diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 00000000..c9702d39 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,680 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + digest = "1:48a213e9dc4880bbbd6999309a476fa4d3cc67560aa7127154cf8ea95bd464c2" + name = "github.com/allegro/bigcache" + packages = [ + ".", + "queue", + ] + pruneopts = "" + revision = "f31987a23e44c5121ef8c8b2f2ea2e8ffa37b068" + version = "v1.1.0" + +[[projects]] + branch = "master" + digest = "1:a313376bcbcce8ae8bddb8089a7293e0473a0f8e9e3710d6244e09e81875ccf0" + name = "github.com/aristanetworks/goarista" + packages = ["monotime"] + pruneopts = "" + revision = "ff33da284e760fcdb03c33d37a719e5ed30ba844" + +[[projects]] + branch = "master" + digest = "1:c6bf1ac7bbc0fe51637bf54d5a88ff79b171b3b42dbc665dec98303c862d8662" + name = "github.com/btcsuite/btcd" + packages = ["btcec"] + pruneopts = "" + revision = "cff30e1d23fc9e800b2b5b4b41ef1817dda07e9f" + +[[projects]] + digest = "1:5d47691333460db6ac83ced03c79b4bdb9aff3e322be24affb7855bed8affc6c" + name = "github.com/dave/jennifer" + packages = ["jen"] + pruneopts = "" + revision = "14e399b6b5e8456c66c45c955fc27b568bacb5c9" + version = "v1.3.0" + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" + version = "v1.1.1" + +[[projects]] + name = "github.com/deckarep/golang-set" + packages = ["."] + pruneopts = "" + revision = "cbaa98ba5575e67703b32b4b19f73c91f3c4159e" + version = "v1.7.1" + +[[projects]] + name = "github.com/edsrzf/mmap-go" + packages = ["."] + revision = "188cc3b666ba704534fa4f96e9e61f21f1e1ba7c" + version = "v1.0.0" + +[[projects]] + name = "github.com/elastic/gosigar" + packages = [ + ".", + "sys/windows" + ] + revision = "f75810decf6f4d88b130bfc4d2ba7ccdcea0c01d" + version = "v0.10.4" + +[[projects]] + branch = "rpc_statediffing" + name = "github.com/ethereum/go-ethereum" + packages = [ + ".", + "accounts", + "accounts/abi", + "accounts/abi/bind", + "accounts/external", + "accounts/keystore", + "accounts/scwallet", + "accounts/usbwallet", + "accounts/usbwallet/trezor", + "common", + "common/bitutil", + "common/hexutil", + "common/math", + "common/mclock", + "common/prque", + "consensus", + "consensus/clique", + "consensus/ethash", + "consensus/misc", + "core", + "core/bloombits", + "core/rawdb", + "core/state", + "core/types", + "core/vm", + "crypto", + "crypto/bn256", + "crypto/bn256/cloudflare", + "crypto/bn256/google", + "crypto/ecies", + "crypto/secp256k1", + "eth/downloader", + "ethclient", + "ethdb", + "ethdb/leveldb", + "ethdb/memorydb", + "event", + "internal/debug", + "internal/ethapi", + "log", + "metrics", + "metrics/exp", + "metrics/prometheus", + "node", + "p2p", + "p2p/discover", + "p2p/discv5", + "p2p/enode", + "p2p/enr", + "p2p/nat", + "p2p/netutil", + "params", + "rlp", + "rpc", + "signer/core", + "signer/storage", + "statediff", + "trie" + ] + revision = "87e6e8e35293f3b9e2e5ce78b79e8a31fa66ea29" + source = "github.com/vulcanize/go-ethereum" + +[[projects]] + branch = "master" + name = "github.com/fjl/memsize" + packages = [ + ".", + "memsizeui" + ] + revision = "bcb5799ab5e5bd6a0fbd8ba513f95a50d9eac048" + +[[projects]] + digest = "1:eb53021a8aa3f599d29c7102e65026242bdedce998a54837dc67f14b6a97c5fd" + name = "github.com/fsnotify/fsnotify" + packages = ["."] + pruneopts = "" + revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" + version = "v1.4.7" + +[[projects]] + branch = "master" + name = "github.com/gballet/go-libpcsclite" + packages = ["."] + revision = "2772fd86a8ff4306d2749f610a386bfee9e0d727" + +[[projects]] + name = "github.com/go-stack/stack" + packages = ["."] + pruneopts = "" + revision = "2fee6af1a9795aafbe0253a0cfbdf668e1fb8a9a" + version = "v1.8.0" + +[[projects]] + digest = "1:3dd078fda7500c341bc26cfbc6c6a34614f295a2457149fc1045cab767cbcf18" + name = "github.com/golang/protobuf" + packages = [ + "proto", + "protoc-gen-go/descriptor" + ] + revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7" + +[[projects]] + branch = "master" + digest = "1:2a5888946cdbc8aa360fd43301f9fc7869d663f60d5eedae7d4e6e5e4f06f2bf" + name = "github.com/golang/snappy" + packages = ["."] + pruneopts = "" + revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" + +[[projects]] + digest = "1:5247b135b5492aa232a731acdcb52b08f32b874cb398f21ab460396eadbe866b" + name = "github.com/google/uuid" + packages = ["."] + pruneopts = "" + revision = "d460ce9f8df2e77fb1ba55ca87fafed96c607494" + version = "v1.0.0" + +[[projects]] + branch = "master" + digest = "1:9c776d7d9c54b7ed89f119e449983c3f24c0023e75001d6092442412ebca6b94" + name = "github.com/hashicorp/golang-lru" + packages = [ + ".", + "simplelru", + ] + pruneopts = "" + revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" + +[[projects]] + digest = "1:d14365c51dd1d34d5c79833ec91413bfbb166be978724f15701e17080dc06dec" + name = "github.com/hashicorp/hcl" + packages = [ + ".", + "hcl/ast", + "hcl/parser", + "hcl/printer", + "hcl/scanner", + "hcl/strconv", + "hcl/token", + "json/parser", + "json/scanner", + "json/token", + ] + pruneopts = "" + revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" + version = "v1.0.0" + +[[projects]] + digest = "1:b3c5b95e56c06f5aa72cb2500e6ee5f44fcd122872d4fec2023a488e561218bc" + name = "github.com/hpcloud/tail" + packages = [ + ".", + "ratelimiter", + "util", + "watch", + "winfile", + ] + pruneopts = "" + revision = "a30252cb686a21eb2d0b98132633053ec2f7f1e5" + version = "v1.0.0" + +[[projects]] + branch = "master" + digest = "1:b6e4cc26365c004808649862e22069de09594a9222143399a7a04904e9f7018c" + name = "github.com/huin/goupnp" + packages = [ + ".", + "dcps/internetgateway1", + "dcps/internetgateway2", + "httpu", + "scpd", + "soap", + "ssdp", + ] + pruneopts = "" + revision = "1395d1447324cbea88d249fbfcfd70ea878fdfca" + +[[projects]] + digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" + name = "github.com/inconshreveable/mousetrap" + packages = ["."] + pruneopts = "" + revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" + version = "v1.0" + +[[projects]] + digest = "1:76f836364ae83ed811c415aa92e1209ce49de9f62aad85b85fca749a8b96a110" + name = "github.com/jackpal/go-nat-pmp" + packages = ["."] + pruneopts = "" + revision = "c9cfead9f2a36ddf3daa40ba269aa7f4bbba6b62" + version = "v1.0.1" + +[[projects]] + branch = "master" + digest = "1:617ee2434b77e911fa26b678730be9a617f75243b194eadc8201c8ac860844aa" + name = "github.com/jmoiron/sqlx" + packages = [ + ".", + "reflectx", + ] + pruneopts = "" + revision = "0dae4fefe7c0e190f7b5a78dac28a1c82cc8d849" + +[[projects]] + branch = "master" + name = "github.com/karalabe/usb" + packages = ["."] + revision = "9be757f914c0907b7ddd561ea86eec15313ac022" + +[[projects]] + name = "github.com/konsorten/go-windows-terminal-sequences" + packages = ["."] + pruneopts = "" + revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242" + version = "v1.0.1" + +[[projects]] + branch = "master" + digest = "1:29145d7af4adafd72a79df5e41456ac9e232d5a28c1cd4dacf3ff008a217fc10" + name = "github.com/lib/pq" + packages = [ + ".", + "oid", + ] + pruneopts = "" + revision = "4ded0e9383f75c197b3a2aaa6d590ac52df6fd79" + +[[projects]] + digest = "1:961dc3b1d11f969370533390fdf203813162980c858e1dabe827b60940c909a5" + name = "github.com/magiconair/properties" + packages = ["."] + pruneopts = "" + revision = "c2353362d570a7bfa228149c62842019201cfb71" + version = "v1.8.0" + +[[projects]] + name = "github.com/mattn/go-colorable" + packages = ["."] + revision = "8029fb3788e5a4a9c00e415f586a6d033f5d38b3" + version = "v0.1.2" + +[[projects]] + name = "github.com/mattn/go-isatty" + packages = ["."] + revision = "1311e847b0cb909da63b5fecfb5370aa66236465" + version = "v0.0.8" + +[[projects]] + name = "github.com/mattn/go-runewidth" + packages = ["."] + revision = "3ee7d812e62a0804a7d0a324e0249ca2db3476d3" + version = "v0.0.4" + +[[projects]] + name = "github.com/mitchellh/go-homedir" + packages = ["."] + pruneopts = "" + revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4" + version = "v1.0.0" + +[[projects]] + digest = "1:5219b4506253ccc598f9340677162a42d6a78f340a4cc6df2d62db4d0593c4e9" + name = "github.com/mitchellh/mapstructure" + packages = ["."] + pruneopts = "" + revision = "fa473d140ef3c6adf42d6b391fe76707f1f243c8" + version = "v1.0.0" + +[[projects]] + name = "github.com/olekukonko/tablewriter" + packages = ["."] + revision = "e6d60cf7ba1f42d86d54cdf5508611c4aafb3970" + version = "v0.0.1" + +[[projects]] + name = "github.com/onsi/ginkgo" + packages = [ + ".", + "config", + "internal/codelocation", + "internal/containernode", + "internal/failer", + "internal/leafnodes", + "internal/remote", + "internal/spec", + "internal/spec_iterator", + "internal/specrunner", + "internal/suite", + "internal/testingtproxy", + "internal/writer", + "reporters", + "reporters/stenographer", + "reporters/stenographer/support/go-colorable", + "reporters/stenographer/support/go-isatty", + "types", + ] + pruneopts = "" + revision = "3774a09d95489ccaa16032e0770d08ea77ba6184" + version = "v1.6.0" + +[[projects]] + digest = "1:3ecd0a37c4a90c12a97e31c398cdbc173824351aa891898ee178120bfe71c478" + name = "github.com/onsi/gomega" + packages = [ + ".", + "format", + "ghttp", + "internal/assertion", + "internal/asyncassertion", + "internal/oraclematcher", + "internal/testingtsupport", + "matchers", + "matchers/support/goraph/bipartitegraph", + "matchers/support/goraph/edge", + "matchers/support/goraph/node", + "matchers/support/goraph/util", + "types", + ] + pruneopts = "" + revision = "7615b9433f86a8bdf29709bf288bc4fd0636a369" + version = "v1.4.2" + +[[projects]] + digest = "1:a5484d4fa43127138ae6e7b2299a6a52ae006c7f803d98d717f60abf3e97192e" + name = "github.com/pborman/uuid" + packages = ["."] + pruneopts = "" + revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1" + version = "v1.2" + +[[projects]] + digest = "1:894aef961c056b6d85d12bac890bf60c44e99b46292888bfa66caf529f804457" + name = "github.com/pelletier/go-toml" + packages = ["."] + pruneopts = "" + revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194" + version = "v1.2.0" + +[[projects]] + digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d" + name = "github.com/pkg/errors" + packages = ["."] + pruneopts = "" + revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" + version = "v0.8.1" + +[[projects]] + digest = "1:fdbe7e05d74cc4d175cc4515a7807a5bb8b66ebe130da382b99713c9038648ae" + name = "github.com/pressly/goose" + packages = ["."] + pruneopts = "" + revision = "e4b98955473e91a12fc7d8816c28d06376d1d92c" + version = "v2.6.0" + +[[projects]] + name = "github.com/prometheus/tsdb" + packages = ["fileutil"] + revision = "d230c67aa180850b80ae49e07079f55df1da0502" + version = "v0.9.1" + +[[projects]] + name = "github.com/rjeczalik/notify" + packages = ["."] + pruneopts = "" + revision = "0f065fa99b48b842c3fd3e2c8b194c6f2b69f6b8" + version = "v0.9.1" + +[[projects]] + digest = "1:78c9cf43ddeacd0e472f412082227a0fac2ae107ee60e9112156f9371f9912cf" + name = "github.com/rs/cors" + packages = ["."] + pruneopts = "" + revision = "3fb1b69b103a84de38a19c3c6ec073dd6caa4d3f" + version = "v1.5.0" + +[[projects]] + digest = "1:9d57e200ef5ccc4217fe0a34287308bac652435e7c6513f6263e0493d2245c56" + name = "github.com/sirupsen/logrus" + packages = ["."] + pruneopts = "" + revision = "bcd833dfe83d3cebad139e4a29ed79cb2318bf95" + version = "v1.2.0" + +[[projects]] + digest = "1:d0431c2fd72e39ee43ea7742322abbc200c3e704c9102c5c3c2e2e667095b0ca" + name = "github.com/spf13/afero" + packages = [ + ".", + "mem", + ] + pruneopts = "" + revision = "d40851caa0d747393da1ffb28f7f9d8b4eeffebd" + version = "v1.1.2" + +[[projects]] + digest = "1:d0b38ba6da419a6d4380700218eeec8623841d44a856bb57369c172fbf692ab4" + name = "github.com/spf13/cast" + packages = ["."] + pruneopts = "" + revision = "8965335b8c7107321228e3e3702cab9832751bac" + version = "v1.2.0" + +[[projects]] + digest = "1:a1403cc8a94b8d7956ee5e9694badef0e7b051af289caad1cf668331e3ffa4f6" + name = "github.com/spf13/cobra" + packages = ["."] + pruneopts = "" + revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" + version = "v0.0.3" + +[[projects]] + digest = "1:9ceffa4ab5f7195ecf18b3a7fff90c837a9ed5e22e66d18069e4bccfe1f52aa0" + name = "github.com/spf13/jwalterweatherman" + packages = ["."] + pruneopts = "" + revision = "4a4406e478ca629068e7768fc33f3f044173c0a6" + version = "v1.0.0" + +[[projects]] + digest = "1:0a52bcb568386d98f4894575d53ce3e456f56471de6897bb8b9de13c33d9340e" + name = "github.com/spf13/pflag" + packages = ["."] + pruneopts = "" + revision = "9a97c102cda95a86cec2345a6f09f55a939babf5" + version = "v1.0.2" + +[[projects]] + digest = "1:ac25ea6cc1156aca9611411274b4a0bdd83a623845df6985aab508253955cc66" + name = "github.com/spf13/viper" + packages = ["."] + pruneopts = "" + revision = "8fb642006536c8d3760c99d4fa2389f5e2205631" + version = "v1.2.0" + +[[projects]] + branch = "develop" + name = "github.com/status-im/keycard-go" + packages = ["derivationpath"] + revision = "d95853db0f480b9d6379009500acf44b21dc0be6" + +[[projects]] + name = "github.com/steakknife/bloomfilter" + packages = ["."] + revision = "99ee86d9200fcc2ffde62f508329bd6627c0a307" + version = "1.0.4" + +[[projects]] + name = "github.com/steakknife/hamming" + packages = ["."] + revision = "003c143a81c25ea5e263d692919c611c7122ae6b" + version = "0.2.5" + +[[projects]] + branch = "master" + digest = "1:ce5194e5afac308cc34e500cab45b4ce88a0742d689e3cf7e37b607ad76bed2f" + name = "github.com/syndtr/goleveldb" + packages = [ + "leveldb", + "leveldb/cache", + "leveldb/comparer", + "leveldb/errors", + "leveldb/filter", + "leveldb/iterator", + "leveldb/journal", + "leveldb/memdb", + "leveldb/opt", + "leveldb/storage", + "leveldb/table", + "leveldb/util", + ] + pruneopts = "" + revision = "ae2bd5eed72d46b28834ec3f60db3a3ebedd8dbd" + +[[projects]] + name = "github.com/tyler-smith/go-bip39" + packages = [ + ".", + "wordlists" + ] + revision = "2af0a847066a4f2669040ccd44a79c8eca10806a" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "github.com/wsddn/go-ecdh" + packages = ["."] + revision = "48726bab92085232373de4ec5c51ce7b441c63a0" + +[[projects]] + branch = "master" + digest = "1:59b49c47c11a48f1054529207f65907c014ecf5f9a7c0d9c0f1616dec7b062ed" + name = "golang.org/x/crypto" + packages = [ + "curve25519", + "pbkdf2", + "ripemd160", + "scrypt", + "sha3", + "ssh/terminal", + ] + pruneopts = "" + revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908" + +[[projects]] + branch = "master" + digest = "1:fbdbb6cf8db3278412c9425ad78b26bb8eb788181f26a3ffb3e4f216b314f86a" + name = "golang.org/x/net" + packages = [ + "context", + "html", + "html/atom", + "html/charset", + ] + pruneopts = "" + revision = "26e67e76b6c3f6ce91f7c52def5af501b4e0f3a2" + +[[projects]] + branch = "master" + digest = "1:b2ea75de0ccb2db2ac79356407f8a4cd8f798fe15d41b381c00abf3ae8e55ed1" + name = "golang.org/x/sync" + packages = ["errgroup"] + pruneopts = "" + revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" + +[[projects]] + branch = "master" + digest = "1:70d519d5cddeb60ceda2db88c24c340b1b2d7efb25ab54bacb38f57ea1998df7" + name = "golang.org/x/sys" + packages = [ + "cpu", + "unix", + "windows", + ] + pruneopts = "" + revision = "d641721ec2dead6fe5ca284096fe4b1fcd49e427" + +[[projects]] + digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4" + name = "golang.org/x/text" + packages = [ + "encoding", + "encoding/charmap", + "encoding/htmlindex", + "encoding/internal", + "encoding/internal/identifier", + "encoding/japanese", + "encoding/korean", + "encoding/simplifiedchinese", + "encoding/traditionalchinese", + "encoding/unicode", + "internal/gen", + "internal/tag", + "internal/triegen", + "internal/ucd", + "internal/utf8internal", + "language", + "runes", + "transform", + "unicode/cldr", + "unicode/norm", + ] + pruneopts = "" + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" + +[[projects]] + digest = "1:eb53021a8aa3f599d29c7102e65026242bdedce998a54837dc67f14b6a97c5fd" + name = "gopkg.in/fsnotify.v1" + packages = ["."] + pruneopts = "" + revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" + source = "gopkg.in/fsnotify/fsnotify.v1" + version = "v1.4.7" + +[[projects]] + branch = "v2" + digest = "1:4f830ee018eb8c56d0def653ad7c9a1d2a053f0cef2ac6b2200f73b98fa6a681" + name = "gopkg.in/natefinch/npipe.v2" + packages = ["."] + pruneopts = "" + revision = "c1b8fa8bdccecb0b8db834ee0b92fdbcfa606dd6" + +[[projects]] + branch = "v1" + digest = "1:a96d16bd088460f2e0685d46c39bcf1208ba46e0a977be2df49864ec7da447dd" + name = "gopkg.in/tomb.v1" + packages = ["."] + pruneopts = "" + revision = "dd632973f1e7218eb1089048e0798ec9ae7dceb8" + +[[projects]] + name = "gopkg.in/urfave/cli.v1" + packages = ["."] + revision = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1" + version = "v1.20.0" + +[[projects]] + name = "gopkg.in/yaml.v2" + packages = ["."] + pruneopts = "" + revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" + version = "v2.2.1" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "e6774f47f8a8401fcdd5d1a8329514dbc8f0a4e81ab356e2779e8866153e5d43" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 63398eb8..ff1e9559 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -58,6 +58,10 @@ name = "github.com/dgraph-io/badger" revision = "0ce1d2e26af1ba8b8a72ea864145a3e1e3b382cd" +[[override]] + name = "github.com/golang/protobuf" + revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7" + [prune] go-tests = true unused-packages = true diff --git a/vendor/bazil.org/fuse/.gitattributes b/vendor/bazil.org/fuse/.gitattributes deleted file mode 100644 index b65f2a9f..00000000 --- a/vendor/bazil.org/fuse/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.go filter=gofmt -*.cgo filter=gofmt diff --git a/vendor/bazil.org/fuse/.gitignore b/vendor/bazil.org/fuse/.gitignore deleted file mode 100644 index 53589948..00000000 --- a/vendor/bazil.org/fuse/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -*~ -.#* -## the next line needs to start with a backslash to avoid looking like -## a comment -\#*# -.*.swp - -*.test - -/clockfs -/hellofs diff --git a/vendor/bazil.org/fuse/LICENSE b/vendor/bazil.org/fuse/LICENSE deleted file mode 100644 index 4ac7cd83..00000000 --- a/vendor/bazil.org/fuse/LICENSE +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2013-2015 Tommi Virtanen. -Copyright (c) 2009, 2011, 2012 The Go Authors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -The following included software components have additional copyright -notices and license terms that may differ from the above. - - -File fuse.go: - -// Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, -// which carries this notice: -// -// The files in this directory are subject to the following license. -// -// The author of this software is Russ Cox. -// -// Copyright (c) 2006 Russ Cox -// -// Permission to use, copy, modify, and distribute this software for any -// purpose without fee is hereby granted, provided that this entire notice -// is included in all copies of any software which is or includes a copy -// or modification of this software and in all copies of the supporting -// documentation for such software. -// -// THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION OR WARRANTY -// OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS -// FITNESS FOR ANY PARTICULAR PURPOSE. - - -File fuse_kernel.go: - -// Derived from FUSE's fuse_kernel.h -/* - This file defines the kernel interface of FUSE - Copyright (C) 2001-2007 Miklos Szeredi - - - This -- and only this -- header file may also be distributed under - the terms of the BSD Licence as follows: - - Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ diff --git a/vendor/bazil.org/fuse/README.md b/vendor/bazil.org/fuse/README.md deleted file mode 100644 index 8c6d556e..00000000 --- a/vendor/bazil.org/fuse/README.md +++ /dev/null @@ -1,23 +0,0 @@ -bazil.org/fuse -- Filesystems in Go -=================================== - -`bazil.org/fuse` is a Go library for writing FUSE userspace -filesystems. - -It is a from-scratch implementation of the kernel-userspace -communication protocol, and does not use the C library from the -project called FUSE. `bazil.org/fuse` embraces Go fully for safety and -ease of programming. - -Here’s how to get going: - - go get bazil.org/fuse - -Website: http://bazil.org/fuse/ - -Github repository: https://github.com/bazil/fuse - -API docs: http://godoc.org/bazil.org/fuse - -Our thanks to Russ Cox for his fuse library, which this project is -based on. diff --git a/vendor/bazil.org/fuse/buffer.go b/vendor/bazil.org/fuse/buffer.go deleted file mode 100644 index bb1d2b77..00000000 --- a/vendor/bazil.org/fuse/buffer.go +++ /dev/null @@ -1,35 +0,0 @@ -package fuse - -import "unsafe" - -// buffer provides a mechanism for constructing a message from -// multiple segments. -type buffer []byte - -// alloc allocates size bytes and returns a pointer to the new -// segment. -func (w *buffer) alloc(size uintptr) unsafe.Pointer { - s := int(size) - if len(*w)+s > cap(*w) { - old := *w - *w = make([]byte, len(*w), 2*cap(*w)+s) - copy(*w, old) - } - l := len(*w) - *w = (*w)[:l+s] - return unsafe.Pointer(&(*w)[l]) -} - -// reset clears out the contents of the buffer. -func (w *buffer) reset() { - for i := range (*w)[:cap(*w)] { - (*w)[i] = 0 - } - *w = (*w)[:0] -} - -func newBuffer(extra uintptr) buffer { - const hdrSize = unsafe.Sizeof(outHeader{}) - buf := make(buffer, hdrSize, hdrSize+extra) - return buf -} diff --git a/vendor/bazil.org/fuse/debug.go b/vendor/bazil.org/fuse/debug.go deleted file mode 100644 index be9f900d..00000000 --- a/vendor/bazil.org/fuse/debug.go +++ /dev/null @@ -1,21 +0,0 @@ -package fuse - -import ( - "runtime" -) - -func stack() string { - buf := make([]byte, 1024) - return string(buf[:runtime.Stack(buf, false)]) -} - -func nop(msg interface{}) {} - -// Debug is called to output debug messages, including protocol -// traces. The default behavior is to do nothing. -// -// The messages have human-friendly string representations and are -// safe to marshal to JSON. -// -// Implementations must not retain msg. -var Debug func(msg interface{}) = nop diff --git a/vendor/bazil.org/fuse/error_darwin.go b/vendor/bazil.org/fuse/error_darwin.go deleted file mode 100644 index a3fb89ca..00000000 --- a/vendor/bazil.org/fuse/error_darwin.go +++ /dev/null @@ -1,17 +0,0 @@ -package fuse - -import ( - "syscall" -) - -const ( - ENOATTR = Errno(syscall.ENOATTR) -) - -const ( - errNoXattr = ENOATTR -) - -func init() { - errnoNames[errNoXattr] = "ENOATTR" -} diff --git a/vendor/bazil.org/fuse/error_freebsd.go b/vendor/bazil.org/fuse/error_freebsd.go deleted file mode 100644 index c6ea6d6e..00000000 --- a/vendor/bazil.org/fuse/error_freebsd.go +++ /dev/null @@ -1,15 +0,0 @@ -package fuse - -import "syscall" - -const ( - ENOATTR = Errno(syscall.ENOATTR) -) - -const ( - errNoXattr = ENOATTR -) - -func init() { - errnoNames[errNoXattr] = "ENOATTR" -} diff --git a/vendor/bazil.org/fuse/error_linux.go b/vendor/bazil.org/fuse/error_linux.go deleted file mode 100644 index 6f113e71..00000000 --- a/vendor/bazil.org/fuse/error_linux.go +++ /dev/null @@ -1,17 +0,0 @@ -package fuse - -import ( - "syscall" -) - -const ( - ENODATA = Errno(syscall.ENODATA) -) - -const ( - errNoXattr = ENODATA -) - -func init() { - errnoNames[errNoXattr] = "ENODATA" -} diff --git a/vendor/bazil.org/fuse/error_std.go b/vendor/bazil.org/fuse/error_std.go deleted file mode 100644 index 398f43fb..00000000 --- a/vendor/bazil.org/fuse/error_std.go +++ /dev/null @@ -1,31 +0,0 @@ -package fuse - -// There is very little commonality in extended attribute errors -// across platforms. -// -// getxattr return value for "extended attribute does not exist" is -// ENOATTR on OS X, and ENODATA on Linux and apparently at least -// NetBSD. There may be a #define ENOATTR on Linux too, but the value -// is ENODATA in the actual syscalls. FreeBSD and OpenBSD have no -// ENODATA, only ENOATTR. ENOATTR is not in any of the standards, -// ENODATA exists but is only used for STREAMs. -// -// Each platform will define it a errNoXattr constant, and this file -// will enforce that it implements the right interfaces and hide the -// implementation. -// -// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/getxattr.2.html -// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013090.html -// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013097.html -// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html -// http://www.freebsd.org/cgi/man.cgi?query=extattr_get_file&sektion=2 -// http://nixdoc.net/man-pages/openbsd/man2/extattr_get_file.2.html - -// ErrNoXattr is a platform-independent error value meaning the -// extended attribute was not found. It can be used to respond to -// GetxattrRequest and such. -const ErrNoXattr = errNoXattr - -var _ error = ErrNoXattr -var _ Errno = ErrNoXattr -var _ ErrorNumber = ErrNoXattr diff --git a/vendor/bazil.org/fuse/fs/serve.go b/vendor/bazil.org/fuse/fs/serve.go deleted file mode 100644 index e9fc5659..00000000 --- a/vendor/bazil.org/fuse/fs/serve.go +++ /dev/null @@ -1,1568 +0,0 @@ -// FUSE service loop, for servers that wish to use it. - -package fs // import "bazil.org/fuse/fs" - -import ( - "encoding/binary" - "fmt" - "hash/fnv" - "io" - "log" - "reflect" - "runtime" - "strings" - "sync" - "time" - - "golang.org/x/net/context" -) - -import ( - "bytes" - - "bazil.org/fuse" - "bazil.org/fuse/fuseutil" -) - -const ( - attrValidTime = 1 * time.Minute - entryValidTime = 1 * time.Minute -) - -// TODO: FINISH DOCS - -// An FS is the interface required of a file system. -// -// Other FUSE requests can be handled by implementing methods from the -// FS* interfaces, for example FSStatfser. -type FS interface { - // Root is called to obtain the Node for the file system root. - Root() (Node, error) -} - -type FSStatfser interface { - // Statfs is called to obtain file system metadata. - // It should write that data to resp. - Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error -} - -type FSDestroyer interface { - // Destroy is called when the file system is shutting down. - // - // Linux only sends this request for block device backed (fuseblk) - // filesystems, to allow them to flush writes to disk before the - // unmount completes. - Destroy() -} - -type FSInodeGenerator interface { - // GenerateInode is called to pick a dynamic inode number when it - // would otherwise be 0. - // - // Not all filesystems bother tracking inodes, but FUSE requires - // the inode to be set, and fewer duplicates in general makes UNIX - // tools work better. - // - // Operations where the nodes may return 0 inodes include Getattr, - // Setattr and ReadDir. - // - // If FS does not implement FSInodeGenerator, GenerateDynamicInode - // is used. - // - // Implementing this is useful to e.g. constrain the range of - // inode values used for dynamic inodes. - GenerateInode(parentInode uint64, name string) uint64 -} - -// A Node is the interface required of a file or directory. -// See the documentation for type FS for general information -// pertaining to all methods. -// -// A Node must be usable as a map key, that is, it cannot be a -// function, map or slice. -// -// Other FUSE requests can be handled by implementing methods from the -// Node* interfaces, for example NodeOpener. -// -// Methods returning Node should take care to return the same Node -// when the result is logically the same instance. Without this, each -// Node will get a new NodeID, causing spurious cache invalidations, -// extra lookups and aliasing anomalies. This may not matter for a -// simple, read-only filesystem. -type Node interface { - // Attr fills attr with the standard metadata for the node. - // - // Fields with reasonable defaults are prepopulated. For example, - // all times are set to a fixed moment when the program started. - // - // If Inode is left as 0, a dynamic inode number is chosen. - // - // The result may be cached for the duration set in Valid. - Attr(ctx context.Context, attr *fuse.Attr) error -} - -type NodeGetattrer interface { - // Getattr obtains the standard metadata for the receiver. - // It should store that metadata in resp. - // - // If this method is not implemented, the attributes will be - // generated based on Attr(), with zero values filled in. - Getattr(ctx context.Context, req *fuse.GetattrRequest, resp *fuse.GetattrResponse) error -} - -type NodeSetattrer interface { - // Setattr sets the standard metadata for the receiver. - // - // Note, this is also used to communicate changes in the size of - // the file, outside of Writes. - // - // req.Valid is a bitmask of what fields are actually being set. - // For example, the method should not change the mode of the file - // unless req.Valid.Mode() is true. - Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error -} - -type NodeSymlinker interface { - // Symlink creates a new symbolic link in the receiver, which must be a directory. - // - // TODO is the above true about directories? - Symlink(ctx context.Context, req *fuse.SymlinkRequest) (Node, error) -} - -// This optional request will be called only for symbolic link nodes. -type NodeReadlinker interface { - // Readlink reads a symbolic link. - Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) -} - -type NodeLinker interface { - // Link creates a new directory entry in the receiver based on an - // existing Node. Receiver must be a directory. - Link(ctx context.Context, req *fuse.LinkRequest, old Node) (Node, error) -} - -type NodeRemover interface { - // Remove removes the entry with the given name from - // the receiver, which must be a directory. The entry to be removed - // may correspond to a file (unlink) or to a directory (rmdir). - Remove(ctx context.Context, req *fuse.RemoveRequest) error -} - -type NodeAccesser interface { - // Access checks whether the calling context has permission for - // the given operations on the receiver. If so, Access should - // return nil. If not, Access should return EPERM. - // - // Note that this call affects the result of the access(2) system - // call but not the open(2) system call. If Access is not - // implemented, the Node behaves as if it always returns nil - // (permission granted), relying on checks in Open instead. - Access(ctx context.Context, req *fuse.AccessRequest) error -} - -type NodeStringLookuper interface { - // Lookup looks up a specific entry in the receiver, - // which must be a directory. Lookup should return a Node - // corresponding to the entry. If the name does not exist in - // the directory, Lookup should return ENOENT. - // - // Lookup need not to handle the names "." and "..". - Lookup(ctx context.Context, name string) (Node, error) -} - -type NodeRequestLookuper interface { - // Lookup looks up a specific entry in the receiver. - // See NodeStringLookuper for more. - Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (Node, error) -} - -type NodeMkdirer interface { - Mkdir(ctx context.Context, req *fuse.MkdirRequest) (Node, error) -} - -type NodeOpener interface { - // Open opens the receiver. After a successful open, a client - // process has a file descriptor referring to this Handle. - // - // Open can also be also called on non-files. For example, - // directories are Opened for ReadDir or fchdir(2). - // - // If this method is not implemented, the open will always - // succeed, and the Node itself will be used as the Handle. - // - // XXX note about access. XXX OpenFlags. - Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (Handle, error) -} - -type NodeCreater interface { - // Create creates a new directory entry in the receiver, which - // must be a directory. - Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (Node, Handle, error) -} - -type NodeForgetter interface { - // Forget about this node. This node will not receive further - // method calls. - // - // Forget is not necessarily seen on unmount, as all nodes are - // implicitly forgotten as part part of the unmount. - Forget() -} - -type NodeRenamer interface { - Rename(ctx context.Context, req *fuse.RenameRequest, newDir Node) error -} - -type NodeMknoder interface { - Mknod(ctx context.Context, req *fuse.MknodRequest) (Node, error) -} - -// TODO this should be on Handle not Node -type NodeFsyncer interface { - Fsync(ctx context.Context, req *fuse.FsyncRequest) error -} - -type NodeGetxattrer interface { - // Getxattr gets an extended attribute by the given name from the - // node. - // - // If there is no xattr by that name, returns fuse.ErrNoXattr. - Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error -} - -type NodeListxattrer interface { - // Listxattr lists the extended attributes recorded for the node. - Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error -} - -type NodeSetxattrer interface { - // Setxattr sets an extended attribute with the given name and - // value for the node. - Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error -} - -type NodeRemovexattrer interface { - // Removexattr removes an extended attribute for the name. - // - // If there is no xattr by that name, returns fuse.ErrNoXattr. - Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error -} - -var startTime = time.Now() - -func nodeAttr(ctx context.Context, n Node, attr *fuse.Attr) error { - attr.Valid = attrValidTime - attr.Nlink = 1 - attr.Atime = startTime - attr.Mtime = startTime - attr.Ctime = startTime - attr.Crtime = startTime - if err := n.Attr(ctx, attr); err != nil { - return err - } - return nil -} - -// A Handle is the interface required of an opened file or directory. -// See the documentation for type FS for general information -// pertaining to all methods. -// -// Other FUSE requests can be handled by implementing methods from the -// Handle* interfaces. The most common to implement are HandleReader, -// HandleReadDirer, and HandleWriter. -// -// TODO implement methods: Getlk, Setlk, Setlkw -type Handle interface { -} - -type HandleFlusher interface { - // Flush is called each time the file or directory is closed. - // Because there can be multiple file descriptors referring to a - // single opened file, Flush can be called multiple times. - Flush(ctx context.Context, req *fuse.FlushRequest) error -} - -type HandleReadAller interface { - ReadAll(ctx context.Context) ([]byte, error) -} - -type HandleReadDirAller interface { - ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) -} - -type HandleReader interface { - // Read requests to read data from the handle. - // - // There is a page cache in the kernel that normally submits only - // page-aligned reads spanning one or more pages. However, you - // should not rely on this. To see individual requests as - // submitted by the file system clients, set OpenDirectIO. - // - // Note that reads beyond the size of the file as reported by Attr - // are not even attempted (except in OpenDirectIO mode). - Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error -} - -type HandleWriter interface { - // Write requests to write data into the handle at the given offset. - // Store the amount of data written in resp.Size. - // - // There is a writeback page cache in the kernel that normally submits - // only page-aligned writes spanning one or more pages. However, - // you should not rely on this. To see individual requests as - // submitted by the file system clients, set OpenDirectIO. - // - // Writes that grow the file are expected to update the file size - // (as seen through Attr). Note that file size changes are - // communicated also through Setattr. - Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error -} - -type HandleReleaser interface { - Release(ctx context.Context, req *fuse.ReleaseRequest) error -} - -type Config struct { - // Function to send debug log messages to. If nil, use fuse.Debug. - // Note that changing this or fuse.Debug may not affect existing - // calls to Serve. - // - // See fuse.Debug for the rules that log functions must follow. - Debug func(msg interface{}) - - // Function to put things into context for processing the request. - // The returned context must have ctx as its parent. - // - // Note that changing this may not affect existing calls to Serve. - // - // Must not retain req. - WithContext func(ctx context.Context, req fuse.Request) context.Context -} - -// New returns a new FUSE server ready to serve this kernel FUSE -// connection. -// -// Config may be nil. -func New(conn *fuse.Conn, config *Config) *Server { - s := &Server{ - conn: conn, - req: map[fuse.RequestID]*serveRequest{}, - nodeRef: map[Node]fuse.NodeID{}, - dynamicInode: GenerateDynamicInode, - } - if config != nil { - s.debug = config.Debug - s.context = config.WithContext - } - if s.debug == nil { - s.debug = fuse.Debug - } - return s -} - -type Server struct { - // set in New - conn *fuse.Conn - debug func(msg interface{}) - context func(ctx context.Context, req fuse.Request) context.Context - - // set once at Serve time - fs FS - dynamicInode func(parent uint64, name string) uint64 - - // state, protected by meta - meta sync.Mutex - req map[fuse.RequestID]*serveRequest - node []*serveNode - nodeRef map[Node]fuse.NodeID - handle []*serveHandle - freeNode []fuse.NodeID - freeHandle []fuse.HandleID - nodeGen uint64 - - // Used to ensure worker goroutines finish before Serve returns - wg sync.WaitGroup -} - -// Serve serves the FUSE connection by making calls to the methods -// of fs and the Nodes and Handles it makes available. It returns only -// when the connection has been closed or an unexpected error occurs. -func (s *Server) Serve(fs FS) error { - defer s.wg.Wait() // Wait for worker goroutines to complete before return - - s.fs = fs - if dyn, ok := fs.(FSInodeGenerator); ok { - s.dynamicInode = dyn.GenerateInode - } - - root, err := fs.Root() - if err != nil { - return fmt.Errorf("cannot obtain root node: %v", err) - } - // Recognize the root node if it's ever returned from Lookup, - // passed to Invalidate, etc. - s.nodeRef[root] = 1 - s.node = append(s.node, nil, &serveNode{ - inode: 1, - generation: s.nodeGen, - node: root, - refs: 1, - }) - s.handle = append(s.handle, nil) - - for { - req, err := s.conn.ReadRequest() - if err != nil { - if err == io.EOF { - break - } - return err - } - - s.wg.Add(1) - go func() { - defer s.wg.Done() - s.serve(req) - }() - } - return nil -} - -// Serve serves a FUSE connection with the default settings. See -// Server.Serve. -func Serve(c *fuse.Conn, fs FS) error { - server := New(c, nil) - return server.Serve(fs) -} - -type nothing struct{} - -type serveRequest struct { - Request fuse.Request - cancel func() -} - -type serveNode struct { - inode uint64 - generation uint64 - node Node - refs uint64 - - // Delay freeing the NodeID until waitgroup is done. This allows - // using the NodeID for short periods of time without holding the - // Server.meta lock. - // - // Rules: - // - // - hold Server.meta while calling wg.Add, then unlock - // - do NOT try to reacquire Server.meta - wg sync.WaitGroup -} - -func (sn *serveNode) attr(ctx context.Context, attr *fuse.Attr) error { - err := nodeAttr(ctx, sn.node, attr) - if attr.Inode == 0 { - attr.Inode = sn.inode - } - return err -} - -type serveHandle struct { - handle Handle - readData []byte - nodeID fuse.NodeID -} - -// NodeRef is deprecated. It remains here to decrease code churn on -// FUSE library users. You may remove it from your program now; -// returning the same Node values are now recognized automatically, -// without needing NodeRef. -type NodeRef struct{} - -func (c *Server) saveNode(inode uint64, node Node) (id fuse.NodeID, gen uint64) { - c.meta.Lock() - defer c.meta.Unlock() - - if id, ok := c.nodeRef[node]; ok { - sn := c.node[id] - sn.refs++ - return id, sn.generation - } - - sn := &serveNode{inode: inode, node: node, refs: 1} - if n := len(c.freeNode); n > 0 { - id = c.freeNode[n-1] - c.freeNode = c.freeNode[:n-1] - c.node[id] = sn - c.nodeGen++ - } else { - id = fuse.NodeID(len(c.node)) - c.node = append(c.node, sn) - } - sn.generation = c.nodeGen - c.nodeRef[node] = id - return id, sn.generation -} - -func (c *Server) saveHandle(handle Handle, nodeID fuse.NodeID) (id fuse.HandleID) { - c.meta.Lock() - shandle := &serveHandle{handle: handle, nodeID: nodeID} - if n := len(c.freeHandle); n > 0 { - id = c.freeHandle[n-1] - c.freeHandle = c.freeHandle[:n-1] - c.handle[id] = shandle - } else { - id = fuse.HandleID(len(c.handle)) - c.handle = append(c.handle, shandle) - } - c.meta.Unlock() - return -} - -type nodeRefcountDropBug struct { - N uint64 - Refs uint64 - Node fuse.NodeID -} - -func (n *nodeRefcountDropBug) String() string { - return fmt.Sprintf("bug: trying to drop %d of %d references to %v", n.N, n.Refs, n.Node) -} - -func (c *Server) dropNode(id fuse.NodeID, n uint64) (forget bool) { - c.meta.Lock() - defer c.meta.Unlock() - snode := c.node[id] - - if snode == nil { - // this should only happen if refcounts kernel<->us disagree - // *and* two ForgetRequests for the same node race each other; - // this indicates a bug somewhere - c.debug(nodeRefcountDropBug{N: n, Node: id}) - - // we may end up triggering Forget twice, but that's better - // than not even once, and that's the best we can do - return true - } - - if n > snode.refs { - c.debug(nodeRefcountDropBug{N: n, Refs: snode.refs, Node: id}) - n = snode.refs - } - - snode.refs -= n - if snode.refs == 0 { - snode.wg.Wait() - c.node[id] = nil - delete(c.nodeRef, snode.node) - c.freeNode = append(c.freeNode, id) - return true - } - return false -} - -func (c *Server) dropHandle(id fuse.HandleID) { - c.meta.Lock() - c.handle[id] = nil - c.freeHandle = append(c.freeHandle, id) - c.meta.Unlock() -} - -type missingHandle struct { - Handle fuse.HandleID - MaxHandle fuse.HandleID -} - -func (m missingHandle) String() string { - return fmt.Sprint("missing handle: ", m.Handle, m.MaxHandle) -} - -// Returns nil for invalid handles. -func (c *Server) getHandle(id fuse.HandleID) (shandle *serveHandle) { - c.meta.Lock() - defer c.meta.Unlock() - if id < fuse.HandleID(len(c.handle)) { - shandle = c.handle[uint(id)] - } - if shandle == nil { - c.debug(missingHandle{ - Handle: id, - MaxHandle: fuse.HandleID(len(c.handle)), - }) - } - return -} - -type request struct { - Op string - Request *fuse.Header - In interface{} `json:",omitempty"` -} - -func (r request) String() string { - return fmt.Sprintf("<- %s", r.In) -} - -type logResponseHeader struct { - ID fuse.RequestID -} - -func (m logResponseHeader) String() string { - return fmt.Sprintf("ID=%v", m.ID) -} - -type response struct { - Op string - Request logResponseHeader - Out interface{} `json:",omitempty"` - // Errno contains the errno value as a string, for example "EPERM". - Errno string `json:",omitempty"` - // Error may contain a free form error message. - Error string `json:",omitempty"` -} - -func (r response) errstr() string { - s := r.Errno - if r.Error != "" { - // prefix the errno constant to the long form message - s = s + ": " + r.Error - } - return s -} - -func (r response) String() string { - switch { - case r.Errno != "" && r.Out != nil: - return fmt.Sprintf("-> [%v] %v error=%s", r.Request, r.Out, r.errstr()) - case r.Errno != "": - return fmt.Sprintf("-> [%v] %s error=%s", r.Request, r.Op, r.errstr()) - case r.Out != nil: - // make sure (seemingly) empty values are readable - switch r.Out.(type) { - case string: - return fmt.Sprintf("-> [%v] %s %q", r.Request, r.Op, r.Out) - case []byte: - return fmt.Sprintf("-> [%v] %s [% x]", r.Request, r.Op, r.Out) - default: - return fmt.Sprintf("-> [%v] %v", r.Request, r.Out) - } - default: - return fmt.Sprintf("-> [%v] %s", r.Request, r.Op) - } -} - -type notification struct { - Op string - Node fuse.NodeID - Out interface{} `json:",omitempty"` - Err string `json:",omitempty"` -} - -func (n notification) String() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "=> %s %v", n.Op, n.Node) - if n.Out != nil { - // make sure (seemingly) empty values are readable - switch n.Out.(type) { - case string: - fmt.Fprintf(&buf, " %q", n.Out) - case []byte: - fmt.Fprintf(&buf, " [% x]", n.Out) - default: - fmt.Fprintf(&buf, " %s", n.Out) - } - } - if n.Err != "" { - fmt.Fprintf(&buf, " Err:%v", n.Err) - } - return buf.String() -} - -type logMissingNode struct { - MaxNode fuse.NodeID -} - -func opName(req fuse.Request) string { - t := reflect.Indirect(reflect.ValueOf(req)).Type() - s := t.Name() - s = strings.TrimSuffix(s, "Request") - return s -} - -type logLinkRequestOldNodeNotFound struct { - Request *fuse.Header - In *fuse.LinkRequest -} - -func (m *logLinkRequestOldNodeNotFound) String() string { - return fmt.Sprintf("In LinkRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.OldNode) -} - -type renameNewDirNodeNotFound struct { - Request *fuse.Header - In *fuse.RenameRequest -} - -func (m *renameNewDirNodeNotFound) String() string { - return fmt.Sprintf("In RenameRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.NewDir) -} - -type handlerPanickedError struct { - Request interface{} - Err interface{} -} - -var _ error = handlerPanickedError{} - -func (h handlerPanickedError) Error() string { - return fmt.Sprintf("handler panicked: %v", h.Err) -} - -var _ fuse.ErrorNumber = handlerPanickedError{} - -func (h handlerPanickedError) Errno() fuse.Errno { - if err, ok := h.Err.(fuse.ErrorNumber); ok { - return err.Errno() - } - return fuse.DefaultErrno -} - -// handlerTerminatedError happens when a handler terminates itself -// with runtime.Goexit. This is most commonly because of incorrect use -// of testing.TB.FailNow, typically via t.Fatal. -type handlerTerminatedError struct { - Request interface{} -} - -var _ error = handlerTerminatedError{} - -func (h handlerTerminatedError) Error() string { - return fmt.Sprintf("handler terminated (called runtime.Goexit)") -} - -var _ fuse.ErrorNumber = handlerTerminatedError{} - -func (h handlerTerminatedError) Errno() fuse.Errno { - return fuse.DefaultErrno -} - -type handleNotReaderError struct { - handle Handle -} - -var _ error = handleNotReaderError{} - -func (e handleNotReaderError) Error() string { - return fmt.Sprintf("handle has no Read: %T", e.handle) -} - -var _ fuse.ErrorNumber = handleNotReaderError{} - -func (e handleNotReaderError) Errno() fuse.Errno { - return fuse.ENOTSUP -} - -func initLookupResponse(s *fuse.LookupResponse) { - s.EntryValid = entryValidTime -} - -func (c *Server) serve(r fuse.Request) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - parentCtx := ctx - if c.context != nil { - ctx = c.context(ctx, r) - } - - req := &serveRequest{Request: r, cancel: cancel} - - c.debug(request{ - Op: opName(r), - Request: r.Hdr(), - In: r, - }) - var node Node - var snode *serveNode - c.meta.Lock() - hdr := r.Hdr() - if id := hdr.Node; id != 0 { - if id < fuse.NodeID(len(c.node)) { - snode = c.node[uint(id)] - } - if snode == nil { - c.meta.Unlock() - c.debug(response{ - Op: opName(r), - Request: logResponseHeader{ID: hdr.ID}, - Error: fuse.ESTALE.ErrnoName(), - // this is the only place that sets both Error and - // Out; not sure if i want to do that; might get rid - // of len(c.node) things altogether - Out: logMissingNode{ - MaxNode: fuse.NodeID(len(c.node)), - }, - }) - r.RespondError(fuse.ESTALE) - return - } - node = snode.node - } - if c.req[hdr.ID] != nil { - // This happens with OSXFUSE. Assume it's okay and - // that we'll never see an interrupt for this one. - // Otherwise everything wedges. TODO: Report to OSXFUSE? - // - // TODO this might have been because of missing done() calls - } else { - c.req[hdr.ID] = req - } - c.meta.Unlock() - - // Call this before responding. - // After responding is too late: we might get another request - // with the same ID and be very confused. - done := func(resp interface{}) { - msg := response{ - Op: opName(r), - Request: logResponseHeader{ID: hdr.ID}, - } - if err, ok := resp.(error); ok { - msg.Error = err.Error() - if ferr, ok := err.(fuse.ErrorNumber); ok { - errno := ferr.Errno() - msg.Errno = errno.ErrnoName() - if errno == err { - // it's just a fuse.Errno with no extra detail; - // skip the textual message for log readability - msg.Error = "" - } - } else { - msg.Errno = fuse.DefaultErrno.ErrnoName() - } - } else { - msg.Out = resp - } - c.debug(msg) - - c.meta.Lock() - delete(c.req, hdr.ID) - c.meta.Unlock() - } - - var responded bool - defer func() { - if rec := recover(); rec != nil { - const size = 1 << 16 - buf := make([]byte, size) - n := runtime.Stack(buf, false) - buf = buf[:n] - log.Printf("fuse: panic in handler for %v: %v\n%s", r, rec, buf) - err := handlerPanickedError{ - Request: r, - Err: rec, - } - done(err) - r.RespondError(err) - return - } - - if !responded { - err := handlerTerminatedError{ - Request: r, - } - done(err) - r.RespondError(err) - } - }() - - if err := c.handleRequest(ctx, node, snode, r, done); err != nil { - if err == context.Canceled { - select { - case <-parentCtx.Done(): - // We canceled the parent context because of an - // incoming interrupt request, so return EINTR - // to trigger the right behavior in the client app. - // - // Only do this when it's the parent context that was - // canceled, not a context controlled by the program - // using this library, so we don't return EINTR too - // eagerly -- it might cause busy loops. - // - // Decent write-up on role of EINTR: - // http://250bpm.com/blog:12 - err = fuse.EINTR - default: - // nothing - } - } - done(err) - r.RespondError(err) - } - - // disarm runtime.Goexit protection - responded = true -} - -// handleRequest will either a) call done(s) and r.Respond(s) OR b) return an error. -func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, r fuse.Request, done func(resp interface{})) error { - switch r := r.(type) { - default: - // Note: To FUSE, ENOSYS means "this server never implements this request." - // It would be inappropriate to return ENOSYS for other operations in this - // switch that might only be unavailable in some contexts, not all. - return fuse.ENOSYS - - case *fuse.StatfsRequest: - s := &fuse.StatfsResponse{} - if fs, ok := c.fs.(FSStatfser); ok { - if err := fs.Statfs(ctx, r, s); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - // Node operations. - case *fuse.GetattrRequest: - s := &fuse.GetattrResponse{} - if n, ok := node.(NodeGetattrer); ok { - if err := n.Getattr(ctx, r, s); err != nil { - return err - } - } else { - if err := snode.attr(ctx, &s.Attr); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - case *fuse.SetattrRequest: - s := &fuse.SetattrResponse{} - if n, ok := node.(NodeSetattrer); ok { - if err := n.Setattr(ctx, r, s); err != nil { - return err - } - } - - if err := snode.attr(ctx, &s.Attr); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.SymlinkRequest: - s := &fuse.SymlinkResponse{} - initLookupResponse(&s.LookupResponse) - n, ok := node.(NodeSymlinker) - if !ok { - return fuse.EIO // XXX or EPERM like Mkdir? - } - n2, err := n.Symlink(ctx, r) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.NewName, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.ReadlinkRequest: - n, ok := node.(NodeReadlinker) - if !ok { - return fuse.EIO /// XXX or EPERM? - } - target, err := n.Readlink(ctx, r) - if err != nil { - return err - } - done(target) - r.Respond(target) - return nil - - case *fuse.LinkRequest: - n, ok := node.(NodeLinker) - if !ok { - return fuse.EIO /// XXX or EPERM? - } - c.meta.Lock() - var oldNode *serveNode - if int(r.OldNode) < len(c.node) { - oldNode = c.node[r.OldNode] - } - c.meta.Unlock() - if oldNode == nil { - c.debug(logLinkRequestOldNodeNotFound{ - Request: r.Hdr(), - In: r, - }) - return fuse.EIO - } - n2, err := n.Link(ctx, r, oldNode.node) - if err != nil { - return err - } - s := &fuse.LookupResponse{} - initLookupResponse(s) - if err := c.saveLookup(ctx, s, snode, r.NewName, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.RemoveRequest: - n, ok := node.(NodeRemover) - if !ok { - return fuse.EIO /// XXX or EPERM? - } - err := n.Remove(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.AccessRequest: - if n, ok := node.(NodeAccesser); ok { - if err := n.Access(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.LookupRequest: - var n2 Node - var err error - s := &fuse.LookupResponse{} - initLookupResponse(s) - if n, ok := node.(NodeStringLookuper); ok { - n2, err = n.Lookup(ctx, r.Name) - } else if n, ok := node.(NodeRequestLookuper); ok { - n2, err = n.Lookup(ctx, r, s) - } else { - return fuse.ENOENT - } - if err != nil { - return err - } - if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.MkdirRequest: - s := &fuse.MkdirResponse{} - initLookupResponse(&s.LookupResponse) - n, ok := node.(NodeMkdirer) - if !ok { - return fuse.EPERM - } - n2, err := n.Mkdir(ctx, r) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.OpenRequest: - s := &fuse.OpenResponse{} - var h2 Handle - if n, ok := node.(NodeOpener); ok { - hh, err := n.Open(ctx, r, s) - if err != nil { - return err - } - h2 = hh - } else { - h2 = node - } - s.Handle = c.saveHandle(h2, r.Hdr().Node) - done(s) - r.Respond(s) - return nil - - case *fuse.CreateRequest: - n, ok := node.(NodeCreater) - if !ok { - // If we send back ENOSYS, FUSE will try mknod+open. - return fuse.EPERM - } - s := &fuse.CreateResponse{OpenResponse: fuse.OpenResponse{}} - initLookupResponse(&s.LookupResponse) - n2, h2, err := n.Create(ctx, r, s) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { - return err - } - s.Handle = c.saveHandle(h2, r.Hdr().Node) - done(s) - r.Respond(s) - return nil - - case *fuse.GetxattrRequest: - n, ok := node.(NodeGetxattrer) - if !ok { - return fuse.ENOTSUP - } - s := &fuse.GetxattrResponse{} - err := n.Getxattr(ctx, r, s) - if err != nil { - return err - } - if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return fuse.ERANGE - } - done(s) - r.Respond(s) - return nil - - case *fuse.ListxattrRequest: - n, ok := node.(NodeListxattrer) - if !ok { - return fuse.ENOTSUP - } - s := &fuse.ListxattrResponse{} - err := n.Listxattr(ctx, r, s) - if err != nil { - return err - } - if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return fuse.ERANGE - } - done(s) - r.Respond(s) - return nil - - case *fuse.SetxattrRequest: - n, ok := node.(NodeSetxattrer) - if !ok { - return fuse.ENOTSUP - } - err := n.Setxattr(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.RemovexattrRequest: - n, ok := node.(NodeRemovexattrer) - if !ok { - return fuse.ENOTSUP - } - err := n.Removexattr(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.ForgetRequest: - forget := c.dropNode(r.Hdr().Node, r.N) - if forget { - n, ok := node.(NodeForgetter) - if ok { - n.Forget() - } - } - done(nil) - r.Respond() - return nil - - // Handle operations. - case *fuse.ReadRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return fuse.ESTALE - } - handle := shandle.handle - - s := &fuse.ReadResponse{Data: make([]byte, 0, r.Size)} - if r.Dir { - if h, ok := handle.(HandleReadDirAller); ok { - // detect rewinddir(3) or similar seek and refresh - // contents - if r.Offset == 0 { - shandle.readData = nil - } - - if shandle.readData == nil { - dirs, err := h.ReadDirAll(ctx) - if err != nil { - return err - } - var data []byte - for _, dir := range dirs { - if dir.Inode == 0 { - dir.Inode = c.dynamicInode(snode.inode, dir.Name) - } - data = fuse.AppendDirent(data, dir) - } - shandle.readData = data - } - fuseutil.HandleRead(r, s, shandle.readData) - done(s) - r.Respond(s) - return nil - } - } else { - if h, ok := handle.(HandleReadAller); ok { - if shandle.readData == nil { - data, err := h.ReadAll(ctx) - if err != nil { - return err - } - if data == nil { - data = []byte{} - } - shandle.readData = data - } - fuseutil.HandleRead(r, s, shandle.readData) - done(s) - r.Respond(s) - return nil - } - h, ok := handle.(HandleReader) - if !ok { - err := handleNotReaderError{handle: handle} - return err - } - if err := h.Read(ctx, r, s); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - case *fuse.WriteRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return fuse.ESTALE - } - - s := &fuse.WriteResponse{} - if h, ok := shandle.handle.(HandleWriter); ok { - if err := h.Write(ctx, r, s); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - } - return fuse.EIO - - case *fuse.FlushRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return fuse.ESTALE - } - handle := shandle.handle - - if h, ok := handle.(HandleFlusher); ok { - if err := h.Flush(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.ReleaseRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return fuse.ESTALE - } - handle := shandle.handle - - // No matter what, release the handle. - c.dropHandle(r.Handle) - - if h, ok := handle.(HandleReleaser); ok { - if err := h.Release(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.DestroyRequest: - if fs, ok := c.fs.(FSDestroyer); ok { - fs.Destroy() - } - done(nil) - r.Respond() - return nil - - case *fuse.RenameRequest: - c.meta.Lock() - var newDirNode *serveNode - if int(r.NewDir) < len(c.node) { - newDirNode = c.node[r.NewDir] - } - c.meta.Unlock() - if newDirNode == nil { - c.debug(renameNewDirNodeNotFound{ - Request: r.Hdr(), - In: r, - }) - return fuse.EIO - } - n, ok := node.(NodeRenamer) - if !ok { - return fuse.EIO // XXX or EPERM like Mkdir? - } - err := n.Rename(ctx, r, newDirNode.node) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.MknodRequest: - n, ok := node.(NodeMknoder) - if !ok { - return fuse.EIO - } - n2, err := n.Mknod(ctx, r) - if err != nil { - return err - } - s := &fuse.LookupResponse{} - initLookupResponse(s) - if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.FsyncRequest: - n, ok := node.(NodeFsyncer) - if !ok { - return fuse.EIO - } - err := n.Fsync(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.InterruptRequest: - c.meta.Lock() - ireq := c.req[r.IntrID] - if ireq != nil && ireq.cancel != nil { - ireq.cancel() - ireq.cancel = nil - } - c.meta.Unlock() - done(nil) - r.Respond() - return nil - - /* case *FsyncdirRequest: - return ENOSYS - - case *GetlkRequest, *SetlkRequest, *SetlkwRequest: - return ENOSYS - - case *BmapRequest: - return ENOSYS - - case *SetvolnameRequest, *GetxtimesRequest, *ExchangeRequest: - return ENOSYS - */ - } - - panic("not reached") -} - -func (c *Server) saveLookup(ctx context.Context, s *fuse.LookupResponse, snode *serveNode, elem string, n2 Node) error { - if err := nodeAttr(ctx, n2, &s.Attr); err != nil { - return err - } - if s.Attr.Inode == 0 { - s.Attr.Inode = c.dynamicInode(snode.inode, elem) - } - - s.Node, s.Generation = c.saveNode(s.Attr.Inode, n2) - return nil -} - -type invalidateNodeDetail struct { - Off int64 - Size int64 -} - -func (i invalidateNodeDetail) String() string { - return fmt.Sprintf("Off:%d Size:%d", i.Off, i.Size) -} - -func errstr(err error) string { - if err == nil { - return "" - } - return err.Error() -} - -func (s *Server) invalidateNode(node Node, off int64, size int64) error { - s.meta.Lock() - id, ok := s.nodeRef[node] - if ok { - snode := s.node[id] - snode.wg.Add(1) - defer snode.wg.Done() - } - s.meta.Unlock() - if !ok { - // This is what the kernel would have said, if we had been - // able to send this message; it's not cached. - return fuse.ErrNotCached - } - // Delay logging until after we can record the error too. We - // consider a /dev/fuse write to be instantaneous enough to not - // need separate before and after messages. - err := s.conn.InvalidateNode(id, off, size) - s.debug(notification{ - Op: "InvalidateNode", - Node: id, - Out: invalidateNodeDetail{ - Off: off, - Size: size, - }, - Err: errstr(err), - }) - return err -} - -// InvalidateNodeAttr invalidates the kernel cache of the attributes -// of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeAttr(node Node) error { - return s.invalidateNode(node, 0, 0) -} - -// InvalidateNodeData invalidates the kernel cache of the attributes -// and data of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeData(node Node) error { - return s.invalidateNode(node, 0, -1) -} - -// InvalidateNodeDataRange invalidates the kernel cache of the -// attributes and a range of the data of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeDataRange(node Node, off int64, size int64) error { - return s.invalidateNode(node, off, size) -} - -type invalidateEntryDetail struct { - Name string -} - -func (i invalidateEntryDetail) String() string { - return fmt.Sprintf("%q", i.Name) -} - -// InvalidateEntry invalidates the kernel cache of the directory entry -// identified by parent node and entry basename. -// -// Kernel may or may not cache directory listings. To invalidate -// those, use InvalidateNode to invalidate all of the data for a -// directory. (As of 2015-06, Linux FUSE does not cache directory -// listings.) -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (s *Server) InvalidateEntry(parent Node, name string) error { - s.meta.Lock() - id, ok := s.nodeRef[parent] - if ok { - snode := s.node[id] - snode.wg.Add(1) - defer snode.wg.Done() - } - s.meta.Unlock() - if !ok { - // This is what the kernel would have said, if we had been - // able to send this message; it's not cached. - return fuse.ErrNotCached - } - err := s.conn.InvalidateEntry(id, name) - s.debug(notification{ - Op: "InvalidateEntry", - Node: id, - Out: invalidateEntryDetail{ - Name: name, - }, - Err: errstr(err), - }) - return err -} - -// DataHandle returns a read-only Handle that satisfies reads -// using the given data. -func DataHandle(data []byte) Handle { - return &dataHandle{data} -} - -type dataHandle struct { - data []byte -} - -func (d *dataHandle) ReadAll(ctx context.Context) ([]byte, error) { - return d.data, nil -} - -// GenerateDynamicInode returns a dynamic inode. -// -// The parent inode and current entry name are used as the criteria -// for choosing a pseudorandom inode. This makes it likely the same -// entry will get the same inode on multiple runs. -func GenerateDynamicInode(parent uint64, name string) uint64 { - h := fnv.New64a() - var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], parent) - _, _ = h.Write(buf[:]) - _, _ = h.Write([]byte(name)) - var inode uint64 - for { - inode = h.Sum64() - if inode != 0 { - break - } - // there's a tiny probability that result is zero; change the - // input a little and try again - _, _ = h.Write([]byte{'x'}) - } - return inode -} diff --git a/vendor/bazil.org/fuse/fs/tree.go b/vendor/bazil.org/fuse/fs/tree.go deleted file mode 100644 index 7e078045..00000000 --- a/vendor/bazil.org/fuse/fs/tree.go +++ /dev/null @@ -1,99 +0,0 @@ -// FUSE directory tree, for servers that wish to use it with the service loop. - -package fs - -import ( - "os" - pathpkg "path" - "strings" - - "golang.org/x/net/context" -) - -import ( - "bazil.org/fuse" -) - -// A Tree implements a basic read-only directory tree for FUSE. -// The Nodes contained in it may still be writable. -type Tree struct { - tree -} - -func (t *Tree) Root() (Node, error) { - return &t.tree, nil -} - -// Add adds the path to the tree, resolving to the given node. -// If path or a prefix of path has already been added to the tree, -// Add panics. -// -// Add is only safe to call before starting to serve requests. -func (t *Tree) Add(path string, node Node) { - path = pathpkg.Clean("/" + path)[1:] - elems := strings.Split(path, "/") - dir := Node(&t.tree) - for i, elem := range elems { - dt, ok := dir.(*tree) - if !ok { - panic("fuse: Tree.Add for " + strings.Join(elems[:i], "/") + " and " + path) - } - n := dt.lookup(elem) - if n != nil { - if i+1 == len(elems) { - panic("fuse: Tree.Add for " + path + " conflicts with " + elem) - } - dir = n - } else { - if i+1 == len(elems) { - dt.add(elem, node) - } else { - dir = &tree{} - dt.add(elem, dir) - } - } - } -} - -type treeDir struct { - name string - node Node -} - -type tree struct { - dir []treeDir -} - -func (t *tree) lookup(name string) Node { - for _, d := range t.dir { - if d.name == name { - return d.node - } - } - return nil -} - -func (t *tree) add(name string, n Node) { - t.dir = append(t.dir, treeDir{name, n}) -} - -func (t *tree) Attr(ctx context.Context, a *fuse.Attr) error { - a.Mode = os.ModeDir | 0555 - return nil -} - -func (t *tree) Lookup(ctx context.Context, name string) (Node, error) { - n := t.lookup(name) - if n != nil { - return n, nil - } - return nil, fuse.ENOENT -} - -func (t *tree) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { - var out []fuse.Dirent - for _, d := range t.dir { - out = append(out, fuse.Dirent{Name: d.name}) - } - return out, nil -} diff --git a/vendor/bazil.org/fuse/fuse.go b/vendor/bazil.org/fuse/fuse.go deleted file mode 100644 index 7dc70f9e..00000000 --- a/vendor/bazil.org/fuse/fuse.go +++ /dev/null @@ -1,2304 +0,0 @@ -// See the file LICENSE for copyright and licensing information. - -// Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, -// which carries this notice: -// -// The files in this directory are subject to the following license. -// -// The author of this software is Russ Cox. -// -// Copyright (c) 2006 Russ Cox -// -// Permission to use, copy, modify, and distribute this software for any -// purpose without fee is hereby granted, provided that this entire notice -// is included in all copies of any software which is or includes a copy -// or modification of this software and in all copies of the supporting -// documentation for such software. -// -// THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION OR WARRANTY -// OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS -// FITNESS FOR ANY PARTICULAR PURPOSE. - -// Package fuse enables writing FUSE file systems on Linux, OS X, and FreeBSD. -// -// On OS X, it requires OSXFUSE (http://osxfuse.github.com/). -// -// There are two approaches to writing a FUSE file system. The first is to speak -// the low-level message protocol, reading from a Conn using ReadRequest and -// writing using the various Respond methods. This approach is closest to -// the actual interaction with the kernel and can be the simplest one in contexts -// such as protocol translators. -// -// Servers of synthesized file systems tend to share common -// bookkeeping abstracted away by the second approach, which is to -// call fs.Serve to serve the FUSE protocol using an implementation of -// the service methods in the interfaces FS* (file system), Node* (file -// or directory), and Handle* (opened file or directory). -// There are a daunting number of such methods that can be written, -// but few are required. -// The specific methods are described in the documentation for those interfaces. -// -// The hellofs subdirectory contains a simple illustration of the fs.Serve approach. -// -// Service Methods -// -// The required and optional methods for the FS, Node, and Handle interfaces -// have the general form -// -// Op(ctx context.Context, req *OpRequest, resp *OpResponse) error -// -// where Op is the name of a FUSE operation. Op reads request -// parameters from req and writes results to resp. An operation whose -// only result is the error result omits the resp parameter. -// -// Multiple goroutines may call service methods simultaneously; the -// methods being called are responsible for appropriate -// synchronization. -// -// The operation must not hold on to the request or response, -// including any []byte fields such as WriteRequest.Data or -// SetxattrRequest.Xattr. -// -// Errors -// -// Operations can return errors. The FUSE interface can only -// communicate POSIX errno error numbers to file system clients, the -// message is not visible to file system clients. The returned error -// can implement ErrorNumber to control the errno returned. Without -// ErrorNumber, a generic errno (EIO) is returned. -// -// Error messages will be visible in the debug log as part of the -// response. -// -// Interrupted Operations -// -// In some file systems, some operations -// may take an undetermined amount of time. For example, a Read waiting for -// a network message or a matching Write might wait indefinitely. If the request -// is cancelled and no longer needed, the context will be cancelled. -// Blocking operations should select on a receive from ctx.Done() and attempt to -// abort the operation early if the receive succeeds (meaning the channel is closed). -// To indicate that the operation failed because it was aborted, return fuse.EINTR. -// -// If an operation does not block for an indefinite amount of time, supporting -// cancellation is not necessary. -// -// Authentication -// -// All requests types embed a Header, meaning that the method can -// inspect req.Pid, req.Uid, and req.Gid as necessary to implement -// permission checking. The kernel FUSE layer normally prevents other -// users from accessing the FUSE file system (to change this, see -// AllowOther, AllowRoot), but does not enforce access modes (to -// change this, see DefaultPermissions). -// -// Mount Options -// -// Behavior and metadata of the mounted file system can be changed by -// passing MountOption values to Mount. -// -package fuse // import "bazil.org/fuse" - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "os" - "sync" - "syscall" - "time" - "unsafe" -) - -// A Conn represents a connection to a mounted FUSE file system. -type Conn struct { - // Ready is closed when the mount is complete or has failed. - Ready <-chan struct{} - - // MountError stores any error from the mount process. Only valid - // after Ready is closed. - MountError error - - // File handle for kernel communication. Only safe to access if - // rio or wio is held. - dev *os.File - wio sync.RWMutex - rio sync.RWMutex - - // Protocol version negotiated with InitRequest/InitResponse. - proto Protocol -} - -// MountpointDoesNotExistError is an error returned when the -// mountpoint does not exist. -type MountpointDoesNotExistError struct { - Path string -} - -var _ error = (*MountpointDoesNotExistError)(nil) - -func (e *MountpointDoesNotExistError) Error() string { - return fmt.Sprintf("mountpoint does not exist: %v", e.Path) -} - -// Mount mounts a new FUSE connection on the named directory -// and returns a connection for reading and writing FUSE messages. -// -// After a successful return, caller must call Close to free -// resources. -// -// Even on successful return, the new mount is not guaranteed to be -// visible until after Conn.Ready is closed. See Conn.MountError for -// possible errors. Incoming requests on Conn must be served to make -// progress. -func Mount(dir string, options ...MountOption) (*Conn, error) { - conf := mountConfig{ - options: make(map[string]string), - } - for _, option := range options { - if err := option(&conf); err != nil { - return nil, err - } - } - - ready := make(chan struct{}, 1) - c := &Conn{ - Ready: ready, - } - f, err := mount(dir, &conf, ready, &c.MountError) - if err != nil { - return nil, err - } - c.dev = f - - if err := initMount(c, &conf); err != nil { - c.Close() - if err == ErrClosedWithoutInit { - // see if we can provide a better error - <-c.Ready - if err := c.MountError; err != nil { - return nil, err - } - } - return nil, err - } - - return c, nil -} - -type OldVersionError struct { - Kernel Protocol - LibraryMin Protocol -} - -func (e *OldVersionError) Error() string { - return fmt.Sprintf("kernel FUSE version is too old: %v < %v", e.Kernel, e.LibraryMin) -} - -var ( - ErrClosedWithoutInit = errors.New("fuse connection closed without init") -) - -func initMount(c *Conn, conf *mountConfig) error { - req, err := c.ReadRequest() - if err != nil { - if err == io.EOF { - return ErrClosedWithoutInit - } - return err - } - r, ok := req.(*InitRequest) - if !ok { - return fmt.Errorf("missing init, got: %T", req) - } - - min := Protocol{protoVersionMinMajor, protoVersionMinMinor} - if r.Kernel.LT(min) { - req.RespondError(Errno(syscall.EPROTO)) - c.Close() - return &OldVersionError{ - Kernel: r.Kernel, - LibraryMin: min, - } - } - - proto := Protocol{protoVersionMaxMajor, protoVersionMaxMinor} - if r.Kernel.LT(proto) { - // Kernel doesn't support the latest version we have. - proto = r.Kernel - } - c.proto = proto - - s := &InitResponse{ - Library: proto, - MaxReadahead: conf.maxReadahead, - MaxWrite: maxWrite, - Flags: InitBigWrites | conf.initFlags, - } - r.Respond(s) - return nil -} - -// A Request represents a single FUSE request received from the kernel. -// Use a type switch to determine the specific kind. -// A request of unrecognized type will have concrete type *Header. -type Request interface { - // Hdr returns the Header associated with this request. - Hdr() *Header - - // RespondError responds to the request with the given error. - RespondError(error) - - String() string -} - -// A RequestID identifies an active FUSE request. -type RequestID uint64 - -func (r RequestID) String() string { - return fmt.Sprintf("%#x", uint64(r)) -} - -// A NodeID is a number identifying a directory or file. -// It must be unique among IDs returned in LookupResponses -// that have not yet been forgotten by ForgetRequests. -type NodeID uint64 - -func (n NodeID) String() string { - return fmt.Sprintf("%#x", uint64(n)) -} - -// A HandleID is a number identifying an open directory or file. -// It only needs to be unique while the directory or file is open. -type HandleID uint64 - -func (h HandleID) String() string { - return fmt.Sprintf("%#x", uint64(h)) -} - -// The RootID identifies the root directory of a FUSE file system. -const RootID NodeID = rootID - -// A Header describes the basic information sent in every request. -type Header struct { - Conn *Conn `json:"-"` // connection this request was received on - ID RequestID // unique ID for request - Node NodeID // file or directory the request is about - Uid uint32 // user ID of process making request - Gid uint32 // group ID of process making request - Pid uint32 // process ID of process making request - - // for returning to reqPool - msg *message -} - -func (h *Header) String() string { - return fmt.Sprintf("ID=%v Node=%v Uid=%d Gid=%d Pid=%d", h.ID, h.Node, h.Uid, h.Gid, h.Pid) -} - -func (h *Header) Hdr() *Header { - return h -} - -func (h *Header) noResponse() { - putMessage(h.msg) -} - -func (h *Header) respond(msg []byte) { - out := (*outHeader)(unsafe.Pointer(&msg[0])) - out.Unique = uint64(h.ID) - h.Conn.respond(msg) - putMessage(h.msg) -} - -// An ErrorNumber is an error with a specific error number. -// -// Operations may return an error value that implements ErrorNumber to -// control what specific error number (errno) to return. -type ErrorNumber interface { - // Errno returns the the error number (errno) for this error. - Errno() Errno -} - -const ( - // ENOSYS indicates that the call is not supported. - ENOSYS = Errno(syscall.ENOSYS) - - // ESTALE is used by Serve to respond to violations of the FUSE protocol. - ESTALE = Errno(syscall.ESTALE) - - ENOENT = Errno(syscall.ENOENT) - EIO = Errno(syscall.EIO) - EPERM = Errno(syscall.EPERM) - - // EINTR indicates request was interrupted by an InterruptRequest. - // See also fs.Intr. - EINTR = Errno(syscall.EINTR) - - ERANGE = Errno(syscall.ERANGE) - ENOTSUP = Errno(syscall.ENOTSUP) - EEXIST = Errno(syscall.EEXIST) -) - -// DefaultErrno is the errno used when error returned does not -// implement ErrorNumber. -const DefaultErrno = EIO - -var errnoNames = map[Errno]string{ - ENOSYS: "ENOSYS", - ESTALE: "ESTALE", - ENOENT: "ENOENT", - EIO: "EIO", - EPERM: "EPERM", - EINTR: "EINTR", - EEXIST: "EEXIST", -} - -// Errno implements Error and ErrorNumber using a syscall.Errno. -type Errno syscall.Errno - -var _ = ErrorNumber(Errno(0)) -var _ = error(Errno(0)) - -func (e Errno) Errno() Errno { - return e -} - -func (e Errno) String() string { - return syscall.Errno(e).Error() -} - -func (e Errno) Error() string { - return syscall.Errno(e).Error() -} - -// ErrnoName returns the short non-numeric identifier for this errno. -// For example, "EIO". -func (e Errno) ErrnoName() string { - s := errnoNames[e] - if s == "" { - s = fmt.Sprint(e.Errno()) - } - return s -} - -func (e Errno) MarshalText() ([]byte, error) { - s := e.ErrnoName() - return []byte(s), nil -} - -func (h *Header) RespondError(err error) { - errno := DefaultErrno - if ferr, ok := err.(ErrorNumber); ok { - errno = ferr.Errno() - } - // FUSE uses negative errors! - // TODO: File bug report against OSXFUSE: positive error causes kernel panic. - buf := newBuffer(0) - hOut := (*outHeader)(unsafe.Pointer(&buf[0])) - hOut.Error = -int32(errno) - h.respond(buf) -} - -// All requests read from the kernel, without data, are shorter than -// this. -var maxRequestSize = syscall.Getpagesize() -var bufSize = maxRequestSize + maxWrite - -// reqPool is a pool of messages. -// -// Lifetime of a logical message is from getMessage to putMessage. -// getMessage is called by ReadRequest. putMessage is called by -// Conn.ReadRequest, Request.Respond, or Request.RespondError. -// -// Messages in the pool are guaranteed to have conn and off zeroed, -// buf allocated and len==bufSize, and hdr set. -var reqPool = sync.Pool{ - New: allocMessage, -} - -func allocMessage() interface{} { - m := &message{buf: make([]byte, bufSize)} - m.hdr = (*inHeader)(unsafe.Pointer(&m.buf[0])) - return m -} - -func getMessage(c *Conn) *message { - m := reqPool.Get().(*message) - m.conn = c - return m -} - -func putMessage(m *message) { - m.buf = m.buf[:bufSize] - m.conn = nil - m.off = 0 - reqPool.Put(m) -} - -// a message represents the bytes of a single FUSE message -type message struct { - conn *Conn - buf []byte // all bytes - hdr *inHeader // header - off int // offset for reading additional fields -} - -func (m *message) len() uintptr { - return uintptr(len(m.buf) - m.off) -} - -func (m *message) data() unsafe.Pointer { - var p unsafe.Pointer - if m.off < len(m.buf) { - p = unsafe.Pointer(&m.buf[m.off]) - } - return p -} - -func (m *message) bytes() []byte { - return m.buf[m.off:] -} - -func (m *message) Header() Header { - h := m.hdr - return Header{ - Conn: m.conn, - ID: RequestID(h.Unique), - Node: NodeID(h.Nodeid), - Uid: h.Uid, - Gid: h.Gid, - Pid: h.Pid, - - msg: m, - } -} - -// fileMode returns a Go os.FileMode from a Unix mode. -func fileMode(unixMode uint32) os.FileMode { - mode := os.FileMode(unixMode & 0777) - switch unixMode & syscall.S_IFMT { - case syscall.S_IFREG: - // nothing - case syscall.S_IFDIR: - mode |= os.ModeDir - case syscall.S_IFCHR: - mode |= os.ModeCharDevice | os.ModeDevice - case syscall.S_IFBLK: - mode |= os.ModeDevice - case syscall.S_IFIFO: - mode |= os.ModeNamedPipe - case syscall.S_IFLNK: - mode |= os.ModeSymlink - case syscall.S_IFSOCK: - mode |= os.ModeSocket - default: - // no idea - mode |= os.ModeDevice - } - if unixMode&syscall.S_ISUID != 0 { - mode |= os.ModeSetuid - } - if unixMode&syscall.S_ISGID != 0 { - mode |= os.ModeSetgid - } - return mode -} - -type noOpcode struct { - Opcode uint32 -} - -func (m noOpcode) String() string { - return fmt.Sprintf("No opcode %v", m.Opcode) -} - -type malformedMessage struct { -} - -func (malformedMessage) String() string { - return "malformed message" -} - -// Close closes the FUSE connection. -func (c *Conn) Close() error { - c.wio.Lock() - defer c.wio.Unlock() - c.rio.Lock() - defer c.rio.Unlock() - return c.dev.Close() -} - -// caller must hold wio or rio -func (c *Conn) fd() int { - return int(c.dev.Fd()) -} - -func (c *Conn) Protocol() Protocol { - return c.proto -} - -// ReadRequest returns the next FUSE request from the kernel. -// -// Caller must call either Request.Respond or Request.RespondError in -// a reasonable time. Caller must not retain Request after that call. -func (c *Conn) ReadRequest() (Request, error) { - m := getMessage(c) -loop: - c.rio.RLock() - n, err := syscall.Read(c.fd(), m.buf) - c.rio.RUnlock() - if err == syscall.EINTR { - // OSXFUSE sends EINTR to userspace when a request interrupt - // completed before it got sent to userspace? - goto loop - } - if err != nil && err != syscall.ENODEV { - putMessage(m) - return nil, err - } - if n <= 0 { - putMessage(m) - return nil, io.EOF - } - m.buf = m.buf[:n] - - if n < inHeaderSize { - putMessage(m) - return nil, errors.New("fuse: message too short") - } - - // FreeBSD FUSE sends a short length in the header - // for FUSE_INIT even though the actual read length is correct. - if n == inHeaderSize+initInSize && m.hdr.Opcode == opInit && m.hdr.Len < uint32(n) { - m.hdr.Len = uint32(n) - } - - // OSXFUSE sometimes sends the wrong m.hdr.Len in a FUSE_WRITE message. - if m.hdr.Len < uint32(n) && m.hdr.Len >= uint32(unsafe.Sizeof(writeIn{})) && m.hdr.Opcode == opWrite { - m.hdr.Len = uint32(n) - } - - if m.hdr.Len != uint32(n) { - // prepare error message before returning m to pool - err := fmt.Errorf("fuse: read %d opcode %d but expected %d", n, m.hdr.Opcode, m.hdr.Len) - putMessage(m) - return nil, err - } - - m.off = inHeaderSize - - // Convert to data structures. - // Do not trust kernel to hand us well-formed data. - var req Request - switch m.hdr.Opcode { - default: - Debug(noOpcode{Opcode: m.hdr.Opcode}) - goto unrecognized - - case opLookup: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &LookupRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - } - - case opForget: - in := (*forgetIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ForgetRequest{ - Header: m.Header(), - N: in.Nlookup, - } - - case opGetattr: - switch { - case c.proto.LT(Protocol{7, 9}): - req = &GetattrRequest{ - Header: m.Header(), - } - - default: - in := (*getattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &GetattrRequest{ - Header: m.Header(), - Flags: GetattrFlags(in.GetattrFlags), - Handle: HandleID(in.Fh), - } - } - - case opSetattr: - in := (*setattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &SetattrRequest{ - Header: m.Header(), - Valid: SetattrValid(in.Valid), - Handle: HandleID(in.Fh), - Size: in.Size, - Atime: time.Unix(int64(in.Atime), int64(in.AtimeNsec)), - Mtime: time.Unix(int64(in.Mtime), int64(in.MtimeNsec)), - Mode: fileMode(in.Mode), - Uid: in.Uid, - Gid: in.Gid, - Bkuptime: in.BkupTime(), - Chgtime: in.Chgtime(), - Flags: in.Flags(), - } - - case opReadlink: - if len(m.bytes()) > 0 { - goto corrupt - } - req = &ReadlinkRequest{ - Header: m.Header(), - } - - case opSymlink: - // m.bytes() is "newName\0target\0" - names := m.bytes() - if len(names) == 0 || names[len(names)-1] != 0 { - goto corrupt - } - i := bytes.IndexByte(names, '\x00') - if i < 0 { - goto corrupt - } - newName, target := names[0:i], names[i+1:len(names)-1] - req = &SymlinkRequest{ - Header: m.Header(), - NewName: string(newName), - Target: string(target), - } - - case opLink: - in := (*linkIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - newName := m.bytes()[unsafe.Sizeof(*in):] - if len(newName) < 2 || newName[len(newName)-1] != 0 { - goto corrupt - } - newName = newName[:len(newName)-1] - req = &LinkRequest{ - Header: m.Header(), - OldNode: NodeID(in.Oldnodeid), - NewName: string(newName), - } - - case opMknod: - size := mknodInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*mknodIn)(m.data()) - name := m.bytes()[size:] - if len(name) < 2 || name[len(name)-1] != '\x00' { - goto corrupt - } - name = name[:len(name)-1] - r := &MknodRequest{ - Header: m.Header(), - Mode: fileMode(in.Mode), - Rdev: in.Rdev, - Name: string(name), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opMkdir: - size := mkdirInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*mkdirIn)(m.data()) - name := m.bytes()[size:] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - r := &MkdirRequest{ - Header: m.Header(), - Name: string(name[:i]), - // observed on Linux: mkdirIn.Mode & syscall.S_IFMT == 0, - // and this causes fileMode to go into it's "no idea" - // code branch; enforce type to directory - Mode: fileMode((in.Mode &^ syscall.S_IFMT) | syscall.S_IFDIR), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opUnlink, opRmdir: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &RemoveRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - Dir: m.hdr.Opcode == opRmdir, - } - - case opRename: - in := (*renameIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - newDirNodeID := NodeID(in.Newdir) - oldNew := m.bytes()[unsafe.Sizeof(*in):] - // oldNew should be "old\x00new\x00" - if len(oldNew) < 4 { - goto corrupt - } - if oldNew[len(oldNew)-1] != '\x00' { - goto corrupt - } - i := bytes.IndexByte(oldNew, '\x00') - if i < 0 { - goto corrupt - } - oldName, newName := string(oldNew[:i]), string(oldNew[i+1:len(oldNew)-1]) - req = &RenameRequest{ - Header: m.Header(), - NewDir: newDirNodeID, - OldName: oldName, - NewName: newName, - } - - case opOpendir, opOpen: - in := (*openIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &OpenRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opOpendir, - Flags: openFlags(in.Flags), - } - - case opRead, opReaddir: - in := (*readIn)(m.data()) - if m.len() < readInSize(c.proto) { - goto corrupt - } - r := &ReadRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opReaddir, - Handle: HandleID(in.Fh), - Offset: int64(in.Offset), - Size: int(in.Size), - } - if c.proto.GE(Protocol{7, 9}) { - r.Flags = ReadFlags(in.ReadFlags) - r.LockOwner = in.LockOwner - r.FileFlags = openFlags(in.Flags) - } - req = r - - case opWrite: - in := (*writeIn)(m.data()) - if m.len() < writeInSize(c.proto) { - goto corrupt - } - r := &WriteRequest{ - Header: m.Header(), - Handle: HandleID(in.Fh), - Offset: int64(in.Offset), - Flags: WriteFlags(in.WriteFlags), - } - if c.proto.GE(Protocol{7, 9}) { - r.LockOwner = in.LockOwner - r.FileFlags = openFlags(in.Flags) - } - buf := m.bytes()[writeInSize(c.proto):] - if uint32(len(buf)) < in.Size { - goto corrupt - } - r.Data = buf - req = r - - case opStatfs: - req = &StatfsRequest{ - Header: m.Header(), - } - - case opRelease, opReleasedir: - in := (*releaseIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ReleaseRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opReleasedir, - Handle: HandleID(in.Fh), - Flags: openFlags(in.Flags), - ReleaseFlags: ReleaseFlags(in.ReleaseFlags), - LockOwner: in.LockOwner, - } - - case opFsync, opFsyncdir: - in := (*fsyncIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &FsyncRequest{ - Dir: m.hdr.Opcode == opFsyncdir, - Header: m.Header(), - Handle: HandleID(in.Fh), - Flags: in.FsyncFlags, - } - - case opSetxattr: - in := (*setxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - m.off += int(unsafe.Sizeof(*in)) - name := m.bytes() - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - xattr := name[i+1:] - if uint32(len(xattr)) < in.Size { - goto corrupt - } - xattr = xattr[:in.Size] - req = &SetxattrRequest{ - Header: m.Header(), - Flags: in.Flags, - Position: in.position(), - Name: string(name[:i]), - Xattr: xattr, - } - - case opGetxattr: - in := (*getxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - name := m.bytes()[unsafe.Sizeof(*in):] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - req = &GetxattrRequest{ - Header: m.Header(), - Name: string(name[:i]), - Size: in.Size, - Position: in.position(), - } - - case opListxattr: - in := (*getxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ListxattrRequest{ - Header: m.Header(), - Size: in.Size, - Position: in.position(), - } - - case opRemovexattr: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &RemovexattrRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - } - - case opFlush: - in := (*flushIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &FlushRequest{ - Header: m.Header(), - Handle: HandleID(in.Fh), - Flags: in.FlushFlags, - LockOwner: in.LockOwner, - } - - case opInit: - in := (*initIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &InitRequest{ - Header: m.Header(), - Kernel: Protocol{in.Major, in.Minor}, - MaxReadahead: in.MaxReadahead, - Flags: InitFlags(in.Flags), - } - - case opGetlk: - panic("opGetlk") - case opSetlk: - panic("opSetlk") - case opSetlkw: - panic("opSetlkw") - - case opAccess: - in := (*accessIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &AccessRequest{ - Header: m.Header(), - Mask: in.Mask, - } - - case opCreate: - size := createInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*createIn)(m.data()) - name := m.bytes()[size:] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - r := &CreateRequest{ - Header: m.Header(), - Flags: openFlags(in.Flags), - Mode: fileMode(in.Mode), - Name: string(name[:i]), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opInterrupt: - in := (*interruptIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &InterruptRequest{ - Header: m.Header(), - IntrID: RequestID(in.Unique), - } - - case opBmap: - panic("opBmap") - - case opDestroy: - req = &DestroyRequest{ - Header: m.Header(), - } - - // OS X - case opSetvolname: - panic("opSetvolname") - case opGetxtimes: - panic("opGetxtimes") - case opExchange: - in := (*exchangeIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - oldDirNodeID := NodeID(in.Olddir) - newDirNodeID := NodeID(in.Newdir) - oldNew := m.bytes()[unsafe.Sizeof(*in):] - // oldNew should be "oldname\x00newname\x00" - if len(oldNew) < 4 { - goto corrupt - } - if oldNew[len(oldNew)-1] != '\x00' { - goto corrupt - } - i := bytes.IndexByte(oldNew, '\x00') - if i < 0 { - goto corrupt - } - oldName, newName := string(oldNew[:i]), string(oldNew[i+1:len(oldNew)-1]) - req = &ExchangeDataRequest{ - Header: m.Header(), - OldDir: oldDirNodeID, - NewDir: newDirNodeID, - OldName: oldName, - NewName: newName, - // TODO options - } - } - - return req, nil - -corrupt: - Debug(malformedMessage{}) - putMessage(m) - return nil, fmt.Errorf("fuse: malformed message") - -unrecognized: - // Unrecognized message. - // Assume higher-level code will send a "no idea what you mean" error. - h := m.Header() - return &h, nil -} - -type bugShortKernelWrite struct { - Written int64 - Length int64 - Error string - Stack string -} - -func (b bugShortKernelWrite) String() string { - return fmt.Sprintf("short kernel write: written=%d/%d error=%q stack=\n%s", b.Written, b.Length, b.Error, b.Stack) -} - -type bugKernelWriteError struct { - Error string - Stack string -} - -func (b bugKernelWriteError) String() string { - return fmt.Sprintf("kernel write error: error=%q stack=\n%s", b.Error, b.Stack) -} - -// safe to call even with nil error -func errorString(err error) string { - if err == nil { - return "" - } - return err.Error() -} - -func (c *Conn) writeToKernel(msg []byte) error { - out := (*outHeader)(unsafe.Pointer(&msg[0])) - out.Len = uint32(len(msg)) - - c.wio.RLock() - defer c.wio.RUnlock() - nn, err := syscall.Write(c.fd(), msg) - if err == nil && nn != len(msg) { - Debug(bugShortKernelWrite{ - Written: int64(nn), - Length: int64(len(msg)), - Error: errorString(err), - Stack: stack(), - }) - } - return err -} - -func (c *Conn) respond(msg []byte) { - if err := c.writeToKernel(msg); err != nil { - Debug(bugKernelWriteError{ - Error: errorString(err), - Stack: stack(), - }) - } -} - -type notCachedError struct{} - -func (notCachedError) Error() string { - return "node not cached" -} - -var _ ErrorNumber = notCachedError{} - -func (notCachedError) Errno() Errno { - // Behave just like if the original syscall.ENOENT had been passed - // straight through. - return ENOENT -} - -var ( - ErrNotCached = notCachedError{} -) - -// sendInvalidate sends an invalidate notification to kernel. -// -// A returned ENOENT is translated to a friendlier error. -func (c *Conn) sendInvalidate(msg []byte) error { - switch err := c.writeToKernel(msg); err { - case syscall.ENOENT: - return ErrNotCached - default: - return err - } -} - -// InvalidateNode invalidates the kernel cache of the attributes and a -// range of the data of a node. -// -// Giving offset 0 and size -1 means all data. To invalidate just the -// attributes, give offset 0 and size 0. -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (c *Conn) InvalidateNode(nodeID NodeID, off int64, size int64) error { - buf := newBuffer(unsafe.Sizeof(notifyInvalInodeOut{})) - h := (*outHeader)(unsafe.Pointer(&buf[0])) - // h.Unique is 0 - h.Error = notifyCodeInvalInode - out := (*notifyInvalInodeOut)(buf.alloc(unsafe.Sizeof(notifyInvalInodeOut{}))) - out.Ino = uint64(nodeID) - out.Off = off - out.Len = size - return c.sendInvalidate(buf) -} - -// InvalidateEntry invalidates the kernel cache of the directory entry -// identified by parent directory node ID and entry basename. -// -// Kernel may or may not cache directory listings. To invalidate -// those, use InvalidateNode to invalidate all of the data for a -// directory. (As of 2015-06, Linux FUSE does not cache directory -// listings.) -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (c *Conn) InvalidateEntry(parent NodeID, name string) error { - const maxUint32 = ^uint32(0) - if uint64(len(name)) > uint64(maxUint32) { - // very unlikely, but we don't want to silently truncate - return syscall.ENAMETOOLONG - } - buf := newBuffer(unsafe.Sizeof(notifyInvalEntryOut{}) + uintptr(len(name)) + 1) - h := (*outHeader)(unsafe.Pointer(&buf[0])) - // h.Unique is 0 - h.Error = notifyCodeInvalEntry - out := (*notifyInvalEntryOut)(buf.alloc(unsafe.Sizeof(notifyInvalEntryOut{}))) - out.Parent = uint64(parent) - out.Namelen = uint32(len(name)) - buf = append(buf, name...) - buf = append(buf, '\x00') - return c.sendInvalidate(buf) -} - -// An InitRequest is the first request sent on a FUSE file system. -type InitRequest struct { - Header `json:"-"` - Kernel Protocol - // Maximum readahead in bytes that the kernel plans to use. - MaxReadahead uint32 - Flags InitFlags -} - -var _ = Request(&InitRequest{}) - -func (r *InitRequest) String() string { - return fmt.Sprintf("Init [%v] %v ra=%d fl=%v", &r.Header, r.Kernel, r.MaxReadahead, r.Flags) -} - -// An InitResponse is the response to an InitRequest. -type InitResponse struct { - Library Protocol - // Maximum readahead in bytes that the kernel can use. Ignored if - // greater than InitRequest.MaxReadahead. - MaxReadahead uint32 - Flags InitFlags - // Maximum size of a single write operation. - // Linux enforces a minimum of 4 KiB. - MaxWrite uint32 -} - -func (r *InitResponse) String() string { - return fmt.Sprintf("Init %v ra=%d fl=%v w=%d", r.Library, r.MaxReadahead, r.Flags, r.MaxWrite) -} - -// Respond replies to the request with the given response. -func (r *InitRequest) Respond(resp *InitResponse) { - buf := newBuffer(unsafe.Sizeof(initOut{})) - out := (*initOut)(buf.alloc(unsafe.Sizeof(initOut{}))) - out.Major = resp.Library.Major - out.Minor = resp.Library.Minor - out.MaxReadahead = resp.MaxReadahead - out.Flags = uint32(resp.Flags) - out.MaxWrite = resp.MaxWrite - - // MaxWrite larger than our receive buffer would just lead to - // errors on large writes. - if out.MaxWrite > maxWrite { - out.MaxWrite = maxWrite - } - r.respond(buf) -} - -// A StatfsRequest requests information about the mounted file system. -type StatfsRequest struct { - Header `json:"-"` -} - -var _ = Request(&StatfsRequest{}) - -func (r *StatfsRequest) String() string { - return fmt.Sprintf("Statfs [%s]", &r.Header) -} - -// Respond replies to the request with the given response. -func (r *StatfsRequest) Respond(resp *StatfsResponse) { - buf := newBuffer(unsafe.Sizeof(statfsOut{})) - out := (*statfsOut)(buf.alloc(unsafe.Sizeof(statfsOut{}))) - out.St = kstatfs{ - Blocks: resp.Blocks, - Bfree: resp.Bfree, - Bavail: resp.Bavail, - Files: resp.Files, - Ffree: resp.Ffree, - Bsize: resp.Bsize, - Namelen: resp.Namelen, - Frsize: resp.Frsize, - } - r.respond(buf) -} - -// A StatfsResponse is the response to a StatfsRequest. -type StatfsResponse struct { - Blocks uint64 // Total data blocks in file system. - Bfree uint64 // Free blocks in file system. - Bavail uint64 // Free blocks in file system if you're not root. - Files uint64 // Total files in file system. - Ffree uint64 // Free files in file system. - Bsize uint32 // Block size - Namelen uint32 // Maximum file name length? - Frsize uint32 // Fragment size, smallest addressable data size in the file system. -} - -func (r *StatfsResponse) String() string { - return fmt.Sprintf("Statfs blocks=%d/%d/%d files=%d/%d bsize=%d frsize=%d namelen=%d", - r.Bavail, r.Bfree, r.Blocks, - r.Ffree, r.Files, - r.Bsize, - r.Frsize, - r.Namelen, - ) -} - -// An AccessRequest asks whether the file can be accessed -// for the purpose specified by the mask. -type AccessRequest struct { - Header `json:"-"` - Mask uint32 -} - -var _ = Request(&AccessRequest{}) - -func (r *AccessRequest) String() string { - return fmt.Sprintf("Access [%s] mask=%#x", &r.Header, r.Mask) -} - -// Respond replies to the request indicating that access is allowed. -// To deny access, use RespondError. -func (r *AccessRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// An Attr is the metadata for a single file or directory. -type Attr struct { - Valid time.Duration // how long Attr can be cached - - Inode uint64 // inode number - Size uint64 // size in bytes - Blocks uint64 // size in 512-byte units - Atime time.Time // time of last access - Mtime time.Time // time of last modification - Ctime time.Time // time of last inode change - Crtime time.Time // time of creation (OS X only) - Mode os.FileMode // file mode - Nlink uint32 // number of links (usually 1) - Uid uint32 // owner uid - Gid uint32 // group gid - Rdev uint32 // device numbers - Flags uint32 // chflags(2) flags (OS X only) - BlockSize uint32 // preferred blocksize for filesystem I/O -} - -func (a Attr) String() string { - return fmt.Sprintf("valid=%v ino=%v size=%d mode=%v", a.Valid, a.Inode, a.Size, a.Mode) -} - -func unix(t time.Time) (sec uint64, nsec uint32) { - nano := t.UnixNano() - sec = uint64(nano / 1e9) - nsec = uint32(nano % 1e9) - return -} - -func (a *Attr) attr(out *attr, proto Protocol) { - out.Ino = a.Inode - out.Size = a.Size - out.Blocks = a.Blocks - out.Atime, out.AtimeNsec = unix(a.Atime) - out.Mtime, out.MtimeNsec = unix(a.Mtime) - out.Ctime, out.CtimeNsec = unix(a.Ctime) - out.SetCrtime(unix(a.Crtime)) - out.Mode = uint32(a.Mode) & 0777 - switch { - default: - out.Mode |= syscall.S_IFREG - case a.Mode&os.ModeDir != 0: - out.Mode |= syscall.S_IFDIR - case a.Mode&os.ModeDevice != 0: - if a.Mode&os.ModeCharDevice != 0 { - out.Mode |= syscall.S_IFCHR - } else { - out.Mode |= syscall.S_IFBLK - } - case a.Mode&os.ModeNamedPipe != 0: - out.Mode |= syscall.S_IFIFO - case a.Mode&os.ModeSymlink != 0: - out.Mode |= syscall.S_IFLNK - case a.Mode&os.ModeSocket != 0: - out.Mode |= syscall.S_IFSOCK - } - if a.Mode&os.ModeSetuid != 0 { - out.Mode |= syscall.S_ISUID - } - if a.Mode&os.ModeSetgid != 0 { - out.Mode |= syscall.S_ISGID - } - out.Nlink = a.Nlink - out.Uid = a.Uid - out.Gid = a.Gid - out.Rdev = a.Rdev - out.SetFlags(a.Flags) - if proto.GE(Protocol{7, 9}) { - out.Blksize = a.BlockSize - } - - return -} - -// A GetattrRequest asks for the metadata for the file denoted by r.Node. -type GetattrRequest struct { - Header `json:"-"` - Flags GetattrFlags - Handle HandleID -} - -var _ = Request(&GetattrRequest{}) - -func (r *GetattrRequest) String() string { - return fmt.Sprintf("Getattr [%s] %v fl=%v", &r.Header, r.Handle, r.Flags) -} - -// Respond replies to the request with the given response. -func (r *GetattrRequest) Respond(resp *GetattrResponse) { - size := attrOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*attrOut)(buf.alloc(size)) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A GetattrResponse is the response to a GetattrRequest. -type GetattrResponse struct { - Attr Attr // file attributes -} - -func (r *GetattrResponse) String() string { - return fmt.Sprintf("Getattr %v", r.Attr) -} - -// A GetxattrRequest asks for the extended attributes associated with r.Node. -type GetxattrRequest struct { - Header `json:"-"` - - // Maximum size to return. - Size uint32 - - // Name of the attribute requested. - Name string - - // Offset within extended attributes. - // - // Only valid for OS X, and then only with the resource fork - // attribute. - Position uint32 -} - -var _ = Request(&GetxattrRequest{}) - -func (r *GetxattrRequest) String() string { - return fmt.Sprintf("Getxattr [%s] %q %d @%d", &r.Header, r.Name, r.Size, r.Position) -} - -// Respond replies to the request with the given response. -func (r *GetxattrRequest) Respond(resp *GetxattrResponse) { - if r.Size == 0 { - buf := newBuffer(unsafe.Sizeof(getxattrOut{})) - out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{}))) - out.Size = uint32(len(resp.Xattr)) - r.respond(buf) - } else { - buf := newBuffer(uintptr(len(resp.Xattr))) - buf = append(buf, resp.Xattr...) - r.respond(buf) - } -} - -// A GetxattrResponse is the response to a GetxattrRequest. -type GetxattrResponse struct { - Xattr []byte -} - -func (r *GetxattrResponse) String() string { - return fmt.Sprintf("Getxattr %x", r.Xattr) -} - -// A ListxattrRequest asks to list the extended attributes associated with r.Node. -type ListxattrRequest struct { - Header `json:"-"` - Size uint32 // maximum size to return - Position uint32 // offset within attribute list -} - -var _ = Request(&ListxattrRequest{}) - -func (r *ListxattrRequest) String() string { - return fmt.Sprintf("Listxattr [%s] %d @%d", &r.Header, r.Size, r.Position) -} - -// Respond replies to the request with the given response. -func (r *ListxattrRequest) Respond(resp *ListxattrResponse) { - if r.Size == 0 { - buf := newBuffer(unsafe.Sizeof(getxattrOut{})) - out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{}))) - out.Size = uint32(len(resp.Xattr)) - r.respond(buf) - } else { - buf := newBuffer(uintptr(len(resp.Xattr))) - buf = append(buf, resp.Xattr...) - r.respond(buf) - } -} - -// A ListxattrResponse is the response to a ListxattrRequest. -type ListxattrResponse struct { - Xattr []byte -} - -func (r *ListxattrResponse) String() string { - return fmt.Sprintf("Listxattr %x", r.Xattr) -} - -// Append adds an extended attribute name to the response. -func (r *ListxattrResponse) Append(names ...string) { - for _, name := range names { - r.Xattr = append(r.Xattr, name...) - r.Xattr = append(r.Xattr, '\x00') - } -} - -// A RemovexattrRequest asks to remove an extended attribute associated with r.Node. -type RemovexattrRequest struct { - Header `json:"-"` - Name string // name of extended attribute -} - -var _ = Request(&RemovexattrRequest{}) - -func (r *RemovexattrRequest) String() string { - return fmt.Sprintf("Removexattr [%s] %q", &r.Header, r.Name) -} - -// Respond replies to the request, indicating that the attribute was removed. -func (r *RemovexattrRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A SetxattrRequest asks to set an extended attribute associated with a file. -type SetxattrRequest struct { - Header `json:"-"` - - // Flags can make the request fail if attribute does/not already - // exist. Unfortunately, the constants are platform-specific and - // not exposed by Go1.2. Look for XATTR_CREATE, XATTR_REPLACE. - // - // TODO improve this later - // - // TODO XATTR_CREATE and exist -> EEXIST - // - // TODO XATTR_REPLACE and not exist -> ENODATA - Flags uint32 - - // Offset within extended attributes. - // - // Only valid for OS X, and then only with the resource fork - // attribute. - Position uint32 - - Name string - Xattr []byte -} - -var _ = Request(&SetxattrRequest{}) - -func trunc(b []byte, max int) ([]byte, string) { - if len(b) > max { - return b[:max], "..." - } - return b, "" -} - -func (r *SetxattrRequest) String() string { - xattr, tail := trunc(r.Xattr, 16) - return fmt.Sprintf("Setxattr [%s] %q %x%s fl=%v @%#x", &r.Header, r.Name, xattr, tail, r.Flags, r.Position) -} - -// Respond replies to the request, indicating that the extended attribute was set. -func (r *SetxattrRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A LookupRequest asks to look up the given name in the directory named by r.Node. -type LookupRequest struct { - Header `json:"-"` - Name string -} - -var _ = Request(&LookupRequest{}) - -func (r *LookupRequest) String() string { - return fmt.Sprintf("Lookup [%s] %q", &r.Header, r.Name) -} - -// Respond replies to the request with the given response. -func (r *LookupRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A LookupResponse is the response to a LookupRequest. -type LookupResponse struct { - Node NodeID - Generation uint64 - EntryValid time.Duration - Attr Attr -} - -func (r *LookupResponse) string() string { - return fmt.Sprintf("%v gen=%d valid=%v attr={%v}", r.Node, r.Generation, r.EntryValid, r.Attr) -} - -func (r *LookupResponse) String() string { - return fmt.Sprintf("Lookup %s", r.string()) -} - -// An OpenRequest asks to open a file or directory -type OpenRequest struct { - Header `json:"-"` - Dir bool // is this Opendir? - Flags OpenFlags -} - -var _ = Request(&OpenRequest{}) - -func (r *OpenRequest) String() string { - return fmt.Sprintf("Open [%s] dir=%v fl=%v", &r.Header, r.Dir, r.Flags) -} - -// Respond replies to the request with the given response. -func (r *OpenRequest) Respond(resp *OpenResponse) { - buf := newBuffer(unsafe.Sizeof(openOut{})) - out := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{}))) - out.Fh = uint64(resp.Handle) - out.OpenFlags = uint32(resp.Flags) - r.respond(buf) -} - -// A OpenResponse is the response to a OpenRequest. -type OpenResponse struct { - Handle HandleID - Flags OpenResponseFlags -} - -func (r *OpenResponse) string() string { - return fmt.Sprintf("%v fl=%v", r.Handle, r.Flags) -} - -func (r *OpenResponse) String() string { - return fmt.Sprintf("Open %s", r.string()) -} - -// A CreateRequest asks to create and open a file (not a directory). -type CreateRequest struct { - Header `json:"-"` - Name string - Flags OpenFlags - Mode os.FileMode - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&CreateRequest{}) - -func (r *CreateRequest) String() string { - return fmt.Sprintf("Create [%s] %q fl=%v mode=%v umask=%v", &r.Header, r.Name, r.Flags, r.Mode, r.Umask) -} - -// Respond replies to the request with the given response. -func (r *CreateRequest) Respond(resp *CreateResponse) { - eSize := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(eSize + unsafe.Sizeof(openOut{})) - - e := (*entryOut)(buf.alloc(eSize)) - e.Nodeid = uint64(resp.Node) - e.Generation = resp.Generation - e.EntryValid = uint64(resp.EntryValid / time.Second) - e.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - e.AttrValid = uint64(resp.Attr.Valid / time.Second) - e.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&e.Attr, r.Header.Conn.proto) - - o := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{}))) - o.Fh = uint64(resp.Handle) - o.OpenFlags = uint32(resp.Flags) - - r.respond(buf) -} - -// A CreateResponse is the response to a CreateRequest. -// It describes the created node and opened handle. -type CreateResponse struct { - LookupResponse - OpenResponse -} - -func (r *CreateResponse) String() string { - return fmt.Sprintf("Create {%s} {%s}", r.LookupResponse.string(), r.OpenResponse.string()) -} - -// A MkdirRequest asks to create (but not open) a directory. -type MkdirRequest struct { - Header `json:"-"` - Name string - Mode os.FileMode - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&MkdirRequest{}) - -func (r *MkdirRequest) String() string { - return fmt.Sprintf("Mkdir [%s] %q mode=%v umask=%v", &r.Header, r.Name, r.Mode, r.Umask) -} - -// Respond replies to the request with the given response. -func (r *MkdirRequest) Respond(resp *MkdirResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A MkdirResponse is the response to a MkdirRequest. -type MkdirResponse struct { - LookupResponse -} - -func (r *MkdirResponse) String() string { - return fmt.Sprintf("Mkdir %v", r.LookupResponse.string()) -} - -// A ReadRequest asks to read from an open file. -type ReadRequest struct { - Header `json:"-"` - Dir bool // is this Readdir? - Handle HandleID - Offset int64 - Size int - Flags ReadFlags - LockOwner uint64 - FileFlags OpenFlags -} - -var _ = Request(&ReadRequest{}) - -func (r *ReadRequest) String() string { - return fmt.Sprintf("Read [%s] %v %d @%#x dir=%v fl=%v lock=%d ffl=%v", &r.Header, r.Handle, r.Size, r.Offset, r.Dir, r.Flags, r.LockOwner, r.FileFlags) -} - -// Respond replies to the request with the given response. -func (r *ReadRequest) Respond(resp *ReadResponse) { - buf := newBuffer(uintptr(len(resp.Data))) - buf = append(buf, resp.Data...) - r.respond(buf) -} - -// A ReadResponse is the response to a ReadRequest. -type ReadResponse struct { - Data []byte -} - -func (r *ReadResponse) String() string { - return fmt.Sprintf("Read %d", len(r.Data)) -} - -type jsonReadResponse struct { - Len uint64 -} - -func (r *ReadResponse) MarshalJSON() ([]byte, error) { - j := jsonReadResponse{ - Len: uint64(len(r.Data)), - } - return json.Marshal(j) -} - -// A ReleaseRequest asks to release (close) an open file handle. -type ReleaseRequest struct { - Header `json:"-"` - Dir bool // is this Releasedir? - Handle HandleID - Flags OpenFlags // flags from OpenRequest - ReleaseFlags ReleaseFlags - LockOwner uint32 -} - -var _ = Request(&ReleaseRequest{}) - -func (r *ReleaseRequest) String() string { - return fmt.Sprintf("Release [%s] %v fl=%v rfl=%v owner=%#x", &r.Header, r.Handle, r.Flags, r.ReleaseFlags, r.LockOwner) -} - -// Respond replies to the request, indicating that the handle has been released. -func (r *ReleaseRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A DestroyRequest is sent by the kernel when unmounting the file system. -// No more requests will be received after this one, but it should still be -// responded to. -type DestroyRequest struct { - Header `json:"-"` -} - -var _ = Request(&DestroyRequest{}) - -func (r *DestroyRequest) String() string { - return fmt.Sprintf("Destroy [%s]", &r.Header) -} - -// Respond replies to the request. -func (r *DestroyRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A ForgetRequest is sent by the kernel when forgetting about r.Node -// as returned by r.N lookup requests. -type ForgetRequest struct { - Header `json:"-"` - N uint64 -} - -var _ = Request(&ForgetRequest{}) - -func (r *ForgetRequest) String() string { - return fmt.Sprintf("Forget [%s] %d", &r.Header, r.N) -} - -// Respond replies to the request, indicating that the forgetfulness has been recorded. -func (r *ForgetRequest) Respond() { - // Don't reply to forget messages. - r.noResponse() -} - -// A Dirent represents a single directory entry. -type Dirent struct { - // Inode this entry names. - Inode uint64 - - // Type of the entry, for example DT_File. - // - // Setting this is optional. The zero value (DT_Unknown) means - // callers will just need to do a Getattr when the type is - // needed. Providing a type can speed up operations - // significantly. - Type DirentType - - // Name of the entry - Name string -} - -// Type of an entry in a directory listing. -type DirentType uint32 - -const ( - // These don't quite match os.FileMode; especially there's an - // explicit unknown, instead of zero value meaning file. They - // are also not quite syscall.DT_*; nothing says the FUSE - // protocol follows those, and even if they were, we don't - // want each fs to fiddle with syscall. - - // The shift by 12 is hardcoded in the FUSE userspace - // low-level C library, so it's safe here. - - DT_Unknown DirentType = 0 - DT_Socket DirentType = syscall.S_IFSOCK >> 12 - DT_Link DirentType = syscall.S_IFLNK >> 12 - DT_File DirentType = syscall.S_IFREG >> 12 - DT_Block DirentType = syscall.S_IFBLK >> 12 - DT_Dir DirentType = syscall.S_IFDIR >> 12 - DT_Char DirentType = syscall.S_IFCHR >> 12 - DT_FIFO DirentType = syscall.S_IFIFO >> 12 -) - -func (t DirentType) String() string { - switch t { - case DT_Unknown: - return "unknown" - case DT_Socket: - return "socket" - case DT_Link: - return "link" - case DT_File: - return "file" - case DT_Block: - return "block" - case DT_Dir: - return "dir" - case DT_Char: - return "char" - case DT_FIFO: - return "fifo" - } - return "invalid" -} - -// AppendDirent appends the encoded form of a directory entry to data -// and returns the resulting slice. -func AppendDirent(data []byte, dir Dirent) []byte { - de := dirent{ - Ino: dir.Inode, - Namelen: uint32(len(dir.Name)), - Type: uint32(dir.Type), - } - de.Off = uint64(len(data) + direntSize + (len(dir.Name)+7)&^7) - data = append(data, (*[direntSize]byte)(unsafe.Pointer(&de))[:]...) - data = append(data, dir.Name...) - n := direntSize + uintptr(len(dir.Name)) - if n%8 != 0 { - var pad [8]byte - data = append(data, pad[:8-n%8]...) - } - return data -} - -// A WriteRequest asks to write to an open file. -type WriteRequest struct { - Header - Handle HandleID - Offset int64 - Data []byte - Flags WriteFlags - LockOwner uint64 - FileFlags OpenFlags -} - -var _ = Request(&WriteRequest{}) - -func (r *WriteRequest) String() string { - return fmt.Sprintf("Write [%s] %v %d @%d fl=%v lock=%d ffl=%v", &r.Header, r.Handle, len(r.Data), r.Offset, r.Flags, r.LockOwner, r.FileFlags) -} - -type jsonWriteRequest struct { - Handle HandleID - Offset int64 - Len uint64 - Flags WriteFlags -} - -func (r *WriteRequest) MarshalJSON() ([]byte, error) { - j := jsonWriteRequest{ - Handle: r.Handle, - Offset: r.Offset, - Len: uint64(len(r.Data)), - Flags: r.Flags, - } - return json.Marshal(j) -} - -// Respond replies to the request with the given response. -func (r *WriteRequest) Respond(resp *WriteResponse) { - buf := newBuffer(unsafe.Sizeof(writeOut{})) - out := (*writeOut)(buf.alloc(unsafe.Sizeof(writeOut{}))) - out.Size = uint32(resp.Size) - r.respond(buf) -} - -// A WriteResponse replies to a write indicating how many bytes were written. -type WriteResponse struct { - Size int -} - -func (r *WriteResponse) String() string { - return fmt.Sprintf("Write %d", r.Size) -} - -// A SetattrRequest asks to change one or more attributes associated with a file, -// as indicated by Valid. -type SetattrRequest struct { - Header `json:"-"` - Valid SetattrValid - Handle HandleID - Size uint64 - Atime time.Time - Mtime time.Time - Mode os.FileMode - Uid uint32 - Gid uint32 - - // OS X only - Bkuptime time.Time - Chgtime time.Time - Crtime time.Time - Flags uint32 // see chflags(2) -} - -var _ = Request(&SetattrRequest{}) - -func (r *SetattrRequest) String() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "Setattr [%s]", &r.Header) - if r.Valid.Mode() { - fmt.Fprintf(&buf, " mode=%v", r.Mode) - } - if r.Valid.Uid() { - fmt.Fprintf(&buf, " uid=%d", r.Uid) - } - if r.Valid.Gid() { - fmt.Fprintf(&buf, " gid=%d", r.Gid) - } - if r.Valid.Size() { - fmt.Fprintf(&buf, " size=%d", r.Size) - } - if r.Valid.Atime() { - fmt.Fprintf(&buf, " atime=%v", r.Atime) - } - if r.Valid.AtimeNow() { - fmt.Fprintf(&buf, " atime=now") - } - if r.Valid.Mtime() { - fmt.Fprintf(&buf, " mtime=%v", r.Mtime) - } - if r.Valid.MtimeNow() { - fmt.Fprintf(&buf, " mtime=now") - } - if r.Valid.Handle() { - fmt.Fprintf(&buf, " handle=%v", r.Handle) - } else { - fmt.Fprintf(&buf, " handle=INVALID-%v", r.Handle) - } - if r.Valid.LockOwner() { - fmt.Fprintf(&buf, " lockowner") - } - if r.Valid.Crtime() { - fmt.Fprintf(&buf, " crtime=%v", r.Crtime) - } - if r.Valid.Chgtime() { - fmt.Fprintf(&buf, " chgtime=%v", r.Chgtime) - } - if r.Valid.Bkuptime() { - fmt.Fprintf(&buf, " bkuptime=%v", r.Bkuptime) - } - if r.Valid.Flags() { - fmt.Fprintf(&buf, " flags=%v", r.Flags) - } - return buf.String() -} - -// Respond replies to the request with the given response, -// giving the updated attributes. -func (r *SetattrRequest) Respond(resp *SetattrResponse) { - size := attrOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*attrOut)(buf.alloc(size)) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A SetattrResponse is the response to a SetattrRequest. -type SetattrResponse struct { - Attr Attr // file attributes -} - -func (r *SetattrResponse) String() string { - return fmt.Sprintf("Setattr %v", r.Attr) -} - -// A FlushRequest asks for the current state of an open file to be flushed -// to storage, as when a file descriptor is being closed. A single opened Handle -// may receive multiple FlushRequests over its lifetime. -type FlushRequest struct { - Header `json:"-"` - Handle HandleID - Flags uint32 - LockOwner uint64 -} - -var _ = Request(&FlushRequest{}) - -func (r *FlushRequest) String() string { - return fmt.Sprintf("Flush [%s] %v fl=%#x lk=%#x", &r.Header, r.Handle, r.Flags, r.LockOwner) -} - -// Respond replies to the request, indicating that the flush succeeded. -func (r *FlushRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A RemoveRequest asks to remove a file or directory from the -// directory r.Node. -type RemoveRequest struct { - Header `json:"-"` - Name string // name of the entry to remove - Dir bool // is this rmdir? -} - -var _ = Request(&RemoveRequest{}) - -func (r *RemoveRequest) String() string { - return fmt.Sprintf("Remove [%s] %q dir=%v", &r.Header, r.Name, r.Dir) -} - -// Respond replies to the request, indicating that the file was removed. -func (r *RemoveRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A SymlinkRequest is a request to create a symlink making NewName point to Target. -type SymlinkRequest struct { - Header `json:"-"` - NewName, Target string -} - -var _ = Request(&SymlinkRequest{}) - -func (r *SymlinkRequest) String() string { - return fmt.Sprintf("Symlink [%s] from %q to target %q", &r.Header, r.NewName, r.Target) -} - -// Respond replies to the request, indicating that the symlink was created. -func (r *SymlinkRequest) Respond(resp *SymlinkResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A SymlinkResponse is the response to a SymlinkRequest. -type SymlinkResponse struct { - LookupResponse -} - -func (r *SymlinkResponse) String() string { - return fmt.Sprintf("Symlink %v", r.LookupResponse.string()) -} - -// A ReadlinkRequest is a request to read a symlink's target. -type ReadlinkRequest struct { - Header `json:"-"` -} - -var _ = Request(&ReadlinkRequest{}) - -func (r *ReadlinkRequest) String() string { - return fmt.Sprintf("Readlink [%s]", &r.Header) -} - -func (r *ReadlinkRequest) Respond(target string) { - buf := newBuffer(uintptr(len(target))) - buf = append(buf, target...) - r.respond(buf) -} - -// A LinkRequest is a request to create a hard link. -type LinkRequest struct { - Header `json:"-"` - OldNode NodeID - NewName string -} - -var _ = Request(&LinkRequest{}) - -func (r *LinkRequest) String() string { - return fmt.Sprintf("Link [%s] node %d to %q", &r.Header, r.OldNode, r.NewName) -} - -func (r *LinkRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A RenameRequest is a request to rename a file. -type RenameRequest struct { - Header `json:"-"` - NewDir NodeID - OldName, NewName string -} - -var _ = Request(&RenameRequest{}) - -func (r *RenameRequest) String() string { - return fmt.Sprintf("Rename [%s] from %q to dirnode %v %q", &r.Header, r.OldName, r.NewDir, r.NewName) -} - -func (r *RenameRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -type MknodRequest struct { - Header `json:"-"` - Name string - Mode os.FileMode - Rdev uint32 - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&MknodRequest{}) - -func (r *MknodRequest) String() string { - return fmt.Sprintf("Mknod [%s] Name %q mode=%v umask=%v rdev=%d", &r.Header, r.Name, r.Mode, r.Umask, r.Rdev) -} - -func (r *MknodRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -type FsyncRequest struct { - Header `json:"-"` - Handle HandleID - // TODO bit 1 is datasync, not well documented upstream - Flags uint32 - Dir bool -} - -var _ = Request(&FsyncRequest{}) - -func (r *FsyncRequest) String() string { - return fmt.Sprintf("Fsync [%s] Handle %v Flags %v", &r.Header, r.Handle, r.Flags) -} - -func (r *FsyncRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// An InterruptRequest is a request to interrupt another pending request. The -// response to that request should return an error status of EINTR. -type InterruptRequest struct { - Header `json:"-"` - IntrID RequestID // ID of the request to be interrupt. -} - -var _ = Request(&InterruptRequest{}) - -func (r *InterruptRequest) Respond() { - // nothing to do here - r.noResponse() -} - -func (r *InterruptRequest) String() string { - return fmt.Sprintf("Interrupt [%s] ID %v", &r.Header, r.IntrID) -} - -// An ExchangeDataRequest is a request to exchange the contents of two -// files, while leaving most metadata untouched. -// -// This request comes from OS X exchangedata(2) and represents its -// specific semantics. Crucially, it is very different from Linux -// renameat(2) RENAME_EXCHANGE. -// -// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/exchangedata.2.html -type ExchangeDataRequest struct { - Header `json:"-"` - OldDir, NewDir NodeID - OldName, NewName string - // TODO options -} - -var _ = Request(&ExchangeDataRequest{}) - -func (r *ExchangeDataRequest) String() string { - // TODO options - return fmt.Sprintf("ExchangeData [%s] %v %q and %v %q", &r.Header, r.OldDir, r.OldName, r.NewDir, r.NewName) -} - -func (r *ExchangeDataRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} diff --git a/vendor/bazil.org/fuse/fuse_darwin.go b/vendor/bazil.org/fuse/fuse_darwin.go deleted file mode 100644 index b58dca97..00000000 --- a/vendor/bazil.org/fuse/fuse_darwin.go +++ /dev/null @@ -1,9 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// This value has to be >=16MB or OSXFUSE (3.4.0 observed) will -// forcibly close the /dev/fuse file descriptor on a Setxattr with a -// 16MB value. See TestSetxattr16MB and -// https://github.com/bazil/fuse/issues/42 -const maxWrite = 16 * 1024 * 1024 diff --git a/vendor/bazil.org/fuse/fuse_freebsd.go b/vendor/bazil.org/fuse/fuse_freebsd.go deleted file mode 100644 index 4aa83a0d..00000000 --- a/vendor/bazil.org/fuse/fuse_freebsd.go +++ /dev/null @@ -1,6 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// This number is just a guess. -const maxWrite = 128 * 1024 diff --git a/vendor/bazil.org/fuse/fuse_kernel.go b/vendor/bazil.org/fuse/fuse_kernel.go deleted file mode 100644 index 87c5ca1d..00000000 --- a/vendor/bazil.org/fuse/fuse_kernel.go +++ /dev/null @@ -1,774 +0,0 @@ -// See the file LICENSE for copyright and licensing information. - -// Derived from FUSE's fuse_kernel.h, which carries this notice: -/* - This file defines the kernel interface of FUSE - Copyright (C) 2001-2007 Miklos Szeredi - - - This -- and only this -- header file may also be distributed under - the terms of the BSD Licence as follows: - - Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -package fuse - -import ( - "fmt" - "syscall" - "unsafe" -) - -// The FUSE version implemented by the package. -const ( - protoVersionMinMajor = 7 - protoVersionMinMinor = 8 - protoVersionMaxMajor = 7 - protoVersionMaxMinor = 12 -) - -const ( - rootID = 1 -) - -type kstatfs struct { - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Bsize uint32 - Namelen uint32 - Frsize uint32 - _ uint32 - Spare [6]uint32 -} - -type fileLock struct { - Start uint64 - End uint64 - Type uint32 - Pid uint32 -} - -// GetattrFlags are bit flags that can be seen in GetattrRequest. -type GetattrFlags uint32 - -const ( - // Indicates the handle is valid. - GetattrFh GetattrFlags = 1 << 0 -) - -var getattrFlagsNames = []flagName{ - {uint32(GetattrFh), "GetattrFh"}, -} - -func (fl GetattrFlags) String() string { - return flagString(uint32(fl), getattrFlagsNames) -} - -// The SetattrValid are bit flags describing which fields in the SetattrRequest -// are included in the change. -type SetattrValid uint32 - -const ( - SetattrMode SetattrValid = 1 << 0 - SetattrUid SetattrValid = 1 << 1 - SetattrGid SetattrValid = 1 << 2 - SetattrSize SetattrValid = 1 << 3 - SetattrAtime SetattrValid = 1 << 4 - SetattrMtime SetattrValid = 1 << 5 - SetattrHandle SetattrValid = 1 << 6 - - // Linux only(?) - SetattrAtimeNow SetattrValid = 1 << 7 - SetattrMtimeNow SetattrValid = 1 << 8 - SetattrLockOwner SetattrValid = 1 << 9 // http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg27852.html - - // OS X only - SetattrCrtime SetattrValid = 1 << 28 - SetattrChgtime SetattrValid = 1 << 29 - SetattrBkuptime SetattrValid = 1 << 30 - SetattrFlags SetattrValid = 1 << 31 -) - -func (fl SetattrValid) Mode() bool { return fl&SetattrMode != 0 } -func (fl SetattrValid) Uid() bool { return fl&SetattrUid != 0 } -func (fl SetattrValid) Gid() bool { return fl&SetattrGid != 0 } -func (fl SetattrValid) Size() bool { return fl&SetattrSize != 0 } -func (fl SetattrValid) Atime() bool { return fl&SetattrAtime != 0 } -func (fl SetattrValid) Mtime() bool { return fl&SetattrMtime != 0 } -func (fl SetattrValid) Handle() bool { return fl&SetattrHandle != 0 } -func (fl SetattrValid) AtimeNow() bool { return fl&SetattrAtimeNow != 0 } -func (fl SetattrValid) MtimeNow() bool { return fl&SetattrMtimeNow != 0 } -func (fl SetattrValid) LockOwner() bool { return fl&SetattrLockOwner != 0 } -func (fl SetattrValid) Crtime() bool { return fl&SetattrCrtime != 0 } -func (fl SetattrValid) Chgtime() bool { return fl&SetattrChgtime != 0 } -func (fl SetattrValid) Bkuptime() bool { return fl&SetattrBkuptime != 0 } -func (fl SetattrValid) Flags() bool { return fl&SetattrFlags != 0 } - -func (fl SetattrValid) String() string { - return flagString(uint32(fl), setattrValidNames) -} - -var setattrValidNames = []flagName{ - {uint32(SetattrMode), "SetattrMode"}, - {uint32(SetattrUid), "SetattrUid"}, - {uint32(SetattrGid), "SetattrGid"}, - {uint32(SetattrSize), "SetattrSize"}, - {uint32(SetattrAtime), "SetattrAtime"}, - {uint32(SetattrMtime), "SetattrMtime"}, - {uint32(SetattrHandle), "SetattrHandle"}, - {uint32(SetattrAtimeNow), "SetattrAtimeNow"}, - {uint32(SetattrMtimeNow), "SetattrMtimeNow"}, - {uint32(SetattrLockOwner), "SetattrLockOwner"}, - {uint32(SetattrCrtime), "SetattrCrtime"}, - {uint32(SetattrChgtime), "SetattrChgtime"}, - {uint32(SetattrBkuptime), "SetattrBkuptime"}, - {uint32(SetattrFlags), "SetattrFlags"}, -} - -// Flags that can be seen in OpenRequest.Flags. -const ( - // Access modes. These are not 1-bit flags, but alternatives where - // only one can be chosen. See the IsReadOnly etc convenience - // methods. - OpenReadOnly OpenFlags = syscall.O_RDONLY - OpenWriteOnly OpenFlags = syscall.O_WRONLY - OpenReadWrite OpenFlags = syscall.O_RDWR - - // File was opened in append-only mode, all writes will go to end - // of file. OS X does not provide this information. - OpenAppend OpenFlags = syscall.O_APPEND - OpenCreate OpenFlags = syscall.O_CREAT - OpenDirectory OpenFlags = syscall.O_DIRECTORY - OpenExclusive OpenFlags = syscall.O_EXCL - OpenNonblock OpenFlags = syscall.O_NONBLOCK - OpenSync OpenFlags = syscall.O_SYNC - OpenTruncate OpenFlags = syscall.O_TRUNC -) - -// OpenAccessModeMask is a bitmask that separates the access mode -// from the other flags in OpenFlags. -const OpenAccessModeMask OpenFlags = syscall.O_ACCMODE - -// OpenFlags are the O_FOO flags passed to open/create/etc calls. For -// example, os.O_WRONLY | os.O_APPEND. -type OpenFlags uint32 - -func (fl OpenFlags) String() string { - // O_RDONLY, O_RWONLY, O_RDWR are not flags - s := accModeName(fl & OpenAccessModeMask) - flags := uint32(fl &^ OpenAccessModeMask) - if flags != 0 { - s = s + "+" + flagString(flags, openFlagNames) - } - return s -} - -// Return true if OpenReadOnly is set. -func (fl OpenFlags) IsReadOnly() bool { - return fl&OpenAccessModeMask == OpenReadOnly -} - -// Return true if OpenWriteOnly is set. -func (fl OpenFlags) IsWriteOnly() bool { - return fl&OpenAccessModeMask == OpenWriteOnly -} - -// Return true if OpenReadWrite is set. -func (fl OpenFlags) IsReadWrite() bool { - return fl&OpenAccessModeMask == OpenReadWrite -} - -func accModeName(flags OpenFlags) string { - switch flags { - case OpenReadOnly: - return "OpenReadOnly" - case OpenWriteOnly: - return "OpenWriteOnly" - case OpenReadWrite: - return "OpenReadWrite" - default: - return "" - } -} - -var openFlagNames = []flagName{ - {uint32(OpenAppend), "OpenAppend"}, - {uint32(OpenCreate), "OpenCreate"}, - {uint32(OpenDirectory), "OpenDirectory"}, - {uint32(OpenExclusive), "OpenExclusive"}, - {uint32(OpenNonblock), "OpenNonblock"}, - {uint32(OpenSync), "OpenSync"}, - {uint32(OpenTruncate), "OpenTruncate"}, -} - -// The OpenResponseFlags are returned in the OpenResponse. -type OpenResponseFlags uint32 - -const ( - OpenDirectIO OpenResponseFlags = 1 << 0 // bypass page cache for this open file - OpenKeepCache OpenResponseFlags = 1 << 1 // don't invalidate the data cache on open - OpenNonSeekable OpenResponseFlags = 1 << 2 // mark the file as non-seekable (not supported on OS X) - - OpenPurgeAttr OpenResponseFlags = 1 << 30 // OS X - OpenPurgeUBC OpenResponseFlags = 1 << 31 // OS X -) - -func (fl OpenResponseFlags) String() string { - return flagString(uint32(fl), openResponseFlagNames) -} - -var openResponseFlagNames = []flagName{ - {uint32(OpenDirectIO), "OpenDirectIO"}, - {uint32(OpenKeepCache), "OpenKeepCache"}, - {uint32(OpenNonSeekable), "OpenNonSeekable"}, - {uint32(OpenPurgeAttr), "OpenPurgeAttr"}, - {uint32(OpenPurgeUBC), "OpenPurgeUBC"}, -} - -// The InitFlags are used in the Init exchange. -type InitFlags uint32 - -const ( - InitAsyncRead InitFlags = 1 << 0 - InitPosixLocks InitFlags = 1 << 1 - InitFileOps InitFlags = 1 << 2 - InitAtomicTrunc InitFlags = 1 << 3 - InitExportSupport InitFlags = 1 << 4 - InitBigWrites InitFlags = 1 << 5 - // Do not mask file access modes with umask. Not supported on OS X. - InitDontMask InitFlags = 1 << 6 - InitSpliceWrite InitFlags = 1 << 7 - InitSpliceMove InitFlags = 1 << 8 - InitSpliceRead InitFlags = 1 << 9 - InitFlockLocks InitFlags = 1 << 10 - InitHasIoctlDir InitFlags = 1 << 11 - InitAutoInvalData InitFlags = 1 << 12 - InitDoReaddirplus InitFlags = 1 << 13 - InitReaddirplusAuto InitFlags = 1 << 14 - InitAsyncDIO InitFlags = 1 << 15 - InitWritebackCache InitFlags = 1 << 16 - InitNoOpenSupport InitFlags = 1 << 17 - - InitCaseSensitive InitFlags = 1 << 29 // OS X only - InitVolRename InitFlags = 1 << 30 // OS X only - InitXtimes InitFlags = 1 << 31 // OS X only -) - -type flagName struct { - bit uint32 - name string -} - -var initFlagNames = []flagName{ - {uint32(InitAsyncRead), "InitAsyncRead"}, - {uint32(InitPosixLocks), "InitPosixLocks"}, - {uint32(InitFileOps), "InitFileOps"}, - {uint32(InitAtomicTrunc), "InitAtomicTrunc"}, - {uint32(InitExportSupport), "InitExportSupport"}, - {uint32(InitBigWrites), "InitBigWrites"}, - {uint32(InitDontMask), "InitDontMask"}, - {uint32(InitSpliceWrite), "InitSpliceWrite"}, - {uint32(InitSpliceMove), "InitSpliceMove"}, - {uint32(InitSpliceRead), "InitSpliceRead"}, - {uint32(InitFlockLocks), "InitFlockLocks"}, - {uint32(InitHasIoctlDir), "InitHasIoctlDir"}, - {uint32(InitAutoInvalData), "InitAutoInvalData"}, - {uint32(InitDoReaddirplus), "InitDoReaddirplus"}, - {uint32(InitReaddirplusAuto), "InitReaddirplusAuto"}, - {uint32(InitAsyncDIO), "InitAsyncDIO"}, - {uint32(InitWritebackCache), "InitWritebackCache"}, - {uint32(InitNoOpenSupport), "InitNoOpenSupport"}, - - {uint32(InitCaseSensitive), "InitCaseSensitive"}, - {uint32(InitVolRename), "InitVolRename"}, - {uint32(InitXtimes), "InitXtimes"}, -} - -func (fl InitFlags) String() string { - return flagString(uint32(fl), initFlagNames) -} - -func flagString(f uint32, names []flagName) string { - var s string - - if f == 0 { - return "0" - } - - for _, n := range names { - if f&n.bit != 0 { - s += "+" + n.name - f &^= n.bit - } - } - if f != 0 { - s += fmt.Sprintf("%+#x", f) - } - return s[1:] -} - -// The ReleaseFlags are used in the Release exchange. -type ReleaseFlags uint32 - -const ( - ReleaseFlush ReleaseFlags = 1 << 0 -) - -func (fl ReleaseFlags) String() string { - return flagString(uint32(fl), releaseFlagNames) -} - -var releaseFlagNames = []flagName{ - {uint32(ReleaseFlush), "ReleaseFlush"}, -} - -// Opcodes -const ( - opLookup = 1 - opForget = 2 // no reply - opGetattr = 3 - opSetattr = 4 - opReadlink = 5 - opSymlink = 6 - opMknod = 8 - opMkdir = 9 - opUnlink = 10 - opRmdir = 11 - opRename = 12 - opLink = 13 - opOpen = 14 - opRead = 15 - opWrite = 16 - opStatfs = 17 - opRelease = 18 - opFsync = 20 - opSetxattr = 21 - opGetxattr = 22 - opListxattr = 23 - opRemovexattr = 24 - opFlush = 25 - opInit = 26 - opOpendir = 27 - opReaddir = 28 - opReleasedir = 29 - opFsyncdir = 30 - opGetlk = 31 - opSetlk = 32 - opSetlkw = 33 - opAccess = 34 - opCreate = 35 - opInterrupt = 36 - opBmap = 37 - opDestroy = 38 - opIoctl = 39 // Linux? - opPoll = 40 // Linux? - - // OS X - opSetvolname = 61 - opGetxtimes = 62 - opExchange = 63 -) - -type entryOut struct { - Nodeid uint64 // Inode ID - Generation uint64 // Inode generation - EntryValid uint64 // Cache timeout for the name - AttrValid uint64 // Cache timeout for the attributes - EntryValidNsec uint32 - AttrValidNsec uint32 - Attr attr -} - -func entryOutSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(entryOut{}.Attr) + unsafe.Offsetof(entryOut{}.Attr.Blksize) - default: - return unsafe.Sizeof(entryOut{}) - } -} - -type forgetIn struct { - Nlookup uint64 -} - -type getattrIn struct { - GetattrFlags uint32 - _ uint32 - Fh uint64 -} - -type attrOut struct { - AttrValid uint64 // Cache timeout for the attributes - AttrValidNsec uint32 - _ uint32 - Attr attr -} - -func attrOutSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(attrOut{}.Attr) + unsafe.Offsetof(attrOut{}.Attr.Blksize) - default: - return unsafe.Sizeof(attrOut{}) - } -} - -// OS X -type getxtimesOut struct { - Bkuptime uint64 - Crtime uint64 - BkuptimeNsec uint32 - CrtimeNsec uint32 -} - -type mknodIn struct { - Mode uint32 - Rdev uint32 - Umask uint32 - _ uint32 - // "filename\x00" follows. -} - -func mknodInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(mknodIn{}.Umask) - default: - return unsafe.Sizeof(mknodIn{}) - } -} - -type mkdirIn struct { - Mode uint32 - Umask uint32 - // filename follows -} - -func mkdirInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(mkdirIn{}.Umask) + 4 - default: - return unsafe.Sizeof(mkdirIn{}) - } -} - -type renameIn struct { - Newdir uint64 - // "oldname\x00newname\x00" follows -} - -// OS X -type exchangeIn struct { - Olddir uint64 - Newdir uint64 - Options uint64 - // "oldname\x00newname\x00" follows -} - -type linkIn struct { - Oldnodeid uint64 -} - -type setattrInCommon struct { - Valid uint32 - _ uint32 - Fh uint64 - Size uint64 - LockOwner uint64 // unused on OS X? - Atime uint64 - Mtime uint64 - Unused2 uint64 - AtimeNsec uint32 - MtimeNsec uint32 - Unused3 uint32 - Mode uint32 - Unused4 uint32 - Uid uint32 - Gid uint32 - Unused5 uint32 -} - -type openIn struct { - Flags uint32 - Unused uint32 -} - -type openOut struct { - Fh uint64 - OpenFlags uint32 - _ uint32 -} - -type createIn struct { - Flags uint32 - Mode uint32 - Umask uint32 - _ uint32 -} - -func createInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(createIn{}.Umask) - default: - return unsafe.Sizeof(createIn{}) - } -} - -type releaseIn struct { - Fh uint64 - Flags uint32 - ReleaseFlags uint32 - LockOwner uint32 -} - -type flushIn struct { - Fh uint64 - FlushFlags uint32 - _ uint32 - LockOwner uint64 -} - -type readIn struct { - Fh uint64 - Offset uint64 - Size uint32 - ReadFlags uint32 - LockOwner uint64 - Flags uint32 - _ uint32 -} - -func readInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(readIn{}.ReadFlags) + 4 - default: - return unsafe.Sizeof(readIn{}) - } -} - -// The ReadFlags are passed in ReadRequest. -type ReadFlags uint32 - -const ( - // LockOwner field is valid. - ReadLockOwner ReadFlags = 1 << 1 -) - -var readFlagNames = []flagName{ - {uint32(ReadLockOwner), "ReadLockOwner"}, -} - -func (fl ReadFlags) String() string { - return flagString(uint32(fl), readFlagNames) -} - -type writeIn struct { - Fh uint64 - Offset uint64 - Size uint32 - WriteFlags uint32 - LockOwner uint64 - Flags uint32 - _ uint32 -} - -func writeInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(writeIn{}.LockOwner) - default: - return unsafe.Sizeof(writeIn{}) - } -} - -type writeOut struct { - Size uint32 - _ uint32 -} - -// The WriteFlags are passed in WriteRequest. -type WriteFlags uint32 - -const ( - WriteCache WriteFlags = 1 << 0 - // LockOwner field is valid. - WriteLockOwner WriteFlags = 1 << 1 -) - -var writeFlagNames = []flagName{ - {uint32(WriteCache), "WriteCache"}, - {uint32(WriteLockOwner), "WriteLockOwner"}, -} - -func (fl WriteFlags) String() string { - return flagString(uint32(fl), writeFlagNames) -} - -const compatStatfsSize = 48 - -type statfsOut struct { - St kstatfs -} - -type fsyncIn struct { - Fh uint64 - FsyncFlags uint32 - _ uint32 -} - -type setxattrInCommon struct { - Size uint32 - Flags uint32 -} - -func (setxattrInCommon) position() uint32 { - return 0 -} - -type getxattrInCommon struct { - Size uint32 - _ uint32 -} - -func (getxattrInCommon) position() uint32 { - return 0 -} - -type getxattrOut struct { - Size uint32 - _ uint32 -} - -type lkIn struct { - Fh uint64 - Owner uint64 - Lk fileLock - LkFlags uint32 - _ uint32 -} - -func lkInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(lkIn{}.LkFlags) - default: - return unsafe.Sizeof(lkIn{}) - } -} - -type lkOut struct { - Lk fileLock -} - -type accessIn struct { - Mask uint32 - _ uint32 -} - -type initIn struct { - Major uint32 - Minor uint32 - MaxReadahead uint32 - Flags uint32 -} - -const initInSize = int(unsafe.Sizeof(initIn{})) - -type initOut struct { - Major uint32 - Minor uint32 - MaxReadahead uint32 - Flags uint32 - Unused uint32 - MaxWrite uint32 -} - -type interruptIn struct { - Unique uint64 -} - -type bmapIn struct { - Block uint64 - BlockSize uint32 - _ uint32 -} - -type bmapOut struct { - Block uint64 -} - -type inHeader struct { - Len uint32 - Opcode uint32 - Unique uint64 - Nodeid uint64 - Uid uint32 - Gid uint32 - Pid uint32 - _ uint32 -} - -const inHeaderSize = int(unsafe.Sizeof(inHeader{})) - -type outHeader struct { - Len uint32 - Error int32 - Unique uint64 -} - -type dirent struct { - Ino uint64 - Off uint64 - Namelen uint32 - Type uint32 - Name [0]byte -} - -const direntSize = 8 + 8 + 4 + 4 - -const ( - notifyCodePoll int32 = 1 - notifyCodeInvalInode int32 = 2 - notifyCodeInvalEntry int32 = 3 -) - -type notifyInvalInodeOut struct { - Ino uint64 - Off int64 - Len int64 -} - -type notifyInvalEntryOut struct { - Parent uint64 - Namelen uint32 - _ uint32 -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_darwin.go b/vendor/bazil.org/fuse/fuse_kernel_darwin.go deleted file mode 100644 index b9873fdf..00000000 --- a/vendor/bazil.org/fuse/fuse_kernel_darwin.go +++ /dev/null @@ -1,88 +0,0 @@ -package fuse - -import ( - "time" -) - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - Crtime_ uint64 // OS X only - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - CrtimeNsec uint32 // OS X only - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Flags_ uint32 // OS X only; see chflags(2) - Blksize uint32 - padding uint32 -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - a.Crtime_, a.CrtimeNsec = s, ns -} - -func (a *attr) SetFlags(f uint32) { - a.Flags_ = f -} - -type setattrIn struct { - setattrInCommon - - // OS X only - Bkuptime_ uint64 - Chgtime_ uint64 - Crtime uint64 - BkuptimeNsec uint32 - ChgtimeNsec uint32 - CrtimeNsec uint32 - Flags_ uint32 // see chflags(2) -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Unix(int64(in.Bkuptime_), int64(in.BkuptimeNsec)) -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Unix(int64(in.Chgtime_), int64(in.ChgtimeNsec)) -} - -func (in *setattrIn) Flags() uint32 { - return in.Flags_ -} - -func openFlags(flags uint32) OpenFlags { - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon - - // OS X only - Position uint32 - Padding uint32 -} - -func (g *getxattrIn) position() uint32 { - return g.Position -} - -type setxattrIn struct { - setxattrInCommon - - // OS X only - Position uint32 - Padding uint32 -} - -func (s *setxattrIn) position() uint32 { - return s.Position -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_freebsd.go b/vendor/bazil.org/fuse/fuse_kernel_freebsd.go deleted file mode 100644 index b1141e41..00000000 --- a/vendor/bazil.org/fuse/fuse_kernel_freebsd.go +++ /dev/null @@ -1,62 +0,0 @@ -package fuse - -import "time" - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Blksize uint32 - padding uint32 -} - -func (a *attr) Crtime() time.Time { - return time.Time{} -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - // ignored on freebsd -} - -func (a *attr) SetFlags(f uint32) { - // ignored on freebsd -} - -type setattrIn struct { - setattrInCommon -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Flags() uint32 { - return 0 -} - -func openFlags(flags uint32) OpenFlags { - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon -} - -type setxattrIn struct { - setxattrInCommon -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_linux.go b/vendor/bazil.org/fuse/fuse_kernel_linux.go deleted file mode 100644 index d3ba8661..00000000 --- a/vendor/bazil.org/fuse/fuse_kernel_linux.go +++ /dev/null @@ -1,70 +0,0 @@ -package fuse - -import "time" - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Blksize uint32 - padding uint32 -} - -func (a *attr) Crtime() time.Time { - return time.Time{} -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - // Ignored on Linux. -} - -func (a *attr) SetFlags(f uint32) { - // Ignored on Linux. -} - -type setattrIn struct { - setattrInCommon -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Flags() uint32 { - return 0 -} - -func openFlags(flags uint32) OpenFlags { - // on amd64, the 32-bit O_LARGEFILE flag is always seen; - // on i386, the flag probably depends on the app - // requesting, but in any case should be utterly - // uninteresting to us here; our kernel protocol messages - // are not directly related to the client app's kernel - // API/ABI - flags &^= 0x8000 - - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon -} - -type setxattrIn struct { - setxattrInCommon -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_std.go b/vendor/bazil.org/fuse/fuse_kernel_std.go deleted file mode 100644 index 074cfd32..00000000 --- a/vendor/bazil.org/fuse/fuse_kernel_std.go +++ /dev/null @@ -1 +0,0 @@ -package fuse diff --git a/vendor/bazil.org/fuse/fuse_linux.go b/vendor/bazil.org/fuse/fuse_linux.go deleted file mode 100644 index 5fb96f9a..00000000 --- a/vendor/bazil.org/fuse/fuse_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// Linux 4.2.0 has been observed to cap this value at 128kB -// (FUSE_MAX_PAGES_PER_REQ=32, 4kB pages). -const maxWrite = 128 * 1024 diff --git a/vendor/bazil.org/fuse/fuseutil/fuseutil.go b/vendor/bazil.org/fuse/fuseutil/fuseutil.go deleted file mode 100644 index b3f52b73..00000000 --- a/vendor/bazil.org/fuse/fuseutil/fuseutil.go +++ /dev/null @@ -1,20 +0,0 @@ -package fuseutil // import "bazil.org/fuse/fuseutil" - -import ( - "bazil.org/fuse" -) - -// HandleRead handles a read request assuming that data is the entire file content. -// It adjusts the amount returned in resp according to req.Offset and req.Size. -func HandleRead(req *fuse.ReadRequest, resp *fuse.ReadResponse, data []byte) { - if req.Offset >= int64(len(data)) { - data = nil - } else { - data = data[req.Offset:] - } - if len(data) > req.Size { - data = data[:req.Size] - } - n := copy(resp.Data[:req.Size], data) - resp.Data = resp.Data[:n] -} diff --git a/vendor/bazil.org/fuse/mount.go b/vendor/bazil.org/fuse/mount.go deleted file mode 100644 index 8054e902..00000000 --- a/vendor/bazil.org/fuse/mount.go +++ /dev/null @@ -1,38 +0,0 @@ -package fuse - -import ( - "bufio" - "errors" - "io" - "log" - "sync" -) - -var ( - // ErrOSXFUSENotFound is returned from Mount when the OSXFUSE - // installation is not detected. - // - // Only happens on OS X. Make sure OSXFUSE is installed, or see - // OSXFUSELocations for customization. - ErrOSXFUSENotFound = errors.New("cannot locate OSXFUSE") -) - -func neverIgnoreLine(line string) bool { - return false -} - -func lineLogger(wg *sync.WaitGroup, prefix string, ignore func(line string) bool, r io.ReadCloser) { - defer wg.Done() - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - if ignore(line) { - continue - } - log.Printf("%s: %s", prefix, line) - } - if err := scanner.Err(); err != nil { - log.Printf("%s, error reading: %v", prefix, err) - } -} diff --git a/vendor/bazil.org/fuse/mount_darwin.go b/vendor/bazil.org/fuse/mount_darwin.go deleted file mode 100644 index c1c36e62..00000000 --- a/vendor/bazil.org/fuse/mount_darwin.go +++ /dev/null @@ -1,208 +0,0 @@ -package fuse - -import ( - "errors" - "fmt" - "log" - "os" - "os/exec" - "path" - "strconv" - "strings" - "sync" - "syscall" -) - -var ( - errNoAvail = errors.New("no available fuse devices") - errNotLoaded = errors.New("osxfuse is not loaded") -) - -func loadOSXFUSE(bin string) error { - cmd := exec.Command(bin) - cmd.Dir = "/" - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - err := cmd.Run() - return err -} - -func openOSXFUSEDev(devPrefix string) (*os.File, error) { - var f *os.File - var err error - for i := uint64(0); ; i++ { - path := devPrefix + strconv.FormatUint(i, 10) - f, err = os.OpenFile(path, os.O_RDWR, 0000) - if os.IsNotExist(err) { - if i == 0 { - // not even the first device was found -> fuse is not loaded - return nil, errNotLoaded - } - - // we've run out of kernel-provided devices - return nil, errNoAvail - } - - if err2, ok := err.(*os.PathError); ok && err2.Err == syscall.EBUSY { - // try the next one - continue - } - - if err != nil { - return nil, err - } - return f, nil - } -} - -func handleMountOSXFUSE(helperName string, errCh chan<- error) func(line string) (ignore bool) { - var noMountpointPrefix = helperName + `: ` - const noMountpointSuffix = `: No such file or directory` - return func(line string) (ignore bool) { - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringMountOSXFUSEError returns whether the Wait error is -// uninteresting; exit status 64 is. -func isBoringMountOSXFUSEError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 64 { - return true - } - } - return false -} - -func callMount(bin string, daemonVar string, dir string, conf *mountConfig, f *os.File, ready chan<- struct{}, errp *error) error { - for k, v := range conf.options { - if strings.Contains(k, ",") || strings.Contains(v, ",") { - // Silly limitation but the mount helper does not - // understand any escaping. See TestMountOptionCommaError. - return fmt.Errorf("mount options cannot contain commas on darwin: %q=%q", k, v) - } - } - cmd := exec.Command( - bin, - "-o", conf.getOptions(), - // Tell osxfuse-kext how large our buffer is. It must split - // writes larger than this into multiple writes. - // - // OSXFUSE seems to ignore InitResponse.MaxWrite, and uses - // this instead. - "-o", "iosize="+strconv.FormatUint(maxWrite, 10), - // refers to fd passed in cmd.ExtraFiles - "3", - dir, - ) - cmd.ExtraFiles = []*os.File{f} - cmd.Env = os.Environ() - // OSXFUSE <3.3.0 - cmd.Env = append(cmd.Env, "MOUNT_FUSEFS_CALL_BY_LIB=") - // OSXFUSE >=3.3.0 - cmd.Env = append(cmd.Env, "MOUNT_OSXFUSE_CALL_BY_LIB=") - - daemon := os.Args[0] - if daemonVar != "" { - cmd.Env = append(cmd.Env, daemonVar+"="+daemon) - } - - stdout, err := cmd.StdoutPipe() - if err != nil { - return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return fmt.Errorf("mount_osxfusefs: %v", err) - } - helperErrCh := make(chan error, 1) - go func() { - var wg sync.WaitGroup - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - helperName := path.Base(bin) - go lineLogger(&wg, "mount helper error", handleMountOSXFUSE(helperName, helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringMountOSXFUSEError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - *errp = helperErr - close(ready) - return - default: - // nope, fall back to generic message - } - - *errp = fmt.Errorf("mount_osxfusefs: %v", err) - close(ready) - return - } - - *errp = nil - close(ready) - }() - return nil -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) { - locations := conf.osxfuseLocations - if locations == nil { - locations = []OSXFUSEPaths{ - OSXFUSELocationV3, - OSXFUSELocationV2, - } - } - for _, loc := range locations { - if _, err := os.Stat(loc.Mount); os.IsNotExist(err) { - // try the other locations - continue - } - - f, err := openOSXFUSEDev(loc.DevicePrefix) - if err == errNotLoaded { - err = loadOSXFUSE(loc.Load) - if err != nil { - return nil, err - } - // try again - f, err = openOSXFUSEDev(loc.DevicePrefix) - } - if err != nil { - return nil, err - } - err = callMount(loc.Mount, loc.DaemonVar, dir, conf, f, ready, errp) - if err != nil { - f.Close() - return nil, err - } - return f, nil - } - return nil, ErrOSXFUSENotFound -} diff --git a/vendor/bazil.org/fuse/mount_freebsd.go b/vendor/bazil.org/fuse/mount_freebsd.go deleted file mode 100644 index 70bb4102..00000000 --- a/vendor/bazil.org/fuse/mount_freebsd.go +++ /dev/null @@ -1,111 +0,0 @@ -package fuse - -import ( - "fmt" - "log" - "os" - "os/exec" - "strings" - "sync" - "syscall" -) - -func handleMountFusefsStderr(errCh chan<- error) func(line string) (ignore bool) { - return func(line string) (ignore bool) { - const ( - noMountpointPrefix = `mount_fusefs: ` - noMountpointSuffix = `: No such file or directory` - ) - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringMountFusefsError returns whether the Wait error is -// uninteresting; exit status 1 is. -func isBoringMountFusefsError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 1 { - return true - } - } - return false -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) { - for k, v := range conf.options { - if strings.Contains(k, ",") || strings.Contains(v, ",") { - // Silly limitation but the mount helper does not - // understand any escaping. See TestMountOptionCommaError. - return nil, fmt.Errorf("mount options cannot contain commas on FreeBSD: %q=%q", k, v) - } - } - - f, err := os.OpenFile("/dev/fuse", os.O_RDWR, 0000) - if err != nil { - *errp = err - return nil, err - } - - cmd := exec.Command( - "/sbin/mount_fusefs", - "--safe", - "-o", conf.getOptions(), - "3", - dir, - ) - cmd.ExtraFiles = []*os.File{f} - - stdout, err := cmd.StdoutPipe() - if err != nil { - return nil, fmt.Errorf("setting up mount_fusefs stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return nil, fmt.Errorf("setting up mount_fusefs stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return nil, fmt.Errorf("mount_fusefs: %v", err) - } - helperErrCh := make(chan error, 1) - var wg sync.WaitGroup - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - go lineLogger(&wg, "mount helper error", handleMountFusefsStderr(helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringMountFusefsError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - return nil, helperErr - default: - // nope, fall back to generic message - } - return nil, fmt.Errorf("mount_fusefs: %v", err) - } - - close(ready) - return f, nil -} diff --git a/vendor/bazil.org/fuse/mount_linux.go b/vendor/bazil.org/fuse/mount_linux.go deleted file mode 100644 index 197d1044..00000000 --- a/vendor/bazil.org/fuse/mount_linux.go +++ /dev/null @@ -1,150 +0,0 @@ -package fuse - -import ( - "fmt" - "log" - "net" - "os" - "os/exec" - "strings" - "sync" - "syscall" -) - -func handleFusermountStderr(errCh chan<- error) func(line string) (ignore bool) { - return func(line string) (ignore bool) { - if line == `fusermount: failed to open /etc/fuse.conf: Permission denied` { - // Silence this particular message, it occurs way too - // commonly and isn't very relevant to whether the mount - // succeeds or not. - return true - } - - const ( - noMountpointPrefix = `fusermount: failed to access mountpoint ` - noMountpointSuffix = `: No such file or directory` - ) - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringFusermountError returns whether the Wait error is -// uninteresting; exit status 1 is. -func isBoringFusermountError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 1 { - return true - } - } - return false -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (fusefd *os.File, err error) { - // linux mount is never delayed - close(ready) - - fds, err := syscall.Socketpair(syscall.AF_FILE, syscall.SOCK_STREAM, 0) - if err != nil { - return nil, fmt.Errorf("socketpair error: %v", err) - } - - writeFile := os.NewFile(uintptr(fds[0]), "fusermount-child-writes") - defer writeFile.Close() - - readFile := os.NewFile(uintptr(fds[1]), "fusermount-parent-reads") - defer readFile.Close() - - cmd := exec.Command( - "fusermount", - "-o", conf.getOptions(), - "--", - dir, - ) - cmd.Env = append(os.Environ(), "_FUSE_COMMFD=3") - - cmd.ExtraFiles = []*os.File{writeFile} - - var wg sync.WaitGroup - stdout, err := cmd.StdoutPipe() - if err != nil { - return nil, fmt.Errorf("setting up fusermount stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return nil, fmt.Errorf("setting up fusermount stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return nil, fmt.Errorf("fusermount: %v", err) - } - helperErrCh := make(chan error, 1) - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - go lineLogger(&wg, "mount helper error", handleFusermountStderr(helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringFusermountError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - return nil, helperErr - default: - // nope, fall back to generic message - } - - return nil, fmt.Errorf("fusermount: %v", err) - } - - c, err := net.FileConn(readFile) - if err != nil { - return nil, fmt.Errorf("FileConn from fusermount socket: %v", err) - } - defer c.Close() - - uc, ok := c.(*net.UnixConn) - if !ok { - return nil, fmt.Errorf("unexpected FileConn type; expected UnixConn, got %T", c) - } - - buf := make([]byte, 32) // expect 1 byte - oob := make([]byte, 32) // expect 24 bytes - _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob) - scms, err := syscall.ParseSocketControlMessage(oob[:oobn]) - if err != nil { - return nil, fmt.Errorf("ParseSocketControlMessage: %v", err) - } - if len(scms) != 1 { - return nil, fmt.Errorf("expected 1 SocketControlMessage; got scms = %#v", scms) - } - scm := scms[0] - gotFds, err := syscall.ParseUnixRights(&scm) - if err != nil { - return nil, fmt.Errorf("syscall.ParseUnixRights: %v", err) - } - if len(gotFds) != 1 { - return nil, fmt.Errorf("wanted 1 fd; got %#v", gotFds) - } - f := os.NewFile(uintptr(gotFds[0]), "/dev/fuse") - return f, nil -} diff --git a/vendor/bazil.org/fuse/options.go b/vendor/bazil.org/fuse/options.go deleted file mode 100644 index 65ce8a54..00000000 --- a/vendor/bazil.org/fuse/options.go +++ /dev/null @@ -1,310 +0,0 @@ -package fuse - -import ( - "errors" - "strings" -) - -func dummyOption(conf *mountConfig) error { - return nil -} - -// mountConfig holds the configuration for a mount operation. -// Use it by passing MountOption values to Mount. -type mountConfig struct { - options map[string]string - maxReadahead uint32 - initFlags InitFlags - osxfuseLocations []OSXFUSEPaths -} - -func escapeComma(s string) string { - s = strings.Replace(s, `\`, `\\`, -1) - s = strings.Replace(s, `,`, `\,`, -1) - return s -} - -// getOptions makes a string of options suitable for passing to FUSE -// mount flag `-o`. Returns an empty string if no options were set. -// Any platform specific adjustments should happen before the call. -func (m *mountConfig) getOptions() string { - var opts []string - for k, v := range m.options { - k = escapeComma(k) - if v != "" { - k += "=" + escapeComma(v) - } - opts = append(opts, k) - } - return strings.Join(opts, ",") -} - -type mountOption func(*mountConfig) error - -// MountOption is passed to Mount to change the behavior of the mount. -type MountOption mountOption - -// FSName sets the file system name (also called source) that is -// visible in the list of mounted file systems. -// -// FreeBSD ignores this option. -func FSName(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["fsname"] = name - return nil - } -} - -// Subtype sets the subtype of the mount. The main type is always -// `fuse`. The type in a list of mounted file systems will look like -// `fuse.foo`. -// -// OS X ignores this option. -// FreeBSD ignores this option. -func Subtype(fstype string) MountOption { - return func(conf *mountConfig) error { - conf.options["subtype"] = fstype - return nil - } -} - -// LocalVolume sets the volume to be local (instead of network), -// changing the behavior of Finder, Spotlight, and such. -// -// OS X only. Others ignore this option. -func LocalVolume() MountOption { - return localVolume -} - -// VolumeName sets the volume name shown in Finder. -// -// OS X only. Others ignore this option. -func VolumeName(name string) MountOption { - return volumeName(name) -} - -// NoAppleDouble makes OSXFUSE disallow files with names used by OS X -// to store extended attributes on file systems that do not support -// them natively. -// -// Such file names are: -// -// ._* -// .DS_Store -// -// OS X only. Others ignore this option. -func NoAppleDouble() MountOption { - return noAppleDouble -} - -// NoAppleXattr makes OSXFUSE disallow extended attributes with the -// prefix "com.apple.". This disables persistent Finder state and -// other such information. -// -// OS X only. Others ignore this option. -func NoAppleXattr() MountOption { - return noAppleXattr -} - -// ExclCreate causes O_EXCL flag to be set for only "truly" exclusive creates, -// i.e. create calls for which the initiator explicitly set the O_EXCL flag. -// -// OSXFUSE expects all create calls to return EEXIST in case the file -// already exists, regardless of whether O_EXCL was specified or not. -// To ensure this behavior, it normally sets OpenExclusive for all -// Create calls, regardless of whether the original call had it set. -// For distributed filesystems, that may force every file create to be -// a distributed consensus action, causing undesirable delays. -// -// This option makes the FUSE filesystem see the original flag value, -// and better decide when to ensure global consensus. -// -// Note that returning EEXIST on existing file create is still -// expected with OSXFUSE, regardless of the presence of the -// OpenExclusive flag. -// -// For more information, see -// https://github.com/osxfuse/osxfuse/issues/209 -// -// OS X only. Others ignore this options. -// Requires OSXFUSE 3.4.1 or newer. -func ExclCreate() MountOption { - return exclCreate -} - -// DaemonTimeout sets the time in seconds between a request and a reply before -// the FUSE mount is declared dead. -// -// OS X and FreeBSD only. Others ignore this option. -func DaemonTimeout(name string) MountOption { - return daemonTimeout(name) -} - -var ErrCannotCombineAllowOtherAndAllowRoot = errors.New("cannot combine AllowOther and AllowRoot") - -// AllowOther allows other users to access the file system. -// -// Only one of AllowOther or AllowRoot can be used. -func AllowOther() MountOption { - return func(conf *mountConfig) error { - if _, ok := conf.options["allow_root"]; ok { - return ErrCannotCombineAllowOtherAndAllowRoot - } - conf.options["allow_other"] = "" - return nil - } -} - -// AllowRoot allows other users to access the file system. -// -// Only one of AllowOther or AllowRoot can be used. -// -// FreeBSD ignores this option. -func AllowRoot() MountOption { - return func(conf *mountConfig) error { - if _, ok := conf.options["allow_other"]; ok { - return ErrCannotCombineAllowOtherAndAllowRoot - } - conf.options["allow_root"] = "" - return nil - } -} - -// AllowDev enables interpreting character or block special devices on the -// filesystem. -func AllowDev() MountOption { - return func(conf *mountConfig) error { - conf.options["dev"] = "" - return nil - } -} - -// AllowSUID allows set-user-identifier or set-group-identifier bits to take -// effect. -func AllowSUID() MountOption { - return func(conf *mountConfig) error { - conf.options["suid"] = "" - return nil - } -} - -// DefaultPermissions makes the kernel enforce access control based on -// the file mode (as in chmod). -// -// Without this option, the Node itself decides what is and is not -// allowed. This is normally ok because FUSE file systems cannot be -// accessed by other users without AllowOther/AllowRoot. -// -// FreeBSD ignores this option. -func DefaultPermissions() MountOption { - return func(conf *mountConfig) error { - conf.options["default_permissions"] = "" - return nil - } -} - -// ReadOnly makes the mount read-only. -func ReadOnly() MountOption { - return func(conf *mountConfig) error { - conf.options["ro"] = "" - return nil - } -} - -// MaxReadahead sets the number of bytes that can be prefetched for -// sequential reads. The kernel can enforce a maximum value lower than -// this. -// -// This setting makes the kernel perform speculative reads that do not -// originate from any client process. This usually tremendously -// improves read performance. -func MaxReadahead(n uint32) MountOption { - return func(conf *mountConfig) error { - conf.maxReadahead = n - return nil - } -} - -// AsyncRead enables multiple outstanding read requests for the same -// handle. Without this, there is at most one request in flight at a -// time. -func AsyncRead() MountOption { - return func(conf *mountConfig) error { - conf.initFlags |= InitAsyncRead - return nil - } -} - -// WritebackCache enables the kernel to buffer writes before sending -// them to the FUSE server. Without this, writethrough caching is -// used. -func WritebackCache() MountOption { - return func(conf *mountConfig) error { - conf.initFlags |= InitWritebackCache - return nil - } -} - -// OSXFUSEPaths describes the paths used by an installed OSXFUSE -// version. See OSXFUSELocationV3 for typical values. -type OSXFUSEPaths struct { - // Prefix for the device file. At mount time, an incrementing - // number is suffixed until a free FUSE device is found. - DevicePrefix string - // Path of the load helper, used to load the kernel extension if - // no device files are found. - Load string - // Path of the mount helper, used for the actual mount operation. - Mount string - // Environment variable used to pass the path to the executable - // calling the mount helper. - DaemonVar string -} - -// Default paths for OSXFUSE. See OSXFUSELocations. -var ( - OSXFUSELocationV3 = OSXFUSEPaths{ - DevicePrefix: "/dev/osxfuse", - Load: "/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse", - Mount: "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse", - DaemonVar: "MOUNT_OSXFUSE_DAEMON_PATH", - } - OSXFUSELocationV2 = OSXFUSEPaths{ - DevicePrefix: "/dev/osxfuse", - Load: "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs", - Mount: "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs", - DaemonVar: "MOUNT_FUSEFS_DAEMON_PATH", - } -) - -// OSXFUSELocations sets where to look for OSXFUSE files. The -// arguments are all the possible locations. The previous locations -// are replaced. -// -// Without this option, OSXFUSELocationV3 and OSXFUSELocationV2 are -// used. -// -// OS X only. Others ignore this option. -func OSXFUSELocations(paths ...OSXFUSEPaths) MountOption { - return func(conf *mountConfig) error { - if len(paths) == 0 { - return errors.New("must specify at least one location for OSXFUSELocations") - } - // replace previous values, but make a copy so there's no - // worries about caller mutating their slice - conf.osxfuseLocations = append(conf.osxfuseLocations[:0], paths...) - return nil - } -} - -// AllowNonEmptyMount allows the mounting over a non-empty directory. -// -// The files in it will be shadowed by the freshly created mount. By -// default these mounts are rejected to prevent accidental covering up -// of data, which could for example prevent automatic backup. -func AllowNonEmptyMount() MountOption { - return func(conf *mountConfig) error { - conf.options["nonempty"] = "" - return nil - } -} diff --git a/vendor/bazil.org/fuse/options_darwin.go b/vendor/bazil.org/fuse/options_darwin.go deleted file mode 100644 index faa9d78e..00000000 --- a/vendor/bazil.org/fuse/options_darwin.go +++ /dev/null @@ -1,35 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - conf.options["local"] = "" - return nil -} - -func volumeName(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["volname"] = name - return nil - } -} - -func daemonTimeout(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["daemon_timeout"] = name - return nil - } -} - -func noAppleXattr(conf *mountConfig) error { - conf.options["noapplexattr"] = "" - return nil -} - -func noAppleDouble(conf *mountConfig) error { - conf.options["noappledouble"] = "" - return nil -} - -func exclCreate(conf *mountConfig) error { - conf.options["excl_create"] = "" - return nil -} diff --git a/vendor/bazil.org/fuse/options_freebsd.go b/vendor/bazil.org/fuse/options_freebsd.go deleted file mode 100644 index 7c164b13..00000000 --- a/vendor/bazil.org/fuse/options_freebsd.go +++ /dev/null @@ -1,28 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - return nil -} - -func volumeName(name string) MountOption { - return dummyOption -} - -func daemonTimeout(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["timeout"] = name - return nil - } -} - -func noAppleXattr(conf *mountConfig) error { - return nil -} - -func noAppleDouble(conf *mountConfig) error { - return nil -} - -func exclCreate(conf *mountConfig) error { - return nil -} diff --git a/vendor/bazil.org/fuse/options_linux.go b/vendor/bazil.org/fuse/options_linux.go deleted file mode 100644 index 13f0896d..00000000 --- a/vendor/bazil.org/fuse/options_linux.go +++ /dev/null @@ -1,25 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - return nil -} - -func volumeName(name string) MountOption { - return dummyOption -} - -func daemonTimeout(name string) MountOption { - return dummyOption -} - -func noAppleXattr(conf *mountConfig) error { - return nil -} - -func noAppleDouble(conf *mountConfig) error { - return nil -} - -func exclCreate(conf *mountConfig) error { - return nil -} diff --git a/vendor/bazil.org/fuse/protocol.go b/vendor/bazil.org/fuse/protocol.go deleted file mode 100644 index a77bbf72..00000000 --- a/vendor/bazil.org/fuse/protocol.go +++ /dev/null @@ -1,75 +0,0 @@ -package fuse - -import ( - "fmt" -) - -// Protocol is a FUSE protocol version number. -type Protocol struct { - Major uint32 - Minor uint32 -} - -func (p Protocol) String() string { - return fmt.Sprintf("%d.%d", p.Major, p.Minor) -} - -// LT returns whether a is less than b. -func (a Protocol) LT(b Protocol) bool { - return a.Major < b.Major || - (a.Major == b.Major && a.Minor < b.Minor) -} - -// GE returns whether a is greater than or equal to b. -func (a Protocol) GE(b Protocol) bool { - return a.Major > b.Major || - (a.Major == b.Major && a.Minor >= b.Minor) -} - -func (a Protocol) is79() bool { - return a.GE(Protocol{7, 9}) -} - -// HasAttrBlockSize returns whether Attr.BlockSize is respected by the -// kernel. -func (a Protocol) HasAttrBlockSize() bool { - return a.is79() -} - -// HasReadWriteFlags returns whether ReadRequest/WriteRequest -// fields Flags and FileFlags are valid. -func (a Protocol) HasReadWriteFlags() bool { - return a.is79() -} - -// HasGetattrFlags returns whether GetattrRequest field Flags is -// valid. -func (a Protocol) HasGetattrFlags() bool { - return a.is79() -} - -func (a Protocol) is710() bool { - return a.GE(Protocol{7, 10}) -} - -// HasOpenNonSeekable returns whether OpenResponse field Flags flag -// OpenNonSeekable is supported. -func (a Protocol) HasOpenNonSeekable() bool { - return a.is710() -} - -func (a Protocol) is712() bool { - return a.GE(Protocol{7, 12}) -} - -// HasUmask returns whether CreateRequest/MkdirRequest/MknodRequest -// field Umask is valid. -func (a Protocol) HasUmask() bool { - return a.is712() -} - -// HasInvalidate returns whether InvalidateNode/InvalidateEntry are -// supported. -func (a Protocol) HasInvalidate() bool { - return a.is712() -} diff --git a/vendor/bazil.org/fuse/unmount.go b/vendor/bazil.org/fuse/unmount.go deleted file mode 100644 index ffe3f155..00000000 --- a/vendor/bazil.org/fuse/unmount.go +++ /dev/null @@ -1,6 +0,0 @@ -package fuse - -// Unmount tries to unmount the filesystem mounted at dir. -func Unmount(dir string) error { - return unmount(dir) -} diff --git a/vendor/bazil.org/fuse/unmount_linux.go b/vendor/bazil.org/fuse/unmount_linux.go deleted file mode 100644 index 088f0cfe..00000000 --- a/vendor/bazil.org/fuse/unmount_linux.go +++ /dev/null @@ -1,21 +0,0 @@ -package fuse - -import ( - "bytes" - "errors" - "os/exec" -) - -func unmount(dir string) error { - cmd := exec.Command("fusermount", "-u", dir) - output, err := cmd.CombinedOutput() - if err != nil { - if len(output) > 0 { - output = bytes.TrimRight(output, "\n") - msg := err.Error() + ": " + string(output) - err = errors.New(msg) - } - return err - } - return nil -} diff --git a/vendor/bazil.org/fuse/unmount_std.go b/vendor/bazil.org/fuse/unmount_std.go deleted file mode 100644 index d6efe276..00000000 --- a/vendor/bazil.org/fuse/unmount_std.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build !linux - -package fuse - -import ( - "os" - "syscall" -) - -func unmount(dir string) error { - err := syscall.Unmount(dir, 0) - if err != nil { - err = &os.PathError{Op: "unmount", Path: dir, Err: err} - return err - } - return nil -} diff --git a/vendor/github.com/AndreasBriese/bbloom/.travis.yml b/vendor/github.com/AndreasBriese/bbloom/.travis.yml deleted file mode 100644 index 4f2ee4d9..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: go diff --git a/vendor/github.com/AndreasBriese/bbloom/LICENSE b/vendor/github.com/AndreasBriese/bbloom/LICENSE deleted file mode 100644 index 4b20050e..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -bbloom.go - -// The MIT License (MIT) -// Copyright (c) 2014 Andreas Briese, eduToolbox@Bri-C GmbH, Sarstedt - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -siphash.go - -// https://github.com/dchest/siphash -// -// Written in 2012 by Dmitry Chestnykh. -// -// To the extent possible under law, the author have dedicated all copyright -// and related and neighboring rights to this software to the public domain -// worldwide. This software is distributed without any warranty. -// http://creativecommons.org/publicdomain/zero/1.0/ -// -// Package siphash implements SipHash-2-4, a fast short-input PRF -// created by Jean-Philippe Aumasson and Daniel J. Bernstein. diff --git a/vendor/github.com/AndreasBriese/bbloom/README.md b/vendor/github.com/AndreasBriese/bbloom/README.md deleted file mode 100644 index d7413c33..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/README.md +++ /dev/null @@ -1,131 +0,0 @@ -## bbloom: a bitset Bloom filter for go/golang -=== - -[![Build Status](https://travis-ci.org/AndreasBriese/bbloom.png?branch=master)](http://travis-ci.org/AndreasBriese/bbloom) - -package implements a fast bloom filter with real 'bitset' and JSONMarshal/JSONUnmarshal to store/reload the Bloom filter. - -NOTE: the package uses unsafe.Pointer to set and read the bits from the bitset. If you're uncomfortable with using the unsafe package, please consider using my bloom filter package at github.com/AndreasBriese/bloom - -=== - -changelog 11/2015: new thread safe methods AddTS(), HasTS(), AddIfNotHasTS() following a suggestion from Srdjan Marinovic (github @a-little-srdjan), who used this to code a bloomfilter cache. - -This bloom filter was developed to strengthen a website-log database and was tested and optimized for this log-entry mask: "2014/%02i/%02i %02i:%02i:%02i /info.html". -Nonetheless bbloom should work with any other form of entries. - -~~Hash function is a modified Berkeley DB sdbm hash (to optimize for smaller strings). sdbm http://www.cse.yorku.ca/~oz/hash.html~~ - -Found sipHash (SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein.) to be about as fast. sipHash had been ported by Dimtry Chestnyk to Go (github.com/dchest/siphash ) - -Minimum hashset size is: 512 ([4]uint64; will be set automatically). - -###install - -```sh -go get github.com/AndreasBriese/bbloom -``` - -###test -+ change to folder ../bbloom -+ create wordlist in file "words.txt" (you might use `python permut.py`) -+ run 'go test -bench=.' within the folder - -```go -go test -bench=. -``` - -~~If you've installed the GOCONVEY TDD-framework http://goconvey.co/ you can run the tests automatically.~~ - -using go's testing framework now (have in mind that the op timing is related to 65536 operations of Add, Has, AddIfNotHas respectively) - -### usage - -after installation add - -```go -import ( - ... - "github.com/AndreasBriese/bbloom" - ... - ) -``` - -at your header. In the program use - -```go -// create a bloom filter for 65536 items and 1 % wrong-positive ratio -bf := bbloom.New(float64(1<<16), float64(0.01)) - -// or -// create a bloom filter with 650000 for 65536 items and 7 locs per hash explicitly -// bf = bbloom.New(float64(650000), float64(7)) -// or -bf = bbloom.New(650000.0, 7.0) - -// add one item -bf.Add([]byte("butter")) - -// Number of elements added is exposed now -// Note: ElemNum will not be included in JSON export (for compatability to older version) -nOfElementsInFilter := bf.ElemNum - -// check if item is in the filter -isIn := bf.Has([]byte("butter")) // should be true -isNotIn := bf.Has([]byte("Butter")) // should be false - -// 'add only if item is new' to the bloomfilter -added := bf.AddIfNotHas([]byte("butter")) // should be false because 'butter' is already in the set -added = bf.AddIfNotHas([]byte("buTTer")) // should be true because 'buTTer' is new - -// thread safe versions for concurrent use: AddTS, HasTS, AddIfNotHasTS -// add one item -bf.AddTS([]byte("peanutbutter")) -// check if item is in the filter -isIn = bf.HasTS([]byte("peanutbutter")) // should be true -isNotIn = bf.HasTS([]byte("peanutButter")) // should be false -// 'add only if item is new' to the bloomfilter -added = bf.AddIfNotHasTS([]byte("butter")) // should be false because 'peanutbutter' is already in the set -added = bf.AddIfNotHasTS([]byte("peanutbuTTer")) // should be true because 'penutbuTTer' is new - -// convert to JSON ([]byte) -Json := bf.JSONMarshal() - -// bloomfilters Mutex is exposed for external un-/locking -// i.e. mutex lock while doing JSON conversion -bf.Mtx.Lock() -Json = bf.JSONMarshal() -bf.Mtx.Unlock() - -// restore a bloom filter from storage -bfNew := bbloom.JSONUnmarshal(Json) - -isInNew := bfNew.Has([]byte("butter")) // should be true -isNotInNew := bfNew.Has([]byte("Butter")) // should be false - -``` - -to work with the bloom filter. - -### why 'fast'? - -It's about 3 times faster than William Fitzgeralds bitset bloom filter https://github.com/willf/bloom . And it is about so fast as my []bool set variant for Boom filters (see https://github.com/AndreasBriese/bloom ) but having a 8times smaller memory footprint: - - - Bloom filter (filter size 524288, 7 hashlocs) - github.com/AndreasBriese/bbloom 'Add' 65536 items (10 repetitions): 6595800 ns (100 ns/op) - github.com/AndreasBriese/bbloom 'Has' 65536 items (10 repetitions): 5986600 ns (91 ns/op) - github.com/AndreasBriese/bloom 'Add' 65536 items (10 repetitions): 6304684 ns (96 ns/op) - github.com/AndreasBriese/bloom 'Has' 65536 items (10 repetitions): 6568663 ns (100 ns/op) - - github.com/willf/bloom 'Add' 65536 items (10 repetitions): 24367224 ns (371 ns/op) - github.com/willf/bloom 'Test' 65536 items (10 repetitions): 21881142 ns (333 ns/op) - github.com/dataence/bloom/standard 'Add' 65536 items (10 repetitions): 23041644 ns (351 ns/op) - github.com/dataence/bloom/standard 'Check' 65536 items (10 repetitions): 19153133 ns (292 ns/op) - github.com/cabello/bloom 'Add' 65536 items (10 repetitions): 131921507 ns (2012 ns/op) - github.com/cabello/bloom 'Contains' 65536 items (10 repetitions): 131108962 ns (2000 ns/op) - -(on MBPro15 OSX10.8.5 i7 4Core 2.4Ghz) - - -With 32bit bloom filters (bloom32) using modified sdbm, bloom32 does hashing with only 2 bit shifts, one xor and one substraction per byte. smdb is about as fast as fnv64a but gives less collisions with the dataset (see mask above). bloom.New(float64(10 * 1<<16),float64(7)) populated with 1<<16 random items from the dataset (see above) and tested against the rest results in less than 0.05% collisions. diff --git a/vendor/github.com/AndreasBriese/bbloom/bbloom.go b/vendor/github.com/AndreasBriese/bbloom/bbloom.go deleted file mode 100644 index 3d457406..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/bbloom.go +++ /dev/null @@ -1,270 +0,0 @@ -// The MIT License (MIT) -// Copyright (c) 2014 Andreas Briese, eduToolbox@Bri-C GmbH, Sarstedt - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package bbloom - -import ( - "bytes" - "encoding/json" - "log" - "math" - "sync" - "unsafe" -) - -// helper -var mask = []uint8{1, 2, 4, 8, 16, 32, 64, 128} - -func getSize(ui64 uint64) (size uint64, exponent uint64) { - if ui64 < uint64(512) { - ui64 = uint64(512) - } - size = uint64(1) - for size < ui64 { - size <<= 1 - exponent++ - } - return size, exponent -} - -func calcSizeByWrongPositives(numEntries, wrongs float64) (uint64, uint64) { - size := -1 * numEntries * math.Log(wrongs) / math.Pow(float64(0.69314718056), 2) - locs := math.Ceil(float64(0.69314718056) * size / numEntries) - return uint64(size), uint64(locs) -} - -// New -// returns a new bloomfilter -func New(params ...float64) (bloomfilter Bloom) { - var entries, locs uint64 - if len(params) == 2 { - if params[1] < 1 { - entries, locs = calcSizeByWrongPositives(params[0], params[1]) - } else { - entries, locs = uint64(params[0]), uint64(params[1]) - } - } else { - log.Fatal("usage: New(float64(number_of_entries), float64(number_of_hashlocations)) i.e. New(float64(1000), float64(3)) or New(float64(number_of_entries), float64(number_of_hashlocations)) i.e. New(float64(1000), float64(0.03))") - } - size, exponent := getSize(uint64(entries)) - bloomfilter = Bloom{ - sizeExp: exponent, - size: size - 1, - setLocs: locs, - shift: 64 - exponent, - } - bloomfilter.Size(size) - return bloomfilter -} - -// NewWithBoolset -// takes a []byte slice and number of locs per entry -// returns the bloomfilter with a bitset populated according to the input []byte -func NewWithBoolset(bs *[]byte, locs uint64) (bloomfilter Bloom) { - bloomfilter = New(float64(len(*bs)<<3), float64(locs)) - ptr := uintptr(unsafe.Pointer(&bloomfilter.bitset[0])) - for _, b := range *bs { - *(*uint8)(unsafe.Pointer(ptr)) = b - ptr++ - } - return bloomfilter -} - -// bloomJSONImExport -// Im/Export structure used by JSONMarshal / JSONUnmarshal -type bloomJSONImExport struct { - FilterSet []byte - SetLocs uint64 -} - -// JSONUnmarshal -// takes JSON-Object (type bloomJSONImExport) as []bytes -// returns bloom32 / bloom64 object -func JSONUnmarshal(dbData []byte) Bloom { - bloomImEx := bloomJSONImExport{} - json.Unmarshal(dbData, &bloomImEx) - buf := bytes.NewBuffer(bloomImEx.FilterSet) - bs := buf.Bytes() - bf := NewWithBoolset(&bs, bloomImEx.SetLocs) - return bf -} - -// -// Bloom filter -type Bloom struct { - Mtx sync.Mutex - ElemNum uint64 - bitset []uint64 - sizeExp uint64 - size uint64 - setLocs uint64 - shift uint64 -} - -// <--- http://www.cse.yorku.ca/~oz/hash.html -// modified Berkeley DB Hash (32bit) -// hash is casted to l, h = 16bit fragments -// func (bl Bloom) absdbm(b *[]byte) (l, h uint64) { -// hash := uint64(len(*b)) -// for _, c := range *b { -// hash = uint64(c) + (hash << 6) + (hash << bl.sizeExp) - hash -// } -// h = hash >> bl.shift -// l = hash << bl.shift >> bl.shift -// return l, h -// } - -// Update: found sipHash of Jean-Philippe Aumasson & Daniel J. Bernstein to be even faster than absdbm() -// https://131002.net/siphash/ -// siphash was implemented for Go by Dmitry Chestnykh https://github.com/dchest/siphash - -// Add -// set the bit(s) for entry; Adds an entry to the Bloom filter -func (bl *Bloom) Add(entry []byte) { - l, h := bl.sipHash(entry) - for i := uint64(0); i < (*bl).setLocs; i++ { - (*bl).Set((h + i*l) & (*bl).size) - (*bl).ElemNum++ - } -} - -// AddTS -// Thread safe: Mutex.Lock the bloomfilter for the time of processing the entry -func (bl *Bloom) AddTS(entry []byte) { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - bl.Add(entry[:]) -} - -// Has -// check if bit(s) for entry is/are set -// returns true if the entry was added to the Bloom Filter -func (bl Bloom) Has(entry []byte) bool { - l, h := bl.sipHash(entry) - for i := uint64(0); i < bl.setLocs; i++ { - switch bl.IsSet((h + i*l) & bl.size) { - case false: - return false - } - } - return true -} - -// HasTS -// Thread safe: Mutex.Lock the bloomfilter for the time of processing the entry -func (bl *Bloom) HasTS(entry []byte) bool { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - return bl.Has(entry[:]) -} - -// AddIfNotHas -// Only Add entry if it's not present in the bloomfilter -// returns true if entry was added -// returns false if entry was allready registered in the bloomfilter -func (bl Bloom) AddIfNotHas(entry []byte) (added bool) { - if bl.Has(entry[:]) { - return added - } - bl.Add(entry[:]) - return true -} - -// AddIfNotHasTS -// Tread safe: Only Add entry if it's not present in the bloomfilter -// returns true if entry was added -// returns false if entry was allready registered in the bloomfilter -func (bl *Bloom) AddIfNotHasTS(entry []byte) (added bool) { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - return bl.AddIfNotHas(entry[:]) -} - -// Size -// make Bloom filter with as bitset of size sz -func (bl *Bloom) Size(sz uint64) { - (*bl).bitset = make([]uint64, sz>>6) -} - -// Clear -// resets the Bloom filter -func (bl *Bloom) Clear() { - for i, _ := range (*bl).bitset { - (*bl).bitset[i] = 0 - } -} - -// Set -// set the bit[idx] of bitsit -func (bl *Bloom) Set(idx uint64) { - ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&bl.bitset[idx>>6])) + uintptr((idx%64)>>3)) - *(*uint8)(ptr) |= mask[idx%8] -} - -// IsSet -// check if bit[idx] of bitset is set -// returns true/false -func (bl *Bloom) IsSet(idx uint64) bool { - ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&bl.bitset[idx>>6])) + uintptr((idx%64)>>3)) - r := ((*(*uint8)(ptr)) >> (idx % 8)) & 1 - return r == 1 -} - -// JSONMarshal -// returns JSON-object (type bloomJSONImExport) as []byte -func (bl Bloom) JSONMarshal() []byte { - bloomImEx := bloomJSONImExport{} - bloomImEx.SetLocs = uint64(bl.setLocs) - bloomImEx.FilterSet = make([]byte, len(bl.bitset)<<3) - ptr := uintptr(unsafe.Pointer(&bl.bitset[0])) - for i := range bloomImEx.FilterSet { - bloomImEx.FilterSet[i] = *(*byte)(unsafe.Pointer(ptr)) - ptr++ - } - data, err := json.Marshal(bloomImEx) - if err != nil { - log.Fatal("json.Marshal failed: ", err) - } - return data -} - -// // alternative hashFn -// func (bl Bloom) fnv64a(b *[]byte) (l, h uint64) { -// h64 := fnv.New64a() -// h64.Write(*b) -// hash := h64.Sum64() -// h = hash >> 32 -// l = hash << 32 >> 32 -// return l, h -// } -// -// // <-- http://partow.net/programming/hashfunctions/index.html -// // citation: An algorithm proposed by Donald E. Knuth in The Art Of Computer Programming Volume 3, -// // under the topic of sorting and search chapter 6.4. -// // modified to fit with boolset-length -// func (bl Bloom) DEKHash(b *[]byte) (l, h uint64) { -// hash := uint64(len(*b)) -// for _, c := range *b { -// hash = ((hash << 5) ^ (hash >> bl.shift)) ^ uint64(c) -// } -// h = hash >> bl.shift -// l = hash << bl.sizeExp >> bl.sizeExp -// return l, h -// } diff --git a/vendor/github.com/AndreasBriese/bbloom/sipHash.go b/vendor/github.com/AndreasBriese/bbloom/sipHash.go deleted file mode 100644 index a91d8199..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/sipHash.go +++ /dev/null @@ -1,225 +0,0 @@ -// Written in 2012 by Dmitry Chestnykh. -// -// To the extent possible under law, the author have dedicated all copyright -// and related and neighboring rights to this software to the public domain -// worldwide. This software is distributed without any warranty. -// http://creativecommons.org/publicdomain/zero/1.0/ -// -// Package siphash implements SipHash-2-4, a fast short-input PRF -// created by Jean-Philippe Aumasson and Daniel J. Bernstein. - -package bbloom - -// Hash returns the 64-bit SipHash-2-4 of the given byte slice with two 64-bit -// parts of 128-bit key: k0 and k1. -func (bl Bloom) sipHash(p []byte) (l, h uint64) { - // Initialization. - v0 := uint64(8317987320269560794) // k0 ^ 0x736f6d6570736575 - v1 := uint64(7237128889637516672) // k1 ^ 0x646f72616e646f6d - v2 := uint64(7816392314733513934) // k0 ^ 0x6c7967656e657261 - v3 := uint64(8387220255325274014) // k1 ^ 0x7465646279746573 - t := uint64(len(p)) << 56 - - // Compression. - for len(p) >= 8 { - - m := uint64(p[0]) | uint64(p[1])<<8 | uint64(p[2])<<16 | uint64(p[3])<<24 | - uint64(p[4])<<32 | uint64(p[5])<<40 | uint64(p[6])<<48 | uint64(p[7])<<56 - - v3 ^= m - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - v0 ^= m - p = p[8:] - } - - // Compress last block. - switch len(p) { - case 7: - t |= uint64(p[6]) << 48 - fallthrough - case 6: - t |= uint64(p[5]) << 40 - fallthrough - case 5: - t |= uint64(p[4]) << 32 - fallthrough - case 4: - t |= uint64(p[3]) << 24 - fallthrough - case 3: - t |= uint64(p[2]) << 16 - fallthrough - case 2: - t |= uint64(p[1]) << 8 - fallthrough - case 1: - t |= uint64(p[0]) - } - - v3 ^= t - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - v0 ^= t - - // Finalization. - v2 ^= 0xff - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 3. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 4. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // return v0 ^ v1 ^ v2 ^ v3 - - hash := v0 ^ v1 ^ v2 ^ v3 - h = hash >> bl.shift - l = hash << bl.shift >> bl.shift - return l, h - -} diff --git a/vendor/github.com/AndreasBriese/bbloom/words.txt b/vendor/github.com/AndreasBriese/bbloom/words.txt deleted file mode 100644 index ad86a31a..00000000 --- a/vendor/github.com/AndreasBriese/bbloom/words.txt +++ /dev/null @@ -1,140 +0,0 @@ -2014/01/01 00:00:00 /info.html -2014/01/01 00:00:00 /info.html -2014/01/01 00:00:01 /info.html -2014/01/01 00:00:02 /info.html -2014/01/01 00:00:03 /info.html -2014/01/01 00:00:04 /info.html -2014/01/01 00:00:05 /info.html -2014/01/01 00:00:06 /info.html -2014/01/01 00:00:07 /info.html -2014/01/01 00:00:08 /info.html -2014/01/01 00:00:09 /info.html -2014/01/01 00:00:10 /info.html -2014/01/01 00:00:11 /info.html -2014/01/01 00:00:12 /info.html -2014/01/01 00:00:13 /info.html -2014/01/01 00:00:14 /info.html -2014/01/01 00:00:15 /info.html -2014/01/01 00:00:16 /info.html -2014/01/01 00:00:17 /info.html -2014/01/01 00:00:18 /info.html -2014/01/01 00:00:19 /info.html -2014/01/01 00:00:20 /info.html -2014/01/01 00:00:21 /info.html -2014/01/01 00:00:22 /info.html -2014/01/01 00:00:23 /info.html -2014/01/01 00:00:24 /info.html -2014/01/01 00:00:25 /info.html -2014/01/01 00:00:26 /info.html -2014/01/01 00:00:27 /info.html -2014/01/01 00:00:28 /info.html -2014/01/01 00:00:29 /info.html -2014/01/01 00:00:30 /info.html -2014/01/01 00:00:31 /info.html -2014/01/01 00:00:32 /info.html -2014/01/01 00:00:33 /info.html -2014/01/01 00:00:34 /info.html -2014/01/01 00:00:35 /info.html -2014/01/01 00:00:36 /info.html -2014/01/01 00:00:37 /info.html -2014/01/01 00:00:38 /info.html -2014/01/01 00:00:39 /info.html -2014/01/01 00:00:40 /info.html -2014/01/01 00:00:41 /info.html -2014/01/01 00:00:42 /info.html -2014/01/01 00:00:43 /info.html -2014/01/01 00:00:44 /info.html -2014/01/01 00:00:45 /info.html -2014/01/01 00:00:46 /info.html -2014/01/01 00:00:47 /info.html -2014/01/01 00:00:48 /info.html -2014/01/01 00:00:49 /info.html -2014/01/01 00:00:50 /info.html -2014/01/01 00:00:51 /info.html -2014/01/01 00:00:52 /info.html -2014/01/01 00:00:53 /info.html -2014/01/01 00:00:54 /info.html -2014/01/01 00:00:55 /info.html -2014/01/01 00:00:56 /info.html -2014/01/01 00:00:57 /info.html -2014/01/01 00:00:58 /info.html -2014/01/01 00:00:59 /info.html -2014/01/01 00:01:00 /info.html -2014/01/01 00:01:01 /info.html -2014/01/01 00:01:02 /info.html -2014/01/01 00:01:03 /info.html -2014/01/01 00:01:04 /info.html -2014/01/01 00:01:05 /info.html -2014/01/01 00:01:06 /info.html -2014/01/01 00:01:07 /info.html -2014/01/01 00:01:08 /info.html -2014/01/01 00:01:09 /info.html -2014/01/01 00:01:10 /info.html -2014/01/01 00:01:11 /info.html -2014/01/01 00:01:12 /info.html -2014/01/01 00:01:13 /info.html -2014/01/01 00:01:14 /info.html -2014/01/01 00:01:15 /info.html -2014/01/01 00:01:16 /info.html -2014/01/01 00:01:17 /info.html -2014/01/01 00:01:18 /info.html -2014/01/01 00:01:19 /info.html -2014/01/01 00:01:20 /info.html -2014/01/01 00:01:21 /info.html -2014/01/01 00:01:22 /info.html -2014/01/01 00:01:23 /info.html -2014/01/01 00:01:24 /info.html -2014/01/01 00:01:25 /info.html -2014/01/01 00:01:26 /info.html -2014/01/01 00:01:27 /info.html -2014/01/01 00:01:28 /info.html -2014/01/01 00:01:29 /info.html -2014/01/01 00:01:30 /info.html -2014/01/01 00:01:31 /info.html -2014/01/01 00:01:32 /info.html -2014/01/01 00:01:33 /info.html -2014/01/01 00:01:34 /info.html -2014/01/01 00:01:35 /info.html -2014/01/01 00:01:36 /info.html -2014/01/01 00:01:37 /info.html -2014/01/01 00:01:38 /info.html -2014/01/01 00:01:39 /info.html -2014/01/01 00:01:40 /info.html -2014/01/01 00:01:41 /info.html -2014/01/01 00:01:42 /info.html -2014/01/01 00:01:43 /info.html -2014/01/01 00:01:44 /info.html -2014/01/01 00:01:45 /info.html -2014/01/01 00:01:46 /info.html -2014/01/01 00:01:47 /info.html -2014/01/01 00:01:48 /info.html -2014/01/01 00:01:49 /info.html -2014/01/01 00:01:50 /info.html -2014/01/01 00:01:51 /info.html -2014/01/01 00:01:52 /info.html -2014/01/01 00:01:53 /info.html -2014/01/01 00:01:54 /info.html -2014/01/01 00:01:55 /info.html -2014/01/01 00:01:56 /info.html -2014/01/01 00:01:57 /info.html -2014/01/01 00:01:58 /info.html -2014/01/01 00:01:59 /info.html -2014/01/01 00:02:00 /info.html -2014/01/01 00:02:01 /info.html -2014/01/01 00:02:02 /info.html -2014/01/01 00:02:03 /info.html -2014/01/01 00:02:04 /info.html -2014/01/01 00:02:05 /info.html -2014/01/01 00:02:06 /info.html -2014/01/01 00:02:07 /info.html -2014/01/01 00:02:08 /info.html -2014/01/01 00:02:09 /info.html -2014/01/01 00:02:10 /info.html -2014/01/01 00:02:11 /info.html -2014/01/01 00:02:12 /info.html -2014/01/01 00:02:13 /info.html -2014/01/01 00:02:14 /info.html -2014/01/01 00:02:15 /info.html -2014/01/01 00:02:16 /info.html -2014/01/01 00:02:17 /info.html -2014/01/01 00:02:18 /info.html diff --git a/vendor/github.com/Stebalien/go-bitfield/LICENSE b/vendor/github.com/Stebalien/go-bitfield/LICENSE deleted file mode 100644 index a55967e0..00000000 --- a/vendor/github.com/Stebalien/go-bitfield/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2018 Steven Allen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/Stebalien/go-bitfield/README.md b/vendor/github.com/Stebalien/go-bitfield/README.md deleted file mode 100644 index ea3037cb..00000000 --- a/vendor/github.com/Stebalien/go-bitfield/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# go-bitfield - -This is a simple bitfield package that's about 2-3x faster than using `big.Int`s -from the standard library. It also has a better interface (and, e.g., supports -counting ones). diff --git a/vendor/github.com/Stebalien/go-bitfield/bitfield.go b/vendor/github.com/Stebalien/go-bitfield/bitfield.go deleted file mode 100644 index d6f12b06..00000000 --- a/vendor/github.com/Stebalien/go-bitfield/bitfield.go +++ /dev/null @@ -1,114 +0,0 @@ -package bitfield - -// NOTE: Don't bother replacing the divisions/modulo with shifts/ands, go is smart. - -import ( - "math/bits" -) - -// NewBitfield creates a new fixed-sized Bitfield (allocated up-front). -// -// Panics if size is not a multiple of 8. -func NewBitfield(size int) Bitfield { - if size%8 != 0 { - panic("Bitfield size must be a multiple of 8") - } - return make([]byte, size/8) -} - -// FromBytes constructs a new bitfield from a serialized bitfield. -func FromBytes(size int, bits []byte) Bitfield { - bf := NewBitfield(size) - start := len(bf) - len(bits) - if start < 0 { - panic("bitfield too small") - } - copy(bf[start:], bits) - return bf -} - -func (bf Bitfield) offset(i int) (uint, uint8) { - return uint(len(bf)) - (uint(i) / 8) - 1, uint8(i) % 8 -} - -// Bitfield is, well, a bitfield. -type Bitfield []byte - -// Bytes returns the Bitfield as a byte string. -// -// This function *does not* copy. -func (bf Bitfield) Bytes() []byte { - for i, b := range bf { - if b != 0 { - return bf[i:] - } - } - return nil -} - -// Bit returns the ith bit. -// -// Panics if the bit is out of bounds. -func (bf Bitfield) Bit(i int) bool { - idx, off := bf.offset(i) - return (bf[idx]>>off)&0x1 != 0 -} - -// SetBit sets the ith bit. -// -// Panics if the bit is out of bounds. -func (bf Bitfield) SetBit(i int) { - idx, off := bf.offset(i) - bf[idx] |= 1 << off -} - -// UnsetBit unsets the ith bit. -// -// Panics if the bit is out of bounds. -func (bf Bitfield) UnsetBit(i int) { - idx, off := bf.offset(i) - bf[idx] &= 0xFF ^ (1 << off) -} - -// SetBytes sets the bits to the given byte array. -// -// Panics if 'b' is larger than the bitfield. -func (bf Bitfield) SetBytes(b []byte) { - start := len(bf) - len(b) - if start < 0 { - panic("bitfield too small") - } - for i := range bf[:start] { - bf[i] = 0 - } - copy(bf[start:], b) -} - -// Ones returns the number of bits set. -func (bf Bitfield) Ones() int { - cnt := 0 - for _, b := range bf { - cnt += bits.OnesCount8(b) - } - return cnt -} - -// OnesBefore returns the number of bits set *before* this bit. -func (bf Bitfield) OnesBefore(i int) int { - idx, off := bf.offset(i) - cnt := bits.OnesCount8(bf[idx] << (8 - off)) - for _, b := range bf[idx+1:] { - cnt += bits.OnesCount8(b) - } - return cnt -} - -// OnesAfter returns the number of bits set *after* this bit. -func (bf Bitfield) OnesAfter(i int) int { - idx, off := bf.offset(i) - cnt := bits.OnesCount8(bf[idx] >> off) - for _, b := range bf[:idx] { - cnt += bits.OnesCount8(b) - } - return cnt -} diff --git a/vendor/github.com/Stebalien/go-bitfield/go.mod b/vendor/github.com/Stebalien/go-bitfield/go.mod deleted file mode 100644 index 83337723..00000000 --- a/vendor/github.com/Stebalien/go-bitfield/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/Stebalien/go-bitfield - -go 1.12 diff --git a/vendor/github.com/Stebalien/go-bitfield/package.json b/vendor/github.com/Stebalien/go-bitfield/package.json deleted file mode 100644 index a8045cb2..00000000 --- a/vendor/github.com/Stebalien/go-bitfield/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "Stebalien", - "bugs": { - "url": "https://github.com/Stebalien/go-bitfield" - }, - "gx": { - "dvcsimport": "github.com/Stebalien/go-bitfield" - }, - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-bitfield", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.3" -} - diff --git a/vendor/github.com/allegro/bigcache/.gitignore b/vendor/github.com/allegro/bigcache/.gitignore index 256d6659..372c42cb 100644 --- a/vendor/github.com/allegro/bigcache/.gitignore +++ b/vendor/github.com/allegro/bigcache/.gitignore @@ -2,9 +2,4 @@ .DS_Store /server/server.exe /server/server -/server/server_dar* -/server/server_fre* -/server/server_win* -/server/server_net* -/server/server_ope* CHANGELOG.md diff --git a/vendor/github.com/allegro/bigcache/.travis.yml b/vendor/github.com/allegro/bigcache/.travis.yml index cc28df6a..a9d987ef 100644 --- a/vendor/github.com/allegro/bigcache/.travis.yml +++ b/vendor/github.com/allegro/bigcache/.travis.yml @@ -14,7 +14,7 @@ before_install: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - go get golang.org/x/tools/cmd/goimports - - go get golang.org/x/lint/golint + - go get github.com/golang/lint/golint - go get github.com/stretchr/testify/assert - go get github.com/gordonklaus/ineffassign diff --git a/vendor/github.com/allegro/bigcache/README.md b/vendor/github.com/allegro/bigcache/README.md index c23f7f36..cd462d36 100644 --- a/vendor/github.com/allegro/bigcache/README.md +++ b/vendor/github.com/allegro/bigcache/README.md @@ -46,15 +46,10 @@ config := bigcache.Config { // if value is reached then the oldest entries can be overridden for the new ones // 0 value means no size limit HardMaxCacheSize: 8192, - // callback fired when the oldest entry is removed because of its expiration time or no space left - // for the new entry, or because delete was called. A bitmask representing the reason will be returned. - // Default value is nil which means no callback and it prevents from unwrapping the oldest entry. + // callback fired when the oldest entry is removed because of its + // expiration time or no space left for the new entry. Default value is nil which + // means no callback and it prevents from unwrapping the oldest entry. OnRemove: nil, - // OnRemoveWithReason is a callback fired when the oldest entry is removed because of its expiration time or no space left - // for the new entry, or because delete was called. A constant representing the reason will be passed through. - // Default value is nil which means no callback and it prevents from unwrapping the oldest entry. - // Ignored if OnRemove is specified. - OnRemoveWithReason: nil, } cache, initErr := bigcache.NewBigCache(config) @@ -79,20 +74,20 @@ Benchmark tests were made using an i7-6700K with 32GB of RAM on Windows 10. ```bash cd caches_bench; go test -bench=. -benchtime=10s ./... -timeout 30m -BenchmarkMapSet-8 3000000 569 ns/op 202 B/op 3 allocs/op -BenchmarkConcurrentMapSet-8 1000000 1592 ns/op 347 B/op 8 allocs/op -BenchmarkFreeCacheSet-8 3000000 775 ns/op 355 B/op 2 allocs/op -BenchmarkBigCacheSet-8 3000000 640 ns/op 303 B/op 2 allocs/op -BenchmarkMapGet-8 5000000 407 ns/op 24 B/op 1 allocs/op -BenchmarkConcurrentMapGet-8 3000000 558 ns/op 24 B/op 2 allocs/op -BenchmarkFreeCacheGet-8 2000000 682 ns/op 136 B/op 2 allocs/op -BenchmarkBigCacheGet-8 3000000 512 ns/op 152 B/op 4 allocs/op -BenchmarkBigCacheSetParallel-8 10000000 225 ns/op 313 B/op 3 allocs/op -BenchmarkFreeCacheSetParallel-8 10000000 218 ns/op 341 B/op 3 allocs/op -BenchmarkConcurrentMapSetParallel-8 5000000 318 ns/op 200 B/op 6 allocs/op -BenchmarkBigCacheGetParallel-8 20000000 178 ns/op 152 B/op 4 allocs/op -BenchmarkFreeCacheGetParallel-8 20000000 295 ns/op 136 B/op 3 allocs/op -BenchmarkConcurrentMapGetParallel-8 10000000 237 ns/op 24 B/op 2 allocs/op +BenchmarkMapSet-8 2000000 716 ns/op 336 B/op 3 allocs/op +BenchmarkConcurrentMapSet-8 1000000 1292 ns/op 347 B/op 8 allocs/op +BenchmarkFreeCacheSet-8 3000000 501 ns/op 371 B/op 3 allocs/op +BenchmarkBigCacheSet-8 3000000 482 ns/op 303 B/op 2 allocs/op +BenchmarkMapGet-8 5000000 309 ns/op 24 B/op 1 allocs/op +BenchmarkConcurrentMapGet-8 2000000 659 ns/op 24 B/op 2 allocs/op +BenchmarkFreeCacheGet-8 3000000 541 ns/op 152 B/op 3 allocs/op +BenchmarkBigCacheGet-8 3000000 420 ns/op 152 B/op 3 allocs/op +BenchmarkBigCacheSetParallel-8 10000000 184 ns/op 313 B/op 3 allocs/op +BenchmarkFreeCacheSetParallel-8 10000000 195 ns/op 357 B/op 4 allocs/op +BenchmarkConcurrentMapSetParallel-8 5000000 242 ns/op 200 B/op 6 allocs/op +BenchmarkBigCacheGetParallel-8 20000000 100 ns/op 152 B/op 4 allocs/op +BenchmarkFreeCacheGetParallel-8 10000000 133 ns/op 152 B/op 4 allocs/op +BenchmarkConcurrentMapGetParallel-8 10000000 202 ns/op 24 B/op 2 allocs/op ``` Writes and reads in bigcache are faster than in freecache. diff --git a/vendor/github.com/allegro/bigcache/bigcache.go b/vendor/github.com/allegro/bigcache/bigcache.go index b3879264..3a6f6bd6 100644 --- a/vendor/github.com/allegro/bigcache/bigcache.go +++ b/vendor/github.com/allegro/bigcache/bigcache.go @@ -10,7 +10,7 @@ const ( ) // BigCache is fast, concurrent, evicting cache created to keep big number of entries without impact on performance. -// It keeps entries on heap but omits GC for them. To achieve that, operations take place on byte arrays, +// It keeps entries on heap but omits GC for them. To achieve that operations on bytes arrays take place, // therefore entries (de)serialization in front of the cache will be needed in most use cases. type BigCache struct { shards []*cacheShard @@ -20,22 +20,8 @@ type BigCache struct { config Config shardMask uint64 maxShardSize uint32 - close chan struct{} } -// RemoveReason is a value used to signal to the user why a particular key was removed in the OnRemove callback. -type RemoveReason uint32 - -const ( - // Expired means the key is past its LifeWindow. - Expired RemoveReason = iota - // NoSpace means the key is the oldest and the cache size was at its maximum when Set was called, or the - // entry exceeded the maximum shard size. - NoSpace - // Deleted means Delete was called and this key was removed as a result. - Deleted -) - // NewBigCache initialize new instance of BigCache func NewBigCache(config Config) (*BigCache, error) { return newBigCache(config, &systemClock{}) @@ -59,16 +45,13 @@ func newBigCache(config Config, clock clock) (*BigCache, error) { config: config, shardMask: uint64(config.Shards - 1), maxShardSize: uint32(config.maximumShardSize()), - close: make(chan struct{}), } - var onRemove func(wrappedEntry []byte, reason RemoveReason) - if config.OnRemove != nil { - onRemove = cache.providedOnRemove - } else if config.OnRemoveWithReason != nil { - onRemove = cache.providedOnRemoveWithReason - } else { + var onRemove func(wrappedEntry []byte) + if config.OnRemove == nil { onRemove = cache.notProvidedOnRemove + } else { + onRemove = cache.providedOnRemove } for i := 0; i < config.Shards; i++ { @@ -77,15 +60,8 @@ func newBigCache(config Config, clock clock) (*BigCache, error) { if config.CleanWindow > 0 { go func() { - ticker := time.NewTicker(config.CleanWindow) - defer ticker.Stop() - for { - select { - case t := <-ticker.C: - cache.cleanUp(uint64(t.Unix())) - case <-cache.close: - return - } + for t := range time.Tick(config.CleanWindow) { + cache.cleanUp(uint64(t.Unix())) } }() } @@ -93,16 +69,8 @@ func newBigCache(config Config, clock clock) (*BigCache, error) { return cache, nil } -// Close is used to signal a shutdown of the cache when you are done with it. -// This allows the cleaning goroutines to exit and ensures references are not -// kept to the cache preventing GC of the entire cache. -func (c *BigCache) Close() error { - close(c.close) - return nil -} - // Get reads entry for the key. -// It returns an ErrEntryNotFound when +// It returns an EntryNotFoundError when // no entry exists for the given key. func (c *BigCache) Get(key string) ([]byte, error) { hashedKey := c.hash.Sum64(key) @@ -141,15 +109,6 @@ func (c *BigCache) Len() int { return len } -// Capacity returns amount of bytes store in the cache. -func (c *BigCache) Capacity() int { - var len int - for _, shard := range c.shards { - len += shard.capacity() - } - return len -} - // Stats returns cache's statistics func (c *BigCache) Stats() Stats { var s Stats @@ -169,10 +128,10 @@ func (c *BigCache) Iterator() *EntryInfoIterator { return newIterator(c) } -func (c *BigCache) onEvict(oldestEntry []byte, currentTimestamp uint64, evict func(reason RemoveReason) error) bool { +func (c *BigCache) onEvict(oldestEntry []byte, currentTimestamp uint64, evict func() error) bool { oldestTimestamp := readTimestampFromEntry(oldestEntry) if currentTimestamp-oldestTimestamp > c.lifeWindow { - evict(Expired) + evict() return true } return false @@ -188,15 +147,9 @@ func (c *BigCache) getShard(hashedKey uint64) (shard *cacheShard) { return c.shards[hashedKey&c.shardMask] } -func (c *BigCache) providedOnRemove(wrappedEntry []byte, reason RemoveReason) { +func (c *BigCache) providedOnRemove(wrappedEntry []byte) { c.config.OnRemove(readKeyFromEntry(wrappedEntry), readEntry(wrappedEntry)) } -func (c *BigCache) providedOnRemoveWithReason(wrappedEntry []byte, reason RemoveReason) { - if c.config.onRemoveFilter == 0 || (1< 0 { - c.config.OnRemoveWithReason(readKeyFromEntry(wrappedEntry), readEntry(wrappedEntry), reason) - } -} - -func (c *BigCache) notProvidedOnRemove(wrappedEntry []byte, reason RemoveReason) { +func (c *BigCache) notProvidedOnRemove(wrappedEntry []byte) { } diff --git a/vendor/github.com/allegro/bigcache/bytes.go b/vendor/github.com/allegro/bigcache/bytes.go deleted file mode 100644 index 3944bfe1..00000000 --- a/vendor/github.com/allegro/bigcache/bytes.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !appengine - -package bigcache - -import ( - "reflect" - "unsafe" -) - -func bytesToString(b []byte) string { - bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - strHeader := reflect.StringHeader{Data: bytesHeader.Data, Len: bytesHeader.Len} - return *(*string)(unsafe.Pointer(&strHeader)) -} diff --git a/vendor/github.com/allegro/bigcache/bytes_appengine.go b/vendor/github.com/allegro/bigcache/bytes_appengine.go deleted file mode 100644 index 3892f3b5..00000000 --- a/vendor/github.com/allegro/bigcache/bytes_appengine.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build appengine - -package bigcache - -func bytesToString(b []byte) string { - return string(b) -} diff --git a/vendor/github.com/allegro/bigcache/config.go b/vendor/github.com/allegro/bigcache/config.go index 9654143a..0a523947 100644 --- a/vendor/github.com/allegro/bigcache/config.go +++ b/vendor/github.com/allegro/bigcache/config.go @@ -26,16 +26,8 @@ type Config struct { // the oldest entries are overridden for the new ones. HardMaxCacheSize int // OnRemove is a callback fired when the oldest entry is removed because of its expiration time or no space left - // for the new entry, or because delete was called. - // Default value is nil which means no callback and it prevents from unwrapping the oldest entry. + // for the new entry. Default value is nil which means no callback and it prevents from unwrapping the oldest entry. OnRemove func(key string, entry []byte) - // OnRemoveWithReason is a callback fired when the oldest entry is removed because of its expiration time or no space left - // for the new entry, or because delete was called. A constant representing the reason will be passed through. - // Default value is nil which means no callback and it prevents from unwrapping the oldest entry. - // Ignored if OnRemove is specified. - OnRemoveWithReason func(key string, entry []byte, reason RemoveReason) - - onRemoveFilter int // Logger is a logging interface and used in combination with `Verbose` // Defaults to `DefaultLogger()` @@ -73,14 +65,3 @@ func (c Config) maximumShardSize() int { return maxShardSize } - -// OnRemoveFilterSet sets which remove reasons will trigger a call to OnRemoveWithReason. -// Filtering out reasons prevents bigcache from unwrapping them, which saves cpu. -func (c Config) OnRemoveFilterSet(reasons ...RemoveReason) Config { - c.onRemoveFilter = 0 - for i := range reasons { - c.onRemoveFilter |= 1 << uint(reasons[i]) - } - - return c -} diff --git a/vendor/github.com/allegro/bigcache/encoding.go b/vendor/github.com/allegro/bigcache/encoding.go index 4d434e5d..5d90d71d 100644 --- a/vendor/github.com/allegro/bigcache/encoding.go +++ b/vendor/github.com/allegro/bigcache/encoding.go @@ -2,6 +2,8 @@ package bigcache import ( "encoding/binary" + "reflect" + "unsafe" ) const ( @@ -53,6 +55,12 @@ func readKeyFromEntry(data []byte) string { return bytesToString(dst) } +func bytesToString(b []byte) string { + bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + strHeader := reflect.StringHeader{Data: bytesHeader.Data, Len: bytesHeader.Len} + return *(*string)(unsafe.Pointer(&strHeader)) +} + func readHashFromEntry(data []byte) uint64 { return binary.LittleEndian.Uint64(data[timestampSizeInBytes:]) } diff --git a/vendor/github.com/allegro/bigcache/entry_not_found_error.go b/vendor/github.com/allegro/bigcache/entry_not_found_error.go index 051a7123..e6955a57 100644 --- a/vendor/github.com/allegro/bigcache/entry_not_found_error.go +++ b/vendor/github.com/allegro/bigcache/entry_not_found_error.go @@ -1,6 +1,17 @@ package bigcache -import "errors" +import "fmt" -// ErrEntryNotFound is an error type struct which is returned when entry was not found for provided key -var ErrEntryNotFound = errors.New("Entry not found") +// EntryNotFoundError is an error type struct which is returned when entry was not found for provided key +type EntryNotFoundError struct { + message string +} + +func notFound(key string) error { + return &EntryNotFoundError{fmt.Sprintf("Entry %q not found", key)} +} + +// Error returned when entry does not exist. +func (e EntryNotFoundError) Error() string { + return e.message +} diff --git a/vendor/github.com/allegro/bigcache/shard.go b/vendor/github.com/allegro/bigcache/shard.go index 67679ba1..af48ebc3 100644 --- a/vendor/github.com/allegro/bigcache/shard.go +++ b/vendor/github.com/allegro/bigcache/shard.go @@ -8,14 +8,12 @@ import ( "github.com/allegro/bigcache/queue" ) -type onRemoveCallback func(wrappedEntry []byte, reason RemoveReason) - type cacheShard struct { hashmap map[uint64]uint32 entries queue.BytesQueue lock sync.RWMutex entryBuffer []byte - onRemove onRemoveCallback + onRemove func(wrappedEntry []byte) isVerbose bool logger Logger @@ -25,6 +23,8 @@ type cacheShard struct { stats Stats } +type onRemoveCallback func(wrappedEntry []byte) + func (s *cacheShard) get(key string, hashedKey uint64) ([]byte, error) { s.lock.RLock() itemIndex := s.hashmap[hashedKey] @@ -32,7 +32,7 @@ func (s *cacheShard) get(key string, hashedKey uint64) ([]byte, error) { if itemIndex == 0 { s.lock.RUnlock() s.miss() - return nil, ErrEntryNotFound + return nil, notFound(key) } wrappedEntry, err := s.entries.Get(int(itemIndex)) @@ -47,7 +47,7 @@ func (s *cacheShard) get(key string, hashedKey uint64) ([]byte, error) { } s.lock.RUnlock() s.collision() - return nil, ErrEntryNotFound + return nil, notFound(key) } s.lock.RUnlock() s.hit() @@ -77,7 +77,7 @@ func (s *cacheShard) set(key string, hashedKey uint64, entry []byte) error { s.lock.Unlock() return nil } - if s.removeOldestEntry(NoSpace) != nil { + if s.removeOldestEntry() != nil { s.lock.Unlock() return fmt.Errorf("entry is bigger than max shard size") } @@ -91,7 +91,7 @@ func (s *cacheShard) del(key string, hashedKey uint64) error { if itemIndex == 0 { s.lock.RUnlock() s.delmiss() - return ErrEntryNotFound + return notFound(key) } wrappedEntry, err := s.entries.Get(int(itemIndex)) @@ -105,7 +105,7 @@ func (s *cacheShard) del(key string, hashedKey uint64) error { s.lock.Lock() { delete(s.hashmap, hashedKey) - s.onRemove(wrappedEntry, Deleted) + s.onRemove(wrappedEntry) resetKeyFromEntry(wrappedEntry) } s.lock.Unlock() @@ -114,10 +114,10 @@ func (s *cacheShard) del(key string, hashedKey uint64) error { return nil } -func (s *cacheShard) onEvict(oldestEntry []byte, currentTimestamp uint64, evict func(reason RemoveReason) error) bool { +func (s *cacheShard) onEvict(oldestEntry []byte, currentTimestamp uint64, evict func() error) bool { oldestTimestamp := readTimestampFromEntry(oldestEntry) if currentTimestamp-oldestTimestamp > s.lifeWindow { - evict(Expired) + evict() return true } return false @@ -140,17 +140,14 @@ func (s *cacheShard) getOldestEntry() ([]byte, error) { } func (s *cacheShard) getEntry(index int) ([]byte, error) { - s.lock.RLock() - entry, err := s.entries.Get(index) - s.lock.RUnlock() - - return entry, err + return s.entries.Get(index) } func (s *cacheShard) copyKeys() (keys []uint32, next int) { - s.lock.RLock() keys = make([]uint32, len(s.hashmap)) + s.lock.RLock() + for _, index := range s.hashmap { keys[next] = index next++ @@ -160,12 +157,12 @@ func (s *cacheShard) copyKeys() (keys []uint32, next int) { return keys, next } -func (s *cacheShard) removeOldestEntry(reason RemoveReason) error { +func (s *cacheShard) removeOldestEntry() error { oldest, err := s.entries.Pop() if err == nil { hash := readHashFromEntry(oldest) delete(s.hashmap, hash) - s.onRemove(oldest, reason) + s.onRemove(oldest) return nil } return err @@ -186,13 +183,6 @@ func (s *cacheShard) len() int { return res } -func (s *cacheShard) capacity() int { - s.lock.RLock() - res := s.entries.Capacity() - s.lock.RUnlock() - return res -} - func (s *cacheShard) getStats() Stats { var stats = Stats{ Hits: atomic.LoadInt64(&s.stats.Hits), diff --git a/vendor/github.com/bren2010/proquint/LICENSE.md b/vendor/github.com/bren2010/proquint/LICENSE.md deleted file mode 100644 index e5d49487..00000000 --- a/vendor/github.com/bren2010/proquint/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Brendan McMillion - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/bren2010/proquint/README.md b/vendor/github.com/bren2010/proquint/README.md deleted file mode 100644 index 13e7b0b5..00000000 --- a/vendor/github.com/bren2010/proquint/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Proquint -------- - -Golang implementation of [Proquint Pronounceable Identifiers](https://github.com/deoxxa/proquint). - - diff --git a/vendor/github.com/bren2010/proquint/proquint.go b/vendor/github.com/bren2010/proquint/proquint.go deleted file mode 100644 index 60e1cf98..00000000 --- a/vendor/github.com/bren2010/proquint/proquint.go +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright (c) 2014 Brendan McMillion - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -package proquint - -import ( - "bytes" - "strings" - "regexp" -) - -var ( - conse = [...]byte{'b', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', - 'p', 'r', 's', 't', 'v', 'z'} - vowse = [...]byte{'a', 'i', 'o', 'u'} - - consd = map[byte] uint16 { - 'b' : 0, 'd' : 1, 'f' : 2, 'g' : 3, - 'h' : 4, 'j' : 5, 'k' : 6, 'l' : 7, - 'm' : 8, 'n' : 9, 'p' : 10, 'r' : 11, - 's' : 12, 't' : 13, 'v' : 14, 'z' : 15, - } - - vowsd = map[byte] uint16 { - 'a' : 0, 'i' : 1, 'o' : 2, 'u' : 3, - } -) - -/** -* Tests if a given string is a Proquint identifier -* -* @param {string} str The candidate string. -* -* @return {bool} Whether or not it qualifies. -* @return {error} Error -*/ -func IsProquint(str string) (bool, error) { - exp := "^([abdfghijklmnoprstuvz]{5}-)*[abdfghijklmnoprstuvz]{5}$" - ok, err := regexp.MatchString(exp, str) - - return ok, err -} - -/** -* Encodes an arbitrary byte slice into an identifier. -* -* @param {[]byte} buf Slice of bytes to encode. -* -* @return {string} The given byte slice as an identifier. -*/ -func Encode(buf []byte) string { - var out bytes.Buffer - - for i := 0; i < len(buf); i = i + 2 { - var n uint16 = (uint16(buf[i]) * 256) + uint16(buf[i + 1]) - - var ( - c1 = n & 0x0f - v1 = (n >> 4) & 0x03 - c2 = (n >> 6) & 0x0f - v2 = (n >> 10) & 0x03 - c3 = (n >> 12) & 0x0f - ) - - out.WriteByte(conse[c1]) - out.WriteByte(vowse[v1]) - out.WriteByte(conse[c2]) - out.WriteByte(vowse[v2]) - out.WriteByte(conse[c3]) - - if (i + 2) < len(buf) { - out.WriteByte('-') - } - } - - return out.String() -} - -/** -* Decodes an identifier into its corresponding byte slice. -* -* @param {string} str Identifier to convert. -* -* @return {[]byte} The identifier as a byte slice. -*/ -func Decode(str string) []byte { - var ( - out bytes.Buffer - bits []string = strings.Split(str, "-") - ) - - for i := 0; i < len(bits); i++ { - var x uint16 = consd[bits[i][0]] + - (vowsd[bits[i][1]] << 4) + - (consd[bits[i][2]] << 6) + - (vowsd[bits[i][3]] << 10) + - (consd[bits[i][4]] << 12) - - out.WriteByte(byte(x >> 8)) - out.WriteByte(byte(x)) - } - - return out.Bytes() -} diff --git a/vendor/github.com/btcsuite/btcd/btcec/signature.go b/vendor/github.com/btcsuite/btcd/btcec/signature.go index f1c43774..6026c424 100644 --- a/vendor/github.com/btcsuite/btcd/btcec/signature.go +++ b/vendor/github.com/btcsuite/btcd/btcec/signature.go @@ -85,11 +85,6 @@ func (sig *Signature) IsEqual(otherSig *Signature) bool { sig.S.Cmp(otherSig.S) == 0 } -// MinSigLen is the minimum length of a DER encoded signature and is when both R -// and S are 1 byte each. -// 0x30 + <1-byte> + 0x02 + 0x01 + + 0x2 + 0x01 + -const MinSigLen = 8 - func parseSig(sigStr []byte, curve elliptic.Curve, der bool) (*Signature, error) { // Originally this code used encoding/asn1 in order to parse the // signature, but a number of problems were found with this approach. @@ -103,7 +98,9 @@ func parseSig(sigStr []byte, curve elliptic.Curve, der bool) (*Signature, error) signature := &Signature{} - if len(sigStr) < MinSigLen { + // minimal message is when both numbers are 1 bytes. adding up to: + // 0x30 + len + 0x02 + 0x01 + + 0x2 + 0x01 + + if len(sigStr) < 8 { return nil, errors.New("malformed signature: too short") } // 0x30 @@ -115,10 +112,7 @@ func parseSig(sigStr []byte, curve elliptic.Curve, der bool) (*Signature, error) // length of remaining message siglen := sigStr[index] index++ - - // siglen should be less than the entire message and greater than - // the minimal message size. - if int(siglen+2) > len(sigStr) || int(siglen+2) < MinSigLen { + if int(siglen+2) > len(sigStr) { return nil, errors.New("malformed signature: bad length") } // trim the slice we're working on so we only look at what matters. @@ -427,7 +421,9 @@ func signRFC6979(privateKey *PrivateKey, hash []byte) (*Signature, error) { k := nonceRFC6979(privkey.D, hash) inv := new(big.Int).ModInverse(k, N) r, _ := privkey.Curve.ScalarBaseMult(k.Bytes()) - r.Mod(r, N) + if r.Cmp(N) == 1 { + r.Sub(r, N) + } if r.Sign() == 0 { return nil, errors.New("calculated R is zero") diff --git a/vendor/github.com/cenkalti/backoff/.gitignore b/vendor/github.com/cenkalti/backoff/.gitignore deleted file mode 100644 index 00268614..00000000 --- a/vendor/github.com/cenkalti/backoff/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/vendor/github.com/cenkalti/backoff/.travis.yml b/vendor/github.com/cenkalti/backoff/.travis.yml deleted file mode 100644 index 47a6a46e..00000000 --- a/vendor/github.com/cenkalti/backoff/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go -go: - - 1.7 - - 1.x - - tip -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -service=travis-ci diff --git a/vendor/github.com/cenkalti/backoff/LICENSE b/vendor/github.com/cenkalti/backoff/LICENSE deleted file mode 100644 index 89b81799..00000000 --- a/vendor/github.com/cenkalti/backoff/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Cenk Altı - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cenkalti/backoff/README.md b/vendor/github.com/cenkalti/backoff/README.md deleted file mode 100644 index 55ebc98f..00000000 --- a/vendor/github.com/cenkalti/backoff/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] - -This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. - -[Exponential backoff][exponential backoff wiki] -is an algorithm that uses feedback to multiplicatively decrease the rate of some process, -in order to gradually find an acceptable rate. -The retries exponentially increase and stop increasing when a certain threshold is met. - -## Usage - -See https://godoc.org/github.com/cenkalti/backoff#pkg-examples - -## Contributing - -* I would like to keep this library as small as possible. -* Please don't send a PR without opening an issue and discussing it first. -* If proposed change is not a common use case, I will probably not accept it. - -[godoc]: https://godoc.org/github.com/cenkalti/backoff -[godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png -[travis]: https://travis-ci.org/cenkalti/backoff -[travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master -[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master -[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master - -[google-http-java-client]: https://github.com/google/google-http-java-client/blob/da1aa993e90285ec18579f1553339b00e19b3ab5/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java -[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff - -[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_ diff --git a/vendor/github.com/cenkalti/backoff/backoff.go b/vendor/github.com/cenkalti/backoff/backoff.go deleted file mode 100644 index 3676ee40..00000000 --- a/vendor/github.com/cenkalti/backoff/backoff.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package backoff implements backoff algorithms for retrying operations. -// -// Use Retry function for retrying operations that may fail. -// If Retry does not meet your needs, -// copy/paste the function into your project and modify as you wish. -// -// There is also Ticker type similar to time.Ticker. -// You can use it if you need to work with channels. -// -// See Examples section below for usage examples. -package backoff - -import "time" - -// BackOff is a backoff policy for retrying an operation. -type BackOff interface { - // NextBackOff returns the duration to wait before retrying the operation, - // or backoff. Stop to indicate that no more retries should be made. - // - // Example usage: - // - // duration := backoff.NextBackOff(); - // if (duration == backoff.Stop) { - // // Do not retry operation. - // } else { - // // Sleep for duration and retry operation. - // } - // - NextBackOff() time.Duration - - // Reset to initial state. - Reset() -} - -// Stop indicates that no more retries should be made for use in NextBackOff(). -const Stop time.Duration = -1 - -// ZeroBackOff is a fixed backoff policy whose backoff time is always zero, -// meaning that the operation is retried immediately without waiting, indefinitely. -type ZeroBackOff struct{} - -func (b *ZeroBackOff) Reset() {} - -func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 } - -// StopBackOff is a fixed backoff policy that always returns backoff.Stop for -// NextBackOff(), meaning that the operation should never be retried. -type StopBackOff struct{} - -func (b *StopBackOff) Reset() {} - -func (b *StopBackOff) NextBackOff() time.Duration { return Stop } - -// ConstantBackOff is a backoff policy that always returns the same backoff delay. -// This is in contrast to an exponential backoff policy, -// which returns a delay that grows longer as you call NextBackOff() over and over again. -type ConstantBackOff struct { - Interval time.Duration -} - -func (b *ConstantBackOff) Reset() {} -func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval } - -func NewConstantBackOff(d time.Duration) *ConstantBackOff { - return &ConstantBackOff{Interval: d} -} diff --git a/vendor/github.com/cenkalti/backoff/context.go b/vendor/github.com/cenkalti/backoff/context.go deleted file mode 100644 index 7706faa2..00000000 --- a/vendor/github.com/cenkalti/backoff/context.go +++ /dev/null @@ -1,63 +0,0 @@ -package backoff - -import ( - "context" - "time" -) - -// BackOffContext is a backoff policy that stops retrying after the context -// is canceled. -type BackOffContext interface { - BackOff - Context() context.Context -} - -type backOffContext struct { - BackOff - ctx context.Context -} - -// WithContext returns a BackOffContext with context ctx -// -// ctx must not be nil -func WithContext(b BackOff, ctx context.Context) BackOffContext { - if ctx == nil { - panic("nil context") - } - - if b, ok := b.(*backOffContext); ok { - return &backOffContext{ - BackOff: b.BackOff, - ctx: ctx, - } - } - - return &backOffContext{ - BackOff: b, - ctx: ctx, - } -} - -func ensureContext(b BackOff) BackOffContext { - if cb, ok := b.(BackOffContext); ok { - return cb - } - return WithContext(b, context.Background()) -} - -func (b *backOffContext) Context() context.Context { - return b.ctx -} - -func (b *backOffContext) NextBackOff() time.Duration { - select { - case <-b.ctx.Done(): - return Stop - default: - } - next := b.BackOff.NextBackOff() - if deadline, ok := b.ctx.Deadline(); ok && deadline.Sub(time.Now()) < next { - return Stop - } - return next -} diff --git a/vendor/github.com/cenkalti/backoff/exponential.go b/vendor/github.com/cenkalti/backoff/exponential.go deleted file mode 100644 index a031a659..00000000 --- a/vendor/github.com/cenkalti/backoff/exponential.go +++ /dev/null @@ -1,153 +0,0 @@ -package backoff - -import ( - "math/rand" - "time" -) - -/* -ExponentialBackOff is a backoff implementation that increases the backoff -period for each retry attempt using a randomization function that grows exponentially. - -NextBackOff() is calculated using the following formula: - - randomized interval = - RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) - -In other words NextBackOff() will range between the randomization factor -percentage below and above the retry interval. - -For example, given the following parameters: - - RetryInterval = 2 - RandomizationFactor = 0.5 - Multiplier = 2 - -the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, -multiplied by the exponential, that is, between 2 and 6 seconds. - -Note: MaxInterval caps the RetryInterval and not the randomized interval. - -If the time elapsed since an ExponentialBackOff instance is created goes past the -MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop. - -The elapsed time can be reset by calling Reset(). - -Example: Given the following default arguments, for 10 tries the sequence will be, -and assuming we go over the MaxElapsedTime on the 10th try: - - Request # RetryInterval (seconds) Randomized Interval (seconds) - - 1 0.5 [0.25, 0.75] - 2 0.75 [0.375, 1.125] - 3 1.125 [0.562, 1.687] - 4 1.687 [0.8435, 2.53] - 5 2.53 [1.265, 3.795] - 6 3.795 [1.897, 5.692] - 7 5.692 [2.846, 8.538] - 8 8.538 [4.269, 12.807] - 9 12.807 [6.403, 19.210] - 10 19.210 backoff.Stop - -Note: Implementation is not thread-safe. -*/ -type ExponentialBackOff struct { - InitialInterval time.Duration - RandomizationFactor float64 - Multiplier float64 - MaxInterval time.Duration - // After MaxElapsedTime the ExponentialBackOff stops. - // It never stops if MaxElapsedTime == 0. - MaxElapsedTime time.Duration - Clock Clock - - currentInterval time.Duration - startTime time.Time -} - -// Clock is an interface that returns current time for BackOff. -type Clock interface { - Now() time.Time -} - -// Default values for ExponentialBackOff. -const ( - DefaultInitialInterval = 500 * time.Millisecond - DefaultRandomizationFactor = 0.5 - DefaultMultiplier = 1.5 - DefaultMaxInterval = 60 * time.Second - DefaultMaxElapsedTime = 15 * time.Minute -) - -// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. -func NewExponentialBackOff() *ExponentialBackOff { - b := &ExponentialBackOff{ - InitialInterval: DefaultInitialInterval, - RandomizationFactor: DefaultRandomizationFactor, - Multiplier: DefaultMultiplier, - MaxInterval: DefaultMaxInterval, - MaxElapsedTime: DefaultMaxElapsedTime, - Clock: SystemClock, - } - b.Reset() - return b -} - -type systemClock struct{} - -func (t systemClock) Now() time.Time { - return time.Now() -} - -// SystemClock implements Clock interface that uses time.Now(). -var SystemClock = systemClock{} - -// Reset the interval back to the initial retry interval and restarts the timer. -func (b *ExponentialBackOff) Reset() { - b.currentInterval = b.InitialInterval - b.startTime = b.Clock.Now() -} - -// NextBackOff calculates the next backoff interval using the formula: -// Randomized interval = RetryInterval +/- (RandomizationFactor * RetryInterval) -func (b *ExponentialBackOff) NextBackOff() time.Duration { - // Make sure we have not gone over the maximum elapsed time. - if b.MaxElapsedTime != 0 && b.GetElapsedTime() > b.MaxElapsedTime { - return Stop - } - defer b.incrementCurrentInterval() - return getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval) -} - -// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance -// is created and is reset when Reset() is called. -// -// The elapsed time is computed using time.Now().UnixNano(). It is -// safe to call even while the backoff policy is used by a running -// ticker. -func (b *ExponentialBackOff) GetElapsedTime() time.Duration { - return b.Clock.Now().Sub(b.startTime) -} - -// Increments the current interval by multiplying it with the multiplier. -func (b *ExponentialBackOff) incrementCurrentInterval() { - // Check for overflow, if overflow is detected set the current interval to the max interval. - if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { - b.currentInterval = b.MaxInterval - } else { - b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) - } -} - -// Returns a random value from the following interval: -// [randomizationFactor * currentInterval, randomizationFactor * currentInterval]. -func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { - var delta = randomizationFactor * float64(currentInterval) - var minInterval = float64(currentInterval) - delta - var maxInterval = float64(currentInterval) + delta - - // Get a random value from the range [minInterval, maxInterval]. - // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then - // we want a 33% chance for selecting either 1, 2 or 3. - return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) -} diff --git a/vendor/github.com/cenkalti/backoff/go.mod b/vendor/github.com/cenkalti/backoff/go.mod deleted file mode 100644 index 479e62ad..00000000 --- a/vendor/github.com/cenkalti/backoff/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/cenkalti/backoff/v3 - -go 1.12 diff --git a/vendor/github.com/cenkalti/backoff/retry.go b/vendor/github.com/cenkalti/backoff/retry.go deleted file mode 100644 index e936a506..00000000 --- a/vendor/github.com/cenkalti/backoff/retry.go +++ /dev/null @@ -1,82 +0,0 @@ -package backoff - -import "time" - -// An Operation is executing by Retry() or RetryNotify(). -// The operation will be retried using a backoff policy if it returns an error. -type Operation func() error - -// Notify is a notify-on-error function. It receives an operation error and -// backoff delay if the operation failed (with an error). -// -// NOTE that if the backoff policy stated to stop retrying, -// the notify function isn't called. -type Notify func(error, time.Duration) - -// Retry the operation o until it does not return error or BackOff stops. -// o is guaranteed to be run at least once. -// -// If o returns a *PermanentError, the operation is not retried, and the -// wrapped error is returned. -// -// Retry sleeps the goroutine for the duration returned by BackOff after a -// failed operation returns. -func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) } - -// RetryNotify calls notify function with the error and wait duration -// for each failed attempt before sleep. -func RetryNotify(operation Operation, b BackOff, notify Notify) error { - var err error - var next time.Duration - var t *time.Timer - - cb := ensureContext(b) - - b.Reset() - for { - if err = operation(); err == nil { - return nil - } - - if permanent, ok := err.(*PermanentError); ok { - return permanent.Err - } - - if next = cb.NextBackOff(); next == Stop { - return err - } - - if notify != nil { - notify(err, next) - } - - if t == nil { - t = time.NewTimer(next) - defer t.Stop() - } else { - t.Reset(next) - } - - select { - case <-cb.Context().Done(): - return err - case <-t.C: - } - } -} - -// PermanentError signals that the operation should not be retried. -type PermanentError struct { - Err error -} - -func (e *PermanentError) Error() string { - return e.Err.Error() -} - -// Permanent wraps the given err in a *PermanentError. -func Permanent(err error) *PermanentError { - return &PermanentError{ - Err: err, - } -} diff --git a/vendor/github.com/cenkalti/backoff/ticker.go b/vendor/github.com/cenkalti/backoff/ticker.go deleted file mode 100644 index e41084b0..00000000 --- a/vendor/github.com/cenkalti/backoff/ticker.go +++ /dev/null @@ -1,82 +0,0 @@ -package backoff - -import ( - "sync" - "time" -) - -// Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. -// -// Ticks will continue to arrive when the previous operation is still running, -// so operations that take a while to fail could run in quick succession. -type Ticker struct { - C <-chan time.Time - c chan time.Time - b BackOffContext - stop chan struct{} - stopOnce sync.Once -} - -// NewTicker returns a new Ticker containing a channel that will send -// the time at times specified by the BackOff argument. Ticker is -// guaranteed to tick at least once. The channel is closed when Stop -// method is called or BackOff stops. It is not safe to manipulate the -// provided backoff policy (notably calling NextBackOff or Reset) -// while the ticker is running. -func NewTicker(b BackOff) *Ticker { - c := make(chan time.Time) - t := &Ticker{ - C: c, - c: c, - b: ensureContext(b), - stop: make(chan struct{}), - } - t.b.Reset() - go t.run() - return t -} - -// Stop turns off a ticker. After Stop, no more ticks will be sent. -func (t *Ticker) Stop() { - t.stopOnce.Do(func() { close(t.stop) }) -} - -func (t *Ticker) run() { - c := t.c - defer close(c) - - // Ticker is guaranteed to tick at least once. - afterC := t.send(time.Now()) - - for { - if afterC == nil { - return - } - - select { - case tick := <-afterC: - afterC = t.send(tick) - case <-t.stop: - t.c = nil // Prevent future ticks from being sent to the channel. - return - case <-t.b.Context().Done(): - return - } - } -} - -func (t *Ticker) send(tick time.Time) <-chan time.Time { - select { - case t.c <- tick: - case <-t.stop: - return nil - } - - next := t.b.NextBackOff() - if next == Stop { - t.Stop() - return nil - } - - return time.After(next) -} diff --git a/vendor/github.com/cenkalti/backoff/tries.go b/vendor/github.com/cenkalti/backoff/tries.go deleted file mode 100644 index cfeefd9b..00000000 --- a/vendor/github.com/cenkalti/backoff/tries.go +++ /dev/null @@ -1,35 +0,0 @@ -package backoff - -import "time" - -/* -WithMaxRetries creates a wrapper around another BackOff, which will -return Stop if NextBackOff() has been called too many times since -the last time Reset() was called - -Note: Implementation is not thread-safe. -*/ -func WithMaxRetries(b BackOff, max uint64) BackOff { - return &backOffTries{delegate: b, maxTries: max} -} - -type backOffTries struct { - delegate BackOff - maxTries uint64 - numTries uint64 -} - -func (b *backOffTries) NextBackOff() time.Duration { - if b.maxTries > 0 { - if b.maxTries <= b.numTries { - return Stop - } - b.numTries++ - } - return b.delegate.NextBackOff() -} - -func (b *backOffTries) Reset() { - b.numTries = 0 - b.delegate.Reset() -} diff --git a/vendor/github.com/cheekybits/genny/LICENSE b/vendor/github.com/cheekybits/genny/LICENSE deleted file mode 100644 index 519d7f22..00000000 --- a/vendor/github.com/cheekybits/genny/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 cheekybits - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/cheekybits/genny/generic/doc.go b/vendor/github.com/cheekybits/genny/generic/doc.go deleted file mode 100644 index 3bd6c869..00000000 --- a/vendor/github.com/cheekybits/genny/generic/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package generic contains the generic marker types. -package generic diff --git a/vendor/github.com/cheekybits/genny/generic/generic.go b/vendor/github.com/cheekybits/genny/generic/generic.go deleted file mode 100644 index 04a2306c..00000000 --- a/vendor/github.com/cheekybits/genny/generic/generic.go +++ /dev/null @@ -1,13 +0,0 @@ -package generic - -// Type is the placeholder type that indicates a generic value. -// When genny is executed, variables of this type will be replaced with -// references to the specific types. -// var GenericType generic.Type -type Type interface{} - -// Number is the placehoder type that indiccates a generic numerical value. -// When genny is executed, variables of this type will be replaced with -// references to the specific types. -// var GenericType generic.Number -type Number float64 diff --git a/vendor/github.com/coreos/go-semver/LICENSE b/vendor/github.com/coreos/go-semver/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/coreos/go-semver/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/coreos/go-semver/NOTICE b/vendor/github.com/coreos/go-semver/NOTICE deleted file mode 100644 index 23a0ada2..00000000 --- a/vendor/github.com/coreos/go-semver/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2018 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go deleted file mode 100644 index 76cf4852..00000000 --- a/vendor/github.com/coreos/go-semver/semver/semver.go +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright 2013-2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Semantic Versions http://semver.org -package semver - -import ( - "bytes" - "errors" - "fmt" - "regexp" - "strconv" - "strings" -) - -type Version struct { - Major int64 - Minor int64 - Patch int64 - PreRelease PreRelease - Metadata string -} - -type PreRelease string - -func splitOff(input *string, delim string) (val string) { - parts := strings.SplitN(*input, delim, 2) - - if len(parts) == 2 { - *input = parts[0] - val = parts[1] - } - - return val -} - -func New(version string) *Version { - return Must(NewVersion(version)) -} - -func NewVersion(version string) (*Version, error) { - v := Version{} - - if err := v.Set(version); err != nil { - return nil, err - } - - return &v, nil -} - -// Must is a helper for wrapping NewVersion and will panic if err is not nil. -func Must(v *Version, err error) *Version { - if err != nil { - panic(err) - } - return v -} - -// Set parses and updates v from the given version string. Implements flag.Value -func (v *Version) Set(version string) error { - metadata := splitOff(&version, "+") - preRelease := PreRelease(splitOff(&version, "-")) - dotParts := strings.SplitN(version, ".", 3) - - if len(dotParts) != 3 { - return fmt.Errorf("%s is not in dotted-tri format", version) - } - - if err := validateIdentifier(string(preRelease)); err != nil { - return fmt.Errorf("failed to validate pre-release: %v", err) - } - - if err := validateIdentifier(metadata); err != nil { - return fmt.Errorf("failed to validate metadata: %v", err) - } - - parsed := make([]int64, 3, 3) - - for i, v := range dotParts[:3] { - val, err := strconv.ParseInt(v, 10, 64) - parsed[i] = val - if err != nil { - return err - } - } - - v.Metadata = metadata - v.PreRelease = preRelease - v.Major = parsed[0] - v.Minor = parsed[1] - v.Patch = parsed[2] - return nil -} - -func (v Version) String() string { - var buffer bytes.Buffer - - fmt.Fprintf(&buffer, "%d.%d.%d", v.Major, v.Minor, v.Patch) - - if v.PreRelease != "" { - fmt.Fprintf(&buffer, "-%s", v.PreRelease) - } - - if v.Metadata != "" { - fmt.Fprintf(&buffer, "+%s", v.Metadata) - } - - return buffer.String() -} - -func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error { - var data string - if err := unmarshal(&data); err != nil { - return err - } - return v.Set(data) -} - -func (v Version) MarshalJSON() ([]byte, error) { - return []byte(`"` + v.String() + `"`), nil -} - -func (v *Version) UnmarshalJSON(data []byte) error { - l := len(data) - if l == 0 || string(data) == `""` { - return nil - } - if l < 2 || data[0] != '"' || data[l-1] != '"' { - return errors.New("invalid semver string") - } - return v.Set(string(data[1 : l-1])) -} - -// Compare tests if v is less than, equal to, or greater than versionB, -// returning -1, 0, or +1 respectively. -func (v Version) Compare(versionB Version) int { - if cmp := recursiveCompare(v.Slice(), versionB.Slice()); cmp != 0 { - return cmp - } - return preReleaseCompare(v, versionB) -} - -// Equal tests if v is equal to versionB. -func (v Version) Equal(versionB Version) bool { - return v.Compare(versionB) == 0 -} - -// LessThan tests if v is less than versionB. -func (v Version) LessThan(versionB Version) bool { - return v.Compare(versionB) < 0 -} - -// Slice converts the comparable parts of the semver into a slice of integers. -func (v Version) Slice() []int64 { - return []int64{v.Major, v.Minor, v.Patch} -} - -func (p PreRelease) Slice() []string { - preRelease := string(p) - return strings.Split(preRelease, ".") -} - -func preReleaseCompare(versionA Version, versionB Version) int { - a := versionA.PreRelease - b := versionB.PreRelease - - /* Handle the case where if two versions are otherwise equal it is the - * one without a PreRelease that is greater */ - if len(a) == 0 && (len(b) > 0) { - return 1 - } else if len(b) == 0 && (len(a) > 0) { - return -1 - } - - // If there is a prerelease, check and compare each part. - return recursivePreReleaseCompare(a.Slice(), b.Slice()) -} - -func recursiveCompare(versionA []int64, versionB []int64) int { - if len(versionA) == 0 { - return 0 - } - - a := versionA[0] - b := versionB[0] - - if a > b { - return 1 - } else if a < b { - return -1 - } - - return recursiveCompare(versionA[1:], versionB[1:]) -} - -func recursivePreReleaseCompare(versionA []string, versionB []string) int { - // A larger set of pre-release fields has a higher precedence than a smaller set, - // if all of the preceding identifiers are equal. - if len(versionA) == 0 { - if len(versionB) > 0 { - return -1 - } - return 0 - } else if len(versionB) == 0 { - // We're longer than versionB so return 1. - return 1 - } - - a := versionA[0] - b := versionB[0] - - aInt := false - bInt := false - - aI, err := strconv.Atoi(versionA[0]) - if err == nil { - aInt = true - } - - bI, err := strconv.Atoi(versionB[0]) - if err == nil { - bInt = true - } - - // Numeric identifiers always have lower precedence than non-numeric identifiers. - if aInt && !bInt { - return -1 - } else if !aInt && bInt { - return 1 - } - - // Handle Integer Comparison - if aInt && bInt { - if aI > bI { - return 1 - } else if aI < bI { - return -1 - } - } - - // Handle String Comparison - if a > b { - return 1 - } else if a < b { - return -1 - } - - return recursivePreReleaseCompare(versionA[1:], versionB[1:]) -} - -// BumpMajor increments the Major field by 1 and resets all other fields to their default values -func (v *Version) BumpMajor() { - v.Major += 1 - v.Minor = 0 - v.Patch = 0 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// BumpMinor increments the Minor field by 1 and resets all other fields to their default values -func (v *Version) BumpMinor() { - v.Minor += 1 - v.Patch = 0 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// BumpPatch increments the Patch field by 1 and resets all other fields to their default values -func (v *Version) BumpPatch() { - v.Patch += 1 - v.PreRelease = PreRelease("") - v.Metadata = "" -} - -// validateIdentifier makes sure the provided identifier satisfies semver spec -func validateIdentifier(id string) error { - if id != "" && !reIdentifier.MatchString(id) { - return fmt.Errorf("%s is not a valid semver identifier", id) - } - return nil -} - -// reIdentifier is a regular expression used to check that pre-release and metadata -// identifiers satisfy the spec requirements -var reIdentifier = regexp.MustCompile(`^[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$`) diff --git a/vendor/github.com/coreos/go-semver/semver/sort.go b/vendor/github.com/coreos/go-semver/semver/sort.go deleted file mode 100644 index e256b41a..00000000 --- a/vendor/github.com/coreos/go-semver/semver/sort.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013-2015 CoreOS, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semver - -import ( - "sort" -) - -type Versions []*Version - -func (s Versions) Len() int { - return len(s) -} - -func (s Versions) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s Versions) Less(i, j int) bool { - return s[i].LessThan(*s[j]) -} - -// Sort sorts the given slice of Version -func Sort(versions []*Version) { - sort.Sort(Versions(versions)) -} diff --git a/vendor/github.com/cskr/pubsub/LICENSE b/vendor/github.com/cskr/pubsub/LICENSE deleted file mode 100644 index ae195b47..00000000 --- a/vendor/github.com/cskr/pubsub/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013, Chandra Sekar S -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/cskr/pubsub/README.md b/vendor/github.com/cskr/pubsub/README.md deleted file mode 100644 index 8ec08386..00000000 --- a/vendor/github.com/cskr/pubsub/README.md +++ /dev/null @@ -1,13 +0,0 @@ -[![GoDoc](https://godoc.org/github.com/cskr/pubsub?status.svg)](https://godoc.org/github.com/cskr/pubsub) - -Package pubsub implements a simple multi-topic pub-sub library. - -Install pubsub with, - - go get github.com/cskr/pubsub - -This repository is a go module and contains tagged releases. Please pin a -version for production use. - -Use of this module is governed by a BSD-style license that can be found in the -[LICENSE](LICENSE) file. diff --git a/vendor/github.com/cskr/pubsub/go.mod b/vendor/github.com/cskr/pubsub/go.mod deleted file mode 100644 index 18dbec9b..00000000 --- a/vendor/github.com/cskr/pubsub/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/cskr/pubsub - -go 1.12 diff --git a/vendor/github.com/cskr/pubsub/pubsub.go b/vendor/github.com/cskr/pubsub/pubsub.go deleted file mode 100644 index 352ef6ff..00000000 --- a/vendor/github.com/cskr/pubsub/pubsub.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2013, Chandra Sekar S. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package pubsub implements a simple multi-topic pub-sub -// library. -// -// Topics must be strings and messages of any type can be -// published. A topic can have any number of subcribers and -// all of them receive messages published on the topic. -package pubsub - -type operation int - -const ( - sub operation = iota - subOnce - subOnceEach - pub - tryPub - unsub - unsubAll - closeTopic - shutdown -) - -// PubSub is a collection of topics. -type PubSub struct { - cmdChan chan cmd - capacity int -} - -type cmd struct { - op operation - topics []string - ch chan interface{} - msg interface{} -} - -// New creates a new PubSub and starts a goroutine for handling operations. -// The capacity of the channels created by Sub and SubOnce will be as specified. -func New(capacity int) *PubSub { - ps := &PubSub{make(chan cmd), capacity} - go ps.start() - return ps -} - -// Sub returns a channel on which messages published on any of -// the specified topics can be received. -func (ps *PubSub) Sub(topics ...string) chan interface{} { - return ps.sub(sub, topics...) -} - -// SubOnce is similar to Sub, but only the first message published, after subscription, -// on any of the specified topics can be received. -func (ps *PubSub) SubOnce(topics ...string) chan interface{} { - return ps.sub(subOnce, topics...) -} - -// SubOnceEach returns a channel on which callers receive, at most, one message -// for each topic. -func (ps *PubSub) SubOnceEach(topics ...string) chan interface{} { - return ps.sub(subOnceEach, topics...) -} - -func (ps *PubSub) sub(op operation, topics ...string) chan interface{} { - ch := make(chan interface{}, ps.capacity) - ps.cmdChan <- cmd{op: op, topics: topics, ch: ch} - return ch -} - -// AddSub adds subscriptions to an existing channel. -func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) { - ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch} -} - -// AddSubOnceEach adds subscriptions to an existing channel with SubOnceEach -// behavior. -func (ps *PubSub) AddSubOnceEach(ch chan interface{}, topics ...string) { - ps.cmdChan <- cmd{op: subOnceEach, topics: topics, ch: ch} -} - -// Pub publishes the given message to all subscribers of -// the specified topics. -func (ps *PubSub) Pub(msg interface{}, topics ...string) { - ps.cmdChan <- cmd{op: pub, topics: topics, msg: msg} -} - -// TryPub publishes the given message to all subscribers of -// the specified topics if the topic has buffer space. -func (ps *PubSub) TryPub(msg interface{}, topics ...string) { - ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg} -} - -// Unsub unsubscribes the given channel from the specified -// topics. If no topic is specified, it is unsubscribed -// from all topics. -// -// Unsub must be called from a goroutine that is different from the subscriber. -// The subscriber must consume messages from the channel until it reaches the -// end. Not doing so can result in a deadlock. -func (ps *PubSub) Unsub(ch chan interface{}, topics ...string) { - if len(topics) == 0 { - ps.cmdChan <- cmd{op: unsubAll, ch: ch} - return - } - - ps.cmdChan <- cmd{op: unsub, topics: topics, ch: ch} -} - -// Close closes all channels currently subscribed to the specified topics. -// If a channel is subscribed to multiple topics, some of which is -// not specified, it is not closed. -func (ps *PubSub) Close(topics ...string) { - ps.cmdChan <- cmd{op: closeTopic, topics: topics} -} - -// Shutdown closes all subscribed channels and terminates the goroutine. -func (ps *PubSub) Shutdown() { - ps.cmdChan <- cmd{op: shutdown} -} - -func (ps *PubSub) start() { - reg := registry{ - topics: make(map[string]map[chan interface{}]subType), - revTopics: make(map[chan interface{}]map[string]bool), - } - -loop: - for cmd := range ps.cmdChan { - if cmd.topics == nil { - switch cmd.op { - case unsubAll: - reg.removeChannel(cmd.ch) - - case shutdown: - break loop - } - - continue loop - } - - for _, topic := range cmd.topics { - switch cmd.op { - case sub: - reg.add(topic, cmd.ch, normal) - - case subOnce: - reg.add(topic, cmd.ch, onceAny) - - case subOnceEach: - reg.add(topic, cmd.ch, onceEach) - - case tryPub: - reg.sendNoWait(topic, cmd.msg) - - case pub: - reg.send(topic, cmd.msg) - - case unsub: - reg.remove(topic, cmd.ch) - - case closeTopic: - reg.removeTopic(topic) - } - } - } - - for topic, chans := range reg.topics { - for ch := range chans { - reg.remove(topic, ch) - } - } -} - -// registry maintains the current subscription state. It's not -// safe to access a registry from multiple goroutines simultaneously. -type registry struct { - topics map[string]map[chan interface{}]subType - revTopics map[chan interface{}]map[string]bool -} - -type subType int - -const ( - onceAny subType = iota - onceEach - normal -) - -func (reg *registry) add(topic string, ch chan interface{}, st subType) { - if reg.topics[topic] == nil { - reg.topics[topic] = make(map[chan interface{}]subType) - } - reg.topics[topic][ch] = st - - if reg.revTopics[ch] == nil { - reg.revTopics[ch] = make(map[string]bool) - } - reg.revTopics[ch][topic] = true -} - -func (reg *registry) send(topic string, msg interface{}) { - for ch, st := range reg.topics[topic] { - ch <- msg - switch st { - case onceAny: - for topic := range reg.revTopics[ch] { - reg.remove(topic, ch) - } - case onceEach: - reg.remove(topic, ch) - } - } -} - -func (reg *registry) sendNoWait(topic string, msg interface{}) { - for ch, st := range reg.topics[topic] { - select { - case ch <- msg: - switch st { - case onceAny: - for topic := range reg.revTopics[ch] { - reg.remove(topic, ch) - } - case onceEach: - reg.remove(topic, ch) - } - default: - } - - } -} - -func (reg *registry) removeTopic(topic string) { - for ch := range reg.topics[topic] { - reg.remove(topic, ch) - } -} - -func (reg *registry) removeChannel(ch chan interface{}) { - for topic := range reg.revTopics[ch] { - reg.remove(topic, ch) - } -} - -func (reg *registry) remove(topic string, ch chan interface{}) { - if _, ok := reg.topics[topic]; !ok { - return - } - - if _, ok := reg.topics[topic][ch]; !ok { - return - } - - delete(reg.topics[topic], ch) - delete(reg.revTopics[ch], topic) - - if len(reg.topics[topic]) == 0 { - delete(reg.topics, topic) - } - - if len(reg.revTopics[ch]) == 0 { - close(ch) - delete(reg.revTopics, ch) - } -} diff --git a/vendor/github.com/davidlazar/go-crypto/LICENSE b/vendor/github.com/davidlazar/go-crypto/LICENSE deleted file mode 100644 index a91035e1..00000000 --- a/vendor/github.com/davidlazar/go-crypto/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 David Lazar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/davidlazar/go-crypto/drbg/LICENSE b/vendor/github.com/davidlazar/go-crypto/drbg/LICENSE deleted file mode 100644 index b5c6032f..00000000 --- a/vendor/github.com/davidlazar/go-crypto/drbg/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 David Lazar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/davidlazar/go-crypto/salsa20/salsa20.go b/vendor/github.com/davidlazar/go-crypto/salsa20/salsa20.go deleted file mode 100644 index 4942dfee..00000000 --- a/vendor/github.com/davidlazar/go-crypto/salsa20/salsa20.go +++ /dev/null @@ -1,85 +0,0 @@ -package salsa20 - -import ( - "crypto/cipher" - "encoding/binary" - - "golang.org/x/crypto/salsa20/salsa" -) - -const BlockSize = 64 - -type salsaCipher struct { - key *[32]byte - nonce [8]byte - x [BlockSize]byte - nx int - counter uint64 -} - -func New(key *[32]byte, nonce []byte) cipher.Stream { - c := new(salsaCipher) - - if len(nonce) == 24 { - var subKey [32]byte - var hNonce [16]byte - copy(hNonce[:], nonce[:16]) - salsa.HSalsa20(&subKey, &hNonce, key, &salsa.Sigma) - copy(c.nonce[:], nonce[16:]) - c.key = &subKey - } else if len(nonce) == 8 { - c.key = key - copy(c.nonce[:], nonce) - } else { - panic("salsa20: nonce must be 8 or 24 bytes") - } - return c -} - -func (c *salsaCipher) XORKeyStream(dst, src []byte) { - if len(dst) < len(src) { - src = src[:len(dst)] - } - if c.nx > 0 { - n := xorBytes(dst, src, c.x[c.nx:]) - c.nx += n - if c.nx == BlockSize { - c.nx = 0 - } - src = src[n:] - dst = dst[n:] - } - if len(src) > BlockSize { - n := len(src) &^ (BlockSize - 1) - c.blocks(dst, src[:n]) - src = src[n:] - dst = dst[n:] - } - if len(src) > 0 { - c.nx = copy(c.x[:], src) - for i := c.nx; i < len(c.x); i++ { - c.x[i] = 0 - } - c.blocks(c.x[:], c.x[:]) - copy(dst, c.x[:c.nx]) - } -} - -func (c *salsaCipher) blocks(dst, src []byte) { - var nonce [16]byte - copy(nonce[:], c.nonce[:]) - binary.LittleEndian.PutUint64(nonce[8:], c.counter) - salsa.XORKeyStream(dst, src, &nonce, c.key) - c.counter += uint64(len(src)) / 64 -} - -func xorBytes(dst, a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - dst[i] = a[i] ^ b[i] - } - return n -} diff --git a/vendor/github.com/dgraph-io/badger/.gitignore b/vendor/github.com/dgraph-io/badger/.gitignore deleted file mode 100644 index 11b9bcb1..00000000 --- a/vendor/github.com/dgraph-io/badger/.gitignore +++ /dev/null @@ -1 +0,0 @@ -p/ diff --git a/vendor/github.com/dgraph-io/badger/.golangci.yml b/vendor/github.com/dgraph-io/badger/.golangci.yml deleted file mode 100644 index 22f245f2..00000000 --- a/vendor/github.com/dgraph-io/badger/.golangci.yml +++ /dev/null @@ -1,20 +0,0 @@ -run: - tests: false - -linters-settings: - lll: - line-length: 100 - -linters: - disable-all: true - enable: - - errcheck - - ineffassign - - gas - - gofmt - - golint - - gosimple - - govet - - lll - - varcheck - - unused diff --git a/vendor/github.com/dgraph-io/badger/.travis.yml b/vendor/github.com/dgraph-io/badger/.travis.yml deleted file mode 100644 index 43bf4cdc..00000000 --- a/vendor/github.com/dgraph-io/badger/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -go: - - "1.9" - - "1.10" - - "1.11" - -matrix: - include: - - os: osx -notifications: - email: false - slack: - secure: X7uBLWYbuUhf8QFE16CoS5z7WvFR8EN9j6cEectMW6mKZ3vwXGwVXRIPsgUq/606DsQdCCx34MR8MRWYGlu6TBolbSe9y0EP0i46yipPz22YtuT7umcVUbGEyx8MZKgG0v1u/zA0O4aCsOBpGAA3gxz8h3JlEHDt+hv6U8xRsSllVLzLSNb5lwxDtcfEDxVVqP47GMEgjLPM28Pyt5qwjk7o5a4YSVzkfdxBXxd3gWzFUWzJ5E3cTacli50dK4GVfiLcQY2aQYoYO7AAvDnvP+TPfjDkBlUEE4MUz5CDIN51Xb+WW33sX7g+r3Bj7V5IRcF973RiYkpEh+3eoiPnyWyxhDZBYilty3b+Hysp6d4Ov/3I3ll7Bcny5+cYjakjkMH3l9w3gs6Y82GlpSLSJshKWS8vPRsxFe0Pstj6QSJXTd9EBaFr+l1ScXjJv/Sya9j8N9FfTuOTESWuaL1auX4Y7zEEVHlA8SCNOO8K0eTfxGZnC/YcIHsR8rePEAcFxfOYQppkyLF/XvAtnb/LMUuu0g4y2qNdme6Oelvyar1tFEMRtbl4mRCdu/krXBFtkrsfUaVY6WTPdvXAGotsFJ0wuA53zGVhlcd3+xAlSlR3c1QX95HIMeivJKb5L4nTjP+xnrmQNtnVk+tG4LSH2ltuwcZSSczModtcBmRefrk= - -env: - global: - - secure: CRkV2+/jlO0gXzzS50XGxfMS117FNwiVjxNY/LeWq06RKD+dDCPxTJl3JCNe3l0cYEPAglV2uMMYukDiTqJ7e+HI4nh4N4mv6lwx39N8dAvJe1x5ITS2T4qk4kTjuQb1Q1vw/ZOxoQqmvNKj2uRmBdJ/HHmysbRJ1OzCWML3OXdUwJf0AYlJzTjpMfkOKr7sTtE4rwyyQtd4tKH1fGdurgI9ZuFd9qvYxK2qcJhsQ6CNqMXt+7FkVkN1rIPmofjjBTNryzUr4COFXuWH95aDAif19DeBW4lbNgo1+FpDsrgmqtuhl6NAuptI8q/imow2KXBYJ8JPXsxW8DVFj0IIp0RCd3GjaEnwBEbxAyiIHLfW7AudyTS/dJOvZffPqXnuJ8xj3OPIdNe4xY0hWl8Ju2HhKfLOAHq7VadHZWd3IHLil70EiL4/JLD1rNbMImUZisFaA8pyrcIvYYebjOnk4TscwKFLedClRSX1XsMjWWd0oykQtrdkHM2IxknnBpaLu7mFnfE07f6dkG0nlpyu4SCLey7hr5FdcEmljA0nIxTSYDg6035fQkBEAbe7hlESOekkVNT9IZPwG+lmt3vU4ofi6NqNbJecOuSB+h36IiZ9s4YQtxYNnLgW14zjuFGGyT5smc3IjBT7qngDjKIgyrSVoRkY/8udy9qbUgvBeW8= - -before_script: -- go get github.com/mattn/goveralls -script: -- bash contrib/cover.sh $HOME/build coverage.out || travis_terminate 1 -- goveralls -service=travis-ci -coverprofile=coverage.out || true -- goveralls -coverprofile=coverage.out -service=travis-ci diff --git a/vendor/github.com/dgraph-io/badger/CHANGELOG.md b/vendor/github.com/dgraph-io/badger/CHANGELOG.md deleted file mode 100644 index 550b66e2..00000000 --- a/vendor/github.com/dgraph-io/badger/CHANGELOG.md +++ /dev/null @@ -1,100 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.5.3] - 2018-07-11 -Bug Fixes: -* Fix a panic caused due to item.vptr not copying over vs.Value, when looking - for a move key. - -## [1.5.2] - 2018-06-19 -Bug Fixes: -* Fix the way move key gets generated. -* If a transaction has unclosed, or multiple iterators running simultaneously, - throw a panic. Every iterator must be properly closed. At any point in time, - only one iterator per transaction can be running. This is to avoid bugs in a - transaction data structure which is thread unsafe. - -* *Warning: This change might cause panics in user code. Fix is to properly - close your iterators, and only have one running at a time per transaction.* - -## [1.5.1] - 2018-06-04 -Bug Fixes: -* Fix for infinite yieldItemValue recursion. #503 -* Fix recursive addition of `badgerMove` prefix. https://github.com/dgraph-io/badger/commit/2e3a32f0ccac3066fb4206b28deb39c210c5266f -* Use file size based window size for sampling, instead of fixing it to 10MB. #501 - -Cleanup: -* Clarify comments and documentation. -* Move badger tool one directory level up. - -## [1.5.0] - 2018-05-08 -* Introduce `NumVersionsToKeep` option. This option is used to discard many - versions of the same key, which saves space. -* Add a new `SetWithDiscard` method, which would indicate that all the older - versions of the key are now invalid. Those versions would be discarded during - compactions. -* Value log GC moves are now bound to another keyspace to ensure latest versions - of data are always at the top in LSM tree. -* Introduce `ValueLogMaxEntries` to restrict the number of key-value pairs per - value log file. This helps bound the time it takes to garbage collect one - file. - -## [1.4.0] - 2018-05-04 -* Make mmap-ing of value log optional. -* Run GC multiple times, based on recorded discard statistics. -* Add MergeOperator. -* Force compact L0 on clsoe (#439). -* Add truncate option to warn about data loss (#452). -* Discard key versions during compaction (#464). -* Introduce new `LSMOnlyOptions`, to make Badger act like a typical LSM based DB. - -Bug fix: -* (Temporary) Check max version across all tables in Get (removed in next - release). -* Update commit and read ts while loading from backup. -* Ensure all transaction entries are part of the same value log file. -* On commit, run unlock callbacks before doing writes (#413). -* Wait for goroutines to finish before closing iterators (#421). - -## [1.3.0] - 2017-12-12 -* Add `DB.NextSequence()` method to generate monotonically increasing integer - sequences. -* Add `DB.Size()` method to return the size of LSM and value log files. -* Tweaked mmap code to make Windows 32-bit builds work. -* Tweaked build tags on some files to make iOS builds work. -* Fix `DB.PurgeOlderVersions()` to not violate some constraints. - -## [1.2.0] - 2017-11-30 -* Expose a `Txn.SetEntry()` method to allow setting the key-value pair - and all the metadata at the same time. - -## [1.1.1] - 2017-11-28 -* Fix bug where txn.Get was returing key deleted in same transaction. -* Fix race condition while decrementing reference in oracle. -* Update doneCommit in the callback for CommitAsync. -* Iterator see writes of current txn. - -## [1.1.0] - 2017-11-13 -* Create Badger directory if it does not exist when `badger.Open` is called. -* Added `Item.ValueCopy()` to avoid deadlocks in long-running iterations -* Fixed 64-bit alignment issues to make Badger run on Arm v7 - -## [1.0.1] - 2017-11-06 -* Fix an uint16 overflow when resizing key slice - -[Unreleased]: https://github.com/dgraph-io/badger/compare/v1.5.3...HEAD -[1.5.3]: https://github.com/dgraph-io/badger/compare/v1.5.2...v1.5.3 -[1.5.2]: https://github.com/dgraph-io/badger/compare/v1.5.1...v1.5.2 -[1.5.1]: https://github.com/dgraph-io/badger/compare/v1.5.0...v1.5.1 -[1.5.0]: https://github.com/dgraph-io/badger/compare/v1.4.0...v1.5.0 -[1.4.0]: https://github.com/dgraph-io/badger/compare/v1.3.0...v1.4.0 -[1.3.0]: https://github.com/dgraph-io/badger/compare/v1.2.0...v1.3.0 -[1.2.0]: https://github.com/dgraph-io/badger/compare/v1.1.1...v1.2.0 -[1.1.1]: https://github.com/dgraph-io/badger/compare/v1.1.0...v1.1.1 -[1.1.0]: https://github.com/dgraph-io/badger/compare/v1.0.1...v1.1.0 -[1.0.1]: https://github.com/dgraph-io/badger/compare/v1.0.0...v1.0.1 diff --git a/vendor/github.com/dgraph-io/badger/CODE_OF_CONDUCT.md b/vendor/github.com/dgraph-io/badger/CODE_OF_CONDUCT.md deleted file mode 100644 index bf7bbc29..00000000 --- a/vendor/github.com/dgraph-io/badger/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,5 +0,0 @@ -# Code of Conduct - -Our Code of Conduct can be found here: - -https://dgraph.io/conduct diff --git a/vendor/github.com/dgraph-io/badger/LICENSE b/vendor/github.com/dgraph-io/badger/LICENSE deleted file mode 100644 index d9a10c0d..00000000 --- a/vendor/github.com/dgraph-io/badger/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/vendor/github.com/dgraph-io/badger/README.md b/vendor/github.com/dgraph-io/badger/README.md deleted file mode 100644 index a25d8e1f..00000000 --- a/vendor/github.com/dgraph-io/badger/README.md +++ /dev/null @@ -1,776 +0,0 @@ -# BadgerDB [![GoDoc](https://godoc.org/github.com/dgraph-io/badger?status.svg)](https://godoc.org/github.com/dgraph-io/badger) [![Go Report Card](https://goreportcard.com/badge/github.com/dgraph-io/badger)](https://goreportcard.com/report/github.com/dgraph-io/badger) [![Sourcegraph](https://sourcegraph.com/github.com/dgraph-io/badger/-/badge.svg)](https://sourcegraph.com/github.com/dgraph-io/badger?badge) [![Build Status](https://teamcity.dgraph.io/guestAuth/app/rest/builds/buildType:(id:Badger_UnitTests)/statusIcon.svg)](https://teamcity.dgraph.io/viewLog.html?buildTypeId=Badger_UnitTests&buildId=lastFinished&guest=1) ![Appveyor](https://ci.appveyor.com/api/projects/status/github/dgraph-io/badger?branch=master&svg=true) [![Coverage Status](https://coveralls.io/repos/github/dgraph-io/badger/badge.svg?branch=master)](https://coveralls.io/github/dgraph-io/badger?branch=master) - -![Badger mascot](images/diggy-shadow.png) - -BadgerDB is an embeddable, persistent and fast key-value (KV) database -written in pure Go. It's meant to be a performant alternative to non-Go-based -key-value stores like [RocksDB](https://github.com/facebook/rocksdb). - -## Project Status [Oct 27, 2018] - -Badger is stable and is being used to serve data sets worth hundreds of -terabytes. Badger supports concurrent ACID transactions with serializable -snapshot isolation (SSI) guarantees. A Jepsen-style bank test runs nightly for -8h, with `--race` flag and ensures maintainance of transactional guarantees. -Badger has also been tested to work with filesystem level anomalies, to ensure -persistence and consistency. - -Badger v1.0 was released in Nov 2017, with a Badger v2.0 release coming up in a -few months. The [Changelog] is kept fairly up-to-date. - -[Changelog]:https://github.com/dgraph-io/badger/blob/master/CHANGELOG.md - -## Table of Contents - * [Getting Started](#getting-started) - + [Installing](#installing) - + [Opening a database](#opening-a-database) - + [Transactions](#transactions) - - [Read-only transactions](#read-only-transactions) - - [Read-write transactions](#read-write-transactions) - - [Managing transactions manually](#managing-transactions-manually) - + [Using key/value pairs](#using-keyvalue-pairs) - + [Monotonically increasing integers](#monotonically-increasing-integers) - * [Merge Operations](#merge-operations) - + [Setting Time To Live(TTL) and User Metadata on Keys](#setting-time-to-livettl-and-user-metadata-on-keys) - + [Iterating over keys](#iterating-over-keys) - - [Prefix scans](#prefix-scans) - - [Key-only iteration](#key-only-iteration) - + [Stream](#stream) - + [Garbage Collection](#garbage-collection) - + [Database backup](#database-backup) - + [Memory usage](#memory-usage) - + [Statistics](#statistics) - * [Resources](#resources) - + [Blog Posts](#blog-posts) - * [Contact](#contact) - * [Design](#design) - + [Comparisons](#comparisons) - + [Benchmarks](#benchmarks) - * [Other Projects Using Badger](#other-projects-using-badger) - * [Frequently Asked Questions](#frequently-asked-questions) - -## Getting Started - -### Installing -To start using Badger, install Go 1.8 or above and run `go get`: - -```sh -$ go get github.com/dgraph-io/badger/... -``` - -This will retrieve the library and install the `badger` command line -utility into your `$GOBIN` path. - - -### Opening a database -The top-level object in Badger is a `DB`. It represents multiple files on disk -in specific directories, which contain the data for a single database. - -To open your database, use the `badger.Open()` function, with the appropriate -options. The `Dir` and `ValueDir` options are mandatory and must be -specified by the client. They can be set to the same value to simplify things. - -```go -package main - -import ( - "log" - - "github.com/dgraph-io/badger" -) - -func main() { - // Open the Badger database located in the /tmp/badger directory. - // It will be created if it doesn't exist. - opts := badger.DefaultOptions - opts.Dir = "/tmp/badger" - opts.ValueDir = "/tmp/badger" - db, err := badger.Open(opts) - if err != nil { - log.Fatal(err) - } - defer db.Close() -  // Your code here… -} -``` - -Please note that Badger obtains a lock on the directories so multiple processes -cannot open the same database at the same time. - -### Transactions - -#### Read-only transactions -To start a read-only transaction, you can use the `DB.View()` method: - -```go -err := db.View(func(txn *badger.Txn) error { -  // Your code here… -  return nil -}) -``` - -You cannot perform any writes or deletes within this transaction. Badger -ensures that you get a consistent view of the database within this closure. Any -writes that happen elsewhere after the transaction has started, will not be -seen by calls made within the closure. - -#### Read-write transactions -To start a read-write transaction, you can use the `DB.Update()` method: - -```go -err := db.Update(func(txn *badger.Txn) error { -  // Your code here… -  return nil -}) -``` - -All database operations are allowed inside a read-write transaction. - -Always check the returned error value. If you return an error -within your closure it will be passed through. - -An `ErrConflict` error will be reported in case of a conflict. Depending on the state -of your application, you have the option to retry the operation if you receive -this error. - -An `ErrTxnTooBig` will be reported in case the number of pending writes/deletes in -the transaction exceed a certain limit. In that case, it is best to commit the -transaction and start a new transaction immediately. Here is an example (we are -not checking for errors in some places for simplicity): - -```go -updates := make(map[string]string) -txn := db.NewTransaction(true) -for k,v := range updates { - if err := txn.Set([]byte(k),[]byte(v)); err == ErrTxnTooBig { - _ = txn.Commit() - txn = db.NewTransaction(true) - _ = txn.Set([]byte(k),[]byte(v)) - } -} -_ = txn.Commit() -``` - -#### Managing transactions manually -The `DB.View()` and `DB.Update()` methods are wrappers around the -`DB.NewTransaction()` and `Txn.Commit()` methods (or `Txn.Discard()` in case of -read-only transactions). These helper methods will start the transaction, -execute a function, and then safely discard your transaction if an error is -returned. This is the recommended way to use Badger transactions. - -However, sometimes you may want to manually create and commit your -transactions. You can use the `DB.NewTransaction()` function directly, which -takes in a boolean argument to specify whether a read-write transaction is -required. For read-write transactions, it is necessary to call `Txn.Commit()` -to ensure the transaction is committed. For read-only transactions, calling -`Txn.Discard()` is sufficient. `Txn.Commit()` also calls `Txn.Discard()` -internally to cleanup the transaction, so just calling `Txn.Commit()` is -sufficient for read-write transaction. However, if your code doesn’t call -`Txn.Commit()` for some reason (for e.g it returns prematurely with an error), -then please make sure you call `Txn.Discard()` in a `defer` block. Refer to the -code below. - -```go -// Start a writable transaction. -txn := db.NewTransaction(true) -defer txn.Discard() - -// Use the transaction... -err := txn.Set([]byte("answer"), []byte("42")) -if err != nil { - return err -} - -// Commit the transaction and check for error. -if err := txn.Commit(); err != nil { - return err -} -``` - -The first argument to `DB.NewTransaction()` is a boolean stating if the transaction -should be writable. - -Badger allows an optional callback to the `Txn.Commit()` method. Normally, the -callback can be set to `nil`, and the method will return after all the writes -have succeeded. However, if this callback is provided, the `Txn.Commit()` -method returns as soon as it has checked for any conflicts. The actual writing -to the disk happens asynchronously, and the callback is invoked once the -writing has finished, or an error has occurred. This can improve the throughput -of the application in some cases. But it also means that a transaction is not -durable until the callback has been invoked with a `nil` error value. - -### Using key/value pairs -To save a key/value pair, use the `Txn.Set()` method: - -```go -err := db.Update(func(txn *badger.Txn) error { - err := txn.Set([]byte("answer"), []byte("42")) - return err -}) -``` - -This will set the value of the `"answer"` key to `"42"`. To retrieve this -value, we can use the `Txn.Get()` method: - -```go -err := db.View(func(txn *badger.Txn) error { - item, err := txn.Get([]byte("answer")) - handle(err) - - var valNot, valCopy []byte - err := item.Value(func(val []byte) error { - // This func with val would only be called if item.Value encounters no error. - - // Accessing val here is valid. - fmt.Printf("The answer is: %s\n", val) - - // Copying or parsing val is valid. - valCopy = append([]byte{}, val...) - - // Assigning val slice to another variable is NOT OK. - valNot = val // Do not do this. - return nil - }) - handle(err) - - // DO NOT access val here. It is the most common cause of bugs. - fmt.Printf("NEVER do this. %s\n", valNot) - - // You must copy it to use it outside item.Value(...). - fmt.Printf("The answer is: %s\n", valCopy) - - // Alternatively, you could also use item.ValueCopy(). - valCopy, err = item.ValueCopy(nil) - handle(err) - fmt.Printf("The answer is: %s\n", valCopy) - - return nil -}) -``` - -`Txn.Get()` returns `ErrKeyNotFound` if the value is not found. - -Please note that values returned from `Get()` are only valid while the -transaction is open. If you need to use a value outside of the transaction -then you must use `copy()` to copy it to another byte slice. - -Use the `Txn.Delete()` method to delete a key. - -### Monotonically increasing integers - -To get unique monotonically increasing integers with strong durability, you can -use the `DB.GetSequence` method. This method returns a `Sequence` object, which -is thread-safe and can be used concurrently via various goroutines. - -Badger would lease a range of integers to hand out from memory, with the -bandwidth provided to `DB.GetSequence`. The frequency at which disk writes are -done is determined by this lease bandwidth and the frequency of `Next` -invocations. Setting a bandwith too low would do more disk writes, setting it -too high would result in wasted integers if Badger is closed or crashes. -To avoid wasted integers, call `Release` before closing Badger. - -```go -seq, err := db.GetSequence(key, 1000) -defer seq.Release() -for { - num, err := seq.Next() -} -``` - -### Merge Operations -Badger provides support for unordered merge operations. You can define a func -of type `MergeFunc` which takes in an existing value, and a value to be -_merged_ with it. It returns a new value which is the result of the _merge_ -operation. All values are specified in byte arrays. For e.g., here is a merge -function (`add`) which adds a `uint64` value to an existing `uint64` value. - -```Go -func uint64ToBytes(i uint64) []byte { - var buf [8]byte - binary.BigEndian.PutUint64(buf[:], i) - return buf[:] -} - -func bytesToUint64(b []byte) uint64 { - return binary.BigEndian.Uint64(b) -} - -// Merge function to add two uint64 numbers -func add(existing, new []byte) []byte { - return uint64ToBytes(bytesToUint64(existing) + bytesToUint64(new)) -} -``` - -This function can then be passed to the `DB.GetMergeOperator()` method, along -with a key, and a duration value. The duration specifies how often the merge -function is run on values that have been added using the `MergeOperator.Add()` -method. - -`MergeOperator.Get()` method can be used to retrieve the cumulative value of the key -associated with the merge operation. - -```Go -key := []byte("merge") -m := db.GetMergeOperator(key, add, 200*time.Millisecond) -defer m.Stop() - -m.Add(uint64ToBytes(1)) -m.Add(uint64ToBytes(2)) -m.Add(uint64ToBytes(3)) - -res, err := m.Get() // res should have value 6 encoded -fmt.Println(bytesToUint64(res)) -``` - -### Setting Time To Live(TTL) and User Metadata on Keys -Badger allows setting an optional Time to Live (TTL) value on keys. Once the TTL has -elapsed, the key will no longer be retrievable and will be eligible for garbage -collection. A TTL can be set as a `time.Duration` value using the `Txn.SetWithTTL()` -API method. - -An optional user metadata value can be set on each key. A user metadata value -is represented by a single byte. It can be used to set certain bits along -with the key to aid in interpreting or decoding the key-value pair. User -metadata can be set using the `Txn.SetWithMeta()` API method. - -`Txn.SetEntry()` can be used to set the key, value, user metatadata and TTL, -all at once. - -### Iterating over keys -To iterate over keys, we can use an `Iterator`, which can be obtained using the -`Txn.NewIterator()` method. Iteration happens in byte-wise lexicographical sorting -order. - - -```go -err := db.View(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.PrefetchSize = 10 - it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.Valid(); it.Next() { - item := it.Item() - k := item.Key() - err := item.Value(func(v []byte) error { - fmt.Printf("key=%s, value=%s\n", k, v) - return nil - }) - if err != nil { - return err - } - } - return nil -}) -``` - -The iterator allows you to move to a specific point in the list of keys and move -forward or backward through the keys one at a time. - -By default, Badger prefetches the values of the next 100 items. You can adjust -that with the `IteratorOptions.PrefetchSize` field. However, setting it to -a value higher than GOMAXPROCS (which we recommend to be 128 or higher) -shouldn’t give any additional benefits. You can also turn off the fetching of -values altogether. See section below on key-only iteration. - -#### Prefix scans -To iterate over a key prefix, you can combine `Seek()` and `ValidForPrefix()`: - -```go -db.View(func(txn *badger.Txn) error { - it := txn.NewIterator(badger.DefaultIteratorOptions) - defer it.Close() - prefix := []byte("1234") - for it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() { - item := it.Item() - k := item.Key() - err := item.Value(func(v []byte) error { - fmt.Printf("key=%s, value=%s\n", k, v) - return nil - }) - if err != nil { - return err - } - } - return nil -}) -``` - -#### Key-only iteration -Badger supports a unique mode of iteration called _key-only_ iteration. It is -several order of magnitudes faster than regular iteration, because it involves -access to the LSM-tree only, which is usually resident entirely in RAM. To -enable key-only iteration, you need to set the `IteratorOptions.PrefetchValues` -field to `false`. This can also be used to do sparse reads for selected keys -during an iteration, by calling `item.Value()` only when required. - -```go -err := db.View(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.PrefetchValues = false - it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.Valid(); it.Next() { - item := it.Item() - k := item.Key() - fmt.Printf("key=%s\n", k) - } - return nil -}) -``` - -### Stream -Badger provides a Stream framework, which concurrently iterates over all or a -portion of the DB, converting data into custom key-values, and streams it out -serially to be sent over network, written to disk, or even written back to -Badger. This is a lot faster way to iterate over Badger than using a single -Iterator. Stream supports Badger in both managed and normal mode. - -Stream uses the natural boundaries created by SSTables within the LSM tree, to -quickly generate key ranges. Each goroutine then picks a range and runs an -iterator to iterate over it. Each iterator iterates over all versions of values -and is created from the same transaction, thus working over a snapshot of the -DB. Every time a new key is encountered, it calls `ChooseKey(item)`, followed -by `KeyToList(key, itr)`. This allows a user to select or reject that key, and -if selected, convert the value versions into custom key-values. The goroutine -batches up 4MB worth of key-values, before sending it over to a channel. -Another goroutine further batches up data from this channel using *smart -batching* algorithm and calls `Send` serially. - -This framework is designed for high throughput key-value iteration, spreading -the work of iteration across many goroutines. `DB.Backup` uses this framework to -provide full and incremental backups quickly. Dgraph is a heavy user of this -framework. In fact, this framework was developed and used within Dgraph, before -getting ported over to Badger. - -```go -stream := db.NewStream() -// db.NewStreamAt(readTs) for managed mode. - -// -- Optional settings -stream.NumGo = 16 // Set number of goroutines to use for iteration. -stream.Prefix = []byte("some-prefix") // Leave nil for iteration over the whole DB. -stream.LogPrefix = "Badger.Streaming" // For identifying stream logs. Outputs to Logger. - -// ChooseKey is called concurrently for every key. If left nil, assumes true by default. -stream.ChooseKey = func(item *badger.Item) bool { - return bytes.HasSuffix(item.Key(), []byte("er")) -} - -// KeyToList is called concurrently for chosen keys. This can be used to convert -// Badger data into custom key-values. If nil, uses stream.ToList, a default -// implementation, which picks all valid key-values. -stream.KeyToList = nil - -// -- End of optional settings. - -// Send is called serially, while Stream.Orchestrate is running. -stream.Send = func(list *pb.KVList) error { - return proto.MarshalText(w, list) // Write to w. -} - -// Run the stream -if err := stream.Orchestrate(context.Background()); err != nil { - return err -} -// Done. -``` - -### Garbage Collection -Badger values need to be garbage collected, because of two reasons: - -* Badger keeps values separately from the LSM tree. This means that the compaction operations -that clean up the LSM tree do not touch the values at all. Values need to be cleaned up -separately. - -* Concurrent read/write transactions could leave behind multiple values for a single key, because they -are stored with different versions. These could accumulate, and take up unneeded space beyond the -time these older versions are needed. - -Badger relies on the client to perform garbage collection at a time of their choosing. It provides -the following method, which can be invoked at an appropriate time: - -* `DB.RunValueLogGC()`: This method is designed to do garbage collection while - Badger is online. Along with randomly picking a file, it uses statistics generated by the - LSM-tree compactions to pick files that are likely to lead to maximum space - reclamation. It is recommended to be called during periods of low activity in - your system, or periodically. One call would only result in removal of at max - one log file. As an optimization, you could also immediately re-run it whenever - it returns nil error (indicating a successful value log GC), as shown below. - - ```go - ticker := time.NewTicker(5 * time.Minute) - defer ticker.Stop() - for range ticker.C { - again: - err := db.RunValueLogGC(0.7) - if err == nil { - goto again - } - } - ``` - -* `DB.PurgeOlderVersions()`: This method is **DEPRECATED** since v1.5.0. Now, Badger's LSM tree automatically discards older/invalid versions of keys. - -**Note: The RunValueLogGC method would not garbage collect the latest value log.** - -### Database backup -There are two public API methods `DB.Backup()` and `DB.Load()` which can be -used to do online backups and restores. Badger v0.9 provides a CLI tool -`badger`, which can do offline backup/restore. Make sure you have `$GOPATH/bin` -in your PATH to use this tool. - -The command below will create a version-agnostic backup of the database, to a -file `badger.bak` in the current working directory - -``` -badger backup --dir -``` - -To restore `badger.bak` in the current working directory to a new database: - -``` -badger restore --dir -``` - -See `badger --help` for more details. - -If you have a Badger database that was created using v0.8 (or below), you can -use the `badger_backup` tool provided in v0.8.1, and then restore it using the -command above to upgrade your database to work with the latest version. - -``` -badger_backup --dir --backup-file badger.bak -``` - -We recommend all users to use the `Backup` and `Restore` APIs and tools. However, -Badger is also rsync-friendly because all files are immutable, barring the -latest value log which is append-only. So, rsync can be used as rudimentary way -to perform a backup. In the following script, we repeat rsync to ensure that the -LSM tree remains consistent with the MANIFEST file while doing a full backup. - -``` -#!/bin/bash -set -o history -set -o histexpand -# Makes a complete copy of a Badger database directory. -# Repeat rsync if the MANIFEST and SSTables are updated. -rsync -avz --delete db/ dst -while !! | grep -q "(MANIFEST\|\.sst)$"; do :; done -``` - -### Memory usage -Badger's memory usage can be managed by tweaking several options available in -the `Options` struct that is passed in when opening the database using -`DB.Open`. - -- `Options.ValueLogLoadingMode` can be set to `options.FileIO` (instead of the - default `options.MemoryMap`) to avoid memory-mapping log files. This can be - useful in environments with low RAM. -- Number of memtables (`Options.NumMemtables`) - - If you modify `Options.NumMemtables`, also adjust `Options.NumLevelZeroTables` and - `Options.NumLevelZeroTablesStall` accordingly. -- Number of concurrent compactions (`Options.NumCompactors`) -- Mode in which LSM tree is loaded (`Options.TableLoadingMode`) -- Size of table (`Options.MaxTableSize`) -- Size of value log file (`Options.ValueLogFileSize`) - -If you want to decrease the memory usage of Badger instance, tweak these -options (ideally one at a time) until you achieve the desired -memory usage. - -### Statistics -Badger records metrics using the [expvar] package, which is included in the Go -standard library. All the metrics are documented in [y/metrics.go][metrics] -file. - -`expvar` package adds a handler in to the default HTTP server (which has to be -started explicitly), and serves up the metrics at the `/debug/vars` endpoint. -These metrics can then be collected by a system like [Prometheus], to get -better visibility into what Badger is doing. - -[expvar]: https://golang.org/pkg/expvar/ -[metrics]: https://github.com/dgraph-io/badger/blob/master/y/metrics.go -[Prometheus]: https://prometheus.io/ - -## Resources - -### Blog Posts -1. [Introducing Badger: A fast key-value store written natively in -Go](https://open.dgraph.io/post/badger/) -2. [Make Badger crash resilient with ALICE](https://blog.dgraph.io/post/alice/) -3. [Badger vs LMDB vs BoltDB: Benchmarking key-value databases in Go](https://blog.dgraph.io/post/badger-lmdb-boltdb/) -4. [Concurrent ACID Transactions in Badger](https://blog.dgraph.io/post/badger-txn/) - -## Design -Badger was written with these design goals in mind: - -- Write a key-value database in pure Go. -- Use latest research to build the fastest KV database for data sets spanning terabytes. -- Optimize for SSDs. - -Badger’s design is based on a paper titled _[WiscKey: Separating Keys from -Values in SSD-conscious Storage][wisckey]_. - -[wisckey]: https://www.usenix.org/system/files/conference/fast16/fast16-papers-lu.pdf - -### Comparisons -| Feature | Badger | RocksDB | BoltDB | -| ------- | ------ | ------- | ------ | -| Design | LSM tree with value log | LSM tree only | B+ tree | -| High Read throughput | Yes | No | Yes | -| High Write throughput | Yes | Yes | No | -| Designed for SSDs | Yes (with latest research 1) | Not specifically 2 | No | -| Embeddable | Yes | Yes | Yes | -| Sorted KV access | Yes | Yes | Yes | -| Pure Go (no Cgo) | Yes | No | Yes | -| Transactions | Yes, ACID, concurrent with SSI3 | Yes (but non-ACID) | Yes, ACID | -| Snapshots | Yes | Yes | Yes | -| TTL support | Yes | Yes | No | -| 3D access (key-value-version) | Yes4 | No | No | - -1 The [WISCKEY paper][wisckey] (on which Badger is based) saw big -wins with separating values from keys, significantly reducing the write -amplification compared to a typical LSM tree. - -2 RocksDB is an SSD optimized version of LevelDB, which was designed specifically for rotating disks. -As such RocksDB's design isn't aimed at SSDs. - -3 SSI: Serializable Snapshot Isolation. For more details, see the blog post [Concurrent ACID Transactions in Badger](https://blog.dgraph.io/post/badger-txn/) - -4 Badger provides direct access to value versions via its Iterator API. -Users can also specify how many versions to keep per key via Options. - -### Benchmarks -We have run comprehensive benchmarks against RocksDB, Bolt and LMDB. The -benchmarking code, and the detailed logs for the benchmarks can be found in the -[badger-bench] repo. More explanation, including graphs can be found the blog posts (linked -above). - -[badger-bench]: https://github.com/dgraph-io/badger-bench - -## Other Projects Using Badger -Below is a list of known projects that use Badger: - -* [0-stor](https://github.com/zero-os/0-stor) - Single device object store. -* [Dgraph](https://github.com/dgraph-io/dgraph) - Distributed graph database. -* [Dispatch Protocol](https://github.com/dispatchlabs/disgo) - Blockchain protocol for distributed application data analytics. -* [Sandglass](https://github.com/celrenheit/sandglass) - distributed, horizontally scalable, persistent, time sorted message queue. -* [Usenet Express](https://usenetexpress.com/) - Serving over 300TB of data with Badger. -* [go-ipfs](https://github.com/ipfs/go-ipfs) - Go client for the InterPlanetary File System (IPFS), a new hypermedia distribution protocol. -* [gorush](https://github.com/appleboy/gorush) - A push notification server written in Go. -* [emitter](https://github.com/emitter-io/emitter) - Scalable, low latency, distributed pub/sub broker with message storage, uses MQTT, gossip and badger. -* [GarageMQ](https://github.com/valinurovam/garagemq) - AMQP server written in Go. -* [RedixDB](https://alash3al.github.io/redix/) - A real-time persistent key-value store with the same redis protocol. -* [BBVA](https://github.com/BBVA/raft-badger) - Raft backend implementation using BadgerDB for Hashicorp raft. -* [Riot](https://github.com/go-ego/riot) - An open-source, distributed search engine. -* [Fantom](https://github.com/Fantom-foundation/go-lachesis) - aBFT Consensus platform for distributed applications. -* [decred](https://github.com/decred/dcrdata) - An open, progressive, and self-funding cryptocurrency with a system of community-based governance integrated into its blockchain. -* [OpenNetSys](https://github.com/opennetsys/c3-go) - Create useful dApps in any software language. -* [HoneyTrap](https://github.com/honeytrap/honeytrap) - An extensible and opensource system for running, monitoring and managing honeypots. -* [Insolar](https://github.com/insolar/insolar) - Enterprise-ready blockchain platform. -* [IoTeX](https://github.com/iotexproject/iotex-core) - The next generation of the decentralized network for IoT powered by scalability- and privacy-centric blockchains. -* [go-sessions](https://github.com/kataras/go-sessions) - The sessions manager for Go net/http and fasthttp. -* [Babble](https://github.com/mosaicnetworks/babble) - BFT Consensus platform for distributed applications. -* [Tormenta](https://github.com/jpincas/tormenta) - Embedded object-persistence layer / simple JSON database for Go projects. -* [BadgerHold](https://github.com/timshannon/badgerhold) - An embeddable NoSQL store for querying Go types built on Badger -* [Goblero](https://github.com/didil/goblero) - Pure Go embedded persistent job queue backed by BadgerDB -* [Surfline](https://www.surfline.com) - Serving global wave and weather forecast data with Badger. -* [Cete](https://github.com/mosuka/cete) - Simple and highly available distributed key-value store built on Badger. Makes it easy bringing up a cluster of Badger with Raft consensus algorithm by hashicorp/raft. - -If you are using Badger in a project please send a pull request to add it to the list. - -## Frequently Asked Questions -- **My writes are getting stuck. Why?** - -**Update: With the new `Value(func(v []byte))` API, this deadlock can no longer -happen.** - -The following is true for users on Badger v1.x. - -This can happen if a long running iteration with `Prefetch` is set to false, but -a `Item::Value` call is made internally in the loop. That causes Badger to -acquire read locks over the value log files to avoid value log GC removing the -file from underneath. As a side effect, this also blocks a new value log GC -file from being created, when the value log file boundary is hit. - -Please see Github issues [#293](https://github.com/dgraph-io/badger/issues/293) -and [#315](https://github.com/dgraph-io/badger/issues/315). - -There are multiple workarounds during iteration: - -1. Use `Item::ValueCopy` instead of `Item::Value` when retrieving value. -1. Set `Prefetch` to true. Badger would then copy over the value and release the - file lock immediately. -1. When `Prefetch` is false, don't call `Item::Value` and do a pure key-only - iteration. This might be useful if you just want to delete a lot of keys. -1. Do the writes in a separate transaction after the reads. - -- **My writes are really slow. Why?** - -Are you creating a new transaction for every single key update, and waiting for -it to `Commit` fully before creating a new one? This will lead to very low -throughput. - -We have created `WriteBatch` API which provides a way to batch up -many updates into a single transaction and `Commit` that transaction using -callbacks to avoid blocking. This amortizes the cost of a transaction really -well, and provides the most efficient way to do bulk writes. - -```go -wb := db.NewWriteBatch() -defer wb.Cancel() - -for i := 0; i < N; i++ { - err := wb.Set(key(i), value(i), 0) // Will create txns as needed. - handle(err) -} -handle(wb.Flush()) // Wait for all txns to finish. -``` - -Note that `WriteBatch` API does not allow any reads. For read-modify-write -workloads, you should be using the `Transaction` API. - -- **I don't see any disk write. Why?** - -If you're using Badger with `SyncWrites=false`, then your writes might not be written to value log -and won't get synced to disk immediately. Writes to LSM tree are done inmemory first, before they -get compacted to disk. The compaction would only happen once `MaxTableSize` has been reached. So, if -you're doing a few writes and then checking, you might not see anything on disk. Once you `Close` -the database, you'll see these writes on disk. - -- **Reverse iteration doesn't give me the right results.** - -Just like forward iteration goes to the first key which is equal or greater than the SEEK key, reverse iteration goes to the first key which is equal or lesser than the SEEK key. Therefore, SEEK key would not be part of the results. You can typically add a `0xff` byte as a suffix to the SEEK key to include it in the results. See the following issues: [#436](https://github.com/dgraph-io/badger/issues/436) and [#347](https://github.com/dgraph-io/badger/issues/347). - -- **Which instances should I use for Badger?** - -We recommend using instances which provide local SSD storage, without any limit -on the maximum IOPS. In AWS, these are storage optimized instances like i3. They -provide local SSDs which clock 100K IOPS over 4KB blocks easily. - -- **I'm getting a closed channel error. Why?** - -``` -panic: close of closed channel -panic: send on closed channel -``` - -If you're seeing panics like above, this would be because you're operating on a closed DB. This can happen, if you call `Close()` before sending a write, or multiple times. You should ensure that you only call `Close()` once, and all your read/write operations finish before closing. - -- **Are there any Go specific settings that I should use?** - -We *highly* recommend setting a high number for GOMAXPROCS, which allows Go to -observe the full IOPS throughput provided by modern SSDs. In Dgraph, we have set -it to 128. For more details, [see this -thread](https://groups.google.com/d/topic/golang-nuts/jPb_h3TvlKE/discussion). - -- **Are there any linux specific settings that I should use?** - -We recommend setting max file descriptors to a high number depending upon the expected size of you data. - -## Contact -- Please use [discuss.dgraph.io](https://discuss.dgraph.io) for questions, feature requests and discussions. -- Please use [Github issue tracker](https://github.com/dgraph-io/badger/issues) for filing bugs or feature requests. -- Join [![Slack Status](http://slack.dgraph.io/badge.svg)](http://slack.dgraph.io). -- Follow us on Twitter [@dgraphlabs](https://twitter.com/dgraphlabs). - diff --git a/vendor/github.com/dgraph-io/badger/appveyor.yml b/vendor/github.com/dgraph-io/badger/appveyor.yml deleted file mode 100644 index 79dac338..00000000 --- a/vendor/github.com/dgraph-io/badger/appveyor.yml +++ /dev/null @@ -1,48 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -# Platform. -platform: x64 - -clone_folder: c:\gopath\src\github.com\dgraph-io\badger - -# Environment variables -environment: - GOVERSION: 1.8.3 - GOPATH: c:\gopath - -# scripts that run after cloning repository -install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - - go version - - go env - - python --version - -# To run your custom scripts instead of automatic MSBuild -build_script: - # We need to disable firewall - https://github.com/appveyor/ci/issues/1579#issuecomment-309830648 - - ps: Disable-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-Out)' - - cd c:\gopath\src\github.com\dgraph-io\badger - - git branch - - go get -t ./... - -# To run your custom scripts instead of automatic tests -test_script: - # Unit tests - - ps: Add-AppveyorTest "Unit Tests" -Outcome Running - - go test -v github.com/dgraph-io/badger/... - - go test -v -vlog_mmap=false github.com/dgraph-io/badger/... - - ps: Update-AppveyorTest "Unit Tests" -Outcome Passed - -notifications: - - provider: Email - to: - - pawan@dgraph.io - on_build_failure: true - on_build_status_changed: true -# to disable deployment -deploy: off - diff --git a/vendor/github.com/dgraph-io/badger/backup.go b/vendor/github.com/dgraph-io/badger/backup.go deleted file mode 100644 index 0bc3b328..00000000 --- a/vendor/github.com/dgraph-io/badger/backup.go +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bufio" - "bytes" - "context" - "encoding/binary" - "io" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/y" -) - -// Backup is a wrapper function over Stream.Backup to generate full and incremental backups of the -// DB. For more control over how many goroutines are used to generate the backup, or if you wish to -// backup only a certain range of keys, use Stream.Backup directly. -func (db *DB) Backup(w io.Writer, since uint64) (uint64, error) { - stream := db.NewStream() - stream.LogPrefix = "DB.Backup" - return stream.Backup(w, since) -} - -// Backup dumps a protobuf-encoded list of all entries in the database into the -// given writer, that are newer than the specified version. It returns a -// timestamp indicating when the entries were dumped which can be passed into a -// later invocation to generate an incremental dump, of entries that have been -// added/modified since the last invocation of Stream.Backup(). -// -// This can be used to backup the data in a database at a given point in time. -func (stream *Stream) Backup(w io.Writer, since uint64) (uint64, error) { - stream.KeyToList = func(key []byte, itr *Iterator) (*pb.KVList, error) { - list := &pb.KVList{} - for ; itr.Valid(); itr.Next() { - item := itr.Item() - if !bytes.Equal(item.Key(), key) { - return list, nil - } - if item.Version() < since { - // Ignore versions less than given timestamp, or skip older - // versions of the given key. - return list, nil - } - - var valCopy []byte - if !item.IsDeletedOrExpired() { - // No need to copy value, if item is deleted or expired. - var err error - valCopy, err = item.ValueCopy(nil) - if err != nil { - stream.db.opt.Errorf("Key [%x, %d]. Error while fetching value [%v]\n", - item.Key(), item.Version(), err) - return nil, err - } - } - - // clear txn bits - meta := item.meta &^ (bitTxn | bitFinTxn) - kv := &pb.KV{ - Key: item.KeyCopy(nil), - Value: valCopy, - UserMeta: []byte{item.UserMeta()}, - Version: item.Version(), - ExpiresAt: item.ExpiresAt(), - Meta: []byte{meta}, - } - list.Kv = append(list.Kv, kv) - - switch { - case item.DiscardEarlierVersions(): - // If we need to discard earlier versions of this item, add a delete - // marker just below the current version. - list.Kv = append(list.Kv, &pb.KV{ - Key: item.KeyCopy(nil), - Version: item.Version() - 1, - Meta: []byte{bitDelete}, - }) - return list, nil - - case item.IsDeletedOrExpired(): - return list, nil - } - } - return list, nil - } - - var maxVersion uint64 - stream.Send = func(list *pb.KVList) error { - for _, kv := range list.Kv { - if maxVersion < kv.Version { - maxVersion = kv.Version - } - } - return writeTo(list, w) - } - - if err := stream.Orchestrate(context.Background()); err != nil { - return 0, err - } - return maxVersion, nil -} - -func writeTo(list *pb.KVList, w io.Writer) error { - if err := binary.Write(w, binary.LittleEndian, uint64(list.Size())); err != nil { - return err - } - buf, err := list.Marshal() - if err != nil { - return err - } - _, err = w.Write(buf) - return err -} - -type loader struct { - db *DB - throttle *y.Throttle - entries []*Entry -} - -func (db *DB) newLoader(maxPendingWrites int) *loader { - return &loader{ - db: db, - throttle: y.NewThrottle(maxPendingWrites), - } -} - -func (l *loader) set(kv *pb.KV) error { - var userMeta, meta byte - if len(kv.UserMeta) > 0 { - userMeta = kv.UserMeta[0] - } - if len(kv.Meta) > 0 { - meta = kv.Meta[0] - } - - l.entries = append(l.entries, &Entry{ - Key: y.KeyWithTs(kv.Key, kv.Version), - Value: kv.Value, - UserMeta: userMeta, - ExpiresAt: kv.ExpiresAt, - meta: meta, - }) - if len(l.entries) >= 1000 { - return l.send() - } - return nil -} - -func (l *loader) send() error { - if err := l.throttle.Do(); err != nil { - return err - } - l.db.batchSetAsync(l.entries, func(err error) { - l.throttle.Done(err) - }) - - l.entries = make([]*Entry, 0, 1000) - return nil -} - -func (l *loader) finish() error { - if len(l.entries) > 0 { - if err := l.send(); err != nil { - return err - } - } - return l.throttle.Finish() -} - -// Load reads a protobuf-encoded list of all entries from a reader and writes -// them to the database. This can be used to restore the database from a backup -// made by calling DB.Backup(). -// -// DB.Load() should be called on a database that is not running any other -// concurrent transactions while it is running. -func (db *DB) Load(r io.Reader, maxPendingWrites int) error { - br := bufio.NewReaderSize(r, 16<<10) - unmarshalBuf := make([]byte, 1<<10) - - ldr := db.newLoader(maxPendingWrites) - for { - var sz uint64 - err := binary.Read(br, binary.LittleEndian, &sz) - if err == io.EOF { - break - } else if err != nil { - return err - } - - if cap(unmarshalBuf) < int(sz) { - unmarshalBuf = make([]byte, sz) - } - - if _, err = io.ReadFull(br, unmarshalBuf[:sz]); err != nil { - return err - } - - list := &pb.KVList{} - if err := list.Unmarshal(unmarshalBuf[:sz]); err != nil { - return err - } - - for _, kv := range list.Kv { - if err := ldr.set(kv); err != nil { - return err - } - - // Update nextTxnTs, memtable stores this - // timestamp in badger head when flushed. - if kv.Version >= db.orc.nextTxnTs { - db.orc.nextTxnTs = kv.Version + 1 - } - } - } - - if err := ldr.finish(); err != nil { - return err - } - db.orc.txnMark.Done(db.orc.nextTxnTs - 1) - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/batch.go b/vendor/github.com/dgraph-io/badger/batch.go deleted file mode 100644 index bfbc239b..00000000 --- a/vendor/github.com/dgraph-io/badger/batch.go +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2018 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "sync" - "time" - - "github.com/dgraph-io/badger/y" -) - -// WriteBatch holds the necessary info to perform batched writes. -type WriteBatch struct { - sync.Mutex - txn *Txn - db *DB - throttle *y.Throttle - err error -} - -// NewWriteBatch creates a new WriteBatch. This provides a way to conveniently do a lot of writes, -// batching them up as tightly as possible in a single transaction and using callbacks to avoid -// waiting for them to commit, thus achieving good performance. This API hides away the logic of -// creating and committing transactions. Due to the nature of SSI guaratees provided by Badger, -// blind writes can never encounter transaction conflicts (ErrConflict). -func (db *DB) NewWriteBatch() *WriteBatch { - return &WriteBatch{ - db: db, - txn: db.newTransaction(true, true), - throttle: y.NewThrottle(16), - } -} - -// SetMaxPendingTxns sets a limit on maximum number of pending transactions while writing batches. -// This function should be called before using WriteBatch. Default value of MaxPendingTxns is -// 16 to minimise memory usage. -func (wb *WriteBatch) SetMaxPendingTxns(max int) { - wb.throttle = y.NewThrottle(max) -} - -// Cancel function must be called if there's a chance that Flush might not get -// called. If neither Flush or Cancel is called, the transaction oracle would -// never get a chance to clear out the row commit timestamp map, thus causing an -// unbounded memory consumption. Typically, you can call Cancel as a defer -// statement right after NewWriteBatch is called. -// -// Note that any committed writes would still go through despite calling Cancel. -func (wb *WriteBatch) Cancel() { - if err := wb.throttle.Finish(); err != nil { - wb.db.opt.Errorf("WatchBatch.Cancel error while finishing: %v", err) - } - wb.txn.Discard() -} - -func (wb *WriteBatch) callback(err error) { - // sync.WaitGroup is thread-safe, so it doesn't need to be run inside wb.Lock. - defer wb.throttle.Done(err) - if err == nil { - return - } - - wb.Lock() - defer wb.Unlock() - if wb.err != nil { - return - } - wb.err = err -} - -// SetEntry is the equivalent of Txn.SetEntry. -func (wb *WriteBatch) SetEntry(e *Entry) error { - wb.Lock() - defer wb.Unlock() - - if err := wb.txn.SetEntry(e); err != ErrTxnTooBig { - return err - } - // Txn has reached it's zenith. Commit now. - if cerr := wb.commit(); cerr != nil { - return cerr - } - // This time the error must not be ErrTxnTooBig, otherwise, we make the - // error permanent. - if err := wb.txn.SetEntry(e); err != nil { - wb.err = err - return err - } - return nil -} - -// Set is equivalent of Txn.SetWithMeta. -func (wb *WriteBatch) Set(k, v []byte, meta byte) error { - e := &Entry{Key: k, Value: v, UserMeta: meta} - return wb.SetEntry(e) -} - -// SetWithTTL is equivalent of Txn.SetWithTTL. -func (wb *WriteBatch) SetWithTTL(key, val []byte, dur time.Duration) error { - expire := time.Now().Add(dur).Unix() - e := &Entry{Key: key, Value: val, ExpiresAt: uint64(expire)} - return wb.SetEntry(e) -} - -// Delete is equivalent of Txn.Delete. -func (wb *WriteBatch) Delete(k []byte) error { - wb.Lock() - defer wb.Unlock() - - if err := wb.txn.Delete(k); err != ErrTxnTooBig { - return err - } - if err := wb.commit(); err != nil { - return err - } - if err := wb.txn.Delete(k); err != nil { - wb.err = err - return err - } - return nil -} - -// Caller to commit must hold a write lock. -func (wb *WriteBatch) commit() error { - if wb.err != nil { - return wb.err - } - if err := wb.throttle.Do(); err != nil { - return err - } - wb.txn.CommitWith(wb.callback) - wb.txn = wb.db.newTransaction(true, true) - wb.txn.readTs = 0 // We're not reading anything. - return wb.err -} - -// Flush must be called at the end to ensure that any pending writes get committed to Badger. Flush -// returns any error stored by WriteBatch. -func (wb *WriteBatch) Flush() error { - wb.Lock() - _ = wb.commit() - wb.txn.Discard() - wb.Unlock() - - if err := wb.throttle.Finish(); err != nil { - return err - } - - return wb.err -} - -// Error returns any errors encountered so far. No commits would be run once an error is detected. -func (wb *WriteBatch) Error() error { - wb.Lock() - defer wb.Unlock() - return wb.err -} diff --git a/vendor/github.com/dgraph-io/badger/compaction.go b/vendor/github.com/dgraph-io/badger/compaction.go deleted file mode 100644 index 931d5666..00000000 --- a/vendor/github.com/dgraph-io/badger/compaction.go +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "fmt" - "log" - "math" - "sync" - - "golang.org/x/net/trace" - - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" -) - -type keyRange struct { - left []byte - right []byte - inf bool -} - -var infRange = keyRange{inf: true} - -func (r keyRange) String() string { - return fmt.Sprintf("[left=%x, right=%x, inf=%v]", r.left, r.right, r.inf) -} - -func (r keyRange) equals(dst keyRange) bool { - return bytes.Equal(r.left, dst.left) && - bytes.Equal(r.right, dst.right) && - r.inf == dst.inf -} - -func (r keyRange) overlapsWith(dst keyRange) bool { - if r.inf || dst.inf { - return true - } - - // If my left is greater than dst right, we have no overlap. - if y.CompareKeys(r.left, dst.right) > 0 { - return false - } - // If my right is less than dst left, we have no overlap. - if y.CompareKeys(r.right, dst.left) < 0 { - return false - } - // We have overlap. - return true -} - -func getKeyRange(tables []*table.Table) keyRange { - if len(tables) == 0 { - return keyRange{} - } - smallest := tables[0].Smallest() - biggest := tables[0].Biggest() - for i := 1; i < len(tables); i++ { - if y.CompareKeys(tables[i].Smallest(), smallest) < 0 { - smallest = tables[i].Smallest() - } - if y.CompareKeys(tables[i].Biggest(), biggest) > 0 { - biggest = tables[i].Biggest() - } - } - return keyRange{ - left: y.KeyWithTs(y.ParseKey(smallest), math.MaxUint64), - right: y.KeyWithTs(y.ParseKey(biggest), 0), - } -} - -type levelCompactStatus struct { - ranges []keyRange - delSize int64 -} - -func (lcs *levelCompactStatus) debug() string { - var b bytes.Buffer - for _, r := range lcs.ranges { - b.WriteString(r.String()) - } - return b.String() -} - -func (lcs *levelCompactStatus) overlapsWith(dst keyRange) bool { - for _, r := range lcs.ranges { - if r.overlapsWith(dst) { - return true - } - } - return false -} - -func (lcs *levelCompactStatus) remove(dst keyRange) bool { - final := lcs.ranges[:0] - var found bool - for _, r := range lcs.ranges { - if !r.equals(dst) { - final = append(final, r) - } else { - found = true - } - } - lcs.ranges = final - return found -} - -type compactStatus struct { - sync.RWMutex - levels []*levelCompactStatus -} - -func (cs *compactStatus) toLog(tr trace.Trace) { - cs.RLock() - defer cs.RUnlock() - - tr.LazyPrintf("Compaction status:") - for i, l := range cs.levels { - if l.debug() == "" { - continue - } - tr.LazyPrintf("[%d] %s", i, l.debug()) - } -} - -func (cs *compactStatus) overlapsWith(level int, this keyRange) bool { - cs.RLock() - defer cs.RUnlock() - - thisLevel := cs.levels[level] - return thisLevel.overlapsWith(this) -} - -func (cs *compactStatus) delSize(l int) int64 { - cs.RLock() - defer cs.RUnlock() - return cs.levels[l].delSize -} - -type thisAndNextLevelRLocked struct{} - -// compareAndAdd will check whether we can run this compactDef. That it doesn't overlap with any -// other running compaction. If it can be run, it would store this run in the compactStatus state. -func (cs *compactStatus) compareAndAdd(_ thisAndNextLevelRLocked, cd compactDef) bool { - cs.Lock() - defer cs.Unlock() - - level := cd.thisLevel.level - - y.AssertTruef(level < len(cs.levels)-1, "Got level %d. Max levels: %d", level, len(cs.levels)) - thisLevel := cs.levels[level] - nextLevel := cs.levels[level+1] - - if thisLevel.overlapsWith(cd.thisRange) { - return false - } - if nextLevel.overlapsWith(cd.nextRange) { - return false - } - // Check whether this level really needs compaction or not. Otherwise, we'll end up - // running parallel compactions for the same level. - // Update: We should not be checking size here. Compaction priority already did the size checks. - // Here we should just be executing the wish of others. - - thisLevel.ranges = append(thisLevel.ranges, cd.thisRange) - nextLevel.ranges = append(nextLevel.ranges, cd.nextRange) - thisLevel.delSize += cd.thisSize - return true -} - -func (cs *compactStatus) delete(cd compactDef) { - cs.Lock() - defer cs.Unlock() - - level := cd.thisLevel.level - y.AssertTruef(level < len(cs.levels)-1, "Got level %d. Max levels: %d", level, len(cs.levels)) - - thisLevel := cs.levels[level] - nextLevel := cs.levels[level+1] - - thisLevel.delSize -= cd.thisSize - found := thisLevel.remove(cd.thisRange) - found = nextLevel.remove(cd.nextRange) && found - - if !found { - this := cd.thisRange - next := cd.nextRange - fmt.Printf("Looking for: [%q, %q, %v] in this level.\n", this.left, this.right, this.inf) - fmt.Printf("This Level:\n%s\n", thisLevel.debug()) - fmt.Println() - fmt.Printf("Looking for: [%q, %q, %v] in next level.\n", next.left, next.right, next.inf) - fmt.Printf("Next Level:\n%s\n", nextLevel.debug()) - log.Fatal("keyRange not found") - } -} diff --git a/vendor/github.com/dgraph-io/badger/db.go b/vendor/github.com/dgraph-io/badger/db.go deleted file mode 100644 index 24e7b1a4..00000000 --- a/vendor/github.com/dgraph-io/badger/db.go +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "context" - "encoding/binary" - "encoding/hex" - "expvar" - "io" - "math" - "os" - "path/filepath" - "sort" - "strconv" - "sync" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/options" - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/skl" - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" - humanize "github.com/dustin/go-humanize" - "github.com/pkg/errors" - "golang.org/x/net/trace" -) - -var ( - badgerPrefix = []byte("!badger!") // Prefix for internal keys used by badger. - head = []byte("!badger!head") // For storing value offset for replay. - txnKey = []byte("!badger!txn") // For indicating end of entries in txn. - badgerMove = []byte("!badger!move") // For key-value pairs which got moved during GC. - lfDiscardStatsKey = []byte("!badger!discard") // For storing lfDiscardStats -) - -type closers struct { - updateSize *y.Closer - compactors *y.Closer - memtable *y.Closer - writes *y.Closer - valueGC *y.Closer - pub *y.Closer -} - -type callback func(kv *pb.KVList) - -// DB provides the various functions required to interact with Badger. -// DB is thread-safe. -type DB struct { - sync.RWMutex // Guards list of inmemory tables, not individual reads and writes. - - dirLockGuard *directoryLockGuard - // nil if Dir and ValueDir are the same - valueDirGuard *directoryLockGuard - - closers closers - elog trace.EventLog - mt *skl.Skiplist // Our latest (actively written) in-memory table - imm []*skl.Skiplist // Add here only AFTER pushing to flushChan. - opt Options - manifest *manifestFile - lc *levelsController - vlog valueLog - vhead valuePointer // less than or equal to a pointer to the last vlog value put into mt - writeCh chan *request - flushChan chan flushTask // For flushing memtables. - closeOnce sync.Once // For closing DB only once. - - // Number of log rotates since the last memtable flush. We will access this field via atomic - // functions. Since we are not going to use any 64bit atomic functions, there is no need for - // 64 bit alignment of this struct(see #311). - logRotates int32 - - blockWrites int32 - - orc *oracle - - pub *publisher -} - -const ( - kvWriteChCapacity = 1000 -) - -func (db *DB) replayFunction() func(Entry, valuePointer) error { - type txnEntry struct { - nk []byte - v y.ValueStruct - } - - var txn []txnEntry - var lastCommit uint64 - - toLSM := func(nk []byte, vs y.ValueStruct) { - for err := db.ensureRoomForWrite(); err != nil; err = db.ensureRoomForWrite() { - db.elog.Printf("Replay: Making room for writes") - time.Sleep(10 * time.Millisecond) - } - db.mt.Put(nk, vs) - } - - first := true - return func(e Entry, vp valuePointer) error { // Function for replaying. - if first { - db.elog.Printf("First key=%q\n", e.Key) - } - first = false - - if db.orc.nextTxnTs < y.ParseTs(e.Key) { - db.orc.nextTxnTs = y.ParseTs(e.Key) - } - - nk := make([]byte, len(e.Key)) - copy(nk, e.Key) - var nv []byte - meta := e.meta - if db.shouldWriteValueToLSM(e) { - nv = make([]byte, len(e.Value)) - copy(nv, e.Value) - } else { - nv = make([]byte, vptrSize) - vp.Encode(nv) - meta = meta | bitValuePointer - } - - v := y.ValueStruct{ - Value: nv, - Meta: meta, - UserMeta: e.UserMeta, - ExpiresAt: e.ExpiresAt, - } - - if e.meta&bitFinTxn > 0 { - txnTs, err := strconv.ParseUint(string(e.Value), 10, 64) - if err != nil { - return errors.Wrapf(err, "Unable to parse txn fin: %q", e.Value) - } - y.AssertTrue(lastCommit == txnTs) - y.AssertTrue(len(txn) > 0) - // Got the end of txn. Now we can store them. - for _, t := range txn { - toLSM(t.nk, t.v) - } - txn = txn[:0] - lastCommit = 0 - - } else if e.meta&bitTxn > 0 { - txnTs := y.ParseTs(nk) - if lastCommit == 0 { - lastCommit = txnTs - } - if lastCommit != txnTs { - db.opt.Warningf("Found an incomplete txn at timestamp %d. Discarding it.\n", - lastCommit) - txn = txn[:0] - lastCommit = txnTs - } - te := txnEntry{nk: nk, v: v} - txn = append(txn, te) - - } else { - // This entry is from a rewrite. - toLSM(nk, v) - - // We shouldn't get this entry in the middle of a transaction. - y.AssertTrue(lastCommit == 0) - y.AssertTrue(len(txn) == 0) - } - return nil - } -} - -// Open returns a new DB object. -func Open(opt Options) (db *DB, err error) { - opt.maxBatchSize = (15 * opt.MaxTableSize) / 100 - opt.maxBatchCount = opt.maxBatchSize / int64(skl.MaxNodeSize) - - if opt.ValueThreshold > math.MaxUint16-16 { - return nil, ErrValueThreshold - } - - if opt.ReadOnly { - // Can't truncate if the DB is read only. - opt.Truncate = false - // Do not perform compaction in read only mode. - opt.CompactL0OnClose = false - } - - for _, path := range []string{opt.Dir, opt.ValueDir} { - dirExists, err := exists(path) - if err != nil { - return nil, y.Wrapf(err, "Invalid Dir: %q", path) - } - if !dirExists { - if opt.ReadOnly { - return nil, y.Wrapf(err, "Cannot find Dir for read-only open: %q", path) - } - // Try to create the directory - err = os.Mkdir(path, 0700) - if err != nil { - return nil, y.Wrapf(err, "Error Creating Dir: %q", path) - } - } - } - absDir, err := filepath.Abs(opt.Dir) - if err != nil { - return nil, err - } - absValueDir, err := filepath.Abs(opt.ValueDir) - if err != nil { - return nil, err - } - var dirLockGuard, valueDirLockGuard *directoryLockGuard - dirLockGuard, err = acquireDirectoryLock(opt.Dir, lockFile, opt.ReadOnly) - if err != nil { - return nil, err - } - defer func() { - if dirLockGuard != nil { - _ = dirLockGuard.release() - } - }() - if absValueDir != absDir { - valueDirLockGuard, err = acquireDirectoryLock(opt.ValueDir, lockFile, opt.ReadOnly) - if err != nil { - return nil, err - } - defer func() { - if valueDirLockGuard != nil { - _ = valueDirLockGuard.release() - } - }() - } - if !(opt.ValueLogFileSize <= 2<<30 && opt.ValueLogFileSize >= 1<<20) { - return nil, ErrValueLogSize - } - if !(opt.ValueLogLoadingMode == options.FileIO || - opt.ValueLogLoadingMode == options.MemoryMap) { - return nil, ErrInvalidLoadingMode - } - manifestFile, manifest, err := openOrCreateManifestFile(opt.Dir, opt.ReadOnly) - if err != nil { - return nil, err - } - defer func() { - if manifestFile != nil { - _ = manifestFile.close() - } - }() - - db = &DB{ - imm: make([]*skl.Skiplist, 0, opt.NumMemtables), - flushChan: make(chan flushTask, opt.NumMemtables), - writeCh: make(chan *request, kvWriteChCapacity), - opt: opt, - manifest: manifestFile, - elog: trace.NewEventLog("Badger", "DB"), - dirLockGuard: dirLockGuard, - valueDirGuard: valueDirLockGuard, - orc: newOracle(opt), - pub: newPublisher(), - } - - // Calculate initial size. - db.calculateSize() - db.closers.updateSize = y.NewCloser(1) - go db.updateSize(db.closers.updateSize) - db.mt = skl.NewSkiplist(arenaSize(opt)) - - // newLevelsController potentially loads files in directory. - if db.lc, err = newLevelsController(db, &manifest); err != nil { - return nil, err - } - - if !opt.ReadOnly { - db.closers.compactors = y.NewCloser(1) - db.lc.startCompact(db.closers.compactors) - - db.closers.memtable = y.NewCloser(1) - go db.flushMemtable(db.closers.memtable) // Need levels controller to be up. - } - - headKey := y.KeyWithTs(head, math.MaxUint64) - // Need to pass with timestamp, lsm get removes the last 8 bytes and compares key - vs, err := db.get(headKey) - if err != nil { - return nil, errors.Wrap(err, "Retrieving head") - } - db.orc.nextTxnTs = vs.Version - var vptr valuePointer - if len(vs.Value) > 0 { - vptr.Decode(vs.Value) - } - - replayCloser := y.NewCloser(1) - go db.doWrites(replayCloser) - - if err = db.vlog.open(db, vptr, db.replayFunction()); err != nil { - return db, err - } - replayCloser.SignalAndWait() // Wait for replay to be applied first. - - // Let's advance nextTxnTs to one more than whatever we observed via - // replaying the logs. - db.orc.txnMark.Done(db.orc.nextTxnTs) - // In normal mode, we must update readMark so older versions of keys can be removed during - // compaction when run in offline mode via the flatten tool. - db.orc.readMark.Done(db.orc.nextTxnTs) - db.orc.incrementNextTs() - - db.writeCh = make(chan *request, kvWriteChCapacity) - db.closers.writes = y.NewCloser(1) - go db.doWrites(db.closers.writes) - - db.closers.valueGC = y.NewCloser(1) - go db.vlog.waitOnGC(db.closers.valueGC) - - db.closers.pub = y.NewCloser(1) - go db.pub.listenForUpdates(db.closers.pub) - - valueDirLockGuard = nil - dirLockGuard = nil - manifestFile = nil - return db, nil -} - -// Close closes a DB. It's crucial to call it to ensure all the pending updates make their way to -// disk. Calling DB.Close() multiple times would still only close the DB once. -func (db *DB) Close() error { - var err error - db.closeOnce.Do(func() { - err = db.close() - }) - return err -} - -func (db *DB) close() (err error) { - db.elog.Printf("Closing database") - atomic.StoreInt32(&db.blockWrites, 1) - - // Stop value GC first. - db.closers.valueGC.SignalAndWait() - - // Stop writes next. - db.closers.writes.SignalAndWait() - - db.closers.pub.SignalAndWait() - - // Now close the value log. - if vlogErr := db.vlog.Close(); vlogErr != nil { - err = errors.Wrap(vlogErr, "DB.Close") - } - - // Make sure that block writer is done pushing stuff into memtable! - // Otherwise, you will have a race condition: we are trying to flush memtables - // and remove them completely, while the block / memtable writer is still - // trying to push stuff into the memtable. This will also resolve the value - // offset problem: as we push into memtable, we update value offsets there. - if !db.mt.Empty() { - db.elog.Printf("Flushing memtable") - for { - pushedFlushTask := func() bool { - db.Lock() - defer db.Unlock() - y.AssertTrue(db.mt != nil) - select { - case db.flushChan <- flushTask{mt: db.mt, vptr: db.vhead}: - db.imm = append(db.imm, db.mt) // Flusher will attempt to remove this from s.imm. - db.mt = nil // Will segfault if we try writing! - db.elog.Printf("pushed to flush chan\n") - return true - default: - // If we fail to push, we need to unlock and wait for a short while. - // The flushing operation needs to update s.imm. Otherwise, we have a deadlock. - // TODO: Think about how to do this more cleanly, maybe without any locks. - } - return false - }() - if pushedFlushTask { - break - } - time.Sleep(10 * time.Millisecond) - } - } - db.stopCompactions() - - // Force Compact L0 - // We don't need to care about cstatus since no parallel compaction is running. - if db.opt.CompactL0OnClose { - err := db.lc.doCompact(compactionPriority{level: 0, score: 1.73}) - switch err { - case errFillTables: - // This error only means that there might be enough tables to do a compaction. So, we - // should not report it to the end user to avoid confusing them. - case nil: - db.opt.Infof("Force compaction on level 0 done") - default: - db.opt.Warningf("While forcing compaction on level 0: %v", err) - } - } - - if lcErr := db.lc.close(); err == nil { - err = errors.Wrap(lcErr, "DB.Close") - } - db.elog.Printf("Waiting for closer") - db.closers.updateSize.SignalAndWait() - db.orc.Stop() - - db.elog.Finish() - - if db.dirLockGuard != nil { - if guardErr := db.dirLockGuard.release(); err == nil { - err = errors.Wrap(guardErr, "DB.Close") - } - } - if db.valueDirGuard != nil { - if guardErr := db.valueDirGuard.release(); err == nil { - err = errors.Wrap(guardErr, "DB.Close") - } - } - if manifestErr := db.manifest.close(); err == nil { - err = errors.Wrap(manifestErr, "DB.Close") - } - - // Fsync directories to ensure that lock file, and any other removed files whose directory - // we haven't specifically fsynced, are guaranteed to have their directory entry removal - // persisted to disk. - if syncErr := syncDir(db.opt.Dir); err == nil { - err = errors.Wrap(syncErr, "DB.Close") - } - if syncErr := syncDir(db.opt.ValueDir); err == nil { - err = errors.Wrap(syncErr, "DB.Close") - } - - return err -} - -const ( - lockFile = "LOCK" -) - -// Sync syncs database content to disk. This function provides -// more control to user to sync data whenever required. -func (db *DB) Sync() error { - return db.vlog.sync(math.MaxUint32) -} - -// When you create or delete a file, you have to ensure the directory entry for the file is synced -// in order to guarantee the file is visible (if the system crashes). (See the man page for fsync, -// or see https://github.com/coreos/etcd/issues/6368 for an example.) -func syncDir(dir string) error { - f, err := openDir(dir) - if err != nil { - return errors.Wrapf(err, "While opening directory: %s.", dir) - } - err = f.Sync() - closeErr := f.Close() - if err != nil { - return errors.Wrapf(err, "While syncing directory: %s.", dir) - } - return errors.Wrapf(closeErr, "While closing directory: %s.", dir) -} - -// getMemtables returns the current memtables and get references. -func (db *DB) getMemTables() ([]*skl.Skiplist, func()) { - db.RLock() - defer db.RUnlock() - - tables := make([]*skl.Skiplist, len(db.imm)+1) - - // Get mutable memtable. - tables[0] = db.mt - tables[0].IncrRef() - - // Get immutable memtables. - last := len(db.imm) - 1 - for i := range db.imm { - tables[i+1] = db.imm[last-i] - tables[i+1].IncrRef() - } - return tables, func() { - for _, tbl := range tables { - tbl.DecrRef() - } - } -} - -// get returns the value in memtable or disk for given key. -// Note that value will include meta byte. -// -// IMPORTANT: We should never write an entry with an older timestamp for the same key, We need to -// maintain this invariant to search for the latest value of a key, or else we need to search in all -// tables and find the max version among them. To maintain this invariant, we also need to ensure -// that all versions of a key are always present in the same table from level 1, because compaction -// can push any table down. -// -// Update (Sep 22, 2018): To maintain the above invariant, and to allow keys to be moved from one -// value log to another (while reclaiming space during value log GC), we have logically moved this -// need to write "old versions after new versions" to the badgerMove keyspace. Thus, for normal -// gets, we can stop going down the LSM tree once we find any version of the key (note however that -// we will ALWAYS skip versions with ts greater than the key version). However, if that key has -// been moved, then for the corresponding movekey, we'll look through all the levels of the tree -// to ensure that we pick the highest version of the movekey present. -func (db *DB) get(key []byte) (y.ValueStruct, error) { - tables, decr := db.getMemTables() // Lock should be released. - defer decr() - - var maxVs *y.ValueStruct - var version uint64 - if bytes.HasPrefix(key, badgerMove) { - // If we are checking badgerMove key, we should look into all the - // levels, so we can pick up the newer versions, which might have been - // compacted down the tree. - maxVs = &y.ValueStruct{} - version = y.ParseTs(key) - } - - y.NumGets.Add(1) - for i := 0; i < len(tables); i++ { - vs := tables[i].Get(key) - y.NumMemtableGets.Add(1) - if vs.Meta == 0 && vs.Value == nil { - continue - } - // Found a version of the key. For user keyspace, return immediately. For move keyspace, - // continue iterating, unless we found a version == given key version. - if maxVs == nil || vs.Version == version { - return vs, nil - } - if maxVs.Version < vs.Version { - *maxVs = vs - } - } - return db.lc.get(key, maxVs) -} - -func (db *DB) updateHead(ptrs []valuePointer) { - var ptr valuePointer - for i := len(ptrs) - 1; i >= 0; i-- { - p := ptrs[i] - if !p.IsZero() { - ptr = p - break - } - } - if ptr.IsZero() { - return - } - - db.Lock() - defer db.Unlock() - y.AssertTrue(!ptr.Less(db.vhead)) - db.vhead = ptr -} - -var requestPool = sync.Pool{ - New: func() interface{} { - return new(request) - }, -} - -func (db *DB) shouldWriteValueToLSM(e Entry) bool { - return len(e.Value) < db.opt.ValueThreshold -} - -func (db *DB) writeToLSM(b *request) error { - if len(b.Ptrs) != len(b.Entries) { - return errors.Errorf("Ptrs and Entries don't match: %+v", b) - } - - for i, entry := range b.Entries { - if entry.meta&bitFinTxn != 0 { - continue - } - if db.shouldWriteValueToLSM(*entry) { // Will include deletion / tombstone case. - db.mt.Put(entry.Key, - y.ValueStruct{ - Value: entry.Value, - Meta: entry.meta, - UserMeta: entry.UserMeta, - ExpiresAt: entry.ExpiresAt, - }) - } else { - var offsetBuf [vptrSize]byte - db.mt.Put(entry.Key, - y.ValueStruct{ - Value: b.Ptrs[i].Encode(offsetBuf[:]), - Meta: entry.meta | bitValuePointer, - UserMeta: entry.UserMeta, - ExpiresAt: entry.ExpiresAt, - }) - } - } - return nil -} - -// writeRequests is called serially by only one goroutine. -func (db *DB) writeRequests(reqs []*request) error { - if len(reqs) == 0 { - return nil - } - - done := func(err error) { - for _, r := range reqs { - r.Err = err - r.Wg.Done() - } - } - db.elog.Printf("writeRequests called. Writing to value log") - - err := db.vlog.write(reqs) - if err != nil { - done(err) - return err - } - - db.elog.Printf("Sending updates to subscribers") - db.pub.sendUpdates(reqs) - db.elog.Printf("Writing to memtable") - var count int - for _, b := range reqs { - if len(b.Entries) == 0 { - continue - } - count += len(b.Entries) - var i uint64 - for err = db.ensureRoomForWrite(); err == errNoRoom; err = db.ensureRoomForWrite() { - i++ - if i%100 == 0 { - db.elog.Printf("Making room for writes") - } - // We need to poll a bit because both hasRoomForWrite and the flusher need access to s.imm. - // When flushChan is full and you are blocked there, and the flusher is trying to update s.imm, - // you will get a deadlock. - time.Sleep(10 * time.Millisecond) - } - if err != nil { - done(err) - return errors.Wrap(err, "writeRequests") - } - if err := db.writeToLSM(b); err != nil { - done(err) - return errors.Wrap(err, "writeRequests") - } - db.updateHead(b.Ptrs) - } - done(nil) - db.elog.Printf("%d entries written", count) - return nil -} - -func (db *DB) sendToWriteCh(entries []*Entry) (*request, error) { - if atomic.LoadInt32(&db.blockWrites) == 1 { - return nil, ErrBlockedWrites - } - var count, size int64 - for _, e := range entries { - size += int64(e.estimateSize(db.opt.ValueThreshold)) - count++ - } - if count >= db.opt.maxBatchCount || size >= db.opt.maxBatchSize { - return nil, ErrTxnTooBig - } - - // We can only service one request because we need each txn to be stored in a contigous section. - // Txns should not interleave among other txns or rewrites. - req := requestPool.Get().(*request) - req.Entries = entries - req.Wg = sync.WaitGroup{} - req.Wg.Add(1) - req.IncrRef() // for db write - req.IncrRef() // for publisher updates - db.writeCh <- req // Handled in doWrites. - y.NumPuts.Add(int64(len(entries))) - - return req, nil -} - -func (db *DB) doWrites(lc *y.Closer) { - defer lc.Done() - pendingCh := make(chan struct{}, 1) - - writeRequests := func(reqs []*request) { - if err := db.writeRequests(reqs); err != nil { - db.opt.Errorf("writeRequests: %v", err) - } - <-pendingCh - } - - // This variable tracks the number of pending writes. - reqLen := new(expvar.Int) - y.PendingWrites.Set(db.opt.Dir, reqLen) - - reqs := make([]*request, 0, 10) - for { - var r *request - select { - case r = <-db.writeCh: - case <-lc.HasBeenClosed(): - goto closedCase - } - - for { - reqs = append(reqs, r) - reqLen.Set(int64(len(reqs))) - - if len(reqs) >= 3*kvWriteChCapacity { - pendingCh <- struct{}{} // blocking. - goto writeCase - } - - select { - // Either push to pending, or continue to pick from writeCh. - case r = <-db.writeCh: - case pendingCh <- struct{}{}: - goto writeCase - case <-lc.HasBeenClosed(): - goto closedCase - } - } - - closedCase: - close(db.writeCh) - for r := range db.writeCh { // Flush the channel. - reqs = append(reqs, r) - } - - pendingCh <- struct{}{} // Push to pending before doing a write. - writeRequests(reqs) - return - - writeCase: - go writeRequests(reqs) - reqs = make([]*request, 0, 10) - reqLen.Set(0) - } -} - -// batchSet applies a list of badger.Entry. If a request level error occurs it -// will be returned. -// Check(kv.BatchSet(entries)) -func (db *DB) batchSet(entries []*Entry) error { - req, err := db.sendToWriteCh(entries) - if err != nil { - return err - } - - return req.Wait() -} - -// batchSetAsync is the asynchronous version of batchSet. It accepts a callback -// function which is called when all the sets are complete. If a request level -// error occurs, it will be passed back via the callback. -// err := kv.BatchSetAsync(entries, func(err error)) { -// Check(err) -// } -func (db *DB) batchSetAsync(entries []*Entry, f func(error)) error { - req, err := db.sendToWriteCh(entries) - if err != nil { - return err - } - go func() { - err := req.Wait() - // Write is complete. Let's call the callback function now. - f(err) - }() - return nil -} - -var errNoRoom = errors.New("No room for write") - -// ensureRoomForWrite is always called serially. -func (db *DB) ensureRoomForWrite() error { - var err error - db.Lock() - defer db.Unlock() - - // Here we determine if we need to force flush memtable. Given we rotated log file, it would - // make sense to force flush a memtable, so the updated value head would have a chance to be - // pushed to L0. Otherwise, it would not go to L0, until the memtable has been fully filled, - // which can take a lot longer if the write load has fewer keys and larger values. This force - // flush, thus avoids the need to read through a lot of log files on a crash and restart. - // Above approach is quite simple with small drawback. We are calling ensureRoomForWrite before - // inserting every entry in Memtable. We will get latest db.head after all entries for a request - // are inserted in Memtable. If we have done >= db.logRotates rotations, then while inserting - // first entry in Memtable, below condition will be true and we will endup flushing old value of - // db.head. Hence we are limiting no of value log files to be read to db.logRotates only. - forceFlush := atomic.LoadInt32(&db.logRotates) >= db.opt.LogRotatesToFlush - - if !forceFlush && db.mt.MemSize() < db.opt.MaxTableSize { - return nil - } - - y.AssertTrue(db.mt != nil) // A nil mt indicates that DB is being closed. - select { - case db.flushChan <- flushTask{mt: db.mt, vptr: db.vhead}: - // After every memtable flush, let's reset the counter. - atomic.StoreInt32(&db.logRotates, 0) - - // Ensure value log is synced to disk so this memtable's contents wouldn't be lost. - err = db.vlog.sync(db.vhead.Fid) - if err != nil { - return err - } - - db.opt.Debugf("Flushing memtable, mt.size=%d size of flushChan: %d\n", - db.mt.MemSize(), len(db.flushChan)) - // We manage to push this task. Let's modify imm. - db.imm = append(db.imm, db.mt) - db.mt = skl.NewSkiplist(arenaSize(db.opt)) - // New memtable is empty. We certainly have room. - return nil - default: - // We need to do this to unlock and allow the flusher to modify imm. - return errNoRoom - } -} - -func arenaSize(opt Options) int64 { - return opt.MaxTableSize + opt.maxBatchSize + opt.maxBatchCount*int64(skl.MaxNodeSize) -} - -// WriteLevel0Table flushes memtable. -func writeLevel0Table(ft flushTask, f io.Writer) error { - iter := ft.mt.NewIterator() - defer iter.Close() - b := table.NewTableBuilder() - defer b.Close() - for iter.SeekToFirst(); iter.Valid(); iter.Next() { - if len(ft.dropPrefix) > 0 && bytes.HasPrefix(iter.Key(), ft.dropPrefix) { - continue - } - if err := b.Add(iter.Key(), iter.Value()); err != nil { - return err - } - } - _, err := f.Write(b.Finish()) - return err -} - -type flushTask struct { - mt *skl.Skiplist - vptr valuePointer - dropPrefix []byte -} - -// handleFlushTask must be run serially. -func (db *DB) handleFlushTask(ft flushTask) error { - // There can be a scnerio, when empty memtable is flushed. For example, memtable is empty and - // after writing request to value log, rotation count exceeds db.LogRotatesToFlush. - if ft.mt.Empty() { - return nil - } - - // Store badger head even if vptr is zero, need it for readTs - db.opt.Debugf("Storing value log head: %+v\n", ft.vptr) - db.elog.Printf("Storing offset: %+v\n", ft.vptr) - offset := make([]byte, vptrSize) - ft.vptr.Encode(offset) - - // Pick the max commit ts, so in case of crash, our read ts would be higher than all the - // commits. - headTs := y.KeyWithTs(head, db.orc.nextTs()) - ft.mt.Put(headTs, y.ValueStruct{Value: offset}) - - // Also store lfDiscardStats before flushing memtables - discardStatsKey := y.KeyWithTs(lfDiscardStatsKey, 1) - ft.mt.Put(discardStatsKey, y.ValueStruct{Value: db.vlog.encodedDiscardStats()}) - - fileID := db.lc.reserveFileID() - fd, err := y.CreateSyncedFile(table.NewFilename(fileID, db.opt.Dir), true) - if err != nil { - return y.Wrap(err) - } - - // Don't block just to sync the directory entry. - dirSyncCh := make(chan error) - go func() { dirSyncCh <- syncDir(db.opt.Dir) }() - - err = writeLevel0Table(ft, fd) - dirSyncErr := <-dirSyncCh - - if err != nil { - db.elog.Errorf("ERROR while writing to level 0: %v", err) - return err - } - if dirSyncErr != nil { - // Do dir sync as best effort. No need to return due to an error there. - db.elog.Errorf("ERROR while syncing level directory: %v", dirSyncErr) - } - - tbl, err := table.OpenTable(fd, db.opt.TableLoadingMode, nil) - if err != nil { - db.elog.Printf("ERROR while opening table: %v", err) - return err - } - // We own a ref on tbl. - err = db.lc.addLevel0Table(tbl) // This will incrRef (if we don't error, sure) - tbl.DecrRef() // Releases our ref. - return err -} - -// flushMemtable must keep running until we send it an empty flushTask. If there -// are errors during handling the flush task, we'll retry indefinitely. -func (db *DB) flushMemtable(lc *y.Closer) error { - defer lc.Done() - - for ft := range db.flushChan { - if ft.mt == nil { - // We close db.flushChan now, instead of sending a nil ft.mt. - continue - } - for { - err := db.handleFlushTask(ft) - if err == nil { - // Update s.imm. Need a lock. - db.Lock() - // This is a single-threaded operation. ft.mt corresponds to the head of - // db.imm list. Once we flush it, we advance db.imm. The next ft.mt - // which would arrive here would match db.imm[0], because we acquire a - // lock over DB when pushing to flushChan. - // TODO: This logic is dirty AF. Any change and this could easily break. - y.AssertTrue(ft.mt == db.imm[0]) - db.imm = db.imm[1:] - ft.mt.DecrRef() // Return memory. - db.Unlock() - - break - } - // Encountered error. Retry indefinitely. - db.opt.Errorf("Failure while flushing memtable to disk: %v. Retrying...\n", err) - time.Sleep(time.Second) - } - } - return nil -} - -func exists(path string) (bool, error) { - _, err := os.Stat(path) - if err == nil { - return true, nil - } - if os.IsNotExist(err) { - return false, nil - } - return true, err -} - -// This function does a filewalk, calculates the size of vlog and sst files and stores it in -// y.LSMSize and y.VlogSize. -func (db *DB) calculateSize() { - newInt := func(val int64) *expvar.Int { - v := new(expvar.Int) - v.Add(val) - return v - } - - totalSize := func(dir string) (int64, int64) { - var lsmSize, vlogSize int64 - err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - ext := filepath.Ext(path) - if ext == ".sst" { - lsmSize += info.Size() - } else if ext == ".vlog" { - vlogSize += info.Size() - } - return nil - }) - if err != nil { - db.elog.Printf("Got error while calculating total size of directory: %s", dir) - } - return lsmSize, vlogSize - } - - lsmSize, vlogSize := totalSize(db.opt.Dir) - y.LSMSize.Set(db.opt.Dir, newInt(lsmSize)) - // If valueDir is different from dir, we'd have to do another walk. - if db.opt.ValueDir != db.opt.Dir { - _, vlogSize = totalSize(db.opt.ValueDir) - } - y.VlogSize.Set(db.opt.Dir, newInt(vlogSize)) -} - -func (db *DB) updateSize(lc *y.Closer) { - defer lc.Done() - - metricsTicker := time.NewTicker(time.Minute) - defer metricsTicker.Stop() - - for { - select { - case <-metricsTicker.C: - db.calculateSize() - case <-lc.HasBeenClosed(): - return - } - } -} - -// RunValueLogGC triggers a value log garbage collection. -// -// It picks value log files to perform GC based on statistics that are collected -// duing compactions. If no such statistics are available, then log files are -// picked in random order. The process stops as soon as the first log file is -// encountered which does not result in garbage collection. -// -// When a log file is picked, it is first sampled. If the sample shows that we -// can discard at least discardRatio space of that file, it would be rewritten. -// -// If a call to RunValueLogGC results in no rewrites, then an ErrNoRewrite is -// thrown indicating that the call resulted in no file rewrites. -// -// We recommend setting discardRatio to 0.5, thus indicating that a file be -// rewritten if half the space can be discarded. This results in a lifetime -// value log write amplification of 2 (1 from original write + 0.5 rewrite + -// 0.25 + 0.125 + ... = 2). Setting it to higher value would result in fewer -// space reclaims, while setting it to a lower value would result in more space -// reclaims at the cost of increased activity on the LSM tree. discardRatio -// must be in the range (0.0, 1.0), both endpoints excluded, otherwise an -// ErrInvalidRequest is returned. -// -// Only one GC is allowed at a time. If another value log GC is running, or DB -// has been closed, this would return an ErrRejected. -// -// Note: Every time GC is run, it would produce a spike of activity on the LSM -// tree. -func (db *DB) RunValueLogGC(discardRatio float64) error { - if discardRatio >= 1.0 || discardRatio <= 0.0 { - return ErrInvalidRequest - } - - // Find head on disk - headKey := y.KeyWithTs(head, math.MaxUint64) - // Need to pass with timestamp, lsm get removes the last 8 bytes and compares key - val, err := db.lc.get(headKey, nil) - if err != nil { - return errors.Wrap(err, "Retrieving head from on-disk LSM") - } - - var head valuePointer - if len(val.Value) > 0 { - head.Decode(val.Value) - } - - // Pick a log file and run GC - return db.vlog.runGC(discardRatio, head) -} - -// Size returns the size of lsm and value log files in bytes. It can be used to decide how often to -// call RunValueLogGC. -func (db *DB) Size() (lsm, vlog int64) { - if y.LSMSize.Get(db.opt.Dir) == nil { - lsm, vlog = 0, 0 - return - } - lsm = y.LSMSize.Get(db.opt.Dir).(*expvar.Int).Value() - vlog = y.VlogSize.Get(db.opt.Dir).(*expvar.Int).Value() - return -} - -// Sequence represents a Badger sequence. -type Sequence struct { - sync.Mutex - db *DB - key []byte - next uint64 - leased uint64 - bandwidth uint64 -} - -// Next would return the next integer in the sequence, updating the lease by running a transaction -// if needed. -func (seq *Sequence) Next() (uint64, error) { - seq.Lock() - defer seq.Unlock() - if seq.next >= seq.leased { - if err := seq.updateLease(); err != nil { - return 0, err - } - } - val := seq.next - seq.next++ - return val, nil -} - -// Release the leased sequence to avoid wasted integers. This should be done right -// before closing the associated DB. However it is valid to use the sequence after -// it was released, causing a new lease with full bandwidth. -func (seq *Sequence) Release() error { - seq.Lock() - defer seq.Unlock() - err := seq.db.Update(func(txn *Txn) error { - var buf [8]byte - binary.BigEndian.PutUint64(buf[:], seq.next) - return txn.Set(seq.key, buf[:]) - }) - if err != nil { - return err - } - seq.leased = seq.next - return nil -} - -func (seq *Sequence) updateLease() error { - return seq.db.Update(func(txn *Txn) error { - item, err := txn.Get(seq.key) - if err == ErrKeyNotFound { - seq.next = 0 - } else if err != nil { - return err - } else { - var num uint64 - if err := item.Value(func(v []byte) error { - num = binary.BigEndian.Uint64(v) - return nil - }); err != nil { - return err - } - seq.next = num - } - - lease := seq.next + seq.bandwidth - var buf [8]byte - binary.BigEndian.PutUint64(buf[:], lease) - if err = txn.Set(seq.key, buf[:]); err != nil { - return err - } - seq.leased = lease - return nil - }) -} - -// GetSequence would initiate a new sequence object, generating it from the stored lease, if -// available, in the database. Sequence can be used to get a list of monotonically increasing -// integers. Multiple sequences can be created by providing different keys. Bandwidth sets the -// size of the lease, determining how many Next() requests can be served from memory. -// -// GetSequence is not supported on ManagedDB. Calling this would result in a panic. -func (db *DB) GetSequence(key []byte, bandwidth uint64) (*Sequence, error) { - if db.opt.managedTxns { - panic("Cannot use GetSequence with managedDB=true.") - } - - switch { - case len(key) == 0: - return nil, ErrEmptyKey - case bandwidth == 0: - return nil, ErrZeroBandwidth - } - seq := &Sequence{ - db: db, - key: key, - next: 0, - leased: 0, - bandwidth: bandwidth, - } - err := seq.updateLease() - return seq, err -} - -// Tables gets the TableInfo objects from the level controller. If withKeysCount -// is true, TableInfo objects also contain counts of keys for the tables. -func (db *DB) Tables(withKeysCount bool) []TableInfo { - return db.lc.getTableInfo(withKeysCount) -} - -// KeySplits can be used to get rough key ranges to divide up iteration over -// the DB. -func (db *DB) KeySplits(prefix []byte) []string { - var splits []string - // We just want table ranges here and not keys count. - for _, ti := range db.Tables(false) { - // We don't use ti.Left, because that has a tendency to store !badger - // keys. - if bytes.HasPrefix(ti.Right, prefix) { - splits = append(splits, string(ti.Right)) - } - } - sort.Strings(splits) - return splits -} - -// MaxBatchCount returns max possible entries in batch -func (db *DB) MaxBatchCount() int64 { - return db.opt.maxBatchCount -} - -// MaxBatchSize returns max possible batch size -func (db *DB) MaxBatchSize() int64 { - return db.opt.maxBatchSize -} - -func (db *DB) stopCompactions() { - // Stop memtable flushes. - if db.closers.memtable != nil { - close(db.flushChan) - db.closers.memtable.SignalAndWait() - } - // Stop compactions. - if db.closers.compactors != nil { - db.closers.compactors.SignalAndWait() - } -} - -func (db *DB) startCompactions() { - // Resume compactions. - if db.closers.compactors != nil { - db.closers.compactors = y.NewCloser(1) - db.lc.startCompact(db.closers.compactors) - } - if db.closers.memtable != nil { - db.flushChan = make(chan flushTask, db.opt.NumMemtables) - db.closers.memtable = y.NewCloser(1) - go db.flushMemtable(db.closers.memtable) - } -} - -// Flatten can be used to force compactions on the LSM tree so all the tables fall on the same -// level. This ensures that all the versions of keys are colocated and not split across multiple -// levels, which is necessary after a restore from backup. During Flatten, live compactions are -// stopped. Ideally, no writes are going on during Flatten. Otherwise, it would create competition -// between flattening the tree and new tables being created at level zero. -func (db *DB) Flatten(workers int) error { - db.stopCompactions() - defer db.startCompactions() - - compactAway := func(cp compactionPriority) error { - db.opt.Infof("Attempting to compact with %+v\n", cp) - errCh := make(chan error, 1) - for i := 0; i < workers; i++ { - go func() { - errCh <- db.lc.doCompact(cp) - }() - } - var success int - var rerr error - for i := 0; i < workers; i++ { - err := <-errCh - if err != nil { - rerr = err - db.opt.Warningf("While running doCompact with %+v. Error: %v\n", cp, err) - } else { - success++ - } - } - if success == 0 { - return rerr - } - // We could do at least one successful compaction. So, we'll consider this a success. - db.opt.Infof("%d compactor(s) succeeded. One or more tables from level %d compacted.\n", - success, cp.level) - return nil - } - - hbytes := func(sz int64) string { - return humanize.Bytes(uint64(sz)) - } - - for { - db.opt.Infof("\n") - var levels []int - for i, l := range db.lc.levels { - sz := l.getTotalSize() - db.opt.Infof("Level: %d. %8s Size. %8s Max.\n", - i, hbytes(l.getTotalSize()), hbytes(l.maxTotalSize)) - if sz > 0 { - levels = append(levels, i) - } - } - if len(levels) <= 1 { - prios := db.lc.pickCompactLevels() - if len(prios) == 0 || prios[0].score <= 1.0 { - db.opt.Infof("All tables consolidated into one level. Flattening done.\n") - return nil - } - if err := compactAway(prios[0]); err != nil { - return err - } - continue - } - // Create an artificial compaction priority, to ensure that we compact the level. - cp := compactionPriority{level: levels[0], score: 1.71} - if err := compactAway(cp); err != nil { - return err - } - } -} - -func (db *DB) prepareToDrop() func() { - if db.opt.ReadOnly { - panic("Attempting to drop data in read-only mode.") - } - // Stop accepting new writes. - atomic.StoreInt32(&db.blockWrites, 1) - - // Make all pending writes finish. The following will also close writeCh. - db.closers.writes.SignalAndWait() - db.opt.Infof("Writes flushed. Stopping compactions now...") - - // Stop all compactions. - db.stopCompactions() - return func() { - db.opt.Infof("Resuming writes") - db.startCompactions() - - db.writeCh = make(chan *request, kvWriteChCapacity) - db.closers.writes = y.NewCloser(1) - go db.doWrites(db.closers.writes) - - // Resume writes. - atomic.StoreInt32(&db.blockWrites, 0) - } -} - -// DropAll would drop all the data stored in Badger. It does this in the following way. -// - Stop accepting new writes. -// - Pause memtable flushes and compactions. -// - Pick all tables from all levels, create a changeset to delete all these -// tables and apply it to manifest. -// - Pick all log files from value log, and delete all of them. Restart value log files from zero. -// - Resume memtable flushes and compactions. -// -// NOTE: DropAll is resilient to concurrent writes, but not to reads. It is up to the user to not do -// any reads while DropAll is going on, otherwise they may result in panics. Ideally, both reads and -// writes are paused before running DropAll, and resumed after it is finished. -func (db *DB) DropAll() error { - f, err := db.dropAll() - if err != nil { - return err - } - if f == nil { - panic("both error and returned function cannot be nil in DropAll") - } - f() - return nil -} - -func (db *DB) dropAll() (func(), error) { - db.opt.Infof("DropAll called. Blocking writes...") - f := db.prepareToDrop() - - // Block all foreign interactions with memory tables. - db.Lock() - defer db.Unlock() - - // Remove inmemory tables. Calling DecrRef for safety. Not sure if they're absolutely needed. - db.mt.DecrRef() - for _, mt := range db.imm { - mt.DecrRef() - } - db.imm = db.imm[:0] - db.mt = skl.NewSkiplist(arenaSize(db.opt)) // Set it up for future writes. - - num, err := db.lc.dropTree() - if err != nil { - return nil, err - } - db.opt.Infof("Deleted %d SSTables. Now deleting value logs...\n", num) - - num, err = db.vlog.dropAll() - if err != nil { - return nil, err - } - db.vhead = valuePointer{} // Zero it out. - db.lc.nextFileID = 1 - db.opt.Infof("Deleted %d value log files. DropAll done.\n", num) - return f, nil -} - -// DropPrefix would drop all the keys with the provided prefix. It does this in the following way: -// - Stop accepting new writes. -// - Stop memtable flushes and compactions. -// - Flush out all memtables, skipping over keys with the given prefix, Kp. -// - Write out the value log header to memtables when flushing, so we don't accidentally bring Kp -// back after a restart. -// - Compact L0->L1, skipping over Kp. -// - Compact rest of the levels, Li->Li, picking tables which have Kp. -// - Resume memtable flushes, compactions and writes. -func (db *DB) DropPrefix(prefix []byte) error { - db.opt.Infof("DropPrefix called on %s. Blocking writes...", hex.Dump(prefix)) - f := db.prepareToDrop() - defer f() - - // Block all foreign interactions with memory tables. - db.Lock() - defer db.Unlock() - - db.imm = append(db.imm, db.mt) - for _, memtable := range db.imm { - if memtable.Empty() { - memtable.DecrRef() - continue - } - task := flushTask{ - mt: memtable, - // Ensure that the head of value log gets persisted to disk. - vptr: db.vhead, - dropPrefix: prefix, - } - db.opt.Debugf("Flushing memtable") - if err := db.handleFlushTask(task); err != nil { - db.opt.Errorf("While trying to flush memtable: %v", err) - return err - } - memtable.DecrRef() - } - db.imm = db.imm[:0] - db.mt = skl.NewSkiplist(arenaSize(db.opt)) - - // Drop prefixes from the levels. - if err := db.lc.dropPrefix(prefix); err != nil { - return err - } - db.opt.Infof("DropPrefix done") - return nil -} - -// Subscribe can be used watch key changes for the given key prefix. -func (db *DB) Subscribe(ctx context.Context, cb callback, prefix []byte, prefixes ...[]byte) error { - if cb == nil { - return ErrNilCallback - } - prefixes = append(prefixes, prefix) - c := y.NewCloser(1) - recvCh, id := db.pub.newSubscriber(c, prefixes...) - slurp := func(batch *pb.KVList) { - defer func() { - if len(batch.GetKv()) > 0 { - cb(batch) - } - }() - for { - select { - case kvs := <-recvCh: - batch.Kv = append(batch.Kv, kvs.Kv...) - default: - return - } - } - } - for { - select { - case <-c.HasBeenClosed(): - slurp(new(pb.KVList)) - // Drain if any pending updates. - c.Done() - // No need to delete here. Closer will be called only while - // closing DB. Subscriber will be deleted by cleanSubscribers. - return nil - case <-ctx.Done(): - c.Done() - db.pub.deleteSubscriber(id) - // Delete the subscriber to avoid further updates. - return ctx.Err() - case batch := <-recvCh: - slurp(batch) - } - } -} diff --git a/vendor/github.com/dgraph-io/badger/dir_unix.go b/vendor/github.com/dgraph-io/badger/dir_unix.go deleted file mode 100644 index a5e0fa33..00000000 --- a/vendor/github.com/dgraph-io/badger/dir_unix.go +++ /dev/null @@ -1,100 +0,0 @@ -// +build !windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - - "github.com/pkg/errors" - "golang.org/x/sys/unix" -) - -// directoryLockGuard holds a lock on a directory and a pid file inside. The pid file isn't part -// of the locking mechanism, it's just advisory. -type directoryLockGuard struct { - // File handle on the directory, which we've flocked. - f *os.File - // The absolute path to our pid file. - path string - // Was this a shared lock for a read-only database? - readOnly bool -} - -// acquireDirectoryLock gets a lock on the directory (using flock). If -// this is not read-only, it will also write our pid to -// dirPath/pidFileName for convenience. -func acquireDirectoryLock(dirPath string, pidFileName string, readOnly bool) (*directoryLockGuard, error) { - // Convert to absolute path so that Release still works even if we do an unbalanced - // chdir in the meantime. - absPidFilePath, err := filepath.Abs(filepath.Join(dirPath, pidFileName)) - if err != nil { - return nil, errors.Wrap(err, "cannot get absolute path for pid lock file") - } - f, err := os.Open(dirPath) - if err != nil { - return nil, errors.Wrapf(err, "cannot open directory %q", dirPath) - } - opts := unix.LOCK_EX | unix.LOCK_NB - if readOnly { - opts = unix.LOCK_SH | unix.LOCK_NB - } - - err = unix.Flock(int(f.Fd()), opts) - if err != nil { - f.Close() - return nil, errors.Wrapf(err, - "Cannot acquire directory lock on %q. Another process is using this Badger database.", - dirPath) - } - - if !readOnly { - // Yes, we happily overwrite a pre-existing pid file. We're the - // only read-write badger process using this directory. - err = ioutil.WriteFile(absPidFilePath, []byte(fmt.Sprintf("%d\n", os.Getpid())), 0666) - if err != nil { - f.Close() - return nil, errors.Wrapf(err, - "Cannot write pid file %q", absPidFilePath) - } - } - return &directoryLockGuard{f, absPidFilePath, readOnly}, nil -} - -// Release deletes the pid file and releases our lock on the directory. -func (guard *directoryLockGuard) release() error { - var err error - if !guard.readOnly { - // It's important that we remove the pid file first. - err = os.Remove(guard.path) - } - - if closeErr := guard.f.Close(); err == nil { - err = closeErr - } - guard.path = "" - guard.f = nil - - return err -} - -// openDir opens a directory for syncing. -func openDir(path string) (*os.File, error) { return os.Open(path) } diff --git a/vendor/github.com/dgraph-io/badger/dir_windows.go b/vendor/github.com/dgraph-io/badger/dir_windows.go deleted file mode 100644 index 28ccb7aa..00000000 --- a/vendor/github.com/dgraph-io/badger/dir_windows.go +++ /dev/null @@ -1,106 +0,0 @@ -// +build windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -// OpenDir opens a directory in windows with write access for syncing. -import ( - "os" - "path/filepath" - "syscall" - - "github.com/pkg/errors" -) - -// FILE_ATTRIBUTE_TEMPORARY - A file that is being used for temporary storage. -// FILE_FLAG_DELETE_ON_CLOSE - The file is to be deleted immediately after all of its handles are -// closed, which includes the specified handle and any other open or duplicated handles. -// See: https://docs.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants -// NOTE: Added here to avoid importing golang.org/x/sys/windows -const ( - FILE_ATTRIBUTE_TEMPORARY = 0x00000100 - FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 -) - -func openDir(path string) (*os.File, error) { - fd, err := openDirWin(path) - if err != nil { - return nil, err - } - return os.NewFile(uintptr(fd), path), nil -} - -func openDirWin(path string) (fd syscall.Handle, err error) { - if len(path) == 0 { - return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND - } - pathp, err := syscall.UTF16PtrFromString(path) - if err != nil { - return syscall.InvalidHandle, err - } - access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE) - sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE) - createmode := uint32(syscall.OPEN_EXISTING) - fl := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS) - return syscall.CreateFile(pathp, access, sharemode, nil, createmode, fl, 0) -} - -// DirectoryLockGuard holds a lock on the directory. -type directoryLockGuard struct { - h syscall.Handle - path string -} - -// AcquireDirectoryLock acquires exclusive access to a directory. -func acquireDirectoryLock(dirPath string, pidFileName string, readOnly bool) (*directoryLockGuard, error) { - if readOnly { - return nil, ErrWindowsNotSupported - } - - // Convert to absolute path so that Release still works even if we do an unbalanced - // chdir in the meantime. - absLockFilePath, err := filepath.Abs(filepath.Join(dirPath, pidFileName)) - if err != nil { - return nil, errors.Wrap(err, "Cannot get absolute path for pid lock file") - } - - // This call creates a file handler in memory that only one process can use at a time. When - // that process ends, the file is deleted by the system. - // FILE_ATTRIBUTE_TEMPORARY is used to tell Windows to try to create the handle in memory. - // FILE_FLAG_DELETE_ON_CLOSE is not specified in syscall_windows.go but tells Windows to delete - // the file when all processes holding the handler are closed. - // XXX: this works but it's a bit klunky. i'd prefer to use LockFileEx but it needs unsafe pkg. - h, err := syscall.CreateFile( - syscall.StringToUTF16Ptr(absLockFilePath), 0, 0, nil, - syscall.OPEN_ALWAYS, - uint32(FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE), - 0) - if err != nil { - return nil, errors.Wrapf(err, - "Cannot create lock file %q. Another process is using this Badger database", - absLockFilePath) - } - - return &directoryLockGuard{h: h, path: absLockFilePath}, nil -} - -// Release removes the directory lock. -func (g *directoryLockGuard) release() error { - g.path = "" - return syscall.CloseHandle(g.h) -} diff --git a/vendor/github.com/dgraph-io/badger/doc.go b/vendor/github.com/dgraph-io/badger/doc.go deleted file mode 100644 index 83dc9a28..00000000 --- a/vendor/github.com/dgraph-io/badger/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Package badger implements an embeddable, simple and fast key-value database, -written in pure Go. It is designed to be highly performant for both reads and -writes simultaneously. Badger uses Multi-Version Concurrency Control (MVCC), and -supports transactions. It runs transactions concurrently, with serializable -snapshot isolation guarantees. - -Badger uses an LSM tree along with a value log to separate keys from values, -hence reducing both write amplification and the size of the LSM tree. This -allows LSM tree to be served entirely from RAM, while the values are served -from SSD. - - -Usage - -Badger has the following main types: DB, Txn, Item and Iterator. DB contains -keys that are associated with values. It must be opened with the appropriate -options before it can be accessed. - -All operations happen inside a Txn. Txn represents a transaction, which can -be read-only or read-write. Read-only transactions can read values for a -given key (which are returned inside an Item), or iterate over a set of -key-value pairs using an Iterator (which are returned as Item type values as -well). Read-write transactions can also update and delete keys from the DB. - -See the examples for more usage details. -*/ -package badger diff --git a/vendor/github.com/dgraph-io/badger/errors.go b/vendor/github.com/dgraph-io/badger/errors.go deleted file mode 100644 index cad66cb1..00000000 --- a/vendor/github.com/dgraph-io/badger/errors.go +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "github.com/pkg/errors" -) - -var ( - // ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid - // range. - ErrValueLogSize = errors.New("Invalid ValueLogFileSize, must be between 1MB and 2GB") - - // ErrValueThreshold is returned when ValueThreshold is set to a value close to or greater than - // uint16. - ErrValueThreshold = errors.New("Invalid ValueThreshold, must be lower than uint16") - - // ErrKeyNotFound is returned when key isn't found on a txn.Get. - ErrKeyNotFound = errors.New("Key not found") - - // ErrTxnTooBig is returned if too many writes are fit into a single transaction. - ErrTxnTooBig = errors.New("Txn is too big to fit into one request") - - // ErrConflict is returned when a transaction conflicts with another transaction. This can happen if - // the read rows had been updated concurrently by another transaction. - ErrConflict = errors.New("Transaction Conflict. Please retry") - - // ErrReadOnlyTxn is returned if an update function is called on a read-only transaction. - ErrReadOnlyTxn = errors.New("No sets or deletes are allowed in a read-only transaction") - - // ErrDiscardedTxn is returned if a previously discarded transaction is re-used. - ErrDiscardedTxn = errors.New("This transaction has been discarded. Create a new one") - - // ErrEmptyKey is returned if an empty key is passed on an update function. - ErrEmptyKey = errors.New("Key cannot be empty") - - // ErrInvalidKey is returned if the key has a special !badger! prefix, - // reserved for internal usage. - ErrInvalidKey = errors.New("Key is using a reserved !badger! prefix") - - // ErrRetry is returned when a log file containing the value is not found. - // This usually indicates that it may have been garbage collected, and the - // operation needs to be retried. - ErrRetry = errors.New("Unable to find log file. Please retry") - - // ErrThresholdZero is returned if threshold is set to zero, and value log GC is called. - // In such a case, GC can't be run. - ErrThresholdZero = errors.New( - "Value log GC can't run because threshold is set to zero") - - // ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite. - ErrNoRewrite = errors.New( - "Value log GC attempt didn't result in any cleanup") - - // ErrRejected is returned if a value log GC is called either while another GC is running, or - // after DB::Close has been called. - ErrRejected = errors.New("Value log GC request rejected") - - // ErrInvalidRequest is returned if the user request is invalid. - ErrInvalidRequest = errors.New("Invalid request") - - // ErrManagedTxn is returned if the user tries to use an API which isn't - // allowed due to external management of transactions, when using ManagedDB. - ErrManagedTxn = errors.New( - "Invalid API request. Not allowed to perform this action using ManagedDB") - - // ErrInvalidDump if a data dump made previously cannot be loaded into the database. - ErrInvalidDump = errors.New("Data dump cannot be read") - - // ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence. - ErrZeroBandwidth = errors.New("Bandwidth must be greater than zero") - - // ErrInvalidLoadingMode is returned when opt.ValueLogLoadingMode option is not - // within the valid range - ErrInvalidLoadingMode = errors.New("Invalid ValueLogLoadingMode, must be FileIO or MemoryMap") - - // ErrReplayNeeded is returned when opt.ReadOnly is set but the - // database requires a value log replay. - ErrReplayNeeded = errors.New("Database was not properly closed, cannot open read-only") - - // ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows - ErrWindowsNotSupported = errors.New("Read-only mode is not supported on Windows") - - // ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of - // corrupt data to allow Badger to run properly. - ErrTruncateNeeded = errors.New("Value log truncate required to run DB. This might result in data loss") - - // ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all - // data from Badger, we stop accepting new writes, by returning this error. - ErrBlockedWrites = errors.New("Writes are blocked, possibly due to DropAll or Close") - - // ErrNilCallback is returned when subscriber's callback is nil. - ErrNilCallback = errors.New("Callback cannot be nil") -) diff --git a/vendor/github.com/dgraph-io/badger/histogram.go b/vendor/github.com/dgraph-io/badger/histogram.go deleted file mode 100644 index d8c94bb7..00000000 --- a/vendor/github.com/dgraph-io/badger/histogram.go +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2019 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "fmt" - "math" -) - -// PrintHistogram builds and displays the key-value size histogram. -// When keyPrefix is set, only the keys that have prefix "keyPrefix" are -// considered for creating the histogram -func (db *DB) PrintHistogram(keyPrefix []byte) { - if db == nil { - fmt.Println("\nCannot build histogram: DB is nil.") - return - } - histogram := db.buildHistogram(keyPrefix) - fmt.Printf("Histogram of key sizes (in bytes)\n") - histogram.keySizeHistogram.printHistogram() - fmt.Printf("Histogram of value sizes (in bytes)\n") - histogram.valueSizeHistogram.printHistogram() -} - -// histogramData stores information about a histogram -type histogramData struct { - bins []int64 - countPerBin []int64 - totalCount int64 - min int64 - max int64 - sum int64 -} - -// sizeHistogram contains keySize histogram and valueSize histogram -type sizeHistogram struct { - keySizeHistogram, valueSizeHistogram histogramData -} - -// newSizeHistogram returns a new instance of keyValueSizeHistogram with -// properly initialized fields. -func newSizeHistogram() *sizeHistogram { - // TODO(ibrahim): find appropriate bin size. - keyBins := createHistogramBins(1, 16) - valueBins := createHistogramBins(1, 30) - return &sizeHistogram{ - keySizeHistogram: histogramData{ - bins: keyBins, - countPerBin: make([]int64, len(keyBins)+1), - max: math.MinInt64, - min: math.MaxInt64, - sum: 0, - }, - valueSizeHistogram: histogramData{ - bins: valueBins, - countPerBin: make([]int64, len(valueBins)+1), - max: math.MinInt64, - min: math.MaxInt64, - sum: 0, - }, - } -} - -// createHistogramBins creates bins for an histogram. The bin sizes are powers -// of two of the form [2^min_exponent, ..., 2^max_exponent]. -func createHistogramBins(minExponent, maxExponent uint32) []int64 { - var bins []int64 - for i := minExponent; i <= maxExponent; i++ { - bins = append(bins, int64(1)< histogram.max { - histogram.max = value - } - if value < histogram.min { - histogram.min = value - } - - histogram.sum += value - histogram.totalCount++ - - for index := 0; index <= len(histogram.bins); index++ { - // Allocate value in the last buckets if we reached the end of the Bounds array. - if index == len(histogram.bins) { - histogram.countPerBin[index]++ - break - } - - // Check if the value should be added to the "index" bin - if value < int64(histogram.bins[index]) { - histogram.countPerBin[index]++ - break - } - } -} - -// buildHistogram builds the key-value size histogram. -// When keyPrefix is set, only the keys that have prefix "keyPrefix" are -// considered for creating the histogram -func (db *DB) buildHistogram(keyPrefix []byte) *sizeHistogram { - txn := db.NewTransaction(false) - defer txn.Discard() - - itr := txn.NewIterator(DefaultIteratorOptions) - defer itr.Close() - - badgerHistogram := newSizeHistogram() - - // Collect key and value sizes. - for itr.Seek(keyPrefix); itr.ValidForPrefix(keyPrefix); itr.Next() { - item := itr.Item() - badgerHistogram.keySizeHistogram.Update(item.KeySize()) - badgerHistogram.valueSizeHistogram.Update(item.ValueSize()) - } - return badgerHistogram -} - -// printHistogram prints the histogram data in a human-readable format. -func (histogram histogramData) printHistogram() { - fmt.Printf("Total count: %d\n", histogram.totalCount) - fmt.Printf("Min value: %d\n", histogram.min) - fmt.Printf("Max value: %d\n", histogram.max) - fmt.Printf("Mean: %.2f\n", float64(histogram.sum)/float64(histogram.totalCount)) - fmt.Printf("%24s %9s\n", "Range", "Count") - - numBins := len(histogram.bins) - for index, count := range histogram.countPerBin { - if count == 0 { - continue - } - - // The last bin represents the bin that contains the range from - // the last bin up to infinity so it's processed differently than the - // other bins. - if index == len(histogram.countPerBin)-1 { - lowerBound := int(histogram.bins[numBins-1]) - fmt.Printf("[%10d, %10s) %9d\n", lowerBound, "infinity", count) - continue - } - - upperBound := int(histogram.bins[index]) - lowerBound := 0 - if index > 0 { - lowerBound = int(histogram.bins[index-1]) - } - - fmt.Printf("[%10d, %10d) %9d\n", lowerBound, upperBound, count) - } - fmt.Println() -} diff --git a/vendor/github.com/dgraph-io/badger/iterator.go b/vendor/github.com/dgraph-io/badger/iterator.go deleted file mode 100644 index c071324d..00000000 --- a/vendor/github.com/dgraph-io/badger/iterator.go +++ /dev/null @@ -1,684 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "fmt" - "hash/crc32" - "sync" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/options" - "github.com/dgraph-io/badger/table" - - "github.com/dgraph-io/badger/y" -) - -type prefetchStatus uint8 - -const ( - prefetched prefetchStatus = iota + 1 -) - -// Item is returned during iteration. Both the Key() and Value() output is only valid until -// iterator.Next() is called. -type Item struct { - status prefetchStatus - err error - wg sync.WaitGroup - db *DB - key []byte - vptr []byte - meta byte // We need to store meta to know about bitValuePointer. - userMeta byte - expiresAt uint64 - val []byte - slice *y.Slice // Used only during prefetching. - next *Item - version uint64 - txn *Txn -} - -// String returns a string representation of Item -func (item *Item) String() string { - return fmt.Sprintf("key=%q, version=%d, meta=%x", item.Key(), item.Version(), item.meta) -} - -// Key returns the key. -// -// Key is only valid as long as item is valid, or transaction is valid. If you need to use it -// outside its validity, please use KeyCopy. -func (item *Item) Key() []byte { - return item.key -} - -// KeyCopy returns a copy of the key of the item, writing it to dst slice. -// If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and -// returned. -func (item *Item) KeyCopy(dst []byte) []byte { - return y.SafeCopy(dst, item.key) -} - -// Version returns the commit timestamp of the item. -func (item *Item) Version() uint64 { - return item.version -} - -// Value retrieves the value of the item from the value log. -// -// This method must be called within a transaction. Calling it outside a -// transaction is considered undefined behavior. If an iterator is being used, -// then Item.Value() is defined in the current iteration only, because items are -// reused. -// -// If you need to use a value outside a transaction, please use Item.ValueCopy -// instead, or copy it yourself. Value might change once discard or commit is called. -// Use ValueCopy if you want to do a Set after Get. -func (item *Item) Value(fn func(val []byte) error) error { - item.wg.Wait() - if item.status == prefetched { - if item.err == nil && fn != nil { - if err := fn(item.val); err != nil { - return err - } - } - return item.err - } - buf, cb, err := item.yieldItemValue() - defer runCallback(cb) - if err != nil { - return err - } - if fn != nil { - return fn(buf) - } - return nil -} - -// ValueCopy returns a copy of the value of the item from the value log, writing it to dst slice. -// If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and -// returned. Tip: It might make sense to reuse the returned slice as dst argument for the next call. -// -// This function is useful in long running iterate/update transactions to avoid a write deadlock. -// See Github issue: https://github.com/dgraph-io/badger/issues/315 -func (item *Item) ValueCopy(dst []byte) ([]byte, error) { - item.wg.Wait() - if item.status == prefetched { - return y.SafeCopy(dst, item.val), item.err - } - buf, cb, err := item.yieldItemValue() - defer runCallback(cb) - return y.SafeCopy(dst, buf), err -} - -func (item *Item) hasValue() bool { - if item.meta == 0 && item.vptr == nil { - // key not found - return false - } - return true -} - -// IsDeletedOrExpired returns true if item contains deleted or expired value. -func (item *Item) IsDeletedOrExpired() bool { - return isDeletedOrExpired(item.meta, item.expiresAt) -} - -// DiscardEarlierVersions returns whether the item was created with the -// option to discard earlier versions of a key when multiple are available. -func (item *Item) DiscardEarlierVersions() bool { - return item.meta&bitDiscardEarlierVersions > 0 -} - -func (item *Item) yieldItemValue() ([]byte, func(), error) { - key := item.Key() // No need to copy. - for { - if !item.hasValue() { - return nil, nil, nil - } - - if item.slice == nil { - item.slice = new(y.Slice) - } - - if (item.meta & bitValuePointer) == 0 { - val := item.slice.Resize(len(item.vptr)) - copy(val, item.vptr) - return val, nil, nil - } - - var vp valuePointer - vp.Decode(item.vptr) - result, cb, err := item.db.vlog.Read(vp, item.slice) - if err != ErrRetry { - return result, cb, err - } - if bytes.HasPrefix(key, badgerMove) { - // err == ErrRetry - // Error is retry even after checking the move keyspace. So, let's - // just assume that value is not present. - return nil, cb, nil - } - - // The value pointer is pointing to a deleted value log. Look for the - // move key and read that instead. - runCallback(cb) - // Do not put badgerMove on the left in append. It seems to cause some sort of manipulation. - keyTs := y.KeyWithTs(item.Key(), item.Version()) - key = make([]byte, len(badgerMove)+len(keyTs)) - n := copy(key, badgerMove) - copy(key[n:], keyTs) - // Note that we can't set item.key to move key, because that would - // change the key user sees before and after this call. Also, this move - // logic is internal logic and should not impact the external behavior - // of the retrieval. - vs, err := item.db.get(key) - if err != nil { - return nil, nil, err - } - if vs.Version != item.Version() { - return nil, nil, nil - } - // Bug fix: Always copy the vs.Value into vptr here. Otherwise, when item is reused this - // slice gets overwritten. - item.vptr = y.SafeCopy(item.vptr, vs.Value) - item.meta &^= bitValuePointer // Clear the value pointer bit. - if vs.Meta&bitValuePointer > 0 { - item.meta |= bitValuePointer // This meta would only be about value pointer. - } - } -} - -func runCallback(cb func()) { - if cb != nil { - cb() - } -} - -func (item *Item) prefetchValue() { - val, cb, err := item.yieldItemValue() - defer runCallback(cb) - - item.err = err - item.status = prefetched - if val == nil { - return - } - if item.db.opt.ValueLogLoadingMode == options.MemoryMap { - buf := item.slice.Resize(len(val)) - copy(buf, val) - item.val = buf - } else { - item.val = val - } -} - -// EstimatedSize returns the approximate size of the key-value pair. -// -// This can be called while iterating through a store to quickly estimate the -// size of a range of key-value pairs (without fetching the corresponding -// values). -func (item *Item) EstimatedSize() int64 { - if !item.hasValue() { - return 0 - } - if (item.meta & bitValuePointer) == 0 { - return int64(len(item.key) + len(item.vptr)) - } - var vp valuePointer - vp.Decode(item.vptr) - return int64(vp.Len) // includes key length. -} - -// KeySize returns the size of the key. -// Exact size of the key is key + 8 bytes of timestamp -func (item *Item) KeySize() int64 { - return int64(len(item.key)) -} - -// ValueSize returns the exact size of the value. -// -// This can be called to quickly estimate the size of a value without fetching -// it. -func (item *Item) ValueSize() int64 { - if !item.hasValue() { - return 0 - } - if (item.meta & bitValuePointer) == 0 { - return int64(len(item.vptr)) - } - var vp valuePointer - vp.Decode(item.vptr) - - klen := int64(len(item.key) + 8) // 8 bytes for timestamp. - return int64(vp.Len) - klen - headerBufSize - crc32.Size -} - -// UserMeta returns the userMeta set by the user. Typically, this byte, optionally set by the user -// is used to interpret the value. -func (item *Item) UserMeta() byte { - return item.userMeta -} - -// ExpiresAt returns a Unix time value indicating when the item will be -// considered expired. 0 indicates that the item will never expire. -func (item *Item) ExpiresAt() uint64 { - return item.expiresAt -} - -// TODO: Switch this to use linked list container in Go. -type list struct { - head *Item - tail *Item -} - -func (l *list) push(i *Item) { - i.next = nil - if l.tail == nil { - l.head = i - l.tail = i - return - } - l.tail.next = i - l.tail = i -} - -func (l *list) pop() *Item { - if l.head == nil { - return nil - } - i := l.head - if l.head == l.tail { - l.tail = nil - l.head = nil - } else { - l.head = i.next - } - i.next = nil - return i -} - -// IteratorOptions is used to set options when iterating over Badger key-value -// stores. -// -// This package provides DefaultIteratorOptions which contains options that -// should work for most applications. Consider using that as a starting point -// before customizing it for your own needs. -type IteratorOptions struct { - // Indicates whether we should prefetch values during iteration and store them. - PrefetchValues bool - // How many KV pairs to prefetch while iterating. Valid only if PrefetchValues is true. - PrefetchSize int - Reverse bool // Direction of iteration. False is forward, true is backward. - AllVersions bool // Fetch all valid versions of the same key. - - // The following option is used to narrow down the SSTables that iterator picks up. If - // Prefix is specified, only tables which could have this prefix are picked based on their range - // of keys. - Prefix []byte // Only iterate over this given prefix. - prefixIsKey bool // If set, use the prefix for bloom filter lookup. - - internalAccess bool // Used to allow internal access to badger keys. -} - -func (opt *IteratorOptions) pickTable(t table.TableInterface) bool { - if len(opt.Prefix) == 0 { - return true - } - trim := func(key []byte) []byte { - if len(key) > len(opt.Prefix) { - return key[:len(opt.Prefix)] - } - return key - } - if bytes.Compare(trim(t.Smallest()), opt.Prefix) > 0 { - return false - } - if bytes.Compare(trim(t.Biggest()), opt.Prefix) < 0 { - return false - } - // Bloom filter lookup would only work if opt.Prefix does NOT have the read - // timestamp as part of the key. - if opt.prefixIsKey && t.DoesNotHave(opt.Prefix) { - return false - } - return true -} - -// DefaultIteratorOptions contains default options when iterating over Badger key-value stores. -var DefaultIteratorOptions = IteratorOptions{ - PrefetchValues: true, - PrefetchSize: 100, - Reverse: false, - AllVersions: false, -} - -// Iterator helps iterating over the KV pairs in a lexicographically sorted order. -type Iterator struct { - iitr *y.MergeIterator - txn *Txn - readTs uint64 - - opt IteratorOptions - item *Item - data list - waste list - - lastKey []byte // Used to skip over multiple versions of the same key. - - closed bool -} - -// NewIterator returns a new iterator. Depending upon the options, either only keys, or both -// key-value pairs would be fetched. The keys are returned in lexicographically sorted order. -// Using prefetch is recommended if you're doing a long running iteration, for performance. -// -// Multiple Iterators: -// For a read-only txn, multiple iterators can be running simultaneously. However, for a read-write -// txn, only one can be running at one time to avoid race conditions, because Txn is thread-unsafe. -func (txn *Txn) NewIterator(opt IteratorOptions) *Iterator { - if txn.discarded { - panic("Transaction has already been discarded") - } - // Do not change the order of the next if. We must track the number of running iterators. - if atomic.AddInt32(&txn.numIterators, 1) > 1 && txn.update { - atomic.AddInt32(&txn.numIterators, -1) - panic("Only one iterator can be active at one time, for a RW txn.") - } - - // TODO: If Prefix is set, only pick those memtables which have keys with - // the prefix. - tables, decr := txn.db.getMemTables() - defer decr() - txn.db.vlog.incrIteratorCount() - var iters []y.Iterator - if itr := txn.newPendingWritesIterator(opt.Reverse); itr != nil { - iters = append(iters, itr) - } - for i := 0; i < len(tables); i++ { - iters = append(iters, tables[i].NewUniIterator(opt.Reverse)) - } - iters = txn.db.lc.appendIterators(iters, &opt) // This will increment references. - res := &Iterator{ - txn: txn, - iitr: y.NewMergeIterator(iters, opt.Reverse), - opt: opt, - readTs: txn.readTs, - } - return res -} - -// NewKeyIterator is just like NewIterator, but allows the user to iterate over all versions of a -// single key. Internally, it sets the Prefix option in provided opt, and uses that prefix to -// additionally run bloom filter lookups before picking tables from the LSM tree. -func (txn *Txn) NewKeyIterator(key []byte, opt IteratorOptions) *Iterator { - if len(opt.Prefix) > 0 { - panic("opt.Prefix should be nil for NewKeyIterator.") - } - opt.Prefix = key // This key must be without the timestamp. - opt.prefixIsKey = true - return txn.NewIterator(opt) -} - -func (it *Iterator) newItem() *Item { - item := it.waste.pop() - if item == nil { - item = &Item{slice: new(y.Slice), db: it.txn.db, txn: it.txn} - } - return item -} - -// Item returns pointer to the current key-value pair. -// This item is only valid until it.Next() gets called. -func (it *Iterator) Item() *Item { - tx := it.txn - tx.addReadKey(it.item.Key()) - return it.item -} - -// Valid returns false when iteration is done. -func (it *Iterator) Valid() bool { - if it.item == nil { - return false - } - return bytes.HasPrefix(it.item.key, it.opt.Prefix) -} - -// ValidForPrefix returns false when iteration is done -// or when the current key is not prefixed by the specified prefix. -func (it *Iterator) ValidForPrefix(prefix []byte) bool { - return it.Valid() && bytes.HasPrefix(it.item.key, prefix) -} - -// Close would close the iterator. It is important to call this when you're done with iteration. -func (it *Iterator) Close() { - if it.closed { - return - } - it.closed = true - - it.iitr.Close() - // It is important to wait for the fill goroutines to finish. Otherwise, we might leave zombie - // goroutines behind, which are waiting to acquire file read locks after DB has been closed. - waitFor := func(l list) { - item := l.pop() - for item != nil { - item.wg.Wait() - item = l.pop() - } - } - waitFor(it.waste) - waitFor(it.data) - - // TODO: We could handle this error. - _ = it.txn.db.vlog.decrIteratorCount() - atomic.AddInt32(&it.txn.numIterators, -1) -} - -// Next would advance the iterator by one. Always check it.Valid() after a Next() -// to ensure you have access to a valid it.Item(). -func (it *Iterator) Next() { - // Reuse current item - it.item.wg.Wait() // Just cleaner to wait before pushing to avoid doing ref counting. - it.waste.push(it.item) - - // Set next item to current - it.item = it.data.pop() - - for it.iitr.Valid() { - if it.parseItem() { - // parseItem calls one extra next. - // This is used to deal with the complexity of reverse iteration. - break - } - } -} - -func isDeletedOrExpired(meta byte, expiresAt uint64) bool { - if meta&bitDelete > 0 { - return true - } - if expiresAt == 0 { - return false - } - return expiresAt <= uint64(time.Now().Unix()) -} - -// parseItem is a complex function because it needs to handle both forward and reverse iteration -// implementation. We store keys such that their versions are sorted in descending order. This makes -// forward iteration efficient, but revese iteration complicated. This tradeoff is better because -// forward iteration is more common than reverse. -// -// This function advances the iterator. -func (it *Iterator) parseItem() bool { - mi := it.iitr - key := mi.Key() - - setItem := func(item *Item) { - if it.item == nil { - it.item = item - } else { - it.data.push(item) - } - } - - // Skip badger keys. - if !it.opt.internalAccess && bytes.HasPrefix(key, badgerPrefix) { - mi.Next() - return false - } - - // Skip any versions which are beyond the readTs. - version := y.ParseTs(key) - if version > it.readTs { - mi.Next() - return false - } - - if it.opt.AllVersions { - // Return deleted or expired values also, otherwise user can't figure out - // whether the key was deleted. - item := it.newItem() - it.fill(item) - setItem(item) - mi.Next() - return true - } - - // If iterating in forward direction, then just checking the last key against current key would - // be sufficient. - if !it.opt.Reverse { - if y.SameKey(it.lastKey, key) { - mi.Next() - return false - } - // Only track in forward direction. - // We should update lastKey as soon as we find a different key in our snapshot. - // Consider keys: a 5, b 7 (del), b 5. When iterating, lastKey = a. - // Then we see b 7, which is deleted. If we don't store lastKey = b, we'll then return b 5, - // which is wrong. Therefore, update lastKey here. - it.lastKey = y.SafeCopy(it.lastKey, mi.Key()) - } - -FILL: - // If deleted, advance and return. - vs := mi.Value() - if isDeletedOrExpired(vs.Meta, vs.ExpiresAt) { - mi.Next() - return false - } - - item := it.newItem() - it.fill(item) - // fill item based on current cursor position. All Next calls have returned, so reaching here - // means no Next was called. - - mi.Next() // Advance but no fill item yet. - if !it.opt.Reverse || !mi.Valid() { // Forward direction, or invalid. - setItem(item) - return true - } - - // Reverse direction. - nextTs := y.ParseTs(mi.Key()) - mik := y.ParseKey(mi.Key()) - if nextTs <= it.readTs && bytes.Equal(mik, item.key) { - // This is a valid potential candidate. - goto FILL - } - // Ignore the next candidate. Return the current one. - setItem(item) - return true -} - -func (it *Iterator) fill(item *Item) { - vs := it.iitr.Value() - item.meta = vs.Meta - item.userMeta = vs.UserMeta - item.expiresAt = vs.ExpiresAt - - item.version = y.ParseTs(it.iitr.Key()) - item.key = y.SafeCopy(item.key, y.ParseKey(it.iitr.Key())) - - item.vptr = y.SafeCopy(item.vptr, vs.Value) - item.val = nil - if it.opt.PrefetchValues { - item.wg.Add(1) - go func() { - // FIXME we are not handling errors here. - item.prefetchValue() - item.wg.Done() - }() - } -} - -func (it *Iterator) prefetch() { - prefetchSize := 2 - if it.opt.PrefetchValues && it.opt.PrefetchSize > 1 { - prefetchSize = it.opt.PrefetchSize - } - - i := it.iitr - var count int - it.item = nil - for i.Valid() { - if !it.parseItem() { - continue - } - count++ - if count == prefetchSize { - break - } - } -} - -// Seek would seek to the provided key if present. If absent, it would seek to the next smallest key -// greater than the provided key if iterating in the forward direction. Behavior would be reversed if -// iterating backwards. -func (it *Iterator) Seek(key []byte) { - for i := it.data.pop(); i != nil; i = it.data.pop() { - i.wg.Wait() - it.waste.push(i) - } - - it.lastKey = it.lastKey[:0] - if len(key) == 0 { - key = it.opt.Prefix - } - if len(key) == 0 { - it.iitr.Rewind() - it.prefetch() - return - } - - if !it.opt.Reverse { - key = y.KeyWithTs(key, it.txn.readTs) - } else { - key = y.KeyWithTs(key, 0) - } - it.iitr.Seek(key) - it.prefetch() -} - -// Rewind would rewind the iterator cursor all the way to zero-th position, which would be the -// smallest key if iterating forward, and largest if iterating backward. It does not keep track of -// whether the cursor started with a Seek(). -func (it *Iterator) Rewind() { - it.Seek(nil) -} diff --git a/vendor/github.com/dgraph-io/badger/level_handler.go b/vendor/github.com/dgraph-io/badger/level_handler.go deleted file mode 100644 index 147967fb..00000000 --- a/vendor/github.com/dgraph-io/badger/level_handler.go +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "fmt" - "sort" - "sync" - - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -type levelHandler struct { - // Guards tables, totalSize. - sync.RWMutex - - // For level >= 1, tables are sorted by key ranges, which do not overlap. - // For level 0, tables are sorted by time. - // For level 0, newest table are at the back. Compact the oldest one first, which is at the front. - tables []*table.Table - totalSize int64 - - // The following are initialized once and const. - level int - strLevel string - maxTotalSize int64 - db *DB -} - -func (s *levelHandler) getTotalSize() int64 { - s.RLock() - defer s.RUnlock() - return s.totalSize -} - -// initTables replaces s.tables with given tables. This is done during loading. -func (s *levelHandler) initTables(tables []*table.Table) { - s.Lock() - defer s.Unlock() - - s.tables = tables - s.totalSize = 0 - for _, t := range tables { - s.totalSize += t.Size() - } - - if s.level == 0 { - // Key range will overlap. Just sort by fileID in ascending order - // because newer tables are at the end of level 0. - sort.Slice(s.tables, func(i, j int) bool { - return s.tables[i].ID() < s.tables[j].ID() - }) - } else { - // Sort tables by keys. - sort.Slice(s.tables, func(i, j int) bool { - return y.CompareKeys(s.tables[i].Smallest(), s.tables[j].Smallest()) < 0 - }) - } -} - -// deleteTables remove tables idx0, ..., idx1-1. -func (s *levelHandler) deleteTables(toDel []*table.Table) error { - s.Lock() // s.Unlock() below - - toDelMap := make(map[uint64]struct{}) - for _, t := range toDel { - toDelMap[t.ID()] = struct{}{} - } - - // Make a copy as iterators might be keeping a slice of tables. - var newTables []*table.Table - for _, t := range s.tables { - _, found := toDelMap[t.ID()] - if !found { - newTables = append(newTables, t) - continue - } - s.totalSize -= t.Size() - } - s.tables = newTables - - s.Unlock() // Unlock s _before_ we DecrRef our tables, which can be slow. - - return decrRefs(toDel) -} - -// replaceTables will replace tables[left:right] with newTables. Note this EXCLUDES tables[right]. -// You must call decr() to delete the old tables _after_ writing the update to the manifest. -func (s *levelHandler) replaceTables(toDel, toAdd []*table.Table) error { - // Need to re-search the range of tables in this level to be replaced as other goroutines might - // be changing it as well. (They can't touch our tables, but if they add/remove other tables, - // the indices get shifted around.) - s.Lock() // We s.Unlock() below. - - toDelMap := make(map[uint64]struct{}) - for _, t := range toDel { - toDelMap[t.ID()] = struct{}{} - } - var newTables []*table.Table - for _, t := range s.tables { - _, found := toDelMap[t.ID()] - if !found { - newTables = append(newTables, t) - continue - } - s.totalSize -= t.Size() - } - - // Increase totalSize first. - for _, t := range toAdd { - s.totalSize += t.Size() - t.IncrRef() - newTables = append(newTables, t) - } - - // Assign tables. - s.tables = newTables - sort.Slice(s.tables, func(i, j int) bool { - return y.CompareKeys(s.tables[i].Smallest(), s.tables[j].Smallest()) < 0 - }) - s.Unlock() // s.Unlock before we DecrRef tables -- that can be slow. - return decrRefs(toDel) -} - -func decrRefs(tables []*table.Table) error { - for _, table := range tables { - if err := table.DecrRef(); err != nil { - return err - } - } - return nil -} - -func newLevelHandler(db *DB, level int) *levelHandler { - return &levelHandler{ - level: level, - strLevel: fmt.Sprintf("l%d", level), - db: db, - } -} - -// tryAddLevel0Table returns true if ok and no stalling. -func (s *levelHandler) tryAddLevel0Table(t *table.Table) bool { - y.AssertTrue(s.level == 0) - // Need lock as we may be deleting the first table during a level 0 compaction. - s.Lock() - defer s.Unlock() - if len(s.tables) >= s.db.opt.NumLevelZeroTablesStall { - return false - } - - s.tables = append(s.tables, t) - t.IncrRef() - s.totalSize += t.Size() - - return true -} - -func (s *levelHandler) numTables() int { - s.RLock() - defer s.RUnlock() - return len(s.tables) -} - -func (s *levelHandler) close() error { - s.RLock() - defer s.RUnlock() - var err error - for _, t := range s.tables { - if closeErr := t.Close(); closeErr != nil && err == nil { - err = closeErr - } - } - return errors.Wrap(err, "levelHandler.close") -} - -// getTableForKey acquires a read-lock to access s.tables. It returns a list of tableHandlers. -func (s *levelHandler) getTableForKey(key []byte) ([]*table.Table, func() error) { - s.RLock() - defer s.RUnlock() - - if s.level == 0 { - // For level 0, we need to check every table. Remember to make a copy as s.tables may change - // once we exit this function, and we don't want to lock s.tables while seeking in tables. - // CAUTION: Reverse the tables. - out := make([]*table.Table, 0, len(s.tables)) - for i := len(s.tables) - 1; i >= 0; i-- { - out = append(out, s.tables[i]) - s.tables[i].IncrRef() - } - return out, func() error { - for _, t := range out { - if err := t.DecrRef(); err != nil { - return err - } - } - return nil - } - } - // For level >= 1, we can do a binary search as key range does not overlap. - idx := sort.Search(len(s.tables), func(i int) bool { - return y.CompareKeys(s.tables[i].Biggest(), key) >= 0 - }) - if idx >= len(s.tables) { - // Given key is strictly > than every element we have. - return nil, func() error { return nil } - } - tbl := s.tables[idx] - tbl.IncrRef() - return []*table.Table{tbl}, tbl.DecrRef -} - -// get returns value for a given key or the key after that. If not found, return nil. -func (s *levelHandler) get(key []byte) (y.ValueStruct, error) { - tables, decr := s.getTableForKey(key) - keyNoTs := y.ParseKey(key) - - var maxVs y.ValueStruct - for _, th := range tables { - if th.DoesNotHave(keyNoTs) { - y.NumLSMBloomHits.Add(s.strLevel, 1) - continue - } - - it := th.NewIterator(false) - defer it.Close() - - y.NumLSMGets.Add(s.strLevel, 1) - it.Seek(key) - if !it.Valid() { - continue - } - if y.SameKey(key, it.Key()) { - if version := y.ParseTs(it.Key()); maxVs.Version < version { - maxVs = it.Value() - maxVs.Version = version - } - } - } - return maxVs, decr() -} - -// appendIterators appends iterators to an array of iterators, for merging. -// Note: This obtains references for the table handlers. Remember to close these iterators. -func (s *levelHandler) appendIterators(iters []y.Iterator, opt *IteratorOptions) []y.Iterator { - s.RLock() - defer s.RUnlock() - - tables := make([]*table.Table, 0, len(s.tables)) - for _, t := range s.tables { - if opt.pickTable(t) { - tables = append(tables, t) - } - } - if len(tables) == 0 { - return iters - } - - if s.level == 0 { - // Remember to add in reverse order! - // The newer table at the end of s.tables should be added first as it takes precedence. - return appendIteratorsReversed(iters, tables, opt.Reverse) - } - return append(iters, table.NewConcatIterator(tables, opt.Reverse)) -} - -type levelHandlerRLocked struct{} - -// overlappingTables returns the tables that intersect with key range. Returns a half-interval. -// This function should already have acquired a read lock, and this is so important the caller must -// pass an empty parameter declaring such. -func (s *levelHandler) overlappingTables(_ levelHandlerRLocked, kr keyRange) (int, int) { - if len(kr.left) == 0 || len(kr.right) == 0 { - return 0, 0 - } - left := sort.Search(len(s.tables), func(i int) bool { - return y.CompareKeys(kr.left, s.tables[i].Biggest()) <= 0 - }) - right := sort.Search(len(s.tables), func(i int) bool { - return y.CompareKeys(kr.right, s.tables[i].Smallest()) < 0 - }) - return left, right -} diff --git a/vendor/github.com/dgraph-io/badger/levels.go b/vendor/github.com/dgraph-io/badger/levels.go deleted file mode 100644 index df90164c..00000000 --- a/vendor/github.com/dgraph-io/badger/levels.go +++ /dev/null @@ -1,986 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "fmt" - "math" - "math/rand" - "os" - "sort" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/trace" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -type levelsController struct { - nextFileID uint64 // Atomic - elog trace.EventLog - - // The following are initialized once and const. - levels []*levelHandler - kv *DB - - cstatus compactStatus -} - -var ( - // This is for getting timings between stalls. - lastUnstalled time.Time -) - -// revertToManifest checks that all necessary table files exist and removes all table files not -// referenced by the manifest. idMap is a set of table file id's that were read from the directory -// listing. -func revertToManifest(kv *DB, mf *Manifest, idMap map[uint64]struct{}) error { - // 1. Check all files in manifest exist. - for id := range mf.Tables { - if _, ok := idMap[id]; !ok { - return fmt.Errorf("file does not exist for table %d", id) - } - } - - // 2. Delete files that shouldn't exist. - for id := range idMap { - if _, ok := mf.Tables[id]; !ok { - kv.elog.Printf("Table file %d not referenced in MANIFEST\n", id) - filename := table.NewFilename(id, kv.opt.Dir) - if err := os.Remove(filename); err != nil { - return y.Wrapf(err, "While removing table %d", id) - } - } - } - - return nil -} - -func newLevelsController(db *DB, mf *Manifest) (*levelsController, error) { - y.AssertTrue(db.opt.NumLevelZeroTablesStall > db.opt.NumLevelZeroTables) - s := &levelsController{ - kv: db, - elog: db.elog, - levels: make([]*levelHandler, db.opt.MaxLevels), - } - s.cstatus.levels = make([]*levelCompactStatus, db.opt.MaxLevels) - - for i := 0; i < db.opt.MaxLevels; i++ { - s.levels[i] = newLevelHandler(db, i) - if i == 0 { - // Do nothing. - } else if i == 1 { - // Level 1 probably shouldn't be too much bigger than level 0. - s.levels[i].maxTotalSize = db.opt.LevelOneSize - } else { - s.levels[i].maxTotalSize = s.levels[i-1].maxTotalSize * int64(db.opt.LevelSizeMultiplier) - } - s.cstatus.levels[i] = new(levelCompactStatus) - } - - // Compare manifest against directory, check for existent/non-existent files, and remove. - if err := revertToManifest(db, mf, getIDMap(db.opt.Dir)); err != nil { - return nil, err - } - - // Some files may be deleted. Let's reload. - var flags uint32 = y.Sync - if db.opt.ReadOnly { - flags |= y.ReadOnly - } - - var mu sync.Mutex - tables := make([][]*table.Table, db.opt.MaxLevels) - var maxFileID uint64 - - // We found that using 3 goroutines allows disk throughput to be utilized to its max. - // Disk utilization is the main thing we should focus on, while trying to read the data. That's - // the one factor that remains constant between HDD and SSD. - throttle := y.NewThrottle(3) - - start := time.Now() - var numOpened int32 - tick := time.NewTicker(3 * time.Second) - defer tick.Stop() - - for fileID, tf := range mf.Tables { - fname := table.NewFilename(fileID, db.opt.Dir) - select { - case <-tick.C: - db.opt.Infof("%d tables out of %d opened in %s\n", atomic.LoadInt32(&numOpened), - len(mf.Tables), time.Since(start).Round(time.Millisecond)) - default: - } - if err := throttle.Do(); err != nil { - closeAllTables(tables) - return nil, err - } - if fileID > maxFileID { - maxFileID = fileID - } - go func(fname string, tf TableManifest) { - var rerr error - defer func() { - throttle.Done(rerr) - atomic.AddInt32(&numOpened, 1) - }() - fd, err := y.OpenExistingFile(fname, flags) - if err != nil { - rerr = errors.Wrapf(err, "Opening file: %q", fname) - return - } - - t, err := table.OpenTable(fd, db.opt.TableLoadingMode, tf.Checksum) - if err != nil { - if strings.HasPrefix(err.Error(), "CHECKSUM_MISMATCH:") { - db.opt.Errorf(err.Error()) - db.opt.Errorf("Ignoring table %s", fd.Name()) - // Do not set rerr. We will continue without this table. - } else { - rerr = errors.Wrapf(err, "Opening table: %q", fname) - } - return - } - - mu.Lock() - tables[tf.Level] = append(tables[tf.Level], t) - mu.Unlock() - }(fname, tf) - } - if err := throttle.Finish(); err != nil { - closeAllTables(tables) - return nil, err - } - db.opt.Infof("All %d tables opened in %s\n", atomic.LoadInt32(&numOpened), - time.Since(start).Round(time.Millisecond)) - s.nextFileID = maxFileID + 1 - for i, tbls := range tables { - s.levels[i].initTables(tbls) - } - - // Make sure key ranges do not overlap etc. - if err := s.validate(); err != nil { - _ = s.cleanupLevels() - return nil, errors.Wrap(err, "Level validation") - } - - // Sync directory (because we have at least removed some files, or previously created the - // manifest file). - if err := syncDir(db.opt.Dir); err != nil { - _ = s.close() - return nil, err - } - - return s, nil -} - -// Closes the tables, for cleanup in newLevelsController. (We Close() instead of using DecrRef() -// because that would delete the underlying files.) We ignore errors, which is OK because tables -// are read-only. -func closeAllTables(tables [][]*table.Table) { - for _, tableSlice := range tables { - for _, table := range tableSlice { - _ = table.Close() - } - } -} - -func (s *levelsController) cleanupLevels() error { - var firstErr error - for _, l := range s.levels { - if err := l.close(); err != nil && firstErr == nil { - firstErr = err - } - } - return firstErr -} - -// dropTree picks all tables from all levels, creates a manifest changeset, -// applies it, and then decrements the refs of these tables, which would result -// in their deletion. -func (s *levelsController) dropTree() (int, error) { - // First pick all tables, so we can create a manifest changelog. - var all []*table.Table - for _, l := range s.levels { - l.RLock() - all = append(all, l.tables...) - l.RUnlock() - } - if len(all) == 0 { - return 0, nil - } - - // Generate the manifest changes. - changes := []*pb.ManifestChange{} - for _, table := range all { - changes = append(changes, newDeleteChange(table.ID())) - } - changeSet := pb.ManifestChangeSet{Changes: changes} - if err := s.kv.manifest.addChanges(changeSet.Changes); err != nil { - return 0, err - } - - // Now that manifest has been successfully written, we can delete the tables. - for _, l := range s.levels { - l.Lock() - l.totalSize = 0 - l.tables = l.tables[:0] - l.Unlock() - } - for _, table := range all { - if err := table.DecrRef(); err != nil { - return 0, err - } - } - return len(all), nil -} - -// dropPrefix runs a L0->L1 compaction, and then runs same level compaction on the rest of the -// levels. For L0->L1 compaction, it runs compactions normally, but skips over all the keys with the -// provided prefix. For Li->Li compactions, it picks up the tables which would have the prefix. The -// tables who only have keys with this prefix are quickly dropped. The ones which have other keys -// are run through MergeIterator and compacted to create new tables. All the mechanisms of -// compactions apply, i.e. level sizes and MANIFEST are updated as in the normal flow. -func (s *levelsController) dropPrefix(prefix []byte) error { - opt := s.kv.opt - for _, l := range s.levels { - l.RLock() - if l.level == 0 { - size := len(l.tables) - l.RUnlock() - - if size > 0 { - cp := compactionPriority{ - level: 0, - score: 1.74, - // A unique number greater than 1.0 does two things. Helps identify this - // function in logs, and forces a compaction. - dropPrefix: prefix, - } - if err := s.doCompact(cp); err != nil { - opt.Warningf("While compacting level 0: %v", err) - return nil - } - } - continue - } - - var tables []*table.Table - for _, table := range l.tables { - var absent bool - switch { - case bytes.HasPrefix(table.Smallest(), prefix): - case bytes.HasPrefix(table.Biggest(), prefix): - case bytes.Compare(prefix, table.Smallest()) > 0 && - bytes.Compare(prefix, table.Biggest()) < 0: - default: - absent = true - } - if !absent { - tables = append(tables, table) - } - } - l.RUnlock() - if len(tables) == 0 { - continue - } - - cd := compactDef{ - elog: trace.New(fmt.Sprintf("Badger.L%d", l.level), "Compact"), - thisLevel: l, - nextLevel: l, - top: []*table.Table{}, - bot: tables, - dropPrefix: prefix, - } - if err := s.runCompactDef(l.level, cd); err != nil { - opt.Warningf("While running compact def: %+v. Error: %v", cd, err) - return err - } - } - return nil -} - -func (s *levelsController) startCompact(lc *y.Closer) { - n := s.kv.opt.NumCompactors - lc.AddRunning(n - 1) - for i := 0; i < n; i++ { - go s.runWorker(lc) - } -} - -func (s *levelsController) runWorker(lc *y.Closer) { - defer lc.Done() - - randomDelay := time.NewTimer(time.Duration(rand.Int31n(1000)) * time.Millisecond) - select { - case <-randomDelay.C: - case <-lc.HasBeenClosed(): - randomDelay.Stop() - return - } - - ticker := time.NewTicker(time.Second) - defer ticker.Stop() - - for { - select { - // Can add a done channel or other stuff. - case <-ticker.C: - prios := s.pickCompactLevels() - for _, p := range prios { - if err := s.doCompact(p); err == nil { - break - } else if err == errFillTables { - // pass - } else { - s.kv.opt.Warningf("While running doCompact: %v\n", err) - } - } - case <-lc.HasBeenClosed(): - return - } - } -} - -// Returns true if level zero may be compacted, without accounting for compactions that already -// might be happening. -func (s *levelsController) isLevel0Compactable() bool { - return s.levels[0].numTables() >= s.kv.opt.NumLevelZeroTables -} - -// Returns true if the non-zero level may be compacted. delSize provides the size of the tables -// which are currently being compacted so that we treat them as already having started being -// compacted (because they have been, yet their size is already counted in getTotalSize). -func (l *levelHandler) isCompactable(delSize int64) bool { - return l.getTotalSize()-delSize >= l.maxTotalSize -} - -type compactionPriority struct { - level int - score float64 - dropPrefix []byte -} - -// pickCompactLevel determines which level to compact. -// Based on: https://github.com/facebook/rocksdb/wiki/Leveled-Compaction -func (s *levelsController) pickCompactLevels() (prios []compactionPriority) { - // This function must use identical criteria for guaranteeing compaction's progress that - // addLevel0Table uses. - - // cstatus is checked to see if level 0's tables are already being compacted - if !s.cstatus.overlapsWith(0, infRange) && s.isLevel0Compactable() { - pri := compactionPriority{ - level: 0, - score: float64(s.levels[0].numTables()) / float64(s.kv.opt.NumLevelZeroTables), - } - prios = append(prios, pri) - } - - for i, l := range s.levels[1:] { - // Don't consider those tables that are already being compacted right now. - delSize := s.cstatus.delSize(i + 1) - - if l.isCompactable(delSize) { - pri := compactionPriority{ - level: i + 1, - score: float64(l.getTotalSize()-delSize) / float64(l.maxTotalSize), - } - prios = append(prios, pri) - } - } - sort.Slice(prios, func(i, j int) bool { - return prios[i].score > prios[j].score - }) - return prios -} - -// compactBuildTables merge topTables and botTables to form a list of new tables. -func (s *levelsController) compactBuildTables( - lev int, cd compactDef) ([]*table.Table, func() error, error) { - topTables := cd.top - botTables := cd.bot - - var hasOverlap bool - { - kr := getKeyRange(cd.top) - for i, lh := range s.levels { - if i <= lev { // Skip upper levels. - continue - } - lh.RLock() - left, right := lh.overlappingTables(levelHandlerRLocked{}, kr) - lh.RUnlock() - if right-left > 0 { - hasOverlap = true - break - } - } - } - - // Try to collect stats so that we can inform value log about GC. That would help us find which - // value log file should be GCed. - discardStats := make(map[uint32]int64) - updateStats := func(vs y.ValueStruct) { - if vs.Meta&bitValuePointer > 0 { - var vp valuePointer - vp.Decode(vs.Value) - discardStats[vp.Fid] += int64(vp.Len) - } - } - - // Create iterators across all the tables involved first. - var iters []y.Iterator - if lev == 0 { - iters = appendIteratorsReversed(iters, topTables, false) - } else if len(topTables) > 0 { - y.AssertTrue(len(topTables) == 1) - iters = []y.Iterator{topTables[0].NewIterator(false)} - } - - // Next level has level>=1 and we can use ConcatIterator as key ranges do not overlap. - var valid []*table.Table - for _, table := range botTables { - if len(cd.dropPrefix) > 0 && - bytes.HasPrefix(table.Smallest(), cd.dropPrefix) && - bytes.HasPrefix(table.Biggest(), cd.dropPrefix) { - // All the keys in this table have the dropPrefix. So, this table does not need to be - // in the iterator and can be dropped immediately. - continue - } - valid = append(valid, table) - } - iters = append(iters, table.NewConcatIterator(valid, false)) - it := y.NewMergeIterator(iters, false) - defer it.Close() // Important to close the iterator to do ref counting. - - it.Rewind() - - // Pick a discard ts, so we can discard versions below this ts. We should - // never discard any versions starting from above this timestamp, because - // that would affect the snapshot view guarantee provided by transactions. - discardTs := s.kv.orc.discardAtOrBelow() - - // Start generating new tables. - type newTableResult struct { - table *table.Table - err error - } - resultCh := make(chan newTableResult) - var numBuilds, numVersions int - var lastKey, skipKey []byte - for it.Valid() { - timeStart := time.Now() - builder := table.NewTableBuilder() - var numKeys, numSkips uint64 - for ; it.Valid(); it.Next() { - // See if we need to skip the prefix. - if len(cd.dropPrefix) > 0 && bytes.HasPrefix(it.Key(), cd.dropPrefix) { - numSkips++ - updateStats(it.Value()) - continue - } - - // See if we need to skip this key. - if len(skipKey) > 0 { - if y.SameKey(it.Key(), skipKey) { - numSkips++ - updateStats(it.Value()) - continue - } else { - skipKey = skipKey[:0] - } - } - - if !y.SameKey(it.Key(), lastKey) { - if builder.ReachedCapacity(s.kv.opt.MaxTableSize) { - // Only break if we are on a different key, and have reached capacity. We want - // to ensure that all versions of the key are stored in the same sstable, and - // not divided across multiple tables at the same level. - break - } - lastKey = y.SafeCopy(lastKey, it.Key()) - numVersions = 0 - } - - vs := it.Value() - version := y.ParseTs(it.Key()) - // Do not discard entries inserted by merge operator. These entries will be discarded once they're merged - if version <= discardTs && vs.Meta&bitMergeEntry == 0 { - // Keep track of the number of versions encountered for this key. Only consider the - // versions which are below the minReadTs, otherwise, we might end up discarding the - // only valid version for a running transaction. - numVersions++ - lastValidVersion := vs.Meta&bitDiscardEarlierVersions > 0 - if isDeletedOrExpired(vs.Meta, vs.ExpiresAt) || - numVersions > s.kv.opt.NumVersionsToKeep || - lastValidVersion { - // If this version of the key is deleted or expired, skip all the rest of the - // versions. Ensure that we're only removing versions below readTs. - skipKey = y.SafeCopy(skipKey, it.Key()) - - if lastValidVersion { - // Add this key. We have set skipKey, so the following key versions - // would be skipped. - } else if hasOverlap { - // If this key range has overlap with lower levels, then keep the deletion - // marker with the latest version, discarding the rest. We have set skipKey, - // so the following key versions would be skipped. - } else { - // If no overlap, we can skip all the versions, by continuing here. - numSkips++ - updateStats(vs) - continue // Skip adding this key. - } - } - } - numKeys++ - y.Check(builder.Add(it.Key(), it.Value())) - } - // It was true that it.Valid() at least once in the loop above, which means we - // called Add() at least once, and builder is not Empty(). - s.kv.opt.Debugf("LOG Compact. Added %d keys. Skipped %d keys. Iteration took: %v", - numKeys, numSkips, time.Since(timeStart)) - if !builder.Empty() { - numBuilds++ - fileID := s.reserveFileID() - go func(builder *table.Builder) { - defer builder.Close() - - fd, err := y.CreateSyncedFile(table.NewFilename(fileID, s.kv.opt.Dir), true) - if err != nil { - resultCh <- newTableResult{nil, errors.Wrapf(err, "While opening new table: %d", fileID)} - return - } - - if _, err := fd.Write(builder.Finish()); err != nil { - resultCh <- newTableResult{nil, errors.Wrapf(err, "Unable to write to file: %d", fileID)} - return - } - - tbl, err := table.OpenTable(fd, s.kv.opt.TableLoadingMode, nil) - // decrRef is added below. - resultCh <- newTableResult{tbl, errors.Wrapf(err, "Unable to open table: %q", fd.Name())} - }(builder) - } - } - - newTables := make([]*table.Table, 0, 20) - // Wait for all table builders to finish. - var firstErr error - for x := 0; x < numBuilds; x++ { - res := <-resultCh - newTables = append(newTables, res.table) - if firstErr == nil { - firstErr = res.err - } - } - - if firstErr == nil { - // Ensure created files' directory entries are visible. We don't mind the extra latency - // from not doing this ASAP after all file creation has finished because this is a - // background operation. - firstErr = syncDir(s.kv.opt.Dir) - } - - if firstErr != nil { - // An error happened. Delete all the newly created table files (by calling DecrRef - // -- we're the only holders of a ref). - for j := 0; j < numBuilds; j++ { - if newTables[j] != nil { - newTables[j].DecrRef() - } - } - errorReturn := errors.Wrapf(firstErr, "While running compaction for: %+v", cd) - return nil, nil, errorReturn - } - - sort.Slice(newTables, func(i, j int) bool { - return y.CompareKeys(newTables[i].Biggest(), newTables[j].Biggest()) < 0 - }) - s.kv.vlog.updateDiscardStats(discardStats) - s.kv.opt.Debugf("Discard stats: %v", discardStats) - return newTables, func() error { return decrRefs(newTables) }, nil -} - -func buildChangeSet(cd *compactDef, newTables []*table.Table) pb.ManifestChangeSet { - changes := []*pb.ManifestChange{} - for _, table := range newTables { - changes = append(changes, - newCreateChange(table.ID(), cd.nextLevel.level, table.Checksum)) - } - for _, table := range cd.top { - changes = append(changes, newDeleteChange(table.ID())) - } - for _, table := range cd.bot { - changes = append(changes, newDeleteChange(table.ID())) - } - return pb.ManifestChangeSet{Changes: changes} -} - -type compactDef struct { - elog trace.Trace - - thisLevel *levelHandler - nextLevel *levelHandler - - top []*table.Table - bot []*table.Table - - thisRange keyRange - nextRange keyRange - - thisSize int64 - - dropPrefix []byte -} - -func (cd *compactDef) lockLevels() { - cd.thisLevel.RLock() - cd.nextLevel.RLock() -} - -func (cd *compactDef) unlockLevels() { - cd.nextLevel.RUnlock() - cd.thisLevel.RUnlock() -} - -func (s *levelsController) fillTablesL0(cd *compactDef) bool { - cd.lockLevels() - defer cd.unlockLevels() - - cd.top = make([]*table.Table, len(cd.thisLevel.tables)) - copy(cd.top, cd.thisLevel.tables) - if len(cd.top) == 0 { - return false - } - cd.thisRange = infRange - - kr := getKeyRange(cd.top) - left, right := cd.nextLevel.overlappingTables(levelHandlerRLocked{}, kr) - cd.bot = make([]*table.Table, right-left) - copy(cd.bot, cd.nextLevel.tables[left:right]) - - if len(cd.bot) == 0 { - cd.nextRange = kr - } else { - cd.nextRange = getKeyRange(cd.bot) - } - - if !s.cstatus.compareAndAdd(thisAndNextLevelRLocked{}, *cd) { - return false - } - - return true -} - -func (s *levelsController) fillTables(cd *compactDef) bool { - cd.lockLevels() - defer cd.unlockLevels() - - tbls := make([]*table.Table, len(cd.thisLevel.tables)) - copy(tbls, cd.thisLevel.tables) - if len(tbls) == 0 { - return false - } - - // Find the biggest table, and compact that first. - // TODO: Try other table picking strategies. - sort.Slice(tbls, func(i, j int) bool { - return tbls[i].Size() > tbls[j].Size() - }) - - for _, t := range tbls { - cd.thisSize = t.Size() - cd.thisRange = keyRange{ - // We pick all the versions of the smallest and the biggest key. - left: y.KeyWithTs(y.ParseKey(t.Smallest()), math.MaxUint64), - // Note that version zero would be the rightmost key. - right: y.KeyWithTs(y.ParseKey(t.Biggest()), 0), - } - if s.cstatus.overlapsWith(cd.thisLevel.level, cd.thisRange) { - continue - } - cd.top = []*table.Table{t} - left, right := cd.nextLevel.overlappingTables(levelHandlerRLocked{}, cd.thisRange) - - cd.bot = make([]*table.Table, right-left) - copy(cd.bot, cd.nextLevel.tables[left:right]) - - if len(cd.bot) == 0 { - cd.bot = []*table.Table{} - cd.nextRange = cd.thisRange - if !s.cstatus.compareAndAdd(thisAndNextLevelRLocked{}, *cd) { - continue - } - return true - } - cd.nextRange = getKeyRange(cd.bot) - - if s.cstatus.overlapsWith(cd.nextLevel.level, cd.nextRange) { - continue - } - if !s.cstatus.compareAndAdd(thisAndNextLevelRLocked{}, *cd) { - continue - } - return true - } - return false -} - -func (s *levelsController) runCompactDef(l int, cd compactDef) (err error) { - timeStart := time.Now() - - thisLevel := cd.thisLevel - nextLevel := cd.nextLevel - - // Table should never be moved directly between levels, always be rewritten to allow discarding - // invalid versions. - - newTables, decr, err := s.compactBuildTables(l, cd) - if err != nil { - return err - } - defer func() { - // Only assign to err, if it's not already nil. - if decErr := decr(); err == nil { - err = decErr - } - }() - changeSet := buildChangeSet(&cd, newTables) - - // We write to the manifest _before_ we delete files (and after we created files) - if err := s.kv.manifest.addChanges(changeSet.Changes); err != nil { - return err - } - - // See comment earlier in this function about the ordering of these ops, and the order in which - // we access levels when reading. - if err := nextLevel.replaceTables(cd.bot, newTables); err != nil { - return err - } - if err := thisLevel.deleteTables(cd.top); err != nil { - return err - } - - // Note: For level 0, while doCompact is running, it is possible that new tables are added. - // However, the tables are added only to the end, so it is ok to just delete the first table. - - s.kv.opt.Infof("LOG Compact %d->%d, del %d tables, add %d tables, took %v\n", - thisLevel.level, nextLevel.level, len(cd.top)+len(cd.bot), - len(newTables), time.Since(timeStart)) - return nil -} - -var errFillTables = errors.New("Unable to fill tables") - -// doCompact picks some table on level l and compacts it away to the next level. -func (s *levelsController) doCompact(p compactionPriority) error { - l := p.level - y.AssertTrue(l+1 < s.kv.opt.MaxLevels) // Sanity check. - - cd := compactDef{ - elog: trace.New(fmt.Sprintf("Badger.L%d", l), "Compact"), - thisLevel: s.levels[l], - nextLevel: s.levels[l+1], - dropPrefix: p.dropPrefix, - } - cd.elog.SetMaxEvents(100) - defer cd.elog.Finish() - - s.kv.opt.Infof("Got compaction priority: %+v", p) - - // While picking tables to be compacted, both levels' tables are expected to - // remain unchanged. - if l == 0 { - if !s.fillTablesL0(&cd) { - return errFillTables - } - - } else { - if !s.fillTables(&cd) { - return errFillTables - } - } - defer s.cstatus.delete(cd) // Remove the ranges from compaction status. - - s.kv.opt.Infof("Running for level: %d\n", cd.thisLevel.level) - s.cstatus.toLog(cd.elog) - if err := s.runCompactDef(l, cd); err != nil { - // This compaction couldn't be done successfully. - s.kv.opt.Warningf("LOG Compact FAILED with error: %+v: %+v", err, cd) - return err - } - - s.cstatus.toLog(cd.elog) - s.kv.opt.Infof("Compaction for level: %d DONE", cd.thisLevel.level) - return nil -} - -func (s *levelsController) addLevel0Table(t *table.Table) error { - // We update the manifest _before_ the table becomes part of a levelHandler, because at that - // point it could get used in some compaction. This ensures the manifest file gets updated in - // the proper order. (That means this update happens before that of some compaction which - // deletes the table.) - err := s.kv.manifest.addChanges([]*pb.ManifestChange{ - newCreateChange(t.ID(), 0, t.Checksum), - }) - if err != nil { - return err - } - - for !s.levels[0].tryAddLevel0Table(t) { - // Stall. Make sure all levels are healthy before we unstall. - var timeStart time.Time - { - s.elog.Printf("STALLED STALLED STALLED: %v\n", time.Since(lastUnstalled)) - s.cstatus.RLock() - for i := 0; i < s.kv.opt.MaxLevels; i++ { - s.elog.Printf("level=%d. Status=%s Size=%d\n", - i, s.cstatus.levels[i].debug(), s.levels[i].getTotalSize()) - } - s.cstatus.RUnlock() - timeStart = time.Now() - } - // Before we unstall, we need to make sure that level 0 and 1 are healthy. Otherwise, we - // will very quickly fill up level 0 again and if the compaction strategy favors level 0, - // then level 1 is going to super full. - for i := 0; ; i++ { - // Passing 0 for delSize to compactable means we're treating incomplete compactions as - // not having finished -- we wait for them to finish. Also, it's crucial this behavior - // replicates pickCompactLevels' behavior in computing compactability in order to - // guarantee progress. - if !s.isLevel0Compactable() && !s.levels[1].isCompactable(0) { - break - } - time.Sleep(10 * time.Millisecond) - if i%100 == 0 { - prios := s.pickCompactLevels() - s.elog.Printf("Waiting to add level 0 table. Compaction priorities: %+v\n", prios) - i = 0 - } - } - { - s.elog.Printf("UNSTALLED UNSTALLED UNSTALLED: %v\n", time.Since(timeStart)) - lastUnstalled = time.Now() - } - } - - return nil -} - -func (s *levelsController) close() error { - err := s.cleanupLevels() - return errors.Wrap(err, "levelsController.Close") -} - -// get returns the found value if any. If not found, we return nil. -func (s *levelsController) get(key []byte, maxVs *y.ValueStruct) (y.ValueStruct, error) { - // It's important that we iterate the levels from 0 on upward. The reason is, if we iterated - // in opposite order, or in parallel (naively calling all the h.RLock() in some order) we could - // read level L's tables post-compaction and level L+1's tables pre-compaction. (If we do - // parallelize this, we will need to call the h.RLock() function by increasing order of level - // number.) - version := y.ParseTs(key) - for _, h := range s.levels { - vs, err := h.get(key) // Calls h.RLock() and h.RUnlock(). - if err != nil { - return y.ValueStruct{}, errors.Wrapf(err, "get key: %q", key) - } - if vs.Value == nil && vs.Meta == 0 { - continue - } - if maxVs == nil || vs.Version == version { - return vs, nil - } - if maxVs.Version < vs.Version { - *maxVs = vs - } - } - if maxVs != nil { - return *maxVs, nil - } - return y.ValueStruct{}, nil -} - -func appendIteratorsReversed(out []y.Iterator, th []*table.Table, reversed bool) []y.Iterator { - for i := len(th) - 1; i >= 0; i-- { - // This will increment the reference of the table handler. - out = append(out, th[i].NewIterator(reversed)) - } - return out -} - -// appendIterators appends iterators to an array of iterators, for merging. -// Note: This obtains references for the table handlers. Remember to close these iterators. -func (s *levelsController) appendIterators( - iters []y.Iterator, opt *IteratorOptions) []y.Iterator { - // Just like with get, it's important we iterate the levels from 0 on upward, to avoid missing - // data when there's a compaction. - for _, level := range s.levels { - iters = level.appendIterators(iters, opt) - } - return iters -} - -// TableInfo represents the information about a table. -type TableInfo struct { - ID uint64 - Level int - Left []byte - Right []byte - KeyCount uint64 // Number of keys in the table -} - -func (s *levelsController) getTableInfo(withKeysCount bool) (result []TableInfo) { - for _, l := range s.levels { - l.RLock() - for _, t := range l.tables { - var count uint64 - if withKeysCount { - it := t.NewIterator(false) - for it.Rewind(); it.Valid(); it.Next() { - count++ - } - } - - info := TableInfo{ - ID: t.ID(), - Level: l.level, - Left: t.Smallest(), - Right: t.Biggest(), - KeyCount: count, - } - result = append(result, info) - } - l.RUnlock() - } - sort.Slice(result, func(i, j int) bool { - if result[i].Level != result[j].Level { - return result[i].Level < result[j].Level - } - return result[i].ID < result[j].ID - }) - return -} diff --git a/vendor/github.com/dgraph-io/badger/logger.go b/vendor/github.com/dgraph-io/badger/logger.go deleted file mode 100644 index 3a9b8a33..00000000 --- a/vendor/github.com/dgraph-io/badger/logger.go +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2018 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "log" - "os" -) - -// Logger is implemented by any logging system that is used for standard logs. -type Logger interface { - Errorf(string, ...interface{}) - Warningf(string, ...interface{}) - Infof(string, ...interface{}) - Debugf(string, ...interface{}) -} - -// Errorf logs an ERROR log message to the logger specified in opts or to the -// global logger if no logger is specified in opts. -func (opt *Options) Errorf(format string, v ...interface{}) { - if opt.Logger == nil { - return - } - opt.Logger.Errorf(format, v...) -} - -// Infof logs an INFO message to the logger specified in opts. -func (opt *Options) Infof(format string, v ...interface{}) { - if opt.Logger == nil { - return - } - opt.Logger.Infof(format, v...) -} - -// Warningf logs a WARNING message to the logger specified in opts. -func (opt *Options) Warningf(format string, v ...interface{}) { - if opt.Logger == nil { - return - } - opt.Logger.Warningf(format, v...) -} - -// Debugf logs a DEBUG message to the logger specified in opts. -func (opt *Options) Debugf(format string, v ...interface{}) { - if opt.Logger == nil { - return - } - opt.Logger.Debugf(format, v...) -} - -type defaultLog struct { - *log.Logger -} - -var defaultLogger = &defaultLog{Logger: log.New(os.Stderr, "badger ", log.LstdFlags)} - -func (l *defaultLog) Errorf(f string, v ...interface{}) { - l.Printf("ERROR: "+f, v...) -} - -func (l *defaultLog) Warningf(f string, v ...interface{}) { - l.Printf("WARNING: "+f, v...) -} - -func (l *defaultLog) Infof(f string, v ...interface{}) { - l.Printf("INFO: "+f, v...) -} - -func (l *defaultLog) Debugf(f string, v ...interface{}) { - l.Printf("DEBUG: "+f, v...) -} diff --git a/vendor/github.com/dgraph-io/badger/managed_db.go b/vendor/github.com/dgraph-io/badger/managed_db.go deleted file mode 100644 index 4de226ae..00000000 --- a/vendor/github.com/dgraph-io/badger/managed_db.go +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -// OpenManaged returns a new DB, which allows more control over setting -// transaction timestamps, aka managed mode. -// -// This is only useful for databases built on top of Badger (like Dgraph), and -// can be ignored by most users. -func OpenManaged(opts Options) (*DB, error) { - opts.managedTxns = true - return Open(opts) -} - -// NewTransactionAt follows the same logic as DB.NewTransaction(), but uses the -// provided read timestamp. -// -// This is only useful for databases built on top of Badger (like Dgraph), and -// can be ignored by most users. -func (db *DB) NewTransactionAt(readTs uint64, update bool) *Txn { - if !db.opt.managedTxns { - panic("Cannot use NewTransactionAt with managedDB=false. Use NewTransaction instead.") - } - txn := db.newTransaction(update, true) - txn.readTs = readTs - return txn -} - -// CommitAt commits the transaction, following the same logic as Commit(), but -// at the given commit timestamp. This will panic if not used with managed transactions. -// -// This is only useful for databases built on top of Badger (like Dgraph), and -// can be ignored by most users. -func (txn *Txn) CommitAt(commitTs uint64, callback func(error)) error { - if !txn.db.opt.managedTxns { - panic("Cannot use CommitAt with managedDB=false. Use Commit instead.") - } - txn.commitTs = commitTs - if callback == nil { - return txn.Commit() - } - txn.CommitWith(callback) - return nil -} - -// SetDiscardTs sets a timestamp at or below which, any invalid or deleted -// versions can be discarded from the LSM tree, and thence from the value log to -// reclaim disk space. Can only be used with managed transactions. -func (db *DB) SetDiscardTs(ts uint64) { - if !db.opt.managedTxns { - panic("Cannot use SetDiscardTs with managedDB=false.") - } - db.orc.setDiscardTs(ts) -} diff --git a/vendor/github.com/dgraph-io/badger/manifest.go b/vendor/github.com/dgraph-io/badger/manifest.go deleted file mode 100644 index 34ce1217..00000000 --- a/vendor/github.com/dgraph-io/badger/manifest.go +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bufio" - "bytes" - "encoding/binary" - "fmt" - "hash/crc32" - "io" - "os" - "path/filepath" - "sync" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -// Manifest represents the contents of the MANIFEST file in a Badger store. -// -// The MANIFEST file describes the startup state of the db -- all LSM files and what level they're -// at. -// -// It consists of a sequence of ManifestChangeSet objects. Each of these is treated atomically, -// and contains a sequence of ManifestChange's (file creations/deletions) which we use to -// reconstruct the manifest at startup. -type Manifest struct { - Levels []levelManifest - Tables map[uint64]TableManifest - - // Contains total number of creation and deletion changes in the manifest -- used to compute - // whether it'd be useful to rewrite the manifest. - Creations int - Deletions int -} - -func createManifest() Manifest { - levels := make([]levelManifest, 0) - return Manifest{ - Levels: levels, - Tables: make(map[uint64]TableManifest), - } -} - -// levelManifest contains information about LSM tree levels -// in the MANIFEST file. -type levelManifest struct { - Tables map[uint64]struct{} // Set of table id's -} - -// TableManifest contains information about a specific level -// in the LSM tree. -type TableManifest struct { - Level uint8 - Checksum []byte -} - -// manifestFile holds the file pointer (and other info) about the manifest file, which is a log -// file we append to. -type manifestFile struct { - fp *os.File - directory string - // We make this configurable so that unit tests can hit rewrite() code quickly - deletionsRewriteThreshold int - - // Guards appends, which includes access to the manifest field. - appendLock sync.Mutex - - // Used to track the current state of the manifest, used when rewriting. - manifest Manifest -} - -const ( - // ManifestFilename is the filename for the manifest file. - ManifestFilename = "MANIFEST" - manifestRewriteFilename = "MANIFEST-REWRITE" - manifestDeletionsRewriteThreshold = 10000 - manifestDeletionsRatio = 10 -) - -// asChanges returns a sequence of changes that could be used to recreate the Manifest in its -// present state. -func (m *Manifest) asChanges() []*pb.ManifestChange { - changes := make([]*pb.ManifestChange, 0, len(m.Tables)) - for id, tm := range m.Tables { - changes = append(changes, newCreateChange(id, int(tm.Level), tm.Checksum)) - } - return changes -} - -func (m *Manifest) clone() Manifest { - changeSet := pb.ManifestChangeSet{Changes: m.asChanges()} - ret := createManifest() - y.Check(applyChangeSet(&ret, &changeSet)) - return ret -} - -// openOrCreateManifestFile opens a Badger manifest file if it exists, or creates on if -// one doesn’t. -func openOrCreateManifestFile(dir string, readOnly bool) (ret *manifestFile, result Manifest, err error) { - return helpOpenOrCreateManifestFile(dir, readOnly, manifestDeletionsRewriteThreshold) -} - -func helpOpenOrCreateManifestFile(dir string, readOnly bool, deletionsThreshold int) (ret *manifestFile, result Manifest, err error) { - path := filepath.Join(dir, ManifestFilename) - var flags uint32 - if readOnly { - flags |= y.ReadOnly - } - fp, err := y.OpenExistingFile(path, flags) // We explicitly sync in addChanges, outside the lock. - if err != nil { - if !os.IsNotExist(err) { - return nil, Manifest{}, err - } - if readOnly { - return nil, Manifest{}, fmt.Errorf("no manifest found, required for read-only db") - } - m := createManifest() - fp, netCreations, err := helpRewrite(dir, &m) - if err != nil { - return nil, Manifest{}, err - } - y.AssertTrue(netCreations == 0) - mf := &manifestFile{ - fp: fp, - directory: dir, - manifest: m.clone(), - deletionsRewriteThreshold: deletionsThreshold, - } - return mf, m, nil - } - - manifest, truncOffset, err := ReplayManifestFile(fp) - if err != nil { - _ = fp.Close() - return nil, Manifest{}, err - } - - if !readOnly { - // Truncate file so we don't have a half-written entry at the end. - if err := fp.Truncate(truncOffset); err != nil { - _ = fp.Close() - return nil, Manifest{}, err - } - } - if _, err = fp.Seek(0, io.SeekEnd); err != nil { - _ = fp.Close() - return nil, Manifest{}, err - } - - mf := &manifestFile{ - fp: fp, - directory: dir, - manifest: manifest.clone(), - deletionsRewriteThreshold: deletionsThreshold, - } - return mf, manifest, nil -} - -func (mf *manifestFile) close() error { - return mf.fp.Close() -} - -// addChanges writes a batch of changes, atomically, to the file. By "atomically" that means when -// we replay the MANIFEST file, we'll either replay all the changes or none of them. (The truth of -// this depends on the filesystem -- some might append garbage data if a system crash happens at -// the wrong time.) -func (mf *manifestFile) addChanges(changesParam []*pb.ManifestChange) error { - changes := pb.ManifestChangeSet{Changes: changesParam} - buf, err := changes.Marshal() - if err != nil { - return err - } - - // Maybe we could use O_APPEND instead (on certain file systems) - mf.appendLock.Lock() - if err := applyChangeSet(&mf.manifest, &changes); err != nil { - mf.appendLock.Unlock() - return err - } - // Rewrite manifest if it'd shrink by 1/10 and it's big enough to care - if mf.manifest.Deletions > mf.deletionsRewriteThreshold && - mf.manifest.Deletions > manifestDeletionsRatio*(mf.manifest.Creations-mf.manifest.Deletions) { - if err := mf.rewrite(); err != nil { - mf.appendLock.Unlock() - return err - } - } else { - var lenCrcBuf [8]byte - binary.BigEndian.PutUint32(lenCrcBuf[0:4], uint32(len(buf))) - binary.BigEndian.PutUint32(lenCrcBuf[4:8], crc32.Checksum(buf, y.CastagnoliCrcTable)) - buf = append(lenCrcBuf[:], buf...) - if _, err := mf.fp.Write(buf); err != nil { - mf.appendLock.Unlock() - return err - } - } - - mf.appendLock.Unlock() - return mf.fp.Sync() -} - -// Has to be 4 bytes. The value can never change, ever, anyway. -var magicText = [4]byte{'B', 'd', 'g', 'r'} - -// The magic version number. -const magicVersion = 4 - -func helpRewrite(dir string, m *Manifest) (*os.File, int, error) { - rewritePath := filepath.Join(dir, manifestRewriteFilename) - // We explicitly sync. - fp, err := y.OpenTruncFile(rewritePath, false) - if err != nil { - return nil, 0, err - } - - buf := make([]byte, 8) - copy(buf[0:4], magicText[:]) - binary.BigEndian.PutUint32(buf[4:8], magicVersion) - - netCreations := len(m.Tables) - changes := m.asChanges() - set := pb.ManifestChangeSet{Changes: changes} - - changeBuf, err := set.Marshal() - if err != nil { - fp.Close() - return nil, 0, err - } - var lenCrcBuf [8]byte - binary.BigEndian.PutUint32(lenCrcBuf[0:4], uint32(len(changeBuf))) - binary.BigEndian.PutUint32(lenCrcBuf[4:8], crc32.Checksum(changeBuf, y.CastagnoliCrcTable)) - buf = append(buf, lenCrcBuf[:]...) - buf = append(buf, changeBuf...) - if _, err := fp.Write(buf); err != nil { - fp.Close() - return nil, 0, err - } - if err := fp.Sync(); err != nil { - fp.Close() - return nil, 0, err - } - - // In Windows the files should be closed before doing a Rename. - if err = fp.Close(); err != nil { - return nil, 0, err - } - manifestPath := filepath.Join(dir, ManifestFilename) - if err := os.Rename(rewritePath, manifestPath); err != nil { - return nil, 0, err - } - fp, err = y.OpenExistingFile(manifestPath, 0) - if err != nil { - return nil, 0, err - } - if _, err := fp.Seek(0, io.SeekEnd); err != nil { - fp.Close() - return nil, 0, err - } - if err := syncDir(dir); err != nil { - fp.Close() - return nil, 0, err - } - - return fp, netCreations, nil -} - -// Must be called while appendLock is held. -func (mf *manifestFile) rewrite() error { - // In Windows the files should be closed before doing a Rename. - if err := mf.fp.Close(); err != nil { - return err - } - fp, netCreations, err := helpRewrite(mf.directory, &mf.manifest) - if err != nil { - return err - } - mf.fp = fp - mf.manifest.Creations = netCreations - mf.manifest.Deletions = 0 - - return nil -} - -type countingReader struct { - wrapped *bufio.Reader - count int64 -} - -func (r *countingReader) Read(p []byte) (n int, err error) { - n, err = r.wrapped.Read(p) - r.count += int64(n) - return -} - -func (r *countingReader) ReadByte() (b byte, err error) { - b, err = r.wrapped.ReadByte() - if err == nil { - r.count++ - } - return -} - -var ( - errBadMagic = errors.New("manifest has bad magic") -) - -// ReplayManifestFile reads the manifest file and constructs two manifest objects. (We need one -// immutable copy and one mutable copy of the manifest. Easiest way is to construct two of them.) -// Also, returns the last offset after a completely read manifest entry -- the file must be -// truncated at that point before further appends are made (if there is a partial entry after -// that). In normal conditions, truncOffset is the file size. -func ReplayManifestFile(fp *os.File) (ret Manifest, truncOffset int64, err error) { - r := countingReader{wrapped: bufio.NewReader(fp)} - - var magicBuf [8]byte - if _, err := io.ReadFull(&r, magicBuf[:]); err != nil { - return Manifest{}, 0, errBadMagic - } - if !bytes.Equal(magicBuf[0:4], magicText[:]) { - return Manifest{}, 0, errBadMagic - } - version := binary.BigEndian.Uint32(magicBuf[4:8]) - if version != magicVersion { - return Manifest{}, 0, - fmt.Errorf("manifest has unsupported version: %d (we support %d)", version, magicVersion) - } - - build := createManifest() - var offset int64 - for { - offset = r.count - var lenCrcBuf [8]byte - _, err := io.ReadFull(&r, lenCrcBuf[:]) - if err != nil { - if err == io.EOF || err == io.ErrUnexpectedEOF { - break - } - return Manifest{}, 0, err - } - length := binary.BigEndian.Uint32(lenCrcBuf[0:4]) - var buf = make([]byte, length) - if _, err := io.ReadFull(&r, buf); err != nil { - if err == io.EOF || err == io.ErrUnexpectedEOF { - break - } - return Manifest{}, 0, err - } - if crc32.Checksum(buf, y.CastagnoliCrcTable) != binary.BigEndian.Uint32(lenCrcBuf[4:8]) { - break - } - - var changeSet pb.ManifestChangeSet - if err := changeSet.Unmarshal(buf); err != nil { - return Manifest{}, 0, err - } - - if err := applyChangeSet(&build, &changeSet); err != nil { - return Manifest{}, 0, err - } - } - - return build, offset, err -} - -func applyManifestChange(build *Manifest, tc *pb.ManifestChange) error { - switch tc.Op { - case pb.ManifestChange_CREATE: - if _, ok := build.Tables[tc.Id]; ok { - return fmt.Errorf("MANIFEST invalid, table %d exists", tc.Id) - } - build.Tables[tc.Id] = TableManifest{ - Level: uint8(tc.Level), - Checksum: append([]byte{}, tc.Checksum...), - } - for len(build.Levels) <= int(tc.Level) { - build.Levels = append(build.Levels, levelManifest{make(map[uint64]struct{})}) - } - build.Levels[tc.Level].Tables[tc.Id] = struct{}{} - build.Creations++ - case pb.ManifestChange_DELETE: - tm, ok := build.Tables[tc.Id] - if !ok { - return fmt.Errorf("MANIFEST removes non-existing table %d", tc.Id) - } - delete(build.Levels[tm.Level].Tables, tc.Id) - delete(build.Tables, tc.Id) - build.Deletions++ - default: - return fmt.Errorf("MANIFEST file has invalid manifestChange op") - } - return nil -} - -// This is not a "recoverable" error -- opening the KV store fails because the MANIFEST file is -// just plain broken. -func applyChangeSet(build *Manifest, changeSet *pb.ManifestChangeSet) error { - for _, change := range changeSet.Changes { - if err := applyManifestChange(build, change); err != nil { - return err - } - } - return nil -} - -func newCreateChange(id uint64, level int, checksum []byte) *pb.ManifestChange { - return &pb.ManifestChange{ - Id: id, - Op: pb.ManifestChange_CREATE, - Level: uint32(level), - Checksum: checksum, - } -} - -func newDeleteChange(id uint64) *pb.ManifestChange { - return &pb.ManifestChange{ - Id: id, - Op: pb.ManifestChange_DELETE, - } -} diff --git a/vendor/github.com/dgraph-io/badger/merge.go b/vendor/github.com/dgraph-io/badger/merge.go deleted file mode 100644 index 7bca447a..00000000 --- a/vendor/github.com/dgraph-io/badger/merge.go +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "sync" - "time" - - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -// MergeOperator represents a Badger merge operator. -type MergeOperator struct { - sync.RWMutex - f MergeFunc - db *DB - key []byte - closer *y.Closer -} - -// MergeFunc accepts two byte slices, one representing an existing value, and -// another representing a new value that needs to be ‘merged’ into it. MergeFunc -// contains the logic to perform the ‘merge’ and return an updated value. -// MergeFunc could perform operations like integer addition, list appends etc. -// Note that the ordering of the operands is unspecified, so the merge func -// should either be agnostic to ordering or do additional handling if ordering -// is required. -type MergeFunc func(existing, val []byte) []byte - -// GetMergeOperator creates a new MergeOperator for a given key and returns a -// pointer to it. It also fires off a goroutine that performs a compaction using -// the merge function that runs periodically, as specified by dur. -func (db *DB) GetMergeOperator(key []byte, - f MergeFunc, dur time.Duration) *MergeOperator { - op := &MergeOperator{ - f: f, - db: db, - key: key, - closer: y.NewCloser(1), - } - - go op.runCompactions(dur) - return op -} - -var errNoMerge = errors.New("No need for merge") - -func (op *MergeOperator) iterateAndMerge(txn *Txn) (val []byte, err error) { - opt := DefaultIteratorOptions - opt.AllVersions = true - it := txn.NewKeyIterator(op.key, opt) - defer it.Close() - - var numVersions int - for it.Rewind(); it.Valid(); it.Next() { - item := it.Item() - numVersions++ - if numVersions == 1 { - val, err = item.ValueCopy(val) - if err != nil { - return nil, err - } - } else { - if err := item.Value(func(newVal []byte) error { - val = op.f(val, newVal) - return nil - }); err != nil { - return nil, err - } - } - if item.DiscardEarlierVersions() { - break - } - } - if numVersions == 0 { - return nil, ErrKeyNotFound - } else if numVersions == 1 { - return val, errNoMerge - } - return val, nil -} - -func (op *MergeOperator) compact() error { - op.Lock() - defer op.Unlock() - err := op.db.Update(func(txn *Txn) error { - var ( - val []byte - err error - ) - val, err = op.iterateAndMerge(txn) - if err != nil { - return err - } - // Write value back to the DB. It is important that we do not set the bitMergeEntry bit - // here. When compaction happens, all the older merged entries will be removed. - return txn.SetWithDiscard(op.key, val, 0) - }) - - if err == ErrKeyNotFound || err == errNoMerge { - // pass. - } else if err != nil { - return err - } - return nil -} - -func (op *MergeOperator) runCompactions(dur time.Duration) { - ticker := time.NewTicker(dur) - defer op.closer.Done() - var stop bool - for { - select { - case <-op.closer.HasBeenClosed(): - stop = true - case <-ticker.C: // wait for tick - } - if err := op.compact(); err != nil { - op.db.opt.Errorf("failure while running merge operation: %s", err) - } - if stop { - ticker.Stop() - break - } - } -} - -// Add records a value in Badger which will eventually be merged by a background -// routine into the values that were recorded by previous invocations to Add(). -func (op *MergeOperator) Add(val []byte) error { - return op.db.Update(func(txn *Txn) error { - return txn.setMergeEntry(op.key, val) - }) -} - -// Get returns the latest value for the merge operator, which is derived by -// applying the merge function to all the values added so far. -// -// If Add has not been called even once, Get will return ErrKeyNotFound. -func (op *MergeOperator) Get() ([]byte, error) { - op.RLock() - defer op.RUnlock() - var existing []byte - err := op.db.View(func(txn *Txn) (err error) { - existing, err = op.iterateAndMerge(txn) - return err - }) - if err == errNoMerge { - return existing, nil - } - return existing, err -} - -// Stop waits for any pending merge to complete and then stops the background -// goroutine. -func (op *MergeOperator) Stop() { - op.closer.SignalAndWait() -} diff --git a/vendor/github.com/dgraph-io/badger/options.go b/vendor/github.com/dgraph-io/badger/options.go deleted file mode 100644 index 560b65b2..00000000 --- a/vendor/github.com/dgraph-io/badger/options.go +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "github.com/dgraph-io/badger/options" -) - -// NOTE: Keep the comments in the following to 75 chars width, so they -// format nicely in godoc. - -// Options are params for creating DB object. -// -// This package provides DefaultOptions which contains options that should -// work for most applications. Consider using that as a starting point before -// customizing it for your own needs. -type Options struct { - // 1. Mandatory flags - // ------------------- - // Directory to store the data in. If it doesn't exist, Badger will - // try to create it for you. - Dir string - // Directory to store the value log in. Can be the same as Dir. If it - // doesn't exist, Badger will try to create it for you. - ValueDir string - - // 2. Frequently modified flags - // ----------------------------- - // Sync all writes to disk. Setting this to false would achieve better - // performance, but may cause data to be lost. - SyncWrites bool - - // How should LSM tree be accessed. - TableLoadingMode options.FileLoadingMode - - // How should value log be accessed. - ValueLogLoadingMode options.FileLoadingMode - - // How many versions to keep per key. - NumVersionsToKeep int - - // Open the DB as read-only. With this set, multiple processes can - // open the same Badger DB. Note: if the DB being opened had crashed - // before and has vlog data to be replayed, ReadOnly will cause Open - // to fail with an appropriate message. - ReadOnly bool - - // Truncate value log to delete corrupt data, if any. Would not truncate if ReadOnly is set. - Truncate bool - - // DB-specific logger which will override the global logger. - Logger Logger - - // 3. Flags that user might want to review - // ---------------------------------------- - // The following affect all levels of LSM tree. - MaxTableSize int64 // Each table (or file) is at most this size. - LevelSizeMultiplier int // Equals SizeOf(Li+1)/SizeOf(Li). - MaxLevels int // Maximum number of levels of compaction. - // If value size >= this threshold, only store value offsets in tree. - ValueThreshold int - // Maximum number of tables to keep in memory, before stalling. - NumMemtables int - // The following affect how we handle LSM tree L0. - // Maximum number of Level 0 tables before we start compacting. - NumLevelZeroTables int - - // If we hit this number of Level 0 tables, we will stall until L0 is - // compacted away. - NumLevelZeroTablesStall int - - // Maximum total size for L1. - LevelOneSize int64 - - // Size of single value log file. - ValueLogFileSize int64 - - // Max number of entries a value log file can hold (approximately). A value log file would be - // determined by the smaller of its file size and max entries. - ValueLogMaxEntries uint32 - - // Number of compaction workers to run concurrently. Setting this to zero would stop compactions - // to happen within LSM tree. If set to zero, writes could block forever. - NumCompactors int - - // When closing the DB, force compact Level 0. This ensures that both reads and writes are - // efficient when the DB is opened later. - CompactL0OnClose bool - - // After this many number of value log file rotates, there would be a force flushing of memtable - // to disk. This is useful in write loads with fewer keys and larger values. This work load - // would fill up the value logs quickly, while not filling up the Memtables. Thus, on a crash - // and restart, the value log head could cause the replay of a good number of value log files - // which can slow things on start. - LogRotatesToFlush int32 - - // Transaction start and commit timestamps are managed by end-user. - // This is only useful for databases built on top of Badger (like Dgraph). - // Not recommended for most users. - managedTxns bool - - // 4. Flags for testing purposes - // ------------------------------ - maxBatchCount int64 // max entries in batch - maxBatchSize int64 // max batch size in bytes - -} - -// DefaultOptions sets a list of recommended options for good performance. -// Feel free to modify these to suit your needs. -var DefaultOptions = Options{ - LevelOneSize: 256 << 20, - LevelSizeMultiplier: 10, - TableLoadingMode: options.MemoryMap, - ValueLogLoadingMode: options.MemoryMap, - // table.MemoryMap to mmap() the tables. - // table.Nothing to not preload the tables. - MaxLevels: 7, - MaxTableSize: 64 << 20, - NumCompactors: 2, // Compactions can be expensive. Only run 2. - NumLevelZeroTables: 5, - NumLevelZeroTablesStall: 10, - NumMemtables: 5, - SyncWrites: true, - NumVersionsToKeep: 1, - CompactL0OnClose: true, - // Nothing to read/write value log using standard File I/O - // MemoryMap to mmap() the value log files - // (2^30 - 1)*2 when mmapping < 2^31 - 1, max int32. - // -1 so 2*ValueLogFileSize won't overflow on 32-bit systems. - ValueLogFileSize: 1<<30 - 1, - - ValueLogMaxEntries: 1000000, - ValueThreshold: 32, - Truncate: false, - Logger: defaultLogger, - LogRotatesToFlush: 2, -} - -// LSMOnlyOptions follows from DefaultOptions, but sets a higher ValueThreshold -// so values would be colocated with the LSM tree, with value log largely acting -// as a write-ahead log only. These options would reduce the disk usage of value -// log, and make Badger act more like a typical LSM tree. -var LSMOnlyOptions = Options{} - -func init() { - LSMOnlyOptions = DefaultOptions - - LSMOnlyOptions.ValueThreshold = 65500 // Max value length which fits in uint16. - // Let's not set any other options, because they can cause issues with the - // size of key-value a user can pass to Badger. For e.g., if we set - // ValueLogFileSize to 64MB, a user can't pass a value more than that. - // Setting it to ValueLogMaxEntries to 1000, can generate too many files. - // These options are better configured on a usage basis, than broadly here. - // The ValueThreshold is the most important setting a user needs to do to - // achieve a heavier usage of LSM tree. - // NOTE: If a user does not want to set 64KB as the ValueThreshold because - // of performance reasons, 1KB would be a good option too, allowing - // values smaller than 1KB to be colocated with the keys in the LSM tree. -} diff --git a/vendor/github.com/dgraph-io/badger/options/options.go b/vendor/github.com/dgraph-io/badger/options/options.go deleted file mode 100644 index 06c8b1b7..00000000 --- a/vendor/github.com/dgraph-io/badger/options/options.go +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package options - -// FileLoadingMode specifies how data in LSM table files and value log files should -// be loaded. -type FileLoadingMode int - -const ( - // FileIO indicates that files must be loaded using standard I/O - FileIO FileLoadingMode = iota - // LoadToRAM indicates that file must be loaded into RAM - LoadToRAM - // MemoryMap indicates that that the file must be memory-mapped - MemoryMap -) diff --git a/vendor/github.com/dgraph-io/badger/pb/gen.sh b/vendor/github.com/dgraph-io/badger/pb/gen.sh deleted file mode 100755 index 49b44ff4..00000000 --- a/vendor/github.com/dgraph-io/badger/pb/gen.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# You might need to go get -v github.com/gogo/protobuf/... - -protos=${GOPATH-$HOME/go}/src/github.com/dgraph-io/badger/pb -pushd $protos > /dev/null -protoc --gofast_out=plugins=grpc:. -I=. pb.proto diff --git a/vendor/github.com/dgraph-io/badger/pb/pb.pb.go b/vendor/github.com/dgraph-io/badger/pb/pb.pb.go deleted file mode 100644 index f9a2c6ee..00000000 --- a/vendor/github.com/dgraph-io/badger/pb/pb.pb.go +++ /dev/null @@ -1,1313 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb.proto - -package pb - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ManifestChange_Operation int32 - -const ( - ManifestChange_CREATE ManifestChange_Operation = 0 - ManifestChange_DELETE ManifestChange_Operation = 1 -) - -var ManifestChange_Operation_name = map[int32]string{ - 0: "CREATE", - 1: "DELETE", -} - -var ManifestChange_Operation_value = map[string]int32{ - "CREATE": 0, - "DELETE": 1, -} - -func (x ManifestChange_Operation) String() string { - return proto.EnumName(ManifestChange_Operation_name, int32(x)) -} - -func (ManifestChange_Operation) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_f80abaa17e25ccc8, []int{3, 0} -} - -type KV struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - UserMeta []byte `protobuf:"bytes,3,opt,name=user_meta,json=userMeta,proto3" json:"user_meta,omitempty"` - Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` - ExpiresAt uint64 `protobuf:"varint,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` - Meta []byte `protobuf:"bytes,6,opt,name=meta,proto3" json:"meta,omitempty"` - // Stream id is used to identify which stream the KV came from. - StreamId uint32 `protobuf:"varint,10,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KV) Reset() { *m = KV{} } -func (m *KV) String() string { return proto.CompactTextString(m) } -func (*KV) ProtoMessage() {} -func (*KV) Descriptor() ([]byte, []int) { - return fileDescriptor_f80abaa17e25ccc8, []int{0} -} -func (m *KV) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *KV) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_KV.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *KV) XXX_Merge(src proto.Message) { - xxx_messageInfo_KV.Merge(m, src) -} -func (m *KV) XXX_Size() int { - return m.Size() -} -func (m *KV) XXX_DiscardUnknown() { - xxx_messageInfo_KV.DiscardUnknown(m) -} - -var xxx_messageInfo_KV proto.InternalMessageInfo - -func (m *KV) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *KV) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *KV) GetUserMeta() []byte { - if m != nil { - return m.UserMeta - } - return nil -} - -func (m *KV) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *KV) GetExpiresAt() uint64 { - if m != nil { - return m.ExpiresAt - } - return 0 -} - -func (m *KV) GetMeta() []byte { - if m != nil { - return m.Meta - } - return nil -} - -func (m *KV) GetStreamId() uint32 { - if m != nil { - return m.StreamId - } - return 0 -} - -type KVList struct { - Kv []*KV `protobuf:"bytes,1,rep,name=kv,proto3" json:"kv,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KVList) Reset() { *m = KVList{} } -func (m *KVList) String() string { return proto.CompactTextString(m) } -func (*KVList) ProtoMessage() {} -func (*KVList) Descriptor() ([]byte, []int) { - return fileDescriptor_f80abaa17e25ccc8, []int{1} -} -func (m *KVList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *KVList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_KVList.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *KVList) XXX_Merge(src proto.Message) { - xxx_messageInfo_KVList.Merge(m, src) -} -func (m *KVList) XXX_Size() int { - return m.Size() -} -func (m *KVList) XXX_DiscardUnknown() { - xxx_messageInfo_KVList.DiscardUnknown(m) -} - -var xxx_messageInfo_KVList proto.InternalMessageInfo - -func (m *KVList) GetKv() []*KV { - if m != nil { - return m.Kv - } - return nil -} - -type ManifestChangeSet struct { - // A set of changes that are applied atomically. - Changes []*ManifestChange `protobuf:"bytes,1,rep,name=changes,proto3" json:"changes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ManifestChangeSet) Reset() { *m = ManifestChangeSet{} } -func (m *ManifestChangeSet) String() string { return proto.CompactTextString(m) } -func (*ManifestChangeSet) ProtoMessage() {} -func (*ManifestChangeSet) Descriptor() ([]byte, []int) { - return fileDescriptor_f80abaa17e25ccc8, []int{2} -} -func (m *ManifestChangeSet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ManifestChangeSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ManifestChangeSet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ManifestChangeSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_ManifestChangeSet.Merge(m, src) -} -func (m *ManifestChangeSet) XXX_Size() int { - return m.Size() -} -func (m *ManifestChangeSet) XXX_DiscardUnknown() { - xxx_messageInfo_ManifestChangeSet.DiscardUnknown(m) -} - -var xxx_messageInfo_ManifestChangeSet proto.InternalMessageInfo - -func (m *ManifestChangeSet) GetChanges() []*ManifestChange { - if m != nil { - return m.Changes - } - return nil -} - -type ManifestChange struct { - Id uint64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - Op ManifestChange_Operation `protobuf:"varint,2,opt,name=Op,proto3,enum=pb.ManifestChange_Operation" json:"Op,omitempty"` - Level uint32 `protobuf:"varint,3,opt,name=Level,proto3" json:"Level,omitempty"` - Checksum []byte `protobuf:"bytes,4,opt,name=Checksum,proto3" json:"Checksum,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ManifestChange) Reset() { *m = ManifestChange{} } -func (m *ManifestChange) String() string { return proto.CompactTextString(m) } -func (*ManifestChange) ProtoMessage() {} -func (*ManifestChange) Descriptor() ([]byte, []int) { - return fileDescriptor_f80abaa17e25ccc8, []int{3} -} -func (m *ManifestChange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ManifestChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ManifestChange.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ManifestChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_ManifestChange.Merge(m, src) -} -func (m *ManifestChange) XXX_Size() int { - return m.Size() -} -func (m *ManifestChange) XXX_DiscardUnknown() { - xxx_messageInfo_ManifestChange.DiscardUnknown(m) -} - -var xxx_messageInfo_ManifestChange proto.InternalMessageInfo - -func (m *ManifestChange) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *ManifestChange) GetOp() ManifestChange_Operation { - if m != nil { - return m.Op - } - return ManifestChange_CREATE -} - -func (m *ManifestChange) GetLevel() uint32 { - if m != nil { - return m.Level - } - return 0 -} - -func (m *ManifestChange) GetChecksum() []byte { - if m != nil { - return m.Checksum - } - return nil -} - -func init() { - proto.RegisterEnum("pb.ManifestChange_Operation", ManifestChange_Operation_name, ManifestChange_Operation_value) - proto.RegisterType((*KV)(nil), "pb.KV") - proto.RegisterType((*KVList)(nil), "pb.KVList") - proto.RegisterType((*ManifestChangeSet)(nil), "pb.ManifestChangeSet") - proto.RegisterType((*ManifestChange)(nil), "pb.ManifestChange") -} - -func init() { proto.RegisterFile("pb.proto", fileDescriptor_f80abaa17e25ccc8) } - -var fileDescriptor_f80abaa17e25ccc8 = []byte{ - // 365 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x4f, 0x8a, 0xdb, 0x30, - 0x14, 0xc6, 0x47, 0x8a, 0xc7, 0xe3, 0xbc, 0xce, 0x04, 0x57, 0x94, 0x22, 0xfa, 0xc7, 0x18, 0x77, - 0xe3, 0xc5, 0xe0, 0xc5, 0xf4, 0x04, 0x69, 0xea, 0x45, 0x48, 0x42, 0x40, 0x0d, 0xd9, 0x06, 0x39, - 0x7e, 0x6d, 0x8c, 0x13, 0x5b, 0x58, 0x8a, 0x69, 0x6f, 0xd2, 0x0b, 0xf4, 0x04, 0xbd, 0x44, 0x97, - 0x3d, 0x42, 0x49, 0x2f, 0x52, 0xac, 0xfc, 0x81, 0xd0, 0xdd, 0xfb, 0xbe, 0xef, 0xbd, 0x4f, 0xf0, - 0x13, 0x78, 0x2a, 0x4b, 0x54, 0x53, 0x9b, 0x9a, 0x51, 0x95, 0x45, 0x3f, 0x09, 0xd0, 0xc9, 0x92, - 0xf9, 0xd0, 0x2b, 0xf1, 0x1b, 0x27, 0x21, 0x89, 0xef, 0x45, 0x37, 0xb2, 0x17, 0x70, 0xdb, 0xca, - 0xed, 0x1e, 0x39, 0xb5, 0xde, 0x51, 0xb0, 0xd7, 0xd0, 0xdf, 0x6b, 0x6c, 0x56, 0x3b, 0x34, 0x92, - 0xf7, 0x6c, 0xe2, 0x75, 0xc6, 0x0c, 0x8d, 0x64, 0x1c, 0xee, 0x5a, 0x6c, 0x74, 0x51, 0x57, 0xdc, - 0x09, 0x49, 0xec, 0x88, 0xb3, 0x64, 0x6f, 0x01, 0xf0, 0xab, 0x2a, 0x1a, 0xd4, 0x2b, 0x69, 0xf8, - 0xad, 0x0d, 0xfb, 0x27, 0x67, 0x68, 0x18, 0x03, 0xc7, 0x16, 0xba, 0xb6, 0xd0, 0xce, 0xdd, 0x4b, - 0xda, 0x34, 0x28, 0x77, 0xab, 0x22, 0xe7, 0x10, 0x92, 0xf8, 0x41, 0x78, 0x47, 0x63, 0x9c, 0x47, - 0x21, 0xb8, 0x93, 0xe5, 0xb4, 0xd0, 0x86, 0xbd, 0x04, 0x5a, 0xb6, 0x9c, 0x84, 0xbd, 0xf8, 0xd9, - 0x93, 0x9b, 0xa8, 0x2c, 0x99, 0x2c, 0x05, 0x2d, 0xdb, 0x68, 0x08, 0xcf, 0x67, 0xb2, 0x2a, 0x3e, - 0xa3, 0x36, 0xa3, 0x8d, 0xac, 0xbe, 0xe0, 0x27, 0x34, 0xec, 0x11, 0xee, 0xd6, 0x56, 0xe8, 0xd3, - 0x05, 0xeb, 0x2e, 0xae, 0xf7, 0xc4, 0x79, 0x25, 0xfa, 0x41, 0x60, 0x70, 0x9d, 0xb1, 0x01, 0xd0, - 0x71, 0x6e, 0x29, 0x39, 0x82, 0x8e, 0x73, 0xf6, 0x08, 0x74, 0xae, 0x2c, 0xa1, 0xc1, 0xd3, 0x9b, - 0xff, 0xbb, 0x92, 0xb9, 0xc2, 0x46, 0x9a, 0xa2, 0xae, 0x04, 0x9d, 0xab, 0x0e, 0xe9, 0x14, 0x5b, - 0xdc, 0x5a, 0x70, 0x0f, 0xe2, 0x28, 0xd8, 0x2b, 0xf0, 0x46, 0x1b, 0x5c, 0x97, 0x7a, 0xbf, 0xb3, - 0xd8, 0xee, 0xc5, 0x45, 0x47, 0xef, 0xa0, 0x7f, 0xa9, 0x60, 0x00, 0xee, 0x48, 0xa4, 0xc3, 0x45, - 0xea, 0xdf, 0x74, 0xf3, 0xc7, 0x74, 0x9a, 0x2e, 0x52, 0x9f, 0x7c, 0xf0, 0x7f, 0x1d, 0x02, 0xf2, - 0xfb, 0x10, 0x90, 0x3f, 0x87, 0x80, 0x7c, 0xff, 0x1b, 0xdc, 0x64, 0xae, 0xfd, 0xdf, 0xf7, 0xff, - 0x02, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x28, 0x5d, 0xcf, 0xeb, 0x01, 0x00, 0x00, -} - -func (m *KV) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KV) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintPb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintPb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if len(m.UserMeta) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintPb(dAtA, i, uint64(len(m.UserMeta))) - i += copy(dAtA[i:], m.UserMeta) - } - if m.Version != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.Version)) - } - if m.ExpiresAt != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.ExpiresAt)) - } - if len(m.Meta) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintPb(dAtA, i, uint64(len(m.Meta))) - i += copy(dAtA[i:], m.Meta) - } - if m.StreamId != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.StreamId)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *KVList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KVList) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Kv) > 0 { - for _, msg := range m.Kv { - dAtA[i] = 0xa - i++ - i = encodeVarintPb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ManifestChangeSet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ManifestChangeSet) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Changes) > 0 { - for _, msg := range m.Changes { - dAtA[i] = 0xa - i++ - i = encodeVarintPb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ManifestChange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ManifestChange) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.Id)) - } - if m.Op != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.Op)) - } - if m.Level != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintPb(dAtA, i, uint64(m.Level)) - } - if len(m.Checksum) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintPb(dAtA, i, uint64(len(m.Checksum))) - i += copy(dAtA[i:], m.Checksum) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintPb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *KV) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovPb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovPb(uint64(l)) - } - l = len(m.UserMeta) - if l > 0 { - n += 1 + l + sovPb(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovPb(uint64(m.Version)) - } - if m.ExpiresAt != 0 { - n += 1 + sovPb(uint64(m.ExpiresAt)) - } - l = len(m.Meta) - if l > 0 { - n += 1 + l + sovPb(uint64(l)) - } - if m.StreamId != 0 { - n += 1 + sovPb(uint64(m.StreamId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *KVList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Kv) > 0 { - for _, e := range m.Kv { - l = e.Size() - n += 1 + l + sovPb(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ManifestChangeSet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovPb(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ManifestChange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovPb(uint64(m.Id)) - } - if m.Op != 0 { - n += 1 + sovPb(uint64(m.Op)) - } - if m.Level != 0 { - n += 1 + sovPb(uint64(m.Level)) - } - l = len(m.Checksum) - if l > 0 { - n += 1 + l + sovPb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovPb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozPb(x uint64) (n int) { - return sovPb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *KV) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KV: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KV: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserMeta", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UserMeta = append(m.UserMeta[:0], dAtA[iNdEx:postIndex]...) - if m.UserMeta == nil { - m.UserMeta = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiresAt", wireType) - } - m.ExpiresAt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpiresAt |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Meta = append(m.Meta[:0], dAtA[iNdEx:postIndex]...) - if m.Meta == nil { - m.Meta = []byte{} - } - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StreamId", wireType) - } - m.StreamId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StreamId |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KVList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KVList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KVList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kv", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kv = append(m.Kv, &KV{}) - if err := m.Kv[len(m.Kv)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ManifestChangeSet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ManifestChangeSet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ManifestChangeSet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &ManifestChange{}) - if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ManifestChange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ManifestChange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ManifestChange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Op |= ManifestChange_Operation(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Level", wireType) - } - m.Level = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Level |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPb - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...) - if m.Checksum == nil { - m.Checksum = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthPb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthPb - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthPb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipPb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthPb - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthPb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPb = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/dgraph-io/badger/pb/pb.proto b/vendor/github.com/dgraph-io/badger/pb/pb.proto deleted file mode 100644 index c6e7f413..00000000 --- a/vendor/github.com/dgraph-io/badger/pb/pb.proto +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Use protos/gen.sh to generate .pb.go files. -syntax = "proto3"; - -package pb; - -message KV { - bytes key = 1; - bytes value = 2; - bytes user_meta = 3; - uint64 version = 4; - uint64 expires_at = 5; - bytes meta = 6; - - // Stream id is used to identify which stream the KV came from. - uint32 stream_id = 10; -} - -message KVList { - repeated KV kv = 1; -} - -message ManifestChangeSet { - // A set of changes that are applied atomically. - repeated ManifestChange changes = 1; -} - -message ManifestChange { - uint64 Id = 1; - enum Operation { - CREATE = 0; - DELETE = 1; - } - Operation Op = 2; - uint32 Level = 3; // Only used for CREATE - bytes Checksum = 4; // Only used for CREATE -} diff --git a/vendor/github.com/dgraph-io/badger/publisher.go b/vendor/github.com/dgraph-io/badger/publisher.go deleted file mode 100644 index 60f4fc90..00000000 --- a/vendor/github.com/dgraph-io/badger/publisher.go +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2019 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package badger - -import ( - "bytes" - "sync" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/y" -) - -type subscriber struct { - prefixes [][]byte - sendCh chan<- *pb.KVList - subCloser *y.Closer -} - -type publisher struct { - sync.Mutex - pubCh chan requests - subscribers map[uint64]subscriber - nextID uint64 -} - -func newPublisher() *publisher { - return &publisher{ - pubCh: make(chan requests, 1000), - subscribers: make(map[uint64]subscriber), - nextID: 0, - } -} - -func (p *publisher) listenForUpdates(c *y.Closer) { - defer func() { - p.cleanSubscribers() - c.Done() - }() - slurp := func(batch []*request) { - for { - select { - case reqs := <-p.pubCh: - batch = append(batch, reqs...) - default: - p.publishUpdates(batch) - return - } - } - } - for { - select { - case <-c.HasBeenClosed(): - return - case reqs := <-p.pubCh: - slurp(reqs) - } - } -} - -func (p *publisher) publishUpdates(reqs requests) { - kvs := &pb.KVList{} - p.Lock() - defer func() { - p.Unlock() - // Release all the request. - reqs.DecrRef() - }() - for _, s := range p.subscribers { - for _, prefix := range s.prefixes { - for _, req := range reqs { - for _, e := range req.Entries { - // TODO: Use trie to find subscribers. - if bytes.HasPrefix(e.Key, prefix) { - k := y.SafeCopy(nil, e.Key) - kv := &pb.KV{ - Key: y.ParseKey(k), - Value: y.SafeCopy(nil, e.Value), - Meta: []byte{e.UserMeta}, - ExpiresAt: e.ExpiresAt, - Version: y.ParseTs(k), - } - kvs.Kv = append(kvs.Kv, kv) - } - } - } - } - if len(kvs.GetKv()) > 0 { - s.sendCh <- kvs - } - } -} - -func (p *publisher) newSubscriber(c *y.Closer, prefixes ...[]byte) (<-chan *pb.KVList, uint64) { - p.Lock() - defer p.Unlock() - ch := make(chan *pb.KVList, 1000) - id := p.nextID - // Increment next ID. - p.nextID++ - p.subscribers[id] = subscriber{ - prefixes: prefixes, - sendCh: ch, - subCloser: c, - } - return ch, id -} - -// cleanSubscribers stops all the subscribers. Ideally, It should be called while closing DB. -func (p *publisher) cleanSubscribers() { - p.Lock() - defer p.Unlock() - for id, s := range p.subscribers { - delete(p.subscribers, id) - s.subCloser.SignalAndWait() - } -} - -func (p *publisher) deleteSubscriber(id uint64) { - p.Lock() - defer p.Unlock() - if _, ok := p.subscribers[id]; !ok { - return - } - delete(p.subscribers, id) -} - -func (p *publisher) sendUpdates(reqs []*request) { - // TODO: Prefix check before pushing into pubCh. - if p.noOfSubscribers() != 0 { - p.pubCh <- reqs - } -} - -func (p *publisher) noOfSubscribers() int { - p.Lock() - defer p.Unlock() - return len(p.subscribers) -} diff --git a/vendor/github.com/dgraph-io/badger/skl/README.md b/vendor/github.com/dgraph-io/badger/skl/README.md deleted file mode 100644 index 92fa68bb..00000000 --- a/vendor/github.com/dgraph-io/badger/skl/README.md +++ /dev/null @@ -1,113 +0,0 @@ -This is much better than `skiplist` and `slist`. - -``` -BenchmarkReadWrite/frac_0-8 3000000 537 ns/op -BenchmarkReadWrite/frac_1-8 3000000 503 ns/op -BenchmarkReadWrite/frac_2-8 3000000 492 ns/op -BenchmarkReadWrite/frac_3-8 3000000 475 ns/op -BenchmarkReadWrite/frac_4-8 3000000 440 ns/op -BenchmarkReadWrite/frac_5-8 5000000 442 ns/op -BenchmarkReadWrite/frac_6-8 5000000 380 ns/op -BenchmarkReadWrite/frac_7-8 5000000 338 ns/op -BenchmarkReadWrite/frac_8-8 5000000 294 ns/op -BenchmarkReadWrite/frac_9-8 10000000 268 ns/op -BenchmarkReadWrite/frac_10-8 100000000 26.3 ns/op -``` - -And even better than a simple map with read-write lock: - -``` -BenchmarkReadWriteMap/frac_0-8 2000000 774 ns/op -BenchmarkReadWriteMap/frac_1-8 2000000 647 ns/op -BenchmarkReadWriteMap/frac_2-8 3000000 605 ns/op -BenchmarkReadWriteMap/frac_3-8 3000000 603 ns/op -BenchmarkReadWriteMap/frac_4-8 3000000 556 ns/op -BenchmarkReadWriteMap/frac_5-8 3000000 472 ns/op -BenchmarkReadWriteMap/frac_6-8 3000000 476 ns/op -BenchmarkReadWriteMap/frac_7-8 3000000 457 ns/op -BenchmarkReadWriteMap/frac_8-8 5000000 444 ns/op -BenchmarkReadWriteMap/frac_9-8 5000000 361 ns/op -BenchmarkReadWriteMap/frac_10-8 10000000 212 ns/op -``` - -# Node Pooling - -Command used - -``` -rm -Rf tmp && /usr/bin/time -l ./populate -keys_mil 10 -``` - -For pprof results, we run without using /usr/bin/time. There are four runs below. - -Results seem to vary quite a bit between runs. - -## Before node pooling - -``` -1311.53MB of 1338.69MB total (97.97%) -Dropped 30 nodes (cum <= 6.69MB) -Showing top 10 nodes out of 37 (cum >= 12.50MB) - flat flat% sum% cum cum% - 523.04MB 39.07% 39.07% 523.04MB 39.07% github.com/dgraph-io/badger/skl.(*Skiplist).Put - 184.51MB 13.78% 52.85% 184.51MB 13.78% runtime.stringtoslicebyte - 166.01MB 12.40% 65.25% 689.04MB 51.47% github.com/dgraph-io/badger/mem.(*Table).Put - 165MB 12.33% 77.58% 165MB 12.33% runtime.convT2E - 116.92MB 8.73% 86.31% 116.92MB 8.73% bytes.makeSlice - 62.50MB 4.67% 90.98% 62.50MB 4.67% main.newValue - 34.50MB 2.58% 93.56% 34.50MB 2.58% github.com/dgraph-io/badger/table.(*BlockIterator).parseKV - 25.50MB 1.90% 95.46% 100.06MB 7.47% github.com/dgraph-io/badger/y.(*MergeIterator).Next - 21.06MB 1.57% 97.04% 21.06MB 1.57% github.com/dgraph-io/badger/table.(*Table).read - 12.50MB 0.93% 97.97% 12.50MB 0.93% github.com/dgraph-io/badger/table.header.Encode - - 128.31 real 329.37 user 17.11 sys -3355660288 maximum resident set size - 0 average shared memory size - 0 average unshared data size - 0 average unshared stack size - 2203080 page reclaims - 764 page faults - 0 swaps - 275 block input operations - 76 block output operations - 0 messages sent - 0 messages received - 0 signals received - 49173 voluntary context switches - 599922 involuntary context switches -``` - -## After node pooling - -``` -1963.13MB of 2026.09MB total (96.89%) -Dropped 29 nodes (cum <= 10.13MB) -Showing top 10 nodes out of 41 (cum >= 185.62MB) - flat flat% sum% cum cum% - 658.05MB 32.48% 32.48% 658.05MB 32.48% github.com/dgraph-io/badger/skl.glob..func1 - 297.51MB 14.68% 47.16% 297.51MB 14.68% runtime.convT2E - 257.51MB 12.71% 59.87% 257.51MB 12.71% runtime.stringtoslicebyte - 249.01MB 12.29% 72.16% 1007.06MB 49.70% github.com/dgraph-io/badger/mem.(*Table).Put - 142.43MB 7.03% 79.19% 142.43MB 7.03% bytes.makeSlice - 100MB 4.94% 84.13% 758.05MB 37.41% github.com/dgraph-io/badger/skl.newNode - 99.50MB 4.91% 89.04% 99.50MB 4.91% main.newValue - 75MB 3.70% 92.74% 75MB 3.70% github.com/dgraph-io/badger/table.(*BlockIterator).parseKV - 44.62MB 2.20% 94.94% 44.62MB 2.20% github.com/dgraph-io/badger/table.(*Table).read - 39.50MB 1.95% 96.89% 185.62MB 9.16% github.com/dgraph-io/badger/y.(*MergeIterator).Next - - 135.58 real 374.29 user 17.65 sys -3740614656 maximum resident set size - 0 average shared memory size - 0 average unshared data size - 0 average unshared stack size - 2276566 page reclaims - 770 page faults - 0 swaps - 128 block input operations - 90 block output operations - 0 messages sent - 0 messages received - 0 signals received - 46434 voluntary context switches - 597049 involuntary context switches -``` \ No newline at end of file diff --git a/vendor/github.com/dgraph-io/badger/skl/arena.go b/vendor/github.com/dgraph-io/badger/skl/arena.go deleted file mode 100644 index def55071..00000000 --- a/vendor/github.com/dgraph-io/badger/skl/arena.go +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package skl - -import ( - "sync/atomic" - "unsafe" - - "github.com/dgraph-io/badger/y" -) - -const ( - offsetSize = int(unsafe.Sizeof(uint32(0))) - - // Always align nodes on 64-bit boundaries, even on 32-bit architectures, - // so that the node.value field is 64-bit aligned. This is necessary because - // node.getValueOffset uses atomic.LoadUint64, which expects its input - // pointer to be 64-bit aligned. - nodeAlign = int(unsafe.Sizeof(uint64(0))) - 1 -) - -// Arena should be lock-free. -type Arena struct { - n uint32 - buf []byte -} - -// newArena returns a new arena. -func newArena(n int64) *Arena { - // Don't store data at position 0 in order to reserve offset=0 as a kind - // of nil pointer. - out := &Arena{ - n: 1, - buf: make([]byte, n), - } - return out -} - -func (s *Arena) size() int64 { - return int64(atomic.LoadUint32(&s.n)) -} - -func (s *Arena) reset() { - atomic.StoreUint32(&s.n, 0) -} - -// putNode allocates a node in the arena. The node is aligned on a pointer-sized -// boundary. The arena offset of the node is returned. -func (s *Arena) putNode(height int) uint32 { - // Compute the amount of the tower that will never be used, since the height - // is less than maxHeight. - unusedSize := (maxHeight - height) * offsetSize - - // Pad the allocation with enough bytes to ensure pointer alignment. - l := uint32(MaxNodeSize - unusedSize + nodeAlign) - n := atomic.AddUint32(&s.n, l) - y.AssertTruef(int(n) <= len(s.buf), - "Arena too small, toWrite:%d newTotal:%d limit:%d", - l, n, len(s.buf)) - - // Return the aligned offset. - m := (n - l + uint32(nodeAlign)) & ^uint32(nodeAlign) - return m -} - -// Put will *copy* val into arena. To make better use of this, reuse your input -// val buffer. Returns an offset into buf. User is responsible for remembering -// size of val. We could also store this size inside arena but the encoding and -// decoding will incur some overhead. -func (s *Arena) putVal(v y.ValueStruct) uint32 { - l := uint32(v.EncodedSize()) - n := atomic.AddUint32(&s.n, l) - y.AssertTruef(int(n) <= len(s.buf), - "Arena too small, toWrite:%d newTotal:%d limit:%d", - l, n, len(s.buf)) - m := n - l - v.Encode(s.buf[m:]) - return m -} - -func (s *Arena) putKey(key []byte) uint32 { - l := uint32(len(key)) - n := atomic.AddUint32(&s.n, l) - y.AssertTruef(int(n) <= len(s.buf), - "Arena too small, toWrite:%d newTotal:%d limit:%d", - l, n, len(s.buf)) - m := n - l - y.AssertTrue(len(key) == copy(s.buf[m:n], key)) - return m -} - -// getNode returns a pointer to the node located at offset. If the offset is -// zero, then the nil node pointer is returned. -func (s *Arena) getNode(offset uint32) *node { - if offset == 0 { - return nil - } - - return (*node)(unsafe.Pointer(&s.buf[offset])) -} - -// getKey returns byte slice at offset. -func (s *Arena) getKey(offset uint32, size uint16) []byte { - return s.buf[offset : offset+uint32(size)] -} - -// getVal returns byte slice at offset. The given size should be just the value -// size and should NOT include the meta bytes. -func (s *Arena) getVal(offset uint32, size uint16) (ret y.ValueStruct) { - ret.Decode(s.buf[offset : offset+uint32(size)]) - return -} - -// getNodeOffset returns the offset of node in the arena. If the node pointer is -// nil, then the zero offset is returned. -func (s *Arena) getNodeOffset(nd *node) uint32 { - if nd == nil { - return 0 - } - - return uint32(uintptr(unsafe.Pointer(nd)) - uintptr(unsafe.Pointer(&s.buf[0]))) -} diff --git a/vendor/github.com/dgraph-io/badger/skl/skl.go b/vendor/github.com/dgraph-io/badger/skl/skl.go deleted file mode 100644 index b465b09e..00000000 --- a/vendor/github.com/dgraph-io/badger/skl/skl.go +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -Adapted from RocksDB inline skiplist. - -Key differences: -- No optimization for sequential inserts (no "prev"). -- No custom comparator. -- Support overwrites. This requires care when we see the same key when inserting. - For RocksDB or LevelDB, overwrites are implemented as a newer sequence number in the key, so - there is no need for values. We don't intend to support versioning. In-place updates of values - would be more efficient. -- We discard all non-concurrent code. -- We do not support Splices. This simplifies the code a lot. -- No AllocateNode or other pointer arithmetic. -- We combine the findLessThan, findGreaterOrEqual, etc into one function. -*/ - -package skl - -import ( - "math" - "math/rand" - "sync/atomic" - "unsafe" - - "github.com/dgraph-io/badger/y" -) - -const ( - maxHeight = 20 - heightIncrease = math.MaxUint32 / 3 -) - -// MaxNodeSize is the memory footprint of a node of maximum height. -const MaxNodeSize = int(unsafe.Sizeof(node{})) - -type node struct { - // Multiple parts of the value are encoded as a single uint64 so that it - // can be atomically loaded and stored: - // value offset: uint32 (bits 0-31) - // value size : uint16 (bits 32-47) - value uint64 - - // A byte slice is 24 bytes. We are trying to save space here. - keyOffset uint32 // Immutable. No need to lock to access key. - keySize uint16 // Immutable. No need to lock to access key. - - // Height of the tower. - height uint16 - - // Most nodes do not need to use the full height of the tower, since the - // probability of each successive level decreases exponentially. Because - // these elements are never accessed, they do not need to be allocated. - // Therefore, when a node is allocated in the arena, its memory footprint - // is deliberately truncated to not include unneeded tower elements. - // - // All accesses to elements should use CAS operations, with no need to lock. - tower [maxHeight]uint32 -} - -// Skiplist maps keys to values (in memory) -type Skiplist struct { - height int32 // Current height. 1 <= height <= kMaxHeight. CAS. - head *node - ref int32 - arena *Arena -} - -// IncrRef increases the refcount -func (s *Skiplist) IncrRef() { - atomic.AddInt32(&s.ref, 1) -} - -// DecrRef decrements the refcount, deallocating the Skiplist when done using it -func (s *Skiplist) DecrRef() { - newRef := atomic.AddInt32(&s.ref, -1) - if newRef > 0 { - return - } - - s.arena.reset() - // Indicate we are closed. Good for testing. Also, lets GC reclaim memory. Race condition - // here would suggest we are accessing skiplist when we are supposed to have no reference! - s.arena = nil -} - -func (s *Skiplist) valid() bool { return s.arena != nil } - -func newNode(arena *Arena, key []byte, v y.ValueStruct, height int) *node { - // The base level is already allocated in the node struct. - offset := arena.putNode(height) - node := arena.getNode(offset) - node.keyOffset = arena.putKey(key) - node.keySize = uint16(len(key)) - node.height = uint16(height) - node.value = encodeValue(arena.putVal(v), v.EncodedSize()) - return node -} - -func encodeValue(valOffset uint32, valSize uint16) uint64 { - return uint64(valSize)<<32 | uint64(valOffset) -} - -func decodeValue(value uint64) (valOffset uint32, valSize uint16) { - valOffset = uint32(value) - valSize = uint16(value >> 32) - return -} - -// NewSkiplist makes a new empty skiplist, with a given arena size -func NewSkiplist(arenaSize int64) *Skiplist { - arena := newArena(arenaSize) - head := newNode(arena, nil, y.ValueStruct{}, maxHeight) - return &Skiplist{ - height: 1, - head: head, - arena: arena, - ref: 1, - } -} - -func (s *node) getValueOffset() (uint32, uint16) { - value := atomic.LoadUint64(&s.value) - return decodeValue(value) -} - -func (s *node) key(arena *Arena) []byte { - return arena.getKey(s.keyOffset, s.keySize) -} - -func (s *node) setValue(arena *Arena, v y.ValueStruct) { - valOffset := arena.putVal(v) - value := encodeValue(valOffset, v.EncodedSize()) - atomic.StoreUint64(&s.value, value) -} - -func (s *node) getNextOffset(h int) uint32 { - return atomic.LoadUint32(&s.tower[h]) -} - -func (s *node) casNextOffset(h int, old, val uint32) bool { - return atomic.CompareAndSwapUint32(&s.tower[h], old, val) -} - -// Returns true if key is strictly > n.key. -// If n is nil, this is an "end" marker and we return false. -//func (s *Skiplist) keyIsAfterNode(key []byte, n *node) bool { -// y.AssertTrue(n != s.head) -// return n != nil && y.CompareKeys(key, n.key) > 0 -//} - -func randomHeight() int { - h := 1 - for h < maxHeight && rand.Uint32() <= heightIncrease { - h++ - } - return h -} - -func (s *Skiplist) getNext(nd *node, height int) *node { - return s.arena.getNode(nd.getNextOffset(height)) -} - -// findNear finds the node near to key. -// If less=true, it finds rightmost node such that node.key < key (if allowEqual=false) or -// node.key <= key (if allowEqual=true). -// If less=false, it finds leftmost node such that node.key > key (if allowEqual=false) or -// node.key >= key (if allowEqual=true). -// Returns the node found. The bool returned is true if the node has key equal to given key. -func (s *Skiplist) findNear(key []byte, less bool, allowEqual bool) (*node, bool) { - x := s.head - level := int(s.getHeight() - 1) - for { - // Assume x.key < key. - next := s.getNext(x, level) - if next == nil { - // x.key < key < END OF LIST - if level > 0 { - // Can descend further to iterate closer to the end. - level-- - continue - } - // Level=0. Cannot descend further. Let's return something that makes sense. - if !less { - return nil, false - } - // Try to return x. Make sure it is not a head node. - if x == s.head { - return nil, false - } - return x, false - } - - nextKey := next.key(s.arena) - cmp := y.CompareKeys(key, nextKey) - if cmp > 0 { - // x.key < next.key < key. We can continue to move right. - x = next - continue - } - if cmp == 0 { - // x.key < key == next.key. - if allowEqual { - return next, true - } - if !less { - // We want >, so go to base level to grab the next bigger note. - return s.getNext(next, 0), false - } - // We want <. If not base level, we should go closer in the next level. - if level > 0 { - level-- - continue - } - // On base level. Return x. - if x == s.head { - return nil, false - } - return x, false - } - // cmp < 0. In other words, x.key < key < next. - if level > 0 { - level-- - continue - } - // At base level. Need to return something. - if !less { - return next, false - } - // Try to return x. Make sure it is not a head node. - if x == s.head { - return nil, false - } - return x, false - } -} - -// findSpliceForLevel returns (outBefore, outAfter) with outBefore.key <= key <= outAfter.key. -// The input "before" tells us where to start looking. -// If we found a node with the same key, then we return outBefore = outAfter. -// Otherwise, outBefore.key < key < outAfter.key. -func (s *Skiplist) findSpliceForLevel(key []byte, before *node, level int) (*node, *node) { - for { - // Assume before.key < key. - next := s.getNext(before, level) - if next == nil { - return before, next - } - nextKey := next.key(s.arena) - cmp := y.CompareKeys(key, nextKey) - if cmp == 0 { - // Equality case. - return next, next - } - if cmp < 0 { - // before.key < key < next.key. We are done for this level. - return before, next - } - before = next // Keep moving right on this level. - } -} - -func (s *Skiplist) getHeight() int32 { - return atomic.LoadInt32(&s.height) -} - -// Put inserts the key-value pair. -func (s *Skiplist) Put(key []byte, v y.ValueStruct) { - // Since we allow overwrite, we may not need to create a new node. We might not even need to - // increase the height. Let's defer these actions. - - listHeight := s.getHeight() - var prev [maxHeight + 1]*node - var next [maxHeight + 1]*node - prev[listHeight] = s.head - next[listHeight] = nil - for i := int(listHeight) - 1; i >= 0; i-- { - // Use higher level to speed up for current level. - prev[i], next[i] = s.findSpliceForLevel(key, prev[i+1], i) - if prev[i] == next[i] { - prev[i].setValue(s.arena, v) - return - } - } - - // We do need to create a new node. - height := randomHeight() - x := newNode(s.arena, key, v, height) - - // Try to increase s.height via CAS. - listHeight = s.getHeight() - for height > int(listHeight) { - if atomic.CompareAndSwapInt32(&s.height, listHeight, int32(height)) { - // Successfully increased skiplist.height. - break - } - listHeight = s.getHeight() - } - - // We always insert from the base level and up. After you add a node in base level, we cannot - // create a node in the level above because it would have discovered the node in the base level. - for i := 0; i < height; i++ { - for { - if prev[i] == nil { - y.AssertTrue(i > 1) // This cannot happen in base level. - // We haven't computed prev, next for this level because height exceeds old listHeight. - // For these levels, we expect the lists to be sparse, so we can just search from head. - prev[i], next[i] = s.findSpliceForLevel(key, s.head, i) - // Someone adds the exact same key before we are able to do so. This can only happen on - // the base level. But we know we are not on the base level. - y.AssertTrue(prev[i] != next[i]) - } - nextOffset := s.arena.getNodeOffset(next[i]) - x.tower[i] = nextOffset - if prev[i].casNextOffset(i, nextOffset, s.arena.getNodeOffset(x)) { - // Managed to insert x between prev[i] and next[i]. Go to the next level. - break - } - // CAS failed. We need to recompute prev and next. - // It is unlikely to be helpful to try to use a different level as we redo the search, - // because it is unlikely that lots of nodes are inserted between prev[i] and next[i]. - prev[i], next[i] = s.findSpliceForLevel(key, prev[i], i) - if prev[i] == next[i] { - y.AssertTruef(i == 0, "Equality can happen only on base level: %d", i) - prev[i].setValue(s.arena, v) - return - } - } - } -} - -// Empty returns if the Skiplist is empty. -func (s *Skiplist) Empty() bool { - return s.findLast() == nil -} - -// findLast returns the last element. If head (empty list), we return nil. All the find functions -// will NEVER return the head nodes. -func (s *Skiplist) findLast() *node { - n := s.head - level := int(s.getHeight()) - 1 - for { - next := s.getNext(n, level) - if next != nil { - n = next - continue - } - if level == 0 { - if n == s.head { - return nil - } - return n - } - level-- - } -} - -// Get gets the value associated with the key. It returns a valid value if it finds equal or earlier -// version of the same key. -func (s *Skiplist) Get(key []byte) y.ValueStruct { - n, _ := s.findNear(key, false, true) // findGreaterOrEqual. - if n == nil { - return y.ValueStruct{} - } - - nextKey := s.arena.getKey(n.keyOffset, n.keySize) - if !y.SameKey(key, nextKey) { - return y.ValueStruct{} - } - - valOffset, valSize := n.getValueOffset() - vs := s.arena.getVal(valOffset, valSize) - vs.Version = y.ParseTs(nextKey) - return vs -} - -// NewIterator returns a skiplist iterator. You have to Close() the iterator. -func (s *Skiplist) NewIterator() *Iterator { - s.IncrRef() - return &Iterator{list: s} -} - -// MemSize returns the size of the Skiplist in terms of how much memory is used within its internal -// arena. -func (s *Skiplist) MemSize() int64 { return s.arena.size() } - -// Iterator is an iterator over skiplist object. For new objects, you just -// need to initialize Iterator.list. -type Iterator struct { - list *Skiplist - n *node -} - -// Close frees the resources held by the iterator -func (s *Iterator) Close() error { - s.list.DecrRef() - return nil -} - -// Valid returns true iff the iterator is positioned at a valid node. -func (s *Iterator) Valid() bool { return s.n != nil } - -// Key returns the key at the current position. -func (s *Iterator) Key() []byte { - return s.list.arena.getKey(s.n.keyOffset, s.n.keySize) -} - -// Value returns value. -func (s *Iterator) Value() y.ValueStruct { - valOffset, valSize := s.n.getValueOffset() - return s.list.arena.getVal(valOffset, valSize) -} - -// Next advances to the next position. -func (s *Iterator) Next() { - y.AssertTrue(s.Valid()) - s.n = s.list.getNext(s.n, 0) -} - -// Prev advances to the previous position. -func (s *Iterator) Prev() { - y.AssertTrue(s.Valid()) - s.n, _ = s.list.findNear(s.Key(), true, false) // find <. No equality allowed. -} - -// Seek advances to the first entry with a key >= target. -func (s *Iterator) Seek(target []byte) { - s.n, _ = s.list.findNear(target, false, true) // find >=. -} - -// SeekForPrev finds an entry with key <= target. -func (s *Iterator) SeekForPrev(target []byte) { - s.n, _ = s.list.findNear(target, true, true) // find <=. -} - -// SeekToFirst seeks position at the first entry in list. -// Final state of iterator is Valid() iff list is not empty. -func (s *Iterator) SeekToFirst() { - s.n = s.list.getNext(s.list.head, 0) -} - -// SeekToLast seeks position at the last entry in list. -// Final state of iterator is Valid() iff list is not empty. -func (s *Iterator) SeekToLast() { - s.n = s.list.findLast() -} - -// UniIterator is a unidirectional memtable iterator. It is a thin wrapper around -// Iterator. We like to keep Iterator as before, because it is more powerful and -// we might support bidirectional iterators in the future. -type UniIterator struct { - iter *Iterator - reversed bool -} - -// NewUniIterator returns a UniIterator. -func (s *Skiplist) NewUniIterator(reversed bool) *UniIterator { - return &UniIterator{ - iter: s.NewIterator(), - reversed: reversed, - } -} - -// Next implements y.Interface -func (s *UniIterator) Next() { - if !s.reversed { - s.iter.Next() - } else { - s.iter.Prev() - } -} - -// Rewind implements y.Interface -func (s *UniIterator) Rewind() { - if !s.reversed { - s.iter.SeekToFirst() - } else { - s.iter.SeekToLast() - } -} - -// Seek implements y.Interface -func (s *UniIterator) Seek(key []byte) { - if !s.reversed { - s.iter.Seek(key) - } else { - s.iter.SeekForPrev(key) - } -} - -// Key implements y.Interface -func (s *UniIterator) Key() []byte { return s.iter.Key() } - -// Value implements y.Interface -func (s *UniIterator) Value() y.ValueStruct { return s.iter.Value() } - -// Valid implements y.Interface -func (s *UniIterator) Valid() bool { return s.iter.Valid() } - -// Close implements y.Interface (and frees up the iter's resources) -func (s *UniIterator) Close() error { return s.iter.Close() } diff --git a/vendor/github.com/dgraph-io/badger/stream.go b/vendor/github.com/dgraph-io/badger/stream.go deleted file mode 100644 index f0841a6a..00000000 --- a/vendor/github.com/dgraph-io/badger/stream.go +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright 2018 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "context" - "math" - "sync" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/y" - humanize "github.com/dustin/go-humanize" -) - -const pageSize = 4 << 20 // 4MB - -// Stream provides a framework to concurrently iterate over a snapshot of Badger, pick up -// key-values, batch them up and call Send. Stream does concurrent iteration over many smaller key -// ranges. It does NOT send keys in lexicographical sorted order. To get keys in sorted -// order, use Iterator. -type Stream struct { - // Prefix to only iterate over certain range of keys. If set to nil (default), Stream would - // iterate over the entire DB. - Prefix []byte - - // Number of goroutines to use for iterating over key ranges. Defaults to 16. - NumGo int - - // Badger would produce log entries in Infof to indicate the progress of Stream. LogPrefix can - // be used to help differentiate them from other activities. Default is "Badger.Stream". - LogPrefix string - - // ChooseKey is invoked each time a new key is encountered. Note that this is not called - // on every version of the value, only the first encountered version (i.e. the highest version - // of the value a key has). ChooseKey can be left nil to select all keys. - // - // Note: Calls to ChooseKey are concurrent. - ChooseKey func(item *Item) bool - - // KeyToList, similar to ChooseKey, is only invoked on the highest version of the value. It - // is upto the caller to iterate over the versions and generate zero, one or more KVs. It - // is expected that the user would advance the iterator to go through the versions of the - // values. However, the user MUST immediately return from this function on the first encounter - // with a mismatching key. See example usage in ToList function. Can be left nil to use ToList - // function by default. - // - // Note: Calls to KeyToList are concurrent. - KeyToList func(key []byte, itr *Iterator) (*pb.KVList, error) - - // This is the method where Stream sends the final output. All calls to Send are done by a - // single goroutine, i.e. logic within Send method can expect single threaded execution. - Send func(*pb.KVList) error - - readTs uint64 - db *DB - rangeCh chan keyRange - kvChan chan *pb.KVList - nextStreamId uint32 -} - -// ToList is a default implementation of KeyToList. It picks up all valid versions of the key, -// skipping over deleted or expired keys. -func (st *Stream) ToList(key []byte, itr *Iterator) (*pb.KVList, error) { - list := &pb.KVList{} - for ; itr.Valid(); itr.Next() { - item := itr.Item() - if item.IsDeletedOrExpired() { - break - } - if !bytes.Equal(key, item.Key()) { - // Break out on the first encounter with another key. - break - } - - valCopy, err := item.ValueCopy(nil) - if err != nil { - return nil, err - } - kv := &pb.KV{ - Key: item.KeyCopy(nil), - Value: valCopy, - UserMeta: []byte{item.UserMeta()}, - Version: item.Version(), - ExpiresAt: item.ExpiresAt(), - } - list.Kv = append(list.Kv, kv) - if st.db.opt.NumVersionsToKeep == 1 { - break - } - - if item.DiscardEarlierVersions() { - break - } - } - return list, nil -} - -// keyRange is [start, end), including start, excluding end. Do ensure that the start, -// end byte slices are owned by keyRange struct. -func (st *Stream) produceRanges(ctx context.Context) { - splits := st.db.KeySplits(st.Prefix) - - // We don't need to create more key ranges than NumGo goroutines. This way, we will have limited - // number of "streams" coming out, which then helps limit the memory used by SSWriter. - { - pickEvery := int(math.Floor(float64(len(splits)) / float64(st.NumGo))) - if pickEvery < 1 { - pickEvery = 1 - } - filtered := splits[:0] - for i, split := range splits { - if (i+1)%pickEvery == 0 { - filtered = append(filtered, split) - } - } - splits = filtered - } - - start := y.SafeCopy(nil, st.Prefix) - for _, key := range splits { - st.rangeCh <- keyRange{left: start, right: y.SafeCopy(nil, []byte(key))} - start = y.SafeCopy(nil, []byte(key)) - } - // Edge case: prefix is empty and no splits exist. In that case, we should have at least one - // keyRange output. - st.rangeCh <- keyRange{left: start} - close(st.rangeCh) -} - -// produceKVs picks up ranges from rangeCh, generates KV lists and sends them to kvChan. -func (st *Stream) produceKVs(ctx context.Context) error { - var size int - var txn *Txn - if st.readTs > 0 { - txn = st.db.NewTransactionAt(st.readTs, false) - } else { - txn = st.db.NewTransaction(false) - } - defer txn.Discard() - - iterate := func(kr keyRange) error { - iterOpts := DefaultIteratorOptions - iterOpts.AllVersions = true - iterOpts.Prefix = st.Prefix - iterOpts.PrefetchValues = false - itr := txn.NewIterator(iterOpts) - defer itr.Close() - - // This unique stream id is used to identify all the keys from this iteration. - streamId := atomic.AddUint32(&st.nextStreamId, 1) - - outList := new(pb.KVList) - var prevKey []byte - for itr.Seek(kr.left); itr.Valid(); { - // it.Valid would only return true for keys with the provided Prefix in iterOpts. - item := itr.Item() - if bytes.Equal(item.Key(), prevKey) { - itr.Next() - continue - } - prevKey = append(prevKey[:0], item.Key()...) - - // Check if we reached the end of the key range. - if len(kr.right) > 0 && bytes.Compare(item.Key(), kr.right) >= 0 { - break - } - // Check if we should pick this key. - if st.ChooseKey != nil && !st.ChooseKey(item) { - continue - } - - // Now convert to key value. - list, err := st.KeyToList(item.KeyCopy(nil), itr) - if err != nil { - return err - } - if list == nil || len(list.Kv) == 0 { - continue - } - outList.Kv = append(outList.Kv, list.Kv...) - size += list.Size() - if size >= pageSize { - for _, kv := range outList.Kv { - kv.StreamId = streamId - } - select { - case st.kvChan <- outList: - case <-ctx.Done(): - return ctx.Err() - } - outList = new(pb.KVList) - size = 0 - } - } - if len(outList.Kv) > 0 { - for _, kv := range outList.Kv { - kv.StreamId = streamId - } - // TODO: Think of a way to indicate that a stream is over. - select { - case st.kvChan <- outList: - case <-ctx.Done(): - return ctx.Err() - } - } - return nil - } - - for { - select { - case kr, ok := <-st.rangeCh: - if !ok { - // Done with the keys. - return nil - } - if err := iterate(kr); err != nil { - return err - } - case <-ctx.Done(): - return ctx.Err() - } - } -} - -func (st *Stream) streamKVs(ctx context.Context) error { - var count int - var bytesSent uint64 - t := time.NewTicker(time.Second) - defer t.Stop() - now := time.Now() - - slurp := func(batch *pb.KVList) error { - loop: - for { - select { - case kvs, ok := <-st.kvChan: - if !ok { - break loop - } - y.AssertTrue(kvs != nil) - batch.Kv = append(batch.Kv, kvs.Kv...) - default: - break loop - } - } - sz := uint64(batch.Size()) - bytesSent += sz - count += len(batch.Kv) - t := time.Now() - if err := st.Send(batch); err != nil { - return err - } - st.db.opt.Infof("%s Created batch of size: %s in %s.\n", - st.LogPrefix, humanize.Bytes(sz), time.Since(t)) - return nil - } - -outer: - for { - var batch *pb.KVList - select { - case <-ctx.Done(): - return ctx.Err() - - case <-t.C: - dur := time.Since(now) - durSec := uint64(dur.Seconds()) - if durSec == 0 { - continue - } - speed := bytesSent / durSec - st.db.opt.Infof("%s Time elapsed: %s, bytes sent: %s, speed: %s/sec\n", st.LogPrefix, - y.FixedDuration(dur), humanize.Bytes(bytesSent), humanize.Bytes(speed)) - - case kvs, ok := <-st.kvChan: - if !ok { - break outer - } - y.AssertTrue(kvs != nil) - batch = kvs - if err := slurp(batch); err != nil { - return err - } - } - } - - st.db.opt.Infof("%s Sent %d keys\n", st.LogPrefix, count) - return nil -} - -// Orchestrate runs Stream. It picks up ranges from the SSTables, then runs NumGo number of -// goroutines to iterate over these ranges and batch up KVs in lists. It concurrently runs a single -// goroutine to pick these lists, batch them up further and send to Output.Send. Orchestrate also -// spits logs out to Infof, using provided LogPrefix. Note that all calls to Output.Send -// are serial. In case any of these steps encounter an error, Orchestrate would stop execution and -// return that error. Orchestrate can be called multiple times, but in serial order. -func (st *Stream) Orchestrate(ctx context.Context) error { - st.rangeCh = make(chan keyRange, 3) // Contains keys for posting lists. - - // kvChan should only have a small capacity to ensure that we don't buffer up too much data if - // sending is slow. Page size is set to 4MB, which is used to lazily cap the size of each - // KVList. To get 128MB buffer, we can set the channel size to 32. - st.kvChan = make(chan *pb.KVList, 32) - - if st.KeyToList == nil { - st.KeyToList = st.ToList - } - - // Picks up ranges from Badger, and sends them to rangeCh. - go st.produceRanges(ctx) - - errCh := make(chan error, 1) // Stores error by consumeKeys. - var wg sync.WaitGroup - for i := 0; i < st.NumGo; i++ { - wg.Add(1) - go func() { - defer wg.Done() - // Picks up ranges from rangeCh, generates KV lists, and sends them to kvChan. - if err := st.produceKVs(ctx); err != nil { - select { - case errCh <- err: - default: - } - } - }() - } - - // Pick up key-values from kvChan and send to stream. - kvErr := make(chan error, 1) - go func() { - // Picks up KV lists from kvChan, and sends them to Output. - kvErr <- st.streamKVs(ctx) - }() - wg.Wait() // Wait for produceKVs to be over. - close(st.kvChan) // Now we can close kvChan. - - select { - case err := <-errCh: // Check error from produceKVs. - return err - default: - } - - // Wait for key streaming to be over. - err := <-kvErr - return err -} - -func (db *DB) newStream() *Stream { - return &Stream{db: db, NumGo: 16, LogPrefix: "Badger.Stream"} -} - -// NewStream creates a new Stream. -func (db *DB) NewStream() *Stream { - if db.opt.managedTxns { - panic("This API can not be called in managed mode.") - } - return db.newStream() -} - -// NewStreamAt creates a new Stream at a particular timestamp. Should only be used with managed DB. -func (db *DB) NewStreamAt(readTs uint64) *Stream { - if !db.opt.managedTxns { - panic("This API can only be called in managed mode.") - } - stream := db.newStream() - stream.readTs = readTs - return stream -} diff --git a/vendor/github.com/dgraph-io/badger/stream_writer.go b/vendor/github.com/dgraph-io/badger/stream_writer.go deleted file mode 100644 index cdf8849c..00000000 --- a/vendor/github.com/dgraph-io/badger/stream_writer.go +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright 2019 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "math" - - "github.com/dgraph-io/badger/pb" - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" - humanize "github.com/dustin/go-humanize" - "github.com/pkg/errors" -) - -const headStreamId uint32 = math.MaxUint32 - -// StreamWriter is used to write data coming from multiple streams. The streams must not have any -// overlapping key ranges. Within each stream, the keys must be sorted. Badger Stream framework is -// capable of generating such an output. So, this StreamWriter can be used at the other end to build -// BadgerDB at a much faster pace by writing SSTables (and value logs) directly to LSM tree levels -// without causing any compactions at all. This is way faster than using batched writer or using -// transactions, but only applicable in situations where the keys are pre-sorted and the DB is being -// bootstrapped. Existing data would get deleted when using this writer. So, this is only useful -// when restoring from backup or replicating DB across servers. -// -// StreamWriter should not be called on in-use DB instances. It is designed only to bootstrap new -// DBs. -type StreamWriter struct { - db *DB - done func() - throttle *y.Throttle - head valuePointer - maxVersion uint64 - writers map[uint32]*sortedWriter -} - -// NewStreamWriter creates a StreamWriter. Right after creating StreamWriter, Prepare must be -// called. The memory usage of a StreamWriter is directly proportional to the number of streams -// possible. So, efforts must be made to keep the number of streams low. Stream framework would -// typically use 16 goroutines and hence create 16 streams. -func (db *DB) NewStreamWriter() *StreamWriter { - return &StreamWriter{ - db: db, - // throttle shouldn't make much difference. Memory consumption is based on the number of - // concurrent streams being processed. - throttle: y.NewThrottle(16), - writers: make(map[uint32]*sortedWriter), - } -} - -// Prepare should be called before writing any entry to StreamWriter. It deletes all data present in -// existing DB, stops compactions and any writes being done by other means. Be very careful when -// calling Prepare, because it could result in permanent data loss. Not calling Prepare would result -// in a corrupt Badger instance. -func (sw *StreamWriter) Prepare() error { - var err error - sw.done, err = sw.db.dropAll() - return err -} - -// Write writes KVList to DB. Each KV within the list contains the stream id which StreamWriter -// would use to demux the writes. -func (sw *StreamWriter) Write(kvs *pb.KVList) error { - var entries []*Entry - for _, kv := range kvs.Kv { - var meta, userMeta byte - if len(kv.Meta) > 0 { - meta = kv.Meta[0] - } - if len(kv.UserMeta) > 0 { - userMeta = kv.UserMeta[0] - } - if sw.maxVersion < kv.Version { - sw.maxVersion = kv.Version - } - e := &Entry{ - Key: y.KeyWithTs(kv.Key, kv.Version), - Value: kv.Value, - UserMeta: userMeta, - ExpiresAt: kv.ExpiresAt, - meta: meta, - } - // If the value can be colocated with the key in LSM tree, we can skip - // writing the value to value log. - e.skipVlog = sw.db.shouldWriteValueToLSM(*e) - entries = append(entries, e) - } - req := &request{ - Entries: entries, - } - y.AssertTrue(len(kvs.Kv) == len(req.Entries)) - if err := sw.db.vlog.write([]*request{req}); err != nil { - return err - } - - for i, kv := range kvs.Kv { - e := req.Entries[i] - vptr := req.Ptrs[i] - if !vptr.IsZero() { - y.AssertTrue(sw.head.Less(vptr)) - sw.head = vptr - } - - writer, ok := sw.writers[kv.StreamId] - if !ok { - writer = sw.newWriter(kv.StreamId) - sw.writers[kv.StreamId] = writer - } - - var vs y.ValueStruct - if e.skipVlog { - vs = y.ValueStruct{ - Value: e.Value, - Meta: e.meta, - UserMeta: e.UserMeta, - ExpiresAt: e.ExpiresAt, - } - } else { - vbuf := make([]byte, vptrSize) - vs = y.ValueStruct{ - Value: vptr.Encode(vbuf), - Meta: e.meta | bitValuePointer, - UserMeta: e.UserMeta, - ExpiresAt: e.ExpiresAt, - } - } - if err := writer.Add(e.Key, vs); err != nil { - return err - } - } - return nil -} - -// Flush is called once we are done writing all the entries. It syncs DB directories. It also -// updates Oracle with maxVersion found in all entries (if DB is not managed). -func (sw *StreamWriter) Flush() error { - defer sw.done() - for _, writer := range sw.writers { - if err := writer.Done(); err != nil { - return err - } - } - - // Encode and write the value log head into a new table. - data := make([]byte, vptrSize) - sw.head.Encode(data) - headWriter := sw.newWriter(headStreamId) - if err := headWriter.Add( - y.KeyWithTs(head, sw.maxVersion), - y.ValueStruct{Value: data}); err != nil { - return err - } - if err := headWriter.Done(); err != nil { - return err - } - - if !sw.db.opt.managedTxns { - sw.db.orc = newOracle(sw.db.opt) - sw.db.orc.nextTxnTs = sw.maxVersion - sw.db.orc.txnMark.Done(sw.maxVersion) - sw.db.orc.readMark.Done(sw.maxVersion) - sw.db.orc.incrementNextTs() - } - - // Wait for all files to be written. - if err := sw.throttle.Finish(); err != nil { - return err - } - - // Now sync the directories, so all the files are registered. - if sw.db.opt.ValueDir != sw.db.opt.Dir { - if err := syncDir(sw.db.opt.ValueDir); err != nil { - return err - } - } - return syncDir(sw.db.opt.Dir) -} - -type sortedWriter struct { - db *DB - throttle *y.Throttle - - builder *table.Builder - lastKey []byte - streamId uint32 -} - -func (sw *StreamWriter) newWriter(streamId uint32) *sortedWriter { - return &sortedWriter{ - db: sw.db, - streamId: streamId, - throttle: sw.throttle, - builder: table.NewTableBuilder(), - } -} - -// ErrUnsortedKey is returned when any out of order key arrives at sortedWriter during call to Add. -var ErrUnsortedKey = errors.New("Keys not in sorted order") - -// Add adds key and vs to sortedWriter. -func (w *sortedWriter) Add(key []byte, vs y.ValueStruct) error { - if bytes.Compare(key, w.lastKey) <= 0 { - return ErrUnsortedKey - } - sameKey := y.SameKey(key, w.lastKey) - w.lastKey = y.SafeCopy(w.lastKey, key) - - if err := w.builder.Add(key, vs); err != nil { - return err - } - // Same keys should go into the same SSTable. - if !sameKey && w.builder.ReachedCapacity(w.db.opt.MaxTableSize) { - return w.send() - } - return nil -} - -func (w *sortedWriter) send() error { - if err := w.throttle.Do(); err != nil { - return err - } - go func(builder *table.Builder) { - data := builder.Finish() - err := w.createTable(data) - w.throttle.Done(err) - }(w.builder) - w.builder = table.NewTableBuilder() - return nil -} - -// Done is called once we are done writing all keys and valueStructs -// to sortedWriter. It completes writing current SST to disk. -func (w *sortedWriter) Done() error { - if w.builder.Empty() { - return nil - } - return w.send() -} - -func (w *sortedWriter) createTable(data []byte) error { - if len(data) == 0 { - return nil - } - fileID := w.db.lc.reserveFileID() - fd, err := y.CreateSyncedFile(table.NewFilename(fileID, w.db.opt.Dir), true) - if err != nil { - return err - } - if _, err := fd.Write(data); err != nil { - return err - } - tbl, err := table.OpenTable(fd, w.db.opt.TableLoadingMode, nil) - if err != nil { - return err - } - lc := w.db.lc - - var lhandler *levelHandler - // We should start the levels from 1, because we need level 0 to set the !badger!head key. We - // cannot mix up this key with other keys from the DB, otherwise we would introduce a range - // overlap violation. - y.AssertTrue(len(lc.levels) > 1) - for _, l := range lc.levels[1:] { - ratio := float64(l.getTotalSize()) / float64(l.maxTotalSize) - if ratio < 1.0 { - lhandler = l - break - } - } - if lhandler == nil { - // If we're exceeding the size of the lowest level, shove it in the lowest level. Can't do - // better than that. - lhandler = lc.levels[len(lc.levels)-1] - } - if w.streamId == headStreamId { - // This is a special !badger!head key. We should store it at level 0, separate from all the - // other keys to avoid an overlap. - lhandler = lc.levels[0] - } - // Now that table can be opened successfully, let's add this to the MANIFEST. - change := &pb.ManifestChange{ - Id: tbl.ID(), - Op: pb.ManifestChange_CREATE, - Level: uint32(lhandler.level), - Checksum: tbl.Checksum, - } - if err := w.db.manifest.addChanges([]*pb.ManifestChange{change}); err != nil { - return err - } - if err := lhandler.replaceTables([]*table.Table{}, []*table.Table{tbl}); err != nil { - return err - } - w.db.opt.Infof("Table created: %d at level: %d for stream: %d. Size: %s\n", - fileID, lhandler.level, w.streamId, humanize.Bytes(uint64(tbl.Size()))) - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/structs.go b/vendor/github.com/dgraph-io/badger/structs.go deleted file mode 100644 index 2161b7f3..00000000 --- a/vendor/github.com/dgraph-io/badger/structs.go +++ /dev/null @@ -1,133 +0,0 @@ -package badger - -import ( - "bytes" - "encoding/binary" - "fmt" - "hash/crc32" - - "github.com/dgraph-io/badger/y" -) - -type valuePointer struct { - Fid uint32 - Len uint32 - Offset uint32 -} - -func (p valuePointer) Less(o valuePointer) bool { - if p.Fid != o.Fid { - return p.Fid < o.Fid - } - if p.Offset != o.Offset { - return p.Offset < o.Offset - } - return p.Len < o.Len -} - -func (p valuePointer) IsZero() bool { - return p.Fid == 0 && p.Offset == 0 && p.Len == 0 -} - -const vptrSize = 12 - -// Encode encodes Pointer into byte buffer. -func (p valuePointer) Encode(b []byte) []byte { - binary.BigEndian.PutUint32(b[:4], p.Fid) - binary.BigEndian.PutUint32(b[4:8], p.Len) - binary.BigEndian.PutUint32(b[8:12], p.Offset) - return b[:vptrSize] -} - -func (p *valuePointer) Decode(b []byte) { - p.Fid = binary.BigEndian.Uint32(b[:4]) - p.Len = binary.BigEndian.Uint32(b[4:8]) - p.Offset = binary.BigEndian.Uint32(b[8:12]) -} - -// header is used in value log as a header before Entry. -type header struct { - klen uint32 - vlen uint32 - expiresAt uint64 - meta byte - userMeta byte -} - -const ( - headerBufSize = 18 -) - -func (h header) Encode(out []byte) { - y.AssertTrue(len(out) >= headerBufSize) - binary.BigEndian.PutUint32(out[0:4], h.klen) - binary.BigEndian.PutUint32(out[4:8], h.vlen) - binary.BigEndian.PutUint64(out[8:16], h.expiresAt) - out[16] = h.meta - out[17] = h.userMeta -} - -// Decodes h from buf. -func (h *header) Decode(buf []byte) { - h.klen = binary.BigEndian.Uint32(buf[0:4]) - h.vlen = binary.BigEndian.Uint32(buf[4:8]) - h.expiresAt = binary.BigEndian.Uint64(buf[8:16]) - h.meta = buf[16] - h.userMeta = buf[17] -} - -// Entry provides Key, Value, UserMeta and ExpiresAt. This struct can be used by the user to set data. -type Entry struct { - Key []byte - Value []byte - UserMeta byte - ExpiresAt uint64 // time.Unix - meta byte - - // Fields maintained internally. - offset uint32 - skipVlog bool -} - -func (e *Entry) estimateSize(threshold int) int { - if len(e.Value) < threshold { - return len(e.Key) + len(e.Value) + 2 // Meta, UserMeta - } - return len(e.Key) + 12 + 2 // 12 for ValuePointer, 2 for metas. -} - -// Encodes e to buf. Returns number of bytes written. -func encodeEntry(e *Entry, buf *bytes.Buffer) (int, error) { - h := header{ - klen: uint32(len(e.Key)), - vlen: uint32(len(e.Value)), - expiresAt: e.ExpiresAt, - meta: e.meta, - userMeta: e.UserMeta, - } - - var headerEnc [headerBufSize]byte - h.Encode(headerEnc[:]) - - hash := crc32.New(y.CastagnoliCrcTable) - - buf.Write(headerEnc[:]) - hash.Write(headerEnc[:]) - - buf.Write(e.Key) - hash.Write(e.Key) - - buf.Write(e.Value) - hash.Write(e.Value) - - var crcBuf [crc32.Size]byte - binary.BigEndian.PutUint32(crcBuf[:], hash.Sum32()) - buf.Write(crcBuf[:]) - - return len(headerEnc) + len(e.Key) + len(e.Value) + len(crcBuf), nil -} - -func (e Entry) print(prefix string) { - fmt.Printf("%s Key: %s Meta: %d UserMeta: %d Offset: %d len(val)=%d", - prefix, e.Key, e.meta, e.UserMeta, e.offset, len(e.Value)) -} diff --git a/vendor/github.com/dgraph-io/badger/table/README.md b/vendor/github.com/dgraph-io/badger/table/README.md deleted file mode 100644 index 5d33e96a..00000000 --- a/vendor/github.com/dgraph-io/badger/table/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# BenchmarkRead - -``` -$ go test -bench Read$ -count 3 - -Size of table: 105843444 -BenchmarkRead-8 3 343846914 ns/op -BenchmarkRead-8 3 351790907 ns/op -BenchmarkRead-8 3 351762823 ns/op -``` - -Size of table is 105,843,444 bytes, which is ~101M. - -The rate is ~287M/s which matches our read speed. This is using mmap. - -To read a 64M table, this would take ~0.22s, which is negligible. - -``` -$ go test -bench BenchmarkReadAndBuild -count 3 - -BenchmarkReadAndBuild-8 1 2341034225 ns/op -BenchmarkReadAndBuild-8 1 2346349671 ns/op -BenchmarkReadAndBuild-8 1 2364064576 ns/op -``` - -The rate is ~43M/s. To build a ~64M table, this would take ~1.5s. Note that this -does NOT include the flushing of the table to disk. All we are doing above is -to read one table (mmaped) and write one table in memory. - -The table building takes 1.5-0.22 ~ 1.3s. - -If we are writing out up to 10 tables, this would take 1.5*10 ~ 15s, and ~13s -is spent building the tables. - -When running populate, building one table in memory tends to take ~1.5s to ~2.5s -on my system. Where does this overhead come from? Let's investigate the merging. - -Below, we merge 5 tables. The total size remains unchanged at ~101M. - -``` -$ go test -bench ReadMerged -count 3 -BenchmarkReadMerged-8 1 1321190264 ns/op -BenchmarkReadMerged-8 1 1296958737 ns/op -BenchmarkReadMerged-8 1 1314381178 ns/op -``` - -The rate is ~76M/s. To build a 64M table, this would take ~0.84s. The writing -takes ~1.3s as we saw above. So in total, we expect around 0.84+1.3 ~ 2.1s. -This roughly matches what we observe when running populate. There might be -some additional overhead due to the concurrent writes going on, in flushing the -table to disk. Also, the tables tend to be slightly bigger than 64M/s. \ No newline at end of file diff --git a/vendor/github.com/dgraph-io/badger/table/builder.go b/vendor/github.com/dgraph-io/badger/table/builder.go deleted file mode 100644 index 43e65622..00000000 --- a/vendor/github.com/dgraph-io/badger/table/builder.go +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package table - -import ( - "bytes" - "encoding/binary" - "io" - "math" - - "github.com/AndreasBriese/bbloom" - "github.com/dgraph-io/badger/y" -) - -var ( - restartInterval = 100 // Might want to change this to be based on total size instead of numKeys. -) - -func newBuffer(sz int) *bytes.Buffer { - b := new(bytes.Buffer) - b.Grow(sz) - return b -} - -type header struct { - plen uint16 // Overlap with base key. - klen uint16 // Length of the diff. - vlen uint16 // Length of value. - prev uint32 // Offset for the previous key-value pair. The offset is relative to block base offset. -} - -// Encode encodes the header. -func (h header) Encode(b []byte) { - binary.BigEndian.PutUint16(b[0:2], h.plen) - binary.BigEndian.PutUint16(b[2:4], h.klen) - binary.BigEndian.PutUint16(b[4:6], h.vlen) - binary.BigEndian.PutUint32(b[6:10], h.prev) -} - -// Decode decodes the header. -func (h *header) Decode(buf []byte) int { - h.plen = binary.BigEndian.Uint16(buf[0:2]) - h.klen = binary.BigEndian.Uint16(buf[2:4]) - h.vlen = binary.BigEndian.Uint16(buf[4:6]) - h.prev = binary.BigEndian.Uint32(buf[6:10]) - return h.Size() -} - -// Size returns size of the header. Currently it's just a constant. -func (h header) Size() int { return 10 } - -// Builder is used in building a table. -type Builder struct { - counter int // Number of keys written for the current block. - - // Typically tens or hundreds of meg. This is for one single file. - buf *bytes.Buffer - - baseKey []byte // Base key for the current block. - baseOffset uint32 // Offset for the current block. - - restarts []uint32 // Base offsets of every block. - - // Tracks offset for the previous key-value pair. Offset is relative to block base offset. - prevOffset uint32 - - keyBuf *bytes.Buffer - keyCount int -} - -// NewTableBuilder makes a new TableBuilder. -func NewTableBuilder() *Builder { - return &Builder{ - keyBuf: newBuffer(1 << 20), - buf: newBuffer(1 << 20), - prevOffset: math.MaxUint32, // Used for the first element! - } -} - -// Close closes the TableBuilder. -func (b *Builder) Close() {} - -// Empty returns whether it's empty. -func (b *Builder) Empty() bool { return b.buf.Len() == 0 } - -// keyDiff returns a suffix of newKey that is different from b.baseKey. -func (b Builder) keyDiff(newKey []byte) []byte { - var i int - for i = 0; i < len(newKey) && i < len(b.baseKey); i++ { - if newKey[i] != b.baseKey[i] { - break - } - } - return newKey[i:] -} - -func (b *Builder) addHelper(key []byte, v y.ValueStruct) { - // Add key to bloom filter. - if len(key) > 0 { - var klen [2]byte - keyNoTs := y.ParseKey(key) - binary.BigEndian.PutUint16(klen[:], uint16(len(keyNoTs))) - b.keyBuf.Write(klen[:]) - b.keyBuf.Write(keyNoTs) - b.keyCount++ - } - - // diffKey stores the difference of key with baseKey. - var diffKey []byte - if len(b.baseKey) == 0 { - // Make a copy. Builder should not keep references. Otherwise, caller has to be very careful - // and will have to make copies of keys every time they add to builder, which is even worse. - b.baseKey = append(b.baseKey[:0], key...) - diffKey = key - } else { - diffKey = b.keyDiff(key) - } - - h := header{ - plen: uint16(len(key) - len(diffKey)), - klen: uint16(len(diffKey)), - vlen: uint16(v.EncodedSize()), - prev: b.prevOffset, // prevOffset is the location of the last key-value added. - } - b.prevOffset = uint32(b.buf.Len()) - b.baseOffset // Remember current offset for the next Add call. - - // Layout: header, diffKey, value. - var hbuf [10]byte - h.Encode(hbuf[:]) - b.buf.Write(hbuf[:]) - b.buf.Write(diffKey) // We only need to store the key difference. - - v.EncodeTo(b.buf) - b.counter++ // Increment number of keys added for this current block. -} - -func (b *Builder) finishBlock() { - // When we are at the end of the block and Valid=false, and the user wants to do a Prev, - // we need a dummy header to tell us the offset of the previous key-value pair. - b.addHelper([]byte{}, y.ValueStruct{}) -} - -// Add adds a key-value pair to the block. -// If doNotRestart is true, we will not restart even if b.counter >= restartInterval. -func (b *Builder) Add(key []byte, value y.ValueStruct) error { - if b.counter >= restartInterval { - b.finishBlock() - // Start a new block. Initialize the block. - b.restarts = append(b.restarts, uint32(b.buf.Len())) - b.counter = 0 - b.baseKey = []byte{} - b.baseOffset = uint32(b.buf.Len()) - b.prevOffset = math.MaxUint32 // First key-value pair of block has header.prev=MaxInt. - } - b.addHelper(key, value) - return nil // Currently, there is no meaningful error. -} - -// TODO: vvv this was the comment on ReachedCapacity. -// FinalSize returns the *rough* final size of the array, counting the header which is not yet written. -// TODO: Look into why there is a discrepancy. I suspect it is because of Write(empty, empty) -// at the end. The diff can vary. - -// ReachedCapacity returns true if we... roughly (?) reached capacity? -func (b *Builder) ReachedCapacity(cap int64) bool { - estimateSz := b.buf.Len() + 8 /* empty header */ + 4*len(b.restarts) + 8 // 8 = end of buf offset + len(restarts). - return int64(estimateSz) > cap -} - -// blockIndex generates the block index for the table. -// It is mainly a list of all the block base offsets. -func (b *Builder) blockIndex() []byte { - // Store the end offset, so we know the length of the final block. - b.restarts = append(b.restarts, uint32(b.buf.Len())) - - // Add 4 because we want to write out number of restarts at the end. - sz := 4*len(b.restarts) + 4 - out := make([]byte, sz) - buf := out - for _, r := range b.restarts { - binary.BigEndian.PutUint32(buf[:4], r) - buf = buf[4:] - } - binary.BigEndian.PutUint32(buf[:4], uint32(len(b.restarts))) - return out -} - -// Finish finishes the table by appending the index. -func (b *Builder) Finish() []byte { - bf := bbloom.New(float64(b.keyCount), 0.01) - var klen [2]byte - key := make([]byte, 1024) - for { - if _, err := b.keyBuf.Read(klen[:]); err == io.EOF { - break - } else if err != nil { - y.Check(err) - } - kl := int(binary.BigEndian.Uint16(klen[:])) - if cap(key) < kl { - key = make([]byte, 2*int(kl)) // 2 * uint16 will overflow - } - key = key[:kl] - y.Check2(b.keyBuf.Read(key)) - bf.Add(key) - } - - b.finishBlock() // This will never start a new block. - index := b.blockIndex() - b.buf.Write(index) - - // Write bloom filter. - bdata := bf.JSONMarshal() - n, err := b.buf.Write(bdata) - y.Check(err) - var buf [4]byte - binary.BigEndian.PutUint32(buf[:], uint32(n)) - b.buf.Write(buf[:]) - - return b.buf.Bytes() -} diff --git a/vendor/github.com/dgraph-io/badger/table/iterator.go b/vendor/github.com/dgraph-io/badger/table/iterator.go deleted file mode 100644 index 0eb5ed01..00000000 --- a/vendor/github.com/dgraph-io/badger/table/iterator.go +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package table - -import ( - "bytes" - "io" - "math" - "sort" - - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -type blockIterator struct { - data []byte - pos uint32 - err error - baseKey []byte - - key []byte - val []byte - init bool - - last header // The last header we saw. -} - -func (itr *blockIterator) Reset() { - itr.pos = 0 - itr.err = nil - itr.baseKey = []byte{} - itr.key = []byte{} - itr.val = []byte{} - itr.init = false - itr.last = header{} -} - -func (itr *blockIterator) Init() { - if !itr.init { - itr.Next() - } -} - -func (itr *blockIterator) Valid() bool { - return itr != nil && itr.err == nil -} - -func (itr *blockIterator) Error() error { - return itr.err -} - -func (itr *blockIterator) Close() {} - -var ( - origin = 0 - current = 1 -) - -// Seek brings us to the first block element that is >= input key. -func (itr *blockIterator) Seek(key []byte, whence int) { - itr.err = nil - - switch whence { - case origin: - itr.Reset() - case current: - } - - var done bool - for itr.Init(); itr.Valid(); itr.Next() { - k := itr.Key() - if y.CompareKeys(k, key) >= 0 { - // We are done as k is >= key. - done = true - break - } - } - if !done { - itr.err = io.EOF - } -} - -func (itr *blockIterator) SeekToFirst() { - itr.err = nil - itr.Init() -} - -// SeekToLast brings us to the last element. Valid should return true. -func (itr *blockIterator) SeekToLast() { - itr.err = nil - for itr.Init(); itr.Valid(); itr.Next() { - } - itr.Prev() -} - -// parseKV would allocate a new byte slice for key and for value. -func (itr *blockIterator) parseKV(h header) { - if cap(itr.key) < int(h.plen+h.klen) { - sz := int(h.plen) + int(h.klen) // Convert to int before adding to avoid uint16 overflow. - itr.key = make([]byte, 2*sz) - } - itr.key = itr.key[:h.plen+h.klen] - copy(itr.key, itr.baseKey[:h.plen]) - copy(itr.key[h.plen:], itr.data[itr.pos:itr.pos+uint32(h.klen)]) - itr.pos += uint32(h.klen) - - if itr.pos+uint32(h.vlen) > uint32(len(itr.data)) { - itr.err = errors.Errorf("Value exceeded size of block: %d %d %d %d %v", - itr.pos, h.klen, h.vlen, len(itr.data), h) - return - } - itr.val = y.SafeCopy(itr.val, itr.data[itr.pos:itr.pos+uint32(h.vlen)]) - itr.pos += uint32(h.vlen) -} - -func (itr *blockIterator) Next() { - itr.init = true - itr.err = nil - if itr.pos >= uint32(len(itr.data)) { - itr.err = io.EOF - return - } - - var h header - itr.pos += uint32(h.Decode(itr.data[itr.pos:])) - itr.last = h // Store the last header. - - if h.klen == 0 && h.plen == 0 { - // Last entry in the table. - itr.err = io.EOF - return - } - - // Populate baseKey if it isn't set yet. This would only happen for the first Next. - if len(itr.baseKey) == 0 { - // This should be the first Next() for this block. Hence, prefix length should be zero. - y.AssertTrue(h.plen == 0) - itr.baseKey = itr.data[itr.pos : itr.pos+uint32(h.klen)] - } - itr.parseKV(h) -} - -func (itr *blockIterator) Prev() { - if !itr.init { - return - } - itr.err = nil - if itr.last.prev == math.MaxUint32 { - // This is the first element of the block! - itr.err = io.EOF - itr.pos = 0 - return - } - - // Move back using current header's prev. - itr.pos = itr.last.prev - - var h header - y.AssertTruef(itr.pos < uint32(len(itr.data)), "%d %d", itr.pos, len(itr.data)) - itr.pos += uint32(h.Decode(itr.data[itr.pos:])) - itr.parseKV(h) - itr.last = h -} - -func (itr *blockIterator) Key() []byte { - if itr.err != nil { - return nil - } - return itr.key -} - -func (itr *blockIterator) Value() []byte { - if itr.err != nil { - return nil - } - return itr.val -} - -// Iterator is an iterator for a Table. -type Iterator struct { - t *Table - bpos int - bi *blockIterator - err error - - // Internally, Iterator is bidirectional. However, we only expose the - // unidirectional functionality for now. - reversed bool -} - -// NewIterator returns a new iterator of the Table -func (t *Table) NewIterator(reversed bool) *Iterator { - t.IncrRef() // Important. - ti := &Iterator{t: t, reversed: reversed} - ti.next() - return ti -} - -// Close closes the iterator (and it must be called). -func (itr *Iterator) Close() error { - return itr.t.DecrRef() -} - -func (itr *Iterator) reset() { - itr.bpos = 0 - itr.err = nil -} - -// Valid follows the y.Iterator interface -func (itr *Iterator) Valid() bool { - return itr.err == nil -} - -func (itr *Iterator) seekToFirst() { - numBlocks := len(itr.t.blockIndex) - if numBlocks == 0 { - itr.err = io.EOF - return - } - itr.bpos = 0 - block, err := itr.t.block(itr.bpos) - if err != nil { - itr.err = err - return - } - itr.bi = block.NewIterator() - itr.bi.SeekToFirst() - itr.err = itr.bi.Error() -} - -func (itr *Iterator) seekToLast() { - numBlocks := len(itr.t.blockIndex) - if numBlocks == 0 { - itr.err = io.EOF - return - } - itr.bpos = numBlocks - 1 - block, err := itr.t.block(itr.bpos) - if err != nil { - itr.err = err - return - } - itr.bi = block.NewIterator() - itr.bi.SeekToLast() - itr.err = itr.bi.Error() -} - -func (itr *Iterator) seekHelper(blockIdx int, key []byte) { - itr.bpos = blockIdx - block, err := itr.t.block(blockIdx) - if err != nil { - itr.err = err - return - } - itr.bi = block.NewIterator() - itr.bi.Seek(key, origin) - itr.err = itr.bi.Error() -} - -// seekFrom brings us to a key that is >= input key. -func (itr *Iterator) seekFrom(key []byte, whence int) { - itr.err = nil - switch whence { - case origin: - itr.reset() - case current: - } - - idx := sort.Search(len(itr.t.blockIndex), func(idx int) bool { - ko := itr.t.blockIndex[idx] - return y.CompareKeys(ko.key, key) > 0 - }) - if idx == 0 { - // The smallest key in our table is already strictly > key. We can return that. - // This is like a SeekToFirst. - itr.seekHelper(0, key) - return - } - - // block[idx].smallest is > key. - // Since idx>0, we know block[idx-1].smallest is <= key. - // There are two cases. - // 1) Everything in block[idx-1] is strictly < key. In this case, we should go to the first - // element of block[idx]. - // 2) Some element in block[idx-1] is >= key. We should go to that element. - itr.seekHelper(idx-1, key) - if itr.err == io.EOF { - // Case 1. Need to visit block[idx]. - if idx == len(itr.t.blockIndex) { - // If idx == len(itr.t.blockIndex), then input key is greater than ANY element of table. - // There's nothing we can do. Valid() should return false as we seek to end of table. - return - } - // Since block[idx].smallest is > key. This is essentially a block[idx].SeekToFirst. - itr.seekHelper(idx, key) - } - // Case 2: No need to do anything. We already did the seek in block[idx-1]. -} - -// seek will reset iterator and seek to >= key. -func (itr *Iterator) seek(key []byte) { - itr.seekFrom(key, origin) -} - -// seekForPrev will reset iterator and seek to <= key. -func (itr *Iterator) seekForPrev(key []byte) { - // TODO: Optimize this. We shouldn't have to take a Prev step. - itr.seekFrom(key, origin) - if !bytes.Equal(itr.Key(), key) { - itr.prev() - } -} - -func (itr *Iterator) next() { - itr.err = nil - - if itr.bpos >= len(itr.t.blockIndex) { - itr.err = io.EOF - return - } - - if itr.bi == nil { - block, err := itr.t.block(itr.bpos) - if err != nil { - itr.err = err - return - } - itr.bi = block.NewIterator() - itr.bi.SeekToFirst() - itr.err = itr.bi.Error() - return - } - - itr.bi.Next() - if !itr.bi.Valid() { - itr.bpos++ - itr.bi = nil - itr.next() - return - } -} - -func (itr *Iterator) prev() { - itr.err = nil - if itr.bpos < 0 { - itr.err = io.EOF - return - } - - if itr.bi == nil { - block, err := itr.t.block(itr.bpos) - if err != nil { - itr.err = err - return - } - itr.bi = block.NewIterator() - itr.bi.SeekToLast() - itr.err = itr.bi.Error() - return - } - - itr.bi.Prev() - if !itr.bi.Valid() { - itr.bpos-- - itr.bi = nil - itr.prev() - return - } -} - -// Key follows the y.Iterator interface -func (itr *Iterator) Key() []byte { - return itr.bi.Key() -} - -// Value follows the y.Iterator interface -func (itr *Iterator) Value() (ret y.ValueStruct) { - ret.Decode(itr.bi.Value()) - return -} - -// Next follows the y.Iterator interface -func (itr *Iterator) Next() { - if !itr.reversed { - itr.next() - } else { - itr.prev() - } -} - -// Rewind follows the y.Iterator interface -func (itr *Iterator) Rewind() { - if !itr.reversed { - itr.seekToFirst() - } else { - itr.seekToLast() - } -} - -// Seek follows the y.Iterator interface -func (itr *Iterator) Seek(key []byte) { - if !itr.reversed { - itr.seek(key) - } else { - itr.seekForPrev(key) - } -} - -// ConcatIterator concatenates the sequences defined by several iterators. (It only works with -// TableIterators, probably just because it's faster to not be so generic.) -type ConcatIterator struct { - idx int // Which iterator is active now. - cur *Iterator - iters []*Iterator // Corresponds to tables. - tables []*Table // Disregarding reversed, this is in ascending order. - reversed bool -} - -// NewConcatIterator creates a new concatenated iterator -func NewConcatIterator(tbls []*Table, reversed bool) *ConcatIterator { - iters := make([]*Iterator, len(tbls)) - for i := 0; i < len(tbls); i++ { - iters[i] = tbls[i].NewIterator(reversed) - } - return &ConcatIterator{ - reversed: reversed, - iters: iters, - tables: tbls, - idx: -1, // Not really necessary because s.it.Valid()=false, but good to have. - } -} - -func (s *ConcatIterator) setIdx(idx int) { - s.idx = idx - if idx < 0 || idx >= len(s.iters) { - s.cur = nil - } else { - s.cur = s.iters[s.idx] - } -} - -// Rewind implements y.Interface -func (s *ConcatIterator) Rewind() { - if len(s.iters) == 0 { - return - } - if !s.reversed { - s.setIdx(0) - } else { - s.setIdx(len(s.iters) - 1) - } - s.cur.Rewind() -} - -// Valid implements y.Interface -func (s *ConcatIterator) Valid() bool { - return s.cur != nil && s.cur.Valid() -} - -// Key implements y.Interface -func (s *ConcatIterator) Key() []byte { - return s.cur.Key() -} - -// Value implements y.Interface -func (s *ConcatIterator) Value() y.ValueStruct { - return s.cur.Value() -} - -// Seek brings us to element >= key if reversed is false. Otherwise, <= key. -func (s *ConcatIterator) Seek(key []byte) { - var idx int - if !s.reversed { - idx = sort.Search(len(s.tables), func(i int) bool { - return y.CompareKeys(s.tables[i].Biggest(), key) >= 0 - }) - } else { - n := len(s.tables) - idx = n - 1 - sort.Search(n, func(i int) bool { - return y.CompareKeys(s.tables[n-1-i].Smallest(), key) <= 0 - }) - } - if idx >= len(s.tables) || idx < 0 { - s.setIdx(-1) - return - } - // For reversed=false, we know s.tables[i-1].Biggest() < key. Thus, the - // previous table cannot possibly contain key. - s.setIdx(idx) - s.cur.Seek(key) -} - -// Next advances our concat iterator. -func (s *ConcatIterator) Next() { - s.cur.Next() - if s.cur.Valid() { - // Nothing to do. Just stay with the current table. - return - } - for { // In case there are empty tables. - if !s.reversed { - s.setIdx(s.idx + 1) - } else { - s.setIdx(s.idx - 1) - } - if s.cur == nil { - // End of list. Valid will become false. - return - } - s.cur.Rewind() - if s.cur.Valid() { - break - } - } -} - -// Close implements y.Interface. -func (s *ConcatIterator) Close() error { - for _, it := range s.iters { - if err := it.Close(); err != nil { - return errors.Wrap(err, "ConcatIterator") - } - } - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/table/table.go b/vendor/github.com/dgraph-io/badger/table/table.go deleted file mode 100644 index 9650c08e..00000000 --- a/vendor/github.com/dgraph-io/badger/table/table.go +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package table - -import ( - "bytes" - "crypto/sha256" - "encoding/binary" - "fmt" - "io" - "os" - "path" - "path/filepath" - "strconv" - "strings" - "sync" - "sync/atomic" - - "github.com/AndreasBriese/bbloom" - "github.com/dgraph-io/badger/options" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -const fileSuffix = ".sst" - -type keyOffset struct { - key []byte - offset int - len int -} - -// TableInterface is useful for testing. -type TableInterface interface { - Smallest() []byte - Biggest() []byte - DoesNotHave(key []byte) bool -} - -// Table represents a loaded table file with the info we have about it -type Table struct { - sync.Mutex - - fd *os.File // Own fd. - tableSize int // Initialized in OpenTable, using fd.Stat(). - - blockIndex []keyOffset - ref int32 // For file garbage collection. Atomic. - - loadingMode options.FileLoadingMode - mmap []byte // Memory mapped. - - // The following are initialized once and const. - smallest, biggest []byte // Smallest and largest keys. - id uint64 // file id, part of filename - - bf bbloom.Bloom - - Checksum []byte -} - -// IncrRef increments the refcount (having to do with whether the file should be deleted) -func (t *Table) IncrRef() { - atomic.AddInt32(&t.ref, 1) -} - -// DecrRef decrements the refcount and possibly deletes the table -func (t *Table) DecrRef() error { - newRef := atomic.AddInt32(&t.ref, -1) - if newRef == 0 { - // We can safely delete this file, because for all the current files, we always have - // at least one reference pointing to them. - - // It's necessary to delete windows files - if t.loadingMode == options.MemoryMap { - y.Munmap(t.mmap) - } - if err := t.fd.Truncate(0); err != nil { - // This is very important to let the FS know that the file is deleted. - return err - } - filename := t.fd.Name() - if err := t.fd.Close(); err != nil { - return err - } - if err := os.Remove(filename); err != nil { - return err - } - } - return nil -} - -type block struct { - offset int - data []byte -} - -func (b block) NewIterator() *blockIterator { - return &blockIterator{data: b.data} -} - -// OpenTable assumes file has only one table and opens it. Takes ownership of fd upon function -// entry. Returns a table with one reference count on it (decrementing which may delete the file! -// -- consider t.Close() instead). The fd has to writeable because we call Truncate on it before -// deleting. -func OpenTable(fd *os.File, mode options.FileLoadingMode, cksum []byte) (*Table, error) { - fileInfo, err := fd.Stat() - if err != nil { - // It's OK to ignore fd.Close() errs in this function because we have only read - // from the file. - _ = fd.Close() - return nil, y.Wrap(err) - } - - filename := fileInfo.Name() - id, ok := ParseFileID(filename) - if !ok { - _ = fd.Close() - return nil, errors.Errorf("Invalid filename: %s", filename) - } - t := &Table{ - fd: fd, - ref: 1, // Caller is given one reference. - id: id, - loadingMode: mode, - } - - t.tableSize = int(fileInfo.Size()) - - // We first load to RAM, so we can read the index and do checksum. - if err := t.loadToRAM(); err != nil { - return nil, err - } - // Enforce checksum before we read index. Otherwise, if the file was - // truncated, we'd end up with panics in readIndex. - if len(cksum) > 0 && !bytes.Equal(t.Checksum, cksum) { - return nil, fmt.Errorf( - "CHECKSUM_MISMATCH: Table checksum does not match checksum in MANIFEST."+ - " NOT including table %s. This would lead to missing data."+ - "\n sha256 %x Expected\n sha256 %x Found\n", filename, cksum, t.Checksum) - } - if err := t.readIndex(); err != nil { - return nil, y.Wrap(err) - } - - it := t.NewIterator(false) - defer it.Close() - it.Rewind() - if it.Valid() { - t.smallest = it.Key() - } - - it2 := t.NewIterator(true) - defer it2.Close() - it2.Rewind() - if it2.Valid() { - t.biggest = it2.Key() - } - - switch mode { - case options.LoadToRAM: - // No need to do anything. t.mmap is already filled. - case options.MemoryMap: - t.mmap, err = y.Mmap(fd, false, fileInfo.Size()) - if err != nil { - _ = fd.Close() - return nil, y.Wrapf(err, "Unable to map file") - } - case options.FileIO: - t.mmap = nil - default: - panic(fmt.Sprintf("Invalid loading mode: %v", mode)) - } - return t, nil -} - -// Close closes the open table. (Releases resources back to the OS.) -func (t *Table) Close() error { - if t.loadingMode == options.MemoryMap { - y.Munmap(t.mmap) - } - - return t.fd.Close() -} - -func (t *Table) read(off, sz int) ([]byte, error) { - if len(t.mmap) > 0 { - if len(t.mmap[off:]) < sz { - return nil, y.ErrEOF - } - return t.mmap[off : off+sz], nil - } - - res := make([]byte, sz) - nbr, err := t.fd.ReadAt(res, int64(off)) - y.NumReads.Add(1) - y.NumBytesRead.Add(int64(nbr)) - return res, err -} - -func (t *Table) readNoFail(off, sz int) []byte { - res, err := t.read(off, sz) - y.Check(err) - return res -} - -func (t *Table) readIndex() error { - if len(t.mmap) != t.tableSize { - panic("Table size does not match the read bytes") - } - readPos := t.tableSize - - // Read bloom filter. - readPos -= 4 - buf := t.readNoFail(readPos, 4) - bloomLen := int(binary.BigEndian.Uint32(buf)) - readPos -= bloomLen - data := t.readNoFail(readPos, bloomLen) - t.bf = bbloom.JSONUnmarshal(data) - - readPos -= 4 - buf = t.readNoFail(readPos, 4) - restartsLen := int(binary.BigEndian.Uint32(buf)) - - readPos -= 4 * restartsLen - buf = t.readNoFail(readPos, 4*restartsLen) - - offsets := make([]int, restartsLen) - for i := 0; i < restartsLen; i++ { - offsets[i] = int(binary.BigEndian.Uint32(buf[:4])) - buf = buf[4:] - } - - // The last offset stores the end of the last block. - for i := 0; i < len(offsets); i++ { - var o int - if i == 0 { - o = 0 - } else { - o = offsets[i-1] - } - - ko := keyOffset{ - offset: o, - len: offsets[i] - o, - } - t.blockIndex = append(t.blockIndex, ko) - } - - // Execute this index read serially, because we already have table data in memory. - var h header - for idx := range t.blockIndex { - ko := &t.blockIndex[idx] - - hbuf := t.readNoFail(ko.offset, h.Size()) - h.Decode(hbuf) - y.AssertTrue(h.plen == 0) - - key := t.readNoFail(ko.offset+len(hbuf), int(h.klen)) - ko.key = append([]byte{}, key...) - } - - return nil -} - -func (t *Table) block(idx int) (block, error) { - y.AssertTruef(idx >= 0, "idx=%d", idx) - if idx >= len(t.blockIndex) { - return block{}, errors.New("block out of index") - } - - ko := t.blockIndex[idx] - blk := block{ - offset: ko.offset, - } - var err error - blk.data, err = t.read(blk.offset, ko.len) - return blk, err -} - -// Size is its file size in bytes -func (t *Table) Size() int64 { return int64(t.tableSize) } - -// Smallest is its smallest key, or nil if there are none -func (t *Table) Smallest() []byte { return t.smallest } - -// Biggest is its biggest key, or nil if there are none -func (t *Table) Biggest() []byte { return t.biggest } - -// Filename is NOT the file name. Just kidding, it is. -func (t *Table) Filename() string { return t.fd.Name() } - -// ID is the table's ID number (used to make the file name). -func (t *Table) ID() uint64 { return t.id } - -// DoesNotHave returns true if (but not "only if") the table does not have the key. It does a -// bloom filter lookup. -func (t *Table) DoesNotHave(key []byte) bool { return !t.bf.Has(key) } - -// ParseFileID reads the file id out of a filename. -func ParseFileID(name string) (uint64, bool) { - name = path.Base(name) - if !strings.HasSuffix(name, fileSuffix) { - return 0, false - } - // suffix := name[len(fileSuffix):] - name = strings.TrimSuffix(name, fileSuffix) - id, err := strconv.Atoi(name) - if err != nil { - return 0, false - } - y.AssertTrue(id >= 0) - return uint64(id), true -} - -// IDToFilename does the inverse of ParseFileID -func IDToFilename(id uint64) string { - return fmt.Sprintf("%06d", id) + fileSuffix -} - -// NewFilename should be named TableFilepath -- it combines the dir with the ID to make a table -// filepath. -func NewFilename(id uint64, dir string) string { - return filepath.Join(dir, IDToFilename(id)) -} - -func (t *Table) loadToRAM() error { - if _, err := t.fd.Seek(0, io.SeekStart); err != nil { - return err - } - t.mmap = make([]byte, t.tableSize) - sum := sha256.New() - tee := io.TeeReader(t.fd, sum) - read, err := tee.Read(t.mmap) - if err != nil || read != t.tableSize { - return y.Wrapf(err, "Unable to load file in memory. Table file: %s", t.Filename()) - } - t.Checksum = sum.Sum(nil) - y.NumReads.Add(1) - y.NumBytesRead.Add(int64(read)) - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/test.sh b/vendor/github.com/dgraph-io/badger/test.sh deleted file mode 100755 index e2df230e..00000000 --- a/vendor/github.com/dgraph-io/badger/test.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e - -# Ensure that we can compile the binary. -pushd badger -go build -v . -popd - -# Run the memory intensive tests first. -go test -v --manual=true -run='TestBigKeyValuePairs$' -go test -v --manual=true -run='TestPushValueLogLimit' - -# Run the special Truncate test. -rm -R p || true -go test -v --manual=true -run='TestTruncateVlogNoClose$' . -truncate --size=4096 p/000000.vlog -go test -v --manual=true -run='TestTruncateVlogNoClose2$' . -go test -v --manual=true -run='TestTruncateVlogNoClose3$' . -rm -R p || true - -# Then the normal tests. -echo -echo "==> Starting tests with value log mmapped..." -sleep 5 -go test -v --vlog_mmap=true -race ./... - -echo -echo "==> Starting tests with value log not mmapped..." -sleep 5 -go test -v --vlog_mmap=false -race ./... diff --git a/vendor/github.com/dgraph-io/badger/txn.go b/vendor/github.com/dgraph-io/badger/txn.go deleted file mode 100644 index f6faa926..00000000 --- a/vendor/github.com/dgraph-io/badger/txn.go +++ /dev/null @@ -1,765 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bytes" - "context" - "encoding/hex" - "math" - "sort" - "strconv" - "sync" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/y" - farm "github.com/dgryski/go-farm" - "github.com/pkg/errors" -) - -type oracle struct { - // A 64-bit integer must be at the top for memory alignment. See issue #311. - refCount int64 - isManaged bool // Does not change value, so no locking required. - - sync.Mutex // For nextTxnTs and commits. - // writeChLock lock is for ensuring that transactions go to the write - // channel in the same order as their commit timestamps. - writeChLock sync.Mutex - nextTxnTs uint64 - - // Used to block NewTransaction, so all previous commits are visible to a new read. - txnMark *y.WaterMark - - // Either of these is used to determine which versions can be permanently - // discarded during compaction. - discardTs uint64 // Used by ManagedDB. - readMark *y.WaterMark // Used by DB. - - // commits stores a key fingerprint and latest commit counter for it. - // refCount is used to clear out commits map to avoid a memory blowup. - commits map[uint64]uint64 - - // closer is used to stop watermarks. - closer *y.Closer -} - -func newOracle(opt Options) *oracle { - orc := &oracle{ - isManaged: opt.managedTxns, - commits: make(map[uint64]uint64), - // We're not initializing nextTxnTs and readOnlyTs. It would be done after replay in Open. - // - // WaterMarks must be 64-bit aligned for atomic package, hence we must use pointers here. - // See https://golang.org/pkg/sync/atomic/#pkg-note-BUG. - readMark: &y.WaterMark{Name: "badger.PendingReads"}, - txnMark: &y.WaterMark{Name: "badger.TxnTimestamp"}, - closer: y.NewCloser(2), - } - orc.readMark.Init(orc.closer) - orc.txnMark.Init(orc.closer) - return orc -} - -func (o *oracle) Stop() { - o.closer.SignalAndWait() -} - -func (o *oracle) addRef() { - atomic.AddInt64(&o.refCount, 1) -} - -func (o *oracle) decrRef() { - if atomic.AddInt64(&o.refCount, -1) != 0 { - return - } - - // Clear out commits maps to release memory. - o.Lock() - defer o.Unlock() - // Avoids the race where something new is added to commitsMap - // after we check refCount and before we take Lock. - if atomic.LoadInt64(&o.refCount) != 0 { - return - } - if len(o.commits) >= 1000 { // If the map is still small, let it slide. - o.commits = make(map[uint64]uint64) - } -} - -func (o *oracle) readTs() uint64 { - if o.isManaged { - panic("ReadTs should not be retrieved for managed DB") - } - - var readTs uint64 - o.Lock() - readTs = o.nextTxnTs - 1 - o.readMark.Begin(readTs) - o.Unlock() - - // Wait for all txns which have no conflicts, have been assigned a commit - // timestamp and are going through the write to value log and LSM tree - // process. Not waiting here could mean that some txns which have been - // committed would not be read. - y.Check(o.txnMark.WaitForMark(context.Background(), readTs)) - return readTs -} - -func (o *oracle) nextTs() uint64 { - o.Lock() - defer o.Unlock() - return o.nextTxnTs -} - -func (o *oracle) incrementNextTs() { - o.Lock() - defer o.Unlock() - o.nextTxnTs++ -} - -// Any deleted or invalid versions at or below ts would be discarded during -// compaction to reclaim disk space in LSM tree and thence value log. -func (o *oracle) setDiscardTs(ts uint64) { - o.Lock() - defer o.Unlock() - o.discardTs = ts -} - -func (o *oracle) discardAtOrBelow() uint64 { - if o.isManaged { - o.Lock() - defer o.Unlock() - return o.discardTs - } - return o.readMark.DoneUntil() -} - -// hasConflict must be called while having a lock. -func (o *oracle) hasConflict(txn *Txn) bool { - if len(txn.reads) == 0 { - return false - } - for _, ro := range txn.reads { - // A commit at the read timestamp is expected. - // But, any commit after the read timestamp should cause a conflict. - if ts, has := o.commits[ro]; has && ts > txn.readTs { - return true - } - } - return false -} - -func (o *oracle) newCommitTs(txn *Txn) uint64 { - o.Lock() - defer o.Unlock() - - if o.hasConflict(txn) { - return 0 - } - - var ts uint64 - if !o.isManaged { - // This is the general case, when user doesn't specify the read and commit ts. - ts = o.nextTxnTs - o.nextTxnTs++ - o.txnMark.Begin(ts) - - } else { - // If commitTs is set, use it instead. - ts = txn.commitTs - } - - for _, w := range txn.writes { - o.commits[w] = ts // Update the commitTs. - } - return ts -} - -func (o *oracle) doneCommit(cts uint64) { - if o.isManaged { - // No need to update anything. - return - } - o.txnMark.Done(cts) -} - -// Txn represents a Badger transaction. -type Txn struct { - readTs uint64 - commitTs uint64 - - update bool // update is used to conditionally keep track of reads. - reads []uint64 // contains fingerprints of keys read. - writes []uint64 // contains fingerprints of keys written. - - pendingWrites map[string]*Entry // cache stores any writes done by txn. - - db *DB - discarded bool - - size int64 - count int64 - numIterators int32 -} - -type pendingWritesIterator struct { - entries []*Entry - nextIdx int - readTs uint64 - reversed bool -} - -func (pi *pendingWritesIterator) Next() { - pi.nextIdx++ -} - -func (pi *pendingWritesIterator) Rewind() { - pi.nextIdx = 0 -} - -func (pi *pendingWritesIterator) Seek(key []byte) { - key = y.ParseKey(key) - pi.nextIdx = sort.Search(len(pi.entries), func(idx int) bool { - cmp := bytes.Compare(pi.entries[idx].Key, key) - if !pi.reversed { - return cmp >= 0 - } - return cmp <= 0 - }) -} - -func (pi *pendingWritesIterator) Key() []byte { - y.AssertTrue(pi.Valid()) - entry := pi.entries[pi.nextIdx] - return y.KeyWithTs(entry.Key, pi.readTs) -} - -func (pi *pendingWritesIterator) Value() y.ValueStruct { - y.AssertTrue(pi.Valid()) - entry := pi.entries[pi.nextIdx] - return y.ValueStruct{ - Value: entry.Value, - Meta: entry.meta, - UserMeta: entry.UserMeta, - ExpiresAt: entry.ExpiresAt, - Version: pi.readTs, - } -} - -func (pi *pendingWritesIterator) Valid() bool { - return pi.nextIdx < len(pi.entries) -} - -func (pi *pendingWritesIterator) Close() error { - return nil -} - -func (txn *Txn) newPendingWritesIterator(reversed bool) *pendingWritesIterator { - if !txn.update || len(txn.pendingWrites) == 0 { - return nil - } - entries := make([]*Entry, 0, len(txn.pendingWrites)) - for _, e := range txn.pendingWrites { - entries = append(entries, e) - } - // Number of pending writes per transaction shouldn't be too big in general. - sort.Slice(entries, func(i, j int) bool { - cmp := bytes.Compare(entries[i].Key, entries[j].Key) - if !reversed { - return cmp < 0 - } - return cmp > 0 - }) - return &pendingWritesIterator{ - readTs: txn.readTs, - entries: entries, - reversed: reversed, - } -} - -func (txn *Txn) checkSize(e *Entry) error { - count := txn.count + 1 - // Extra bytes for version in key. - size := txn.size + int64(e.estimateSize(txn.db.opt.ValueThreshold)) + 10 - if count >= txn.db.opt.maxBatchCount || size >= txn.db.opt.maxBatchSize { - return ErrTxnTooBig - } - txn.count, txn.size = count, size - return nil -} - -// Set adds a key-value pair to the database. -// -// It will return ErrReadOnlyTxn if update flag was set to false when creating the -// transaction. -// -// The current transaction keeps a reference to the key and val byte slice -// arguments. Users must not modify key and val until the end of the transaction. -func (txn *Txn) Set(key, val []byte) error { - e := &Entry{ - Key: key, - Value: val, - } - return txn.SetEntry(e) -} - -// SetWithMeta adds a key-value pair to the database, along with a metadata -// byte. -// -// This byte is stored alongside the key, and can be used as an aid to -// interpret the value or store other contextual bits corresponding to the -// key-value pair. -// -// The current transaction keeps a reference to the key and val byte slice -// arguments. Users must not modify key and val until the end of the transaction. -func (txn *Txn) SetWithMeta(key, val []byte, meta byte) error { - e := &Entry{Key: key, Value: val, UserMeta: meta} - return txn.SetEntry(e) -} - -// SetWithDiscard acts like SetWithMeta, but adds a marker to discard earlier -// versions of the key. -// -// This method is only useful if you have set a higher limit for -// options.NumVersionsToKeep. The default setting is 1, in which case, this -// function doesn't add any more benefit than just calling the normal -// SetWithMeta (or Set) function. If however, you have a higher setting for -// NumVersionsToKeep (in Dgraph, we set it to infinity), you can use this method -// to indicate that all the older versions can be discarded and removed during -// compactions. -// -// The current transaction keeps a reference to the key and val byte slice -// arguments. Users must not modify key and val until the end of the -// transaction. -func (txn *Txn) SetWithDiscard(key, val []byte, meta byte) error { - e := &Entry{ - Key: key, - Value: val, - UserMeta: meta, - meta: bitDiscardEarlierVersions, - } - return txn.SetEntry(e) -} - -// SetWithTTL adds a key-value pair to the database, along with a time-to-live -// (TTL) setting. A key stored with a TTL would automatically expire after the -// time has elapsed, and be eligible for garbage collection. -// -// The current transaction keeps a reference to the key and val byte slice -// arguments. Users must not modify key and val until the end of the -// transaction. -func (txn *Txn) SetWithTTL(key, val []byte, dur time.Duration) error { - expire := time.Now().Add(dur).Unix() - e := &Entry{Key: key, Value: val, ExpiresAt: uint64(expire)} - return txn.SetEntry(e) -} - -// setMergeEntry is similar to SetEntry but it sets the bitMergeEntry flag -func (txn *Txn) setMergeEntry(key, val []byte) error { - e := &Entry{Key: key, Value: val, meta: bitMergeEntry} - return txn.SetEntry(e) -} - -func exceedsSize(prefix string, max int64, key []byte) error { - return errors.Errorf("%s with size %d exceeded %d limit. %s:\n%s", - prefix, len(key), max, prefix, hex.Dump(key[:1<<10])) -} - -func (txn *Txn) modify(e *Entry) error { - const maxKeySize = 65000 - - switch { - case !txn.update: - return ErrReadOnlyTxn - case txn.discarded: - return ErrDiscardedTxn - case len(e.Key) == 0: - return ErrEmptyKey - case bytes.HasPrefix(e.Key, badgerPrefix): - return ErrInvalidKey - case len(e.Key) > maxKeySize: - // Key length can't be more than uint16, as determined by table::header. To - // keep things safe and allow badger move prefix and a timestamp suffix, let's - // cut it down to 65000, instead of using 65536. - return exceedsSize("Key", maxKeySize, e.Key) - case int64(len(e.Value)) > txn.db.opt.ValueLogFileSize: - return exceedsSize("Value", txn.db.opt.ValueLogFileSize, e.Value) - } - - if err := txn.checkSize(e); err != nil { - return err - } - fp := farm.Fingerprint64(e.Key) // Avoid dealing with byte arrays. - txn.writes = append(txn.writes, fp) - txn.pendingWrites[string(e.Key)] = e - return nil -} - -// SetEntry takes an Entry struct and adds the key-value pair in the struct, -// along with other metadata to the database. -// -// The current transaction keeps a reference to the entry passed in argument. -// Users must not modify the entry until the end of the transaction. -func (txn *Txn) SetEntry(e *Entry) error { - return txn.modify(e) -} - -// Delete deletes a key. -// -// This is done by adding a delete marker for the key at commit timestamp. Any -// reads happening before this timestamp would be unaffected. Any reads after -// this commit would see the deletion. -// -// The current transaction keeps a reference to the key byte slice argument. -// Users must not modify the key until the end of the transaction. -func (txn *Txn) Delete(key []byte) error { - e := &Entry{ - Key: key, - meta: bitDelete, - } - return txn.modify(e) -} - -// Get looks for key and returns corresponding Item. -// If key is not found, ErrKeyNotFound is returned. -func (txn *Txn) Get(key []byte) (item *Item, rerr error) { - if len(key) == 0 { - return nil, ErrEmptyKey - } else if txn.discarded { - return nil, ErrDiscardedTxn - } - - item = new(Item) - if txn.update { - if e, has := txn.pendingWrites[string(key)]; has && bytes.Equal(key, e.Key) { - if isDeletedOrExpired(e.meta, e.ExpiresAt) { - return nil, ErrKeyNotFound - } - // Fulfill from cache. - item.meta = e.meta - item.val = e.Value - item.userMeta = e.UserMeta - item.key = key - item.status = prefetched - item.version = txn.readTs - item.expiresAt = e.ExpiresAt - // We probably don't need to set db on item here. - return item, nil - } - // Only track reads if this is update txn. No need to track read if txn serviced it - // internally. - txn.addReadKey(key) - } - - seek := y.KeyWithTs(key, txn.readTs) - vs, err := txn.db.get(seek) - if err != nil { - return nil, errors.Wrapf(err, "DB::Get key: %q", key) - } - if vs.Value == nil && vs.Meta == 0 { - return nil, ErrKeyNotFound - } - if isDeletedOrExpired(vs.Meta, vs.ExpiresAt) { - return nil, ErrKeyNotFound - } - - item.key = key - item.version = vs.Version - item.meta = vs.Meta - item.userMeta = vs.UserMeta - item.db = txn.db - item.vptr = vs.Value // TODO: Do we need to copy this over? - item.txn = txn - item.expiresAt = vs.ExpiresAt - return item, nil -} - -func (txn *Txn) addReadKey(key []byte) { - if txn.update { - fp := farm.Fingerprint64(key) - txn.reads = append(txn.reads, fp) - } -} - -// Discard discards a created transaction. This method is very important and must be called. Commit -// method calls this internally, however, calling this multiple times doesn't cause any issues. So, -// this can safely be called via a defer right when transaction is created. -// -// NOTE: If any operations are run on a discarded transaction, ErrDiscardedTxn is returned. -func (txn *Txn) Discard() { - if txn.discarded { // Avoid a re-run. - return - } - if atomic.LoadInt32(&txn.numIterators) > 0 { - panic("Unclosed iterator at time of Txn.Discard.") - } - txn.discarded = true - if !txn.db.orc.isManaged { - txn.db.orc.readMark.Done(txn.readTs) - } - if txn.update { - txn.db.orc.decrRef() - } -} - -func (txn *Txn) commitAndSend() (func() error, error) { - orc := txn.db.orc - // Ensure that the order in which we get the commit timestamp is the same as - // the order in which we push these updates to the write channel. So, we - // acquire a writeChLock before getting a commit timestamp, and only release - // it after pushing the entries to it. - orc.writeChLock.Lock() - defer orc.writeChLock.Unlock() - - commitTs := orc.newCommitTs(txn) - if commitTs == 0 { - return nil, ErrConflict - } - - // The following debug information is what led to determining the cause of - // bank txn violation bug, and it took a whole bunch of effort to narrow it - // down to here. So, keep this around for at least a couple of months. - // var b strings.Builder - // fmt.Fprintf(&b, "Read: %d. Commit: %d. reads: %v. writes: %v. Keys: ", - // txn.readTs, commitTs, txn.reads, txn.writes) - entries := make([]*Entry, 0, len(txn.pendingWrites)+1) - for _, e := range txn.pendingWrites { - // fmt.Fprintf(&b, "[%q : %q], ", e.Key, e.Value) - - // Suffix the keys with commit ts, so the key versions are sorted in - // descending order of commit timestamp. - e.Key = y.KeyWithTs(e.Key, commitTs) - e.meta |= bitTxn - entries = append(entries, e) - } - // log.Printf("%s\n", b.String()) - e := &Entry{ - Key: y.KeyWithTs(txnKey, commitTs), - Value: []byte(strconv.FormatUint(commitTs, 10)), - meta: bitFinTxn, - } - entries = append(entries, e) - - req, err := txn.db.sendToWriteCh(entries) - if err != nil { - orc.doneCommit(commitTs) - return nil, err - } - ret := func() error { - err := req.Wait() - // Wait before marking commitTs as done. - // We can't defer doneCommit above, because it is being called from a - // callback here. - orc.doneCommit(commitTs) - return err - } - return ret, nil -} - -func (txn *Txn) commitPrecheck() { - if txn.commitTs == 0 && txn.db.opt.managedTxns { - panic("Commit cannot be called with managedDB=true. Use CommitAt.") - } - if txn.discarded { - panic("Trying to commit a discarded txn") - } -} - -// Commit commits the transaction, following these steps: -// -// 1. If there are no writes, return immediately. -// -// 2. Check if read rows were updated since txn started. If so, return ErrConflict. -// -// 3. If no conflict, generate a commit timestamp and update written rows' commit ts. -// -// 4. Batch up all writes, write them to value log and LSM tree. -// -// 5. If callback is provided, Badger will return immediately after checking -// for conflicts. Writes to the database will happen in the background. If -// there is a conflict, an error will be returned and the callback will not -// run. If there are no conflicts, the callback will be called in the -// background upon successful completion of writes or any error during write. -// -// If error is nil, the transaction is successfully committed. In case of a non-nil error, the LSM -// tree won't be updated, so there's no need for any rollback. -func (txn *Txn) Commit() error { - txn.commitPrecheck() // Precheck before discarding txn. - defer txn.Discard() - - if len(txn.writes) == 0 { - return nil // Nothing to do. - } - - txnCb, err := txn.commitAndSend() - if err != nil { - return err - } - // If batchSet failed, LSM would not have been updated. So, no need to rollback anything. - - // TODO: What if some of the txns successfully make it to value log, but others fail. - // Nothing gets updated to LSM, until a restart happens. - return txnCb() -} - -type txnCb struct { - commit func() error - user func(error) - err error -} - -func runTxnCallback(cb *txnCb) { - switch { - case cb == nil: - panic("txn callback is nil") - case cb.user == nil: - panic("Must have caught a nil callback for txn.CommitWith") - case cb.err != nil: - cb.user(cb.err) - case cb.commit != nil: - err := cb.commit() - cb.user(err) - default: - cb.user(nil) - } -} - -// CommitWith acts like Commit, but takes a callback, which gets run via a -// goroutine to avoid blocking this function. The callback is guaranteed to run, -// so it is safe to increment sync.WaitGroup before calling CommitWith, and -// decrementing it in the callback; to block until all callbacks are run. -func (txn *Txn) CommitWith(cb func(error)) { - txn.commitPrecheck() // Precheck before discarding txn. - defer txn.Discard() - - if cb == nil { - panic("Nil callback provided to CommitWith") - } - - if len(txn.writes) == 0 { - // Do not run these callbacks from here, because the CommitWith and the - // callback might be acquiring the same locks. Instead run the callback - // from another goroutine. - go runTxnCallback(&txnCb{user: cb, err: nil}) - return - } - - commitCb, err := txn.commitAndSend() - if err != nil { - go runTxnCallback(&txnCb{user: cb, err: err}) - return - } - - go runTxnCallback(&txnCb{user: cb, commit: commitCb}) -} - -// ReadTs returns the read timestamp of the transaction. -func (txn *Txn) ReadTs() uint64 { - return txn.readTs -} - -// NewTransaction creates a new transaction. Badger supports concurrent execution of transactions, -// providing serializable snapshot isolation, avoiding write skews. Badger achieves this by tracking -// the keys read and at Commit time, ensuring that these read keys weren't concurrently modified by -// another transaction. -// -// For read-only transactions, set update to false. In this mode, we don't track the rows read for -// any changes. Thus, any long running iterations done in this mode wouldn't pay this overhead. -// -// Running transactions concurrently is OK. However, a transaction itself isn't thread safe, and -// should only be run serially. It doesn't matter if a transaction is created by one goroutine and -// passed down to other, as long as the Txn APIs are called serially. -// -// When you create a new transaction, it is absolutely essential to call -// Discard(). This should be done irrespective of what the update param is set -// to. Commit API internally runs Discard, but running it twice wouldn't cause -// any issues. -// -// txn := db.NewTransaction(false) -// defer txn.Discard() -// // Call various APIs. -func (db *DB) NewTransaction(update bool) *Txn { - return db.newTransaction(update, false) -} - -func (db *DB) newTransaction(update, isManaged bool) *Txn { - if db.opt.ReadOnly && update { - // DB is read-only, force read-only transaction. - update = false - } - - txn := &Txn{ - update: update, - db: db, - count: 1, // One extra entry for BitFin. - size: int64(len(txnKey) + 10), // Some buffer for the extra entry. - } - if update { - txn.pendingWrites = make(map[string]*Entry) - txn.db.orc.addRef() - } - // It is important that the oracle addRef happens BEFORE we retrieve a read - // timestamp. Otherwise, it is possible that the oracle commit map would - // become nil after we get the read timestamp. - // The sequence of events can be: - // 1. This txn gets a read timestamp. - // 2. Another txn working on the same keyset commits them, and decrements - // the reference to oracle. - // 3. Oracle ref reaches zero, resetting commit map. - // 4. This txn increments the oracle reference. - // 5. Now this txn would go on to commit the keyset, and no conflicts - // would be detected. - // See issue: https://github.com/dgraph-io/badger/issues/574 - if !isManaged { - txn.readTs = db.orc.readTs() - } - return txn -} - -// View executes a function creating and managing a read-only transaction for the user. Error -// returned by the function is relayed by the View method. -// If View is used with managed transactions, it would assume a read timestamp of MaxUint64. -func (db *DB) View(fn func(txn *Txn) error) error { - var txn *Txn - if db.opt.managedTxns { - txn = db.NewTransactionAt(math.MaxUint64, false) - } else { - txn = db.NewTransaction(false) - } - defer txn.Discard() - - return fn(txn) -} - -// Update executes a function, creating and managing a read-write transaction -// for the user. Error returned by the function is relayed by the Update method. -// Update cannot be used with managed transactions. -func (db *DB) Update(fn func(txn *Txn) error) error { - if db.opt.managedTxns { - panic("Update can only be used with managedDB=false.") - } - txn := db.NewTransaction(true) - defer txn.Discard() - - if err := fn(txn); err != nil { - return err - } - - return txn.Commit() -} diff --git a/vendor/github.com/dgraph-io/badger/util.go b/vendor/github.com/dgraph-io/badger/util.go deleted file mode 100644 index 02952a80..00000000 --- a/vendor/github.com/dgraph-io/badger/util.go +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "encoding/hex" - "io/ioutil" - "math/rand" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/table" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" -) - -// summary is produced when DB is closed. Currently it is used only for testing. -type summary struct { - fileIDs map[uint64]bool -} - -func (s *levelsController) getSummary() *summary { - out := &summary{ - fileIDs: make(map[uint64]bool), - } - for _, l := range s.levels { - l.getSummary(out) - } - return out -} - -func (s *levelHandler) getSummary(sum *summary) { - s.RLock() - defer s.RUnlock() - for _, t := range s.tables { - sum.fileIDs[t.ID()] = true - } -} - -func (s *DB) validate() error { return s.lc.validate() } - -func (s *levelsController) validate() error { - for _, l := range s.levels { - if err := l.validate(); err != nil { - return errors.Wrap(err, "Levels Controller") - } - } - return nil -} - -// Check does some sanity check on one level of data or in-memory index. -func (s *levelHandler) validate() error { - if s.level == 0 { - return nil - } - - s.RLock() - defer s.RUnlock() - numTables := len(s.tables) - for j := 1; j < numTables; j++ { - if j >= len(s.tables) { - return errors.Errorf("Level %d, j=%d numTables=%d", s.level, j, numTables) - } - - if y.CompareKeys(s.tables[j-1].Biggest(), s.tables[j].Smallest()) >= 0 { - return errors.Errorf( - "Inter: Biggest(j-1) \n%s\n vs Smallest(j): \n%s\n: level=%d j=%d numTables=%d", - hex.Dump(s.tables[j-1].Biggest()), hex.Dump(s.tables[j].Smallest()), - s.level, j, numTables) - } - - if y.CompareKeys(s.tables[j].Smallest(), s.tables[j].Biggest()) > 0 { - return errors.Errorf( - "Intra: %q vs %q: level=%d j=%d numTables=%d", - s.tables[j].Smallest(), s.tables[j].Biggest(), s.level, j, numTables) - } - } - return nil -} - -// func (s *KV) debugPrintMore() { s.lc.debugPrintMore() } - -// // debugPrintMore shows key ranges of each level. -// func (s *levelsController) debugPrintMore() { -// s.Lock() -// defer s.Unlock() -// for i := 0; i < s.kv.opt.MaxLevels; i++ { -// s.levels[i].debugPrintMore() -// } -// } - -// func (s *levelHandler) debugPrintMore() { -// s.RLock() -// defer s.RUnlock() -// s.elog.Printf("Level %d:", s.level) -// for _, t := range s.tables { -// y.Printf(" [%s, %s]", t.Smallest(), t.Biggest()) -// } -// y.Printf("\n") -// } - -// reserveFileID reserves a unique file id. -func (s *levelsController) reserveFileID() uint64 { - id := atomic.AddUint64(&s.nextFileID, 1) - return id - 1 -} - -func getIDMap(dir string) map[uint64]struct{} { - fileInfos, err := ioutil.ReadDir(dir) - y.Check(err) - idMap := make(map[uint64]struct{}) - for _, info := range fileInfos { - if info.IsDir() { - continue - } - fileID, ok := table.ParseFileID(info.Name()) - if !ok { - continue - } - idMap[fileID] = struct{}{} - } - return idMap -} - -func init() { - rand.Seed(time.Now().UnixNano()) -} diff --git a/vendor/github.com/dgraph-io/badger/value.go b/vendor/github.com/dgraph-io/badger/value.go deleted file mode 100644 index 77cdc185..00000000 --- a/vendor/github.com/dgraph-io/badger/value.go +++ /dev/null @@ -1,1396 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package badger - -import ( - "bufio" - "bytes" - "encoding/binary" - "encoding/json" - "fmt" - "hash/crc32" - "io" - "io/ioutil" - "math" - "math/rand" - "os" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/dgraph-io/badger/options" - "github.com/dgraph-io/badger/y" - "github.com/pkg/errors" - "golang.org/x/net/trace" -) - -// Values have their first byte being byteData or byteDelete. This helps us distinguish between -// a key that has never been seen and a key that has been explicitly deleted. -const ( - bitDelete byte = 1 << 0 // Set if the key has been deleted. - bitValuePointer byte = 1 << 1 // Set if the value is NOT stored directly next to key. - bitDiscardEarlierVersions byte = 1 << 2 // Set if earlier versions can be discarded. - // Set if item shouldn't be discarded via compactions (used by merge operator) - bitMergeEntry byte = 1 << 3 - // The MSB 2 bits are for transactions. - bitTxn byte = 1 << 6 // Set if the entry is part of a txn. - bitFinTxn byte = 1 << 7 // Set if the entry is to indicate end of txn in value log. - - mi int64 = 1 << 20 -) - -type logFile struct { - path string - // This is a lock on the log file. It guards the fd’s value, the file’s - // existence and the file’s memory map. - // - // Use shared ownership when reading/writing the file or memory map, use - // exclusive ownership to open/close the descriptor, unmap or remove the file. - lock sync.RWMutex - fd *os.File - fid uint32 - fmap []byte - size uint32 - loadingMode options.FileLoadingMode -} - -// openReadOnly assumes that we have a write lock on logFile. -func (lf *logFile) openReadOnly() error { - var err error - lf.fd, err = os.OpenFile(lf.path, os.O_RDONLY, 0666) - if err != nil { - return errors.Wrapf(err, "Unable to open %q as RDONLY.", lf.path) - } - - fi, err := lf.fd.Stat() - if err != nil { - return errors.Wrapf(err, "Unable to check stat for %q", lf.path) - } - y.AssertTrue(fi.Size() <= math.MaxUint32) - lf.size = uint32(fi.Size()) - - if err = lf.mmap(fi.Size()); err != nil { - _ = lf.fd.Close() - return y.Wrapf(err, "Unable to map file") - } - - return nil -} - -func (lf *logFile) mmap(size int64) (err error) { - if lf.loadingMode != options.MemoryMap { - // Nothing to do - return nil - } - lf.fmap, err = y.Mmap(lf.fd, false, size) - if err == nil { - err = y.Madvise(lf.fmap, false) // Disable readahead - } - return err -} - -func (lf *logFile) munmap() (err error) { - if lf.loadingMode != options.MemoryMap { - // Nothing to do - return nil - } - if err := y.Munmap(lf.fmap); err != nil { - return errors.Wrapf(err, "Unable to munmap value log: %q", lf.path) - } - return nil -} - -// Acquire lock on mmap/file if you are calling this -func (lf *logFile) read(p valuePointer, s *y.Slice) (buf []byte, err error) { - var nbr int64 - offset := p.Offset - if lf.loadingMode == options.FileIO { - buf = s.Resize(int(p.Len)) - var n int - n, err = lf.fd.ReadAt(buf, int64(offset)) - nbr = int64(n) - } else { - // Do not convert size to uint32, because the lf.fmap can be of size - // 4GB, which overflows the uint32 during conversion to make the size 0, - // causing the read to fail with ErrEOF. See issue #585. - size := int64(len(lf.fmap)) - valsz := p.Len - if int64(offset) >= size || int64(offset+valsz) > size { - err = y.ErrEOF - } else { - buf = lf.fmap[offset : offset+valsz] - nbr = int64(valsz) - } - } - y.NumReads.Add(1) - y.NumBytesRead.Add(nbr) - return buf, err -} - -func (lf *logFile) doneWriting(offset uint32) error { - // Sync before acquiring lock. (We call this from write() and thus know we have shared access - // to the fd.) - if err := lf.fd.Sync(); err != nil { - return errors.Wrapf(err, "Unable to sync value log: %q", lf.path) - } - // Close and reopen the file read-only. Acquire lock because fd will become invalid for a bit. - // Acquiring the lock is bad because, while we don't hold the lock for a long time, it forces - // one batch of readers wait for the preceding batch of readers to finish. - // - // If there's a benefit to reopening the file read-only, it might be on Windows. I don't know - // what the benefit is. Consider keeping the file read-write, or use fcntl to change - // permissions. - lf.lock.Lock() - defer lf.lock.Unlock() - if err := lf.munmap(); err != nil { - return err - } - // TODO: Confirm if we need to run a file sync after truncation. - // Truncation must run after unmapping, otherwise Windows would crap itself. - if err := lf.fd.Truncate(int64(offset)); err != nil { - return errors.Wrapf(err, "Unable to truncate file: %q", lf.path) - } - if err := lf.fd.Close(); err != nil { - return errors.Wrapf(err, "Unable to close value log: %q", lf.path) - } - - return lf.openReadOnly() -} - -// You must hold lf.lock to sync() -func (lf *logFile) sync() error { - return lf.fd.Sync() -} - -var errStop = errors.New("Stop iteration") -var errTruncate = errors.New("Do truncate") - -type logEntry func(e Entry, vp valuePointer) error - -type safeRead struct { - k []byte - v []byte - - recordOffset uint32 -} - -func (r *safeRead) Entry(reader *bufio.Reader) (*Entry, error) { - var hbuf [headerBufSize]byte - var err error - - hash := crc32.New(y.CastagnoliCrcTable) - tee := io.TeeReader(reader, hash) - if _, err = io.ReadFull(tee, hbuf[:]); err != nil { - return nil, err - } - - var h header - h.Decode(hbuf[:]) - if h.klen > uint32(1<<16) { // Key length must be below uint16. - return nil, errTruncate - } - kl := int(h.klen) - if cap(r.k) < kl { - r.k = make([]byte, 2*kl) - } - vl := int(h.vlen) - if cap(r.v) < vl { - r.v = make([]byte, 2*vl) - } - - e := &Entry{} - e.offset = r.recordOffset - e.Key = r.k[:kl] - e.Value = r.v[:vl] - - if _, err = io.ReadFull(tee, e.Key); err != nil { - if err == io.EOF { - err = errTruncate - } - return nil, err - } - if _, err = io.ReadFull(tee, e.Value); err != nil { - if err == io.EOF { - err = errTruncate - } - return nil, err - } - var crcBuf [4]byte - if _, err = io.ReadFull(reader, crcBuf[:]); err != nil { - if err == io.EOF { - err = errTruncate - } - return nil, err - } - crc := binary.BigEndian.Uint32(crcBuf[:]) - if crc != hash.Sum32() { - return nil, errTruncate - } - e.meta = h.meta - e.UserMeta = h.userMeta - e.ExpiresAt = h.expiresAt - return e, nil -} - -// iterate iterates over log file. It doesn't not allocate new memory for every kv pair. -// Therefore, the kv pair is only valid for the duration of fn call. -func (vlog *valueLog) iterate(lf *logFile, offset uint32, fn logEntry) (uint32, error) { - fi, err := lf.fd.Stat() - if err != nil { - return 0, err - } - if int64(offset) == fi.Size() { - // We're at the end of the file already. No need to do anything. - return offset, nil - } - if vlog.opt.ReadOnly { - // We're not at the end of the file. We'd need to replay the entries, or - // possibly truncate the file. - return 0, ErrReplayNeeded - } - - // We're not at the end of the file. Let's Seek to the offset and start reading. - if _, err := lf.fd.Seek(int64(offset), io.SeekStart); err != nil { - return 0, errFile(err, lf.path, "Unable to seek") - } - - reader := bufio.NewReader(lf.fd) - read := &safeRead{ - k: make([]byte, 10), - v: make([]byte, 10), - recordOffset: offset, - } - - var lastCommit uint64 - var validEndOffset uint32 - for { - e, err := read.Entry(reader) - if err == io.EOF { - break - } else if err == io.ErrUnexpectedEOF || err == errTruncate { - break - } else if err != nil { - return 0, err - } else if e == nil { - continue - } - - var vp valuePointer - vp.Len = uint32(headerBufSize + len(e.Key) + len(e.Value) + crc32.Size) - read.recordOffset += vp.Len - - vp.Offset = e.offset - vp.Fid = lf.fid - - if e.meta&bitTxn > 0 { - txnTs := y.ParseTs(e.Key) - if lastCommit == 0 { - lastCommit = txnTs - } - if lastCommit != txnTs { - break - } - - } else if e.meta&bitFinTxn > 0 { - txnTs, err := strconv.ParseUint(string(e.Value), 10, 64) - if err != nil || lastCommit != txnTs { - break - } - // Got the end of txn. Now we can store them. - lastCommit = 0 - validEndOffset = read.recordOffset - - } else { - if lastCommit != 0 { - // This is most likely an entry which was moved as part of GC. - // We shouldn't get this entry in the middle of a transaction. - break - } - validEndOffset = read.recordOffset - } - - if err := fn(*e, vp); err != nil { - if err == errStop { - break - } - return 0, errFile(err, lf.path, "Iteration function") - } - } - return validEndOffset, nil -} - -func (vlog *valueLog) rewrite(f *logFile, tr trace.Trace) error { - maxFid := atomic.LoadUint32(&vlog.maxFid) - y.AssertTruef(uint32(f.fid) < maxFid, "fid to move: %d. Current max fid: %d", f.fid, maxFid) - tr.LazyPrintf("Rewriting fid: %d", f.fid) - - wb := make([]*Entry, 0, 1000) - var size int64 - - y.AssertTrue(vlog.db != nil) - var count, moved int - fe := func(e Entry) error { - count++ - if count%100000 == 0 { - tr.LazyPrintf("Processing entry %d", count) - } - - vs, err := vlog.db.get(e.Key) - if err != nil { - return err - } - if discardEntry(e, vs) { - return nil - } - - // Value is still present in value log. - if len(vs.Value) == 0 { - return errors.Errorf("Empty value: %+v", vs) - } - var vp valuePointer - vp.Decode(vs.Value) - - if vp.Fid > f.fid { - return nil - } - if vp.Offset > e.offset { - return nil - } - if vp.Fid == f.fid && vp.Offset == e.offset { - moved++ - // This new entry only contains the key, and a pointer to the value. - ne := new(Entry) - ne.meta = 0 // Remove all bits. Different keyspace doesn't need these bits. - ne.UserMeta = e.UserMeta - - // Create a new key in a separate keyspace, prefixed by moveKey. We are not - // allowed to rewrite an older version of key in the LSM tree, because then this older - // version would be at the top of the LSM tree. To work correctly, reads expect the - // latest versions to be at the top, and the older versions at the bottom. - if bytes.HasPrefix(e.Key, badgerMove) { - ne.Key = append([]byte{}, e.Key...) - } else { - ne.Key = make([]byte, len(badgerMove)+len(e.Key)) - n := copy(ne.Key, badgerMove) - copy(ne.Key[n:], e.Key) - } - - ne.Value = append([]byte{}, e.Value...) - wb = append(wb, ne) - size += int64(e.estimateSize(vlog.opt.ValueThreshold)) - if size >= 64*mi { - tr.LazyPrintf("request has %d entries, size %d", len(wb), size) - if err := vlog.db.batchSet(wb); err != nil { - return err - } - size = 0 - wb = wb[:0] - } - } else { - vlog.db.opt.Warningf("This entry should have been caught. %+v\n", e) - } - return nil - } - - _, err := vlog.iterate(f, 0, func(e Entry, vp valuePointer) error { - return fe(e) - }) - if err != nil { - return err - } - - tr.LazyPrintf("request has %d entries, size %d", len(wb), size) - batchSize := 1024 - var loops int - for i := 0; i < len(wb); { - loops++ - if batchSize == 0 { - vlog.db.opt.Warningf("We shouldn't reach batch size of zero.") - return ErrNoRewrite - } - end := i + batchSize - if end > len(wb) { - end = len(wb) - } - if err := vlog.db.batchSet(wb[i:end]); err != nil { - if err == ErrTxnTooBig { - // Decrease the batch size to half. - batchSize = batchSize / 2 - tr.LazyPrintf("Dropped batch size to %d", batchSize) - continue - } - return err - } - i += batchSize - } - tr.LazyPrintf("Processed %d entries in %d loops", len(wb), loops) - tr.LazyPrintf("Total entries: %d. Moved: %d", count, moved) - tr.LazyPrintf("Removing fid: %d", f.fid) - var deleteFileNow bool - // Entries written to LSM. Remove the older file now. - { - vlog.filesLock.Lock() - // Just a sanity-check. - if _, ok := vlog.filesMap[f.fid]; !ok { - vlog.filesLock.Unlock() - return errors.Errorf("Unable to find fid: %d", f.fid) - } - if vlog.iteratorCount() == 0 { - delete(vlog.filesMap, f.fid) - deleteFileNow = true - } else { - vlog.filesToBeDeleted = append(vlog.filesToBeDeleted, f.fid) - } - vlog.filesLock.Unlock() - } - - if deleteFileNow { - vlog.deleteLogFile(f) - } - - return nil -} - -func (vlog *valueLog) deleteMoveKeysFor(fid uint32, tr trace.Trace) error { - db := vlog.db - var result []*Entry - var count, pointers uint64 - tr.LazyPrintf("Iterating over move keys to find invalids for fid: %d", fid) - err := db.View(func(txn *Txn) error { - opt := DefaultIteratorOptions - opt.internalAccess = true - opt.PrefetchValues = false - itr := txn.NewIterator(opt) - defer itr.Close() - - for itr.Seek(badgerMove); itr.ValidForPrefix(badgerMove); itr.Next() { - count++ - item := itr.Item() - if item.meta&bitValuePointer == 0 { - continue - } - pointers++ - var vp valuePointer - vp.Decode(item.vptr) - if vp.Fid == fid { - e := &Entry{Key: y.KeyWithTs(item.Key(), item.Version()), meta: bitDelete} - result = append(result, e) - } - } - return nil - }) - if err != nil { - tr.LazyPrintf("Got error while iterating move keys: %v", err) - tr.SetError() - return err - } - tr.LazyPrintf("Num total move keys: %d. Num pointers: %d", count, pointers) - tr.LazyPrintf("Number of invalid move keys found: %d", len(result)) - batchSize := 10240 - for i := 0; i < len(result); { - end := i + batchSize - if end > len(result) { - end = len(result) - } - if err := db.batchSet(result[i:end]); err != nil { - if err == ErrTxnTooBig { - batchSize /= 2 - tr.LazyPrintf("Dropped batch size to %d", batchSize) - continue - } - tr.LazyPrintf("Error while doing batchSet: %v", err) - tr.SetError() - return err - } - i += batchSize - } - tr.LazyPrintf("Move keys deletion done.") - return nil -} - -func (vlog *valueLog) incrIteratorCount() { - atomic.AddInt32(&vlog.numActiveIterators, 1) -} - -func (vlog *valueLog) iteratorCount() int { - return int(atomic.LoadInt32(&vlog.numActiveIterators)) -} - -func (vlog *valueLog) decrIteratorCount() error { - num := atomic.AddInt32(&vlog.numActiveIterators, -1) - if num != 0 { - return nil - } - - vlog.filesLock.Lock() - lfs := make([]*logFile, 0, len(vlog.filesToBeDeleted)) - for _, id := range vlog.filesToBeDeleted { - lfs = append(lfs, vlog.filesMap[id]) - delete(vlog.filesMap, id) - } - vlog.filesToBeDeleted = nil - vlog.filesLock.Unlock() - - for _, lf := range lfs { - if err := vlog.deleteLogFile(lf); err != nil { - return err - } - } - return nil -} - -func (vlog *valueLog) deleteLogFile(lf *logFile) error { - if lf == nil { - return nil - } - path := vlog.fpath(lf.fid) - if err := lf.munmap(); err != nil { - _ = lf.fd.Close() - return err - } - if err := lf.fd.Close(); err != nil { - return err - } - return os.Remove(path) -} - -func (vlog *valueLog) dropAll() (int, error) { - // We don't want to block dropAll on any pending transactions. So, don't worry about iterator - // count. - var count int - deleteAll := func() error { - vlog.filesLock.Lock() - defer vlog.filesLock.Unlock() - for _, lf := range vlog.filesMap { - if err := vlog.deleteLogFile(lf); err != nil { - return err - } - count++ - } - vlog.filesMap = make(map[uint32]*logFile) - return nil - } - if err := deleteAll(); err != nil { - return count, err - } - - vlog.db.opt.Infof("Value logs deleted. Creating value log file: 0") - if _, err := vlog.createVlogFile(0); err != nil { - return count, err - } - atomic.StoreUint32(&vlog.maxFid, 0) - return count, nil -} - -// lfDiscardStats keeps track of the amount of data that could be discarded for -// a given logfile. -type lfDiscardStats struct { - sync.Mutex - m map[uint32]int64 -} - -type valueLog struct { - dirPath string - elog trace.EventLog - - // guards our view of which files exist, which to be deleted, how many active iterators - filesLock sync.RWMutex - filesMap map[uint32]*logFile - filesToBeDeleted []uint32 - // A refcount of iterators -- when this hits zero, we can delete the filesToBeDeleted. - numActiveIterators int32 - - db *DB - maxFid uint32 // accessed via atomics. - writableLogOffset uint32 // read by read, written by write. Must access via atomics. - numEntriesWritten uint32 - opt Options - - garbageCh chan struct{} - lfDiscardStats *lfDiscardStats -} - -func vlogFilePath(dirPath string, fid uint32) string { - return fmt.Sprintf("%s%s%06d.vlog", dirPath, string(os.PathSeparator), fid) -} - -func (vlog *valueLog) fpath(fid uint32) string { - return vlogFilePath(vlog.dirPath, fid) -} - -func (vlog *valueLog) populateFilesMap() error { - vlog.filesMap = make(map[uint32]*logFile) - - files, err := ioutil.ReadDir(vlog.dirPath) - if err != nil { - return errFile(err, vlog.dirPath, "Unable to open log dir.") - } - - found := make(map[uint64]struct{}) - for _, file := range files { - if !strings.HasSuffix(file.Name(), ".vlog") { - continue - } - fsz := len(file.Name()) - fid, err := strconv.ParseUint(file.Name()[:fsz-5], 10, 32) - if err != nil { - return errFile(err, file.Name(), "Unable to parse log id.") - } - if _, ok := found[fid]; ok { - return errFile(err, file.Name(), "Duplicate file found. Please delete one.") - } - found[fid] = struct{}{} - - lf := &logFile{ - fid: uint32(fid), - path: vlog.fpath(uint32(fid)), - loadingMode: vlog.opt.ValueLogLoadingMode, - } - vlog.filesMap[uint32(fid)] = lf - if vlog.maxFid < uint32(fid) { - vlog.maxFid = uint32(fid) - } - } - return nil -} - -func (vlog *valueLog) createVlogFile(fid uint32) (*logFile, error) { - path := vlog.fpath(fid) - lf := &logFile{ - fid: fid, - path: path, - loadingMode: vlog.opt.ValueLogLoadingMode, - } - // writableLogOffset is only written by write func, by read by Read func. - // To avoid a race condition, all reads and updates to this variable must be - // done via atomics. - atomic.StoreUint32(&vlog.writableLogOffset, 0) - vlog.numEntriesWritten = 0 - - var err error - if lf.fd, err = y.CreateSyncedFile(path, vlog.opt.SyncWrites); err != nil { - return nil, errFile(err, lf.path, "Create value log file") - } - if err = syncDir(vlog.dirPath); err != nil { - return nil, errFile(err, vlog.dirPath, "Sync value log dir") - } - if err = lf.mmap(2 * vlog.opt.ValueLogFileSize); err != nil { - return nil, errFile(err, lf.path, "Mmap value log file") - } - - vlog.filesLock.Lock() - vlog.filesMap[fid] = lf - vlog.filesLock.Unlock() - - return lf, nil -} - -func errFile(err error, path string, msg string) error { - return fmt.Errorf("%s. Path=%s. Error=%v", msg, path, err) -} - -func (vlog *valueLog) replayLog(lf *logFile, offset uint32, replayFn logEntry) error { - var err error - mode := os.O_RDONLY - if vlog.opt.Truncate { - // We should open the file in RW mode, so it can be truncated. - mode = os.O_RDWR - } - lf.fd, err = os.OpenFile(lf.path, mode, 0) - if err != nil { - return errFile(err, lf.path, "Open file") - } - defer lf.fd.Close() - - fi, err := lf.fd.Stat() - if err != nil { - return errFile(err, lf.path, "Unable to run file.Stat") - } - - // Alright, let's iterate now. - endOffset, err := vlog.iterate(lf, offset, replayFn) - if err != nil { - return errFile(err, lf.path, "Unable to replay logfile") - } - if int64(endOffset) == fi.Size() { - return nil - } - - // End offset is different from file size. So, we should truncate the file - // to that size. - y.AssertTrue(int64(endOffset) <= fi.Size()) - if !vlog.opt.Truncate { - return ErrTruncateNeeded - } - - if err := lf.fd.Truncate(int64(endOffset)); err != nil { - return errFile(err, lf.path, fmt.Sprintf( - "Truncation needed at offset %d. Can be done manually as well.", endOffset)) - } - return nil -} - -func (vlog *valueLog) open(db *DB, ptr valuePointer, replayFn logEntry) error { - opt := db.opt - vlog.opt = opt - vlog.dirPath = opt.ValueDir - vlog.db = db - vlog.elog = trace.NewEventLog("Badger", "Valuelog") - vlog.garbageCh = make(chan struct{}, 1) // Only allow one GC at a time. - - if err := vlog.populateDiscardStats(); err != nil { - return err - } - - if err := vlog.populateFilesMap(); err != nil { - return err - } - // If no files are found, then create a new file. - if len(vlog.filesMap) == 0 { - _, err := vlog.createVlogFile(0) - return err - } - - fids := vlog.sortedFids() - for _, fid := range fids { - lf, ok := vlog.filesMap[fid] - y.AssertTrue(ok) - - // This file is before the value head pointer. So, we don't need to - // replay it, and can just open it in readonly mode. - if fid < ptr.Fid { - if err := lf.openReadOnly(); err != nil { - return err - } - continue - } - - var offset uint32 - if fid == ptr.Fid { - offset = ptr.Offset + ptr.Len - } - vlog.db.opt.Infof("Replaying file id: %d at offset: %d\n", fid, offset) - now := time.Now() - // Replay and possible truncation done. Now we can open the file as per - // user specified options. - if err := vlog.replayLog(lf, offset, replayFn); err != nil { - return err - } - vlog.db.opt.Infof("Replay took: %s\n", time.Since(now)) - - if fid < vlog.maxFid { - if err := lf.openReadOnly(); err != nil { - return err - } - } else { - var flags uint32 - switch { - case vlog.opt.ReadOnly: - // If we have read only, we don't need SyncWrites. - flags |= y.ReadOnly - case vlog.opt.SyncWrites: - flags |= y.Sync - } - var err error - if lf.fd, err = y.OpenExistingFile(vlog.fpath(fid), flags); err != nil { - return errFile(err, lf.path, "Open existing file") - } - } - } - - // Seek to the end to start writing. - last, ok := vlog.filesMap[vlog.maxFid] - y.AssertTrue(ok) - lastOffset, err := last.fd.Seek(0, io.SeekEnd) - if err != nil { - return errFile(err, last.path, "file.Seek to end") - } - vlog.writableLogOffset = uint32(lastOffset) - - // Update the head to point to the updated tail. Otherwise, even after doing a successful - // replay and closing the DB, the value log head does not get updated, which causes the replay - // to happen repeatedly. - vlog.db.vhead = valuePointer{Fid: vlog.maxFid, Offset: uint32(lastOffset)} - - // Map the file if needed. When we create a file, it is automatically mapped. - if err = last.mmap(2 * opt.ValueLogFileSize); err != nil { - return errFile(err, last.path, "Map log file") - } - return nil -} - -func (vlog *valueLog) Close() error { - vlog.elog.Printf("Stopping garbage collection of values.") - defer vlog.elog.Finish() - - var err error - for id, f := range vlog.filesMap { - f.lock.Lock() // We won’t release the lock. - if munmapErr := f.munmap(); munmapErr != nil && err == nil { - err = munmapErr - } - - maxFid := atomic.LoadUint32(&vlog.maxFid) - if !vlog.opt.ReadOnly && id == maxFid { - // truncate writable log file to correct offset. - if truncErr := f.fd.Truncate( - int64(vlog.woffset())); truncErr != nil && err == nil { - err = truncErr - } - } - - if closeErr := f.fd.Close(); closeErr != nil && err == nil { - err = closeErr - } - } - return err -} - -// sortedFids returns the file id's not pending deletion, sorted. Assumes we have shared access to -// filesMap. -func (vlog *valueLog) sortedFids() []uint32 { - toBeDeleted := make(map[uint32]struct{}) - for _, fid := range vlog.filesToBeDeleted { - toBeDeleted[fid] = struct{}{} - } - ret := make([]uint32, 0, len(vlog.filesMap)) - for fid := range vlog.filesMap { - if _, ok := toBeDeleted[fid]; !ok { - ret = append(ret, fid) - } - } - sort.Slice(ret, func(i, j int) bool { - return ret[i] < ret[j] - }) - return ret -} - -type request struct { - // Input values - Entries []*Entry - // Output values and wait group stuff below - Ptrs []valuePointer - Wg sync.WaitGroup - Err error - ref int32 -} - -func (req *request) IncrRef() { - atomic.AddInt32(&req.ref, 1) -} - -func (req *request) DecrRef() { - nRef := atomic.AddInt32(&req.ref, -1) - if nRef > 0 { - return - } - req.Entries = nil - requestPool.Put(req) -} - -func (req *request) Wait() error { - req.Wg.Wait() - err := req.Err - req.DecrRef() // DecrRef after writing to DB. - return err -} - -type requests []*request - -func (reqs requests) DecrRef() { - for _, req := range reqs { - req.DecrRef() - } -} - -// sync function syncs content of latest value log file to disk. Syncing of value log directory is -// not required here as it happens every time a value log file rotation happens(check createVlogFile -// function). During rotation, previous value log file also gets synced to disk. It only syncs file -// if fid >= vlog.maxFid. In some cases such as replay(while openning db), it might be called with -// fid < vlog.maxFid. To sync irrespective of file id just call it with math.MaxUint32. -func (vlog *valueLog) sync(fid uint32) error { - if vlog.opt.SyncWrites { - return nil - } - - vlog.filesLock.RLock() - maxFid := atomic.LoadUint32(&vlog.maxFid) - // During replay it is possible to get sync call with fid less than maxFid. - // Because older file has already been synced, we can return from here. - if fid < maxFid || len(vlog.filesMap) == 0 { - vlog.filesLock.RUnlock() - return nil - } - curlf := vlog.filesMap[maxFid] - // Sometimes it is possible that vlog.maxFid has been increased but file creation - // with same id is still in progress and this function is called. In those cases - // entry for the file might not be present in vlog.filesMap. - if curlf == nil { - vlog.filesLock.RUnlock() - return nil - } - curlf.lock.RLock() - vlog.filesLock.RUnlock() - - err := curlf.sync() - curlf.lock.RUnlock() - return err -} - -func (vlog *valueLog) woffset() uint32 { - return atomic.LoadUint32(&vlog.writableLogOffset) -} - -// write is thread-unsafe by design and should not be called concurrently. -func (vlog *valueLog) write(reqs []*request) error { - vlog.filesLock.RLock() - maxFid := atomic.LoadUint32(&vlog.maxFid) - curlf := vlog.filesMap[maxFid] - vlog.filesLock.RUnlock() - - var buf bytes.Buffer - toDisk := func() error { - if buf.Len() == 0 { - return nil - } - vlog.elog.Printf("Flushing %d blocks of total size: %d", len(reqs), buf.Len()) - n, err := curlf.fd.Write(buf.Bytes()) - if err != nil { - return errors.Wrapf(err, "Unable to write to value log file: %q", curlf.path) - } - buf.Reset() - y.NumWrites.Add(1) - y.NumBytesWritten.Add(int64(n)) - vlog.elog.Printf("Done") - atomic.AddUint32(&vlog.writableLogOffset, uint32(n)) - - if vlog.woffset() > uint32(vlog.opt.ValueLogFileSize) || - vlog.numEntriesWritten > vlog.opt.ValueLogMaxEntries { - var err error - if err = curlf.doneWriting(vlog.woffset()); err != nil { - return err - } - - newid := atomic.AddUint32(&vlog.maxFid, 1) - y.AssertTruef(newid > 0, "newid has overflown uint32: %v", newid) - newlf, err := vlog.createVlogFile(newid) - if err != nil { - return err - } - curlf = newlf - atomic.AddInt32(&vlog.db.logRotates, 1) - } - return nil - } - - for i := range reqs { - b := reqs[i] - b.Ptrs = b.Ptrs[:0] - var written int - for j := range b.Entries { - e := b.Entries[j] - if e.skipVlog { - b.Ptrs = append(b.Ptrs, valuePointer{}) - continue - } - var p valuePointer - - p.Fid = curlf.fid - // Use the offset including buffer length so far. - p.Offset = vlog.woffset() + uint32(buf.Len()) - plen, err := encodeEntry(e, &buf) // Now encode the entry into buffer. - if err != nil { - return err - } - p.Len = uint32(plen) - b.Ptrs = append(b.Ptrs, p) - written++ - } - vlog.numEntriesWritten += uint32(written) - // We write to disk here so that all entries that are part of the same transaction are - // written to the same vlog file. - writeNow := - vlog.woffset()+uint32(buf.Len()) > uint32(vlog.opt.ValueLogFileSize) || - vlog.numEntriesWritten > uint32(vlog.opt.ValueLogMaxEntries) - if writeNow { - if err := toDisk(); err != nil { - return err - } - } - } - return toDisk() -} - -// Gets the logFile and acquires and RLock() for the mmap. You must call RUnlock on the file -// (if non-nil) -func (vlog *valueLog) getFileRLocked(fid uint32) (*logFile, error) { - vlog.filesLock.RLock() - defer vlog.filesLock.RUnlock() - ret, ok := vlog.filesMap[fid] - if !ok { - // log file has gone away, will need to retry the operation. - return nil, ErrRetry - } - ret.lock.RLock() - return ret, nil -} - -// Read reads the value log at a given location. -// TODO: Make this read private. -func (vlog *valueLog) Read(vp valuePointer, s *y.Slice) ([]byte, func(), error) { - // Check for valid offset if we are reading to writable log. - maxFid := atomic.LoadUint32(&vlog.maxFid) - if vp.Fid == maxFid && vp.Offset >= vlog.woffset() { - return nil, nil, errors.Errorf( - "Invalid value pointer offset: %d greater than current offset: %d", - vp.Offset, vlog.woffset()) - } - - buf, cb, err := vlog.readValueBytes(vp, s) - if err != nil { - return nil, cb, err - } - var h header - h.Decode(buf) - n := uint32(headerBufSize) + h.klen - return buf[n : n+h.vlen], cb, nil -} - -func (vlog *valueLog) readValueBytes(vp valuePointer, s *y.Slice) ([]byte, func(), error) { - lf, err := vlog.getFileRLocked(vp.Fid) - if err != nil { - return nil, nil, err - } - - buf, err := lf.read(vp, s) - if vlog.opt.ValueLogLoadingMode == options.MemoryMap { - return buf, lf.lock.RUnlock, err - } - // If we are using File I/O we unlock the file immediately - // and return an empty function as callback. - lf.lock.RUnlock() - return buf, nil, err -} - -// Test helper -func valueBytesToEntry(buf []byte) (e Entry) { - var h header - h.Decode(buf) - n := uint32(headerBufSize) - - e.Key = buf[n : n+h.klen] - n += h.klen - e.meta = h.meta - e.UserMeta = h.userMeta - e.Value = buf[n : n+h.vlen] - return -} - -func (vlog *valueLog) pickLog(head valuePointer, tr trace.Trace) (files []*logFile) { - vlog.filesLock.RLock() - defer vlog.filesLock.RUnlock() - fids := vlog.sortedFids() - if len(fids) <= 1 { - tr.LazyPrintf("Only one or less value log file.") - return nil - } else if head.Fid == 0 { - tr.LazyPrintf("Head pointer is at zero.") - return nil - } - - // Pick a candidate that contains the largest amount of discardable data - candidate := struct { - fid uint32 - discard int64 - }{math.MaxUint32, 0} - vlog.lfDiscardStats.Lock() - for _, fid := range fids { - if fid >= head.Fid { - break - } - if vlog.lfDiscardStats.m[fid] > candidate.discard { - candidate.fid = fid - candidate.discard = vlog.lfDiscardStats.m[fid] - } - } - vlog.lfDiscardStats.Unlock() - - if candidate.fid != math.MaxUint32 { // Found a candidate - tr.LazyPrintf("Found candidate via discard stats: %v", candidate) - files = append(files, vlog.filesMap[candidate.fid]) - } else { - tr.LazyPrintf("Could not find candidate via discard stats. Randomly picking one.") - } - - // Fallback to randomly picking a log file - var idxHead int - for i, fid := range fids { - if fid == head.Fid { - idxHead = i - break - } - } - if idxHead == 0 { // Not found or first file - tr.LazyPrintf("Could not find any file.") - return nil - } - idx := rand.Intn(idxHead) // Don’t include head.Fid. We pick a random file before it. - if idx > 0 { - idx = rand.Intn(idx + 1) // Another level of rand to favor smaller fids. - } - tr.LazyPrintf("Randomly chose fid: %d", fids[idx]) - files = append(files, vlog.filesMap[fids[idx]]) - return files -} - -func discardEntry(e Entry, vs y.ValueStruct) bool { - if vs.Version != y.ParseTs(e.Key) { - // Version not found. Discard. - return true - } - if isDeletedOrExpired(vs.Meta, vs.ExpiresAt) { - return true - } - if (vs.Meta & bitValuePointer) == 0 { - // Key also stores the value in LSM. Discard. - return true - } - if (vs.Meta & bitFinTxn) > 0 { - // Just a txn finish entry. Discard. - return true - } - return false -} - -func (vlog *valueLog) doRunGC(lf *logFile, discardRatio float64, tr trace.Trace) (err error) { - // Update stats before exiting - defer func() { - if err == nil { - vlog.lfDiscardStats.Lock() - delete(vlog.lfDiscardStats.m, lf.fid) - vlog.lfDiscardStats.Unlock() - } - }() - - type reason struct { - total float64 - discard float64 - count int - } - - fi, err := lf.fd.Stat() - if err != nil { - tr.LazyPrintf("Error while finding file size: %v", err) - tr.SetError() - return err - } - - // Set up the sampling window sizes. - sizeWindow := float64(fi.Size()) * 0.1 // 10% of the file as window. - sizeWindowM := sizeWindow / (1 << 20) // in MBs. - countWindow := int(float64(vlog.opt.ValueLogMaxEntries) * 0.01) // 1% of num entries. - tr.LazyPrintf("Size window: %5.2f. Count window: %d.", sizeWindow, countWindow) - - // Pick a random start point for the log. - skipFirstM := float64(rand.Int63n(fi.Size())) // Pick a random starting location. - skipFirstM -= sizeWindow // Avoid hitting EOF by moving back by window. - skipFirstM /= float64(mi) // Convert to MBs. - tr.LazyPrintf("Skip first %5.2f MB of file of size: %d MB", skipFirstM, fi.Size()/mi) - var skipped float64 - - var r reason - start := time.Now() - y.AssertTrue(vlog.db != nil) - s := new(y.Slice) - var numIterations int - _, err = vlog.iterate(lf, 0, func(e Entry, vp valuePointer) error { - numIterations++ - esz := float64(vp.Len) / (1 << 20) // in MBs. - if skipped < skipFirstM { - skipped += esz - return nil - } - - // Sample until we reach the window sizes or exceed 10 seconds. - if r.count > countWindow { - tr.LazyPrintf("Stopping sampling after %d entries.", countWindow) - return errStop - } - if r.total > sizeWindowM { - tr.LazyPrintf("Stopping sampling after reaching window size.") - return errStop - } - if time.Since(start) > 10*time.Second { - tr.LazyPrintf("Stopping sampling after 10 seconds.") - return errStop - } - r.total += esz - r.count++ - - vs, err := vlog.db.get(e.Key) - if err != nil { - return err - } - if discardEntry(e, vs) { - r.discard += esz - return nil - } - - // Value is still present in value log. - y.AssertTrue(len(vs.Value) > 0) - vp.Decode(vs.Value) - - if vp.Fid > lf.fid { - // Value is present in a later log. Discard. - r.discard += esz - return nil - } - if vp.Offset > e.offset { - // Value is present in a later offset, but in the same log. - r.discard += esz - return nil - } - if vp.Fid == lf.fid && vp.Offset == e.offset { - // This is still the active entry. This would need to be rewritten. - - } else { - vlog.elog.Printf("Reason=%+v\n", r) - - buf, cb, err := vlog.readValueBytes(vp, s) - if err != nil { - return errStop - } - ne := valueBytesToEntry(buf) - ne.offset = vp.Offset - ne.print("Latest Entry Header in LSM") - e.print("Latest Entry in Log") - runCallback(cb) - return errors.Errorf("This shouldn't happen. Latest Pointer:%+v. Meta:%v.", - vp, vs.Meta) - } - return nil - }) - - if err != nil { - tr.LazyPrintf("Error while iterating for RunGC: %v", err) - tr.SetError() - return err - } - tr.LazyPrintf("Fid: %d. Skipped: %5.2fMB Num iterations: %d. Data status=%+v\n", - lf.fid, skipped, numIterations, r) - - // If we couldn't sample at least a 1000 KV pairs or at least 75% of the window size, - // and what we can discard is below the threshold, we should skip the rewrite. - if (r.count < countWindow && r.total < sizeWindowM*0.75) || r.discard < discardRatio*r.total { - tr.LazyPrintf("Skipping GC on fid: %d", lf.fid) - return ErrNoRewrite - } - if err = vlog.rewrite(lf, tr); err != nil { - return err - } - tr.LazyPrintf("Done rewriting.") - return nil -} - -func (vlog *valueLog) waitOnGC(lc *y.Closer) { - defer lc.Done() - - <-lc.HasBeenClosed() // Wait for lc to be closed. - - // Block any GC in progress to finish, and don't allow any more writes to runGC by filling up - // the channel of size 1. - vlog.garbageCh <- struct{}{} -} - -func (vlog *valueLog) runGC(discardRatio float64, head valuePointer) error { - select { - case vlog.garbageCh <- struct{}{}: - // Pick a log file for GC. - tr := trace.New("Badger.ValueLog", "GC") - tr.SetMaxEvents(100) - defer func() { - tr.Finish() - <-vlog.garbageCh - }() - - var err error - files := vlog.pickLog(head, tr) - if len(files) == 0 { - tr.LazyPrintf("PickLog returned zero results.") - return ErrNoRewrite - } - tried := make(map[uint32]bool) - for _, lf := range files { - if _, done := tried[lf.fid]; done { - continue - } - tried[lf.fid] = true - err = vlog.doRunGC(lf, discardRatio, tr) - if err == nil { - return vlog.deleteMoveKeysFor(lf.fid, tr) - } - } - return err - default: - return ErrRejected - } -} - -func (vlog *valueLog) updateDiscardStats(stats map[uint32]int64) { - vlog.lfDiscardStats.Lock() - for fid, sz := range stats { - vlog.lfDiscardStats.m[fid] += sz - } - vlog.lfDiscardStats.Unlock() -} - -// encodedDiscardStats returns []byte representation of lfDiscardStats -// This will be called while storing stats in BadgerDB -func (vlog *valueLog) encodedDiscardStats() []byte { - vlog.lfDiscardStats.Lock() - defer vlog.lfDiscardStats.Unlock() - - encodedStats, _ := json.Marshal(vlog.lfDiscardStats.m) - return encodedStats -} - -// populateDiscardStats populates vlog.lfDiscardStats -// This function will be called while initializing valueLog -func (vlog *valueLog) populateDiscardStats() error { - discardStatsKey := y.KeyWithTs(lfDiscardStatsKey, math.MaxUint64) - vs, err := vlog.db.get(discardStatsKey) - if err != nil { - return err - } - - // check if value is Empty - if vs.Value == nil || len(vs.Value) == 0 { - vlog.lfDiscardStats = &lfDiscardStats{m: make(map[uint32]int64)} - return nil - } - - var statsMap map[uint32]int64 - if err := json.Unmarshal(vs.Value, &statsMap); err != nil { - return err - } - vlog.opt.Debugf("Value Log Discard stats: %v", statsMap) - vlog.lfDiscardStats = &lfDiscardStats{m: statsMap} - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/y/error.go b/vendor/github.com/dgraph-io/badger/y/error.go deleted file mode 100644 index 59bb2835..00000000 --- a/vendor/github.com/dgraph-io/badger/y/error.go +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -// This file contains some functions for error handling. Note that we are moving -// towards using x.Trace, i.e., rpc tracing using net/tracer. But for now, these -// functions are useful for simple checks logged on one machine. -// Some common use cases are: -// (1) You receive an error from external lib, and would like to check/log fatal. -// For this, use x.Check, x.Checkf. These will check for err != nil, which is -// more common in Go. If you want to check for boolean being true, use -// x.Assert, x.Assertf. -// (2) You receive an error from external lib, and would like to pass on with some -// stack trace information. In this case, use x.Wrap or x.Wrapf. -// (3) You want to generate a new error with stack trace info. Use x.Errorf. - -import ( - "fmt" - "log" - - "github.com/pkg/errors" -) - -var debugMode = true - -// Check logs fatal if err != nil. -func Check(err error) { - if err != nil { - log.Fatalf("%+v", Wrap(err)) - } -} - -// Check2 acts as convenience wrapper around Check, using the 2nd argument as error. -func Check2(_ interface{}, err error) { - Check(err) -} - -// AssertTrue asserts that b is true. Otherwise, it would log fatal. -func AssertTrue(b bool) { - if !b { - log.Fatalf("%+v", errors.Errorf("Assert failed")) - } -} - -// AssertTruef is AssertTrue with extra info. -func AssertTruef(b bool, format string, args ...interface{}) { - if !b { - log.Fatalf("%+v", errors.Errorf(format, args...)) - } -} - -// Wrap wraps errors from external lib. -func Wrap(err error) error { - if !debugMode { - return err - } - return errors.Wrap(err, "") -} - -// Wrapf is Wrap with extra info. -func Wrapf(err error, format string, args ...interface{}) error { - if !debugMode { - if err == nil { - return nil - } - return fmt.Errorf(format+" error: %+v", append(args, err)...) - } - return errors.Wrapf(err, format, args...) -} diff --git a/vendor/github.com/dgraph-io/badger/y/file_dsync.go b/vendor/github.com/dgraph-io/badger/y/file_dsync.go deleted file mode 100644 index 3f3445e2..00000000 --- a/vendor/github.com/dgraph-io/badger/y/file_dsync.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build !dragonfly,!freebsd,!windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import "golang.org/x/sys/unix" - -func init() { - datasyncFileFlag = unix.O_DSYNC -} diff --git a/vendor/github.com/dgraph-io/badger/y/file_nodsync.go b/vendor/github.com/dgraph-io/badger/y/file_nodsync.go deleted file mode 100644 index b68be7ab..00000000 --- a/vendor/github.com/dgraph-io/badger/y/file_nodsync.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build dragonfly freebsd windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import "syscall" - -func init() { - datasyncFileFlag = syscall.O_SYNC -} diff --git a/vendor/github.com/dgraph-io/badger/y/iterator.go b/vendor/github.com/dgraph-io/badger/y/iterator.go deleted file mode 100644 index 719e8ec8..00000000 --- a/vendor/github.com/dgraph-io/badger/y/iterator.go +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import ( - "bytes" - "container/heap" - "encoding/binary" - - "github.com/pkg/errors" -) - -// ValueStruct represents the value info that can be associated with a key, but also the internal -// Meta field. -type ValueStruct struct { - Meta byte - UserMeta byte - ExpiresAt uint64 - Value []byte - - Version uint64 // This field is not serialized. Only for internal usage. -} - -func sizeVarint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} - -// EncodedSize is the size of the ValueStruct when encoded -func (v *ValueStruct) EncodedSize() uint16 { - sz := len(v.Value) + 2 // meta, usermeta. - if v.ExpiresAt == 0 { - return uint16(sz + 1) - } - - enc := sizeVarint(v.ExpiresAt) - return uint16(sz + enc) -} - -// Decode uses the length of the slice to infer the length of the Value field. -func (v *ValueStruct) Decode(b []byte) { - v.Meta = b[0] - v.UserMeta = b[1] - var sz int - v.ExpiresAt, sz = binary.Uvarint(b[2:]) - v.Value = b[2+sz:] -} - -// Encode expects a slice of length at least v.EncodedSize(). -func (v *ValueStruct) Encode(b []byte) { - b[0] = v.Meta - b[1] = v.UserMeta - sz := binary.PutUvarint(b[2:], v.ExpiresAt) - copy(b[2+sz:], v.Value) -} - -// EncodeTo should be kept in sync with the Encode function above. The reason -// this function exists is to avoid creating byte arrays per key-value pair in -// table/builder.go. -func (v *ValueStruct) EncodeTo(buf *bytes.Buffer) { - buf.WriteByte(v.Meta) - buf.WriteByte(v.UserMeta) - var enc [binary.MaxVarintLen64]byte - sz := binary.PutUvarint(enc[:], v.ExpiresAt) - buf.Write(enc[:sz]) - buf.Write(v.Value) -} - -// Iterator is an interface for a basic iterator. -type Iterator interface { - Next() - Rewind() - Seek(key []byte) - Key() []byte - Value() ValueStruct - Valid() bool - - // All iterators should be closed so that file garbage collection works. - Close() error -} - -type elem struct { - itr Iterator - nice int - reversed bool -} - -type elemHeap []*elem - -func (eh elemHeap) Len() int { return len(eh) } -func (eh elemHeap) Swap(i, j int) { eh[i], eh[j] = eh[j], eh[i] } -func (eh *elemHeap) Push(x interface{}) { *eh = append(*eh, x.(*elem)) } -func (eh *elemHeap) Pop() interface{} { - // Remove the last element, because Go has already swapped 0th elem <-> last. - old := *eh - n := len(old) - x := old[n-1] - *eh = old[0 : n-1] - return x -} -func (eh elemHeap) Less(i, j int) bool { - cmp := CompareKeys(eh[i].itr.Key(), eh[j].itr.Key()) - if cmp < 0 { - return !eh[i].reversed - } - if cmp > 0 { - return eh[i].reversed - } - // The keys are equal. In this case, lower nice take precedence. This is important. - return eh[i].nice < eh[j].nice -} - -// MergeIterator merges multiple iterators. -// NOTE: MergeIterator owns the array of iterators and is responsible for closing them. -type MergeIterator struct { - h elemHeap - curKey []byte - reversed bool - - all []Iterator -} - -// NewMergeIterator returns a new MergeIterator from a list of Iterators. -func NewMergeIterator(iters []Iterator, reversed bool) *MergeIterator { - m := &MergeIterator{all: iters, reversed: reversed} - m.h = make(elemHeap, 0, len(iters)) - m.initHeap() - return m -} - -func (s *MergeIterator) storeKey(smallest Iterator) { - if cap(s.curKey) < len(smallest.Key()) { - s.curKey = make([]byte, 2*len(smallest.Key())) - } - s.curKey = s.curKey[:len(smallest.Key())] - copy(s.curKey, smallest.Key()) -} - -// initHeap checks all iterators and initializes our heap and array of keys. -// Whenever we reverse direction, we need to run this. -func (s *MergeIterator) initHeap() { - s.h = s.h[:0] - for idx, itr := range s.all { - if !itr.Valid() { - continue - } - e := &elem{itr: itr, nice: idx, reversed: s.reversed} - s.h = append(s.h, e) - } - heap.Init(&s.h) - for len(s.h) > 0 { - it := s.h[0].itr - if it == nil || !it.Valid() { - heap.Pop(&s.h) - continue - } - s.storeKey(s.h[0].itr) - break - } -} - -// Valid returns whether the MergeIterator is at a valid element. -func (s *MergeIterator) Valid() bool { - if s == nil { - return false - } - if len(s.h) == 0 { - return false - } - return s.h[0].itr.Valid() -} - -// Key returns the key associated with the current iterator -func (s *MergeIterator) Key() []byte { - if len(s.h) == 0 { - return nil - } - return s.h[0].itr.Key() -} - -// Value returns the value associated with the iterator. -func (s *MergeIterator) Value() ValueStruct { - if len(s.h) == 0 { - return ValueStruct{} - } - return s.h[0].itr.Value() -} - -// Next returns the next element. If it is the same as the current key, ignore it. -func (s *MergeIterator) Next() { - if len(s.h) == 0 { - return - } - - smallest := s.h[0].itr - smallest.Next() - - for len(s.h) > 0 { - smallest = s.h[0].itr - if !smallest.Valid() { - heap.Pop(&s.h) - continue - } - - heap.Fix(&s.h, 0) - smallest = s.h[0].itr - if smallest.Valid() { - if !bytes.Equal(smallest.Key(), s.curKey) { - break - } - smallest.Next() - } - } - if !smallest.Valid() { - return - } - s.storeKey(smallest) -} - -// Rewind seeks to first element (or last element for reverse iterator). -func (s *MergeIterator) Rewind() { - for _, itr := range s.all { - itr.Rewind() - } - s.initHeap() -} - -// Seek brings us to element with key >= given key. -func (s *MergeIterator) Seek(key []byte) { - for _, itr := range s.all { - itr.Seek(key) - } - s.initHeap() -} - -// Close implements y.Iterator -func (s *MergeIterator) Close() error { - for _, itr := range s.all { - if err := itr.Close(); err != nil { - return errors.Wrap(err, "MergeIterator") - } - } - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/y/metrics.go b/vendor/github.com/dgraph-io/badger/y/metrics.go deleted file mode 100644 index 2de17d10..00000000 --- a/vendor/github.com/dgraph-io/badger/y/metrics.go +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import "expvar" - -var ( - // LSMSize has size of the LSM in bytes - LSMSize *expvar.Map - // VlogSize has size of the value log in bytes - VlogSize *expvar.Map - // PendingWrites tracks the number of pending writes. - PendingWrites *expvar.Map - - // These are cumulative - - // NumReads has cumulative number of reads - NumReads *expvar.Int - // NumWrites has cumulative number of writes - NumWrites *expvar.Int - // NumBytesRead has cumulative number of bytes read - NumBytesRead *expvar.Int - // NumBytesWritten has cumulative number of bytes written - NumBytesWritten *expvar.Int - // NumLSMGets is number of LMS gets - NumLSMGets *expvar.Map - // NumLSMBloomHits is number of LMS bloom hits - NumLSMBloomHits *expvar.Map - // NumGets is number of gets - NumGets *expvar.Int - // NumPuts is number of puts - NumPuts *expvar.Int - // NumBlockedPuts is number of blocked puts - NumBlockedPuts *expvar.Int - // NumMemtableGets is number of memtable gets - NumMemtableGets *expvar.Int -) - -// These variables are global and have cumulative values for all kv stores. -func init() { - NumReads = expvar.NewInt("badger_disk_reads_total") - NumWrites = expvar.NewInt("badger_disk_writes_total") - NumBytesRead = expvar.NewInt("badger_read_bytes") - NumBytesWritten = expvar.NewInt("badger_written_bytes") - NumLSMGets = expvar.NewMap("badger_lsm_level_gets_total") - NumLSMBloomHits = expvar.NewMap("badger_lsm_bloom_hits_total") - NumGets = expvar.NewInt("badger_gets_total") - NumPuts = expvar.NewInt("badger_puts_total") - NumBlockedPuts = expvar.NewInt("badger_blocked_puts_total") - NumMemtableGets = expvar.NewInt("badger_memtable_gets_total") - LSMSize = expvar.NewMap("badger_lsm_size_bytes") - VlogSize = expvar.NewMap("badger_vlog_size_bytes") - PendingWrites = expvar.NewMap("badger_pending_writes_total") -} diff --git a/vendor/github.com/dgraph-io/badger/y/mmap_unix.go b/vendor/github.com/dgraph-io/badger/y/mmap_unix.go deleted file mode 100644 index f9203a01..00000000 --- a/vendor/github.com/dgraph-io/badger/y/mmap_unix.go +++ /dev/null @@ -1,63 +0,0 @@ -// +build !windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import ( - "os" - "syscall" - "unsafe" - - "golang.org/x/sys/unix" -) - -// Mmap uses the mmap system call to memory-map a file. If writable is true, -// memory protection of the pages is set so that they may be written to as well. -func Mmap(fd *os.File, writable bool, size int64) ([]byte, error) { - mtype := unix.PROT_READ - if writable { - mtype |= unix.PROT_WRITE - } - return unix.Mmap(int(fd.Fd()), 0, int(size), mtype, unix.MAP_SHARED) -} - -// Munmap unmaps a previously mapped slice. -func Munmap(b []byte) error { - return unix.Munmap(b) -} - -// Madvise uses the madvise system call to give advise about the use of memory -// when using a slice that is memory-mapped to a file. Set the readahead flag to -// false if page references are expected in random order. -func Madvise(b []byte, readahead bool) error { - flags := unix.MADV_NORMAL - if !readahead { - flags = unix.MADV_RANDOM - } - return madvise(b, flags) -} - -// This is required because the unix package does not support the madvise system call on OS X. -func madvise(b []byte, advice int) (err error) { - _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), - uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/github.com/dgraph-io/badger/y/mmap_windows.go b/vendor/github.com/dgraph-io/badger/y/mmap_windows.go deleted file mode 100644 index 0efb2d0f..00000000 --- a/vendor/github.com/dgraph-io/badger/y/mmap_windows.go +++ /dev/null @@ -1,90 +0,0 @@ -// +build windows - -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -func Mmap(fd *os.File, write bool, size int64) ([]byte, error) { - protect := syscall.PAGE_READONLY - access := syscall.FILE_MAP_READ - - if write { - protect = syscall.PAGE_READWRITE - access = syscall.FILE_MAP_WRITE - } - fi, err := fd.Stat() - if err != nil { - return nil, err - } - - // Truncate the database to the size of the mmap. - if fi.Size() < size { - if err := fd.Truncate(size); err != nil { - return nil, fmt.Errorf("truncate: %s", err) - } - } - - // Open a file mapping handle. - sizelo := uint32(size >> 32) - sizehi := uint32(size) & 0xffffffff - - handler, err := syscall.CreateFileMapping(syscall.Handle(fd.Fd()), nil, - uint32(protect), sizelo, sizehi, nil) - if err != nil { - return nil, os.NewSyscallError("CreateFileMapping", err) - } - - // Create the memory map. - addr, err := syscall.MapViewOfFile(handler, uint32(access), 0, 0, uintptr(size)) - if addr == 0 { - return nil, os.NewSyscallError("MapViewOfFile", err) - } - - // Close mapping handle. - if err := syscall.CloseHandle(syscall.Handle(handler)); err != nil { - return nil, os.NewSyscallError("CloseHandle", err) - } - - // Slice memory layout - // Copied this snippet from golang/sys package - var sl = struct { - addr uintptr - len int - cap int - }{addr, int(size), int(size)} - - // Use unsafe to turn sl into a []byte. - data := *(*[]byte)(unsafe.Pointer(&sl)) - - return data, nil -} - -func Munmap(b []byte) error { - return syscall.UnmapViewOfFile(uintptr(unsafe.Pointer(&b[0]))) -} - -func Madvise(b []byte, readahead bool) error { - // Do Nothing. We don’t care about this setting on Windows - return nil -} diff --git a/vendor/github.com/dgraph-io/badger/y/watermark.go b/vendor/github.com/dgraph-io/badger/y/watermark.go deleted file mode 100644 index c0bbb194..00000000 --- a/vendor/github.com/dgraph-io/badger/y/watermark.go +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2016-2018 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import ( - "container/heap" - "context" - "sync/atomic" - - "golang.org/x/net/trace" -) - -type uint64Heap []uint64 - -func (u uint64Heap) Len() int { return len(u) } -func (u uint64Heap) Less(i, j int) bool { return u[i] < u[j] } -func (u uint64Heap) Swap(i, j int) { u[i], u[j] = u[j], u[i] } -func (u *uint64Heap) Push(x interface{}) { *u = append(*u, x.(uint64)) } -func (u *uint64Heap) Pop() interface{} { - old := *u - n := len(old) - x := old[n-1] - *u = old[0 : n-1] - return x -} - -// mark contains one of more indices, along with a done boolean to indicate the -// status of the index: begin or done. It also contains waiters, who could be -// waiting for the watermark to reach >= a certain index. -type mark struct { - // Either this is an (index, waiter) pair or (index, done) or (indices, done). - index uint64 - waiter chan struct{} - indices []uint64 - done bool // Set to true if the index is done. -} - -// WaterMark is used to keep track of the minimum un-finished index. Typically, an index k becomes -// finished or "done" according to a WaterMark once Done(k) has been called -// 1. as many times as Begin(k) has, AND -// 2. a positive number of times. -// -// An index may also become "done" by calling SetDoneUntil at a time such that it is not -// inter-mingled with Begin/Done calls. -// -// Since doneUntil and lastIndex addresses are passed to sync/atomic packages, we ensure that they -// are 64-bit aligned by putting them at the beginning of the structure. -type WaterMark struct { - doneUntil uint64 - lastIndex uint64 - Name string - markCh chan mark - elog trace.EventLog -} - -// Init initializes a WaterMark struct. MUST be called before using it. -func (w *WaterMark) Init(closer *Closer) { - w.markCh = make(chan mark, 100) - w.elog = trace.NewEventLog("Watermark", w.Name) - go w.process(closer) -} - -// Begin sets the last index to the given value. -func (w *WaterMark) Begin(index uint64) { - atomic.StoreUint64(&w.lastIndex, index) - w.markCh <- mark{index: index, done: false} -} - -// BeginMany works like Begin but accepts multiple indices. -func (w *WaterMark) BeginMany(indices []uint64) { - atomic.StoreUint64(&w.lastIndex, indices[len(indices)-1]) - w.markCh <- mark{index: 0, indices: indices, done: false} -} - -// Done sets a single index as done. -func (w *WaterMark) Done(index uint64) { - w.markCh <- mark{index: index, done: true} -} - -// DoneMany works like Done but accepts multiple indices. -func (w *WaterMark) DoneMany(indices []uint64) { - w.markCh <- mark{index: 0, indices: indices, done: true} -} - -// DoneUntil returns the maximum index that has the property that all indices -// less than or equal to it are done. -func (w *WaterMark) DoneUntil() uint64 { - return atomic.LoadUint64(&w.doneUntil) -} - -// SetDoneUntil sets the maximum index that has the property that all indices -// less than or equal to it are done. -func (w *WaterMark) SetDoneUntil(val uint64) { - atomic.StoreUint64(&w.doneUntil, val) -} - -// LastIndex returns the last index for which Begin has been called. -func (w *WaterMark) LastIndex() uint64 { - return atomic.LoadUint64(&w.lastIndex) -} - -// WaitForMark waits until the given index is marked as done. -func (w *WaterMark) WaitForMark(ctx context.Context, index uint64) error { - if w.DoneUntil() >= index { - return nil - } - waitCh := make(chan struct{}) - w.markCh <- mark{index: index, waiter: waitCh} - - select { - case <-ctx.Done(): - return ctx.Err() - case <-waitCh: - return nil - } -} - -// process is used to process the Mark channel. This is not thread-safe, -// so only run one goroutine for process. One is sufficient, because -// all goroutine ops use purely memory and cpu. -// Each index has to emit atleast one begin watermark in serial order otherwise waiters -// can get blocked idefinitely. Example: We had an watermark at 100 and a waiter at 101, -// if no watermark is emitted at index 101 then waiter would get stuck indefinitely as it -// can't decide whether the task at 101 has decided not to emit watermark or it didn't get -// scheduled yet. -func (w *WaterMark) process(closer *Closer) { - defer closer.Done() - - var indices uint64Heap - // pending maps raft proposal index to the number of pending mutations for this proposal. - pending := make(map[uint64]int) - waiters := make(map[uint64][]chan struct{}) - - heap.Init(&indices) - var loop uint64 - - processOne := func(index uint64, done bool) { - // If not already done, then set. Otherwise, don't undo a done entry. - prev, present := pending[index] - if !present { - heap.Push(&indices, index) - } - - delta := 1 - if done { - delta = -1 - } - pending[index] = prev + delta - - loop++ - if len(indices) > 0 && loop%10000 == 0 { - min := indices[0] - w.elog.Printf("WaterMark %s: Done entry %4d. Size: %4d Watermark: %-4d Looking for: %-4d. Value: %d\n", - w.Name, index, len(indices), w.DoneUntil(), min, pending[min]) - } - - // Update mark by going through all indices in order; and checking if they have - // been done. Stop at the first index, which isn't done. - doneUntil := w.DoneUntil() - if doneUntil > index { - AssertTruef(false, "Name: %s doneUntil: %d. Index: %d", w.Name, doneUntil, index) - } - - until := doneUntil - loops := 0 - - for len(indices) > 0 { - min := indices[0] - if done := pending[min]; done > 0 { - break // len(indices) will be > 0. - } - // Even if done is called multiple times causing it to become - // negative, we should still pop the index. - heap.Pop(&indices) - delete(pending, min) - until = min - loops++ - } - for i := doneUntil + 1; i <= until; i++ { - toNotify := waiters[i] - for _, ch := range toNotify { - close(ch) - } - delete(waiters, i) // Release the memory back. - } - if until != doneUntil { - AssertTrue(atomic.CompareAndSwapUint64(&w.doneUntil, doneUntil, until)) - w.elog.Printf("%s: Done until %d. Loops: %d\n", w.Name, until, loops) - } - } - - for { - select { - case <-closer.HasBeenClosed(): - return - case mark := <-w.markCh: - if mark.waiter != nil { - doneUntil := atomic.LoadUint64(&w.doneUntil) - if doneUntil >= mark.index { - close(mark.waiter) - } else { - ws, ok := waiters[mark.index] - if !ok { - waiters[mark.index] = []chan struct{}{mark.waiter} - } else { - waiters[mark.index] = append(ws, mark.waiter) - } - } - } else { - if mark.index > 0 { - processOne(mark.index, mark.done) - } - for _, index := range mark.indices { - processOne(index, mark.done) - } - } - } - } -} diff --git a/vendor/github.com/dgraph-io/badger/y/y.go b/vendor/github.com/dgraph-io/badger/y/y.go deleted file mode 100644 index 4948315a..00000000 --- a/vendor/github.com/dgraph-io/badger/y/y.go +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 2017 Dgraph Labs, Inc. and Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package y - -import ( - "bytes" - "encoding/binary" - "fmt" - "hash/crc32" - "math" - "os" - "sync" - "time" - - "github.com/pkg/errors" -) - -// ErrEOF indicates an end of file when trying to read from a memory mapped file -// and encountering the end of slice. -var ErrEOF = errors.New("End of mapped region") - -const ( - // Sync indicates that O_DSYNC should be set on the underlying file, - // ensuring that data writes do not return until the data is flushed - // to disk. - Sync = 1 << iota - // ReadOnly opens the underlying file on a read-only basis. - ReadOnly -) - -var ( - // This is O_DSYNC (datasync) on platforms that support it -- see file_unix.go - datasyncFileFlag = 0x0 - - // CastagnoliCrcTable is a CRC32 polynomial table - CastagnoliCrcTable = crc32.MakeTable(crc32.Castagnoli) - - // Dummy channel for nil closers. - dummyCloserChan = make(chan struct{}) -) - -// OpenExistingFile opens an existing file, errors if it doesn't exist. -func OpenExistingFile(filename string, flags uint32) (*os.File, error) { - openFlags := os.O_RDWR - if flags&ReadOnly != 0 { - openFlags = os.O_RDONLY - } - - if flags&Sync != 0 { - openFlags |= datasyncFileFlag - } - return os.OpenFile(filename, openFlags, 0) -} - -// CreateSyncedFile creates a new file (using O_EXCL), errors if it already existed. -func CreateSyncedFile(filename string, sync bool) (*os.File, error) { - flags := os.O_RDWR | os.O_CREATE | os.O_EXCL - if sync { - flags |= datasyncFileFlag - } - return os.OpenFile(filename, flags, 0666) -} - -// OpenSyncedFile creates the file if one doesn't exist. -func OpenSyncedFile(filename string, sync bool) (*os.File, error) { - flags := os.O_RDWR | os.O_CREATE - if sync { - flags |= datasyncFileFlag - } - return os.OpenFile(filename, flags, 0666) -} - -// OpenTruncFile opens the file with O_RDWR | O_CREATE | O_TRUNC -func OpenTruncFile(filename string, sync bool) (*os.File, error) { - flags := os.O_RDWR | os.O_CREATE | os.O_TRUNC - if sync { - flags |= datasyncFileFlag - } - return os.OpenFile(filename, flags, 0666) -} - -// SafeCopy does append(a[:0], src...). -func SafeCopy(a, src []byte) []byte { - return append(a[:0], src...) -} - -// Copy copies a byte slice and returns the copied slice. -func Copy(a []byte) []byte { - b := make([]byte, len(a)) - copy(b, a) - return b -} - -// KeyWithTs generates a new key by appending ts to key. -func KeyWithTs(key []byte, ts uint64) []byte { - out := make([]byte, len(key)+8) - copy(out, key) - binary.BigEndian.PutUint64(out[len(key):], math.MaxUint64-ts) - return out -} - -// ParseTs parses the timestamp from the key bytes. -func ParseTs(key []byte) uint64 { - if len(key) <= 8 { - return 0 - } - return math.MaxUint64 - binary.BigEndian.Uint64(key[len(key)-8:]) -} - -// CompareKeys checks the key without timestamp and checks the timestamp if keyNoTs -// is same. -// a would be sorted higher than aa if we use bytes.compare -// All keys should have timestamp. -func CompareKeys(key1, key2 []byte) int { - AssertTrue(len(key1) > 8 && len(key2) > 8) - if cmp := bytes.Compare(key1[:len(key1)-8], key2[:len(key2)-8]); cmp != 0 { - return cmp - } - return bytes.Compare(key1[len(key1)-8:], key2[len(key2)-8:]) -} - -// ParseKey parses the actual key from the key bytes. -func ParseKey(key []byte) []byte { - if key == nil { - return nil - } - - AssertTrue(len(key) > 8) - return key[:len(key)-8] -} - -// SameKey checks for key equality ignoring the version timestamp suffix. -func SameKey(src, dst []byte) bool { - if len(src) != len(dst) { - return false - } - return bytes.Equal(ParseKey(src), ParseKey(dst)) -} - -// Slice holds a reusable buf, will reallocate if you request a larger size than ever before. -// One problem is with n distinct sizes in random order it'll reallocate log(n) times. -type Slice struct { - buf []byte -} - -// Resize reuses the Slice's buffer (or makes a new one) and returns a slice in that buffer of -// length sz. -func (s *Slice) Resize(sz int) []byte { - if cap(s.buf) < sz { - s.buf = make([]byte, sz) - } - return s.buf[0:sz] -} - -// FixedDuration returns a string representation of the given duration with the -// hours, minutes, and seconds. -func FixedDuration(d time.Duration) string { - str := fmt.Sprintf("%02ds", int(d.Seconds())%60) - if d >= time.Minute { - str = fmt.Sprintf("%02dm", int(d.Minutes())%60) + str - } - if d >= time.Hour { - str = fmt.Sprintf("%02dh", int(d.Hours())) + str - } - return str -} - -// Closer holds the two things we need to close a goroutine and wait for it to finish: a chan -// to tell the goroutine to shut down, and a WaitGroup with which to wait for it to finish shutting -// down. -type Closer struct { - closed chan struct{} - waiting sync.WaitGroup -} - -// NewCloser constructs a new Closer, with an initial count on the WaitGroup. -func NewCloser(initial int) *Closer { - ret := &Closer{closed: make(chan struct{})} - ret.waiting.Add(initial) - return ret -} - -// AddRunning Add()'s delta to the WaitGroup. -func (lc *Closer) AddRunning(delta int) { - lc.waiting.Add(delta) -} - -// Signal signals the HasBeenClosed signal. -func (lc *Closer) Signal() { - close(lc.closed) -} - -// HasBeenClosed gets signaled when Signal() is called. -func (lc *Closer) HasBeenClosed() <-chan struct{} { - if lc == nil { - return dummyCloserChan - } - return lc.closed -} - -// Done calls Done() on the WaitGroup. -func (lc *Closer) Done() { - if lc == nil { - return - } - lc.waiting.Done() -} - -// Wait waits on the WaitGroup. (It waits for NewCloser's initial value, AddRunning, and Done -// calls to balance out.) -func (lc *Closer) Wait() { - lc.waiting.Wait() -} - -// SignalAndWait calls Signal(), then Wait(). -func (lc *Closer) SignalAndWait() { - lc.Signal() - lc.Wait() -} - -// Throttle allows a limited number of workers to run at a time. It also -// provides a mechanism to check for errors encountered by workers and wait for -// them to finish. -type Throttle struct { - once sync.Once - wg sync.WaitGroup - ch chan struct{} - errCh chan error - finishErr error -} - -// NewThrottle creates a new throttle with a max number of workers. -func NewThrottle(max int) *Throttle { - return &Throttle{ - ch: make(chan struct{}, max), - errCh: make(chan error, max), - } -} - -// Do should be called by workers before they start working. It blocks if there -// are already maximum number of workers working. If it detects an error from -// previously Done workers, it would return it. -func (t *Throttle) Do() error { - for { - select { - case t.ch <- struct{}{}: - t.wg.Add(1) - return nil - case err := <-t.errCh: - if err != nil { - return err - } - } - } -} - -// Done should be called by workers when they finish working. They can also -// pass the error status of work done. -func (t *Throttle) Done(err error) { - if err != nil { - t.errCh <- err - } - select { - case <-t.ch: - default: - panic("Throttle Do Done mismatch") - } - t.wg.Done() -} - -// Finish waits until all workers have finished working. It would return any error passed by Done. -// If Finish is called multiple time, it will wait for workers to finish only once(first time). -// From next calls, it will return same error as found on first call. -func (t *Throttle) Finish() error { - t.once.Do(func() { - t.wg.Wait() - close(t.ch) - close(t.errCh) - for err := range t.errCh { - if err != nil { - t.finishErr = err - return - } - } - }) - - return t.finishErr -} diff --git a/vendor/github.com/dgryski/go-farm/.gitignore b/vendor/github.com/dgryski/go-farm/.gitignore deleted file mode 100644 index 36029ab5..00000000 --- a/vendor/github.com/dgryski/go-farm/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -*.exe -*.test -*.prof - -target diff --git a/vendor/github.com/dgryski/go-farm/.travis.yml b/vendor/github.com/dgryski/go-farm/.travis.yml deleted file mode 100644 index bc89a55d..00000000 --- a/vendor/github.com/dgryski/go-farm/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: go - -sudo: false - -branches: - except: - - release - -branches: - only: - - master - - develop - - travis - -go: - - 1.11.x - - 1.12.x - - tip - -matrix: - allow_failures: - - go: tip - -before_install: - - if [ -n "$GH_USER" ]; then git config --global github.user ${GH_USER}; fi; - - if [ -n "$GH_TOKEN" ]; then git config --global github.token ${GH_TOKEN}; fi; - - go get github.com/mattn/goveralls - -before_script: - - make deps - -script: - - make qa - -after_failure: - - cat ./target/test/report.xml - -after_success: - - if [ "$TRAVIS_GO_VERSION" = "1.9" ]; then $HOME/gopath/bin/goveralls -covermode=count -coverprofile=target/report/coverage.out -service=travis-ci; fi; diff --git a/vendor/github.com/dgryski/go-farm/LICENSE b/vendor/github.com/dgryski/go-farm/LICENSE deleted file mode 100644 index 3d07f666..00000000 --- a/vendor/github.com/dgryski/go-farm/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -As this is a highly derivative work, I have placed it under the same license as the original implementation: - -Copyright (c) 2014-2017 Damian Gryski -Copyright (c) 2016-2017 Nicola Asuni - Tecnick.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/github.com/dgryski/go-farm/Makefile b/vendor/github.com/dgryski/go-farm/Makefile deleted file mode 100644 index c189c95d..00000000 --- a/vendor/github.com/dgryski/go-farm/Makefile +++ /dev/null @@ -1,203 +0,0 @@ -# MAKEFILE -# -# @author Nicola Asuni -# @link https://github.com/dgryski/go-farm -# -# This file is intended to be executed in a Linux-compatible system. -# It also assumes that the project has been cloned in the right path under GOPATH: -# $GOPATH/src/github.com/dgryski/go-farm -# -# ------------------------------------------------------------------------------ - -# List special make targets that are not associated with files -.PHONY: help all test format fmtcheck vet lint coverage cyclo ineffassign misspell structcheck varcheck errcheck gosimple astscan qa deps clean nuke - -# Use bash as shell (Note: Ubuntu now uses dash which doesn't support PIPESTATUS). -SHELL=/bin/bash - -# CVS path (path to the parent dir containing the project) -CVSPATH=github.com/dgryski - -# Project owner -OWNER=dgryski - -# Project vendor -VENDOR=dgryski - -# Project name -PROJECT=go-farm - -# Project version -VERSION=$(shell cat VERSION) - -# Name of RPM or DEB package -PKGNAME=${VENDOR}-${PROJECT} - -# Current directory -CURRENTDIR=$(shell pwd) - -# GO lang path -ifneq ($(GOPATH),) - ifeq ($(findstring $(GOPATH),$(CURRENTDIR)),) - # the defined GOPATH is not valid - GOPATH= - endif -endif -ifeq ($(GOPATH),) - # extract the GOPATH - GOPATH=$(firstword $(subst /src/, ,$(CURRENTDIR))) -endif - -# --- MAKE TARGETS --- - -# Display general help about this command -help: - @echo "" - @echo "$(PROJECT) Makefile." - @echo "GOPATH=$(GOPATH)" - @echo "The following commands are available:" - @echo "" - @echo " make qa : Run all the tests" - @echo " make test : Run the unit tests" - @echo "" - @echo " make format : Format the source code" - @echo " make fmtcheck : Check if the source code has been formatted" - @echo " make vet : Check for suspicious constructs" - @echo " make lint : Check for style errors" - @echo " make coverage : Generate the coverage report" - @echo " make cyclo : Generate the cyclomatic complexity report" - @echo " make ineffassign : Detect ineffectual assignments" - @echo " make misspell : Detect commonly misspelled words in source files" - @echo " make structcheck : Find unused struct fields" - @echo " make varcheck : Find unused global variables and constants" - @echo " make errcheck : Check that error return values are used" - @echo " make gosimple : Suggest code simplifications" - @echo " make astscan : GO AST scanner" - @echo "" - @echo " make docs : Generate source code documentation" - @echo "" - @echo " make deps : Get the dependencies" - @echo " make clean : Remove any build artifact" - @echo " make nuke : Deletes any intermediate file" - @echo "" - - -# Alias for help target -all: help - -# Run the unit tests -test: - @mkdir -p target/test - @mkdir -p target/report - GOPATH=$(GOPATH) \ - go test \ - -covermode=atomic \ - -bench=. \ - -race \ - -cpuprofile=target/report/cpu.out \ - -memprofile=target/report/mem.out \ - -mutexprofile=target/report/mutex.out \ - -coverprofile=target/report/coverage.out \ - -v ./... | \ - tee >(PATH=$(GOPATH)/bin:$(PATH) go-junit-report > target/test/report.xml); \ - test $${PIPESTATUS[0]} -eq 0 - -# Format the source code -format: - @find . -type f -name "*.go" -exec gofmt -s -w {} \; - -# Check if the source code has been formatted -fmtcheck: - @mkdir -p target - @find . -type f -name "*.go" -exec gofmt -s -d {} \; | tee target/format.diff - @test ! -s target/format.diff || { echo "ERROR: the source code has not been formatted - please use 'make format' or 'gofmt'"; exit 1; } - -# Check for syntax errors -vet: - GOPATH=$(GOPATH) go vet . - -# Check for style errors -lint: - GOPATH=$(GOPATH) PATH=$(GOPATH)/bin:$(PATH) golint . - -# Generate the coverage report -coverage: - @mkdir -p target/report - GOPATH=$(GOPATH) \ - go tool cover -html=target/report/coverage.out -o target/report/coverage.html - -# Report cyclomatic complexity -cyclo: - @mkdir -p target/report - GOPATH=$(GOPATH) gocyclo -avg ./ | tee target/report/cyclo.txt ; test $${PIPESTATUS[0]} -eq 0 - -# Detect ineffectual assignments -ineffassign: - @mkdir -p target/report - GOPATH=$(GOPATH) ineffassign ./ | tee target/report/ineffassign.txt ; test $${PIPESTATUS[0]} -eq 0 - -# Detect commonly misspelled words in source files -misspell: - @mkdir -p target/report - GOPATH=$(GOPATH) misspell -error ./ | tee target/report/misspell.txt ; test $${PIPESTATUS[0]} -eq 0 - -# Find unused struct fields -structcheck: - @mkdir -p target/report - GOPATH=$(GOPATH) structcheck -a ./ | tee target/report/structcheck.txt - -# Find unused global variables and constants -varcheck: - @mkdir -p target/report - GOPATH=$(GOPATH) varcheck -e ./ | tee target/report/varcheck.txt - -# Check that error return values are used -errcheck: - @mkdir -p target/report - GOPATH=$(GOPATH) errcheck ./ | tee target/report/errcheck.txt - -# Suggest code simplifications -gosimple: - @mkdir -p target/report - GOPATH=$(GOPATH) gosimple ./ | tee target/report/gosimple.txt - -# AST scanner -astscan: - @mkdir -p target/report - GOPATH=$(GOPATH) gas .//*.go | tee target/report/astscan.txt - -# Generate source docs -docs: - @mkdir -p target/docs - nohup sh -c 'GOPATH=$(GOPATH) godoc -http=127.0.0.1:6060' > target/godoc_server.log 2>&1 & - wget --directory-prefix=target/docs/ --execute robots=off --retry-connrefused --recursive --no-parent --adjust-extension --page-requisites --convert-links http://127.0.0.1:6060/pkg/github.com/${VENDOR}/${PROJECT}/ ; kill -9 `lsof -ti :6060` - @echo ''${PKGNAME}' Documentation ...' > target/docs/index.html - -# Alias to run all quality-assurance checks -qa: fmtcheck test vet lint coverage cyclo ineffassign misspell structcheck varcheck errcheck gosimple astscan - -# --- INSTALL --- - -# Get the dependencies -deps: - GOPATH=$(GOPATH) go get ./... - GOPATH=$(GOPATH) go get golang.org/x/lint/golint - GOPATH=$(GOPATH) go get github.com/jstemmer/go-junit-report - GOPATH=$(GOPATH) go get github.com/axw/gocov/gocov - GOPATH=$(GOPATH) go get github.com/fzipp/gocyclo - GOPATH=$(GOPATH) go get github.com/gordonklaus/ineffassign - GOPATH=$(GOPATH) go get github.com/client9/misspell/cmd/misspell - GOPATH=$(GOPATH) go get github.com/opennota/check/cmd/structcheck - GOPATH=$(GOPATH) go get github.com/opennota/check/cmd/varcheck - GOPATH=$(GOPATH) go get github.com/kisielk/errcheck - GOPATH=$(GOPATH) go get honnef.co/go/tools/cmd/gosimple - GOPATH=$(GOPATH) go get github.com/GoASTScanner/gas - -# Remove any build artifact -clean: - GOPATH=$(GOPATH) go clean ./... - -# Deletes any intermediate file -nuke: - rm -rf ./target - GOPATH=$(GOPATH) go clean -i ./... diff --git a/vendor/github.com/dgryski/go-farm/README.md b/vendor/github.com/dgryski/go-farm/README.md deleted file mode 100644 index dd07d6f9..00000000 --- a/vendor/github.com/dgryski/go-farm/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# go-farm - -*Google's FarmHash hash functions implemented in Go* - -[![Master Branch](https://img.shields.io/badge/-master:-gray.svg)](https://github.com/dgryski/go-farm/tree/master) -[![Master Build Status](https://secure.travis-ci.org/dgryski/go-farm.png?branch=master)](https://travis-ci.org/dgryski/go-farm?branch=master) -[![Master Coverage Status](https://coveralls.io/repos/dgryski/go-farm/badge.svg?branch=master&service=github)](https://coveralls.io/github/dgryski/go-farm?branch=master) -[![Go Report Card](https://goreportcard.com/badge/github.com/dgryski/go-farm)](https://goreportcard.com/report/github.com/dgryski/go-farm) -[![GoDoc](https://godoc.org/github.com/dgryski/go-farm?status.svg)](http://godoc.org/github.com/dgryski/go-farm) - -## Description - -FarmHash, a family of hash functions. - -This is a (mechanical) translation of the non-SSE4/non-AESNI hash functions from Google's FarmHash (https://github.com/google/farmhash). - - -FarmHash provides hash functions for strings and other data. -The functions mix the input bits thoroughly but are not suitable for cryptography. - -All members of the FarmHash family were designed with heavy reliance on previous work by Jyrki Alakuijala, Austin Appleby, Bob Jenkins, and others. - -For more information please consult https://github.com/google/farmhash - - -## Getting started - -This application is written in Go language, please refer to the guides in https://golang.org for getting started. - -This project include a Makefile that allows you to test and build the project with simple commands. -To see all available options: -```bash -make help -``` - -## Running all tests - -Before committing the code, please check if it passes all tests using -```bash -make qa -``` diff --git a/vendor/github.com/dgryski/go-farm/VERSION b/vendor/github.com/dgryski/go-farm/VERSION deleted file mode 100644 index 38f77a65..00000000 --- a/vendor/github.com/dgryski/go-farm/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.0.1 diff --git a/vendor/github.com/dgryski/go-farm/asm.go b/vendor/github.com/dgryski/go-farm/asm.go deleted file mode 100644 index 1d69eebb..00000000 --- a/vendor/github.com/dgryski/go-farm/asm.go +++ /dev/null @@ -1,898 +0,0 @@ -// +build ignore - -package main - -import ( - "flag" - - . "github.com/mmcloughlin/avo/build" - . "github.com/mmcloughlin/avo/operand" - . "github.com/mmcloughlin/avo/reg" -) - -const k0 uint64 = 0xc3a5c85c97cb3127 -const k1 uint64 = 0xb492b66fbe98f273 -const k2 uint64 = 0x9ae16a3b2f90404f - -const c1 uint32 = 0xcc9e2d51 -const c2 uint32 = 0x1b873593 - -func shiftMix(val GPVirtual) GPVirtual { - r := GP64() - MOVQ(val, r) - SHRQ(Imm(47), r) - XORQ(val, r) - return r -} - -func shiftMix64(val uint64) uint64 { - return val ^ (val >> 47) -} - -func hashLen16MulLine(a, b, c, d, k, mul GPVirtual) GPVirtual { - tmpa := GP64() - MOVQ(a, tmpa) - - ADDQ(b, tmpa) - RORQ(Imm(43), tmpa) - ADDQ(d, tmpa) - tmpc := GP64() - MOVQ(c, tmpc) - RORQ(Imm(30), tmpc) - ADDQ(tmpc, tmpa) - - ADDQ(c, a) - ADDQ(k, b) - RORQ(Imm(18), b) - ADDQ(b, a) - - r := hashLen16Mul(tmpa, a, mul) - return r -} - -func hashLen16Mul(u, v, mul GPVirtual) GPVirtual { - XORQ(v, u) - IMULQ(mul, u) - a := shiftMix(u) - - XORQ(a, v) - IMULQ(mul, v) - b := shiftMix(v) - - IMULQ(mul, b) - - return b -} - -func hashLen0to16(sbase, slen GPVirtual) { - CMPQ(slen, Imm(8)) - JL(LabelRef("check4")) - { - a := GP64() - MOVQ(Mem{Base: sbase}, a) - - b := GP64() - t := GP64() - MOVQ(slen, t) - SUBQ(Imm(8), t) - ADDQ(sbase, t) - MOVQ(Mem{Base: t}, b) - - rk2 := GP64() - MOVQ(Imm(k2), rk2) - - ADDQ(rk2, a) - - mul := slen - SHLQ(Imm(1), mul) - ADDQ(rk2, mul) - - c := GP64() - MOVQ(b, c) - RORQ(Imm(37), c) - IMULQ(mul, c) - ADDQ(a, c) - - d := GP64() - MOVQ(a, d) - RORQ(Imm(25), d) - ADDQ(b, d) - IMULQ(mul, d) - - r := hashLen16Mul(c, d, mul) - Store(r, ReturnIndex(0)) - RET() - } - - Label("check4") - - CMPQ(slen, Imm(4)) - JL(LabelRef("check0")) - { - rk2 := GP64() - MOVQ(Imm(k2), rk2) - - mul := GP64() - MOVQ(slen, mul) - SHLQ(Imm(1), mul) - ADDQ(rk2, mul) - - a := GP64() - MOVL(Mem{Base: sbase}, a.As32()) - - SHLQ(Imm(3), a) - ADDQ(slen, a) - - b := GP64() - SUBQ(Imm(4), slen) - ADDQ(slen, sbase) - MOVL(Mem{Base: sbase}, b.As32()) - r := hashLen16Mul(a, b, mul) - - Store(r, ReturnIndex(0)) - RET() - } - - Label("check0") - TESTQ(slen, slen) - JZ(LabelRef("empty")) - { - - a := GP64() - MOVBQZX(Mem{Base: sbase}, a) - - base := GP64() - MOVQ(slen, base) - SHRQ(Imm(1), base) - - b := GP64() - ADDQ(sbase, base) - MOVBQZX(Mem{Base: base}, b) - - MOVQ(slen, base) - SUBQ(Imm(1), base) - c := GP64() - ADDQ(sbase, base) - MOVBQZX(Mem{Base: base}, c) - - SHLQ(Imm(8), b) - ADDQ(b, a) - y := a - - SHLQ(Imm(2), c) - ADDQ(c, slen) - z := slen - - rk0 := GP64() - MOVQ(Imm(k0), rk0) - IMULQ(rk0, z) - - rk2 := GP64() - MOVQ(Imm(k2), rk2) - - IMULQ(rk2, y) - XORQ(y, z) - - r := shiftMix(z) - IMULQ(rk2, r) - - Store(r, ReturnIndex(0)) - RET() - } - - Label("empty") - - ret := GP64() - MOVQ(Imm(k2), ret) - Store(ret, ReturnIndex(0)) - RET() -} - -func hashLen17to32(sbase, slen GPVirtual) { - mul := GP64() - MOVQ(slen, mul) - SHLQ(Imm(1), mul) - - rk2 := GP64() - MOVQ(Imm(k2), rk2) - ADDQ(rk2, mul) - - a := GP64() - MOVQ(Mem{Base: sbase}, a) - - rk1 := GP64() - MOVQ(Imm(k1), rk1) - IMULQ(rk1, a) - - b := GP64() - MOVQ(Mem{Base: sbase, Disp: 8}, b) - - base := GP64() - MOVQ(slen, base) - SUBQ(Imm(16), base) - ADDQ(sbase, base) - - c := GP64() - MOVQ(Mem{Base: base, Disp: 8}, c) - IMULQ(mul, c) - - d := GP64() - MOVQ(Mem{Base: base}, d) - IMULQ(rk2, d) - - r := hashLen16MulLine(a, b, c, d, rk2, mul) - Store(r, ReturnIndex(0)) - RET() -} - -// Return an 8-byte hash for 33 to 64 bytes. -func hashLen33to64(sbase, slen GPVirtual) { - mul := GP64() - MOVQ(slen, mul) - SHLQ(Imm(1), mul) - - rk2 := GP64() - MOVQ(Imm(k2), rk2) - ADDQ(rk2, mul) - - a := GP64() - MOVQ(Mem{Base: sbase}, a) - IMULQ(rk2, a) - - b := GP64() - MOVQ(Mem{Base: sbase, Disp: 8}, b) - - base := GP64() - MOVQ(slen, base) - SUBQ(Imm(16), base) - ADDQ(sbase, base) - - c := GP64() - MOVQ(Mem{Base: base, Disp: 8}, c) - IMULQ(mul, c) - - d := GP64() - MOVQ(Mem{Base: base}, d) - IMULQ(rk2, d) - - y := GP64() - MOVQ(a, y) - - ADDQ(b, y) - RORQ(Imm(43), y) - ADDQ(d, y) - tmpc := GP64() - MOVQ(c, tmpc) - RORQ(Imm(30), tmpc) - ADDQ(tmpc, y) - - ADDQ(a, c) - ADDQ(rk2, b) - RORQ(Imm(18), b) - ADDQ(b, c) - - tmpy := GP64() - MOVQ(y, tmpy) - z := hashLen16Mul(tmpy, c, mul) - - e := GP64() - MOVQ(Mem{Base: sbase, Disp: 16}, e) - IMULQ(mul, e) - - f := GP64() - MOVQ(Mem{Base: sbase, Disp: 24}, f) - - base = GP64() - MOVQ(slen, base) - SUBQ(Imm(32), base) - ADDQ(sbase, base) - g := GP64() - MOVQ(Mem{Base: base}, g) - ADDQ(y, g) - IMULQ(mul, g) - - h := GP64() - MOVQ(Mem{Base: base, Disp: 8}, h) - ADDQ(z, h) - IMULQ(mul, h) - - r := hashLen16MulLine(e, f, g, h, a, mul) - Store(r, ReturnIndex(0)) - RET() -} - -// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. -func weakHashLen32WithSeeds(sbase GPVirtual, disp int, a, b GPVirtual) { - - w := Mem{Base: sbase, Disp: disp + 0} - x := Mem{Base: sbase, Disp: disp + 8} - y := Mem{Base: sbase, Disp: disp + 16} - z := Mem{Base: sbase, Disp: disp + 24} - - // a += w - ADDQ(w, a) - - // b = bits.RotateLeft64(b+a+z, -21) - ADDQ(a, b) - ADDQ(z, b) - RORQ(Imm(21), b) - - // c := a - c := GP64() - MOVQ(a, c) - - // a += x - // a += y - ADDQ(x, a) - ADDQ(y, a) - - // b += bits.RotateLeft64(a, -44) - atmp := GP64() - MOVQ(a, atmp) - RORQ(Imm(44), atmp) - ADDQ(atmp, b) - - // a += z - // b += c - ADDQ(z, a) - ADDQ(c, b) - - XCHGQ(a, b) -} - -func hashLoopBody(x, y, z, vlo, vhi, wlo, whi, sbase GPVirtual, mul1 GPVirtual, mul2 uint64) { - ADDQ(y, x) - ADDQ(vlo, x) - ADDQ(Mem{Base: sbase, Disp: 8}, x) - RORQ(Imm(37), x) - - IMULQ(mul1, x) - - ADDQ(vhi, y) - ADDQ(Mem{Base: sbase, Disp: 48}, y) - RORQ(Imm(42), y) - IMULQ(mul1, y) - - if mul2 != 1 { - t := GP64() - MOVQ(U32(mul2), t) - IMULQ(whi, t) - XORQ(t, x) - } else { - XORQ(whi, x) - } - - if mul2 != 1 { - t := GP64() - MOVQ(U32(mul2), t) - IMULQ(vlo, t) - ADDQ(t, y) - } else { - ADDQ(vlo, y) - } - - ADDQ(Mem{Base: sbase, Disp: 40}, y) - - ADDQ(wlo, z) - RORQ(Imm(33), z) - IMULQ(mul1, z) - - { - IMULQ(mul1, vhi) - MOVQ(x, vlo) - ADDQ(wlo, vlo) - weakHashLen32WithSeeds(sbase, 0, vhi, vlo) - } - - { - ADDQ(z, whi) - MOVQ(y, wlo) - ADDQ(Mem{Base: sbase, Disp: 16}, wlo) - weakHashLen32WithSeeds(sbase, 32, whi, wlo) - } - - XCHGQ(z, x) -} - -func fp64() { - - TEXT("Fingerprint64", NOSPLIT, "func(s []byte) uint64") - - slen := GP64() - sbase := GP64() - - Load(Param("s").Base(), sbase) - Load(Param("s").Len(), slen) - - CMPQ(slen, Imm(16)) - JG(LabelRef("check32")) - hashLen0to16(sbase, slen) - - Label("check32") - CMPQ(slen, Imm(32)) - JG(LabelRef("check64")) - hashLen17to32(sbase, slen) - - Label("check64") - CMPQ(slen, Imm(64)) - JG(LabelRef("long")) - hashLen33to64(sbase, slen) - - Label("long") - - seed := uint64(81) - - vlo, vhi, wlo, whi := GP64(), GP64(), GP64(), GP64() - XORQ(vlo, vlo) - XORQ(vhi, vhi) - XORQ(wlo, wlo) - XORQ(whi, whi) - - x := GP64() - - eightOne := uint64(81) - - MOVQ(Imm(eightOne*k2), x) - ADDQ(Mem{Base: sbase}, x) - - y := GP64() - y64 := uint64(seed*k1) + 113 - MOVQ(Imm(y64), y) - - z := GP64() - MOVQ(Imm(shiftMix64(y64*k2+113)*k2), z) - - endIdx := GP64() - MOVQ(slen, endIdx) - tmp := GP64() - SUBQ(Imm(1), endIdx) - MOVQ(U64(^uint64(63)), tmp) - ANDQ(tmp, endIdx) - last64Idx := GP64() - MOVQ(slen, last64Idx) - SUBQ(Imm(1), last64Idx) - ANDQ(Imm(63), last64Idx) - SUBQ(Imm(63), last64Idx) - ADDQ(endIdx, last64Idx) - - last64 := GP64() - MOVQ(last64Idx, last64) - ADDQ(sbase, last64) - - end := GP64() - MOVQ(slen, end) - - Label("loop") - - rk1 := GP64() - MOVQ(Imm(k1), rk1) - - hashLoopBody(x, y, z, vlo, vhi, wlo, whi, sbase, rk1, 1) - - ADDQ(Imm(64), sbase) - SUBQ(Imm(64), end) - CMPQ(end, Imm(64)) - JG(LabelRef("loop")) - - MOVQ(last64, sbase) - - mul := GP64() - MOVQ(z, mul) - ANDQ(Imm(0xff), mul) - SHLQ(Imm(1), mul) - ADDQ(rk1, mul) - - MOVQ(last64, sbase) - - SUBQ(Imm(1), slen) - ANDQ(Imm(63), slen) - ADDQ(slen, wlo) - - ADDQ(wlo, vlo) - ADDQ(vlo, wlo) - - hashLoopBody(x, y, z, vlo, vhi, wlo, whi, sbase, mul, 9) - - { - a := hashLen16Mul(vlo, wlo, mul) - ADDQ(z, a) - b := shiftMix(y) - rk0 := GP64() - MOVQ(Imm(k0), rk0) - IMULQ(rk0, b) - ADDQ(b, a) - - c := hashLen16Mul(vhi, whi, mul) - ADDQ(x, c) - - r := hashLen16Mul(a, c, mul) - Store(r, ReturnIndex(0)) - } - - RET() -} - -func fmix(h GPVirtual) GPVirtual { - h2 := GP32() - MOVL(h, h2) - SHRL(Imm(16), h2) - XORL(h2, h) - - MOVL(Imm(0x85ebca6b), h2) - IMULL(h2, h) - - MOVL(h, h2) - SHRL(Imm(13), h2) - XORL(h2, h) - - MOVL(Imm(0xc2b2ae35), h2) - IMULL(h2, h) - - MOVL(h, h2) - SHRL(Imm(16), h2) - XORL(h2, h) - return h -} - -func mur(a, h GPVirtual) GPVirtual { - imul3l(c1, a, a) - RORL(Imm(17), a) - imul3l(c2, a, a) - XORL(a, h) - RORL(Imm(19), h) - - LEAL(Mem{Base: h, Index: h, Scale: 4}, a) - LEAL(Mem{Base: a, Disp: 0xe6546b64}, h) - - return h -} - -func hash32Len5to12(sbase, slen GPVirtual) { - - a := GP32() - MOVL(slen.As32(), a) - b := GP32() - MOVL(a, b) - SHLL(Imm(2), b) - ADDL(a, b) - - c := GP32() - MOVL(U32(9), c) - - d := GP32() - MOVL(b, d) - - ADDL(Mem{Base: sbase, Disp: 0}, a) - - t := GP64() - MOVQ(slen, t) - SUBQ(Imm(4), t) - ADDQ(sbase, t) - ADDL(Mem{Base: t}, b) - - MOVQ(slen, t) - SHRQ(Imm(1), t) - ANDQ(Imm(4), t) - ADDQ(sbase, t) - ADDL(Mem{Base: t}, c) - - t = mur(a, d) - t = mur(b, t) - t = mur(c, t) - t = fmix(t) - - Store(t, ReturnIndex(0)) - RET() -} - -func hash32Len13to24Seed(sbase, slen GPVirtual) { - slen2 := GP64() - MOVQ(slen, slen2) - SHRQ(Imm(1), slen2) - ADDQ(sbase, slen2) - - a := GP32() - MOVL(Mem{Base: slen2, Disp: -4}, a) - - b := GP32() - MOVL(Mem{Base: sbase, Disp: 4}, b) - - send := GP64() - MOVQ(slen, send) - ADDQ(sbase, send) - - c := GP32() - MOVL(Mem{Base: send, Disp: -8}, c) - - d := GP32() - MOVL(Mem{Base: slen2}, d) - - e := GP32() - MOVL(Mem{Base: sbase}, e) - - f := GP32() - MOVL(Mem{Base: send, Disp: -4}, f) - - h := GP32() - MOVL(U32(c1), h) - IMULL(d, h) - ADDL(slen.As32(), h) - - RORL(Imm(12), a) - ADDL(f, a) - - ctmp := GP32() - MOVL(c, ctmp) - h = mur(ctmp, h) - ADDL(a, h) - - RORL(Imm(3), a) - ADDL(c, a) - - h = mur(e, h) - ADDL(a, h) - - ADDL(f, a) - RORL(Imm(12), a) - ADDL(d, a) - - h = mur(b, h) - ADDL(a, h) - - h = fmix(h) - - Store(h, ReturnIndex(0)) - RET() -} - -func hash32Len0to4(sbase, slen GPVirtual) { - b := GP32() - c := GP32() - - XORL(b, b) - MOVL(U32(9), c) - - TESTQ(slen, slen) - JZ(LabelRef("done")) - - l := GP64() - v := GP32() - MOVQ(slen, l) - - c1reg := GP32() - MOVL(U32(c1), c1reg) - - for i := 0; i < 4; i++ { - IMULL(c1reg, b) - MOVBLSX(Mem{Base: sbase, Disp: i}, v) - ADDL(v, b) - XORL(b, c) - SUBQ(Imm(1), l) - TESTQ(l, l) - JZ(LabelRef("done")) - } - - Label("done") - - s32 := GP32() - MOVL(slen.As32(), s32) - r := mur(s32, c) - r = mur(b, r) - r = fmix(r) - - Store(r, ReturnIndex(0)) - RET() -} - -func fp32() { - - TEXT("Fingerprint32", NOSPLIT, "func(s []byte) uint32") - - sbase := GP64() - slen := GP64() - - Load(Param("s").Base(), sbase) - Load(Param("s").Len(), slen) - - CMPQ(slen, Imm(24)) - JG(LabelRef("long")) - - CMPQ(slen, Imm(12)) - JG(LabelRef("hash_13_24")) - - CMPQ(slen, Imm(4)) - JG(LabelRef("hash_5_12")) - hash32Len0to4(sbase, slen) - - Label("hash_5_12") - hash32Len5to12(sbase, slen) - - Label("hash_13_24") - hash32Len13to24Seed(sbase, slen) - - Label("long") - - h := GP32() - MOVL(slen.As32(), h) - - g := GP32() - MOVL(U32(c1), g) - IMULL(h, g) - - f := GP32() - MOVL(g, f) - - // len > 24 - - send := GP64() - MOVQ(slen, send) - ADDQ(sbase, send) - c1reg := GP32() - MOVL(U32(c1), c1reg) - c2reg := GP32() - MOVL(U32(c2), c2reg) - - shuf := func(r GPVirtual, disp int) { - a := GP32() - MOVL(Mem{Base: send, Disp: disp}, a) - IMULL(c1reg, a) - RORL(Imm(17), a) - IMULL(c2reg, a) - XORL(a, r) - RORL(Imm(19), r) - MOVL(r, a) - SHLL(Imm(2), a) - ADDL(a, r) - ADDL(Imm(0xe6546b64), r) - } - - shuf(h, -4) - shuf(g, -8) - shuf(h, -16) - shuf(g, -12) - - PREFETCHT0(Mem{Base: sbase}) - { - a := GP32() - MOVL(Mem{Base: send, Disp: -20}, a) - IMULL(c1reg, a) - RORL(Imm(17), a) - IMULL(c2reg, a) - - ADDL(a, f) - RORL(Imm(19), f) - ADDL(Imm(113), f) - - } - - loop32Body := func(f, g, h, sbase, slen GPVirtual, disp int) { - a, b, c, d, e := GP32(), GP32(), GP32(), GP32(), GP32() - - MOVL(Mem{Base: sbase, Disp: disp + 0}, a) - ADDL(a, h) - - MOVL(Mem{Base: sbase, Disp: disp + 4}, b) - ADDL(b, g) - - MOVL(Mem{Base: sbase, Disp: disp + 8}, c) - ADDL(c, f) - - MOVL(Mem{Base: sbase, Disp: disp + 12}, d) - t := GP32() - MOVL(d, t) - h = mur(t, h) - - MOVL(Mem{Base: sbase, Disp: disp + 16}, e) - ADDL(e, h) - - MOVL(c, t) - g = mur(t, g) - ADDL(a, g) - - imul3l(c1, e, t) - ADDL(b, t) - f = mur(t, f) - ADDL(d, f) - - ADDL(g, f) - ADDL(f, g) - } - - Label("loop80") - CMPQ(slen, Imm(80+20)) - JL(LabelRef("loop20")) - { - PREFETCHT0(Mem{Base: sbase, Disp: 20}) - loop32Body(f, g, h, sbase, slen, 0) - PREFETCHT0(Mem{Base: sbase, Disp: 40}) - loop32Body(f, g, h, sbase, slen, 20) - PREFETCHT0(Mem{Base: sbase, Disp: 60}) - loop32Body(f, g, h, sbase, slen, 40) - PREFETCHT0(Mem{Base: sbase, Disp: 80}) - loop32Body(f, g, h, sbase, slen, 60) - - ADDQ(Imm(80), sbase) - SUBQ(Imm(80), slen) - JMP(LabelRef("loop80")) - } - - Label("loop20") - CMPQ(slen, Imm(20)) - JLE(LabelRef("after")) - { - loop32Body(f, g, h, sbase, slen, 0) - - ADDQ(Imm(20), sbase) - SUBQ(Imm(20), slen) - JMP(LabelRef("loop20")) - } - - Label("after") - - c1reg = GP32() - MOVL(U32(c1), c1reg) - - RORL(Imm(11), g) - IMULL(c1reg, g) - - RORL(Imm(17), g) - IMULL(c1reg, g) - - RORL(Imm(11), f) - IMULL(c1reg, f) - - RORL(Imm(17), f) - IMULL(c1reg, f) - - ADDL(g, h) - RORL(Imm(19), h) - - t := GP32() - MOVL(h, t) - SHLL(Imm(2), t) - ADDL(t, h) - ADDL(Imm(0xe6546b64), h) - - RORL(Imm(17), h) - IMULL(c1reg, h) - - ADDL(f, h) - RORL(Imm(19), h) - - t = GP32() - MOVL(h, t) - SHLL(Imm(2), t) - ADDL(t, h) - ADDL(Imm(0xe6546b64), h) - - RORL(Imm(17), h) - IMULL(c1reg, h) - - Store(h, ReturnIndex(0)) - RET() -} - -var go111 = flag.Bool("go111", true, "use assembly instructions present in go1.11 and later") - -func imul3l(m uint32, x, y Register) { - if *go111 { - IMUL3L(U32(m), x, y) - } else { - t := GP32() - MOVL(U32(m), t) - IMULL(t, x) - MOVL(x, y) - } -} - -func main() { - - flag.Parse() - - ConstraintExpr("amd64,!purego") - - fp64() - fp32() - - Generate() -} diff --git a/vendor/github.com/dgryski/go-farm/basics.go b/vendor/github.com/dgryski/go-farm/basics.go deleted file mode 100644 index ec7076c0..00000000 --- a/vendor/github.com/dgryski/go-farm/basics.go +++ /dev/null @@ -1,32 +0,0 @@ -package farm - -import "math/bits" - -// Some primes between 2^63 and 2^64 for various uses. -const k0 uint64 = 0xc3a5c85c97cb3127 -const k1 uint64 = 0xb492b66fbe98f273 -const k2 uint64 = 0x9ae16a3b2f90404f - -// Magic numbers for 32-bit hashing. Copied from Murmur3. -const c1 uint32 = 0xcc9e2d51 -const c2 uint32 = 0x1b873593 - -// A 32-bit to 32-bit integer hash copied from Murmur3. -func fmix(h uint32) uint32 { - h ^= h >> 16 - h *= 0x85ebca6b - h ^= h >> 13 - h *= 0xc2b2ae35 - h ^= h >> 16 - return h -} - -func mur(a, h uint32) uint32 { - // Helper from Murmur3 for combining two 32-bit values. - a *= c1 - a = bits.RotateLeft32(a, -17) - a *= c2 - h ^= a - h = bits.RotateLeft32(h, -19) - return h*5 + 0xe6546b64 -} diff --git a/vendor/github.com/dgryski/go-farm/farmhashcc.go b/vendor/github.com/dgryski/go-farm/farmhashcc.go deleted file mode 100644 index 3e68ae3a..00000000 --- a/vendor/github.com/dgryski/go-farm/farmhashcc.go +++ /dev/null @@ -1,194 +0,0 @@ -package farm - -import ( - "encoding/binary" - "math/bits" -) - -// This file provides a 32-bit hash equivalent to CityHash32 (v1.1.1) -// and a 128-bit hash equivalent to CityHash128 (v1.1.1). It also provides -// a seeded 32-bit hash function similar to CityHash32. - -func hash32Len13to24Seed(s []byte, seed uint32) uint32 { - slen := len(s) - a := binary.LittleEndian.Uint32(s[-4+(slen>>1) : -4+(slen>>1)+4]) - b := binary.LittleEndian.Uint32(s[4 : 4+4]) - c := binary.LittleEndian.Uint32(s[slen-8 : slen-8+4]) - d := binary.LittleEndian.Uint32(s[(slen >> 1) : (slen>>1)+4]) - e := binary.LittleEndian.Uint32(s[0 : 0+4]) - f := binary.LittleEndian.Uint32(s[slen-4 : slen-4+4]) - h := d*c1 + uint32(slen) + seed - a = bits.RotateLeft32(a, -12) + f - h = mur(c, h) + a - a = bits.RotateLeft32(a, -3) + c - h = mur(e, h) + a - a = bits.RotateLeft32(a+f, -12) + d - h = mur(b^seed, h) + a - return fmix(h) -} - -func hash32Len0to4(s []byte, seed uint32) uint32 { - slen := len(s) - b := seed - c := uint32(9) - for i := 0; i < slen; i++ { - v := int8(s[i]) - b = (b * c1) + uint32(v) - c ^= b - } - return fmix(mur(b, mur(uint32(slen), c))) -} - -func hash128to64(x uint128) uint64 { - // Murmur-inspired hashing. - const mul uint64 = 0x9ddfea08eb382d69 - a := (x.lo ^ x.hi) * mul - a ^= (a >> 47) - b := (x.hi ^ a) * mul - b ^= (b >> 47) - b *= mul - return b -} - -type uint128 struct { - lo uint64 - hi uint64 -} - -// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings -// of any length representable in signed long. Based on City and Murmur. -func cityMurmur(s []byte, seed uint128) uint128 { - slen := len(s) - a := seed.lo - b := seed.hi - var c uint64 - var d uint64 - l := slen - 16 - if l <= 0 { // len <= 16 - a = shiftMix(a*k1) * k1 - c = b*k1 + hashLen0to16(s) - if slen >= 8 { - d = shiftMix(a + binary.LittleEndian.Uint64(s[0:0+8])) - } else { - d = shiftMix(a + c) - } - } else { // len > 16 - c = hashLen16(binary.LittleEndian.Uint64(s[slen-8:slen-8+8])+k1, a) - d = hashLen16(b+uint64(slen), c+binary.LittleEndian.Uint64(s[slen-16:slen-16+8])) - a += d - for { - a ^= shiftMix(binary.LittleEndian.Uint64(s[0:0+8])*k1) * k1 - a *= k1 - b ^= a - c ^= shiftMix(binary.LittleEndian.Uint64(s[8:8+8])*k1) * k1 - c *= k1 - d ^= c - s = s[16:] - l -= 16 - if l <= 0 { - break - } - } - } - a = hashLen16(a, c) - b = hashLen16(d, b) - return uint128{a ^ b, hashLen16(b, a)} -} - -func cityHash128WithSeed(s []byte, seed uint128) uint128 { - slen := len(s) - if slen < 128 { - return cityMurmur(s, seed) - } - - endIdx := ((slen - 1) / 128) * 128 - lastBlockIdx := endIdx + ((slen - 1) & 127) - 127 - last := s[lastBlockIdx:] - - // We expect len >= 128 to be the common case. Keep 56 bytes of state: - // v, w, x, y, and z. - var v1, v2 uint64 - var w1, w2 uint64 - x := seed.lo - y := seed.hi - z := uint64(slen) * k1 - v1 = bits.RotateLeft64(y^k1, -49)*k1 + binary.LittleEndian.Uint64(s[0:0+8]) - v2 = bits.RotateLeft64(v1, -42)*k1 + binary.LittleEndian.Uint64(s[8:8+8]) - w1 = bits.RotateLeft64(y+z, -35)*k1 + x - w2 = bits.RotateLeft64(x+binary.LittleEndian.Uint64(s[88:88+8]), -53) * k1 - - // This is the same inner loop as CityHash64(), manually unrolled. - for { - x = bits.RotateLeft64(x+y+v1+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1 - y = bits.RotateLeft64(y+v2+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1 - x ^= w2 - y += v1 + binary.LittleEndian.Uint64(s[40:40+8]) - z = bits.RotateLeft64(z+w1, -33) * k1 - v1, v2 = weakHashLen32WithSeeds(s, v2*k1, x+w1) - w1, w2 = weakHashLen32WithSeeds(s[32:], z+w2, y+binary.LittleEndian.Uint64(s[16:16+8])) - z, x = x, z - s = s[64:] - x = bits.RotateLeft64(x+y+v1+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1 - y = bits.RotateLeft64(y+v2+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1 - x ^= w2 - y += v1 + binary.LittleEndian.Uint64(s[40:40+8]) - z = bits.RotateLeft64(z+w1, -33) * k1 - v1, v2 = weakHashLen32WithSeeds(s, v2*k1, x+w1) - w1, w2 = weakHashLen32WithSeeds(s[32:], z+w2, y+binary.LittleEndian.Uint64(s[16:16+8])) - z, x = x, z - s = s[64:] - slen -= 128 - if slen < 128 { - break - } - } - x += bits.RotateLeft64(v1+z, -49) * k0 - y = y*k0 + bits.RotateLeft64(w2, -37) - z = z*k0 + bits.RotateLeft64(w1, -27) - w1 *= 9 - v1 *= k0 - // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s. - for tailDone := 0; tailDone < slen; { - tailDone += 32 - y = bits.RotateLeft64(x+y, -42)*k0 + v2 - w1 += binary.LittleEndian.Uint64(last[128-tailDone+16 : 128-tailDone+16+8]) - x = x*k0 + w1 - z += w2 + binary.LittleEndian.Uint64(last[128-tailDone:128-tailDone+8]) - w2 += v1 - v1, v2 = weakHashLen32WithSeeds(last[128-tailDone:], v1+z, v2) - v1 *= k0 - } - - // At this point our 56 bytes of state should contain more than - // enough information for a strong 128-bit hash. We use two - // different 56-byte-to-8-byte hashes to get a 16-byte final result. - x = hashLen16(x, v1) - y = hashLen16(y+z, w1) - return uint128{hashLen16(x+v2, w2) + y, - hashLen16(x+w2, y+v2)} -} - -func cityHash128(s []byte) uint128 { - slen := len(s) - if slen >= 16 { - return cityHash128WithSeed(s[16:], uint128{binary.LittleEndian.Uint64(s[0 : 0+8]), binary.LittleEndian.Uint64(s[8:8+8]) + k0}) - } - return cityHash128WithSeed(s, uint128{k0, k1}) -} - -// Fingerprint128 is a 128-bit fingerprint function for byte-slices -func Fingerprint128(s []byte) (lo, hi uint64) { - h := cityHash128(s) - return h.lo, h.hi -} - -// Hash128 is a 128-bit hash function for byte-slices -func Hash128(s []byte) (lo, hi uint64) { - return Fingerprint128(s) -} - -// Hash128WithSeed is a 128-bit hash function for byte-slices and a 128-bit seed -func Hash128WithSeed(s []byte, seed0, seed1 uint64) (lo, hi uint64) { - h := cityHash128WithSeed(s, uint128{seed0, seed1}) - return h.lo, h.hi -} diff --git a/vendor/github.com/dgryski/go-farm/farmhashmk.go b/vendor/github.com/dgryski/go-farm/farmhashmk.go deleted file mode 100644 index 8e4c7428..00000000 --- a/vendor/github.com/dgryski/go-farm/farmhashmk.go +++ /dev/null @@ -1,102 +0,0 @@ -package farm - -import ( - "encoding/binary" - "math/bits" -) - -func hash32Len5to12(s []byte, seed uint32) uint32 { - slen := len(s) - a := uint32(len(s)) - b := uint32(len(s) * 5) - c := uint32(9) - d := b + seed - a += binary.LittleEndian.Uint32(s[0 : 0+4]) - b += binary.LittleEndian.Uint32(s[slen-4 : slen-4+4]) - c += binary.LittleEndian.Uint32(s[((slen >> 1) & 4) : ((slen>>1)&4)+4]) - return fmix(seed ^ mur(c, mur(b, mur(a, d)))) -} - -// Hash32 hashes a byte slice and returns a uint32 hash value -func Hash32(s []byte) uint32 { - - slen := len(s) - - if slen <= 24 { - if slen <= 12 { - if slen <= 4 { - return hash32Len0to4(s, 0) - } - return hash32Len5to12(s, 0) - } - return hash32Len13to24Seed(s, 0) - } - - // len > 24 - h := uint32(slen) - g := c1 * uint32(slen) - f := g - a0 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-4:slen-4+4])*c1, -17) * c2 - a1 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-8:slen-8+4])*c1, -17) * c2 - a2 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-16:slen-16+4])*c1, -17) * c2 - a3 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-12:slen-12+4])*c1, -17) * c2 - a4 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-20:slen-20+4])*c1, -17) * c2 - h ^= a0 - h = bits.RotateLeft32(h, -19) - h = h*5 + 0xe6546b64 - h ^= a2 - h = bits.RotateLeft32(h, -19) - h = h*5 + 0xe6546b64 - g ^= a1 - g = bits.RotateLeft32(g, -19) - g = g*5 + 0xe6546b64 - g ^= a3 - g = bits.RotateLeft32(g, -19) - g = g*5 + 0xe6546b64 - f += a4 - f = bits.RotateLeft32(f, -19) + 113 - for len(s) > 20 { - a := binary.LittleEndian.Uint32(s[0 : 0+4]) - b := binary.LittleEndian.Uint32(s[4 : 4+4]) - c := binary.LittleEndian.Uint32(s[8 : 8+4]) - d := binary.LittleEndian.Uint32(s[12 : 12+4]) - e := binary.LittleEndian.Uint32(s[16 : 16+4]) - h += a - g += b - f += c - h = mur(d, h) + e - g = mur(c, g) + a - f = mur(b+e*c1, f) + d - f += g - g += f - s = s[20:] - } - g = bits.RotateLeft32(g, -11) * c1 - g = bits.RotateLeft32(g, -17) * c1 - f = bits.RotateLeft32(f, -11) * c1 - f = bits.RotateLeft32(f, -17) * c1 - h = bits.RotateLeft32(h+g, -19) - h = h*5 + 0xe6546b64 - h = bits.RotateLeft32(h, -17) * c1 - h = bits.RotateLeft32(h+f, -19) - h = h*5 + 0xe6546b64 - h = bits.RotateLeft32(h, -17) * c1 - return h -} - -// Hash32WithSeed hashes a byte slice and a uint32 seed and returns a uint32 hash value -func Hash32WithSeed(s []byte, seed uint32) uint32 { - slen := len(s) - - if slen <= 24 { - if slen >= 13 { - return hash32Len13to24Seed(s, seed*c1) - } - if slen >= 5 { - return hash32Len5to12(s, seed) - } - return hash32Len0to4(s, seed) - } - h := hash32Len13to24Seed(s[:24], seed^uint32(slen)) - return mur(Hash32(s[24:])+seed, h) -} diff --git a/vendor/github.com/dgryski/go-farm/farmhashna.go b/vendor/github.com/dgryski/go-farm/farmhashna.go deleted file mode 100644 index ac62edd3..00000000 --- a/vendor/github.com/dgryski/go-farm/farmhashna.go +++ /dev/null @@ -1,161 +0,0 @@ -package farm - -import ( - "encoding/binary" - "math/bits" -) - -func shiftMix(val uint64) uint64 { - return val ^ (val >> 47) -} - -func hashLen16(u, v uint64) uint64 { - return hash128to64(uint128{u, v}) -} - -func hashLen16Mul(u, v, mul uint64) uint64 { - // Murmur-inspired hashing. - a := (u ^ v) * mul - a ^= (a >> 47) - b := (v ^ a) * mul - b ^= (b >> 47) - b *= mul - return b -} - -func hashLen0to16(s []byte) uint64 { - slen := uint64(len(s)) - if slen >= 8 { - mul := k2 + slen*2 - a := binary.LittleEndian.Uint64(s[0:0+8]) + k2 - b := binary.LittleEndian.Uint64(s[int(slen-8) : int(slen-8)+8]) - c := bits.RotateLeft64(b, -37)*mul + a - d := (bits.RotateLeft64(a, -25) + b) * mul - return hashLen16Mul(c, d, mul) - } - - if slen >= 4 { - mul := k2 + slen*2 - a := binary.LittleEndian.Uint32(s[0 : 0+4]) - return hashLen16Mul(slen+(uint64(a)<<3), uint64(binary.LittleEndian.Uint32(s[int(slen-4):int(slen-4)+4])), mul) - } - if slen > 0 { - a := s[0] - b := s[slen>>1] - c := s[slen-1] - y := uint32(a) + (uint32(b) << 8) - z := uint32(slen) + (uint32(c) << 2) - return shiftMix(uint64(y)*k2^uint64(z)*k0) * k2 - } - return k2 -} - -// This probably works well for 16-byte strings as well, but it may be overkill -// in that case. -func hashLen17to32(s []byte) uint64 { - slen := len(s) - mul := k2 + uint64(slen*2) - a := binary.LittleEndian.Uint64(s[0:0+8]) * k1 - b := binary.LittleEndian.Uint64(s[8 : 8+8]) - c := binary.LittleEndian.Uint64(s[slen-8:slen-8+8]) * mul - d := binary.LittleEndian.Uint64(s[slen-16:slen-16+8]) * k2 - return hashLen16Mul(bits.RotateLeft64(a+b, -43)+bits.RotateLeft64(c, -30)+d, a+bits.RotateLeft64(b+k2, -18)+c, mul) -} - -// Return a 16-byte hash for 48 bytes. Quick and dirty. -// Callers do best to use "random-looking" values for a and b. -func weakHashLen32WithSeedsWords(w, x, y, z, a, b uint64) (uint64, uint64) { - a += w - b = bits.RotateLeft64(b+a+z, -21) - c := a - a += x - a += y - b += bits.RotateLeft64(a, -44) - return a + z, b + c -} - -// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. -func weakHashLen32WithSeeds(s []byte, a, b uint64) (uint64, uint64) { - return weakHashLen32WithSeedsWords(binary.LittleEndian.Uint64(s[0:0+8]), - binary.LittleEndian.Uint64(s[8:8+8]), - binary.LittleEndian.Uint64(s[16:16+8]), - binary.LittleEndian.Uint64(s[24:24+8]), - a, - b) -} - -// Return an 8-byte hash for 33 to 64 bytes. -func hashLen33to64(s []byte) uint64 { - slen := len(s) - mul := k2 + uint64(slen)*2 - a := binary.LittleEndian.Uint64(s[0:0+8]) * k2 - b := binary.LittleEndian.Uint64(s[8 : 8+8]) - c := binary.LittleEndian.Uint64(s[slen-8:slen-8+8]) * mul - d := binary.LittleEndian.Uint64(s[slen-16:slen-16+8]) * k2 - y := bits.RotateLeft64(a+b, -43) + bits.RotateLeft64(c, -30) + d - z := hashLen16Mul(y, a+bits.RotateLeft64(b+k2, -18)+c, mul) - e := binary.LittleEndian.Uint64(s[16:16+8]) * mul - f := binary.LittleEndian.Uint64(s[24 : 24+8]) - g := (y + binary.LittleEndian.Uint64(s[slen-32:slen-32+8])) * mul - h := (z + binary.LittleEndian.Uint64(s[slen-24:slen-24+8])) * mul - return hashLen16Mul(bits.RotateLeft64(e+f, -43)+bits.RotateLeft64(g, -30)+h, e+bits.RotateLeft64(f+a, -18)+g, mul) -} - -func naHash64(s []byte) uint64 { - slen := len(s) - var seed uint64 = 81 - if slen <= 32 { - if slen <= 16 { - return hashLen0to16(s) - } - return hashLen17to32(s) - } - if slen <= 64 { - return hashLen33to64(s) - } - // For strings over 64 bytes we loop. - // Internal state consists of 56 bytes: v, w, x, y, and z. - v := uint128{0, 0} - w := uint128{0, 0} - x := seed*k2 + binary.LittleEndian.Uint64(s[0:0+8]) - y := seed*k1 + 113 - z := shiftMix(y*k2+113) * k2 - // Set end so that after the loop we have 1 to 64 bytes left to process. - endIdx := ((slen - 1) / 64) * 64 - last64Idx := endIdx + ((slen - 1) & 63) - 63 - last64 := s[last64Idx:] - for len(s) > 64 { - x = bits.RotateLeft64(x+y+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1 - y = bits.RotateLeft64(y+v.hi+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1 - x ^= w.hi - y += v.lo + binary.LittleEndian.Uint64(s[40:40+8]) - z = bits.RotateLeft64(z+w.lo, -33) * k1 - v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*k1, x+w.lo) - w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8])) - x, z = z, x - s = s[64:] - } - mul := k1 + ((z & 0xff) << 1) - // Make s point to the last 64 bytes of input. - s = last64 - w.lo += (uint64(slen-1) & 63) - v.lo += w.lo - w.lo += v.lo - x = bits.RotateLeft64(x+y+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * mul - y = bits.RotateLeft64(y+v.hi+binary.LittleEndian.Uint64(s[48:48+8]), -42) * mul - x ^= w.hi * 9 - y += v.lo*9 + binary.LittleEndian.Uint64(s[40:40+8]) - z = bits.RotateLeft64(z+w.lo, -33) * mul - v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*mul, x+w.lo) - w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8])) - x, z = z, x - return hashLen16Mul(hashLen16Mul(v.lo, w.lo, mul)+shiftMix(y)*k0+z, hashLen16Mul(v.hi, w.hi, mul)+x, mul) -} - -func naHash64WithSeed(s []byte, seed uint64) uint64 { - return naHash64WithSeeds(s, k2, seed) -} - -func naHash64WithSeeds(s []byte, seed0, seed1 uint64) uint64 { - return hashLen16(naHash64(s)-seed0, seed1) -} diff --git a/vendor/github.com/dgryski/go-farm/farmhashuo.go b/vendor/github.com/dgryski/go-farm/farmhashuo.go deleted file mode 100644 index 474b74e0..00000000 --- a/vendor/github.com/dgryski/go-farm/farmhashuo.go +++ /dev/null @@ -1,122 +0,0 @@ -package farm - -import ( - "encoding/binary" - "math/bits" -) - -func uoH(x, y, mul uint64, r uint) uint64 { - a := (x ^ y) * mul - a ^= (a >> 47) - b := (y ^ a) * mul - return bits.RotateLeft64(b, -int(r)) * mul -} - -// Hash64WithSeeds hashes a byte slice and two uint64 seeds and returns a uint64 hash value -func Hash64WithSeeds(s []byte, seed0, seed1 uint64) uint64 { - slen := len(s) - if slen <= 64 { - return naHash64WithSeeds(s, seed0, seed1) - } - - // For strings over 64 bytes we loop. - // Internal state consists of 64 bytes: u, v, w, x, y, and z. - x := seed0 - y := seed1*k2 + 113 - z := shiftMix(y*k2) * k2 - v := uint128{seed0, seed1} - var w uint128 - u := x - z - x *= k2 - mul := k2 + (u & 0x82) - - // Set end so that after the loop we have 1 to 64 bytes left to process. - endIdx := ((slen - 1) / 64) * 64 - last64Idx := endIdx + ((slen - 1) & 63) - 63 - last64 := s[last64Idx:] - - for len(s) > 64 { - a0 := binary.LittleEndian.Uint64(s[0 : 0+8]) - a1 := binary.LittleEndian.Uint64(s[8 : 8+8]) - a2 := binary.LittleEndian.Uint64(s[16 : 16+8]) - a3 := binary.LittleEndian.Uint64(s[24 : 24+8]) - a4 := binary.LittleEndian.Uint64(s[32 : 32+8]) - a5 := binary.LittleEndian.Uint64(s[40 : 40+8]) - a6 := binary.LittleEndian.Uint64(s[48 : 48+8]) - a7 := binary.LittleEndian.Uint64(s[56 : 56+8]) - x += a0 + a1 - y += a2 - z += a3 - v.lo += a4 - v.hi += a5 + a1 - w.lo += a6 - w.hi += a7 - - x = bits.RotateLeft64(x, -26) - x *= 9 - y = bits.RotateLeft64(y, -29) - z *= mul - v.lo = bits.RotateLeft64(v.lo, -33) - v.hi = bits.RotateLeft64(v.hi, -30) - w.lo ^= x - w.lo *= 9 - z = bits.RotateLeft64(z, -32) - z += w.hi - w.hi += z - z *= 9 - u, y = y, u - - z += a0 + a6 - v.lo += a2 - v.hi += a3 - w.lo += a4 - w.hi += a5 + a6 - x += a1 - y += a7 - - y += v.lo - v.lo += x - y - v.hi += w.lo - w.lo += v.hi - w.hi += x - y - x += w.hi - w.hi = bits.RotateLeft64(w.hi, -34) - u, z = z, u - s = s[64:] - } - // Make s point to the last 64 bytes of input. - s = last64 - u *= 9 - v.hi = bits.RotateLeft64(v.hi, -28) - v.lo = bits.RotateLeft64(v.lo, -20) - w.lo += (uint64(slen-1) & 63) - u += y - y += u - x = bits.RotateLeft64(y-x+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * mul - y = bits.RotateLeft64(y^v.hi^binary.LittleEndian.Uint64(s[48:48+8]), -42) * mul - x ^= w.hi * 9 - y += v.lo + binary.LittleEndian.Uint64(s[40:40+8]) - z = bits.RotateLeft64(z+w.lo, -33) * mul - v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*mul, x+w.lo) - w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8])) - return uoH(hashLen16Mul(v.lo+x, w.lo^y, mul)+z-u, - uoH(v.hi+y, w.hi+z, k2, 30)^x, - k2, - 31) -} - -// Hash64WithSeed hashes a byte slice and a uint64 seed and returns a uint64 hash value -func Hash64WithSeed(s []byte, seed uint64) uint64 { - if len(s) <= 64 { - return naHash64WithSeed(s, seed) - } - return Hash64WithSeeds(s, 0, seed) -} - -// Hash64 hashes a byte slice and returns a uint64 hash value -func Hash64(s []byte) uint64 { - if len(s) <= 64 { - return naHash64(s) - } - return Hash64WithSeeds(s, 81, 0) -} diff --git a/vendor/github.com/dgryski/go-farm/fp_amd64.s b/vendor/github.com/dgryski/go-farm/fp_amd64.s deleted file mode 100644 index 2b8fa324..00000000 --- a/vendor/github.com/dgryski/go-farm/fp_amd64.s +++ /dev/null @@ -1,951 +0,0 @@ -// Code generated by command: go run asm.go -out=fp_amd64.s -go111=false. DO NOT EDIT. - -// +build amd64,!purego - -#include "textflag.h" - -// func Fingerprint64(s []byte) uint64 -TEXT ·Fingerprint64(SB), NOSPLIT, $0-32 - MOVQ s_base+0(FP), CX - MOVQ s_len+8(FP), AX - CMPQ AX, $0x10 - JG check32 - CMPQ AX, $0x08 - JL check4 - MOVQ (CX), DX - MOVQ AX, BX - SUBQ $0x08, BX - ADDQ CX, BX - MOVQ (BX), BX - MOVQ $0x9ae16a3b2f90404f, BP - ADDQ BP, DX - SHLQ $0x01, AX - ADDQ BP, AX - MOVQ BX, BP - RORQ $0x25, BP - IMULQ AX, BP - ADDQ DX, BP - RORQ $0x19, DX - ADDQ BX, DX - IMULQ AX, DX - XORQ DX, BP - IMULQ AX, BP - MOVQ BP, BX - SHRQ $0x2f, BX - XORQ BP, BX - XORQ BX, DX - IMULQ AX, DX - MOVQ DX, BX - SHRQ $0x2f, BX - XORQ DX, BX - IMULQ AX, BX - MOVQ BX, ret+24(FP) - RET - -check4: - CMPQ AX, $0x04 - JL check0 - MOVQ $0x9ae16a3b2f90404f, DX - MOVQ AX, BX - SHLQ $0x01, BX - ADDQ DX, BX - MOVL (CX), SI - SHLQ $0x03, SI - ADDQ AX, SI - SUBQ $0x04, AX - ADDQ AX, CX - MOVL (CX), DI - XORQ DI, SI - IMULQ BX, SI - MOVQ SI, DX - SHRQ $0x2f, DX - XORQ SI, DX - XORQ DX, DI - IMULQ BX, DI - MOVQ DI, DX - SHRQ $0x2f, DX - XORQ DI, DX - IMULQ BX, DX - MOVQ DX, ret+24(FP) - RET - -check0: - TESTQ AX, AX - JZ empty - MOVBQZX (CX), DX - MOVQ AX, BX - SHRQ $0x01, BX - ADDQ CX, BX - MOVBQZX (BX), BP - MOVQ AX, BX - SUBQ $0x01, BX - ADDQ CX, BX - MOVBQZX (BX), BX - SHLQ $0x08, BP - ADDQ BP, DX - SHLQ $0x02, BX - ADDQ BX, AX - MOVQ $0xc3a5c85c97cb3127, BX - IMULQ BX, AX - MOVQ $0x9ae16a3b2f90404f, BX - IMULQ BX, DX - XORQ DX, AX - MOVQ AX, DX - SHRQ $0x2f, DX - XORQ AX, DX - IMULQ BX, DX - MOVQ DX, ret+24(FP) - RET - -empty: - MOVQ $0x9ae16a3b2f90404f, DX - MOVQ DX, ret+24(FP) - RET - -check32: - CMPQ AX, $0x20 - JG check64 - MOVQ AX, DX - SHLQ $0x01, DX - MOVQ $0x9ae16a3b2f90404f, BX - ADDQ BX, DX - MOVQ (CX), BP - MOVQ $0xb492b66fbe98f273, SI - IMULQ SI, BP - MOVQ 8(CX), SI - MOVQ AX, DI - SUBQ $0x10, DI - ADDQ CX, DI - MOVQ 8(DI), R12 - IMULQ DX, R12 - MOVQ (DI), DI - IMULQ BX, DI - MOVQ BP, R13 - ADDQ SI, R13 - RORQ $0x2b, R13 - ADDQ DI, R13 - MOVQ R12, DI - RORQ $0x1e, DI - ADDQ DI, R13 - ADDQ R12, BP - ADDQ BX, SI - RORQ $0x12, SI - ADDQ SI, BP - XORQ BP, R13 - IMULQ DX, R13 - MOVQ R13, BX - SHRQ $0x2f, BX - XORQ R13, BX - XORQ BX, BP - IMULQ DX, BP - MOVQ BP, BX - SHRQ $0x2f, BX - XORQ BP, BX - IMULQ DX, BX - MOVQ BX, ret+24(FP) - RET - -check64: - CMPQ AX, $0x40 - JG long - MOVQ AX, DX - SHLQ $0x01, DX - MOVQ $0x9ae16a3b2f90404f, BX - ADDQ BX, DX - MOVQ (CX), BP - IMULQ BX, BP - MOVQ 8(CX), SI - MOVQ AX, DI - SUBQ $0x10, DI - ADDQ CX, DI - MOVQ 8(DI), R12 - IMULQ DX, R12 - MOVQ (DI), DI - IMULQ BX, DI - MOVQ BP, R13 - ADDQ SI, R13 - RORQ $0x2b, R13 - ADDQ DI, R13 - MOVQ R12, DI - RORQ $0x1e, DI - ADDQ DI, R13 - ADDQ BP, R12 - ADDQ BX, SI - RORQ $0x12, SI - ADDQ SI, R12 - MOVQ R13, BX - XORQ R12, BX - IMULQ DX, BX - MOVQ BX, SI - SHRQ $0x2f, SI - XORQ BX, SI - XORQ SI, R12 - IMULQ DX, R12 - MOVQ R12, BX - SHRQ $0x2f, BX - XORQ R12, BX - IMULQ DX, BX - MOVQ 16(CX), SI - IMULQ DX, SI - MOVQ 24(CX), DI - MOVQ AX, R12 - SUBQ $0x20, R12 - ADDQ CX, R12 - MOVQ (R12), R14 - ADDQ R13, R14 - IMULQ DX, R14 - MOVQ 8(R12), R12 - ADDQ BX, R12 - IMULQ DX, R12 - MOVQ SI, BX - ADDQ DI, BX - RORQ $0x2b, BX - ADDQ R12, BX - MOVQ R14, R12 - RORQ $0x1e, R12 - ADDQ R12, BX - ADDQ R14, SI - ADDQ BP, DI - RORQ $0x12, DI - ADDQ DI, SI - XORQ SI, BX - IMULQ DX, BX - MOVQ BX, BP - SHRQ $0x2f, BP - XORQ BX, BP - XORQ BP, SI - IMULQ DX, SI - MOVQ SI, BX - SHRQ $0x2f, BX - XORQ SI, BX - IMULQ DX, BX - MOVQ BX, ret+24(FP) - RET - -long: - XORQ R8, R8 - XORQ R9, R9 - XORQ R10, R10 - XORQ R11, R11 - MOVQ $0x01529cba0ca458ff, DX - ADDQ (CX), DX - MOVQ $0x226bb95b4e64b6d4, BX - MOVQ $0x134a747f856d0526, BP - MOVQ AX, SI - SUBQ $0x01, SI - MOVQ $0xffffffffffffffc0, DI - ANDQ DI, SI - MOVQ AX, DI - SUBQ $0x01, DI - ANDQ $0x3f, DI - SUBQ $0x3f, DI - ADDQ SI, DI - MOVQ DI, SI - ADDQ CX, SI - MOVQ AX, DI - -loop: - MOVQ $0xb492b66fbe98f273, R12 - ADDQ BX, DX - ADDQ R8, DX - ADDQ 8(CX), DX - RORQ $0x25, DX - IMULQ R12, DX - ADDQ R9, BX - ADDQ 48(CX), BX - RORQ $0x2a, BX - IMULQ R12, BX - XORQ R11, DX - ADDQ R8, BX - ADDQ 40(CX), BX - ADDQ R10, BP - RORQ $0x21, BP - IMULQ R12, BP - IMULQ R12, R9 - MOVQ DX, R8 - ADDQ R10, R8 - ADDQ (CX), R9 - ADDQ R9, R8 - ADDQ 24(CX), R8 - RORQ $0x15, R8 - MOVQ R9, R10 - ADDQ 8(CX), R9 - ADDQ 16(CX), R9 - MOVQ R9, R13 - RORQ $0x2c, R13 - ADDQ R13, R8 - ADDQ 24(CX), R9 - ADDQ R10, R8 - XCHGQ R9, R8 - ADDQ BP, R11 - MOVQ BX, R10 - ADDQ 16(CX), R10 - ADDQ 32(CX), R11 - ADDQ R11, R10 - ADDQ 56(CX), R10 - RORQ $0x15, R10 - MOVQ R11, R13 - ADDQ 40(CX), R11 - ADDQ 48(CX), R11 - MOVQ R11, R14 - RORQ $0x2c, R14 - ADDQ R14, R10 - ADDQ 56(CX), R11 - ADDQ R13, R10 - XCHGQ R11, R10 - XCHGQ BP, DX - ADDQ $0x40, CX - SUBQ $0x40, DI - CMPQ DI, $0x40 - JG loop - MOVQ SI, CX - MOVQ BP, DI - ANDQ $0xff, DI - SHLQ $0x01, DI - ADDQ R12, DI - MOVQ SI, CX - SUBQ $0x01, AX - ANDQ $0x3f, AX - ADDQ AX, R10 - ADDQ R10, R8 - ADDQ R8, R10 - ADDQ BX, DX - ADDQ R8, DX - ADDQ 8(CX), DX - RORQ $0x25, DX - IMULQ DI, DX - ADDQ R9, BX - ADDQ 48(CX), BX - RORQ $0x2a, BX - IMULQ DI, BX - MOVQ $0x00000009, AX - IMULQ R11, AX - XORQ AX, DX - MOVQ $0x00000009, AX - IMULQ R8, AX - ADDQ AX, BX - ADDQ 40(CX), BX - ADDQ R10, BP - RORQ $0x21, BP - IMULQ DI, BP - IMULQ DI, R9 - MOVQ DX, R8 - ADDQ R10, R8 - ADDQ (CX), R9 - ADDQ R9, R8 - ADDQ 24(CX), R8 - RORQ $0x15, R8 - MOVQ R9, AX - ADDQ 8(CX), R9 - ADDQ 16(CX), R9 - MOVQ R9, SI - RORQ $0x2c, SI - ADDQ SI, R8 - ADDQ 24(CX), R9 - ADDQ AX, R8 - XCHGQ R9, R8 - ADDQ BP, R11 - MOVQ BX, R10 - ADDQ 16(CX), R10 - ADDQ 32(CX), R11 - ADDQ R11, R10 - ADDQ 56(CX), R10 - RORQ $0x15, R10 - MOVQ R11, AX - ADDQ 40(CX), R11 - ADDQ 48(CX), R11 - MOVQ R11, SI - RORQ $0x2c, SI - ADDQ SI, R10 - ADDQ 56(CX), R11 - ADDQ AX, R10 - XCHGQ R11, R10 - XCHGQ BP, DX - XORQ R10, R8 - IMULQ DI, R8 - MOVQ R8, AX - SHRQ $0x2f, AX - XORQ R8, AX - XORQ AX, R10 - IMULQ DI, R10 - MOVQ R10, AX - SHRQ $0x2f, AX - XORQ R10, AX - IMULQ DI, AX - ADDQ BP, AX - MOVQ BX, CX - SHRQ $0x2f, CX - XORQ BX, CX - MOVQ $0xc3a5c85c97cb3127, BX - IMULQ BX, CX - ADDQ CX, AX - XORQ R11, R9 - IMULQ DI, R9 - MOVQ R9, CX - SHRQ $0x2f, CX - XORQ R9, CX - XORQ CX, R11 - IMULQ DI, R11 - MOVQ R11, CX - SHRQ $0x2f, CX - XORQ R11, CX - IMULQ DI, CX - ADDQ DX, CX - XORQ CX, AX - IMULQ DI, AX - MOVQ AX, DX - SHRQ $0x2f, DX - XORQ AX, DX - XORQ DX, CX - IMULQ DI, CX - MOVQ CX, AX - SHRQ $0x2f, AX - XORQ CX, AX - IMULQ DI, AX - MOVQ AX, ret+24(FP) - RET - -// func Fingerprint32(s []byte) uint32 -TEXT ·Fingerprint32(SB), NOSPLIT, $0-28 - MOVQ s_base+0(FP), AX - MOVQ s_len+8(FP), CX - CMPQ CX, $0x18 - JG long - CMPQ CX, $0x0c - JG hash_13_24 - CMPQ CX, $0x04 - JG hash_5_12 - XORL DX, DX - MOVL $0x00000009, BX - TESTQ CX, CX - JZ done - MOVQ CX, BP - MOVL $0xcc9e2d51, DI - IMULL DI, DX - MOVBLSX (AX), SI - ADDL SI, DX - XORL DX, BX - SUBQ $0x01, BP - TESTQ BP, BP - JZ done - IMULL DI, DX - MOVBLSX 1(AX), SI - ADDL SI, DX - XORL DX, BX - SUBQ $0x01, BP - TESTQ BP, BP - JZ done - IMULL DI, DX - MOVBLSX 2(AX), SI - ADDL SI, DX - XORL DX, BX - SUBQ $0x01, BP - TESTQ BP, BP - JZ done - IMULL DI, DX - MOVBLSX 3(AX), SI - ADDL SI, DX - XORL DX, BX - SUBQ $0x01, BP - TESTQ BP, BP - JZ done - -done: - MOVL CX, BP - MOVL $0xcc9e2d51, SI - IMULL SI, BP - RORL $0x11, BP - MOVL $0x1b873593, SI - IMULL SI, BP - XORL BP, BX - RORL $0x13, BX - LEAL (BX)(BX*4), BP - LEAL 3864292196(BP), BX - MOVL $0xcc9e2d51, BP - IMULL BP, DX - RORL $0x11, DX - MOVL $0x1b873593, BP - IMULL BP, DX - XORL DX, BX - RORL $0x13, BX - LEAL (BX)(BX*4), DX - LEAL 3864292196(DX), BX - MOVL BX, DX - SHRL $0x10, DX - XORL DX, BX - MOVL $0x85ebca6b, DX - IMULL DX, BX - MOVL BX, DX - SHRL $0x0d, DX - XORL DX, BX - MOVL $0xc2b2ae35, DX - IMULL DX, BX - MOVL BX, DX - SHRL $0x10, DX - XORL DX, BX - MOVL BX, ret+24(FP) - RET - -hash_5_12: - MOVL CX, DX - MOVL DX, BX - SHLL $0x02, BX - ADDL DX, BX - MOVL $0x00000009, BP - MOVL BX, SI - ADDL (AX), DX - MOVQ CX, DI - SUBQ $0x04, DI - ADDQ AX, DI - ADDL (DI), BX - MOVQ CX, DI - SHRQ $0x01, DI - ANDQ $0x04, DI - ADDQ AX, DI - ADDL (DI), BP - MOVL $0xcc9e2d51, DI - IMULL DI, DX - RORL $0x11, DX - MOVL $0x1b873593, DI - IMULL DI, DX - XORL DX, SI - RORL $0x13, SI - LEAL (SI)(SI*4), DX - LEAL 3864292196(DX), SI - MOVL $0xcc9e2d51, DX - IMULL DX, BX - RORL $0x11, BX - MOVL $0x1b873593, DX - IMULL DX, BX - XORL BX, SI - RORL $0x13, SI - LEAL (SI)(SI*4), BX - LEAL 3864292196(BX), SI - MOVL $0xcc9e2d51, DX - IMULL DX, BP - RORL $0x11, BP - MOVL $0x1b873593, DX - IMULL DX, BP - XORL BP, SI - RORL $0x13, SI - LEAL (SI)(SI*4), BP - LEAL 3864292196(BP), SI - MOVL SI, DX - SHRL $0x10, DX - XORL DX, SI - MOVL $0x85ebca6b, DX - IMULL DX, SI - MOVL SI, DX - SHRL $0x0d, DX - XORL DX, SI - MOVL $0xc2b2ae35, DX - IMULL DX, SI - MOVL SI, DX - SHRL $0x10, DX - XORL DX, SI - MOVL SI, ret+24(FP) - RET - -hash_13_24: - MOVQ CX, DX - SHRQ $0x01, DX - ADDQ AX, DX - MOVL -4(DX), BX - MOVL 4(AX), BP - MOVQ CX, SI - ADDQ AX, SI - MOVL -8(SI), DI - MOVL (DX), DX - MOVL (AX), R8 - MOVL -4(SI), SI - MOVL $0xcc9e2d51, R9 - IMULL DX, R9 - ADDL CX, R9 - RORL $0x0c, BX - ADDL SI, BX - MOVL DI, R10 - MOVL $0xcc9e2d51, R11 - IMULL R11, R10 - RORL $0x11, R10 - MOVL $0x1b873593, R11 - IMULL R11, R10 - XORL R10, R9 - RORL $0x13, R9 - LEAL (R9)(R9*4), R10 - LEAL 3864292196(R10), R9 - ADDL BX, R9 - RORL $0x03, BX - ADDL DI, BX - MOVL $0xcc9e2d51, DI - IMULL DI, R8 - RORL $0x11, R8 - MOVL $0x1b873593, DI - IMULL DI, R8 - XORL R8, R9 - RORL $0x13, R9 - LEAL (R9)(R9*4), R8 - LEAL 3864292196(R8), R9 - ADDL BX, R9 - ADDL SI, BX - RORL $0x0c, BX - ADDL DX, BX - MOVL $0xcc9e2d51, DX - IMULL DX, BP - RORL $0x11, BP - MOVL $0x1b873593, DX - IMULL DX, BP - XORL BP, R9 - RORL $0x13, R9 - LEAL (R9)(R9*4), BP - LEAL 3864292196(BP), R9 - ADDL BX, R9 - MOVL R9, DX - SHRL $0x10, DX - XORL DX, R9 - MOVL $0x85ebca6b, DX - IMULL DX, R9 - MOVL R9, DX - SHRL $0x0d, DX - XORL DX, R9 - MOVL $0xc2b2ae35, DX - IMULL DX, R9 - MOVL R9, DX - SHRL $0x10, DX - XORL DX, R9 - MOVL R9, ret+24(FP) - RET - -long: - MOVL CX, DX - MOVL $0xcc9e2d51, BX - IMULL DX, BX - MOVL BX, BP - MOVQ CX, SI - ADDQ AX, SI - MOVL $0xcc9e2d51, DI - MOVL $0x1b873593, R8 - MOVL -4(SI), R9 - IMULL DI, R9 - RORL $0x11, R9 - IMULL R8, R9 - XORL R9, DX - RORL $0x13, DX - MOVL DX, R9 - SHLL $0x02, R9 - ADDL R9, DX - ADDL $0xe6546b64, DX - MOVL -8(SI), R9 - IMULL DI, R9 - RORL $0x11, R9 - IMULL R8, R9 - XORL R9, BX - RORL $0x13, BX - MOVL BX, R9 - SHLL $0x02, R9 - ADDL R9, BX - ADDL $0xe6546b64, BX - MOVL -16(SI), R9 - IMULL DI, R9 - RORL $0x11, R9 - IMULL R8, R9 - XORL R9, DX - RORL $0x13, DX - MOVL DX, R9 - SHLL $0x02, R9 - ADDL R9, DX - ADDL $0xe6546b64, DX - MOVL -12(SI), R9 - IMULL DI, R9 - RORL $0x11, R9 - IMULL R8, R9 - XORL R9, BX - RORL $0x13, BX - MOVL BX, R9 - SHLL $0x02, R9 - ADDL R9, BX - ADDL $0xe6546b64, BX - PREFETCHT0 (AX) - MOVL -20(SI), SI - IMULL DI, SI - RORL $0x11, SI - IMULL R8, SI - ADDL SI, BP - RORL $0x13, BP - ADDL $0x71, BP - -loop80: - CMPQ CX, $0x64 - JL loop20 - PREFETCHT0 20(AX) - MOVL (AX), SI - ADDL SI, DX - MOVL 4(AX), DI - ADDL DI, BX - MOVL 8(AX), R8 - ADDL R8, BP - MOVL 12(AX), R9 - MOVL R9, R11 - MOVL $0xcc9e2d51, R10 - IMULL R10, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R10 - IMULL R10, R11 - XORL R11, DX - RORL $0x13, DX - LEAL (DX)(DX*4), R11 - LEAL 3864292196(R11), DX - MOVL 16(AX), R10 - ADDL R10, DX - MOVL R8, R11 - MOVL $0xcc9e2d51, R8 - IMULL R8, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R8 - IMULL R8, R11 - XORL R11, BX - RORL $0x13, BX - LEAL (BX)(BX*4), R11 - LEAL 3864292196(R11), BX - ADDL SI, BX - MOVL $0xcc9e2d51, SI - IMULL SI, R10 - MOVL R10, R11 - ADDL DI, R11 - MOVL $0xcc9e2d51, SI - IMULL SI, R11 - RORL $0x11, R11 - MOVL $0x1b873593, SI - IMULL SI, R11 - XORL R11, BP - RORL $0x13, BP - LEAL (BP)(BP*4), R11 - LEAL 3864292196(R11), BP - ADDL R9, BP - ADDL BX, BP - ADDL BP, BX - PREFETCHT0 40(AX) - MOVL 20(AX), SI - ADDL SI, DX - MOVL 24(AX), DI - ADDL DI, BX - MOVL 28(AX), R8 - ADDL R8, BP - MOVL 32(AX), R9 - MOVL R9, R11 - MOVL $0xcc9e2d51, R10 - IMULL R10, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R10 - IMULL R10, R11 - XORL R11, DX - RORL $0x13, DX - LEAL (DX)(DX*4), R11 - LEAL 3864292196(R11), DX - MOVL 36(AX), R10 - ADDL R10, DX - MOVL R8, R11 - MOVL $0xcc9e2d51, R8 - IMULL R8, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R8 - IMULL R8, R11 - XORL R11, BX - RORL $0x13, BX - LEAL (BX)(BX*4), R11 - LEAL 3864292196(R11), BX - ADDL SI, BX - MOVL $0xcc9e2d51, SI - IMULL SI, R10 - MOVL R10, R11 - ADDL DI, R11 - MOVL $0xcc9e2d51, SI - IMULL SI, R11 - RORL $0x11, R11 - MOVL $0x1b873593, SI - IMULL SI, R11 - XORL R11, BP - RORL $0x13, BP - LEAL (BP)(BP*4), R11 - LEAL 3864292196(R11), BP - ADDL R9, BP - ADDL BX, BP - ADDL BP, BX - PREFETCHT0 60(AX) - MOVL 40(AX), SI - ADDL SI, DX - MOVL 44(AX), DI - ADDL DI, BX - MOVL 48(AX), R8 - ADDL R8, BP - MOVL 52(AX), R9 - MOVL R9, R11 - MOVL $0xcc9e2d51, R10 - IMULL R10, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R10 - IMULL R10, R11 - XORL R11, DX - RORL $0x13, DX - LEAL (DX)(DX*4), R11 - LEAL 3864292196(R11), DX - MOVL 56(AX), R10 - ADDL R10, DX - MOVL R8, R11 - MOVL $0xcc9e2d51, R8 - IMULL R8, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R8 - IMULL R8, R11 - XORL R11, BX - RORL $0x13, BX - LEAL (BX)(BX*4), R11 - LEAL 3864292196(R11), BX - ADDL SI, BX - MOVL $0xcc9e2d51, SI - IMULL SI, R10 - MOVL R10, R11 - ADDL DI, R11 - MOVL $0xcc9e2d51, SI - IMULL SI, R11 - RORL $0x11, R11 - MOVL $0x1b873593, SI - IMULL SI, R11 - XORL R11, BP - RORL $0x13, BP - LEAL (BP)(BP*4), R11 - LEAL 3864292196(R11), BP - ADDL R9, BP - ADDL BX, BP - ADDL BP, BX - PREFETCHT0 80(AX) - MOVL 60(AX), SI - ADDL SI, DX - MOVL 64(AX), DI - ADDL DI, BX - MOVL 68(AX), R8 - ADDL R8, BP - MOVL 72(AX), R9 - MOVL R9, R11 - MOVL $0xcc9e2d51, R10 - IMULL R10, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R10 - IMULL R10, R11 - XORL R11, DX - RORL $0x13, DX - LEAL (DX)(DX*4), R11 - LEAL 3864292196(R11), DX - MOVL 76(AX), R10 - ADDL R10, DX - MOVL R8, R11 - MOVL $0xcc9e2d51, R8 - IMULL R8, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R8 - IMULL R8, R11 - XORL R11, BX - RORL $0x13, BX - LEAL (BX)(BX*4), R11 - LEAL 3864292196(R11), BX - ADDL SI, BX - MOVL $0xcc9e2d51, SI - IMULL SI, R10 - MOVL R10, R11 - ADDL DI, R11 - MOVL $0xcc9e2d51, SI - IMULL SI, R11 - RORL $0x11, R11 - MOVL $0x1b873593, SI - IMULL SI, R11 - XORL R11, BP - RORL $0x13, BP - LEAL (BP)(BP*4), R11 - LEAL 3864292196(R11), BP - ADDL R9, BP - ADDL BX, BP - ADDL BP, BX - ADDQ $0x50, AX - SUBQ $0x50, CX - JMP loop80 - -loop20: - CMPQ CX, $0x14 - JLE after - MOVL (AX), SI - ADDL SI, DX - MOVL 4(AX), DI - ADDL DI, BX - MOVL 8(AX), R8 - ADDL R8, BP - MOVL 12(AX), R9 - MOVL R9, R11 - MOVL $0xcc9e2d51, R10 - IMULL R10, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R10 - IMULL R10, R11 - XORL R11, DX - RORL $0x13, DX - LEAL (DX)(DX*4), R11 - LEAL 3864292196(R11), DX - MOVL 16(AX), R10 - ADDL R10, DX - MOVL R8, R11 - MOVL $0xcc9e2d51, R8 - IMULL R8, R11 - RORL $0x11, R11 - MOVL $0x1b873593, R8 - IMULL R8, R11 - XORL R11, BX - RORL $0x13, BX - LEAL (BX)(BX*4), R11 - LEAL 3864292196(R11), BX - ADDL SI, BX - MOVL $0xcc9e2d51, SI - IMULL SI, R10 - MOVL R10, R11 - ADDL DI, R11 - MOVL $0xcc9e2d51, SI - IMULL SI, R11 - RORL $0x11, R11 - MOVL $0x1b873593, SI - IMULL SI, R11 - XORL R11, BP - RORL $0x13, BP - LEAL (BP)(BP*4), R11 - LEAL 3864292196(R11), BP - ADDL R9, BP - ADDL BX, BP - ADDL BP, BX - ADDQ $0x14, AX - SUBQ $0x14, CX - JMP loop20 - -after: - MOVL $0xcc9e2d51, AX - RORL $0x0b, BX - IMULL AX, BX - RORL $0x11, BX - IMULL AX, BX - RORL $0x0b, BP - IMULL AX, BP - RORL $0x11, BP - IMULL AX, BP - ADDL BX, DX - RORL $0x13, DX - MOVL DX, CX - SHLL $0x02, CX - ADDL CX, DX - ADDL $0xe6546b64, DX - RORL $0x11, DX - IMULL AX, DX - ADDL BP, DX - RORL $0x13, DX - MOVL DX, CX - SHLL $0x02, CX - ADDL CX, DX - ADDL $0xe6546b64, DX - RORL $0x11, DX - IMULL AX, DX - MOVL DX, ret+24(FP) - RET diff --git a/vendor/github.com/dgryski/go-farm/fp_generic.go b/vendor/github.com/dgryski/go-farm/fp_generic.go deleted file mode 100644 index 2cfa1b9d..00000000 --- a/vendor/github.com/dgryski/go-farm/fp_generic.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !amd64 purego - -package farm - -// Fingerprint64 is a 64-bit fingerprint function for byte-slices -func Fingerprint64(s []byte) uint64 { - return naHash64(s) -} - -// Fingerprint32 is a 32-bit fingerprint function for byte-slices -func Fingerprint32(s []byte) uint32 { - return Hash32(s) -} diff --git a/vendor/github.com/dgryski/go-farm/fp_stub.go b/vendor/github.com/dgryski/go-farm/fp_stub.go deleted file mode 100644 index 94fff8de..00000000 --- a/vendor/github.com/dgryski/go-farm/fp_stub.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by command: go run asm.go -out=fp_amd64.s -stubs=fp_stub.go. DO NOT EDIT. - -// +build amd64,!purego - -package farm - -func Fingerprint64(s []byte) uint64 - -func Fingerprint32(s []byte) uint32 diff --git a/vendor/github.com/dustin/go-humanize/.travis.yml b/vendor/github.com/dustin/go-humanize/.travis.yml deleted file mode 100644 index ba95cdd1..00000000 --- a/vendor/github.com/dustin/go-humanize/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: go -go: - - 1.3.x - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - master -matrix: - allow_failures: - - go: master - fast_finish: true -install: - - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d -s .) - - go tool vet . - - go test -v -race ./... diff --git a/vendor/github.com/dustin/go-humanize/LICENSE b/vendor/github.com/dustin/go-humanize/LICENSE deleted file mode 100644 index 8d9a94a9..00000000 --- a/vendor/github.com/dustin/go-humanize/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2005-2008 Dustin Sallings - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - diff --git a/vendor/github.com/dustin/go-humanize/README.markdown b/vendor/github.com/dustin/go-humanize/README.markdown deleted file mode 100644 index 91b4ae56..00000000 --- a/vendor/github.com/dustin/go-humanize/README.markdown +++ /dev/null @@ -1,124 +0,0 @@ -# Humane Units [![Build Status](https://travis-ci.org/dustin/go-humanize.svg?branch=master)](https://travis-ci.org/dustin/go-humanize) [![GoDoc](https://godoc.org/github.com/dustin/go-humanize?status.svg)](https://godoc.org/github.com/dustin/go-humanize) - -Just a few functions for helping humanize times and sizes. - -`go get` it as `github.com/dustin/go-humanize`, import it as -`"github.com/dustin/go-humanize"`, use it as `humanize`. - -See [godoc](https://godoc.org/github.com/dustin/go-humanize) for -complete documentation. - -## Sizes - -This lets you take numbers like `82854982` and convert them to useful -strings like, `83 MB` or `79 MiB` (whichever you prefer). - -Example: - -```go -fmt.Printf("That file is %s.", humanize.Bytes(82854982)) // That file is 83 MB. -``` - -## Times - -This lets you take a `time.Time` and spit it out in relative terms. -For example, `12 seconds ago` or `3 days from now`. - -Example: - -```go -fmt.Printf("This was touched %s.", humanize.Time(someTimeInstance)) // This was touched 7 hours ago. -``` - -Thanks to Kyle Lemons for the time implementation from an IRC -conversation one day. It's pretty neat. - -## Ordinals - -From a [mailing list discussion][odisc] where a user wanted to be able -to label ordinals. - - 0 -> 0th - 1 -> 1st - 2 -> 2nd - 3 -> 3rd - 4 -> 4th - [...] - -Example: - -```go -fmt.Printf("You're my %s best friend.", humanize.Ordinal(193)) // You are my 193rd best friend. -``` - -## Commas - -Want to shove commas into numbers? Be my guest. - - 0 -> 0 - 100 -> 100 - 1000 -> 1,000 - 1000000000 -> 1,000,000,000 - -100000 -> -100,000 - -Example: - -```go -fmt.Printf("You owe $%s.\n", humanize.Comma(6582491)) // You owe $6,582,491. -``` - -## Ftoa - -Nicer float64 formatter that removes trailing zeros. - -```go -fmt.Printf("%f", 2.24) // 2.240000 -fmt.Printf("%s", humanize.Ftoa(2.24)) // 2.24 -fmt.Printf("%f", 2.0) // 2.000000 -fmt.Printf("%s", humanize.Ftoa(2.0)) // 2 -``` - -## SI notation - -Format numbers with [SI notation][sinotation]. - -Example: - -```go -humanize.SI(0.00000000223, "M") // 2.23 nM -``` - -## English-specific functions - -The following functions are in the `humanize/english` subpackage. - -### Plurals - -Simple English pluralization - -```go -english.PluralWord(1, "object", "") // object -english.PluralWord(42, "object", "") // objects -english.PluralWord(2, "bus", "") // buses -english.PluralWord(99, "locus", "loci") // loci - -english.Plural(1, "object", "") // 1 object -english.Plural(42, "object", "") // 42 objects -english.Plural(2, "bus", "") // 2 buses -english.Plural(99, "locus", "loci") // 99 loci -``` - -### Word series - -Format comma-separated words lists with conjuctions: - -```go -english.WordSeries([]string{"foo"}, "and") // foo -english.WordSeries([]string{"foo", "bar"}, "and") // foo and bar -english.WordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar and baz - -english.OxfordWordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar, and baz -``` - -[odisc]: https://groups.google.com/d/topic/golang-nuts/l8NhI74jl-4/discussion -[sinotation]: http://en.wikipedia.org/wiki/Metric_prefix diff --git a/vendor/github.com/dustin/go-humanize/big.go b/vendor/github.com/dustin/go-humanize/big.go deleted file mode 100644 index f49dc337..00000000 --- a/vendor/github.com/dustin/go-humanize/big.go +++ /dev/null @@ -1,31 +0,0 @@ -package humanize - -import ( - "math/big" -) - -// order of magnitude (to a max order) -func oomm(n, b *big.Int, maxmag int) (float64, int) { - mag := 0 - m := &big.Int{} - for n.Cmp(b) >= 0 { - n.DivMod(n, b, m) - mag++ - if mag == maxmag && maxmag >= 0 { - break - } - } - return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag -} - -// total order of magnitude -// (same as above, but with no upper limit) -func oom(n, b *big.Int) (float64, int) { - mag := 0 - m := &big.Int{} - for n.Cmp(b) >= 0 { - n.DivMod(n, b, m) - mag++ - } - return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag -} diff --git a/vendor/github.com/dustin/go-humanize/bigbytes.go b/vendor/github.com/dustin/go-humanize/bigbytes.go deleted file mode 100644 index 1a2bf617..00000000 --- a/vendor/github.com/dustin/go-humanize/bigbytes.go +++ /dev/null @@ -1,173 +0,0 @@ -package humanize - -import ( - "fmt" - "math/big" - "strings" - "unicode" -) - -var ( - bigIECExp = big.NewInt(1024) - - // BigByte is one byte in bit.Ints - BigByte = big.NewInt(1) - // BigKiByte is 1,024 bytes in bit.Ints - BigKiByte = (&big.Int{}).Mul(BigByte, bigIECExp) - // BigMiByte is 1,024 k bytes in bit.Ints - BigMiByte = (&big.Int{}).Mul(BigKiByte, bigIECExp) - // BigGiByte is 1,024 m bytes in bit.Ints - BigGiByte = (&big.Int{}).Mul(BigMiByte, bigIECExp) - // BigTiByte is 1,024 g bytes in bit.Ints - BigTiByte = (&big.Int{}).Mul(BigGiByte, bigIECExp) - // BigPiByte is 1,024 t bytes in bit.Ints - BigPiByte = (&big.Int{}).Mul(BigTiByte, bigIECExp) - // BigEiByte is 1,024 p bytes in bit.Ints - BigEiByte = (&big.Int{}).Mul(BigPiByte, bigIECExp) - // BigZiByte is 1,024 e bytes in bit.Ints - BigZiByte = (&big.Int{}).Mul(BigEiByte, bigIECExp) - // BigYiByte is 1,024 z bytes in bit.Ints - BigYiByte = (&big.Int{}).Mul(BigZiByte, bigIECExp) -) - -var ( - bigSIExp = big.NewInt(1000) - - // BigSIByte is one SI byte in big.Ints - BigSIByte = big.NewInt(1) - // BigKByte is 1,000 SI bytes in big.Ints - BigKByte = (&big.Int{}).Mul(BigSIByte, bigSIExp) - // BigMByte is 1,000 SI k bytes in big.Ints - BigMByte = (&big.Int{}).Mul(BigKByte, bigSIExp) - // BigGByte is 1,000 SI m bytes in big.Ints - BigGByte = (&big.Int{}).Mul(BigMByte, bigSIExp) - // BigTByte is 1,000 SI g bytes in big.Ints - BigTByte = (&big.Int{}).Mul(BigGByte, bigSIExp) - // BigPByte is 1,000 SI t bytes in big.Ints - BigPByte = (&big.Int{}).Mul(BigTByte, bigSIExp) - // BigEByte is 1,000 SI p bytes in big.Ints - BigEByte = (&big.Int{}).Mul(BigPByte, bigSIExp) - // BigZByte is 1,000 SI e bytes in big.Ints - BigZByte = (&big.Int{}).Mul(BigEByte, bigSIExp) - // BigYByte is 1,000 SI z bytes in big.Ints - BigYByte = (&big.Int{}).Mul(BigZByte, bigSIExp) -) - -var bigBytesSizeTable = map[string]*big.Int{ - "b": BigByte, - "kib": BigKiByte, - "kb": BigKByte, - "mib": BigMiByte, - "mb": BigMByte, - "gib": BigGiByte, - "gb": BigGByte, - "tib": BigTiByte, - "tb": BigTByte, - "pib": BigPiByte, - "pb": BigPByte, - "eib": BigEiByte, - "eb": BigEByte, - "zib": BigZiByte, - "zb": BigZByte, - "yib": BigYiByte, - "yb": BigYByte, - // Without suffix - "": BigByte, - "ki": BigKiByte, - "k": BigKByte, - "mi": BigMiByte, - "m": BigMByte, - "gi": BigGiByte, - "g": BigGByte, - "ti": BigTiByte, - "t": BigTByte, - "pi": BigPiByte, - "p": BigPByte, - "ei": BigEiByte, - "e": BigEByte, - "z": BigZByte, - "zi": BigZiByte, - "y": BigYByte, - "yi": BigYiByte, -} - -var ten = big.NewInt(10) - -func humanateBigBytes(s, base *big.Int, sizes []string) string { - if s.Cmp(ten) < 0 { - return fmt.Sprintf("%d B", s) - } - c := (&big.Int{}).Set(s) - val, mag := oomm(c, base, len(sizes)-1) - suffix := sizes[mag] - f := "%.0f %s" - if val < 10 { - f = "%.1f %s" - } - - return fmt.Sprintf(f, val, suffix) - -} - -// BigBytes produces a human readable representation of an SI size. -// -// See also: ParseBigBytes. -// -// BigBytes(82854982) -> 83 MB -func BigBytes(s *big.Int) string { - sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} - return humanateBigBytes(s, bigSIExp, sizes) -} - -// BigIBytes produces a human readable representation of an IEC size. -// -// See also: ParseBigBytes. -// -// BigIBytes(82854982) -> 79 MiB -func BigIBytes(s *big.Int) string { - sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} - return humanateBigBytes(s, bigIECExp, sizes) -} - -// ParseBigBytes parses a string representation of bytes into the number -// of bytes it represents. -// -// See also: BigBytes, BigIBytes. -// -// ParseBigBytes("42 MB") -> 42000000, nil -// ParseBigBytes("42 mib") -> 44040192, nil -func ParseBigBytes(s string) (*big.Int, error) { - lastDigit := 0 - hasComma := false - for _, r := range s { - if !(unicode.IsDigit(r) || r == '.' || r == ',') { - break - } - if r == ',' { - hasComma = true - } - lastDigit++ - } - - num := s[:lastDigit] - if hasComma { - num = strings.Replace(num, ",", "", -1) - } - - val := &big.Rat{} - _, err := fmt.Sscanf(num, "%f", val) - if err != nil { - return nil, err - } - - extra := strings.ToLower(strings.TrimSpace(s[lastDigit:])) - if m, ok := bigBytesSizeTable[extra]; ok { - mv := (&big.Rat{}).SetInt(m) - val.Mul(val, mv) - rv := &big.Int{} - rv.Div(val.Num(), val.Denom()) - return rv, nil - } - - return nil, fmt.Errorf("unhandled size name: %v", extra) -} diff --git a/vendor/github.com/dustin/go-humanize/bytes.go b/vendor/github.com/dustin/go-humanize/bytes.go deleted file mode 100644 index 0b498f48..00000000 --- a/vendor/github.com/dustin/go-humanize/bytes.go +++ /dev/null @@ -1,143 +0,0 @@ -package humanize - -import ( - "fmt" - "math" - "strconv" - "strings" - "unicode" -) - -// IEC Sizes. -// kibis of bits -const ( - Byte = 1 << (iota * 10) - KiByte - MiByte - GiByte - TiByte - PiByte - EiByte -) - -// SI Sizes. -const ( - IByte = 1 - KByte = IByte * 1000 - MByte = KByte * 1000 - GByte = MByte * 1000 - TByte = GByte * 1000 - PByte = TByte * 1000 - EByte = PByte * 1000 -) - -var bytesSizeTable = map[string]uint64{ - "b": Byte, - "kib": KiByte, - "kb": KByte, - "mib": MiByte, - "mb": MByte, - "gib": GiByte, - "gb": GByte, - "tib": TiByte, - "tb": TByte, - "pib": PiByte, - "pb": PByte, - "eib": EiByte, - "eb": EByte, - // Without suffix - "": Byte, - "ki": KiByte, - "k": KByte, - "mi": MiByte, - "m": MByte, - "gi": GiByte, - "g": GByte, - "ti": TiByte, - "t": TByte, - "pi": PiByte, - "p": PByte, - "ei": EiByte, - "e": EByte, -} - -func logn(n, b float64) float64 { - return math.Log(n) / math.Log(b) -} - -func humanateBytes(s uint64, base float64, sizes []string) string { - if s < 10 { - return fmt.Sprintf("%d B", s) - } - e := math.Floor(logn(float64(s), base)) - suffix := sizes[int(e)] - val := math.Floor(float64(s)/math.Pow(base, e)*10+0.5) / 10 - f := "%.0f %s" - if val < 10 { - f = "%.1f %s" - } - - return fmt.Sprintf(f, val, suffix) -} - -// Bytes produces a human readable representation of an SI size. -// -// See also: ParseBytes. -// -// Bytes(82854982) -> 83 MB -func Bytes(s uint64) string { - sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB"} - return humanateBytes(s, 1000, sizes) -} - -// IBytes produces a human readable representation of an IEC size. -// -// See also: ParseBytes. -// -// IBytes(82854982) -> 79 MiB -func IBytes(s uint64) string { - sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"} - return humanateBytes(s, 1024, sizes) -} - -// ParseBytes parses a string representation of bytes into the number -// of bytes it represents. -// -// See Also: Bytes, IBytes. -// -// ParseBytes("42 MB") -> 42000000, nil -// ParseBytes("42 mib") -> 44040192, nil -func ParseBytes(s string) (uint64, error) { - lastDigit := 0 - hasComma := false - for _, r := range s { - if !(unicode.IsDigit(r) || r == '.' || r == ',') { - break - } - if r == ',' { - hasComma = true - } - lastDigit++ - } - - num := s[:lastDigit] - if hasComma { - num = strings.Replace(num, ",", "", -1) - } - - f, err := strconv.ParseFloat(num, 64) - if err != nil { - return 0, err - } - - extra := strings.ToLower(strings.TrimSpace(s[lastDigit:])) - if m, ok := bytesSizeTable[extra]; ok { - f *= float64(m) - if f >= math.MaxUint64 { - return 0, fmt.Errorf("too large: %v", s) - } - return uint64(f), nil - } - - return 0, fmt.Errorf("unhandled size name: %v", extra) -} diff --git a/vendor/github.com/dustin/go-humanize/comma.go b/vendor/github.com/dustin/go-humanize/comma.go deleted file mode 100644 index 520ae3e5..00000000 --- a/vendor/github.com/dustin/go-humanize/comma.go +++ /dev/null @@ -1,116 +0,0 @@ -package humanize - -import ( - "bytes" - "math" - "math/big" - "strconv" - "strings" -) - -// Comma produces a string form of the given number in base 10 with -// commas after every three orders of magnitude. -// -// e.g. Comma(834142) -> 834,142 -func Comma(v int64) string { - sign := "" - - // Min int64 can't be negated to a usable value, so it has to be special cased. - if v == math.MinInt64 { - return "-9,223,372,036,854,775,808" - } - - if v < 0 { - sign = "-" - v = 0 - v - } - - parts := []string{"", "", "", "", "", "", ""} - j := len(parts) - 1 - - for v > 999 { - parts[j] = strconv.FormatInt(v%1000, 10) - switch len(parts[j]) { - case 2: - parts[j] = "0" + parts[j] - case 1: - parts[j] = "00" + parts[j] - } - v = v / 1000 - j-- - } - parts[j] = strconv.Itoa(int(v)) - return sign + strings.Join(parts[j:], ",") -} - -// Commaf produces a string form of the given number in base 10 with -// commas after every three orders of magnitude. -// -// e.g. Commaf(834142.32) -> 834,142.32 -func Commaf(v float64) string { - buf := &bytes.Buffer{} - if v < 0 { - buf.Write([]byte{'-'}) - v = 0 - v - } - - comma := []byte{','} - - parts := strings.Split(strconv.FormatFloat(v, 'f', -1, 64), ".") - pos := 0 - if len(parts[0])%3 != 0 { - pos += len(parts[0]) % 3 - buf.WriteString(parts[0][:pos]) - buf.Write(comma) - } - for ; pos < len(parts[0]); pos += 3 { - buf.WriteString(parts[0][pos : pos+3]) - buf.Write(comma) - } - buf.Truncate(buf.Len() - 1) - - if len(parts) > 1 { - buf.Write([]byte{'.'}) - buf.WriteString(parts[1]) - } - return buf.String() -} - -// CommafWithDigits works like the Commaf but limits the resulting -// string to the given number of decimal places. -// -// e.g. CommafWithDigits(834142.32, 1) -> 834,142.3 -func CommafWithDigits(f float64, decimals int) string { - return stripTrailingDigits(Commaf(f), decimals) -} - -// BigComma produces a string form of the given big.Int in base 10 -// with commas after every three orders of magnitude. -func BigComma(b *big.Int) string { - sign := "" - if b.Sign() < 0 { - sign = "-" - b.Abs(b) - } - - athousand := big.NewInt(1000) - c := (&big.Int{}).Set(b) - _, m := oom(c, athousand) - parts := make([]string, m+1) - j := len(parts) - 1 - - mod := &big.Int{} - for b.Cmp(athousand) >= 0 { - b.DivMod(b, athousand, mod) - parts[j] = strconv.FormatInt(mod.Int64(), 10) - switch len(parts[j]) { - case 2: - parts[j] = "0" + parts[j] - case 1: - parts[j] = "00" + parts[j] - } - j-- - } - parts[j] = strconv.Itoa(int(b.Int64())) - return sign + strings.Join(parts[j:], ",") -} diff --git a/vendor/github.com/dustin/go-humanize/commaf.go b/vendor/github.com/dustin/go-humanize/commaf.go deleted file mode 100644 index 620690de..00000000 --- a/vendor/github.com/dustin/go-humanize/commaf.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build go1.6 - -package humanize - -import ( - "bytes" - "math/big" - "strings" -) - -// BigCommaf produces a string form of the given big.Float in base 10 -// with commas after every three orders of magnitude. -func BigCommaf(v *big.Float) string { - buf := &bytes.Buffer{} - if v.Sign() < 0 { - buf.Write([]byte{'-'}) - v.Abs(v) - } - - comma := []byte{','} - - parts := strings.Split(v.Text('f', -1), ".") - pos := 0 - if len(parts[0])%3 != 0 { - pos += len(parts[0]) % 3 - buf.WriteString(parts[0][:pos]) - buf.Write(comma) - } - for ; pos < len(parts[0]); pos += 3 { - buf.WriteString(parts[0][pos : pos+3]) - buf.Write(comma) - } - buf.Truncate(buf.Len() - 1) - - if len(parts) > 1 { - buf.Write([]byte{'.'}) - buf.WriteString(parts[1]) - } - return buf.String() -} diff --git a/vendor/github.com/dustin/go-humanize/ftoa.go b/vendor/github.com/dustin/go-humanize/ftoa.go deleted file mode 100644 index 1c62b640..00000000 --- a/vendor/github.com/dustin/go-humanize/ftoa.go +++ /dev/null @@ -1,46 +0,0 @@ -package humanize - -import ( - "strconv" - "strings" -) - -func stripTrailingZeros(s string) string { - offset := len(s) - 1 - for offset > 0 { - if s[offset] == '.' { - offset-- - break - } - if s[offset] != '0' { - break - } - offset-- - } - return s[:offset+1] -} - -func stripTrailingDigits(s string, digits int) string { - if i := strings.Index(s, "."); i >= 0 { - if digits <= 0 { - return s[:i] - } - i++ - if i+digits >= len(s) { - return s - } - return s[:i+digits] - } - return s -} - -// Ftoa converts a float to a string with no trailing zeros. -func Ftoa(num float64) string { - return stripTrailingZeros(strconv.FormatFloat(num, 'f', 6, 64)) -} - -// FtoaWithDigits converts a float to a string but limits the resulting string -// to the given number of decimal places, and no trailing zeros. -func FtoaWithDigits(num float64, digits int) string { - return stripTrailingZeros(stripTrailingDigits(strconv.FormatFloat(num, 'f', 6, 64), digits)) -} diff --git a/vendor/github.com/dustin/go-humanize/humanize.go b/vendor/github.com/dustin/go-humanize/humanize.go deleted file mode 100644 index a2c2da31..00000000 --- a/vendor/github.com/dustin/go-humanize/humanize.go +++ /dev/null @@ -1,8 +0,0 @@ -/* -Package humanize converts boring ugly numbers to human-friendly strings and back. - -Durations can be turned into strings such as "3 days ago", numbers -representing sizes like 82854982 into useful strings like, "83 MB" or -"79 MiB" (whichever you prefer). -*/ -package humanize diff --git a/vendor/github.com/dustin/go-humanize/number.go b/vendor/github.com/dustin/go-humanize/number.go deleted file mode 100644 index dec61865..00000000 --- a/vendor/github.com/dustin/go-humanize/number.go +++ /dev/null @@ -1,192 +0,0 @@ -package humanize - -/* -Slightly adapted from the source to fit go-humanize. - -Author: https://github.com/gorhill -Source: https://gist.github.com/gorhill/5285193 - -*/ - -import ( - "math" - "strconv" -) - -var ( - renderFloatPrecisionMultipliers = [...]float64{ - 1, - 10, - 100, - 1000, - 10000, - 100000, - 1000000, - 10000000, - 100000000, - 1000000000, - } - - renderFloatPrecisionRounders = [...]float64{ - 0.5, - 0.05, - 0.005, - 0.0005, - 0.00005, - 0.000005, - 0.0000005, - 0.00000005, - 0.000000005, - 0.0000000005, - } -) - -// FormatFloat produces a formatted number as string based on the following user-specified criteria: -// * thousands separator -// * decimal separator -// * decimal precision -// -// Usage: s := RenderFloat(format, n) -// The format parameter tells how to render the number n. -// -// See examples: http://play.golang.org/p/LXc1Ddm1lJ -// -// Examples of format strings, given n = 12345.6789: -// "#,###.##" => "12,345.67" -// "#,###." => "12,345" -// "#,###" => "12345,678" -// "#\u202F###,##" => "12 345,68" -// "#.###,###### => 12.345,678900 -// "" (aka default format) => 12,345.67 -// -// The highest precision allowed is 9 digits after the decimal symbol. -// There is also a version for integer number, FormatInteger(), -// which is convenient for calls within template. -func FormatFloat(format string, n float64) string { - // Special cases: - // NaN = "NaN" - // +Inf = "+Infinity" - // -Inf = "-Infinity" - if math.IsNaN(n) { - return "NaN" - } - if n > math.MaxFloat64 { - return "Infinity" - } - if n < -math.MaxFloat64 { - return "-Infinity" - } - - // default format - precision := 2 - decimalStr := "." - thousandStr := "," - positiveStr := "" - negativeStr := "-" - - if len(format) > 0 { - format := []rune(format) - - // If there is an explicit format directive, - // then default values are these: - precision = 9 - thousandStr = "" - - // collect indices of meaningful formatting directives - formatIndx := []int{} - for i, char := range format { - if char != '#' && char != '0' { - formatIndx = append(formatIndx, i) - } - } - - if len(formatIndx) > 0 { - // Directive at index 0: - // Must be a '+' - // Raise an error if not the case - // index: 0123456789 - // +0.000,000 - // +000,000.0 - // +0000.00 - // +0000 - if formatIndx[0] == 0 { - if format[formatIndx[0]] != '+' { - panic("RenderFloat(): invalid positive sign directive") - } - positiveStr = "+" - formatIndx = formatIndx[1:] - } - - // Two directives: - // First is thousands separator - // Raise an error if not followed by 3-digit - // 0123456789 - // 0.000,000 - // 000,000.00 - if len(formatIndx) == 2 { - if (formatIndx[1] - formatIndx[0]) != 4 { - panic("RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers") - } - thousandStr = string(format[formatIndx[0]]) - formatIndx = formatIndx[1:] - } - - // One directive: - // Directive is decimal separator - // The number of digit-specifier following the separator indicates wanted precision - // 0123456789 - // 0.00 - // 000,0000 - if len(formatIndx) == 1 { - decimalStr = string(format[formatIndx[0]]) - precision = len(format) - formatIndx[0] - 1 - } - } - } - - // generate sign part - var signStr string - if n >= 0.000000001 { - signStr = positiveStr - } else if n <= -0.000000001 { - signStr = negativeStr - n = -n - } else { - signStr = "" - n = 0.0 - } - - // split number into integer and fractional parts - intf, fracf := math.Modf(n + renderFloatPrecisionRounders[precision]) - - // generate integer part string - intStr := strconv.FormatInt(int64(intf), 10) - - // add thousand separator if required - if len(thousandStr) > 0 { - for i := len(intStr); i > 3; { - i -= 3 - intStr = intStr[:i] + thousandStr + intStr[i:] - } - } - - // no fractional part, we can leave now - if precision == 0 { - return signStr + intStr - } - - // generate fractional part - fracStr := strconv.Itoa(int(fracf * renderFloatPrecisionMultipliers[precision])) - // may need padding - if len(fracStr) < precision { - fracStr = "000000000000000"[:precision-len(fracStr)] + fracStr - } - - return signStr + intStr + decimalStr + fracStr -} - -// FormatInteger produces a formatted number as string. -// See FormatFloat. -func FormatInteger(format string, n int) string { - return FormatFloat(format, float64(n)) -} diff --git a/vendor/github.com/dustin/go-humanize/ordinals.go b/vendor/github.com/dustin/go-humanize/ordinals.go deleted file mode 100644 index 43d88a86..00000000 --- a/vendor/github.com/dustin/go-humanize/ordinals.go +++ /dev/null @@ -1,25 +0,0 @@ -package humanize - -import "strconv" - -// Ordinal gives you the input number in a rank/ordinal format. -// -// Ordinal(3) -> 3rd -func Ordinal(x int) string { - suffix := "th" - switch x % 10 { - case 1: - if x%100 != 11 { - suffix = "st" - } - case 2: - if x%100 != 12 { - suffix = "nd" - } - case 3: - if x%100 != 13 { - suffix = "rd" - } - } - return strconv.Itoa(x) + suffix -} diff --git a/vendor/github.com/dustin/go-humanize/si.go b/vendor/github.com/dustin/go-humanize/si.go deleted file mode 100644 index ae659e0e..00000000 --- a/vendor/github.com/dustin/go-humanize/si.go +++ /dev/null @@ -1,123 +0,0 @@ -package humanize - -import ( - "errors" - "math" - "regexp" - "strconv" -) - -var siPrefixTable = map[float64]string{ - -24: "y", // yocto - -21: "z", // zepto - -18: "a", // atto - -15: "f", // femto - -12: "p", // pico - -9: "n", // nano - -6: "µ", // micro - -3: "m", // milli - 0: "", - 3: "k", // kilo - 6: "M", // mega - 9: "G", // giga - 12: "T", // tera - 15: "P", // peta - 18: "E", // exa - 21: "Z", // zetta - 24: "Y", // yotta -} - -var revSIPrefixTable = revfmap(siPrefixTable) - -// revfmap reverses the map and precomputes the power multiplier -func revfmap(in map[float64]string) map[string]float64 { - rv := map[string]float64{} - for k, v := range in { - rv[v] = math.Pow(10, k) - } - return rv -} - -var riParseRegex *regexp.Regexp - -func init() { - ri := `^([\-0-9.]+)\s?([` - for _, v := range siPrefixTable { - ri += v - } - ri += `]?)(.*)` - - riParseRegex = regexp.MustCompile(ri) -} - -// ComputeSI finds the most appropriate SI prefix for the given number -// and returns the prefix along with the value adjusted to be within -// that prefix. -// -// See also: SI, ParseSI. -// -// e.g. ComputeSI(2.2345e-12) -> (2.2345, "p") -func ComputeSI(input float64) (float64, string) { - if input == 0 { - return 0, "" - } - mag := math.Abs(input) - exponent := math.Floor(logn(mag, 10)) - exponent = math.Floor(exponent/3) * 3 - - value := mag / math.Pow(10, exponent) - - // Handle special case where value is exactly 1000.0 - // Should return 1 M instead of 1000 k - if value == 1000.0 { - exponent += 3 - value = mag / math.Pow(10, exponent) - } - - value = math.Copysign(value, input) - - prefix := siPrefixTable[exponent] - return value, prefix -} - -// SI returns a string with default formatting. -// -// SI uses Ftoa to format float value, removing trailing zeros. -// -// See also: ComputeSI, ParseSI. -// -// e.g. SI(1000000, "B") -> 1 MB -// e.g. SI(2.2345e-12, "F") -> 2.2345 pF -func SI(input float64, unit string) string { - value, prefix := ComputeSI(input) - return Ftoa(value) + " " + prefix + unit -} - -// SIWithDigits works like SI but limits the resulting string to the -// given number of decimal places. -// -// e.g. SIWithDigits(1000000, 0, "B") -> 1 MB -// e.g. SIWithDigits(2.2345e-12, 2, "F") -> 2.23 pF -func SIWithDigits(input float64, decimals int, unit string) string { - value, prefix := ComputeSI(input) - return FtoaWithDigits(value, decimals) + " " + prefix + unit -} - -var errInvalid = errors.New("invalid input") - -// ParseSI parses an SI string back into the number and unit. -// -// See also: SI, ComputeSI. -// -// e.g. ParseSI("2.2345 pF") -> (2.2345e-12, "F", nil) -func ParseSI(input string) (float64, string, error) { - found := riParseRegex.FindStringSubmatch(input) - if len(found) != 4 { - return 0, "", errInvalid - } - mag := revSIPrefixTable[found[2]] - unit := found[3] - - base, err := strconv.ParseFloat(found[1], 64) - return base * mag, unit, err -} diff --git a/vendor/github.com/dustin/go-humanize/times.go b/vendor/github.com/dustin/go-humanize/times.go deleted file mode 100644 index dd3fbf5e..00000000 --- a/vendor/github.com/dustin/go-humanize/times.go +++ /dev/null @@ -1,117 +0,0 @@ -package humanize - -import ( - "fmt" - "math" - "sort" - "time" -) - -// Seconds-based time units -const ( - Day = 24 * time.Hour - Week = 7 * Day - Month = 30 * Day - Year = 12 * Month - LongTime = 37 * Year -) - -// Time formats a time into a relative string. -// -// Time(someT) -> "3 weeks ago" -func Time(then time.Time) string { - return RelTime(then, time.Now(), "ago", "from now") -} - -// A RelTimeMagnitude struct contains a relative time point at which -// the relative format of time will switch to a new format string. A -// slice of these in ascending order by their "D" field is passed to -// CustomRelTime to format durations. -// -// The Format field is a string that may contain a "%s" which will be -// replaced with the appropriate signed label (e.g. "ago" or "from -// now") and a "%d" that will be replaced by the quantity. -// -// The DivBy field is the amount of time the time difference must be -// divided by in order to display correctly. -// -// e.g. if D is 2*time.Minute and you want to display "%d minutes %s" -// DivBy should be time.Minute so whatever the duration is will be -// expressed in minutes. -type RelTimeMagnitude struct { - D time.Duration - Format string - DivBy time.Duration -} - -var defaultMagnitudes = []RelTimeMagnitude{ - {time.Second, "now", time.Second}, - {2 * time.Second, "1 second %s", 1}, - {time.Minute, "%d seconds %s", time.Second}, - {2 * time.Minute, "1 minute %s", 1}, - {time.Hour, "%d minutes %s", time.Minute}, - {2 * time.Hour, "1 hour %s", 1}, - {Day, "%d hours %s", time.Hour}, - {2 * Day, "1 day %s", 1}, - {Week, "%d days %s", Day}, - {2 * Week, "1 week %s", 1}, - {Month, "%d weeks %s", Week}, - {2 * Month, "1 month %s", 1}, - {Year, "%d months %s", Month}, - {18 * Month, "1 year %s", 1}, - {2 * Year, "2 years %s", 1}, - {LongTime, "%d years %s", Year}, - {math.MaxInt64, "a long while %s", 1}, -} - -// RelTime formats a time into a relative string. -// -// It takes two times and two labels. In addition to the generic time -// delta string (e.g. 5 minutes), the labels are used applied so that -// the label corresponding to the smaller time is applied. -// -// RelTime(timeInPast, timeInFuture, "earlier", "later") -> "3 weeks earlier" -func RelTime(a, b time.Time, albl, blbl string) string { - return CustomRelTime(a, b, albl, blbl, defaultMagnitudes) -} - -// CustomRelTime formats a time into a relative string. -// -// It takes two times two labels and a table of relative time formats. -// In addition to the generic time delta string (e.g. 5 minutes), the -// labels are used applied so that the label corresponding to the -// smaller time is applied. -func CustomRelTime(a, b time.Time, albl, blbl string, magnitudes []RelTimeMagnitude) string { - lbl := albl - diff := b.Sub(a) - - if a.After(b) { - lbl = blbl - diff = a.Sub(b) - } - - n := sort.Search(len(magnitudes), func(i int) bool { - return magnitudes[i].D > diff - }) - - if n >= len(magnitudes) { - n = len(magnitudes) - 1 - } - mag := magnitudes[n] - args := []interface{}{} - escaped := false - for _, ch := range mag.Format { - if escaped { - switch ch { - case 's': - args = append(args, lbl) - case 'd': - args = append(args, diff/mag.DivBy) - } - escaped = false - } else { - escaped = ch == '%' - } - } - return fmt.Sprintf(mag.Format, args...) -} diff --git a/vendor/github.com/elastic/gosigar/CHANGELOG.md b/vendor/github.com/elastic/gosigar/CHANGELOG.md index 0ce0fad6..9377542a 100644 --- a/vendor/github.com/elastic/gosigar/CHANGELOG.md +++ b/vendor/github.com/elastic/gosigar/CHANGELOG.md @@ -12,6 +12,12 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Deprecated +## [0.10.4] + +### Fixed + +- Fixed a crash when splitting command-line arguments under Windows. #124 + ## [0.10.3] ### Fixed diff --git a/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go b/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go index 7da8a071..0c11fda3 100644 --- a/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go +++ b/vendor/github.com/elastic/gosigar/sys/windows/syscall_windows.go @@ -503,9 +503,17 @@ func GetUserProcessParams(handle syscall.Handle, pbi ProcessBasicInformation) (p return params, nil } +// ReadProcessUnicodeString returns a zero-terminated UTF-16 string from another +// process's memory. func ReadProcessUnicodeString(handle syscall.Handle, s *UnicodeString) ([]byte, error) { - buf := make([]byte, s.Size) - nRead, err := ReadProcessMemory(handle, s.Buffer, buf) + // Allocate an extra UTF-16 null character at the end in case the read string + // is not terminated. + extra := 2 + if s.Size&1 != 0 { + extra = 3 // If size is odd, need 3 nulls to terminate. + } + buf := make([]byte, int(s.Size)+extra) + nRead, err := ReadProcessMemory(handle, s.Buffer, buf[:s.Size]) if err != nil { return nil, err } @@ -515,12 +523,26 @@ func ReadProcessUnicodeString(handle syscall.Handle, s *UnicodeString) ([]byte, return buf, nil } -// Use Windows' CommandLineToArgv API to split an UTF-16 command line string -// into a list of parameters. +// ByteSliceToStringSlice uses CommandLineToArgv API to split an UTF-16 command +// line string into a list of parameters. func ByteSliceToStringSlice(utf16 []byte) ([]string, error) { - if len(utf16) == 0 { + n := len(utf16) + // Discard odd byte + if n&1 != 0 { + n-- + utf16 = utf16[:n] + } + if n == 0 { return nil, nil } + terminated := false + for i := 0; i < n && !terminated; i += 2 { + terminated = utf16[i] == 0 && utf16[i+1] == 0 + } + if !terminated { + // Append a null uint16 at the end if terminator is missing + utf16 = append(utf16, 0, 0) + } var numArgs int32 argsWide, err := syscall.CommandLineToArgv((*uint16)(unsafe.Pointer(&utf16[0])), &numArgs) if err != nil { diff --git a/vendor/github.com/ethereum/go-ethereum/README.md b/vendor/github.com/ethereum/go-ethereum/README.md index 5ae8e7a6..fd259415 100644 --- a/vendor/github.com/ethereum/go-ethereum/README.md +++ b/vendor/github.com/ethereum/go-ethereum/README.md @@ -9,28 +9,30 @@ https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/6874 [![Travis](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv) -Automated builds are available for stable releases and the unstable master branch. -Binary archives are published at https://geth.ethereum.org/downloads/. +Automated builds are available for stable releases and the unstable master branch. Binary +archives are published at https://geth.ethereum.org/downloads/. ## Building the source -For prerequisites and detailed build instructions please read the -[Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) -on the wiki. +For prerequisites and detailed build instructions please read the [Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) on the wiki. -Building geth requires both a Go (version 1.10 or later) and a C compiler. -You can install them using your favourite package manager. -Once the dependencies are installed, run +Building `geth` requires both a Go (version 1.10 or later) and a C compiler. You can install +them using your favourite package manager. Once the dependencies are installed, run - make geth +```shell +make geth +``` or, to build the full suite of utilities: - make all +```shell +make all +``` ## Executables -The go-ethereum project comes with several wrappers/executables found in the `cmd` directory. +The go-ethereum project comes with several wrappers/executables found in the `cmd` +directory. | Command | Description | | :-----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -42,269 +44,301 @@ The go-ethereum project comes with several wrappers/executables found in the `cm | `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereum/wiki/wiki/RLP)) dumps (data encoding used by the Ethereum protocol both network as well as consensus wise) to user-friendlier hierarchical representation (e.g. `rlpdump --hex CE0183FFFFFFC4C304050583616263`). | | `puppeth` | a CLI wizard that aids in creating a new Ethereum network. | -## Running geth +## Running `geth` Going through all the possible command line flags is out of scope here (please consult our -[CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options)), but we've -enumerated a few common parameter combos to get you up to speed quickly on how you can run your -own Geth instance. +[CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options)), +but we've enumerated a few common parameter combos to get you up to speed quickly +on how you can run your own `geth` instance. ### Full node on the main Ethereum network -By far the most common scenario is people wanting to simply interact with the Ethereum network: -create accounts; transfer funds; deploy and interact with contracts. For this particular use-case -the user doesn't care about years-old historical data, so we can fast-sync quickly to the current -state of the network. To do so: +By far the most common scenario is people wanting to simply interact with the Ethereum +network: create accounts; transfer funds; deploy and interact with contracts. For this +particular use-case the user doesn't care about years-old historical data, so we can +fast-sync quickly to the current state of the network. To do so: -``` +```shell $ geth console ``` This command will: - - * Start geth in fast sync mode (default, can be changed with the `--syncmode` flag), causing it to - download more data in exchange for avoiding processing the entire history of the Ethereum network, - which is very CPU intensive. - * Start up Geth's built-in interactive [JavaScript console](https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console), + * Start `geth` in fast sync mode (default, can be changed with the `--syncmode` flag), + causing it to download more data in exchange for avoiding processing the entire history + of the Ethereum network, which is very CPU intensive. + * Start up `geth`'s built-in interactive [JavaScript console](https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console), (via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API) - as well as Geth's own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs). - This tool is optional and if you leave it out you can always attach to an already running Geth instance - with `geth attach`. + as well as `geth`'s own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs). + This tool is optional and if you leave it out you can always attach to an already running + `geth` instance with `geth attach`. ### A Full node on the Ethereum test network -Transitioning towards developers, if you'd like to play around with creating Ethereum contracts, you -almost certainly would like to do that without any real money involved until you get the hang of the -entire system. In other words, instead of attaching to the main network, you want to join the **test** -network with your node, which is fully equivalent to the main network, but with play-Ether only. +Transitioning towards developers, if you'd like to play around with creating Ethereum +contracts, you almost certainly would like to do that without any real money involved until +you get the hang of the entire system. In other words, instead of attaching to the main +network, you want to join the **test** network with your node, which is fully equivalent to +the main network, but with play-Ether only. -``` +```shell $ geth --testnet console ``` -The `console` subcommand has the exact same meaning as above and they are equally useful on the -testnet too. Please see above for their explanations if you've skipped here. +The `console` subcommand has the exact same meaning as above and they are equally +useful on the testnet too. Please see above for their explanations if you've skipped here. -Specifying the `--testnet` flag, however, will reconfigure your Geth instance a bit: +Specifying the `--testnet` flag, however, will reconfigure your `geth` instance a bit: - * Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest - itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux). Note, on OSX - and Linux this also means that attaching to a running testnet node requires the use of a custom - endpoint since `geth attach` will try to attach to a production node endpoint by default. E.g. - `geth attach /testnet/geth.ipc`. Windows users are not affected by this. - * Instead of connecting the main Ethereum network, the client will connect to the test network, - which uses different P2P bootnodes, different network IDs and genesis states. - -*Note: Although there are some internal protective measures to prevent transactions from crossing -over between the main network and test network, you should make sure to always use separate accounts -for play-money and real-money. Unless you manually move accounts, Geth will by default correctly -separate the two networks and will not make any accounts available between them.* + * Instead of using the default data directory (`~/.ethereum` on Linux for example), `geth` + will nest itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on + Linux). Note, on OSX and Linux this also means that attaching to a running testnet node + requires the use of a custom endpoint since `geth attach` will try to attach to a + production node endpoint by default. E.g. + `geth attach /testnet/geth.ipc`. Windows users are not affected by + this. + * Instead of connecting the main Ethereum network, the client will connect to the test + network, which uses different P2P bootnodes, different network IDs and genesis states. + +*Note: Although there are some internal protective measures to prevent transactions from +crossing over between the main network and test network, you should make sure to always +use separate accounts for play-money and real-money. Unless you manually move +accounts, `geth` will by default correctly separate the two networks and will not make any +accounts available between them.* ### Full node on the Rinkeby test network -The above test network is a cross-client one based on the ethash proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty/security. Go Ethereum also supports connecting to a proof-of-authority based test network called [*Rinkeby*](https://www.rinkeby.io) (operated by members of the community). This network is lighter, more secure, but is only supported by go-ethereum. +The above test network is a cross-client one based on the ethash proof-of-work consensus +algorithm. As such, it has certain extra overhead and is more susceptible to reorganization +attacks due to the network's low difficulty/security. Go Ethereum also supports connecting +to a proof-of-authority based test network called [*Rinkeby*](https://www.rinkeby.io) +(operated by members of the community). This network is lighter, more secure, but is only +supported by go-ethereum. -``` +```shell $ geth --rinkeby console ``` ### Configuration -As an alternative to passing the numerous flags to the `geth` binary, you can also pass a configuration file via: +As an alternative to passing the numerous flags to the `geth` binary, you can also pass a +configuration file via: -``` +```shell $ geth --config /path/to/your_config.toml ``` -To get an idea how the file should look like you can use the `dumpconfig` subcommand to export your existing configuration: +To get an idea how the file should look like you can use the `dumpconfig` subcommand to +export your existing configuration: -``` +```shell $ geth --your-favourite-flags dumpconfig ``` -*Note: This works only with geth v1.6.0 and above.* +*Note: This works only with `geth` v1.6.0 and above.* #### Docker quick start -One of the quickest ways to get Ethereum up and running on your machine is by using Docker: +One of the quickest ways to get Ethereum up and running on your machine is by using +Docker: -``` +```shell docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \ -p 8545:8545 -p 30303:30303 \ ethereum/client-go ``` -This will start geth in fast-sync mode with a DB memory allowance of 1GB just as the above command does. It will also create a persistent volume in your home directory for saving your blockchain as well as map the default ports. There is also an `alpine` tag available for a slim version of the image. +This will start `geth` in fast-sync mode with a DB memory allowance of 1GB just as the +above command does. It will also create a persistent volume in your home directory for +saving your blockchain as well as map the default ports. There is also an `alpine` tag +available for a slim version of the image. -Do not forget `--rpcaddr 0.0.0.0`, if you want to access RPC from other containers and/or hosts. By default, `geth` binds to the local interface and RPC endpoints is not accessible from the outside. +Do not forget `--rpcaddr 0.0.0.0`, if you want to access RPC from other containers +and/or hosts. By default, `geth` binds to the local interface and RPC endpoints is not +accessible from the outside. -### Programmatically interfacing Geth nodes +### Programmatically interfacing `geth` nodes -As a developer, sooner rather than later you'll want to start interacting with Geth and the Ethereum -network via your own programs and not manually through the console. To aid this, Geth has built-in -support for a JSON-RPC based APIs ([standard APIs](https://github.com/ethereum/wiki/wiki/JSON-RPC) and -[Geth specific APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs)). These can be -exposed via HTTP, WebSockets and IPC (UNIX sockets on UNIX based platforms, and named pipes on Windows). +As a developer, sooner rather than later you'll want to start interacting with `geth` and the +Ethereum network via your own programs and not manually through the console. To aid +this, `geth` has built-in support for a JSON-RPC based APIs ([standard APIs](https://github.com/ethereum/wiki/wiki/JSON-RPC) +and [`geth` specific APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs)). +These can be exposed via HTTP, WebSockets and IPC (UNIX sockets on UNIX based +platforms, and named pipes on Windows). -The IPC interface is enabled by default and exposes all the APIs supported by Geth, whereas the HTTP -and WS interfaces need to manually be enabled and only expose a subset of APIs due to security reasons. -These can be turned on/off and configured as you'd expect. +The IPC interface is enabled by default and exposes all the APIs supported by `geth`, +whereas the HTTP and WS interfaces need to manually be enabled and only expose a +subset of APIs due to security reasons. These can be turned on/off and configured as +you'd expect. HTTP based JSON-RPC API options: * `--rpc` Enable the HTTP-RPC server - * `--rpcaddr` HTTP-RPC server listening interface (default: "localhost") - * `--rpcport` HTTP-RPC server listening port (default: 8545) - * `--rpcapi` API's offered over the HTTP-RPC interface (default: "eth,net,web3") + * `--rpcaddr` HTTP-RPC server listening interface (default: `localhost`) + * `--rpcport` HTTP-RPC server listening port (default: `8545`) + * `--rpcapi` API's offered over the HTTP-RPC interface (default: `eth,net,web3`) * `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced) * `--ws` Enable the WS-RPC server - * `--wsaddr` WS-RPC server listening interface (default: "localhost") - * `--wsport` WS-RPC server listening port (default: 8546) - * `--wsapi` API's offered over the WS-RPC interface (default: "eth,net,web3") + * `--wsaddr` WS-RPC server listening interface (default: `localhost`) + * `--wsport` WS-RPC server listening port (default: `8546`) + * `--wsapi` API's offered over the WS-RPC interface (default: `eth,net,web3`) * `--wsorigins` Origins from which to accept websockets requests * `--ipcdisable` Disable the IPC-RPC server - * `--ipcapi` API's offered over the IPC-RPC interface (default: "admin,debug,eth,miner,net,personal,shh,txpool,web3") + * `--ipcapi` API's offered over the IPC-RPC interface (default: `admin,debug,eth,miner,net,personal,shh,txpool,web3`) * `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it) -You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect -via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](https://www.jsonrpc.org/specification) -on all transports. You can reuse the same connection for multiple requests! +You'll need to use your own programming environments' capabilities (libraries, tools, etc) to +connect via HTTP, WS or IPC to a `geth` node configured with the above flags and you'll +need to speak [JSON-RPC](https://www.jsonrpc.org/specification) on all transports. You +can reuse the same connection for multiple requests! -**Note: Please understand the security implications of opening up an HTTP/WS based transport before -doing so! Hackers on the internet are actively trying to subvert Ethereum nodes with exposed APIs! -Further, all browser tabs can access locally running web servers, so malicious web pages could try to -subvert locally available APIs!** +**Note: Please understand the security implications of opening up an HTTP/WS based +transport before doing so! Hackers on the internet are actively trying to subvert +Ethereum nodes with exposed APIs! Further, all browser tabs can access locally +running web servers, so malicious web pages could try to subvert locally available +APIs!** ### Operating a private network -Maintaining your own private network is more involved as a lot of configurations taken for granted in -the official networks need to be manually set up. +Maintaining your own private network is more involved as a lot of configurations taken for +granted in the official networks need to be manually set up. #### Defining the private genesis state -First, you'll need to create the genesis state of your networks, which all nodes need to be aware of -and agree upon. This consists of a small JSON file (e.g. call it `genesis.json`): +First, you'll need to create the genesis state of your networks, which all nodes need to be +aware of and agree upon. This consists of a small JSON file (e.g. call it `genesis.json`): ```json { "config": { - "chainId": 0, - "homesteadBlock": 0, - "eip155Block": 0, - "eip158Block": 0 - }, - "alloc" : {}, - "coinbase" : "0x0000000000000000000000000000000000000000", - "difficulty" : "0x20000", - "extraData" : "", - "gasLimit" : "0x2fefd8", - "nonce" : "0x0000000000000042", - "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp" : "0x00" + "chainId": 0, + "homesteadBlock": 0, + "eip155Block": 0, + "eip158Block": 0 + }, + "alloc": {}, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x20000", + "extraData": "", + "gasLimit": "0x2fefd8", + "nonce": "0x0000000000000042", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00" } ``` -The above fields should be fine for most purposes, although we'd recommend changing the `nonce` to -some random value so you prevent unknown remote nodes from being able to connect to you. If you'd -like to pre-fund some accounts for easier testing, you can populate the `alloc` field with account -configs: +The above fields should be fine for most purposes, although we'd recommend changing +the `nonce` to some random value so you prevent unknown remote nodes from being able +to connect to you. If you'd like to pre-fund some accounts for easier testing, you can +populate the `alloc` field with account configs: ```json "alloc": { - "0x0000000000000000000000000000000000000001": {"balance": "111111111"}, - "0x0000000000000000000000000000000000000002": {"balance": "222222222"} + "0x0000000000000000000000000000000000000001": { + "balance": "111111111" + }, + "0x0000000000000000000000000000000000000002": { + "balance": "222222222" + } } ``` -With the genesis state defined in the above JSON file, you'll need to initialize **every** Geth node -with it prior to starting it up to ensure all blockchain parameters are correctly set: +With the genesis state defined in the above JSON file, you'll need to initialize **every** +`geth` node with it prior to starting it up to ensure all blockchain parameters are correctly +set: -``` +```shell $ geth init path/to/genesis.json ``` #### Creating the rendezvous point -With all nodes that you want to run initialized to the desired genesis state, you'll need to start a -bootstrap node that others can use to find each other in your network and/or over the internet. The -clean way is to configure and run a dedicated bootnode: +With all nodes that you want to run initialized to the desired genesis state, you'll need to +start a bootstrap node that others can use to find each other in your network and/or over +the internet. The clean way is to configure and run a dedicated bootnode: -``` +```shell $ bootnode --genkey=boot.key $ bootnode --nodekey=boot.key ``` With the bootnode online, it will display an [`enode` URL](https://github.com/ethereum/wiki/wiki/enode-url-format) -that other nodes can use to connect to it and exchange peer information. Make sure to replace the -displayed IP address information (most probably `[::]`) with your externally accessible IP to get the -actual `enode` URL. +that other nodes can use to connect to it and exchange peer information. Make sure to +replace the displayed IP address information (most probably `[::]`) with your externally +accessible IP to get the actual `enode` URL. -*Note: You could also use a full-fledged Geth node as a bootnode, but it's the less recommended way.* +*Note: You could also use a full-fledged `geth` node as a bootnode, but it's the less +recommended way.* #### Starting up your member nodes -With the bootnode operational and externally reachable (you can try `telnet ` to ensure -it's indeed reachable), start every subsequent Geth node pointed to the bootnode for peer discovery -via the `--bootnodes` flag. It will probably also be desirable to keep the data directory of your -private network separated, so do also specify a custom `--datadir` flag. +With the bootnode operational and externally reachable (you can try +`telnet ` to ensure it's indeed reachable), start every subsequent `geth` +node pointed to the bootnode for peer discovery via the `--bootnodes` flag. It will +probably also be desirable to keep the data directory of your private network separated, so +do also specify a custom `--datadir` flag. -``` +```shell $ geth --datadir=path/to/custom/data/folder --bootnodes= ``` -*Note: Since your network will be completely cut off from the main and test networks, you'll also -need to configure a miner to process transactions and create new blocks for you.* +*Note: Since your network will be completely cut off from the main and test networks, you'll +also need to configure a miner to process transactions and create new blocks for you.* #### Running a private miner -Mining on the public Ethereum network is a complex task as it's only feasible using GPUs, requiring -an OpenCL or CUDA enabled `ethminer` instance. For information on such a setup, please consult the -[EtherMining subreddit](https://www.reddit.com/r/EtherMining/) and the [Genoil miner](https://github.com/Genoil/cpp-ethereum) -repository. +Mining on the public Ethereum network is a complex task as it's only feasible using GPUs, +requiring an OpenCL or CUDA enabled `ethminer` instance. For information on such a +setup, please consult the [EtherMining subreddit](https://www.reddit.com/r/EtherMining/) +and the [Genoil miner](https://github.com/Genoil/cpp-ethereum) repository. -In a private network setting, however a single CPU miner instance is more than enough for practical -purposes as it can produce a stable stream of blocks at the correct intervals without needing heavy -resources (consider running on a single thread, no need for multiple ones either). To start a Geth -instance for mining, run it with all your usual flags, extended by: +In a private network setting, however a single CPU miner instance is more than enough for +practical purposes as it can produce a stable stream of blocks at the correct intervals +without needing heavy resources (consider running on a single thread, no need for multiple +ones either). To start a `geth` instance for mining, run it with all your usual flags, extended +by: -``` +```shell $ geth --mine --minerthreads=1 --etherbase=0x0000000000000000000000000000000000000000 ``` -Which will start mining blocks and transactions on a single CPU thread, crediting all proceedings to -the account specified by `--etherbase`. You can further tune the mining by changing the default gas -limit blocks converge to (`--targetgaslimit`) and the price transactions are accepted at (`--gasprice`). +Which will start mining blocks and transactions on a single CPU thread, crediting all +proceedings to the account specified by `--etherbase`. You can further tune the mining +by changing the default gas limit blocks converge to (`--targetgaslimit`) and the price +transactions are accepted at (`--gasprice`). ## Contribution -Thank you for considering to help out with the source code! We welcome contributions from -anyone on the internet, and are grateful for even the smallest of fixes! +Thank you for considering to help out with the source code! We welcome contributions +from anyone on the internet, and are grateful for even the smallest of fixes! If you'd like to contribute to go-ethereum, please fork, fix, commit and send a pull request -for the maintainers to review and merge into the main code base. If you wish to submit more -complex changes though, please check up with the core devs first on [our gitter channel](https://gitter.im/ethereum/go-ethereum) -to ensure those changes are in line with the general philosophy of the project and/or get some -early feedback which can make both your efforts much lighter as well as our review and merge -procedures quick and simple. +for the maintainers to review and merge into the main code base. If you wish to submit +more complex changes though, please check up with the core devs first on [our gitter channel](https://gitter.im/ethereum/go-ethereum) +to ensure those changes are in line with the general philosophy of the project and/or get +some early feedback which can make both your efforts much lighter as well as our review +and merge procedures quick and simple. Please make sure your contributions adhere to our coding guidelines: - * Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). - * Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. + * Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) + guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). + * Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) + guidelines. * Pull requests need to be based on and opened against the `master` branch. * Commit messages should be prefixed with the package(s) they modify. * E.g. "eth, rpc: make trace configs optional" Please see the [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) -for more details on configuring your environment, managing project dependencies, and testing procedures. +for more details on configuring your environment, managing project dependencies, and +testing procedures. ## License The go-ethereum library (i.e. all code outside of the `cmd` directory) is licensed under the -[GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), also -included in our repository in the `COPYING.LESSER` file. +[GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), +also included in our repository in the `COPYING.LESSER` file. The go-ethereum binaries (i.e. all code inside of the `cmd` directory) is licensed under the -[GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also included -in our repository in the `COPYING` file. +[GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also +included in our repository in the `COPYING` file. diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/abi.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/abi.go new file mode 100644 index 00000000..97a3a98b --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/abi.go @@ -0,0 +1,192 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package abi + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + "github.com/ethereum/go-ethereum/common" +) + +// The ABI holds information about a contract's context and available +// invokable methods. It will allow you to type check function calls and +// packs data accordingly. +type ABI struct { + Constructor Method + Methods map[string]Method + Events map[string]Event +} + +// JSON returns a parsed ABI interface and error if it failed. +func JSON(reader io.Reader) (ABI, error) { + dec := json.NewDecoder(reader) + + var abi ABI + if err := dec.Decode(&abi); err != nil { + return ABI{}, err + } + + return abi, nil +} + +// Pack the given method name to conform the ABI. Method call's data +// will consist of method_id, args0, arg1, ... argN. Method id consists +// of 4 bytes and arguments are all 32 bytes. +// Method ids are created from the first 4 bytes of the hash of the +// methods string signature. (signature = baz(uint32,string32)) +func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) { + // Fetch the ABI of the requested method + if name == "" { + // constructor + arguments, err := abi.Constructor.Inputs.Pack(args...) + if err != nil { + return nil, err + } + return arguments, nil + } + method, exist := abi.Methods[name] + if !exist { + return nil, fmt.Errorf("method '%s' not found", name) + } + arguments, err := method.Inputs.Pack(args...) + if err != nil { + return nil, err + } + // Pack up the method ID too if not a constructor and return + return append(method.Id(), arguments...), nil +} + +// Unpack output in v according to the abi specification +func (abi ABI) Unpack(v interface{}, name string, data []byte) (err error) { + if len(data) == 0 { + return fmt.Errorf("abi: unmarshalling empty output") + } + // since there can't be naming collisions with contracts and events, + // we need to decide whether we're calling a method or an event + if method, ok := abi.Methods[name]; ok { + if len(data)%32 != 0 { + return fmt.Errorf("abi: improperly formatted output: %s - Bytes: [%+v]", string(data), data) + } + return method.Outputs.Unpack(v, data) + } + if event, ok := abi.Events[name]; ok { + return event.Inputs.Unpack(v, data) + } + return fmt.Errorf("abi: could not locate named method or event") +} + +// UnpackIntoMap unpacks a log into the provided map[string]interface{} +func (abi ABI) UnpackIntoMap(v map[string]interface{}, name string, data []byte) (err error) { + if len(data) == 0 { + return fmt.Errorf("abi: unmarshalling empty output") + } + // since there can't be naming collisions with contracts and events, + // we need to decide whether we're calling a method or an event + if method, ok := abi.Methods[name]; ok { + if len(data)%32 != 0 { + return fmt.Errorf("abi: improperly formatted output") + } + return method.Outputs.UnpackIntoMap(v, data) + } + if event, ok := abi.Events[name]; ok { + return event.Inputs.UnpackIntoMap(v, data) + } + return fmt.Errorf("abi: could not locate named method or event") +} + +// UnmarshalJSON implements json.Unmarshaler interface +func (abi *ABI) UnmarshalJSON(data []byte) error { + var fields []struct { + Type string + Name string + Constant bool + Anonymous bool + Inputs []Argument + Outputs []Argument + } + + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + abi.Methods = make(map[string]Method) + abi.Events = make(map[string]Event) + for _, field := range fields { + switch field.Type { + case "constructor": + abi.Constructor = Method{ + Inputs: field.Inputs, + } + // empty defaults to function according to the abi spec + case "function", "": + name := field.Name + _, ok := abi.Methods[name] + for idx := 0; ok; idx++ { + name = fmt.Sprintf("%s%d", field.Name, idx) + _, ok = abi.Methods[name] + } + abi.Methods[name] = Method{ + Name: name, + Const: field.Constant, + Inputs: field.Inputs, + Outputs: field.Outputs, + } + case "event": + name := field.Name + _, ok := abi.Events[name] + for idx := 0; ok; idx++ { + name = fmt.Sprintf("%s%d", field.Name, idx) + _, ok = abi.Events[name] + } + abi.Events[name] = Event{ + Name: name, + Anonymous: field.Anonymous, + Inputs: field.Inputs, + } + } + } + + return nil +} + +// MethodById looks up a method by the 4-byte id +// returns nil if none found +func (abi *ABI) MethodById(sigdata []byte) (*Method, error) { + if len(sigdata) < 4 { + return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata)) + } + for _, method := range abi.Methods { + if bytes.Equal(method.Id(), sigdata[:4]) { + return &method, nil + } + } + return nil, fmt.Errorf("no method with id: %#x", sigdata[:4]) +} + +// EventByID looks an event up by its topic hash in the +// ABI and returns nil if none found. +func (abi *ABI) EventByID(topic common.Hash) (*Event, error) { + for _, event := range abi.Events { + if bytes.Equal(event.Id().Bytes(), topic.Bytes()) { + return &event, nil + } + } + return nil, fmt.Errorf("no event with id: %#x", topic.Hex()) +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/argument.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/argument.go new file mode 100644 index 00000000..4dae5865 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/argument.go @@ -0,0 +1,365 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package abi + +import ( + "encoding/json" + "fmt" + "reflect" + "strings" +) + +// Argument holds the name of the argument and the corresponding type. +// Types are used when packing and testing arguments. +type Argument struct { + Name string + Type Type + Indexed bool // indexed is only used by events +} + +type Arguments []Argument + +type ArgumentMarshaling struct { + Name string + Type string + Components []ArgumentMarshaling + Indexed bool +} + +// UnmarshalJSON implements json.Unmarshaler interface +func (argument *Argument) UnmarshalJSON(data []byte) error { + var arg ArgumentMarshaling + err := json.Unmarshal(data, &arg) + if err != nil { + return fmt.Errorf("argument json err: %v", err) + } + + argument.Type, err = NewType(arg.Type, arg.Components) + if err != nil { + return err + } + argument.Name = arg.Name + argument.Indexed = arg.Indexed + + return nil +} + +// LengthNonIndexed returns the number of arguments when not counting 'indexed' ones. Only events +// can ever have 'indexed' arguments, it should always be false on arguments for method input/output +func (arguments Arguments) LengthNonIndexed() int { + out := 0 + for _, arg := range arguments { + if !arg.Indexed { + out++ + } + } + return out +} + +// NonIndexed returns the arguments with indexed arguments filtered out +func (arguments Arguments) NonIndexed() Arguments { + var ret []Argument + for _, arg := range arguments { + if !arg.Indexed { + ret = append(ret, arg) + } + } + return ret +} + +// isTuple returns true for non-atomic constructs, like (uint,uint) or uint[] +func (arguments Arguments) isTuple() bool { + return len(arguments) > 1 +} + +// Unpack performs the operation hexdata -> Go format +func (arguments Arguments) Unpack(v interface{}, data []byte) error { + // make sure the passed value is arguments pointer + if reflect.Ptr != reflect.ValueOf(v).Kind() { + return fmt.Errorf("abi: Unpack(non-pointer %T)", v) + } + marshalledValues, err := arguments.UnpackValues(data) + if err != nil { + return err + } + if arguments.isTuple() { + return arguments.unpackTuple(v, marshalledValues) + } + return arguments.unpackAtomic(v, marshalledValues[0]) +} + +// UnpackIntoMap performs the operation hexdata -> mapping of argument name to argument value +func (arguments Arguments) UnpackIntoMap(v map[string]interface{}, data []byte) error { + marshalledValues, err := arguments.UnpackValues(data) + if err != nil { + return err + } + + return arguments.unpackIntoMap(v, marshalledValues) +} + +// unpack sets the unmarshalled value to go format. +// Note the dst here must be settable. +func unpack(t *Type, dst interface{}, src interface{}) error { + var ( + dstVal = reflect.ValueOf(dst).Elem() + srcVal = reflect.ValueOf(src) + ) + tuple, typ := false, t + for { + if typ.T == SliceTy || typ.T == ArrayTy { + typ = typ.Elem + continue + } + tuple = typ.T == TupleTy + break + } + if !tuple { + return set(dstVal, srcVal) + } + + // Dereferences interface or pointer wrapper + dstVal = indirectInterfaceOrPtr(dstVal) + + switch t.T { + case TupleTy: + if dstVal.Kind() != reflect.Struct { + return fmt.Errorf("abi: invalid dst value for unpack, want struct, got %s", dstVal.Kind()) + } + fieldmap, err := mapArgNamesToStructFields(t.TupleRawNames, dstVal) + if err != nil { + return err + } + for i, elem := range t.TupleElems { + fname := fieldmap[t.TupleRawNames[i]] + field := dstVal.FieldByName(fname) + if !field.IsValid() { + return fmt.Errorf("abi: field %s can't found in the given value", t.TupleRawNames[i]) + } + if err := unpack(elem, field.Addr().Interface(), srcVal.Field(i).Interface()); err != nil { + return err + } + } + return nil + case SliceTy: + if dstVal.Kind() != reflect.Slice { + return fmt.Errorf("abi: invalid dst value for unpack, want slice, got %s", dstVal.Kind()) + } + slice := reflect.MakeSlice(dstVal.Type(), srcVal.Len(), srcVal.Len()) + for i := 0; i < slice.Len(); i++ { + if err := unpack(t.Elem, slice.Index(i).Addr().Interface(), srcVal.Index(i).Interface()); err != nil { + return err + } + } + dstVal.Set(slice) + case ArrayTy: + if dstVal.Kind() != reflect.Array { + return fmt.Errorf("abi: invalid dst value for unpack, want array, got %s", dstVal.Kind()) + } + array := reflect.New(dstVal.Type()).Elem() + for i := 0; i < array.Len(); i++ { + if err := unpack(t.Elem, array.Index(i).Addr().Interface(), srcVal.Index(i).Interface()); err != nil { + return err + } + } + dstVal.Set(array) + } + return nil +} + +// unpackIntoMap unpacks marshalledValues into the provided map[string]interface{} +func (arguments Arguments) unpackIntoMap(v map[string]interface{}, marshalledValues []interface{}) error { + // Make sure map is not nil + if v == nil { + return fmt.Errorf("abi: cannot unpack into a nil map") + } + + for i, arg := range arguments.NonIndexed() { + v[arg.Name] = marshalledValues[i] + } + return nil +} + +// unpackAtomic unpacks ( hexdata -> go ) a single value +func (arguments Arguments) unpackAtomic(v interface{}, marshalledValues interface{}) error { + if arguments.LengthNonIndexed() == 0 { + return nil + } + argument := arguments.NonIndexed()[0] + elem := reflect.ValueOf(v).Elem() + + if elem.Kind() == reflect.Struct && argument.Type.T != TupleTy { + fieldmap, err := mapArgNamesToStructFields([]string{argument.Name}, elem) + if err != nil { + return err + } + field := elem.FieldByName(fieldmap[argument.Name]) + if !field.IsValid() { + return fmt.Errorf("abi: field %s can't be found in the given value", argument.Name) + } + return unpack(&argument.Type, field.Addr().Interface(), marshalledValues) + } + return unpack(&argument.Type, elem.Addr().Interface(), marshalledValues) +} + +// unpackTuple unpacks ( hexdata -> go ) a batch of values. +func (arguments Arguments) unpackTuple(v interface{}, marshalledValues []interface{}) error { + var ( + value = reflect.ValueOf(v).Elem() + typ = value.Type() + kind = value.Kind() + ) + if err := requireUnpackKind(value, typ, kind, arguments); err != nil { + return err + } + + // If the interface is a struct, get of abi->struct_field mapping + var abi2struct map[string]string + if kind == reflect.Struct { + var ( + argNames []string + err error + ) + for _, arg := range arguments.NonIndexed() { + argNames = append(argNames, arg.Name) + } + abi2struct, err = mapArgNamesToStructFields(argNames, value) + if err != nil { + return err + } + } + for i, arg := range arguments.NonIndexed() { + switch kind { + case reflect.Struct: + field := value.FieldByName(abi2struct[arg.Name]) + if !field.IsValid() { + return fmt.Errorf("abi: field %s can't be found in the given value", arg.Name) + } + if err := unpack(&arg.Type, field.Addr().Interface(), marshalledValues[i]); err != nil { + return err + } + case reflect.Slice, reflect.Array: + if value.Len() < i { + return fmt.Errorf("abi: insufficient number of arguments for unpack, want %d, got %d", len(arguments), value.Len()) + } + v := value.Index(i) + if err := requireAssignable(v, reflect.ValueOf(marshalledValues[i])); err != nil { + return err + } + if err := unpack(&arg.Type, v.Addr().Interface(), marshalledValues[i]); err != nil { + return err + } + default: + return fmt.Errorf("abi:[2] cannot unmarshal tuple in to %v", typ) + } + } + return nil + +} + +// UnpackValues can be used to unpack ABI-encoded hexdata according to the ABI-specification, +// without supplying a struct to unpack into. Instead, this method returns a list containing the +// values. An atomic argument will be a list with one element. +func (arguments Arguments) UnpackValues(data []byte) ([]interface{}, error) { + retval := make([]interface{}, 0, arguments.LengthNonIndexed()) + virtualArgs := 0 + for index, arg := range arguments.NonIndexed() { + marshalledValue, err := toGoType((index+virtualArgs)*32, arg.Type, data) + if arg.Type.T == ArrayTy && !isDynamicType(arg.Type) { + // If we have a static array, like [3]uint256, these are coded as + // just like uint256,uint256,uint256. + // This means that we need to add two 'virtual' arguments when + // we count the index from now on. + // + // Array values nested multiple levels deep are also encoded inline: + // [2][3]uint256: uint256,uint256,uint256,uint256,uint256,uint256 + // + // Calculate the full array size to get the correct offset for the next argument. + // Decrement it by 1, as the normal index increment is still applied. + virtualArgs += getTypeSize(arg.Type)/32 - 1 + } else if arg.Type.T == TupleTy && !isDynamicType(arg.Type) { + // If we have a static tuple, like (uint256, bool, uint256), these are + // coded as just like uint256,bool,uint256 + virtualArgs += getTypeSize(arg.Type)/32 - 1 + } + if err != nil { + return nil, err + } + retval = append(retval, marshalledValue) + } + return retval, nil +} + +// PackValues performs the operation Go format -> Hexdata +// It is the semantic opposite of UnpackValues +func (arguments Arguments) PackValues(args []interface{}) ([]byte, error) { + return arguments.Pack(args...) +} + +// Pack performs the operation Go format -> Hexdata +func (arguments Arguments) Pack(args ...interface{}) ([]byte, error) { + // Make sure arguments match up and pack them + abiArgs := arguments + if len(args) != len(abiArgs) { + return nil, fmt.Errorf("argument count mismatch: %d for %d", len(args), len(abiArgs)) + } + // variable input is the output appended at the end of packed + // output. This is used for strings and bytes types input. + var variableInput []byte + + // input offset is the bytes offset for packed output + inputOffset := 0 + for _, abiArg := range abiArgs { + inputOffset += getTypeSize(abiArg.Type) + } + var ret []byte + for i, a := range args { + input := abiArgs[i] + // pack the input + packed, err := input.Type.pack(reflect.ValueOf(a)) + if err != nil { + return nil, err + } + // check for dynamic types + if isDynamicType(input.Type) { + // set the offset + ret = append(ret, packNum(reflect.ValueOf(inputOffset))...) + // calculate next offset + inputOffset += len(packed) + // append to variable input + variableInput = append(variableInput, packed...) + } else { + // append the packed value to the input + ret = append(ret, packed...) + } + } + // append the variable input at the end of the packed input + ret = append(ret, variableInput...) + + return ret, nil +} + +// ToCamelCase converts an under-score string to a camel-case string +func ToCamelCase(input string) string { + parts := strings.Split(input, "_") + for i, s := range parts { + if len(s) > 0 { + parts[i] = strings.ToUpper(s[:1]) + s[1:] + } + } + return strings.Join(parts, "") +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/auth.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/auth.go index 5d5ad003..e51f0bd8 100644 --- a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/auth.go +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/auth.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/external" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -43,7 +44,7 @@ func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) { return NewKeyedTransactor(key.PrivateKey), nil } -// NewKeystoreTransactor is a utility method to easily create a transaction signer from +// NewKeyStoreTransactor is a utility method to easily create a transaction signer from // an decrypted key from a keystore func NewKeyStoreTransactor(keystore *keystore.KeyStore, account accounts.Account) (*TransactOpts, error) { return &TransactOpts{ @@ -79,3 +80,17 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts { }, } } + +// NewClefTransactor is a utility method to easily create a transaction signer +// with a clef backend. +func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account) *TransactOpts { + return &TransactOpts{ + From: account.Address, + Signer: func(signer types.Signer, address common.Address, transaction *types.Transaction) (*types.Transaction, error) { + if address != account.Address { + return nil, errors.New("not authorized to sign this account") + } + return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id + }, + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/backends/simulated.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/backends/simulated.go index ac4602fe..6c59092b 100644 --- a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/backends/simulated.go +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/backends/simulated.go @@ -45,8 +45,10 @@ import ( // This nil assignment ensures compile time that SimulatedBackend implements bind.ContractBackend. var _ bind.ContractBackend = (*SimulatedBackend)(nil) -var errBlockNumberUnsupported = errors.New("SimulatedBackend cannot access blocks other than the latest block") -var errGasEstimationFailed = errors.New("gas required exceeds allowance or always failing transaction") +var ( + errBlockNumberUnsupported = errors.New("simulatedBackend cannot access blocks other than the latest block") + errGasEstimationFailed = errors.New("gas required exceeds allowance or always failing transaction") +) // SimulatedBackend implements bind.ContractBackend, simulating a blockchain in // the background. Its main purpose is to allow easily testing contract bindings. @@ -63,10 +65,9 @@ type SimulatedBackend struct { config *params.ChainConfig } -// NewSimulatedBackend creates a new binding backend using a simulated blockchain -// for testing purposes. -func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend { - database := rawdb.NewMemoryDatabase() +// NewSimulatedBackendWithDatabase creates a new binding backend based on the given database +// and uses a simulated blockchain for testing purposes. +func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend { genesis := core.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc} genesis.MustCommit(database) blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{}, nil) @@ -81,6 +82,12 @@ func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBac return backend } +// NewSimulatedBackend creates a new binding backend using a simulated blockchain +// for testing purposes. +func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend { + return NewSimulatedBackendWithDatabase(rawdb.NewMemoryDatabase(), alloc, gasLimit) +} + // Commit imports all the pending transactions as a single block and starts a // fresh new state. func (b *SimulatedBackend) Commit() { @@ -316,7 +323,7 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transa b.mu.Lock() defer b.mu.Unlock() - sender, err := types.Sender(types.HomesteadSigner{}, tx) + sender, err := types.Sender(types.NewEIP155Signer(b.config.ChainID), tx) if err != nil { panic(fmt.Errorf("invalid transaction: %v", err)) } @@ -424,6 +431,11 @@ func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error { return nil } +// Blockchain returns the underlying blockchain. +func (b *SimulatedBackend) Blockchain() *core.BlockChain { + return b.blockchain +} + // callmsg implements core.Message to allow passing it as a transaction simulator. type callmsg struct { ethereum.CallMsg diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/bind.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/bind.go new file mode 100644 index 00000000..cd8c942b --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/bind.go @@ -0,0 +1,558 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package bind generates Ethereum contract Go bindings. +// +// Detailed usage document and tutorial available on the go-ethereum Wiki page: +// https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts +package bind + +import ( + "bytes" + "errors" + "fmt" + "go/format" + "regexp" + "strings" + "text/template" + "unicode" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/log" +) + +// Lang is a target programming language selector to generate bindings for. +type Lang int + +const ( + LangGo Lang = iota + LangJava + LangObjC +) + +// Bind generates a Go wrapper around a contract ABI. This wrapper isn't meant +// to be used as is in client code, but rather as an intermediate struct which +// enforces compile time type safety and naming convention opposed to having to +// manually maintain hard coded strings that break on runtime. +func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string) (string, error) { + // Process each individual contract requested binding + contracts := make(map[string]*tmplContract) + + // Map used to flag each encountered library as such + isLib := make(map[string]struct{}) + + for i := 0; i < len(types); i++ { + // Parse the actual ABI to generate the binding for + evmABI, err := abi.JSON(strings.NewReader(abis[i])) + if err != nil { + return "", err + } + // Strip any whitespace from the JSON ABI + strippedABI := strings.Map(func(r rune) rune { + if unicode.IsSpace(r) { + return -1 + } + return r + }, abis[i]) + + // Extract the call and transact methods; events, struct definitions; and sort them alphabetically + var ( + calls = make(map[string]*tmplMethod) + transacts = make(map[string]*tmplMethod) + events = make(map[string]*tmplEvent) + structs = make(map[string]*tmplStruct) + ) + for _, original := range evmABI.Methods { + // Normalize the method for capital cases and non-anonymous inputs/outputs + normalized := original + normalized.Name = methodNormalizer[lang](original.Name) + + normalized.Inputs = make([]abi.Argument, len(original.Inputs)) + copy(normalized.Inputs, original.Inputs) + for j, input := range normalized.Inputs { + if input.Name == "" { + normalized.Inputs[j].Name = fmt.Sprintf("arg%d", j) + } + if _, exist := structs[input.Type.String()]; input.Type.T == abi.TupleTy && !exist { + bindStructType[lang](input.Type, structs) + } + } + normalized.Outputs = make([]abi.Argument, len(original.Outputs)) + copy(normalized.Outputs, original.Outputs) + for j, output := range normalized.Outputs { + if output.Name != "" { + normalized.Outputs[j].Name = capitalise(output.Name) + } + if _, exist := structs[output.Type.String()]; output.Type.T == abi.TupleTy && !exist { + bindStructType[lang](output.Type, structs) + } + } + // Append the methods to the call or transact lists + if original.Const { + calls[original.Name] = &tmplMethod{Original: original, Normalized: normalized, Structured: structured(original.Outputs)} + } else { + transacts[original.Name] = &tmplMethod{Original: original, Normalized: normalized, Structured: structured(original.Outputs)} + } + } + for _, original := range evmABI.Events { + // Skip anonymous events as they don't support explicit filtering + if original.Anonymous { + continue + } + // Normalize the event for capital cases and non-anonymous outputs + normalized := original + normalized.Name = methodNormalizer[lang](original.Name) + + normalized.Inputs = make([]abi.Argument, len(original.Inputs)) + copy(normalized.Inputs, original.Inputs) + for j, input := range normalized.Inputs { + // Indexed fields are input, non-indexed ones are outputs + if input.Indexed { + if input.Name == "" { + normalized.Inputs[j].Name = fmt.Sprintf("arg%d", j) + } + if _, exist := structs[input.Type.String()]; input.Type.T == abi.TupleTy && !exist { + bindStructType[lang](input.Type, structs) + } + } + } + // Append the event to the accumulator list + events[original.Name] = &tmplEvent{Original: original, Normalized: normalized} + } + + // There is no easy way to pass arbitrary java objects to the Go side. + if len(structs) > 0 && lang == LangJava { + return "", errors.New("java binding for tuple arguments is not supported yet") + } + + contracts[types[i]] = &tmplContract{ + Type: capitalise(types[i]), + InputABI: strings.Replace(strippedABI, "\"", "\\\"", -1), + InputBin: strings.TrimPrefix(strings.TrimSpace(bytecodes[i]), "0x"), + Constructor: evmABI.Constructor, + Calls: calls, + Transacts: transacts, + Events: events, + Libraries: make(map[string]string), + Structs: structs, + } + // Function 4-byte signatures are stored in the same sequence + // as types, if available. + if len(fsigs) > i { + contracts[types[i]].FuncSigs = fsigs[i] + } + // Parse library references. + for pattern, name := range libs { + matched, err := regexp.Match("__\\$"+pattern+"\\$__", []byte(contracts[types[i]].InputBin)) + if err != nil { + log.Error("Could not search for pattern", "pattern", pattern, "contract", contracts[types[i]], "err", err) + } + if matched { + contracts[types[i]].Libraries[pattern] = name + // keep track that this type is a library + if _, ok := isLib[name]; !ok { + isLib[name] = struct{}{} + } + } + } + } + // Check if that type has already been identified as a library + for i := 0; i < len(types); i++ { + _, ok := isLib[types[i]] + contracts[types[i]].Library = ok + } + // Generate the contract template data content and render it + data := &tmplData{ + Package: pkg, + Contracts: contracts, + Libraries: libs, + } + buffer := new(bytes.Buffer) + + funcs := map[string]interface{}{ + "bindtype": bindType[lang], + "bindtopictype": bindTopicType[lang], + "namedtype": namedType[lang], + "formatmethod": formatMethod, + "formatevent": formatEvent, + "capitalise": capitalise, + "decapitalise": decapitalise, + } + tmpl := template.Must(template.New("").Funcs(funcs).Parse(tmplSource[lang])) + if err := tmpl.Execute(buffer, data); err != nil { + return "", err + } + // For Go bindings pass the code through gofmt to clean it up + if lang == LangGo { + code, err := format.Source(buffer.Bytes()) + if err != nil { + return "", fmt.Errorf("%v\n%s", err, buffer) + } + return string(code), nil + } + // For all others just return as is for now + return buffer.String(), nil +} + +// bindType is a set of type binders that convert Solidity types to some supported +// programming language types. +var bindType = map[Lang]func(kind abi.Type, structs map[string]*tmplStruct) string{ + LangGo: bindTypeGo, + LangJava: bindTypeJava, +} + +// bindBasicTypeGo converts basic solidity types(except array, slice and tuple) to Go one. +func bindBasicTypeGo(kind abi.Type) string { + switch kind.T { + case abi.AddressTy: + return "common.Address" + case abi.IntTy, abi.UintTy: + parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String()) + switch parts[2] { + case "8", "16", "32", "64": + return fmt.Sprintf("%sint%s", parts[1], parts[2]) + } + return "*big.Int" + case abi.FixedBytesTy: + return fmt.Sprintf("[%d]byte", kind.Size) + case abi.BytesTy: + return "[]byte" + case abi.FunctionTy: + return "[24]byte" + default: + // string, bool types + return kind.String() + } +} + +// bindTypeGo converts solidity types to Go ones. Since there is no clear mapping +// from all Solidity types to Go ones (e.g. uint17), those that cannot be exactly +// mapped will use an upscaled type (e.g. BigDecimal). +func bindTypeGo(kind abi.Type, structs map[string]*tmplStruct) string { + switch kind.T { + case abi.TupleTy: + return structs[kind.String()].Name + case abi.ArrayTy: + return fmt.Sprintf("[%d]", kind.Size) + bindTypeGo(*kind.Elem, structs) + case abi.SliceTy: + return "[]" + bindTypeGo(*kind.Elem, structs) + default: + return bindBasicTypeGo(kind) + } +} + +// bindBasicTypeJava converts basic solidity types(except array, slice and tuple) to Java one. +func bindBasicTypeJava(kind abi.Type) string { + switch kind.T { + case abi.AddressTy: + return "Address" + case abi.IntTy, abi.UintTy: + // Note that uint and int (without digits) are also matched, + // these are size 256, and will translate to BigInt (the default). + parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String()) + if len(parts) != 3 { + return kind.String() + } + // All unsigned integers should be translated to BigInt since gomobile doesn't + // support them. + if parts[1] == "u" { + return "BigInt" + } + + namedSize := map[string]string{ + "8": "byte", + "16": "short", + "32": "int", + "64": "long", + }[parts[2]] + + // default to BigInt + if namedSize == "" { + namedSize = "BigInt" + } + return namedSize + case abi.FixedBytesTy, abi.BytesTy: + return "byte[]" + case abi.BoolTy: + return "boolean" + case abi.StringTy: + return "String" + case abi.FunctionTy: + return "byte[24]" + default: + return kind.String() + } +} + +// pluralizeJavaType explicitly converts multidimensional types to predefined +// type in go side. +func pluralizeJavaType(typ string) string { + switch typ { + case "boolean": + return "Bools" + case "String": + return "Strings" + case "Address": + return "Addresses" + case "byte[]": + return "Binaries" + case "BigInt": + return "BigInts" + } + return typ + "[]" +} + +// bindTypeJava converts a Solidity type to a Java one. Since there is no clear mapping +// from all Solidity types to Java ones (e.g. uint17), those that cannot be exactly +// mapped will use an upscaled type (e.g. BigDecimal). +func bindTypeJava(kind abi.Type, structs map[string]*tmplStruct) string { + switch kind.T { + case abi.TupleTy: + return structs[kind.String()].Name + case abi.ArrayTy, abi.SliceTy: + return pluralizeJavaType(bindTypeJava(*kind.Elem, structs)) + default: + return bindBasicTypeJava(kind) + } +} + +// bindTopicType is a set of type binders that convert Solidity types to some +// supported programming language topic types. +var bindTopicType = map[Lang]func(kind abi.Type, structs map[string]*tmplStruct) string{ + LangGo: bindTopicTypeGo, + LangJava: bindTopicTypeJava, +} + +// bindTopicTypeGo converts a Solidity topic type to a Go one. It is almost the same +// funcionality as for simple types, but dynamic types get converted to hashes. +func bindTopicTypeGo(kind abi.Type, structs map[string]*tmplStruct) string { + bound := bindTypeGo(kind, structs) + if bound == "string" || bound == "[]byte" { + bound = "common.Hash" + } + return bound +} + +// bindTopicTypeJava converts a Solidity topic type to a Java one. It is almost the same +// funcionality as for simple types, but dynamic types get converted to hashes. +func bindTopicTypeJava(kind abi.Type, structs map[string]*tmplStruct) string { + bound := bindTypeJava(kind, structs) + if bound == "String" || bound == "byte[]" { + bound = "Hash" + } + return bound +} + +// bindStructType is a set of type binders that convert Solidity tuple types to some supported +// programming language struct definition. +var bindStructType = map[Lang]func(kind abi.Type, structs map[string]*tmplStruct) string{ + LangGo: bindStructTypeGo, + LangJava: bindStructTypeJava, +} + +// bindStructTypeGo converts a Solidity tuple type to a Go one and records the mapping +// in the given map. +// Notably, this function will resolve and record nested struct recursively. +func bindStructTypeGo(kind abi.Type, structs map[string]*tmplStruct) string { + switch kind.T { + case abi.TupleTy: + if s, exist := structs[kind.String()]; exist { + return s.Name + } + var fields []*tmplField + for i, elem := range kind.TupleElems { + field := bindStructTypeGo(*elem, structs) + fields = append(fields, &tmplField{Type: field, Name: capitalise(kind.TupleRawNames[i]), SolKind: *elem}) + } + name := fmt.Sprintf("Struct%d", len(structs)) + structs[kind.String()] = &tmplStruct{ + Name: name, + Fields: fields, + } + return name + case abi.ArrayTy: + return fmt.Sprintf("[%d]", kind.Size) + bindStructTypeGo(*kind.Elem, structs) + case abi.SliceTy: + return "[]" + bindStructTypeGo(*kind.Elem, structs) + default: + return bindBasicTypeGo(kind) + } +} + +// bindStructTypeJava converts a Solidity tuple type to a Java one and records the mapping +// in the given map. +// Notably, this function will resolve and record nested struct recursively. +func bindStructTypeJava(kind abi.Type, structs map[string]*tmplStruct) string { + switch kind.T { + case abi.TupleTy: + if s, exist := structs[kind.String()]; exist { + return s.Name + } + var fields []*tmplField + for i, elem := range kind.TupleElems { + field := bindStructTypeJava(*elem, structs) + fields = append(fields, &tmplField{Type: field, Name: decapitalise(kind.TupleRawNames[i]), SolKind: *elem}) + } + name := fmt.Sprintf("Class%d", len(structs)) + structs[kind.String()] = &tmplStruct{ + Name: name, + Fields: fields, + } + return name + case abi.ArrayTy, abi.SliceTy: + return pluralizeJavaType(bindStructTypeJava(*kind.Elem, structs)) + default: + return bindBasicTypeJava(kind) + } +} + +// namedType is a set of functions that transform language specific types to +// named versions that my be used inside method names. +var namedType = map[Lang]func(string, abi.Type) string{ + LangGo: func(string, abi.Type) string { panic("this shouldn't be needed") }, + LangJava: namedTypeJava, +} + +// namedTypeJava converts some primitive data types to named variants that can +// be used as parts of method names. +func namedTypeJava(javaKind string, solKind abi.Type) string { + switch javaKind { + case "byte[]": + return "Binary" + case "boolean": + return "Bool" + default: + parts := regexp.MustCompile(`(u)?int([0-9]*)(\[[0-9]*\])?`).FindStringSubmatch(solKind.String()) + if len(parts) != 4 { + return javaKind + } + switch parts[2] { + case "8", "16", "32", "64": + if parts[3] == "" { + return capitalise(fmt.Sprintf("%sint%s", parts[1], parts[2])) + } + return capitalise(fmt.Sprintf("%sint%ss", parts[1], parts[2])) + + default: + return javaKind + } + } +} + +// methodNormalizer is a name transformer that modifies Solidity method names to +// conform to target language naming concentions. +var methodNormalizer = map[Lang]func(string) string{ + LangGo: abi.ToCamelCase, + LangJava: decapitalise, +} + +// capitalise makes a camel-case string which starts with an upper case character. +func capitalise(input string) string { + return abi.ToCamelCase(input) +} + +// decapitalise makes a camel-case string which starts with a lower case character. +func decapitalise(input string) string { + if len(input) == 0 { + return input + } + + goForm := abi.ToCamelCase(input) + return strings.ToLower(goForm[:1]) + goForm[1:] +} + +// structured checks whether a list of ABI data types has enough information to +// operate through a proper Go struct or if flat returns are needed. +func structured(args abi.Arguments) bool { + if len(args) < 2 { + return false + } + exists := make(map[string]bool) + for _, out := range args { + // If the name is anonymous, we can't organize into a struct + if out.Name == "" { + return false + } + // If the field name is empty when normalized or collides (var, Var, _var, _Var), + // we can't organize into a struct + field := capitalise(out.Name) + if field == "" || exists[field] { + return false + } + exists[field] = true + } + return true +} + +// resolveArgName converts a raw argument representation into a user friendly format. +func resolveArgName(arg abi.Argument, structs map[string]*tmplStruct) string { + var ( + prefix string + embedded string + typ = &arg.Type + ) +loop: + for { + switch typ.T { + case abi.SliceTy: + prefix += "[]" + case abi.ArrayTy: + prefix += fmt.Sprintf("[%d]", typ.Size) + default: + embedded = typ.String() + break loop + } + typ = typ.Elem + } + if s, exist := structs[embedded]; exist { + return prefix + s.Name + } else { + return arg.Type.String() + } +} + +// formatMethod transforms raw method representation into a user friendly one. +func formatMethod(method abi.Method, structs map[string]*tmplStruct) string { + inputs := make([]string, len(method.Inputs)) + for i, input := range method.Inputs { + inputs[i] = fmt.Sprintf("%v %v", resolveArgName(input, structs), input.Name) + } + outputs := make([]string, len(method.Outputs)) + for i, output := range method.Outputs { + outputs[i] = resolveArgName(output, structs) + if len(output.Name) > 0 { + outputs[i] += fmt.Sprintf(" %v", output.Name) + } + } + constant := "" + if method.Const { + constant = "constant " + } + return fmt.Sprintf("function %v(%v) %sreturns(%v)", method.Name, strings.Join(inputs, ", "), constant, strings.Join(outputs, ", ")) +} + +// formatEvent transforms raw event representation into a user friendly one. +func formatEvent(event abi.Event, structs map[string]*tmplStruct) string { + inputs := make([]string, len(event.Inputs)) + for i, input := range event.Inputs { + if input.Indexed { + inputs[i] = fmt.Sprintf("%v indexed %v", resolveArgName(input, structs), input.Name) + } else { + inputs[i] = fmt.Sprintf("%v %v", resolveArgName(input, structs), input.Name) + } + } + return fmt.Sprintf("event %v(%v)", event.Name, strings.Join(inputs, ", ")) +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/template.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/template.go new file mode 100644 index 00000000..3683a1eb --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/template.go @@ -0,0 +1,616 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package bind + +import "github.com/ethereum/go-ethereum/accounts/abi" + +// tmplData is the data structure required to fill the binding template. +type tmplData struct { + Package string // Name of the package to place the generated file in + Contracts map[string]*tmplContract // List of contracts to generate into this file + Libraries map[string]string // Map the bytecode's link pattern to the library name +} + +// tmplContract contains the data needed to generate an individual contract binding. +type tmplContract struct { + Type string // Type name of the main contract binding + InputABI string // JSON ABI used as the input to generate the binding from + InputBin string // Optional EVM bytecode used to denetare deploy code from + FuncSigs map[string]string // Optional map: string signature -> 4-byte signature + Constructor abi.Method // Contract constructor for deploy parametrization + Calls map[string]*tmplMethod // Contract calls that only read state data + Transacts map[string]*tmplMethod // Contract calls that write state data + Events map[string]*tmplEvent // Contract events accessors + Libraries map[string]string // Same as tmplData, but filtered to only keep what the contract needs + Structs map[string]*tmplStruct // Contract struct type definitions + Library bool +} + +// tmplMethod is a wrapper around an abi.Method that contains a few preprocessed +// and cached data fields. +type tmplMethod struct { + Original abi.Method // Original method as parsed by the abi package + Normalized abi.Method // Normalized version of the parsed method (capitalized names, non-anonymous args/returns) + Structured bool // Whether the returns should be accumulated into a struct +} + +// tmplEvent is a wrapper around an a +type tmplEvent struct { + Original abi.Event // Original event as parsed by the abi package + Normalized abi.Event // Normalized version of the parsed fields +} + +// tmplField is a wrapper around a struct field with binding language +// struct type definition and relative filed name. +type tmplField struct { + Type string // Field type representation depends on target binding language + Name string // Field name converted from the raw user-defined field name + SolKind abi.Type // Raw abi type information +} + +// tmplStruct is a wrapper around an abi.tuple contains a auto-generated +// struct name. +type tmplStruct struct { + Name string // Auto-generated struct name(We can't obtain the raw struct name through abi) + Fields []*tmplField // Struct fields definition depends on the binding language. +} + +// tmplSource is language to template mapping containing all the supported +// programming languages the package can generate to. +var tmplSource = map[Lang]string{ + LangGo: tmplSourceGo, + LangJava: tmplSourceJava, +} + +// tmplSourceGo is the Go source template use to generate the contract binding +// based on. +const tmplSourceGo = ` +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package {{.Package}} + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = abi.U256 + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +{{range $contract := .Contracts}} + {{$structs := $contract.Structs}} + // {{.Type}}ABI is the input ABI used to generate the binding from. + const {{.Type}}ABI = "{{.InputABI}}" + + {{if $contract.FuncSigs}} + // {{.Type}}FuncSigs maps the 4-byte function signature to its string representation. + var {{.Type}}FuncSigs = map[string]string{ + {{range $strsig, $binsig := .FuncSigs}}"{{$binsig}}": "{{$strsig}}", + {{end}} + } + {{end}} + + {{if .InputBin}} + // {{.Type}}Bin is the compiled bytecode used for deploying new contracts. + var {{.Type}}Bin = "0x{{.InputBin}}" + + // Deploy{{.Type}} deploys a new Ethereum contract, binding an instance of {{.Type}} to it. + func Deploy{{.Type}}(auth *bind.TransactOpts, backend bind.ContractBackend {{range .Constructor.Inputs}}, {{.Name}} {{bindtype .Type $structs}}{{end}}) (common.Address, *types.Transaction, *{{.Type}}, error) { + parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + {{range $pattern, $name := .Libraries}} + {{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend) + {{$contract.Type}}Bin = strings.Replace({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:], -1) + {{end}} + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}}) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &{{.Type}}{ {{.Type}}Caller: {{.Type}}Caller{contract: contract}, {{.Type}}Transactor: {{.Type}}Transactor{contract: contract}, {{.Type}}Filterer: {{.Type}}Filterer{contract: contract} }, nil + } + {{end}} + + // {{.Type}} is an auto generated Go binding around an Ethereum contract. + type {{.Type}} struct { + {{.Type}}Caller // Read-only binding to the contract + {{.Type}}Transactor // Write-only binding to the contract + {{.Type}}Filterer // Log filterer for contract events + } + + // {{.Type}}Caller is an auto generated read-only Go binding around an Ethereum contract. + type {{.Type}}Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls + } + + // {{.Type}}Transactor is an auto generated write-only Go binding around an Ethereum contract. + type {{.Type}}Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls + } + + // {{.Type}}Filterer is an auto generated log filtering Go binding around an Ethereum contract events. + type {{.Type}}Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls + } + + // {{.Type}}Session is an auto generated Go binding around an Ethereum contract, + // with pre-set call and transact options. + type {{.Type}}Session struct { + Contract *{{.Type}} // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session + } + + // {{.Type}}CallerSession is an auto generated read-only Go binding around an Ethereum contract, + // with pre-set call options. + type {{.Type}}CallerSession struct { + Contract *{{.Type}}Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + } + + // {{.Type}}TransactorSession is an auto generated write-only Go binding around an Ethereum contract, + // with pre-set transact options. + type {{.Type}}TransactorSession struct { + Contract *{{.Type}}Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session + } + + // {{.Type}}Raw is an auto generated low-level Go binding around an Ethereum contract. + type {{.Type}}Raw struct { + Contract *{{.Type}} // Generic contract binding to access the raw methods on + } + + // {{.Type}}CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. + type {{.Type}}CallerRaw struct { + Contract *{{.Type}}Caller // Generic read-only contract binding to access the raw methods on + } + + // {{.Type}}TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. + type {{.Type}}TransactorRaw struct { + Contract *{{.Type}}Transactor // Generic write-only contract binding to access the raw methods on + } + + // New{{.Type}} creates a new instance of {{.Type}}, bound to a specific deployed contract. + func New{{.Type}}(address common.Address, backend bind.ContractBackend) (*{{.Type}}, error) { + contract, err := bind{{.Type}}(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &{{.Type}}{ {{.Type}}Caller: {{.Type}}Caller{contract: contract}, {{.Type}}Transactor: {{.Type}}Transactor{contract: contract}, {{.Type}}Filterer: {{.Type}}Filterer{contract: contract} }, nil + } + + // New{{.Type}}Caller creates a new read-only instance of {{.Type}}, bound to a specific deployed contract. + func New{{.Type}}Caller(address common.Address, caller bind.ContractCaller) (*{{.Type}}Caller, error) { + contract, err := bind{{.Type}}(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &{{.Type}}Caller{contract: contract}, nil + } + + // New{{.Type}}Transactor creates a new write-only instance of {{.Type}}, bound to a specific deployed contract. + func New{{.Type}}Transactor(address common.Address, transactor bind.ContractTransactor) (*{{.Type}}Transactor, error) { + contract, err := bind{{.Type}}(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &{{.Type}}Transactor{contract: contract}, nil + } + + // New{{.Type}}Filterer creates a new log filterer instance of {{.Type}}, bound to a specific deployed contract. + func New{{.Type}}Filterer(address common.Address, filterer bind.ContractFilterer) (*{{.Type}}Filterer, error) { + contract, err := bind{{.Type}}(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &{{.Type}}Filterer{contract: contract}, nil + } + + // bind{{.Type}} binds a generic wrapper to an already deployed contract. + func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil + } + + // Call invokes the (constant) contract method with params as input values and + // sets the output to result. The result type might be a single field for simple + // returns, a slice of interfaces for anonymous returns and a struct for named + // returns. + func (_{{$contract.Type}} *{{$contract.Type}}Raw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Caller.contract.Call(opts, result, method, params...) + } + + // Transfer initiates a plain transaction to move funds to the contract, calling + // its default method if one is available. + func (_{{$contract.Type}} *{{$contract.Type}}Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.contract.Transfer(opts) + } + + // Transact invokes the (paid) contract method with params as input values. + func (_{{$contract.Type}} *{{$contract.Type}}Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.contract.Transact(opts, method, params...) + } + + // Call invokes the (constant) contract method with params as input values and + // sets the output to result. The result type might be a single field for simple + // returns, a slice of interfaces for anonymous returns and a struct for named + // returns. + func (_{{$contract.Type}} *{{$contract.Type}}CallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _{{$contract.Type}}.Contract.contract.Call(opts, result, method, params...) + } + + // Transfer initiates a plain transaction to move funds to the contract, calling + // its default method if one is available. + func (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.contract.Transfer(opts) + } + + // Transact invokes the (paid) contract method with params as input values. + func (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.contract.Transact(opts, method, params...) + } + + {{range .Structs}} + // {{.Name}} is an auto generated low-level Go binding around an user-defined struct. + type {{.Name}} struct { + {{range $field := .Fields}} + {{$field.Name}} {{$field.Type}}{{end}} + } + {{end}} + + {{range .Calls}} + // {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Caller) {{.Normalized.Name}}(opts *bind.CallOpts {{range .Normalized.Inputs}}, {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} },{{else}}{{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}}{{end}} error) { + {{if .Structured}}ret := new(struct{ + {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}} + {{end}} + }){{else}}var ( + {{range $i, $_ := .Normalized.Outputs}}ret{{$i}} = new({{bindtype .Type $structs}}) + {{end}} + ){{end}} + out := {{if .Structured}}ret{{else}}{{if eq (len .Normalized.Outputs) 1}}ret0{{else}}&[]interface{}{ + {{range $i, $_ := .Normalized.Outputs}}ret{{$i}}, + {{end}} + }{{end}}{{end}} + err := _{{$contract.Type}}.contract.Call(opts, out, "{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + return {{if .Structured}}*ret,{{else}}{{range $i, $_ := .Normalized.Outputs}}*ret{{$i}},{{end}}{{end}} err + } + + // {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Session) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} }, {{else}} {{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}} {{end}} error) { + return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.CallOpts {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + } + + // {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}CallerSession) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} }, {{else}} {{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}} {{end}} error) { + return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.CallOpts {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + } + {{end}} + + {{range .Transacts}} + // {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Transactor) {{.Normalized.Name}}(opts *bind.TransactOpts {{range .Normalized.Inputs}}, {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) { + return _{{$contract.Type}}.contract.Transact(opts, "{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}}) + } + + // {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Session) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}}) + } + + // {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatmethod .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}TransactorSession) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}}) + } + {{end}} + + {{range .Events}} + // {{$contract.Type}}{{.Normalized.Name}}Iterator is returned from Filter{{.Normalized.Name}} and is used to iterate over the raw logs and unpacked data for {{.Normalized.Name}} events raised by the {{$contract.Type}} contract. + type {{$contract.Type}}{{.Normalized.Name}}Iterator struct { + Event *{{$contract.Type}}{{.Normalized.Name}} // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration + } + // Next advances the iterator to the subsequent event, returning whether there + // are any more events found. In case of a retrieval or parsing error, false is + // returned and Error() can be queried for the exact failure. + func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Next() bool { + // If the iterator failed, stop iterating + if (it.fail != nil) { + return false + } + // If the iterator completed, deliver directly whatever's available + if (it.done) { + select { + case log := <-it.logs: + it.Event = new({{$contract.Type}}{{.Normalized.Name}}) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new({{$contract.Type}}{{.Normalized.Name}}) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } + } + // Error returns any retrieval or parsing error occurred during filtering. + func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Error() error { + return it.fail + } + // Close terminates the iteration process, releasing any pending underlying + // resources. + func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Close() error { + it.sub.Unsubscribe() + return nil + } + + // {{$contract.Type}}{{.Normalized.Name}} represents a {{.Normalized.Name}} event raised by the {{$contract.Type}} contract. + type {{$contract.Type}}{{.Normalized.Name}} struct { {{range .Normalized.Inputs}} + {{capitalise .Name}} {{if .Indexed}}{{bindtopictype .Type $structs}}{{else}}{{bindtype .Type $structs}}{{end}}; {{end}} + Raw types.Log // Blockchain specific contextual infos + } + + // Filter{{.Normalized.Name}} is a free log retrieval operation binding the contract event 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatevent .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Filter{{.Normalized.Name}}(opts *bind.FilterOpts{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}} []{{bindtype .Type $structs}}{{end}}{{end}}) (*{{$contract.Type}}{{.Normalized.Name}}Iterator, error) { + {{range .Normalized.Inputs}} + {{if .Indexed}}var {{.Name}}Rule []interface{} + for _, {{.Name}}Item := range {{.Name}} { + {{.Name}}Rule = append({{.Name}}Rule, {{.Name}}Item) + }{{end}}{{end}} + + logs, sub, err := _{{$contract.Type}}.contract.FilterLogs(opts, "{{.Original.Name}}"{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}}Rule{{end}}{{end}}) + if err != nil { + return nil, err + } + return &{{$contract.Type}}{{.Normalized.Name}}Iterator{contract: _{{$contract.Type}}.contract, event: "{{.Original.Name}}", logs: logs, sub: sub}, nil + } + + // Watch{{.Normalized.Name}} is a free log subscription operation binding the contract event 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{formatevent .Original $structs}} + func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Watch{{.Normalized.Name}}(opts *bind.WatchOpts, sink chan<- *{{$contract.Type}}{{.Normalized.Name}}{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}} []{{bindtype .Type $structs}}{{end}}{{end}}) (event.Subscription, error) { + {{range .Normalized.Inputs}} + {{if .Indexed}}var {{.Name}}Rule []interface{} + for _, {{.Name}}Item := range {{.Name}} { + {{.Name}}Rule = append({{.Name}}Rule, {{.Name}}Item) + }{{end}}{{end}} + + logs, sub, err := _{{$contract.Type}}.contract.WatchLogs(opts, "{{.Original.Name}}"{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}}Rule{{end}}{{end}}) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new({{$contract.Type}}{{.Normalized.Name}}) + if err := _{{$contract.Type}}.contract.UnpackLog(event, "{{.Original.Name}}", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil + } + + // Parse{{.Normalized.Name}} is a log parse operation binding the contract event 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{.Original.String}} + func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Parse{{.Normalized.Name}}(log types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) { + event := new({{$contract.Type}}{{.Normalized.Name}}) + if err := _{{$contract.Type}}.contract.UnpackLog(event, "{{.Original.Name}}", log); err != nil { + return nil, err + } + return event, nil + } + + {{end}} +{{end}} +` + +// tmplSourceJava is the Java source template use to generate the contract binding +// based on. +const tmplSourceJava = ` +// This file is an automatically generated Java binding. Do not modify as any +// change will likely be lost upon the next re-generation! + +package {{.Package}}; + +import org.ethereum.geth.*; +import java.util.*; + +{{range $contract := .Contracts}} +{{$structs := $contract.Structs}} +{{if not .Library}}public {{end}}class {{.Type}} { + // ABI is the input ABI used to generate the binding from. + public final static String ABI = "{{.InputABI}}"; + {{if $contract.FuncSigs}} + // {{.Type}}FuncSigs maps the 4-byte function signature to its string representation. + public final static Map {{.Type}}FuncSigs; + static { + Hashtable temp = new Hashtable(); + {{range $strsig, $binsig := .FuncSigs}}temp.put("{{$binsig}}", "{{$strsig}}"); + {{end}} + {{.Type}}FuncSigs = Collections.unmodifiableMap(temp); + } + {{end}} + {{if .InputBin}} + // BYTECODE is the compiled bytecode used for deploying new contracts. + public final static String BYTECODE = "0x{{.InputBin}}"; + + // deploy deploys a new Ethereum contract, binding an instance of {{.Type}} to it. + public static {{.Type}} deploy(TransactOpts auth, EthereumClient client{{range .Constructor.Inputs}}, {{bindtype .Type $structs}} {{.Name}}{{end}}) throws Exception { + Interfaces args = Geth.newInterfaces({{(len .Constructor.Inputs)}}); + String bytecode = BYTECODE; + {{if .Libraries}} + + // "link" contract to dependent libraries by deploying them first. + {{range $pattern, $name := .Libraries}} + {{capitalise $name}} {{decapitalise $name}}Inst = {{capitalise $name}}.deploy(auth, client); + bytecode = bytecode.replace("__${{$pattern}}$__", {{decapitalise $name}}Inst.Address.getHex().substring(2)); + {{end}} + {{end}} + {{range $index, $element := .Constructor.Inputs}}Interface arg{{$index}} = Geth.newInterface();arg{{$index}}.set{{namedtype (bindtype .Type $structs) .Type}}({{.Name}});args.set({{$index}},arg{{$index}}); + {{end}} + return new {{.Type}}(Geth.deployContract(auth, ABI, Geth.decodeFromHex(bytecode), client, args)); + } + + // Internal constructor used by contract deployment. + private {{.Type}}(BoundContract deployment) { + this.Address = deployment.getAddress(); + this.Deployer = deployment.getDeployer(); + this.Contract = deployment; + } + {{end}} + + // Ethereum address where this contract is located at. + public final Address Address; + + // Ethereum transaction in which this contract was deployed (if known!). + public final Transaction Deployer; + + // Contract instance bound to a blockchain address. + private final BoundContract Contract; + + // Creates a new instance of {{.Type}}, bound to a specific deployed contract. + public {{.Type}}(Address address, EthereumClient client) throws Exception { + this(Geth.bindContract(address, ABI, client)); + } + + {{range .Calls}} + {{if gt (len .Normalized.Outputs) 1}} + // {{capitalise .Normalized.Name}}Results is the output of a call to {{.Normalized.Name}}. + public class {{capitalise .Normalized.Name}}Results { + {{range $index, $item := .Normalized.Outputs}}public {{bindtype .Type $structs}} {{if ne .Name ""}}{{.Name}}{{else}}Return{{$index}}{{end}}; + {{end}} + } + {{end}} + + // {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{.Original.String}} + public {{if gt (len .Normalized.Outputs) 1}}{{capitalise .Normalized.Name}}Results{{else}}{{range .Normalized.Outputs}}{{bindtype .Type $structs}}{{end}}{{end}} {{.Normalized.Name}}(CallOpts opts{{range .Normalized.Inputs}}, {{bindtype .Type $structs}} {{.Name}}{{end}}) throws Exception { + Interfaces args = Geth.newInterfaces({{(len .Normalized.Inputs)}}); + {{range $index, $item := .Normalized.Inputs}}Interface arg{{$index}} = Geth.newInterface();arg{{$index}}.set{{namedtype (bindtype .Type $structs) .Type}}({{.Name}});args.set({{$index}},arg{{$index}}); + {{end}} + + Interfaces results = Geth.newInterfaces({{(len .Normalized.Outputs)}}); + {{range $index, $item := .Normalized.Outputs}}Interface result{{$index}} = Geth.newInterface(); result{{$index}}.setDefault{{namedtype (bindtype .Type $structs) .Type}}(); results.set({{$index}}, result{{$index}}); + {{end}} + + if (opts == null) { + opts = Geth.newCallOpts(); + } + this.Contract.call(opts, results, "{{.Original.Name}}", args); + {{if gt (len .Normalized.Outputs) 1}} + {{capitalise .Normalized.Name}}Results result = new {{capitalise .Normalized.Name}}Results(); + {{range $index, $item := .Normalized.Outputs}}result.{{if ne .Name ""}}{{.Name}}{{else}}Return{{$index}}{{end}} = results.get({{$index}}).get{{namedtype (bindtype .Type $structs) .Type}}(); + {{end}} + return result; + {{else}}{{range .Normalized.Outputs}}return results.get(0).get{{namedtype (bindtype .Type $structs) .Type}}();{{end}} + {{end}} + } + {{end}} + + {{range .Transacts}} + // {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.Id}}. + // + // Solidity: {{.Original.String}} + public Transaction {{.Normalized.Name}}(TransactOpts opts{{range .Normalized.Inputs}}, {{bindtype .Type $structs}} {{.Name}}{{end}}) throws Exception { + Interfaces args = Geth.newInterfaces({{(len .Normalized.Inputs)}}); + {{range $index, $item := .Normalized.Inputs}}Interface arg{{$index}} = Geth.newInterface();arg{{$index}}.set{{namedtype (bindtype .Type $structs) .Type}}({{.Name}});args.set({{$index}},arg{{$index}}); + {{end}} + return this.Contract.transact(opts, "{{.Original.Name}}" , args); + } + {{end}} +} +{{end}} +` diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/reflect.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/reflect.go new file mode 100644 index 00000000..73ca8fa2 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/reflect.go @@ -0,0 +1,226 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package abi + +import ( + "fmt" + "reflect" + "strings" +) + +// indirect recursively dereferences the value until it either gets the value +// or finds a big.Int +func indirect(v reflect.Value) reflect.Value { + if v.Kind() == reflect.Ptr && v.Elem().Type() != derefbigT { + return indirect(v.Elem()) + } + return v +} + +// indirectInterfaceOrPtr recursively dereferences the value until value is not interface. +func indirectInterfaceOrPtr(v reflect.Value) reflect.Value { + if (v.Kind() == reflect.Interface || v.Kind() == reflect.Ptr) && v.Elem().IsValid() { + return indirect(v.Elem()) + } + return v +} + +// reflectIntKind returns the reflect using the given size and +// unsignedness. +func reflectIntKindAndType(unsigned bool, size int) (reflect.Kind, reflect.Type) { + switch size { + case 8: + if unsigned { + return reflect.Uint8, uint8T + } + return reflect.Int8, int8T + case 16: + if unsigned { + return reflect.Uint16, uint16T + } + return reflect.Int16, int16T + case 32: + if unsigned { + return reflect.Uint32, uint32T + } + return reflect.Int32, int32T + case 64: + if unsigned { + return reflect.Uint64, uint64T + } + return reflect.Int64, int64T + } + return reflect.Ptr, bigT +} + +// mustArrayToBytesSlice creates a new byte slice with the exact same size as value +// and copies the bytes in value to the new slice. +func mustArrayToByteSlice(value reflect.Value) reflect.Value { + slice := reflect.MakeSlice(reflect.TypeOf([]byte{}), value.Len(), value.Len()) + reflect.Copy(slice, value) + return slice +} + +// set attempts to assign src to dst by either setting, copying or otherwise. +// +// set is a bit more lenient when it comes to assignment and doesn't force an as +// strict ruleset as bare `reflect` does. +func set(dst, src reflect.Value) error { + dstType, srcType := dst.Type(), src.Type() + switch { + case dstType.Kind() == reflect.Interface && dst.Elem().IsValid(): + return set(dst.Elem(), src) + case dstType.Kind() == reflect.Ptr && dstType.Elem() != derefbigT: + return set(dst.Elem(), src) + case srcType.AssignableTo(dstType) && dst.CanSet(): + dst.Set(src) + case dstType.Kind() == reflect.Slice && srcType.Kind() == reflect.Slice: + return setSlice(dst, src) + default: + return fmt.Errorf("abi: cannot unmarshal %v in to %v", src.Type(), dst.Type()) + } + return nil +} + +// setSlice attempts to assign src to dst when slices are not assignable by default +// e.g. src: [][]byte -> dst: [][15]byte +func setSlice(dst, src reflect.Value) error { + slice := reflect.MakeSlice(dst.Type(), src.Len(), src.Len()) + for i := 0; i < src.Len(); i++ { + v := src.Index(i) + reflect.Copy(slice.Index(i), v) + } + + dst.Set(slice) + return nil +} + +// requireAssignable assures that `dest` is a pointer and it's not an interface. +func requireAssignable(dst, src reflect.Value) error { + if dst.Kind() != reflect.Ptr && dst.Kind() != reflect.Interface { + return fmt.Errorf("abi: cannot unmarshal %v into %v", src.Type(), dst.Type()) + } + return nil +} + +// requireUnpackKind verifies preconditions for unpacking `args` into `kind` +func requireUnpackKind(v reflect.Value, t reflect.Type, k reflect.Kind, + args Arguments) error { + + switch k { + case reflect.Struct: + case reflect.Slice, reflect.Array: + if minLen := args.LengthNonIndexed(); v.Len() < minLen { + return fmt.Errorf("abi: insufficient number of elements in the list/array for unpack, want %d, got %d", + minLen, v.Len()) + } + default: + return fmt.Errorf("abi: cannot unmarshal tuple into %v", t) + } + return nil +} + +// mapArgNamesToStructFields maps a slice of argument names to struct fields. +// first round: for each Exportable field that contains a `abi:""` tag +// and this field name exists in the given argument name list, pair them together. +// second round: for each argument name that has not been already linked, +// find what variable is expected to be mapped into, if it exists and has not been +// used, pair them. +// Note this function assumes the given value is a struct value. +func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[string]string, error) { + typ := value.Type() + + abi2struct := make(map[string]string) + struct2abi := make(map[string]string) + + // first round ~~~ + for i := 0; i < typ.NumField(); i++ { + structFieldName := typ.Field(i).Name + + // skip private struct fields. + if structFieldName[:1] != strings.ToUpper(structFieldName[:1]) { + continue + } + // skip fields that have no abi:"" tag. + var ok bool + var tagName string + if tagName, ok = typ.Field(i).Tag.Lookup("abi"); !ok { + continue + } + // check if tag is empty. + if tagName == "" { + return nil, fmt.Errorf("struct: abi tag in '%s' is empty", structFieldName) + } + // check which argument field matches with the abi tag. + found := false + for _, arg := range argNames { + if arg == tagName { + if abi2struct[arg] != "" { + return nil, fmt.Errorf("struct: abi tag in '%s' already mapped", structFieldName) + } + // pair them + abi2struct[arg] = structFieldName + struct2abi[structFieldName] = arg + found = true + } + } + // check if this tag has been mapped. + if !found { + return nil, fmt.Errorf("struct: abi tag '%s' defined but not found in abi", tagName) + } + } + + // second round ~~~ + for _, argName := range argNames { + + structFieldName := ToCamelCase(argName) + + if structFieldName == "" { + return nil, fmt.Errorf("abi: purely underscored output cannot unpack to struct") + } + + // this abi has already been paired, skip it... unless there exists another, yet unassigned + // struct field with the same field name. If so, raise an error: + // abi: [ { "name": "value" } ] + // struct { Value *big.Int , Value1 *big.Int `abi:"value"`} + if abi2struct[argName] != "" { + if abi2struct[argName] != structFieldName && + struct2abi[structFieldName] == "" && + value.FieldByName(structFieldName).IsValid() { + return nil, fmt.Errorf("abi: multiple variables maps to the same abi field '%s'", argName) + } + continue + } + + // return an error if this struct field has already been paired. + if struct2abi[structFieldName] != "" { + return nil, fmt.Errorf("abi: multiple outputs mapping to the same struct field '%s'", structFieldName) + } + + if value.FieldByName(structFieldName).IsValid() { + // pair them + abi2struct[argName] = structFieldName + struct2abi[structFieldName] = argName + } else { + // not paired, but annotate as used, to detect cases like + // abi : [ { "name": "value" }, { "name": "_value" } ] + // struct { Value *big.Int } + struct2abi[structFieldName] = argName + } + } + return abi2struct, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/type.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/type.go new file mode 100644 index 00000000..597d3143 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/type.go @@ -0,0 +1,348 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package abi + +import ( + "errors" + "fmt" + "reflect" + "regexp" + "strconv" + "strings" +) + +// Type enumerator +const ( + IntTy byte = iota + UintTy + BoolTy + StringTy + SliceTy + ArrayTy + TupleTy + AddressTy + FixedBytesTy + BytesTy + HashTy + FixedPointTy + FunctionTy +) + +// Type is the reflection of the supported argument type +type Type struct { + Elem *Type + Kind reflect.Kind + Type reflect.Type + Size int + T byte // Our own type checking + + stringKind string // holds the unparsed string for deriving signatures + + // Tuple relative fields + TupleElems []*Type // Type information of all tuple fields + TupleRawNames []string // Raw field name of all tuple fields +} + +var ( + // typeRegex parses the abi sub types + typeRegex = regexp.MustCompile("([a-zA-Z]+)(([0-9]+)(x([0-9]+))?)?") +) + +// NewType creates a new reflection type of abi type given in t. +func NewType(t string, components []ArgumentMarshaling) (typ Type, err error) { + // check that array brackets are equal if they exist + if strings.Count(t, "[") != strings.Count(t, "]") { + return Type{}, fmt.Errorf("invalid arg type in abi") + } + typ.stringKind = t + + // if there are brackets, get ready to go into slice/array mode and + // recursively create the type + if strings.Count(t, "[") != 0 { + i := strings.LastIndex(t, "[") + // recursively embed the type + embeddedType, err := NewType(t[:i], components) + if err != nil { + return Type{}, err + } + // grab the last cell and create a type from there + sliced := t[i:] + // grab the slice size with regexp + re := regexp.MustCompile("[0-9]+") + intz := re.FindAllString(sliced, -1) + + if len(intz) == 0 { + // is a slice + typ.T = SliceTy + typ.Kind = reflect.Slice + typ.Elem = &embeddedType + typ.Type = reflect.SliceOf(embeddedType.Type) + typ.stringKind = embeddedType.stringKind + sliced + } else if len(intz) == 1 { + // is a array + typ.T = ArrayTy + typ.Kind = reflect.Array + typ.Elem = &embeddedType + typ.Size, err = strconv.Atoi(intz[0]) + if err != nil { + return Type{}, fmt.Errorf("abi: error parsing variable size: %v", err) + } + typ.Type = reflect.ArrayOf(typ.Size, embeddedType.Type) + typ.stringKind = embeddedType.stringKind + sliced + } else { + return Type{}, fmt.Errorf("invalid formatting of array type") + } + return typ, err + } + // parse the type and size of the abi-type. + matches := typeRegex.FindAllStringSubmatch(t, -1) + if len(matches) == 0 { + return Type{}, fmt.Errorf("invalid type '%v'", t) + } + parsedType := matches[0] + + // varSize is the size of the variable + var varSize int + if len(parsedType[3]) > 0 { + var err error + varSize, err = strconv.Atoi(parsedType[2]) + if err != nil { + return Type{}, fmt.Errorf("abi: error parsing variable size: %v", err) + } + } else { + if parsedType[0] == "uint" || parsedType[0] == "int" { + // this should fail because it means that there's something wrong with + // the abi type (the compiler should always format it to the size...always) + return Type{}, fmt.Errorf("unsupported arg type: %s", t) + } + } + // varType is the parsed abi type + switch varType := parsedType[1]; varType { + case "int": + typ.Kind, typ.Type = reflectIntKindAndType(false, varSize) + typ.Size = varSize + typ.T = IntTy + case "uint": + typ.Kind, typ.Type = reflectIntKindAndType(true, varSize) + typ.Size = varSize + typ.T = UintTy + case "bool": + typ.Kind = reflect.Bool + typ.T = BoolTy + typ.Type = reflect.TypeOf(bool(false)) + case "address": + typ.Kind = reflect.Array + typ.Type = addressT + typ.Size = 20 + typ.T = AddressTy + case "string": + typ.Kind = reflect.String + typ.Type = reflect.TypeOf("") + typ.T = StringTy + case "bytes": + if varSize == 0 { + typ.T = BytesTy + typ.Kind = reflect.Slice + typ.Type = reflect.SliceOf(reflect.TypeOf(byte(0))) + } else { + typ.T = FixedBytesTy + typ.Kind = reflect.Array + typ.Size = varSize + typ.Type = reflect.ArrayOf(varSize, reflect.TypeOf(byte(0))) + } + case "tuple": + var ( + fields []reflect.StructField + elems []*Type + names []string + expression string // canonical parameter expression + ) + expression += "(" + for idx, c := range components { + cType, err := NewType(c.Type, c.Components) + if err != nil { + return Type{}, err + } + if ToCamelCase(c.Name) == "" { + return Type{}, errors.New("abi: purely anonymous or underscored field is not supported") + } + fields = append(fields, reflect.StructField{ + Name: ToCamelCase(c.Name), // reflect.StructOf will panic for any exported field. + Type: cType.Type, + Tag: reflect.StructTag("json:\"" + c.Name + "\""), + }) + elems = append(elems, &cType) + names = append(names, c.Name) + expression += cType.stringKind + if idx != len(components)-1 { + expression += "," + } + } + expression += ")" + typ.Kind = reflect.Struct + typ.Type = reflect.StructOf(fields) + typ.TupleElems = elems + typ.TupleRawNames = names + typ.T = TupleTy + typ.stringKind = expression + case "function": + typ.Kind = reflect.Array + typ.T = FunctionTy + typ.Size = 24 + typ.Type = reflect.ArrayOf(24, reflect.TypeOf(byte(0))) + default: + return Type{}, fmt.Errorf("unsupported arg type: %s", t) + } + + return +} + +// String implements Stringer +func (t Type) String() (out string) { + return t.stringKind +} + +func (t Type) pack(v reflect.Value) ([]byte, error) { + // dereference pointer first if it's a pointer + v = indirect(v) + if err := typeCheck(t, v); err != nil { + return nil, err + } + + switch t.T { + case SliceTy, ArrayTy: + var ret []byte + + if t.requiresLengthPrefix() { + // append length + ret = append(ret, packNum(reflect.ValueOf(v.Len()))...) + } + + // calculate offset if any + offset := 0 + offsetReq := isDynamicType(*t.Elem) + if offsetReq { + offset = getTypeSize(*t.Elem) * v.Len() + } + var tail []byte + for i := 0; i < v.Len(); i++ { + val, err := t.Elem.pack(v.Index(i)) + if err != nil { + return nil, err + } + if !offsetReq { + ret = append(ret, val...) + continue + } + ret = append(ret, packNum(reflect.ValueOf(offset))...) + offset += len(val) + tail = append(tail, val...) + } + return append(ret, tail...), nil + case TupleTy: + // (T1,...,Tk) for k >= 0 and any types T1, …, Tk + // enc(X) = head(X(1)) ... head(X(k)) tail(X(1)) ... tail(X(k)) + // where X = (X(1), ..., X(k)) and head and tail are defined for Ti being a static + // type as + // head(X(i)) = enc(X(i)) and tail(X(i)) = "" (the empty string) + // and as + // head(X(i)) = enc(len(head(X(1)) ... head(X(k)) tail(X(1)) ... tail(X(i-1)))) + // tail(X(i)) = enc(X(i)) + // otherwise, i.e. if Ti is a dynamic type. + fieldmap, err := mapArgNamesToStructFields(t.TupleRawNames, v) + if err != nil { + return nil, err + } + // Calculate prefix occupied size. + offset := 0 + for _, elem := range t.TupleElems { + offset += getTypeSize(*elem) + } + var ret, tail []byte + for i, elem := range t.TupleElems { + field := v.FieldByName(fieldmap[t.TupleRawNames[i]]) + if !field.IsValid() { + return nil, fmt.Errorf("field %s for tuple not found in the given struct", t.TupleRawNames[i]) + } + val, err := elem.pack(field) + if err != nil { + return nil, err + } + if isDynamicType(*elem) { + ret = append(ret, packNum(reflect.ValueOf(offset))...) + tail = append(tail, val...) + offset += len(val) + } else { + ret = append(ret, val...) + } + } + return append(ret, tail...), nil + + default: + return packElement(t, v), nil + } +} + +// requireLengthPrefix returns whether the type requires any sort of length +// prefixing. +func (t Type) requiresLengthPrefix() bool { + return t.T == StringTy || t.T == BytesTy || t.T == SliceTy +} + +// isDynamicType returns true if the type is dynamic. +// The following types are called “dynamic”: +// * bytes +// * string +// * T[] for any T +// * T[k] for any dynamic T and any k >= 0 +// * (T1,...,Tk) if Ti is dynamic for some 1 <= i <= k +func isDynamicType(t Type) bool { + if t.T == TupleTy { + for _, elem := range t.TupleElems { + if isDynamicType(*elem) { + return true + } + } + return false + } + return t.T == StringTy || t.T == BytesTy || t.T == SliceTy || (t.T == ArrayTy && isDynamicType(*t.Elem)) +} + +// getTypeSize returns the size that this type needs to occupy. +// We distinguish static and dynamic types. Static types are encoded in-place +// and dynamic types are encoded at a separately allocated location after the +// current block. +// So for a static variable, the size returned represents the size that the +// variable actually occupies. +// For a dynamic variable, the returned size is fixed 32 bytes, which is used +// to store the location reference for actual value storage. +func getTypeSize(t Type) int { + if t.T == ArrayTy && !isDynamicType(*t.Elem) { + // Recursively calculate type size if it is a nested array + if t.Elem.T == ArrayTy { + return t.Size * getTypeSize(*t.Elem) + } + return t.Size * 32 + } else if t.T == TupleTy && !isDynamicType(t) { + total := 0 + for _, elem := range t.TupleElems { + total += getTypeSize(*elem) + } + return total + } + return 32 +} diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/external/backend.go b/vendor/github.com/ethereum/go-ethereum/accounts/external/backend.go index 23037f52..705c9872 100644 --- a/vendor/github.com/ethereum/go-ethereum/accounts/external/backend.go +++ b/vendor/github.com/ethereum/go-ethereum/accounts/external/backend.go @@ -182,18 +182,21 @@ func (api *ExternalSigner) SignText(account accounts.Account, text []byte) ([]by func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) { res := ethapi.SignTransactionResult{} - to := common.NewMixedcaseAddress(*tx.To()) data := hexutil.Bytes(tx.Data()) + var to *common.MixedcaseAddress + if tx.To() != nil { + t := common.NewMixedcaseAddress(*tx.To()) + to = &t + } args := &core.SendTxArgs{ Data: &data, Nonce: hexutil.Uint64(tx.Nonce()), Value: hexutil.Big(*tx.Value()), Gas: hexutil.Uint64(tx.Gas()), GasPrice: hexutil.Big(*tx.GasPrice()), - To: &to, + To: to, From: common.NewMixedcaseAddress(account.Address), } - if err := api.client.Call(&res, "account_signTransaction", args); err != nil { return nil, err } diff --git a/vendor/github.com/ethereum/go-ethereum/appveyor.yml b/vendor/github.com/ethereum/go-ethereum/appveyor.yml index d3ed3785..8f840c19 100644 --- a/vendor/github.com/ethereum/go-ethereum/appveyor.yml +++ b/vendor/github.com/ethereum/go-ethereum/appveyor.yml @@ -23,8 +23,8 @@ environment: install: - git submodule update --init - rmdir C:\go /s /q - - appveyor DownloadFile https://dl.google.com/go/go1.12.5.windows-%GETH_ARCH%.zip - - 7z x go1.12.5.windows-%GETH_ARCH%.zip -y -oC:\ > NUL + - appveyor DownloadFile https://dl.google.com/go/go1.12.7.windows-%GETH_ARCH%.zip + - 7z x go1.12.7.windows-%GETH_ARCH%.zip -y -oC:\ > NUL - go version - gcc --version diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/abigen/main.go b/vendor/github.com/ethereum/go-ethereum/cmd/abigen/main.go index 461c2946..6af34c5f 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/abigen/main.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/abigen/main.go @@ -18,97 +18,199 @@ package main import ( "encoding/json" - "flag" "fmt" "io/ioutil" "os" "strings" "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common/compiler" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "gopkg.in/urfave/cli.v1" +) + +const ( + commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...] +{{if .Description}}{{.Description}} +{{end}}{{if .Subcommands}} +SUBCOMMANDS: + {{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} + {{end}}{{end}}{{if .Flags}} +OPTIONS: +{{range $.Flags}}{{"\t"}}{{.}} +{{end}} +{{end}}` ) var ( - abiFlag = flag.String("abi", "", "Path to the Ethereum contract ABI json to bind, - for STDIN") - binFlag = flag.String("bin", "", "Path to the Ethereum contract bytecode (generate deploy method)") - typFlag = flag.String("type", "", "Struct name for the binding (default = package name)") + // Git SHA1 commit hash of the release (set via linker flags) + gitCommit = "" + gitDate = "" - solFlag = flag.String("sol", "", "Path to the Ethereum contract Solidity source to build and bind") - solcFlag = flag.String("solc", "solc", "Solidity compiler to use if source builds are requested") - excFlag = flag.String("exc", "", "Comma separated types to exclude from binding") + app *cli.App - vyFlag = flag.String("vy", "", "Path to the Ethereum contract Vyper source to build and bind") - vyperFlag = flag.String("vyper", "vyper", "Vyper compiler to use if source builds are requested") - - pkgFlag = flag.String("pkg", "", "Package name to generate the binding into") - outFlag = flag.String("out", "", "Output file for the generated binding (default = stdout)") - langFlag = flag.String("lang", "go", "Destination language for the bindings (go, java, objc)") + // Flags needed by abigen + abiFlag = cli.StringFlag{ + Name: "abi", + Usage: "Path to the Ethereum contract ABI json to bind, - for STDIN", + } + binFlag = cli.StringFlag{ + Name: "bin", + Usage: "Path to the Ethereum contract bytecode (generate deploy method)", + } + typeFlag = cli.StringFlag{ + Name: "type", + Usage: "Struct name for the binding (default = package name)", + } + jsonFlag = cli.StringFlag{ + Name: "combined-json", + Usage: "Path to the combined-json file generated by compiler", + } + solFlag = cli.StringFlag{ + Name: "sol", + Usage: "Path to the Ethereum contract Solidity source to build and bind", + } + solcFlag = cli.StringFlag{ + Name: "solc", + Usage: "Solidity compiler to use if source builds are requested", + Value: "solc", + } + vyFlag = cli.StringFlag{ + Name: "vy", + Usage: "Path to the Ethereum contract Vyper source to build and bind", + } + vyperFlag = cli.StringFlag{ + Name: "vyper", + Usage: "Vyper compiler to use if source builds are requested", + Value: "vyper", + } + excFlag = cli.StringFlag{ + Name: "exc", + Usage: "Comma separated types to exclude from binding", + } + pkgFlag = cli.StringFlag{ + Name: "pkg", + Usage: "Package name to generate the binding into", + } + outFlag = cli.StringFlag{ + Name: "out", + Usage: "Output file for the generated binding (default = stdout)", + } + langFlag = cli.StringFlag{ + Name: "lang", + Usage: "Destination language for the bindings (go, java, objc)", + Value: "go", + } ) -func main() { - // Parse and ensure all needed inputs are specified - flag.Parse() - - if *abiFlag == "" && *solFlag == "" && *vyFlag == "" { - fmt.Printf("No contract ABI (--abi), Solidity source (--sol), or Vyper source (--vy) specified\n") - os.Exit(-1) - } else if (*abiFlag != "" || *binFlag != "" || *typFlag != "") && (*solFlag != "" || *vyFlag != "") { - fmt.Printf("Contract ABI (--abi), bytecode (--bin) and type (--type) flags are mutually exclusive with the Solidity (--sol) and Vyper (--vy) flags\n") - os.Exit(-1) - } else if *solFlag != "" && *vyFlag != "" { - fmt.Printf("Solidity (--sol) and Vyper (--vy) flags are mutually exclusive\n") - os.Exit(-1) +func init() { + app = utils.NewApp(gitCommit, gitDate, "ethereum checkpoint helper tool") + app.Flags = []cli.Flag{ + abiFlag, + binFlag, + typeFlag, + jsonFlag, + solFlag, + solcFlag, + vyFlag, + vyperFlag, + excFlag, + pkgFlag, + outFlag, + langFlag, } - if *pkgFlag == "" { - fmt.Printf("No destination package specified (--pkg)\n") - os.Exit(-1) + app.Action = utils.MigrateFlags(abigen) + cli.CommandHelpTemplate = commandHelperTemplate +} + +func abigen(c *cli.Context) error { + utils.CheckExclusive(c, abiFlag, jsonFlag, solFlag, vyFlag) // Only one source can be selected. + if c.GlobalString(pkgFlag.Name) == "" { + utils.Fatalf("No destination package specified (--pkg)") } var lang bind.Lang - switch *langFlag { + switch c.GlobalString(langFlag.Name) { case "go": lang = bind.LangGo case "java": lang = bind.LangJava case "objc": lang = bind.LangObjC + utils.Fatalf("Objc binding generation is uncompleted") default: - fmt.Printf("Unsupported destination language \"%s\" (--lang)\n", *langFlag) - os.Exit(-1) + utils.Fatalf("Unsupported destination language \"%s\" (--lang)", c.GlobalString(langFlag.Name)) } // If the entire solidity code was specified, build and bind based on that var ( abis []string bins []string types []string + sigs []map[string]string + libs = make(map[string]string) ) - if *solFlag != "" || *vyFlag != "" || *abiFlag == "-" { + if c.GlobalString(abiFlag.Name) != "" { + // Load up the ABI, optional bytecode and type name from the parameters + var ( + abi []byte + err error + ) + input := c.GlobalString(abiFlag.Name) + if input == "-" { + abi, err = ioutil.ReadAll(os.Stdin) + } else { + abi, err = ioutil.ReadFile(input) + } + if err != nil { + utils.Fatalf("Failed to read input ABI: %v", err) + } + abis = append(abis, string(abi)) + + var bin []byte + if binFile := c.GlobalString(binFlag.Name); binFile != "" { + if bin, err = ioutil.ReadFile(binFile); err != nil { + utils.Fatalf("Failed to read input bytecode: %v", err) + } + if strings.Contains(string(bin), "//") { + utils.Fatalf("Contract has additional library references, please use other mode(e.g. --combined-json) to catch library infos") + } + } + bins = append(bins, string(bin)) + + kind := c.GlobalString(typeFlag.Name) + if kind == "" { + kind = c.GlobalString(pkgFlag.Name) + } + types = append(types, kind) + } else { // Generate the list of types to exclude from binding exclude := make(map[string]bool) - for _, kind := range strings.Split(*excFlag, ",") { + for _, kind := range strings.Split(c.GlobalString(excFlag.Name), ",") { exclude[strings.ToLower(kind)] = true } - - var contracts map[string]*compiler.Contract var err error + var contracts map[string]*compiler.Contract switch { - case *solFlag != "": - contracts, err = compiler.CompileSolidity(*solcFlag, *solFlag) + case c.GlobalIsSet(solFlag.Name): + contracts, err = compiler.CompileSolidity(c.GlobalString(solcFlag.Name), c.GlobalString(solFlag.Name)) if err != nil { - fmt.Printf("Failed to build Solidity contract: %v\n", err) - os.Exit(-1) + utils.Fatalf("Failed to build Solidity contract: %v", err) } - case *vyFlag != "": - contracts, err = compiler.CompileVyper(*vyperFlag, *vyFlag) + case c.GlobalIsSet(vyFlag.Name): + contracts, err = compiler.CompileVyper(c.GlobalString(vyperFlag.Name), c.GlobalString(vyFlag.Name)) if err != nil { - fmt.Printf("Failed to build Vyper contract: %v\n", err) - os.Exit(-1) + utils.Fatalf("Failed to build Vyper contract: %v", err) } - default: - contracts, err = contractsFromStdin() + case c.GlobalIsSet(jsonFlag.Name): + jsonOutput, err := ioutil.ReadFile(c.GlobalString(jsonFlag.Name)) if err != nil { - fmt.Printf("Failed to read input ABIs from STDIN: %v\n", err) - os.Exit(-1) + utils.Fatalf("Failed to read combined-json from compiler: %v", err) + } + contracts, err = compiler.ParseCombinedJSON(jsonOutput, "", "", "", "") + if err != nil { + utils.Fatalf("Failed to read contract information from json output: %v", err) } } // Gather all non-excluded contract for binding @@ -118,61 +220,39 @@ func main() { } abi, err := json.Marshal(contract.Info.AbiDefinition) // Flatten the compiler parse if err != nil { - fmt.Printf("Failed to parse ABIs from compiler output: %v\n", err) - os.Exit(-1) + utils.Fatalf("Failed to parse ABIs from compiler output: %v", err) } abis = append(abis, string(abi)) bins = append(bins, contract.Code) - + sigs = append(sigs, contract.Hashes) nameParts := strings.Split(name, ":") types = append(types, nameParts[len(nameParts)-1]) - } - } else { - // Otherwise load up the ABI, optional bytecode and type name from the parameters - abi, err := ioutil.ReadFile(*abiFlag) - if err != nil { - fmt.Printf("Failed to read input ABI: %v\n", err) - os.Exit(-1) + libPattern := crypto.Keccak256Hash([]byte(name)).String()[2:36] + libs[libPattern] = nameParts[len(nameParts)-1] } - abis = append(abis, string(abi)) - - var bin []byte - if *binFlag != "" { - if bin, err = ioutil.ReadFile(*binFlag); err != nil { - fmt.Printf("Failed to read input bytecode: %v\n", err) - os.Exit(-1) - } - } - bins = append(bins, string(bin)) - - kind := *typFlag - if kind == "" { - kind = *pkgFlag - } - types = append(types, kind) } // Generate the contract binding - code, err := bind.Bind(types, abis, bins, *pkgFlag, lang) + code, err := bind.Bind(types, abis, bins, sigs, c.GlobalString(pkgFlag.Name), lang, libs) if err != nil { - fmt.Printf("Failed to generate ABI binding: %v\n", err) - os.Exit(-1) + utils.Fatalf("Failed to generate ABI binding: %v", err) } // Either flush it out to a file or display on the standard output - if *outFlag == "" { + if !c.GlobalIsSet(outFlag.Name) { fmt.Printf("%s\n", code) - return + return nil } - if err := ioutil.WriteFile(*outFlag, []byte(code), 0600); err != nil { - fmt.Printf("Failed to write ABI binding: %v\n", err) - os.Exit(-1) + if err := ioutil.WriteFile(c.GlobalString(outFlag.Name), []byte(code), 0600); err != nil { + utils.Fatalf("Failed to write ABI binding: %v", err) } + return nil } -func contractsFromStdin() (map[string]*compiler.Contract, error) { - bytes, err := ioutil.ReadAll(os.Stdin) - if err != nil { - return nil, err +func main() { + log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) + + if err := app.Run(os.Args); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) } - return compiler.ParseCombinedJSON(bytes, "", "", "", "") } diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/common.go b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/common.go new file mode 100644 index 00000000..107cd1de --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/common.go @@ -0,0 +1,120 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "strconv" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/external" + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/contracts/checkpointoracle" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + "gopkg.in/urfave/cli.v1" +) + +// newClient creates a client with specified remote URL. +func newClient(ctx *cli.Context) *ethclient.Client { + client, err := ethclient.Dial(ctx.GlobalString(nodeURLFlag.Name)) + if err != nil { + utils.Fatalf("Failed to connect to Ethereum node: %v", err) + } + return client +} + +// newRPCClient creates a rpc client with specified node URL. +func newRPCClient(url string) *rpc.Client { + client, err := rpc.Dial(url) + if err != nil { + utils.Fatalf("Failed to connect to Ethereum node: %v", err) + } + return client +} + +// getContractAddr retrieves the register contract address through +// rpc request. +func getContractAddr(client *rpc.Client) common.Address { + var addr string + if err := client.Call(&addr, "les_getCheckpointContractAddress"); err != nil { + utils.Fatalf("Failed to fetch checkpoint oracle address: %v", err) + } + return common.HexToAddress(addr) +} + +// getCheckpoint retrieves the specified checkpoint or the latest one +// through rpc request. +func getCheckpoint(ctx *cli.Context, client *rpc.Client) *params.TrustedCheckpoint { + var checkpoint *params.TrustedCheckpoint + + if ctx.GlobalIsSet(indexFlag.Name) { + var result [3]string + index := uint64(ctx.GlobalInt64(indexFlag.Name)) + if err := client.Call(&result, "les_getCheckpoint", index); err != nil { + utils.Fatalf("Failed to get local checkpoint %v, please ensure the les API is exposed", err) + } + checkpoint = ¶ms.TrustedCheckpoint{ + SectionIndex: index, + SectionHead: common.HexToHash(result[0]), + CHTRoot: common.HexToHash(result[1]), + BloomRoot: common.HexToHash(result[2]), + } + } else { + var result [4]string + err := client.Call(&result, "les_latestCheckpoint") + if err != nil { + utils.Fatalf("Failed to get local checkpoint %v, please ensure the les API is exposed", err) + } + index, err := strconv.ParseUint(result[0], 0, 64) + if err != nil { + utils.Fatalf("Failed to parse checkpoint index %v", err) + } + checkpoint = ¶ms.TrustedCheckpoint{ + SectionIndex: index, + SectionHead: common.HexToHash(result[1]), + CHTRoot: common.HexToHash(result[2]), + BloomRoot: common.HexToHash(result[3]), + } + } + return checkpoint +} + +// newContract creates a registrar contract instance with specified +// contract address or the default contracts for mainnet or testnet. +func newContract(client *rpc.Client) (common.Address, *checkpointoracle.CheckpointOracle) { + addr := getContractAddr(client) + if addr == (common.Address{}) { + utils.Fatalf("No specified registrar contract address") + } + contract, err := checkpointoracle.NewCheckpointOracle(addr, ethclient.NewClient(client)) + if err != nil { + utils.Fatalf("Failed to setup registrar contract %s: %v", addr, err) + } + return addr, contract +} + +// newClefSigner sets up a clef backend and returns a clef transaction signer. +func newClefSigner(ctx *cli.Context) *bind.TransactOpts { + clef, err := external.NewExternalSigner(ctx.String(clefURLFlag.Name)) + if err != nil { + utils.Fatalf("Failed to create clef signer %v", err) + } + return bind.NewClefTransactor(clef, accounts.Account{Address: common.HexToAddress(ctx.String(signerFlag.Name))}) +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/exec.go b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/exec.go new file mode 100644 index 00000000..1ce975f4 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/exec.go @@ -0,0 +1,311 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "math/big" + "strings" + "time" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/contracts/checkpointoracle" + "github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" + "gopkg.in/urfave/cli.v1" +) + +var commandDeploy = cli.Command{ + Name: "deploy", + Usage: "Deploy a new checkpoint oracle contract", + Flags: []cli.Flag{ + nodeURLFlag, + clefURLFlag, + signerFlag, + signersFlag, + thresholdFlag, + }, + Action: utils.MigrateFlags(deploy), +} + +var commandSign = cli.Command{ + Name: "sign", + Usage: "Sign the checkpoint with the specified key", + Flags: []cli.Flag{ + nodeURLFlag, + clefURLFlag, + signerFlag, + indexFlag, + hashFlag, + oracleFlag, + }, + Action: utils.MigrateFlags(sign), +} + +var commandPublish = cli.Command{ + Name: "publish", + Usage: "Publish a checkpoint into the oracle", + Flags: []cli.Flag{ + nodeURLFlag, + clefURLFlag, + signerFlag, + indexFlag, + signaturesFlag, + }, + Action: utils.MigrateFlags(publish), +} + +// deploy deploys the checkpoint registrar contract. +// +// Note the network where the contract is deployed depends on +// the network where the connected node is located. +func deploy(ctx *cli.Context) error { + // Gather all the addresses that should be permitted to sign + var addrs []common.Address + for _, account := range strings.Split(ctx.String(signersFlag.Name), ",") { + if trimmed := strings.TrimSpace(account); !common.IsHexAddress(trimmed) { + utils.Fatalf("Invalid account in --signers: '%s'", trimmed) + } + addrs = append(addrs, common.HexToAddress(account)) + } + // Retrieve and validate the signing threshold + needed := ctx.Int(thresholdFlag.Name) + if needed == 0 || needed > len(addrs) { + utils.Fatalf("Invalid signature threshold %d", needed) + } + // Print a summary to ensure the user understands what they're signing + fmt.Printf("Deploying new checkpoint oracle:\n\n") + for i, addr := range addrs { + fmt.Printf("Admin %d => %s\n", i+1, addr.Hex()) + } + fmt.Printf("\nSignatures needed to publish: %d\n", needed) + + // setup clef signer, create an abigen transactor and an RPC client + transactor, client := newClefSigner(ctx), newClient(ctx) + + // Deploy the checkpoint oracle + fmt.Println("Sending deploy request to Clef...") + oracle, tx, _, err := contract.DeployCheckpointOracle(transactor, client, addrs, big.NewInt(int64(params.CheckpointFrequency)), + big.NewInt(int64(params.CheckpointProcessConfirmations)), big.NewInt(int64(needed))) + if err != nil { + utils.Fatalf("Failed to deploy checkpoint oracle %v", err) + } + log.Info("Deployed checkpoint oracle", "address", oracle, "tx", tx.Hash().Hex()) + + return nil +} + +// sign creates the signature for specific checkpoint +// with local key. Only contract admins have the permission to +// sign checkpoint. +func sign(ctx *cli.Context) error { + var ( + offline bool // The indicator whether we sign checkpoint by offline. + chash common.Hash + cindex uint64 + address common.Address + + node *rpc.Client + oracle *checkpointoracle.CheckpointOracle + ) + if !ctx.GlobalIsSet(nodeURLFlag.Name) { + // Offline mode signing + offline = true + if !ctx.IsSet(hashFlag.Name) { + utils.Fatalf("Please specify the checkpoint hash (--hash) to sign in offline mode") + } + chash = common.HexToHash(ctx.String(hashFlag.Name)) + + if !ctx.IsSet(indexFlag.Name) { + utils.Fatalf("Please specify checkpoint index (--index) to sign in offline mode") + } + cindex = ctx.Uint64(indexFlag.Name) + + if !ctx.IsSet(oracleFlag.Name) { + utils.Fatalf("Please specify oracle address (--oracle) to sign in offline mode") + } + address = common.HexToAddress(ctx.String(oracleFlag.Name)) + } else { + // Interactive mode signing, retrieve the data from the remote node + node = newRPCClient(ctx.GlobalString(nodeURLFlag.Name)) + + checkpoint := getCheckpoint(ctx, node) + chash, cindex, address = checkpoint.Hash(), checkpoint.SectionIndex, getContractAddr(node) + + // Check the validity of checkpoint + reqCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) + defer cancelFn() + + head, err := ethclient.NewClient(node).HeaderByNumber(reqCtx, nil) + if err != nil { + return err + } + num := head.Number.Uint64() + if num < ((cindex+1)*params.CheckpointFrequency + params.CheckpointProcessConfirmations) { + utils.Fatalf("Invalid future checkpoint") + } + _, oracle = newContract(node) + latest, _, h, err := oracle.Contract().GetLatestCheckpoint(nil) + if err != nil { + return err + } + if cindex < latest { + utils.Fatalf("Checkpoint is too old") + } + if cindex == latest && (latest != 0 || h.Uint64() != 0) { + utils.Fatalf("Stale checkpoint, latest registered %d, given %d", latest, cindex) + } + } + var ( + signature string + signer string + ) + // isAdmin checks whether the specified signer is admin. + isAdmin := func(addr common.Address) error { + signers, err := oracle.Contract().GetAllAdmin(nil) + if err != nil { + return err + } + for _, s := range signers { + if s == addr { + return nil + } + } + return fmt.Errorf("signer %v is not the admin", addr.Hex()) + } + // Print to the user the data thy are about to sign + fmt.Printf("Oracle => %s\n", address.Hex()) + fmt.Printf("Index %4d => %s\n", cindex, chash.Hex()) + + // Sign checkpoint in clef mode. + signer = ctx.String(signerFlag.Name) + + if !offline { + if err := isAdmin(common.HexToAddress(signer)); err != nil { + return err + } + } + clef := newRPCClient(ctx.String(clefURLFlag.Name)) + p := make(map[string]string) + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, cindex) + p["address"] = address.Hex() + p["message"] = hexutil.Encode(append(buf, chash.Bytes()...)) + + fmt.Println("Sending signing request to Clef...") + if err := clef.Call(&signature, "account_signData", accounts.MimetypeDataWithValidator, signer, p); err != nil { + utils.Fatalf("Failed to sign checkpoint, err %v", err) + } + fmt.Printf("Signer => %s\n", signer) + fmt.Printf("Signature => %s\n", signature) + return nil +} + +// sighash calculates the hash of the data to sign for the checkpoint oracle. +func sighash(index uint64, oracle common.Address, hash common.Hash) []byte { + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, index) + + data := append([]byte{0x19, 0x00}, append(oracle[:], append(buf, hash[:]...)...)...) + return crypto.Keccak256(data) +} + +// ecrecover calculates the sender address from a sighash and signature combo. +func ecrecover(sighash []byte, sig []byte) common.Address { + sig[64] -= 27 + defer func() { sig[64] += 27 }() + + signer, err := crypto.SigToPub(sighash, sig) + if err != nil { + utils.Fatalf("Failed to recover sender from signature %x: %v", sig, err) + } + return crypto.PubkeyToAddress(*signer) +} + +// publish registers the specified checkpoint which generated by connected node +// with a authorised private key. +func publish(ctx *cli.Context) error { + // Print the checkpoint oracle's current status to make sure we're interacting + // with the correct network and contract. + status(ctx) + + // Gather the signatures from the CLI + var sigs [][]byte + for _, sig := range strings.Split(ctx.String(signaturesFlag.Name), ",") { + trimmed := strings.TrimPrefix(strings.TrimSpace(sig), "0x") + if len(trimmed) != 130 { + utils.Fatalf("Invalid signature in --signature: '%s'", trimmed) + } else { + sigs = append(sigs, common.Hex2Bytes(trimmed)) + } + } + // Retrieve the checkpoint we want to sign to sort the signatures + var ( + client = newRPCClient(ctx.GlobalString(nodeURLFlag.Name)) + addr, oracle = newContract(client) + checkpoint = getCheckpoint(ctx, client) + sighash = sighash(checkpoint.SectionIndex, addr, checkpoint.Hash()) + ) + for i := 0; i < len(sigs); i++ { + for j := i + 1; j < len(sigs); j++ { + signerA := ecrecover(sighash, sigs[i]) + signerB := ecrecover(sighash, sigs[j]) + if bytes.Compare(signerA.Bytes(), signerB.Bytes()) > 0 { + sigs[i], sigs[j] = sigs[j], sigs[i] + } + } + } + // Retrieve recent header info to protect replay attack + reqCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) + defer cancelFn() + + head, err := ethclient.NewClient(client).HeaderByNumber(reqCtx, nil) + if err != nil { + return err + } + num := head.Number.Uint64() + recent, err := ethclient.NewClient(client).HeaderByNumber(reqCtx, big.NewInt(int64(num-128))) + if err != nil { + return err + } + // Print a summary of the operation that's going to be performed + fmt.Printf("Publishing %d => %s:\n\n", checkpoint.SectionIndex, checkpoint.Hash().Hex()) + for i, sig := range sigs { + fmt.Printf("Signer %d => %s\n", i+1, ecrecover(sighash, sig).Hex()) + } + fmt.Println() + fmt.Printf("Sentry number => %d\nSentry hash => %s\n", recent.Number, recent.Hash().Hex()) + + // Publish the checkpoint into the oracle + fmt.Println("Sending publish request to Clef...") + tx, err := oracle.RegisterCheckpoint(newClefSigner(ctx), checkpoint.SectionIndex, checkpoint.Hash().Bytes(), recent.Number, recent.Hash(), sigs) + if err != nil { + utils.Fatalf("Register contract failed %v", err) + } + log.Info("Successfully registered checkpoint", "tx", tx.Hash().Hex()) + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/main.go b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/main.go new file mode 100644 index 00000000..1fdec60a --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/main.go @@ -0,0 +1,117 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +// checkpoint-admin is a utility that can be used to query checkpoint information +// and register stable checkpoints into an oracle contract. +package main + +import ( + "fmt" + "os" + + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common/fdlimit" + "github.com/ethereum/go-ethereum/log" + "gopkg.in/urfave/cli.v1" +) + +const ( + commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...] +{{if .Description}}{{.Description}} +{{end}}{{if .Subcommands}} +SUBCOMMANDS: + {{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} + {{end}}{{end}}{{if .Flags}} +OPTIONS: +{{range $.Flags}}{{"\t"}}{{.}} +{{end}} +{{end}}` +) + +var ( + // Git SHA1 commit hash of the release (set via linker flags) + gitCommit = "" + gitDate = "" +) + +var app *cli.App + +func init() { + app = utils.NewApp(gitCommit, gitDate, "ethereum checkpoint helper tool") + app.Commands = []cli.Command{ + commandStatus, + commandDeploy, + commandSign, + commandPublish, + } + app.Flags = []cli.Flag{ + oracleFlag, + nodeURLFlag, + } + cli.CommandHelpTemplate = commandHelperTemplate +} + +// Commonly used command line flags. +var ( + indexFlag = cli.Int64Flag{ + Name: "index", + Usage: "Checkpoint index (query latest from remote node if not specified)", + } + hashFlag = cli.StringFlag{ + Name: "hash", + Usage: "Checkpoint hash (query latest from remote node if not specified)", + } + oracleFlag = cli.StringFlag{ + Name: "oracle", + Usage: "Checkpoint oracle address (query from remote node if not specified)", + } + thresholdFlag = cli.Int64Flag{ + Name: "threshold", + Usage: "Minimal number of signatures required to approve a checkpoint", + } + nodeURLFlag = cli.StringFlag{ + Name: "rpc", + Value: "http://localhost:8545", + Usage: "The rpc endpoint of a local or remote geth node", + } + clefURLFlag = cli.StringFlag{ + Name: "clef", + Value: "http://localhost:8550", + Usage: "The rpc endpoint of clef", + } + signerFlag = cli.StringFlag{ + Name: "signer", + Usage: "Signer address for clef signing", + } + signersFlag = cli.StringFlag{ + Name: "signers", + Usage: "Comma separated accounts of trusted checkpoint signers", + } + signaturesFlag = cli.StringFlag{ + Name: "signatures", + Usage: "Comma separated checkpoint signatures to submit", + } +) + +func main() { + log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) + fdlimit.Raise(2048) + + if err := app.Run(os.Args); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/status.go b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/status.go new file mode 100644 index 00000000..c134ec09 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/checkpoint-admin/status.go @@ -0,0 +1,61 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" + "gopkg.in/urfave/cli.v1" +) + +var commandStatus = cli.Command{ + Name: "status", + Usage: "Fetches the signers and checkpoint status of the oracle contract", + Flags: []cli.Flag{ + nodeURLFlag, + }, + Action: utils.MigrateFlags(status), +} + +// status fetches the admin list of specified registrar contract. +func status(ctx *cli.Context) error { + // Create a wrapper around the checkpoint oracle contract + addr, oracle := newContract(newRPCClient(ctx.GlobalString(nodeURLFlag.Name))) + fmt.Printf("Oracle => %s\n", addr.Hex()) + fmt.Println() + + // Retrieve the list of authorized signers (admins) + admins, err := oracle.Contract().GetAllAdmin(nil) + if err != nil { + return err + } + for i, admin := range admins { + fmt.Printf("Admin %d => %s\n", i+1, admin.Hex()) + } + fmt.Println() + + // Retrieve the latest checkpoint + index, checkpoint, height, err := oracle.Contract().GetLatestCheckpoint(nil) + if err != nil { + return err + } + fmt.Printf("Checkpoint (published at #%d) %d => %s\n", height, index, common.Hash(checkpoint).Hex()) + + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/README.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/README.md new file mode 100644 index 00000000..eeaee090 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/README.md @@ -0,0 +1,937 @@ +# Clef + +Clef can be used to sign transactions and data and is meant as a(n eventual) replacement for Geth's account management. This allows DApps to not depend on Geth's account management. When a DApp wants to sign data (or a transaction), it can send the content to Clef, which will then provide the user with context and asks for permission to sign the content. If the users grants the signing request, Clef will send the signature back to the DApp. + +This setup allows a DApp to connect to a remote Ethereum node and send transactions that are locally signed. This can help in situations when a DApp is connected to an untrusted remote Ethereum node, because a local one is not available, not synchronised with the chain, or is a node that has no built-in (or limited) account management. + +Clef can run as a daemon on the same machine, off a usb-stick like [USB armory](https://inversepath.com/usbarmory), or even a separate VM in a [QubesOS](https://www.qubes-os.org/) type setup. + +Check out the + +* [CLI tutorial](tutorial.md) for some concrete examples on how Clef works. +* [Setup docs](docs/setup.md) for infos on how to configure Clef on QubesOS or USB Armory. +* [Data types](datatypes.md) for details on the communication messages between Clef and an external UI. + +## Command line flags + +Clef accepts the following command line options: + +``` +COMMANDS: + init Initialize the signer, generate secret storage + attest Attest that a js-file is to be used + setpw Store a credential for a keystore file + delpw Remove a credential for a keystore file + gendoc Generate documentation about json-rpc format + help Shows a list of commands or help for one command + +GLOBAL OPTIONS: + --loglevel value log level to emit to the screen (default: 4) + --keystore value Directory for the keystore (default: "$HOME/.ethereum/keystore") + --configdir value Directory for Clef configuration (default: "$HOME/.clef") + --chainid value Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli) (default: 1) + --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength + --nousb Disables monitoring for and managing USB hardware wallets + --pcscdpath value Path to the smartcard daemon (pcscd) socket file (default: "/run/pcscd/pcscd.comm") + --rpcaddr value HTTP-RPC server listening interface (default: "localhost") + --rpcvhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") + --ipcdisable Disable the IPC-RPC server + --ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it) + --rpc Enable the HTTP-RPC server + --rpcport value HTTP-RPC server listening port (default: 8550) + --signersecret value A file containing the (encrypted) master seed to encrypt Clef data, e.g. keystore credentials and ruleset hash + --4bytedb-custom value File used for writing new 4byte-identifiers submitted via API (default: "./4byte-custom.json") + --auditlog value File used to emit audit logs. Set to "" to disable (default: "audit.log") + --rules value Path to the rule file to auto-authorize requests with + --stdio-ui Use STDIN/STDOUT as a channel for an external UI. This means that an STDIN/STDOUT is used for RPC-communication with a e.g. a graphical user interface, and can be used when Clef is started by an external process. + --stdio-ui-test Mechanism to test interface between Clef and UI. Requires 'stdio-ui'. + --advanced If enabled, issues warnings instead of rejections for suspicious requests. Default off + --help, -h show help + --version, -v print the version +``` + +Example: + +``` +$ clef -keystore /my/keystore -chainid 4 +``` + +## Security model + +The security model of Clef is as follows: + +* One critical component (the Clef binary / daemon) is responsible for handling cryptographic operations: signing, private keys, encryption/decryption of keystore files. +* Clef has a well-defined 'external' API. +* The 'external' API is considered UNTRUSTED. +* Clef also communicates with whatever process that invoked the binary, via stdin/stdout. + * This channel is considered 'trusted'. Over this channel, approvals and passwords are communicated. + +The general flow for signing a transaction using e.g. Geth is as follows: +![image](sign_flow.png) + +In this case, `geth` would be started with `--signer http://localhost:8550` and would relay requests to `eth.sendTransaction`. + +## TODOs + +Some snags and todos + +* [ ] Clef should take a startup param "--no-change", for UIs that do not contain the capability to perform changes to things, only approve/deny. Such a UI should be able to start the signer in a more secure mode by telling it that it only wants approve/deny capabilities. +* [x] It would be nice if Clef could collect new 4byte-id:s/method selectors, and have a secondary database for those (`4byte_custom.json`). Users could then (optionally) submit their collections for inclusion upstream. +* [ ] It should be possible to configure Clef to check if an account is indeed known to it, before passing on to the UI. The reason it currently does not, is that it would make it possible to enumerate accounts if it immediately returned "unknown account" (side channel attack). +* [x] It should be possible to configure Clef to auto-allow listing (certain) accounts, instead of asking every time. +* [x] Done Upon startup, Clef should spit out some info to the caller (particularly important when executed in `stdio-ui`-mode), invoking methods with the following info: + * [x] Version info about the signer + * [x] Address of API (HTTP/IPC) + * [ ] List of known accounts +* [ ] Have a default timeout on signing operations, so that if the user has not answered within e.g. 60 seconds, the request is rejected. +* [ ] `account_signRawTransaction` +* [ ] `account_bulkSignTransactions([] transactions)` should + * only exist if enabled via config/flag + * only allow non-data-sending transactions + * all txs must use the same `from`-account + * let the user confirm, showing + * the total amount + * the number of unique recipients + +* Geth todos + - The signer should pass the `Origin` header as call-info to the UI. As of right now, the way that info about the request is put together is a bit of a hack into the HTTP server. This could probably be greatly improved. + - Relay: Geth should be started in `geth --signer localhost:8550`. + - Currently, the Geth APIs use `common.Address` in the arguments to transaction submission (e.g `to` field). This type is 20 `bytes`, and is incapable of carrying checksum information. The signer uses `common.MixedcaseAddress`, which retains the original input. + - The Geth API should switch to use the same type, and relay `to`-account verbatim to the external API. +* [x] Storage + * [x] An encrypted key-value storage should be implemented. + * See [rules.md](rules.md) for more info about this. +* Another potential thing to introduce is pairing. + * To prevent spurious requests which users just accept, implement a way to "pair" the caller with the signer (external API). + * Thus Geth/cpp would cryptographically handshake and afterwards the caller would be allowed to make signing requests. + * This feature would make the addition of rules less dangerous. + +* Wallets / accounts. Add API methods for wallets. + +## Communication + +### External API + +Clef listens to HTTP requests on `rpcaddr`:`rpcport` (or to IPC on `ipcpath`), with the same JSON-RPC standard as Geth. The messages are expected to be [JSON-RPC 2.0 standard](https://www.jsonrpc.org/specification). + +Some of these call can require user interaction. Clients must be aware that responses may be delayed significantly or may never be received if a users decides to ignore the confirmation request. + +The External API is **untrusted**: it does not accept credentials over this API, nor does it expect that requests have any authority. + +### Internal UI API + +Clef has one native console-based UI, for operation without any standalone tools. However, there is also an API to communicate with an external UI. To enable that UI, the signer needs to be executed with the `--stdio-ui` option, which allocates `stdin` / `stdout` for the UI API. + +An example (insecure) proof-of-concept of has been implemented in `pythonsigner.py`. + +The model is as follows: + +* The user starts the UI app (`pythonsigner.py`). +* The UI app starts `clef` with `--stdio-ui`, and listens to the +process output for confirmation-requests. +* `clef` opens the external HTTP API. +* When the `signer` receives requests, it sends a JSON-RPC request via `stdout`. +* The UI app prompts the user accordingly, and responds to `clef`. +* `clef` signs (or not), and responds to the original request. + +## External API + +See the [external API changelog](extapi_changelog.md) for information about changes to this API. + +### Encoding +- number: positive integers that are hex encoded +- data: hex encoded data +- string: ASCII string + +All hex encoded values must be prefixed with `0x`. + +## Methods + +### account_new + +#### Create new password protected account + +The signer will generate a new private key, encrypts it according to [web3 keystore spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) and stores it in the keystore directory. +The client is responsible for creating a backup of the keystore. If the keystore is lost there is no method of retrieving lost accounts. + +#### Arguments + +None + +#### Result + - address [string]: account address that is derived from the generated key + - url [string]: location of the keyfile + +#### Sample call +```json +{ + "id": 0, + "jsonrpc": "2.0", + "method": "account_new", + "params": [] +} +``` +Response +``` +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "address": "0xbea9183f8f4f03d427f6bcea17388bdff1cab133", + "url": "keystore:///my/keystore/UTC--2017-08-24T08-40-15.419655028Z--bea9183f8f4f03d427f6bcea17388bdff1cab133" + } +} +``` + +### account_list + +#### List available accounts + List all accounts that this signer currently manages + +#### Arguments + +None + +#### Result + - array with account records: + - account.address [string]: account address that is derived from the generated key + - account.type [string]: type of the + - account.url [string]: location of the account + +#### Sample call +```json +{ + "id": 1, + "jsonrpc": "2.0", + "method": "account_list" +} +``` +Response +``` +{ + "id": 1, + "jsonrpc": "2.0", + "result": [ + { + "address": "0xafb2f771f58513609765698f65d3f2f0224a956f", + "type": "account", + "url": "keystore:///tmp/keystore/UTC--2017-08-24T07-26-47.162109726Z--afb2f771f58513609765698f65d3f2f0224a956f" + }, + { + "address": "0xbea9183f8f4f03d427f6bcea17388bdff1cab133", + "type": "account", + "url": "keystore:///tmp/keystore/UTC--2017-08-24T08-40-15.419655028Z--bea9183f8f4f03d427f6bcea17388bdff1cab133" + } + ] +} +``` + +### account_signTransaction + +#### Sign transactions + Signs a transactions and responds with the signed transaction in RLP encoded form. + +#### Arguments + 2. transaction object: + - `from` [address]: account to send the transaction from + - `to` [address]: receiver account. If omitted or `0x`, will cause contract creation. + - `gas` [number]: maximum amount of gas to burn + - `gasPrice` [number]: gas price + - `value` [number:optional]: amount of Wei to send with the transaction + - `data` [data:optional]: input data + - `nonce` [number]: account nonce + 3. method signature [string:optional] + - The method signature, if present, is to aid decoding the calldata. Should consist of `methodname(paramtype,...)`, e.g. `transfer(uint256,address)`. The signer may use this data to parse the supplied calldata, and show the user. The data, however, is considered totally untrusted, and reliability is not expected. + + +#### Result + - signed transaction in RLP encoded form [data] + +#### Sample call +```json +{ + "id": 2, + "jsonrpc": "2.0", + "method": "account_signTransaction", + "params": [ + { + "from": "0x1923f626bb8dc025849e00f99c25fe2b2f7fb0db", + "gas": "0x55555", + "gasPrice": "0x1234", + "input": "0xabcd", + "nonce": "0x0", + "to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "value": "0x1234" + } + ] +} +``` +Response + +```json +{ + "id": 2, + "jsonrpc": "2.0", + "error": { + "code": -32000, + "message": "Request denied" + } +} +``` +#### Sample call with ABI-data + + +```json +{ + "id": 67, + "jsonrpc": "2.0", + "method": "account_signTransaction", + "params": [ + { + "from": "0x694267f14675d7e1b9494fd8d72fefe1755710fa", + "gas": "0x333", + "gasPrice": "0x1", + "nonce": "0x0", + "to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "value": "0x0", + "data": "0x4401a6e40000000000000000000000000000000000000000000000000000000000000012" + }, + "safeSend(address)" + ] +} +``` +Response + +```json +{ + "jsonrpc": "2.0", + "id": 67, + "result": { + "raw": "0xf88380018203339407a565b7ed7d7a678680a4c162885bedbb695fe080a44401a6e4000000000000000000000000000000000000000000000000000000000000001226a0223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20ea02aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663", + "tx": { + "nonce": "0x0", + "gasPrice": "0x1", + "gas": "0x333", + "to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "value": "0x0", + "input": "0x4401a6e40000000000000000000000000000000000000000000000000000000000000012", + "v": "0x26", + "r": "0x223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20e", + "s": "0x2aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663", + "hash": "0xeba2df809e7a612a0a0d444ccfa5c839624bdc00dd29e3340d46df3870f8a30e" + } + } +} +``` + +Bash example: +```bash +#curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x694267f14675d7e1b9494fd8d72fefe1755710fa","gas":"0x333","gasPrice":"0x1","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x0", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"},"safeSend(address)"],"id":67}' http://localhost:8550/ + +{"jsonrpc":"2.0","id":67,"result":{"raw":"0xf88380018203339407a565b7ed7d7a678680a4c162885bedbb695fe080a44401a6e4000000000000000000000000000000000000000000000000000000000000001226a0223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20ea02aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663","tx":{"nonce":"0x0","gasPrice":"0x1","gas":"0x333","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0","value":"0x0","input":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012","v":"0x26","r":"0x223a7c9bcf5531c99be5ea7082183816eb20cfe0bbc322e97cc5c7f71ab8b20e","s":"0x2aadee6b34b45bb15bc42d9c09de4a6754e7000908da72d48cc7704971491663","hash":"0xeba2df809e7a612a0a0d444ccfa5c839624bdc00dd29e3340d46df3870f8a30e"}}} +``` + +### account_signData + +#### Sign data + Signs a chunk of data and returns the calculated signature. + +#### Arguments + - content type [string]: type of signed data + - `text/validator`: hex data with custom validator defined in a contract + - `application/clique`: [clique](https://github.com/ethereum/EIPs/issues/225) headers + - `text/plain`: simple hex data validated by `account_ecRecover` + - account [address]: account to sign with + - data [object]: data to sign + +#### Result + - calculated signature [data] + +#### Sample call +```json +{ + "id": 3, + "jsonrpc": "2.0", + "method": "account_signData", + "params": [ + "data/plain", + "0x1923f626bb8dc025849e00f99c25fe2b2f7fb0db", + "0xaabbccdd" + ] +} +``` +Response + +```json +{ + "id": 3, + "jsonrpc": "2.0", + "result": "0x5b6693f153b48ec1c706ba4169960386dbaa6903e249cc79a8e6ddc434451d417e1e57327872c7f538beeb323c300afa9999a3d4a5de6caf3be0d5ef832b67ef1c" +} +``` + +### account_signTypedData + +#### Sign data + Signs a chunk of structured data conformant to [EIP712]([EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md)) and returns the calculated signature. + +#### Arguments + - account [address]: account to sign with + - data [object]: data to sign + +#### Result + - calculated signature [data] + +#### Sample call +```json +{ + "id": 68, + "jsonrpc": "2.0", + "method": "account_signTypedData", + "params": [ + "0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826", + { + "types": { + "EIP712Domain": [ + { + "name": "name", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "chainId", + "type": "uint256" + }, + { + "name": "verifyingContract", + "type": "address" + } + ], + "Person": [ + { + "name": "name", + "type": "string" + }, + { + "name": "wallet", + "type": "address" + } + ], + "Mail": [ + { + "name": "from", + "type": "Person" + }, + { + "name": "to", + "type": "Person" + }, + { + "name": "contents", + "type": "string" + } + ] + }, + "primaryType": "Mail", + "domain": { + "name": "Ether Mail", + "version": "1", + "chainId": 1, + "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + "message": { + "from": { + "name": "Cow", + "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + "to": { + "name": "Bob", + "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + "contents": "Hello, Bob!" + } + } + ] +} +``` +Response + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c" +} +``` + +### account_ecRecover + +#### Sign data + +Derive the address from the account that was used to sign data with content type `text/plain` and the signature. + +#### Arguments + - data [data]: data that was signed + - signature [data]: the signature to verify + +#### Result + - derived account [address] + +#### Sample call +```json +{ + "id": 4, + "jsonrpc": "2.0", + "method": "account_ecRecover", + "params": [ + "data/plain", + "0xaabbccdd", + "0x5b6693f153b48ec1c706ba4169960386dbaa6903e249cc79a8e6ddc434451d417e1e57327872c7f538beeb323c300afa9999a3d4a5de6caf3be0d5ef832b67ef1c" + ] +} +``` +Response + +```json +{ + "id": 4, + "jsonrpc": "2.0", + "result": "0x1923f626bb8dc025849e00f99c25fe2b2f7fb0db" +} +``` + +### account_import + +#### Import account + Import a private key into the keystore. The imported key is expected to be encrypted according to the web3 keystore + format. + +#### Arguments + - account [object]: key in [web3 keystore format](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) (retrieved with account_export) + +#### Result + - imported key [object]: + - key.address [address]: address of the imported key + - key.type [string]: type of the account + - key.url [string]: key URL + +#### Sample call +```json +{ + "id": 6, + "jsonrpc": "2.0", + "method": "account_import", + "params": [ + { + "address": "c7412fc59930fd90099c917a50e5f11d0934b2f5", + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "401c39a7c7af0388491c3d3ecb39f532" + }, + "ciphertext": "eb045260b18dd35cd0e6d99ead52f8fa1e63a6b0af2d52a8de198e59ad783204", + "kdf": "scrypt", + "kdfparams": { + "dklen": 32, + "n": 262144, + "p": 1, + "r": 8, + "salt": "9a657e3618527c9b5580ded60c12092e5038922667b7b76b906496f021bb841a" + }, + "mac": "880dc10bc06e9cec78eb9830aeb1e7a4a26b4c2c19615c94acb632992b952806" + }, + "id": "09bccb61-b8d3-4e93-bf4f-205a8194f0b9", + "version": 3 + } + ] +} +``` +Response + +```json +{ + "id": 6, + "jsonrpc": "2.0", + "result": { + "address": "0xc7412fc59930fd90099c917a50e5f11d0934b2f5", + "type": "account", + "url": "keystore:///tmp/keystore/UTC--2017-08-24T11-00-42.032024108Z--c7412fc59930fd90099c917a50e5f11d0934b2f5" + } +} +``` + +### account_export + +#### Export account from keystore + Export a private key from the keystore. The exported private key is encrypted with the original passphrase. When the + key is imported later this passphrase is required. + +#### Arguments + - account [address]: export private key that is associated with this account + +#### Result + - exported key, see [web3 keystore format](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for + more information + +#### Sample call +```json +{ + "id": 5, + "jsonrpc": "2.0", + "method": "account_export", + "params": [ + "0xc7412fc59930fd90099c917a50e5f11d0934b2f5" + ] +} +``` +Response + +```json +{ + "id": 5, + "jsonrpc": "2.0", + "result": { + "address": "c7412fc59930fd90099c917a50e5f11d0934b2f5", + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "401c39a7c7af0388491c3d3ecb39f532" + }, + "ciphertext": "eb045260b18dd35cd0e6d99ead52f8fa1e63a6b0af2d52a8de198e59ad783204", + "kdf": "scrypt", + "kdfparams": { + "dklen": 32, + "n": 262144, + "p": 1, + "r": 8, + "salt": "9a657e3618527c9b5580ded60c12092e5038922667b7b76b906496f021bb841a" + }, + "mac": "880dc10bc06e9cec78eb9830aeb1e7a4a26b4c2c19615c94acb632992b952806" + }, + "id": "09bccb61-b8d3-4e93-bf4f-205a8194f0b9", + "version": 3 + } +} +``` + +## UI API + +These methods needs to be implemented by a UI listener. + +By starting the signer with the switch `--stdio-ui-test`, the signer will invoke all known methods, and expect the UI to respond with +denials. This can be used during development to ensure that the API is (at least somewhat) correctly implemented. +See `pythonsigner`, which can be invoked via `python3 pythonsigner.py test` to perform the 'denial-handshake-test'. + +All methods in this API uses object-based parameters, so that there can be no mixups of parameters: each piece of data is accessed by key. + +See the [ui API changelog](intapi_changelog.md) for information about changes to this API. + +OBS! A slight deviation from `json` standard is in place: every request and response should be confined to a single line. +Whereas the `json` specification allows for linebreaks, linebreaks __should not__ be used in this communication channel, to make +things simpler for both parties. + +### ApproveTx / `ui_approveTx` + +Invoked when there's a transaction for approval. + + +#### Sample call + +Here's a method invocation: +```bash + +curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x694267f14675d7e1b9494fd8d72fefe1755710fa","gas":"0x333","gasPrice":"0x1","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x0", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"},"safeSend(address)"],"id":67}' http://localhost:8550/ +``` +Results in the following invocation on the UI: +```json + +{ + "jsonrpc": "2.0", + "id": 1, + "method": "ui_approveTx", + "params": [ + { + "transaction": { + "from": "0x0x694267f14675d7e1b9494fd8d72fefe1755710fa", + "to": "0x0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "gas": "0x333", + "gasPrice": "0x1", + "value": "0x0", + "nonce": "0x0", + "data": "0x4401a6e40000000000000000000000000000000000000000000000000000000000000012", + "input": null + }, + "call_info": [ + { + "type": "WARNING", + "message": "Invalid checksum on to-address" + }, + { + "type": "Info", + "message": "safeSend(address: 0x0000000000000000000000000000000000000012)" + } + ], + "meta": { + "remote": "127.0.0.1:48486", + "local": "localhost:8550", + "scheme": "HTTP/1.1" + } + } + ] +} + +``` + +The same method invocation, but with invalid data: +```bash + +curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x694267f14675d7e1b9494fd8d72fefe1755710fa","gas":"0x333","gasPrice":"0x1","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x0", "data":"0x4401a6e40000000000000002000000000000000000000000000000000000000000000012"},"safeSend(address)"],"id":67}' http://localhost:8550/ +``` + +```json + +{ + "jsonrpc": "2.0", + "id": 1, + "method": "ui_approveTx", + "params": [ + { + "transaction": { + "from": "0x0x694267f14675d7e1b9494fd8d72fefe1755710fa", + "to": "0x0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "gas": "0x333", + "gasPrice": "0x1", + "value": "0x0", + "nonce": "0x0", + "data": "0x4401a6e40000000000000002000000000000000000000000000000000000000000000012", + "input": null + }, + "call_info": [ + { + "type": "WARNING", + "message": "Invalid checksum on to-address" + }, + { + "type": "WARNING", + "message": "Transaction data did not match ABI-interface: WARNING: Supplied data is stuffed with extra data. \nWant 0000000000000002000000000000000000000000000000000000000000000012\nHave 0000000000000000000000000000000000000000000000000000000000000012\nfor method safeSend(address)" + } + ], + "meta": { + "remote": "127.0.0.1:48492", + "local": "localhost:8550", + "scheme": "HTTP/1.1" + } + } + ] +} + + +``` + +One which has missing `to`, but with no `data`: + + +```json + +{ + "jsonrpc": "2.0", + "id": 3, + "method": "ui_approveTx", + "params": [ + { + "transaction": { + "from": "", + "to": null, + "gas": "0x0", + "gasPrice": "0x0", + "value": "0x0", + "nonce": "0x0", + "data": null, + "input": null + }, + "call_info": [ + { + "type": "CRITICAL", + "message": "Tx will create contract with empty code!" + } + ], + "meta": { + "remote": "signer binary", + "local": "main", + "scheme": "in-proc" + } + } + ] +} +``` + +### ApproveListing / `ui_approveListing` + +Invoked when a request for account listing has been made. + +#### Sample call + +```json + +{ + "jsonrpc": "2.0", + "id": 5, + "method": "ui_approveListing", + "params": [ + { + "accounts": [ + { + "type": "Account", + "url": "keystore:///home/bazonk/.ethereum/keystore/UTC--2017-11-20T14-44-54.089682944Z--123409812340981234098123409812deadbeef42", + "address": "0x123409812340981234098123409812deadbeef42" + }, + { + "type": "Account", + "url": "keystore:///home/bazonk/.ethereum/keystore/UTC--2017-11-23T21-59-03.199240693Z--cafebabedeadbeef34098123409812deadbeef42", + "address": "0xcafebabedeadbeef34098123409812deadbeef42" + } + ], + "meta": { + "remote": "signer binary", + "local": "main", + "scheme": "in-proc" + } + } + ] +} + +``` + + +### ApproveSignData / `ui_approveSignData` + +#### Sample call + +```json +{ + "jsonrpc": "2.0", + "id": 4, + "method": "ui_approveSignData", + "params": [ + { + "address": "0x123409812340981234098123409812deadbeef42", + "raw_data": "0x01020304", + "message": "\u0019Ethereum Signed Message:\n4\u0001\u0002\u0003\u0004", + "hash": "0x7e3a4e7a9d1744bc5c675c25e1234ca8ed9162bd17f78b9085e48047c15ac310", + "meta": { + "remote": "signer binary", + "local": "main", + "scheme": "in-proc" + } + } + ] +} + +``` + +### ShowInfo / `ui_showInfo` + +The UI should show the info to the user. Does not expect response. + +#### Sample call + +```json +{ + "jsonrpc": "2.0", + "id": 9, + "method": "ui_showInfo", + "params": [ + { + "text": "Tests completed" + } + ] +} + +``` + +### ShowError / `ui_showError` + +The UI should show the info to the user. Does not expect response. + +```json + +{ + "jsonrpc": "2.0", + "id": 2, + "method": "ShowError", + "params": [ + { + "text": "Testing 'ShowError'" + } + ] +} + +``` + +### OnApprovedTx / `ui_onApprovedTx` + +`OnApprovedTx` is called when a transaction has been approved and signed. The call contains the return value that will be sent to the external caller. The return value from this method is ignored - the reason for having this callback is to allow the ruleset to keep track of approved transactions. + +When implementing rate-limited rules, this callback should be used. + +TLDR; Use this method to keep track of signed transactions, instead of using the data in `ApproveTx`. + +### OnSignerStartup / `ui_onSignerStartup` + +This method provide the UI with information about what API version the signer uses (both internal and external) aswell as build-info and external API, +in k/v-form. + +Example call: +```json + +{ + "jsonrpc": "2.0", + "id": 1, + "method": "ui_onSignerStartup", + "params": [ + { + "info": { + "extapi_http": "http://localhost:8550", + "extapi_ipc": null, + "extapi_version": "2.0.0", + "intapi_version": "1.2.0" + } + } + ] +} + +``` + + +### Rules for UI apis + +A UI should conform to the following rules. + +* A UI MUST NOT load any external resources that were not embedded/part of the UI package. + * For example, not load icons, stylesheets from the internet + * Not load files from the filesystem, unless they reside in the same local directory (e.g. config files) +* A Graphical UI MUST show the blocky-identicon for ethereum addresses. +* A UI MUST warn display approproate warning if the destination-account is formatted with invalid checksum. +* A UI MUST NOT open any ports or services + * The signer opens the public port +* A UI SHOULD verify the permissions on the signer binary, and refuse to execute or warn if permissions allow non-user write. +* A UI SHOULD inform the user about the `SHA256` or `MD5` hash of the binary being executed +* A UI SHOULD NOT maintain a secondary storage of data, e.g. list of accounts + * The signer provides accounts +* A UI SHOULD, to the best extent possible, use static linking / bundling, so that required libraries are bundled +along with the UI. + + +### UI Implementations + +There are a couple of implementation for a UI. We'll try to keep this list up to date. + +| Name | Repo | UI type| No external resources| Blocky support| Verifies permissions | Hash information | No secondary storage | Statically linked| Can modify parameters| +| ---- | ---- | -------| ---- | ---- | ---- |---- | ---- | ---- | ---- | +| QtSigner| https://github.com/holiman/qtsigner/| Python3/QT-based| :+1:| :+1:| :+1:| :+1:| :+1:| :x: | :+1: (partially)| +| GtkSigner| https://github.com/holiman/gtksigner| Python3/GTK-based| :+1:| :x:| :x:| :+1:| :+1:| :x: | :x: | +| Frame | https://github.com/floating/frame/commits/go-signer| Electron-based| :x:| :x:| :x:| :x:| ?| :x: | :x: | +| Clef UI| https://github.com/kyokan/clef-ui| Golang/QT-based| :+1:| :+1:| :x:| :+1:| :+1:| :x: | :+1: (approve tx only)| diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/datatypes.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/datatypes.md new file mode 100644 index 00000000..5ebf9adc --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/datatypes.md @@ -0,0 +1,224 @@ +## UI Client interface + +These data types are defined in the channel between clef and the UI +### SignDataRequest + +SignDataRequest contains information about a pending request to sign some data. The data to be signed can be of various types, defined by content-type. Clef has done most of the work in canonicalizing and making sense of the data, and it's up to the UI to presentthe user with the contents of the `message` + +Example: +```json +{ + "content_type": "text/plain", + "address": "0xDEADbEeF000000000000000000000000DeaDbeEf", + "raw_data": "GUV0aGVyZXVtIFNpZ25lZCBNZXNzYWdlOgoxMWhlbGxvIHdvcmxk", + "messages": [ + { + "name": "message", + "value": "\u0019Ethereum Signed Message:\n11hello world", + "type": "text/plain" + } + ], + "hash": "0xd9eba16ed0ecae432b71fe008c98cc872bb4cc214d3220a36f365326cf807d68", + "meta": { + "remote": "localhost:9999", + "local": "localhost:8545", + "scheme": "http", + "User-Agent": "Firefox 3.2", + "Origin": "www.malicious.ru" + } +} +``` +### SignDataResponse - approve + +Response to SignDataRequest + +Example: +```json +{ + "approved": true +} +``` +### SignDataResponse - deny + +Response to SignDataRequest + +Example: +```json +{ + "approved": false +} +``` +### SignTxRequest + +SignTxRequest contains information about a pending request to sign a transaction. Aside from the transaction itself, there is also a `call_info`-struct. That struct contains messages of various types, that the user should be informed of. + +As in any request, it's important to consider that the `meta` info also contains untrusted data. + +The `transaction` (on input into clef) can have either `data` or `input` -- if both are set, they must be identical, otherwise an error is generated. However, Clef will always use `data` when passing this struct on (if Clef does otherwise, please file a ticket) + +Example: +```json +{ + "transaction": { + "from": "0xDEADbEeF000000000000000000000000DeaDbeEf", + "to": null, + "gas": "0x3e8", + "gasPrice": "0x5", + "value": "0x6", + "nonce": "0x1", + "data": "0x01020304" + }, + "call_info": [ + { + "type": "Warning", + "message": "Something looks odd, show this message as a warning" + }, + { + "type": "Info", + "message": "User should see this aswell" + } + ], + "meta": { + "remote": "localhost:9999", + "local": "localhost:8545", + "scheme": "http", + "User-Agent": "Firefox 3.2", + "Origin": "www.malicious.ru" + } +} +``` +### SignTxResponse - approve + +Response to request to sign a transaction. This response needs to contain the `transaction`, because the UI is free to make modifications to the transaction. + +Example: +```json +{ + "transaction": { + "from": "0xDEADbEeF000000000000000000000000DeaDbeEf", + "to": null, + "gas": "0x3e8", + "gasPrice": "0x5", + "value": "0x6", + "nonce": "0x4", + "data": "0x04030201" + }, + "approved": true +} +``` +### SignTxResponse - deny + +Response to SignTxRequest. When denying a request, there's no need to provide the transaction in return + +Example: +```json +{ + "transaction": { + "from": "0x", + "to": null, + "gas": "0x0", + "gasPrice": "0x0", + "value": "0x0", + "nonce": "0x0", + "data": null + }, + "approved": false +} +``` +### OnApproved - SignTransactionResult + +SignTransactionResult is used in the call `clef` -> `OnApprovedTx(result)` + +This occurs _after_ successful completion of the entire signing procedure, but right before the signed transaction is passed to the external caller. This method (and data) can be used by the UI to signal to the user that the transaction was signed, but it is primarily useful for ruleset implementations. + +A ruleset that implements a rate limitation needs to know what transactions are sent out to the external interface. By hooking into this methods, the ruleset can maintain track of that count. + +**OBS:** Note that if an attacker can restore your `clef` data to a previous point in time (e.g through a backup), the attacker can reset such windows, even if he/she is unable to decrypt the content. + +The `OnApproved` method cannot be responded to, it's purely informative + +Example: +```json +{ + "raw": "0xf85d640101948a8eafb1cf62bfbeb1741769dae1a9dd47996192018026a0716bd90515acb1e68e5ac5867aa11a1e65399c3349d479f5fb698554ebc6f293a04e8a4ebfff434e971e0ef12c5bf3a881b06fd04fc3f8b8a7291fb67a26a1d4ed", + "tx": { + "nonce": "0x64", + "gasPrice": "0x1", + "gas": "0x1", + "to": "0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192", + "value": "0x1", + "input": "0x", + "v": "0x26", + "r": "0x716bd90515acb1e68e5ac5867aa11a1e65399c3349d479f5fb698554ebc6f293", + "s": "0x4e8a4ebfff434e971e0ef12c5bf3a881b06fd04fc3f8b8a7291fb67a26a1d4ed", + "hash": "0x662f6d772692dd692f1b5e8baa77a9ff95bbd909362df3fc3d301aafebde5441" + } +} +``` +### UserInputRequest + +Sent when clef needs the user to provide data. If 'password' is true, the input field should be treated accordingly (echo-free) + +Example: +```json +{ + "prompt": "The question to ask the user", + "title": "The title here", + "isPassword": true +} +``` +### UserInputResponse + +Response to UserInputRequest + +Example: +```json +{ + "text": "The textual response from user" +} +``` +### ListRequest + +Sent when a request has been made to list addresses. The UI is provided with the full `account`s, including local directory names. Note: this information is not passed back to the external caller, who only sees the `address`es. + +Example: +```json +{ + "accounts": [ + { + "address": "0xdeadbeef000000000000000000000000deadbeef", + "url": "keystore:///path/to/keyfile/a" + }, + { + "address": "0x1111111122222222222233333333334444444444", + "url": "keystore:///path/to/keyfile/b" + } + ], + "meta": { + "remote": "localhost:9999", + "local": "localhost:8545", + "scheme": "http", + "User-Agent": "Firefox 3.2", + "Origin": "www.malicious.ru" + } +} +``` +### ListResponse + +Response to list request. The response contains a list of all addresses to show to the caller. Note: the UI is free to respond with any address the caller, regardless of whether it exists or not + +Example: +```json +{ + "accounts": [ + { + "address": "0x0000000000000000000000000000000000000000", + "url": ".. ignored .." + }, + { + "address": "0xffffffffffffffffffffffffffffffffffffffff", + "url": "" + } + ] +} +``` diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/extapi_changelog.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/extapi_changelog.md new file mode 100644 index 00000000..dbc30263 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/extapi_changelog.md @@ -0,0 +1,46 @@ +## Changelog for external API + +The API uses [semantic versioning](https://semver.org/). + +TL;DR: Given a version number MAJOR.MINOR.PATCH, increment the: + +* MAJOR version when you make incompatible API changes, +* MINOR version when you add functionality in a backwards-compatible manner, and +* PATCH version when you make backwards-compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. + + +### 6.0.0 + +* `New` was changed to deliver only an address, not the full `Account` data +* `Export` was moved from External API to the UI Server API + +#### 5.0.0 + +* The external `account_EcRecover`-method was reimplemented. +* The external method `account_sign(address, data)` was replaced with `account_signData(contentType, address, data)`. +The addition of `contentType` makes it possible to use the method for different types of objects, such as: + * signing data with an intended validator (not yet implemented) + * signing clique headers, + * signing plain personal messages, +* The external method `account_signTypedData` implements [EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md) and makes it possible to sign typed data. + +#### 4.0.0 + +* The external `account_Ecrecover`-method was removed. +* The external `account_Import`-method was removed. + +#### 3.0.0 + +* The external `account_List`-method was changed to not expose `url`, which contained info about the local filesystem. It now returns only a list of addresses. + +#### 2.0.0 + +* Commit `73abaf04b1372fa4c43201fb1b8019fe6b0a6f8d`, move `from` into `transaction` object in `signTransaction`. This +makes the `accounts_signTransaction` identical to the old `eth_signTransaction`. + + +#### 1.0.0 + +Initial release. diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/intapi_changelog.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/intapi_changelog.md new file mode 100644 index 00000000..38424f06 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/intapi_changelog.md @@ -0,0 +1,180 @@ +## Changelog for internal API (ui-api) + +The API uses [semantic versioning](https://semver.org/). + +TL;DR: Given a version number MAJOR.MINOR.PATCH, increment the: + +* MAJOR version when you make incompatible API changes, +* MINOR version when you add functionality in a backwards-compatible manner, and +* PATCH version when you make backwards-compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. + +### 7.0.0 + +- The `message` field was renamed to `messages` in all data signing request methods to better reflect that it's a list, not a value. +- The `storage.Put` and `storage.Get` methods in the rule execution engine were lower-cased to `storage.put` and `storage.get` to be consistent with JavaScript call conventions. + +### 6.0.0 + +Removed `password` from responses to operations which require them. This is for two reasons, + +- Consistency between how rulesets operate and how manual processing works. A rule can `Approve` but require the actual password to be stored in the clef storage. +With this change, the same stored password can be used even if rulesets are not enabled, but storage is. +- It also removes the usability-shortcut that a UI might otherwise want to implement; remembering passwords. Since we now will not require the +password on every `Approve`, there's no need for the UI to cache it locally. + - In a future update, we'll likely add `clef_storePassword` to the internal API, so the user can store it via his UI (currently only CLI works). + +Affected datatypes: +- `SignTxResponse` +- `SignDataResponse` +- `NewAccountResponse` + +If `clef` requires a password, the `OnInputRequired` will be used to collect it. + + +### 5.0.0 + +Changed the namespace format to adhere to the legacy ethereum format: `name_methodName`. Changes: + +* `ApproveTx` -> `ui_approveTx` +* `ApproveSignData` -> `ui_approveSignData` +* `ApproveExport` -> `removed` +* `ApproveImport` -> `removed` +* `ApproveListing` -> `ui_approveListing` +* `ApproveNewAccount` -> `ui_approveNewAccount` +* `ShowError` -> `ui_showError` +* `ShowInfo` -> `ui_showInfo` +* `OnApprovedTx` -> `ui_onApprovedTx` +* `OnSignerStartup` -> `ui_onSignerStartup` +* `OnInputRequired` -> `ui_onInputRequired` + + +### 4.0.0 + +* Bidirectional communication implemented, so the UI can query `clef` via the stdin/stdout RPC channel. Methods implemented are: + - `clef_listWallets` + - `clef_listAccounts` + - `clef_listWallets` + - `clef_deriveAccount` + - `clef_importRawKey` + - `clef_openWallet` + - `clef_chainId` + - `clef_setChainId` + - `clef_export` + - `clef_import` + +* The type `Account` was modified (the json-field `type` was removed), to consist of + +```go +type Account struct { + Address common.Address `json:"address"` // Ethereum account address derived from the key + URL URL `json:"url"` // Optional resource locator within a backend +} +``` + + +### 3.2.0 + +* Make `ShowError`, `OnApprovedTx`, `OnSignerStartup` be json-rpc [notifications](https://www.jsonrpc.org/specification#notification): + +> A Notification is a Request object without an "id" member. A Request object that is a Notification signifies the Client's lack of interest in the corresponding Response object, and as such no Response object needs to be returned to the client. The Server MUST NOT reply to a Notification, including those that are within a batch request. +> +> Notifications are not confirmable by definition, since they do not have a Response object to be returned. As such, the Client would not be aware of any errors (like e.g. "Invalid params","Internal error" +### 3.1.0 + +* Add `ContentType` `string` to `SignDataRequest` to accommodate the latest EIP-191 and EIP-712 implementations. + +### 3.0.0 + +* Make use of `OnInputRequired(info UserInputRequest)` for obtaining master password during startup + +### 2.1.0 + +* Add `OnInputRequired(info UserInputRequest)` to internal API. This method is used when Clef needs user input, e.g. passwords. + +The following structures are used: + +```go +UserInputRequest struct { + Prompt string `json:"prompt"` + Title string `json:"title"` + IsPassword bool `json:"isPassword"` +} +UserInputResponse struct { + Text string `json:"text"` +} +``` + +### 2.0.0 + +* Modify how `call_info` on a transaction is conveyed. New format: + +``` +{ + "jsonrpc": "2.0", + "id": 2, + "method": "ApproveTx", + "params": [ + { + "transaction": { + "from": "0x82A2A876D39022B3019932D30Cd9c97ad5616813", + "to": "0x07a565b7ed7d7a678680a4c162885bedbb695fe0", + "gas": "0x333", + "gasPrice": "0x123", + "value": "0x10", + "nonce": "0x0", + "data": "0x4401a6e40000000000000000000000000000000000000000000000000000000000000012", + "input": null + }, + "call_info": [ + { + "type": "WARNING", + "message": "Invalid checksum on to-address" + }, + { + "type": "WARNING", + "message": "Tx contains data, but provided ABI signature could not be matched: Did not match: test (0 matches)" + } + ], + "meta": { + "remote": "127.0.0.1:54286", + "local": "localhost:8550", + "scheme": "HTTP/1.1" + } + } + ] +} +``` + +#### 1.2.0 + +* Add `OnStartup` method, to provide the UI with information about what API version +the signer uses (both internal and external) aswell as build-info and external api. + +Example call: +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "OnSignerStartup", + "params": [ + { + "info": { + "extapi_http": "http://localhost:8550", + "extapi_ipc": null, + "extapi_version": "2.0.0", + "intapi_version": "1.2.0" + } + } + ] +} +``` + +#### 1.1.0 + +* Add `OnApproved` method + +#### 1.0.0 + +Initial release. diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/main.go b/vendor/github.com/ethereum/go-ethereum/cmd/clef/main.go index 0ea6f36f..f4d94f02 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/clef/main.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/main.go @@ -93,7 +93,7 @@ var ( chainIdFlag = cli.Int64Flag{ Name: "chainid", Value: params.MainnetChainConfig.ChainID.Int64(), - Usage: "Chain id to use for signing (1=mainnet, 3=ropsten, 4=rinkeby, 5=Goerli)", + Usage: "Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli)", } rpcPortFlag = cli.IntFlag{ Name: "rpcport", @@ -116,8 +116,7 @@ var ( } ruleFlag = cli.StringFlag{ Name: "rules", - Usage: "Enable rule-engine", - Value: "", + Usage: "Path to the rule file to auto-authorize requests with", } stdiouiFlag = cli.BoolFlag{ Name: "stdio-ui", @@ -160,7 +159,6 @@ incoming requests. Whenever you make an edit to the rule file, you need to use attestation to tell Clef that the file is 'safe' to execute.`, } - setCredentialCommand = cli.Command{ Action: utils.MigrateFlags(setCredential), Name: "setpw", @@ -172,8 +170,20 @@ Clef that the file is 'safe' to execute.`, signerSecretFlag, }, Description: ` -The setpw command stores a password for a given address (keyfile). If you enter a blank passphrase, it will -remove any stored credential for that address (keyfile) +The setpw command stores a password for a given address (keyfile). +`} + delCredentialCommand = cli.Command{ + Action: utils.MigrateFlags(removeCredential), + Name: "delpw", + Usage: "Remove a credential for a keystore file", + ArgsUsage: "
", + Flags: []cli.Flag{ + logLevelFlag, + configdirFlag, + signerSecretFlag, + }, + Description: ` +The delpw command removes a password for a given address (keyfile). `} gendocCommand = cli.Command{ Action: GenDoc, @@ -210,9 +220,9 @@ func init() { advancedMode, } app.Action = signer - app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, gendocCommand} - + app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, delCredentialCommand, gendocCommand} } + func main() { if err := app.Run(os.Args); err != nil { fmt.Fprintln(os.Stderr, err) @@ -221,11 +231,20 @@ func main() { } func initializeSecrets(c *cli.Context) error { + // Get past the legal message if err := initialize(c); err != nil { return err } + // Ensure the master key does not yet exist, we're not willing to overwrite configDir := c.GlobalString(configdirFlag.Name) - + if err := os.Mkdir(configDir, 0700); err != nil && !os.IsExist(err) { + return err + } + location := filepath.Join(configDir, "masterseed.json") + if _, err := os.Stat(location); err == nil { + return fmt.Errorf("master key %v already exists, will not overwrite", location) + } + // Key file does not exist yet, generate a new one and encrypt it masterSeed := make([]byte, 256) num, err := io.ReadFull(rand.Reader, masterSeed) if err != nil { @@ -234,18 +253,18 @@ func initializeSecrets(c *cli.Context) error { if num != len(masterSeed) { return fmt.Errorf("failed to read enough random") } - n, p := keystore.StandardScryptN, keystore.StandardScryptP if c.GlobalBool(utils.LightKDFFlag.Name) { n, p = keystore.LightScryptN, keystore.LightScryptP } - text := "The master seed of clef is locked with a password. Please give a password. Do not forget this password." + text := "The master seed of clef will be locked with a password.\nPlease specify a password. Do not forget this password!" var password string for { password = getPassPhrase(text, true) if err := core.ValidatePasswordFormat(password); err != nil { fmt.Printf("invalid password: %v\n", err) } else { + fmt.Println() break } } @@ -253,28 +272,27 @@ func initializeSecrets(c *cli.Context) error { if err != nil { return fmt.Errorf("failed to encrypt master seed: %v", err) } - - err = os.Mkdir(configDir, 0700) - if err != nil && !os.IsExist(err) { + // Double check the master key path to ensure nothing wrote there in between + if err = os.Mkdir(configDir, 0700); err != nil && !os.IsExist(err) { return err } - location := filepath.Join(configDir, "masterseed.json") if _, err := os.Stat(location); err == nil { - return fmt.Errorf("file %v already exists, will not overwrite", location) + return fmt.Errorf("master key %v already exists, will not overwrite", location) } - err = ioutil.WriteFile(location, cipherSeed, 0400) - if err != nil { + // Write the file and print the usual warning message + if err = ioutil.WriteFile(location, cipherSeed, 0400); err != nil { return err } fmt.Printf("A master seed has been generated into %s\n", location) fmt.Printf(` -This is required to be able to store credentials, such as : +This is required to be able to store credentials, such as: * Passwords for keystores (used by rule engine) -* Storage for javascript rules -* Hash of rule-file +* Storage for JavaScript auto-signing rules +* Hash of JavaScript rule-file -You should treat that file with utmost secrecy, and make a backup of it. -NOTE: This file does not contain your accounts. Those need to be backed up separately! +You should treat 'masterseed.json' with utmost secrecy and make a backup of it! +* The password is necessary but not enough, you need to back up the master seed too! +* The master seed does not contain your accounts, those need to be backed up separately! `) return nil @@ -305,14 +323,18 @@ func attestFile(ctx *cli.Context) error { func setCredential(ctx *cli.Context) error { if len(ctx.Args()) < 1 { - utils.Fatalf("This command requires an address to be passed as an argument.") + utils.Fatalf("This command requires an address to be passed as an argument") } if err := initialize(ctx); err != nil { return err } - - address := ctx.Args().First() - password := getPassPhrase("Enter a passphrase to store with this address.", true) + addr := ctx.Args().First() + if !common.IsHexAddress(addr) { + utils.Fatalf("Invalid address specified: %s", addr) + } + address := common.HexToAddress(addr) + password := getPassPhrase("Please enter a passphrase to store for this address:", true) + fmt.Println() stretchedKey, err := readMasterKey(ctx, nil) if err != nil { @@ -322,10 +344,38 @@ func setCredential(ctx *cli.Context) error { vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10])) pwkey := crypto.Keccak256([]byte("credentials"), stretchedKey) - // Initialize the encrypted storages pwStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "credentials.json"), pwkey) - pwStorage.Put(address, password) - log.Info("Credential store updated", "key", address) + pwStorage.Put(address.Hex(), password) + + log.Info("Credential store updated", "set", address) + return nil +} + +func removeCredential(ctx *cli.Context) error { + if len(ctx.Args()) < 1 { + utils.Fatalf("This command requires an address to be passed as an argument") + } + if err := initialize(ctx); err != nil { + return err + } + addr := ctx.Args().First() + if !common.IsHexAddress(addr) { + utils.Fatalf("Invalid address specified: %s", addr) + } + address := common.HexToAddress(addr) + + stretchedKey, err := readMasterKey(ctx, nil) + if err != nil { + utils.Fatalf(err.Error()) + } + configDir := ctx.GlobalString(configdirFlag.Name) + vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10])) + pwkey := crypto.Keccak256([]byte("credentials"), stretchedKey) + + pwStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "credentials.json"), pwkey) + pwStorage.Del(address.Hex()) + + log.Info("Credential store updated", "unset", address) return nil } @@ -340,13 +390,17 @@ func initialize(c *cli.Context) error { if !confirm(legalWarning) { return fmt.Errorf("aborted by user") } + fmt.Println() } - log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int(logLevelFlag.Name)), log.StreamHandler(logOutput, log.TerminalFormat(true)))) return nil } func signer(c *cli.Context) error { + // If we have some unrecognized command, bail out + if args := c.Args(); len(args) > 0 { + return fmt.Errorf("invalid command: %q", args[0]) + } if err := initialize(c); err != nil { return err } @@ -376,7 +430,7 @@ func signer(c *cli.Context) error { configDir := c.GlobalString(configdirFlag.Name) if stretchedKey, err := readMasterKey(c, ui); err != nil { - log.Info("No master seed provided, rules disabled", "error", err) + log.Warn("Failed to open master, rules disabled", "err", err) } else { vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), stretchedKey)[:10])) @@ -390,17 +444,17 @@ func signer(c *cli.Context) error { jsStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "jsstorage.json"), jskey) configStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "config.json"), confkey) - //Do we have a rule-file? + // Do we have a rule-file? if ruleFile := c.GlobalString(ruleFlag.Name); ruleFile != "" { - ruleJS, err := ioutil.ReadFile(c.GlobalString(ruleFile)) + ruleJS, err := ioutil.ReadFile(ruleFile) if err != nil { - log.Info("Could not load rulefile, rules not enabled", "file", "rulefile") + log.Warn("Could not load rules, disabling", "file", ruleFile, "err", err) } else { shasum := sha256.Sum256(ruleJS) foundShaSum := hex.EncodeToString(shasum[:]) - storedShasum := configStorage.Get("ruleset_sha256") + storedShasum, _ := configStorage.Get("ruleset_sha256") if storedShasum != foundShaSum { - log.Info("Could not validate ruleset hash, rules not enabled", "got", foundShaSum, "expected", storedShasum) + log.Warn("Rule hash not attested, disabling", "hash", foundShaSum, "attested", storedShasum) } else { // Initialize rules ruleEngine, err := rules.NewRuleEvaluator(ui, jsStorage) @@ -452,7 +506,6 @@ func signer(c *cli.Context) error { Version: "1.0"}, } if c.GlobalBool(utils.RPCEnabledFlag.Name) { - vhosts := splitAndTrim(c.GlobalString(utils.RPCVirtualHostsFlag.Name)) cors := splitAndTrim(c.GlobalString(utils.RPCCORSDomainFlag.Name)) @@ -469,7 +522,6 @@ func signer(c *cli.Context) error { listener.Close() log.Info("HTTP endpoint closed", "url", httpEndpoint) }() - } if !c.GlobalBool(utils.IPCDisabledFlag.Name) { if c.IsSet(utils.IPCPathFlag.Name) { @@ -496,8 +548,8 @@ func signer(c *cli.Context) error { } ui.OnSignerStartup(core.StartupInfo{ Info: map[string]interface{}{ - "extapi_version": core.ExternalAPIVersion, "intapi_version": core.InternalAPIVersion, + "extapi_version": core.ExternalAPIVersion, "extapi_http": extapiURL, "extapi_ipc": ipcapiURL, }, @@ -592,7 +644,6 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) { if len(masterSeed) < 256 { return nil, fmt.Errorf("master seed of insufficient length, expected >255 bytes, got %d", len(masterSeed)) } - // Create vault location vaultLocation := filepath.Join(configDir, common.Bytes2Hex(crypto.Keccak256([]byte("vault"), masterSeed)[:10])) err = os.Mkdir(vaultLocation, 0700) @@ -620,13 +671,12 @@ func checkFile(filename string) error { // confirm displays a text and asks for user confirmation func confirm(text string) bool { fmt.Printf(text) - fmt.Printf("\nEnter 'ok' to proceed:\n>") + fmt.Printf("\nEnter 'ok' to proceed:\n> ") text, err := bufio.NewReader(os.Stdin).ReadString('\n') if err != nil { log.Crit("Failed to read user input", "err", err) } - if text := strings.TrimSpace(text); text == "ok" { return true } @@ -642,7 +692,7 @@ func testExternalUI(api *core.SignerAPI) { a := common.HexToAddress("0xdeadbeef000000000000000000000000deadbeef") addErr := func(errStr string) { - log.Info("Test error", "error", errStr) + log.Info("Test error", "err", errStr) errs = append(errs, errStr) } @@ -864,14 +914,14 @@ func GenDoc(ctx *cli.Context) { "of the work in canonicalizing and making sense of the data, and it's up to the UI to present" + "the user with the contents of the `message`" sighash, msg := accounts.TextAndHash([]byte("hello world")) - message := []*core.NameValueType{{"message", msg, accounts.MimetypeTextPlain}} + messages := []*core.NameValueType{{"message", msg, accounts.MimetypeTextPlain}} add("SignDataRequest", desc, &core.SignDataRequest{ Address: common.NewMixedcaseAddress(a), Meta: meta, ContentType: accounts.MimetypeTextPlain, Rawdata: []byte(msg), - Message: message, + Messages: messages, Hash: sighash}) } { // Sign plain text response @@ -982,29 +1032,3 @@ These data types are defined in the channel between clef and the UI`) fmt.Println(elem) } } - -/** -//Create Account - -curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_new","params":["test"],"id":67}' localhost:8550 - -// List accounts - -curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_list","params":[""],"id":67}' http://localhost:8550/ - -// Make Transaction -// safeSend(0x12) -// 4401a6e40000000000000000000000000000000000000000000000000000000000000012 - -// supplied abi -curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x82A2A876D39022B3019932D30Cd9c97ad5616813","gas":"0x333","gasPrice":"0x123","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x10", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"},"test"],"id":67}' http://localhost:8550/ - -// Not supplied -curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_signTransaction","params":[{"from":"0x82A2A876D39022B3019932D30Cd9c97ad5616813","gas":"0x333","gasPrice":"0x123","nonce":"0x0","to":"0x07a565b7ed7d7a678680a4c162885bedbb695fe0", "value":"0x10", "data":"0x4401a6e40000000000000000000000000000000000000000000000000000000000000012"}],"id":67}' http://localhost:8550/ - -// Sign data - -curl -i -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"account_sign","params":["0x694267f14675d7e1b9494fd8d72fefe1755710fa","bazonk gaz baz"],"id":67}' http://localhost:8550/ - - -**/ diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/pythonsigner.py b/vendor/github.com/ethereum/go-ethereum/cmd/clef/pythonsigner.py new file mode 100644 index 00000000..315aabd7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/pythonsigner.py @@ -0,0 +1,177 @@ +import os,sys, subprocess +from tinyrpc.transports import ServerTransport +from tinyrpc.protocols.jsonrpc import JSONRPCProtocol +from tinyrpc.dispatch import public,RPCDispatcher +from tinyrpc.server import RPCServer + +""" This is a POC example of how to write a custom UI for Clef. The UI starts the +clef process with the '--stdio-ui' option, and communicates with clef using standard input / output. + +The standard input/output is a relatively secure way to communicate, as it does not require opening any ports +or IPC files. Needless to say, it does not protect against memory inspection mechanisms where an attacker +can access process memory.""" + +try: + import urllib.parse as urlparse +except ImportError: + import urllib as urlparse + +class StdIOTransport(ServerTransport): + """ Uses std input/output for RPC """ + def receive_message(self): + return None, urlparse.unquote(sys.stdin.readline()) + + def send_reply(self, context, reply): + print(reply) + +class PipeTransport(ServerTransport): + """ Uses std a pipe for RPC """ + + def __init__(self,input, output): + self.input = input + self.output = output + + def receive_message(self): + data = self.input.readline() + print(">> {}".format( data)) + return None, urlparse.unquote(data) + + def send_reply(self, context, reply): + print("<< {}".format( reply)) + self.output.write(reply) + self.output.write("\n") + +class StdIOHandler(): + def __init__(self): + pass + + @public + def ApproveTx(self,req): + """ + Example request: + { + "jsonrpc": "2.0", + "method": "ApproveTx", + "params": [{ + "transaction": { + "to": "0xae967917c465db8578ca9024c205720b1a3651A9", + "gas": "0x333", + "gasPrice": "0x123", + "value": "0x10", + "data": "0xd7a5865800000000000000000000000000000000000000000000000000000000000000ff", + "nonce": "0x0" + }, + "from": "0xAe967917c465db8578ca9024c205720b1a3651A9", + "call_info": "Warning! Could not validate ABI-data against calldata\nSupplied ABI spec does not contain method signature in data: 0xd7a58658", + "meta": { + "remote": "127.0.0.1:34572", + "local": "localhost:8550", + "scheme": "HTTP/1.1" + } + }], + "id": 1 + } + + :param transaction: transaction info + :param call_info: info abou the call, e.g. if ABI info could not be + :param meta: metadata about the request, e.g. where the call comes from + :return: + """ + transaction = req.get('transaction') + _from = req.get('from') + call_info = req.get('call_info') + meta = req.get('meta') + + return { + "approved" : False, + #"transaction" : transaction, + # "from" : _from, +# "password" : None, + } + + @public + def ApproveSignData(self, req): + """ Example request + + """ + return {"approved": False, "password" : None} + + @public + def ApproveExport(self, req): + """ Example request + + """ + return {"approved" : False} + + @public + def ApproveImport(self, req): + """ Example request + + """ + return { "approved" : False, "old_password": "", "new_password": ""} + + @public + def ApproveListing(self, req): + """ Example request + + """ + return {'accounts': []} + + @public + def ApproveNewAccount(self, req): + """ + Example request + + :return: + """ + return {"approved": False, + #"password": "" + } + + @public + def ShowError(self,message = {}): + """ + Example request: + + {"jsonrpc":"2.0","method":"ShowInfo","params":{"message":"Testing 'ShowError'"},"id":1} + + :param message: to show + :return: nothing + """ + if 'text' in message.keys(): + sys.stderr.write("Error: {}\n".format( message['text'])) + return + + @public + def ShowInfo(self,message = {}): + """ + Example request + {"jsonrpc":"2.0","method":"ShowInfo","params":{"message":"Testing 'ShowInfo'"},"id":0} + + :param message: to display + :return:nothing + """ + + if 'text' in message.keys(): + sys.stdout.write("Error: {}\n".format( message['text'])) + return + +def main(args): + cmd = ["clef", "--stdio-ui"] + if len(args) > 0 and args[0] == "test": + cmd.extend(["--stdio-ui-test"]) + print("cmd: {}".format(" ".join(cmd))) + dispatcher = RPCDispatcher() + dispatcher.register_instance(StdIOHandler(), '') + # line buffered + p = subprocess.Popen(cmd, bufsize=1, universal_newlines=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + + rpc_server = RPCServer( + PipeTransport(p.stdout, p.stdin), + JSONRPCProtocol(), + dispatcher + ) + rpc_server.serve_forever() + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/rules.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/rules.md new file mode 100644 index 00000000..153e69ff --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/rules.md @@ -0,0 +1,234 @@ +# Rules + +The `signer` binary contains a ruleset engine, implemented with [OttoVM](https://github.com/robertkrimen/otto) + +It enables usecases like the following: + +* I want to auto-approve transactions with contract `CasinoDapp`, with up to `0.05 ether` in value to maximum `1 ether` per 24h period +* I want to auto-approve transaction to contract `EthAlarmClock` with `data`=`0xdeadbeef`, if `value=0`, `gas < 44k` and `gasPrice < 40Gwei` + +The two main features that are required for this to work well are; + +1. Rule Implementation: how to create, manage and interpret rules in a flexible but secure manner +2. Credential managements and credentials; how to provide auto-unlock without exposing keys unnecessarily. + +The section below deals with both of them + +## Rule Implementation + +A ruleset file is implemented as a `js` file. Under the hood, the ruleset-engine is a `SignerUI`, implementing the same methods as the `json-rpc` methods +defined in the UI protocol. Example: + +```js +function asBig(str) { + if (str.slice(0, 2) == "0x") { + return new BigNumber(str.slice(2), 16) + } + return new BigNumber(str) +} + +// Approve transactions to a certain contract if value is below a certain limit +function ApproveTx(req) { + var limit = big.Newint("0xb1a2bc2ec50000") + var value = asBig(req.transaction.value); + + if (req.transaction.to.toLowerCase() == "0xae967917c465db8578ca9024c205720b1a3651a9") && value.lt(limit)) { + return "Approve" + } + // If we return "Reject", it will be rejected. + // By not returning anything, it will be passed to the next UI, for manual processing +} + +// Approve listings if request made from IPC +function ApproveListing(req){ + if (req.metadata.scheme == "ipc"){ return "Approve"} +} +``` + +Whenever the external API is called (and the ruleset is enabled), the `signer` calls the UI, which is an instance of a ruleset-engine. The ruleset-engine +invokes the corresponding method. In doing so, there are three possible outcomes: + +1. JS returns "Approve" + * Auto-approve request +2. JS returns "Reject" + * Auto-reject request +3. Error occurs, or something else is returned + * Pass on to `next` ui: the regular UI channel. + +A more advanced example can be found below, "Example 1: ruleset for a rate-limited window", using `storage` to `Put` and `Get` `string`s by key. + +* At the time of writing, storage only exists as an ephemeral unencrypted implementation, to be used during testing. + +### Things to note + +The Otto vm has a few [caveats](https://github.com/robertkrimen/otto): + +* "use strict" will parse, but does nothing. +* The regular expression engine (re2/regexp) is not fully compatible with the ECMA5 specification. +* Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported. + +Additionally, a few more have been added + +* The rule execution cannot load external javascript files. +* The only preloaded libary is [`bignumber.js`](https://github.com/MikeMcl/bignumber.js) version `2.0.3`. This one is fairly old, and is not aligned with the documentation at the github repository. +* Each invocation is made in a fresh virtual machine. This means that you cannot store data in global variables between invocations. This is a deliberate choice -- if you want to store data, use the disk-backed `storage`, since rules should not rely on ephemeral data. +* Javascript API parameters are _always_ an object. This is also a design choice, to ensure that parameters are accessed by _key_ and not by order. This is to prevent mistakes due to missing parameters or parameter changes. +* The JS engine has access to `storage` and `console`. + +#### Security considerations + +##### Security of ruleset + +Some security precautions can be made, such as: + +* Never load `ruleset.js` unless the file is `readonly` (`r-??-??-?`). If the user wishes to modify the ruleset, he must make it writeable and then set back to readonly. + * This is to prevent attacks where files are dropped on the users disk. +* Since we're going to have to have some form of secure storage (not defined in this section), we could also store the `sha3` of the `ruleset.js` file in there. + * If the user wishes to modify the ruleset, he'd then have to perform e.g. `signer --attest /path/to/ruleset --credential ` + +##### Security of implementation + +The drawbacks of this very flexible solution is that the `signer` needs to contain a javascript engine. This is pretty simple to implement, since it's already +implemented for `geth`. There are no known security vulnerabilities in, nor have we had any security-problems with it so far. + +The javascript engine would be an added attack surface; but if the validation of `rulesets` is made good (with hash-based attestation), the actual javascript cannot be considered +an attack surface -- if an attacker can control the ruleset, a much simpler attack would be to implement an "always-approve" rule instead of exploiting the js vm. The only benefit +to be gained from attacking the actual `signer` process from the `js` side would be if it could somehow extract cryptographic keys from memory. + +##### Security in usability + +Javascript is flexible, but also easy to get wrong, especially when users assume that `js` can handle large integers natively. Typical errors +include trying to multiply `gasCost` with `gas` without using `bigint`:s. + +It's unclear whether any other DSL could be more secure; since there's always the possibility of erroneously implementing a rule. + + +## Credential management + +The ability to auto-approve transaction means that the signer needs to have necessary credentials to decrypt keyfiles. These passwords are hereafter called `ksp` (keystore pass). + +### Example implementation + +Upon startup of the signer, the signer is given a switch: `--seed ` +The `seed` contains a blob of bytes, which is the master seed for the `signer`. + +The `signer` uses the `seed` to: + +* Generate the `path` where the settings are stored. + * `./settings/1df094eb-c2b1-4689-90dd-790046d38025/vault.dat` + * `./settings/1df094eb-c2b1-4689-90dd-790046d38025/rules.js` +* Generate the encryption password for `vault.dat`. + +The `vault.dat` would be an encrypted container storing the following information: + +* `ksp` entries +* `sha256` hash of `rules.js` +* Information about pair:ed callers (not yet specified) + +### Security considerations + +This would leave it up to the user to ensure that the `path/to/masterseed` is handled in a secure way. It's difficult to get around this, although one could +imagine leveraging OS-level keychains where supported. The setup is however in general similar to how ssh-keys are stored in `.ssh/`. + + +# Implementation status + +This is now implemented (with ephemeral non-encrypted storage for now, so not yet enabled). + +## Example 1: ruleset for a rate-limited window + + +```js +function big(str) { + if (str.slice(0, 2) == "0x") { + return new BigNumber(str.slice(2), 16) + } + return new BigNumber(str) +} + +// Time window: 1 week +var window = 1000* 3600*24*7; + +// Limit : 1 ether +var limit = new BigNumber("1e18"); + +function isLimitOk(transaction) { + var value = big(transaction.value) + // Start of our window function + var windowstart = new Date().getTime() - window; + + var txs = []; + var stored = storage.get('txs'); + + if (stored != "") { + txs = JSON.parse(stored) + } + // First, remove all that have passed out of the time-window + var newtxs = txs.filter(function(tx){return tx.tstamp > windowstart}); + console.log(txs, newtxs.length); + + // Secondly, aggregate the current sum + sum = new BigNumber(0) + + sum = newtxs.reduce(function(agg, tx){ return big(tx.value).plus(agg)}, sum); + console.log("ApproveTx > Sum so far", sum); + console.log("ApproveTx > Requested", value.toNumber()); + + // Would we exceed weekly limit ? + return sum.plus(value).lt(limit) + +} +function ApproveTx(r) { + if (isLimitOk(r.transaction)) { + return "Approve" + } + return "Nope" +} + +/** +* OnApprovedTx(str) is called when a transaction has been approved and signed. The parameter + * 'response_str' contains the return value that will be sent to the external caller. +* The return value from this method is ignore - the reason for having this callback is to allow the +* ruleset to keep track of approved transactions. +* +* When implementing rate-limited rules, this callback should be used. +* If a rule responds with neither 'Approve' nor 'Reject' - the tx goes to manual processing. If the user +* then accepts the transaction, this method will be called. +* +* TLDR; Use this method to keep track of signed transactions, instead of using the data in ApproveTx. +*/ +function OnApprovedTx(resp) { + var value = big(resp.tx.value) + var txs = [] + // Load stored transactions + var stored = storage.get('txs'); + if (stored != "") { + txs = JSON.parse(stored) + } + // Add this to the storage + txs.push({tstamp: new Date().getTime(), value: value}); + storage.put("txs", JSON.stringify(txs)); +} +``` + +## Example 2: allow destination + +```js +function ApproveTx(r) { + if (r.transaction.from.toLowerCase() == "0x0000000000000000000000000000000000001337") { + return "Approve" + } + if (r.transaction.from.toLowerCase() == "0x000000000000000000000000000000000000dead") { + return "Reject" + } + // Otherwise goes to manual processing +} +``` + +## Example 3: Allow listing + +```js +function ApproveListing() { + return "Approve" +} +``` diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/clef/tutorial.md b/vendor/github.com/ethereum/go-ethereum/cmd/clef/tutorial.md new file mode 100644 index 00000000..a0a6b052 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/clef/tutorial.md @@ -0,0 +1,353 @@ +## Initializing Clef + +First thing's first, Clef needs to store some data itself. Since that data might be sensitive (passwords, signing rules, accounts), Clef's entire storage is encrypted. To support encrypting data, the first step is to initialize Clef with a random master seed, itself too encrypted with your chosen password: + +```text +$ clef init + +WARNING! + +Clef is an account management tool. It may, like any software, contain bugs. + +Please take care to +- backup your keystore files, +- verify that the keystore(s) can be opened with your password. + +Clef is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +Enter 'ok' to proceed: +> ok + +The master seed of clef will be locked with a password. +Please specify a password. Do not forget this password! +Passphrase: +Repeat passphrase: + +A master seed has been generated into /home/martin/.clef/masterseed.json + +This is required to be able to store credentials, such as: +* Passwords for keystores (used by rule engine) +* Storage for JavaScript auto-signing rules +* Hash of JavaScript rule-file + +You should treat 'masterseed.json' with utmost secrecy and make a backup of it! +* The password is necessary but not enough, you need to back up the master seed too! +* The master seed does not contain your accounts, those need to be backed up separately! +``` + +*For readability purposes, we'll remove the WARNING printout, user confirmation and the unlocking of the master seed in the rest of this document.* + +## Remote interactions + +Clef is capable of managing both key-file based accounts as well as hardware wallets. To evaluate clef, we're going to point it to our Rinkeby testnet keystore and specify the Rinkeby chain ID for signing (Clef doesn't have a backing chain, so it doesn't know what network it runs on). + +```text +$ clef --keystore ~/.ethereum/rinkeby/keystore --chainid 4 + +INFO [07-01|11:00:46.385] Starting signer chainid=4 keystore=$HOME/.ethereum/rinkeby/keystore light-kdf=false advanced=false +DEBUG[07-01|11:00:46.389] FS scan times list=3.521941ms set=9.017µs diff=4.112µs +DEBUG[07-01|11:00:46.391] Ledger support enabled +DEBUG[07-01|11:00:46.391] Trezor support enabled via HID +DEBUG[07-01|11:00:46.391] Trezor support enabled via WebUSB +INFO [07-01|11:00:46.391] Audit logs configured file=audit.log +DEBUG[07-01|11:00:46.392] IPC registered namespace=account +INFO [07-01|11:00:46.392] IPC endpoint opened url=$HOME/.clef/clef.ipc +------- Signer info ------- +* intapi_version : 7.0.0 +* extapi_version : 6.0.0 +* extapi_http : n/a +* extapi_ipc : $HOME/.clef/clef.ipc +``` + +By default, Clef starts up in CLI (Command Line Interface) mode. Arbitrary remote processes may *request* account interactions (e.g. sign a transaction), which the user will need to individually *confirm*. + +To test this out, we can *request* Clef to list all account via its *External API endpoint*: + +```text +echo '{"id": 1, "jsonrpc": "2.0", "method": "account_list"}' | nc -U ~/.clef/clef.ipc +``` + +This will prompt the user within the Clef CLI to confirm or deny the request: + +```text +-------- List Account request-------------- +A request has been made to list all accounts. +You can select which accounts the caller can see + [x] 0xD9C9Cd5f6779558b6e0eD4e6Acf6b1947E7fA1F3 + URL: keystore://$HOME/.ethereum/rinkeby/keystore/UTC--2017-04-14T15-15-00.327614556Z--d9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3 + [x] 0x086278A6C067775F71d6B2BB1856Db6E28c30418 + URL: keystore://$HOME/.ethereum/rinkeby/keystore/UTC--2018-02-06T22-53-11.211657239Z--086278a6c067775f71d6b2bb1856db6e28c30418 +------------------------------------------- +Request context: + NA -> NA -> NA + +Additional HTTP header data, provided by the external caller: + User-Agent: + Origin: +Approve? [y/N]: +> +``` + +Depending on whether we approve or deny the request, the original NetCat process will get: + +```text +{"jsonrpc":"2.0","id":1,"result":["0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3","0x086278a6c067775f71d6b2bb1856db6e28c30418"]} + +or + +{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"Request denied"}} +``` + +Apart from listing accounts, you can also *request* creating a new account; signing transactions and data; and recovering signatures. You can find the available methods in the Clef [External API Spec](https://github.com/ethereum/go-ethereum/tree/master/cmd/clef#external-api-1) and the [External API Changelog](https://github.com/ethereum/go-ethereum/blob/master/cmd/clef/extapi_changelog.md). + +*Note, the number of things you can do from the External API is deliberately small, since we want to limit the power of remote calls by as much as possible! Clef has an [Internal API](https://github.com/ethereum/go-ethereum/tree/master/cmd/clef#ui-api-1) too for the UI (User Interface) which is much richer and can support custom interfaces on top. But that's out of scope here.* + +## Automatic rules + +For most users, manually confirming every transaction is the way to go. However, there are cases when it makes sense to set up some rules which permit Clef to sign a transaction without prompting the user. One such example would be running a signer on Rinkeby or other PoA networks. + +For starters, we can create a rule file that automatically permits anyone to list our available accounts without user confirmation. The rule file is a tiny JavaScript snippet that you can program however you want: + +```js +function ApproveListing() { + return "Approve" +} +``` + +Of course, Clef isn't going to just accept and run arbitrary scripts you give it, that would be dangerous if someone changes your rule file! Instead, you need to explicitly *attest* the rule file, which entails injecting its hash into Clef's secure store. + +```text +$ sha256sum rules.js +645b58e4f945e24d0221714ff29f6aa8e860382ced43490529db1695f5fcc71c rules.js + +$ clef attest 645b58e4f945e24d0221714ff29f6aa8e860382ced43490529db1695f5fcc71c +Decrypt master seed of clef +Passphrase: +INFO [07-01|13:25:03.290] Ruleset attestation updated sha256=645b58e4f945e24d0221714ff29f6aa8e860382ced43490529db1695f5fcc71c +``` + +At this point, we can start Clef with the rule file: + +```text +$ clef --keystore ~/.ethereum/rinkeby/keystore --chainid 4 --rules rules.js + +INFO [07-01|13:39:49.726] Rule engine configured file=rules.js +INFO [07-01|13:39:49.726] Starting signer chainid=4 keystore=$HOME/.ethereum/rinkeby/keystore light-kdf=false advanced=false +DEBUG[07-01|13:39:49.726] FS scan times list=35.15µs set=4.251µs diff=2.766µs +DEBUG[07-01|13:39:49.727] Ledger support enabled +DEBUG[07-01|13:39:49.727] Trezor support enabled via HID +DEBUG[07-01|13:39:49.727] Trezor support enabled via WebUSB +INFO [07-01|13:39:49.728] Audit logs configured file=audit.log +DEBUG[07-01|13:39:49.728] IPC registered namespace=account +INFO [07-01|13:39:49.728] IPC endpoint opened url=$HOME/.clef/clef.ipc +------- Signer info ------- +* intapi_version : 7.0.0 +* extapi_version : 6.0.0 +* extapi_http : n/a +* extapi_ipc : $HOME/.clef/clef.ipc +``` + +Any account listing *request* will now be auto-approved by the rule file: + +```text +$ echo '{"id": 1, "jsonrpc": "2.0", "method": "account_list"}' | nc -U ~/.clef/clef.ipc +{"jsonrpc":"2.0","id":1,"result":["0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3","0x086278a6c067775f71d6b2bb1856db6e28c30418"]} +``` + +## Under the hood + +While doing the operations above, these files have been created: + +```text +$ ls -laR ~/.clef/ + +$HOME/.clef/: +total 24 +drwxr-x--x 3 user user 4096 Jul 1 13:45 . +drwxr-xr-x 102 user user 12288 Jul 1 13:39 .. +drwx------ 2 user user 4096 Jul 1 13:25 02f90c0603f4f2f60188 +-r-------- 1 user user 868 Jun 28 13:55 masterseed.json + +$HOME/.clef/02f90c0603f4f2f60188: +total 12 +drwx------ 2 user user 4096 Jul 1 13:25 . +drwxr-x--x 3 user user 4096 Jul 1 13:45 .. +-rw------- 1 user user 159 Jul 1 13:25 config.json + +$ cat ~/.clef/02f90c0603f4f2f60188/config.json +{"ruleset_sha256":{"iv":"SWWEtnl+R+I+wfG7","c":"I3fjmwmamxVcfGax7D0MdUOL29/rBWcs73WBILmYK0o1CrX7wSMc3y37KsmtlZUAjp0oItYq01Ow8VGUOzilG91tDHInB5YHNtm/YkufEbo="}} +``` + +In `$HOME/.clef`, the `masterseed.json` file was created, containing the master seed. This seed was then used to derive a few other things: + +- **Vault location**: in this case `02f90c0603f4f2f60188`. + - If you use a different master seed, a different vault location will be used that does not conflict with each other (e.g. `clef --signersecret /path/to/file`). This allows you to run multiple instances of Clef, each with its own rules (e.g. mainnet + testnet). +- **`config.json`**: the encrypted key/value storage for configuration data, currently only containing the key `ruleset_sha256`, the attested hash of the automatic rules to use. + +## Advanced rules + +In order to make more useful rules - like signing transactions - the signer needs access to the passwords needed to unlock keys from the keystore. You can inject an unlock password via `clef setpw`. + +```text +$ clef setpw 0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3 + +Please enter a passphrase to store for this address: +Passphrase: +Repeat passphrase: + +Decrypt master seed of clef +Passphrase: +INFO [07-01|14:05:56.031] Credential store updated key=0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3 +``` + +Now let's update the rules to make use of the new credentials: + +```js +function ApproveListing() { + return "Approve" +} + +function ApproveSignData(req) { + if (req.address.toLowerCase() == "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3") { + if (req.messages[0].value.indexOf("bazonk") >= 0) { + return "Approve" + } + return "Reject" + } + // Otherwise goes to manual processing +} +``` + +In this example: + +- Any requests to sign data with the account `0xd9c9...` will be: + - Auto-approved if the message contains `bazonk`, + - Auto-rejected if the message does not contain `bazonk`, +- Any other requests will be passed along for manual confirmation. + +*Note, to make this example work, please use you own accounts. You can create a new account either via Clef or the traditional account CLI tools. If the latter was chosen, make sure both Clef and Geth use the same keystore by specifing `--keystore path/to/your/keystore` when running Clef.* + +Attest the new rule file so that Clef will accept loading it: + +```text +$ sha256sum rules.js +f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178 rules.js + +$ clef attest f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178 +Decrypt master seed of clef +Passphrase: +INFO [07-01|14:11:28.509] Ruleset attestation updated sha256=f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178 +``` + +Restart Clef with the new rules in place: + +``` +$ clef --keystore ~/.ethereum/rinkeby/keystore --chainid 4 --rules rules.js + +INFO [07-01|14:12:41.636] Rule engine configured file=rules.js +INFO [07-01|14:12:41.636] Starting signer chainid=4 keystore=$HOME/.ethereum/rinkeby/keystore light-kdf=false advanced=false +DEBUG[07-01|14:12:41.636] FS scan times list=46.722µs set=4.47µs diff=2.157µs +DEBUG[07-01|14:12:41.637] Ledger support enabled +DEBUG[07-01|14:12:41.637] Trezor support enabled via HID +DEBUG[07-01|14:12:41.638] Trezor support enabled via WebUSB +INFO [07-01|14:12:41.638] Audit logs configured file=audit.log +DEBUG[07-01|14:12:41.638] IPC registered namespace=account +INFO [07-01|14:12:41.638] IPC endpoint opened url=$HOME/.clef/clef.ipc +------- Signer info ------- +* intapi_version : 7.0.0 +* extapi_version : 6.0.0 +* extapi_http : n/a +* extapi_ipc : $HOME/.clef/clef.ipc +``` + +Then test signing, once with `bazonk` and once without: + +``` +$ echo '{"id": 1, "jsonrpc":"2.0", "method":"account_signData", "params":["data/plain", "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3", "0x202062617a6f6e6b2062617a2067617a0a"]}' | nc -U ~/.clef/clef.ipc +{"jsonrpc":"2.0","id":1,"result":"0x4f93e3457027f6be99b06b3392d0ebc60615ba448bb7544687ef1248dea4f5317f789002df783979c417d969836b6fda3710f5bffb296b4d51c8aaae6e2ac4831c"} + +$ echo '{"id": 1, "jsonrpc":"2.0", "method":"account_signData", "params":["data/plain", "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3", "0x2020626f6e6b2062617a2067617a0a"]}' | nc -U ~/.clef/clef.ipc +{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"Request denied"}} +``` + +Meanwhile, in the Clef output log you can see: +```text +INFO [02-21|14:42:41] Op approved +INFO [02-21|14:42:56] Op rejected +``` + +The signer also stores all traffic over the external API in a log file. The last 4 lines shows the two requests and their responses: + +```text +$ tail -n 4 audit.log +t=2019-07-01T15:52:14+0300 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"NA\",\"local\":\"NA\",\"scheme\":\"NA\",\"User-Agent\":\"\",\"Origin\":\"\"}" addr="0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3 [chksum INVALID]" data=0x202062617a6f6e6b2062617a2067617a0a content-type=data/plain +t=2019-07-01T15:52:14+0300 lvl=info msg=SignData api=signer type=response data=4f93e3457027f6be99b06b3392d0ebc60615ba448bb7544687ef1248dea4f5317f789002df783979c417d969836b6fda3710f5bffb296b4d51c8aaae6e2ac4831c error=nil +t=2019-07-01T15:52:23+0300 lvl=info msg=SignData api=signer type=request metadata="{\"remote\":\"NA\",\"local\":\"NA\",\"scheme\":\"NA\",\"User-Agent\":\"\",\"Origin\":\"\"}" addr="0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3 [chksum INVALID]" data=0x2020626f6e6b2062617a2067617a0a content-type=data/plain +t=2019-07-01T15:52:23+0300 lvl=info msg=SignData api=signer type=response data= error="Request denied" +``` + +For more details on writing automatic rules, please see the [rules spec](https://github.com/ethereum/go-ethereum/blob/master/cmd/clef/rules.md). + +## Geth integration + +Of course, as awesome as Clef is, it's not feasible to interact with it via JSON RPC by hand. Long term, we're hoping to convince the general Ethereum community to support Clef as a general signer (it's only 3-5 methods), thus allowing your favorite DApp, Metamask, MyCrypto, etc to request signatures directly. + +Until then however, we're trying to pave the way via Geth. Geth v1.9.0 has built in support via `--signer ` for using a local or remote Clef instance as an account backend! + +We can try this by running Clef with our previous rules on Rinkeby (for now it's a good idea to allow auto-listing accounts, since Geth likes to retrieve them once in a while). + +```text +$ clef --keystore ~/.ethereum/rinkeby/keystore --chainid 4 --rules rules.js +``` + +In a different window we can start Geth, list our accounts, even list our wallets to see where the accounts originate from: + +```text +$ geth --rinkeby --signer=~/.clef/clef.ipc console + +> eth.accounts +["0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3", "0x086278a6c067775f71d6b2bb1856db6e28c30418"] + +> personal.listWallets +[{ + accounts: [{ + address: "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3", + url: "extapi://$HOME/.clef/clef.ipc" + }, { + address: "0x086278a6c067775f71d6b2bb1856db6e28c30418", + url: "extapi://$HOME/.clef/clef.ipc" + }], + status: "ok [version=6.0.0]", + url: "extapi://$HOME/.clef/clef.ipc" +}] + +> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[0]}) +``` + +Lastly, when we requested a transaction to be sent, Clef prompted us in the original window to approve it: + +```text +--------- Transaction request------------- +to: 0xD9C9Cd5f6779558b6e0eD4e6Acf6b1947E7fA1F3 +from: 0xD9C9Cd5f6779558b6e0eD4e6Acf6b1947E7fA1F3 [chksum ok] +value: 0 wei +gas: 0x5208 (21000) +gasprice: 1000000000 wei +nonce: 0x2366 (9062) + +Request context: + NA -> NA -> NA + +Additional HTTP header data, provided by the external caller: + User-Agent: + Origin: +------------------------------------------- +Approve? [y/N]: +> y +``` + +:boom: + +*Note, if you enable the external signer backend in Geth, all other account management is disabled. This is because long term we want to remove account management from Geth.* diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/evm/runner.go b/vendor/github.com/ethereum/go-ethereum/cmd/evm/runner.go new file mode 100644 index 00000000..318aa222 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/evm/runner.go @@ -0,0 +1,263 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "math/big" + "os" + goruntime "runtime" + "runtime/pprof" + "time" + + "github.com/ethereum/go-ethereum/cmd/evm/internal/compiler" + "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/core/vm/runtime" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" + cli "gopkg.in/urfave/cli.v1" +) + +var runCommand = cli.Command{ + Action: runCmd, + Name: "run", + Usage: "run arbitrary evm binary", + ArgsUsage: "", + Description: `The run command runs arbitrary EVM code.`, +} + +// readGenesis will read the given JSON format genesis file and return +// the initialized Genesis structure +func readGenesis(genesisPath string) *core.Genesis { + // Make sure we have a valid genesis JSON + //genesisPath := ctx.Args().First() + if len(genesisPath) == 0 { + utils.Fatalf("Must supply path to genesis JSON file") + } + file, err := os.Open(genesisPath) + if err != nil { + utils.Fatalf("Failed to read genesis file: %v", err) + } + defer file.Close() + + genesis := new(core.Genesis) + if err := json.NewDecoder(file).Decode(genesis); err != nil { + utils.Fatalf("invalid genesis file: %v", err) + } + return genesis +} + +func runCmd(ctx *cli.Context) error { + glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false))) + glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name))) + log.Root().SetHandler(glogger) + logconfig := &vm.LogConfig{ + DisableMemory: ctx.GlobalBool(DisableMemoryFlag.Name), + DisableStack: ctx.GlobalBool(DisableStackFlag.Name), + Debug: ctx.GlobalBool(DebugFlag.Name), + } + + var ( + tracer vm.Tracer + debugLogger *vm.StructLogger + statedb *state.StateDB + chainConfig *params.ChainConfig + sender = common.BytesToAddress([]byte("sender")) + receiver = common.BytesToAddress([]byte("receiver")) + genesisConfig *core.Genesis + ) + if ctx.GlobalBool(MachineFlag.Name) { + tracer = vm.NewJSONLogger(logconfig, os.Stdout) + } else if ctx.GlobalBool(DebugFlag.Name) { + debugLogger = vm.NewStructLogger(logconfig) + tracer = debugLogger + } else { + debugLogger = vm.NewStructLogger(logconfig) + } + if ctx.GlobalString(GenesisFlag.Name) != "" { + gen := readGenesis(ctx.GlobalString(GenesisFlag.Name)) + genesisConfig = gen + db := rawdb.NewMemoryDatabase() + genesis := gen.ToBlock(db) + statedb, _ = state.New(genesis.Root(), state.NewDatabase(db)) + chainConfig = gen.Config + } else { + statedb, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) + genesisConfig = new(core.Genesis) + } + if ctx.GlobalString(SenderFlag.Name) != "" { + sender = common.HexToAddress(ctx.GlobalString(SenderFlag.Name)) + } + statedb.CreateAccount(sender) + + if ctx.GlobalString(ReceiverFlag.Name) != "" { + receiver = common.HexToAddress(ctx.GlobalString(ReceiverFlag.Name)) + } + + var ( + code []byte + ret []byte + err error + ) + codeFileFlag := ctx.GlobalString(CodeFileFlag.Name) + codeFlag := ctx.GlobalString(CodeFlag.Name) + + // The '--code' or '--codefile' flag overrides code in state + if codeFileFlag != "" || codeFlag != "" { + var hexcode []byte + if codeFileFlag != "" { + var err error + // If - is specified, it means that code comes from stdin + if codeFileFlag == "-" { + //Try reading from stdin + if hexcode, err = ioutil.ReadAll(os.Stdin); err != nil { + fmt.Printf("Could not load code from stdin: %v\n", err) + os.Exit(1) + } + } else { + // Codefile with hex assembly + if hexcode, err = ioutil.ReadFile(codeFileFlag); err != nil { + fmt.Printf("Could not load code from file: %v\n", err) + os.Exit(1) + } + } + } else { + hexcode = []byte(codeFlag) + } + if len(hexcode)%2 != 0 { + fmt.Printf("Invalid input length for hex data (%d)\n", len(hexcode)) + os.Exit(1) + } + code = common.FromHex(string(hexcode)) + } else if fn := ctx.Args().First(); len(fn) > 0 { + // EASM-file to compile + src, err := ioutil.ReadFile(fn) + if err != nil { + return err + } + bin, err := compiler.Compile(fn, src, false) + if err != nil { + return err + } + code = common.Hex2Bytes(bin) + } + initialGas := ctx.GlobalUint64(GasFlag.Name) + if genesisConfig.GasLimit != 0 { + initialGas = genesisConfig.GasLimit + } + runtimeConfig := runtime.Config{ + Origin: sender, + State: statedb, + GasLimit: initialGas, + GasPrice: utils.GlobalBig(ctx, PriceFlag.Name), + Value: utils.GlobalBig(ctx, ValueFlag.Name), + Difficulty: genesisConfig.Difficulty, + Time: new(big.Int).SetUint64(genesisConfig.Timestamp), + Coinbase: genesisConfig.Coinbase, + BlockNumber: new(big.Int).SetUint64(genesisConfig.Number), + EVMConfig: vm.Config{ + Tracer: tracer, + Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name), + EVMInterpreter: ctx.GlobalString(EVMInterpreterFlag.Name), + }, + } + + if cpuProfilePath := ctx.GlobalString(CPUProfileFlag.Name); cpuProfilePath != "" { + f, err := os.Create(cpuProfilePath) + if err != nil { + fmt.Println("could not create CPU profile: ", err) + os.Exit(1) + } + if err := pprof.StartCPUProfile(f); err != nil { + fmt.Println("could not start CPU profile: ", err) + os.Exit(1) + } + defer pprof.StopCPUProfile() + } + + if chainConfig != nil { + runtimeConfig.ChainConfig = chainConfig + } + tstart := time.Now() + var leftOverGas uint64 + if ctx.GlobalBool(CreateFlag.Name) { + input := append(code, common.Hex2Bytes(ctx.GlobalString(InputFlag.Name))...) + ret, _, leftOverGas, err = runtime.Create(input, &runtimeConfig) + } else { + if len(code) > 0 { + statedb.SetCode(receiver, code) + } + ret, leftOverGas, err = runtime.Call(receiver, common.Hex2Bytes(ctx.GlobalString(InputFlag.Name)), &runtimeConfig) + } + execTime := time.Since(tstart) + + if ctx.GlobalBool(DumpFlag.Name) { + statedb.Commit(true) + statedb.IntermediateRoot(true) + fmt.Println(string(statedb.Dump(false, false, true))) + } + + if memProfilePath := ctx.GlobalString(MemProfileFlag.Name); memProfilePath != "" { + f, err := os.Create(memProfilePath) + if err != nil { + fmt.Println("could not create memory profile: ", err) + os.Exit(1) + } + if err := pprof.WriteHeapProfile(f); err != nil { + fmt.Println("could not write memory profile: ", err) + os.Exit(1) + } + f.Close() + } + + if ctx.GlobalBool(DebugFlag.Name) { + if debugLogger != nil { + fmt.Fprintln(os.Stderr, "#### TRACE ####") + vm.WriteTrace(os.Stderr, debugLogger.StructLogs()) + } + fmt.Fprintln(os.Stderr, "#### LOGS ####") + vm.WriteLogs(os.Stderr, statedb.Logs()) + } + + if ctx.GlobalBool(StatDumpFlag.Name) { + var mem goruntime.MemStats + goruntime.ReadMemStats(&mem) + fmt.Fprintf(os.Stderr, `evm execution time: %v +heap objects: %d +allocations: %d +total allocations: %d +GC calls: %d +Gas used: %d + +`, execTime, mem.HeapObjects, mem.Alloc, mem.TotalAlloc, mem.NumGC, initialGas-leftOverGas) + } + if tracer == nil { + fmt.Printf("0x%x\n", ret) + if err != nil { + fmt.Printf(" error: %v\n", err) + } + } + + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/evm/staterunner.go b/vendor/github.com/ethereum/go-ethereum/cmd/evm/staterunner.go new file mode 100644 index 00000000..cef2aedb --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/evm/staterunner.go @@ -0,0 +1,127 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "os" + + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/tests" + + cli "gopkg.in/urfave/cli.v1" +) + +var stateTestCommand = cli.Command{ + Action: stateTestCmd, + Name: "statetest", + Usage: "executes the given state tests", + ArgsUsage: "", +} + +// StatetestResult contains the execution status after running a state test, any +// error that might have occurred and a dump of the final state if requested. +type StatetestResult struct { + Name string `json:"name"` + Pass bool `json:"pass"` + Fork string `json:"fork"` + Error string `json:"error,omitempty"` + State *state.Dump `json:"state,omitempty"` +} + +func stateTestCmd(ctx *cli.Context) error { + if len(ctx.Args().First()) == 0 { + return errors.New("path-to-test argument required") + } + // Configure the go-ethereum logger + glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false))) + glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name))) + log.Root().SetHandler(glogger) + + // Configure the EVM logger + config := &vm.LogConfig{ + DisableMemory: ctx.GlobalBool(DisableMemoryFlag.Name), + DisableStack: ctx.GlobalBool(DisableStackFlag.Name), + } + var ( + tracer vm.Tracer + debugger *vm.StructLogger + ) + switch { + case ctx.GlobalBool(MachineFlag.Name): + tracer = vm.NewJSONLogger(config, os.Stderr) + + case ctx.GlobalBool(DebugFlag.Name): + debugger = vm.NewStructLogger(config) + tracer = debugger + + default: + debugger = vm.NewStructLogger(config) + } + // Load the test content from the input file + src, err := ioutil.ReadFile(ctx.Args().First()) + if err != nil { + return err + } + var tests map[string]tests.StateTest + if err = json.Unmarshal(src, &tests); err != nil { + return err + } + // Iterate over all the tests, run them and aggregate the results + cfg := vm.Config{ + Tracer: tracer, + Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name), + } + results := make([]StatetestResult, 0, len(tests)) + for key, test := range tests { + for _, st := range test.Subtests() { + // Run the test and aggregate the result + result := &StatetestResult{Name: key, Fork: st.Fork, Pass: true} + state, err := test.Run(st, cfg) + // print state root for evmlab tracing + if ctx.GlobalBool(MachineFlag.Name) && state != nil { + fmt.Fprintf(os.Stderr, "{\"stateRoot\": \"%x\"}\n", state.IntermediateRoot(false)) + } + if err != nil { + // Test failed, mark as so and dump any state to aid debugging + result.Pass, result.Error = false, err.Error() + if ctx.GlobalBool(DumpFlag.Name) && state != nil { + dump := state.RawDump(false, false, true) + result.State = &dump + } + } + + results = append(results, *result) + + // Print any structured logs collected + if ctx.GlobalBool(DebugFlag.Name) { + if debugger != nil { + fmt.Fprintln(os.Stderr, "#### TRACE ####") + vm.WriteTrace(os.Stderr, debugger.StructLogs()) + } + } + } + } + out, _ := json.MarshalIndent(results, "", " ") + fmt.Println(string(out)) + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/geth/chaincmd.go b/vendor/github.com/ethereum/go-ethereum/cmd/geth/chaincmd.go index c91545c7..49e6a059 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/geth/chaincmd.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/geth/chaincmd.go @@ -162,6 +162,10 @@ Remove blockchain and state databases`, utils.DataDirFlag, utils.CacheFlag, utils.SyncModeFlag, + utils.IterativeOutputFlag, + utils.ExcludeCodeFlag, + utils.ExcludeStorageFlag, + utils.IncludeIncompletesFlag, }, Category: "BLOCKCHAIN COMMANDS", Description: ` @@ -287,7 +291,7 @@ func importChain(ctx *cli.Context) error { fmt.Printf("Allocations: %.3f million\n", float64(mem.Mallocs)/1000000) fmt.Printf("GC pause: %v\n\n", time.Duration(mem.PauseTotalNs)) - if ctx.GlobalIsSet(utils.NoCompactionFlag.Name) { + if ctx.GlobalBool(utils.NoCompactionFlag.Name) { return nil } @@ -504,6 +508,7 @@ func dump(ctx *cli.Context) error { defer stack.Close() chain, chainDb := utils.MakeChain(ctx, stack) + defer chainDb.Close() for _, arg := range ctx.Args() { var block *types.Block if hashish(arg) { @@ -520,10 +525,20 @@ func dump(ctx *cli.Context) error { if err != nil { utils.Fatalf("could not create new state: %v", err) } - fmt.Printf("%s\n", state.Dump()) + excludeCode := ctx.Bool(utils.ExcludeCodeFlag.Name) + excludeStorage := ctx.Bool(utils.ExcludeStorageFlag.Name) + includeMissing := ctx.Bool(utils.IncludeIncompletesFlag.Name) + if ctx.Bool(utils.IterativeOutputFlag.Name) { + state.IterativeDump(excludeCode, excludeStorage, !includeMissing, json.NewEncoder(os.Stdout)) + } else { + if includeMissing { + fmt.Printf("If you want to include accounts with missing preimages, you need iterative output, since" + + " otherwise the accounts will overwrite each other in the resulting mapping.") + } + fmt.Printf("%v %s\n", includeMissing, state.Dump(excludeCode, excludeStorage, false)) + } } } - chainDb.Close() return nil } diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/geth/config.go b/vendor/github.com/ethereum/go-ethereum/cmd/geth/config.go index 204eb37c..8f1e2089 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/geth/config.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/geth/config.go @@ -20,7 +20,6 @@ import ( "bufio" "errors" "fmt" - "math/big" "os" "reflect" "unicode" @@ -30,7 +29,6 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/dashboard" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/graphql" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" whisper "github.com/ethereum/go-ethereum/whisper/whisperv6" @@ -125,7 +123,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) { } // Apply flags. - utils.SetULC(ctx, &cfg.Eth) utils.SetNodeConfig(ctx, &cfg.Node) stack, err := node.New(&cfg.Node) if err != nil { @@ -135,7 +132,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) { if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) { cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name) } - utils.SetShhConfig(ctx, stack, &cfg.Shh) utils.SetDashboardConfig(ctx, &cfg.Dashboard) @@ -154,10 +150,6 @@ func enableWhisper(ctx *cli.Context) bool { func makeFullNode(ctx *cli.Context) *node.Node { stack, cfg := makeConfigNode(ctx) - if ctx.GlobalIsSet(utils.ConstantinopleOverrideFlag.Name) { - cfg.Eth.ConstantinopleOverride = new(big.Int).SetUint64(ctx.GlobalUint64(utils.ConstantinopleOverrideFlag.Name)) - } - utils.RegisterEthService(stack, &cfg.Eth) if ctx.GlobalBool(utils.StateDiffFlag.Name) { @@ -183,14 +175,10 @@ func makeFullNode(ctx *cli.Context) *node.Node { } utils.RegisterShhService(stack, &cfg.Shh) } - - // Configure GraphQL if required + // Configure GraphQL if requested if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) { - if err := graphql.RegisterGraphQLService(stack, cfg.Node.GraphQLEndpoint(), cfg.Node.GraphQLCors, cfg.Node.GraphQLVirtualHosts, cfg.Node.HTTPTimeouts); err != nil { - utils.Fatalf("Failed to register the Ethereum service: %v", err) - } + utils.RegisterGraphQLService(stack, cfg.Node.GraphQLEndpoint(), cfg.Node.GraphQLCors, cfg.Node.GraphQLVirtualHosts, cfg.Node.HTTPTimeouts) } - // Add the Ethereum Stats daemon if requested. if cfg.Ethstats.URL != "" { utils.RegisterEthStatsService(stack, cfg.Ethstats.URL) diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/geth/main.go b/vendor/github.com/ethereum/go-ethereum/cmd/geth/main.go index 09086d0f..9423648c 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/geth/main.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/geth/main.go @@ -21,6 +21,7 @@ import ( "fmt" "math" "os" + "runtime" godebug "runtime/debug" "sort" "strconv" @@ -37,6 +38,7 @@ import ( "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/internal/debug" + "github.com/ethereum/go-ethereum/les" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/node" @@ -88,18 +90,19 @@ var ( utils.TxPoolAccountQueueFlag, utils.TxPoolGlobalQueueFlag, utils.TxPoolLifetimeFlag, - utils.ULCModeConfigFlag, - utils.OnlyAnnounceModeFlag, - utils.ULCTrustedNodesFlag, - utils.ULCMinTrustedFractionFlag, utils.SyncModeFlag, utils.ExitWhenSyncedFlag, utils.GCModeFlag, - utils.LightServFlag, - utils.LightBandwidthInFlag, - utils.LightBandwidthOutFlag, - utils.LightPeersFlag, + utils.LightServeFlag, + utils.LightLegacyServFlag, + utils.LightIngressFlag, + utils.LightEgressFlag, + utils.LightMaxPeersFlag, + utils.LightLegacyPeersFlag, utils.LightKDFFlag, + utils.UltraLightServersFlag, + utils.UltraLightFractionFlag, + utils.UltraLightOnlyAnnounceFlag, utils.WhitelistFlag, utils.CacheFlag, utils.CacheDatabaseFlag, @@ -137,7 +140,6 @@ var ( utils.GoerliFlag, utils.VMEnableDebugFlag, utils.NetworkIdFlag, - utils.ConstantinopleOverrideFlag, utils.EthStatsURLFlag, utils.FakePoWFlag, utils.NoCompactionFlag, @@ -261,11 +263,15 @@ func init() { } // Cap the cache allowance and tune the garbage collector var mem gosigar.Mem - if err := mem.Get(); err == nil { - allowance := int(mem.Total / 1024 / 1024 / 3) - if cache := ctx.GlobalInt(utils.CacheFlag.Name); cache > allowance { - log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance) - ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(allowance)) + // Workaround until OpenBSD support lands into gosigar + // Check https://github.com/elastic/gosigar#supported-platforms + if runtime.GOOS != "openbsd" { + if err := mem.Get(); err == nil { + allowance := int(mem.Total / 1024 / 1024 / 3) + if cache := ctx.GlobalInt(utils.CacheFlag.Name); cache > allowance { + log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance) + ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(allowance)) + } } } // Ensure Go's GC ignores the database cache for trigger percentage @@ -328,14 +334,33 @@ func startNode(ctx *cli.Context, stack *node.Node) { events := make(chan accounts.WalletEvent, 16) stack.AccountManager().Subscribe(events) - go func() { - // Create a chain state reader for self-derivation - rpcClient, err := stack.Attach() - if err != nil { - utils.Fatalf("Failed to attach to self: %v", err) - } - stateReader := ethclient.NewClient(rpcClient) + // Create a client to interact with local geth node. + rpcClient, err := stack.Attach() + if err != nil { + utils.Fatalf("Failed to attach to self: %v", err) + } + ethClient := ethclient.NewClient(rpcClient) + // Set contract backend for ethereum service if local node + // is serving LES requests. + if ctx.GlobalInt(utils.LightLegacyServFlag.Name) > 0 || ctx.GlobalInt(utils.LightServeFlag.Name) > 0 { + var ethService *eth.Ethereum + if err := stack.Service(ðService); err != nil { + utils.Fatalf("Failed to retrieve ethereum service: %v", err) + } + ethService.SetContractBackend(ethClient) + } + // Set contract backend for les service if local node is + // running as a light client. + if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { + var lesService *les.LightEthereum + if err := stack.Service(&lesService); err != nil { + utils.Fatalf("Failed to retrieve light ethereum service: %v", err) + } + lesService.SetContractBackend(ethClient) + } + + go func() { // Open any wallets already attached for _, wallet := range stack.AccountManager().Wallets() { if err := wallet.Open(""); err != nil { @@ -359,7 +384,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { } derivationPaths = append(derivationPaths, accounts.DefaultBaseDerivationPath) - event.Wallet.SelfDerive(derivationPaths, stateReader) + event.Wallet.SelfDerive(derivationPaths, ethClient) case accounts.WalletDropped: log.Info("Old wallet dropped", "url", event.Wallet.URL()) @@ -388,7 +413,6 @@ func startNode(ctx *cli.Context, stack *node.Node) { "age", common.PrettyAge(timestamp)) stack.Stop() } - } }() } diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/geth/retesteth.go b/vendor/github.com/ethereum/go-ethereum/cmd/geth/retesteth.go index 6d5763f8..0615f446 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/geth/retesteth.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/geth/retesteth.go @@ -86,7 +86,7 @@ type RetestethEthAPI interface { } type RetestethDebugAPI interface { - AccountRangeAt(ctx context.Context, + AccountRange(ctx context.Context, blockHashOrNumber *math.HexOrDecimal256, txIndex uint64, addressHash *math.HexOrDecimal256, maxResults uint64, ) (AccountRangeResult, error) @@ -604,7 +604,7 @@ func (api *RetestethAPI) GetBlockByNumber(ctx context.Context, blockNr math.HexO return nil, fmt.Errorf("block %d not found", blockNr) } -func (api *RetestethAPI) AccountRangeAt(ctx context.Context, +func (api *RetestethAPI) AccountRange(ctx context.Context, blockHashOrNumber *math.HexOrDecimal256, txIndex uint64, addressHash *math.HexOrDecimal256, maxResults uint64, ) (AccountRangeResult, error) { diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/geth/usage.go b/vendor/github.com/ethereum/go-ethereum/cmd/geth/usage.go index 3ff7f884..d667120e 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/geth/usage.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/geth/usage.go @@ -82,14 +82,22 @@ var AppHelpFlagGroups = []flagGroup{ utils.GCModeFlag, utils.EthStatsURLFlag, utils.IdentityFlag, - utils.LightServFlag, - utils.LightBandwidthInFlag, - utils.LightBandwidthOutFlag, - utils.LightPeersFlag, utils.LightKDFFlag, utils.WhitelistFlag, }, }, + { + Name: "LIGHT CLIENT", + Flags: []cli.Flag{ + utils.LightServeFlag, + utils.LightIngressFlag, + utils.LightEgressFlag, + utils.LightMaxPeersFlag, + utils.UltraLightServersFlag, + utils.UltraLightFractionFlag, + utils.UltraLightOnlyAnnounceFlag, + }, + }, { Name: "DEVELOPER CHAIN", Flags: []cli.Flag{ @@ -156,20 +164,25 @@ var AppHelpFlagGroups = []flagGroup{ { Name: "API AND CONSOLE", Flags: []cli.Flag{ + utils.IPCDisabledFlag, + utils.IPCPathFlag, utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RPCApiFlag, utils.RPCGlobalGasCap, + utils.RPCCORSDomainFlag, + utils.RPCVirtualHostsFlag, utils.WSEnabledFlag, utils.WSListenAddrFlag, utils.WSPortFlag, utils.WSApiFlag, utils.WSAllowedOriginsFlag, - utils.IPCDisabledFlag, - utils.IPCPathFlag, - utils.RPCCORSDomainFlag, - utils.RPCVirtualHostsFlag, + utils.GraphQLEnabledFlag, + utils.GraphQLListenAddrFlag, + utils.GraphQLPortFlag, + utils.GraphQLCORSDomainFlag, + utils.GraphQLVirtualHostsFlag, utils.JSpathFlag, utils.ExecFlag, utils.PreloadJSFlag, @@ -240,6 +253,8 @@ var AppHelpFlagGroups = []flagGroup{ { Name: "DEPRECATED", Flags: []cli.Flag{ + utils.LightLegacyServFlag, + utils.LightLegacyPeersFlag, utils.MinerLegacyThreadsFlag, utils.MinerLegacyGasTargetFlag, utils.MinerLegacyGasPriceFlag, diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/module_explorer.go b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/module_explorer.go new file mode 100644 index 00000000..8fffe1a1 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/module_explorer.go @@ -0,0 +1,194 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "bytes" + "fmt" + "html/template" + "math/rand" + "path/filepath" + "strconv" + "strings" + + "github.com/ethereum/go-ethereum/log" +) + +// explorerDockerfile is the Dockerfile required to run a block explorer. +var explorerDockerfile = ` +FROM puppeth/blockscout:latest + +ADD genesis.json /genesis.json +RUN \ + echo 'geth --cache 512 init /genesis.json' > explorer.sh && \ + echo $'geth --networkid {{.NetworkID}} --syncmode "full" --gcmode "archive" --port {{.EthPort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcapi "net,web3,eth,shh,debug" --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" --exitwhensynced' >> explorer.sh && \ + echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --gcmode "archive" --port {{.EthPort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcapi "net,web3,eth,shh,debug" --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \ + echo '/usr/local/bin/docker-entrypoint.sh postgres &' >> explorer.sh && \ + echo 'sleep 5' >> explorer.sh && \ + echo 'mix do ecto.drop --force, ecto.create, ecto.migrate' >> explorer.sh && \ + echo 'mix phx.server' >> explorer.sh + +ENTRYPOINT ["/bin/sh", "explorer.sh"] +` + +// explorerComposefile is the docker-compose.yml file required to deploy and +// maintain a block explorer. +var explorerComposefile = ` +version: '2' +services: + explorer: + build: . + image: {{.Network}}/explorer + container_name: {{.Network}}_explorer_1 + ports: + - "{{.EthPort}}:{{.EthPort}}" + - "{{.EthPort}}:{{.EthPort}}/udp"{{if not .VHost}} + - "{{.WebPort}}:4000"{{end}} + environment: + - ETH_PORT={{.EthPort}} + - ETH_NAME={{.EthName}} + - BLOCK_TRANSFORMER={{.Transformer}}{{if .VHost}} + - VIRTUAL_HOST={{.VHost}} + - VIRTUAL_PORT=4000{{end}} + volumes: + - {{.Datadir}}:/opt/app/.ethereum + - {{.DBDir}}:/var/lib/postgresql/data + logging: + driver: "json-file" + options: + max-size: "1m" + max-file: "10" + restart: always +` + +// deployExplorer deploys a new block explorer container to a remote machine via +// SSH, docker and docker-compose. If an instance with the specified network name +// already exists there, it will be overwritten! +func deployExplorer(client *sshClient, network string, bootnodes []string, config *explorerInfos, nocache bool, isClique bool) ([]byte, error) { + // Generate the content to upload to the server + workdir := fmt.Sprintf("%d", rand.Int63()) + files := make(map[string][]byte) + + dockerfile := new(bytes.Buffer) + template.Must(template.New("").Parse(explorerDockerfile)).Execute(dockerfile, map[string]interface{}{ + "NetworkID": config.node.network, + "Bootnodes": strings.Join(bootnodes, ","), + "Ethstats": config.node.ethstats, + "EthPort": config.node.port, + }) + files[filepath.Join(workdir, "Dockerfile")] = dockerfile.Bytes() + + transformer := "base" + if isClique { + transformer = "clique" + } + composefile := new(bytes.Buffer) + template.Must(template.New("").Parse(explorerComposefile)).Execute(composefile, map[string]interface{}{ + "Network": network, + "VHost": config.host, + "Ethstats": config.node.ethstats, + "Datadir": config.node.datadir, + "DBDir": config.dbdir, + "EthPort": config.node.port, + "EthName": config.node.ethstats[:strings.Index(config.node.ethstats, ":")], + "WebPort": config.port, + "Transformer": transformer, + }) + files[filepath.Join(workdir, "docker-compose.yaml")] = composefile.Bytes() + files[filepath.Join(workdir, "genesis.json")] = config.node.genesis + + // Upload the deployment files to the remote server (and clean up afterwards) + if out, err := client.Upload(files); err != nil { + return out, err + } + defer client.Run("rm -rf " + workdir) + + // Build and deploy the boot or seal node service + if nocache { + return nil, client.Stream(fmt.Sprintf("cd %s && docker-compose -p %s build --pull --no-cache && docker-compose -p %s up -d --force-recreate --timeout 60", workdir, network, network)) + } + return nil, client.Stream(fmt.Sprintf("cd %s && docker-compose -p %s up -d --build --force-recreate --timeout 60", workdir, network)) +} + +// explorerInfos is returned from a block explorer status check to allow reporting +// various configuration parameters. +type explorerInfos struct { + node *nodeInfos + dbdir string + host string + port int +} + +// Report converts the typed struct into a plain string->string map, containing +// most - but not all - fields for reporting to the user. +func (info *explorerInfos) Report() map[string]string { + report := map[string]string{ + "Website address ": info.host, + "Website listener port ": strconv.Itoa(info.port), + "Ethereum listener port ": strconv.Itoa(info.node.port), + "Ethstats username": info.node.ethstats, + } + return report +} + +// checkExplorer does a health-check against a block explorer server to verify +// whether it's running, and if yes, whether it's responsive. +func checkExplorer(client *sshClient, network string) (*explorerInfos, error) { + // Inspect a possible explorer container on the host + infos, err := inspectContainer(client, fmt.Sprintf("%s_explorer_1", network)) + if err != nil { + return nil, err + } + if !infos.running { + return nil, ErrServiceOffline + } + // Resolve the port from the host, or the reverse proxy + port := infos.portmap["4000/tcp"] + if port == 0 { + if proxy, _ := checkNginx(client, network); proxy != nil { + port = proxy.port + } + } + if port == 0 { + return nil, ErrNotExposed + } + // Resolve the host from the reverse-proxy and the config values + host := infos.envvars["VIRTUAL_HOST"] + if host == "" { + host = client.server + } + // Run a sanity check to see if the devp2p is reachable + p2pPort := infos.portmap[infos.envvars["ETH_PORT"]+"/tcp"] + if err = checkPort(host, p2pPort); err != nil { + log.Warn("Explorer node seems unreachable", "server", host, "port", p2pPort, "err", err) + } + if err = checkPort(host, port); err != nil { + log.Warn("Explorer service seems unreachable", "server", host, "port", port, "err", err) + } + // Assemble and return the useful infos + stats := &explorerInfos{ + node: &nodeInfos{ + datadir: infos.volumes["/opt/app/.ethereum"], + port: infos.portmap[infos.envvars["ETH_PORT"]+"/tcp"], + ethstats: infos.envvars["ETH_NAME"], + }, + dbdir: infos.volumes["/var/lib/postgresql/data"], + host: host, + port: port, + } + return stats, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_dashboard.go b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_dashboard.go new file mode 100644 index 00000000..b699d761 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_dashboard.go @@ -0,0 +1,158 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/log" +) + +// deployDashboard queries the user for various input on deploying a web-service +// dashboard, after which is pushes the container. +func (w *wizard) deployDashboard() { + // Select the server to interact with + server := w.selectServer() + if server == "" { + return + } + client := w.servers[server] + + // Retrieve any active dashboard configurations from the server + infos, err := checkDashboard(client, w.network) + if err != nil { + infos = &dashboardInfos{ + port: 80, + host: client.server, + } + } + existed := err == nil + + // Figure out which port to listen on + fmt.Println() + fmt.Printf("Which port should the dashboard listen on? (default = %d)\n", infos.port) + infos.port = w.readDefaultInt(infos.port) + + // Figure which virtual-host to deploy the dashboard on + infos.host, err = w.ensureVirtualHost(client, infos.port, infos.host) + if err != nil { + log.Error("Failed to decide on dashboard host", "err", err) + return + } + // Port and proxy settings retrieved, figure out which services are available + available := make(map[string][]string) + for server, services := range w.services { + for _, service := range services { + available[service] = append(available[service], server) + } + } + for _, service := range []string{"ethstats", "explorer", "wallet", "faucet"} { + // Gather all the locally hosted pages of this type + var pages []string + for _, server := range available[service] { + client := w.servers[server] + if client == nil { + continue + } + // If there's a service running on the machine, retrieve it's port number + var port int + switch service { + case "ethstats": + if infos, err := checkEthstats(client, w.network); err == nil { + port = infos.port + } + case "explorer": + if infos, err := checkExplorer(client, w.network); err == nil { + port = infos.port + } + case "wallet": + if infos, err := checkWallet(client, w.network); err == nil { + port = infos.webPort + } + case "faucet": + if infos, err := checkFaucet(client, w.network); err == nil { + port = infos.port + } + } + if page, err := resolve(client, w.network, service, port); err == nil && page != "" { + pages = append(pages, page) + } + } + // Prompt the user to chose one, enter manually or simply not list this service + defLabel, defChoice := "don't list", len(pages)+2 + if len(pages) > 0 { + defLabel, defChoice = pages[0], 1 + } + fmt.Println() + fmt.Printf("Which %s service to list? (default = %s)\n", service, defLabel) + for i, page := range pages { + fmt.Printf(" %d. %s\n", i+1, page) + } + fmt.Printf(" %d. List external %s service\n", len(pages)+1, service) + fmt.Printf(" %d. Don't list any %s service\n", len(pages)+2, service) + + choice := w.readDefaultInt(defChoice) + if choice < 0 || choice > len(pages)+2 { + log.Error("Invalid listing choice, aborting") + return + } + var page string + switch { + case choice <= len(pages): + page = pages[choice-1] + case choice == len(pages)+1: + fmt.Println() + fmt.Printf("Which address is the external %s service at?\n", service) + page = w.readString() + default: + // No service hosting for this + } + // Save the users choice + switch service { + case "ethstats": + infos.ethstats = page + case "explorer": + infos.explorer = page + case "wallet": + infos.wallet = page + case "faucet": + infos.faucet = page + } + } + // If we have ethstats running, ask whether to make the secret public or not + if w.conf.ethstats != "" { + fmt.Println() + fmt.Println("Include ethstats secret on dashboard (y/n)? (default = yes)") + infos.trusted = w.readDefaultYesNo(true) + } + // Try to deploy the dashboard container on the host + nocache := false + if existed { + fmt.Println() + fmt.Printf("Should the dashboard be built from scratch (y/n)? (default = no)\n") + nocache = w.readDefaultYesNo(false) + } + if out, err := deployDashboard(client, w.network, &w.conf, infos, nocache); err != nil { + log.Error("Failed to deploy dashboard container", "err", err) + if len(out) > 0 { + fmt.Printf("%s\n", out) + } + return + } + // All ok, run a network scan to pick any changes up + w.networkStats() +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_explorer.go b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_explorer.go new file mode 100644 index 00000000..1df9cbc0 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_explorer.go @@ -0,0 +1,120 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/ethereum/go-ethereum/log" +) + +// deployExplorer creates a new block explorer based on some user input. +func (w *wizard) deployExplorer() { + // Do some sanity check before the user wastes time on input + if w.conf.Genesis == nil { + log.Error("No genesis block configured") + return + } + if w.conf.ethstats == "" { + log.Error("No ethstats server configured") + return + } + // Select the server to interact with + server := w.selectServer() + if server == "" { + return + } + client := w.servers[server] + + // Retrieve any active node configurations from the server + infos, err := checkExplorer(client, w.network) + if err != nil { + infos = &explorerInfos{ + node: &nodeInfos{port: 30303}, + port: 80, + host: client.server, + } + } + existed := err == nil + + infos.node.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ") + infos.node.network = w.conf.Genesis.Config.ChainID.Int64() + + // Figure out which port to listen on + fmt.Println() + fmt.Printf("Which port should the explorer listen on? (default = %d)\n", infos.port) + infos.port = w.readDefaultInt(infos.port) + + // Figure which virtual-host to deploy ethstats on + if infos.host, err = w.ensureVirtualHost(client, infos.port, infos.host); err != nil { + log.Error("Failed to decide on explorer host", "err", err) + return + } + // Figure out where the user wants to store the persistent data + fmt.Println() + if infos.node.datadir == "" { + fmt.Printf("Where should node data be stored on the remote machine?\n") + infos.node.datadir = w.readString() + } else { + fmt.Printf("Where should node data be stored on the remote machine? (default = %s)\n", infos.node.datadir) + infos.node.datadir = w.readDefaultString(infos.node.datadir) + } + // Figure out where the user wants to store the persistent data for backend database + fmt.Println() + if infos.dbdir == "" { + fmt.Printf("Where should postgres data be stored on the remote machine?\n") + infos.dbdir = w.readString() + } else { + fmt.Printf("Where should postgres data be stored on the remote machine? (default = %s)\n", infos.dbdir) + infos.dbdir = w.readDefaultString(infos.dbdir) + } + // Figure out which port to listen on + fmt.Println() + fmt.Printf("Which TCP/UDP port should the archive node listen on? (default = %d)\n", infos.node.port) + infos.node.port = w.readDefaultInt(infos.node.port) + + // Set a proper name to report on the stats page + fmt.Println() + if infos.node.ethstats == "" { + fmt.Printf("What should the explorer be called on the stats page?\n") + infos.node.ethstats = w.readString() + ":" + w.conf.ethstats + } else { + fmt.Printf("What should the explorer be called on the stats page? (default = %s)\n", infos.node.ethstats) + infos.node.ethstats = w.readDefaultString(infos.node.ethstats) + ":" + w.conf.ethstats + } + // Try to deploy the explorer on the host + nocache := false + if existed { + fmt.Println() + fmt.Printf("Should the explorer be built from scratch (y/n)? (default = no)\n") + nocache = w.readDefaultYesNo(false) + } + if out, err := deployExplorer(client, w.network, w.conf.bootnodes, infos, nocache, w.conf.Genesis.Config.Clique != nil); err != nil { + log.Error("Failed to deploy explorer container", "err", err) + if len(out) > 0 { + fmt.Printf("%s\n", out) + } + return + } + // All ok, run a network scan to pick any changes up + log.Info("Waiting for node to finish booting") + time.Sleep(3 * time.Second) + + w.networkStats() +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_genesis.go b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_genesis.go new file mode 100644 index 00000000..499f320f --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_genesis.go @@ -0,0 +1,300 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "math/big" + "math/rand" + "net/http" + "os" + "path/filepath" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" +) + +// makeGenesis creates a new genesis struct based on some user input. +func (w *wizard) makeGenesis() { + // Construct a default genesis block + genesis := &core.Genesis{ + Timestamp: uint64(time.Now().Unix()), + GasLimit: 4700000, + Difficulty: big.NewInt(524288), + Alloc: make(core.GenesisAlloc), + Config: ¶ms.ChainConfig{ + HomesteadBlock: big.NewInt(0), + EIP150Block: big.NewInt(0), + EIP155Block: big.NewInt(0), + EIP158Block: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + }, + } + // Figure out which consensus engine to choose + fmt.Println() + fmt.Println("Which consensus engine to use? (default = clique)") + fmt.Println(" 1. Ethash - proof-of-work") + fmt.Println(" 2. Clique - proof-of-authority") + + choice := w.read() + switch { + case choice == "1": + // In case of ethash, we're pretty much done + genesis.Config.Ethash = new(params.EthashConfig) + genesis.ExtraData = make([]byte, 32) + + case choice == "" || choice == "2": + // In the case of clique, configure the consensus parameters + genesis.Difficulty = big.NewInt(1) + genesis.Config.Clique = ¶ms.CliqueConfig{ + Period: 15, + Epoch: 30000, + } + fmt.Println() + fmt.Println("How many seconds should blocks take? (default = 15)") + genesis.Config.Clique.Period = uint64(w.readDefaultInt(15)) + + // We also need the initial list of signers + fmt.Println() + fmt.Println("Which accounts are allowed to seal? (mandatory at least one)") + + var signers []common.Address + for { + if address := w.readAddress(); address != nil { + signers = append(signers, *address) + continue + } + if len(signers) > 0 { + break + } + } + // Sort the signers and embed into the extra-data section + for i := 0; i < len(signers); i++ { + for j := i + 1; j < len(signers); j++ { + if bytes.Compare(signers[i][:], signers[j][:]) > 0 { + signers[i], signers[j] = signers[j], signers[i] + } + } + } + genesis.ExtraData = make([]byte, 32+len(signers)*common.AddressLength+65) + for i, signer := range signers { + copy(genesis.ExtraData[32+i*common.AddressLength:], signer[:]) + } + + default: + log.Crit("Invalid consensus engine choice", "choice", choice) + } + // Consensus all set, just ask for initial funds and go + fmt.Println() + fmt.Println("Which accounts should be pre-funded? (advisable at least one)") + for { + // Read the address of the account to fund + if address := w.readAddress(); address != nil { + genesis.Alloc[*address] = core.GenesisAccount{ + Balance: new(big.Int).Lsh(big.NewInt(1), 256-7), // 2^256 / 128 (allow many pre-funds without balance overflows) + } + continue + } + break + } + fmt.Println() + fmt.Println("Should the precompile-addresses (0x1 .. 0xff) be pre-funded with 1 wei? (advisable yes)") + if w.readDefaultYesNo(true) { + // Add a batch of precompile balances to avoid them getting deleted + for i := int64(0); i < 256; i++ { + genesis.Alloc[common.BigToAddress(big.NewInt(i))] = core.GenesisAccount{Balance: big.NewInt(1)} + } + } + // Query the user for some custom extras + fmt.Println() + fmt.Println("Specify your chain/network ID if you want an explicit one (default = random)") + genesis.Config.ChainID = new(big.Int).SetUint64(uint64(w.readDefaultInt(rand.Intn(65536)))) + + // All done, store the genesis and flush to disk + log.Info("Configured new genesis block") + + w.conf.Genesis = genesis + w.conf.flush() +} + +// importGenesis imports a Geth genesis spec into puppeth. +func (w *wizard) importGenesis() { + // Request the genesis JSON spec URL from the user + fmt.Println() + fmt.Println("Where's the genesis file? (local file or http/https url)") + url := w.readURL() + + // Convert the various allowed URLs to a reader stream + var reader io.Reader + + switch url.Scheme { + case "http", "https": + // Remote web URL, retrieve it via an HTTP client + res, err := http.Get(url.String()) + if err != nil { + log.Error("Failed to retrieve remote genesis", "err", err) + return + } + defer res.Body.Close() + reader = res.Body + + case "": + // Schemaless URL, interpret as a local file + file, err := os.Open(url.String()) + if err != nil { + log.Error("Failed to open local genesis", "err", err) + return + } + defer file.Close() + reader = file + + default: + log.Error("Unsupported genesis URL scheme", "scheme", url.Scheme) + return + } + // Parse the genesis file and inject it successful + var genesis core.Genesis + if err := json.NewDecoder(reader).Decode(&genesis); err != nil { + log.Error("Invalid genesis spec: %v", err) + return + } + log.Info("Imported genesis block") + + w.conf.Genesis = &genesis + w.conf.flush() +} + +// manageGenesis permits the modification of chain configuration parameters in +// a genesis config and the export of the entire genesis spec. +func (w *wizard) manageGenesis() { + // Figure out whether to modify or export the genesis + fmt.Println() + fmt.Println(" 1. Modify existing configurations") + fmt.Println(" 2. Export genesis configurations") + fmt.Println(" 3. Remove genesis configuration") + + choice := w.read() + switch choice { + case "1": + // Fork rule updating requested, iterate over each fork + fmt.Println() + fmt.Printf("Which block should Homestead come into effect? (default = %v)\n", w.conf.Genesis.Config.HomesteadBlock) + w.conf.Genesis.Config.HomesteadBlock = w.readDefaultBigInt(w.conf.Genesis.Config.HomesteadBlock) + + fmt.Println() + fmt.Printf("Which block should EIP150 (Tangerine Whistle) come into effect? (default = %v)\n", w.conf.Genesis.Config.EIP150Block) + w.conf.Genesis.Config.EIP150Block = w.readDefaultBigInt(w.conf.Genesis.Config.EIP150Block) + + fmt.Println() + fmt.Printf("Which block should EIP155 (Spurious Dragon) come into effect? (default = %v)\n", w.conf.Genesis.Config.EIP155Block) + w.conf.Genesis.Config.EIP155Block = w.readDefaultBigInt(w.conf.Genesis.Config.EIP155Block) + + fmt.Println() + fmt.Printf("Which block should EIP158/161 (also Spurious Dragon) come into effect? (default = %v)\n", w.conf.Genesis.Config.EIP158Block) + w.conf.Genesis.Config.EIP158Block = w.readDefaultBigInt(w.conf.Genesis.Config.EIP158Block) + + fmt.Println() + fmt.Printf("Which block should Byzantium come into effect? (default = %v)\n", w.conf.Genesis.Config.ByzantiumBlock) + w.conf.Genesis.Config.ByzantiumBlock = w.readDefaultBigInt(w.conf.Genesis.Config.ByzantiumBlock) + + fmt.Println() + fmt.Printf("Which block should Constantinople come into effect? (default = %v)\n", w.conf.Genesis.Config.ConstantinopleBlock) + w.conf.Genesis.Config.ConstantinopleBlock = w.readDefaultBigInt(w.conf.Genesis.Config.ConstantinopleBlock) + if w.conf.Genesis.Config.PetersburgBlock == nil { + w.conf.Genesis.Config.PetersburgBlock = w.conf.Genesis.Config.ConstantinopleBlock + } + fmt.Println() + fmt.Printf("Which block should Petersburg come into effect? (default = %v)\n", w.conf.Genesis.Config.PetersburgBlock) + w.conf.Genesis.Config.PetersburgBlock = w.readDefaultBigInt(w.conf.Genesis.Config.PetersburgBlock) + + out, _ := json.MarshalIndent(w.conf.Genesis.Config, "", " ") + fmt.Printf("Chain configuration updated:\n\n%s\n", out) + + w.conf.flush() + + case "2": + // Save whatever genesis configuration we currently have + fmt.Println() + fmt.Printf("Which folder to save the genesis specs into? (default = current)\n") + fmt.Printf(" Will create %s.json, %s-aleth.json, %s-harmony.json, %s-parity.json\n", w.network, w.network, w.network, w.network) + + folder := w.readDefaultString(".") + if err := os.MkdirAll(folder, 0755); err != nil { + log.Error("Failed to create spec folder", "folder", folder, "err", err) + return + } + out, _ := json.MarshalIndent(w.conf.Genesis, "", " ") + + // Export the native genesis spec used by puppeth and Geth + gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network)) + if err := ioutil.WriteFile((gethJson), out, 0644); err != nil { + log.Error("Failed to save genesis file", "err", err) + return + } + log.Info("Saved native genesis chain spec", "path", gethJson) + + // Export the genesis spec used by Aleth (formerly C++ Ethereum) + if spec, err := newAlethGenesisSpec(w.network, w.conf.Genesis); err != nil { + log.Error("Failed to create Aleth chain spec", "err", err) + } else { + saveGenesis(folder, w.network, "aleth", spec) + } + // Export the genesis spec used by Parity + if spec, err := newParityChainSpec(w.network, w.conf.Genesis, []string{}); err != nil { + log.Error("Failed to create Parity chain spec", "err", err) + } else { + saveGenesis(folder, w.network, "parity", spec) + } + // Export the genesis spec used by Harmony (formerly EthereumJ + saveGenesis(folder, w.network, "harmony", w.conf.Genesis) + + case "3": + // Make sure we don't have any services running + if len(w.conf.servers()) > 0 { + log.Error("Genesis reset requires all services and servers torn down") + return + } + log.Info("Genesis block destroyed") + + w.conf.Genesis = nil + w.conf.flush() + default: + log.Error("That's not something I can do") + return + } +} + +// saveGenesis JSON encodes an arbitrary genesis spec into a pre-defined file. +func saveGenesis(folder, network, client string, spec interface{}) { + path := filepath.Join(folder, fmt.Sprintf("%s-%s.json", network, client)) + + out, _ := json.Marshal(spec) + if err := ioutil.WriteFile(path, out, 0644); err != nil { + log.Error("Failed to save genesis file", "client", client, "err", err) + return + } + log.Info("Saved genesis chain spec", "client", client, "path", path) +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_network.go b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_network.go new file mode 100644 index 00000000..97302c0d --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_network.go @@ -0,0 +1,200 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package main + +import ( + "fmt" + "strings" + + "github.com/ethereum/go-ethereum/log" +) + +// manageServers displays a list of servers the user can disconnect from, and an +// option to connect to new servers. +func (w *wizard) manageServers() { + // List all the servers we can disconnect, along with an entry to connect a new one + fmt.Println() + + servers := w.conf.servers() + for i, server := range servers { + fmt.Printf(" %d. Disconnect %s\n", i+1, server) + } + fmt.Printf(" %d. Connect another server\n", len(w.conf.Servers)+1) + + choice := w.readInt() + if choice < 0 || choice > len(w.conf.Servers)+1 { + log.Error("Invalid server choice, aborting") + return + } + // If the user selected an existing server, drop it + if choice <= len(w.conf.Servers) { + server := servers[choice-1] + client := w.servers[server] + + delete(w.servers, server) + if client != nil { + client.Close() + } + delete(w.conf.Servers, server) + w.conf.flush() + + log.Info("Disconnected existing server", "server", server) + w.networkStats() + return + } + // If the user requested connecting a new server, do it + if w.makeServer() != "" { + w.networkStats() + } +} + +// makeServer reads a single line from stdin and interprets it as +// username:identity@hostname to connect to. It tries to establish a +// new SSH session and also executing some baseline validations. +// +// If connection succeeds, the server is added to the wizards configs! +func (w *wizard) makeServer() string { + fmt.Println() + fmt.Println("What is the remote server's address ([username[:identity]@]hostname[:port])?") + + // Read and dial the server to ensure docker is present + input := w.readString() + + client, err := dial(input, nil) + if err != nil { + log.Error("Server not ready for puppeth", "err", err) + return "" + } + // All checks passed, start tracking the server + w.servers[input] = client + w.conf.Servers[input] = client.pubkey + w.conf.flush() + + return input +} + +// selectServer lists the user all the currently known servers to choose from, +// also granting the option to add a new one. +func (w *wizard) selectServer() string { + // List the available server to the user and wait for a choice + fmt.Println() + fmt.Println("Which server do you want to interact with?") + + servers := w.conf.servers() + for i, server := range servers { + fmt.Printf(" %d. %s\n", i+1, server) + } + fmt.Printf(" %d. Connect another server\n", len(w.conf.Servers)+1) + + choice := w.readInt() + if choice < 0 || choice > len(w.conf.Servers)+1 { + log.Error("Invalid server choice, aborting") + return "" + } + // If the user requested connecting to a new server, go for it + if choice <= len(w.conf.Servers) { + return servers[choice-1] + } + return w.makeServer() +} + +// manageComponents displays a list of network components the user can tear down +// and an option +func (w *wizard) manageComponents() { + // List all the components we can tear down, along with an entry to deploy a new one + fmt.Println() + + var serviceHosts, serviceNames []string + for server, services := range w.services { + for _, service := range services { + serviceHosts = append(serviceHosts, server) + serviceNames = append(serviceNames, service) + + fmt.Printf(" %d. Tear down %s on %s\n", len(serviceHosts), strings.Title(service), server) + } + } + fmt.Printf(" %d. Deploy new network component\n", len(serviceHosts)+1) + + choice := w.readInt() + if choice < 0 || choice > len(serviceHosts)+1 { + log.Error("Invalid component choice, aborting") + return + } + // If the user selected an existing service, destroy it + if choice <= len(serviceHosts) { + // Figure out the service to destroy and execute it + service := serviceNames[choice-1] + server := serviceHosts[choice-1] + client := w.servers[server] + + if out, err := tearDown(client, w.network, service, true); err != nil { + log.Error("Failed to tear down component", "err", err) + if len(out) > 0 { + fmt.Printf("%s\n", out) + } + return + } + // Clean up any references to it from out state + services := w.services[server] + for i, name := range services { + if name == service { + w.services[server] = append(services[:i], services[i+1:]...) + if len(w.services[server]) == 0 { + delete(w.services, server) + } + } + } + log.Info("Torn down existing component", "server", server, "service", service) + return + } + // If the user requested deploying a new component, do it + w.deployComponent() +} + +// deployComponent displays a list of network components the user can deploy and +// guides through the process. +func (w *wizard) deployComponent() { + // Print all the things we can deploy and wait or user choice + fmt.Println() + fmt.Println("What would you like to deploy? (recommended order)") + fmt.Println(" 1. Ethstats - Network monitoring tool") + fmt.Println(" 2. Bootnode - Entry point of the network") + fmt.Println(" 3. Sealer - Full node minting new blocks") + fmt.Println(" 4. Explorer - Chain analysis webservice") + fmt.Println(" 5. Wallet - Browser wallet for quick sends") + fmt.Println(" 6. Faucet - Crypto faucet to give away funds") + fmt.Println(" 7. Dashboard - Website listing above web-services") + + switch w.read() { + case "1": + w.deployEthstats() + case "2": + w.deployNode(true) + case "3": + w.deployNode(false) + case "4": + w.deployExplorer() + case "5": + w.deployWallet() + case "6": + w.deployFaucet() + case "7": + w.deployDashboard() + default: + log.Error("That's not something I can do") + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/cmd/utils/flags.go b/vendor/github.com/ethereum/go-ethereum/cmd/utils/flags.go index 9ace9be7..dbe00864 100644 --- a/vendor/github.com/ethereum/go-ethereum/cmd/utils/flags.go +++ b/vendor/github.com/ethereum/go-ethereum/cmd/utils/flags.go @@ -19,7 +19,7 @@ package utils import ( "crypto/ecdsa" - "encoding/json" + "errors" "fmt" "io/ioutil" "math/big" @@ -47,6 +47,7 @@ import ( "github.com/ethereum/go-ethereum/eth/gasprice" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethstats" + "github.com/ethereum/go-ethereum/graphql" "github.com/ethereum/go-ethereum/les" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" @@ -59,6 +60,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/p2p/netutil" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/statediff" whisper "github.com/ethereum/go-ethereum/whisper/whisperv6" @@ -100,7 +102,6 @@ func NewApp(gitCommit, gitDate, usage string) *cli.App { app := cli.NewApp() app.Name = filepath.Base(os.Args[0]) app.Author = "" - //app.Authors = nil app.Email = "" app.Version = params.VersionWithCommit(gitCommit, gitDate) app.Usage = usage @@ -155,10 +156,6 @@ var ( Name: "goerli", Usage: "Görli network: pre-configured proof-of-authority test network", } - ConstantinopleOverrideFlag = cli.Uint64Flag{ - Name: "override.constantinople", - Usage: "Manually specify constantinople fork-block, overriding the bundled setting", - } DeveloperFlag = cli.BoolFlag{ Name: "dev", Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled", @@ -180,21 +177,21 @@ var ( Name: "exitwhensynced", Usage: "Exits after block synchronisation completes", } - ULCModeConfigFlag = cli.StringFlag{ - Name: "ulc.config", - Usage: "Config file to use for ultra light client mode", + IterativeOutputFlag = cli.BoolFlag{ + Name: "iterative", + Usage: "Print streaming JSON iteratively, delimited by newlines", } - OnlyAnnounceModeFlag = cli.BoolFlag{ - Name: "ulc.onlyannounce", - Usage: "ULC server sends announcements only", + ExcludeStorageFlag = cli.BoolFlag{ + Name: "nostorage", + Usage: "Exclude storage entries (save db lookups)", } - ULCMinTrustedFractionFlag = cli.IntFlag{ - Name: "ulc.fraction", - Usage: "Minimum % of trusted ULC servers required to announce a new head", + IncludeIncompletesFlag = cli.BoolFlag{ + Name: "incompletes", + Usage: "Include accounts for which we don't have the address (missing preimage)", } - ULCTrustedNodesFlag = cli.StringFlag{ - Name: "ulc.trusted", - Usage: "List of trusted ULC servers", + ExcludeCodeFlag = cli.BoolFlag{ + Name: "nocode", + Usage: "Exclude contract code (save db lookups)", } defaultSyncMode = eth.DefaultConfig.SyncMode SyncModeFlag = TextMarshalerFlag{ @@ -207,26 +204,6 @@ var ( Usage: `Blockchain garbage collection mode ("full", "archive")`, Value: "full", } - LightServFlag = cli.IntFlag{ - Name: "lightserv", - Usage: "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)", - Value: 0, - } - LightBandwidthInFlag = cli.IntFlag{ - Name: "lightbwin", - Usage: "Incoming bandwidth limit for light server (kilobytes/sec, 0 = unlimited)", - Value: 0, - } - LightBandwidthOutFlag = cli.IntFlag{ - Name: "lightbwout", - Usage: "Outgoing bandwidth limit for light server (kilobytes/sec, 0 = unlimited)", - Value: 0, - } - LightPeersFlag = cli.IntFlag{ - Name: "lightpeers", - Usage: "Maximum number of LES client peers", - Value: eth.DefaultConfig.LightPeers, - } LightKDFFlag = cli.BoolFlag{ Name: "lightkdf", Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", @@ -235,6 +212,51 @@ var ( Name: "whitelist", Usage: "Comma separated block number-to-hash mappings to enforce (=)", } + // Light server and client settings + LightLegacyServFlag = cli.IntFlag{ // Deprecated in favor of light.serve, remove in 2021 + Name: "lightserv", + Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)", + Value: eth.DefaultConfig.LightServ, + } + LightServeFlag = cli.IntFlag{ + Name: "light.serve", + Usage: "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)", + Value: eth.DefaultConfig.LightServ, + } + LightIngressFlag = cli.IntFlag{ + Name: "light.ingress", + Usage: "Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)", + Value: eth.DefaultConfig.LightIngress, + } + LightEgressFlag = cli.IntFlag{ + Name: "light.egress", + Usage: "Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)", + Value: eth.DefaultConfig.LightEgress, + } + LightLegacyPeersFlag = cli.IntFlag{ // Deprecated in favor of light.maxpeers, remove in 2021 + Name: "lightpeers", + Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers)", + Value: eth.DefaultConfig.LightPeers, + } + LightMaxPeersFlag = cli.IntFlag{ + Name: "light.maxpeers", + Usage: "Maximum number of light clients to serve, or light servers to attach to", + Value: eth.DefaultConfig.LightPeers, + } + UltraLightServersFlag = cli.StringFlag{ + Name: "ulc.servers", + Usage: "List of trusted ultra-light servers", + Value: strings.Join(eth.DefaultConfig.UltraLightServers, ","), + } + UltraLightFractionFlag = cli.IntFlag{ + Name: "ulc.fraction", + Usage: "Minimum % of trusted ultra-light servers required to announce a new head", + Value: eth.DefaultConfig.UltraLightFraction, + } + UltraLightOnlyAnnounceFlag = cli.BoolFlag{ + Name: "ulc.onlyannounce", + Usage: "Ultra light server sends announcements only", + } // Dashboard settings DashboardEnabledFlag = cli.BoolFlag{ Name: "dashboard", @@ -477,6 +499,14 @@ var ( Usage: "Disables db compaction after import", } // RPC settings + IPCDisabledFlag = cli.BoolFlag{ + Name: "ipcdisable", + Usage: "Disable the IPC-RPC server", + } + IPCPathFlag = DirectoryFlag{ + Name: "ipcpath", + Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)", + } RPCEnabledFlag = cli.BoolFlag{ Name: "rpc", Usage: "Enable the HTTP-RPC server", @@ -491,30 +521,6 @@ var ( Usage: "HTTP-RPC server listening port", Value: node.DefaultHTTPPort, } - GraphQLEnabledFlag = cli.BoolFlag{ - Name: "graphql", - Usage: "Enable the GraphQL server", - } - GraphQLListenAddrFlag = cli.StringFlag{ - Name: "graphql.addr", - Usage: "GraphQL server listening interface", - Value: node.DefaultGraphQLHost, - } - GraphQLPortFlag = cli.IntFlag{ - Name: "graphql.port", - Usage: "GraphQL server listening port", - Value: node.DefaultGraphQLPort, - } - GraphQLCORSDomainFlag = cli.StringFlag{ - Name: "graphql.rpccorsdomain", - Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", - Value: "", - } - GraphQLVirtualHostsFlag = cli.StringFlag{ - Name: "graphql.rpcvhosts", - Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", - Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","), - } RPCCORSDomainFlag = cli.StringFlag{ Name: "rpccorsdomain", Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", @@ -530,14 +536,6 @@ var ( Usage: "API's offered over the HTTP-RPC interface", Value: "", } - IPCDisabledFlag = cli.BoolFlag{ - Name: "ipcdisable", - Usage: "Disable the IPC-RPC server", - } - IPCPathFlag = DirectoryFlag{ - Name: "ipcpath", - Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)", - } WSEnabledFlag = cli.BoolFlag{ Name: "ws", Usage: "Enable the WS-RPC server", @@ -562,6 +560,30 @@ var ( Usage: "Origins from which to accept websockets requests", Value: "", } + GraphQLEnabledFlag = cli.BoolFlag{ + Name: "graphql", + Usage: "Enable the GraphQL server", + } + GraphQLListenAddrFlag = cli.StringFlag{ + Name: "graphql.addr", + Usage: "GraphQL server listening interface", + Value: node.DefaultGraphQLHost, + } + GraphQLPortFlag = cli.IntFlag{ + Name: "graphql.port", + Usage: "GraphQL server listening port", + Value: node.DefaultGraphQLPort, + } + GraphQLCORSDomainFlag = cli.StringFlag{ + Name: "graphql.corsdomain", + Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", + Value: "", + } + GraphQLVirtualHostsFlag = cli.StringFlag{ + Name: "graphql.vhosts", + Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", + Value: strings.Join(node.DefaultConfig.GraphQLVirtualHosts, ","), + } ExecFlag = cli.StringFlag{ Name: "exec", Usage: "Execute JavaScript statement", @@ -721,7 +743,7 @@ var ( StateDiffFlag = cli.BoolFlag{ Name: "statediff", - Usage: "Enables the calculation of state diffs between each block, persists these state diffs the configured persistence mode.", + Usage: "Enables the processing of state diffs between each block", } StateDiffPathsAndProofs = cli.BoolFlag{ Name: "statediff.pathsandproofs", @@ -898,7 +920,6 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { cfg.HTTPHost = ctx.GlobalString(RPCListenAddrFlag.Name) } } - if ctx.GlobalIsSet(RPCPortFlag.Name) { cfg.HTTPPort = ctx.GlobalInt(RPCPortFlag.Name) } @@ -940,7 +961,6 @@ func setWS(ctx *cli.Context, cfg *node.Config) { cfg.WSHost = ctx.GlobalString(WSListenAddrFlag.Name) } } - if ctx.GlobalIsSet(WSPortFlag.Name) { cfg.WSPort = ctx.GlobalInt(WSPortFlag.Name) } @@ -958,7 +978,7 @@ func setWS(ctx *cli.Context, cfg *node.Config) { // setIPC creates an IPC path configuration from the set command line flags, // returning an empty string if IPC was explicitly disabled, or the set path. func setIPC(ctx *cli.Context, cfg *node.Config) { - checkExclusive(ctx, IPCDisabledFlag, IPCPathFlag) + CheckExclusive(ctx, IPCDisabledFlag, IPCPathFlag) switch { case ctx.GlobalBool(IPCDisabledFlag.Name): cfg.IPCPath = "" @@ -967,37 +987,38 @@ func setIPC(ctx *cli.Context, cfg *node.Config) { } } -// SetULC setup ULC config from file if given. -func SetULC(ctx *cli.Context, cfg *eth.Config) { - // ULC config isn't loaded from global config and ULC config and ULC trusted nodes are not defined. - if cfg.ULC == nil && !(ctx.GlobalIsSet(ULCModeConfigFlag.Name) || ctx.GlobalIsSet(ULCTrustedNodesFlag.Name)) { - return +// setLes configures the les server and ultra light client settings from the command line flags. +func setLes(ctx *cli.Context, cfg *eth.Config) { + if ctx.GlobalIsSet(LightLegacyServFlag.Name) { + cfg.LightServ = ctx.GlobalInt(LightLegacyServFlag.Name) } - cfg.ULC = ð.ULCConfig{} - - path := ctx.GlobalString(ULCModeConfigFlag.Name) - if path != "" { - cfgData, err := ioutil.ReadFile(path) - if err != nil { - Fatalf("Failed to unmarshal ULC configuration: %v", err) - } - - err = json.Unmarshal(cfgData, &cfg.ULC) - if err != nil { - Fatalf("Failed to unmarshal ULC configuration: %s", err.Error()) - } + if ctx.GlobalIsSet(LightServeFlag.Name) { + cfg.LightServ = ctx.GlobalInt(LightServeFlag.Name) } - - if trustedNodes := ctx.GlobalString(ULCTrustedNodesFlag.Name); trustedNodes != "" { - cfg.ULC.TrustedServers = strings.Split(trustedNodes, ",") + if ctx.GlobalIsSet(LightIngressFlag.Name) { + cfg.LightIngress = ctx.GlobalInt(LightIngressFlag.Name) } - - if trustedFraction := ctx.GlobalInt(ULCMinTrustedFractionFlag.Name); trustedFraction > 0 { - cfg.ULC.MinTrustedFraction = trustedFraction + if ctx.GlobalIsSet(LightEgressFlag.Name) { + cfg.LightEgress = ctx.GlobalInt(LightEgressFlag.Name) } - if cfg.ULC.MinTrustedFraction <= 0 && cfg.ULC.MinTrustedFraction > 100 { - log.Error("MinTrustedFraction is invalid", "MinTrustedFraction", cfg.ULC.MinTrustedFraction, "Changed to default", eth.DefaultULCMinTrustedFraction) - cfg.ULC.MinTrustedFraction = eth.DefaultULCMinTrustedFraction + if ctx.GlobalIsSet(LightLegacyPeersFlag.Name) { + cfg.LightPeers = ctx.GlobalInt(LightLegacyPeersFlag.Name) + } + if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { + cfg.LightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) + } + if ctx.GlobalIsSet(UltraLightServersFlag.Name) { + cfg.UltraLightServers = strings.Split(ctx.GlobalString(UltraLightServersFlag.Name), ",") + } + if ctx.GlobalIsSet(UltraLightFractionFlag.Name) { + cfg.UltraLightFraction = ctx.GlobalInt(UltraLightFractionFlag.Name) + } + if cfg.UltraLightFraction <= 0 && cfg.UltraLightFraction > 100 { + log.Error("Ultra light fraction is invalid", "had", cfg.UltraLightFraction, "updated", eth.DefaultConfig.UltraLightFraction) + cfg.UltraLightFraction = eth.DefaultConfig.UltraLightFraction + } + if ctx.GlobalIsSet(UltraLightOnlyAnnounceFlag.Name) { + cfg.UltraLightOnlyAnnounce = ctx.GlobalBool(UltraLightOnlyAnnounceFlag.Name) } } @@ -1091,19 +1112,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { setBootstrapNodesV5(ctx, cfg) lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light" - lightServer := ctx.GlobalInt(LightServFlag.Name) != 0 - lightPeers := ctx.GlobalInt(LightPeersFlag.Name) + lightServer := (ctx.GlobalInt(LightLegacyServFlag.Name) != 0 || ctx.GlobalInt(LightServeFlag.Name) != 0) + lightPeers := ctx.GlobalInt(LightLegacyPeersFlag.Name) + if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { + lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) + } if ctx.GlobalIsSet(MaxPeersFlag.Name) { cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name) - if lightServer && !ctx.GlobalIsSet(LightPeersFlag.Name) { + if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { cfg.MaxPeers += lightPeers } } else { if lightServer { cfg.MaxPeers += lightPeers } - if lightClient && ctx.GlobalIsSet(LightPeersFlag.Name) && cfg.MaxPeers < lightPeers { + if lightClient && (ctx.GlobalIsSet(LightLegacyPeersFlag.Name) || ctx.GlobalIsSet(LightMaxPeersFlag.Name)) && cfg.MaxPeers < lightPeers { cfg.MaxPeers = lightPeers } } @@ -1205,11 +1229,11 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { cfg.DataDir = ctx.GlobalString(DataDirFlag.Name) case ctx.GlobalBool(DeveloperFlag.Name): cfg.DataDir = "" // unless explicitly requested, use memory databases - case ctx.GlobalBool(TestnetFlag.Name): + case ctx.GlobalBool(TestnetFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet") - case ctx.GlobalBool(RinkebyFlag.Name): + case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby") - case ctx.GlobalBool(GoerliFlag.Name): + case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli") } } @@ -1343,10 +1367,10 @@ func setWhitelist(ctx *cli.Context, cfg *eth.Config) { } } -// checkExclusive verifies that only a single instance of the provided flags was +// CheckExclusive verifies that only a single instance of the provided flags was // set by the user. Each flag might optionally be followed by a string type to // specialize it further. -func checkExclusive(ctx *cli.Context, args ...interface{}) { +func CheckExclusive(ctx *cli.Context, args ...interface{}) { set := make([]string, 0, 1) for i := 0; i < len(args); i++ { // Make sure the next argument is a flag and skip if not set @@ -1400,10 +1424,10 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { // SetEthConfig applies eth-related command line flags to the config. func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { // Avoid conflicting network flags - checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, GoerliFlag) - checkExclusive(ctx, LightServFlag, SyncModeFlag, "light") - // Can't use both ephemeral unlocked and external signer - checkExclusive(ctx, DeveloperFlag, ExternalSignerFlag) + CheckExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, GoerliFlag) + CheckExclusive(ctx, LightLegacyServFlag, LightServeFlag, SyncModeFlag, "light") + CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer + var ks *keystore.KeyStore if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 { ks = keystores[0].(*keystore.KeyStore) @@ -1414,21 +1438,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { setEthash(ctx, cfg) setMiner(ctx, &cfg.Miner) setWhitelist(ctx, cfg) + setLes(ctx, cfg) if ctx.GlobalIsSet(SyncModeFlag.Name) { cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) } - if ctx.GlobalIsSet(LightServFlag.Name) { - cfg.LightServ = ctx.GlobalInt(LightServFlag.Name) - } - cfg.LightBandwidthIn = ctx.GlobalInt(LightBandwidthInFlag.Name) - cfg.LightBandwidthOut = ctx.GlobalInt(LightBandwidthOutFlag.Name) - if ctx.GlobalIsSet(LightPeersFlag.Name) { - cfg.LightPeers = ctx.GlobalInt(LightPeersFlag.Name) - } - if ctx.GlobalIsSet(OnlyAnnounceModeFlag.Name) { - cfg.OnlyAnnounce = ctx.GlobalBool(OnlyAnnounceModeFlag.Name) - } if ctx.GlobalIsSet(NetworkIdFlag.Name) { cfg.NetworkId = ctx.GlobalUint64(NetworkIdFlag.Name) } @@ -1573,12 +1587,33 @@ func RegisterEthStatsService(stack *node.Node, url string) { var lesServ *les.LightEthereum ctx.Service(&lesServ) + // Let ethstats use whichever is not nil return ethstats.New(url, ethServ, lesServ) }); err != nil { Fatalf("Failed to register the Ethereum Stats service: %v", err) } } +// RegisterGraphQLService is a utility function to construct a new service and register it against a node. +func RegisterGraphQLService(stack *node.Node, endpoint string, cors, vhosts []string, timeouts rpc.HTTPTimeouts) { + if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + // Try to construct the GraphQL service backed by a full node + var ethServ *eth.Ethereum + if err := ctx.Service(ðServ); err == nil { + return graphql.New(ethServ.APIBackend, endpoint, cors, vhosts, timeouts) + } + // Try to construct the GraphQL service backed by a light node + var lesServ *les.LightEthereum + if err := ctx.Service(&lesServ); err == nil { + return graphql.New(lesServ.ApiBackend, endpoint, cors, vhosts, timeouts) + } + // Well, this should not have happened, bail out + return nil, errors.New("no Ethereum service") + }); err != nil { + Fatalf("Failed to register the GraphQL service: %v", err) + } +} + // RegisterStateDiffService configures and registers a service to stream state diff data over RPC func RegisterStateDiffService(stack *node.Node, ctx *cli.Context) { config := statediff.Config{ diff --git a/vendor/github.com/ethereum/go-ethereum/common/compiler/helpers.go b/vendor/github.com/ethereum/go-ethereum/common/compiler/helpers.go new file mode 100644 index 00000000..5ed640de --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/compiler/helpers.go @@ -0,0 +1,65 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package compiler wraps the Solidity and Vyper compiler executables (solc; vyper). +package compiler + +import ( + "bytes" + "io/ioutil" + "regexp" +) + +var versionRegexp = regexp.MustCompile(`([0-9]+)\.([0-9]+)\.([0-9]+)`) + +// Contract contains information about a compiled contract, alongside its code and runtime code. +type Contract struct { + Code string `json:"code"` + RuntimeCode string `json:"runtime-code"` + Info ContractInfo `json:"info"` + Hashes map[string]string `json:"hashes"` +} + +// ContractInfo contains information about a compiled contract, including access +// to the ABI definition, source mapping, user and developer docs, and metadata. +// +// Depending on the source, language version, compiler version, and compiler +// options will provide information about how the contract was compiled. +type ContractInfo struct { + Source string `json:"source"` + Language string `json:"language"` + LanguageVersion string `json:"languageVersion"` + CompilerVersion string `json:"compilerVersion"` + CompilerOptions string `json:"compilerOptions"` + SrcMap interface{} `json:"srcMap"` + SrcMapRuntime string `json:"srcMapRuntime"` + AbiDefinition interface{} `json:"abiDefinition"` + UserDoc interface{} `json:"userDoc"` + DeveloperDoc interface{} `json:"developerDoc"` + Metadata string `json:"metadata"` +} + +func slurpFiles(files []string) (string, error) { + var concat bytes.Buffer + for _, file := range files { + content, err := ioutil.ReadFile(file) + if err != nil { + return "", err + } + concat.Write(content) + } + return concat.String(), nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/common/compiler/solidity.go b/vendor/github.com/ethereum/go-ethereum/common/compiler/solidity.go new file mode 100644 index 00000000..16b91bf7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/common/compiler/solidity.go @@ -0,0 +1,177 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package compiler wraps the Solidity and Vyper compiler executables (solc; vyper). +package compiler + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "os/exec" + "strconv" + "strings" +) + +// Solidity contains information about the solidity compiler. +type Solidity struct { + Path, Version, FullVersion string + Major, Minor, Patch int +} + +// --combined-output format +type solcOutput struct { + Contracts map[string]struct { + BinRuntime string `json:"bin-runtime"` + SrcMapRuntime string `json:"srcmap-runtime"` + Bin, SrcMap, Abi, Devdoc, Userdoc, Metadata string + Hashes map[string]string + } + Version string +} + +func (s *Solidity) makeArgs() []string { + p := []string{ + "--combined-json", "bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc", + "--optimize", // code optimizer switched on + } + if s.Major > 0 || s.Minor > 4 || s.Patch > 6 { + p[1] += ",metadata,hashes" + } + return p +} + +// SolidityVersion runs solc and parses its version output. +func SolidityVersion(solc string) (*Solidity, error) { + if solc == "" { + solc = "solc" + } + var out bytes.Buffer + cmd := exec.Command(solc, "--version") + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return nil, err + } + matches := versionRegexp.FindStringSubmatch(out.String()) + if len(matches) != 4 { + return nil, fmt.Errorf("can't parse solc version %q", out.String()) + } + s := &Solidity{Path: cmd.Path, FullVersion: out.String(), Version: matches[0]} + if s.Major, err = strconv.Atoi(matches[1]); err != nil { + return nil, err + } + if s.Minor, err = strconv.Atoi(matches[2]); err != nil { + return nil, err + } + if s.Patch, err = strconv.Atoi(matches[3]); err != nil { + return nil, err + } + return s, nil +} + +// CompileSolidityString builds and returns all the contracts contained within a source string. +func CompileSolidityString(solc, source string) (map[string]*Contract, error) { + if len(source) == 0 { + return nil, errors.New("solc: empty source string") + } + s, err := SolidityVersion(solc) + if err != nil { + return nil, err + } + args := append(s.makeArgs(), "--") + cmd := exec.Command(s.Path, append(args, "-")...) + cmd.Stdin = strings.NewReader(source) + return s.run(cmd, source) +} + +// CompileSolidity compiles all given Solidity source files. +func CompileSolidity(solc string, sourcefiles ...string) (map[string]*Contract, error) { + if len(sourcefiles) == 0 { + return nil, errors.New("solc: no source files") + } + source, err := slurpFiles(sourcefiles) + if err != nil { + return nil, err + } + s, err := SolidityVersion(solc) + if err != nil { + return nil, err + } + args := append(s.makeArgs(), "--") + cmd := exec.Command(s.Path, append(args, sourcefiles...)...) + return s.run(cmd, source) +} + +func (s *Solidity) run(cmd *exec.Cmd, source string) (map[string]*Contract, error) { + var stderr, stdout bytes.Buffer + cmd.Stderr = &stderr + cmd.Stdout = &stdout + if err := cmd.Run(); err != nil { + return nil, fmt.Errorf("solc: %v\n%s", err, stderr.Bytes()) + } + + return ParseCombinedJSON(stdout.Bytes(), source, s.Version, s.Version, strings.Join(s.makeArgs(), " ")) +} + +// ParseCombinedJSON takes the direct output of a solc --combined-output run and +// parses it into a map of string contract name to Contract structs. The +// provided source, language and compiler version, and compiler options are all +// passed through into the Contract structs. +// +// The solc output is expected to contain ABI, source mapping, user docs, and dev docs. +// +// Returns an error if the JSON is malformed or missing data, or if the JSON +// embedded within the JSON is malformed. +func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion string, compilerVersion string, compilerOptions string) (map[string]*Contract, error) { + var output solcOutput + if err := json.Unmarshal(combinedJSON, &output); err != nil { + return nil, err + } + // Compilation succeeded, assemble and return the contracts. + contracts := make(map[string]*Contract) + for name, info := range output.Contracts { + // Parse the individual compilation results. + var abi interface{} + if err := json.Unmarshal([]byte(info.Abi), &abi); err != nil { + return nil, fmt.Errorf("solc: error reading abi definition (%v)", err) + } + var userdoc, devdoc interface{} + json.Unmarshal([]byte(info.Userdoc), &userdoc) + json.Unmarshal([]byte(info.Devdoc), &devdoc) + + contracts[name] = &Contract{ + Code: "0x" + info.Bin, + RuntimeCode: "0x" + info.BinRuntime, + Hashes: info.Hashes, + Info: ContractInfo{ + Source: source, + Language: "Solidity", + LanguageVersion: languageVersion, + CompilerVersion: compilerVersion, + CompilerOptions: compilerOptions, + SrcMap: info.SrcMap, + SrcMapRuntime: info.SrcMapRuntime, + AbiDefinition: abi, + UserDoc: userdoc, + DeveloperDoc: devdoc, + Metadata: info.Metadata, + }, + } + } + return contracts, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.go b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.go new file mode 100644 index 00000000..3bb35179 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.go @@ -0,0 +1,415 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contract + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = abi.U256 + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// CheckpointOracleABI is the input ABI used to generate the binding from. +const CheckpointOracleABI = "[{\"constant\":true,\"inputs\":[],\"name\":\"GetAllAdmin\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"GetLatestCheckpoint\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"},{\"name\":\"\",\"type\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_recentNumber\",\"type\":\"uint256\"},{\"name\":\"_recentHash\",\"type\":\"bytes32\"},{\"name\":\"_hash\",\"type\":\"bytes32\"},{\"name\":\"_sectionIndex\",\"type\":\"uint64\"},{\"name\":\"v\",\"type\":\"uint8[]\"},{\"name\":\"r\",\"type\":\"bytes32[]\"},{\"name\":\"s\",\"type\":\"bytes32[]\"}],\"name\":\"SetCheckpoint\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_adminlist\",\"type\":\"address[]\"},{\"name\":\"_sectionSize\",\"type\":\"uint256\"},{\"name\":\"_processConfirms\",\"type\":\"uint256\"},{\"name\":\"_threshold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"index\",\"type\":\"uint64\"},{\"indexed\":false,\"name\":\"checkpointHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"v\",\"type\":\"uint8\"},{\"indexed\":false,\"name\":\"r\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"NewCheckpointVote\",\"type\":\"event\"}]" + +// CheckpointOracleBin is the compiled bytecode used for deploying new contracts. +const CheckpointOracleBin = `0x608060405234801561001057600080fd5b506040516108153803806108158339818101604052608081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8201602081018481111561005e57600080fd5b815185602082028301116401000000008211171561007b57600080fd5b505060208201516040830151606090930151919450925060005b84518110156101415760016000808784815181106100af57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060018582815181106100fc57fe5b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501610095565b50600592909255600655600755506106b78061015e6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806345848dfc146100465780634d6a304c1461009e578063d459fc46146100cf575b600080fd5b61004e6102b0565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561008a578181015183820152602001610072565b505050509050019250505060405180910390f35b6100a661034f565b6040805167ffffffffffffffff9094168452602084019290925282820152519081900360600190f35b61029c600480360360e08110156100e557600080fd5b81359160208101359160408201359167ffffffffffffffff6060820135169181019060a08101608082013564010000000081111561012257600080fd5b82018360208201111561013457600080fd5b8035906020019184602083028401116401000000008311171561015657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156101a657600080fd5b8201836020820111156101b857600080fd5b803590602001918460208302840111640100000000831117156101da57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561022a57600080fd5b82018360208201111561023c57600080fd5b8035906020019184602083028401116401000000008311171561025e57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061036a945050505050565b604080519115158252519081900360200190f35b6060806001805490506040519080825280602002602001820160405280156102e2578160200160208202803883390190505b50905060005b60015481101561034957600181815481106102ff57fe5b9060005260206000200160009054906101000a90046001600160a01b031682828151811061032957fe5b6001600160a01b03909216602092830291909101909101526001016102e8565b50905090565b60025460045460035467ffffffffffffffff90921691909192565b3360009081526020819052604081205460ff1661038657600080fd5b8688401461039357600080fd5b82518451146103a157600080fd5b81518451146103af57600080fd5b6006546005548660010167ffffffffffffffff1602014310156103d457506000610677565b60025467ffffffffffffffff90811690861610156103f457506000610677565b60025467ffffffffffffffff8681169116148015610426575067ffffffffffffffff8516151580610426575060035415155b1561043357506000610677565b8561044057506000610677565b60408051601960f81b6020808301919091526000602183018190523060601b60228401526001600160c01b031960c08a901b166036840152603e8084018b905284518085039091018152605e909301909352815191012090805b86518110156106715760006001848984815181106104b457fe5b60200260200101518985815181106104c857fe5b60200260200101518986815181106104dc57fe5b602002602001015160405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561053b573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526020819052919091205490925060ff16905061057057600080fd5b826001600160a01b0316816001600160a01b03161161058e57600080fd5b8092508867ffffffffffffffff167fce51ffa16246bcaf0899f6504f473cd0114f430f566cef71ab7e03d3dde42a418b8a85815181106105ca57fe5b60200260200101518a86815181106105de57fe5b60200260200101518a87815181106105f257fe5b6020026020010151604051808581526020018460ff1660ff16815260200183815260200182815260200194505050505060405180910390a260075482600101106106685750505060048790555050436003556002805467ffffffffffffffff191667ffffffffffffffff86161790556001610677565b5060010161049a565b50600080fd5b97965050505050505056fea265627a7a723058207f6a191ce575596a2f1e907c8c0a01003d16b69fb2c4f432d10878e8c0a99a0264736f6c634300050a0032` + +// DeployCheckpointOracle deploys a new Ethereum contract, binding an instance of CheckpointOracle to it. +func DeployCheckpointOracle(auth *bind.TransactOpts, backend bind.ContractBackend, _adminlist []common.Address, _sectionSize *big.Int, _processConfirms *big.Int, _threshold *big.Int) (common.Address, *types.Transaction, *CheckpointOracle, error) { + parsed, err := abi.JSON(strings.NewReader(CheckpointOracleABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(CheckpointOracleBin), backend, _adminlist, _sectionSize, _processConfirms, _threshold) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &CheckpointOracle{CheckpointOracleCaller: CheckpointOracleCaller{contract: contract}, CheckpointOracleTransactor: CheckpointOracleTransactor{contract: contract}, CheckpointOracleFilterer: CheckpointOracleFilterer{contract: contract}}, nil +} + +// CheckpointOracle is an auto generated Go binding around an Ethereum contract. +type CheckpointOracle struct { + CheckpointOracleCaller // Read-only binding to the contract + CheckpointOracleTransactor // Write-only binding to the contract + CheckpointOracleFilterer // Log filterer for contract events +} + +// CheckpointOracleCaller is an auto generated read-only Go binding around an Ethereum contract. +type CheckpointOracleCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CheckpointOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. +type CheckpointOracleTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CheckpointOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type CheckpointOracleFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// CheckpointOracleSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type CheckpointOracleSession struct { + Contract *CheckpointOracle // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// CheckpointOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type CheckpointOracleCallerSession struct { + Contract *CheckpointOracleCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// CheckpointOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type CheckpointOracleTransactorSession struct { + Contract *CheckpointOracleTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// CheckpointOracleRaw is an auto generated low-level Go binding around an Ethereum contract. +type CheckpointOracleRaw struct { + Contract *CheckpointOracle // Generic contract binding to access the raw methods on +} + +// CheckpointOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type CheckpointOracleCallerRaw struct { + Contract *CheckpointOracleCaller // Generic read-only contract binding to access the raw methods on +} + +// CheckpointOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type CheckpointOracleTransactorRaw struct { + Contract *CheckpointOracleTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewCheckpointOracle creates a new instance of CheckpointOracle, bound to a specific deployed contract. +func NewCheckpointOracle(address common.Address, backend bind.ContractBackend) (*CheckpointOracle, error) { + contract, err := bindCheckpointOracle(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &CheckpointOracle{CheckpointOracleCaller: CheckpointOracleCaller{contract: contract}, CheckpointOracleTransactor: CheckpointOracleTransactor{contract: contract}, CheckpointOracleFilterer: CheckpointOracleFilterer{contract: contract}}, nil +} + +// NewCheckpointOracleCaller creates a new read-only instance of CheckpointOracle, bound to a specific deployed contract. +func NewCheckpointOracleCaller(address common.Address, caller bind.ContractCaller) (*CheckpointOracleCaller, error) { + contract, err := bindCheckpointOracle(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &CheckpointOracleCaller{contract: contract}, nil +} + +// NewCheckpointOracleTransactor creates a new write-only instance of CheckpointOracle, bound to a specific deployed contract. +func NewCheckpointOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*CheckpointOracleTransactor, error) { + contract, err := bindCheckpointOracle(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &CheckpointOracleTransactor{contract: contract}, nil +} + +// NewCheckpointOracleFilterer creates a new log filterer instance of CheckpointOracle, bound to a specific deployed contract. +func NewCheckpointOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*CheckpointOracleFilterer, error) { + contract, err := bindCheckpointOracle(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &CheckpointOracleFilterer{contract: contract}, nil +} + +// bindCheckpointOracle binds a generic wrapper to an already deployed contract. +func bindCheckpointOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(CheckpointOracleABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_CheckpointOracle *CheckpointOracleRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _CheckpointOracle.Contract.CheckpointOracleCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_CheckpointOracle *CheckpointOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CheckpointOracle.Contract.CheckpointOracleTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_CheckpointOracle *CheckpointOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CheckpointOracle.Contract.CheckpointOracleTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_CheckpointOracle *CheckpointOracleCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _CheckpointOracle.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_CheckpointOracle *CheckpointOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CheckpointOracle.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_CheckpointOracle *CheckpointOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CheckpointOracle.Contract.contract.Transact(opts, method, params...) +} + +// GetAllAdmin is a free data retrieval call binding the contract method 0x45848dfc. +// +// Solidity: function GetAllAdmin() constant returns(address[]) +func (_CheckpointOracle *CheckpointOracleCaller) GetAllAdmin(opts *bind.CallOpts) ([]common.Address, error) { + var ( + ret0 = new([]common.Address) + ) + out := ret0 + err := _CheckpointOracle.contract.Call(opts, out, "GetAllAdmin") + return *ret0, err +} + +// GetAllAdmin is a free data retrieval call binding the contract method 0x45848dfc. +// +// Solidity: function GetAllAdmin() constant returns(address[]) +func (_CheckpointOracle *CheckpointOracleSession) GetAllAdmin() ([]common.Address, error) { + return _CheckpointOracle.Contract.GetAllAdmin(&_CheckpointOracle.CallOpts) +} + +// GetAllAdmin is a free data retrieval call binding the contract method 0x45848dfc. +// +// Solidity: function GetAllAdmin() constant returns(address[]) +func (_CheckpointOracle *CheckpointOracleCallerSession) GetAllAdmin() ([]common.Address, error) { + return _CheckpointOracle.Contract.GetAllAdmin(&_CheckpointOracle.CallOpts) +} + +// GetLatestCheckpoint is a free data retrieval call binding the contract method 0x4d6a304c. +// +// Solidity: function GetLatestCheckpoint() constant returns(uint64, bytes32, uint256) +func (_CheckpointOracle *CheckpointOracleCaller) GetLatestCheckpoint(opts *bind.CallOpts) (uint64, [32]byte, *big.Int, error) { + var ( + ret0 = new(uint64) + ret1 = new([32]byte) + ret2 = new(*big.Int) + ) + out := &[]interface{}{ + ret0, + ret1, + ret2, + } + err := _CheckpointOracle.contract.Call(opts, out, "GetLatestCheckpoint") + return *ret0, *ret1, *ret2, err +} + +// GetLatestCheckpoint is a free data retrieval call binding the contract method 0x4d6a304c. +// +// Solidity: function GetLatestCheckpoint() constant returns(uint64, bytes32, uint256) +func (_CheckpointOracle *CheckpointOracleSession) GetLatestCheckpoint() (uint64, [32]byte, *big.Int, error) { + return _CheckpointOracle.Contract.GetLatestCheckpoint(&_CheckpointOracle.CallOpts) +} + +// GetLatestCheckpoint is a free data retrieval call binding the contract method 0x4d6a304c. +// +// Solidity: function GetLatestCheckpoint() constant returns(uint64, bytes32, uint256) +func (_CheckpointOracle *CheckpointOracleCallerSession) GetLatestCheckpoint() (uint64, [32]byte, *big.Int, error) { + return _CheckpointOracle.Contract.GetLatestCheckpoint(&_CheckpointOracle.CallOpts) +} + +// SetCheckpoint is a paid mutator transaction binding the contract method 0xd459fc46. +// +// Solidity: function SetCheckpoint(uint256 _recentNumber, bytes32 _recentHash, bytes32 _hash, uint64 _sectionIndex, uint8[] v, bytes32[] r, bytes32[] s) returns(bool) +func (_CheckpointOracle *CheckpointOracleTransactor) SetCheckpoint(opts *bind.TransactOpts, _recentNumber *big.Int, _recentHash [32]byte, _hash [32]byte, _sectionIndex uint64, v []uint8, r [][32]byte, s [][32]byte) (*types.Transaction, error) { + return _CheckpointOracle.contract.Transact(opts, "SetCheckpoint", _recentNumber, _recentHash, _hash, _sectionIndex, v, r, s) +} + +// SetCheckpoint is a paid mutator transaction binding the contract method 0xd459fc46. +// +// Solidity: function SetCheckpoint(uint256 _recentNumber, bytes32 _recentHash, bytes32 _hash, uint64 _sectionIndex, uint8[] v, bytes32[] r, bytes32[] s) returns(bool) +func (_CheckpointOracle *CheckpointOracleSession) SetCheckpoint(_recentNumber *big.Int, _recentHash [32]byte, _hash [32]byte, _sectionIndex uint64, v []uint8, r [][32]byte, s [][32]byte) (*types.Transaction, error) { + return _CheckpointOracle.Contract.SetCheckpoint(&_CheckpointOracle.TransactOpts, _recentNumber, _recentHash, _hash, _sectionIndex, v, r, s) +} + +// SetCheckpoint is a paid mutator transaction binding the contract method 0xd459fc46. +// +// Solidity: function SetCheckpoint(uint256 _recentNumber, bytes32 _recentHash, bytes32 _hash, uint64 _sectionIndex, uint8[] v, bytes32[] r, bytes32[] s) returns(bool) +func (_CheckpointOracle *CheckpointOracleTransactorSession) SetCheckpoint(_recentNumber *big.Int, _recentHash [32]byte, _hash [32]byte, _sectionIndex uint64, v []uint8, r [][32]byte, s [][32]byte) (*types.Transaction, error) { + return _CheckpointOracle.Contract.SetCheckpoint(&_CheckpointOracle.TransactOpts, _recentNumber, _recentHash, _hash, _sectionIndex, v, r, s) +} + +// CheckpointOracleNewCheckpointVoteIterator is returned from FilterNewCheckpointVote and is used to iterate over the raw logs and unpacked data for NewCheckpointVote events raised by the CheckpointOracle contract. +type CheckpointOracleNewCheckpointVoteIterator struct { + Event *CheckpointOracleNewCheckpointVote // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *CheckpointOracleNewCheckpointVoteIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(CheckpointOracleNewCheckpointVote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(CheckpointOracleNewCheckpointVote) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *CheckpointOracleNewCheckpointVoteIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *CheckpointOracleNewCheckpointVoteIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// CheckpointOracleNewCheckpointVote represents a NewCheckpointVote event raised by the CheckpointOracle contract. +type CheckpointOracleNewCheckpointVote struct { + Index uint64 + CheckpointHash [32]byte + V uint8 + R [32]byte + S [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewCheckpointVote is a free log retrieval operation binding the contract event 0xce51ffa16246bcaf0899f6504f473cd0114f430f566cef71ab7e03d3dde42a41. +// +// Solidity: event NewCheckpointVote(uint64 indexed index, bytes32 checkpointHash, uint8 v, bytes32 r, bytes32 s) +func (_CheckpointOracle *CheckpointOracleFilterer) FilterNewCheckpointVote(opts *bind.FilterOpts, index []uint64) (*CheckpointOracleNewCheckpointVoteIterator, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _CheckpointOracle.contract.FilterLogs(opts, "NewCheckpointVote", indexRule) + if err != nil { + return nil, err + } + return &CheckpointOracleNewCheckpointVoteIterator{contract: _CheckpointOracle.contract, event: "NewCheckpointVote", logs: logs, sub: sub}, nil +} + +// WatchNewCheckpointVote is a free log subscription operation binding the contract event 0xce51ffa16246bcaf0899f6504f473cd0114f430f566cef71ab7e03d3dde42a41. +// +// Solidity: event NewCheckpointVote(uint64 indexed index, bytes32 checkpointHash, uint8 v, bytes32 r, bytes32 s) +func (_CheckpointOracle *CheckpointOracleFilterer) WatchNewCheckpointVote(opts *bind.WatchOpts, sink chan<- *CheckpointOracleNewCheckpointVote, index []uint64) (event.Subscription, error) { + + var indexRule []interface{} + for _, indexItem := range index { + indexRule = append(indexRule, indexItem) + } + + logs, sub, err := _CheckpointOracle.contract.WatchLogs(opts, "NewCheckpointVote", indexRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(CheckpointOracleNewCheckpointVote) + if err := _CheckpointOracle.contract.UnpackLog(event, "NewCheckpointVote", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseNewCheckpointVote is a log parse operation binding the contract event 0xce51ffa16246bcaf0899f6504f473cd0114f430f566cef71ab7e03d3dde42a41. +// +// Solidity: event NewCheckpointVote(uint64 indexed index, bytes32 checkpointHash, uint8 v, bytes32 r, bytes32 s) +func (_CheckpointOracle *CheckpointOracleFilterer) ParseNewCheckpointVote(log types.Log) (*CheckpointOracleNewCheckpointVote, error) { + event := new(CheckpointOracleNewCheckpointVote) + if err := _CheckpointOracle.contract.UnpackLog(event, "NewCheckpointVote", log); err != nil { + return nil, err + } + return event, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.sol b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.sol new file mode 100644 index 00000000..01064472 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract/oracle.sol @@ -0,0 +1,174 @@ +pragma solidity ^0.5.10; + +/** + * @title CheckpointOracle + * @author Gary Rong, Martin Swende + * @dev Implementation of the blockchain checkpoint registrar. + */ +contract CheckpointOracle { + /* + Events + */ + + // NewCheckpointVote is emitted when a new checkpoint proposal receives a vote. + event NewCheckpointVote(uint64 indexed index, bytes32 checkpointHash, uint8 v, bytes32 r, bytes32 s); + + /* + Public Functions + */ + constructor(address[] memory _adminlist, uint _sectionSize, uint _processConfirms, uint _threshold) public { + for (uint i = 0; i < _adminlist.length; i++) { + admins[_adminlist[i]] = true; + adminList.push(_adminlist[i]); + } + sectionSize = _sectionSize; + processConfirms = _processConfirms; + threshold = _threshold; + } + + /** + * @dev Get latest stable checkpoint information. + * @return section index + * @return checkpoint hash + * @return block height associated with checkpoint + */ + function GetLatestCheckpoint() + view + public + returns(uint64, bytes32, uint) { + return (sectionIndex, hash, height); + } + + // SetCheckpoint sets a new checkpoint. It accepts a list of signatures + // @_recentNumber: a recent blocknumber, for replay protection + // @_recentHash : the hash of `_recentNumber` + // @_hash : the hash to set at _sectionIndex + // @_sectionIndex : the section index to set + // @v : the list of v-values + // @r : the list or r-values + // @s : the list of s-values + function SetCheckpoint( + uint _recentNumber, + bytes32 _recentHash, + bytes32 _hash, + uint64 _sectionIndex, + uint8[] memory v, + bytes32[] memory r, + bytes32[] memory s) + public + returns (bool) + { + // Ensure the sender is authorized. + require(admins[msg.sender]); + + // These checks replay protection, so it cannot be replayed on forks, + // accidentally or intentionally + require(blockhash(_recentNumber) == _recentHash); + + // Ensure the batch of signatures are valid. + require(v.length == r.length); + require(v.length == s.length); + + // Filter out "future" checkpoint. + if (block.number < (_sectionIndex+1)*sectionSize+processConfirms) { + return false; + } + // Filter out "old" announcement + if (_sectionIndex < sectionIndex) { + return false; + } + // Filter out "stale" announcement + if (_sectionIndex == sectionIndex && (_sectionIndex != 0 || height != 0)) { + return false; + } + // Filter out "invalid" announcement + if (_hash == ""){ + return false; + } + + // EIP 191 style signatures + // + // Arguments when calculating hash to validate + // 1: byte(0x19) - the initial 0x19 byte + // 2: byte(0) - the version byte (data with intended validator) + // 3: this - the validator address + // -- Application specific data + // 4 : checkpoint section_index(uint64) + // 5 : checkpoint hash (bytes32) + // hash = keccak256(checkpoint_index, section_head, cht_root, bloom_root) + bytes32 signedHash = keccak256(abi.encodePacked(byte(0x19), byte(0), this, _sectionIndex, _hash)); + + address lastVoter = address(0); + + // In order for us not to have to maintain a mapping of who has already + // voted, and we don't want to count a vote twice, the signatures must + // be submitted in strict ordering. + for (uint idx = 0; idx < v.length; idx++){ + address signer = ecrecover(signedHash, v[idx], r[idx], s[idx]); + require(admins[signer]); + require(uint256(signer) > uint256(lastVoter)); + lastVoter = signer; + emit NewCheckpointVote(_sectionIndex, _hash, v[idx], r[idx], s[idx]); + + // Sufficient signatures present, update latest checkpoint. + if (idx+1 >= threshold){ + hash = _hash; + height = block.number; + sectionIndex = _sectionIndex; + return true; + } + } + // We shouldn't wind up here, reverting un-emits the events + revert(); + } + + /** + * @dev Get all admin addresses + * @return address list + */ + function GetAllAdmin() + public + view + returns(address[] memory) + { + address[] memory ret = new address[](adminList.length); + for (uint i = 0; i < adminList.length; i++) { + ret[i] = adminList[i]; + } + return ret; + } + + /* + Fields + */ + // A map of admin users who have the permission to update CHT and bloom Trie root + mapping(address => bool) admins; + + // A list of admin users so that we can obtain all admin users. + address[] adminList; + + // Latest stored section id + uint64 sectionIndex; + + // The block height associated with latest registered checkpoint. + uint height; + + // The hash of latest registered checkpoint. + bytes32 hash; + + // The frequency for creating a checkpoint + // + // The default value should be the same as the checkpoint size(32768) in the ethereum. + uint sectionSize; + + // The number of confirmations needed before a checkpoint can be registered. + // We have to make sure the checkpoint registered will not be invalid due to + // chain reorg. + // + // The default value should be the same as the checkpoint process confirmations(256) + // in the ethereum. + uint processConfirms; + + // The required signatures to finalize a stable checkpoint. + uint threshold; +} diff --git a/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/oracle.go b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/oracle.go new file mode 100644 index 00000000..13ff236f --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/contracts/checkpointoracle/oracle.go @@ -0,0 +1,90 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package checkpointoracle is a an on-chain light client checkpoint oracle. +package checkpointoracle + +//go:generate abigen --sol contract/oracle.sol --pkg contract --out contract/oracle.go + +import ( + "errors" + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract" + "github.com/ethereum/go-ethereum/core/types" +) + +// CheckpointOracle is a Go wrapper around an on-chain light client checkpoint oracle. +type CheckpointOracle struct { + contract *contract.CheckpointOracle +} + +// NewCheckpointOracle binds checkpoint contract and returns a registrar instance. +func NewCheckpointOracle(contractAddr common.Address, backend bind.ContractBackend) (*CheckpointOracle, error) { + c, err := contract.NewCheckpointOracle(contractAddr, backend) + if err != nil { + return nil, err + } + return &CheckpointOracle{contract: c}, nil +} + +// Contract returns the underlying contract instance. +func (oracle *CheckpointOracle) Contract() *contract.CheckpointOracle { + return oracle.contract +} + +// LookupCheckpointEvents searches checkpoint event for specific section in the +// given log batches. +func (oracle *CheckpointOracle) LookupCheckpointEvents(blockLogs [][]*types.Log, section uint64, hash common.Hash) []*contract.CheckpointOracleNewCheckpointVote { + var votes []*contract.CheckpointOracleNewCheckpointVote + + for _, logs := range blockLogs { + for _, log := range logs { + event, err := oracle.contract.ParseNewCheckpointVote(*log) + if err != nil { + continue + } + if event.Index == section && common.Hash(event.CheckpointHash) == hash { + votes = append(votes, event) + } + } + } + return votes +} + +// RegisterCheckpoint registers the checkpoint with a batch of associated signatures +// that are collected off-chain and sorted by lexicographical order. +// +// Notably all signatures given should be transformed to "ethereum style" which transforms +// v from 0/1 to 27/28 according to the yellow paper. +func (oracle *CheckpointOracle) RegisterCheckpoint(opts *bind.TransactOpts, index uint64, hash []byte, rnum *big.Int, rhash [32]byte, sigs [][]byte) (*types.Transaction, error) { + var ( + r [][32]byte + s [][32]byte + v []uint8 + ) + for i := 0; i < len(sigs); i++ { + if len(sigs[i]) != 65 { + return nil, errors.New("invalid signature") + } + r = append(r, common.BytesToHash(sigs[i][:32])) + s = append(s, common.BytesToHash(sigs[i][32:64])) + v = append(v, sigs[i][64]) + } + return oracle.contract.SetCheckpoint(opts, rnum, rhash, common.BytesToHash(hash), index, v, r, s) +} diff --git a/vendor/github.com/ethereum/go-ethereum/core/blockchain.go b/vendor/github.com/ethereum/go-ethereum/core/blockchain.go index 15e771f4..cf1a65cd 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/blockchain.go +++ b/vendor/github.com/ethereum/go-ethereum/core/blockchain.go @@ -931,9 +931,17 @@ func (bc *BlockChain) truncateAncient(head uint64) error { return nil } +// numberHash is just a container for a number and a hash, to represent a block +type numberHash struct { + number uint64 + hash common.Hash +} + // InsertReceiptChain attempts to complete an already existing header chain with // transaction and receipt data. func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain []types.Receipts, ancientLimit uint64) (int, error) { + // We don't require the chainMu here since we want to maximize the + // concurrency of header insertion and receipt insertion. bc.wg.Add(1) defer bc.wg.Done() @@ -966,19 +974,21 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ // updateHead updates the head fast sync block if the inserted blocks are better // and returns a indicator whether the inserted blocks are canonical. updateHead := func(head *types.Block) bool { - var isCanonical bool bc.chainmu.Lock() - if td := bc.GetTd(head.Hash(), head.NumberU64()); td != nil { // Rewind may have occurred, skip in that case - currentFastBlock := bc.CurrentFastBlock() + + // Rewind may have occurred, skip in that case. + if bc.CurrentHeader().Number.Cmp(head.Number()) >= 0 { + currentFastBlock, td := bc.CurrentFastBlock(), bc.GetTd(head.Hash(), head.NumberU64()) if bc.GetTd(currentFastBlock.Hash(), currentFastBlock.NumberU64()).Cmp(td) < 0 { rawdb.WriteHeadFastBlockHash(bc.db, head.Hash()) bc.currentFastBlock.Store(head) headFastBlockGauge.Update(int64(head.NumberU64())) - isCanonical = true + bc.chainmu.Unlock() + return true } } bc.chainmu.Unlock() - return isCanonical + return false } // writeAncient writes blockchain and corresponding receipt chain into ancient store. // @@ -998,7 +1008,7 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ } } }() - var deleted types.Blocks + var deleted []*numberHash for i, block := range blockChain { // Short circuit insertion if shutting down or processing failed if atomic.LoadInt32(&bc.procInterrupt) == 1 { @@ -1033,12 +1043,40 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ // Always keep genesis block in active database. if b.NumberU64() != 0 { - deleted = append(deleted, b) + deleted = append(deleted, &numberHash{b.NumberU64(), b.Hash()}) } if time.Since(logged) > 8*time.Second { log.Info("Migrating ancient blocks", "count", count, "elapsed", common.PrettyDuration(time.Since(start))) logged = time.Now() } + // Don't collect too much in-memory, write it out every 100K blocks + if len(deleted) > 100000 { + + // Sync the ancient store explicitly to ensure all data has been flushed to disk. + if err := bc.db.Sync(); err != nil { + return 0, err + } + // Wipe out canonical block data. + for _, nh := range deleted { + rawdb.DeleteBlockWithoutNumber(batch, nh.hash, nh.number) + rawdb.DeleteCanonicalHash(batch, nh.number) + } + if err := batch.Write(); err != nil { + return 0, err + } + batch.Reset() + // Wipe out side chain too. + for _, nh := range deleted { + for _, hash := range rawdb.ReadAllHashes(bc.db, nh.number) { + rawdb.DeleteBlock(batch, hash, nh.number) + } + } + if err := batch.Write(); err != nil { + return 0, err + } + batch.Reset() + deleted = deleted[0:] + } } if count > 0 { log.Info("Migrated ancient blocks", "count", count, "elapsed", common.PrettyDuration(time.Since(start))) @@ -1066,7 +1104,11 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ previous = nil // disable rollback explicitly // Wipe out canonical block data. - for _, block := range append(deleted, blockChain...) { + for _, nh := range deleted { + rawdb.DeleteBlockWithoutNumber(batch, nh.hash, nh.number) + rawdb.DeleteCanonicalHash(batch, nh.number) + } + for _, block := range blockChain { // Always keep genesis block in active database. if block.NumberU64() != 0 { rawdb.DeleteBlockWithoutNumber(batch, block.Hash(), block.NumberU64()) @@ -1079,7 +1121,12 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [ batch.Reset() // Wipe out side chain too. - for _, block := range append(deleted, blockChain...) { + for _, nh := range deleted { + for _, hash := range rawdb.ReadAllHashes(bc.db, nh.number) { + rawdb.DeleteBlock(batch, hash, nh.number) + } + } + for _, block := range blockChain { // Always keep genesis block in active database. if block.NumberU64() != 0 { for _, hash := range rawdb.ReadAllHashes(bc.db, block.NumberU64()) { @@ -2130,7 +2177,7 @@ func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header { return bc.hc.GetHeaderByNumber(number) } -// Config retrieves the blockchain's chain configuration. +// Config retrieves the chain's fork configuration. func (bc *BlockChain) Config() *params.ChainConfig { return bc.chainConfig } // Engine retrieves the blockchain's consensus engine. diff --git a/vendor/github.com/ethereum/go-ethereum/core/chain_indexer.go b/vendor/github.com/ethereum/go-ethereum/core/chain_indexer.go new file mode 100644 index 00000000..c0c2c4f7 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/chain_indexer.go @@ -0,0 +1,512 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package core + +import ( + "context" + "encoding/binary" + "fmt" + "sync" + "sync/atomic" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/log" +) + +// ChainIndexerBackend defines the methods needed to process chain segments in +// the background and write the segment results into the database. These can be +// used to create filter blooms or CHTs. +type ChainIndexerBackend interface { + // Reset initiates the processing of a new chain segment, potentially terminating + // any partially completed operations (in case of a reorg). + Reset(ctx context.Context, section uint64, prevHead common.Hash) error + + // Process crunches through the next header in the chain segment. The caller + // will ensure a sequential order of headers. + Process(ctx context.Context, header *types.Header) error + + // Commit finalizes the section metadata and stores it into the database. + Commit() error +} + +// ChainIndexerChain interface is used for connecting the indexer to a blockchain +type ChainIndexerChain interface { + // CurrentHeader retrieves the latest locally known header. + CurrentHeader() *types.Header + + // SubscribeChainHeadEvent subscribes to new head header notifications. + SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Subscription +} + +// ChainIndexer does a post-processing job for equally sized sections of the +// canonical chain (like BlooomBits and CHT structures). A ChainIndexer is +// connected to the blockchain through the event system by starting a +// ChainHeadEventLoop in a goroutine. +// +// Further child ChainIndexers can be added which use the output of the parent +// section indexer. These child indexers receive new head notifications only +// after an entire section has been finished or in case of rollbacks that might +// affect already finished sections. +type ChainIndexer struct { + chainDb ethdb.Database // Chain database to index the data from + indexDb ethdb.Database // Prefixed table-view of the db to write index metadata into + backend ChainIndexerBackend // Background processor generating the index data content + children []*ChainIndexer // Child indexers to cascade chain updates to + + active uint32 // Flag whether the event loop was started + update chan struct{} // Notification channel that headers should be processed + quit chan chan error // Quit channel to tear down running goroutines + ctx context.Context + ctxCancel func() + + sectionSize uint64 // Number of blocks in a single chain segment to process + confirmsReq uint64 // Number of confirmations before processing a completed segment + + storedSections uint64 // Number of sections successfully indexed into the database + knownSections uint64 // Number of sections known to be complete (block wise) + cascadedHead uint64 // Block number of the last completed section cascaded to subindexers + + checkpointSections uint64 // Number of sections covered by the checkpoint + checkpointHead common.Hash // Section head belonging to the checkpoint + + throttling time.Duration // Disk throttling to prevent a heavy upgrade from hogging resources + + log log.Logger + lock sync.RWMutex +} + +// NewChainIndexer creates a new chain indexer to do background processing on +// chain segments of a given size after certain number of confirmations passed. +// The throttling parameter might be used to prevent database thrashing. +func NewChainIndexer(chainDb ethdb.Database, indexDb ethdb.Database, backend ChainIndexerBackend, section, confirm uint64, throttling time.Duration, kind string) *ChainIndexer { + c := &ChainIndexer{ + chainDb: chainDb, + indexDb: indexDb, + backend: backend, + update: make(chan struct{}, 1), + quit: make(chan chan error), + sectionSize: section, + confirmsReq: confirm, + throttling: throttling, + log: log.New("type", kind), + } + // Initialize database dependent fields and start the updater + c.loadValidSections() + c.ctx, c.ctxCancel = context.WithCancel(context.Background()) + + go c.updateLoop() + + return c +} + +// AddCheckpoint adds a checkpoint. Sections are never processed and the chain +// is not expected to be available before this point. The indexer assumes that +// the backend has sufficient information available to process subsequent sections. +// +// Note: knownSections == 0 and storedSections == checkpointSections until +// syncing reaches the checkpoint +func (c *ChainIndexer) AddCheckpoint(section uint64, shead common.Hash) { + c.lock.Lock() + defer c.lock.Unlock() + + // Short circuit if the given checkpoint is below than local's. + if c.checkpointSections >= section+1 || section < c.storedSections { + return + } + c.checkpointSections = section + 1 + c.checkpointHead = shead + + c.setSectionHead(section, shead) + c.setValidSections(section + 1) +} + +// Start creates a goroutine to feed chain head events into the indexer for +// cascading background processing. Children do not need to be started, they +// are notified about new events by their parents. +func (c *ChainIndexer) Start(chain ChainIndexerChain) { + events := make(chan ChainHeadEvent, 10) + sub := chain.SubscribeChainHeadEvent(events) + + go c.eventLoop(chain.CurrentHeader(), events, sub) +} + +// Close tears down all goroutines belonging to the indexer and returns any error +// that might have occurred internally. +func (c *ChainIndexer) Close() error { + var errs []error + + c.ctxCancel() + + // Tear down the primary update loop + errc := make(chan error) + c.quit <- errc + if err := <-errc; err != nil { + errs = append(errs, err) + } + // If needed, tear down the secondary event loop + if atomic.LoadUint32(&c.active) != 0 { + c.quit <- errc + if err := <-errc; err != nil { + errs = append(errs, err) + } + } + // Close all children + for _, child := range c.children { + if err := child.Close(); err != nil { + errs = append(errs, err) + } + } + // Return any failures + switch { + case len(errs) == 0: + return nil + + case len(errs) == 1: + return errs[0] + + default: + return fmt.Errorf("%v", errs) + } +} + +// eventLoop is a secondary - optional - event loop of the indexer which is only +// started for the outermost indexer to push chain head events into a processing +// queue. +func (c *ChainIndexer) eventLoop(currentHeader *types.Header, events chan ChainHeadEvent, sub event.Subscription) { + // Mark the chain indexer as active, requiring an additional teardown + atomic.StoreUint32(&c.active, 1) + + defer sub.Unsubscribe() + + // Fire the initial new head event to start any outstanding processing + c.newHead(currentHeader.Number.Uint64(), false) + + var ( + prevHeader = currentHeader + prevHash = currentHeader.Hash() + ) + for { + select { + case errc := <-c.quit: + // Chain indexer terminating, report no failure and abort + errc <- nil + return + + case ev, ok := <-events: + // Received a new event, ensure it's not nil (closing) and update + if !ok { + errc := <-c.quit + errc <- nil + return + } + header := ev.Block.Header() + if header.ParentHash != prevHash { + // Reorg to the common ancestor if needed (might not exist in light sync mode, skip reorg then) + // TODO(karalabe, zsfelfoldi): This seems a bit brittle, can we detect this case explicitly? + + if rawdb.ReadCanonicalHash(c.chainDb, prevHeader.Number.Uint64()) != prevHash { + if h := rawdb.FindCommonAncestor(c.chainDb, prevHeader, header); h != nil { + c.newHead(h.Number.Uint64(), true) + } + } + } + c.newHead(header.Number.Uint64(), false) + + prevHeader, prevHash = header, header.Hash() + } + } +} + +// newHead notifies the indexer about new chain heads and/or reorgs. +func (c *ChainIndexer) newHead(head uint64, reorg bool) { + c.lock.Lock() + defer c.lock.Unlock() + + // If a reorg happened, invalidate all sections until that point + if reorg { + // Revert the known section number to the reorg point + known := (head + 1) / c.sectionSize + stored := known + if known < c.checkpointSections { + known = 0 + } + if stored < c.checkpointSections { + stored = c.checkpointSections + } + if known < c.knownSections { + c.knownSections = known + } + // Revert the stored sections from the database to the reorg point + if stored < c.storedSections { + c.setValidSections(stored) + } + // Update the new head number to the finalized section end and notify children + head = known * c.sectionSize + + if head < c.cascadedHead { + c.cascadedHead = head + for _, child := range c.children { + child.newHead(c.cascadedHead, true) + } + } + return + } + // No reorg, calculate the number of newly known sections and update if high enough + var sections uint64 + if head >= c.confirmsReq { + sections = (head + 1 - c.confirmsReq) / c.sectionSize + if sections < c.checkpointSections { + sections = 0 + } + if sections > c.knownSections { + if c.knownSections < c.checkpointSections { + // syncing reached the checkpoint, verify section head + syncedHead := rawdb.ReadCanonicalHash(c.chainDb, c.checkpointSections*c.sectionSize-1) + if syncedHead != c.checkpointHead { + c.log.Error("Synced chain does not match checkpoint", "number", c.checkpointSections*c.sectionSize-1, "expected", c.checkpointHead, "synced", syncedHead) + return + } + } + c.knownSections = sections + + select { + case c.update <- struct{}{}: + default: + } + } + } +} + +// updateLoop is the main event loop of the indexer which pushes chain segments +// down into the processing backend. +func (c *ChainIndexer) updateLoop() { + var ( + updating bool + updated time.Time + ) + + for { + select { + case errc := <-c.quit: + // Chain indexer terminating, report no failure and abort + errc <- nil + return + + case <-c.update: + // Section headers completed (or rolled back), update the index + c.lock.Lock() + if c.knownSections > c.storedSections { + // Periodically print an upgrade log message to the user + if time.Since(updated) > 8*time.Second { + if c.knownSections > c.storedSections+1 { + updating = true + c.log.Info("Upgrading chain index", "percentage", c.storedSections*100/c.knownSections) + } + updated = time.Now() + } + // Cache the current section count and head to allow unlocking the mutex + c.verifyLastHead() + section := c.storedSections + var oldHead common.Hash + if section > 0 { + oldHead = c.SectionHead(section - 1) + } + // Process the newly defined section in the background + c.lock.Unlock() + newHead, err := c.processSection(section, oldHead) + if err != nil { + select { + case <-c.ctx.Done(): + <-c.quit <- nil + return + default: + } + c.log.Error("Section processing failed", "error", err) + } + c.lock.Lock() + + // If processing succeeded and no reorgs occurred, mark the section completed + if err == nil && (section == 0 || oldHead == c.SectionHead(section-1)) { + c.setSectionHead(section, newHead) + c.setValidSections(section + 1) + if c.storedSections == c.knownSections && updating { + updating = false + c.log.Info("Finished upgrading chain index") + } + c.cascadedHead = c.storedSections*c.sectionSize - 1 + for _, child := range c.children { + c.log.Trace("Cascading chain index update", "head", c.cascadedHead) + child.newHead(c.cascadedHead, false) + } + } else { + // If processing failed, don't retry until further notification + c.log.Debug("Chain index processing failed", "section", section, "err", err) + c.verifyLastHead() + c.knownSections = c.storedSections + } + } + // If there are still further sections to process, reschedule + if c.knownSections > c.storedSections { + time.AfterFunc(c.throttling, func() { + select { + case c.update <- struct{}{}: + default: + } + }) + } + c.lock.Unlock() + } + } +} + +// processSection processes an entire section by calling backend functions while +// ensuring the continuity of the passed headers. Since the chain mutex is not +// held while processing, the continuity can be broken by a long reorg, in which +// case the function returns with an error. +func (c *ChainIndexer) processSection(section uint64, lastHead common.Hash) (common.Hash, error) { + c.log.Trace("Processing new chain section", "section", section) + + // Reset and partial processing + + if err := c.backend.Reset(c.ctx, section, lastHead); err != nil { + c.setValidSections(0) + return common.Hash{}, err + } + + for number := section * c.sectionSize; number < (section+1)*c.sectionSize; number++ { + hash := rawdb.ReadCanonicalHash(c.chainDb, number) + if hash == (common.Hash{}) { + return common.Hash{}, fmt.Errorf("canonical block #%d unknown", number) + } + header := rawdb.ReadHeader(c.chainDb, hash, number) + if header == nil { + return common.Hash{}, fmt.Errorf("block #%d [%x…] not found", number, hash[:4]) + } else if header.ParentHash != lastHead { + return common.Hash{}, fmt.Errorf("chain reorged during section processing") + } + if err := c.backend.Process(c.ctx, header); err != nil { + return common.Hash{}, err + } + lastHead = header.Hash() + } + if err := c.backend.Commit(); err != nil { + return common.Hash{}, err + } + return lastHead, nil +} + +// verifyLastHead compares last stored section head with the corresponding block hash in the +// actual canonical chain and rolls back reorged sections if necessary to ensure that stored +// sections are all valid +func (c *ChainIndexer) verifyLastHead() { + for c.storedSections > 0 && c.storedSections > c.checkpointSections { + if c.SectionHead(c.storedSections-1) == rawdb.ReadCanonicalHash(c.chainDb, c.storedSections*c.sectionSize-1) { + return + } + c.setValidSections(c.storedSections - 1) + } +} + +// Sections returns the number of processed sections maintained by the indexer +// and also the information about the last header indexed for potential canonical +// verifications. +func (c *ChainIndexer) Sections() (uint64, uint64, common.Hash) { + c.lock.Lock() + defer c.lock.Unlock() + + c.verifyLastHead() + return c.storedSections, c.storedSections*c.sectionSize - 1, c.SectionHead(c.storedSections - 1) +} + +// AddChildIndexer adds a child ChainIndexer that can use the output of this one +func (c *ChainIndexer) AddChildIndexer(indexer *ChainIndexer) { + c.lock.Lock() + defer c.lock.Unlock() + + c.children = append(c.children, indexer) + + // Cascade any pending updates to new children too + sections := c.storedSections + if c.knownSections < sections { + // if a section is "stored" but not "known" then it is a checkpoint without + // available chain data so we should not cascade it yet + sections = c.knownSections + } + if sections > 0 { + indexer.newHead(sections*c.sectionSize-1, false) + } +} + +// loadValidSections reads the number of valid sections from the index database +// and caches is into the local state. +func (c *ChainIndexer) loadValidSections() { + data, _ := c.indexDb.Get([]byte("count")) + if len(data) == 8 { + c.storedSections = binary.BigEndian.Uint64(data) + } +} + +// setValidSections writes the number of valid sections to the index database +func (c *ChainIndexer) setValidSections(sections uint64) { + // Set the current number of valid sections in the database + var data [8]byte + binary.BigEndian.PutUint64(data[:], sections) + c.indexDb.Put([]byte("count"), data[:]) + + // Remove any reorged sections, caching the valids in the mean time + for c.storedSections > sections { + c.storedSections-- + c.removeSectionHead(c.storedSections) + } + c.storedSections = sections // needed if new > old +} + +// SectionHead retrieves the last block hash of a processed section from the +// index database. +func (c *ChainIndexer) SectionHead(section uint64) common.Hash { + var data [8]byte + binary.BigEndian.PutUint64(data[:], section) + + hash, _ := c.indexDb.Get(append([]byte("shead"), data[:]...)) + if len(hash) == len(common.Hash{}) { + return common.BytesToHash(hash) + } + return common.Hash{} +} + +// setSectionHead writes the last block hash of a processed section to the index +// database. +func (c *ChainIndexer) setSectionHead(section uint64, hash common.Hash) { + var data [8]byte + binary.BigEndian.PutUint64(data[:], section) + + c.indexDb.Put(append([]byte("shead"), data[:]...), hash.Bytes()) +} + +// removeSectionHead removes the reference to a processed section from the index +// database. +func (c *ChainIndexer) removeSectionHead(section uint64) { + var data [8]byte + binary.BigEndian.PutUint64(data[:], section) + + c.indexDb.Delete(append([]byte("shead"), data[:]...)) +} diff --git a/vendor/github.com/ethereum/go-ethereum/core/forkid/forkid.go b/vendor/github.com/ethereum/go-ethereum/core/forkid/forkid.go new file mode 100644 index 00000000..8c170087 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/forkid/forkid.go @@ -0,0 +1,236 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package forkid implements EIP-2124 (https://eips.ethereum.org/EIPS/eip-2124). +package forkid + +import ( + "encoding/binary" + "errors" + "hash/crc32" + "math" + "math/big" + "reflect" + "strings" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" +) + +var ( + // ErrRemoteStale is returned by the validator if a remote fork checksum is a + // subset of our already applied forks, but the announced next fork block is + // not on our already passed chain. + ErrRemoteStale = errors.New("remote needs update") + + // ErrLocalIncompatibleOrStale is returned by the validator if a remote fork + // checksum does not match any local checksum variation, signalling that the + // two chains have diverged in the past at some point (possibly at genesis). + ErrLocalIncompatibleOrStale = errors.New("local incompatible or needs update") +) + +// ID is a fork identifier as defined by EIP-2124. +type ID struct { + Hash [4]byte // CRC32 checksum of the genesis block and passed fork block numbers + Next uint64 // Block number of the next upcoming fork, or 0 if no forks are known +} + +// NewID calculates the Ethereum fork ID from the chain config and head. +func NewID(chain *core.BlockChain) ID { + return newID( + chain.Config(), + chain.Genesis().Hash(), + chain.CurrentHeader().Number.Uint64(), + ) +} + +// newID is the internal version of NewID, which takes extracted values as its +// arguments instead of a chain. The reason is to allow testing the IDs without +// having to simulate an entire blockchain. +func newID(config *params.ChainConfig, genesis common.Hash, head uint64) ID { + // Calculate the starting checksum from the genesis hash + hash := crc32.ChecksumIEEE(genesis[:]) + + // Calculate the current fork checksum and the next fork block + var next uint64 + for _, fork := range gatherForks(config) { + if fork <= head { + // Fork already passed, checksum the previous hash and the fork number + hash = checksumUpdate(hash, fork) + continue + } + next = fork + break + } + return ID{Hash: checksumToBytes(hash), Next: next} +} + +// NewFilter creates an filter that returns if a fork ID should be rejected or not +// based on the local chain's status. +func NewFilter(chain *core.BlockChain) func(id ID) error { + return newFilter( + chain.Config(), + chain.Genesis().Hash(), + func() uint64 { + return chain.CurrentHeader().Number.Uint64() + }, + ) +} + +// newFilter is the internal version of NewFilter, taking closures as its arguments +// instead of a chain. The reason is to allow testing it without having to simulate +// an entire blockchain. +func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() uint64) func(id ID) error { + // Calculate the all the valid fork hash and fork next combos + var ( + forks = gatherForks(config) + sums = make([][4]byte, len(forks)+1) // 0th is the genesis + ) + hash := crc32.ChecksumIEEE(genesis[:]) + sums[0] = checksumToBytes(hash) + for i, fork := range forks { + hash = checksumUpdate(hash, fork) + sums[i+1] = checksumToBytes(hash) + } + // Add two sentries to simplify the fork checks and don't require special + // casing the last one. + forks = append(forks, math.MaxUint64) // Last fork will never be passed + + // Create a validator that will filter out incompatible chains + return func(id ID) error { + // Run the fork checksum validation ruleset: + // 1. If local and remote FORK_CSUM matches, connect. + // The two nodes are in the same fork state currently. They might know + // of differing future forks, but that's not relevant until the fork + // triggers (might be postponed, nodes might be updated to match). + // 2. If the remote FORK_CSUM is a subset of the local past forks and the + // remote FORK_NEXT matches with the locally following fork block number, + // connect. + // Remote node is currently syncing. It might eventually diverge from + // us, but at this current point in time we don't have enough information. + // 3. If the remote FORK_CSUM is a superset of the local past forks and can + // be completed with locally known future forks, connect. + // Local node is currently syncing. It might eventually diverge from + // the remote, but at this current point in time we don't have enough + // information. + // 4. Reject in all other cases. + head := headfn() + for i, fork := range forks { + // If our head is beyond this fork, continue to the next (we have a dummy + // fork of maxuint64 as the last item to always fail this check eventually). + if head > fork { + continue + } + // Found the first unpassed fork block, check if our current state matches + // the remote checksum (rule #1). + if sums[i] == id.Hash { + // Yay, fork checksum matched, ignore any upcoming fork + return nil + } + // The local and remote nodes are in different forks currently, check if the + // remote checksum is a subset of our local forks (rule #2). + for j := 0; j < i; j++ { + if sums[j] == id.Hash { + // Remote checksum is a subset, validate based on the announced next fork + if forks[j] != id.Next { + return ErrRemoteStale + } + return nil + } + } + // Remote chain is not a subset of our local one, check if it's a superset by + // any chance, signalling that we're simply out of sync (rule #3). + for j := i + 1; j < len(sums); j++ { + if sums[j] == id.Hash { + // Yay, remote checksum is a superset, ignore upcoming forks + return nil + } + } + // No exact, subset or superset match. We are on differing chains, reject. + return ErrLocalIncompatibleOrStale + } + log.Error("Impossible fork ID validation", "id", id) + return nil // Something's very wrong, accept rather than reject + } +} + +// checksum calculates the IEEE CRC32 checksum of a block number. +func checksum(fork uint64) uint32 { + var blob [8]byte + binary.BigEndian.PutUint64(blob[:], fork) + return crc32.ChecksumIEEE(blob[:]) +} + +// checksumUpdate calculates the next IEEE CRC32 checksum based on the previous +// one and a fork block number (equivalent to CRC32(original-blob || fork)). +func checksumUpdate(hash uint32, fork uint64) uint32 { + var blob [8]byte + binary.BigEndian.PutUint64(blob[:], fork) + return crc32.Update(hash, crc32.IEEETable, blob[:]) +} + +// checksumToBytes converts a uint32 checksum into a [4]byte array. +func checksumToBytes(hash uint32) [4]byte { + var blob [4]byte + binary.BigEndian.PutUint32(blob[:], hash) + return blob +} + +// gatherForks gathers all the known forks and creates a sorted list out of them. +func gatherForks(config *params.ChainConfig) []uint64 { + // Gather all the fork block numbers via reflection + kind := reflect.TypeOf(params.ChainConfig{}) + conf := reflect.ValueOf(config).Elem() + + var forks []uint64 + for i := 0; i < kind.NumField(); i++ { + // Fetch the next field and skip non-fork rules + field := kind.Field(i) + if !strings.HasSuffix(field.Name, "Block") { + continue + } + if field.Type != reflect.TypeOf(new(big.Int)) { + continue + } + // Extract the fork rule block number and aggregate it + rule := conf.Field(i).Interface().(*big.Int) + if rule != nil { + forks = append(forks, rule.Uint64()) + } + } + // Sort the fork block numbers to permit chronologival XOR + for i := 0; i < len(forks); i++ { + for j := i + 1; j < len(forks); j++ { + if forks[i] > forks[j] { + forks[i], forks[j] = forks[j], forks[i] + } + } + } + // Deduplicate block numbers applying multiple forks + for i := 1; i < len(forks); i++ { + if forks[i] == forks[i-1] { + forks = append(forks[:i], forks[i+1:]...) + i-- + } + } + // Skip any forks in block 0, that's the genesis ruleset + if len(forks) > 0 && forks[0] == 0 { + forks = forks[1:] + } + return forks +} diff --git a/vendor/github.com/ethereum/go-ethereum/core/genesis.go b/vendor/github.com/ethereum/go-ethereum/core/genesis.go index 830fb033..57809fe7 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/genesis.go +++ b/vendor/github.com/ethereum/go-ethereum/core/genesis.go @@ -151,9 +151,6 @@ func (e *GenesisMismatchError) Error() string { // // The returned chain configuration is never nil. func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) { - return SetupGenesisBlockWithOverride(db, genesis, nil) -} -func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constantinopleOverride *big.Int) (*params.ChainConfig, common.Hash, error) { if genesis != nil && genesis.Config == nil { return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig } @@ -196,10 +193,6 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constant // Get the existing chain configuration. newcfg := genesis.configOrDefault(stored) - if constantinopleOverride != nil { - newcfg.ConstantinopleBlock = constantinopleOverride - newcfg.PetersburgBlock = constantinopleOverride - } storedcfg := rawdb.ReadChainConfig(db, stored) if storedcfg == nil { log.Warn("Found genesis block without chain config") diff --git a/vendor/github.com/ethereum/go-ethereum/core/state/dump.go b/vendor/github.com/ethereum/go-ethereum/core/state/dump.go new file mode 100644 index 00000000..51d3e555 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/state/dump.go @@ -0,0 +1,153 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package state + +import ( + "encoding/json" + "fmt" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/trie" +) + +// DumpAccount represents an account in the state +type DumpAccount struct { + Balance string `json:"balance"` + Nonce uint64 `json:"nonce"` + Root string `json:"root"` + CodeHash string `json:"codeHash"` + Code string `json:"code,omitempty"` + Storage map[common.Hash]string `json:"storage,omitempty"` + Address *common.Address `json:"address,omitempty"` // Address only present in iterative (line-by-line) mode + SecureKey hexutil.Bytes `json:"key,omitempty"` // If we don't have address, we can output the key + +} + +// Dump represents the full dump in a collected format, as one large map +type Dump struct { + Root string `json:"root"` + Accounts map[common.Address]DumpAccount `json:"accounts"` +} + +// iterativeDump is a 'collector'-implementation which dump output line-by-line iteratively +type iterativeDump json.Encoder + +// Collector interface which the state trie calls during iteration +type collector interface { + onRoot(common.Hash) + onAccount(common.Address, DumpAccount) +} + +func (self *Dump) onRoot(root common.Hash) { + self.Root = fmt.Sprintf("%x", root) +} + +func (self *Dump) onAccount(addr common.Address, account DumpAccount) { + self.Accounts[addr] = account +} + +func (self iterativeDump) onAccount(addr common.Address, account DumpAccount) { + dumpAccount := &DumpAccount{ + Balance: account.Balance, + Nonce: account.Nonce, + Root: account.Root, + CodeHash: account.CodeHash, + Code: account.Code, + Storage: account.Storage, + SecureKey: account.SecureKey, + Address: nil, + } + if addr != (common.Address{}) { + dumpAccount.Address = &addr + } + (*json.Encoder)(&self).Encode(dumpAccount) +} +func (self iterativeDump) onRoot(root common.Hash) { + (*json.Encoder)(&self).Encode(struct { + Root common.Hash `json:"root"` + }{root}) +} + +func (self *StateDB) dump(c collector, excludeCode, excludeStorage, excludeMissingPreimages bool) { + emptyAddress := (common.Address{}) + missingPreimages := 0 + c.onRoot(self.trie.Hash()) + it := trie.NewIterator(self.trie.NodeIterator(nil)) + for it.Next() { + var data Account + if err := rlp.DecodeBytes(it.Value, &data); err != nil { + panic(err) + } + addr := common.BytesToAddress(self.trie.GetKey(it.Key)) + obj := newObject(nil, addr, data) + account := DumpAccount{ + Balance: data.Balance.String(), + Nonce: data.Nonce, + Root: common.Bytes2Hex(data.Root[:]), + CodeHash: common.Bytes2Hex(data.CodeHash), + } + if emptyAddress == addr { + // Preimage missing + missingPreimages++ + if excludeMissingPreimages { + continue + } + account.SecureKey = it.Key + } + if !excludeCode { + account.Code = common.Bytes2Hex(obj.Code(self.db)) + } + if !excludeStorage { + account.Storage = make(map[common.Hash]string) + storageIt := trie.NewIterator(obj.getTrie(self.db).NodeIterator(nil)) + for storageIt.Next() { + account.Storage[common.BytesToHash(self.trie.GetKey(storageIt.Key))] = common.Bytes2Hex(storageIt.Value) + } + } + c.onAccount(addr, account) + } + if missingPreimages > 0 { + log.Warn("Dump incomplete due to missing preimages", "missing", missingPreimages) + } +} + +// RawDump returns the entire state an a single large object +func (self *StateDB) RawDump(excludeCode, excludeStorage, excludeMissingPreimages bool) Dump { + dump := &Dump{ + Accounts: make(map[common.Address]DumpAccount), + } + self.dump(dump, excludeCode, excludeStorage, excludeMissingPreimages) + return *dump +} + +// Dump returns a JSON string representing the entire state as a single json-object +func (self *StateDB) Dump(excludeCode, excludeStorage, excludeMissingPreimages bool) []byte { + dump := self.RawDump(excludeCode, excludeStorage, excludeMissingPreimages) + json, err := json.MarshalIndent(dump, "", " ") + if err != nil { + fmt.Println("dump err", err) + } + return json +} + +// IterativeDump dumps out accounts as json-objects, delimited by linebreaks on stdout +func (self *StateDB) IterativeDump(excludeCode, excludeStorage, excludeMissingPreimages bool, output *json.Encoder) { + self.dump(iterativeDump(*output), excludeCode, excludeStorage, excludeMissingPreimages) +} diff --git a/vendor/github.com/ethereum/go-ethereum/core/tx_noncer.go b/vendor/github.com/ethereum/go-ethereum/core/tx_noncer.go new file mode 100644 index 00000000..aa87c643 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/tx_noncer.go @@ -0,0 +1,79 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package core + +import ( + "sync" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/state" +) + +// txNoncer is a tiny virtual state database to manage the executable nonces of +// accounts in the pool, falling back to reading from a real state database if +// an account is unknown. +type txNoncer struct { + fallback *state.StateDB + nonces map[common.Address]uint64 + lock sync.Mutex +} + +// newTxNoncer creates a new virtual state database to track the pool nonces. +func newTxNoncer(statedb *state.StateDB) *txNoncer { + return &txNoncer{ + fallback: statedb.Copy(), + nonces: make(map[common.Address]uint64), + } +} + +// get returns the current nonce of an account, falling back to a real state +// database if the account is unknown. +func (txn *txNoncer) get(addr common.Address) uint64 { + // We use mutex for get operation is the underlying + // state will mutate db even for read access. + txn.lock.Lock() + defer txn.lock.Unlock() + + if _, ok := txn.nonces[addr]; !ok { + txn.nonces[addr] = txn.fallback.GetNonce(addr) + } + return txn.nonces[addr] +} + +// set inserts a new virtual nonce into the virtual state database to be returned +// whenever the pool requests it instead of reaching into the real state database. +func (txn *txNoncer) set(addr common.Address, nonce uint64) { + txn.lock.Lock() + defer txn.lock.Unlock() + + txn.nonces[addr] = nonce +} + +// setIfLower updates a new virtual nonce into the virtual state database if the +// the new one is lower. +func (txn *txNoncer) setIfLower(addr common.Address, nonce uint64) { + txn.lock.Lock() + defer txn.lock.Unlock() + + if _, ok := txn.nonces[addr]; !ok { + txn.nonces[addr] = txn.fallback.GetNonce(addr) + } + if txn.nonces[addr] <= nonce { + return + } + txn.nonces[addr] = nonce +} diff --git a/vendor/github.com/ethereum/go-ethereum/core/tx_pool.go b/vendor/github.com/ethereum/go-ethereum/core/tx_pool.go index b1682533..c41d3fbd 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/tx_pool.go +++ b/vendor/github.com/ethereum/go-ethereum/core/tx_pool.go @@ -208,20 +208,18 @@ func (config *TxPoolConfig) sanitize() TxPoolConfig { // current state) and future transactions. Transactions move between those // two states over time as they are received and processed. type TxPool struct { - config TxPoolConfig - chainconfig *params.ChainConfig - chain blockChain - gasPrice *big.Int - txFeed event.Feed - scope event.SubscriptionScope - chainHeadCh chan ChainHeadEvent - chainHeadSub event.Subscription - signer types.Signer - mu sync.RWMutex + config TxPoolConfig + chainconfig *params.ChainConfig + chain blockChain + gasPrice *big.Int + txFeed event.Feed + scope event.SubscriptionScope + signer types.Signer + mu sync.RWMutex - currentState *state.StateDB // Current state in the blockchain head - pendingState *state.ManagedState // Pending state tracking virtual nonces - currentMaxGas uint64 // Current gas limit for transaction caps + currentState *state.StateDB // Current state in the blockchain head + pendingNonces *txNoncer // Pending state tracking virtual nonces + currentMaxGas uint64 // Current gas limit for transaction caps locals *accountSet // Set of local transaction to exempt from eviction rules journal *txJournal // Journal of local transaction to back up to disk @@ -232,9 +230,18 @@ type TxPool struct { all *txLookup // All transactions to allow lookups priced *txPricedList // All transactions sorted by price - wg sync.WaitGroup // for shutdown sync + chainHeadCh chan ChainHeadEvent + chainHeadSub event.Subscription + reqResetCh chan *txpoolResetRequest + reqPromoteCh chan *accountSet + queueTxEventCh chan *types.Transaction + reorgDoneCh chan chan struct{} + reorgShutdownCh chan struct{} // requests shutdown of scheduleReorgLoop + wg sync.WaitGroup // tracks loop, scheduleReorgLoop +} - homestead bool +type txpoolResetRequest struct { + oldHead, newHead *types.Header } // NewTxPool creates a new transaction pool to gather, sort and filter inbound @@ -245,16 +252,21 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block // Create the transaction pool with its initial settings pool := &TxPool{ - config: config, - chainconfig: chainconfig, - chain: chain, - signer: types.NewEIP155Signer(chainconfig.ChainID), - pending: make(map[common.Address]*txList), - queue: make(map[common.Address]*txList), - beats: make(map[common.Address]time.Time), - all: newTxLookup(), - chainHeadCh: make(chan ChainHeadEvent, chainHeadChanSize), - gasPrice: new(big.Int).SetUint64(config.PriceLimit), + config: config, + chainconfig: chainconfig, + chain: chain, + signer: types.NewEIP155Signer(chainconfig.ChainID), + pending: make(map[common.Address]*txList), + queue: make(map[common.Address]*txList), + beats: make(map[common.Address]time.Time), + all: newTxLookup(), + chainHeadCh: make(chan ChainHeadEvent, chainHeadChanSize), + reqResetCh: make(chan *txpoolResetRequest), + reqPromoteCh: make(chan *accountSet), + queueTxEventCh: make(chan *types.Transaction), + reorgDoneCh: make(chan chan struct{}), + reorgShutdownCh: make(chan struct{}), + gasPrice: new(big.Int).SetUint64(config.PriceLimit), } pool.locals = newAccountSet(pool.signer) for _, addr := range config.Locals { @@ -264,6 +276,10 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block pool.priced = newTxPricedList(pool.all) pool.reset(nil, chain.CurrentBlock().Header()) + // Start the reorg loop early so it can handle requests generated during journal loading. + pool.wg.Add(1) + go pool.scheduleReorgLoop() + // If local transactions and journaling is enabled, load from disk if !config.NoLocals && config.Journal != "" { pool.journal = newTxJournal(config.Journal) @@ -275,10 +291,9 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block log.Warn("Failed to rotate transaction journal", "err", err) } } - // Subscribe events from blockchain - pool.chainHeadSub = pool.chain.SubscribeChainHeadEvent(pool.chainHeadCh) - // Start the event loop and return + // Subscribe events from blockchain and start the main event loop. + pool.chainHeadSub = pool.chain.SubscribeChainHeadEvent(pool.chainHeadCh) pool.wg.Add(1) go pool.loop() @@ -291,38 +306,31 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block func (pool *TxPool) loop() { defer pool.wg.Done() - // Start the stats reporting and transaction eviction tickers - var prevPending, prevQueued, prevStales int - - report := time.NewTicker(statsReportInterval) + var ( + prevPending, prevQueued, prevStales int + // Start the stats reporting and transaction eviction tickers + report = time.NewTicker(statsReportInterval) + evict = time.NewTicker(evictionInterval) + journal = time.NewTicker(pool.config.Rejournal) + // Track the previous head headers for transaction reorgs + head = pool.chain.CurrentBlock() + ) defer report.Stop() - - evict := time.NewTicker(evictionInterval) defer evict.Stop() - - journal := time.NewTicker(pool.config.Rejournal) defer journal.Stop() - // Track the previous head headers for transaction reorgs - head := pool.chain.CurrentBlock() - - // Keep waiting for and reacting to the various events for { select { // Handle ChainHeadEvent case ev := <-pool.chainHeadCh: if ev.Block != nil { - pool.mu.Lock() - if pool.chainconfig.IsHomestead(ev.Block.Number()) { - pool.homestead = true - } - pool.reset(head.Header(), ev.Block.Header()) + pool.requestReset(head.Header(), ev.Block.Header()) head = ev.Block - - pool.mu.Unlock() } - // Be unsubscribed due to system stopped + + // System shutdown. case <-pool.chainHeadSub.Err(): + close(pool.reorgShutdownCh) return // Handle stats reporting ticks @@ -367,114 +375,6 @@ func (pool *TxPool) loop() { } } -// lockedReset is a wrapper around reset to allow calling it in a thread safe -// manner. This method is only ever used in the tester! -func (pool *TxPool) lockedReset(oldHead, newHead *types.Header) { - pool.mu.Lock() - defer pool.mu.Unlock() - - pool.reset(oldHead, newHead) -} - -// reset retrieves the current state of the blockchain and ensures the content -// of the transaction pool is valid with regard to the chain state. -func (pool *TxPool) reset(oldHead, newHead *types.Header) { - // If we're reorging an old state, reinject all dropped transactions - var reinject types.Transactions - - if oldHead != nil && oldHead.Hash() != newHead.ParentHash { - // If the reorg is too deep, avoid doing it (will happen during fast sync) - oldNum := oldHead.Number.Uint64() - newNum := newHead.Number.Uint64() - - if depth := uint64(math.Abs(float64(oldNum) - float64(newNum))); depth > 64 { - log.Debug("Skipping deep transaction reorg", "depth", depth) - } else { - // Reorg seems shallow enough to pull in all transactions into memory - var discarded, included types.Transactions - var ( - rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64()) - add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64()) - ) - if rem == nil { - // This can happen if a setHead is performed, where we simply discard the old - // head from the chain. - // If that is the case, we don't have the lost transactions any more, and - // there's nothing to add - if newNum < oldNum { - // If the reorg ended up on a lower number, it's indicative of setHead being the cause - log.Debug("Skipping transaction reset caused by setHead", - "old", oldHead.Hash(), "oldnum", oldNum, "new", newHead.Hash(), "newnum", newNum) - } else { - // If we reorged to a same or higher number, then it's not a case of setHead - log.Warn("Transaction pool reset with missing oldhead", - "old", oldHead.Hash(), "oldnum", oldNum, "new", newHead.Hash(), "newnum", newNum) - } - return - } - for rem.NumberU64() > add.NumberU64() { - discarded = append(discarded, rem.Transactions()...) - if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil { - log.Error("Unrooted old chain seen by tx pool", "block", oldHead.Number, "hash", oldHead.Hash()) - return - } - } - for add.NumberU64() > rem.NumberU64() { - included = append(included, add.Transactions()...) - if add = pool.chain.GetBlock(add.ParentHash(), add.NumberU64()-1); add == nil { - log.Error("Unrooted new chain seen by tx pool", "block", newHead.Number, "hash", newHead.Hash()) - return - } - } - for rem.Hash() != add.Hash() { - discarded = append(discarded, rem.Transactions()...) - if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil { - log.Error("Unrooted old chain seen by tx pool", "block", oldHead.Number, "hash", oldHead.Hash()) - return - } - included = append(included, add.Transactions()...) - if add = pool.chain.GetBlock(add.ParentHash(), add.NumberU64()-1); add == nil { - log.Error("Unrooted new chain seen by tx pool", "block", newHead.Number, "hash", newHead.Hash()) - return - } - } - reinject = types.TxDifference(discarded, included) - } - } - // Initialize the internal state to the current head - if newHead == nil { - newHead = pool.chain.CurrentBlock().Header() // Special case during testing - } - statedb, err := pool.chain.StateAt(newHead.Root) - if err != nil { - log.Error("Failed to reset txpool state", "err", err) - return - } - pool.currentState = statedb - pool.pendingState = state.ManageState(statedb) - pool.currentMaxGas = newHead.GasLimit - - // Inject any transactions discarded due to reorgs - log.Debug("Reinjecting stale transactions", "count", len(reinject)) - senderCacher.recover(pool.signer, reinject) - pool.addTxsLocked(reinject, false) - - // validate the pool of pending transactions, this will remove - // any transactions that have been included in the block or - // have been invalidated because of another transaction (e.g. - // higher gas price) - pool.demoteUnexecutables() - - // Update all accounts to the latest known pending nonce - for addr, list := range pool.pending { - txs := list.Flatten() // Heavy but will be cached and is needed by the miner anyway - pool.pendingState.SetNonce(addr, txs[len(txs)-1].Nonce()+1) - } - // Check the queue and move transactions over to the pending if possible - // or remove those that have become invalid - pool.promoteExecutables(nil) -} - // Stop terminates the transaction pool. func (pool *TxPool) Stop() { // Unsubscribe all subscriptions registered from txpool @@ -517,12 +417,13 @@ func (pool *TxPool) SetGasPrice(price *big.Int) { log.Info("Transaction pool price threshold updated", "price", price) } -// State returns the virtual managed state of the transaction pool. -func (pool *TxPool) State() *state.ManagedState { +// Nonce returns the next nonce of an account, with all transactions executable +// by the pool already applied on top. +func (pool *TxPool) Nonce(addr common.Address) uint64 { pool.mu.RLock() defer pool.mu.RUnlock() - return pool.pendingState + return pool.pendingNonces.get(addr) } // Stats retrieves the current pool stats, namely the number of pending and the @@ -638,7 +539,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 { return ErrInsufficientFunds } - intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) + // Ensure the transaction has more gas than the basic tx fee. + intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, true) if err != nil { return err } @@ -648,27 +550,28 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { return nil } -// add validates a transaction and inserts it into the non-executable queue for -// later pending promotion and execution. If the transaction is a replacement for -// an already pending or queued one, it overwrites the previous and returns this -// so outer code doesn't uselessly call promote. +// add validates a transaction and inserts it into the non-executable queue for later +// pending promotion and execution. If the transaction is a replacement for an already +// pending or queued one, it overwrites the previous transaction if its price is higher. // // If a newly added transaction is marked as local, its sending account will be -// whitelisted, preventing any associated transaction from being dropped out of -// the pool due to pricing constraints. -func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { +// whitelisted, preventing any associated transaction from being dropped out of the pool +// due to pricing constraints. +func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err error) { // If the transaction is already known, discard it hash := tx.Hash() if pool.all.Get(hash) != nil { log.Trace("Discarding already known transaction", "hash", hash) return false, fmt.Errorf("known transaction: %x", hash) } + // If the transaction fails basic validation, discard it if err := pool.validateTx(tx, local); err != nil { log.Trace("Discarding invalid transaction", "hash", hash, "err", err) invalidTxMeter.Mark(1) return false, err } + // If the transaction pool is full, discard underpriced transactions if uint64(pool.all.Count()) >= pool.config.GlobalSlots+pool.config.GlobalQueue { // If the new transaction is underpriced, don't accept it @@ -685,7 +588,8 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { pool.removeTx(tx.Hash(), false) } } - // If the transaction is replacing an already pending one, do directly + + // Try to replace an existing transaction in the pending pool from, _ := types.Sender(pool.signer, tx) // already validated if list := pool.pending[from]; list != nil && list.Overlaps(tx) { // Nonce already pending, check if required price bump is met @@ -703,19 +607,17 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { pool.all.Add(tx) pool.priced.Put(tx) pool.journalTx(from, tx) - + pool.queueTxEvent(tx) log.Trace("Pooled new executable transaction", "hash", hash, "from", from, "to", tx.To()) - - // We've directly injected a replacement transaction, notify subsystems - go pool.txFeed.Send(NewTxsEvent{types.Transactions{tx}}) - return old != nil, nil } + // New transaction isn't replacing a pending one, push into queue - replace, err := pool.enqueueTx(hash, tx) + replaced, err = pool.enqueueTx(hash, tx) if err != nil { return false, err } + // Mark local addresses and journal local transactions if local { if !pool.locals.contains(from) { @@ -729,7 +631,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) { pool.journalTx(from, tx) log.Trace("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To()) - return replace, nil + return replaced, nil } // enqueueTx inserts a new transaction into the non-executable transaction queue. @@ -812,101 +714,90 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T } // Set the potentially new pending nonce and notify any subsystems of the new tx pool.beats[addr] = time.Now() - pool.pendingState.SetNonce(addr, tx.Nonce()+1) + pool.pendingNonces.set(addr, tx.Nonce()+1) return true } -// AddLocal enqueues a single transaction into the pool if it is valid, marking -// the sender as a local one in the mean time, ensuring it goes around the local -// pricing constraints. -func (pool *TxPool) AddLocal(tx *types.Transaction) error { - return pool.addTx(tx, !pool.config.NoLocals) -} - -// AddRemote enqueues a single transaction into the pool if it is valid. If the -// sender is not among the locally tracked ones, full pricing constraints will -// apply. -func (pool *TxPool) AddRemote(tx *types.Transaction) error { - return pool.addTx(tx, false) -} - -// AddLocals enqueues a batch of transactions into the pool if they are valid, -// marking the senders as a local ones in the mean time, ensuring they go around -// the local pricing constraints. +// AddLocals enqueues a batch of transactions into the pool if they are valid, marking the +// senders as a local ones, ensuring they go around the local pricing constraints. +// +// This method is used to add transactions from the RPC API and performs synchronous pool +// reorganization and event propagation. func (pool *TxPool) AddLocals(txs []*types.Transaction) []error { - return pool.addTxs(txs, !pool.config.NoLocals) + return pool.addTxs(txs, !pool.config.NoLocals, true) } -// AddRemotes enqueues a batch of transactions into the pool if they are valid. -// If the senders are not among the locally tracked ones, full pricing constraints -// will apply. +// AddLocal enqueues a single local transaction into the pool if it is valid. This is +// a convenience wrapper aroundd AddLocals. +func (pool *TxPool) AddLocal(tx *types.Transaction) error { + errs := pool.AddLocals([]*types.Transaction{tx}) + return errs[0] +} + +// AddRemotes enqueues a batch of transactions into the pool if they are valid. If the +// senders are not among the locally tracked ones, full pricing constraints will apply. +// +// This method is used to add transactions from the p2p network and does not wait for pool +// reorganization and internal event propagation. func (pool *TxPool) AddRemotes(txs []*types.Transaction) []error { - return pool.addTxs(txs, false) + return pool.addTxs(txs, false, false) } -// addTx enqueues a single transaction into the pool if it is valid. -func (pool *TxPool) addTx(tx *types.Transaction, local bool) error { - // Cache sender in transaction before obtaining lock (pool.signer is immutable) - types.Sender(pool.signer, tx) +// This is like AddRemotes, but waits for pool reorganization. Tests use this method. +func (pool *TxPool) addRemotesSync(txs []*types.Transaction) []error { + return pool.addTxs(txs, false, true) +} - pool.mu.Lock() - defer pool.mu.Unlock() +// This is like AddRemotes with a single transaction, but waits for pool reorganization. Tests use this method. +func (pool *TxPool) addRemoteSync(tx *types.Transaction) error { + errs := pool.addRemotesSync([]*types.Transaction{tx}) + return errs[0] +} - // Try to inject the transaction and update any state - replace, err := pool.add(tx, local) - if err != nil { - return err - } - validMeter.Mark(1) - - // If we added a new transaction, run promotion checks and return - if !replace { - from, _ := types.Sender(pool.signer, tx) // already validated - pool.promoteExecutables([]common.Address{from}) - } - return nil +// AddRemote enqueues a single transaction into the pool if it is valid. This is a convenience +// wrapper around AddRemotes. +// +// Deprecated: use AddRemotes +func (pool *TxPool) AddRemote(tx *types.Transaction) error { + errs := pool.AddRemotes([]*types.Transaction{tx}) + return errs[0] } // addTxs attempts to queue a batch of transactions if they are valid. -func (pool *TxPool) addTxs(txs []*types.Transaction, local bool) []error { +func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error { // Cache senders in transactions before obtaining lock (pool.signer is immutable) for _, tx := range txs { types.Sender(pool.signer, tx) } + pool.mu.Lock() - defer pool.mu.Unlock() + errs, dirtyAddrs := pool.addTxsLocked(txs, local) + pool.mu.Unlock() - return pool.addTxsLocked(txs, local) -} - -// addTxsLocked attempts to queue a batch of transactions if they are valid, -// whilst assuming the transaction pool lock is already held. -func (pool *TxPool) addTxsLocked(txs []*types.Transaction, local bool) []error { - // Add the batch of transactions, tracking the accepted ones - dirty := make(map[common.Address]struct{}) - errs := make([]error, len(txs)) - - for i, tx := range txs { - var replace bool - if replace, errs[i] = pool.add(tx, local); errs[i] == nil && !replace { - from, _ := types.Sender(pool.signer, tx) // already validated - dirty[from] = struct{}{} - } - } - validMeter.Mark(int64(len(dirty))) - - // Only reprocess the internal state if something was actually added - if len(dirty) > 0 { - addrs := make([]common.Address, 0, len(dirty)) - for addr := range dirty { - addrs = append(addrs, addr) - } - pool.promoteExecutables(addrs) + done := pool.requestPromoteExecutables(dirtyAddrs) + if sync { + <-done } return errs } +// addTxsLocked attempts to queue a batch of transactions if they are valid. +// The transaction pool lock must be held. +func (pool *TxPool) addTxsLocked(txs []*types.Transaction, local bool) ([]error, *accountSet) { + dirty := newAccountSet(pool.signer) + errs := make([]error, len(txs)) + for i, tx := range txs { + replaced, err := pool.add(tx, local) + errs[i] = err + if err == nil && !replaced { + dirty.addTx(tx) + } + } + validMeter.Mark(int64(len(dirty.accounts))) + return errs, dirty +} + // Status returns the status (unknown/pending/queued) of a batch of transactions // identified by their hashes. func (pool *TxPool) Status(hashes []common.Hash) []TxStatus { @@ -927,8 +818,7 @@ func (pool *TxPool) Status(hashes []common.Hash) []TxStatus { return status } -// Get returns a transaction if it is contained in the pool -// and nil otherwise. +// Get returns a transaction if it is contained in the pool and nil otherwise. func (pool *TxPool) Get(hash common.Hash) *types.Transaction { return pool.all.Get(hash) } @@ -964,9 +854,7 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) { pool.enqueueTx(tx.Hash(), tx) } // Update the account nonce if needed - if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce { - pool.pendingState.SetNonce(addr, nonce) - } + pool.pendingNonces.setIfLower(addr, tx.Nonce()) // Reduce the pending counter pendingCounter.Dec(int64(1 + len(invalids))) return @@ -984,20 +872,261 @@ func (pool *TxPool) removeTx(hash common.Hash, outofbound bool) { } } +// requestPromoteExecutables requests a pool reset to the new head block. +// The returned channel is closed when the reset has occurred. +func (pool *TxPool) requestReset(oldHead *types.Header, newHead *types.Header) chan struct{} { + select { + case pool.reqResetCh <- &txpoolResetRequest{oldHead, newHead}: + return <-pool.reorgDoneCh + case <-pool.reorgShutdownCh: + return pool.reorgShutdownCh + } +} + +// requestPromoteExecutables requests transaction promotion checks for the given addresses. +// The returned channel is closed when the promotion checks have occurred. +func (pool *TxPool) requestPromoteExecutables(set *accountSet) chan struct{} { + select { + case pool.reqPromoteCh <- set: + return <-pool.reorgDoneCh + case <-pool.reorgShutdownCh: + return pool.reorgShutdownCh + } +} + +// queueTxEvent enqueues a transaction event to be sent in the next reorg run. +func (pool *TxPool) queueTxEvent(tx *types.Transaction) { + select { + case pool.queueTxEventCh <- tx: + case <-pool.reorgShutdownCh: + } +} + +// scheduleReorgLoop schedules runs of reset and promoteExecutables. Code above should not +// call those methods directly, but request them being run using requestReset and +// requestPromoteExecutables instead. +func (pool *TxPool) scheduleReorgLoop() { + defer pool.wg.Done() + + var ( + curDone chan struct{} // non-nil while runReorg is active + nextDone = make(chan struct{}) + launchNextRun bool + reset *txpoolResetRequest + dirtyAccounts *accountSet + queuedEvents = make(map[common.Address]*txSortedMap) + ) + for { + // Launch next background reorg if needed + if curDone == nil && launchNextRun { + // Run the background reorg and announcements + go pool.runReorg(nextDone, reset, dirtyAccounts, queuedEvents) + + // Prepare everything for the next round of reorg + curDone, nextDone = nextDone, make(chan struct{}) + launchNextRun = false + + reset, dirtyAccounts = nil, nil + queuedEvents = make(map[common.Address]*txSortedMap) + } + + select { + case req := <-pool.reqResetCh: + // Reset request: update head if request is already pending. + if reset == nil { + reset = req + } else { + reset.newHead = req.newHead + } + launchNextRun = true + pool.reorgDoneCh <- nextDone + + case req := <-pool.reqPromoteCh: + // Promote request: update address set if request is already pending. + if dirtyAccounts == nil { + dirtyAccounts = req + } else { + dirtyAccounts.merge(req) + } + launchNextRun = true + pool.reorgDoneCh <- nextDone + + case tx := <-pool.queueTxEventCh: + // Queue up the event, but don't schedule a reorg. It's up to the caller to + // request one later if they want the events sent. + addr, _ := types.Sender(pool.signer, tx) + if _, ok := queuedEvents[addr]; !ok { + queuedEvents[addr] = newTxSortedMap() + } + queuedEvents[addr].Put(tx) + + case <-curDone: + curDone = nil + + case <-pool.reorgShutdownCh: + // Wait for current run to finish. + if curDone != nil { + <-curDone + } + close(nextDone) + return + } + } +} + +// runReorg runs reset and promoteExecutables on behalf of scheduleReorgLoop. +func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirtyAccounts *accountSet, events map[common.Address]*txSortedMap) { + defer close(done) + + var promoteAddrs []common.Address + if dirtyAccounts != nil { + promoteAddrs = dirtyAccounts.flatten() + } + pool.mu.Lock() + if reset != nil { + // Reset from the old head to the new, rescheduling any reorged transactions + pool.reset(reset.oldHead, reset.newHead) + + // Nonces were reset, discard any events that became stale + for addr := range events { + events[addr].Forward(pool.pendingNonces.get(addr)) + if events[addr].Len() == 0 { + delete(events, addr) + } + } + // Reset needs promote for all addresses + promoteAddrs = promoteAddrs[:0] + for addr := range pool.queue { + promoteAddrs = append(promoteAddrs, addr) + } + } + // Check for pending transactions for every account that sent new ones + promoted := pool.promoteExecutables(promoteAddrs) + for _, tx := range promoted { + addr, _ := types.Sender(pool.signer, tx) + if _, ok := events[addr]; !ok { + events[addr] = newTxSortedMap() + } + events[addr].Put(tx) + } + // If a new block appeared, validate the pool of pending transactions. This will + // remove any transaction that has been included in the block or was invalidated + // because of another transaction (e.g. higher gas price). + if reset != nil { + pool.demoteUnexecutables() + } + // Ensure pool.queue and pool.pending sizes stay within the configured limits. + pool.truncatePending() + pool.truncateQueue() + + // Update all accounts to the latest known pending nonce + for addr, list := range pool.pending { + txs := list.Flatten() // Heavy but will be cached and is needed by the miner anyway + pool.pendingNonces.set(addr, txs[len(txs)-1].Nonce()+1) + } + pool.mu.Unlock() + + // Notify subsystems for newly added transactions + if len(events) > 0 { + var txs []*types.Transaction + for _, set := range events { + txs = append(txs, set.Flatten()...) + } + pool.txFeed.Send(NewTxsEvent{txs}) + } +} + +// reset retrieves the current state of the blockchain and ensures the content +// of the transaction pool is valid with regard to the chain state. +func (pool *TxPool) reset(oldHead, newHead *types.Header) { + // If we're reorging an old state, reinject all dropped transactions + var reinject types.Transactions + + if oldHead != nil && oldHead.Hash() != newHead.ParentHash { + // If the reorg is too deep, avoid doing it (will happen during fast sync) + oldNum := oldHead.Number.Uint64() + newNum := newHead.Number.Uint64() + + if depth := uint64(math.Abs(float64(oldNum) - float64(newNum))); depth > 64 { + log.Debug("Skipping deep transaction reorg", "depth", depth) + } else { + // Reorg seems shallow enough to pull in all transactions into memory + var discarded, included types.Transactions + var ( + rem = pool.chain.GetBlock(oldHead.Hash(), oldHead.Number.Uint64()) + add = pool.chain.GetBlock(newHead.Hash(), newHead.Number.Uint64()) + ) + if rem == nil { + // This can happen if a setHead is performed, where we simply discard the old + // head from the chain. + // If that is the case, we don't have the lost transactions any more, and + // there's nothing to add + if newNum < oldNum { + // If the reorg ended up on a lower number, it's indicative of setHead being the cause + log.Debug("Skipping transaction reset caused by setHead", + "old", oldHead.Hash(), "oldnum", oldNum, "new", newHead.Hash(), "newnum", newNum) + } else { + // If we reorged to a same or higher number, then it's not a case of setHead + log.Warn("Transaction pool reset with missing oldhead", + "old", oldHead.Hash(), "oldnum", oldNum, "new", newHead.Hash(), "newnum", newNum) + } + return + } + for rem.NumberU64() > add.NumberU64() { + discarded = append(discarded, rem.Transactions()...) + if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil { + log.Error("Unrooted old chain seen by tx pool", "block", oldHead.Number, "hash", oldHead.Hash()) + return + } + } + for add.NumberU64() > rem.NumberU64() { + included = append(included, add.Transactions()...) + if add = pool.chain.GetBlock(add.ParentHash(), add.NumberU64()-1); add == nil { + log.Error("Unrooted new chain seen by tx pool", "block", newHead.Number, "hash", newHead.Hash()) + return + } + } + for rem.Hash() != add.Hash() { + discarded = append(discarded, rem.Transactions()...) + if rem = pool.chain.GetBlock(rem.ParentHash(), rem.NumberU64()-1); rem == nil { + log.Error("Unrooted old chain seen by tx pool", "block", oldHead.Number, "hash", oldHead.Hash()) + return + } + included = append(included, add.Transactions()...) + if add = pool.chain.GetBlock(add.ParentHash(), add.NumberU64()-1); add == nil { + log.Error("Unrooted new chain seen by tx pool", "block", newHead.Number, "hash", newHead.Hash()) + return + } + } + reinject = types.TxDifference(discarded, included) + } + } + // Initialize the internal state to the current head + if newHead == nil { + newHead = pool.chain.CurrentBlock().Header() // Special case during testing + } + statedb, err := pool.chain.StateAt(newHead.Root) + if err != nil { + log.Error("Failed to reset txpool state", "err", err) + return + } + pool.currentState = statedb + pool.pendingNonces = newTxNoncer(statedb) + pool.currentMaxGas = newHead.GasLimit + + // Inject any transactions discarded due to reorgs + log.Debug("Reinjecting stale transactions", "count", len(reinject)) + senderCacher.recover(pool.signer, reinject) + pool.addTxsLocked(reinject, false) +} + // promoteExecutables moves transactions that have become processable from the // future queue to the set of pending transactions. During this process, all // invalidated transactions (low nonce, low balance) are deleted. -func (pool *TxPool) promoteExecutables(accounts []common.Address) { +func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Transaction { // Track the promoted transactions to broadcast them at once var promoted []*types.Transaction - // Gather all the accounts potentially needing updates - if accounts == nil { - accounts = make([]common.Address, 0, len(pool.queue)) - for addr := range pool.queue { - accounts = append(accounts, addr) - } - } // Iterate over all accounts and promote any executable transactions for _, addr := range accounts { list := pool.queue[addr] @@ -1021,7 +1150,7 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) { queuedNofundsMeter.Mark(int64(len(drops))) // Gather all executable transactions and promote them - readies := list.Ready(pool.pendingState.GetNonce(addr)) + readies := list.Ready(pool.pendingNonces.get(addr)) for _, tx := range readies { hash := tx.Hash() if pool.promoteTx(addr, hash, tx) { @@ -1053,69 +1182,46 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) { delete(pool.queue, addr) } } - // Notify subsystem for new promoted transactions. - if len(promoted) > 0 { - go pool.txFeed.Send(NewTxsEvent{promoted}) - } - // If the pending limit is overflown, start equalizing allowances + return promoted +} + +// truncatePending removes transactions from the pending queue if the pool is above the +// pending limit. The algorithm tries to reduce transaction counts by an approximately +// equal number for all for accounts with many pending transactions. +func (pool *TxPool) truncatePending() { pending := uint64(0) for _, list := range pool.pending { pending += uint64(list.Len()) } - if pending > pool.config.GlobalSlots { - pendingBeforeCap := pending - // Assemble a spam order to penalize large transactors first - spammers := prque.New(nil) - for addr, list := range pool.pending { - // Only evict transactions from high rollers - if !pool.locals.contains(addr) && uint64(list.Len()) > pool.config.AccountSlots { - spammers.Push(addr, int64(list.Len())) - } + if pending <= pool.config.GlobalSlots { + return + } + + pendingBeforeCap := pending + // Assemble a spam order to penalize large transactors first + spammers := prque.New(nil) + for addr, list := range pool.pending { + // Only evict transactions from high rollers + if !pool.locals.contains(addr) && uint64(list.Len()) > pool.config.AccountSlots { + spammers.Push(addr, int64(list.Len())) } - // Gradually drop transactions from offenders - offenders := []common.Address{} - for pending > pool.config.GlobalSlots && !spammers.Empty() { - // Retrieve the next offender if not local address - offender, _ := spammers.Pop() - offenders = append(offenders, offender.(common.Address)) + } + // Gradually drop transactions from offenders + offenders := []common.Address{} + for pending > pool.config.GlobalSlots && !spammers.Empty() { + // Retrieve the next offender if not local address + offender, _ := spammers.Pop() + offenders = append(offenders, offender.(common.Address)) - // Equalize balances until all the same or below threshold - if len(offenders) > 1 { - // Calculate the equalization threshold for all current offenders - threshold := pool.pending[offender.(common.Address)].Len() + // Equalize balances until all the same or below threshold + if len(offenders) > 1 { + // Calculate the equalization threshold for all current offenders + threshold := pool.pending[offender.(common.Address)].Len() - // Iteratively reduce all offenders until below limit or threshold reached - for pending > pool.config.GlobalSlots && pool.pending[offenders[len(offenders)-2]].Len() > threshold { - for i := 0; i < len(offenders)-1; i++ { - list := pool.pending[offenders[i]] - - caps := list.Cap(list.Len() - 1) - for _, tx := range caps { - // Drop the transaction from the global pools too - hash := tx.Hash() - pool.all.Remove(hash) - - // Update the account nonce to the dropped transaction - if nonce := tx.Nonce(); pool.pendingState.GetNonce(offenders[i]) > nonce { - pool.pendingState.SetNonce(offenders[i], nonce) - } - log.Trace("Removed fairness-exceeding pending transaction", "hash", hash) - } - pool.priced.Removed(len(caps)) - pendingCounter.Dec(int64(len(caps))) - if pool.locals.contains(offenders[i]) { - localCounter.Dec(int64(len(caps))) - } - pending-- - } - } - } - } - // If still above threshold, reduce to limit or min allowance - if pending > pool.config.GlobalSlots && len(offenders) > 0 { - for pending > pool.config.GlobalSlots && uint64(pool.pending[offenders[len(offenders)-1]].Len()) > pool.config.AccountSlots { - for _, addr := range offenders { - list := pool.pending[addr] + // Iteratively reduce all offenders until below limit or threshold reached + for pending > pool.config.GlobalSlots && pool.pending[offenders[len(offenders)-2]].Len() > threshold { + for i := 0; i < len(offenders)-1; i++ { + list := pool.pending[offenders[i]] caps := list.Cap(list.Len() - 1) for _, tx := range caps { @@ -1124,60 +1230,89 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) { pool.all.Remove(hash) // Update the account nonce to the dropped transaction - if nonce := tx.Nonce(); pool.pendingState.GetNonce(addr) > nonce { - pool.pendingState.SetNonce(addr, nonce) - } + pool.pendingNonces.setIfLower(offenders[i], tx.Nonce()) log.Trace("Removed fairness-exceeding pending transaction", "hash", hash) } pool.priced.Removed(len(caps)) pendingCounter.Dec(int64(len(caps))) - if pool.locals.contains(addr) { + if pool.locals.contains(offenders[i]) { localCounter.Dec(int64(len(caps))) } pending-- } } } - pendingRateLimitMeter.Mark(int64(pendingBeforeCap - pending)) } - // If we've queued more transactions than the hard limit, drop oldest ones + + // If still above threshold, reduce to limit or min allowance + if pending > pool.config.GlobalSlots && len(offenders) > 0 { + for pending > pool.config.GlobalSlots && uint64(pool.pending[offenders[len(offenders)-1]].Len()) > pool.config.AccountSlots { + for _, addr := range offenders { + list := pool.pending[addr] + + caps := list.Cap(list.Len() - 1) + for _, tx := range caps { + // Drop the transaction from the global pools too + hash := tx.Hash() + pool.all.Remove(hash) + + // Update the account nonce to the dropped transaction + pool.pendingNonces.setIfLower(addr, tx.Nonce()) + log.Trace("Removed fairness-exceeding pending transaction", "hash", hash) + } + pool.priced.Removed(len(caps)) + pendingCounter.Dec(int64(len(caps))) + if pool.locals.contains(addr) { + localCounter.Dec(int64(len(caps))) + } + pending-- + } + } + } + pendingRateLimitMeter.Mark(int64(pendingBeforeCap - pending)) +} + +// truncateQueue drops the oldes transactions in the queue if the pool is above the global queue limit. +func (pool *TxPool) truncateQueue() { queued := uint64(0) for _, list := range pool.queue { queued += uint64(list.Len()) } - if queued > pool.config.GlobalQueue { - // Sort all accounts with queued transactions by heartbeat - addresses := make(addressesByHeartbeat, 0, len(pool.queue)) - for addr := range pool.queue { - if !pool.locals.contains(addr) { // don't drop locals - addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]}) - } + if queued <= pool.config.GlobalQueue { + return + } + + // Sort all accounts with queued transactions by heartbeat + addresses := make(addressesByHeartbeat, 0, len(pool.queue)) + for addr := range pool.queue { + if !pool.locals.contains(addr) { // don't drop locals + addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]}) } - sort.Sort(addresses) + } + sort.Sort(addresses) - // Drop transactions until the total is below the limit or only locals remain - for drop := queued - pool.config.GlobalQueue; drop > 0 && len(addresses) > 0; { - addr := addresses[len(addresses)-1] - list := pool.queue[addr.address] + // Drop transactions until the total is below the limit or only locals remain + for drop := queued - pool.config.GlobalQueue; drop > 0 && len(addresses) > 0; { + addr := addresses[len(addresses)-1] + list := pool.queue[addr.address] - addresses = addresses[:len(addresses)-1] + addresses = addresses[:len(addresses)-1] - // Drop all transactions if they are less than the overflow - if size := uint64(list.Len()); size <= drop { - for _, tx := range list.Flatten() { - pool.removeTx(tx.Hash(), true) - } - drop -= size - queuedRateLimitMeter.Mark(int64(size)) - continue - } - // Otherwise drop only last few transactions - txs := list.Flatten() - for i := len(txs) - 1; i >= 0 && drop > 0; i-- { - pool.removeTx(txs[i].Hash(), true) - drop-- - queuedRateLimitMeter.Mark(1) + // Drop all transactions if they are less than the overflow + if size := uint64(list.Len()); size <= drop { + for _, tx := range list.Flatten() { + pool.removeTx(tx.Hash(), true) } + drop -= size + queuedRateLimitMeter.Mark(int64(size)) + continue + } + // Otherwise drop only last few transactions + txs := list.Flatten() + for i := len(txs) - 1; i >= 0 && drop > 0; i-- { + pool.removeTx(txs[i].Hash(), true) + drop-- + queuedRateLimitMeter.Mark(1) } } } @@ -1224,7 +1359,7 @@ func (pool *TxPool) demoteUnexecutables() { log.Error("Demoting invalidated transaction", "hash", hash) pool.enqueueTx(hash, tx) } - pendingCounter.Inc(int64(len(gapped))) + pendingCounter.Dec(int64(len(gapped))) } // Delete the entire queue entry if it became empty. if list.Empty() { @@ -1256,11 +1391,15 @@ type accountSet struct { // newAccountSet creates a new address set with an associated signer for sender // derivations. -func newAccountSet(signer types.Signer) *accountSet { - return &accountSet{ +func newAccountSet(signer types.Signer, addrs ...common.Address) *accountSet { + as := &accountSet{ accounts: make(map[common.Address]struct{}), signer: signer, } + for _, addr := range addrs { + as.add(addr) + } + return as } // contains checks if a given address is contained within the set. @@ -1284,6 +1423,13 @@ func (as *accountSet) add(addr common.Address) { as.cache = nil } +// addTx adds the sender of tx into the set. +func (as *accountSet) addTx(tx *types.Transaction) { + if addr, err := types.Sender(as.signer, tx); err == nil { + as.add(addr) + } +} + // flatten returns the list of addresses within this set, also caching it for later // reuse. The returned slice should not be changed! func (as *accountSet) flatten() []common.Address { @@ -1297,6 +1443,14 @@ func (as *accountSet) flatten() []common.Address { return *as.cache } +// merge adds all addresses from the 'other' set into 'as'. +func (as *accountSet) merge(other *accountSet) { + for addr := range other.accounts { + as.accounts[addr] = struct{}{} + } + as.cache = nil +} + // txLookup is used internally by TxPool to track transactions while allowing lookup without // mutex contention. // diff --git a/vendor/github.com/ethereum/go-ethereum/core/types/block.go b/vendor/github.com/ethereum/go-ethereum/core/types/block.go index f754c3c4..b0ec7fc7 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/types/block.go +++ b/vendor/github.com/ethereum/go-ethereum/core/types/block.go @@ -19,6 +19,7 @@ package types import ( "encoding/binary" + "fmt" "io" "math/big" "reflect" @@ -110,6 +111,25 @@ func (h *Header) Size() common.StorageSize { return headerSize + common.StorageSize(len(h.Extra)+(h.Difficulty.BitLen()+h.Number.BitLen())/8) } +// SanityCheck checks a few basic things -- these checks are way beyond what +// any 'sane' production values should hold, and can mainly be used to prevent +// that the unbounded fields are stuffed with junk data to add processing +// overhead +func (h *Header) SanityCheck() error { + if h.Number != nil && !h.Number.IsUint64() { + return fmt.Errorf("too large block number: bitlen %d", h.Number.BitLen()) + } + if h.Difficulty != nil { + if diffLen := h.Difficulty.BitLen(); diffLen > 80 { + return fmt.Errorf("too large block difficulty: bitlen %d", diffLen) + } + } + if eLen := len(h.Extra); eLen > 100*1024 { + return fmt.Errorf("too large block extradata: size %d", eLen) + } + return nil +} + func rlpHash(x interface{}) (h common.Hash) { hw := sha3.NewLegacyKeccak256() rlp.Encode(hw, x) @@ -316,6 +336,12 @@ func (b *Block) Size() common.StorageSize { return common.StorageSize(c) } +// SanityCheck can be used to prevent that unbounded fields are +// stuffed with junk data to add processing overhead +func (b *Block) SanityCheck() error { + return b.header.SanityCheck() +} + type writeCounter common.StorageSize func (c *writeCounter) Write(b []byte) (int, error) { diff --git a/vendor/github.com/ethereum/go-ethereum/core/vm/evm.go b/vendor/github.com/ethereum/go-ethereum/core/vm/evm.go new file mode 100644 index 00000000..d47b0093 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/vm/evm.go @@ -0,0 +1,470 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package vm + +import ( + "math/big" + "sync/atomic" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" +) + +// emptyCodeHash is used by create to ensure deployment is disallowed to already +// deployed contract addresses (relevant after the account abstraction). +var emptyCodeHash = crypto.Keccak256Hash(nil) + +type ( + // CanTransferFunc is the signature of a transfer guard function + CanTransferFunc func(StateDB, common.Address, *big.Int) bool + // TransferFunc is the signature of a transfer function + TransferFunc func(StateDB, common.Address, common.Address, *big.Int) + // GetHashFunc returns the nth block hash in the blockchain + // and is used by the BLOCKHASH EVM op code. + GetHashFunc func(uint64) common.Hash +) + +// run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter. +func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) { + if contract.CodeAddr != nil { + precompiles := PrecompiledContractsHomestead + if evm.ChainConfig().IsByzantium(evm.BlockNumber) { + precompiles = PrecompiledContractsByzantium + } + if p := precompiles[*contract.CodeAddr]; p != nil { + return RunPrecompiledContract(p, input, contract) + } + } + for _, interpreter := range evm.interpreters { + if interpreter.CanRun(contract.Code) { + if evm.interpreter != interpreter { + // Ensure that the interpreter pointer is set back + // to its current value upon return. + defer func(i Interpreter) { + evm.interpreter = i + }(evm.interpreter) + evm.interpreter = interpreter + } + return interpreter.Run(contract, input, readOnly) + } + } + return nil, ErrNoCompatibleInterpreter +} + +// Context provides the EVM with auxiliary information. Once provided +// it shouldn't be modified. +type Context struct { + // CanTransfer returns whether the account contains + // sufficient ether to transfer the value + CanTransfer CanTransferFunc + // Transfer transfers ether from one account to the other + Transfer TransferFunc + // GetHash returns the hash corresponding to n + GetHash GetHashFunc + + // Message information + Origin common.Address // Provides information for ORIGIN + GasPrice *big.Int // Provides information for GASPRICE + + // Block information + Coinbase common.Address // Provides information for COINBASE + GasLimit uint64 // Provides information for GASLIMIT + BlockNumber *big.Int // Provides information for NUMBER + Time *big.Int // Provides information for TIME + Difficulty *big.Int // Provides information for DIFFICULTY +} + +// EVM is the Ethereum Virtual Machine base object and provides +// the necessary tools to run a contract on the given state with +// the provided context. It should be noted that any error +// generated through any of the calls should be considered a +// revert-state-and-consume-all-gas operation, no checks on +// specific errors should ever be performed. The interpreter makes +// sure that any errors generated are to be considered faulty code. +// +// The EVM should never be reused and is not thread safe. +type EVM struct { + // Context provides auxiliary blockchain related information + Context + // StateDB gives access to the underlying state + StateDB StateDB + // Depth is the current call stack + depth int + + // chainConfig contains information about the current chain + chainConfig *params.ChainConfig + // chain rules contains the chain rules for the current epoch + chainRules params.Rules + // virtual machine configuration options used to initialise the + // evm. + vmConfig Config + // global (to this context) ethereum virtual machine + // used throughout the execution of the tx. + interpreters []Interpreter + interpreter Interpreter + // abort is used to abort the EVM calling operations + // NOTE: must be set atomically + abort int32 + // callGasTemp holds the gas available for the current call. This is needed because the + // available gas is calculated in gasCall* according to the 63/64 rule and later + // applied in opCall*. + callGasTemp uint64 +} + +// NewEVM returns a new EVM. The returned EVM is not thread safe and should +// only ever be used *once*. +func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmConfig Config) *EVM { + evm := &EVM{ + Context: ctx, + StateDB: statedb, + vmConfig: vmConfig, + chainConfig: chainConfig, + chainRules: chainConfig.Rules(ctx.BlockNumber), + interpreters: make([]Interpreter, 0, 1), + } + + if chainConfig.IsEWASM(ctx.BlockNumber) { + // to be implemented by EVM-C and Wagon PRs. + // if vmConfig.EWASMInterpreter != "" { + // extIntOpts := strings.Split(vmConfig.EWASMInterpreter, ":") + // path := extIntOpts[0] + // options := []string{} + // if len(extIntOpts) > 1 { + // options = extIntOpts[1..] + // } + // evm.interpreters = append(evm.interpreters, NewEVMVCInterpreter(evm, vmConfig, options)) + // } else { + // evm.interpreters = append(evm.interpreters, NewEWASMInterpreter(evm, vmConfig)) + // } + panic("No supported ewasm interpreter yet.") + } + + // vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here + // as we always want to have the built-in EVM as the failover option. + evm.interpreters = append(evm.interpreters, NewEVMInterpreter(evm, vmConfig)) + evm.interpreter = evm.interpreters[0] + + return evm +} + +// Cancel cancels any running EVM operation. This may be called concurrently and +// it's safe to be called multiple times. +func (evm *EVM) Cancel() { + atomic.StoreInt32(&evm.abort, 1) +} + +// Cancelled returns true if Cancel has been called +func (evm *EVM) Cancelled() bool { + return atomic.LoadInt32(&evm.abort) == 1 +} + +// Interpreter returns the current interpreter +func (evm *EVM) Interpreter() Interpreter { + return evm.interpreter +} + +// Call executes the contract associated with the addr with the given input as +// parameters. It also handles any necessary value transfer required and takes +// the necessary steps to create accounts and reverses the state in case of an +// execution error or failed value transfer. +func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { + if evm.vmConfig.NoRecursion && evm.depth > 0 { + return nil, gas, nil + } + + // Fail if we're trying to execute above the call depth limit + if evm.depth > int(params.CallCreateDepth) { + return nil, gas, ErrDepth + } + // Fail if we're trying to transfer more than the available balance + if !evm.Context.CanTransfer(evm.StateDB, caller.Address(), value) { + return nil, gas, ErrInsufficientBalance + } + + var ( + to = AccountRef(addr) + snapshot = evm.StateDB.Snapshot() + ) + if !evm.StateDB.Exist(addr) { + precompiles := PrecompiledContractsHomestead + if evm.ChainConfig().IsByzantium(evm.BlockNumber) { + precompiles = PrecompiledContractsByzantium + } + if precompiles[addr] == nil && evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 { + // Calling a non existing account, don't do anything, but ping the tracer + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) + evm.vmConfig.Tracer.CaptureEnd(ret, 0, 0, nil) + } + return nil, gas, nil + } + evm.StateDB.CreateAccount(addr) + } + evm.Transfer(evm.StateDB, caller.Address(), to.Address(), value) + // Initialise a new contract and set the code that is to be used by the EVM. + // The contract is a scoped environment for this execution context only. + contract := NewContract(caller, to, value, gas) + contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) + + // Even if the account has no code, we need to continue because it might be a precompile + start := time.Now() + + // Capture the tracer start/end events in debug mode + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) + + defer func() { // Lazy evaluation of the parameters + evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err) + }() + } + ret, err = run(evm, contract, input, false) + + // When an error was returned by the EVM or when setting the creation code + // above we revert to the snapshot and consume any gas remaining. Additionally + // when we're in homestead this also counts for code storage gas errors. + if err != nil { + evm.StateDB.RevertToSnapshot(snapshot) + if err != errExecutionReverted { + contract.UseGas(contract.Gas) + } + } + return ret, contract.Gas, err +} + +// CallCode executes the contract associated with the addr with the given input +// as parameters. It also handles any necessary value transfer required and takes +// the necessary steps to create accounts and reverses the state in case of an +// execution error or failed value transfer. +// +// CallCode differs from Call in the sense that it executes the given address' +// code with the caller as context. +func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { + if evm.vmConfig.NoRecursion && evm.depth > 0 { + return nil, gas, nil + } + + // Fail if we're trying to execute above the call depth limit + if evm.depth > int(params.CallCreateDepth) { + return nil, gas, ErrDepth + } + // Fail if we're trying to transfer more than the available balance + if !evm.CanTransfer(evm.StateDB, caller.Address(), value) { + return nil, gas, ErrInsufficientBalance + } + + var ( + snapshot = evm.StateDB.Snapshot() + to = AccountRef(caller.Address()) + ) + // Initialise a new contract and set the code that is to be used by the EVM. + // The contract is a scoped environment for this execution context only. + contract := NewContract(caller, to, value, gas) + contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) + + ret, err = run(evm, contract, input, false) + if err != nil { + evm.StateDB.RevertToSnapshot(snapshot) + if err != errExecutionReverted { + contract.UseGas(contract.Gas) + } + } + return ret, contract.Gas, err +} + +// DelegateCall executes the contract associated with the addr with the given input +// as parameters. It reverses the state in case of an execution error. +// +// DelegateCall differs from CallCode in the sense that it executes the given address' +// code with the caller as context and the caller is set to the caller of the caller. +func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) { + if evm.vmConfig.NoRecursion && evm.depth > 0 { + return nil, gas, nil + } + // Fail if we're trying to execute above the call depth limit + if evm.depth > int(params.CallCreateDepth) { + return nil, gas, ErrDepth + } + + var ( + snapshot = evm.StateDB.Snapshot() + to = AccountRef(caller.Address()) + ) + + // Initialise a new contract and make initialise the delegate values + contract := NewContract(caller, to, nil, gas).AsDelegate() + contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) + + ret, err = run(evm, contract, input, false) + if err != nil { + evm.StateDB.RevertToSnapshot(snapshot) + if err != errExecutionReverted { + contract.UseGas(contract.Gas) + } + } + return ret, contract.Gas, err +} + +// StaticCall executes the contract associated with the addr with the given input +// as parameters while disallowing any modifications to the state during the call. +// Opcodes that attempt to perform such modifications will result in exceptions +// instead of performing the modifications. +func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) { + if evm.vmConfig.NoRecursion && evm.depth > 0 { + return nil, gas, nil + } + // Fail if we're trying to execute above the call depth limit + if evm.depth > int(params.CallCreateDepth) { + return nil, gas, ErrDepth + } + + var ( + to = AccountRef(addr) + snapshot = evm.StateDB.Snapshot() + ) + // Initialise a new contract and set the code that is to be used by the EVM. + // The contract is a scoped environment for this execution context only. + contract := NewContract(caller, to, new(big.Int), gas) + contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) + + // We do an AddBalance of zero here, just in order to trigger a touch. + // This doesn't matter on Mainnet, where all empties are gone at the time of Byzantium, + // but is the correct thing to do and matters on other networks, in tests, and potential + // future scenarios + evm.StateDB.AddBalance(addr, bigZero) + + // When an error was returned by the EVM or when setting the creation code + // above we revert to the snapshot and consume any gas remaining. Additionally + // when we're in Homestead this also counts for code storage gas errors. + ret, err = run(evm, contract, input, true) + if err != nil { + evm.StateDB.RevertToSnapshot(snapshot) + if err != errExecutionReverted { + contract.UseGas(contract.Gas) + } + } + return ret, contract.Gas, err +} + +type codeAndHash struct { + code []byte + hash common.Hash +} + +func (c *codeAndHash) Hash() common.Hash { + if c.hash == (common.Hash{}) { + c.hash = crypto.Keccak256Hash(c.code) + } + return c.hash +} + +// create creates a new contract using code as deployment code. +func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64, value *big.Int, address common.Address) ([]byte, common.Address, uint64, error) { + // Depth check execution. Fail if we're trying to execute above the + // limit. + if evm.depth > int(params.CallCreateDepth) { + return nil, common.Address{}, gas, ErrDepth + } + if !evm.CanTransfer(evm.StateDB, caller.Address(), value) { + return nil, common.Address{}, gas, ErrInsufficientBalance + } + nonce := evm.StateDB.GetNonce(caller.Address()) + evm.StateDB.SetNonce(caller.Address(), nonce+1) + + // Ensure there's no existing contract already at the designated address + contractHash := evm.StateDB.GetCodeHash(address) + if evm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != emptyCodeHash) { + return nil, common.Address{}, 0, ErrContractAddressCollision + } + // Create a new account on the state + snapshot := evm.StateDB.Snapshot() + evm.StateDB.CreateAccount(address) + if evm.ChainConfig().IsEIP158(evm.BlockNumber) { + evm.StateDB.SetNonce(address, 1) + } + evm.Transfer(evm.StateDB, caller.Address(), address, value) + + // Initialise a new contract and set the code that is to be used by the EVM. + // The contract is a scoped environment for this execution context only. + contract := NewContract(caller, AccountRef(address), value, gas) + contract.SetCodeOptionalHash(&address, codeAndHash) + + if evm.vmConfig.NoRecursion && evm.depth > 0 { + return nil, address, gas, nil + } + + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureStart(caller.Address(), address, true, codeAndHash.code, gas, value) + } + start := time.Now() + + ret, err := run(evm, contract, nil, false) + + // check whether the max code size has been exceeded + maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize + // if the contract creation ran successfully and no errors were returned + // calculate the gas required to store the code. If the code could not + // be stored due to not enough gas set an error and let it be handled + // by the error checking condition below. + if err == nil && !maxCodeSizeExceeded { + createDataGas := uint64(len(ret)) * params.CreateDataGas + if contract.UseGas(createDataGas) { + evm.StateDB.SetCode(address, ret) + } else { + err = ErrCodeStoreOutOfGas + } + } + + // When an error was returned by the EVM or when setting the creation code + // above we revert to the snapshot and consume any gas remaining. Additionally + // when we're in homestead this also counts for code storage gas errors. + if maxCodeSizeExceeded || (err != nil && (evm.ChainConfig().IsHomestead(evm.BlockNumber) || err != ErrCodeStoreOutOfGas)) { + evm.StateDB.RevertToSnapshot(snapshot) + if err != errExecutionReverted { + contract.UseGas(contract.Gas) + } + } + // Assign err if contract code size exceeds the max while the err is still empty. + if maxCodeSizeExceeded && err == nil { + err = errMaxCodeSizeExceeded + } + if evm.vmConfig.Debug && evm.depth == 0 { + evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err) + } + return ret, address, contract.Gas, err + +} + +// Create creates a new contract using code as deployment code. +func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) { + contractAddr = crypto.CreateAddress(caller.Address(), evm.StateDB.GetNonce(caller.Address())) + return evm.create(caller, &codeAndHash{code: code}, gas, value, contractAddr) +} + +// Create2 creates a new contract using code as deployment code. +// +// The different between Create2 with Create is Create2 uses sha3(0xff ++ msg.sender ++ salt ++ sha3(init_code))[12:] +// instead of the usual sender-and-nonce-hash as the address where the contract is initialized at. +func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *big.Int, salt *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) { + codeAndHash := &codeAndHash{code: code} + contractAddr = crypto.CreateAddress2(caller.Address(), common.BigToHash(salt), codeAndHash.Hash().Bytes()) + return evm.create(caller, codeAndHash, gas, endowment, contractAddr) +} + +// ChainConfig returns the environment's chain configuration +func (evm *EVM) ChainConfig() *params.ChainConfig { return evm.chainConfig } diff --git a/vendor/github.com/ethereum/go-ethereum/eth/api.go b/vendor/github.com/ethereum/go-ethereum/eth/api.go new file mode 100644 index 00000000..98c2f587 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/eth/api.go @@ -0,0 +1,533 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package eth + +import ( + "compress/gzip" + "context" + "errors" + "fmt" + "io" + "math/big" + "os" + "runtime" + "strings" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/trie" +) + +// PublicEthereumAPI provides an API to access Ethereum full node-related +// information. +type PublicEthereumAPI struct { + e *Ethereum +} + +// NewPublicEthereumAPI creates a new Ethereum protocol API for full nodes. +func NewPublicEthereumAPI(e *Ethereum) *PublicEthereumAPI { + return &PublicEthereumAPI{e} +} + +// Etherbase is the address that mining rewards will be send to +func (api *PublicEthereumAPI) Etherbase() (common.Address, error) { + return api.e.Etherbase() +} + +// Coinbase is the address that mining rewards will be send to (alias for Etherbase) +func (api *PublicEthereumAPI) Coinbase() (common.Address, error) { + return api.Etherbase() +} + +// Hashrate returns the POW hashrate +func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 { + return hexutil.Uint64(api.e.Miner().HashRate()) +} + +// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. +func (api *PublicEthereumAPI) ChainId() hexutil.Uint64 { + chainID := new(big.Int) + if config := api.e.blockchain.Config(); config.IsEIP155(api.e.blockchain.CurrentBlock().Number()) { + chainID = config.ChainID + } + return (hexutil.Uint64)(chainID.Uint64()) +} + +// PublicMinerAPI provides an API to control the miner. +// It offers only methods that operate on data that pose no security risk when it is publicly accessible. +type PublicMinerAPI struct { + e *Ethereum +} + +// NewPublicMinerAPI create a new PublicMinerAPI instance. +func NewPublicMinerAPI(e *Ethereum) *PublicMinerAPI { + return &PublicMinerAPI{e} +} + +// Mining returns an indication if this node is currently mining. +func (api *PublicMinerAPI) Mining() bool { + return api.e.IsMining() +} + +// PrivateMinerAPI provides private RPC methods to control the miner. +// These methods can be abused by external users and must be considered insecure for use by untrusted users. +type PrivateMinerAPI struct { + e *Ethereum +} + +// NewPrivateMinerAPI create a new RPC service which controls the miner of this node. +func NewPrivateMinerAPI(e *Ethereum) *PrivateMinerAPI { + return &PrivateMinerAPI{e: e} +} + +// Start starts the miner with the given number of threads. If threads is nil, +// the number of workers started is equal to the number of logical CPUs that are +// usable by this process. If mining is already running, this method adjust the +// number of threads allowed to use and updates the minimum price required by the +// transaction pool. +func (api *PrivateMinerAPI) Start(threads *int) error { + if threads == nil { + return api.e.StartMining(runtime.NumCPU()) + } + return api.e.StartMining(*threads) +} + +// Stop terminates the miner, both at the consensus engine level as well as at +// the block creation level. +func (api *PrivateMinerAPI) Stop() { + api.e.StopMining() +} + +// SetExtra sets the extra data string that is included when this miner mines a block. +func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error) { + if err := api.e.Miner().SetExtra([]byte(extra)); err != nil { + return false, err + } + return true, nil +} + +// SetGasPrice sets the minimum accepted gas price for the miner. +func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool { + api.e.lock.Lock() + api.e.gasPrice = (*big.Int)(&gasPrice) + api.e.lock.Unlock() + + api.e.txPool.SetGasPrice((*big.Int)(&gasPrice)) + return true +} + +// SetEtherbase sets the etherbase of the miner +func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool { + api.e.SetEtherbase(etherbase) + return true +} + +// SetRecommitInterval updates the interval for miner sealing work recommitting. +func (api *PrivateMinerAPI) SetRecommitInterval(interval int) { + api.e.Miner().SetRecommitInterval(time.Duration(interval) * time.Millisecond) +} + +// GetHashrate returns the current hashrate of the miner. +func (api *PrivateMinerAPI) GetHashrate() uint64 { + return api.e.miner.HashRate() +} + +// PrivateAdminAPI is the collection of Ethereum full node-related APIs +// exposed over the private admin endpoint. +type PrivateAdminAPI struct { + eth *Ethereum +} + +// NewPrivateAdminAPI creates a new API definition for the full node private +// admin methods of the Ethereum service. +func NewPrivateAdminAPI(eth *Ethereum) *PrivateAdminAPI { + return &PrivateAdminAPI{eth: eth} +} + +// ExportChain exports the current blockchain into a local file. +func (api *PrivateAdminAPI) ExportChain(file string) (bool, error) { + // Make sure we can create the file to export into + out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm) + if err != nil { + return false, err + } + defer out.Close() + + var writer io.Writer = out + if strings.HasSuffix(file, ".gz") { + writer = gzip.NewWriter(writer) + defer writer.(*gzip.Writer).Close() + } + + // Export the blockchain + if err := api.eth.BlockChain().Export(writer); err != nil { + return false, err + } + return true, nil +} + +func hasAllBlocks(chain *core.BlockChain, bs []*types.Block) bool { + for _, b := range bs { + if !chain.HasBlock(b.Hash(), b.NumberU64()) { + return false + } + } + + return true +} + +// ImportChain imports a blockchain from a local file. +func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) { + // Make sure the can access the file to import + in, err := os.Open(file) + if err != nil { + return false, err + } + defer in.Close() + + var reader io.Reader = in + if strings.HasSuffix(file, ".gz") { + if reader, err = gzip.NewReader(reader); err != nil { + return false, err + } + } + + // Run actual the import in pre-configured batches + stream := rlp.NewStream(reader, 0) + + blocks, index := make([]*types.Block, 0, 2500), 0 + for batch := 0; ; batch++ { + // Load a batch of blocks from the input file + for len(blocks) < cap(blocks) { + block := new(types.Block) + if err := stream.Decode(block); err == io.EOF { + break + } else if err != nil { + return false, fmt.Errorf("block %d: failed to parse: %v", index, err) + } + blocks = append(blocks, block) + index++ + } + if len(blocks) == 0 { + break + } + + if hasAllBlocks(api.eth.BlockChain(), blocks) { + blocks = blocks[:0] + continue + } + // Import the batch and reset the buffer + if _, err := api.eth.BlockChain().InsertChain(blocks); err != nil { + return false, fmt.Errorf("batch %d: failed to insert: %v", batch, err) + } + blocks = blocks[:0] + } + return true, nil +} + +// PublicDebugAPI is the collection of Ethereum full node APIs exposed +// over the public debugging endpoint. +type PublicDebugAPI struct { + eth *Ethereum +} + +// NewPublicDebugAPI creates a new API definition for the full node- +// related public debug methods of the Ethereum service. +func NewPublicDebugAPI(eth *Ethereum) *PublicDebugAPI { + return &PublicDebugAPI{eth: eth} +} + +// DumpBlock retrieves the entire state of the database at a given block. +func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) { + if blockNr == rpc.PendingBlockNumber { + // If we're dumping the pending state, we need to request + // both the pending block as well as the pending state from + // the miner and operate on those + _, stateDb := api.eth.miner.Pending() + return stateDb.RawDump(false, false, true), nil + } + var block *types.Block + if blockNr == rpc.LatestBlockNumber { + block = api.eth.blockchain.CurrentBlock() + } else { + block = api.eth.blockchain.GetBlockByNumber(uint64(blockNr)) + } + if block == nil { + return state.Dump{}, fmt.Errorf("block #%d not found", blockNr) + } + stateDb, err := api.eth.BlockChain().StateAt(block.Root()) + if err != nil { + return state.Dump{}, err + } + return stateDb.RawDump(false, false, true), nil +} + +// PrivateDebugAPI is the collection of Ethereum full node APIs exposed over +// the private debugging endpoint. +type PrivateDebugAPI struct { + eth *Ethereum +} + +// NewPrivateDebugAPI creates a new API definition for the full node-related +// private debug methods of the Ethereum service. +func NewPrivateDebugAPI(eth *Ethereum) *PrivateDebugAPI { + return &PrivateDebugAPI{eth: eth} +} + +// Preimage is a debug API function that returns the preimage for a sha3 hash, if known. +func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { + if preimage := rawdb.ReadPreimage(api.eth.ChainDb(), hash); preimage != nil { + return preimage, nil + } + return nil, errors.New("unknown preimage") +} + +// BadBlockArgs represents the entries in the list returned when bad blocks are queried. +type BadBlockArgs struct { + Hash common.Hash `json:"hash"` + Block map[string]interface{} `json:"block"` + RLP string `json:"rlp"` +} + +// GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network +// and returns them as a JSON list of block-hashes +func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) { + blocks := api.eth.BlockChain().BadBlocks() + results := make([]*BadBlockArgs, len(blocks)) + + var err error + for i, block := range blocks { + results[i] = &BadBlockArgs{ + Hash: block.Hash(), + } + if rlpBytes, err := rlp.EncodeToBytes(block); err != nil { + results[i].RLP = err.Error() // Hacky, but hey, it works + } else { + results[i].RLP = fmt.Sprintf("0x%x", rlpBytes) + } + if results[i].Block, err = ethapi.RPCMarshalBlock(block, true, true); err != nil { + results[i].Block = map[string]interface{}{"error": err.Error()} + } + } + return results, nil +} + +// AccountRangeResult returns a mapping from the hash of an account addresses +// to its preimage. It will return the JSON null if no preimage is found. +// Since a query can return a limited amount of results, a "next" field is +// also present for paging. +type AccountRangeResult struct { + Accounts map[common.Hash]*common.Address `json:"accounts"` + Next common.Hash `json:"next"` +} + +func accountRange(st state.Trie, start *common.Hash, maxResults int) (AccountRangeResult, error) { + if start == nil { + start = &common.Hash{0} + } + it := trie.NewIterator(st.NodeIterator(start.Bytes())) + result := AccountRangeResult{Accounts: make(map[common.Hash]*common.Address), Next: common.Hash{}} + + if maxResults > AccountRangeMaxResults { + maxResults = AccountRangeMaxResults + } + + for i := 0; i < maxResults && it.Next(); i++ { + if preimage := st.GetKey(it.Key); preimage != nil { + addr := &common.Address{} + addr.SetBytes(preimage) + result.Accounts[common.BytesToHash(it.Key)] = addr + } else { + result.Accounts[common.BytesToHash(it.Key)] = nil + } + } + + if it.Next() { + result.Next = common.BytesToHash(it.Key) + } + + return result, nil +} + +// AccountRangeMaxResults is the maximum number of results to be returned per call +const AccountRangeMaxResults = 256 + +// AccountRange enumerates all accounts in the latest state +func (api *PrivateDebugAPI) AccountRange(ctx context.Context, start *common.Hash, maxResults int) (AccountRangeResult, error) { + var statedb *state.StateDB + var err error + block := api.eth.blockchain.CurrentBlock() + + if len(block.Transactions()) == 0 { + statedb, err = api.computeStateDB(block, defaultTraceReexec) + if err != nil { + return AccountRangeResult{}, err + } + } else { + _, _, statedb, err = api.computeTxEnv(block.Hash(), len(block.Transactions())-1, 0) + if err != nil { + return AccountRangeResult{}, err + } + } + + trie, err := statedb.Database().OpenTrie(block.Header().Root) + if err != nil { + return AccountRangeResult{}, err + } + + return accountRange(trie, start, maxResults) +} + +// StorageRangeResult is the result of a debug_storageRangeAt API call. +type StorageRangeResult struct { + Storage storageMap `json:"storage"` + NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie. +} + +type storageMap map[common.Hash]storageEntry + +type storageEntry struct { + Key *common.Hash `json:"key"` + Value common.Hash `json:"value"` +} + +// StorageRangeAt returns the storage at the given block height and transaction index. +func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) { + _, _, statedb, err := api.computeTxEnv(blockHash, txIndex, 0) + if err != nil { + return StorageRangeResult{}, err + } + st := statedb.StorageTrie(contractAddress) + if st == nil { + return StorageRangeResult{}, fmt.Errorf("account %x doesn't exist", contractAddress) + } + return storageRangeAt(st, keyStart, maxResult) +} + +func storageRangeAt(st state.Trie, start []byte, maxResult int) (StorageRangeResult, error) { + it := trie.NewIterator(st.NodeIterator(start)) + result := StorageRangeResult{Storage: storageMap{}} + for i := 0; i < maxResult && it.Next(); i++ { + _, content, _, err := rlp.Split(it.Value) + if err != nil { + return StorageRangeResult{}, err + } + e := storageEntry{Value: common.BytesToHash(content)} + if preimage := st.GetKey(it.Key); preimage != nil { + preimage := common.BytesToHash(preimage) + e.Key = &preimage + } + result.Storage[common.BytesToHash(it.Key)] = e + } + // Add the 'next key' so clients can continue downloading. + if it.Next() { + next := common.BytesToHash(it.Key) + result.NextKey = &next + } + return result, nil +} + +// GetModifiedAccountsByNumber returns all accounts that have changed between the +// two blocks specified. A change is defined as a difference in nonce, balance, +// code hash, or storage hash. +// +// With one parameter, returns the list of accounts modified in the specified block. +func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error) { + var startBlock, endBlock *types.Block + + startBlock = api.eth.blockchain.GetBlockByNumber(startNum) + if startBlock == nil { + return nil, fmt.Errorf("start block %x not found", startNum) + } + + if endNum == nil { + endBlock = startBlock + startBlock = api.eth.blockchain.GetBlockByHash(startBlock.ParentHash()) + if startBlock == nil { + return nil, fmt.Errorf("block %x has no parent", endBlock.Number()) + } + } else { + endBlock = api.eth.blockchain.GetBlockByNumber(*endNum) + if endBlock == nil { + return nil, fmt.Errorf("end block %d not found", *endNum) + } + } + return api.getModifiedAccounts(startBlock, endBlock) +} + +// GetModifiedAccountsByHash returns all accounts that have changed between the +// two blocks specified. A change is defined as a difference in nonce, balance, +// code hash, or storage hash. +// +// With one parameter, returns the list of accounts modified in the specified block. +func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error) { + var startBlock, endBlock *types.Block + startBlock = api.eth.blockchain.GetBlockByHash(startHash) + if startBlock == nil { + return nil, fmt.Errorf("start block %x not found", startHash) + } + + if endHash == nil { + endBlock = startBlock + startBlock = api.eth.blockchain.GetBlockByHash(startBlock.ParentHash()) + if startBlock == nil { + return nil, fmt.Errorf("block %x has no parent", endBlock.Number()) + } + } else { + endBlock = api.eth.blockchain.GetBlockByHash(*endHash) + if endBlock == nil { + return nil, fmt.Errorf("end block %x not found", *endHash) + } + } + return api.getModifiedAccounts(startBlock, endBlock) +} + +func (api *PrivateDebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]common.Address, error) { + if startBlock.Number().Uint64() >= endBlock.Number().Uint64() { + return nil, fmt.Errorf("start block height (%d) must be less than end block height (%d)", startBlock.Number().Uint64(), endBlock.Number().Uint64()) + } + triedb := api.eth.BlockChain().StateCache().TrieDB() + + oldTrie, err := trie.NewSecure(startBlock.Root(), triedb) + if err != nil { + return nil, err + } + newTrie, err := trie.NewSecure(endBlock.Root(), triedb) + if err != nil { + return nil, err + } + diff, _ := trie.NewDifferenceIterator(oldTrie.NodeIterator([]byte{}), newTrie.NodeIterator([]byte{})) + iter := trie.NewIterator(diff) + + var dirty []common.Address + for iter.Next() { + key := newTrie.GetKey(iter.Key) + if key == nil { + return nil, fmt.Errorf("no preimage found for hash %x", iter.Key) + } + dirty = append(dirty, common.BytesToAddress(key)) + } + return dirty, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/eth/api_backend.go b/vendor/github.com/ethereum/go-ethereum/eth/api_backend.go index db0e8cf4..ee5b51cf 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/api_backend.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/api_backend.go @@ -185,7 +185,7 @@ func (b *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) } func (b *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) { - return b.eth.txPool.State().GetNonce(addr), nil + return b.eth.txPool.Nonce(addr), nil } func (b *EthAPIBackend) Stats() (pending int, queued int) { diff --git a/vendor/github.com/ethereum/go-ethereum/eth/api_tracer.go b/vendor/github.com/ethereum/go-ethereum/eth/api_tracer.go new file mode 100644 index 00000000..ce211cbd --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/eth/api_tracer.go @@ -0,0 +1,823 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package eth + +import ( + "bufio" + "bytes" + "context" + "errors" + "fmt" + "io/ioutil" + "os" + "runtime" + "sync" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/eth/tracers" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/trie" +) + +const ( + // defaultTraceTimeout is the amount of time a single transaction can execute + // by default before being forcefully aborted. + defaultTraceTimeout = 5 * time.Second + + // defaultTraceReexec is the number of blocks the tracer is willing to go back + // and reexecute to produce missing historical state necessary to run a specific + // trace. + defaultTraceReexec = uint64(128) +) + +// TraceConfig holds extra parameters to trace functions. +type TraceConfig struct { + *vm.LogConfig + Tracer *string + Timeout *string + Reexec *uint64 +} + +// StdTraceConfig holds extra parameters to standard-json trace functions. +type StdTraceConfig struct { + *vm.LogConfig + Reexec *uint64 + TxHash common.Hash +} + +// txTraceResult is the result of a single transaction trace. +type txTraceResult struct { + Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer + Error string `json:"error,omitempty"` // Trace failure produced by the tracer +} + +// blockTraceTask represents a single block trace task when an entire chain is +// being traced. +type blockTraceTask struct { + statedb *state.StateDB // Intermediate state prepped for tracing + block *types.Block // Block to trace the transactions from + rootref common.Hash // Trie root reference held for this task + results []*txTraceResult // Trace results procudes by the task +} + +// blockTraceResult represets the results of tracing a single block when an entire +// chain is being traced. +type blockTraceResult struct { + Block hexutil.Uint64 `json:"block"` // Block number corresponding to this trace + Hash common.Hash `json:"hash"` // Block hash corresponding to this trace + Traces []*txTraceResult `json:"traces"` // Trace results produced by the task +} + +// txTraceTask represents a single transaction trace task when an entire block +// is being traced. +type txTraceTask struct { + statedb *state.StateDB // Intermediate state prepped for tracing + index int // Transaction offset in the block +} + +// TraceChain returns the structured logs created during the execution of EVM +// between two blocks (excluding start) and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error) { + // Fetch the block interval that we want to trace + var from, to *types.Block + + switch start { + case rpc.PendingBlockNumber: + from = api.eth.miner.PendingBlock() + case rpc.LatestBlockNumber: + from = api.eth.blockchain.CurrentBlock() + default: + from = api.eth.blockchain.GetBlockByNumber(uint64(start)) + } + switch end { + case rpc.PendingBlockNumber: + to = api.eth.miner.PendingBlock() + case rpc.LatestBlockNumber: + to = api.eth.blockchain.CurrentBlock() + default: + to = api.eth.blockchain.GetBlockByNumber(uint64(end)) + } + // Trace the chain if we've found all our blocks + if from == nil { + return nil, fmt.Errorf("starting block #%d not found", start) + } + if to == nil { + return nil, fmt.Errorf("end block #%d not found", end) + } + if from.Number().Cmp(to.Number()) >= 0 { + return nil, fmt.Errorf("end block (#%d) needs to come after start block (#%d)", end, start) + } + return api.traceChain(ctx, from, to, config) +} + +// traceChain configures a new tracer according to the provided configuration, and +// executes all the transactions contained within. The return value will be one item +// per transaction, dependent on the requested tracer. +func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Block, config *TraceConfig) (*rpc.Subscription, error) { + // Tracing a chain is a **long** operation, only do with subscriptions + notifier, supported := rpc.NotifierFromContext(ctx) + if !supported { + return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported + } + sub := notifier.CreateSubscription() + + // Ensure we have a valid starting state before doing any work + origin := start.NumberU64() + database := state.NewDatabaseWithCache(api.eth.ChainDb(), 16) // Chain tracing will probably start at genesis + + if number := start.NumberU64(); number > 0 { + start = api.eth.blockchain.GetBlock(start.ParentHash(), start.NumberU64()-1) + if start == nil { + return nil, fmt.Errorf("parent block #%d not found", number-1) + } + } + statedb, err := state.New(start.Root(), database) + if err != nil { + // If the starting state is missing, allow some number of blocks to be reexecuted + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + // Find the most recent block that has the state available + for i := uint64(0); i < reexec; i++ { + start = api.eth.blockchain.GetBlock(start.ParentHash(), start.NumberU64()-1) + if start == nil { + break + } + if statedb, err = state.New(start.Root(), database); err == nil { + break + } + } + // If we still don't have the state available, bail out + if err != nil { + switch err.(type) { + case *trie.MissingNodeError: + return nil, errors.New("required historical state unavailable") + default: + return nil, err + } + } + } + // Execute all the transaction contained within the chain concurrently for each block + blocks := int(end.NumberU64() - origin) + + threads := runtime.NumCPU() + if threads > blocks { + threads = blocks + } + var ( + pend = new(sync.WaitGroup) + tasks = make(chan *blockTraceTask, threads) + results = make(chan *blockTraceTask, threads) + ) + for th := 0; th < threads; th++ { + pend.Add(1) + go func() { + defer pend.Done() + + // Fetch and execute the next block trace tasks + for task := range tasks { + signer := types.MakeSigner(api.eth.blockchain.Config(), task.block.Number()) + + // Trace all the transactions contained within + for i, tx := range task.block.Transactions() { + msg, _ := tx.AsMessage(signer) + vmctx := core.NewEVMContext(msg, task.block.Header(), api.eth.blockchain, nil) + + res, err := api.traceTx(ctx, msg, vmctx, task.statedb, config) + if err != nil { + task.results[i] = &txTraceResult{Error: err.Error()} + log.Warn("Tracing failed", "hash", tx.Hash(), "block", task.block.NumberU64(), "err", err) + break + } + // Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect + task.statedb.Finalise(api.eth.blockchain.Config().IsEIP158(task.block.Number())) + task.results[i] = &txTraceResult{Result: res} + } + // Stream the result back to the user or abort on teardown + select { + case results <- task: + case <-notifier.Closed(): + return + } + } + }() + } + // Start a goroutine to feed all the blocks into the tracers + begin := time.Now() + + go func() { + var ( + logged time.Time + number uint64 + traced uint64 + failed error + proot common.Hash + ) + // Ensure everything is properly cleaned up on any exit path + defer func() { + close(tasks) + pend.Wait() + + switch { + case failed != nil: + log.Warn("Chain tracing failed", "start", start.NumberU64(), "end", end.NumberU64(), "transactions", traced, "elapsed", time.Since(begin), "err", failed) + case number < end.NumberU64(): + log.Warn("Chain tracing aborted", "start", start.NumberU64(), "end", end.NumberU64(), "abort", number, "transactions", traced, "elapsed", time.Since(begin)) + default: + log.Info("Chain tracing finished", "start", start.NumberU64(), "end", end.NumberU64(), "transactions", traced, "elapsed", time.Since(begin)) + } + close(results) + }() + // Feed all the blocks both into the tracer, as well as fast process concurrently + for number = start.NumberU64() + 1; number <= end.NumberU64(); number++ { + // Stop tracing if interruption was requested + select { + case <-notifier.Closed(): + return + default: + } + // Print progress logs if long enough time elapsed + if time.Since(logged) > 8*time.Second { + if number > origin { + nodes, imgs := database.TrieDB().Size() + log.Info("Tracing chain segment", "start", origin, "end", end.NumberU64(), "current", number, "transactions", traced, "elapsed", time.Since(begin), "memory", nodes+imgs) + } else { + log.Info("Preparing state for chain trace", "block", number, "start", origin, "elapsed", time.Since(begin)) + } + logged = time.Now() + } + // Retrieve the next block to trace + block := api.eth.blockchain.GetBlockByNumber(number) + if block == nil { + failed = fmt.Errorf("block #%d not found", number) + break + } + // Send the block over to the concurrent tracers (if not in the fast-forward phase) + if number > origin { + txs := block.Transactions() + + select { + case tasks <- &blockTraceTask{statedb: statedb.Copy(), block: block, rootref: proot, results: make([]*txTraceResult, len(txs))}: + case <-notifier.Closed(): + return + } + traced += uint64(len(txs)) + } + // Generate the next state snapshot fast without tracing + _, _, _, err := api.eth.blockchain.Processor().Process(block, statedb, vm.Config{}) + if err != nil { + failed = err + break + } + // Finalize the state so any modifications are written to the trie + root, err := statedb.Commit(api.eth.blockchain.Config().IsEIP158(block.Number())) + if err != nil { + failed = err + break + } + if err := statedb.Reset(root); err != nil { + failed = err + break + } + // Reference the trie twice, once for us, once for the tracer + database.TrieDB().Reference(root, common.Hash{}) + if number >= origin { + database.TrieDB().Reference(root, common.Hash{}) + } + // Dereference all past tries we ourselves are done working with + if proot != (common.Hash{}) { + database.TrieDB().Dereference(proot) + } + proot = root + + // TODO(karalabe): Do we need the preimages? Won't they accumulate too much? + } + }() + + // Keep reading the trace results and stream the to the user + go func() { + var ( + done = make(map[uint64]*blockTraceResult) + next = origin + 1 + ) + for res := range results { + // Queue up next received result + result := &blockTraceResult{ + Block: hexutil.Uint64(res.block.NumberU64()), + Hash: res.block.Hash(), + Traces: res.results, + } + done[uint64(result.Block)] = result + + // Dereference any paret tries held in memory by this task + database.TrieDB().Dereference(res.rootref) + + // Stream completed traces to the user, aborting on the first error + for result, ok := done[next]; ok; result, ok = done[next] { + if len(result.Traces) > 0 || next == end.NumberU64() { + notifier.Notify(sub.ID, result) + } + delete(done, next) + next++ + } + } + }() + return sub, nil +} + +// TraceBlockByNumber returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error) { + // Fetch the block that we want to trace + var block *types.Block + + switch number { + case rpc.PendingBlockNumber: + block = api.eth.miner.PendingBlock() + case rpc.LatestBlockNumber: + block = api.eth.blockchain.CurrentBlock() + default: + block = api.eth.blockchain.GetBlockByNumber(uint64(number)) + } + // Trace the block if it was found + if block == nil { + return nil, fmt.Errorf("block #%d not found", number) + } + return api.traceBlock(ctx, block, config) +} + +// TraceBlockByHash returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error) { + block := api.eth.blockchain.GetBlockByHash(hash) + if block == nil { + return nil, fmt.Errorf("block %#x not found", hash) + } + return api.traceBlock(ctx, block, config) +} + +// TraceBlock returns the structured logs created during the execution of EVM +// and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error) { + block := new(types.Block) + if err := rlp.Decode(bytes.NewReader(blob), block); err != nil { + return nil, fmt.Errorf("could not decode block: %v", err) + } + return api.traceBlock(ctx, block, config) +} + +// TraceBlockFromFile returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error) { + blob, err := ioutil.ReadFile(file) + if err != nil { + return nil, fmt.Errorf("could not read file: %v", err) + } + return api.TraceBlock(ctx, blob, config) +} + +// TraceBadBlockByHash returns the structured logs created during the execution of +// EVM against a block pulled from the pool of bad ones and returns them as a JSON +// object. +func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error) { + blocks := api.eth.blockchain.BadBlocks() + for _, block := range blocks { + if block.Hash() == hash { + return api.traceBlock(ctx, block, config) + } + } + return nil, fmt.Errorf("bad block %#x not found", hash) +} + +// StandardTraceBlockToFile dumps the structured logs created during the +// execution of EVM to the local file system and returns a list of files +// to the caller. +func (api *PrivateDebugAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error) { + block := api.eth.blockchain.GetBlockByHash(hash) + if block == nil { + return nil, fmt.Errorf("block %#x not found", hash) + } + return api.standardTraceBlockToFile(ctx, block, config) +} + +// StandardTraceBadBlockToFile dumps the structured logs created during the +// execution of EVM against a block pulled from the pool of bad ones to the +// local file system and returns a list of files to the caller. +func (api *PrivateDebugAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error) { + blocks := api.eth.blockchain.BadBlocks() + for _, block := range blocks { + if block.Hash() == hash { + return api.standardTraceBlockToFile(ctx, block, config) + } + } + return nil, fmt.Errorf("bad block %#x not found", hash) +} + +// traceBlock configures a new tracer according to the provided configuration, and +// executes all the transactions contained within. The return value will be one item +// per transaction, dependent on the requestd tracer. +func (api *PrivateDebugAPI) traceBlock(ctx context.Context, block *types.Block, config *TraceConfig) ([]*txTraceResult, error) { + // Create the parent state database + if err := api.eth.engine.VerifyHeader(api.eth.blockchain, block.Header(), true); err != nil { + return nil, err + } + parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1) + if parent == nil { + return nil, fmt.Errorf("parent %#x not found", block.ParentHash()) + } + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + statedb, err := api.computeStateDB(parent, reexec) + if err != nil { + return nil, err + } + // Execute all the transaction contained within the block concurrently + var ( + signer = types.MakeSigner(api.eth.blockchain.Config(), block.Number()) + + txs = block.Transactions() + results = make([]*txTraceResult, len(txs)) + + pend = new(sync.WaitGroup) + jobs = make(chan *txTraceTask, len(txs)) + ) + threads := runtime.NumCPU() + if threads > len(txs) { + threads = len(txs) + } + for th := 0; th < threads; th++ { + pend.Add(1) + go func() { + defer pend.Done() + + // Fetch and execute the next transaction trace tasks + for task := range jobs { + msg, _ := txs[task.index].AsMessage(signer) + vmctx := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil) + + res, err := api.traceTx(ctx, msg, vmctx, task.statedb, config) + if err != nil { + results[task.index] = &txTraceResult{Error: err.Error()} + continue + } + results[task.index] = &txTraceResult{Result: res} + } + }() + } + // Feed the transactions into the tracers and return + var failed error + for i, tx := range txs { + // Send the trace task over for execution + jobs <- &txTraceTask{statedb: statedb.Copy(), index: i} + + // Generate the next state snapshot fast without tracing + msg, _ := tx.AsMessage(signer) + vmctx := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil) + + vmenv := vm.NewEVM(vmctx, statedb, api.eth.blockchain.Config(), vm.Config{}) + if _, _, _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas())); err != nil { + failed = err + break + } + // Finalize the state so any modifications are written to the trie + // Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect + statedb.Finalise(vmenv.ChainConfig().IsEIP158(block.Number())) + } + close(jobs) + pend.Wait() + + // If execution failed in between, abort + if failed != nil { + return nil, failed + } + return results, nil +} + +// standardTraceBlockToFile configures a new tracer which uses standard JSON output, +// and traces either a full block or an individual transaction. The return value will +// be one filename per transaction traced. +func (api *PrivateDebugAPI) standardTraceBlockToFile(ctx context.Context, block *types.Block, config *StdTraceConfig) ([]string, error) { + // If we're tracing a single transaction, make sure it's present + if config != nil && config.TxHash != (common.Hash{}) { + if !containsTx(block, config.TxHash) { + return nil, fmt.Errorf("transaction %#x not found in block", config.TxHash) + } + } + // Create the parent state database + if err := api.eth.engine.VerifyHeader(api.eth.blockchain, block.Header(), true); err != nil { + return nil, err + } + parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1) + if parent == nil { + return nil, fmt.Errorf("parent %#x not found", block.ParentHash()) + } + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + statedb, err := api.computeStateDB(parent, reexec) + if err != nil { + return nil, err + } + // Retrieve the tracing configurations, or use default values + var ( + logConfig vm.LogConfig + txHash common.Hash + ) + if config != nil { + if config.LogConfig != nil { + logConfig = *config.LogConfig + } + txHash = config.TxHash + } + logConfig.Debug = true + + // Execute transaction, either tracing all or just the requested one + var ( + signer = types.MakeSigner(api.eth.blockchain.Config(), block.Number()) + dumps []string + ) + for i, tx := range block.Transactions() { + // Prepare the trasaction for un-traced execution + var ( + msg, _ = tx.AsMessage(signer) + vmctx = core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil) + + vmConf vm.Config + dump *os.File + writer *bufio.Writer + err error + ) + // If the transaction needs tracing, swap out the configs + if tx.Hash() == txHash || txHash == (common.Hash{}) { + // Generate a unique temporary file to dump it into + prefix := fmt.Sprintf("block_%#x-%d-%#x-", block.Hash().Bytes()[:4], i, tx.Hash().Bytes()[:4]) + + dump, err = ioutil.TempFile(os.TempDir(), prefix) + if err != nil { + return nil, err + } + dumps = append(dumps, dump.Name()) + + // Swap out the noop logger to the standard tracer + writer = bufio.NewWriter(dump) + vmConf = vm.Config{ + Debug: true, + Tracer: vm.NewJSONLogger(&logConfig, writer), + EnablePreimageRecording: true, + } + } + // Execute the transaction and flush any traces to disk + vmenv := vm.NewEVM(vmctx, statedb, api.eth.blockchain.Config(), vmConf) + _, _, _, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas())) + if writer != nil { + writer.Flush() + } + if dump != nil { + dump.Close() + log.Info("Wrote standard trace", "file", dump.Name()) + } + if err != nil { + return dumps, err + } + // Finalize the state so any modifications are written to the trie + // Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect + statedb.Finalise(vmenv.ChainConfig().IsEIP158(block.Number())) + + // If we've traced the transaction we were looking for, abort + if tx.Hash() == txHash { + break + } + } + return dumps, nil +} + +// containsTx reports whether the transaction with a certain hash +// is contained within the specified block. +func containsTx(block *types.Block, hash common.Hash) bool { + for _, tx := range block.Transactions() { + if tx.Hash() == hash { + return true + } + } + return false +} + +// computeStateDB retrieves the state database associated with a certain block. +// If no state is locally available for the given block, a number of blocks are +// attempted to be reexecuted to generate the desired state. +func (api *PrivateDebugAPI) computeStateDB(block *types.Block, reexec uint64) (*state.StateDB, error) { + // If we have the state fully available, use that + statedb, err := api.eth.blockchain.StateAt(block.Root()) + if err == nil { + return statedb, nil + } + // Otherwise try to reexec blocks until we find a state or reach our limit + origin := block.NumberU64() + database := state.NewDatabaseWithCache(api.eth.ChainDb(), 16) + + for i := uint64(0); i < reexec; i++ { + block = api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1) + if block == nil { + break + } + if statedb, err = state.New(block.Root(), database); err == nil { + break + } + } + if err != nil { + switch err.(type) { + case *trie.MissingNodeError: + return nil, fmt.Errorf("required historical state unavailable (reexec=%d)", reexec) + default: + return nil, err + } + } + // State was available at historical point, regenerate + var ( + start = time.Now() + logged time.Time + proot common.Hash + ) + for block.NumberU64() < origin { + // Print progress logs if long enough time elapsed + if time.Since(logged) > 8*time.Second { + log.Info("Regenerating historical state", "block", block.NumberU64()+1, "target", origin, "remaining", origin-block.NumberU64()-1, "elapsed", time.Since(start)) + logged = time.Now() + } + // Retrieve the next block to regenerate and process it + if block = api.eth.blockchain.GetBlockByNumber(block.NumberU64() + 1); block == nil { + return nil, fmt.Errorf("block #%d not found", block.NumberU64()+1) + } + _, _, _, err := api.eth.blockchain.Processor().Process(block, statedb, vm.Config{}) + if err != nil { + return nil, fmt.Errorf("processing block %d failed: %v", block.NumberU64(), err) + } + // Finalize the state so any modifications are written to the trie + root, err := statedb.Commit(api.eth.blockchain.Config().IsEIP158(block.Number())) + if err != nil { + return nil, err + } + if err := statedb.Reset(root); err != nil { + return nil, fmt.Errorf("state reset after block %d failed: %v", block.NumberU64(), err) + } + database.TrieDB().Reference(root, common.Hash{}) + if proot != (common.Hash{}) { + database.TrieDB().Dereference(proot) + } + proot = root + } + nodes, imgs := database.TrieDB().Size() + log.Info("Historical state regenerated", "block", block.NumberU64(), "elapsed", time.Since(start), "nodes", nodes, "preimages", imgs) + return statedb, nil +} + +// TraceTransaction returns the structured logs created during the execution of EVM +// and returns them as a JSON object. +func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) { + // Retrieve the transaction and assemble its EVM context + tx, blockHash, _, index := rawdb.ReadTransaction(api.eth.ChainDb(), hash) + if tx == nil { + return nil, fmt.Errorf("transaction %#x not found", hash) + } + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + msg, vmctx, statedb, err := api.computeTxEnv(blockHash, int(index), reexec) + if err != nil { + return nil, err + } + // Trace the transaction and return + return api.traceTx(ctx, msg, vmctx, statedb, config) +} + +// traceTx configures a new tracer according to the provided configuration, and +// executes the given message in the provided environment. The return value will +// be tracer dependent. +func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, vmctx vm.Context, statedb *state.StateDB, config *TraceConfig) (interface{}, error) { + // Assemble the structured logger or the JavaScript tracer + var ( + tracer vm.Tracer + err error + ) + switch { + case config != nil && config.Tracer != nil: + // Define a meaningful timeout of a single transaction trace + timeout := defaultTraceTimeout + if config.Timeout != nil { + if timeout, err = time.ParseDuration(*config.Timeout); err != nil { + return nil, err + } + } + // Constuct the JavaScript tracer to execute with + if tracer, err = tracers.New(*config.Tracer); err != nil { + return nil, err + } + // Handle timeouts and RPC cancellations + deadlineCtx, cancel := context.WithTimeout(ctx, timeout) + go func() { + <-deadlineCtx.Done() + tracer.(*tracers.Tracer).Stop(errors.New("execution timeout")) + }() + defer cancel() + + case config == nil: + tracer = vm.NewStructLogger(nil) + + default: + tracer = vm.NewStructLogger(config.LogConfig) + } + // Run the transaction with tracing enabled. + vmenv := vm.NewEVM(vmctx, statedb, api.eth.blockchain.Config(), vm.Config{Debug: true, Tracer: tracer}) + + ret, gas, failed, err := core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.Gas())) + if err != nil { + return nil, fmt.Errorf("tracing failed: %v", err) + } + // Depending on the tracer type, format and return the output + switch tracer := tracer.(type) { + case *vm.StructLogger: + return ðapi.ExecutionResult{ + Gas: gas, + Failed: failed, + ReturnValue: fmt.Sprintf("%x", ret), + StructLogs: ethapi.FormatLogs(tracer.StructLogs()), + }, nil + + case *tracers.Tracer: + return tracer.GetResult() + + default: + panic(fmt.Sprintf("bad tracer type %T", tracer)) + } +} + +// computeTxEnv returns the execution environment of a certain transaction. +func (api *PrivateDebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, reexec uint64) (core.Message, vm.Context, *state.StateDB, error) { + // Create the parent state database + block := api.eth.blockchain.GetBlockByHash(blockHash) + if block == nil { + return nil, vm.Context{}, nil, fmt.Errorf("block %#x not found", blockHash) + } + parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1) + if parent == nil { + return nil, vm.Context{}, nil, fmt.Errorf("parent %#x not found", block.ParentHash()) + } + statedb, err := api.computeStateDB(parent, reexec) + if err != nil { + return nil, vm.Context{}, nil, err + } + + if txIndex == 0 && len(block.Transactions()) == 0 { + return nil, vm.Context{}, statedb, nil + } + + // Recompute transactions up to the target index. + signer := types.MakeSigner(api.eth.blockchain.Config(), block.Number()) + + for idx, tx := range block.Transactions() { + // Assemble the transaction call message and return if the requested offset + msg, _ := tx.AsMessage(signer) + context := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil) + if idx == txIndex { + return msg, context, statedb, nil + } + // Not yet the searched for transaction, execute on top of the current state + vmenv := vm.NewEVM(context, statedb, api.eth.blockchain.Config(), vm.Config{}) + if _, _, _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil { + return nil, vm.Context{}, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err) + } + // Ensure any modifications are committed to the state + // Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect + statedb.Finalise(vmenv.ChainConfig().IsEIP158(block.Number())) + } + return nil, vm.Context{}, nil, fmt.Errorf("transaction index %d out of range for block %#x", txIndex, blockHash) +} diff --git a/vendor/github.com/ethereum/go-ethereum/eth/backend.go b/vendor/github.com/ethereum/go-ethereum/eth/backend.go index f3c7b58d..f46fde65 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/backend.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/backend.go @@ -26,6 +26,7 @@ import ( "sync/atomic" "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus" @@ -46,6 +47,7 @@ import ( "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" @@ -57,6 +59,7 @@ type LesServer interface { APIs() []rpc.API Protocols() []p2p.Protocol SetBloomBitsIndexer(bbIndexer *core.ChainIndexer) + SetContractBackend(bind.ContractBackend) } // Ethereum implements the Ethereum full node service. @@ -64,7 +67,9 @@ type Ethereum struct { config *Config // Channel for shutting down the service - shutdownChan chan bool // Channel for shutting down the Ethereum + shutdownChan chan bool + + server *p2p.Server // Handlers txPool *core.TxPool @@ -99,6 +104,14 @@ func (s *Ethereum) AddLesServer(ls LesServer) { ls.SetBloomBitsIndexer(s.bloomIndexer) } +// SetClient sets a rpc client which connecting to our local node. +func (s *Ethereum) SetContractBackend(backend bind.ContractBackend) { + // Pass the rpc client to les server if it is enabled. + if s.lesServer != nil { + s.lesServer.SetContractBackend(backend) + } +} + // New creates a new Ethereum object (including the // initialisation of the common Ethereum object) func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { @@ -124,7 +137,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { if err != nil { return nil, err } - chainConfig, genesisHash, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, config.Genesis, config.ConstantinopleOverride) + chainConfig, genesisHash, genesisErr := core.SetupGenesisBlock(chainDb, config.Genesis) if _, ok := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !ok { return nil, genesisErr } @@ -193,7 +206,11 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { // Permit the downloader to use the trie cache allowance during fast sync cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit - if eth.protocolManager, err = NewProtocolManager(chainConfig, config.SyncMode, config.NetworkId, eth.eventMux, eth.txPool, eth.engine, eth.blockchain, chainDb, cacheLimit, config.Whitelist); err != nil { + checkpoint := config.Checkpoint + if checkpoint == nil { + checkpoint = params.TrustedCheckpoints[genesisHash] + } + if eth.protocolManager, err = NewProtocolManager(chainConfig, checkpoint, config.SyncMode, config.NetworkId, eth.eventMux, eth.txPool, eth.engine, eth.blockchain, chainDb, cacheLimit, config.Whitelist); err != nil { return nil, err } eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) @@ -269,6 +286,11 @@ func (s *Ethereum) APIs() []rpc.API { // Append any APIs exposed explicitly by the consensus engine apis = append(apis, s.engine.APIs(s.BlockChain())...) + // Append any APIs exposed explicitly by the les server + if s.lesServer != nil { + apis = append(apis, s.lesServer.APIs()...) + } + // Append all the local APIs and return return append(apis, []rpc.API{ { @@ -478,7 +500,7 @@ func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } func (s *Ethereum) Engine() consensus.Engine { return s.engine } func (s *Ethereum) ChainDb() ethdb.Database { return s.chainDb } func (s *Ethereum) IsListening() bool { return true } // Always listening -func (s *Ethereum) EthVersion() int { return int(s.protocolManager.SubProtocols[0].Version) } +func (s *Ethereum) EthVersion() int { return int(ProtocolVersions[0]) } func (s *Ethereum) NetVersion() uint64 { return s.networkID } func (s *Ethereum) Downloader() *downloader.Downloader { return s.protocolManager.downloader } func (s *Ethereum) Synced() bool { return atomic.LoadUint32(&s.protocolManager.acceptTxs) == 1 } @@ -487,15 +509,22 @@ func (s *Ethereum) ArchiveMode() bool { return s.config.NoPruni // Protocols implements node.Service, returning all the currently configured // network protocols to start. func (s *Ethereum) Protocols() []p2p.Protocol { - if s.lesServer == nil { - return s.protocolManager.SubProtocols + protos := make([]p2p.Protocol, len(ProtocolVersions)) + for i, vsn := range ProtocolVersions { + protos[i] = s.protocolManager.makeProtocol(vsn) + protos[i].Attributes = []enr.Entry{s.currentEthEntry()} } - return append(s.protocolManager.SubProtocols, s.lesServer.Protocols()...) + if s.lesServer != nil { + protos = append(protos, s.lesServer.Protocols()...) + } + return protos } // Start implements node.Service, starting all internal goroutines needed by the // Ethereum protocol implementation. func (s *Ethereum) Start(srvr *p2p.Server) error { + s.startEthEntryUpdate(srvr.LocalNode()) + // Start the bloom bits servicing goroutines s.startBloomHandlers(params.BloomBitsBlocks) diff --git a/vendor/github.com/ethereum/go-ethereum/eth/config.go b/vendor/github.com/ethereum/go-ethereum/eth/config.go index cd1d6c28..e67e060c 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/config.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/config.go @@ -43,12 +43,13 @@ var DefaultConfig = Config{ DatasetsInMem: 1, DatasetsOnDisk: 2, }, - NetworkId: 1, - LightPeers: 100, - DatabaseCache: 512, - TrieCleanCache: 256, - TrieDirtyCache: 256, - TrieTimeout: 60 * time.Minute, + NetworkId: 1, + LightPeers: 100, + UltraLightFraction: 75, + DatabaseCache: 512, + TrieCleanCache: 256, + TrieDirtyCache: 256, + TrieTimeout: 60 * time.Minute, Miner: miner.Config{ GasFloor: 8000000, GasCeil: 8000000, @@ -103,14 +104,15 @@ type Config struct { Whitelist map[uint64]common.Hash `toml:"-"` // Light client options - LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests - LightBandwidthIn int `toml:",omitempty"` // Incoming bandwidth limit for light servers - LightBandwidthOut int `toml:",omitempty"` // Outgoing bandwidth limit for light servers - LightPeers int `toml:",omitempty"` // Maximum number of LES client peers - OnlyAnnounce bool // Maximum number of LES client peers + LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests + LightIngress int `toml:",omitempty"` // Incoming bandwidth limit for light servers + LightEgress int `toml:",omitempty"` // Outgoing bandwidth limit for light servers + LightPeers int `toml:",omitempty"` // Maximum number of LES client peers // Ultra Light client options - ULC *ULCConfig `toml:",omitempty"` + UltraLightServers []string `toml:",omitempty"` // List of trusted ultra light servers + UltraLightFraction int `toml:",omitempty"` // Percentage of trusted servers to accept an announcement + UltraLightOnlyAnnounce bool `toml:",omitempty"` // Whether to only announce headers, or also serve them // Database options SkipBcVersionCheck bool `toml:"-"` @@ -146,11 +148,14 @@ type Config struct { // Type of the EVM interpreter ("" for default) EVMInterpreter string - // Constantinople block override (TODO: remove after the fork) - ConstantinopleOverride *big.Int - // RPCGasCap is the global gas cap for eth-call variants. RPCGasCap *big.Int `toml:",omitempty"` + // Checkpoint is a hardcoded checkpoint which can be nil. + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` + + // CheckpointOracle is the configuration for checkpoint oracle. + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` + StateDiff bool } diff --git a/vendor/github.com/ethereum/go-ethereum/eth/enr_entry.go b/vendor/github.com/ethereum/go-ethereum/eth/enr_entry.go new file mode 100644 index 00000000..d9e7b957 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/eth/enr_entry.go @@ -0,0 +1,61 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package eth + +import ( + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/forkid" + "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ethereum/go-ethereum/rlp" +) + +// ethEntry is the "eth" ENR entry which advertises eth protocol +// on the discovery network. +type ethEntry struct { + ForkID forkid.ID // Fork identifier per EIP-2124 + + // Ignore additional fields (for forward compatibility). + Rest []rlp.RawValue `rlp:"tail"` +} + +// ENRKey implements enr.Entry. +func (e ethEntry) ENRKey() string { + return "eth" +} + +func (eth *Ethereum) startEthEntryUpdate(ln *enode.LocalNode) { + var newHead = make(chan core.ChainHeadEvent, 10) + sub := eth.blockchain.SubscribeChainHeadEvent(newHead) + + go func() { + defer sub.Unsubscribe() + for { + select { + case <-newHead: + ln.Set(eth.currentEthEntry()) + case <-sub.Err(): + // Would be nice to sync with eth.Stop, but there is no + // good way to do that. + return + } + } + }() +} + +func (eth *Ethereum) currentEthEntry() *ethEntry { + return ðEntry{ForkID: forkid.NewID(eth.blockchain)} +} diff --git a/vendor/github.com/ethereum/go-ethereum/eth/fetcher/fetcher.go b/vendor/github.com/ethereum/go-ethereum/eth/fetcher/fetcher.go new file mode 100644 index 00000000..28c532d9 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/eth/fetcher/fetcher.go @@ -0,0 +1,734 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package fetcher contains the block announcement based synchronisation. +package fetcher + +import ( + "errors" + "math/rand" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/prque" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/log" +) + +const ( + arriveTimeout = 500 * time.Millisecond // Time allowance before an announced block is explicitly requested + gatherSlack = 100 * time.Millisecond // Interval used to collate almost-expired announces with fetches + fetchTimeout = 5 * time.Second // Maximum allotted time to return an explicitly requested block + maxUncleDist = 7 // Maximum allowed backward distance from the chain head + maxQueueDist = 32 // Maximum allowed distance from the chain head to queue + hashLimit = 256 // Maximum number of unique blocks a peer may have announced + blockLimit = 64 // Maximum number of unique blocks a peer may have delivered +) + +var ( + errTerminated = errors.New("terminated") +) + +// blockRetrievalFn is a callback type for retrieving a block from the local chain. +type blockRetrievalFn func(common.Hash) *types.Block + +// headerRequesterFn is a callback type for sending a header retrieval request. +type headerRequesterFn func(common.Hash) error + +// bodyRequesterFn is a callback type for sending a body retrieval request. +type bodyRequesterFn func([]common.Hash) error + +// headerVerifierFn is a callback type to verify a block's header for fast propagation. +type headerVerifierFn func(header *types.Header) error + +// blockBroadcasterFn is a callback type for broadcasting a block to connected peers. +type blockBroadcasterFn func(block *types.Block, propagate bool) + +// chainHeightFn is a callback type to retrieve the current chain height. +type chainHeightFn func() uint64 + +// chainInsertFn is a callback type to insert a batch of blocks into the local chain. +type chainInsertFn func(types.Blocks) (int, error) + +// peerDropFn is a callback type for dropping a peer detected as malicious. +type peerDropFn func(id string) + +// announce is the hash notification of the availability of a new block in the +// network. +type announce struct { + hash common.Hash // Hash of the block being announced + number uint64 // Number of the block being announced (0 = unknown | old protocol) + header *types.Header // Header of the block partially reassembled (new protocol) + time time.Time // Timestamp of the announcement + + origin string // Identifier of the peer originating the notification + + fetchHeader headerRequesterFn // Fetcher function to retrieve the header of an announced block + fetchBodies bodyRequesterFn // Fetcher function to retrieve the body of an announced block +} + +// headerFilterTask represents a batch of headers needing fetcher filtering. +type headerFilterTask struct { + peer string // The source peer of block headers + headers []*types.Header // Collection of headers to filter + time time.Time // Arrival time of the headers +} + +// bodyFilterTask represents a batch of block bodies (transactions and uncles) +// needing fetcher filtering. +type bodyFilterTask struct { + peer string // The source peer of block bodies + transactions [][]*types.Transaction // Collection of transactions per block bodies + uncles [][]*types.Header // Collection of uncles per block bodies + time time.Time // Arrival time of the blocks' contents +} + +// inject represents a schedules import operation. +type inject struct { + origin string + block *types.Block +} + +// Fetcher is responsible for accumulating block announcements from various peers +// and scheduling them for retrieval. +type Fetcher struct { + // Various event channels + notify chan *announce + inject chan *inject + + headerFilter chan chan *headerFilterTask + bodyFilter chan chan *bodyFilterTask + + done chan common.Hash + quit chan struct{} + + // Announce states + announces map[string]int // Per peer announce counts to prevent memory exhaustion + announced map[common.Hash][]*announce // Announced blocks, scheduled for fetching + fetching map[common.Hash]*announce // Announced blocks, currently fetching + fetched map[common.Hash][]*announce // Blocks with headers fetched, scheduled for body retrieval + completing map[common.Hash]*announce // Blocks with headers, currently body-completing + + // Block cache + queue *prque.Prque // Queue containing the import operations (block number sorted) + queues map[string]int // Per peer block counts to prevent memory exhaustion + queued map[common.Hash]*inject // Set of already queued blocks (to dedupe imports) + + // Callbacks + getBlock blockRetrievalFn // Retrieves a block from the local chain + verifyHeader headerVerifierFn // Checks if a block's headers have a valid proof of work + broadcastBlock blockBroadcasterFn // Broadcasts a block to connected peers + chainHeight chainHeightFn // Retrieves the current chain's height + insertChain chainInsertFn // Injects a batch of blocks into the chain + dropPeer peerDropFn // Drops a peer for misbehaving + + // Testing hooks + announceChangeHook func(common.Hash, bool) // Method to call upon adding or deleting a hash from the announce list + queueChangeHook func(common.Hash, bool) // Method to call upon adding or deleting a block from the import queue + fetchingHook func([]common.Hash) // Method to call upon starting a block (eth/61) or header (eth/62) fetch + completingHook func([]common.Hash) // Method to call upon starting a block body fetch (eth/62) + importedHook func(*types.Block) // Method to call upon successful block import (both eth/61 and eth/62) +} + +// New creates a block fetcher to retrieve blocks based on hash announcements. +func New(getBlock blockRetrievalFn, verifyHeader headerVerifierFn, broadcastBlock blockBroadcasterFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn) *Fetcher { + return &Fetcher{ + notify: make(chan *announce), + inject: make(chan *inject), + headerFilter: make(chan chan *headerFilterTask), + bodyFilter: make(chan chan *bodyFilterTask), + done: make(chan common.Hash), + quit: make(chan struct{}), + announces: make(map[string]int), + announced: make(map[common.Hash][]*announce), + fetching: make(map[common.Hash]*announce), + fetched: make(map[common.Hash][]*announce), + completing: make(map[common.Hash]*announce), + queue: prque.New(nil), + queues: make(map[string]int), + queued: make(map[common.Hash]*inject), + getBlock: getBlock, + verifyHeader: verifyHeader, + broadcastBlock: broadcastBlock, + chainHeight: chainHeight, + insertChain: insertChain, + dropPeer: dropPeer, + } +} + +// Start boots up the announcement based synchroniser, accepting and processing +// hash notifications and block fetches until termination requested. +func (f *Fetcher) Start() { + go f.loop() +} + +// Stop terminates the announcement based synchroniser, canceling all pending +// operations. +func (f *Fetcher) Stop() { + close(f.quit) +} + +// Notify announces the fetcher of the potential availability of a new block in +// the network. +func (f *Fetcher) Notify(peer string, hash common.Hash, number uint64, time time.Time, + headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn) error { + block := &announce{ + hash: hash, + number: number, + time: time, + origin: peer, + fetchHeader: headerFetcher, + fetchBodies: bodyFetcher, + } + select { + case f.notify <- block: + return nil + case <-f.quit: + return errTerminated + } +} + +// Enqueue tries to fill gaps the fetcher's future import queue. +func (f *Fetcher) Enqueue(peer string, block *types.Block) error { + op := &inject{ + origin: peer, + block: block, + } + select { + case f.inject <- op: + return nil + case <-f.quit: + return errTerminated + } +} + +// FilterHeaders extracts all the headers that were explicitly requested by the fetcher, +// returning those that should be handled differently. +func (f *Fetcher) FilterHeaders(peer string, headers []*types.Header, time time.Time) []*types.Header { + log.Trace("Filtering headers", "peer", peer, "headers", len(headers)) + + // Send the filter channel to the fetcher + filter := make(chan *headerFilterTask) + + select { + case f.headerFilter <- filter: + case <-f.quit: + return nil + } + // Request the filtering of the header list + select { + case filter <- &headerFilterTask{peer: peer, headers: headers, time: time}: + case <-f.quit: + return nil + } + // Retrieve the headers remaining after filtering + select { + case task := <-filter: + return task.headers + case <-f.quit: + return nil + } +} + +// FilterBodies extracts all the block bodies that were explicitly requested by +// the fetcher, returning those that should be handled differently. +func (f *Fetcher) FilterBodies(peer string, transactions [][]*types.Transaction, uncles [][]*types.Header, time time.Time) ([][]*types.Transaction, [][]*types.Header) { + log.Trace("Filtering bodies", "peer", peer, "txs", len(transactions), "uncles", len(uncles)) + + // Send the filter channel to the fetcher + filter := make(chan *bodyFilterTask) + + select { + case f.bodyFilter <- filter: + case <-f.quit: + return nil, nil + } + // Request the filtering of the body list + select { + case filter <- &bodyFilterTask{peer: peer, transactions: transactions, uncles: uncles, time: time}: + case <-f.quit: + return nil, nil + } + // Retrieve the bodies remaining after filtering + select { + case task := <-filter: + return task.transactions, task.uncles + case <-f.quit: + return nil, nil + } +} + +// Loop is the main fetcher loop, checking and processing various notification +// events. +func (f *Fetcher) loop() { + // Iterate the block fetching until a quit is requested + fetchTimer := time.NewTimer(0) + completeTimer := time.NewTimer(0) + + for { + // Clean up any expired block fetches + for hash, announce := range f.fetching { + if time.Since(announce.time) > fetchTimeout { + f.forgetHash(hash) + } + } + // Import any queued blocks that could potentially fit + height := f.chainHeight() + for !f.queue.Empty() { + op := f.queue.PopItem().(*inject) + hash := op.block.Hash() + if f.queueChangeHook != nil { + f.queueChangeHook(hash, false) + } + // If too high up the chain or phase, continue later + number := op.block.NumberU64() + if number > height+1 { + f.queue.Push(op, -int64(number)) + if f.queueChangeHook != nil { + f.queueChangeHook(hash, true) + } + break + } + // Otherwise if fresh and still unknown, try and import + if number+maxUncleDist < height || f.getBlock(hash) != nil { + f.forgetBlock(hash) + continue + } + f.insert(op.origin, op.block) + } + // Wait for an outside event to occur + select { + case <-f.quit: + // Fetcher terminating, abort all operations + return + + case notification := <-f.notify: + // A block was announced, make sure the peer isn't DOSing us + propAnnounceInMeter.Mark(1) + + count := f.announces[notification.origin] + 1 + if count > hashLimit { + log.Debug("Peer exceeded outstanding announces", "peer", notification.origin, "limit", hashLimit) + propAnnounceDOSMeter.Mark(1) + break + } + // If we have a valid block number, check that it's potentially useful + if notification.number > 0 { + if dist := int64(notification.number) - int64(f.chainHeight()); dist < -maxUncleDist || dist > maxQueueDist { + log.Debug("Peer discarded announcement", "peer", notification.origin, "number", notification.number, "hash", notification.hash, "distance", dist) + propAnnounceDropMeter.Mark(1) + break + } + } + // All is well, schedule the announce if block's not yet downloading + if _, ok := f.fetching[notification.hash]; ok { + break + } + if _, ok := f.completing[notification.hash]; ok { + break + } + f.announces[notification.origin] = count + f.announced[notification.hash] = append(f.announced[notification.hash], notification) + if f.announceChangeHook != nil && len(f.announced[notification.hash]) == 1 { + f.announceChangeHook(notification.hash, true) + } + if len(f.announced) == 1 { + f.rescheduleFetch(fetchTimer) + } + + case op := <-f.inject: + // A direct block insertion was requested, try and fill any pending gaps + propBroadcastInMeter.Mark(1) + f.enqueue(op.origin, op.block) + + case hash := <-f.done: + // A pending import finished, remove all traces of the notification + f.forgetHash(hash) + f.forgetBlock(hash) + + case <-fetchTimer.C: + // At least one block's timer ran out, check for needing retrieval + request := make(map[string][]common.Hash) + + for hash, announces := range f.announced { + if time.Since(announces[0].time) > arriveTimeout-gatherSlack { + // Pick a random peer to retrieve from, reset all others + announce := announces[rand.Intn(len(announces))] + f.forgetHash(hash) + + // If the block still didn't arrive, queue for fetching + if f.getBlock(hash) == nil { + request[announce.origin] = append(request[announce.origin], hash) + f.fetching[hash] = announce + } + } + } + // Send out all block header requests + for peer, hashes := range request { + log.Trace("Fetching scheduled headers", "peer", peer, "list", hashes) + + // Create a closure of the fetch and schedule in on a new thread + fetchHeader, hashes := f.fetching[hashes[0]].fetchHeader, hashes + go func() { + if f.fetchingHook != nil { + f.fetchingHook(hashes) + } + for _, hash := range hashes { + headerFetchMeter.Mark(1) + fetchHeader(hash) // Suboptimal, but protocol doesn't allow batch header retrievals + } + }() + } + // Schedule the next fetch if blocks are still pending + f.rescheduleFetch(fetchTimer) + + case <-completeTimer.C: + // At least one header's timer ran out, retrieve everything + request := make(map[string][]common.Hash) + + for hash, announces := range f.fetched { + // Pick a random peer to retrieve from, reset all others + announce := announces[rand.Intn(len(announces))] + f.forgetHash(hash) + + // If the block still didn't arrive, queue for completion + if f.getBlock(hash) == nil { + request[announce.origin] = append(request[announce.origin], hash) + f.completing[hash] = announce + } + } + // Send out all block body requests + for peer, hashes := range request { + log.Trace("Fetching scheduled bodies", "peer", peer, "list", hashes) + + // Create a closure of the fetch and schedule in on a new thread + if f.completingHook != nil { + f.completingHook(hashes) + } + bodyFetchMeter.Mark(int64(len(hashes))) + go f.completing[hashes[0]].fetchBodies(hashes) + } + // Schedule the next fetch if blocks are still pending + f.rescheduleComplete(completeTimer) + + case filter := <-f.headerFilter: + // Headers arrived from a remote peer. Extract those that were explicitly + // requested by the fetcher, and return everything else so it's delivered + // to other parts of the system. + var task *headerFilterTask + select { + case task = <-filter: + case <-f.quit: + return + } + headerFilterInMeter.Mark(int64(len(task.headers))) + + // Split the batch of headers into unknown ones (to return to the caller), + // known incomplete ones (requiring body retrievals) and completed blocks. + unknown, incomplete, complete := []*types.Header{}, []*announce{}, []*types.Block{} + for _, header := range task.headers { + hash := header.Hash() + + // Filter fetcher-requested headers from other synchronisation algorithms + if announce := f.fetching[hash]; announce != nil && announce.origin == task.peer && f.fetched[hash] == nil && f.completing[hash] == nil && f.queued[hash] == nil { + // If the delivered header does not match the promised number, drop the announcer + if header.Number.Uint64() != announce.number { + log.Trace("Invalid block number fetched", "peer", announce.origin, "hash", header.Hash(), "announced", announce.number, "provided", header.Number) + f.dropPeer(announce.origin) + f.forgetHash(hash) + continue + } + // Only keep if not imported by other means + if f.getBlock(hash) == nil { + announce.header = header + announce.time = task.time + + // If the block is empty (header only), short circuit into the final import queue + if header.TxHash == types.DeriveSha(types.Transactions{}) && header.UncleHash == types.CalcUncleHash([]*types.Header{}) { + log.Trace("Block empty, skipping body retrieval", "peer", announce.origin, "number", header.Number, "hash", header.Hash()) + + block := types.NewBlockWithHeader(header) + block.ReceivedAt = task.time + + complete = append(complete, block) + f.completing[hash] = announce + continue + } + // Otherwise add to the list of blocks needing completion + incomplete = append(incomplete, announce) + } else { + log.Trace("Block already imported, discarding header", "peer", announce.origin, "number", header.Number, "hash", header.Hash()) + f.forgetHash(hash) + } + } else { + // Fetcher doesn't know about it, add to the return list + unknown = append(unknown, header) + } + } + headerFilterOutMeter.Mark(int64(len(unknown))) + select { + case filter <- &headerFilterTask{headers: unknown, time: task.time}: + case <-f.quit: + return + } + // Schedule the retrieved headers for body completion + for _, announce := range incomplete { + hash := announce.header.Hash() + if _, ok := f.completing[hash]; ok { + continue + } + f.fetched[hash] = append(f.fetched[hash], announce) + if len(f.fetched) == 1 { + f.rescheduleComplete(completeTimer) + } + } + // Schedule the header-only blocks for import + for _, block := range complete { + if announce := f.completing[block.Hash()]; announce != nil { + f.enqueue(announce.origin, block) + } + } + + case filter := <-f.bodyFilter: + // Block bodies arrived, extract any explicitly requested blocks, return the rest + var task *bodyFilterTask + select { + case task = <-filter: + case <-f.quit: + return + } + bodyFilterInMeter.Mark(int64(len(task.transactions))) + + blocks := []*types.Block{} + for i := 0; i < len(task.transactions) && i < len(task.uncles); i++ { + // Match up a body to any possible completion request + matched := false + + for hash, announce := range f.completing { + if f.queued[hash] == nil { + txnHash := types.DeriveSha(types.Transactions(task.transactions[i])) + uncleHash := types.CalcUncleHash(task.uncles[i]) + + if txnHash == announce.header.TxHash && uncleHash == announce.header.UncleHash && announce.origin == task.peer { + // Mark the body matched, reassemble if still unknown + matched = true + + if f.getBlock(hash) == nil { + block := types.NewBlockWithHeader(announce.header).WithBody(task.transactions[i], task.uncles[i]) + block.ReceivedAt = task.time + + blocks = append(blocks, block) + } else { + f.forgetHash(hash) + } + } + } + } + if matched { + task.transactions = append(task.transactions[:i], task.transactions[i+1:]...) + task.uncles = append(task.uncles[:i], task.uncles[i+1:]...) + i-- + continue + } + } + + bodyFilterOutMeter.Mark(int64(len(task.transactions))) + select { + case filter <- task: + case <-f.quit: + return + } + // Schedule the retrieved blocks for ordered import + for _, block := range blocks { + if announce := f.completing[block.Hash()]; announce != nil { + f.enqueue(announce.origin, block) + } + } + } + } +} + +// rescheduleFetch resets the specified fetch timer to the next announce timeout. +func (f *Fetcher) rescheduleFetch(fetch *time.Timer) { + // Short circuit if no blocks are announced + if len(f.announced) == 0 { + return + } + // Otherwise find the earliest expiring announcement + earliest := time.Now() + for _, announces := range f.announced { + if earliest.After(announces[0].time) { + earliest = announces[0].time + } + } + fetch.Reset(arriveTimeout - time.Since(earliest)) +} + +// rescheduleComplete resets the specified completion timer to the next fetch timeout. +func (f *Fetcher) rescheduleComplete(complete *time.Timer) { + // Short circuit if no headers are fetched + if len(f.fetched) == 0 { + return + } + // Otherwise find the earliest expiring announcement + earliest := time.Now() + for _, announces := range f.fetched { + if earliest.After(announces[0].time) { + earliest = announces[0].time + } + } + complete.Reset(gatherSlack - time.Since(earliest)) +} + +// enqueue schedules a new future import operation, if the block to be imported +// has not yet been seen. +func (f *Fetcher) enqueue(peer string, block *types.Block) { + hash := block.Hash() + + // Ensure the peer isn't DOSing us + count := f.queues[peer] + 1 + if count > blockLimit { + log.Debug("Discarded propagated block, exceeded allowance", "peer", peer, "number", block.Number(), "hash", hash, "limit", blockLimit) + propBroadcastDOSMeter.Mark(1) + f.forgetHash(hash) + return + } + // Discard any past or too distant blocks + if dist := int64(block.NumberU64()) - int64(f.chainHeight()); dist < -maxUncleDist || dist > maxQueueDist { + log.Debug("Discarded propagated block, too far away", "peer", peer, "number", block.Number(), "hash", hash, "distance", dist) + propBroadcastDropMeter.Mark(1) + f.forgetHash(hash) + return + } + // Schedule the block for future importing + if _, ok := f.queued[hash]; !ok { + op := &inject{ + origin: peer, + block: block, + } + f.queues[peer] = count + f.queued[hash] = op + f.queue.Push(op, -int64(block.NumberU64())) + if f.queueChangeHook != nil { + f.queueChangeHook(op.block.Hash(), true) + } + log.Debug("Queued propagated block", "peer", peer, "number", block.Number(), "hash", hash, "queued", f.queue.Size()) + } +} + +// insert spawns a new goroutine to run a block insertion into the chain. If the +// block's number is at the same height as the current import phase, it updates +// the phase states accordingly. +func (f *Fetcher) insert(peer string, block *types.Block) { + hash := block.Hash() + + // Run the import on a new thread + log.Debug("Importing propagated block", "peer", peer, "number", block.Number(), "hash", hash) + go func() { + defer func() { f.done <- hash }() + + // If the parent's unknown, abort insertion + parent := f.getBlock(block.ParentHash()) + if parent == nil { + log.Debug("Unknown parent of propagated block", "peer", peer, "number", block.Number(), "hash", hash, "parent", block.ParentHash()) + return + } + // Quickly validate the header and propagate the block if it passes + switch err := f.verifyHeader(block.Header()); err { + case nil: + // All ok, quickly propagate to our peers + propBroadcastOutTimer.UpdateSince(block.ReceivedAt) + go f.broadcastBlock(block, true) + + case consensus.ErrFutureBlock: + // Weird future block, don't fail, but neither propagate + + default: + // Something went very wrong, drop the peer + log.Debug("Propagated block verification failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err) + f.dropPeer(peer) + return + } + // Run the actual import and log any issues + if _, err := f.insertChain(types.Blocks{block}); err != nil { + log.Debug("Propagated block import failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err) + return + } + // If import succeeded, broadcast the block + propAnnounceOutTimer.UpdateSince(block.ReceivedAt) + go f.broadcastBlock(block, false) + + // Invoke the testing hook if needed + if f.importedHook != nil { + f.importedHook(block) + } + }() +} + +// forgetHash removes all traces of a block announcement from the fetcher's +// internal state. +func (f *Fetcher) forgetHash(hash common.Hash) { + // Remove all pending announces and decrement DOS counters + for _, announce := range f.announced[hash] { + f.announces[announce.origin]-- + if f.announces[announce.origin] <= 0 { + delete(f.announces, announce.origin) + } + } + delete(f.announced, hash) + if f.announceChangeHook != nil { + f.announceChangeHook(hash, false) + } + // Remove any pending fetches and decrement the DOS counters + if announce := f.fetching[hash]; announce != nil { + f.announces[announce.origin]-- + if f.announces[announce.origin] <= 0 { + delete(f.announces, announce.origin) + } + delete(f.fetching, hash) + } + + // Remove any pending completion requests and decrement the DOS counters + for _, announce := range f.fetched[hash] { + f.announces[announce.origin]-- + if f.announces[announce.origin] <= 0 { + delete(f.announces, announce.origin) + } + } + delete(f.fetched, hash) + + // Remove any pending completions and decrement the DOS counters + if announce := f.completing[hash]; announce != nil { + f.announces[announce.origin]-- + if f.announces[announce.origin] <= 0 { + delete(f.announces, announce.origin) + } + delete(f.completing, hash) + } +} + +// forgetBlock removes all traces of a queued block from the fetcher's internal +// state. +func (f *Fetcher) forgetBlock(hash common.Hash) { + if insert := f.queued[hash]; insert != nil { + f.queues[insert.origin]-- + if f.queues[insert.origin] == 0 { + delete(f.queues, insert.origin) + } + delete(f.queued, hash) + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/eth/gen_config.go b/vendor/github.com/ethereum/go-ethereum/eth/gen_config.go index 178faf7c..bc4b55b1 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/gen_config.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/gen_config.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/gasprice" "github.com/ethereum/go-ethereum/miner" + "github.com/ethereum/go-ethereum/params" ) // MarshalTOML marshals as TOML. @@ -24,14 +25,16 @@ func (c Config) MarshalTOML() (interface{}, error) { NoPrefetch bool Whitelist map[uint64]common.Hash `toml:"-"` LightServ int `toml:",omitempty"` - LightBandwidthIn int `toml:",omitempty"` - LightBandwidthOut int `toml:",omitempty"` + LightIngress int `toml:",omitempty"` + LightEgress int `toml:",omitempty"` LightPeers int `toml:",omitempty"` - OnlyAnnounce bool - ULC *ULCConfig `toml:",omitempty"` - SkipBcVersionCheck bool `toml:"-"` - DatabaseHandles int `toml:"-"` + UltraLightServers []string `toml:",omitempty"` + UltraLightFraction int `toml:",omitempty"` + UltraLightOnlyAnnounce bool `toml:",omitempty"` + SkipBcVersionCheck bool `toml:"-"` + DatabaseHandles int `toml:"-"` DatabaseCache int + DatabaseFreezer string TrieCleanCache int TrieDirtyCache int TrieTimeout time.Duration @@ -43,8 +46,9 @@ func (c Config) MarshalTOML() (interface{}, error) { DocRoot string `toml:"-"` EWASMInterpreter string EVMInterpreter string - ConstantinopleOverride *big.Int - RPCGasCap *big.Int `toml:",omitempty"` + RPCGasCap *big.Int `toml:",omitempty"` + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` } var enc Config enc.Genesis = c.Genesis @@ -54,14 +58,16 @@ func (c Config) MarshalTOML() (interface{}, error) { enc.NoPrefetch = c.NoPrefetch enc.Whitelist = c.Whitelist enc.LightServ = c.LightServ - enc.LightBandwidthIn = c.LightBandwidthIn - enc.LightBandwidthOut = c.LightBandwidthOut + enc.LightIngress = c.LightIngress + enc.LightEgress = c.LightEgress enc.LightPeers = c.LightPeers - enc.OnlyAnnounce = c.OnlyAnnounce - enc.ULC = c.ULC + enc.UltraLightServers = c.UltraLightServers + enc.UltraLightFraction = c.UltraLightFraction + enc.UltraLightOnlyAnnounce = c.UltraLightOnlyAnnounce enc.SkipBcVersionCheck = c.SkipBcVersionCheck enc.DatabaseHandles = c.DatabaseHandles enc.DatabaseCache = c.DatabaseCache + enc.DatabaseFreezer = c.DatabaseFreezer enc.TrieCleanCache = c.TrieCleanCache enc.TrieDirtyCache = c.TrieDirtyCache enc.TrieTimeout = c.TrieTimeout @@ -73,8 +79,9 @@ func (c Config) MarshalTOML() (interface{}, error) { enc.DocRoot = c.DocRoot enc.EWASMInterpreter = c.EWASMInterpreter enc.EVMInterpreter = c.EVMInterpreter - enc.ConstantinopleOverride = c.ConstantinopleOverride enc.RPCGasCap = c.RPCGasCap + enc.Checkpoint = c.Checkpoint + enc.CheckpointOracle = c.CheckpointOracle return &enc, nil } @@ -88,14 +95,16 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { NoPrefetch *bool Whitelist map[uint64]common.Hash `toml:"-"` LightServ *int `toml:",omitempty"` - LightBandwidthIn *int `toml:",omitempty"` - LightBandwidthOut *int `toml:",omitempty"` + LightIngress *int `toml:",omitempty"` + LightEgress *int `toml:",omitempty"` LightPeers *int `toml:",omitempty"` - OnlyAnnounce *bool - ULC *ULCConfig `toml:",omitempty"` - SkipBcVersionCheck *bool `toml:"-"` - DatabaseHandles *int `toml:"-"` + UltraLightServers []string `toml:",omitempty"` + UltraLightFraction *int `toml:",omitempty"` + UltraLightOnlyAnnounce *bool `toml:",omitempty"` + SkipBcVersionCheck *bool `toml:"-"` + DatabaseHandles *int `toml:"-"` DatabaseCache *int + DatabaseFreezer *string TrieCleanCache *int TrieDirtyCache *int TrieTimeout *time.Duration @@ -107,8 +116,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { DocRoot *string `toml:"-"` EWASMInterpreter *string EVMInterpreter *string - ConstantinopleOverride *big.Int - RPCGasCap *big.Int `toml:",omitempty"` + RPCGasCap *big.Int `toml:",omitempty"` + Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` + CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` } var dec Config if err := unmarshal(&dec); err != nil { @@ -135,20 +145,23 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.LightServ != nil { c.LightServ = *dec.LightServ } - if dec.LightBandwidthIn != nil { - c.LightBandwidthIn = *dec.LightBandwidthIn + if dec.LightIngress != nil { + c.LightIngress = *dec.LightIngress } - if dec.LightBandwidthOut != nil { - c.LightBandwidthOut = *dec.LightBandwidthOut + if dec.LightEgress != nil { + c.LightEgress = *dec.LightEgress } if dec.LightPeers != nil { c.LightPeers = *dec.LightPeers } - if dec.OnlyAnnounce != nil { - c.OnlyAnnounce = *dec.OnlyAnnounce + if dec.UltraLightServers != nil { + c.UltraLightServers = dec.UltraLightServers } - if dec.ULC != nil { - c.ULC = dec.ULC + if dec.UltraLightFraction != nil { + c.UltraLightFraction = *dec.UltraLightFraction + } + if dec.UltraLightOnlyAnnounce != nil { + c.UltraLightOnlyAnnounce = *dec.UltraLightOnlyAnnounce } if dec.SkipBcVersionCheck != nil { c.SkipBcVersionCheck = *dec.SkipBcVersionCheck @@ -159,6 +172,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.DatabaseCache != nil { c.DatabaseCache = *dec.DatabaseCache } + if dec.DatabaseFreezer != nil { + c.DatabaseFreezer = *dec.DatabaseFreezer + } if dec.TrieCleanCache != nil { c.TrieCleanCache = *dec.TrieCleanCache } @@ -192,11 +208,14 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.EVMInterpreter != nil { c.EVMInterpreter = *dec.EVMInterpreter } - if dec.ConstantinopleOverride != nil { - c.ConstantinopleOverride = dec.ConstantinopleOverride - } if dec.RPCGasCap != nil { c.RPCGasCap = dec.RPCGasCap } + if dec.Checkpoint != nil { + c.Checkpoint = dec.Checkpoint + } + if dec.CheckpointOracle != nil { + c.CheckpointOracle = dec.CheckpointOracle + } return nil } diff --git a/vendor/github.com/ethereum/go-ethereum/eth/handler.go b/vendor/github.com/ethereum/go-ethereum/eth/handler.go index 58add2ea..4ce2d1c8 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/handler.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/handler.go @@ -58,10 +58,6 @@ var ( syncChallengeTimeout = 15 * time.Second // Time allowance for a node to reply to the sync progress challenge ) -// errIncompatibleConfig is returned if the requested protocols and configs are -// not compatible (low protocol version restrictions and high requirements). -var errIncompatibleConfig = errors.New("incompatible configuration") - func errResp(code errCode, format string, v ...interface{}) error { return fmt.Errorf("%v - %v", code, fmt.Sprintf(format, v...)) } @@ -75,17 +71,14 @@ type ProtocolManager struct { checkpointNumber uint64 // Block number for the sync progress validator to cross reference checkpointHash common.Hash // Block hash for the sync progress validator to cross reference - txpool txPool - blockchain *core.BlockChain - chainconfig *params.ChainConfig - maxPeers int + txpool txPool + blockchain *core.BlockChain + maxPeers int downloader *downloader.Downloader fetcher *fetcher.Fetcher peers *peerSet - SubProtocols []p2p.Protocol - eventMux *event.TypeMux txsCh chan core.NewTxsEvent txsSub event.Subscription @@ -106,14 +99,13 @@ type ProtocolManager struct { // NewProtocolManager returns a new Ethereum sub protocol manager. The Ethereum sub protocol manages peers capable // with the Ethereum network. -func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkID uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb ethdb.Database, cacheLimit int, whitelist map[uint64]common.Hash) (*ProtocolManager, error) { +func NewProtocolManager(config *params.ChainConfig, checkpoint *params.TrustedCheckpoint, mode downloader.SyncMode, networkID uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb ethdb.Database, cacheLimit int, whitelist map[uint64]common.Hash) (*ProtocolManager, error) { // Create the protocol manager with the base fields manager := &ProtocolManager{ networkID: networkID, eventMux: mux, txpool: txpool, blockchain: blockchain, - chainconfig: config, peers: newPeerSet(), whitelist: whitelist, newPeerCh: make(chan *peer), @@ -121,54 +113,35 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne txsyncCh: make(chan *txsync), quitSync: make(chan struct{}), } - // If fast sync was requested and our database is empty, grant it - if mode == downloader.FastSync && blockchain.CurrentBlock().NumberU64() == 0 { - manager.fastSync = uint32(1) + if mode == downloader.FullSync { + // The database seems empty as the current block is the genesis. Yet the fast + // block is ahead, so fast sync was enabled for this node at a certain point. + // The scenarios where this can happen is + // * if the user manually (or via a bad block) rolled back a fast sync node + // below the sync point. + // * the last fast sync is not finished while user specifies a full sync this + // time. But we don't have any recent state for full sync. + // In these cases however it's safe to reenable fast sync. + fullBlock, fastBlock := blockchain.CurrentBlock(), blockchain.CurrentFastBlock() + if fullBlock.NumberU64() == 0 && fastBlock.NumberU64() > 0 { + manager.fastSync = uint32(1) + log.Warn("Switch sync mode from full sync to fast sync") + } + } else { + if blockchain.CurrentBlock().NumberU64() > 0 { + // Print warning log if database is not empty to run fast sync. + log.Warn("Switch sync mode from fast sync to full sync") + } else { + // If fast sync was requested and our database is empty, grant it + manager.fastSync = uint32(1) + } } // If we have trusted checkpoints, enforce them on the chain - if checkpoint, ok := params.TrustedCheckpoints[blockchain.Genesis().Hash()]; ok { + if checkpoint != nil { manager.checkpointNumber = (checkpoint.SectionIndex+1)*params.CHTFrequency - 1 manager.checkpointHash = checkpoint.SectionHead } - // Initiate a sub-protocol for every implemented version we can handle - manager.SubProtocols = make([]p2p.Protocol, 0, len(ProtocolVersions)) - for i, version := range ProtocolVersions { - // Skip protocol version if incompatible with the mode of operation - // TODO(karalabe): hard-drop eth/62 from the code base - if atomic.LoadUint32(&manager.fastSync) == 1 && version < eth63 { - continue - } - // Compatible; initialise the sub-protocol - version := version // Closure for the run - manager.SubProtocols = append(manager.SubProtocols, p2p.Protocol{ - Name: ProtocolName, - Version: version, - Length: ProtocolLengths[i], - Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error { - peer := manager.newPeer(int(version), p, rw) - select { - case manager.newPeerCh <- peer: - manager.wg.Add(1) - defer manager.wg.Done() - return manager.handle(peer) - case <-manager.quitSync: - return p2p.DiscQuitting - } - }, - NodeInfo: func() interface{} { - return manager.NodeInfo() - }, - PeerInfo: func(id enode.ID) interface{} { - if p := manager.peers.Peer(fmt.Sprintf("%x", id[:8])); p != nil { - return p.Info() - } - return nil - }, - }) - } - if len(manager.SubProtocols) == 0 { - return nil, errIncompatibleConfig - } + // Construct the downloader (long sync) and its backing state bloom if fast // sync is requested. The downloader is responsible for deallocating the state // bloom when it's done. @@ -216,6 +189,39 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne return manager, nil } +func (pm *ProtocolManager) makeProtocol(version uint) p2p.Protocol { + length, ok := protocolLengths[version] + if !ok { + panic("makeProtocol for unknown version") + } + + return p2p.Protocol{ + Name: protocolName, + Version: version, + Length: length, + Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error { + peer := pm.newPeer(int(version), p, rw) + select { + case pm.newPeerCh <- peer: + pm.wg.Add(1) + defer pm.wg.Done() + return pm.handle(peer) + case <-pm.quitSync: + return p2p.DiscQuitting + } + }, + NodeInfo: func() interface{} { + return pm.NodeInfo() + }, + PeerInfo: func(id enode.ID) interface{} { + if p := pm.peers.Peer(fmt.Sprintf("%x", id[:8])); p != nil { + return p.Info() + } + return nil + }, + } +} + func (pm *ProtocolManager) removePeer(id string) { // Short circuit if the peer was already removed peer := pm.peers.Peer(id) @@ -362,8 +368,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { if err != nil { return err } - if msg.Size > ProtocolMaxMsgSize { - return errResp(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + if msg.Size > protocolMaxMsgSize { + return errResp(ErrMsgTooLarge, "%v > %v", msg.Size, protocolMaxMsgSize) } defer msg.Discard() @@ -678,6 +684,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { if err := msg.Decode(&request); err != nil { return errResp(ErrDecode, "%v: %v", msg, err) } + if err := request.sanityCheck(); err != nil { + return err + } request.Block.ReceivedAt = msg.ReceivedAt request.Block.ReceivedFrom = p diff --git a/vendor/github.com/ethereum/go-ethereum/eth/peer.go b/vendor/github.com/ethereum/go-ethereum/eth/peer.go index 208badc5..814c787b 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/peer.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/peer.go @@ -394,8 +394,8 @@ func (p *peer) readStatus(network uint64, status *statusData, genesis common.Has if msg.Code != StatusMsg { return errResp(ErrNoStatusMsg, "first msg has code %x (!= %x)", msg.Code, StatusMsg) } - if msg.Size > ProtocolMaxMsgSize { - return errResp(ErrMsgTooLarge, "%v > %v", msg.Size, ProtocolMaxMsgSize) + if msg.Size > protocolMaxMsgSize { + return errResp(ErrMsgTooLarge, "%v > %v", msg.Size, protocolMaxMsgSize) } // Decode the handshake and make sure everything matches if err := msg.Decode(&status); err != nil { diff --git a/vendor/github.com/ethereum/go-ethereum/eth/protocol.go b/vendor/github.com/ethereum/go-ethereum/eth/protocol.go new file mode 100644 index 00000000..de0c979d --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/eth/protocol.go @@ -0,0 +1,196 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package eth + +import ( + "fmt" + "io" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/rlp" +) + +// Constants to match up protocol versions and messages +const ( + eth62 = 62 + eth63 = 63 +) + +// protocolName is the official short name of the protocol used during capability negotiation. +const protocolName = "eth" + +// ProtocolVersions are the supported versions of the eth protocol (first is primary). +var ProtocolVersions = []uint{eth63} + +// protocolLengths are the number of implemented message corresponding to different protocol versions. +var protocolLengths = map[uint]uint64{eth63: 17, eth62: 8} + +const protocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message + +// eth protocol message codes +const ( + // Protocol messages belonging to eth/62 + StatusMsg = 0x00 + NewBlockHashesMsg = 0x01 + TxMsg = 0x02 + GetBlockHeadersMsg = 0x03 + BlockHeadersMsg = 0x04 + GetBlockBodiesMsg = 0x05 + BlockBodiesMsg = 0x06 + NewBlockMsg = 0x07 + + // Protocol messages belonging to eth/63 + GetNodeDataMsg = 0x0d + NodeDataMsg = 0x0e + GetReceiptsMsg = 0x0f + ReceiptsMsg = 0x10 +) + +type errCode int + +const ( + ErrMsgTooLarge = iota + ErrDecode + ErrInvalidMsgCode + ErrProtocolVersionMismatch + ErrNetworkIdMismatch + ErrGenesisBlockMismatch + ErrNoStatusMsg + ErrExtraStatusMsg + ErrSuspendedPeer +) + +func (e errCode) String() string { + return errorToString[int(e)] +} + +// XXX change once legacy code is out +var errorToString = map[int]string{ + ErrMsgTooLarge: "Message too long", + ErrDecode: "Invalid message", + ErrInvalidMsgCode: "Invalid message code", + ErrProtocolVersionMismatch: "Protocol version mismatch", + ErrNetworkIdMismatch: "NetworkId mismatch", + ErrGenesisBlockMismatch: "Genesis block mismatch", + ErrNoStatusMsg: "No status message", + ErrExtraStatusMsg: "Extra status message", + ErrSuspendedPeer: "Suspended peer", +} + +type txPool interface { + // AddRemotes should add the given transactions to the pool. + AddRemotes([]*types.Transaction) []error + + // Pending should return pending transactions. + // The slice should be modifiable by the caller. + Pending() (map[common.Address]types.Transactions, error) + + // SubscribeNewTxsEvent should return an event subscription of + // NewTxsEvent and send events to the given channel. + SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription +} + +// statusData is the network packet for the status message. +type statusData struct { + ProtocolVersion uint32 + NetworkId uint64 + TD *big.Int + CurrentBlock common.Hash + GenesisBlock common.Hash +} + +// newBlockHashesData is the network packet for the block announcements. +type newBlockHashesData []struct { + Hash common.Hash // Hash of one particular block being announced + Number uint64 // Number of one particular block being announced +} + +// getBlockHeadersData represents a block header query. +type getBlockHeadersData struct { + Origin hashOrNumber // Block from which to retrieve headers + Amount uint64 // Maximum number of headers to retrieve + Skip uint64 // Blocks to skip between consecutive headers + Reverse bool // Query direction (false = rising towards latest, true = falling towards genesis) +} + +// hashOrNumber is a combined field for specifying an origin block. +type hashOrNumber struct { + Hash common.Hash // Block hash from which to retrieve headers (excludes Number) + Number uint64 // Block hash from which to retrieve headers (excludes Hash) +} + +// EncodeRLP is a specialized encoder for hashOrNumber to encode only one of the +// two contained union fields. +func (hn *hashOrNumber) EncodeRLP(w io.Writer) error { + if hn.Hash == (common.Hash{}) { + return rlp.Encode(w, hn.Number) + } + if hn.Number != 0 { + return fmt.Errorf("both origin hash (%x) and number (%d) provided", hn.Hash, hn.Number) + } + return rlp.Encode(w, hn.Hash) +} + +// DecodeRLP is a specialized decoder for hashOrNumber to decode the contents +// into either a block hash or a block number. +func (hn *hashOrNumber) DecodeRLP(s *rlp.Stream) error { + _, size, _ := s.Kind() + origin, err := s.Raw() + if err == nil { + switch { + case size == 32: + err = rlp.DecodeBytes(origin, &hn.Hash) + case size <= 8: + err = rlp.DecodeBytes(origin, &hn.Number) + default: + err = fmt.Errorf("invalid input size %d for origin", size) + } + } + return err +} + +// newBlockData is the network packet for the block propagation message. +type newBlockData struct { + Block *types.Block + TD *big.Int +} + +// sanityCheck verifies that the values are reasonable, as a DoS protection +func (request *newBlockData) sanityCheck() error { + if err := request.Block.SanityCheck(); err != nil { + return err + } + //TD at mainnet block #7753254 is 76 bits. If it becomes 100 million times + // larger, it will still fit within 100 bits + if tdlen := request.TD.BitLen(); tdlen > 100 { + return fmt.Errorf("too large block TD: bitlen %d", tdlen) + } + return nil +} + +// blockBody represents the data content of a single block. +type blockBody struct { + Transactions []*types.Transaction // Transactions contained within a block + Uncles []*types.Header // Uncles contained within a block +} + +// blockBodiesData is the network packet for block content distribution. +type blockBodiesData []*blockBody diff --git a/vendor/github.com/ethereum/go-ethereum/eth/sync.go b/vendor/github.com/ethereum/go-ethereum/eth/sync.go index e303ef8d..9e180ee2 100644 --- a/vendor/github.com/ethereum/go-ethereum/eth/sync.go +++ b/vendor/github.com/ethereum/go-ethereum/eth/sync.go @@ -179,14 +179,6 @@ func (pm *ProtocolManager) synchronise(peer *peer) { if atomic.LoadUint32(&pm.fastSync) == 1 { // Fast sync was explicitly requested, and explicitly granted mode = downloader.FastSync - } else if currentBlock.NumberU64() == 0 && pm.blockchain.CurrentFastBlock().NumberU64() > 0 { - // The database seems empty as the current block is the genesis. Yet the fast - // block is ahead, so fast sync was enabled for this node at a certain point. - // The only scenario where this can happen is if the user manually (or via a - // bad block) rolled back a fast sync node below the sync point. In this case - // however it's safe to reenable fast sync. - atomic.StoreUint32(&pm.fastSync, 1) - mode = downloader.FastSync } if mode == downloader.FastSync { // Make sure the peer's total difficulty we are synchronizing is higher. diff --git a/vendor/github.com/ethereum/go-ethereum/graphql/graphiql.go b/vendor/github.com/ethereum/go-ethereum/graphql/graphiql.go new file mode 100644 index 00000000..483d4cea --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/graphql/graphiql.go @@ -0,0 +1,120 @@ +// The MIT License (MIT) +// +// Copyright (c) 2016 Muhammed Thanish +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package graphql + +import ( + "bytes" + "fmt" + "net/http" +) + +// GraphiQL is an in-browser IDE for exploring GraphiQL APIs. +// This handler returns GraphiQL when requested. +// +// For more information, see https://github.com/graphql/graphiql. +type GraphiQL struct{} + +func respond(w http.ResponseWriter, body []byte, code int) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.Header().Set("X-Content-Type-Options", "nosniff") + w.WriteHeader(code) + _, _ = w.Write(body) +} + +func errorJSON(msg string) []byte { + buf := bytes.Buffer{} + fmt.Fprintf(&buf, `{"error": "%s"}`, msg) + return buf.Bytes() +} + +func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method != "GET" { + respond(w, errorJSON("only GET requests are supported"), http.StatusMethodNotAllowed) + return + } + + w.Write(graphiql) +} + +var graphiql = []byte(` + + + + + + + + + + + +
Loading...
+ + + +`) diff --git a/vendor/github.com/ethereum/go-ethereum/graphql/graphql.go b/vendor/github.com/ethereum/go-ethereum/graphql/graphql.go index d22a3afb..3f6bcab9 100644 --- a/vendor/github.com/ethereum/go-ethereum/graphql/graphql.go +++ b/vendor/github.com/ethereum/go-ethereum/graphql/graphql.go @@ -20,9 +20,6 @@ package graphql import ( "context" "errors" - "fmt" - "net" - "net/http" "time" "github.com/ethereum/go-ethereum" @@ -32,16 +29,10 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/internal/ethapi" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" - graphqlgo "github.com/graph-gophers/graphql-go" - "github.com/graph-gophers/graphql-go/relay" ) var OnlyOnMainChainError = errors.New("This operation is only available for blocks on the canonical chain.") @@ -49,7 +40,7 @@ var BlockInvariantError = errors.New("Block objects must be instantiated with at // Account represents an Ethereum account at a particular block. type Account struct { - backend *eth.EthAPIBackend + backend ethapi.Backend address common.Address blockNumber rpc.BlockNumber } @@ -102,7 +93,7 @@ func (a *Account) Storage(ctx context.Context, args struct{ Slot common.Hash }) // Log represents an individual log message. All arguments are mandatory. type Log struct { - backend *eth.EthAPIBackend + backend ethapi.Backend transaction *Transaction log *types.Log } @@ -134,7 +125,7 @@ func (l *Log) Data(ctx context.Context) hexutil.Bytes { // Transaction represents an Ethereum transaction. // backend and hash are mandatory; all others will be fetched when required. type Transaction struct { - backend *eth.EthAPIBackend + backend ethapi.Backend hash common.Hash tx *types.Transaction block *Block @@ -349,7 +340,7 @@ const ( // backend, and either num or hash are mandatory. All other fields are lazily fetched // when required. type Block struct { - backend *eth.EthAPIBackend + backend ethapi.Backend num *rpc.BlockNumber hash common.Hash header *types.Header @@ -745,7 +736,7 @@ type BlockFilterCriteria struct { // runFilter accepts a filter and executes it, returning all its results as // `Log` objects. -func runFilter(ctx context.Context, be *eth.EthAPIBackend, filter *filters.Filter) ([]*Log, error) { +func runFilter(ctx context.Context, be ethapi.Backend, filter *filters.Filter) ([]*Log, error) { logs, err := filter.Logs(ctx) if err != nil || logs == nil { return nil, err @@ -888,7 +879,7 @@ func (b *Block) EstimateGas(ctx context.Context, args struct { } type Pending struct { - backend *eth.EthAPIBackend + backend ethapi.Backend } func (p *Pending) TransactionCount(ctx context.Context) (int32, error) { @@ -947,7 +938,7 @@ func (p *Pending) EstimateGas(ctx context.Context, args struct { // Resolver is the top-level object in the GraphQL hierarchy. type Resolver struct { - backend *eth.EthAPIBackend + backend ethapi.Backend } func (r *Resolver) Block(ctx context.Context, args struct { @@ -1088,7 +1079,6 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria // Construct the range filter filter := filters.NewRangeFilter(filters.Backend(r.backend), begin, end, addresses, topics) - return runFilter(ctx, r.backend, filter) } @@ -1145,89 +1135,3 @@ func (r *Resolver) Syncing() (*SyncState, error) { // Otherwise gather the block sync stats return &SyncState{progress}, nil } - -// NewHandler returns a new `http.Handler` that will answer GraphQL queries. -// It additionally exports an interactive query browser on the / endpoint. -func NewHandler(be *eth.EthAPIBackend) (http.Handler, error) { - q := Resolver{be} - - s, err := graphqlgo.ParseSchema(schema, &q) - if err != nil { - return nil, err - } - h := &relay.Handler{Schema: s} - - mux := http.NewServeMux() - mux.Handle("/", GraphiQL{}) - mux.Handle("/graphql", h) - mux.Handle("/graphql/", h) - return mux, nil -} - -// Service encapsulates a GraphQL service. -type Service struct { - endpoint string // The host:port endpoint for this service. - cors []string // Allowed CORS domains - vhosts []string // Recognised vhosts - timeouts rpc.HTTPTimeouts // Timeout settings for HTTP requests. - backend *eth.EthAPIBackend // The backend that queries will operate onn. - handler http.Handler // The `http.Handler` used to answer queries. - listener net.Listener // The listening socket. -} - -// Protocols returns the list of protocols exported by this service. -func (s *Service) Protocols() []p2p.Protocol { return nil } - -// APIs returns the list of APIs exported by this service. -func (s *Service) APIs() []rpc.API { return nil } - -// Start is called after all services have been constructed and the networking -// layer was also initialized to spawn any goroutines required by the service. -func (s *Service) Start(server *p2p.Server) error { - var err error - s.handler, err = NewHandler(s.backend) - if err != nil { - return err - } - - if s.listener, err = net.Listen("tcp", s.endpoint); err != nil { - return err - } - - go rpc.NewHTTPServer(s.cors, s.vhosts, s.timeouts, s.handler).Serve(s.listener) - log.Info("GraphQL endpoint opened", "url", fmt.Sprintf("http://%s", s.endpoint)) - return nil -} - -// Stop terminates all goroutines belonging to the service, blocking until they -// are all terminated. -func (s *Service) Stop() error { - if s.listener != nil { - s.listener.Close() - s.listener = nil - log.Info("GraphQL endpoint closed", "url", fmt.Sprintf("http://%s", s.endpoint)) - } - return nil -} - -// NewService constructs a new service instance. -func NewService(backend *eth.EthAPIBackend, endpoint string, cors, vhosts []string, timeouts rpc.HTTPTimeouts) (*Service, error) { - return &Service{ - endpoint: endpoint, - cors: cors, - vhosts: vhosts, - timeouts: timeouts, - backend: backend, - }, nil -} - -// RegisterGraphQLService is a utility function to construct a new service and register it against a node. -func RegisterGraphQLService(stack *node.Node, endpoint string, cors, vhosts []string, timeouts rpc.HTTPTimeouts) error { - return stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { - var ethereum *eth.Ethereum - if err := ctx.Service(ðereum); err != nil { - return nil, err - } - return NewService(ethereum.APIBackend, endpoint, cors, vhosts, timeouts) - }) -} diff --git a/vendor/github.com/ethereum/go-ethereum/graphql/service.go b/vendor/github.com/ethereum/go-ethereum/graphql/service.go new file mode 100644 index 00000000..f6407568 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/graphql/service.go @@ -0,0 +1,103 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package graphql + +import ( + "fmt" + "net" + "net/http" + + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/rpc" + "github.com/graph-gophers/graphql-go" + "github.com/graph-gophers/graphql-go/relay" +) + +// Service encapsulates a GraphQL service. +type Service struct { + endpoint string // The host:port endpoint for this service. + cors []string // Allowed CORS domains + vhosts []string // Recognised vhosts + timeouts rpc.HTTPTimeouts // Timeout settings for HTTP requests. + backend ethapi.Backend // The backend that queries will operate onn. + handler http.Handler // The `http.Handler` used to answer queries. + listener net.Listener // The listening socket. +} + +// New constructs a new GraphQL service instance. +func New(backend ethapi.Backend, endpoint string, cors, vhosts []string, timeouts rpc.HTTPTimeouts) (*Service, error) { + return &Service{ + endpoint: endpoint, + cors: cors, + vhosts: vhosts, + timeouts: timeouts, + backend: backend, + }, nil +} + +// Protocols returns the list of protocols exported by this service. +func (s *Service) Protocols() []p2p.Protocol { return nil } + +// APIs returns the list of APIs exported by this service. +func (s *Service) APIs() []rpc.API { return nil } + +// Start is called after all services have been constructed and the networking +// layer was also initialized to spawn any goroutines required by the service. +func (s *Service) Start(server *p2p.Server) error { + var err error + s.handler, err = newHandler(s.backend) + if err != nil { + return err + } + if s.listener, err = net.Listen("tcp", s.endpoint); err != nil { + return err + } + go rpc.NewHTTPServer(s.cors, s.vhosts, s.timeouts, s.handler).Serve(s.listener) + log.Info("GraphQL endpoint opened", "url", fmt.Sprintf("http://%s", s.endpoint)) + return nil +} + +// newHandler returns a new `http.Handler` that will answer GraphQL queries. +// It additionally exports an interactive query browser on the / endpoint. +func newHandler(backend ethapi.Backend) (http.Handler, error) { + q := Resolver{backend} + + s, err := graphql.ParseSchema(schema, &q) + if err != nil { + return nil, err + } + h := &relay.Handler{Schema: s} + + mux := http.NewServeMux() + mux.Handle("/", GraphiQL{}) + mux.Handle("/graphql", h) + mux.Handle("/graphql/", h) + return mux, nil +} + +// Stop terminates all goroutines belonging to the service, blocking until they +// are all terminated. +func (s *Service) Stop() error { + if s.listener != nil { + s.listener.Close() + s.listener = nil + log.Info("GraphQL endpoint closed", "url", fmt.Sprintf("http://%s", s.endpoint)) + } + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go b/vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go index 4132ff14..338223fd 100644 --- a/vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go +++ b/vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go @@ -802,6 +802,10 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNr rpc.BlockNumb if err := vmError(); err != nil { return nil, 0, false, err } + // If the timer caused an abort, return an appropriate error message + if evm.Cancelled() { + return nil, 0, false, fmt.Errorf("execution aborted (timeout = %v)", timeout) + } return res, gas, failed, err } diff --git a/vendor/github.com/ethereum/go-ethereum/internal/ethapi/backend.go b/vendor/github.com/ethereum/go-ethereum/internal/ethapi/backend.go index 9229ccfb..28ec6989 100644 --- a/vendor/github.com/ethereum/go-ethereum/internal/ethapi/backend.go +++ b/vendor/github.com/ethereum/go-ethereum/internal/ethapi/backend.go @@ -24,6 +24,7 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/bloombits" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -47,9 +48,10 @@ type Backend interface { ExtRPCEnabled() bool RPCGasCap() *big.Int // global gas cap for eth_call over rpc: DoS protection - // BlockChain API + // Blockchain API SetHead(number uint64) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) + HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error) @@ -60,7 +62,7 @@ type Backend interface { SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription - // TxPool API + // Transaction pool API SendTx(ctx context.Context, signedTx *types.Transaction) error GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) GetPoolTransactions() (types.Transactions, error) @@ -70,6 +72,13 @@ type Backend interface { TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription + // Filter API + BloomStatus() (uint64, uint64) + GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) + ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) + SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription + SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription + ChainConfig() *params.ChainConfig CurrentBlock() *types.Block } diff --git a/vendor/github.com/ethereum/go-ethereum/internal/web3ext/web3ext.go b/vendor/github.com/ethereum/go-ethereum/internal/web3ext/web3ext.go index 31c0c57e..0abcd5a8 100644 --- a/vendor/github.com/ethereum/go-ethereum/internal/web3ext/web3ext.go +++ b/vendor/github.com/ethereum/go-ethereum/internal/web3ext/web3ext.go @@ -32,6 +32,7 @@ var Modules = map[string]string{ "shh": ShhJs, "swarmfs": SwarmfsJs, "txpool": TxpoolJs, + "les": LESJs, } const ChequebookJs = ` @@ -760,3 +761,28 @@ web3._extend({ ] }); ` + +const LESJs = ` +web3._extend({ + property: 'les', + methods: + [ + new web3._extend.Method({ + name: 'getCheckpoint', + call: 'les_getCheckpoint', + params: 1 + }), + ], + properties: + [ + new web3._extend.Property({ + name: 'latestCheckpoint', + getter: 'les_latestCheckpoint' + }), + new web3._extend.Property({ + name: 'checkpointContractAddress', + getter: 'les_getCheckpointContractAddress' + }), + ] +}); +` diff --git a/vendor/github.com/ethereum/go-ethereum/les/api.go b/vendor/github.com/ethereum/go-ethereum/les/api.go index 3a8d49ca..95e1b009 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/api.go +++ b/vendor/github.com/ethereum/go-ethereum/les/api.go @@ -17,456 +17,68 @@ package les import ( - "context" "errors" - "fmt" - "sync" - "time" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/les/csvlogger" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rpc" ) var ( - ErrMinCap = errors.New("capacity too small") - ErrTotalCap = errors.New("total capacity exceeded") - ErrUnknownBenchmarkType = errors.New("unknown benchmark type") - - dropCapacityDelay = time.Second // delay applied to decreasing capacity changes + errNoCheckpoint = errors.New("no local checkpoint provided") + errNotActivated = errors.New("checkpoint registrar is not activated") ) -// PrivateLightServerAPI provides an API to access the LES light server. -// It offers only methods that operate on public data that is freely available to anyone. -type PrivateLightServerAPI struct { - server *LesServer +// PrivateLightAPI provides an API to access the LES light server or light client. +type PrivateLightAPI struct { + backend *lesCommons + reg *checkpointOracle } -// NewPrivateLightServerAPI creates a new LES light server API. -func NewPrivateLightServerAPI(server *LesServer) *PrivateLightServerAPI { - return &PrivateLightServerAPI{ - server: server, +// NewPrivateLightAPI creates a new LES service API. +func NewPrivateLightAPI(backend *lesCommons, reg *checkpointOracle) *PrivateLightAPI { + return &PrivateLightAPI{ + backend: backend, + reg: reg, } } -// TotalCapacity queries total available capacity for all clients -func (api *PrivateLightServerAPI) TotalCapacity() hexutil.Uint64 { - return hexutil.Uint64(api.server.priorityClientPool.totalCapacity()) -} - -// SubscribeTotalCapacity subscribes to changed total capacity events. -// If onlyUnderrun is true then notification is sent only if the total capacity -// drops under the total capacity of connected priority clients. +// LatestCheckpoint returns the latest local checkpoint package. // -// Note: actually applying decreasing total capacity values is delayed while the -// notification is sent instantly. This allows lowering the capacity of a priority client -// or choosing which one to drop before the system drops some of them automatically. -func (api *PrivateLightServerAPI) SubscribeTotalCapacity(ctx context.Context, onlyUnderrun bool) (*rpc.Subscription, error) { - notifier, supported := rpc.NotifierFromContext(ctx) - if !supported { - return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported +// The checkpoint package consists of 4 strings: +// result[0], hex encoded latest section index +// result[1], 32 bytes hex encoded latest section head hash +// result[2], 32 bytes hex encoded latest section canonical hash trie root hash +// result[3], 32 bytes hex encoded latest section bloom trie root hash +func (api *PrivateLightAPI) LatestCheckpoint() ([4]string, error) { + var res [4]string + cp := api.backend.latestLocalCheckpoint() + if cp.Empty() { + return res, errNoCheckpoint } - rpcSub := notifier.CreateSubscription() - api.server.priorityClientPool.subscribeTotalCapacity(&tcSubscription{notifier, rpcSub, onlyUnderrun}) - return rpcSub, nil + res[0] = hexutil.EncodeUint64(cp.SectionIndex) + res[1], res[2], res[3] = cp.SectionHead.Hex(), cp.CHTRoot.Hex(), cp.BloomRoot.Hex() + return res, nil } -type ( - // tcSubscription represents a total capacity subscription - tcSubscription struct { - notifier *rpc.Notifier - rpcSub *rpc.Subscription - onlyUnderrun bool - } - tcSubs map[*tcSubscription]struct{} -) - -// send sends a changed total capacity event to the subscribers -func (s tcSubs) send(tc uint64, underrun bool) { - for sub := range s { - select { - case <-sub.rpcSub.Err(): - delete(s, sub) - case <-sub.notifier.Closed(): - delete(s, sub) - default: - if underrun || !sub.onlyUnderrun { - sub.notifier.Notify(sub.rpcSub.ID, tc) - } - } - } -} - -// MinimumCapacity queries minimum assignable capacity for a single client -func (api *PrivateLightServerAPI) MinimumCapacity() hexutil.Uint64 { - return hexutil.Uint64(api.server.minCapacity) -} - -// FreeClientCapacity queries the capacity provided for free clients -func (api *PrivateLightServerAPI) FreeClientCapacity() hexutil.Uint64 { - return hexutil.Uint64(api.server.freeClientCap) -} - -// SetClientCapacity sets the priority capacity assigned to a given client. -// If the assigned capacity is bigger than zero then connection is always -// guaranteed. The sum of capacity assigned to priority clients can not exceed -// the total available capacity. +// GetLocalCheckpoint returns the specific local checkpoint package. // -// Note: assigned capacity can be changed while the client is connected with -// immediate effect. -func (api *PrivateLightServerAPI) SetClientCapacity(id enode.ID, cap uint64) error { - if cap != 0 && cap < api.server.minCapacity { - return ErrMinCap +// The checkpoint package consists of 3 strings: +// result[0], 32 bytes hex encoded latest section head hash +// result[1], 32 bytes hex encoded latest section canonical hash trie root hash +// result[2], 32 bytes hex encoded latest section bloom trie root hash +func (api *PrivateLightAPI) GetCheckpoint(index uint64) ([3]string, error) { + var res [3]string + cp := api.backend.getLocalCheckpoint(index) + if cp.Empty() { + return res, errNoCheckpoint } - return api.server.priorityClientPool.setClientCapacity(id, cap) + res[0], res[1], res[2] = cp.SectionHead.Hex(), cp.CHTRoot.Hex(), cp.BloomRoot.Hex() + return res, nil } -// GetClientCapacity returns the capacity assigned to a given client -func (api *PrivateLightServerAPI) GetClientCapacity(id enode.ID) hexutil.Uint64 { - api.server.priorityClientPool.lock.Lock() - defer api.server.priorityClientPool.lock.Unlock() - - return hexutil.Uint64(api.server.priorityClientPool.clients[id].cap) -} - -// clientPool is implemented by both the free and priority client pools -type clientPool interface { - peerSetNotify - setLimits(count int, totalCap uint64) -} - -// priorityClientPool stores information about prioritized clients -type priorityClientPool struct { - lock sync.Mutex - child clientPool - ps *peerSet - clients map[enode.ID]priorityClientInfo - totalCap, totalCapAnnounced uint64 - totalConnectedCap, freeClientCap uint64 - maxPeers, priorityCount int - logger *csvlogger.Logger - logTotalPriConn *csvlogger.Channel - - subs tcSubs - updateSchedule []scheduledUpdate - scheduleCounter uint64 -} - -// scheduledUpdate represents a delayed total capacity update -type scheduledUpdate struct { - time mclock.AbsTime - totalCap, id uint64 -} - -// priorityClientInfo entries exist for all prioritized clients and currently connected non-priority clients -type priorityClientInfo struct { - cap uint64 // zero for non-priority clients - connected bool - peer *peer -} - -// newPriorityClientPool creates a new priority client pool -func newPriorityClientPool(freeClientCap uint64, ps *peerSet, child clientPool, metricsLogger, eventLogger *csvlogger.Logger) *priorityClientPool { - return &priorityClientPool{ - clients: make(map[enode.ID]priorityClientInfo), - freeClientCap: freeClientCap, - ps: ps, - child: child, - logger: eventLogger, - logTotalPriConn: metricsLogger.NewChannel("totalPriConn", 0), - } -} - -// registerPeer is called when a new client is connected. If the client has no -// priority assigned then it is passed to the child pool which may either keep it -// or disconnect it. -// -// Note: priorityClientPool also stores a record about free clients while they are -// connected in order to be able to assign priority to them later. -func (v *priorityClientPool) registerPeer(p *peer) { - v.lock.Lock() - defer v.lock.Unlock() - - id := p.ID() - c := v.clients[id] - v.logger.Event(fmt.Sprintf("priorityClientPool: registerPeer cap=%d connected=%v, %x", c.cap, c.connected, id.Bytes())) - if c.connected { - return - } - if c.cap == 0 && v.child != nil { - v.child.registerPeer(p) - } - if c.cap != 0 && v.totalConnectedCap+c.cap > v.totalCap { - v.logger.Event(fmt.Sprintf("priorityClientPool: rejected, %x", id.Bytes())) - go v.ps.Unregister(p.id) - return - } - - c.connected = true - c.peer = p - v.clients[id] = c - if c.cap != 0 { - v.priorityCount++ - v.totalConnectedCap += c.cap - v.logger.Event(fmt.Sprintf("priorityClientPool: accepted with %d capacity, %x", c.cap, id.Bytes())) - v.logTotalPriConn.Update(float64(v.totalConnectedCap)) - if v.child != nil { - v.child.setLimits(v.maxPeers-v.priorityCount, v.totalCap-v.totalConnectedCap) - } - p.updateCapacity(c.cap) - } -} - -// unregisterPeer is called when a client is disconnected. If the client has no -// priority assigned then it is also removed from the child pool. -func (v *priorityClientPool) unregisterPeer(p *peer) { - v.lock.Lock() - defer v.lock.Unlock() - - id := p.ID() - c := v.clients[id] - v.logger.Event(fmt.Sprintf("priorityClientPool: unregisterPeer cap=%d connected=%v, %x", c.cap, c.connected, id.Bytes())) - if !c.connected { - return - } - if c.cap != 0 { - c.connected = false - v.clients[id] = c - v.priorityCount-- - v.totalConnectedCap -= c.cap - v.logTotalPriConn.Update(float64(v.totalConnectedCap)) - if v.child != nil { - v.child.setLimits(v.maxPeers-v.priorityCount, v.totalCap-v.totalConnectedCap) - } - } else { - if v.child != nil { - v.child.unregisterPeer(p) - } - delete(v.clients, id) - } -} - -// setLimits updates the allowed peer count and total capacity of the priority -// client pool. Since the free client pool is a child of the priority pool the -// remaining peer count and capacity is assigned to the free pool by calling its -// own setLimits function. -// -// Note: a decreasing change of the total capacity is applied with a delay. -func (v *priorityClientPool) setLimits(count int, totalCap uint64) { - v.lock.Lock() - defer v.lock.Unlock() - - v.totalCapAnnounced = totalCap - if totalCap > v.totalCap { - v.setLimitsNow(count, totalCap) - v.subs.send(totalCap, false) - return - } - v.setLimitsNow(count, v.totalCap) - if totalCap < v.totalCap { - v.subs.send(totalCap, totalCap < v.totalConnectedCap) - for i, s := range v.updateSchedule { - if totalCap >= s.totalCap { - s.totalCap = totalCap - v.updateSchedule = v.updateSchedule[:i+1] - return - } - } - v.updateSchedule = append(v.updateSchedule, scheduledUpdate{time: mclock.Now() + mclock.AbsTime(dropCapacityDelay), totalCap: totalCap}) - if len(v.updateSchedule) == 1 { - v.scheduleCounter++ - id := v.scheduleCounter - v.updateSchedule[0].id = id - time.AfterFunc(dropCapacityDelay, func() { v.checkUpdate(id) }) - } - } else { - v.updateSchedule = nil - } -} - -// checkUpdate performs the next scheduled update if possible and schedules -// the one after that -func (v *priorityClientPool) checkUpdate(id uint64) { - v.lock.Lock() - defer v.lock.Unlock() - - if len(v.updateSchedule) == 0 || v.updateSchedule[0].id != id { - return - } - v.setLimitsNow(v.maxPeers, v.updateSchedule[0].totalCap) - v.updateSchedule = v.updateSchedule[1:] - if len(v.updateSchedule) != 0 { - v.scheduleCounter++ - id := v.scheduleCounter - v.updateSchedule[0].id = id - dt := time.Duration(v.updateSchedule[0].time - mclock.Now()) - time.AfterFunc(dt, func() { v.checkUpdate(id) }) - } -} - -// setLimits updates the allowed peer count and total capacity immediately -func (v *priorityClientPool) setLimitsNow(count int, totalCap uint64) { - if v.priorityCount > count || v.totalConnectedCap > totalCap { - for id, c := range v.clients { - if c.connected { - v.logger.Event(fmt.Sprintf("priorityClientPool: setLimitsNow kicked out, %x", id.Bytes())) - c.connected = false - v.totalConnectedCap -= c.cap - v.logTotalPriConn.Update(float64(v.totalConnectedCap)) - v.priorityCount-- - v.clients[id] = c - go v.ps.Unregister(c.peer.id) - if v.priorityCount <= count && v.totalConnectedCap <= totalCap { - break - } - } - } - } - v.maxPeers = count - v.totalCap = totalCap - if v.child != nil { - v.child.setLimits(v.maxPeers-v.priorityCount, v.totalCap-v.totalConnectedCap) - } -} - -// totalCapacity queries total available capacity for all clients -func (v *priorityClientPool) totalCapacity() uint64 { - v.lock.Lock() - defer v.lock.Unlock() - - return v.totalCapAnnounced -} - -// subscribeTotalCapacity subscribes to changed total capacity events -func (v *priorityClientPool) subscribeTotalCapacity(sub *tcSubscription) { - v.lock.Lock() - defer v.lock.Unlock() - - v.subs[sub] = struct{}{} -} - -// setClientCapacity sets the priority capacity assigned to a given client -func (v *priorityClientPool) setClientCapacity(id enode.ID, cap uint64) error { - v.lock.Lock() - defer v.lock.Unlock() - - c := v.clients[id] - if c.cap == cap { - return nil - } - if c.connected { - if v.totalConnectedCap+cap > v.totalCap+c.cap { - return ErrTotalCap - } - if c.cap == 0 { - if v.child != nil { - v.child.unregisterPeer(c.peer) - } - v.priorityCount++ - } - if cap == 0 { - v.priorityCount-- - } - v.totalConnectedCap += cap - c.cap - v.logTotalPriConn.Update(float64(v.totalConnectedCap)) - if v.child != nil { - v.child.setLimits(v.maxPeers-v.priorityCount, v.totalCap-v.totalConnectedCap) - } - if cap == 0 { - if v.child != nil { - v.child.registerPeer(c.peer) - } - c.peer.updateCapacity(v.freeClientCap) - } else { - c.peer.updateCapacity(cap) - } - } - if cap != 0 || c.connected { - c.cap = cap - v.clients[id] = c - } else { - delete(v.clients, id) - } - if c.connected { - v.logger.Event(fmt.Sprintf("priorityClientPool: changed capacity to %d, %x", cap, id.Bytes())) - } - return nil -} - -// Benchmark runs a request performance benchmark with a given set of measurement setups -// in multiple passes specified by passCount. The measurement time for each setup in each -// pass is specified in milliseconds by length. -// -// Note: measurement time is adjusted for each pass depending on the previous ones. -// Therefore a controlled total measurement time is achievable in multiple passes. -func (api *PrivateLightServerAPI) Benchmark(setups []map[string]interface{}, passCount, length int) ([]map[string]interface{}, error) { - benchmarks := make([]requestBenchmark, len(setups)) - for i, setup := range setups { - if t, ok := setup["type"].(string); ok { - getInt := func(field string, def int) int { - if value, ok := setup[field].(float64); ok { - return int(value) - } - return def - } - getBool := func(field string, def bool) bool { - if value, ok := setup[field].(bool); ok { - return value - } - return def - } - switch t { - case "header": - benchmarks[i] = &benchmarkBlockHeaders{ - amount: getInt("amount", 1), - skip: getInt("skip", 1), - byHash: getBool("byHash", false), - reverse: getBool("reverse", false), - } - case "body": - benchmarks[i] = &benchmarkBodiesOrReceipts{receipts: false} - case "receipts": - benchmarks[i] = &benchmarkBodiesOrReceipts{receipts: true} - case "proof": - benchmarks[i] = &benchmarkProofsOrCode{code: false} - case "code": - benchmarks[i] = &benchmarkProofsOrCode{code: true} - case "cht": - benchmarks[i] = &benchmarkHelperTrie{ - bloom: false, - reqCount: getInt("amount", 1), - } - case "bloom": - benchmarks[i] = &benchmarkHelperTrie{ - bloom: true, - reqCount: getInt("amount", 1), - } - case "txSend": - benchmarks[i] = &benchmarkTxSend{} - case "txStatus": - benchmarks[i] = &benchmarkTxStatus{} - default: - return nil, ErrUnknownBenchmarkType - } - } else { - return nil, ErrUnknownBenchmarkType - } - } - rs := api.server.protocolManager.runBenchmark(benchmarks, passCount, time.Millisecond*time.Duration(length)) - result := make([]map[string]interface{}, len(setups)) - for i, r := range rs { - res := make(map[string]interface{}) - if r.err == nil { - res["totalCount"] = r.totalCount - res["avgTime"] = r.avgTime - res["maxInSize"] = r.maxInSize - res["maxOutSize"] = r.maxOutSize - } else { - res["error"] = r.err.Error() - } - result[i] = res - } - return result, nil +// GetCheckpointContractAddress returns the contract contract address in hex format. +func (api *PrivateLightAPI) GetCheckpointContractAddress() (string, error) { + if api.reg == nil { + return "", errNotActivated + } + return api.reg.config.Address.Hex(), nil } diff --git a/vendor/github.com/ethereum/go-ethereum/les/backend.go b/vendor/github.com/ethereum/go-ethereum/les/backend.go index ed0f4505..c067afae 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/backend.go +++ b/vendor/github.com/ethereum/go-ethereum/les/backend.go @@ -23,6 +23,7 @@ import ( "time" "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/mclock" @@ -43,14 +44,13 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discv5" "github.com/ethereum/go-ethereum/params" - rpc "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/rpc" ) type LightEthereum struct { lesCommons odr *LesOdr - relay *LesTxRelay chainConfig *params.ChainConfig // Channel for shutting down the service shutdownChan chan bool @@ -62,6 +62,7 @@ type LightEthereum struct { serverPool *serverPool reqDist *requestDistributor retriever *retrieveManager + relay *lesTxRelay bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests bloomIndexer *core.ChainIndexer @@ -83,7 +84,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { if err != nil { return nil, err } - chainConfig, genesisHash, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, config.Genesis, config.ConstantinopleOverride) + chainConfig, genesisHash, genesisErr := core.SetupGenesisBlock(chainDb, config.Genesis) if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat { return nil, genesisErr } @@ -109,23 +110,22 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { bloomRequests: make(chan chan *bloombits.Retrieval), bloomIndexer: eth.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations), } - - var trustedNodes []string - if leth.config.ULC != nil { - trustedNodes = leth.config.ULC.TrustedServers - } - leth.serverPool = newServerPool(chainDb, quitSync, &leth.wg, trustedNodes) + leth.serverPool = newServerPool(chainDb, quitSync, &leth.wg, leth.config.UltraLightServers) leth.retriever = newRetrieveManager(peers, leth.reqDist, leth.serverPool) - leth.relay = NewLesTxRelay(peers, leth.retriever) + leth.relay = newLesTxRelay(peers, leth.retriever) leth.odr = NewLesOdr(chainDb, light.DefaultClientIndexerConfig, leth.retriever) leth.chtIndexer = light.NewChtIndexer(chainDb, leth.odr, params.CHTFrequency, params.HelperTrieConfirmations) leth.bloomTrieIndexer = light.NewBloomTrieIndexer(chainDb, leth.odr, params.BloomBitsBlocksClient, params.BloomTrieFrequency) leth.odr.SetIndexers(leth.chtIndexer, leth.bloomTrieIndexer, leth.bloomIndexer) + checkpoint := config.Checkpoint + if checkpoint == nil { + checkpoint = params.TrustedCheckpoints[genesisHash] + } // Note: NewLightChain adds the trusted checkpoint so it needs an ODR with // indexers already set but not started yet - if leth.blockchain, err = light.NewLightChain(leth.odr, leth.chainConfig, leth.engine); err != nil { + if leth.blockchain, err = light.NewLightChain(leth.odr, leth.chainConfig, leth.engine, checkpoint); err != nil { return nil, err } // Note: AddChildIndexer starts the update process for the child @@ -141,32 +141,6 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { } leth.txPool = light.NewTxPool(leth.chainConfig, leth.blockchain, leth.relay) - - if leth.protocolManager, err = NewProtocolManager( - leth.chainConfig, - light.DefaultClientIndexerConfig, - true, - config.NetworkId, - leth.eventMux, - leth.engine, - leth.peers, - leth.blockchain, - nil, - chainDb, - leth.odr, - leth.relay, - leth.serverPool, - quitSync, - &leth.wg, - config.ULC, - nil); err != nil { - return nil, err - } - - if leth.protocolManager.isULCEnabled() { - log.Warn("Ultra light client is enabled", "trustedNodes", len(leth.protocolManager.ulc.trustedKeys), "minTrustedFraction", leth.protocolManager.ulc.minTrustedFraction) - leth.blockchain.DisableCheckFreq() - } leth.ApiBackend = &LesApiBackend{ctx.ExtRPCEnabled(), leth, nil} gpoParams := config.GPO @@ -174,6 +148,19 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { gpoParams.Default = config.Miner.GasPrice } leth.ApiBackend.gpo = gasprice.NewOracle(leth.ApiBackend, gpoParams) + + oracle := config.CheckpointOracle + if oracle == nil { + oracle = params.CheckpointOracles[genesisHash] + } + registrar := newCheckpointOracle(oracle, leth.getLocalCheckpoint) + if leth.protocolManager, err = NewProtocolManager(leth.chainConfig, checkpoint, light.DefaultClientIndexerConfig, config.UltraLightServers, config.UltraLightFraction, true, config.NetworkId, leth.eventMux, leth.peers, leth.blockchain, nil, chainDb, leth.odr, leth.serverPool, registrar, quitSync, &leth.wg, nil); err != nil { + return nil, err + } + if leth.protocolManager.ulc != nil { + log.Warn("Ultra light client is enabled", "servers", len(config.UltraLightServers), "fraction", config.UltraLightFraction) + leth.blockchain.DisableCheckFreq() + } return leth, nil } @@ -234,6 +221,11 @@ func (s *LightEthereum) APIs() []rpc.API { Version: "1.0", Service: s.netRPCService, Public: true, + }, { + Namespace: "les", + Version: "1.0", + Service: NewPrivateLightAPI(&s.lesCommons, s.protocolManager.reg), + Public: false, }, }...) } @@ -288,3 +280,12 @@ func (s *LightEthereum) Stop() error { return nil } + +// SetClient sets the rpc client and binds the registrar contract. +func (s *LightEthereum) SetContractBackend(backend bind.ContractBackend) { + // Short circuit if registrar is nil + if s.protocolManager.reg == nil { + return + } + s.protocolManager.reg.start(backend) +} diff --git a/vendor/github.com/ethereum/go-ethereum/les/checkpointoracle.go b/vendor/github.com/ethereum/go-ethereum/les/checkpointoracle.go new file mode 100644 index 00000000..4695fbc1 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/les/checkpointoracle.go @@ -0,0 +1,158 @@ +// Copyright 2019 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package les + +import ( + "encoding/binary" + "sync/atomic" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/contracts/checkpointoracle" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" +) + +// checkpointOracle is responsible for offering the latest stable checkpoint +// generated and announced by the contract admins on-chain. The checkpoint is +// verified by clients locally during the checkpoint syncing. +type checkpointOracle struct { + config *params.CheckpointOracleConfig + contract *checkpointoracle.CheckpointOracle + + // Whether the contract backend is set. + running int32 + + getLocal func(uint64) params.TrustedCheckpoint // Function used to retrieve local checkpoint + syncDoneHook func() // Function used to notify that light syncing has completed. +} + +// newCheckpointOracle returns a checkpoint registrar handler. +func newCheckpointOracle(config *params.CheckpointOracleConfig, getLocal func(uint64) params.TrustedCheckpoint) *checkpointOracle { + if config == nil { + log.Info("Checkpoint registrar is not enabled") + return nil + } + if config.Address == (common.Address{}) || uint64(len(config.Signers)) < config.Threshold { + log.Warn("Invalid checkpoint registrar config") + return nil + } + log.Info("Configured checkpoint registrar", "address", config.Address, "signers", len(config.Signers), "threshold", config.Threshold) + + return &checkpointOracle{ + config: config, + getLocal: getLocal, + } +} + +// start binds the registrar contract and start listening to the +// newCheckpointEvent for the server side. +func (reg *checkpointOracle) start(backend bind.ContractBackend) { + contract, err := checkpointoracle.NewCheckpointOracle(reg.config.Address, backend) + if err != nil { + log.Error("Oracle contract binding failed", "err", err) + return + } + if !atomic.CompareAndSwapInt32(®.running, 0, 1) { + log.Error("Already bound and listening to registrar") + return + } + reg.contract = contract +} + +// isRunning returns an indicator whether the registrar is running. +func (reg *checkpointOracle) isRunning() bool { + return atomic.LoadInt32(®.running) == 1 +} + +// stableCheckpoint returns the stable checkpoint which was generated by local +// indexers and announced by trusted signers. +func (reg *checkpointOracle) stableCheckpoint() (*params.TrustedCheckpoint, uint64) { + // Retrieve the latest checkpoint from the contract, abort if empty + latest, hash, height, err := reg.contract.Contract().GetLatestCheckpoint(nil) + if err != nil || (latest == 0 && hash == [32]byte{}) { + return nil, 0 + } + local := reg.getLocal(latest) + + // The following scenarios may occur: + // + // * local node is out of sync so that it doesn't have the + // checkpoint which registered in the contract. + // * local checkpoint doesn't match with the registered one. + // + // In both cases, server won't send the **stable** checkpoint + // to the client(no worry, client can use hardcoded one instead). + if local.HashEqual(common.Hash(hash)) { + return &local, height.Uint64() + } + return nil, 0 +} + +// verifySigners recovers the signer addresses according to the signature and +// checks whether there are enough approvals to finalize the checkpoint. +func (reg *checkpointOracle) verifySigners(index uint64, hash [32]byte, signatures [][]byte) (bool, []common.Address) { + // Short circuit if the given signatures doesn't reach the threshold. + if len(signatures) < int(reg.config.Threshold) { + return false, nil + } + var ( + signers []common.Address + checked = make(map[common.Address]struct{}) + ) + for i := 0; i < len(signatures); i++ { + if len(signatures[i]) != 65 { + continue + } + // EIP 191 style signatures + // + // Arguments when calculating hash to validate + // 1: byte(0x19) - the initial 0x19 byte + // 2: byte(0) - the version byte (data with intended validator) + // 3: this - the validator address + // -- Application specific data + // 4 : checkpoint section_index (uint64) + // 5 : checkpoint hash (bytes32) + // hash = keccak256(checkpoint_index, section_head, cht_root, bloom_root) + buf := make([]byte, 8) + binary.BigEndian.PutUint64(buf, index) + data := append([]byte{0x19, 0x00}, append(reg.config.Address.Bytes(), append(buf, hash[:]...)...)...) + signatures[i][64] -= 27 // Transform V from 27/28 to 0/1 according to the yellow paper for verification. + pubkey, err := crypto.Ecrecover(crypto.Keccak256(data), signatures[i]) + if err != nil { + return false, nil + } + var signer common.Address + copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) + if _, exist := checked[signer]; exist { + continue + } + for _, s := range reg.config.Signers { + if s == signer { + signers = append(signers, signer) + checked[signer] = struct{}{} + } + } + } + threshold := reg.config.Threshold + if uint64(len(signers)) < threshold { + log.Warn("Not enough signers to approve checkpoint", "signers", len(signers), "threshold", threshold) + return false, nil + } + return true, signers +} diff --git a/vendor/github.com/ethereum/go-ethereum/les/commons.go b/vendor/github.com/ethereum/go-ethereum/les/commons.go index d4647997..7eaf39c8 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/commons.go +++ b/vendor/github.com/ethereum/go-ethereum/les/commons.go @@ -76,24 +76,6 @@ func (c *lesCommons) makeProtocols(versions []uint) []p2p.Protocol { // nodeInfo retrieves some protocol metadata about the running host node. func (c *lesCommons) nodeInfo() interface{} { - var cht params.TrustedCheckpoint - sections, _, _ := c.chtIndexer.Sections() - sections2, _, _ := c.bloomTrieIndexer.Sections() - - if sections2 < sections { - sections = sections2 - } - if sections > 0 { - sectionIndex := sections - 1 - sectionHead := c.bloomTrieIndexer.SectionHead(sectionIndex) - cht = params.TrustedCheckpoint{ - SectionIndex: sectionIndex, - SectionHead: sectionHead, - CHTRoot: light.GetChtRoot(c.chainDb, sectionIndex, sectionHead), - BloomRoot: light.GetBloomTrieRoot(c.chainDb, sectionIndex, sectionHead), - } - } - chain := c.protocolManager.blockchain head := chain.CurrentHeader() hash := head.Hash() @@ -103,6 +85,38 @@ func (c *lesCommons) nodeInfo() interface{} { Genesis: chain.Genesis().Hash(), Config: chain.Config(), Head: chain.CurrentHeader().Hash(), - CHT: cht, + CHT: c.latestLocalCheckpoint(), + } +} + +// latestLocalCheckpoint finds the common stored section index and returns a set of +// post-processed trie roots (CHT and BloomTrie) associated with +// the appropriate section index and head hash as a local checkpoint package. +func (c *lesCommons) latestLocalCheckpoint() params.TrustedCheckpoint { + sections, _, _ := c.chtIndexer.Sections() + sections2, _, _ := c.bloomTrieIndexer.Sections() + // Cap the section index if the two sections are not consistent. + if sections > sections2 { + sections = sections2 + } + if sections == 0 { + // No checkpoint information can be provided. + return params.TrustedCheckpoint{} + } + return c.getLocalCheckpoint(sections - 1) +} + +// getLocalCheckpoint returns a set of post-processed trie roots (CHT and BloomTrie) +// associated with the appropriate head hash by specific section index. +// +// The returned checkpoint is only the checkpoint generated by the local indexers, +// not the stable checkpoint registered in the registrar contract. +func (c *lesCommons) getLocalCheckpoint(index uint64) params.TrustedCheckpoint { + sectionHead := c.chtIndexer.SectionHead(index) + return params.TrustedCheckpoint{ + SectionIndex: index, + SectionHead: sectionHead, + CHTRoot: light.GetChtRoot(c.chainDb, index, sectionHead), + BloomRoot: light.GetBloomTrieRoot(c.chainDb, index, sectionHead), } } diff --git a/vendor/github.com/ethereum/go-ethereum/les/costtracker.go b/vendor/github.com/ethereum/go-ethereum/les/costtracker.go index e463c9f8..61b076d1 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/costtracker.go +++ b/vendor/github.com/ethereum/go-ethereum/les/costtracker.go @@ -18,7 +18,6 @@ package les import ( "encoding/binary" - "fmt" "math" "sync" "sync/atomic" @@ -27,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/les/csvlogger" "github.com/ethereum/go-ethereum/les/flowcontrol" "github.com/ethereum/go-ethereum/log" ) @@ -96,46 +94,56 @@ const ( // as the number of cost units per nanosecond of serving time in a single thread. // It is based on statistics collected during serving requests in high-load periods // and practically acts as a one-dimension request price scaling factor over the -// pre-defined cost estimate table. Instead of scaling the cost values, the real -// value of cost units is changed by applying the factor to the serving times. This -// is more convenient because the changes in the cost factor can be applied immediately -// without always notifying the clients about the changed cost tables. +// pre-defined cost estimate table. +// +// The reason for dynamically maintaining the global factor on the server side is: +// the estimated time cost of the request is fixed(hardcoded) but the configuration +// of the machine running the server is really different. Therefore, the request serving +// time in different machine will vary greatly. And also, the request serving time +// in same machine may vary greatly with different request pressure. +// +// In order to more effectively limit resources, we apply the global factor to serving +// time to make the result as close as possible to the estimated time cost no matter +// the server is slow or fast. And also we scale the totalRecharge with global factor +// so that fast server can serve more requests than estimation and slow server can +// reduce request pressure. +// +// Instead of scaling the cost values, the real value of cost units is changed by +// applying the factor to the serving times. This is more convenient because the +// changes in the cost factor can be applied immediately without always notifying +// the clients about the changed cost tables. type costTracker struct { db ethdb.Database stopCh chan chan struct{} - inSizeFactor, outSizeFactor float64 - gf, utilTarget float64 - minBufLimit uint64 + inSizeFactor float64 + outSizeFactor float64 + factor float64 + utilTarget float64 + minBufLimit uint64 - gfUpdateCh chan gfUpdate gfLock sync.RWMutex + reqInfoCh chan reqInfo totalRechargeCh chan uint64 - stats map[uint64][]uint64 - logger *csvlogger.Logger - logRecentTime, logRecentAvg, logTotalRecharge, logRelCost *csvlogger.Channel + stats map[uint64][]uint64 // Used for testing purpose. } // newCostTracker creates a cost tracker and loads the cost factor statistics from the database. // It also returns the minimum capacity that can be assigned to any peer. -func newCostTracker(db ethdb.Database, config *eth.Config, logger *csvlogger.Logger) (*costTracker, uint64) { +func newCostTracker(db ethdb.Database, config *eth.Config) (*costTracker, uint64) { utilTarget := float64(config.LightServ) * flowcontrol.FixedPointMultiplier / 100 ct := &costTracker{ - db: db, - stopCh: make(chan chan struct{}), - utilTarget: utilTarget, - logger: logger, - logRelCost: logger.NewMinMaxChannel("relativeCost", true), - logRecentTime: logger.NewMinMaxChannel("recentTime", true), - logRecentAvg: logger.NewMinMaxChannel("recentAvg", true), - logTotalRecharge: logger.NewChannel("totalRecharge", 0.01), + db: db, + stopCh: make(chan chan struct{}), + reqInfoCh: make(chan reqInfo, 100), + utilTarget: utilTarget, } - if config.LightBandwidthIn > 0 { - ct.inSizeFactor = utilTarget / float64(config.LightBandwidthIn) + if config.LightIngress > 0 { + ct.inSizeFactor = utilTarget / float64(config.LightIngress) } - if config.LightBandwidthOut > 0 { - ct.outSizeFactor = utilTarget / float64(config.LightBandwidthOut) + if config.LightEgress > 0 { + ct.outSizeFactor = utilTarget / float64(config.LightEgress) } if makeCostStats { ct.stats = make(map[uint64][]uint64) @@ -204,8 +212,15 @@ func (ct *costTracker) makeCostList(globalFactor float64) RequestCostList { return list } -type gfUpdate struct { - avgTimeCost, servingTime float64 +// reqInfo contains the estimated time cost and the actual request serving time +// which acts as a feed source to update factor maintained by costTracker. +type reqInfo struct { + // avgTimeCost is the estimated time cost corresponding to maxCostTable. + avgTimeCost float64 + + // servingTime is the CPU time corresponding to the actual processing of + // the request. + servingTime float64 } // gfLoop starts an event loop which updates the global cost factor which is @@ -218,43 +233,48 @@ type gfUpdate struct { // total allowed serving time per second but nominated in cost units, should // also be scaled with the cost factor and is also updated by this loop. func (ct *costTracker) gfLoop() { - var gfLog, recentTime, recentAvg float64 - lastUpdate := mclock.Now() - expUpdate := lastUpdate + var ( + factor, totalRecharge float64 + gfLog, recentTime, recentAvg float64 + lastUpdate, expUpdate = mclock.Now(), mclock.Now() + ) + + // Load historical cost factor statistics from the database. data, _ := ct.db.Get([]byte(gfDbKey)) if len(data) == 8 { gfLog = math.Float64frombits(binary.BigEndian.Uint64(data[:])) } - gf := math.Exp(gfLog) - ct.gf = gf - totalRecharge := ct.utilTarget * gf - ct.gfUpdateCh = make(chan gfUpdate, 100) - threshold := gfUsageThreshold * float64(gfUsageTC) * ct.utilTarget / 1000000 + ct.factor = math.Exp(gfLog) + factor, totalRecharge = ct.factor, ct.utilTarget*ct.factor + + // In order to perform factor data statistics under the high request pressure, + // we only adjust factor when recent factor usage beyond the threshold. + threshold := gfUsageThreshold * float64(gfUsageTC) * ct.utilTarget / flowcontrol.FixedPointMultiplier go func() { saveCostFactor := func() { var data [8]byte binary.BigEndian.PutUint64(data[:], math.Float64bits(gfLog)) ct.db.Put([]byte(gfDbKey), data[:]) - log.Debug("global cost factor saved", "value", gf) + log.Debug("global cost factor saved", "value", factor) } saveTicker := time.NewTicker(time.Minute * 10) for { select { - case r := <-ct.gfUpdateCh: + case r := <-ct.reqInfoCh: + requestServedMeter.Mark(int64(r.servingTime)) + requestEstimatedMeter.Mark(int64(r.avgTimeCost / factor)) + requestServedTimer.Update(time.Duration(r.servingTime)) + relativeCostHistogram.Update(int64(r.avgTimeCost / factor / r.servingTime)) + now := mclock.Now() - if ct.logRelCost != nil && r.avgTimeCost > 1e-20 { - ct.logRelCost.Update(r.servingTime * gf / r.avgTimeCost) - } - if r.servingTime > 1000000000 { - ct.logger.Event(fmt.Sprintf("Very long servingTime = %f avgTimeCost = %f costFactor = %f", r.servingTime, r.avgTimeCost, gf)) - } dt := float64(now - expUpdate) expUpdate = now exp := math.Exp(-dt / float64(gfUsageTC)) - // calculate gf correction until now, based on previous values + + // calculate factor correction until now, based on previous values var gfCorr float64 max := recentTime if recentAvg > max { @@ -268,27 +288,28 @@ func (ct *costTracker) gfLoop() { } else { gfCorr = math.Log(max/threshold) * float64(gfUsageTC) } - // calculate log(gf) correction with the right direction and time constant + // calculate log(factor) correction with the right direction and time constant if recentTime > recentAvg { - // drop gf if actual serving times are larger than average estimates + // drop factor if actual serving times are larger than average estimates gfCorr /= -float64(gfDropTC) } else { - // raise gf if actual serving times are smaller than average estimates + // raise factor if actual serving times are smaller than average estimates gfCorr /= float64(gfRaiseTC) } } // update recent cost values with current request recentTime = recentTime*exp + r.servingTime - recentAvg = recentAvg*exp + r.avgTimeCost/gf + recentAvg = recentAvg*exp + r.avgTimeCost/factor if gfCorr != 0 { + // Apply the correction to factor gfLog += gfCorr - gf = math.Exp(gfLog) + factor = math.Exp(gfLog) + // Notify outside modules the new factor and totalRecharge. if time.Duration(now-lastUpdate) > time.Second { - totalRecharge = ct.utilTarget * gf - lastUpdate = now + totalRecharge, lastUpdate = ct.utilTarget*factor, now ct.gfLock.Lock() - ct.gf = gf + ct.factor = factor ch := ct.totalRechargeCh ct.gfLock.Unlock() if ch != nil { @@ -297,12 +318,12 @@ func (ct *costTracker) gfLoop() { default: } } - log.Debug("global cost factor updated", "gf", gf) + log.Debug("global cost factor updated", "factor", factor) } } - ct.logRecentTime.Update(recentTime) - ct.logRecentAvg.Update(recentAvg) - ct.logTotalRecharge.Update(totalRecharge) + recentServedGauge.Update(int64(recentTime)) + recentEstimatedGauge.Update(int64(recentAvg)) + totalRechargeGauge.Update(int64(totalRecharge)) case <-saveTicker.C: saveCostFactor() @@ -321,7 +342,7 @@ func (ct *costTracker) globalFactor() float64 { ct.gfLock.RLock() defer ct.gfLock.RUnlock() - return ct.gf + return ct.factor } // totalRecharge returns the current total recharge parameter which is used by @@ -330,7 +351,7 @@ func (ct *costTracker) totalRecharge() uint64 { ct.gfLock.RLock() defer ct.gfLock.RUnlock() - return uint64(ct.gf * ct.utilTarget) + return uint64(ct.factor * ct.utilTarget) } // subscribeTotalRecharge returns all future updates to the total recharge value @@ -340,7 +361,7 @@ func (ct *costTracker) subscribeTotalRecharge(ch chan uint64) uint64 { defer ct.gfLock.Unlock() ct.totalRechargeCh = ch - return uint64(ct.gf * ct.utilTarget) + return uint64(ct.factor * ct.utilTarget) } // updateStats updates the global cost factor and (if enabled) the real cost vs. @@ -349,7 +370,7 @@ func (ct *costTracker) updateStats(code, amount, servingTime, realCost uint64) { avg := reqAvgTimeCost[code] avgTimeCost := avg.baseCost + amount*avg.reqCost select { - case ct.gfUpdateCh <- gfUpdate{float64(avgTimeCost), float64(servingTime)}: + case ct.reqInfoCh <- reqInfo{float64(avgTimeCost), float64(servingTime)}: default: } if makeCostStats { diff --git a/vendor/github.com/ethereum/go-ethereum/les/csvlogger/csvlogger.go b/vendor/github.com/ethereum/go-ethereum/les/csvlogger/csvlogger.go deleted file mode 100644 index 9a4093cb..00000000 --- a/vendor/github.com/ethereum/go-ethereum/les/csvlogger/csvlogger.go +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2019 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package csvlogger - -import ( - "fmt" - "os" - "sync" - "time" - - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" -) - -// Logger is a metrics/events logger that writes logged values and events into a comma separated file -type Logger struct { - file *os.File - started mclock.AbsTime - channels []*Channel - period time.Duration - stopCh, stopped chan struct{} - storeCh chan string - eventHeader string -} - -// NewLogger creates a new Logger -func NewLogger(fileName string, updatePeriod time.Duration, eventHeader string) *Logger { - if fileName == "" { - return nil - } - f, err := os.Create(fileName) - if err != nil { - log.Error("Error creating log file", "name", fileName, "error", err) - return nil - } - return &Logger{ - file: f, - period: updatePeriod, - stopCh: make(chan struct{}), - storeCh: make(chan string, 1), - eventHeader: eventHeader, - } -} - -// NewChannel creates a new value logger channel that writes values in a single -// column. If the relative change of the value is bigger than the given threshold -// then a new line is added immediately (threshold can also be 0). -func (l *Logger) NewChannel(name string, threshold float64) *Channel { - if l == nil { - return nil - } - c := &Channel{ - logger: l, - name: name, - threshold: threshold, - } - l.channels = append(l.channels, c) - return c -} - -// NewMinMaxChannel creates a new value logger channel that writes the minimum and -// maximum of the tracked value in two columns. It never triggers adding a new line. -// If zeroDefault is true then 0 is written to both min and max columns if no update -// was given during the last period. If it is false then the last update will appear -// in both columns. -func (l *Logger) NewMinMaxChannel(name string, zeroDefault bool) *Channel { - if l == nil { - return nil - } - c := &Channel{ - logger: l, - name: name, - minmax: true, - mmZeroDefault: zeroDefault, - } - l.channels = append(l.channels, c) - return c -} - -func (l *Logger) store(event string) { - s := fmt.Sprintf("%g", float64(mclock.Now()-l.started)/1000000000) - for _, ch := range l.channels { - s += ", " + ch.store() - } - if event != "" { - s += ", " + event - } - l.file.WriteString(s + "\n") -} - -// Start writes the header line and starts the logger -func (l *Logger) Start() { - if l == nil { - return - } - l.started = mclock.Now() - s := "Time" - for _, ch := range l.channels { - s += ", " + ch.header() - } - if l.eventHeader != "" { - s += ", " + l.eventHeader - } - l.file.WriteString(s + "\n") - go func() { - timer := time.NewTimer(l.period) - for { - select { - case <-timer.C: - l.store("") - timer.Reset(l.period) - case event := <-l.storeCh: - l.store(event) - if !timer.Stop() { - <-timer.C - } - timer.Reset(l.period) - case <-l.stopCh: - close(l.stopped) - return - } - } - }() -} - -// Stop stops the logger and closes the file -func (l *Logger) Stop() { - if l == nil { - return - } - l.stopped = make(chan struct{}) - close(l.stopCh) - <-l.stopped - l.file.Close() -} - -// Event immediately adds a new line and adds the given event string in the last column -func (l *Logger) Event(event string) { - if l == nil { - return - } - select { - case l.storeCh <- event: - case <-l.stopCh: - } -} - -// Channel represents a logger channel tracking a single value -type Channel struct { - logger *Logger - lock sync.Mutex - name string - threshold, storeMin, storeMax, lastValue, min, max float64 - minmax, mmSet, mmZeroDefault bool -} - -// Update updates the tracked value -func (lc *Channel) Update(value float64) { - if lc == nil { - return - } - lc.lock.Lock() - defer lc.lock.Unlock() - - lc.lastValue = value - if lc.minmax { - if value > lc.max || !lc.mmSet { - lc.max = value - } - if value < lc.min || !lc.mmSet { - lc.min = value - } - lc.mmSet = true - } else { - if value < lc.storeMin || value > lc.storeMax { - select { - case lc.logger.storeCh <- "": - default: - } - } - } -} - -func (lc *Channel) store() (s string) { - lc.lock.Lock() - defer lc.lock.Unlock() - - if lc.minmax { - s = fmt.Sprintf("%g, %g", lc.min, lc.max) - lc.mmSet = false - if lc.mmZeroDefault { - lc.min = 0 - } else { - lc.min = lc.lastValue - } - lc.max = lc.min - } else { - s = fmt.Sprintf("%g", lc.lastValue) - lc.storeMin = lc.lastValue * (1 - lc.threshold) - lc.storeMax = lc.lastValue * (1 + lc.threshold) - if lc.lastValue < 0 { - lc.storeMin, lc.storeMax = lc.storeMax, lc.storeMin - } - } - return -} - -func (lc *Channel) header() string { - if lc.minmax { - return lc.name + " (min), " + lc.name + " (max)" - } - return lc.name -} diff --git a/vendor/github.com/ethereum/go-ethereum/les/fetcher.go b/vendor/github.com/ethereum/go-ethereum/les/fetcher.go index fa02be9a..76e4f076 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/fetcher.go +++ b/vendor/github.com/ethereum/go-ethereum/les/fetcher.go @@ -469,23 +469,18 @@ func (f *lightFetcher) findBestRequest() (bestHash common.Hash, bestAmount uint6 // isTrustedHash checks if the block can be trusted by the minimum trusted fraction. func (f *lightFetcher) isTrustedHash(hash common.Hash) bool { - if !f.pm.isULCEnabled() { + // If ultra light cliet mode is disabled, trust all hashes + if f.pm.ulc == nil { return true } - - var numAgreed int - for p, fp := range f.peers { - if !p.isTrusted { - continue + // Ultra light enabled, only trust after enough confirmations + var agreed int + for peer, info := range f.peers { + if peer.trusted && info.nodeByHash[hash] != nil { + agreed++ } - if _, ok := fp.nodeByHash[hash]; !ok { - continue - } - - numAgreed++ } - - return 100*numAgreed/len(f.pm.ulc.trustedKeys) >= f.pm.ulc.minTrustedFraction + return 100*agreed/len(f.pm.ulc.keys) >= f.pm.ulc.fraction } func (f *lightFetcher) newFetcherDistReqForSync(bestHash common.Hash) *distReq { @@ -498,16 +493,15 @@ func (f *lightFetcher) newFetcherDistReqForSync(bestHash common.Hash) *distReq { f.lock.Lock() defer f.lock.Unlock() - if p.isOnlyAnnounce { + if p.onlyAnnounce { return false } - fp := f.peers[p] return fp != nil && fp.nodeByHash[bestHash] != nil }, request: func(dp distPeer) func() { - if f.pm.isULCEnabled() { - //keep last trusted header before sync + if f.pm.ulc != nil { + // Keep last trusted header before sync f.setLastTrustedHeader(f.chain.CurrentHeader()) } go func() { @@ -533,10 +527,9 @@ func (f *lightFetcher) newFetcherDistReq(bestHash common.Hash, reqID uint64, bes f.lock.Lock() defer f.lock.Unlock() - if p.isOnlyAnnounce { + if p.onlyAnnounce { return false } - fp := f.peers[p] if fp == nil { return false @@ -708,36 +701,30 @@ func (f *lightFetcher) checkSyncedHeaders(p *peer) { p.Log().Debug("Unknown peer to check sync headers") return } - - n := fp.lastAnnounced - var td *big.Int - - var h *types.Header - if f.pm.isULCEnabled() { - var unapprovedHashes []common.Hash - // Overwrite last announced for ULC mode - h, unapprovedHashes = f.lastTrustedTreeNode(p) - //rollback untrusted blocks - f.chain.Rollback(unapprovedHashes) - //overwrite to last trusted - n = fp.nodeByHash[h.Hash()] + var ( + node = fp.lastAnnounced + td *big.Int + ) + if f.pm.ulc != nil { + // Roll back untrusted blocks + h, unapproved := f.lastTrustedTreeNode(p) + f.chain.Rollback(unapproved) + node = fp.nodeByHash[h.Hash()] } - - //find last valid block - for n != nil { - if td = f.chain.GetTd(n.hash, n.number); td != nil { + // Find last valid block + for node != nil { + if td = f.chain.GetTd(node.hash, node.number); td != nil { break } - n = n.parent + node = node.parent } - - // Now n is the latest downloaded/approved header after syncing - if n == nil { + // Now node is the latest downloaded/approved header after syncing + if node == nil { p.Log().Debug("Synchronisation failed") go f.pm.removePeer(p.id) return } - header := f.chain.GetHeader(n.hash, n.number) + header := f.chain.GetHeader(node.hash, node.number) f.newHeaders([]*types.Header{header}, []*big.Int{td}) } diff --git a/vendor/github.com/ethereum/go-ethereum/les/freeclient.go b/vendor/github.com/ethereum/go-ethereum/les/freeclient.go index f434ea0b..934b8815 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/freeclient.go +++ b/vendor/github.com/ethereum/go-ethereum/les/freeclient.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/common/prque" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/les/csvlogger" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" ) @@ -53,8 +52,7 @@ type freeClientPool struct { connectedLimit, totalLimit int freeClientCap uint64 - logger *csvlogger.Logger - logTotalFreeConn *csvlogger.Channel + connectedCap uint64 addressMap map[string]*freeClientPoolEntry connPool, disconnPool *prque.Prque @@ -69,18 +67,16 @@ const ( ) // newFreeClientPool creates a new free client pool -func newFreeClientPool(db ethdb.Database, freeClientCap uint64, totalLimit int, clock mclock.Clock, removePeer func(string), metricsLogger, eventLogger *csvlogger.Logger) *freeClientPool { +func newFreeClientPool(db ethdb.Database, freeClientCap uint64, totalLimit int, clock mclock.Clock, removePeer func(string)) *freeClientPool { pool := &freeClientPool{ - db: db, - clock: clock, - addressMap: make(map[string]*freeClientPoolEntry), - connPool: prque.New(poolSetIndex), - disconnPool: prque.New(poolSetIndex), - freeClientCap: freeClientCap, - totalLimit: totalLimit, - logger: eventLogger, - logTotalFreeConn: metricsLogger.NewChannel("totalFreeConn", 0), - removePeer: removePeer, + db: db, + clock: clock, + addressMap: make(map[string]*freeClientPoolEntry), + connPool: prque.New(poolSetIndex), + disconnPool: prque.New(poolSetIndex), + freeClientCap: freeClientCap, + totalLimit: totalLimit, + removePeer: removePeer, } pool.loadFromDb() return pool @@ -126,10 +122,7 @@ func (f *freeClientPool) connect(address, id string) bool { if f.closed { return false } - - f.logger.Event("freeClientPool: connecting from " + address + ", " + id) if f.connectedLimit == 0 { - f.logger.Event("freeClientPool: rejected, " + id) log.Debug("Client rejected", "address", address) return false } @@ -141,7 +134,6 @@ func (f *freeClientPool) connect(address, id string) bool { f.addressMap[address] = e } else { if e.connected { - f.logger.Event("freeClientPool: already connected, " + id) log.Debug("Client already connected", "address", address) return false } @@ -154,12 +146,13 @@ func (f *freeClientPool) connect(address, id string) bool { if e.linUsage+int64(connectedBias)-i.linUsage < 0 { // kick it out and accept the new client f.dropClient(i, now) - f.logger.Event("freeClientPool: kicked out, " + i.id) + clientKickedMeter.Mark(1) + f.connectedCap -= f.freeClientCap } else { // keep the old client and reject the new one f.connPool.Push(i, i.linUsage) - f.logger.Event("freeClientPool: rejected, " + id) log.Debug("Client rejected", "address", address) + clientRejectedMeter.Mark(1) return false } } @@ -167,11 +160,12 @@ func (f *freeClientPool) connect(address, id string) bool { e.connected = true e.id = id f.connPool.Push(e, e.linUsage) - f.logTotalFreeConn.Update(float64(uint64(f.connPool.Size()) * f.freeClientCap)) if f.connPool.Size()+f.disconnPool.Size() > f.totalLimit { f.disconnPool.Pop() } - f.logger.Event("freeClientPool: accepted, " + id) + f.connectedCap += f.freeClientCap + totalConnectedGauge.Update(int64(f.connectedCap)) + clientConnectedMeter.Mark(1) log.Debug("Client accepted", "address", address) return true } @@ -203,13 +197,12 @@ func (f *freeClientPool) disconnect(address string) { log.Debug("Client already disconnected", "address", address) return } - f.connPool.Remove(e.index) - f.logTotalFreeConn.Update(float64(uint64(f.connPool.Size()) * f.freeClientCap)) f.calcLogUsage(e, now) e.connected = false f.disconnPool.Push(e, -e.logUsage) - f.logger.Event("freeClientPool: disconnected, " + e.id) + f.connectedCap -= f.freeClientCap + totalConnectedGauge.Update(int64(f.connectedCap)) log.Debug("Client disconnected", "address", address) } @@ -227,15 +220,15 @@ func (f *freeClientPool) setLimits(count int, totalCap uint64) { for f.connPool.Size() > f.connectedLimit { i := f.connPool.PopItem().(*freeClientPoolEntry) f.dropClient(i, now) - f.logger.Event("freeClientPool: setLimits kicked out, " + i.id) + f.connectedCap -= f.freeClientCap } + totalConnectedGauge.Update(int64(f.connectedCap)) } // dropClient disconnects a client and also moves it from the connected to the // disconnected pool func (f *freeClientPool) dropClient(i *freeClientPoolEntry, now mclock.AbsTime) { f.connPool.Remove(i.index) - f.logTotalFreeConn.Update(float64(uint64(f.connPool.Size()) * f.freeClientCap)) f.calcLogUsage(i, now) i.connected = false f.disconnPool.Push(i, -i.logUsage) diff --git a/vendor/github.com/ethereum/go-ethereum/les/handler.go b/vendor/github.com/ethereum/go-ethereum/les/handler.go index c7bd2310..743776bd 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/handler.go +++ b/vendor/github.com/ethereum/go-ethereum/les/handler.go @@ -27,16 +27,13 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/les/csvlogger" "github.com/ethereum/go-ethereum/light" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p" @@ -101,7 +98,7 @@ type ProtocolManager struct { networkId uint64 // The identity of network. txpool txPool - txrelay *LesTxRelay + txrelay *lesTxRelay blockchain BlockChain chainDb ethdb.Database odr *LesOdr @@ -115,6 +112,8 @@ type ProtocolManager struct { fetcher *lightFetcher ulc *ulc peers *peerSet + checkpoint *params.TrustedCheckpoint + reg *checkpointOracle // If reg == nil, it means the checkpoint registrar is not activated // channels for fetcher, syncer, txsyncLoop newPeerCh chan *peer @@ -123,7 +122,6 @@ type ProtocolManager struct { wg *sync.WaitGroup eventMux *event.TypeMux - logger *csvlogger.Logger // Callbacks synced func() bool @@ -131,23 +129,7 @@ type ProtocolManager struct { // NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable // with the ethereum network. -func NewProtocolManager( - chainConfig *params.ChainConfig, - indexerConfig *light.IndexerConfig, - client bool, - networkId uint64, - mux *event.TypeMux, - engine consensus.Engine, - peers *peerSet, - blockchain BlockChain, - txpool txPool, - chainDb ethdb.Database, - odr *LesOdr, - txrelay *LesTxRelay, - serverPool *serverPool, - quitSync chan struct{}, - wg *sync.WaitGroup, - ulcConfig *eth.ULCConfig, synced func() bool) (*ProtocolManager, error) { +func NewProtocolManager(chainConfig *params.ChainConfig, checkpoint *params.TrustedCheckpoint, indexerConfig *light.IndexerConfig, ulcServers []string, ulcFraction int, client bool, networkId uint64, mux *event.TypeMux, peers *peerSet, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, serverPool *serverPool, registrar *checkpointOracle, quitSync chan struct{}, wg *sync.WaitGroup, synced func() bool) (*ProtocolManager, error) { // Create the protocol manager with the base fields manager := &ProtocolManager{ client: client, @@ -159,13 +141,14 @@ func NewProtocolManager( odr: odr, networkId: networkId, txpool: txpool, - txrelay: txrelay, serverPool: serverPool, + reg: registrar, peers: peers, newPeerCh: make(chan *peer), quitSync: quitSync, wg: wg, noMorePeers: make(chan struct{}), + checkpoint: checkpoint, synced: synced, } if odr != nil { @@ -173,20 +156,24 @@ func NewProtocolManager( manager.reqDist = odr.retriever.dist } - if ulcConfig != nil { - manager.ulc = newULC(ulcConfig) + if ulcServers != nil { + ulc, err := newULC(ulcServers, ulcFraction) + if err != nil { + log.Warn("Failed to initialize ultra light client", "err", err) + } else { + manager.ulc = ulc + } } - removePeer := manager.removePeer if disableClientRemovePeer { removePeer = func(id string) {} } if client { - var checkpoint uint64 - if cht, ok := params.TrustedCheckpoints[blockchain.Genesis().Hash()]; ok { - checkpoint = (cht.SectionIndex+1)*params.CHTFrequency - 1 + var checkpointNumber uint64 + if checkpoint != nil { + checkpointNumber = (checkpoint.SectionIndex+1)*params.CHTFrequency - 1 } - manager.downloader = downloader.New(checkpoint, chainDb, nil, manager.eventMux, nil, blockchain, removePeer) + manager.downloader = downloader.New(checkpointNumber, chainDb, nil, manager.eventMux, nil, blockchain, removePeer) manager.peers.notify((*downloaderPeerNotify)(manager)) manager.fetcher = newLightFetcher(manager) } @@ -263,11 +250,11 @@ func (pm *ProtocolManager) runPeer(version uint, p *p2p.Peer, rw p2p.MsgReadWrit } func (pm *ProtocolManager) newPeer(pv int, nv uint64, p *p2p.Peer, rw p2p.MsgReadWriter) *peer { - var isTrusted bool - if pm.isULCEnabled() { - isTrusted = pm.ulc.isTrusted(p.ID()) + var trusted bool + if pm.ulc != nil { + trusted = pm.ulc.trusted(p.ID()) } - return newPeer(pv, nv, isTrusted, p, newMeteredMsgWriter(rw)) + return newPeer(pv, nv, trusted, p, newMeteredMsgWriter(rw)) } // handle is the callback invoked to manage the life cycle of a les peer. When @@ -276,11 +263,12 @@ func (pm *ProtocolManager) handle(p *peer) error { // Ignore maxPeers if this is a trusted peer // In server mode we try to check into the client pool after handshake if pm.client && pm.peers.Len() >= pm.maxPeers && !p.Peer.Info().Network.Trusted { - pm.logger.Event("Rejected (too many peers), " + p.id) + clientRejectedMeter.Mark(1) return p2p.DiscTooManyPeers } // Reject light clients if server is not synced. if !pm.client && !pm.synced() { + clientRejectedMeter.Mark(1) return p2p.DiscRequested } p.Log().Debug("Light Ethereum peer connected", "name", p.Name()) @@ -295,7 +283,7 @@ func (pm *ProtocolManager) handle(p *peer) error { ) if err := p.Handshake(td, hash, number, genesis.Hash(), pm.server); err != nil { p.Log().Debug("Light Ethereum handshake failed", "err", err) - pm.logger.Event("Handshake error: " + err.Error() + ", " + p.id) + clientErrorMeter.Mark(1) return err } if p.fcClient != nil { @@ -308,14 +296,14 @@ func (pm *ProtocolManager) handle(p *peer) error { // Register the peer locally if err := pm.peers.Register(p); err != nil { + clientErrorMeter.Mark(1) p.Log().Error("Light Ethereum peer registration failed", "err", err) - pm.logger.Event("Peer registration error: " + err.Error() + ", " + p.id) return err } - pm.logger.Event("Connection established, " + p.id) + connectedAt := time.Now() defer func() { - pm.logger.Event("Closed connection, " + p.id) pm.removePeer(p.id) + connectionTimer.UpdateSince(connectedAt) }() // Register the peer in the downloader. If the downloader considers it banned, we disconnect @@ -331,11 +319,9 @@ func (pm *ProtocolManager) handle(p *peer) error { pm.serverPool.registered(p.poolEntry) } } - // main loop. handle incoming messages. for { if err := pm.handleMsg(p); err != nil { - pm.logger.Event("Message handling error: " + err.Error() + ", " + p.id) p.Log().Debug("Light Ethereum message handling failed", "err", err) if p.fcServer != nil { p.fcServer.DumpLogs() @@ -459,7 +445,9 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { if err := msg.Decode(&req); err != nil { return errResp(ErrDecode, "%v: %v", msg, err) } - + if err := req.sanityCheck(); err != nil { + return err + } update, size := req.Update.decode() if p.rejectUpdate(size) { return errResp(ErrRequestRejected, "") @@ -1212,14 +1200,6 @@ func (pm *ProtocolManager) txStatus(hash common.Hash) light.TxStatus { return stat } -// isULCEnabled returns true if we can use ULC -func (pm *ProtocolManager) isULCEnabled() bool { - if pm.ulc == nil || len(pm.ulc.trustedKeys) == 0 { - return false - } - return true -} - // downloaderPeerNotify implements peerSetNotify type downloaderPeerNotify ProtocolManager diff --git a/vendor/github.com/ethereum/go-ethereum/les/metrics.go b/vendor/github.com/ethereum/go-ethereum/les/metrics.go new file mode 100644 index 00000000..4c6737a4 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/les/metrics.go @@ -0,0 +1,96 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package les + +import ( + "github.com/ethereum/go-ethereum/metrics" + "github.com/ethereum/go-ethereum/p2p" +) + +var ( + miscInPacketsMeter = metrics.NewRegisteredMeter("les/misc/in/packets", nil) + miscInTrafficMeter = metrics.NewRegisteredMeter("les/misc/in/traffic", nil) + miscOutPacketsMeter = metrics.NewRegisteredMeter("les/misc/out/packets", nil) + miscOutTrafficMeter = metrics.NewRegisteredMeter("les/misc/out/traffic", nil) + + connectionTimer = metrics.NewRegisteredTimer("les/connectionTime", nil) + + totalConnectedGauge = metrics.NewRegisteredGauge("les/server/totalConnected", nil) + totalCapacityGauge = metrics.NewRegisteredGauge("les/server/totalCapacity", nil) + totalRechargeGauge = metrics.NewRegisteredGauge("les/server/totalRecharge", nil) + blockProcessingTimer = metrics.NewRegisteredTimer("les/server/blockProcessingTime", nil) + requestServedTimer = metrics.NewRegisteredTimer("les/server/requestServed", nil) + requestServedMeter = metrics.NewRegisteredMeter("les/server/totalRequestServed", nil) + requestEstimatedMeter = metrics.NewRegisteredMeter("les/server/totalRequestEstimated", nil) + relativeCostHistogram = metrics.NewRegisteredHistogram("les/server/relativeCost", nil, metrics.NewExpDecaySample(1028, 0.015)) + recentServedGauge = metrics.NewRegisteredGauge("les/server/recentRequestServed", nil) + recentEstimatedGauge = metrics.NewRegisteredGauge("les/server/recentRequestEstimated", nil) + sqServedGauge = metrics.NewRegisteredGauge("les/server/servingQueue/served", nil) + sqQueuedGauge = metrics.NewRegisteredGauge("les/server/servingQueue/queued", nil) + clientConnectedMeter = metrics.NewRegisteredMeter("les/server/clientEvent/connected", nil) + clientRejectedMeter = metrics.NewRegisteredMeter("les/server/clientEvent/rejected", nil) + clientKickedMeter = metrics.NewRegisteredMeter("les/server/clientEvent/kicked", nil) + // clientDisconnectedMeter = metrics.NewRegisteredMeter("les/server/clientEvent/disconnected", nil) + clientFreezeMeter = metrics.NewRegisteredMeter("les/server/clientEvent/freeze", nil) + clientErrorMeter = metrics.NewRegisteredMeter("les/server/clientEvent/error", nil) +) + +// meteredMsgReadWriter is a wrapper around a p2p.MsgReadWriter, capable of +// accumulating the above defined metrics based on the data stream contents. +type meteredMsgReadWriter struct { + p2p.MsgReadWriter // Wrapped message stream to meter + version int // Protocol version to select correct meters +} + +// newMeteredMsgWriter wraps a p2p MsgReadWriter with metering support. If the +// metrics system is disabled, this function returns the original object. +func newMeteredMsgWriter(rw p2p.MsgReadWriter) p2p.MsgReadWriter { + if !metrics.Enabled { + return rw + } + return &meteredMsgReadWriter{MsgReadWriter: rw} +} + +// Init sets the protocol version used by the stream to know which meters to +// increment in case of overlapping message ids between protocol versions. +func (rw *meteredMsgReadWriter) Init(version int) { + rw.version = version +} + +func (rw *meteredMsgReadWriter) ReadMsg() (p2p.Msg, error) { + // Read the message and short circuit in case of an error + msg, err := rw.MsgReadWriter.ReadMsg() + if err != nil { + return msg, err + } + // Account for the data traffic + packets, traffic := miscInPacketsMeter, miscInTrafficMeter + packets.Mark(1) + traffic.Mark(int64(msg.Size)) + + return msg, err +} + +func (rw *meteredMsgReadWriter) WriteMsg(msg p2p.Msg) error { + // Account for the data traffic + packets, traffic := miscOutPacketsMeter, miscOutTrafficMeter + packets.Mark(1) + traffic.Mark(int64(msg.Size)) + + // Send the packet to the p2p layer + return rw.MsgReadWriter.WriteMsg(msg) +} diff --git a/vendor/github.com/ethereum/go-ethereum/les/odr.go b/vendor/github.com/ethereum/go-ethereum/les/odr.go index 9176924c..a26c0668 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/odr.go +++ b/vendor/github.com/ethereum/go-ethereum/les/odr.go @@ -108,7 +108,7 @@ func (odr *LesOdr) Retrieve(ctx context.Context, req light.OdrRequest) (err erro }, canSend: func(dp distPeer) bool { p := dp.(*peer) - if !p.isOnlyAnnounce { + if !p.onlyAnnounce { return lreq.CanSend(p) } return false diff --git a/vendor/github.com/ethereum/go-ethereum/les/odr_requests.go b/vendor/github.com/ethereum/go-ethereum/les/odr_requests.go index 89c60917..3c4dd709 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/odr_requests.go +++ b/vendor/github.com/ethereum/go-ethereum/les/odr_requests.go @@ -166,11 +166,13 @@ func (r *ReceiptsRequest) Validate(db ethdb.Database, msg *Msg) error { receipt := receipts[0] // Retrieve our stored header and validate receipt content against it - header := rawdb.ReadHeader(db, r.Hash, r.Number) - if header == nil { + if r.Header == nil { + r.Header = rawdb.ReadHeader(db, r.Hash, r.Number) + } + if r.Header == nil { return errHeaderUnavailable } - if header.ReceiptHash != types.DeriveSha(receipt) { + if r.Header.ReceiptHash != types.DeriveSha(receipt) { return errReceiptHashMismatch } // Validations passed, store and return @@ -323,7 +325,11 @@ func (r *ChtRequest) CanSend(peer *peer) bool { peer.lock.RLock() defer peer.lock.RUnlock() - return peer.headInfo.Number >= r.Config.ChtConfirms && r.ChtNum <= (peer.headInfo.Number-r.Config.ChtConfirms)/r.Config.ChtSize + if r.Untrusted { + return peer.headInfo.Number >= r.BlockNum && peer.id == r.PeerId + } else { + return peer.headInfo.Number >= r.Config.ChtConfirms && r.ChtNum <= (peer.headInfo.Number-r.Config.ChtConfirms)/r.Config.ChtSize + } } // Request sends an ODR request to the LES network (implementation of LesOdrRequest) @@ -364,32 +370,37 @@ func (r *ChtRequest) Validate(db ethdb.Database, msg *Msg) error { } // Verify the CHT - var encNumber [8]byte - binary.BigEndian.PutUint64(encNumber[:], r.BlockNum) - - reads := &readTraceDB{db: nodeSet} - value, _, err := trie.VerifyProof(r.ChtRoot, encNumber[:], reads) - if err != nil { - return fmt.Errorf("merkle proof verification failed: %v", err) - } - if len(reads.reads) != nodeSet.KeyCount() { - return errUselessNodes - } - + // Note: For untrusted CHT request, there is no proof response but + // header data. var node light.ChtNode - if err := rlp.DecodeBytes(value, &node); err != nil { - return err - } - if node.Hash != header.Hash() { - return errCHTHashMismatch - } - if r.BlockNum != header.Number.Uint64() { - return errCHTNumberMismatch + if !r.Untrusted { + var encNumber [8]byte + binary.BigEndian.PutUint64(encNumber[:], r.BlockNum) + + reads := &readTraceDB{db: nodeSet} + value, _, err := trie.VerifyProof(r.ChtRoot, encNumber[:], reads) + if err != nil { + return fmt.Errorf("merkle proof verification failed: %v", err) + } + if len(reads.reads) != nodeSet.KeyCount() { + return errUselessNodes + } + + if err := rlp.DecodeBytes(value, &node); err != nil { + return err + } + if node.Hash != header.Hash() { + return errCHTHashMismatch + } + if r.BlockNum != header.Number.Uint64() { + return errCHTNumberMismatch + } } // Verifications passed, store and return r.Header = header r.Proof = nodeSet - r.Td = node.Td + r.Td = node.Td // For untrusted request, td here is nil, todo improve the les/2 protocol + return nil } diff --git a/vendor/github.com/ethereum/go-ethereum/les/peer.go b/vendor/github.com/ethereum/go-ethereum/les/peer.go index a615c9b7..1aa1613b 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/peer.go +++ b/vendor/github.com/ethereum/go-ethereum/les/peer.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/les/flowcontrol" "github.com/ethereum/go-ethereum/light" "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" ) @@ -79,6 +80,10 @@ type peer struct { announceType uint64 + // Checkpoint relative fields + checkpoint params.TrustedCheckpoint + checkpointNumber uint64 + id string headInfo *announceData @@ -105,21 +110,21 @@ type peer struct { fcParams flowcontrol.ServerParams fcCosts requestCostTable - isTrusted bool - isOnlyAnnounce bool + trusted bool + onlyAnnounce bool chainSince, chainRecent uint64 stateSince, stateRecent uint64 } -func newPeer(version int, network uint64, isTrusted bool, p *p2p.Peer, rw p2p.MsgReadWriter) *peer { +func newPeer(version int, network uint64, trusted bool, p *p2p.Peer, rw p2p.MsgReadWriter) *peer { return &peer{ - Peer: p, - rw: rw, - version: version, - network: network, - id: fmt.Sprintf("%x", p.ID().Bytes()), - isTrusted: isTrusted, - errCh: make(chan error, 1), + Peer: p, + rw: rw, + version: version, + network: network, + id: fmt.Sprintf("%x", p.ID().Bytes()), + trusted: trusted, + errCh: make(chan error, 1), } } @@ -575,10 +580,18 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis send = send.add("flowControl/MRC", costList) p.fcCosts = costList.decode(ProtocolLengths[uint(p.version)]) p.fcParams = server.defParams + + if server.protocolManager != nil && server.protocolManager.reg != nil && server.protocolManager.reg.isRunning() { + cp, height := server.protocolManager.reg.stableCheckpoint() + if cp != nil { + send = send.add("checkpoint/value", cp) + send = send.add("checkpoint/registerHeight", height) + } + } } else { //on client node p.announceType = announceTypeSimple - if p.isTrusted { + if p.trusted { p.announceType = announceTypeSigned } send = send.add("announceType", p.announceType) @@ -639,40 +652,44 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, headNum uint64, genesis } else { //mark OnlyAnnounce server if "serveHeaders", "serveChainSince", "serveStateSince" or "txRelay" fields don't exist if recv.get("serveChainSince", &p.chainSince) != nil { - p.isOnlyAnnounce = true + p.onlyAnnounce = true } if recv.get("serveRecentChain", &p.chainRecent) != nil { p.chainRecent = 0 } if recv.get("serveStateSince", &p.stateSince) != nil { - p.isOnlyAnnounce = true + p.onlyAnnounce = true } if recv.get("serveRecentState", &p.stateRecent) != nil { p.stateRecent = 0 } if recv.get("txRelay", nil) != nil { - p.isOnlyAnnounce = true + p.onlyAnnounce = true } - if p.isOnlyAnnounce && !p.isTrusted { + if p.onlyAnnounce && !p.trusted { return errResp(ErrUselessPeer, "peer cannot serve requests") } - var params flowcontrol.ServerParams - if err := recv.get("flowControl/BL", ¶ms.BufLimit); err != nil { + var sParams flowcontrol.ServerParams + if err := recv.get("flowControl/BL", &sParams.BufLimit); err != nil { return err } - if err := recv.get("flowControl/MRR", ¶ms.MinRecharge); err != nil { + if err := recv.get("flowControl/MRR", &sParams.MinRecharge); err != nil { return err } var MRC RequestCostList if err := recv.get("flowControl/MRC", &MRC); err != nil { return err } - p.fcParams = params - p.fcServer = flowcontrol.NewServerNode(params, &mclock.System{}) + p.fcParams = sParams + p.fcServer = flowcontrol.NewServerNode(sParams, &mclock.System{}) p.fcCosts = MRC.decode(ProtocolLengths[uint(p.version)]) - if !p.isOnlyAnnounce { + + recv.get("checkpoint/value", &p.checkpoint) + recv.get("checkpoint/registerHeight", &p.checkpointNumber) + + if !p.onlyAnnounce { for msgCode := range reqAvgTimeCost { if p.fcCosts[msgCode] == nil { return errResp(ErrUselessPeer, "peer does not support message %d", msgCode) diff --git a/vendor/github.com/ethereum/go-ethereum/les/protocol.go b/vendor/github.com/ethereum/go-ethereum/les/protocol.go index ebf58147..5fdf32b7 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/protocol.go +++ b/vendor/github.com/ethereum/go-ethereum/les/protocol.go @@ -149,6 +149,14 @@ type announceData struct { Update keyValueList } +// sanityCheck verifies that the values are reasonable, as a DoS protection +func (a *announceData) sanityCheck() error { + if tdlen := a.Td.BitLen(); tdlen > 100 { + return fmt.Errorf("too large block TD: bitlen %d", tdlen) + } + return nil +} + // sign adds a signature to the block announcement by the given privKey func (a *announceData) sign(privKey *ecdsa.PrivateKey) { rlp, _ := rlp.EncodeToBytes(announceBlock{a.Hash, a.Number, a.Td}) diff --git a/vendor/github.com/ethereum/go-ethereum/les/server.go b/vendor/github.com/ethereum/go-ethereum/les/server.go index fbdf6cf1..0795baf9 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/server.go +++ b/vendor/github.com/ethereum/go-ethereum/les/server.go @@ -21,13 +21,13 @@ import ( "sync" "time" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/les/csvlogger" "github.com/ethereum/go-ethereum/les/flowcontrol" "github.com/ethereum/go-ethereum/light" "github.com/ethereum/go-ethereum/log" @@ -39,15 +39,6 @@ import ( const bufLimitRatio = 6000 // fixed bufLimit/MRR ratio -const ( - logFileName = "" // csv log file name (disabled if empty) - logClientPoolMetrics = true // log client pool metrics - logClientPoolEvents = false // detailed client pool event logging - logRequestServing = true // log request serving metrics and events - logBlockProcEvents = true // log block processing events - logProtocolHandler = true // log protocol handler events -) - type LesServer struct { lesCommons @@ -61,79 +52,36 @@ type LesServer struct { privateKey *ecdsa.PrivateKey quitSync chan struct{} onlyAnnounce bool - csvLogger *csvlogger.Logger - logTotalCap *csvlogger.Channel thcNormal, thcBlockProcessing int // serving thread count for normal operation and block processing mode maxPeers int minCapacity, freeClientCap uint64 freeClientPool *freeClientPool - priorityClientPool *priorityClientPool } -func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { - var csvLogger *csvlogger.Logger - if logFileName != "" { - csvLogger = csvlogger.NewLogger(logFileName, time.Second*10, "event, peerId") - } - - quitSync := make(chan struct{}) - pm, err := NewProtocolManager( - eth.BlockChain().Config(), - light.DefaultServerIndexerConfig, - false, - config.NetworkId, - eth.EventMux(), - eth.Engine(), - newPeerSet(), - eth.BlockChain(), - eth.TxPool(), - eth.ChainDb(), - nil, - nil, - nil, - quitSync, - new(sync.WaitGroup), - config.ULC, - eth.Synced) - if err != nil { - return nil, err - } - if logProtocolHandler { - pm.logger = csvLogger - } - requestLogger := csvLogger - if !logRequestServing { - requestLogger = nil - } - pm.servingQueue = newServingQueue(int64(time.Millisecond*10), float64(config.LightServ)/100, requestLogger) - +func NewLesServer(e *eth.Ethereum, config *eth.Config) (*LesServer, error) { lesTopics := make([]discv5.Topic, len(AdvertiseProtocolVersions)) for i, pv := range AdvertiseProtocolVersions { - lesTopics[i] = lesTopic(eth.BlockChain().Genesis().Hash(), pv) + lesTopics[i] = lesTopic(e.BlockChain().Genesis().Hash(), pv) } - + quitSync := make(chan struct{}) srv := &LesServer{ lesCommons: lesCommons{ config: config, - chainDb: eth.ChainDb(), iConfig: light.DefaultServerIndexerConfig, - chtIndexer: light.NewChtIndexer(eth.ChainDb(), nil, params.CHTFrequency, params.HelperTrieProcessConfirmations), - bloomTrieIndexer: light.NewBloomTrieIndexer(eth.ChainDb(), nil, params.BloomBitsBlocks, params.BloomTrieFrequency), - protocolManager: pm, + chainDb: e.ChainDb(), + chtIndexer: light.NewChtIndexer(e.ChainDb(), nil, params.CHTFrequency, params.HelperTrieProcessConfirmations), + bloomTrieIndexer: light.NewBloomTrieIndexer(e.ChainDb(), nil, params.BloomBitsBlocks, params.BloomTrieFrequency), }, - archiveMode: eth.ArchiveMode(), + archiveMode: e.ArchiveMode(), quitSync: quitSync, lesTopics: lesTopics, - onlyAnnounce: config.OnlyAnnounce, - csvLogger: csvLogger, - logTotalCap: requestLogger.NewChannel("totalCapacity", 0.01), + onlyAnnounce: config.UltraLightOnlyAnnounce, } - srv.costTracker, srv.minCapacity = newCostTracker(eth.ChainDb(), config, requestLogger) + srv.costTracker, srv.minCapacity = newCostTracker(e.ChainDb(), config) logger := log.New() - pm.server = srv srv.thcNormal = config.LightServ * 4 / 100 if srv.thcNormal < 4 { srv.thcNormal = 4 @@ -141,22 +89,28 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) { srv.thcBlockProcessing = config.LightServ/100 + 1 srv.fcManager = flowcontrol.NewClientManager(nil, &mclock.System{}) - chtSectionCount, _, _ := srv.chtIndexer.Sections() - if chtSectionCount != 0 { - chtLastSection := chtSectionCount - 1 - chtSectionHead := srv.chtIndexer.SectionHead(chtLastSection) - chtRoot := light.GetChtRoot(pm.chainDb, chtLastSection, chtSectionHead) - logger.Info("Loaded CHT", "section", chtLastSection, "head", chtSectionHead, "root", chtRoot) - } - bloomTrieSectionCount, _, _ := srv.bloomTrieIndexer.Sections() - if bloomTrieSectionCount != 0 { - bloomTrieLastSection := bloomTrieSectionCount - 1 - bloomTrieSectionHead := srv.bloomTrieIndexer.SectionHead(bloomTrieLastSection) - bloomTrieRoot := light.GetBloomTrieRoot(pm.chainDb, bloomTrieLastSection, bloomTrieSectionHead) - logger.Info("Loaded bloom trie", "section", bloomTrieLastSection, "head", bloomTrieSectionHead, "root", bloomTrieRoot) + checkpoint := srv.latestLocalCheckpoint() + if !checkpoint.Empty() { + logger.Info("Loaded latest checkpoint", "section", checkpoint.SectionIndex, "head", checkpoint.SectionHead, + "chtroot", checkpoint.CHTRoot, "bloomroot", checkpoint.BloomRoot) } - srv.chtIndexer.Start(eth.BlockChain()) + srv.chtIndexer.Start(e.BlockChain()) + + oracle := config.CheckpointOracle + if oracle == nil { + oracle = params.CheckpointOracles[e.BlockChain().Genesis().Hash()] + } + registrar := newCheckpointOracle(oracle, srv.getLocalCheckpoint) + // TODO(rjl493456442) Checkpoint is useless for les server, separate handler for client and server. + pm, err := NewProtocolManager(e.BlockChain().Config(), nil, light.DefaultServerIndexerConfig, config.UltraLightServers, config.UltraLightFraction, false, config.NetworkId, e.EventMux(), newPeerSet(), e.BlockChain(), e.TxPool(), e.ChainDb(), nil, nil, registrar, quitSync, new(sync.WaitGroup), e.Synced) + if err != nil { + return nil, err + } + srv.protocolManager = pm + pm.servingQueue = newServingQueue(int64(time.Millisecond*10), float64(config.LightServ)/100) + pm.server = srv + return srv, nil } @@ -165,7 +119,7 @@ func (s *LesServer) APIs() []rpc.API { { Namespace: "les", Version: "1.0", - Service: NewPrivateLightServerAPI(s), + Service: NewPrivateLightAPI(&s.lesCommons, s.protocolManager.reg), Public: false, }, } @@ -177,11 +131,10 @@ func (s *LesServer) APIs() []rpc.API { func (s *LesServer) startEventLoop() { s.protocolManager.wg.Add(1) - blockProcLogger := s.csvLogger - if !logBlockProcEvents { - blockProcLogger = nil - } - var processing, procLast bool + var ( + processing, procLast bool + procStarted time.Time + ) blockProcFeed := make(chan bool, 100) s.protocolManager.blockchain.(*core.BlockChain).SubscribeBlockProcessingEvent(blockProcFeed) totalRechargeCh := make(chan uint64, 100) @@ -190,13 +143,13 @@ func (s *LesServer) startEventLoop() { updateRecharge := func() { if processing { if !procLast { - blockProcLogger.Event("block processing started") + procStarted = time.Now() } s.protocolManager.servingQueue.setThreads(s.thcBlockProcessing) s.fcManager.SetRechargeCurve(flowcontrol.PieceWiseLinear{{0, 0}, {totalRecharge, totalRecharge}}) } else { if procLast { - blockProcLogger.Event("block processing finished") + blockProcessingTimer.UpdateSince(procStarted) } s.protocolManager.servingQueue.setThreads(s.thcNormal) s.fcManager.SetRechargeCurve(flowcontrol.PieceWiseLinear{{0, 0}, {totalRecharge / 16, totalRecharge / 2}, {totalRecharge / 2, totalRecharge / 2}, {totalRecharge, totalRecharge}}) @@ -205,7 +158,7 @@ func (s *LesServer) startEventLoop() { } updateRecharge() totalCapacity := s.fcManager.SubscribeTotalCapacity(totalCapacityCh) - s.priorityClientPool.setLimits(s.maxPeers, totalCapacity) + s.freeClientPool.setLimits(s.maxPeers, totalCapacity) var maxFreePeers uint64 go func() { @@ -216,13 +169,13 @@ func (s *LesServer) startEventLoop() { case totalRecharge = <-totalRechargeCh: updateRecharge() case totalCapacity = <-totalCapacityCh: - s.logTotalCap.Update(float64(totalCapacity)) + totalCapacityGauge.Update(int64(totalCapacity)) newFreePeers := totalCapacity / s.freeClientCap if newFreePeers < maxFreePeers && newFreePeers < uint64(s.maxPeers) { log.Warn("Reduced total capacity", "maxFreePeers", newFreePeers) } maxFreePeers = newFreePeers - s.priorityClientPool.setLimits(s.maxPeers, totalCapacity) + s.freeClientPool.setLimits(s.maxPeers, totalCapacity) case <-s.protocolManager.quitSync: s.protocolManager.wg.Done() return @@ -257,19 +210,9 @@ func (s *LesServer) Start(srvr *p2p.Server) { maxCapacity = totalRecharge } s.fcManager.SetCapacityLimits(s.freeClientCap, maxCapacity, s.freeClientCap*2) - poolMetricsLogger := s.csvLogger - if !logClientPoolMetrics { - poolMetricsLogger = nil - } - poolEventLogger := s.csvLogger - if !logClientPoolEvents { - poolEventLogger = nil - } - s.freeClientPool = newFreeClientPool(s.chainDb, s.freeClientCap, 10000, mclock.System{}, func(id string) { go s.protocolManager.removePeer(id) }, poolMetricsLogger, poolEventLogger) - s.priorityClientPool = newPriorityClientPool(s.freeClientCap, s.protocolManager.peers, s.freeClientPool, poolMetricsLogger, poolEventLogger) + s.freeClientPool = newFreeClientPool(s.chainDb, s.freeClientCap, 10000, mclock.System{}, func(id string) { go s.protocolManager.removePeer(id) }) + s.protocolManager.peers.notify(s.freeClientPool) - s.protocolManager.peers.notify(s.priorityClientPool) - s.csvLogger.Start() s.startEventLoop() s.protocolManager.Start(s.config.LightPeers) if srvr.DiscV5 != nil { @@ -292,6 +235,13 @@ func (s *LesServer) SetBloomBitsIndexer(bloomIndexer *core.ChainIndexer) { bloomIndexer.AddChildIndexer(s.bloomTrieIndexer) } +// SetClient sets the rpc client and starts running checkpoint contract if it is not yet watched. +func (s *LesServer) SetContractBackend(backend bind.ContractBackend) { + if s.protocolManager.reg != nil { + s.protocolManager.reg.start(backend) + } +} + // Stop stops the LES service func (s *LesServer) Stop() { s.fcManager.Stop() @@ -303,7 +253,6 @@ func (s *LesServer) Stop() { s.freeClientPool.stop() s.costTracker.stop() s.protocolManager.Stop() - s.csvLogger.Stop() } // todo(rjl493456442) separate client and server implementation. diff --git a/vendor/github.com/ethereum/go-ethereum/les/servingqueue.go b/vendor/github.com/ethereum/go-ethereum/les/servingqueue.go index 26656ec0..a9e8369f 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/servingqueue.go +++ b/vendor/github.com/ethereum/go-ethereum/les/servingqueue.go @@ -17,14 +17,12 @@ package les import ( - "fmt" "sort" "sync" "sync/atomic" "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/common/prque" - "github.com/ethereum/go-ethereum/les/csvlogger" ) // servingQueue allows running tasks in a limited number of threads and puts the @@ -44,10 +42,6 @@ type servingQueue struct { queue *prque.Prque // priority queue for waiting or suspended tasks best *servingTask // the highest priority task (not included in the queue) suspendBias int64 // priority bias against suspending an already running task - - logger *csvlogger.Logger - logRecentTime *csvlogger.Channel - logQueuedTime *csvlogger.Channel } // servingTask represents a request serving task. Tasks can be implemented to @@ -127,7 +121,7 @@ func (t *servingTask) waitOrStop() bool { } // newServingQueue returns a new servingQueue -func newServingQueue(suspendBias int64, utilTarget float64, logger *csvlogger.Logger) *servingQueue { +func newServingQueue(suspendBias int64, utilTarget float64) *servingQueue { sq := &servingQueue{ queue: prque.New(nil), suspendBias: suspendBias, @@ -140,9 +134,6 @@ func newServingQueue(suspendBias int64, utilTarget float64, logger *csvlogger.Lo burstDropLimit: uint64(utilTarget * bufLimitRatio * 1000000), burstDecRate: utilTarget, lastUpdate: mclock.Now(), - logger: logger, - logRecentTime: logger.NewMinMaxChannel("recentTime", false), - logQueuedTime: logger.NewMinMaxChannel("queuedTime", false), } sq.wg.Add(2) go sq.queueLoop() @@ -246,16 +237,13 @@ func (sq *servingQueue) freezePeers() { } sort.Sort(peerList) drop := true - sq.logger.Event("freezing peers") for _, tasks := range peerList { if drop { tasks.peer.freezeClient() tasks.peer.fcClient.Freeze() sq.queuedTime -= tasks.sumTime - if sq.logQueuedTime != nil { - sq.logQueuedTime.Update(float64(sq.queuedTime) / 1000) - } - sq.logger.Event(fmt.Sprintf("frozen peer sumTime=%d, %v", tasks.sumTime, tasks.peer.id)) + sqQueuedGauge.Update(int64(sq.queuedTime)) + clientFreezeMeter.Mark(1) drop = sq.recentTime+sq.queuedTime > sq.burstDropLimit for _, task := range tasks.list { task.tokenCh <- nil @@ -299,10 +287,8 @@ func (sq *servingQueue) addTask(task *servingTask) { } sq.updateRecentTime() sq.queuedTime += task.expTime - if sq.logQueuedTime != nil { - sq.logRecentTime.Update(float64(sq.recentTime) / 1000) - sq.logQueuedTime.Update(float64(sq.queuedTime) / 1000) - } + sqServedGauge.Update(int64(sq.recentTime)) + sqQueuedGauge.Update(int64(sq.queuedTime)) if sq.recentTime+sq.queuedTime > sq.burstLimit { sq.freezePeers() } @@ -322,10 +308,8 @@ func (sq *servingQueue) queueLoop() { sq.updateRecentTime() sq.queuedTime -= expTime sq.recentTime += expTime - if sq.logQueuedTime != nil { - sq.logRecentTime.Update(float64(sq.recentTime) / 1000) - sq.logQueuedTime.Update(float64(sq.queuedTime) / 1000) - } + sqServedGauge.Update(int64(sq.recentTime)) + sqQueuedGauge.Update(int64(sq.queuedTime)) if sq.queue.Size() == 0 { sq.best = nil } else { diff --git a/vendor/github.com/ethereum/go-ethereum/les/sync.go b/vendor/github.com/ethereum/go-ethereum/les/sync.go new file mode 100644 index 00000000..54fd81c2 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/les/sync.go @@ -0,0 +1,212 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package les + +import ( + "context" + "errors" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/eth/downloader" + "github.com/ethereum/go-ethereum/light" + "github.com/ethereum/go-ethereum/log" +) + +var errInvalidCheckpoint = errors.New("invalid advertised checkpoint") + +const ( + // lightSync starts syncing from the current highest block. + // If the chain is empty, syncing the entire header chain. + lightSync = iota + + // legacyCheckpointSync starts syncing from a hardcoded checkpoint. + legacyCheckpointSync + + // checkpointSync starts syncing from a checkpoint signed by trusted + // signer or hardcoded checkpoint for compatibility. + checkpointSync +) + +// syncer is responsible for periodically synchronising with the network, both +// downloading hashes and blocks as well as handling the announcement handler. +func (pm *ProtocolManager) syncer() { + // Start and ensure cleanup of sync mechanisms + //pm.fetcher.Start() + //defer pm.fetcher.Stop() + defer pm.downloader.Terminate() + + // Wait for different events to fire synchronisation operations + //forceSync := time.Tick(forceSyncCycle) + for { + select { + case <-pm.newPeerCh: + /* // Make sure we have peers to select from, then sync + if pm.peers.Len() < minDesiredPeerCount { + break + } + go pm.synchronise(pm.peers.BestPeer()) + */ + /*case <-forceSync: + // Force a sync even if not enough peers are present + go pm.synchronise(pm.peers.BestPeer()) + */ + case <-pm.noMorePeers: + return + } + } +} + +// validateCheckpoint verifies the advertised checkpoint by peer is valid or not. +// +// Each network has several hard-coded checkpoint signer addresses. Only the +// checkpoint issued by the specified signer is considered valid. +// +// In addition to the checkpoint registered in the registrar contract, there are +// several legacy hardcoded checkpoints in our codebase. These checkpoints are +// also considered as valid. +func (pm *ProtocolManager) validateCheckpoint(peer *peer) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() + + // Fetch the block header corresponding to the checkpoint registration. + cp := peer.checkpoint + header, err := light.GetUntrustedHeaderByNumber(ctx, pm.odr, peer.checkpointNumber, peer.id) + if err != nil { + return err + } + // Fetch block logs associated with the block header. + logs, err := light.GetUntrustedBlockLogs(ctx, pm.odr, header) + if err != nil { + return err + } + events := pm.reg.contract.LookupCheckpointEvents(logs, cp.SectionIndex, cp.Hash()) + if len(events) == 0 { + return errInvalidCheckpoint + } + var ( + index = events[0].Index + hash = events[0].CheckpointHash + signatures [][]byte + ) + for _, event := range events { + signatures = append(signatures, append(event.R[:], append(event.S[:], event.V)...)) + } + valid, signers := pm.reg.verifySigners(index, hash, signatures) + if !valid { + return errInvalidCheckpoint + } + log.Warn("Verified advertised checkpoint", "peer", peer.id, "signers", len(signers)) + return nil +} + +// synchronise tries to sync up our local chain with a remote peer. +func (pm *ProtocolManager) synchronise(peer *peer) { + // Short circuit if the peer is nil. + if peer == nil { + return + } + // Make sure the peer's TD is higher than our own. + latest := pm.blockchain.CurrentHeader() + currentTd := rawdb.ReadTd(pm.chainDb, latest.Hash(), latest.Number.Uint64()) + if currentTd != nil && peer.headBlockInfo().Td.Cmp(currentTd) < 0 { + return + } + // Recap the checkpoint. + // + // The light client may be connected to several different versions of the server. + // (1) Old version server which can not provide stable checkpoint in the handshake packet. + // => Use hardcoded checkpoint or empty checkpoint + // (2) New version server but simple checkpoint syncing is not enabled(e.g. mainnet, new testnet or private network) + // => Use hardcoded checkpoint or empty checkpoint + // (3) New version server but the provided stable checkpoint is even lower than the hardcoded one. + // => Use hardcoded checkpoint + // (4) New version server with valid and higher stable checkpoint + // => Use provided checkpoint + var checkpoint = &peer.checkpoint + var hardcoded bool + if pm.checkpoint != nil && pm.checkpoint.SectionIndex >= peer.checkpoint.SectionIndex { + checkpoint = pm.checkpoint // Use the hardcoded one. + hardcoded = true + } + // Determine whether we should run checkpoint syncing or normal light syncing. + // + // Here has four situations that we will disable the checkpoint syncing: + // + // 1. The checkpoint is empty + // 2. The latest head block of the local chain is above the checkpoint. + // 3. The checkpoint is hardcoded(recap with local hardcoded checkpoint) + // 4. For some networks the checkpoint syncing is not activated. + mode := checkpointSync + switch { + case checkpoint.Empty(): + mode = lightSync + log.Debug("Disable checkpoint syncing", "reason", "empty checkpoint") + case latest.Number.Uint64() >= (checkpoint.SectionIndex+1)*pm.iConfig.ChtSize-1: + mode = lightSync + log.Debug("Disable checkpoint syncing", "reason", "local chain beyond the checkpoint") + case hardcoded: + mode = legacyCheckpointSync + log.Debug("Disable checkpoint syncing", "reason", "checkpoint is hardcoded") + case pm.reg == nil || !pm.reg.isRunning(): + mode = legacyCheckpointSync + log.Debug("Disable checkpoint syncing", "reason", "checkpoint syncing is not activated") + } + // Notify testing framework if syncing has completed(for testing purpose). + defer func() { + if pm.reg != nil && pm.reg.syncDoneHook != nil { + pm.reg.syncDoneHook() + } + }() + start := time.Now() + if mode == checkpointSync || mode == legacyCheckpointSync { + // Validate the advertised checkpoint + if mode == legacyCheckpointSync { + checkpoint = pm.checkpoint + } else if mode == checkpointSync { + if err := pm.validateCheckpoint(peer); err != nil { + log.Debug("Failed to validate checkpoint", "reason", err) + pm.removePeer(peer.id) + return + } + pm.blockchain.(*light.LightChain).AddTrustedCheckpoint(checkpoint) + } + log.Debug("Checkpoint syncing start", "peer", peer.id, "checkpoint", checkpoint.SectionIndex) + + // Fetch the start point block header. + // + // For the ethash consensus engine, the start header is the block header + // of the checkpoint. + // + // For the clique consensus engine, the start header is the block header + // of the latest epoch covered by checkpoint. + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + if !checkpoint.Empty() && !pm.blockchain.(*light.LightChain).SyncCheckpoint(ctx, checkpoint) { + log.Debug("Sync checkpoint failed") + pm.removePeer(peer.id) + return + } + } + // Fetch the remaining block headers based on the current chain header. + if err := pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), downloader.LightSync); err != nil { + log.Debug("Synchronise failed", "reason", err) + return + } + log.Debug("Synchronise finished", "elapsed", common.PrettyDuration(time.Since(start))) +} diff --git a/vendor/github.com/ethereum/go-ethereum/les/transactions.rlp b/vendor/github.com/ethereum/go-ethereum/les/transactions.rlp deleted file mode 100755 index e69de29b..00000000 diff --git a/vendor/github.com/ethereum/go-ethereum/les/txrelay.go b/vendor/github.com/ethereum/go-ethereum/les/txrelay.go index 5ebef1c2..49195161 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/txrelay.go +++ b/vendor/github.com/ethereum/go-ethereum/les/txrelay.go @@ -30,7 +30,7 @@ type ltrInfo struct { sentTo map[*peer]struct{} } -type LesTxRelay struct { +type lesTxRelay struct { txSent map[common.Hash]*ltrInfo txPending map[common.Hash]struct{} ps *peerSet @@ -42,8 +42,8 @@ type LesTxRelay struct { retriever *retrieveManager } -func NewLesTxRelay(ps *peerSet, retriever *retrieveManager) *LesTxRelay { - r := &LesTxRelay{ +func newLesTxRelay(ps *peerSet, retriever *retrieveManager) *lesTxRelay { + r := &lesTxRelay{ txSent: make(map[common.Hash]*ltrInfo), txPending: make(map[common.Hash]struct{}), ps: ps, @@ -54,18 +54,18 @@ func NewLesTxRelay(ps *peerSet, retriever *retrieveManager) *LesTxRelay { return r } -func (self *LesTxRelay) Stop() { +func (self *lesTxRelay) Stop() { close(self.stop) } -func (self *LesTxRelay) registerPeer(p *peer) { +func (self *lesTxRelay) registerPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() self.peerList = self.ps.AllPeers() } -func (self *LesTxRelay) unregisterPeer(p *peer) { +func (self *lesTxRelay) unregisterPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() @@ -74,7 +74,7 @@ func (self *LesTxRelay) unregisterPeer(p *peer) { // send sends a list of transactions to at most a given number of peers at // once, never resending any particular transaction to the same peer twice -func (self *LesTxRelay) send(txs types.Transactions, count int) { +func (self *lesTxRelay) send(txs types.Transactions, count int) { sendTo := make(map[*peer]types.Transactions) self.peerStartPos++ // rotate the starting position of the peer list @@ -130,7 +130,7 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { return peer.GetTxRelayCost(len(ll), len(enc)) }, canSend: func(dp distPeer) bool { - return !dp.(*peer).isOnlyAnnounce && dp.(*peer) == pp + return !dp.(*peer).onlyAnnounce && dp.(*peer) == pp }, request: func(dp distPeer) func() { peer := dp.(*peer) @@ -143,14 +143,14 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { } } -func (self *LesTxRelay) Send(txs types.Transactions) { +func (self *lesTxRelay) Send(txs types.Transactions) { self.lock.Lock() defer self.lock.Unlock() self.send(txs, 3) } -func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { +func (self *lesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { self.lock.Lock() defer self.lock.Unlock() @@ -173,7 +173,7 @@ func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback } } -func (self *LesTxRelay) Discard(hashes []common.Hash) { +func (self *lesTxRelay) Discard(hashes []common.Hash) { self.lock.Lock() defer self.lock.Unlock() diff --git a/vendor/github.com/ethereum/go-ethereum/les/ulc.go b/vendor/github.com/ethereum/go-ethereum/les/ulc.go index 8792f60d..b97217e7 100644 --- a/vendor/github.com/ethereum/go-ethereum/les/ulc.go +++ b/vendor/github.com/ethereum/go-ethereum/les/ulc.go @@ -17,38 +17,38 @@ package les import ( - "github.com/ethereum/go-ethereum/eth" + "errors" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/enode" ) type ulc struct { - trustedKeys map[string]struct{} - minTrustedFraction int + keys map[string]bool + fraction int } -// newULC creates and returns a ultra light client instance. -func newULC(ulcConfig *eth.ULCConfig) *ulc { - if ulcConfig == nil { - return nil - } - m := make(map[string]struct{}, len(ulcConfig.TrustedServers)) - for _, id := range ulcConfig.TrustedServers { +// newULC creates and returns an ultra light client instance. +func newULC(servers []string, fraction int) (*ulc, error) { + keys := make(map[string]bool) + for _, id := range servers { node, err := enode.Parse(enode.ValidSchemes, id) if err != nil { - log.Debug("Failed to parse trusted server", "id", id, "err", err) + log.Warn("Failed to parse trusted server", "id", id, "err", err) continue } - m[node.ID().String()] = struct{}{} + keys[node.ID().String()] = true } - return &ulc{m, ulcConfig.MinTrustedFraction} + if len(keys) == 0 { + return nil, errors.New("no trusted servers") + } + return &ulc{ + keys: keys, + fraction: fraction, + }, nil } -// isTrusted return an indicator that whether the specified peer is trusted. -func (u *ulc) isTrusted(p enode.ID) bool { - if u.trustedKeys == nil { - return false - } - _, ok := u.trustedKeys[p.String()] - return ok +// trusted return an indicator that whether the specified peer is trusted. +func (u *ulc) trusted(p enode.ID) bool { + return u.keys[p.String()] } diff --git a/vendor/github.com/ethereum/go-ethereum/light/lightchain.go b/vendor/github.com/ethereum/go-ethereum/light/lightchain.go index f0beec47..7f64d1c2 100644 --- a/vendor/github.com/ethereum/go-ethereum/light/lightchain.go +++ b/vendor/github.com/ethereum/go-ethereum/light/lightchain.go @@ -77,7 +77,7 @@ type LightChain struct { // NewLightChain returns a fully initialised light chain using information // available in the database. It initialises the default Ethereum header // validator. -func NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus.Engine) (*LightChain, error) { +func NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus.Engine, checkpoint *params.TrustedCheckpoint) (*LightChain, error) { bodyCache, _ := lru.New(bodyCacheLimit) bodyRLPCache, _ := lru.New(bodyCacheLimit) blockCache, _ := lru.New(blockCacheLimit) @@ -101,8 +101,8 @@ func NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus. if bc.genesisBlock == nil { return nil, core.ErrNoGenesis } - if cp, ok := params.TrustedCheckpoints[bc.genesisBlock.Hash()]; ok { - bc.addTrustedCheckpoint(cp) + if checkpoint != nil { + bc.AddTrustedCheckpoint(checkpoint) } if err := bc.loadLastState(); err != nil { return nil, err @@ -118,8 +118,8 @@ func NewLightChain(odr OdrBackend, config *params.ChainConfig, engine consensus. return bc, nil } -// addTrustedCheckpoint adds a trusted checkpoint to the blockchain -func (lc *LightChain) addTrustedCheckpoint(cp *params.TrustedCheckpoint) { +// AddTrustedCheckpoint adds a trusted checkpoint to the blockchain +func (lc *LightChain) AddTrustedCheckpoint(cp *params.TrustedCheckpoint) { if lc.odr.ChtIndexer() != nil { StoreChtRoot(lc.chainDb, cp.SectionIndex, cp.SectionHead, cp.CHTRoot) lc.odr.ChtIndexer().AddCheckpoint(cp.SectionIndex, cp.SectionHead) @@ -131,7 +131,7 @@ func (lc *LightChain) addTrustedCheckpoint(cp *params.TrustedCheckpoint) { if lc.odr.BloomIndexer() != nil { lc.odr.BloomIndexer().AddCheckpoint(cp.SectionIndex, cp.SectionHead) } - log.Info("Added trusted checkpoint", "chain", cp.Name, "block", (cp.SectionIndex+1)*lc.indexerConfig.ChtSize-1, "hash", cp.SectionHead) + log.Info("Added trusted checkpoint", "block", (cp.SectionIndex+1)*lc.indexerConfig.ChtSize-1, "hash", cp.SectionHead) } func (lc *LightChain) getProcInterrupt() bool { @@ -462,21 +462,21 @@ func (lc *LightChain) GetHeaderByNumberOdr(ctx context.Context, number uint64) ( // Config retrieves the header chain's chain configuration. func (lc *LightChain) Config() *params.ChainConfig { return lc.hc.Config() } -func (lc *LightChain) SyncCht(ctx context.Context) bool { - // If we don't have a CHT indexer, abort - if lc.odr.ChtIndexer() == nil { - return false - } - // Ensure the remote CHT head is ahead of us +// SyncCheckpoint fetches the checkpoint point block header according to +// the checkpoint provided by the remote peer. +// +// Note if we are running the clique, fetches the last epoch snapshot header +// which covered by checkpoint. +func (lc *LightChain) SyncCheckpoint(ctx context.Context, checkpoint *params.TrustedCheckpoint) bool { + // Ensure the remote checkpoint head is ahead of us head := lc.CurrentHeader().Number.Uint64() - sections, _, _ := lc.odr.ChtIndexer().Sections() - latest := sections*lc.indexerConfig.ChtSize - 1 + latest := (checkpoint.SectionIndex+1)*lc.indexerConfig.ChtSize - 1 if clique := lc.hc.Config().Clique; clique != nil { latest -= latest % clique.Epoch // epoch snapshot for clique } if head >= latest { - return false + return true } // Retrieve the latest useful header and update to it if header, err := GetHeaderByNumber(ctx, lc.odr, latest); header != nil && err == nil { diff --git a/vendor/github.com/ethereum/go-ethereum/light/odr.go b/vendor/github.com/ethereum/go-ethereum/light/odr.go index d1185e4e..907712ed 100644 --- a/vendor/github.com/ethereum/go-ethereum/light/odr.go +++ b/vendor/github.com/ethereum/go-ethereum/light/odr.go @@ -122,19 +122,25 @@ func (req *BlockRequest) StoreResult(db ethdb.Database) { // ReceiptsRequest is the ODR request type for retrieving block bodies type ReceiptsRequest struct { OdrRequest - Hash common.Hash - Number uint64 - Receipts types.Receipts + Untrusted bool // Indicator whether the result retrieved is trusted or not + Hash common.Hash + Number uint64 + Header *types.Header + Receipts types.Receipts } // StoreResult stores the retrieved data in local database func (req *ReceiptsRequest) StoreResult(db ethdb.Database) { - rawdb.WriteReceipts(db, req.Hash, req.Number, req.Receipts) + if !req.Untrusted { + rawdb.WriteReceipts(db, req.Hash, req.Number, req.Receipts) + } } // ChtRequest is the ODR request type for state/storage trie entries type ChtRequest struct { OdrRequest + Untrusted bool // Indicator whether the result retrieved is trusted or not + PeerId string // The specified peer id from which to retrieve data. Config *IndexerConfig ChtNum, BlockNum uint64 ChtRoot common.Hash @@ -147,9 +153,11 @@ type ChtRequest struct { func (req *ChtRequest) StoreResult(db ethdb.Database) { hash, num := req.Header.Hash(), req.Header.Number.Uint64() - rawdb.WriteHeader(db, req.Header) - rawdb.WriteTd(db, hash, num, req.Td) - rawdb.WriteCanonicalHash(db, hash, num) + if !req.Untrusted { + rawdb.WriteHeader(db, req.Header) + rawdb.WriteTd(db, hash, num, req.Td) + rawdb.WriteCanonicalHash(db, hash, num) + } } // BloomRequest is the ODR request type for retrieving bloom filters from a CHT structure diff --git a/vendor/github.com/ethereum/go-ethereum/light/odr_util.go b/vendor/github.com/ethereum/go-ethereum/light/odr_util.go index 100bd584..82e33bb7 100644 --- a/vendor/github.com/ethereum/go-ethereum/light/odr_util.go +++ b/vendor/github.com/ethereum/go-ethereum/light/odr_util.go @@ -69,6 +69,16 @@ func GetHeaderByNumber(ctx context.Context, odr OdrBackend, number uint64) (*typ return r.Header, nil } +// GetUntrustedHeaderByNumber fetches specified block header without correctness checking. +// Note this function should only be used in light client checkpoint syncing. +func GetUntrustedHeaderByNumber(ctx context.Context, odr OdrBackend, number uint64, peerId string) (*types.Header, error) { + r := &ChtRequest{BlockNum: number, ChtNum: number / odr.IndexerConfig().ChtSize, Untrusted: true, PeerId: peerId, Config: odr.IndexerConfig()} + if err := odr.Retrieve(ctx, r); err != nil { + return nil, err + } + return r.Header, nil +} + func GetCanonicalHash(ctx context.Context, odr OdrBackend, number uint64) (common.Hash, error) { hash := rawdb.ReadCanonicalHash(odr.Database(), number) if (hash != common.Hash{}) { @@ -169,6 +179,30 @@ func GetBlockLogs(ctx context.Context, odr OdrBackend, hash common.Hash, number return logs, nil } +// GetUntrustedBlockLogs retrieves the logs generated by the transactions included in a +// block. The retrieved logs are regarded as untrusted and will not be stored in the +// database. This function should only be used in light client checkpoint syncing. +func GetUntrustedBlockLogs(ctx context.Context, odr OdrBackend, header *types.Header) ([][]*types.Log, error) { + // Retrieve the potentially incomplete receipts from disk or network + hash, number := header.Hash(), header.Number.Uint64() + receipts := rawdb.ReadRawReceipts(odr.Database(), hash, number) + if receipts == nil { + r := &ReceiptsRequest{Hash: hash, Number: number, Header: header, Untrusted: true} + if err := odr.Retrieve(ctx, r); err != nil { + return nil, err + } + receipts = r.Receipts + // Untrusted receipts won't be stored in the database. Therefore + // derived fields computation is unnecessary. + } + // Return the logs without deriving any computed fields on the receipts + logs := make([][]*types.Log, len(receipts)) + for i, receipt := range receipts { + logs[i] = receipt.Logs + } + return logs, nil +} + // GetBloomBits retrieves a batch of compressed bloomBits vectors belonging to the given bit index and section indexes func GetBloomBits(ctx context.Context, odr OdrBackend, bitIdx uint, sectionIdxList []uint64) ([][]byte, error) { var ( diff --git a/vendor/github.com/ethereum/go-ethereum/metrics/metrics.go b/vendor/github.com/ethereum/go-ethereum/metrics/metrics.go index 98e8ced2..8ab4e28f 100644 --- a/vendor/github.com/ethereum/go-ethereum/metrics/metrics.go +++ b/vendor/github.com/ethereum/go-ethereum/metrics/metrics.go @@ -73,28 +73,26 @@ func CollectProcessMetrics(refresh time.Duration) { diskstats[i] = new(DiskStats) } // Define the various metrics to collect - cpuSysLoad := GetOrRegisterGauge("system/cpu/sysload", DefaultRegistry) - cpuSysWait := GetOrRegisterGauge("system/cpu/syswait", DefaultRegistry) - cpuProcLoad := GetOrRegisterGauge("system/cpu/procload", DefaultRegistry) + var ( + cpuSysLoad = GetOrRegisterGauge("system/cpu/sysload", DefaultRegistry) + cpuSysWait = GetOrRegisterGauge("system/cpu/syswait", DefaultRegistry) + cpuProcLoad = GetOrRegisterGauge("system/cpu/procload", DefaultRegistry) + cpuThreads = GetOrRegisterGauge("system/cpu/threads", DefaultRegistry) + cpuGoroutines = GetOrRegisterGauge("system/cpu/goroutines", DefaultRegistry) - memPauses := GetOrRegisterMeter("system/memory/pauses", DefaultRegistry) - memAllocs := GetOrRegisterMeter("system/memory/allocs", DefaultRegistry) - memFrees := GetOrRegisterMeter("system/memory/frees", DefaultRegistry) - memHeld := GetOrRegisterGauge("system/memory/held", DefaultRegistry) - memUsed := GetOrRegisterGauge("system/memory/used", DefaultRegistry) + memPauses = GetOrRegisterMeter("system/memory/pauses", DefaultRegistry) + memAllocs = GetOrRegisterMeter("system/memory/allocs", DefaultRegistry) + memFrees = GetOrRegisterMeter("system/memory/frees", DefaultRegistry) + memHeld = GetOrRegisterGauge("system/memory/held", DefaultRegistry) + memUsed = GetOrRegisterGauge("system/memory/used", DefaultRegistry) - var diskReads, diskReadBytes, diskWrites, diskWriteBytes Meter - var diskReadBytesCounter, diskWriteBytesCounter Counter - if err := ReadDiskStats(diskstats[0]); err == nil { - diskReads = GetOrRegisterMeter("system/disk/readcount", DefaultRegistry) - diskReadBytes = GetOrRegisterMeter("system/disk/readdata", DefaultRegistry) - diskReadBytesCounter = GetOrRegisterCounter("system/disk/readbytes", DefaultRegistry) - diskWrites = GetOrRegisterMeter("system/disk/writecount", DefaultRegistry) - diskWriteBytes = GetOrRegisterMeter("system/disk/writedata", DefaultRegistry) + diskReads = GetOrRegisterMeter("system/disk/readcount", DefaultRegistry) + diskReadBytes = GetOrRegisterMeter("system/disk/readdata", DefaultRegistry) + diskReadBytesCounter = GetOrRegisterCounter("system/disk/readbytes", DefaultRegistry) + diskWrites = GetOrRegisterMeter("system/disk/writecount", DefaultRegistry) + diskWriteBytes = GetOrRegisterMeter("system/disk/writedata", DefaultRegistry) diskWriteBytesCounter = GetOrRegisterCounter("system/disk/writebytes", DefaultRegistry) - } else { - log.Debug("Failed to read disk metrics", "err", err) - } + ) // Iterate loading the different stats and updating the meters for i := 1; ; i++ { location1 := i % 2 @@ -104,6 +102,8 @@ func CollectProcessMetrics(refresh time.Duration) { cpuSysLoad.Update((cpuStats[location1].GlobalTime - cpuStats[location2].GlobalTime) / refreshFreq) cpuSysWait.Update((cpuStats[location1].GlobalWait - cpuStats[location2].GlobalWait) / refreshFreq) cpuProcLoad.Update((cpuStats[location1].LocalTime - cpuStats[location2].LocalTime) / refreshFreq) + cpuThreads.Update(int64(threadCreateProfile.Count())) + cpuGoroutines.Update(int64(runtime.NumGoroutine())) runtime.ReadMemStats(memstats[location1]) memPauses.Mark(int64(memstats[location1].PauseTotalNs - memstats[location2].PauseTotalNs)) diff --git a/vendor/github.com/ethereum/go-ethereum/miner/worker.go b/vendor/github.com/ethereum/go-ethereum/miner/worker.go index 64ac21cc..4a9528c3 100644 --- a/vendor/github.com/ethereum/go-ethereum/miner/worker.go +++ b/vendor/github.com/ethereum/go-ethereum/miner/worker.go @@ -453,6 +453,10 @@ func (w *worker) mainLoop() { // already included in the current mining block. These transactions will // be automatically eliminated. if !w.isRunning() && w.current != nil { + // If block is already full, abort + if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas { + continue + } w.mu.RLock() coinbase := w.coinbase w.mu.RUnlock() @@ -463,8 +467,13 @@ func (w *worker) mainLoop() { txs[acc] = append(txs[acc], tx) } txset := types.NewTransactionsByPriceAndNonce(w.current.signer, txs) + tcount := w.current.tcount w.commitTransactions(txset, coinbase, nil) - w.updateSnapshot() + // Only update the snapshot if any new transactons were added + // to the pending block + if tcount != w.current.tcount { + w.updateSnapshot() + } } else { // If clique is running in dev mode(period is 0), disable // advance sealing here. diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/bind.go b/vendor/github.com/ethereum/go-ethereum/mobile/bind.go new file mode 100644 index 00000000..90ecdf82 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/bind.go @@ -0,0 +1,223 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains all the wrappers from the bind package. + +package geth + +import ( + "errors" + "math/big" + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/keystore" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" +) + +// Signer is an interface defining the callback when a contract requires a +// method to sign the transaction before submission. +type Signer interface { + Sign(*Address, *Transaction) (tx *Transaction, _ error) +} + +type MobileSigner struct { + sign bind.SignerFn +} + +func (s *MobileSigner) Sign(addr *Address, unsignedTx *Transaction) (signedTx *Transaction, _ error) { + sig, err := s.sign(types.EIP155Signer{}, addr.address, unsignedTx.tx) + if err != nil { + return nil, err + } + return &Transaction{sig}, nil +} + +// CallOpts is the collection of options to fine tune a contract call request. +type CallOpts struct { + opts bind.CallOpts +} + +// NewCallOpts creates a new option set for contract calls. +func NewCallOpts() *CallOpts { + return new(CallOpts) +} + +func (opts *CallOpts) IsPending() bool { return opts.opts.Pending } +func (opts *CallOpts) GetGasLimit() int64 { return 0 /* TODO(karalabe) */ } + +// GetContext cannot be reliably implemented without identity preservation (https://github.com/golang/go/issues/16876) +// Even then it's awkward to unpack the subtleties of a Go context out to Java. +// func (opts *CallOpts) GetContext() *Context { return &Context{opts.opts.Context} } + +func (opts *CallOpts) SetPending(pending bool) { opts.opts.Pending = pending } +func (opts *CallOpts) SetGasLimit(limit int64) { /* TODO(karalabe) */ } +func (opts *CallOpts) SetContext(context *Context) { opts.opts.Context = context.context } + +// TransactOpts is the collection of authorization data required to create a +// valid Ethereum transaction. +type TransactOpts struct { + opts bind.TransactOpts +} + +// NewTransactOpts creates a new option set for contract transaction. +func NewTransactOpts() *TransactOpts { + return new(TransactOpts) +} + +// NewKeyedTransactor is a utility method to easily create a transaction signer +// from a single private key. +func NewKeyedTransactOpts(keyJson []byte, passphrase string) (*TransactOpts, error) { + key, err := keystore.DecryptKey(keyJson, passphrase) + if err != nil { + return nil, err + } + keyAddr := crypto.PubkeyToAddress(key.PrivateKey.PublicKey) + opts := bind.TransactOpts{ + From: keyAddr, + Signer: func(signer types.Signer, address common.Address, tx *types.Transaction) (*types.Transaction, error) { + if address != keyAddr { + return nil, errors.New("not authorized to sign this account") + } + signature, err := crypto.Sign(signer.Hash(tx).Bytes(), key.PrivateKey) + if err != nil { + return nil, err + } + return tx.WithSignature(signer, signature) + }, + } + return &TransactOpts{opts}, nil +} + +func (opts *TransactOpts) GetFrom() *Address { return &Address{opts.opts.From} } +func (opts *TransactOpts) GetNonce() int64 { return opts.opts.Nonce.Int64() } +func (opts *TransactOpts) GetValue() *BigInt { return &BigInt{opts.opts.Value} } +func (opts *TransactOpts) GetGasPrice() *BigInt { return &BigInt{opts.opts.GasPrice} } +func (opts *TransactOpts) GetGasLimit() int64 { return int64(opts.opts.GasLimit) } + +// GetSigner cannot be reliably implemented without identity preservation (https://github.com/golang/go/issues/16876) +// func (opts *TransactOpts) GetSigner() Signer { return &signer{opts.opts.Signer} } + +// GetContext cannot be reliably implemented without identity preservation (https://github.com/golang/go/issues/16876) +// Even then it's awkward to unpack the subtleties of a Go context out to Java. +//func (opts *TransactOpts) GetContext() *Context { return &Context{opts.opts.Context} } + +func (opts *TransactOpts) SetFrom(from *Address) { opts.opts.From = from.address } +func (opts *TransactOpts) SetNonce(nonce int64) { opts.opts.Nonce = big.NewInt(nonce) } +func (opts *TransactOpts) SetSigner(s Signer) { + opts.opts.Signer = func(signer types.Signer, addr common.Address, tx *types.Transaction) (*types.Transaction, error) { + sig, err := s.Sign(&Address{addr}, &Transaction{tx}) + if err != nil { + return nil, err + } + return sig.tx, nil + } +} +func (opts *TransactOpts) SetValue(value *BigInt) { opts.opts.Value = value.bigint } +func (opts *TransactOpts) SetGasPrice(price *BigInt) { opts.opts.GasPrice = price.bigint } +func (opts *TransactOpts) SetGasLimit(limit int64) { opts.opts.GasLimit = uint64(limit) } +func (opts *TransactOpts) SetContext(context *Context) { opts.opts.Context = context.context } + +// BoundContract is the base wrapper object that reflects a contract on the +// Ethereum network. It contains a collection of methods that are used by the +// higher level contract bindings to operate. +type BoundContract struct { + contract *bind.BoundContract + address common.Address + deployer *types.Transaction +} + +// DeployContract deploys a contract onto the Ethereum blockchain and binds the +// deployment address with a wrapper. +func DeployContract(opts *TransactOpts, abiJSON string, bytecode []byte, client *EthereumClient, args *Interfaces) (contract *BoundContract, _ error) { + // Deploy the contract to the network + parsed, err := abi.JSON(strings.NewReader(abiJSON)) + if err != nil { + return nil, err + } + addr, tx, bound, err := bind.DeployContract(&opts.opts, parsed, common.CopyBytes(bytecode), client.client, args.objects...) + if err != nil { + return nil, err + } + return &BoundContract{ + contract: bound, + address: addr, + deployer: tx, + }, nil +} + +// BindContract creates a low level contract interface through which calls and +// transactions may be made through. +func BindContract(address *Address, abiJSON string, client *EthereumClient) (contract *BoundContract, _ error) { + parsed, err := abi.JSON(strings.NewReader(abiJSON)) + if err != nil { + return nil, err + } + return &BoundContract{ + contract: bind.NewBoundContract(address.address, parsed, client.client, client.client, client.client), + address: address.address, + }, nil +} + +func (c *BoundContract) GetAddress() *Address { return &Address{c.address} } +func (c *BoundContract) GetDeployer() *Transaction { + if c.deployer == nil { + return nil + } + return &Transaction{c.deployer} +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. +func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error { + if len(out.objects) == 1 { + result := out.objects[0] + if err := c.contract.Call(&opts.opts, result, method, args.objects...); err != nil { + return err + } + out.objects[0] = result + } else { + results := make([]interface{}, len(out.objects)) + copy(results, out.objects) + if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil { + return err + } + copy(out.objects, results) + } + return nil +} + +// Transact invokes the (paid) contract method with params as input values. +func (c *BoundContract) Transact(opts *TransactOpts, method string, args *Interfaces) (tx *Transaction, _ error) { + rawTx, err := c.contract.Transact(&opts.opts, method, args.objects...) + if err != nil { + return nil, err + } + return &Transaction{rawTx}, nil +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (c *BoundContract) Transfer(opts *TransactOpts) (tx *Transaction, _ error) { + rawTx, err := c.contract.Transfer(&opts.opts) + if err != nil { + return nil, err + } + return &Transaction{rawTx}, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/common.go b/vendor/github.com/ethereum/go-ethereum/mobile/common.go new file mode 100644 index 00000000..d7e04572 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/common.go @@ -0,0 +1,241 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains all the wrappers from the common package. + +package geth + +import ( + "encoding/hex" + "errors" + "fmt" + "strings" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" +) + +// Hash represents the 32 byte Keccak256 hash of arbitrary data. +type Hash struct { + hash common.Hash +} + +// NewHashFromBytes converts a slice of bytes to a hash value. +func NewHashFromBytes(binary []byte) (hash *Hash, _ error) { + h := new(Hash) + if err := h.SetBytes(common.CopyBytes(binary)); err != nil { + return nil, err + } + return h, nil +} + +// NewHashFromHex converts a hex string to a hash value. +func NewHashFromHex(hex string) (hash *Hash, _ error) { + h := new(Hash) + if err := h.SetHex(hex); err != nil { + return nil, err + } + return h, nil +} + +// SetBytes sets the specified slice of bytes as the hash value. +func (h *Hash) SetBytes(hash []byte) error { + if length := len(hash); length != common.HashLength { + return fmt.Errorf("invalid hash length: %v != %v", length, common.HashLength) + } + copy(h.hash[:], hash) + return nil +} + +// GetBytes retrieves the byte representation of the hash. +func (h *Hash) GetBytes() []byte { + return h.hash[:] +} + +// SetHex sets the specified hex string as the hash value. +func (h *Hash) SetHex(hash string) error { + hash = strings.ToLower(hash) + if len(hash) >= 2 && hash[:2] == "0x" { + hash = hash[2:] + } + if length := len(hash); length != 2*common.HashLength { + return fmt.Errorf("invalid hash hex length: %v != %v", length, 2*common.HashLength) + } + bin, err := hex.DecodeString(hash) + if err != nil { + return err + } + copy(h.hash[:], bin) + return nil +} + +// GetHex retrieves the hex string representation of the hash. +func (h *Hash) GetHex() string { + return h.hash.Hex() +} + +// Hashes represents a slice of hashes. +type Hashes struct{ hashes []common.Hash } + +// NewHashes creates a slice of uninitialized Hashes. +func NewHashes(size int) *Hashes { + return &Hashes{ + hashes: make([]common.Hash, size), + } +} + +// NewHashesEmpty creates an empty slice of Hashes values. +func NewHashesEmpty() *Hashes { + return NewHashes(0) +} + +// Size returns the number of hashes in the slice. +func (h *Hashes) Size() int { + return len(h.hashes) +} + +// Get returns the hash at the given index from the slice. +func (h *Hashes) Get(index int) (hash *Hash, _ error) { + if index < 0 || index >= len(h.hashes) { + return nil, errors.New("index out of bounds") + } + return &Hash{h.hashes[index]}, nil +} + +// Set sets the Hash at the given index in the slice. +func (h *Hashes) Set(index int, hash *Hash) error { + if index < 0 || index >= len(h.hashes) { + return errors.New("index out of bounds") + } + h.hashes[index] = hash.hash + return nil +} + +// Append adds a new Hash element to the end of the slice. +func (h *Hashes) Append(hash *Hash) { + h.hashes = append(h.hashes, hash.hash) +} + +// Address represents the 20 byte address of an Ethereum account. +type Address struct { + address common.Address +} + +// NewAddressFromBytes converts a slice of bytes to a hash value. +func NewAddressFromBytes(binary []byte) (address *Address, _ error) { + a := new(Address) + if err := a.SetBytes(common.CopyBytes(binary)); err != nil { + return nil, err + } + return a, nil +} + +// NewAddressFromHex converts a hex string to a address value. +func NewAddressFromHex(hex string) (address *Address, _ error) { + a := new(Address) + if err := a.SetHex(hex); err != nil { + return nil, err + } + return a, nil +} + +// SetBytes sets the specified slice of bytes as the address value. +func (a *Address) SetBytes(address []byte) error { + if length := len(address); length != common.AddressLength { + return fmt.Errorf("invalid address length: %v != %v", length, common.AddressLength) + } + copy(a.address[:], address) + return nil +} + +// GetBytes retrieves the byte representation of the address. +func (a *Address) GetBytes() []byte { + return a.address[:] +} + +// SetHex sets the specified hex string as the address value. +func (a *Address) SetHex(address string) error { + address = strings.ToLower(address) + if len(address) >= 2 && address[:2] == "0x" { + address = address[2:] + } + if length := len(address); length != 2*common.AddressLength { + return fmt.Errorf("invalid address hex length: %v != %v", length, 2*common.AddressLength) + } + bin, err := hex.DecodeString(address) + if err != nil { + return err + } + copy(a.address[:], bin) + return nil +} + +// GetHex retrieves the hex string representation of the address. +func (a *Address) GetHex() string { + return a.address.Hex() +} + +// Addresses represents a slice of addresses. +type Addresses struct{ addresses []common.Address } + +// NewAddresses creates a slice of uninitialized addresses. +func NewAddresses(size int) *Addresses { + return &Addresses{ + addresses: make([]common.Address, size), + } +} + +// NewAddressesEmpty creates an empty slice of Addresses values. +func NewAddressesEmpty() *Addresses { + return NewAddresses(0) +} + +// Size returns the number of addresses in the slice. +func (a *Addresses) Size() int { + return len(a.addresses) +} + +// Get returns the address at the given index from the slice. +func (a *Addresses) Get(index int) (address *Address, _ error) { + if index < 0 || index >= len(a.addresses) { + return nil, errors.New("index out of bounds") + } + return &Address{a.addresses[index]}, nil +} + +// Set sets the address at the given index in the slice. +func (a *Addresses) Set(index int, address *Address) error { + if index < 0 || index >= len(a.addresses) { + return errors.New("index out of bounds") + } + a.addresses[index] = address.address + return nil +} + +// Append adds a new address element to the end of the slice. +func (a *Addresses) Append(address *Address) { + a.addresses = append(a.addresses, address.address) +} + +// EncodeToHex encodes b as a hex string with 0x prefix. +func EncodeToHex(b []byte) string { + return hexutil.Encode(b) +} + +// DecodeFromHex decodes a hex string with 0x prefix. +func DecodeFromHex(s string) ([]byte, error) { + return hexutil.Decode(s) +} diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/context.go b/vendor/github.com/ethereum/go-ethereum/mobile/context.go new file mode 100644 index 00000000..76b4c546 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/context.go @@ -0,0 +1,80 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains all the wrappers from the golang.org/x/net/context package to support +// client side context management on mobile platforms. + +package geth + +import ( + "context" + "time" +) + +// Context carries a deadline, a cancellation signal, and other values across API +// boundaries. +type Context struct { + context context.Context + cancel context.CancelFunc +} + +// NewContext returns a non-nil, empty Context. It is never canceled, has no +// values, and has no deadline. It is typically used by the main function, +// initialization, and tests, and as the top-level Context for incoming requests. +func NewContext() *Context { + return &Context{ + context: context.Background(), + } +} + +// WithCancel returns a copy of the original context with cancellation mechanism +// included. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func (c *Context) WithCancel() *Context { + child, cancel := context.WithCancel(c.context) + return &Context{ + context: child, + cancel: cancel, + } +} + +// WithDeadline returns a copy of the original context with the deadline adjusted +// to be no later than the specified time. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func (c *Context) WithDeadline(sec int64, nsec int64) *Context { + child, cancel := context.WithDeadline(c.context, time.Unix(sec, nsec)) + return &Context{ + context: child, + cancel: cancel, + } +} + +// WithTimeout returns a copy of the original context with the deadline adjusted +// to be no later than now + the duration specified. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func (c *Context) WithTimeout(nsec int64) *Context { + child, cancel := context.WithTimeout(c.context, time.Duration(nsec)) + return &Context{ + context: child, + cancel: cancel, + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/geth.go b/vendor/github.com/ethereum/go-ethereum/mobile/geth.go new file mode 100644 index 00000000..edcbfdbd --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/geth.go @@ -0,0 +1,226 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains all the wrappers from the node package to support client side node +// management on mobile platforms. + +package geth + +import ( + "encoding/json" + "fmt" + "path/filepath" + + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/eth/downloader" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/ethstats" + "github.com/ethereum/go-ethereum/internal/debug" + "github.com/ethereum/go-ethereum/les" + "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/ethereum/go-ethereum/params" + whisper "github.com/ethereum/go-ethereum/whisper/whisperv6" +) + +// NodeConfig represents the collection of configuration values to fine tune the Geth +// node embedded into a mobile process. The available values are a subset of the +// entire API provided by go-ethereum to reduce the maintenance surface and dev +// complexity. +type NodeConfig struct { + // Bootstrap nodes used to establish connectivity with the rest of the network. + BootstrapNodes *Enodes + + // MaxPeers is the maximum number of peers that can be connected. If this is + // set to zero, then only the configured static and trusted peers can connect. + MaxPeers int + + // EthereumEnabled specifies whether the node should run the Ethereum protocol. + EthereumEnabled bool + + // EthereumNetworkID is the network identifier used by the Ethereum protocol to + // decide if remote peers should be accepted or not. + EthereumNetworkID int64 // uint64 in truth, but Java can't handle that... + + // EthereumGenesis is the genesis JSON to use to seed the blockchain with. An + // empty genesis state is equivalent to using the mainnet's state. + EthereumGenesis string + + // EthereumDatabaseCache is the system memory in MB to allocate for database caching. + // A minimum of 16MB is always reserved. + EthereumDatabaseCache int + + // EthereumNetStats is a netstats connection string to use to report various + // chain, transaction and node stats to a monitoring server. + // + // It has the form "nodename:secret@host:port" + EthereumNetStats string + + // WhisperEnabled specifies whether the node should run the Whisper protocol. + WhisperEnabled bool + + // Listening address of pprof server. + PprofAddress string +} + +// defaultNodeConfig contains the default node configuration values to use if all +// or some fields are missing from the user's specified list. +var defaultNodeConfig = &NodeConfig{ + BootstrapNodes: FoundationBootnodes(), + MaxPeers: 25, + EthereumEnabled: true, + EthereumNetworkID: 1, + EthereumDatabaseCache: 16, +} + +// NewNodeConfig creates a new node option set, initialized to the default values. +func NewNodeConfig() *NodeConfig { + config := *defaultNodeConfig + return &config +} + +// Node represents a Geth Ethereum node instance. +type Node struct { + node *node.Node +} + +// NewNode creates and configures a new Geth node. +func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { + // If no or partial configurations were specified, use defaults + if config == nil { + config = NewNodeConfig() + } + if config.MaxPeers == 0 { + config.MaxPeers = defaultNodeConfig.MaxPeers + } + if config.BootstrapNodes == nil || config.BootstrapNodes.Size() == 0 { + config.BootstrapNodes = defaultNodeConfig.BootstrapNodes + } + + if config.PprofAddress != "" { + debug.StartPProf(config.PprofAddress) + } + + // Create the empty networking stack + nodeConf := &node.Config{ + Name: clientIdentifier, + Version: params.VersionWithMeta, + DataDir: datadir, + KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores! + P2P: p2p.Config{ + NoDiscovery: true, + DiscoveryV5: true, + BootstrapNodesV5: config.BootstrapNodes.nodes, + ListenAddr: ":0", + NAT: nat.Any(), + MaxPeers: config.MaxPeers, + }, + } + + rawStack, err := node.New(nodeConf) + if err != nil { + return nil, err + } + + debug.Memsize.Add("node", rawStack) + + var genesis *core.Genesis + if config.EthereumGenesis != "" { + // Parse the user supplied genesis spec if not mainnet + genesis = new(core.Genesis) + if err := json.Unmarshal([]byte(config.EthereumGenesis), genesis); err != nil { + return nil, fmt.Errorf("invalid genesis spec: %v", err) + } + // If we have the testnet, hard code the chain configs too + if config.EthereumGenesis == TestnetGenesis() { + genesis.Config = params.TestnetChainConfig + if config.EthereumNetworkID == 1 { + config.EthereumNetworkID = 3 + } + } + } + // Register the Ethereum protocol if requested + if config.EthereumEnabled { + ethConf := eth.DefaultConfig + ethConf.Genesis = genesis + ethConf.SyncMode = downloader.LightSync + ethConf.NetworkId = uint64(config.EthereumNetworkID) + ethConf.DatabaseCache = config.EthereumDatabaseCache + if err := rawStack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + return les.New(ctx, ðConf) + }); err != nil { + return nil, fmt.Errorf("ethereum init: %v", err) + } + // If netstats reporting is requested, do it + if config.EthereumNetStats != "" { + if err := rawStack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + var lesServ *les.LightEthereum + ctx.Service(&lesServ) + + return ethstats.New(config.EthereumNetStats, nil, lesServ) + }); err != nil { + return nil, fmt.Errorf("netstats init: %v", err) + } + } + } + // Register the Whisper protocol if requested + if config.WhisperEnabled { + if err := rawStack.Register(func(*node.ServiceContext) (node.Service, error) { + return whisper.New(&whisper.DefaultConfig), nil + }); err != nil { + return nil, fmt.Errorf("whisper init: %v", err) + } + } + return &Node{rawStack}, nil +} + +// Close terminates a running node along with all it's services, tearing internal +// state doen too. It's not possible to restart a closed node. +func (n *Node) Close() error { + return n.node.Close() +} + +// Start creates a live P2P node and starts running it. +func (n *Node) Start() error { + return n.node.Start() +} + +// Stop terminates a running node along with all it's services. If the node was +// not started, an error is returned. +func (n *Node) Stop() error { + return n.node.Stop() +} + +// GetEthereumClient retrieves a client to access the Ethereum subsystem. +func (n *Node) GetEthereumClient() (client *EthereumClient, _ error) { + rpc, err := n.node.Attach() + if err != nil { + return nil, err + } + return &EthereumClient{ethclient.NewClient(rpc)}, nil +} + +// GetNodeInfo gathers and returns a collection of metadata known about the host. +func (n *Node) GetNodeInfo() *NodeInfo { + return &NodeInfo{n.node.Server().NodeInfo()} +} + +// GetPeersInfo returns an array of metadata objects describing connected peers. +func (n *Node) GetPeersInfo() *PeerInfos { + return &PeerInfos{n.node.Server().PeersInfo()} +} diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/interface.go b/vendor/github.com/ethereum/go-ethereum/mobile/interface.go new file mode 100644 index 00000000..d5200d5b --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/interface.go @@ -0,0 +1,276 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains perverted wrappers to allow crossing over empty interfaces. + +package geth + +import ( + "errors" + "math/big" + + "github.com/ethereum/go-ethereum/common" +) + +// Interface represents a wrapped version of Go's interface{}, with the capacity +// to store arbitrary data types. +// +// Since it's impossible to get the arbitrary-ness converted between Go and mobile +// platforms, we're using explicit getters and setters for the conversions. There +// is of course no point in enumerating everything, just enough to support the +// contract bindins requiring client side generated code. +type Interface struct { + object interface{} +} + +// NewInterface creates a new empty interface that can be used to pass around +// generic types. +func NewInterface() *Interface { + return new(Interface) +} + +func (i *Interface) SetBool(b bool) { i.object = &b } +func (i *Interface) SetBools(bs *Bools) { i.object = &bs.bools } +func (i *Interface) SetString(str string) { i.object = &str } +func (i *Interface) SetStrings(strs *Strings) { i.object = &strs.strs } +func (i *Interface) SetBinary(binary []byte) { b := common.CopyBytes(binary); i.object = &b } +func (i *Interface) SetBinaries(binaries *Binaries) { i.object = &binaries.binaries } +func (i *Interface) SetAddress(address *Address) { i.object = &address.address } +func (i *Interface) SetAddresses(addrs *Addresses) { i.object = &addrs.addresses } +func (i *Interface) SetHash(hash *Hash) { i.object = &hash.hash } +func (i *Interface) SetHashes(hashes *Hashes) { i.object = &hashes.hashes } +func (i *Interface) SetInt8(n int8) { i.object = &n } +func (i *Interface) SetInt16(n int16) { i.object = &n } +func (i *Interface) SetInt32(n int32) { i.object = &n } +func (i *Interface) SetInt64(n int64) { i.object = &n } +func (i *Interface) SetInt8s(bigints *BigInts) { + ints := make([]int8, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, int8(bi.Int64())) + } + i.object = &ints +} +func (i *Interface) SetInt16s(bigints *BigInts) { + ints := make([]int16, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, int16(bi.Int64())) + } + i.object = &ints +} +func (i *Interface) SetInt32s(bigints *BigInts) { + ints := make([]int32, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, int32(bi.Int64())) + } + i.object = &ints +} +func (i *Interface) SetInt64s(bigints *BigInts) { + ints := make([]int64, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, bi.Int64()) + } + i.object = &ints +} +func (i *Interface) SetUint8(bigint *BigInt) { n := uint8(bigint.bigint.Uint64()); i.object = &n } +func (i *Interface) SetUint16(bigint *BigInt) { n := uint16(bigint.bigint.Uint64()); i.object = &n } +func (i *Interface) SetUint32(bigint *BigInt) { n := uint32(bigint.bigint.Uint64()); i.object = &n } +func (i *Interface) SetUint64(bigint *BigInt) { n := bigint.bigint.Uint64(); i.object = &n } +func (i *Interface) SetUint8s(bigints *BigInts) { + ints := make([]uint8, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, uint8(bi.Uint64())) + } + i.object = &ints +} +func (i *Interface) SetUint16s(bigints *BigInts) { + ints := make([]uint16, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, uint16(bi.Uint64())) + } + i.object = &ints +} +func (i *Interface) SetUint32s(bigints *BigInts) { + ints := make([]uint32, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, uint32(bi.Uint64())) + } + i.object = &ints +} +func (i *Interface) SetUint64s(bigints *BigInts) { + ints := make([]uint64, 0, bigints.Size()) + for _, bi := range bigints.bigints { + ints = append(ints, bi.Uint64()) + } + i.object = &ints +} +func (i *Interface) SetBigInt(bigint *BigInt) { i.object = &bigint.bigint } +func (i *Interface) SetBigInts(bigints *BigInts) { i.object = &bigints.bigints } + +func (i *Interface) SetDefaultBool() { i.object = new(bool) } +func (i *Interface) SetDefaultBools() { i.object = new([]bool) } +func (i *Interface) SetDefaultString() { i.object = new(string) } +func (i *Interface) SetDefaultStrings() { i.object = new([]string) } +func (i *Interface) SetDefaultBinary() { i.object = new([]byte) } +func (i *Interface) SetDefaultBinaries() { i.object = new([][]byte) } +func (i *Interface) SetDefaultAddress() { i.object = new(common.Address) } +func (i *Interface) SetDefaultAddresses() { i.object = new([]common.Address) } +func (i *Interface) SetDefaultHash() { i.object = new(common.Hash) } +func (i *Interface) SetDefaultHashes() { i.object = new([]common.Hash) } +func (i *Interface) SetDefaultInt8() { i.object = new(int8) } +func (i *Interface) SetDefaultInt8s() { i.object = new([]int8) } +func (i *Interface) SetDefaultInt16() { i.object = new(int16) } +func (i *Interface) SetDefaultInt16s() { i.object = new([]int16) } +func (i *Interface) SetDefaultInt32() { i.object = new(int32) } +func (i *Interface) SetDefaultInt32s() { i.object = new([]int32) } +func (i *Interface) SetDefaultInt64() { i.object = new(int64) } +func (i *Interface) SetDefaultInt64s() { i.object = new([]int64) } +func (i *Interface) SetDefaultUint8() { i.object = new(uint8) } +func (i *Interface) SetDefaultUint8s() { i.object = new([]uint8) } +func (i *Interface) SetDefaultUint16() { i.object = new(uint16) } +func (i *Interface) SetDefaultUint16s() { i.object = new([]uint16) } +func (i *Interface) SetDefaultUint32() { i.object = new(uint32) } +func (i *Interface) SetDefaultUint32s() { i.object = new([]uint32) } +func (i *Interface) SetDefaultUint64() { i.object = new(uint64) } +func (i *Interface) SetDefaultUint64s() { i.object = new([]uint64) } +func (i *Interface) SetDefaultBigInt() { i.object = new(*big.Int) } +func (i *Interface) SetDefaultBigInts() { i.object = new([]*big.Int) } + +func (i *Interface) GetBool() bool { return *i.object.(*bool) } +func (i *Interface) GetBools() *Bools { return &Bools{*i.object.(*[]bool)} } +func (i *Interface) GetString() string { return *i.object.(*string) } +func (i *Interface) GetStrings() *Strings { return &Strings{*i.object.(*[]string)} } +func (i *Interface) GetBinary() []byte { return *i.object.(*[]byte) } +func (i *Interface) GetBinaries() *Binaries { return &Binaries{*i.object.(*[][]byte)} } +func (i *Interface) GetAddress() *Address { return &Address{*i.object.(*common.Address)} } +func (i *Interface) GetAddresses() *Addresses { return &Addresses{*i.object.(*[]common.Address)} } +func (i *Interface) GetHash() *Hash { return &Hash{*i.object.(*common.Hash)} } +func (i *Interface) GetHashes() *Hashes { return &Hashes{*i.object.(*[]common.Hash)} } +func (i *Interface) GetInt8() int8 { return *i.object.(*int8) } +func (i *Interface) GetInt16() int16 { return *i.object.(*int16) } +func (i *Interface) GetInt32() int32 { return *i.object.(*int32) } +func (i *Interface) GetInt64() int64 { return *i.object.(*int64) } +func (i *Interface) GetInt8s() *BigInts { + val := i.object.(*[]int8) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetInt64(int64(v))}) + } + return bigints +} +func (i *Interface) GetInt16s() *BigInts { + val := i.object.(*[]int16) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetInt64(int64(v))}) + } + return bigints +} +func (i *Interface) GetInt32s() *BigInts { + val := i.object.(*[]int32) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetInt64(int64(v))}) + } + return bigints +} +func (i *Interface) GetInt64s() *BigInts { + val := i.object.(*[]int64) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetInt64(v)}) + } + return bigints +} +func (i *Interface) GetUint8() *BigInt { + return &BigInt{new(big.Int).SetUint64(uint64(*i.object.(*uint8)))} +} +func (i *Interface) GetUint16() *BigInt { + return &BigInt{new(big.Int).SetUint64(uint64(*i.object.(*uint16)))} +} +func (i *Interface) GetUint32() *BigInt { + return &BigInt{new(big.Int).SetUint64(uint64(*i.object.(*uint32)))} +} +func (i *Interface) GetUint64() *BigInt { + return &BigInt{new(big.Int).SetUint64(*i.object.(*uint64))} +} +func (i *Interface) GetUint8s() *BigInts { + val := i.object.(*[]uint8) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetUint64(uint64(v))}) + } + return bigints +} +func (i *Interface) GetUint16s() *BigInts { + val := i.object.(*[]uint16) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetUint64(uint64(v))}) + } + return bigints +} +func (i *Interface) GetUint32s() *BigInts { + val := i.object.(*[]uint32) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetUint64(uint64(v))}) + } + return bigints +} +func (i *Interface) GetUint64s() *BigInts { + val := i.object.(*[]uint64) + bigints := NewBigInts(len(*val)) + for i, v := range *val { + bigints.Set(i, &BigInt{new(big.Int).SetUint64(v)}) + } + return bigints +} +func (i *Interface) GetBigInt() *BigInt { return &BigInt{*i.object.(**big.Int)} } +func (i *Interface) GetBigInts() *BigInts { return &BigInts{*i.object.(*[]*big.Int)} } + +// Interfaces is a slices of wrapped generic objects. +type Interfaces struct { + objects []interface{} +} + +// NewInterfaces creates a slice of uninitialized interfaces. +func NewInterfaces(size int) *Interfaces { + return &Interfaces{objects: make([]interface{}, size)} +} + +// Size returns the number of interfaces in the slice. +func (i *Interfaces) Size() int { + return len(i.objects) +} + +// Get returns the bigint at the given index from the slice. +// Notably the returned value can be changed without affecting the +// interfaces itself. +func (i *Interfaces) Get(index int) (iface *Interface, _ error) { + if index < 0 || index >= len(i.objects) { + return nil, errors.New("index out of bounds") + } + return &Interface{object: i.objects[index]}, nil +} + +// Set sets the big int at the given index in the slice. +func (i *Interfaces) Set(index int, object *Interface) error { + if index < 0 || index >= len(i.objects) { + return errors.New("index out of bounds") + } + i.objects[index] = object.object + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/mobile/primitives.go b/vendor/github.com/ethereum/go-ethereum/mobile/primitives.go new file mode 100644 index 00000000..7e1ab26e --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/mobile/primitives.go @@ -0,0 +1,116 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains various wrappers for primitive types. + +package geth + +import ( + "errors" + "fmt" + + "github.com/ethereum/go-ethereum/common" +) + +// Strings represents s slice of strs. +type Strings struct{ strs []string } + +// Size returns the number of strs in the slice. +func (s *Strings) Size() int { + return len(s.strs) +} + +// Get returns the string at the given index from the slice. +func (s *Strings) Get(index int) (str string, _ error) { + if index < 0 || index >= len(s.strs) { + return "", errors.New("index out of bounds") + } + return s.strs[index], nil +} + +// Set sets the string at the given index in the slice. +func (s *Strings) Set(index int, str string) error { + if index < 0 || index >= len(s.strs) { + return errors.New("index out of bounds") + } + s.strs[index] = str + return nil +} + +// String implements the Stringer interface. +func (s *Strings) String() string { + return fmt.Sprintf("%v", s.strs) +} + +// Bools represents a slice of bool. +type Bools struct{ bools []bool } + +// Size returns the number of bool in the slice. +func (bs *Bools) Size() int { + return len(bs.bools) +} + +// Get returns the bool at the given index from the slice. +func (bs *Bools) Get(index int) (b bool, _ error) { + if index < 0 || index >= len(bs.bools) { + return false, errors.New("index out of bounds") + } + return bs.bools[index], nil +} + +// Set sets the bool at the given index in the slice. +func (bs *Bools) Set(index int, b bool) error { + if index < 0 || index >= len(bs.bools) { + return errors.New("index out of bounds") + } + bs.bools[index] = b + return nil +} + +// String implements the Stringer interface. +func (bs *Bools) String() string { + return fmt.Sprintf("%v", bs.bools) +} + +// Binaries represents a slice of byte slice +type Binaries struct{ binaries [][]byte } + +// Size returns the number of byte slice in the slice. +func (bs *Binaries) Size() int { + return len(bs.binaries) +} + +// Get returns the byte slice at the given index from the slice. +func (bs *Binaries) Get(index int) (binary []byte, _ error) { + if index < 0 || index >= len(bs.binaries) { + return nil, errors.New("index out of bounds") + } + return common.CopyBytes(bs.binaries[index]), nil +} + +// Set sets the byte slice at the given index in the slice. +func (bs *Binaries) Set(index int, binary []byte) error { + if index < 0 || index >= len(bs.binaries) { + return errors.New("index out of bounds") + } + bs.binaries[index] = common.CopyBytes(binary) + return nil +} + +// String implements the Stringer interface. +func (bs *Binaries) String() string { + return fmt.Sprintf("%v", bs.binaries) +} diff --git a/vendor/github.com/ethereum/go-ethereum/node/defaults.go b/vendor/github.com/ethereum/go-ethereum/node/defaults.go index 564bb35b..f84a5d54 100644 --- a/vendor/github.com/ethereum/go-ethereum/node/defaults.go +++ b/vendor/github.com/ethereum/go-ethereum/node/defaults.go @@ -38,13 +38,15 @@ const ( // DefaultConfig contains reasonable default settings. var DefaultConfig = Config{ - DataDir: DefaultDataDir(), - HTTPPort: DefaultHTTPPort, - HTTPModules: []string{"net", "web3"}, - HTTPVirtualHosts: []string{"localhost"}, - HTTPTimeouts: rpc.DefaultHTTPTimeouts, - WSPort: DefaultWSPort, - WSModules: []string{"net", "web3"}, + DataDir: DefaultDataDir(), + HTTPPort: DefaultHTTPPort, + HTTPModules: []string{"net", "web3"}, + HTTPVirtualHosts: []string{"localhost"}, + HTTPTimeouts: rpc.DefaultHTTPTimeouts, + WSPort: DefaultWSPort, + WSModules: []string{"net", "web3"}, + GraphQLPort: DefaultGraphQLPort, + GraphQLVirtualHosts: []string{"localhost"}, P2P: p2p.Config{ ListenAddr: ":30303", MaxPeers: 50, diff --git a/vendor/github.com/ethereum/go-ethereum/node/node.go b/vendor/github.com/ethereum/go-ethereum/node/node.go index 08daeeee..c9c27d82 100644 --- a/vendor/github.com/ethereum/go-ethereum/node/node.go +++ b/vendor/github.com/ethereum/go-ethereum/node/node.go @@ -247,7 +247,6 @@ func (n *Node) Start() error { n.services = services n.server = running n.stop = make(chan struct{}) - return nil } diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/discover/table.go b/vendor/github.com/ethereum/go-ethereum/p2p/discover/table.go index e0a46792..e5a5793e 100644 --- a/vendor/github.com/ethereum/go-ethereum/p2p/discover/table.go +++ b/vendor/github.com/ethereum/go-ethereum/p2p/discover/table.go @@ -147,35 +147,18 @@ func (tab *Table) ReadRandomNodes(buf []*enode.Node) (n int) { tab.mutex.Lock() defer tab.mutex.Unlock() - // Find all non-empty buckets and get a fresh slice of their entries. - var buckets [][]*node + var nodes []*enode.Node for _, b := range &tab.buckets { - if len(b.entries) > 0 { - buckets = append(buckets, b.entries) + for _, n := range b.entries { + nodes = append(nodes, unwrapNode(n)) } } - if len(buckets) == 0 { - return 0 + // Shuffle. + for i := 0; i < len(nodes); i++ { + j := tab.rand.Intn(len(nodes)) + nodes[i], nodes[j] = nodes[j], nodes[i] } - // Shuffle the buckets. - for i := len(buckets) - 1; i > 0; i-- { - j := tab.rand.Intn(len(buckets)) - buckets[i], buckets[j] = buckets[j], buckets[i] - } - // Move head of each bucket into buf, removing buckets that become empty. - var i, j int - for ; i < len(buf); i, j = i+1, (j+1)%len(buckets) { - b := buckets[j] - buf[i] = unwrapNode(b[0]) - buckets[j] = b[1:] - if len(b) == 1 { - buckets = append(buckets[:j], buckets[j+1:]...) - } - if len(buckets) == 0 { - break - } - } - return i + 1 + return copy(buf, nodes) } // getNode returns the node with the given ID or nil if it isn't in the table. diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/message.go b/vendor/github.com/ethereum/go-ethereum/p2p/message.go new file mode 100644 index 00000000..b9877322 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/p2p/message.go @@ -0,0 +1,320 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package p2p + +import ( + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "sync/atomic" + "time" + + "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ethereum/go-ethereum/rlp" +) + +// Msg defines the structure of a p2p message. +// +// Note that a Msg can only be sent once since the Payload reader is +// consumed during sending. It is not possible to create a Msg and +// send it any number of times. If you want to reuse an encoded +// structure, encode the payload into a byte array and create a +// separate Msg with a bytes.Reader as Payload for each send. +type Msg struct { + Code uint64 + Size uint32 // size of the paylod + Payload io.Reader + ReceivedAt time.Time +} + +// Decode parses the RLP content of a message into +// the given value, which must be a pointer. +// +// For the decoding rules, please see package rlp. +func (msg Msg) Decode(val interface{}) error { + s := rlp.NewStream(msg.Payload, uint64(msg.Size)) + if err := s.Decode(val); err != nil { + return newPeerError(errInvalidMsg, "(code %x) (size %d) %v", msg.Code, msg.Size, err) + } + return nil +} + +func (msg Msg) String() string { + return fmt.Sprintf("msg #%v (%v bytes)", msg.Code, msg.Size) +} + +// Discard reads any remaining payload data into a black hole. +func (msg Msg) Discard() error { + _, err := io.Copy(ioutil.Discard, msg.Payload) + return err +} + +type MsgReader interface { + ReadMsg() (Msg, error) +} + +type MsgWriter interface { + // WriteMsg sends a message. It will block until the message's + // Payload has been consumed by the other end. + // + // Note that messages can be sent only once because their + // payload reader is drained. + WriteMsg(Msg) error +} + +// MsgReadWriter provides reading and writing of encoded messages. +// Implementations should ensure that ReadMsg and WriteMsg can be +// called simultaneously from multiple goroutines. +type MsgReadWriter interface { + MsgReader + MsgWriter +} + +// Send writes an RLP-encoded message with the given code. +// data should encode as an RLP list. +func Send(w MsgWriter, msgcode uint64, data interface{}) error { + size, r, err := rlp.EncodeToReader(data) + if err != nil { + return err + } + return w.WriteMsg(Msg{Code: msgcode, Size: uint32(size), Payload: r}) +} + +// SendItems writes an RLP with the given code and data elements. +// For a call such as: +// +// SendItems(w, code, e1, e2, e3) +// +// the message payload will be an RLP list containing the items: +// +// [e1, e2, e3] +// +func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error { + return Send(w, msgcode, elems) +} + +// eofSignal wraps a reader with eof signaling. the eof channel is +// closed when the wrapped reader returns an error or when count bytes +// have been read. +type eofSignal struct { + wrapped io.Reader + count uint32 // number of bytes left + eof chan<- struct{} +} + +// note: when using eofSignal to detect whether a message payload +// has been read, Read might not be called for zero sized messages. +func (r *eofSignal) Read(buf []byte) (int, error) { + if r.count == 0 { + if r.eof != nil { + r.eof <- struct{}{} + r.eof = nil + } + return 0, io.EOF + } + + max := len(buf) + if int(r.count) < len(buf) { + max = int(r.count) + } + n, err := r.wrapped.Read(buf[:max]) + r.count -= uint32(n) + if (err != nil || r.count == 0) && r.eof != nil { + r.eof <- struct{}{} // tell Peer that msg has been consumed + r.eof = nil + } + return n, err +} + +// MsgPipe creates a message pipe. Reads on one end are matched +// with writes on the other. The pipe is full-duplex, both ends +// implement MsgReadWriter. +func MsgPipe() (*MsgPipeRW, *MsgPipeRW) { + var ( + c1, c2 = make(chan Msg), make(chan Msg) + closing = make(chan struct{}) + closed = new(int32) + rw1 = &MsgPipeRW{c1, c2, closing, closed} + rw2 = &MsgPipeRW{c2, c1, closing, closed} + ) + return rw1, rw2 +} + +// ErrPipeClosed is returned from pipe operations after the +// pipe has been closed. +var ErrPipeClosed = errors.New("p2p: read or write on closed message pipe") + +// MsgPipeRW is an endpoint of a MsgReadWriter pipe. +type MsgPipeRW struct { + w chan<- Msg + r <-chan Msg + closing chan struct{} + closed *int32 +} + +// WriteMsg sends a message on the pipe. +// It blocks until the receiver has consumed the message payload. +func (p *MsgPipeRW) WriteMsg(msg Msg) error { + if atomic.LoadInt32(p.closed) == 0 { + consumed := make(chan struct{}, 1) + msg.Payload = &eofSignal{msg.Payload, msg.Size, consumed} + select { + case p.w <- msg: + if msg.Size > 0 { + // wait for payload read or discard + select { + case <-consumed: + case <-p.closing: + } + } + return nil + case <-p.closing: + } + } + return ErrPipeClosed +} + +// ReadMsg returns a message sent on the other end of the pipe. +func (p *MsgPipeRW) ReadMsg() (Msg, error) { + if atomic.LoadInt32(p.closed) == 0 { + select { + case msg := <-p.r: + return msg, nil + case <-p.closing: + } + } + return Msg{}, ErrPipeClosed +} + +// Close unblocks any pending ReadMsg and WriteMsg calls on both ends +// of the pipe. They will return ErrPipeClosed. Close also +// interrupts any reads from a message payload. +func (p *MsgPipeRW) Close() error { + if atomic.AddInt32(p.closed, 1) != 1 { + // someone else is already closing + atomic.StoreInt32(p.closed, 1) // avoid overflow + return nil + } + close(p.closing) + return nil +} + +// ExpectMsg reads a message from r and verifies that its +// code and encoded RLP content match the provided values. +// If content is nil, the payload is discarded and not verified. +func ExpectMsg(r MsgReader, code uint64, content interface{}) error { + msg, err := r.ReadMsg() + if err != nil { + return err + } + if msg.Code != code { + return fmt.Errorf("message code mismatch: got %d, expected %d", msg.Code, code) + } + if content == nil { + return msg.Discard() + } + contentEnc, err := rlp.EncodeToBytes(content) + if err != nil { + panic("content encode error: " + err.Error()) + } + if int(msg.Size) != len(contentEnc) { + return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc)) + } + actualContent, err := ioutil.ReadAll(msg.Payload) + if err != nil { + return err + } + if !bytes.Equal(actualContent, contentEnc) { + return fmt.Errorf("message payload mismatch:\ngot: %x\nwant: %x", actualContent, contentEnc) + } + return nil +} + +// msgEventer wraps a MsgReadWriter and sends events whenever a message is sent +// or received +type msgEventer struct { + MsgReadWriter + + feed *event.Feed + peerID enode.ID + Protocol string + localAddress string + remoteAddress string +} + +// newMsgEventer returns a msgEventer which sends message events to the given +// feed +func newMsgEventer(rw MsgReadWriter, feed *event.Feed, peerID enode.ID, proto, remote, local string) *msgEventer { + return &msgEventer{ + MsgReadWriter: rw, + feed: feed, + peerID: peerID, + Protocol: proto, + remoteAddress: remote, + localAddress: local, + } +} + +// ReadMsg reads a message from the underlying MsgReadWriter and emits a +// "message received" event +func (ev *msgEventer) ReadMsg() (Msg, error) { + msg, err := ev.MsgReadWriter.ReadMsg() + if err != nil { + return msg, err + } + ev.feed.Send(&PeerEvent{ + Type: PeerEventTypeMsgRecv, + Peer: ev.peerID, + Protocol: ev.Protocol, + MsgCode: &msg.Code, + MsgSize: &msg.Size, + LocalAddress: ev.localAddress, + RemoteAddress: ev.remoteAddress, + }) + return msg, nil +} + +// WriteMsg writes a message to the underlying MsgReadWriter and emits a +// "message sent" event +func (ev *msgEventer) WriteMsg(msg Msg) error { + err := ev.MsgReadWriter.WriteMsg(msg) + if err != nil { + return err + } + ev.feed.Send(&PeerEvent{ + Type: PeerEventTypeMsgSend, + Peer: ev.peerID, + Protocol: ev.Protocol, + MsgCode: &msg.Code, + MsgSize: &msg.Size, + LocalAddress: ev.localAddress, + RemoteAddress: ev.remoteAddress, + }) + return nil +} + +// Close closes the underlying MsgReadWriter if it implements the io.Closer +// interface +func (ev *msgEventer) Close() error { + if v, ok := ev.MsgReadWriter.(io.Closer); ok { + return v.Close() + } + return nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/peer.go b/vendor/github.com/ethereum/go-ethereum/p2p/peer.go index 98ea6835..d370894f 100644 --- a/vendor/github.com/ethereum/go-ethereum/p2p/peer.go +++ b/vendor/github.com/ethereum/go-ethereum/p2p/peer.go @@ -91,12 +91,14 @@ const ( // PeerEvent is an event emitted when peers are either added or dropped from // a p2p.Server or when a message is sent or received on a peer connection type PeerEvent struct { - Type PeerEventType `json:"type"` - Peer enode.ID `json:"peer"` - Error string `json:"error,omitempty"` - Protocol string `json:"protocol,omitempty"` - MsgCode *uint64 `json:"msg_code,omitempty"` - MsgSize *uint32 `json:"msg_size,omitempty"` + Type PeerEventType `json:"type"` + Peer enode.ID `json:"peer"` + Error string `json:"error,omitempty"` + Protocol string `json:"protocol,omitempty"` + MsgCode *uint64 `json:"msg_code,omitempty"` + MsgSize *uint32 `json:"msg_size,omitempty"` + LocalAddress string `json:"local,omitempty"` + RemoteAddress string `json:"remote,omitempty"` } // Peer represents a connected remote node. @@ -354,7 +356,7 @@ func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) proto.werr = writeErr var rw MsgReadWriter = proto if p.events != nil { - rw = newMsgEventer(rw, p.events, p.ID(), proto.Name) + rw = newMsgEventer(rw, p.events, p.ID(), proto.Name, p.Info().Network.RemoteAddress, p.Info().Network.LocalAddress) } p.log.Trace(fmt.Sprintf("Starting protocol %s/%d", proto.Name, proto.Version)) go func() { diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/protocol.go b/vendor/github.com/ethereum/go-ethereum/p2p/protocol.go new file mode 100644 index 00000000..9ce4c202 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/p2p/protocol.go @@ -0,0 +1,81 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package p2p + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ethereum/go-ethereum/p2p/enr" +) + +// Protocol represents a P2P subprotocol implementation. +type Protocol struct { + // Name should contain the official protocol name, + // often a three-letter word. + Name string + + // Version should contain the version number of the protocol. + Version uint + + // Length should contain the number of message codes used + // by the protocol. + Length uint64 + + // Run is called in a new goroutine when the protocol has been + // negotiated with a peer. It should read and write messages from + // rw. The Payload for each message must be fully consumed. + // + // The peer connection is closed when Start returns. It should return + // any protocol-level error (such as an I/O error) that is + // encountered. + Run func(peer *Peer, rw MsgReadWriter) error + + // NodeInfo is an optional helper method to retrieve protocol specific metadata + // about the host node. + NodeInfo func() interface{} + + // PeerInfo is an optional helper method to retrieve protocol specific metadata + // about a certain peer in the network. If an info retrieval function is set, + // but returns nil, it is assumed that the protocol handshake is still running. + PeerInfo func(id enode.ID) interface{} + + // Attributes contains protocol specific information for the node record. + Attributes []enr.Entry +} + +func (p Protocol) cap() Cap { + return Cap{p.Name, p.Version} +} + +// Cap is the structure of a peer capability. +type Cap struct { + Name string + Version uint +} + +func (cap Cap) String() string { + return fmt.Sprintf("%s/%d", cap.Name, cap.Version) +} + +type capsByNameAndVersion []Cap + +func (cs capsByNameAndVersion) Len() int { return len(cs) } +func (cs capsByNameAndVersion) Swap(i, j int) { cs[i], cs[j] = cs[j], cs[i] } +func (cs capsByNameAndVersion) Less(i, j int) bool { + return cs[i].Name < cs[j].Name || (cs[i].Name == cs[j].Name && cs[i].Version < cs[j].Version) +} diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/server.go b/vendor/github.com/ethereum/go-ethereum/p2p/server.go index a373904f..692c9eb7 100644 --- a/vendor/github.com/ethereum/go-ethereum/p2p/server.go +++ b/vendor/github.com/ethereum/go-ethereum/p2p/server.go @@ -286,6 +286,11 @@ func (c *conn) set(f connFlag, val bool) { } } +// LocalNode returns the local node record. +func (srv *Server) LocalNode() *enode.LocalNode { + return srv.localnode +} + // Peers returns all connected peers. func (srv *Server) Peers() []*Peer { var ps []*Peer @@ -488,7 +493,6 @@ func (srv *Server) setupLocalNode() error { srv.nodedb = db srv.localnode = enode.NewLocalNode(db, srv.PrivateKey) srv.localnode.SetFallbackIP(net.IP{127, 0, 0, 1}) - srv.localnode.Set(capsByNameAndVersion(srv.ourHandshake.Caps)) // TODO: check conflicts for _, p := range srv.Protocols { for _, e := range p.Attributes { @@ -744,7 +748,7 @@ running: p.events = &srv.peerFeed } name := truncateName(c.name) - srv.log.Debug("Adding p2p peer", "name", name, "addr", c.fd.RemoteAddr(), "peers", len(peers)+1) + p.log.Debug("Adding p2p peer", "addr", p.RemoteAddr(), "peers", len(peers)+1, "name", name) go srv.runPeer(p) peers[c.node.ID()] = p if p.Inbound() { @@ -759,7 +763,7 @@ running: case pd := <-srv.delpeer: // A peer disconnected. d := common.PrettyDuration(mclock.Now() - pd.created) - pd.log.Debug("Removing p2p peer", "duration", d, "peers", len(peers)-1, "req", pd.requested, "err", pd.err) + pd.log.Debug("Removing p2p peer", "addr", pd.RemoteAddr(), "peers", len(peers)-1, "duration", d, "req", pd.requested, "err", pd.err) delete(peers, pd.ID()) if pd.Inbound() { inboundCount-- @@ -1016,8 +1020,10 @@ func (srv *Server) runPeer(p *Peer) { // broadcast peer add srv.peerFeed.Send(&PeerEvent{ - Type: PeerEventTypeAdd, - Peer: p.ID(), + Type: PeerEventTypeAdd, + Peer: p.ID(), + RemoteAddress: p.RemoteAddr().String(), + LocalAddress: p.LocalAddr().String(), }) // run the protocol @@ -1025,9 +1031,11 @@ func (srv *Server) runPeer(p *Peer) { // broadcast peer drop srv.peerFeed.Send(&PeerEvent{ - Type: PeerEventTypeDrop, - Peer: p.ID(), - Error: err.Error(), + Type: PeerEventTypeDrop, + Peer: p.ID(), + Error: err.Error(), + RemoteAddress: p.RemoteAddr().String(), + LocalAddress: p.LocalAddr().String(), }) // Note: run waits for existing peers to be sent on srv.delpeer diff --git a/vendor/github.com/ethereum/go-ethereum/p2p/simulations/adapters/exec.go b/vendor/github.com/ethereum/go-ethereum/p2p/simulations/adapters/exec.go new file mode 100644 index 00000000..4f17efc3 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/p2p/simulations/adapters/exec.go @@ -0,0 +1,548 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package adapters + +import ( + "bytes" + "context" + "crypto/ecdsa" + "encoding/json" + "errors" + "fmt" + "io" + "net" + "net/http" + "os" + "os/exec" + "os/signal" + "path/filepath" + "strings" + "sync" + "syscall" + "time" + + "github.com/docker/docker/pkg/reexec" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ethereum/go-ethereum/rpc" + "golang.org/x/net/websocket" +) + +func init() { + // Register a reexec function to start a simulation node when the current binary is + // executed as "p2p-node" (rather than whatever the main() function would normally do). + reexec.Register("p2p-node", execP2PNode) +} + +// ExecAdapter is a NodeAdapter which runs simulation nodes by executing the current binary +// as a child process. +type ExecAdapter struct { + // BaseDir is the directory under which the data directories for each + // simulation node are created. + BaseDir string + + nodes map[enode.ID]*ExecNode +} + +// NewExecAdapter returns an ExecAdapter which stores node data in +// subdirectories of the given base directory +func NewExecAdapter(baseDir string) *ExecAdapter { + return &ExecAdapter{ + BaseDir: baseDir, + nodes: make(map[enode.ID]*ExecNode), + } +} + +// Name returns the name of the adapter for logging purposes +func (e *ExecAdapter) Name() string { + return "exec-adapter" +} + +// NewNode returns a new ExecNode using the given config +func (e *ExecAdapter) NewNode(config *NodeConfig) (Node, error) { + if len(config.Services) == 0 { + return nil, errors.New("node must have at least one service") + } + for _, service := range config.Services { + if _, exists := serviceFuncs[service]; !exists { + return nil, fmt.Errorf("unknown node service %q", service) + } + } + + // create the node directory using the first 12 characters of the ID + // as Unix socket paths cannot be longer than 256 characters + dir := filepath.Join(e.BaseDir, config.ID.String()[:12]) + if err := os.Mkdir(dir, 0755); err != nil { + return nil, fmt.Errorf("error creating node directory: %s", err) + } + + err := config.initDummyEnode() + if err != nil { + return nil, err + } + + // generate the config + conf := &execNodeConfig{ + Stack: node.DefaultConfig, + Node: config, + } + if config.DataDir != "" { + conf.Stack.DataDir = config.DataDir + } else { + conf.Stack.DataDir = filepath.Join(dir, "data") + } + + // these parameters are crucial for execadapter node to run correctly + conf.Stack.WSHost = "127.0.0.1" + conf.Stack.WSPort = 0 + conf.Stack.WSOrigins = []string{"*"} + conf.Stack.WSExposeAll = true + conf.Stack.P2P.EnableMsgEvents = config.EnableMsgEvents + conf.Stack.P2P.NoDiscovery = true + conf.Stack.P2P.NAT = nil + conf.Stack.NoUSB = true + + // listen on a localhost port, which we set when we + // initialise NodeConfig (usually a random port) + conf.Stack.P2P.ListenAddr = fmt.Sprintf(":%d", config.Port) + + node := &ExecNode{ + ID: config.ID, + Dir: dir, + Config: conf, + adapter: e, + } + node.newCmd = node.execCommand + e.nodes[node.ID] = node + return node, nil +} + +// ExecNode starts a simulation node by exec'ing the current binary and +// running the configured services +type ExecNode struct { + ID enode.ID + Dir string + Config *execNodeConfig + Cmd *exec.Cmd + Info *p2p.NodeInfo + + adapter *ExecAdapter + client *rpc.Client + wsAddr string + newCmd func() *exec.Cmd + key *ecdsa.PrivateKey +} + +// Addr returns the node's enode URL +func (n *ExecNode) Addr() []byte { + if n.Info == nil { + return nil + } + return []byte(n.Info.Enode) +} + +// Client returns an rpc.Client which can be used to communicate with the +// underlying services (it is set once the node has started) +func (n *ExecNode) Client() (*rpc.Client, error) { + return n.client, nil +} + +// Start exec's the node passing the ID and service as command line arguments +// and the node config encoded as JSON in an environment variable. +func (n *ExecNode) Start(snapshots map[string][]byte) (err error) { + if n.Cmd != nil { + return errors.New("already started") + } + defer func() { + if err != nil { + n.Stop() + } + }() + + // encode a copy of the config containing the snapshot + confCopy := *n.Config + confCopy.Snapshots = snapshots + confCopy.PeerAddrs = make(map[string]string) + for id, node := range n.adapter.nodes { + confCopy.PeerAddrs[id.String()] = node.wsAddr + } + confData, err := json.Marshal(confCopy) + if err != nil { + return fmt.Errorf("error generating node config: %s", err) + } + + // start the one-shot server that waits for startup information + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + statusURL, statusC := n.waitForStartupJSON(ctx) + + // start the node + cmd := n.newCmd() + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Env = append(os.Environ(), + envStatusURL+"="+statusURL, + envNodeConfig+"="+string(confData), + ) + if err := cmd.Start(); err != nil { + return fmt.Errorf("error starting node: %s", err) + } + n.Cmd = cmd + + // read the WebSocket address from the stderr logs + status := <-statusC + if status.Err != "" { + return errors.New(status.Err) + } + client, err := rpc.DialWebsocket(ctx, status.WSEndpoint, "http://localhost") + if err != nil { + return fmt.Errorf("can't connect to RPC server: %v", err) + } + + // node ready :) + n.client = client + n.wsAddr = status.WSEndpoint + n.Info = status.NodeInfo + return nil +} + +// waitForStartupJSON runs a one-shot HTTP server to receive a startup report. +func (n *ExecNode) waitForStartupJSON(ctx context.Context) (string, chan nodeStartupJSON) { + var ( + ch = make(chan nodeStartupJSON, 1) + quitOnce sync.Once + srv http.Server + ) + l, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + ch <- nodeStartupJSON{Err: err.Error()} + return "", ch + } + quit := func(status nodeStartupJSON) { + quitOnce.Do(func() { + l.Close() + ch <- status + }) + } + srv.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var status nodeStartupJSON + if err := json.NewDecoder(r.Body).Decode(&status); err != nil { + status.Err = fmt.Sprintf("can't decode startup report: %v", err) + } + quit(status) + }) + // Run the HTTP server, but don't wait forever and shut it down + // if the context is canceled. + go srv.Serve(l) + go func() { + <-ctx.Done() + quit(nodeStartupJSON{Err: "didn't get startup report"}) + }() + + url := "http://" + l.Addr().String() + return url, ch +} + +// execCommand returns a command which runs the node locally by exec'ing +// the current binary but setting argv[0] to "p2p-node" so that the child +// runs execP2PNode +func (n *ExecNode) execCommand() *exec.Cmd { + return &exec.Cmd{ + Path: reexec.Self(), + Args: []string{"p2p-node", strings.Join(n.Config.Node.Services, ","), n.ID.String()}, + } +} + +// Stop stops the node by first sending SIGTERM and then SIGKILL if the node +// doesn't stop within 5s +func (n *ExecNode) Stop() error { + if n.Cmd == nil { + return nil + } + defer func() { + n.Cmd = nil + }() + + if n.client != nil { + n.client.Close() + n.client = nil + n.wsAddr = "" + n.Info = nil + } + + if err := n.Cmd.Process.Signal(syscall.SIGTERM); err != nil { + return n.Cmd.Process.Kill() + } + waitErr := make(chan error) + go func() { + waitErr <- n.Cmd.Wait() + }() + select { + case err := <-waitErr: + return err + case <-time.After(5 * time.Second): + return n.Cmd.Process.Kill() + } +} + +// NodeInfo returns information about the node +func (n *ExecNode) NodeInfo() *p2p.NodeInfo { + info := &p2p.NodeInfo{ + ID: n.ID.String(), + } + if n.client != nil { + n.client.Call(&info, "admin_nodeInfo") + } + return info +} + +// ServeRPC serves RPC requests over the given connection by dialling the +// node's WebSocket address and joining the two connections +func (n *ExecNode) ServeRPC(clientConn net.Conn) error { + conn, err := websocket.Dial(n.wsAddr, "", "http://localhost") + if err != nil { + return err + } + var wg sync.WaitGroup + wg.Add(2) + join := func(src, dst net.Conn) { + defer wg.Done() + io.Copy(dst, src) + // close the write end of the destination connection + if cw, ok := dst.(interface { + CloseWrite() error + }); ok { + cw.CloseWrite() + } else { + dst.Close() + } + } + go join(conn, clientConn) + go join(clientConn, conn) + wg.Wait() + return nil +} + +// Snapshots creates snapshots of the services by calling the +// simulation_snapshot RPC method +func (n *ExecNode) Snapshots() (map[string][]byte, error) { + if n.client == nil { + return nil, errors.New("RPC not started") + } + var snapshots map[string][]byte + return snapshots, n.client.Call(&snapshots, "simulation_snapshot") +} + +// execNodeConfig is used to serialize the node configuration so it can be +// passed to the child process as a JSON encoded environment variable +type execNodeConfig struct { + Stack node.Config `json:"stack"` + Node *NodeConfig `json:"node"` + Snapshots map[string][]byte `json:"snapshots,omitempty"` + PeerAddrs map[string]string `json:"peer_addrs,omitempty"` +} + +// execP2PNode starts a simulation node when the current binary is executed with +// argv[0] being "p2p-node", reading the service / ID from argv[1] / argv[2] +// and the node config from an environment variable. +func execP2PNode() { + glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.LogfmtFormat())) + glogger.Verbosity(log.LvlInfo) + log.Root().SetHandler(glogger) + statusURL := os.Getenv(envStatusURL) + if statusURL == "" { + log.Crit("missing " + envStatusURL) + } + + // Start the node and gather startup report. + var status nodeStartupJSON + stack, stackErr := startExecNodeStack() + if stackErr != nil { + status.Err = stackErr.Error() + } else { + status.WSEndpoint = "ws://" + stack.WSEndpoint() + status.NodeInfo = stack.Server().NodeInfo() + } + + // Send status to the host. + statusJSON, _ := json.Marshal(status) + if _, err := http.Post(statusURL, "application/json", bytes.NewReader(statusJSON)); err != nil { + log.Crit("Can't post startup info", "url", statusURL, "err", err) + } + if stackErr != nil { + os.Exit(1) + } + + // Stop the stack if we get a SIGTERM signal. + go func() { + sigc := make(chan os.Signal, 1) + signal.Notify(sigc, syscall.SIGTERM) + defer signal.Stop(sigc) + <-sigc + log.Info("Received SIGTERM, shutting down...") + stack.Stop() + }() + stack.Wait() // Wait for the stack to exit. +} + +func startExecNodeStack() (*node.Node, error) { + // read the services from argv + serviceNames := strings.Split(os.Args[1], ",") + + // decode the config + confEnv := os.Getenv(envNodeConfig) + if confEnv == "" { + return nil, fmt.Errorf("missing " + envNodeConfig) + } + var conf execNodeConfig + if err := json.Unmarshal([]byte(confEnv), &conf); err != nil { + return nil, fmt.Errorf("error decoding %s: %v", envNodeConfig, err) + } + + // create enode record + nodeTcpConn, err := net.ResolveTCPAddr("tcp", conf.Stack.P2P.ListenAddr) + if nodeTcpConn.IP == nil { + nodeTcpConn.IP = net.IPv4(127, 0, 0, 1) + } + conf.Node.initEnode(nodeTcpConn.IP, nodeTcpConn.Port, nodeTcpConn.Port) + conf.Stack.P2P.PrivateKey = conf.Node.PrivateKey + conf.Stack.Logger = log.New("node.id", conf.Node.ID.String()) + + // initialize the devp2p stack + stack, err := node.New(&conf.Stack) + if err != nil { + return nil, fmt.Errorf("error creating node stack: %v", err) + } + + // register the services, collecting them into a map so we can wrap + // them in a snapshot service + services := make(map[string]node.Service, len(serviceNames)) + for _, name := range serviceNames { + serviceFunc, exists := serviceFuncs[name] + if !exists { + return nil, fmt.Errorf("unknown node service %q", err) + } + constructor := func(nodeCtx *node.ServiceContext) (node.Service, error) { + ctx := &ServiceContext{ + RPCDialer: &wsRPCDialer{addrs: conf.PeerAddrs}, + NodeContext: nodeCtx, + Config: conf.Node, + } + if conf.Snapshots != nil { + ctx.Snapshot = conf.Snapshots[name] + } + service, err := serviceFunc(ctx) + if err != nil { + return nil, err + } + services[name] = service + return service, nil + } + if err := stack.Register(constructor); err != nil { + return stack, fmt.Errorf("error registering service %q: %v", name, err) + } + } + + // register the snapshot service + err = stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + return &snapshotService{services}, nil + }) + if err != nil { + return stack, fmt.Errorf("error starting snapshot service: %v", err) + } + + // start the stack + if err = stack.Start(); err != nil { + err = fmt.Errorf("error starting stack: %v", err) + } + return stack, err +} + +const ( + envStatusURL = "_P2P_STATUS_URL" + envNodeConfig = "_P2P_NODE_CONFIG" +) + +// nodeStartupJSON is sent to the simulation host after startup. +type nodeStartupJSON struct { + Err string + WSEndpoint string + NodeInfo *p2p.NodeInfo +} + +// snapshotService is a node.Service which wraps a list of services and +// exposes an API to generate a snapshot of those services +type snapshotService struct { + services map[string]node.Service +} + +func (s *snapshotService) APIs() []rpc.API { + return []rpc.API{{ + Namespace: "simulation", + Version: "1.0", + Service: SnapshotAPI{s.services}, + }} +} + +func (s *snapshotService) Protocols() []p2p.Protocol { + return nil +} + +func (s *snapshotService) Start(*p2p.Server) error { + return nil +} + +func (s *snapshotService) Stop() error { + return nil +} + +// SnapshotAPI provides an RPC method to create snapshots of services +type SnapshotAPI struct { + services map[string]node.Service +} + +func (api SnapshotAPI) Snapshot() (map[string][]byte, error) { + snapshots := make(map[string][]byte) + for name, service := range api.services { + if s, ok := service.(interface { + Snapshot() ([]byte, error) + }); ok { + snap, err := s.Snapshot() + if err != nil { + return nil, err + } + snapshots[name] = snap + } + } + return snapshots, nil +} + +type wsRPCDialer struct { + addrs map[string]string +} + +// DialRPC implements the RPCDialer interface by creating a WebSocket RPC +// client of the given node +func (w *wsRPCDialer) DialRPC(id enode.ID) (*rpc.Client, error) { + addr, ok := w.addrs[id.String()] + if !ok { + return nil, fmt.Errorf("unknown node: %s", id) + } + return rpc.DialWebsocket(context.Background(), addr, "http://localhost") +} diff --git a/vendor/github.com/ethereum/go-ethereum/params/bootnodes.go b/vendor/github.com/ethereum/go-ethereum/params/bootnodes.go new file mode 100644 index 00000000..36f13d17 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/params/bootnodes.go @@ -0,0 +1,81 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package params + +// MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on +// the main Ethereum network. +var MainnetBootnodes = []string{ + // Ethereum Foundation Go Bootnodes + "enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", // bootnode-aws-ap-southeast-1-001 + "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", // bootnode-aws-us-east-1-001 + "enode://ca6de62fce278f96aea6ec5a2daadb877e51651247cb96ee310a318def462913b653963c155a0ef6c7d50048bba6e6cea881130857413d9f50a621546b590758@34.255.23.113:30303", // bootnode-aws-eu-west-1-001 + "enode://279944d8dcd428dffaa7436f25ca0ca43ae19e7bcf94a8fb7d1641651f92d121e972ac2e8f381414b80cc8e5555811c2ec6e1a99bb009b3f53c4c69923e11bd8@35.158.244.151:30303", // bootnode-aws-eu-central-1-001 + "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", // bootnode-azure-australiaeast-001 + "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", // bootnode-azure-brazilsouth-001 + "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", // bootnode-azure-koreasouth-001 + "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", // bootnode-azure-westus-001 + + // Ethereum Foundation Go Bootnodes (legacy) + "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", // IE + "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", // US-WEST + "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", // BR + "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", // AU + "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", // SG + + // Ethereum Foundation C++ Bootnodes + "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", // DE +} + +// TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the +// Ropsten test network. +var TestnetBootnodes = []string{ + "enode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303", // US-Azure geth + "enode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303", // US-Azure parity + "enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303", // Parity + "enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303", // @gpip +} + +// RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the +// Rinkeby test network. +var RinkebyBootnodes = []string{ + "enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303", // IE + "enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303", // INFURA + "enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA +} + +// GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the +// Görli test network. +var GoerliBootnodes = []string{ + // Upstream bootnodes + "enode://011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a@51.141.78.53:30303", + "enode://176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b@13.93.54.137:30303", + "enode://46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291@94.237.54.114:30313", + "enode://c1f8b7c2ac4453271fa07d8e9ecf9a2e8285aa0bd0c07df0131f47153306b0736fd3db8924e7a9bf0bed6b1d8d4f87362a71b033dc7c64547728d953e43e59b2@52.64.155.147:30303", + "enode://f4a9c6ee28586009fb5a96c8af13a58ed6d8315a9eee4772212c1d4d9cebe5a8b8a78ea4434f318726317d04a3f531a1ef0420cf9752605a562cfe858c46e263@213.186.16.82:30303", + + // Ethereum Foundation bootnode + "enode://573b6607cd59f241e30e4c4943fd50e99e2b6f42f9bd5ca111659d309c06741247f4f1e93843ad3e8c8c18b6e2d94c161b7ef67479b3938780a97134b618b5ce@52.56.136.200:30303", +} + +// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the +// experimental RLPx v5 topic-discovery network. +var DiscoveryV5Bootnodes = []string{ + "enode://06051a5573c81934c9554ef2898eb13b33a34b94cf36b202b69fde139ca17a85051979867720d4bdae4323d4943ddf9aeeb6643633aa656e0be843659795007a@35.177.226.168:30303", + "enode://0cc5f5ffb5d9098c8b8c62325f3797f56509bff942704687b6530992ac706e2cb946b90a34f1f19548cd3c7baccbcaea354531e5983c7d1bc0dee16ce4b6440b@40.118.3.223:30304", + "enode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30306", + "enode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30307", +} diff --git a/vendor/github.com/ethereum/go-ethereum/params/config.go b/vendor/github.com/ethereum/go-ethereum/params/config.go index c59c748a..0620e6ad 100644 --- a/vendor/github.com/ethereum/go-ethereum/params/config.go +++ b/vendor/github.com/ethereum/go-ethereum/params/config.go @@ -17,10 +17,12 @@ package params import ( + "encoding/binary" "fmt" "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" ) // Genesis hashes to enforce below configs on. @@ -40,6 +42,15 @@ var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{ GoerliGenesisHash: GoerliTrustedCheckpoint, } +// CheckpointOracles associates each known checkpoint oracles with the genesis hash of +// the chain it belongs to. +var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ + MainnetGenesisHash: MainnetCheckpointOracle, + TestnetGenesisHash: TestnetCheckpointOracle, + RinkebyGenesisHash: RinkebyCheckpointOracle, + GoerliGenesisHash: GoerliCheckpointOracle, +} + var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ @@ -59,11 +70,23 @@ var ( // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network. MainnetTrustedCheckpoint = &TrustedCheckpoint{ - Name: "mainnet", - SectionIndex: 227, - SectionHead: common.HexToHash("0xa2e0b25d72c2fc6e35a7f853cdacb193b4b4f95c606accf7f8fa8415283582c7"), - CHTRoot: common.HexToHash("0xf69bdd4053b95b61a27b106a0e86103d791edd8574950dc96aa351ab9b9f1aa0"), - BloomRoot: common.HexToHash("0xec1b454d4c6322c78ccedf76ac922a8698c3cac4d98748a84af4995b7bd3d744"), + SectionIndex: 246, + SectionHead: common.HexToHash("0xb86fbe8a2b1f3c576d06fe1721cd976f98ac1cbf1823da16ef74811e85fd44ac"), + CHTRoot: common.HexToHash("0xe99b397f908a391d0d6bd41d1c19cea4bf5051a9695c94d58de44c538d7a1037"), + BloomRoot: common.HexToHash("0xa1c1e064ccc16690c5fbabf600c4c7ebb2d8e8fcc674e59365087a77fb391a47"), + } + + // MainnetCheckpointOracle contains a set of configs for the main network oracle. + MainnetCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"), + Signers: []common.Address{ + common.HexToAddress("0x1b2C260efc720BE89101890E4Db589b44E950527"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume + }, + Threshold: 2, } // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. @@ -84,11 +107,23 @@ var ( // TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network. TestnetTrustedCheckpoint = &TrustedCheckpoint{ - Name: "testnet", - SectionIndex: 161, - SectionHead: common.HexToHash("0x5378afa734e1feafb34bcca1534c4d96952b754579b96a4afb23d5301ecececc"), - CHTRoot: common.HexToHash("0x1cf2b071e7443a62914362486b613ff30f60cea0d9c268ed8c545f876a3ee60c"), - BloomRoot: common.HexToHash("0x5ac25c84bd18a9cbe878d4609a80220f57f85037a112644532412ba0d498a31b"), + SectionIndex: 180, + SectionHead: common.HexToHash("0xc5741683f9fcff7b670732deef2ebe6e7ff7a7bb29249401300b13b4eee690a6"), + CHTRoot: common.HexToHash("0xf03ccebbf71a0998833afdf0e7c29095138c2df1cee6ed44ad9da62b5206b8ad"), + BloomRoot: common.HexToHash("0xec46c48cf218891c91ad1139d3b3aec7cf385d4c1100c06711e56b83d8993b23"), + } + + // TestnetCheckpointOracle contains a set of configs for the Ropsten test network oracle. + TestnetCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0xEF79475013f154E6A65b54cB2742867791bf0B84"), + Signers: []common.Address{ + common.HexToAddress("0x32162F3581E88a5f62e8A61892B42C46E2c18f7b"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume + }, + Threshold: 2, } // RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. @@ -112,11 +147,22 @@ var ( // RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network. RinkebyTrustedCheckpoint = &TrustedCheckpoint{ - Name: "rinkeby", - SectionIndex: 125, - SectionHead: common.HexToHash("0x8a738386f6bb34add15846f8f49c4c519a2f32519096e792b9f43bcb407c831c"), - CHTRoot: common.HexToHash("0xa1e5720a9bad4dce794f129e4ac6744398197b652868011486a6f89c8ec84a75"), - BloomRoot: common.HexToHash("0xa3048fe8b7e30f77f11bc755a88478363d7d3e71c2bdfe4e8ab9e269cd804ba2"), + SectionIndex: 142, + SectionHead: common.HexToHash("0xf7e3946d54c3040d391edd61a855fec7293f9d0b51445ede88562f2dc2edce3f"), + CHTRoot: common.HexToHash("0xb2beee185e3ecada83eb69f72cbcca3e0978dbc8da5cdb3e34a71b3d597815d0"), + BloomRoot: common.HexToHash("0x3970039fee31eb0542090030d1567cc99b8051572d51899db4d91619ca26f0cb"), + } + + // RinkebyCheckpointOracle contains a set of configs for the Rinkeby test network oracle. + RinkebyCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0xebe8eFA441B9302A0d7eaECc277c09d20D684540"), + Signers: []common.Address{ + common.HexToAddress("0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + }, + Threshold: 2, } // GoerliChainConfig contains the chain parameters to run a node on the Görli test network. @@ -139,11 +185,23 @@ var ( // GoerliTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network. GoerliTrustedCheckpoint = &TrustedCheckpoint{ - Name: "goerli", - SectionIndex: 9, - SectionHead: common.HexToHash("0x8e223d827391eee53b07cb8ee057dbfa11c93e0b45352188c783affd7840a921"), - CHTRoot: common.HexToHash("0xe0a817ac69b36c1e437c5b0cff9e764853f5115702b5f66d451b665d6afb7e78"), - BloomRoot: common.HexToHash("0x50d672aeb655b723284969c7c1201fb6ca003c23ed144bcb9f2d1b30e2971c1b"), + SectionIndex: 26, + SectionHead: common.HexToHash("0xd0c206e064c8efea930d97e56786af95354ea481b35294a20e5a340937e4c2c9"), + CHTRoot: common.HexToHash("0xce7235999aa8d73c4493b8f397474dafc627652a790dec60c4a968e2dfa5d7be"), + BloomRoot: common.HexToHash("0xc1ac19553473ebb07325b5092a09277d62e9ffe159166a1c6fbec614c4dfd885"), + } + + // GoerliCheckpointOracle contains a set of configs for the Goerli test network oracle. + GoerliCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"), + Signers: []common.Address{ + common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume + }, + Threshold: 2, } // AllEthashProtocolChanges contains every protocol change (EIPs) introduced @@ -169,13 +227,43 @@ var ( // used to start light syncing from this checkpoint and avoid downloading the // entire header chain while still being able to securely access old headers/logs. type TrustedCheckpoint struct { - Name string `json:"-"` SectionIndex uint64 `json:"sectionIndex"` SectionHead common.Hash `json:"sectionHead"` CHTRoot common.Hash `json:"chtRoot"` BloomRoot common.Hash `json:"bloomRoot"` } +// HashEqual returns an indicator comparing the itself hash with given one. +func (c *TrustedCheckpoint) HashEqual(hash common.Hash) bool { + if c.Empty() { + return hash == common.Hash{} + } + return c.Hash() == hash +} + +// Hash returns the hash of checkpoint's four key fields(index, sectionHead, chtRoot and bloomTrieRoot). +func (c *TrustedCheckpoint) Hash() common.Hash { + buf := make([]byte, 8+3*common.HashLength) + binary.BigEndian.PutUint64(buf, c.SectionIndex) + copy(buf[8:], c.SectionHead.Bytes()) + copy(buf[8+common.HashLength:], c.CHTRoot.Bytes()) + copy(buf[8+2*common.HashLength:], c.BloomRoot.Bytes()) + return crypto.Keccak256Hash(buf) +} + +// Empty returns an indicator whether the checkpoint is regarded as empty. +func (c *TrustedCheckpoint) Empty() bool { + return c.SectionHead == (common.Hash{}) || c.CHTRoot == (common.Hash{}) || c.BloomRoot == (common.Hash{}) +} + +// CheckpointOracleConfig represents a set of checkpoint contract(which acts as an oracle) +// config which used for light client checkpoint syncing. +type CheckpointOracleConfig struct { + Address common.Address `json:"address"` + Signers []common.Address `json:"signers"` + Threshold uint64 `json:"threshold"` +} + // ChainConfig is the core config which determines the blockchain settings. // // ChainConfig is stored in the database on a per block basis. This means @@ -236,7 +324,7 @@ func (c *ChainConfig) String() string { default: engine = "unknown" } - return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v ConstantinopleFix: %v Engine: %v}", + return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -364,7 +452,7 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi return newCompatError("Constantinople fork block", c.ConstantinopleBlock, newcfg.ConstantinopleBlock) } if isForkIncompatible(c.PetersburgBlock, newcfg.PetersburgBlock, head) { - return newCompatError("ConstantinopleFix fork block", c.PetersburgBlock, newcfg.PetersburgBlock) + return newCompatError("Petersburg fork block", c.PetersburgBlock, newcfg.PetersburgBlock) } if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) { return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock) diff --git a/vendor/github.com/ethereum/go-ethereum/params/network_params.go b/vendor/github.com/ethereum/go-ethereum/params/network_params.go index a949b845..bba24721 100644 --- a/vendor/github.com/ethereum/go-ethereum/params/network_params.go +++ b/vendor/github.com/ethereum/go-ethereum/params/network_params.go @@ -47,6 +47,12 @@ const ( // is generated HelperTrieProcessConfirmations = 256 + // CheckpointFrequency is the block frequency for creating checkpoint + CheckpointFrequency = 32768 + + // CheckpointProcessConfirmations is the number before a checkpoint is generated + CheckpointProcessConfirmations = 256 + // ImmutabilityThreshold is the number of blocks after which a chain segment is // considered immutable (i.e. soft finality). It is used by the downloader as a // hard limit against deep ancestors, by the blockchain against deep reorgs, by diff --git a/vendor/github.com/ethereum/go-ethereum/params/version.go b/vendor/github.com/ethereum/go-ethereum/params/version.go index c91a26ed..f4704267 100644 --- a/vendor/github.com/ethereum/go-ethereum/params/version.go +++ b/vendor/github.com/ethereum/go-ethereum/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 9 // Minor version component of the current release - VersionPatch = 0 // Patch version component of the current release + VersionPatch = 1 // Patch version component of the current release VersionMeta = "unstable" // Version metadata to append to the version string ) diff --git a/vendor/github.com/ethereum/go-ethereum/rpc/client.go b/vendor/github.com/ethereum/go-ethereum/rpc/client.go new file mode 100644 index 00000000..2053f540 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/rpc/client.go @@ -0,0 +1,626 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package rpc + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "net/url" + "reflect" + "strconv" + "sync/atomic" + "time" + + "github.com/ethereum/go-ethereum/log" +) + +var ( + ErrClientQuit = errors.New("client is closed") + ErrNoResult = errors.New("no result in JSON-RPC response") + ErrSubscriptionQueueOverflow = errors.New("subscription queue overflow") + errClientReconnected = errors.New("client reconnected") + errDead = errors.New("connection lost") +) + +const ( + // Timeouts + tcpKeepAliveInterval = 30 * time.Second + defaultDialTimeout = 10 * time.Second // used if context has no deadline + subscribeTimeout = 5 * time.Second // overall timeout eth_subscribe, rpc_modules calls +) + +const ( + // Subscriptions are removed when the subscriber cannot keep up. + // + // This can be worked around by supplying a channel with sufficiently sized buffer, + // but this can be inconvenient and hard to explain in the docs. Another issue with + // buffered channels is that the buffer is static even though it might not be needed + // most of the time. + // + // The approach taken here is to maintain a per-subscription linked list buffer + // shrinks on demand. If the buffer reaches the size below, the subscription is + // dropped. + maxClientSubscriptionBuffer = 20000 +) + +// BatchElem is an element in a batch request. +type BatchElem struct { + Method string + Args []interface{} + // The result is unmarshaled into this field. Result must be set to a + // non-nil pointer value of the desired type, otherwise the response will be + // discarded. + Result interface{} + // Error is set if the server returns an error for this request, or if + // unmarshaling into Result fails. It is not set for I/O errors. + Error error +} + +// Client represents a connection to an RPC server. +type Client struct { + idgen func() ID // for subscriptions + isHTTP bool + services *serviceRegistry + + idCounter uint32 + + // This function, if non-nil, is called when the connection is lost. + reconnectFunc reconnectFunc + + // writeConn is used for writing to the connection on the caller's goroutine. It should + // only be accessed outside of dispatch, with the write lock held. The write lock is + // taken by sending on requestOp and released by sending on sendDone. + writeConn jsonWriter + + // for dispatch + close chan struct{} + closing chan struct{} // closed when client is quitting + didClose chan struct{} // closed when client quits + reconnected chan ServerCodec // where write/reconnect sends the new connection + readOp chan readOp // read messages + readErr chan error // errors from read + reqInit chan *requestOp // register response IDs, takes write lock + reqSent chan error // signals write completion, releases write lock + reqTimeout chan *requestOp // removes response IDs when call timeout expires +} + +type reconnectFunc func(ctx context.Context) (ServerCodec, error) + +type clientContextKey struct{} + +type clientConn struct { + codec ServerCodec + handler *handler +} + +func (c *Client) newClientConn(conn ServerCodec) *clientConn { + ctx := context.WithValue(context.Background(), clientContextKey{}, c) + handler := newHandler(ctx, conn, c.idgen, c.services) + return &clientConn{conn, handler} +} + +func (cc *clientConn) close(err error, inflightReq *requestOp) { + cc.handler.close(err, inflightReq) + cc.codec.Close() +} + +type readOp struct { + msgs []*jsonrpcMessage + batch bool +} + +type requestOp struct { + ids []json.RawMessage + err error + resp chan *jsonrpcMessage // receives up to len(ids) responses + sub *ClientSubscription // only set for EthSubscribe requests +} + +func (op *requestOp) wait(ctx context.Context, c *Client) (*jsonrpcMessage, error) { + select { + case <-ctx.Done(): + // Send the timeout to dispatch so it can remove the request IDs. + if !c.isHTTP { + select { + case c.reqTimeout <- op: + case <-c.closing: + } + } + return nil, ctx.Err() + case resp := <-op.resp: + return resp, op.err + } +} + +// Dial creates a new client for the given URL. +// +// The currently supported URL schemes are "http", "https", "ws" and "wss". If rawurl is a +// file name with no URL scheme, a local socket connection is established using UNIX +// domain sockets on supported platforms and named pipes on Windows. If you want to +// configure transport options, use DialHTTP, DialWebsocket or DialIPC instead. +// +// For websocket connections, the origin is set to the local host name. +// +// The client reconnects automatically if the connection is lost. +func Dial(rawurl string) (*Client, error) { + return DialContext(context.Background(), rawurl) +} + +// DialContext creates a new RPC client, just like Dial. +// +// The context is used to cancel or time out the initial connection establishment. It does +// not affect subsequent interactions with the client. +func DialContext(ctx context.Context, rawurl string) (*Client, error) { + u, err := url.Parse(rawurl) + if err != nil { + return nil, err + } + switch u.Scheme { + case "http", "https": + return DialHTTP(rawurl) + case "ws", "wss": + return DialWebsocket(ctx, rawurl, "") + case "stdio": + return DialStdIO(ctx) + case "": + return DialIPC(ctx, rawurl) + default: + return nil, fmt.Errorf("no known transport for URL scheme %q", u.Scheme) + } +} + +// Client retrieves the client from the context, if any. This can be used to perform +// 'reverse calls' in a handler method. +func ClientFromContext(ctx context.Context) (*Client, bool) { + client, ok := ctx.Value(clientContextKey{}).(*Client) + return client, ok +} + +func newClient(initctx context.Context, connect reconnectFunc) (*Client, error) { + conn, err := connect(initctx) + if err != nil { + return nil, err + } + c := initClient(conn, randomIDGenerator(), new(serviceRegistry)) + c.reconnectFunc = connect + return c, nil +} + +func initClient(conn ServerCodec, idgen func() ID, services *serviceRegistry) *Client { + _, isHTTP := conn.(*httpConn) + c := &Client{ + idgen: idgen, + isHTTP: isHTTP, + services: services, + writeConn: conn, + close: make(chan struct{}), + closing: make(chan struct{}), + didClose: make(chan struct{}), + reconnected: make(chan ServerCodec), + readOp: make(chan readOp), + readErr: make(chan error), + reqInit: make(chan *requestOp), + reqSent: make(chan error, 1), + reqTimeout: make(chan *requestOp), + } + if !isHTTP { + go c.dispatch(conn) + } + return c +} + +// RegisterName creates a service for the given receiver type under the given name. When no +// methods on the given receiver match the criteria to be either a RPC method or a +// subscription an error is returned. Otherwise a new service is created and added to the +// service collection this client provides to the server. +func (c *Client) RegisterName(name string, receiver interface{}) error { + return c.services.registerName(name, receiver) +} + +func (c *Client) nextID() json.RawMessage { + id := atomic.AddUint32(&c.idCounter, 1) + return strconv.AppendUint(nil, uint64(id), 10) +} + +// SupportedModules calls the rpc_modules method, retrieving the list of +// APIs that are available on the server. +func (c *Client) SupportedModules() (map[string]string, error) { + var result map[string]string + ctx, cancel := context.WithTimeout(context.Background(), subscribeTimeout) + defer cancel() + err := c.CallContext(ctx, &result, "rpc_modules") + return result, err +} + +// Close closes the client, aborting any in-flight requests. +func (c *Client) Close() { + if c.isHTTP { + return + } + select { + case c.close <- struct{}{}: + <-c.didClose + case <-c.didClose: + } +} + +// Call performs a JSON-RPC call with the given arguments and unmarshals into +// result if no error occurred. +// +// The result must be a pointer so that package json can unmarshal into it. You +// can also pass nil, in which case the result is ignored. +func (c *Client) Call(result interface{}, method string, args ...interface{}) error { + ctx := context.Background() + return c.CallContext(ctx, result, method, args...) +} + +// CallContext performs a JSON-RPC call with the given arguments. If the context is +// canceled before the call has successfully returned, CallContext returns immediately. +// +// The result must be a pointer so that package json can unmarshal into it. You +// can also pass nil, in which case the result is ignored. +func (c *Client) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error { + msg, err := c.newMessage(method, args...) + if err != nil { + return err + } + op := &requestOp{ids: []json.RawMessage{msg.ID}, resp: make(chan *jsonrpcMessage, 1)} + + if c.isHTTP { + err = c.sendHTTP(ctx, op, msg) + } else { + err = c.send(ctx, op, msg) + } + if err != nil { + return err + } + + // dispatch has accepted the request and will close the channel when it quits. + switch resp, err := op.wait(ctx, c); { + case err != nil: + return err + case resp.Error != nil: + return resp.Error + case len(resp.Result) == 0: + return ErrNoResult + default: + return json.Unmarshal(resp.Result, &result) + } +} + +// BatchCall sends all given requests as a single batch and waits for the server +// to return a response for all of them. +// +// In contrast to Call, BatchCall only returns I/O errors. Any error specific to +// a request is reported through the Error field of the corresponding BatchElem. +// +// Note that batch calls may not be executed atomically on the server side. +func (c *Client) BatchCall(b []BatchElem) error { + ctx := context.Background() + return c.BatchCallContext(ctx, b) +} + +// BatchCall sends all given requests as a single batch and waits for the server +// to return a response for all of them. The wait duration is bounded by the +// context's deadline. +// +// In contrast to CallContext, BatchCallContext only returns errors that have occurred +// while sending the request. Any error specific to a request is reported through the +// Error field of the corresponding BatchElem. +// +// Note that batch calls may not be executed atomically on the server side. +func (c *Client) BatchCallContext(ctx context.Context, b []BatchElem) error { + msgs := make([]*jsonrpcMessage, len(b)) + op := &requestOp{ + ids: make([]json.RawMessage, len(b)), + resp: make(chan *jsonrpcMessage, len(b)), + } + for i, elem := range b { + msg, err := c.newMessage(elem.Method, elem.Args...) + if err != nil { + return err + } + msgs[i] = msg + op.ids[i] = msg.ID + } + + var err error + if c.isHTTP { + err = c.sendBatchHTTP(ctx, op, msgs) + } else { + err = c.send(ctx, op, msgs) + } + + // Wait for all responses to come back. + for n := 0; n < len(b) && err == nil; n++ { + var resp *jsonrpcMessage + resp, err = op.wait(ctx, c) + if err != nil { + break + } + // Find the element corresponding to this response. + // The element is guaranteed to be present because dispatch + // only sends valid IDs to our channel. + var elem *BatchElem + for i := range msgs { + if bytes.Equal(msgs[i].ID, resp.ID) { + elem = &b[i] + break + } + } + if resp.Error != nil { + elem.Error = resp.Error + continue + } + if len(resp.Result) == 0 { + elem.Error = ErrNoResult + continue + } + elem.Error = json.Unmarshal(resp.Result, elem.Result) + } + return err +} + +// Notify sends a notification, i.e. a method call that doesn't expect a response. +func (c *Client) Notify(ctx context.Context, method string, args ...interface{}) error { + op := new(requestOp) + msg, err := c.newMessage(method, args...) + if err != nil { + return err + } + msg.ID = nil + + if c.isHTTP { + return c.sendHTTP(ctx, op, msg) + } else { + return c.send(ctx, op, msg) + } +} + +// EthSubscribe registers a subscripion under the "eth" namespace. +func (c *Client) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*ClientSubscription, error) { + return c.Subscribe(ctx, "eth", channel, args...) +} + +// ShhSubscribe registers a subscripion under the "shh" namespace. +func (c *Client) ShhSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*ClientSubscription, error) { + return c.Subscribe(ctx, "shh", channel, args...) +} + +// Subscribe calls the "_subscribe" method with the given arguments, +// registering a subscription. Server notifications for the subscription are +// sent to the given channel. The element type of the channel must match the +// expected type of content returned by the subscription. +// +// The context argument cancels the RPC request that sets up the subscription but has no +// effect on the subscription after Subscribe has returned. +// +// Slow subscribers will be dropped eventually. Client buffers up to 20000 notifications +// before considering the subscriber dead. The subscription Err channel will receive +// ErrSubscriptionQueueOverflow. Use a sufficiently large buffer on the channel or ensure +// that the channel usually has at least one reader to prevent this issue. +func (c *Client) Subscribe(ctx context.Context, namespace string, channel interface{}, args ...interface{}) (*ClientSubscription, error) { + // Check type of channel first. + chanVal := reflect.ValueOf(channel) + if chanVal.Kind() != reflect.Chan || chanVal.Type().ChanDir()&reflect.SendDir == 0 { + panic("first argument to Subscribe must be a writable channel") + } + if chanVal.IsNil() { + panic("channel given to Subscribe must not be nil") + } + if c.isHTTP { + return nil, ErrNotificationsUnsupported + } + + msg, err := c.newMessage(namespace+subscribeMethodSuffix, args...) + if err != nil { + return nil, err + } + op := &requestOp{ + ids: []json.RawMessage{msg.ID}, + resp: make(chan *jsonrpcMessage), + sub: newClientSubscription(c, namespace, chanVal), + } + + // Send the subscription request. + // The arrival and validity of the response is signaled on sub.quit. + if err := c.send(ctx, op, msg); err != nil { + return nil, err + } + if _, err := op.wait(ctx, c); err != nil { + return nil, err + } + return op.sub, nil +} + +func (c *Client) newMessage(method string, paramsIn ...interface{}) (*jsonrpcMessage, error) { + msg := &jsonrpcMessage{Version: vsn, ID: c.nextID(), Method: method} + if paramsIn != nil { // prevent sending "params":null + var err error + if msg.Params, err = json.Marshal(paramsIn); err != nil { + return nil, err + } + } + return msg, nil +} + +// send registers op with the dispatch loop, then sends msg on the connection. +// if sending fails, op is deregistered. +func (c *Client) send(ctx context.Context, op *requestOp, msg interface{}) error { + select { + case c.reqInit <- op: + err := c.write(ctx, msg) + c.reqSent <- err + return err + case <-ctx.Done(): + // This can happen if the client is overloaded or unable to keep up with + // subscription notifications. + return ctx.Err() + case <-c.closing: + return ErrClientQuit + } +} + +func (c *Client) write(ctx context.Context, msg interface{}) error { + // The previous write failed. Try to establish a new connection. + if c.writeConn == nil { + if err := c.reconnect(ctx); err != nil { + return err + } + } + err := c.writeConn.Write(ctx, msg) + if err != nil { + c.writeConn = nil + } + return err +} + +func (c *Client) reconnect(ctx context.Context) error { + if c.reconnectFunc == nil { + return errDead + } + + if _, ok := ctx.Deadline(); !ok { + var cancel func() + ctx, cancel = context.WithTimeout(ctx, defaultDialTimeout) + defer cancel() + } + newconn, err := c.reconnectFunc(ctx) + if err != nil { + log.Trace("RPC client reconnect failed", "err", err) + return err + } + select { + case c.reconnected <- newconn: + c.writeConn = newconn + return nil + case <-c.didClose: + newconn.Close() + return ErrClientQuit + } +} + +// dispatch is the main loop of the client. +// It sends read messages to waiting calls to Call and BatchCall +// and subscription notifications to registered subscriptions. +func (c *Client) dispatch(codec ServerCodec) { + var ( + lastOp *requestOp // tracks last send operation + reqInitLock = c.reqInit // nil while the send lock is held + conn = c.newClientConn(codec) + reading = true + ) + defer func() { + close(c.closing) + if reading { + conn.close(ErrClientQuit, nil) + c.drainRead() + } + close(c.didClose) + }() + + // Spawn the initial read loop. + go c.read(codec) + + for { + select { + case <-c.close: + return + + // Read path: + case op := <-c.readOp: + if op.batch { + conn.handler.handleBatch(op.msgs) + } else { + conn.handler.handleMsg(op.msgs[0]) + } + + case err := <-c.readErr: + conn.handler.log.Debug("RPC connection read error", "err", err) + conn.close(err, lastOp) + reading = false + + // Reconnect: + case newcodec := <-c.reconnected: + log.Debug("RPC client reconnected", "reading", reading, "conn", newcodec.RemoteAddr()) + if reading { + // Wait for the previous read loop to exit. This is a rare case which + // happens if this loop isn't notified in time after the connection breaks. + // In those cases the caller will notice first and reconnect. Closing the + // handler terminates all waiting requests (closing op.resp) except for + // lastOp, which will be transferred to the new handler. + conn.close(errClientReconnected, lastOp) + c.drainRead() + } + go c.read(newcodec) + reading = true + conn = c.newClientConn(newcodec) + // Re-register the in-flight request on the new handler + // because that's where it will be sent. + conn.handler.addRequestOp(lastOp) + + // Send path: + case op := <-reqInitLock: + // Stop listening for further requests until the current one has been sent. + reqInitLock = nil + lastOp = op + conn.handler.addRequestOp(op) + + case err := <-c.reqSent: + if err != nil { + // Remove response handlers for the last send. When the read loop + // goes down, it will signal all other current operations. + conn.handler.removeRequestOp(lastOp) + } + // Let the next request in. + reqInitLock = c.reqInit + lastOp = nil + + case op := <-c.reqTimeout: + conn.handler.removeRequestOp(op) + } + } +} + +// drainRead drops read messages until an error occurs. +func (c *Client) drainRead() { + for { + select { + case <-c.readOp: + case <-c.readErr: + return + } + } +} + +// read decodes RPC messages from a codec, feeding them into dispatch. +func (c *Client) read(codec ServerCodec) { + for { + msgs, batch, err := codec.Read() + if _, ok := err.(*json.SyntaxError); ok { + codec.Write(context.Background(), errorMessage(&parseError{err.Error()})) + } + if err != nil { + c.readErr <- err + return + } + c.readOp <- readOp{msgs, batch} + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/signer/core/api.go b/vendor/github.com/ethereum/go-ethereum/signer/core/api.go index 251ee55d..d68919c6 100644 --- a/vendor/github.com/ethereum/go-ethereum/signer/core/api.go +++ b/vendor/github.com/ethereum/go-ethereum/signer/core/api.go @@ -24,7 +24,6 @@ import ( "math/big" "os" "reflect" - "strings" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -44,7 +43,7 @@ const ( // ExternalAPIVersion -- see extapi_changelog.md ExternalAPIVersion = "6.0.0" // InternalAPIVersion -- see intapi_changelog.md - InternalAPIVersion = "6.0.0" + InternalAPIVersion = "7.0.0" ) // ExternalAPI defines the external API through which signing requests are made. @@ -234,7 +233,7 @@ type ( ContentType string `json:"content_type"` Address common.MixedcaseAddress `json:"address"` Rawdata []byte `json:"raw_data"` - Message []*NameValueType `json:"message"` + Messages []*NameValueType `json:"messages"` Hash hexutil.Bytes `json:"hash"` Meta Metadata `json:"meta"` } @@ -477,22 +476,24 @@ func logDiff(original *SignTxRequest, new *SignTxResponse) bool { return modified } -func (api *SignerAPI) lookupPassword(address common.Address) string { - return api.credentials.Get(strings.ToLower(address.String())) +func (api *SignerAPI) lookupPassword(address common.Address) (string, error) { + return api.credentials.Get(address.Hex()) } + func (api *SignerAPI) lookupOrQueryPassword(address common.Address, title, prompt string) (string, error) { - if pw := api.lookupPassword(address); pw != "" { + // Look up the password and return if available + if pw, err := api.lookupPassword(address); err == nil { return pw, nil - } else { - pwResp, err := api.UI.OnInputRequired(UserInputRequest{title, prompt, true}) - if err != nil { - log.Warn("error obtaining password", "error", err) - // We'll not forward the error here, in case the error contains info about the response from the UI, - // which could leak the password if it was malformed json or something - return "", errors.New("internal error") - } - return pwResp.Text, nil } + // Password unavailable, request it from the user + pwResp, err := api.UI.OnInputRequired(UserInputRequest{title, prompt, true}) + if err != nil { + log.Warn("error obtaining password", "error", err) + // We'll not forward the error here, in case the error contains info about the response from the UI, + // which could leak the password if it was malformed json or something + return "", errors.New("internal error") + } + return pwResp.Text, nil } // SignTransaction signs the given Transaction and returns it both as json and rlp-encoded form diff --git a/vendor/github.com/ethereum/go-ethereum/signer/core/cliui.go b/vendor/github.com/ethereum/go-ethereum/signer/core/cliui.go new file mode 100644 index 00000000..381c40be --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/signer/core/cliui.go @@ -0,0 +1,250 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package core + +import ( + "bufio" + "encoding/json" + "fmt" + "os" + "strings" + "sync" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "golang.org/x/crypto/ssh/terminal" +) + +type CommandlineUI struct { + in *bufio.Reader + mu sync.Mutex +} + +func NewCommandlineUI() *CommandlineUI { + return &CommandlineUI{in: bufio.NewReader(os.Stdin)} +} + +func (ui *CommandlineUI) RegisterUIServer(api *UIServerAPI) { + // noop +} + +// readString reads a single line from stdin, trimming if from spaces, enforcing +// non-emptyness. +func (ui *CommandlineUI) readString() string { + for { + fmt.Printf("> ") + text, err := ui.in.ReadString('\n') + if err != nil { + log.Crit("Failed to read user input", "err", err) + } + if text = strings.TrimSpace(text); text != "" { + return text + } + } +} + +// readPassword reads a single line from stdin, trimming it from the trailing new +// line and returns it. The input will not be echoed. +func (ui *CommandlineUI) readPassword() string { + fmt.Printf("Enter password to approve:\n") + fmt.Printf("> ") + + text, err := terminal.ReadPassword(int(os.Stdin.Fd())) + if err != nil { + log.Crit("Failed to read password", "err", err) + } + fmt.Println() + fmt.Println("-----------------------") + return string(text) +} + +// readPassword reads a single line from stdin, trimming it from the trailing new +// line and returns it. The input will not be echoed. +func (ui *CommandlineUI) readPasswordText(inputstring string) string { + fmt.Printf("Enter %s:\n", inputstring) + fmt.Printf("> ") + text, err := terminal.ReadPassword(int(os.Stdin.Fd())) + if err != nil { + log.Crit("Failed to read password", "err", err) + } + fmt.Println("-----------------------") + return string(text) +} + +func (ui *CommandlineUI) OnInputRequired(info UserInputRequest) (UserInputResponse, error) { + + fmt.Printf("## %s\n\n%s\n", info.Title, info.Prompt) + if info.IsPassword { + fmt.Printf("> ") + text, err := terminal.ReadPassword(int(os.Stdin.Fd())) + if err != nil { + log.Error("Failed to read password", "err", err) + } + fmt.Println("-----------------------") + return UserInputResponse{string(text)}, err + } + text := ui.readString() + fmt.Println("-----------------------") + return UserInputResponse{text}, nil +} + +// confirm returns true if user enters 'Yes', otherwise false +func (ui *CommandlineUI) confirm() bool { + fmt.Printf("Approve? [y/N]:\n") + if ui.readString() == "y" { + return true + } + fmt.Println("-----------------------") + return false +} + +func showMetadata(metadata Metadata) { + fmt.Printf("Request context:\n\t%v -> %v -> %v\n", metadata.Remote, metadata.Scheme, metadata.Local) + fmt.Printf("\nAdditional HTTP header data, provided by the external caller:\n") + fmt.Printf("\tUser-Agent: %v\n\tOrigin: %v\n", metadata.UserAgent, metadata.Origin) +} + +// ApproveTx prompt the user for confirmation to request to sign Transaction +func (ui *CommandlineUI) ApproveTx(request *SignTxRequest) (SignTxResponse, error) { + ui.mu.Lock() + defer ui.mu.Unlock() + weival := request.Transaction.Value.ToInt() + fmt.Printf("--------- Transaction request-------------\n") + if to := request.Transaction.To; to != nil { + fmt.Printf("to: %v\n", to.Original()) + if !to.ValidChecksum() { + fmt.Printf("\nWARNING: Invalid checksum on to-address!\n\n") + } + } else { + fmt.Printf("to: \n") + } + fmt.Printf("from: %v\n", request.Transaction.From.String()) + fmt.Printf("value: %v wei\n", weival) + fmt.Printf("gas: %v (%v)\n", request.Transaction.Gas, uint64(request.Transaction.Gas)) + fmt.Printf("gasprice: %v wei\n", request.Transaction.GasPrice.ToInt()) + fmt.Printf("nonce: %v (%v)\n", request.Transaction.Nonce, uint64(request.Transaction.Nonce)) + if request.Transaction.Data != nil { + d := *request.Transaction.Data + if len(d) > 0 { + + fmt.Printf("data: %v\n", hexutil.Encode(d)) + } + } + if request.Callinfo != nil { + fmt.Printf("\nTransaction validation:\n") + for _, m := range request.Callinfo { + fmt.Printf(" * %s : %s\n", m.Typ, m.Message) + } + fmt.Println() + + } + fmt.Printf("\n") + showMetadata(request.Meta) + fmt.Printf("-------------------------------------------\n") + if !ui.confirm() { + return SignTxResponse{request.Transaction, false}, nil + } + return SignTxResponse{request.Transaction, true}, nil +} + +// ApproveSignData prompt the user for confirmation to request to sign data +func (ui *CommandlineUI) ApproveSignData(request *SignDataRequest) (SignDataResponse, error) { + ui.mu.Lock() + defer ui.mu.Unlock() + + fmt.Printf("-------- Sign data request--------------\n") + fmt.Printf("Account: %s\n", request.Address.String()) + fmt.Printf("messages:\n") + for _, nvt := range request.Messages { + fmt.Printf("\u00a0\u00a0%v\n", strings.TrimSpace(nvt.Pprint(1))) + } + fmt.Printf("raw data: \n%q\n", request.Rawdata) + fmt.Printf("data hash: %v\n", request.Hash) + fmt.Printf("-------------------------------------------\n") + showMetadata(request.Meta) + if !ui.confirm() { + return SignDataResponse{false}, nil + } + return SignDataResponse{true}, nil +} + +// ApproveListing prompt the user for confirmation to list accounts +// the list of accounts to list can be modified by the UI +func (ui *CommandlineUI) ApproveListing(request *ListRequest) (ListResponse, error) { + ui.mu.Lock() + defer ui.mu.Unlock() + + fmt.Printf("-------- List Account request--------------\n") + fmt.Printf("A request has been made to list all accounts. \n") + fmt.Printf("You can select which accounts the caller can see\n") + for _, account := range request.Accounts { + fmt.Printf(" [x] %v\n", account.Address.Hex()) + fmt.Printf(" URL: %v\n", account.URL) + } + fmt.Printf("-------------------------------------------\n") + showMetadata(request.Meta) + if !ui.confirm() { + return ListResponse{nil}, nil + } + return ListResponse{request.Accounts}, nil +} + +// ApproveNewAccount prompt the user for confirmation to create new Account, and reveal to caller +func (ui *CommandlineUI) ApproveNewAccount(request *NewAccountRequest) (NewAccountResponse, error) { + + ui.mu.Lock() + defer ui.mu.Unlock() + + fmt.Printf("-------- New Account request--------------\n\n") + fmt.Printf("A request has been made to create a new account. \n") + fmt.Printf("Approving this operation means that a new account is created,\n") + fmt.Printf("and the address is returned to the external caller\n\n") + showMetadata(request.Meta) + if !ui.confirm() { + return NewAccountResponse{false}, nil + } + return NewAccountResponse{true}, nil +} + +// ShowError displays error message to user +func (ui *CommandlineUI) ShowError(message string) { + fmt.Printf("## Error \n%s\n", message) + fmt.Printf("-------------------------------------------\n") +} + +// ShowInfo displays info message to user +func (ui *CommandlineUI) ShowInfo(message string) { + fmt.Printf("## Info \n%s\n", message) +} + +func (ui *CommandlineUI) OnApprovedTx(tx ethapi.SignTransactionResult) { + fmt.Printf("Transaction signed:\n ") + if jsn, err := json.MarshalIndent(tx.Tx, " ", " "); err != nil { + fmt.Printf("WARN: marshalling error %v\n", err) + } else { + fmt.Println(string(jsn)) + } +} + +func (ui *CommandlineUI) OnSignerStartup(info StartupInfo) { + + fmt.Printf("------- Signer info -------\n") + for k, v := range info.Info { + fmt.Printf("* %v : %v\n", k, v) + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/signer/core/signed_data.go b/vendor/github.com/ethereum/go-ethereum/signer/core/signed_data.go index 27eca918..91e6cc7d 100644 --- a/vendor/github.com/ethereum/go-ethereum/signer/core/signed_data.go +++ b/vendor/github.com/ethereum/go-ethereum/signer/core/signed_data.go @@ -123,11 +123,10 @@ type TypedDataDomain struct { var typedDataReferenceTypeRegexp = regexp.MustCompile(`^[A-Z](\w*)(\[\])?$`) // sign receives a request and produces a signature - +// // Note, the produced signature conforms to the secp256k1 curve R, S and V values, // where the V value will be 27 or 28 for legacy reasons, if legacyV==true. func (api *SignerAPI) sign(addr common.MixedcaseAddress, req *SignDataRequest, legacyV bool) (hexutil.Bytes, error) { - // We make the request prior to looking up if we actually have the account, to prevent // account-enumeration via the API res, err := api.UI.ApproveSignData(req) @@ -169,7 +168,6 @@ func (api *SignerAPI) SignData(ctx context.Context, contentType string, addr com if err != nil { return nil, err } - signature, err := api.sign(addr, req, transformV) if err != nil { api.UI.ShowError(err.Error()) @@ -202,7 +200,7 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType return nil, useEthereumV, err } sighash, msg := SignTextValidator(validatorData) - message := []*NameValueType{ + messages := []*NameValueType{ { Name: "This is a request to sign data intended for a particular validator (see EIP 191 version 0)", Typ: "description", @@ -224,7 +222,7 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType Value: fmt.Sprintf("0x%x", msg), }, } - req = &SignDataRequest{ContentType: mediaType, Rawdata: []byte(msg), Message: message, Hash: sighash} + req = &SignDataRequest{ContentType: mediaType, Rawdata: []byte(msg), Messages: messages, Hash: sighash} case ApplicationClique.Mime: // Clique is the Ethereum PoA standard stringData, ok := data.(string) @@ -251,7 +249,7 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType if err != nil { return nil, useEthereumV, err } - message := []*NameValueType{ + messages := []*NameValueType{ { Name: "Clique header", Typ: "clique", @@ -260,7 +258,7 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType } // Clique uses V on the form 0 or 1 useEthereumV = false - req = &SignDataRequest{ContentType: mediaType, Rawdata: cliqueRlp, Message: message, Hash: sighash} + req = &SignDataRequest{ContentType: mediaType, Rawdata: cliqueRlp, Messages: messages, Hash: sighash} default: // also case TextPlain.Mime: // Calculates an Ethereum ECDSA signature for: // hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}") @@ -272,21 +270,20 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType return nil, useEthereumV, err } else { sighash, msg := accounts.TextAndHash(textData) - message := []*NameValueType{ + messages := []*NameValueType{ { Name: "message", Typ: accounts.MimetypeTextPlain, Value: msg, }, } - req = &SignDataRequest{ContentType: mediaType, Rawdata: []byte(msg), Message: message, Hash: sighash} + req = &SignDataRequest{ContentType: mediaType, Rawdata: []byte(msg), Messages: messages, Hash: sighash} } } } req.Address = addr req.Meta = MetadataFromContext(ctx) return req, useEthereumV, nil - } // SignTextWithValidator signs the given message which can be further recovered @@ -327,11 +324,11 @@ func (api *SignerAPI) SignTypedData(ctx context.Context, addr common.MixedcaseAd } rawData := []byte(fmt.Sprintf("\x19\x01%s%s", string(domainSeparator), string(typedDataHash))) sighash := crypto.Keccak256(rawData) - message, err := typedData.Format() + messages, err := typedData.Format() if err != nil { return nil, err } - req := &SignDataRequest{ContentType: DataTyped.Mime, Rawdata: rawData, Message: message, Hash: sighash} + req := &SignDataRequest{ContentType: DataTyped.Mime, Rawdata: rawData, Messages: messages, Hash: sighash} signature, err := api.sign(addr, req, true) if err != nil { api.UI.ShowError(err.Error()) diff --git a/vendor/github.com/ethereum/go-ethereum/signer/fourbyte/validation.go b/vendor/github.com/ethereum/go-ethereum/signer/fourbyte/validation.go index 6b8168cc..0997c636 100644 --- a/vendor/github.com/ethereum/go-ethereum/signer/fourbyte/validation.go +++ b/vendor/github.com/ethereum/go-ethereum/signer/fourbyte/validation.go @@ -58,7 +58,7 @@ func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) ( // No value submitted at least, critically Warn, but don't blow up messages.Crit("Transaction will create contract with empty code") } else if len(data) < 40 { // arbitrary heuristic limit - messages.Warn(fmt.Sprintf("Transaction will will create contract, but payload is suspiciously small (%d bytes)", len(data))) + messages.Warn(fmt.Sprintf("Transaction will create contract, but payload is suspiciously small (%d bytes)", len(data))) } // Method selector should be nil for contract creation if selector != nil { diff --git a/vendor/github.com/ethereum/go-ethereum/signer/rules/rules.go b/vendor/github.com/ethereum/go-ethereum/signer/rules/rules.go new file mode 100644 index 00000000..f731dac4 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/signer/rules/rules.go @@ -0,0 +1,245 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package rules + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/signer/core" + "github.com/ethereum/go-ethereum/signer/rules/deps" + "github.com/ethereum/go-ethereum/signer/storage" + "github.com/robertkrimen/otto" +) + +var ( + BigNumber_JS = deps.MustAsset("bignumber.js") +) + +// consoleOutput is an override for the console.log and console.error methods to +// stream the output into the configured output stream instead of stdout. +func consoleOutput(call otto.FunctionCall) otto.Value { + output := []string{"JS:> "} + for _, argument := range call.ArgumentList { + output = append(output, fmt.Sprintf("%v", argument)) + } + fmt.Fprintln(os.Stderr, strings.Join(output, " ")) + return otto.Value{} +} + +// rulesetUI provides an implementation of UIClientAPI that evaluates a javascript +// file for each defined UI-method +type rulesetUI struct { + next core.UIClientAPI // The next handler, for manual processing + storage storage.Storage + jsRules string // The rules to use +} + +func NewRuleEvaluator(next core.UIClientAPI, jsbackend storage.Storage) (*rulesetUI, error) { + c := &rulesetUI{ + next: next, + storage: jsbackend, + jsRules: "", + } + + return c, nil +} +func (r *rulesetUI) RegisterUIServer(api *core.UIServerAPI) { + // TODO, make it possible to query from js +} + +func (r *rulesetUI) Init(javascriptRules string) error { + r.jsRules = javascriptRules + return nil +} +func (r *rulesetUI) execute(jsfunc string, jsarg interface{}) (otto.Value, error) { + + // Instantiate a fresh vm engine every time + vm := otto.New() + + // Set the native callbacks + consoleObj, _ := vm.Get("console") + consoleObj.Object().Set("log", consoleOutput) + consoleObj.Object().Set("error", consoleOutput) + + vm.Set("storage", struct{}{}) + storageObj, _ := vm.Get("storage") + storageObj.Object().Set("put", func(call otto.FunctionCall) otto.Value { + key, val := call.Argument(0).String(), call.Argument(1).String() + if val == "" { + r.storage.Del(key) + } else { + r.storage.Put(key, val) + } + return otto.NullValue() + }) + storageObj.Object().Set("get", func(call otto.FunctionCall) otto.Value { + goval, _ := r.storage.Get(call.Argument(0).String()) + jsval, _ := otto.ToValue(goval) + return jsval + }) + // Load bootstrap libraries + script, err := vm.Compile("bignumber.js", BigNumber_JS) + if err != nil { + log.Warn("Failed loading libraries", "err", err) + return otto.UndefinedValue(), err + } + vm.Run(script) + + // Run the actual rule implementation + _, err = vm.Run(r.jsRules) + if err != nil { + log.Warn("Execution failed", "err", err) + return otto.UndefinedValue(), err + } + + // And the actual call + // All calls are objects with the parameters being keys in that object. + // To provide additional insulation between js and go, we serialize it into JSON on the Go-side, + // and deserialize it on the JS side. + + jsonbytes, err := json.Marshal(jsarg) + if err != nil { + log.Warn("failed marshalling data", "data", jsarg) + return otto.UndefinedValue(), err + } + // Now, we call foobar(JSON.parse()). + var call string + if len(jsonbytes) > 0 { + call = fmt.Sprintf("%v(JSON.parse(%v))", jsfunc, string(jsonbytes)) + } else { + call = fmt.Sprintf("%v()", jsfunc) + } + return vm.Run(call) +} + +func (r *rulesetUI) checkApproval(jsfunc string, jsarg []byte, err error) (bool, error) { + if err != nil { + return false, err + } + v, err := r.execute(jsfunc, string(jsarg)) + if err != nil { + log.Info("error occurred during execution", "error", err) + return false, err + } + result, err := v.ToString() + if err != nil { + log.Info("error occurred during response unmarshalling", "error", err) + return false, err + } + if result == "Approve" { + log.Info("Op approved") + return true, nil + } else if result == "Reject" { + log.Info("Op rejected") + return false, nil + } + return false, fmt.Errorf("Unknown response") +} + +func (r *rulesetUI) ApproveTx(request *core.SignTxRequest) (core.SignTxResponse, error) { + jsonreq, err := json.Marshal(request) + approved, err := r.checkApproval("ApproveTx", jsonreq, err) + if err != nil { + log.Info("Rule-based approval error, going to manual", "error", err) + return r.next.ApproveTx(request) + } + + if approved { + return core.SignTxResponse{ + Transaction: request.Transaction, + Approved: true}, + nil + } + return core.SignTxResponse{Approved: false}, err +} + +func (r *rulesetUI) ApproveSignData(request *core.SignDataRequest) (core.SignDataResponse, error) { + jsonreq, err := json.Marshal(request) + approved, err := r.checkApproval("ApproveSignData", jsonreq, err) + if err != nil { + log.Info("Rule-based approval error, going to manual", "error", err) + return r.next.ApproveSignData(request) + } + if approved { + return core.SignDataResponse{Approved: true}, nil + } + return core.SignDataResponse{Approved: false}, err +} + +// OnInputRequired not handled by rules +func (r *rulesetUI) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) { + return r.next.OnInputRequired(info) +} + +func (r *rulesetUI) ApproveListing(request *core.ListRequest) (core.ListResponse, error) { + jsonreq, err := json.Marshal(request) + approved, err := r.checkApproval("ApproveListing", jsonreq, err) + if err != nil { + log.Info("Rule-based approval error, going to manual", "error", err) + return r.next.ApproveListing(request) + } + if approved { + return core.ListResponse{Accounts: request.Accounts}, nil + } + return core.ListResponse{}, err +} + +func (r *rulesetUI) ApproveNewAccount(request *core.NewAccountRequest) (core.NewAccountResponse, error) { + // This cannot be handled by rules, requires setting a password + // dispatch to next + return r.next.ApproveNewAccount(request) +} + +func (r *rulesetUI) ShowError(message string) { + log.Error(message) + r.next.ShowError(message) +} + +func (r *rulesetUI) ShowInfo(message string) { + log.Info(message) + r.next.ShowInfo(message) +} + +func (r *rulesetUI) OnSignerStartup(info core.StartupInfo) { + jsonInfo, err := json.Marshal(info) + if err != nil { + log.Warn("failed marshalling data", "data", info) + return + } + r.next.OnSignerStartup(info) + _, err = r.execute("OnSignerStartup", string(jsonInfo)) + if err != nil { + log.Info("error occurred during execution", "error", err) + } +} + +func (r *rulesetUI) OnApprovedTx(tx ethapi.SignTransactionResult) { + jsonTx, err := json.Marshal(tx) + if err != nil { + log.Warn("failed marshalling transaction", "tx", tx) + return + } + _, err = r.execute("OnApprovedTx", string(jsonTx)) + if err != nil { + log.Info("error occurred during execution", "error", err) + } +} diff --git a/vendor/github.com/ethereum/go-ethereum/signer/storage/aes_gcm_storage.go b/vendor/github.com/ethereum/go-ethereum/signer/storage/aes_gcm_storage.go new file mode 100644 index 00000000..e6a8f145 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/signer/storage/aes_gcm_storage.go @@ -0,0 +1,180 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . +// + +package storage + +import ( + "crypto/aes" + "crypto/cipher" + "crypto/rand" + "encoding/json" + "io" + "io/ioutil" + "os" + + "github.com/ethereum/go-ethereum/log" +) + +type storedCredential struct { + // The iv + Iv []byte `json:"iv"` + // The ciphertext + CipherText []byte `json:"c"` +} + +// AESEncryptedStorage is a storage type which is backed by a json-file. The json-file contains +// key-value mappings, where the keys are _not_ encrypted, only the values are. +type AESEncryptedStorage struct { + // File to read/write credentials + filename string + // Key stored in base64 + key []byte +} + +// NewAESEncryptedStorage creates a new encrypted storage backed by the given file/key +func NewAESEncryptedStorage(filename string, key []byte) *AESEncryptedStorage { + return &AESEncryptedStorage{ + filename: filename, + key: key, + } +} + +// Put stores a value by key. 0-length keys results in noop. +func (s *AESEncryptedStorage) Put(key, value string) { + if len(key) == 0 { + return + } + data, err := s.readEncryptedStorage() + if err != nil { + log.Warn("Failed to read encrypted storage", "err", err, "file", s.filename) + return + } + ciphertext, iv, err := encrypt(s.key, []byte(value), []byte(key)) + if err != nil { + log.Warn("Failed to encrypt entry", "err", err) + return + } + encrypted := storedCredential{Iv: iv, CipherText: ciphertext} + data[key] = encrypted + if err = s.writeEncryptedStorage(data); err != nil { + log.Warn("Failed to write entry", "err", err) + } +} + +// Get returns the previously stored value, or an error if it does not exist or +// key is of 0-length. +func (s *AESEncryptedStorage) Get(key string) (string, error) { + if len(key) == 0 { + return "", ErrZeroKey + } + data, err := s.readEncryptedStorage() + if err != nil { + log.Warn("Failed to read encrypted storage", "err", err, "file", s.filename) + return "", err + } + encrypted, exist := data[key] + if !exist { + log.Warn("Key does not exist", "key", key) + return "", ErrNotFound + } + entry, err := decrypt(s.key, encrypted.Iv, encrypted.CipherText, []byte(key)) + if err != nil { + log.Warn("Failed to decrypt key", "key", key) + return "", err + } + return string(entry), nil +} + +// Del removes a key-value pair. If the key doesn't exist, the method is a noop. +func (s *AESEncryptedStorage) Del(key string) { + data, err := s.readEncryptedStorage() + if err != nil { + log.Warn("Failed to read encrypted storage", "err", err, "file", s.filename) + return + } + delete(data, key) + if err = s.writeEncryptedStorage(data); err != nil { + log.Warn("Failed to write entry", "err", err) + } +} + +// readEncryptedStorage reads the file with encrypted creds +func (s *AESEncryptedStorage) readEncryptedStorage() (map[string]storedCredential, error) { + creds := make(map[string]storedCredential) + raw, err := ioutil.ReadFile(s.filename) + + if err != nil { + if os.IsNotExist(err) { + // Doesn't exist yet + return creds, nil + } + log.Warn("Failed to read encrypted storage", "err", err, "file", s.filename) + } + if err = json.Unmarshal(raw, &creds); err != nil { + log.Warn("Failed to unmarshal encrypted storage", "err", err, "file", s.filename) + return nil, err + } + return creds, nil +} + +// writeEncryptedStorage write the file with encrypted creds +func (s *AESEncryptedStorage) writeEncryptedStorage(creds map[string]storedCredential) error { + raw, err := json.Marshal(creds) + if err != nil { + return err + } + if err = ioutil.WriteFile(s.filename, raw, 0600); err != nil { + return err + } + return nil +} + +// encrypt encrypts plaintext with the given key, with additional data +// The 'additionalData' is used to place the (plaintext) KV-store key into the V, +// to prevent the possibility to alter a K, or swap two entries in the KV store with eachother. +func encrypt(key []byte, plaintext []byte, additionalData []byte) ([]byte, []byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, nil, err + } + aesgcm, err := cipher.NewGCM(block) + nonce := make([]byte, aesgcm.NonceSize()) + if _, err := io.ReadFull(rand.Reader, nonce); err != nil { + return nil, nil, err + } + if err != nil { + return nil, nil, err + } + ciphertext := aesgcm.Seal(nil, nonce, plaintext, additionalData) + return ciphertext, nonce, nil +} + +func decrypt(key []byte, nonce []byte, ciphertext []byte, additionalData []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + aesgcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + plaintext, err := aesgcm.Open(nil, nonce, ciphertext, additionalData) + if err != nil { + return nil, err + } + return plaintext, nil +} diff --git a/vendor/github.com/ethereum/go-ethereum/signer/storage/storage.go b/vendor/github.com/ethereum/go-ethereum/signer/storage/storage.go new file mode 100644 index 00000000..c1f593d9 --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/signer/storage/storage.go @@ -0,0 +1,88 @@ +// Copyright 2018 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . +// + +package storage + +import "errors" + +var ( + // ErrZeroKey is returned if an attempt was made to inset a 0-length key. + ErrZeroKey = errors.New("0-length key") + + // ErrNotFound is returned if an unknown key is attempted to be retrieved. + ErrNotFound = errors.New("not found") +) + +type Storage interface { + // Put stores a value by key. 0-length keys results in noop. + Put(key, value string) + + // Get returns the previously stored value, or an error if the key is 0-length + // or unknown. + Get(key string) (string, error) + + // Del removes a key-value pair. If the key doesn't exist, the method is a noop. + Del(key string) +} + +// EphemeralStorage is an in-memory storage that does +// not persist values to disk. Mainly used for testing +type EphemeralStorage struct { + data map[string]string + namespace string +} + +// Put stores a value by key. 0-length keys results in noop. +func (s *EphemeralStorage) Put(key, value string) { + if len(key) == 0 { + return + } + s.data[key] = value +} + +// Get returns the previously stored value, or an error if the key is 0-length +// or unknown. +func (s *EphemeralStorage) Get(key string) (string, error) { + if len(key) == 0 { + return "", ErrZeroKey + } + if v, ok := s.data[key]; ok { + return v, nil + } + return "", ErrNotFound +} + +// Del removes a key-value pair. If the key doesn't exist, the method is a noop. +func (s *EphemeralStorage) Del(key string) { + delete(s.data, key) +} + +func NewEphemeralStorage() Storage { + s := &EphemeralStorage{ + data: make(map[string]string), + } + return s +} + +// NoStorage is a dummy construct which doesn't remember anything you tell it +type NoStorage struct{} + +func (s *NoStorage) Put(key, value string) {} +func (s *NoStorage) Del(key string) {} +func (s *NoStorage) Get(key string) (string, error) { + return "", errors.New("I forgot") +} diff --git a/vendor/github.com/ethereum/go-ethereum/statediff/doc.go b/vendor/github.com/ethereum/go-ethereum/statediff/doc.go index c0cbb435..0e6d5f3e 100644 --- a/vendor/github.com/ethereum/go-ethereum/statediff/doc.go +++ b/vendor/github.com/ethereum/go-ethereum/statediff/doc.go @@ -20,13 +20,23 @@ This work is adapted from work by Charles Crain at https://github.com/jpmorganch Package statediff provides an auxiliary service that processes state diff objects from incoming chain events, relaying the objects to any rpc subscriptions. +The service is spun up using the below CLI flags +--statediff: boolean flag, turns on the service +--statediff.streamblock: boolean flag, configures the service to associate and stream out the rest of the block data with the state diffs. +--statediff.intermediatenodes: boolean flag, tells service to include intermediate (branch and extension) nodes; default (false) processes leaf nodes only. +--statediff.pathsandproofs: boolean flag, tells service to generate paths and proofs for the diffed storage and state trie leaf nodes. +--statediff.watchedaddresses: string slice flag, used to limit the state diffing process to the given addresses. Usage: --statediff.watchedaddresses=addr1 --statediff.watchedaddresses=addr2 --statediff.watchedaddresses=addr3 + +If you wish to use the websocket endpoint to subscribe to the statediff service, be sure to open up the Websocket RPC server with the `--ws` flag. + Rpc subscriptions to the service can be created using the rpc.Client.Subscribe() method, with the "statediff" namespace, a statediff.Payload channel, and the name of the statediff api's rpc method- "stream". e.g. +cli, _ := rpc.Dial("ipcPathOrWsURL") stateDiffPayloadChan := make(chan statediff.Payload, 20000) -rpcSub, err := Subscribe(context.Background(), "statediff", stateDiffPayloadChan, "stream"}) +rpcSub, err := cli.Subscribe(context.Background(), "statediff", stateDiffPayloadChan, "stream"}) for { select { case stateDiffPayload := <- stateDiffPayloadChan: @@ -35,6 +45,5 @@ for { log.Error(err) } } - */ package statediff diff --git a/vendor/github.com/ethereum/go-ethereum/statediff/service.go b/vendor/github.com/ethereum/go-ethereum/statediff/service.go index e978fcb8..be3dc6cf 100644 --- a/vendor/github.com/ethereum/go-ethereum/statediff/service.go +++ b/vendor/github.com/ethereum/go-ethereum/statediff/service.go @@ -40,6 +40,7 @@ type blockChain interface { SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription GetBlockByHash(hash common.Hash) *types.Block AddToStateDiffProcessedCollection(hash common.Hash) + GetReceiptsByHash(hash common.Hash) types.Receipts } // IService is the state-diffing service interface @@ -69,7 +70,7 @@ type Service struct { // Cache the last block so that we can avoid having to lookup the next block's parent lastBlock *types.Block // Whether or not the block data is streamed alongside the state diff data in the subscription payload - streamBlock bool + StreamBlock bool // Whether or not we have any subscribers; only if we do, do we processes state diffs subscribers int32 } @@ -82,7 +83,7 @@ func NewStateDiffService(db ethdb.Database, blockChain *core.BlockChain, config Builder: NewBuilder(db, blockChain, config), QuitChan: make(chan bool), Subscriptions: make(map[rpc.ID]Subscription), - streamBlock: config.StreamBlock, + StreamBlock: config.StreamBlock, }, nil } @@ -108,7 +109,6 @@ func (sds *Service) Loop(chainEventCh chan core.ChainEvent) { chainEventSub := sds.BlockChain.SubscribeChainEvent(chainEventCh) defer chainEventSub.Unsubscribe() errCh := chainEventSub.Err() - for { select { //Notify chain event channel of events @@ -161,12 +161,19 @@ func (sds *Service) processStateDiff(currentBlock, parentBlock *types.Block) err StateDiffRlp: stateDiffRlp, Err: err, } - if sds.streamBlock { - rlpBuff := new(bytes.Buffer) - if err = currentBlock.EncodeRLP(rlpBuff); err != nil { + if sds.StreamBlock { + blockBuff := new(bytes.Buffer) + if err = currentBlock.EncodeRLP(blockBuff); err != nil { return err } - payload.BlockRlp = rlpBuff.Bytes() + payload.BlockRlp = blockBuff.Bytes() + receiptBuff := new(bytes.Buffer) + receipts := sds.BlockChain.GetReceiptsByHash(currentBlock.Hash()) + if err = rlp.Encode(receiptBuff, receipts); err != nil { + println(err.Error()) + return err + } + payload.ReceiptsRlp = receiptBuff.Bytes() } // If we have any websocket subscriptions listening in, send the data to them diff --git a/vendor/github.com/ethereum/go-ethereum/statediff/testhelpers/mocks/blockchain.go b/vendor/github.com/ethereum/go-ethereum/statediff/testhelpers/mocks/blockchain.go index f2c097d3..50843523 100644 --- a/vendor/github.com/ethereum/go-ethereum/statediff/testhelpers/mocks/blockchain.go +++ b/vendor/github.com/ethereum/go-ethereum/statediff/testhelpers/mocks/blockchain.go @@ -30,16 +30,20 @@ import ( // BlockChain is a mock blockchain for testing type BlockChain struct { ParentHashesLookedUp []common.Hash - parentBlocksToReturn []*types.Block + parentBlocksToReturn map[common.Hash]*types.Block callCount int ChainEvents []core.ChainEvent + Receipts map[common.Hash]types.Receipts } // AddToStateDiffProcessedCollection mock method func (blockChain *BlockChain) AddToStateDiffProcessedCollection(hash common.Hash) {} // SetParentBlocksToReturn mock method -func (blockChain *BlockChain) SetParentBlocksToReturn(blocks []*types.Block) { +func (blockChain *BlockChain) SetParentBlocksToReturn(blocks map[common.Hash]*types.Block) { + if blockChain.parentBlocksToReturn == nil { + blockChain.parentBlocksToReturn = make(map[common.Hash]*types.Block) + } blockChain.parentBlocksToReturn = blocks } @@ -49,10 +53,9 @@ func (blockChain *BlockChain) GetBlockByHash(hash common.Hash) *types.Block { var parentBlock *types.Block if len(blockChain.parentBlocksToReturn) > 0 { - parentBlock = blockChain.parentBlocksToReturn[blockChain.callCount] + parentBlock = blockChain.parentBlocksToReturn[hash] } - blockChain.callCount++ return parentBlock } @@ -84,3 +87,16 @@ func (blockChain *BlockChain) SubscribeChainEvent(ch chan<- core.ChainEvent) eve return subscription } + +// SetReceiptsForHash mock method +func (blockChain *BlockChain) SetReceiptsForHash(hash common.Hash, receipts types.Receipts) { + if blockChain.Receipts == nil { + blockChain.Receipts = make(map[common.Hash]types.Receipts) + } + blockChain.Receipts[hash] = receipts +} + +// GetReceiptsByHash mock method +func (blockChain *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { + return blockChain.Receipts[hash] +} diff --git a/vendor/github.com/ethereum/go-ethereum/statediff/types.go b/vendor/github.com/ethereum/go-ethereum/statediff/types.go index 6df398a1..2db58d52 100644 --- a/vendor/github.com/ethereum/go-ethereum/statediff/types.go +++ b/vendor/github.com/ethereum/go-ethereum/statediff/types.go @@ -36,15 +36,16 @@ type Subscription struct { // Payload packages the data to send to StateDiffingService subscriptions type Payload struct { - BlockRlp []byte `json:"blockRlp" gencodec:"required"` + BlockRlp []byte `json:"blockRlp"` + ReceiptsRlp []byte `json:"receiptsRlp"` StateDiffRlp []byte `json:"stateDiff" gencodec:"required"` Err error `json:"error"` } // StateDiff is the final output structure from the builder type StateDiff struct { - BlockNumber *big.Int `json:"blockNumber" gencodec:"required"` - BlockHash common.Hash `json:"blockHash" gencodec:"required"` + BlockNumber *big.Int `json:"blockNumber" gencodec:"required"` + BlockHash common.Hash `json:"blockHash" gencodec:"required"` CreatedAccounts []AccountDiff `json:"createdAccounts" gencodec:"required"` DeletedAccounts []AccountDiff `json:"deletedAccounts" gencodec:"required"` UpdatedAccounts []AccountDiff `json:"updatedAccounts" gencodec:"required"` diff --git a/vendor/github.com/ethereum/go-ethereum/trie/sync_bloom.go b/vendor/github.com/ethereum/go-ethereum/trie/sync_bloom.go index 7b5b7488..2182d1c4 100644 --- a/vendor/github.com/ethereum/go-ethereum/trie/sync_bloom.go +++ b/vendor/github.com/ethereum/go-ethereum/trie/sync_bloom.go @@ -70,7 +70,7 @@ func NewSyncBloom(memory uint64, database ethdb.Iteratee) *SyncBloom { // Create the bloom filter to track known trie nodes bloom, err := bloomfilter.New(memory*1024*1024*8, 3) if err != nil { - panic(fmt.Sprintf("failed to create bloom: %v", err)) // Can't happen, here for sanity + panic(fmt.Sprintf("failed to create bloom: %v", err)) } log.Info("Allocated fast sync bloom", "size", common.StorageSize(memory*1024*1024)) diff --git a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv6/envelope.go b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv6/envelope.go new file mode 100644 index 00000000..5b6925ed --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv6/envelope.go @@ -0,0 +1,280 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Contains the Whisper protocol Envelope element. + +package whisperv6 + +import ( + "crypto/ecdsa" + "encoding/binary" + "fmt" + gmath "math" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/ecies" + "github.com/ethereum/go-ethereum/rlp" +) + +// Envelope represents a clear-text data packet to transmit through the Whisper +// network. Its contents may or may not be encrypted and signed. +type Envelope struct { + Expiry uint32 + TTL uint32 + Topic TopicType + Data []byte + Nonce uint64 + + pow float64 // Message-specific PoW as described in the Whisper specification. + + // the following variables should not be accessed directly, use the corresponding function instead: Hash(), Bloom() + hash common.Hash // Cached hash of the envelope to avoid rehashing every time. + bloom []byte +} + +// size returns the size of envelope as it is sent (i.e. public fields only) +func (e *Envelope) size() int { + return EnvelopeHeaderLength + len(e.Data) +} + +// rlpWithoutNonce returns the RLP encoded envelope contents, except the nonce. +func (e *Envelope) rlpWithoutNonce() []byte { + res, _ := rlp.EncodeToBytes([]interface{}{e.Expiry, e.TTL, e.Topic, e.Data}) + return res +} + +// NewEnvelope wraps a Whisper message with expiration and destination data +// included into an envelope for network forwarding. +func NewEnvelope(ttl uint32, topic TopicType, msg *sentMessage) *Envelope { + env := Envelope{ + Expiry: uint32(time.Now().Add(time.Second * time.Duration(ttl)).Unix()), + TTL: ttl, + Topic: topic, + Data: msg.Raw, + Nonce: 0, + } + + return &env +} + +// Seal closes the envelope by spending the requested amount of time as a proof +// of work on hashing the data. +func (e *Envelope) Seal(options *MessageParams) error { + if options.PoW == 0 { + // PoW is not required + return nil + } + + var target, bestLeadingZeros int + if options.PoW < 0 { + // target is not set - the function should run for a period + // of time specified in WorkTime param. Since we can predict + // the execution time, we can also adjust Expiry. + e.Expiry += options.WorkTime + } else { + target = e.powToFirstBit(options.PoW) + } + + rlp := e.rlpWithoutNonce() + buf := make([]byte, len(rlp)+8) + copy(buf, rlp) + asAnInt := new(big.Int) + + finish := time.Now().Add(time.Duration(options.WorkTime) * time.Second).UnixNano() + for nonce := uint64(0); time.Now().UnixNano() < finish; { + for i := 0; i < 1024; i++ { + binary.BigEndian.PutUint64(buf[len(rlp):], nonce) + h := crypto.Keccak256(buf) + asAnInt.SetBytes(h) + leadingZeros := 256 - asAnInt.BitLen() + if leadingZeros > bestLeadingZeros { + e.Nonce, bestLeadingZeros = nonce, leadingZeros + if target > 0 && bestLeadingZeros >= target { + return nil + } + } + nonce++ + } + } + + if target > 0 && bestLeadingZeros < target { + return fmt.Errorf("failed to reach the PoW target, specified pow time (%d seconds) was insufficient", options.WorkTime) + } + + return nil +} + +// PoW computes (if necessary) and returns the proof of work target +// of the envelope. +func (e *Envelope) PoW() float64 { + if e.pow == 0 { + e.calculatePoW(0) + } + return e.pow +} + +func (e *Envelope) calculatePoW(diff uint32) { + rlp := e.rlpWithoutNonce() + buf := make([]byte, len(rlp)+8) + copy(buf, rlp) + binary.BigEndian.PutUint64(buf[len(rlp):], e.Nonce) + powHash := new(big.Int).SetBytes(crypto.Keccak256(buf)) + leadingZeroes := 256 - powHash.BitLen() + x := gmath.Pow(2, float64(leadingZeroes)) + x /= float64(len(rlp)) + x /= float64(e.TTL + diff) + e.pow = x +} + +func (e *Envelope) powToFirstBit(pow float64) int { + x := pow + x *= float64(e.size()) + x *= float64(e.TTL) + bits := gmath.Log2(x) + bits = gmath.Ceil(bits) + res := int(bits) + if res < 1 { + res = 1 + } + return res +} + +// Hash returns the SHA3 hash of the envelope, calculating it if not yet done. +func (e *Envelope) Hash() common.Hash { + if (e.hash == common.Hash{}) { + encoded, _ := rlp.EncodeToBytes(e) + e.hash = crypto.Keccak256Hash(encoded) + } + return e.hash +} + +// DecodeRLP decodes an Envelope from an RLP data stream. +func (e *Envelope) DecodeRLP(s *rlp.Stream) error { + raw, err := s.Raw() + if err != nil { + return err + } + // The decoding of Envelope uses the struct fields but also needs + // to compute the hash of the whole RLP-encoded envelope. This + // type has the same structure as Envelope but is not an + // rlp.Decoder (does not implement DecodeRLP function). + // Only public members will be encoded. + type rlpenv Envelope + if err := rlp.DecodeBytes(raw, (*rlpenv)(e)); err != nil { + return err + } + e.hash = crypto.Keccak256Hash(raw) + return nil +} + +// OpenAsymmetric tries to decrypt an envelope, potentially encrypted with a particular key. +func (e *Envelope) OpenAsymmetric(key *ecdsa.PrivateKey) (*ReceivedMessage, error) { + message := &ReceivedMessage{Raw: e.Data} + err := message.decryptAsymmetric(key) + switch err { + case nil: + return message, nil + case ecies.ErrInvalidPublicKey: // addressed to somebody else + return nil, err + default: + return nil, fmt.Errorf("unable to open envelope, decrypt failed: %v", err) + } +} + +// OpenSymmetric tries to decrypt an envelope, potentially encrypted with a particular key. +func (e *Envelope) OpenSymmetric(key []byte) (msg *ReceivedMessage, err error) { + msg = &ReceivedMessage{Raw: e.Data} + err = msg.decryptSymmetric(key) + if err != nil { + msg = nil + } + return msg, err +} + +// Open tries to decrypt an envelope, and populates the message fields in case of success. +func (e *Envelope) Open(watcher *Filter) (msg *ReceivedMessage) { + if watcher == nil { + return nil + } + + // The API interface forbids filters doing both symmetric and asymmetric encryption. + if watcher.expectsAsymmetricEncryption() && watcher.expectsSymmetricEncryption() { + return nil + } + + if watcher.expectsAsymmetricEncryption() { + msg, _ = e.OpenAsymmetric(watcher.KeyAsym) + if msg != nil { + msg.Dst = &watcher.KeyAsym.PublicKey + } + } else if watcher.expectsSymmetricEncryption() { + msg, _ = e.OpenSymmetric(watcher.KeySym) + if msg != nil { + msg.SymKeyHash = crypto.Keccak256Hash(watcher.KeySym) + } + } + + if msg != nil { + ok := msg.ValidateAndParse() + if !ok { + return nil + } + msg.Topic = e.Topic + msg.PoW = e.PoW() + msg.TTL = e.TTL + msg.Sent = e.Expiry - e.TTL + msg.EnvelopeHash = e.Hash() + } + return msg +} + +// Bloom maps 4-bytes Topic into 64-byte bloom filter with 3 bits set (at most). +func (e *Envelope) Bloom() []byte { + if e.bloom == nil { + e.bloom = TopicToBloom(e.Topic) + } + return e.bloom +} + +// TopicToBloom converts the topic (4 bytes) to the bloom filter (64 bytes) +func TopicToBloom(topic TopicType) []byte { + b := make([]byte, BloomFilterSize) + var index [3]int + for j := 0; j < 3; j++ { + index[j] = int(topic[j]) + if (topic[3] & (1 << uint(j))) != 0 { + index[j] += 256 + } + } + + for j := 0; j < 3; j++ { + byteIndex := index[j] / 8 + bitIndex := index[j] % 8 + b[byteIndex] = (1 << uint(bitIndex)) + } + return b +} + +// GetEnvelope retrieves an envelope from the message queue by its hash. +// It returns nil if the envelope can not be found. +func (w *Whisper) GetEnvelope(hash common.Hash) *Envelope { + w.poolMu.RLock() + defer w.poolMu.RUnlock() + return w.envelopes[hash] +} diff --git a/vendor/github.com/facebookgo/atomicfile/.travis.yml b/vendor/github.com/facebookgo/atomicfile/.travis.yml deleted file mode 100644 index e3632ac5..00000000 --- a/vendor/github.com/facebookgo/atomicfile/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go - -go: - - 1.4 - -before_install: - - go get -v golang.org/x/tools/cmd/vet - - go get -v golang.org/x/tools/cmd/cover - - go get -v github.com/golang/lint/golint - -install: - - go install -race -v std - - go get -race -t -v ./... - - go install -race -v ./... - -script: - - go vet ./... - - $HOME/gopath/bin/golint . - - go test -cpu=2 -race -v ./... - - go test -cpu=2 -covermode=atomic ./... diff --git a/vendor/github.com/facebookgo/atomicfile/atomicfile.go b/vendor/github.com/facebookgo/atomicfile/atomicfile.go deleted file mode 100644 index 9294460d..00000000 --- a/vendor/github.com/facebookgo/atomicfile/atomicfile.go +++ /dev/null @@ -1,59 +0,0 @@ -// Package atomicfile provides the ability to write a file with an eventual -// rename on Close (using os.Rename). This allows for a file to always be in a -// consistent state and never represent an in-progress write. -// -// NOTE: `os.Rename` may not be atomic on your operating system. -package atomicfile - -import ( - "io/ioutil" - "os" - "path/filepath" -) - -// File behaves like os.File, but does an atomic rename operation at Close. -type File struct { - *os.File - path string -} - -// New creates a new temporary file that will replace the file at the given -// path when Closed. -func New(path string, mode os.FileMode) (*File, error) { - f, err := ioutil.TempFile(filepath.Dir(path), filepath.Base(path)) - if err != nil { - return nil, err - } - if err := os.Chmod(f.Name(), mode); err != nil { - f.Close() - os.Remove(f.Name()) - return nil, err - } - return &File{File: f, path: path}, nil -} - -// Close the file replacing the configured file. -func (f *File) Close() error { - if err := f.File.Close(); err != nil { - os.Remove(f.File.Name()) - return err - } - if err := os.Rename(f.Name(), f.path); err != nil { - return err - } - return nil -} - -// Abort closes the file and removes it instead of replacing the configured -// file. This is useful if after starting to write to the file you decide you -// don't want it anymore. -func (f *File) Abort() error { - if err := f.File.Close(); err != nil { - os.Remove(f.Name()) - return err - } - if err := os.Remove(f.Name()); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/facebookgo/atomicfile/license b/vendor/github.com/facebookgo/atomicfile/license deleted file mode 100644 index d8c91007..00000000 --- a/vendor/github.com/facebookgo/atomicfile/license +++ /dev/null @@ -1,30 +0,0 @@ -BSD License - -For atomicfile software - -Copyright (c) 2015, Facebook, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/facebookgo/atomicfile/patents b/vendor/github.com/facebookgo/atomicfile/patents deleted file mode 100644 index 50637e6f..00000000 --- a/vendor/github.com/facebookgo/atomicfile/patents +++ /dev/null @@ -1,33 +0,0 @@ -Additional Grant of Patent Rights Version 2 - -"Software" means the atomicfile software distributed by Facebook, Inc. - -Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software -("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable -(subject to the termination provision below) license under any Necessary -Claims, to make, have made, use, sell, offer to sell, import, and otherwise -transfer the Software. For avoidance of doubt, no license is granted under -Facebook’s rights in any patent claims that are infringed by (i) modifications -to the Software made by you or any third party or (ii) the Software in -combination with any software or other technology. - -The license granted hereunder will terminate, automatically and without notice, -if you (or any of your subsidiaries, corporate affiliates or agents) initiate -directly or indirectly, or take a direct financial interest in, any Patent -Assertion: (i) against Facebook or any of its subsidiaries or corporate -affiliates, (ii) against any party if such Patent Assertion arises in whole or -in part from any software, technology, product or service of Facebook or any of -its subsidiaries or corporate affiliates, or (iii) against any party relating -to the Software. Notwithstanding the foregoing, if Facebook or any of its -subsidiaries or corporate affiliates files a lawsuit alleging patent -infringement against you in the first instance, and you respond by filing a -patent infringement counterclaim in that lawsuit against that party that is -unrelated to the Software, the license granted hereunder will not terminate -under section (i) of this paragraph due to such counterclaim. - -A "Necessary Claim" is a claim of a patent owned by Facebook that is -necessarily infringed by the Software standing alone. - -A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, -or contributory infringement or inducement to infringe any patent, including a -cross-claim or counterclaim. diff --git a/vendor/github.com/facebookgo/atomicfile/readme.md b/vendor/github.com/facebookgo/atomicfile/readme.md deleted file mode 100644 index 24a2544d..00000000 --- a/vendor/github.com/facebookgo/atomicfile/readme.md +++ /dev/null @@ -1,9 +0,0 @@ -atomicfile [![Build Status](https://secure.travis-ci.org/facebookgo/atomicfile.png)](https://travis-ci.org/facebookgo/atomicfile) -========== - -Documentation: https://godoc.org/github.com/facebookgo/atomicfile - -NOTE: This package uses `os.Rename`, which may or may not be atomic on your -operating system. It is known to not be atomic on Windows. -https://github.com/natefinch/atomic provides a similar library that is atomic -on Windows as well and may be worth investigating. diff --git a/vendor/github.com/fjl/memsize/.travis.yml b/vendor/github.com/fjl/memsize/.travis.yml index bc51dc01..2d7d4fa6 100644 --- a/vendor/github.com/fjl/memsize/.travis.yml +++ b/vendor/github.com/fjl/memsize/.travis.yml @@ -1,5 +1,8 @@ language: go -go: "1.10.x" +go: + - "1.10.x" + - "1.11.x" + - "1.12.x" env: - GOARCH=i386 - GOARCH=amd64 diff --git a/vendor/github.com/fjl/memsize/mapiter_go12.go b/vendor/github.com/fjl/memsize/mapiter_go12.go new file mode 100644 index 00000000..fcdb0c34 --- /dev/null +++ b/vendor/github.com/fjl/memsize/mapiter_go12.go @@ -0,0 +1,12 @@ +// +build go1.12 + +package memsize + +import "reflect" + +func iterateMap(m reflect.Value, fn func(k, v reflect.Value)) { + it := m.MapRange() + for it.Next() { + fn(it.Key(), it.Value()) + } +} diff --git a/vendor/github.com/fjl/memsize/mapiter_old.go b/vendor/github.com/fjl/memsize/mapiter_old.go new file mode 100644 index 00000000..49995896 --- /dev/null +++ b/vendor/github.com/fjl/memsize/mapiter_old.go @@ -0,0 +1,11 @@ +// +build !go1.12 + +package memsize + +import "reflect" + +func iterateMap(m reflect.Value, fn func(k, v reflect.Value)) { + for _, k := range m.MapKeys() { + fn(k, m.MapIndex(k)) + } +} diff --git a/vendor/github.com/fjl/memsize/memsize.go b/vendor/github.com/fjl/memsize/memsize.go index fcbff1f8..107b79b2 100644 --- a/vendor/github.com/fjl/memsize/memsize.go +++ b/vendor/github.com/fjl/memsize/memsize.go @@ -223,10 +223,10 @@ func (c *context) scanMap(v reflect.Value) uintptr { extra = uintptr(0) ) if c.tc.needScan(typ.Key()) || c.tc.needScan(typ.Elem()) { - for _, k := range v.MapKeys() { + iterateMap(v, func(k, v reflect.Value) { extra += c.scan(invalidAddr, k, false) - extra += c.scan(invalidAddr, v.MapIndex(k), false) - } + extra += c.scan(invalidAddr, v, false) + }) } else { extra = len*typ.Key().Size() + len*typ.Elem().Size() } diff --git a/vendor/github.com/gogo/protobuf/AUTHORS b/vendor/github.com/gogo/protobuf/AUTHORS deleted file mode 100644 index 3d97fc7a..00000000 --- a/vendor/github.com/gogo/protobuf/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of GoGo authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS file, which -# lists people. For example, employees are listed in CONTRIBUTORS, -# but not in AUTHORS, because the employer holds the copyright. - -# Names should be added to this file as one of -# Organization's name -# Individual's name -# Individual's name - -# Please keep the list sorted. - -Sendgrid, Inc -Vastech SA (PTY) LTD -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS deleted file mode 100644 index 1b4f6c20..00000000 --- a/vendor/github.com/gogo/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,23 +0,0 @@ -Anton Povarov -Brian Goff -Clayton Coleman -Denis Smirnov -DongYun Kang -Dwayne Schultz -Georg Apitz -Gustav Paul -Johan Brandhorst -John Shahid -John Tuley -Laurent -Patrick Lee -Peter Edge -Roger Johansson -Sam Nguyen -Sergio Arbeo -Stephen J Day -Tamir Duberstein -Todd Eisenberger -Tormod Erevik Lea -Vyacheslav Kim -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS b/vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS deleted file mode 100644 index b368efb7..00000000 --- a/vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS +++ /dev/null @@ -1,5 +0,0 @@ -The contributors to the Go protobuf repository: - -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. \ No newline at end of file diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE deleted file mode 100644 index f57de90d..00000000 --- a/vendor/github.com/gogo/protobuf/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -Copyright (c) 2013, The GoGo Authors. All rights reserved. - -Protocol Buffers for Go with Gadgets - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/gogo/protobuf/gogoproto/Makefile b/vendor/github.com/gogo/protobuf/gogoproto/Makefile deleted file mode 100644 index 0b4659b7..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers for Go with Gadgets -# -# Copyright (c) 2013, The GoGo Authors. All rights reserved. -# http://github.com/gogo/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:../../../../ --proto_path=../../../../:../protobuf/:. *.proto - -restore: - cp gogo.pb.golden gogo.pb.go - -preserve: - cp gogo.pb.go gogo.pb.golden diff --git a/vendor/github.com/gogo/protobuf/gogoproto/doc.go b/vendor/github.com/gogo/protobuf/gogoproto/doc.go deleted file mode 100644 index 081c86fa..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/doc.go +++ /dev/null @@ -1,169 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package gogoproto provides extensions for protocol buffers to achieve: - - - fast marshalling and unmarshalling. - - peace of mind by optionally generating test and benchmark code. - - more canonical Go structures. - - less typing by optionally generating extra helper code. - - goprotobuf compatibility - -More Canonical Go Structures - -A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. -You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. -Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. - - - nullable, if false, a field is generated without a pointer (see warning below). - - embed, if true, the field is generated as an embedded field. - - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 - - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. - - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. - - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - -Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -for a quicker overview. - -The following message: - - package test; - - import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -Will generate a go struct which looks a lot like this: - - type A struct { - Description string - Number int64 - Id github_com_gogo_protobuf_test_custom.Uuid - } - -You will see there are no pointers, since all fields are non-nullable. -You will also see a custom type which marshals to a string. -Be warned it is your responsibility to test your custom types thoroughly. -You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. - -Next we will embed the message A in message B. - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -See below that A is embedded in B. - - type B struct { - A - G []github_com_gogo_protobuf_test_custom.Uint128 - } - -Also see the repeated custom type. - - type Uint128 [2]uint64 - -Next we will create a custom name for one of our fields. - - message C { - optional int64 size = 1 [(gogoproto.customname) = "MySize"]; - } - -See below that the field's name is MySize and not Size. - - type C struct { - MySize *int64 - } - -The is useful when having a protocol buffer message with a field name which conflicts with a generated method. -As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. -Using customname you can fix this error without changing the field name. -This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. - -Gogoprotobuf also has some more subtle changes, these could be changed back: - - - the generated package name for imports do not have the extra /filename.pb, - but are actually the imports specified in the .proto file. - -Gogoprotobuf also has lost some features which should be brought back with time: - - - Marshalling and unmarshalling with reflect and without the unsafe package, - this requires work in pointer_reflect.go - -Why does nullable break protocol buffer specifications: - -The protocol buffer specification states, somewhere, that you should be able to tell whether a -field is set or unset. With the option nullable=false this feature is lost, -since your non-nullable fields will always be set. It can be seen as a layer on top of -protocol buffers, where before and after marshalling all non-nullable fields are set -and they cannot be unset. - -Goprotobuf Compatibility: - -Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. -Gogoprotobuf generates the same code as goprotobuf if no extensions are used. -The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: - - - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. - - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix - - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. - - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face - - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. - - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension - - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. - - goproto_registration (beta), if true, the generated files will register all messages and types against both gogo/protobuf and golang/protobuf. This is necessary when using third-party packages which read registrations from golang/protobuf (such as the grpc-gateway). - -Less Typing and Peace of Mind is explained in their specific plugin folders godoc: - - - github.com/gogo/protobuf/plugin/ - -If you do not use any of these extension the code that is generated -will be the same as if goprotobuf has generated it. - -The most complete way to see examples is to look at - - github.com/gogo/protobuf/test/thetest.proto - -Gogoprototest is a seperate project, -because we want to keep gogoprotobuf independent of goprotobuf, -but we still want to test it thoroughly. - -*/ -package gogoproto diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go deleted file mode 100644 index e352808b..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go +++ /dev/null @@ -1,874 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gogo.proto - -package gogoproto - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62001, - Name: "gogoproto.goproto_enum_prefix", - Tag: "varint,62001,opt,name=goproto_enum_prefix", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62021, - Name: "gogoproto.goproto_enum_stringer", - Tag: "varint,62021,opt,name=goproto_enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62022, - Name: "gogoproto.enum_stringer", - Tag: "varint,62022,opt,name=enum_stringer", - Filename: "gogo.proto", -} - -var E_EnumCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 62023, - Name: "gogoproto.enum_customname", - Tag: "bytes,62023,opt,name=enum_customname", - Filename: "gogo.proto", -} - -var E_Enumdecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62024, - Name: "gogoproto.enumdecl", - Tag: "varint,62024,opt,name=enumdecl", - Filename: "gogo.proto", -} - -var E_EnumvalueCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 66001, - Name: "gogoproto.enumvalue_customname", - Tag: "bytes,66001,opt,name=enumvalue_customname", - Filename: "gogo.proto", -} - -var E_GoprotoGettersAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63001, - Name: "gogoproto.goproto_getters_all", - Tag: "varint,63001,opt,name=goproto_getters_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63002, - Name: "gogoproto.goproto_enum_prefix_all", - Tag: "varint,63002,opt,name=goproto_enum_prefix_all", - Filename: "gogo.proto", -} - -var E_GoprotoStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63003, - Name: "gogoproto.goproto_stringer_all", - Tag: "varint,63003,opt,name=goproto_stringer_all", - Filename: "gogo.proto", -} - -var E_VerboseEqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63004, - Name: "gogoproto.verbose_equal_all", - Tag: "varint,63004,opt,name=verbose_equal_all", - Filename: "gogo.proto", -} - -var E_FaceAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63005, - Name: "gogoproto.face_all", - Tag: "varint,63005,opt,name=face_all", - Filename: "gogo.proto", -} - -var E_GostringAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63006, - Name: "gogoproto.gostring_all", - Tag: "varint,63006,opt,name=gostring_all", - Filename: "gogo.proto", -} - -var E_PopulateAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63007, - Name: "gogoproto.populate_all", - Tag: "varint,63007,opt,name=populate_all", - Filename: "gogo.proto", -} - -var E_StringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63008, - Name: "gogoproto.stringer_all", - Tag: "varint,63008,opt,name=stringer_all", - Filename: "gogo.proto", -} - -var E_OnlyoneAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63009, - Name: "gogoproto.onlyone_all", - Tag: "varint,63009,opt,name=onlyone_all", - Filename: "gogo.proto", -} - -var E_EqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63013, - Name: "gogoproto.equal_all", - Tag: "varint,63013,opt,name=equal_all", - Filename: "gogo.proto", -} - -var E_DescriptionAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63014, - Name: "gogoproto.description_all", - Tag: "varint,63014,opt,name=description_all", - Filename: "gogo.proto", -} - -var E_TestgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63015, - Name: "gogoproto.testgen_all", - Tag: "varint,63015,opt,name=testgen_all", - Filename: "gogo.proto", -} - -var E_BenchgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63016, - Name: "gogoproto.benchgen_all", - Tag: "varint,63016,opt,name=benchgen_all", - Filename: "gogo.proto", -} - -var E_MarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63017, - Name: "gogoproto.marshaler_all", - Tag: "varint,63017,opt,name=marshaler_all", - Filename: "gogo.proto", -} - -var E_UnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63018, - Name: "gogoproto.unmarshaler_all", - Tag: "varint,63018,opt,name=unmarshaler_all", - Filename: "gogo.proto", -} - -var E_StableMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63019, - Name: "gogoproto.stable_marshaler_all", - Tag: "varint,63019,opt,name=stable_marshaler_all", - Filename: "gogo.proto", -} - -var E_SizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63020, - Name: "gogoproto.sizer_all", - Tag: "varint,63020,opt,name=sizer_all", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63021, - Name: "gogoproto.goproto_enum_stringer_all", - Tag: "varint,63021,opt,name=goproto_enum_stringer_all", - Filename: "gogo.proto", -} - -var E_EnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63022, - Name: "gogoproto.enum_stringer_all", - Tag: "varint,63022,opt,name=enum_stringer_all", - Filename: "gogo.proto", -} - -var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63023, - Name: "gogoproto.unsafe_marshaler_all", - Tag: "varint,63023,opt,name=unsafe_marshaler_all", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63024, - Name: "gogoproto.unsafe_unmarshaler_all", - Tag: "varint,63024,opt,name=unsafe_unmarshaler_all", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63025, - Name: "gogoproto.goproto_extensions_map_all", - Tag: "varint,63025,opt,name=goproto_extensions_map_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63026, - Name: "gogoproto.goproto_unrecognized_all", - Tag: "varint,63026,opt,name=goproto_unrecognized_all", - Filename: "gogo.proto", -} - -var E_GogoprotoImport = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63027, - Name: "gogoproto.gogoproto_import", - Tag: "varint,63027,opt,name=gogoproto_import", - Filename: "gogo.proto", -} - -var E_ProtosizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63028, - Name: "gogoproto.protosizer_all", - Tag: "varint,63028,opt,name=protosizer_all", - Filename: "gogo.proto", -} - -var E_CompareAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63029, - Name: "gogoproto.compare_all", - Tag: "varint,63029,opt,name=compare_all", - Filename: "gogo.proto", -} - -var E_TypedeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63030, - Name: "gogoproto.typedecl_all", - Tag: "varint,63030,opt,name=typedecl_all", - Filename: "gogo.proto", -} - -var E_EnumdeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63031, - Name: "gogoproto.enumdecl_all", - Tag: "varint,63031,opt,name=enumdecl_all", - Filename: "gogo.proto", -} - -var E_GoprotoRegistration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63032, - Name: "gogoproto.goproto_registration", - Tag: "varint,63032,opt,name=goproto_registration", - Filename: "gogo.proto", -} - -var E_MessagenameAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63033, - Name: "gogoproto.messagename_all", - Tag: "varint,63033,opt,name=messagename_all", - Filename: "gogo.proto", -} - -var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63034, - Name: "gogoproto.goproto_sizecache_all", - Tag: "varint,63034,opt,name=goproto_sizecache_all", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63035, - Name: "gogoproto.goproto_unkeyed_all", - Tag: "varint,63035,opt,name=goproto_unkeyed_all", - Filename: "gogo.proto", -} - -var E_GoprotoGetters = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64001, - Name: "gogoproto.goproto_getters", - Tag: "varint,64001,opt,name=goproto_getters", - Filename: "gogo.proto", -} - -var E_GoprotoStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64003, - Name: "gogoproto.goproto_stringer", - Tag: "varint,64003,opt,name=goproto_stringer", - Filename: "gogo.proto", -} - -var E_VerboseEqual = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64004, - Name: "gogoproto.verbose_equal", - Tag: "varint,64004,opt,name=verbose_equal", - Filename: "gogo.proto", -} - -var E_Face = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64005, - Name: "gogoproto.face", - Tag: "varint,64005,opt,name=face", - Filename: "gogo.proto", -} - -var E_Gostring = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64006, - Name: "gogoproto.gostring", - Tag: "varint,64006,opt,name=gostring", - Filename: "gogo.proto", -} - -var E_Populate = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64007, - Name: "gogoproto.populate", - Tag: "varint,64007,opt,name=populate", - Filename: "gogo.proto", -} - -var E_Stringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 67008, - Name: "gogoproto.stringer", - Tag: "varint,67008,opt,name=stringer", - Filename: "gogo.proto", -} - -var E_Onlyone = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64009, - Name: "gogoproto.onlyone", - Tag: "varint,64009,opt,name=onlyone", - Filename: "gogo.proto", -} - -var E_Equal = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64013, - Name: "gogoproto.equal", - Tag: "varint,64013,opt,name=equal", - Filename: "gogo.proto", -} - -var E_Description = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64014, - Name: "gogoproto.description", - Tag: "varint,64014,opt,name=description", - Filename: "gogo.proto", -} - -var E_Testgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64015, - Name: "gogoproto.testgen", - Tag: "varint,64015,opt,name=testgen", - Filename: "gogo.proto", -} - -var E_Benchgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64016, - Name: "gogoproto.benchgen", - Tag: "varint,64016,opt,name=benchgen", - Filename: "gogo.proto", -} - -var E_Marshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64017, - Name: "gogoproto.marshaler", - Tag: "varint,64017,opt,name=marshaler", - Filename: "gogo.proto", -} - -var E_Unmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64018, - Name: "gogoproto.unmarshaler", - Tag: "varint,64018,opt,name=unmarshaler", - Filename: "gogo.proto", -} - -var E_StableMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64019, - Name: "gogoproto.stable_marshaler", - Tag: "varint,64019,opt,name=stable_marshaler", - Filename: "gogo.proto", -} - -var E_Sizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64020, - Name: "gogoproto.sizer", - Tag: "varint,64020,opt,name=sizer", - Filename: "gogo.proto", -} - -var E_UnsafeMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64023, - Name: "gogoproto.unsafe_marshaler", - Tag: "varint,64023,opt,name=unsafe_marshaler", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64024, - Name: "gogoproto.unsafe_unmarshaler", - Tag: "varint,64024,opt,name=unsafe_unmarshaler", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64025, - Name: "gogoproto.goproto_extensions_map", - Tag: "varint,64025,opt,name=goproto_extensions_map", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognized = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64026, - Name: "gogoproto.goproto_unrecognized", - Tag: "varint,64026,opt,name=goproto_unrecognized", - Filename: "gogo.proto", -} - -var E_Protosizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64028, - Name: "gogoproto.protosizer", - Tag: "varint,64028,opt,name=protosizer", - Filename: "gogo.proto", -} - -var E_Compare = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64029, - Name: "gogoproto.compare", - Tag: "varint,64029,opt,name=compare", - Filename: "gogo.proto", -} - -var E_Typedecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64030, - Name: "gogoproto.typedecl", - Tag: "varint,64030,opt,name=typedecl", - Filename: "gogo.proto", -} - -var E_Messagename = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64033, - Name: "gogoproto.messagename", - Tag: "varint,64033,opt,name=messagename", - Filename: "gogo.proto", -} - -var E_GoprotoSizecache = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64034, - Name: "gogoproto.goproto_sizecache", - Tag: "varint,64034,opt,name=goproto_sizecache", - Filename: "gogo.proto", -} - -var E_GoprotoUnkeyed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64035, - Name: "gogoproto.goproto_unkeyed", - Tag: "varint,64035,opt,name=goproto_unkeyed", - Filename: "gogo.proto", -} - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65001, - Name: "gogoproto.nullable", - Tag: "varint,65001,opt,name=nullable", - Filename: "gogo.proto", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65002, - Name: "gogoproto.embed", - Tag: "varint,65002,opt,name=embed", - Filename: "gogo.proto", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65003, - Name: "gogoproto.customtype", - Tag: "bytes,65003,opt,name=customtype", - Filename: "gogo.proto", -} - -var E_Customname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65004, - Name: "gogoproto.customname", - Tag: "bytes,65004,opt,name=customname", - Filename: "gogo.proto", -} - -var E_Jsontag = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65005, - Name: "gogoproto.jsontag", - Tag: "bytes,65005,opt,name=jsontag", - Filename: "gogo.proto", -} - -var E_Moretags = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65006, - Name: "gogoproto.moretags", - Tag: "bytes,65006,opt,name=moretags", - Filename: "gogo.proto", -} - -var E_Casttype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65007, - Name: "gogoproto.casttype", - Tag: "bytes,65007,opt,name=casttype", - Filename: "gogo.proto", -} - -var E_Castkey = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65008, - Name: "gogoproto.castkey", - Tag: "bytes,65008,opt,name=castkey", - Filename: "gogo.proto", -} - -var E_Castvalue = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65009, - Name: "gogoproto.castvalue", - Tag: "bytes,65009,opt,name=castvalue", - Filename: "gogo.proto", -} - -var E_Stdtime = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65010, - Name: "gogoproto.stdtime", - Tag: "varint,65010,opt,name=stdtime", - Filename: "gogo.proto", -} - -var E_Stdduration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65011, - Name: "gogoproto.stdduration", - Tag: "varint,65011,opt,name=stdduration", - Filename: "gogo.proto", -} - -var E_Wktpointer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65012, - Name: "gogoproto.wktpointer", - Tag: "varint,65012,opt,name=wktpointer", - Filename: "gogo.proto", -} - -func init() { - proto.RegisterExtension(E_GoprotoEnumPrefix) - proto.RegisterExtension(E_GoprotoEnumStringer) - proto.RegisterExtension(E_EnumStringer) - proto.RegisterExtension(E_EnumCustomname) - proto.RegisterExtension(E_Enumdecl) - proto.RegisterExtension(E_EnumvalueCustomname) - proto.RegisterExtension(E_GoprotoGettersAll) - proto.RegisterExtension(E_GoprotoEnumPrefixAll) - proto.RegisterExtension(E_GoprotoStringerAll) - proto.RegisterExtension(E_VerboseEqualAll) - proto.RegisterExtension(E_FaceAll) - proto.RegisterExtension(E_GostringAll) - proto.RegisterExtension(E_PopulateAll) - proto.RegisterExtension(E_StringerAll) - proto.RegisterExtension(E_OnlyoneAll) - proto.RegisterExtension(E_EqualAll) - proto.RegisterExtension(E_DescriptionAll) - proto.RegisterExtension(E_TestgenAll) - proto.RegisterExtension(E_BenchgenAll) - proto.RegisterExtension(E_MarshalerAll) - proto.RegisterExtension(E_UnmarshalerAll) - proto.RegisterExtension(E_StableMarshalerAll) - proto.RegisterExtension(E_SizerAll) - proto.RegisterExtension(E_GoprotoEnumStringerAll) - proto.RegisterExtension(E_EnumStringerAll) - proto.RegisterExtension(E_UnsafeMarshalerAll) - proto.RegisterExtension(E_UnsafeUnmarshalerAll) - proto.RegisterExtension(E_GoprotoExtensionsMapAll) - proto.RegisterExtension(E_GoprotoUnrecognizedAll) - proto.RegisterExtension(E_GogoprotoImport) - proto.RegisterExtension(E_ProtosizerAll) - proto.RegisterExtension(E_CompareAll) - proto.RegisterExtension(E_TypedeclAll) - proto.RegisterExtension(E_EnumdeclAll) - proto.RegisterExtension(E_GoprotoRegistration) - proto.RegisterExtension(E_MessagenameAll) - proto.RegisterExtension(E_GoprotoSizecacheAll) - proto.RegisterExtension(E_GoprotoUnkeyedAll) - proto.RegisterExtension(E_GoprotoGetters) - proto.RegisterExtension(E_GoprotoStringer) - proto.RegisterExtension(E_VerboseEqual) - proto.RegisterExtension(E_Face) - proto.RegisterExtension(E_Gostring) - proto.RegisterExtension(E_Populate) - proto.RegisterExtension(E_Stringer) - proto.RegisterExtension(E_Onlyone) - proto.RegisterExtension(E_Equal) - proto.RegisterExtension(E_Description) - proto.RegisterExtension(E_Testgen) - proto.RegisterExtension(E_Benchgen) - proto.RegisterExtension(E_Marshaler) - proto.RegisterExtension(E_Unmarshaler) - proto.RegisterExtension(E_StableMarshaler) - proto.RegisterExtension(E_Sizer) - proto.RegisterExtension(E_UnsafeMarshaler) - proto.RegisterExtension(E_UnsafeUnmarshaler) - proto.RegisterExtension(E_GoprotoExtensionsMap) - proto.RegisterExtension(E_GoprotoUnrecognized) - proto.RegisterExtension(E_Protosizer) - proto.RegisterExtension(E_Compare) - proto.RegisterExtension(E_Typedecl) - proto.RegisterExtension(E_Messagename) - proto.RegisterExtension(E_GoprotoSizecache) - proto.RegisterExtension(E_GoprotoUnkeyed) - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) - proto.RegisterExtension(E_Customname) - proto.RegisterExtension(E_Jsontag) - proto.RegisterExtension(E_Moretags) - proto.RegisterExtension(E_Casttype) - proto.RegisterExtension(E_Castkey) - proto.RegisterExtension(E_Castvalue) - proto.RegisterExtension(E_Stdtime) - proto.RegisterExtension(E_Stdduration) - proto.RegisterExtension(E_Wktpointer) -} - -func init() { proto.RegisterFile("gogo.proto", fileDescriptor_592445b5231bc2b9) } - -var fileDescriptor_592445b5231bc2b9 = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0x49, 0x6f, 0x1c, 0x45, - 0x14, 0x80, 0x85, 0x48, 0x64, 0x4f, 0x79, 0x8b, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0xe0, 0xc4, 0xc9, - 0x3e, 0x45, 0x28, 0x65, 0x45, 0x96, 0x63, 0x39, 0x56, 0x10, 0x0e, 0xc6, 0x89, 0xc3, 0x76, 0x18, - 0xf5, 0xf4, 0x94, 0xdb, 0x8d, 0xbb, 0xbb, 0x9a, 0xee, 0xea, 0x10, 0xe7, 0x86, 0xc2, 0x22, 0x84, - 0xd8, 0x91, 0x20, 0x21, 0x09, 0x04, 0xc4, 0xbe, 0x86, 0x7d, 0xb9, 0x70, 0x61, 0xb9, 0xf2, 0x1f, - 0xb8, 0x00, 0x66, 0xf7, 0xcd, 0x17, 0xf4, 0xba, 0xdf, 0xeb, 0xa9, 0x69, 0x8f, 0x54, 0x35, 0xb7, - 0xf6, 0xb8, 0xbe, 0x6f, 0xaa, 0xdf, 0xeb, 0x7a, 0xef, 0x4d, 0x33, 0xe6, 0x49, 0x4f, 0x4e, 0xc6, - 0x89, 0x54, 0xb2, 0x5e, 0x83, 0xeb, 0xfc, 0x72, 0xdf, 0x7e, 0x4f, 0x4a, 0x2f, 0x10, 0x53, 0xf9, - 0x5f, 0xcd, 0x6c, 0x75, 0xaa, 0x25, 0x52, 0x37, 0xf1, 0x63, 0x25, 0x93, 0x62, 0x31, 0x3f, 0xc6, - 0xc6, 0x70, 0x71, 0x43, 0x44, 0x59, 0xd8, 0x88, 0x13, 0xb1, 0xea, 0x9f, 0xae, 0x5f, 0x3f, 0x59, - 0x90, 0x93, 0x44, 0x4e, 0xce, 0x47, 0x59, 0x78, 0x47, 0xac, 0x7c, 0x19, 0xa5, 0x7b, 0xaf, 0xfc, - 0x72, 0xf5, 0xfe, 0xab, 0x6e, 0xe9, 0x5f, 0x1e, 0x45, 0x14, 0xfe, 0xb7, 0x94, 0x83, 0x7c, 0x99, - 0x5d, 0xd3, 0xe1, 0x4b, 0x55, 0xe2, 0x47, 0x9e, 0x48, 0x0c, 0xc6, 0xef, 0xd1, 0x38, 0xa6, 0x19, - 0x8f, 0x23, 0xca, 0xe7, 0xd8, 0x50, 0x2f, 0xae, 0x1f, 0xd0, 0x35, 0x28, 0x74, 0xc9, 0x02, 0x1b, - 0xc9, 0x25, 0x6e, 0x96, 0x2a, 0x19, 0x46, 0x4e, 0x28, 0x0c, 0x9a, 0x1f, 0x73, 0x4d, 0x6d, 0x79, - 0x18, 0xb0, 0xb9, 0x92, 0xe2, 0x9c, 0xf5, 0xc3, 0x27, 0x2d, 0xe1, 0x06, 0x06, 0xc3, 0x4f, 0xb8, - 0x91, 0x72, 0x3d, 0x3f, 0xc9, 0xc6, 0xe1, 0xfa, 0x94, 0x13, 0x64, 0x42, 0xdf, 0xc9, 0x4d, 0x5d, - 0x3d, 0x27, 0x61, 0x19, 0xc9, 0x7e, 0x3e, 0xbb, 0x2b, 0xdf, 0xce, 0x58, 0x29, 0xd0, 0xf6, 0xa4, - 0x65, 0xd1, 0x13, 0x4a, 0x89, 0x24, 0x6d, 0x38, 0x41, 0xb7, 0xed, 0x1d, 0xf1, 0x83, 0xd2, 0x78, - 0x6e, 0xb3, 0x33, 0x8b, 0x0b, 0x05, 0x39, 0x1b, 0x04, 0x7c, 0x85, 0x5d, 0xdb, 0xe5, 0xa9, 0xb0, - 0x70, 0x9e, 0x47, 0xe7, 0xf8, 0x8e, 0x27, 0x03, 0xb4, 0x4b, 0x8c, 0x3e, 0x2f, 0x73, 0x69, 0xe1, - 0x7c, 0x19, 0x9d, 0x75, 0x64, 0x29, 0xa5, 0x60, 0xbc, 0x8d, 0x8d, 0x9e, 0x12, 0x49, 0x53, 0xa6, - 0xa2, 0x21, 0x1e, 0xc8, 0x9c, 0xc0, 0x42, 0x77, 0x01, 0x75, 0x23, 0x08, 0xce, 0x03, 0x07, 0xae, - 0x83, 0xac, 0x7f, 0xd5, 0x71, 0x85, 0x85, 0xe2, 0x22, 0x2a, 0xfa, 0x60, 0x3d, 0xa0, 0xb3, 0x6c, - 0xd0, 0x93, 0xc5, 0x2d, 0x59, 0xe0, 0x97, 0x10, 0x1f, 0x20, 0x06, 0x15, 0xb1, 0x8c, 0xb3, 0xc0, - 0x51, 0x36, 0x3b, 0x78, 0x85, 0x14, 0xc4, 0xa0, 0xa2, 0x87, 0xb0, 0xbe, 0x4a, 0x8a, 0x54, 0x8b, - 0xe7, 0x0c, 0x1b, 0x90, 0x51, 0xb0, 0x21, 0x23, 0x9b, 0x4d, 0x5c, 0x46, 0x03, 0x43, 0x04, 0x04, - 0xd3, 0xac, 0x66, 0x9b, 0x88, 0x37, 0x36, 0xe9, 0x78, 0x50, 0x06, 0x16, 0xd8, 0x08, 0x15, 0x28, - 0x5f, 0x46, 0x16, 0x8a, 0x37, 0x51, 0x31, 0xac, 0x61, 0x78, 0x1b, 0x4a, 0xa4, 0xca, 0x13, 0x36, - 0x92, 0xb7, 0xe8, 0x36, 0x10, 0xc1, 0x50, 0x36, 0x45, 0xe4, 0xae, 0xd9, 0x19, 0xde, 0xa6, 0x50, - 0x12, 0x03, 0x8a, 0x39, 0x36, 0x14, 0x3a, 0x49, 0xba, 0xe6, 0x04, 0x56, 0xe9, 0x78, 0x07, 0x1d, - 0x83, 0x25, 0x84, 0x11, 0xc9, 0xa2, 0x5e, 0x34, 0xef, 0x52, 0x44, 0x34, 0x0c, 0x8f, 0x5e, 0xaa, - 0x9c, 0x66, 0x20, 0x1a, 0xbd, 0xd8, 0xde, 0xa3, 0xa3, 0x57, 0xb0, 0x8b, 0xba, 0x71, 0x9a, 0xd5, - 0x52, 0xff, 0x8c, 0x95, 0xe6, 0x7d, 0xca, 0x74, 0x0e, 0x00, 0x7c, 0x0f, 0xbb, 0xae, 0x6b, 0x9b, - 0xb0, 0x90, 0x7d, 0x80, 0xb2, 0x89, 0x2e, 0xad, 0x02, 0x4b, 0x42, 0xaf, 0xca, 0x0f, 0xa9, 0x24, - 0x88, 0x8a, 0x6b, 0x89, 0x8d, 0x67, 0x51, 0xea, 0xac, 0xf6, 0x16, 0xb5, 0x8f, 0x28, 0x6a, 0x05, - 0xdb, 0x11, 0xb5, 0x13, 0x6c, 0x02, 0x8d, 0xbd, 0xe5, 0xf5, 0x63, 0x2a, 0xac, 0x05, 0xbd, 0xd2, - 0x99, 0xdd, 0xfb, 0xd8, 0xbe, 0x32, 0x9c, 0xa7, 0x95, 0x88, 0x52, 0x60, 0x1a, 0xa1, 0x13, 0x5b, - 0x98, 0xaf, 0xa0, 0x99, 0x2a, 0xfe, 0x7c, 0x29, 0x58, 0x74, 0x62, 0x90, 0xdf, 0xcd, 0xf6, 0x92, - 0x3c, 0x8b, 0x12, 0xe1, 0x4a, 0x2f, 0xf2, 0xcf, 0x88, 0x96, 0x85, 0xfa, 0x93, 0x4a, 0xaa, 0x56, - 0x34, 0x1c, 0xcc, 0x47, 0xd9, 0x9e, 0x72, 0x56, 0x69, 0xf8, 0x61, 0x2c, 0x13, 0x65, 0x30, 0x7e, - 0x4a, 0x99, 0x2a, 0xb9, 0xa3, 0x39, 0xc6, 0xe7, 0xd9, 0x70, 0xfe, 0xa7, 0xed, 0x23, 0xf9, 0x19, - 0x8a, 0x86, 0xda, 0x14, 0x16, 0x0e, 0x57, 0x86, 0xb1, 0x93, 0xd8, 0xd4, 0xbf, 0xcf, 0xa9, 0x70, - 0x20, 0x82, 0x85, 0x43, 0x6d, 0xc4, 0x02, 0xba, 0xbd, 0x85, 0xe1, 0x0b, 0x2a, 0x1c, 0xc4, 0xa0, - 0x82, 0x06, 0x06, 0x0b, 0xc5, 0x97, 0xa4, 0x20, 0x06, 0x14, 0x77, 0xb6, 0x1b, 0x6d, 0x22, 0x3c, - 0x3f, 0x55, 0x89, 0x03, 0xab, 0x0d, 0xaa, 0xaf, 0x36, 0x3b, 0x87, 0xb0, 0x65, 0x0d, 0x85, 0x4a, - 0x14, 0x8a, 0x34, 0x75, 0x3c, 0x01, 0x13, 0x87, 0xc5, 0xc6, 0xbe, 0xa6, 0x4a, 0xa4, 0x61, 0xb0, - 0x37, 0x6d, 0x42, 0x84, 0xb0, 0xbb, 0x8e, 0xbb, 0x66, 0xa3, 0xfb, 0xa6, 0xb2, 0xb9, 0xe3, 0xc4, - 0x82, 0x53, 0x9b, 0x7f, 0xb2, 0x68, 0x5d, 0x6c, 0x58, 0x3d, 0x9d, 0xdf, 0x56, 0xe6, 0x9f, 0x95, - 0x82, 0x2c, 0x6a, 0xc8, 0x48, 0x65, 0x9e, 0xaa, 0xdf, 0xb8, 0xc3, 0xb5, 0x58, 0xdc, 0x17, 0xe9, - 0x1e, 0xda, 0xc2, 0xfb, 0xed, 0x1c, 0xa7, 0xf8, 0xed, 0xf0, 0x90, 0x77, 0x0e, 0x3d, 0x66, 0xd9, - 0xd9, 0xad, 0xf2, 0x39, 0xef, 0x98, 0x79, 0xf8, 0x11, 0x36, 0xd4, 0x31, 0xf0, 0x98, 0x55, 0x0f, - 0xa3, 0x6a, 0x50, 0x9f, 0x77, 0xf8, 0x01, 0xb6, 0x0b, 0x86, 0x17, 0x33, 0xfe, 0x08, 0xe2, 0xf9, - 0x72, 0x7e, 0x88, 0xf5, 0xd3, 0xd0, 0x62, 0x46, 0x1f, 0x45, 0xb4, 0x44, 0x00, 0xa7, 0x81, 0xc5, - 0x8c, 0x3f, 0x46, 0x38, 0x21, 0x80, 0xdb, 0x87, 0xf0, 0xbb, 0x27, 0x76, 0x61, 0xd3, 0xa1, 0xd8, - 0x4d, 0xb3, 0x3e, 0x9c, 0x54, 0xcc, 0xf4, 0xe3, 0xf8, 0xe5, 0x44, 0xf0, 0x5b, 0xd9, 0x6e, 0xcb, - 0x80, 0x3f, 0x89, 0x68, 0xb1, 0x9e, 0xcf, 0xb1, 0x01, 0x6d, 0x3a, 0x31, 0xe3, 0x4f, 0x21, 0xae, - 0x53, 0xb0, 0x75, 0x9c, 0x4e, 0xcc, 0x82, 0xa7, 0x69, 0xeb, 0x48, 0x40, 0xd8, 0x68, 0x30, 0x31, - 0xd3, 0xcf, 0x50, 0xd4, 0x09, 0xe1, 0x33, 0xac, 0x56, 0x36, 0x1b, 0x33, 0xff, 0x2c, 0xf2, 0x6d, - 0x06, 0x22, 0xa0, 0x35, 0x3b, 0xb3, 0xe2, 0x39, 0x8a, 0x80, 0x46, 0xc1, 0x31, 0xaa, 0x0e, 0x30, - 0x66, 0xd3, 0xf3, 0x74, 0x8c, 0x2a, 0xf3, 0x0b, 0x64, 0x33, 0xaf, 0xf9, 0x66, 0xc5, 0x0b, 0x94, - 0xcd, 0x7c, 0x3d, 0x6c, 0xa3, 0x3a, 0x11, 0x98, 0x1d, 0x2f, 0xd2, 0x36, 0x2a, 0x03, 0x01, 0x5f, - 0x62, 0xf5, 0x9d, 0xd3, 0x80, 0xd9, 0xf7, 0x12, 0xfa, 0x46, 0x77, 0x0c, 0x03, 0xfc, 0x2e, 0x36, - 0xd1, 0x7d, 0x12, 0x30, 0x5b, 0xcf, 0x6d, 0x55, 0x7e, 0xbb, 0xe9, 0x83, 0x00, 0x3f, 0xd1, 0x6e, - 0x29, 0xfa, 0x14, 0x60, 0xd6, 0x9e, 0xdf, 0xea, 0x2c, 0xdc, 0xfa, 0x10, 0xc0, 0x67, 0x19, 0x6b, - 0x37, 0x60, 0xb3, 0xeb, 0x02, 0xba, 0x34, 0x08, 0x8e, 0x06, 0xf6, 0x5f, 0x33, 0x7f, 0x91, 0x8e, - 0x06, 0x12, 0x70, 0x34, 0xa8, 0xf5, 0x9a, 0xe9, 0x4b, 0x74, 0x34, 0x08, 0x81, 0x27, 0x5b, 0xeb, - 0x6e, 0x66, 0xc3, 0x65, 0x7a, 0xb2, 0x35, 0x8a, 0x1f, 0x63, 0xa3, 0x3b, 0x1a, 0xa2, 0x59, 0xf5, - 0x1a, 0xaa, 0xf6, 0x54, 0xfb, 0xa1, 0xde, 0xbc, 0xb0, 0x19, 0x9a, 0x6d, 0xaf, 0x57, 0x9a, 0x17, - 0xf6, 0x42, 0x3e, 0xcd, 0xfa, 0xa3, 0x2c, 0x08, 0xe0, 0xf0, 0xd4, 0x6f, 0xe8, 0xd2, 0x4d, 0x45, - 0xd0, 0x22, 0xc5, 0xaf, 0xdb, 0x18, 0x1d, 0x02, 0xf8, 0x01, 0xb6, 0x5b, 0x84, 0x4d, 0xd1, 0x32, - 0x91, 0xbf, 0x6d, 0x53, 0xc1, 0x84, 0xd5, 0x7c, 0x86, 0xb1, 0xe2, 0xd5, 0x08, 0x84, 0xd9, 0xc4, - 0xfe, 0xbe, 0x5d, 0xbc, 0xa5, 0xd1, 0x90, 0xb6, 0x20, 0x4f, 0x8a, 0x41, 0xb0, 0xd9, 0x29, 0xc8, - 0x33, 0x72, 0x90, 0xf5, 0xdd, 0x9f, 0xca, 0x48, 0x39, 0x9e, 0x89, 0xfe, 0x03, 0x69, 0x5a, 0x0f, - 0x01, 0x0b, 0x65, 0x22, 0x94, 0xe3, 0xa5, 0x26, 0xf6, 0x4f, 0x64, 0x4b, 0x00, 0x60, 0xd7, 0x49, - 0x95, 0xcd, 0x7d, 0xff, 0x45, 0x30, 0x01, 0xb0, 0x69, 0xb8, 0x5e, 0x17, 0x1b, 0x26, 0xf6, 0x6f, - 0xda, 0x34, 0xae, 0xe7, 0x87, 0x58, 0x0d, 0x2e, 0xf3, 0xb7, 0x4a, 0x26, 0xf8, 0x1f, 0x84, 0xdb, - 0x04, 0x7c, 0x73, 0xaa, 0x5a, 0xca, 0x37, 0x07, 0xfb, 0x5f, 0xcc, 0x34, 0xad, 0xe7, 0xb3, 0x6c, - 0x20, 0x55, 0xad, 0x56, 0x86, 0xf3, 0xa9, 0x01, 0xff, 0x6f, 0xbb, 0x7c, 0x65, 0x51, 0x32, 0x90, - 0xed, 0x07, 0xd7, 0x55, 0x2c, 0xfd, 0x48, 0x89, 0xc4, 0x64, 0xd8, 0x42, 0x83, 0x86, 0x1c, 0x9e, - 0x67, 0x63, 0xae, 0x0c, 0xab, 0xdc, 0x61, 0xb6, 0x20, 0x17, 0xe4, 0x52, 0x5e, 0x67, 0xee, 0xbd, - 0xd9, 0xf3, 0xd5, 0x5a, 0xd6, 0x9c, 0x74, 0x65, 0x38, 0x05, 0xbf, 0x3c, 0xda, 0x2f, 0x54, 0xcb, - 0xdf, 0x21, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xaf, 0x70, 0x4e, 0x83, 0x15, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden b/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden deleted file mode 100644 index f6502e4b..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by protoc-gen-go. -// source: gogo.proto -// DO NOT EDIT! - -package gogoproto - -import proto "github.com/gogo/protobuf/proto" -import json "encoding/json" -import math "math" -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -// Reference proto, json, and math imports to suppress error if they are not otherwise used. -var _ = proto.Marshal -var _ = &json.SyntaxError{} -var _ = math.Inf - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51235, - Name: "gogoproto.nullable", - Tag: "varint,51235,opt,name=nullable", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 51236, - Name: "gogoproto.embed", - Tag: "varint,51236,opt,name=embed", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 51237, - Name: "gogoproto.customtype", - Tag: "bytes,51237,opt,name=customtype", -} - -func init() { - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto b/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto deleted file mode 100644 index b80c8565..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/gogo.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - -} diff --git a/vendor/github.com/gogo/protobuf/gogoproto/helper.go b/vendor/github.com/gogo/protobuf/gogoproto/helper.go deleted file mode 100644 index 390d4e4b..00000000 --- a/vendor/github.com/gogo/protobuf/gogoproto/helper.go +++ /dev/null @@ -1,415 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package gogoproto - -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -import proto "github.com/gogo/protobuf/proto" - -func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Embed, false) -} - -func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Nullable, true) -} - -func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdtime, false) -} - -func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdduration, false) -} - -func IsStdDouble(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.DoubleValue" -} - -func IsStdFloat(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.FloatValue" -} - -func IsStdInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int64Value" -} - -func IsStdUInt64(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt64Value" -} - -func IsStdInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.Int32Value" -} - -func IsStdUInt32(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.UInt32Value" -} - -func IsStdBool(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BoolValue" -} - -func IsStdString(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.StringValue" -} - -func IsStdBytes(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) && *field.TypeName == ".google.protobuf.BytesValue" -} - -func IsStdType(field *google_protobuf.FieldDescriptorProto) bool { - return (IsStdTime(field) || IsStdDuration(field) || - IsStdDouble(field) || IsStdFloat(field) || - IsStdInt64(field) || IsStdUInt64(field) || - IsStdInt32(field) || IsStdUInt32(field) || - IsStdBool(field) || - IsStdString(field) || IsStdBytes(field)) -} - -func IsWktPtr(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Wktpointer, false) -} - -func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { - nullable := IsNullable(field) - if field.IsMessage() || IsCustomType(field) { - return nullable - } - if proto3 { - return false - } - return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES -} - -func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCustomType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastKey(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastValue(field) - if len(typ) > 0 { - return true - } - return false -} - -func HasEnumDecl(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_Enumdecl, proto.GetBoolExtension(file.Options, E_EnumdeclAll, true)) -} - -func HasTypeDecl(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Typedecl, proto.GetBoolExtension(file.Options, E_TypedeclAll, true)) -} - -func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customtype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Casttype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castkey) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castvalue) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { - name := GetCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { - name := GetEnumCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { - name := GetEnumValueCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Jsontag) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Moretags) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool - -func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) -} - -func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) -} - -func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) -} - -func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) -} - -func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) -} - -func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) -} - -func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) -} - -func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) -} - -func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) -} - -func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) -} - -func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) -} - -func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) -} - -func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) -} - -func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) -} - -func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) -} - -func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) -} - -func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) -} - -func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) -} - -func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) -} - -func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) -} - -func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) -} - -func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) -} - -func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) -} - -func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) -} - -func IsProto3(file *google_protobuf.FileDescriptorProto) bool { - return file.GetSyntax() == "proto3" -} - -func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) -} - -func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) -} - -func RegistersGolangProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GoprotoRegistration, false) -} - -func HasMessageName(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Messagename, proto.GetBoolExtension(file.Options, E_MessagenameAll, false)) -} - -func HasSizecache(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoSizecache, proto.GetBoolExtension(file.Options, E_GoprotoSizecacheAll, true)) -} - -func HasUnkeyed(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoUnkeyed, proto.GetBoolExtension(file.Options, E_GoprotoUnkeyedAll, true)) -} diff --git a/vendor/github.com/gogo/protobuf/io/full.go b/vendor/github.com/gogo/protobuf/io/full.go deleted file mode 100644 index 550726a3..00000000 --- a/vendor/github.com/gogo/protobuf/io/full.go +++ /dev/null @@ -1,102 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package io - -import ( - "github.com/gogo/protobuf/proto" - "io" -) - -func NewFullWriter(w io.Writer) WriteCloser { - return &fullWriter{w, nil} -} - -type fullWriter struct { - w io.Writer - buffer []byte -} - -func (this *fullWriter) WriteMsg(msg proto.Message) (err error) { - var data []byte - if m, ok := msg.(marshaler); ok { - n, ok := getSize(m) - if !ok { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - if n >= len(this.buffer) { - this.buffer = make([]byte, n) - } - _, err = m.MarshalTo(this.buffer) - if err != nil { - return err - } - data = this.buffer[:n] - } else { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - _, err = this.w.Write(data) - return err -} - -func (this *fullWriter) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -type fullReader struct { - r io.Reader - buf []byte -} - -func NewFullReader(r io.Reader, maxSize int) ReadCloser { - return &fullReader{r, make([]byte, maxSize)} -} - -func (this *fullReader) ReadMsg(msg proto.Message) error { - length, err := this.r.Read(this.buf) - if err != nil { - return err - } - return proto.Unmarshal(this.buf[:length], msg) -} - -func (this *fullReader) Close() error { - if closer, ok := this.r.(io.Closer); ok { - return closer.Close() - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/io/io.go b/vendor/github.com/gogo/protobuf/io/io.go deleted file mode 100644 index 6dca519a..00000000 --- a/vendor/github.com/gogo/protobuf/io/io.go +++ /dev/null @@ -1,70 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package io - -import ( - "github.com/gogo/protobuf/proto" - "io" -) - -type Writer interface { - WriteMsg(proto.Message) error -} - -type WriteCloser interface { - Writer - io.Closer -} - -type Reader interface { - ReadMsg(msg proto.Message) error -} - -type ReadCloser interface { - Reader - io.Closer -} - -type marshaler interface { - MarshalTo(data []byte) (n int, err error) -} - -func getSize(v interface{}) (int, bool) { - if sz, ok := v.(interface { - Size() (n int) - }); ok { - return sz.Size(), true - } else if sz, ok := v.(interface { - ProtoSize() (n int) - }); ok { - return sz.ProtoSize(), true - } else { - return 0, false - } -} diff --git a/vendor/github.com/gogo/protobuf/io/uint32.go b/vendor/github.com/gogo/protobuf/io/uint32.go deleted file mode 100644 index fc43857d..00000000 --- a/vendor/github.com/gogo/protobuf/io/uint32.go +++ /dev/null @@ -1,138 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package io - -import ( - "encoding/binary" - "io" - - "github.com/gogo/protobuf/proto" -) - -const uint32BinaryLen = 4 - -func NewUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder) WriteCloser { - return &uint32Writer{w, byteOrder, nil, make([]byte, uint32BinaryLen)} -} - -func NewSizeUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder, size int) WriteCloser { - return &uint32Writer{w, byteOrder, make([]byte, size), make([]byte, uint32BinaryLen)} -} - -type uint32Writer struct { - w io.Writer - byteOrder binary.ByteOrder - buffer []byte - lenBuf []byte -} - -func (this *uint32Writer) writeFallback(msg proto.Message) error { - data, err := proto.Marshal(msg) - if err != nil { - return err - } - - length := uint32(len(data)) - this.byteOrder.PutUint32(this.lenBuf, length) - if _, err = this.w.Write(this.lenBuf); err != nil { - return err - } - _, err = this.w.Write(data) - return err -} - -func (this *uint32Writer) WriteMsg(msg proto.Message) error { - m, ok := msg.(marshaler) - if !ok { - return this.writeFallback(msg) - } - - n, ok := getSize(m) - if !ok { - return this.writeFallback(msg) - } - - size := n + uint32BinaryLen - if size > len(this.buffer) { - this.buffer = make([]byte, size) - } - - this.byteOrder.PutUint32(this.buffer, uint32(n)) - if _, err := m.MarshalTo(this.buffer[uint32BinaryLen:]); err != nil { - return err - } - - _, err := this.w.Write(this.buffer[:size]) - return err -} - -func (this *uint32Writer) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -type uint32Reader struct { - r io.Reader - byteOrder binary.ByteOrder - lenBuf []byte - buf []byte - maxSize int -} - -func NewUint32DelimitedReader(r io.Reader, byteOrder binary.ByteOrder, maxSize int) ReadCloser { - return &uint32Reader{r, byteOrder, make([]byte, 4), nil, maxSize} -} - -func (this *uint32Reader) ReadMsg(msg proto.Message) error { - if _, err := io.ReadFull(this.r, this.lenBuf); err != nil { - return err - } - length32 := this.byteOrder.Uint32(this.lenBuf) - length := int(length32) - if length < 0 || length > this.maxSize { - return io.ErrShortBuffer - } - if length >= len(this.buf) { - this.buf = make([]byte, length) - } - _, err := io.ReadFull(this.r, this.buf[:length]) - if err != nil { - return err - } - return proto.Unmarshal(this.buf[:length], msg) -} - -func (this *uint32Reader) Close() error { - if closer, ok := this.r.(io.Closer); ok { - return closer.Close() - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/io/varint.go b/vendor/github.com/gogo/protobuf/io/varint.go deleted file mode 100644 index e81e296e..00000000 --- a/vendor/github.com/gogo/protobuf/io/varint.go +++ /dev/null @@ -1,133 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package io - -import ( - "bufio" - "encoding/binary" - "errors" - "github.com/gogo/protobuf/proto" - "io" -) - -var ( - errSmallBuffer = errors.New("Buffer Too Small") - errLargeValue = errors.New("Value is Larger than 64 bits") -) - -func NewDelimitedWriter(w io.Writer) WriteCloser { - return &varintWriter{w, make([]byte, binary.MaxVarintLen64), nil} -} - -type varintWriter struct { - w io.Writer - lenBuf []byte - buffer []byte -} - -func (this *varintWriter) WriteMsg(msg proto.Message) (err error) { - var data []byte - if m, ok := msg.(marshaler); ok { - n, ok := getSize(m) - if ok { - if n+binary.MaxVarintLen64 >= len(this.buffer) { - this.buffer = make([]byte, n+binary.MaxVarintLen64) - } - lenOff := binary.PutUvarint(this.buffer, uint64(n)) - _, err = m.MarshalTo(this.buffer[lenOff:]) - if err != nil { - return err - } - _, err = this.w.Write(this.buffer[:lenOff+n]) - return err - } - } - - // fallback - data, err = proto.Marshal(msg) - if err != nil { - return err - } - length := uint64(len(data)) - n := binary.PutUvarint(this.lenBuf, length) - _, err = this.w.Write(this.lenBuf[:n]) - if err != nil { - return err - } - _, err = this.w.Write(data) - return err -} - -func (this *varintWriter) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -func NewDelimitedReader(r io.Reader, maxSize int) ReadCloser { - var closer io.Closer - if c, ok := r.(io.Closer); ok { - closer = c - } - return &varintReader{bufio.NewReader(r), nil, maxSize, closer} -} - -type varintReader struct { - r *bufio.Reader - buf []byte - maxSize int - closer io.Closer -} - -func (this *varintReader) ReadMsg(msg proto.Message) error { - length64, err := binary.ReadUvarint(this.r) - if err != nil { - return err - } - length := int(length64) - if length < 0 || length > this.maxSize { - return io.ErrShortBuffer - } - if len(this.buf) < length { - this.buf = make([]byte, length) - } - buf := this.buf[:length] - if _, err := io.ReadFull(this.r, buf); err != nil { - return err - } - return proto.Unmarshal(buf, msg) -} - -func (this *varintReader) Close() error { - if this.closer != nil { - return this.closer.Close() - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile deleted file mode 100644 index 00d65f32..00000000 --- a/vendor/github.com/gogo/protobuf/proto/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -install: - go install - -test: install generate-test-pbs - go test - - -generate-test-pbs: - make install - make -C test_proto - make -C proto3_proto - make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go deleted file mode 100644 index a26b046d..00000000 --- a/vendor/github.com/gogo/protobuf/proto/clone.go +++ /dev/null @@ -1,258 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(src Message) Message { - in := reflect.ValueOf(src) - if in.IsNil() { - return src - } - out := reflect.New(in.Type().Elem()) - dst := out.Interface().(Message) - Merge(dst, src) - return dst -} - -// Merger is the interface representing objects that can merge messages of the same type. -type Merger interface { - // Merge merges src into this message. - // Required and optional fields that are set in src will be set to that value in dst. - // Elements of repeated fields will be appended. - // - // Merge may panic if called with a different argument type than the receiver. - Merge(src Message) -} - -// generatedMerger is the custom merge method that generated protos will have. -// We must add this method since a generate Merge method will conflict with -// many existing protos that have a Merge data field already defined. -type generatedMerger interface { - XXX_Merge(src Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) - } - if in.IsNil() { - return // Merge from nil src is a noop - } - if m, ok := dst.(generatedMerger); ok { - m.XXX_Merge(src) - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { - emOut := out.Addr().Interface().(extensionsBytes) - bIn := emIn.GetExtensions() - bOut := emOut.GetExtensions() - *bOut = append(*bOut, *bIn...) - } else if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go deleted file mode 100644 index 24552483..00000000 --- a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go +++ /dev/null @@ -1,39 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import "reflect" - -type custom interface { - Marshal() ([]byte, error) - Unmarshal(data []byte) error - Size() int -} - -var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go deleted file mode 100644 index 63b0f08b..00000000 --- a/vendor/github.com/gogo/protobuf/proto/decode.go +++ /dev/null @@ -1,427 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -// Unmarshal implementations should not clear the receiver. -// Any unmarshaled data should be merged into the receiver. -// Callers of Unmarshal that do not want to retain existing data -// should Reset the receiver before calling Unmarshal. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// newUnmarshaler is the interface representing objects that can -// unmarshal themselves. The semantics are identical to Unmarshaler. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newUnmarshaler interface { - XXX_Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -// StartGroup tag is already consumed. This function consumes -// EndGroup tag. -func (p *Buffer) DecodeGroup(pb Message) error { - b := p.buf[p.index:] - x, y := findEndGroup(b) - if x < 0 { - return io.ErrUnexpectedEOF - } - err := Unmarshal(b[:x], pb) - p.index += y - return err -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(newUnmarshaler); ok { - err := u.XXX_Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - // Slow workaround for messages that aren't Unmarshalers. - // This includes some hand-coded .pb.go files and - // bootstrap protos. - // TODO: fix all of those and then add Unmarshal to - // the Message interface. Then: - // The cast above and code below can be deleted. - // The old unmarshaler can be deleted. - // Clients can call Unmarshal directly (can already do that, actually). - var info InternalMessageInfo - err := info.Unmarshal(pb, p.buf[p.index:]) - p.index = len(p.buf) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/deprecated.go b/vendor/github.com/gogo/protobuf/proto/deprecated.go deleted file mode 100644 index 35b882c0..00000000 --- a/vendor/github.com/gogo/protobuf/proto/deprecated.go +++ /dev/null @@ -1,63 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2018 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import "errors" - -// Deprecated: do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func RegisterMessageSetType(Message, int32, string) {} diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go deleted file mode 100644 index fe1bd7d9..00000000 --- a/vendor/github.com/gogo/protobuf/proto/discard.go +++ /dev/null @@ -1,350 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2017 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -// -// For proto2 messages, the unknown fields of message extensions are only -// discarded from messages that have been accessed via GetExtension. -func DiscardUnknown(m Message) { - if m, ok := m.(generatedDiscarder); ok { - m.XXX_DiscardUnknown() - return - } - // TODO: Dynamically populate a InternalMessageInfo for legacy messages, - // but the master branch has no implementation for InternalMessageInfo, - // so it would be more work to replicate that approach. - discardLegacy(m) -} - -// DiscardUnknown recursively discards all unknown fields. -func (a *InternalMessageInfo) DiscardUnknown(m Message) { - di := atomicLoadDiscardInfo(&a.discard) - if di == nil { - di = getDiscardInfo(reflect.TypeOf(m).Elem()) - atomicStoreDiscardInfo(&a.discard, di) - } - di.discard(toPointer(&m)) -} - -type discardInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []discardFieldInfo - unrecognized field -} - -type discardFieldInfo struct { - field field // Offset of field, guaranteed to be valid - discard func(src pointer) -} - -var ( - discardInfoMap = map[reflect.Type]*discardInfo{} - discardInfoLock sync.Mutex -) - -func getDiscardInfo(t reflect.Type) *discardInfo { - discardInfoLock.Lock() - defer discardInfoLock.Unlock() - di := discardInfoMap[t] - if di == nil { - di = &discardInfo{typ: t} - discardInfoMap[t] = di - } - return di -} - -func (di *discardInfo) discard(src pointer) { - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&di.initialized) == 0 { - di.computeDiscardInfo() - } - - for _, fi := range di.fields { - sfp := src.offset(fi.field) - fi.discard(sfp) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { - // Ignore lock since DiscardUnknown is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - DiscardUnknown(m) - } - } - } - - if di.unrecognized.IsValid() { - *src.offset(di.unrecognized).toBytes() = nil - } -} - -func (di *discardInfo) computeDiscardInfo() { - di.lock.Lock() - defer di.lock.Unlock() - if di.initialized != 0 { - return - } - t := di.typ - n := t.NumField() - - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - dfi := discardFieldInfo{field: toField(&f)} - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) - case isSlice: // E.g., []*pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sps := src.getPointerSlice() - for _, sp := range sps { - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - default: // E.g., *pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sp := src.getPointer() - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) - default: // E.g., map[K]V - if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) - dfi.discard = func(src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - DiscardUnknown(val.Interface().(Message)) - } - } - } else { - dfi.discard = func(pointer) {} // Noop - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) - default: // E.g., interface{} - // TODO: Make this faster? - dfi.discard = func(src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - DiscardUnknown(sv.Interface().(Message)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) - } - - di.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - di.unrecognized = toField(&f) - } - - atomic.StoreInt32(&di.initialized, 1) -} - -func discardLegacy(m Message) { - v := reflect.ValueOf(m) - if v.Kind() != reflect.Ptr || v.IsNil() { - return - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return - } - t := v.Type() - - for i := 0; i < v.NumField(); i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - vf := v.Field(i) - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) - case isSlice: // E.g., []*pb.T - for j := 0; j < vf.Len(); j++ { - discardLegacy(vf.Index(j).Interface().(Message)) - } - default: // E.g., *pb.T - discardLegacy(vf.Interface().(Message)) - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) - default: // E.g., map[K]V - tv := vf.Type().Elem() - if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) - for _, key := range vf.MapKeys() { - val := vf.MapIndex(key) - discardLegacy(val.Interface().(Message)) - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) - default: // E.g., test_proto.isCommunique_Union interface - if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { - vf = vf.Elem() // E.g., *test_proto.Communique_Msg - if !vf.IsNil() { - vf = vf.Elem() // E.g., test_proto.Communique_Msg - vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value - if vf.Kind() == reflect.Ptr { - discardLegacy(vf.Interface().(Message)) - } - } - } - } - } - } - - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - vf.Set(reflect.ValueOf([]byte(nil))) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(m); err == nil { - // Ignore lock since discardLegacy is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - discardLegacy(m) - } - } - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration.go b/vendor/github.com/gogo/protobuf/proto/duration.go deleted file mode 100644 index 93464c91..00000000 --- a/vendor/github.com/gogo/protobuf/proto/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// validateDuration determines whether the Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %#v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %#v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) - } - return nil -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func durationFromProto(p *duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { - return 0, err - } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a Duration. -func durationProto(d time.Duration) *duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go deleted file mode 100644 index e748e173..00000000 --- a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() - -type duration struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *duration) Reset() { *m = duration{} } -func (*duration) ProtoMessage() {} -func (*duration) String() string { return "duration" } - -func init() { - RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go deleted file mode 100644 index 3abfed2c..00000000 --- a/vendor/github.com/gogo/protobuf/proto/encode.go +++ /dev/null @@ -1,203 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "reflect" -) - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - switch { - case x < 1<<7: - return 1 - case x < 1<<14: - return 2 - case x < 1<<21: - return 3 - case x < 1<<28: - return 4 - case x < 1<<35: - return 5 - case x < 1<<42: - return 6 - case x < 1<<49: - return 7 - case x < 1<<56: - return 8 - case x < 1<<63: - return 9 - } - return 10 -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - siz := Size(pb) - p.EncodeVarint(uint64(siz)) - return p.Marshal(pb) -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go deleted file mode 100644 index 0f5fb173..00000000 --- a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -func NewRequiredNotSetError(field string) *RequiredNotSetError { - return &RequiredNotSetError{field} -} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go deleted file mode 100644 index d4db5a1c..00000000 --- a/vendor/github.com/gogo/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - return bytes.Equal(u1, u2) -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.enc, e2.enc) { - continue - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - // If both have only encoded form and the bytes are the same, - // it is handled above. We get here when the bytes are different. - // We don't know how to decode it, so just compare them as byte - // slices. - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go deleted file mode 100644 index 686bd2a0..00000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions.go +++ /dev/null @@ -1,604 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "io" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, error) { - switch p := p.(type) { - case extendableProto: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return p, nil - case extendableProtoV1: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return extensionAdapter{p}, nil - case extensionsBytes: - return slowExtensionAdapter{p}, nil - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -func isNilPtr(x interface{}) bool { - v := reflect.ValueOf(x) - return v.Kind() == reflect.Ptr && v.IsNil() -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - if ebase, ok := base.(extensionsBytes); ok { - clearExtension(base, id) - ext := ebase.GetExtensions() - *ext = append(*ext, b...) - return - } - epb, err := extendable(base) - if err != nil { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if ea, ok := pbi.(slowExtensionAdapter); ok { - pbi = ea.extensionsBytes - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - buf := *ext - o := 0 - for o < len(buf) { - tag, n := DecodeVarint(buf[o:]) - fieldNum := int32(tag >> 3) - if int32(fieldNum) == extension.Field { - return true - } - wireType := int(tag & 0x7) - o += n - l, err := size(buf[o:], wireType) - if err != nil { - return false - } - o += l - } - return false - } - // TODO: Check types, field numbers, etc.? - epb, err := extendable(pb) - if err != nil { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - clearExtension(pb, extension.Field) -} - -func clearExtension(pb Message, fieldNum int32) { - if epb, ok := pb.(extensionsBytes); ok { - offset := 0 - for offset != -1 { - offset = deleteExtension(epb, fieldNum, offset) - } - return - } - epb, err := extendable(pb) - if err != nil { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, fieldNum) -} - -// GetExtension retrieves a proto2 extended field from pb. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes of the field extension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - return decodeExtensionFromBytes(extension, *ext) - } - - epb, err := extendable(pb) - if err != nil { - return nil, err - } - - if extension.ExtendedType != nil { - // can only check type if this is a complete descriptor - if cerr := checkExtensionTypes(epb, extension); cerr != nil { - return nil, cerr - } - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - if extension.ExtensionType == nil { - // incomplete descriptor - return e.enc, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } - - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() - - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err - } - - if len(b) == 0 { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, ok := pb.(extensionsBytes); ok { - newb, err := encodeExtension(extension, value) - if err != nil { - return err - } - bb := epb.GetExtensions() - *bb = append(*bb, newb...) - return nil - } - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - *ext = []byte{} - return - } - epb, err := extendable(pb) - if err != nil { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go deleted file mode 100644 index 53ebd8cc..00000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go +++ /dev/null @@ -1,368 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "bytes" - "errors" - "fmt" - "io" - "reflect" - "sort" - "strings" - "sync" -) - -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - -type slowExtensionAdapter struct { - extensionsBytes -} - -func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { - panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") -} - -func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - b := s.GetExtensions() - m, err := BytesToExtensionsMap(*b) - if err != nil { - panic(err) - } - return m, notLocker{} -} - -func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { - if reflect.ValueOf(pb).IsNil() { - return ifnotset - } - value, err := GetExtension(pb, extension) - if err != nil { - return ifnotset - } - if value == nil { - return ifnotset - } - if value.(*bool) == nil { - return ifnotset - } - return *(value.(*bool)) -} - -func (this *Extension) Equal(that *Extension) bool { - if err := this.Encode(); err != nil { - return false - } - if err := that.Encode(); err != nil { - return false - } - return bytes.Equal(this.enc, that.enc) -} - -func (this *Extension) Compare(that *Extension) int { - if err := this.Encode(); err != nil { - return 1 - } - if err := that.Encode(); err != nil { - return -1 - } - return bytes.Compare(this.enc, that.enc) -} - -func SizeOfInternalExtension(m extendableProto) (n int) { - info := getMarshalInfo(reflect.TypeOf(m)) - return info.sizeV1Extensions(m.extensionsWrite()) -} - -type sortableMapElem struct { - field int32 - ext Extension -} - -func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { - s := make(sortableExtensions, 0, len(m)) - for k, v := range m { - s = append(s, &sortableMapElem{field: k, ext: v}) - } - return s -} - -type sortableExtensions []*sortableMapElem - -func (this sortableExtensions) Len() int { return len(this) } - -func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } - -func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } - -func (this sortableExtensions) String() string { - sort.Sort(this) - ss := make([]string, len(this)) - for i := range this { - ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) - } - return "map[" + strings.Join(ss, ",") + "]" -} - -func StringFromInternalExtension(m extendableProto) string { - return StringFromExtensionsMap(m.extensionsWrite()) -} - -func StringFromExtensionsMap(m map[int32]Extension) string { - return newSortableExtensionsFromMap(m).String() -} - -func StringFromExtensionsBytes(ext []byte) string { - m, err := BytesToExtensionsMap(ext) - if err != nil { - panic(err) - } - return StringFromExtensionsMap(m) -} - -func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMap(m.extensionsWrite(), data) -} - -func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[o:], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - o += n - } - return o, nil -} - -func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - e := m[id] - if err := e.Encode(); err != nil { - return nil, err - } - return e.enc, nil -} - -func size(buf []byte, wire int) (int, error) { - switch wire { - case WireVarint: - _, n := DecodeVarint(buf) - return n, nil - case WireFixed64: - return 8, nil - case WireBytes: - v, n := DecodeVarint(buf) - return int(v) + n, nil - case WireFixed32: - return 4, nil - case WireStartGroup: - offset := 0 - for { - u, n := DecodeVarint(buf[offset:]) - fwire := int(u & 0x7) - offset += n - if fwire == WireEndGroup { - return offset, nil - } - s, err := size(buf[offset:], wire) - if err != nil { - return 0, err - } - offset += s - } - } - return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) -} - -func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { - m := make(map[int32]Extension) - i := 0 - for i < len(buf) { - tag, n := DecodeVarint(buf[i:]) - if n <= 0 { - return nil, fmt.Errorf("unable to decode varint") - } - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size(buf[i+n:], wireType) - if err != nil { - return nil, err - } - end := i + int(l) + n - m[int32(fieldNum)] = Extension{enc: buf[i:end]} - i = end - } - return m, nil -} - -func NewExtension(e []byte) Extension { - ee := Extension{enc: make([]byte, len(e))} - copy(ee.enc, e) - return ee -} - -func AppendExtension(e Message, tag int32, buf []byte) { - if ee, eok := e.(extensionsBytes); eok { - ext := ee.GetExtensions() - *ext = append(*ext, buf...) - return - } - if ee, eok := e.(extendableProto); eok { - m := ee.extensionsWrite() - ext := m[int32(tag)] // may be missing - ext.enc = append(ext.enc, buf...) - m[int32(tag)] = ext - } -} - -func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { - u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) - ei := u.getExtElemInfo(extension) - v := value - p := toAddrPointer(&v, ei.isptr) - siz := ei.sizer(p, SizeVarint(ei.wiretag)) - buf := make([]byte, 0, siz) - return ei.marshaler(buf, p, ei.wiretag, false) -} - -func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { - o := 0 - for o < len(buf) { - tag, n := DecodeVarint((buf)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - if o+n > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - l, err := size((buf)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - if o+n+l > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - v, err := decodeExtension((buf)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) -} - -func (this *Extension) Encode() error { - if this.enc == nil { - var err error - this.enc, err = encodeExtension(this.desc, this.value) - if err != nil { - return err - } - } - return nil -} - -func (this Extension) GoString() string { - if err := this.Encode(); err != nil { - return fmt.Sprintf("error encoding extension: %v", err) - } - return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) -} - -func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return errors.New("proto: bad extension number; not in declared ranges") - } - return SetExtension(pb, desc, value) -} - -func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return nil, fmt.Errorf("unregistered field number %d", fieldNum) - } - return GetExtension(pb, desc) -} - -func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { - x := &XXX_InternalExtensions{ - p: new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }), - } - x.p.extensionMap = m - return *x -} - -func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { - pb := extendable.(extendableProto) - return pb.extensionsWrite() -} - -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go deleted file mode 100644 index d17f8020..00000000 --- a/vendor/github.com/gogo/protobuf/proto/lib.go +++ /dev/null @@ -1,967 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/gogo/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/gogo/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - sindex := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = sindex -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or T or []*T or []T - switch f.Kind() { - case reflect.Struct: - setDefaults(f, recur, zeros) - - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.Kind() == reflect.Ptr && e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Struct: - nestedMessage = true // non-nullable - - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr, reflect.Struct: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const GoGoProtoPackageIsVersion2 = true - -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const GoGoProtoPackageIsVersion1 = true - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go deleted file mode 100644 index b3aa3919..00000000 --- a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go +++ /dev/null @@ -1,50 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "encoding/json" - "strconv" -) - -type Sizer interface { - Size() int -} - -type ProtoSizer interface { - ProtoSize() int -} - -func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { - s, ok := m[value] - if !ok { - s = strconv.Itoa(int(value)) - } - return json.Marshal(s) -} diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go deleted file mode 100644 index f48a7567..00000000 --- a/vendor/github.com/gogo/protobuf/proto/message_set.go +++ /dev/null @@ -1,181 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Support for message sets. - */ - -import ( - "errors" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go deleted file mode 100644 index b6cad908..00000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,357 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go deleted file mode 100644 index 7ffd3c29..00000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" -) - -// TODO: untested, so probably incorrect. - -func (p pointer) getRef() pointer { - return pointer{v: p.v.Addr()} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index d55a335d..00000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,308 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go deleted file mode 100644 index aca8eed0..00000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ /dev/null @@ -1,56 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -func (p pointer) getRef() pointer { - return pointer{p: (unsafe.Pointer)(&p.p)} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go deleted file mode 100644 index c9e5fa02..00000000 --- a/vendor/github.com/gogo/protobuf/proto/properties.go +++ /dev/null @@ -1,599 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "os" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - CustomType string - CastType string - StdTime bool - StdDuration bool - WktPointer bool - - stype reflect.Type // set for struct types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } - case strings.HasPrefix(f, "embedded="): - p.OrigName = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "customtype="): - p.CustomType = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "casttype="): - p.CastType = strings.Split(f, "=")[1] - case f == "stdtime": - p.StdTime = true - case f == "stdduration": - p.StdDuration = true - case f == "wktptr": - p.WktPointer = true - } - } -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - isMap := typ.Kind() == reflect.Map - if len(p.CustomType) > 0 && !isMap { - p.ctype = typ - p.setTag(lockGetProp) - return - } - if p.StdTime && !isMap { - p.setTag(lockGetProp) - return - } - if p.StdDuration && !isMap { - p.setTag(lockGetProp) - return - } - if p.WktPointer && !isMap { - p.setTag(lockGetProp) - return - } - switch t1 := typ; t1.Kind() { - case reflect.Struct: - p.stype = typ - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - case reflect.Struct: - p.stype = t3 - } - case reflect.Struct: - p.stype = t2 - } - - case reflect.Map: - - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - - p.MapValProp.CustomType = p.CustomType - p.MapValProp.StdDuration = p.StdDuration - p.MapValProp.StdTime = p.StdTime - p.MapValProp.WktPointer = p.WktPointer - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - p.setTag(lockGetProp) -} - -func (p *Properties) setTag(lockGetProp bool) { - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - isOneofMessage := false - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - isOneofMessage = true - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok { - var oots []interface{} - _, _, _, oots = om.XXX_OneofFuncs() - - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) -var enumStringMaps = make(map[string]map[int32]string) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap - if _, ok := enumStringMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumStringMaps[typeName] = unusedNameMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go deleted file mode 100644 index 40ea3dd9..00000000 --- a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go +++ /dev/null @@ -1,36 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" -) - -var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() -var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go deleted file mode 100644 index 5a5fd93f..00000000 --- a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go +++ /dev/null @@ -1,119 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "io" -) - -func Skip(data []byte) (n int, err error) { - l := len(data) - index := 0 - for index < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - index++ - if data[index-1] < 0x80 { - break - } - } - return index, nil - case 1: - index += 8 - return index, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - index += length - return index, nil - case 3: - for { - var innerWire uint64 - var start int = index - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := Skip(data[start:]) - if err != nil { - return 0, err - } - index = start + next - } - return index, nil - case 4: - return index, nil - case 5: - index += 4 - return index, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go deleted file mode 100644 index 9b1538d0..00000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal.go +++ /dev/null @@ -1,3006 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements - - hassizer bool // has custom sizer - hasprotosizer bool // has custom protosizer - - bytesExtensions field // offset of XXX_extensions where the field type is []byte -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex - - uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - // Uses the message's Size method if available - if u.hassizer { - s := ptr.asPointerTo(u.typ).Interface().(Sizer) - return s.Size() - } - // Uses the message's ProtoSize method if available - if u.hasprotosizer { - s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) - return s.ProtoSize() - } - - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - n += len(s) - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - b = append(b, s...) - } - for _, f := range u.fields { - if f.required { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.bytesExtensions = invalidField - u.sizecache = invalidField - isOneofMessage := false - - if reflect.PtrTo(t).Implements(sizerType) { - u.hassizer = true - } - if reflect.PtrTo(t).Implements(protosizerType) { - u.hasprotosizer = true - } - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - n := t.NumField() - - // deal with XXX fields first - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Tag.Get("protobuf_oneof") != "" { - isOneofMessage = true - } - if !strings.HasPrefix(f.Name, "XXX_") { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f) - case "XXX_unrecognized": - u.unrecognized = toField(&f) - case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" - case "XXX_extensions": - if f.Type.Kind() == reflect.Map { - u.v1extensions = toField(&f) - } else { - u.bytesExtensions = toField(&f) - } - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) - } - n-- - } - - // get oneof implementers - var oneofImplementers []interface{} - // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok && isOneofMessage { - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - } - } -} - -type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - ctype := false - isTime := false - isDuration := false - isWktPointer := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - if strings.HasPrefix(tags[i], "customtype=") { - ctype = true - } - if tags[i] == "stdtime" { - isTime = true - } - if tags[i] == "stdduration" { - isDuration = true - } - if tags[i] == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - if !proto3 && !pointer && !slice { - nozero = false - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - if pointer { - return makeCustomPtrMarshaler(getMarshalInfo(t)) - } - return makeCustomMarshaler(getMarshalInfo(t)) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeTimePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeTimePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeTimeSliceMarshaler(getMarshalInfo(t)) - } - return makeTimeMarshaler(getMarshalInfo(t)) - } - - if isDuration { - if pointer { - if slice { - return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationPtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeDurationSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationMarshaler(getMarshalInfo(t)) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValueMarshaler(getMarshalInfo(t)) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValueMarshaler(getMarshalInfo(t)) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValueMarshaler(getMarshalInfo(t)) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValueMarshaler(getMarshalInfo(t)) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValueMarshaler(getMarshalInfo(t)) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if pointer { - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } else { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageRefMarshaler(getMarshalInfo(t)) - } - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - tags := strings.Split(f.Tag.Get("protobuf"), ",") - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - stdOptions := false - for _, t := range tags { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "stdduration" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for id, e := range m { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return b, err - } - b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, id := range keys { - e := m[int32(id)] - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if p.deterministic { - if _, ok := pb.(Marshaler); ok { - return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) - } - } - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - var b []byte - b, err = m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go deleted file mode 100644 index 997f57c1..00000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go +++ /dev/null @@ -1,388 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -// makeMessageRefMarshaler differs a bit from makeMessageMarshaler -// It marshal a message T instead of a *T -func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - siz := u.size(ptr) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - b = appendVarint(b, wiretag) - siz := u.cachedsize(ptr) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, ptr, deterministic) - } -} - -// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler -// It marshals a slice of messages []T instead of []*T -func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - var err, errreq error - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - b = appendVarint(b, wiretag) - siz := u.size(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if err != nil { - if _, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errreq == nil { - errreq = err - } - continue - } - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - - return b, errreq - } -} - -func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go deleted file mode 100644 index f520106e..00000000 --- a/vendor/github.com/gogo/protobuf/proto/table_merge.go +++ /dev/null @@ -1,657 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - mfi := mergeFieldInfo{field: toField(&f)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case !isPointer: - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - mergeInfo.merge(dst, src) - } - case isSlice: // E.g., []*pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mergeInfo.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mergeInfo.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - mi.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - mi.unrecognized = toField(&f) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go deleted file mode 100644 index bb2622f2..00000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go +++ /dev/null @@ -1,2245 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*RequiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension - var e Extension - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc - break - } - if u.bytesExtensions.IsValid() { - z = m.offset(u.bytesExtensions).toBytes() - break - } - panic("no extensions field available") - } - } - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap[int32(tag)] = e - } - } - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - u.bytesExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { - u.oldExtensions = toField(&f) - continue - } else if f.Type == reflect.TypeOf(([]byte)(nil)) { - u.bytesExtensions = toField(&f) - continue - } - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") - // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler - if fn.IsValid() && len(oneofFields) > 0 { - res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} - for i := res.Len() - 1; i >= 0; i-- { - v := res.Index(i) // interface{} - tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - } - } - - // Get extension ranges, if any. - fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - ctype := false - isTime := false - isDuration := false - isWktPointer := false - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - if strings.HasPrefix(tag, "customtype=") { - ctype = true - } - if tag == "stdtime" { - isTime = true - } - if tag == "stdduration" { - isDuration = true - } - if tag == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) - } - if pointer { - return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalCustom(getUnmarshalInfo(t), name) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTime(getUnmarshalInfo(t), name) - } - - if isDuration { - if pointer { - if slice { - return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDuration(getUnmarshalInfo(t), name) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessage(getUnmarshalInfo(t), name) - } - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - tagArray := strings.Split(f.Tag.Get("protobuf"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - for _, t := range tagArray { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - } - if t == "stdduration" { - valTags = append(valTags, t) - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go deleted file mode 100644 index 00d6c7ad..00000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go +++ /dev/null @@ -1,385 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "io" - "reflect" -) - -func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f // gogo: changed from v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.New(sub.typ)) - m := s.Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := reflect.New(sub.typ) - c := m.Interface().(custom) - if err := c.Unmarshal(b[:x]); err != nil { - return nil, err - } - v := valToPointer(m) - f.appendRef(v, sub.typ) - return b[x:], nil - } -} - -func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - m := f.asPointerTo(sub.typ).Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&d)) - return b[x:], nil - } -} - -func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(d)) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&d)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(d)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go deleted file mode 100644 index 0407ba85..00000000 --- a/vendor/github.com/gogo/protobuf/proto/text.go +++ /dev/null @@ -1,928 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - "sync" - "time" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, v, props); err != nil { - return err - } - } else if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, fv, props); err != nil { - return err - } - } else if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv - if pv.CanAddr() { - pv = sv.Addr() - } else { - pv = reflect.New(sv.Type()) - pv.Elem().Set(sv) - } - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - if props != nil { - if len(props.CustomType) > 0 { - custom, ok := v.Interface().(Marshaler) - if ok { - data, err := custom.Marshal() - if err != nil { - return err - } - if err := writeString(w, string(data)); err != nil { - return err - } - return nil - } - } else if len(props.CastType) > 0 { - if _, ok := v.Interface().(interface { - String() string - }); ok { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - _, err := fmt.Fprintf(w, "%d", v.Interface()) - return err - } - } - } else if props.StdTime { - t, ok := v.Interface().(time.Time) - if !ok { - return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) - } - tproto, err := timestampProto(t) - if err != nil { - return err - } - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdTime = false - err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) - return err - } else if props.StdDuration { - d, ok := v.Interface().(time.Duration) - if !ok { - return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) - } - dproto := durationProto(d) - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdDuration = false - err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) - return err - } - } - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, ferr := fmt.Fprintf(w, "/* %v */\n", err) - return ferr - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, werr := w.Write(endBraceNewline); werr != nil { - return werr - } - continue - } - if _, ferr := fmt.Fprint(w, tag); ferr != nil { - return ferr - } - if wire != WireStartGroup { - if err = w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err = w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - e := pv.Interface().(Message) - - var m map[int32]Extension - var mu sync.Locker - if em, ok := e.(extensionsBytes); ok { - eb := em.GetExtensions() - var err error - m, err = BytesToExtensionsMap(*eb) - if err != nil { - return err - } - mu = notLocker{} - } else if _, ok := e.(extendableProto); ok { - ep, _ := extendable(e) - m, mu = ep.extensionsRead() - if m == nil { - return nil - } - } - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(e, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/vendor/github.com/gogo/protobuf/proto/text_gogo.go deleted file mode 100644 index 1d6c6aa0..00000000 --- a/vendor/github.com/gogo/protobuf/proto/text_gogo.go +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" -) - -func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { - m, ok := enumStringMaps[props.Enum] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - key := int32(0) - if v.Kind() == reflect.Ptr { - key = int32(v.Elem().Int()) - } else { - key = int32(v.Int()) - } - s, ok := m[key] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - _, err := fmt.Fprint(w, s) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go deleted file mode 100644 index 1ce0be2f..00000000 --- a/vendor/github.com/gogo/protobuf/proto/text_parser.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(i), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - if len(props.CustomType) > 0 { - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - tc := reflect.TypeOf(new(Marshaler)) - ok := t.Elem().Implements(tc.Elem()) - if ok { - fv := v - flen := fv.Len() - if flen == fv.Cap() { - nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) - reflect.Copy(nav, fv) - fv.Set(nav) - } - fv.SetLen(flen + 1) - - // Read one. - p.back() - return p.readAny(fv.Index(flen), props) - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.ValueOf(custom)) - } else { - custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.Indirect(reflect.ValueOf(custom))) - } - return nil - } - if props.StdTime { - fv := v - p.back() - props.StdTime = false - tproto := ×tamp{} - err := p.readAny(reflect.ValueOf(tproto).Elem(), props) - props.StdTime = true - if err != nil { - return err - } - tim, err := timestampFromProto(tproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ts := fv.Interface().([]*time.Time) - ts = append(ts, &tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } else { - ts := fv.Interface().([]time.Time) - ts = append(ts, tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&tim)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&tim))) - } - return nil - } - if props.StdDuration { - fv := v - p.back() - props.StdDuration = false - dproto := &duration{} - err := p.readAny(reflect.ValueOf(dproto).Elem(), props) - props.StdDuration = true - if err != nil { - return err - } - dur, err := durationFromProto(dproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ds := fv.Interface().([]*time.Duration) - ds = append(ds, &dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } else { - ds := fv.Interface().([]time.Duration) - ds = append(ds, dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&dur)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&dur))) - } - return nil - } - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - ntok := p.next() - if ntok.err != nil { - return ntok.err - } - if ntok.value == "]" { - break - } - if ntok.value != "," { - return p.errorf("Expected ']' or ',' found %q", ntok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int8: - if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int16: - if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint8: - if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint16: - if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp.go b/vendor/github.com/gogo/protobuf/proto/timestamp.go deleted file mode 100644 index 9324f654..00000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp.go +++ /dev/null @@ -1,113 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func timestampFromProto(ts *timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func timestampProto(t time.Time) (*timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := ×tamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go deleted file mode 100644 index 38439fa9..00000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() - -type timestamp struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *timestamp) Reset() { *m = timestamp{} } -func (*timestamp) ProtoMessage() {} -func (*timestamp) String() string { return "timestamp" } - -func init() { - RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers.go b/vendor/github.com/gogo/protobuf/proto/wrappers.go deleted file mode 100644 index b175d1b6..00000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers.go +++ /dev/null @@ -1,1888 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "io" - "reflect" -) - -func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go deleted file mode 100644 index c1cf7bf8..00000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go +++ /dev/null @@ -1,113 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -type float64Value struct { - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float64Value) Reset() { *m = float64Value{} } -func (*float64Value) ProtoMessage() {} -func (*float64Value) String() string { return "float64" } - -type float32Value struct { - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float32Value) Reset() { *m = float32Value{} } -func (*float32Value) ProtoMessage() {} -func (*float32Value) String() string { return "float32" } - -type int64Value struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int64Value) Reset() { *m = int64Value{} } -func (*int64Value) ProtoMessage() {} -func (*int64Value) String() string { return "int64" } - -type uint64Value struct { - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint64Value) Reset() { *m = uint64Value{} } -func (*uint64Value) ProtoMessage() {} -func (*uint64Value) String() string { return "uint64" } - -type int32Value struct { - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int32Value) Reset() { *m = int32Value{} } -func (*int32Value) ProtoMessage() {} -func (*int32Value) String() string { return "int32" } - -type uint32Value struct { - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint32Value) Reset() { *m = uint32Value{} } -func (*uint32Value) ProtoMessage() {} -func (*uint32Value) String() string { return "uint32" } - -type boolValue struct { - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *boolValue) Reset() { *m = boolValue{} } -func (*boolValue) ProtoMessage() {} -func (*boolValue) String() string { return "bool" } - -type stringValue struct { - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *stringValue) Reset() { *m = stringValue{} } -func (*stringValue) ProtoMessage() {} -func (*stringValue) String() string { return "string" } - -type bytesValue struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *bytesValue) Reset() { *m = bytesValue{} } -func (*bytesValue) ProtoMessage() {} -func (*bytesValue) String() string { return "[]byte" } - -func init() { - RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") - RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") - RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") - RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") - RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") - RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") - RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") - RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") - RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile deleted file mode 100644 index 3496dc99..00000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -regenerate: - go install github.com/gogo/protobuf/protoc-gen-gogo - go install github.com/gogo/protobuf/protoc-gen-gostring - protoc --gogo_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto - protoc --gostring_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go deleted file mode 100644 index a85bf198..00000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go +++ /dev/null @@ -1,118 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Package descriptor provides functions for obtaining protocol buffer -// descriptors for generated Go types. -// -// These functions cannot go in package proto because they depend on the -// generated protobuf descriptor messages, which themselves depend on proto. -package descriptor - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - - "github.com/gogo/protobuf/proto" -) - -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) - } - defer r.Close() - - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) - } - - fd := new(FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) - } - - return fd, nil -} - -// Message is a proto.Message with a method to return its descriptor. -// -// Message types generated by the protocol compiler always satisfy -// the Message interface. -type Message interface { - proto.Message - Descriptor() ([]byte, []int) -} - -// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it -// describing the given message. -func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { - gz, path := msg.Descriptor() - fd, err := extractFile(gz) - if err != nil { - panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) - } - - md = fd.MessageType[path[0]] - for _, i := range path[1:] { - md = md.NestedType[i] - } - return fd, md -} - -// Is this field a scalar numeric type? -func (field *FieldDescriptorProto) IsScalar() bool { - if field.Type == nil { - return false - } - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE, - FieldDescriptorProto_TYPE_FLOAT, - FieldDescriptorProto_TYPE_INT64, - FieldDescriptorProto_TYPE_UINT64, - FieldDescriptorProto_TYPE_INT32, - FieldDescriptorProto_TYPE_FIXED64, - FieldDescriptorProto_TYPE_FIXED32, - FieldDescriptorProto_TYPE_BOOL, - FieldDescriptorProto_TYPE_UINT32, - FieldDescriptorProto_TYPE_ENUM, - FieldDescriptorProto_TYPE_SFIXED32, - FieldDescriptorProto_TYPE_SFIXED64, - FieldDescriptorProto_TYPE_SINT32, - FieldDescriptorProto_TYPE_SINT64: - return true - default: - return false - } -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go deleted file mode 100644 index cacfa392..00000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go +++ /dev/null @@ -1,2865 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type FieldDescriptorProto_Type int32 - -const ( - // 0 is reserved for errors. - // Order is weird for historical reasons. - FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 - FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 - FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 - FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 - FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 - FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 - FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 - FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 - // New in version 2. - FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 - FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 - FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 - FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 - FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 - FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 - FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 -) - -var FieldDescriptorProto_Type_name = map[int32]string{ - 1: "TYPE_DOUBLE", - 2: "TYPE_FLOAT", - 3: "TYPE_INT64", - 4: "TYPE_UINT64", - 5: "TYPE_INT32", - 6: "TYPE_FIXED64", - 7: "TYPE_FIXED32", - 8: "TYPE_BOOL", - 9: "TYPE_STRING", - 10: "TYPE_GROUP", - 11: "TYPE_MESSAGE", - 12: "TYPE_BYTES", - 13: "TYPE_UINT32", - 14: "TYPE_ENUM", - 15: "TYPE_SFIXED32", - 16: "TYPE_SFIXED64", - 17: "TYPE_SINT32", - 18: "TYPE_SINT64", -} - -var FieldDescriptorProto_Type_value = map[string]int32{ - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18, -} - -func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { - p := new(FieldDescriptorProto_Type) - *p = x - return p -} - -func (x FieldDescriptorProto_Type) String() string { - return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) -} - -func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") - if err != nil { - return err - } - *x = FieldDescriptorProto_Type(value) - return nil -} - -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 0} -} - -type FieldDescriptorProto_Label int32 - -const ( - // 0 is reserved for errors - FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 - FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 -) - -var FieldDescriptorProto_Label_name = map[int32]string{ - 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", - 3: "LABEL_REPEATED", -} - -var FieldDescriptorProto_Label_value = map[string]int32{ - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3, -} - -func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { - p := new(FieldDescriptorProto_Label) - *p = x - return p -} - -func (x FieldDescriptorProto_Label) String() string { - return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) -} - -func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") - if err != nil { - return err - } - *x = FieldDescriptorProto_Label(value) - return nil -} - -func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4, 1} -} - -// Generated classes can be optimized for speed or code size. -type FileOptions_OptimizeMode int32 - -const ( - FileOptions_SPEED FileOptions_OptimizeMode = 1 - // etc. - FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 - FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 -) - -var FileOptions_OptimizeMode_name = map[int32]string{ - 1: "SPEED", - 2: "CODE_SIZE", - 3: "LITE_RUNTIME", -} - -var FileOptions_OptimizeMode_value = map[string]int32{ - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3, -} - -func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { - p := new(FileOptions_OptimizeMode) - *p = x - return p -} - -func (x FileOptions_OptimizeMode) String() string { - return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) -} - -func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") - if err != nil { - return err - } - *x = FileOptions_OptimizeMode(value) - return nil -} - -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10, 0} -} - -type FieldOptions_CType int32 - -const ( - // Default mode. - FieldOptions_STRING FieldOptions_CType = 0 - FieldOptions_CORD FieldOptions_CType = 1 - FieldOptions_STRING_PIECE FieldOptions_CType = 2 -) - -var FieldOptions_CType_name = map[int32]string{ - 0: "STRING", - 1: "CORD", - 2: "STRING_PIECE", -} - -var FieldOptions_CType_value = map[string]int32{ - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2, -} - -func (x FieldOptions_CType) Enum() *FieldOptions_CType { - p := new(FieldOptions_CType) - *p = x - return p -} - -func (x FieldOptions_CType) String() string { - return proto.EnumName(FieldOptions_CType_name, int32(x)) -} - -func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") - if err != nil { - return err - } - *x = FieldOptions_CType(value) - return nil -} - -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 0} -} - -type FieldOptions_JSType int32 - -const ( - // Use the default type. - FieldOptions_JS_NORMAL FieldOptions_JSType = 0 - // Use JavaScript strings. - FieldOptions_JS_STRING FieldOptions_JSType = 1 - // Use JavaScript numbers. - FieldOptions_JS_NUMBER FieldOptions_JSType = 2 -) - -var FieldOptions_JSType_name = map[int32]string{ - 0: "JS_NORMAL", - 1: "JS_STRING", - 2: "JS_NUMBER", -} - -var FieldOptions_JSType_value = map[string]int32{ - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2, -} - -func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { - p := new(FieldOptions_JSType) - *p = x - return p -} - -func (x FieldOptions_JSType) String() string { - return proto.EnumName(FieldOptions_JSType_name, int32(x)) -} - -func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") - if err != nil { - return err - } - *x = FieldOptions_JSType(value) - return nil -} - -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12, 1} -} - -// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, -// or neither? HTTP based RPC implementation may choose GET verb for safe -// methods, and PUT verb for idempotent methods instead of the default POST. -type MethodOptions_IdempotencyLevel int32 - -const ( - MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 - MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 - MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 -) - -var MethodOptions_IdempotencyLevel_name = map[int32]string{ - 0: "IDEMPOTENCY_UNKNOWN", - 1: "NO_SIDE_EFFECTS", - 2: "IDEMPOTENT", -} - -var MethodOptions_IdempotencyLevel_value = map[string]int32{ - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2, -} - -func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { - p := new(MethodOptions_IdempotencyLevel) - *p = x - return p -} - -func (x MethodOptions_IdempotencyLevel) String() string { - return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) -} - -func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") - if err != nil { - return err - } - *x = MethodOptions_IdempotencyLevel(value) - return nil -} - -func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17, 0} -} - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{0} -} -func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) -} -func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) -} -func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorSet.Merge(m, src) -} -func (m *FileDescriptorSet) XXX_Size() int { - return xxx_messageInfo_FileDescriptorSet.Size(m) -} -func (m *FileDescriptorSet) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo - -func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { - if m != nil { - return m.File - } - return nil -} - -// Describes a complete .proto file. -type FileDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` - // Names of files imported by this file. - Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` - // Indexes of the public imported files in the dependency list above. - PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` - // All top-level definitions in this file. - MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` - Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{1} -} -func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) -} -func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorProto.Merge(m, src) -} -func (m *FileDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FileDescriptorProto.Size(m) -} -func (m *FileDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo - -func (m *FileDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FileDescriptorProto) GetPackage() string { - if m != nil && m.Package != nil { - return *m.Package - } - return "" -} - -func (m *FileDescriptorProto) GetDependency() []string { - if m != nil { - return m.Dependency - } - return nil -} - -func (m *FileDescriptorProto) GetPublicDependency() []int32 { - if m != nil { - return m.PublicDependency - } - return nil -} - -func (m *FileDescriptorProto) GetWeakDependency() []int32 { - if m != nil { - return m.WeakDependency - } - return nil -} - -func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { - if m != nil { - return m.MessageType - } - return nil -} - -func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { - if m != nil { - return m.Service - } - return nil -} - -func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *FileDescriptorProto) GetOptions() *FileOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { - if m != nil { - return m.SourceCodeInfo - } - return nil -} - -func (m *FileDescriptorProto) GetSyntax() string { - if m != nil && m.Syntax != nil { - return *m.Syntax - } - return "" -} - -// Describes a message type. -type DescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` - NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` - OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` - Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` - ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2} -} -func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) -} -func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) -} -func (m *DescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto.Merge(m, src) -} -func (m *DescriptorProto) XXX_Size() int { - return xxx_messageInfo_DescriptorProto.Size(m) -} -func (m *DescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo - -func (m *DescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *DescriptorProto) GetField() []*FieldDescriptorProto { - if m != nil { - return m.Field - } - return nil -} - -func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *DescriptorProto) GetNestedType() []*DescriptorProto { - if m != nil { - return m.NestedType - } - return nil -} - -func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { - if m != nil { - return m.ExtensionRange - } - return nil -} - -func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { - if m != nil { - return m.OneofDecl - } - return nil -} - -func (m *DescriptorProto) GetOptions() *MessageOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *DescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 0} -} -func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) -} -func (m *DescriptorProto_ExtensionRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) -} -func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo - -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { - if m != nil { - return m.Options - } - return nil -} - -// Range of reserved tag numbers. Reserved tag numbers may not be used by -// fields or extension ranges in the same message. Reserved ranges may -// not overlap. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{2, 1} -} -func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) -} -func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) -} -func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) -} -func (m *DescriptorProto_ReservedRange) XXX_Size() int { - return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) -} -func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo - -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -type ExtensionRangeOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } -func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } -func (*ExtensionRangeOptions) ProtoMessage() {} -func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{3} -} - -var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ExtensionRangeOptions -} - -func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) -} -func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) -} -func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) -} -func (m *ExtensionRangeOptions) XXX_Size() int { - return xxx_messageInfo_ExtensionRangeOptions.Size(m) -} -func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo - -func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// Describes a field within a message. -type FieldDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` - Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{4} -} -func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) -} -func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) -} -func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldDescriptorProto.Merge(m, src) -} -func (m *FieldDescriptorProto) XXX_Size() int { - return xxx_messageInfo_FieldDescriptorProto.Size(m) -} -func (m *FieldDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo - -func (m *FieldDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FieldDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { - if m != nil && m.Label != nil { - return *m.Label - } - return FieldDescriptorProto_LABEL_OPTIONAL -} - -func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return FieldDescriptorProto_TYPE_DOUBLE -} - -func (m *FieldDescriptorProto) GetTypeName() string { - if m != nil && m.TypeName != nil { - return *m.TypeName - } - return "" -} - -func (m *FieldDescriptorProto) GetExtendee() string { - if m != nil && m.Extendee != nil { - return *m.Extendee - } - return "" -} - -func (m *FieldDescriptorProto) GetDefaultValue() string { - if m != nil && m.DefaultValue != nil { - return *m.DefaultValue - } - return "" -} - -func (m *FieldDescriptorProto) GetOneofIndex() int32 { - if m != nil && m.OneofIndex != nil { - return *m.OneofIndex - } - return 0 -} - -func (m *FieldDescriptorProto) GetJsonName() string { - if m != nil && m.JsonName != nil { - return *m.JsonName - } - return "" -} - -func (m *FieldDescriptorProto) GetOptions() *FieldOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a oneof. -type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{5} -} -func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) -} -func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) -} -func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofDescriptorProto.Merge(m, src) -} -func (m *OneofDescriptorProto) XXX_Size() int { - return xxx_messageInfo_OneofDescriptorProto.Size(m) -} -func (m *OneofDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo - -func (m *OneofDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OneofDescriptorProto) GetOptions() *OneofOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes an enum type. -type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6} -} -func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) -} -func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto.Merge(m, src) -} -func (m *EnumDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto.Size(m) -} -func (m *EnumDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo - -func (m *EnumDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { - if m != nil { - return m.Value - } - return nil -} - -func (m *EnumDescriptorProto) GetOptions() *EnumOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *EnumDescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -// Range of reserved numeric values. Reserved values may not be used by -// entries in the same enum. Reserved ranges may not overlap. -// -// Note that this is distinct from DescriptorProto.ReservedRange in that it -// is inclusive such that it can appropriately represent the entire int32 -// domain. -type EnumDescriptorProto_EnumReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } -func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} -func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{6, 0} -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { - return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) -} -func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { - xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo - -func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -// Describes a value within an enum. -type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{7} -} -func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) -} -func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) -} -func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) -} -func (m *EnumValueDescriptorProto) XXX_Size() int { - return xxx_messageInfo_EnumValueDescriptorProto.Size(m) -} -func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo - -func (m *EnumValueDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumValueDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a service. -type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{8} -} -func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) -} -func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) -} -func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) -} -func (m *ServiceDescriptorProto) XXX_Size() int { - return xxx_messageInfo_ServiceDescriptorProto.Size(m) -} -func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo - -func (m *ServiceDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { - if m != nil { - return m.Method - } - return nil -} - -func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a method of a service. -type MethodDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` - OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` - Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` - // Identifies if client streams multiple client messages - ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` - // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{9} -} -func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) -} -func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) -} -func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodDescriptorProto.Merge(m, src) -} -func (m *MethodDescriptorProto) XXX_Size() int { - return xxx_messageInfo_MethodDescriptorProto.Size(m) -} -func (m *MethodDescriptorProto) XXX_DiscardUnknown() { - xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo - -const Default_MethodDescriptorProto_ClientStreaming bool = false -const Default_MethodDescriptorProto_ServerStreaming bool = false - -func (m *MethodDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MethodDescriptorProto) GetInputType() string { - if m != nil && m.InputType != nil { - return *m.InputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOutputType() string { - if m != nil && m.OutputType != nil { - return *m.OutputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOptions() *MethodOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *MethodDescriptorProto) GetClientStreaming() bool { - if m != nil && m.ClientStreaming != nil { - return *m.ClientStreaming - } - return Default_MethodDescriptorProto_ClientStreaming -} - -func (m *MethodDescriptorProto) GetServerStreaming() bool { - if m != nil && m.ServerStreaming != nil { - return *m.ServerStreaming - } - return Default_MethodDescriptorProto_ServerStreaming -} - -type FileOptions struct { - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` - // This option does nothing. - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` - OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` - JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` - PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` - // Namespace for generated classes; defaults to the package. - CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be used - // for determining the namespace. - PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{10} -} - -var extRange_FileOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FileOptions -} - -func (m *FileOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FileOptions.Unmarshal(m, b) -} -func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) -} -func (m *FileOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileOptions.Merge(m, src) -} -func (m *FileOptions) XXX_Size() int { - return xxx_messageInfo_FileOptions.Size(m) -} -func (m *FileOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FileOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FileOptions proto.InternalMessageInfo - -const Default_FileOptions_JavaMultipleFiles bool = false -const Default_FileOptions_JavaStringCheckUtf8 bool = false -const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED -const Default_FileOptions_CcGenericServices bool = false -const Default_FileOptions_JavaGenericServices bool = false -const Default_FileOptions_PyGenericServices bool = false -const Default_FileOptions_PhpGenericServices bool = false -const Default_FileOptions_Deprecated bool = false -const Default_FileOptions_CcEnableArenas bool = false - -func (m *FileOptions) GetJavaPackage() string { - if m != nil && m.JavaPackage != nil { - return *m.JavaPackage - } - return "" -} - -func (m *FileOptions) GetJavaOuterClassname() string { - if m != nil && m.JavaOuterClassname != nil { - return *m.JavaOuterClassname - } - return "" -} - -func (m *FileOptions) GetJavaMultipleFiles() bool { - if m != nil && m.JavaMultipleFiles != nil { - return *m.JavaMultipleFiles - } - return Default_FileOptions_JavaMultipleFiles -} - -// Deprecated: Do not use. -func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { - if m != nil && m.JavaGenerateEqualsAndHash != nil { - return *m.JavaGenerateEqualsAndHash - } - return false -} - -func (m *FileOptions) GetJavaStringCheckUtf8() bool { - if m != nil && m.JavaStringCheckUtf8 != nil { - return *m.JavaStringCheckUtf8 - } - return Default_FileOptions_JavaStringCheckUtf8 -} - -func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { - if m != nil && m.OptimizeFor != nil { - return *m.OptimizeFor - } - return Default_FileOptions_OptimizeFor -} - -func (m *FileOptions) GetGoPackage() string { - if m != nil && m.GoPackage != nil { - return *m.GoPackage - } - return "" -} - -func (m *FileOptions) GetCcGenericServices() bool { - if m != nil && m.CcGenericServices != nil { - return *m.CcGenericServices - } - return Default_FileOptions_CcGenericServices -} - -func (m *FileOptions) GetJavaGenericServices() bool { - if m != nil && m.JavaGenericServices != nil { - return *m.JavaGenericServices - } - return Default_FileOptions_JavaGenericServices -} - -func (m *FileOptions) GetPyGenericServices() bool { - if m != nil && m.PyGenericServices != nil { - return *m.PyGenericServices - } - return Default_FileOptions_PyGenericServices -} - -func (m *FileOptions) GetPhpGenericServices() bool { - if m != nil && m.PhpGenericServices != nil { - return *m.PhpGenericServices - } - return Default_FileOptions_PhpGenericServices -} - -func (m *FileOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FileOptions_Deprecated -} - -func (m *FileOptions) GetCcEnableArenas() bool { - if m != nil && m.CcEnableArenas != nil { - return *m.CcEnableArenas - } - return Default_FileOptions_CcEnableArenas -} - -func (m *FileOptions) GetObjcClassPrefix() string { - if m != nil && m.ObjcClassPrefix != nil { - return *m.ObjcClassPrefix - } - return "" -} - -func (m *FileOptions) GetCsharpNamespace() string { - if m != nil && m.CsharpNamespace != nil { - return *m.CsharpNamespace - } - return "" -} - -func (m *FileOptions) GetSwiftPrefix() string { - if m != nil && m.SwiftPrefix != nil { - return *m.SwiftPrefix - } - return "" -} - -func (m *FileOptions) GetPhpClassPrefix() string { - if m != nil && m.PhpClassPrefix != nil { - return *m.PhpClassPrefix - } - return "" -} - -func (m *FileOptions) GetPhpNamespace() string { - if m != nil && m.PhpNamespace != nil { - return *m.PhpNamespace - } - return "" -} - -func (m *FileOptions) GetPhpMetadataNamespace() string { - if m != nil && m.PhpMetadataNamespace != nil { - return *m.PhpMetadataNamespace - } - return "" -} - -func (m *FileOptions) GetRubyPackage() string { - if m != nil && m.RubyPackage != nil { - return *m.RubyPackage - } - return "" -} - -func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MessageOptions struct { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{11} -} - -var extRange_MessageOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MessageOptions -} - -func (m *MessageOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageOptions.Unmarshal(m, b) -} -func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) -} -func (m *MessageOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageOptions.Merge(m, src) -} -func (m *MessageOptions) XXX_Size() int { - return xxx_messageInfo_MessageOptions.Size(m) -} -func (m *MessageOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MessageOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageOptions proto.InternalMessageInfo - -const Default_MessageOptions_MessageSetWireFormat bool = false -const Default_MessageOptions_NoStandardDescriptorAccessor bool = false -const Default_MessageOptions_Deprecated bool = false - -func (m *MessageOptions) GetMessageSetWireFormat() bool { - if m != nil && m.MessageSetWireFormat != nil { - return *m.MessageSetWireFormat - } - return Default_MessageOptions_MessageSetWireFormat -} - -func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { - if m != nil && m.NoStandardDescriptorAccessor != nil { - return *m.NoStandardDescriptorAccessor - } - return Default_MessageOptions_NoStandardDescriptorAccessor -} - -func (m *MessageOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MessageOptions_Deprecated -} - -func (m *MessageOptions) GetMapEntry() bool { - if m != nil && m.MapEntry != nil { - return *m.MapEntry - } - return false -} - -func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type FieldOptions struct { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // For Google-internal migration only. Do not use. - Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{12} -} - -var extRange_FieldOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FieldOptions -} - -func (m *FieldOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldOptions.Unmarshal(m, b) -} -func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) -} -func (m *FieldOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldOptions.Merge(m, src) -} -func (m *FieldOptions) XXX_Size() int { - return xxx_messageInfo_FieldOptions.Size(m) -} -func (m *FieldOptions) XXX_DiscardUnknown() { - xxx_messageInfo_FieldOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldOptions proto.InternalMessageInfo - -const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING -const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL -const Default_FieldOptions_Lazy bool = false -const Default_FieldOptions_Deprecated bool = false -const Default_FieldOptions_Weak bool = false - -func (m *FieldOptions) GetCtype() FieldOptions_CType { - if m != nil && m.Ctype != nil { - return *m.Ctype - } - return Default_FieldOptions_Ctype -} - -func (m *FieldOptions) GetPacked() bool { - if m != nil && m.Packed != nil { - return *m.Packed - } - return false -} - -func (m *FieldOptions) GetJstype() FieldOptions_JSType { - if m != nil && m.Jstype != nil { - return *m.Jstype - } - return Default_FieldOptions_Jstype -} - -func (m *FieldOptions) GetLazy() bool { - if m != nil && m.Lazy != nil { - return *m.Lazy - } - return Default_FieldOptions_Lazy -} - -func (m *FieldOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FieldOptions_Deprecated -} - -func (m *FieldOptions) GetWeak() bool { - if m != nil && m.Weak != nil { - return *m.Weak - } - return Default_FieldOptions_Weak -} - -func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type OneofOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{13} -} - -var extRange_OneofOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OneofOptions -} - -func (m *OneofOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OneofOptions.Unmarshal(m, b) -} -func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) -} -func (m *OneofOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_OneofOptions.Merge(m, src) -} -func (m *OneofOptions) XXX_Size() int { - return xxx_messageInfo_OneofOptions.Size(m) -} -func (m *OneofOptions) XXX_DiscardUnknown() { - xxx_messageInfo_OneofOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_OneofOptions proto.InternalMessageInfo - -func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumOptions struct { - // Set this option to true to allow mapping different tag names to the same - // value. - AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{14} -} - -var extRange_EnumOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumOptions -} - -func (m *EnumOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumOptions.Unmarshal(m, b) -} -func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) -} -func (m *EnumOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumOptions.Merge(m, src) -} -func (m *EnumOptions) XXX_Size() int { - return xxx_messageInfo_EnumOptions.Size(m) -} -func (m *EnumOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumOptions proto.InternalMessageInfo - -const Default_EnumOptions_Deprecated bool = false - -func (m *EnumOptions) GetAllowAlias() bool { - if m != nil && m.AllowAlias != nil { - return *m.AllowAlias - } - return false -} - -func (m *EnumOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumOptions_Deprecated -} - -func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumValueOptions struct { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{15} -} - -var extRange_EnumValueOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumValueOptions -} - -func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) -} -func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) -} -func (m *EnumValueOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumValueOptions.Merge(m, src) -} -func (m *EnumValueOptions) XXX_Size() int { - return xxx_messageInfo_EnumValueOptions.Size(m) -} -func (m *EnumValueOptions) XXX_DiscardUnknown() { - xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo - -const Default_EnumValueOptions_Deprecated bool = false - -func (m *EnumValueOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumValueOptions_Deprecated -} - -func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type ServiceOptions struct { - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{16} -} - -var extRange_ServiceOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ServiceOptions -} - -func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) -} -func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) -} -func (m *ServiceOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceOptions.Merge(m, src) -} -func (m *ServiceOptions) XXX_Size() int { - return xxx_messageInfo_ServiceOptions.Size(m) -} -func (m *ServiceOptions) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo - -const Default_ServiceOptions_Deprecated bool = false - -func (m *ServiceOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_ServiceOptions_Deprecated -} - -func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MethodOptions struct { - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{17} -} - -var extRange_MethodOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MethodOptions -} - -func (m *MethodOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MethodOptions.Unmarshal(m, b) -} -func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) -} -func (m *MethodOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_MethodOptions.Merge(m, src) -} -func (m *MethodOptions) XXX_Size() int { - return xxx_messageInfo_MethodOptions.Size(m) -} -func (m *MethodOptions) XXX_DiscardUnknown() { - xxx_messageInfo_MethodOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_MethodOptions proto.InternalMessageInfo - -const Default_MethodOptions_Deprecated bool = false -const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN - -func (m *MethodOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MethodOptions_Deprecated -} - -func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { - if m != nil && m.IdempotencyLevel != nil { - return *m.IdempotencyLevel - } - return Default_MethodOptions_IdempotencyLevel -} - -func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -type UninterpretedOption struct { - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18} -} -func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) -} -func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption.Merge(m, src) -} -func (m *UninterpretedOption) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption.Size(m) -} -func (m *UninterpretedOption) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo - -func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { - if m != nil { - return m.Name - } - return nil -} - -func (m *UninterpretedOption) GetIdentifierValue() string { - if m != nil && m.IdentifierValue != nil { - return *m.IdentifierValue - } - return "" -} - -func (m *UninterpretedOption) GetPositiveIntValue() uint64 { - if m != nil && m.PositiveIntValue != nil { - return *m.PositiveIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetNegativeIntValue() int64 { - if m != nil && m.NegativeIntValue != nil { - return *m.NegativeIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *UninterpretedOption) GetStringValue() []byte { - if m != nil { - return m.StringValue - } - return nil -} - -func (m *UninterpretedOption) GetAggregateValue() string { - if m != nil && m.AggregateValue != nil { - return *m.AggregateValue - } - return "" -} - -// The name of the uninterpreted option. Each string represents a segment in -// a dot-separated name. is_extension is true iff a segment represents an -// extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{18, 0} -} -func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) -} -func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) -} -func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { - xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) -} -func (m *UninterpretedOption_NamePart) XXX_Size() int { - return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) -} -func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { - xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) -} - -var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo - -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} - -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -type SourceCodeInfo struct { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19} -} -func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) -} -func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo.Merge(m, src) -} -func (m *SourceCodeInfo) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo.Size(m) -} -func (m *SourceCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo - -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { - if m != nil { - return m.Location - } - return nil -} - -type SourceCodeInfo_Location struct { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` - TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` - LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{19, 0} -} -func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) -} -func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) -} -func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { - xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) -} -func (m *SourceCodeInfo_Location) XXX_Size() int { - return xxx_messageInfo_SourceCodeInfo_Location.Size(m) -} -func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { - xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) -} - -var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo - -func (m *SourceCodeInfo_Location) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *SourceCodeInfo_Location) GetSpan() []int32 { - if m != nil { - return m.Span - } - return nil -} - -func (m *SourceCodeInfo_Location) GetLeadingComments() string { - if m != nil && m.LeadingComments != nil { - return *m.LeadingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetTrailingComments() string { - if m != nil && m.TrailingComments != nil { - return *m.TrailingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { - if m != nil { - return m.LeadingDetachedComments - } - return nil -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20} -} -func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) -} -func (m *GeneratedCodeInfo) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo.Size(m) -} -func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo - -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - -type GeneratedCodeInfo_Annotation struct { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Identifies the filesystem path to the original source .proto. - SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} -func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptor_308767df5ffe18af, []int{20, 0} -} -func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { - xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) -} -func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { - return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) -} -func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { - xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) -} - -var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo - -func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { - if m != nil && m.SourceFile != nil { - return *m.SourceFile - } - return "" -} - -func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { - if m != nil && m.Begin != nil { - return *m.Begin - } - return 0 -} - -func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func init() { - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) - proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) - proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") - proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") - proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") -} - -func init() { proto.RegisterFile("descriptor.proto", fileDescriptor_308767df5ffe18af) } - -var fileDescriptor_308767df5ffe18af = []byte{ - // 2522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x5f, 0x7d, 0x5a, 0x7a, 0x92, 0x65, 0x7a, 0xec, 0x75, 0x18, 0xef, 0x47, 0x1c, 0xed, 0x66, - 0xe3, 0x24, 0xbb, 0xca, 0xc2, 0x49, 0x9c, 0xac, 0x53, 0x6c, 0x2b, 0x4b, 0x8c, 0x57, 0xa9, 0xbe, - 0x4a, 0xc9, 0xdd, 0x64, 0x8b, 0x82, 0x18, 0x93, 0x23, 0x89, 0x09, 0x45, 0x72, 0x49, 0x2a, 0x89, - 0x83, 0x1e, 0x02, 0xf4, 0x54, 0xa0, 0x7f, 0x40, 0x51, 0x14, 0x3d, 0xf4, 0xb2, 0x40, 0xff, 0x80, - 0x02, 0xed, 0xbd, 0xd7, 0x02, 0xbd, 0xf7, 0x50, 0xa0, 0x05, 0xda, 0x3f, 0xa1, 0xc7, 0x62, 0x66, - 0x48, 0x8a, 0xd4, 0x47, 0xe2, 0x5d, 0x20, 0xd9, 0x93, 0x3d, 0xef, 0xfd, 0xde, 0x9b, 0x37, 0x8f, - 0xbf, 0x79, 0xf3, 0x66, 0x04, 0x82, 0x46, 0x5c, 0xd5, 0xd1, 0x6d, 0xcf, 0x72, 0x2a, 0xb6, 0x63, - 0x79, 0x16, 0x5a, 0x1b, 0x5a, 0xd6, 0xd0, 0x20, 0x7c, 0x74, 0x32, 0x19, 0x94, 0x5b, 0xb0, 0x7e, - 0x4f, 0x37, 0x48, 0x3d, 0x04, 0xf6, 0x88, 0x87, 0xee, 0x40, 0x7a, 0xa0, 0x1b, 0x44, 0x4c, 0xec, - 0xa4, 0x76, 0x0b, 0x7b, 0x1f, 0x56, 0x66, 0x8c, 0x2a, 0x71, 0x8b, 0x2e, 0x15, 0xcb, 0xcc, 0xa2, - 0xfc, 0xef, 0x34, 0x6c, 0x2c, 0xd0, 0x22, 0x04, 0x69, 0x13, 0x8f, 0xa9, 0xc7, 0xc4, 0x6e, 0x5e, - 0x66, 0xff, 0x23, 0x11, 0x56, 0x6c, 0xac, 0x3e, 0xc6, 0x43, 0x22, 0x26, 0x99, 0x38, 0x18, 0xa2, - 0xf7, 0x01, 0x34, 0x62, 0x13, 0x53, 0x23, 0xa6, 0x7a, 0x2a, 0xa6, 0x76, 0x52, 0xbb, 0x79, 0x39, - 0x22, 0x41, 0xd7, 0x60, 0xdd, 0x9e, 0x9c, 0x18, 0xba, 0xaa, 0x44, 0x60, 0xb0, 0x93, 0xda, 0xcd, - 0xc8, 0x02, 0x57, 0xd4, 0xa7, 0xe0, 0xcb, 0xb0, 0xf6, 0x94, 0xe0, 0xc7, 0x51, 0x68, 0x81, 0x41, - 0x4b, 0x54, 0x1c, 0x01, 0xd6, 0xa0, 0x38, 0x26, 0xae, 0x8b, 0x87, 0x44, 0xf1, 0x4e, 0x6d, 0x22, - 0xa6, 0xd9, 0xea, 0x77, 0xe6, 0x56, 0x3f, 0xbb, 0xf2, 0x82, 0x6f, 0xd5, 0x3f, 0xb5, 0x09, 0xaa, - 0x42, 0x9e, 0x98, 0x93, 0x31, 0xf7, 0x90, 0x59, 0x92, 0x3f, 0xc9, 0x9c, 0x8c, 0x67, 0xbd, 0xe4, - 0xa8, 0x99, 0xef, 0x62, 0xc5, 0x25, 0xce, 0x13, 0x5d, 0x25, 0x62, 0x96, 0x39, 0xb8, 0x3c, 0xe7, - 0xa0, 0xc7, 0xf5, 0xb3, 0x3e, 0x02, 0x3b, 0x54, 0x83, 0x3c, 0x79, 0xe6, 0x11, 0xd3, 0xd5, 0x2d, - 0x53, 0x5c, 0x61, 0x4e, 0x2e, 0x2d, 0xf8, 0x8a, 0xc4, 0xd0, 0x66, 0x5d, 0x4c, 0xed, 0xd0, 0x3e, - 0xac, 0x58, 0xb6, 0xa7, 0x5b, 0xa6, 0x2b, 0xe6, 0x76, 0x12, 0xbb, 0x85, 0xbd, 0x77, 0x17, 0x12, - 0xa1, 0xc3, 0x31, 0x72, 0x00, 0x46, 0x0d, 0x10, 0x5c, 0x6b, 0xe2, 0xa8, 0x44, 0x51, 0x2d, 0x8d, - 0x28, 0xba, 0x39, 0xb0, 0xc4, 0x3c, 0x73, 0x70, 0x61, 0x7e, 0x21, 0x0c, 0x58, 0xb3, 0x34, 0xd2, - 0x30, 0x07, 0x96, 0x5c, 0x72, 0x63, 0x63, 0xb4, 0x05, 0x59, 0xf7, 0xd4, 0xf4, 0xf0, 0x33, 0xb1, - 0xc8, 0x18, 0xe2, 0x8f, 0xca, 0x7f, 0xce, 0xc2, 0xda, 0x59, 0x28, 0x76, 0x17, 0x32, 0x03, 0xba, - 0x4a, 0x31, 0xf9, 0x6d, 0x72, 0xc0, 0x6d, 0xe2, 0x49, 0xcc, 0x7e, 0xc7, 0x24, 0x56, 0xa1, 0x60, - 0x12, 0xd7, 0x23, 0x1a, 0x67, 0x44, 0xea, 0x8c, 0x9c, 0x02, 0x6e, 0x34, 0x4f, 0xa9, 0xf4, 0x77, - 0xa2, 0xd4, 0x03, 0x58, 0x0b, 0x43, 0x52, 0x1c, 0x6c, 0x0e, 0x03, 0x6e, 0x5e, 0x7f, 0x55, 0x24, - 0x15, 0x29, 0xb0, 0x93, 0xa9, 0x99, 0x5c, 0x22, 0xb1, 0x31, 0xaa, 0x03, 0x58, 0x26, 0xb1, 0x06, - 0x8a, 0x46, 0x54, 0x43, 0xcc, 0x2d, 0xc9, 0x52, 0x87, 0x42, 0xe6, 0xb2, 0x64, 0x71, 0xa9, 0x6a, - 0xa0, 0xcf, 0xa6, 0x54, 0x5b, 0x59, 0xc2, 0x94, 0x16, 0xdf, 0x64, 0x73, 0x6c, 0x3b, 0x86, 0x92, - 0x43, 0x28, 0xef, 0x89, 0xe6, 0xaf, 0x2c, 0xcf, 0x82, 0xa8, 0xbc, 0x72, 0x65, 0xb2, 0x6f, 0xc6, - 0x17, 0xb6, 0xea, 0x44, 0x87, 0xe8, 0x03, 0x08, 0x05, 0x0a, 0xa3, 0x15, 0xb0, 0x2a, 0x54, 0x0c, - 0x84, 0x6d, 0x3c, 0x26, 0xdb, 0xcf, 0xa1, 0x14, 0x4f, 0x0f, 0xda, 0x84, 0x8c, 0xeb, 0x61, 0xc7, - 0x63, 0x2c, 0xcc, 0xc8, 0x7c, 0x80, 0x04, 0x48, 0x11, 0x53, 0x63, 0x55, 0x2e, 0x23, 0xd3, 0x7f, - 0xd1, 0x8f, 0xa6, 0x0b, 0x4e, 0xb1, 0x05, 0x7f, 0x34, 0xff, 0x45, 0x63, 0x9e, 0x67, 0xd7, 0xbd, - 0x7d, 0x1b, 0x56, 0x63, 0x0b, 0x38, 0xeb, 0xd4, 0xe5, 0x5f, 0xc0, 0xdb, 0x0b, 0x5d, 0xa3, 0x07, - 0xb0, 0x39, 0x31, 0x75, 0xd3, 0x23, 0x8e, 0xed, 0x10, 0xca, 0x58, 0x3e, 0x95, 0xf8, 0x9f, 0x95, - 0x25, 0x9c, 0x3b, 0x8e, 0xa2, 0xb9, 0x17, 0x79, 0x63, 0x32, 0x2f, 0xbc, 0x9a, 0xcf, 0xfd, 0x77, - 0x45, 0x78, 0xf1, 0xe2, 0xc5, 0x8b, 0x64, 0xf9, 0x37, 0x59, 0xd8, 0x5c, 0xb4, 0x67, 0x16, 0x6e, - 0xdf, 0x2d, 0xc8, 0x9a, 0x93, 0xf1, 0x09, 0x71, 0x58, 0x92, 0x32, 0xb2, 0x3f, 0x42, 0x55, 0xc8, - 0x18, 0xf8, 0x84, 0x18, 0x62, 0x7a, 0x27, 0xb1, 0x5b, 0xda, 0xbb, 0x76, 0xa6, 0x5d, 0x59, 0x69, - 0x52, 0x13, 0x99, 0x5b, 0xa2, 0xcf, 0x21, 0xed, 0x97, 0x68, 0xea, 0xe1, 0xea, 0xd9, 0x3c, 0xd0, - 0xbd, 0x24, 0x33, 0x3b, 0xf4, 0x0e, 0xe4, 0xe9, 0x5f, 0xce, 0x8d, 0x2c, 0x8b, 0x39, 0x47, 0x05, - 0x94, 0x17, 0x68, 0x1b, 0x72, 0x6c, 0x9b, 0x68, 0x24, 0x38, 0xda, 0xc2, 0x31, 0x25, 0x96, 0x46, - 0x06, 0x78, 0x62, 0x78, 0xca, 0x13, 0x6c, 0x4c, 0x08, 0x23, 0x7c, 0x5e, 0x2e, 0xfa, 0xc2, 0x9f, - 0x52, 0x19, 0xba, 0x00, 0x05, 0xbe, 0xab, 0x74, 0x53, 0x23, 0xcf, 0x58, 0xf5, 0xcc, 0xc8, 0x7c, - 0xa3, 0x35, 0xa8, 0x84, 0x4e, 0xff, 0xc8, 0xb5, 0xcc, 0x80, 0x9a, 0x6c, 0x0a, 0x2a, 0x60, 0xd3, - 0xdf, 0x9e, 0x2d, 0xdc, 0xef, 0x2d, 0x5e, 0xde, 0x2c, 0xa7, 0xca, 0x7f, 0x4a, 0x42, 0x9a, 0xd5, - 0x8b, 0x35, 0x28, 0xf4, 0x1f, 0x76, 0x25, 0xa5, 0xde, 0x39, 0x3e, 0x6c, 0x4a, 0x42, 0x02, 0x95, - 0x00, 0x98, 0xe0, 0x5e, 0xb3, 0x53, 0xed, 0x0b, 0xc9, 0x70, 0xdc, 0x68, 0xf7, 0xf7, 0x6f, 0x0a, - 0xa9, 0xd0, 0xe0, 0x98, 0x0b, 0xd2, 0x51, 0xc0, 0x8d, 0x3d, 0x21, 0x83, 0x04, 0x28, 0x72, 0x07, - 0x8d, 0x07, 0x52, 0x7d, 0xff, 0xa6, 0x90, 0x8d, 0x4b, 0x6e, 0xec, 0x09, 0x2b, 0x68, 0x15, 0xf2, - 0x4c, 0x72, 0xd8, 0xe9, 0x34, 0x85, 0x5c, 0xe8, 0xb3, 0xd7, 0x97, 0x1b, 0xed, 0x23, 0x21, 0x1f, - 0xfa, 0x3c, 0x92, 0x3b, 0xc7, 0x5d, 0x01, 0x42, 0x0f, 0x2d, 0xa9, 0xd7, 0xab, 0x1e, 0x49, 0x42, - 0x21, 0x44, 0x1c, 0x3e, 0xec, 0x4b, 0x3d, 0xa1, 0x18, 0x0b, 0xeb, 0xc6, 0x9e, 0xb0, 0x1a, 0x4e, - 0x21, 0xb5, 0x8f, 0x5b, 0x42, 0x09, 0xad, 0xc3, 0x2a, 0x9f, 0x22, 0x08, 0x62, 0x6d, 0x46, 0xb4, - 0x7f, 0x53, 0x10, 0xa6, 0x81, 0x70, 0x2f, 0xeb, 0x31, 0xc1, 0xfe, 0x4d, 0x01, 0x95, 0x6b, 0x90, - 0x61, 0xec, 0x42, 0x08, 0x4a, 0xcd, 0xea, 0xa1, 0xd4, 0x54, 0x3a, 0xdd, 0x7e, 0xa3, 0xd3, 0xae, - 0x36, 0x85, 0xc4, 0x54, 0x26, 0x4b, 0x3f, 0x39, 0x6e, 0xc8, 0x52, 0x5d, 0x48, 0x46, 0x65, 0x5d, - 0xa9, 0xda, 0x97, 0xea, 0x42, 0xaa, 0xac, 0xc2, 0xe6, 0xa2, 0x3a, 0xb9, 0x70, 0x67, 0x44, 0x3e, - 0x71, 0x72, 0xc9, 0x27, 0x66, 0xbe, 0xe6, 0x3e, 0xf1, 0xbf, 0x92, 0xb0, 0xb1, 0xe0, 0xac, 0x58, - 0x38, 0xc9, 0x0f, 0x21, 0xc3, 0x29, 0xca, 0x4f, 0xcf, 0x2b, 0x0b, 0x0f, 0x1d, 0x46, 0xd8, 0xb9, - 0x13, 0x94, 0xd9, 0x45, 0x3b, 0x88, 0xd4, 0x92, 0x0e, 0x82, 0xba, 0x98, 0xab, 0xe9, 0x3f, 0x9f, - 0xab, 0xe9, 0xfc, 0xd8, 0xdb, 0x3f, 0xcb, 0xb1, 0xc7, 0x64, 0xdf, 0xae, 0xb6, 0x67, 0x16, 0xd4, - 0xf6, 0xbb, 0xb0, 0x3e, 0xe7, 0xe8, 0xcc, 0x35, 0xf6, 0x97, 0x09, 0x10, 0x97, 0x25, 0xe7, 0x15, - 0x95, 0x2e, 0x19, 0xab, 0x74, 0x77, 0x67, 0x33, 0x78, 0x71, 0xf9, 0x47, 0x98, 0xfb, 0xd6, 0xdf, - 0x24, 0x60, 0x6b, 0x71, 0xa7, 0xb8, 0x30, 0x86, 0xcf, 0x21, 0x3b, 0x26, 0xde, 0xc8, 0x0a, 0xba, - 0xa5, 0x8f, 0x16, 0x9c, 0xc1, 0x54, 0x3d, 0xfb, 0xb1, 0x7d, 0xab, 0xe8, 0x21, 0x9e, 0x5a, 0xd6, - 0xee, 0xf1, 0x68, 0xe6, 0x22, 0xfd, 0x55, 0x12, 0xde, 0x5e, 0xe8, 0x7c, 0x61, 0xa0, 0xef, 0x01, - 0xe8, 0xa6, 0x3d, 0xf1, 0x78, 0x47, 0xc4, 0x0b, 0x6c, 0x9e, 0x49, 0x58, 0xf1, 0xa2, 0xc5, 0x73, - 0xe2, 0x85, 0xfa, 0x14, 0xd3, 0x03, 0x17, 0x31, 0xc0, 0x9d, 0x69, 0xa0, 0x69, 0x16, 0xe8, 0xfb, - 0x4b, 0x56, 0x3a, 0x47, 0xcc, 0x4f, 0x41, 0x50, 0x0d, 0x9d, 0x98, 0x9e, 0xe2, 0x7a, 0x0e, 0xc1, - 0x63, 0xdd, 0x1c, 0xb2, 0x13, 0x24, 0x77, 0x90, 0x19, 0x60, 0xc3, 0x25, 0xf2, 0x1a, 0x57, 0xf7, - 0x02, 0x2d, 0xb5, 0x60, 0x04, 0x72, 0x22, 0x16, 0xd9, 0x98, 0x05, 0x57, 0x87, 0x16, 0xe5, 0x5f, - 0xe7, 0xa1, 0x10, 0xe9, 0xab, 0xd1, 0x45, 0x28, 0x3e, 0xc2, 0x4f, 0xb0, 0x12, 0xdc, 0x95, 0x78, - 0x26, 0x0a, 0x54, 0xd6, 0xf5, 0xef, 0x4b, 0x9f, 0xc2, 0x26, 0x83, 0x58, 0x13, 0x8f, 0x38, 0x8a, - 0x6a, 0x60, 0xd7, 0x65, 0x49, 0xcb, 0x31, 0x28, 0xa2, 0xba, 0x0e, 0x55, 0xd5, 0x02, 0x0d, 0xba, - 0x05, 0x1b, 0xcc, 0x62, 0x3c, 0x31, 0x3c, 0xdd, 0x36, 0x88, 0x42, 0x6f, 0x6f, 0x2e, 0x3b, 0x49, - 0xc2, 0xc8, 0xd6, 0x29, 0xa2, 0xe5, 0x03, 0x68, 0x44, 0x2e, 0xaa, 0xc3, 0x7b, 0xcc, 0x6c, 0x48, - 0x4c, 0xe2, 0x60, 0x8f, 0x28, 0xe4, 0xeb, 0x09, 0x36, 0x5c, 0x05, 0x9b, 0x9a, 0x32, 0xc2, 0xee, - 0x48, 0xdc, 0xa4, 0x0e, 0x0e, 0x93, 0x62, 0x42, 0x3e, 0x4f, 0x81, 0x47, 0x3e, 0x4e, 0x62, 0xb0, - 0xaa, 0xa9, 0x7d, 0x81, 0xdd, 0x11, 0x3a, 0x80, 0x2d, 0xe6, 0xc5, 0xf5, 0x1c, 0xdd, 0x1c, 0x2a, - 0xea, 0x88, 0xa8, 0x8f, 0x95, 0x89, 0x37, 0xb8, 0x23, 0xbe, 0x13, 0x9d, 0x9f, 0x45, 0xd8, 0x63, - 0x98, 0x1a, 0x85, 0x1c, 0x7b, 0x83, 0x3b, 0xa8, 0x07, 0x45, 0xfa, 0x31, 0xc6, 0xfa, 0x73, 0xa2, - 0x0c, 0x2c, 0x87, 0x1d, 0x8d, 0xa5, 0x05, 0xa5, 0x29, 0x92, 0xc1, 0x4a, 0xc7, 0x37, 0x68, 0x59, - 0x1a, 0x39, 0xc8, 0xf4, 0xba, 0x92, 0x54, 0x97, 0x0b, 0x81, 0x97, 0x7b, 0x96, 0x43, 0x09, 0x35, - 0xb4, 0xc2, 0x04, 0x17, 0x38, 0xa1, 0x86, 0x56, 0x90, 0xde, 0x5b, 0xb0, 0xa1, 0xaa, 0x7c, 0xcd, - 0xba, 0xaa, 0xf8, 0x77, 0x2c, 0x57, 0x14, 0x62, 0xc9, 0x52, 0xd5, 0x23, 0x0e, 0xf0, 0x39, 0xee, - 0xa2, 0xcf, 0xe0, 0xed, 0x69, 0xb2, 0xa2, 0x86, 0xeb, 0x73, 0xab, 0x9c, 0x35, 0xbd, 0x05, 0x1b, - 0xf6, 0xe9, 0xbc, 0x21, 0x8a, 0xcd, 0x68, 0x9f, 0xce, 0x9a, 0xdd, 0x86, 0x4d, 0x7b, 0x64, 0xcf, - 0xdb, 0x5d, 0x8d, 0xda, 0x21, 0x7b, 0x64, 0xcf, 0x1a, 0x5e, 0x62, 0x17, 0x6e, 0x87, 0xa8, 0xd8, - 0x23, 0x9a, 0x78, 0x2e, 0x0a, 0x8f, 0x28, 0xd0, 0x75, 0x10, 0x54, 0x55, 0x21, 0x26, 0x3e, 0x31, - 0x88, 0x82, 0x1d, 0x62, 0x62, 0x57, 0xbc, 0x10, 0x05, 0x97, 0x54, 0x55, 0x62, 0xda, 0x2a, 0x53, - 0xa2, 0xab, 0xb0, 0x6e, 0x9d, 0x3c, 0x52, 0x39, 0x25, 0x15, 0xdb, 0x21, 0x03, 0xfd, 0x99, 0xf8, - 0x21, 0xcb, 0xef, 0x1a, 0x55, 0x30, 0x42, 0x76, 0x99, 0x18, 0x5d, 0x01, 0x41, 0x75, 0x47, 0xd8, - 0xb1, 0x59, 0x4d, 0x76, 0x6d, 0xac, 0x12, 0xf1, 0x12, 0x87, 0x72, 0x79, 0x3b, 0x10, 0xd3, 0x2d, - 0xe1, 0x3e, 0xd5, 0x07, 0x5e, 0xe0, 0xf1, 0x32, 0xdf, 0x12, 0x4c, 0xe6, 0x7b, 0xdb, 0x05, 0x81, - 0xa6, 0x22, 0x36, 0xf1, 0x2e, 0x83, 0x95, 0xec, 0x91, 0x1d, 0x9d, 0xf7, 0x03, 0x58, 0xa5, 0xc8, - 0xe9, 0xa4, 0x57, 0x78, 0x43, 0x66, 0x8f, 0x22, 0x33, 0xde, 0x84, 0x2d, 0x0a, 0x1a, 0x13, 0x0f, - 0x6b, 0xd8, 0xc3, 0x11, 0xf4, 0xc7, 0x0c, 0x4d, 0xf3, 0xde, 0xf2, 0x95, 0xb1, 0x38, 0x9d, 0xc9, - 0xc9, 0x69, 0xc8, 0xac, 0x4f, 0x78, 0x9c, 0x54, 0x16, 0x70, 0xeb, 0xb5, 0x35, 0xdd, 0xe5, 0x03, - 0x28, 0x46, 0x89, 0x8f, 0xf2, 0xc0, 0xa9, 0x2f, 0x24, 0x68, 0x17, 0x54, 0xeb, 0xd4, 0x69, 0xff, - 0xf2, 0x95, 0x24, 0x24, 0x69, 0x1f, 0xd5, 0x6c, 0xf4, 0x25, 0x45, 0x3e, 0x6e, 0xf7, 0x1b, 0x2d, - 0x49, 0x48, 0x45, 0x1b, 0xf6, 0xbf, 0x26, 0xa1, 0x14, 0xbf, 0x7b, 0xa1, 0x1f, 0xc0, 0xb9, 0xe0, - 0xa1, 0xc4, 0x25, 0x9e, 0xf2, 0x54, 0x77, 0xd8, 0x5e, 0x1c, 0x63, 0x7e, 0x2e, 0x86, 0x6c, 0xd8, - 0xf4, 0x51, 0x3d, 0xe2, 0x7d, 0xa9, 0x3b, 0x74, 0xa7, 0x8d, 0xb1, 0x87, 0x9a, 0x70, 0xc1, 0xb4, - 0x14, 0xd7, 0xc3, 0xa6, 0x86, 0x1d, 0x4d, 0x99, 0x3e, 0x51, 0x29, 0x58, 0x55, 0x89, 0xeb, 0x5a, - 0xfc, 0x0c, 0x0c, 0xbd, 0xbc, 0x6b, 0x5a, 0x3d, 0x1f, 0x3c, 0x3d, 0x1c, 0xaa, 0x3e, 0x74, 0x86, - 0xb9, 0xa9, 0x65, 0xcc, 0x7d, 0x07, 0xf2, 0x63, 0x6c, 0x2b, 0xc4, 0xf4, 0x9c, 0x53, 0xd6, 0x71, - 0xe7, 0xe4, 0xdc, 0x18, 0xdb, 0x12, 0x1d, 0xbf, 0x99, 0x8b, 0xcf, 0x3f, 0x52, 0x50, 0x8c, 0x76, - 0xdd, 0xf4, 0x12, 0xa3, 0xb2, 0x03, 0x2a, 0xc1, 0x4a, 0xd8, 0x07, 0x2f, 0xed, 0xd1, 0x2b, 0x35, - 0x7a, 0x72, 0x1d, 0x64, 0x79, 0x2f, 0x2c, 0x73, 0x4b, 0xda, 0x35, 0x50, 0x6a, 0x11, 0xde, 0x7b, - 0xe4, 0x64, 0x7f, 0x84, 0x8e, 0x20, 0xfb, 0xc8, 0x65, 0xbe, 0xb3, 0xcc, 0xf7, 0x87, 0x2f, 0xf7, - 0x7d, 0xbf, 0xc7, 0x9c, 0xe7, 0xef, 0xf7, 0x94, 0x76, 0x47, 0x6e, 0x55, 0x9b, 0xb2, 0x6f, 0x8e, - 0xce, 0x43, 0xda, 0xc0, 0xcf, 0x4f, 0xe3, 0x67, 0x1c, 0x13, 0x9d, 0x35, 0xf1, 0xe7, 0x21, 0xfd, - 0x94, 0xe0, 0xc7, 0xf1, 0x93, 0x85, 0x89, 0x5e, 0x23, 0xf5, 0xaf, 0x43, 0x86, 0xe5, 0x0b, 0x01, - 0xf8, 0x19, 0x13, 0xde, 0x42, 0x39, 0x48, 0xd7, 0x3a, 0x32, 0xa5, 0xbf, 0x00, 0x45, 0x2e, 0x55, - 0xba, 0x0d, 0xa9, 0x26, 0x09, 0xc9, 0xf2, 0x2d, 0xc8, 0xf2, 0x24, 0xd0, 0xad, 0x11, 0xa6, 0x41, - 0x78, 0xcb, 0x1f, 0xfa, 0x3e, 0x12, 0x81, 0xf6, 0xb8, 0x75, 0x28, 0xc9, 0x42, 0x32, 0xfa, 0x79, - 0x5d, 0x28, 0x46, 0x1b, 0xee, 0x37, 0xc3, 0xa9, 0xbf, 0x24, 0xa0, 0x10, 0x69, 0xa0, 0x69, 0xe7, - 0x83, 0x0d, 0xc3, 0x7a, 0xaa, 0x60, 0x43, 0xc7, 0xae, 0x4f, 0x0a, 0x60, 0xa2, 0x2a, 0x95, 0x9c, - 0xf5, 0xa3, 0xbd, 0x91, 0xe0, 0x7f, 0x9f, 0x00, 0x61, 0xb6, 0x77, 0x9d, 0x09, 0x30, 0xf1, 0xbd, - 0x06, 0xf8, 0xbb, 0x04, 0x94, 0xe2, 0x0d, 0xeb, 0x4c, 0x78, 0x17, 0xbf, 0xd7, 0xf0, 0xfe, 0x99, - 0x84, 0xd5, 0x58, 0x9b, 0x7a, 0xd6, 0xe8, 0xbe, 0x86, 0x75, 0x5d, 0x23, 0x63, 0xdb, 0xf2, 0x88, - 0xa9, 0x9e, 0x2a, 0x06, 0x79, 0x42, 0x0c, 0xb1, 0xcc, 0x0a, 0xc5, 0xf5, 0x97, 0x37, 0xc2, 0x95, - 0xc6, 0xd4, 0xae, 0x49, 0xcd, 0x0e, 0x36, 0x1a, 0x75, 0xa9, 0xd5, 0xed, 0xf4, 0xa5, 0x76, 0xed, - 0xa1, 0x72, 0xdc, 0xfe, 0x71, 0xbb, 0xf3, 0x65, 0x5b, 0x16, 0xf4, 0x19, 0xd8, 0x6b, 0xdc, 0xea, - 0x5d, 0x10, 0x66, 0x83, 0x42, 0xe7, 0x60, 0x51, 0x58, 0xc2, 0x5b, 0x68, 0x03, 0xd6, 0xda, 0x1d, - 0xa5, 0xd7, 0xa8, 0x4b, 0x8a, 0x74, 0xef, 0x9e, 0x54, 0xeb, 0xf7, 0xf8, 0xd3, 0x46, 0x88, 0xee, - 0xc7, 0x37, 0xf5, 0x6f, 0x53, 0xb0, 0xb1, 0x20, 0x12, 0x54, 0xf5, 0x2f, 0x25, 0xfc, 0x9e, 0xf4, - 0xc9, 0x59, 0xa2, 0xaf, 0xd0, 0xae, 0xa0, 0x8b, 0x1d, 0xcf, 0xbf, 0xc3, 0x5c, 0x01, 0x9a, 0x25, - 0xd3, 0xd3, 0x07, 0x3a, 0x71, 0xfc, 0x97, 0x20, 0x7e, 0x53, 0x59, 0x9b, 0xca, 0xf9, 0x63, 0xd0, - 0xc7, 0x80, 0x6c, 0xcb, 0xd5, 0x3d, 0xfd, 0x09, 0x51, 0x74, 0x33, 0x78, 0x36, 0xa2, 0x37, 0x97, - 0xb4, 0x2c, 0x04, 0x9a, 0x86, 0xe9, 0x85, 0x68, 0x93, 0x0c, 0xf1, 0x0c, 0x9a, 0x16, 0xf0, 0x94, - 0x2c, 0x04, 0x9a, 0x10, 0x7d, 0x11, 0x8a, 0x9a, 0x35, 0xa1, 0xed, 0x1c, 0xc7, 0xd1, 0xf3, 0x22, - 0x21, 0x17, 0xb8, 0x2c, 0x84, 0xf8, 0x8d, 0xfa, 0xf4, 0xbd, 0xaa, 0x28, 0x17, 0xb8, 0x8c, 0x43, - 0x2e, 0xc3, 0x1a, 0x1e, 0x0e, 0x1d, 0xea, 0x3c, 0x70, 0xc4, 0xaf, 0x1e, 0xa5, 0x50, 0xcc, 0x80, - 0xdb, 0xf7, 0x21, 0x17, 0xe4, 0x81, 0x1e, 0xc9, 0x34, 0x13, 0x8a, 0xcd, 0xef, 0xd3, 0xc9, 0xdd, - 0xbc, 0x9c, 0x33, 0x03, 0xe5, 0x45, 0x28, 0xea, 0xae, 0x32, 0x7d, 0x7e, 0x4f, 0xee, 0x24, 0x77, - 0x73, 0x72, 0x41, 0x77, 0xc3, 0xa7, 0xcb, 0xf2, 0x37, 0x49, 0x28, 0xc5, 0x7f, 0x3e, 0x40, 0x75, - 0xc8, 0x19, 0x96, 0x8a, 0x19, 0xb5, 0xf8, 0x6f, 0x57, 0xbb, 0xaf, 0xf8, 0xc5, 0xa1, 0xd2, 0xf4, - 0xf1, 0x72, 0x68, 0xb9, 0xfd, 0xb7, 0x04, 0xe4, 0x02, 0x31, 0xda, 0x82, 0xb4, 0x8d, 0xbd, 0x11, - 0x73, 0x97, 0x39, 0x4c, 0x0a, 0x09, 0x99, 0x8d, 0xa9, 0xdc, 0xb5, 0xb1, 0xc9, 0x28, 0xe0, 0xcb, - 0xe9, 0x98, 0x7e, 0x57, 0x83, 0x60, 0x8d, 0xdd, 0x6b, 0xac, 0xf1, 0x98, 0x98, 0x9e, 0x1b, 0x7c, - 0x57, 0x5f, 0x5e, 0xf3, 0xc5, 0xe8, 0x1a, 0xac, 0x7b, 0x0e, 0xd6, 0x8d, 0x18, 0x36, 0xcd, 0xb0, - 0x42, 0xa0, 0x08, 0xc1, 0x07, 0x70, 0x3e, 0xf0, 0xab, 0x11, 0x0f, 0xab, 0x23, 0xa2, 0x4d, 0x8d, - 0xb2, 0xec, 0xfd, 0xe2, 0x9c, 0x0f, 0xa8, 0xfb, 0xfa, 0xc0, 0xb6, 0xfc, 0xf7, 0x04, 0xac, 0x07, - 0x37, 0x31, 0x2d, 0x4c, 0x56, 0x0b, 0x00, 0x9b, 0xa6, 0xe5, 0x45, 0xd3, 0x35, 0x4f, 0xe5, 0x39, - 0xbb, 0x4a, 0x35, 0x34, 0x92, 0x23, 0x0e, 0xb6, 0xc7, 0x00, 0x53, 0xcd, 0xd2, 0xb4, 0x5d, 0x80, - 0x82, 0xff, 0xdb, 0x10, 0xfb, 0x81, 0x91, 0xdf, 0xdd, 0x81, 0x8b, 0xe8, 0x95, 0x0d, 0x6d, 0x42, - 0xe6, 0x84, 0x0c, 0x75, 0xd3, 0x7f, 0xf1, 0xe5, 0x83, 0xe0, 0x85, 0x25, 0x1d, 0xbe, 0xb0, 0x1c, - 0xfe, 0x0c, 0x36, 0x54, 0x6b, 0x3c, 0x1b, 0xee, 0xa1, 0x30, 0xf3, 0x7e, 0xe0, 0x7e, 0x91, 0xf8, - 0x0a, 0xa6, 0x2d, 0xe6, 0xff, 0x12, 0x89, 0x3f, 0x24, 0x53, 0x47, 0xdd, 0xc3, 0x3f, 0x26, 0xb7, - 0x8f, 0xb8, 0x69, 0x37, 0x58, 0xa9, 0x4c, 0x06, 0x06, 0x51, 0x69, 0xf4, 0xff, 0x0f, 0x00, 0x00, - 0xff, 0xff, 0x88, 0x17, 0xc1, 0xbe, 0x38, 0x1d, 0x00, 0x00, -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go deleted file mode 100644 index 165b2110..00000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go +++ /dev/null @@ -1,752 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: descriptor.proto - -package descriptor - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - math "math" - reflect "reflect" - sort "sort" - strconv "strconv" - strings "strings" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func (this *FileDescriptorSet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.FileDescriptorSet{") - if this.File != nil { - s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 16) - s = append(s, "&descriptor.FileDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Package != nil { - s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") - } - if this.Dependency != nil { - s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") - } - if this.PublicDependency != nil { - s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") - } - if this.WeakDependency != nil { - s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") - } - if this.MessageType != nil { - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.Service != nil { - s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.SourceCodeInfo != nil { - s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") - } - if this.Syntax != nil { - s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.DescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Field != nil { - s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.NestedType != nil { - s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.ExtensionRange != nil { - s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") - } - if this.OneofDecl != nil { - s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ExtensionRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.DescriptorProto_ReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ExtensionRangeOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.ExtensionRangeOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.FieldDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Label != nil { - s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "FieldDescriptorProto_Label")+",\n") - } - if this.Type != nil { - s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "FieldDescriptorProto_Type")+",\n") - } - if this.TypeName != nil { - s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") - } - if this.Extendee != nil { - s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") - } - if this.DefaultValue != nil { - s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") - } - if this.OneofIndex != nil { - s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") - } - if this.JsonName != nil { - s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.OneofDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.EnumDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Value != nil { - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto_EnumReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumDescriptorProto_EnumReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumValueDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.ServiceDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Method != nil { - s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&descriptor.MethodDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.InputType != nil { - s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") - } - if this.OutputType != nil { - s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ClientStreaming != nil { - s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") - } - if this.ServerStreaming != nil { - s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 25) - s = append(s, "&descriptor.FileOptions{") - if this.JavaPackage != nil { - s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") - } - if this.JavaOuterClassname != nil { - s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") - } - if this.JavaMultipleFiles != nil { - s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") - } - if this.JavaGenerateEqualsAndHash != nil { - s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") - } - if this.JavaStringCheckUtf8 != nil { - s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") - } - if this.OptimizeFor != nil { - s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "FileOptions_OptimizeMode")+",\n") - } - if this.GoPackage != nil { - s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") - } - if this.CcGenericServices != nil { - s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") - } - if this.JavaGenericServices != nil { - s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") - } - if this.PyGenericServices != nil { - s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") - } - if this.PhpGenericServices != nil { - s = append(s, "PhpGenericServices: "+valueToGoStringDescriptor(this.PhpGenericServices, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.CcEnableArenas != nil { - s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") - } - if this.ObjcClassPrefix != nil { - s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") - } - if this.CsharpNamespace != nil { - s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") - } - if this.SwiftPrefix != nil { - s = append(s, "SwiftPrefix: "+valueToGoStringDescriptor(this.SwiftPrefix, "string")+",\n") - } - if this.PhpClassPrefix != nil { - s = append(s, "PhpClassPrefix: "+valueToGoStringDescriptor(this.PhpClassPrefix, "string")+",\n") - } - if this.PhpNamespace != nil { - s = append(s, "PhpNamespace: "+valueToGoStringDescriptor(this.PhpNamespace, "string")+",\n") - } - if this.PhpMetadataNamespace != nil { - s = append(s, "PhpMetadataNamespace: "+valueToGoStringDescriptor(this.PhpMetadataNamespace, "string")+",\n") - } - if this.RubyPackage != nil { - s = append(s, "RubyPackage: "+valueToGoStringDescriptor(this.RubyPackage, "string")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MessageOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.MessageOptions{") - if this.MessageSetWireFormat != nil { - s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") - } - if this.NoStandardDescriptorAccessor != nil { - s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.MapEntry != nil { - s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.FieldOptions{") - if this.Ctype != nil { - s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "FieldOptions_CType")+",\n") - } - if this.Packed != nil { - s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") - } - if this.Jstype != nil { - s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "FieldOptions_JSType")+",\n") - } - if this.Lazy != nil { - s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.Weak != nil { - s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.OneofOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumOptions{") - if this.AllowAlias != nil { - s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumValueOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.ServiceOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.MethodOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.IdempotencyLevel != nil { - s = append(s, "IdempotencyLevel: "+valueToGoStringDescriptor(this.IdempotencyLevel, "MethodOptions_IdempotencyLevel")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.UninterpretedOption{") - if this.Name != nil { - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - } - if this.IdentifierValue != nil { - s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") - } - if this.PositiveIntValue != nil { - s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") - } - if this.NegativeIntValue != nil { - s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") - } - if this.DoubleValue != nil { - s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") - } - if this.StringValue != nil { - s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") - } - if this.AggregateValue != nil { - s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption_NamePart) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.UninterpretedOption_NamePart{") - if this.NamePart != nil { - s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") - } - if this.IsExtension != nil { - s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.SourceCodeInfo{") - if this.Location != nil { - s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo_Location) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.SourceCodeInfo_Location{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.Span != nil { - s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") - } - if this.LeadingComments != nil { - s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") - } - if this.TrailingComments != nil { - s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") - } - if this.LeadingDetachedComments != nil { - s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.GeneratedCodeInfo{") - if this.Annotation != nil { - s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo_Annotation) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.SourceFile != nil { - s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") - } - if this.Begin != nil { - s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringDescriptor(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} diff --git a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go deleted file mode 100644 index e0846a35..00000000 --- a/vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go +++ /dev/null @@ -1,390 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package descriptor - -import ( - "strings" -) - -func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { - if !msg.GetOptions().GetMapEntry() { - return nil, nil - } - return msg.GetField()[0], msg.GetField()[1] -} - -func dotToUnderscore(r rune) rune { - if r == '.' { - return '_' - } - return r -} - -func (field *FieldDescriptorProto) WireType() (wire int) { - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE: - return 1 - case FieldDescriptorProto_TYPE_FLOAT: - return 5 - case FieldDescriptorProto_TYPE_INT64: - return 0 - case FieldDescriptorProto_TYPE_UINT64: - return 0 - case FieldDescriptorProto_TYPE_INT32: - return 0 - case FieldDescriptorProto_TYPE_UINT32: - return 0 - case FieldDescriptorProto_TYPE_FIXED64: - return 1 - case FieldDescriptorProto_TYPE_FIXED32: - return 5 - case FieldDescriptorProto_TYPE_BOOL: - return 0 - case FieldDescriptorProto_TYPE_STRING: - return 2 - case FieldDescriptorProto_TYPE_GROUP: - return 2 - case FieldDescriptorProto_TYPE_MESSAGE: - return 2 - case FieldDescriptorProto_TYPE_BYTES: - return 2 - case FieldDescriptorProto_TYPE_ENUM: - return 0 - case FieldDescriptorProto_TYPE_SFIXED32: - return 5 - case FieldDescriptorProto_TYPE_SFIXED64: - return 1 - case FieldDescriptorProto_TYPE_SINT32: - return 0 - case FieldDescriptorProto_TYPE_SINT64: - return 0 - } - panic("unreachable") -} - -func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { - packed := field.IsPacked() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey3Uint64() (x uint64) { - packed := field.IsPacked3() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey() []byte { - x := field.GetKeyUint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (field *FieldDescriptorProto) GetKey3() []byte { - x := field.GetKey3Uint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { - msg := desc.GetMessage(packageName, messageName) - if msg == nil { - return nil - } - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) - if nes != nil { - return nes - } - } - return nil -} - -func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) - if res != nil { - return res - } - } - return nil -} - -func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - if msg.GetName()+"."+nes.GetName() == typeName { - return nes - } - } - } - } - return nil -} - -func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - if msg.GetName()+"."+nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - } - } - return false -} - -func (msg *DescriptorProto) IsExtendable() bool { - return len(msg.GetExtensionRange()) > 0 -} - -func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetName() == fieldName { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetNumber() == fieldNum { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", "" - } - field := parent.GetFieldDescriptor(fieldName) - if field == nil { - var extPackageName string - extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) - if field == nil { - return "", "" - } - packageName = extPackageName - } - typeNames := strings.Split(field.GetTypeName(), ".") - if len(typeNames) == 1 { - msg := desc.GetMessage(packageName, typeName) - if msg == nil { - return "", "" - } - return packageName, msg.GetName() - } - if len(typeNames) > 2 { - for i := 1; i < len(typeNames)-1; i++ { - packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") - typeName = strings.Join(typeNames[len(typeNames)-i:], ".") - msg := desc.GetMessage(packageName, typeName) - if msg != nil { - typeNames := strings.Split(msg.GetName(), ".") - if len(typeNames) == 1 { - return packageName, msg.GetName() - } - return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] - } - } - } - return "", "" -} - -func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, enum := range file.GetEnumType() { - if enum.GetName() == typeName { - return enum - } - } - } - return nil -} - -func (f *FieldDescriptorProto) IsEnum() bool { - return *f.Type == FieldDescriptorProto_TYPE_ENUM -} - -func (f *FieldDescriptorProto) IsMessage() bool { - return *f.Type == FieldDescriptorProto_TYPE_MESSAGE -} - -func (f *FieldDescriptorProto) IsBytes() bool { - return *f.Type == FieldDescriptorProto_TYPE_BYTES -} - -func (f *FieldDescriptorProto) IsRepeated() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED -} - -func (f *FieldDescriptorProto) IsString() bool { - return *f.Type == FieldDescriptorProto_TYPE_STRING -} - -func (f *FieldDescriptorProto) IsBool() bool { - return *f.Type == FieldDescriptorProto_TYPE_BOOL -} - -func (f *FieldDescriptorProto) IsRequired() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED -} - -func (f *FieldDescriptorProto) IsPacked() bool { - return f.Options != nil && f.GetOptions().GetPacked() -} - -func (f *FieldDescriptorProto) IsPacked3() bool { - if f.IsRepeated() && f.IsScalar() { - if f.Options == nil || f.GetOptions().Packed == nil { - return true - } - return f.Options != nil && f.GetOptions().GetPacked() - } - return false -} - -func (m *DescriptorProto) HasExtension() bool { - return len(m.ExtensionRange) > 0 -} diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go index 79668ff5..a4b8c0cd 100644 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ b/vendor/github.com/golang/protobuf/proto/properties.go @@ -38,7 +38,6 @@ package proto import ( "fmt" "log" - "os" "reflect" "sort" "strconv" @@ -194,7 +193,7 @@ func (p *Properties) Parse(s string) { // "bytes,49,opt,name=foo,def=hello!" fields := strings.Split(s, ",") // breaks def=, but handled below. if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + log.Printf("proto: tag has too few fields: %q", s) return } @@ -214,7 +213,7 @@ func (p *Properties) Parse(s string) { p.WireType = WireBytes // no numeric converter for non-numeric types default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + log.Printf("proto: tag has unknown wire type: %q", s) return } diff --git a/vendor/github.com/golang/snappy/go.mod b/vendor/github.com/golang/snappy/go.mod deleted file mode 100644 index f6406bb2..00000000 --- a/vendor/github.com/golang/snappy/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/golang/snappy diff --git a/vendor/github.com/google/uuid/go.mod b/vendor/github.com/google/uuid/go.mod deleted file mode 100644 index fc84cd79..00000000 --- a/vendor/github.com/google/uuid/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/google/uuid diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go index d651a2b0..3e4e90dc 100644 --- a/vendor/github.com/google/uuid/node.go +++ b/vendor/github.com/google/uuid/node.go @@ -48,7 +48,6 @@ func setNodeInterface(name string) bool { // does not specify a specific interface generate a random Node ID // (section 4.1.6) if name == "" { - ifname = "random" randomBits(nodeID[:]) return true } diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go index 524404cc..7f3643fe 100644 --- a/vendor/github.com/google/uuid/uuid.go +++ b/vendor/github.com/google/uuid/uuid.go @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. All rights reserved. +// Copyright 2016 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -35,43 +35,20 @@ const ( var rander = rand.Reader // random function -// Parse decodes s into a UUID or returns an error. Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +// Parse decodes s into a UUID or returns an error. Both the UUID form of +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded. func Parse(s string) (UUID, error) { var uuid UUID - switch len(s) { - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36: - - // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: + if len(s) != 36 { + if len(s) != 36+9 { + return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) + } if strings.ToLower(s[:9]) != "urn:uuid:" { return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) } s = s[9:] - - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - case 36 + 2: - s = s[1:] - - // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - case 32: - var ok bool - for i := range uuid { - uuid[i], ok = xtob(s[i*2], s[i*2+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return uuid, errors.New("invalid UUID format") } @@ -93,29 +70,15 @@ func Parse(s string) (UUID, error) { // ParseBytes is like Parse, except it parses a byte slice instead of a string. func ParseBytes(b []byte) (UUID, error) { var uuid UUID - switch len(b) { - case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if len(b) != 36 { + if len(b) != 36+9 { + return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) + } if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) } b = b[9:] - case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - b = b[1:] - case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - var ok bool - for i := 0; i < 32; i += 2 { - uuid[i/2], ok = xtob(b[i], b[i+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { return uuid, errors.New("invalid UUID format") } @@ -134,16 +97,6 @@ func ParseBytes(b []byte) (UUID, error) { return uuid, nil } -// MustParse is like Parse but panics if the string cannot be parsed. -// It simplifies safe initialization of global variables holding compiled UUIDs. -func MustParse(s string) UUID { - uuid, err := Parse(s) - if err != nil { - panic(`uuid: Parse(` + s + `): ` + err.Error()) - } - return uuid -} - // FromBytes creates a new UUID from a byte slice. Returns an error if the slice // does not have a length of 16. The bytes are copied from the slice. func FromBytes(b []byte) (uuid UUID, err error) { @@ -177,7 +130,7 @@ func (uuid UUID) URN() string { } func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst, uuid[:4]) + hex.Encode(dst[:], uuid[:4]) dst[8] = '-' hex.Encode(dst[9:13], uuid[4:6]) dst[13] = '-' diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore deleted file mode 100644 index cd3fcd1e..00000000 --- a/vendor/github.com/gorilla/websocket/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -.idea/ -*.iml diff --git a/vendor/github.com/gorilla/websocket/.travis.yml b/vendor/github.com/gorilla/websocket/.travis.yml deleted file mode 100644 index a49db51c..00000000 --- a/vendor/github.com/gorilla/websocket/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go -sudo: false - -matrix: - include: - - go: 1.7.x - - go: 1.8.x - - go: 1.9.x - - go: 1.10.x - - go: 1.11.x - - go: tip - allow_failures: - - go: tip - -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d .) - - go vet $(go list ./... | grep -v /vendor/) - - go test -v -race ./... diff --git a/vendor/github.com/gorilla/websocket/AUTHORS b/vendor/github.com/gorilla/websocket/AUTHORS deleted file mode 100644 index 1931f400..00000000 --- a/vendor/github.com/gorilla/websocket/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -# This is the official list of Gorilla WebSocket authors for copyright -# purposes. -# -# Please keep the list sorted. - -Gary Burd -Google LLC (https://opensource.google.com/) -Joachim Bauch - diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE deleted file mode 100644 index 9171c972..00000000 --- a/vendor/github.com/gorilla/websocket/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md deleted file mode 100644 index 20e391f8..00000000 --- a/vendor/github.com/gorilla/websocket/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# Gorilla WebSocket - -Gorilla WebSocket is a [Go](http://golang.org/) implementation of the -[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. - -[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket) -[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) - -### Documentation - -* [API Reference](http://godoc.org/github.com/gorilla/websocket) -* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat) -* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) -* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) -* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch) - -### Status - -The Gorilla WebSocket package provides a complete and tested implementation of -the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The -package API is stable. - -### Installation - - go get github.com/gorilla/websocket - -### Protocol Compliance - -The Gorilla WebSocket package passes the server tests in the [Autobahn Test -Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn -subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). - -### Gorilla WebSocket compared with other packages - - - - - - - - - - - - - - - - - - -
github.com/gorillagolang.org/x/net
RFC 6455 Features
Passes Autobahn Test SuiteYesNo
Receive fragmented messageYesNo, see note 1
Send close messageYesNo
Send pings and receive pongsYesNo
Get the type of a received data messageYesYes, see note 2
Other Features
Compression ExtensionsExperimentalNo
Read message using io.ReaderYesNo, see note 3
Write message using io.WriteCloserYesNo, see note 3
- -Notes: - -1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html). -2. The application can get the type of a received data message by implementing - a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal) - function. -3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries. - Read returns when the input buffer is full or a frame boundary is - encountered. Each call to Write sends a single frame message. The Gorilla - io.Reader and io.WriteCloser operate on a single WebSocket message. - diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go deleted file mode 100644 index 2e32fd50..00000000 --- a/vendor/github.com/gorilla/websocket/client.go +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2013 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. - -package websocket - -import ( - "bytes" - "context" - "crypto/tls" - "errors" - "io" - "io/ioutil" - "net" - "net/http" - "net/http/httptrace" - "net/url" - "strings" - "time" -) - -// ErrBadHandshake is returned when the server response to opening handshake is -// invalid. -var ErrBadHandshake = errors.New("websocket: bad handshake") - -var errInvalidCompression = errors.New("websocket: invalid compression negotiation") - -// NewClient creates a new client connection using the given net connection. -// The URL u specifies the host and request URI. Use requestHeader to specify -// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies -// (Cookie). Use the response.Header to get the selected subprotocol -// (Sec-WebSocket-Protocol) and cookies (Set-Cookie). -// -// If the WebSocket handshake fails, ErrBadHandshake is returned along with a -// non-nil *http.Response so that callers can handle redirects, authentication, -// etc. -// -// Deprecated: Use Dialer instead. -func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) { - d := Dialer{ - ReadBufferSize: readBufSize, - WriteBufferSize: writeBufSize, - NetDial: func(net, addr string) (net.Conn, error) { - return netConn, nil - }, - } - return d.Dial(u.String(), requestHeader) -} - -// A Dialer contains options for connecting to WebSocket server. -type Dialer struct { - // NetDial specifies the dial function for creating TCP connections. If - // NetDial is nil, net.Dial is used. - 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 - // Request. If the function returns a non-nil error, the - // request is aborted with the provided error. - // If Proxy is nil or returns a nil *URL, no proxy is used. - Proxy func(*http.Request) (*url.URL, error) - - // TLSClientConfig specifies the TLS configuration to use with tls.Client. - // If nil, the default configuration is used. - TLSClientConfig *tls.Config - - // HandshakeTimeout specifies the duration for the handshake to complete. - HandshakeTimeout time.Duration - - // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer - // size is zero, then a useful default size is used. The I/O buffer sizes - // do not limit the size of the messages that can be sent or received. - 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 []string - - // EnableCompression specifies if the client should attempt to negotiate - // per message compression (RFC 7692). Setting this value to true does not - // guarantee that compression will be supported. Currently only "no context - // takeover" modes are supported. - EnableCompression bool - - // Jar specifies the cookie jar. - // If Jar is nil, cookies are not sent in requests and ignored - // in responses. - 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") - -func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { - hostPort = u.Host - hostNoPort = u.Host - if i := strings.LastIndex(u.Host, ":"); i > strings.LastIndex(u.Host, "]") { - hostNoPort = hostNoPort[:i] - } else { - switch u.Scheme { - case "wss": - hostPort += ":443" - case "https": - hostPort += ":443" - default: - hostPort += ":80" - } - } - return hostPort, hostNoPort -} - -// DefaultDialer is a dialer with all fields set to the default values. -var DefaultDialer = &Dialer{ - Proxy: http.ProxyFromEnvironment, - HandshakeTimeout: 45 * time.Second, -} - -// nilDialer is dialer to use when receiver is nil. -var nilDialer = *DefaultDialer - -// DialContext creates a new client connection. Use requestHeader to specify the -// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie). -// Use the response.Header to get the selected subprotocol -// (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 -// non-nil *http.Response so that callers can handle redirects, authentication, -// etcetera. The response body may not contain the entire response and does not -// need to be closed by the application. -func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) { - if d == nil { - d = &nilDialer - } - - challengeKey, err := generateChallengeKey() - if err != nil { - return nil, nil, err - } - - u, err := url.Parse(urlStr) - if err != nil { - return nil, nil, err - } - - switch u.Scheme { - case "ws": - u.Scheme = "http" - case "wss": - u.Scheme = "https" - default: - return nil, nil, errMalformedURL - } - - if u.User != nil { - // User name and password are not allowed in websocket URIs. - return nil, nil, errMalformedURL - } - - req := &http.Request{ - Method: "GET", - URL: u, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: make(http.Header), - Host: u.Host, - } - req = req.WithContext(ctx) - - // Set the cookies present in the cookie jar of the dialer - if d.Jar != nil { - for _, cookie := range d.Jar.Cookies(u) { - req.AddCookie(cookie) - } - } - - // Set the request headers using the capitalization for names and values in - // RFC examples. Although the capitalization shouldn't matter, there are - // servers that depend on it. The Header.Set method is not used because the - // method canonicalizes the header names. - req.Header["Upgrade"] = []string{"websocket"} - req.Header["Connection"] = []string{"Upgrade"} - req.Header["Sec-WebSocket-Key"] = []string{challengeKey} - req.Header["Sec-WebSocket-Version"] = []string{"13"} - if len(d.Subprotocols) > 0 { - req.Header["Sec-WebSocket-Protocol"] = []string{strings.Join(d.Subprotocols, ", ")} - } - for k, vs := range requestHeader { - switch { - case k == "Host": - if len(vs) > 0 { - req.Host = vs[0] - } - case k == "Upgrade" || - k == "Connection" || - k == "Sec-Websocket-Key" || - k == "Sec-Websocket-Version" || - k == "Sec-Websocket-Extensions" || - (k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0): - return nil, nil, errors.New("websocket: duplicate header not allowed: " + k) - case k == "Sec-Websocket-Protocol": - req.Header["Sec-WebSocket-Protocol"] = vs - default: - req.Header[k] = vs - } - } - - if d.EnableCompression { - req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"} - } - - if d.HandshakeTimeout != 0 { - var cancel func() - ctx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout) - defer cancel() - } - - // Get network dial function. - var netDial func(network, add string) (net.Conn, error) - - if d.NetDialContext != nil { - 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 deadline, ok := ctx.Deadline(); ok { - forwardDial := netDial - netDial = func(network, addr string) (net.Conn, error) { - c, err := forwardDial(network, addr) - if err != nil { - return nil, err - } - err = c.SetDeadline(deadline) - if err != nil { - c.Close() - return nil, err - } - return c, nil - } - } - - // If needed, wrap the dial function to connect through a proxy. - if d.Proxy != nil { - proxyURL, err := d.Proxy(req) - if err != nil { - return nil, nil, err - } - if proxyURL != nil { - dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial)) - if err != nil { - return nil, nil, err - } - netDial = dialer.Dial - } - } - - hostPort, hostNoPort := hostPortNoPort(u) - trace := httptrace.ContextClientTrace(ctx) - if trace != nil && trace.GetConn != nil { - trace.GetConn(hostPort) - } - - netConn, err := netDial("tcp", hostPort) - if trace != nil && trace.GotConn != nil { - trace.GotConn(httptrace.GotConnInfo{ - Conn: netConn, - }) - } - if err != nil { - return nil, nil, err - } - - defer func() { - if netConn != nil { - netConn.Close() - } - }() - - if u.Scheme == "https" { - cfg := cloneTLSConfig(d.TLSClientConfig) - if cfg.ServerName == "" { - cfg.ServerName = hostNoPort - } - tlsConn := tls.Client(netConn, cfg) - netConn = tlsConn - - var err error - if trace != nil { - err = doHandshakeWithTrace(trace, tlsConn, cfg) - } else { - err = doHandshake(tlsConn, cfg) - } - - if err != nil { - return nil, nil, err - } - } - - conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize, d.WriteBufferPool, nil, nil) - - if err := req.Write(netConn); err != nil { - 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) - if err != nil { - return nil, nil, err - } - - if d.Jar != nil { - if rc := resp.Cookies(); len(rc) > 0 { - d.Jar.SetCookies(u, rc) - } - } - - if resp.StatusCode != 101 || - !strings.EqualFold(resp.Header.Get("Upgrade"), "websocket") || - !strings.EqualFold(resp.Header.Get("Connection"), "upgrade") || - resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) { - // Before closing the network connection on return from this - // function, slurp up some of the response to aid application - // debugging. - buf := make([]byte, 1024) - n, _ := io.ReadFull(resp.Body, buf) - resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n])) - return nil, resp, ErrBadHandshake - } - - for _, ext := range parseExtensions(resp.Header) { - if ext[""] != "permessage-deflate" { - continue - } - _, snct := ext["server_no_context_takeover"] - _, cnct := ext["client_no_context_takeover"] - if !snct || !cnct { - return nil, resp, errInvalidCompression - } - conn.newCompressionWriter = compressNoContextTakeover - conn.newDecompressionReader = decompressNoContextTakeover - break - } - - resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) - conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol") - - netConn.SetDeadline(time.Time{}) - netConn = nil // to avoid close in defer. - 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 -} diff --git a/vendor/github.com/gorilla/websocket/client_clone.go b/vendor/github.com/gorilla/websocket/client_clone.go deleted file mode 100644 index 4f0d9437..00000000 --- a/vendor/github.com/gorilla/websocket/client_clone.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 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.8 - -package websocket - -import "crypto/tls" - -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return cfg.Clone() -} diff --git a/vendor/github.com/gorilla/websocket/client_clone_legacy.go b/vendor/github.com/gorilla/websocket/client_clone_legacy.go deleted file mode 100644 index babb007f..00000000 --- a/vendor/github.com/gorilla/websocket/client_clone_legacy.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 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.8 - -package websocket - -import "crypto/tls" - -// cloneTLSConfig clones all public fields except the fields -// SessionTicketsDisabled and SessionTicketKey. This avoids copying the -// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a -// config in active use. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - } -} diff --git a/vendor/github.com/gorilla/websocket/compression.go b/vendor/github.com/gorilla/websocket/compression.go deleted file mode 100644 index 813ffb1e..00000000 --- a/vendor/github.com/gorilla/websocket/compression.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2017 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. - -package websocket - -import ( - "compress/flate" - "errors" - "io" - "strings" - "sync" -) - -const ( - minCompressionLevel = -2 // flate.HuffmanOnly not defined in Go < 1.6 - maxCompressionLevel = flate.BestCompression - defaultCompressionLevel = 1 -) - -var ( - flateWriterPools [maxCompressionLevel - minCompressionLevel + 1]sync.Pool - flateReaderPool = sync.Pool{New: func() interface{} { - return flate.NewReader(nil) - }} -) - -func decompressNoContextTakeover(r io.Reader) io.ReadCloser { - const tail = - // Add four bytes as specified in RFC - "\x00\x00\xff\xff" + - // Add final block to squelch unexpected EOF error from flate reader. - "\x01\x00\x00\xff\xff" - - fr, _ := flateReaderPool.Get().(io.ReadCloser) - fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil) - return &flateReadWrapper{fr} -} - -func isValidCompressionLevel(level int) bool { - return minCompressionLevel <= level && level <= maxCompressionLevel -} - -func compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser { - p := &flateWriterPools[level-minCompressionLevel] - tw := &truncWriter{w: w} - fw, _ := p.Get().(*flate.Writer) - if fw == nil { - fw, _ = flate.NewWriter(tw, level) - } else { - fw.Reset(tw) - } - return &flateWriteWrapper{fw: fw, tw: tw, p: p} -} - -// truncWriter is an io.Writer that writes all but the last four bytes of the -// stream to another io.Writer. -type truncWriter struct { - w io.WriteCloser - n int - p [4]byte -} - -func (w *truncWriter) Write(p []byte) (int, error) { - n := 0 - - // fill buffer first for simplicity. - if w.n < len(w.p) { - n = copy(w.p[w.n:], p) - p = p[n:] - w.n += n - if len(p) == 0 { - return n, nil - } - } - - m := len(p) - if m > len(w.p) { - m = len(w.p) - } - - if nn, err := w.w.Write(w.p[:m]); err != nil { - return n + nn, err - } - - copy(w.p[:], w.p[m:]) - copy(w.p[len(w.p)-m:], p[len(p)-m:]) - nn, err := w.w.Write(p[:len(p)-m]) - return n + nn, err -} - -type flateWriteWrapper struct { - fw *flate.Writer - tw *truncWriter - p *sync.Pool -} - -func (w *flateWriteWrapper) Write(p []byte) (int, error) { - if w.fw == nil { - return 0, errWriteClosed - } - return w.fw.Write(p) -} - -func (w *flateWriteWrapper) Close() error { - if w.fw == nil { - return errWriteClosed - } - err1 := w.fw.Flush() - w.p.Put(w.fw) - w.fw = nil - if w.tw.p != [4]byte{0, 0, 0xff, 0xff} { - return errors.New("websocket: internal error, unexpected bytes at end of flate stream") - } - err2 := w.tw.w.Close() - if err1 != nil { - return err1 - } - return err2 -} - -type flateReadWrapper struct { - fr io.ReadCloser -} - -func (r *flateReadWrapper) Read(p []byte) (int, error) { - if r.fr == nil { - return 0, io.ErrClosedPipe - } - n, err := r.fr.Read(p) - if err == io.EOF { - // Preemptively place the reader back in the pool. This helps with - // scenarios where the application does not call NextReader() soon after - // this final read. - r.Close() - } - return n, err -} - -func (r *flateReadWrapper) Close() error { - if r.fr == nil { - return io.ErrClosedPipe - } - err := r.fr.Close() - flateReaderPool.Put(r.fr) - r.fr = nil - return err -} diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go deleted file mode 100644 index d2a21c14..00000000 --- a/vendor/github.com/gorilla/websocket/conn.go +++ /dev/null @@ -1,1165 +0,0 @@ -// Copyright 2013 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. - -package websocket - -import ( - "bufio" - "encoding/binary" - "errors" - "io" - "io/ioutil" - "math/rand" - "net" - "strconv" - "sync" - "time" - "unicode/utf8" -) - -const ( - // Frame header byte 0 bits from Section 5.2 of RFC 6455 - finalBit = 1 << 7 - rsv1Bit = 1 << 6 - rsv2Bit = 1 << 5 - rsv3Bit = 1 << 4 - - // Frame header byte 1 bits from Section 5.2 of RFC 6455 - maskBit = 1 << 7 - - maxFrameHeaderSize = 2 + 8 + 4 // Fixed header + length + mask - maxControlFramePayloadSize = 125 - - writeWait = time.Second - - defaultReadBufferSize = 4096 - defaultWriteBufferSize = 4096 - - continuationFrame = 0 - noFrame = -1 -) - -// Close codes defined in RFC 6455, section 11.7. -const ( - CloseNormalClosure = 1000 - CloseGoingAway = 1001 - CloseProtocolError = 1002 - CloseUnsupportedData = 1003 - CloseNoStatusReceived = 1005 - CloseAbnormalClosure = 1006 - CloseInvalidFramePayloadData = 1007 - ClosePolicyViolation = 1008 - CloseMessageTooBig = 1009 - CloseMandatoryExtension = 1010 - CloseInternalServerErr = 1011 - CloseServiceRestart = 1012 - CloseTryAgainLater = 1013 - CloseTLSHandshake = 1015 -) - -// The message types are defined in RFC 6455, section 11.8. -const ( - // TextMessage denotes a text data message. The text message payload is - // interpreted as UTF-8 encoded text data. - TextMessage = 1 - - // BinaryMessage denotes a binary data message. - BinaryMessage = 2 - - // CloseMessage denotes a close control message. The optional message - // payload contains a numeric code and text. Use the FormatCloseMessage - // function to format a close message payload. - CloseMessage = 8 - - // PingMessage denotes a ping control message. The optional message payload - // is UTF-8 encoded text. - PingMessage = 9 - - // PongMessage denotes a pong control message. The optional message payload - // is UTF-8 encoded text. - PongMessage = 10 -) - -// ErrCloseSent is returned when the application writes a message to the -// connection after sending a close message. -var ErrCloseSent = errors.New("websocket: close sent") - -// ErrReadLimit is returned when reading a message that is larger than the -// read limit set for the connection. -var ErrReadLimit = errors.New("websocket: read limit exceeded") - -// netError satisfies the net Error interface. -type netError struct { - msg string - temporary bool - timeout bool -} - -func (e *netError) Error() string { return e.msg } -func (e *netError) Temporary() bool { return e.temporary } -func (e *netError) Timeout() bool { return e.timeout } - -// CloseError represents a close message. -type CloseError struct { - // Code is defined in RFC 6455, section 11.7. - Code int - - // Text is the optional text payload. - Text string -} - -func (e *CloseError) Error() string { - s := []byte("websocket: close ") - s = strconv.AppendInt(s, int64(e.Code), 10) - switch e.Code { - case CloseNormalClosure: - s = append(s, " (normal)"...) - case CloseGoingAway: - s = append(s, " (going away)"...) - case CloseProtocolError: - s = append(s, " (protocol error)"...) - case CloseUnsupportedData: - s = append(s, " (unsupported data)"...) - case CloseNoStatusReceived: - s = append(s, " (no status)"...) - case CloseAbnormalClosure: - s = append(s, " (abnormal closure)"...) - case CloseInvalidFramePayloadData: - s = append(s, " (invalid payload data)"...) - case ClosePolicyViolation: - s = append(s, " (policy violation)"...) - case CloseMessageTooBig: - s = append(s, " (message too big)"...) - case CloseMandatoryExtension: - s = append(s, " (mandatory extension missing)"...) - case CloseInternalServerErr: - s = append(s, " (internal server error)"...) - case CloseTLSHandshake: - s = append(s, " (TLS handshake error)"...) - } - if e.Text != "" { - s = append(s, ": "...) - s = append(s, e.Text...) - } - return string(s) -} - -// IsCloseError returns boolean indicating whether the error is a *CloseError -// with one of the specified codes. -func IsCloseError(err error, codes ...int) bool { - if e, ok := err.(*CloseError); ok { - for _, code := range codes { - if e.Code == code { - return true - } - } - } - return false -} - -// IsUnexpectedCloseError returns boolean indicating whether the error is a -// *CloseError with a code not in the list of expected codes. -func IsUnexpectedCloseError(err error, expectedCodes ...int) bool { - if e, ok := err.(*CloseError); ok { - for _, code := range expectedCodes { - if e.Code == code { - return false - } - } - return true - } - return false -} - -var ( - errWriteTimeout = &netError{msg: "websocket: write timeout", timeout: true, temporary: true} - errUnexpectedEOF = &CloseError{Code: CloseAbnormalClosure, Text: io.ErrUnexpectedEOF.Error()} - errBadWriteOpCode = errors.New("websocket: bad write message type") - errWriteClosed = errors.New("websocket: write closed") - errInvalidControlFrame = errors.New("websocket: invalid control frame") -) - -func newMaskKey() [4]byte { - n := rand.Uint32() - return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)} -} - -func hideTempErr(err error) error { - if e, ok := err.(net.Error); ok && e.Temporary() { - err = &netError{msg: e.Error(), timeout: e.Timeout()} - } - return err -} - -func isControl(frameType int) bool { - return frameType == CloseMessage || frameType == PingMessage || frameType == PongMessage -} - -func isData(frameType int) bool { - return frameType == TextMessage || frameType == BinaryMessage -} - -var validReceivedCloseCodes = map[int]bool{ - // see http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number - - CloseNormalClosure: true, - CloseGoingAway: true, - CloseProtocolError: true, - CloseUnsupportedData: true, - CloseNoStatusReceived: false, - CloseAbnormalClosure: false, - CloseInvalidFramePayloadData: true, - ClosePolicyViolation: true, - CloseMessageTooBig: true, - CloseMandatoryExtension: true, - CloseInternalServerErr: true, - CloseServiceRestart: true, - CloseTryAgainLater: true, - CloseTLSHandshake: false, -} - -func isValidReceivedCloseCode(code int) bool { - 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. -type Conn struct { - conn net.Conn - isServer bool - subprotocol string - - // Write fields - mu chan bool // used as mutex to protect write to conn - writeBuf []byte // frame is constructed in this buffer. - writePool BufferPool - writeBufSize int - writeDeadline time.Time - writer io.WriteCloser // the current writer returned to the application - isWriting bool // for best-effort concurrent write detection - - writeErrMu sync.Mutex - writeErr error - - enableWriteCompression bool - compressionLevel int - newCompressionWriter func(io.WriteCloser, int) io.WriteCloser - - // Read fields - reader io.ReadCloser // the current reader returned to the application - readErr error - br *bufio.Reader - readRemaining int64 // bytes remaining in current frame. - readFinal bool // true the current message has more frames. - readLength int64 // Message size. - readLimit int64 // Maximum message size. - readMaskPos int - readMaskKey [4]byte - handlePong func(string) error - handlePing func(string) error - handleClose func(int, string) error - readErrCount int - messageReader *messageReader // the current low-level reader - - readDecompress bool // whether last read frame had RSV1 set - newDecompressionReader func(io.Reader) io.ReadCloser -} - -func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, writeBufferPool BufferPool, br *bufio.Reader, writeBuf []byte) *Conn { - - if br == nil { - if readBufferSize == 0 { - readBufferSize = defaultReadBufferSize - } else if readBufferSize < maxControlFramePayloadSize { - // must be large enough for control frame - readBufferSize = maxControlFramePayloadSize - } - br = bufio.NewReaderSize(conn, readBufferSize) - } - - if writeBufferSize <= 0 { - writeBufferSize = defaultWriteBufferSize - } - writeBufferSize += maxFrameHeaderSize - - if writeBuf == nil && writeBufferPool == nil { - writeBuf = make([]byte, writeBufferSize) - } - - mu := make(chan bool, 1) - mu <- true - c := &Conn{ - isServer: isServer, - br: br, - conn: conn, - mu: mu, - readFinal: true, - writeBuf: writeBuf, - writePool: writeBufferPool, - writeBufSize: writeBufferSize, - enableWriteCompression: true, - compressionLevel: defaultCompressionLevel, - } - c.SetCloseHandler(nil) - c.SetPingHandler(nil) - c.SetPongHandler(nil) - return c -} - -// Subprotocol returns the negotiated protocol for the connection. -func (c *Conn) Subprotocol() string { - return c.subprotocol -} - -// Close closes the underlying network connection without sending or waiting -// for a close message. -func (c *Conn) Close() error { - return c.conn.Close() -} - -// LocalAddr returns the local network address. -func (c *Conn) LocalAddr() net.Addr { - return c.conn.LocalAddr() -} - -// RemoteAddr returns the remote network address. -func (c *Conn) RemoteAddr() net.Addr { - return c.conn.RemoteAddr() -} - -// Write methods - -func (c *Conn) writeFatal(err error) error { - err = hideTempErr(err) - c.writeErrMu.Lock() - if c.writeErr == nil { - c.writeErr = err - } - c.writeErrMu.Unlock() - 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 { - <-c.mu - defer func() { c.mu <- true }() - - c.writeErrMu.Lock() - err := c.writeErr - c.writeErrMu.Unlock() - if err != nil { - return err - } - - c.conn.SetWriteDeadline(deadline) - if len(buf1) == 0 { - _, err = c.conn.Write(buf0) - } else { - err = c.writeBufs(buf0, buf1) - } - if err != nil { - return c.writeFatal(err) - } - if frameType == CloseMessage { - c.writeFatal(ErrCloseSent) - } - return nil -} - -// WriteControl writes a control message with the given deadline. The allowed -// message types are CloseMessage, PingMessage and PongMessage. -func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error { - if !isControl(messageType) { - return errBadWriteOpCode - } - if len(data) > maxControlFramePayloadSize { - return errInvalidControlFrame - } - - b0 := byte(messageType) | finalBit - b1 := byte(len(data)) - if !c.isServer { - b1 |= maskBit - } - - buf := make([]byte, 0, maxFrameHeaderSize+maxControlFramePayloadSize) - buf = append(buf, b0, b1) - - if c.isServer { - buf = append(buf, data...) - } else { - key := newMaskKey() - buf = append(buf, key[:]...) - buf = append(buf, data...) - maskBytes(key, 0, buf[6:]) - } - - d := time.Hour * 1000 - if !deadline.IsZero() { - d = deadline.Sub(time.Now()) - if d < 0 { - return errWriteTimeout - } - } - - timer := time.NewTimer(d) - select { - case <-c.mu: - timer.Stop() - case <-timer.C: - return errWriteTimeout - } - defer func() { c.mu <- true }() - - c.writeErrMu.Lock() - err := c.writeErr - c.writeErrMu.Unlock() - if err != nil { - return err - } - - c.conn.SetWriteDeadline(deadline) - _, err = c.conn.Write(buf) - if err != nil { - return c.writeFatal(err) - } - if messageType == CloseMessage { - c.writeFatal(ErrCloseSent) - } - return err -} - -func (c *Conn) prepWrite(messageType int) error { - // Close previous writer if not already closed by the application. It's - // probably better to return an error in this situation, but we cannot - // change this without breaking existing applications. - if c.writer != nil { - c.writer.Close() - c.writer = nil - } - - if !isControl(messageType) && !isData(messageType) { - return errBadWriteOpCode - } - - c.writeErrMu.Lock() - err := c.writeErr - c.writeErrMu.Unlock() - 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 -// method flushes the complete message to the network. -// -// There can be at most one open writer on a connection. NextWriter closes the -// previous writer if the application has not already done so. -// -// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and -// PongMessage) are supported. -func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) { - if err := c.prepWrite(messageType); err != nil { - return nil, err - } - - mw := &messageWriter{ - c: c, - frameType: messageType, - pos: maxFrameHeaderSize, - } - c.writer = mw - if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) { - w := c.newCompressionWriter(c.writer, c.compressionLevel) - mw.compress = true - c.writer = w - } - return c.writer, nil -} - -type messageWriter struct { - c *Conn - compress bool // whether next call to flushFrame should set RSV1 - pos int // end of data in writeBuf. - frameType int // type of the current frame. - err error -} - -func (w *messageWriter) fatal(err error) error { - if w.err != nil { - w.err = err - w.c.writer = nil - } - return err -} - -// flushFrame writes buffered data and extra as a frame to the network. The -// final argument indicates that this is the last frame in the message. -func (w *messageWriter) flushFrame(final bool, extra []byte) error { - c := w.c - length := w.pos - maxFrameHeaderSize + len(extra) - - // Check for invalid control frames. - if isControl(w.frameType) && - (!final || length > maxControlFramePayloadSize) { - return w.fatal(errInvalidControlFrame) - } - - b0 := byte(w.frameType) - if final { - b0 |= finalBit - } - if w.compress { - b0 |= rsv1Bit - } - w.compress = false - - b1 := byte(0) - if !c.isServer { - b1 |= maskBit - } - - // Assume that the frame starts at beginning of c.writeBuf. - framePos := 0 - if c.isServer { - // Adjust up if mask not included in the header. - framePos = 4 - } - - switch { - case length >= 65536: - c.writeBuf[framePos] = b0 - c.writeBuf[framePos+1] = b1 | 127 - binary.BigEndian.PutUint64(c.writeBuf[framePos+2:], uint64(length)) - case length > 125: - framePos += 6 - c.writeBuf[framePos] = b0 - c.writeBuf[framePos+1] = b1 | 126 - binary.BigEndian.PutUint16(c.writeBuf[framePos+2:], uint16(length)) - default: - framePos += 8 - c.writeBuf[framePos] = b0 - c.writeBuf[framePos+1] = b1 | byte(length) - } - - if !c.isServer { - key := newMaskKey() - copy(c.writeBuf[maxFrameHeaderSize-4:], key[:]) - maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos]) - if len(extra) > 0 { - return c.writeFatal(errors.New("websocket: internal error, extra used in client mode")) - } - } - - // Write the buffers to the connection with best-effort detection of - // concurrent writes. See the concurrency section in the package - // documentation for more info. - - if c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = true - - err := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra) - - if !c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = false - - if err != nil { - return w.fatal(err) - } - - if final { - c.writer = nil - if c.writePool != nil { - c.writePool.Put(writePoolData{buf: c.writeBuf}) - c.writeBuf = nil - } - return nil - } - - // Setup for next frame. - w.pos = maxFrameHeaderSize - w.frameType = continuationFrame - return nil -} - -func (w *messageWriter) ncopy(max int) (int, error) { - n := len(w.c.writeBuf) - w.pos - if n <= 0 { - if err := w.flushFrame(false, nil); err != nil { - return 0, err - } - n = len(w.c.writeBuf) - w.pos - } - if n > max { - n = max - } - return n, nil -} - -func (w *messageWriter) Write(p []byte) (int, error) { - if w.err != nil { - return 0, w.err - } - - if len(p) > 2*len(w.c.writeBuf) && w.c.isServer { - // Don't buffer large messages. - err := w.flushFrame(false, p) - if err != nil { - return 0, err - } - return len(p), nil - } - - nn := len(p) - for len(p) > 0 { - n, err := w.ncopy(len(p)) - if err != nil { - return 0, err - } - copy(w.c.writeBuf[w.pos:], p[:n]) - w.pos += n - p = p[n:] - } - return nn, nil -} - -func (w *messageWriter) WriteString(p string) (int, error) { - if w.err != nil { - return 0, w.err - } - - nn := len(p) - for len(p) > 0 { - n, err := w.ncopy(len(p)) - if err != nil { - return 0, err - } - copy(w.c.writeBuf[w.pos:], p[:n]) - w.pos += n - p = p[n:] - } - return nn, nil -} - -func (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) { - if w.err != nil { - return 0, w.err - } - for { - if w.pos == len(w.c.writeBuf) { - err = w.flushFrame(false, nil) - if err != nil { - break - } - } - var n int - n, err = r.Read(w.c.writeBuf[w.pos:]) - w.pos += n - nn += int64(n) - if err != nil { - if err == io.EOF { - err = nil - } - break - } - } - return nn, err -} - -func (w *messageWriter) Close() error { - if w.err != nil { - return w.err - } - if err := w.flushFrame(true, nil); err != nil { - return err - } - w.err = errWriteClosed - return nil -} - -// WritePreparedMessage writes prepared message into connection. -func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error { - frameType, frameData, err := pm.frame(prepareKey{ - isServer: c.isServer, - compress: c.newCompressionWriter != nil && c.enableWriteCompression && isData(pm.messageType), - compressionLevel: c.compressionLevel, - }) - if err != nil { - return err - } - if c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = true - err = c.write(frameType, c.writeDeadline, frameData, nil) - if !c.isWriting { - panic("concurrent write to websocket connection") - } - c.isWriting = false - return err -} - -// WriteMessage is a helper method for getting a writer using NextWriter, -// writing the message and closing the writer. -func (c *Conn) WriteMessage(messageType int, data []byte) error { - - if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) { - // Fast path with no allocations and single frame. - - if err := c.prepWrite(messageType); err != nil { - return err - } - mw := messageWriter{c: c, frameType: messageType, pos: maxFrameHeaderSize} - n := copy(c.writeBuf[mw.pos:], data) - mw.pos += n - data = data[n:] - return mw.flushFrame(true, data) - } - - w, err := c.NextWriter(messageType) - if err != nil { - return err - } - if _, err = w.Write(data); err != nil { - return err - } - return w.Close() -} - -// SetWriteDeadline sets the write deadline on the underlying network -// connection. After a write has timed out, the websocket state is corrupt and -// all future writes will return an error. A zero value for t means writes will -// not time out. -func (c *Conn) SetWriteDeadline(t time.Time) error { - c.writeDeadline = t - return nil -} - -// Read methods - -func (c *Conn) advanceFrame() (int, error) { - // 1. Skip remainder of previous frame. - - if c.readRemaining > 0 { - if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil { - return noFrame, err - } - } - - // 2. Read and parse first two bytes of frame header. - - p, err := c.read(2) - if err != nil { - return noFrame, err - } - - final := p[0]&finalBit != 0 - frameType := int(p[0] & 0xf) - mask := p[1]&maskBit != 0 - c.readRemaining = int64(p[1] & 0x7f) - - c.readDecompress = false - if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 { - c.readDecompress = true - p[0] &^= rsv1Bit - } - - if rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 { - return noFrame, c.handleProtocolError("unexpected reserved bits 0x" + strconv.FormatInt(int64(rsv), 16)) - } - - switch frameType { - case CloseMessage, PingMessage, PongMessage: - if c.readRemaining > maxControlFramePayloadSize { - return noFrame, c.handleProtocolError("control frame length > 125") - } - if !final { - return noFrame, c.handleProtocolError("control frame not final") - } - case TextMessage, BinaryMessage: - if !c.readFinal { - return noFrame, c.handleProtocolError("message start before final message frame") - } - c.readFinal = final - case continuationFrame: - if c.readFinal { - return noFrame, c.handleProtocolError("continuation after final message frame") - } - c.readFinal = final - default: - return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType)) - } - - // 3. Read and parse frame length. - - switch c.readRemaining { - case 126: - p, err := c.read(2) - if err != nil { - return noFrame, err - } - c.readRemaining = int64(binary.BigEndian.Uint16(p)) - case 127: - p, err := c.read(8) - if err != nil { - return noFrame, err - } - c.readRemaining = int64(binary.BigEndian.Uint64(p)) - } - - // 4. Handle frame masking. - - if mask != c.isServer { - return noFrame, c.handleProtocolError("incorrect mask flag") - } - - if mask { - c.readMaskPos = 0 - p, err := c.read(len(c.readMaskKey)) - if err != nil { - return noFrame, err - } - copy(c.readMaskKey[:], p) - } - - // 5. For text and binary messages, enforce read limit and return. - - if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage { - - c.readLength += c.readRemaining - if c.readLimit > 0 && c.readLength > c.readLimit { - c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)) - return noFrame, ErrReadLimit - } - - return frameType, nil - } - - // 6. Read control frame payload. - - var payload []byte - if c.readRemaining > 0 { - payload, err = c.read(int(c.readRemaining)) - c.readRemaining = 0 - if err != nil { - return noFrame, err - } - if c.isServer { - maskBytes(c.readMaskKey, 0, payload) - } - } - - // 7. Process control frame payload. - - switch frameType { - case PongMessage: - if err := c.handlePong(string(payload)); err != nil { - return noFrame, err - } - case PingMessage: - if err := c.handlePing(string(payload)); err != nil { - return noFrame, err - } - case CloseMessage: - closeCode := CloseNoStatusReceived - closeText := "" - if len(payload) >= 2 { - closeCode = int(binary.BigEndian.Uint16(payload)) - if !isValidReceivedCloseCode(closeCode) { - return noFrame, c.handleProtocolError("invalid close code") - } - closeText = string(payload[2:]) - if !utf8.ValidString(closeText) { - return noFrame, c.handleProtocolError("invalid utf8 payload in close frame") - } - } - if err := c.handleClose(closeCode, closeText); err != nil { - return noFrame, err - } - return noFrame, &CloseError{Code: closeCode, Text: closeText} - } - - return frameType, nil -} - -func (c *Conn) handleProtocolError(message string) error { - c.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait)) - return errors.New("websocket: " + message) -} - -// NextReader returns the next data message received from the peer. The -// returned messageType is either TextMessage or BinaryMessage. -// -// There can be at most one open reader on a connection. NextReader discards -// the previous message if the application has not already consumed it. -// -// Applications must break out of the application's read loop when this method -// returns a non-nil error value. Errors returned from this method are -// permanent. Once this method returns a non-nil error, all subsequent calls to -// this method return the same error. -func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { - // Close previous reader, only relevant for decompression. - if c.reader != nil { - c.reader.Close() - c.reader = nil - } - - c.messageReader = nil - c.readLength = 0 - - for c.readErr == nil { - frameType, err := c.advanceFrame() - if err != nil { - c.readErr = hideTempErr(err) - break - } - if frameType == TextMessage || frameType == BinaryMessage { - c.messageReader = &messageReader{c} - c.reader = c.messageReader - if c.readDecompress { - c.reader = c.newDecompressionReader(c.reader) - } - return frameType, c.reader, nil - } - } - - // Applications that do handle the error returned from this method spin in - // tight loop on connection failure. To help application developers detect - // this error, panic on repeated reads to the failed connection. - c.readErrCount++ - if c.readErrCount >= 1000 { - panic("repeated read on failed websocket connection") - } - - return noFrame, nil, c.readErr -} - -type messageReader struct{ c *Conn } - -func (r *messageReader) Read(b []byte) (int, error) { - c := r.c - if c.messageReader != r { - return 0, io.EOF - } - - for c.readErr == nil { - - if c.readRemaining > 0 { - if int64(len(b)) > c.readRemaining { - b = b[:c.readRemaining] - } - n, err := c.br.Read(b) - c.readErr = hideTempErr(err) - if c.isServer { - c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n]) - } - c.readRemaining -= int64(n) - if c.readRemaining > 0 && c.readErr == io.EOF { - c.readErr = errUnexpectedEOF - } - return n, c.readErr - } - - if c.readFinal { - c.messageReader = nil - return 0, io.EOF - } - - frameType, err := c.advanceFrame() - switch { - case err != nil: - c.readErr = hideTempErr(err) - case frameType == TextMessage || frameType == BinaryMessage: - c.readErr = errors.New("websocket: internal error, unexpected text or binary in Reader") - } - } - - err := c.readErr - if err == io.EOF && c.messageReader == r { - err = errUnexpectedEOF - } - return 0, err -} - -func (r *messageReader) Close() error { - return nil -} - -// ReadMessage is a helper method for getting a reader using NextReader and -// reading from that reader to a buffer. -func (c *Conn) ReadMessage() (messageType int, p []byte, err error) { - var r io.Reader - messageType, r, err = c.NextReader() - if err != nil { - return messageType, nil, err - } - p, err = ioutil.ReadAll(r) - return messageType, p, err -} - -// SetReadDeadline sets the read deadline on the underlying network connection. -// After a read has timed out, the websocket connection state is corrupt and -// all future reads will return an error. A zero value for t means reads will -// not time out. -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.conn.SetReadDeadline(t) -} - -// SetReadLimit sets the maximum size for a message read from the peer. If a -// message exceeds the limit, the connection sends a close message to the peer -// and returns ErrReadLimit to the application. -func (c *Conn) SetReadLimit(limit int64) { - c.readLimit = limit -} - -// CloseHandler returns the current close handler -func (c *Conn) CloseHandler() func(code int, text string) error { - return c.handleClose -} - -// SetCloseHandler sets the handler for close messages received from the peer. -// The code argument to h is the received close code or CloseNoStatusReceived -// if the close message is empty. The default close handler sends a close -// message back to the peer. -// -// The handler function is called from the NextReader, ReadMessage and message -// reader Read methods. The application must read the connection to process -// close messages as described in the section on Control Messages above. -// -// The connection read methods return a CloseError when a close message is -// received. Most applications should handle close messages as part of their -// normal error handling. Applications should only set a close handler when the -// application must perform some action before sending a close message back to -// the peer. -func (c *Conn) SetCloseHandler(h func(code int, text string) error) { - if h == nil { - h = func(code int, text string) error { - message := FormatCloseMessage(code, "") - c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)) - return nil - } - } - c.handleClose = h -} - -// PingHandler returns the current ping handler -func (c *Conn) PingHandler() func(appData string) error { - return c.handlePing -} - -// SetPingHandler sets the handler for ping messages received from the peer. -// The appData argument to h is the PING message application data. The default -// ping handler sends a pong to the peer. -// -// The handler function is called from the NextReader, ReadMessage and message -// reader Read methods. The application must read the connection to process -// ping messages as described in the section on Control Messages above. -func (c *Conn) SetPingHandler(h func(appData string) error) { - if h == nil { - h = func(message string) error { - err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait)) - if err == ErrCloseSent { - return nil - } else if e, ok := err.(net.Error); ok && e.Temporary() { - return nil - } - return err - } - } - c.handlePing = h -} - -// PongHandler returns the current pong handler -func (c *Conn) PongHandler() func(appData string) error { - return c.handlePong -} - -// SetPongHandler sets the handler for pong messages received from the peer. -// The appData argument to h is the PONG message application data. The default -// pong handler does nothing. -// -// The handler function is called from the NextReader, ReadMessage and message -// reader Read methods. The application must read the connection to process -// pong messages as described in the section on Control Messages above. -func (c *Conn) SetPongHandler(h func(appData string) error) { - if h == nil { - h = func(string) error { return nil } - } - c.handlePong = h -} - -// UnderlyingConn returns the internal net.Conn. This can be used to further -// modifications to connection specific flags. -func (c *Conn) UnderlyingConn() net.Conn { - return c.conn -} - -// EnableWriteCompression enables and disables write compression of -// subsequent text and binary messages. This function is a noop if -// compression was not negotiated with the peer. -func (c *Conn) EnableWriteCompression(enable bool) { - c.enableWriteCompression = enable -} - -// SetCompressionLevel sets the flate compression level for subsequent text and -// binary messages. This function is a noop if compression was not negotiated -// with the peer. See the compress/flate package for a description of -// compression levels. -func (c *Conn) SetCompressionLevel(level int) error { - if !isValidCompressionLevel(level) { - return errors.New("websocket: invalid compression level") - } - c.compressionLevel = level - return nil -} - -// FormatCloseMessage formats closeCode and text as a WebSocket close message. -// An empty message is returned for code CloseNoStatusReceived. -func FormatCloseMessage(closeCode int, text string) []byte { - if closeCode == CloseNoStatusReceived { - // Return empty message because it's illegal to send - // CloseNoStatusReceived. Return non-nil value in case application - // checks for nil. - return []byte{} - } - buf := make([]byte, 2+len(text)) - binary.BigEndian.PutUint16(buf, uint16(closeCode)) - copy(buf[2:], text) - return buf -} diff --git a/vendor/github.com/gorilla/websocket/conn_write.go b/vendor/github.com/gorilla/websocket/conn_write.go deleted file mode 100644 index a509a21f..00000000 --- a/vendor/github.com/gorilla/websocket/conn_write.go +++ /dev/null @@ -1,15 +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.8 - -package websocket - -import "net" - -func (c *Conn) writeBufs(bufs ...[]byte) error { - b := net.Buffers(bufs) - _, err := b.WriteTo(c.conn) - return err -} diff --git a/vendor/github.com/gorilla/websocket/conn_write_legacy.go b/vendor/github.com/gorilla/websocket/conn_write_legacy.go deleted file mode 100644 index 37edaff5..00000000 --- a/vendor/github.com/gorilla/websocket/conn_write_legacy.go +++ /dev/null @@ -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.8 - -package websocket - -func (c *Conn) writeBufs(bufs ...[]byte) error { - for _, buf := range bufs { - if len(buf) > 0 { - if _, err := c.conn.Write(buf); err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/gorilla/websocket/doc.go b/vendor/github.com/gorilla/websocket/doc.go deleted file mode 100644 index dcce1a63..00000000 --- a/vendor/github.com/gorilla/websocket/doc.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2013 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. - -// Package websocket implements the WebSocket protocol defined in RFC 6455. -// -// Overview -// -// The Conn type represents a WebSocket connection. A server application calls -// the Upgrader.Upgrade method from an HTTP request handler to get a *Conn: -// -// var upgrader = websocket.Upgrader{ -// ReadBufferSize: 1024, -// WriteBufferSize: 1024, -// } -// -// func handler(w http.ResponseWriter, r *http.Request) { -// conn, err := upgrader.Upgrade(w, r, nil) -// if err != nil { -// log.Println(err) -// return -// } -// ... Use conn to send and receive messages. -// } -// -// Call the connection's WriteMessage and ReadMessage methods to send and -// receive messages as a slice of bytes. This snippet of code shows how to echo -// messages using these methods: -// -// for { -// messageType, p, err := conn.ReadMessage() -// if err != nil { -// log.Println(err) -// return -// } -// if err := conn.WriteMessage(messageType, p); err != nil { -// log.Println(err) -// return -// } -// } -// -// In above snippet of code, p is a []byte and messageType is an int with value -// websocket.BinaryMessage or websocket.TextMessage. -// -// An application can also send and receive messages using the io.WriteCloser -// and io.Reader interfaces. To send a message, call the connection NextWriter -// method to get an io.WriteCloser, write the message to the writer and close -// the writer when done. To receive a message, call the connection NextReader -// method to get an io.Reader and read until io.EOF is returned. This snippet -// shows how to echo messages using the NextWriter and NextReader methods: -// -// for { -// messageType, r, err := conn.NextReader() -// if err != nil { -// return -// } -// w, err := conn.NextWriter(messageType) -// if err != nil { -// return err -// } -// if _, err := io.Copy(w, r); err != nil { -// return err -// } -// if err := w.Close(); err != nil { -// return err -// } -// } -// -// Data Messages -// -// The WebSocket protocol distinguishes between text and binary data messages. -// Text messages are interpreted as UTF-8 encoded text. The interpretation of -// binary messages is left to the application. -// -// This package uses the TextMessage and BinaryMessage integer constants to -// identify the two data message types. The ReadMessage and NextReader methods -// return the type of the received message. The messageType argument to the -// WriteMessage and NextWriter methods specifies the type of a sent message. -// -// It is the application's responsibility to ensure that text messages are -// valid UTF-8 encoded text. -// -// Control Messages -// -// The WebSocket protocol defines three types of control messages: close, ping -// and pong. Call the connection WriteControl, WriteMessage or NextWriter -// methods to send a control message to the peer. -// -// Connections handle received close messages by calling the handler function -// set with the SetCloseHandler method and by returning a *CloseError from the -// NextReader, ReadMessage or the message Read method. The default close -// handler sends a close message to the peer. -// -// Connections handle received ping messages by calling the handler function -// set with the SetPingHandler method. The default ping handler sends a pong -// message to the peer. -// -// Connections handle received pong messages by calling the handler function -// set with the SetPongHandler method. The default pong handler does nothing. -// If an application sends ping messages, then the application should set a -// pong handler to receive the corresponding pong. -// -// The control message handler functions are called from the NextReader, -// ReadMessage and message reader Read methods. The default close and ping -// handlers can block these methods for a short time when the handler writes to -// the connection. -// -// The application must read the connection to process close, ping and pong -// messages sent from the peer. If the application is not otherwise interested -// in messages from the peer, then the application should start a goroutine to -// read and discard messages from the peer. A simple example is: -// -// func readLoop(c *websocket.Conn) { -// for { -// if _, _, err := c.NextReader(); err != nil { -// c.Close() -// break -// } -// } -// } -// -// Concurrency -// -// Connections support one concurrent reader and one concurrent writer. -// -// Applications are responsible for ensuring that no more than one goroutine -// calls the write methods (NextWriter, SetWriteDeadline, WriteMessage, -// WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and -// that no more than one goroutine calls the read methods (NextReader, -// SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler) -// concurrently. -// -// The Close and WriteControl methods can be called concurrently with all other -// methods. -// -// Origin Considerations -// -// Web browsers allow Javascript applications to open a WebSocket connection to -// any host. It's up to the server to enforce an origin policy using the Origin -// request header sent by the browser. -// -// The Upgrader calls the function specified in the CheckOrigin field to check -// the origin. If the CheckOrigin function returns false, then the Upgrade -// method fails the WebSocket handshake with HTTP status 403. -// -// If the CheckOrigin field is nil, then the Upgrader uses a safe default: fail -// the handshake if the Origin request header is present and the Origin host is -// not equal to the Host request header. -// -// The deprecated package-level Upgrade function does not perform origin -// checking. The application is responsible for checking the Origin header -// before calling the Upgrade function. -// -// Compression EXPERIMENTAL -// -// Per message compression extensions (RFC 7692) are experimentally supported -// by this package in a limited capacity. Setting the EnableCompression option -// to true in Dialer or Upgrader will attempt to negotiate per message deflate -// support. -// -// var upgrader = websocket.Upgrader{ -// EnableCompression: true, -// } -// -// If compression was successfully negotiated with the connection's peer, any -// message received in compressed form will be automatically decompressed. -// All Read methods will return uncompressed bytes. -// -// Per message compression of messages written to a connection can be enabled -// or disabled by calling the corresponding Conn method: -// -// conn.EnableWriteCompression(false) -// -// Currently this package does not support compression with "context takeover". -// This means that messages must be compressed and decompressed in isolation, -// without retaining sliding window or dictionary state across messages. For -// more details refer to RFC 7692. -// -// Use of compression is experimental and may result in decreased performance. -package websocket diff --git a/vendor/github.com/gorilla/websocket/json.go b/vendor/github.com/gorilla/websocket/json.go deleted file mode 100644 index dc2c1f64..00000000 --- a/vendor/github.com/gorilla/websocket/json.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2013 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. - -package websocket - -import ( - "encoding/json" - "io" -) - -// WriteJSON writes the JSON encoding of v as a message. -// -// Deprecated: Use c.WriteJSON instead. -func WriteJSON(c *Conn, v interface{}) error { - return c.WriteJSON(v) -} - -// WriteJSON writes the JSON encoding of v as a message. -// -// See the documentation for encoding/json Marshal for details about the -// conversion of Go values to JSON. -func (c *Conn) WriteJSON(v interface{}) error { - w, err := c.NextWriter(TextMessage) - if err != nil { - return err - } - err1 := json.NewEncoder(w).Encode(v) - err2 := w.Close() - if err1 != nil { - return err1 - } - return err2 -} - -// ReadJSON reads the next JSON-encoded message from the connection and stores -// it in the value pointed to by v. -// -// Deprecated: Use c.ReadJSON instead. -func ReadJSON(c *Conn, v interface{}) error { - return c.ReadJSON(v) -} - -// ReadJSON reads the next JSON-encoded message from the connection and stores -// it in the value pointed to by v. -// -// See the documentation for the encoding/json Unmarshal function for details -// about the conversion of JSON to a Go value. -func (c *Conn) ReadJSON(v interface{}) error { - _, r, err := c.NextReader() - if err != nil { - return err - } - err = json.NewDecoder(r).Decode(v) - if err == io.EOF { - // One value is expected in the message. - err = io.ErrUnexpectedEOF - } - return err -} diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go deleted file mode 100644 index 577fce9e..00000000 --- a/vendor/github.com/gorilla/websocket/mask.go +++ /dev/null @@ -1,54 +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 !appengine - -package websocket - -import "unsafe" - -const wordSize = int(unsafe.Sizeof(uintptr(0))) - -func maskBytes(key [4]byte, pos int, b []byte) int { - // Mask one byte at a time for small buffers. - if len(b) < 2*wordSize { - for i := range b { - b[i] ^= key[pos&3] - pos++ - } - return pos & 3 - } - - // Mask one byte at a time to word boundary. - if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { - n = wordSize - n - for i := range b[:n] { - b[i] ^= key[pos&3] - pos++ - } - b = b[n:] - } - - // Create aligned word size key. - var k [wordSize]byte - for i := range k { - k[i] = key[(pos+i)&3] - } - kw := *(*uintptr)(unsafe.Pointer(&k)) - - // Mask one word at a time. - n := (len(b) / wordSize) * wordSize - for i := 0; i < n; i += wordSize { - *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw - } - - // Mask one byte at a time for remaining bytes. - b = b[n:] - for i := range b { - b[i] ^= key[pos&3] - pos++ - } - - return pos & 3 -} diff --git a/vendor/github.com/gorilla/websocket/mask_safe.go b/vendor/github.com/gorilla/websocket/mask_safe.go deleted file mode 100644 index 2aac060e..00000000 --- a/vendor/github.com/gorilla/websocket/mask_safe.go +++ /dev/null @@ -1,15 +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 appengine - -package websocket - -func maskBytes(key [4]byte, pos int, b []byte) int { - for i := range b { - b[i] ^= key[pos&3] - pos++ - } - return pos & 3 -} diff --git a/vendor/github.com/gorilla/websocket/prepared.go b/vendor/github.com/gorilla/websocket/prepared.go deleted file mode 100644 index 74ec565d..00000000 --- a/vendor/github.com/gorilla/websocket/prepared.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2017 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. - -package websocket - -import ( - "bytes" - "net" - "sync" - "time" -) - -// PreparedMessage caches on the wire representations of a message payload. -// Use PreparedMessage to efficiently send a message payload to multiple -// connections. PreparedMessage is especially useful when compression is used -// because the CPU and memory expensive compression operation can be executed -// once for a given set of compression options. -type PreparedMessage struct { - messageType int - data []byte - mu sync.Mutex - frames map[prepareKey]*preparedFrame -} - -// prepareKey defines a unique set of options to cache prepared frames in PreparedMessage. -type prepareKey struct { - isServer bool - compress bool - compressionLevel int -} - -// preparedFrame contains data in wire representation. -type preparedFrame struct { - once sync.Once - data []byte -} - -// NewPreparedMessage returns an initialized PreparedMessage. You can then send -// it to connection using WritePreparedMessage method. Valid wire -// representation will be calculated lazily only once for a set of current -// connection options. -func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) { - pm := &PreparedMessage{ - messageType: messageType, - frames: make(map[prepareKey]*preparedFrame), - data: data, - } - - // Prepare a plain server frame. - _, frameData, err := pm.frame(prepareKey{isServer: true, compress: false}) - if err != nil { - return nil, err - } - - // To protect against caller modifying the data argument, remember the data - // copied to the plain server frame. - pm.data = frameData[len(frameData)-len(data):] - return pm, nil -} - -func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) { - pm.mu.Lock() - frame, ok := pm.frames[key] - if !ok { - frame = &preparedFrame{} - pm.frames[key] = frame - } - pm.mu.Unlock() - - var err error - frame.once.Do(func() { - // Prepare a frame using a 'fake' connection. - // TODO: Refactor code in conn.go to allow more direct construction of - // the frame. - mu := make(chan bool, 1) - mu <- true - var nc prepareConn - c := &Conn{ - conn: &nc, - mu: mu, - isServer: key.isServer, - compressionLevel: key.compressionLevel, - enableWriteCompression: true, - writeBuf: make([]byte, defaultWriteBufferSize+maxFrameHeaderSize), - } - if key.compress { - c.newCompressionWriter = compressNoContextTakeover - } - err = c.WriteMessage(pm.messageType, pm.data) - frame.data = nc.buf.Bytes() - }) - return pm.messageType, frame.data, err -} - -type prepareConn struct { - buf bytes.Buffer - net.Conn -} - -func (pc *prepareConn) Write(p []byte) (int, error) { return pc.buf.Write(p) } -func (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil } diff --git a/vendor/github.com/gorilla/websocket/proxy.go b/vendor/github.com/gorilla/websocket/proxy.go deleted file mode 100644 index bf2478e4..00000000 --- a/vendor/github.com/gorilla/websocket/proxy.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2017 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. - -package websocket - -import ( - "bufio" - "encoding/base64" - "errors" - "net" - "net/http" - "net/url" - "strings" -) - -type netDialerFunc func(network, addr string) (net.Conn, error) - -func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) { - return fn(network, addr) -} - -func init() { - proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) { - return &httpProxyDialer{proxyURL: proxyURL, fowardDial: forwardDialer.Dial}, nil - }) -} - -type httpProxyDialer struct { - proxyURL *url.URL - fowardDial func(network, addr string) (net.Conn, error) -} - -func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) { - hostPort, _ := hostPortNoPort(hpd.proxyURL) - conn, err := hpd.fowardDial(network, hostPort) - if err != nil { - return nil, err - } - - connectHeader := make(http.Header) - if user := hpd.proxyURL.User; user != nil { - proxyUser := user.Username() - if proxyPassword, passwordSet := user.Password(); passwordSet { - credential := base64.StdEncoding.EncodeToString([]byte(proxyUser + ":" + proxyPassword)) - connectHeader.Set("Proxy-Authorization", "Basic "+credential) - } - } - - connectReq := &http.Request{ - Method: "CONNECT", - URL: &url.URL{Opaque: addr}, - Host: addr, - Header: connectHeader, - } - - if err := connectReq.Write(conn); err != nil { - conn.Close() - return nil, err - } - - // Read response. It's OK to use and discard buffered reader here becaue - // the remote server does not speak until spoken to. - br := bufio.NewReader(conn) - resp, err := http.ReadResponse(br, connectReq) - if err != nil { - conn.Close() - return nil, err - } - - if resp.StatusCode != 200 { - conn.Close() - f := strings.SplitN(resp.Status, " ", 2) - return nil, errors.New(f[1]) - } - return conn, nil -} diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go deleted file mode 100644 index a761824b..00000000 --- a/vendor/github.com/gorilla/websocket/server.go +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright 2013 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. - -package websocket - -import ( - "bufio" - "errors" - "io" - "net/http" - "net/url" - "strings" - "time" -) - -// HandshakeError describes an error with the handshake from the peer. -type HandshakeError struct { - message string -} - -func (e HandshakeError) Error() string { return e.message } - -// Upgrader specifies parameters for upgrading an HTTP connection to a -// WebSocket connection. -type Upgrader struct { - // HandshakeTimeout specifies the duration for the handshake to complete. - HandshakeTimeout time.Duration - - // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer - // size is zero, then buffers allocated by the HTTP server are used. The - // I/O buffer sizes do not limit the size of the messages that can be sent - // or received. - 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 - // 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 - // requested by the client. If there's no match, then no protocol is - // negotiated (the Sec-Websocket-Protocol header is not included in the - // handshake response). - Subprotocols []string - - // Error specifies the function for generating HTTP error responses. If Error - // is nil, then http.Error is used to generate the HTTP response. - Error func(w http.ResponseWriter, r *http.Request, status int, reason error) - - // CheckOrigin returns true if the request Origin header is acceptable. If - // CheckOrigin is nil, then a safe default is used: return false if the - // Origin request header is present and the origin host is not equal to - // request Host header. - // - // A CheckOrigin function should carefully validate the request origin to - // prevent cross-site request forgery. - CheckOrigin func(r *http.Request) bool - - // EnableCompression specify if the server should attempt to negotiate per - // message compression (RFC 7692). Setting this value to true does not - // guarantee that compression will be supported. Currently only "no context - // takeover" modes are supported. - EnableCompression bool -} - -func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) { - err := HandshakeError{reason} - if u.Error != nil { - u.Error(w, r, status, err) - } else { - w.Header().Set("Sec-Websocket-Version", "13") - http.Error(w, http.StatusText(status), status) - } - return nil, err -} - -// checkSameOrigin returns true if the origin is not set or is equal to the request host. -func checkSameOrigin(r *http.Request) bool { - origin := r.Header["Origin"] - if len(origin) == 0 { - return true - } - u, err := url.Parse(origin[0]) - if err != nil { - return false - } - return equalASCIIFold(u.Host, r.Host) -} - -func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string { - if u.Subprotocols != nil { - clientProtocols := Subprotocols(r) - for _, serverProtocol := range u.Subprotocols { - for _, clientProtocol := range clientProtocols { - if clientProtocol == serverProtocol { - return clientProtocol - } - } - } - } else if responseHeader != nil { - return responseHeader.Get("Sec-Websocket-Protocol") - } - return "" -} - -// Upgrade upgrades the HTTP server connection to the WebSocket protocol. -// -// The responseHeader is included in the response to the client's upgrade -// request. Use the responseHeader to specify cookies (Set-Cookie) and the -// application negotiated subprotocol (Sec-WebSocket-Protocol). -// -// If the upgrade fails, then Upgrade replies to the client with an HTTP error -// response. -func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) { - const badHandshake = "websocket: the client is not using the websocket protocol: " - - if !tokenListContainsValue(r.Header, "Connection", "upgrade") { - return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'upgrade' token not found in 'Connection' header") - } - - if !tokenListContainsValue(r.Header, "Upgrade", "websocket") { - return u.returnError(w, r, http.StatusBadRequest, badHandshake+"'websocket' token not found in 'Upgrade' header") - } - - if r.Method != "GET" { - return u.returnError(w, r, http.StatusMethodNotAllowed, badHandshake+"request method is not GET") - } - - if !tokenListContainsValue(r.Header, "Sec-Websocket-Version", "13") { - return u.returnError(w, r, http.StatusBadRequest, "websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header") - } - - if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok { - return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-WebSocket-Extensions' headers are unsupported") - } - - checkOrigin := u.CheckOrigin - if checkOrigin == nil { - checkOrigin = checkSameOrigin - } - if !checkOrigin(r) { - return u.returnError(w, r, http.StatusForbidden, "websocket: request origin not allowed by Upgrader.CheckOrigin") - } - - challengeKey := r.Header.Get("Sec-Websocket-Key") - if challengeKey == "" { - return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-WebSocket-Key' header is missing or blank") - } - - subprotocol := u.selectSubprotocol(r, responseHeader) - - // Negotiate PMCE - var compress bool - if u.EnableCompression { - for _, ext := range parseExtensions(r.Header) { - if ext[""] != "permessage-deflate" { - continue - } - compress = true - break - } - } - - h, ok := w.(http.Hijacker) - if !ok { - return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker") - } - var brw *bufio.ReadWriter - netConn, brw, err := h.Hijack() - if err != nil { - return u.returnError(w, r, http.StatusInternalServerError, err.Error()) - } - - if brw.Reader.Buffered() > 0 { - netConn.Close() - return nil, errors.New("websocket: client sent data before handshake is complete") - } - - 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 - - if compress { - c.newCompressionWriter = compressNoContextTakeover - c.newDecompressionReader = decompressNoContextTakeover - } - - // 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, computeAcceptKey(challengeKey)...) - p = append(p, "\r\n"...) - if c.subprotocol != "" { - p = append(p, "Sec-WebSocket-Protocol: "...) - p = append(p, c.subprotocol...) - p = append(p, "\r\n"...) - } - if compress { - p = append(p, "Sec-WebSocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...) - } - for k, vs := range responseHeader { - if k == "Sec-Websocket-Protocol" { - continue - } - for _, v := range vs { - p = append(p, k...) - p = append(p, ": "...) - for i := 0; i < len(v); i++ { - b := v[i] - if b <= 31 { - // prevent response splitting. - b = ' ' - } - p = append(p, b) - } - p = append(p, "\r\n"...) - } - } - p = append(p, "\r\n"...) - - // Clear deadlines set by HTTP server. - netConn.SetDeadline(time.Time{}) - - if u.HandshakeTimeout > 0 { - netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)) - } - if _, err = netConn.Write(p); err != nil { - netConn.Close() - return nil, err - } - if u.HandshakeTimeout > 0 { - netConn.SetWriteDeadline(time.Time{}) - } - - return c, nil -} - -// Upgrade upgrades the HTTP server connection to the WebSocket protocol. -// -// Deprecated: Use websocket.Upgrader instead. -// -// Upgrade does not perform origin checking. The application is responsible for -// checking the Origin header before calling Upgrade. An example implementation -// of the same origin policy check is: -// -// if req.Header.Get("Origin") != "http://"+req.Host { -// http.Error(w, "Origin not allowed", http.StatusForbidden) -// return -// } -// -// If the endpoint supports subprotocols, then the application is responsible -// for negotiating the protocol used on the connection. Use the Subprotocols() -// function to get the subprotocols requested by the client. Use the -// Sec-Websocket-Protocol response header to specify the subprotocol selected -// by the application. -// -// The responseHeader is included in the response to the client's upgrade -// request. Use the responseHeader to specify cookies (Set-Cookie) and the -// negotiated subprotocol (Sec-Websocket-Protocol). -// -// The connection buffers IO to the underlying network connection. The -// readBufSize and writeBufSize parameters specify the size of the buffers to -// use. Messages can be larger than the buffers. -// -// If the request is not a valid WebSocket handshake, then Upgrade returns an -// error of type HandshakeError. Applications should handle this error by -// replying to the client with an HTTP error response. -func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) { - u := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize} - u.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) { - // don't return errors to maintain backwards compatibility - } - u.CheckOrigin = func(r *http.Request) bool { - // allow all connections by default - return true - } - return u.Upgrade(w, r, responseHeader) -} - -// Subprotocols returns the subprotocols requested by the client in the -// Sec-Websocket-Protocol header. -func Subprotocols(r *http.Request) []string { - h := strings.TrimSpace(r.Header.Get("Sec-Websocket-Protocol")) - if h == "" { - return nil - } - protocols := strings.Split(h, ",") - for i := range protocols { - protocols[i] = strings.TrimSpace(protocols[i]) - } - return protocols -} - -// IsWebSocketUpgrade returns true if the client requested upgrade to the -// WebSocket protocol. -func IsWebSocketUpgrade(r *http.Request) bool { - return tokenListContainsValue(r.Header, "Connection", "upgrade") && - 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)] -} diff --git a/vendor/github.com/gorilla/websocket/trace.go b/vendor/github.com/gorilla/websocket/trace.go deleted file mode 100644 index 834f122a..00000000 --- a/vendor/github.com/gorilla/websocket/trace.go +++ /dev/null @@ -1,19 +0,0 @@ -// +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 -} diff --git a/vendor/github.com/gorilla/websocket/trace_17.go b/vendor/github.com/gorilla/websocket/trace_17.go deleted file mode 100644 index 77d05a0b..00000000 --- a/vendor/github.com/gorilla/websocket/trace_17.go +++ /dev/null @@ -1,12 +0,0 @@ -// +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) -} diff --git a/vendor/github.com/gorilla/websocket/util.go b/vendor/github.com/gorilla/websocket/util.go deleted file mode 100644 index 354001e1..00000000 --- a/vendor/github.com/gorilla/websocket/util.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2013 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. - -package websocket - -import ( - "crypto/rand" - "crypto/sha1" - "encoding/base64" - "io" - "net/http" - "strings" - "unicode/utf8" -) - -var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") - -func computeAcceptKey(challengeKey string) string { - h := sha1.New() - h.Write([]byte(challengeKey)) - h.Write(keyGUID) - return base64.StdEncoding.EncodeToString(h.Sum(nil)) -} - -func generateChallengeKey() (string, error) { - p := make([]byte, 16) - if _, err := io.ReadFull(rand.Reader, p); err != nil { - return "", err - } - return base64.StdEncoding.EncodeToString(p), nil -} - -// Octet types from RFC 2616. -var octetTypes [256]byte - -const ( - isTokenOctet = 1 << iota - isSpaceOctet -) - -func init() { - // From RFC 2616 - // - // OCTET = - // CHAR = - // CTL = - // CR = - // LF = - // SP = - // HT = - // <"> = - // CRLF = CR LF - // LWS = [CRLF] 1*( SP | HT ) - // TEXT = - // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> - // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT - // token = 1* - // qdtext = > - - for c := 0; c < 256; c++ { - var t byte - isCtl := c <= 31 || c == 127 - isChar := 0 <= c && c <= 127 - isSeparator := strings.IndexRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) >= 0 - if strings.IndexRune(" \t\r\n", rune(c)) >= 0 { - t |= isSpaceOctet - } - if isChar && !isCtl && !isSeparator { - t |= isTokenOctet - } - octetTypes[c] = t - } -} - -func skipSpace(s string) (rest string) { - i := 0 - for ; i < len(s); i++ { - if octetTypes[s[i]]&isSpaceOctet == 0 { - break - } - } - return s[i:] -} - -func nextToken(s string) (token, rest string) { - i := 0 - for ; i < len(s); i++ { - if octetTypes[s[i]]&isTokenOctet == 0 { - break - } - } - return s[:i], s[i:] -} - -func nextTokenOrQuoted(s string) (value string, rest string) { - if !strings.HasPrefix(s, "\"") { - return nextToken(s) - } - s = s[1:] - for i := 0; i < len(s); i++ { - switch s[i] { - case '"': - return s[:i], s[i+1:] - case '\\': - p := make([]byte, len(s)-1) - j := copy(p, s[:i]) - escape := true - for i = i + 1; i < len(s); i++ { - b := s[i] - switch { - case escape: - escape = false - p[j] = b - j++ - case b == '\\': - escape = true - case b == '"': - return string(p[:j]), s[i+1:] - default: - p[j] = b - j++ - } - } - return "", "" - } - } - return "", "" -} - -// equalASCIIFold returns true if s is equal to t with ASCII case folding. -func equalASCIIFold(s, t string) bool { - for s != "" && t != "" { - sr, size := utf8.DecodeRuneInString(s) - s = s[size:] - tr, size := utf8.DecodeRuneInString(t) - t = t[size:] - if sr == tr { - continue - } - if 'A' <= sr && sr <= 'Z' { - sr = sr + 'a' - 'A' - } - if 'A' <= tr && tr <= 'Z' { - tr = tr + 'a' - 'A' - } - if sr != tr { - return false - } - } - return s == t -} - -// tokenListContainsValue returns true if the 1#token header with the given -// name contains a token equal to value with ASCII case folding. -func tokenListContainsValue(header http.Header, name string, value string) bool { -headers: - for _, s := range header[name] { - for { - var t string - t, s = nextToken(skipSpace(s)) - if t == "" { - continue headers - } - s = skipSpace(s) - if s != "" && s[0] != ',' { - continue headers - } - if equalASCIIFold(t, value) { - return true - } - if s == "" { - continue headers - } - s = s[1:] - } - } - return false -} - -// parseExtensions parses WebSocket extensions from a header. -func parseExtensions(header http.Header) []map[string]string { - // From RFC 6455: - // - // Sec-WebSocket-Extensions = extension-list - // extension-list = 1#extension - // extension = extension-token *( ";" extension-param ) - // extension-token = registered-token - // registered-token = token - // extension-param = token [ "=" (token | quoted-string) ] - // ;When using the quoted-string syntax variant, the value - // ;after quoted-string unescaping MUST conform to the - // ;'token' ABNF. - - var result []map[string]string -headers: - for _, s := range header["Sec-Websocket-Extensions"] { - for { - var t string - t, s = nextToken(skipSpace(s)) - if t == "" { - continue headers - } - ext := map[string]string{"": t} - for { - s = skipSpace(s) - if !strings.HasPrefix(s, ";") { - break - } - var k string - k, s = nextToken(skipSpace(s[1:])) - if k == "" { - continue headers - } - s = skipSpace(s) - var v string - if strings.HasPrefix(s, "=") { - v, s = nextTokenOrQuoted(skipSpace(s[1:])) - s = skipSpace(s) - } - if s != "" && s[0] != ',' && s[0] != ';' { - continue headers - } - ext[k] = v - } - if s != "" && s[0] != ',' { - continue headers - } - result = append(result, ext) - if s == "" { - continue headers - } - s = s[1:] - } - } - return result -} diff --git a/vendor/github.com/gorilla/websocket/x_net_proxy.go b/vendor/github.com/gorilla/websocket/x_net_proxy.go deleted file mode 100644 index 2e668f6b..00000000 --- a/vendor/github.com/gorilla/websocket/x_net_proxy.go +++ /dev/null @@ -1,473 +0,0 @@ -// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT. -//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy - -// Package proxy provides support for a variety of protocols to proxy network -// data. -// - -package websocket - -import ( - "errors" - "io" - "net" - "net/url" - "os" - "strconv" - "strings" - "sync" -) - -type proxy_direct struct{} - -// Direct is a direct proxy: one that makes network connections directly. -var proxy_Direct = proxy_direct{} - -func (proxy_direct) Dial(network, addr string) (net.Conn, error) { - return net.Dial(network, addr) -} - -// A PerHost directs connections to a default Dialer unless the host name -// requested matches one of a number of exceptions. -type proxy_PerHost struct { - def, bypass proxy_Dialer - - bypassNetworks []*net.IPNet - bypassIPs []net.IP - bypassZones []string - bypassHosts []string -} - -// NewPerHost returns a PerHost Dialer that directs connections to either -// defaultDialer or bypass, depending on whether the connection matches one of -// the configured rules. -func proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost { - return &proxy_PerHost{ - def: defaultDialer, - bypass: bypass, - } -} - -// Dial connects to the address addr on the given network through either -// defaultDialer or bypass. -func (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - - return p.dialerForRequest(host).Dial(network, addr) -} - -func (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer { - if ip := net.ParseIP(host); ip != nil { - for _, net := range p.bypassNetworks { - if net.Contains(ip) { - return p.bypass - } - } - for _, bypassIP := range p.bypassIPs { - if bypassIP.Equal(ip) { - return p.bypass - } - } - return p.def - } - - for _, zone := range p.bypassZones { - if strings.HasSuffix(host, zone) { - return p.bypass - } - if host == zone[1:] { - // For a zone ".example.com", we match "example.com" - // too. - return p.bypass - } - } - for _, bypassHost := range p.bypassHosts { - if bypassHost == host { - return p.bypass - } - } - return p.def -} - -// AddFromString parses a string that contains comma-separated values -// specifying hosts that should use the bypass proxy. Each value is either an -// IP address, a CIDR range, a zone (*.example.com) or a host name -// (localhost). A best effort is made to parse the string and errors are -// ignored. -func (p *proxy_PerHost) AddFromString(s string) { - hosts := strings.Split(s, ",") - for _, host := range hosts { - host = strings.TrimSpace(host) - if len(host) == 0 { - continue - } - if strings.Contains(host, "/") { - // We assume that it's a CIDR address like 127.0.0.0/8 - if _, net, err := net.ParseCIDR(host); err == nil { - p.AddNetwork(net) - } - continue - } - if ip := net.ParseIP(host); ip != nil { - p.AddIP(ip) - continue - } - if strings.HasPrefix(host, "*.") { - p.AddZone(host[1:]) - continue - } - p.AddHost(host) - } -} - -// AddIP specifies an IP address that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match an IP. -func (p *proxy_PerHost) AddIP(ip net.IP) { - p.bypassIPs = append(p.bypassIPs, ip) -} - -// AddNetwork specifies an IP range that will use the bypass proxy. Note that -// this will only take effect if a literal IP address is dialed. A connection -// to a named host will never match. -func (p *proxy_PerHost) AddNetwork(net *net.IPNet) { - p.bypassNetworks = append(p.bypassNetworks, net) -} - -// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of -// "example.com" matches "example.com" and all of its subdomains. -func (p *proxy_PerHost) AddZone(zone string) { - if strings.HasSuffix(zone, ".") { - zone = zone[:len(zone)-1] - } - if !strings.HasPrefix(zone, ".") { - zone = "." + zone - } - p.bypassZones = append(p.bypassZones, zone) -} - -// AddHost specifies a host name that will use the bypass proxy. -func (p *proxy_PerHost) AddHost(host string) { - if strings.HasSuffix(host, ".") { - host = host[:len(host)-1] - } - p.bypassHosts = append(p.bypassHosts, host) -} - -// A Dialer is a means to establish a connection. -type proxy_Dialer interface { - // Dial connects to the given address via the proxy. - Dial(network, addr string) (c net.Conn, err error) -} - -// Auth contains authentication parameters that specific Dialers may require. -type proxy_Auth struct { - User, Password string -} - -// FromEnvironment returns the dialer specified by the proxy related variables in -// the environment. -func proxy_FromEnvironment() proxy_Dialer { - allProxy := proxy_allProxyEnv.Get() - if len(allProxy) == 0 { - return proxy_Direct - } - - proxyURL, err := url.Parse(allProxy) - if err != nil { - return proxy_Direct - } - proxy, err := proxy_FromURL(proxyURL, proxy_Direct) - if err != nil { - return proxy_Direct - } - - noProxy := proxy_noProxyEnv.Get() - if len(noProxy) == 0 { - return proxy - } - - perHost := proxy_NewPerHost(proxy, proxy_Direct) - perHost.AddFromString(noProxy) - return perHost -} - -// proxySchemes is a map from URL schemes to a function that creates a Dialer -// from a URL with such a scheme. -var proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error) - -// RegisterDialerType takes a URL scheme and a function to generate Dialers from -// a URL with that scheme and a forwarding Dialer. Registered schemes are used -// by FromURL. -func proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) { - if proxy_proxySchemes == nil { - proxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) - } - proxy_proxySchemes[scheme] = f -} - -// FromURL returns a Dialer given a URL specification and an underlying -// Dialer for it to make network requests. -func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) { - var auth *proxy_Auth - if u.User != nil { - auth = new(proxy_Auth) - auth.User = u.User.Username() - if p, ok := u.User.Password(); ok { - auth.Password = p - } - } - - switch u.Scheme { - case "socks5": - return proxy_SOCKS5("tcp", u.Host, auth, forward) - } - - // If the scheme doesn't match any of the built-in schemes, see if it - // was registered by another package. - if proxy_proxySchemes != nil { - if f, ok := proxy_proxySchemes[u.Scheme]; ok { - return f(u, forward) - } - } - - return nil, errors.New("proxy: unknown scheme: " + u.Scheme) -} - -var ( - proxy_allProxyEnv = &proxy_envOnce{ - names: []string{"ALL_PROXY", "all_proxy"}, - } - proxy_noProxyEnv = &proxy_envOnce{ - names: []string{"NO_PROXY", "no_proxy"}, - } -) - -// envOnce looks up an environment variable (optionally by multiple -// names) once. It mitigates expensive lookups on some platforms -// (e.g. Windows). -// (Borrowed from net/http/transport.go) -type proxy_envOnce struct { - names []string - once sync.Once - val string -} - -func (e *proxy_envOnce) Get() string { - e.once.Do(e.init) - return e.val -} - -func (e *proxy_envOnce) init() { - for _, n := range e.names { - e.val = os.Getenv(n) - if e.val != "" { - return - } - } -} - -// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address -// with an optional username and password. See RFC 1928 and RFC 1929. -func proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) { - s := &proxy_socks5{ - network: network, - addr: addr, - forward: forward, - } - if auth != nil { - s.user = auth.User - s.password = auth.Password - } - - return s, nil -} - -type proxy_socks5 struct { - user, password string - network, addr string - forward proxy_Dialer -} - -const proxy_socks5Version = 5 - -const ( - proxy_socks5AuthNone = 0 - proxy_socks5AuthPassword = 2 -) - -const proxy_socks5Connect = 1 - -const ( - proxy_socks5IP4 = 1 - proxy_socks5Domain = 3 - proxy_socks5IP6 = 4 -) - -var proxy_socks5Errors = []string{ - "", - "general failure", - "connection forbidden", - "network unreachable", - "host unreachable", - "connection refused", - "TTL expired", - "command not supported", - "address type not supported", -} - -// Dial connects to the address addr on the given network via the SOCKS5 proxy. -func (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) { - switch network { - case "tcp", "tcp6", "tcp4": - default: - return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network) - } - - conn, err := s.forward.Dial(s.network, s.addr) - if err != nil { - return nil, err - } - if err := s.connect(conn, addr); err != nil { - conn.Close() - return nil, err - } - return conn, nil -} - -// connect takes an existing connection to a socks5 proxy server, -// and commands the server to extend that connection to target, -// which must be a canonical address with a host and port. -func (s *proxy_socks5) connect(conn net.Conn, target string) error { - host, portStr, err := net.SplitHostPort(target) - if err != nil { - return err - } - - port, err := strconv.Atoi(portStr) - if err != nil { - return errors.New("proxy: failed to parse port number: " + portStr) - } - if port < 1 || port > 0xffff { - return errors.New("proxy: port number out of range: " + portStr) - } - - // the size here is just an estimate - buf := make([]byte, 0, 6+len(host)) - - buf = append(buf, proxy_socks5Version) - if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 { - buf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword) - } else { - buf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone) - } - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - if buf[0] != 5 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) - } - if buf[1] == 0xff { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") - } - - // See RFC 1929 - if buf[1] == proxy_socks5AuthPassword { - buf = buf[:0] - buf = append(buf, 1 /* password protocol version */) - buf = append(buf, uint8(len(s.user))) - buf = append(buf, s.user...) - buf = append(buf, uint8(len(s.password))) - buf = append(buf, s.password...) - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if buf[1] != 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") - } - } - - buf = buf[:0] - buf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */) - - if ip := net.ParseIP(host); ip != nil { - if ip4 := ip.To4(); ip4 != nil { - buf = append(buf, proxy_socks5IP4) - ip = ip4 - } else { - buf = append(buf, proxy_socks5IP6) - } - buf = append(buf, ip...) - } else { - if len(host) > 255 { - return errors.New("proxy: destination host name too long: " + host) - } - buf = append(buf, proxy_socks5Domain) - buf = append(buf, byte(len(host))) - buf = append(buf, host...) - } - buf = append(buf, byte(port>>8), byte(port)) - - if _, err := conn.Write(buf); err != nil { - return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - if _, err := io.ReadFull(conn, buf[:4]); err != nil { - return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - failure := "unknown error" - if int(buf[1]) < len(proxy_socks5Errors) { - failure = proxy_socks5Errors[buf[1]] - } - - if len(failure) > 0 { - return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) - } - - bytesToDiscard := 0 - switch buf[3] { - case proxy_socks5IP4: - bytesToDiscard = net.IPv4len - case proxy_socks5IP6: - bytesToDiscard = net.IPv6len - case proxy_socks5Domain: - _, err := io.ReadFull(conn, buf[:1]) - if err != nil { - return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - bytesToDiscard = int(buf[0]) - default: - return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) - } - - if cap(buf) < bytesToDiscard { - buf = make([]byte, bytesToDiscard) - } else { - buf = buf[:bytesToDiscard] - } - if _, err := io.ReadFull(conn, buf); err != nil { - return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - // Also need to discard the port number - if _, err := io.ReadFull(conn, buf[:2]); err != nil { - return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/errwrap/LICENSE b/vendor/github.com/hashicorp/errwrap/LICENSE deleted file mode 100644 index c33dcc7c..00000000 --- a/vendor/github.com/hashicorp/errwrap/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/errwrap/README.md b/vendor/github.com/hashicorp/errwrap/README.md deleted file mode 100644 index 444df08f..00000000 --- a/vendor/github.com/hashicorp/errwrap/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# errwrap - -`errwrap` is a package for Go that formalizes the pattern of wrapping errors -and checking if an error contains another error. - -There is a common pattern in Go of taking a returned `error` value and -then wrapping it (such as with `fmt.Errorf`) before returning it. The problem -with this pattern is that you completely lose the original `error` structure. - -Arguably the _correct_ approach is that you should make a custom structure -implementing the `error` interface, and have the original error as a field -on that structure, such [as this example](http://golang.org/pkg/os/#PathError). -This is a good approach, but you have to know the entire chain of possible -rewrapping that happens, when you might just care about one. - -`errwrap` formalizes this pattern (it doesn't matter what approach you use -above) by giving a single interface for wrapping errors, checking if a specific -error is wrapped, and extracting that error. - -## Installation and Docs - -Install using `go get github.com/hashicorp/errwrap`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/errwrap - -## Usage - -#### Basic Usage - -Below is a very basic example of its usage: - -```go -// A function that always returns an error, but wraps it, like a real -// function might. -func tryOpen() error { - _, err := os.Open("/i/dont/exist") - if err != nil { - return errwrap.Wrapf("Doesn't exist: {{err}}", err) - } - - return nil -} - -func main() { - err := tryOpen() - - // We can use the Contains helpers to check if an error contains - // another error. It is safe to do this with a nil error, or with - // an error that doesn't even use the errwrap package. - if errwrap.Contains(err, "does not exist") { - // Do something - } - if errwrap.ContainsType(err, new(os.PathError)) { - // Do something - } - - // Or we can use the associated `Get` functions to just extract - // a specific error. This would return nil if that specific error doesn't - // exist. - perr := errwrap.GetType(err, new(os.PathError)) -} -``` - -#### Custom Types - -If you're already making custom types that properly wrap errors, then -you can get all the functionality of `errwraps.Contains` and such by -implementing the `Wrapper` interface with just one function. Example: - -```go -type AppError { - Code ErrorCode - Err error -} - -func (e *AppError) WrappedErrors() []error { - return []error{e.Err} -} -``` - -Now this works: - -```go -err := &AppError{Err: fmt.Errorf("an error")} -if errwrap.ContainsType(err, fmt.Errorf("")) { - // This will work! -} -``` diff --git a/vendor/github.com/hashicorp/errwrap/errwrap.go b/vendor/github.com/hashicorp/errwrap/errwrap.go deleted file mode 100644 index a733bef1..00000000 --- a/vendor/github.com/hashicorp/errwrap/errwrap.go +++ /dev/null @@ -1,169 +0,0 @@ -// Package errwrap implements methods to formalize error wrapping in Go. -// -// All of the top-level functions that take an `error` are built to be able -// to take any error, not just wrapped errors. This allows you to use errwrap -// without having to type-check and type-cast everywhere. -package errwrap - -import ( - "errors" - "reflect" - "strings" -) - -// WalkFunc is the callback called for Walk. -type WalkFunc func(error) - -// Wrapper is an interface that can be implemented by custom types to -// have all the Contains, Get, etc. functions in errwrap work. -// -// When Walk reaches a Wrapper, it will call the callback for every -// wrapped error in addition to the wrapper itself. Since all the top-level -// functions in errwrap use Walk, this means that all those functions work -// with your custom type. -type Wrapper interface { - WrappedErrors() []error -} - -// Wrap defines that outer wraps inner, returning an error type that -// can be cleanly used with the other methods in this package, such as -// Contains, GetAll, etc. -// -// This function won't modify the error message at all (the outer message -// will be used). -func Wrap(outer, inner error) error { - return &wrappedError{ - Outer: outer, - Inner: inner, - } -} - -// Wrapf wraps an error with a formatting message. This is similar to using -// `fmt.Errorf` to wrap an error. If you're using `fmt.Errorf` to wrap -// errors, you should replace it with this. -// -// format is the format of the error message. The string '{{err}}' will -// be replaced with the original error message. -func Wrapf(format string, err error) error { - outerMsg := "" - if err != nil { - outerMsg = err.Error() - } - - outer := errors.New(strings.Replace( - format, "{{err}}", outerMsg, -1)) - - return Wrap(outer, err) -} - -// Contains checks if the given error contains an error with the -// message msg. If err is not a wrapped error, this will always return -// false unless the error itself happens to match this msg. -func Contains(err error, msg string) bool { - return len(GetAll(err, msg)) > 0 -} - -// ContainsType checks if the given error contains an error with -// the same concrete type as v. If err is not a wrapped error, this will -// check the err itself. -func ContainsType(err error, v interface{}) bool { - return len(GetAllType(err, v)) > 0 -} - -// Get is the same as GetAll but returns the deepest matching error. -func Get(err error, msg string) error { - es := GetAll(err, msg) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetType is the same as GetAllType but returns the deepest matching error. -func GetType(err error, v interface{}) error { - es := GetAllType(err, v) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetAll gets all the errors that might be wrapped in err with the -// given message. The order of the errors is such that the outermost -// matching error (the most recent wrap) is index zero, and so on. -func GetAll(err error, msg string) []error { - var result []error - - Walk(err, func(err error) { - if err.Error() == msg { - result = append(result, err) - } - }) - - return result -} - -// GetAllType gets all the errors that are the same type as v. -// -// The order of the return value is the same as described in GetAll. -func GetAllType(err error, v interface{}) []error { - var result []error - - var search string - if v != nil { - search = reflect.TypeOf(v).String() - } - Walk(err, func(err error) { - var needle string - if err != nil { - needle = reflect.TypeOf(err).String() - } - - if needle == search { - result = append(result, err) - } - }) - - return result -} - -// Walk walks all the wrapped errors in err and calls the callback. If -// err isn't a wrapped error, this will be called once for err. If err -// is a wrapped error, the callback will be called for both the wrapper -// that implements error as well as the wrapped error itself. -func Walk(err error, cb WalkFunc) { - if err == nil { - return - } - - switch e := err.(type) { - case *wrappedError: - cb(e.Outer) - Walk(e.Inner, cb) - case Wrapper: - cb(err) - - for _, err := range e.WrappedErrors() { - Walk(err, cb) - } - default: - cb(err) - } -} - -// wrappedError is an implementation of error that has both the -// outer and inner errors. -type wrappedError struct { - Outer error - Inner error -} - -func (w *wrappedError) Error() string { - return w.Outer.Error() -} - -func (w *wrappedError) WrappedErrors() []error { - return []error{w.Outer, w.Inner} -} diff --git a/vendor/github.com/hashicorp/errwrap/go.mod b/vendor/github.com/hashicorp/errwrap/go.mod deleted file mode 100644 index c9b84022..00000000 --- a/vendor/github.com/hashicorp/errwrap/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/hashicorp/errwrap diff --git a/vendor/github.com/hashicorp/go-multierror/.travis.yml b/vendor/github.com/hashicorp/go-multierror/.travis.yml deleted file mode 100644 index 304a8359..00000000 --- a/vendor/github.com/hashicorp/go-multierror/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -sudo: false - -language: go - -go: - - 1.x - -branches: - only: - - master - -script: make test testrace diff --git a/vendor/github.com/hashicorp/go-multierror/LICENSE b/vendor/github.com/hashicorp/go-multierror/LICENSE deleted file mode 100644 index 82b4de97..00000000 --- a/vendor/github.com/hashicorp/go-multierror/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/go-multierror/Makefile b/vendor/github.com/hashicorp/go-multierror/Makefile deleted file mode 100644 index b97cd6ed..00000000 --- a/vendor/github.com/hashicorp/go-multierror/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -TEST?=./... - -default: test - -# test runs the test suite and vets the code. -test: generate - @echo "==> Running tests..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS} - -# testrace runs the race checker -testrace: generate - @echo "==> Running tests (race)..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -race ${TESTARGS} - -# updatedeps installs all the dependencies needed to run and build. -updatedeps: - @sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'" - -# generate runs `go generate` to build the dynamically generated source files. -generate: - @echo "==> Generating..." - @find . -type f -name '.DS_Store' -delete - @go list ./... \ - | grep -v "/vendor/" \ - | xargs -n1 go generate - -.PHONY: default test testrace updatedeps generate diff --git a/vendor/github.com/hashicorp/go-multierror/README.md b/vendor/github.com/hashicorp/go-multierror/README.md deleted file mode 100644 index ead5830f..00000000 --- a/vendor/github.com/hashicorp/go-multierror/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# go-multierror - -[![Build Status](http://img.shields.io/travis/hashicorp/go-multierror.svg?style=flat-square)][travis] -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[travis]: https://travis-ci.org/hashicorp/go-multierror -[godocs]: https://godoc.org/github.com/hashicorp/go-multierror - -`go-multierror` is a package for Go that provides a mechanism for -representing a list of `error` values as a single `error`. - -This allows a function in Go to return an `error` that might actually -be a list of errors. If the caller knows this, they can unwrap the -list and access the errors. If the caller doesn't know, the error -formats to a nice human-readable format. - -`go-multierror` implements the -[errwrap](https://github.com/hashicorp/errwrap) interface so that it can -be used with that library, as well. - -## Installation and Docs - -Install using `go get github.com/hashicorp/go-multierror`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/go-multierror - -## Usage - -go-multierror is easy to use and purposely built to be unobtrusive in -existing Go applications/libraries that may not be aware of it. - -**Building a list of errors** - -The `Append` function is used to create a list of errors. This function -behaves a lot like the Go built-in `append` function: it doesn't matter -if the first argument is nil, a `multierror.Error`, or any other `error`, -the function behaves as you would expect. - -```go -var result error - -if err := step1(); err != nil { - result = multierror.Append(result, err) -} -if err := step2(); err != nil { - result = multierror.Append(result, err) -} - -return result -``` - -**Customizing the formatting of the errors** - -By specifying a custom `ErrorFormat`, you can customize the format -of the `Error() string` function: - -```go -var result *multierror.Error - -// ... accumulate errors here, maybe using Append - -if result != nil { - result.ErrorFormat = func([]error) string { - return "errors!" - } -} -``` - -**Accessing the list of errors** - -`multierror.Error` implements `error` so if the caller doesn't know about -multierror, it will work just fine. But if you're aware a multierror might -be returned, you can use type switches to access the list of errors: - -```go -if err := something(); err != nil { - if merr, ok := err.(*multierror.Error); ok { - // Use merr.Errors - } -} -``` - -**Returning a multierror only if there are errors** - -If you build a `multierror.Error`, you can use the `ErrorOrNil` function -to return an `error` implementation only if there are errors to return: - -```go -var result *multierror.Error - -// ... accumulate errors here - -// Return the `error` only if errors were added to the multierror, otherwise -// return nil since there are no errors. -return result.ErrorOrNil() -``` diff --git a/vendor/github.com/hashicorp/go-multierror/append.go b/vendor/github.com/hashicorp/go-multierror/append.go deleted file mode 100644 index 775b6e75..00000000 --- a/vendor/github.com/hashicorp/go-multierror/append.go +++ /dev/null @@ -1,41 +0,0 @@ -package multierror - -// Append is a helper function that will append more errors -// onto an Error in order to create a larger multi-error. -// -// If err is not a multierror.Error, then it will be turned into -// one. If any of the errs are multierr.Error, they will be flattened -// one level into err. -func Append(err error, errs ...error) *Error { - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Go through each error and flatten - for _, e := range errs { - switch e := e.(type) { - case *Error: - if e != nil { - err.Errors = append(err.Errors, e.Errors...) - } - default: - if e != nil { - err.Errors = append(err.Errors, e) - } - } - } - - return err - default: - newErrs := make([]error, 0, len(errs)+1) - if err != nil { - newErrs = append(newErrs, err) - } - newErrs = append(newErrs, errs...) - - return Append(&Error{}, newErrs...) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/flatten.go b/vendor/github.com/hashicorp/go-multierror/flatten.go deleted file mode 100644 index aab8e9ab..00000000 --- a/vendor/github.com/hashicorp/go-multierror/flatten.go +++ /dev/null @@ -1,26 +0,0 @@ -package multierror - -// Flatten flattens the given error, merging any *Errors together into -// a single *Error. -func Flatten(err error) error { - // If it isn't an *Error, just return the error as-is - if _, ok := err.(*Error); !ok { - return err - } - - // Otherwise, make the result and flatten away! - flatErr := new(Error) - flatten(err, flatErr) - return flatErr -} - -func flatten(err error, flatErr *Error) { - switch err := err.(type) { - case *Error: - for _, e := range err.Errors { - flatten(e, flatErr) - } - default: - flatErr.Errors = append(flatErr.Errors, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go deleted file mode 100644 index 47f13c49..00000000 --- a/vendor/github.com/hashicorp/go-multierror/format.go +++ /dev/null @@ -1,27 +0,0 @@ -package multierror - -import ( - "fmt" - "strings" -) - -// ErrorFormatFunc is a function callback that is called by Error to -// turn the list of errors into a string. -type ErrorFormatFunc func([]error) string - -// ListFormatFunc is a basic formatter that outputs the number of errors -// that occurred along with a bullet point list of the errors. -func ListFormatFunc(es []error) string { - if len(es) == 1 { - return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0]) - } - - points := make([]string, len(es)) - for i, err := range es { - points[i] = fmt.Sprintf("* %s", err) - } - - return fmt.Sprintf( - "%d errors occurred:\n\t%s\n\n", - len(es), strings.Join(points, "\n\t")) -} diff --git a/vendor/github.com/hashicorp/go-multierror/go.mod b/vendor/github.com/hashicorp/go-multierror/go.mod deleted file mode 100644 index 2534331d..00000000 --- a/vendor/github.com/hashicorp/go-multierror/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/hashicorp/go-multierror - -require github.com/hashicorp/errwrap v1.0.0 diff --git a/vendor/github.com/hashicorp/go-multierror/go.sum b/vendor/github.com/hashicorp/go-multierror/go.sum deleted file mode 100644 index 85b1f8ff..00000000 --- a/vendor/github.com/hashicorp/go-multierror/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= diff --git a/vendor/github.com/hashicorp/go-multierror/multierror.go b/vendor/github.com/hashicorp/go-multierror/multierror.go deleted file mode 100644 index 89b1422d..00000000 --- a/vendor/github.com/hashicorp/go-multierror/multierror.go +++ /dev/null @@ -1,51 +0,0 @@ -package multierror - -import ( - "fmt" -) - -// Error is an error type to track multiple errors. This is used to -// accumulate errors in cases and return them as a single "error". -type Error struct { - Errors []error - ErrorFormat ErrorFormatFunc -} - -func (e *Error) Error() string { - fn := e.ErrorFormat - if fn == nil { - fn = ListFormatFunc - } - - return fn(e.Errors) -} - -// ErrorOrNil returns an error interface if this Error represents -// a list of errors, or returns nil if the list of errors is empty. This -// function is useful at the end of accumulation to make sure that the value -// returned represents the existence of errors. -func (e *Error) ErrorOrNil() error { - if e == nil { - return nil - } - if len(e.Errors) == 0 { - return nil - } - - return e -} - -func (e *Error) GoString() string { - return fmt.Sprintf("*%#v", *e) -} - -// WrappedErrors returns the list of errors that this Error is wrapping. -// It is an implementation of the errwrap.Wrapper interface so that -// multierror.Error can be used with that library. -// -// This method is not safe to be called concurrently and is no different -// than accessing the Errors field directly. It is implemented only to -// satisfy the errwrap.Wrapper interface. -func (e *Error) WrappedErrors() []error { - return e.Errors -} diff --git a/vendor/github.com/hashicorp/go-multierror/prefix.go b/vendor/github.com/hashicorp/go-multierror/prefix.go deleted file mode 100644 index 5c477abe..00000000 --- a/vendor/github.com/hashicorp/go-multierror/prefix.go +++ /dev/null @@ -1,37 +0,0 @@ -package multierror - -import ( - "fmt" - - "github.com/hashicorp/errwrap" -) - -// Prefix is a helper function that will prefix some text -// to the given error. If the error is a multierror.Error, then -// it will be prefixed to each wrapped error. -// -// This is useful to use when appending multiple multierrors -// together in order to give better scoping. -func Prefix(err error, prefix string) error { - if err == nil { - return nil - } - - format := fmt.Sprintf("%s {{err}}", prefix) - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Wrap each of the errors - for i, e := range err.Errors { - err.Errors[i] = errwrap.Wrapf(format, e) - } - - return err - default: - return errwrap.Wrapf(format, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/sort.go b/vendor/github.com/hashicorp/go-multierror/sort.go deleted file mode 100644 index fecb14e8..00000000 --- a/vendor/github.com/hashicorp/go-multierror/sort.go +++ /dev/null @@ -1,16 +0,0 @@ -package multierror - -// Len implements sort.Interface function for length -func (err Error) Len() int { - return len(err.Errors) -} - -// Swap implements sort.Interface function for swapping elements -func (err Error) Swap(i, j int) { - err.Errors[i], err.Errors[j] = err.Errors[j], err.Errors[i] -} - -// Less implements sort.Interface function for determining order -func (err Error) Less(i, j int) bool { - return err.Errors[i].Error() < err.Errors[j].Error() -} diff --git a/vendor/github.com/hashicorp/golang-lru/go.mod b/vendor/github.com/hashicorp/golang-lru/go.mod deleted file mode 100644 index 824cb97e..00000000 --- a/vendor/github.com/hashicorp/golang-lru/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/hashicorp/golang-lru diff --git a/vendor/github.com/hashicorp/golang-lru/lru.go b/vendor/github.com/hashicorp/golang-lru/lru.go index 1cbe04b7..c8d9b0a2 100644 --- a/vendor/github.com/hashicorp/golang-lru/lru.go +++ b/vendor/github.com/hashicorp/golang-lru/lru.go @@ -40,35 +40,31 @@ func (c *Cache) Purge() { // Add adds a value to the cache. Returns true if an eviction occurred. func (c *Cache) Add(key, value interface{}) (evicted bool) { c.lock.Lock() - evicted = c.lru.Add(key, value) - c.lock.Unlock() - return evicted + defer c.lock.Unlock() + return c.lru.Add(key, value) } // Get looks up a key's value from the cache. func (c *Cache) Get(key interface{}) (value interface{}, ok bool) { c.lock.Lock() - value, ok = c.lru.Get(key) - c.lock.Unlock() - return value, ok + defer c.lock.Unlock() + return c.lru.Get(key) } // Contains checks if a key is in the cache, without updating the // recent-ness or deleting it for being stale. func (c *Cache) Contains(key interface{}) bool { c.lock.RLock() - containKey := c.lru.Contains(key) - c.lock.RUnlock() - return containKey + defer c.lock.RUnlock() + return c.lru.Contains(key) } // Peek returns the key value (or undefined if not found) without updating // the "recently used"-ness of the key. func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) { c.lock.RLock() - value, ok = c.lru.Peek(key) - c.lock.RUnlock() - return value, ok + defer c.lock.RUnlock() + return c.lru.Peek(key) } // ContainsOrAdd checks if a key is in the cache without updating the @@ -102,15 +98,13 @@ func (c *Cache) RemoveOldest() { // Keys returns a slice of the keys in the cache, from oldest to newest. func (c *Cache) Keys() []interface{} { c.lock.RLock() - keys := c.lru.Keys() - c.lock.RUnlock() - return keys + defer c.lock.RUnlock() + return c.lru.Keys() } // Len returns the number of items in the cache. func (c *Cache) Len() int { c.lock.RLock() - length := c.lru.Len() - c.lock.RUnlock() - return length + defer c.lock.RUnlock() + return c.lru.Len() } diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go index 74c70774..744cac01 100644 --- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go +++ b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go @@ -1,36 +1,37 @@ package simplelru + // LRUCache is the interface for simple LRU cache. type LRUCache interface { - // Adds a value to the cache, returns true if an eviction occurred and - // updates the "recently used"-ness of the key. - Add(key, value interface{}) bool + // Adds a value to the cache, returns true if an eviction occurred and + // updates the "recently used"-ness of the key. + Add(key, value interface{}) bool - // Returns key's value from the cache and - // updates the "recently used"-ness of the key. #value, isFound - Get(key interface{}) (value interface{}, ok bool) + // Returns key's value from the cache and + // updates the "recently used"-ness of the key. #value, isFound + Get(key interface{}) (value interface{}, ok bool) - // Check if a key exsists in cache without updating the recent-ness. - Contains(key interface{}) (ok bool) + // Check if a key exsists in cache without updating the recent-ness. + Contains(key interface{}) (ok bool) - // Returns key's value without updating the "recently used"-ness of the key. - Peek(key interface{}) (value interface{}, ok bool) + // Returns key's value without updating the "recently used"-ness of the key. + Peek(key interface{}) (value interface{}, ok bool) - // Removes a key from the cache. - Remove(key interface{}) bool + // Removes a key from the cache. + Remove(key interface{}) bool - // Removes the oldest entry from cache. - RemoveOldest() (interface{}, interface{}, bool) + // Removes the oldest entry from cache. + RemoveOldest() (interface{}, interface{}, bool) - // Returns the oldest entry from the cache. #key, value, isFound - GetOldest() (interface{}, interface{}, bool) + // Returns the oldest entry from the cache. #key, value, isFound + GetOldest() (interface{}, interface{}, bool) - // Returns a slice of the keys in the cache, from oldest to newest. - Keys() []interface{} + // Returns a slice of the keys in the cache, from oldest to newest. + Keys() []interface{} - // Returns the number of items in the cache. - Len() int + // Returns the number of items in the cache. + Len() int - // Clear all cache entries - Purge() + // Clear all cache entries + Purge() } diff --git a/vendor/github.com/huin/goupnp/.gitignore b/vendor/github.com/huin/goupnp/.gitignore index 7a6e0ebe..09ef375e 100644 --- a/vendor/github.com/huin/goupnp/.gitignore +++ b/vendor/github.com/huin/goupnp/.gitignore @@ -1,2 +1 @@ -*.zip -*.sublime-workspace \ No newline at end of file +/gotasks/specs diff --git a/vendor/github.com/huin/goupnp/README.md b/vendor/github.com/huin/goupnp/README.md index 7c63903a..433ba5c6 100644 --- a/vendor/github.com/huin/goupnp/README.md +++ b/vendor/github.com/huin/goupnp/README.md @@ -25,19 +25,15 @@ Core components: Regenerating dcps generated source code: ---------------------------------------- -1. Build code generator: - - `go get -u github.com/huin/goupnp/cmd/goupnpdcpgen` - -2. Regenerate the code: - - `go generate ./...` +1. Install gotasks: `go get -u github.com/jingweno/gotask` +2. Change to the gotasks directory: `cd gotasks` +3. Run specgen task: `gotask specgen` Supporting additional UPnP devices and services: ------------------------------------------------ Supporting additional services is, in the trivial case, simply a matter of -adding the service to the `dcpMetadata` whitelist in `cmd/goupnpdcpgen/metadata.go`, +adding the service to the `dcpMetadata` whitelist in `gotasks/specgen_task.go`, regenerating the source code (see above), and committing that source code. However, it would be helpful if anyone needing such a service could test the diff --git a/vendor/github.com/huin/goupnp/dcps/internetgateway1/gen.go b/vendor/github.com/huin/goupnp/dcps/internetgateway1/gen.go deleted file mode 100644 index 2b146a34..00000000 --- a/vendor/github.com/huin/goupnp/dcps/internetgateway1/gen.go +++ /dev/null @@ -1,2 +0,0 @@ -//go:generate goupnpdcpgen -dcp_name internetgateway1 -package internetgateway1 diff --git a/vendor/github.com/huin/goupnp/dcps/internetgateway2/gen.go b/vendor/github.com/huin/goupnp/dcps/internetgateway2/gen.go deleted file mode 100644 index 752058b4..00000000 --- a/vendor/github.com/huin/goupnp/dcps/internetgateway2/gen.go +++ /dev/null @@ -1,2 +0,0 @@ -//go:generate goupnpdcpgen -dcp_name internetgateway2 -package internetgateway2 diff --git a/vendor/github.com/huin/goupnp/go.mod b/vendor/github.com/huin/goupnp/go.mod deleted file mode 100644 index e4a078f6..00000000 --- a/vendor/github.com/huin/goupnp/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/huin/goupnp - -require ( - github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150 - golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 - golang.org/x/text v0.3.0 // indirect -) diff --git a/vendor/github.com/huin/goupnp/go.sum b/vendor/github.com/huin/goupnp/go.sum deleted file mode 100644 index 3e758699..00000000 --- a/vendor/github.com/huin/goupnp/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150 h1:vlNjIqmUZ9CMAWsbURYl3a6wZbw7q5RHVvlXTNS/Bs8= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 h1:Y/KGZSOdz/2r0WJ9Mkmz6NJBusp0kiNx1Cn82lzJQ6w= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/huin/goupnp/goupnp.sublime-project b/vendor/github.com/huin/goupnp/goupnp.sublime-project deleted file mode 100644 index 24db3031..00000000 --- a/vendor/github.com/huin/goupnp/goupnp.sublime-project +++ /dev/null @@ -1,8 +0,0 @@ -{ - "folders": - [ - { - "path": "." - } - ] -} diff --git a/vendor/github.com/ipfs/bbloom/.gitignore b/vendor/github.com/ipfs/bbloom/.gitignore deleted file mode 100644 index 6540f71c..00000000 --- a/vendor/github.com/ipfs/bbloom/.gitignore +++ /dev/null @@ -1 +0,0 @@ -words.txt diff --git a/vendor/github.com/ipfs/bbloom/.travis.yml b/vendor/github.com/ipfs/bbloom/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/bbloom/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/bbloom/README.md b/vendor/github.com/ipfs/bbloom/README.md deleted file mode 100644 index 6d77e146..00000000 --- a/vendor/github.com/ipfs/bbloom/README.md +++ /dev/null @@ -1,129 +0,0 @@ -## bbloom: a bitset Bloom filter for go/golang -=== - -package implements a fast bloom filter with real 'bitset' and JSONMarshal/JSONUnmarshal to store/reload the Bloom filter. - -NOTE: the package uses unsafe.Pointer to set and read the bits from the bitset. If you're uncomfortable with using the unsafe package, please consider using my bloom filter package at github.com/AndreasBriese/bloom - -=== - -changelog 11/2015: new thread safe methods AddTS(), HasTS(), AddIfNotHasTS() following a suggestion from Srdjan Marinovic (github @a-little-srdjan), who used this to code a bloomfilter cache. - -This bloom filter was developed to strengthen a website-log database and was tested and optimized for this log-entry mask: "2014/%02i/%02i %02i:%02i:%02i /info.html". -Nonetheless bbloom should work with any other form of entries. - -~~Hash function is a modified Berkeley DB sdbm hash (to optimize for smaller strings). sdbm http://www.cse.yorku.ca/~oz/hash.html~~ - -Found sipHash (SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein.) to be about as fast. sipHash had been ported by Dimtry Chestnyk to Go (github.com/dchest/siphash ) - -Minimum hashset size is: 512 ([4]uint64; will be set automatically). - -###install - -```sh -go get github.com/AndreasBriese/bbloom -``` - -###test -+ change to folder ../bbloom -+ create wordlist in file "words.txt" (you might use `python permut.py`) -+ run 'go test -bench=.' within the folder - -```go -go test -bench=. -``` - -~~If you've installed the GOCONVEY TDD-framework http://goconvey.co/ you can run the tests automatically.~~ - -using go's testing framework now (have in mind that the op timing is related to 65536 operations of Add, Has, AddIfNotHas respectively) - -### usage - -after installation add - -```go -import ( - ... - "github.com/AndreasBriese/bbloom" - ... - ) -``` - -at your header. In the program use - -```go -// create a bloom filter for 65536 items and 1 % wrong-positive ratio -bf := bbloom.New(float64(1<<16), float64(0.01)) - -// or -// create a bloom filter with 650000 for 65536 items and 7 locs per hash explicitly -// bf = bbloom.New(float64(650000), float64(7)) -// or -bf = bbloom.New(650000.0, 7.0) - -// add one item -bf.Add([]byte("butter")) - -// Number of elements added is exposed now -// Note: ElemNum will not be included in JSON export (for compatability to older version) -nOfElementsInFilter := bf.ElemNum - -// check if item is in the filter -isIn := bf.Has([]byte("butter")) // should be true -isNotIn := bf.Has([]byte("Butter")) // should be false - -// 'add only if item is new' to the bloomfilter -added := bf.AddIfNotHas([]byte("butter")) // should be false because 'butter' is already in the set -added = bf.AddIfNotHas([]byte("buTTer")) // should be true because 'buTTer' is new - -// thread safe versions for concurrent use: AddTS, HasTS, AddIfNotHasTS -// add one item -bf.AddTS([]byte("peanutbutter")) -// check if item is in the filter -isIn = bf.HasTS([]byte("peanutbutter")) // should be true -isNotIn = bf.HasTS([]byte("peanutButter")) // should be false -// 'add only if item is new' to the bloomfilter -added = bf.AddIfNotHasTS([]byte("butter")) // should be false because 'peanutbutter' is already in the set -added = bf.AddIfNotHasTS([]byte("peanutbuTTer")) // should be true because 'penutbuTTer' is new - -// convert to JSON ([]byte) -Json := bf.JSONMarshal() - -// bloomfilters Mutex is exposed for external un-/locking -// i.e. mutex lock while doing JSON conversion -bf.Mtx.Lock() -Json = bf.JSONMarshal() -bf.Mtx.Unlock() - -// restore a bloom filter from storage -bfNew := bbloom.JSONUnmarshal(Json) - -isInNew := bfNew.Has([]byte("butter")) // should be true -isNotInNew := bfNew.Has([]byte("Butter")) // should be false - -``` - -to work with the bloom filter. - -### why 'fast'? - -It's about 3 times faster than William Fitzgeralds bitset bloom filter https://github.com/willf/bloom . And it is about so fast as my []bool set variant for Boom filters (see https://github.com/AndreasBriese/bloom ) but having a 8times smaller memory footprint: - - - Bloom filter (filter size 524288, 7 hashlocs) - github.com/AndreasBriese/bbloom 'Add' 65536 items (10 repetitions): 6595800 ns (100 ns/op) - github.com/AndreasBriese/bbloom 'Has' 65536 items (10 repetitions): 5986600 ns (91 ns/op) - github.com/AndreasBriese/bloom 'Add' 65536 items (10 repetitions): 6304684 ns (96 ns/op) - github.com/AndreasBriese/bloom 'Has' 65536 items (10 repetitions): 6568663 ns (100 ns/op) - - github.com/willf/bloom 'Add' 65536 items (10 repetitions): 24367224 ns (371 ns/op) - github.com/willf/bloom 'Test' 65536 items (10 repetitions): 21881142 ns (333 ns/op) - github.com/dataence/bloom/standard 'Add' 65536 items (10 repetitions): 23041644 ns (351 ns/op) - github.com/dataence/bloom/standard 'Check' 65536 items (10 repetitions): 19153133 ns (292 ns/op) - github.com/cabello/bloom 'Add' 65536 items (10 repetitions): 131921507 ns (2012 ns/op) - github.com/cabello/bloom 'Contains' 65536 items (10 repetitions): 131108962 ns (2000 ns/op) - -(on MBPro15 OSX10.8.5 i7 4Core 2.4Ghz) - - -With 32bit bloom filters (bloom32) using modified sdbm, bloom32 does hashing with only 2 bit shifts, one xor and one substraction per byte. smdb is about as fast as fnv64a but gives less collisions with the dataset (see mask above). bloom.New(float64(10 * 1<<16),float64(7)) populated with 1<<16 random items from the dataset (see above) and tested against the rest results in less than 0.05% collisions. diff --git a/vendor/github.com/ipfs/bbloom/bbloom.go b/vendor/github.com/ipfs/bbloom/bbloom.go deleted file mode 100644 index 2bff5945..00000000 --- a/vendor/github.com/ipfs/bbloom/bbloom.go +++ /dev/null @@ -1,315 +0,0 @@ -// The MIT License (MIT) -// Copyright (c) 2014 Andreas Briese, eduToolbox@Bri-C GmbH, Sarstedt - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package bbloom - -import ( - "bytes" - "encoding/json" - "errors" - "math" - "sync" - "unsafe" -) - -// helper -var mask = []uint8{1, 2, 4, 8, 16, 32, 64, 128} - -func getSize(ui64 uint64) (size uint64, exponent uint64) { - if ui64 < uint64(512) { - ui64 = uint64(512) - } - size = uint64(1) - for size < ui64 { - size <<= 1 - exponent++ - } - return size, exponent -} - -func calcSizeByWrongPositives(numEntries, wrongs float64) (uint64, uint64) { - size := -1 * numEntries * math.Log(wrongs) / math.Pow(float64(0.69314718056), 2) - locs := math.Ceil(float64(0.69314718056) * size / numEntries) - return uint64(size), uint64(locs) -} - -var ErrUsage = errors.New("usage: New(float64(number_of_entries), float64(number_of_hashlocations)) i.e. New(float64(1000), float64(3)) or New(float64(number_of_entries), float64(ratio_of_false_positives)) i.e. New(float64(1000), float64(0.03))") -var ErrInvalidParms = errors.New("One of parameters was outside of allowed range") - -// New -// returns a new bloomfilter -func New(params ...float64) (bloomfilter *Bloom, err error) { - var entries, locs uint64 - if len(params) == 2 { - if params[0] < 0 || params[1] < 0 { - return nil, ErrInvalidParms - } - if params[1] < 1 { - entries, locs = calcSizeByWrongPositives(math.Max(params[0], 1), params[1]) - } else { - entries, locs = uint64(params[0]), uint64(params[1]) - } - } else { - return nil, ErrUsage - } - size, exponent := getSize(uint64(entries)) - bloomfilter = &Bloom{ - sizeExp: exponent, - size: size - 1, - setLocs: locs, - shift: 64 - exponent, - bitset: make([]uint64, size>>6), - } - return bloomfilter, nil -} - -// NewWithBoolset -// takes a []byte slice and number of locs per entry -// returns the bloomfilter with a bitset populated according to the input []byte -func NewWithBoolset(bs *[]byte, locs uint64) (bloomfilter *Bloom) { - bloomfilter, err := New(float64(len(*bs)<<3), float64(locs)) - if err != nil { - panic(err) // Should never happen - } - ptr := uintptr(unsafe.Pointer(&bloomfilter.bitset[0])) - for _, b := range *bs { - *(*uint8)(unsafe.Pointer(ptr)) = b - ptr++ - } - return bloomfilter -} - -// bloomJSONImExport -// Im/Export structure used by JSONMarshal / JSONUnmarshal -type bloomJSONImExport struct { - FilterSet []byte - SetLocs uint64 -} - -// -// Bloom filter -type Bloom struct { - Mtx sync.RWMutex - bitset []uint64 - sizeExp uint64 - size uint64 - setLocs uint64 - shift uint64 - - content uint64 -} - -func (bl *Bloom) ElementsAdded() uint64 { - return bl.content -} - -// <--- http://www.cse.yorku.ca/~oz/hash.html -// modified Berkeley DB Hash (32bit) -// hash is casted to l, h = 16bit fragments -// func (bl Bloom) absdbm(b *[]byte) (l, h uint64) { -// hash := uint64(len(*b)) -// for _, c := range *b { -// hash = uint64(c) + (hash << 6) + (hash << bl.sizeExp) - hash -// } -// h = hash >> bl.shift -// l = hash << bl.shift >> bl.shift -// return l, h -// } - -// Update: found sipHash of Jean-Philippe Aumasson & Daniel J. Bernstein to be even faster than absdbm() -// https://131002.net/siphash/ -// siphash was implemented for Go by Dmitry Chestnykh https://github.com/dchest/siphash - -// Add -// set the bit(s) for entry; Adds an entry to the Bloom filter -func (bl *Bloom) Add(entry []byte) { - bl.content++ - l, h := bl.sipHash(entry) - for i := uint64(0); i < (*bl).setLocs; i++ { - bl.set((h + i*l) & (*bl).size) - } -} - -// AddTS -// Thread safe: Mutex.Lock the bloomfilter for the time of processing the entry -func (bl *Bloom) AddTS(entry []byte) { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - bl.Add(entry[:]) -} - -// Has -// check if bit(s) for entry is/are set -// returns true if the entry was added to the Bloom Filter -func (bl *Bloom) Has(entry []byte) bool { - l, h := bl.sipHash(entry) - res := true - for i := uint64(0); i < bl.setLocs; i++ { - res = res && bl.isSet((h+i*l)&bl.size) - // Branching here (early escape) is not worth it - // This is my conclusion from benchmarks - // if !res { - // return false - // } - } - return res -} - -// HasTS -// Thread safe: Mutex.Lock the bloomfilter for the time of processing the entry -func (bl *Bloom) HasTS(entry []byte) bool { - bl.Mtx.RLock() - defer bl.Mtx.RUnlock() - return bl.Has(entry[:]) -} - -// AddIfNotHas -// Only Add entry if it's not present in the bloomfilter -// returns true if entry was added -// returns false if entry was allready registered in the bloomfilter -func (bl *Bloom) AddIfNotHas(entry []byte) (added bool) { - l, h := bl.sipHash(entry) - contained := true - for i := uint64(0); i < bl.setLocs; i++ { - prev := bl.getSet((h + i*l) & bl.size) - contained = contained && prev - } - if !contained { - bl.content++ - } - return !contained -} - -// AddIfNotHasTS -// Tread safe: Only Add entry if it's not present in the bloomfilter -// returns true if entry was added -// returns false if entry was allready registered in the bloomfilter -func (bl *Bloom) AddIfNotHasTS(entry []byte) (added bool) { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - return bl.AddIfNotHas(entry[:]) -} - -// Clear -// resets the Bloom filter -func (bl *Bloom) Clear() { - bl.Mtx.Lock() - defer bl.Mtx.Unlock() - for i, _ := range (*bl).bitset { - bl.bitset[i] = 0 - } - bl.content = 0 -} - -// Set -// set the bit[idx] of bitsit -func (bl *Bloom) set(idx uint64) { - ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&bl.bitset[idx>>6])) + uintptr((idx%64)>>3)) - *(*uint8)(ptr) |= mask[idx%8] -} - -func (bl *Bloom) getSet(idx uint64) bool { - ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&bl.bitset[idx>>6])) + uintptr((idx%64)>>3)) - res := *(*uint8)(ptr)&mask[idx%8] > 0 - *(*uint8)(ptr) |= mask[idx%8] - return res -} - -// IsSet -// check if bit[idx] of bitset is set -// returns true/false -func (bl *Bloom) isSet(idx uint64) bool { - ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&bl.bitset[idx>>6])) + uintptr((idx%64)>>3)) - return *(*uint8)(ptr)&mask[idx%8] > 0 -} - -// JSONMarshal -// returns JSON-object (type bloomJSONImExport) as []byte -func (bl *Bloom) JSONMarshal() ([]byte, error) { - bl.Mtx.RLock() - defer bl.Mtx.RUnlock() - bloomImEx := bloomJSONImExport{} - bloomImEx.SetLocs = uint64(bl.setLocs) - bloomImEx.FilterSet = make([]byte, len(bl.bitset)<<3) - ptr := uintptr(unsafe.Pointer(&bl.bitset[0])) - for i := range bloomImEx.FilterSet { - bloomImEx.FilterSet[i] = *(*byte)(unsafe.Pointer(ptr)) - ptr++ - } - data, err := json.Marshal(bloomImEx) - return data, err -} - -// JSONUnmarshal -// takes JSON-Object (type bloomJSONImExport) as []bytes -// returns bloom32 / bloom64 object -func JSONUnmarshal(dbData []byte) *Bloom { - bloomImEx := bloomJSONImExport{} - json.Unmarshal(dbData, &bloomImEx) - buf := bytes.NewBuffer(bloomImEx.FilterSet) - bs := buf.Bytes() - bf := NewWithBoolset(&bs, bloomImEx.SetLocs) - return bf -} - -func (bl *Bloom) FillRatio() float64 { - count := uint64(0) - for _, b := range bl.bitset { - count += uint64(popcount(b)) - } - return float64(count) / float64(bl.size+1) -} - -func popcount(x uint64) uint { - const ( - m1 = 0x5555555555555555 //binary: 0101... - m2 = 0x3333333333333333 //binary: 00110011.. - m4 = 0x0f0f0f0f0f0f0f0f //binary: 4 zeros, 4 ones ... - h01 = 0x0101010101010101 //the sum of 256 to the power of 0,1,2,3... - ) - x -= (x >> 1) & m1 //put count of each 2 bits into those 2 bits - x = (x & m2) + ((x >> 2) & m2) //put count of each 4 bits into those 4 bits - x = (x + (x >> 4)) & m4 //put count of each 8 bits into those 8 bits - return uint((x * h01) >> 56) -} - -// // alternative hashFn -// func (bl Bloom) fnv64a(b *[]byte) (l, h uint64) { -// h64 := fnv.New64a() -// h64.Write(*b) -// hash := h64.Sum64() -// h = hash >> 32 -// l = hash << 32 >> 32 -// return l, h -// } -// -// // <-- http://partow.net/programming/hashfunctions/index.html -// // citation: An algorithm proposed by Donald E. Knuth in The Art Of Computer Programming Volume 3, -// // under the topic of sorting and search chapter 6.4. -// // modified to fit with boolset-length -// func (bl Bloom) DEKHash(b *[]byte) (l, h uint64) { -// hash := uint64(len(*b)) -// for _, c := range *b { -// hash = ((hash << 5) ^ (hash >> bl.shift)) ^ uint64(c) -// } -// h = hash >> bl.shift -// l = hash << bl.sizeExp >> bl.sizeExp -// return l, h -// } diff --git a/vendor/github.com/ipfs/bbloom/go.mod b/vendor/github.com/ipfs/bbloom/go.mod deleted file mode 100644 index 07ae2921..00000000 --- a/vendor/github.com/ipfs/bbloom/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/ipfs/bbloom diff --git a/vendor/github.com/ipfs/bbloom/package.json b/vendor/github.com/ipfs/bbloom/package.json deleted file mode 100644 index 3d42cf9c..00000000 --- a/vendor/github.com/ipfs/bbloom/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "author": "AndreasBriese", - "bugs": { - "url": "https://github.com/ipfs/bbloom" - }, - "gx": { - "dvcsimport": "github.com/ipfs/bbloom" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "MIT", - "name": "bbloom", - "version": "0.1.2" -} - diff --git a/vendor/github.com/ipfs/bbloom/sipHash.go b/vendor/github.com/ipfs/bbloom/sipHash.go deleted file mode 100644 index a91d8199..00000000 --- a/vendor/github.com/ipfs/bbloom/sipHash.go +++ /dev/null @@ -1,225 +0,0 @@ -// Written in 2012 by Dmitry Chestnykh. -// -// To the extent possible under law, the author have dedicated all copyright -// and related and neighboring rights to this software to the public domain -// worldwide. This software is distributed without any warranty. -// http://creativecommons.org/publicdomain/zero/1.0/ -// -// Package siphash implements SipHash-2-4, a fast short-input PRF -// created by Jean-Philippe Aumasson and Daniel J. Bernstein. - -package bbloom - -// Hash returns the 64-bit SipHash-2-4 of the given byte slice with two 64-bit -// parts of 128-bit key: k0 and k1. -func (bl Bloom) sipHash(p []byte) (l, h uint64) { - // Initialization. - v0 := uint64(8317987320269560794) // k0 ^ 0x736f6d6570736575 - v1 := uint64(7237128889637516672) // k1 ^ 0x646f72616e646f6d - v2 := uint64(7816392314733513934) // k0 ^ 0x6c7967656e657261 - v3 := uint64(8387220255325274014) // k1 ^ 0x7465646279746573 - t := uint64(len(p)) << 56 - - // Compression. - for len(p) >= 8 { - - m := uint64(p[0]) | uint64(p[1])<<8 | uint64(p[2])<<16 | uint64(p[3])<<24 | - uint64(p[4])<<32 | uint64(p[5])<<40 | uint64(p[6])<<48 | uint64(p[7])<<56 - - v3 ^= m - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - v0 ^= m - p = p[8:] - } - - // Compress last block. - switch len(p) { - case 7: - t |= uint64(p[6]) << 48 - fallthrough - case 6: - t |= uint64(p[5]) << 40 - fallthrough - case 5: - t |= uint64(p[4]) << 32 - fallthrough - case 4: - t |= uint64(p[3]) << 24 - fallthrough - case 3: - t |= uint64(p[2]) << 16 - fallthrough - case 2: - t |= uint64(p[1]) << 8 - fallthrough - case 1: - t |= uint64(p[0]) - } - - v3 ^= t - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - v0 ^= t - - // Finalization. - v2 ^= 0xff - - // Round 1. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 2. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 3. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // Round 4. - v0 += v1 - v1 = v1<<13 | v1>>51 - v1 ^= v0 - v0 = v0<<32 | v0>>32 - - v2 += v3 - v3 = v3<<16 | v3>>48 - v3 ^= v2 - - v0 += v3 - v3 = v3<<21 | v3>>43 - v3 ^= v0 - - v2 += v1 - v1 = v1<<17 | v1>>47 - v1 ^= v2 - v2 = v2<<32 | v2>>32 - - // return v0 ^ v1 ^ v2 ^ v3 - - hash := v0 ^ v1 ^ v2 ^ v3 - h = hash >> bl.shift - l = hash << bl.shift >> bl.shift - return l, h - -} diff --git a/vendor/github.com/ipfs/go-bitswap/.gitignore b/vendor/github.com/ipfs/go-bitswap/.gitignore deleted file mode 100644 index a9a5aecf..00000000 --- a/vendor/github.com/ipfs/go-bitswap/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tmp diff --git a/vendor/github.com/ipfs/go-bitswap/.travis.yml b/vendor/github.com/ipfs/go-bitswap/.travis.yml deleted file mode 100644 index 923835bc..00000000 --- a/vendor/github.com/ipfs/go-bitswap/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-bitswap/LICENSE b/vendor/github.com/ipfs/go-bitswap/LICENSE deleted file mode 100644 index 7d5dcac4..00000000 --- a/vendor/github.com/ipfs/go-bitswap/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-bitswap/Makefile b/vendor/github.com/ipfs/go-bitswap/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/ipfs/go-bitswap/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-bitswap/README.md b/vendor/github.com/ipfs/go-bitswap/README.md deleted file mode 100644 index 62bbd9b3..00000000 --- a/vendor/github.com/ipfs/go-bitswap/README.md +++ /dev/null @@ -1,64 +0,0 @@ -go-bitswap -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-bitswap/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-bitswap/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-bitswap.svg?branch=master)](https://travis-ci.org/ipfs/go-bitswap) - -> An implementation of the bitswap protocol in go! - - -## Table of Contents - -- [Install](#install) -- [Protocol](#protocol) -- [Implementation](#implementation) -- [Contribute](#contribute) -- [License](#license) - -## Protocol -Bitswap is the data trading module for ipfs, it manages requesting and sending -blocks to and from other peers in the network. Bitswap has two main jobs, the -first is to acquire blocks requested by the client from the network. The second -is to judiciously send blocks in its possession to other peers who want them. - -Bitswap is a message based protocol, as opposed to response-reply. All messages -contain wantlists, or blocks. Upon receiving a wantlist, a node should consider -sending out wanted blocks if they have them. Upon receiving blocks, the node -should send out a notification called a 'Cancel' signifying that they no longer -want the block. At a protocol level, bitswap is very simple. - -## Implementation -Internally, when a message with a wantlist is received, it is sent to the -decision engine to be considered, and blocks that we have that are wanted are -placed into the peer request queue. Any block we possess that is wanted by -another peer has a task in the peer request queue created for it. The peer -request queue is a priority queue that sorts available tasks by some metric, -currently, that metric is very simple and aims to fairly address the tasks -of each other peer. More advanced decision logic will be implemented in the -future. Task workers pull tasks to be done off of the queue, retrieve the block -to be sent, and send it off. The number of task workers is limited by a constant -factor. - -Client requests for new blocks are handled by the want manager, for every new -block (or set of blocks) wanted, the 'WantBlocks' method is invoked. The want -manager then ensures that connected peers are notified of the new block that we -want by sending the new entries to a message queue for each peer. The message -queue will loop while there is work available and do the following: 1) Ensure it -has a connection to its peer, 2) grab the message to be sent, and 3) send it. -If new messages are added while the loop is in steps 1 or 3, the messages are -combined into one to avoid having to keep an actual queue and send multiple -messages. The same process occurs when the client receives a block and sends a -cancel message for it. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-bitswap/bitswap.go b/vendor/github.com/ipfs/go-bitswap/bitswap.go deleted file mode 100644 index ec89982f..00000000 --- a/vendor/github.com/ipfs/go-bitswap/bitswap.go +++ /dev/null @@ -1,428 +0,0 @@ -// Package bitswap implements the IPFS exchange interface with the BitSwap -// bilateral exchange protocol. -package bitswap - -import ( - "context" - "errors" - "sync" - "time" - - bssrs "github.com/ipfs/go-bitswap/sessionrequestsplitter" - delay "github.com/ipfs/go-ipfs-delay" - - decision "github.com/ipfs/go-bitswap/decision" - bsgetter "github.com/ipfs/go-bitswap/getter" - bsmsg "github.com/ipfs/go-bitswap/message" - bsmq "github.com/ipfs/go-bitswap/messagequeue" - bsnet "github.com/ipfs/go-bitswap/network" - bspm "github.com/ipfs/go-bitswap/peermanager" - bspqm "github.com/ipfs/go-bitswap/providerquerymanager" - bssession "github.com/ipfs/go-bitswap/session" - bssm "github.com/ipfs/go-bitswap/sessionmanager" - bsspm "github.com/ipfs/go-bitswap/sessionpeermanager" - bswm "github.com/ipfs/go-bitswap/wantmanager" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - exchange "github.com/ipfs/go-ipfs-exchange-interface" - logging "github.com/ipfs/go-log" - metrics "github.com/ipfs/go-metrics-interface" - process "github.com/jbenet/goprocess" - procctx "github.com/jbenet/goprocess/context" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -var log = logging.Logger("bitswap") - -var _ exchange.SessionExchange = (*Bitswap)(nil) - -const ( - // these requests take at _least_ two minutes at the moment. - provideTimeout = time.Minute * 3 - defaultProvSearchDelay = time.Second -) - -var ( - // HasBlockBufferSize is the buffer size of the channel for new blocks - // that need to be provided. They should get pulled over by the - // provideCollector even before they are actually provided. - // TODO: Does this need to be this large givent that? - HasBlockBufferSize = 256 - provideKeysBufferSize = 2048 - provideWorkerMax = 6 - - // the 1<<18+15 is to observe old file chunks that are 1<<18 + 14 in size - metricsBuckets = []float64{1 << 6, 1 << 10, 1 << 14, 1 << 18, 1<<18 + 15, 1 << 22} -) - -// Option defines the functional option type that can be used to configure -// bitswap instances -type Option func(*Bitswap) - -// ProvideEnabled is an option for enabling/disabling provide announcements -func ProvideEnabled(enabled bool) Option { - return func(bs *Bitswap) { - bs.provideEnabled = enabled - } -} - -// ProviderSearchDelay overwrites the global provider search delay -func ProviderSearchDelay(newProvSearchDelay time.Duration) Option { - return func(bs *Bitswap) { - bs.provSearchDelay = newProvSearchDelay - } -} - -// RebroadcastDelay overwrites the global provider rebroadcast delay -func RebroadcastDelay(newRebroadcastDelay delay.D) Option { - return func(bs *Bitswap) { - bs.rebroadcastDelay = newRebroadcastDelay - } -} - -// New initializes a BitSwap instance that communicates over the provided -// BitSwapNetwork. This function registers the returned instance as the network -// delegate. Runs until context is cancelled or bitswap.Close is called. -func New(parent context.Context, network bsnet.BitSwapNetwork, - bstore blockstore.Blockstore, options ...Option) exchange.Interface { - - // important to use provided parent context (since it may include important - // loggable data). It's probably not a good idea to allow bitswap to be - // coupled to the concerns of the ipfs daemon in this way. - // - // FIXME(btc) Now that bitswap manages itself using a process, it probably - // shouldn't accept a context anymore. Clients should probably use Close() - // exclusively. We should probably find another way to share logging data - ctx, cancelFunc := context.WithCancel(parent) - ctx = metrics.CtxSubScope(ctx, "bitswap") - dupHist := metrics.NewCtx(ctx, "recv_dup_blocks_bytes", "Summary of duplicate"+ - " data blocks recived").Histogram(metricsBuckets) - allHist := metrics.NewCtx(ctx, "recv_all_blocks_bytes", "Summary of all"+ - " data blocks recived").Histogram(metricsBuckets) - - sentHistogram := metrics.NewCtx(ctx, "sent_all_blocks_bytes", "Histogram of blocks sent by"+ - " this bitswap").Histogram(metricsBuckets) - - px := process.WithTeardown(func() error { - return nil - }) - - peerQueueFactory := func(ctx context.Context, p peer.ID) bspm.PeerQueue { - return bsmq.New(ctx, p, network) - } - - wm := bswm.New(ctx, bspm.New(ctx, peerQueueFactory)) - pqm := bspqm.New(ctx, network) - - sessionFactory := func(ctx context.Context, id uint64, pm bssession.PeerManager, srs bssession.RequestSplitter, - provSearchDelay time.Duration, - rebroadcastDelay delay.D) bssm.Session { - return bssession.New(ctx, id, wm, pm, srs, provSearchDelay, rebroadcastDelay) - } - sessionPeerManagerFactory := func(ctx context.Context, id uint64) bssession.PeerManager { - return bsspm.New(ctx, id, network.ConnectionManager(), pqm) - } - sessionRequestSplitterFactory := func(ctx context.Context) bssession.RequestSplitter { - return bssrs.New(ctx) - } - - bs := &Bitswap{ - blockstore: bstore, - engine: decision.NewEngine(ctx, bstore, network.ConnectionManager()), // TODO close the engine with Close() method - network: network, - process: px, - newBlocks: make(chan cid.Cid, HasBlockBufferSize), - provideKeys: make(chan cid.Cid, provideKeysBufferSize), - wm: wm, - pqm: pqm, - sm: bssm.New(ctx, sessionFactory, sessionPeerManagerFactory, sessionRequestSplitterFactory), - counters: new(counters), - dupMetric: dupHist, - allMetric: allHist, - sentHistogram: sentHistogram, - provideEnabled: true, - provSearchDelay: defaultProvSearchDelay, - rebroadcastDelay: delay.Fixed(time.Minute), - } - - // apply functional options before starting and running bitswap - for _, option := range options { - option(bs) - } - - bs.wm.Startup() - bs.pqm.Startup() - network.SetDelegate(bs) - - // Start up bitswaps async worker routines - bs.startWorkers(ctx, px) - - // bind the context and process. - // do it over here to avoid closing before all setup is done. - go func() { - <-px.Closing() // process closes first - cancelFunc() - }() - procctx.CloseAfterContext(px, ctx) // parent cancelled first - - return bs -} - -// Bitswap instances implement the bitswap protocol. -type Bitswap struct { - // the wantlist tracks global wants for bitswap - wm *bswm.WantManager - - // the provider query manager manages requests to find providers - pqm *bspqm.ProviderQueryManager - - // the engine is the bit of logic that decides who to send which blocks to - engine *decision.Engine - - // network delivers messages on behalf of the session - network bsnet.BitSwapNetwork - - // blockstore is the local database - // NB: ensure threadsafety - blockstore blockstore.Blockstore - - // newBlocks is a channel for newly added blocks to be provided to the - // network. blocks pushed down this channel get buffered and fed to the - // provideKeys channel later on to avoid too much network activity - newBlocks chan cid.Cid - // provideKeys directly feeds provide workers - provideKeys chan cid.Cid - - process process.Process - - // Counters for various statistics - counterLk sync.Mutex - counters *counters - - // Metrics interface metrics - dupMetric metrics.Histogram - allMetric metrics.Histogram - sentHistogram metrics.Histogram - - // the sessionmanager manages tracking sessions - sm *bssm.SessionManager - - // whether or not to make provide announcements - provideEnabled bool - - // how long to wait before looking for providers in a session - provSearchDelay time.Duration - - // how often to rebroadcast providing requests to find more optimized providers - rebroadcastDelay delay.D -} - -type counters struct { - blocksRecvd uint64 - dupBlocksRecvd uint64 - dupDataRecvd uint64 - blocksSent uint64 - dataSent uint64 - dataRecvd uint64 - messagesRecvd uint64 -} - -// GetBlock attempts to retrieve a particular block from peers within the -// deadline enforced by the context. -func (bs *Bitswap) GetBlock(parent context.Context, k cid.Cid) (blocks.Block, error) { - return bsgetter.SyncGetBlock(parent, k, bs.GetBlocks) -} - -// WantlistForPeer returns the currently understood list of blocks requested by a -// given peer. -func (bs *Bitswap) WantlistForPeer(p peer.ID) []cid.Cid { - var out []cid.Cid - for _, e := range bs.engine.WantlistForPeer(p) { - out = append(out, e.Cid) - } - return out -} - -// LedgerForPeer returns aggregated data about blocks swapped and communication -// with a given peer. -func (bs *Bitswap) LedgerForPeer(p peer.ID) *decision.Receipt { - return bs.engine.LedgerForPeer(p) -} - -// GetBlocks returns a channel where the caller may receive blocks that -// correspond to the provided |keys|. Returns an error if BitSwap is unable to -// begin this request within the deadline enforced by the context. -// -// NB: Your request remains open until the context expires. To conserve -// resources, provide a context with a reasonably short deadline (ie. not one -// that lasts throughout the lifetime of the server) -func (bs *Bitswap) GetBlocks(ctx context.Context, keys []cid.Cid) (<-chan blocks.Block, error) { - session := bs.sm.NewSession(ctx, bs.provSearchDelay, bs.rebroadcastDelay) - return session.GetBlocks(ctx, keys) -} - -// HasBlock announces the existence of a block to this bitswap service. The -// service will potentially notify its peers. -func (bs *Bitswap) HasBlock(blk blocks.Block) error { - return bs.receiveBlockFrom(blk, "") -} - -// TODO: Some of this stuff really only needs to be done when adding a block -// from the user, not when receiving it from the network. -// In case you run `git blame` on this comment, I'll save you some time: ask -// @whyrusleeping, I don't know the answers you seek. -func (bs *Bitswap) receiveBlockFrom(blk blocks.Block, from peer.ID) error { - select { - case <-bs.process.Closing(): - return errors.New("bitswap is closed") - default: - } - - err := bs.blockstore.Put(blk) - if err != nil { - log.Errorf("Error writing block to datastore: %s", err) - return err - } - - // NOTE: There exists the possiblity for a race condition here. If a user - // creates a node, then adds it to the dagservice while another goroutine - // is waiting on a GetBlock for that object, they will receive a reference - // to the same node. We should address this soon, but i'm not going to do - // it now as it requires more thought and isnt causing immediate problems. - - bs.sm.ReceiveBlockFrom(from, blk) - - bs.engine.AddBlock(blk) - - if bs.provideEnabled { - select { - case bs.newBlocks <- blk.Cid(): - // send block off to be reprovided - case <-bs.process.Closing(): - return bs.process.Close() - } - } - return nil -} - -// ReceiveMessage is called by the network interface when a new message is -// received. -func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg.BitSwapMessage) { - bs.counterLk.Lock() - bs.counters.messagesRecvd++ - bs.counterLk.Unlock() - - // This call records changes to wantlists, blocks received, - // and number of bytes transfered. - bs.engine.MessageReceived(p, incoming) - // TODO: this is bad, and could be easily abused. - // Should only track *useful* messages in ledger - - iblocks := incoming.Blocks() - - if len(iblocks) == 0 { - return - } - - wg := sync.WaitGroup{} - for _, block := range iblocks { - - wg.Add(1) - go func(b blocks.Block) { // TODO: this probably doesnt need to be a goroutine... - defer wg.Done() - - bs.updateReceiveCounters(b) - bs.sm.UpdateReceiveCounters(b) - log.Debugf("got block %s from %s", b, p) - - // skip received blocks that are not in the wantlist - if !bs.wm.IsWanted(b.Cid()) { - return - } - - if err := bs.receiveBlockFrom(b, p); err != nil { - log.Warningf("ReceiveMessage recvBlockFrom error: %s", err) - } - log.Event(ctx, "Bitswap.GetBlockRequest.End", b.Cid()) - }(block) - } - wg.Wait() -} - -func (bs *Bitswap) updateReceiveCounters(b blocks.Block) { - blkLen := len(b.RawData()) - has, err := bs.blockstore.Has(b.Cid()) - if err != nil { - log.Infof("blockstore.Has error: %s", err) - return - } - - bs.allMetric.Observe(float64(blkLen)) - if has { - bs.dupMetric.Observe(float64(blkLen)) - } - - bs.counterLk.Lock() - defer bs.counterLk.Unlock() - c := bs.counters - - c.blocksRecvd++ - c.dataRecvd += uint64(len(b.RawData())) - if has { - c.dupBlocksRecvd++ - c.dupDataRecvd += uint64(blkLen) - } -} - -// PeerConnected is called by the network interface -// when a peer initiates a new connection to bitswap. -func (bs *Bitswap) PeerConnected(p peer.ID) { - bs.wm.Connected(p) - bs.engine.PeerConnected(p) -} - -// PeerDisconnected is called by the network interface when a peer -// closes a connection -func (bs *Bitswap) PeerDisconnected(p peer.ID) { - bs.wm.Disconnected(p) - bs.engine.PeerDisconnected(p) -} - -// ReceiveError is called by the network interface when an error happens -// at the network layer. Currently just logs error. -func (bs *Bitswap) ReceiveError(err error) { - log.Infof("Bitswap ReceiveError: %s", err) - // TODO log the network error - // TODO bubble the network error up to the parent context/error logger -} - -// Close is called to shutdown Bitswap -func (bs *Bitswap) Close() error { - return bs.process.Close() -} - -// GetWantlist returns the current local wantlist. -func (bs *Bitswap) GetWantlist() []cid.Cid { - entries := bs.wm.CurrentWants() - out := make([]cid.Cid, 0, len(entries)) - for _, e := range entries { - out = append(out, e.Cid) - } - return out -} - -// IsOnline is needed to match go-ipfs-exchange-interface -func (bs *Bitswap) IsOnline() bool { - return true -} - -// NewSession generates a new Bitswap session. You should use this, rather -// that calling Bitswap.GetBlocks, any time you intend to do several related -// block requests in a row. The session returned will have it's own GetBlocks -// method, but the session will use the fact that the requests are related to -// be more efficient in its requests to peers. If you are using a session -// from go-blockservice, it will create a bitswap session automatically. -func (bs *Bitswap) NewSession(ctx context.Context) exchange.Fetcher { - return bs.sm.NewSession(ctx, bs.provSearchDelay, bs.rebroadcastDelay) -} diff --git a/vendor/github.com/ipfs/go-bitswap/decision/engine.go b/vendor/github.com/ipfs/go-bitswap/decision/engine.go deleted file mode 100644 index 61bb4ca1..00000000 --- a/vendor/github.com/ipfs/go-bitswap/decision/engine.go +++ /dev/null @@ -1,424 +0,0 @@ -// Package decision implements the decision engine for the bitswap service. -package decision - -import ( - "context" - "fmt" - "sync" - "time" - - "github.com/google/uuid" - bsmsg "github.com/ipfs/go-bitswap/message" - wl "github.com/ipfs/go-bitswap/wantlist" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - bstore "github.com/ipfs/go-ipfs-blockstore" - logging "github.com/ipfs/go-log" - "github.com/ipfs/go-peertaskqueue" - "github.com/ipfs/go-peertaskqueue/peertask" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -// TODO consider taking responsibility for other types of requests. For -// example, there could be a |cancelQueue| for all of the cancellation -// messages that need to go out. There could also be a |wantlistQueue| for -// the local peer's wantlists. Alternatively, these could all be bundled -// into a single, intelligent global queue that efficiently -// batches/combines and takes all of these into consideration. -// -// Right now, messages go onto the network for four reasons: -// 1. an initial `sendwantlist` message to a provider of the first key in a -// request -// 2. a periodic full sweep of `sendwantlist` messages to all providers -// 3. upon receipt of blocks, a `cancel` message to all peers -// 4. draining the priority queue of `blockrequests` from peers -// -// Presently, only `blockrequests` are handled by the decision engine. -// However, there is an opportunity to give it more responsibility! If the -// decision engine is given responsibility for all of the others, it can -// intelligently decide how to combine requests efficiently. -// -// Some examples of what would be possible: -// -// * when sending out the wantlists, include `cancel` requests -// * when handling `blockrequests`, include `sendwantlist` and `cancel` as -// appropriate -// * when handling `cancel`, if we recently received a wanted block from a -// peer, include a partial wantlist that contains a few other high priority -// blocks -// -// In a sense, if we treat the decision engine as a black box, it could do -// whatever it sees fit to produce desired outcomes (get wanted keys -// quickly, maintain good relationships with peers, etc). - -var log = logging.Logger("engine") - -const ( - // outboxChanBuffer must be 0 to prevent stale messages from being sent - outboxChanBuffer = 0 - // maxMessageSize is the maximum size of the batched payload - maxMessageSize = 512 * 1024 - // tagPrefix is the tag given to peers associated an engine - tagPrefix = "bs-engine-%s" - - // tagWeight is the default weight for peers associated with an engine - tagWeight = 5 -) - -// Envelope contains a message for a Peer. -type Envelope struct { - // Peer is the intended recipient. - Peer peer.ID - - // Message is the payload. - Message bsmsg.BitSwapMessage - - // A callback to notify the decision queue that the task is complete - Sent func() -} - -// PeerTagger covers the methods on the connection manager used by the decision -// engine to tag peers -type PeerTagger interface { - TagPeer(peer.ID, string, int) - UntagPeer(p peer.ID, tag string) -} - -// Engine manages sending requested blocks to peers. -type Engine struct { - // peerRequestQueue is a priority queue of requests received from peers. - // Requests are popped from the queue, packaged up, and placed in the - // outbox. - peerRequestQueue *peertaskqueue.PeerTaskQueue - - // FIXME it's a bit odd for the client and the worker to both share memory - // (both modify the peerRequestQueue) and also to communicate over the - // workSignal channel. consider sending requests over the channel and - // allowing the worker to have exclusive access to the peerRequestQueue. In - // that case, no lock would be required. - workSignal chan struct{} - - // outbox contains outgoing messages to peers. This is owned by the - // taskWorker goroutine - outbox chan (<-chan *Envelope) - - bs bstore.Blockstore - - peerTagger PeerTagger - - tag string - lock sync.Mutex // protects the fields immediatly below - // ledgerMap lists Ledgers by their Partner key. - ledgerMap map[peer.ID]*ledger - - ticker *time.Ticker -} - -// NewEngine creates a new block sending engine for the given block store -func NewEngine(ctx context.Context, bs bstore.Blockstore, peerTagger PeerTagger) *Engine { - e := &Engine{ - ledgerMap: make(map[peer.ID]*ledger), - bs: bs, - peerTagger: peerTagger, - outbox: make(chan (<-chan *Envelope), outboxChanBuffer), - workSignal: make(chan struct{}, 1), - ticker: time.NewTicker(time.Millisecond * 100), - } - e.tag = fmt.Sprintf(tagPrefix, uuid.New().String()) - e.peerRequestQueue = peertaskqueue.New(peertaskqueue.OnPeerAddedHook(e.onPeerAdded), peertaskqueue.OnPeerRemovedHook(e.onPeerRemoved)) - go e.taskWorker(ctx) - return e -} - -func (e *Engine) onPeerAdded(p peer.ID) { - e.peerTagger.TagPeer(p, e.tag, tagWeight) -} - -func (e *Engine) onPeerRemoved(p peer.ID) { - e.peerTagger.UntagPeer(p, e.tag) -} - -// WantlistForPeer returns the currently understood want list for a given peer -func (e *Engine) WantlistForPeer(p peer.ID) (out []wl.Entry) { - partner := e.findOrCreate(p) - partner.lk.Lock() - defer partner.lk.Unlock() - return partner.wantList.SortedEntries() -} - -// LedgerForPeer returns aggregated data about blocks swapped and communication -// with a given peer. -func (e *Engine) LedgerForPeer(p peer.ID) *Receipt { - ledger := e.findOrCreate(p) - - ledger.lk.Lock() - defer ledger.lk.Unlock() - - return &Receipt{ - Peer: ledger.Partner.String(), - Value: ledger.Accounting.Value(), - Sent: ledger.Accounting.BytesSent, - Recv: ledger.Accounting.BytesRecv, - Exchanged: ledger.ExchangeCount(), - } -} - -func (e *Engine) taskWorker(ctx context.Context) { - defer close(e.outbox) // because taskWorker uses the channel exclusively - for { - oneTimeUse := make(chan *Envelope, 1) // buffer to prevent blocking - select { - case <-ctx.Done(): - return - case e.outbox <- oneTimeUse: - } - // receiver is ready for an outoing envelope. let's prepare one. first, - // we must acquire a task from the PQ... - envelope, err := e.nextEnvelope(ctx) - if err != nil { - close(oneTimeUse) - return // ctx cancelled - } - oneTimeUse <- envelope // buffered. won't block - close(oneTimeUse) - } -} - -// nextEnvelope runs in the taskWorker goroutine. Returns an error if the -// context is cancelled before the next Envelope can be created. -func (e *Engine) nextEnvelope(ctx context.Context) (*Envelope, error) { - for { - nextTask := e.peerRequestQueue.PopBlock() - for nextTask == nil { - select { - case <-ctx.Done(): - return nil, ctx.Err() - case <-e.workSignal: - nextTask = e.peerRequestQueue.PopBlock() - case <-e.ticker.C: - e.peerRequestQueue.ThawRound() - nextTask = e.peerRequestQueue.PopBlock() - } - } - - // with a task in hand, we're ready to prepare the envelope... - msg := bsmsg.New(true) - for _, entry := range nextTask.Tasks { - block, err := e.bs.Get(entry.Identifier.(cid.Cid)) - if err != nil { - log.Errorf("tried to execute a task and errored fetching block: %s", err) - continue - } - msg.AddBlock(block) - } - - if msg.Empty() { - // If we don't have the block, don't hold that against the peer - // make sure to update that the task has been 'completed' - nextTask.Done(nextTask.Tasks) - continue - } - - return &Envelope{ - Peer: nextTask.Target, - Message: msg, - Sent: func() { - nextTask.Done(nextTask.Tasks) - select { - case e.workSignal <- struct{}{}: - // work completing may mean that our queue will provide new - // work to be done. - default: - } - }, - }, nil - } -} - -// Outbox returns a channel of one-time use Envelope channels. -func (e *Engine) Outbox() <-chan (<-chan *Envelope) { - return e.outbox -} - -// Peers returns a slice of Peers with whom the local node has active sessions. -func (e *Engine) Peers() []peer.ID { - e.lock.Lock() - defer e.lock.Unlock() - - response := make([]peer.ID, 0, len(e.ledgerMap)) - - for _, ledger := range e.ledgerMap { - response = append(response, ledger.Partner) - } - return response -} - -// MessageReceived performs book-keeping. Returns error if passed invalid -// arguments. -func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage) { - if m.Empty() { - log.Debugf("received empty message from %s", p) - } - - newWorkExists := false - defer func() { - if newWorkExists { - e.signalNewWork() - } - }() - - l := e.findOrCreate(p) - l.lk.Lock() - defer l.lk.Unlock() - if m.Full() { - l.wantList = wl.New() - } - - var msgSize int - var activeEntries []peertask.Task - for _, entry := range m.Wantlist() { - if entry.Cancel { - log.Debugf("%s cancel %s", p, entry.Cid) - l.CancelWant(entry.Cid) - e.peerRequestQueue.Remove(entry.Cid, p) - } else { - log.Debugf("wants %s - %d", entry.Cid, entry.Priority) - l.Wants(entry.Cid, entry.Priority) - blockSize, err := e.bs.GetSize(entry.Cid) - if err != nil { - if err == bstore.ErrNotFound { - continue - } - log.Error(err) - } else { - // we have the block - newWorkExists = true - if msgSize+blockSize > maxMessageSize { - e.peerRequestQueue.PushBlock(p, activeEntries...) - activeEntries = []peertask.Task{} - msgSize = 0 - } - activeEntries = append(activeEntries, peertask.Task{Identifier: entry.Cid, Priority: entry.Priority}) - msgSize += blockSize - } - } - } - if len(activeEntries) > 0 { - e.peerRequestQueue.PushBlock(p, activeEntries...) - } - for _, block := range m.Blocks() { - log.Debugf("got block %s %d bytes", block, len(block.RawData())) - l.ReceivedBytes(len(block.RawData())) - } -} - -func (e *Engine) addBlock(block blocks.Block) { - work := false - - for _, l := range e.ledgerMap { - l.lk.Lock() - if entry, ok := l.WantListContains(block.Cid()); ok { - e.peerRequestQueue.PushBlock(l.Partner, peertask.Task{ - Identifier: entry.Cid, - Priority: entry.Priority, - }) - work = true - } - l.lk.Unlock() - } - - if work { - e.signalNewWork() - } -} - -// AddBlock is called to when a new block is received and added to a block store -// meaning there may be peers who want that block that we should send it to. -func (e *Engine) AddBlock(block blocks.Block) { - e.lock.Lock() - defer e.lock.Unlock() - - e.addBlock(block) -} - -// TODO add contents of m.WantList() to my local wantlist? NB: could introduce -// race conditions where I send a message, but MessageSent gets handled after -// MessageReceived. The information in the local wantlist could become -// inconsistent. Would need to ensure that Sends and acknowledgement of the -// send happen atomically - -// MessageSent is called when a message has successfully been sent out, to record -// changes. -func (e *Engine) MessageSent(p peer.ID, m bsmsg.BitSwapMessage) { - l := e.findOrCreate(p) - l.lk.Lock() - defer l.lk.Unlock() - - for _, block := range m.Blocks() { - l.SentBytes(len(block.RawData())) - l.wantList.Remove(block.Cid()) - e.peerRequestQueue.Remove(block.Cid(), p) - } - -} - -// PeerConnected is called when a new peer connects, meaning we should start -// sending blocks. -func (e *Engine) PeerConnected(p peer.ID) { - e.lock.Lock() - defer e.lock.Unlock() - l, ok := e.ledgerMap[p] - if !ok { - l = newLedger(p) - e.ledgerMap[p] = l - } - l.lk.Lock() - defer l.lk.Unlock() - l.ref++ -} - -// PeerDisconnected is called when a peer disconnects. -func (e *Engine) PeerDisconnected(p peer.ID) { - e.lock.Lock() - defer e.lock.Unlock() - l, ok := e.ledgerMap[p] - if !ok { - return - } - l.lk.Lock() - defer l.lk.Unlock() - l.ref-- - if l.ref <= 0 { - delete(e.ledgerMap, p) - } -} - -func (e *Engine) numBytesSentTo(p peer.ID) uint64 { - // NB not threadsafe - return e.findOrCreate(p).Accounting.BytesSent -} - -func (e *Engine) numBytesReceivedFrom(p peer.ID) uint64 { - // NB not threadsafe - return e.findOrCreate(p).Accounting.BytesRecv -} - -// ledger lazily instantiates a ledger -func (e *Engine) findOrCreate(p peer.ID) *ledger { - e.lock.Lock() - defer e.lock.Unlock() - l, ok := e.ledgerMap[p] - if !ok { - l = newLedger(p) - e.ledgerMap[p] = l - } - return l -} - -func (e *Engine) signalNewWork() { - // Signal task generation to restart (if stopped!) - select { - case e.workSignal <- struct{}{}: - default: - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/decision/ledger.go b/vendor/github.com/ipfs/go-bitswap/decision/ledger.go deleted file mode 100644 index 12eca63b..00000000 --- a/vendor/github.com/ipfs/go-bitswap/decision/ledger.go +++ /dev/null @@ -1,97 +0,0 @@ -package decision - -import ( - "sync" - "time" - - wl "github.com/ipfs/go-bitswap/wantlist" - - cid "github.com/ipfs/go-cid" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -func newLedger(p peer.ID) *ledger { - return &ledger{ - wantList: wl.New(), - Partner: p, - sentToPeer: make(map[string]time.Time), - } -} - -// ledger stores the data exchange relationship between two peers. -// NOT threadsafe -type ledger struct { - // Partner is the remote Peer. - Partner peer.ID - - // Accounting tracks bytes sent and received. - Accounting debtRatio - - // lastExchange is the time of the last data exchange. - lastExchange time.Time - - // exchangeCount is the number of exchanges with this peer - exchangeCount uint64 - - // wantList is a (bounded, small) set of keys that Partner desires. - wantList *wl.Wantlist - - // sentToPeer is a set of keys to ensure we dont send duplicate blocks - // to a given peer - sentToPeer map[string]time.Time - - // ref is the reference count for this ledger, its used to ensure we - // don't drop the reference to this ledger in multi-connection scenarios - ref int - - lk sync.Mutex -} - -// Receipt is a summary of the ledger for a given peer -// collecting various pieces of aggregated data for external -// reporting purposes. -type Receipt struct { - Peer string - Value float64 - Sent uint64 - Recv uint64 - Exchanged uint64 -} - -type debtRatio struct { - BytesSent uint64 - BytesRecv uint64 -} - -func (dr *debtRatio) Value() float64 { - return float64(dr.BytesSent) / float64(dr.BytesRecv+1) -} - -func (l *ledger) SentBytes(n int) { - l.exchangeCount++ - l.lastExchange = time.Now() - l.Accounting.BytesSent += uint64(n) -} - -func (l *ledger) ReceivedBytes(n int) { - l.exchangeCount++ - l.lastExchange = time.Now() - l.Accounting.BytesRecv += uint64(n) -} - -func (l *ledger) Wants(k cid.Cid, priority int) { - log.Debugf("peer %s wants %s", l.Partner, k) - l.wantList.Add(k, priority) -} - -func (l *ledger) CancelWant(k cid.Cid) { - l.wantList.Remove(k) -} - -func (l *ledger) WantListContains(k cid.Cid) (wl.Entry, bool) { - return l.wantList.Contains(k) -} - -func (l *ledger) ExchangeCount() uint64 { - return l.exchangeCount -} diff --git a/vendor/github.com/ipfs/go-bitswap/getter/getter.go b/vendor/github.com/ipfs/go-bitswap/getter/getter.go deleted file mode 100644 index 4f1c29db..00000000 --- a/vendor/github.com/ipfs/go-bitswap/getter/getter.go +++ /dev/null @@ -1,112 +0,0 @@ -package getter - -import ( - "context" - "errors" - - notifications "github.com/ipfs/go-bitswap/notifications" - logging "github.com/ipfs/go-log" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" -) - -var log = logging.Logger("bitswap") - -// GetBlocksFunc is any function that can take an array of CIDs and return a -// channel of incoming blocks. -type GetBlocksFunc func(context.Context, []cid.Cid) (<-chan blocks.Block, error) - -// SyncGetBlock takes a block cid and an async function for getting several -// blocks that returns a channel, and uses that function to return the -// block syncronously. -func SyncGetBlock(p context.Context, k cid.Cid, gb GetBlocksFunc) (blocks.Block, error) { - if !k.Defined() { - log.Error("undefined cid in GetBlock") - return nil, blockstore.ErrNotFound - } - - // Any async work initiated by this function must end when this function - // returns. To ensure this, derive a new context. Note that it is okay to - // listen on parent in this scope, but NOT okay to pass |parent| to - // functions called by this one. Otherwise those functions won't return - // when this context's cancel func is executed. This is difficult to - // enforce. May this comment keep you safe. - ctx, cancel := context.WithCancel(p) - defer cancel() - - promise, err := gb(ctx, []cid.Cid{k}) - if err != nil { - return nil, err - } - - select { - case block, ok := <-promise: - if !ok { - select { - case <-ctx.Done(): - return nil, ctx.Err() - default: - return nil, errors.New("promise channel was closed") - } - } - return block, nil - case <-p.Done(): - return nil, p.Err() - } -} - -// WantFunc is any function that can express a want for set of blocks. -type WantFunc func(context.Context, []cid.Cid) - -// AsyncGetBlocks take a set of block cids, a pubsub channel for incoming -// blocks, a want function, and a close function, -// and returns a channel of incoming blocks. -func AsyncGetBlocks(ctx context.Context, keys []cid.Cid, notif notifications.PubSub, want WantFunc, cwants func([]cid.Cid)) (<-chan blocks.Block, error) { - if len(keys) == 0 { - out := make(chan blocks.Block) - close(out) - return out, nil - } - - remaining := cid.NewSet() - promise := notif.Subscribe(ctx, keys...) - for _, k := range keys { - log.Event(ctx, "Bitswap.GetBlockRequest.Start", k) - remaining.Add(k) - } - - want(ctx, keys) - - out := make(chan blocks.Block) - go handleIncoming(ctx, remaining, promise, out, cwants) - return out, nil -} - -func handleIncoming(ctx context.Context, remaining *cid.Set, in <-chan blocks.Block, out chan blocks.Block, cfun func([]cid.Cid)) { - ctx, cancel := context.WithCancel(ctx) - defer func() { - cancel() - close(out) - // can't just defer this call on its own, arguments are resolved *when* the defer is created - cfun(remaining.Keys()) - }() - for { - select { - case blk, ok := <-in: - if !ok { - return - } - - remaining.Remove(blk.Cid()) - select { - case out <- blk: - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/go.mod b/vendor/github.com/ipfs/go-bitswap/go.mod deleted file mode 100644 index 9fb78e7f..00000000 --- a/vendor/github.com/ipfs/go-bitswap/go.mod +++ /dev/null @@ -1,39 +0,0 @@ -module github.com/ipfs/go-bitswap - -require ( - github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50 // indirect - github.com/cskr/pubsub v1.0.2 - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gogo/protobuf v1.2.1 - github.com/golang/protobuf v1.3.1 // indirect - github.com/google/uuid v1.1.1 - github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-detect-race v0.0.1 - github.com/ipfs/go-ipfs-blockstore v0.0.1 - github.com/ipfs/go-ipfs-blocksutil v0.0.1 - github.com/ipfs/go-ipfs-delay v0.0.1 - github.com/ipfs/go-ipfs-exchange-interface v0.0.1 - github.com/ipfs/go-ipfs-routing v0.1.0 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-metrics-interface v0.0.1 - github.com/ipfs/go-peertaskqueue v0.1.1 - github.com/jbenet/goprocess v0.1.3 - github.com/libp2p/go-libp2p v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.3 - github.com/libp2p/go-libp2p-loggables v0.1.0 - github.com/libp2p/go-libp2p-netutil v0.1.0 - github.com/libp2p/go-libp2p-testing v0.0.4 - github.com/libp2p/go-msgio v0.0.3 // indirect - github.com/mattn/go-colorable v0.1.2 // indirect - github.com/multiformats/go-multiaddr v0.0.4 - github.com/opentracing/opentracing-go v1.1.0 // indirect - golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect - golang.org/x/net v0.0.0-20190611141213-3f473d35a33a // indirect - golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae // indirect - golang.org/x/text v0.3.2 // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect -) diff --git a/vendor/github.com/ipfs/go-bitswap/go.sum b/vendor/github.com/ipfs/go-bitswap/go.sum deleted file mode 100644 index 6740d9e1..00000000 --- a/vendor/github.com/ipfs/go-bitswap/go.sum +++ /dev/null @@ -1,334 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50 h1:4i3KsuVA0o0KoBxAC5x+MY7RbteiMK1V7gf/G08NGIQ= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ= -github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-peertaskqueue v0.1.1 h1:+gPjbI+V3NktXZOqJA1kzbms2pYmhjgQQal0MzZrOAY= -github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.1 h1:52sB0TJuDk2nYMcMfHOKaPoaayDZjaYVCq6Vk1ejUTk= -github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8= -github.com/libp2p/go-libp2p-autonat v0.1.0 h1:aCWAu43Ri4nU0ZPO7NyLzUvvfqd0nE3dX0R/ZGYVgOU= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0 h1:eniLL3Y9aq/sryfyV1IAHj5rlvuyj3b7iz8tSiZpdhY= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= -github.com/libp2p/go-libp2p-core v0.0.3 h1:+IonUYY0nJZLb5Fdv6a6DOjtGP1L8Bb3faamiI2q5FY= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0 h1:j+R6cokKcGbnZLf4kcNwpx6mDEUPF3N6SrqMymQhmvs= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.3 h1:VsOlWispTivSsOMg70e0W77y6oiSBSRCyP6URrWvE04= -github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-ws-transport v0.1.0 h1:F+0OvvdmPTDsVc4AjPHjV7L7Pk1B7D5QwtDcKE2oag4= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-bitswap/message/message.go b/vendor/github.com/ipfs/go-bitswap/message/message.go deleted file mode 100644 index df44d112..00000000 --- a/vendor/github.com/ipfs/go-bitswap/message/message.go +++ /dev/null @@ -1,251 +0,0 @@ -package message - -import ( - "fmt" - "io" - - pb "github.com/ipfs/go-bitswap/message/pb" - wantlist "github.com/ipfs/go-bitswap/wantlist" - blocks "github.com/ipfs/go-block-format" - - ggio "github.com/gogo/protobuf/io" - cid "github.com/ipfs/go-cid" - - "github.com/libp2p/go-libp2p-core/network" -) - -// BitSwapMessage is the basic interface for interacting building, encoding, -// and decoding messages sent on the BitSwap protocol. -type BitSwapMessage interface { - // Wantlist returns a slice of unique keys that represent data wanted by - // the sender. - Wantlist() []Entry - - // Blocks returns a slice of unique blocks. - Blocks() []blocks.Block - - // AddEntry adds an entry to the Wantlist. - AddEntry(key cid.Cid, priority int) - - Cancel(key cid.Cid) - - Empty() bool - - // A full wantlist is an authoritative copy, a 'non-full' wantlist is a patch-set - Full() bool - - AddBlock(blocks.Block) - Exportable - - Loggable() map[string]interface{} -} - -// Exportable is an interface for structures than can be -// encoded in a bitswap protobuf. -type Exportable interface { - ToProtoV0() *pb.Message - ToProtoV1() *pb.Message - ToNetV0(w io.Writer) error - ToNetV1(w io.Writer) error -} - -type impl struct { - full bool - wantlist map[cid.Cid]*Entry - blocks map[cid.Cid]blocks.Block -} - -// New returns a new, empty bitswap message -func New(full bool) BitSwapMessage { - return newMsg(full) -} - -func newMsg(full bool) *impl { - return &impl{ - blocks: make(map[cid.Cid]blocks.Block), - wantlist: make(map[cid.Cid]*Entry), - full: full, - } -} - -// Entry is an wantlist entry in a Bitswap message (along with whether it's an -// add or cancel). -type Entry struct { - wantlist.Entry - Cancel bool -} - -func newMessageFromProto(pbm pb.Message) (BitSwapMessage, error) { - m := newMsg(pbm.Wantlist.Full) - for _, e := range pbm.Wantlist.Entries { - c, err := cid.Cast([]byte(e.Block)) - if err != nil { - return nil, fmt.Errorf("incorrectly formatted cid in wantlist: %s", err) - } - m.addEntry(c, int(e.Priority), e.Cancel) - } - - // deprecated - for _, d := range pbm.Blocks { - // CIDv0, sha256, protobuf only - b := blocks.NewBlock(d) - m.AddBlock(b) - } - // - - for _, b := range pbm.GetPayload() { - pref, err := cid.PrefixFromBytes(b.GetPrefix()) - if err != nil { - return nil, err - } - - c, err := pref.Sum(b.GetData()) - if err != nil { - return nil, err - } - - blk, err := blocks.NewBlockWithCid(b.GetData(), c) - if err != nil { - return nil, err - } - - m.AddBlock(blk) - } - - return m, nil -} - -func (m *impl) Full() bool { - return m.full -} - -func (m *impl) Empty() bool { - return len(m.blocks) == 0 && len(m.wantlist) == 0 -} - -func (m *impl) Wantlist() []Entry { - out := make([]Entry, 0, len(m.wantlist)) - for _, e := range m.wantlist { - out = append(out, *e) - } - return out -} - -func (m *impl) Blocks() []blocks.Block { - bs := make([]blocks.Block, 0, len(m.blocks)) - for _, block := range m.blocks { - bs = append(bs, block) - } - return bs -} - -func (m *impl) Cancel(k cid.Cid) { - delete(m.wantlist, k) - m.addEntry(k, 0, true) -} - -func (m *impl) AddEntry(k cid.Cid, priority int) { - m.addEntry(k, priority, false) -} - -func (m *impl) addEntry(c cid.Cid, priority int, cancel bool) { - e, exists := m.wantlist[c] - if exists { - e.Priority = priority - e.Cancel = cancel - } else { - m.wantlist[c] = &Entry{ - Entry: wantlist.Entry{ - Cid: c, - Priority: priority, - }, - Cancel: cancel, - } - } -} - -func (m *impl) AddBlock(b blocks.Block) { - m.blocks[b.Cid()] = b -} - -// FromNet generates a new BitswapMessage from incoming data on an io.Reader. -func FromNet(r io.Reader) (BitSwapMessage, error) { - pbr := ggio.NewDelimitedReader(r, network.MessageSizeMax) - return FromPBReader(pbr) -} - -// FromPBReader generates a new Bitswap message from a gogo-protobuf reader -func FromPBReader(pbr ggio.Reader) (BitSwapMessage, error) { - pb := new(pb.Message) - if err := pbr.ReadMsg(pb); err != nil { - return nil, err - } - - return newMessageFromProto(*pb) -} - -func (m *impl) ToProtoV0() *pb.Message { - pbm := new(pb.Message) - pbm.Wantlist.Entries = make([]pb.Message_Wantlist_Entry, 0, len(m.wantlist)) - for _, e := range m.wantlist { - pbm.Wantlist.Entries = append(pbm.Wantlist.Entries, pb.Message_Wantlist_Entry{ - Block: e.Cid.Bytes(), - Priority: int32(e.Priority), - Cancel: e.Cancel, - }) - } - pbm.Wantlist.Full = m.full - - blocks := m.Blocks() - pbm.Blocks = make([][]byte, 0, len(blocks)) - for _, b := range blocks { - pbm.Blocks = append(pbm.Blocks, b.RawData()) - } - return pbm -} - -func (m *impl) ToProtoV1() *pb.Message { - pbm := new(pb.Message) - pbm.Wantlist.Entries = make([]pb.Message_Wantlist_Entry, 0, len(m.wantlist)) - for _, e := range m.wantlist { - pbm.Wantlist.Entries = append(pbm.Wantlist.Entries, pb.Message_Wantlist_Entry{ - Block: e.Cid.Bytes(), - Priority: int32(e.Priority), - Cancel: e.Cancel, - }) - } - pbm.Wantlist.Full = m.full - - blocks := m.Blocks() - pbm.Payload = make([]pb.Message_Block, 0, len(blocks)) - for _, b := range blocks { - pbm.Payload = append(pbm.Payload, pb.Message_Block{ - Data: b.RawData(), - Prefix: b.Cid().Prefix().Bytes(), - }) - } - return pbm -} - -func (m *impl) ToNetV0(w io.Writer) error { - pbw := ggio.NewDelimitedWriter(w) - - return pbw.WriteMsg(m.ToProtoV0()) -} - -func (m *impl) ToNetV1(w io.Writer) error { - pbw := ggio.NewDelimitedWriter(w) - - return pbw.WriteMsg(m.ToProtoV1()) -} - -func (m *impl) Loggable() map[string]interface{} { - blocks := make([]string, 0, len(m.blocks)) - for _, v := range m.blocks { - blocks = append(blocks, v.Cid().String()) - } - return map[string]interface{}{ - "blocks": blocks, - "wants": m.Wantlist(), - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/message/pb/Makefile b/vendor/github.com/ipfs/go-bitswap/message/pb/Makefile deleted file mode 100644 index df34e54b..00000000 --- a/vendor/github.com/ipfs/go-bitswap/message/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/ipfs/go-bitswap/message/pb/message.pb.go b/vendor/github.com/ipfs/go-bitswap/message/pb/message.pb.go deleted file mode 100644 index 34eacb29..00000000 --- a/vendor/github.com/ipfs/go-bitswap/message/pb/message.pb.go +++ /dev/null @@ -1,1152 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: message.proto - -package bitswap_message_pb - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Message struct { - Wantlist Message_Wantlist `protobuf:"bytes,1,opt,name=wantlist,proto3" json:"wantlist"` - Blocks [][]byte `protobuf:"bytes,2,rep,name=blocks,proto3" json:"blocks,omitempty"` - Payload []Message_Block `protobuf:"bytes,3,rep,name=payload,proto3" json:"payload"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_33c57e4bae7b9afd, []int{0} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetWantlist() Message_Wantlist { - if m != nil { - return m.Wantlist - } - return Message_Wantlist{} -} - -func (m *Message) GetBlocks() [][]byte { - if m != nil { - return m.Blocks - } - return nil -} - -func (m *Message) GetPayload() []Message_Block { - if m != nil { - return m.Payload - } - return nil -} - -type Message_Wantlist struct { - Entries []Message_Wantlist_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries"` - Full bool `protobuf:"varint,2,opt,name=full,proto3" json:"full,omitempty"` -} - -func (m *Message_Wantlist) Reset() { *m = Message_Wantlist{} } -func (m *Message_Wantlist) String() string { return proto.CompactTextString(m) } -func (*Message_Wantlist) ProtoMessage() {} -func (*Message_Wantlist) Descriptor() ([]byte, []int) { - return fileDescriptor_33c57e4bae7b9afd, []int{0, 0} -} -func (m *Message_Wantlist) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Wantlist) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Wantlist.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Wantlist) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Wantlist.Merge(m, src) -} -func (m *Message_Wantlist) XXX_Size() int { - return m.Size() -} -func (m *Message_Wantlist) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Wantlist.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_Wantlist proto.InternalMessageInfo - -func (m *Message_Wantlist) GetEntries() []Message_Wantlist_Entry { - if m != nil { - return m.Entries - } - return nil -} - -func (m *Message_Wantlist) GetFull() bool { - if m != nil { - return m.Full - } - return false -} - -type Message_Wantlist_Entry struct { - Block []byte `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` - Priority int32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"` - Cancel bool `protobuf:"varint,3,opt,name=cancel,proto3" json:"cancel,omitempty"` -} - -func (m *Message_Wantlist_Entry) Reset() { *m = Message_Wantlist_Entry{} } -func (m *Message_Wantlist_Entry) String() string { return proto.CompactTextString(m) } -func (*Message_Wantlist_Entry) ProtoMessage() {} -func (*Message_Wantlist_Entry) Descriptor() ([]byte, []int) { - return fileDescriptor_33c57e4bae7b9afd, []int{0, 0, 0} -} -func (m *Message_Wantlist_Entry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Wantlist_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Wantlist_Entry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Wantlist_Entry) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Wantlist_Entry.Merge(m, src) -} -func (m *Message_Wantlist_Entry) XXX_Size() int { - return m.Size() -} -func (m *Message_Wantlist_Entry) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Wantlist_Entry.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_Wantlist_Entry proto.InternalMessageInfo - -func (m *Message_Wantlist_Entry) GetBlock() []byte { - if m != nil { - return m.Block - } - return nil -} - -func (m *Message_Wantlist_Entry) GetPriority() int32 { - if m != nil { - return m.Priority - } - return 0 -} - -func (m *Message_Wantlist_Entry) GetCancel() bool { - if m != nil { - return m.Cancel - } - return false -} - -type Message_Block struct { - Prefix []byte `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *Message_Block) Reset() { *m = Message_Block{} } -func (m *Message_Block) String() string { return proto.CompactTextString(m) } -func (*Message_Block) ProtoMessage() {} -func (*Message_Block) Descriptor() ([]byte, []int) { - return fileDescriptor_33c57e4bae7b9afd, []int{0, 1} -} -func (m *Message_Block) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Block.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Block) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Block.Merge(m, src) -} -func (m *Message_Block) XXX_Size() int { - return m.Size() -} -func (m *Message_Block) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Block.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_Block proto.InternalMessageInfo - -func (m *Message_Block) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -func (m *Message_Block) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func init() { - proto.RegisterType((*Message)(nil), "bitswap.message.pb.Message") - proto.RegisterType((*Message_Wantlist)(nil), "bitswap.message.pb.Message.Wantlist") - proto.RegisterType((*Message_Wantlist_Entry)(nil), "bitswap.message.pb.Message.Wantlist.Entry") - proto.RegisterType((*Message_Block)(nil), "bitswap.message.pb.Message.Block") -} - -func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) } - -var fileDescriptor_33c57e4bae7b9afd = []byte{ - // 335 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x4a, 0xf3, 0x40, - 0x14, 0xc5, 0x33, 0x4d, 0xd3, 0x86, 0xdb, 0x7e, 0x9b, 0xe1, 0x43, 0x86, 0x2c, 0x62, 0x14, 0x17, - 0x41, 0x70, 0x0a, 0xed, 0x13, 0x58, 0xd0, 0x85, 0xe0, 0xc2, 0x6c, 0x5c, 0x4f, 0xd2, 0x34, 0x0e, - 0xa6, 0x99, 0x90, 0x4c, 0xa9, 0x7d, 0x0b, 0x5f, 0xc1, 0x07, 0x71, 0xdf, 0x65, 0x97, 0xae, 0x44, - 0xda, 0x17, 0x91, 0xdc, 0x4e, 0xb3, 0x11, 0xc4, 0xdd, 0x3d, 0xc3, 0x39, 0xbf, 0xfb, 0x67, 0xe0, - 0xdf, 0x22, 0xad, 0x6b, 0x91, 0xa5, 0xbc, 0xac, 0x94, 0x56, 0x94, 0xc6, 0x52, 0xd7, 0x2b, 0x51, - 0xf2, 0xf6, 0x39, 0xf6, 0xae, 0x32, 0xa9, 0x9f, 0x96, 0x31, 0x4f, 0xd4, 0x62, 0x94, 0xa9, 0x4c, - 0x8d, 0xd0, 0x1a, 0x2f, 0xe7, 0xa8, 0x50, 0x60, 0x75, 0x40, 0x9c, 0xbf, 0xd9, 0xd0, 0xbf, 0x3f, - 0xa4, 0xe9, 0x2d, 0xb8, 0x2b, 0x51, 0xe8, 0x5c, 0xd6, 0x9a, 0x91, 0x80, 0x84, 0x83, 0xf1, 0x05, - 0xff, 0xd9, 0x81, 0x1b, 0x3b, 0x7f, 0x34, 0xde, 0x69, 0x77, 0xf3, 0x79, 0x6a, 0x45, 0x6d, 0x96, - 0x9e, 0x40, 0x2f, 0xce, 0x55, 0xf2, 0x5c, 0xb3, 0x4e, 0x60, 0x87, 0xc3, 0xc8, 0x28, 0x7a, 0x0d, - 0xfd, 0x52, 0xac, 0x73, 0x25, 0x66, 0xcc, 0x0e, 0xec, 0x70, 0x30, 0x3e, 0xfb, 0x0d, 0x3f, 0x6d, - 0x42, 0x86, 0x7d, 0xcc, 0x79, 0xef, 0x04, 0xdc, 0x63, 0x5f, 0x7a, 0x07, 0xfd, 0xb4, 0xd0, 0x95, - 0x4c, 0x6b, 0x46, 0x90, 0x77, 0xf9, 0x97, 0x71, 0xf9, 0x4d, 0xa1, 0xab, 0xf5, 0x11, 0x6c, 0x00, - 0x94, 0x42, 0x77, 0xbe, 0xcc, 0x73, 0xd6, 0x09, 0x48, 0xe8, 0x46, 0x58, 0x7b, 0x0f, 0xe0, 0xa0, - 0x97, 0xfe, 0x07, 0x07, 0x57, 0xc0, 0xab, 0x0c, 0xa3, 0x83, 0xa0, 0x1e, 0xb8, 0x65, 0x25, 0x55, - 0x25, 0xf5, 0x1a, 0x63, 0x4e, 0xd4, 0xea, 0xe6, 0x04, 0x89, 0x28, 0x92, 0x34, 0x67, 0x36, 0x02, - 0x8d, 0xf2, 0x26, 0xe0, 0xe0, 0x5e, 0x8d, 0xa1, 0xac, 0xd2, 0xb9, 0x7c, 0x31, 0x4c, 0xa3, 0x9a, - 0x39, 0x66, 0x42, 0x0b, 0x04, 0x0e, 0x23, 0xac, 0xa7, 0x6c, 0xb3, 0xf3, 0xc9, 0x76, 0xe7, 0x93, - 0xaf, 0x9d, 0x4f, 0x5e, 0xf7, 0xbe, 0xb5, 0xdd, 0xfb, 0xd6, 0xc7, 0xde, 0xb7, 0xe2, 0x1e, 0x7e, - 0xe2, 0xe4, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x1d, 0x6e, 0x21, 0x18, 0x02, 0x00, 0x00, -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintMessage(dAtA, i, uint64(m.Wantlist.Size())) - n1, err := m.Wantlist.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - if len(m.Blocks) > 0 { - for _, b := range m.Blocks { - dAtA[i] = 0x12 - i++ - i = encodeVarintMessage(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if len(m.Payload) > 0 { - for _, msg := range m.Payload { - dAtA[i] = 0x1a - i++ - i = encodeVarintMessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *Message_Wantlist) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_Wantlist) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for _, msg := range m.Entries { - dAtA[i] = 0xa - i++ - i = encodeVarintMessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Full { - dAtA[i] = 0x10 - i++ - if m.Full { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *Message_Wantlist_Entry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_Wantlist_Entry) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Block) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintMessage(dAtA, i, uint64(len(m.Block))) - i += copy(dAtA[i:], m.Block) - } - if m.Priority != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintMessage(dAtA, i, uint64(m.Priority)) - } - if m.Cancel { - dAtA[i] = 0x18 - i++ - if m.Cancel { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *Message_Block) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_Block) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Prefix) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintMessage(dAtA, i, uint64(len(m.Prefix))) - i += copy(dAtA[i:], m.Prefix) - } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintMessage(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - return i, nil -} - -func encodeVarintMessage(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Wantlist.Size() - n += 1 + l + sovMessage(uint64(l)) - if len(m.Blocks) > 0 { - for _, b := range m.Blocks { - l = len(b) - n += 1 + l + sovMessage(uint64(l)) - } - } - if len(m.Payload) > 0 { - for _, e := range m.Payload { - l = e.Size() - n += 1 + l + sovMessage(uint64(l)) - } - } - return n -} - -func (m *Message_Wantlist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovMessage(uint64(l)) - } - } - if m.Full { - n += 2 - } - return n -} - -func (m *Message_Wantlist_Entry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Block) - if l > 0 { - n += 1 + l + sovMessage(uint64(l)) - } - if m.Priority != 0 { - n += 1 + sovMessage(uint64(m.Priority)) - } - if m.Cancel { - n += 2 - } - return n -} - -func (m *Message_Block) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovMessage(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovMessage(uint64(l)) - } - return n -} - -func sovMessage(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozMessage(x uint64) (n int) { - return sovMessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Wantlist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Wantlist.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blocks = append(m.Blocks, make([]byte, postIndex-iNdEx)) - copy(m.Blocks[len(m.Blocks)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload, Message_Block{}) - if err := m.Payload[len(m.Payload)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_Wantlist) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Wantlist: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Wantlist: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, Message_Wantlist_Entry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Full", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Full = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_Wantlist_Entry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Entry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Block = append(m.Block[:0], dAtA[iNdEx:postIndex]...) - if m.Block == nil { - m.Block = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) - } - m.Priority = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Priority |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Cancel", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Cancel = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_Block) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Block: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) - if m.Prefix == nil { - m.Prefix = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMessage(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMessage - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMessage - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMessage(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMessage - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthMessage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMessage = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-bitswap/message/pb/message.proto b/vendor/github.com/ipfs/go-bitswap/message/pb/message.proto deleted file mode 100644 index 102b3431..00000000 --- a/vendor/github.com/ipfs/go-bitswap/message/pb/message.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package bitswap.message.pb; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -message Message { - - message Wantlist { - - message Entry { - bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0) - int32 priority = 2; // the priority (normalized). default to 1 - bool cancel = 3; // whether this revokes an entry - } - - repeated Entry entries = 1 [(gogoproto.nullable) = false]; // a list of wantlist entries - bool full = 2; // whether this is the full wantlist. default to false - } - - message Block { - bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length) - bytes data = 2; - } - - Wantlist wantlist = 1 [(gogoproto.nullable) = false]; - repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0 - repeated Block payload = 3 [(gogoproto.nullable) = false]; // used to send Blocks in bitswap 1.1.0 -} diff --git a/vendor/github.com/ipfs/go-bitswap/messagequeue/messagequeue.go b/vendor/github.com/ipfs/go-bitswap/messagequeue/messagequeue.go deleted file mode 100644 index 9e472424..00000000 --- a/vendor/github.com/ipfs/go-bitswap/messagequeue/messagequeue.go +++ /dev/null @@ -1,273 +0,0 @@ -package messagequeue - -import ( - "context" - "sync" - "time" - - bsmsg "github.com/ipfs/go-bitswap/message" - bsnet "github.com/ipfs/go-bitswap/network" - wantlist "github.com/ipfs/go-bitswap/wantlist" - logging "github.com/ipfs/go-log" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -var log = logging.Logger("bitswap") - -const ( - defaultRebroadcastInterval = 30 * time.Second - maxRetries = 10 -) - -// MessageNetwork is any network that can connect peers and generate a message -// sender. -type MessageNetwork interface { - ConnectTo(context.Context, peer.ID) error - NewMessageSender(context.Context, peer.ID) (bsnet.MessageSender, error) -} - -// MessageQueue implements queue of want messages to send to peers. -type MessageQueue struct { - ctx context.Context - p peer.ID - network MessageNetwork - - outgoingWork chan struct{} - done chan struct{} - - // do not touch out of run loop - wl *wantlist.SessionTrackedWantlist - nextMessage bsmsg.BitSwapMessage - nextMessageLk sync.RWMutex - sender bsnet.MessageSender - rebroadcastIntervalLk sync.RWMutex - rebroadcastInterval time.Duration - rebroadcastTimer *time.Timer -} - -// New creats a new MessageQueue. -func New(ctx context.Context, p peer.ID, network MessageNetwork) *MessageQueue { - return &MessageQueue{ - ctx: ctx, - wl: wantlist.NewSessionTrackedWantlist(), - network: network, - p: p, - outgoingWork: make(chan struct{}, 1), - done: make(chan struct{}), - rebroadcastInterval: defaultRebroadcastInterval, - } -} - -// AddMessage adds new entries to an outgoing message for a given session. -func (mq *MessageQueue) AddMessage(entries []bsmsg.Entry, ses uint64) { - if !mq.addEntries(entries, ses) { - return - } - select { - case mq.outgoingWork <- struct{}{}: - default: - } -} - -// AddWantlist adds a complete session tracked want list to a message queue -func (mq *MessageQueue) AddWantlist(initialWants *wantlist.SessionTrackedWantlist) { - initialWants.CopyWants(mq.wl) - mq.addWantlist() -} - -// SetRebroadcastInterval sets a new interval on which to rebroadcast the full wantlist -func (mq *MessageQueue) SetRebroadcastInterval(delay time.Duration) { - mq.rebroadcastIntervalLk.Lock() - mq.rebroadcastInterval = delay - if mq.rebroadcastTimer != nil { - mq.rebroadcastTimer.Reset(delay) - } - mq.rebroadcastIntervalLk.Unlock() -} - -// Startup starts the processing of messages, and creates an initial message -// based on the given initial wantlist. -func (mq *MessageQueue) Startup() { - mq.rebroadcastIntervalLk.RLock() - mq.rebroadcastTimer = time.NewTimer(mq.rebroadcastInterval) - mq.rebroadcastIntervalLk.RUnlock() - go mq.runQueue() -} - -// Shutdown stops the processing of messages for a message queue. -func (mq *MessageQueue) Shutdown() { - close(mq.done) -} - -func (mq *MessageQueue) runQueue() { - for { - select { - case <-mq.rebroadcastTimer.C: - mq.rebroadcastWantlist() - case <-mq.outgoingWork: - mq.sendMessage() - case <-mq.done: - if mq.sender != nil { - mq.sender.Close() - } - return - case <-mq.ctx.Done(): - if mq.sender != nil { - mq.sender.Reset() - } - return - } - } -} - -func (mq *MessageQueue) addWantlist() { - - mq.nextMessageLk.Lock() - defer mq.nextMessageLk.Unlock() - - if mq.wl.Len() > 0 { - if mq.nextMessage == nil { - mq.nextMessage = bsmsg.New(false) - } - for _, e := range mq.wl.Entries() { - mq.nextMessage.AddEntry(e.Cid, e.Priority) - } - select { - case mq.outgoingWork <- struct{}{}: - default: - } - } -} - -func (mq *MessageQueue) rebroadcastWantlist() { - mq.rebroadcastIntervalLk.RLock() - mq.rebroadcastTimer.Reset(mq.rebroadcastInterval) - mq.rebroadcastIntervalLk.RUnlock() - - mq.addWantlist() -} - -func (mq *MessageQueue) addEntries(entries []bsmsg.Entry, ses uint64) bool { - var work bool - mq.nextMessageLk.Lock() - defer mq.nextMessageLk.Unlock() - // if we have no message held allocate a new one - if mq.nextMessage == nil { - mq.nextMessage = bsmsg.New(false) - } - - for _, e := range entries { - if e.Cancel { - if mq.wl.Remove(e.Cid, ses) { - work = true - mq.nextMessage.Cancel(e.Cid) - } - } else { - if mq.wl.Add(e.Cid, e.Priority, ses) { - work = true - mq.nextMessage.AddEntry(e.Cid, e.Priority) - } - } - } - return work -} - -func (mq *MessageQueue) extractOutgoingMessage() bsmsg.BitSwapMessage { - // grab outgoing message - mq.nextMessageLk.Lock() - message := mq.nextMessage - mq.nextMessage = nil - mq.nextMessageLk.Unlock() - return message -} - -func (mq *MessageQueue) sendMessage() { - message := mq.extractOutgoingMessage() - if message == nil || message.Empty() { - return - } - - err := mq.initializeSender() - if err != nil { - log.Infof("cant open message sender to peer %s: %s", mq.p, err) - // TODO: cant connect, what now? - return - } - - for i := 0; i < maxRetries; i++ { // try to send this message until we fail. - if mq.attemptSendAndRecovery(message) { - return - } - } -} - -func (mq *MessageQueue) initializeSender() error { - if mq.sender != nil { - return nil - } - nsender, err := openSender(mq.ctx, mq.network, mq.p) - if err != nil { - return err - } - mq.sender = nsender - return nil -} - -func (mq *MessageQueue) attemptSendAndRecovery(message bsmsg.BitSwapMessage) bool { - err := mq.sender.SendMsg(mq.ctx, message) - if err == nil { - return true - } - - log.Infof("bitswap send error: %s", err) - mq.sender.Reset() - mq.sender = nil - - select { - case <-mq.done: - return true - case <-mq.ctx.Done(): - return true - case <-time.After(time.Millisecond * 100): - // wait 100ms in case disconnect notifications are still propogating - log.Warning("SendMsg errored but neither 'done' nor context.Done() were set") - } - - err = mq.initializeSender() - if err != nil { - log.Infof("couldnt open sender again after SendMsg(%s) failed: %s", mq.p, err) - // TODO(why): what do we do now? - // I think the *right* answer is to probably put the message we're - // trying to send back, and then return to waiting for new work or - // a disconnect. - return true - } - - // TODO: Is this the same instance for the remote peer? - // If its not, we should resend our entire wantlist to them - /* - if mq.sender.InstanceID() != mq.lastSeenInstanceID { - wlm = mq.getFullWantlistMessage() - } - */ - return false -} - -func openSender(ctx context.Context, network MessageNetwork, p peer.ID) (bsnet.MessageSender, error) { - // allow ten minutes for connections this includes looking them up in the - // dht dialing them, and handshaking - conctx, cancel := context.WithTimeout(ctx, time.Minute*10) - defer cancel() - - err := network.ConnectTo(conctx, p) - if err != nil { - return nil, err - } - - nsender, err := network.NewMessageSender(ctx, p) - if err != nil { - return nil, err - } - - return nsender, nil -} diff --git a/vendor/github.com/ipfs/go-bitswap/network/interface.go b/vendor/github.com/ipfs/go-bitswap/network/interface.go deleted file mode 100644 index 783e29e9..00000000 --- a/vendor/github.com/ipfs/go-bitswap/network/interface.go +++ /dev/null @@ -1,87 +0,0 @@ -package network - -import ( - "context" - - bsmsg "github.com/ipfs/go-bitswap/message" - - cid "github.com/ipfs/go-cid" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -var ( - // ProtocolBitswapOne is the prefix for the legacy bitswap protocol - ProtocolBitswapOne protocol.ID = "/ipfs/bitswap/1.0.0" - // ProtocolBitswapNoVers is equivalent to the legacy bitswap protocol - ProtocolBitswapNoVers protocol.ID = "/ipfs/bitswap" - - // ProtocolBitswap is the current version of bitswap protocol, 1.1.0 - ProtocolBitswap protocol.ID = "/ipfs/bitswap/1.1.0" -) - -// BitSwapNetwork provides network connectivity for BitSwap sessions. -type BitSwapNetwork interface { - - // SendMessage sends a BitSwap message to a peer. - SendMessage( - context.Context, - peer.ID, - bsmsg.BitSwapMessage) error - - // SetDelegate registers the Reciver to handle messages received from the - // network. - SetDelegate(Receiver) - - ConnectTo(context.Context, peer.ID) error - - NewMessageSender(context.Context, peer.ID) (MessageSender, error) - - ConnectionManager() connmgr.ConnManager - - Stats() Stats - - Routing -} - -// MessageSender is an interface for sending a series of messages over the bitswap -// network -type MessageSender interface { - SendMsg(context.Context, bsmsg.BitSwapMessage) error - Close() error - Reset() error -} - -// Receiver is an interface that can receive messages from the BitSwapNetwork. -type Receiver interface { - ReceiveMessage( - ctx context.Context, - sender peer.ID, - incoming bsmsg.BitSwapMessage) - - ReceiveError(error) - - // Connected/Disconnected warns bitswap about peer connections. - PeerConnected(peer.ID) - PeerDisconnected(peer.ID) -} - -// Routing is an interface to providing and finding providers on a bitswap -// network. -type Routing interface { - // FindProvidersAsync returns a channel of providers for the given key. - FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.ID - - // Provide provides the key to the network. - Provide(context.Context, cid.Cid) error -} - -// Stats is a container for statistics about the bitswap network -// the numbers inside are specific to bitswap, and not any other protocols -// using the same underlying network. -type Stats struct { - MessagesSent uint64 - MessagesRecvd uint64 -} diff --git a/vendor/github.com/ipfs/go-bitswap/network/ipfs_impl.go b/vendor/github.com/ipfs/go-bitswap/network/ipfs_impl.go deleted file mode 100644 index 2cfbbcbf..00000000 --- a/vendor/github.com/ipfs/go-bitswap/network/ipfs_impl.go +++ /dev/null @@ -1,229 +0,0 @@ -package network - -import ( - "context" - "fmt" - "io" - "sync/atomic" - "time" - - bsmsg "github.com/ipfs/go-bitswap/message" - "github.com/libp2p/go-libp2p-core/helpers" - - ggio "github.com/gogo/protobuf/io" - cid "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - peerstore "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/routing" - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("bitswap_network") - -var sendMessageTimeout = time.Minute * 10 - -// NewFromIpfsHost returns a BitSwapNetwork supported by underlying IPFS host. -func NewFromIpfsHost(host host.Host, r routing.ContentRouting) BitSwapNetwork { - bitswapNetwork := impl{ - host: host, - routing: r, - } - return &bitswapNetwork -} - -// impl transforms the ipfs network interface, which sends and receives -// NetMessage objects, into the bitswap network interface. -type impl struct { - host host.Host - routing routing.ContentRouting - - // inbound messages from the network are forwarded to the receiver - receiver Receiver - - stats Stats -} - -type streamMessageSender struct { - s network.Stream -} - -func (s *streamMessageSender) Close() error { - return helpers.FullClose(s.s) -} - -func (s *streamMessageSender) Reset() error { - return s.s.Reset() -} - -func (s *streamMessageSender) SendMsg(ctx context.Context, msg bsmsg.BitSwapMessage) error { - return msgToStream(ctx, s.s, msg) -} - -func msgToStream(ctx context.Context, s network.Stream, msg bsmsg.BitSwapMessage) error { - deadline := time.Now().Add(sendMessageTimeout) - if dl, ok := ctx.Deadline(); ok { - deadline = dl - } - - if err := s.SetWriteDeadline(deadline); err != nil { - log.Warningf("error setting deadline: %s", err) - } - - switch s.Protocol() { - case ProtocolBitswap: - if err := msg.ToNetV1(s); err != nil { - log.Debugf("error: %s", err) - return err - } - case ProtocolBitswapOne, ProtocolBitswapNoVers: - if err := msg.ToNetV0(s); err != nil { - log.Debugf("error: %s", err) - return err - } - default: - return fmt.Errorf("unrecognized protocol on remote: %s", s.Protocol()) - } - - if err := s.SetWriteDeadline(time.Time{}); err != nil { - log.Warningf("error resetting deadline: %s", err) - } - return nil -} - -func (bsnet *impl) NewMessageSender(ctx context.Context, p peer.ID) (MessageSender, error) { - s, err := bsnet.newStreamToPeer(ctx, p) - if err != nil { - return nil, err - } - - return &streamMessageSender{s: s}, nil -} - -func (bsnet *impl) newStreamToPeer(ctx context.Context, p peer.ID) (network.Stream, error) { - return bsnet.host.NewStream(ctx, p, ProtocolBitswap, ProtocolBitswapOne, ProtocolBitswapNoVers) -} - -func (bsnet *impl) SendMessage( - ctx context.Context, - p peer.ID, - outgoing bsmsg.BitSwapMessage) error { - - s, err := bsnet.newStreamToPeer(ctx, p) - if err != nil { - return err - } - - if err = msgToStream(ctx, s, outgoing); err != nil { - s.Reset() - return err - } - atomic.AddUint64(&bsnet.stats.MessagesSent, 1) - - // TODO(https://github.com/libp2p/go-libp2p-net/issues/28): Avoid this goroutine. - go helpers.AwaitEOF(s) - return s.Close() - -} - -func (bsnet *impl) SetDelegate(r Receiver) { - bsnet.receiver = r - bsnet.host.SetStreamHandler(ProtocolBitswap, bsnet.handleNewStream) - bsnet.host.SetStreamHandler(ProtocolBitswapOne, bsnet.handleNewStream) - bsnet.host.SetStreamHandler(ProtocolBitswapNoVers, bsnet.handleNewStream) - bsnet.host.Network().Notify((*netNotifiee)(bsnet)) - // TODO: StopNotify. - -} - -func (bsnet *impl) ConnectTo(ctx context.Context, p peer.ID) error { - return bsnet.host.Connect(ctx, peer.AddrInfo{ID: p}) -} - -// FindProvidersAsync returns a channel of providers for the given key. -func (bsnet *impl) FindProvidersAsync(ctx context.Context, k cid.Cid, max int) <-chan peer.ID { - out := make(chan peer.ID, max) - go func() { - defer close(out) - providers := bsnet.routing.FindProvidersAsync(ctx, k, max) - for info := range providers { - if info.ID == bsnet.host.ID() { - continue // ignore self as provider - } - bsnet.host.Peerstore().AddAddrs(info.ID, info.Addrs, peerstore.TempAddrTTL) - select { - case <-ctx.Done(): - return - case out <- info.ID: - } - } - }() - return out -} - -// Provide provides the key to the network -func (bsnet *impl) Provide(ctx context.Context, k cid.Cid) error { - return bsnet.routing.Provide(ctx, k, true) -} - -// handleNewStream receives a new stream from the network. -func (bsnet *impl) handleNewStream(s network.Stream) { - defer s.Close() - - if bsnet.receiver == nil { - s.Reset() - return - } - - reader := ggio.NewDelimitedReader(s, network.MessageSizeMax) - for { - received, err := bsmsg.FromPBReader(reader) - if err != nil { - if err != io.EOF { - s.Reset() - go bsnet.receiver.ReceiveError(err) - log.Debugf("bitswap net handleNewStream from %s error: %s", s.Conn().RemotePeer(), err) - } - return - } - - p := s.Conn().RemotePeer() - ctx := context.Background() - log.Debugf("bitswap net handleNewStream from %s", s.Conn().RemotePeer()) - bsnet.receiver.ReceiveMessage(ctx, p, received) - atomic.AddUint64(&bsnet.stats.MessagesRecvd, 1) - } -} - -func (bsnet *impl) ConnectionManager() connmgr.ConnManager { - return bsnet.host.ConnManager() -} - -func (bsnet *impl) Stats() Stats { - return Stats{ - MessagesRecvd: atomic.LoadUint64(&bsnet.stats.MessagesRecvd), - MessagesSent: atomic.LoadUint64(&bsnet.stats.MessagesSent), - } -} - -type netNotifiee impl - -func (nn *netNotifiee) impl() *impl { - return (*impl)(nn) -} - -func (nn *netNotifiee) Connected(n network.Network, v network.Conn) { - nn.impl().receiver.PeerConnected(v.RemotePeer()) -} - -func (nn *netNotifiee) Disconnected(n network.Network, v network.Conn) { - nn.impl().receiver.PeerDisconnected(v.RemotePeer()) -} - -func (nn *netNotifiee) OpenedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) ClosedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) Listen(n network.Network, a ma.Multiaddr) {} -func (nn *netNotifiee) ListenClose(n network.Network, a ma.Multiaddr) {} diff --git a/vendor/github.com/ipfs/go-bitswap/notifications/notifications.go b/vendor/github.com/ipfs/go-bitswap/notifications/notifications.go deleted file mode 100644 index 0934fa5f..00000000 --- a/vendor/github.com/ipfs/go-bitswap/notifications/notifications.go +++ /dev/null @@ -1,135 +0,0 @@ -package notifications - -import ( - "context" - "sync" - - pubsub "github.com/cskr/pubsub" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" -) - -const bufferSize = 16 - -// PubSub is a simple interface for publishing blocks and being able to subscribe -// for cids. It's used internally by bitswap to decouple receiving blocks -// and actually providing them back to the GetBlocks caller. -type PubSub interface { - Publish(block blocks.Block) - Subscribe(ctx context.Context, keys ...cid.Cid) <-chan blocks.Block - Shutdown() -} - -// New generates a new PubSub interface. -func New() PubSub { - return &impl{ - wrapped: *pubsub.New(bufferSize), - closed: make(chan struct{}), - } -} - -type impl struct { - lk sync.RWMutex - wrapped pubsub.PubSub - - closed chan struct{} -} - -func (ps *impl) Publish(block blocks.Block) { - ps.lk.RLock() - defer ps.lk.RUnlock() - select { - case <-ps.closed: - return - default: - } - - ps.wrapped.Pub(block, block.Cid().KeyString()) -} - -func (ps *impl) Shutdown() { - ps.lk.Lock() - defer ps.lk.Unlock() - select { - case <-ps.closed: - return - default: - } - close(ps.closed) - ps.wrapped.Shutdown() -} - -// Subscribe returns a channel of blocks for the given |keys|. |blockChannel| -// is closed if the |ctx| times out or is cancelled, or after sending len(keys) -// blocks. -func (ps *impl) Subscribe(ctx context.Context, keys ...cid.Cid) <-chan blocks.Block { - - blocksCh := make(chan blocks.Block, len(keys)) - valuesCh := make(chan interface{}, len(keys)) // provide our own channel to control buffer, prevent blocking - if len(keys) == 0 { - close(blocksCh) - return blocksCh - } - - // prevent shutdown - ps.lk.RLock() - defer ps.lk.RUnlock() - - select { - case <-ps.closed: - close(blocksCh) - return blocksCh - default: - } - - ps.wrapped.AddSubOnceEach(valuesCh, toStrings(keys)...) - go func() { - defer func() { - close(blocksCh) - - ps.lk.RLock() - defer ps.lk.RUnlock() - // Don't touch the pubsub instance if we're - // already closed. - select { - case <-ps.closed: - return - default: - } - - ps.wrapped.Unsub(valuesCh) - }() - - for { - select { - case <-ctx.Done(): - return - case <-ps.closed: - case val, ok := <-valuesCh: - if !ok { - return - } - block, ok := val.(blocks.Block) - if !ok { - return - } - select { - case <-ctx.Done(): - return - case blocksCh <- block: // continue - case <-ps.closed: - } - } - } - }() - - return blocksCh -} - -func toStrings(keys []cid.Cid) []string { - strs := make([]string, 0, len(keys)) - for _, key := range keys { - strs = append(strs, key.KeyString()) - } - return strs -} diff --git a/vendor/github.com/ipfs/go-bitswap/peermanager/peermanager.go b/vendor/github.com/ipfs/go-bitswap/peermanager/peermanager.go deleted file mode 100644 index 3aefbbe6..00000000 --- a/vendor/github.com/ipfs/go-bitswap/peermanager/peermanager.go +++ /dev/null @@ -1,108 +0,0 @@ -package peermanager - -import ( - "context" - - bsmsg "github.com/ipfs/go-bitswap/message" - wantlist "github.com/ipfs/go-bitswap/wantlist" - - peer "github.com/libp2p/go-libp2p-core/peer" -) - -// PeerQueue provides a queer of messages to be sent for a single peer. -type PeerQueue interface { - AddMessage(entries []bsmsg.Entry, ses uint64) - Startup() - AddWantlist(initialWants *wantlist.SessionTrackedWantlist) - Shutdown() -} - -// PeerQueueFactory provides a function that will create a PeerQueue. -type PeerQueueFactory func(ctx context.Context, p peer.ID) PeerQueue - -type peerQueueInstance struct { - refcnt int - pq PeerQueue -} - -// PeerManager manages a pool of peers and sends messages to peers in the pool. -type PeerManager struct { - // peerQueues -- interact through internal utility functions get/set/remove/iterate - peerQueues map[peer.ID]*peerQueueInstance - - createPeerQueue PeerQueueFactory - ctx context.Context -} - -// New creates a new PeerManager, given a context and a peerQueueFactory. -func New(ctx context.Context, createPeerQueue PeerQueueFactory) *PeerManager { - return &PeerManager{ - peerQueues: make(map[peer.ID]*peerQueueInstance), - createPeerQueue: createPeerQueue, - ctx: ctx, - } -} - -// ConnectedPeers returns a list of peers this PeerManager is managing. -func (pm *PeerManager) ConnectedPeers() []peer.ID { - peers := make([]peer.ID, 0, len(pm.peerQueues)) - for p := range pm.peerQueues { - peers = append(peers, p) - } - return peers -} - -// Connected is called to add a new peer to the pool, and send it an initial set -// of wants. -func (pm *PeerManager) Connected(p peer.ID, initialWants *wantlist.SessionTrackedWantlist) { - pq := pm.getOrCreate(p) - - if pq.refcnt == 0 { - pq.pq.AddWantlist(initialWants) - } - - pq.refcnt++ -} - -// Disconnected is called to remove a peer from the pool. -func (pm *PeerManager) Disconnected(p peer.ID) { - pq, ok := pm.peerQueues[p] - - if !ok { - return - } - - pq.refcnt-- - if pq.refcnt > 0 { - return - } - - delete(pm.peerQueues, p) - pq.pq.Shutdown() -} - -// SendMessage is called to send a message to all or some peers in the pool; -// if targets is nil, it sends to all. -func (pm *PeerManager) SendMessage(entries []bsmsg.Entry, targets []peer.ID, from uint64) { - if len(targets) == 0 { - for _, p := range pm.peerQueues { - p.pq.AddMessage(entries, from) - } - } else { - for _, t := range targets { - pqi := pm.getOrCreate(t) - pqi.pq.AddMessage(entries, from) - } - } -} - -func (pm *PeerManager) getOrCreate(p peer.ID) *peerQueueInstance { - pqi, ok := pm.peerQueues[p] - if !ok { - pq := pm.createPeerQueue(pm.ctx, p) - pq.Startup() - pqi = &peerQueueInstance{0, pq} - pm.peerQueues[p] = pqi - } - return pqi -} diff --git a/vendor/github.com/ipfs/go-bitswap/providerquerymanager/providerquerymanager.go b/vendor/github.com/ipfs/go-bitswap/providerquerymanager/providerquerymanager.go deleted file mode 100644 index e1f77edf..00000000 --- a/vendor/github.com/ipfs/go-bitswap/providerquerymanager/providerquerymanager.go +++ /dev/null @@ -1,423 +0,0 @@ -package providerquerymanager - -import ( - "context" - "fmt" - "sync" - "time" - - "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -var log = logging.Logger("bitswap") - -const ( - maxProviders = 10 - maxInProcessRequests = 6 - defaultTimeout = 10 * time.Second -) - -type inProgressRequestStatus struct { - ctx context.Context - cancelFn func() - providersSoFar []peer.ID - listeners map[chan peer.ID]struct{} -} - -type findProviderRequest struct { - k cid.Cid - ctx context.Context -} - -// ProviderQueryNetwork is an interface for finding providers and connecting to -// peers. -type ProviderQueryNetwork interface { - ConnectTo(context.Context, peer.ID) error - FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.ID -} - -type providerQueryMessage interface { - debugMessage() string - handle(pqm *ProviderQueryManager) -} - -type receivedProviderMessage struct { - k cid.Cid - p peer.ID -} - -type finishedProviderQueryMessage struct { - k cid.Cid -} - -type newProvideQueryMessage struct { - k cid.Cid - inProgressRequestChan chan<- inProgressRequest -} - -type cancelRequestMessage struct { - incomingProviders chan peer.ID - k cid.Cid -} - -// ProviderQueryManager manages requests to find more providers for blocks -// for bitswap sessions. It's main goals are to: -// - rate limit requests -- don't have too many find provider calls running -// simultaneously -// - connect to found peers and filter them if it can't connect -// - ensure two findprovider calls for the same block don't run concurrently -// - manage timeouts -type ProviderQueryManager struct { - ctx context.Context - network ProviderQueryNetwork - providerQueryMessages chan providerQueryMessage - providerRequestsProcessing chan *findProviderRequest - incomingFindProviderRequests chan *findProviderRequest - - findProviderTimeout time.Duration - timeoutMutex sync.RWMutex - - // do not touch outside the run loop - inProgressRequestStatuses map[cid.Cid]*inProgressRequestStatus -} - -// New initializes a new ProviderQueryManager for a given context and a given -// network provider. -func New(ctx context.Context, network ProviderQueryNetwork) *ProviderQueryManager { - return &ProviderQueryManager{ - ctx: ctx, - network: network, - providerQueryMessages: make(chan providerQueryMessage, 16), - providerRequestsProcessing: make(chan *findProviderRequest), - incomingFindProviderRequests: make(chan *findProviderRequest), - inProgressRequestStatuses: make(map[cid.Cid]*inProgressRequestStatus), - findProviderTimeout: defaultTimeout, - } -} - -// Startup starts processing for the ProviderQueryManager. -func (pqm *ProviderQueryManager) Startup() { - go pqm.run() -} - -type inProgressRequest struct { - providersSoFar []peer.ID - incoming chan peer.ID -} - -// SetFindProviderTimeout changes the timeout for finding providers -func (pqm *ProviderQueryManager) SetFindProviderTimeout(findProviderTimeout time.Duration) { - pqm.timeoutMutex.Lock() - pqm.findProviderTimeout = findProviderTimeout - pqm.timeoutMutex.Unlock() -} - -// FindProvidersAsync finds providers for the given block. -func (pqm *ProviderQueryManager) FindProvidersAsync(sessionCtx context.Context, k cid.Cid) <-chan peer.ID { - inProgressRequestChan := make(chan inProgressRequest) - - select { - case pqm.providerQueryMessages <- &newProvideQueryMessage{ - k: k, - inProgressRequestChan: inProgressRequestChan, - }: - case <-pqm.ctx.Done(): - ch := make(chan peer.ID) - close(ch) - return ch - case <-sessionCtx.Done(): - ch := make(chan peer.ID) - close(ch) - return ch - } - - // DO NOT select on sessionCtx. We only want to abort here if we're - // shutting down because we can't actually _cancel_ the request till we - // get to receiveProviders. - var receivedInProgressRequest inProgressRequest - select { - case <-pqm.ctx.Done(): - ch := make(chan peer.ID) - close(ch) - return ch - case receivedInProgressRequest = <-inProgressRequestChan: - } - - return pqm.receiveProviders(sessionCtx, k, receivedInProgressRequest) -} - -func (pqm *ProviderQueryManager) receiveProviders(sessionCtx context.Context, k cid.Cid, receivedInProgressRequest inProgressRequest) <-chan peer.ID { - // maintains an unbuffered queue for incoming providers for given request for a given session - // essentially, as a provider comes in, for a given CID, we want to immediately broadcast to all - // sessions that queried that CID, without worrying about whether the client code is actually - // reading from the returned channel -- so that the broadcast never blocks - // based on: https://medium.com/capital-one-tech/building-an-unbounded-channel-in-go-789e175cd2cd - returnedProviders := make(chan peer.ID) - receivedProviders := append([]peer.ID(nil), receivedInProgressRequest.providersSoFar[0:]...) - incomingProviders := receivedInProgressRequest.incoming - - go func() { - defer close(returnedProviders) - outgoingProviders := func() chan<- peer.ID { - if len(receivedProviders) == 0 { - return nil - } - return returnedProviders - } - nextProvider := func() peer.ID { - if len(receivedProviders) == 0 { - return "" - } - return receivedProviders[0] - } - for len(receivedProviders) > 0 || incomingProviders != nil { - select { - case <-pqm.ctx.Done(): - return - case <-sessionCtx.Done(): - if incomingProviders != nil { - pqm.cancelProviderRequest(k, incomingProviders) - } - return - case provider, ok := <-incomingProviders: - if !ok { - incomingProviders = nil - } else { - receivedProviders = append(receivedProviders, provider) - } - case outgoingProviders() <- nextProvider(): - receivedProviders = receivedProviders[1:] - } - } - }() - return returnedProviders -} - -func (pqm *ProviderQueryManager) cancelProviderRequest(k cid.Cid, incomingProviders chan peer.ID) { - cancelMessageChannel := pqm.providerQueryMessages - for { - select { - case cancelMessageChannel <- &cancelRequestMessage{ - incomingProviders: incomingProviders, - k: k, - }: - cancelMessageChannel = nil - // clear out any remaining providers, in case and "incoming provider" - // messages get processed before our cancel message - case _, ok := <-incomingProviders: - if !ok { - return - } - case <-pqm.ctx.Done(): - return - } - } -} - -func (pqm *ProviderQueryManager) findProviderWorker() { - // findProviderWorker just cycles through incoming provider queries one - // at a time. We have six of these workers running at once - // to let requests go in parallel but keep them rate limited - for { - select { - case fpr, ok := <-pqm.providerRequestsProcessing: - if !ok { - return - } - k := fpr.k - log.Debugf("Beginning Find Provider Request for cid: %s", k.String()) - pqm.timeoutMutex.RLock() - findProviderCtx, cancel := context.WithTimeout(fpr.ctx, pqm.findProviderTimeout) - pqm.timeoutMutex.RUnlock() - providers := pqm.network.FindProvidersAsync(findProviderCtx, k, maxProviders) - wg := &sync.WaitGroup{} - for p := range providers { - wg.Add(1) - go func(p peer.ID) { - defer wg.Done() - err := pqm.network.ConnectTo(findProviderCtx, p) - if err != nil { - log.Debugf("failed to connect to provider %s: %s", p, err) - return - } - select { - case pqm.providerQueryMessages <- &receivedProviderMessage{ - k: k, - p: p, - }: - case <-pqm.ctx.Done(): - return - } - }(p) - } - cancel() - wg.Wait() - select { - case pqm.providerQueryMessages <- &finishedProviderQueryMessage{ - k: k, - }: - case <-pqm.ctx.Done(): - } - case <-pqm.ctx.Done(): - return - } - } -} - -func (pqm *ProviderQueryManager) providerRequestBufferWorker() { - // the provider request buffer worker just maintains an unbounded - // buffer for incoming provider queries and dispatches to the find - // provider workers as they become available - // based on: https://medium.com/capital-one-tech/building-an-unbounded-channel-in-go-789e175cd2cd - var providerQueryRequestBuffer []*findProviderRequest - nextProviderQuery := func() *findProviderRequest { - if len(providerQueryRequestBuffer) == 0 { - return nil - } - return providerQueryRequestBuffer[0] - } - outgoingRequests := func() chan<- *findProviderRequest { - if len(providerQueryRequestBuffer) == 0 { - return nil - } - return pqm.providerRequestsProcessing - } - - for { - select { - case incomingRequest, ok := <-pqm.incomingFindProviderRequests: - if !ok { - return - } - providerQueryRequestBuffer = append(providerQueryRequestBuffer, incomingRequest) - case outgoingRequests() <- nextProviderQuery(): - providerQueryRequestBuffer = providerQueryRequestBuffer[1:] - case <-pqm.ctx.Done(): - return - } - } -} - -func (pqm *ProviderQueryManager) cleanupInProcessRequests() { - for _, requestStatus := range pqm.inProgressRequestStatuses { - for listener := range requestStatus.listeners { - close(listener) - } - requestStatus.cancelFn() - } -} - -func (pqm *ProviderQueryManager) run() { - defer pqm.cleanupInProcessRequests() - - go pqm.providerRequestBufferWorker() - for i := 0; i < maxInProcessRequests; i++ { - go pqm.findProviderWorker() - } - - for { - select { - case nextMessage := <-pqm.providerQueryMessages: - log.Debug(nextMessage.debugMessage()) - nextMessage.handle(pqm) - case <-pqm.ctx.Done(): - return - } - } -} - -func (rpm *receivedProviderMessage) debugMessage() string { - return fmt.Sprintf("Received provider (%s) for cid (%s)", rpm.p.String(), rpm.k.String()) -} - -func (rpm *receivedProviderMessage) handle(pqm *ProviderQueryManager) { - requestStatus, ok := pqm.inProgressRequestStatuses[rpm.k] - if !ok { - log.Errorf("Received provider (%s) for cid (%s) not requested", rpm.p.String(), rpm.k.String()) - return - } - requestStatus.providersSoFar = append(requestStatus.providersSoFar, rpm.p) - for listener := range requestStatus.listeners { - select { - case listener <- rpm.p: - case <-pqm.ctx.Done(): - return - } - } -} - -func (fpqm *finishedProviderQueryMessage) debugMessage() string { - return fmt.Sprintf("Finished Provider Query on cid: %s", fpqm.k.String()) -} - -func (fpqm *finishedProviderQueryMessage) handle(pqm *ProviderQueryManager) { - requestStatus, ok := pqm.inProgressRequestStatuses[fpqm.k] - if !ok { - // we canceled the request as it finished. - return - } - for listener := range requestStatus.listeners { - close(listener) - } - delete(pqm.inProgressRequestStatuses, fpqm.k) - requestStatus.cancelFn() -} - -func (npqm *newProvideQueryMessage) debugMessage() string { - return fmt.Sprintf("New Provider Query on cid: %s", npqm.k.String()) -} - -func (npqm *newProvideQueryMessage) handle(pqm *ProviderQueryManager) { - requestStatus, ok := pqm.inProgressRequestStatuses[npqm.k] - if !ok { - ctx, cancelFn := context.WithCancel(pqm.ctx) - requestStatus = &inProgressRequestStatus{ - listeners: make(map[chan peer.ID]struct{}), - ctx: ctx, - cancelFn: cancelFn, - } - pqm.inProgressRequestStatuses[npqm.k] = requestStatus - select { - case pqm.incomingFindProviderRequests <- &findProviderRequest{ - k: npqm.k, - ctx: ctx, - }: - case <-pqm.ctx.Done(): - return - } - } - inProgressChan := make(chan peer.ID) - requestStatus.listeners[inProgressChan] = struct{}{} - select { - case npqm.inProgressRequestChan <- inProgressRequest{ - providersSoFar: requestStatus.providersSoFar, - incoming: inProgressChan, - }: - case <-pqm.ctx.Done(): - } -} - -func (crm *cancelRequestMessage) debugMessage() string { - return fmt.Sprintf("Cancel provider query on cid: %s", crm.k.String()) -} - -func (crm *cancelRequestMessage) handle(pqm *ProviderQueryManager) { - requestStatus, ok := pqm.inProgressRequestStatuses[crm.k] - if !ok { - // Request finished while queued. - return - } - _, ok = requestStatus.listeners[crm.incomingProviders] - if !ok { - // Request finished and _restarted_ while queued. - return - } - delete(requestStatus.listeners, crm.incomingProviders) - close(crm.incomingProviders) - if len(requestStatus.listeners) == 0 { - delete(pqm.inProgressRequestStatuses, crm.k) - requestStatus.cancelFn() - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/session/cidqueue.go b/vendor/github.com/ipfs/go-bitswap/session/cidqueue.go deleted file mode 100644 index cf461a6c..00000000 --- a/vendor/github.com/ipfs/go-bitswap/session/cidqueue.go +++ /dev/null @@ -1,46 +0,0 @@ -package session - -import cid "github.com/ipfs/go-cid" - -type cidQueue struct { - elems []cid.Cid - eset *cid.Set -} - -func newCidQueue() *cidQueue { - return &cidQueue{eset: cid.NewSet()} -} - -func (cq *cidQueue) Pop() cid.Cid { - for { - if len(cq.elems) == 0 { - return cid.Cid{} - } - - out := cq.elems[0] - cq.elems = cq.elems[1:] - - if cq.eset.Has(out) { - cq.eset.Remove(out) - return out - } - } -} - -func (cq *cidQueue) Push(c cid.Cid) { - if cq.eset.Visit(c) { - cq.elems = append(cq.elems, c) - } -} - -func (cq *cidQueue) Remove(c cid.Cid) { - cq.eset.Remove(c) -} - -func (cq *cidQueue) Has(c cid.Cid) bool { - return cq.eset.Has(c) -} - -func (cq *cidQueue) Len() int { - return cq.eset.Len() -} diff --git a/vendor/github.com/ipfs/go-bitswap/session/session.go b/vendor/github.com/ipfs/go-bitswap/session/session.go deleted file mode 100644 index 0757ab11..00000000 --- a/vendor/github.com/ipfs/go-bitswap/session/session.go +++ /dev/null @@ -1,467 +0,0 @@ -package session - -import ( - "context" - "math/rand" - "time" - - lru "github.com/hashicorp/golang-lru" - bsgetter "github.com/ipfs/go-bitswap/getter" - notifications "github.com/ipfs/go-bitswap/notifications" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - delay "github.com/ipfs/go-ipfs-delay" - logging "github.com/ipfs/go-log" - peer "github.com/libp2p/go-libp2p-core/peer" - loggables "github.com/libp2p/go-libp2p-loggables" - - bssrs "github.com/ipfs/go-bitswap/sessionrequestsplitter" -) - -const ( - broadcastLiveWantsLimit = 4 - targetedLiveWantsLimit = 32 -) - -// WantManager is an interface that can be used to request blocks -// from given peers. -type WantManager interface { - WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64) - CancelWants(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64) -} - -// PeerManager provides an interface for tracking and optimize peers, and -// requesting more when neccesary. -type PeerManager interface { - FindMorePeers(context.Context, cid.Cid) - GetOptimizedPeers() []peer.ID - RecordPeerRequests([]peer.ID, []cid.Cid) - RecordPeerResponse(peer.ID, cid.Cid) -} - -// RequestSplitter provides an interface for splitting -// a request for Cids up among peers. -type RequestSplitter interface { - SplitRequest([]peer.ID, []cid.Cid) []*bssrs.PartialRequest - RecordDuplicateBlock() - RecordUniqueBlock() -} - -type interestReq struct { - c cid.Cid - resp chan bool -} - -type blkRecv struct { - from peer.ID - blk blocks.Block - counterMessage bool -} - -// Session holds state for an individual bitswap transfer operation. -// This allows bitswap to make smarter decisions about who to send wantlist -// info to, and who to request blocks from. -type Session struct { - // dependencies - ctx context.Context - wm WantManager - pm PeerManager - srs RequestSplitter - - // channels - incoming chan blkRecv - newReqs chan []cid.Cid - cancelKeys chan []cid.Cid - interestReqs chan interestReq - latencyReqs chan chan time.Duration - tickDelayReqs chan time.Duration - - // do not touch outside run loop - tofetch *cidQueue - interest *lru.Cache - pastWants *cidQueue - liveWants map[cid.Cid]time.Time - idleTick *time.Timer - periodicSearchTimer *time.Timer - baseTickDelay time.Duration - latTotal time.Duration - fetchcnt int - consecutiveTicks int - initialSearchDelay time.Duration - periodicSearchDelay delay.D - // identifiers - notif notifications.PubSub - uuid logging.Loggable - id uint64 -} - -// New creates a new bitswap session whose lifetime is bounded by the -// given context. -func New(ctx context.Context, - id uint64, - wm WantManager, - pm PeerManager, - srs RequestSplitter, - initialSearchDelay time.Duration, - periodicSearchDelay delay.D) *Session { - s := &Session{ - liveWants: make(map[cid.Cid]time.Time), - newReqs: make(chan []cid.Cid), - cancelKeys: make(chan []cid.Cid), - tofetch: newCidQueue(), - pastWants: newCidQueue(), - interestReqs: make(chan interestReq), - latencyReqs: make(chan chan time.Duration), - tickDelayReqs: make(chan time.Duration), - ctx: ctx, - wm: wm, - pm: pm, - srs: srs, - incoming: make(chan blkRecv), - notif: notifications.New(), - uuid: loggables.Uuid("GetBlockRequest"), - baseTickDelay: time.Millisecond * 500, - id: id, - initialSearchDelay: initialSearchDelay, - periodicSearchDelay: periodicSearchDelay, - } - - cache, _ := lru.New(2048) - s.interest = cache - - go s.run(ctx) - - return s -} - -// ReceiveBlockFrom receives an incoming block from the given peer. -func (s *Session) ReceiveBlockFrom(from peer.ID, blk blocks.Block) { - select { - case s.incoming <- blkRecv{from: from, blk: blk, counterMessage: false}: - case <-s.ctx.Done(): - } - ks := []cid.Cid{blk.Cid()} - s.wm.CancelWants(s.ctx, ks, nil, s.id) - -} - -// UpdateReceiveCounters updates receive counters for a block, -// which may be a duplicate and adjusts the split factor based on that. -func (s *Session) UpdateReceiveCounters(blk blocks.Block) { - select { - case s.incoming <- blkRecv{from: "", blk: blk, counterMessage: true}: - case <-s.ctx.Done(): - } -} - -// InterestedIn returns true if this session is interested in the given Cid. -func (s *Session) InterestedIn(c cid.Cid) bool { - if s.interest.Contains(c) { - return true - } - // TODO: PERF: this is using a channel to guard a map access against race - // conditions. This is definitely much slower than a mutex, though its unclear - // if it will actually induce any noticeable slowness. This is implemented this - // way to avoid adding a more complex set of mutexes around the liveWants map. - // note that in the average case (where this session *is* interested in the - // block we received) this function will not be called, as the cid will likely - // still be in the interest cache. - resp := make(chan bool, 1) - select { - case s.interestReqs <- interestReq{ - c: c, - resp: resp, - }: - case <-s.ctx.Done(): - return false - } - - select { - case want := <-resp: - return want - case <-s.ctx.Done(): - return false - } -} - -// GetBlock fetches a single block. -func (s *Session) GetBlock(parent context.Context, k cid.Cid) (blocks.Block, error) { - return bsgetter.SyncGetBlock(parent, k, s.GetBlocks) -} - -// GetBlocks fetches a set of blocks within the context of this session and -// returns a channel that found blocks will be returned on. No order is -// guaranteed on the returned blocks. -func (s *Session) GetBlocks(ctx context.Context, keys []cid.Cid) (<-chan blocks.Block, error) { - ctx = logging.ContextWithLoggable(ctx, s.uuid) - return bsgetter.AsyncGetBlocks(ctx, keys, s.notif, - func(ctx context.Context, keys []cid.Cid) { - select { - case s.newReqs <- keys: - case <-ctx.Done(): - case <-s.ctx.Done(): - } - }, - func(keys []cid.Cid) { - select { - case s.cancelKeys <- keys: - case <-s.ctx.Done(): - } - }, - ) -} - -// GetAverageLatency returns the average latency for block requests. -func (s *Session) GetAverageLatency() time.Duration { - resp := make(chan time.Duration) - select { - case s.latencyReqs <- resp: - case <-s.ctx.Done(): - return -1 * time.Millisecond - } - - select { - case latency := <-resp: - return latency - case <-s.ctx.Done(): - return -1 * time.Millisecond - } -} - -// SetBaseTickDelay changes the rate at which ticks happen. -func (s *Session) SetBaseTickDelay(baseTickDelay time.Duration) { - select { - case s.tickDelayReqs <- baseTickDelay: - case <-s.ctx.Done(): - } -} - -// Session run loop -- everything function below here should not be called -// of this loop -func (s *Session) run(ctx context.Context) { - s.idleTick = time.NewTimer(s.initialSearchDelay) - s.periodicSearchTimer = time.NewTimer(s.periodicSearchDelay.NextWaitTime()) - for { - select { - case blk := <-s.incoming: - if blk.counterMessage { - s.updateReceiveCounters(ctx, blk) - } else { - s.handleIncomingBlock(ctx, blk) - } - case keys := <-s.newReqs: - s.handleNewRequest(ctx, keys) - case keys := <-s.cancelKeys: - s.handleCancel(keys) - case <-s.idleTick.C: - s.handleIdleTick(ctx) - case <-s.periodicSearchTimer.C: - s.handlePeriodicSearch(ctx) - case lwchk := <-s.interestReqs: - lwchk.resp <- s.cidIsWanted(lwchk.c) - case resp := <-s.latencyReqs: - resp <- s.averageLatency() - case baseTickDelay := <-s.tickDelayReqs: - s.baseTickDelay = baseTickDelay - case <-ctx.Done(): - s.handleShutdown() - return - } - } -} - -func (s *Session) handleIncomingBlock(ctx context.Context, blk blkRecv) { - s.idleTick.Stop() - - if blk.from != "" { - s.pm.RecordPeerResponse(blk.from, blk.blk.Cid()) - } - - s.receiveBlock(ctx, blk.blk) - - s.resetIdleTick() -} - -func (s *Session) handleNewRequest(ctx context.Context, keys []cid.Cid) { - for _, k := range keys { - s.interest.Add(k, nil) - } - if toadd := s.wantBudget(); toadd > 0 { - if toadd > len(keys) { - toadd = len(keys) - } - - now := keys[:toadd] - keys = keys[toadd:] - - s.wantBlocks(ctx, now) - } - for _, k := range keys { - s.tofetch.Push(k) - } -} - -func (s *Session) handleCancel(keys []cid.Cid) { - for _, c := range keys { - s.tofetch.Remove(c) - } -} - -func (s *Session) handleIdleTick(ctx context.Context) { - - live := make([]cid.Cid, 0, len(s.liveWants)) - now := time.Now() - for c := range s.liveWants { - live = append(live, c) - s.liveWants[c] = now - } - - // Broadcast these keys to everyone we're connected to - s.pm.RecordPeerRequests(nil, live) - s.wm.WantBlocks(ctx, live, nil, s.id) - - // do no find providers on consecutive ticks - // -- just rely on periodic search widening - if len(live) > 0 && (s.consecutiveTicks == 0) { - s.pm.FindMorePeers(ctx, live[0]) - } - s.resetIdleTick() - - if len(s.liveWants) > 0 { - s.consecutiveTicks++ - } -} - -func (s *Session) handlePeriodicSearch(ctx context.Context) { - randomWant := s.randomLiveWant() - if !randomWant.Defined() { - return - } - - // TODO: come up with a better strategy for determining when to search - // for new providers for blocks. - s.pm.FindMorePeers(ctx, randomWant) - s.wm.WantBlocks(ctx, []cid.Cid{randomWant}, nil, s.id) - - s.periodicSearchTimer.Reset(s.periodicSearchDelay.NextWaitTime()) -} - -func (s *Session) randomLiveWant() cid.Cid { - if len(s.liveWants) == 0 { - return cid.Cid{} - } - i := rand.Intn(len(s.liveWants)) - // picking a random live want - for k := range s.liveWants { - if i == 0 { - return k - } - i-- - } - return cid.Cid{} -} -func (s *Session) handleShutdown() { - s.idleTick.Stop() - s.notif.Shutdown() - - live := make([]cid.Cid, 0, len(s.liveWants)) - for c := range s.liveWants { - live = append(live, c) - } - s.wm.CancelWants(s.ctx, live, nil, s.id) -} - -func (s *Session) cidIsWanted(c cid.Cid) bool { - _, ok := s.liveWants[c] - if !ok { - ok = s.tofetch.Has(c) - } - return ok -} - -func (s *Session) receiveBlock(ctx context.Context, blk blocks.Block) { - c := blk.Cid() - if s.cidIsWanted(c) { - s.srs.RecordUniqueBlock() - tval, ok := s.liveWants[c] - if ok { - s.latTotal += time.Since(tval) - delete(s.liveWants, c) - } else { - s.tofetch.Remove(c) - } - s.fetchcnt++ - // we've received new wanted blocks, so future ticks are not consecutive - s.consecutiveTicks = 0 - s.notif.Publish(blk) - - toAdd := s.wantBudget() - if toAdd > s.tofetch.Len() { - toAdd = s.tofetch.Len() - } - if toAdd > 0 { - var keys []cid.Cid - for i := 0; i < toAdd; i++ { - keys = append(keys, s.tofetch.Pop()) - } - s.wantBlocks(ctx, keys) - } - - s.pastWants.Push(c) - } -} - -func (s *Session) updateReceiveCounters(ctx context.Context, blk blkRecv) { - ks := blk.blk.Cid() - if s.pastWants.Has(ks) { - s.srs.RecordDuplicateBlock() - } -} - -func (s *Session) wantBlocks(ctx context.Context, ks []cid.Cid) { - now := time.Now() - for _, c := range ks { - s.liveWants[c] = now - } - peers := s.pm.GetOptimizedPeers() - if len(peers) > 0 { - splitRequests := s.srs.SplitRequest(peers, ks) - for _, splitRequest := range splitRequests { - s.pm.RecordPeerRequests(splitRequest.Peers, splitRequest.Keys) - s.wm.WantBlocks(ctx, splitRequest.Keys, splitRequest.Peers, s.id) - } - } else { - s.pm.RecordPeerRequests(nil, ks) - s.wm.WantBlocks(ctx, ks, nil, s.id) - } -} - -func (s *Session) averageLatency() time.Duration { - return s.latTotal / time.Duration(s.fetchcnt) -} - -func (s *Session) resetIdleTick() { - var tickDelay time.Duration - if s.latTotal == 0 { - tickDelay = s.initialSearchDelay - } else { - avLat := s.averageLatency() - tickDelay = s.baseTickDelay + (3 * avLat) - } - tickDelay = tickDelay * time.Duration(1+s.consecutiveTicks) - s.idleTick.Reset(tickDelay) -} - -func (s *Session) wantBudget() int { - live := len(s.liveWants) - var budget int - if len(s.pm.GetOptimizedPeers()) > 0 { - budget = targetedLiveWantsLimit - live - } else { - budget = broadcastLiveWantsLimit - live - } - if budget < 0 { - budget = 0 - } - return budget -} diff --git a/vendor/github.com/ipfs/go-bitswap/sessionmanager/sessionmanager.go b/vendor/github.com/ipfs/go-bitswap/sessionmanager/sessionmanager.go deleted file mode 100644 index a2617073..00000000 --- a/vendor/github.com/ipfs/go-bitswap/sessionmanager/sessionmanager.go +++ /dev/null @@ -1,138 +0,0 @@ -package sessionmanager - -import ( - "context" - "sync" - "time" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - delay "github.com/ipfs/go-ipfs-delay" - - bssession "github.com/ipfs/go-bitswap/session" - exchange "github.com/ipfs/go-ipfs-exchange-interface" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -// Session is a session that is managed by the session manager -type Session interface { - exchange.Fetcher - InterestedIn(cid.Cid) bool - ReceiveBlockFrom(peer.ID, blocks.Block) - UpdateReceiveCounters(blocks.Block) -} - -type sesTrk struct { - session Session - pm bssession.PeerManager - srs bssession.RequestSplitter -} - -// SessionFactory generates a new session for the SessionManager to track. -type SessionFactory func(ctx context.Context, id uint64, pm bssession.PeerManager, srs bssession.RequestSplitter, provSearchDelay time.Duration, rebroadcastDelay delay.D) Session - -// RequestSplitterFactory generates a new request splitter for a session. -type RequestSplitterFactory func(ctx context.Context) bssession.RequestSplitter - -// PeerManagerFactory generates a new peer manager for a session. -type PeerManagerFactory func(ctx context.Context, id uint64) bssession.PeerManager - -// SessionManager is responsible for creating, managing, and dispatching to -// sessions. -type SessionManager struct { - ctx context.Context - sessionFactory SessionFactory - peerManagerFactory PeerManagerFactory - requestSplitterFactory RequestSplitterFactory - - // Sessions - sessLk sync.Mutex - sessions []sesTrk - - // Session Index - sessIDLk sync.Mutex - sessID uint64 -} - -// New creates a new SessionManager. -func New(ctx context.Context, sessionFactory SessionFactory, peerManagerFactory PeerManagerFactory, requestSplitterFactory RequestSplitterFactory) *SessionManager { - return &SessionManager{ - ctx: ctx, - sessionFactory: sessionFactory, - peerManagerFactory: peerManagerFactory, - requestSplitterFactory: requestSplitterFactory, - } -} - -// NewSession initializes a session with the given context, and adds to the -// session manager. -func (sm *SessionManager) NewSession(ctx context.Context, - provSearchDelay time.Duration, - rebroadcastDelay delay.D) exchange.Fetcher { - id := sm.GetNextSessionID() - sessionctx, cancel := context.WithCancel(ctx) - - pm := sm.peerManagerFactory(sessionctx, id) - srs := sm.requestSplitterFactory(sessionctx) - session := sm.sessionFactory(sessionctx, id, pm, srs, provSearchDelay, rebroadcastDelay) - tracked := sesTrk{session, pm, srs} - sm.sessLk.Lock() - sm.sessions = append(sm.sessions, tracked) - sm.sessLk.Unlock() - go func() { - defer cancel() - select { - case <-sm.ctx.Done(): - sm.removeSession(tracked) - case <-ctx.Done(): - sm.removeSession(tracked) - } - }() - - return session -} - -func (sm *SessionManager) removeSession(session sesTrk) { - sm.sessLk.Lock() - defer sm.sessLk.Unlock() - for i := 0; i < len(sm.sessions); i++ { - if sm.sessions[i] == session { - sm.sessions[i] = sm.sessions[len(sm.sessions)-1] - sm.sessions = sm.sessions[:len(sm.sessions)-1] - return - } - } -} - -// GetNextSessionID returns the next sequentional identifier for a session. -func (sm *SessionManager) GetNextSessionID() uint64 { - sm.sessIDLk.Lock() - defer sm.sessIDLk.Unlock() - sm.sessID++ - return sm.sessID -} - -// ReceiveBlockFrom receives a block from a peer and dispatches to interested -// sessions. -func (sm *SessionManager) ReceiveBlockFrom(from peer.ID, blk blocks.Block) { - sm.sessLk.Lock() - defer sm.sessLk.Unlock() - - k := blk.Cid() - for _, s := range sm.sessions { - if s.session.InterestedIn(k) { - s.session.ReceiveBlockFrom(from, blk) - } - } -} - -// UpdateReceiveCounters records the fact that a block was received, allowing -// sessions to track duplicates -func (sm *SessionManager) UpdateReceiveCounters(blk blocks.Block) { - sm.sessLk.Lock() - defer sm.sessLk.Unlock() - - for _, s := range sm.sessions { - s.session.UpdateReceiveCounters(blk) - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/sessionpeermanager/sessionpeermanager.go b/vendor/github.com/ipfs/go-bitswap/sessionpeermanager/sessionpeermanager.go deleted file mode 100644 index 59bfbf49..00000000 --- a/vendor/github.com/ipfs/go-bitswap/sessionpeermanager/sessionpeermanager.go +++ /dev/null @@ -1,221 +0,0 @@ -package sessionpeermanager - -import ( - "context" - "fmt" - "math/rand" - - cid "github.com/ipfs/go-cid" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -const ( - maxOptimizedPeers = 32 - reservePeers = 2 - unoptimizedTagValue = 5 // tag value for "unoptimized" session peers. - optimizedTagValue = 10 // tag value for "optimized" session peers. -) - -// PeerTagger is an interface for tagging peers with metadata -type PeerTagger interface { - TagPeer(peer.ID, string, int) - UntagPeer(p peer.ID, tag string) -} - -// PeerProviderFinder is an interface for finding providers -type PeerProviderFinder interface { - FindProvidersAsync(context.Context, cid.Cid) <-chan peer.ID -} - -type peerMessage interface { - handle(spm *SessionPeerManager) -} - -// SessionPeerManager tracks and manages peers for a session, and provides -// the best ones to the session -type SessionPeerManager struct { - ctx context.Context - tagger PeerTagger - providerFinder PeerProviderFinder - tag string - id uint64 - - peerMessages chan peerMessage - - // do not touch outside of run loop - activePeers map[peer.ID]bool - unoptimizedPeersArr []peer.ID - optimizedPeersArr []peer.ID -} - -// New creates a new SessionPeerManager -func New(ctx context.Context, id uint64, tagger PeerTagger, providerFinder PeerProviderFinder) *SessionPeerManager { - spm := &SessionPeerManager{ - id: id, - ctx: ctx, - tagger: tagger, - providerFinder: providerFinder, - peerMessages: make(chan peerMessage, 16), - activePeers: make(map[peer.ID]bool), - } - - spm.tag = fmt.Sprint("bs-ses-", id) - - go spm.run(ctx) - return spm -} - -// RecordPeerResponse records that a peer received a block, and adds to it -// the list of peers if it wasn't already added -func (spm *SessionPeerManager) RecordPeerResponse(p peer.ID, k cid.Cid) { - - // at the moment, we're just adding peers here - // in the future, we'll actually use this to record metrics - select { - case spm.peerMessages <- &peerResponseMessage{p}: - case <-spm.ctx.Done(): - } -} - -// RecordPeerRequests records that a given set of peers requested the given cids -func (spm *SessionPeerManager) RecordPeerRequests(p []peer.ID, ks []cid.Cid) { - // at the moment, we're not doing anything here - // soon we'll use this to track latency by peer -} - -// GetOptimizedPeers returns the best peers available for a session -func (spm *SessionPeerManager) GetOptimizedPeers() []peer.ID { - // right now this just returns all peers, but soon we might return peers - // ordered by optimization, or only a subset - resp := make(chan []peer.ID, 1) - select { - case spm.peerMessages <- &peerReqMessage{resp}: - case <-spm.ctx.Done(): - return nil - } - - select { - case peers := <-resp: - return peers - case <-spm.ctx.Done(): - return nil - } -} - -// FindMorePeers attempts to find more peers for a session by searching for -// providers for the given Cid -func (spm *SessionPeerManager) FindMorePeers(ctx context.Context, c cid.Cid) { - go func(k cid.Cid) { - for p := range spm.providerFinder.FindProvidersAsync(ctx, k) { - - select { - case spm.peerMessages <- &peerFoundMessage{p}: - case <-ctx.Done(): - case <-spm.ctx.Done(): - } - } - }(c) -} - -func (spm *SessionPeerManager) run(ctx context.Context) { - for { - select { - case pm := <-spm.peerMessages: - pm.handle(spm) - case <-ctx.Done(): - spm.handleShutdown() - return - } - } -} - -func (spm *SessionPeerManager) tagPeer(p peer.ID, value int) { - spm.tagger.TagPeer(p, spm.tag, value) -} - -func (spm *SessionPeerManager) insertOptimizedPeer(p peer.ID) { - if len(spm.optimizedPeersArr) >= (maxOptimizedPeers - reservePeers) { - tailPeer := spm.optimizedPeersArr[len(spm.optimizedPeersArr)-1] - spm.optimizedPeersArr = spm.optimizedPeersArr[:len(spm.optimizedPeersArr)-1] - spm.unoptimizedPeersArr = append(spm.unoptimizedPeersArr, tailPeer) - } - - spm.optimizedPeersArr = append([]peer.ID{p}, spm.optimizedPeersArr...) -} - -func (spm *SessionPeerManager) removeOptimizedPeer(p peer.ID) { - for i := 0; i < len(spm.optimizedPeersArr); i++ { - if spm.optimizedPeersArr[i] == p { - spm.optimizedPeersArr = append(spm.optimizedPeersArr[:i], spm.optimizedPeersArr[i+1:]...) - return - } - } -} - -func (spm *SessionPeerManager) removeUnoptimizedPeer(p peer.ID) { - for i := 0; i < len(spm.unoptimizedPeersArr); i++ { - if spm.unoptimizedPeersArr[i] == p { - spm.unoptimizedPeersArr[i] = spm.unoptimizedPeersArr[len(spm.unoptimizedPeersArr)-1] - spm.unoptimizedPeersArr = spm.unoptimizedPeersArr[:len(spm.unoptimizedPeersArr)-1] - return - } - } -} - -type peerFoundMessage struct { - p peer.ID -} - -func (pfm *peerFoundMessage) handle(spm *SessionPeerManager) { - p := pfm.p - if _, ok := spm.activePeers[p]; !ok { - spm.activePeers[p] = false - spm.unoptimizedPeersArr = append(spm.unoptimizedPeersArr, p) - spm.tagPeer(p, unoptimizedTagValue) - } -} - -type peerResponseMessage struct { - p peer.ID -} - -func (prm *peerResponseMessage) handle(spm *SessionPeerManager) { - p := prm.p - isOptimized, ok := spm.activePeers[p] - if isOptimized { - spm.removeOptimizedPeer(p) - } else { - spm.activePeers[p] = true - spm.tagPeer(p, optimizedTagValue) - - // transition from unoptimized. - if ok { - spm.removeUnoptimizedPeer(p) - } - } - spm.insertOptimizedPeer(p) -} - -type peerReqMessage struct { - resp chan<- []peer.ID -} - -func (prm *peerReqMessage) handle(spm *SessionPeerManager) { - randomOrder := rand.Perm(len(spm.unoptimizedPeersArr)) - maxPeers := len(spm.unoptimizedPeersArr) + len(spm.optimizedPeersArr) - if maxPeers > maxOptimizedPeers { - maxPeers = maxOptimizedPeers - } - - extraPeers := make([]peer.ID, maxPeers-len(spm.optimizedPeersArr)) - for i := range extraPeers { - extraPeers[i] = spm.unoptimizedPeersArr[randomOrder[i]] - } - prm.resp <- append(spm.optimizedPeersArr, extraPeers...) -} - -func (spm *SessionPeerManager) handleShutdown() { - for p := range spm.activePeers { - spm.tagger.UntagPeer(p, spm.tag) - } -} diff --git a/vendor/github.com/ipfs/go-bitswap/sessionrequestsplitter/sessionrequestsplitter.go b/vendor/github.com/ipfs/go-bitswap/sessionrequestsplitter/sessionrequestsplitter.go deleted file mode 100644 index 5400fe5c..00000000 --- a/vendor/github.com/ipfs/go-bitswap/sessionrequestsplitter/sessionrequestsplitter.go +++ /dev/null @@ -1,163 +0,0 @@ -package sessionrequestsplitter - -import ( - "context" - - "github.com/ipfs/go-cid" - "github.com/libp2p/go-libp2p-core/peer" -) - -const ( - minReceivedToAdjustSplit = 2 - maxSplit = 16 - maxAcceptableDupes = 0.4 - minDuplesToTryLessSplits = 0.2 - initialSplit = 2 -) - -// PartialRequest is represents one slice of an over request split among peers -type PartialRequest struct { - Peers []peer.ID - Keys []cid.Cid -} - -type srsMessage interface { - handle(srs *SessionRequestSplitter) -} - -// SessionRequestSplitter track how many duplicate and unique blocks come in and -// uses that to determine how much to split up each set of wants among peers. -type SessionRequestSplitter struct { - ctx context.Context - messages chan srsMessage - - // data, do not touch outside run loop - receivedCount int - split int - duplicateReceivedCount int -} - -// New returns a new SessionRequestSplitter. -func New(ctx context.Context) *SessionRequestSplitter { - srs := &SessionRequestSplitter{ - ctx: ctx, - messages: make(chan srsMessage, 10), - split: initialSplit, - } - go srs.run() - return srs -} - -// SplitRequest splits a request for the given cids one or more times among the -// given peers. -func (srs *SessionRequestSplitter) SplitRequest(peers []peer.ID, ks []cid.Cid) []*PartialRequest { - resp := make(chan []*PartialRequest, 1) - - select { - case srs.messages <- &splitRequestMessage{peers, ks, resp}: - case <-srs.ctx.Done(): - return nil - } - select { - case splitRequests := <-resp: - return splitRequests - case <-srs.ctx.Done(): - return nil - } - -} - -// RecordDuplicateBlock records the fact that the session received a duplicate -// block and adjusts split factor as neccesary. -func (srs *SessionRequestSplitter) RecordDuplicateBlock() { - select { - case srs.messages <- &recordDuplicateMessage{}: - case <-srs.ctx.Done(): - } -} - -// RecordUniqueBlock records the fact that the session received unique block -// and adjusts the split factor as neccesary. -func (srs *SessionRequestSplitter) RecordUniqueBlock() { - select { - case srs.messages <- &recordUniqueMessage{}: - case <-srs.ctx.Done(): - } -} - -func (srs *SessionRequestSplitter) run() { - for { - select { - case message := <-srs.messages: - message.handle(srs) - case <-srs.ctx.Done(): - return - } - } -} - -func (srs *SessionRequestSplitter) duplicateRatio() float64 { - return float64(srs.duplicateReceivedCount) / float64(srs.receivedCount) -} - -type splitRequestMessage struct { - peers []peer.ID - ks []cid.Cid - resp chan []*PartialRequest -} - -func (s *splitRequestMessage) handle(srs *SessionRequestSplitter) { - split := srs.split - peers := s.peers - ks := s.ks - if len(peers) < split { - split = len(peers) - } - peerSplits := splitPeers(peers, split) - if len(ks) < split { - split = len(ks) - } - keySplits := splitKeys(ks, split) - splitRequests := make([]*PartialRequest, len(keySplits)) - for i := range splitRequests { - splitRequests[i] = &PartialRequest{peerSplits[i], keySplits[i]} - } - s.resp <- splitRequests -} - -type recordDuplicateMessage struct{} - -func (r *recordDuplicateMessage) handle(srs *SessionRequestSplitter) { - srs.receivedCount++ - srs.duplicateReceivedCount++ - if (srs.receivedCount > minReceivedToAdjustSplit) && (srs.duplicateRatio() > maxAcceptableDupes) && (srs.split < maxSplit) { - srs.split++ - } -} - -type recordUniqueMessage struct{} - -func (r *recordUniqueMessage) handle(srs *SessionRequestSplitter) { - srs.receivedCount++ - if (srs.split > 1) && (srs.duplicateRatio() < minDuplesToTryLessSplits) { - srs.split-- - } - -} -func splitKeys(ks []cid.Cid, split int) [][]cid.Cid { - splits := make([][]cid.Cid, split) - for i, c := range ks { - pos := i % split - splits[pos] = append(splits[pos], c) - } - return splits -} - -func splitPeers(peers []peer.ID, split int) [][]peer.ID { - splits := make([][]peer.ID, split) - for i, p := range peers { - pos := i % split - splits[pos] = append(splits[pos], p) - } - return splits -} diff --git a/vendor/github.com/ipfs/go-bitswap/stat.go b/vendor/github.com/ipfs/go-bitswap/stat.go deleted file mode 100644 index af39ecb2..00000000 --- a/vendor/github.com/ipfs/go-bitswap/stat.go +++ /dev/null @@ -1,48 +0,0 @@ -package bitswap - -import ( - "sort" - - cid "github.com/ipfs/go-cid" -) - -// Stat is a struct that provides various statistics on bitswap operations -type Stat struct { - ProvideBufLen int - Wantlist []cid.Cid - Peers []string - BlocksReceived uint64 - DataReceived uint64 - BlocksSent uint64 - DataSent uint64 - DupBlksReceived uint64 - DupDataReceived uint64 - MessagesReceived uint64 -} - -// Stat returns aggregated statistics about bitswap operations -func (bs *Bitswap) Stat() (*Stat, error) { - st := new(Stat) - st.ProvideBufLen = len(bs.newBlocks) - st.Wantlist = bs.GetWantlist() - bs.counterLk.Lock() - c := bs.counters - st.BlocksReceived = c.blocksRecvd - st.DupBlksReceived = c.dupBlocksRecvd - st.DupDataReceived = c.dupDataRecvd - st.BlocksSent = c.blocksSent - st.DataSent = c.dataSent - st.DataReceived = c.dataRecvd - st.MessagesReceived = c.messagesRecvd - bs.counterLk.Unlock() - - peers := bs.engine.Peers() - st.Peers = make([]string, 0, len(peers)) - - for _, p := range peers { - st.Peers = append(st.Peers, p.Pretty()) - } - sort.Strings(st.Peers) - - return st, nil -} diff --git a/vendor/github.com/ipfs/go-bitswap/wantlist/wantlist.go b/vendor/github.com/ipfs/go-bitswap/wantlist/wantlist.go deleted file mode 100644 index b5c2a602..00000000 --- a/vendor/github.com/ipfs/go-bitswap/wantlist/wantlist.go +++ /dev/null @@ -1,216 +0,0 @@ -// Package wantlist implements an object for bitswap that contains the keys -// that a given peer wants. -package wantlist - -import ( - "sort" - - cid "github.com/ipfs/go-cid" -) - -// SessionTrackedWantlist is a list of wants that also track which bitswap -// sessions have requested them -type SessionTrackedWantlist struct { - set map[cid.Cid]*sessionTrackedEntry -} - -// Wantlist is a raw list of wanted blocks and their priorities -type Wantlist struct { - set map[cid.Cid]Entry -} - -// Entry is an entry in a want list, consisting of a cid and its priority -type Entry struct { - Cid cid.Cid - Priority int -} - -type sessionTrackedEntry struct { - Entry - sesTrk map[uint64]struct{} -} - -// NewRefEntry creates a new reference tracked wantlist entry. -func NewRefEntry(c cid.Cid, p int) Entry { - return Entry{ - Cid: c, - Priority: p, - } -} - -type entrySlice []Entry - -func (es entrySlice) Len() int { return len(es) } -func (es entrySlice) Swap(i, j int) { es[i], es[j] = es[j], es[i] } -func (es entrySlice) Less(i, j int) bool { return es[i].Priority > es[j].Priority } - -// NewSessionTrackedWantlist generates a new SessionTrackedWantList. -func NewSessionTrackedWantlist() *SessionTrackedWantlist { - return &SessionTrackedWantlist{ - set: make(map[cid.Cid]*sessionTrackedEntry), - } -} - -// New generates a new raw Wantlist -func New() *Wantlist { - return &Wantlist{ - set: make(map[cid.Cid]Entry), - } -} - -// Add adds the given cid to the wantlist with the specified priority, governed -// by the session ID 'ses'. if a cid is added under multiple session IDs, then -// it must be removed by each of those sessions before it is no longer 'in the -// wantlist'. Calls to Add are idempotent given the same arguments. Subsequent -// calls with different values for priority will not update the priority. -// TODO: think through priority changes here -// Add returns true if the cid did not exist in the wantlist before this call -// (even if it was under a different session). -func (w *SessionTrackedWantlist) Add(c cid.Cid, priority int, ses uint64) bool { - - if e, ok := w.set[c]; ok { - e.sesTrk[ses] = struct{}{} - return false - } - - w.set[c] = &sessionTrackedEntry{ - Entry: Entry{Cid: c, Priority: priority}, - sesTrk: map[uint64]struct{}{ses: struct{}{}}, - } - - return true -} - -// AddEntry adds given Entry to the wantlist. For more information see Add method. -func (w *SessionTrackedWantlist) AddEntry(e Entry, ses uint64) bool { - if ex, ok := w.set[e.Cid]; ok { - ex.sesTrk[ses] = struct{}{} - return false - } - w.set[e.Cid] = &sessionTrackedEntry{ - Entry: e, - sesTrk: map[uint64]struct{}{ses: struct{}{}}, - } - return true -} - -// Remove removes the given cid from being tracked by the given session. -// 'true' is returned if this call to Remove removed the final session ID -// tracking the cid. (meaning true will be returned iff this call caused the -// value of 'Contains(c)' to change from true to false) -func (w *SessionTrackedWantlist) Remove(c cid.Cid, ses uint64) bool { - e, ok := w.set[c] - if !ok { - return false - } - - delete(e.sesTrk, ses) - if len(e.sesTrk) == 0 { - delete(w.set, c) - return true - } - return false -} - -// Contains returns true if the given cid is in the wantlist tracked by one or -// more sessions. -func (w *SessionTrackedWantlist) Contains(k cid.Cid) (Entry, bool) { - e, ok := w.set[k] - if !ok { - return Entry{}, false - } - return e.Entry, true -} - -// Entries returns all wantlist entries for a given session tracked want list. -func (w *SessionTrackedWantlist) Entries() []Entry { - es := make([]Entry, 0, len(w.set)) - for _, e := range w.set { - es = append(es, e.Entry) - } - return es -} - -// SortedEntries returns wantlist entries ordered by priority. -func (w *SessionTrackedWantlist) SortedEntries() []Entry { - es := w.Entries() - sort.Sort(entrySlice(es)) - return es -} - -// Len returns the number of entries in a wantlist. -func (w *SessionTrackedWantlist) Len() int { - return len(w.set) -} - -// CopyWants copies all wants from one SessionTrackWantlist to another (along with -// the session data) -func (w *SessionTrackedWantlist) CopyWants(to *SessionTrackedWantlist) { - for _, e := range w.set { - for k := range e.sesTrk { - to.AddEntry(e.Entry, k) - } - } -} - -// Len returns the number of entries in a wantlist. -func (w *Wantlist) Len() int { - return len(w.set) -} - -// Add adds an entry in a wantlist from CID & Priority, if not already present. -func (w *Wantlist) Add(c cid.Cid, priority int) bool { - if _, ok := w.set[c]; ok { - return false - } - - w.set[c] = Entry{ - Cid: c, - Priority: priority, - } - - return true -} - -// AddEntry adds an entry to a wantlist if not already present. -func (w *Wantlist) AddEntry(e Entry) bool { - if _, ok := w.set[e.Cid]; ok { - return false - } - w.set[e.Cid] = e - return true -} - -// Remove removes the given cid from the wantlist. -func (w *Wantlist) Remove(c cid.Cid) bool { - _, ok := w.set[c] - if !ok { - return false - } - - delete(w.set, c) - return true -} - -// Contains returns the entry, if present, for the given CID, plus whether it -// was present. -func (w *Wantlist) Contains(c cid.Cid) (Entry, bool) { - e, ok := w.set[c] - return e, ok -} - -// Entries returns all wantlist entries for a want list. -func (w *Wantlist) Entries() []Entry { - es := make([]Entry, 0, len(w.set)) - for _, e := range w.set { - es = append(es, e) - } - return es -} - -// SortedEntries returns wantlist entries ordered by priority. -func (w *Wantlist) SortedEntries() []Entry { - es := w.Entries() - sort.Sort(entrySlice(es)) - return es -} diff --git a/vendor/github.com/ipfs/go-bitswap/wantmanager/wantmanager.go b/vendor/github.com/ipfs/go-bitswap/wantmanager/wantmanager.go deleted file mode 100644 index 4203d14f..00000000 --- a/vendor/github.com/ipfs/go-bitswap/wantmanager/wantmanager.go +++ /dev/null @@ -1,282 +0,0 @@ -package wantmanager - -import ( - "context" - "math" - - bsmsg "github.com/ipfs/go-bitswap/message" - wantlist "github.com/ipfs/go-bitswap/wantlist" - logging "github.com/ipfs/go-log" - - cid "github.com/ipfs/go-cid" - metrics "github.com/ipfs/go-metrics-interface" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -var log = logging.Logger("bitswap") - -const ( - // maxPriority is the max priority as defined by the bitswap protocol - maxPriority = math.MaxInt32 -) - -// PeerHandler sends changes out to the network as they get added to the wantlist -// managed by the WantManager. -type PeerHandler interface { - Disconnected(p peer.ID) - Connected(p peer.ID, initialWants *wantlist.SessionTrackedWantlist) - SendMessage(entries []bsmsg.Entry, targets []peer.ID, from uint64) -} - -type wantMessage interface { - handle(wm *WantManager) -} - -// WantManager manages a global want list. It tracks two seperate want lists - -// one for all wants, and one for wants that are specifically broadcast to the -// internet. -type WantManager struct { - // channel requests to the run loop - // to get predictable behavior while running this in a go routine - // having only one channel is neccesary, so requests are processed serially - wantMessages chan wantMessage - - // synchronized by Run loop, only touch inside there - wl *wantlist.SessionTrackedWantlist - bcwl *wantlist.SessionTrackedWantlist - - ctx context.Context - cancel func() - - peerHandler PeerHandler - wantlistGauge metrics.Gauge -} - -// New initializes a new WantManager for a given context. -func New(ctx context.Context, peerHandler PeerHandler) *WantManager { - ctx, cancel := context.WithCancel(ctx) - wantlistGauge := metrics.NewCtx(ctx, "wantlist_total", - "Number of items in wantlist.").Gauge() - return &WantManager{ - wantMessages: make(chan wantMessage, 10), - wl: wantlist.NewSessionTrackedWantlist(), - bcwl: wantlist.NewSessionTrackedWantlist(), - ctx: ctx, - cancel: cancel, - peerHandler: peerHandler, - wantlistGauge: wantlistGauge, - } -} - -// WantBlocks adds the given cids to the wantlist, tracked by the given session. -func (wm *WantManager) WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64) { - log.Infof("want blocks: %s", ks) - wm.addEntries(ctx, ks, peers, false, ses) -} - -// CancelWants removes the given cids from the wantlist, tracked by the given session. -func (wm *WantManager) CancelWants(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64) { - wm.addEntries(context.Background(), ks, peers, true, ses) -} - -// IsWanted returns whether a CID is currently wanted. -func (wm *WantManager) IsWanted(c cid.Cid) bool { - resp := make(chan bool, 1) - select { - case wm.wantMessages <- &isWantedMessage{c, resp}: - case <-wm.ctx.Done(): - return false - } - select { - case wanted := <-resp: - return wanted - case <-wm.ctx.Done(): - return false - } -} - -// CurrentWants returns the list of current wants. -func (wm *WantManager) CurrentWants() []wantlist.Entry { - resp := make(chan []wantlist.Entry, 1) - select { - case wm.wantMessages <- ¤tWantsMessage{resp}: - case <-wm.ctx.Done(): - return nil - } - select { - case wantlist := <-resp: - return wantlist - case <-wm.ctx.Done(): - return nil - } -} - -// CurrentBroadcastWants returns the current list of wants that are broadcasts. -func (wm *WantManager) CurrentBroadcastWants() []wantlist.Entry { - resp := make(chan []wantlist.Entry, 1) - select { - case wm.wantMessages <- ¤tBroadcastWantsMessage{resp}: - case <-wm.ctx.Done(): - return nil - } - select { - case wl := <-resp: - return wl - case <-wm.ctx.Done(): - return nil - } -} - -// WantCount returns the total count of wants. -func (wm *WantManager) WantCount() int { - resp := make(chan int, 1) - select { - case wm.wantMessages <- &wantCountMessage{resp}: - case <-wm.ctx.Done(): - return 0 - } - select { - case count := <-resp: - return count - case <-wm.ctx.Done(): - return 0 - } -} - -// Connected is called when a new peer is connected -func (wm *WantManager) Connected(p peer.ID) { - select { - case wm.wantMessages <- &connectedMessage{p}: - case <-wm.ctx.Done(): - } -} - -// Disconnected is called when a peer is disconnected -func (wm *WantManager) Disconnected(p peer.ID) { - select { - case wm.wantMessages <- &disconnectedMessage{p}: - case <-wm.ctx.Done(): - } -} - -// Startup starts processing for the WantManager. -func (wm *WantManager) Startup() { - go wm.run() -} - -// Shutdown ends processing for the want manager. -func (wm *WantManager) Shutdown() { - wm.cancel() -} - -func (wm *WantManager) run() { - // NOTE: Do not open any streams or connections from anywhere in this - // event loop. Really, just don't do anything likely to block. - for { - select { - case message := <-wm.wantMessages: - message.handle(wm) - case <-wm.ctx.Done(): - return - } - } -} - -func (wm *WantManager) addEntries(ctx context.Context, ks []cid.Cid, targets []peer.ID, cancel bool, ses uint64) { - entries := make([]bsmsg.Entry, 0, len(ks)) - for i, k := range ks { - entries = append(entries, bsmsg.Entry{ - Cancel: cancel, - Entry: wantlist.NewRefEntry(k, maxPriority-i), - }) - } - select { - case wm.wantMessages <- &wantSet{entries: entries, targets: targets, from: ses}: - case <-wm.ctx.Done(): - case <-ctx.Done(): - } -} - -type wantSet struct { - entries []bsmsg.Entry - targets []peer.ID - from uint64 -} - -func (ws *wantSet) handle(wm *WantManager) { - // is this a broadcast or not? - brdc := len(ws.targets) == 0 - - // add changes to our wantlist - for _, e := range ws.entries { - if e.Cancel { - if brdc { - wm.bcwl.Remove(e.Cid, ws.from) - } - - if wm.wl.Remove(e.Cid, ws.from) { - wm.wantlistGauge.Dec() - } - } else { - if brdc { - wm.bcwl.AddEntry(e.Entry, ws.from) - } - if wm.wl.AddEntry(e.Entry, ws.from) { - wm.wantlistGauge.Inc() - } - } - } - - // broadcast those wantlist changes - wm.peerHandler.SendMessage(ws.entries, ws.targets, ws.from) -} - -type isWantedMessage struct { - c cid.Cid - resp chan<- bool -} - -func (iwm *isWantedMessage) handle(wm *WantManager) { - _, isWanted := wm.wl.Contains(iwm.c) - iwm.resp <- isWanted -} - -type currentWantsMessage struct { - resp chan<- []wantlist.Entry -} - -func (cwm *currentWantsMessage) handle(wm *WantManager) { - cwm.resp <- wm.wl.Entries() -} - -type currentBroadcastWantsMessage struct { - resp chan<- []wantlist.Entry -} - -func (cbcwm *currentBroadcastWantsMessage) handle(wm *WantManager) { - cbcwm.resp <- wm.bcwl.Entries() -} - -type wantCountMessage struct { - resp chan<- int -} - -func (wcm *wantCountMessage) handle(wm *WantManager) { - wcm.resp <- wm.wl.Len() -} - -type connectedMessage struct { - p peer.ID -} - -func (cm *connectedMessage) handle(wm *WantManager) { - wm.peerHandler.Connected(cm.p, wm.bcwl) -} - -type disconnectedMessage struct { - p peer.ID -} - -func (dm *disconnectedMessage) handle(wm *WantManager) { - wm.peerHandler.Disconnected(dm.p) -} diff --git a/vendor/github.com/ipfs/go-bitswap/workers.go b/vendor/github.com/ipfs/go-bitswap/workers.go deleted file mode 100644 index fb3dc019..00000000 --- a/vendor/github.com/ipfs/go-bitswap/workers.go +++ /dev/null @@ -1,189 +0,0 @@ -package bitswap - -import ( - "context" - - engine "github.com/ipfs/go-bitswap/decision" - bsmsg "github.com/ipfs/go-bitswap/message" - cid "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log" - process "github.com/jbenet/goprocess" - procctx "github.com/jbenet/goprocess/context" -) - -// TaskWorkerCount is the total number of simultaneous threads sending -// outgoing messages -var TaskWorkerCount = 8 - -func (bs *Bitswap) startWorkers(ctx context.Context, px process.Process) { - - // Start up workers to handle requests from other nodes for the data on this node - for i := 0; i < TaskWorkerCount; i++ { - i := i - px.Go(func(px process.Process) { - bs.taskWorker(ctx, i) - }) - } - - if bs.provideEnabled { - // Start up a worker to manage sending out provides messages - px.Go(func(px process.Process) { - bs.provideCollector(ctx) - }) - - // Spawn up multiple workers to handle incoming blocks - // consider increasing number if providing blocks bottlenecks - // file transfers - px.Go(bs.provideWorker) - } -} - -func (bs *Bitswap) taskWorker(ctx context.Context, id int) { - idmap := logging.LoggableMap{"ID": id} - defer log.Debug("bitswap task worker shutting down...") - for { - log.Event(ctx, "Bitswap.TaskWorker.Loop", idmap) - select { - case nextEnvelope := <-bs.engine.Outbox(): - select { - case envelope, ok := <-nextEnvelope: - if !ok { - continue - } - // update the BS ledger to reflect sent message - // TODO: Should only track *useful* messages in ledger - outgoing := bsmsg.New(false) - for _, block := range envelope.Message.Blocks() { - log.Event(ctx, "Bitswap.TaskWorker.Work", logging.LoggableF(func() map[string]interface{} { - return logging.LoggableMap{ - "ID": id, - "Target": envelope.Peer.Pretty(), - "Block": block.Cid().String(), - } - })) - outgoing.AddBlock(block) - } - bs.engine.MessageSent(envelope.Peer, outgoing) - - bs.sendBlocks(ctx, envelope) - bs.counterLk.Lock() - for _, block := range envelope.Message.Blocks() { - bs.counters.blocksSent++ - bs.counters.dataSent += uint64(len(block.RawData())) - } - bs.counterLk.Unlock() - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } -} - -func (bs *Bitswap) sendBlocks(ctx context.Context, env *engine.Envelope) { - // Blocks need to be sent synchronously to maintain proper backpressure - // throughout the network stack - defer env.Sent() - - msgSize := 0 - msg := bsmsg.New(false) - for _, block := range env.Message.Blocks() { - msgSize += len(block.RawData()) - msg.AddBlock(block) - log.Infof("Sending block %s to %s", block, env.Peer) - } - - bs.sentHistogram.Observe(float64(msgSize)) - err := bs.network.SendMessage(ctx, env.Peer, msg) - if err != nil { - log.Infof("sendblock error: %s", err) - } -} - -func (bs *Bitswap) provideWorker(px process.Process) { - // FIXME: OnClosingContext returns a _custom_ context type. - // Unfortunately, deriving a new cancelable context from this custom - // type fires off a goroutine. To work around this, we create a single - // cancelable context up-front and derive all sub-contexts from that. - // - // See: https://github.com/ipfs/go-ipfs/issues/5810 - ctx := procctx.OnClosingContext(px) - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - limit := make(chan struct{}, provideWorkerMax) - - limitedGoProvide := func(k cid.Cid, wid int) { - defer func() { - // replace token when done - <-limit - }() - ev := logging.LoggableMap{"ID": wid} - - defer log.EventBegin(ctx, "Bitswap.ProvideWorker.Work", ev, k).Done() - - ctx, cancel := context.WithTimeout(ctx, provideTimeout) // timeout ctx - defer cancel() - - if err := bs.network.Provide(ctx, k); err != nil { - log.Warning(err) - } - } - - // worker spawner, reads from bs.provideKeys until it closes, spawning a - // _ratelimited_ number of workers to handle each key. - for wid := 2; ; wid++ { - ev := logging.LoggableMap{"ID": 1} - log.Event(ctx, "Bitswap.ProvideWorker.Loop", ev) - - select { - case <-px.Closing(): - return - case k, ok := <-bs.provideKeys: - if !ok { - log.Debug("provideKeys channel closed") - return - } - select { - case <-px.Closing(): - return - case limit <- struct{}{}: - go limitedGoProvide(k, wid) - } - } - } -} - -func (bs *Bitswap) provideCollector(ctx context.Context) { - defer close(bs.provideKeys) - var toProvide []cid.Cid - var nextKey cid.Cid - var keysOut chan cid.Cid - - for { - select { - case blkey, ok := <-bs.newBlocks: - if !ok { - log.Debug("newBlocks channel closed") - return - } - - if keysOut == nil { - nextKey = blkey - keysOut = bs.provideKeys - } else { - toProvide = append(toProvide, blkey) - } - case keysOut <- nextKey: - if len(toProvide) > 0 { - nextKey = toProvide[0] - toProvide = toProvide[1:] - } else { - keysOut = nil - } - case <-ctx.Done(): - return - } - } -} diff --git a/vendor/github.com/ipfs/go-block-format/.travis.yml b/vendor/github.com/ipfs/go-block-format/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-block-format/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-block-format/LICENSE b/vendor/github.com/ipfs/go-block-format/LICENSE deleted file mode 100644 index 8001ebee..00000000 --- a/vendor/github.com/ipfs/go-block-format/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2017 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-block-format/Makefile b/vendor/github.com/ipfs/go-block-format/Makefile deleted file mode 100644 index 7811c099..00000000 --- a/vendor/github.com/ipfs/go-block-format/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -covertools: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -deps: gx covertools - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-block-format/README.md b/vendor/github.com/ipfs/go-block-format/README.md deleted file mode 100644 index 67cd1fcd..00000000 --- a/vendor/github.com/ipfs/go-block-format/README.md +++ /dev/null @@ -1,35 +0,0 @@ -go-block-format -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-block-format/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-block-format/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-block-format.svg?branch=master)](https://travis-ci.org/ipfs/go-block-format) - -> go-block-format is a set of interfaces that a type needs to implement in order to be a CID addressable block of data. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-block-format/blocks.go b/vendor/github.com/ipfs/go-block-format/blocks.go deleted file mode 100644 index 3d3894b3..00000000 --- a/vendor/github.com/ipfs/go-block-format/blocks.go +++ /dev/null @@ -1,82 +0,0 @@ -// Package blocks contains the lowest level of IPLD data structures. -// A block is raw data accompanied by a CID. The CID contains the multihash -// corresponding to the block. -package blocks - -import ( - "errors" - "fmt" - - cid "github.com/ipfs/go-cid" - u "github.com/ipfs/go-ipfs-util" - mh "github.com/multiformats/go-multihash" -) - -// ErrWrongHash is returned when the Cid of a block is not the expected -// according to the contents. It is currently used only when debugging. -var ErrWrongHash = errors.New("data did not match given hash") - -// Block provides abstraction for blocks implementations. -type Block interface { - RawData() []byte - Cid() cid.Cid - String() string - Loggable() map[string]interface{} -} - -// A BasicBlock is a singular block of data in ipfs. It implements the Block -// interface. -type BasicBlock struct { - cid cid.Cid - data []byte -} - -// NewBlock creates a Block object from opaque data. It will hash the data. -func NewBlock(data []byte) *BasicBlock { - // TODO: fix assumptions - return &BasicBlock{data: data, cid: cid.NewCidV0(u.Hash(data))} -} - -// NewBlockWithCid creates a new block when the hash of the data -// is already known, this is used to save time in situations where -// we are able to be confident that the data is correct. -func NewBlockWithCid(data []byte, c cid.Cid) (*BasicBlock, error) { - if u.Debug { - chkc, err := c.Prefix().Sum(data) - if err != nil { - return nil, err - } - - if !chkc.Equals(c) { - return nil, ErrWrongHash - } - } - return &BasicBlock{data: data, cid: c}, nil -} - -// Multihash returns the hash contained in the block CID. -func (b *BasicBlock) Multihash() mh.Multihash { - return b.cid.Hash() -} - -// RawData returns the block raw contents as a byte slice. -func (b *BasicBlock) RawData() []byte { - return b.data -} - -// Cid returns the content identifier of the block. -func (b *BasicBlock) Cid() cid.Cid { - return b.cid -} - -// String provides a human-readable representation of the block CID. -func (b *BasicBlock) String() string { - return fmt.Sprintf("[Block %s]", b.Cid()) -} - -// Loggable returns a go-log loggable item. -func (b *BasicBlock) Loggable() map[string]interface{} { - return map[string]interface{}{ - "block": b.Cid().String(), - } -} diff --git a/vendor/github.com/ipfs/go-block-format/codecov.yml b/vendor/github.com/ipfs/go-block-format/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-block-format/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-block-format/go.mod b/vendor/github.com/ipfs/go-block-format/go.mod deleted file mode 100644 index f6ab8eab..00000000 --- a/vendor/github.com/ipfs/go-block-format/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-block-format - -require ( - github.com/ipfs/go-cid v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-block-format/go.sum b/vendor/github.com/ipfs/go-block-format/go.sum deleted file mode 100644 index 3fb22960..00000000 --- a/vendor/github.com/ipfs/go-block-format/go.sum +++ /dev/null @@ -1,24 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-block-format/package.json b/vendor/github.com/ipfs/go-block-format/package.json deleted file mode 100644 index 970ac559..00000000 --- a/vendor/github.com/ipfs/go-block-format/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": "stebalien", - "bugs": { - "url": "https://github.com/ipfs/go-block-format" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-block-format" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - } - ], - "gxVersion": "0.11.0", - "language": "go", - "license": "", - "name": "go-block-format", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.2.2" -} - diff --git a/vendor/github.com/ipfs/go-blockservice/.travis.yml b/vendor/github.com/ipfs/go-blockservice/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/ipfs/go-blockservice/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-blockservice/LICENSE b/vendor/github.com/ipfs/go-blockservice/LICENSE deleted file mode 100644 index 7d5dcac4..00000000 --- a/vendor/github.com/ipfs/go-blockservice/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-blockservice/README.md b/vendor/github.com/ipfs/go-blockservice/README.md deleted file mode 100644 index 3df67fde..00000000 --- a/vendor/github.com/ipfs/go-blockservice/README.md +++ /dev/null @@ -1,33 +0,0 @@ -go-blockservice -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-block-format/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-block-format/branch/master) -[![Travis CI](https://travis-ci.com/ipfs/go-blockservice.svg?branch=master)](https://travis-ci.com/ipfs/go-blockservice) - -> go-blockservice provides a seamless interface to both local and remote storage backends. - - -## Table of Contents - -- [TODO](#todo) -- [Contribute](#contribute) -- [License](#license) - -## TODO - -The interfaces here really would like to be merged with the blockstore interfaces. -The 'dagservice' constructor currently takes a blockservice, but it would be really nice -if it could just take a blockstore, and have this package implement a blockstore. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-blockservice/blockservice.go b/vendor/github.com/ipfs/go-blockservice/blockservice.go deleted file mode 100644 index ba88d1c2..00000000 --- a/vendor/github.com/ipfs/go-blockservice/blockservice.go +++ /dev/null @@ -1,359 +0,0 @@ -// package blockservice implements a BlockService interface that provides -// a single GetBlock/AddBlock interface that seamlessly retrieves data either -// locally or from a remote peer through the exchange. -package blockservice - -import ( - "context" - "errors" - "io" - "sync" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - exchange "github.com/ipfs/go-ipfs-exchange-interface" - logging "github.com/ipfs/go-log" - "github.com/ipfs/go-verifcid" -) - -var log = logging.Logger("blockservice") - -var ErrNotFound = errors.New("blockservice: key not found") - -// BlockGetter is the common interface shared between blockservice sessions and -// the blockservice. -type BlockGetter interface { - // GetBlock gets the requested block. - GetBlock(ctx context.Context, c cid.Cid) (blocks.Block, error) - - // GetBlocks does a batch request for the given cids, returning blocks as - // they are found, in no particular order. - // - // It may not be able to find all requested blocks (or the context may - // be canceled). In that case, it will close the channel early. It is up - // to the consumer to detect this situation and keep track which blocks - // it has received and which it hasn't. - GetBlocks(ctx context.Context, ks []cid.Cid) <-chan blocks.Block -} - -// BlockService is a hybrid block datastore. It stores data in a local -// datastore and may retrieve data from a remote Exchange. -// It uses an internal `datastore.Datastore` instance to store values. -type BlockService interface { - io.Closer - BlockGetter - - // Blockstore returns a reference to the underlying blockstore - Blockstore() blockstore.Blockstore - - // Exchange returns a reference to the underlying exchange (usually bitswap) - Exchange() exchange.Interface - - // AddBlock puts a given block to the underlying datastore - AddBlock(o blocks.Block) error - - // AddBlocks adds a slice of blocks at the same time using batching - // capabilities of the underlying datastore whenever possible. - AddBlocks(bs []blocks.Block) error - - // DeleteBlock deletes the given block from the blockservice. - DeleteBlock(o cid.Cid) error -} - -type blockService struct { - blockstore blockstore.Blockstore - exchange exchange.Interface - // If checkFirst is true then first check that a block doesn't - // already exist to avoid republishing the block on the exchange. - checkFirst bool -} - -// NewBlockService creates a BlockService with given datastore instance. -func New(bs blockstore.Blockstore, rem exchange.Interface) BlockService { - if rem == nil { - log.Warning("blockservice running in local (offline) mode.") - } - - return &blockService{ - blockstore: bs, - exchange: rem, - checkFirst: true, - } -} - -// NewWriteThrough ceates a BlockService that guarantees writes will go -// through to the blockstore and are not skipped by cache checks. -func NewWriteThrough(bs blockstore.Blockstore, rem exchange.Interface) BlockService { - if rem == nil { - log.Warning("blockservice running in local (offline) mode.") - } - - return &blockService{ - blockstore: bs, - exchange: rem, - checkFirst: false, - } -} - -// Blockstore returns the blockstore behind this blockservice. -func (s *blockService) Blockstore() blockstore.Blockstore { - return s.blockstore -} - -// Exchange returns the exchange behind this blockservice. -func (s *blockService) Exchange() exchange.Interface { - return s.exchange -} - -// NewSession creates a new session that allows for -// controlled exchange of wantlists to decrease the bandwidth overhead. -// If the current exchange is a SessionExchange, a new exchange -// session will be created. Otherwise, the current exchange will be used -// directly. -func NewSession(ctx context.Context, bs BlockService) *Session { - exch := bs.Exchange() - if sessEx, ok := exch.(exchange.SessionExchange); ok { - return &Session{ - sessCtx: ctx, - ses: nil, - sessEx: sessEx, - bs: bs.Blockstore(), - } - } - return &Session{ - ses: exch, - sessCtx: ctx, - bs: bs.Blockstore(), - } -} - -// AddBlock adds a particular block to the service, Putting it into the datastore. -// TODO pass a context into this if the remote.HasBlock is going to remain here. -func (s *blockService) AddBlock(o blocks.Block) error { - c := o.Cid() - // hash security - err := verifcid.ValidateCid(c) - if err != nil { - return err - } - if s.checkFirst { - if has, err := s.blockstore.Has(c); has || err != nil { - return err - } - } - - if err := s.blockstore.Put(o); err != nil { - return err - } - - log.Event(context.TODO(), "BlockService.BlockAdded", c) - - if err := s.exchange.HasBlock(o); err != nil { - log.Errorf("HasBlock: %s", err.Error()) - } - - return nil -} - -func (s *blockService) AddBlocks(bs []blocks.Block) error { - // hash security - for _, b := range bs { - err := verifcid.ValidateCid(b.Cid()) - if err != nil { - return err - } - } - var toput []blocks.Block - if s.checkFirst { - toput = make([]blocks.Block, 0, len(bs)) - for _, b := range bs { - has, err := s.blockstore.Has(b.Cid()) - if err != nil { - return err - } - if !has { - toput = append(toput, b) - } - } - } else { - toput = bs - } - - if len(toput) == 0 { - return nil - } - - err := s.blockstore.PutMany(toput) - if err != nil { - return err - } - - for _, o := range toput { - log.Event(context.TODO(), "BlockService.BlockAdded", o.Cid()) - if err := s.exchange.HasBlock(o); err != nil { - log.Errorf("HasBlock: %s", err.Error()) - } - } - return nil -} - -// GetBlock retrieves a particular block from the service, -// Getting it from the datastore using the key (hash). -func (s *blockService) GetBlock(ctx context.Context, c cid.Cid) (blocks.Block, error) { - log.Debugf("BlockService GetBlock: '%s'", c) - - var f func() exchange.Fetcher - if s.exchange != nil { - f = s.getExchange - } - - return getBlock(ctx, c, s.blockstore, f) // hash security -} - -func (s *blockService) getExchange() exchange.Fetcher { - return s.exchange -} - -func getBlock(ctx context.Context, c cid.Cid, bs blockstore.Blockstore, fget func() exchange.Fetcher) (blocks.Block, error) { - err := verifcid.ValidateCid(c) // hash security - if err != nil { - return nil, err - } - - block, err := bs.Get(c) - if err == nil { - return block, nil - } - - if err == blockstore.ErrNotFound && fget != nil { - f := fget() // Don't load the exchange until we have to - - // TODO be careful checking ErrNotFound. If the underlying - // implementation changes, this will break. - log.Debug("Blockservice: Searching bitswap") - blk, err := f.GetBlock(ctx, c) - if err != nil { - if err == blockstore.ErrNotFound { - return nil, ErrNotFound - } - return nil, err - } - log.Event(ctx, "BlockService.BlockFetched", c) - return blk, nil - } - - log.Debug("Blockservice GetBlock: Not found") - if err == blockstore.ErrNotFound { - return nil, ErrNotFound - } - - return nil, err -} - -// GetBlocks gets a list of blocks asynchronously and returns through -// the returned channel. -// NB: No guarantees are made about order. -func (s *blockService) GetBlocks(ctx context.Context, ks []cid.Cid) <-chan blocks.Block { - return getBlocks(ctx, ks, s.blockstore, s.getExchange) // hash security -} - -func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget func() exchange.Fetcher) <-chan blocks.Block { - out := make(chan blocks.Block) - - go func() { - defer close(out) - - k := 0 - for _, c := range ks { - // hash security - if err := verifcid.ValidateCid(c); err == nil { - ks[k] = c - k++ - } else { - log.Errorf("unsafe CID (%s) passed to blockService.GetBlocks: %s", c, err) - } - } - ks = ks[:k] - - var misses []cid.Cid - for _, c := range ks { - hit, err := bs.Get(c) - if err != nil { - misses = append(misses, c) - continue - } - select { - case out <- hit: - case <-ctx.Done(): - return - } - } - - if len(misses) == 0 { - return - } - - f := fget() // don't load exchange unless we have to - rblocks, err := f.GetBlocks(ctx, misses) - if err != nil { - log.Debugf("Error with GetBlocks: %s", err) - return - } - - for b := range rblocks { - log.Event(ctx, "BlockService.BlockFetched", b.Cid()) - select { - case out <- b: - case <-ctx.Done(): - return - } - } - }() - return out -} - -// DeleteBlock deletes a block in the blockservice from the datastore -func (s *blockService) DeleteBlock(c cid.Cid) error { - err := s.blockstore.DeleteBlock(c) - if err == nil { - log.Event(context.TODO(), "BlockService.BlockDeleted", c) - } - return err -} - -func (s *blockService) Close() error { - log.Debug("blockservice is shutting down...") - return s.exchange.Close() -} - -// Session is a helper type to provide higher level access to bitswap sessions -type Session struct { - bs blockstore.Blockstore - ses exchange.Fetcher - sessEx exchange.SessionExchange - sessCtx context.Context - lk sync.Mutex -} - -func (s *Session) getSession() exchange.Fetcher { - s.lk.Lock() - defer s.lk.Unlock() - if s.ses == nil { - s.ses = s.sessEx.NewSession(s.sessCtx) - } - - return s.ses -} - -// GetBlock gets a block in the context of a request session -func (s *Session) GetBlock(ctx context.Context, c cid.Cid) (blocks.Block, error) { - return getBlock(ctx, c, s.bs, s.getSession) // hash security -} - -// GetBlocks gets blocks in the context of a request session -func (s *Session) GetBlocks(ctx context.Context, ks []cid.Cid) <-chan blocks.Block { - return getBlocks(ctx, ks, s.bs, s.getSession) // hash security -} - -var _ BlockGetter = (*Session)(nil) diff --git a/vendor/github.com/ipfs/go-blockservice/go.mod b/vendor/github.com/ipfs/go-blockservice/go.mod deleted file mode 100644 index 4644e9fa..00000000 --- a/vendor/github.com/ipfs/go-blockservice/go.mod +++ /dev/null @@ -1,17 +0,0 @@ -module github.com/ipfs/go-blockservice - -require ( - github.com/ipfs/go-bitswap v0.1.3 - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-ipfs-blockstore v0.0.1 - github.com/ipfs/go-ipfs-blocksutil v0.0.1 - github.com/ipfs/go-ipfs-delay v0.0.1 - github.com/ipfs/go-ipfs-exchange-interface v0.0.1 - github.com/ipfs/go-ipfs-exchange-offline v0.0.1 - github.com/ipfs/go-ipfs-routing v0.1.0 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-verifcid v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-blockservice/go.sum b/vendor/github.com/ipfs/go-blockservice/go.sum deleted file mode 100644 index 5cba9762..00000000 --- a/vendor/github.com/ipfs/go-blockservice/go.sum +++ /dev/null @@ -1,335 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50 h1:4i3KsuVA0o0KoBxAC5x+MY7RbteiMK1V7gf/G08NGIQ= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.1.3 h1:jAl9Z/TYObpGeGATUemnOZ7RYb0F/kzNVlhcYZesz+0= -github.com/ipfs/go-bitswap v0.1.3/go.mod h1:YEQlFy0kkxops5Vy+OxWdRSEZIoS7I7KDIwoa5Chkps= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ= -github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-peertaskqueue v0.1.1 h1:+gPjbI+V3NktXZOqJA1kzbms2pYmhjgQQal0MzZrOAY= -github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.1 h1:52sB0TJuDk2nYMcMfHOKaPoaayDZjaYVCq6Vk1ejUTk= -github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= -github.com/libp2p/go-libp2p-core v0.0.3 h1:+IonUYY0nJZLb5Fdv6a6DOjtGP1L8Bb3faamiI2q5FY= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.3 h1:VsOlWispTivSsOMg70e0W77y6oiSBSRCyP6URrWvE04= -github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-cid/.gitignore b/vendor/github.com/ipfs/go-cid/.gitignore deleted file mode 100644 index aaea8ed0..00000000 --- a/vendor/github.com/ipfs/go-cid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cid-fuzz.zip diff --git a/vendor/github.com/ipfs/go-cid/.travis.yml b/vendor/github.com/ipfs/go-cid/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-cid/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-cid/LICENSE b/vendor/github.com/ipfs/go-cid/LICENSE deleted file mode 100644 index 0e323020..00000000 --- a/vendor/github.com/ipfs/go-cid/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Protocol Labs, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-cid/Makefile b/vendor/github.com/ipfs/go-cid/Makefile deleted file mode 100644 index e6bdd2c9..00000000 --- a/vendor/github.com/ipfs/go-cid/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: deps - -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -covertools: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -deps: gx covertools - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo diff --git a/vendor/github.com/ipfs/go-cid/README.md b/vendor/github.com/ipfs/go-cid/README.md deleted file mode 100644 index 0824d519..00000000 --- a/vendor/github.com/ipfs/go-cid/README.md +++ /dev/null @@ -1,125 +0,0 @@ -go-cid -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-cid?status.svg)](https://godoc.org/github.com/ipfs/go-cid) -[![Coverage Status](https://coveralls.io/repos/github/ipfs/go-cid/badge.svg?branch=master)](https://coveralls.io/github/ipfs/go-cid?branch=master) -[![Travis CI](https://travis-ci.org/ipfs/go-cid.svg?branch=master)](https://travis-ci.org/ipfs/go-cid) - -> A package to handle content IDs in Go. - -This is an implementation in Go of the [CID spec](https://github.com/ipld/cid). -It is used in `go-ipfs` and related packages to refer to a typed hunk of data. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-cid` is a standard Go module which can be installed with: - -```sh -go get github.com/ipfs/go-cid -``` - -Note that `go-cid` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section). - -## Usage - -### Using Gx and Gx-go - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project it is recommended that you: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/ipfs/go-cid -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -### Running tests - -Before running tests, please run: - -```sh -make deps -``` - -This will make sure that dependencies are rewritten to known working versions. - -### Examples - -#### Parsing string input from users - -```go -// Create a cid from a marshaled string -c, err := cid.Decode("bafzbeigai3eoy2ccc7ybwjfz5r3rdxqrinwi4rwytly24tdbh6yk7zslrm") -if err != nil {...} - -fmt.Println("Got CID: ", c) -``` - -#### Creating a CID from scratch - -```go -// Create a cid manually by specifying the 'prefix' parameters -pref := cid.Prefix{ - Version: 1, - Codec: cid.Raw, - MhType: mh.SHA2_256, - MhLength: -1, // default length -} - -// And then feed it some data -c, err := pref.Sum([]byte("Hello World!")) -if err != nil {...} - -fmt.Println("Created CID: ", c) -``` - -#### Check if two CIDs match - -```go -// To test if two cid's are equivalent, be sure to use the 'Equals' method: -if c1.Equals(c2) { - fmt.Println("These two refer to the same exact data!") -} -``` - -#### Check if some data matches a given CID - -```go -// To check if some data matches a given cid, -// Get your CIDs prefix, and use that to sum the data in question: -other, err := c.Prefix().Sum(mydata) -if err != nil {...} - -if !c.Equals(other) { - fmt.Println("This data is different.") -} - -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson diff --git a/vendor/github.com/ipfs/go-cid/builder.go b/vendor/github.com/ipfs/go-cid/builder.go deleted file mode 100644 index a1688327..00000000 --- a/vendor/github.com/ipfs/go-cid/builder.go +++ /dev/null @@ -1,74 +0,0 @@ -package cid - -import ( - mh "github.com/multiformats/go-multihash" -) - -type Builder interface { - Sum(data []byte) (Cid, error) - GetCodec() uint64 - WithCodec(uint64) Builder -} - -type V0Builder struct{} - -type V1Builder struct { - Codec uint64 - MhType uint64 - MhLength int // MhLength <= 0 means the default length -} - -func (p Prefix) GetCodec() uint64 { - return p.Codec -} - -func (p Prefix) WithCodec(c uint64) Builder { - if c == p.Codec { - return p - } - p.Codec = c - if c != DagProtobuf { - p.Version = 1 - } - return p -} - -func (p V0Builder) Sum(data []byte) (Cid, error) { - hash, err := mh.Sum(data, mh.SHA2_256, -1) - if err != nil { - return Undef, err - } - return NewCidV0(hash), nil -} - -func (p V0Builder) GetCodec() uint64 { - return DagProtobuf -} - -func (p V0Builder) WithCodec(c uint64) Builder { - if c == DagProtobuf { - return p - } - return V1Builder{Codec: c, MhType: mh.SHA2_256} -} - -func (p V1Builder) Sum(data []byte) (Cid, error) { - mhLen := p.MhLength - if mhLen <= 0 { - mhLen = -1 - } - hash, err := mh.Sum(data, p.MhType, mhLen) - if err != nil { - return Undef, err - } - return NewCidV1(p.Codec, hash), nil -} - -func (p V1Builder) GetCodec() uint64 { - return p.Codec -} - -func (p V1Builder) WithCodec(c uint64) Builder { - p.Codec = c - return p -} diff --git a/vendor/github.com/ipfs/go-cid/cid.go b/vendor/github.com/ipfs/go-cid/cid.go deleted file mode 100644 index 6b62d30d..00000000 --- a/vendor/github.com/ipfs/go-cid/cid.go +++ /dev/null @@ -1,601 +0,0 @@ -// Package cid implements the Content-IDentifiers specification -// (https://github.com/ipld/cid) in Go. CIDs are -// self-describing content-addressed identifiers useful for -// distributed information systems. CIDs are used in the IPFS -// (https://ipfs.io) project ecosystem. -// -// CIDs have two major versions. A CIDv0 corresponds to a multihash of type -// DagProtobuf, is deprecated and exists for compatibility reasons. Usually, -// CIDv1 should be used. -// -// A CIDv1 has four parts: -// -// ::= -// -// As shown above, the CID implementation relies heavily on Multiformats, -// particularly Multibase -// (https://github.com/multiformats/go-multibase), Multicodec -// (https://github.com/multiformats/multicodec) and Multihash -// implementations (https://github.com/multiformats/go-multihash). -package cid - -import ( - "bytes" - "encoding" - "encoding/binary" - "encoding/json" - "errors" - "fmt" - "strings" - - mbase "github.com/multiformats/go-multibase" - mh "github.com/multiformats/go-multihash" -) - -// UnsupportedVersionString just holds an error message -const UnsupportedVersionString = "" - -var ( - // ErrVarintBuffSmall means that a buffer passed to the cid parser was not - // long enough, or did not contain an invalid cid - ErrVarintBuffSmall = errors.New("reading varint: buffer too small") - - // ErrVarintTooBig means that the varint in the given cid was above the - // limit of 2^64 - ErrVarintTooBig = errors.New("reading varint: varint bigger than 64bits" + - " and not supported") - - // ErrCidTooShort means that the cid passed to decode was not long - // enough to be a valid Cid - ErrCidTooShort = errors.New("cid too short") - - // ErrInvalidEncoding means that selected encoding is not supported - // by this Cid version - ErrInvalidEncoding = errors.New("invalid base encoding") -) - -// These are multicodec-packed content types. The should match -// the codes described in the authoritative document: -// https://github.com/multiformats/multicodec/blob/master/table.csv -const ( - Raw = 0x55 - - DagProtobuf = 0x70 - DagCBOR = 0x71 - - GitRaw = 0x78 - - EthBlock = 0x90 - EthBlockList = 0x91 - EthTxTrie = 0x92 - EthTx = 0x93 - EthTxReceiptTrie = 0x94 - EthTxReceipt = 0x95 - EthStateTrie = 0x96 - EthAccountSnapshot = 0x97 - EthStorageTrie = 0x98 - BitcoinBlock = 0xb0 - BitcoinTx = 0xb1 - ZcashBlock = 0xc0 - ZcashTx = 0xc1 - DecredBlock = 0xe0 - DecredTx = 0xe1 - DashBlock = 0xf0 - DashTx = 0xf1 -) - -// Codecs maps the name of a codec to its type -var Codecs = map[string]uint64{ - "v0": DagProtobuf, - "raw": Raw, - "protobuf": DagProtobuf, - "cbor": DagCBOR, - "git-raw": GitRaw, - "eth-block": EthBlock, - "eth-block-list": EthBlockList, - "eth-tx-trie": EthTxTrie, - "eth-tx": EthTx, - "eth-tx-receipt-trie": EthTxReceiptTrie, - "eth-tx-receipt": EthTxReceipt, - "eth-state-trie": EthStateTrie, - "eth-account-snapshot": EthAccountSnapshot, - "eth-storage-trie": EthStorageTrie, - "bitcoin-block": BitcoinBlock, - "bitcoin-tx": BitcoinTx, - "zcash-block": ZcashBlock, - "zcash-tx": ZcashTx, - "decred-block": DecredBlock, - "decred-tx": DecredTx, - "dash-block": DashBlock, - "dash-tx": DashTx, -} - -// CodecToStr maps the numeric codec to its name -var CodecToStr = map[uint64]string{ - Raw: "raw", - DagProtobuf: "protobuf", - DagCBOR: "cbor", - GitRaw: "git-raw", - EthBlock: "eth-block", - EthBlockList: "eth-block-list", - EthTxTrie: "eth-tx-trie", - EthTx: "eth-tx", - EthTxReceiptTrie: "eth-tx-receipt-trie", - EthTxReceipt: "eth-tx-receipt", - EthStateTrie: "eth-state-trie", - EthAccountSnapshot: "eth-account-snapshot", - EthStorageTrie: "eth-storage-trie", - BitcoinBlock: "bitcoin-block", - BitcoinTx: "bitcoin-tx", - ZcashBlock: "zcash-block", - ZcashTx: "zcash-tx", - DecredBlock: "decred-block", - DecredTx: "decred-tx", - DashBlock: "dash-block", - DashTx: "dash-tx", -} - -// NewCidV0 returns a Cid-wrapped multihash. -// They exist to allow IPFS to work with Cids while keeping -// compatibility with the plain-multihash format used used in IPFS. -// NewCidV1 should be used preferentially. -func NewCidV0(mhash mh.Multihash) Cid { - // Need to make sure hash is valid for CidV0 otherwise we will - // incorrectly detect it as CidV1 in the Version() method - dec, err := mh.Decode(mhash) - if err != nil { - panic(err) - } - if dec.Code != mh.SHA2_256 || dec.Length != 32 { - panic("invalid hash for cidv0") - } - return Cid{string(mhash)} -} - -// NewCidV1 returns a new Cid using the given multicodec-packed -// content type. -func NewCidV1(codecType uint64, mhash mh.Multihash) Cid { - hashlen := len(mhash) - // two 8 bytes (max) numbers plus hash - buf := make([]byte, 2*binary.MaxVarintLen64+hashlen) - n := binary.PutUvarint(buf, 1) - n += binary.PutUvarint(buf[n:], codecType) - cn := copy(buf[n:], mhash) - if cn != hashlen { - panic("copy hash length is inconsistent") - } - - return Cid{string(buf[:n+hashlen])} -} - -var _ encoding.BinaryMarshaler = Cid{} -var _ encoding.BinaryUnmarshaler = (*Cid)(nil) -var _ encoding.TextMarshaler = Cid{} -var _ encoding.TextUnmarshaler = (*Cid)(nil) - -// Cid represents a self-describing content addressed -// identifier. It is formed by a Version, a Codec (which indicates -// a multicodec-packed content type) and a Multihash. -type Cid struct{ str string } - -// Undef can be used to represent a nil or undefined Cid, using Cid{} -// directly is also acceptable. -var Undef = Cid{} - -// Defined returns true if a Cid is defined -// Calling any other methods on an undefined Cid will result in -// undefined behavior. -func (c Cid) Defined() bool { - return c.str != "" -} - -// Parse is a short-hand function to perform Decode, Cast etc... on -// a generic interface{} type. -func Parse(v interface{}) (Cid, error) { - switch v2 := v.(type) { - case string: - if strings.Contains(v2, "/ipfs/") { - return Decode(strings.Split(v2, "/ipfs/")[1]) - } - return Decode(v2) - case []byte: - return Cast(v2) - case mh.Multihash: - return NewCidV0(v2), nil - case Cid: - return v2, nil - default: - return Undef, fmt.Errorf("can't parse %+v as Cid", v2) - } -} - -// Decode parses a Cid-encoded string and returns a Cid object. -// For CidV1, a Cid-encoded string is primarily a multibase string: -// -// -// -// The base-encoded string represents a: -// -// -// -// Decode will also detect and parse CidV0 strings. Strings -// starting with "Qm" are considered CidV0 and treated directly -// as B58-encoded multihashes. -func Decode(v string) (Cid, error) { - if len(v) < 2 { - return Undef, ErrCidTooShort - } - - if len(v) == 46 && v[:2] == "Qm" { - hash, err := mh.FromB58String(v) - if err != nil { - return Undef, err - } - - return NewCidV0(hash), nil - } - - _, data, err := mbase.Decode(v) - if err != nil { - return Undef, err - } - - return Cast(data) -} - -// Extract the encoding from a Cid. If Decode on the same string did -// not return an error neither will this function. -func ExtractEncoding(v string) (mbase.Encoding, error) { - if len(v) < 2 { - return -1, ErrCidTooShort - } - - if len(v) == 46 && v[:2] == "Qm" { - return mbase.Base58BTC, nil - } - - encoding := mbase.Encoding(v[0]) - - // check encoding is valid - _, err := mbase.NewEncoder(encoding) - if err != nil { - return -1, err - } - - return encoding, nil -} - -func uvError(read int) error { - switch { - case read == 0: - return ErrVarintBuffSmall - case read < 0: - return ErrVarintTooBig - default: - return nil - } -} - -// Cast takes a Cid data slice, parses it and returns a Cid. -// For CidV1, the data buffer is in the form: -// -// -// -// CidV0 are also supported. In particular, data buffers starting -// with length 34 bytes, which starts with bytes [18,32...] are considered -// binary multihashes. -// -// Please use decode when parsing a regular Cid string, as Cast does not -// expect multibase-encoded data. Cast accepts the output of Cid.Bytes(). -func Cast(data []byte) (Cid, error) { - if len(data) == 34 && data[0] == 18 && data[1] == 32 { - h, err := mh.Cast(data) - if err != nil { - return Undef, err - } - - return NewCidV0(h), nil - } - - vers, n := binary.Uvarint(data) - if err := uvError(n); err != nil { - return Undef, err - } - - if vers != 1 { - return Undef, fmt.Errorf("expected 1 as the cid version number, got: %d", vers) - } - - _, cn := binary.Uvarint(data[n:]) - if err := uvError(cn); err != nil { - return Undef, err - } - - rest := data[n+cn:] - h, err := mh.Cast(rest) - if err != nil { - return Undef, err - } - - return Cid{string(data[0 : n+cn+len(h)])}, nil -} - -// UnmarshalBinary is equivalent to Cast(). It implements the -// encoding.BinaryUnmarshaler interface. -func (c *Cid) UnmarshalBinary(data []byte) error { - casted, err := Cast(data) - if err != nil { - return err - } - c.str = casted.str - return nil -} - -// UnmarshalText is equivalent to Decode(). It implements the -// encoding.TextUnmarshaler interface. -func (c *Cid) UnmarshalText(text []byte) error { - decodedCid, err := Decode(string(text)) - if err != nil { - return err - } - c.str = decodedCid.str - return nil -} - -// Version returns the Cid version. -func (c Cid) Version() uint64 { - if len(c.str) == 34 && c.str[0] == 18 && c.str[1] == 32 { - return 0 - } - return 1 -} - -// Type returns the multicodec-packed content type of a Cid. -func (c Cid) Type() uint64 { - if c.Version() == 0 { - return DagProtobuf - } - _, n := uvarint(c.str) - codec, _ := uvarint(c.str[n:]) - return codec -} - -// String returns the default string representation of a -// Cid. Currently, Base58 is used as the encoding for the -// multibase string. -func (c Cid) String() string { - switch c.Version() { - case 0: - return c.Hash().B58String() - case 1: - mbstr, err := mbase.Encode(mbase.Base32, c.Bytes()) - if err != nil { - panic("should not error with hardcoded mbase: " + err.Error()) - } - - return mbstr - default: - panic("not possible to reach this point") - } -} - -// String returns the string representation of a Cid -// encoded is selected base -func (c Cid) StringOfBase(base mbase.Encoding) (string, error) { - switch c.Version() { - case 0: - if base != mbase.Base58BTC { - return "", ErrInvalidEncoding - } - return c.Hash().B58String(), nil - case 1: - return mbase.Encode(base, c.Bytes()) - default: - panic("not possible to reach this point") - } -} - -// Encode return the string representation of a Cid in a given base -// when applicable. Version 0 Cid's are always in Base58 as they do -// not take a multibase prefix. -func (c Cid) Encode(base mbase.Encoder) string { - switch c.Version() { - case 0: - return c.Hash().B58String() - case 1: - return base.Encode(c.Bytes()) - default: - panic("not possible to reach this point") - } -} - -// Hash returns the multihash contained by a Cid. -func (c Cid) Hash() mh.Multihash { - bytes := c.Bytes() - - if c.Version() == 0 { - return mh.Multihash(bytes) - } - - // skip version length - _, n1 := binary.Uvarint(bytes) - // skip codec length - _, n2 := binary.Uvarint(bytes[n1:]) - - return mh.Multihash(bytes[n1+n2:]) -} - -// Bytes returns the byte representation of a Cid. -// The output of bytes can be parsed back into a Cid -// with Cast(). -func (c Cid) Bytes() []byte { - return []byte(c.str) -} - -// MarshalBinary is equivalent to Bytes(). It implements the -// encoding.BinaryMarshaler interface. -func (c Cid) MarshalBinary() ([]byte, error) { - return c.Bytes(), nil -} - -// MarshalText is equivalent to String(). It implements the -// encoding.TextMarshaler interface. -func (c Cid) MarshalText() ([]byte, error) { - return []byte(c.String()), nil -} - -// Equals checks that two Cids are the same. -// In order for two Cids to be considered equal, the -// Version, the Codec and the Multihash must match. -func (c Cid) Equals(o Cid) bool { - return c == o -} - -// UnmarshalJSON parses the JSON representation of a Cid. -func (c *Cid) UnmarshalJSON(b []byte) error { - if len(b) < 2 { - return fmt.Errorf("invalid cid json blob") - } - obj := struct { - CidTarget string `json:"/"` - }{} - objptr := &obj - err := json.Unmarshal(b, &objptr) - if err != nil { - return err - } - if objptr == nil { - *c = Cid{} - return nil - } - - if obj.CidTarget == "" { - return fmt.Errorf("cid was incorrectly formatted") - } - - out, err := Decode(obj.CidTarget) - if err != nil { - return err - } - - *c = out - - return nil -} - -// MarshalJSON procudes a JSON representation of a Cid, which looks as follows: -// -// { "/": "" } -// -// Note that this formatting comes from the IPLD specification -// (https://github.com/ipld/specs/tree/master/ipld) -func (c Cid) MarshalJSON() ([]byte, error) { - if !c.Defined() { - return []byte("null"), nil - } - return []byte(fmt.Sprintf("{\"/\":\"%s\"}", c.String())), nil -} - -// KeyString returns the binary representation of the Cid as a string -func (c Cid) KeyString() string { - return c.str -} - -// Loggable returns a Loggable (as defined by -// https://godoc.org/github.com/ipfs/go-log). -func (c Cid) Loggable() map[string]interface{} { - return map[string]interface{}{ - "cid": c, - } -} - -// Prefix builds and returns a Prefix out of a Cid. -func (c Cid) Prefix() Prefix { - dec, _ := mh.Decode(c.Hash()) // assuming we got a valid multiaddr, this will not error - return Prefix{ - MhType: dec.Code, - MhLength: dec.Length, - Version: c.Version(), - Codec: c.Type(), - } -} - -// Prefix represents all the metadata of a Cid, -// that is, the Version, the Codec, the Multihash type -// and the Multihash length. It does not contains -// any actual content information. -// NOTE: The use -1 in MhLength to mean default length is deprecated, -// use the V0Builder or V1Builder structures instead -type Prefix struct { - Version uint64 - Codec uint64 - MhType uint64 - MhLength int -} - -// Sum uses the information in a prefix to perform a multihash.Sum() -// and return a newly constructed Cid with the resulting multihash. -func (p Prefix) Sum(data []byte) (Cid, error) { - length := p.MhLength - if p.MhType == mh.ID { - length = -1 - } - - hash, err := mh.Sum(data, p.MhType, length) - if err != nil { - return Undef, err - } - - switch p.Version { - case 0: - return NewCidV0(hash), nil - case 1: - return NewCidV1(p.Codec, hash), nil - default: - return Undef, fmt.Errorf("invalid cid version") - } -} - -// Bytes returns a byte representation of a Prefix. It looks like: -// -// -func (p Prefix) Bytes() []byte { - buf := make([]byte, 4*binary.MaxVarintLen64) - n := binary.PutUvarint(buf, p.Version) - n += binary.PutUvarint(buf[n:], p.Codec) - n += binary.PutUvarint(buf[n:], uint64(p.MhType)) - n += binary.PutUvarint(buf[n:], uint64(p.MhLength)) - return buf[:n] -} - -// PrefixFromBytes parses a Prefix-byte representation onto a -// Prefix. -func PrefixFromBytes(buf []byte) (Prefix, error) { - r := bytes.NewReader(buf) - vers, err := binary.ReadUvarint(r) - if err != nil { - return Prefix{}, err - } - - codec, err := binary.ReadUvarint(r) - if err != nil { - return Prefix{}, err - } - - mhtype, err := binary.ReadUvarint(r) - if err != nil { - return Prefix{}, err - } - - mhlen, err := binary.ReadUvarint(r) - if err != nil { - return Prefix{}, err - } - - return Prefix{ - Version: vers, - Codec: codec, - MhType: mhtype, - MhLength: int(mhlen), - }, nil -} diff --git a/vendor/github.com/ipfs/go-cid/cid_fuzz.go b/vendor/github.com/ipfs/go-cid/cid_fuzz.go deleted file mode 100644 index 99842b53..00000000 --- a/vendor/github.com/ipfs/go-cid/cid_fuzz.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build gofuzz - -package cid - -func Fuzz(data []byte) int { - cid, err := Cast(data) - - if err != nil { - return 0 - } - - _ = cid.Bytes() - _ = cid.String() - p := cid.Prefix() - _ = p.Bytes() - - if !cid.Equals(cid) { - panic("inequality") - } - - // json loop - json, err := cid.MarshalJSON() - if err != nil { - panic(err.Error()) - } - cid2 := Cid{} - err = cid2.UnmarshalJSON(json) - if err != nil { - panic(err.Error()) - } - - if !cid.Equals(cid2) { - panic("json loop not equal") - } - - return 1 -} diff --git a/vendor/github.com/ipfs/go-cid/codecov.yml b/vendor/github.com/ipfs/go-cid/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-cid/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-cid/deprecated.go b/vendor/github.com/ipfs/go-cid/deprecated.go deleted file mode 100644 index cd889f98..00000000 --- a/vendor/github.com/ipfs/go-cid/deprecated.go +++ /dev/null @@ -1,28 +0,0 @@ -package cid - -import ( - mh "github.com/multiformats/go-multihash" -) - -// NewPrefixV0 returns a CIDv0 prefix with the specified multihash type. -// DEPRECATED: Use V0Builder -func NewPrefixV0(mhType uint64) Prefix { - return Prefix{ - MhType: mhType, - MhLength: mh.DefaultLengths[mhType], - Version: 0, - Codec: DagProtobuf, - } -} - -// NewPrefixV1 returns a CIDv1 prefix with the specified codec and multihash -// type. -// DEPRECATED: Use V1Builder -func NewPrefixV1(codecType uint64, mhType uint64) Prefix { - return Prefix{ - MhType: mhType, - MhLength: mh.DefaultLengths[mhType], - Version: 1, - Codec: codecType, - } -} diff --git a/vendor/github.com/ipfs/go-cid/go.mod b/vendor/github.com/ipfs/go-cid/go.mod deleted file mode 100644 index 8e1b5f47..00000000 --- a/vendor/github.com/ipfs/go-cid/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-cid - -require ( - github.com/multiformats/go-multibase v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-cid/go.sum b/vendor/github.com/ipfs/go-cid/go.sum deleted file mode 100644 index d6043b8b..00000000 --- a/vendor/github.com/ipfs/go-cid/go.sum +++ /dev/null @@ -1,20 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-cid/package.json b/vendor/github.com/ipfs/go-cid/package.json deleted file mode 100644 index c98a77ee..00000000 --- a/vendor/github.com/ipfs/go-cid/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/ipfs/go-cid" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-cid" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "whyrusleeping", - "hash": "QmekxXDhCxCJRNuzmHreuaT3BsuJcsjcXWNrtV9C8DRHtd", - "name": "go-multibase", - "version": "0.3.0" - } - ], - "gxVersion": "0.8.0", - "language": "go", - "license": "MIT", - "name": "go-cid", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.9.3" -} - diff --git a/vendor/github.com/ipfs/go-cid/set.go b/vendor/github.com/ipfs/go-cid/set.go deleted file mode 100644 index eb3b3f0d..00000000 --- a/vendor/github.com/ipfs/go-cid/set.go +++ /dev/null @@ -1,65 +0,0 @@ -package cid - -// Set is a implementation of a set of Cids, that is, a structure -// to which holds a single copy of every Cids that is added to it. -type Set struct { - set map[Cid]struct{} -} - -// NewSet initializes and returns a new Set. -func NewSet() *Set { - return &Set{set: make(map[Cid]struct{})} -} - -// Add puts a Cid in the Set. -func (s *Set) Add(c Cid) { - s.set[c] = struct{}{} -} - -// Has returns if the Set contains a given Cid. -func (s *Set) Has(c Cid) bool { - _, ok := s.set[c] - return ok -} - -// Remove deletes a Cid from the Set. -func (s *Set) Remove(c Cid) { - delete(s.set, c) -} - -// Len returns how many elements the Set has. -func (s *Set) Len() int { - return len(s.set) -} - -// Keys returns the Cids in the set. -func (s *Set) Keys() []Cid { - out := make([]Cid, 0, len(s.set)) - for k := range s.set { - out = append(out, k) - } - return out -} - -// Visit adds a Cid to the set only if it is -// not in it already. -func (s *Set) Visit(c Cid) bool { - if !s.Has(c) { - s.Add(c) - return true - } - - return false -} - -// ForEach allows to run a custom function on each -// Cid in the set. -func (s *Set) ForEach(f func(c Cid) error) error { - for c := range s.set { - err := f(c) - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-cid/varint.go b/vendor/github.com/ipfs/go-cid/varint.go deleted file mode 100644 index 391c1f4d..00000000 --- a/vendor/github.com/ipfs/go-cid/varint.go +++ /dev/null @@ -1,34 +0,0 @@ -package cid - -// Version of varint function that work with a string rather than -// []byte to avoid unnecessary allocation - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license as given at https://golang.org/LICENSE - -// uvarint decodes a uint64 from buf and returns that value and the -// number of characters read (> 0). If an error occurred, the value is 0 -// and the number of bytes n is <= 0 meaning: -// -// n == 0: buf too small -// n < 0: value larger than 64 bits (overflow) -// and -n is the number of bytes read -// -func uvarint(buf string) (uint64, int) { - var x uint64 - var s uint - // we have a binary string so we can't use a range loope - for i := 0; i < len(buf); i++ { - b := buf[i] - if b < 0x80 { - if i > 9 || i == 9 && b > 1 { - return 0, -(i + 1) // overflow - } - return x | uint64(b)< go-cidutil implements various utilities and helper functions for working with CIDs - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-cidutil/codecov.yml b/vendor/github.com/ipfs/go-cidutil/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-cidutil/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-cidutil/format.go b/vendor/github.com/ipfs/go-cidutil/format.go deleted file mode 100644 index 21e157df..00000000 --- a/vendor/github.com/ipfs/go-cidutil/format.go +++ /dev/null @@ -1,197 +0,0 @@ -package cidutil - -import ( - "bytes" - "fmt" - - c "github.com/ipfs/go-cid" - mb "github.com/multiformats/go-multibase" - mh "github.com/multiformats/go-multihash" -) - -// FormatRef is a string documenting the format string for the Format function -const FormatRef = ` - %% literal % - %b multibase name - %B multibase code - %v version string - %V version number - %c codec name - %C codec code - %h multihash name - %H multihash code - %L hash digest length - %m multihash encoded in base %b (with multibase prefix) - %M multihash encoded in base %b without multibase prefix - %d hash digest encoded in base %b (with multibase prefix) - %D hash digest encoded in base %b without multibase prefix - %s cid string encoded in base %b (1) - %S cid string encoded in base %b without multibase prefix - %P cid prefix: %v-%c-%h-%L - -(1) For CID version 0 the multibase must be base58btc and no prefix is -used. For Cid version 1 the multibase prefix is included. -` - -// Format formats a cid according to the format specificer as -// documented in the FormatRef constant -func Format(fmtStr string, base mb.Encoding, cid c.Cid) (string, error) { - p := cid.Prefix() - var out bytes.Buffer - var err error - encoder, err := mb.NewEncoder(base) - if err != nil { - return "", err - } - for i := 0; i < len(fmtStr); i++ { - if fmtStr[i] != '%' { - out.WriteByte(fmtStr[i]) - continue - } - i++ - if i >= len(fmtStr) { - return "", FormatStringError{"premature end of format string", ""} - } - switch fmtStr[i] { - case '%': - out.WriteByte('%') - case 'b': // base name - out.WriteString(baseToString(base)) - case 'B': // base code - out.WriteByte(byte(base)) - case 'v': // version string - fmt.Fprintf(&out, "cidv%d", p.Version) - case 'V': // version num - fmt.Fprintf(&out, "%d", p.Version) - case 'c': // codec name - out.WriteString(codecToString(p.Codec)) - case 'C': // codec code - fmt.Fprintf(&out, "%d", p.Codec) - case 'h': // hash fun name - out.WriteString(hashToString(p.MhType)) - case 'H': // hash fun code - fmt.Fprintf(&out, "%d", p.MhType) - case 'L': // hash length - fmt.Fprintf(&out, "%d", p.MhLength) - case 'm', 'M': // multihash encoded in base %b - out.WriteString(encode(encoder, cid.Hash(), fmtStr[i] == 'M')) - case 'd', 'D': // hash digest encoded in base %b - dec, err := mh.Decode(cid.Hash()) - if err != nil { - return "", err - } - out.WriteString(encode(encoder, dec.Digest, fmtStr[i] == 'D')) - case 's': // cid string encoded in base %b - str, err := cid.StringOfBase(base) - if err != nil { - return "", err - } - out.WriteString(str) - case 'S': // cid string without base prefix - out.WriteString(encode(encoder, cid.Bytes(), true)) - case 'P': // prefix - fmt.Fprintf(&out, "cidv%d-%s-%s-%d", - p.Version, - codecToString(p.Codec), - hashToString(p.MhType), - p.MhLength, - ) - default: - return "", FormatStringError{"unrecognized specifier in format string", fmtStr[i-1 : i+1]} - } - - } - return out.String(), err -} - -// FormatStringError is the error return from Format when the format -// string is ill formed -type FormatStringError struct { - Message string - Specifier string -} - -func (e FormatStringError) Error() string { - if e.Specifier == "" { - return e.Message - } else { - return fmt.Sprintf("%s: %s", e.Message, e.Specifier) - } -} - -func baseToString(base mb.Encoding) string { - baseStr, ok := mb.EncodingToStr[base] - if !ok { - return fmt.Sprintf("base?%c", base) - } - return baseStr -} - -func codecToString(num uint64) string { - name, ok := c.CodecToStr[num] - if !ok { - return fmt.Sprintf("codec?%d", num) - } - return name -} - -func hashToString(num uint64) string { - name, ok := mh.Codes[num] - if !ok { - return fmt.Sprintf("hash?%d", num) - } - return name -} - -func encode(base mb.Encoder, data []byte, strip bool) string { - str := base.Encode(data) - if strip { - return str[1:] - } - return str -} - -// ScanForCid scans bytes for anything resembling a CID. If one is -// found `i` will point to the begging of the cid and `j` to to the -// end and the cid will be returned, otherwise `i` and `j` will point -// the end of the buffer and the cid will be `Undef`. -func ScanForCid(buf []byte) (i, j int, cid c.Cid, cidStr string) { - i = 0 - for { - i = j - for i < len(buf) && !asciiIsAlpha(buf[i]) { - i++ - } - j = i - if i == len(buf) { - return - } - for j < len(buf) && asciiIsAlpha(buf[j]) { - j++ - } - if j-i <= 1 || j-i > 128 || !supported[buf[i]] { - continue - } - var err error - cidStr = string(buf[i:j]) - cid, err = c.Decode(cidStr) - if err == nil { - return - } - } -} - -var supported = make([]bool, 256) - -func init() { - // for now base64 encoding are not supported as they contain non - // alhphanumeric characters - supportedPrefixes := []byte("QfFbBcCvVtThzZ") - for _, b := range supportedPrefixes { - supported[b] = true - } -} - -func asciiIsAlpha(b byte) bool { - return ('A' <= b && b <= 'Z') || ('a' <= b && b <= 'z') || ('0' <= b && b <= '9') -} diff --git a/vendor/github.com/ipfs/go-cidutil/go.mod b/vendor/github.com/ipfs/go-cidutil/go.mod deleted file mode 100644 index 73ce4c91..00000000 --- a/vendor/github.com/ipfs/go-cidutil/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-cidutil - -require ( - github.com/ipfs/go-cid v0.0.2 - github.com/multiformats/go-multibase v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-cidutil/go.sum b/vendor/github.com/ipfs/go-cidutil/go.sum deleted file mode 100644 index 7319f155..00000000 --- a/vendor/github.com/ipfs/go-cidutil/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-cidutil/inline.go b/vendor/github.com/ipfs/go-cidutil/inline.go deleted file mode 100644 index d140e114..00000000 --- a/vendor/github.com/ipfs/go-cidutil/inline.go +++ /dev/null @@ -1,26 +0,0 @@ -package cidutil - -import ( - cid "github.com/ipfs/go-cid" - mhash "github.com/multiformats/go-multihash" -) - -// InlineBuilder is a cid.Builder that will use the id multihash when the -// size of the content is no more than limit -type InlineBuilder struct { - cid.Builder // Parent Builder - Limit int // Limit (inclusive) -} - -// WithCodec implements the cid.Builder interface -func (p InlineBuilder) WithCodec(c uint64) cid.Builder { - return InlineBuilder{p.Builder.WithCodec(c), p.Limit} -} - -// Sum implements the cid.Builder interface -func (p InlineBuilder) Sum(data []byte) (cid.Cid, error) { - if len(data) > p.Limit { - return p.Builder.Sum(data) - } - return cid.V1Builder{Codec: p.GetCodec(), MhType: mhash.ID}.Sum(data) -} diff --git a/vendor/github.com/ipfs/go-cidutil/package.json b/vendor/github.com/ipfs/go-cidutil/package.json deleted file mode 100644 index a286ee0e..00000000 --- a/vendor/github.com/ipfs/go-cidutil/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "author": "kevina", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/ipfs/go-cidutil" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "whyrusleeping", - "hash": "QmekxXDhCxCJRNuzmHreuaT3BsuJcsjcXWNrtV9C8DRHtd", - "name": "go-multibase", - "version": "0.3.0" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-cidutil", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.2.1" -} - diff --git a/vendor/github.com/ipfs/go-cidutil/set.go b/vendor/github.com/ipfs/go-cidutil/set.go deleted file mode 100644 index ea812a13..00000000 --- a/vendor/github.com/ipfs/go-cidutil/set.go +++ /dev/null @@ -1,42 +0,0 @@ -package cidutil - -import ( - "context" - - c "github.com/ipfs/go-cid" -) - -type Set = c.Set - -func NewSet() *Set { return c.NewSet() } - -// StreamingSet is an extension of Set which allows to implement back-pressure -// for the Visit function -type StreamingSet struct { - Set *Set - New chan c.Cid -} - -// NewStreamingSet initializes and returns new Set. -func NewStreamingSet() *StreamingSet { - return &StreamingSet{ - Set: c.NewSet(), - New: make(chan c.Cid), - } -} - -// Visitor creates new visitor which adds a Cids to the set and emits them to -// the set.New channel -func (s *StreamingSet) Visitor(ctx context.Context) func(c c.Cid) bool { - return func(c c.Cid) bool { - if s.Set.Visit(c) { - select { - case s.New <- c: - case <-ctx.Done(): - } - return true - } - - return false - } -} diff --git a/vendor/github.com/ipfs/go-cidutil/slice.go b/vendor/github.com/ipfs/go-cidutil/slice.go deleted file mode 100644 index fa39b64d..00000000 --- a/vendor/github.com/ipfs/go-cidutil/slice.go +++ /dev/null @@ -1,30 +0,0 @@ -package cidutil - -import ( - "github.com/ipfs/go-cid" - "sort" -) - -// Slice is a convenience type for sorting CIDs -type Slice []cid.Cid - -func (s Slice) Len() int { - return len(s) -} - -func (s Slice) Less(i, j int) bool { - return s[i].KeyString() < s[j].KeyString() -} - -func (s Slice) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s Slice) Sort() { - sort.Sort(s) -} - -// Sort sorts a slice of CIDs -func Sort(s []cid.Cid) { - Slice(s).Sort() -} diff --git a/vendor/github.com/ipfs/go-datastore/.gitignore b/vendor/github.com/ipfs/go-datastore/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/ipfs/go-datastore/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/ipfs/go-datastore/.travis.yml b/vendor/github.com/ipfs/go-datastore/.travis.yml deleted file mode 100644 index 30dc421c..00000000 --- a/vendor/github.com/ipfs/go-datastore/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race -cpu=5" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-datastore/LICENSE b/vendor/github.com/ipfs/go-datastore/LICENSE deleted file mode 100644 index f2049023..00000000 --- a/vendor/github.com/ipfs/go-datastore/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-datastore/Makefile b/vendor/github.com/ipfs/go-datastore/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/ipfs/go-datastore/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/ipfs/go-datastore/README.md b/vendor/github.com/ipfs/go-datastore/README.md deleted file mode 100644 index 0f7a3c19..00000000 --- a/vendor/github.com/ipfs/go-datastore/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# go-datastore - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-datastore?status.svg)](https://godoc.org/github.com/ipfs/go-datastore) - -> key-value datastore interfaces - -datastore is a generic layer of abstraction for data store and database access. It is a simple API with the aim to enable application development in a datastore-agnostic way, allowing datastores to be swapped seamlessly without changing application code. Thus, one can leverage different datastores with different strengths without committing the application to one datastore throughout its lifetime. - -In addition, grouped datastores significantly simplify interesting data access patterns (such as caching and sharding). - -Based on [datastore.py](https://github.com/datastore/datastore). - -## Documentation - -https://godoc.org/github.com/ipfs/go-datastore - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-datastore/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - diff --git a/vendor/github.com/ipfs/go-datastore/autobatch/README.md b/vendor/github.com/ipfs/go-datastore/autobatch/README.md deleted file mode 100644 index 9b805aba..00000000 --- a/vendor/github.com/ipfs/go-datastore/autobatch/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# autobatch - -Autobatch is an implementation of -[go-datastore](https://github.com/ipfs/go-datastore) that automatically batches -together writes by holding puts in memory until a certain threshold is met. -This can improve disk performance at the cost of memory in certain situations. - -## Usage - -Simply wrap your existing datastore in an autobatching layer like so: - -```go -bds := NewAutoBatching(basedstore, 128) -``` - -And make all future calls to the autobatching object. - -## License -MIT diff --git a/vendor/github.com/ipfs/go-datastore/autobatch/autobatch.go b/vendor/github.com/ipfs/go-datastore/autobatch/autobatch.go deleted file mode 100644 index aeca9a45..00000000 --- a/vendor/github.com/ipfs/go-datastore/autobatch/autobatch.go +++ /dev/null @@ -1,143 +0,0 @@ -// Package autobatch provides a go-datastore implementation that -// automatically batches together writes by holding puts in memory until -// a certain threshold is met. -package autobatch - -import ( - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" -) - -// Datastore implements a go-datatsore. -type Datastore struct { - child ds.Batching - - // TODO: discuss making ds.Batch implement the full ds.Datastore interface - buffer map[ds.Key]op - maxBufferEntries int -} - -type op struct { - delete bool - value []byte -} - -// NewAutoBatching returns a new datastore that automatically -// batches writes using the given Batching datastore. The size -// of the memory pool is given by size. -func NewAutoBatching(d ds.Batching, size int) *Datastore { - return &Datastore{ - child: d, - buffer: make(map[ds.Key]op, size), - maxBufferEntries: size, - } -} - -// Delete deletes a key/value -func (d *Datastore) Delete(k ds.Key) error { - d.buffer[k] = op{delete: true} - if len(d.buffer) > d.maxBufferEntries { - return d.Flush() - } - return nil -} - -// Get retrieves a value given a key. -func (d *Datastore) Get(k ds.Key) ([]byte, error) { - o, ok := d.buffer[k] - if ok { - if o.delete { - return nil, ds.ErrNotFound - } - return o.value, nil - } - - return d.child.Get(k) -} - -// Put stores a key/value. -func (d *Datastore) Put(k ds.Key, val []byte) error { - d.buffer[k] = op{value: val} - if len(d.buffer) > d.maxBufferEntries { - return d.Flush() - } - return nil -} - -// Flush flushes the current batch to the underlying datastore. -func (d *Datastore) Flush() error { - b, err := d.child.Batch() - if err != nil { - return err - } - - for k, o := range d.buffer { - var err error - if o.delete { - err = b.Delete(k) - if err == ds.ErrNotFound { - // Ignore these, let delete be idempotent. - err = nil - } - } else { - err = b.Put(k, o.value) - } - if err != nil { - return err - } - } - // clear out buffer - d.buffer = make(map[ds.Key]op, d.maxBufferEntries) - - return b.Commit() -} - -// Has checks if a key is stored. -func (d *Datastore) Has(k ds.Key) (bool, error) { - o, ok := d.buffer[k] - if ok { - return !o.delete, nil - } - - return d.child.Has(k) -} - -// GetSize implements Datastore.GetSize -func (d *Datastore) GetSize(k ds.Key) (int, error) { - o, ok := d.buffer[k] - if ok { - if o.delete { - return -1, ds.ErrNotFound - } - return len(o.value), nil - } - - return d.child.GetSize(k) -} - -// Query performs a query -func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) { - err := d.Flush() - if err != nil { - return nil, err - } - - return d.child.Query(q) -} - -// DiskUsage implements the PersistentDatastore interface. -func (d *Datastore) DiskUsage() (uint64, error) { - return ds.DiskUsage(d.child) -} - -func (d *Datastore) Close() error { - err1 := d.Flush() - err2 := d.child.Close() - if err1 != nil { - return err1 - } - if err2 != nil { - return err2 - } - return nil -} diff --git a/vendor/github.com/ipfs/go-datastore/basic_ds.go b/vendor/github.com/ipfs/go-datastore/basic_ds.go deleted file mode 100644 index 19b74e26..00000000 --- a/vendor/github.com/ipfs/go-datastore/basic_ds.go +++ /dev/null @@ -1,274 +0,0 @@ -package datastore - -import ( - "log" - - dsq "github.com/ipfs/go-datastore/query" -) - -// Here are some basic datastore implementations. - -// MapDatastore uses a standard Go map for internal storage. -type MapDatastore struct { - values map[Key][]byte -} - -// NewMapDatastore constructs a MapDatastore. It is _not_ thread-safe by -// default, wrap using sync.MutexWrap if you need thread safety (the answer here -// is usually yes). -func NewMapDatastore() (d *MapDatastore) { - return &MapDatastore{ - values: make(map[Key][]byte), - } -} - -// Put implements Datastore.Put -func (d *MapDatastore) Put(key Key, value []byte) (err error) { - d.values[key] = value - return nil -} - -// Get implements Datastore.Get -func (d *MapDatastore) Get(key Key) (value []byte, err error) { - val, found := d.values[key] - if !found { - return nil, ErrNotFound - } - return val, nil -} - -// Has implements Datastore.Has -func (d *MapDatastore) Has(key Key) (exists bool, err error) { - _, found := d.values[key] - return found, nil -} - -// GetSize implements Datastore.GetSize -func (d *MapDatastore) GetSize(key Key) (size int, err error) { - if v, found := d.values[key]; found { - return len(v), nil - } - return -1, ErrNotFound -} - -// Delete implements Datastore.Delete -func (d *MapDatastore) Delete(key Key) (err error) { - if _, found := d.values[key]; !found { - return ErrNotFound - } - delete(d.values, key) - return nil -} - -// Query implements Datastore.Query -func (d *MapDatastore) Query(q dsq.Query) (dsq.Results, error) { - re := make([]dsq.Entry, 0, len(d.values)) - for k, v := range d.values { - e := dsq.Entry{Key: k.String()} - if !q.KeysOnly { - e.Value = v - } - re = append(re, e) - } - r := dsq.ResultsWithEntries(q, re) - r = dsq.NaiveQueryApply(q, r) - return r, nil -} - -func (d *MapDatastore) Batch() (Batch, error) { - return NewBasicBatch(d), nil -} - -func (d *MapDatastore) Close() error { - return nil -} - -// NullDatastore stores nothing, but conforms to the API. -// Useful to test with. -type NullDatastore struct { -} - -// NewNullDatastore constructs a null datastoe -func NewNullDatastore() *NullDatastore { - return &NullDatastore{} -} - -// Put implements Datastore.Put -func (d *NullDatastore) Put(key Key, value []byte) (err error) { - return nil -} - -// Get implements Datastore.Get -func (d *NullDatastore) Get(key Key) (value []byte, err error) { - return nil, ErrNotFound -} - -// Has implements Datastore.Has -func (d *NullDatastore) Has(key Key) (exists bool, err error) { - return false, nil -} - -// Has implements Datastore.GetSize -func (d *NullDatastore) GetSize(key Key) (size int, err error) { - return -1, ErrNotFound -} - -// Delete implements Datastore.Delete -func (d *NullDatastore) Delete(key Key) (err error) { - return nil -} - -// Query implements Datastore.Query -func (d *NullDatastore) Query(q dsq.Query) (dsq.Results, error) { - return dsq.ResultsWithEntries(q, nil), nil -} - -func (d *NullDatastore) Batch() (Batch, error) { - return NewBasicBatch(d), nil -} - -func (d *NullDatastore) Close() error { - return nil -} - -// LogDatastore logs all accesses through the datastore. -type LogDatastore struct { - Name string - child Datastore -} - -// Shim is a datastore which has a child. -type Shim interface { - Datastore - - Children() []Datastore -} - -// NewLogDatastore constructs a log datastore. -func NewLogDatastore(ds Datastore, name string) *LogDatastore { - if len(name) < 1 { - name = "LogDatastore" - } - return &LogDatastore{Name: name, child: ds} -} - -// Children implements Shim -func (d *LogDatastore) Children() []Datastore { - return []Datastore{d.child} -} - -// Put implements Datastore.Put -func (d *LogDatastore) Put(key Key, value []byte) (err error) { - log.Printf("%s: Put %s\n", d.Name, key) - // log.Printf("%s: Put %s ```%s```", d.Name, key, value) - return d.child.Put(key, value) -} - -// Get implements Datastore.Get -func (d *LogDatastore) Get(key Key) (value []byte, err error) { - log.Printf("%s: Get %s\n", d.Name, key) - return d.child.Get(key) -} - -// Has implements Datastore.Has -func (d *LogDatastore) Has(key Key) (exists bool, err error) { - log.Printf("%s: Has %s\n", d.Name, key) - return d.child.Has(key) -} - -// GetSize implements Datastore.GetSize -func (d *LogDatastore) GetSize(key Key) (size int, err error) { - log.Printf("%s: GetSize %s\n", d.Name, key) - return d.child.GetSize(key) -} - -// Delete implements Datastore.Delete -func (d *LogDatastore) Delete(key Key) (err error) { - log.Printf("%s: Delete %s\n", d.Name, key) - return d.child.Delete(key) -} - -// DiskUsage implements the PersistentDatastore interface. -func (d *LogDatastore) DiskUsage() (uint64, error) { - log.Printf("%s: DiskUsage\n", d.Name) - return DiskUsage(d.child) -} - -// Query implements Datastore.Query -func (d *LogDatastore) Query(q dsq.Query) (dsq.Results, error) { - log.Printf("%s: Query\n", d.Name) - log.Printf("%s: q.Prefix: %s\n", d.Name, q.Prefix) - log.Printf("%s: q.KeysOnly: %v\n", d.Name, q.KeysOnly) - log.Printf("%s: q.Filters: %d\n", d.Name, len(q.Filters)) - log.Printf("%s: q.Orders: %d\n", d.Name, len(q.Orders)) - log.Printf("%s: q.Offset: %d\n", d.Name, q.Offset) - - return d.child.Query(q) -} - -// LogBatch logs all accesses through the batch. -type LogBatch struct { - Name string - child Batch -} - -func (d *LogDatastore) Batch() (Batch, error) { - log.Printf("%s: Batch\n", d.Name) - if bds, ok := d.child.(Batching); ok { - b, err := bds.Batch() - - if err != nil { - return nil, err - } - return &LogBatch{ - Name: d.Name, - child: b, - }, nil - } - return nil, ErrBatchUnsupported -} - -// Put implements Batch.Put -func (d *LogBatch) Put(key Key, value []byte) (err error) { - log.Printf("%s: BatchPut %s\n", d.Name, key) - // log.Printf("%s: Put %s ```%s```", d.Name, key, value) - return d.child.Put(key, value) -} - -// Delete implements Batch.Delete -func (d *LogBatch) Delete(key Key) (err error) { - log.Printf("%s: BatchDelete %s\n", d.Name, key) - return d.child.Delete(key) -} - -// Commit implements Batch.Commit -func (d *LogBatch) Commit() (err error) { - log.Printf("%s: BatchCommit\n", d.Name) - return d.child.Commit() -} - -func (d *LogDatastore) Close() error { - log.Printf("%s: Close\n", d.Name) - return d.child.Close() -} - -func (d *LogDatastore) Check() error { - if c, ok := d.child.(CheckedDatastore); ok { - return c.Check() - } - return nil -} - -func (d *LogDatastore) Scrub() error { - if c, ok := d.child.(ScrubbedDatastore); ok { - return c.Scrub() - } - return nil -} - -func (d *LogDatastore) CollectGarbage() error { - if c, ok := d.child.(GCDatastore); ok { - return c.CollectGarbage() - } - return nil -} diff --git a/vendor/github.com/ipfs/go-datastore/batch.go b/vendor/github.com/ipfs/go-datastore/batch.go deleted file mode 100644 index 57880dd2..00000000 --- a/vendor/github.com/ipfs/go-datastore/batch.go +++ /dev/null @@ -1,52 +0,0 @@ -package datastore - -type op struct { - delete bool - value []byte -} - -// basicBatch implements the transaction interface for datastores who do -// not have any sort of underlying transactional support -type basicBatch struct { - ops map[Key]op - - target Datastore -} - -func NewBasicBatch(ds Datastore) Batch { - return &basicBatch{ - ops: make(map[Key]op), - target: ds, - } -} - -func (bt *basicBatch) Put(key Key, val []byte) error { - bt.ops[key] = op{value: val} - return nil -} - -func (bt *basicBatch) Delete(key Key) error { - bt.ops[key] = op{delete: true} - return nil -} - -func (bt *basicBatch) Commit() error { - var err error - for k, op := range bt.ops { - if op.delete { - err = bt.target.Delete(k) - // We could try to do something smarter but I really - // don't care. Delete should be idempotent anyways. - if err == ErrNotFound { - err = nil - } - } else { - err = bt.target.Put(k, op.value) - } - if err != nil { - break - } - } - - return err -} diff --git a/vendor/github.com/ipfs/go-datastore/datastore.go b/vendor/github.com/ipfs/go-datastore/datastore.go deleted file mode 100644 index eec1932c..00000000 --- a/vendor/github.com/ipfs/go-datastore/datastore.go +++ /dev/null @@ -1,239 +0,0 @@ -package datastore - -import ( - "errors" - "io" - "time" - - query "github.com/ipfs/go-datastore/query" -) - -/* -Datastore represents storage for any key-value pair. - -Datastores are general enough to be backed by all kinds of different storage: -in-memory caches, databases, a remote datastore, flat files on disk, etc. - -The general idea is to wrap a more complicated storage facility in a simple, -uniform interface, keeping the freedom of using the right tools for the job. -In particular, a Datastore can aggregate other datastores in interesting ways, -like sharded (to distribute load) or tiered access (caches before databases). - -While Datastores should be written general enough to accept all sorts of -values, some implementations will undoubtedly have to be specific (e.g. SQL -databases where fields should be decomposed into columns), particularly to -support queries efficiently. Moreover, certain datastores may enforce certain -types of values (e.g. requiring an io.Reader, a specific struct, etc) or -serialization formats (JSON, Protobufs, etc). - -IMPORTANT: No Datastore should ever Panic! This is a cross-module interface, -and thus it should behave predictably and handle exceptional conditions with -proper error reporting. Thus, all Datastore calls may return errors, which -should be checked by callers. -*/ -type Datastore interface { - Read - Write - io.Closer -} - -// Write is the write-side of the Datastore interface. -type Write interface { - // Put stores the object `value` named by `key`. - // - // The generalized Datastore interface does not impose a value type, - // allowing various datastore middleware implementations (which do not - // handle the values directly) to be composed together. - // - // Ultimately, the lowest-level datastore will need to do some value checking - // or risk getting incorrect values. It may also be useful to expose a more - // type-safe interface to your application, and do the checking up-front. - Put(key Key, value []byte) error - - // Delete removes the value for given `key`. - Delete(key Key) error -} - -// Read is the read-side of the Datastore interface. -type Read interface { - // Get retrieves the object `value` named by `key`. - // Get will return ErrNotFound if the key is not mapped to a value. - Get(key Key) (value []byte, err error) - - // Has returns whether the `key` is mapped to a `value`. - // In some contexts, it may be much cheaper only to check for existence of - // a value, rather than retrieving the value itself. (e.g. HTTP HEAD). - // The default implementation is found in `GetBackedHas`. - Has(key Key) (exists bool, err error) - - // GetSize returns the size of the `value` named by `key`. - // In some contexts, it may be much cheaper to only get the size of the - // value rather than retrieving the value itself. - GetSize(key Key) (size int, err error) - - // Query searches the datastore and returns a query result. This function - // may return before the query actually runs. To wait for the query: - // - // result, _ := ds.Query(q) - // - // // use the channel interface; result may come in at different times - // for entry := range result.Next() { ... } - // - // // or wait for the query to be completely done - // entries, _ := result.Rest() - // for entry := range entries { ... } - // - Query(q query.Query) (query.Results, error) -} - -// Batching datastores support deferred, grouped updates to the database. -// `Batch`es do NOT have transactional semantics: updates to the underlying -// datastore are not guaranteed to occur in the same iota of time. Similarly, -// batched updates will not be flushed to the underlying datastore until -// `Commit` has been called. `Txn`s from a `TxnDatastore` have all the -// capabilities of a `Batch`, but the reverse is NOT true. -type Batching interface { - Datastore - - Batch() (Batch, error) -} - -// ErrBatchUnsupported is returned if the by Batch if the Datastore doesn't -// actually support batching. -var ErrBatchUnsupported = errors.New("this datastore does not support batching") - -// CheckedDatastore is an interface that should be implemented by datastores -// which may need checking on-disk data integrity. -type CheckedDatastore interface { - Datastore - - Check() error -} - -// CheckedDatastore is an interface that should be implemented by datastores -// which want to provide a mechanism to check data integrity and/or -// error correction. -type ScrubbedDatastore interface { - Datastore - - Scrub() error -} - -// GCDatastore is an interface that should be implemented by datastores which -// don't free disk space by just removing data from them. -type GCDatastore interface { - Datastore - - CollectGarbage() error -} - -// PersistentDatastore is an interface that should be implemented by datastores -// which can report disk usage. -type PersistentDatastore interface { - Datastore - - // DiskUsage returns the space used by a datastore, in bytes. - DiskUsage() (uint64, error) -} - -// DiskUsage checks if a Datastore is a -// PersistentDatastore and returns its DiskUsage(), -// otherwise returns 0. -func DiskUsage(d Datastore) (uint64, error) { - persDs, ok := d.(PersistentDatastore) - if !ok { - return 0, nil - } - return persDs.DiskUsage() -} - -// TTLDatastore is an interface that should be implemented by datastores that -// support expiring entries. -type TTLDatastore interface { - Datastore - TTL -} - -// TTL encapulates the methods that deal with entries with time-to-live. -type TTL interface { - PutWithTTL(key Key, value []byte, ttl time.Duration) error - SetTTL(key Key, ttl time.Duration) error - GetExpiration(key Key) (time.Time, error) -} - -// Txn extends the Datastore type. Txns allow users to batch queries and -// mutations to the Datastore into atomic groups, or transactions. Actions -// performed on a transaction will not take hold until a successful call to -// Commit has been made. Likewise, transactions can be aborted by calling -// Discard before a successful Commit has been made. -type Txn interface { - Read - Write - - // Commit finalizes a transaction, attempting to commit it to the Datastore. - // May return an error if the transaction has gone stale. The presence of an - // error is an indication that the data was not committed to the Datastore. - Commit() error - // Discard throws away changes recorded in a transaction without committing - // them to the underlying Datastore. Any calls made to Discard after Commit - // has been successfully called will have no effect on the transaction and - // state of the Datastore, making it safe to defer. - Discard() -} - -// TxnDatastore is an interface that should be implemented by datastores that -// support transactions. -type TxnDatastore interface { - Datastore - - NewTransaction(readOnly bool) (Txn, error) -} - -// Errors - -// ErrNotFound is returned by Get, Has, and Delete when a datastore does not -// map the given key to a value. -var ErrNotFound = errors.New("datastore: key not found") - -// ErrInvalidType is returned by Put when a given value is incopatible with -// the type the datastore supports. This means a conversion (or serialization) -// is needed beforehand. -var ErrInvalidType = errors.New("datastore: invalid type error") - -// GetBackedHas provides a default Datastore.Has implementation. -// It exists so Datastore.Has implementations can use it, like so: -// -// func (*d SomeDatastore) Has(key Key) (exists bool, err error) { -// return GetBackedHas(d, key) -// } -func GetBackedHas(ds Read, key Key) (bool, error) { - _, err := ds.Get(key) - switch err { - case nil: - return true, nil - case ErrNotFound: - return false, nil - default: - return false, err - } -} - -// GetBackedSize provides a default Datastore.GetSize implementation. -// It exists so Datastore.GetSize implementations can use it, like so: -// -// func (*d SomeDatastore) GetSize(key Key) (size int, err error) { -// return GetBackedSize(d, key) -// } -func GetBackedSize(ds Read, key Key) (int, error) { - value, err := ds.Get(key) - if err == nil { - return len(value), nil - } - return -1, err -} - -type Batch interface { - Write - - Commit() error -} diff --git a/vendor/github.com/ipfs/go-datastore/go.mod b/vendor/github.com/ipfs/go-datastore/go.mod deleted file mode 100644 index 6e22c954..00000000 --- a/vendor/github.com/ipfs/go-datastore/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/ipfs/go-datastore - -require ( - github.com/go-check/check v0.0.0-20180628173108-788fd7840127 - github.com/google/uuid v1.1.1 - github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8 - github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 - github.com/kr/pretty v0.1.0 // indirect - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect -) diff --git a/vendor/github.com/ipfs/go-datastore/go.sum b/vendor/github.com/ipfs/go-datastore/go.sum deleted file mode 100644 index d7327672..00000000 --- a/vendor/github.com/ipfs/go-datastore/go.sum +++ /dev/null @@ -1,15 +0,0 @@ -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8 h1:NAviDvJ0WXgD+yiL2Rj35AmnfgI11+pHXbdciD917U0= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -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= diff --git a/vendor/github.com/ipfs/go-datastore/key.go b/vendor/github.com/ipfs/go-datastore/key.go deleted file mode 100644 index 161fedff..00000000 --- a/vendor/github.com/ipfs/go-datastore/key.go +++ /dev/null @@ -1,302 +0,0 @@ -package datastore - -import ( - "encoding/json" - "path" - "strings" - - dsq "github.com/ipfs/go-datastore/query" - - "github.com/google/uuid" -) - -/* -A Key represents the unique identifier of an object. -Our Key scheme is inspired by file systems and Google App Engine key model. - -Keys are meant to be unique across a system. Keys are hierarchical, -incorporating more and more specific namespaces. Thus keys can be deemed -'children' or 'ancestors' of other keys:: - - Key("/Comedy") - Key("/Comedy/MontyPython") - -Also, every namespace can be parametrized to embed relevant object -information. For example, the Key `name` (most specific namespace) could -include the object type:: - - Key("/Comedy/MontyPython/Actor:JohnCleese") - Key("/Comedy/MontyPython/Sketch:CheeseShop") - Key("/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender") - -*/ -type Key struct { - string -} - -// NewKey constructs a key from string. it will clean the value. -func NewKey(s string) Key { - k := Key{s} - k.Clean() - return k -} - -// RawKey creates a new Key without safety checking the input. Use with care. -func RawKey(s string) Key { - // accept an empty string and fix it to avoid special cases - // elsewhere - if len(s) == 0 { - return Key{"/"} - } - - // perform a quick sanity check that the key is in the correct - // format, if it is not then it is a programmer error and it is - // okay to panic - if len(s) == 0 || s[0] != '/' || (len(s) > 1 && s[len(s)-1] == '/') { - panic("invalid datastore key: " + s) - } - - return Key{s} -} - -// KeyWithNamespaces constructs a key out of a namespace slice. -func KeyWithNamespaces(ns []string) Key { - return NewKey(strings.Join(ns, "/")) -} - -// Clean up a Key, using path.Clean. -func (k *Key) Clean() { - switch { - case len(k.string) == 0: - k.string = "/" - case k.string[0] == '/': - k.string = path.Clean(k.string) - default: - k.string = path.Clean("/" + k.string) - } -} - -// Strings is the string value of Key -func (k Key) String() string { - return k.string -} - -// Bytes returns the string value of Key as a []byte -func (k Key) Bytes() []byte { - return []byte(k.string) -} - -// Equal checks equality of two keys -func (k Key) Equal(k2 Key) bool { - return k.string == k2.string -} - -// Less checks whether this key is sorted lower than another. -func (k Key) Less(k2 Key) bool { - list1 := k.List() - list2 := k2.List() - for i, c1 := range list1 { - if len(list2) < (i + 1) { - return false - } - - c2 := list2[i] - if c1 < c2 { - return true - } else if c1 > c2 { - return false - } - // c1 == c2, continue - } - - // list1 is shorter or exactly the same. - return len(list1) < len(list2) -} - -// List returns the `list` representation of this Key. -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").List() -// ["Comedy", "MontyPythong", "Actor:JohnCleese"] -func (k Key) List() []string { - return strings.Split(k.string, "/")[1:] -} - -// Reverse returns the reverse of this Key. -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Reverse() -// NewKey("/Actor:JohnCleese/MontyPython/Comedy") -func (k Key) Reverse() Key { - l := k.List() - r := make([]string, len(l), len(l)) - for i, e := range l { - r[len(l)-i-1] = e - } - return KeyWithNamespaces(r) -} - -// Namespaces returns the `namespaces` making up this Key. -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Namespaces() -// ["Comedy", "MontyPython", "Actor:JohnCleese"] -func (k Key) Namespaces() []string { - return k.List() -} - -// BaseNamespace returns the "base" namespace of this key (path.Base(filename)) -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").BaseNamespace() -// "Actor:JohnCleese" -func (k Key) BaseNamespace() string { - n := k.Namespaces() - return n[len(n)-1] -} - -// Type returns the "type" of this key (value of last namespace). -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Type() -// "Actor" -func (k Key) Type() string { - return NamespaceType(k.BaseNamespace()) -} - -// Name returns the "name" of this key (field of last namespace). -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Name() -// "JohnCleese" -func (k Key) Name() string { - return NamespaceValue(k.BaseNamespace()) -} - -// Instance returns an "instance" of this type key (appends value to namespace). -// NewKey("/Comedy/MontyPython/Actor").Instance("JohnClesse") -// NewKey("/Comedy/MontyPython/Actor:JohnCleese") -func (k Key) Instance(s string) Key { - return NewKey(k.string + ":" + s) -} - -// Path returns the "path" of this key (parent + type). -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Path() -// NewKey("/Comedy/MontyPython/Actor") -func (k Key) Path() Key { - s := k.Parent().string + "/" + NamespaceType(k.BaseNamespace()) - return NewKey(s) -} - -// Parent returns the `parent` Key of this Key. -// NewKey("/Comedy/MontyPython/Actor:JohnCleese").Parent() -// NewKey("/Comedy/MontyPython") -func (k Key) Parent() Key { - n := k.List() - if len(n) == 1 { - return RawKey("/") - } - return NewKey(strings.Join(n[:len(n)-1], "/")) -} - -// Child returns the `child` Key of this Key. -// NewKey("/Comedy/MontyPython").Child(NewKey("Actor:JohnCleese")) -// NewKey("/Comedy/MontyPython/Actor:JohnCleese") -func (k Key) Child(k2 Key) Key { - switch { - case k.string == "/": - return k2 - case k2.string == "/": - return k - default: - return RawKey(k.string + k2.string) - } -} - -// ChildString returns the `child` Key of this Key -- string helper. -// NewKey("/Comedy/MontyPython").ChildString("Actor:JohnCleese") -// NewKey("/Comedy/MontyPython/Actor:JohnCleese") -func (k Key) ChildString(s string) Key { - return NewKey(k.string + "/" + s) -} - -// IsAncestorOf returns whether this key is a prefix of `other` -// NewKey("/Comedy").IsAncestorOf("/Comedy/MontyPython") -// true -func (k Key) IsAncestorOf(other Key) bool { - if other.string == k.string { - return false - } - return strings.HasPrefix(other.string, k.string) -} - -// IsDescendantOf returns whether this key contains another as a prefix. -// NewKey("/Comedy/MontyPython").IsDescendantOf("/Comedy") -// true -func (k Key) IsDescendantOf(other Key) bool { - if other.string == k.string { - return false - } - return strings.HasPrefix(k.string, other.string) -} - -// IsTopLevel returns whether this key has only one namespace. -func (k Key) IsTopLevel() bool { - return len(k.List()) == 1 -} - -// MarshalJSON implements the json.Marshaler interface, -// keys are represented as JSON strings -func (k Key) MarshalJSON() ([]byte, error) { - return json.Marshal(k.String()) -} - -// UnmarshalJSON implements the json.Unmarshaler interface, -// keys will parse any value specified as a key to a string -func (k *Key) UnmarshalJSON(data []byte) error { - var key string - if err := json.Unmarshal(data, &key); err != nil { - return err - } - *k = NewKey(key) - return nil -} - -// RandomKey returns a randomly (uuid) generated key. -// RandomKey() -// NewKey("/f98719ea086343f7b71f32ea9d9d521d") -func RandomKey() Key { - return NewKey(strings.Replace(uuid.New().String(), "-", "", -1)) -} - -/* -A Key Namespace is like a path element. -A namespace can optionally include a type (delimited by ':') - - > NamespaceValue("Song:PhilosopherSong") - PhilosopherSong - > NamespaceType("Song:PhilosopherSong") - Song - > NamespaceType("Music:Song:PhilosopherSong") - Music:Song -*/ - -// NamespaceType is the first component of a namespace. `foo` in `foo:bar` -func NamespaceType(namespace string) string { - parts := strings.Split(namespace, ":") - if len(parts) < 2 { - return "" - } - return strings.Join(parts[0:len(parts)-1], ":") -} - -// NamespaceValue returns the last component of a namespace. `baz` in `f:b:baz` -func NamespaceValue(namespace string) string { - parts := strings.Split(namespace, ":") - return parts[len(parts)-1] -} - -// KeySlice attaches the methods of sort.Interface to []Key, -// sorting in increasing order. -type KeySlice []Key - -func (p KeySlice) Len() int { return len(p) } -func (p KeySlice) Less(i, j int) bool { return p[i].Less(p[j]) } -func (p KeySlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -// EntryKeys -func EntryKeys(e []dsq.Entry) []Key { - ks := make([]Key, len(e)) - for i, e := range e { - ks[i] = NewKey(e.Key) - } - return ks -} diff --git a/vendor/github.com/ipfs/go-datastore/keytransform/doc.go b/vendor/github.com/ipfs/go-datastore/keytransform/doc.go deleted file mode 100644 index b389dcfa..00000000 --- a/vendor/github.com/ipfs/go-datastore/keytransform/doc.go +++ /dev/null @@ -1,25 +0,0 @@ -// Package keytransform introduces a Datastore Shim that transforms keys before -// passing them to its child. It can be used to manipulate what keys look like -// to the user, for example namespacing keys, reversing them, etc. -// -// Use the Wrap function to wrap a datastore with any KeyTransform. -// A KeyTransform is simply an interface with two functions, a conversion and -// its inverse. For example: -// -// import ( -// ktds "github.com/ipfs/go-datastore/keytransform" -// ds "github.com/ipfs/go-datastore" -// ) -// -// func reverseKey(k ds.Key) ds.Key { -// return k.Reverse() -// } -// -// func invertKeys(d ds.Datastore) { -// return ktds.Wrap(d, &ktds.Pair{ -// Convert: reverseKey, -// Invert: reverseKey, // reverse is its own inverse. -// }) -// } -// -package keytransform diff --git a/vendor/github.com/ipfs/go-datastore/keytransform/interface.go b/vendor/github.com/ipfs/go-datastore/keytransform/interface.go deleted file mode 100644 index 4f07967a..00000000 --- a/vendor/github.com/ipfs/go-datastore/keytransform/interface.go +++ /dev/null @@ -1,13 +0,0 @@ -package keytransform - -import ds "github.com/ipfs/go-datastore" - -// KeyMapping is a function that maps one key to annother -type KeyMapping func(ds.Key) ds.Key - -// KeyTransform is an object with a pair of functions for (invertibly) -// transforming keys -type KeyTransform interface { - ConvertKey(ds.Key) ds.Key - InvertKey(ds.Key) ds.Key -} diff --git a/vendor/github.com/ipfs/go-datastore/keytransform/keytransform.go b/vendor/github.com/ipfs/go-datastore/keytransform/keytransform.go deleted file mode 100644 index ae029730..00000000 --- a/vendor/github.com/ipfs/go-datastore/keytransform/keytransform.go +++ /dev/null @@ -1,255 +0,0 @@ -package keytransform - -import ( - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" -) - -// Wrap wraps a given datastore with a KeyTransform function. -// The resulting wrapped datastore will use the transform on all Datastore -// operations. -func Wrap(child ds.Datastore, t KeyTransform) *Datastore { - if t == nil { - panic("t (KeyTransform) is nil") - } - - if child == nil { - panic("child (ds.Datastore) is nil") - } - - return &Datastore{child: child, KeyTransform: t} -} - -// Datastore keeps a KeyTransform function -type Datastore struct { - child ds.Datastore - - KeyTransform -} - -// Children implements ds.Shim -func (d *Datastore) Children() []ds.Datastore { - return []ds.Datastore{d.child} -} - -// Put stores the given value, transforming the key first. -func (d *Datastore) Put(key ds.Key, value []byte) (err error) { - return d.child.Put(d.ConvertKey(key), value) -} - -// Get returns the value for given key, transforming the key first. -func (d *Datastore) Get(key ds.Key) (value []byte, err error) { - return d.child.Get(d.ConvertKey(key)) -} - -// Has returns whether the datastore has a value for a given key, transforming -// the key first. -func (d *Datastore) Has(key ds.Key) (exists bool, err error) { - return d.child.Has(d.ConvertKey(key)) -} - -// GetSize returns the size of the value named by the given key, transforming -// the key first. -func (d *Datastore) GetSize(key ds.Key) (size int, err error) { - return d.child.GetSize(d.ConvertKey(key)) -} - -// Delete removes the value for given key -func (d *Datastore) Delete(key ds.Key) (err error) { - return d.child.Delete(d.ConvertKey(key)) -} - -// Query implements Query, inverting keys on the way back out. -func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) { - nq, cq := d.prepareQuery(q) - - cqr, err := d.child.Query(cq) - if err != nil { - return nil, err - } - - qr := dsq.ResultsFromIterator(q, dsq.Iterator{ - Next: func() (dsq.Result, bool) { - r, ok := cqr.NextSync() - if !ok { - return r, false - } - if r.Error == nil { - r.Entry.Key = d.InvertKey(ds.RawKey(r.Entry.Key)).String() - } - return r, true - }, - Close: func() error { - return cqr.Close() - }, - }) - return dsq.NaiveQueryApply(nq, qr), nil -} - -// Split the query into a child query and a naive query. That way, we can make -// the child datastore do as much work as possible. -func (d *Datastore) prepareQuery(q dsq.Query) (naive, child dsq.Query) { - - // First, put everything in the child query. Then, start taking things - // out. - child = q - - // Always let the child handle the key prefix. - child.Prefix = d.ConvertKey(ds.NewKey(child.Prefix)).String() - - // Check if the key transform is order-preserving so we can use the - // child datastore's built-in ordering. - orderPreserving := false - switch d.KeyTransform.(type) { - case PrefixTransform, *PrefixTransform: - orderPreserving = true - } - - // Try to let the child handle ordering. -orders: - for i, o := range child.Orders { - switch o.(type) { - case dsq.OrderByValue, *dsq.OrderByValue, - dsq.OrderByValueDescending, *dsq.OrderByValueDescending: - // Key doesn't matter. - continue - case dsq.OrderByKey, *dsq.OrderByKey, - dsq.OrderByKeyDescending, *dsq.OrderByKeyDescending: - // if the key transform preserves order, we can delegate - // to the child datastore. - if orderPreserving { - // When sorting, we compare with the first - // Order, then, if equal, we compare with the - // second Order, etc. However, keys are _unique_ - // so we'll never apply any additional orders - // after ordering by key. - child.Orders = child.Orders[:i+1] - break orders - } - } - - // Can't handle this order under transform, punt it to a naive - // ordering. - naive.Orders = q.Orders - child.Orders = nil - naive.Offset = q.Offset - child.Offset = 0 - naive.Limit = q.Limit - child.Limit = 0 - break - } - - // Try to let the child handle the filters. - - // don't modify the original filters. - child.Filters = append([]dsq.Filter(nil), child.Filters...) - - for i, f := range child.Filters { - switch f := f.(type) { - case dsq.FilterValueCompare, *dsq.FilterValueCompare: - continue - case dsq.FilterKeyCompare: - child.Filters[i] = dsq.FilterKeyCompare{ - Op: f.Op, - Key: d.ConvertKey(ds.NewKey(f.Key)).String(), - } - continue - case *dsq.FilterKeyCompare: - child.Filters[i] = &dsq.FilterKeyCompare{ - Op: f.Op, - Key: d.ConvertKey(ds.NewKey(f.Key)).String(), - } - continue - case dsq.FilterKeyPrefix: - child.Filters[i] = dsq.FilterKeyPrefix{ - Prefix: d.ConvertKey(ds.NewKey(f.Prefix)).String(), - } - continue - case *dsq.FilterKeyPrefix: - child.Filters[i] = &dsq.FilterKeyPrefix{ - Prefix: d.ConvertKey(ds.NewKey(f.Prefix)).String(), - } - continue - } - - // Not a known filter, defer to the naive implementation. - naive.Filters = q.Filters - child.Filters = nil - naive.Offset = q.Offset - child.Offset = 0 - naive.Limit = q.Limit - child.Limit = 0 - break - } - return -} - -func (d *Datastore) Close() error { - return d.child.Close() -} - -// DiskUsage implements the PersistentDatastore interface. -func (d *Datastore) DiskUsage() (uint64, error) { - return ds.DiskUsage(d.child) -} - -func (d *Datastore) Batch() (ds.Batch, error) { - bds, ok := d.child.(ds.Batching) - if !ok { - return nil, ds.ErrBatchUnsupported - } - - childbatch, err := bds.Batch() - if err != nil { - return nil, err - } - return &transformBatch{ - dst: childbatch, - f: d.ConvertKey, - }, nil -} - -type transformBatch struct { - dst ds.Batch - - f KeyMapping -} - -func (t *transformBatch) Put(key ds.Key, val []byte) error { - return t.dst.Put(t.f(key), val) -} - -func (t *transformBatch) Delete(key ds.Key) error { - return t.dst.Delete(t.f(key)) -} - -func (t *transformBatch) Commit() error { - return t.dst.Commit() -} - -func (d *Datastore) Check() error { - if c, ok := d.child.(ds.CheckedDatastore); ok { - return c.Check() - } - return nil -} - -func (d *Datastore) Scrub() error { - if c, ok := d.child.(ds.ScrubbedDatastore); ok { - return c.Scrub() - } - return nil -} - -func (d *Datastore) CollectGarbage() error { - if c, ok := d.child.(ds.GCDatastore); ok { - return c.CollectGarbage() - } - return nil -} - -var _ ds.Datastore = (*Datastore)(nil) -var _ ds.GCDatastore = (*Datastore)(nil) -var _ ds.Batching = (*Datastore)(nil) -var _ ds.PersistentDatastore = (*Datastore)(nil) -var _ ds.ScrubbedDatastore = (*Datastore)(nil) diff --git a/vendor/github.com/ipfs/go-datastore/keytransform/transforms.go b/vendor/github.com/ipfs/go-datastore/keytransform/transforms.go deleted file mode 100644 index cc39897e..00000000 --- a/vendor/github.com/ipfs/go-datastore/keytransform/transforms.go +++ /dev/null @@ -1,49 +0,0 @@ -package keytransform - -import ds "github.com/ipfs/go-datastore" - -// Pair is a convince struct for constructing a key transform. -type Pair struct { - Convert KeyMapping - Invert KeyMapping -} - -func (t *Pair) ConvertKey(k ds.Key) ds.Key { - return t.Convert(k) -} - -func (t *Pair) InvertKey(k ds.Key) ds.Key { - return t.Invert(k) -} - -var _ KeyTransform = (*Pair)(nil) - -// PrefixTransform constructs a KeyTransform with a pair of functions that -// add or remove the given prefix key. -// -// Warning: will panic if prefix not found when it should be there. This is -// to avoid insidious data inconsistency errors. -type PrefixTransform struct { - Prefix ds.Key -} - -// ConvertKey adds the prefix. -func (p PrefixTransform) ConvertKey(k ds.Key) ds.Key { - return p.Prefix.Child(k) -} - -// InvertKey removes the prefix. panics if prefix not found. -func (p PrefixTransform) InvertKey(k ds.Key) ds.Key { - if p.Prefix.String() == "/" { - return k - } - - if !p.Prefix.IsAncestorOf(k) { - panic("expected prefix not found") - } - - s := k.String()[len(p.Prefix.String()):] - return ds.RawKey(s) -} - -var _ KeyTransform = (*PrefixTransform)(nil) diff --git a/vendor/github.com/ipfs/go-datastore/mount/mount.go b/vendor/github.com/ipfs/go-datastore/mount/mount.go deleted file mode 100644 index 326277a6..00000000 --- a/vendor/github.com/ipfs/go-datastore/mount/mount.go +++ /dev/null @@ -1,400 +0,0 @@ -// Package mount provides a Datastore that has other Datastores -// mounted at various key prefixes and is threadsafe -package mount - -import ( - "container/heap" - "errors" - "fmt" - "sort" - "strings" - "sync" - - ds "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" -) - -var ( - ErrNoMount = errors.New("no datastore mounted for this key") -) - -type Mount struct { - Prefix ds.Key - Datastore ds.Datastore -} - -func New(mounts []Mount) *Datastore { - // make a copy so we're sure it doesn't mutate - m := make([]Mount, len(mounts)) - for i, v := range mounts { - m[i] = v - } - sort.Slice(m, func(i, j int) bool { return m[i].Prefix.String() > m[j].Prefix.String() }) - return &Datastore{mounts: m} -} - -type Datastore struct { - mounts []Mount -} - -var _ ds.Datastore = (*Datastore)(nil) - -func (d *Datastore) lookup(key ds.Key) (ds.Datastore, ds.Key, ds.Key) { - for _, m := range d.mounts { - if m.Prefix.Equal(key) || m.Prefix.IsAncestorOf(key) { - s := strings.TrimPrefix(key.String(), m.Prefix.String()) - k := ds.NewKey(s) - return m.Datastore, m.Prefix, k - } - } - return nil, ds.NewKey("/"), key -} - -type queryResults struct { - mount ds.Key - results query.Results - next query.Result -} - -func (qr *queryResults) advance() bool { - if qr.results == nil { - return false - } - - qr.next = query.Result{} - r, more := qr.results.NextSync() - if !more { - err := qr.results.Close() - qr.results = nil - if err != nil { - // One more result, the error. - qr.next = query.Result{Error: err} - return true - } - return false - } - - r.Key = qr.mount.Child(ds.RawKey(r.Key)).String() - qr.next = r - return true -} - -type querySet struct { - query query.Query - heads []*queryResults -} - -func (h *querySet) Len() int { - return len(h.heads) -} - -func (h *querySet) Less(i, j int) bool { - return query.Less(h.query.Orders, h.heads[i].next.Entry, h.heads[j].next.Entry) -} - -func (h *querySet) Swap(i, j int) { - h.heads[i], h.heads[j] = h.heads[j], h.heads[i] -} - -func (h *querySet) Push(x interface{}) { - h.heads = append(h.heads, x.(*queryResults)) -} - -func (h *querySet) Pop() interface{} { - i := len(h.heads) - 1 - last := h.heads[i] - h.heads[i] = nil - h.heads = h.heads[:i] - return last -} - -func (h *querySet) close() error { - var errs []error - for _, qr := range h.heads { - err := qr.results.Close() - if err != nil { - errs = append(errs, err) - } - } - h.heads = nil - if len(errs) > 0 { - return errs[0] - } - return nil -} - -func (h *querySet) addResults(mount ds.Key, results query.Results) { - r := &queryResults{ - results: results, - mount: mount, - } - if r.advance() { - heap.Push(h, r) - } -} - -func (h *querySet) next() (query.Result, bool) { - if len(h.heads) == 0 { - return query.Result{}, false - } - head := h.heads[0] - next := head.next - - if head.advance() { - heap.Fix(h, 0) - } else { - heap.Remove(h, 0) - } - - return next, true -} - -// lookupAll returns all mounts that might contain keys that are descendant of -// -// Matching: /ao/e -// -// / B /ao/e -// /a/ not matching -// /ao/ B /e -// /ao/e/ A / -// /ao/e/uh/ A / -// /aoe/ not matching -func (d *Datastore) lookupAll(key ds.Key) (dst []ds.Datastore, mountpoint, rest []ds.Key) { - for _, m := range d.mounts { - p := m.Prefix.String() - if len(p) > 1 { - p = p + "/" - } - - if strings.HasPrefix(p, key.String()) { - dst = append(dst, m.Datastore) - mountpoint = append(mountpoint, m.Prefix) - rest = append(rest, ds.NewKey("/")) - } else if strings.HasPrefix(key.String(), p) { - r := strings.TrimPrefix(key.String(), m.Prefix.String()) - - dst = append(dst, m.Datastore) - mountpoint = append(mountpoint, m.Prefix) - rest = append(rest, ds.NewKey(r)) - } - } - return dst, mountpoint, rest -} - -func (d *Datastore) Put(key ds.Key, value []byte) error { - cds, _, k := d.lookup(key) - if cds == nil { - return ErrNoMount - } - return cds.Put(k, value) -} - -func (d *Datastore) Get(key ds.Key) (value []byte, err error) { - cds, _, k := d.lookup(key) - if cds == nil { - return nil, ds.ErrNotFound - } - return cds.Get(k) -} - -func (d *Datastore) Has(key ds.Key) (exists bool, err error) { - cds, _, k := d.lookup(key) - if cds == nil { - return false, nil - } - return cds.Has(k) -} - -func (d *Datastore) GetSize(key ds.Key) (size int, err error) { - cds, _, k := d.lookup(key) - if cds == nil { - return -1, ds.ErrNotFound - } - return cds.GetSize(k) -} - -func (d *Datastore) Delete(key ds.Key) error { - cds, _, k := d.lookup(key) - if cds == nil { - return ds.ErrNotFound - } - return cds.Delete(k) -} - -func (d *Datastore) Query(master query.Query) (query.Results, error) { - childQuery := query.Query{ - Prefix: master.Prefix, - Limit: master.Limit, - Orders: master.Orders, - KeysOnly: master.KeysOnly, - ReturnExpirations: master.ReturnExpirations, - } - - prefix := ds.NewKey(childQuery.Prefix) - dses, mounts, rests := d.lookupAll(prefix) - - queries := &querySet{ - query: childQuery, - heads: make([]*queryResults, 0, len(dses)), - } - - for i := range dses { - mount := mounts[i] - dstore := dses[i] - rest := rests[i] - - qi := childQuery - qi.Prefix = rest.String() - results, err := dstore.Query(qi) - - if err != nil { - _ = queries.close() - return nil, err - } - queries.addResults(mount, results) - } - - qr := query.ResultsFromIterator(childQuery, query.Iterator{ - Next: queries.next, - Close: queries.close, - }) - - if len(master.Filters) > 0 { - for _, f := range master.Filters { - qr = query.NaiveFilter(qr, f) - } - } - - if master.Offset > 0 { - qr = query.NaiveOffset(qr, master.Offset) - } - - if childQuery.Limit > 0 { - qr = query.NaiveLimit(qr, childQuery.Limit) - } - - return qr, nil -} - -func (d *Datastore) Close() error { - for _, d := range d.mounts { - err := d.Datastore.Close() - if err != nil { - return err - } - } - return nil -} - -// DiskUsage returns the sum of DiskUsages for the mounted datastores. -// Non PersistentDatastores will not be accounted. -func (d *Datastore) DiskUsage() (uint64, error) { - var duTotal uint64 = 0 - for _, d := range d.mounts { - du, err := ds.DiskUsage(d.Datastore) - duTotal += du - if err != nil { - return duTotal, err - } - } - return duTotal, nil -} - -type mountBatch struct { - mounts map[string]ds.Batch - lk sync.Mutex - - d *Datastore -} - -func (d *Datastore) Batch() (ds.Batch, error) { - return &mountBatch{ - mounts: make(map[string]ds.Batch), - d: d, - }, nil -} - -func (mt *mountBatch) lookupBatch(key ds.Key) (ds.Batch, ds.Key, error) { - mt.lk.Lock() - defer mt.lk.Unlock() - - child, loc, rest := mt.d.lookup(key) - t, ok := mt.mounts[loc.String()] - if !ok { - bds, ok := child.(ds.Batching) - if !ok { - return nil, ds.NewKey(""), ds.ErrBatchUnsupported - } - var err error - t, err = bds.Batch() - if err != nil { - return nil, ds.NewKey(""), err - } - mt.mounts[loc.String()] = t - } - return t, rest, nil -} - -func (mt *mountBatch) Put(key ds.Key, val []byte) error { - t, rest, err := mt.lookupBatch(key) - if err != nil { - return err - } - - return t.Put(rest, val) -} - -func (mt *mountBatch) Delete(key ds.Key) error { - t, rest, err := mt.lookupBatch(key) - if err != nil { - return err - } - - return t.Delete(rest) -} - -func (mt *mountBatch) Commit() error { - mt.lk.Lock() - defer mt.lk.Unlock() - - for _, t := range mt.mounts { - err := t.Commit() - if err != nil { - return err - } - } - return nil -} - -func (d *Datastore) Check() error { - for _, m := range d.mounts { - if c, ok := m.Datastore.(ds.CheckedDatastore); ok { - if err := c.Check(); err != nil { - return fmt.Errorf("checking datastore at %s: %s", m.Prefix.String(), err.Error()) - } - } - } - return nil -} - -func (d *Datastore) Scrub() error { - for _, m := range d.mounts { - if c, ok := m.Datastore.(ds.ScrubbedDatastore); ok { - if err := c.Scrub(); err != nil { - return fmt.Errorf("scrubbing datastore at %s: %s", m.Prefix.String(), err.Error()) - } - } - } - return nil -} - -func (d *Datastore) CollectGarbage() error { - for _, m := range d.mounts { - if c, ok := m.Datastore.(ds.GCDatastore); ok { - if err := c.CollectGarbage(); err != nil { - return fmt.Errorf("gc on datastore at %s: %s", m.Prefix.String(), err.Error()) - } - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-datastore/namespace/doc.go b/vendor/github.com/ipfs/go-datastore/namespace/doc.go deleted file mode 100644 index 9ff9a8ca..00000000 --- a/vendor/github.com/ipfs/go-datastore/namespace/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Package namespace introduces a namespace Datastore Shim, which basically -// mounts the entire child datastore under a prefix. -// -// Use the Wrap function to wrap a datastore with any Key prefix. For example: -// -// import ( -// "fmt" -// -// ds "github.com/ipfs/go-datastore" -// nsds "github.com/ipfs/go-datastore/namespace" -// ) -// -// func main() { -// mp := ds.NewMapDatastore() -// ns := nsds.Wrap(mp, ds.NewKey("/foo/bar")) -// -// // in the Namespace Datastore: -// ns.Put(ds.NewKey("/beep"), "boop") -// v2, _ := ns.Get(ds.NewKey("/beep")) // v2 == "boop" -// -// // and, in the underlying MapDatastore: -// v3, _ := mp.Get(ds.NewKey("/foo/bar/beep")) // v3 == "boop" -// } -package namespace diff --git a/vendor/github.com/ipfs/go-datastore/namespace/namespace.go b/vendor/github.com/ipfs/go-datastore/namespace/namespace.go deleted file mode 100644 index 1913fb79..00000000 --- a/vendor/github.com/ipfs/go-datastore/namespace/namespace.go +++ /dev/null @@ -1,26 +0,0 @@ -package namespace - -import ( - ds "github.com/ipfs/go-datastore" - ktds "github.com/ipfs/go-datastore/keytransform" -) - -// PrefixTransform constructs a KeyTransform with a pair of functions that -// add or remove the given prefix key. -// -// Warning: will panic if prefix not found when it should be there. This is -// to avoid insidious data inconsistency errors. -// -// DEPRECATED: Use ktds.PrefixTransform directly. -func PrefixTransform(prefix ds.Key) ktds.PrefixTransform { - return ktds.PrefixTransform{Prefix: prefix} -} - -// Wrap wraps a given datastore with a key-prefix. -func Wrap(child ds.Datastore, prefix ds.Key) *ktds.Datastore { - if child == nil { - panic("child (ds.Datastore) is nil") - } - - return ktds.Wrap(child, PrefixTransform(prefix)) -} diff --git a/vendor/github.com/ipfs/go-datastore/package.json b/vendor/github.com/ipfs/go-datastore/package.json deleted file mode 100644 index d1d52e6a..00000000 --- a/vendor/github.com/ipfs/go-datastore/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "author": "jbenet", - "bugs": { - "url": "https://github.com/jbenet/go-datastore" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-datastore" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP", - "name": "goprocess", - "version": "1.0.0" - }, - { - "author": "gustavo", - "hash": "QmYBJ8BXPDTMnzLFdv4rS5kbR1fUFASDVDpK7ZbeWMx6hq", - "name": "go-check", - "version": "1.0.0" - }, - { - "author": "hsanjuan", - "hash": "QmUe1WCHkQaz4UeNKiHDUBV2T6i9prc3DniqyHPXyfGaUq", - "name": "go-ipfs-delay", - "version": "0.1.0" - }, - { - "author": "google", - "hash": "QmSSeQqc5QeuefkaM6JFV5tSF9knLUkXKVhW1eYRiqe72W", - "name": "uuid", - "version": "0.1.0" - } - ], - "gxVersion": "0.7.0", - "language": "go", - "license": "MIT", - "name": "go-datastore", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "3.6.1" -} - diff --git a/vendor/github.com/ipfs/go-datastore/query/filter.go b/vendor/github.com/ipfs/go-datastore/query/filter.go deleted file mode 100644 index 501414d3..00000000 --- a/vendor/github.com/ipfs/go-datastore/query/filter.go +++ /dev/null @@ -1,90 +0,0 @@ -package query - -import ( - "bytes" - "fmt" - "strings" -) - -// Filter is an object that tests ResultEntries -type Filter interface { - // Filter returns whether an entry passes the filter - Filter(e Entry) bool -} - -// Op is a comparison operator -type Op string - -var ( - Equal = Op("==") - NotEqual = Op("!=") - GreaterThan = Op(">") - GreaterThanOrEqual = Op(">=") - LessThan = Op("<") - LessThanOrEqual = Op("<=") -) - -// FilterValueCompare is used to signal to datastores they -// should apply internal comparisons. unfortunately, there -// is no way to apply comparisons* to interface{} types in -// Go, so if the datastore doesnt have a special way to -// handle these comparisons, you must provided the -// TypedFilter to actually do filtering. -// -// [*] other than == and !=, which use reflect.DeepEqual. -type FilterValueCompare struct { - Op Op - Value []byte -} - -func (f FilterValueCompare) Filter(e Entry) bool { - cmp := bytes.Compare(e.Value, f.Value) - switch f.Op { - case Equal: - return cmp == 0 - case NotEqual: - return cmp != 0 - case LessThan: - return cmp < 0 - case LessThanOrEqual: - return cmp <= 0 - case GreaterThan: - return cmp > 0 - case GreaterThanOrEqual: - return cmp >= 0 - default: - panic(fmt.Errorf("unknown operation: %s", f.Op)) - } -} - -type FilterKeyCompare struct { - Op Op - Key string -} - -func (f FilterKeyCompare) Filter(e Entry) bool { - switch f.Op { - case Equal: - return e.Key == f.Key - case NotEqual: - return e.Key != f.Key - case GreaterThan: - return e.Key > f.Key - case GreaterThanOrEqual: - return e.Key >= f.Key - case LessThan: - return e.Key < f.Key - case LessThanOrEqual: - return e.Key <= f.Key - default: - panic(fmt.Errorf("unknown op '%s'", f.Op)) - } -} - -type FilterKeyPrefix struct { - Prefix string -} - -func (f FilterKeyPrefix) Filter(e Entry) bool { - return strings.HasPrefix(e.Key, f.Prefix) -} diff --git a/vendor/github.com/ipfs/go-datastore/query/order.go b/vendor/github.com/ipfs/go-datastore/query/order.go deleted file mode 100644 index 5e0acf1b..00000000 --- a/vendor/github.com/ipfs/go-datastore/query/order.go +++ /dev/null @@ -1,74 +0,0 @@ -package query - -import ( - "bytes" - "sort" - "strings" -) - -// Order is an object used to order objects -type Order interface { - Compare(a, b Entry) int -} - -// OrderByFunction orders the results based on the result of the given function. -type OrderByFunction func(a, b Entry) int - -func (o OrderByFunction) Compare(a, b Entry) int { - return o(a, b) -} - -// OrderByValue is used to signal to datastores they should apply internal -// orderings. -type OrderByValue struct{} - -func (o OrderByValue) Compare(a, b Entry) int { - return bytes.Compare(a.Value, b.Value) -} - -// OrderByValueDescending is used to signal to datastores they -// should apply internal orderings. -type OrderByValueDescending struct{} - -func (o OrderByValueDescending) Compare(a, b Entry) int { - return -bytes.Compare(a.Value, b.Value) -} - -// OrderByKey -type OrderByKey struct{} - -func (o OrderByKey) Compare(a, b Entry) int { - return strings.Compare(a.Key, b.Key) -} - -// OrderByKeyDescending -type OrderByKeyDescending struct{} - -func (o OrderByKeyDescending) Compare(a, b Entry) int { - return -strings.Compare(a.Key, b.Key) -} - -// Less returns true if a comes before b with the requested orderings. -func Less(orders []Order, a, b Entry) bool { - for _, cmp := range orders { - switch cmp.Compare(a, b) { - case 0: - case -1: - return true - case 1: - return false - } - } - - // This gives us a *stable* sort for free. We don't care - // preserving the order from the underlying datastore - // because it's undefined. - return a.Key < b.Key -} - -// Sort sorts the given entries using the given orders. -func Sort(orders []Order, entries []Entry) { - sort.Slice(entries, func(i int, j int) bool { - return Less(orders, entries[i], entries[j]) - }) -} diff --git a/vendor/github.com/ipfs/go-datastore/query/query.go b/vendor/github.com/ipfs/go-datastore/query/query.go deleted file mode 100644 index 2540dfc6..00000000 --- a/vendor/github.com/ipfs/go-datastore/query/query.go +++ /dev/null @@ -1,386 +0,0 @@ -package query - -import ( - "time" - - goprocess "github.com/jbenet/goprocess" -) - -/* -Query represents storage for any key-value pair. - -tl;dr: - - queries are supported across datastores. - Cheap on top of relational dbs, and expensive otherwise. - Pick the right tool for the job! - -In addition to the key-value store get and set semantics, datastore -provides an interface to retrieve multiple records at a time through -the use of queries. The datastore Query model gleans a common set of -operations performed when querying. To avoid pasting here years of -database research, let’s summarize the operations datastore supports. - -Query Operations: - - * namespace - scope the query, usually by object type - * filters - select a subset of values by applying constraints - * orders - sort the results by applying sort conditions - * limit - impose a numeric limit on the number of results - * offset - skip a number of results (for efficient pagination) - -datastore combines these operations into a simple Query class that allows -applications to define their constraints in a simple, generic, way without -introducing datastore specific calls, languages, etc. - -Of course, different datastores provide relational query support across a -wide spectrum, from full support in traditional databases to none at all in -most key-value stores. Datastore aims to provide a common, simple interface -for the sake of application evolution over time and keeping large code bases -free of tool-specific code. It would be ridiculous to claim to support high- -performance queries on architectures that obviously do not. Instead, datastore -provides the interface, ideally translating queries to their native form -(e.g. into SQL for MySQL). - -However, on the wrong datastore, queries can potentially incur the high cost -of performing the aforemantioned query operations on the data set directly in -Go. It is the client’s responsibility to select the right tool for the job: -pick a data storage solution that fits the application’s needs now, and wrap -it with a datastore implementation. As the needs change, swap out datastore -implementations to support your new use cases. Some applications, particularly -in early development stages, can afford to incurr the cost of queries on non- -relational databases (e.g. using a FSDatastore and not worry about a database -at all). When it comes time to switch the tool for performance, updating the -application code can be as simple as swapping the datastore in one place, not -all over the application code base. This gain in engineering time, both at -initial development and during later iterations, can significantly offset the -cost of the layer of abstraction. - -*/ -type Query struct { - Prefix string // namespaces the query to results whose keys have Prefix - Filters []Filter // filter results. apply sequentially - Orders []Order // order results. apply hierarchically - Limit int // maximum number of results - Offset int // skip given number of results - KeysOnly bool // return only keys. - ReturnExpirations bool // return expirations (see TTLDatastore) -} - -// Entry is a query result entry. -type Entry struct { - Key string // cant be ds.Key because circular imports ...!!! - Value []byte // Will be nil if KeysOnly has been passed. - Expiration time.Time // Entry expiration timestamp if requested and supported (see TTLDatastore). -} - -// Result is a special entry that includes an error, so that the client -// may be warned about internal errors. If Error is non-nil, Entry must be -// empty. -type Result struct { - Entry - - Error error -} - -// Results is a set of Query results. This is the interface for clients. -// Example: -// -// qr, _ := myds.Query(q) -// for r := range qr.Next() { -// if r.Error != nil { -// // handle. -// break -// } -// -// fmt.Println(r.Entry.Key, r.Entry.Value) -// } -// -// or, wait on all results at once: -// -// qr, _ := myds.Query(q) -// es, _ := qr.Rest() -// for _, e := range es { -// fmt.Println(e.Key, e.Value) -// } -// -type Results interface { - Query() Query // the query these Results correspond to - Next() <-chan Result // returns a channel to wait for the next result - NextSync() (Result, bool) // blocks and waits to return the next result, second paramter returns false when results are exhausted - Rest() ([]Entry, error) // waits till processing finishes, returns all entries at once. - Close() error // client may call Close to signal early exit - - // Process returns a goprocess.Process associated with these results. - // most users will not need this function (Close is all they want), - // but it's here in case you want to connect the results to other - // goprocess-friendly things. - Process() goprocess.Process -} - -// results implements Results -type results struct { - query Query - proc goprocess.Process - res <-chan Result -} - -func (r *results) Next() <-chan Result { - return r.res -} - -func (r *results) NextSync() (Result, bool) { - val, ok := <-r.res - return val, ok -} - -func (r *results) Rest() ([]Entry, error) { - var es []Entry - for e := range r.res { - if e.Error != nil { - return es, e.Error - } - es = append(es, e.Entry) - } - <-r.proc.Closed() // wait till the processing finishes. - return es, nil -} - -func (r *results) Process() goprocess.Process { - return r.proc -} - -func (r *results) Close() error { - return r.proc.Close() -} - -func (r *results) Query() Query { - return r.query -} - -// ResultBuilder is what implementors use to construct results -// Implementors of datastores and their clients must respect the -// Process of the Request: -// -// * clients must call r.Process().Close() on an early exit, so -// implementations can reclaim resources. -// * if the Entries are read to completion (channel closed), Process -// should be closed automatically. -// * datastores must respect <-Process.Closing(), which intermediates -// an early close signal from the client. -// -type ResultBuilder struct { - Query Query - Process goprocess.Process - Output chan Result -} - -// Results returns a Results to to this builder. -func (rb *ResultBuilder) Results() Results { - return &results{ - query: rb.Query, - proc: rb.Process, - res: rb.Output, - } -} - -const NormalBufSize = 1 -const KeysOnlyBufSize = 128 - -func NewResultBuilder(q Query) *ResultBuilder { - bufSize := NormalBufSize - if q.KeysOnly { - bufSize = KeysOnlyBufSize - } - b := &ResultBuilder{ - Query: q, - Output: make(chan Result, bufSize), - } - b.Process = goprocess.WithTeardown(func() error { - close(b.Output) - return nil - }) - return b -} - -// ResultsWithChan returns a Results object from a channel -// of Result entries. -// -// DEPRECATED: This iterator is impossible to cancel correctly. Canceling it -// will leave anything trying to write to the result channel hanging. -func ResultsWithChan(q Query, res <-chan Result) Results { - return ResultsWithProcess(q, func(worker goprocess.Process, out chan<- Result) { - for { - select { - case <-worker.Closing(): // client told us to close early - return - case e, more := <-res: - if !more { - return - } - - select { - case out <- e: - case <-worker.Closing(): // client told us to close early - return - } - } - } - }) -} - -// ResultsWithProcess returns a Results object with the results generated by the -// passed subprocess. -func ResultsWithProcess(q Query, proc func(goprocess.Process, chan<- Result)) Results { - b := NewResultBuilder(q) - - // go consume all the entries and add them to the results. - b.Process.Go(func(worker goprocess.Process) { - proc(worker, b.Output) - }) - - go b.Process.CloseAfterChildren() - return b.Results() -} - -// ResultsWithEntries returns a Results object from a list of entries -func ResultsWithEntries(q Query, res []Entry) Results { - i := 0 - return ResultsFromIterator(q, Iterator{ - Next: func() (Result, bool) { - if i >= len(res) { - return Result{}, false - } - next := res[i] - i++ - return Result{Entry: next}, true - }, - }) -} - -func ResultsReplaceQuery(r Results, q Query) Results { - switch r := r.(type) { - case *results: - // note: not using field names to make sure all fields are copied - return &results{q, r.proc, r.res} - case *resultsIter: - // note: not using field names to make sure all fields are copied - lr := r.legacyResults - if lr != nil { - lr = &results{q, lr.proc, lr.res} - } - return &resultsIter{q, r.next, r.close, lr} - default: - panic("unknown results type") - } -} - -// -// ResultFromIterator provides an alternative way to to construct -// results without the use of channels. -// - -func ResultsFromIterator(q Query, iter Iterator) Results { - if iter.Close == nil { - iter.Close = noopClose - } - return &resultsIter{ - query: q, - next: iter.Next, - close: iter.Close, - } -} - -func noopClose() error { - return nil -} - -type Iterator struct { - Next func() (Result, bool) - Close func() error // note: might be called more than once -} - -type resultsIter struct { - query Query - next func() (Result, bool) - close func() error - legacyResults *results -} - -func (r *resultsIter) Next() <-chan Result { - r.useLegacyResults() - return r.legacyResults.Next() -} - -func (r *resultsIter) NextSync() (Result, bool) { - if r.legacyResults != nil { - return r.legacyResults.NextSync() - } else { - res, ok := r.next() - if !ok { - r.close() - } - return res, ok - } -} - -func (r *resultsIter) Rest() ([]Entry, error) { - var es []Entry - for { - e, ok := r.NextSync() - if !ok { - break - } - if e.Error != nil { - return es, e.Error - } - es = append(es, e.Entry) - } - return es, nil -} - -func (r *resultsIter) Process() goprocess.Process { - r.useLegacyResults() - return r.legacyResults.Process() -} - -func (r *resultsIter) Close() error { - if r.legacyResults != nil { - return r.legacyResults.Close() - } else { - return r.close() - } -} - -func (r *resultsIter) Query() Query { - return r.query -} - -func (r *resultsIter) useLegacyResults() { - if r.legacyResults != nil { - return - } - - b := NewResultBuilder(r.query) - - // go consume all the entries and add them to the results. - b.Process.Go(func(worker goprocess.Process) { - defer r.close() - for { - e, ok := r.next() - if !ok { - break - } - select { - case b.Output <- e: - case <-worker.Closing(): // client told us to close early - return - } - } - return - }) - - go b.Process.CloseAfterChildren() - - r.legacyResults = b.Results().(*results) -} diff --git a/vendor/github.com/ipfs/go-datastore/query/query_impl.go b/vendor/github.com/ipfs/go-datastore/query/query_impl.go deleted file mode 100644 index 6c2e422b..00000000 --- a/vendor/github.com/ipfs/go-datastore/query/query_impl.go +++ /dev/null @@ -1,142 +0,0 @@ -package query - -import ( - goprocess "github.com/jbenet/goprocess" -) - -// NaiveFilter applies a filter to the results. -func NaiveFilter(qr Results, filter Filter) Results { - return ResultsFromIterator(qr.Query(), Iterator{ - Next: func() (Result, bool) { - for { - e, ok := qr.NextSync() - if !ok { - return Result{}, false - } - if e.Error != nil || filter.Filter(e.Entry) { - return e, true - } - } - }, - Close: func() error { - return qr.Close() - }, - }) -} - -// NaiveLimit truncates the results to a given int limit -func NaiveLimit(qr Results, limit int) Results { - if limit == 0 { - // 0 means no limit - return qr - } - closed := false - return ResultsFromIterator(qr.Query(), Iterator{ - Next: func() (Result, bool) { - if limit == 0 { - if !closed { - closed = true - err := qr.Close() - if err != nil { - return Result{Error: err}, true - } - } - return Result{}, false - } - limit-- - return qr.NextSync() - }, - Close: func() error { - if closed { - return nil - } - closed = true - return qr.Close() - }, - }) -} - -// NaiveOffset skips a given number of results -func NaiveOffset(qr Results, offset int) Results { - return ResultsFromIterator(qr.Query(), Iterator{ - Next: func() (Result, bool) { - for ; offset > 0; offset-- { - res, ok := qr.NextSync() - if !ok || res.Error != nil { - return res, ok - } - } - return qr.NextSync() - }, - Close: func() error { - return qr.Close() - }, - }) -} - -// NaiveOrder reorders results according to given orders. -// WARNING: this is the only non-stream friendly operation! -func NaiveOrder(qr Results, orders ...Order) Results { - // Short circuit. - if len(orders) == 0 { - return qr - } - - return ResultsWithProcess(qr.Query(), func(worker goprocess.Process, out chan<- Result) { - defer qr.Close() - var entries []Entry - collect: - for { - select { - case <-worker.Closing(): - return - case e, ok := <-qr.Next(): - if !ok { - break collect - } - if e.Error != nil { - out <- e - continue - } - entries = append(entries, e.Entry) - } - } - - Sort(orders, entries) - - for _, e := range entries { - select { - case <-worker.Closing(): - return - case out <- Result{Entry: e}: - } - } - }) -} - -func NaiveQueryApply(q Query, qr Results) Results { - if q.Prefix != "" { - qr = NaiveFilter(qr, FilterKeyPrefix{q.Prefix}) - } - for _, f := range q.Filters { - qr = NaiveFilter(qr, f) - } - if len(q.Orders) > 0 { - qr = NaiveOrder(qr, q.Orders...) - } - if q.Offset != 0 { - qr = NaiveOffset(qr, q.Offset) - } - if q.Limit != 0 { - qr = NaiveLimit(qr, q.Limit) - } - return qr -} - -func ResultEntriesFrom(keys []string, vals [][]byte) []Entry { - re := make([]Entry, len(keys)) - for i, k := range keys { - re[i] = Entry{Key: k, Value: vals[i]} - } - return re -} diff --git a/vendor/github.com/ipfs/go-datastore/retrystore/retrystore.go b/vendor/github.com/ipfs/go-datastore/retrystore/retrystore.go deleted file mode 100644 index a03daa8c..00000000 --- a/vendor/github.com/ipfs/go-datastore/retrystore/retrystore.go +++ /dev/null @@ -1,96 +0,0 @@ -// Package retrystore provides a datastore wrapper which -// allows to retry operations. -package retrystore - -import ( - "fmt" - "time" - - ds "github.com/ipfs/go-datastore" -) - -// Datastore wraps a Batching datastore with a -// user-provided TempErrorFunc -which determines if an error -// is a temporal error and thus, worth retrying-, an amount of Retries -// -which specify how many times to retry an operation after -// a temporal error- and a base Delay, which is multiplied by the -// current retry and performs a pause before attempting the operation again. -type Datastore struct { - TempErrFunc func(error) bool - Retries int - Delay time.Duration - - ds.Batching -} - -var errFmtString = "ran out of retries trying to get past temporary error: %s" - -func (d *Datastore) runOp(op func() error) error { - err := op() - if err == nil || !d.TempErrFunc(err) { - return err - } - - for i := 0; i < d.Retries; i++ { - time.Sleep(time.Duration(i+1) * d.Delay) - - err = op() - if err == nil || !d.TempErrFunc(err) { - return err - } - } - - return fmt.Errorf(errFmtString, err) -} - -// DiskUsage implements the PersistentDatastore interface. -func (d *Datastore) DiskUsage() (uint64, error) { - var size uint64 - err := d.runOp(func() error { - var err error - size, err = ds.DiskUsage(d.Batching) - return err - }) - return size, err -} - -// Get retrieves a value given a key. -func (d *Datastore) Get(k ds.Key) ([]byte, error) { - var val []byte - err := d.runOp(func() error { - var err error - val, err = d.Batching.Get(k) - return err - }) - - return val, err -} - -// Put stores a key/value. -func (d *Datastore) Put(k ds.Key, val []byte) error { - return d.runOp(func() error { - return d.Batching.Put(k, val) - }) -} - -// Has checks if a key is stored. -func (d *Datastore) Has(k ds.Key) (bool, error) { - var has bool - err := d.runOp(func() error { - var err error - has, err = d.Batching.Has(k) - return err - }) - return has, err -} - -// GetSize returns the size of the value in the datastore, if present. -func (d *Datastore) GetSize(k ds.Key) (int, error) { - var size int - err := d.runOp(func() error { - var err error - size, err = d.Batching.GetSize(k) - return err - }) - return size, err -} diff --git a/vendor/github.com/ipfs/go-datastore/sync/sync.go b/vendor/github.com/ipfs/go-datastore/sync/sync.go deleted file mode 100644 index 5a4bb0e7..00000000 --- a/vendor/github.com/ipfs/go-datastore/sync/sync.go +++ /dev/null @@ -1,167 +0,0 @@ -package sync - -import ( - "sync" - - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" -) - -// MutexDatastore contains a child datastire and a mutex. -// used for coarse sync -type MutexDatastore struct { - sync.RWMutex - - child ds.Datastore -} - -// MutexWrap constructs a datastore with a coarse lock around the entire -// datastore, for every single operation. -func MutexWrap(d ds.Datastore) *MutexDatastore { - return &MutexDatastore{child: d} -} - -// Children implements Shim -func (d *MutexDatastore) Children() []ds.Datastore { - return []ds.Datastore{d.child} -} - -// Put implements Datastore.Put -func (d *MutexDatastore) Put(key ds.Key, value []byte) (err error) { - d.Lock() - defer d.Unlock() - return d.child.Put(key, value) -} - -// Get implements Datastore.Get -func (d *MutexDatastore) Get(key ds.Key) (value []byte, err error) { - d.RLock() - defer d.RUnlock() - return d.child.Get(key) -} - -// Has implements Datastore.Has -func (d *MutexDatastore) Has(key ds.Key) (exists bool, err error) { - d.RLock() - defer d.RUnlock() - return d.child.Has(key) -} - -// GetSize implements Datastore.GetSize -func (d *MutexDatastore) GetSize(key ds.Key) (size int, err error) { - d.RLock() - defer d.RUnlock() - return d.child.GetSize(key) -} - -// Delete implements Datastore.Delete -func (d *MutexDatastore) Delete(key ds.Key) (err error) { - d.Lock() - defer d.Unlock() - return d.child.Delete(key) -} - -// Query implements Datastore.Query -func (d *MutexDatastore) Query(q dsq.Query) (dsq.Results, error) { - d.RLock() - defer d.RUnlock() - - // Apply the entire query while locked. Non-sync datastores may not - // allow concurrent queries. - - results, err := d.child.Query(q) - if err != nil { - return nil, err - } - - entries, err1 := results.Rest() - err2 := results.Close() - switch { - case err1 != nil: - return nil, err1 - case err2 != nil: - return nil, err2 - } - return dsq.ResultsWithEntries(q, entries), nil -} - -func (d *MutexDatastore) Batch() (ds.Batch, error) { - d.RLock() - defer d.RUnlock() - bds, ok := d.child.(ds.Batching) - if !ok { - return nil, ds.ErrBatchUnsupported - } - - b, err := bds.Batch() - if err != nil { - return nil, err - } - return &syncBatch{ - batch: b, - mds: d, - }, nil -} - -func (d *MutexDatastore) Close() error { - d.RWMutex.Lock() - defer d.RWMutex.Unlock() - return d.child.Close() -} - -// DiskUsage implements the PersistentDatastore interface. -func (d *MutexDatastore) DiskUsage() (uint64, error) { - d.RLock() - defer d.RUnlock() - return ds.DiskUsage(d.child) -} - -type syncBatch struct { - batch ds.Batch - mds *MutexDatastore -} - -func (b *syncBatch) Put(key ds.Key, val []byte) error { - b.mds.Lock() - defer b.mds.Unlock() - return b.batch.Put(key, val) -} - -func (b *syncBatch) Delete(key ds.Key) error { - b.mds.Lock() - defer b.mds.Unlock() - return b.batch.Delete(key) -} - -func (b *syncBatch) Commit() error { - b.mds.Lock() - defer b.mds.Unlock() - return b.batch.Commit() -} - -func (d *MutexDatastore) Check() error { - if c, ok := d.child.(ds.CheckedDatastore); ok { - d.RWMutex.Lock() - defer d.RWMutex.Unlock() - return c.Check() - } - return nil -} - -func (d *MutexDatastore) Scrub() error { - if c, ok := d.child.(ds.ScrubbedDatastore); ok { - d.RWMutex.Lock() - defer d.RWMutex.Unlock() - return c.Scrub() - } - return nil -} - -func (d *MutexDatastore) CollectGarbage() error { - if c, ok := d.child.(ds.GCDatastore); ok { - d.RWMutex.Lock() - defer d.RWMutex.Unlock() - return c.CollectGarbage() - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ds-badger/.travis.yml b/vendor/github.com/ipfs/go-ds-badger/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ds-badger/LICENSE b/vendor/github.com/ipfs/go-ds-badger/LICENSE deleted file mode 100644 index 1e2cfe14..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Łukasz Magiera - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/ipfs/go-ds-badger/Makefile b/vendor/github.com/ipfs/go-ds-badger/Makefile deleted file mode 100644 index 785abac8..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/Makefile +++ /dev/null @@ -1,14 +0,0 @@ - -test: deps - go test -race -v ./... - -export IPFS_API ?= v04x.ipfs.io - -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - go get -t ./... diff --git a/vendor/github.com/ipfs/go-ds-badger/README.md b/vendor/github.com/ipfs/go-ds-badger/README.md deleted file mode 100644 index b3e55c63..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# go-ds-badger - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ds-badger?status.svg)](https://godoc.org/github.com/ipfs/go-ds-badger) -[![Build Status](https://travis-ci.org/ipfs/go-ds-badger.svg?branch=master)](https://travis-ci.org/ipfs/go-ds-badger) - -> Datastore implementation using [badger](https://github.com/dgraph-io/badger) as backend. - -## Documentation - -https://godoc.org/github.com/ipfs/go-ds-badger - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-ds-badger/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT diff --git a/vendor/github.com/ipfs/go-ds-badger/codecov.yml b/vendor/github.com/ipfs/go-ds-badger/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-ds-badger/datastore.go b/vendor/github.com/ipfs/go-ds-badger/datastore.go deleted file mode 100644 index 8204e04e..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/datastore.go +++ /dev/null @@ -1,608 +0,0 @@ -package badger - -import ( - "errors" - "fmt" - "strings" - "sync" - "time" - - badger "github.com/dgraph-io/badger" - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" - logger "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" -) - -var log = logger.Logger("badger") - -var ErrClosed = errors.New("datastore closed") - -type Datastore struct { - DB *badger.DB - - closeLk sync.RWMutex - closed bool - closeOnce sync.Once - closing chan struct{} - - gcDiscardRatio float64 -} - -// Implements the datastore.Txn interface, enabling transaction support for -// the badger Datastore. -type txn struct { - ds *Datastore - txn *badger.Txn - - // Whether this transaction has been implicitly created as a result of a direct Datastore - // method invocation. - implicit bool -} - -// Options are the badger datastore options, reexported here for convenience. -type Options struct { - gcDiscardRatio float64 - - badger.Options -} - -// DefaultOptions are the default options for the badger datastore. -var DefaultOptions Options - -func init() { - DefaultOptions = Options{ - gcDiscardRatio: 0.1, - Options: badger.DefaultOptions, - } - DefaultOptions.Options.CompactL0OnClose = false - DefaultOptions.Options.Truncate = true -} - -var _ ds.Datastore = (*Datastore)(nil) -var _ ds.TxnDatastore = (*Datastore)(nil) -var _ ds.TTLDatastore = (*Datastore)(nil) - -// NewDatastore creates a new badger datastore. -// -// DO NOT set the Dir and/or ValuePath fields of opt, they will be set for you. -func NewDatastore(path string, options *Options) (*Datastore, error) { - // Copy the options because we modify them. - var opt badger.Options - var gcDiscardRatio float64 - if options == nil { - opt = badger.DefaultOptions - gcDiscardRatio = DefaultOptions.gcDiscardRatio - } else { - opt = options.Options - gcDiscardRatio = options.gcDiscardRatio - } - - opt.Dir = path - opt.ValueDir = path - opt.Logger = log - - kv, err := badger.Open(opt) - if err != nil { - if strings.HasPrefix(err.Error(), "manifest has unsupported version:") { - err = fmt.Errorf("unsupported badger version, use github.com/ipfs/badgerds-upgrade to upgrade: %s", err.Error()) - } - return nil, err - } - - return &Datastore{ - DB: kv, - closing: make(chan struct{}), - gcDiscardRatio: gcDiscardRatio, - }, nil -} - -// NewTransaction starts a new transaction. The resulting transaction object -// can be mutated without incurring changes to the underlying Datastore until -// the transaction is Committed. -func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return nil, ErrClosed - } - - return &txn{d, d.DB.NewTransaction(!readOnly), false}, nil -} - -// newImplicitTransaction creates a transaction marked as 'implicit'. -// Implicit transactions are created by Datastore methods performing single operations. -func (d *Datastore) newImplicitTransaction(readOnly bool) *txn { - return &txn{d, d.DB.NewTransaction(!readOnly), true} -} - -func (d *Datastore) Put(key ds.Key, value []byte) error { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return ErrClosed - } - - txn := d.newImplicitTransaction(false) - defer txn.discard() - - if err := txn.put(key, value); err != nil { - return err - } - - return txn.commit() -} - -func (d *Datastore) PutWithTTL(key ds.Key, value []byte, ttl time.Duration) error { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return ErrClosed - } - - txn := d.newImplicitTransaction(false) - defer txn.discard() - - if err := txn.putWithTTL(key, value, ttl); err != nil { - return err - } - - return txn.commit() -} - -func (d *Datastore) SetTTL(key ds.Key, ttl time.Duration) error { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return ErrClosed - } - - txn := d.newImplicitTransaction(false) - defer txn.discard() - - if err := txn.setTTL(key, ttl); err != nil { - return err - } - - return txn.commit() -} - -func (d *Datastore) GetExpiration(key ds.Key) (time.Time, error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return time.Time{}, ErrClosed - } - - txn := d.newImplicitTransaction(false) - defer txn.discard() - - return txn.getExpiration(key) -} - -func (d *Datastore) Get(key ds.Key) (value []byte, err error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return nil, ErrClosed - } - - txn := d.newImplicitTransaction(true) - defer txn.discard() - - return txn.get(key) -} - -func (d *Datastore) Has(key ds.Key) (bool, error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return false, ErrClosed - } - - txn := d.newImplicitTransaction(true) - defer txn.discard() - - return txn.has(key) -} - -func (d *Datastore) GetSize(key ds.Key) (size int, err error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return -1, ErrClosed - } - - txn := d.newImplicitTransaction(true) - defer txn.discard() - - return txn.getSize(key) -} - -func (d *Datastore) Delete(key ds.Key) error { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - - txn := d.newImplicitTransaction(false) - defer txn.discard() - - err := txn.delete(key) - if err != nil { - return err - } - - return txn.commit() -} - -func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - - txn := d.newImplicitTransaction(true) - // We cannot defer txn.Discard() here, as the txn must remain active while the iterator is open. - // https://github.com/dgraph-io/badger/commit/b1ad1e93e483bbfef123793ceedc9a7e34b09f79 - // The closing logic in the query goprocess takes care of discarding the implicit transaction. - return txn.query(q) -} - -// DiskUsage implements the PersistentDatastore interface. -// It returns the sum of lsm and value log files sizes in bytes. -func (d *Datastore) DiskUsage() (uint64, error) { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return 0, ErrClosed - } - lsm, vlog := d.DB.Size() - return uint64(lsm + vlog), nil -} - -func (d *Datastore) Close() error { - d.closeOnce.Do(func() { - close(d.closing) - }) - d.closeLk.Lock() - defer d.closeLk.Unlock() - if d.closed { - return ErrClosed - } - d.closed = true - return d.DB.Close() -} - -func (d *Datastore) Batch() (ds.Batch, error) { - tx, _ := d.NewTransaction(false) - return tx, nil -} - -func (d *Datastore) CollectGarbage() error { - d.closeLk.RLock() - defer d.closeLk.RUnlock() - if d.closed { - return ErrClosed - } - - err := d.DB.RunValueLogGC(d.gcDiscardRatio) - if err == badger.ErrNoRewrite { - err = nil - } - return err -} - -var _ ds.Datastore = (*txn)(nil) -var _ ds.TTLDatastore = (*txn)(nil) - -func (t *txn) Put(key ds.Key, value []byte) error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - return t.put(key, value) -} - -func (t *txn) put(key ds.Key, value []byte) error { - return t.txn.Set(key.Bytes(), value) -} - -func (t *txn) PutWithTTL(key ds.Key, value []byte, ttl time.Duration) error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - return t.putWithTTL(key, value, ttl) -} - -func (t *txn) putWithTTL(key ds.Key, value []byte, ttl time.Duration) error { - return t.txn.SetWithTTL(key.Bytes(), value, ttl) -} - -func (t *txn) GetExpiration(key ds.Key) (time.Time, error) { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return time.Time{}, ErrClosed - } - - return t.getExpiration(key) -} - -func (t *txn) getExpiration(key ds.Key) (time.Time, error) { - item, err := t.txn.Get(key.Bytes()) - if err == badger.ErrKeyNotFound { - return time.Time{}, ds.ErrNotFound - } else if err != nil { - return time.Time{}, err - } - return time.Unix(int64(item.ExpiresAt()), 0), nil -} - -func (t *txn) SetTTL(key ds.Key, ttl time.Duration) error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - - return t.setTTL(key, ttl) -} - -func (t *txn) setTTL(key ds.Key, ttl time.Duration) error { - item, err := t.txn.Get(key.Bytes()) - if err != nil { - return err - } - return item.Value(func(data []byte) error { - return t.putWithTTL(key, data, ttl) - }) - -} - -func (t *txn) Get(key ds.Key) ([]byte, error) { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return nil, ErrClosed - } - - return t.get(key) -} - -func (t *txn) get(key ds.Key) ([]byte, error) { - item, err := t.txn.Get(key.Bytes()) - if err == badger.ErrKeyNotFound { - err = ds.ErrNotFound - } - if err != nil { - return nil, err - } - - return item.ValueCopy(nil) -} - -func (t *txn) Has(key ds.Key) (bool, error) { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return false, ErrClosed - } - - return t.has(key) -} - -func (t *txn) has(key ds.Key) (bool, error) { - _, err := t.txn.Get(key.Bytes()) - switch err { - case badger.ErrKeyNotFound: - return false, nil - case nil: - return true, nil - default: - return false, err - } -} - -func (t *txn) GetSize(key ds.Key) (int, error) { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return -1, ErrClosed - } - - return t.getSize(key) -} - -func (t *txn) getSize(key ds.Key) (int, error) { - item, err := t.txn.Get(key.Bytes()) - switch err { - case nil: - return int(item.ValueSize()), nil - case badger.ErrKeyNotFound: - return -1, ds.ErrNotFound - default: - return -1, err - } -} - -func (t *txn) Delete(key ds.Key) error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - - return t.delete(key) -} - -func (t *txn) delete(key ds.Key) error { - return t.txn.Delete(key.Bytes()) -} - -func (t *txn) Query(q dsq.Query) (dsq.Results, error) { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return nil, ErrClosed - } - - return t.query(q) -} - -func (t *txn) query(q dsq.Query) (dsq.Results, error) { - prefix := []byte(q.Prefix) - opt := badger.DefaultIteratorOptions - opt.PrefetchValues = !q.KeysOnly - - // Special case order by key. - orders := q.Orders - if len(orders) > 0 { - switch q.Orders[0].(type) { - case dsq.OrderByKey, *dsq.OrderByKey: - // Already ordered by key. - orders = nil - case dsq.OrderByKeyDescending, *dsq.OrderByKeyDescending: - orders = nil - opt.Reverse = true - } - } - - txn := t.txn - - it := txn.NewIterator(opt) - it.Seek(prefix) - - if q.Offset > 0 { - for j := 0; j < q.Offset; j++ { - it.Next() - } - } - - qrb := dsq.NewResultBuilder(q) - - qrb.Process.Go(func(worker goprocess.Process) { - t.ds.closeLk.RLock() - closedEarly := false - defer func() { - t.ds.closeLk.RUnlock() - if closedEarly { - select { - case qrb.Output <- dsq.Result{ - Error: ErrClosed, - }: - case <-qrb.Process.Closing(): - } - } - - }() - if t.ds.closed { - closedEarly = true - return - } - - // this iterator is part of an implicit transaction, so when - // we're done we must discard the transaction. It's safe to - // discard the txn it because it contains the iterator only. - if t.implicit { - defer t.discard() - } - - defer it.Close() - - for sent := 0; it.ValidForPrefix(prefix); sent++ { - if qrb.Query.Limit > 0 && sent >= qrb.Query.Limit { - break - } - - item := it.Item() - - k := string(item.Key()) - e := dsq.Entry{Key: k} - - var result dsq.Result - if !q.KeysOnly { - b, err := item.ValueCopy(nil) - if err != nil { - result = dsq.Result{Error: err} - } else { - e.Value = b - result = dsq.Result{Entry: e} - } - } else { - result = dsq.Result{Entry: e} - } - - if q.ReturnExpirations { - result.Expiration = time.Unix(int64(item.ExpiresAt()), 0) - } - - select { - case qrb.Output <- result: - case <-t.ds.closing: // datastore closing. - closedEarly = true - return - case <-worker.Closing(): // client told us to close early - return - } - - it.Next() - } - - return - }) - - go qrb.Process.CloseAfterChildren() - - // Now, apply remaining things (filters, order) - qr := qrb.Results() - for _, f := range q.Filters { - qr = dsq.NaiveFilter(qr, f) - } - if len(orders) > 0 { - qr = dsq.NaiveOrder(qr, orders...) - } - - return qr, nil -} - -func (t *txn) Commit() error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - - return t.commit() -} - -func (t *txn) commit() error { - return t.txn.Commit() -} - -// Alias to commit -func (t *txn) Close() error { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return ErrClosed - } - return t.close() -} - -func (t *txn) close() error { - return t.txn.Commit() -} - -func (t *txn) Discard() { - t.ds.closeLk.RLock() - defer t.ds.closeLk.RUnlock() - if t.ds.closed { - return - } - - t.discard() -} - -func (t *txn) discard() { - t.txn.Discard() -} diff --git a/vendor/github.com/ipfs/go-ds-badger/go.mod b/vendor/github.com/ipfs/go-ds-badger/go.mod deleted file mode 100644 index b5ce2565..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/ipfs/go-ds-badger - -require ( - github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 // indirect - github.com/dgraph-io/badger v2.0.0-rc.2+incompatible - github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/golang/protobuf v1.3.0 // indirect - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 - github.com/pkg/errors v0.8.1 // indirect -) diff --git a/vendor/github.com/ipfs/go-ds-badger/go.sum b/vendor/github.com/ipfs/go-ds-badger/go.sum deleted file mode 100644 index 75c9054b..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/go.sum +++ /dev/null @@ -1,62 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.4 h1:gVTrpUTbbr/T24uvoCaqY2KSHfNLVGm0w+hbee2HMeg= -github.com/dgraph-io/badger v1.5.4/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f h1:6itBiEUtu+gOzXZWn46bM5/qm8LlV6/byR7Yflx/y6M= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v2.0.0-rc.2+incompatible h1:7KPp6xv5+wymkVUbkAnZZXvmDrJlf09m/7u1HG5lAYA= -github.com/dgraph-io/badger v2.0.0-rc.2+incompatible/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f h1:dDxpBYafY/GYpcl+LS4Bn3ziLPuEdGRkRjYAbSlWxSA= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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= diff --git a/vendor/github.com/ipfs/go-ds-badger/package.json b/vendor/github.com/ipfs/go-ds-badger/package.json deleted file mode 100644 index cca00dee..00000000 --- a/vendor/github.com/ipfs/go-ds-badger/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "author": "magik6k", - "bugs": { - "url": "https://github.com/ipfs/go-ds-badger" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ds-badger" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP", - "name": "goprocess", - "version": "1.0.0" - }, - { - "author": "jbenet", - "hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9", - "name": "go-datastore", - "version": "3.6.1" - }, - { - "author": "dgraph-io", - "hash": "QmU4emVTYFKnoJ5yK3pPEN9joyEx6U7y892PDx26ZtNxQd", - "name": "badger", - "version": "2.11.4" - }, - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - } - ], - "gxVersion": "0.8.0", - "language": "go", - "license": "", - "name": "go-ds-badger", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.12.4" -} - diff --git a/vendor/github.com/ipfs/go-ds-flatfs/.gitignore b/vendor/github.com/ipfs/go-ds-flatfs/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/ipfs/go-ds-flatfs/.travis.yml b/vendor/github.com/ipfs/go-ds-flatfs/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ds-flatfs/LICENSE b/vendor/github.com/ipfs/go-ds-flatfs/LICENSE deleted file mode 100644 index f2049023..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ds-flatfs/Makefile b/vendor/github.com/ipfs/go-ds-flatfs/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/ipfs/go-ds-flatfs/README.md b/vendor/github.com/ipfs/go-ds-flatfs/README.md deleted file mode 100644 index 9f51bd58..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# go-ds-flatfs - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ds-flatfs?status.svg)](https://godoc.org/github.com/ipfs/go-ds-flatfs) -[![Build Status](https://travis-ci.org/ipfs/go-ds-flatfs.svg?branch=master)](https://travis-ci.org/ipfs/go-ds-flatfs) -[![Coverage Status](https://img.shields.io/codecov/c/github/ipfs/go-ds-flatfs.svg)](https://codecov.io/gh/ipfs/go-ds-flatfs) - - -> A datastore implementation using sharded directories and flat files to store data - -`go-ds-flatfs` is used by `go-ipfs` to store raw block contents on disk. It supports several sharding functions (prefix, suffix, next-to-last/*). - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ds-flatfs` can be used like any Go module: - - -``` -import "github.com/ipfs/go-ds-flatfs" -``` - -`go-ds-flatfs` uses [`Gx`](https://github.com/whyrusleeping/gx) and [`Gx-go`](https://github.com/whyrusleeping/gx-go) to handle dependendencies. Run `make deps` to download and rewrite the imports to their fixed dependencies. - -## Usage - -Check the [GoDoc module documentation](https://godoc.org/github.com/ipfs/go-ds-flatfs) for an overview of this module's -functionality. - -### DiskUsage and Accuracy - -This datastore implements the [`PersistentDatastore`](https://godoc.org/github.com/ipfs/go-datastore#PersistentDatastore) interface. It offers a `DiskUsage()` method which strives to find a balance between accuracy and performance. This implies: - -* The total disk usage of a datastore is calculated when opening the datastore -* The current disk usage is cached frequently in a file in the datastore root (`diskUsage.cache` by default). This file is also -written when the datastore is closed. -* If this file is not present when the datastore is opened: - * The disk usage will be calculated by walking the datastore's directory tree and estimating the size of each folder. - * This may be a very slow operation for huge datastores or datastores with slow disks - * The operation is time-limited (5 minutes by default). - * Upon timeout, the remaining folders will be assumed to have the average of the previously processed ones. -* After opening, the disk usage is updated in every write/delete operation. - -This means that for certain datastores (huge ones, those with very slow disks or special content), the values reported by -`DiskUsage()` might be reduced accuracy and the first startup (without a `diskUsage.cache` file present), might be slow. - -If you need increased accuracy or a fast start from the first time, you can manually create or update the -`diskUsage.cache` file. - -The file `diskUsage.cache` is a JSON file with two fields `diskUsage` and `accuracy`. For example the JSON file for a -small repo might be: - -``` -{"diskUsage":6357,"accuracy":"initial-exact"} -``` - -`diskUsage` is the calculated disk usage and `accuracy` is a note on the accuracy of the initial calculation. If the -initial calculation was accurate the file will contain the value `initial-exact`. If some of the directories have too -many entries and the disk usage for that directory was estimated based on the first 2000 entries, the file will contain -`initial-approximate`. If the calculation took too long and timed out as indicated above, the file will contain -`initial-timed-out`. - -If the initial calculation timed out the JSON file might be: -``` -{"diskUsage":7589482442898,"accuracy":"initial-timed-out"} - -``` - -To fix this with a more accurate value you could do (in the datastore root): - - $ du -sb . - 7536515831332 . - $ echo -n '{"diskUsage":7536515831332,"accuracy":"initial-exact"}' > diskUsage.cache - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ds-flatfs/codecov.yml b/vendor/github.com/ipfs/go-ds-flatfs/codecov.yml deleted file mode 100644 index db247200..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: off diff --git a/vendor/github.com/ipfs/go-ds-flatfs/convert.go b/vendor/github.com/ipfs/go-ds-flatfs/convert.go deleted file mode 100644 index 308a03a9..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/convert.go +++ /dev/null @@ -1,182 +0,0 @@ -// Package flatfs is a Datastore implementation that stores all -// objects in a two-level directory structure in the local file -// system, regardless of the hierarchy of the keys. -package flatfs - -import ( - "errors" - "fmt" - "io" - "os" - "path/filepath" - "strings" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" -) - -func UpgradeV0toV1(path string, prefixLen int) error { - fun := Prefix(prefixLen) - err := WriteShardFunc(path, fun) - if err != nil { - return err - } - err = WriteReadme(path, fun) - if err != nil { - return err - } - return nil -} - -func DowngradeV1toV0(path string) error { - fun, err := ReadShardFunc(path) - if err != nil { - return err - } else if fun.funName != "prefix" { - return fmt.Errorf("%s: can only downgrade datastore that use the 'prefix' sharding function", path) - } - - err = os.Remove(filepath.Join(path, SHARDING_FN)) - if err != nil { - return err - } - err = os.Remove(filepath.Join(path, README_FN)) - if err != nil && !os.IsNotExist(err) { - return err - } - return nil -} - -func Move(oldPath string, newPath string, out io.Writer) error { - oldDS, err := Open(oldPath, false) - if err != nil { - return fmt.Errorf("%s: %v", oldPath, err) - } - oldDS.deactivate() - newDS, err := Open(newPath, false) - if err != nil { - return fmt.Errorf("%s: %v", newPath, err) - } - newDS.deactivate() - - res, err := oldDS.Query(query.Query{KeysOnly: true}) - if err != nil { - return err - } - - if out != nil { - fmt.Fprintf(out, "Moving Keys...\n") - } - - // first move the keys - count := 0 - for { - e, ok := res.NextSync() - if !ok { - break - } - if e.Error != nil { - return e.Error - } - - err := moveKey(oldDS, newDS, datastore.RawKey(e.Key)) - if err != nil { - return err - } - - count++ - if out != nil && count%10 == 0 { - fmt.Fprintf(out, "\r%d keys so far", count) - } - } - - if out != nil { - fmt.Fprintf(out, "\nCleaning Up...\n") - } - - // now walk the old top-level directory - dir, err := os.Open(oldDS.path) - if err != nil { - return err - } - defer dir.Close() - names, err := dir.Readdirnames(-1) - if err != nil { - return err - } - for _, fn := range names { - if fn == "." || fn == ".." { - continue - } - oldPath := filepath.Join(oldDS.path, fn) - inf, err := os.Stat(oldPath) - if err != nil { - return err - } - if inf.IsDir() { - indir, err := os.Open(oldPath) - if err != nil { - return err - } - - names, err := indir.Readdirnames(-1) - indir.Close() - if err != nil { - return err - } - - for _, n := range names { - p := filepath.Join(oldPath, n) - // part of unfinished write transaction - // remove it - if strings.HasPrefix(n, "put-") { - err := os.Remove(p) - if err != nil { - return err - } - } else { - return errors.New("unknown file in flatfs: " + p) - } - } - - err = os.Remove(oldPath) - if err != nil { - return err - } - } else if fn == SHARDING_FN || fn == README_FN { - // generated file so just remove it - err := os.Remove(oldPath) - if err != nil { - return err - } - } else { - // else we found something unexpected, so to be safe just move it - log.Warningf("found unexpected file in datastore directory: \"%s\", moving anyway\n", fn) - newPath := filepath.Join(newDS.path, fn) - err := os.Rename(oldPath, newPath) - if err != nil { - return err - } - } - } - - if out != nil { - fmt.Fprintf(out, "All Done.\n") - } - - return nil -} - -func moveKey(oldDS *Datastore, newDS *Datastore, key datastore.Key) error { - _, oldPath := oldDS.encode(key) - dir, newPath := newDS.encode(key) - err := os.Mkdir(dir, 0755) - if err != nil && !os.IsExist(err) { - return err - } - err = os.Rename(oldPath, newPath) - if err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ds-flatfs/flatfs.go b/vendor/github.com/ipfs/go-ds-flatfs/flatfs.go deleted file mode 100644 index 4afebabf..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/flatfs.go +++ /dev/null @@ -1,1101 +0,0 @@ -// Package flatfs is a Datastore implementation that stores all -// objects in a two-level directory structure in the local file -// system, regardless of the hierarchy of the keys. -package flatfs - -import ( - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "math" - "math/rand" - "os" - "path/filepath" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" - "github.com/jbenet/goprocess" - - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("flatfs") - -const ( - extension = ".data" - diskUsageMessageTimeout = 5 * time.Second - diskUsageCheckpointPercent = 1.0 - diskUsageCheckpointTimeout = 2 * time.Second -) - -var ( - // DiskUsageFile is the name of the file to cache the size of the - // datastore in disk - DiskUsageFile = "diskUsage.cache" - // DiskUsageFilesAverage is the maximum number of files per folder - // to stat in order to calculate the size of the datastore. - // The size of the rest of the files in a folder will be assumed - // to be the average of the values obtained. This includes - // regular files and directories. - DiskUsageFilesAverage = 2000 - // DiskUsageCalcTimeout is the maximum time to spend - // calculating the DiskUsage upon a start when no - // DiskUsageFile is present. - // If this period did not suffice to read the size of the datastore, - // the remaining sizes will be stimated. - DiskUsageCalcTimeout = 5 * time.Minute -) - -const ( - opPut = iota - opDelete - opRename -) - -type initAccuracy string - -const ( - unknownA initAccuracy = "unknown" - exactA initAccuracy = "initial-exact" - approxA initAccuracy = "initial-approximate" - timedoutA initAccuracy = "initial-timed-out" -) - -func combineAccuracy(a, b initAccuracy) initAccuracy { - if a == unknownA || b == unknownA { - return unknownA - } - if a == timedoutA || b == timedoutA { - return timedoutA - } - if a == approxA || b == approxA { - return approxA - } - if a == exactA && b == exactA { - return exactA - } - if a == "" { - return b - } - if b == "" { - return a - } - return unknownA -} - -var _ datastore.Datastore = (*Datastore)(nil) - -var ( - ErrDatastoreExists = errors.New("datastore already exists") - ErrDatastoreDoesNotExist = errors.New("datastore directory does not exist") - ErrShardingFileMissing = fmt.Errorf("%s file not found in datastore", SHARDING_FN) - ErrClosed = errors.New("datastore closed") -) - -func init() { - rand.Seed(time.Now().UTC().UnixNano()) -} - -// Datastore implements the go-datastore Interface. -// Note this datastore cannot guarantee order of concurrent -// write operations to the same key. See the explanation in -// Put(). -type Datastore struct { - // atmoic operations should always be used with diskUsage. - // Must be first in struct to ensure correct alignment - // (see https://golang.org/pkg/sync/atomic/#pkg-note-BUG) - diskUsage int64 - - path string - - shardStr string - getDir ShardFunc - - // sychronize all writes and directory changes for added safety - sync bool - - // these values should only be used during internalization or - // inside the checkpoint loop - dirty bool - storedValue diskUsageValue - - // Used to trigger a checkpoint. - checkpointCh chan struct{} - done chan struct{} - - shutdownLock sync.RWMutex - shutdown bool - - // opMap handles concurrent write operations (put/delete) - // to the same key - opMap *opMap -} - -type diskUsageValue struct { - DiskUsage int64 `json:"diskUsage"` - Accuracy initAccuracy `json:"accuracy"` -} - -type ShardFunc func(string) string - -type opT int - -// op wraps useful arguments of write operations -type op struct { - typ opT // operation type - key datastore.Key // datastore key. Mandatory. - tmp string // temp file path - path string // file path - v []byte // value -} - -type opMap struct { - ops sync.Map -} - -type opResult struct { - mu sync.RWMutex - success bool - - opMap *opMap - name string -} - -// Returns nil if there's nothing to do. -func (m *opMap) Begin(name string) *opResult { - for { - myOp := &opResult{opMap: m, name: name} - myOp.mu.Lock() - opIface, loaded := m.ops.LoadOrStore(name, myOp) - if !loaded { // no one else doing ops with this key - return myOp - } - - op := opIface.(*opResult) - // someone else doing ops with this key, wait for - // the result - op.mu.RLock() - if op.success { - return nil - } - - // if we are here, we will retry the operation - } -} - -func (o *opResult) Finish(ok bool) { - o.success = ok - o.opMap.ops.Delete(o.name) - o.mu.Unlock() -} - -func Create(path string, fun *ShardIdV1) error { - - err := os.Mkdir(path, 0755) - if err != nil && !os.IsExist(err) { - return err - } - - dsFun, err := ReadShardFunc(path) - switch err { - case ErrShardingFileMissing: - isEmpty, err := DirIsEmpty(path) - if err != nil { - return err - } - if !isEmpty { - return fmt.Errorf("directory missing %s file: %s", SHARDING_FN, path) - } - - err = WriteShardFunc(path, fun) - if err != nil { - return err - } - err = WriteReadme(path, fun) - return err - case nil: - if fun.String() != dsFun.String() { - return fmt.Errorf("specified shard func '%s' does not match repo shard func '%s'", - fun.String(), dsFun.String()) - } - return ErrDatastoreExists - default: - return err - } -} - -func Open(path string, syncFiles bool) (*Datastore, error) { - _, err := os.Stat(path) - if os.IsNotExist(err) { - return nil, ErrDatastoreDoesNotExist - } else if err != nil { - return nil, err - } - - shardId, err := ReadShardFunc(path) - if err != nil { - return nil, err - } - - fs := &Datastore{ - path: path, - shardStr: shardId.String(), - getDir: shardId.Func(), - sync: syncFiles, - checkpointCh: make(chan struct{}, 1), - done: make(chan struct{}), - diskUsage: 0, - opMap: new(opMap), - } - - // This sets diskUsage to the correct value - // It might be slow, but allowing it to happen - // while the datastore is usable might - // cause diskUsage to not be accurate. - err = fs.calculateDiskUsage() - if err != nil { - // Cannot stat() all - // elements in the datastore. - return nil, err - } - - go fs.checkpointLoop() - return fs, nil -} - -// convenience method -func CreateOrOpen(path string, fun *ShardIdV1, sync bool) (*Datastore, error) { - err := Create(path, fun) - if err != nil && err != ErrDatastoreExists { - return nil, err - } - return Open(path, sync) -} - -func (fs *Datastore) ShardStr() string { - return fs.shardStr -} - -func (fs *Datastore) encode(key datastore.Key) (dir, file string) { - noslash := key.String()[1:] - dir = filepath.Join(fs.path, fs.getDir(noslash)) - file = filepath.Join(dir, noslash+extension) - return dir, file -} - -func (fs *Datastore) decode(file string) (key datastore.Key, ok bool) { - if filepath.Ext(file) != extension { - return datastore.Key{}, false - } - name := file[:len(file)-len(extension)] - return datastore.NewKey(name), true -} - -func (fs *Datastore) makeDir(dir string) error { - if err := fs.makeDirNoSync(dir); err != nil { - return err - } - - // In theory, if we create a new prefix dir and add a file to - // it, the creation of the prefix dir itself might not be - // durable yet. Sync the root dir after a successful mkdir of - // a prefix dir, just to be paranoid. - if fs.sync { - if err := syncDir(fs.path); err != nil { - return err - } - } - return nil -} - -func (fs *Datastore) makeDirNoSync(dir string) error { - if err := os.Mkdir(dir, 0755); err != nil { - // EEXIST is safe to ignore here, that just means the prefix - // directory already existed. - if !os.IsExist(err) { - return err - } - return nil - } - - // Track DiskUsage of this NEW folder - fs.updateDiskUsage(dir, true) - return nil -} - -// This function always runs under an opLock. Therefore, only one thread is -// touching the affected files. -func (fs *Datastore) renameAndUpdateDiskUsage(tmpPath, path string) error { - fi, err := os.Stat(path) - - // Destination exists, we need to discount it from diskUsage - if fs != nil && err == nil { - atomic.AddInt64(&fs.diskUsage, -fi.Size()) - } else if !os.IsNotExist(err) { - return err - } - - // Rename and add new file's diskUsage. If the rename fails, - // it will either a) Re-add the size of an existing file, which - // was sustracted before b) Add 0 if there is no existing file. - err = os.Rename(tmpPath, path) - fs.updateDiskUsage(path, true) - return err -} - -var putMaxRetries = 6 - -// Put stores a key/value in the datastore. -// -// Note, that we do not guarantee order of write operations (Put or Delete) -// to the same key in this datastore. -// -// For example. i.e. in the case of two concurrent Put, we only guarantee -// that one of them will come through, but cannot assure which one even if -// one arrived slightly later than the other. In the case of a -// concurrent Put and a Delete operation, we cannot guarantee which one -// will win. -func (fs *Datastore) Put(key datastore.Key, value []byte) error { - fs.shutdownLock.RLock() - defer fs.shutdownLock.RUnlock() - if fs.shutdown { - return ErrClosed - } - - var err error - for i := 1; i <= putMaxRetries; i++ { - err = fs.doWriteOp(&op{ - typ: opPut, - key: key, - v: value, - }) - if err == nil { - break - } - - if !strings.Contains(err.Error(), "too many open files") { - break - } - - log.Errorf("too many open files, retrying in %dms", 100*i) - time.Sleep(time.Millisecond * 100 * time.Duration(i)) - } - return err -} - -func (fs *Datastore) doOp(oper *op) error { - switch oper.typ { - case opPut: - return fs.doPut(oper.key, oper.v) - case opDelete: - return fs.doDelete(oper.key) - case opRename: - return fs.renameAndUpdateDiskUsage(oper.tmp, oper.path) - default: - panic("bad operation, this is a bug") - } -} - -// doWrite optmizes out write operations (put/delete) to the same -// key by queueing them and suceeding all queued -// operations if one of them does. In such case, -// we assume that the first suceeding operation -// on that key was the last one to happen after -// all successful others. -func (fs *Datastore) doWriteOp(oper *op) error { - keyStr := oper.key.String() - - opRes := fs.opMap.Begin(keyStr) - if opRes == nil { // nothing to do, a concurrent op succeeded - return nil - } - - // Do the operation - err := fs.doOp(oper) - - // Finish it. If no error, it will signal other operations - // waiting on this result to succeed. Otherwise, they will - // retry. - opRes.Finish(err == nil) - return err -} - -func (fs *Datastore) doPut(key datastore.Key, val []byte) error { - - dir, path := fs.encode(key) - if err := fs.makeDir(dir); err != nil { - return err - } - - tmp, err := ioutil.TempFile(dir, "put-") - if err != nil { - return err - } - closed := false - removed := false - defer func() { - if !closed { - // silence errcheck - _ = tmp.Close() - } - if !removed { - // silence errcheck - _ = os.Remove(tmp.Name()) - } - }() - - if _, err := tmp.Write(val); err != nil { - return err - } - if fs.sync { - if err := syncFile(tmp); err != nil { - return err - } - } - if err := tmp.Close(); err != nil { - return err - } - closed = true - - err = fs.renameAndUpdateDiskUsage(tmp.Name(), path) - if err != nil { - return err - } - removed = true - - if fs.sync { - if err := syncDir(dir); err != nil { - return err - } - } - return nil -} - -func (fs *Datastore) putMany(data map[datastore.Key][]byte) error { - fs.shutdownLock.RLock() - defer fs.shutdownLock.RUnlock() - if fs.shutdown { - return ErrClosed - } - - var dirsToSync []string - - files := make(map[*os.File]*op, len(data)) - ops := make(map[*os.File]int, len(data)) - - defer func() { - for fi := range files { - val, _ := ops[fi] - switch val { - case 0: - _ = fi.Close() - fallthrough - case 1: - _ = os.Remove(fi.Name()) - } - } - }() - - for key, value := range data { - dir, path := fs.encode(key) - if err := fs.makeDirNoSync(dir); err != nil { - return err - } - dirsToSync = append(dirsToSync, dir) - - tmp, err := ioutil.TempFile(dir, "put-") - if err != nil { - return err - } - - if _, err := tmp.Write(value); err != nil { - return err - } - - files[tmp] = &op{ - typ: opRename, - path: path, - tmp: tmp.Name(), - key: key, - } - } - - // Now we sync everything - // sync and close files - for fi := range files { - if fs.sync { - if err := syncFile(fi); err != nil { - return err - } - } - - if err := fi.Close(); err != nil { - return err - } - - // signify closed - ops[fi] = 1 - } - - // move files to their proper places - for fi, op := range files { - err := fs.doWriteOp(op) - if err != nil { - return err - } - // signify removed - ops[fi] = 2 - } - - // now sync the dirs for those files - if fs.sync { - for _, dir := range dirsToSync { - if err := syncDir(dir); err != nil { - return err - } - } - - // sync top flatfs dir - if err := syncDir(fs.path); err != nil { - return err - } - } - - return nil -} - -func (fs *Datastore) Get(key datastore.Key) (value []byte, err error) { - _, path := fs.encode(key) - data, err := ioutil.ReadFile(path) - if err != nil { - if os.IsNotExist(err) { - return nil, datastore.ErrNotFound - } - // no specific error to return, so just pass it through - return nil, err - } - return data, nil -} - -func (fs *Datastore) Has(key datastore.Key) (exists bool, err error) { - _, path := fs.encode(key) - switch _, err := os.Stat(path); { - case err == nil: - return true, nil - case os.IsNotExist(err): - return false, nil - default: - return false, err - } -} - -func (fs *Datastore) GetSize(key datastore.Key) (size int, err error) { - _, path := fs.encode(key) - switch s, err := os.Stat(path); { - case err == nil: - return int(s.Size()), nil - case os.IsNotExist(err): - return -1, datastore.ErrNotFound - default: - return -1, err - } -} - -// Delete removes a key/value from the Datastore. Please read -// the Put() explanation about the handling of concurrent write -// operations to the same key. -func (fs *Datastore) Delete(key datastore.Key) error { - fs.shutdownLock.RLock() - defer fs.shutdownLock.RUnlock() - if fs.shutdown { - return ErrClosed - } - - return fs.doWriteOp(&op{ - typ: opDelete, - key: key, - v: nil, - }) -} - -// This function always runs within an opLock for the given -// key, and not concurrently. -func (fs *Datastore) doDelete(key datastore.Key) error { - _, path := fs.encode(key) - - fSize := fileSize(path) - - switch err := os.Remove(path); { - case err == nil: - atomic.AddInt64(&fs.diskUsage, -fSize) - fs.checkpointDiskUsage() - return nil - case os.IsNotExist(err): - return datastore.ErrNotFound - default: - return err - } -} - -func (fs *Datastore) Query(q query.Query) (query.Results, error) { - if (q.Prefix != "" && q.Prefix != "/") || - len(q.Filters) > 0 || - len(q.Orders) > 0 || - q.Limit > 0 || - q.Offset > 0 || - !q.KeysOnly { - // TODO this is overly simplistic, but the only caller is - // `ipfs refs local` for now, and this gets us moving. - return nil, errors.New("flatfs only supports listing all keys in random order") - } - - // Replicates the logic in ResultsWithChan but actually respects calls - // to `Close`. - b := query.NewResultBuilder(q) - b.Process.Go(func(p goprocess.Process) { - err := fs.walkTopLevel(fs.path, b) - if err == nil { - return - } - select { - case b.Output <- query.Result{Error: errors.New("walk failed: " + err.Error())}: - case <-p.Closing(): - } - }) - go b.Process.CloseAfterChildren() - - return b.Results(), nil -} - -func (fs *Datastore) walkTopLevel(path string, result *query.ResultBuilder) error { - dir, err := os.Open(path) - if err != nil { - return err - } - defer dir.Close() - names, err := dir.Readdirnames(-1) - if err != nil { - return err - } - for _, dir := range names { - if len(dir) == 0 || dir[0] == '.' { - continue - } - - err = fs.walk(filepath.Join(path, dir), result) - if err != nil { - return err - } - - // Are we closing? - select { - case <-result.Process.Closing(): - return nil - default: - } - } - return nil -} - -// folderSize estimates the diskUsage of a folder by reading -// up to DiskUsageFilesAverage entries in it and assumming any -// other files will have an avereage size. -func folderSize(path string, deadline time.Time) (int64, initAccuracy, error) { - var du int64 - - folder, err := os.Open(path) - if err != nil { - return 0, "", err - } - defer folder.Close() - - stat, err := folder.Stat() - if err != nil { - return 0, "", err - } - - files, err := folder.Readdirnames(-1) - if err != nil { - return 0, "", err - } - - totalFiles := len(files) - i := 0 - filesProcessed := 0 - maxFiles := DiskUsageFilesAverage - if maxFiles <= 0 { - maxFiles = totalFiles - } - - // randomize file order - // https://stackoverflow.com/a/42776696 - for i := len(files) - 1; i > 0; i-- { - j := rand.Intn(i + 1) - files[i], files[j] = files[j], files[i] - } - - accuracy := exactA - for { - // Do not process any files after deadline is over - if time.Now().After(deadline) { - accuracy = timedoutA - break - } - - if i >= totalFiles || filesProcessed >= maxFiles { - if filesProcessed >= maxFiles { - accuracy = approxA - } - break - } - - // Stat the file - fname := files[i] - subpath := filepath.Join(path, fname) - st, err := os.Stat(subpath) - if err != nil { - return 0, "", err - } - - // Find folder size recursively - if st.IsDir() { - du2, acc, err := folderSize(filepath.Join(subpath), deadline) - if err != nil { - return 0, "", err - } - accuracy = combineAccuracy(acc, accuracy) - du += du2 - filesProcessed++ - } else { // in any other case, add the file size - du += st.Size() - filesProcessed++ - } - - i++ - } - - nonProcessed := totalFiles - filesProcessed - - // Avg is total size in this folder up to now / total files processed - // it includes folders ant not folders - avg := 0.0 - if filesProcessed > 0 { - avg = float64(du) / float64(filesProcessed) - } - duEstimation := int64(avg * float64(nonProcessed)) - du += duEstimation - du += stat.Size() - //fmt.Println(path, "total:", totalFiles, "totalStat:", i, "totalFile:", filesProcessed, "left:", nonProcessed, "avg:", int(avg), "est:", int(duEstimation), "du:", du) - return du, accuracy, nil -} - -// calculateDiskUsage tries to read the DiskUsageFile for a cached -// diskUsage value, otherwise walks the datastore files. -// it is only safe to call in Open() -func (fs *Datastore) calculateDiskUsage() error { - // Try to obtain a previously stored value from disk - if persDu := fs.readDiskUsageFile(); persDu > 0 { - fs.diskUsage = persDu - return nil - } - - msgDone := make(chan struct{}, 1) // prevent race condition - msgTimer := time.AfterFunc(diskUsageMessageTimeout, func() { - fmt.Printf("Calculating datastore size. This might take %s at most and will happen only once\n", - DiskUsageCalcTimeout.String()) - msgDone <- struct{}{} - }) - defer msgTimer.Stop() - deadline := time.Now().Add(DiskUsageCalcTimeout) - du, accuracy, err := folderSize(fs.path, deadline) - if err != nil { - return err - } - if !msgTimer.Stop() { - <-msgDone - } - if accuracy == timedoutA { - fmt.Println("WARN: It took to long to calculate the datastore size") - fmt.Printf("WARN: The total size (%d) is an estimation. You can fix errors by\n", du) - fmt.Printf("WARN: replacing the %s file with the right disk usage in bytes and\n", - filepath.Join(fs.path, DiskUsageFile)) - fmt.Println("WARN: re-opening the datastore") - } - - fs.storedValue.Accuracy = accuracy - fs.diskUsage = du - fs.writeDiskUsageFile(du, true) - - return nil -} - -func fileSize(path string) int64 { - fi, err := os.Stat(path) - if err != nil { - return 0 - } - return fi.Size() -} - -// updateDiskUsage reads the size of path and atomically -// increases or decreases the diskUsage variable. -// setting add to false will subtract from disk usage. -func (fs *Datastore) updateDiskUsage(path string, add bool) { - fsize := fileSize(path) - if !add { - fsize = -fsize - } - - if fsize != 0 { - atomic.AddInt64(&fs.diskUsage, fsize) - fs.checkpointDiskUsage() - } -} - -func (fs *Datastore) checkpointDiskUsage() { - select { - case fs.checkpointCh <- struct{}{}: - // msg sent - default: - // checkpoint request already pending - } -} - -func (fs *Datastore) checkpointLoop() { - defer close(fs.done) - - timerActive := true - timer := time.NewTimer(0) - defer timer.Stop() - for { - select { - case _, more := <-fs.checkpointCh: - du := atomic.LoadInt64(&fs.diskUsage) - fs.dirty = true - if !more { // shutting down - fs.writeDiskUsageFile(du, true) - if fs.dirty { - log.Errorf("could not store final value of disk usage to file, future estimates may be inaccurate") - } - return - } - // If the difference between the checkpointed disk usage and - // current one is larger than than `diskUsageCheckpointPercent` - // of the checkpointed: store it. - newDu := float64(du) - lastCheckpointDu := float64(fs.storedValue.DiskUsage) - diff := math.Abs(newDu - lastCheckpointDu) - if lastCheckpointDu*diskUsageCheckpointPercent < diff*100.0 { - fs.writeDiskUsageFile(du, false) - } - // Otherwise insure the value will be written to disk after - // `diskUsageCheckpointTimeout` - if fs.dirty && !timerActive { - timer.Reset(diskUsageCheckpointTimeout) - timerActive = true - } - case <-timer.C: - timerActive = false - if fs.dirty { - du := atomic.LoadInt64(&fs.diskUsage) - fs.writeDiskUsageFile(du, false) - } - } - } -} - -func (fs *Datastore) writeDiskUsageFile(du int64, doSync bool) { - tmp, err := ioutil.TempFile(fs.path, "du-") - if err != nil { - log.Warningf("cound not write disk usage: %v", err) - return - } - - removed := false - defer func() { - if !removed { - // silence errcheck - _ = os.Remove(tmp.Name()) - } - }() - - toWrite := fs.storedValue - toWrite.DiskUsage = du - encoder := json.NewEncoder(tmp) - if err := encoder.Encode(&toWrite); err != nil { - log.Warningf("cound not write disk usage: %v", err) - return - } - - if doSync { - if err := tmp.Sync(); err != nil { - log.Warningf("cound not sync %s: %v", DiskUsageFile, err) - return - } - } - - if err := tmp.Close(); err != nil { - log.Warningf("cound not write disk usage: %v", err) - return - } - - if err := os.Rename(tmp.Name(), filepath.Join(fs.path, DiskUsageFile)); err != nil { - log.Warningf("cound not write disk usage: %v", err) - return - } - removed = true - - fs.storedValue = toWrite - fs.dirty = false -} - -// readDiskUsageFile is only safe to call in Open() -func (fs *Datastore) readDiskUsageFile() int64 { - fpath := filepath.Join(fs.path, DiskUsageFile) - duB, err := ioutil.ReadFile(fpath) - if err != nil { - return 0 - } - err = json.Unmarshal(duB, &fs.storedValue) - if err != nil { - return 0 - } - return fs.storedValue.DiskUsage -} - -// DiskUsage implements the PersistentDatastore interface -// and returns the current disk usage in bytes used by -// this datastore. -// -// The size is approximative and may slightly differ from -// the real disk values. -func (fs *Datastore) DiskUsage() (uint64, error) { - // it may differ from real disk values if - // the filesystem has allocated for blocks - // for a directory because it has many files in it - // we don't account for "resized" directories. - // In a large datastore, the differences should be - // are negligible though. - - du := atomic.LoadInt64(&fs.diskUsage) - return uint64(du), nil -} - -// Accuracy returns a string representing the accuracy of the -// DiskUsage() result, the value returned is implementation defined -// and for informational purposes only -func (fs *Datastore) Accuracy() string { - return string(fs.storedValue.Accuracy) -} - -func (fs *Datastore) walk(path string, result *query.ResultBuilder) error { - dir, err := os.Open(path) - if err != nil { - if os.IsNotExist(err) { - // not an error if the file disappeared - return nil - } - return err - } - defer dir.Close() - - // ignore non-directories - fileInfo, err := dir.Stat() - if err != nil { - return err - } - if !fileInfo.IsDir() { - return nil - } - - names, err := dir.Readdirnames(-1) - if err != nil { - return err - } - for _, fn := range names { - - if len(fn) == 0 || fn[0] == '.' { - continue - } - - key, ok := fs.decode(fn) - if !ok { - log.Warningf("failed to decode flatfs entry: %s", fn) - continue - } - - select { - case result.Output <- query.Result{ - Entry: query.Entry{ - Key: key.String(), - }, - }: - case <-result.Process.Closing(): - return nil - } - } - return nil -} - -// Deactivate closes background maintenance threads, most write -// operations will fail but readonly operations will continue to -// function -func (fs *Datastore) deactivate() error { - fs.shutdownLock.Lock() - defer fs.shutdownLock.Unlock() - if fs.shutdown { - return nil - } - fs.shutdown = true - close(fs.checkpointCh) - <-fs.done - return nil -} - -func (fs *Datastore) Close() error { - return fs.deactivate() -} - -type flatfsBatch struct { - puts map[datastore.Key][]byte - deletes map[datastore.Key]struct{} - - ds *Datastore -} - -func (fs *Datastore) Batch() (datastore.Batch, error) { - return &flatfsBatch{ - puts: make(map[datastore.Key][]byte), - deletes: make(map[datastore.Key]struct{}), - ds: fs, - }, nil -} - -func (bt *flatfsBatch) Put(key datastore.Key, val []byte) error { - bt.puts[key] = val - return nil -} - -func (bt *flatfsBatch) Delete(key datastore.Key) error { - bt.deletes[key] = struct{}{} - return nil -} - -func (bt *flatfsBatch) Commit() error { - if err := bt.ds.putMany(bt.puts); err != nil { - return err - } - - for k, _ := range bt.deletes { - if err := bt.ds.Delete(k); err != nil { - return err - } - } - - return nil -} diff --git a/vendor/github.com/ipfs/go-ds-flatfs/go.mod b/vendor/github.com/ipfs/go-ds-flatfs/go.mod deleted file mode 100644 index f2a9e266..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-ds-flatfs - -require ( - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 -) diff --git a/vendor/github.com/ipfs/go-ds-flatfs/go.sum b/vendor/github.com/ipfs/go-ds-flatfs/go.sum deleted file mode 100644 index c5e35f8a..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/go.sum +++ /dev/null @@ -1,42 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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= diff --git a/vendor/github.com/ipfs/go-ds-flatfs/package.json b/vendor/github.com/ipfs/go-ds-flatfs/package.json deleted file mode 100644 index e8bd0dbd..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/ipfs/go-ds-flatfs" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ds-flatfs" - }, - "gxDependencies": [ - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "jbenet", - "hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9", - "name": "go-datastore", - "version": "3.6.1" - }, - { - "author": "whyrusleeping", - "hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP", - "name": "goprocess", - "version": "1.0.0" - } - ], - "gxVersion": "0.8.0", - "language": "go", - "license": "", - "name": "go-ds-flatfs", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.3.7" -} - diff --git a/vendor/github.com/ipfs/go-ds-flatfs/readme.go b/vendor/github.com/ipfs/go-ds-flatfs/readme.go deleted file mode 100644 index 9c1065bd..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/readme.go +++ /dev/null @@ -1,33 +0,0 @@ -package flatfs - -var README_IPFS_DEF_SHARD = `This is a repository of IPLD objects. Each IPLD object is in a single file, -named .data. Where is the -"base32" encoding of the CID (as specified in -https://github.com/multiformats/multibase) without the 'B' prefix. -All the object files are placed in a tree of directories, based on a -function of the CID. This is a form of sharding similar to -the objects directory in git repositories. Previously, we used -prefixes, we now use the next-to-last two charters. - - func NextToLast(base32cid string) { - nextToLastLen := 2 - offset := len(base32cid) - nextToLastLen - 1 - return str[offset : offset+nextToLastLen] - } - -For example, an object with a base58 CIDv1 of - - zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f - -has a base32 CIDv1 of - - BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA - -and will be placed at - - SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data - -with 'SC' being the last-to-next two characters and the 'B' at the -beginning of the CIDv1 string is the multibase prefix that is not -stored in the filename. -` diff --git a/vendor/github.com/ipfs/go-ds-flatfs/shard.go b/vendor/github.com/ipfs/go-ds-flatfs/shard.go deleted file mode 100644 index acfa4505..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/shard.go +++ /dev/null @@ -1,145 +0,0 @@ -package flatfs - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" -) - -var IPFS_DEF_SHARD = NextToLast(2) -var IPFS_DEF_SHARD_STR = IPFS_DEF_SHARD.String() - -const PREFIX = "/repo/flatfs/shard/" - -const SHARDING_FN = "SHARDING" -const README_FN = "_README" - -type ShardIdV1 struct { - funName string - param int - fun ShardFunc -} - -func (f *ShardIdV1) String() string { - return fmt.Sprintf("%sv1/%s/%d", PREFIX, f.funName, f.param) -} - -func (f *ShardIdV1) Func() ShardFunc { - return f.fun -} - -func Prefix(prefixLen int) *ShardIdV1 { - padding := strings.Repeat("_", prefixLen) - return &ShardIdV1{ - funName: "prefix", - param: prefixLen, - fun: func(noslash string) string { - return (noslash + padding)[:prefixLen] - }, - } -} - -func Suffix(suffixLen int) *ShardIdV1 { - padding := strings.Repeat("_", suffixLen) - return &ShardIdV1{ - funName: "suffix", - param: suffixLen, - fun: func(noslash string) string { - str := padding + noslash - return str[len(str)-suffixLen:] - }, - } -} - -func NextToLast(suffixLen int) *ShardIdV1 { - padding := strings.Repeat("_", suffixLen+1) - return &ShardIdV1{ - funName: "next-to-last", - param: suffixLen, - fun: func(noslash string) string { - str := padding + noslash - offset := len(str) - suffixLen - 1 - return str[offset : offset+suffixLen] - }, - } -} - -func ParseShardFunc(str string) (*ShardIdV1, error) { - str = strings.TrimSpace(str) - - if len(str) == 0 { - return nil, fmt.Errorf("empty shard identifier") - } - - trimmed := strings.TrimPrefix(str, PREFIX) - if str == trimmed { // nothing trimmed - return nil, fmt.Errorf("invalid or no prefix in shard identifier: %s", str) - } - str = trimmed - - parts := strings.Split(str, "/") - if len(parts) != 3 { - return nil, fmt.Errorf("invalid shard identifier: %s", str) - } - - version := parts[0] - if version != "v1" { - return nil, fmt.Errorf("expected 'v1' for version string got: %s\n", version) - } - - funName := parts[1] - - param, err := strconv.Atoi(parts[2]) - if err != nil { - return nil, fmt.Errorf("invalid parameter: %v", err) - } - - switch funName { - case "prefix": - return Prefix(param), nil - case "suffix": - return Suffix(param), nil - case "next-to-last": - return NextToLast(param), nil - default: - return nil, fmt.Errorf("expected 'prefix', 'suffix' or 'next-to-last' got: %s", funName) - } - -} - -func ReadShardFunc(dir string) (*ShardIdV1, error) { - buf, err := ioutil.ReadFile(filepath.Join(dir, SHARDING_FN)) - if os.IsNotExist(err) { - return nil, ErrShardingFileMissing - } else if err != nil { - return nil, err - } - return ParseShardFunc(string(buf)) -} - -func WriteShardFunc(dir string, id *ShardIdV1) error { - file, err := os.OpenFile(filepath.Join(dir, SHARDING_FN), os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0666) - if err != nil { - return err - } - defer file.Close() - _, err = file.WriteString(id.String()) - if err != nil { - return err - } - _, err = file.WriteString("\n") - return err -} - -func WriteReadme(dir string, id *ShardIdV1) error { - if id.String() == IPFS_DEF_SHARD.String() { - err := ioutil.WriteFile(filepath.Join(dir, README_FN), []byte(README_IPFS_DEF_SHARD), 0444) - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ds-flatfs/sync.go b/vendor/github.com/ipfs/go-ds-flatfs/sync.go deleted file mode 100644 index bf38c16f..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/sync.go +++ /dev/null @@ -1,42 +0,0 @@ -package flatfs - -import ( - "os" - "runtime" -) - -// don't block more than 16 threads on sync opearation -// 16 should be able to sataurate most RAIDs -// in case of two used disks per write (RAID 1, 5) and queue depth of 2, -// 16 concurrent Sync calls should be able to saturate 16 HDDs RAID -//TODO: benchmark it out, maybe provide tweak parmeter -const SyncThreadsMax = 16 - -var syncSemaphore chan struct{} = make(chan struct{}, SyncThreadsMax) - -func syncDir(dir string) error { - if runtime.GOOS == "windows" { - // dir sync on windows doesn't work: https://git.io/vPnCI - return nil - } - - dirF, err := os.Open(dir) - if err != nil { - return err - } - defer dirF.Close() - - syncSemaphore <- struct{}{} - defer func() { <-syncSemaphore }() - - if err := dirF.Sync(); err != nil { - return err - } - return nil -} - -func syncFile(file *os.File) error { - syncSemaphore <- struct{}{} - defer func() { <-syncSemaphore }() - return file.Sync() -} diff --git a/vendor/github.com/ipfs/go-ds-flatfs/util.go b/vendor/github.com/ipfs/go-ds-flatfs/util.go deleted file mode 100644 index 31ebde05..00000000 --- a/vendor/github.com/ipfs/go-ds-flatfs/util.go +++ /dev/null @@ -1,21 +0,0 @@ -package flatfs - -import ( - "io" - "os" -) - -// From: http://stackoverflow.com/questions/30697324/how-to-check-if-directory-on-path-is-empty -func DirIsEmpty(name string) (bool, error) { - f, err := os.Open(name) - if err != nil { - return false, err - } - defer f.Close() - - _, err = f.Readdirnames(1) // Or f.Readdir(1) - if err == io.EOF { - return true, nil - } - return false, err // Either not empty or error, suits both cases -} diff --git a/vendor/github.com/ipfs/go-ds-leveldb/.gitignore b/vendor/github.com/ipfs/go-ds-leveldb/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/ipfs/go-ds-leveldb/.travis.yml b/vendor/github.com/ipfs/go-ds-leveldb/.travis.yml deleted file mode 100644 index b86c124d..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race -cpu=5" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ds-leveldb/LICENSE b/vendor/github.com/ipfs/go-ds-leveldb/LICENSE deleted file mode 100644 index 6152c321..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ds-leveldb/Makefile b/vendor/github.com/ipfs/go-ds-leveldb/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/ipfs/go-ds-leveldb/README.md b/vendor/github.com/ipfs/go-ds-leveldb/README.md deleted file mode 100644 index 53515c2f..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# go-ds-leveldb - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ds-leveldb?status.svg)](https://godoc.org/github.com/ipfs/go-ds-leveldb) -[![Build Status](https://travis-ci.org/ipfs/go-ds-leveldb.svg?branch=master)](https://travis-ci.org/ipfs/go-ds-leveldb) - -> A go-datastore implementation using LevelDB - -`go-ds-leveldb` implements the [go-datastore](https://github.com/ipfs/go-datastore) interface using a LevelDB backend. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -This module can be installed like a regular go module: - -``` -go get github.com/ipfs/go-ds-leveldb -``` - -It uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make deps` to rewrite imports to the gx-specified versions. - -## Usage - -``` -import "github.com/ipfs/go-ds-leveldb" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ds-leveldb) - - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ds-leveldb/datastore.go b/vendor/github.com/ipfs/go-ds-leveldb/datastore.go deleted file mode 100644 index 1b2df122..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/datastore.go +++ /dev/null @@ -1,239 +0,0 @@ -package leveldb - -import ( - "os" - "path/filepath" - - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" - "github.com/syndtr/goleveldb/leveldb" - "github.com/syndtr/goleveldb/leveldb/errors" - "github.com/syndtr/goleveldb/leveldb/iterator" - "github.com/syndtr/goleveldb/leveldb/opt" - "github.com/syndtr/goleveldb/leveldb/storage" - "github.com/syndtr/goleveldb/leveldb/util" -) - -type Datastore struct { - *accessor - DB *leveldb.DB - path string -} - -var _ ds.Datastore = (*Datastore)(nil) -var _ ds.TxnDatastore = (*Datastore)(nil) - -// Options is an alias of syndtr/goleveldb/opt.Options which might be extended -// in the future. -type Options opt.Options - -// NewDatastore returns a new datastore backed by leveldb -// -// for path == "", an in memory bachend will be chosen -func NewDatastore(path string, opts *Options) (*Datastore, error) { - var nopts opt.Options - if opts != nil { - nopts = opt.Options(*opts) - } - - var err error - var db *leveldb.DB - - if path == "" { - db, err = leveldb.Open(storage.NewMemStorage(), &nopts) - } else { - db, err = leveldb.OpenFile(path, &nopts) - if errors.IsCorrupted(err) && !nopts.GetReadOnly() { - db, err = leveldb.RecoverFile(path, &nopts) - } - } - - if err != nil { - return nil, err - } - - return &Datastore{ - accessor: &accessor{ldb: db}, - DB: db, - path: path, - }, nil -} - -// An extraction of the common interface between LevelDB Transactions and the DB itself. -// -// It allows to plug in either inside the `accessor`. -type levelDbOps interface { - Put(key, value []byte, wo *opt.WriteOptions) error - Get(key []byte, ro *opt.ReadOptions) (value []byte, err error) - Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) - Delete(key []byte, wo *opt.WriteOptions) error - NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator -} - -// Datastore operations using either the DB or a transaction as the backend. -type accessor struct { - ldb levelDbOps -} - -func (a *accessor) Put(key ds.Key, value []byte) (err error) { - return a.ldb.Put(key.Bytes(), value, nil) -} - -func (a *accessor) Get(key ds.Key) (value []byte, err error) { - val, err := a.ldb.Get(key.Bytes(), nil) - if err != nil { - if err == leveldb.ErrNotFound { - return nil, ds.ErrNotFound - } - return nil, err - } - return val, nil -} - -func (a *accessor) Has(key ds.Key) (exists bool, err error) { - return a.ldb.Has(key.Bytes(), nil) -} - -func (d *accessor) GetSize(key ds.Key) (size int, err error) { - return ds.GetBackedSize(d, key) -} - -func (a *accessor) Delete(key ds.Key) (err error) { - // leveldb Delete will not return an error if the key doesn't - // exist (see https://github.com/syndtr/goleveldb/issues/109), - // so check that the key exists first and if not return an - // error - exists, err := a.ldb.Has(key.Bytes(), nil) - if !exists { - return ds.ErrNotFound - } else if err != nil { - return err - } - return a.ldb.Delete(key.Bytes(), nil) -} - -func (a *accessor) Query(q dsq.Query) (dsq.Results, error) { - var rnge *util.Range - - // make a copy of the query for the fallback naive query implementation. - // don't modify the original so res.Query() returns the correct results. - qNaive := q - if q.Prefix != "" { - rnge = util.BytesPrefix([]byte(q.Prefix)) - qNaive.Prefix = "" - } - i := a.ldb.NewIterator(rnge, nil) - next := i.Next - if len(q.Orders) > 0 { - switch q.Orders[0].(type) { - case dsq.OrderByKey, *dsq.OrderByKey: - qNaive.Orders = nil - case dsq.OrderByKeyDescending, *dsq.OrderByKeyDescending: - next = func() bool { - next = i.Prev - return i.Last() - } - qNaive.Orders = nil - default: - } - } - r := dsq.ResultsFromIterator(q, dsq.Iterator{ - Next: func() (dsq.Result, bool) { - if !next() { - return dsq.Result{}, false - } - k := string(i.Key()) - e := dsq.Entry{Key: k} - - if !q.KeysOnly { - buf := make([]byte, len(i.Value())) - copy(buf, i.Value()) - e.Value = buf - } - return dsq.Result{Entry: e}, true - }, - Close: func() error { - i.Release() - return nil - }, - }) - return dsq.NaiveQueryApply(qNaive, r), nil -} - -// DiskUsage returns the current disk size used by this levelDB. -// For in-mem datastores, it will return 0. -func (d *Datastore) DiskUsage() (uint64, error) { - if d.path == "" { // in-mem - return 0, nil - } - - var du uint64 - - err := filepath.Walk(d.path, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - du += uint64(info.Size()) - return nil - }) - - if err != nil { - return 0, err - } - - return du, nil -} - -// LevelDB needs to be closed. -func (d *Datastore) Close() (err error) { - return d.DB.Close() -} - -type leveldbBatch struct { - b *leveldb.Batch - db *leveldb.DB -} - -func (d *Datastore) Batch() (ds.Batch, error) { - return &leveldbBatch{ - b: new(leveldb.Batch), - db: d.DB, - }, nil -} - -func (b *leveldbBatch) Put(key ds.Key, value []byte) error { - b.b.Put(key.Bytes(), value) - return nil -} - -func (b *leveldbBatch) Commit() error { - return b.db.Write(b.b, nil) -} - -func (b *leveldbBatch) Delete(key ds.Key) error { - b.b.Delete(key.Bytes()) - return nil -} - -// A leveldb transaction embedding the accessor backed by the transaction. -type transaction struct { - *accessor - tx *leveldb.Transaction -} - -func (t *transaction) Commit() error { - return t.tx.Commit() -} - -func (t *transaction) Discard() { - t.tx.Discard() -} - -func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error) { - tx, err := d.DB.OpenTransaction() - if err != nil { - return nil, err - } - accessor := &accessor{tx} - return &transaction{accessor, tx}, nil -} diff --git a/vendor/github.com/ipfs/go-ds-leveldb/go.mod b/vendor/github.com/ipfs/go-ds-leveldb/go.mod deleted file mode 100644 index d26e1c18..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-ds-leveldb - -require ( - github.com/ipfs/go-datastore v0.0.3 - github.com/syndtr/goleveldb v1.0.0 -) diff --git a/vendor/github.com/ipfs/go-ds-leveldb/go.sum b/vendor/github.com/ipfs/go-ds-leveldb/go.sum deleted file mode 100644 index d6ecf9b4..00000000 --- a/vendor/github.com/ipfs/go-ds-leveldb/go.sum +++ /dev/null @@ -1,46 +0,0 @@ -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -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/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/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-datastore v0.0.3 h1:/eP3nMDmLzMJNoWSSYvEkmMTTrm9FFCN+JraP9NdlwU= -github.com/ipfs/go-datastore v0.0.3/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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/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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-ds-measure/.gitignore b/vendor/github.com/ipfs/go-ds-measure/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/ipfs/go-ds-measure/.travis.yml b/vendor/github.com/ipfs/go-ds-measure/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ds-measure/LICENSE b/vendor/github.com/ipfs/go-ds-measure/LICENSE deleted file mode 100644 index f2049023..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2016 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ds-measure/Makefile b/vendor/github.com/ipfs/go-ds-measure/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/ipfs/go-ds-measure/go.mod b/vendor/github.com/ipfs/go-ds-measure/go.mod deleted file mode 100644 index 701ed5c2..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-ds-measure - -require ( - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-metrics-interface v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ds-measure/go.sum b/vendor/github.com/ipfs/go-ds-measure/go.sum deleted file mode 100644 index fb24202d..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -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= diff --git a/vendor/github.com/ipfs/go-ds-measure/measure.go b/vendor/github.com/ipfs/go-ds-measure/measure.go deleted file mode 100644 index c8e83f38..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/measure.go +++ /dev/null @@ -1,332 +0,0 @@ -// Package measure provides a Datastore wrapper that records metrics -// using github.com/ipfs/go-metrics-interface -package measure - -import ( - "io" - "time" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" - "github.com/ipfs/go-metrics-interface" -) - -var ( - // sort latencies in buckets with following upper bounds in seconds - datastoreLatencyBuckets = []float64{1e-4, 1e-3, 1e-2, 1e-1, 1} - - // sort sizes in buckets with following upper bounds in bytes - datastoreSizeBuckets = []float64{1 << 6, 1 << 12, 1 << 18, 1 << 24} -) - -// New wraps the datastore, providing metrics on the operations. The -// metrics are registered with names starting with prefix and a dot. -func New(prefix string, ds datastore.Datastore) *measure { - m := &measure{ - backend: ds, - - putNum: metrics.New(prefix+".put_total", "Total number of Datastore.Put calls").Counter(), - putErr: metrics.New(prefix+".put.errors_total", "Number of errored Datastore.Put calls").Counter(), - putLatency: metrics.New(prefix+".put.latency_seconds", - "Latency distribution of Datastore.Put calls").Histogram(datastoreLatencyBuckets), - putSize: metrics.New(prefix+".put.size_bytes", - "Size distribution of stored byte slices").Histogram(datastoreSizeBuckets), - - getNum: metrics.New(prefix+".get_total", "Total number of Datastore.Get calls").Counter(), - getErr: metrics.New(prefix+".get.errors_total", "Number of errored Datastore.Get calls").Counter(), - getLatency: metrics.New(prefix+".get.latency_seconds", - "Latency distribution of Datastore.Get calls").Histogram(datastoreLatencyBuckets), - getSize: metrics.New(prefix+".get.size_bytes", - "Size distribution of retrieved byte slices").Histogram(datastoreSizeBuckets), - - hasNum: metrics.New(prefix+".has_total", "Total number of Datastore.Has calls").Counter(), - hasErr: metrics.New(prefix+".has.errors_total", "Number of errored Datastore.Has calls").Counter(), - hasLatency: metrics.New(prefix+".has.latency_seconds", - "Latency distribution of Datastore.Has calls").Histogram(datastoreLatencyBuckets), - getsizeNum: metrics.New(prefix+".getsize_total", "Total number of Datastore.GetSize calls").Counter(), - getsizeErr: metrics.New(prefix+".getsize.errors_total", "Number of errored Datastore.GetSize calls").Counter(), - getsizeLatency: metrics.New(prefix+".getsize.latency_seconds", - "Latency distribution of Datastore.GetSize calls").Histogram(datastoreLatencyBuckets), - - deleteNum: metrics.New(prefix+".delete_total", "Total number of Datastore.Delete calls").Counter(), - deleteErr: metrics.New(prefix+".delete.errors_total", "Number of errored Datastore.Delete calls").Counter(), - deleteLatency: metrics.New(prefix+".delete.latency_seconds", - "Latency distribution of Datastore.Delete calls").Histogram(datastoreLatencyBuckets), - - queryNum: metrics.New(prefix+".query_total", "Total number of Datastore.Query calls").Counter(), - queryErr: metrics.New(prefix+".query.errors_total", "Number of errored Datastore.Query calls").Counter(), - queryLatency: metrics.New(prefix+".query.latency_seconds", - "Latency distribution of Datastore.Query calls").Histogram(datastoreLatencyBuckets), - - checkNum: metrics.New(prefix+".check_total", "Total number of Datastore.Check calls").Counter(), - checkErr: metrics.New(prefix+".check.errors_total", "Number of errored Datastore.Check calls").Counter(), - checkLatency: metrics.New(prefix+".check.latency_seconds", - "Latency distribution of Datastore.Check calls").Histogram(datastoreLatencyBuckets), - - scrubNum: metrics.New(prefix+".scrub_total", "Total number of Datastore.Scrub calls").Counter(), - scrubErr: metrics.New(prefix+".scrub.errors_total", "Number of errored Datastore.Scrub calls").Counter(), - scrubLatency: metrics.New(prefix+".scrub.latency_seconds", - "Latency distribution of Datastore.Scrub calls").Histogram(datastoreLatencyBuckets), - - gcNum: metrics.New(prefix+".gc_total", "Total number of Datastore.CollectGarbage calls").Counter(), - gcErr: metrics.New(prefix+".gc.errors_total", "Number of errored Datastore.CollectGarbage calls").Counter(), - gcLatency: metrics.New(prefix+".gc.latency_seconds", - "Latency distribution of Datastore.CollectGarbage calls").Histogram(datastoreLatencyBuckets), - - duNum: metrics.New(prefix+".du_total", "Total number of Datastore.DiskUsage calls").Counter(), - duErr: metrics.New(prefix+".du.errors_total", "Number of errored Datastore.DiskUsage calls").Counter(), - duLatency: metrics.New(prefix+".du.latency_seconds", - "Latency distribution of Datastore.DiskUsage calls").Histogram(datastoreLatencyBuckets), - } - return m -} - -type measure struct { - backend datastore.Datastore - - putNum metrics.Counter - putErr metrics.Counter - putLatency metrics.Histogram - putSize metrics.Histogram - - getNum metrics.Counter - getErr metrics.Counter - getLatency metrics.Histogram - getSize metrics.Histogram - - hasNum metrics.Counter - hasErr metrics.Counter - hasLatency metrics.Histogram - - getsizeNum metrics.Counter - getsizeErr metrics.Counter - getsizeLatency metrics.Histogram - - deleteNum metrics.Counter - deleteErr metrics.Counter - deleteLatency metrics.Histogram - - queryNum metrics.Counter - queryErr metrics.Counter - queryLatency metrics.Histogram - - checkNum metrics.Counter - checkErr metrics.Counter - checkLatency metrics.Histogram - - scrubNum metrics.Counter - scrubErr metrics.Counter - scrubLatency metrics.Histogram - - gcNum metrics.Counter - gcErr metrics.Counter - gcLatency metrics.Histogram - - duNum metrics.Counter - duErr metrics.Counter - duLatency metrics.Histogram -} - -func recordLatency(h metrics.Histogram, start time.Time) { - elapsed := time.Since(start) - h.Observe(elapsed.Seconds()) -} - -func (m *measure) Put(key datastore.Key, value []byte) error { - defer recordLatency(m.putLatency, time.Now()) - m.putNum.Inc() - m.putSize.Observe(float64(len(value))) - err := m.backend.Put(key, value) - if err != nil { - m.putErr.Inc() - } - return err -} - -func (m *measure) Get(key datastore.Key) (value []byte, err error) { - defer recordLatency(m.getLatency, time.Now()) - m.getNum.Inc() - value, err = m.backend.Get(key) - switch err { - case nil: - m.getSize.Observe(float64(len(value))) - case datastore.ErrNotFound: - // Not really an error. - default: - m.getErr.Inc() - } - return value, err -} - -func (m *measure) Has(key datastore.Key) (exists bool, err error) { - defer recordLatency(m.hasLatency, time.Now()) - m.hasNum.Inc() - exists, err = m.backend.Has(key) - if err != nil { - m.hasErr.Inc() - } - return exists, err -} - -func (m *measure) GetSize(key datastore.Key) (size int, err error) { - defer recordLatency(m.getsizeLatency, time.Now()) - m.hasNum.Inc() - size, err = m.backend.GetSize(key) - switch err { - case nil, datastore.ErrNotFound: - default: - m.getsizeErr.Inc() - } - return size, err -} - -func (m *measure) Delete(key datastore.Key) error { - defer recordLatency(m.deleteLatency, time.Now()) - m.deleteNum.Inc() - err := m.backend.Delete(key) - if err != nil { - m.deleteErr.Inc() - } - return err -} - -func (m *measure) Query(q query.Query) (query.Results, error) { - defer recordLatency(m.queryLatency, time.Now()) - m.queryNum.Inc() - res, err := m.backend.Query(q) - if err != nil { - m.queryErr.Inc() - } - return res, err -} - -func (m *measure) Check() error { - defer recordLatency(m.checkLatency, time.Now()) - m.checkNum.Inc() - if c, ok := m.backend.(datastore.CheckedDatastore); ok { - err := c.Check() - if err != nil { - m.checkErr.Inc() - } - return err - } - return nil -} - -func (m *measure) Scrub() error { - defer recordLatency(m.scrubLatency, time.Now()) - m.scrubNum.Inc() - if c, ok := m.backend.(datastore.ScrubbedDatastore); ok { - err := c.Scrub() - if err != nil { - m.scrubErr.Inc() - } - return err - } - return nil -} - -func (m *measure) CollectGarbage() error { - defer recordLatency(m.gcLatency, time.Now()) - m.gcNum.Inc() - if c, ok := m.backend.(datastore.GCDatastore); ok { - err := c.CollectGarbage() - if err != nil { - m.gcErr.Inc() - } - return err - } - return nil -} - -func (m *measure) DiskUsage() (uint64, error) { - defer recordLatency(m.duLatency, time.Now()) - m.duNum.Inc() - size, err := datastore.DiskUsage(m.backend) - if err != nil { - m.duErr.Inc() - } - return size, err -} - -type measuredBatch struct { - puts int - deletes int - - putts datastore.Batch - delts datastore.Batch - - m *measure -} - -func (m *measure) Batch() (datastore.Batch, error) { - bds, ok := m.backend.(datastore.Batching) - if !ok { - return nil, datastore.ErrBatchUnsupported - } - pb, err := bds.Batch() - if err != nil { - return nil, err - } - - db, err := bds.Batch() - if err != nil { - return nil, err - } - - return &measuredBatch{ - putts: pb, - delts: db, - - m: m, - }, nil -} - -func (mt *measuredBatch) Put(key datastore.Key, val []byte) error { - mt.puts++ - mt.m.putSize.Observe(float64(len(val))) - return mt.putts.Put(key, val) -} - -func (mt *measuredBatch) Delete(key datastore.Key) error { - mt.deletes++ - return mt.delts.Delete(key) -} - -func (mt *measuredBatch) Commit() error { - err := logBatchCommit(mt.delts, mt.deletes, mt.m.deleteNum, mt.m.deleteErr, mt.m.deleteLatency) - if err != nil { - return err - } - - err = logBatchCommit(mt.putts, mt.puts, mt.m.putNum, mt.m.putErr, mt.m.putLatency) - if err != nil { - return err - } - - return nil -} - -func logBatchCommit(b datastore.Batch, n int, num, errs metrics.Counter, lat metrics.Histogram) error { - if n > 0 { - before := time.Now() - err := b.Commit() - took := time.Since(before) / time.Duration(n) - num.Add(float64(n)) - for i := 0; i < n; i++ { - lat.Observe(took.Seconds()) - } - if err != nil { - errs.Inc() - return err - } - } - return nil -} - -func (m *measure) Close() error { - if c, ok := m.backend.(io.Closer); ok { - return c.Close() - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ds-measure/package.json b/vendor/github.com/ipfs/go-ds-measure/package.json deleted file mode 100644 index 9d31f488..00000000 --- a/vendor/github.com/ipfs/go-ds-measure/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/ipfs/go-ds-measure" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ds-measure" - }, - "gxDependencies": [ - { - "author": "ipfs", - "hash": "QmekzFM3hPZjTjUFGTABdQkEnQ3PTiMstY198PwSFr5w1Q", - "name": "go-metrics-interface", - "version": "0.2.0" - }, - { - "author": "jbenet", - "hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9", - "name": "go-datastore", - "version": "3.6.1" - } - ], - "gxVersion": "0.8.0", - "language": "go", - "license": "", - "name": "go-ds-measure", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.4.5" -} - diff --git a/vendor/github.com/ipfs/go-fs-lock/.gitignore b/vendor/github.com/ipfs/go-fs-lock/.gitignore deleted file mode 100644 index fcd2aa0d..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.swp -*.out -*.coverprofile -*.test -*.orig -*~ diff --git a/vendor/github.com/ipfs/go-fs-lock/.travis.yml b/vendor/github.com/ipfs/go-fs-lock/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-fs-lock/LICENSE b/vendor/github.com/ipfs/go-fs-lock/LICENSE deleted file mode 100644 index 79bd9c59..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-fs-lock/README.md b/vendor/github.com/ipfs/go-fs-lock/README.md deleted file mode 100644 index adc6c63f..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# go-fs-lock - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-fs-lock?status.svg)](https://godoc.org/github.com/ipfs/go-fs-lock) -[![Coverage Status](https://coveralls.io/repos/github/ipfs/go-fs-lock/badge.svg?branch=master)](https://coveralls.io/github/ipfs/go-fs-lock?branch=master) -[![Travis CI](https://travis-ci.org/ipfs/go-fs-lock.svg?branch=master)](https://travis-ci.org/ipfs/go-fs-lock) - -> Filesystem based locking - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-fs-lock` is a standard Go module which can be installed with: - -```sh -go get github.com/ipfs/go-fs-lock -``` - -Note that `go-fs-lock` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section). - -## Usage - -### Using Gx and Gx-go - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project it is recommended that you: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/ipfs/go-fs-lock -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -### Running tests - -Before running tests, please run: - -```sh -make deps -``` - -This will make sure that dependencies are rewritten to known working versions. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-fs-lock/fslock.go b/vendor/github.com/ipfs/go-fs-lock/fslock.go deleted file mode 100644 index 4b33acb5..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/fslock.go +++ /dev/null @@ -1,76 +0,0 @@ -package fslock - -import ( - "fmt" - "io" - "os" - "path" - "strings" - "syscall" - - "github.com/ipfs/go-ipfs-util" - logging "github.com/ipfs/go-log" - lock "go4.org/lock" -) - -// log is the fsrepo logger -var log = logging.Logger("lock") - -func errPerm(path string) error { - return fmt.Errorf("failed to take lock at %s: permission denied", path) -} - -// Lock creates the lock. -func Lock(confdir, lockFile string) (io.Closer, error) { - return lock.Lock(path.Join(confdir, lockFile)) -} - -// Locked checks if there is a lock already set. -func Locked(confdir, lockFile string) (bool, error) { - log.Debugf("Checking lock") - if !util.FileExists(path.Join(confdir, lockFile)) { - log.Debugf("File doesn't exist: %s", path.Join(confdir, lockFile)) - return false, nil - } - - lk, err := Lock(confdir, lockFile) - if err != nil { - // EAGAIN == someone else has the lock - if err == syscall.EAGAIN { - log.Debugf("Someone else has the lock: %s", path.Join(confdir, lockFile)) - return true, nil - } - if strings.Contains(err.Error(), "resource temporarily unavailable") { - log.Debugf("Can't lock file: %s.\n reason: %s", path.Join(confdir, lockFile), err.Error()) - return true, nil - } - - // we hold the lock ourselves - if strings.Contains(err.Error(), "already locked") { - log.Debugf("Lock is already held by us: %s", path.Join(confdir, lockFile)) - return true, nil - } - - // lock fails on permissions error - if os.IsPermission(err) { - log.Debugf("Lock fails on permissions error") - return false, errPerm(confdir) - } - if isLockCreatePermFail(err) { - log.Debugf("Lock fails on permissions error") - return false, errPerm(confdir) - } - - // otherwise, we cant guarantee anything, error out - return false, err - } - - log.Debugf("No one has a lock") - lk.Close() - return false, nil -} - -func isLockCreatePermFail(err error) bool { - s := err.Error() - return strings.Contains(s, "Lock Create of") && strings.Contains(s, "permission denied") -} diff --git a/vendor/github.com/ipfs/go-fs-lock/go.mod b/vendor/github.com/ipfs/go-fs-lock/go.mod deleted file mode 100644 index 8b3764e9..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-fs-lock - -require ( - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - go4.org v0.0.0-20190218023631-ce4c26f7be8e -) diff --git a/vendor/github.com/ipfs/go-fs-lock/go.sum b/vendor/github.com/ipfs/go-fs-lock/go.sum deleted file mode 100644 index f08985a5..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/go.sum +++ /dev/null @@ -1,45 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -go4.org v0.0.0-20190218023631-ce4c26f7be8e h1:m9LfARr2VIOW0vsV19kEKp/sWQvZnGobA8JHui/XJoY= -go4.org v0.0.0-20190218023631-ce4c26f7be8e/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/ipfs/go-fs-lock/package.json b/vendor/github.com/ipfs/go-fs-lock/package.json deleted file mode 100644 index 9000978e..00000000 --- a/vendor/github.com/ipfs/go-fs-lock/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "author": "dignifiedquire", - "bugs": { - "url": "https://github.com/ipfs/go-fs-lock/issues" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-fs-lock" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "hsanjuan", - "hash": "QmYDxsntDcWC7CTisDmeorEvDVjkRAjjY9Vr9DJ6HSkXMS", - "name": "go4-lock", - "version": "0.0.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-fs-lock", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.11" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/.travis.yml b/vendor/github.com/ipfs/go-ipfs-blockstore/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/LICENSE b/vendor/github.com/ipfs/go-ipfs-blockstore/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/Makefile b/vendor/github.com/ipfs/go-ipfs-blockstore/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/README.md b/vendor/github.com/ipfs/go-ipfs-blockstore/README.md deleted file mode 100644 index 446a95e2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# go-ipfs-blockstore - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-blockstore?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-blockstore) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-blockstore.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-blockstore) - -> go-ipfs-blockstore implements a thin wrapper over a datastore, giving a clean interface for Getting and Putting block objects. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-blockstore` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-blockstore -``` - -## Usage - -``` -import "github.com/ipfs/go-ipfs-blockstore" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-blockstore) - -This module uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/arc_cache.go b/vendor/github.com/ipfs/go-ipfs-blockstore/arc_cache.go deleted file mode 100644 index 231fd855..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/arc_cache.go +++ /dev/null @@ -1,182 +0,0 @@ -package blockstore - -import ( - "context" - - lru "github.com/hashicorp/golang-lru" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - metrics "github.com/ipfs/go-metrics-interface" -) - -type cacheHave bool -type cacheSize int - -// arccache wraps a BlockStore with an Adaptive Replacement Cache (ARC) for -// block Cids. This provides block access-time improvements, allowing -// to short-cut many searches without query-ing the underlying datastore. -type arccache struct { - arc *lru.ARCCache - blockstore Blockstore - - hits metrics.Counter - total metrics.Counter -} - -func newARCCachedBS(ctx context.Context, bs Blockstore, lruSize int) (*arccache, error) { - arc, err := lru.NewARC(lruSize) - if err != nil { - return nil, err - } - c := &arccache{arc: arc, blockstore: bs} - c.hits = metrics.NewCtx(ctx, "arc.hits_total", "Number of ARC cache hits").Counter() - c.total = metrics.NewCtx(ctx, "arc_total", "Total number of ARC cache requests").Counter() - - return c, nil -} - -func (b *arccache) DeleteBlock(k cid.Cid) error { - if has, _, ok := b.hasCached(k); ok && !has { - return ErrNotFound - } - - b.arc.Remove(k) // Invalidate cache before deleting. - err := b.blockstore.DeleteBlock(k) - switch err { - case nil, ErrNotFound: - b.cacheHave(k, false) - return err - default: - return err - } -} - -// if ok == false has is inconclusive -// if ok == true then has respons to question: is it contained -func (b *arccache) hasCached(k cid.Cid) (has bool, size int, ok bool) { - b.total.Inc() - if !k.Defined() { - log.Error("undefined cid in arccache") - // Return cache invalid so the call to blockstore happens - // in case of invalid key and correct error is created. - return false, -1, false - } - - h, ok := b.arc.Get(k.KeyString()) - if ok { - b.hits.Inc() - switch h := h.(type) { - case cacheHave: - return bool(h), -1, true - case cacheSize: - return true, int(h), true - } - } - return false, -1, false -} - -func (b *arccache) Has(k cid.Cid) (bool, error) { - if has, _, ok := b.hasCached(k); ok { - return has, nil - } - has, err := b.blockstore.Has(k) - if err != nil { - return false, err - } - b.cacheHave(k, has) - return has, nil -} - -func (b *arccache) GetSize(k cid.Cid) (int, error) { - if has, blockSize, ok := b.hasCached(k); ok { - if has { - return blockSize, nil - } - return -1, ErrNotFound - } - blockSize, err := b.blockstore.GetSize(k) - if err == ErrNotFound { - b.cacheHave(k, false) - } else if err == nil { - b.cacheSize(k, blockSize) - } - return blockSize, err -} - -func (b *arccache) Get(k cid.Cid) (blocks.Block, error) { - if !k.Defined() { - log.Error("undefined cid in arc cache") - return nil, ErrNotFound - } - - if has, _, ok := b.hasCached(k); ok && !has { - return nil, ErrNotFound - } - - bl, err := b.blockstore.Get(k) - if bl == nil && err == ErrNotFound { - b.cacheHave(k, false) - } else if bl != nil { - b.cacheSize(k, len(bl.RawData())) - } - return bl, err -} - -func (b *arccache) Put(bl blocks.Block) error { - if has, _, ok := b.hasCached(bl.Cid()); ok && has { - return nil - } - - err := b.blockstore.Put(bl) - if err == nil { - b.cacheSize(bl.Cid(), len(bl.RawData())) - } - return err -} - -func (b *arccache) PutMany(bs []blocks.Block) error { - var good []blocks.Block - for _, block := range bs { - // call put on block if result is inconclusive or we are sure that - // the block isn't in storage - if has, _, ok := b.hasCached(block.Cid()); !ok || (ok && !has) { - good = append(good, block) - } - } - err := b.blockstore.PutMany(good) - if err != nil { - return err - } - for _, block := range good { - b.cacheSize(block.Cid(), len(block.RawData())) - } - return nil -} - -func (b *arccache) HashOnRead(enabled bool) { - b.blockstore.HashOnRead(enabled) -} - -func (b *arccache) cacheHave(c cid.Cid, have bool) { - b.arc.Add(c.KeyString(), cacheHave(have)) -} - -func (b *arccache) cacheSize(c cid.Cid, blockSize int) { - b.arc.Add(c.KeyString(), cacheSize(blockSize)) -} - -func (b *arccache) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - return b.blockstore.AllKeysChan(ctx) -} - -func (b *arccache) GCLock() Unlocker { - return b.blockstore.(GCBlockstore).GCLock() -} - -func (b *arccache) PinLock() Unlocker { - return b.blockstore.(GCBlockstore).PinLock() -} - -func (b *arccache) GCRequested() bool { - return b.blockstore.(GCBlockstore).GCRequested() -} diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/blockstore.go b/vendor/github.com/ipfs/go-ipfs-blockstore/blockstore.go deleted file mode 100644 index f57a90af..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/blockstore.go +++ /dev/null @@ -1,284 +0,0 @@ -// Package blockstore implements a thin wrapper over a datastore, giving a -// clean interface for Getting and Putting block objects. -package blockstore - -import ( - "context" - "errors" - "sync" - "sync/atomic" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - dsns "github.com/ipfs/go-datastore/namespace" - dsq "github.com/ipfs/go-datastore/query" - dshelp "github.com/ipfs/go-ipfs-ds-help" - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("blockstore") - -// BlockPrefix namespaces blockstore datastores -var BlockPrefix = ds.NewKey("blocks") - -// ErrHashMismatch is an error returned when the hash of a block -// is different than expected. -var ErrHashMismatch = errors.New("block in storage has different hash than requested") - -// ErrNotFound is an error returned when a block is not found. -var ErrNotFound = errors.New("blockstore: block not found") - -// Blockstore wraps a Datastore block-centered methods and provides a layer -// of abstraction which allows to add different caching strategies. -type Blockstore interface { - DeleteBlock(cid.Cid) error - Has(cid.Cid) (bool, error) - Get(cid.Cid) (blocks.Block, error) - - // GetSize returns the CIDs mapped BlockSize - GetSize(cid.Cid) (int, error) - - // Put puts a given block to the underlying datastore - Put(blocks.Block) error - - // PutMany puts a slice of blocks at the same time using batching - // capabilities of the underlying datastore whenever possible. - PutMany([]blocks.Block) error - - // AllKeysChan returns a channel from which - // the CIDs in the Blockstore can be read. It should respect - // the given context, closing the channel if it becomes Done. - AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) - - // HashOnRead specifies if every read block should be - // rehashed to make sure it matches its CID. - HashOnRead(enabled bool) -} - -// GCLocker abstract functionality to lock a blockstore when performing -// garbage-collection operations. -type GCLocker interface { - // GCLock locks the blockstore for garbage collection. No operations - // that expect to finish with a pin should ocurr simultaneously. - // Reading during GC is safe, and requires no lock. - GCLock() Unlocker - - // PinLock locks the blockstore for sequences of puts expected to finish - // with a pin (before GC). Multiple put->pin sequences can write through - // at the same time, but no GC should happen simulatenously. - // Reading during Pinning is safe, and requires no lock. - PinLock() Unlocker - - // GcRequested returns true if GCLock has been called and is waiting to - // take the lock - GCRequested() bool -} - -// GCBlockstore is a blockstore that can safely run garbage-collection -// operations. -type GCBlockstore interface { - Blockstore - GCLocker -} - -// NewGCBlockstore returns a default implementation of GCBlockstore -// using the given Blockstore and GCLocker. -func NewGCBlockstore(bs Blockstore, gcl GCLocker) GCBlockstore { - return gcBlockstore{bs, gcl} -} - -type gcBlockstore struct { - Blockstore - GCLocker -} - -// NewBlockstore returns a default Blockstore implementation -// using the provided datastore.Batching backend. -func NewBlockstore(d ds.Batching) Blockstore { - var dsb ds.Batching - dd := dsns.Wrap(d, BlockPrefix) - dsb = dd - return &blockstore{ - datastore: dsb, - } -} - -type blockstore struct { - datastore ds.Batching - - rehash bool -} - -func (bs *blockstore) HashOnRead(enabled bool) { - bs.rehash = enabled -} - -func (bs *blockstore) Get(k cid.Cid) (blocks.Block, error) { - if !k.Defined() { - log.Error("undefined cid in blockstore") - return nil, ErrNotFound - } - - bdata, err := bs.datastore.Get(dshelp.CidToDsKey(k)) - if err == ds.ErrNotFound { - return nil, ErrNotFound - } - if err != nil { - return nil, err - } - if bs.rehash { - rbcid, err := k.Prefix().Sum(bdata) - if err != nil { - return nil, err - } - - if !rbcid.Equals(k) { - return nil, ErrHashMismatch - } - - return blocks.NewBlockWithCid(bdata, rbcid) - } - return blocks.NewBlockWithCid(bdata, k) -} - -func (bs *blockstore) Put(block blocks.Block) error { - k := dshelp.CidToDsKey(block.Cid()) - - // Has is cheaper than Put, so see if we already have it - exists, err := bs.datastore.Has(k) - if err == nil && exists { - return nil // already stored. - } - return bs.datastore.Put(k, block.RawData()) -} - -func (bs *blockstore) PutMany(blocks []blocks.Block) error { - t, err := bs.datastore.Batch() - if err != nil { - return err - } - for _, b := range blocks { - k := dshelp.CidToDsKey(b.Cid()) - exists, err := bs.datastore.Has(k) - if err == nil && exists { - continue - } - - err = t.Put(k, b.RawData()) - if err != nil { - return err - } - } - return t.Commit() -} - -func (bs *blockstore) Has(k cid.Cid) (bool, error) { - return bs.datastore.Has(dshelp.CidToDsKey(k)) -} - -func (bs *blockstore) GetSize(k cid.Cid) (int, error) { - size, err := bs.datastore.GetSize(dshelp.CidToDsKey(k)) - if err == ds.ErrNotFound { - return -1, ErrNotFound - } - return size, err -} - -func (bs *blockstore) DeleteBlock(k cid.Cid) error { - err := bs.datastore.Delete(dshelp.CidToDsKey(k)) - if err == ds.ErrNotFound { - return ErrNotFound - } - return err -} - -// AllKeysChan runs a query for keys from the blockstore. -// this is very simplistic, in the future, take dsq.Query as a param? -// -// AllKeysChan respects context. -func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - - // KeysOnly, because that would be _a lot_ of data. - q := dsq.Query{KeysOnly: true} - res, err := bs.datastore.Query(q) - if err != nil { - return nil, err - } - - output := make(chan cid.Cid, dsq.KeysOnlyBufSize) - go func() { - defer func() { - res.Close() // ensure exit (signals early exit, too) - close(output) - }() - - for { - e, ok := res.NextSync() - if !ok { - return - } - if e.Error != nil { - log.Errorf("blockstore.AllKeysChan got err: %s", e.Error) - return - } - - // need to convert to key.Key using key.KeyFromDsKey. - k, err := dshelp.DsKeyToCid(ds.RawKey(e.Key)) - if err != nil { - log.Warningf("error parsing key from DsKey: %s", err) - continue - } - - select { - case <-ctx.Done(): - return - case output <- k: - } - } - }() - - return output, nil -} - -// NewGCLocker returns a default implementation of -// GCLocker using standard [RW] mutexes. -func NewGCLocker() GCLocker { - return &gclocker{} -} - -type gclocker struct { - lk sync.RWMutex - gcreq int32 -} - -// Unlocker represents an object which can Unlock -// something. -type Unlocker interface { - Unlock() -} - -type unlocker struct { - unlock func() -} - -func (u *unlocker) Unlock() { - u.unlock() - u.unlock = nil // ensure its not called twice -} - -func (bs *gclocker) GCLock() Unlocker { - atomic.AddInt32(&bs.gcreq, 1) - bs.lk.Lock() - atomic.AddInt32(&bs.gcreq, -1) - return &unlocker{bs.lk.Unlock} -} - -func (bs *gclocker) PinLock() Unlocker { - bs.lk.RLock() - return &unlocker{bs.lk.RUnlock} -} - -func (bs *gclocker) GCRequested() bool { - return atomic.LoadInt32(&bs.gcreq) > 0 -} diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/bloom_cache.go b/vendor/github.com/ipfs/go-ipfs-blockstore/bloom_cache.go deleted file mode 100644 index 3720d20d..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/bloom_cache.go +++ /dev/null @@ -1,204 +0,0 @@ -package blockstore - -import ( - "context" - "fmt" - "sync/atomic" - "time" - - bloom "github.com/ipfs/bbloom" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - metrics "github.com/ipfs/go-metrics-interface" -) - -// bloomCached returns a Blockstore that caches Has requests using a Bloom -// filter. bloomSize is size of bloom filter in bytes. hashCount specifies the -// number of hashing functions in the bloom filter (usually known as k). -func bloomCached(ctx context.Context, bs Blockstore, bloomSize, hashCount int) (*bloomcache, error) { - bl, err := bloom.New(float64(bloomSize), float64(hashCount)) - if err != nil { - return nil, err - } - bc := &bloomcache{ - blockstore: bs, - bloom: bl, - hits: metrics.NewCtx(ctx, "bloom.hits_total", - "Number of cache hits in bloom cache").Counter(), - total: metrics.NewCtx(ctx, "bloom_total", - "Total number of requests to bloom cache").Counter(), - buildChan: make(chan struct{}), - } - go func() { - err := bc.build(ctx) - if err != nil { - select { - case <-ctx.Done(): - log.Warning("Cache rebuild closed by context finishing: ", err) - default: - log.Error(err) - } - return - } - if metrics.Active() { - fill := metrics.NewCtx(ctx, "bloom_fill_ratio", - "Ratio of bloom filter fullnes, (updated once a minute)").Gauge() - - t := time.NewTicker(1 * time.Minute) - defer t.Stop() - for { - select { - case <-ctx.Done(): - return - case <-t.C: - fill.Set(bc.bloom.FillRatio()) - } - } - } - }() - return bc, nil -} - -type bloomcache struct { - active int32 - - bloom *bloom.Bloom - buildErr error - - buildChan chan struct{} - blockstore Blockstore - - // Statistics - hits metrics.Counter - total metrics.Counter -} - -func (b *bloomcache) BloomActive() bool { - return atomic.LoadInt32(&b.active) != 0 -} - -func (b *bloomcache) Wait(ctx context.Context) error { - select { - case <-ctx.Done(): - return ctx.Err() - case <-b.buildChan: - return b.buildErr - } -} - -func (b *bloomcache) build(ctx context.Context) error { - evt := log.EventBegin(ctx, "bloomcache.build") - defer evt.Done() - defer close(b.buildChan) - - ch, err := b.blockstore.AllKeysChan(ctx) - if err != nil { - b.buildErr = fmt.Errorf("AllKeysChan failed in bloomcache rebuild with: %v", err) - return b.buildErr - } - for { - select { - case key, ok := <-ch: - if !ok { - atomic.StoreInt32(&b.active, 1) - return nil - } - b.bloom.AddTS(key.Bytes()) // Use binary key, the more compact the better - case <-ctx.Done(): - b.buildErr = ctx.Err() - return b.buildErr - } - } -} - -func (b *bloomcache) DeleteBlock(k cid.Cid) error { - if has, ok := b.hasCached(k); ok && !has { - return ErrNotFound - } - - return b.blockstore.DeleteBlock(k) -} - -// if ok == false has is inconclusive -// if ok == true then has respons to question: is it contained -func (b *bloomcache) hasCached(k cid.Cid) (has bool, ok bool) { - b.total.Inc() - if !k.Defined() { - log.Error("undefined in bloom cache") - // Return cache invalid so call to blockstore - // in case of invalid key is forwarded deeper - return false, false - } - if b.BloomActive() { - blr := b.bloom.HasTS(k.Bytes()) - if !blr { // not contained in bloom is only conclusive answer bloom gives - b.hits.Inc() - return false, true - } - } - return false, false -} - -func (b *bloomcache) Has(k cid.Cid) (bool, error) { - if has, ok := b.hasCached(k); ok { - return has, nil - } - - return b.blockstore.Has(k) -} - -func (b *bloomcache) GetSize(k cid.Cid) (int, error) { - return b.blockstore.GetSize(k) -} - -func (b *bloomcache) Get(k cid.Cid) (blocks.Block, error) { - if has, ok := b.hasCached(k); ok && !has { - return nil, ErrNotFound - } - - return b.blockstore.Get(k) -} - -func (b *bloomcache) Put(bl blocks.Block) error { - // See comment in PutMany - err := b.blockstore.Put(bl) - if err == nil { - b.bloom.AddTS(bl.Cid().Bytes()) - } - return err -} - -func (b *bloomcache) PutMany(bs []blocks.Block) error { - // bloom cache gives only conclusive resulty if key is not contained - // to reduce number of puts we need conclusive information if block is contained - // this means that PutMany can't be improved with bloom cache so we just - // just do a passthrough. - err := b.blockstore.PutMany(bs) - if err != nil { - return err - } - for _, bl := range bs { - b.bloom.AddTS(bl.Cid().Bytes()) - } - return nil -} - -func (b *bloomcache) HashOnRead(enabled bool) { - b.blockstore.HashOnRead(enabled) -} - -func (b *bloomcache) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - return b.blockstore.AllKeysChan(ctx) -} - -func (b *bloomcache) GCLock() Unlocker { - return b.blockstore.(GCBlockstore).GCLock() -} - -func (b *bloomcache) PinLock() Unlocker { - return b.blockstore.(GCBlockstore).PinLock() -} - -func (b *bloomcache) GCRequested() bool { - return b.blockstore.(GCBlockstore).GCRequested() -} diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/caching.go b/vendor/github.com/ipfs/go-ipfs-blockstore/caching.go deleted file mode 100644 index 798b84ce..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/caching.go +++ /dev/null @@ -1,55 +0,0 @@ -package blockstore - -import ( - "context" - "errors" - - metrics "github.com/ipfs/go-metrics-interface" -) - -// CacheOpts wraps options for CachedBlockStore(). -// Next to each option is it aproximate memory usage per unit -type CacheOpts struct { - HasBloomFilterSize int // 1 byte - HasBloomFilterHashes int // No size, 7 is usually best, consult bloom papers - HasARCCacheSize int // 32 bytes -} - -// DefaultCacheOpts returns a CacheOpts initialized with default values. -func DefaultCacheOpts() CacheOpts { - return CacheOpts{ - HasBloomFilterSize: 512 << 10, - HasBloomFilterHashes: 7, - HasARCCacheSize: 64 << 10, - } -} - -// CachedBlockstore returns a blockstore wrapped in an ARCCache and -// then in a bloom filter cache, if the options indicate it. -func CachedBlockstore( - ctx context.Context, - bs Blockstore, - opts CacheOpts) (cbs Blockstore, err error) { - cbs = bs - - if opts.HasBloomFilterSize < 0 || opts.HasBloomFilterHashes < 0 || - opts.HasARCCacheSize < 0 { - return nil, errors.New("all options for cache need to be greater than zero") - } - - if opts.HasBloomFilterSize != 0 && opts.HasBloomFilterHashes == 0 { - return nil, errors.New("bloom filter hash count can't be 0 when there is size set") - } - - ctx = metrics.CtxSubScope(ctx, "bs.cache") - - if opts.HasARCCacheSize > 0 { - cbs, err = newARCCachedBS(ctx, cbs, opts.HasARCCacheSize) - } - if opts.HasBloomFilterSize != 0 { - // *8 because of bytes to bits conversion - cbs, err = bloomCached(ctx, cbs, opts.HasBloomFilterSize*8, opts.HasBloomFilterHashes) - } - - return cbs, err -} diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/go.mod b/vendor/github.com/ipfs/go-ipfs-blockstore/go.mod deleted file mode 100644 index 6a8f6c7f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -module github.com/ipfs/go-ipfs-blockstore - -require ( - github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/bbloom v0.0.1 - github.com/ipfs/go-block-format v0.0.1 - github.com/ipfs/go-cid v0.0.1 - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-ipfs-ds-help v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-metrics-interface v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/go.sum b/vendor/github.com/ipfs/go-ipfs-blockstore/go.sum deleted file mode 100644 index c18ffbbe..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/go.sum +++ /dev/null @@ -1,75 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-block-format v0.0.1 h1:GjLpqsPNn2KbzA2GuG+hsUyxMhQ1xXgffWqWOee9e9o= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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= diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/idstore.go b/vendor/github.com/ipfs/go-ipfs-blockstore/idstore.go deleted file mode 100644 index 2a5bf841..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/idstore.go +++ /dev/null @@ -1,86 +0,0 @@ -package blockstore - -import ( - "context" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" -) - -// idstore wraps a BlockStore to add support for identity hashes -type idstore struct { - bs Blockstore -} - -func NewIdStore(bs Blockstore) Blockstore { - return &idstore{bs} -} - -func extractContents(k cid.Cid) (bool, []byte) { - dmh, err := mh.Decode(k.Hash()) - if err != nil || dmh.Code != mh.ID { - return false, nil - } - return true, dmh.Digest -} - -func (b *idstore) DeleteBlock(k cid.Cid) error { - isId, _ := extractContents(k) - if isId { - return nil - } - return b.bs.DeleteBlock(k) -} - -func (b *idstore) Has(k cid.Cid) (bool, error) { - isId, _ := extractContents(k) - if isId { - return true, nil - } - return b.bs.Has(k) -} - -func (b *idstore) GetSize(k cid.Cid) (int, error) { - isId, bdata := extractContents(k) - if isId { - return len(bdata), nil - } - return b.bs.GetSize(k) -} - -func (b *idstore) Get(k cid.Cid) (blocks.Block, error) { - isId, bdata := extractContents(k) - if isId { - return blocks.NewBlockWithCid(bdata, k) - } - return b.bs.Get(k) -} - -func (b *idstore) Put(bl blocks.Block) error { - isId, _ := extractContents(bl.Cid()) - if isId { - return nil - } - return b.bs.Put(bl) -} - -func (b *idstore) PutMany(bs []blocks.Block) error { - toPut := make([]blocks.Block, 0, len(bs)) - for _, bl := range bs { - isId, _ := extractContents(bl.Cid()) - if isId { - continue - } - toPut = append(toPut, bl) - } - return b.bs.PutMany(toPut) -} - -func (b *idstore) HashOnRead(enabled bool) { - b.bs.HashOnRead(enabled) -} - -func (b *idstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - return b.bs.AllKeysChan(ctx) -} diff --git a/vendor/github.com/ipfs/go-ipfs-blockstore/package.json b/vendor/github.com/ipfs/go-ipfs-blockstore/package.json deleted file mode 100644 index 6a40ca76..00000000 --- a/vendor/github.com/ipfs/go-ipfs-blockstore/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-blockstore" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-blockstore" - }, - "gxDependencies": [ - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "jbenet", - "hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9", - "name": "go-datastore", - "version": "3.6.1" - }, - { - "author": "ipfs", - "hash": "QmekzFM3hPZjTjUFGTABdQkEnQ3PTiMstY198PwSFr5w1Q", - "name": "go-metrics-interface", - "version": "0.2.0" - }, - { - "author": "hashicorp", - "hash": "QmQjMHF8ptRgx4E57UFMiT4YM6kqaJeYxZ1MCDX23aw4rK", - "name": "golang-lru", - "version": "2017.10.18" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "hector", - "hash": "QmXSEqXLCzpCByJU4wqbJ37TcBEj77FKMUWUP1qLh56847", - "name": "go-ipfs-ds-help", - "version": "0.1.7" - }, - { - "author": "kubuxu", - "hash": "QmWaLViWQF8jgyoLLqqcSrnp6dJpHESiJfzor1vrfDyTZf", - "name": "bbloom", - "version": "0.1.2" - }, - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-blockstore", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.8" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/.travis.yml b/vendor/github.com/ipfs/go-ipfs-chunker/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/LICENSE b/vendor/github.com/ipfs/go-ipfs-chunker/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/Makefile b/vendor/github.com/ipfs/go-ipfs-chunker/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/README.md b/vendor/github.com/ipfs/go-ipfs-chunker/README.md deleted file mode 100644 index 96faa3de..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# go-ipfs-chunker - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-chunker?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-chunker) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-chunker.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-chunker) - -> go-ipfs-chunker implements data Splitters for go-ipfs. - -`go-ipfs-chunker` provides the `Splitter` interface. IPFS splitters read data from a reader an create "chunks". These chunks are used to build the ipfs DAGs (Merkle Tree) and are the base unit to obtain the sums that ipfs uses to address content. - -The package provides a `SizeSplitter` which creates chunks of equal size and it is used by default in most cases, and a `rabin` fingerprint chunker. This chunker will attempt to split data in a way that the resulting blocks are the same when the data has repetitive patterns, thus optimizing the resulting DAGs. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-chunker` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-chunker -``` - -It uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. - -## Usage - -``` -import "github.com/ipfs/go-ipfs-chunker" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-chunker) - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/go.mod b/vendor/github.com/ipfs/go-ipfs-chunker/go.mod deleted file mode 100644 index 0610d885..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/ipfs/go-ipfs-chunker - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-buffer-pool v0.0.1 - github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f -) diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/go.sum b/vendor/github.com/ipfs/go-ipfs-chunker/go.sum deleted file mode 100644 index a45b1eeb..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/go.sum +++ /dev/null @@ -1,55 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/package.json b/vendor/github.com/ipfs/go-ipfs-chunker/package.json deleted file mode 100644 index d53c0e7b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-chunker" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-chunker" - }, - "gxDependencies": [ - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "whyrusleeping", - "hash": "QmZooytqEoUwQjv7KzH4d3xyJnyvD3AWJaCDMYt5pbCtua", - "name": "chunker", - "version": "0.0.1" - }, - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "Stebalien", - "hash": "QmQDvJoB6aJWN3sjr3xsgXqKCXf4jU5zdMXpDMsBkYVNqa", - "name": "go-buffer-pool", - "version": "0.1.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-chunker", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.6" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/parse.go b/vendor/github.com/ipfs/go-ipfs-chunker/parse.go deleted file mode 100644 index af0a31e8..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/parse.go +++ /dev/null @@ -1,88 +0,0 @@ -package chunk - -import ( - "errors" - "fmt" - "io" - "strconv" - "strings" -) - -var ( - ErrRabinMin = errors.New("rabin min must be greater than 16") - ErrSize = errors.New("chunker size muster greater than 0") -) - -// FromString returns a Splitter depending on the given string: -// it supports "default" (""), "size-{size}", "rabin", "rabin-{blocksize}" and -// "rabin-{min}-{avg}-{max}". -func FromString(r io.Reader, chunker string) (Splitter, error) { - switch { - case chunker == "" || chunker == "default": - return DefaultSplitter(r), nil - - case strings.HasPrefix(chunker, "size-"): - sizeStr := strings.Split(chunker, "-")[1] - size, err := strconv.Atoi(sizeStr) - if err != nil { - return nil, err - } else if size <= 0 { - return nil, ErrSize - } - return NewSizeSplitter(r, int64(size)), nil - - case strings.HasPrefix(chunker, "rabin"): - return parseRabinString(r, chunker) - - default: - return nil, fmt.Errorf("unrecognized chunker option: %s", chunker) - } -} - -func parseRabinString(r io.Reader, chunker string) (Splitter, error) { - parts := strings.Split(chunker, "-") - switch len(parts) { - case 1: - return NewRabin(r, uint64(DefaultBlockSize)), nil - case 2: - size, err := strconv.Atoi(parts[1]) - if err != nil { - return nil, err - } - return NewRabin(r, uint64(size)), nil - case 4: - sub := strings.Split(parts[1], ":") - if len(sub) > 1 && sub[0] != "min" { - return nil, errors.New("first label must be min") - } - min, err := strconv.Atoi(sub[len(sub)-1]) - if err != nil { - return nil, err - } - if min < 16 { - return nil, ErrRabinMin - } - sub = strings.Split(parts[2], ":") - if len(sub) > 1 && sub[0] != "avg" { - log.Error("sub == ", sub) - return nil, errors.New("second label must be avg") - } - avg, err := strconv.Atoi(sub[len(sub)-1]) - if err != nil { - return nil, err - } - - sub = strings.Split(parts[3], ":") - if len(sub) > 1 && sub[0] != "max" { - return nil, errors.New("final label must be max") - } - max, err := strconv.Atoi(sub[len(sub)-1]) - if err != nil { - return nil, err - } - - return NewRabinMinMax(r, uint64(min), uint64(avg), uint64(max)), nil - default: - return nil, errors.New("incorrect format (expected 'rabin' 'rabin-[avg]' or 'rabin-[min]-[avg]-[max]'") - } -} diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/rabin.go b/vendor/github.com/ipfs/go-ipfs-chunker/rabin.go deleted file mode 100644 index 4247057b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/rabin.go +++ /dev/null @@ -1,54 +0,0 @@ -package chunk - -import ( - "hash/fnv" - "io" - - "github.com/whyrusleeping/chunker" -) - -// IpfsRabinPoly is the irreducible polynomial of degree 53 used by for Rabin. -var IpfsRabinPoly = chunker.Pol(17437180132763653) - -// Rabin implements the Splitter interface and splits content with Rabin -// fingerprints. -type Rabin struct { - r *chunker.Chunker - reader io.Reader -} - -// NewRabin creates a new Rabin splitter with the given -// average block size. -func NewRabin(r io.Reader, avgBlkSize uint64) *Rabin { - min := avgBlkSize / 3 - max := avgBlkSize + (avgBlkSize / 2) - - return NewRabinMinMax(r, min, avgBlkSize, max) -} - -// NewRabinMinMax returns a new Rabin splitter which uses -// the given min, average and max block sizes. -func NewRabinMinMax(r io.Reader, min, avg, max uint64) *Rabin { - h := fnv.New32a() - ch := chunker.New(r, IpfsRabinPoly, h, avg, min, max) - - return &Rabin{ - r: ch, - reader: r, - } -} - -// NextBytes reads the next bytes from the reader and returns a slice. -func (r *Rabin) NextBytes() ([]byte, error) { - ch, err := r.r.Next() - if err != nil { - return nil, err - } - - return ch.Data, nil -} - -// Reader returns the io.Reader associated to this Splitter. -func (r *Rabin) Reader() io.Reader { - return r.reader -} diff --git a/vendor/github.com/ipfs/go-ipfs-chunker/splitting.go b/vendor/github.com/ipfs/go-ipfs-chunker/splitting.go deleted file mode 100644 index 2b237399..00000000 --- a/vendor/github.com/ipfs/go-ipfs-chunker/splitting.go +++ /dev/null @@ -1,105 +0,0 @@ -// Package chunk implements streaming block splitters. -// Splitters read data from a reader and provide byte slices (chunks) -// The size and contents of these slices depend on the splitting method -// used. -package chunk - -import ( - "io" - - logging "github.com/ipfs/go-log" - pool "github.com/libp2p/go-buffer-pool" -) - -var log = logging.Logger("chunk") - -// DefaultBlockSize is the chunk size that splitters produce (or aim to). -var DefaultBlockSize int64 = 1024 * 256 - -// A Splitter reads bytes from a Reader and creates "chunks" (byte slices) -// that can be used to build DAG nodes. -type Splitter interface { - Reader() io.Reader - NextBytes() ([]byte, error) -} - -// SplitterGen is a splitter generator, given a reader. -type SplitterGen func(r io.Reader) Splitter - -// DefaultSplitter returns a SizeSplitter with the DefaultBlockSize. -func DefaultSplitter(r io.Reader) Splitter { - return NewSizeSplitter(r, DefaultBlockSize) -} - -// SizeSplitterGen returns a SplitterGen function which will create -// a splitter with the given size when called. -func SizeSplitterGen(size int64) SplitterGen { - return func(r io.Reader) Splitter { - return NewSizeSplitter(r, size) - } -} - -// Chan returns a channel that receives each of the chunks produced -// by a splitter, along with another one for errors. -func Chan(s Splitter) (<-chan []byte, <-chan error) { - out := make(chan []byte) - errs := make(chan error, 1) - go func() { - defer close(out) - defer close(errs) - - // all-chunks loop (keep creating chunks) - for { - b, err := s.NextBytes() - if err != nil { - errs <- err - return - } - - out <- b - } - }() - return out, errs -} - -type sizeSplitterv2 struct { - r io.Reader - size uint32 - err error -} - -// NewSizeSplitter returns a new size-based Splitter with the given block size. -func NewSizeSplitter(r io.Reader, size int64) Splitter { - return &sizeSplitterv2{ - r: r, - size: uint32(size), - } -} - -// NextBytes produces a new chunk. -func (ss *sizeSplitterv2) NextBytes() ([]byte, error) { - if ss.err != nil { - return nil, ss.err - } - - full := pool.Get(int(ss.size)) - n, err := io.ReadFull(ss.r, full) - switch err { - case io.ErrUnexpectedEOF: - ss.err = io.EOF - small := make([]byte, n) - copy(small, full) - pool.Put(full) - return small, nil - case nil: - return full, nil - default: - pool.Put(full) - return nil, err - } -} - -// Reader returns the io.Reader associated to this Splitter. -func (ss *sizeSplitterv2) Reader() io.Reader { - return ss.r -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/.gitignore b/vendor/github.com/ipfs/go-ipfs-config/.gitignore deleted file mode 100644 index 9a684b15..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -serialize/.ipfsconfig diff --git a/vendor/github.com/ipfs/go-ipfs-config/.travis.yml b/vendor/github.com/ipfs/go-ipfs-config/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-config/LICENSE b/vendor/github.com/ipfs/go-ipfs-config/LICENSE deleted file mode 100644 index 833dabb8..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-config/addresses.go b/vendor/github.com/ipfs/go-ipfs-config/addresses.go deleted file mode 100644 index 2d88468f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/addresses.go +++ /dev/null @@ -1,10 +0,0 @@ -package config - -// Addresses stores the (string) multiaddr addresses for the node. -type Addresses struct { - Swarm []string // addresses for the swarm to listen on - Announce []string // swarm addresses to announce to the network - NoAnnounce []string // swarm addresses not to announce to the network - API Strings // address for the local API (RPC) - Gateway Strings // address to listen on for IPFS HTTP object gateway -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/api.go b/vendor/github.com/ipfs/go-ipfs-config/api.go deleted file mode 100644 index b36b1080..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/api.go +++ /dev/null @@ -1,5 +0,0 @@ -package config - -type API struct { - HTTPHeaders map[string][]string // HTTP headers to return with the API. -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/bootstrap_peers.go b/vendor/github.com/ipfs/go-ipfs-config/bootstrap_peers.go deleted file mode 100644 index f4a13dc9..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/bootstrap_peers.go +++ /dev/null @@ -1,88 +0,0 @@ -package config - -import ( - "errors" - "fmt" - - peer "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" - - // Needs to be imported so that users can import this package directly - // and still parse the bootstrap addresses. - _ "github.com/multiformats/go-multiaddr-dns" -) - -// DefaultBootstrapAddresses are the hardcoded bootstrap addresses -// for IPFS. they are nodes run by the IPFS team. docs on these later. -// As with all p2p networks, bootstrap is an important security concern. -// -// NOTE: This is here -- and not inside cmd/ipfs/init.go -- because of an -// import dependency issue. TODO: move this into a config/default/ package. -var DefaultBootstrapAddresses = []string{ - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", - "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", // mars.i.ipfs.io - "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM", // pluto.i.ipfs.io - "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu", // saturn.i.ipfs.io - "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", // venus.i.ipfs.io - "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd", // earth.i.ipfs.io - "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM", // pluto.i.ipfs.io - "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu", // saturn.i.ipfs.io - "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", // venus.i.ipfs.io - "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd", // earth.i.ipfs.io -} - -// ErrInvalidPeerAddr signals an address is not a valid peer address. -var ErrInvalidPeerAddr = errors.New("invalid peer address") - -func (c *Config) BootstrapPeers() ([]peer.AddrInfo, error) { - return ParseBootstrapPeers(c.Bootstrap) -} - -// DefaultBootstrapPeers returns the (parsed) set of default bootstrap peers. -// if it fails, it returns a meaningful error for the user. -// This is here (and not inside cmd/ipfs/init) because of module dependency problems. -func DefaultBootstrapPeers() ([]peer.AddrInfo, error) { - ps, err := ParseBootstrapPeers(DefaultBootstrapAddresses) - if err != nil { - return nil, fmt.Errorf(`failed to parse hardcoded bootstrap peers: %s -This is a problem with the ipfs codebase. Please report it to the dev team.`, err) - } - return ps, nil -} - -func (c *Config) SetBootstrapPeers(bps []peer.AddrInfo) { - c.Bootstrap = BootstrapPeerStrings(bps) -} - -// ParseBootstrapPeer parses a bootstrap list into a list of AddrInfos. -func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error) { - maddrs := make([]ma.Multiaddr, len(addrs)) - for i, addr := range addrs { - var err error - maddrs[i], err = ma.NewMultiaddr(addr) - if err != nil { - return nil, err - } - } - return peer.AddrInfosFromP2pAddrs(maddrs...) -} - -// BootstrapPeerStrings formats a list of AddrInfos as a bootstrap peer list -// suitable for serialization. -func BootstrapPeerStrings(bps []peer.AddrInfo) []string { - bpss := make([]string, 0, len(bps)) - for _, pi := range bps { - addrs, err := peer.AddrInfoToP2pAddrs(&pi) - if err != nil { - // programmer error. - panic(err) - } - for _, addr := range addrs { - bpss = append(bpss, addr.String()) - } - } - return bpss -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/config.go b/vendor/github.com/ipfs/go-ipfs-config/config.go deleted file mode 100644 index dc987547..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/config.go +++ /dev/null @@ -1,128 +0,0 @@ -// package config implements the ipfs config file datastructures and utilities. -package config - -import ( - "bytes" - "encoding/json" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/mitchellh/go-homedir" -) - -// Config is used to load ipfs config files. -type Config struct { - Identity Identity // local node's peer identity - Datastore Datastore // local node's storage - Addresses Addresses // local node's addresses - Mounts Mounts // local node's mount points - Discovery Discovery // local node's discovery mechanisms - Routing Routing // local node's routing settings - Ipns Ipns // Ipns settings - Bootstrap []string // local nodes's bootstrap peer addresses - Gateway Gateway // local node's gateway server options - API API // local node's API settings - Swarm SwarmConfig - Pubsub PubsubConfig - - Reprovider Reprovider - Experimental Experiments -} - -const ( - // DefaultPathName is the default config dir name - DefaultPathName = ".ipfs" - // DefaultPathRoot is the path to the default config dir location. - DefaultPathRoot = "~/" + DefaultPathName - // DefaultConfigFile is the filename of the configuration file - DefaultConfigFile = "config" - // EnvDir is the environment variable used to change the path root. - EnvDir = "IPFS_PATH" -) - -// PathRoot returns the default configuration root directory -func PathRoot() (string, error) { - dir := os.Getenv(EnvDir) - var err error - if len(dir) == 0 { - dir, err = homedir.Expand(DefaultPathRoot) - } - return dir, err -} - -// Path returns the path `extension` relative to the configuration root. If an -// empty string is provided for `configroot`, the default root is used. -func Path(configroot, extension string) (string, error) { - if len(configroot) == 0 { - dir, err := PathRoot() - if err != nil { - return "", err - } - return filepath.Join(dir, extension), nil - - } - return filepath.Join(configroot, extension), nil -} - -// Filename returns the configuration file path given a configuration root -// directory. If the configuration root directory is empty, use the default one -func Filename(configroot string) (string, error) { - return Path(configroot, DefaultConfigFile) -} - -// HumanOutput gets a config value ready for printing -func HumanOutput(value interface{}) ([]byte, error) { - s, ok := value.(string) - if ok { - return []byte(strings.Trim(s, "\n")), nil - } - return Marshal(value) -} - -// Marshal configuration with JSON -func Marshal(value interface{}) ([]byte, error) { - // need to prettyprint, hence MarshalIndent, instead of Encoder - return json.MarshalIndent(value, "", " ") -} - -func FromMap(v map[string]interface{}) (*Config, error) { - buf := new(bytes.Buffer) - if err := json.NewEncoder(buf).Encode(v); err != nil { - return nil, err - } - var conf Config - if err := json.NewDecoder(buf).Decode(&conf); err != nil { - return nil, fmt.Errorf("failure to decode config: %s", err) - } - return &conf, nil -} - -func ToMap(conf *Config) (map[string]interface{}, error) { - buf := new(bytes.Buffer) - if err := json.NewEncoder(buf).Encode(conf); err != nil { - return nil, err - } - var m map[string]interface{} - if err := json.NewDecoder(buf).Decode(&m); err != nil { - return nil, fmt.Errorf("failure to decode config: %s", err) - } - return m, nil -} - -// Clone copies the config. Use when updating. -func (c *Config) Clone() (*Config, error) { - var newConfig Config - var buf bytes.Buffer - - if err := json.NewEncoder(&buf).Encode(c); err != nil { - return nil, fmt.Errorf("failure to encode config: %s", err) - } - - if err := json.NewDecoder(&buf).Decode(&newConfig); err != nil { - return nil, fmt.Errorf("failure to decode config: %s", err) - } - - return &newConfig, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/datastore.go b/vendor/github.com/ipfs/go-ipfs-config/datastore.go deleted file mode 100644 index 2b2bcb51..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/datastore.go +++ /dev/null @@ -1,32 +0,0 @@ -package config - -import ( - "encoding/json" -) - -// DefaultDataStoreDirectory is the directory to store all the local IPFS data. -const DefaultDataStoreDirectory = "datastore" - -// Datastore tracks the configuration of the datastore. -type Datastore struct { - StorageMax string // in B, kB, kiB, MB, ... - StorageGCWatermark int64 // in percentage to multiply on StorageMax - GCPeriod string // in ns, us, ms, s, m, h - - // deprecated fields, use Spec - Type string `json:",omitempty"` - Path string `json:",omitempty"` - NoSync bool `json:",omitempty"` - Params *json.RawMessage `json:",omitempty"` - - Spec map[string]interface{} - - HashOnRead bool - BloomFilterSize int -} - -// DataStorePath returns the default data store path given a configuration root -// (set an empty string to have the default configuration root) -func DataStorePath(configroot string) (string, error) { - return Path(configroot, DefaultDataStoreDirectory) -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/discovery.go b/vendor/github.com/ipfs/go-ipfs-config/discovery.go deleted file mode 100644 index 4fb8508f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/discovery.go +++ /dev/null @@ -1,12 +0,0 @@ -package config - -type Discovery struct { - MDNS MDNS -} - -type MDNS struct { - Enabled bool - - // Time in seconds between discovery rounds - Interval int -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/experiments.go b/vendor/github.com/ipfs/go-ipfs-config/experiments.go deleted file mode 100644 index 6821ed6b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/experiments.go +++ /dev/null @@ -1,12 +0,0 @@ -package config - -type Experiments struct { - FilestoreEnabled bool - UrlstoreEnabled bool - ShardingEnabled bool - Libp2pStreamMounting bool - P2pHttpProxy bool - QUIC bool - PreferTLS bool - StrategicProviding bool -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/gateway.go b/vendor/github.com/ipfs/go-ipfs-config/gateway.go deleted file mode 100644 index 017be9b2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/gateway.go +++ /dev/null @@ -1,11 +0,0 @@ -package config - -// Gateway contains options for the HTTP gateway server. -type Gateway struct { - HTTPHeaders map[string][]string // HTTP headers to return with the gateway - RootRedirect string - Writable bool - PathPrefixes []string - APICommands []string - NoFetch bool -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/go.mod b/vendor/github.com/ipfs/go-ipfs-config/go.mod deleted file mode 100644 index 95b7006b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/ipfs/go-ipfs-config - -require ( - github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.3 - github.com/mitchellh/go-homedir v1.1.0 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-dns v0.0.2 -) diff --git a/vendor/github.com/ipfs/go-ipfs-config/go.sum b/vendor/github.com/ipfs/go-ipfs-config/go.sum deleted file mode 100644 index de086052..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/go.sum +++ /dev/null @@ -1,92 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 h1:BBso6MBKW8ncyZLv37o+KNyy0HrrHgfnOaGQC2qvN+A= -github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5/go.mod h1:JpoxHjuQauoxiFMl1ie8Xc/7TfLuMZ5eOCONd1sUBHg= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.3 h1:+IonUYY0nJZLb5Fdv6a6DOjtGP1L8Bb3faamiI2q5FY= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 h1:8dUaAV7K4uHsF56JQWkprecIQKdPHtR9jCHF5nB8uzc= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-ipfs-config/identity.go b/vendor/github.com/ipfs/go-ipfs-config/identity.go deleted file mode 100644 index f4e7c872..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/identity.go +++ /dev/null @@ -1,29 +0,0 @@ -package config - -import ( - "encoding/base64" - - ic "github.com/libp2p/go-libp2p-core/crypto" -) - -const IdentityTag = "Identity" -const PrivKeyTag = "PrivKey" -const PrivKeySelector = IdentityTag + "." + PrivKeyTag - -// Identity tracks the configuration of the local node's identity. -type Identity struct { - PeerID string - PrivKey string `json:",omitempty"` -} - -// DecodePrivateKey is a helper to decode the users PrivateKey -func (i *Identity) DecodePrivateKey(passphrase string) (ic.PrivKey, error) { - pkb, err := base64.StdEncoding.DecodeString(i.PrivKey) - if err != nil { - return nil, err - } - - // currently storing key unencrypted. in the future we need to encrypt it. - // TODO(security) - return ic.UnmarshalPrivateKey(pkb) -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/init.go b/vendor/github.com/ipfs/go-ipfs-config/init.go deleted file mode 100644 index 7f11c3a3..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/init.go +++ /dev/null @@ -1,181 +0,0 @@ -package config - -import ( - "encoding/base64" - "errors" - "fmt" - "io" - "time" - - ci "github.com/libp2p/go-libp2p-core/crypto" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -func Init(out io.Writer, nBitsForKeypair int) (*Config, error) { - identity, err := identityConfig(out, nBitsForKeypair) - if err != nil { - return nil, err - } - - bootstrapPeers, err := DefaultBootstrapPeers() - if err != nil { - return nil, err - } - - datastore := DefaultDatastoreConfig() - - conf := &Config{ - API: API{ - HTTPHeaders: map[string][]string{}, - }, - - // setup the node's default addresses. - // NOTE: two swarm listen addrs, one tcp, one utp. - Addresses: addressesConfig(), - - Datastore: datastore, - Bootstrap: BootstrapPeerStrings(bootstrapPeers), - Identity: identity, - Discovery: Discovery{ - MDNS: MDNS{ - Enabled: true, - Interval: 10, - }, - }, - - Routing: Routing{ - Type: "dht", - }, - - // setup the node mount points. - Mounts: Mounts{ - IPFS: "/ipfs", - IPNS: "/ipns", - }, - - Ipns: Ipns{ - ResolveCacheSize: 128, - }, - - Gateway: Gateway{ - RootRedirect: "", - Writable: false, - NoFetch: false, - PathPrefixes: []string{}, - HTTPHeaders: map[string][]string{ - "Access-Control-Allow-Origin": []string{"*"}, - "Access-Control-Allow-Methods": []string{"GET"}, - "Access-Control-Allow-Headers": []string{"X-Requested-With", "Range", "User-Agent"}, - }, - APICommands: []string{}, - }, - Reprovider: Reprovider{ - Interval: "12h", - Strategy: "all", - }, - Swarm: SwarmConfig{ - ConnMgr: ConnMgr{ - LowWater: DefaultConnMgrLowWater, - HighWater: DefaultConnMgrHighWater, - GracePeriod: DefaultConnMgrGracePeriod.String(), - Type: "basic", - }, - }, - } - - return conf, nil -} - -// DefaultConnMgrHighWater is the default value for the connection managers -// 'high water' mark -const DefaultConnMgrHighWater = 900 - -// DefaultConnMgrLowWater is the default value for the connection managers 'low -// water' mark -const DefaultConnMgrLowWater = 600 - -// DefaultConnMgrGracePeriod is the default value for the connection managers -// grace period -const DefaultConnMgrGracePeriod = time.Second * 20 - -func addressesConfig() Addresses { - return Addresses{ - Swarm: []string{ - "/ip4/0.0.0.0/tcp/4001", - // "/ip4/0.0.0.0/udp/4002/utp", // disabled for now. - "/ip6/::/tcp/4001", - }, - Announce: []string{}, - NoAnnounce: []string{}, - API: Strings{"/ip4/127.0.0.1/tcp/5001"}, - Gateway: Strings{"/ip4/127.0.0.1/tcp/8080"}, - } -} - -// DefaultDatastoreConfig is an internal function exported to aid in testing. -func DefaultDatastoreConfig() Datastore { - return Datastore{ - StorageMax: "10GB", - StorageGCWatermark: 90, // 90% - GCPeriod: "1h", - BloomFilterSize: 0, - Spec: map[string]interface{}{ - "type": "mount", - "mounts": []interface{}{ - map[string]interface{}{ - "mountpoint": "/blocks", - "type": "measure", - "prefix": "flatfs.datastore", - "child": map[string]interface{}{ - "type": "flatfs", - "path": "blocks", - "sync": true, - "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2", - }, - }, - map[string]interface{}{ - "mountpoint": "/", - "type": "measure", - "prefix": "leveldb.datastore", - "child": map[string]interface{}{ - "type": "levelds", - "path": "datastore", - "compression": "none", - }, - }, - }, - }, - } -} - -// identityConfig initializes a new identity. -func identityConfig(out io.Writer, nbits int) (Identity, error) { - // TODO guard higher up - ident := Identity{} - if nbits < 1024 { - return ident, errors.New("bitsize less than 1024 is considered unsafe") - } - - fmt.Fprintf(out, "generating %v-bit RSA keypair...", nbits) - sk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits) - if err != nil { - return ident, err - } - fmt.Fprintf(out, "done\n") - - // currently storing key unencrypted. in the future we need to encrypt it. - // TODO(security) - skbytes, err := sk.Bytes() - if err != nil { - return ident, err - } - ident.PrivKey = base64.StdEncoding.EncodeToString(skbytes) - - id, err := peer.IDFromPublicKey(pk) - if err != nil { - return ident, err - } - ident.PeerID = id.Pretty() - fmt.Fprintf(out, "peer identity: %s\n", ident.PeerID) - return ident, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/ipns.go b/vendor/github.com/ipfs/go-ipfs-config/ipns.go deleted file mode 100644 index 44a95b09..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/ipns.go +++ /dev/null @@ -1,8 +0,0 @@ -package config - -type Ipns struct { - RepublishPeriod string - RecordLifetime string - - ResolveCacheSize int -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/mounts.go b/vendor/github.com/ipfs/go-ipfs-config/mounts.go deleted file mode 100644 index b23d30b2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/mounts.go +++ /dev/null @@ -1,8 +0,0 @@ -package config - -// Mounts stores the (string) mount points -type Mounts struct { - IPFS string - IPNS string - FuseAllowOther bool -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/profile.go b/vendor/github.com/ipfs/go-ipfs-config/profile.go deleted file mode 100644 index ac871f3f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/profile.go +++ /dev/null @@ -1,259 +0,0 @@ -package config - -import ( - "fmt" - "net" - "os" - "time" -) - -// Transformer is a function which takes configuration and applies some filter to it -type Transformer func(c *Config) error - -// Profile contains the profile transformer the description of the profile -type Profile struct { - // Description briefly describes the functionality of the profile - Description string - - // Transform takes ipfs configuration and applies the profile to it - Transform Transformer -} - -// defaultServerFilters has is a list of IPv4 and IPv6 prefixes that are private, local only, or unrouteable. -// according to https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml -// and https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml -var defaultServerFilters = []string{ - "/ip4/10.0.0.0/ipcidr/8", - "/ip4/100.64.0.0/ipcidr/10", - "/ip4/169.254.0.0/ipcidr/16", - "/ip4/172.16.0.0/ipcidr/12", - "/ip4/192.0.0.0/ipcidr/24", - "/ip4/192.0.0.0/ipcidr/29", - "/ip4/192.0.0.8/ipcidr/32", - "/ip4/192.0.0.170/ipcidr/32", - "/ip4/192.0.0.171/ipcidr/32", - "/ip4/192.0.2.0/ipcidr/24", - "/ip4/192.168.0.0/ipcidr/16", - "/ip4/198.18.0.0/ipcidr/15", - "/ip4/198.51.100.0/ipcidr/24", - "/ip4/203.0.113.0/ipcidr/24", - "/ip4/240.0.0.0/ipcidr/4", - "/ip6/100::/ipcidr/64", - "/ip6/2001:2::/ipcidr/48", - "/ip6/2001:db8::/ipcidr/32", - "/ip6/fc00::/ipcidr/7", - "/ip6/fe80::/ipcidr/10", -} - -// Profiles is a map holding configuration transformers. Docs are in docs/config.md -var Profiles = map[string]Profile{ - "server": { - Description: `Disables local host discovery, recommended when -running IPFS on machines with public IPv4 addresses.`, - - Transform: func(c *Config) error { - c.Addresses.NoAnnounce = appendSingle(c.Addresses.NoAnnounce, defaultServerFilters) - c.Swarm.AddrFilters = appendSingle(c.Swarm.AddrFilters, defaultServerFilters) - c.Discovery.MDNS.Enabled = false - c.Swarm.DisableNatPortMap = true - return nil - }, - }, - - "local-discovery": { - Description: `Sets default values to fields affected by the server -profile, enables discovery in local networks.`, - - Transform: func(c *Config) error { - c.Addresses.NoAnnounce = deleteEntries(c.Addresses.NoAnnounce, defaultServerFilters) - c.Swarm.AddrFilters = deleteEntries(c.Swarm.AddrFilters, defaultServerFilters) - c.Discovery.MDNS.Enabled = true - c.Swarm.DisableNatPortMap = false - return nil - }, - }, - "test": { - Description: `Reduces external interference of IPFS daemon, this -is useful when using the daemon in test environments.`, - - Transform: func(c *Config) error { - c.Addresses.API = Strings{"/ip4/127.0.0.1/tcp/0"} - c.Addresses.Gateway = Strings{"/ip4/127.0.0.1/tcp/0"} - c.Addresses.Swarm = []string{ - "/ip4/127.0.0.1/tcp/0", - } - - c.Swarm.DisableNatPortMap = true - - c.Bootstrap = []string{} - c.Discovery.MDNS.Enabled = false - return nil - }, - }, - "default-networking": { - Description: `Restores default network settings. -Inverse profile of the test profile.`, - - Transform: func(c *Config) error { - c.Addresses = addressesConfig() - - bootstrapPeers, err := DefaultBootstrapPeers() - if err != nil { - return err - } - c.Bootstrap = appendSingle(c.Bootstrap, BootstrapPeerStrings(bootstrapPeers)) - - c.Swarm.DisableNatPortMap = false - c.Discovery.MDNS.Enabled = true - return nil - }, - }, - "badgerds": { - Description: `Replaces default datastore configuration with experimental -badger datastore. - -If you apply this profile after ipfs init, you will need -to convert your datastore to the new configuration. -You can do this using ipfs-ds-convert. - -For more on ipfs-ds-convert see -$ ipfs-ds-convert --help -and -$ ipfs-ds-convert convert --help - -WARNING: badger datastore is experimental. -Make sure to backup your data frequently.`, - - Transform: func(c *Config) error { - c.Datastore.Spec = map[string]interface{}{ - "type": "measure", - "prefix": "badger.datastore", - "child": map[string]interface{}{ - "type": "badgerds", - "path": "badgerds", - "syncWrites": true, - "truncate": true, - }, - } - return nil - }, - }, - "postgresds": { - Description: `Replaces default datastore configuration with experimental -postgres datastore. - -WARNING: postgres datastore is experimental. -Make sure to backup your data frequently.`, - Transform: func(c *Config) error { - c.Datastore.Spec = map[string]interface{}{ - "type": "measure", - "prefix": "postgres.datastore", - "child": map[string]interface{}{ - "type": "postgres", - "host": os.Getenv("IPFS_PGHOST"), - "user": os.Getenv("IPFS_PGUSER"), - "passfile": os.Getenv("IPFS_PGPASSFILE"), - "password": os.Getenv("IPFS_PGPASSWORD"), - "dbname": os.Getenv("IPFS_PGDATABASE"), - "port": os.Getenv("IPFS_PGPORT"), - }, - } - return nil - }, - }, - "default-datastore": { - Description: `Restores default datastore configuration. - -If you apply this profile after ipfs init, you will need -to convert your datastore to the new configuration. -You can do this using ipfs-ds-convert. - -For more on ipfs-ds-convert see -$ ipfs-ds-convert --help -and -$ ipfs-ds-convert convert --help -`, - - Transform: func(c *Config) error { - c.Datastore.Spec = DefaultDatastoreConfig().Spec - return nil - }, - }, - "lowpower": { - Description: `Reduces daemon overhead on the system. May affect node -functionality - performance of content discovery and data -fetching may be degraded. -`, - Transform: func(c *Config) error { - c.Routing.Type = "dhtclient" - c.Reprovider.Interval = "0" - - c.Swarm.ConnMgr.LowWater = 20 - c.Swarm.ConnMgr.HighWater = 40 - c.Swarm.ConnMgr.GracePeriod = time.Minute.String() - return nil - }, - }, - "randomports": { - Description: `Use a random port number for swarm.`, - - Transform: func(c *Config) error { - port, err := getAvailablePort() - if err != nil { - return err - } - c.Addresses.Swarm = []string{ - fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port), - fmt.Sprintf("/ip6/::/tcp/%d", port), - } - return nil - }, - }, -} - -func getAvailablePort() (port int, err error) { - ln, err := net.Listen("tcp", "[::]:0") - if err != nil { - return 0, err - } - defer ln.Close() - port = ln.Addr().(*net.TCPAddr).Port - return port, nil -} - -func appendSingle(a []string, b []string) []string { - out := make([]string, 0, len(a)+len(b)) - m := map[string]bool{} - for _, f := range a { - if !m[f] { - out = append(out, f) - } - m[f] = true - } - for _, f := range b { - if !m[f] { - out = append(out, f) - } - m[f] = true - } - return out -} - -func deleteEntries(arr []string, del []string) []string { - m := map[string]struct{}{} - for _, f := range arr { - m[f] = struct{}{} - } - for _, f := range del { - delete(m, f) - } - return mapKeys(m) -} - -func mapKeys(m map[string]struct{}) []string { - out := make([]string, 0, len(m)) - for f := range m { - out = append(out, f) - } - return out -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/pubsub.go b/vendor/github.com/ipfs/go-ipfs-config/pubsub.go deleted file mode 100644 index 94e03e28..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/pubsub.go +++ /dev/null @@ -1,18 +0,0 @@ -package config - -type PubsubConfig struct { - // Router can be either floodsub (legacy) or gossipsub (new and - // backwards compatible). - Router string - - // DisableSigning disables message signing. Message signing is *enabled* - // by default. - DisableSigning bool - - // StrictSignatureVerification enables strict signature verification. - // When enabled, unsigned messages will be rejected. Eventually, this - // will be made the default and this option will disappear. Once this - // happens, networks will either need to completely disable or - // completely enable message signing. - StrictSignatureVerification bool -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/reprovider.go b/vendor/github.com/ipfs/go-ipfs-config/reprovider.go deleted file mode 100644 index fa029c2f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/reprovider.go +++ /dev/null @@ -1,6 +0,0 @@ -package config - -type Reprovider struct { - Interval string // Time period to reprovide locally stored objects to the network - Strategy string // Which keys to announce -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/routing.go b/vendor/github.com/ipfs/go-ipfs-config/routing.go deleted file mode 100644 index e601cd5e..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/routing.go +++ /dev/null @@ -1,7 +0,0 @@ -package config - -// Routing defines configuration options for libp2p routing -type Routing struct { - // Type sets default daemon routing mode. - Type string -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/serialize/serialize.go b/vendor/github.com/ipfs/go-ipfs-config/serialize/serialize.go deleted file mode 100644 index eedf7e1a..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/serialize/serialize.go +++ /dev/null @@ -1,71 +0,0 @@ -package fsrepo - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "os" - "path/filepath" - - "github.com/ipfs/go-ipfs-config" - - "github.com/facebookgo/atomicfile" - "github.com/ipfs/go-ipfs-util" -) - -// ReadConfigFile reads the config from `filename` into `cfg`. -func ReadConfigFile(filename string, cfg interface{}) error { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - if err := json.NewDecoder(f).Decode(cfg); err != nil { - return fmt.Errorf("failure to decode config: %s", err) - } - return nil -} - -// WriteConfigFile writes the config from `cfg` into `filename`. -func WriteConfigFile(filename string, cfg interface{}) error { - err := os.MkdirAll(filepath.Dir(filename), 0775) - if err != nil { - return err - } - - f, err := atomicfile.New(filename, 0660) - if err != nil { - return err - } - defer f.Close() - - return encode(f, cfg) -} - -// encode configuration with JSON -func encode(w io.Writer, value interface{}) error { - // need to prettyprint, hence MarshalIndent, instead of Encoder - buf, err := config.Marshal(value) - if err != nil { - return err - } - _, err = w.Write(buf) - return err -} - -// Load reads given file and returns the read config, or error. -func Load(filename string) (*config.Config, error) { - // if nothing is there, fail. User must run 'ipfs init' - if !util.FileExists(filename) { - return nil, errors.New("ipfs not initialized, please run 'ipfs init'") - } - - var cfg config.Config - err := ReadConfigFile(filename, &cfg) - if err != nil { - return nil, err - } - - return &cfg, err -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/swarm.go b/vendor/github.com/ipfs/go-ipfs-config/swarm.go deleted file mode 100644 index 16dc54d9..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/swarm.go +++ /dev/null @@ -1,25 +0,0 @@ -package config - -type SwarmConfig struct { - AddrFilters []string - DisableBandwidthMetrics bool - DisableNatPortMap bool - DisableRelay bool - EnableRelayHop bool - - // autorelay functionality - // if true, then the libp2p host will be constructed with autorelay functionality. - EnableAutoRelay bool - // if true, then an AutoNATService will be instantiated to facilitate autorelay - EnableAutoNATService bool - - ConnMgr ConnMgr -} - -// ConnMgr defines configuration options for the libp2p connection manager -type ConnMgr struct { - Type string - LowWater int - HighWater int - GracePeriod string -} diff --git a/vendor/github.com/ipfs/go-ipfs-config/types.go b/vendor/github.com/ipfs/go-ipfs-config/types.go deleted file mode 100644 index 58451c68..00000000 --- a/vendor/github.com/ipfs/go-ipfs-config/types.go +++ /dev/null @@ -1,41 +0,0 @@ -package config - -import ( - "encoding/json" -) - -// Strings is a helper type that (un)marshals a single string to/from a single -// JSON string and a slice of strings to/from a JSON array of strings. -type Strings []string - -// UnmarshalJSON conforms to the json.Unmarshaler interface. -func (o *Strings) UnmarshalJSON(data []byte) error { - if data[0] == '[' { - return json.Unmarshal(data, (*[]string)(o)) - } - var value string - if err := json.Unmarshal(data, &value); err != nil { - return err - } - if len(value) == 0 { - *o = []string{} - } else { - *o = []string{value} - } - return nil -} - -// MarshalJSON conforms to the json.Marshaler interface. -func (o Strings) MarshalJSON() ([]byte, error) { - switch len(o) { - case 0: - return json.Marshal(nil) - case 1: - return json.Marshal(o[0]) - default: - return json.Marshal([]string(o)) - } -} - -var _ json.Unmarshaler = (*Strings)(nil) -var _ json.Marshaler = (*Strings)(nil) diff --git a/vendor/github.com/ipfs/go-ipfs-delay/.travis.yml b/vendor/github.com/ipfs/go-ipfs-delay/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-delay/LICENSE b/vendor/github.com/ipfs/go-ipfs-delay/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-delay/Makefile b/vendor/github.com/ipfs/go-ipfs-delay/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-delay/README.md b/vendor/github.com/ipfs/go-ipfs-delay/README.md deleted file mode 100644 index 0f020b1e..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-ipfs-delay - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-delay?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-delay) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-delay.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-delay) - -> go-ipfs-delay makes it easy to add (threadsafe) configurable delays to other objects. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-delay` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-delay -``` - -## Usage - -``` -import "github.com/ipfs/go-ipfs-delay" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-delay) - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-delay/delay.go b/vendor/github.com/ipfs/go-ipfs-delay/delay.go deleted file mode 100644 index afc08587..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/delay.go +++ /dev/null @@ -1,75 +0,0 @@ -package delay - -import ( - "math/rand" - "sync" - "time" -) - -// D (Delay) makes it easy to add (threadsafe) configurable delays to other -// objects. -type D interface { - Set(time.Duration) time.Duration - Wait() - NextWaitTime() time.Duration - Get() time.Duration -} - -type delay struct { - l sync.RWMutex - t time.Duration - generator Generator -} - -func (d *delay) Set(t time.Duration) time.Duration { - d.l.Lock() - defer d.l.Unlock() - prev := d.t - d.t = t - return prev -} - -func (d *delay) Wait() { - d.l.RLock() - defer d.l.RUnlock() - time.Sleep(d.generator.NextWaitTime(d.t)) -} - -func (d *delay) NextWaitTime() time.Duration { - d.l.Lock() - defer d.l.Unlock() - return d.generator.NextWaitTime(d.t) -} - -func (d *delay) Get() time.Duration { - d.l.Lock() - defer d.l.Unlock() - return d.t -} - -// Delay generates a generic delay form a t, a sleeper, and a generator -func Delay(t time.Duration, generator Generator) D { - return &delay{ - t: t, - generator: generator, - } -} - -// Fixed returns a delay with fixed latency -func Fixed(t time.Duration) D { - return Delay(t, FixedGenerator()) -} - -// VariableUniform is a delay following a uniform distribution -// Notice that to implement the D interface Set can only change the minimum delay -// the delta is set only at initialization -func VariableUniform(t, d time.Duration, rng *rand.Rand) D { - return Delay(t, VariableUniformGenerator(d, rng)) -} - -// VariableNormal is a delay following a normal distribution -// Notice that to implement the D interface Set can only change the mean delay -// the standard deviation is set only at initialization -func VariableNormal(t, std time.Duration, rng *rand.Rand) D { - return Delay(t, VariableNormalGenerator(std, rng)) -} diff --git a/vendor/github.com/ipfs/go-ipfs-delay/generator.go b/vendor/github.com/ipfs/go-ipfs-delay/generator.go deleted file mode 100644 index 122d7c0b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/generator.go +++ /dev/null @@ -1,66 +0,0 @@ -package delay - -import ( - "math/rand" - "time" -) - -// Generator provides an interface for generating wait times -type Generator interface { - NextWaitTime(time.Duration) time.Duration -} - -var sharedRNG = rand.New(rand.NewSource(time.Now().UnixNano())) - -// VariableNormalGenerator makes delays that following a normal distribution -func VariableNormalGenerator(std time.Duration, rng *rand.Rand) Generator { - if rng == nil { - rng = sharedRNG - } - - return &variableNormal{ - std: std, - rng: rng, - } -} - -type variableNormal struct { - std time.Duration - rng *rand.Rand -} - -func (d *variableNormal) NextWaitTime(t time.Duration) time.Duration { - return time.Duration(d.rng.NormFloat64()*float64(d.std)) + t -} - -// VariableUniformGenerator generates delays following a uniform distribution -func VariableUniformGenerator(d time.Duration, rng *rand.Rand) Generator { - if rng == nil { - rng = sharedRNG - } - - return &variableUniform{ - d: d, - rng: rng, - } -} - -type variableUniform struct { - d time.Duration // max delta - rng *rand.Rand -} - -func (d *variableUniform) NextWaitTime(t time.Duration) time.Duration { - return time.Duration(d.rng.Float64()*float64(d.d)) + t -} - -type fixed struct{} - -// FixedGenerator returns a delay with fixed latency -func FixedGenerator() Generator { - return &fixed{} -} - -func (d *fixed) NextWaitTime(t time.Duration) time.Duration { - return t -} diff --git a/vendor/github.com/ipfs/go-ipfs-delay/go.mod b/vendor/github.com/ipfs/go-ipfs-delay/go.mod deleted file mode 100644 index 49cae0fc..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/ipfs/go-ipfs-delay diff --git a/vendor/github.com/ipfs/go-ipfs-delay/package.json b/vendor/github.com/ipfs/go-ipfs-delay/package.json deleted file mode 100644 index 124b8915..00000000 --- a/vendor/github.com/ipfs/go-ipfs-delay/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-delay" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-delay" - }, - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-ipfs-delay", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.0" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/.travis.yml b/vendor/github.com/ipfs/go-ipfs-ds-help/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/LICENSE b/vendor/github.com/ipfs/go-ipfs-ds-help/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/Makefile b/vendor/github.com/ipfs/go-ipfs-ds-help/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/README.md b/vendor/github.com/ipfs/go-ipfs-ds-help/README.md deleted file mode 100644 index 2af3bff4..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# go-ipfs-ds-help - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-ds-help?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-ds-help) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-ds-help.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-ds-help) - -> go-ipfs-ds-help provides utilities for parsing and creating datastore keys used by go-ipfs. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-ds-help` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-ds-help -``` - -## Usage - -``` -import "github.com/ipfs/go-ipfs-ds-help" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-ds-help) - -This module uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/go.mod b/vendor/github.com/ipfs/go-ipfs-ds-help/go.mod deleted file mode 100644 index ada36b21..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-ipfs-ds-help - -require ( - github.com/ipfs/go-cid v0.0.1 - github.com/ipfs/go-datastore v0.0.1 - github.com/multiformats/go-base32 v0.0.3 -) diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/go.sum b/vendor/github.com/ipfs/go-ipfs-ds-help/go.sum deleted file mode 100644 index 6de64438..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/go.sum +++ /dev/null @@ -1,38 +0,0 @@ -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -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= diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/key.go b/vendor/github.com/ipfs/go-ipfs-ds-help/key.go deleted file mode 100644 index 1f47023f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/key.go +++ /dev/null @@ -1,36 +0,0 @@ -// Package dshelp provides utilities for parsing and creating -// datastore keys used by go-ipfs -package dshelp - -import ( - cid "github.com/ipfs/go-cid" - "github.com/ipfs/go-datastore" - "github.com/multiformats/go-base32" -) - -// NewKeyFromBinary creates a new key from a byte slice. -func NewKeyFromBinary(rawKey []byte) datastore.Key { - buf := make([]byte, 1+base32.RawStdEncoding.EncodedLen(len(rawKey))) - buf[0] = '/' - base32.RawStdEncoding.Encode(buf[1:], rawKey) - return datastore.RawKey(string(buf)) -} - -// BinaryFromDsKey returns the byte slice corresponding to the given Key. -func BinaryFromDsKey(k datastore.Key) ([]byte, error) { - return base32.RawStdEncoding.DecodeString(k.String()[1:]) -} - -// CidToDsKey creates a Key from the given Cid. -func CidToDsKey(k cid.Cid) datastore.Key { - return NewKeyFromBinary(k.Bytes()) -} - -// DsKeyToCid converts the given Key to its corresponding Cid. -func DsKeyToCid(dsKey datastore.Key) (cid.Cid, error) { - kb, err := BinaryFromDsKey(dsKey) - if err != nil { - return cid.Cid{}, err - } - return cid.Cast(kb) -} diff --git a/vendor/github.com/ipfs/go-ipfs-ds-help/package.json b/vendor/github.com/ipfs/go-ipfs-ds-help/package.json deleted file mode 100644 index 830616eb..00000000 --- a/vendor/github.com/ipfs/go-ipfs-ds-help/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-ds-help" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-ds-help" - }, - "gxDependencies": [ - { - "author": "jbenet", - "hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9", - "name": "go-datastore", - "version": "3.6.1" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "Golang", - "hash": "QmPbbYin7KBd1Y1BfUe15vHzwJiioyi3wtKQTtXWWf8SC5", - "name": "base32", - "version": "0.0.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-ipfs-ds-help", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.7" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/.travis.yml b/vendor/github.com/ipfs/go-ipfs-exchange-interface/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/LICENSE b/vendor/github.com/ipfs/go-ipfs-exchange-interface/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/Makefile b/vendor/github.com/ipfs/go-ipfs-exchange-interface/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/README.md b/vendor/github.com/ipfs/go-ipfs-exchange-interface/README.md deleted file mode 100644 index 8dbcfe1c..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-ipfs-exchange-interface - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-exchange-interface?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-exchange-interface) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-exchange-interface.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-exchange-interface) - -> go-ipfs-exchange-interface defines the IPFS exchange interface - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-exchange-interface` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-exchange-interface -``` - -## Usage - -``` -import "github.com/ipfs/go-ipfs-exchange-interface" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-exchange-interface) - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.mod b/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.mod deleted file mode 100644 index fade39b9..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-ipfs-exchange-interface - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.sum b/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.sum deleted file mode 100644 index aa764c6a..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/go.sum +++ /dev/null @@ -1,26 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/interface.go b/vendor/github.com/ipfs/go-ipfs-exchange-interface/interface.go deleted file mode 100644 index c3032b23..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/interface.go +++ /dev/null @@ -1,37 +0,0 @@ -// Package exchange defines the IPFS exchange interface -package exchange - -import ( - "context" - "io" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" -) - -// Interface defines the functionality of the IPFS block exchange protocol. -type Interface interface { // type Exchanger interface - Fetcher - - // TODO Should callers be concerned with whether the block was made - // available on the network? - HasBlock(blocks.Block) error - - IsOnline() bool - - io.Closer -} - -// Fetcher is an object that can be used to retrieve blocks -type Fetcher interface { - // GetBlock returns the block associated with a given key. - GetBlock(context.Context, cid.Cid) (blocks.Block, error) - GetBlocks(context.Context, []cid.Cid) (<-chan blocks.Block, error) -} - -// SessionExchange is an exchange.Interface which supports -// sessions. -type SessionExchange interface { - Interface - NewSession(context.Context) Fetcher -} diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-interface/package.json b/vendor/github.com/ipfs/go-ipfs-exchange-interface/package.json deleted file mode 100644 index c5f83220..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-interface/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-exchange-interface" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-exchange-interface" - }, - "gxDependencies": [ - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-exchange-interface", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.3" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/.travis.yml b/vendor/github.com/ipfs/go-ipfs-exchange-offline/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/LICENSE b/vendor/github.com/ipfs/go-ipfs-exchange-offline/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/Makefile b/vendor/github.com/ipfs/go-ipfs-exchange-offline/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/README.md b/vendor/github.com/ipfs/go-ipfs-exchange-offline/README.md deleted file mode 100644 index 707099e9..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# go-ipfs-exchange-offline - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-exchange-offline?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-exchange-offline) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-exchange-offline.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-exchange-offline) - -> go-ipfs-exchange-offline implements the go-ipfs-exchange-interface - -This is an offline exchange implementation which will not perform any request. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-exchange-offline` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-exchange-offline -``` - -It uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. - -## Usage - -``` -import "github.com/ipfs/go-ipfs-exchange-offline" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-exchange-offline) - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.mod b/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.mod deleted file mode 100644 index 5852ebda..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/ipfs/go-ipfs-exchange-offline - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.1 - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-ipfs-blockstore v0.0.1 - github.com/ipfs/go-ipfs-blocksutil v0.0.1 - github.com/ipfs/go-ipfs-exchange-interface v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.sum b/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.sum deleted file mode 100644 index b52cb59a..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/go.sum +++ /dev/null @@ -1,82 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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= diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/offline.go b/vendor/github.com/ipfs/go-ipfs-exchange-offline/offline.go deleted file mode 100644 index cb82b8a0..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/offline.go +++ /dev/null @@ -1,73 +0,0 @@ -// package offline implements an object that implements the exchange -// interface but returns nil values to every request. -package offline - -import ( - "context" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - exchange "github.com/ipfs/go-ipfs-exchange-interface" -) - -func Exchange(bs blockstore.Blockstore) exchange.Interface { - return &offlineExchange{bs: bs} -} - -// offlineExchange implements the Exchange interface but doesn't return blocks. -// For use in offline mode. -type offlineExchange struct { - bs blockstore.Blockstore -} - -// GetBlock returns nil to signal that a block could not be retrieved for the -// given key. -// NB: This function may return before the timeout expires. -func (e *offlineExchange) GetBlock(_ context.Context, k cid.Cid) (blocks.Block, error) { - return e.bs.Get(k) -} - -// HasBlock always returns nil. -func (e *offlineExchange) HasBlock(b blocks.Block) error { - return e.bs.Put(b) -} - -// Close always returns nil. -func (_ *offlineExchange) Close() error { - // NB: exchange doesn't own the blockstore's underlying datastore, so it is - // not responsible for closing it. - return nil -} - -func (e *offlineExchange) GetBlocks(ctx context.Context, ks []cid.Cid) (<-chan blocks.Block, error) { - out := make(chan blocks.Block) - go func() { - defer close(out) - var misses []cid.Cid - for _, k := range ks { - hit, err := e.bs.Get(k) - if err != nil { - misses = append(misses, k) - // a long line of misses should abort when context is cancelled. - select { - // TODO case send misses down channel - case <-ctx.Done(): - return - default: - continue - } - } - select { - case out <- hit: - case <-ctx.Done(): - return - } - } - }() - return out, nil -} - -func (e *offlineExchange) IsOnline() bool { - return false -} diff --git a/vendor/github.com/ipfs/go-ipfs-exchange-offline/package.json b/vendor/github.com/ipfs/go-ipfs-exchange-offline/package.json deleted file mode 100644 index e356dd9f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-exchange-offline/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-exchange-offline" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-exchange-offline" - }, - "gxDependencies": [ - { - "author": "hsanjuan", - "hash": "QmXjKkjMDTtXAiLBwstVexofB8LeruZmE2eBd85GwGFFLA", - "name": "go-ipfs-blockstore", - "version": "0.1.8" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "hsanjuan", - "hash": "QmWokDcQdSZCxrNxgaRzQDDBofALhActzNBaxRLtiRkUHg", - "name": "go-ipfs-exchange-interface", - "version": "0.1.3" - }, - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "hsanjuan", - "hash": "QmcbQ44AgbtV1rnxZz5RsRVduxdgNYLANxnsuW5wvvu4ts", - "name": "go-ipfs-blocksutil", - "version": "0.1.2" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-exchange-offline", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.7" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-files/.travis.yml b/vendor/github.com/ipfs/go-ipfs-files/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-files/LICENSE b/vendor/github.com/ipfs/go-ipfs-files/LICENSE deleted file mode 100644 index 6cccfc2b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-files/README.md b/vendor/github.com/ipfs/go-ipfs-files/README.md deleted file mode 100644 index 4f704695..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# go-ipfs-files - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) - -> File interfaces and utils used in IPFS - -## Documentation - -https://godoc.org/github.com/ipfs/go-ipfs-files - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-ipfs-files/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - diff --git a/vendor/github.com/ipfs/go-ipfs-files/file.go b/vendor/github.com/ipfs/go-ipfs-files/file.go deleted file mode 100644 index 4d7ef113..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/file.go +++ /dev/null @@ -1,94 +0,0 @@ -package files - -import ( - "errors" - "io" - "os" -) - -var ( - ErrNotDirectory = errors.New("file isn't a directory") - ErrNotReader = errors.New("file isn't a regular file") - - ErrNotSupported = errors.New("operation not supported") -) - -// Node is a common interface for files, directories and other special files -type Node interface { - io.Closer - - // Size returns size of this file (if this file is a directory, total size of - // all files stored in the tree should be returned). Some implementations may - // choose not to implement this - Size() (int64, error) -} - -// Node represents a regular Unix file -type File interface { - Node - - io.Reader - io.Seeker -} - -// DirEntry exposes information about a directory entry -type DirEntry interface { - // Name returns base name of this entry, which is the base name of referenced - // file - Name() string - - // Node returns the file referenced by this DirEntry - Node() Node -} - -// DirIterator is a iterator over directory entries. -// See Directory.Entries for more -type DirIterator interface { - // DirEntry holds information about current directory entry. - // Note that after creating new iterator you MUST call Next() at least once - // before accessing these methods. Calling these methods without prior calls - // to Next() and after Next() returned false may result in undefined behavior - DirEntry - - // Next advances iterator to the next file. - Next() bool - - // Err may return an error after previous call to Next() returned `false`. - // If previous call to Next() returned `true`, Err() is guaranteed to - // return nil - Err() error -} - -// Directory is a special file which can link to any number of files. -type Directory interface { - Node - - // Entries returns a stateful iterator over directory entries. - // - // Example usage: - // - // it := dir.Entries() - // for it.Next() { - // name := it.Name() - // file := it.Node() - // [...] - // } - // if it.Err() != nil { - // return err - // } - // - // Note that you can't store the result of it.Node() and use it after - // advancing the iterator - Entries() DirIterator -} - -// FileInfo exposes information on files in local filesystem -type FileInfo interface { - Node - - // AbsPath returns full real file path. - AbsPath() string - - // Stat returns os.Stat of this file, may be nil for some files - Stat() os.FileInfo -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/go.mod b/vendor/github.com/ipfs/go-ipfs-files/go.mod deleted file mode 100644 index 1e70e551..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/ipfs/go-ipfs-files - -require golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 diff --git a/vendor/github.com/ipfs/go-ipfs-files/go.sum b/vendor/github.com/ipfs/go-ipfs-files/go.sum deleted file mode 100644 index 55a8c3a9..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipfs-files/is_hidden.go b/vendor/github.com/ipfs/go-ipfs-files/is_hidden.go deleted file mode 100644 index 4ebca600..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/is_hidden.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build !windows - -package files - -import ( - "path/filepath" - "strings" -) - -func IsHidden(name string, f Node) bool { - fName := filepath.Base(name) - - if strings.HasPrefix(fName, ".") && len(fName) > 1 { - return true - } - - return false -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/is_hidden_windows.go b/vendor/github.com/ipfs/go-ipfs-files/is_hidden_windows.go deleted file mode 100644 index 7419f932..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/is_hidden_windows.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build windows - -package files - -import ( - "path/filepath" - "strings" - - windows "golang.org/x/sys/windows" -) - -func IsHidden(name string, f Node) bool { - - fName := filepath.Base(name) - - if strings.HasPrefix(fName, ".") && len(fName) > 1 { - return true - } - - fi, ok := f.(FileInfo) - if !ok { - return false - } - - p, e := windows.UTF16PtrFromString(fi.AbsPath()) - if e != nil { - return false - } - - attrs, e := windows.GetFileAttributes(p) - if e != nil { - return false - } - return attrs&windows.FILE_ATTRIBUTE_HIDDEN != 0 -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/linkfile.go b/vendor/github.com/ipfs/go-ipfs-files/linkfile.go deleted file mode 100644 index 409309bc..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/linkfile.go +++ /dev/null @@ -1,53 +0,0 @@ -package files - -import ( - "io" - "os" - "strings" -) - -type Symlink struct { - Target string - stat os.FileInfo - - reader io.Reader -} - -func NewLinkFile(target string, stat os.FileInfo) File { - return &Symlink{ - Target: target, - stat: stat, - reader: strings.NewReader(target), - } -} - -func (lf *Symlink) Close() error { - if c, ok := lf.reader.(io.Closer); ok { - return c.Close() - } - - return nil -} - -func (lf *Symlink) Read(b []byte) (int, error) { - return lf.reader.Read(b) -} - -func (lf *Symlink) Seek(offset int64, whence int) (int64, error) { - if s, ok := lf.reader.(io.Seeker); ok { - return s.Seek(offset, whence) - } - - return 0, ErrNotSupported -} - -func (lf *Symlink) Size() (int64, error) { - return 0, ErrNotSupported -} - -func ToSymlink(n Node) *Symlink { - l, _ := n.(*Symlink) - return l -} - -var _ File = &Symlink{} diff --git a/vendor/github.com/ipfs/go-ipfs-files/multifilereader.go b/vendor/github.com/ipfs/go-ipfs-files/multifilereader.go deleted file mode 100644 index 86867f68..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/multifilereader.go +++ /dev/null @@ -1,152 +0,0 @@ -package files - -import ( - "bytes" - "fmt" - "io" - "mime/multipart" - "net/textproto" - "net/url" - "path" - "sync" -) - -// MultiFileReader reads from a `commands.Node` (which can be a directory of files -// or a regular file) as HTTP multipart encoded data. -type MultiFileReader struct { - io.Reader - - // directory stack for NextFile - files []DirIterator - path []string - - currentFile Node - buf bytes.Buffer - mpWriter *multipart.Writer - closed bool - mutex *sync.Mutex - - // if true, the data will be type 'multipart/form-data' - // if false, the data will be type 'multipart/mixed' - form bool -} - -// NewMultiFileReader constructs a MultiFileReader. `file` can be any `commands.Directory`. -// If `form` is set to true, the multipart data will have a Content-Type of 'multipart/form-data', -// if `form` is false, the Content-Type will be 'multipart/mixed'. -func NewMultiFileReader(file Directory, form bool) *MultiFileReader { - it := file.Entries() - - mfr := &MultiFileReader{ - files: []DirIterator{it}, - path: []string{""}, - form: form, - mutex: &sync.Mutex{}, - } - mfr.mpWriter = multipart.NewWriter(&mfr.buf) - - return mfr -} - -func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) { - mfr.mutex.Lock() - defer mfr.mutex.Unlock() - - // if we are closed and the buffer is flushed, end reading - if mfr.closed && mfr.buf.Len() == 0 { - return 0, io.EOF - } - - // if the current file isn't set, advance to the next file - if mfr.currentFile == nil { - var entry DirEntry - - for entry == nil { - if len(mfr.files) == 0 { - mfr.mpWriter.Close() - mfr.closed = true - return mfr.buf.Read(buf) - } - - if !mfr.files[len(mfr.files)-1].Next() { - if mfr.files[len(mfr.files)-1].Err() != nil { - return 0, mfr.files[len(mfr.files)-1].Err() - } - mfr.files = mfr.files[:len(mfr.files)-1] - mfr.path = mfr.path[:len(mfr.path)-1] - continue - } - - entry = mfr.files[len(mfr.files)-1] - } - - // handle starting a new file part - if !mfr.closed { - - mfr.currentFile = entry.Node() - - // write the boundary and headers - header := make(textproto.MIMEHeader) - filename := url.QueryEscape(path.Join(path.Join(mfr.path...), entry.Name())) - dispositionPrefix := "attachment" - if mfr.form { - dispositionPrefix = "form-data; name=\"file\"" - } - - header.Set("Content-Disposition", fmt.Sprintf("%s; filename=\"%s\"", dispositionPrefix, filename)) - - var contentType string - - switch f := entry.Node().(type) { - case *Symlink: - contentType = "application/symlink" - case Directory: - newIt := f.Entries() - mfr.files = append(mfr.files, newIt) - mfr.path = append(mfr.path, entry.Name()) - contentType = "application/x-directory" - case File: - // otherwise, use the file as a reader to read its contents - contentType = "application/octet-stream" - default: - return 0, ErrNotSupported - } - - header.Set("Content-Type", contentType) - if rf, ok := entry.Node().(FileInfo); ok { - header.Set("abspath", rf.AbsPath()) - } - - _, err := mfr.mpWriter.CreatePart(header) - if err != nil { - return 0, err - } - } - } - - // if the buffer has something in it, read from it - if mfr.buf.Len() > 0 { - return mfr.buf.Read(buf) - } - - // otherwise, read from file data - switch f := mfr.currentFile.(type) { - case File: - written, err = f.Read(buf) - if err != io.EOF { - return written, err - } - } - - if err := mfr.currentFile.Close(); err != nil { - return written, err - } - - mfr.currentFile = nil - return written, nil -} - -// Boundary returns the boundary string to be used to separate files in the multipart data -func (mfr *MultiFileReader) Boundary() string { - return mfr.mpWriter.Boundary() -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/multipartfile.go b/vendor/github.com/ipfs/go-ipfs-files/multipartfile.go deleted file mode 100644 index d4593ad6..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/multipartfile.go +++ /dev/null @@ -1,228 +0,0 @@ -package files - -import ( - "io" - "io/ioutil" - "mime" - "mime/multipart" - "net/url" - "path" - "strings" -) - -const ( - multipartFormdataType = "multipart/form-data" - multipartMixedType = "multipart/mixed" - - applicationDirectory = "application/x-directory" - applicationSymlink = "application/symlink" - applicationFile = "application/octet-stream" - - contentTypeHeader = "Content-Type" -) - -type multipartDirectory struct { - path string - walker *multipartWalker - - // part is the part describing the directory. It's nil when implicit. - part *multipart.Part -} - -type multipartWalker struct { - part *multipart.Part - reader *multipart.Reader -} - -func (m *multipartWalker) consumePart() { - m.part = nil -} - -func (m *multipartWalker) getPart() (*multipart.Part, error) { - if m.part != nil { - return m.part, nil - } - if m.reader == nil { - return nil, io.EOF - } - - var err error - m.part, err = m.reader.NextPart() - if err == io.EOF { - m.reader = nil - } - return m.part, err -} - -// NewFileFromPartReader creates a Directory from a multipart reader. -func NewFileFromPartReader(reader *multipart.Reader, mediatype string) (Directory, error) { - switch mediatype { - case applicationDirectory, multipartFormdataType: - default: - return nil, ErrNotDirectory - } - - return &multipartDirectory{ - path: "/", - walker: &multipartWalker{ - reader: reader, - }, - }, nil -} - -func (w *multipartWalker) nextFile() (Node, error) { - part, err := w.getPart() - if err != nil { - return nil, err - } - w.consumePart() - - contentType := part.Header.Get(contentTypeHeader) - if contentType != "" { - var err error - contentType, _, err = mime.ParseMediaType(contentType) - if err != nil { - return nil, err - } - } - - switch contentType { - case multipartFormdataType, applicationDirectory: - return &multipartDirectory{ - part: part, - path: fileName(part), - walker: w, - }, nil - case applicationSymlink: - out, err := ioutil.ReadAll(part) - if err != nil { - return nil, err - } - - return NewLinkFile(string(out), nil), nil - default: - return &ReaderFile{ - reader: part, - abspath: part.Header.Get("abspath"), - }, nil - } -} - -// fileName returns a normalized filename from a part. -func fileName(part *multipart.Part) string { - filename := part.FileName() - if escaped, err := url.QueryUnescape(filename); err == nil { - filename = escaped - } // if there is a unescape error, just treat the name as unescaped - - return path.Clean("/" + filename) -} - -// dirName appends a slash to the end of the filename, if not present. -// expects a _cleaned_ path. -func dirName(filename string) string { - if !strings.HasSuffix(filename, "/") { - filename += "/" - } - return filename -} - -// isChild checks if child is a child of parent directory. -// expects a _cleaned_ path. -func isChild(child, parent string) bool { - return strings.HasPrefix(child, dirName(parent)) -} - -// makeRelative makes the child path relative to the parent path. -// expects a _cleaned_ path. -func makeRelative(child, parent string) string { - return strings.TrimPrefix(child, dirName(parent)) -} - -type multipartIterator struct { - f *multipartDirectory - - curFile Node - curName string - err error -} - -func (it *multipartIterator) Name() string { - return it.curName -} - -func (it *multipartIterator) Node() Node { - return it.curFile -} - -func (it *multipartIterator) Next() bool { - if it.f.walker.reader == nil || it.err != nil { - return false - } - var part *multipart.Part - for { - part, it.err = it.f.walker.getPart() - if it.err != nil { - return false - } - - name := fileName(part) - - // Is the file in a different directory? - if !isChild(name, it.f.path) { - return false - } - - // Have we already entered this directory? - if it.curName != "" && isChild(name, path.Join(it.f.path, it.curName)) { - it.f.walker.consumePart() - continue - } - - // Make the path relative to the current directory. - name = makeRelative(name, it.f.path) - - // Check if we need to create a fake directory (more than one - // path component). - if idx := strings.IndexByte(name, '/'); idx >= 0 { - it.curName = name[:idx] - it.curFile = &multipartDirectory{ - path: path.Join(it.f.path, it.curName), - walker: it.f.walker, - } - return true - } - it.curName = name - - // Finally, advance to the next file. - it.curFile, it.err = it.f.walker.nextFile() - - return it.err == nil - } -} - -func (it *multipartIterator) Err() error { - // We use EOF to signal that this iterator is done. That way, we don't - // need to check every time `Next` is called. - if it.err == io.EOF { - return nil - } - return it.err -} - -func (f *multipartDirectory) Entries() DirIterator { - return &multipartIterator{f: f} -} - -func (f *multipartDirectory) Close() error { - if f.part != nil { - return f.part.Close() - } - return nil -} - -func (f *multipartDirectory) Size() (int64, error) { - return 0, ErrNotSupported -} - -var _ Directory = &multipartDirectory{} diff --git a/vendor/github.com/ipfs/go-ipfs-files/package.json b/vendor/github.com/ipfs/go-ipfs-files/package.json deleted file mode 100644 index 967f2e79..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "author": "magik6k", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-files" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-files" - }, - "gxDependencies": [ - { - "author": "The Go Authors", - "hash": "QmVGjyM9i2msKvLXwh9VosCTgP4mL91kC7hDmqnwTTx6Hu", - "name": "sys", - "version": "0.2.0" - } - ], - "gxVersion": "0.11.0", - "language": "go", - "license": "", - "name": "go-ipfs-files", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "2.0.7" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-files/readerfile.go b/vendor/github.com/ipfs/go-ipfs-files/readerfile.go deleted file mode 100644 index f98fec48..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/readerfile.go +++ /dev/null @@ -1,82 +0,0 @@ -package files - -import ( - "bytes" - "io" - "io/ioutil" - "os" - "path/filepath" -) - -// ReaderFile is a implementation of File created from an `io.Reader`. -// ReaderFiles are never directories, and can be read from and closed. -type ReaderFile struct { - abspath string - reader io.ReadCloser - stat os.FileInfo - - fsize int64 -} - -func NewBytesFile(b []byte) File { - return &ReaderFile{"", NewReaderFile(bytes.NewReader(b)), nil, int64(len(b))} -} - -func NewReaderFile(reader io.Reader) File { - return NewReaderStatFile(reader, nil) -} - -func NewReaderStatFile(reader io.Reader, stat os.FileInfo) File { - rc, ok := reader.(io.ReadCloser) - if !ok { - rc = ioutil.NopCloser(reader) - } - - return &ReaderFile{"", rc, stat, -1} -} - -func NewReaderPathFile(path string, reader io.ReadCloser, stat os.FileInfo) (*ReaderFile, error) { - abspath, err := filepath.Abs(path) - if err != nil { - return nil, err - } - - return &ReaderFile{abspath, reader, stat, -1}, nil -} - -func (f *ReaderFile) AbsPath() string { - return f.abspath -} - -func (f *ReaderFile) Read(p []byte) (int, error) { - return f.reader.Read(p) -} - -func (f *ReaderFile) Close() error { - return f.reader.Close() -} - -func (f *ReaderFile) Stat() os.FileInfo { - return f.stat -} - -func (f *ReaderFile) Size() (int64, error) { - if f.stat == nil { - if f.fsize >= 0 { - return f.fsize, nil - } - return 0, ErrNotSupported - } - return f.stat.Size(), nil -} - -func (f *ReaderFile) Seek(offset int64, whence int) (int64, error) { - if s, ok := f.reader.(io.Seeker); ok { - return s.Seek(offset, whence) - } - - return 0, ErrNotSupported -} - -var _ File = &ReaderFile{} -var _ FileInfo = &ReaderFile{} diff --git a/vendor/github.com/ipfs/go-ipfs-files/serialfile.go b/vendor/github.com/ipfs/go-ipfs-files/serialfile.go deleted file mode 100644 index e29752d6..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/serialfile.go +++ /dev/null @@ -1,178 +0,0 @@ -package files - -import ( - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" -) - -// serialFile implements Node, and reads from a path on the OS filesystem. -// No more than one file will be opened at a time (directories will advance -// to the next file when NextFile() is called). -type serialFile struct { - path string - files []os.FileInfo - stat os.FileInfo - handleHiddenFiles bool -} - -type serialIterator struct { - files []os.FileInfo - handleHiddenFiles bool - path string - - curName string - curFile Node - - err error -} - -// TODO: test/document limitations -func NewSerialFile(path string, hidden bool, stat os.FileInfo) (Node, error) { - switch mode := stat.Mode(); { - case mode.IsRegular(): - file, err := os.Open(path) - if err != nil { - return nil, err - } - return NewReaderPathFile(path, file, stat) - case mode.IsDir(): - // for directories, stat all of the contents first, so we know what files to - // open when NextFile() is called - contents, err := ioutil.ReadDir(path) - if err != nil { - return nil, err - } - return &serialFile{path, contents, stat, hidden}, nil - case mode&os.ModeSymlink != 0: - target, err := os.Readlink(path) - if err != nil { - return nil, err - } - return NewLinkFile(target, stat), nil - default: - return nil, fmt.Errorf("unrecognized file type for %s: %s", path, mode.String()) - } -} - -func (it *serialIterator) Name() string { - return it.curName -} - -func (it *serialIterator) Node() Node { - return it.curFile -} - -func (it *serialIterator) Next() bool { - // if there aren't any files left in the root directory, we're done - if len(it.files) == 0 { - return false - } - - stat := it.files[0] - it.files = it.files[1:] - for !it.handleHiddenFiles && strings.HasPrefix(stat.Name(), ".") { - if len(it.files) == 0 { - return false - } - - stat = it.files[0] - it.files = it.files[1:] - } - - // open the next file - filePath := filepath.ToSlash(filepath.Join(it.path, stat.Name())) - - // recursively call the constructor on the next file - // if it's a regular file, we will open it as a ReaderFile - // if it's a directory, files in it will be opened serially - sf, err := NewSerialFile(filePath, it.handleHiddenFiles, stat) - if err != nil { - it.err = err - return false - } - - it.curName = stat.Name() - it.curFile = sf - return true -} - -func (it *serialIterator) Err() error { - return it.err -} - -func (f *serialFile) Entries() DirIterator { - return &serialIterator{ - path: f.path, - files: f.files, - handleHiddenFiles: f.handleHiddenFiles, - } -} - -func (f *serialFile) NextFile() (string, Node, error) { - // if there aren't any files left in the root directory, we're done - if len(f.files) == 0 { - return "", nil, io.EOF - } - - stat := f.files[0] - f.files = f.files[1:] - - for !f.handleHiddenFiles && strings.HasPrefix(stat.Name(), ".") { - if len(f.files) == 0 { - return "", nil, io.EOF - } - - stat = f.files[0] - f.files = f.files[1:] - } - - // open the next file - filePath := filepath.ToSlash(filepath.Join(f.path, stat.Name())) - - // recursively call the constructor on the next file - // if it's a regular file, we will open it as a ReaderFile - // if it's a directory, files in it will be opened serially - sf, err := NewSerialFile(filePath, f.handleHiddenFiles, stat) - if err != nil { - return "", nil, err - } - - return stat.Name(), sf, nil -} - -func (f *serialFile) Close() error { - return nil -} - -func (f *serialFile) Stat() os.FileInfo { - return f.stat -} - -func (f *serialFile) Size() (int64, error) { - if !f.stat.IsDir() { - //something went terribly, terribly wrong - return 0, errors.New("serialFile is not a directory") - } - - var du int64 - err := filepath.Walk(f.path, func(p string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - - if fi != nil && fi.Mode().IsRegular() { - du += fi.Size() - } - return nil - }) - - return du, err -} - -var _ Directory = &serialFile{} -var _ DirIterator = &serialIterator{} diff --git a/vendor/github.com/ipfs/go-ipfs-files/slicedirectory.go b/vendor/github.com/ipfs/go-ipfs-files/slicedirectory.go deleted file mode 100644 index d1165626..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/slicedirectory.go +++ /dev/null @@ -1,97 +0,0 @@ -package files - -import "sort" - -type fileEntry struct { - name string - file Node -} - -func (e fileEntry) Name() string { - return e.name -} - -func (e fileEntry) Node() Node { - return e.file -} - -func FileEntry(name string, file Node) DirEntry { - return fileEntry{ - name: name, - file: file, - } -} - -type sliceIterator struct { - files []DirEntry - n int -} - -func (it *sliceIterator) Name() string { - return it.files[it.n].Name() -} - -func (it *sliceIterator) Node() Node { - return it.files[it.n].Node() -} - -func (it *sliceIterator) Next() bool { - it.n++ - return it.n < len(it.files) -} - -func (it *sliceIterator) Err() error { - return nil -} - -// SliceFile implements Node, and provides simple directory handling. -// It contains children files, and is created from a `[]Node`. -// SliceFiles are always directories, and can't be read from or closed. -type SliceFile struct { - files []DirEntry -} - -func NewMapDirectory(f map[string]Node) Directory { - ents := make([]DirEntry, 0, len(f)) - for name, nd := range f { - ents = append(ents, FileEntry(name, nd)) - } - sort.Slice(ents, func(i, j int) bool { - return ents[i].Name() < ents[j].Name() - }) - - return NewSliceDirectory(ents) -} - -func NewSliceDirectory(files []DirEntry) Directory { - return &SliceFile{files} -} - -func (f *SliceFile) Entries() DirIterator { - return &sliceIterator{files: f.files, n: -1} -} - -func (f *SliceFile) Close() error { - return nil -} - -func (f *SliceFile) Length() int { - return len(f.files) -} - -func (f *SliceFile) Size() (int64, error) { - var size int64 - - for _, file := range f.files { - s, err := file.Node().Size() - if err != nil { - return 0, err - } - size += s - } - - return size, nil -} - -var _ Directory = &SliceFile{} -var _ DirEntry = fileEntry{} diff --git a/vendor/github.com/ipfs/go-ipfs-files/tarwriter.go b/vendor/github.com/ipfs/go-ipfs-files/tarwriter.go deleted file mode 100644 index 6d062726..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/tarwriter.go +++ /dev/null @@ -1,100 +0,0 @@ -package files - -import ( - "archive/tar" - "fmt" - "io" - "path" - "time" -) - -type TarWriter struct { - TarW *tar.Writer -} - -// NewTarWriter wraps given io.Writer into a new tar writer -func NewTarWriter(w io.Writer) (*TarWriter, error) { - return &TarWriter{ - TarW: tar.NewWriter(w), - }, nil -} - -func (w *TarWriter) writeDir(f Directory, fpath string) error { - if err := writeDirHeader(w.TarW, fpath); err != nil { - return err - } - - it := f.Entries() - for it.Next() { - if err := w.WriteFile(it.Node(), path.Join(fpath, it.Name())); err != nil { - return err - } - } - return it.Err() -} - -func (w *TarWriter) writeFile(f File, fpath string) error { - size, err := f.Size() - if err != nil { - return err - } - - if err := writeFileHeader(w.TarW, fpath, uint64(size)); err != nil { - return err - } - - if _, err := io.Copy(w.TarW, f); err != nil { - return err - } - w.TarW.Flush() - return nil -} - -// WriteNode adds a node to the archive. -func (w *TarWriter) WriteFile(nd Node, fpath string) error { - switch nd := nd.(type) { - case *Symlink: - return writeSymlinkHeader(w.TarW, nd.Target, fpath) - case File: - return w.writeFile(nd, fpath) - case Directory: - return w.writeDir(nd, fpath) - default: - return fmt.Errorf("file type %T is not supported", nd) - } -} - -// Close closes the tar writer. -func (w *TarWriter) Close() error { - return w.TarW.Close() -} - -func writeDirHeader(w *tar.Writer, fpath string) error { - return w.WriteHeader(&tar.Header{ - Name: fpath, - Typeflag: tar.TypeDir, - Mode: 0777, - ModTime: time.Now(), - // TODO: set mode, dates, etc. when added to unixFS - }) -} - -func writeFileHeader(w *tar.Writer, fpath string, size uint64) error { - return w.WriteHeader(&tar.Header{ - Name: fpath, - Size: int64(size), - Typeflag: tar.TypeReg, - Mode: 0644, - ModTime: time.Now(), - // TODO: set mode, dates, etc. when added to unixFS - }) -} - -func writeSymlinkHeader(w *tar.Writer, target, fpath string) error { - return w.WriteHeader(&tar.Header{ - Name: fpath, - Linkname: target, - Mode: 0777, - Typeflag: tar.TypeSymlink, - }) -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/util.go b/vendor/github.com/ipfs/go-ipfs-files/util.go deleted file mode 100644 index e727e7ae..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/util.go +++ /dev/null @@ -1,25 +0,0 @@ -package files - -// ToFile is an alias for n.(File). If the file isn't a regular file, nil value -// will be returned -func ToFile(n Node) File { - f, _ := n.(File) - return f -} - -// ToDir is an alias for n.(Directory). If the file isn't directory, a nil value -// will be returned -func ToDir(n Node) Directory { - d, _ := n.(Directory) - return d -} - -// FileFromEntry calls ToFile on Node in the given entry -func FileFromEntry(e DirEntry) File { - return ToFile(e.Node()) -} - -// DirFromEntry calls ToDir on Node in the given entry -func DirFromEntry(e DirEntry) Directory { - return ToDir(e.Node()) -} diff --git a/vendor/github.com/ipfs/go-ipfs-files/webfile.go b/vendor/github.com/ipfs/go-ipfs-files/webfile.go deleted file mode 100644 index 594b81c8..00000000 --- a/vendor/github.com/ipfs/go-ipfs-files/webfile.go +++ /dev/null @@ -1,89 +0,0 @@ -package files - -import ( - "errors" - "fmt" - "io" - "net/http" - "net/url" - "os" -) - -// WebFile is an implementation of File which reads it -// from a Web URL (http). A GET request will be performed -// against the source when calling Read(). -type WebFile struct { - body io.ReadCloser - url *url.URL - contentLength int64 -} - -// NewWebFile creates a WebFile with the given URL, which -// will be used to perform the GET request on Read(). -func NewWebFile(url *url.URL) *WebFile { - return &WebFile{ - url: url, - } -} - -func (wf *WebFile) start() error { - if wf.body == nil { - s := wf.url.String() - resp, err := http.Get(s) - if err != nil { - return err - } - if resp.StatusCode < 200 || resp.StatusCode > 299 { - return fmt.Errorf("got non-2XX status code %d: %s", resp.StatusCode, s) - } - wf.body = resp.Body - wf.contentLength = resp.ContentLength - } - return nil -} - -// Read reads the File from it's web location. On the first -// call to Read, a GET request will be performed against the -// WebFile's URL, using Go's default HTTP client. Any further -// reads will keep reading from the HTTP Request body. -func (wf *WebFile) Read(b []byte) (int, error) { - if err := wf.start(); err != nil { - return 0, err - } - return wf.body.Read(b) -} - -// Close closes the WebFile (or the request body). -func (wf *WebFile) Close() error { - if wf.body == nil { - return nil - } - return wf.body.Close() -} - -// TODO: implement -func (wf *WebFile) Seek(offset int64, whence int) (int64, error) { - return 0, ErrNotSupported -} - -func (wf *WebFile) Size() (int64, error) { - if err := wf.start(); err != nil { - return 0, err - } - if wf.contentLength < 0 { - return -1, errors.New("Content-Length hearer was not set") - } - - return wf.contentLength, nil -} - -func (wf *WebFile) AbsPath() string { - return wf.url.String() -} - -func (wf *WebFile) Stat() os.FileInfo { - return nil -} - -var _ File = &WebFile{} -var _ FileInfo = &WebFile{} diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/.gitignore b/vendor/github.com/ipfs/go-ipfs-posinfo/.gitignore deleted file mode 100644 index a1338d68..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 -.glide/ diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/.travis.yml b/vendor/github.com/ipfs/go-ipfs-posinfo/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/LICENSE b/vendor/github.com/ipfs/go-ipfs-posinfo/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/Makefile b/vendor/github.com/ipfs/go-ipfs-posinfo/Makefile deleted file mode 100644 index 24d71558..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - go test -v -covermode count -coverprofile=coverage.out . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/README.md b/vendor/github.com/ipfs/go-ipfs-posinfo/README.md deleted file mode 100644 index bd509c17..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# go-ipfs-posinfo - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-posinfo?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-posinfo) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-posinfo.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-posinfo) - -> Posinfo wraps offset information for ipfs filestore nodes - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -``` -go get github.com/ipfs/go-ipfs-posinfo -``` - -## Usage - -See the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-posinfo) - - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/go.mod b/vendor/github.com/ipfs/go-ipfs-posinfo/go.mod deleted file mode 100644 index d0064084..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/ipfs/go-ipfs-posinfo - -require github.com/ipfs/go-ipld-format v0.0.1 diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/go.sum b/vendor/github.com/ipfs/go-ipfs-posinfo/go.sum deleted file mode 100644 index 9e2d1534..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/go.sum +++ /dev/null @@ -1,28 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/package.json b/vendor/github.com/ipfs/go-ipfs-posinfo/package.json deleted file mode 100644 index f1815f58..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "author": "hector", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-posinfo" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-posinfo" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-posinfo", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.5" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-posinfo/posinfo.go b/vendor/github.com/ipfs/go-ipfs-posinfo/posinfo.go deleted file mode 100644 index 0b32c89d..00000000 --- a/vendor/github.com/ipfs/go-ipfs-posinfo/posinfo.go +++ /dev/null @@ -1,23 +0,0 @@ -// Package posinfo wraps offset information used by ipfs filestore nodes -package posinfo - -import ( - "os" - - ipld "github.com/ipfs/go-ipld-format" -) - -// PosInfo stores information about the file offset, its path and -// stat. -type PosInfo struct { - Offset uint64 - FullPath string - Stat os.FileInfo // can be nil -} - -// FilestoreNode is an ipld.Node which arries PosInfo with it -// allowing to map it directly to a filesystem object. -type FilestoreNode struct { - ipld.Node - PosInfo *PosInfo -} diff --git a/vendor/github.com/ipfs/go-ipfs-pq/.travis.yml b/vendor/github.com/ipfs/go-ipfs-pq/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-pq/LICENSE b/vendor/github.com/ipfs/go-ipfs-pq/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-pq/Makefile b/vendor/github.com/ipfs/go-ipfs-pq/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-ipfs-pq/README.md b/vendor/github.com/ipfs/go-ipfs-pq/README.md deleted file mode 100644 index df2157fc..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-ipfs-pq - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs-pq?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs-pq) -[![Build Status](https://travis-ci.org/ipfs/go-ipfs-pq.svg?branch=master)](https://travis-ci.org/ipfs/go-ipfs-pq) - -> go-ipfs-pq implements a priority queue. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-ipfs-pq` works like a regular Go module: - -``` -> go get github.com/ipfs/go-ipfs-pq -``` - -## Usage - -``` -import "github.com/ipfs/go-ipfs-pq" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-ipfs-pq) - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-ipfs-pq/go.mod b/vendor/github.com/ipfs/go-ipfs-pq/go.mod deleted file mode 100644 index 28b98ba0..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/ipfs/go-ipfs-pq diff --git a/vendor/github.com/ipfs/go-ipfs-pq/package.json b/vendor/github.com/ipfs/go-ipfs-pq/package.json deleted file mode 100644 index 329e1c13..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-pq" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-pq" - }, - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipfs-pq", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.0.1" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-pq/pq.go b/vendor/github.com/ipfs/go-ipfs-pq/pq.go deleted file mode 100644 index 28f40616..00000000 --- a/vendor/github.com/ipfs/go-ipfs-pq/pq.go +++ /dev/null @@ -1,106 +0,0 @@ -// Package pq implements a priority queue. -package pq - -import "container/heap" - -// PQ is a basic priority queue. -type PQ interface { - // Push adds the ele - Push(Elem) - // Pop returns the highest priority Elem in PQ. - Pop() Elem - // Len returns the number of elements in the PQ. - Len() int - // Update `fixes` the PQ. - Update(index int) - - // TODO explain why this interface should not be extended - // It does not support Remove. This is because... -} - -// Elem describes elements that can be added to the PQ. Clients must implement -// this interface. -type Elem interface { - // SetIndex stores the int index. - SetIndex(int) - // Index returns the last given by SetIndex(int). - Index() int -} - -// ElemComparator returns true if pri(a) > pri(b) -type ElemComparator func(a, b Elem) bool - -// New creates a PQ with a client-supplied comparator. -func New(cmp ElemComparator) PQ { - q := &wrapper{heapinterface{ - elems: make([]Elem, 0), - cmp: cmp, - }} - heap.Init(&q.heapinterface) - return q -} - -// wrapper exists because we cannot re-define Push. We want to expose -// Push(Elem) but heap.Interface requires Push(interface{}) -type wrapper struct { - heapinterface -} - -var _ PQ = &wrapper{} - -func (w *wrapper) Push(e Elem) { - heap.Push(&w.heapinterface, e) -} - -func (w *wrapper) Pop() Elem { - return heap.Pop(&w.heapinterface).(Elem) -} - -func (w *wrapper) Update(index int) { - heap.Fix(&w.heapinterface, index) -} - -// heapinterface handles dirty low-level details of managing the priority queue. -type heapinterface struct { - elems []Elem - cmp ElemComparator -} - -var _ heap.Interface = &heapinterface{} - -// public interface - -func (q *heapinterface) Len() int { - return len(q.elems) -} - -// Less delegates the decision to the comparator -func (q *heapinterface) Less(i, j int) bool { - return q.cmp(q.elems[i], q.elems[j]) -} - -// Swap swaps the elements with indexes i and j. -func (q *heapinterface) Swap(i, j int) { - q.elems[i], q.elems[j] = q.elems[j], q.elems[i] - q.elems[i].SetIndex(i) - q.elems[j].SetIndex(j) -} - -// Note that Push and Pop in this interface are for package heap's -// implementation to call. To add and remove things from the heap, wrap with -// the pq struct to call heap.Push and heap.Pop. - -func (q *heapinterface) Push(x interface{}) { // where to put the elem? - t := x.(Elem) - t.SetIndex(len(q.elems)) - q.elems = append(q.elems, t) -} - -func (q *heapinterface) Pop() interface{} { - old := q.elems - n := len(old) - elem := old[n-1] // remove the last - elem.SetIndex(-1) // for safety // FIXME why? - q.elems = old[0 : n-1] // shrink - return elem -} diff --git a/vendor/github.com/ipfs/go-ipfs-routing/LICENSE b/vendor/github.com/ipfs/go-ipfs-routing/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-ipfs-routing/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-routing/none/none_client.go b/vendor/github.com/ipfs/go-ipfs-routing/none/none_client.go deleted file mode 100644 index 9604ab07..00000000 --- a/vendor/github.com/ipfs/go-ipfs-routing/none/none_client.go +++ /dev/null @@ -1,57 +0,0 @@ -// Package nilrouting implements a routing client that does nothing. -package nilrouting - -import ( - "context" - "errors" - - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - record "github.com/libp2p/go-libp2p-record" -) - -type nilclient struct { -} - -func (c *nilclient) PutValue(_ context.Context, _ string, _ []byte, _ ...routing.Option) error { - return nil -} - -func (c *nilclient) GetValue(_ context.Context, _ string, _ ...routing.Option) ([]byte, error) { - return nil, errors.New("tried GetValue from nil routing") -} - -func (c *nilclient) SearchValue(_ context.Context, _ string, _ ...routing.Option) (<-chan []byte, error) { - return nil, errors.New("tried SearchValue from nil routing") -} - -func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (peer.AddrInfo, error) { - return peer.AddrInfo{}, nil -} - -func (c *nilclient) FindProvidersAsync(_ context.Context, _ cid.Cid, _ int) <-chan peer.AddrInfo { - out := make(chan peer.AddrInfo) - defer close(out) - return out -} - -func (c *nilclient) Provide(_ context.Context, _ cid.Cid, _ bool) error { - return nil -} - -func (c *nilclient) Bootstrap(_ context.Context) error { - return nil -} - -// ConstructNilRouting creates an Routing client which does nothing. -func ConstructNilRouting(_ context.Context, _ host.Host, _ ds.Batching, _ record.Validator) (routing.Routing, error) { - return &nilclient{}, nil -} - -// ensure nilclient satisfies interface -var _ routing.Routing = &nilclient{} diff --git a/vendor/github.com/ipfs/go-ipfs-routing/offline/offline.go b/vendor/github.com/ipfs/go-ipfs-routing/offline/offline.go deleted file mode 100644 index c76f9209..00000000 --- a/vendor/github.com/ipfs/go-ipfs-routing/offline/offline.go +++ /dev/null @@ -1,128 +0,0 @@ -// Package offline implements Routing with a client which -// is only able to perform offline operations. -package offline - -import ( - "bytes" - "context" - "errors" - "time" - - proto "github.com/gogo/protobuf/proto" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - dshelp "github.com/ipfs/go-ipfs-ds-help" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - record "github.com/libp2p/go-libp2p-record" - pb "github.com/libp2p/go-libp2p-record/pb" -) - -// ErrOffline is returned when trying to perform operations that -// require connectivity. -var ErrOffline = errors.New("routing system in offline mode") - -// NewOfflineRouter returns an Routing implementation which only performs -// offline operations. It allows to Put and Get signed dht -// records to and from the local datastore. -func NewOfflineRouter(dstore ds.Datastore, validator record.Validator) routing.Routing { - return &offlineRouting{ - datastore: dstore, - validator: validator, - } -} - -// offlineRouting implements the Routing interface, -// but only provides the capability to Put and Get signed dht -// records to and from the local datastore. -type offlineRouting struct { - datastore ds.Datastore - validator record.Validator -} - -func (c *offlineRouting) PutValue(ctx context.Context, key string, val []byte, _ ...routing.Option) error { - if err := c.validator.Validate(key, val); err != nil { - return err - } - if old, err := c.GetValue(ctx, key); err == nil { - // be idempotent to be nice. - if bytes.Equal(old, val) { - return nil - } - // check to see if the older record is better - i, err := c.validator.Select(key, [][]byte{val, old}) - if err != nil { - // this shouldn't happen for validated records. - return err - } - if i != 0 { - return errors.New("can't replace a newer record with an older one") - } - } - rec := record.MakePutRecord(key, val) - data, err := proto.Marshal(rec) - if err != nil { - return err - } - - return c.datastore.Put(dshelp.NewKeyFromBinary([]byte(key)), data) -} - -func (c *offlineRouting) GetValue(ctx context.Context, key string, _ ...routing.Option) ([]byte, error) { - buf, err := c.datastore.Get(dshelp.NewKeyFromBinary([]byte(key))) - if err != nil { - return nil, err - } - - rec := new(pb.Record) - err = proto.Unmarshal(buf, rec) - if err != nil { - return nil, err - } - val := rec.GetValue() - - err = c.validator.Validate(key, val) - if err != nil { - return nil, err - } - return val, nil -} - -func (c *offlineRouting) SearchValue(ctx context.Context, key string, _ ...routing.Option) (<-chan []byte, error) { - out := make(chan []byte, 1) - go func() { - defer close(out) - v, err := c.GetValue(ctx, key) - if err == nil { - out <- v - } - }() - return out, nil -} - -func (c *offlineRouting) FindPeer(ctx context.Context, pid peer.ID) (peer.AddrInfo, error) { - return peer.AddrInfo{}, ErrOffline -} - -func (c *offlineRouting) FindProvidersAsync(ctx context.Context, k cid.Cid, max int) <-chan peer.AddrInfo { - out := make(chan peer.AddrInfo) - close(out) - return out -} - -func (c *offlineRouting) Provide(_ context.Context, k cid.Cid, _ bool) error { - return ErrOffline -} - -func (c *offlineRouting) Ping(ctx context.Context, p peer.ID) (time.Duration, error) { - return 0, ErrOffline -} - -func (c *offlineRouting) Bootstrap(context.Context) error { - return nil -} - -// ensure offlineRouting matches the Routing interface -var _ routing.Routing = &offlineRouting{} diff --git a/vendor/github.com/ipfs/go-ipfs-util/.gitignore b/vendor/github.com/ipfs/go-ipfs-util/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/ipfs/go-ipfs-util/.travis.yml b/vendor/github.com/ipfs/go-ipfs-util/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipfs-util/LICENSE b/vendor/github.com/ipfs/go-ipfs-util/LICENSE deleted file mode 100644 index 9ce97444..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs-util/README.md b/vendor/github.com/ipfs/go-ipfs-util/README.md deleted file mode 100644 index 33bff12c..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# go-ipfs-util - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![](https://img.shields.io/badge/discussion_repo-go_to_issues-brightgreen.svg?style=flat-square)](https://github.com/ipfs/NAME/issues) - -> Common utilities used by go-ipfs and other related go packages - -## Install - -This is a Go module which can be installed with `go get github.com/ipfs/go-ipfs-util`. `go-ipfs-util` is however packaged with Gx, so it is recommended to use Gx to install it (see Usage section). - -## Usage - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). -In order to use it in your own project do: - -``` -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/ipfs/go-ipfs-util -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-ipfs-util/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT diff --git a/vendor/github.com/ipfs/go-ipfs-util/file.go b/vendor/github.com/ipfs/go-ipfs-util/file.go deleted file mode 100644 index e6e30df4..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/file.go +++ /dev/null @@ -1,12 +0,0 @@ -package util - -import "os" - -// FileExists check if the file with the given path exits. -func FileExists(filename string) bool { - fi, err := os.Lstat(filename) - if fi != nil || (err != nil && !os.IsNotExist(err)) { - return true - } - return false -} diff --git a/vendor/github.com/ipfs/go-ipfs-util/go.mod b/vendor/github.com/ipfs/go-ipfs-util/go.mod deleted file mode 100644 index 112c925b..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-ipfs-util - -require ( - github.com/mr-tron/base58 v1.1.0 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipfs-util/go.sum b/vendor/github.com/ipfs/go-ipfs-util/go.sum deleted file mode 100644 index 25c9723e..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/go.sum +++ /dev/null @@ -1,16 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipfs-util/package.json b/vendor/github.com/ipfs/go-ipfs-util/package.json deleted file mode 100644 index 3c3ed116..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-util" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "mr-tron", - "hash": "QmWFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY", - "name": "go-base58-fast", - "version": "0.1.1" - } - ], - "gxVersion": "0.9.1", - "language": "go", - "license": "", - "name": "go-ipfs-util", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.2.9" -} - diff --git a/vendor/github.com/ipfs/go-ipfs-util/time.go b/vendor/github.com/ipfs/go-ipfs-util/time.go deleted file mode 100644 index 37d720fb..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/time.go +++ /dev/null @@ -1,22 +0,0 @@ -package util - -import "time" - -// TimeFormatIpfs is the format ipfs uses to represent time in string form. -var TimeFormatIpfs = time.RFC3339Nano - -// ParseRFC3339 parses an RFC3339Nano-formatted time stamp and -// returns the UTC time. -func ParseRFC3339(s string) (time.Time, error) { - t, err := time.Parse(TimeFormatIpfs, s) - if err != nil { - return time.Time{}, err - } - return t.UTC(), nil -} - -// FormatRFC3339 returns the string representation of the -// UTC value of the given time in RFC3339Nano format. -func FormatRFC3339(t time.Time) string { - return t.UTC().Format(TimeFormatIpfs) -} diff --git a/vendor/github.com/ipfs/go-ipfs-util/util.go b/vendor/github.com/ipfs/go-ipfs-util/util.go deleted file mode 100644 index 8ebe3c70..00000000 --- a/vendor/github.com/ipfs/go-ipfs-util/util.go +++ /dev/null @@ -1,158 +0,0 @@ -// Package util implements various utility functions used within ipfs -// that do not currently have a better place to live. -package util - -import ( - "errors" - "io" - "math/rand" - "os" - "path/filepath" - "runtime/debug" - "strings" - "time" - - b58 "github.com/mr-tron/base58/base58" - mh "github.com/multiformats/go-multihash" -) - -// DefaultIpfsHash is the current default hash function used by IPFS. -const DefaultIpfsHash = mh.SHA2_256 - -// Debug is a global flag for debugging. -var Debug bool - -// ErrNotImplemented signifies a function has not been implemented yet. -var ErrNotImplemented = errors.New("Error: not implemented yet.") - -// ErrTimeout implies that a timeout has been triggered -var ErrTimeout = errors.New("Error: Call timed out.") - -// ErrSearchIncomplete implies that a search type operation didnt -// find the expected node, but did find 'a' node. -var ErrSearchIncomplete = errors.New("Error: Search Incomplete.") - -// ErrCast is returned when a cast fails AND the program should not panic. -func ErrCast() error { - debug.PrintStack() - return errCast -} - -var errCast = errors.New("cast error") - -// ExpandPathnames takes a set of paths and turns them into absolute paths -func ExpandPathnames(paths []string) ([]string, error) { - var out []string - for _, p := range paths { - abspath, err := filepath.Abs(p) - if err != nil { - return nil, err - } - out = append(out, abspath) - } - return out, nil -} - -type randGen struct { - rand.Rand -} - -// NewTimeSeededRand returns a random bytes reader -// which has been initialized with the current time. -func NewTimeSeededRand() io.Reader { - src := rand.NewSource(time.Now().UnixNano()) - return &randGen{ - Rand: *rand.New(src), - } -} - -// NewSeededRand returns a random bytes reader -// initialized with the given seed. -func NewSeededRand(seed int64) io.Reader { - src := rand.NewSource(seed) - return &randGen{ - Rand: *rand.New(src), - } -} - -func (r *randGen) Read(p []byte) (n int, err error) { - for i := 0; i < len(p); i++ { - p[i] = byte(r.Rand.Intn(255)) - } - return len(p), nil -} - -// GetenvBool is the way to check an env var as a boolean -func GetenvBool(name string) bool { - v := strings.ToLower(os.Getenv(name)) - return v == "true" || v == "t" || v == "1" -} - -// MultiErr is a util to return multiple errors -type MultiErr []error - -func (m MultiErr) Error() string { - if len(m) == 0 { - return "no errors" - } - - s := "Multiple errors: " - for i, e := range m { - if i != 0 { - s += ", " - } - s += e.Error() - } - return s -} - -// Partition splits a subject 3 parts: prefix, separator, suffix. -// The first occurrence of the separator will be matched. -// ie. Partition("Ready, steady, go!", ", ") -> ["Ready", ", ", "steady, go!"] -func Partition(subject string, sep string) (string, string, string) { - if i := strings.Index(subject, sep); i != -1 { - return subject[:i], subject[i : i+len(sep)], subject[i+len(sep):] - } - return subject, "", "" -} - -// RPartition splits a subject 3 parts: prefix, separator, suffix. -// The last occurrence of the separator will be matched. -// ie. RPartition("Ready, steady, go!", ", ") -> ["Ready, steady", ", ", "go!"] -func RPartition(subject string, sep string) (string, string, string) { - if i := strings.LastIndex(subject, sep); i != -1 { - return subject[:i], subject[i : i+len(sep)], subject[i+len(sep):] - } - return subject, "", "" -} - -// Hash is the global IPFS hash function. uses multihash SHA2_256, 256 bits -func Hash(data []byte) mh.Multihash { - h, err := mh.Sum(data, DefaultIpfsHash, -1) - if err != nil { - // this error can be safely ignored (panic) because multihash only fails - // from the selection of hash function. If the fn + length are valid, it - // won't error. - panic("multihash failed to hash using SHA2_256.") - } - return h -} - -// IsValidHash checks whether a given hash is valid (b58 decodable, len > 0) -func IsValidHash(s string) bool { - out, err := b58.Decode(s) - if err != nil { - return false - } - _, err = mh.Cast(out) - return err == nil -} - -// XOR takes two byte slices, XORs them together, returns the resulting slice. -func XOR(a, b []byte) []byte { - c := make([]byte, len(a)) - for i := 0; i < len(a); i++ { - c[i] = a[i] ^ b[i] - } - return c -} diff --git a/vendor/github.com/ipfs/go-ipfs/.codeclimate.yml b/vendor/github.com/ipfs/go-ipfs/.codeclimate.yml deleted file mode 100644 index 98f44c20..00000000 --- a/vendor/github.com/ipfs/go-ipfs/.codeclimate.yml +++ /dev/null @@ -1,46 +0,0 @@ -ratings: - paths: - - "**/*.go" - -exclude_paths: -- test/ -- Godeps/ -- thirdparty/ -- "**/*.pb.go" - -engines: - fixme: - enabled: true - config: - strings: - - FIXME - - HACK - - XXX - - BUG - golint: - enabled: true - govet: - enabled: true - gofmt: - enabled: true - -version: "2" -checks: - argument-count: - enabled: false - complex-logic: - enabled: false - file-lines: - enabled: false - method-complexity: - enabled: false - method-count: - enabled: false - method-lines: - enabled: false - nested-control-flow: - enabled: false - return-statements: - enabled: false - similar-code: - enabled: false diff --git a/vendor/github.com/ipfs/go-ipfs/.dockerignore b/vendor/github.com/ipfs/go-ipfs/.dockerignore deleted file mode 100644 index 10dd5fd8..00000000 --- a/vendor/github.com/ipfs/go-ipfs/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -Dockerfile -Dockerfile.fast -.git/ -!.git/HEAD -!.git/refs/ -!.git/packed-refs -test/sharness/lib/sharness/ - -# The Docker client might not be running on Linux -# so delete any compiled binaries -bin/gx -bin/gx* -bin/tmp diff --git a/vendor/github.com/ipfs/go-ipfs/.gitattributes b/vendor/github.com/ipfs/go-ipfs/.gitattributes deleted file mode 100644 index d6b38c11..00000000 --- a/vendor/github.com/ipfs/go-ipfs/.gitattributes +++ /dev/null @@ -1,15 +0,0 @@ -# Default to text -* text eol=lf - -# True text -*.md text eol=auto -LICENSE text eol=auto - -# Known binary types -*.png binary -*.tar binary -*.gz binary - -# Binary assets -assets/init-doc/* binary -core/coreunix/test_data/** binary diff --git a/vendor/github.com/ipfs/go-ipfs/.gitignore b/vendor/github.com/ipfs/go-ipfs/.gitignore deleted file mode 100644 index f96cb84b..00000000 --- a/vendor/github.com/ipfs/go-ipfs/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# ipfs can generate profiling dump files -*.cpuprof -*.memprof - -*.swp -.ipfsconfig -*.out -*.coverprofile -*.test -*.orig -*~ - -coverage.txt -gx-workspace-update.json - -.ipfs -bin/gx -bin/protoc-* -bin/gx* -bin/tmp -bin/gocovmerge -bin/cover - - -vendor -.tarball -go-ipfs-source.tar.gz diff --git a/vendor/github.com/ipfs/go-ipfs/CHANGELOG.md b/vendor/github.com/ipfs/go-ipfs/CHANGELOG.md deleted file mode 100644 index c6f2f085..00000000 --- a/vendor/github.com/ipfs/go-ipfs/CHANGELOG.md +++ /dev/null @@ -1,4352 +0,0 @@ -# go-ipfs changelog - -## 0.4.21 2019-05-30 - -We're happy to announce go-ipfs 0.4.21. This release has some critical bug fixes -and a handful of new features so every user should upgrade. - -Key bug fixes: - -* Too many open file descriptors/too many peers - ([#6237](https://github.com/ipfs/go-ipfs/issues/6237)). -* Adding multiple files at the same time doesn't work - ([#6254](https://github.com/ipfs/go-ipfs/pull/6255)). -* CPU utilization spikes and then holds at 100% - ([#5613](https://github.com/ipfs/go-ipfs/issues/5613)). - -Key features: - -* Experimental TLS1.3 support (to eventually replace secio). -* OpenSSL support for SECIO handshakes (performance improvement). - -**IMPORTANT:** This release fixes a bug in our security transport that could -potentially drop data from the channel. Note: This issue affects neither the -privacy nor the integrity of the data with respect to a third-party attacker. -Only the peer sending us data could trigger this bug. - -**ALL USERS MUST UPGRADE.** We intended to introduce a feature this release that, -unfortunately, [reliably triggered this bug][secio-bug]. To avoid partitioning -the network, we've decided to postpone this feature for a release or two. - -Specifically, we're going to provide a minimum _one month_ upgrade period. After -that, we'll start testing the impact of deploying the proposed changes. - -If you're running the mainline go-ipfs, please upgrade ASAP. If you're building -a separate app or working on a forked go-ipfs, make sure to upgrade -github.com/libp2p/go-libp2p-secio to _at least_ v0.0.3. - -[secio-bug]: https://github.com/libp2p/go-libp2p/issues/644 - -### Contributors - -First off, we'd like to give a shout-out to all contributors that participated -in this release (including contributions to ipld, libp2p, and multiformats): - -| Contributor | Commits | Lines ± | Files Changed | -|----------------------------|---------|-------------|---------------| -| Steven Allen | 220 | +6078/-4211 | 520 | -| Łukasz Magiera | 53 | +5039/-4557 | 274 | -| vyzo | 179 | +2929/-1704 | 238 | -| Raúl Kripalani | 44 | +757/-1895 | 134 | -| hannahhoward | 11 | +755/-1005 | 49 | -| Marten Seemann | 16 | +862/-203 | 44 | -| keks | 10 | +359/-110 | 12 | -| Jan Winkelmann | 8 | +368/-26 | 16 | -| Jakub Sztandera | 4 | +361/-8 | 7 | -| Adrian Lanzafame | 1 | +287/-18 | 5 | -| Erik Ingenito | 4 | +247/-28 | 8 | -| Reid 'arrdem' McKenzie | 1 | +220/-20 | 3 | -| Yusef Napora | 26 | +98/-130 | 26 | -| Michael Avila | 3 | +116/-59 | 8 | -| Raghav Gulati | 13 | +145/-26 | 13 | -| tg | 1 | +41/-33 | 1 | -| Matt Joiner | 6 | +41/-30 | 7 | -| Cole Brown | 1 | +37/-25 | 1 | -| Dominic Della Valle | 2 | +12/-40 | 4 | -| Overbool | 1 | +50/-0 | 2 | -| Christopher Buesser | 3 | +29/-16 | 10 | -| myself659 | 1 | +38/-5 | 2 | -| Alex Browne | 3 | +30/-8 | 3 | -| jmank88 | 1 | +27/-4 | 2 | -| Vikram | 1 | +25/-1 | 2 | -| MollyM | 7 | +17/-9 | 7 | -| Marcin Rataj | 1 | +17/-1 | 1 | -| requilence | 1 | +11/-4 | 1 | -| Teran McKinney | 1 | +8/-2 | 1 | -| Oli Evans | 1 | +5/-5 | 1 | -| Masashi Salvador Mitsuzawa | 1 | +5/-1 | 1 | -| chenminjian | 1 | +4/-0 | 1 | -| Edgar Lee | 1 | +3/-1 | 1 | -| Dirk McCormick | 1 | +2/-2 | 2 | -| ia | 1 | +1/-1 | 1 | -| Alan Shaw | 1 | +1/-1 | 1 | - -### Bug Fixes And Enhancements - -This release includes quite a number of critical bug fixes and -performance/reliability enhancements. - -#### Error when adding multiple files - -The last release broke the simple command `ipfs add file1 file2`. It turns out -we simply lacked a test case for this. Both of these issues (the bug and the -lack of a test case) have now been fixed. - -#### SECIO - -As noted above, we've fixed a bug that could cause data to be dropped from a -SECIO connection on read. Specifically, this happens when: - -1. The capacity of the read buffer is greater than the length. -2. The remote peer sent more than the length but less than the capacity in a - single secio "frame". - -In this case, we'd fill the read buffer to it's capacity instead of its length. - -#### Too many open files, too many peers, etc. - -Go-ipfs automatically closes the least useful connections when it accumulates -too many connections. Unfortunately, some relayed connections were blocking in -`Close()`, halting the entire process. - -#### Out of control CPU usage - -Many users noted out of control CPU usage this release. This turned out to be a -long-standing issue with how the DHT handled provider records (records recording -which peers have what content): - -1. It wasn't removing provider records for content until the set of providers - completely emptied. -2. It was loading every provider record into memory whenever we updated the set - of providers. - -Combined, these two issues were trashing the provider record cache, forcing the -DHT to repeatedly load and discard provider records. - -#### More Reliable Connection Management - -Go-ipfs has a subsystem called the "connection manager" to close the -least-useful connections when go-ipfs runs low on resources. - -Unfortunately, other IPFS subsystems may learn about connections _before_ the -connection manager. Previously, if some IPFS subsystem tried to mark a -connection as useful before the connection manager learned about it, the -connection manager would discard this information. We believe this was causing -[#6271](https://github.com/ipfs/go-ipfs/issues/6271). [It no longer does -that](https://github.com/libp2p/go-libp2p-connmgr/pull/39). - -#### Improved Bitswap Connection Management - -Bitswap now uses the connection manager to mark all peers downloading blocks as -important (while downloading). Previously, it only marked peers from which _it_ -was downloading blocks. - -#### Reduced Memory Usage - -The most noticeable memory reduction in this release comes from fixing connection -closing. However, we've made a few additional improvements: - -* Bitswap's "work queue" no longer remembers every peer it has seen - indefinitely. -* The peerstore now interns protocol names. -* The per-peer goroutine count has been reduced. -* The DHT now wastes less memory on idle peers by pooling buffered writers and - returning them to the pool when not actively using them. - -#### Increased File Descriptor Limit - -The default file descriptor limit has been raised to 8192 (from 2048). -Unfortunately, go-ipfs behaves poorly when it runs out of file descriptors and -it uses a _lot_ of file descriptors. - -Luckily, most modern kernels can handle thousands of file descriptors without -any difficulty. - -#### Decreased Connection Handshake Latency - -Libp2p now shaves off a couple of round trips when initiating connections by -beginning the protocol negotiation before the remote peer responds to the -initial handshake message. - -In the optimal case (when the target peer speaks our preferred protocol), this -reduces the number of handshake round-trips from 6 to 4 (including the TCP -handshake). - -### Commands - -This release brings no new commands but does introduce a few changes, bugfixes, -and enhancements. This section is hardly complete but it lists the most -noticeable changes. - -Take note: this release also introduces a few breaking changes. - -#### [DEPRECATION] The URLStore Command Deprecated - -The experimental `ipfs urlstore` command is now deprecated. Please use `ipfs add ---nocopy URL` instead. - -#### [BREAKING] The DHT Command Base64 Encodes Values - -When responding to an `ipfs dht get` command, the daemon now encodes the -returned value using base64. The `ipfs` command will automatically decode this -value before returning it to the user so this change should only affect those -using the HTTP API directly. - -Unfortunately, this change was necessary as DHT records are arbitrary binary -blobs which can't be directly stored in JSON strings. - -#### [BREAKING] Base32 Encoded v1 CIDs By Default - -Both js-ipfs and go-ipfs now encode CIDv1 CIDs using base32 by default, instead -of base58. Unfortunately, base58 is case-sensitive and doesn't play well with -browsers (see [#4143](https://github.com/ipfs/go-ipfs/issues/4143). - -#### Human Readable Numbers - -The `ipfs bitswap stat` and and `ipfs object stat` commands now support a -`--humanize` flag that formats numbers with human-readable units (GiB, MiB, -etc.). - -#### Improved Errors - -This release improves two types of errors: - -1. Commands that take paths/multiaddrs now include the path/multiaddr in the - error message when it fails to parse. -2. `ipfs swarm connect` now returns a detailed error describing which addresses - were tried and why the dial failed. - -#### Ping Improvements - -The ping command has received some small improvements and fixes: - -1. It now exits with a non-zero exit status on failure. -2. It no longer succeeds with zero successful pings if we have a zombie but - non-functional connection to the peer being pinged - ([#6298](https://github.com/ipfs/go-ipfs/issues/6298)). -3. It now prints out the average latency when canceled with `^C` (like the unix - `ping` command). - -#### Improved Help Text - -Go-ipfs now intelligently wraps help text for easier reading. On an 80 character -wide terminal, - -**Before** - -``` -USAGE - ipfs add ... - Add a file or directory to ipfs. - -SYNOPSIS - ipfs add [--recursive | -r] [--dereference-args] [--stdin-name=] [ ---hidden | -H] [--quiet | -q] [--quieter | -Q] [--silent] [--progress | -p] [--t -rickle | -t] [--only-hash | -n] [--wrap-with-directory | -w] [--chunker= | -s] [--pin=false] [--raw-leaves] [--nocopy] [--fscache] [--cid-version=] [--hash=] [--inline] [--inline-limit=] [--] -... - -ARGUMENTS - - ... - The path to a file to be added to ipfs. - -OPTIONS - - -r, --recursive bool - Add directory paths recursive -ly. - --dereference-args bool - Symlinks supplied in argument -s are dereferenced. - --stdin-name string - Assign a name if the file sou -rce is stdin. - -H, --hidden bool - Include files that are hidden -. Only takes effect on recursive add. - -q, --quiet bool - Write minimal output. - -Q, --quieter bool - Write only final hash. - --silent bool - Write no output. - -p, --progress bool - Stream progress data. - -t, --trickle bool - Use trickle-dag format for da -g generation. - -n, --only-hash bool - Only chunk and hash - do not -write to disk. - -w, --wrap-with-directory bool - Wrap files with a directory o -bject. - -s, --chunker string - Chunking algorithm, size-[byt -es] or rabin-[min]-[avg]-[max]. Default: size-262144. - --pin bool - Pin this object when adding. -Default: true. - --raw-leaves bool - Use raw blocks for leaf nodes -. (experimental). - --nocopy bool - Add the file using filestore. - Implies raw-leaves. (experimental). - --fscache bool - Check the filestore for pre-e -xisting blocks. (experimental). - --cid-version int - CID version. Defaults to 0 un -less an option that depends on CIDv1 is passed. (experimental). - --hash string - Hash function to use. Implies - CIDv1 if not sha2-256. (experimental). Default: sha2-256. - --inline bool - Inline small blocks into CIDs -. (experimental). - --inline-limit int - Maximum block size to inline. - (experimental). Default: 32. - -``` - - -**After** - -``` -USAGE - ipfs add ... - Add a file or directory to ipfs. - -SYNOPSIS - ipfs add [--recursive | -r] [--dereference-args] [--stdin-name=] - [--hidden | -H] [--quiet | -q] [--quieter | -Q] [--silent] - [--progress | -p] [--trickle | -t] [--only-hash | -n] - [--wrap-with-directory | -w] [--chunker= | -s] [--pin=false] - [--raw-leaves] [--nocopy] [--fscache] [--cid-version=] - [--hash=] [--inline] [--inline-limit=] [--] - ... - -ARGUMENTS - - ... - The path to a file to be added to ipfs. - -OPTIONS - - -r, --recursive bool - Add directory paths recursively. - --dereference-args bool - Symlinks supplied in arguments are - dereferenced. - --stdin-name string - Assign a name if the file source is stdin. - -H, --hidden bool - Include files that are hidden. Only takes - effect on recursive add. - -q, --quiet bool - Write minimal output. - -Q, --quieter bool - Write only final hash. - --silent bool - Write no output. - -p, --progress bool - Stream progress data. - -t, --trickle bool - Use trickle-dag format for dag generation. - -n, --only-hash bool - Only chunk and hash - do not write to - disk. - -w, --wrap-with-directory bool - Wrap files with a directory object. - -s, --chunker string - Chunking algorithm, size-[bytes] or - rabin-[min]-[avg]-[max]. Default: - size-262144. - --pin bool - Pin this object when adding. Default: - true. - --raw-leaves bool - Use raw blocks for leaf nodes. - (experimental). - --nocopy bool - Add the file using filestore. Implies - raw-leaves. (experimental). - --fscache bool - Check the filestore for pre-existing - blocks. (experimental). - --cid-version int - CID version. Defaults to 0 unless an - option that depends on CIDv1 is passed. - (experimental). - --hash string - Hash function to use. Implies CIDv1 if - not sha2-256. (experimental). Default: - sha2-256. - --inline bool - Inline small blocks into CIDs. - (experimental). - --inline-limit int - Maximum block size to inline. - (experimental). Default: 32. -``` - -### Features - -This release is primarily a bug fix release but it still includes two nice -features from libp2p. - -#### Experimental TLS1.3 support - -Go-ipfs now has experimental TLS1.3 support. Currently, libp2p (IPFS's -networking library) uses a custom TLS-like protocol we call SECIO. However, the -conventional wisdom concerning custom security transports is "just don't" so we -are working on replacing it with TLS1.3 - -To choose this protocol by default, set the `Experimental.PreferTLS` config -variable: - -```bash -> ipfs config --bool Experimental.PreferTLS true -``` - -Why TLS1.3 and not X (noise, etc.)? - -1. Libp2p allows negotiating transports so there's no reason not to add noise - support to libp2p as well. -2. TLS has wide language support which should make implementing libp2p for new - languages significantly simpler. - -#### OpenSSL Support - -Go-ipfs can now (optionally) be built with OpenSSL support for improved -performance when establishing connections. This is primarily useful for nodes -receiving multiple inbound connections per second. - -To enable openssl support, rebuild go-ipfs with: - -```bash -> make build GOFLAGS=-tags=openssl -``` - -### CoreAPI - -The CoreAPI refactor is still underway and we've made significant progress -towards a usable ipfs-as-a-library constructor. Specifically, we've integrated -the [fx](https://go.uber.org/fx) dependency injection system and are -now working on cleaning up our initialization logic. This should make it easier -to inject new services into a go-ipfs process without messing with the core -internals. - -### Build: `GOCC` Environment Variable - -Build system now uses `GOCC` environment variable allowing for use of specific -go versions during builds. - -### Changelog - -- github.com/ipfs/go-ipfs: - - fix: use http.Error for sending errors ([ipfs/go-ipfs#6379](https://github.com/ipfs/go-ipfs/pull/6379)) - - core: call app.Stop once ([ipfs/go-ipfs#6380](https://github.com/ipfs/go-ipfs/pull/6380)) - - explain what dhtclient does ([ipfs/go-ipfs#6375](https://github.com/ipfs/go-ipfs/pull/6375)) - - ci: actually enable golangci-lint ([ipfs/go-ipfs#6362](https://github.com/ipfs/go-ipfs/pull/6362)) - - commands/swarm(fix): handle empty multiaddrs ([ipfs/go-ipfs#6355](https://github.com/ipfs/go-ipfs/pull/6355)) - - feat: improve errors when a path fails to parse ([ipfs/go-ipfs#6346](https://github.com/ipfs/go-ipfs/pull/6346)) - - fix vendoring dependencies when building the source tarball ([ipfs/go-ipfs#6349](https://github.com/ipfs/go-ipfs/pull/6349)) - - core: Use correct default for connmgr lowWater ([ipfs/go-ipfs#6352](https://github.com/ipfs/go-ipfs/pull/6352)) - - doc: remove out of date documentation ([ipfs/go-ipfs#6345](https://github.com/ipfs/go-ipfs/pull/6345)) - - Add generation of dependency changes to mkreleaselog ([ipfs/go-ipfs#6348](https://github.com/ipfs/go-ipfs/pull/6348)) - - readme: remove mention of DCO ([ipfs/go-ipfs#6344](https://github.com/ipfs/go-ipfs/pull/6344)) - - Add golangci-lint ([ipfs/go-ipfs#6321](https://github.com/ipfs/go-ipfs/pull/6321)) - - docs+mk: update guidance for unsupported platforms ([ipfs/go-ipfs#6338](https://github.com/ipfs/go-ipfs/pull/6338)) - - fix formatting in object get ([ipfs/go-ipfs#6340](https://github.com/ipfs/go-ipfs/pull/6340)) - - fail start when loading a plugin fails ([ipfs/go-ipfs#6339](https://github.com/ipfs/go-ipfs/pull/6339)) - - fix a typo in the issue template ([ipfs/go-ipfs#6335](https://github.com/ipfs/go-ipfs/pull/6335)) - - github: turn issue template into a multiple-choice question ([ipfs/go-ipfs#6333](https://github.com/ipfs/go-ipfs/pull/6333)) - - object put: Allow empty objects ([ipfs/go-ipfs#6330](https://github.com/ipfs/go-ipfs/pull/6330)) - - Update fuse.md ([ipfs/go-ipfs#6332](https://github.com/ipfs/go-ipfs/pull/6332)) - - work towards fixing dht commands ([ipfs/go-ipfs#6277](https://github.com/ipfs/go-ipfs/pull/6277)) - - fix setting ulimit ([ipfs/go-ipfs#6319](https://github.com/ipfs/go-ipfs/pull/6319)) - - switch to base32 by default for CIDv1 ([ipfs/go-ipfs#6300](https://github.com/ipfs/go-ipfs/pull/6300)) - - cmdkit -> cmds ([ipfs/go-ipfs#6318](https://github.com/ipfs/go-ipfs/pull/6318)) - - raise default fd limit to 8192 ([ipfs/go-ipfs#6266](https://github.com/ipfs/go-ipfs/pull/6266)) - - pin: don't walk all pinned blocks when removing a non-existent pin ([ipfs/go-ipfs#6311](https://github.com/ipfs/go-ipfs/pull/6311)) - - ping: fix a bunch of issues ([ipfs/go-ipfs#6312](https://github.com/ipfs/go-ipfs/pull/6312)) - - test(coreapi): use a thread-safe datastore everywhere ([ipfs/go-ipfs#6222](https://github.com/ipfs/go-ipfs/pull/6222)) - - fix(Dockerfile): Allow ipfs mount in Docker container ([ipfs/go-ipfs#5560](https://github.com/ipfs/go-ipfs/pull/5560)) - - docs: fix Routing section ([ipfs/go-ipfs#6309](https://github.com/ipfs/go-ipfs/pull/6309)) - - License update to dual MIT and Apache 2 ([ipfs/go-ipfs#6301](https://github.com/ipfs/go-ipfs/pull/6301)) - - Go test fix ([ipfs/go-ipfs#6293](https://github.com/ipfs/go-ipfs/pull/6293)) - - commands(pin update): return resolved CIDs instead of paths ([ipfs/go-ipfs#6275](https://github.com/ipfs/go-ipfs/pull/6275)) - - core: fix autonat construction ([ipfs/go-ipfs#6289](https://github.com/ipfs/go-ipfs/pull/6289)) - - Test and fix GC/pin bug ([ipfs/go-ipfs#6288](https://github.com/ipfs/go-ipfs/pull/6288)) - - GOCC implementation & fix in make & build scripts ([ipfs/go-ipfs#6282](https://github.com/ipfs/go-ipfs/pull/6282)) - - gc: cancel context ([ipfs/go-ipfs#6281](https://github.com/ipfs/go-ipfs/pull/6281)) - - fix: windows friendly daemon help ([ipfs/go-ipfs#6278](https://github.com/ipfs/go-ipfs/pull/6278)) - - Invert constructor config handling ([ipfs/go-ipfs#6276](https://github.com/ipfs/go-ipfs/pull/6276)) - - docs: document environment variables ([ipfs/go-ipfs#6268](https://github.com/ipfs/go-ipfs/pull/6268)) - - add: Return error from iterator ([ipfs/go-ipfs#6272](https://github.com/ipfs/go-ipfs/pull/6272)) - - commands(feat): use the coreapi in the urlstore command ([ipfs/go-ipfs#6259](https://github.com/ipfs/go-ipfs/pull/6259)) - - humanize for ipfs bitswap stat ([ipfs/go-ipfs#6258](https://github.com/ipfs/go-ipfs/pull/6258)) - - Revert "raise default fd limit to 8192" ([ipfs/go-ipfs#6265](https://github.com/ipfs/go-ipfs/pull/6265)) - - raise default fd limit to 8192 ([ipfs/go-ipfs#6261](https://github.com/ipfs/go-ipfs/pull/6261)) - - Fix AutoNAT service for private network ([ipfs/go-ipfs#6251](https://github.com/ipfs/go-ipfs/pull/6251)) - - add: Fix adding multiple files ([ipfs/go-ipfs#6255](https://github.com/ipfs/go-ipfs/pull/6255)) - - reprovider: Use goprocess ([ipfs/go-ipfs#6248](https://github.com/ipfs/go-ipfs/pull/6248)) - - core/corehttp/gateway_handler: pass a request ctx instead of the node ([ipfs/go-ipfs#6244](https://github.com/ipfs/go-ipfs/pull/6244)) - - constructor: cleanup some things ([ipfs/go-ipfs#6246](https://github.com/ipfs/go-ipfs/pull/6246)) - - Support --human flag in cmd/object-stat ([ipfs/go-ipfs#6241](https://github.com/ipfs/go-ipfs/pull/6241)) - - build: fix macos build with fuse ([ipfs/go-ipfs#6235](https://github.com/ipfs/go-ipfs/pull/6235)) - - add an experiment to prefer TLS 1.3 over secio ([ipfs/go-ipfs#6229](https://github.com/ipfs/go-ipfs/pull/6229)) - - fix two small nits in the go-ipfs constructor ([ipfs/go-ipfs#6234](https://github.com/ipfs/go-ipfs/pull/6234)) - - DI-based core.NewNode ([ipfs/go-ipfs#6162](https://github.com/ipfs/go-ipfs/pull/6162)) - - coreapi: Drop error from ParsePath ([ipfs/go-ipfs#6122](https://github.com/ipfs/go-ipfs/pull/6122)) - - fix the wrong path configuration in root redirection ([ipfs/go-ipfs#6215](https://github.com/ipfs/go-ipfs/pull/6215)) -- github.com/ipfs/go-bitswap (v0.0.4 -> v0.0.7): - - feat(engine): tag peers with requests ([ipfs/go-bitswap#128](https://github.com/ipfs/go-bitswap/pull/128)) - - fix(network): add mutex to avoid data race ([ipfs/go-bitswap#127](https://github.com/ipfs/go-bitswap/pull/127)) - - Change bitswap provide toggle to not be static ([ipfs/go-bitswap#124](https://github.com/ipfs/go-bitswap/pull/124)) - - Use shared peer task queue with Graphsync ([ipfs/go-bitswap#119](https://github.com/ipfs/go-bitswap/pull/119)) - - Add missing godoc comments, refactor to avoid confusion ([ipfs/go-bitswap#117](https://github.com/ipfs/go-bitswap/pull/117)) - - fix(decision): cleanup request queues ([ipfs/go-bitswap#116](https://github.com/ipfs/go-bitswap/pull/116)) - - Control provider workers with experiment flag ([ipfs/go-bitswap#110](https://github.com/ipfs/go-bitswap/pull/110)) - - connmgr: give peers more weight when actively participating in a session ([ipfs/go-bitswap#111](https://github.com/ipfs/go-bitswap/pull/111)) - - make the WantlistManager own the PeerHandler ([ipfs/go-bitswap#78](https://github.com/ipfs/go-bitswap/pull/78)) - - remove IPFS_LOW_MEM flag support ([ipfs/go-bitswap#115](https://github.com/ipfs/go-bitswap/pull/115)) -- github.com/ipfs/go-cid (v0.0.1 -> v0.0.2): - - default cidv1 to base32 ([ipfs/go-cid#85](https://github.com/ipfs/go-cid/pull/85)) -- github.com/ipfs/go-cidutil (v0.0.1 -> v0.0.2): - - default cidv1 to base32 ([ipfs/go-cidutil#13](https://github.com/ipfs/go-cidutil/pull/13)) -- github.com/ipfs/go-datastore (v0.0.3 -> v0.0.5): - - MapDatastore: obey KeysOnly ([ipfs/go-datastore#130](https://github.com/ipfs/go-datastore/pull/130)) - - fix the keytransform datastore's query implementation ([ipfs/go-datastore#127](https://github.com/ipfs/go-datastore/pull/127)) - - sync: apply entire query while locked ([ipfs/go-datastore#129](https://github.com/ipfs/go-datastore/pull/129)) - - filter: values are now always bytes ([ipfs/go-datastore#126](https://github.com/ipfs/go-datastore/pull/126)) - - autobatch: batch deletes ([ipfs/go-datastore#128](https://github.com/ipfs/go-datastore/pull/128)) -- github.com/ipfs/go-ipfs-cmds (v0.0.5 -> v0.0.8): - - fix: use golang's http.Error to send errors ([ipfs/go-ipfs-cmds#167](https://github.com/ipfs/go-ipfs-cmds/pull/167)) - - improve help text on narrow terminals ([ipfs/go-ipfs-cmds#140](https://github.com/ipfs/go-ipfs-cmds/pull/140)) - - chore: remove an old hack ([ipfs/go-ipfs-cmds#165](https://github.com/ipfs/go-ipfs-cmds/pull/165)) - - http: use the request context ([ipfs/go-ipfs-cmds#163](https://github.com/ipfs/go-ipfs-cmds/pull/163)) - - merge in go-ipfs-cmdkit ([ipfs/go-ipfs-cmds#164](https://github.com/ipfs/go-ipfs-cmds/pull/164)) - - fix: return the correct error ([ipfs/go-ipfs-cmds#162](https://github.com/ipfs/go-ipfs-cmds/pull/162)) -- github.com/ipfs/go-ipfs-config (v0.0.1 -> v0.0.3): - - Closes: #6284 Add appropriate IPv6 ranges to defaultServerFilters ([ipfs/go-ipfs-config#34](https://github.com/ipfs/go-ipfs-config/pull/34)) - - add an experiment to prefer TLS 1.3 over secio ([ipfs/go-ipfs-config#32](https://github.com/ipfs/go-ipfs-config/pull/32)) -- github.com/ipfs/go-ipfs-files (v0.0.2 -> v0.0.3): - - webfile: make Size() work before Read ([ipfs/go-ipfs-files#18](https://github.com/ipfs/go-ipfs-files/pull/18)) - - check http status code during WebFile reads and return error for non-2XX ([ipfs/go-ipfs-files#17](https://github.com/ipfs/go-ipfs-files/pull/17)) -- github.com/ipfs/go-ipld-cbor (v0.0.1 -> v0.0.2): - - switch to base32 by default ([ipfs/go-ipld-cbor#62](https://github.com/ipfs/go-ipld-cbor/pull/62)) -- github.com/ipfs/go-ipld-git (v0.0.1 -> v0.0.2): - - switch to base32 by default ([ipfs/go-ipld-git#40](https://github.com/ipfs/go-ipld-git/pull/40)) -- github.com/ipfs/go-mfs (v0.0.4 -> v0.0.7): - - Fix directory mv and add tests ([ipfs/go-mfs#76](https://github.com/ipfs/go-mfs/pull/76)) - - fix: not remove file by mistakes ([ipfs/go-mfs#73](https://github.com/ipfs/go-mfs/pull/73)) -- github.com/ipfs/go-path (v0.0.3 -> v0.0.4): - - include the path in path errors ([ipfs/go-path#28](https://github.com/ipfs/go-path/pull/28)) -- github.com/ipfs/go-unixfs (v0.0.4 -> v0.0.6): - - chore: remove URL field ([ipfs/go-unixfs#72](https://github.com/ipfs/go-unixfs/pull/72)) -- github.com/ipfs/interface-go-ipfs-core (v0.0.6 -> v0.0.8): - - switch to base32 cidv1 by default ([ipfs/interface-go-ipfs-core#29](https://github.com/ipfs/interface-go-ipfs-core/pull/29)) - - path: drop error from ParsePath ([ipfs/interface-go-ipfs-core#22](https://github.com/ipfs/interface-go-ipfs-core/pull/22)) - - tests: fix a bunch of small test lints/issues ([ipfs/interface-go-ipfs-core#28](https://github.com/ipfs/interface-go-ipfs-core/pull/28)) - - Update Pin.RmRecursive docs to clarify shared indirect pins are not removed ([ipfs/interface-go-ipfs-core#26](https://github.com/ipfs/interface-go-ipfs-core/pull/26)) -- github.com/libp2p/go-buffer-pool (v0.0.1 -> v0.0.2): - - feat: add buffered writer ([libp2p/go-buffer-pool#9](https://github.com/libp2p/go-buffer-pool/pull/9)) -- github.com/libp2p/go-conn-security-multistream (v0.0.1 -> v0.0.2): - - block while writing ([libp2p/go-conn-security-multistream#10](https://github.com/libp2p/go-conn-security-multistream/pull/10)) -- github.com/libp2p/go-libp2p (v0.0.12 -> v0.0.28): - - Close the connection manager ([libp2p/go-libp2p#639](https://github.com/libp2p/go-libp2p/pull/639)) - - Frequent Relay Advertisements ([libp2p/go-libp2p#637](https://github.com/libp2p/go-libp2p/pull/637)) - - ping: return a stream of results ([libp2p/go-libp2p#626](https://github.com/libp2p/go-libp2p/pull/626)) - - Use cancelable background context in identify ([libp2p/go-libp2p#624](https://github.com/libp2p/go-libp2p/pull/624)) - - avoid intermediate allocation in relayAddrs ([libp2p/go-libp2p#609](https://github.com/libp2p/go-libp2p/pull/609)) - - cache relayAddrs for a short period of time ([libp2p/go-libp2p#608](https://github.com/libp2p/go-libp2p/pull/608)) - - autorelay: break findRelays into multiple functions and avoid the goto ([libp2p/go-libp2p#606](https://github.com/libp2p/go-libp2p/pull/606)) - - autorelay: curtail addrsplosion ([libp2p/go-libp2p#598](https://github.com/libp2p/go-libp2p/pull/598)) - - Periodically schedule identify push if the address set has changed ([libp2p/go-libp2p#597](https://github.com/libp2p/go-libp2p/pull/597)) - - Replace peer addresses in identify ([libp2p/go-libp2p#599](https://github.com/libp2p/go-libp2p/pull/599)) -- github.com/libp2p/go-libp2p-circuit (v0.0.4 -> v0.0.8): - - call Stream.Reset instead of Stream.Close ([libp2p/go-libp2p-circuit#76](https://github.com/libp2p/go-libp2p-circuit/pull/76)) - - Tag the hop relay when creating stop streams ([libp2p/go-libp2p-circuit#77](https://github.com/libp2p/go-libp2p-circuit/pull/77)) - - Tag peers with live hop streams ([libp2p/go-libp2p-circuit#75](https://github.com/libp2p/go-libp2p-circuit/pull/75)) - - Hard Limit the number of hop stream goroutines ([libp2p/go-libp2p-circuit#74](https://github.com/libp2p/go-libp2p-circuit/pull/74)) - - set deadline for stop handshake ([libp2p/go-libp2p-circuit#73](https://github.com/libp2p/go-libp2p-circuit/pull/73)) -- github.com/libp2p/go-libp2p-connmgr (v0.0.1 -> v0.0.6): - - Background trimming ([libp2p/go-libp2p-connmgr#43](https://github.com/libp2p/go-libp2p-connmgr/pull/43)) - - Implement UpsertTag ([libp2p/go-libp2p-connmgr#38](https://github.com/libp2p/go-libp2p-connmgr/pull/38)) - - Add peer protection capability (implementation) ([libp2p/go-libp2p-connmgr#36](https://github.com/libp2p/go-libp2p-connmgr/pull/36)) -- github.com/libp2p/go-libp2p-crypto (v0.0.1 -> v0.0.2): - - add openssl support ([libp2p/go-libp2p-crypto#61](https://github.com/libp2p/go-libp2p-crypto/pull/61)) -- github.com/libp2p/go-libp2p-discovery (v0.0.1 -> v0.0.4): - - More consistent use of options ([libp2p/go-libp2p-discovery#25](https://github.com/libp2p/go-libp2p-discovery/pull/25)) - - Use 3hrs as routing advertisement ttl ([libp2p/go-libp2p-discovery#23](https://github.com/libp2p/go-libp2p-discovery/pull/23)) -- github.com/libp2p/go-libp2p-interface-connmgr (v0.0.1 -> v0.0.5): - - Add Close method to the ConnManager interface ([libp2p/go-libp2p-interface-connmgr#18](https://github.com/libp2p/go-libp2p-interface-connmgr/pull/18)) - - Add UpsertTag to the interface ([libp2p/go-libp2p-interface-connmgr#17](https://github.com/libp2p/go-libp2p-interface-connmgr/pull/17)) - - Fix NullConnMgr to respect ConnManager interface ([libp2p/go-libp2p-interface-connmgr#15](https://github.com/libp2p/go-libp2p-interface-connmgr/pull/15)) - - Add peer protection capability ([libp2p/go-libp2p-interface-connmgr#14](https://github.com/libp2p/go-libp2p-interface-connmgr/pull/14)) -- github.com/libp2p/go-libp2p-kad-dht (v0.0.7 -> v0.0.13): - - fix: reduce memory used by buffered writers ([libp2p/go-libp2p-kad-dht#332](https://github.com/libp2p/go-libp2p-kad-dht/pull/332)) - - query: fix a goroutine leak when the routing table is empty ([libp2p/go-libp2p-kad-dht#329](https://github.com/libp2p/go-libp2p-kad-dht/pull/329)) - - query: fix error "leak" ([libp2p/go-libp2p-kad-dht#328](https://github.com/libp2p/go-libp2p-kad-dht/pull/328)) - - providers: run datastore GC concurrently ([libp2p/go-libp2p-kad-dht#326](https://github.com/libp2p/go-libp2p-kad-dht/pull/326)) - - fix(providers): gc ([libp2p/go-libp2p-kad-dht#325](https://github.com/libp2p/go-libp2p-kad-dht/pull/325)) - - Remove the old protocol from the defaults ([libp2p/go-libp2p-kad-dht#320](https://github.com/libp2p/go-libp2p-kad-dht/pull/320)) - - Fix some provider subsystem performance issues ([libp2p/go-libp2p-kad-dht#319](https://github.com/libp2p/go-libp2p-kad-dht/pull/319)) -- github.com/libp2p/go-libp2p-peerstore (v0.0.2 -> v0.0.6): - - segment the memory peerstore + granular locks ([libp2p/go-libp2p-peerstore#78](https://github.com/libp2p/go-libp2p-peerstore/pull/78)) - - don't delete under the read lock ([libp2p/go-libp2p-peerstore#76](https://github.com/libp2p/go-libp2p-peerstore/pull/76)) - - Read/Write locking ([libp2p/go-libp2p-peerstore#74](https://github.com/libp2p/go-libp2p-peerstore/pull/74)) - - optimize peerstore memory ([libp2p/go-libp2p-peerstore#71](https://github.com/libp2p/go-libp2p-peerstore/pull/71)) - - fix unmarshalling of peer IDs ([libp2p/go-libp2p-peerstore#72](https://github.com/libp2p/go-libp2p-peerstore/pull/72)) - - fix error handling in UpdateAddrs: return on error ([libp2p/go-libp2p-peerstore#70](https://github.com/libp2p/go-libp2p-peerstore/pull/70)) -- github.com/libp2p/go-libp2p-pubsub (v0.0.1 -> v0.0.3): - - rework validator pipeline ([libp2p/go-libp2p-pubsub#176](https://github.com/libp2p/go-libp2p-pubsub/pull/176)) - - Test adversarial signing ([libp2p/go-libp2p-pubsub#181](https://github.com/libp2p/go-libp2p-pubsub/pull/181)) - - Strict message signing by default ([libp2p/go-libp2p-pubsub#180](https://github.com/libp2p/go-libp2p-pubsub/pull/180)) -- github.com/libp2p/go-libp2p-secio (v0.0.1 -> v0.0.3): - - fix buffer size check ([libp2p/go-libp2p-secio#44](https://github.com/libp2p/go-libp2p-secio/pull/44)) -- github.com/libp2p/go-libp2p-swarm (v0.0.2 -> v0.0.6): - - dial: return a nice custom dial error ([libp2p/go-libp2p-swarm#121](https://github.com/libp2p/go-libp2p-swarm/pull/121)) -- github.com/libp2p/go-libp2p-tls (null -> v0.0.1): - - implement the new handshake ([libp2p/go-libp2p-tls#20](https://github.com/libp2p/go-libp2p-tls/pull/20)) - - use a prefix when signing the public key ([libp2p/go-libp2p-tls#26](https://github.com/libp2p/go-libp2p-tls/pull/26)) - - use ChaCha if one of the peers doesn't have AES hardware support ([libp2p/go-libp2p-tls#23](https://github.com/libp2p/go-libp2p-tls/pull/23)) - - improve peer verification ([libp2p/go-libp2p-tls#17](https://github.com/libp2p/go-libp2p-tls/pull/17)) - - add an example (mainly for development) ([libp2p/go-libp2p-tls#14](https://github.com/libp2p/go-libp2p-tls/pull/14)) -- github.com/libp2p/go-libp2p-transport-upgrader (v0.0.1 -> v0.0.4): - - improve correctness of closing connections on failure ([libp2p/go-libp2p-transport-upgrader#19](https://github.com/libp2p/go-libp2p-transport-upgrader/pull/19)) -- github.com/libp2p/go-maddr-filter (v0.0.1 -> v0.0.4): - - fix filter listing ([libp2p/go-maddr-filter#13](https://github.com/libp2p/go-maddr-filter/pull/13)) - - Reinstate deprecated Remove() method to reverse breakage ([libp2p/go-maddr-filter#12](https://github.com/libp2p/go-maddr-filter/pull/12)) - - Implement support for whitelists, default-deny/allow ([libp2p/go-maddr-filter#8](https://github.com/libp2p/go-maddr-filter/pull/8)) -- github.com/libp2p/go-mplex (v0.0.1 -> v0.0.4): - - disable write coalescing ([libp2p/go-mplex#61](https://github.com/libp2p/go-mplex/pull/61)) - - fix SetDeadline error conditions ([libp2p/go-mplex#59](https://github.com/libp2p/go-mplex/pull/59)) - - don't use contexts for deadlines ([libp2p/go-mplex#58](https://github.com/libp2p/go-mplex/pull/58)) - - don't reset on pathologies, just ignore the data ([libp2p/go-mplex#57](https://github.com/libp2p/go-mplex/pull/57)) - - coalesce writes ([libp2p/go-mplex#54](https://github.com/libp2p/go-mplex/pull/54)) - - read as much as we can in one go ([libp2p/go-mplex#53](https://github.com/libp2p/go-mplex/pull/53)) - - use timeouts when sending messages for stream open, close, and reset. ([libp2p/go-mplex#52](https://github.com/libp2p/go-mplex/pull/52)) - - fix: reset a stream even if closed remotely ([libp2p/go-mplex#50](https://github.com/libp2p/go-mplex/pull/50)) - - downgrade Error log to Warning ([libp2p/go-mplex#46](https://github.com/libp2p/go-mplex/pull/46)) - - Fix race condition by adding a mutex for deadline access ([libp2p/go-mplex#41](https://github.com/libp2p/go-mplex/pull/41)) -- github.com/libp2p/go-msgio (v0.0.1 -> v0.0.2): - - fix: never claim to read more than read ([libp2p/go-msgio#12](https://github.com/libp2p/go-msgio/pull/12)) -- github.com/libp2p/go-ws-transport (v0.0.2 -> v0.0.4): - - dep: import go-smux-* into the libp2p org ([libp2p/go-ws-transport#43](https://github.com/libp2p/go-ws-transport/pull/43)) - - replace gx instructions with note about gomod ([libp2p/go-ws-transport#42](https://github.com/libp2p/go-ws-transport/pull/42)) - - -## 0.4.20 2019-04-16 - -We're happy to release go-ipfs 0.4.20. This release includes some critical -performance and stability fixes so all users should upgrade ASAP. - -This is also the first release to use go modules instead of GX. While GX has -been a great way to dogfood an IPFS-based package manager, building and -maintaining a custom package manager is a _lot_ of work and we haven't been able -to dedicate enough time to bring the user experience of gx to an acceptable -level. You can read [#5850](https://github.com/ipfs/go-ipfs/issues/5850) for -some discussion on this matter. - -### Docker - -As of this release, it's now much easier to run arbitrary IPFS commands within -the docker container: - -```bash -> docker run --name my-ipfs ipfs/go-ipfs:v0.4.20 config profile apply server # apply the server profile -> docker start my-ipfs # start the daemon -``` - -This release also [reverts](https://github.com/ipfs/go-ipfs/pull/6040) a change that -caused some significant trouble in 0.4.19. If you've been running into Docker -permission errors in 0.4.19, please upgrade. - -### WebUI - -This release contains a major -[WebUI](https://github.com/ipfs-shipyard/ipfs-webui) release with some -significant improvements to the file browser and new opt-in, privately hosted, -anonymous usage analytics. - -### Commands - -As usual, we've made several changes and improvements to our commands. The most -notable changes are listed in this section. - -#### New: `ipfs version deps` - -This release includes a new command, `ipfs version deps`, to list all -dependencies (with versions) of the current go-ipfs build. This should make it -easy to tell exactly how go-ipfs was built when tracking down issues. - -#### New: `ipfs add URL` - -The `ipfs add` command has gained support for URLs. This means you can: - -1. Add files with `ipfs add URL` instead of downloading the file first. -2. Replace all uses of the `ipfs urlstore` command with a call to `ipfs add - --nocopy`. The `ipfs urlstore` command will be deprecated in a future - release. - - -#### Changed: `ipfs swarm connect` - -The `ipfs swarm connect` command has a few new features: - -It now marks the newly created connection as "important". This should ensure -that the connection manager won't come along later and close the connection if -it doesn't think it's being used. - -It can now resolve `/dnsaddr` addresses that _don't_ end in a peer ID. For -example, you can now run `ipfs swarm connect /dnsaddr/bootstrap.libp2p.io` to -connect to one of the bootstrap peers at random. NOTE: This could connect you to -an _arbitrary_ peer as DNS is not secure (by default). Please do not rely on -this except for testing or unless you know what you're doing. - -Finally, `ipfs swarm connect` now returns _all_ errors on failure. This should -make it much easier to debug connectivity issues. For example, one might see an -error like: - -``` -Error: connect QmYou failure: dial attempt failed: 6 errors occurred: - * --> (/ip4/127.0.0.1/tcp/4001) dial attempt failed: dial tcp4 127.0.0.1:4001: connect: connection refused - * --> (/ip6/::1/tcp/4001) dial attempt failed: dial tcp6 [::1]:4001: connect: connection refused - * --> (/ip6/2604::1/tcp/4001) dial attempt failed: dial tcp6 [2604::1]:4001: connect: network is unreachable - * --> (/ip6/2602::1/tcp/4001) dial attempt failed: dial tcp6 [2602::1]:4001: connect: network is unreachable - * --> (/ip4/150.0.1.2/tcp/4001) dial attempt failed: dial tcp4 0.0.0.0:4001->150.0.1.2:4001: i/o timeout - * --> (/ip4/200.0.1.2/tcp/4001) dial attempt failed: dial tcp4 0.0.0.0:4001->200.0.1.2:4001: i/o timeout -``` - -#### Changed: `ipfs bitswap stat` - -`ipfs bitswap stat` no longer lists bitswap partners unless the `-v` flag is -passed. That is, it will now return: - -``` -> ipfs bitswap stat -bitswap status - provides buffer: 0 / 256 - blocks received: 0 - blocks sent: 79 - data received: 0 - data sent: 672706 - dup blocks received: 0 - dup data received: 0 B - wantlist [0 keys] - partners [197] -``` - -Instead of: - -``` -> ipfs bitswap stat -v -bitswap status - provides buffer: 0 / 256 - blocks received: 0 - blocks sent: 79 - data received: 0 - data sent: 672706 - dup blocks received: 0 - dup data received: 0 B - wantlist [0 keys] - partners [203] - QmNQTTTRCDpCYCiiu6TYWCqEa7ShAUo9jrZJvWngfSu1mL - QmNWaxbqERvdcgoWpqAhDMrbK2gKi3SMGk3LUEvfcqZcf4 - QmNgSVpgZVEd41pBX6DyCaHRof8UmUJLqQ3XH2qNL9xLvN - ... omitting 200 lines ... -``` - -#### Changed: `ipfs repo stat --human` - -The `--human` flag in the `ipfs repo stat` command now intelligently picks a -size unit instead of always using MiB. - -#### Changed: `ipfs resolve` (`ipfs dns`, `ipfs name resolve`) - -All of the resolve commands now: - -1. Resolve _recursively_ (up to 32 steps) by default to better match user - expectations (these commands used to be non-recursive by default). To turn - recursion off, pass `-r false`. -2. When resolving non-recursively, these commands no longer fail when partially - resolving a name. Instead, they simply return the intermediate result. - -#### Changed: `ipfs files flush` - -The `ipfs files flush` command now returns the CID of the flushed file. - -### Performance And Reliability - -This release has the usual collection of performance and reliability -improvements. - -#### Badger Memory Usage - -Those of you using the badger datastore should notice reduced memory usage in -this release due to some upstream changes. Badger still uses significantly more -memory than the default datastore configuration but this will hopefully continue -to improve. - -#### Bitswap - -We fixed some critical CPU utilization regressions in bitswap for this release. -If you've been noticing CPU _regressions_ in go-ipfs 0.4.19, especially when -running a public gateway, upgrading to 0.4.20 will likely fix them. - -#### Relays - -After AutoRelay was introduced in go-ipfs 0.4.19, the number of peers connecting -through relays skyrocketed to over 120K concurrent peers. This highlighted some -performance issues that we've now fixed in this release. Specifically: - -* We've significantly reduced the amount of memory allocated per-peer. -* We've fixed a bug where relays might, in rare cases, try to actively dial a - peer to relay traffic. By default, relays only forward traffic between peers - already connected to the relay. -* We've fixed quite a number of performance issues that only show up when - rapidly forming new connections. This will actually help _all_ nodes but will - especially help relays. - -If you've enabled relay _hop_ (`Swarm.EnableRelayHop`) in go-ipfs 0.4.19 and it -hasn't burned down your machine yet, this release should improve things -significantly. However, relays are still under heavy load so running an open -relay will continue to be resource intensive. - -We're continuing to investigate this issue and have a few more patches on the -way that, unfortunately, won't make it into this release. - -#### Panics - -We've fixed two notable panics in this release: - -* We've fixed a frequent panic in the DHT. -* We've fixed an occasional panic in the experimental QUIC transport. - -### Content Routing - -IPFS announces and finds content by sending and retrieving content routing -("provider") records to and from the DHT. Unfortunately, sending out these -records can be quite resource intensive. - -This release has two changes to alleviate this: a reduced number of initial -provide workers and a persistent provider queue. - -We've reduced the number of parallel initial provide workers (workers that send -out provider records when content is initially added to go-ipfs) from 512 to 6. -Each provide request (currently, due to some issues in our DHT) tries to -establish hundreds of connections, significantly impacting the performance of -go-ipfs and [crashing some -routers](https://github.com/ipfs/go-ipfs/issues/3320). - -We've introduced a new persistent provider queue for files added via `ipfs add` -and `ipfs pin add`. When new directory trees are added to go-ipfs, go-ipfs will -add the root/final CID to this queue. Then, in the background, go-ipfs will walk -the queue, sequentially sending out provider records for each CID. - -This ensures that root CIDs are sent out as soon as possible and are sent even -when files are added when the go-ipfs daemon isn't running. - -By example, let's add a directory tree to go-ipfs: - -```bash -> # We're going to do this in "online" mode first so let's start the daemon. -> ipfs daemon & -... -Daemon is ready -> # Now, we're going to create a directory to add. -> mkdir foo -> for i in {0..1000}; do echo do echo $i > foo/$i; done -> # finally, we're going to add it. -> ipfs add -r foo -added QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9 foo/0 -... -added QmQac2chFyJ24yfG2Dfuqg1P5gipLcgUDuiuYkQ5ExwGap foo/990 -added QmQWwz9haeQ5T2QmQeXzqspKdowzYELShBCLzLJjVa2DuV foo/991 -added QmQ5D4MtHUN4LTS4n7mgyHyaUukieMMyCfvnzXQAAbgTJm foo/992 -added QmZq4n4KRNq3k1ovzxJ4qdQXZSrarfJjnoLYPR3ztHd7EY foo/993 -added QmdtrsuVf8Nf1s1MaSjLAd54iNqrn1KN9VoFNgKGnLgjbt foo/994 -added QmbstvU9mnW2hsE94WFmw5WbrXdLTu2Sf9kWWSozrSDscL foo/995 -added QmXFd7f35gAnmisjfFmfYKkjA3F3TSpvUYB9SXr6tLsdg8 foo/996 -added QmV5BxS1YQ9V227Np2Cq124cRrFDAyBXNMqHHa6kpJ9cr6 foo/997 -added QmcXsccUtwKeQ1SuYC3YgyFUeYmAR9CXwGGnT3LPeCg5Tx foo/998 -added Qmc4mcQcpaNzyDQxQj5SyxwFg9ZYz5XBEeEZAuH4cQirj9 foo/999 -added QmXpXzUhcS9edmFBuVafV5wFXKjfXkCQcjAUZsTs7qFf3G foo -``` - -In 0.4.19, we would have sent out provider records for files `foo/{0..1000}` -_before_ sending out a provider record for `foo`. If you were ask a friend to -download /ipfs/QmUQcSjQx2bg4cSe2rUZyQi6F8QtJFJb74fWL7D784UWf9, they would -(baring other issues) be able to find it pretty quickly as this is the first CID -you'll have announced to the network. However, if you ask your friend to -download /ipfs/QmXpXzUhcS9edmFBuVafV5wFXKjfXkCQcjAUZsTs7qFf3G/0, they'll have to -wait for you to finish telling the network about every file in `foo` first. - -In 0.4.20, we _immediately_ tell the network about -`QmXpXzUhcS9edmFBuVafV5wFXKjfXkCQcjAUZsTs7qFf3G` (the `foo` directory) as soon -as we finish adding the directory to go-ipfs _without_ waiting to finish -announcing `foo/{0..1000}`. This is especially important in this release -because we've drastically reduced the number of provide workers. - -The second benefit is that this queue is persistent. That means go-ipfs won't -forget to send out this record, even if it was offline when the content was -initially added. NOTE: go-ipfs _does_ continuously _re_-send provider records in -the background twice a day, it just might be a while before it gets around to -sending one out any specific one. - -### Bitswap - -Bitswap now periodically re-sends its wantlist to connected peers. This should -help work around some race conditions we've seen in bitswap where one node wants -a block but the other doesn't know for some reason. - -You can track this issue here: https://github.com/ipfs/go-ipfs/issues/5183. - -### Improved NAT Traversal - -While NATs are still p2p enemy #1, this release includes slightly improved -support for traversing them. - -Specifically, this release now: - -1. Better detects the "gateway" NAT, even when multiple devices on the network - _claim_ to be NATs. -2. Better guesses the external IP address when port mapping, even when the - gateway lies. - -### Reduced AutoRelay Boot Time - -The experimental AutoRelay feature can now detect NATs _much_ faster as we've -reduced initial NAT detection delay to 15 seconds. There's still room for -improvement but this should make nodes that have enabled this feature dialable -earlier on start. - -### Changelogs - -- github.com/ipfs/go-ipfs: - - gitattributes: avoid normalizing known binary files ([ipfs/go-ipfs#6209](https://github.com/ipfs/go-ipfs/pull/6209)) - - gitattributes: default to LF ([ipfs/go-ipfs#6198](https://github.com/ipfs/go-ipfs/pull/6198)) - - Fix level db panic ([ipfs/go-ipfs#6186](https://github.com/ipfs/go-ipfs/pull/6186)) - - Dockerfile: Remove 2 year old deprecation warning ([ipfs/go-ipfs#6188](https://github.com/ipfs/go-ipfs/pull/6188)) - - align output for the command ipfs object stat ([ipfs/go-ipfs#6189](https://github.com/ipfs/go-ipfs/pull/6189)) - - provider queue: don't repeatedly retry the same item if we fail ([ipfs/go-ipfs#6187](https://github.com/ipfs/go-ipfs/pull/6187)) - - test: remove version/deps from ro commands test ([ipfs/go-ipfs#6185](https://github.com/ipfs/go-ipfs/pull/6185)) - - feat: add version deps command [modversion] ([ipfs/go-ipfs#6115](https://github.com/ipfs/go-ipfs/pull/6115)) - - readme: update for go modules ([ipfs/go-ipfs#6180](https://github.com/ipfs/go-ipfs/pull/6180)) - - Switch to Go 1.12 ([ipfs/go-ipfs#6144](https://github.com/ipfs/go-ipfs/pull/6144)) - - ci: avoid interleaving output from different sharness tests ([ipfs/go-ipfs#6175](https://github.com/ipfs/go-ipfs/pull/6175)) - - fix two bugs where the repo may not properly be closed ([ipfs/go-ipfs#6176](https://github.com/ipfs/go-ipfs/pull/6176)) - - fix error check in swarm connect ([ipfs/go-ipfs#6174](https://github.com/ipfs/go-ipfs/pull/6174)) - - feat(coreapi): tag all explicit connect requests in the connection manager ([ipfs/go-ipfs#6171](https://github.com/ipfs/go-ipfs/pull/6171)) - - chore: remove CODEOWNERS ([ipfs/go-ipfs#6172](https://github.com/ipfs/go-ipfs/pull/6172)) - - feat: update to IPFS Web UI 2.4.4 ([ipfs/go-ipfs#6169](https://github.com/ipfs/go-ipfs/pull/6169)) - - fix add error handling ([ipfs/go-ipfs#6156](https://github.com/ipfs/go-ipfs/pull/6156)) - - chore: remove waffle ([ipfs/go-ipfs#6157](https://github.com/ipfs/go-ipfs/pull/6157)) - - chore: fix a bunch of issues caught by golangci-lint ([ipfs/go-ipfs#6140](https://github.com/ipfs/go-ipfs/pull/6140)) - - docs/experimental-features.md: link to ipfs-ds-convert ([ipfs/go-ipfs#6154](https://github.com/ipfs/go-ipfs/pull/6154)) - - interrupt: fix send on closed ([ipfs/go-ipfs#6147](https://github.com/ipfs/go-ipfs/pull/6147)) - - docs: document Gateway.Writable not Gateway.Writeable ([ipfs/go-ipfs#6151](https://github.com/ipfs/go-ipfs/pull/6151)) - - Fuse fixes ([ipfs/go-ipfs#6135](https://github.com/ipfs/go-ipfs/pull/6135)) - - Remove duplicate blockstore from the package list ([ipfs/go-ipfs#6138](https://github.com/ipfs/go-ipfs/pull/6138)) - - Query for provider head/tail ([ipfs/go-ipfs#6125](https://github.com/ipfs/go-ipfs/pull/6125)) - - Remove dead link from ISSUE_TEMPLATE.md ([ipfs/go-ipfs#6128](https://github.com/ipfs/go-ipfs/pull/6128)) - - coreapi: remove Unixfs.Wrap ([ipfs/go-ipfs#6123](https://github.com/ipfs/go-ipfs/pull/6123)) - - coreapi unixfs: change Wrap logic to make more sense ([ipfs/go-ipfs#6019](https://github.com/ipfs/go-ipfs/pull/6019)) - - deps: switch back to jbenet go-is-domain ([ipfs/go-ipfs#6119](https://github.com/ipfs/go-ipfs/pull/6119)) - - command repo stat: add human flag tests to t0080-repo.sh ([ipfs/go-ipfs#6116](https://github.com/ipfs/go-ipfs/pull/6116)) - - gc: fix a potential deadlock ([ipfs/go-ipfs#6112](https://github.com/ipfs/go-ipfs/pull/6112)) - - fix config options in osxfuse error messages ([ipfs/go-ipfs#6105](https://github.com/ipfs/go-ipfs/pull/6105)) - - Command repo stat: improve human flag behavior ([ipfs/go-ipfs#6106](https://github.com/ipfs/go-ipfs/pull/6106)) - - Provide root node immediately on add and pin add ([ipfs/go-ipfs#6068](https://github.com/ipfs/go-ipfs/pull/6068)) - - gomod: Update Dockerfile, remove Dockerfile.fast ([ipfs/go-ipfs#6100](https://github.com/ipfs/go-ipfs/pull/6100)) - - Return CID from 'ipfs files flush' ([ipfs/go-ipfs#6102](https://github.com/ipfs/go-ipfs/pull/6102)) - - resolve: fix recursion ([ipfs/go-ipfs#6087](https://github.com/ipfs/go-ipfs/pull/6087)) - - fix(swarm): add dnsaddr support in swarm connect ([ipfs/go-ipfs#5535](https://github.com/ipfs/go-ipfs/pull/5535)) - - make in-memory datastore thread-safe ([ipfs/go-ipfs#6085](https://github.com/ipfs/go-ipfs/pull/6085)) - - Update package table to remove broken jenkins links ([ipfs/go-ipfs#6084](https://github.com/ipfs/go-ipfs/pull/6084)) - - mk: fix maketarball to work with gomod ([ipfs/go-ipfs#6078](https://github.com/ipfs/go-ipfs/pull/6078)) - - fix ls command to use the new coreinterface types ([ipfs/go-ipfs#6051](https://github.com/ipfs/go-ipfs/pull/6051)) - - mk: remove install_unsupported, leave a note ([ipfs/go-ipfs#6063](https://github.com/ipfs/go-ipfs/pull/6063)) - - mk: change git-hash command to include information about modifications ([ipfs/go-ipfs#6060](https://github.com/ipfs/go-ipfs/pull/6060)) - - mk: fix make install by not setting GOBIN ([ipfs/go-ipfs#6059](https://github.com/ipfs/go-ipfs/pull/6059)) - - go: require Golang 1.11.4 ([ipfs/go-ipfs#6057](https://github.com/ipfs/go-ipfs/pull/6057)) - - yamux: increase yamux window size to 8MiB. ([ipfs/go-ipfs#6049](https://github.com/ipfs/go-ipfs/pull/6049)) - - Introduce go modules [yey] ([ipfs/go-ipfs#6038](https://github.com/ipfs/go-ipfs/pull/6038)) - - cleanup daemon online logic ([ipfs/go-ipfs#6050](https://github.com/ipfs/go-ipfs/pull/6050)) - - ci: test on 32bit os ([ipfs/go-ipfs#5429](https://github.com/ipfs/go-ipfs/pull/5429)) - - feat/cmds: hide peers info default in bitswap stat ([ipfs/go-ipfs#5820](https://github.com/ipfs/go-ipfs/pull/5820)) - - Improve CLI help pages ([ipfs/go-ipfs#6013](https://github.com/ipfs/go-ipfs/pull/6013)) - - Close #6044 ([ipfs/go-ipfs#6045](https://github.com/ipfs/go-ipfs/pull/6045)) - - commands(dht): return final error ([ipfs/go-ipfs#6034](https://github.com/ipfs/go-ipfs/pull/6034)) - - Revert "Really run as non-root user in docker container" ([ipfs/go-ipfs#6040](https://github.com/ipfs/go-ipfs/pull/6040)) -- github.com/ipfs/go-bitswap: - - feat(messagequeue): rebroadcast wantlist ([ipfs/go-bitswap#106](https://github.com/ipfs/go-bitswap/pull/106)) - - reduce provide workers to 6 ([ipfs/go-bitswap#93](https://github.com/ipfs/go-bitswap/pull/93)) - - Reduce memory allocation ([ipfs/go-bitswap#103](https://github.com/ipfs/go-bitswap/pull/103)) - - refactor(messagequeue): remove dead code ([ipfs/go-bitswap#98](https://github.com/ipfs/go-bitswap/pull/98)) - - fix: limit use of custom context type ([ipfs/go-bitswap#89](https://github.com/ipfs/go-bitswap/pull/89)) - - fix: remove non-error log message ([ipfs/go-bitswap#91](https://github.com/ipfs/go-bitswap/pull/91)) - - fix(messagequeue): Remove second run loop ([ipfs/go-bitswap#94](https://github.com/ipfs/go-bitswap/pull/94)) -- github.com/ipfs/go-blockservice: - - Revert "Remove verifcid as it is handled in go-cid" ([ipfs/go-blockservice#25](https://github.com/ipfs/go-blockservice/pull/25)) - - Remove verifcid as it is handled in go-cid ([ipfs/go-blockservice#23](https://github.com/ipfs/go-blockservice/pull/23)) -- github.com/ipfs/go-datastore: - - cleanup and optimize naive query filters ([ipfs/go-datastore#125](https://github.com/ipfs/go-datastore/pull/125)) - - Fix – sorted limited offset mount queries ([ipfs/go-datastore#124](https://github.com/ipfs/go-datastore/pull/124)) - - Fix function comments based on best practices from Effective Go ([ipfs/go-datastore#122](https://github.com/ipfs/go-datastore/pull/122)) - - remove ThreadSafeDatastore ([ipfs/go-datastore#120](https://github.com/ipfs/go-datastore/pull/120)) - - Splinter TTLDatastore interface into TTL + Datastore ([ipfs/go-datastore#118](https://github.com/ipfs/go-datastore/pull/118)) -- github.com/ipfs/go-ds-badger: - - tweak the default options ([ipfs/go-ds-badger#52](https://github.com/ipfs/go-ds-badger/pull/52)) - - remove thread-safe assertion ([ipfs/go-ds-badger#55](https://github.com/ipfs/go-ds-badger/pull/55)) - - make memory-safe against concurrent closure/operations ([ipfs/go-ds-badger#53](https://github.com/ipfs/go-ds-badger/pull/53)) - - make badger use our logging framework ([ipfs/go-ds-badger#50](https://github.com/ipfs/go-ds-badger/pull/50)) -- github.com/ipfs/go-ds-flatfs: - - remove thread-safe assertion ([ipfs/go-ds-flatfs#53](https://github.com/ipfs/go-ds-flatfs/pull/53)) -- github.com/ipfs/go-ds-leveldb: - - Fast reverse query ([ipfs/go-ds-leveldb#28](https://github.com/ipfs/go-ds-leveldb/pull/28)) - - remove thread-safe assertion ([ipfs/go-ds-leveldb#27](https://github.com/ipfs/go-ds-leveldb/pull/27)) -- github.com/ipfs/go-ipfs-cmdkit: - - Extract files package ([ipfs/go-ipfs-cmdkit#31](https://github.com/ipfs/go-ipfs-cmdkit/pull/31)) -- github.com/ipfs/go-ipfs-cmds: - - sync: add yet another sync error ([ipfs/go-ipfs-cmds#161](https://github.com/ipfs/go-ipfs-cmds/pull/161)) - - Removed broken link from readme ([ipfs/go-ipfs-cmds#159](https://github.com/ipfs/go-ipfs-cmds/pull/159)) - - Fix broken link in readme ([ipfs/go-ipfs-cmds#160](https://github.com/ipfs/go-ipfs-cmds/pull/160)) - - set WebFile fpath to URL base ([ipfs/go-ipfs-cmds#158](https://github.com/ipfs/go-ipfs-cmds/pull/158)) - - Handle stdin name in cli/parse ([ipfs/go-ipfs-cmds#157](https://github.com/ipfs/go-ipfs-cmds/pull/157)) - - support url paths as files.WebFile ([ipfs/go-ipfs-cmds#154](https://github.com/ipfs/go-ipfs-cmds/pull/154)) - - typed encoder: improve pointer reflection ([ipfs/go-ipfs-cmds#155](https://github.com/ipfs/go-ipfs-cmds/pull/155)) - - cli: don't sync output to NUL on Windows ([ipfs/go-ipfs-cmds#153](https://github.com/ipfs/go-ipfs-cmds/pull/153)) -- github.com/ipfs/go-ipfs-files: - - return url as AbsPath from WebFile to implement FileInfo ([ipfs/go-ipfs-files#13](https://github.com/ipfs/go-ipfs-files/pull/13)) - - fix the content disposition header ([ipfs/go-ipfs-files#14](https://github.com/ipfs/go-ipfs-files/pull/14)) - - go format ([ipfs/go-ipfs-files#15](https://github.com/ipfs/go-ipfs-files/pull/15)) - - simplify content type checking ([ipfs/go-ipfs-files#9](https://github.com/ipfs/go-ipfs-files/pull/9)) - - remove extra webfile test code ([ipfs/go-ipfs-files#12](https://github.com/ipfs/go-ipfs-files/pull/12)) -- github.com/ipfs/go-merkledag: - - add function to marshal raw nodes to json ([ipfs/go-merkledag#36](https://github.com/ipfs/go-merkledag/pull/36)) - - fix some performance regressions when reading protobuf nodes ([ipfs/go-merkledag#34](https://github.com/ipfs/go-merkledag/pull/34)) -- github.com/ipfs/go-metrics-interface: - - update the counter interface to match prometheus ([ipfs/go-metrics-interface#2](https://github.com/ipfs/go-metrics-interface/pull/2)) -- github.com/ipfs/go-mfs: - - Return node from FlushPath ([ipfs/go-mfs#72](https://github.com/ipfs/go-mfs/pull/72)) - - Wire up context to FlushPath ([ipfs/go-mfs#70](https://github.com/ipfs/go-mfs/pull/70)) -- github.com/ipfs/interface-go-ipfs-core: - - don't close the top-level addr ([ipfs/interface-go-ipfs-core#25](https://github.com/ipfs/interface-go-ipfs-core/pull/25)) - - fix a bunch of small test "bugs" ([ipfs/interface-go-ipfs-core#24](https://github.com/ipfs/interface-go-ipfs-core/pull/24)) - - remove Wrap ([ipfs/interface-go-ipfs-core#21](https://github.com/ipfs/interface-go-ipfs-core/pull/21)) - - Unixfs.Wrap Fixes ([ipfs/interface-go-ipfs-core#10](https://github.com/ipfs/interface-go-ipfs-core/pull/10)) - - tweak the Ls interface ([ipfs/interface-go-ipfs-core#14](https://github.com/ipfs/interface-go-ipfs-core/pull/14)) -- github.com/libp2p/go-buffer-pool: - - Enable tests ([libp2p/go-buffer-pool#6](https://github.com/libp2p/go-buffer-pool/pull/6)) -- github.com/libp2p/go-flow-metrics: - - Just repair spelling mistake ([libp2p/go-flow-metrics#3](https://github.com/libp2p/go-flow-metrics/pull/3)) -- github.com/libp2p/go-libp2p: - - Deprecate gx in readme & link to workspace repo ([libp2p/go-libp2p#591](https://github.com/libp2p/go-libp2p/pull/591)) - - Respect nodial option in routed host ([libp2p/go-libp2p#590](https://github.com/libp2p/go-libp2p/pull/590)) - - fix panic in observed address activation check ([libp2p/go-libp2p#586](https://github.com/libp2p/go-libp2p/pull/586)) - - Improve observed address handling ([libp2p/go-libp2p#585](https://github.com/libp2p/go-libp2p/pull/585)) - - identify: avoid parsing/printing multiaddrs ([libp2p/go-libp2p#583](https://github.com/libp2p/go-libp2p/pull/583)) - - move things outside of the lock in obsaddr ([libp2p/go-libp2p#582](https://github.com/libp2p/go-libp2p/pull/582)) - - identify: be more careful about the addresses we store ([libp2p/go-libp2p#577](https://github.com/libp2p/go-libp2p/pull/577)) - - relay: turn autorelay into a service and always filter out relay addresses ([libp2p/go-libp2p#578](https://github.com/libp2p/go-libp2p/pull/578)) - - chore: fail in the libp2p constructor if we fail to store the key ([libp2p/go-libp2p#576](https://github.com/libp2p/go-libp2p/pull/576)) - - Fix broken link in README.md ([libp2p/go-libp2p#580](https://github.com/libp2p/go-libp2p/pull/580)) - - Link to docs & discuss in readme ([libp2p/go-libp2p#571](https://github.com/libp2p/go-libp2p/pull/571)) - - Reduce autorelay boot delay and correctly handle private->public transition ([libp2p/go-libp2p#570](https://github.com/libp2p/go-libp2p/pull/570)) - - reduce nat error level ([libp2p/go-libp2p#568](https://github.com/libp2p/go-libp2p/pull/568)) - - relay: simplify declaration of multiaddr var ([libp2p/go-libp2p#563](https://github.com/libp2p/go-libp2p/pull/563)) - - Fix UDP listen on a Unspecified Address and Dial from the Unspecified Address ([libp2p/go-libp2p#561](https://github.com/libp2p/go-libp2p/pull/561)) - - Remove jenkins column from package table ([libp2p/go-libp2p#562](https://github.com/libp2p/go-libp2p/pull/562)) - - Fix typos in p2p/net/README.md ([libp2p/go-libp2p#555](https://github.com/libp2p/go-libp2p/pull/555)) - - better nat mapping ([libp2p/go-libp2p#549](https://github.com/libp2p/go-libp2p/pull/549)) -- github.com/libp2p/go-libp2p-autonat: - - fully close the autonat client stream ([libp2p/go-libp2p-autonat#21](https://github.com/libp2p/go-libp2p-autonat/pull/21)) - - parallelize dialbacks ([libp2p/go-libp2p-autonat#20](https://github.com/libp2p/go-libp2p-autonat/pull/20)) - - Pacify the race detector ([libp2p/go-libp2p-autonat#17](https://github.com/libp2p/go-libp2p-autonat/pull/17)) -- github.com/libp2p/go-libp2p-autonat-svc: - - full close the autonat stream ([libp2p/go-libp2p-autonat-svc#20](https://github.com/libp2p/go-libp2p-autonat-svc/pull/20)) - - reduce dialback timeout to 15s ([libp2p/go-libp2p-autonat-svc#17](https://github.com/libp2p/go-libp2p-autonat-svc/pull/17)) -- github.com/libp2p/go-libp2p-circuit: - - use buffer pool in newDelimitedReader ([libp2p/go-libp2p-circuit#71](https://github.com/libp2p/go-libp2p-circuit/pull/71)) - - Use NoDial option when opening hop streams for non-active relays ([libp2p/go-libp2p-circuit#70](https://github.com/libp2p/go-libp2p-circuit/pull/70)) - - use io.CopyBuffer with explicitly allocated buffers ([libp2p/go-libp2p-circuit#69](https://github.com/libp2p/go-libp2p-circuit/pull/69)) - - docs and nits ([libp2p/go-libp2p-circuit#66](https://github.com/libp2p/go-libp2p-circuit/pull/66)) -- github.com/libp2p/go-libp2p-kad-dht: - - dialQueue: start the control loop later ([libp2p/go-libp2p-kad-dht#312](https://github.com/libp2p/go-libp2p-kad-dht/pull/312)) - - make it work in wasm ([libp2p/go-libp2p-kad-dht#310](https://github.com/libp2p/go-libp2p-kad-dht/pull/310)) - - Revert "GoModules: Checksum mismatch:" ([libp2p/go-libp2p-kad-dht#309](https://github.com/libp2p/go-libp2p-kad-dht/pull/309)) - - defer dialqueue action until initial peers have been added ([libp2p/go-libp2p-kad-dht#301](https://github.com/libp2p/go-libp2p-kad-dht/pull/301)) -- github.com/libp2p/go-libp2p-nat: - - switch to libp2p's go-nat fork ([libp2p/go-libp2p-nat#16](https://github.com/libp2p/go-libp2p-nat/pull/16)) - - remove all uses of multiaddrs ([libp2p/go-libp2p-nat#14](https://github.com/libp2p/go-libp2p-nat/pull/14)) -- github.com/libp2p/go-libp2p-net: - - fix WithNoDial to return the context ([libp2p/go-libp2p-net#43](https://github.com/libp2p/go-libp2p-net/pull/43)) - - NoDial context option ([libp2p/go-libp2p-net#42](https://github.com/libp2p/go-libp2p-net/pull/42)) -- github.com/libp2p/go-libp2p-peer: - - Let ID implement encoding.Binary[Un]Marshaler and encoding.Text[Un]Marshaler ([libp2p/go-libp2p-peer#44](https://github.com/libp2p/go-libp2p-peer/pull/44)) -- github.com/libp2p/go-libp2p-peerstore: - - keep temp addresses for 2 minutes ([libp2p/go-libp2p-peerstore#67](https://github.com/libp2p/go-libp2p-peerstore/pull/67)) - - migrate to multiformats/go-base32 ([libp2p/go-libp2p-peerstore#61](https://github.com/libp2p/go-libp2p-peerstore/pull/61)) -- github.com/libp2p/go-libp2p-protocol: - - update readme ([libp2p/go-libp2p-protocol#6](https://github.com/libp2p/go-libp2p-protocol/pull/6)) - - Enable standard Travis CI tests. ([libp2p/go-libp2p-protocol#5](https://github.com/libp2p/go-libp2p-protocol/pull/5)) - - Fix go get address. ([libp2p/go-libp2p-protocol#4](https://github.com/libp2p/go-libp2p-protocol/pull/4)) - - Add MIT license ([libp2p/go-libp2p-protocol#3](https://github.com/libp2p/go-libp2p-protocol/pull/3)) - - Standardized Readme ([libp2p/go-libp2p-protocol#2](https://github.com/libp2p/go-libp2p-protocol/pull/2)) -- github.com/libp2p/go-libp2p-pubsub-router: - - gx publish 0.5.17 ([libp2p/go-libp2p-pubsub-router#26](https://github.com/libp2p/go-libp2p-pubsub-router/pull/26)) -- github.com/libp2p/go-libp2p-quic-transport: - - update quic-go to v0.11.0 ([libp2p/go-libp2p-quic-transport#54](https://github.com/libp2p/go-libp2p-quic-transport/pull/54)) -- github.com/libp2p/go-libp2p-routing-helpers: - - fix(put): fail if any router fails ([libp2p/go-libp2p-routing-helpers#19](https://github.com/libp2p/go-libp2p-routing-helpers/pull/19)) -- github.com/libp2p/go-libp2p-swarm: - - Add context option to disable dialing when opening a new stream ([libp2p/go-libp2p-swarm#116](https://github.com/libp2p/go-libp2p-swarm/pull/116)) - - return all dial errors if dial has failed ([libp2p/go-libp2p-swarm#115](https://github.com/libp2p/go-libp2p-swarm/pull/115)) - - Differentiate no addresses error from no good addresses ([libp2p/go-libp2p-swarm#113](https://github.com/libp2p/go-libp2p-swarm/pull/113)) -- github.com/libp2p/go-libp2p-transport: - - tests: constrain concurrency with race detector. ([libp2p/go-libp2p-transport#47](https://github.com/libp2p/go-libp2p-transport/pull/47)) - - pick test timeout from env var if available. ([libp2p/go-libp2p-transport#46](https://github.com/libp2p/go-libp2p-transport/pull/46)) - - increase test timeout. ([libp2p/go-libp2p-transport#45](https://github.com/libp2p/go-libp2p-transport/pull/45)) -- github.com/libp2p/go-msgio: - - Improve test coverage ([libp2p/go-msgio#10](https://github.com/libp2p/go-msgio/pull/10)) -- github.com/libp2p/go-reuseport: - - fix: add wasm build tag to wasm module ([libp2p/go-reuseport#70](https://github.com/libp2p/go-reuseport/pull/70)) -- github.com/libp2p/go-reuseport-transport: - - don't set linger to 0 ([libp2p/go-reuseport-transport#14](https://github.com/libp2p/go-reuseport-transport/pull/14)) -- github.com/libp2p/go-tcp-transport: - - set linger to 0 for both inbound and outbound connections ([libp2p/go-tcp-transport#36](https://github.com/libp2p/go-tcp-transport/pull/36)) -- github.com/libp2p/go-ws-transport: - - modernize request handling ([libp2p/go-ws-transport#41](https://github.com/libp2p/go-ws-transport/pull/41)) - -## 0.4.19 2019-03-01 - -We're happy to announce go 0.4.19. This release contains a bunch of important -fixes and a slew of new and improved features. Get pumped and upgrade ASAP to benefit from all the new goodies! 🎁 - -### Features - -#### 🔌 Initializing With Random Ports - -Go-ipfs can now be configured to listen on a random but _stable_ port (across -restarts) using the new `randomports` configuration profile. This should be -helpful when testing and/or running multiple go-ipfs instances on a single -machine. - -To initialize a go-ipfs instance with a randomly chosen port, run: - -```bash -> ipfs init --profile=randomports -``` - -#### 👂 Gateway Directory Listing - -IPNS (and/or DNSLink) directory listings on the gateway, e.g. -https://ipfs.io/ipns/dist.ipfs.io/go-ipfs/, will now display the _ipfs_ hash of -the current directory. This way users can more easily create permanent links to -otherwise mutable data. - -#### 📡 AutoRelay and AutoNAT - -This release introduces two new experimental features (courtesy of libp2p): -AutoRelay and AutoNAT. - -AutoRelay is a new service that automatically chooses a public relay when it -detects that the go-ipfs node is behind a NAT. While relaying connections -through a third-party node isn't the most efficient way to route around NATs, -it's a reliable fallback. - -To enable AutoRelay, set the `Swarm.EnableAutoRelay` option in the config. - -AutoNAT is the service AutoRelay uses to detect if the node is behind a NAT. You -don't have to set any special config flags to enable it. - -In this same config section, you may also notice options like `EnableRelayHop`, -`EnableAutoNATService`, etc. You _do not_ need to enable these: - -* `EnableRelayHop` -- Allow _other_ nodes to use _your_ node as a relay - (disabled by default). -* `EnableAutoNATService` -- Help _other_ nodes detect if they're behind a NAT - (disabled by default). - -#### 📵 Offline Operation - -There are two new "offline" features in this release: a global `--offline` flag -and an option to configure the gateway to not fetch files. - -Most go-ipfs commands now support the `--offline` flag. This causes IPFS to avoid -network operations when performing the requested operation. If you've ever used -the `--local` flag, the `--offline` flag is the (almost) universally supported -replacement. - -For example: - -* If the daemon is started with `ipfs daemon --offline`, it won't even _connect_ - to the network. (note: this feature isn't new, just an example). -* `ipfs add --offline some_file` won't send out provider records. -* `ipfs cat --offline Qm...` won't fetch any blocks from the network. -* `ipfs block stat --offline Qm...` is a great way to tell if a block is locally - available. - -Note: It doesn't _yet_ work with the `refs`, `urlstore`, or `tar` commands -([#6002](https://github.com/ipfs/go-ipfs/issues/6002)). - -On to the gateway, there's a new `Gateway.NoFetch` option to configure the -gateway to only serve locally present files. This makes it possible to run an -IPFS node as a gateway to serve content of _your_ choosing without acting like a -public proxy. 🤫 - -#### 📍 Adding And Pinning Content - -There's a new `--pin` flag for both `ipfs block put` and `ipfs urlstore add` to -match the `--pin` flag in `ipfs add`. This allows one to atomically add and pin -content with these APIs. - -**NOTE 1:** For `ipfs urlstore add`, `--pin` has been enabled _by default_ to -match the behavior in `ipfs add`. However, `ipfs block put` _does not_ pin by -default to match the _current_ behavior. - -**NOTE 2:** If you had previously used the urlstore and _weren't_ explicitly -pinning content after adding it, it isn't pinned and running the garbage -collector will delete it. While technically documented in the `ipfs urlstore -add` helptext, this behavior was non-obvious and bears mentioning. - -#### 🗂 File Listing - -The `ipfs ls` command has two significant changes this release: it reports -_file_ sizes instead of _dag_ sizes and has gained a new `--stream` flag. - -First up, `ipfs ls` now reports _file_ sizes instead of _dag_ sizes. Previously, -for historical reasons, `ipfs ls` would report the size of a file/directory as -seen by IPFS _including_ all the filesystem datastructures and metadata. -However, this meant that `ls -l` and `ipfs ls` would print _different_ sizes: - -```bash -> ipfs ls /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv - -QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about -QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y 200 contact -QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 322 help -QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y 12 ping -QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF 1692 quick-start -QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB 1102 readme -QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm 1173 security-notes - -> ipfs get /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv -Saving file(s) to QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv - 6.39 KiB / 6.39 KiB [================================] 100.00% 0s - -> ls -l QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv -total 28 --rw------- 1 user group 1677 Feb 14 17:03 about --rw------- 1 user group 189 Feb 14 17:03 contact --rw------- 1 user group 311 Feb 14 17:03 help --rw------- 1 user group 4 Feb 14 17:03 ping --rw------- 1 user group 1681 Feb 14 17:03 quick-start --rw------- 1 user group 1091 Feb 14 17:03 readme --rw------- 1 user group 1162 Feb 14 17:03 security-notes -``` - -This is now no longer the case. `ipfs ls` and `ls -l` now return the _same_ -sizes. 🙌 - -Second up, `ipfs ls` now has a new `--stream` flag. In IPFS, very large -directories (e.g., Wikipedia) are split up into multiple chunks (shards) as -there are too many entries to fit in a single block. Unfortunately, `ipfs ls` -buffers the _entire_ file list in memory and then sorts it. This means that -`ipfs ls /ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki` (wikipedia) -will take a _very_ long time to return anything (it'll also use quite a bit of -memory). - -However, the new `--stream` flag makes it possible to stream a directory listing -as new chunks are fetched from the network. To test this, you can run `ipfs ls ---stream --size=false --resolve-type=false -/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki`. You probably won't -want to wait for that command to finish, Wikipedia has a _lot_ of entries. 😉 - -#### 🔁 HTTP Proxy - -This release sees a new (experimental) feature contributed by our friends at -[Peergos](https://peergos.org): HTTP proxy over libp2p. When enabled, the local -gateway can act as an HTTP proxy and forward HTTP requests to libp2p peers. When -combined with the `ipfs p2p` command, users can use this to expose HTTP services -to other go-ipfs nodes via their gateways. For details, check out the -[documentation](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#p2p-http-proxy). - -### Performance And Reliability - -This release introduces quite a few performance/reliability improvements and, as -usual, fixes several memory leaks. Below is a non-exhaustive list of noticeable changes. - -#### 📞 DHT - -This release includes an important DHT fix that should significantly: - -1. Reduce dialing. -2. Speed up DHT queries. -3. Improve performance of the gateways. - -Basically, in the worst case, a DHT query would turn into a random walk of the -entire IPFS network. Yikes! - -Relevant PR: https://github.com/libp2p/go-libp2p-kad-dht/pull/237 - -#### 🕸 Bitswap - -Bitswap sessions have improved and are now used for _all_ requests. Sessions -allow us to group related content and ask peers most likely to _have_ the -content instead of broadcasting the request to all connected peers. This gives -us two significant benefits: - -1. Less wasted upload bandwidth. Instead of broadcasting which blocks we want to - everyone, we can ask fewer peers thus reducing the number of requests we send - out. -2. Less wasted download bandwidth. Because we _know_ which peers likely have - content, we can ask an individual peer for a block and expect to get an - answer. In the past, we'd ask every peer at the same time to optimize for - latency at the expense of bandwidth (getting the same block from multiple - peers). We had to do this because we had to assume that _most_ peers didn't - have the requested block. - -#### ‼️ Pubsub - -This release includes some significant reliability improvements in pubsub -subscription handling. If you've previously had issues with connected pubsub -peers _not_ seeing each-other's messages, please upgrade ASAP. - -#### ♻️ Reuseport - -In this release, we've rewritten our previously error-prone `go-reuseport` -library to _not_ duplicate a significant portion of Go's low-level networking -code. This was made possible by Go's new `Control` -[`net.Dialer`](https://golang.org/pkg/net/#Dialer) option. - -In the past, our first suggestion to anyone experiencing weird resource or -connectivity issues was to disable `REUSEPORT` (set `IPFS_REUSEPORT` to false). -This should no longer be necessary. - -#### 🐺 Badger Datastore - -[Badger has reached 1.0][badger-release]. This release brings an audit and -numerous reliability fixes. We are now reasonably confident that badger will -become the default datastore in a future release. 👍 - -[badger-release]: https://blog.dgraph.io/post/releasing-v1.0/ - -This release also adds a new `Truncate` configuration option for the badger -datastore (enabled by default for new IPFS nodes). When enabled, badger will -_delete_ any un-synced data on start instead of simply refusing to start. This -should be safe on all filesystems where the `sync` operation is safe and removes -the need for manual intervention when restarting an IPFS node after a crash. - -Assuming you initialized your badger repo with `ipfs init --profile=badgerds`, -you can enable truncate on an existing repo by running: `ipfs config --json -"Datastore.Spec.child.truncate" true`. - -### Refactors and Endeavors - -#### 🕹 Commands Library - -The legacy commands library shim has now been completely removed. This won't -mean much for many users but the go-ipfs team is happy to have this behind them. - -#### 🌐 Base32 CIDs - -This release can now encode CIDs in responses in bases other than base58. This -is primarily useful for web-browser integration as it allows us to (a) encode -CIDs in a lower-case base (e.g., base32) and then use them in the _origin_ part -of URLs. The take away is: this release brings us a step closer to better -browser integration. - -Specifically, this release adds two flags: - -1. `--cid-base`: When specified, the IPFS CLI will encode all CIDv1 CIDs using the - requested base. -2. `--upgrade-cidv0-in-output`: When specified, the IPFS CLI will _upgrade_ CIDv0 - CIDs to CIDv1 CIDs when returning them to the user. This upgrade is necessary - because CIDv0 doesn't support multibase however, it's off by default as it - changes the _binary_ representation of the CIDs (which could have unintended - consequences). - -#### 🎛 CoreAPI - -The work on the CoreAPI refactor ([ipfs/go-ipfs#4498][]) has progressed leaps and -bounds this release. The CoreAPI is a comprehensive programmatic interface -designed to allow go-ipfs be used as a daemon or a library interchangeably. - -As of this release, go-ipfs now has: - -* External interface definitions in [ipfs/interface-go-ipfs-core][]. -* A work-in-progress implementation ([ipfs/go-ipfs-http-client][]) of these - interfaces that uses the IPFS HTTP API. This will replace the - ([ipfs/go-ipfs-api][]) library. -* A new plugin type ["Daemon"][daemon-plugin]. Daemon plugins are started and - stopped along with the go-ipfs daemon and are instantiated with a copy of the - CoreAPI. This allows them to control and extend the go-ipfs daemon from within - the daemon itself. - -The next steps are: - -1. Finishing the remaining API surface area. At the moment, the two key missing - parts are: - 1. Config manipulation. - 2. The `ipfs files` API. -1. Finalizing the [ipfs/go-ipfs-http-client][] implementation. -2. Creating a simple way to construct and initialize a go-ipfs node when using - go-ipfs as a library. - -[ipfs/go-ipfs#4498]: https://github.com/ipfs/go-ipfs/issues/4498 -[ipfs/interface-go-ipfs-core]: https://github.com/ipfs/interface-go-ipfs-core -[ipfs/go-ipfs-http-client]: https://github.com/ipfs/go-ipfs-http-client -[ipfs/go-ipfs-api]: https://github.com/ipfs/go-ipfs-http-client -[daemon-plugin]: https://github.com/ipfs/go-ipfs/blob/master/docs/plugins.md#daemon - -### Changelogs - -- github.com/ipfs/go-ipfs: - - fix: show interactive output from install.sh ([ipfs/go-ipfs#6024](https://github.com/ipfs/go-ipfs/pull/6024)) - - fix: return the shortest, completely resolved path in the resolve command ([ipfs/go-ipfs#5704](https://github.com/ipfs/go-ipfs/pull/5704)) - - fix a few interop test issues ([ipfs/go-ipfs#6004](https://github.com/ipfs/go-ipfs/pull/6004)) - - fix HAMT bookmark ln ([ipfs/go-ipfs#6005](https://github.com/ipfs/go-ipfs/pull/6005)) - - docs: document Gateway.NoFetch ([ipfs/go-ipfs#5999](https://github.com/ipfs/go-ipfs/pull/5999)) - - Improve "name publish" ttl option documentation ([ipfs/go-ipfs#5979](https://github.com/ipfs/go-ipfs/pull/5979)) - - fix(cmd/mv): dst filename error ([ipfs/go-ipfs#5964](https://github.com/ipfs/go-ipfs/pull/5964)) - - coreapi: extract interface ([ipfs/go-ipfs#5978](https://github.com/ipfs/go-ipfs/pull/5978)) - - coreapi: cleanup non-gx references ([ipfs/go-ipfs#5976](https://github.com/ipfs/go-ipfs/pull/5976)) - - coreapi: fix seek test on http impl ([ipfs/go-ipfs#5971](https://github.com/ipfs/go-ipfs/pull/5971)) - - block put --pin ([ipfs/go-ipfs#5969](https://github.com/ipfs/go-ipfs/pull/5969)) - - Port `ipfs ls` to CoreAPI ([ipfs/go-ipfs#5962](https://github.com/ipfs/go-ipfs/pull/5962)) - - docs: duplicate default helptext in `name publish` ([ipfs/go-ipfs#5960](https://github.com/ipfs/go-ipfs/pull/5960)) - - plugin: add a daemon plugin with access to the CoreAPI ([ipfs/go-ipfs#5955](https://github.com/ipfs/go-ipfs/pull/5955)) - - coreapi: add some seeker tests ([ipfs/go-ipfs#5934](https://github.com/ipfs/go-ipfs/pull/5934)) - - Refactor ipfs get to use CoreAPI ([ipfs/go-ipfs#5943](https://github.com/ipfs/go-ipfs/pull/5943)) - - refact(cmd/init): change string option to const ([ipfs/go-ipfs#5949](https://github.com/ipfs/go-ipfs/pull/5949)) - - cmds/pin: use coreapi/pin ([ipfs/go-ipfs#5843](https://github.com/ipfs/go-ipfs/pull/5843)) - - Only perform DNSLink lookups on fully qualified domain names (FQDN) ([ipfs/go-ipfs#5950](https://github.com/ipfs/go-ipfs/pull/5950)) - - Fix DontCheckOSXFUSE config command example ([ipfs/go-ipfs#5951](https://github.com/ipfs/go-ipfs/pull/5951)) - - refact(cmd/config): change string option to const ([ipfs/go-ipfs#5948](https://github.com/ipfs/go-ipfs/pull/5948)) - - clarification the document of --resolve flag in name.publish ([ipfs/go-ipfs#5651](https://github.com/ipfs/go-ipfs/pull/5651)) - - Drop some coreunix code ([ipfs/go-ipfs#5938](https://github.com/ipfs/go-ipfs/pull/5938)) - - commands: fix verbose flag ([ipfs/go-ipfs#5940](https://github.com/ipfs/go-ipfs/pull/5940)) - - Fixes #4558 ([ipfs/go-ipfs#5937](https://github.com/ipfs/go-ipfs/pull/5937)) - - Port dag commansds to CoreAPI ([ipfs/go-ipfs#5939](https://github.com/ipfs/go-ipfs/pull/5939)) - - mfs: make sure to flush after mv and chcid ([ipfs/go-ipfs#5936](https://github.com/ipfs/go-ipfs/pull/5936)) - - docs/code-flow : Add code flow documentation for add cmd. ([ipfs/go-ipfs#5864](https://github.com/ipfs/go-ipfs/pull/5864)) - - coreapi: few more error check fixes ([ipfs/go-ipfs#5935](https://github.com/ipfs/go-ipfs/pull/5935)) - - Fixed and cleaned up TestIpfsStressRead ([ipfs/go-ipfs#5920](https://github.com/ipfs/go-ipfs/pull/5920)) - - Clarify that chunker sizes are in bytes ([ipfs/go-ipfs#5923](https://github.com/ipfs/go-ipfs/pull/5923)) - - refact(cmd/patch): change string to const ([ipfs/go-ipfs#5931](https://github.com/ipfs/go-ipfs/pull/5931)) - - refact(cmd/object): change option string to const ([ipfs/go-ipfs#5932](https://github.com/ipfs/go-ipfs/pull/5932)) - - coreapi: replace coreiface.DagAPI with ipld.DAGService ([ipfs/go-ipfs#5922](https://github.com/ipfs/go-ipfs/pull/5922)) - - Add global option to specify the multibase encoding (server side) ([ipfs/go-ipfs#5789](https://github.com/ipfs/go-ipfs/pull/5789)) - - coreapi: Adjust some tests for go-ipfs-http-api ([ipfs/go-ipfs#5926](https://github.com/ipfs/go-ipfs/pull/5926)) - - chore: update to Web UI v2.3.3 ([ipfs/go-ipfs#5928](https://github.com/ipfs/go-ipfs/pull/5928)) - - ls: Report real file size ([ipfs/go-ipfs#5906](https://github.com/ipfs/go-ipfs/pull/5906)) - - Improve the Filestore document ([ipfs/go-ipfs#5927](https://github.com/ipfs/go-ipfs/pull/5927)) - - [CORS] Bubble go-ipfs-cmds 2.0.10 - Updates CORS library ([ipfs/go-ipfs#5919](https://github.com/ipfs/go-ipfs/pull/5919)) - - reduce verbosity of daemon start ([ipfs/go-ipfs#5904](https://github.com/ipfs/go-ipfs/pull/5904)) - - feat: update to Web UI v2.3.2 ([ipfs/go-ipfs#5899](https://github.com/ipfs/go-ipfs/pull/5899)) - - CoreAPI: Don't panic when testing incomplete implementions ([ipfs/go-ipfs#5900](https://github.com/ipfs/go-ipfs/pull/5900)) - - gateway: fix CORs headers ([ipfs/go-ipfs#5893](https://github.com/ipfs/go-ipfs/pull/5893)) - - Local Gateway option ([ipfs/go-ipfs#5649](https://github.com/ipfs/go-ipfs/pull/5649)) - - Show hash on gateway ([ipfs/go-ipfs#5830](https://github.com/ipfs/go-ipfs/pull/5830)) - - fix: ulimit docs mistake ([ipfs/go-ipfs#5894](https://github.com/ipfs/go-ipfs/pull/5894)) - - Move coreapi tests to the interface ([ipfs/go-ipfs#5865](https://github.com/ipfs/go-ipfs/pull/5865)) - - Move checkHelptextRecursive forward a bit ([ipfs/go-ipfs#5889](https://github.com/ipfs/go-ipfs/pull/5889)) - - coreapi/unixfs: Use path instead of raw hash in AddEvent ([ipfs/go-ipfs#5854](https://github.com/ipfs/go-ipfs/pull/5854)) - - Fix name resolve --offline ([ipfs/go-ipfs#5885](https://github.com/ipfs/go-ipfs/pull/5885)) - - testing: slow down republisher sharness test ([ipfs/go-ipfs#5856](https://github.com/ipfs/go-ipfs/pull/5856)) - - docs: flesh out plugin documentation ([ipfs/go-ipfs#5876](https://github.com/ipfs/go-ipfs/pull/5876)) - - main: move InterruptHandler to util ([ipfs/go-ipfs#5872](https://github.com/ipfs/go-ipfs/pull/5872)) - - make: fix building source tarball on macos ([ipfs/go-ipfs#5860](https://github.com/ipfs/go-ipfs/pull/5860)) - - fix config data race ([ipfs/go-ipfs#5634](https://github.com/ipfs/go-ipfs/pull/5634)) - - CoreAPI: Global offline option ([ipfs/go-ipfs#5825](https://github.com/ipfs/go-ipfs/pull/5825)) - - Update for go-ipfs-files refactor ([ipfs/go-ipfs#5661](https://github.com/ipfs/go-ipfs/pull/5661)) - - feat: update Web UI to v2.3.0 ([ipfs/go-ipfs#5855](https://github.com/ipfs/go-ipfs/pull/5855)) - - Stateful plugin loading ([ipfs/go-ipfs#4806](https://github.com/ipfs/go-ipfs/pull/4806)) - - startup: always load the private key ([ipfs/go-ipfs#5844](https://github.com/ipfs/go-ipfs/pull/5844)) - - add --dereference-args parameter ([ipfs/go-ipfs#5801](https://github.com/ipfs/go-ipfs/pull/5801)) - - config: document the connection manager ([ipfs/go-ipfs#5839](https://github.com/ipfs/go-ipfs/pull/5839)) - - add pinning support to the urlstore ([ipfs/go-ipfs#5834](https://github.com/ipfs/go-ipfs/pull/5834)) - - refact(cmd/cat): remove useless code ([ipfs/go-ipfs#5836](https://github.com/ipfs/go-ipfs/pull/5836)) - - Really run as non-root user in docker container ([ipfs/go-ipfs#5048](https://github.com/ipfs/go-ipfs/pull/5048)) - - README: document guix package ([ipfs/go-ipfs#5832](https://github.com/ipfs/go-ipfs/pull/5832)) - - docs: Improve config documentation ([ipfs/go-ipfs#5829](https://github.com/ipfs/go-ipfs/pull/5829)) - - block: rm extra output ([ipfs/go-ipfs#5751](https://github.com/ipfs/go-ipfs/pull/5751)) - - merge github-issue-guide with the issue template ([ipfs/go-ipfs#4636](https://github.com/ipfs/go-ipfs/pull/4636)) - - docs: fix inconsistent capitalization of "API". ([ipfs/go-ipfs#5824](https://github.com/ipfs/go-ipfs/pull/5824)) - - Update README.md ([ipfs/go-ipfs#5818](https://github.com/ipfs/go-ipfs/pull/5818)) - - CONTRIBUTING.md link ([ipfs/go-ipfs#5811](https://github.com/ipfs/go-ipfs/pull/5811)) - - README: Update required Go version ([ipfs/go-ipfs#5813](https://github.com/ipfs/go-ipfs/pull/5813)) - - p2p: report-peer-id option for listen ([ipfs/go-ipfs#5771](https://github.com/ipfs/go-ipfs/pull/5771)) - - really fix netcat race ([ipfs/go-ipfs#5803](https://github.com/ipfs/go-ipfs/pull/5803)) - - [http_proxy_over_p2p] ([ipfs/go-ipfs#5526](https://github.com/ipfs/go-ipfs/pull/5526)) - - coreapi/pin: Use CID's directly in maps instead of converting to string ([ipfs/go-ipfs#5809](https://github.com/ipfs/go-ipfs/pull/5809)) - - Gx update go-merkledag and related deps. ([ipfs/go-ipfs#5802](https://github.com/ipfs/go-ipfs/pull/5802)) - - cmds: rm old lib ([ipfs/go-ipfs#5786](https://github.com/ipfs/go-ipfs/pull/5786)) - - badger: add truncate flag ([ipfs/go-ipfs#5625](https://github.com/ipfs/go-ipfs/pull/5625)) - - docker: allow IPFS_PROFILE to choose the profile for `ipfs init` ([ipfs/go-ipfs#5473](https://github.com/ipfs/go-ipfs/pull/5473)) - - Add --stream option to `ls` command ([ipfs/go-ipfs#5611](https://github.com/ipfs/go-ipfs/pull/5611)) - - Switch to using request.Context() ([ipfs/go-ipfs#5782](https://github.com/ipfs/go-ipfs/pull/5782)) - - Update go-ipfs-delay and assoc deps ([ipfs/go-ipfs#5762](https://github.com/ipfs/go-ipfs/pull/5762)) - - Suppress bootstrap error ([ipfs/go-ipfs#5769](https://github.com/ipfs/go-ipfs/pull/5769)) - - ISSUE_TEMPLATE: move the support question comment to the very top ([ipfs/go-ipfs#5770](https://github.com/ipfs/go-ipfs/pull/5770)) - - cmds: use MakeTypedEncoder ([ipfs/go-ipfs#5760](https://github.com/ipfs/go-ipfs/pull/5760)) - - cmds/bitswap: sort wantlist ([ipfs/go-ipfs#5759](https://github.com/ipfs/go-ipfs/pull/5759)) - - cmds/update: use new cmds lib ([ipfs/go-ipfs#5730](https://github.com/ipfs/go-ipfs/pull/5730)) - - cmds/file: use new cmds lib ([ipfs/go-ipfs#5756](https://github.com/ipfs/go-ipfs/pull/5756)) - - cmds: remove reduntant func ([ipfs/go-ipfs#5750](https://github.com/ipfs/go-ipfs/pull/5750)) - - commands/refs: use new cmds ([ipfs/go-ipfs#5679](https://github.com/ipfs/go-ipfs/pull/5679)) - - commands/pin: use new cmds lib ([ipfs/go-ipfs#5674](https://github.com/ipfs/go-ipfs/pull/5674)) - - commands/boostrap: use new cmds ([ipfs/go-ipfs#5678](https://github.com/ipfs/go-ipfs/pull/5678)) - - fix(cmd/add): progressbar output error when input is read from stdin ([ipfs/go-ipfs#5743](https://github.com/ipfs/go-ipfs/pull/5743)) - - unexport GOFLAGS ([ipfs/go-ipfs#5747](https://github.com/ipfs/go-ipfs/pull/5747)) - - refactor(cmds): use new cmds ([ipfs/go-ipfs#5659](https://github.com/ipfs/go-ipfs/pull/5659)) - - commands/filestore: use new cmds lib ([ipfs/go-ipfs#5673](https://github.com/ipfs/go-ipfs/pull/5673)) - - Fix broken links ([ipfs/go-ipfs#5721](https://github.com/ipfs/go-ipfs/pull/5721)) - - fix `ipfs help` bug #5557 ([ipfs/go-ipfs#5573](https://github.com/ipfs/go-ipfs/pull/5573)) - - commands/bitswap: use new cmds lib ([ipfs/go-ipfs#5676](https://github.com/ipfs/go-ipfs/pull/5676)) - - refact(cmd/repo): repo's sub cmds uses new cmd lib ([ipfs/go-ipfs#5677](https://github.com/ipfs/go-ipfs/pull/5677)) - - fix the maketarball script ([ipfs/go-ipfs#5718](https://github.com/ipfs/go-ipfs/pull/5718)) - - output link to WebUI on daemon startup ([ipfs/go-ipfs#5729](https://github.com/ipfs/go-ipfs/pull/5729)) - - Move persistent datastores to plugins ([ipfs/go-ipfs#5695](https://github.com/ipfs/go-ipfs/pull/5695)) - - Update IPTB test ([ipfs/go-ipfs#5636](https://github.com/ipfs/go-ipfs/pull/5636)) - - enhance(cmd/verify): add goroutine count to improve verify speed ([ipfs/go-ipfs#5710](https://github.com/ipfs/go-ipfs/pull/5710)) - - Update go-mfs and go-unixfs ([ipfs/go-ipfs#5714](https://github.com/ipfs/go-ipfs/pull/5714)) - - fix(flag/version): flag `all` should have a higher priority ([ipfs/go-ipfs#5719](https://github.com/ipfs/go-ipfs/pull/5719)) - - commands/p2p: use new cmds lib ([ipfs/go-ipfs#5672](https://github.com/ipfs/go-ipfs/pull/5672)) - - commands/dht: use new cmds lib ([ipfs/go-ipfs#5671](https://github.com/ipfs/go-ipfs/pull/5671)) - - commands/object: use new cmds ([ipfs/go-ipfs#5666](https://github.com/ipfs/go-ipfs/pull/5666)) - - commands/files: use new cmds ([ipfs/go-ipfs#5665](https://github.com/ipfs/go-ipfs/pull/5665)) - - cmds/env: add a config path helper ([ipfs/go-ipfs#5712](https://github.com/ipfs/go-ipfs/pull/5712)) -- github.com/ipfs/dir-index-html: - - show hash if given ([ipfs/dir-index-html#21](https://github.com/ipfs/dir-index-html/pull/21)) - - Add "jpeg" as an alias to "jpg". ([ipfs/dir-index-html#16](https://github.com/ipfs/dir-index-html/pull/16)) -- github.com/libp2p/go-addr-util: - - Improve test coverage ([libp2p/go-addr-util#14](https://github.com/libp2p/go-addr-util/pull/14)) -- github.com/ipfs/go-bitswap: - - fix(prq): fix a bunch of goroutine leaks and deadlocks ([ipfs/go-bitswap#87](https://github.com/ipfs/go-bitswap/pull/87)) - - remove allocations round two ([ipfs/go-bitswap#84](https://github.com/ipfs/go-bitswap/pull/84)) - - fix(bitswap): remove CancelWants function ([ipfs/go-bitswap#80](https://github.com/ipfs/go-bitswap/pull/80)) - - Avoid allocating for wantlist entries ([ipfs/go-bitswap#79](https://github.com/ipfs/go-bitswap/pull/79)) - - ci(Jenkins): remove Jenkinsfile ([ipfs/go-bitswap#83](https://github.com/ipfs/go-bitswap/pull/83)) - - More specific wantlists ([ipfs/go-bitswap#74](https://github.com/ipfs/go-bitswap/pull/74)) - - fix(wantlist): remove races on setup ([ipfs/go-bitswap#72](https://github.com/ipfs/go-bitswap/pull/72)) - - fix multiple data races ([ipfs/go-bitswap#76](https://github.com/ipfs/go-bitswap/pull/76)) - - ci: add travis ([ipfs/go-bitswap#75](https://github.com/ipfs/go-bitswap/pull/75)) - - providers: don't add every connected node as a provider ([ipfs/go-bitswap#59](https://github.com/ipfs/go-bitswap/pull/59)) - - refactor(GetBlocks): Merge session/non-session ([ipfs/go-bitswap#64](https://github.com/ipfs/go-bitswap/pull/64)) - - Feat: A more robust provider finder for sessions (for now) and soon for all bitswap ([ipfs/go-bitswap#60](https://github.com/ipfs/go-bitswap/pull/60)) - - fix(tests): stabilize session tests ([ipfs/go-bitswap#63](https://github.com/ipfs/go-bitswap/pull/63)) - - contexts: make sure to abort when a context is canceled ([ipfs/go-bitswap#58](https://github.com/ipfs/go-bitswap/pull/58)) - - fix(sessions): explicitly connect found peers ([ipfs/go-bitswap#56](https://github.com/ipfs/go-bitswap/pull/56)) - - Speed up sessions Round #1 ([ipfs/go-bitswap#27](https://github.com/ipfs/go-bitswap/pull/27)) - - Fix debug log formatting issues ([ipfs/go-bitswap#37](https://github.com/ipfs/go-bitswap/pull/37)) - - Feat/bandwidth limited tests ([ipfs/go-bitswap#42](https://github.com/ipfs/go-bitswap/pull/42)) - - fix(tests): stabilize unreliable session tests ([ipfs/go-bitswap#44](https://github.com/ipfs/go-bitswap/pull/44)) - - Bitswap Refactor #4: Extract session peer manager from sessions ([ipfs/go-bitswap#26](https://github.com/ipfs/go-bitswap/pull/26)) - - Bitswap Refactor #3: Extract sessions to package ([ipfs/go-bitswap#30](https://github.com/ipfs/go-bitswap/pull/30)) - - docs(comments): end comment sentences to have full-stop ([ipfs/go-bitswap#33](https://github.com/ipfs/go-bitswap/pull/33)) - - Bitswap Refactor #2: Extract PeerManager From Want Manager + Unit Test ([ipfs/go-bitswap#29](https://github.com/ipfs/go-bitswap/pull/29)) - - Bitswap Refactor #1: Session Manager & Extract Want Manager ([ipfs/go-bitswap#28](https://github.com/ipfs/go-bitswap/pull/28)) - - fix(Receiver): Ignore unwanted blocks ([ipfs/go-bitswap#24](https://github.com/ipfs/go-bitswap/pull/24)) - - feat(Benchmarks): Add real world dup blocks test ([ipfs/go-bitswap#25](https://github.com/ipfs/go-bitswap/pull/25)) - - Feat/bitswap pr improvements ([ipfs/go-bitswap#19](https://github.com/ipfs/go-bitswap/pull/19)) -- github.com/ipfs/go-blockservice: - - Don't return errors on closed exchange ([ipfs/go-blockservice#15](https://github.com/ipfs/go-blockservice/pull/15)) -- github.com/ipfs/go-cid: - - fix inline CIDs generated by Prefix.Sum ([ipfs/go-cid#84](https://github.com/ipfs/go-cid/pull/84)) - - Let Cid implement Binary[Un]Marshaler and Text[Un]Marshaler interfaces. ([ipfs/go-cid#81](https://github.com/ipfs/go-cid/pull/81)) - - fix typo in comment ([ipfs/go-cid#80](https://github.com/ipfs/go-cid/pull/80)) - - add codecs for Dash blocks, tx ([ipfs/go-cid#78](https://github.com/ipfs/go-cid/pull/78)) -- github.com/ipfs/go-cidutil: - - Fix Travis CI to run all tests. ([ipfs/go-cidutil#11](https://github.com/ipfs/go-cidutil/pull/11)) - - Changes needed for `--cid-base` option in go-ipfs (simplified vesion) ([ipfs/go-cidutil#10](https://github.com/ipfs/go-cidutil/pull/10)) - - add a utility method for sorting CID slices ([ipfs/go-cidutil#5](https://github.com/ipfs/go-cidutil/pull/5)) -- github.com/libp2p/go-conn-security: - - fix link to usage example in README ([libp2p/go-conn-security#4](https://github.com/libp2p/go-conn-security/pull/4)) -- github.com/ipfs/go-datastore: - - interfaces: make GetBacked* take a Read instead of a Datastore ([ipfs/go-datastore#115](https://github.com/ipfs/go-datastore/pull/115)) - - remove closer type assertions ([ipfs/go-datastore#112](https://github.com/ipfs/go-datastore/pull/112)) - - remove io.Closer from the transaction interface ([ipfs/go-datastore#113](https://github.com/ipfs/go-datastore/pull/113)) - - feat(datastore): expose datastore Close() ([ipfs/go-datastore#111](https://github.com/ipfs/go-datastore/pull/111)) - - query: make datastore ordering act like a user would expect ([ipfs/go-datastore#110](https://github.com/ipfs/go-datastore/pull/110)) - - delayed: implement io.Closer and export datastore type. ([ipfs/go-datastore#108](https://github.com/ipfs/go-datastore/pull/108)) - - split the datastore into a read and a write interface ([ipfs/go-datastore#107](https://github.com/ipfs/go-datastore/pull/107)) - - Describe behavior of Batching datastores ([ipfs/go-datastore#105](https://github.com/ipfs/go-datastore/pull/105)) - - handle concurrent puts/deletes in BasicBatch ([ipfs/go-datastore#103](https://github.com/ipfs/go-datastore/pull/103)) - - add a GetSize method ([ipfs/go-datastore#99](https://github.com/ipfs/go-datastore/pull/99)) -- github.com/ipfs/go-ds-badger: - - removed additional/wasteful Prefix conversion ([ipfs/go-ds-badger#45](https://github.com/ipfs/go-ds-badger/pull/45)) - - Enable Jenkins ([ipfs/go-ds-badger#35](https://github.com/ipfs/go-ds-badger/pull/35)) - - fix application or ordering for interface change ([ipfs/go-ds-badger#44](https://github.com/ipfs/go-ds-badger/pull/44)) - - Update badger ([ipfs/go-ds-badger#40](https://github.com/ipfs/go-ds-badger/pull/40)) -- github.com/ipfs/go-ds-flatfs: - - fix a goroutine leak killing the gateways ([ipfs/go-ds-flatfs#51](https://github.com/ipfs/go-ds-flatfs/pull/51)) -- github.com/ipfs/go-ds-leveldb: - - Expose Datastore type ([ipfs/go-ds-leveldb#20](https://github.com/ipfs/go-ds-leveldb/pull/20)) - - fix application or ordering for interface change ([ipfs/go-ds-leveldb#23](https://github.com/ipfs/go-ds-leveldb/pull/23)) -- github.com/ipfs/go-ipfs-cmds: - - fix sync error with go1.12 on darwin ([ipfs/go-ipfs-cmds#147](https://github.com/ipfs/go-ipfs-cmds/pull/147)) - - cli: fix ignoring std{out,err} sync errors on windows ([ipfs/go-ipfs-cmds#146](https://github.com/ipfs/go-ipfs-cmds/pull/146)) - - roundup of cleanup fixes ([ipfs/go-ipfs-cmds#144](https://github.com/ipfs/go-ipfs-cmds/pull/144)) - - Update cors library ([ipfs/go-ipfs-cmds#139](https://github.com/ipfs/go-ipfs-cmds/pull/139)) - - expand on the api error ([ipfs/go-ipfs-cmds#138](https://github.com/ipfs/go-ipfs-cmds/pull/138)) - - set the connection close header if we have a body to read ([ipfs/go-ipfs-cmds#116](https://github.com/ipfs/go-ipfs-cmds/pull/116)) - - print a nicer error on timeout/cancel ([ipfs/go-ipfs-cmds#137](https://github.com/ipfs/go-ipfs-cmds/pull/137)) - - Add link traversal option ([ipfs/go-ipfs-cmds#96](https://github.com/ipfs/go-ipfs-cmds/pull/96)) - - Don't skip stdin test on Windows ([ipfs/go-ipfs-cmds#136](https://github.com/ipfs/go-ipfs-cmds/pull/136)) - - MakeTypedEncoder: accept results by pointer or value ([ipfs/go-ipfs-cmds#134](https://github.com/ipfs/go-ipfs-cmds/pull/134)) -- github.com/ipfs/go-ipfs-config: - - Gateway.NoFetch ([ipfs/go-ipfs-config#19](https://github.com/ipfs/go-ipfs-config/pull/19)) - - add a Clone function ([ipfs/go-ipfs-config#16](https://github.com/ipfs/go-ipfs-config/pull/16)) - - randomports: give user ability to init ipfs using random port for swarm. ([ipfs/go-ipfs-config#17](https://github.com/ipfs/go-ipfs-config/pull/17)) - - Allow the use of the User-Agent header ([ipfs/go-ipfs-config#15](https://github.com/ipfs/go-ipfs-config/pull/15)) - - autorelay options ([ipfs/go-ipfs-config#21](https://github.com/ipfs/go-ipfs-config/pull/21)) - - profile: add badger truncate option ([ipfs/go-ipfs-config#20](https://github.com/ipfs/go-ipfs-config/pull/20)) -- github.com/ipfs/go-ipfs-delay: - - Feat/refactor wait time ([ipfs/go-ipfs-delay#1](https://github.com/ipfs/go-ipfs-delay/pull/1)) -- github.com/ipfs/go-ipfs-files: - - multipart: fix handling of common prefixes ([ipfs/go-ipfs-files#7](https://github.com/ipfs/go-ipfs-files/pull/7)) - - create implicit directories from multipart requests ([ipfs/go-ipfs-files#6](https://github.com/ipfs/go-ipfs-files/pull/6)) - - TarWriter ([ipfs/go-ipfs-files#4](https://github.com/ipfs/go-ipfs-files/pull/4)) - - Refactor filename - file relation ([ipfs/go-ipfs-files#2](https://github.com/ipfs/go-ipfs-files/pull/2)) -- github.com/ipfs/go-ipld-cbor: - - cbor: decode undefined as null ([ipfs/go-ipld-cbor#54](https://github.com/ipfs/go-ipld-cbor/pull/54)) - - error when trying to encode an empty link ([ipfs/go-ipld-cbor#52](https://github.com/ipfs/go-ipld-cbor/pull/52)) - - test for struct with both a cid and a bigint ([ipfs/go-ipld-cbor#51](https://github.com/ipfs/go-ipld-cbor/pull/51)) -- github.com/ipfs/go-ipld-format: - - Add a DAG walker with support for IPLD `Node`s ([ipfs/go-ipld-format#39](https://github.com/ipfs/go-ipld-format/pull/39)) - - Add BufferedDAG wrapping Batch as a DAGService. ([ipfs/go-ipld-format#48](https://github.com/ipfs/go-ipld-format/pull/48)) -- github.com/ipfs/go-ipld-git: - - Fix blob marshalling ([ipfs/go-ipld-git#37](https://github.com/ipfs/go-ipld-git/pull/37)) - - Re-enable assertion on commit size -- it is correct after #31 ([ipfs/go-ipld-git#33](https://github.com/ipfs/go-ipld-git/pull/33)) - - Use OS path separator in testing, fixes #30 ([ipfs/go-ipld-git#34](https://github.com/ipfs/go-ipld-git/pull/34)) - - Use rawdata length for size, fixes #7 ([ipfs/go-ipld-git#31](https://github.com/ipfs/go-ipld-git/pull/31)) - - Cache RawData for Commit, Tag, & Tree, fixes #6 ([ipfs/go-ipld-git#28](https://github.com/ipfs/go-ipld-git/pull/28)) - - Precompute Blob CID, fixes #21 ([ipfs/go-ipld-git#27](https://github.com/ipfs/go-ipld-git/pull/27)) - - Enable Jenkins ([ipfs/go-ipld-git#29](https://github.com/ipfs/go-ipld-git/pull/29)) -- github.com/ipfs/go-ipns: - - fix community/CONTRIBUTING.md link in README.md ([ipfs/go-ipns#20](https://github.com/ipfs/go-ipns/pull/20)) - - fix typo in README.md ([ipfs/go-ipns#21](https://github.com/ipfs/go-ipns/pull/21)) - - testing: disable inline peer ID test ([ipfs/go-ipns#19](https://github.com/ipfs/go-ipns/pull/19)) -- github.com/libp2p/go-libp2p: - - Fixed race conditions in mock package mock_stream and mock_conn ([libp2p/go-libp2p#535](https://github.com/libp2p/go-libp2p/pull/535)) - - increase initial relay advertisement delay to 30s ([libp2p/go-libp2p#534](https://github.com/libp2p/go-libp2p/pull/534)) - - Use PeerRouting in autorelay to find relay peer addresses ([libp2p/go-libp2p#531](https://github.com/libp2p/go-libp2p/pull/531)) - - docs: update broken links in NEWS.md ([libp2p/go-libp2p#517](https://github.com/libp2p/go-libp2p/pull/517)) - - don't advertise the raw public address in autorelay ([libp2p/go-libp2p#511](https://github.com/libp2p/go-libp2p/pull/511)) - - mock: export ratelimiter as RateLimiter ([libp2p/go-libp2p#507](https://github.com/libp2p/go-libp2p/pull/507)) - - readme: remove duplicate repo entries in README and package-list.json ([libp2p/go-libp2p#506](https://github.com/libp2p/go-libp2p/pull/506)) - - explicit option to enable autorelay ([libp2p/go-libp2p#500](https://github.com/libp2p/go-libp2p/pull/500)) - - Add delay in initial relay advertisement to allow the dht time to bootstrap ([libp2p/go-libp2p#495](https://github.com/libp2p/go-libp2p/pull/495)) - - suppressing error msg for NoSecurity option ([libp2p/go-libp2p#498](https://github.com/libp2p/go-libp2p/pull/498)) - - pulling updates ([libp2p/go-libp2p#4](https://github.com/libp2p/go-libp2p/pull/4)) - - fix contributing link in README ([libp2p/go-libp2p#494](https://github.com/libp2p/go-libp2p/pull/494)) - - Fix badges and links on README.md ([libp2p/go-libp2p#485](https://github.com/libp2p/go-libp2p/pull/485)) - - mocknet: fix NewStream and self dials ([libp2p/go-libp2p#480](https://github.com/libp2p/go-libp2p/pull/480)) - - deflake identify test ([libp2p/go-libp2p#479](https://github.com/libp2p/go-libp2p/pull/479)) - - mocknet: use peer ID in peer address ([libp2p/go-libp2p#476](https://github.com/libp2p/go-libp2p/pull/476)) - - autorelay ([libp2p/go-libp2p#454](https://github.com/libp2p/go-libp2p/pull/454)) - - Getting updates ([libp2p/go-libp2p#3](https://github.com/libp2p/go-libp2p/pull/3)) -- github.com/libp2p/go-libp2p-autonat: - - track autonat peer addresses ([libp2p/go-libp2p-autonat#7](https://github.com/libp2p/go-libp2p-autonat/pull/7)) -- github.com/libp2p/go-libp2p-circuit: - - Don't log raw binary ([libp2p/go-libp2p-circuit#53](https://github.com/libp2p/go-libp2p-circuit/pull/53)) -- github.com/libp2p/go-libp2p-connmgr: - - Fix concurrency and silence period not being honoured ([libp2p/go-libp2p-connmgr#26](https://github.com/libp2p/go-libp2p-connmgr/pull/26)) -- github.com/libp2p/go-libp2p-crypto: - - Fix: Remove redundant Ed25519 public key (#36). ([libp2p/go-libp2p-crypto#54](https://github.com/libp2p/go-libp2p-crypto/pull/54)) - - libp2p badges, remove IPFS ([libp2p/go-libp2p-crypto#52](https://github.com/libp2p/go-libp2p-crypto/pull/52)) - - Fix broken contribute link in README ([libp2p/go-libp2p-crypto#46](https://github.com/libp2p/go-libp2p-crypto/pull/46)) - - forbid RSA keys smaller than 512 bits ([libp2p/go-libp2p-crypto#43](https://github.com/libp2p/go-libp2p-crypto/pull/43)) - - Added ECDSA; Added RSA tests; Fixed linting errors; Handling all un-handled errors ([libp2p/go-libp2p-crypto#35](https://github.com/libp2p/go-libp2p-crypto/pull/35)) - - switch to the go-crypto ed25519 implementation ([libp2p/go-libp2p-crypto#38](https://github.com/libp2p/go-libp2p-crypto/pull/38)) - - update gogo protobuf ([libp2p/go-libp2p-crypto#37](https://github.com/libp2p/go-libp2p-crypto/pull/37)) -- github.com/libp2p/go-libp2p-discovery: - - add a timeout to Provide in routing.Advertise ([libp2p/go-libp2p-discovery#12](https://github.com/libp2p/go-libp2p-discovery/pull/12)) - - correctly encode ns to CID ([libp2p/go-libp2p-discovery#11](https://github.com/libp2p/go-libp2p-discovery/pull/11)) - - use 6hrs as ttl for routing based advertisements ([libp2p/go-libp2p-discovery#8](https://github.com/libp2p/go-libp2p-discovery/pull/8)) -- github.com/libp2p/go-libp2p-host: - - Helper to get PeerInfo from Host ([libp2p/go-libp2p-host#20](https://github.com/libp2p/go-libp2p-host/pull/20)) -- github.com/libp2p/go-libp2p-kad-dht: - - fix(dialQueue): account for failed dials ([libp2p/go-libp2p-kad-dht#277](https://github.com/libp2p/go-libp2p-kad-dht/pull/277)) - - Fix Bootstrap sub-queries ([libp2p/go-libp2p-kad-dht#264](https://github.com/libp2p/go-libp2p-kad-dht/pull/264)) - - dial queue: fix possible goroutine leak ([libp2p/go-libp2p-kad-dht#262](https://github.com/libp2p/go-libp2p-kad-dht/pull/262)) - - Alter some logging ([libp2p/go-libp2p-kad-dht#269](https://github.com/libp2p/go-libp2p-kad-dht/pull/269)) - - Revert #236: Test go mod in travis and use major versioning in import paths ([libp2p/go-libp2p-kad-dht#259](https://github.com/libp2p/go-libp2p-kad-dht/pull/259)) - - fix tests on freebsd ([libp2p/go-libp2p-kad-dht#255](https://github.com/libp2p/go-libp2p-kad-dht/pull/255)) - - Fix "no protocol with name dnsaddr" error ([libp2p/go-libp2p-kad-dht#247](https://github.com/libp2p/go-libp2p-kad-dht/pull/247)) - - Fix a race in dial queue ([libp2p/go-libp2p-kad-dht#248](https://github.com/libp2p/go-libp2p-kad-dht/pull/248)) - - Fix races with DialQueue variables ([libp2p/go-libp2p-kad-dht#241](https://github.com/libp2p/go-libp2p-kad-dht/pull/241)) - - Fix CircleCI ([libp2p/go-libp2p-kad-dht#238](https://github.com/libp2p/go-libp2p-kad-dht/pull/238)) - - Adaptive queue for staging dials ([libp2p/go-libp2p-kad-dht#237](https://github.com/libp2p/go-libp2p-kad-dht/pull/237)) - - Add the full libp2p default bootstrap peer list ([libp2p/go-libp2p-kad-dht#226](https://github.com/libp2p/go-libp2p-kad-dht/pull/226)) - - Revert "Tidy up bootstrapping" ([libp2p/go-libp2p-kad-dht#232](https://github.com/libp2p/go-libp2p-kad-dht/pull/232)) - - Tidy up bootstrapping ([libp2p/go-libp2p-kad-dht#225](https://github.com/libp2p/go-libp2p-kad-dht/pull/225)) - - Revert "Remove signal bootstrapping" ([libp2p/go-libp2p-kad-dht#227](https://github.com/libp2p/go-libp2p-kad-dht/pull/227)) - - Remove signal bootstrapping ([libp2p/go-libp2p-kad-dht#224](https://github.com/libp2p/go-libp2p-kad-dht/pull/224)) - - fix a potential DHT query hang ([libp2p/go-libp2p-kad-dht#219](https://github.com/libp2p/go-libp2p-kad-dht/pull/219)) - - docs: duplicate pkg documentation ([libp2p/go-libp2p-kad-dht#218](https://github.com/libp2p/go-libp2p-kad-dht/pull/218)) - - tests: skip key inlining test ([libp2p/go-libp2p-kad-dht#212](https://github.com/libp2p/go-libp2p-kad-dht/pull/212)) - - Rephrase "betterPeersToQuery" method comment to be less cryptic ([libp2p/go-libp2p-kad-dht#206](https://github.com/libp2p/go-libp2p-kad-dht/pull/206)) -- github.com/libp2p/go-libp2p-loggables: - - test: add unit tests ([libp2p/go-libp2p-loggables#21](https://github.com/libp2p/go-libp2p-loggables/pull/21)) -- github.com/libp2p/go-libp2p-netutil: - - Add tests ([libp2p/go-libp2p-netutil#28](https://github.com/libp2p/go-libp2p-netutil/pull/28)) -- github.com/libp2p/go-libp2p-peer: - - fix: re-enable peer ID inlining but make it configurable ([libp2p/go-libp2p-peer#42](https://github.com/libp2p/go-libp2p-peer/pull/42)) - - Protobuf and JSON (un-)marshalling methods for peer.ID ([libp2p/go-libp2p-peer#41](https://github.com/libp2p/go-libp2p-peer/pull/41)) - - disable key inlining ([libp2p/go-libp2p-peer#40](https://github.com/libp2p/go-libp2p-peer/pull/40)) -- github.com/libp2p/go-libp2p-peerstore: - - Add unit test to verify AddAddr doesn't shorten TTL ([libp2p/go-libp2p-peerstore#52](https://github.com/libp2p/go-libp2p-peerstore/pull/52)) - - disable inline-peer id test ([libp2p/go-libp2p-peerstore#49](https://github.com/libp2p/go-libp2p-peerstore/pull/49)) - - README: Update contributing guideline linkrot. ([libp2p/go-libp2p-peerstore#48](https://github.com/libp2p/go-libp2p-peerstore/pull/48)) - - Deterministic benchmark order; Keybook interface benchmarks ([libp2p/go-libp2p-peerstore#43](https://github.com/libp2p/go-libp2p-peerstore/pull/43)) - - PeerInfo UnMarshal Error #393 ([libp2p/go-libp2p-peerstore#45](https://github.com/libp2p/go-libp2p-peerstore/pull/45)) - - fix the inline key test ([libp2p/go-libp2p-peerstore#44](https://github.com/libp2p/go-libp2p-peerstore/pull/44)) -- github.com/libp2p/go-libp2p-pubsub: - - move timecache check/update after validation ([libp2p/go-libp2p-pubsub#156](https://github.com/libp2p/go-libp2p-pubsub/pull/156)) - - fix nonsensical check ([libp2p/go-libp2p-pubsub#154](https://github.com/libp2p/go-libp2p-pubsub/pull/154)) - - Extend validator interface to include message source ([libp2p/go-libp2p-pubsub#151](https://github.com/libp2p/go-libp2p-pubsub/pull/151)) - - Implement peer blacklist ([libp2p/go-libp2p-pubsub#149](https://github.com/libp2p/go-libp2p-pubsub/pull/149)) - - make timecache duration configurable ([libp2p/go-libp2p-pubsub#148](https://github.com/libp2p/go-libp2p-pubsub/pull/148)) - - godoc is not html either ([libp2p/go-libp2p-pubsub#147](https://github.com/libp2p/go-libp2p-pubsub/pull/147)) - - godoc documentation is not markdown ([libp2p/go-libp2p-pubsub#146](https://github.com/libp2p/go-libp2p-pubsub/pull/146)) - - Add documentation for subscribe's non-instanteneous semantics ([libp2p/go-libp2p-pubsub#145](https://github.com/libp2p/go-libp2p-pubsub/pull/145)) - - Some documentation ([libp2p/go-libp2p-pubsub#140](https://github.com/libp2p/go-libp2p-pubsub/pull/140)) - - rework peer tracking logic to handle multiple connections ([libp2p/go-libp2p-pubsub#132](https://github.com/libp2p/go-libp2p-pubsub/pull/132)) -- github.com/libp2p/go-libp2p-pubsub-router: - - encode record-store keys in pubsub ([libp2p/go-libp2p-pubsub-router#17](https://github.com/libp2p/go-libp2p-pubsub-router/pull/17)) -- github.com/libp2p/go-libp2p-quic-transport: - - fix badges in README ([libp2p/go-libp2p-quic-transport#39](https://github.com/libp2p/go-libp2p-quic-transport/pull/39)) - - Fix missing transport parameter in dialed connection ([libp2p/go-libp2p-quic-transport#38](https://github.com/libp2p/go-libp2p-quic-transport/pull/38)) -- github.com/libp2p/go-libp2p-routing: - - Update the comment on IpfsRouting.Bootstrap ([libp2p/go-libp2p-routing#36](https://github.com/libp2p/go-libp2p-routing/pull/36)) -- github.com/libp2p/go-libp2p-swarm: - - Make FD limits configurable by environment property ([libp2p/go-libp2p-swarm#102](https://github.com/libp2p/go-libp2p-swarm/pull/102)) - - Fix logging race ([libp2p/go-libp2p-swarm#100](https://github.com/libp2p/go-libp2p-swarm/pull/100)) - - Add CircleCI config ([libp2p/go-libp2p-swarm#99](https://github.com/libp2p/go-libp2p-swarm/pull/99)) - - Enhance debug logging in dial limiter ([libp2p/go-libp2p-swarm#98](https://github.com/libp2p/go-libp2p-swarm/pull/98)) - - dialer: handle dial cancel and/or completion before trying new addresses ([libp2p/go-libp2p-swarm#96](https://github.com/libp2p/go-libp2p-swarm/pull/96)) - - avoid spawning goroutines for canceled dials ([libp2p/go-libp2p-swarm#95](https://github.com/libp2p/go-libp2p-swarm/pull/95)) - - warn when we encounter a useless transport ([libp2p/go-libp2p-swarm#90](https://github.com/libp2p/go-libp2p-swarm/pull/90)) -- github.com/libp2p/go-libp2p-transport: - - fix transport tests for quic ([libp2p/go-libp2p-transport#39](https://github.com/libp2p/go-libp2p-transport/pull/39)) - - fix: fully close streams before returning ([libp2p/go-libp2p-transport#37](https://github.com/libp2p/go-libp2p-transport/pull/37)) - - fix typo in README ([libp2p/go-libp2p-transport#36](https://github.com/libp2p/go-libp2p-transport/pull/36)) -- github.com/libp2p/go-libp2p-transport-upgrader: - - annotate errors ([libp2p/go-libp2p-transport-upgrader#11](https://github.com/libp2p/go-libp2p-transport-upgrader/pull/11)) -- github.com/ipfs/go-log: - - uglify the (event) logs ([ipfs/go-log#53](https://github.com/ipfs/go-log/pull/53)) - - add environment variable for writing tracing information to a file ([ipfs/go-log#52](https://github.com/ipfs/go-log/pull/52)) - - correctly display the line number when FinishWithErr fails ([ipfs/go-log#51](https://github.com/ipfs/go-log/pull/51)) -- github.com/libp2p/go-maddr-filter: - - test: extend test to improve coverage ([libp2p/go-maddr-filter#7](https://github.com/libp2p/go-maddr-filter/pull/7)) -- github.com/ipfs/go-merkledag: - - Increase FetchGraphConcurrency to 32 ([ipfs/go-merkledag#29](https://github.com/ipfs/go-merkledag/pull/29)) - - Enable CI ([ipfs/go-merkledag#9](https://github.com/ipfs/go-merkledag/pull/9)) - - fix a fetch deadlock on error ([ipfs/go-merkledag#21](https://github.com/ipfs/go-merkledag/pull/21)) - - Wait for all go routines to finish before function returns ([ipfs/go-merkledag#19](https://github.com/ipfs/go-merkledag/pull/19)) -- github.com/ipfs/go-metrics-prometheus: - - use prometheus instead of gxed ([ipfs/go-metrics-prometheus#3](https://github.com/ipfs/go-metrics-prometheus/pull/3)) -- github.com/ipfs/go-mfs: - - fix(mv): dst filename error ([ipfs/go-mfs#62](https://github.com/ipfs/go-mfs/pull/62)) - - fix over-wait in WaitPub ([ipfs/go-mfs#53](https://github.com/ipfs/go-mfs/pull/53)) - - Fix/32/pr ports from go-ipfs to go-mfs ([ipfs/go-mfs#49](https://github.com/ipfs/go-mfs/pull/49)) - - remove the `fullSync` option from `updateChildEntry` ([ipfs/go-mfs#45](https://github.com/ipfs/go-mfs/pull/45)) - - Various refactorings ([ipfs/go-mfs#36](https://github.com/ipfs/go-mfs/pull/36)) - - use RW lock for the `File`'s lock ([ipfs/go-mfs#43](https://github.com/ipfs/go-mfs/pull/43)) - - add documentation links in README ([ipfs/go-mfs#41](https://github.com/ipfs/go-mfs/pull/41)) - - [WIP] documentation notes ([ipfs/go-mfs#27](https://github.com/ipfs/go-mfs/pull/27)) - - feat(inode): add inode struct ([ipfs/go-mfs#12](https://github.com/ipfs/go-mfs/pull/12)) -- github.com/libp2p/go-mplex: - - fix deadlock ([libp2p/go-mplex#39](https://github.com/libp2p/go-mplex/pull/39)) - - When a stream is closed, cancel pending writes ([libp2p/go-mplex#35](https://github.com/libp2p/go-mplex/pull/35)) - - make sure to but the buffer back in the pool ([libp2p/go-mplex#34](https://github.com/libp2p/go-mplex/pull/34)) - - reduce the packet count ([libp2p/go-mplex#29](https://github.com/libp2p/go-mplex/pull/29)) -- github.com/ipfs/go-path: - - fix: no components error ([ipfs/go-path#18](https://github.com/ipfs/go-path/pull/18)) - - nit: validate CIDs in IPLD paths ([ipfs/go-path#16](https://github.com/ipfs/go-path/pull/16)) -- github.com/libp2p/go-reuseport: - - Fix build on wasm ([libp2p/go-reuseport#59](https://github.com/libp2p/go-reuseport/pull/59)) - - Use Go Control API ([libp2p/go-reuseport#56](https://github.com/libp2p/go-reuseport/pull/56)) - - Support WASM ([libp2p/go-reuseport#54](https://github.com/libp2p/go-reuseport/pull/54)) -- github.com/libp2p/go-reuseport-transport: - - Update to go-reuseport 0.2.0 ([libp2p/go-reuseport-transport#6](https://github.com/libp2p/go-reuseport-transport/pull/6)) -- github.com/libp2p/go-stream-muxer: - - add standard reset error ([libp2p/go-stream-muxer#23](https://github.com/libp2p/go-stream-muxer/pull/23)) - - ci: fix ([libp2p/go-stream-muxer#24](https://github.com/libp2p/go-stream-muxer/pull/24)) - - Document Reset versus Close ([libp2p/go-stream-muxer#18](https://github.com/libp2p/go-stream-muxer/pull/18)) - - WIP document Conn.Close ([libp2p/go-stream-muxer#19](https://github.com/libp2p/go-stream-muxer/pull/19)) -- github.com/libp2p/go-tcp-transport: - - Deprecate IPFS_REUSEPORT, use LIBP2P_TCP_REUSEPORT ([libp2p/go-tcp-transport#27](https://github.com/libp2p/go-tcp-transport/pull/27)) -- github.com/ipfs/go-unixfs: - - unixfile: precalc dir size ([ipfs/go-unixfs#61](https://github.com/ipfs/go-unixfs/pull/61)) - - Archive refactor ([ipfs/go-unixfs#59](https://github.com/ipfs/go-unixfs/pull/59)) - - decouple the DAG traversal logic from the DAG reader (local branch) ([ipfs/go-unixfs#60](https://github.com/ipfs/go-unixfs/pull/60)) - - Unixfs: enforce refs on files when using nocopy ([ipfs/go-unixfs#56](https://github.com/ipfs/go-unixfs/pull/56)) - - Fix/handle overflow ([ipfs/go-unixfs#53](https://github.com/ipfs/go-unixfs/pull/53)) - - feat(Directory): Add EnumLinksAsync method ([ipfs/go-unixfs#39](https://github.com/ipfs/go-unixfs/pull/39)) - - - -## 0.4.18 2018-10-26 - -This is probably one of the largest go-ipfs releases in recent history, 3 months -in the making. - -### Features - -The headline features this release are experimental QUIC support, the gossipsub -pubsub routing algorithm, pubsub message signing, and a refactored `ipfs p2p` -command. However, that's just scratching the surface. - -#### QUIC - -First up, on the networking front, this release has also introduced experimental -support for the QUIC protocol. QUIC is a new UDP-based network transport that -solves many of the long standing issues with TCP. - -For us, this means (eventually): - -* **Fewer local resources.** TCP requires a file-descriptor per connection while - QUIC (and most UDP based transports) can share a single file descriptor - between all connections. This should allow us to dial faster and keep more - connections open. -* **Faster connection establishment.** When client authentication is included, - QUIC has a three-way handshake like TCP. However, unlike TCP, this handshake - brings us from all the way from 0 to a fully encrypted, authenticated, and - multiplexed connection. In theory (not yet in practice), this should - significantly reduce the latency of DHT queries. -* **Behaves better on lossy networks.** When multiplexing multiple requests over - a single TCP connection, a single dropped packet will bring the entire - connection to a halt while the packet is re-transmitted. However, because QUIC - handles multiplexing internally, dropping a single packets affects only the - related stream. -* **Better NAT traversal.** TL;DR: NAT hole-punching is significantly easier - and, in many cases, more reliable with UDP than with TCP. - -However, we still have a long way to go. While we encourage users to test this, -the IETF QUIC protocol is still being actively developed and *will* change. You -can find instructions for enabling it -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#QUIC). - -#### Pubsub - -In terms of pubsub, go-ipfs now supports the gossipsub routing algorithm and -message signing. - -The gossipsub routing algorithm is *significantly* more efficient than the -current floodsub routing algorithm. Even better, it's fully backwards compatible -so you can enable it and still talk to nodes using the floodsub algorithm. You -can find instructions to enable gossipsub in go-ipfs -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#gossipsub). - -Messages are now signed by their authors. While signing has now been enabled by -default, strict signature verification has not been and will not be for at least -one release (probably multiple) to avoid breaking existing applications. You can -read about how to configure this feature -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#message-signing). - -#### Commands - -In terms of new toys, this release introduces a new `ipfs cid` subcommand for -working with CIDs, a completely refactored `ipfs p2p` command, streaming name -resolution, and complete inline block support. - -The new `ipfs cid` command allows users to both inspect CIDs and convert them -between various formats and versions. For example: - -```sh -# Print out the CID metadata (prefix) -> ipfs cid format -f %P QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o -cidv0-protobuf-sha2-256-32 - -# Get the hex sha256 hash from the CID. -> ipfs cid format -b base16 -f '0x%D' QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o -0x46d44814b9c5af141c3aaab7c05dc5e844ead5f91f12858b021eba45768b4c0e - -# Convert a base58 v0 CID to a base32 v1 CID. -> ipfs cid base32 QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o -bafybeicg2rebjoofv4kbyovkw7af3rpiitvnl6i7ckcywaq6xjcxnc2mby -``` - -The refactored `ipfs p2p` command allows forwarding TCP streams through two IPFS -nodes from one host to another. It's `ssh -L` but for IPFS. You can find -documentation -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-p2p). -It's still experimental but we don't expect too many breaking changes at this -point (it will very likely be stabilized in the next release). Quick summary of -breaking changes: - -* We don't stop listening for local (forwarded) connections after accepting a - single connection. -* `ipfs p2p stream ls` output now returns more useful output, first address is - always the initiator address. -* `ipfs p2p listener ls` is renamed to `ipfs p2p ls` -* `ipfs p2p listener close` is renamed to `ipfs p2p close` -* Protocol names have to be prefixed with `/x/` and are now just passed to - libp2p as handler name. Previous version did this 'under the hood' and with - `/p2p/` prefix. There is a `--allow-custom-protocol` flag which allows you - to use any libp2p handler name. -* `ipfs p2p listener open` and `ipfs p2p stream dial` got renamed: - * `ipfs p2p listener open p2p-test /ip4/127.0.0.1/tcp/10101` - new becomes `ipfs p2p listen /x/p2p-test /ip4/127.0.0.1/tcp/10101` - * `ipfs p2p stream dial $NODE_A_PEERID p2p-test /ip4/127.0.0.1/tcp/10102` - is now `ipfs p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/$NODE_A_PEERID` - -There is now a new flag for `ipfs name resolve` - `--stream`. When the command -is invoked with the flag set, it will start returning results as soon as they -are discovered in the DHT and other routing mechanisms. This enables certain -applications to start prefetching/displaying data while the discovery is still -running. Note that this command will likely return many outdated records -before it finding and returning the latest. However, it will always return -*valid* records (even if a bit stale). - -Finally, in the previous release, we added support for extracting blocks inlined -into CIDs. In this release, we've added support for creating these CIDs. You can -now run `ipfs add` with the `--inline` flag to inline blocks less than or equal -to 32 bytes in length into a CID, instead of writing an actual block. This -should significantly reduce the size of filesystem trees with many empty -directories and tiny files. - -#### IPNS - -You can now publish and resolve paths with namespaces *other* than `/ipns` and -`/ipfs` through IPNS. Critically, IPNS can now be used with IPLD paths (paths -starting with `/ipld`). - -#### WebUI - -Finally, this release includes the shiny [updated -webui](https://github.com/ipfs-shipyard/ipfs-webui). You can view it by -installing go-ipfs and visiting http://localhost:5001/webui. - -### Performance - -This release includes some significant performance improvements, both in terms -of resource utilization and speed. This section will go into some technical -details so feel free to skip it if you're just looking for shiny new features. - -#### Resource Utilization - -In this release, we've (a) fixed a slow memory leak in libp2p and (b) -significantly reduced the allocation load. Together, these should improve both -memory and CPU usage. - -##### Datastructures - -We've changed two of our most frequently used datastructures, CIDs and -Multiaddrs, to reduce allocation load. - -First, we now store CIDs *encode* as strings, instead of decoded in structs -(behind pointers). In addition to being more compact, our `Cid` type is now a -valid `map` key so we no longer have to encode CIDs every time we want to use -them in a map/set. Allocations when inserting CIDs into maps/sets was showing up -as a significant source of allocations under heavy load so this change should -improve memory usage. - -Second, we've changed many of our multiaddr parsing/processing/formatting -functions to allocate less. Much of our DHT related-work includes processing -multiaddrs so this should reduce CPU utilization when heavily using the DHT. - -##### Streams and Yamux - -Streams have always plagued us in terms of memory utilization. This was -partially solved by introducing the connection manager, keeping our maximum -connection count to a reasonable number but they're still a major memory sink. - -This release sees two improvements on this front: - -1. A memory [leak in identify](https://github.com/libp2p/go-libp2p/issues/419) - has been fixed. This was slowly causing us to leak connections (locking up - the memory used by the connections' streams). -2. Yamux streams now use a buffer-pool backed, auto shrinking read buffer. - Before, this read buffer would grow to its maximum size (a few megabytes) and - never shrink but these buffers now shrink as they're emptied. - -#### Bitswap Performance - -Bitswap will now pack *multiple* small blocks into a single message thanks -[ipfs/go-bitswap#5](https://github.com/ipfs/go-bitswap/pull/5). While this won't -help when transferring large files (with large blocks), this should help when -transferring many tiny files. - -### Refactors and Endeavors - -This release saw yet another commands-library refactor, work towards the -CoreAPI, and the first step towards reliable base32 CID support. - -#### Commands Lib - -We've completely refactored our commands library (again). While it still needs -quite a bit of work, it now requires significantly less boilerplate and should -be significantly more robust. The refactor immediately found two broken tests -and probably fixed quite a few bugs around properly returning and handling -errors. - -#### CoreAPI - -CoreAPI is a new way to interact with IPFS from Go. While it's still not -final, most things you can do via the CLI or HTTP interfaces, can now be done -through the new API. - -Currently there is only one implementation, backed by go-ipfs node, and there are -plans to start http-api backed one soon. We are also looking into creating RPC -interface using this API, which could help performance in some use cases. - -You can track progress in https://github.com/ipfs/go-ipfs/issues/4498 - -#### IPLD paths - -We introduced new path type which introduces distinction between IPLD and -IPFS (unixfs) paths. From now on paths prefixed with `/ipld/` will always -use IPLD link traversal and `/ipfs/` will use unixfs path resolver, which -takes things like shardnig into account. - -Note that this is only initial support and there likely are some bugs in -how the paths are handled internally, so consider this feature -experimental for now. - -#### CIDv1/Base32 Migration - -Currently, IPFS is usually used in browsers by browsing to -`https://SOME_GATEWAY/ipfs/CID/...`. There are two significant drawbacks to this -approach: - -1. From a browser security standpoint, all IPFS "sites" will live under the same - origin (SOME_GATEWAY). -2. From a UX standpoint, this doesn't feel very "native" (even if the gateway is - a local IPFS node). - -To fix the security issue, we intend to switch IPFS gateway links -`https://ipfs.io/ipfs/CID` to to `https://CID.ipfs.dweb.link`. This way, the CID -will be a part of the -["origin"](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) so -each IPFS website will get a separate security origin. - -To fix the UX issue, we've been working on adding support for `ipfs://CID/...` -to web browsers through our -[ipfs-companion](https://github.com/ipfs/ipfs-companion/) add-on and some new, -experimental extension APIs from Mozilla. This has the same effect of putting -the CID in the URL origin but has the added benefit of looking "native". - -Unfortunately, origins must be *case insensitive*. Currently, most CIDs users -see are *CIDv0* CIDs (those starting with `Qm`) which are *always* base58 -encoded and are therefore case-sensitive. - -Fortunately, CIDv1 (the latest CID format) supports arbitrary bases using the -[multibase](https://github.com/multiformats/multibase/) standard. Unfortunately, -IPFS has always treated equivalent CIDv0 and CIDv1 CIDs as distinct. This means -that files added with CIDv0 CIDs (the default) can't be looked up using the -equivalent CIDv1. - -This release makes some significant progress towards solving this issue by -introducing two features: - -(1) The previous mentioned `ipfs cid base32` command for converting CID to a -case intensive encoding required by domain names. This command converts a CID to -version 1 and encodes it using base32. - -(2) A hack to allow locally looking up blocks associated with a CIDv0 CID using -the equivalent CIDv1 CID (or the reverse). This hack will eventually -be replaced with a multihash indexed blockstore, which is agnostic to both the -CID version and multicodec content type. - -### go-ipfs changelog - -Features (i.e., users take heed): - - gossipsub ([ipfs/go-ipfs#5373](https://github.com/ipfs/go-ipfs/pull/5373)) - - support /ipfs/CID in `ipfs dht findprovs` ([ipfs/go-ipfs#5329](https://github.com/ipfs/go-ipfs/pull/5329)) - - return a json object from config show ([ipfs/go-ipfs#5345](https://github.com/ipfs/go-ipfs/pull/5345)) - - Set filename in Content-Disposition if filename=x is passed in URI query ([ipfs/go-ipfs#4177](https://github.com/ipfs/go-ipfs/pull/4177)) - - Allow mfs files.write command to create parent directories ([ipfs/go-ipfs#5359](https://github.com/ipfs/go-ipfs/pull/5359)) - - Run DNS lookup for --api endpoint provided in CLI ([ipfs/go-ipfs#5372](https://github.com/ipfs/go-ipfs/pull/5372)) - - Add support for inlinling blocks into CIDs the id-hash ([ipfs/go-ipfs#5281](https://github.com/ipfs/go-ipfs/pull/5281)) - - depth limited refs -r ([ipfs/go-ipfs#5337](https://github.com/ipfs/go-ipfs/pull/5337)) - - remove bitswap unwant ([ipfs/go-ipfs#5308](https://github.com/ipfs/go-ipfs/pull/5308)) - - add experimental QUIC support ([ipfs/go-ipfs#5350](https://github.com/ipfs/go-ipfs/pull/5350)) - - add a --stdin-name flag for naming files from stdin ([ipfs/go-ipfs#5399](https://github.com/ipfs/go-ipfs/pull/5399)) - - Refactor `ipfs p2p` ([ipfs/go-ipfs#4929](https://github.com/ipfs/go-ipfs/pull/4929)) - - add dns support in`ipfs p2p forward` and refactor code ([ipfs/go-ipfs#5533](https://github.com/ipfs/go-ipfs/pull/5533)) - - feat(command): expose connection direction ([ipfs/go-ipfs#5457](https://github.com/ipfs/go-ipfs/pull/5457)) - - error when publishing ipns records without a running daemon ([ipfs/go-ipfs#5477](https://github.com/ipfs/go-ipfs/pull/5477)) - - feat(daemon): print version on start ([ipfs/go-ipfs#5503](https://github.com/ipfs/go-ipfs/pull/5503)) - - add quieter option to name publish ([ipfs/go-ipfs#5494](https://github.com/ipfs/go-ipfs/pull/5494)) - - Provide new "cid" sub-command. ([ipfs/go-ipfs#5385](https://github.com/ipfs/go-ipfs/pull/5385)) - - feat(command): add force flag for files rm ([ipfs/go-ipfs#5555](https://github.com/ipfs/go-ipfs/pull/5555)) - - Add support for datastore plugins ([ipfs/go-ipfs#5187](https://github.com/ipfs/go-ipfs/pull/5187)) - - files ls: append slash to directory names ([ipfs/go-ipfs#5605](https://github.com/ipfs/go-ipfs/pull/5605)) - - ipfs name resolve --stream ([ipfs/go-ipfs#5404](https://github.com/ipfs/go-ipfs/pull/5404)) - - update webui to 2.1.0 ([ipfs/go-ipfs#5627](https://github.com/ipfs/go-ipfs/pull/5627)) - - feat: add dry-run flag for config profile apply command ([ipfs/go-ipfs#5455](https://github.com/ipfs/go-ipfs/pull/5455)) - - configurable pubsub signing ([ipfs/go-ipfs#5647](https://github.com/ipfs/go-ipfs/pull/5647)) - -Fixes (i.e., users take note): - - pin update fixes ([ipfs/go-ipfs#5265](https://github.com/ipfs/go-ipfs/pull/5265)) - - Fix inability to pin two things at once ([ipfs/go-ipfs#5512](https://github.com/ipfs/go-ipfs/pull/5512)) - - wait for all connections to close before exiting on shutdown. ([ipfs/go-ipfs#5322](https://github.com/ipfs/go-ipfs/pull/5322)) - - Fixed ipns address resolution in fuse unix mount ([ipfs/go-ipfs#5384](https://github.com/ipfs/go-ipfs/pull/5384)) - - core/commands/ls: wrap `NewDirectoryFromNode` error ([ipfs/go-ipfs#5166](https://github.com/ipfs/go-ipfs/pull/5166)) - - fix goroutine leaks in filestore.go ([ipfs/go-ipfs#5427](https://github.com/ipfs/go-ipfs/pull/5427)) - - move VersionOption after GatewayOption to fix #5422 ([ipfs/go-ipfs#5424](https://github.com/ipfs/go-ipfs/pull/5424)) - - fix(commands): fix filestore.go goroutine leak ([ipfs/go-ipfs#5439](https://github.com/ipfs/go-ipfs/pull/5439)) - - fix(commands): goroutine leaks in ping.go ([ipfs/go-ipfs#5444](https://github.com/ipfs/go-ipfs/pull/5444)) - - fix output of object command ([ipfs/go-ipfs#5459](https://github.com/ipfs/go-ipfs/pull/5459)) - - add warning when no bootstrap in config ([ipfs/go-ipfs#5445](https://github.com/ipfs/go-ipfs/pull/5445)) - - fix behaviour of key rename to same name ([ipfs/go-ipfs#5465](https://github.com/ipfs/go-ipfs/pull/5465)) - - fix(object): print object diff error ([ipfs/go-ipfs#5469](https://github.com/ipfs/go-ipfs/pull/5469)) - - fix(pin): goroutine leaks ([ipfs/go-ipfs#5453](https://github.com/ipfs/go-ipfs/pull/5453)) - - fix offline id bug ([ipfs/go-ipfs#5486](https://github.com/ipfs/go-ipfs/pull/5486)) - - files cp: improve flush error message ([ipfs/go-ipfs#5485](https://github.com/ipfs/go-ipfs/pull/5485)) - - resolve: fix unixfs resolution through sharded directories ([ipfs/go-ipfs#5484](https://github.com/ipfs/go-ipfs/pull/5484)) - - Switch name publish/resolve to coreapi ([ipfs/go-ipfs#5563](https://github.com/ipfs/go-ipfs/pull/5563)) - - use CoreAPI resolver everywhere (fixes sharded directory resolution) ([ipfs/go-ipfs#5492](https://github.com/ipfs/go-ipfs/pull/5492)) - - add pin lock in AddallPin function ([ipfs/go-ipfs#5506](https://github.com/ipfs/go-ipfs/pull/5506)) - - take the pinlock when updating pins ([ipfs/go-ipfs#5550](https://github.com/ipfs/go-ipfs/pull/5550)) - - fix(object): add support for raw leaves in object diff ([ipfs/go-ipfs#5472](https://github.com/ipfs/go-ipfs/pull/5472)) - - don't use the domain name as a filename in /ipns/a.com ([ipfs/go-ipfs#5564](https://github.com/ipfs/go-ipfs/pull/5564)) - - refactor(command): modify int to int64 ([ipfs/go-ipfs#5612](https://github.com/ipfs/go-ipfs/pull/5612)) - - fix(core): ipns config RecordLifetime panic ([ipfs/go-ipfs#5648](https://github.com/ipfs/go-ipfs/pull/5648)) - - simplify dag put and correctly take pin lock ([ipfs/go-ipfs#5667](https://github.com/ipfs/go-ipfs/pull/5667)) - - fix prometheus concurrent map write bug ([ipfs/go-ipfs#5706](https://github.com/ipfs/go-ipfs/pull/5706)) - -Regressions Fixes (fixes for bugs introduced since the last release): - - namesys: properly attach path in name.Resolve ([ipfs/go-ipfs#5660](https://github.com/ipfs/go-ipfs/pull/5660)) - - fix(p2p): issue #5523 ([ipfs/go-ipfs#5529](https://github.com/ipfs/go-ipfs/pull/5529)) - - fix infinite loop in `stats bw` ([ipfs/go-ipfs#5598](https://github.com/ipfs/go-ipfs/pull/5598)) - - make warnings on no bootstrap peers less noisy ([ipfs/go-ipfs#5466](https://github.com/ipfs/go-ipfs/pull/5466)) - - fix two transport related bugs ([ipfs/go-ipfs#5417](https://github.com/ipfs/go-ipfs/pull/5417)) - - Fix pin ls output when hash is specified ([ipfs/go-ipfs#5699](https://github.com/ipfs/go-ipfs/pull/5699)) - - ping: switch to the ping service enabled in the libp2p constructor ([ipfs/go-ipfs#5698](https://github.com/ipfs/go-ipfs/pull/5698)) - - commands: fix a bunch of tiny commands-lib issues ([ipfs/go-ipfs#5697](https://github.com/ipfs/go-ipfs/pull/5697)) - - cleanup the ping command ([ipfs/go-ipfs#5680](https://github.com/ipfs/go-ipfs/pull/5680)) - - fix gossipsub goroutine explosion ([ipfs/go-ipfs#5688](https://github.com/ipfs/go-ipfs/pull/5688)) - - fix(cmd/gc): Run func does not return error when Emit func returns error ([ipfs/go-ipfs#5687](https://github.com/ipfs/go-ipfs/pull/5687)) - -Extractions: - - Extract bitswap to go-bitswap ([ipfs/go-ipfs#5294](https://github.com/ipfs/go-ipfs/pull/5294)) - - Extract blockservice and verifcid ([ipfs/go-ipfs#5296](https://github.com/ipfs/go-ipfs/pull/5296)) - - Extract merkledag package, move dagutils to top level ([ipfs/go-ipfs#5298](https://github.com/ipfs/go-ipfs/pull/5298)) - - Extract path and resolver ([ipfs/go-ipfs#5306](https://github.com/ipfs/go-ipfs/pull/5306)) - - Extract config package ([ipfs/go-ipfs#5277](https://github.com/ipfs/go-ipfs/pull/5277)) - - Extract unixfs and importers to go-unixfs ([ipfs/go-ipfs#5316](https://github.com/ipfs/go-ipfs/pull/5316)) - - delete unixfs code... ([ipfs/go-ipfs#5319](https://github.com/ipfs/go-ipfs/pull/5319)) - - Extract /mfs to github.com/ipfs/go-mfs ([ipfs/go-ipfs#5391](https://github.com/ipfs/go-ipfs/pull/5391)) - - re-format log output as ndjson ([ipfs/go-ipfs#5708](https://github.com/ipfs/go-ipfs/pull/5708)) - - error on resolving non-terminal paths ([ipfs/go-ipfs#5705](https://github.com/ipfs/go-ipfs/pull/5705)) - -Documentation: - - document the fact that we now publish releases on GitHub ([ipfs/go-ipfs#5301](https://github.com/ipfs/go-ipfs/pull/5301)) - - docs: add url to dev weekly sync to the README ([ipfs/go-ipfs#5371](https://github.com/ipfs/go-ipfs/pull/5371)) - - docs: README refresh, add cli-http-api-core diagram ([ipfs/go-ipfs#5396](https://github.com/ipfs/go-ipfs/pull/5396)) - - add some basic gateway documentation ([ipfs/go-ipfs#5393](https://github.com/ipfs/go-ipfs/pull/5393)) - - fix the default gateway port ([ipfs/go-ipfs#5419](https://github.com/ipfs/go-ipfs/pull/5419)) - - fix order of events in the release process ([ipfs/go-ipfs#5434](https://github.com/ipfs/go-ipfs/pull/5434)) - - docs: add some minimal read-only API documentation ([ipfs/go-ipfs#5437](https://github.com/ipfs/go-ipfs/pull/5437)) - - feat: use package-table ([ipfs/go-ipfs#5395](https://github.com/ipfs/go-ipfs/pull/5395)) - - link to go-{libp2p,ipld} package tables ([ipfs/go-ipfs#5446](https://github.com/ipfs/go-ipfs/pull/5446)) - - api: fix outdated HTTPHeaders config documentation ([ipfs/go-ipfs#5451](https://github.com/ipfs/go-ipfs/pull/5451)) - - add version, usage, and planning info for urlstore ([ipfs/go-ipfs#5552](https://github.com/ipfs/go-ipfs/pull/5552)) - - debug-guide.md added memory statistics command ([ipfs/go-ipfs#5546](https://github.com/ipfs/go-ipfs/pull/5546)) - - Change to point to combined go contributing guidelines ([ipfs/go-ipfs#5607](https://github.com/ipfs/go-ipfs/pull/5607)) - - docs: Update link format ([ipfs/go-ipfs#5617](https://github.com/ipfs/go-ipfs/pull/5617)) - - Fix link in readme ([ipfs/go-ipfs#5632](https://github.com/ipfs/go-ipfs/pull/5632)) - - docs: add a note for dns command ([ipfs/go-ipfs#5629](https://github.com/ipfs/go-ipfs/pull/5629)) - - Dockerfile: Specifies comments on exposed ports ([ipfs/go-ipfs#5615](https://github.com/ipfs/go-ipfs/pull/5615)) - - document pubsub message signing ([ipfs/go-ipfs#5669](https://github.com/ipfs/go-ipfs/pull/5669)) - -Testing: - - Include cid-fmt binary in test/bin. ([ipfs/go-ipfs#5297](https://github.com/ipfs/go-ipfs/pull/5297)) - - wait for the nodes to fully stop ([ipfs/go-ipfs#5315](https://github.com/ipfs/go-ipfs/pull/5315)) - - apply timeout for build steps after getting node ([ipfs/go-ipfs#5313](https://github.com/ipfs/go-ipfs/pull/5313)) - - ci: check for gx deps dupes ([ipfs/go-ipfs#5338](https://github.com/ipfs/go-ipfs/pull/5338)) - - ci: call cleanWs after each step ([ipfs/go-ipfs#5374](https://github.com/ipfs/go-ipfs/pull/5374)) - - add correct test for GC completeness ([ipfs/go-ipfs#5364](https://github.com/ipfs/go-ipfs/pull/5364)) - - fix the urlstore tests ([ipfs/go-ipfs#5397](https://github.com/ipfs/go-ipfs/pull/5397)) - - improve gateway options test ([ipfs/go-ipfs#5433](https://github.com/ipfs/go-ipfs/pull/5433)) - - coreapi name: Increase test swarm size ([ipfs/go-ipfs#5481](https://github.com/ipfs/go-ipfs/pull/5481)) - - fix fuse unmount test ([ipfs/go-ipfs#5476](https://github.com/ipfs/go-ipfs/pull/5476)) - - test(add): add test for issue \#5456 ([ipfs/go-ipfs#5493](https://github.com/ipfs/go-ipfs/pull/5493)) - - fixed tests of raised fd limits ([ipfs/go-ipfs#5496](https://github.com/ipfs/go-ipfs/pull/5496)) - - pprof: create HTTP endpoint for setting MutexProfileFraction ([ipfs/go-ipfs#5527](https://github.com/ipfs/go-ipfs/pull/5527)) - - fix(command):update `add --chunker` test ([ipfs/go-ipfs#5571](https://github.com/ipfs/go-ipfs/pull/5571)) - - switch to go 1.11 ([ipfs/go-ipfs#5483](https://github.com/ipfs/go-ipfs/pull/5483)) - - fix: sharness race in directory_size if file is removed ([ipfs/go-ipfs#5586](https://github.com/ipfs/go-ipfs/pull/5586)) - - Bump Go versions and use '.x' to always get latest minor versions ([ipfs/go-ipfs#5682](https://github.com/ipfs/go-ipfs/pull/5682)) - - add rabin min error test ([ipfs/go-ipfs#5449](https://github.com/ipfs/go-ipfs/pull/5449)) - - Use CircleCI 2.0 ([ipfs/go-ipfs#5691](https://github.com/ipfs/go-ipfs/pull/5691)) - -Internal: - - Add ability to retrieve blocks even if given using a different CID version ([ipfs/go-ipfs#5285](https://github.com/ipfs/go-ipfs/pull/5285)) - - update gogo-protobuf ([ipfs/go-ipfs#5355](https://github.com/ipfs/go-ipfs/pull/5355)) - - update protobuf files in go-ipfs ([ipfs/go-ipfs#5356](https://github.com/ipfs/go-ipfs/pull/5356)) - - string-backed CIDs ([ipfs/go-ipfs#5441](https://github.com/ipfs/go-ipfs/pull/5441)) - - commands: switch object to CoreAPI ([ipfs/go-ipfs#4643](https://github.com/ipfs/go-ipfs/pull/4643)) - - coreapi: dag: Batching interface ([ipfs/go-ipfs#5340](https://github.com/ipfs/go-ipfs/pull/5340)) - - key cmd: Refactor to use coreapi ([ipfs/go-ipfs#5339](https://github.com/ipfs/go-ipfs/pull/5339)) - - coreapi: DHT API ([ipfs/go-ipfs#4804](https://github.com/ipfs/go-ipfs/pull/4804)) - - block cmd: Use coreapi ([ipfs/go-ipfs#5331](https://github.com/ipfs/go-ipfs/pull/5331)) - - mk: embed CurrentCommit in the right place ([ipfs/go-ipfs#5507](https://github.com/ipfs/go-ipfs/pull/5507)) - - added binary executable files to .dockerignore ([ipfs/go-ipfs#5544](https://github.com/ipfs/go-ipfs/pull/5544)) - - Add sessions when fetching MerkleDAG in LS ([ipfs/go-ipfs#5509](https://github.com/ipfs/go-ipfs/pull/5509)) - - coreapi: Swarm API ([ipfs/go-ipfs#4803](https://github.com/ipfs/go-ipfs/pull/4803)) - - coreapi swarm: unify impl type with other apis ([ipfs/go-ipfs#5551](https://github.com/ipfs/go-ipfs/pull/5551)) - - Refactor UnixFS CoreAPI ([ipfs/go-ipfs#5501](https://github.com/ipfs/go-ipfs/pull/5501)) - - coreapi: PubSub API ([ipfs/go-ipfs#4805](https://github.com/ipfs/go-ipfs/pull/4805)) - - fix: maketarball.sh for OSX ([ipfs/go-ipfs#5575](https://github.com/ipfs/go-ipfs/pull/5575)) - - test the correct return value when checking directory size ([ipfs/go-ipfs#5580](https://github.com/ipfs/go-ipfs/pull/5580)) - - coreapi unixfs: remove Cat ([ipfs/go-ipfs#5574](https://github.com/ipfs/go-ipfs/pull/5574)) - - Explicitally use BufferedDAG after removing Batch from importers ([ipfs/go-ipfs#5626](https://github.com/ipfs/go-ipfs/pull/5626)) - -Cleanup: - - Fix some weird code in core/coreunix/add.go ([ipfs/go-ipfs#5354](https://github.com/ipfs/go-ipfs/pull/5354)) - - name cmd: move subcommands to subdirectory ([ipfs/go-ipfs#5392](https://github.com/ipfs/go-ipfs/pull/5392)) - - directly parse peer IDs as peer IDs ([ipfs/go-ipfs#5409](https://github.com/ipfs/go-ipfs/pull/5409)) - - don't bother caching if we're using a nil repo ([ipfs/go-ipfs#5414](https://github.com/ipfs/go-ipfs/pull/5414)) - - object:refactor data encode error ([ipfs/go-ipfs#5426](https://github.com/ipfs/go-ipfs/pull/5426)) - - remove Godeps ([ipfs/go-ipfs#5440](https://github.com/ipfs/go-ipfs/pull/5440)) - - update for the go-ipfs-cmds refactor ([ipfs/go-ipfs#5035](https://github.com/ipfs/go-ipfs/pull/5035)) - - fix(unixfs): issue #5217 (Avoid use of `pb.Data`) ([ipfs/go-ipfs#5505](https://github.com/ipfs/go-ipfs/pull/5505)) - - fix(unixfs): issue #5055 ([ipfs/go-ipfs#5525](https://github.com/ipfs/go-ipfs/pull/5525)) - - add offline id test #4978 and refactor command code ([ipfs/go-ipfs#5562](https://github.com/ipfs/go-ipfs/pull/5562)) - - refact(command): replace option name with const string ([ipfs/go-ipfs#5642](https://github.com/ipfs/go-ipfs/pull/5642)) - - remove p2p-circuit addr hack in ipfs swarm peers ([ipfs/go-ipfs#5645](https://github.com/ipfs/go-ipfs/pull/5645)) - - refactor(commands/id): use new command ([ipfs/go-ipfs#5646](https://github.com/ipfs/go-ipfs/pull/5646)) - - object patch rm-link: change arg from 'link' to 'name' ([ipfs/go-ipfs#5638](https://github.com/ipfs/go-ipfs/pull/5638)) - - refactor(cmds): use new cmds lib in version, tar and dns ([ipfs/go-ipfs#5650](https://github.com/ipfs/go-ipfs/pull/5650)) - - cmds/dag: use new cmds lib ([ipfs/go-ipfs#5662](https://github.com/ipfs/go-ipfs/pull/5662)) - - commands/ping: use new cmds lib ([ipfs/go-ipfs#5675](https://github.com/ipfs/go-ipfs/pull/5675)) - -### related changelogs - -Changes to sub-packages go-ipfs depends on. This *does not* include libp2p or multiformats. - -github.com/ipfs/go-log - - update gogo protobuf ([ipfs/go-log#39](https://github.com/ipfs/go-log/pull/39)) - - rename the protobuf to loggabletracer ([ipfs/go-log#41](https://github.com/ipfs/go-log/pull/41)) - - protect loggers with rwmutex ([ipfs/go-log#44](https://github.com/ipfs/go-log/pull/44)) - - make logging prettier ([ipfs/go-log#45](https://github.com/ipfs/go-log/pull/45)) - - add env vars for logging to file and syslog ([ipfs/go-log#46](https://github.com/ipfs/go-log/pull/46)) - - remove syslogger ([ipfs/go-log#47](https://github.com/ipfs/go-log/pull/47)) - -github.com/ipfs/go-datastore - - implement DiskUsage for the rest of the datastores ([ipfs/go-datastore#86](https://github.com/ipfs/go-datastore/pull/86)) - - switch to google's uuid library ([ipfs/go-datastore#89](https://github.com/ipfs/go-datastore/pull/89)) - - return ErrNotFound from the NullDatastore instead of nil, nil ([ipfs/go-datastore#92](https://github.com/ipfs/go-datastore/pull/92)) - - Add TTL and Transactional interfaces ([ipfs/go-datastore#91](https://github.com/ipfs/go-datastore/pull/91)) - - improve testing ([ipfs/go-datastore#93](https://github.com/ipfs/go-datastore/pull/93)) - - Add support for querying entry expiration ([ipfs/go-datastore#96](https://github.com/ipfs/go-datastore/pull/96)) - - Allow ds.NewTransaction() to return an error ([ipfs/go-datastore#98](https://github.com/ipfs/go-datastore/pull/98)) - - add a GetSize method ([ipfs/go-datastore#99](https://github.com/ipfs/go-datastore/pull/99)) - -github.com/ipfs/go-cid - - Add tests for Set type ([ipfs/go-cid#63](https://github.com/ipfs/go-cid/pull/63)) - - Create new Builder interface for creating CIDs. ([ipfs/go-cid#53](https://github.com/ipfs/go-cid/pull/53)) - - cid-fmt Enhancments ([ipfs/go-cid#61](https://github.com/ipfs/go-cid/pull/61)) - - add String benchmark ([ipfs/go-cid#44](https://github.com/ipfs/go-cid/pull/44)) - - add a streaming CID set ([ipfs/go-cid#67](https://github.com/ipfs/go-cid/pull/67)) - - Extract non-core functionality from go-cid into go-cidutil ([ipfs/go-cid#69](https://github.com/ipfs/go-cid/pull/69)) - - cid implementation research ([ipfs/go-cid#70](https://github.com/ipfs/go-cid/pull/70)) - - cid implementation variations++ ([ipfs/go-cid#72](https://github.com/ipfs/go-cid/pull/72)) - - Create a new Encode method that is like StringOfBase but never errors ([ipfs/go-cid#60](https://github.com/ipfs/go-cid/pull/60)) - - add codecs for Dash blocks, tx ([ipfs/go-cid#78](https://github.com/ipfs/go-cid/pull/78)) - -github.com/ipfs/go-ds-flatfs - - check error before defer-removing disk usage file ([ipfs/go-ds-flatfs#47](https://github.com/ipfs/go-ds-flatfs/pull/47)) - - add GetSize function ([ipfs/go-ds-flatfs#48](https://github.com/ipfs/go-ds-flatfs/pull/48)) - -github.com/ipfs/go-ds-measure - - ([ipfs/go-ds-measure#](https://github.com/ipfs/go-ds-measure/pull/)) - -github.com/ipfs/go-ds-leveldb - - recover datastore on corruption ([ipfs/go-ds-leveldb#15](https://github.com/ipfs/go-ds-leveldb/pull/15)) - - Add transactional support to leveldb datastore. ([ipfs/go-ds-leveldb#17](https://github.com/ipfs/go-ds-leveldb/pull/17)) - - implement GetSize ([ipfs/go-ds-leveldb#18](https://github.com/ipfs/go-ds-leveldb/pull/18)) - -github.com/ipfs/go-metrics-prometheus - - use an existing metric when it has already been registered ([ipfs/go-metrics-prometheus#1](https://github.com/ipfs/go-metrics-prometheus/pull/1)) - -github.com/ipfs/go-metrics-interface - - update the counter interface to match prometheus ([ipfs/go-metrics-interface#2](https://github.com/ipfs/go-metrics-interface/pull/2)) - -github.com/ipfs/go-ipld-format - - add copy dagservice function ([ipfs/go-ipld-format#41](https://github.com/ipfs/go-ipld-format/pull/41)) - -github.com/ipfs/go-ipld-cbor - - Refactor to refmt ([ipfs/go-ipld-cbor#30](https://github.com/ipfs/go-ipld-cbor/pull/30)) - - import changes from the filecoin branch ([ipfs/go-ipld-cbor#41](https://github.com/ipfs/go-ipld-cbor/pull/41)) - - register the BitIntAtlasEntry for the tests ([ipfs/go-ipld-cbor#43](https://github.com/ipfs/go-ipld-cbor/pull/43)) - - attempt to allocate a bit less ([ipfs/go-ipld-cbor#45](https://github.com/ipfs/go-ipld-cbor/pull/45)) - -github.com/ipfs/go-ipfs-cmds - - check if we can decode an error before trying ([ipfs/go-ipfs-cmds#108](https://github.com/ipfs/go-ipfs-cmds/pull/108)) - - fix(option): print error message for error timeout option ([ipfs/go-ipfs-cmds#118](https://github.com/ipfs/go-ipfs-cmds/pull/118)) - - Create Jenkinsfile ([ipfs/go-ipfs-cmds#89](https://github.com/ipfs/go-ipfs-cmds/pull/89)) - - fix(add): refer to ipfs issue #5456 ([ipfs/go-ipfs-cmds#121](https://github.com/ipfs/go-ipfs-cmds/pull/121)) - - commands refactor 2.0 ([ipfs/go-ipfs-cmds#112](https://github.com/ipfs/go-ipfs-cmds/pull/112)) - - always assign keks to review new PRs ([ipfs/go-ipfs-cmds#123](https://github.com/ipfs/go-ipfs-cmds/pull/123)) - - extract go-ipfs-files ([ipfs/go-ipfs-cmds#125](https://github.com/ipfs/go-ipfs-cmds/pull/125)) - - split the value encoder and the error encoder ([ipfs/go-ipfs-cmds#128](https://github.com/ipfs/go-ipfs-cmds/pull/128)) - -github.com/ipfs/go-ipfs-cmdkit - - all: gofmt ([ipfs/go-ipfs-cmdkit#22](https://github.com/ipfs/go-ipfs-cmdkit/pull/22)) - - add standard ci scripts ([ipfs/go-ipfs-cmdkit#23](https://github.com/ipfs/go-ipfs-cmdkit/pull/23)) - - only count size for regular files ([ipfs/go-ipfs-cmdkit#25](https://github.com/ipfs/go-ipfs-cmdkit/pull/25)) - - Create Jenkinsfile ([ipfs/go-ipfs-cmdkit#16](https://github.com/ipfs/go-ipfs-cmdkit/pull/16)) - - Feat: add WebFile File implementation. ([ipfs/go-ipfs-cmdkit#26](https://github.com/ipfs/go-ipfs-cmdkit/pull/26)) - - feat(type): fix issue #28 ([ipfs/go-ipfs-cmdkit#29](https://github.com/ipfs/go-ipfs-cmdkit/pull/29)) - - Extract files package ([ipfs/go-ipfs-cmdkit#31](https://github.com/ipfs/go-ipfs-cmdkit/pull/31)) - -github.com/ipfs/go-ds-badger - - update protobuf ([ipfs/go-ds-badger#26](https://github.com/ipfs/go-ds-badger/pull/26)) - - exported type datastore => Datastore ([ipfs/go-ds-badger#1](https://github.com/ipfs/go-ds-badger/pull/1)) - - using exported Datastore type ([ipfs/go-ds-badger#2](https://github.com/ipfs/go-ds-badger/pull/2)) - - exported type datastore => Datastore ([ipfs/go-ds-badger#28](https://github.com/ipfs/go-ds-badger/pull/28)) - - Implement new TxDatastore and Txn interfaces ([ipfs/go-ds-badger#27](https://github.com/ipfs/go-ds-badger/pull/27)) - - Avoid discarding transaction too early in queries ([ipfs/go-ds-badger#31](https://github.com/ipfs/go-ds-badger/pull/31)) - - Ability to get entry expirations ([ipfs/go-ds-badger#32](https://github.com/ipfs/go-ds-badger/pull/32)) - - Update badger to 2.8.0 ([ipfs/go-ds-badger#33](https://github.com/ipfs/go-ds-badger/pull/33)) - - ds.NewTransaction() now returns an error parameter ([ipfs/go-ds-badger#36](https://github.com/ipfs/go-ds-badger/pull/36)) - - make has faster ([ipfs/go-ds-badger#37](https://github.com/ipfs/go-ds-badger/pull/37)) - - Implement GetSize and update badger ([ipfs/go-ds-badger#38](https://github.com/ipfs/go-ds-badger/pull/38)) - -github.com/ipfs/go-ipfs-addr - - Remove dependency on libp2p-circuit ([ipfs/go-ipfs-addr#7](https://github.com/ipfs/go-ipfs-addr/pull/7)) - -github.com/ipfs/go-ipfs-chunker - - return err when rabin min less than 16 ([ipfs/go-ipfs-chunker#3](https://github.com/ipfs/go-ipfs-chunker/pull/3)) - - switch to go-buffer-pool ([ipfs/go-ipfs-chunker#8](https://github.com/ipfs/go-ipfs-chunker/pull/8)) - - fix size-0 chunker bug ([ipfs/go-ipfs-chunker#9](https://github.com/ipfs/go-ipfs-chunker/pull/9)) - -github.com/ipfs/go-ipfs-routing - - update protobuf ([ipfs/go-ipfs-routing#8](https://github.com/ipfs/go-ipfs-routing/pull/8)) - - Implement SearchValue ([ipfs/go-ipfs-routing#12](https://github.com/ipfs/go-ipfs-routing/pull/12)) - -github.com/ipfs/go-ipfs-blockstore - - blockstore: Adding Stat method to map from Cid to BlockSize ([ipfs/go-ipfs-blockstore#5](https://github.com/ipfs/go-ipfs-blockstore/pull/5)) - - correctly convert the datastore not found errors ([ipfs/go-ipfs-blockstore#10](https://github.com/ipfs/go-ipfs-blockstore/pull/10)) - - Fix typo: Change 'should not' to 'should' ([ipfs/go-ipfs-blockstore#14](https://github.com/ipfs/go-ipfs-blockstore/pull/14)) - - fix test race condition ([ipfs/go-ipfs-blockstore#9](https://github.com/ipfs/go-ipfs-blockstore/pull/9)) - - make arccache.GetSize return ErrNotFound when not found ([ipfs/go-ipfs-blockstore#16](https://github.com/ipfs/go-ipfs-blockstore/pull/16)) - - use datastore.GetSize ([ipfs/go-ipfs-blockstore#17](https://github.com/ipfs/go-ipfs-blockstore/pull/17)) - -github.com/ipfs/go-ipns - - update gogo protobuf ([ipfs/go-ipns#16](https://github.com/ipfs/go-ipns/pull/16)) - - use new ExtractPublicKey signature ([ipfs/go-ipns#17](https://github.com/ipfs/go-ipns/pull/17)) - -github.com/ipfs/go-bitswap - - update gogo protobuf ([ipfs/go-bitswap#2](https://github.com/ipfs/go-bitswap/pull/2)) - - ci: add jenkins ([ipfs/go-bitswap#9](https://github.com/ipfs/go-bitswap/pull/9)) - - bitswap: Bitswap now sends multiple blocks per message ([ipfs/go-bitswap#5](https://github.com/ipfs/go-bitswap/pull/5)) - - reduce allocations ([ipfs/go-bitswap#12](https://github.com/ipfs/go-bitswap/pull/12)) - - buffer writes ([ipfs/go-bitswap#15](https://github.com/ipfs/go-bitswap/pull/15)) - - delay finding providers ([ipfs/go-bitswap#17](https://github.com/ipfs/go-bitswap/pull/17)) -github.com/ipfs/go-blockservice - - Avoid allocating a session unless we need it ([ipfs/go-blockservice#6](https://github.com/ipfs/go-blockservice/pull/6)) - -github.com/ipfs/go-cidutil - - add a utility method for sorting CID slices ([ipfs/go-cidutil#5](https://github.com/ipfs/go-cidutil/pull/5)) - -github.com/ipfs/go-ipfs-config - - Add pubsub configuration options ([ipfs/go-ipfs-config#3](https://github.com/ipfs/go-ipfs-config/pull/3)) - - add QUIC experiment ([ipfs/go-ipfs-config#4](https://github.com/ipfs/go-ipfs-config/pull/4)) - - Add Gateway.APICommands for /api allowlists ([ipfs/go-ipfs-config#10](https://github.com/ipfs/go-ipfs-config/pull/10)) - - allow multiple API/Gateway addresses ([ipfs/go-ipfs-config#11](https://github.com/ipfs/go-ipfs-config/pull/11)) - - Fix handling of null strings ([ipfs/go-ipfs-config#12](https://github.com/ipfs/go-ipfs-config/pull/12)) - - add experiment for p2p http proxy ([ipfs/go-ipfs-config#13](https://github.com/ipfs/go-ipfs-config/pull/13)) - - add message signing config options ([ipfs/go-ipfs-config#18](https://github.com/ipfs/go-ipfs-config/pull/18)) - -github.com/ipfs/go-merkledag - - Add FetchGraphWithDepthLimit to specify depth-limited graph fetching. ([ipfs/go-merkledag#2](https://github.com/ipfs/go-merkledag/pull/2)) - - update gogo protobuf ([ipfs/go-merkledag#4](https://github.com/ipfs/go-merkledag/pull/4)) - - Update to use new Builder interface for creating CIDs. ([ipfs/go-merkledag#6](https://github.com/ipfs/go-merkledag/pull/6)) - - perf: avoid allocations when filtering nodes ([ipfs/go-merkledag#11](https://github.com/ipfs/go-merkledag/pull/11)) - -github.com/ipfs/go-mfs - - fix(unixfs): issue #6 ([ipfs/go-mfs#7](https://github.com/ipfs/go-mfs/pull/7)) - - fix(type): issue #13 ([ipfs/go-mfs#14](https://github.com/ipfs/go-mfs/pull/14)) - -github.com/ipfs/go-path - - fix: don't dag.Get in ResolveToLastNode when not needed ([ipfs/go-path#1](https://github.com/ipfs/go-path/pull/1)) - -github.com/ipfs/go-unixfs - - update gogo protobuf ([ipfs/go-unixfs#6](https://github.com/ipfs/go-unixfs/pull/6)) - - Update to use new Builder interface for creating CIDs. ([ipfs/go-unixfs#7](https://github.com/ipfs/go-unixfs/pull/7)) - - nit: make dagTruncate a method on DagModifier ([ipfs/go-unixfs#13](https://github.com/ipfs/go-unixfs/pull/13)) - - fix(fsnode): issue #17 ([ipfs/go-unixfs#18](https://github.com/ipfs/go-unixfs/pull/18)) - - Use EnumerateChildrenAsync in for enumerating HAMT links ([ipfs/go-unixfs#19](https://github.com/ipfs/go-unixfs/pull/19)) - -## 0.4.17 2018-07-27 - -Ipfs 0.4.17 is a quick release to fix a major performance regression in bitswap -(mostly affecting go-ipfs -> js-ipfs transfers). However, while motivated by -this fix, this release contains a few other goodies that will excite some users. - -The headline feature in this release is [urlstore][] support. Urlstore is a -generalization of the filestore backend that can fetch file blocks from remote -URLs on-demand instead of storing them in the local datastore. - -Additionally, we've added support for extracting inline blocks from CIDs (blocks -inlined into CIDs using the identity hash function). However, go-ipfs won't yet -*create* such CIDs so you're unlikely to see any in the wild. - -[urlstore]: https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-urlstore - -Features: - -* URLStore ([ipfs/go-ipfs#4896](https://github.com/ipfs/go-ipfs/pull/4896)) -* Add trickle-dag support to the urlstore ([ipfs/go-ipfs#5245](https://github.com/ipfs/go-ipfs/pull/5245)). -* Allow specifying how the data field in the `object get` is encoded ([ipfs/go-ipfs#5139](https://github.com/ipfs/go-ipfs/pull/5139)) -* Add a `-U` flag to `files ls` to disable sorting ([ipfs/go-ipfs#5219](https://github.com/ipfs/go-ipfs/pull/5219)) -* Add an efficient `--size-only` flag to the `repo stat` ([ipfs/go-ipfs#5010](https://github.com/ipfs/go-ipfs/pull/5010)) -* Inline blocks in CIDs ([ipfs/go-ipfs#5117](https://github.com/ipfs/go-ipfs/pull/5117)) - -Changes/Fixes: - -* Make `ipfs files ls -l` correctly report the hash and size of files ([ipfs/go-ipfs#5045](https://github.com/ipfs/go-ipfs/pull/5045)) -* Fix sorting of `files ls` ([ipfs/go-ipfs#5219](https://github.com/ipfs/go-ipfs/pull/5219)) -* Improve prefetching in `ipfs cat` and related commands ([ipfs/go-ipfs#5162](https://github.com/ipfs/go-ipfs/pull/5162)) -* Better error message when `ipfs cp` fails ([ipfs/go-ipfs#5218](https://github.com/ipfs/go-ipfs/pull/5218)) -* Don't wait for the peer to close it's end of a bitswap stream before considering the block "sent" ([ipfs/go-ipfs#5258](https://github.com/ipfs/go-ipfs/pull/5258)) -* Fix resolving links in sharded directories via the gateway ([ipfs/go-ipfs#5271](https://github.com/ipfs/go-ipfs/pull/5271)) -* Fix building when there's a space in the current directory ([ipfs/go-ipfs#5261](https://github.com/ipfs/go-ipfs/pull/5261)) - -Documentation: - -* Improve documentation about the bloomfilter config options ([ipfs/go-ipfs#4924](https://github.com/ipfs/go-ipfs/pull/4924)) - -General refactorings and internal bug fixes: - -* Remove the `Offset()` method from the DAGReader ([ipfs/go-ipfs#5190](https://github.com/ipfs/go-ipfs/pull/5190)) -* Fix TestLargeWriteChunks seek behavior ([ipfs/go-ipfs#5276](https://github.com/ipfs/go-ipfs/pull/5276)) -* Add a build tag to disable dynamic plugins ([ipfs/go-ipfs#5274](https://github.com/ipfs/go-ipfs/pull/5274)) -* Use FSNode instead of the Protobuf structure in PBDagReader ([ipfs/go-ipfs#5189](https://github.com/ipfs/go-ipfs/pull/5189)) -* Remove support for non-directory MFS roots ([ipfs/go-ipfs#5170](https://github.com/ipfs/go-ipfs/pull/5170)) -* Remove `UnixfsNode` from the balanced builder ([ipfs/go-ipfs#5118](https://github.com/ipfs/go-ipfs/pull/5118)) -* Fix truncating files (internal) when already at the correct size ([ipfs/go-ipfs#5253](https://github.com/ipfs/go-ipfs/pull/5253)) -* Fix `dagTruncate` (internal) to preserve the node type ([ipfs/go-ipfs#5216](https://github.com/ipfs/go-ipfs/pull/5216)) -* Add an internal interface for unixfs directories ([ipfs/go-ipfs#5160](https://github.com/ipfs/go-ipfs/pull/5160)) -* Refactor the CoreAPI path types and interfaces ([ipfs/go-ipfs#4672](https://github.com/ipfs/go-ipfs/pull/4672)) -* Refactor `precalcNextBuf` in the dag reader ([ipfs/go-ipfs#5237](https://github.com/ipfs/go-ipfs/pull/5237)) -* Update a bunch of dependencies that haven't been updated for a while ([ipfs/go-ipfs#5268](https://github.com/ipfs/go-ipfs/pull/5268)) - -## 0.4.16 2018-07-13 - -Ipfs 0.4.16 is a fairly small release in terms of changes to the ipfs codebase, -but it contains a huge amount of changes and improvements from the libraries we -depend on, notably libp2p. - -This release includes small a repo migration to account for some changes to the -DHT. It should only take a second to run but, depending on your configuration, -you may need to run it manually. - -You can run a migration by either: - -1. Selecting "Yes" when the daemon prompts you to migrate. -2. Running the daemon with the `--migrate=true` flag. -3. Manually [running](https://github.com/ipfs/fs-repo-migrations/blob/master/run.md#running-repo-migrations) the migration. - -### Libp2p - -This version of ipfs contains the changes made in libp2p from v5.0.14 through -v6.0.5. In that time, we have made significant changes to the codebase to allow -for easier integration of future transports and modules along with the usual -performance and reliability improvements. You can find many of these -improvements in the libp2p 6.0 [release blog -post](https://ipfs.io/blog/39-go-libp2p-6-0-0/). - -The primary motivation for this refactor was adding support for network -transports like QUIC that have built-in support for encryption, authentication, -and stream multiplexing. It will also allow us to plug-in new security -transports (like TLS) without hard-coding them. - -For example, our [QUIC -transport](https://github.com/libp2p/go-libp2p-quic-transport) currently works, -and can be plugged into libp2p manually (though note that it is still -experimental, as the upstream spec is still in flux). Further work is needed to -make enabling this inside ipfs easy and not require recompilation. - -On the user-visible side of things, we've improved our dialing logic and -timeouts. We now abort dials to local subnets after 5 seconds and abort all -dials if the TCP handshake takes longer than 5 seconds. This should -significantly improve performance in some cases as we limit the number of -concurrent dials and slow dials to non-responsive peers have been known to clog -the dialer, blocking dials to reachable peers. Importantly, this should improve -DHT performance as it tends to spend a disproportional amount of time connecting -to peers. - -We have also made a few noticeable changes to the DHT: we've significantly -improved the chances of finding a value on the DHT, tightened up some of our -validation logic, and fixed some issues that should reduce traffic to nodes -running in dhtclient mode over time. - -Of these, the first one will likely see the most impact. In the past, when -putting a value (e.g., an IPNS entry) into the DHT, we'd try to put the value to -K peers (where K for us is 20). However, we'd often fail to connect to many of -these peers so we'd end up putting the value to significantly fewer than K -peers. We now try to put the value to the K peers we can actually connect to. - -Finally, we've fixed JavaScript interoperability in go-multiplex, the one stream -muxer that both go-libp2p and js-libp2p implement. This should significantly -improve go-libp2p and js-libp2p interoperability. - -### Multiformats - -We are also changing the way that people write 'ipfs' multiaddrs. Currently, -ipfs multiaddrs look something like -`/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ`. -However, calling them 'ipfs' multiaddrs is a bit misleading, as this is actually -the multiaddr of a libp2p peer that happens to run ipfs. Other protocols built -on libp2p right now still have to use multiaddrs that say 'ipfs', even if they -have nothing to do with ipfs. Therefore, we are renaming them to 'p2p' -multiaddrs. Moving forward, these addresses will be written as: -`/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ`. - -This release adds support for *parsing* both types of addresses (`.../ipfs/...` -and `.../p2p/...`) into the same network format, and the network format is -remaining exactly the same. A future release will have the ipfs daemon switch to -*printing* out addresses this way once a large enough portion of the network -has upgraded. - -N.B., these addresses are *not* related to IPFS *file* names (`/ipfs/Qm...`). -Disambiguating the two was yet another motivation to switch the protocol name to -`/p2p/`. - -### IPFS - -On the ipfs side of things, we've started embedding public keys inside IPNS -records and have enabled the Git plugin by default. - -Embedding public keys inside IPNS records allows lookups to be faster as we only -need to fetch the record itself (and not the public key separately). It also -fixes an issue where DHT peers wouldn't store a record for a peer if they didn't -have their public key already. Combined with some of the DHT and dialing fixes, -this should improve the performance of IPNS (once a majority of the network -updates). - -Second, our public builds now include the Git plugin (in past builds, you could -add it yourself, but doing so was not easy). With this, ipfs can ingest and -operate over Git repositories and commit graphs directly. For more information -on this, see [the go-ipld-git repo](https://github.com/ipfs/go-ipld-git). - -Finally, we've included many smaller bugfixes, refactorings, improved -documentation, and a good bit more. For the full details, see the changelog -below. - -## 0.4.16-rc3 2018-07-09 -- Bugfixes - - Fix dht commands when ipns over pubsub is enabled ([ipfs/go-ipfs#5200](https://github.com/ipfs/go-ipfs/pull/5200)) - - Fix content routing when ipns over pubsub is enabled ([ipfs/go-ipfs#5200](https://github.com/ipfs/go-ipfs/pull/5200)) - - Correctly handle multi-hop dnslink resolution ([ipfs/go-ipfs#5202](https://github.com/ipfs/go-ipfs/pull/5202)) - -## 0.4.16-rc2 2018-07-05 -- Bugfixes - - Fix usage of file name vs path name in adder ([ipfs/go-ipfs#5167](https://github.com/ipfs/go-ipfs/pull/5167)) - - Fix `ipfs update` working with migrations ([ipfs/go-ipfs#5194](https://github.com/ipfs/go-ipfs/pull/5194)) -- Documentation - - Grammar fix in fuse docs ([ipfs/go-ipfs#5164](https://github.com/ipfs/go-ipfs/pull/5164)) - -## 0.4.16-rc1 2018-06-27 -- Features - - Embed public keys inside ipns records, use for validation ([ipfs/go-ipfs#5079](https://github.com/ipfs/go-ipfs/pull/5079)) - - Preload git plugin by default ([ipfs/go-ipfs#4991](https://github.com/ipfs/go-ipfs/pull/4991)) -- Improvements - - Only resolve dnslinks once in the gateway ([ipfs/go-ipfs#4977](https://github.com/ipfs/go-ipfs/pull/4977)) - - Libp2p transport refactor update ([ipfs/go-ipfs#4817](https://github.com/ipfs/go-ipfs/pull/4817)) - - Improve swarm connect/disconnect commands ([ipfs/go-ipfs#5107](https://github.com/ipfs/go-ipfs/pull/5107)) -- Documentation - - Fix typo of sudo install command ([ipfs/go-ipfs#5001](https://github.com/ipfs/go-ipfs/pull/5001)) - - Fix experimental features Table of Contents ([ipfs/go-ipfs#4976](https://github.com/ipfs/go-ipfs/pull/4976)) - - Fix link to systemd init scripts in the README ([ipfs/go-ipfs#4968](https://github.com/ipfs/go-ipfs/pull/4968)) - - Add package overview comments to coreapi ([ipfs/go-ipfs#5108](https://github.com/ipfs/go-ipfs/pull/5108)) - - Add README to docs folder ([ipfs/go-ipfs#5095](https://github.com/ipfs/go-ipfs/pull/5095)) - - Add system requirements to README ([ipfs/go-ipfs#5137](https://github.com/ipfs/go-ipfs/pull/5137)) -- Bugfixes - - Fix goroutine leak in pin verify ([ipfs/go-ipfs#5011](https://github.com/ipfs/go-ipfs/pull/5011)) - - Fix commit string in version ([ipfs/go-ipfs#4982](https://github.com/ipfs/go-ipfs/pull/4982)) - - Fix `key rename` command output error ([ipfs/go-ipfs#4962](https://github.com/ipfs/go-ipfs/pull/4962)) - - Report error source when failing to construct private network ([ipfs/go-ipfs#4952](https://github.com/ipfs/go-ipfs/pull/4952)) - - Fix build on DragonFlyBSD ([ipfs/go-ipfs#5031](https://github.com/ipfs/go-ipfs/pull/5031)) - - Fix goroutine leak in dag put ([ipfs/go-ipfs#5016](https://github.com/ipfs/go-ipfs/pull/5016)) - - Fix goroutine leaks in refs.go ([ipfs/go-ipfs#5018](https://github.com/ipfs/go-ipfs/pull/5018)) - - Fix panic, Don't handle errors with fallthrough ([ipfs/go-ipfs#5072](https://github.com/ipfs/go-ipfs/pull/5072)) - - Fix how filestore is hooked up with caching ([ipfs/go-ipfs#5122](https://github.com/ipfs/go-ipfs/pull/5122)) - - Add record validation to offline routing ([ipfs/go-ipfs#5116](https://github.com/ipfs/go-ipfs/pull/5116)) - - Fix `ipfs update` working with migrations ([ipfs/go-ipfs#5194](https://github.com/ipfs/go-ipfs/pull/5194)) -- General Changes and Refactorings - - Remove leftover bits of dead code ([ipfs/go-ipfs#5022](https://github.com/ipfs/go-ipfs/pull/5022)) - - Remove fuse platform build constraints ([ipfs/go-ipfs#5033](https://github.com/ipfs/go-ipfs/pull/5033)) - - Warning when legacy NoSync setting is set ([ipfs/go-ipfs#5036](https://github.com/ipfs/go-ipfs/pull/5036)) - - Clean up and refactor namesys module ([ipfs/go-ipfs#5007](https://github.com/ipfs/go-ipfs/pull/5007)) - - When raw-leaves are used for empty files use 'Raw' nodes ([ipfs/go-ipfs#4693](https://github.com/ipfs/go-ipfs/pull/4693)) - - Update dist_root in build scripts ([ipfs/go-ipfs#5093](https://github.com/ipfs/go-ipfs/pull/5093)) - - Integrate `pb.Data` into `FSNode` to avoid duplicating fields ([ipfs/go-ipfs#5098](https://github.com/ipfs/go-ipfs/pull/5098)) - - Reduce log level when we can't republish ([ipfs/go-ipfs#5091](https://github.com/ipfs/go-ipfs/pull/5091)) - - Extract ipns record logic to go-ipns ([ipfs/go-ipfs#5124](https://github.com/ipfs/go-ipfs/pull/5124)) -- Testing - - Collect test times for sharness ([ipfs/go-ipfs#4959](https://github.com/ipfs/go-ipfs/pull/4959)) - - Fix sharness iptb connect timeout ([ipfs/go-ipfs#4966](https://github.com/ipfs/go-ipfs/pull/4966)) - - Add more timeouts to the jenkins pipeline ([ipfs/go-ipfs#4958](https://github.com/ipfs/go-ipfs/pull/4958)) - - Use go 1.10 on jenkins ([ipfs/go-ipfs#5009](https://github.com/ipfs/go-ipfs/pull/5009)) - - Speed up multinode sharness test ([ipfs/go-ipfs#4967](https://github.com/ipfs/go-ipfs/pull/4967)) - - Print out iptb logs on iptb test failure (for debugging CI) ([ipfs/go-ipfs#5069](https://github.com/ipfs/go-ipfs/pull/5069)) - - Disable the MacOS tests in jenkins ([ipfs/go-ipfs#5119](https://github.com/ipfs/go-ipfs/pull/5119)) - - Make republisher test robust against timing issues ([ipfs/go-ipfs#5125](https://github.com/ipfs/go-ipfs/pull/5125)) - - Archive sharness trash dirs in jenkins ([ipfs/go-ipfs#5071](https://github.com/ipfs/go-ipfs/pull/5071)) - - Fixup DHT sharness tests ([ipfs/go-ipfs#5114](https://github.com/ipfs/go-ipfs/pull/5114)) -- Dependencies - - Update go-ipld-git to fix mergetag resolving ([ipfs/go-ipfs#4988](https://github.com/ipfs/go-ipfs/pull/4988)) - - Fix duplicate /x/sys imports ([ipfs/go-ipfs#5068](https://github.com/ipfs/go-ipfs/pull/5068)) - - Update stream multiplexers ([ipfs/go-ipfs#5075](https://github.com/ipfs/go-ipfs/pull/5075)) - - Update dependencies: go-log, sys, go-crypto ([ipfs/go-ipfs#5100](https://github.com/ipfs/go-ipfs/pull/5100)) - - Explicitly import go-multiaddr-dns in config/bootstrap_peers ([ipfs/go-ipfs#5144](https://github.com/ipfs/go-ipfs/pull/5144)) - - Gx update with dht and dialing improvements ([ipfs/go-ipfs#5158](https://github.com/ipfs/go-ipfs/pull/5158)) - -## 0.4.15 2018-05-09 - -This release is significantly smaller than the last as much of the work on -improving our datastores, and other libraries libp2p has yet to be merged. -However, it still includes many welcome improvements. - -As with 0.4.12 and 0.4.14 (0.4.13 was a patch), this release has a negative -diff-stat. Unfortunately, much of this code isn't actually going away but at -least it's being moved out into separate repositories. - -Much of the work that made it into this release is under the hood. We've cleaned -up some code, extracted several packages into their own repositories, and made -some long neglected optimizations (e.g., handling of sharded directories). -Additionally, this release includes a bunch of tests for our CLI commands that -should help us avoid some of the issues we've seen in the past few releases. - -More visibly, thanks to @djdv's efforts, this release includes some significant -Windows improvements (with more on the way). Specifically, this release includes -better handling of repo lockfiles (no more `ipfs repo fsck`), stdin command-line -support, and, last but not least, IPFS no longer writes random files with scary -garbage in the drive root. To read more about future windows improvements, take -a look at this [blog post](https://blog.ipfs.io/36-a-look-at-windows/). - -To better support low-power devices, we've added a low-power config profile. -This can be enabled when initializing a repo by running `ipfs init` with the -`--profile=lowpower` flag or later by running `ipfs config profile apply lowpower`. - -Finally, with this release we have begun distributing self-contained source -archives of go-ipfs and its dependencies. This should be a welcome improvement -for both packagers and those living in countries with harmonized internet -access. - -- Features - - Add options for record count and timeout for resolving DHT paths ([ipfs/go-ipfs#4733](https://github.com/ipfs/go-ipfs/pull/4733)) - - Add low power init profile ([ipfs/go-ipfs#4154](https://github.com/ipfs/go-ipfs/pull/4154)) - - Add Opentracing plugin support ([ipfs/go-ipfs#4506](https://github.com/ipfs/go-ipfs/pull/4506)) - - Add make target to build source tarballs ([ipfs/go-ipfs#4920](https://github.com/ipfs/go-ipfs/pull/4920)) - -- Improvements - - Add BlockedFetched/Added/Removed events to Blockservice ([ipfs/go-ipfs#4649](https://github.com/ipfs/go-ipfs/pull/4649)) - - Improve performance of HAMT code ([ipfs/go-ipfs#4889](https://github.com/ipfs/go-ipfs/pull/4889)) - - Avoid unnecessarily resolving child nodes when listing a sharded directory ([ipfs/go-ipfs#4884](https://github.com/ipfs/go-ipfs/pull/4884)) - - Tar writer now supports sharded ipfs directories ([ipfs/go-ipfs#4873](https://github.com/ipfs/go-ipfs/pull/4873)) - - Infer type from CID when possible in `ipfs ls` ([ipfs/go-ipfs#4890](https://github.com/ipfs/go-ipfs/pull/4890)) - - Deduplicate keys in GetMany ([ipfs/go-ipfs#4888](https://github.com/ipfs/go-ipfs/pull/4888)) - -- Documentation - - Fix spelling of retrieval ([ipfs/go-ipfs#4819](https://github.com/ipfs/go-ipfs/pull/4819)) - - Update broken links ([ipfs/go-ipfs#4798](https://github.com/ipfs/go-ipfs/pull/4798)) - - Remove roadmap.md ([ipfs/go-ipfs#4834](https://github.com/ipfs/go-ipfs/pull/4834)) - - Remove link to IPFS paper in contribute.md ([ipfs/go-ipfs#4812](https://github.com/ipfs/go-ipfs/pull/4812)) - - Fix broken todo link in readme.md ([ipfs/go-ipfs#4865](https://github.com/ipfs/go-ipfs/pull/4865)) - - Document ipns pubsub ([ipfs/go-ipfs#4903](https://github.com/ipfs/go-ipfs/pull/4903)) - - Fix missing profile docs ([ipfs/go-ipfs#4846](https://github.com/ipfs/go-ipfs/pull/4846)) - - Fix a few typos ([ipfs/go-ipfs#4835](https://github.com/ipfs/go-ipfs/pull/4835)) - - Fix typo in fsrepo error message ([ipfs/go-ipfs#4933](https://github.com/ipfs/go-ipfs/pull/4933)) - - Remove go-ipfs version from issue template ([ipfs/go-ipfs#4943](https://github.com/ipfs/go-ipfs/pull/4943)) - - Add docs for --profile=lowpower ([ipfs/go-ipfs#4970](https://github.com/ipfs/go-ipfs/pull/4970)) - - Improve Windows build documentation ([ipfs/go-ipfs#4691](https://github.com/ipfs/go-ipfs/pull/4691)) - -- Bugfixes - - Check CIDs in base case when diffing nodes ([ipfs/go-ipfs#4767](https://github.com/ipfs/go-ipfs/pull/4767)) - - Support for CIDv1 with custom mhtype in `ipfs block put` ([ipfs/go-ipfs#4563](https://github.com/ipfs/go-ipfs/pull/4563)) - - Clean path in DagArchive ([ipfs/go-ipfs#4743](https://github.com/ipfs/go-ipfs/pull/4743)) - - Set the prefix for MFS root in `ipfs add --hash-only` ([ipfs/go-ipfs#4755](https://github.com/ipfs/go-ipfs/pull/4755)) - - Fix get output path ([ipfs/go-ipfs#4809](https://github.com/ipfs/go-ipfs/pull/4809)) - - Fix incorrect Read calls ([ipfs/go-ipfs#4792](https://github.com/ipfs/go-ipfs/pull/4792)) - - Use prefix in bootstrapWritePeers ([ipfs/go-ipfs#4832](https://github.com/ipfs/go-ipfs/pull/4832)) - - Fix mfs Directory.Path not working ([ipfs/go-ipfs#4844](https://github.com/ipfs/go-ipfs/pull/4844)) - - Remove header in `ipfs stats bw` if not polling ([ipfs/go-ipfs#4856](https://github.com/ipfs/go-ipfs/pull/4856)) - - Match Go's GOPATH defaults behaviour in build scripts ([ipfs/go-ipfs#4678](https://github.com/ipfs/go-ipfs/pull/4678)) - - Fix default-net profile not reverting bootstrap config ([ipfs/go-ipfs#4845](https://github.com/ipfs/go-ipfs/pull/4845)) - - Fix excess goroutines in bitswap caused by insecure CIDs ([ipfs/go-ipfs#4946](https://github.com/ipfs/go-ipfs/pull/4946)) - -- General Changes and Refactorings - - Refactor trickle DAG builder ([ipfs/go-ipfs#4730](https://github.com/ipfs/go-ipfs/pull/4730)) - - Split the coreapi interface into multiple files ([ipfs/go-ipfs#4802](https://github.com/ipfs/go-ipfs/pull/4802)) - - Make `ipfs init` command use new cmds lib ([ipfs/go-ipfs#4732](https://github.com/ipfs/go-ipfs/pull/4732)) - - Extract thirdparty/tar package ([ipfs/go-ipfs#4857](https://github.com/ipfs/go-ipfs/pull/4857)) - - Reduce log level when for disconnected peers to info ([ipfs/go-ipfs#4811](https://github.com/ipfs/go-ipfs/pull/4811)) - - Only visit nodes in EnumerateChildrenAsync when asked ([ipfs/go-ipfs#4885](https://github.com/ipfs/go-ipfs/pull/4885)) - - Refactor coreapi options ([ipfs/go-ipfs#4807](https://github.com/ipfs/go-ipfs/pull/4807)) - - Fix error style for most errors ([ipfs/go-ipfs#4829](https://github.com/ipfs/go-ipfs/pull/4829)) - - Ensure `--help` always works, even with /dev/null stdin ([ipfs/go-ipfs#4849](https://github.com/ipfs/go-ipfs/pull/4849)) - - Deduplicate AddNodeLinkClean into AddNodeLink ([ipfs/go-ipfs#4940](https://github.com/ipfs/go-ipfs/pull/4940)) - - Remove some dead code ([ipfs/go-ipfs#4833](https://github.com/ipfs/go-ipfs/pull/4833)) - - Remove unused imports ([ipfs/go-ipfs#4955](https://github.com/ipfs/go-ipfs/pull/4955)) - - Fix go vet warnings ([ipfs/go-ipfs#4859](https://github.com/ipfs/go-ipfs/pull/4859)) - -- Testing - - Generate JUnit test reports for sharness tests ([ipfs/go-ipfs#4530](https://github.com/ipfs/go-ipfs/pull/4530)) - - Fix t0063-daemon-init.sh by adding test profile to daemon ([ipfs/go-ipfs#4816](https://github.com/ipfs/go-ipfs/pull/4816)) - - Remove circular dependencies in merkledag package tests ([ipfs/go-ipfs#4704](https://github.com/ipfs/go-ipfs/pull/4704)) - - Check that all the commands fail when passed a bad flag ([ipfs/go-ipfs#4848](https://github.com/ipfs/go-ipfs/pull/4848)) - - Allow for some small margin of code coverage dropping on commit ([ipfs/go-ipfs#4867](https://github.com/ipfs/go-ipfs/pull/4867)) - - Add confirmation to archive-branches script ([ipfs/go-ipfs#4797](https://github.com/ipfs/go-ipfs/pull/4797)) - -- Dependencies - - Update lock package ([ipfs/go-ipfs#4855](https://github.com/ipfs/go-ipfs/pull/4855)) - - Update to latest go-datastore. Remove thirdparty/datastore2 ([ipfs/go-ipfs#4742](https://github.com/ipfs/go-ipfs/pull/4742)) - - Extract fs lock into go-fs-lock ([ipfs/go-ipfs#4631](https://github.com/ipfs/go-ipfs/pull/4631)) - - Extract: exchange/interface.go, blocks/blocksutil, exchange/offline ([ipfs/go-ipfs#4912](https://github.com/ipfs/go-ipfs/pull/4912)) - - Remove unused lock dep ([ipfs/go-ipfs#4971](https://github.com/ipfs/go-ipfs/pull/4971)) - - Update iptb ([ipfs/go-ipfs#4965](https://github.com/ipfs/go-ipfs/pull/4965)) - - Update go-ipfs-cmds to fix stdin on windows ([ipfs/go-ipfs#4975](https://github.com/ipfs/go-ipfs/pull/4975)) - - Update go-ds-flatfs to fix windows corruption issue ([ipfs/go-ipfs#4872](https://github.com/ipfs/go-ipfs/pull/4872)) - -## 0.4.14 2018-03-22 - -Ipfs 0.4.14 is a big release with a large number of improvements and bugfixes. -It is also the first release of 2018, and our first release in over three -months. The release took longer than expected due to our refactoring and -extracting of our commands library. This refactor had two stages. The first -round of the refactor disentangled the commands code from core ipfs code, -allowing us to move it out into a [separate -repository](https://github.com/ipfs/go-ipfs-cmds). The code was previously -very entangled with the go-ipfs codebase and not usable for other projects. -The second round of the refactor had the goal of fixing several major issues -around streaming outputs, progress bars, and error handling. It also paved the -way for us to more easily provide an API over other transports, such as -websockets and unix domain sockets. It took a while to flush out all the kinks -on such a massive change. We're pretty sure we've got most of them, but if you -notice anything weird, please let us know. - -Beyond that, we've added a new experimental way to use IPNS. With the new -pubsub IPNS resolver and publisher, you can subscribe to updates of an IPNS -entry, and the owner can publish out changes in real time. With this, IPNS can -become nearly instantaneous. To make use of this, simply start your ipfs daemon -with the `--enable-namesys-pubsub` option, and all IPNS resolution and -publishing will use pubsub. Note that resolving an IPNS name via pubsub without -someone publishing it via pubsub will result in a fallback to using the DHT. -Please give this a try and let us know how it goes! - -Memory and CPU usage should see a noticeable improvement in this release. We -have spent considerable time fixing excess memory usage throughout the codebase -and down into libp2p. Fixes in peer tracking, bitswap allocation, pinning, and -many other places have brought down both peak and average memory usage. An -upgraded hashing library, base58 encoding library, and improved allocation -patterns all contribute to overall lower CPU usage across the board. See the -full changelist below for more memory and CPU usage improvements. - -This release also brings the beginning of the ipfs 'Core API'. Once finished, -the Core API will be the primary way to interact with go-ipfs using go. Both -embedded nodes and nodes accessed over the http API will have the same -interface. Stay tuned for future updates and documentation. - -These are only a sampling of the changes that made it into this release, the -full list (almost 100 PRs!) is below. - -Finally, I'd like to thank everyone who contributed to this release, whether -you're just contributing a typo fix or driving new features. We are really -grateful to everyone who has spent their their time pushing ipfs forward. - -SECURITY NOTE: - -This release of ipfs disallows the usage of insecure hash functions and -lengths. Ipfs does not create these insecure objects for any purpose, but it -did allow manually creating them and fetching them from other peers. If you -currently have objects using insecure hashes in your local ipfs repo, please -remove them before updating. - -#### Changes from rc2 to rc3 -- Fix bug in stdin argument parsing ([ipfs/go-ipfs#4827](https://github.com/ipfs/go-ipfs/pull/4827)) -- Revert commands back to sending a single response ([ipfs/go-ipfs#4822](https://github.com/ipfs/go-ipfs/pull/4822)) - -#### Changes from rc1 to rc2 -- Fix issue in ipfs get caused by go1.10 changes ([ipfs/go-ipfs#4790](https://github.com/ipfs/go-ipfs/pull/4790)) - -- Features - - Pubsub IPNS Publisher and Resolver (experimental) ([ipfs/go-ipfs#4047](https://github.com/ipfs/go-ipfs/pull/4047)) - - Implement coreapi Dag interface ([ipfs/go-ipfs#4471](https://github.com/ipfs/go-ipfs/pull/4471)) - - Add --offset flag to ipfs cat ([ipfs/go-ipfs#4538](https://github.com/ipfs/go-ipfs/pull/4538)) - - Command to apply config profile after init ([ipfs/go-ipfs#4195](https://github.com/ipfs/go-ipfs/pull/4195)) - - Implement coreapi Name and Key interfaces ([ipfs/go-ipfs#4477](https://github.com/ipfs/go-ipfs/pull/4477)) - - Add --length flag to ipfs cat ([ipfs/go-ipfs#4553](https://github.com/ipfs/go-ipfs/pull/4553)) - - Implement coreapi Object interface ([ipfs/go-ipfs#4492](https://github.com/ipfs/go-ipfs/pull/4492)) - - Implement coreapi Block interface ([ipfs/go-ipfs#4548](https://github.com/ipfs/go-ipfs/pull/4548)) - - Implement coreapi Pin interface ([ipfs/go-ipfs#4575](https://github.com/ipfs/go-ipfs/pull/4575)) - - Add a --with-local flag to ipfs files stat ([ipfs/go-ipfs#4638](https://github.com/ipfs/go-ipfs/pull/4638)) - - Disallow usage of blocks with insecure hashes ([ipfs/go-ipfs#4751](https://github.com/ipfs/go-ipfs/pull/4751)) -- Improvements - - Add uuid to event logs ([ipfs/go-ipfs#4392](https://github.com/ipfs/go-ipfs/pull/4392)) - - Add --quiet flag to object put ([ipfs/go-ipfs#4411](https://github.com/ipfs/go-ipfs/pull/4411)) - - Pinning memory improvements and fixes ([ipfs/go-ipfs#4451](https://github.com/ipfs/go-ipfs/pull/4451)) - - Update WebUI version ([ipfs/go-ipfs#4449](https://github.com/ipfs/go-ipfs/pull/4449)) - - Check strong and weak ETag validator ([ipfs/go-ipfs#3983](https://github.com/ipfs/go-ipfs/pull/3983)) - - Improve and refactor FD limit handling ([ipfs/go-ipfs#3801](https://github.com/ipfs/go-ipfs/pull/3801)) - - Support linking to non-dagpb objects in ipfs object patch ([ipfs/go-ipfs#4460](https://github.com/ipfs/go-ipfs/pull/4460)) - - Improve allocation patterns of slices in bitswap ([ipfs/go-ipfs#4458](https://github.com/ipfs/go-ipfs/pull/4458)) - - Secio handshake now happens synchronously ([libp2p/go-libp2p-secio#25](https://github.com/libp2p/go-libp2p-secio/pull/25)) - - Don't block closing connections on pending writes ([libp2p/go-msgio#7](https://github.com/libp2p/go-msgio/pull/7)) - - Improve memory usage of multiaddr parsing ([multiformats/go-multiaddr#56](https://github.com/multiformats/go-multiaddr/pull/56)) - - Don't lock up 256KiB buffers when adding small files ([ipfs/go-ipfs#4508](https://github.com/ipfs/go-ipfs/pull/4508)) - - Clear out memory after reads from the dagreader ([ipfs/go-ipfs#4525](https://github.com/ipfs/go-ipfs/pull/4525)) - - Improve error handling in ipfs ping ([ipfs/go-ipfs#4546](https://github.com/ipfs/go-ipfs/pull/4546)) - - Allow install.sh to be run without being the script dir ([ipfs/go-ipfs#4547](https://github.com/ipfs/go-ipfs/pull/4547)) - - Much faster base58 encoding ([libp2p/go-libp2p-peer#24](https://github.com/libp2p/go-libp2p-peer/pull/24)) - - Use faster sha256 and blake2b libs ([multiformats/go-multihash#63](https://github.com/multiformats/go-multihash/pull/63)) - - Greatly improve peerstore memory usage ([libp2p/go-libp2p-peerstore#22](https://github.com/libp2p/go-libp2p-peerstore/pull/22)) - - Improve dht memory usage and peer tracking ([libp2p/go-libp2p-kad-dht#111](https://github.com/libp2p/go-libp2p-kad-dht/pull/111)) - - New libp2p metrics lib with lower overhead ([libp2p/go-libp2p-metrics#8](https://github.com/libp2p/go-libp2p-metrics/pull/8)) - - Fix memory leak that occurred when dialing many peers ([libp2p/go-libp2p-swarm#51](https://github.com/libp2p/go-libp2p-swarm/pull/51)) - - Wire up new dag interfaces to make sessions easier ([ipfs/go-ipfs#4641](https://github.com/ipfs/go-ipfs/pull/4641)) -- Documentation - - Correct StorageMax config description ([ipfs/go-ipfs#4388](https://github.com/ipfs/go-ipfs/pull/4388)) - - Add how to download IPFS with IPFS doc ([ipfs/go-ipfs#4390](https://github.com/ipfs/go-ipfs/pull/4390)) - - Document gx release checklist item ([ipfs/go-ipfs#4480](https://github.com/ipfs/go-ipfs/pull/4480)) - - Add some documentation to CoreAPI ([ipfs/go-ipfs#4493](https://github.com/ipfs/go-ipfs/pull/4493)) - - Add interop tests to the release checklist ([ipfs/go-ipfs#4501](https://github.com/ipfs/go-ipfs/pull/4501)) - - Add badgerds to experimental-features ToC ([ipfs/go-ipfs#4537](https://github.com/ipfs/go-ipfs/pull/4537)) - - Fix typos and inconsistencies in commands documentation ([ipfs/go-ipfs#4552](https://github.com/ipfs/go-ipfs/pull/4552)) - - Add a document to help troubleshoot data transfers ([ipfs/go-ipfs#4332](https://github.com/ipfs/go-ipfs/pull/4332)) - - Add a bunch of documentation on public interfaces ([ipfs/go-ipfs#4599](https://github.com/ipfs/go-ipfs/pull/4599)) - - Expand the issue template and remove the severity field ([ipfs/go-ipfs#4624](https://github.com/ipfs/go-ipfs/pull/4624)) - - Add godocs for importers module ([ipfs/go-ipfs#4640](https://github.com/ipfs/go-ipfs/pull/4640)) - - Document make targets ([ipfs/go-ipfs#4653](https://github.com/ipfs/go-ipfs/pull/4653)) - - Add godocs for merkledag module ([ipfs/go-ipfs#4665](https://github.com/ipfs/go-ipfs/pull/4665)) - - Add godocs for unixfs module ([ipfs/go-ipfs#4664](https://github.com/ipfs/go-ipfs/pull/4664)) - - Add sharding to experimental features list ([ipfs/go-ipfs#4569](https://github.com/ipfs/go-ipfs/pull/4569)) - - Add godocs for routing module ([ipfs/go-ipfs#4676](https://github.com/ipfs/go-ipfs/pull/4676)) - - Add godocs for path module ([ipfs/go-ipfs#4689](https://github.com/ipfs/go-ipfs/pull/4689)) - - Add godocs for pin module ([ipfs/go-ipfs#4696](https://github.com/ipfs/go-ipfs/pull/4696)) - - Update link to filestore experimental status ([ipfs/go-ipfs#4557](https://github.com/ipfs/go-ipfs/pull/4557)) -- Bugfixes - - Remove trailing slash in ipfs get paths, fixes #3729 ([ipfs/go-ipfs#4365](https://github.com/ipfs/go-ipfs/pull/4365)) - - fix deadlock in bitswap sessions ([ipfs/go-ipfs#4407](https://github.com/ipfs/go-ipfs/pull/4407)) - - Fix two race conditions (and possibly go routine leaks) in commands ([ipfs/go-ipfs#4406](https://github.com/ipfs/go-ipfs/pull/4406)) - - Fix output delay in ipfs pubsub sub ([ipfs/go-ipfs#4402](https://github.com/ipfs/go-ipfs/pull/4402)) - - Use correct context in AddWithContext ([ipfs/go-ipfs#4433](https://github.com/ipfs/go-ipfs/pull/4433)) - - Fix various IPNS republisher issues ([ipfs/go-ipfs#4440](https://github.com/ipfs/go-ipfs/pull/4440)) - - Fix error handling in commands add and get ([ipfs/go-ipfs#4454](https://github.com/ipfs/go-ipfs/pull/4454)) - - Fix hamt (sharding) delete issue ([ipfs/go-ipfs#4398](https://github.com/ipfs/go-ipfs/pull/4398)) - - More correctly check for reuseport support ([libp2p/go-reuseport#40](https://github.com/libp2p/go-reuseport/pull/40)) - - Fix goroutine leak in websockets transport ([libp2p/go-ws-transport#21](https://github.com/libp2p/go-ws-transport/pull/21)) - - Update badgerds to fix i386 windows build ([ipfs/go-ipfs#4464](https://github.com/ipfs/go-ipfs/pull/4464)) - - Only construct bitswap event loggable if necessary ([ipfs/go-ipfs#4533](https://github.com/ipfs/go-ipfs/pull/4533)) - - Ensure that flush on the mfs root flushes its directory ([ipfs/go-ipfs#4509](https://github.com/ipfs/go-ipfs/pull/4509)) - - Fix deferred unlock of pin lock in AddR ([ipfs/go-ipfs#4562](https://github.com/ipfs/go-ipfs/pull/4562)) - - Fix iOS builds ([ipfs/go-ipfs#4610](https://github.com/ipfs/go-ipfs/pull/4610)) - - Calling repo gc now frees up space with badgerds ([ipfs/go-ipfs#4578](https://github.com/ipfs/go-ipfs/pull/4578)) - - Fix leak in bitswap sessions shutdown ([ipfs/go-ipfs#4658](https://github.com/ipfs/go-ipfs/pull/4658)) - - Fix make on windows ([ipfs/go-ipfs#4682](https://github.com/ipfs/go-ipfs/pull/4682)) - - Ignore invalid key files in keystore directory ([ipfs/go-ipfs#4700](https://github.com/ipfs/go-ipfs/pull/4700)) -- General Changes and Refactorings - - Extract and refactor commands library ([ipfs/go-ipfs#3856](https://github.com/ipfs/go-ipfs/pull/3856)) - - Remove all instances of `Default(false)` ([ipfs/go-ipfs#4042](https://github.com/ipfs/go-ipfs/pull/4042)) - - Build for all supported platforms when testing ([ipfs/go-ipfs#4445](https://github.com/ipfs/go-ipfs/pull/4445)) - - Refine gateway and namesys logging ([ipfs/go-ipfs#4428](https://github.com/ipfs/go-ipfs/pull/4428)) - - Demote bitswap error to an info ([ipfs/go-ipfs#4472](https://github.com/ipfs/go-ipfs/pull/4472)) - - Extract posinfo package to github.com/ipfs/go-ipfs-posinfo ([ipfs/go-ipfs#4669](https://github.com/ipfs/go-ipfs/pull/4669)) - - Move signature verification to ipns validator ([ipfs/go-ipfs#4628](https://github.com/ipfs/go-ipfs/pull/4628)) - - Extract importers/chunk module as go-ipfs-chunker ([ipfs/go-ipfs#4661](https://github.com/ipfs/go-ipfs/pull/4661)) - - Extract go-detect-race from Godeps ([ipfs/go-ipfs#4686](https://github.com/ipfs/go-ipfs/pull/4686)) - - Extract flags, delay, ds-help ([ipfs/go-ipfs#4685](https://github.com/ipfs/go-ipfs/pull/4685)) - - Extract routing package to go-ipfs-routing ([ipfs/go-ipfs#4703](https://github.com/ipfs/go-ipfs/pull/4703)) - - Extract blocks/blockstore package to go-ipfs-blockstore ([ipfs/go-ipfs#4707](https://github.com/ipfs/go-ipfs/pull/4707)) - - Add exchange.SessionExchange interface for exchanges that support sessions ([ipfs/go-ipfs#4709](https://github.com/ipfs/go-ipfs/pull/4709)) - - Extract thirdparty/pq to go-ipfs-pq ([ipfs/go-ipfs#4711](https://github.com/ipfs/go-ipfs/pull/4711)) - - Separate "path" from "path/resolver" ([ipfs/go-ipfs#4713](https://github.com/ipfs/go-ipfs/pull/4713)) -- Testing - - Increase verbosity of t0088-repo-stat-symlink.sh test ([ipfs/go-ipfs#4434](https://github.com/ipfs/go-ipfs/pull/4434)) - - Make repo size test pass deterministically ([ipfs/go-ipfs#4443](https://github.com/ipfs/go-ipfs/pull/4443)) - - Always set IPFS_PATH in test-lib.sh ([ipfs/go-ipfs#4469](https://github.com/ipfs/go-ipfs/pull/4469)) - - Fix sharness docker ([ipfs/go-ipfs#4489](https://github.com/ipfs/go-ipfs/pull/4489)) - - Fix loops in sharness tests to fail the test if the inner command fails ([ipfs/go-ipfs#4482](https://github.com/ipfs/go-ipfs/pull/4482)) - - Improve bitswap tests, fix race conditions ([ipfs/go-ipfs#4499](https://github.com/ipfs/go-ipfs/pull/4499)) - - Fix circleci cache directory list ([ipfs/go-ipfs#4564](https://github.com/ipfs/go-ipfs/pull/4564)) - - Only run the build test on test_go_expensive ([ipfs/go-ipfs#4645](https://github.com/ipfs/go-ipfs/pull/4645)) - - Fix go test on Windows ([ipfs/go-ipfs#4632](https://github.com/ipfs/go-ipfs/pull/4632)) - - Fix some tests on FreeBSD ([ipfs/go-ipfs#4662](https://github.com/ipfs/go-ipfs/pull/4662)) - -## 0.4.13 2017-11-16 - -Ipfs 0.4.13 is a patch release that fixes two high priority issues that were -discovered in the 0.4.12 release. - -Bugfixes: - - Fix periodic bitswap deadlock ([ipfs/go-ipfs#4386](https://github.com/ipfs/go-ipfs/pull/4386)) - - Fix badgerds crash on startup ([ipfs/go-ipfs#4384](https://github.com/ipfs/go-ipfs/pull/4384)) - - -## 0.4.12 2017-11-09 - -Ipfs 0.4.12 brings with it many important fixes for the huge spike in network -size we've seen this past month. These changes include the Connection Manager, -faster batching in `ipfs add`, libp2p fixes that reduce CPU usage, and a bunch -of new documentation. - -The most critical change is the 'Connection Manager': it allows an ipfs node to -maintain a limited set of connections to other peers in the network. By default -(and with no config changes required by the user), ipfs nodes will now try to -maintain between 600 and 900 open connections. These limits are still likely -higher than needed, and future releases may lower the default recommendation, -but for now we want to make changes gradually. The rationale for this selection -of numbers is as follows: - -- The DHT routing table for a large network may rise to around 400 peers -- Bitswap connections tend to be separate from the DHT -- PubSub connections also generally are another distinct set of peers - (including js-ipfs nodes) - -Because of this, we selected 600 as a 'LowWater' number, and 900 as a -'HighWater' number to avoid having to clear out connections too frequently. -You can configure different numbers as you see fit via the `Swarm.ConnMgr` -field in your ipfs config file. See -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#connmgr) for -more details. - -Disk utilization during `ipfs add` has been optimized for large files by doing -batch writes in parallel. Previously, when adding a large file, users might have -noticed that the add progressed by about 8MB at a time, with brief pauses in between. -This was caused by quickly filling up the batch, then blocking while it was -writing to disk. We now write to disk in the background while continuing to add -the remainder of the file. - -Other changes in this release have noticeably reduced memory consumption and CPU -usage. This was done by optimising some frequently called functions in libp2p -that were expensive in terms of both CPU usage and memory allocations. We also -lowered the yamux accept buffer sizes which were raised over a year ago to -combat a separate bug that has since been fixed. - -And finally, thank you to everyone who filed bugs, tested out the release candidates, -filed pull requests, and contributed in any other way to this release! - -- Features - - Implement Connection Manager ([ipfs/go-ipfs#4288](https://github.com/ipfs/go-ipfs/pull/4288)) - - Support multiple files in dag put ([ipfs/go-ipfs#4254](https://github.com/ipfs/go-ipfs/pull/4254)) - - Add 'raw' support to the dag put command ([ipfs/go-ipfs#4285](https://github.com/ipfs/go-ipfs/pull/4285)) -- Improvements - - Parallelize dag batch flushing ([ipfs/go-ipfs#4296](https://github.com/ipfs/go-ipfs/pull/4296)) - - Update go-peerstream to improve CPU usage ([ipfs/go-ipfs#4323](https://github.com/ipfs/go-ipfs/pull/4323)) - - Add full support for CidV1 in Files API and Dag Modifier ([ipfs/go-ipfs#4026](https://github.com/ipfs/go-ipfs/pull/4026)) - - Lower yamux accept buffer size ([ipfs/go-ipfs#4326](https://github.com/ipfs/go-ipfs/pull/4326)) - - Optimise `ipfs pin update` command ([ipfs/go-ipfs#4348](https://github.com/ipfs/go-ipfs/pull/4348)) -- Documentation - - Add some docs on plugins ([ipfs/go-ipfs#4255](https://github.com/ipfs/go-ipfs/pull/4255)) - - Add more info about private network bootstrap ([ipfs/go-ipfs#4270](https://github.com/ipfs/go-ipfs/pull/4270)) - - Add more info about `ipfs add` chunker option ([ipfs/go-ipfs#4306](https://github.com/ipfs/go-ipfs/pull/4306)) - - Remove cruft in readme and mention discourse forum ([ipfs/go-ipfs#4345](https://github.com/ipfs/go-ipfs/pull/4345)) - - Add note about updating before reporting issues ([ipfs/go-ipfs#4361](https://github.com/ipfs/go-ipfs/pull/4361)) -- Bugfixes - - Fix FreeBSD build issues ([ipfs/go-ipfs#4275](https://github.com/ipfs/go-ipfs/pull/4275)) - - Don't crash when Datastore.StorageMax is not defined ([ipfs/go-ipfs#4246](https://github.com/ipfs/go-ipfs/pull/4246)) - - Do not call 'Connect' on NewStream in bitswap ([ipfs/go-ipfs#4317](https://github.com/ipfs/go-ipfs/pull/4317)) - - Filter out "" from active peers in bitswap sessions ([ipfs/go-ipfs#4316](https://github.com/ipfs/go-ipfs/pull/4316)) - - Fix "seeker can't seek" on specific files ([ipfs/go-ipfs#4320](https://github.com/ipfs/go-ipfs/pull/4320)) - - Do not set "gecos" field in Dockerfile ([ipfs/go-ipfs#4331](https://github.com/ipfs/go-ipfs/pull/4331)) - - Handle sym links in when calculating repo size ([ipfs/go-ipfs#4305](https://github.com/ipfs/go-ipfs/pull/4305)) -- General Changes and Refactorings - - Fix indent in sharness tests ([ipfs/go-ipfs#4212](https://github.com/ipfs/go-ipfs/pull/4212)) - - Remove supernode routing ([ipfs/go-ipfs#4302](https://github.com/ipfs/go-ipfs/pull/4302)) - - Extract go-ipfs-addr ([ipfs/go-ipfs#4340](https://github.com/ipfs/go-ipfs/pull/4340)) - - Remove dead code and config files ([ipfs/go-ipfs#4357](https://github.com/ipfs/go-ipfs/pull/4357)) - - Update badgerds to 1.0 ([ipfs/go-ipfs#4327](https://github.com/ipfs/go-ipfs/pull/4327)) - - Wrap help descriptions under 80 chars ([ipfs/go-ipfs#4121](https://github.com/ipfs/go-ipfs/pull/4121)) -- Testing - - Make sharness t0180-p2p less racy ([ipfs/go-ipfs#4310](https://github.com/ipfs/go-ipfs/pull/4310)) - - -### 0.4.11 2017-09-14 - -Ipfs 0.4.11 is a larger release that brings many long-awaited features and -performance improvements. These include new datastore options, more efficient -bitswap transfers, greatly improved resource consumption, circuit relay -support, ipld plugins, and more! Take a look at the full changelog below for a -detailed list of every change. - -The ipfs datastore has, until now, been a combination of leveldb and a custom -git-like storage backend called 'flatfs'. This works well enough for the -average user, but different ipfs usecases demand different backend -configurations. To address this, we have changed the configuration file format -for datastores to be a modular way of specifying exactly how you want the -datastore to be structured. You will now be able to configure ipfs to use -flatfs, leveldb, badger, an in-memory datastore, and more to suit your needs. -See the new [datastore -documentation](https://github.com/ipfs/go-ipfs/blob/master/docs/datastores.md) -for more information. - -Bitswap received some much needed attention during this release cycle. The -concept of 'Bitswap Sessions' allows bitswap to associate requests for -different blocks to the same underlying session, and from that infer better -ways of requesting that data. In more concrete terms, parts of the ipfs -codebase that take advantage of sessions (currently, only `ipfs pin add`) will -cause much less extra traffic than before. This is done by making optimistic -guesses about which nodes might be providing given blocks and not sending -wantlist updates to every connected bitswap partner, as well as searching the -DHT for providers less frequently. In future releases we will migrate over more -ipfs commands to take advantage of bitswap sessions. As nodes update to this -and future versions, expect to see idle bandwidth usage on the ipfs network -go down noticeably. - -The never ending effort to reduce resource consumption had a few important -updates this release. First, the bitswap sessions changes discussed above will -help with improving bandwidth usage. Aside from that there are two important -libp2p updates that improved things significantly. The first was a fix to a bug -in the dial limiter code that was causing it to not limit outgoing dials -correctly. This resulted in ipfs running out of file descriptors very -frequently (as well as incurring a decent amount of excess outgoing bandwidth), -this has now been fixed. Users who previously received "too many open files" -errors should see this much less often in 0.4.11. The second change was a -memory leak in the DHT that was identified and fixed. Streams being tracked in -a map in the DHT weren't being cleaned up after the peer disconnected leading -to the multiplexer session not being cleaned up properly. This issue has been -resolved, and now memory usage appears to be stable over time. There is still a -lot of work to be done improving memory usage, but we feel this is a solid -victory. - -It is often said that NAT traversal is the hardest problem in peer to peer -technology, we tend to agree with this. In an effort to provide a more -ubiquitous p2p mesh, we have implemented a relay mechanism that allows willing -peers to relay traffic for other peers who might not otherwise be able to -communicate with each other. This feature is still pretty early, and currently -users have to manually connect through a relay. The next step in this endeavour -is automatic relaying, and research for this is currently in progress. We -expect that when it lands, it will improve the perceived performance of ipfs by -spending less time attempting connections to hard to reach nodes. A short guide -on using the circuit relay feature can be found -[here](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#circuit-relay). - -The last feature we want to highlight (but by no means the last feature in this -release) is our new plugin system. There are many different workflows and -usecases that ipfs should be able to support, but not everyone wants to be able -to use every feature. We could simply merge in all these features, but that -causes problems for several reasons: first off, the size of the ipfs binary -starts to get very large very quickly. Second, each of these different pieces -needs to be maintained and updated independently, which would cause significant -churn in the codebase. To address this, we have come up with a system that -allows users to install plugins to the vanilla ipfs daemon that augment its -capabilities. The first of these plugins are a [git -plugin](https://github.com/ipfs/go-ipfs/blob/master/plugin/plugins/git/git.go) -that allows ipfs to natively address git objects and an [ethereum -plugin](https://github.com/ipfs/go-ipld-eth) that lets ipfs ingest and operate -on all ethereum blockchain data. Soon to come are plugins for the bitcoin and -zcash data formats. In the future, we will be adding plugins for other things -like datastore backends and specialized libp2p network transports. -You can read more on this topic in [Plugin docs](docs/plugins.md) - -In order to simplify its integration with fs-repo-migrations, we've switched -the ipfs/go-ipfs docker image from a musl base to a glibc base. For most users -this will not be noticeable, but if you've been building your own images based -off this image, you'll have to update your dockerfile. We recommend a -multi-stage dockerfile, where the build stage is based off of a regular Debian or -other glibc-based image, and the assembly stage is based off of the ipfs/go-ipfs -image, and you copy build artifacts from the build stage to the assembly -stage. Note, if you are using the docker image and see a deprecation message, -please update your usage. We will stop supporting the old method of starting -the dockerfile in the next release. - -Finally, I would like to thank all of our contributors, users, supporters, and -friends for helping us along the way. Ipfs would not be where it is without -you. - - -- Features - - Add `--pin` option to `ipfs dag put` ([ipfs/go-ipfs#4004](https://github.com/ipfs/go-ipfs/pull/4004)) - - Add `--pin` option to `ipfs object put` ([ipfs/go-ipfs#4095](https://github.com/ipfs/go-ipfs/pull/4095)) - - Implement `--profile` option on `ipfs init` ([ipfs/go-ipfs#4001](https://github.com/ipfs/go-ipfs/pull/4001)) - - Add CID Codecs to `ipfs block put` ([ipfs/go-ipfs#4022](https://github.com/ipfs/go-ipfs/pull/4022)) - - Bitswap sessions ([ipfs/go-ipfs#3867](https://github.com/ipfs/go-ipfs/pull/3867)) - - Create plugin API and loader, add ipld-git plugin ([ipfs/go-ipfs#4033](https://github.com/ipfs/go-ipfs/pull/4033)) - - Make announced swarm addresses configurable ([ipfs/go-ipfs#3948](https://github.com/ipfs/go-ipfs/pull/3948)) - - Reprovider strategies ([ipfs/go-ipfs#4113](https://github.com/ipfs/go-ipfs/pull/4113)) - - Circuit Relay integration ([ipfs/go-ipfs#4091](https://github.com/ipfs/go-ipfs/pull/4091)) - - More configurable datastore configs ([ipfs/go-ipfs#3575](https://github.com/ipfs/go-ipfs/pull/3575)) - - Add experimental support for badger datastore ([ipfs/go-ipfs#4007](https://github.com/ipfs/go-ipfs/pull/4007)) -- Improvements - - Add better support for Raw Nodes in MFS and elsewhere ([ipfs/go-ipfs#3996](https://github.com/ipfs/go-ipfs/pull/3996)) - - Added file size to response of `ipfs add` command ([ipfs/go-ipfs#4082](https://github.com/ipfs/go-ipfs/pull/4082)) - - Add /dnsaddr bootstrap nodes ([ipfs/go-ipfs#4127](https://github.com/ipfs/go-ipfs/pull/4127)) - - Do not publish public keys extractable from ID ([ipfs/go-ipfs#4020](https://github.com/ipfs/go-ipfs/pull/4020)) -- Documentation - - Adding documentation that PubSub Sub can be encoded. ([ipfs/go-ipfs#3909](https://github.com/ipfs/go-ipfs/pull/3909)) - - Add Comms items from js-ipfs, including blog ([ipfs/go-ipfs#3936](https://github.com/ipfs/go-ipfs/pull/3936)) - - Add Developer Certificate of Origin ([ipfs/go-ipfs#4006](https://github.com/ipfs/go-ipfs/pull/4006)) - - Add `transports.md` document ([ipfs/go-ipfs#4034](https://github.com/ipfs/go-ipfs/pull/4034)) - - Add `experimental-features.md` document ([ipfs/go-ipfs#4036](https://github.com/ipfs/go-ipfs/pull/4036)) - - Update release docs ([ipfs/go-ipfs#4165](https://github.com/ipfs/go-ipfs/pull/4165)) - - Add documentation for datastore configs ([ipfs/go-ipfs#4223](https://github.com/ipfs/go-ipfs/pull/4223)) - - General update and clean-up of docs ([ipfs/go-ipfs#4222](https://github.com/ipfs/go-ipfs/pull/4222)) -- Bugfixes - - Fix shutdown check in t0023 ([ipfs/go-ipfs#3969](https://github.com/ipfs/go-ipfs/pull/3969)) - - Fix pinning of unixfs sharded directories ([ipfs/go-ipfs#3975](https://github.com/ipfs/go-ipfs/pull/3975)) - - Show escaped url in gateway 404 message ([ipfs/go-ipfs#4005](https://github.com/ipfs/go-ipfs/pull/4005)) - - Fix early opening of bitswap message sender ([ipfs/go-ipfs#4069](https://github.com/ipfs/go-ipfs/pull/4069)) - - Fix determination of 'root' node in dag put ([ipfs/go-ipfs#4072](https://github.com/ipfs/go-ipfs/pull/4072)) - - Fix bad multipart message panic in gateway ([ipfs/go-ipfs#4053](https://github.com/ipfs/go-ipfs/pull/4053)) - - Add blocks to the blockstore before returning them from blockservice sessions ([ipfs/go-ipfs#4169](https://github.com/ipfs/go-ipfs/pull/4169)) - - Various fixes for /ipfs fuse code ([ipfs/go-ipfs#4194](https://github.com/ipfs/go-ipfs/pull/4194)) - - Fix memory leak in dht stream tracking ([ipfs/go-ipfs#4251](https://github.com/ipfs/go-ipfs/pull/4251)) -- General Changes and Refactorings - - Require go 1.8 ([ipfs/go-ipfs#4044](https://github.com/ipfs/go-ipfs/pull/4044)) - - Change IPFS to use the new pluggable Block to IPLD decoding framework. ([ipfs/go-ipfs#4060](https://github.com/ipfs/go-ipfs/pull/4060)) - - Remove tour command from ipfs ([ipfs/go-ipfs#4123](https://github.com/ipfs/go-ipfs/pull/4123)) - - Add support for Go 1.9 ([ipfs/go-ipfs#4156](https://github.com/ipfs/go-ipfs/pull/4156)) - - Remove some dead code ([ipfs/go-ipfs#4204](https://github.com/ipfs/go-ipfs/pull/4204)) - - Switch docker image from musl to glibc ([ipfs/go-ipfs#4219](https://github.com/ipfs/go-ipfs/pull/4219)) - -### 0.4.10 - 2017-06-27 - -Ipfs 0.4.10 is a patch release that contains several exciting new features, -bugfixes and general improvements. Including new commands, easier corruption -recovery, and a generally cleaner codebase. - -The `ipfs pin` command has two new subcommands, `verify` and `update`. `ipfs -pin verify` is used to scan the repo for pinned object graphs and check their -integrity. Any issues are reported back with helpful error text to make error -recovery simpler. This subcommand was added to help recover from datastore -corruptions, particularly if using the experimental filestore and accidentally -deleting tracked files. -`ipfs pin update` was added to make the task of keeping a large, frequently -changing object graph pinned. Previously users had to call `ipfs pin rm` on the -old pin, and `ipfs pin add` on the new one. The 'new' `ipfs pin add` call would -be very expensive as it would need to verify the entirety of the graph again. -The `ipfs pin update` command takes shortcuts, portions of the graph that were -covered under the old pin are assumed to be fine, and the command skips -checking them. - -Next up, we have finally implemented an `ipfs shutdown` command so users can -shut down their ipfs daemons via the API. This is especially useful on -platforms that make it difficult to control processes (Android, for example), -and is also useful when needing to shut down a node remotely and you do not -have access to the machine itself. - -`ipfs add` has gained a new flag; the `--hash` flag allows you to select which -hash function to use and we have given it the ability to select `blake2b-256`. -This pushes us one step closer to shifting over to using blake2b as the -default. Blake2b is significantly faster than sha2-256, and also is conjectured -to provide superior security. - -We have also finally implemented a very early (and experimental) `ipfs p2p`. -This command and its subcommands will allow you to open up arbitrary streams to -other ipfs peers through libp2p. The interfaces are a little bit clunky right -now, but shouldn't get in the way of anyone wanting to try building a fully -peer to peer application on top of ipfs and libp2p. For more info on this -command, to ask questions, or to provide feedback, head over to the [feedback -issue](https://github.com/ipfs/go-ipfs/issues/3994) for the command. - -A few other subcommands and flags were added around the API, as well as many -other requested improvements. See below for the full list of changes. - - -- Features - - Add support for specifying the hash function in `ipfs add` ([ipfs/go-ipfs#3919](https://github.com/ipfs/go-ipfs/pull/3919)) - - Implement `ipfs key {rm, rename}` ([ipfs/go-ipfs#3892](https://github.com/ipfs/go-ipfs/pull/3892)) - - Implement `ipfs shutdown` command ([ipfs/go-ipfs#3884](https://github.com/ipfs/go-ipfs/pull/3884)) - - Implement `ipfs pin update` ([ipfs/go-ipfs#3846](https://github.com/ipfs/go-ipfs/pull/3846)) - - Implement `ipfs pin verify` ([ipfs/go-ipfs#3843](https://github.com/ipfs/go-ipfs/pull/3843)) - - Implemented experimental p2p commands ([ipfs/go-ipfs#3943](https://github.com/ipfs/go-ipfs/pull/3943)) -- Improvements - - Add MaxStorage field to output of "repo stat" ([ipfs/go-ipfs#3915](https://github.com/ipfs/go-ipfs/pull/3915)) - - Add Suborigin header to gateway responses ([ipfs/go-ipfs#3914](https://github.com/ipfs/go-ipfs/pull/3914)) - - Add "--file-order" option to "filestore ls" and "verify" ([ipfs/go-ipfs#3938](https://github.com/ipfs/go-ipfs/pull/3938)) - - Allow selecting ipns keys by Peer ID ([ipfs/go-ipfs#3882](https://github.com/ipfs/go-ipfs/pull/3882)) - - Don't redirect to trailing slash in gateway for `go get` ([ipfs/go-ipfs#3963](https://github.com/ipfs/go-ipfs/pull/3963)) - - Add 'ipfs dht findprovs --num-providers' to allow choosing number of providers to find ([ipfs/go-ipfs#3966](https://github.com/ipfs/go-ipfs/pull/3966)) - - Make sure all keystore keys get republished ([ipfs/go-ipfs#3951](https://github.com/ipfs/go-ipfs/pull/3951)) -- Documentation - - Adding documentation on PubSub encodings ([ipfs/go-ipfs#3909](https://github.com/ipfs/go-ipfs/pull/3909)) - - Change 'neccessary' to 'necessary' ([ipfs/go-ipfs#3941](https://github.com/ipfs/go-ipfs/pull/3941)) - - README.md: add Nix to the linux package managers ([ipfs/go-ipfs#3939](https://github.com/ipfs/go-ipfs/pull/3939)) - - More verbose errors in filestore ([ipfs/go-ipfs#3964](https://github.com/ipfs/go-ipfs/pull/3964)) -- Bugfixes - - Fix typo in message when file size check fails ([ipfs/go-ipfs#3895](https://github.com/ipfs/go-ipfs/pull/3895)) - - Clean up bitswap ledgers when disconnecting ([ipfs/go-ipfs#3437](https://github.com/ipfs/go-ipfs/pull/3437)) - - Make odds of 'process added after close' panic less likely ([ipfs/go-ipfs#3940](https://github.com/ipfs/go-ipfs/pull/3940)) -- General Changes and Refactorings - - Remove 'ipfs diag net' from codebase ([ipfs/go-ipfs#3916](https://github.com/ipfs/go-ipfs/pull/3916)) - - Update to dht code with provide announce option ([ipfs/go-ipfs#3928](https://github.com/ipfs/go-ipfs/pull/3928)) - - Apply the megacheck code vetting tool ([ipfs/go-ipfs#3949](https://github.com/ipfs/go-ipfs/pull/3949)) - - Expose port 8081 in docker container for /ws listener ([ipfs/go-ipfs#3954](https://github.com/ipfs/go-ipfs/pull/3954)) - -### 0.4.9 - 2017-04-30 - -Ipfs 0.4.9 is a maintenance release that contains several useful bugfixes and -improvements. Notably, `ipfs add` has gained the ability to select which CID -version will be output. The common ipfs hash that looks like this: -`QmRjNgF2mRLDT8AzCPsQbw1EYF2hDTFgfUmJokJPhCApYP` is a multihash. Multihashes -allow us to specify the hashing algorithm that was used to verify the data, but -it doesn't give us any indication of what format that data might be. To address -that issue, we are adding another couple of bytes to the prefix that will allow us -to indicate the format of the data referenced by the hash. This new format is -called a Content ID, or CID for short. The previous bare multihashes will still -be fully supported throughout the entire application as CID version 0. The new -format with the type information will be CID version 1. To give an example, -the content referenced by the hash above is "Hello Ipfs!". That same content, -in the same format (dag-protobuf) using CIDv1 is -`zb2rhkgXZVkT2xvDiuUsJENPSbWJy7fdYnsboLBzzEjjZMRoG`. - -CIDv1 hashes are supported in ipfs versions back to 0.4.5. Nodes running 0.4.4 -and older will not be able to load content via CIDv1 and we recommend that they -update to a newer version. - -There are many other use cases for CIDs. Plugins can be written to -allow ipfs to natively address content from any other merkletree based system, -such as git, bitcoin, zcash and ethereum -- a few systems we've already started work on. - -Aside from the CID flag, there were many other changes as noted below: - -- Features - - Add support for using CidV1 in 'ipfs add' ([ipfs/go-ipfs#3743](https://github.com/ipfs/go-ipfs/pull/3743)) -- Improvements - - Use CID as an ETag strong validator ([ipfs/go-ipfs#3869](https://github.com/ipfs/go-ipfs/pull/3869)) - - Update go-multihash with keccak and bitcoin hashes ([ipfs/go-ipfs#3833](https://github.com/ipfs/go-ipfs/pull/3833)) - - Update go-is-domain to contain new gTLD ([ipfs/go-ipfs#3873](https://github.com/ipfs/go-ipfs/pull/3873)) - - Periodically flush cached directories during ipfs add ([ipfs/go-ipfs#3888](https://github.com/ipfs/go-ipfs/pull/3888)) - - improved gateway directory listing for sharded nodes ([ipfs/go-ipfs#3897](https://github.com/ipfs/go-ipfs/pull/3897)) -- Documentation - - Change issue template to use Severity instead of Priority ([ipfs/go-ipfs#3834](https://github.com/ipfs/go-ipfs/pull/3834)) - - Fix link to commit hook script in contribute.md ([ipfs/go-ipfs#3863](https://github.com/ipfs/go-ipfs/pull/3863)) - - Fix install_unsupported for openbsd, add docs ([ipfs/go-ipfs#3880](https://github.com/ipfs/go-ipfs/pull/3880)) -- Bugfixes - - Fix wanlist typo in prometheus metric name ([ipfs/go-ipfs#3841](https://github.com/ipfs/go-ipfs/pull/3841)) - - Fix `make install` not using ldflags for git hash ([ipfs/go-ipfs#3838](https://github.com/ipfs/go-ipfs/pull/3838)) - - Fix `make install` not installing dependencies ([ipfs/go-ipfs#3848](https://github.com/ipfs/go-ipfs/pull/3848)) - - Fix erroneous Cache-Control: immutable on dir listings ([ipfs/go-ipfs#3870](https://github.com/ipfs/go-ipfs/pull/3870)) - - Fix bitswap accounting of 'BytesSent' in ledger ([ipfs/go-ipfs#3876](https://github.com/ipfs/go-ipfs/pull/3876)) - - Fix gateway handling of sharded directories ([ipfs/go-ipfs#3889](https://github.com/ipfs/go-ipfs/pull/3889)) - - Fix sharding memory growth, and fix resolver for unixfs paths ([ipfs/go-ipfs#3890](https://github.com/ipfs/go-ipfs/pull/3890)) -- General Changes and Refactorings - - Use ctx var consistently in daemon.go ([ipfs/go-ipfs#3864](https://github.com/ipfs/go-ipfs/pull/3864)) - - Handle 404 correctly in dist_get tool ([ipfs/go-ipfs#3879](https://github.com/ipfs/go-ipfs/pull/3879)) -- Testing - - Fix go fuse tests ([ipfs/go-ipfs#3840](https://github.com/ipfs/go-ipfs/pull/3840)) - -### 0.4.8 - 2017-03-29 - -Ipfs 0.4.8 brings with it several improvements, bugfixes, documentation -improvements, and the long awaited directory sharding code. - -Currently, when too many items are added into a unixfs directory, the object -gets too large and you may experience issues. To pervent this problem, and -generally make working really large directories more efficient, we have -implemented a HAMT structure for unixfs. To enable this feature, run: -``` -ipfs config --json Experimental.ShardingEnabled true -``` - -And restart your daemon if it was running. - -Note: With this setting enabled, the hashes of any newly added directories will -be different than they previously were, as the new code will use the sharded -HAMT structure for all directories. Also, nodes running ipfs 0.4.7 and earlier -will not be able to access directories created with this option. - -That said, please do give it a try, let us know how it goes, and then take a -look at all the other cool things added in 0.4.8 below. - -- Features - - Implement unixfs directory sharding ([ipfs/go-ipfs#3042](https://github.com/ipfs/go-ipfs/pull/3042)) - - Add DisableNatPortMap option ([ipfs/go-ipfs#3798](https://github.com/ipfs/go-ipfs/pull/3798)) - - Basic Filestore utilty commands ([ipfs/go-ipfs#3653](https://github.com/ipfs/go-ipfs/pull/3653)) -- Improvements - - More Robust GC ([ipfs/go-ipfs#3712](https://github.com/ipfs/go-ipfs/pull/3712)) - - Automatically fix permissions for docker volumes ([ipfs/go-ipfs#3744](https://github.com/ipfs/go-ipfs/pull/3744)) - - Core API refinements and efficiency improvements ([ipfs/go-ipfs#3493](https://github.com/ipfs/go-ipfs/pull/3493)) - - Improve IsPinned() lookups for indirect pins ([ipfs/go-ipfs#3809](https://github.com/ipfs/go-ipfs/pull/3809)) -- Documentation - - Improve 'name' and 'key' helptexts ([ipfs/go-ipfs#3806](https://github.com/ipfs/go-ipfs/pull/3806)) - - Update link to paper in dev.md ([ipfs/go-ipfs#3812](https://github.com/ipfs/go-ipfs/pull/3812)) - - Add test to enforce helptext on commands ([ipfs/go-ipfs#2648](https://github.com/ipfs/go-ipfs/pull/2648)) -- Bugfixes - - Remove bloom filter check on Put call in blockstore ([ipfs/go-ipfs#3782](https://github.com/ipfs/go-ipfs/pull/3782)) - - Re-add the GOPATH checking functionality ([ipfs/go-ipfs#3787](https://github.com/ipfs/go-ipfs/pull/3787)) - - Use fsrepo.IsInitialized to test for initialization ([ipfs/go-ipfs#3805](https://github.com/ipfs/go-ipfs/pull/3805)) - - Return 404 Not Found for failed path resolutions ([ipfs/go-ipfs#3777](https://github.com/ipfs/go-ipfs/pull/3777)) - - Fix 'dist\_get' failing without failing ([ipfs/go-ipfs#3818](https://github.com/ipfs/go-ipfs/pull/3818)) - - Update iptb with fix for t0130 hanging issue ([ipfs/go-ipfs#3823](https://github.com/ipfs/go-ipfs/pull/3823)) - - fix hidden file detection on windows ([ipfs/go-ipfs#3829](https://github.com/ipfs/go-ipfs/pull/3829)) -- General Changes and Refactorings - - Fix multiple govet warnings ([ipfs/go-ipfs#3824](https://github.com/ipfs/go-ipfs/pull/3824)) - - Make Golint happy in the blocks submodule ([ipfs/go-ipfs#3827](https://github.com/ipfs/go-ipfs/pull/3827)) -- Testing - - Enable codeclimate for automated linting and vetting ([ipfs/go-ipfs#3821](https://github.com/ipfs/go-ipfs/pull/3821)) - - Fix EOF test failure with Multipart.Read ([ipfs/go-ipfs#3804](https://github.com/ipfs/go-ipfs/pull/3804)) - -### 0.4.7 - 2017-03-15 - -Ipfs 0.4.7 contains several exciting new features! -First off, The long awaited filestore feature has been merged, allowing users -the option to not have ipfs store chunked copies of added files in the -blockstore, pushing to burden of ensuring those files are not changed to the -user. The filestore feature is currently still experimental, and must be -enabled in your config with: -``` -ipfs config --json Experimental.FilestoreEnabled true -``` -before it can be used. Please see [this issue](https://github.com/ipfs/go-ipfs/issues/3397#issuecomment-284337564) for more details. - -Next up, We have merged initial support for ipfs 'Private Networks'. This -feature allows users to run ipfs in a mode that will only connect to other -peers in the private network. This feature, like the filestore is being -released experimentally, but if you're interested please try it out. -Instructions for setting it up can be found -[here](https://github.com/ipfs/go-ipfs/issues/3397#issuecomment-284341649). - -This release also enables support for the 'mplex' stream muxer by default. This -stream multiplexing protocol was available previously via the -`--enable-mplex-experiment` daemon flag, but has now graduated to being 'less -experimental' and no longer requires the flag to use it. - -Aside from those, we have a good number of bugfixes, perf improvements and new -tests. Heres a list of highlights: - -- Features - - Implement basic filestore 'no-copy' functionality ([ipfs/go-ipfs#3629](https://github.com/ipfs/go-ipfs/pull/3629)) - - Add support for private ipfs networks ([ipfs/go-ipfs#3697](https://github.com/ipfs/go-ipfs/pull/3697)) - - Enable 'mplex' stream muxer by default ([ipfs/go-ipfs#3725](https://github.com/ipfs/go-ipfs/pull/3725)) - - Add `--quieter` option to `ipfs add` ([ipfs/go-ipfs#3770](https://github.com/ipfs/go-ipfs/pull/3770)) - - Report progress during `pin add` via `--progress` ([ipfs/go-ipfs#3671](https://github.com/ipfs/go-ipfs/pull/3671)) -- Improvements - - Allow `ipfs get` to handle content added with raw leaves option ([ipfs/go-ipfs#3757](https://github.com/ipfs/go-ipfs/pull/3757)) - - Fix accuracy of progress bar on `ipfs get` ([ipfs/go-ipfs#3758](https://github.com/ipfs/go-ipfs/pull/3758)) - - Limit number of objects in batches to prevent too many fds issue ([ipfs/go-ipfs#3756](https://github.com/ipfs/go-ipfs/pull/3756)) - - Add more info to bitswap stat ([ipfs/go-ipfs#3635](https://github.com/ipfs/go-ipfs/pull/3635)) - - Add multiple performance metrics ([ipfs/go-ipfs#3615](https://github.com/ipfs/go-ipfs/pull/3615)) - - Make `dist_get` fall back to other downloaders if one fails ([ipfs/go-ipfs#3692](https://github.com/ipfs/go-ipfs/pull/3692)) -- Documentation - - Add Arch Linux install instructions to readme ([ipfs/go-ipfs#3742](https://github.com/ipfs/go-ipfs/pull/3742)) - - Improve release checklist document ([ipfs/go-ipfs#3717](https://github.com/ipfs/go-ipfs/pull/3717)) -- Bugfixes - - Fix drive root parsing on windows ([ipfs/go-ipfs#3328](https://github.com/ipfs/go-ipfs/pull/3328)) - - Fix panic in ipfs get when passing no parameters to API ([ipfs/go-ipfs#3768](https://github.com/ipfs/go-ipfs/pull/3768)) - - Fix breakage of `ipfs pin add` api output ([ipfs/go-ipfs#3760](https://github.com/ipfs/go-ipfs/pull/3760)) - - Fix issue in DHT queries that was causing poor record replication ([ipfs/go-ipfs#3748](https://github.com/ipfs/go-ipfs/pull/3748)) - - Fix `ipfs mount` crashing if no name was published before ([ipfs/go-ipfs#3728](https://github.com/ipfs/go-ipfs/pull/3728)) - - Add `self` key to the `ipfs key list` listing ([ipfs/go-ipfs#3734](https://github.com/ipfs/go-ipfs/pull/3734)) - - Fix panic when shutting down `ipfs daemon` pre gateway setup ([ipfs/go-ipfs#3723](https://github.com/ipfs/go-ipfs/pull/3723)) -- General Changes and Refactorings - - Refactor `EnumerateChildren` to avoid need for bestEffort parameter ([ipfs/go-ipfs#3700](https://github.com/ipfs/go-ipfs/pull/3700)) - - Update fuse dependency, fixing several issues ([ipfs/go-ipfs#3727](https://github.com/ipfs/go-ipfs/pull/3727)) - - Add `install_unsupported` makefile target for 'exotic' systems ([ipfs/go-ipfs#3719](https://github.com/ipfs/go-ipfs/pull/3719)) - - Deprecate implicit daemon argument in Dockerfile ([ipfs/go-ipfs#3685](https://github.com/ipfs/go-ipfs/pull/3685)) -- Testing - - Add test to ensure helptext is under 80 columns wide ([ipfs/go-ipfs#3774](https://github.com/ipfs/go-ipfs/pull/3774)) - - Add unit tests for auto migration code ([ipfs/go-ipfs#3618](https://github.com/ipfs/go-ipfs/pull/3618)) - - Fix iptb stop issue in sharness tests ([ipfs/go-ipfs#3714](https://github.com/ipfs/go-ipfs/pull/3714)) - - -### 0.4.6 - 2017-02-21 - -Ipfs 0.4.6 contains several bugfixes related to migrations and also contains a -few other improvements to other parts of the codebase. Notably: - -- The default config will now contain some ipv6 addresses for bootstrap nodes. -- `ipfs pin add` should be faster and consume less memory. -- Pinning thousands of files no longer causes superlinear usage of storage space. - -- Improvements - - Make pinset sharding deterministic ([ipfs/go-ipfs#3640](https://github.com/ipfs/go-ipfs/pull/3640)) - - Update to go-multihash with blake2 ([ipfs/go-ipfs#3649](https://github.com/ipfs/go-ipfs/pull/3649)) - - Pass cids instead of nodes around in EnumerateChildrenAsync ([ipfs/go-ipfs#3598](https://github.com/ipfs/go-ipfs/pull/3598)) - - Add /ip6 bootstrap nodes ([ipfs/go-ipfs#3523](https://github.com/ipfs/go-ipfs/pull/3523)) - - Add sub-object support to `dag get` command ([ipfs/go-ipfs#3687](https://github.com/ipfs/go-ipfs/pull/3687)) - - Add half-closed streams support to multiplex experiment ([ipfs/go-ipfs#3695](https://github.com/ipfs/go-ipfs/pull/3695)) -- Documentation - - Add the snap installation instructions ([ipfs/go-ipfs#3663](https://github.com/ipfs/go-ipfs/pull/3663)) - - Add closed PRs, Issues throughput ([ipfs/go-ipfs#3602](https://github.com/ipfs/go-ipfs/pull/3602)) -- Bugfixes - - Fix auto-migration on docker nodes ([ipfs/go-ipfs#3698](https://github.com/ipfs/go-ipfs/pull/3698)) - - Update flatfs to v1.1.2, fixing directory fd issue ([ipfs/go-ipfs#3711](https://github.com/ipfs/go-ipfs/pull/3711)) -- General Changes and Refactorings - - Remove `FindProviders` from routing mocks ([ipfs/go-ipfs#3617](https://github.com/ipfs/go-ipfs/pull/3617)) - - Use Marshalers instead of PostRun to process `block rm` output ([ipfs/go-ipfs#3708](https://github.com/ipfs/go-ipfs/pull/3708)) -- Testing - - Makefile rework and sharness test coverage ([ipfs/go-ipfs#3504](https://github.com/ipfs/go-ipfs/pull/3504)) - - Print out all daemon stderr files when iptb stop fails ([ipfs/go-ipfs#3701](https://github.com/ipfs/go-ipfs/pull/3701)) - - Add tests for recursively pinning a dag ([ipfs/go-ipfs#3691](https://github.com/ipfs/go-ipfs/pull/3691)) - - Fix lack of commit hash during build ([ipfs/go-ipfs#3705](https://github.com/ipfs/go-ipfs/pull/3705)) - -### 0.4.5 - 2017-02-11 - -#### Changes from rc3 to rc4 -- Update to fixed webui. ([ipfs/go-ipfs#3669](https://github.com/ipfs/go-ipfs/pull/3669)) - -#### Changes from rc2 to rc3 -- Fix handling of null arrays in cbor ipld objects. ([ipfs/go-ipfs#3666](https://github.com/ipfs/go-ipfs/pull/3666)) -- Add env var to enable yamux debug logging. ([ipfs/go-ipfs#3668](https://github.com/ipfs/go-ipfs/pull/3668)) -- Fix libc check during auto-migrations. ([ipfs/go-ipfs#3665](https://github.com/ipfs/go-ipfs/pull/3665)) - -#### Changes from rc1 to rc2 -- Fixed json output of ipld objects in `ipfs dag get` ([ipfs/go-ipfs#3655](https://github.com/ipfs/go-ipfs/pull/3655)) - -#### Changes since 0.4.4 - -- Notable changes - - IPLD and CIDs - - Rework go-ipfs to use Content IDs ([ipfs/go-ipfs#3187](https://github.com/ipfs/go-ipfs/pull/3187)) ([ipfs/go-ipfs#3290](https://github.com/ipfs/go-ipfs/pull/3290)) - - Turn merkledag.Node into an interface ([ipfs/go-ipfs#3301](https://github.com/ipfs/go-ipfs/pull/3301)) - - Implement cbor ipld nodes ([ipfs/go-ipfs#3325](https://github.com/ipfs/go-ipfs/pull/3325)) - - Allow cid format selection in block put command ([ipfs/go-ipfs#3324](https://github.com/ipfs/go-ipfs/pull/3324)) ([ipfs/go-ipfs#3483](https://github.com/ipfs/go-ipfs/pull/3483)) - - Bitswap protocol extension to handle cids ([ipfs/go-ipfs#3297](https://github.com/ipfs/go-ipfs/pull/3297)) - - Add dag get to read-only api ([ipfs/go-ipfs#3499](https://github.com/ipfs/go-ipfs/pull/3499)) - - Raw Nodes - - Implement 'Raw Node' node type for addressing raw data ([ipfs/go-ipfs#3307](https://github.com/ipfs/go-ipfs/pull/3307)) - - Optimize DagService GetLinks for Raw Nodes. ([ipfs/go-ipfs#3351](https://github.com/ipfs/go-ipfs/pull/3351)) - - Experimental PubSub - - Added a very basic pubsub implementation ([ipfs/go-ipfs#3202](https://github.com/ipfs/go-ipfs/pull/3202)) - - Core API - - gateway: use core api for serving GET/HEAD/POST ([ipfs/go-ipfs#3244](https://github.com/ipfs/go-ipfs/pull/3244)) - -- Improvements - - Disable auto-gc check in 'ipfs cat' ([ipfs/go-ipfs#3100](https://github.com/ipfs/go-ipfs/pull/3100)) - - Add `bitswap ledger` command ([ipfs/go-ipfs#2852](https://github.com/ipfs/go-ipfs/pull/2852)) - - Add `ipfs block rm` command. ([ipfs/go-ipfs#2962](https://github.com/ipfs/go-ipfs/pull/2962)) - - Add config option to disable bandwidth metrics ([ipfs/go-ipfs#3381](https://github.com/ipfs/go-ipfs/pull/3381)) - - Add experimental dht 'client mode' flag ([ipfs/go-ipfs#3269](https://github.com/ipfs/go-ipfs/pull/3269)) - - Add config option to set reprovider interval ([ipfs/go-ipfs#3101](https://github.com/ipfs/go-ipfs/pull/3101)) - - Add `ipfs dht provide` command ([ipfs/go-ipfs#3106](https://github.com/ipfs/go-ipfs/pull/3106)) - - Add stream info to `ipfs swarm peers -v` ([ipfs/go-ipfs#3352](https://github.com/ipfs/go-ipfs/pull/3352)) - - Add option to enable go-multiplex experiment ([ipfs/go-ipfs#3447](https://github.com/ipfs/go-ipfs/pull/3447)) - - Basic Keystore implementation ([ipfs/go-ipfs#3472](https://github.com/ipfs/go-ipfs/pull/3472)) - - Make `ipfs add --local` not send providers messages ([ipfs/go-ipfs#3102](https://github.com/ipfs/go-ipfs/pull/3102)) - - Fix bug in `ipfs tar add` that buffered input in memory ([ipfs/go-ipfs#3334](https://github.com/ipfs/go-ipfs/pull/3334)) - - Make blockstore retry operations on temporary errors ([ipfs/go-ipfs#3091](https://github.com/ipfs/go-ipfs/pull/3091)) - - Don't hold the PinLock in adder when not pinning. ([ipfs/go-ipfs#3222](https://github.com/ipfs/go-ipfs/pull/3222)) - - Validate repo/api file and improve error message ([ipfs/go-ipfs#3219](https://github.com/ipfs/go-ipfs/pull/3219)) - - no longer hard code gomaxprocs ([ipfs/go-ipfs#3357](https://github.com/ipfs/go-ipfs/pull/3357)) - - Updated Bash complete script ([ipfs/go-ipfs#3377](https://github.com/ipfs/go-ipfs/pull/3377)) - - Remove expensive debug statement in blockstore AllKeysChan ([ipfs/go-ipfs#3384](https://github.com/ipfs/go-ipfs/pull/3384)) - - Remove GC timeout, fix GC tests ([ipfs/go-ipfs#3494](https://github.com/ipfs/go-ipfs/pull/3494)) - - Fix `ipfs pin add` resource consumption ([ipfs/go-ipfs#3495](https://github.com/ipfs/go-ipfs/pull/3495)) ([ipfs/go-ipfs#3571](https://github.com/ipfs/go-ipfs/pull/3571)) - - Add IPNS entry to DHT cache after publish ([ipfs/go-ipfs#3501](https://github.com/ipfs/go-ipfs/pull/3501)) - - Add in `--routing=none` daemon option ([ipfs/go-ipfs#3605](https://github.com/ipfs/go-ipfs/pull/3605)) - -- Bitswap - - Don't re-provide blocks we've provided very recently ([ipfs/go-ipfs#3105](https://github.com/ipfs/go-ipfs/pull/3105)) - - Add a deadline to sendmsg calls ([ipfs/go-ipfs#3445](https://github.com/ipfs/go-ipfs/pull/3445)) - - cleanup bitswap and handle message send failure slightly better ([ipfs/go-ipfs#3408](https://github.com/ipfs/go-ipfs/pull/3408)) - - Increase wantlist resend delay to one minute ([ipfs/go-ipfs#3448](https://github.com/ipfs/go-ipfs/pull/3448)) - - Fix issue where wantlist fullness wasn't included in messages ([ipfs/go-ipfs#3461](https://github.com/ipfs/go-ipfs/pull/3461)) - - Only pass keys down newBlocks chan in bitswap ([ipfs/go-ipfs#3271](https://github.com/ipfs/go-ipfs/pull/3271)) - -- Bugfixes - - gateway: fix --writable flag ([ipfs/go-ipfs#3206](https://github.com/ipfs/go-ipfs/pull/3206)) - - Fix relative seek in unixfs not expanding file properly ([ipfs/go-ipfs#3095](https://github.com/ipfs/go-ipfs/pull/3095)) - - Update multicodec service names for ipfs services ([ipfs/go-ipfs#3132](https://github.com/ipfs/go-ipfs/pull/3132)) - - dht: add missing protocol ID to newStream call ([ipfs/go-ipfs#3203](https://github.com/ipfs/go-ipfs/pull/3203)) - - Return immediately on namesys error ([ipfs/go-ipfs#3345](https://github.com/ipfs/go-ipfs/pull/3345)) - - Improve osxfuse handling ([ipfs/go-ipfs#3098](https://github.com/ipfs/go-ipfs/pull/3098)) ([ipfs/go-ipfs#3413](https://github.com/ipfs/go-ipfs/pull/3413)) - - commands: fix opt.Description panic when desc was empty ([ipfs/go-ipfs#3521](https://github.com/ipfs/go-ipfs/pull/3521)) - - Fixes #3133: Properly handle release candidates in version comparison ([ipfs/go-ipfs#3136](https://github.com/ipfs/go-ipfs/pull/3136)) - - Don't drop error in readStreamedJson. ([ipfs/go-ipfs#3276](https://github.com/ipfs/go-ipfs/pull/3276)) - - Error out on invalid `--routing` option ([ipfs/go-ipfs#3482](https://github.com/ipfs/go-ipfs/pull/3482)) - - Respect contexts when returning diagnostics responses ([ipfs/go-ipfs#3353](https://github.com/ipfs/go-ipfs/pull/3353)) - - Fix json marshalling of pbnode ([ipfs/go-ipfs#3507](https://github.com/ipfs/go-ipfs/pull/3507)) - -- General changes and refactorings - - Disable Suborigins the spec changed and our impl conflicts ([ipfs/go-ipfs#3519](https://github.com/ipfs/go-ipfs/pull/3519)) - - Avoid sending provide messages for pinsets ([ipfs/go-ipfs#3103](https://github.com/ipfs/go-ipfs/pull/3103)) - - Refactor cli handling to expose argument parsing functionality ([ipfs/go-ipfs#3308](https://github.com/ipfs/go-ipfs/pull/3308)) - - Create a FilestoreNode object to carry PosInfo ([ipfs/go-ipfs#3314](https://github.com/ipfs/go-ipfs/pull/3314)) - - Print 'n/a' instead of zero latency in `ipfs swarm peers` ([ipfs/go-ipfs#3491](https://github.com/ipfs/go-ipfs/pull/3491)) - - Add DAGService.GetLinks() method to optimize traversals. ([ipfs/go-ipfs#3255](https://github.com/ipfs/go-ipfs/pull/3255)) - - Make path resolver no longer require whole IpfsNode for construction ([ipfs/go-ipfs#3321](https://github.com/ipfs/go-ipfs/pull/3321)) - - Distinguish between Offline and Local Modes of daemon operation. ([ipfs/go-ipfs#3259](https://github.com/ipfs/go-ipfs/pull/3259)) - - Separate out the GC Locking from the Blockstore interface. ([ipfs/go-ipfs#3348](https://github.com/ipfs/go-ipfs/pull/3348)) - - Avoid unnecessary allocs in datastore key handling ([ipfs/go-ipfs#3407](https://github.com/ipfs/go-ipfs/pull/3407)) - - Use NextSync method for datastore queries ([ipfs/go-ipfs#3386](https://github.com/ipfs/go-ipfs/pull/3386)) - - Switch unixfs.Metadata.MimeType to optional ([ipfs/go-ipfs#3458](https://github.com/ipfs/go-ipfs/pull/3458)) - - Fix path parsing in `ipfs name publish` ([ipfs/go-ipfs#3592](https://github.com/ipfs/go-ipfs/pull/3592)) - - Fix inconsistent `ipfs stats bw` formatting ([ipfs/go-ipfs#3554](https://github.com/ipfs/go-ipfs/pull/3554)) - - Set the libp2p agent version based on version string ([ipfs/go-ipfs#3569](https://github.com/ipfs/go-ipfs/pull/3569)) - -- Cross Platform Changes - - Fix 'dist_get' script on BSDs. ([ipfs/go-ipfs#3264](https://github.com/ipfs/go-ipfs/pull/3264)) - - ulimit: Tune resource limits on BSDs ([ipfs/go-ipfs#3374](https://github.com/ipfs/go-ipfs/pull/3374)) - -- Metrics - - Introduce go-metrics-interface ([ipfs/go-ipfs#3189](https://github.com/ipfs/go-ipfs/pull/3189)) - - Fix metrics injection ([ipfs/go-ipfs#3315](https://github.com/ipfs/go-ipfs/pull/3315)) - -- Misc - - Bump Go requirement to 1.7 ([ipfs/go-ipfs#3111](https://github.com/ipfs/go-ipfs/pull/3111)) - - Merge 0.4.3 release candidate changes back into master ([ipfs/go-ipfs#3248](https://github.com/ipfs/go-ipfs/pull/3248)) - - Add security@ipfs.io GPG key to assets ([ipfs/go-ipfs#2997](https://github.com/ipfs/go-ipfs/pull/2997)) - - Improve makefiles ([ipfs/go-ipfs#2999](https://github.com/ipfs/go-ipfs/pull/2999)) ([ipfs/go-ipfs#3265](https://github.com/ipfs/go-ipfs/pull/3265)) - - Refactor install.sh script ([ipfs/go-ipfs#3194](https://github.com/ipfs/go-ipfs/pull/3194)) - - Add test check for go code formatting ([ipfs/go-ipfs#3421](https://github.com/ipfs/go-ipfs/pull/3421)) - - bin: dist_get script: prevents get_go_vars() returns same values twice ([ipfs/go-ipfs#3079](https://github.com/ipfs/go-ipfs/pull/3079)) - -- Dependencies - - Update libp2p to have fixed spdystream dep ([ipfs/go-ipfs#3210](https://github.com/ipfs/go-ipfs/pull/3210)) - - Update libp2p and dht packages ([ipfs/go-ipfs#3263](https://github.com/ipfs/go-ipfs/pull/3263)) - - Update to libp2p 4.0.1 and propogate other changes ([ipfs/go-ipfs#3284](https://github.com/ipfs/go-ipfs/pull/3284)) - - Update to libp2p 4.0.4 ([ipfs/go-ipfs#3361](https://github.com/ipfs/go-ipfs/pull/3361)) - - Update go-libp2p across codebase ([ipfs/go-ipfs#3406](https://github.com/ipfs/go-ipfs/pull/3406)) - - Update to go-libp2p 4.1.0 ([ipfs/go-ipfs#3373](https://github.com/ipfs/go-ipfs/pull/3373)) - - Update deps for libp2p 3.4.0 ([ipfs/go-ipfs#3110](https://github.com/ipfs/go-ipfs/pull/3110)) - - Update go-libp2p-swarm with deadlock fixes ([ipfs/go-ipfs#3339](https://github.com/ipfs/go-ipfs/pull/3339)) - - Update to new cid and ipld node packages ([ipfs/go-ipfs#3326](https://github.com/ipfs/go-ipfs/pull/3326)) - - Update to newer ipld node interface with Copy and better Tree ([ipfs/go-ipfs#3391](https://github.com/ipfs/go-ipfs/pull/3391)) - - Update experimental go-multiplex to 0.2.6 ([ipfs/go-ipfs#3475](https://github.com/ipfs/go-ipfs/pull/3475)) - - Rework routing interfaces to make separation easier ([ipfs/go-ipfs#3107](https://github.com/ipfs/go-ipfs/pull/3107)) - - Update to dht code with fixed GetClosestPeers ([ipfs/go-ipfs#3346](https://github.com/ipfs/go-ipfs/pull/3346)) - - Move go-is-domain to gx ([ipfs/go-ipfs#3077](https://github.com/ipfs/go-ipfs/pull/3077)) - - Extract thirdparty/loggables and thirdparty/peerset ([ipfs/go-ipfs#3204](https://github.com/ipfs/go-ipfs/pull/3204)) - - Completely remove go-key dep ([ipfs/go-ipfs#3439](https://github.com/ipfs/go-ipfs/pull/3439)) - - Remove randbo dep, its no longer needed ([ipfs/go-ipfs#3118](https://github.com/ipfs/go-ipfs/pull/3118)) - - Update libp2p for identify configuration updates ([ipfs/go-ipfs#3539](https://github.com/ipfs/go-ipfs/pull/3539)) - - Use newer flatfs sharding scheme ([ipfs/go-ipfs#3608](https://github.com/ipfs/go-ipfs/pull/3608)) - -- Testing - - fix test_fsh arg quoting in ipfs-test-lib ([ipfs/go-ipfs#3085](https://github.com/ipfs/go-ipfs/pull/3085)) - - 100% coverage for blocks/blocksutil ([ipfs/go-ipfs#3090](https://github.com/ipfs/go-ipfs/pull/3090)) - - 100% coverage on blocks/set ([ipfs/go-ipfs#3084](https://github.com/ipfs/go-ipfs/pull/3084)) - - 81% coverage on blockstore ([ipfs/go-ipfs#3074](https://github.com/ipfs/go-ipfs/pull/3074)) - - 80% coverage of unixfs/mod ([ipfs/go-ipfs#3096](https://github.com/ipfs/go-ipfs/pull/3096)) - - 82% coverage on blocks ([ipfs/go-ipfs#3086](https://github.com/ipfs/go-ipfs/pull/3086)) - - 87% coverage on unixfs ([ipfs/go-ipfs#3492](https://github.com/ipfs/go-ipfs/pull/3492)) - - Improve coverage on routing/offline ([ipfs/go-ipfs#3516](https://github.com/ipfs/go-ipfs/pull/3516)) - - Add test for flags package ([ipfs/go-ipfs#3449](https://github.com/ipfs/go-ipfs/pull/3449)) - - improve test coverage on merkledag package ([ipfs/go-ipfs#3113](https://github.com/ipfs/go-ipfs/pull/3113)) - - 80% coverage of unixfs/io ([ipfs/go-ipfs#3097](https://github.com/ipfs/go-ipfs/pull/3097)) - - Accept more than one digit in repo version tests ([ipfs/go-ipfs#3130](https://github.com/ipfs/go-ipfs/pull/3130)) - - Fix typo in hash in t0050 ([ipfs/go-ipfs#3170](https://github.com/ipfs/go-ipfs/pull/3170)) - - fix bug in pinsets and add a stress test for the scenario ([ipfs/go-ipfs#3273](https://github.com/ipfs/go-ipfs/pull/3273)) ([ipfs/go-ipfs#3302](https://github.com/ipfs/go-ipfs/pull/3302)) - - Report coverage to codecov ([ipfs/go-ipfs#3473](https://github.com/ipfs/go-ipfs/pull/3473)) - - Add test for 'ipfs config replace' ([ipfs/go-ipfs#3073](https://github.com/ipfs/go-ipfs/pull/3073)) - - Fix netcat on macOS not closing socket when the stdin sends EOF ([ipfs/go-ipfs#3515](https://github.com/ipfs/go-ipfs/pull/3515)) - -- Documentation - - Update dns help with a correct domain name ([ipfs/go-ipfs#3087](https://github.com/ipfs/go-ipfs/pull/3087)) - - Add period to `ipfs pin rm` ([ipfs/go-ipfs#3088](https://github.com/ipfs/go-ipfs/pull/3088)) - - Make all Taglines use imperative mood ([ipfs/go-ipfs#3041](https://github.com/ipfs/go-ipfs/pull/3041)) - - Document listing commands better ([ipfs/go-ipfs#3083](https://github.com/ipfs/go-ipfs/pull/3083)) - - Add notes to readme on building for uncommon systems ([ipfs/go-ipfs#3051](https://github.com/ipfs/go-ipfs/pull/3051)) - - Add branch naming conventions doc ([ipfs/go-ipfs#3035](https://github.com/ipfs/go-ipfs/pull/3035)) - - Replace keyword with <> ([ipfs/go-ipfs#3129](https://github.com/ipfs/go-ipfs/pull/3129)) - - Fix Add() docs regarding pinning ([ipfs/go-ipfs#3513](https://github.com/ipfs/go-ipfs/pull/3513)) - - Add sudo to install commands. ([ipfs/go-ipfs#3201](https://github.com/ipfs/go-ipfs/pull/3201)) - - Add docs for `"commands".Command.Run` ([ipfs/go-ipfs#3382](https://github.com/ipfs/go-ipfs/pull/3382)) - - Put config keys in proper case ([ipfs/go-ipfs#3365](https://github.com/ipfs/go-ipfs/pull/3365)) - - Fix link in `ipfs stats bw` help message ([ipfs/go-ipfs#3620](https://github.com/ipfs/go-ipfs/pull/3620)) - - -### 0.4.4 - 2016-10-11 - -This release contains an important hotfix for a bug we discovered in how pinning works. -If you had a large number of pins, new pins would overwrite existing pins. -Apart from the hotfix, this release is equal to the previous release 0.4.3. - -- Fix bug in pinsets fanout, and add stress test. (@whyrusleeping, [ipfs/go-ipfs#3273](https://github.com/ipfs/go-ipfs/pull/3273)) - -We published a [detailed account of the bug and fix in a blog post](https://ipfs.io/blog/21-go-ipfs-0-4-4-released/). - -### 0.4.3 - 2016-09-20 - -There have been no changes since the last release candidate 0.4.3-rc4. \o/ - -### 0.4.3-rc4 - 2016-09-09 - -This release candidate fixes issues in Bitswap and the `ipfs add` command, and improves testing. -We plan for this to be the last release candidate before the release of go-ipfs v0.4.3. - -With this release candidate, we're also moving go-ipfs to Go 1.7, which we expect will yield improvements in runtime performance, memory usage, build time and size of the release binaries. - -- Require Go 1.7. (@whyrusleeping, @Kubuxu, @lgierth, [ipfs/go-ipfs#3163](https://github.com/ipfs/go-ipfs/pull/3163)) - - For this purpose, switch Docker image from Alpine 3.4 to Alpine Edge. -- Fix cancellation of Bitswap `wantlist` entries. (@whyrusleeping, [ipfs/go-ipfs#3182](https://github.com/ipfs/go-ipfs/pull/3182)) -- Fix clearing of `active` state of Bitswap provider queries. (@whyrusleeping, [ipfs/go-ipfs#3169](https://github.com/ipfs/go-ipfs/pull/3169)) -- Fix a panic in the DHT code. (@Kubuxu, [ipfs/go-ipfs#3200](https://github.com/ipfs/go-ipfs/pull/3200)) -- Improve handling of `Identity` field in `ipfs config` command. (@Kubuxu, @whyrusleeping, [ipfs/go-ipfs#3141](https://github.com/ipfs/go-ipfs/pull/3141)) -- Fix explicit adding of symlinked files and directories. (@kevina, [ipfs/go-ipfs#3135](https://github.com/ipfs/go-ipfs/pull/3135)) -- Fix bash auto-completion of `ipfs daemon --unrestricted-api` option. (@lgierth, [ipfs/go-ipfs#3159](https://github.com/ipfs/go-ipfs/pull/3159)) -- Introduce a new timeout tool for tests to avoid licensing issues. (@Kubuxu, [ipfs/go-ipfs#3152](https://github.com/ipfs/go-ipfs/pull/3152)) -- Improve output for migrations of fs-repo. (@lgierth, [ipfs/go-ipfs#3158](https://github.com/ipfs/go-ipfs/pull/3158)) -- Fix info notice of commands taking input from stdin. (@Kubuxu, [ipfs/go-ipfs#3134](https://github.com/ipfs/go-ipfs/pull/3134)) -- Bring back a few tests for stdin handling of `ipfs cat` and `ipfs add`. (@Kubuxu, [ipfs/go-ipfs#3144](https://github.com/ipfs/go-ipfs/pull/3144)) -- Improve sharness tests for `ipfs repo verify` command. (@whyrusleeping, [ipfs/go-ipfs#3148](https://github.com/ipfs/go-ipfs/pull/3148)) -- Improve sharness tests for CORS headers on the gateway. (@Kubuxu, [ipfs/go-ipfs#3142](https://github.com/ipfs/go-ipfs/pull/3142)) -- Improve tests for pinning within `ipfs files`. (@kevina, [ipfs/go-ipfs#3151](https://github.com/ipfs/go-ipfs/pull/3151)) -- Improve tests for the automatic raising of file descriptor limits. (@whyrusleeping, [ipfs/go-ipfs#3149](https://github.com/ipfs/go-ipfs/pull/3149)) - -### 0.4.3-rc3 - 2016-08-11 - -This release candidate fixes a panic that occurs when input from stdin was -expected, but none was given: [ipfs/go-ipfs#3050](https://github.com/ipfs/go-ipfs/pull/3050) - -### 0.4.3-rc2 - 2016-08-04 - -This release includes bugfixes and fixes for regressions that were introduced -between 0.4.2 and 0.4.3-rc1. - -- Regressions - - Fix daemon panic when there is no multipart input provided over the HTTP API. - (@whyrusleeping, [ipfs/go-ipfs#2989](https://github.com/ipfs/go-ipfs/pull/2989)) - - Fix `ipfs refs --edges` not printing edges. - (@Kubuxu, [ipfs/go-ipfs#3007](https://github.com/ipfs/go-ipfs/pull/3007)) - - Fix progress option for `ipfs add` defaulting to true on the HTTP API. - (@whyrusleeping, [ipfs/go-ipfs#3025](https://github.com/ipfs/go-ipfs/pull/3025)) - - Fix erroneous printing of stdin reading message. - (@whyrusleeping, [ipfs/go-ipfs#3033](https://github.com/ipfs/go-ipfs/pull/3033)) - - Fix panic caused by passing `--mount` and `--offline` flags to `ipfs daemon`. - (@Kubuxu, [ipfs/go-ipfs#3022](https://github.com/ipfs/go-ipfs/pull/3022)) - - Fix symlink path resolution on windows. - (@Kubuxu, [ipfs/go-ipfs#3023](https://github.com/ipfs/go-ipfs/pull/3023)) - - Add in code to prevent issue 3032 from crashing the daemon. - (@whyrusleeping, [ipfs/go-ipfs#3037](https://github.com/ipfs/go-ipfs/pull/3037)) - - -### 0.4.3-rc1 - 2016-07-23 - -This is a maintenance release which comes with a couple of nice enhancements, and improves the performance of Storage, Bitswap, as well as Content and Peer Routing. It also introduces a handful of new commands and options, and fixes a good bunch of bugs. - -This is the first Release Candidate. Unless there are vulnerabilities or regressions discovered, the final 0.4.3 release will happen about one week from now. - -- Security Vulnerability - - - The `master` branch if go-ipfs suffered from a vulnerability for about 3 weeks. It allowed an attacker to use an iframe to request malicious HTML and JS from the API of a local go-ipfs node. The attacker could then gain unrestricted access to the node's API, and e.g. extract the private key. We fixed this issue by reintroducing restrictions on which particular objects can be loaded through the API (@lgierth, [ipfs/go-ipfs#2949](https://github.com/ipfs/go-ipfs/pull/2949)), and by completely excluding the private key from the API (@Kubuxu, [ipfs/go-ipfs#2957](https://github.com/ipfs/go-ipfs/pull/2957)). We will also work on more hardening of the API in the next release. - - **The previous release 0.4.2 is not vulnerable. That means if you're using official binaries from [dist.ipfs.io](https://dist.ipfs.io) you're not affected.** If you're running go-ipfs built from the `master` branch between June 17th ([ipfs/go-ipfs@1afebc21](https://github.com/ipfs/go-ipfs/commit/1afebc21f324982141ca8a29710da0d6f83ca804)) and July 7th ([ipfs/go-ipfs@39bef0d5](https://github.com/ipfs/go-ipfs/commit/39bef0d5b01f70abf679fca2c4d078a2d55620e2)), please update to v0.4.3-rc1 immediately. - - We are grateful to the group of independent researchers who made us aware of this vulnerability. We wanna use this opportunity to reiterate that we're very happy about any additional review of pull requests and releases. You can contact us any time at security@ipfs.io (GPG [4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3](https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3)). - -- Notable changes - - - Improve Bitswap performance. (@whyrusleeping, [ipfs/go-ipfs#2727](https://github.com/ipfs/go-ipfs/pull/2727), [ipfs/go-ipfs#2798](https://github.com/ipfs/go-ipfs/pull/2798)) - - Improve Content Routing and Peer Routing performance. (@whyrusleeping, [ipfs/go-ipfs#2817](https://github.com/ipfs/go-ipfs/pull/2817), [ipfs/go-ipfs#2841](https://github.com/ipfs/go-ipfs/pull/2841)) - - Improve datastore, blockstore, and dagstore performance. (@kevina, @Kubuxu, @whyrusleeping [ipfs/go-datastore#43](https://github.com/ipfs/go-datastore/pull/43), [ipfs/go-ipfs#2885](https://github.com/ipfs/go-ipfs/pull/2885), [ipfs/go-ipfs#2961](https://github.com/ipfs/go-ipfs/pull/2961), [ipfs/go-ipfs#2953](https://github.com/ipfs/go-ipfs/pull/2953), [ipfs/go-ipfs#2960](https://github.com/ipfs/go-ipfs/pull/2960)) - - Content Providers are now stored on disk to gain savings on process memory. (@whyrusleeping, [ipfs/go-ipfs#2804](https://github.com/ipfs/go-ipfs/pull/2804), [ipfs/go-ipfs#2860](https://github.com/ipfs/go-ipfs/pull/2860)) - - Migrations of the fs-repo (usually stored at `~/.ipfs`) now run automatically. If there's a TTY available, you'll get prompted when running `ipfs daemon`, and in addition you can use the `--migrate=true` or `--migrate=false` options to avoid the prompt. (@whyrusleeping, @lgierth, [ipfs/go-ipfs#2939](https://github.com/ipfs/go-ipfs/pull/2939)) - - The internal naming of blocks in the blockstore has changed, which requires a migration of the fs-repo, from version 3 to 4. (@whyrusleeping, [ipfs/go-ipfs#2903](https://github.com/ipfs/go-ipfs/pull/2903)) - - We now automatically raise the file descriptor limit to 1024 if neccessary. (@whyrusleeping, [ipfs/go-ipfs#2884](https://github.com/ipfs/go-ipfs/pull/2884), [ipfs/go-ipfs#2891](https://github.com/ipfs/go-ipfs/pull/2891)) - - After a long struggle with deadlocks and hanging connections, we've decided to disable the uTP transport by default for now. (@whyrusleeping, [ipfs/go-ipfs#2840](https://github.com/ipfs/go-ipfs/pull/2840), [ipfs/go-libp2p-transport@88244000](https://github.com/ipfs/go-libp2p-transport/commit/88244000f0ce8851ffcfbac746ebc0794b71d2a4)) - - There is now documentation for the configuration options in `docs/config.md`. (@whyrusleeping, [ipfs/go-ipfs#2974](https://github.com/ipfs/go-ipfs/pull/2974)) - - All commands now sanely handle the combination of stdin and optional flags in certain edge cases. (@lgierth, [ipfs/go-ipfs#2952](https://github.com/ipfs/go-ipfs/pull/2952)) - -- New Features - - - Add `--offline` option to `ipfs daemon` command, which disables all swarm networking. (@Kubuxu, [ipfs/go-ipfs#2696](https://github.com/ipfs/go-ipfs/pull/2696), [ipfs/go-ipfs#2867](https://github.com/ipfs/go-ipfs/pull/2867)) - - Add `Datastore.HashOnRead` option for verifying block hashes on read access. (@Kubuxu, [ipfs/go-ipfs#2904](https://github.com/ipfs/go-ipfs/pull/2904)) - - Add `Datastore.BloomFilterSize` option for tuning the blockstore's new lookup bloom filter. (@Kubuxu, [ipfs/go-ipfs#2973](https://github.com/ipfs/go-ipfs/pull/2973)) - -- Bugfixes - - - Fix publishing of local IPNS entries, and more. (@whyrusleeping, [ipfs/go-ipfs#2943](https://github.com/ipfs/go-ipfs/pull/2943)) - - Fix progress bars in `ipfs add` and `ipfs get`. (@whyrusleeping, [ipfs/go-ipfs#2893](https://github.com/ipfs/go-ipfs/pull/2893), [ipfs/go-ipfs#2948](https://github.com/ipfs/go-ipfs/pull/2948)) - - Make sure files added through `ipfs files` are pinned and don't get GC'd. (@kevina, [ipfs/go-ipfs#2872](https://github.com/ipfs/go-ipfs/pull/2872)) - - Fix copying into directory using `ipfs files cp`. (@whyrusleeping, [ipfs/go-ipfs#2977](https://github.com/ipfs/go-ipfs/pull/2977)) - - Fix `ipfs version --commit` with Docker containers. (@lgierth, [ipfs/go-ipfs#2734](https://github.com/ipfs/go-ipfs/pull/2734)) - - Run `ipfs diag` commands in the daemon instead of the CLI. (@Kubuxu, [ipfs/go-ipfs#2761](https://github.com/ipfs/go-ipfs/pull/2761)) - - Fix protobuf encoding on the API and in commands. (@stebalien, [ipfs/go-ipfs#2516](https://github.com/ipfs/go-ipfs/pull/2516)) - - Fix goroutine leak in `/ipfs/ping` protocol handler. (@whyrusleeping, [ipfs/go-libp2p#58](https://github.com/ipfs/go-libp2p/pull/58)) - - Fix `--flags` option on `ipfs commands`. (@Kubuxu, [ipfs/go-ipfs#2773](https://github.com/ipfs/go-ipfs/pull/2773)) - - Fix the error channels in `namesys`. (@whyrusleeping, [ipfs/go-ipfs#2788](https://github.com/ipfs/go-ipfs/pull/2788)) - - Fix consumptions of observed swarm addresses. (@whyrusleeping, [ipfs/go-libp2p#63](https://github.com/ipfs/go-libp2p/pull/63), [ipfs/go-ipfs#2771](https://github.com/ipfs/go-ipfs/issues/2771)) - - Fix a rare DHT panic. (@whyrusleeping, [ipfs/go-ipfs#2856](https://github.com/ipfs/go-ipfs/pull/2856)) - - Fix go-ipfs/js-ipfs interoperability issues in SPDY. (@whyrusleeping, [whyrusleeping/go-smux-spdystream@fae17783](https://github.com/whyrusleeping/go-smux-spdystream/commit/fae1778302a9e029bb308cf71cf33f857f2d89e8)) - - Fix a logging race condition during shutdown. (@Kubuxu, [ipfs/go-log#3](https://github.com/ipfs/go-log/pull/3)) - - Prevent DHT connection hangs. (@whyrusleeping, [ipfs/go-ipfs#2826](https://github.com/ipfs/go-ipfs/pull/2826), [ipfs/go-ipfs#2863](https://github.com/ipfs/go-ipfs/pull/2863)) - - Fix NDJSON output of `ipfs refs local`. (@Kubuxu, [ipfs/go-ipfs#2812](https://github.com/ipfs/go-ipfs/pull/2812)) - - Fix race condition in NAT detection. (@whyrusleeping, [ipfs/go-libp2p#69](https://github.com/ipfs/go-libp2p/pull/69)) - - Fix error messages. (@whyrusleeping, @Kubuxu, [ipfs/go-ipfs#2905](https://github.com/ipfs/go-ipfs/pull/2905), [ipfs/go-ipfs#2928](https://github.com/ipfs/go-ipfs/pull/2928)) - -- Enhancements - - - Increase maximum object size on `ipfs put` from 1 MiB to 2 MiB. The maximum object size on the wire including all framing is 4 MiB. (@kpcyrd, [ipfs/go-ipfs#2980](https://github.com/ipfs/go-ipfs/pull/2980)) - - Add CORS headers to the Gateway's default config. (@Kubuxu, [ipfs/go-ipfs#2778](https://github.com/ipfs/go-ipfs/pull/2778)) - - Clear the dial backoff for a peer when using `ipfs swarm connect`. (@whyrusleeping, [ipfs/go-ipfs#2941](https://github.com/ipfs/go-ipfs/pull/2941)) - - Allow passing options to daemon in Docker container. (@lgierth, [ipfs/go-ipfs#2955](https://github.com/ipfs/go-ipfs/pull/2955)) - - Add `-v/--verbose` to `ìpfs swarm peers` command. (@csasarak, [ipfs/go-ipfs#2713](https://github.com/ipfs/go-ipfs/pull/2713)) - - Add `--format`, `--hash`, and `--size` options to `ipfs files stat` command. (@Kubuxu, [ipfs/go-ipfs#2706](https://github.com/ipfs/go-ipfs/pull/2706)) - - Add `--all` option to `ipfs version` command. (@Kubuxu, [ipfs/go-ipfs#2790](https://github.com/ipfs/go-ipfs/pull/2790)) - - Add `ipfs repo version` command. (@pfista, [ipfs/go-ipfs#2598](https://github.com/ipfs/go-ipfs/pull/2598)) - - Add `ipfs repo verify` command. (@whyrusleeping, [ipfs/go-ipfs#2924](https://github.com/ipfs/go-ipfs/pull/2924), [ipfs/go-ipfs#2951](https://github.com/ipfs/go-ipfs/pull/2951)) - - Add `ipfs stats repo` and `ipfs stats bitswap` command aliases. (@pfista, [ipfs/go-ipfs#2810](https://github.com/ipfs/go-ipfs/pull/2810)) - - Add success indication to responses of `ipfs ping` command. (@Kubuxu, [ipfs/go-ipfs#2813](https://github.com/ipfs/go-ipfs/pull/2813)) - - Save changes made via `ipfs swarm filter` to the config file. (@yuvallanger, [ipfs/go-ipfs#2880](https://github.com/ipfs/go-ipfs/pull/2880)) - - Expand `ipfs_p2p_peers` metric to include libp2p transport. (@lgierth, [ipfs/go-ipfs#2728](https://github.com/ipfs/go-ipfs/pull/2728)) - - Rework `ipfs files add` internals to avoid caching and prevent memory leaks. (@whyrusleeping, [ipfs/go-ipfs#2795](https://github.com/ipfs/go-ipfs/pull/2795)) - - Support `GOPATH` with multiple path components. (@karalabe, @lgierth, @djdv, [ipfs/go-ipfs#2808](https://github.com/ipfs/go-ipfs/pull/2808), [ipfs/go-ipfs#2862](https://github.com/ipfs/go-ipfs/pull/2862), [ipfs/go-ipfs#2975](https://github.com/ipfs/go-ipfs/pull/2975)) - -- General Codebase - - - Take steps towards the `filestore` datastore. (@kevina, [ipfs/go-ipfs#2792](https://github.com/ipfs/go-ipfs/pull/2792), [ipfs/go-ipfs#2634](https://github.com/ipfs/go-ipfs/pull/2634)) - - Update recommended Golang version to 1.6.2 (@Kubuxu, [ipfs/go-ipfs#2724](https://github.com/ipfs/go-ipfs/pull/2724)) - - Update to Gx 0.8.0 and Gx-Go 1.2.1, which is faster and less noisy. (@whyrusleeping, [ipfs/go-ipfs#2979](https://github.com/ipfs/go-ipfs/pull/2979)) - - Use `go4.org/lock` instead of `camlistore/lock` for locking. (@whyrusleeping, [ipfs/go-ipfs#2887](https://github.com/ipfs/go-ipfs/pull/2887)) - - Manage `go.uuid`, `hamming`, `backoff`, `proquint`, `pb`, `go-context`, `cors`, `go-datastore` packages with Gx. (@Kubuxu, [ipfs/go-ipfs#2733](https://github.com/ipfs/go-ipfs/pull/2733), [ipfs/go-ipfs#2736](https://github.com/ipfs/go-ipfs/pull/2736), [ipfs/go-ipfs#2757](https://github.com/ipfs/go-ipfs/pull/2757), [ipfs/go-ipfs#2825](https://github.com/ipfs/go-ipfs/pull/2825), [ipfs/go-ipfs#2838](https://github.com/ipfs/go-ipfs/pull/2838)) - - Clean up the gateway's surface. (@lgierth, [ipfs/go-ipfs#2874](https://github.com/ipfs/go-ipfs/pull/2874)) - - Simplify the API gateway's access restrictions. (@lgierth, [ipfs/go-ipfs#2949](https://github.com/ipfs/go-ipfs/pull/2949), [ipfs/go-ipfs#2956](https://github.com/ipfs/go-ipfs/pull/2956)) - - Update docker image to Alpine Linux 3.4 and remove Go version constraint. (@lgierth, [ipfs/go-ipfs#2901](https://github.com/ipfs/go-ipfs/pull/2901), [ipfs/go-ipfs#2929](https://github.com/ipfs/go-ipfs/pull/2929)) - - Clarify `Dockerfile` and `Dockerfile.fast`. (@lgierth, [ipfs/go-ipfs#2796](https://github.com/ipfs/go-ipfs/pull/2796)) - - Simplify resolution of Git commit refs in Dockerfiles. (@lgierth, [ipfs/go-ipfs#2754](https://github.com/ipfs/go-ipfs/pull/2754)) - - Consolidate `--verbose` description across commands. (@Kubuxu, [ipfs/go-ipfs#2746](https://github.com/ipfs/go-ipfs/pull/2746)) - - Allow setting position of default values in command option descriptions. (@Kubuxu, [ipfs/go-ipfs#2744](https://github.com/ipfs/go-ipfs/pull/2744)) - - Set explicit default values for boolean command options. (@RichardLitt, [ipfs/go-ipfs#2657](https://github.com/ipfs/go-ipfs/pull/2657)) - - Autogenerate command synopsises. (@Kubuxu, [ipfs/go-ipfs#2785](https://github.com/ipfs/go-ipfs/pull/2785)) - - Fix and improve lots of documentation. (@RichardLitt, [ipfs/go-ipfs#2741](https://github.com/ipfs/go-ipfs/pull/2741), [ipfs/go-ipfs#2781](https://github.com/ipfs/go-ipfs/pull/2781)) - - Improve command descriptions to fit a width of 78 characters. (@RichardLitt, [ipfs/go-ipfs#2779](https://github.com/ipfs/go-ipfs/pull/2779), [ipfs/go-ipfs#2780](https://github.com/ipfs/go-ipfs/pull/2780), [ipfs/go-ipfs#2782](https://github.com/ipfs/go-ipfs/pull/2782)) - - Fix filename conflict in the debugging guide. (@Kubuxu, [ipfs/go-ipfs#2752](https://github.com/ipfs/go-ipfs/pull/2752)) - - Decapitalize log messages, according to Golang style guides. (@RichardLitt, [ipfs/go-ipfs#2853](https://github.com/ipfs/go-ipfs/pull/2853)) - - Add Github Issues HowTo guide. (@RichardLitt, @chriscool, [ipfs/go-ipfs#2889](https://github.com/ipfs/go-ipfs/pull/2889), [ipfs/go-ipfs#2895](https://github.com/ipfs/go-ipfs/pull/2895)) - - Add Github Issue template. (@chriscool, [ipfs/go-ipfs#2786](https://github.com/ipfs/go-ipfs/pull/2786)) - - Apply standard-readme to the README file. (@RichardLitt, [ipfs/go-ipfs#2883](https://github.com/ipfs/go-ipfs/pull/2883)) - - Fix issues pointed out by `govet`. (@Kubuxu, [ipfs/go-ipfs#2854](https://github.com/ipfs/go-ipfs/pull/2854)) - - Clarify `ipfs get` error message. (@whyrusleeping, [ipfs/go-ipfs#2886](https://github.com/ipfs/go-ipfs/pull/2886)) - - Remove dead code. (@whyrusleeping, [ipfs/go-ipfs#2819](https://github.com/ipfs/go-ipfs/pull/2819)) - - Add changelog for v0.4.3. (@lgierth, [ipfs/go-ipfs#2984](https://github.com/ipfs/go-ipfs/pull/2984)) - -- Tests & CI - - - Fix flaky `ipfs mount` sharness test by using the `iptb` tool. (@noffle, [ipfs/go-ipfs#2707](https://github.com/ipfs/go-ipfs/pull/2707)) - - Fix flaky IP port selection in tests. (@Kubuxu, [ipfs/go-ipfs#2855](https://github.com/ipfs/go-ipfs/pull/2855)) - - Fix CLI tests on OSX by resolving /tmp symlink. (@Kubuxu, [ipfs/go-ipfs#2926](https://github.com/ipfs/go-ipfs/pull/2926)) - - Fix flaky GC test by running the daemon in offline mode. (@Kubuxu, [ipfs/go-ipfs#2908](https://github.com/ipfs/go-ipfs/pull/2908)) - - Add tests for `ipfs add` with hidden files. (@Kubuxu, [ipfs/go-ipfs#2756](https://github.com/ipfs/go-ipfs/pull/2756)) - - Add test to make sure the body of HEAD responses is empty. (@Kubuxu, [ipfs/go-ipfs#2775](https://github.com/ipfs/go-ipfs/pull/2775)) - - Add test to catch misdials. (@Kubuxu, [ipfs/go-ipfs#2831](https://github.com/ipfs/go-ipfs/pull/2831)) - - Mark flaky tests for `ipfs dht query` as known failure. (@noffle, [ipfs/go-ipfs#2720](https://github.com/ipfs/go-ipfs/pull/2720)) - - Remove failing blockstore-without-context test. (@Kubuxu, [ipfs/go-ipfs#2857](https://github.com/ipfs/go-ipfs/pull/2857)) - - Fix `--version` tests for versions with a suffix like `-dev` or `-rc1`. (@lgierth, [ipfs/go-ipfs#2937](https://github.com/ipfs/go-ipfs/pull/2937)) - - Make sharness tests work in cases where go-ipfs is symlinked into GOPATH. (@lgierth, [ipfs/go-ipfs#2937](https://github.com/ipfs/go-ipfs/pull/2937)) - - Add variable delays to blockstore mocks. (@rikonor, [ipfs/go-ipfs#2871](https://github.com/ipfs/go-ipfs/pull/2871)) - - Disable Travis CI email notifications. (@Kubuxu, [ipfs/go-ipfs#2896](https://github.com/ipfs/go-ipfs/pull/2896)) - - -### 0.4.2 - 2016-05-17 - -This is a patch release which fixes performance and networking bugs in go-libp2p, -You should see improvements in CPU and RAM usage, as well as speed of object lookups. -There are also a few other nice improvements. - -* Notable Fixes - * Set a deadline for dialing attempts. This prevents a node from accumulating - failed connections. (@whyrusleeping) - * Avoid unnecessary string/byte conversions in go-multihash. (@whyrusleeping) - * Fix a deadlock around the yamux stream muxer. (@whyrusleeping) - * Fix a bug that left channels open, causing hangs. (@whyrusleeping) - * Fix a bug around yamux which caused connection hangs. (@whyrusleeping) - * Fix a crash caused by nil multiaddrs. (@whyrusleeping) - -* Enhancements - * Add NetBSD support. (@erde74) - * Set Cache-Control: immutable on /ipfs responses. (@kpcyrd) - * Have `ipfs init` optionally accept a default configuration from stdin. (@sivachandran) - * Add `ipfs log ls` command for listing logging subsystems. (@hsanjuan) - * Allow bitswap to read multiple messages per stream. (@whyrusleeping) - * Remove `make toolkit_upgrade` step. (@chriscool) - -* Documentation - * Add a debug-guidelines document. (@richardlitt) - * Update the contribute document. (@richardlitt) - * Fix documentation of many `ipfs` commands. (@richardlitt) - * Fall back to ShortDesc if LongDesc is missing. (@Kubuxu) - -* Removals - * Remove -f option from `ipfs init` command. (@whyrusleeping) - -* Bugfixes - * Fix `ipfs object patch` argument handling and validation. (@jbenet) - * Fix `ipfs config edit` command by running it client-side. (@Kubuxu) - * Set default value for `ipfs refs` arguments. (@richardlitt) - * Fix parsing of incorrect command and argument permutations. (@thomas-gardner) - * Update Dockerfile to latest go1.5.4-r0. (@chriscool) - * Allow passing IPFS_LOGGING to Docker image. (@lgierth) - * Fix dot path parsing on Windows. (@djdv) - * Fix formatting of `ipfs log ls` output. (@richardlitt) - -* General Codebase - * Refactor Makefile. (@kevina) - * Wire context into bitswap requests more deeply. (@whyrusleeping) - * Use gx for iptb. (@chriscool) - * Update gx and gx-go. (@chriscool) - * Make blocks.Block an interface. (@kevina) - * Silence check for Docker existance. (@chriscool) - * Add dist_get script for fetching tools from dist.ipfs.io. (@whyrusleeping) - * Add proper defaults to all `ipfs` commands. (@richardlitt) - * Remove dead `count` option from `ipfs pin ls`. (@richardlitt) - * Initialize pin mode strings only once. (@chriscool) - * Add changelog for v0.4.2. (@lgierth) - * Specify a dist.ipfs.io hash for tool downloads instead of trusting DNS. (@lgierth) - -* CI - * Fix t0170-dht sharness test. (@chriscool) - * Increase timeout in t0060-daemon sharness test. (@Kubuxu) - * Have CircleCI use `make deps` instead of `gx` directly. (@whyrusleeping) - - -### 0.4.1 - 2016-04-25 - -This is a patch release that fixes a few bugs, and adds a few small (but not -insignificant) features. The primary reason for this release is the listener -hang bugfix that was shipped in the 0.4.0 release. - -* Features - * implemented ipfs object diff (@whyrusleeping) - * allow promises (used in get, refs) to fail (@whyrusleeping) - -* Tool changes - * Adds 'toolkit_upgrade' to the makefile help target (@achin) - -* General Codebase - * Use extracted go-libp2p-crypto, -secio, -peer packages (@lgierth) - * Update go-libp2p (@lgierth) - * Fix package manifest fields (@lgierth) - * remove incfusever dead-code (@whyrusleeping) - * remove a ton of unused godeps (@whyrusleeping) - * metrics: add prometheus back (@lgierth) - * clean up dead code and config fields (@whyrusleeping) - * Add log events when blocks are added/removed from the blockstore (@michealmure) - * repo: don't create logs directory, not used any longer (@lgierth) - -* Bugfixes - * fixed ipfs name resolve --local multihash error (@pfista) - * ipfs patch commands won't return null links field anymore (@whyrusleeping) - * Make non recursive resolve print the result (@Kubuxu) - * Output dirs on ipfs add -rn (@noffle) - * update libp2p dep to fix hanging listeners problem (@whyrusleeping) - * Fix Swarm.AddrFilters config setting with regard to `/ip6` addresses (@lgierth) - * fix dht command key escaping (@whyrusleeping) - -* Testing - * Adds tests to make sure 'object patch' writes. (@noffle) - * small sharness test for promise failure checking (@whyrusleeping) - * sharness/Makefile: clean all BINS when cleaning (@chriscool) - -* Documentation - * Fix disconnect argument description (@richardlitt) - * Added a note about swarm disconnect (@richardlitt) - * Also fixed syntax for comment (@richardlitt) - * Alphabetized swarm subcmds (@richardlitt) - * Added note to ipfs stats bw interval option (@richardlitt) - * Small syntax changes to repo stat man (@richardlitt) - * update log command help text (@pfista) - * Added a long description to add (@richardlitt) - * Edited object patch set-data doc (@richardlitt) - * add roadmap.md (@Jeromy) - * Adds files api cmd to helptext (@noffle) - - -### 0.4.0 - 2016-04-05 - -This is a major release with plenty of new features and bugfixes. -It also includes breaking changes which make it incompatible with v0.3.x -on the networking layer. - -* Major Changes - * Multistream - * The addition of multistream is a breaking change on the networking layer, - but gives IPFS implementations the ability to mix and match different - stream multiplexers, e.g. yamux, spdystream, or muxado. - This adds a ton of flexibility on one of the lower layers of the protocol, - and will help us avoid further breaking protocol changes in the future. - * Files API - * The new `files` command and API allow a program to interact with IPFS - using familiar filesystem operations, namely: creating directories, - reading, writing, and deleting files, listing out different directories, - and so on. This feature enables any other application that uses a - filesystem-like backend for storage, to use IPFS as its storage driver - without having change the application logic at all. - * Gx - * go-ipfs now uses [gx](https://github.com/whyrusleeping/gx) to manage its - dependencies. This means that under the hood, go-ipfs's dependencies are - backed by IPFS itself! It also means that go-ipfs is no longer installed - using `go get`. Use `make install` instead. -* New Features - * Web UI - * Update to new version which is compatible with 0.4.0. (@dignifiedquire) - * Networking - * Implement uTP transport. (@whyrusleeping) - * Allow multiple addresses per configured bootstrap node. (@whyrusleeping) - * IPNS - * Improve IPNS resolution performance. (@whyrusleeping) - * Have dnslink prefer `TXT _dnslink.example.com`, allows usage of CNAME records. (@Kubuxu) - * Prevent `ipfs name publish` when `/ipns` is mounted. (@noffle) - * Repo - * Improve performance of `ipfs add`. (@whyrusleeping) - * Add `Datastore.NoSync` config option for flatfs. (@rht) - * Implement mark-and-sweep GC. (@whyrusleeping) - * Allow for GC during `ipfs add`. (@whyrusleeping) - * Add `ipfs repo stat` command. (@tmg, @diasdavid) - * General - * Add support for HTTP OPTIONS requests. (@lidel) - * Add `ipfs diag cmds` to view active API requests (@whyrusleeping) - * Add an `IPFS_LOW_MEM` environment variable which relaxes Bitswap's memory usage. (@whyrusleeping) - * The Docker image now lives at `ipfs/go-ipfs` and has been completely reworked. (@lgierth) -* Security fixes - * The gateway path prefix added in v0.3.10 was vulnerable to cross-site - scripting attacks. This release introduces a configurable list of allowed - path prefixes. It's called `Gateway.PathPrefixes` and takes a list of - strings, e.g. `["/blog", "/foo/bar"]`. The v0.3.x line will not receive any - further updates, so please update to v0.4.0 as soon as possible. (@lgierth) -* Incompatible Changes - * Install using `make install` instead of `go get` (@whyrusleeping) - * Rewrite pinning to store pins in IPFS objects. (@tv42) - * Bump fs-repo version to 3. (@whyrusleeping) - * Use multistream muxer (@whyrusleeping) - * The default for `--type` in `ipfs pin ls` is now `all`. (@chriscool) -* Bug Fixes - * Remove msgio double wrap. (@jbenet) - * Buffer msgio. (@whyrusleeping) - * Perform various fixes to the FUSE code. (@tv42) - * Compute `ipfs add` size in background to not stall add operation. (@whyrusleeping) - * Add option to have `ipfs add` include top-level hidden files. (@noffle) - * Fix CORS checks on the API. (@rht) - * Fix `ipfs update` error message. (@tomgg) - * Resolve paths in `ipfs pin rm` without network lookup. (@noffle) - * Detect FUSE unmounts and track mount state. (@noffle) - * Fix go1.6rc2 panic caused by CloseNotify being called from wrong goroutine. (@rwcarlsen) - * Bump DHT kvalue from 10 to 20. (@whyrusleeping) - * Put public key and IPNS entry to DHT in parallel. (@whyrusleeping) - * Fix panic in CLI argument parsing. (@whyrusleeping) - * Fix range error by using larger-than-zero-length buffer. (@noffle) - * Fix yamux hanging issue by increasing AcceptBacklog. (@whyrusleeping) - * Fix double Transport-Encoding header bug. (@whyrusleeping) - * Fix uTP panic and file descriptor leak. (@whyrusleeping) -* Tool Changes - * Add `--pin` option to `ipfs add`, which defaults to `true` and allows `--pin=false`. (@eminence) - * Add arguments to `ipfs pin ls`. (@chriscool) - * Add `dns` and `resolve` commands to read-only API. (@Kubuxu) - * Add option to display headers for `ipfs object links`. (@palkeo) -* General Codebase Changes - * Check Golang version in Makefile. (@chriscool) - * Improve Makefile. (@tomgg) - * Remove dead Jenkins CI code. (@lgierth) - * Add locking interface to blockstore. (@whyrusleeping) - * Add Merkledag FetchGraph and EnumerateChildren. (@whyrusleeping) - * Rename Lock/RLock to GCLock/PinLock. (@jbenet) - * Implement pluggable datastore types. (@tv42) - * Record datastore metrics for non-default datastores. (@tv42) - * Allow multistream to have zero-rtt stream opening. (@whyrusleeping) - * Refactor `ipnsfs` into a more generic and well tested `mfs`. (@whyrusleeping) - * Grab more peers if bucket doesn't contain enough. (@whyrusleeping) - * Use CloseNotify in gateway. (@whyrusleeping) - * Flatten multipart file transfers. (@whyrusleeping) - * Send updated DHT record fixes to peers who sent outdated records. (@whyrusleeping) - * Replace go-psutil with go-sysinfo. (@whyrusleeping) - * Use ServeContent for index.html. (@AtnNn) - * Refactor `object patch` API to not store data in URL. (@whyrusleeping) - * Use mfs for `ipfs add`. (@whyrusleeping) - * Add `Server` header to API responses. (@Kubuxu) - * Wire context directly into HTTP requests. (@rht) - * Wire context directly into GetDAG operations within GC. (@rht) - * Vendor libp2p using gx. (@whyrusleeping) - * Use gx vendored packages instead of Godeps. (@whyrusleeping) - * Simplify merkledag package interface to ease IPLD inclusion. (@mildred) - * Add default option value support to commands lib. (@whyrusleeping) - * Refactor merkledag fetching methods. (@whyrusleeping) - * Use net/url to escape paths within Web UI. (@noffle) - * Deprecated key.Pretty(). (@MichealMure) -* Documentation - * Fix and update help text for **every** `ipfs` command. (@RichardLitt) - * Change sample API origin settings from wildcard (`*`) to `example.com`. (@Kubuxu) - * Improve documentation of installation process in README. (@whyrusleeping) - * Improve windows.md. (@chriscool) - * Clarify instructions for installing from source. (@noffle) - * Make version checking more robust. (@jedahan) - * Assert the source code is located within GOPATH. (@whyrusleeping) - * Remove mentions of `/dns` from `ipfs dns` command docs. (@lgierth) -* Testing - * Refactor iptb tests. (@chriscool) - * Improve t0240 sharness test. (@chriscool) - * Make bitswap tests less flaky. (@whyrusleeping) - * Use TCP port zero for ipfs daemon in sharness tests. (@whyrusleeping) - * Improve sharness tests on AppVeyor. (@chriscool) - * Add a pause to fix timing on t0065. (@whyrusleeping) - * Add support for arbitrary TCP ports to t0060-daemon.sh. (@noffle) - * Make t0060 sharness test use TCP port zero. (@whyrusleeping) - * Randomized ipfs stress testing via randor (@dignifiedquire) - * Stress test pinning and migrations (@whyrusleeping) - -### 0.3.11 - 2016-01-12 - -This is the final ipfs version before the transition to v0.4.0. -It introduces a few stability improvements, bugfixes, and increased -test coverage. - -* Features - * Add 'get' and 'patch' to the allowed gateway commands (@whyrusleeping) - * Updated webui version (@dignifiedquire) - -* BugFixes - * Fix path parsing for add command (@djdv) - * namesys: Make paths with multiple segments work. Fixes #2059 (@Kubuxu) - * Fix up panic catching in http handler funcs (@whyrusleeping) - * Add correct access control headers to the default api config (@dignifiedquire) - * Fix closenotify by not sending empty file set (@whyrusleeping) - -* Tool Changes - * Have install.sh use the full path to ipfs binary if detected (@jedahan) - * Install daemon system-wide if on El Capitan (@jedahan) - * makefile: add -ldflags to install and nofuse tasks (@lgierth) - -* General Codebase - * Clean up http client code (@whyrusleeping) - * Move api version check to header (@rht) - -* Documentation - * Improved release checklist (@jbenet) - * Added quotes around command in long description (@RichardLitt) - * Added a shutdown note to daemon description (@RichardLitt) - -* Testing - * t0080: improve last tests (@chriscool) - * t0080: improve 'ipfs refs --unique' test (@chriscool) - * Fix t.Fatal usage in goroutines (@chriscool) - * Add docker testing support to sharness (@chriscool) - * sharness: add t0300-docker-image.sh (@chriscool) - * Included more namesys tests. (@Kubuxu) - * Add sharness test to verify requests look good (@whyrusleeping) - * Re-enable ipns sharness test now that iptb is fixed (@whyrusleeping) - * Force use of ipv4 in test (@whyrusleeping) - * Travis-CI: use go 1.5.2 (@jbenet) - -### 0.3.10 - 2015-12-07 - -This patch update introduces the 'ipfs update' command which will be used for -future ipfs updates along with a few other bugfixes and documentation -improvements. - - -* Features - * support for 'ipfs update' to call external binary (@whyrusleeping) - * cache ipns entries to speed things up a little (@whyrusleeping) - * add option to version command to print repo version (@whyrusleeping) - * Add in some more notifications to help profile queries (@whyrusleeping) - * gateway: add path prefix for directory listings (@lgierth) - * gateway: add CurrentCommit to /version (@lgierth) - -* BugFixes - * set data and links nil if not present (@whyrusleeping) - * fix log hanging issue, and implement close-notify for commands (@whyrusleeping) - * fix dial backoff (@whyrusleeping) - * proper ndjson implementation (@whyrusleeping) - * seccat: fix secio context (@lgierth) - * Add newline to end of the output for a few commands. (@nham) - * Add fixed period repo GC + test (@rht) - -* Tool Changes - * Allow `ipfs cat` on ipns path (@rht) - -* General Codebase - * rewrite of backoff mechanism (@whyrusleeping) - * refactor net code to use transports, in rough accordance with libp2p (@whyrusleeping) - * disable building fuse stuff on windows (@whyrusleeping) - * repo: remove Log config (@lgierth) - * commands: fix description of --api (@lgierth) - -* Documentation - * --help: Add a note on using IPFS_PATH to the footer of the helptext. (@sahib) - * Moved email juan to ipfs/contribute (@richardlitt) - * Added commit sign off section (@richardlitt) - * Added a security section (@richardlitt) - * Moved TODO doc to issue #1929 (@richardlitt) - -* Testing - * gateway: add tests for /version (@lgierth) - * Add gc auto test (@rht) - * t0020: cleanup dir with bad perms (@chriscool) - -Note: this commit introduces fixed-period repo gc, which will trigger gc -after a fixed period of time. This feature is introduced now, disabled by -default, and can be enabled with `ipfs daemon --enable-gc`. If all goes well, -in the future, it will be enabled by default. - -### 0.3.9 - 2015-10-30 - -This patch update includes a good number of bugfixes, notably, it fixes -builds on windows, and puts newlines between streaming json objects for a -proper ndjson format. - -* Features - * Writable gateway enabled again (@cryptix) - -* Bugfixes - * fix windows builds (@whyrusleeping) - * content type on command responses default to text (@whyrusleeping) - * add check to makefile to ensure windows builds don't fail silently (@whyrusleeping) - * put newlines between streaming json output objects (@whyrusleeping) - * fix streaming output to flush per write (@whyrusleeping) - * purposely fail builds pre go1.5 (@whyrusleeping) - * fix ipfs id (@whyrusleeping) - * fix a few race conditions in mocknet (@whyrusleeping) - * fix makefile failing when not in a git repo (@whyrusleeping) - * fix cli flag orders (long, short) (@rht) - * fix races in http cors (@miolini) - * small webui update (some bugfixes) (@jbenet) - -* Tool Changes - * make swarm connect return an error when it fails (@whyrusleeping) - * Add short flag for `ipfs ls --headers` (v for verbose) (@rht) - -* General Codebase - * bitswap: clean log printf and humanize dup data count (@cryptix) - * config: update pluto's peerID (@lgierth) - * config: update bootstrap list hostname (@lgierth) - -* Documentation - * Pared down contribute to link to new go guidelines (@richardlitt) - -* Testing - * t0010: add tests for 'ipfs commands --flags' (@chriscool) - * ipns_test: fix namesys.NewNameSystem() call (@chriscool) - * t0060: fail if no nc (@chriscool) - -### 0.3.8 - 2015-10-09 - -This patch update includes changes to make ipns more consistent and reliable, -symlink support in unixfs, mild performance improvements, new tooling features, -a plethora of bugfixes, and greatly improved tests. - -NOTICE: Version 0.3.8 also requires golang version 1.5.1 or higher. - -* Bugfixes - * refactor ipns to be more consistent and reliable (@whyrusleeping) - * fix 'ipfs refs' json output (@whyrusleeping) - * fix setting null config maps (@rht) - * fix output of dht commands (@whyrusleeping) - * fix NAT spam dialing (@whyrusleeping) - * fix random panics on 32 bit systems (@whyrusleeping) - * limit total number of network fd's (@whyrusleeping) - * fix http api content type (@WeMeetAgain) - * fix writing of api file for port zero daemons (@whyrusleeping) - * windows connection refused fixes (@mjanczyk) - * use go1.5's built in trailers, no more failures (@whyrusleeping) - * fix random bitswap hangs (@whyrusleeping) - * rate limit fd usage (@whyrusleeping) - * fix panic in bitswap ratelimiting (@whyrusleeping) - -* Tool Changes - * --empty-repo option for init (@prusnak) - * implement symlinks (@whyrusleeping) - * improve cmds lib files processing (@rht) - * properly return errors through commands (@whyrusleeping) - * bitswap unwant command (@whyrusleeping) - * tar add/cat commands (@whyrusleeping) - * fix gzip compression in get (@klauspost) - * bitswap stat logs wasted bytes (@whyrusleeping) - * resolve command now uses core.Resolve (@rht) - * add `--local` flag to 'name resolve' (@whyrusleeping) - * add `ipfs diag sys` command for debugging help (@whyrusleeping) - -* General Codebase - * improvements to dag editor (@whyrusleeping) - * swarm IPv6 in default config (Baptiste Jonglez) - * improve dir listing css (@rht) - * removed elliptic.P224 usage (@prusnak) - * improve bitswap providing speed (@jbenet) - * print panics that occur in cmds lib (@whyrusleeping) - * ipfs api check test fixes (@rht) - * update peerstream and datastore (@whyrusleeping) - * cleaned up tar-reader code (@jbenet) - * write context into coreunix.Cat (@rht) - * move assets to separate repo (@rht) - * fix proc/ctx wiring in bitswap (@jbenet) - * rabin fingerprinting chunker (@whyrusleeping) - * better notification on daemon ready (@rht) - * coreunix cat cleanup (@rht) - * extract logging into go-log (@whyrusleeping) - * blockservice.New no longer errors (@whyrusleeping) - * refactor ipfs get (@rht) - * readonly api on gateway (@rht) - * cleanup context usage all over (@rht) - * add xml decoding to 'object put' (@ForrestWeston) - * replace nodebuilder with NewNode method (@whyrusleeping) - * add metrics to http handlers (@lgierth) - * rm blockservice workers (@whyrusleeping) - * decompose maybeGzWriter (@rht) - * makefile sets git commit sha on build (@CaioAlonso) - -* Documentation - * add contribute file (@RichardLitt) - * add go devel guide to contribute.md (@whyrusleeping) - -* Testing - * fix mock notifs test (@whyrusleeping) - * test utf8 with object cmd (@chriscool) - * make mocknet conn close idempotent (@jbenet) - * fix fuse tests (@pnelson) - * improve sharness test quoting (@chriscool) - * sharness tests for chunker and add-cat (@rht) - * generalize peerid check in sharness (@chriscool) - * test_cmp argument cleanup (@chriscool) - -### 0.3.7 - 2015-08-02 - -This patch update fixes a problem we introduced in 0.3.6 and did not -catch: the webui failed to work with out-of-the-box CORS configs. -This has been fixed and now should work correctly. @jbenet - -### 0.3.6 - 2015-07-30 - -This patch improves the resource consumption of go-ipfs, -introduces a few new options on the CLI, and also -fixes (yet again) windows builds. - -* Resource consumption: - * fixed goprocess memory leak @rht - * implement batching on datastore @whyrusleeping - * Fix bitswap memory leak @whyrusleeping - * let bitswap ignore temporary write errors @whyrusleeping - * remove logging to disk in favor of api endpoint @whyrusleeping - * --only-hash option for add to skip writing to disk @whyrusleeping - -* Tool changes - * improved `ipfs daemon` output with all addresses @jbenet - * improved `ipfs id -f` output, added `` and `\n \t` support @jbenet - * `ipfs swarm addrs local` now shows the local node's addrs @jbenet - * improved config json parsing @rht - * improved Dockerfile to use alpine linux @Luzifer @lgierth - * improved bash completion @MichaelMure - * Improved 404 for gateway @cryptix - * add unixfs ls to list correct filesizes @wking - * ignore hidden files by default @gatesvp - * global --timeout flag @whyrusleeping - * fix random API failures by closing resp bodies @whyrusleeping - * ipfs swarm filters @whyrusleeping - * api returns errors in http trailers @whyrusleeping @jbenet - * `ipfs patch` learned to create intermediate nodes @whyrusleeping - * `ipfs object stat` now shows Hash @whyrusleeping - * `ipfs cat` now clears progressbar on exit @rht - * `ipfs add -w -r ` now wraps directories @jbenet - * `ipfs add -w ` now wraps with one dir @jbenet - * API + Gateway now support arbitrary HTTP Headers from config @jbenet - * API now supports CORS properly from config @jbenet - * **Deprecated:** `API_ORIGIN` env var (use config, see `ipfs daemon --help`) @jbenet - -* General Codebase - * `nofuse` tag for windows @Luzifer - * improved `ipfs add` code @gatesvp - * started requiring license trailers @chriscool @jbenet - * removed CtxCloser for goprocess @rht - * remove deadcode @lgierth @whyrusleeping - * reduced number of logging libs to 2 (soon to be 1) @rht - * dial address filtering @whyrusleeping - * prometheus metrics @lgierth - * new index page for gateway @krl @cryptix - * move ping to separate protocol @whyrusleeping - * add events to bitswap for a dashboard @whyrusleeping - * add latency and bandwidth options to mocknet @heems - * levenshtein distance cmd autosuggest @sbruce - * refactor/cleanup of cmds http handler @whyrusleeping - * cmds http stream reports errors in trailers @whyrusleeping - -* Bugfixes - * fixed path resolution and validation @rht - * fixed `ipfs get -C` output and progress bar @rht - * Fixed install pkg dist bug @jbenet @Luzifer - * Fix `ipfs get` silent failure @whyrusleeping - * `ipfs get` tarx no longer times out @jbenet - * `ipfs refs -r -u` is now correct @gatesvp - * Fix `ipfs add -w -r ` wrapping bugs @jbenet - * Fixed FUSE unmount failures @jbenet - * Fixed `ipfs log tail` command (api + cli) @whyrusleeping - -* Testing - * sharness updates @chriscool - * ability to disable secio for testing @jbenet - * fixed many random test failures, more reliable CI @whyrusleeping - * Fixed racey notifier failures @whyrusleeping - * `ipfs refs -r -u` test cases @jbenet - * Fix failing pinning test @jbenet - * Better CORS + Referer tests @jbenet - * Added reversible gc test @rht - * Fixed bugs in FUSE IPNS tests @whyrusleeping - * Fixed bugs in FUSE IPFS tests @jbenet - * Added `random-files` tool for easier sharness tests @jbenet - -* Documentation - * Add link to init system examples @slang800 - * Add CORS documentation to daemon init @carver (Note: this will change soon) - -### 0.3.5 - 2015-06-11 - -This patch improves overall stability and performance - -* added 'object patch' and 'object new' commands @whyrusleeping -* improved symmetric NAT avoidance @jbenet -* move util.Key to blocks.Key @whyrusleeping -* fix memory leak in provider store @whyrusleeping -* updated webui to 0.2.0 @krl -* improved bitswap performance @whyrusleeping -* update fuse lib @cryptix -* fix path resolution @wking -* implement test_seq() in sharness @chriscool -* improve parsing of stdin for commands @chriscool -* fix 'ipfs refs' failing silently @whyrusleeping -* fix serial dialing bug @jbenet -* improved testing @chriscool @rht @jbenet -* fixed domain resolving @luzifer -* fix parsing of unwanted stdin @lgierth -* added CORS handlers to gateway @NodeGuy -* added `ipfs daemon --unrestricted-api` option @krl -* general cleanup of dependencies - -### 0.3.4 - 2015-05-10 - -* fix ipns append bug @whyrusleeping -* fix out of memory panic @whyrusleeping -* add in expvar metrics @tv42 -* bitswap improvements @whyrusleeping -* fix write-cache in blockstore @tv42 -* vendoring cleanup @cryptix -* added `launchctl` plist for OSX @grncdr -* improved Dockerfile, changed root and mount paths @ehd -* improved `pin ls` output to show types @vitorbaptista - -### 0.3.3 - 2015-04-28 - -This patch update fixes various issues, in particular: -- windows support (0.3.0 had broken it) -- commandline parses spaces correctly. - -* much improved commandline parsing by @AtnNn -* improved dockerfile by @luzifer -* add cmd cleanup by @wking -* fix flatfs windows support by @tv42 and @gatesvp -* test case improvements by @chriscool -* ipns resolution timeout bug fix by @whyrusleeping -* new cluster tests with iptb by @whyrusleeping -* fix log callstack printing bug by @whyrusleeping -* document bash completion by @dylanPowers - -### 0.3.2 - 2015-04-22 - -This patch update implements multicast dns as well as fxing a few test issues. - -* implement mdns peer discovery @whyrusleeping -* fix mounting issues in sharness tests @chriscool - -### 0.3.1 - 2015-04-21 - -This patch update fixes a few bugs: - -* harden shutdown logic by @torarnv -* daemon locking fixes by @travisperson -* don't re-add entire dirs by @whyrusleeping -* tests now wait for graceful shutdown by @jbenet -* default key size is now 2048 by @jbenet - -### 0.3.0 - 2015-04-20 - -We've just released version 0.3.0, which contains many -performance improvements, bugfixes, and new features. -Perhaps the most noticeable change is moving block storage -from leveldb to flat files in the filesystem. - -What to expect: - -* _much faster_ performance - -* Repo format 2 - * moved default location from ~/.go-ipfs -> ~/.ipfs - * renamed lock filename daemon.lock -> repo.lock - * now using a flat-file datastore for local blocks - -* Fixed lots of bugs - * proper ipfs-path in various commands - * fixed two pinning bugs (recursive pins) - * increased yamux streams window (for speed) - * increased bitswap workers (+ env var) - * fixed memory leaks - * ipfs add error returns - * daemon exit bugfix - * set proper UID and GID on fuse mounts - -* Gateway - * Added support for HEAD requests - -* configuration - * env var to turn off SO_REUSEPORT: IPFS_REUSEPORT=false - * env var to increase bitswap workers: IPFS_BITSWAP_TASK_WORKERS=n - -* other - * bash completion is now available - * ipfs stats bw -- bandwidth meetering - -And many more things. - -### 0.2.3 - 2015-03-01 - -* Alpha Release - -### 2015-01-31: - -* bootstrap addresses now have .../ipfs/... in format - config file Bootstrap field changed accordingly. users - can upgrade cleanly with: - - ipfs bootstrap >boostrap_peers - ipfs bootstrap rm --all - - - ipfs bootstrap add - -ENV SRC_DIR /go-ipfs - -# Download packages first so they can be cached. -COPY go.mod go.sum $SRC_DIR/ -RUN cd $SRC_DIR \ - && go mod download - -COPY . $SRC_DIR - -# Build the thing. -# Also: fix getting HEAD commit hash via git rev-parse. -RUN cd $SRC_DIR \ - && mkdir .git/objects \ - && make build - -# Get su-exec, a very minimal tool for dropping privileges, -# and tini, a very minimal init daemon for containers -ENV SUEXEC_VERSION v0.2 -ENV TINI_VERSION v0.16.1 -RUN set -x \ - && cd /tmp \ - && git clone https://github.com/ncopa/su-exec.git \ - && cd su-exec \ - && git checkout -q $SUEXEC_VERSION \ - && make \ - && cd /tmp \ - && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini \ - && chmod +x tini - -# Get the TLS CA certificates, they're not provided by busybox. -RUN apt-get update && apt-get install -y ca-certificates - -# Install FUSE -RUN apt-get update && apt-get install -y fuse - -# Now comes the actual target image, which aims to be as small as possible. -FROM busybox:1-glibc -MAINTAINER Lars Gierth - -# Get the ipfs binary, entrypoint script, and TLS CAs from the build container. -ENV SRC_DIR /go-ipfs -COPY --from=0 $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs -COPY --from=0 $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs -COPY --from=0 /tmp/su-exec/su-exec /sbin/su-exec -COPY --from=0 /tmp/tini /sbin/tini -COPY --from=0 /bin/fusermount /usr/local/bin/fusermount -COPY --from=0 /etc/ssl/certs /etc/ssl/certs - -# Add suid bit on fusermount so it will run properly -RUN chmod 4755 /usr/local/bin/fusermount - -# This shared lib (part of glibc) doesn't seem to be included with busybox. -COPY --from=0 /lib/x86_64-linux-gnu/libdl-2.24.so /lib/libdl.so.2 - -# Swarm TCP; should be exposed to the public -EXPOSE 4001 -# Daemon API; must not be exposed publicly but to client services under you control -EXPOSE 5001 -# Web Gateway; can be exposed publicly with a proxy, e.g. as https://ipfs.example.org -EXPOSE 8080 -# Swarm Websockets; must be exposed publicly when the node is listening using the websocket transport (/ipX/.../tcp/8081/ws). -EXPOSE 8081 - -# Create the fs-repo directory and switch to a non-privileged user. -ENV IPFS_PATH /data/ipfs -RUN mkdir -p $IPFS_PATH \ - && adduser -D -h $IPFS_PATH -u 1000 -G users ipfs \ - && chown ipfs:users $IPFS_PATH - -# Create mount points for `ipfs mount` command -RUN mkdir /ipfs /ipns \ - && chown ipfs:users /ipfs /ipns - -# Expose the fs-repo as a volume. -# start_ipfs initializes an fs-repo if none is mounted. -# Important this happens after the USER directive so permission are correct. -VOLUME $IPFS_PATH - -# The default logging level -ENV IPFS_LOGGING "" - -# This just makes sure that: -# 1. There's an fs-repo, and initializes one if there isn't. -# 2. The API and Gateway are accessible from outside the container. -ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start_ipfs"] - -# Execute the daemon subcommand by default -CMD ["daemon", "--migrate=true"] diff --git a/vendor/github.com/ipfs/go-ipfs/Gopkg.lock b/vendor/github.com/ipfs/go-ipfs/Gopkg.lock deleted file mode 100644 index 37044d34..00000000 --- a/vendor/github.com/ipfs/go-ipfs/Gopkg.lock +++ /dev/null @@ -1,2642 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:2fab77e19256b26d733b70e1f68cd965cb87e38e3a619fa960cf319aef743d53" - name = "bazil.org/fuse" - packages = [ - ".", - "fs", - "fs/fstestutil", - "fuseutil", - ] - pruneopts = "UT" - revision = "65cc252bf6691cb3c7014bcb2c8dc29de91e3a7e" - -[[projects]] - branch = "master" - digest = "1:6716c9fe6333591128e72848f246fc01dc72240e1e64185d8b4e124e7280b35d" - name = "github.com/AndreasBriese/bbloom" - packages = ["."] - pruneopts = "UT" - revision = "e2d15f34fcf99d5dbb871c820ec73f710fca9815" - -[[projects]] - digest = "1:9f3b30d9f8e0d7040f729b82dcbc8f0dead820a133b3147ce355fc451f32d761" - name = "github.com/BurntSushi/toml" - packages = ["."] - pruneopts = "UT" - revision = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005" - version = "v0.3.1" - -[[projects]] - digest = "1:4a7be34ac4d3c56c039ece7d674236bde2d95f6adc93262cbb21d5b758566b15" - name = "github.com/Kubuxu/go-os-helper" - packages = ["."] - pruneopts = "UT" - revision = "3d3fc2fb493d8d889dddd5a4524283ac2faa4732" - version = "v0.0.1" - -[[projects]] - branch = "master" - digest = "1:c42df949106ee61667006128ed30161bea596cb773a94543bd2d8eec2f88fee5" - name = "github.com/Kubuxu/gocovmerge" - packages = ["."] - pruneopts = "UT" - revision = "7ecaa51963cdbbd985d4d0d8266fda9fab6680ca" - -[[projects]] - branch = "master" - digest = "1:166dc6852cbd78ca17b96e76b18f65853adf97989fcb14a0743f3aa6123f546b" - name = "github.com/OpenPeeDeeP/depguard" - packages = ["."] - pruneopts = "UT" - revision = "1f388ab2d81096755d25043aa729e2fb889f3dae" - -[[projects]] - digest = "1:bf67b338b8ad10f12e81c2f151d0be3246373c96681d06ba1312afe02d4e7fa4" - name = "github.com/Stebalien/go-bitfield" - packages = ["."] - pruneopts = "UT" - revision = "a911218965d225c9b5b8ba5e1a8ea539651ca036" - version = "v0.0.1" - -[[projects]] - digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" - name = "github.com/beorn7/perks" - packages = ["quantile"] - pruneopts = "UT" - revision = "4b2b341e8d7715fae06375aa633dbb6e91b3fb46" - version = "v1.0.0" - -[[projects]] - digest = "1:b6d886569181ec96ca83d529f4d6ba0cbf92ace7bb6f633f90c5f34d9bba7aab" - name = "github.com/blang/semver" - packages = ["."] - pruneopts = "UT" - revision = "ba2c2ddd89069b46a7011d4106f6868f17ee1705" - version = "v3.6.1" - -[[projects]] - branch = "master" - digest = "1:02796fed67c64543bfe3343b26cdc9a221bca2d83e8c7dcf35b5b70f6b5b9c56" - name = "github.com/bren2010/proquint" - packages = ["."] - pruneopts = "UT" - revision = "38337c27106d8f06e9b5cddc6df973ceece1c8ea" - -[[projects]] - branch = "master" - digest = "1:9e7c5138114ff9c51a60731b3a425c319305013c6ea8b3f60fd2435baba1a0db" - name = "github.com/btcsuite/btcd" - packages = ["btcec"] - pruneopts = "UT" - revision = "a0d1e3e36d50f61ee6eaab26d7bd246aae1f9ece" - -[[projects]] - digest = "1:c1100fc71e23b6a32b2c68a5202a848fd13811d5a10b12edb8019c3667d1cd9a" - name = "github.com/cenkalti/backoff" - packages = ["."] - pruneopts = "UT" - revision = "4b4cebaf850ec58f1bb1fec5bdebdf8501c2bc3f" - version = "v3.0.0" - -[[projects]] - digest = "1:f438d91be142877c3ad83157992c91de787ddfbddcc2a7da1ef6ef61606cadc4" - name = "github.com/cheekybits/genny" - packages = ["generic"] - pruneopts = "UT" - revision = "d2cf3cdd35ce0d789056c4bc02a4d6349c947caf" - version = "v1.0.0" - -[[projects]] - digest = "1:05ffeeed3f0f05520de0679f6aa3219ffee69cfd6d9fb6c194879d4c818ad670" - name = "github.com/coreos/go-semver" - packages = ["semver"] - pruneopts = "UT" - revision = "e214231b295a8ea9479f11b70b35d5acf3556d9b" - version = "v0.3.0" - -[[projects]] - digest = "1:5bdd0581421e643e6c3163bb5da785600a2d7d0d73fec58acebaf2e693868e9d" - name = "github.com/cskr/pubsub" - packages = ["."] - pruneopts = "UT" - revision = "65166f5ae403cbf6dcdced31e1f8f8ad95485cb3" - version = "v1.0.2" - -[[projects]] - branch = "master" - digest = "1:ff0db56095c10bcdbf92ce2503f1d0d6e2ee0615184cfb96db2907fcb08d454e" - name = "github.com/davidlazar/go-crypto" - packages = ["salsa20"] - pruneopts = "UT" - revision = "62389b5e4ae0188549f6bb2f4877e7a22a1c420d" - -[[projects]] - digest = "1:98436a9785f711ffee66f06265296dd36afd6e3dc532410c98a9051b5fd4c2f1" - name = "github.com/dgraph-io/badger" - packages = [ - ".", - "options", - "pb", - "skl", - "table", - "y", - ] - pruneopts = "UT" - revision = "0ce1d2e26af1ba8b8a72ea864145a3e1e3b382cd" - -[[projects]] - branch = "master" - digest = "1:6e8109ce247a59ab1eeb5330166c12735f6590de99c9647b6162d11518d32c9a" - name = "github.com/dgryski/go-farm" - packages = ["."] - pruneopts = "UT" - revision = "6a90982ecee230ff6cba02d5bd386acc030be9d3" - -[[projects]] - digest = "1:6f9339c912bbdda81302633ad7e99a28dfa5a639c864061f1929510a9a64aa74" - name = "github.com/dustin/go-humanize" - packages = ["."] - pruneopts = "UT" - revision = "9f541cc9db5d55bce703bd99987c9d5cb8eea45e" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:fffcae02150ef80950d18c721eaa249e6e80df5e0b9b645731949e586573f685" - name = "github.com/elgris/jsondiff" - packages = ["."] - pruneopts = "UT" - revision = "765b5c24c302e7c7fd032fdb8c69f101918229cb" - -[[projects]] - branch = "master" - digest = "1:c183111eaf02a9e6bb39c213bdfb5472b16f1955dd4c9dab82db83f114c64a63" - name = "github.com/facebookgo/atomicfile" - packages = ["."] - pruneopts = "UT" - revision = "2de1f203e7d5e386a6833233882782932729f27e" - -[[projects]] - digest = "1:938a2672d6ebbb7f7bc63eee3e4b9464c16ffcf77ec8913d3edbf32b4e3984dd" - name = "github.com/fatih/color" - packages = ["."] - pruneopts = "UT" - revision = "570b54cabe6b8eb0bc2dfce68d964677d63b5260" - version = "v1.5.0" - -[[projects]] - digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd" - name = "github.com/fsnotify/fsnotify" - packages = ["."] - pruneopts = "UT" - revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" - version = "v1.4.7" - -[[projects]] - digest = "1:b57b6448d97d626ca173056800c194c7cc7f1f6f6590eafd18fe86dfb434f080" - name = "github.com/go-critic/go-critic" - packages = [ - "checkers", - "checkers/internal/lintutil", - ] - pruneopts = "UT" - revision = "d7b3038bc7a1c35a1d02fdd7cf4094f0f1a12001" - version = "v0.3.4" - -[[projects]] - digest = "1:f12f53369294649f9d5046d1e8a40187ad36584201a9e1a135bf44589df1deb8" - name = "github.com/go-lintpack/lintpack" - packages = [ - ".", - "astwalk", - ] - pruneopts = "UT" - revision = "80adc0715ac409128d0b7212719896ad8d3444b7" - version = "v0.5.2" - -[[projects]] - digest = "1:b9a8d81ce273b216a3ad70ff95d98179ec2f5392523a9a305b3e38c70ca9d361" - name = "github.com/go-toolsmith/astcast" - packages = ["."] - pruneopts = "UT" - revision = "a6cb19f07b66b859a53f3f2be6e4c3bba892db7e" - version = "v1.0.0" - -[[projects]] - digest = "1:bd091673b35859ad8f831a5b3c961805e108be72d0778b9d07fd383e59ab4287" - name = "github.com/go-toolsmith/astcopy" - packages = ["."] - pruneopts = "UT" - revision = "245af3020944a15e09072c8ad3883c1451d1fdef" - version = "v1.0.0" - -[[projects]] - digest = "1:db8123e0896cf805cb30c7bacad0b1a1d562edbbcd2a765ceda1af926c9a99a4" - name = "github.com/go-toolsmith/astequal" - packages = ["."] - pruneopts = "UT" - revision = "dcb477bfacd6e00a13c6d63bfc73db28dd343160" - version = "v1.0.0" - -[[projects]] - digest = "1:1ef70bd4e2d06e76470c3cb43b89020201dcb0b4a409d9a961df77cfaf5ae3a8" - name = "github.com/go-toolsmith/astfmt" - packages = ["."] - pruneopts = "UT" - revision = "0d74c731079884bda287cf8df9ce7b92e688af8c" - version = "v1.0.0" - -[[projects]] - digest = "1:f2def520d33d9ba100161b0d2101f98b2104e62bafd3e45ae5deca271ac84000" - name = "github.com/go-toolsmith/astp" - packages = ["."] - pruneopts = "UT" - revision = "6373270dee65bfb0479f2acd16d4c8e9d5db13f8" - version = "v1.0.0" - -[[projects]] - digest = "1:aba9fa7c6dacad505e95d984ec0b07f6b5a4691ed2f4ff36c7b732b3704627a3" - name = "github.com/go-toolsmith/strparse" - packages = ["."] - pruneopts = "UT" - revision = "830b6daa1241714c12a9b9a4a56849fe2f93aedc" - version = "v1.0.0" - -[[projects]] - digest = "1:a51f9845b0dec6e372e229395e019cab7c032711c6ca3ec1895a58bfdf760962" - name = "github.com/go-toolsmith/typep" - packages = ["."] - pruneopts = "UT" - revision = "cab1745ffd84a567b524317c7f90e96755b18fcf" - version = "v1.0.0" - -[[projects]] - digest = "1:9ae31ce33b4bab257668963e844d98765b44160be4ee98cafc44637a213e530d" - name = "github.com/gobwas/glob" - packages = [ - ".", - "compiler", - "match", - "syntax", - "syntax/ast", - "syntax/lexer", - "util/runes", - "util/strings", - ] - pruneopts = "UT" - revision = "5ccd90ef52e1e632236f7326478d4faa74f99438" - version = "v0.2.3" - -[[projects]] - digest = "1:d0e00c8ccabdfe678667d6be78c9d08a6a4efc36d9fb596f098706728b00ba6b" - name = "github.com/gogo/protobuf" - packages = [ - "gogoproto", - "io", - "proto", - "protoc-gen-gogo/descriptor", - ] - pruneopts = "UT" - revision = "ba06b47c162d49f2af050fb4c75bcbc86a159d5c" - version = "v1.2.1" - -[[projects]] - digest = "1:be408f349cae090a7c17a279633d6e62b00068e64af66a582cae0983de8890ea" - name = "github.com/golang/mock" - packages = ["gomock"] - pruneopts = "UT" - revision = "9fa652df1129bef0e734c9cf9bf6dbae9ef3b9fa" - version = "1.3.1" - -[[projects]] - digest = "1:318f1c959a8a740366fce4b1e1eb2fd914036b4af58fbd0a003349b305f118ad" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "UT" - revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" - version = "v1.3.1" - -[[projects]] - digest = "1:e4f5819333ac698d294fe04dbf640f84719658d5c7ce195b10060cc37292ce79" - name = "github.com/golang/snappy" - packages = ["."] - pruneopts = "UT" - revision = "2a8bb927dd31d8daada140a5d09578521ce5c36a" - version = "v0.0.1" - -[[projects]] - branch = "master" - digest = "1:c173565780edcf5d43c5f983be0e9085266764465422d4ad230355abd2e0d252" - name = "github.com/golangci/check" - packages = [ - "cmd/structcheck", - "cmd/varcheck", - ] - pruneopts = "UT" - revision = "cfe4005ccda277a820149d44d6ededc400cc99a2" - -[[projects]] - branch = "master" - digest = "1:efb8cf3f0c2f47844104d6e879fc77d846649df794e378cae50e749fad1bb1dc" - name = "github.com/golangci/dupl" - packages = [ - ".", - "job", - "printer", - "suffixtree", - "syntax", - "syntax/golang", - ] - pruneopts = "UT" - revision = "3e9179ac440a0386ac7cc9a085fc44397c6b9bbc" - -[[projects]] - branch = "master" - digest = "1:f1761ff12ebf63f70390733f5804434f9b323996816cb9cddbb7041279872bcb" - name = "github.com/golangci/errcheck" - packages = [ - "golangci", - "internal/errcheck", - ] - pruneopts = "UT" - revision = "ef45e06d44b6e018d817c16c762d448990adc5e0" - -[[projects]] - branch = "master" - digest = "1:f63d85b6e551b6c8aa3ed2e42b64db15f5b525bdb01fa36af18288f1de4c859b" - name = "github.com/golangci/go-misc" - packages = ["deadcode"] - pruneopts = "UT" - revision = "927a3d87b613e9f6f0fb7ef8bb8de8b83c30a5a2" - -[[projects]] - branch = "master" - digest = "1:cc3a79e8819804582643d37b0664f3fa501dd0b6be958ebe77677e2f69aaba95" - name = "github.com/golangci/go-tools" - packages = [ - "arg", - "callgraph", - "callgraph/static", - "config", - "deprecated", - "functions", - "internal/sharedcheck", - "lint", - "lint/lintdsl", - "lint/lintutil", - "lint/lintutil/format", - "simple", - "ssa", - "ssa/ssautil", - "ssautil", - "staticcheck", - "staticcheck/vrp", - "stylecheck", - "unused", - "version", - ] - pruneopts = "UT" - revision = "35a9f45a5db090b0227d692d823151104cd695fa" - -[[projects]] - branch = "master" - digest = "1:e1b9fbecb1d985f291dbca59767070fe899f38d1b40f7e9433f9a42b7fb3bd4e" - name = "github.com/golangci/goconst" - packages = ["."] - pruneopts = "UT" - revision = "041c5f2b40f3dd334a4a6ee6a3f84ca3fc70680a" - -[[projects]] - branch = "master" - digest = "1:431fd101ab780d1916262a582e241d01cbcbca10f7d85ebdd4ba339b8485483e" - name = "github.com/golangci/gocyclo" - packages = ["pkg/gocyclo"] - pruneopts = "UT" - revision = "0a533e8fa43d6605069e94f455bf9d79d4b8ea8c" - -[[projects]] - branch = "master" - digest = "1:66fcab6100e2be1bb31ae5494a0eb928690e2a4bf739d44eb2923ac7dd687e03" - name = "github.com/golangci/gofmt" - packages = [ - "gofmt", - "goimports", - ] - pruneopts = "UT" - revision = "0b8337e80d98f7eec18e4504a4557b34423fd039" - -[[projects]] - digest = "1:959d250b56bb86b3a6a6b8a4f97749c90a68187f2bbce59888de884117dce849" - name = "github.com/golangci/golangci-lint" - packages = [ - "cmd/golangci-lint", - "pkg/commands", - "pkg/config", - "pkg/exitcodes", - "pkg/fsutils", - "pkg/golinters", - "pkg/golinters/goanalysis", - "pkg/golinters/goanalysis/checker", - "pkg/golinters/goanalysis/passes/nilness", - "pkg/goutil", - "pkg/lint", - "pkg/lint/astcache", - "pkg/lint/linter", - "pkg/lint/lintersdb", - "pkg/logutils", - "pkg/packages", - "pkg/printers", - "pkg/report", - "pkg/result", - "pkg/result/processors", - "pkg/timeutils", - ] - pruneopts = "UT" - revision = "4ba2155996359eabd8800d1fbf3e3a9777c80490" - version = "v1.17.1" - -[[projects]] - branch = "master" - digest = "1:bf573d0637989470dee90e11a6ea87b5de1ddb7a435334b80656b0df05b0630b" - name = "github.com/golangci/gosec" - packages = [ - ".", - "rules", - ] - pruneopts = "UT" - revision = "8afd9cbb6cfb34a3b4d4d5711bafdc6640ae892f" - -[[projects]] - branch = "master" - digest = "1:3a5ea92f78579dfd319260ce995575c07890c8aff429035637287a00da664647" - name = "github.com/golangci/ineffassign" - packages = ["."] - pruneopts = "UT" - revision = "2ee8f2867dde308c46d401d6d30f6c644094b167" - -[[projects]] - branch = "master" - digest = "1:3919f284dcb91eca214603fb11ba9a9d5b020975b577b2c85c541ac3d40fa114" - name = "github.com/golangci/lint-1" - packages = ["."] - pruneopts = "UT" - revision = "d2cdd8c0821928c61cb0903441f8b35457a98a61" - -[[projects]] - branch = "master" - digest = "1:8665edfb3c5371fbac9820d127fa0d9aed813cc2349a27a7d16064dd89fed146" - name = "github.com/golangci/maligned" - packages = ["."] - pruneopts = "UT" - revision = "b1d89398deca2fd3f8578e5a9551e819bd01ca5f" - -[[projects]] - digest = "1:73dfedbcb6b348638ef0066766a9e7d8f6cfc5cfcb3a8e00ceb631a4bca73cf1" - name = "github.com/golangci/misspell" - packages = ["."] - pruneopts = "UT" - revision = "b90dc15cfd220ecf8bbc9043ecb928cef381f011" - version = "v0.3.4" - -[[projects]] - branch = "master" - digest = "1:6bc38b03a76ac4ce44482b437c6a31ec441e494abd271d63722f99ac2e7e9e80" - name = "github.com/golangci/prealloc" - packages = ["."] - pruneopts = "UT" - revision = "215b22d4de21190b80ce05e7d8466677c1aa3223" - -[[projects]] - branch = "master" - digest = "1:6bea17ec2cee4996145d70cffbee98330adc2bfc24107373953a250abca159ff" - name = "github.com/golangci/revgrep" - packages = ["."] - pruneopts = "UT" - revision = "276a5c0a103935ee65af49afc254a65335bf1fcf" - -[[projects]] - branch = "master" - digest = "1:c553e7c7483f2d6db1e84a27a18df144ed4041792d7556916369f86ccf5409fe" - name = "github.com/golangci/unconvert" - packages = ["."] - pruneopts = "UT" - revision = "28b1c447d1f4a810737ee6ab40ea6c1d0ceae4ad" - -[[projects]] - digest = "1:582b704bebaa06b48c29b0cec224a6058a09c86883aaddabde889cd1a5f73e1b" - name = "github.com/google/uuid" - packages = ["."] - pruneopts = "UT" - revision = "0cd6bf5da1e1c83f8b45653022c74f71af0538a4" - version = "v1.1.1" - -[[projects]] - digest = "1:7b5c6e2eeaa9ae5907c391a91c132abfd5c9e8a784a341b5625e750c67e6825d" - name = "github.com/gorilla/websocket" - packages = ["."] - pruneopts = "UT" - revision = "66b9c49e59c6c48f0ffce28c2d8b8a5678502c6d" - version = "v1.4.0" - -[[projects]] - branch = "master" - digest = "1:6c612dcf6342c70b413171db9caa4eb6d64298ac92be7142d5f8757792bd0045" - name = "github.com/gostaticanalysis/analysisutil" - packages = ["."] - pruneopts = "UT" - revision = "56bca42c76353df8b3e08af308c2e3b915bdc4c2" - -[[projects]] - digest = "1:7efe48dea4db6b35dcc15e15394b627247e5b3fb814242de986b746ba8e0abf0" - name = "github.com/gxed/go-shellwords" - packages = ["."] - pruneopts = "UT" - revision = "02e3cf038dcea8290e44424da473dd12be796a8a" - version = "v1.0.3" - -[[projects]] - digest = "1:0ade334594e69404d80d9d323445d2297ff8161637f9b2d347cc6973d2d6f05b" - name = "github.com/hashicorp/errwrap" - packages = ["."] - pruneopts = "UT" - revision = "8a6fb523712970c966eefc6b39ed2c5e74880354" - version = "v1.0.0" - -[[projects]] - digest = "1:f668349b83f7d779567c880550534addeca7ebadfdcf44b0b9c39be61864b4b7" - name = "github.com/hashicorp/go-multierror" - packages = ["."] - pruneopts = "UT" - revision = "886a7fbe3eb1c874d46f623bfa70af45f425b3d1" - version = "v1.0.0" - -[[projects]] - digest = "1:d15ee511aa0f56baacc1eb4c6b922fa1c03b38413b6be18166b996d82a0156ea" - name = "github.com/hashicorp/golang-lru" - packages = [ - ".", - "simplelru", - ] - pruneopts = "UT" - revision = "7087cb70de9f7a8bc0a10c375cb0d2280a8edf9c" - version = "v0.5.1" - -[[projects]] - digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/printer", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token", - ] - pruneopts = "UT" - revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" - version = "v1.0.0" - -[[projects]] - digest = "1:541a489631d4084ea2b619e0edd3f8eb7e3858cd8725dd0239a361798863672e" - name = "github.com/hsanjuan/go-libp2p-http" - packages = ["."] - pruneopts = "UT" - revision = "9b0da0751e81069747a272ede6c1248394cbb560" - version = "v0.1.2" - -[[projects]] - digest = "1:c00cc6d95a674b4b923ac069d364445043bc67836e9bd8aeff8440cfbe6a2cc7" - name = "github.com/huin/goupnp" - packages = [ - ".", - "dcps/internetgateway1", - "dcps/internetgateway2", - "httpu", - "scpd", - "soap", - "ssdp", - ] - pruneopts = "UT" - revision = "656e61dfadd241c7cbdd22a023fa81ecb6860ea8" - version = "v1.0.0" - -[[projects]] - digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" - name = "github.com/inconshreveable/mousetrap" - packages = ["."] - pruneopts = "UT" - revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" - version = "v1.0" - -[[projects]] - digest = "1:fe9aa4ac8c8d9bf5eaec1a8dd8c029f2cecd1c4ad91072b7ac99ecb44ff66910" - name = "github.com/ipfs/bbloom" - packages = ["."] - pruneopts = "UT" - revision = "4492942caf937893b9cf1ebba71c297beda904b2" - version = "v0.0.1" - -[[projects]] - digest = "1:014f43937a01f4140d5c32584836c86dd1c6e524bf56e1b402d842a9d78eb652" - name = "github.com/ipfs/dir-index-html" - packages = ["."] - pruneopts = "UT" - revision = "76b6774a477fe6263d445972fe176f3f3b4ea176" - version = "v1.0.3" - -[[projects]] - digest = "1:01c18b3edc5ca147f9136e937ff4095aa1808bc51772e133273666ea069699bc" - name = "github.com/ipfs/go-bitswap" - packages = [ - ".", - "decision", - "getter", - "message", - "message/pb", - "messagequeue", - "network", - "notifications", - "peermanager", - "providerquerymanager", - "session", - "sessionmanager", - "sessionpeermanager", - "sessionrequestsplitter", - "wantlist", - "wantmanager", - ] - pruneopts = "UT" - revision = "1b921d216899ca84abc6a904efd2cbca77a67f65" - version = "v0.1.1" - -[[projects]] - digest = "1:97b7b1549d94c885626167359549d9164bb35a9a584faa7c3a576909be0ea37f" - name = "github.com/ipfs/go-block-format" - packages = ["."] - pruneopts = "UT" - revision = "9e46c0dce5d9a041b8ea1eed8ca924b36355c61b" - version = "v0.0.2" - -[[projects]] - digest = "1:4de47245d5ec315fb9c8f7aa3b0f2d19fb6df0cf33bf1cdb25673c6110fe4d95" - name = "github.com/ipfs/go-blockservice" - packages = ["."] - pruneopts = "UT" - revision = "4815cb7459d447756e8783e26a86dc8e1bfed774" - version = "v0.1.0" - -[[projects]] - digest = "1:664cf1fc1e6ec05988cc6b8f52a61fca914279a92dcd0bc1b8be5507fb3b0c8a" - name = "github.com/ipfs/go-cid" - packages = ["."] - pruneopts = "UT" - revision = "b1cc3e404d48791056147f118ea7e7ea94eb946f" - version = "v0.0.2" - -[[projects]] - digest = "1:b8b8567077bb9d92b85b2411d5e5a9bb79e79ce3a620f094931b909d6845328a" - name = "github.com/ipfs/go-cidutil" - packages = [ - ".", - "cid-fmt", - "cidenc", - ] - pruneopts = "UT" - revision = "fdf58ea0da03b6087e14bcce352303c1c0bad32d" - version = "v0.0.2" - -[[projects]] - digest = "1:079436f26cbece7e60cf4b4b851794a65dd5f360579b2f27a05415c70478dfb4" - name = "github.com/ipfs/go-datastore" - packages = [ - ".", - "autobatch", - "keytransform", - "mount", - "namespace", - "query", - "retrystore", - "sync", - ] - pruneopts = "UT" - revision = "aa9190c18f1576be98e974359fd08c64ca0b5a94" - version = "v0.0.5" - -[[projects]] - digest = "1:77f64288e27bdc74a4937129006037f89ea08ec55a0822531a9a76050f904528" - name = "github.com/ipfs/go-detect-race" - packages = ["."] - pruneopts = "UT" - revision = "52daa73989bc95b2fa97d6c610adf62d04eb7822" - version = "v0.0.1" - -[[projects]] - digest = "1:8270de0224f4c8ef01e23463a6c6f2a5026a2d3ccf3f2e3145ffcd67d7b9a62c" - name = "github.com/ipfs/go-ds-badger" - packages = ["."] - pruneopts = "UT" - revision = "7fe0af0808f565d460fa8d3851a5808d77f72628" - version = "v0.0.3" - -[[projects]] - digest = "1:f896dc92ae70c70f57ac8d47c0aa3e9fe185afcc35ee807975a621766ee6028f" - name = "github.com/ipfs/go-ds-flatfs" - packages = ["."] - pruneopts = "UT" - revision = "d5e3c1fa14d2fcc187a4a996eea3f48de9d7a5cd" - version = "v0.0.2" - -[[projects]] - digest = "1:ab70bd10c780d127a66393a14061ae69ae0145027e7207b7c43db68524f3f64a" - name = "github.com/ipfs/go-ds-leveldb" - packages = ["."] - pruneopts = "UT" - revision = "47a9627082eeb3e52570a75eb4fdfaff8b2f19a9" - version = "v0.0.2" - -[[projects]] - digest = "1:afbc88b3730097cd76ea72695941270547a5b3ed00d870ee0612897ac9943d79" - name = "github.com/ipfs/go-ds-measure" - packages = ["."] - pruneopts = "UT" - revision = "a74729db656decb31c9d0546aef893eaeb4247f7" - version = "v0.0.1" - -[[projects]] - digest = "1:bc3ed1378495622fd5eba7b63c86c10af1e5c4c1ae8642ab85b994ed89cf08bf" - name = "github.com/ipfs/go-fs-lock" - packages = ["."] - pruneopts = "UT" - revision = "66f8794e4aed94004486434cf8bf815e5991a0a4" - version = "v0.0.1" - -[[projects]] - digest = "1:429edc38cba9210059680d94ed67a8552632025635e666e112313986de135d74" - name = "github.com/ipfs/go-ipfs-blockstore" - packages = ["."] - pruneopts = "UT" - revision = "8d6a694a33d2729a94d848208c75d117b77c3492" - version = "v0.0.1" - -[[projects]] - digest = "1:25b55cfa6c762a2623c5b50b76e021c48c293e983cd38890f885e2f8d8a216c6" - name = "github.com/ipfs/go-ipfs-blocksutil" - packages = ["."] - pruneopts = "UT" - revision = "11463846b576c51999afeedd9a0eacda8b5cb2c4" - version = "v0.0.1" - -[[projects]] - digest = "1:cf743f8296553603264f68ae79fbd0ed9ce25636c28deedde111d6760b8b0c7d" - name = "github.com/ipfs/go-ipfs-chunker" - packages = ["."] - pruneopts = "UT" - revision = "ecef6090e78f549c5f48f18d398e7b7f97e8c32d" - version = "v0.0.1" - -[[projects]] - digest = "1:50f399a26a1a675a8d1709f69aafaee8b5a7d51d678902c98285d02197ea829e" - name = "github.com/ipfs/go-ipfs-cmds" - packages = [ - ".", - "cli", - "http", - ] - pruneopts = "UT" - revision = "6069424baf71e64d6075836733f34a6f9afba22d" - version = "v0.0.10" - -[[projects]] - digest = "1:4751a46363a69f324ef4ed1ef60e24a2f8d74c1b4de8672f094b9329a785ef18" - name = "github.com/ipfs/go-ipfs-config" - packages = [ - ".", - "serialize", - ] - pruneopts = "UT" - revision = "4a51393611d9580d17ecbccb0c4aec5eb81f21ce" - source = "github.com/vulcanize/go-ipfs-config" - -[[projects]] - digest = "1:ae1ee4c628ee8ad66d9505bb2685902c93e0cd89089a17b8804463b5cc1b766b" - name = "github.com/ipfs/go-ipfs-delay" - packages = ["."] - pruneopts = "UT" - revision = "6482ad624d0b4f4053563439f8ca0bd619fbc737" - version = "v0.0.1" - -[[projects]] - digest = "1:0fcfbb9a7c8245d19d5a79c13ad702201c1d9cd8ca79619379a22845de723278" - name = "github.com/ipfs/go-ipfs-ds-help" - packages = ["."] - pruneopts = "UT" - revision = "4a69beb72c1b4e6e7ed62c5c5cbc1bd7a3d219b2" - version = "v0.0.1" - -[[projects]] - digest = "1:c8bc4cbd7b94d84784f6f99cca35ebedebb5f9ded2d561e4130d8c67cc5127b0" - name = "github.com/ipfs/go-ipfs-exchange-interface" - packages = ["."] - pruneopts = "UT" - revision = "b6e88260772433e18af18bb3f237d78678e65f0b" - version = "v0.0.1" - -[[projects]] - digest = "1:284cfd2a17692d0e628a263854b8acea34427b9aa2f4f923b91570f07ae65d2e" - name = "github.com/ipfs/go-ipfs-exchange-offline" - packages = ["."] - pruneopts = "UT" - revision = "e3705b31117ceccfa67820f84c1085f74f5e039b" - version = "v0.0.1" - -[[projects]] - digest = "1:2f4c34c23f57eadaea0a620386dcc691e83f44cc52fb8163f53695e7aa3fbae4" - name = "github.com/ipfs/go-ipfs-files" - packages = ["."] - pruneopts = "UT" - revision = "cf8456081cd5fd17ae1716c5fdff7d4cfba1bbb2" - version = "v0.0.3" - -[[projects]] - digest = "1:990c3a92954ef12159a3564533e63edc53feeadcb513930250351b919c6756f5" - name = "github.com/ipfs/go-ipfs-posinfo" - packages = ["."] - pruneopts = "UT" - revision = "19b0f52f6bd140be93fb568203586a165eb1aadf" - version = "v0.0.1" - -[[projects]] - digest = "1:3d6b825f2ac90788f3ac6bb7927d339ded21d02951d08b5bb66bf5326af45ea9" - name = "github.com/ipfs/go-ipfs-pq" - packages = ["."] - pruneopts = "UT" - revision = "63128f5dd36a6c20c0f2d1c65eb4390d2590a273" - version = "v0.0.1" - -[[projects]] - digest = "1:962e8c6b42e9c2d36bbdb2e55a4cc893f7faec22da7de71c634090b96a87a4d6" - name = "github.com/ipfs/go-ipfs-routing" - packages = [ - "mock", - "none", - "offline", - ] - pruneopts = "UT" - revision = "d508458cea98e199ae7b84029b627ceb9e5db660" - version = "v0.1.0" - -[[projects]] - digest = "1:0b4439ae69776549e6489b261f66894a1390140dad53f1c3b1fbfc074478590d" - name = "github.com/ipfs/go-ipfs-util" - packages = ["."] - pruneopts = "UT" - revision = "a4bb5361e49427531f9a716ead2ce4bd9bdd7959" - version = "v0.0.1" - -[[projects]] - digest = "1:b67b5b49a303fbef8d0c30958b41754068898b0084813cf9021cc9ecd7e4c7e4" - name = "github.com/ipfs/go-ipld-cbor" - packages = [ - ".", - "encoding", - ] - pruneopts = "UT" - revision = "c084f45ab421fae38c99d98ce7aca9ca5ae85af3" - version = "v0.0.2" - -[[projects]] - digest = "1:60006152d40763463546fc6db3e21a223d9a1a5dedb6554bbe6d1679ae1bf7b3" - name = "github.com/ipfs/go-ipld-format" - packages = ["."] - pruneopts = "UT" - revision = "c8bb359ca21e831187139329dd4da249abc95602" - version = "v0.0.2" - -[[projects]] - digest = "1:fe257dab08c7455ab2afb1836d9933f09719d53e16c61df9a2e23316798ccfc2" - name = "github.com/ipfs/go-ipld-git" - packages = ["."] - pruneopts = "UT" - revision = "ee620e932c0cf00124e7c1c6f434eb89530caaf8" - version = "v0.0.2" - -[[projects]] - digest = "1:4638b57014e4a204350087e3a2d5631f8aaa197bb6af688ca6e280457a7a46fa" - name = "github.com/ipfs/go-ipns" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "a989b48e3b7d32af1c872cbf2f6e884a08a9b351" - version = "v0.0.1" - -[[projects]] - digest = "1:e8c78569402b8dcf846924dea6eb27b1de135c9a53d7adbd2629250ef66c021a" - name = "github.com/ipfs/go-log" - packages = [ - ".", - "tracer", - "tracer/wire", - "writer", - ] - pruneopts = "UT" - revision = "91b837264c0f35dd4e2be341d711316b91d3573d" - version = "v0.0.1" - -[[projects]] - digest = "1:1347cc59745de60dcec6e00aec552d654d0efa72b119cd3a92967b8a69a6ff47" - name = "github.com/ipfs/go-merkledag" - packages = [ - ".", - "pb", - "test", - ] - pruneopts = "UT" - revision = "e0c97528b5888969361ca8c0826e79944ea40682" - version = "v0.1.0" - -[[projects]] - digest = "1:2de37461901377cb21aae96aab4ca67ebbb6d77e5f140c8f376eb566b7805365" - name = "github.com/ipfs/go-metrics-interface" - packages = ["."] - pruneopts = "UT" - revision = "87aa106f53272f064ca7956a6db83f17a553f254" - version = "v0.0.1" - -[[projects]] - digest = "1:c78afe3d1578551c86f287fdac8fb883ae34b545084fa9b7d8f6cfb7a73e730f" - name = "github.com/ipfs/go-metrics-prometheus" - packages = ["."] - pruneopts = "UT" - revision = "8f6977cb23506737d1177332bd0b91a2352bcb98" - version = "v0.0.2" - -[[projects]] - digest = "1:87b290476fd7fbd45a38d7e2608ac51562d075cb7e709425cb1a060cf71fbf9a" - name = "github.com/ipfs/go-mfs" - packages = ["."] - pruneopts = "UT" - revision = "bb73cf40769a3306b932f156365f7e7662719fd2" - version = "v0.1.0" - -[[projects]] - digest = "1:78c440f94312bb5181ef6fdebf54ed91c7c115f6e79010aa5e513fdc9a7e3ddd" - name = "github.com/ipfs/go-path" - packages = [ - ".", - "resolver", - ] - pruneopts = "UT" - revision = "466e1ce7a7073faa0af3af8cd95c914ff1b1e945" - version = "v0.0.7" - -[[projects]] - digest = "1:d0b359ab95f5abe4d17eae347b5a2270912e728eaaa9826e6371c8a3d5325fff" - name = "github.com/ipfs/go-peertaskqueue" - packages = [ - ".", - "peertask", - "peertracker", - ] - pruneopts = "UT" - revision = "98cd87e43d9738e3409c0fbf44c9613b1f455207" - version = "v0.1.0" - -[[projects]] - digest = "1:5d5961815f8e4f1fbad28f6c7ff5e42fcd9527aa823a5daa19b622b9cc41d1ed" - name = "github.com/ipfs/go-todocounter" - packages = ["."] - pruneopts = "UT" - revision = "bc75efcf13e6e50fbba27679ba5451585d70c954" - version = "v0.0.1" - -[[projects]] - digest = "1:42a537f668fb79eeb79cd951d6459dd3eb8fba72a914ac15eda3a7cb1d5d2548" - name = "github.com/ipfs/go-unixfs" - packages = [ - ".", - "file", - "hamt", - "importer", - "importer/balanced", - "importer/helpers", - "importer/trickle", - "io", - "mod", - "pb", - ] - pruneopts = "UT" - revision = "5fc20dbc340ea48f74d111d139b2d539d8ffa3c0" - version = "v0.0.8" - -[[projects]] - digest = "1:78438260483c355139f9d83830a88ecd69578904f0f288134d3a95786c4f0864" - name = "github.com/ipfs/go-verifcid" - packages = ["."] - pruneopts = "UT" - revision = "34e41ba962e7ce0211a05915f788486c8db755f1" - version = "v0.0.1" - -[[projects]] - digest = "1:67444125b68f4adc123856dec40308ff0ef9b01f4b6c9a935f57dae78f2d3340" - name = "github.com/ipfs/hang-fds" - packages = ["."] - pruneopts = "UT" - revision = "7a8a28f4b275d193ef56fc921f61f68b4e8d64d0" - version = "v0.0.1" - -[[projects]] - digest = "1:49a5b375c716393e801f42bd704a07f2affa1b99e00e6431bbf012e08ef25af4" - name = "github.com/ipfs/interface-go-ipfs-core" - packages = [ - ".", - "options", - "options/namesys", - "path", - "tests", - ] - pruneopts = "UT" - revision = "f77aa7ee2c521ce3361de11b4e257b01f28f8db0" - version = "v0.1.0" - -[[projects]] - digest = "1:da000e612bc16400a8a0c53dda5b78c401fd7851e7b30a977a3087e7d36d80fc" - name = "github.com/ipfs/iptb" - packages = [ - "cli", - "commands", - "testbed", - "testbed/interfaces", - "util", - ] - pruneopts = "UT" - revision = "ae2b4b3d6c9166db00a845c9e88181c0886f585b" - version = "v1.4.0" - -[[projects]] - digest = "1:aefdc6057b4c5135a4eb07aa5e9a38d0364d1a5d28d1865fec17545799819ce3" - name = "github.com/ipfs/iptb-plugins" - packages = [ - ".", - "local", - ] - pruneopts = "UT" - revision = "a1cfafa7cc11f44e35a1ae4f7f1db896b12642e5" - version = "v0.1.0" - -[[projects]] - digest = "1:b352ae8b1a77cc6b48fc8e314e34a522cfc76d6ca3a06c93b29c9cde5de6771e" - name = "github.com/jackpal/gateway" - packages = ["."] - pruneopts = "UT" - revision = "cbcf4e3f3baee7952fc386c8b2534af4d267c875" - version = "v1.0.5" - -[[projects]] - digest = "1:32b82e71cf24f8b78323e0d7903c4b90278486283965aa2a19b1ea13763b8f34" - name = "github.com/jackpal/go-nat-pmp" - packages = ["."] - pruneopts = "UT" - revision = "c9cfead9f2a36ddf3daa40ba269aa7f4bbba6b62" - version = "v1.0.1" - -[[projects]] - digest = "1:30f857b000a0d14f978110222f1b1ba9cb1de8f6cabaca51933f3627ca6578a0" - name = "github.com/jbenet/go-is-domain" - packages = ["."] - pruneopts = "UT" - revision = "009bc9fc8d69261cc21e8eb2aa0925af155d1c11" - version = "v1.0.2" - -[[projects]] - branch = "master" - digest = "1:8cec67047e352e2a6e2c4ee4ce5b9886ac435c8b86df5941a7a10253e96fc0d3" - name = "github.com/jbenet/go-random" - packages = [ - ".", - "random", - ] - pruneopts = "UT" - revision = "123a90aedc0cfa3fbac8e2854d3d3b8219d9d156" - -[[projects]] - branch = "master" - digest = "1:cf7bb5b9d6a9136537450b5af1bc76578e1b6ec9bdbea01931c9917b74c50824" - name = "github.com/jbenet/go-random-files" - packages = [ - ".", - "random-files", - "ringreader", - ] - pruneopts = "UT" - revision = "31b3f20ebded11390a052597f61b9661e6e7c9ff" - -[[projects]] - branch = "master" - digest = "1:8f4aedc183dc8dfef9a7a1f1ba205dc87ecd2675eea350a736bda889e3bcf8ea" - name = "github.com/jbenet/go-temp-err-catcher" - packages = ["."] - pruneopts = "UT" - revision = "aac704a3f4f27190b4ccc05f303a4931fd1241ff" - -[[projects]] - digest = "1:ee4b434dc3622e5c25a611ce314d40dd724495f27968797a2589a4d89eeed7eb" - name = "github.com/jbenet/goprocess" - packages = [ - ".", - "context", - "periodic", - "ratelimit", - ] - pruneopts = "UT" - revision = "7f9d9ed286badffcf2122cfeb383ec37daf92508" - version = "v0.1.3" - -[[projects]] - digest = "1:75ab90ae3f5d876167e60f493beadfe66f0ed861a710f283fb06c86437a09538" - name = "github.com/jonboulle/clockwork" - packages = ["."] - pruneopts = "UT" - revision = "2eee05ed794112d45db504eb05aa693efd2b8b09" - version = "v0.1.0" - -[[projects]] - digest = "1:15ec2166e33ef6c60b344a04d050eec79193517e7f5082b6233b2d09ef0d10b8" - name = "github.com/kisielk/gotool" - packages = [ - ".", - "internal/load", - ] - pruneopts = "UT" - revision = "80517062f582ea3340cd4baf70e86d539ae7d84d" - version = "v1.0.0" - -[[projects]] - digest = "1:31e761d97c76151dde79e9d28964a812c46efc5baee4085b86f68f0c654450de" - name = "github.com/konsorten/go-windows-terminal-sequences" - packages = ["."] - pruneopts = "UT" - revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e" - version = "v1.0.2" - -[[projects]] - digest = "1:58ad79834dc097c36a857a8c325d646af0a8bbd73375a6958a639507c5399a61" - name = "github.com/koron/go-ssdp" - packages = ["."] - pruneopts = "UT" - revision = "6d1709049dead37ead37808479f88c9bffa2c4d6" - version = "v0.1" - -[[projects]] - digest = "1:bdd53b87de8185da386bae179c84d4848854c6870bacacf6a154fe63e2e750f7" - name = "github.com/lib/pq" - packages = [ - ".", - "oid", - "scram", - ] - pruneopts = "UT" - revision = "bc6a3c0594130b1e34005880bc600b6d3f49fa7f" - version = "v1.1.1" - -[[projects]] - digest = "1:483fcb9b21a758b47501f8880628b85aa3c4e99e33166867d06fa278965c66b2" - name = "github.com/libp2p/go-addr-util" - packages = ["."] - pruneopts = "UT" - revision = "4cd36c0f325f9e38f1e31ff7a10b9d94d53a11cf" - version = "v0.0.1" - -[[projects]] - digest = "1:b18a269f11ff51135d6f82987dbb53288f4d66098a6639b429f4f494a910155b" - name = "github.com/libp2p/go-buffer-pool" - packages = ["."] - pruneopts = "UT" - revision = "c4a5988a1e475884367015e1a2d0bd5fa4c491f4" - version = "v0.0.2" - -[[projects]] - digest = "1:041a5219e2f0c1fa2af5d25aee6970600ba2ac055ba386c18cfe960d392df3db" - name = "github.com/libp2p/go-conn-security-multistream" - packages = ["."] - pruneopts = "UT" - revision = "09b4134a655b5fc883a5bdd62ea12db6e0a1b095" - version = "v0.1.0" - -[[projects]] - digest = "1:83d3d59c84ff3da342ab63011d79750ccb987bda399eb64db3abd3e2fd32c18f" - name = "github.com/libp2p/go-flow-metrics" - packages = ["."] - pruneopts = "UT" - revision = "1f5b3acc846b2c8ce4c4e713296af74f5c24df55" - version = "v0.0.1" - -[[projects]] - digest = "1:d19d69803c50feab0b448d60dee41a3d9bd36af71f0c4b21d3075cfe5b288441" - name = "github.com/libp2p/go-libp2p" - packages = [ - ".", - "config", - "p2p/discovery", - "p2p/host/basic", - "p2p/host/relay", - "p2p/host/routed", - "p2p/net/mock", - "p2p/protocol/identify", - "p2p/protocol/identify/pb", - "p2p/protocol/ping", - ] - pruneopts = "UT" - revision = "d69c889ad97b02883e04164c6acf77a7381634c2" - version = "v0.1.1" - -[[projects]] - digest = "1:9a8251be38a87690510affa2e2fb04799a066b8ef49edc25a6acd30760d40792" - name = "github.com/libp2p/go-libp2p-autonat" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "3464f9b4f7bfbd7bb008813eacb626c7ab7fb9a3" - version = "v0.1.0" - -[[projects]] - digest = "1:04832a4429ccc5e9d793c6c27a5807c5854a79d44a893c80cb72d0bf8dfc157f" - name = "github.com/libp2p/go-libp2p-autonat-svc" - packages = ["."] - pruneopts = "UT" - revision = "51a8fe550623e6ebae91c9b43755e2ee9c310549" - version = "v0.1.0" - -[[projects]] - digest = "1:3da4ac7b6ea1fd52a22012966d7c744715a5cabfea013be30cb0d595bcfcdd3f" - name = "github.com/libp2p/go-libp2p-circuit" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "e65c36f3bb806cf658db0f0b612879899e2d28dc" - version = "v0.1.0" - -[[projects]] - digest = "1:15ffa5302d331a56efdc24ce2570ddf32bfff89daa4e3b0fed0c453a19b4960c" - name = "github.com/libp2p/go-libp2p-connmgr" - packages = ["."] - pruneopts = "UT" - revision = "152025a671fcc297333095f8e4afc98d90b30df7" - version = "v0.1.0" - -[[projects]] - digest = "1:acd95ce094e21559ddad0985e07709d5a1c9f7f648428681b423a5360cd71c74" - name = "github.com/libp2p/go-libp2p-core" - packages = [ - "connmgr", - "crypto", - "crypto/pb", - "discovery", - "helpers", - "host", - "metrics", - "mux", - "network", - "peer", - "peerstore", - "pnet", - "protocol", - "routing", - "sec", - "sec/insecure", - "test", - "transport", - ] - pruneopts = "UT" - revision = "8f222f4b5a872d9af86f74f2ec0982c7356adce6" - version = "v0.0.3" - -[[projects]] - digest = "1:35caf66f415bddda628d9410a20a6bcd8ac3deebbda33de1220d3f7ee3a14ccd" - name = "github.com/libp2p/go-libp2p-crypto" - packages = ["."] - pruneopts = "UT" - revision = "ddb6d72b5ad0ae81bf1ee77b628eac1d7237536a" - version = "v0.1.0" - -[[projects]] - digest = "1:0333065da4682126d7c1aa07dd11d94accc3b93b48945ebb7f6a921e2f6b0db2" - name = "github.com/libp2p/go-libp2p-discovery" - packages = ["."] - pruneopts = "UT" - revision = "d248d63b0af8c023307da18ad7000a12020e06f0" - version = "v0.1.0" - -[[projects]] - digest = "1:c370faf62c81c21ad23d2a5a30e4fb0347e80460e3abcc10901a48daf0999ddc" - name = "github.com/libp2p/go-libp2p-gostream" - packages = ["."] - pruneopts = "UT" - revision = "7fcf4dd149c1d97388f362aa139db26227d54bd4" - version = "v0.1.1" - -[[projects]] - digest = "1:7811b2a796bfc81952e70d14c5bb99ac550b18b1bbf815359a4d24cfc4329481" - name = "github.com/libp2p/go-libp2p-kad-dht" - packages = [ - ".", - "metrics", - "opts", - "pb", - "providers", - ] - pruneopts = "UT" - revision = "31765355df17ef818381169dc36180c84c119928" - version = "v0.1.0" - -[[projects]] - digest = "1:d750c3b6c1c69bab8ed996ca6c053e0a13db53d2c51937a0debc40174c77bfc1" - name = "github.com/libp2p/go-libp2p-kbucket" - packages = [ - ".", - "keyspace", - ] - pruneopts = "UT" - revision = "3752ea0128fd84b4fef0a66739b8ca95c8a471b6" - version = "v0.2.0" - -[[projects]] - digest = "1:645c5ab1429b06141e0d22852df9561e04b3759380f6657f0b510a30eef83665" - name = "github.com/libp2p/go-libp2p-loggables" - packages = ["."] - pruneopts = "UT" - revision = "814642b01726ff6f9302e8ce9eeeb00d25409520" - version = "v0.1.0" - -[[projects]] - digest = "1:714ce7cff748910cfc250713300d24ece7d4832156ba7a245e7ac5fc810c7319" - name = "github.com/libp2p/go-libp2p-mplex" - packages = ["."] - pruneopts = "UT" - revision = "811729f15f0af13fe3f0d9e410c22f6a4bc5c686" - version = "v0.2.1" - -[[projects]] - digest = "1:4614c7d351b9cc24ef6457107fad9830664615bb7d7de91de10c4a4ab1919545" - name = "github.com/libp2p/go-libp2p-nat" - packages = ["."] - pruneopts = "UT" - revision = "c50c291a61bceccb914366d93eb24f58594e9134" - version = "v0.0.4" - -[[projects]] - digest = "1:2930f937f465b6801ca4a89a701a5131aa215a6a854b0e7c344d6d62960d2563" - name = "github.com/libp2p/go-libp2p-netutil" - packages = ["."] - pruneopts = "UT" - revision = "cd42ce60b36206032242a27faa1121c08ae2829e" - version = "v0.1.0" - -[[projects]] - digest = "1:79d1cf3e88f9ae667c30039cc37a6ad0be8bf0fa9b5359b572253de74b24c644" - name = "github.com/libp2p/go-libp2p-peer" - packages = ["."] - pruneopts = "UT" - revision = "62676d8fb785a8fc279878cbe8e03b878f005910" - version = "v0.2.0" - -[[projects]] - digest = "1:9a42e258de3b7daa00e2a3499bfa34185fb0c94b31cfa12a0f85f9105ebf8072" - name = "github.com/libp2p/go-libp2p-peerstore" - packages = [ - ".", - "addr", - "pstoremem", - "queue", - ] - pruneopts = "UT" - revision = "4353646945045d89f77d0b362cb5e5533cbd117e" - version = "v0.1.0" - -[[projects]] - digest = "1:576fc983d8a7fae4f2d03f8bfcfee6c2b062b70fee73cb10cc6a7531445ba998" - name = "github.com/libp2p/go-libp2p-pnet" - packages = ["."] - pruneopts = "UT" - revision = "f0a2f186a5c972b76b55680d5ef21894491c2f81" - version = "v0.1.0" - -[[projects]] - digest = "1:639e2ee83cffd5445eeffd1cb8ba50b690028dc98464abac24e93a15abca8c8b" - name = "github.com/libp2p/go-libp2p-pubsub" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "49274b0e8aecdf6cad59d768e5702ff00aa48488" - version = "v0.1.0" - -[[projects]] - digest = "1:d1eeaaf0f74ecb34eb30a48fd20347cf5b3df17ca822e3a99e23100922072b31" - name = "github.com/libp2p/go-libp2p-pubsub-router" - packages = ["."] - pruneopts = "UT" - revision = "1b619f8d12950c3a6b91f93c08f29842af38a68c" - version = "v0.1.0" - -[[projects]] - digest = "1:0e004b6b20f295a4e3a0e11e0644b3cb05beb5011c751f52cb088bc6d15ba94c" - name = "github.com/libp2p/go-libp2p-quic-transport" - packages = ["."] - pruneopts = "UT" - revision = "2abd270a64ebf0e3b869ee6bc7a1e5ac8b001fe6" - version = "v0.1.1" - -[[projects]] - digest = "1:524733c74ff3b3fad069dbfda7b21c532c2411125b5bd60a7560f90cdbf82eab" - name = "github.com/libp2p/go-libp2p-record" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "4837430afd8f3864d4805d7a1675521abb1096b4" - version = "v0.1.0" - -[[projects]] - digest = "1:ab8374423f8b7148d55e6d7ec848d248a0707b2af8a8b8a5b3608887d9ec485d" - name = "github.com/libp2p/go-libp2p-routing" - packages = ["notifications"] - pruneopts = "UT" - revision = "f4ece6c1baa8e77ee488b25014fcb1059955ed0f" - version = "v0.1.0" - -[[projects]] - digest = "1:62994932ddbe31d1130589fb009538831afec171c787677a570cc9eba0dd96fe" - name = "github.com/libp2p/go-libp2p-routing-helpers" - packages = ["."] - pruneopts = "UT" - revision = "061228ae05eb858e5d99d80e96920a6de1df497a" - version = "v0.1.0" - -[[projects]] - digest = "1:d0bed92a182074cefb3f2e1beb5d250618ab38b2fb2dbcaf0496c20c77acf8da" - name = "github.com/libp2p/go-libp2p-secio" - packages = [ - ".", - "pb", - ] - pruneopts = "UT" - revision = "a158134b5708e33fa36545d8ba8e27ea1c8ae54e" - version = "v0.1.0" - -[[projects]] - digest = "1:112a23330f359f603c21f42d0917245829807671b8e819ff0397d73966df8195" - name = "github.com/libp2p/go-libp2p-swarm" - packages = [ - ".", - "testing", - ] - pruneopts = "UT" - revision = "99831444e78c8f23c9335c17d8f7c700ba25ca14" - version = "v0.1.0" - -[[projects]] - digest = "1:c639dcba227173d259cfd5e0ceb23df301eeddb1ce944fa1a72b60fd6f37d93d" - name = "github.com/libp2p/go-libp2p-testing" - packages = [ - "ci", - "ci/travis", - "etc", - "net", - ] - pruneopts = "UT" - revision = "6d4ca71943f35271918e28f9a9950002e17b4f16" - version = "v0.0.4" - -[[projects]] - digest = "1:af731b7005639d582a0353c22651e94d08d3970abfdddac742c9fad94b85bfd1" - name = "github.com/libp2p/go-libp2p-tls" - packages = ["."] - pruneopts = "UT" - revision = "d1a46ca5425197316b94a31953df645adaa21f67" - version = "v0.1.0" - -[[projects]] - digest = "1:2fcb80000123d80148ce210a053a226d52dc891419905d7ff076c164825da50d" - name = "github.com/libp2p/go-libp2p-transport-upgrader" - packages = ["."] - pruneopts = "UT" - revision = "07ed92ccf9aba3a2e4b2fddc4c17ced060524922" - version = "v0.1.1" - -[[projects]] - digest = "1:c476d8c20126fdc217055de367da2a8c4d78da52bf0818dedd6c92e87795021c" - name = "github.com/libp2p/go-libp2p-yamux" - packages = ["."] - pruneopts = "UT" - revision = "a61e80cb5770aa0d9b1bafe94da1278f58baa2c5" - version = "v0.2.1" - -[[projects]] - digest = "1:986c0c852c462da2cdc5d584dc2fd884cb898371cbc43cdc250149f40f8cd8fc" - name = "github.com/libp2p/go-maddr-filter" - packages = ["."] - pruneopts = "UT" - revision = "e3cdd802c04babcbec2c4711721d105cfe822cd3" - version = "v0.0.4" - -[[projects]] - digest = "1:fd01fc96631a63d323f17fcbd64161804439855404b9405db14deacba9e1b69c" - name = "github.com/libp2p/go-mplex" - packages = ["."] - pruneopts = "UT" - revision = "62fe9554facaec3f80333b61ea8d694fe615705f" - version = "v0.1.0" - -[[projects]] - digest = "1:fd524b598a7aa769d2bb5f0a6e5de4b95989070cf65ff100b87523fc2be7b9dc" - name = "github.com/libp2p/go-msgio" - packages = ["."] - pruneopts = "UT" - revision = "90cce7933451e8b170cf5d5a3627fd2950d155fd" - version = "v0.0.3" - -[[projects]] - digest = "1:82e0411449d8af0c34e200cd6b90e70689d692d17f836906194fa9fc28692e80" - name = "github.com/libp2p/go-nat" - packages = ["."] - pruneopts = "UT" - revision = "d13fdefb3bbb2fde2c6fc090a7ea992cec8b26df" - version = "v0.0.3" - -[[projects]] - digest = "1:3218d9edf75d814d2994ce4b14fae01c657a3284af84522efcc8dee89806f4ca" - name = "github.com/libp2p/go-reuseport" - packages = ["."] - pruneopts = "UT" - revision = "3e6d618acfdfacbbeff71cb2bd70fc188f897a0f" - version = "v0.0.1" - -[[projects]] - digest = "1:bf12fbd51fb864c9e2cb688581d3c14551a8c3d1c2fa60c9ad405c532e1b9d42" - name = "github.com/libp2p/go-reuseport-transport" - packages = ["."] - pruneopts = "UT" - revision = "c7583c88df654a2ecd621e863f661783d79b64d1" - version = "v0.0.2" - -[[projects]] - digest = "1:58a6c4b9e52e298228703f9bf480d65c40ede7152a9ad17aa1eafe618ed0b43a" - name = "github.com/libp2p/go-stream-muxer-multistream" - packages = ["."] - pruneopts = "UT" - revision = "2439b02deee2de8bb1fe24473d3d8333008a714a" - version = "v0.2.0" - -[[projects]] - digest = "1:ac5ce11098023fcf8164307727a2b99d69e2bb84a3b1f4bc3e1d10fd72f9bdbd" - name = "github.com/libp2p/go-tcp-transport" - packages = ["."] - pruneopts = "UT" - revision = "415627e90148700bf97890e54b193a42125c3b66" - version = "v0.1.0" - -[[projects]] - digest = "1:b1436d41d493ff2d51052838e0415c26366314febead5051f732f5c98e3729f1" - name = "github.com/libp2p/go-ws-transport" - packages = ["."] - pruneopts = "UT" - revision = "6efd965516262a6b6e46ea987b94904ef13e59bc" - version = "v0.1.0" - -[[projects]] - digest = "1:64fdef1e970d17504d960d18412125e85ca620703e495105b3fbffee27acf568" - name = "github.com/libp2p/go-yamux" - packages = ["."] - pruneopts = "UT" - revision = "663972181d409e7263040f0b668462f87c85e1bd" - version = "v1.2.3" - -[[projects]] - digest = "1:95de854fb72e6cd0344b875a04abace9abbef78c304c4f31b451bbedd9023338" - name = "github.com/lucas-clemente/quic-go" - packages = [ - ".", - "internal/ackhandler", - "internal/congestion", - "internal/flowcontrol", - "internal/handshake", - "internal/protocol", - "internal/qerr", - "internal/utils", - "internal/wire", - ] - pruneopts = "UT" - revision = "4355e1a7e961ba3b6005cb035ae17732181c9508" - version = "v0.11.2" - -[[projects]] - digest = "1:5a0ef768465592efca0412f7e838cdc0826712f8447e70e6ccc52eb441e9ab13" - name = "github.com/magiconair/properties" - packages = ["."] - pruneopts = "UT" - revision = "de8848e004dd33dc07a2947b3d76f618a7fc7ef1" - version = "v1.8.1" - -[[projects]] - digest = "1:9d377b8e6748a813a7fb25e99bf54bfaefba62eac5bf5152c2657f95dbe83172" - name = "github.com/marten-seemann/qtls" - packages = ["."] - pruneopts = "UT" - revision = "cd359ef406f82ab779fea7db4c512898eb3007a6" - version = "v0.2.4" - -[[projects]] - digest = "1:7c084e0e780596dd2a7e20d25803909a9a43689c153de953520dfbc0b0e51166" - name = "github.com/mattn/go-colorable" - packages = ["."] - pruneopts = "UT" - revision = "8029fb3788e5a4a9c00e415f586a6d033f5d38b3" - version = "v0.1.2" - -[[projects]] - digest = "1:9b90c7639a41697f3d4ad12d7d67dfacc9a7a4a6e0bbfae4fc72d0da57c28871" - name = "github.com/mattn/go-isatty" - packages = ["."] - pruneopts = "UT" - revision = "1311e847b0cb909da63b5fecfb5370aa66236465" - version = "v0.0.8" - -[[projects]] - digest = "1:0356f3312c9bd1cbeda81505b7fd437501d8e778ab66998ef69f00d7f9b3a0d7" - name = "github.com/mattn/go-runewidth" - packages = ["."] - pruneopts = "UT" - revision = "3ee7d812e62a0804a7d0a324e0249ca2db3476d3" - version = "v0.0.4" - -[[projects]] - digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - pruneopts = "UT" - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" - -[[projects]] - branch = "master" - digest = "1:2b32af4d2a529083275afc192d1067d8126b578c7a9613b26600e4df9c735155" - name = "github.com/mgutz/ansi" - packages = ["."] - pruneopts = "UT" - revision = "9520e82c474b0a04dd04f8a40959027271bab992" - -[[projects]] - digest = "1:7c572c76f914b3d3f7d75ce752c3a6ac5ba03be1f775e4602a3f18d7b08ddbbb" - name = "github.com/miekg/dns" - packages = ["."] - pruneopts = "UT" - revision = "9cfcfb2209aecb663673bd44b11f71c215186b80" - version = "v1.1.14" - -[[projects]] - branch = "master" - digest = "1:130cefe87d7eeefc824978dcb78e35672d4c49a11f25c153fbf0cfd952756fa3" - name = "github.com/minio/blake2b-simd" - packages = ["."] - pruneopts = "UT" - revision = "3f5f724cb5b182a5c278d6d3d55b40e7f8c2efb4" - -[[projects]] - digest = "1:d69117243f58a0d320c2889872d8c14d323d865277dc49fc85bfcf48b2846b8f" - name = "github.com/minio/sha256-simd" - packages = ["."] - pruneopts = "UT" - revision = "05b4dd3047e5d6e86cb4e0477164b850cd896261" - version = "v0.1.0" - -[[projects]] - digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - pruneopts = "UT" - revision = "af06845cf3004701891bf4fdb884bfe4920b3727" - version = "v1.1.0" - -[[projects]] - digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - pruneopts = "UT" - revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe" - version = "v1.1.2" - -[[projects]] - branch = "master" - digest = "1:ae08d850ba158ea3ba4a7bb90f8372608172d8920644e5a6693b940a1f4e5d01" - name = "github.com/mmcloughlin/avo" - packages = [ - "attr", - "build", - "buildtags", - "gotypes", - "internal/prnt", - "internal/stack", - "ir", - "operand", - "pass", - "printer", - "reg", - "src", - "x86", - ] - pruneopts = "UT" - revision = "83fbad1a6b3cba8ac7711170e57953fd12cdc40a" - -[[projects]] - digest = "1:b6299badabd66eaede0651e2eaede106d8298b25564e4a7f23e335471d3e5a35" - name = "github.com/mr-tron/base58" - packages = ["base58"] - pruneopts = "UT" - revision = "d504ab2e22d97cb9f10b1d146a1e6a063f4a5f43" - version = "v1.1.2" - -[[projects]] - digest = "1:b9fe622bbadbb060338620752b1cb3aa1473855071195ebe83813af5ebb3629b" - name = "github.com/multiformats/go-base32" - packages = ["."] - pruneopts = "UT" - revision = "a9c2755c3d1672dbe6a7e4a5d182169fa30b6a8e" - version = "v0.0.3" - -[[projects]] - digest = "1:c95537699dfc9ecc62c2bb273fd2fdf5810ce23ed50f25529c17f755a052a7c3" - name = "github.com/multiformats/go-multiaddr" - packages = ["."] - pruneopts = "UT" - revision = "5b1de2f51ff2368d5ce94a659f15ef26be273cd0" - version = "v0.0.4" - -[[projects]] - digest = "1:e7b7007612b49b368d5b505b624b399a1de5fe2764271b92145aa9ca0440ab4e" - name = "github.com/multiformats/go-multiaddr-dns" - packages = ["."] - pruneopts = "UT" - revision = "e7c544d7a325c57bdbd7e9ba9c035a6701c5c7d2" - version = "v0.0.2" - -[[projects]] - digest = "1:1275cf8587ba416c439453ee4b194b803270b836831c487b3da3cf9d82f58bb7" - name = "github.com/multiformats/go-multiaddr-fmt" - packages = ["."] - pruneopts = "UT" - revision = "7d8102a98552c80f8a5ccb9c01e670fac17fd6df" - version = "v0.0.1" - -[[projects]] - digest = "1:ccb950e76138c70abe765c3b9c0e6cad0e55fc66ff53318cea8b651df9f892c7" - name = "github.com/multiformats/go-multiaddr-net" - packages = ["."] - pruneopts = "UT" - revision = "bd61b0499a3cfc893a8eb109c5669342b1671881" - version = "v0.0.1" - -[[projects]] - digest = "1:8f2a32f6d211bf2685d5c47ace5d6b59bd4359f69e92b632793d066129a65c4e" - name = "github.com/multiformats/go-multibase" - packages = ["."] - pruneopts = "UT" - revision = "d63641945dc1749baa23686ad0564ad63fef0493" - version = "v0.0.1" - -[[projects]] - digest = "1:5769b15a01346046ca7a66e2205326e0d5efcf7c4e2d116fcd26b6c8910c6872" - name = "github.com/multiformats/go-multihash" - packages = [ - ".", - "multihash", - "opts", - ] - pruneopts = "UT" - revision = "c242156eec223a58ac13b8c114a2b31e87bbf558" - version = "v0.0.5" - -[[projects]] - digest = "1:026ef80e6db7432132c7687d23b465e0c4bdb47a4aed893ee4b7d528a0550059" - name = "github.com/multiformats/go-multistream" - packages = ["."] - pruneopts = "UT" - revision = "039807e4901c4b2041f40a0e4aa32d72939608aa" - version = "v0.1.0" - -[[projects]] - digest = "1:66b0a65aba488ca6c72f77132d5b8d7e2c5baf07d577dee64502b69a2c90c791" - name = "github.com/nbutton23/zxcvbn-go" - packages = [ - ".", - "adjacency", - "data", - "entropy", - "frequency", - "match", - "matching", - "scoring", - "utils/math", - ] - pruneopts = "UT" - revision = "eafdab6b0663b4b528c35975c8b0e78be6e25261" - version = "v0.1" - -[[projects]] - digest = "1:11e62d6050198055e6cd87ed57e5d8c669e84f839c16e16f192374d913d1a70d" - name = "github.com/opentracing/opentracing-go" - packages = [ - ".", - "ext", - "log", - ] - pruneopts = "UT" - revision = "659c90643e714681897ec2521c60567dd21da733" - version = "v1.1.0" - -[[projects]] - digest = "1:93131d8002d7025da13582877c32d1fc302486775a1b06f62241741006428c5e" - name = "github.com/pelletier/go-toml" - packages = ["."] - pruneopts = "UT" - revision = "728039f679cbcd4f6a54e080d2219a4c4928c546" - version = "v1.4.0" - -[[projects]] - digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" - name = "github.com/pkg/errors" - packages = ["."] - pruneopts = "UT" - revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" - version = "v0.8.1" - -[[projects]] - branch = "master" - digest = "1:13e3ecd0eb9145fd62bebcc8fb8334b20408f31da7be3cacb68b5abcd09a1f42" - name = "github.com/polydawn/refmt" - packages = [ - ".", - "cbor", - "json", - "obj", - "obj/atlas", - "pretty", - "shared", - "tok", - ] - pruneopts = "UT" - revision = "01bf1e26dd14f9b71f26b7005a2b1ef514d5f9a4" - -[[projects]] - digest = "1:e89f2cdede55684adbe44b5566f55838ad2aee1dff348d14b73ccf733607b671" - name = "github.com/prometheus/client_golang" - packages = [ - "prometheus", - "prometheus/internal", - "prometheus/promhttp", - ] - pruneopts = "UT" - revision = "2641b987480bca71fb39738eb8c8b0d577cb1d76" - version = "v0.9.4" - -[[projects]] - branch = "master" - digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" - name = "github.com/prometheus/client_model" - packages = ["go"] - pruneopts = "UT" - revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8" - -[[projects]] - digest = "1:8dcedf2e8f06c7f94e48267dea0bc0be261fa97b377f3ae3e87843a92a549481" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model", - ] - pruneopts = "UT" - revision = "17f5ca1748182ddf24fc33a5a7caaaf790a52fcc" - version = "v0.4.1" - -[[projects]] - digest = "1:403b810b43500b5b0a9a24a47347e31dc2783ccae8cf97c891b46f5b0496fa1a" - name = "github.com/prometheus/procfs" - packages = [ - ".", - "internal/fs", - ] - pruneopts = "UT" - revision = "833678b5bb319f2d20a475cb165c6cc59c2cc77c" - version = "v0.0.2" - -[[projects]] - digest = "1:b0c25f00bad20d783d259af2af8666969e2fc343fa0dc9efe52936bbd67fb758" - name = "github.com/rs/cors" - packages = ["."] - pruneopts = "UT" - revision = "9a47f48565a795472d43519dd49aac781f3034fb" - version = "v1.6.0" - -[[projects]] - digest = "1:04457f9f6f3ffc5fea48e71d62f2ca256637dee0a04d710288e27e05c8b41976" - name = "github.com/sirupsen/logrus" - packages = ["."] - pruneopts = "UT" - revision = "839c75faf7f98a33d445d181f3018b5c3409a45e" - version = "v1.4.2" - -[[projects]] - digest = "1:f0be8922b4a34a3e07caef4c8bcb9377713af6edf3b7cb9ded42f095b7994374" - name = "github.com/sourcegraph/go-diff" - packages = ["diff"] - pruneopts = "UT" - revision = "042635e6444e67483d777aaa240274f13691500c" - version = "v0.5.1" - -[[projects]] - branch = "master" - digest = "1:74aa99ef18406ebfdedfb2a07b9a01f9ff2b6d2547b27b33fcdf1007223d75cc" - name = "github.com/spacemonkeygo/openssl" - packages = [ - ".", - "utils", - ] - pruneopts = "UT" - revision = "c2dcc5cca94ac8f7f3f0c20e20050d4cce9d9730" - -[[projects]] - branch = "master" - digest = "1:d6956eb95db39859627c18e1dd425b2ddd1a0d6000b643a4d4ada8fc887c1e09" - name = "github.com/spacemonkeygo/spacelog" - packages = ["."] - pruneopts = "UT" - revision = "2296661a0572a51438413369004fa931c2641923" - -[[projects]] - digest = "1:919bb3aa6d9d0b67648c219fa4925312bc3c2872da19e818fa769e9c97a2b643" - name = "github.com/spaolacci/murmur3" - packages = ["."] - pruneopts = "UT" - revision = "9f5d223c60793748f04a9d5b4b4eacddfc1f755d" - version = "v1.1" - -[[projects]] - digest = "1:bb495ec276ab82d3dd08504bbc0594a65de8c3b22c6f2aaa92d05b73fbf3a82e" - name = "github.com/spf13/afero" - packages = [ - ".", - "mem", - ] - pruneopts = "UT" - revision = "588a75ec4f32903aa5e39a2619ba6a4631e28424" - version = "v1.2.2" - -[[projects]] - digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc" - name = "github.com/spf13/cast" - packages = ["."] - pruneopts = "UT" - revision = "8c9545af88b134710ab1cd196795e7f2388358d7" - version = "v1.3.0" - -[[projects]] - digest = "1:e096613fb7cf34743d49af87d197663cfccd61876e2219853005a57baedfa562" - name = "github.com/spf13/cobra" - packages = ["."] - pruneopts = "UT" - revision = "f2b07da1e2c38d5f12845a4f607e2e1018cbb1f5" - version = "v0.0.5" - -[[projects]] - digest = "1:1b753ec16506f5864d26a28b43703c58831255059644351bbcb019b843950900" - name = "github.com/spf13/jwalterweatherman" - packages = ["."] - pruneopts = "UT" - revision = "94f6ae3ed3bceceafa716478c5fbf8d29ca601a1" - version = "v1.1.0" - -[[projects]] - digest = "1:c1b1102241e7f645bc8e0c22ae352e8f0dc6484b6cb4d132fa9f24174e0119e2" - name = "github.com/spf13/pflag" - packages = ["."] - pruneopts = "UT" - revision = "298182f68c66c05229eb03ac171abe6e309ee79a" - version = "v1.0.3" - -[[projects]] - digest = "1:11118bd196646c6515fea3d6c43f66162833c6ae4939bfb229b9956d91c6cf17" - name = "github.com/spf13/viper" - packages = ["."] - pruneopts = "UT" - revision = "b5bf975e5823809fb22c7644d008757f78a4259e" - version = "v1.4.0" - -[[projects]] - digest = "1:5b180f17d5bc50b765f4dcf0d126c72979531cbbd7f7929bf3edd87fb801ea2d" - name = "github.com/syndtr/goleveldb" - packages = [ - "leveldb", - "leveldb/cache", - "leveldb/comparer", - "leveldb/errors", - "leveldb/filter", - "leveldb/iterator", - "leveldb/journal", - "leveldb/memdb", - "leveldb/opt", - "leveldb/storage", - "leveldb/table", - "leveldb/util", - ] - pruneopts = "UT" - revision = "9d007e481048296f09f59bd19bb7ae584563cd95" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:a38c75e7edd595bbaa03334c1ac26163a5e990d81f05cd9ec5fd0edc9c786078" - name = "github.com/texttheater/golang-levenshtein" - packages = ["levenshtein"] - pruneopts = "UT" - revision = "d188e65d659ef53fcdb0691c12f1bba64928b649" - -[[projects]] - branch = "master" - digest = "1:7393233424f587db9c11ea3b74c57e4955b47e4ba1b76ab5ea940b672a1263fb" - name = "github.com/timakin/bodyclose" - packages = ["passes/bodyclose"] - pruneopts = "UT" - revision = "4a873e97b2bb302885fe7592c4b2d5749cc62985" - -[[projects]] - digest = "1:b24d38b282bacf9791408a080f606370efa3d364e4b5fd9ba0f7b87786d3b679" - name = "github.com/urfave/cli" - packages = ["."] - pruneopts = "UT" - revision = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1" - version = "v1.20.0" - -[[projects]] - branch = "master" - digest = "1:98fa13beefbf581ec173561adad6374c460631593b4bdcf03adc29cd18e5d2f5" - name = "github.com/whyrusleeping/base32" - packages = ["."] - pruneopts = "UT" - revision = "c30ac30633ccdabefe87eb12465113f06f1bab75" - -[[projects]] - branch = "master" - digest = "1:3ca7e47848bbb8fc6c17b86c9887117e2e83dd5d68f7c4daf8c8fd30471ea597" - name = "github.com/whyrusleeping/chunker" - packages = ["."] - pruneopts = "UT" - revision = "fe64bd25879f446bb7e8a4adf5d4a68552211bd3" - -[[projects]] - branch = "master" - digest = "1:b33eed6794f2b2d1a7d0b45cb705402f26af0f0ad6521667e144ffa71f52d9d9" - name = "github.com/whyrusleeping/go-keyspace" - packages = ["."] - pruneopts = "UT" - revision = "5b898ac5add1da7178a4a98e69cb7b9205c085ee" - -[[projects]] - branch = "master" - digest = "1:0102dfa2f98777db8ff68c920bef1be3ff8504e90485b6cdd24d61b981b487b6" - name = "github.com/whyrusleeping/go-logging" - packages = ["."] - pruneopts = "UT" - revision = "0457bb6b88fc1973573aaf6b5145d8d3ae972390" - -[[projects]] - branch = "master" - digest = "1:94796f9decedb46b17985693cbe996ce3642a991f0efcf7bf9a6c5197da3eefc" - name = "github.com/whyrusleeping/go-notifier" - packages = ["."] - pruneopts = "UT" - revision = "097c5d47330ff6a823f67e3515faa13566a62c6f" - -[[projects]] - branch = "master" - digest = "1:2fba6c6f47871875d89473514217f2e32380f72373ece98c10c93807981f35db" - name = "github.com/whyrusleeping/go-sysinfo" - packages = ["."] - pruneopts = "UT" - revision = "4a357d4b90b11a6fd867fdb51c21d686645830c2" - -[[projects]] - digest = "1:6c96967502c55c555abfe560f561a124951345e713a8e87cc6e2c214976e6e75" - name = "github.com/whyrusleeping/mafmt" - packages = ["."] - pruneopts = "UT" - revision = "7aa7fad2ede4e7157818e3e7af5061f866a9ae23" - version = "v1.2.8" - -[[projects]] - branch = "master" - digest = "1:0a017705731cb8ad506e72d842840ba89809e5b27b5593954c7eeeb631823735" - name = "github.com/whyrusleeping/mdns" - packages = ["."] - pruneopts = "UT" - revision = "ef14215e6b30606f4ce84174ed7a644a05cb1af3" - -[[projects]] - branch = "master" - digest = "1:94b933c1b26f1da25d25a089937d15987170a0a54109aa521a111345c3e84581" - name = "github.com/whyrusleeping/multiaddr-filter" - packages = ["."] - pruneopts = "UT" - revision = "e903e4adabd70b78bc9293b6ee4f359afb3f9f59" - -[[projects]] - branch = "master" - digest = "1:dc9bda956375dc82dacd2a78f32095aae7c6e40c676b2f971357ccb76cbf46c2" - name = "github.com/whyrusleeping/sql-datastore" - packages = [ - ".", - "postgres", - ] - pruneopts = "UT" - revision = "b24eb8d0ce144e31120c0708b0c987362d63c1a0" - -[[projects]] - branch = "master" - digest = "1:e2599924072678810fe41b00dead8e11e95fa55be2dbc01b5309c4bf04f2209c" - name = "github.com/whyrusleeping/tar-utils" - packages = ["."] - pruneopts = "UT" - revision = "8c6c8ba81d5c71fd69c0f48dbde4b2fb422b6dfc" - -[[projects]] - branch = "master" - digest = "1:1ccd9d66ae1abe6b3b28d8b68e09387533fee345d8bbaa753af2fa16e0505807" - name = "github.com/whyrusleeping/timecache" - packages = ["."] - pruneopts = "UT" - revision = "cfcb2f1abfee846c430233aef0b630a946e0a5a6" - -[[projects]] - digest = "1:0509a2e8721ffedf3c03ebed1ac8eda633b8f4ee812d5edcac5c5d77eaeb7f0d" - name = "go.opencensus.io" - packages = [ - "internal/tagencoding", - "metric/metricdata", - "metric/metricproducer", - "resource", - "stats", - "stats/internal", - "stats/view", - "tag", - ] - pruneopts = "UT" - revision = "9c377598961b706d1542bd2d84d538b5094d596e" - version = "v0.22.0" - -[[projects]] - digest = "1:ff6b126259880858441d0a43e63c3f2f9071601415e1f34a7f053f90cbef8464" - name = "go.uber.org/atomic" - packages = ["."] - pruneopts = "UT" - revision = "3b8db5e93c4c02efbc313e17b2e796b0914a01fb" - version = "v1.1.0" - -[[projects]] - digest = "1:2773e4e922e5af534775962ffef08770b8114e177590f7605886528d37417105" - name = "go.uber.org/dig" - packages = [ - ".", - "internal/digreflect", - "internal/dot", - ] - pruneopts = "UT" - revision = "7ff117f761a3f1b3eb521945c17a1091438eb6de" - version = "v1.7.0" - -[[projects]] - digest = "1:74e59bc785a76b467b9a5c0353193e8befa0c27863413e5fc52e87cf3d24fa4e" - name = "go.uber.org/fx" - packages = [ - ".", - "internal/fxlog", - "internal/fxreflect", - "internal/lifecycle", - ] - pruneopts = "UT" - revision = "3de044da969b90ad0a3e4a7867a74662f645f3f9" - version = "v1.9.0" - -[[projects]] - digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" - name = "go.uber.org/multierr" - packages = ["."] - pruneopts = "UT" - revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" - version = "v1.1.0" - -[[projects]] - branch = "master" - digest = "1:52796c672f9529f506ac63c10bf44072c8156cb2c85c0784a8b8ccb164e94903" - name = "go4.org" - packages = ["lock"] - pruneopts = "UT" - revision = "94abd6928b1da39b1d757b60c93fb2419c409fa1" - -[[projects]] - branch = "master" - digest = "1:b7289611803360021aa5fe4469d9ff38eab6b6fa9898af160fc218d3edbbd1a6" - name = "golang.org/x/crypto" - packages = [ - "blake2s", - "blowfish", - "chacha20poly1305", - "cryptobyte", - "cryptobyte/asn1", - "curve25519", - "ed25519", - "ed25519/internal/edwards25519", - "hkdf", - "internal/chacha20", - "internal/subtle", - "poly1305", - "salsa20", - "salsa20/salsa", - "sha3", - "ssh/terminal", - ] - pruneopts = "UT" - revision = "5c40567a22f818bd14a1ea7245dad9f8ef0691aa" - -[[projects]] - branch = "master" - digest = "1:c094df8a7b79d5c6ddc9035b13516f5bf1d7516e785d1c57a6f9d6a1d0efe3ff" - name = "golang.org/x/net" - packages = [ - "bpf", - "context", - "html", - "html/atom", - "html/charset", - "internal/iana", - "internal/socket", - "internal/timeseries", - "ipv4", - "ipv6", - "trace", - ] - pruneopts = "UT" - revision = "3f473d35a33aa6fdd203e306dc439b797820e3f1" - -[[projects]] - branch = "master" - digest = "1:8ea0513faaf49c2491a6aa1c4962261295ed140478e3e84b5c699f42af0a3936" - name = "golang.org/x/sys" - packages = [ - "cpu", - "unix", - "windows", - ] - pruneopts = "UT" - revision = "93c9922d18aeb82498a065f07aec7ad7fa60dfb7" - -[[projects]] - digest = "1:a8790d49ff0b71048aa8170d2863918f9d22e74293ca92b90333c05a40514a84" - name = "golang.org/x/text" - packages = [ - "encoding", - "encoding/charmap", - "encoding/htmlindex", - "encoding/internal", - "encoding/internal/identifier", - "encoding/japanese", - "encoding/korean", - "encoding/simplifiedchinese", - "encoding/traditionalchinese", - "encoding/unicode", - "internal/gen", - "internal/language", - "internal/language/compact", - "internal/tag", - "internal/triegen", - "internal/ucd", - "internal/utf8internal", - "language", - "runes", - "transform", - "unicode/cldr", - "unicode/norm", - "width", - ] - pruneopts = "UT" - revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475" - version = "v0.3.2" - -[[projects]] - branch = "master" - digest = "1:319e7521886d58092551020028e8ddb691d5bd756f1ab58baa033e0ff3ff6c30" - name = "golang.org/x/tools" - packages = [ - "cover", - "go/analysis", - "go/analysis/passes/asmdecl", - "go/analysis/passes/assign", - "go/analysis/passes/atomic", - "go/analysis/passes/atomicalign", - "go/analysis/passes/bools", - "go/analysis/passes/buildssa", - "go/analysis/passes/buildtag", - "go/analysis/passes/cgocall", - "go/analysis/passes/composite", - "go/analysis/passes/copylock", - "go/analysis/passes/ctrlflow", - "go/analysis/passes/httpresponse", - "go/analysis/passes/inspect", - "go/analysis/passes/internal/analysisutil", - "go/analysis/passes/loopclosure", - "go/analysis/passes/lostcancel", - "go/analysis/passes/nilfunc", - "go/analysis/passes/printf", - "go/analysis/passes/shadow", - "go/analysis/passes/shift", - "go/analysis/passes/stdmethods", - "go/analysis/passes/structtag", - "go/analysis/passes/tests", - "go/analysis/passes/unmarshal", - "go/analysis/passes/unreachable", - "go/analysis/passes/unsafeptr", - "go/analysis/passes/unusedresult", - "go/ast/astutil", - "go/ast/inspector", - "go/buildutil", - "go/cfg", - "go/gcexportdata", - "go/internal/cgo", - "go/internal/gcimporter", - "go/internal/packagesdriver", - "go/loader", - "go/packages", - "go/ssa", - "go/ssa/ssautil", - "go/types/typeutil", - "imports", - "internal/fastwalk", - "internal/gopathwalk", - "internal/imports", - "internal/module", - "internal/semver", - ] - pruneopts = "UT" - revision = "d73e1c7e250b19f9948138e2df37cea712e8f06f" - -[[projects]] - branch = "master" - digest = "1:c44a77760372a998be8d4656e8d3c865f68735ec4cad1743a245903a58f64249" - name = "golang.org/x/xerrors" - packages = [ - ".", - "internal", - ] - pruneopts = "UT" - revision = "3ee3066db522c6628d440a3a91c4abdd7f5ef22f" - -[[projects]] - digest = "1:d219400f09c151f0ada918bab650ef46f7ebdb1ff4fea923fdcb839481ec7ec1" - name = "gopkg.in/cheggaaa/pb.v1" - packages = ["."] - pruneopts = "UT" - revision = "f907f6f5dd81f77c2bbc1cde92e4c5a04720cb11" - version = "v1.0.28" - -[[projects]] - digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "UT" - revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" - version = "v2.2.2" - -[[projects]] - digest = "1:7ee7d5148e71f169ebba5fa35fc04bf6e9224f91a7d054483a97e56f9bda9ea7" - name = "gotest.tools/gotestsum" - packages = [ - ".", - "internal/junitxml", - "testjson", - ] - pruneopts = "UT" - revision = "ab2fe5eb001028c964502a7ddf7ee721c5826b2c" - version = "v0.1" - -[[projects]] - branch = "master" - digest = "1:ef98efcb9462d27d251466fdc89656c5dbc28f4dc6b428a4270c3ba668ea412d" - name = "mvdan.cc/interfacer" - packages = ["check"] - pruneopts = "UT" - revision = "c20040233aedb03da82d460eca6130fcd91c629a" - -[[projects]] - branch = "master" - digest = "1:521f15c98723cb42db85f5b83980ffa5f707ddaff12976a0d366e6a6cdd1f791" - name = "mvdan.cc/lint" - packages = ["."] - pruneopts = "UT" - revision = "adc824a0674b99099789b6188a058d485eaf61c0" - -[[projects]] - branch = "master" - digest = "1:49663f044145c794116bde2cbcc8045164717b068a3194d26ae2243874de5994" - name = "mvdan.cc/unparam" - packages = ["check"] - pruneopts = "UT" - revision = "1b9ccfa71afe53433971717161c9666adfc4d8c5" - -[[projects]] - digest = "1:ffbeee69d5d01b594a4ca53e359861e3416c70bdbca8d423c72b815f470ecc49" - name = "sourcegraph.com/sqs/pbtypes" - packages = ["."] - pruneopts = "UT" - revision = "688c2c2cb411327a50aae0f89119af9f38b0fc03" - version = "v1.0.0" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "bazil.org/fuse", - "bazil.org/fuse/fs", - "bazil.org/fuse/fs/fstestutil", - "github.com/Kubuxu/go-os-helper", - "github.com/Kubuxu/gocovmerge", - "github.com/blang/semver", - "github.com/bren2010/proquint", - "github.com/cenkalti/backoff", - "github.com/dustin/go-humanize", - "github.com/elgris/jsondiff", - "github.com/fsnotify/fsnotify", - "github.com/gogo/protobuf/proto", - "github.com/golangci/golangci-lint/cmd/golangci-lint", - "github.com/hashicorp/go-multierror", - "github.com/hashicorp/golang-lru", - "github.com/hsanjuan/go-libp2p-http", - "github.com/ipfs/dir-index-html", - "github.com/ipfs/go-bitswap", - "github.com/ipfs/go-bitswap/decision", - "github.com/ipfs/go-bitswap/network", - "github.com/ipfs/go-block-format", - "github.com/ipfs/go-blockservice", - "github.com/ipfs/go-cid", - "github.com/ipfs/go-cidutil", - "github.com/ipfs/go-cidutil/cid-fmt", - "github.com/ipfs/go-cidutil/cidenc", - "github.com/ipfs/go-datastore", - "github.com/ipfs/go-datastore/mount", - "github.com/ipfs/go-datastore/namespace", - "github.com/ipfs/go-datastore/query", - "github.com/ipfs/go-datastore/retrystore", - "github.com/ipfs/go-datastore/sync", - "github.com/ipfs/go-detect-race", - "github.com/ipfs/go-ds-badger", - "github.com/ipfs/go-ds-flatfs", - "github.com/ipfs/go-ds-leveldb", - "github.com/ipfs/go-ds-measure", - "github.com/ipfs/go-fs-lock", - "github.com/ipfs/go-ipfs-blockstore", - "github.com/ipfs/go-ipfs-blocksutil", - "github.com/ipfs/go-ipfs-chunker", - "github.com/ipfs/go-ipfs-cmds", - "github.com/ipfs/go-ipfs-cmds/cli", - "github.com/ipfs/go-ipfs-cmds/http", - "github.com/ipfs/go-ipfs-config", - "github.com/ipfs/go-ipfs-config/serialize", - "github.com/ipfs/go-ipfs-ds-help", - "github.com/ipfs/go-ipfs-exchange-interface", - "github.com/ipfs/go-ipfs-exchange-offline", - "github.com/ipfs/go-ipfs-files", - "github.com/ipfs/go-ipfs-posinfo", - "github.com/ipfs/go-ipfs-routing/mock", - "github.com/ipfs/go-ipfs-routing/none", - "github.com/ipfs/go-ipfs-routing/offline", - "github.com/ipfs/go-ipfs-util", - "github.com/ipfs/go-ipld-cbor", - "github.com/ipfs/go-ipld-format", - "github.com/ipfs/go-ipld-git", - "github.com/ipfs/go-ipns", - "github.com/ipfs/go-ipns/pb", - "github.com/ipfs/go-log", - "github.com/ipfs/go-log/writer", - "github.com/ipfs/go-merkledag", - "github.com/ipfs/go-merkledag/test", - "github.com/ipfs/go-metrics-interface", - "github.com/ipfs/go-metrics-prometheus", - "github.com/ipfs/go-mfs", - "github.com/ipfs/go-path", - "github.com/ipfs/go-path/resolver", - "github.com/ipfs/go-unixfs", - "github.com/ipfs/go-unixfs/file", - "github.com/ipfs/go-unixfs/importer", - "github.com/ipfs/go-unixfs/importer/balanced", - "github.com/ipfs/go-unixfs/importer/helpers", - "github.com/ipfs/go-unixfs/importer/trickle", - "github.com/ipfs/go-unixfs/io", - "github.com/ipfs/go-unixfs/pb", - "github.com/ipfs/go-verifcid", - "github.com/ipfs/hang-fds", - "github.com/ipfs/interface-go-ipfs-core", - "github.com/ipfs/interface-go-ipfs-core/options", - "github.com/ipfs/interface-go-ipfs-core/options/namesys", - "github.com/ipfs/interface-go-ipfs-core/path", - "github.com/ipfs/interface-go-ipfs-core/tests", - "github.com/ipfs/iptb-plugins/local", - "github.com/ipfs/iptb/cli", - "github.com/ipfs/iptb/testbed", - "github.com/jbenet/go-is-domain", - "github.com/jbenet/go-random", - "github.com/jbenet/go-random-files/random-files", - "github.com/jbenet/go-random/random", - "github.com/jbenet/go-temp-err-catcher", - "github.com/jbenet/goprocess", - "github.com/jbenet/goprocess/context", - "github.com/jbenet/goprocess/periodic", - "github.com/jbenet/goprocess/ratelimit", - "github.com/libp2p/go-libp2p", - "github.com/libp2p/go-libp2p-autonat-svc", - "github.com/libp2p/go-libp2p-circuit", - "github.com/libp2p/go-libp2p-connmgr", - "github.com/libp2p/go-libp2p-core/connmgr", - "github.com/libp2p/go-libp2p-core/crypto", - "github.com/libp2p/go-libp2p-core/host", - "github.com/libp2p/go-libp2p-core/metrics", - "github.com/libp2p/go-libp2p-core/mux", - "github.com/libp2p/go-libp2p-core/network", - "github.com/libp2p/go-libp2p-core/peer", - "github.com/libp2p/go-libp2p-core/peerstore", - "github.com/libp2p/go-libp2p-core/protocol", - "github.com/libp2p/go-libp2p-core/routing", - "github.com/libp2p/go-libp2p-core/test", - "github.com/libp2p/go-libp2p-kad-dht", - "github.com/libp2p/go-libp2p-kad-dht/opts", - "github.com/libp2p/go-libp2p-kbucket", - "github.com/libp2p/go-libp2p-loggables", - "github.com/libp2p/go-libp2p-mplex", - "github.com/libp2p/go-libp2p-peerstore/pstoremem", - "github.com/libp2p/go-libp2p-pnet", - "github.com/libp2p/go-libp2p-pubsub", - "github.com/libp2p/go-libp2p-pubsub-router", - "github.com/libp2p/go-libp2p-quic-transport", - "github.com/libp2p/go-libp2p-record", - "github.com/libp2p/go-libp2p-routing-helpers", - "github.com/libp2p/go-libp2p-secio", - "github.com/libp2p/go-libp2p-swarm", - "github.com/libp2p/go-libp2p-swarm/testing", - "github.com/libp2p/go-libp2p-testing/ci", - "github.com/libp2p/go-libp2p-testing/net", - "github.com/libp2p/go-libp2p-tls", - "github.com/libp2p/go-libp2p-yamux", - "github.com/libp2p/go-libp2p/p2p/discovery", - "github.com/libp2p/go-libp2p/p2p/host/basic", - "github.com/libp2p/go-libp2p/p2p/host/routed", - "github.com/libp2p/go-libp2p/p2p/net/mock", - "github.com/libp2p/go-libp2p/p2p/protocol/identify", - "github.com/libp2p/go-libp2p/p2p/protocol/ping", - "github.com/libp2p/go-maddr-filter", - "github.com/mitchellh/go-homedir", - "github.com/mr-tron/base58/base58", - "github.com/multiformats/go-multiaddr", - "github.com/multiformats/go-multiaddr-dns", - "github.com/multiformats/go-multiaddr-net", - "github.com/multiformats/go-multibase", - "github.com/multiformats/go-multihash", - "github.com/multiformats/go-multihash/multihash", - "github.com/opentracing/opentracing-go", - "github.com/pkg/errors", - "github.com/prometheus/client_golang/prometheus", - "github.com/prometheus/client_golang/prometheus/promhttp", - "github.com/syndtr/goleveldb/leveldb/opt", - "github.com/whyrusleeping/base32", - "github.com/whyrusleeping/go-sysinfo", - "github.com/whyrusleeping/multiaddr-filter", - "github.com/whyrusleeping/sql-datastore/postgres", - "github.com/whyrusleeping/tar-utils", - "go.uber.org/fx", - "golang.org/x/sys/unix", - "gopkg.in/cheggaaa/pb.v1", - "gotest.tools/gotestsum", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/ipfs/go-ipfs/Gopkg.toml b/vendor/github.com/ipfs/go-ipfs/Gopkg.toml deleted file mode 100644 index 53699ef2..00000000 --- a/vendor/github.com/ipfs/go-ipfs/Gopkg.toml +++ /dev/null @@ -1,443 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - - -[[constraint]] - branch = "master" - name = "bazil.org/fuse" - -[[constraint]] - name = "github.com/Kubuxu/go-os-helper" - version = "0.0.1" - -[[constraint]] - branch = "master" - name = "github.com/Kubuxu/gocovmerge" - -[[constraint]] - name = "github.com/blang/semver" - version = "3.6.1" - -[[constraint]] - branch = "master" - name = "github.com/bren2010/proquint" - -[[constraint]] - name = "github.com/cenkalti/backoff" - version = "3.0.0" - -[[constraint]] - name = "github.com/dustin/go-humanize" - version = "1.0.0" - -[[constraint]] - branch = "master" - name = "github.com/elgris/jsondiff" - -[[constraint]] - name = "github.com/fsnotify/fsnotify" - version = "1.4.7" - -[[constraint]] - name = "github.com/gogo/protobuf" - version = "1.2.1" - -[[constraint]] - name = "github.com/golangci/golangci-lint" - version = "1.17.1" - -[[constraint]] - name = "github.com/hashicorp/go-multierror" - version = "1.0.0" - -[[constraint]] - name = "github.com/hashicorp/golang-lru" - version = "0.5.1" - -[[constraint]] - name = "github.com/hsanjuan/go-libp2p-http" - version = "0.1.2" - -[[constraint]] - name = "github.com/ipfs/dir-index-html" - version = "1.0.3" - -[[constraint]] - name = "github.com/ipfs/go-bitswap" - version = "0.1.1" - -[[constraint]] - name = "github.com/ipfs/go-block-format" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-blockservice" - version = "0.1.0" - -[[constraint]] - name = "github.com/ipfs/go-cid" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-cidutil" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-datastore" - version = "0.0.5" - -[[constraint]] - name = "github.com/ipfs/go-detect-race" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ds-badger" - version = "0.0.3" - -[[constraint]] - name = "github.com/ipfs/go-ds-flatfs" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-ds-leveldb" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-ds-measure" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-fs-lock" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-blockstore" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-blocksutil" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-chunker" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-cmds" - version = "0.0.10" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-config" - source = "github.com/vulcanize/go-ipfs-config" - revision = "4a51393611d9580d17ecbccb0c4aec5eb81f21ce" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-ds-help" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-exchange-interface" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-exchange-offline" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-files" - version = "0.0.3" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-posinfo" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-routing" - version = "0.1.0" - -[[constraint]] - name = "github.com/ipfs/go-ipfs-util" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-ipld-cbor" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-ipld-format" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-ipld-git" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-ipns" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-log" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-merkledag" - version = "0.1.0" - -[[constraint]] - name = "github.com/ipfs/go-metrics-interface" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/go-metrics-prometheus" - version = "0.0.2" - -[[constraint]] - name = "github.com/ipfs/go-mfs" - version = "0.1.0" - -[[constraint]] - name = "github.com/ipfs/go-path" - version = "0.0.7" - -[[constraint]] - name = "github.com/ipfs/go-unixfs" - version = "0.0.8" - -[[constraint]] - name = "github.com/ipfs/go-verifcid" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/hang-fds" - version = "0.0.1" - -[[constraint]] - name = "github.com/ipfs/interface-go-ipfs-core" - version = "0.1.0" - -[[constraint]] - name = "github.com/ipfs/iptb" - version = "1.4.0" - -[[constraint]] - name = "github.com/ipfs/iptb-plugins" - version = "0.1.0" - -[[constraint]] - name = "github.com/jbenet/go-is-domain" - version = "1.0.2" - -[[constraint]] - branch = "master" - name = "github.com/jbenet/go-random" - -[[constraint]] - branch = "master" - name = "github.com/jbenet/go-random-files" - -[[constraint]] - branch = "master" - name = "github.com/jbenet/go-temp-err-catcher" - -[[constraint]] - name = "github.com/jbenet/goprocess" - version = "0.1.3" - -[[constraint]] - name = "github.com/libp2p/go-libp2p" - version = "0.1.1" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-autonat-svc" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-circuit" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-connmgr" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-core" - version = "0.0.3" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-kad-dht" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-kbucket" - version = "0.2.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-loggables" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-mplex" - version = "0.2.1" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-peerstore" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-pnet" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-pubsub" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-pubsub-router" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-quic-transport" - version = "0.1.1" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-record" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-routing-helpers" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-secio" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-swarm" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-testing" - version = "0.0.4" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-tls" - version = "0.1.0" - -[[constraint]] - name = "github.com/libp2p/go-libp2p-yamux" - version = "0.2.1" - -[[constraint]] - name = "github.com/libp2p/go-maddr-filter" - version = "0.0.4" - -[[constraint]] - name = "github.com/mitchellh/go-homedir" - version = "1.1.0" - -[[constraint]] - name = "github.com/mr-tron/base58" - version = "1.1.2" - -[[constraint]] - name = "github.com/multiformats/go-multiaddr" - version = "0.0.4" - -[[constraint]] - name = "github.com/multiformats/go-multiaddr-dns" - version = "0.0.2" - -[[constraint]] - name = "github.com/multiformats/go-multiaddr-net" - version = "0.0.1" - -[[constraint]] - name = "github.com/multiformats/go-multibase" - version = "0.0.1" - -[[constraint]] - name = "github.com/multiformats/go-multihash" - version = "0.0.5" - -[[constraint]] - name = "github.com/opentracing/opentracing-go" - version = "1.1.0" - -[[constraint]] - name = "github.com/pkg/errors" - version = "0.8.1" - -[[constraint]] - name = "github.com/prometheus/client_golang" - version = "0.9.4" - -[[constraint]] - name = "github.com/syndtr/goleveldb" - version = "1.0.0" - -[[constraint]] - branch = "master" - name = "github.com/whyrusleeping/base32" - -[[constraint]] - branch = "master" - name = "github.com/whyrusleeping/go-sysinfo" - -[[constraint]] - branch = "master" - name = "github.com/whyrusleeping/multiaddr-filter" - -[[constraint]] - branch = "master" - name = "github.com/whyrusleeping/tar-utils" - -[[constraint]] - name = "go.uber.org/fx" - version = "1.9.0" - -[[constraint]] - branch = "master" - name = "golang.org/x/sys" - -[[constraint]] - name = "gopkg.in/cheggaaa/pb.v1" - version = "1.0.28" - -[[constraint]] - name = "gotest.tools/gotestsum" - version = "0.1.0" - -[[constraint]] - branch = "master" - name = "github.com/whyrusleeping/sql-datastore" - -[[override]] - name = "github.com/dgraph-io/badger" - revision = "0ce1d2e26af1ba8b8a72ea864145a3e1e3b382cd" - -[prune] - go-tests = true - unused-packages = true diff --git a/vendor/github.com/ipfs/go-ipfs/LICENSE-APACHE b/vendor/github.com/ipfs/go-ipfs/LICENSE-APACHE deleted file mode 100644 index 14478a3b..00000000 --- a/vendor/github.com/ipfs/go-ipfs/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/vendor/github.com/ipfs/go-ipfs/LICENSE-MIT b/vendor/github.com/ipfs/go-ipfs/LICENSE-MIT deleted file mode 100644 index 72dc60d8..00000000 --- a/vendor/github.com/ipfs/go-ipfs/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs/Makefile b/vendor/github.com/ipfs/go-ipfs/Makefile deleted file mode 100644 index 4c175dbc..00000000 --- a/vendor/github.com/ipfs/go-ipfs/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# General tools - -SHELL=PATH='$(PATH)' /bin/sh - -# enable second expansion -.SECONDEXPANSION: - -include Rules.mk diff --git a/vendor/github.com/ipfs/go-ipfs/README.md b/vendor/github.com/ipfs/go-ipfs/README.md deleted file mode 100644 index a4af02c0..00000000 --- a/vendor/github.com/ipfs/go-ipfs/README.md +++ /dev/null @@ -1,434 +0,0 @@ -# go-ipfs - -![banner](https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png) - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-ipfs?status.svg)](https://godoc.org/github.com/ipfs/go-ipfs) -[![Build Status](https://travis-ci.com/ipfs/go-ipfs.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs) - -## What is IPFS? - -IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bittorrent swarm, exchanging git objects. IPFS provides an interface as simple as the HTTP web, but with permanence built in. You can also mount the world at /ipfs. - -For more info see: https://github.com/ipfs/ipfs. - -Please put all issues regarding: - - IPFS _design_ in the [ipfs repo issues](https://github.com/ipfs/ipfs/issues). - - Go IPFS _implementation_ in [this repo](https://github.com/ipfs/go-ipfs/issues). - -## Table of Contents - -- [Security Issues](#security-issues) -- [Install](#install) - - [System Requirements](#system-requirements) - - [Install prebuilt packages](#install-prebuilt-packages) - - [From Linux package managers](#from-linux-package-managers) - - [Build from Source](#build-from-source) - - [Install Go](#install-go) - - [Download and Compile IPFS](#download-and-compile-ipfs) - - [Troubleshooting](#troubleshooting) - - [Development Dependencies](#development-dependencies) - - [Updating](#updating-go-ipfs) -- [Usage](#usage) -- [Getting Started](#getting-started) - - [Some things to try](#some-things-to-try) - - [Docker usage](#docker-usage) - - [Troubleshooting](#troubleshooting-1) -- [Packages](#packages) -- [Development](#development) -- [Contributing](#contributing) -- [License](#license) - -## Security Issues - -The IPFS protocol and its implementations are still in heavy development. This means that there may be problems in our protocols, or there may be mistakes in our implementations. And -- though IPFS is not production-ready yet -- many people are already running nodes in their machines. So we take security vulnerabilities very seriously. If you discover a security issue, please bring it to our attention right away! - -If you find a vulnerability that may affect live deployments -- for example, by exposing a remote execution exploit -- please send your report privately to security@ipfs.io. Please DO NOT file a public issue. The GPG key for security@ipfs.io is [4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3](https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3). - -If the issue is a protocol weakness that cannot be immediately exploited or something not yet deployed, just discuss it openly. - -## Install - -The canonical download instructions for IPFS are over at: https://docs.ipfs.io/introduction/install/. It is **highly suggested** you follow those instructions if you are not interested in working on IPFS development. - -### System Requirements - -IPFS can run on most Linux, macOS, and Windows systems. We recommend running it on a machine with at least 2 GB of RAM (it’ll do fine with only one CPU core), but it should run fine with as little as 1 GB of RAM. On systems with less memory, it may not be completely stable. - -### Install prebuilt packages - -We host prebuilt binaries over at our [distributions page](https://ipfs.io/ipns/dist.ipfs.io#go-ipfs). - -From there: -- Click the blue "Download go-ipfs" on the right side of the page. -- Open/extract the archive. -- Move `ipfs` to your path (`install.sh` can do it for you). - -You can also download go-ipfs from this project's GitHub releases page if you are unable to access ipfs.io. - -### From Linux package managers - -- [Arch Linux](#arch-linux) -- [Nix](#nix) -- [Snap](#snap) - -#### Arch Linux - -In Arch Linux go-ipfs is available as -[go-ipfs](https://www.archlinux.org/packages/community/x86_64/go-ipfs/) package. - -``` -$ sudo pacman -S go-ipfs -``` - -Development version of go-ipfs is also on AUR under -[go-ipfs-git](https://aur.archlinux.org/packages/go-ipfs-git/). -You can install it using your favourite AUR Helper or manually from AUR. - -#### Nix - -For Linux and MacOSX you can use the purely functional package manager [Nix](https://nixos.org/nix/): - -``` -$ nix-env -i ipfs -``` - -You can also install the Package by using it's attribute name, which is also `ipfs`. - -#### Guix - -GNU's functional package manager, [Guix](https://www.gnu.org/software/guix/), also provides a go-ipfs package: - -``` -$ guix package -i go-ipfs -``` - -#### Snap - -With snap, in any of the [supported Linux distributions](https://snapcraft.io/docs/core/install): - -``` -$ sudo snap install ipfs -``` - -### From Windows package managers - -- [Chocolatey](#chocolatey) - -#### Chocolatey - -The package [ipfs](https://chocolatey.org/packages/ipfs) currently points to go-ipfs and is being maintained. - -```Powershell -PS> choco install ipfs -``` - -### Build from Source - -#### Install Go - -The build process for ipfs requires Go 1.11 or higher. If you don't have it: [Download Go 1.11+](https://golang.org/dl/). - -You'll need to add Go's bin directories to your `$PATH` environment variable e.g., by adding these lines to your `/etc/profile` (for a system-wide installation) or `$HOME/.profile`: - -``` -export PATH=$PATH:/usr/local/go/bin -export PATH=$PATH:$GOPATH/bin -``` - -(If you run into trouble, see the [Go install instructions](https://golang.org/doc/install)). - -#### Download and Compile IPFS - -``` -$ git clone https://github.com/ipfs/go-ipfs.git - -$ cd go-ipfs -$ make install -``` - -If you are building on a non-GNU system, use `gmake` in place of `make`. -Unsupported platforms (run `(g)make supported` for a list) will also need to set the `nofuse` gotag during build. -``` -$ GOTAGS=nofuse (g)make install -``` - -#### Troubleshooting - -- Separate [instructions are available for building on Windows](docs/windows.md). -- `git` is required in order for `go get` to fetch all dependencies. -- Package managers often contain out-of-date `golang` packages. - Ensure that `go version` reports at least 1.10. See above for how to install go. -- If you are interested in development, please install the development -dependencies as well. -- _WARNING_: Older versions of OSX FUSE (for Mac OS X) can cause kernel panics when mounting!- - We strongly recommend you use the [latest version of OSX FUSE](http://osxfuse.github.io/). - (See https://github.com/ipfs/go-ipfs/issues/177) -- For more details on setting up FUSE (so that you can mount the filesystem), see the docs folder. -- Shell command completion is available in `misc/completion/ipfs-completion.bash`. Read [docs/command-completion.md](docs/command-completion.md) to learn how to install it. -- See the [init examples](https://github.com/ipfs/website/tree/master/static/docs/examples/init) for how to connect IPFS to systemd or whatever init system your distro uses. - -### Updating go-ipfs - -#### Using ipfs-update - -IPFS has an updating tool that can be accessed through `ipfs update`. The tool is -not installed alongside IPFS in order to keep that logic independent of the main -codebase. To install `ipfs update`, [download it here](https://ipfs.io/ipns/dist.ipfs.io/#ipfs-update). - -#### Downloading IPFS builds using IPFS - -List the available versions of go-ipfs: - -``` -$ ipfs cat /ipns/dist.ipfs.io/go-ipfs/versions -``` - -Then, to view available builds for a version from the previous command ($VERSION): - -``` -$ ipfs ls /ipns/dist.ipfs.io/go-ipfs/$VERSION -``` - -To download a given build of a version: - -``` -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_darwin-386.tar.gz # darwin 32-bit build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_darwin-amd64.tar.gz # darwin 64-bit build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_freebsd-amd64.tar.gz # freebsd 64-bit build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-386.tar.gz # linux 32-bit build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-amd64.tar.gz # linux 64-bit build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-arm.tar.gz # linux arm build -$ ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_windows-amd64.zip # windows 64-bit build -``` - -## Usage - -``` - ipfs - Global p2p merkle-dag filesystem. - - ipfs [] [] ... - -SUBCOMMANDS - BASIC COMMANDS - init Initialize ipfs local configuration - add Add a file to ipfs - cat Show ipfs object data - get Download ipfs objects - ls List links from an object - refs List hashes of links from an object - - DATA STRUCTURE COMMANDS - block Interact with raw blocks in the datastore - object Interact with raw dag nodes - files Interact with objects as if they were a unix filesystem - - ADVANCED COMMANDS - daemon Start a long-running daemon process - mount Mount an ipfs read-only mountpoint - resolve Resolve any type of name - name Publish or resolve IPNS names - dns Resolve DNS links - pin Pin objects to local storage - repo Manipulate an IPFS repository - - NETWORK COMMANDS - id Show info about ipfs peers - bootstrap Add or remove bootstrap peers - swarm Manage connections to the p2p network - dht Query the DHT for values or peers - ping Measure the latency of a connection - diag Print diagnostics - - TOOL COMMANDS - config Manage configuration - version Show ipfs version information - update Download and apply go-ipfs updates - commands List all available commands - - Use 'ipfs --help' to learn more about each command. - - ipfs uses a repository in the local file system. By default, the repo is located - at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable: - - export IPFS_PATH=/path/to/ipfsrepo -``` - -## Getting Started - -See also: http://ipfs.io/docs/getting-started/ - -To start using IPFS, you must first initialize IPFS's config files on your -system, this is done with `ipfs init`. See `ipfs init --help` for information on -the optional arguments it takes. After initialization is complete, you can use -`ipfs mount`, `ipfs add` and any of the other commands to explore! - -### Some things to try - -Basic proof of 'ipfs working' locally: - - echo "hello world" > hello - ipfs add hello - # This should output a hash string that looks something like: - # QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o - ipfs cat - - -### Docker usage - -An IPFS docker image is hosted at [hub.docker.com/r/ipfs/go-ipfs](https://hub.docker.com/r/ipfs/go-ipfs/). -To make files visible inside the container you need to mount a host directory -with the `-v` option to docker. Choose a directory that you want to use to -import/export files from IPFS. You should also choose a directory to store -IPFS files that will persist when you restart the container. - - export ipfs_staging= - export ipfs_data= - -Start a container running ipfs and expose ports 4001, 5001 and 8080: - - docker run -d --name ipfs_host -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest - -Watch the ipfs log: - - docker logs -f ipfs_host - -Wait for ipfs to start. ipfs is running when you see: - - Gateway (readonly) server - listening on /ip4/0.0.0.0/tcp/8080 - -You can now stop watching the log. - -Run ipfs commands: - - docker exec ipfs_host ipfs - -For example: connect to peers - - docker exec ipfs_host ipfs swarm peers - -Add files: - - cp -r $ipfs_staging - docker exec ipfs_host ipfs add -r /export/ - -Stop the running container: - - docker stop ipfs_host - -When starting a container running ipfs for the first time with an empty data directory, it will call `ipfs init` to initialize configuration files and generate a new keypair. At this time, you can choose which profile to apply using the `IPFS_PROFILE` environment variable: - - docker run -d --name ipfs_host -e IPFS_PROFILE=server -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest - -### Troubleshooting - -If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries. - -Please direct general questions and help requests to our [forum](https://discuss.ipfs.io) or our IRC channel (freenode #ipfs). - -If you believe you've found a bug, check the [issues list](https://github.com/ipfs/go-ipfs/issues) and, if you don't see your problem there, either come talk to us on IRC (freenode #ipfs) or file an issue of your own! - -## Packages - -> This table is generated using the module [`package-table`](https://github.com/ipfs-shipyard/package-table) with `package-table --data=package-list.json`. - -Listing of the main packages used in the IPFS ecosystem. There are also three specifications worth linking here: - -| Name | CI/Travis | Coverage | Description | -| ---------|---------|---------|--------- | -| **Files** | -| [`go-unixfs`](//github.com/ipfs/go-unixfs) | [![Travis CI](https://travis-ci.com/ipfs/go-unixfs.svg?branch=master)](https://travis-ci.com/ipfs/go-unixfs) | [![codecov](https://codecov.io/gh/ipfs/go-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-unixfs) | the core 'filesystem' logic | -| [`go-mfs`](//github.com/ipfs/go-mfs) | [![Travis CI](https://travis-ci.com/ipfs/go-mfs.svg?branch=master)](https://travis-ci.com/ipfs/go-mfs) | [![codecov](https://codecov.io/gh/ipfs/go-mfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-mfs) | a mutable filesystem editor for unixfs | -| [`go-ipfs-posinfo`](//github.com/ipfs/go-ipfs-posinfo) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-posinfo.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-posinfo) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-posinfo/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-posinfo) | helper datatypes for the filestore | -| [`go-ipfs-chunker`](//github.com/ipfs/go-ipfs-chunker) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-chunker.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-chunker) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-chunker/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-chunker) | file chunkers | -| **Exchange** | -| [`go-ipfs-exchange-interface`](//github.com/ipfs/go-ipfs-exchange-interface) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-exchange-interface.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-exchange-interface) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-exchange-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-exchange-interface) | exchange service interface | -| [`go-ipfs-exchange-offline`](//github.com/ipfs/go-ipfs-exchange-offline) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-exchange-offline.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-exchange-offline) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-exchange-offline/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-exchange-offline) | (dummy) offline implementation of the exchange service | -| [`go-bitswap`](//github.com/ipfs/go-bitswap) | [![Travis CI](https://travis-ci.com/ipfs/go-bitswap.svg?branch=master)](https://travis-ci.com/ipfs/go-bitswap) | [![codecov](https://codecov.io/gh/ipfs/go-bitswap/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-bitswap) | bitswap protocol implementation | -| [`go-blockservice`](//github.com/ipfs/go-blockservice) | [![Travis CI](https://travis-ci.com/ipfs/go-blockservice.svg?branch=master)](https://travis-ci.com/ipfs/go-blockservice) | [![codecov](https://codecov.io/gh/ipfs/go-blockservice/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-blockservice) | service that plugs a blockstore and an exchange together | -| **Datastores** | -| [`go-datastore`](//github.com/ipfs/go-datastore) | [![Travis CI](https://travis-ci.com/ipfs/go-datastore.svg?branch=master)](https://travis-ci.com/ipfs/go-datastore) | [![codecov](https://codecov.io/gh/ipfs/go-datastore/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-datastore) | datastore interfaces, adapters, and basic implementations | -| [`go-ipfs-ds-help`](//github.com/ipfs/go-ipfs-ds-help) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-ds-help.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-ds-help) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-ds-help/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-ds-help) | datastore utility functions | -| [`go-ds-flatfs`](//github.com/ipfs/go-ds-flatfs) | [![Travis CI](https://travis-ci.com/ipfs/go-ds-flatfs.svg?branch=master)](https://travis-ci.com/ipfs/go-ds-flatfs) | [![codecov](https://codecov.io/gh/ipfs/go-ds-flatfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ds-flatfs) | a filesystem-based datastore | -| [`go-ds-measure`](//github.com/ipfs/go-ds-measure) | [![Travis CI](https://travis-ci.com/ipfs/go-ds-measure.svg?branch=master)](https://travis-ci.com/ipfs/go-ds-measure) | [![codecov](https://codecov.io/gh/ipfs/go-ds-measure/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ds-measure) | a metric-collecting database adapter | -| [`go-ds-leveldb`](//github.com/ipfs/go-ds-leveldb) | [![Travis CI](https://travis-ci.com/ipfs/go-ds-leveldb.svg?branch=master)](https://travis-ci.com/ipfs/go-ds-leveldb) | [![codecov](https://codecov.io/gh/ipfs/go-ds-leveldb/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ds-leveldb) | a leveldb based datastore | -| [`go-ds-badger`](//github.com/ipfs/go-ds-badger) | [![Travis CI](https://travis-ci.com/ipfs/go-ds-badger.svg?branch=master)](https://travis-ci.com/ipfs/go-ds-badger) | [![codecov](https://codecov.io/gh/ipfs/go-ds-badger/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ds-badger) | a badgerdb based datastore | -| **Namesys** | -| [`go-ipns`](//github.com/ipfs/go-ipns) | [![Travis CI](https://travis-ci.com/ipfs/go-ipns.svg?branch=master)](https://travis-ci.com/ipfs/go-ipns) | [![codecov](https://codecov.io/gh/ipfs/go-ipns/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipns) | IPNS datastructures and validation logic | -| **Repo** | -| [`go-ipfs-config`](//github.com/ipfs/go-ipfs-config) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-config.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-config) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-config/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-config) | go-ipfs config file definitions | -| [`go-fs-lock`](//github.com/ipfs/go-fs-lock) | [![Travis CI](https://travis-ci.com/ipfs/go-fs-lock.svg?branch=master)](https://travis-ci.com/ipfs/go-fs-lock) | [![codecov](https://codecov.io/gh/ipfs/go-fs-lock/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-fs-lock) | lockfile management functions | -| [`fs-repo-migrations`](//github.com/ipfs/fs-repo-migrations) | [![Travis CI](https://travis-ci.com/ipfs/fs-repo-migrations.svg?branch=master)](https://travis-ci.com/ipfs/fs-repo-migrations) | [![codecov](https://codecov.io/gh/ipfs/fs-repo-migrations/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/fs-repo-migrations) | repo migrations | -| **Blocks** | -| [`go-block-format`](//github.com/ipfs/go-block-format) | [![Travis CI](https://travis-ci.com/ipfs/go-block-format.svg?branch=master)](https://travis-ci.com/ipfs/go-block-format) | [![codecov](https://codecov.io/gh/ipfs/go-block-format/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-block-format) | block interfaces and implementations | -| [`go-ipfs-blockstore`](//github.com/ipfs/go-ipfs-blockstore) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-blockstore.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-blockstore) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-blockstore/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-blockstore) | blockstore interfaces and implementations | -| **Commands** | -| [`go-ipfs-cmds`](//github.com/ipfs/go-ipfs-cmds) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-cmds.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-cmds) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-cmds/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-cmds) | CLI & HTTP commands library | -| [`go-ipfs-api`](//github.com/ipfs/go-ipfs-api) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-api.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-api) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-api/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-api) | a shell for the IPFS HTTP API | -| **Metrics & Logging** | -| [`go-metrics-interface`](//github.com/ipfs/go-metrics-interface) | [![Travis CI](https://travis-ci.com/ipfs/go-metrics-interface.svg?branch=master)](https://travis-ci.com/ipfs/go-metrics-interface) | [![codecov](https://codecov.io/gh/ipfs/go-metrics-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-metrics-interface) | metrics collection interfaces | -| [`go-metrics-prometheus`](//github.com/ipfs/go-metrics-prometheus) | [![Travis CI](https://travis-ci.com/ipfs/go-metrics-prometheus.svg?branch=master)](https://travis-ci.com/ipfs/go-metrics-prometheus) | [![codecov](https://codecov.io/gh/ipfs/go-metrics-prometheus/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-metrics-prometheus) | prometheus-backed metrics collector | -| [`go-log`](//github.com/ipfs/go-log) | [![Travis CI](https://travis-ci.com/ipfs/go-log.svg?branch=master)](https://travis-ci.com/ipfs/go-log) | [![codecov](https://codecov.io/gh/ipfs/go-log/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-log) | logging framework | -| **Generics/Utils** | -| [`go-ipfs-routing`](//github.com/ipfs/go-ipfs-routing) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-routing.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-routing) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-routing/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-routing) | routing (content, peer, value) helpers | -| [`go-ipfs-util`](//github.com/ipfs/go-ipfs-util) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-util.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-util) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-util/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-util) | the kitchen sink | -| [`go-ipfs-addr`](//github.com/ipfs/go-ipfs-addr) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-addr.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-addr) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-addr/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-addr) | utility functions for parsing IPFS multiaddrs | - -For brevity, we've omitted go-libp2p and go-ipld packages. These package tables can be found in their respective project's READMEs: - -* [go-libp2p](https://github.com/libp2p/go-libp2p#packages) -* [go-ipld](https://github.com/ipld/go-ipld#packages) - -## Development - -Some places to get you started on the codebase: - -- Main file: [./cmd/ipfs/main.go](https://github.com/ipfs/go-ipfs/blob/master/cmd/ipfs/main.go) -- CLI Commands: [./core/commands/](https://github.com/ipfs/go-ipfs/tree/master/core/commands) -- Bitswap (the data trading engine): [go-bitswap](https://github.com/ipfs/go-bitswap) -- libp2p - - libp2p: https://github.com/libp2p/go-libp2p - - DHT: https://github.com/libp2p/go-libp2p-kad-dht - - PubSub: https://github.com/libp2p/go-libp2p-pubsub -- [IPFS : The `Add` command demystified](https://github.com/ipfs/go-ipfs/tree/master/docs/add-code-flow.md) - -### CLI, HTTP-API, Architecture Diagram - -![](./docs/cli-http-api-core-diagram.png) - -> [Origin](https://github.com/ipfs/pm/pull/678#discussion_r210410924) - -Description: Dotted means "likely going away". The "Legacy" parts are thin wrappers around some commands to translate between the new system and the old system. The grayed-out parts on the "daemon" diagram are there to show that the code is all the same, it's just that we turn some pieces on and some pieces off depending on whether we're running on the client or the server. - -### Testing - -``` -make test -``` - -### Development Dependencies - -If you make changes to the protocol buffers, you will need to install the [protoc compiler](https://github.com/google/protobuf). - -### Developer Notes - -Find more documentation for developers on [docs](./docs) - -## Contributing - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) - -We ❤️ all [our contributors](docs/AUTHORS); this project wouldn’t be what it is without you! If you want to help out, please see [CONTRIBUTING.md](CONTRIBUTING.md). - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -You can contact us on the freenode #ipfs-dev channel or attend one of our -[weekly calls](https://github.com/ipfs/team-mgmt/issues/674). - -## License - -[MIT](./LICENSE) diff --git a/vendor/github.com/ipfs/go-ipfs/Rules.mk b/vendor/github.com/ipfs/go-ipfs/Rules.mk deleted file mode 100644 index d4bdf361..00000000 --- a/vendor/github.com/ipfs/go-ipfs/Rules.mk +++ /dev/null @@ -1,150 +0,0 @@ -TGT_BIN := -CLEAN := -COVERAGE := -DISTCLEAN := -TEST := -TEST_SHORT := -GOCC ?= go -PROTOC ?= protoc - -all: help # all has to be first defined target -.PHONY: all - -include mk/git.mk # has to be before tarball.mk -include mk/tarball.mk -include mk/util.mk -include mk/golang.mk - -# -------------------- # -# extra properties # -# -------------------- # - -ifeq ($(TEST_NO_FUSE),1) - GOTAGS += nofuse -endif -export IPFS_REUSEPORT=false - -# -------------------- # -# sub-files # -# -------------------- # -dir := bin -include $(dir)/Rules.mk - -# tests need access to rules from plugin -dir := plugin -include $(dir)/Rules.mk - -dir := test -include $(dir)/Rules.mk - -dir := cmd/ipfs -include $(dir)/Rules.mk - -# include this file only if coverage target is executed -# it is quite expensive -ifneq ($(filter coverage% clean distclean test/unit/gotest.junit.xml,$(MAKECMDGOALS)),) - # has to be after cmd/ipfs due to PATH - dir := coverage - include $(dir)/Rules.mk -endif - -dir := pin/internal/pb -include $(dir)/Rules.mk - -dir := filestore/pb -include $(dir)/Rules.mk - - -# -------------------- # -# universal rules # -# -------------------- # - -%.pb.go: %.proto bin/protoc-gen-gogofaster - $(PROTOC) --gogofaster_out=. --proto_path=.:$(GOPATH)/src:$(dir $@) $< - -# -------------------- # -# core targets # -# -------------------- # - -build: $(TGT_BIN) -.PHONY: build - -clean: - rm -rf $(CLEAN) -.PHONY: clean - -coverage: $(COVERAGE) -.PHONY: coverage - -distclean: clean - rm -rf $(DISTCLEAN) - git clean -ffxd -.PHONY: distclean - -test: $(TEST) -.PHONY: test - -test_short: $(TEST_SHORT) -.PHONY: test_short - -deps: -.PHONY: deps - -nofuse: GOTAGS += nofuse -nofuse: build -.PHONY: nofuse - -install: cmd/ipfs-install -.PHONY: install - -install_unsupported: install - @echo "/=======================================================================\\" - @echo '| |' - @echo '| `make install_unsupported` is deprecated, use `make install` instead. |' - @echo '| |' - @echo "\\=======================================================================/" -.PHONY: install_unsupported - -uninstall: - $(GOCC) clean -i ./cmd/ipfs -.PHONY: uninstall - -supported: - @echo "Currently supported platforms:" - @for p in ${SUPPORTED_PLATFORMS}; do echo $$p; done -.PHONY: supported - -help: - @echo 'DEPENDENCY TARGETS:' - @echo '' - @echo ' deps - Download dependencies using bundled gx' - @echo ' test_sharness_deps - Download and build dependencies for sharness' - @echo '' - @echo 'BUILD TARGETS:' - @echo '' - @echo ' all - print this help message' - @echo ' build - Build binary at ./cmd/ipfs/ipfs' - @echo ' nofuse - Build binary with no fuse support' - @echo ' install - Build binary and install into $$GOPATH/bin' -# @echo ' dist_install - TODO: c.f. ./cmd/ipfs/dist/README.md' - @echo '' - @echo 'CLEANING TARGETS:' - @echo '' - @echo ' clean - Remove files generated by build' - @echo ' distclean - Remove files that are no part of a repository' - @echo ' uninstall - Remove binary from $$GOPATH/bin' - @echo '' - @echo 'TESTING TARGETS:' - @echo '' - @echo ' test - Run all tests' - @echo ' test_short - Run short go tests and short sharness tests' - @echo ' test_go_short - Run short go tests' - @echo ' test_go_test - Run all go tests' - @echo ' test_go_expensive - Run all go tests and compile on all platforms' - @echo ' test_go_race - Run go tests with the race detector enabled' - @echo ' test_go_lint - Run the `golangci-lint` vetting tool' - @echo ' test_sharness_short - Run short sharness tests' - @echo ' test_sharness_expensive - Run all sharness tests' - @echo ' coverage - Collects coverage info from unit tests and sharness' - @echo -.PHONY: help diff --git a/vendor/github.com/ipfs/go-ipfs/appveyor.yml b/vendor/github.com/ipfs/go-ipfs/appveyor.yml deleted file mode 100644 index 696102ff..00000000 --- a/vendor/github.com/ipfs/go-ipfs/appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Notes: -# - Minimal appveyor.yml file is an empty file. All sections are optional. -# - Indent each level of configuration with 2 spaces. Do not use tabs! -# - All section names are case-sensitive. -# - Section names should be unique on each level. - -version: "{build}" - -os: Windows Server 2012 R2 - -clone_folder: c:\gopath\src\github.com\ipfs\go-ipfs - -environment: - GOPATH: c:\gopath - TEST_VERBOSE: 1 - #TEST_NO_FUSE: 1 - #TEST_SUITE: test_sharness_expensive - #GOFLAGS: -tags nofuse - global: - BASH: C:\cygwin\bin\bash - matrix: - - GOARCH: amd64 - GOVERSION: 1.5.1 - GOROOT: c:\go - DOWNLOADPLATFORM: "x64" - -install: - # Enable make - #- SET PATH=c:\MinGW\bin;%PATH% - #- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe - - go version - - go env - -# Cygwin build script -# -# NOTES: -# -# The stdin/stdout file descriptor appears not to be valid for the Appveyor -# build which causes failures as certain functions attempt to redirect -# default file handles. Ensure a dummy file descriptor is opened with 'exec'. -# -build_script: - - '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0= cfg.MinPeerThreshold { - log.Event(ctx, "bootstrapSkip", id) - log.Debugf("%s core bootstrap skipped -- connected to %d (> %d) nodes", - id, len(connected), cfg.MinPeerThreshold) - return nil - } - numToDial := cfg.MinPeerThreshold - len(connected) - - // filter out bootstrap nodes we are already connected to - var notConnected []peer.AddrInfo - for _, p := range peers { - if host.Network().Connectedness(p.ID) != network.Connected { - notConnected = append(notConnected, p) - } - } - - // if connected to all bootstrap peer candidates, exit - if len(notConnected) < 1 { - log.Debugf("%s no more bootstrap peers to create %d connections", id, numToDial) - return ErrNotEnoughBootstrapPeers - } - - // connect to a random susbset of bootstrap candidates - randSubset := randomSubsetOfPeers(notConnected, numToDial) - - defer log.EventBegin(ctx, "bootstrapStart", id).Done() - log.Debugf("%s bootstrapping to %d nodes: %s", id, numToDial, randSubset) - return bootstrapConnect(ctx, host, randSubset) -} - -func bootstrapConnect(ctx context.Context, ph host.Host, peers []peer.AddrInfo) error { - if len(peers) < 1 { - return ErrNotEnoughBootstrapPeers - } - - errs := make(chan error, len(peers)) - var wg sync.WaitGroup - for _, p := range peers { - - // performed asynchronously because when performed synchronously, if - // one `Connect` call hangs, subsequent calls are more likely to - // fail/abort due to an expiring context. - // Also, performed asynchronously for dial speed. - - wg.Add(1) - go func(p peer.AddrInfo) { - defer wg.Done() - defer log.EventBegin(ctx, "bootstrapDial", ph.ID(), p.ID).Done() - log.Debugf("%s bootstrapping to %s", ph.ID(), p.ID) - - ph.Peerstore().AddAddrs(p.ID, p.Addrs, peerstore.PermanentAddrTTL) - if err := ph.Connect(ctx, p); err != nil { - log.Event(ctx, "bootstrapDialFailed", p.ID) - log.Debugf("failed to bootstrap with %v: %s", p.ID, err) - errs <- err - return - } - log.Event(ctx, "bootstrapDialSuccess", p.ID) - log.Infof("bootstrapped with %v", p.ID) - }(p) - } - wg.Wait() - - // our failure condition is when no connection attempt succeeded. - // So drain the errs channel, counting the results. - close(errs) - count := 0 - var err error - for err = range errs { - if err != nil { - count++ - } - } - if count == len(peers) { - return fmt.Errorf("failed to bootstrap. %s", err) - } - return nil -} - -func randomSubsetOfPeers(in []peer.AddrInfo, max int) []peer.AddrInfo { - if max > len(in) { - max = len(in) - } - - out := make([]peer.AddrInfo, max) - for i, val := range rand.Perm(len(in))[:max] { - out[i] = in[val] - } - return out -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/builder.go b/vendor/github.com/ipfs/go-ipfs/core/builder.go deleted file mode 100644 index ff8fbd32..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/builder.go +++ /dev/null @@ -1,65 +0,0 @@ -package core - -import ( - "context" - "sync" - - "github.com/ipfs/go-ipfs/core/bootstrap" - "github.com/ipfs/go-ipfs/core/node" - - "github.com/ipfs/go-metrics-interface" - "go.uber.org/fx" -) - -type BuildCfg = node.BuildCfg // Alias for compatibility until we properly refactor the constructor interface - -// NewNode constructs and returns an IpfsNode using the given cfg. -func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) { - ctx = metrics.CtxScope(ctx, "ipfs") - - n := &IpfsNode{ - ctx: ctx, - } - - app := fx.New( - node.IPFS(ctx, cfg), - - fx.NopLogger, - fx.Extract(n), - ) - - var once sync.Once - var stopErr error - n.stop = func() error { - once.Do(func() { - stopErr = app.Stop(context.Background()) - }) - return stopErr - } - n.IsOnline = cfg.Online - - go func() { - // Note that some services use contexts to signal shutting down, which is - // very suboptimal. This needs to be here until that's addressed somehow - <-ctx.Done() - err := n.stop() - if err != nil { - log.Error("failure on stop: ", err) - } - }() - - if app.Err() != nil { - return nil, app.Err() - } - - if err := app.Start(ctx); err != nil { - return nil, err - } - - // TODO: How soon will bootstrap move to libp2p? - if !cfg.Online { - return n, nil - } - - return n, n.Bootstrap(bootstrap.DefaultBootstrapConfig) -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/core.go b/vendor/github.com/ipfs/go-ipfs/core/core.go deleted file mode 100644 index 24535208..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/core.go +++ /dev/null @@ -1,178 +0,0 @@ -/* -Package core implements the IpfsNode object and related methods. - -Packages underneath core/ provide a (relatively) stable, low-level API -to carry out most IPFS-related tasks. For more details on the other -interfaces and how core/... fits into the bigger IPFS picture, see: - - $ godoc github.com/ipfs/go-ipfs -*/ -package core - -import ( - "context" - "io" - - version "github.com/ipfs/go-ipfs" - "github.com/ipfs/go-ipfs/core/bootstrap" - "github.com/ipfs/go-ipfs/core/node" - "github.com/ipfs/go-ipfs/core/node/libp2p" - "github.com/ipfs/go-ipfs/filestore" - "github.com/ipfs/go-ipfs/fuse/mount" - "github.com/ipfs/go-ipfs/namesys" - ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher" - "github.com/ipfs/go-ipfs/p2p" - "github.com/ipfs/go-ipfs/pin" - "github.com/ipfs/go-ipfs/provider" - "github.com/ipfs/go-ipfs/repo" - - bserv "github.com/ipfs/go-blockservice" - bstore "github.com/ipfs/go-ipfs-blockstore" - exchange "github.com/ipfs/go-ipfs-exchange-interface" - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" - mfs "github.com/ipfs/go-mfs" - resolver "github.com/ipfs/go-path/resolver" - goprocess "github.com/jbenet/goprocess" - autonat "github.com/libp2p/go-libp2p-autonat-svc" - connmgr "github.com/libp2p/go-libp2p-core/connmgr" - ic "github.com/libp2p/go-libp2p-core/crypto" - p2phost "github.com/libp2p/go-libp2p-core/host" - metrics "github.com/libp2p/go-libp2p-core/metrics" - peer "github.com/libp2p/go-libp2p-core/peer" - pstore "github.com/libp2p/go-libp2p-core/peerstore" - routing "github.com/libp2p/go-libp2p-core/routing" - dht "github.com/libp2p/go-libp2p-kad-dht" - pubsub "github.com/libp2p/go-libp2p-pubsub" - psrouter "github.com/libp2p/go-libp2p-pubsub-router" - record "github.com/libp2p/go-libp2p-record" - "github.com/libp2p/go-libp2p/p2p/discovery" - p2pbhost "github.com/libp2p/go-libp2p/p2p/host/basic" - "github.com/libp2p/go-libp2p/p2p/protocol/identify" -) - -var log = logging.Logger("core") - -func init() { - identify.ClientVersion = "go-ipfs/" + version.CurrentVersionNumber + "/" + version.CurrentCommit -} - -// IpfsNode is IPFS Core module. It represents an IPFS instance. -type IpfsNode struct { - - // Self - Identity peer.ID // the local node's identity - - Repo repo.Repo - - // Local node - Pinning pin.Pinner // the pinning manager - Mounts Mounts `optional:"true"` // current mount state, if any. - PrivateKey ic.PrivKey `optional:"true"` // the local node's private Key - PNetFingerprint libp2p.PNetFingerprint `optional:"true"` // fingerprint of private network - - // Services - Peerstore pstore.Peerstore `optional:"true"` // storage for other Peer instances - Blockstore bstore.GCBlockstore // the block store (lower level) - Filestore *filestore.Filestore `optional:"true"` // the filestore blockstore - BaseBlocks node.BaseBlocks // the raw blockstore, no filestore wrapping - GCLocker bstore.GCLocker // the locker used to protect the blockstore during gc - Blocks bserv.BlockService // the block service, get/add blocks. - DAG ipld.DAGService // the merkle dag service, get/add objects. - Resolver *resolver.Resolver // the path resolution system - Reporter metrics.Reporter `optional:"true"` - Discovery discovery.Service `optional:"true"` - FilesRoot *mfs.Root - RecordValidator record.Validator - - // Online - PeerHost p2phost.Host `optional:"true"` // the network host (server+client) - Bootstrapper io.Closer `optional:"true"` // the periodic bootstrapper - Routing routing.Routing `optional:"true"` // the routing system. recommend ipfs-dht - Exchange exchange.Interface // the block exchange + strategy (bitswap) - Namesys namesys.NameSystem // the name system, resolves paths to hashes - Provider provider.System // the value provider system - IpnsRepub *ipnsrp.Republisher `optional:"true"` - - AutoNAT *autonat.AutoNATService `optional:"true"` - PubSub *pubsub.PubSub `optional:"true"` - PSRouter *psrouter.PubsubValueStore `optional:"true"` - DHT *dht.IpfsDHT `optional:"true"` - P2P *p2p.P2P `optional:"true"` - - Process goprocess.Process - ctx context.Context - - stop func() error - - // Flags - IsOnline bool `optional:"true"` // Online is set when networking is enabled. - IsDaemon bool `optional:"true"` // Daemon is set when running on a long-running daemon. -} - -// Mounts defines what the node's mount state is. This should -// perhaps be moved to the daemon or mount. It's here because -// it needs to be accessible across daemon requests. -type Mounts struct { - Ipfs mount.Mount - Ipns mount.Mount -} - -// Close calls Close() on the App object -func (n *IpfsNode) Close() error { - return n.stop() -} - -// Context returns the IpfsNode context -func (n *IpfsNode) Context() context.Context { - if n.ctx == nil { - n.ctx = context.TODO() - } - return n.ctx -} - -// Bootstrap will set and call the IpfsNodes bootstrap function. -func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error { - // TODO what should return value be when in offlineMode? - if n.Routing == nil { - return nil - } - - if n.Bootstrapper != nil { - n.Bootstrapper.Close() // stop previous bootstrap process. - } - - // if the caller did not specify a bootstrap peer function, get the - // freshest bootstrap peers from config. this responds to live changes. - if cfg.BootstrapPeers == nil { - cfg.BootstrapPeers = func() []peer.AddrInfo { - ps, err := n.loadBootstrapPeers() - if err != nil { - log.Warning("failed to parse bootstrap peers from config") - return nil - } - return ps - } - } - - var err error - n.Bootstrapper, err = bootstrap.Bootstrap(n.Identity, n.PeerHost, n.Routing, cfg) - return err -} - -func (n *IpfsNode) loadBootstrapPeers() ([]peer.AddrInfo, error) { - cfg, err := n.Repo.Config() - if err != nil { - return nil, err - } - - return cfg.BootstrapPeers() -} - -type ConstructPeerHostOpts struct { - AddrsFactory p2pbhost.AddrsFactory - DisableNatPortMap bool - DisableRelay bool - EnableRelayHop bool - ConnectionManager connmgr.ConnManager -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/coredag/cbor.go b/vendor/github.com/ipfs/go-ipfs/core/coredag/cbor.go deleted file mode 100644 index b51a7057..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/coredag/cbor.go +++ /dev/null @@ -1,32 +0,0 @@ -package coredag - -import ( - "io" - "io/ioutil" - - ipldcbor "github.com/ipfs/go-ipld-cbor" - ipld "github.com/ipfs/go-ipld-format" -) - -func cborJSONParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - nd, err := ipldcbor.FromJSON(r, mhType, mhLen) - if err != nil { - return nil, err - } - - return []ipld.Node{nd}, nil -} - -func cborRawParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - data, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - nd, err := ipldcbor.Decode(data, mhType, mhLen) - if err != nil { - return nil, err - } - - return []ipld.Node{nd}, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/coredag/dagpb.go b/vendor/github.com/ipfs/go-ipfs/core/coredag/dagpb.go deleted file mode 100644 index 0350ec5c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/coredag/dagpb.go +++ /dev/null @@ -1,66 +0,0 @@ -package coredag - -import ( - "io" - "io/ioutil" - "math" - - "github.com/ipfs/go-merkledag" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" -) - -func dagpbJSONParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - data, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - nd := &merkledag.ProtoNode{} - - err = nd.UnmarshalJSON(data) - if err != nil { - return nil, err - } - - nd.SetCidBuilder(cidPrefix(mhType, mhLen)) - - return []ipld.Node{nd}, nil -} - -func dagpbRawParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - data, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - nd, err := merkledag.DecodeProtobuf(data) - if err != nil { - return nil, err - } - - nd.SetCidBuilder(cidPrefix(mhType, mhLen)) - - return []ipld.Node{nd}, nil -} - -func cidPrefix(mhType uint64, mhLen int) *cid.Prefix { - if mhType == math.MaxUint64 { - mhType = mh.SHA2_256 - } - - prefix := &cid.Prefix{ - MhType: mhType, - MhLength: mhLen, - Version: 1, - Codec: cid.DagProtobuf, - } - - if mhType == mh.SHA2_256 { - prefix.Version = 0 - } - - return prefix -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/coredag/dagtransl.go b/vendor/github.com/ipfs/go-ipfs/core/coredag/dagtransl.go deleted file mode 100644 index 67a79246..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/coredag/dagtransl.go +++ /dev/null @@ -1,86 +0,0 @@ -package coredag - -import ( - "fmt" - "io" - - ipld "github.com/ipfs/go-ipld-format" -) - -// DagParser is function used for parsing stream into Node -type DagParser func(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) - -// FormatParsers is used for mapping format descriptors to DagParsers -type FormatParsers map[string]DagParser - -// InputEncParsers is used for mapping input encodings to FormatParsers -type InputEncParsers map[string]FormatParsers - -// DefaultInputEncParsers is InputEncParser that is used everywhere -var DefaultInputEncParsers = InputEncParsers{ - "json": defaultJSONParsers, - "raw": defaultRawParsers, - "cbor": defaultCborParsers, - "protobuf": defaultProtobufParsers, -} - -var defaultJSONParsers = FormatParsers{ - "cbor": cborJSONParser, - "dag-cbor": cborJSONParser, - - "protobuf": dagpbJSONParser, - "dag-pb": dagpbJSONParser, -} - -var defaultRawParsers = FormatParsers{ - "cbor": cborRawParser, - "dag-cbor": cborRawParser, - - "protobuf": dagpbRawParser, - "dag-pb": dagpbRawParser, - - "raw": rawRawParser, -} - -var defaultCborParsers = FormatParsers{ - "cbor": cborRawParser, - "dag-cbor": cborRawParser, -} - -var defaultProtobufParsers = FormatParsers{ - "protobuf": dagpbRawParser, - "dag-pb": dagpbRawParser, -} - -// ParseInputs uses DefaultInputEncParsers to parse io.Reader described by -// input encoding and format to an instance of ipld Node -func ParseInputs(ienc, format string, r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - return DefaultInputEncParsers.ParseInputs(ienc, format, r, mhType, mhLen) -} - -// AddParser adds DagParser under give input encoding and format -func (iep InputEncParsers) AddParser(ienc, format string, f DagParser) { - m, ok := iep[ienc] - if !ok { - m = make(FormatParsers) - iep[ienc] = m - } - - m[format] = f -} - -// ParseInputs parses io.Reader described by input encoding and format to -// an instance of ipld Node -func (iep InputEncParsers) ParseInputs(ienc, format string, r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - parsers, ok := iep[ienc] - if !ok { - return nil, fmt.Errorf("no input parser for %q", ienc) - } - - parser, ok := parsers[format] - if !ok { - return nil, fmt.Errorf("no parser for format %q using input type %q", format, ienc) - } - - return parser(r, mhType, mhLen) -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/coredag/raw.go b/vendor/github.com/ipfs/go-ipfs/core/coredag/raw.go deleted file mode 100644 index 03bbffac..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/coredag/raw.go +++ /dev/null @@ -1,37 +0,0 @@ -package coredag - -import ( - "io" - "io/ioutil" - "math" - - "github.com/ipfs/go-merkledag" - - block "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" -) - -func rawRawParser(r io.Reader, mhType uint64, mhLen int) ([]ipld.Node, error) { - if mhType == math.MaxUint64 { - mhType = mh.SHA2_256 - } - - data, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - h, err := mh.Sum(data, mhType, mhLen) - if err != nil { - return nil, err - } - c := cid.NewCidV1(cid.Raw, h) - blk, err := block.NewBlockWithCid(data, c) - if err != nil { - return nil, err - } - nd := &merkledag.RawNode{Block: blk} - return []ipld.Node{nd}, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/builder.go b/vendor/github.com/ipfs/go-ipfs/core/node/builder.go deleted file mode 100644 index 129ac0a3..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/builder.go +++ /dev/null @@ -1,151 +0,0 @@ -package node - -import ( - "context" - "crypto/rand" - "encoding/base64" - "errors" - - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/core/node/libp2p" - "github.com/ipfs/go-ipfs/repo" - - ds "github.com/ipfs/go-datastore" - dsync "github.com/ipfs/go-datastore/sync" - cfg "github.com/ipfs/go-ipfs-config" - ci "github.com/libp2p/go-libp2p-core/crypto" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -type BuildCfg struct { - // If online is set, the node will have networking enabled - Online bool - - // ExtraOpts is a map of extra options used to configure the ipfs nodes creation - ExtraOpts map[string]bool - - // If permanent then node should run more expensive processes - // that will improve performance in long run - Permanent bool - - // DisableEncryptedConnections disables connection encryption *entirely*. - // DO NOT SET THIS UNLESS YOU'RE TESTING. - DisableEncryptedConnections bool - - // If NilRepo is set, a Repo backed by a nil datastore will be constructed - NilRepo bool - - Routing libp2p.RoutingOption - Host libp2p.HostOption - Repo repo.Repo -} - -func (cfg *BuildCfg) getOpt(key string) bool { - if cfg.ExtraOpts == nil { - return false - } - - return cfg.ExtraOpts[key] -} - -func (cfg *BuildCfg) fillDefaults() error { - if cfg.Repo != nil && cfg.NilRepo { - return errors.New("cannot set a Repo and specify nilrepo at the same time") - } - - if cfg.Repo == nil { - var d ds.Datastore - if cfg.NilRepo { - d = ds.NewNullDatastore() - } else { - d = ds.NewMapDatastore() - } - r, err := defaultRepo(dsync.MutexWrap(d)) - if err != nil { - return err - } - cfg.Repo = r - } - - if cfg.Routing == nil { - cfg.Routing = libp2p.DHTOption - } - - if cfg.Host == nil { - cfg.Host = libp2p.DefaultHostOption - } - - return nil -} - -// options creates fx option group from this build config -func (cfg *BuildCfg) options(ctx context.Context) (fx.Option, *cfg.Config) { - err := cfg.fillDefaults() - if err != nil { - return fx.Error(err), nil - } - - repoOption := fx.Provide(func(lc fx.Lifecycle) repo.Repo { - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return cfg.Repo.Close() - }, - }) - - return cfg.Repo - }) - - metricsCtx := fx.Provide(func() helpers.MetricsCtx { - return helpers.MetricsCtx(ctx) - }) - - hostOption := fx.Provide(func() libp2p.HostOption { - return cfg.Host - }) - - routingOption := fx.Provide(func() libp2p.RoutingOption { - return cfg.Routing - }) - - conf, err := cfg.Repo.Config() - if err != nil { - return fx.Error(err), nil - } - - return fx.Options( - repoOption, - hostOption, - routingOption, - metricsCtx, - ), conf -} - -func defaultRepo(dstore repo.Datastore) (repo.Repo, error) { - c := cfg.Config{} - priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 1024, rand.Reader) - if err != nil { - return nil, err - } - - pid, err := peer.IDFromPublicKey(pub) - if err != nil { - return nil, err - } - - privkeyb, err := priv.Bytes() - if err != nil { - return nil, err - } - - c.Bootstrap = cfg.DefaultBootstrapAddresses - c.Addresses.Swarm = []string{"/ip4/0.0.0.0/tcp/4001"} - c.Identity.PeerID = pid.Pretty() - c.Identity.PrivKey = base64.StdEncoding.EncodeToString(privkeyb) - - return &repo.Mock{ - D: dstore, - C: c, - }, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/core.go b/vendor/github.com/ipfs/go-ipfs/core/node/core.go deleted file mode 100644 index ddb42aff..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/core.go +++ /dev/null @@ -1,124 +0,0 @@ -package node - -import ( - "context" - "fmt" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/pin" - "github.com/ipfs/go-ipfs/repo" - - "github.com/ipfs/go-bitswap" - "github.com/ipfs/go-bitswap/network" - "github.com/ipfs/go-blockservice" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipfs/go-ipfs-exchange-interface" - "github.com/ipfs/go-ipfs-exchange-offline" - "github.com/ipfs/go-ipld-format" - "github.com/ipfs/go-merkledag" - "github.com/ipfs/go-mfs" - "github.com/ipfs/go-unixfs" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/routing" - "go.uber.org/fx" -) - -// BlockService creates new blockservice which provides an interface to fetch content-addressable blocks -func BlockService(lc fx.Lifecycle, bs blockstore.Blockstore, rem exchange.Interface) blockservice.BlockService { - bsvc := blockservice.New(bs, rem) - - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return bsvc.Close() - }, - }) - - return bsvc -} - -// Pinning creates new pinner which tells GC which blocks should be kept -func Pinning(bstore blockstore.Blockstore, ds format.DAGService, repo repo.Repo) (pin.Pinner, error) { - internalDag := merkledag.NewDAGService(blockservice.New(bstore, offline.Exchange(bstore))) - pinning, err := pin.LoadPinner(repo.Datastore(), ds, internalDag) - if err != nil { - // TODO: we should move towards only running 'NewPinner' explicitly on - // node init instead of implicitly here as a result of the pinner keys - // not being found in the datastore. - // this is kinda sketchy and could cause data loss - pinning = pin.NewPinner(repo.Datastore(), ds, internalDag) - } - - return pinning, nil -} - -// Dag creates new DAGService -func Dag(bs blockservice.BlockService) format.DAGService { - return merkledag.NewDAGService(bs) -} - -// OnlineExchange creates new LibP2P backed block exchange (BitSwap) -func OnlineExchange(provide bool) interface{} { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, rt routing.Routing, bs blockstore.GCBlockstore) exchange.Interface { - bitswapNetwork := network.NewFromIpfsHost(host, rt) - exch := bitswap.New(helpers.LifecycleCtx(mctx, lc), bitswapNetwork, bs, bitswap.ProvideEnabled(provide)) - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return exch.Close() - }, - }) - return exch - - } -} - -// Files loads persisted MFS root -func Files(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, error) { - dsk := datastore.NewKey("/local/filesroot") - pf := func(ctx context.Context, c cid.Cid) error { - return repo.Datastore().Put(dsk, c.Bytes()) - } - - var nd *merkledag.ProtoNode - val, err := repo.Datastore().Get(dsk) - ctx := helpers.LifecycleCtx(mctx, lc) - - switch { - case err == datastore.ErrNotFound || val == nil: - nd = unixfs.EmptyDirNode() - err := dag.Add(ctx, nd) - if err != nil { - return nil, fmt.Errorf("failure writing to dagstore: %s", err) - } - case err == nil: - c, err := cid.Cast(val) - if err != nil { - return nil, err - } - - rnd, err := dag.Get(ctx, c) - if err != nil { - return nil, fmt.Errorf("error loading filesroot from DAG: %s", err) - } - - pbnd, ok := rnd.(*merkledag.ProtoNode) - if !ok { - return nil, merkledag.ErrNotProtobuf - } - - nd = pbnd - default: - return nil, err - } - - root, err := mfs.NewRoot(ctx, dag, nd, pf) - - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return root.Close() - }, - }) - - return root, err -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/groups.go b/vendor/github.com/ipfs/go-ipfs/core/node/groups.go deleted file mode 100644 index 1e5207b8..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/groups.go +++ /dev/null @@ -1,294 +0,0 @@ -package node - -import ( - "context" - "errors" - "fmt" - "time" - - blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipfs/go-ipfs-config" - util "github.com/ipfs/go-ipfs-util" - peer "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-peerstore/pstoremem" - pubsub "github.com/libp2p/go-libp2p-pubsub" - - "github.com/ipfs/go-ipfs/core/node/libp2p" - "github.com/ipfs/go-ipfs/p2p" - - offline "github.com/ipfs/go-ipfs-exchange-offline" - offroute "github.com/ipfs/go-ipfs-routing/offline" - "github.com/ipfs/go-path/resolver" - uio "github.com/ipfs/go-unixfs/io" - "go.uber.org/fx" -) - -var BaseLibP2P = fx.Options( - fx.Provide(libp2p.PNet), - fx.Provide(libp2p.ConnectionManager), - fx.Provide(libp2p.DefaultTransports), - - fx.Provide(libp2p.Host), - - fx.Provide(libp2p.DiscoveryHandler), - - fx.Invoke(libp2p.PNetChecker), -) - -func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option { - // parse ConnMgr config - - grace := config.DefaultConnMgrGracePeriod - low := config.DefaultConnMgrLowWater - high := config.DefaultConnMgrHighWater - - connmgr := fx.Options() - - if cfg.Swarm.ConnMgr.Type != "none" { - switch cfg.Swarm.ConnMgr.Type { - case "": - // 'default' value is the basic connection manager - break - case "basic": - var err error - grace, err = time.ParseDuration(cfg.Swarm.ConnMgr.GracePeriod) - if err != nil { - return fx.Error(fmt.Errorf("parsing Swarm.ConnMgr.GracePeriod: %s", err)) - } - - low = cfg.Swarm.ConnMgr.LowWater - high = cfg.Swarm.ConnMgr.HighWater - default: - return fx.Error(fmt.Errorf("unrecognized ConnMgr.Type: %q", cfg.Swarm.ConnMgr.Type)) - } - - connmgr = fx.Provide(libp2p.ConnectionManager(low, high, grace)) - } - - // parse PubSub config - - ps := fx.Options() - if bcfg.getOpt("pubsub") || bcfg.getOpt("ipnsps") { - var pubsubOptions []pubsub.Option - pubsubOptions = append( - pubsubOptions, - pubsub.WithMessageSigning(!cfg.Pubsub.DisableSigning), - pubsub.WithStrictSignatureVerification(cfg.Pubsub.StrictSignatureVerification), - ) - - switch cfg.Pubsub.Router { - case "": - fallthrough - case "floodsub": - ps = fx.Provide(libp2p.FloodSub(pubsubOptions...)) - case "gossipsub": - ps = fx.Provide(libp2p.GossipSub(pubsubOptions...)) - default: - return fx.Error(fmt.Errorf("unknown pubsub router %s", cfg.Pubsub.Router)) - } - } - - // Gather all the options - - opts := fx.Options( - BaseLibP2P, - - fx.Provide(libp2p.AddrFilters(cfg.Swarm.AddrFilters)), - fx.Provide(libp2p.AddrsFactory(cfg.Addresses.Announce, cfg.Addresses.NoAnnounce)), - fx.Provide(libp2p.SmuxTransport(bcfg.getOpt("mplex"))), - fx.Provide(libp2p.Relay(cfg.Swarm.DisableRelay, cfg.Swarm.EnableRelayHop)), - fx.Invoke(libp2p.StartListening(cfg.Addresses.Swarm)), - fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled, cfg.Discovery.MDNS.Interval)), - - fx.Provide(libp2p.Security(!bcfg.DisableEncryptedConnections, cfg.Experimental.PreferTLS)), - - fx.Provide(libp2p.Routing), - fx.Provide(libp2p.BaseRouting), - maybeProvide(libp2p.PubsubRouter, bcfg.getOpt("ipnsps")), - - maybeProvide(libp2p.BandwidthCounter, !cfg.Swarm.DisableBandwidthMetrics), - maybeProvide(libp2p.NatPortMap, !cfg.Swarm.DisableNatPortMap), - maybeProvide(libp2p.AutoRealy, cfg.Swarm.EnableAutoRelay), - maybeProvide(libp2p.QUIC, cfg.Experimental.QUIC), - maybeInvoke(libp2p.AutoNATService(cfg.Experimental.QUIC), cfg.Swarm.EnableAutoNATService), - connmgr, - ps, - ) - - return opts -} - -// Storage groups units which setup datastore based persistence and blockstore layers -func Storage(bcfg *BuildCfg, cfg *config.Config) fx.Option { - cacheOpts := blockstore.DefaultCacheOpts() - cacheOpts.HasBloomFilterSize = cfg.Datastore.BloomFilterSize - if !bcfg.Permanent { - cacheOpts.HasBloomFilterSize = 0 - } - - finalBstore := fx.Provide(GcBlockstoreCtor) - if cfg.Experimental.FilestoreEnabled || cfg.Experimental.UrlstoreEnabled { - finalBstore = fx.Provide(FilestoreBlockstoreCtor) - } - - return fx.Options( - fx.Provide(RepoConfig), - fx.Provide(Datastore), - fx.Provide(BaseBlockstoreCtor(cacheOpts, bcfg.NilRepo, cfg.Datastore.HashOnRead)), - finalBstore, - ) -} - -// Identity groups units providing cryptographic identity -func Identity(cfg *config.Config) fx.Option { - // PeerID - - cid := cfg.Identity.PeerID - if cid == "" { - return fx.Error(errors.New("identity was not set in config (was 'ipfs init' run?)")) - } - if len(cid) == 0 { - return fx.Error(errors.New("no peer ID in config! (was 'ipfs init' run?)")) - } - - id, err := peer.IDB58Decode(cid) - if err != nil { - return fx.Error(fmt.Errorf("peer ID invalid: %s", err)) - } - - // Private Key - - if cfg.Identity.PrivKey == "" { - return fx.Options( // No PK (usually in tests) - fx.Provide(PeerID(id)), - fx.Provide(pstoremem.NewPeerstore), - ) - } - - sk, err := cfg.Identity.DecodePrivateKey("passphrase todo!") - if err != nil { - return fx.Error(err) - } - - return fx.Options( // Full identity - fx.Provide(PeerID(id)), - fx.Provide(PrivateKey(sk)), - fx.Provide(pstoremem.NewPeerstore), - - fx.Invoke(libp2p.PstoreAddSelfKeys), - ) -} - -// IPNS groups namesys related units -var IPNS = fx.Options( - fx.Provide(RecordValidator), -) - -// Online groups online-only units -func Online(bcfg *BuildCfg, cfg *config.Config) fx.Option { - - // Namesys params - - ipnsCacheSize := cfg.Ipns.ResolveCacheSize - if ipnsCacheSize == 0 { - ipnsCacheSize = DefaultIpnsCacheSize - } - if ipnsCacheSize < 0 { - return fx.Error(fmt.Errorf("cannot specify negative resolve cache size")) - } - - // Republisher params - - var repubPeriod, recordLifetime time.Duration - - if cfg.Ipns.RepublishPeriod != "" { - d, err := time.ParseDuration(cfg.Ipns.RepublishPeriod) - if err != nil { - return fx.Error(fmt.Errorf("failure to parse config setting IPNS.RepublishPeriod: %s", err)) - } - - if !util.Debug && (d < time.Minute || d > (time.Hour*24)) { - return fx.Error(fmt.Errorf("config setting IPNS.RepublishPeriod is not between 1min and 1day: %s", d)) - } - - repubPeriod = d - } - - if cfg.Ipns.RecordLifetime != "" { - d, err := time.ParseDuration(cfg.Ipns.RecordLifetime) - if err != nil { - return fx.Error(fmt.Errorf("failure to parse config setting IPNS.RecordLifetime: %s", err)) - } - - recordLifetime = d - } - - /* don't provide from bitswap when the strategic provider service is active */ - shouldBitswapProvide := !cfg.Experimental.StrategicProviding - - return fx.Options( - fx.Provide(OnlineExchange(shouldBitswapProvide)), - fx.Provide(Namesys(ipnsCacheSize)), - - fx.Invoke(IpnsRepublisher(repubPeriod, recordLifetime)), - - fx.Provide(p2p.New), - - LibP2P(bcfg, cfg), - OnlineProviders(cfg.Experimental.StrategicProviding, cfg.Reprovider.Strategy, cfg.Reprovider.Interval), - ) -} - -// Offline groups offline alternatives to Online units -func Offline(cfg *config.Config) fx.Option { - return fx.Options( - fx.Provide(offline.Exchange), - fx.Provide(Namesys(0)), - fx.Provide(offroute.NewOfflineRouter), - OfflineProviders(cfg.Experimental.StrategicProviding, cfg.Reprovider.Strategy, cfg.Reprovider.Interval), - ) -} - -// Core groups basic IPFS services -var Core = fx.Options( - fx.Provide(BlockService), - fx.Provide(Dag), - fx.Provide(resolver.NewBasicResolver), - fx.Provide(Pinning), - fx.Provide(Files), -) - -func Networked(bcfg *BuildCfg, cfg *config.Config) fx.Option { - if bcfg.Online { - return Online(bcfg, cfg) - } - return Offline(cfg) -} - -// IPFS builds a group of fx Options based on the passed BuildCfg -func IPFS(ctx context.Context, bcfg *BuildCfg) fx.Option { - if bcfg == nil { - bcfg = new(BuildCfg) - } - - bcfgOpts, cfg := bcfg.options(ctx) - if cfg == nil { - return bcfgOpts // error - } - - // TEMP: setting global sharding switch here - uio.UseHAMTSharding = cfg.Experimental.ShardingEnabled - - return fx.Options( - bcfgOpts, - - fx.Provide(baseProcess), - - Storage(bcfg, cfg), - Identity(cfg), - IPNS, - Networked(bcfg, cfg), - - Core, - ) -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/helpers.go b/vendor/github.com/ipfs/go-ipfs/core/node/helpers.go deleted file mode 100644 index 9ecd8036..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/helpers.go +++ /dev/null @@ -1,62 +0,0 @@ -package node - -import ( - "context" - - "github.com/jbenet/goprocess" - "github.com/pkg/errors" - "go.uber.org/fx" -) - -type lcProcess struct { - fx.In - - LC fx.Lifecycle - Proc goprocess.Process -} - -// Append wraps ProcessFunc into a goprocess, and appends it to the lifecycle -func (lp *lcProcess) Append(f goprocess.ProcessFunc) { - // Hooks are guaranteed to run in sequence. If a hook fails to start, its - // OnStop won't be executed. - var proc goprocess.Process - - lp.LC.Append(fx.Hook{ - OnStart: func(ctx context.Context) error { - proc = lp.Proc.Go(f) - return nil - }, - OnStop: func(ctx context.Context) error { - if proc == nil { // Theoretically this shouldn't ever happen - return errors.New("lcProcess: proc was nil") - } - - return proc.Close() // todo: respect ctx, somehow - }, - }) -} - -func maybeProvide(opt interface{}, enable bool) fx.Option { - if enable { - return fx.Provide(opt) - } - return fx.Options() -} - -func maybeInvoke(opt interface{}, enable bool) fx.Option { - if enable { - return fx.Invoke(opt) - } - return fx.Options() -} - -// baseProcess creates a goprocess which is closed when the lifecycle signals it to stop -func baseProcess(lc fx.Lifecycle) goprocess.Process { - p := goprocess.WithParent(goprocess.Background()) - lc.Append(fx.Hook{ - OnStop: func(_ context.Context) error { - return p.Close() - }, - }) - return p -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/helpers/helpers.go b/vendor/github.com/ipfs/go-ipfs/core/node/helpers/helpers.go deleted file mode 100644 index 546c8e97..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/helpers/helpers.go +++ /dev/null @@ -1,23 +0,0 @@ -package helpers - -import ( - "context" - "go.uber.org/fx" -) - -type MetricsCtx context.Context - -// LifecycleCtx creates a context which will be cancelled when lifecycle stops -// -// This is a hack which we need because most of our services use contexts in a -// wrong way -func LifecycleCtx(mctx MetricsCtx, lc fx.Lifecycle) context.Context { - ctx, cancel := context.WithCancel(mctx) - lc.Append(fx.Hook{ - OnStop: func(_ context.Context) error { - cancel() - return nil - }, - }) - return ctx -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/identity.go b/vendor/github.com/ipfs/go-ipfs/core/node/identity.go deleted file mode 100644 index ad6eb238..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/identity.go +++ /dev/null @@ -1,29 +0,0 @@ -package node - -import ( - "fmt" - - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" -) - -func PeerID(id peer.ID) func() peer.ID { - return func() peer.ID { - return id - } -} - -// PrivateKey loads the private key from config -func PrivateKey(sk crypto.PrivKey) func(id peer.ID) (crypto.PrivKey, error) { - return func(id peer.ID) (crypto.PrivKey, error) { - id2, err := peer.IDFromPrivateKey(sk) - if err != nil { - return nil, err - } - - if id2 != id { - return nil, fmt.Errorf("private key in config does not match id: %s != %s", id, id2) - } - return sk, nil - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/ipns.go b/vendor/github.com/ipfs/go-ipfs/core/node/ipns.go deleted file mode 100644 index 11769d97..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/ipns.go +++ /dev/null @@ -1,56 +0,0 @@ -package node - -import ( - "fmt" - "time" - - "github.com/ipfs/go-ipfs-util" - "github.com/ipfs/go-ipns" - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/routing" - "github.com/libp2p/go-libp2p-record" - - "github.com/ipfs/go-ipfs/namesys" - "github.com/ipfs/go-ipfs/namesys/republisher" - "github.com/ipfs/go-ipfs/repo" -) - -const DefaultIpnsCacheSize = 128 - -// RecordValidator provides namesys compatible routing record validator -func RecordValidator(ps peerstore.Peerstore) record.Validator { - return record.NamespacedValidator{ - "pk": record.PublicKeyValidator{}, - "ipns": ipns.Validator{KeyBook: ps}, - } -} - -// Namesys creates new name system -func Namesys(cacheSize int) func(rt routing.Routing, repo repo.Repo) (namesys.NameSystem, error) { - return func(rt routing.Routing, repo repo.Repo) (namesys.NameSystem, error) { - return namesys.NewNameSystem(rt, repo.Datastore(), cacheSize), nil - } -} - -// IpnsRepublisher runs new IPNS republisher service -func IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcProcess, namesys.NameSystem, repo.Repo, crypto.PrivKey) error { - return func(lc lcProcess, namesys namesys.NameSystem, repo repo.Repo, privKey crypto.PrivKey) error { - repub := republisher.NewRepublisher(namesys, repo.Datastore(), privKey, repo.Keystore()) - - if repubPeriod != 0 { - if !util.Debug && (repubPeriod < time.Minute || repubPeriod > (time.Hour*24)) { - return fmt.Errorf("config setting IPNS.RepublishPeriod is not between 1min and 1day: %s", repubPeriod) - } - - repub.Interval = repubPeriod - } - - if recordLifetime != 0 { - repub.RecordLifetime = recordLifetime - } - - lc.Append(repub.Run) - return nil - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/addrs.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/addrs.go deleted file mode 100644 index 703a959c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/addrs.go +++ /dev/null @@ -1,117 +0,0 @@ -package libp2p - -import ( - "fmt" - - "github.com/libp2p/go-libp2p" - host "github.com/libp2p/go-libp2p-core/host" - p2pbhost "github.com/libp2p/go-libp2p/p2p/host/basic" - mafilter "github.com/libp2p/go-maddr-filter" - ma "github.com/multiformats/go-multiaddr" - mamask "github.com/whyrusleeping/multiaddr-filter" -) - -func AddrFilters(filters []string) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - for _, s := range filters { - f, err := mamask.NewMask(s) - if err != nil { - return opts, fmt.Errorf("incorrectly formatted address filter in config: %s", s) - } - opts.Opts = append(opts.Opts, libp2p.FilterAddresses(f)) - } - return opts, nil - } -} - -func makeAddrsFactory(announce []string, noAnnounce []string) (p2pbhost.AddrsFactory, error) { - var annAddrs []ma.Multiaddr - for _, addr := range announce { - maddr, err := ma.NewMultiaddr(addr) - if err != nil { - return nil, err - } - annAddrs = append(annAddrs, maddr) - } - - filters := mafilter.NewFilters() - noAnnAddrs := map[string]bool{} - for _, addr := range noAnnounce { - f, err := mamask.NewMask(addr) - if err == nil { - filters.AddFilter(*f, mafilter.ActionDeny) - continue - } - maddr, err := ma.NewMultiaddr(addr) - if err != nil { - return nil, err - } - noAnnAddrs[string(maddr.Bytes())] = true - } - - return func(allAddrs []ma.Multiaddr) []ma.Multiaddr { - var addrs []ma.Multiaddr - if len(annAddrs) > 0 { - addrs = annAddrs - } else { - addrs = allAddrs - } - - var out []ma.Multiaddr - for _, maddr := range addrs { - // check for exact matches - ok := noAnnAddrs[string(maddr.Bytes())] - // check for /ipcidr matches - if !ok && !filters.AddrBlocked(maddr) { - out = append(out, maddr) - } - } - return out - }, nil -} - -func AddrsFactory(announce []string, noAnnounce []string) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - addrsFactory, err := makeAddrsFactory(announce, noAnnounce) - if err != nil { - return opts, err - } - opts.Opts = append(opts.Opts, libp2p.AddrsFactory(addrsFactory)) - return - } -} - -func listenAddresses(addresses []string) ([]ma.Multiaddr, error) { - var listen []ma.Multiaddr - for _, addr := range addresses { - maddr, err := ma.NewMultiaddr(addr) - if err != nil { - return nil, fmt.Errorf("failure to parse config.Addresses.Swarm: %s", addresses) - } - listen = append(listen, maddr) - } - - return listen, nil -} - -func StartListening(addresses []string) func(host host.Host) error { - return func(host host.Host) error { - listenAddrs, err := listenAddresses(addresses) - if err != nil { - return err - } - - // Actually start listening: - if err := host.Network().Listen(listenAddrs...); err != nil { - return err - } - - // list out our addresses - addrs, err := host.Network().InterfaceListenAddresses() - if err != nil { - return err - } - log.Infof("Swarm listening at: %s", addrs) - return nil - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/discovery.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/discovery.go deleted file mode 100644 index 7b0c8263..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/discovery.go +++ /dev/null @@ -1,53 +0,0 @@ -package libp2p - -import ( - "context" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p/p2p/discovery" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" -) - -const discoveryConnTimeout = time.Second * 30 - -type discoveryHandler struct { - ctx context.Context - host host.Host -} - -func (dh *discoveryHandler) HandlePeerFound(p peer.AddrInfo) { - log.Warning("trying peer info: ", p) - ctx, cancel := context.WithTimeout(dh.ctx, discoveryConnTimeout) - defer cancel() - if err := dh.host.Connect(ctx, p); err != nil { - log.Warning("Failed to connect to peer found by discovery: ", err) - } -} - -func DiscoveryHandler(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) *discoveryHandler { - return &discoveryHandler{ - ctx: helpers.LifecycleCtx(mctx, lc), - host: host, - } -} - -func SetupDiscovery(mdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, handler *discoveryHandler) error { - if mdns { - if mdnsInterval == 0 { - mdnsInterval = 5 - } - service, err := discovery.NewMdnsService(helpers.LifecycleCtx(mctx, lc), host, time.Duration(mdnsInterval)*time.Second, discovery.ServiceTag) - if err != nil { - log.Error("mdns error: ", err) - return nil - } - service.RegisterNotifee(handler) - } - return nil - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/host.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/host.go deleted file mode 100644 index 57475316..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/host.go +++ /dev/null @@ -1,76 +0,0 @@ -package libp2p - -import ( - "context" - - "github.com/libp2p/go-libp2p" - host "github.com/libp2p/go-libp2p-core/host" - peer "github.com/libp2p/go-libp2p-core/peer" - peerstore "github.com/libp2p/go-libp2p-core/peerstore" - routing "github.com/libp2p/go-libp2p-core/routing" - record "github.com/libp2p/go-libp2p-record" - routedhost "github.com/libp2p/go-libp2p/p2p/host/routed" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/repo" -) - -type P2PHostIn struct { - fx.In - - Repo repo.Repo - Validator record.Validator - HostOption HostOption - RoutingOption RoutingOption - ID peer.ID - Peerstore peerstore.Peerstore - - Opts [][]libp2p.Option `group:"libp2p"` -} - -type P2PHostOut struct { - fx.Out - - Host host.Host - Routing BaseIpfsRouting -} - -func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (out P2PHostOut, err error) { - opts := []libp2p.Option{libp2p.NoListenAddrs} - for _, o := range params.Opts { - opts = append(opts, o...) - } - - ctx := helpers.LifecycleCtx(mctx, lc) - - opts = append(opts, libp2p.Routing(func(h host.Host) (routing.PeerRouting, error) { - r, err := params.RoutingOption(ctx, h, params.Repo.Datastore(), params.Validator) - out.Routing = r - return r, err - })) - - out.Host, err = params.HostOption(ctx, params.ID, params.Peerstore, opts...) - if err != nil { - return P2PHostOut{}, err - } - - // this code is necessary just for tests: mock network constructions - // ignore the libp2p constructor options that actually construct the routing! - if out.Routing == nil { - r, err := params.RoutingOption(ctx, out.Host, params.Repo.Datastore(), params.Validator) - if err != nil { - return P2PHostOut{}, err - } - out.Routing = r - out.Host = routedhost.Wrap(out.Host, out.Routing) - } - - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return out.Host.Close() - }, - }) - - return out, err -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/hostopt.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/hostopt.go deleted file mode 100644 index 26d6cad7..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/hostopt.go +++ /dev/null @@ -1,25 +0,0 @@ -package libp2p - -import ( - "context" - "fmt" - - "github.com/libp2p/go-libp2p" - host "github.com/libp2p/go-libp2p-core/host" - peer "github.com/libp2p/go-libp2p-core/peer" - peerstore "github.com/libp2p/go-libp2p-core/peerstore" -) - -type HostOption func(ctx context.Context, id peer.ID, ps peerstore.Peerstore, options ...libp2p.Option) (host.Host, error) - -var DefaultHostOption HostOption = constructPeerHost - -// isolates the complex initialization steps -func constructPeerHost(ctx context.Context, id peer.ID, ps peerstore.Peerstore, options ...libp2p.Option) (host.Host, error) { - pkey := ps.PrivKey(id) - if pkey == nil { - return nil, fmt.Errorf("missing private key for node ID: %s", id.Pretty()) - } - options = append([]libp2p.Option{libp2p.Identity(pkey), libp2p.Peerstore(ps)}, options...) - return libp2p.New(ctx, options...) -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/libp2p.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/libp2p.go deleted file mode 100644 index f0c84027..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/libp2p.go +++ /dev/null @@ -1,46 +0,0 @@ -package libp2p - -import ( - "time" - - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p" - "github.com/libp2p/go-libp2p-connmgr" - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "go.uber.org/fx" -) - -var log = logging.Logger("p2pnode") - -type Libp2pOpts struct { - fx.Out - - Opts []libp2p.Option `group:"libp2p"` -} - -// Misc options - -func ConnectionManager(low, high int, grace time.Duration) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - cm := connmgr.NewConnManager(low, high, grace) - opts.Opts = append(opts.Opts, libp2p.ConnectionManager(cm)) - return - } -} - -func PstoreAddSelfKeys(id peer.ID, sk crypto.PrivKey, ps peerstore.Peerstore) error { - if err := ps.AddPubKey(id, sk.GetPublic()); err != nil { - return err - } - - return ps.AddPrivKey(id, sk) -} - -func simpleOpt(opt libp2p.Option) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - opts.Opts = append(opts.Opts, opt) - return - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/nat.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/nat.go deleted file mode 100644 index 6367d311..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/nat.go +++ /dev/null @@ -1,32 +0,0 @@ -package libp2p - -import ( - "github.com/libp2p/go-libp2p" - autonat "github.com/libp2p/go-libp2p-autonat-svc" - host "github.com/libp2p/go-libp2p-core/host" - libp2pquic "github.com/libp2p/go-libp2p-quic-transport" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/repo" -) - -var NatPortMap = simpleOpt(libp2p.NATPortMap()) - -func AutoNATService(quic bool) func(repo repo.Repo, mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) error { - return func(repo repo.Repo, mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) error { - // collect private net option in case swarm.key is presented - opts, _, err := PNet(repo) - if err != nil { - // swarm key exists but was failed to decode - return err - } - - if quic { - opts.Opts = append(opts.Opts, libp2p.DefaultTransports, libp2p.Transport(libp2pquic.NewTransport)) - } - - _, err = autonat.NewAutoNATService(helpers.LifecycleCtx(mctx, lc), host, opts.Opts...) - return err - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pnet.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pnet.go deleted file mode 100644 index bf4cc556..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pnet.go +++ /dev/null @@ -1,70 +0,0 @@ -package libp2p - -import ( - "bytes" - "context" - "fmt" - "time" - - "github.com/libp2p/go-libp2p" - host "github.com/libp2p/go-libp2p-core/host" - pnet "github.com/libp2p/go-libp2p-pnet" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/repo" -) - -type PNetFingerprint []byte - -func PNet(repo repo.Repo) (opts Libp2pOpts, fp PNetFingerprint, err error) { - swarmkey, err := repo.SwarmKey() - if err != nil || swarmkey == nil { - return opts, nil, err - } - - protec, err := pnet.NewProtector(bytes.NewReader(swarmkey)) - if err != nil { - return opts, nil, fmt.Errorf("failed to configure private network: %s", err) - } - fp = protec.Fingerprint() - - opts.Opts = append(opts.Opts, libp2p.PrivateNetwork(protec)) - return opts, fp, nil -} - -func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error { - // TODO: better check? - swarmkey, err := repo.SwarmKey() - if err != nil || swarmkey == nil { - return err - } - - done := make(chan struct{}) - lc.Append(fx.Hook{ - OnStart: func(_ context.Context) error { - go func() { - t := time.NewTicker(30 * time.Second) - defer t.Stop() - - <-t.C // swallow one tick - for { - select { - case <-t.C: - if len(ph.Network().Peers()) == 0 { - log.Warning("We are in private network and have no peers.") - log.Warning("This might be configuration mistake.") - } - case <-done: - return - } - } - }() - return nil - }, - OnStop: func(_ context.Context) error { - close(done) - return nil - }, - }) - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pubsub.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pubsub.go deleted file mode 100644 index c065cd7e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/pubsub.go +++ /dev/null @@ -1,21 +0,0 @@ -package libp2p - -import ( - host "github.com/libp2p/go-libp2p-core/host" - pubsub "github.com/libp2p/go-libp2p-pubsub" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" -) - -func FloodSub(pubsubOptions ...pubsub.Option) interface{} { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) (service *pubsub.PubSub, err error) { - return pubsub.NewFloodSub(helpers.LifecycleCtx(mctx, lc), host, pubsubOptions...) - } -} - -func GossipSub(pubsubOptions ...pubsub.Option) interface{} { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) (service *pubsub.PubSub, err error) { - return pubsub.NewGossipSub(helpers.LifecycleCtx(mctx, lc), host, pubsubOptions...) - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/relay.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/relay.go deleted file mode 100644 index b9e8afa4..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/relay.go +++ /dev/null @@ -1,24 +0,0 @@ -package libp2p - -import ( - "github.com/libp2p/go-libp2p" - relay "github.com/libp2p/go-libp2p-circuit" -) - -func Relay(disable, enableHop bool) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - if disable { - // Enabled by default. - opts.Opts = append(opts.Opts, libp2p.DisableRelay()) - } else { - relayOpts := []relay.RelayOpt{relay.OptDiscovery} - if enableHop { - relayOpts = append(relayOpts, relay.OptHop) - } - opts.Opts = append(opts.Opts, libp2p.EnableRelay(relayOpts...)) - } - return - } -} - -var AutoRealy = simpleOpt(libp2p.EnableAutoRelay()) diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routing.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routing.go deleted file mode 100644 index e5ba1de3..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routing.go +++ /dev/null @@ -1,106 +0,0 @@ -package libp2p - -import ( - "context" - "sort" - - host "github.com/libp2p/go-libp2p-core/host" - routing "github.com/libp2p/go-libp2p-core/routing" - dht "github.com/libp2p/go-libp2p-kad-dht" - "github.com/libp2p/go-libp2p-pubsub" - namesys "github.com/libp2p/go-libp2p-pubsub-router" - record "github.com/libp2p/go-libp2p-record" - routinghelpers "github.com/libp2p/go-libp2p-routing-helpers" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" -) - -type BaseIpfsRouting routing.Routing - -type Router struct { - routing.Routing - - Priority int // less = more important -} - -type p2pRouterOut struct { - fx.Out - - Router Router `group:"routers"` -} - -func BaseRouting(lc fx.Lifecycle, in BaseIpfsRouting) (out p2pRouterOut, dr *dht.IpfsDHT) { - if dht, ok := in.(*dht.IpfsDHT); ok { - dr = dht - - lc.Append(fx.Hook{ - OnStop: func(ctx context.Context) error { - return dr.Close() - }, - }) - } - - return p2pRouterOut{ - Router: Router{ - Priority: 1000, - Routing: in, - }, - }, dr -} - -type p2pOnlineRoutingIn struct { - fx.In - - Routers []Router `group:"routers"` - Validator record.Validator -} - -func Routing(in p2pOnlineRoutingIn) routing.Routing { - routers := in.Routers - - sort.SliceStable(routers, func(i, j int) bool { - return routers[i].Priority < routers[j].Priority - }) - - irouters := make([]routing.Routing, len(routers)) - for i, v := range routers { - irouters[i] = v.Routing - } - - return routinghelpers.Tiered{ - Routers: irouters, - Validator: in.Validator, - } -} - -type p2pPSRoutingIn struct { - fx.In - - BaseIpfsRouting BaseIpfsRouting - Validator record.Validator - Host host.Host - PubSub *pubsub.PubSub `optional:"true"` -} - -func PubsubRouter(mctx helpers.MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (p2pRouterOut, *namesys.PubsubValueStore) { - psRouter := namesys.NewPubsubValueStore( - helpers.LifecycleCtx(mctx, lc), - in.Host, - in.BaseIpfsRouting, - in.PubSub, - in.Validator, - ) - - return p2pRouterOut{ - Router: Router{ - Routing: &routinghelpers.Compose{ - ValueStore: &routinghelpers.LimitedValueStore{ - ValueStore: psRouter, - Namespaces: []string{"ipns"}, - }, - }, - Priority: 100, - }, - }, psRouter -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routingopt.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routingopt.go deleted file mode 100644 index 35389d85..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/routingopt.go +++ /dev/null @@ -1,36 +0,0 @@ -package libp2p - -import ( - "context" - - "github.com/ipfs/go-datastore" - nilrouting "github.com/ipfs/go-ipfs-routing/none" - host "github.com/libp2p/go-libp2p-core/host" - routing "github.com/libp2p/go-libp2p-core/routing" - dht "github.com/libp2p/go-libp2p-kad-dht" - dhtopts "github.com/libp2p/go-libp2p-kad-dht/opts" - record "github.com/libp2p/go-libp2p-record" -) - -type RoutingOption func(context.Context, host.Host, datastore.Batching, record.Validator) (routing.Routing, error) - -func constructDHTRouting(ctx context.Context, host host.Host, dstore datastore.Batching, validator record.Validator) (routing.Routing, error) { - return dht.New( - ctx, host, - dhtopts.Datastore(dstore), - dhtopts.Validator(validator), - ) -} - -func constructClientDHTRouting(ctx context.Context, host host.Host, dstore datastore.Batching, validator record.Validator) (routing.Routing, error) { - return dht.New( - ctx, host, - dhtopts.Client(true), - dhtopts.Datastore(dstore), - dhtopts.Validator(validator), - ) -} - -var DHTOption RoutingOption = constructDHTRouting -var DHTClientOption RoutingOption = constructClientDHTRouting -var NilRouterOption RoutingOption = nilrouting.ConstructNilRouting diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/smux.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/smux.go deleted file mode 100644 index 95e599ec..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/smux.go +++ /dev/null @@ -1,54 +0,0 @@ -package libp2p - -import ( - "os" - "strings" - - "github.com/libp2p/go-libp2p" - smux "github.com/libp2p/go-libp2p-core/mux" - mplex "github.com/libp2p/go-libp2p-mplex" - yamux "github.com/libp2p/go-libp2p-yamux" -) - -func makeSmuxTransportOption(mplexExp bool) libp2p.Option { - const yamuxID = "/yamux/1.0.0" - const mplexID = "/mplex/6.7.0" - - ymxtpt := *yamux.DefaultTransport - ymxtpt.AcceptBacklog = 512 - - if os.Getenv("YAMUX_DEBUG") != "" { - ymxtpt.LogOutput = os.Stderr - } - - muxers := map[string]smux.Multiplexer{yamuxID: &ymxtpt} - if mplexExp { - muxers[mplexID] = mplex.DefaultTransport - } - - // Allow muxer preference order overriding - order := []string{yamuxID, mplexID} - if prefs := os.Getenv("LIBP2P_MUX_PREFS"); prefs != "" { - order = strings.Fields(prefs) - } - - opts := make([]libp2p.Option, 0, len(order)) - for _, id := range order { - tpt, ok := muxers[id] - if !ok { - log.Warning("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id) - continue - } - delete(muxers, id) - opts = append(opts, libp2p.Muxer(id, tpt)) - } - - return libp2p.ChainOptions(opts...) -} - -func SmuxTransport(mplex bool) func() (opts Libp2pOpts, err error) { - return func() (opts Libp2pOpts, err error) { - opts.Opts = append(opts.Opts, makeSmuxTransportOption(mplex)) - return - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/transport.go b/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/transport.go deleted file mode 100644 index 526776ab..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/libp2p/transport.go +++ /dev/null @@ -1,38 +0,0 @@ -package libp2p - -import ( - "github.com/libp2p/go-libp2p" - metrics "github.com/libp2p/go-libp2p-core/metrics" - libp2pquic "github.com/libp2p/go-libp2p-quic-transport" - secio "github.com/libp2p/go-libp2p-secio" - tls "github.com/libp2p/go-libp2p-tls" -) - -var DefaultTransports = simpleOpt(libp2p.DefaultTransports) -var QUIC = simpleOpt(libp2p.Transport(libp2pquic.NewTransport)) - -func Security(enabled, preferTLS bool) interface{} { - if !enabled { - return func() (opts Libp2pOpts) { - // TODO: shouldn't this be Errorf to guarantee visibility? - log.Warningf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS. - You will not be able to connect to any nodes configured to use encrypted connections`) - opts.Opts = append(opts.Opts, libp2p.NoSecurity) - return opts - } - } - return func() (opts Libp2pOpts) { - if preferTLS { - opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(tls.ID, tls.New), libp2p.Security(secio.ID, secio.New))) - } else { - opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(secio.ID, secio.New), libp2p.Security(tls.ID, tls.New))) - } - return opts - } -} - -func BandwidthCounter() (opts Libp2pOpts, reporter metrics.Reporter) { - reporter = metrics.NewBandwidthCounter() - opts.Opts = append(opts.Opts, libp2p.BandwidthReporter(reporter)) - return opts, reporter -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/provider.go b/vendor/github.com/ipfs/go-ipfs/core/node/provider.go deleted file mode 100644 index c87e2ac5..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/provider.go +++ /dev/null @@ -1,117 +0,0 @@ -package node - -import ( - "context" - "fmt" - "time" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/provider" - q "github.com/ipfs/go-ipfs/provider/queue" - "github.com/ipfs/go-ipfs/provider/simple" - "github.com/ipfs/go-ipfs/repo" - "github.com/libp2p/go-libp2p-core/routing" - "go.uber.org/fx" -) - -const kReprovideFrequency = time.Hour * 12 - -// SIMPLE - -// ProviderQueue creates new datastore backed provider queue -func ProviderQueue(mctx helpers.MetricsCtx, lc fx.Lifecycle, repo repo.Repo) (*q.Queue, error) { - return q.NewQueue(helpers.LifecycleCtx(mctx, lc), "provider-v1", repo.Datastore()) -} - -// SimpleProvider creates new record provider -func SimpleProvider(mctx helpers.MetricsCtx, lc fx.Lifecycle, queue *q.Queue, rt routing.Routing) provider.Provider { - return simple.NewProvider(helpers.LifecycleCtx(mctx, lc), queue, rt) -} - -// SimpleReprovider creates new reprovider -func SimpleReprovider(reproviderInterval time.Duration) interface{} { - return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, rt routing.Routing, keyProvider simple.KeyChanFunc) (provider.Reprovider, error) { - return simple.NewReprovider(helpers.LifecycleCtx(mctx, lc), reproviderInterval, rt, keyProvider), nil - } -} - -// SimpleProviderSys creates new provider system -func SimpleProviderSys(isOnline bool) interface{} { - return func(lc fx.Lifecycle, p provider.Provider, r provider.Reprovider) provider.System { - sys := provider.NewSystem(p, r) - - if isOnline { - lc.Append(fx.Hook{ - OnStart: func(ctx context.Context) error { - sys.Run() - return nil - }, - OnStop: func(ctx context.Context) error { - return sys.Close() - }, - }) - } - - return sys - } -} - -// ONLINE/OFFLINE - -// OnlineProviders groups units managing provider routing records online -func OnlineProviders(useStrategicProviding bool, reprovideStrategy string, reprovideInterval string) fx.Option { - if useStrategicProviding { - return fx.Provide(provider.NewOfflineProvider) - } - - return fx.Options( - SimpleProviders(reprovideStrategy, reprovideInterval), - fx.Provide(SimpleProviderSys(true)), - ) -} - -// OfflineProviders groups units managing provider routing records offline -func OfflineProviders(useStrategicProviding bool, reprovideStrategy string, reprovideInterval string) fx.Option { - if useStrategicProviding { - return fx.Provide(provider.NewOfflineProvider) - } - - return fx.Options( - SimpleProviders(reprovideStrategy, reprovideInterval), - fx.Provide(SimpleProviderSys(false)), - ) -} - -// SimpleProviders creates the simple provider/reprovider dependencies -func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Option { - reproviderInterval := kReprovideFrequency - if reprovideInterval != "" { - dur, err := time.ParseDuration(reprovideInterval) - if err != nil { - return fx.Error(err) - } - - reproviderInterval = dur - } - - var keyProvider fx.Option - switch reprovideStrategy { - case "all": - fallthrough - case "": - keyProvider = fx.Provide(simple.NewBlockstoreProvider) - case "roots": - keyProvider = fx.Provide(simple.NewPinnedProvider(true)) - case "pinned": - keyProvider = fx.Provide(simple.NewPinnedProvider(false)) - default: - return fx.Error(fmt.Errorf("unknown reprovider strategy '%s'", reprovideStrategy)) - } - - return fx.Options( - fx.Provide(ProviderQueue), - fx.Provide(SimpleProvider), - keyProvider, - fx.Provide(SimpleReprovider(reproviderInterval)), - ) -} diff --git a/vendor/github.com/ipfs/go-ipfs/core/node/storage.go b/vendor/github.com/ipfs/go-ipfs/core/node/storage.go deleted file mode 100644 index 008b1970..00000000 --- a/vendor/github.com/ipfs/go-ipfs/core/node/storage.go +++ /dev/null @@ -1,94 +0,0 @@ -package node - -import ( - "os" - "syscall" - "time" - - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/retrystore" - blockstore "github.com/ipfs/go-ipfs-blockstore" - config "github.com/ipfs/go-ipfs-config" - "go.uber.org/fx" - - "github.com/ipfs/go-ipfs/core/node/helpers" - "github.com/ipfs/go-ipfs/filestore" - "github.com/ipfs/go-ipfs/repo" - "github.com/ipfs/go-ipfs/thirdparty/cidv0v1" - "github.com/ipfs/go-ipfs/thirdparty/verifbs" -) - -func isTooManyFDError(err error) bool { - perr, ok := err.(*os.PathError) - if ok && perr.Err == syscall.EMFILE { - return true - } - - return false -} - -// RepoConfig loads configuration from the repo -func RepoConfig(repo repo.Repo) (*config.Config, error) { - return repo.Config() -} - -// Datastore provides the datastore -func Datastore(repo repo.Repo) datastore.Datastore { - return repo.Datastore() -} - -// BaseBlocks is the lower level blockstore without GC or Filestore layers -type BaseBlocks blockstore.Blockstore - -// BaseBlockstoreCtor creates cached blockstore backed by the provided datastore -func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead bool) func(mctx helpers.MetricsCtx, repo repo.Repo, lc fx.Lifecycle) (bs BaseBlocks, err error) { - return func(mctx helpers.MetricsCtx, repo repo.Repo, lc fx.Lifecycle) (bs BaseBlocks, err error) { - rds := &retrystore.Datastore{ - Batching: repo.Datastore(), - Delay: time.Millisecond * 200, - Retries: 6, - TempErrFunc: isTooManyFDError, - } - // hash security - bs = blockstore.NewBlockstore(rds) - bs = &verifbs.VerifBS{Blockstore: bs} - - if !nilRepo { - bs, err = blockstore.CachedBlockstore(helpers.LifecycleCtx(mctx, lc), bs, cacheOpts) - if err != nil { - return nil, err - } - } - - bs = blockstore.NewIdStore(bs) - bs = cidv0v1.NewBlockstore(bs) - - if hashOnRead { // TODO: review: this is how it was done originally, is there a reason we can't just pass this directly? - bs.HashOnRead(true) - } - - return - } -} - -// GcBlockstoreCtor wraps the base blockstore with GC and Filestore layers -func GcBlockstoreCtor(bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore) { - gclocker = blockstore.NewGCLocker() - gcbs = blockstore.NewGCBlockstore(bb, gclocker) - - bs = gcbs - return -} - -// GcBlockstoreCtor wraps GcBlockstore and adds Filestore support -func FilestoreBlockstoreCtor(repo repo.Repo, bb BaseBlocks) (gclocker blockstore.GCLocker, gcbs blockstore.GCBlockstore, bs blockstore.Blockstore, fstore *filestore.Filestore) { - gclocker = blockstore.NewGCLocker() - - // hash security - fstore = filestore.NewFilestore(bb, repo.FileManager()) - gcbs = blockstore.NewGCBlockstore(fstore, gclocker) - gcbs = &verifbs.VerifBSGC{GCBlockstore: gcbs} - - bs = gcbs - return -} diff --git a/vendor/github.com/ipfs/go-ipfs/dagutils/diff.go b/vendor/github.com/ipfs/go-ipfs/dagutils/diff.go deleted file mode 100644 index a43756ff..00000000 --- a/vendor/github.com/ipfs/go-ipfs/dagutils/diff.go +++ /dev/null @@ -1,211 +0,0 @@ -package dagutils - -import ( - "context" - "fmt" - "path" - - "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - dag "github.com/ipfs/go-merkledag" - coreiface "github.com/ipfs/interface-go-ipfs-core" -) - -// These constants define the changes that can be applied to a DAG. -const ( - Add = iota - Remove - Mod -) - -// Change represents a change to a DAG and contains a reference to the old and -// new CIDs. -type Change struct { - Type coreiface.ChangeType - Path string - Before cid.Cid - After cid.Cid -} - -// String prints a human-friendly line about a change. -func (c *Change) String() string { - switch c.Type { - case Add: - return fmt.Sprintf("Added %s at %s", c.After.String(), c.Path) - case Remove: - return fmt.Sprintf("Removed %s from %s", c.Before.String(), c.Path) - case Mod: - return fmt.Sprintf("Changed %s to %s at %s", c.Before.String(), c.After.String(), c.Path) - default: - panic("nope") - } -} - -// ApplyChange applies the requested changes to the given node in the given dag. -func ApplyChange(ctx context.Context, ds ipld.DAGService, nd *dag.ProtoNode, cs []*Change) (*dag.ProtoNode, error) { - e := NewDagEditor(nd, ds) - for _, c := range cs { - switch c.Type { - case Add: - child, err := ds.Get(ctx, c.After) - if err != nil { - return nil, err - } - - childpb, ok := child.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - err = e.InsertNodeAtPath(ctx, c.Path, childpb, nil) - if err != nil { - return nil, err - } - - case Remove: - err := e.RmLink(ctx, c.Path) - if err != nil { - return nil, err - } - - case Mod: - err := e.RmLink(ctx, c.Path) - if err != nil { - return nil, err - } - child, err := ds.Get(ctx, c.After) - if err != nil { - return nil, err - } - - childpb, ok := child.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - err = e.InsertNodeAtPath(ctx, c.Path, childpb, nil) - if err != nil { - return nil, err - } - } - } - - return e.Finalize(ctx, ds) -} - -// Diff returns a set of changes that transform node 'a' into node 'b'. -// It only traverses links in the following cases: -// 1. two node's links number are greater than 0. -// 2. both of two nodes are ProtoNode. -// Otherwise, it compares the cid and emits a Mod change object. -func Diff(ctx context.Context, ds ipld.DAGService, a, b ipld.Node) ([]*Change, error) { - // Base case where both nodes are leaves, just compare - // their CIDs. - if len(a.Links()) == 0 && len(b.Links()) == 0 { - return getChange(a, b) - } - - var out []*Change - cleanA, okA := a.Copy().(*dag.ProtoNode) - cleanB, okB := b.Copy().(*dag.ProtoNode) - if !okA || !okB { - return getChange(a, b) - } - - // strip out unchanged stuff - for _, lnk := range a.Links() { - l, _, err := b.ResolveLink([]string{lnk.Name}) - if err == nil { - if l.Cid.Equals(lnk.Cid) { - // no change... ignore it - } else { - anode, err := lnk.GetNode(ctx, ds) - if err != nil { - return nil, err - } - - bnode, err := l.GetNode(ctx, ds) - if err != nil { - return nil, err - } - - sub, err := Diff(ctx, ds, anode, bnode) - if err != nil { - return nil, err - } - - for _, subc := range sub { - subc.Path = path.Join(lnk.Name, subc.Path) - out = append(out, subc) - } - } - _ = cleanA.RemoveNodeLink(l.Name) - _ = cleanB.RemoveNodeLink(l.Name) - } - } - - for _, lnk := range cleanA.Links() { - out = append(out, &Change{ - Type: Remove, - Path: lnk.Name, - Before: lnk.Cid, - }) - } - for _, lnk := range cleanB.Links() { - out = append(out, &Change{ - Type: Add, - Path: lnk.Name, - After: lnk.Cid, - }) - } - - return out, nil -} - -// Conflict represents two incompatible changes and is returned by MergeDiffs(). -type Conflict struct { - A *Change - B *Change -} - -// MergeDiffs takes two slice of changes and adds them to a single slice. -// When a Change from b happens to the same path of an existing change in a, -// a conflict is created and b is not added to the merged slice. -// A slice of Conflicts is returned and contains pointers to the -// Changes involved (which share the same path). -func MergeDiffs(a, b []*Change) ([]*Change, []Conflict) { - var out []*Change - var conflicts []Conflict - paths := make(map[string]*Change) - for _, c := range a { - paths[c.Path] = c - } - - for _, c := range b { - if ca, ok := paths[c.Path]; ok { - conflicts = append(conflicts, Conflict{ - A: ca, - B: c, - }) - } else { - out = append(out, c) - } - } - for _, c := range paths { - out = append(out, c) - } - return out, conflicts -} - -func getChange(a, b ipld.Node) ([]*Change, error) { - if a.Cid().Equals(b.Cid()) { - return []*Change{}, nil - } - return []*Change{ - { - Type: Mod, - Before: a.Cid(), - After: b.Cid(), - }, - }, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/dagutils/diffenum.go b/vendor/github.com/ipfs/go-ipfs/dagutils/diffenum.go deleted file mode 100644 index 4ec74b2d..00000000 --- a/vendor/github.com/ipfs/go-ipfs/dagutils/diffenum.go +++ /dev/null @@ -1,99 +0,0 @@ -package dagutils - -import ( - "context" - "fmt" - - mdag "github.com/ipfs/go-merkledag" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// DiffEnumerate fetches every object in the graph pointed to by 'to' that is -// not in 'from'. This can be used to more efficiently fetch a graph if you can -// guarantee you already have the entirety of 'from' -func DiffEnumerate(ctx context.Context, dserv ipld.NodeGetter, from, to cid.Cid) error { - fnd, err := dserv.Get(ctx, from) - if err != nil { - return fmt.Errorf("get %s: %s", from, err) - } - - tnd, err := dserv.Get(ctx, to) - if err != nil { - return fmt.Errorf("get %s: %s", to, err) - } - - diff := getLinkDiff(fnd, tnd) - - sset := cid.NewSet() - for _, c := range diff { - // Since we're already assuming we have everything in the 'from' graph, - // add all those cids to our 'already seen' set to avoid potentially - // enumerating them later - if c.bef.Defined() { - sset.Add(c.bef) - } - } - for _, c := range diff { - if !c.bef.Defined() { - if sset.Has(c.aft) { - continue - } - err := mdag.EnumerateChildrenAsync(ctx, mdag.GetLinksDirect(dserv), c.aft, sset.Visit) - if err != nil { - return err - } - } else { - err := DiffEnumerate(ctx, dserv, c.bef, c.aft) - if err != nil { - return err - } - } - } - - return nil -} - -// if both bef and aft are not nil, then that signifies bef was replaces with aft. -// if bef is nil and aft is not, that means aft was newly added -// if aft is nil and bef is not, that means bef was deleted -type diffpair struct { - bef, aft cid.Cid -} - -// getLinkDiff returns a changeset between nodes 'a' and 'b'. Currently does -// not log deletions as our usecase doesnt call for this. -func getLinkDiff(a, b ipld.Node) []diffpair { - ina := make(map[string]*ipld.Link) - inb := make(map[string]*ipld.Link) - var aonly []cid.Cid - for _, l := range b.Links() { - inb[l.Cid.KeyString()] = l - } - for _, l := range a.Links() { - var key = l.Cid.KeyString() - ina[key] = l - if inb[key] == nil { - aonly = append(aonly, l.Cid) - } - } - - var out []diffpair - var aindex int - - for _, l := range b.Links() { - if ina[l.Cid.KeyString()] != nil { - continue - } - - if aindex < len(aonly) { - out = append(out, diffpair{bef: aonly[aindex], aft: l.Cid}) - aindex++ - } else { - out = append(out, diffpair{aft: l.Cid}) - continue - } - } - return out -} diff --git a/vendor/github.com/ipfs/go-ipfs/dagutils/utils.go b/vendor/github.com/ipfs/go-ipfs/dagutils/utils.go deleted file mode 100644 index 3a796a9c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/dagutils/utils.go +++ /dev/null @@ -1,234 +0,0 @@ -package dagutils - -import ( - "context" - "errors" - - bserv "github.com/ipfs/go-blockservice" - dag "github.com/ipfs/go-merkledag" - path "github.com/ipfs/go-path" - - ds "github.com/ipfs/go-datastore" - syncds "github.com/ipfs/go-datastore/sync" - bstore "github.com/ipfs/go-ipfs-blockstore" - offline "github.com/ipfs/go-ipfs-exchange-offline" - ipld "github.com/ipfs/go-ipld-format" -) - -// Editor represents a ProtoNode tree editor and provides methods to -// modify it. -type Editor struct { - root *dag.ProtoNode - - // tmp is a temporary in memory (for now) dagstore for all of the - // intermediary nodes to be stored in - tmp ipld.DAGService - - // src is the dagstore with *all* of the data on it, it is used to pull - // nodes from for modification (nil is a valid value) - src ipld.DAGService -} - -// NewMemoryDagService returns a new, thread-safe in-memory DAGService. -func NewMemoryDagService() ipld.DAGService { - // build mem-datastore for editor's intermediary nodes - bs := bstore.NewBlockstore(syncds.MutexWrap(ds.NewMapDatastore())) - bsrv := bserv.New(bs, offline.Exchange(bs)) - return dag.NewDAGService(bsrv) -} - -// NewDagEditor returns an ProtoNode editor. -// -// * root is the node to be modified -// * source is the dagstore to pull nodes from (optional) -func NewDagEditor(root *dag.ProtoNode, source ipld.DAGService) *Editor { - return &Editor{ - root: root, - tmp: NewMemoryDagService(), - src: source, - } -} - -// GetNode returns the a copy of the root node being edited. -func (e *Editor) GetNode() *dag.ProtoNode { - return e.root.Copy().(*dag.ProtoNode) -} - -// GetDagService returns the DAGService used by this editor. -func (e *Editor) GetDagService() ipld.DAGService { - return e.tmp -} - -func addLink(ctx context.Context, ds ipld.DAGService, root *dag.ProtoNode, childname string, childnd ipld.Node) (*dag.ProtoNode, error) { - if childname == "" { - return nil, errors.New("cannot create link with no name") - } - - // ensure that the node we are adding is in the dagservice - err := ds.Add(ctx, childnd) - if err != nil { - return nil, err - } - - _ = ds.Remove(ctx, root.Cid()) - - // ensure no link with that name already exists - _ = root.RemoveNodeLink(childname) // ignore error, only option is ErrNotFound - - if err := root.AddNodeLink(childname, childnd); err != nil { - return nil, err - } - - if err := ds.Add(ctx, root); err != nil { - return nil, err - } - return root, nil -} - -// InsertNodeAtPath inserts a new node in the tree and replaces the current root with the new one. -func (e *Editor) InsertNodeAtPath(ctx context.Context, pth string, toinsert ipld.Node, create func() *dag.ProtoNode) error { - splpath := path.SplitList(pth) - nd, err := e.insertNodeAtPath(ctx, e.root, splpath, toinsert, create) - if err != nil { - return err - } - e.root = nd - return nil -} - -func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.ProtoNode, path []string, toinsert ipld.Node, create func() *dag.ProtoNode) (*dag.ProtoNode, error) { - if len(path) == 1 { - return addLink(ctx, e.tmp, root, path[0], toinsert) - } - - nd, err := root.GetLinkedProtoNode(ctx, e.tmp, path[0]) - if err != nil { - // if 'create' is true, we create directories on the way down as needed - if err == dag.ErrLinkNotFound && create != nil { - nd = create() - err = nil // no longer an error case - } else if err == ipld.ErrNotFound { - // try finding it in our source dagstore - nd, err = root.GetLinkedProtoNode(ctx, e.src, path[0]) - } - - // if we receive an ErrNotFound, then our second 'GetLinkedNode' call - // also fails, we want to error out - if err != nil { - return nil, err - } - } - - ndprime, err := e.insertNodeAtPath(ctx, nd, path[1:], toinsert, create) - if err != nil { - return nil, err - } - - _ = e.tmp.Remove(ctx, root.Cid()) - - _ = root.RemoveNodeLink(path[0]) - err = root.AddNodeLink(path[0], ndprime) - if err != nil { - return nil, err - } - - err = e.tmp.Add(ctx, root) - if err != nil { - return nil, err - } - - return root, nil -} - -// RmLink removes the link with the given name and updates the root node of -// the editor. -func (e *Editor) RmLink(ctx context.Context, pth string) error { - splpath := path.SplitList(pth) - nd, err := e.rmLink(ctx, e.root, splpath) - if err != nil { - return err - } - e.root = nd - return nil -} - -func (e *Editor) rmLink(ctx context.Context, root *dag.ProtoNode, path []string) (*dag.ProtoNode, error) { - if len(path) == 1 { - // base case, remove node in question - err := root.RemoveNodeLink(path[0]) - if err != nil { - return nil, err - } - - err = e.tmp.Add(ctx, root) - if err != nil { - return nil, err - } - - return root, nil - } - - // search for node in both tmp dagstore and source dagstore - nd, err := root.GetLinkedProtoNode(ctx, e.tmp, path[0]) - if err == ipld.ErrNotFound { - nd, err = root.GetLinkedProtoNode(ctx, e.src, path[0]) - } - - if err != nil { - return nil, err - } - - nnode, err := e.rmLink(ctx, nd, path[1:]) - if err != nil { - return nil, err - } - - _ = e.tmp.Remove(ctx, root.Cid()) - - _ = root.RemoveNodeLink(path[0]) - err = root.AddNodeLink(path[0], nnode) - if err != nil { - return nil, err - } - - err = e.tmp.Add(ctx, root) - if err != nil { - return nil, err - } - - return root, nil -} - -// Finalize writes the new DAG to the given DAGService and returns the modified -// root node. -func (e *Editor) Finalize(ctx context.Context, ds ipld.DAGService) (*dag.ProtoNode, error) { - nd := e.GetNode() - err := copyDag(ctx, nd, e.tmp, ds) - return nd, err -} - -func copyDag(ctx context.Context, nd ipld.Node, from, to ipld.DAGService) error { - // TODO(#4609): make this batch. - err := to.Add(ctx, nd) - if err != nil { - return err - } - - for _, lnk := range nd.Links() { - child, err := lnk.GetNode(ctx, from) - if err != nil { - if err == ipld.ErrNotFound { - // not found means we didnt modify it, and it should - // already be in the target datastore - continue - } - return err - } - - err = copyDag(ctx, child, from, to) - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/doc.go b/vendor/github.com/ipfs/go-ipfs/doc.go deleted file mode 100644 index 1183559a..00000000 --- a/vendor/github.com/ipfs/go-ipfs/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -/* -IPFS is a global, versioned, peer-to-peer filesystem -*/ -package ipfs diff --git a/vendor/github.com/ipfs/go-ipfs/docs/AUTHORS b/vendor/github.com/ipfs/go-ipfs/docs/AUTHORS deleted file mode 100644 index 85a6e160..00000000 --- a/vendor/github.com/ipfs/go-ipfs/docs/AUTHORS +++ /dev/null @@ -1,112 +0,0 @@ -# This file lists all individuals having contributed content to the repository. -# For how it is generated, see `docs/generate-authors.sh`. - -Aaron Hill -Adam Gashlin -Adrian Ulrich -Alex -anarcat -Andres Buritica -Andrew Chin -Andy Leap -Artem Andreenko -Baptiste Jonglez -Brendan Benshoof -Brendan Mc -Brian Tiger Chow -Caio Alonso -Carlos Cobo -Cayman Nava -Chas Leichner -Chris Grimmett -Chris P -Chris Sasarak -Christian Couder -Christian Kniep -Christopher Sasarak -David -David Braun -David Dias -David Wagner -dignifiedquire -Dominic Della Valle -Dominic Tarr -drathir -Dylan Powers -Emery Hemingway -epitron -Ethan Buchman -Etienne Laurin -Forrest Weston -Francesco Canessa -gatesvp -Giuseppe Bertone -Harlan T Wood -Hector Sanjuan -Henry -Ho-Sheng Hsiao -Jakub Sztandera -Jason Carver -Jonathan Dahan -Juan Batiz-Benet -Karthik Bala -Kevin Atkinson -Kevin Wallace -klauspost -Knut Ahlers -Konstantin Koroviev -kpcyrd -Kristoffer Ström -Lars Gierth -llSourcell -Marcin Janczyk -Marcin Rataj -Markus Amalthea Magnuson -michael -Michael Lovci -Michael Muré -Michael Pfister -Mildred Ki'Lya -Muneeb Ali -Nick Hamann -palkeo -Patrick Connolly -Pavol Rusnak -Peter Borzov -Philip Nelson -Quinn Slack -ReadmeCritic -rht -Richard Littauer -Robert Carlsen -Roerick Sweeney -Sean Lang -SH -Shanti Bouchez-Mongardé -Shaun Bruce -Simon Kirkby -Siraj Ravel -Siva Chandran -slothbag -sroerick -Stephan Seidt -Stephen Sugden -Stephen Whitmore -Steven Allen -Tarnay Kálmán -theswitch -Thomas Gardner -Tim Groeneveld -Tommi Virtanen -Tonis Tiigi -Tor Arne Vestbø -Travis Person -verokarhu -Vijayee Kulkaa -Vitor Baptista -vitzli -W. Trevor King -Whyrusleeping -wzhd -Yuval Langer -ᴍᴀᴛᴛ ʙᴇʟʟ diff --git a/vendor/github.com/ipfs/go-ipfs/docs/generate-authors.sh b/vendor/github.com/ipfs/go-ipfs/docs/generate-authors.sh deleted file mode 100755 index 75b33b7e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/docs/generate-authors.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -# see also ".mailmap" for how email addresses and names are deduplicated - - -cat >AUTHORS <<-'EOF' -# This file lists all individuals having contributed content to the repository. -# For how it is generated, see `docs/generate-authors.sh`. - -EOF -git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf >>AUTHORS diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/filestore.go b/vendor/github.com/ipfs/go-ipfs/filestore/filestore.go deleted file mode 100644 index be4d954b..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/filestore.go +++ /dev/null @@ -1,251 +0,0 @@ -// Package filestore implements a Blockstore which is able to read certain -// blocks of data directly from its original location in the filesystem. -// -// In a Filestore, object leaves are stored as FilestoreNodes. FilestoreNodes -// include a filesystem path and an offset, allowing a Blockstore dealing with -// such blocks to avoid storing the whole contents and reading them from their -// filesystem location instead. -package filestore - -import ( - "context" - "errors" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - dsq "github.com/ipfs/go-datastore/query" - blockstore "github.com/ipfs/go-ipfs-blockstore" - posinfo "github.com/ipfs/go-ipfs-posinfo" - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("filestore") - -var ErrFilestoreNotEnabled = errors.New("filestore is not enabled, see https://git.io/vNItf") -var ErrUrlstoreNotEnabled = errors.New("urlstore is not enabled") - -// Filestore implements a Blockstore by combining a standard Blockstore -// to store regular blocks and a special Blockstore called -// FileManager to store blocks which data exists in an external file. -type Filestore struct { - fm *FileManager - bs blockstore.Blockstore -} - -// FileManager returns the FileManager in Filestore. -func (f *Filestore) FileManager() *FileManager { - return f.fm -} - -// MainBlockstore returns the standard Blockstore in the Filestore. -func (f *Filestore) MainBlockstore() blockstore.Blockstore { - return f.bs -} - -// NewFilestore creates one using the given Blockstore and FileManager. -func NewFilestore(bs blockstore.Blockstore, fm *FileManager) *Filestore { - return &Filestore{fm, bs} -} - -// AllKeysChan returns a channel from which to read the keys stored in -// the blockstore. If the given context is cancelled the channel will be closed. -func (f *Filestore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - ctx, cancel := context.WithCancel(ctx) - - a, err := f.bs.AllKeysChan(ctx) - if err != nil { - cancel() - return nil, err - } - - out := make(chan cid.Cid, dsq.KeysOnlyBufSize) - go func() { - defer cancel() - defer close(out) - - var done bool - for !done { - select { - case c, ok := <-a: - if !ok { - done = true - continue - } - select { - case out <- c: - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } - - // Can't do these at the same time because the abstractions around - // leveldb make us query leveldb for both operations. We apparently - // cant query leveldb concurrently - b, err := f.fm.AllKeysChan(ctx) - if err != nil { - log.Error("error querying filestore: ", err) - return - } - - done = false - for !done { - select { - case c, ok := <-b: - if !ok { - done = true - continue - } - select { - case out <- c: - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } - }() - return out, nil -} - -// DeleteBlock deletes the block with the given key from the -// blockstore. As expected, in the case of FileManager blocks, only the -// reference is deleted, not its contents. It may return -// ErrNotFound when the block is not stored. -func (f *Filestore) DeleteBlock(c cid.Cid) error { - err1 := f.bs.DeleteBlock(c) - if err1 != nil && err1 != blockstore.ErrNotFound { - return err1 - } - - err2 := f.fm.DeleteBlock(c) - // if we successfully removed something from the blockstore, but the - // filestore didnt have it, return success - - switch err2 { - case nil: - return nil - case blockstore.ErrNotFound: - if err1 == blockstore.ErrNotFound { - return blockstore.ErrNotFound - } - return nil - default: - return err2 - } -} - -// Get retrieves the block with the given Cid. It may return -// ErrNotFound when the block is not stored. -func (f *Filestore) Get(c cid.Cid) (blocks.Block, error) { - blk, err := f.bs.Get(c) - switch err { - case nil: - return blk, nil - case blockstore.ErrNotFound: - return f.fm.Get(c) - default: - return nil, err - } -} - -// GetSize returns the size of the requested block. It may return ErrNotFound -// when the block is not stored. -func (f *Filestore) GetSize(c cid.Cid) (int, error) { - size, err := f.bs.GetSize(c) - switch err { - case nil: - return size, nil - case blockstore.ErrNotFound: - return f.fm.GetSize(c) - default: - return -1, err - } -} - -// Has returns true if the block with the given Cid is -// stored in the Filestore. -func (f *Filestore) Has(c cid.Cid) (bool, error) { - has, err := f.bs.Has(c) - if err != nil { - return false, err - } - - if has { - return true, nil - } - - return f.fm.Has(c) -} - -// Put stores a block in the Filestore. For blocks of -// underlying type FilestoreNode, the operation is -// delegated to the FileManager, while the rest of blocks -// are handled by the regular blockstore. -func (f *Filestore) Put(b blocks.Block) error { - has, err := f.Has(b.Cid()) - if err != nil { - return err - } - - if has { - return nil - } - - switch b := b.(type) { - case *posinfo.FilestoreNode: - return f.fm.Put(b) - default: - return f.bs.Put(b) - } -} - -// PutMany is like Put(), but takes a slice of blocks, allowing -// the underlying blockstore to perform batch transactions. -func (f *Filestore) PutMany(bs []blocks.Block) error { - var normals []blocks.Block - var fstores []*posinfo.FilestoreNode - - for _, b := range bs { - has, err := f.Has(b.Cid()) - if err != nil { - return err - } - - if has { - continue - } - - switch b := b.(type) { - case *posinfo.FilestoreNode: - fstores = append(fstores, b) - default: - normals = append(normals, b) - } - } - - if len(normals) > 0 { - err := f.bs.PutMany(normals) - if err != nil { - return err - } - } - - if len(fstores) > 0 { - err := f.fm.PutMany(fstores) - if err != nil { - return err - } - } - return nil -} - -// HashOnRead calls blockstore.HashOnRead. -func (f *Filestore) HashOnRead(enabled bool) { - f.bs.HashOnRead(enabled) -} - -var _ blockstore.Blockstore = (*Filestore)(nil) diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/fsrefstore.go b/vendor/github.com/ipfs/go-ipfs/filestore/fsrefstore.go deleted file mode 100644 index 320ee592..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/fsrefstore.go +++ /dev/null @@ -1,330 +0,0 @@ -package filestore - -import ( - "context" - "fmt" - "io" - "net/http" - "os" - "path/filepath" - - pb "github.com/ipfs/go-ipfs/filestore/pb" - - proto "github.com/gogo/protobuf/proto" - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - dsns "github.com/ipfs/go-datastore/namespace" - dsq "github.com/ipfs/go-datastore/query" - blockstore "github.com/ipfs/go-ipfs-blockstore" - dshelp "github.com/ipfs/go-ipfs-ds-help" - posinfo "github.com/ipfs/go-ipfs-posinfo" -) - -// FilestorePrefix identifies the key prefix for FileManager blocks. -var FilestorePrefix = ds.NewKey("filestore") - -// FileManager is a blockstore implementation which stores special -// blocks FilestoreNode type. These nodes only contain a reference -// to the actual location of the block data in the filesystem -// (a path and an offset). -type FileManager struct { - AllowFiles bool - AllowUrls bool - ds ds.Batching - root string -} - -// CorruptReferenceError implements the error interface. -// It is used to indicate that the block contents pointed -// by the referencing blocks cannot be retrieved (i.e. the -// file is not found, or the data changed as it was being read). -type CorruptReferenceError struct { - Code Status - Err error -} - -// Error() returns the error message in the CorruptReferenceError -// as a string. -func (c CorruptReferenceError) Error() string { - return c.Err.Error() -} - -// NewFileManager initializes a new file manager with the given -// datastore and root. All FilestoreNodes paths are relative to the -// root path given here, which is prepended for any operations. -func NewFileManager(ds ds.Batching, root string) *FileManager { - return &FileManager{ds: dsns.Wrap(ds, FilestorePrefix), root: root} -} - -// AllKeysChan returns a channel from which to read the keys stored in -// the FileManager. If the given context is cancelled the channel will be -// closed. -func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { - q := dsq.Query{KeysOnly: true} - - res, err := f.ds.Query(q) - if err != nil { - return nil, err - } - - out := make(chan cid.Cid, dsq.KeysOnlyBufSize) - go func() { - defer close(out) - for { - v, ok := res.NextSync() - if !ok { - return - } - - k := ds.RawKey(v.Key) - c, err := dshelp.DsKeyToCid(k) - if err != nil { - log.Errorf("decoding cid from filestore: %s", err) - continue - } - - select { - case out <- c: - case <-ctx.Done(): - return - } - } - }() - - return out, nil -} - -// DeleteBlock deletes the reference-block from the underlying -// datastore. It does not touch the referenced data. -func (f *FileManager) DeleteBlock(c cid.Cid) error { - err := f.ds.Delete(dshelp.CidToDsKey(c)) - if err == ds.ErrNotFound { - return blockstore.ErrNotFound - } - return err -} - -// Get reads a block from the datastore. Reading a block -// is done in two steps: the first step retrieves the reference -// block from the datastore. The second step uses the stored -// path and offsets to read the raw block data directly from disk. -func (f *FileManager) Get(c cid.Cid) (blocks.Block, error) { - dobj, err := f.getDataObj(c) - if err != nil { - return nil, err - } - out, err := f.readDataObj(c, dobj) - if err != nil { - return nil, err - } - - return blocks.NewBlockWithCid(out, c) -} - -// GetSize gets the size of the block from the datastore. -// -// This method may successfully return the size even if returning the block -// would fail because the associated file is no longer available. -func (f *FileManager) GetSize(c cid.Cid) (int, error) { - dobj, err := f.getDataObj(c) - if err != nil { - return -1, err - } - return int(dobj.GetSize_()), nil -} - -func (f *FileManager) readDataObj(c cid.Cid, d *pb.DataObj) ([]byte, error) { - if IsURL(d.GetFilePath()) { - return f.readURLDataObj(c, d) - } - return f.readFileDataObj(c, d) -} - -func (f *FileManager) getDataObj(c cid.Cid) (*pb.DataObj, error) { - o, err := f.ds.Get(dshelp.CidToDsKey(c)) - switch err { - case ds.ErrNotFound: - return nil, blockstore.ErrNotFound - default: - return nil, err - case nil: - // - } - - return unmarshalDataObj(o) -} - -func unmarshalDataObj(data []byte) (*pb.DataObj, error) { - var dobj pb.DataObj - if err := proto.Unmarshal(data, &dobj); err != nil { - return nil, err - } - - return &dobj, nil -} - -func (f *FileManager) readFileDataObj(c cid.Cid, d *pb.DataObj) ([]byte, error) { - if !f.AllowFiles { - return nil, ErrFilestoreNotEnabled - } - - p := filepath.FromSlash(d.GetFilePath()) - abspath := filepath.Join(f.root, p) - - fi, err := os.Open(abspath) - if os.IsNotExist(err) { - return nil, &CorruptReferenceError{StatusFileNotFound, err} - } else if err != nil { - return nil, &CorruptReferenceError{StatusFileError, err} - } - defer fi.Close() - - _, err = fi.Seek(int64(d.GetOffset()), io.SeekStart) - if err != nil { - return nil, &CorruptReferenceError{StatusFileError, err} - } - - outbuf := make([]byte, d.GetSize_()) - _, err = io.ReadFull(fi, outbuf) - if err == io.EOF || err == io.ErrUnexpectedEOF { - return nil, &CorruptReferenceError{StatusFileChanged, err} - } else if err != nil { - return nil, &CorruptReferenceError{StatusFileError, err} - } - - outcid, err := c.Prefix().Sum(outbuf) - if err != nil { - return nil, err - } - - if !c.Equals(outcid) { - return nil, &CorruptReferenceError{StatusFileChanged, - fmt.Errorf("data in file did not match. %s offset %d", d.GetFilePath(), d.GetOffset())} - } - - return outbuf, nil -} - -// reads and verifies the block from URL -func (f *FileManager) readURLDataObj(c cid.Cid, d *pb.DataObj) ([]byte, error) { - if !f.AllowUrls { - return nil, ErrUrlstoreNotEnabled - } - - req, err := http.NewRequest("GET", d.GetFilePath(), nil) - if err != nil { - return nil, err - } - - req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", d.GetOffset(), d.GetOffset()+d.GetSize_()-1)) - - res, err := http.DefaultClient.Do(req) - if err != nil { - return nil, &CorruptReferenceError{StatusFileError, err} - } - if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusPartialContent { - return nil, &CorruptReferenceError{StatusFileError, - fmt.Errorf("expected HTTP 200 or 206 got %d", res.StatusCode)} - } - - outbuf := make([]byte, d.GetSize_()) - _, err = io.ReadFull(res.Body, outbuf) - if err == io.EOF || err == io.ErrUnexpectedEOF { - return nil, &CorruptReferenceError{StatusFileChanged, err} - } else if err != nil { - return nil, &CorruptReferenceError{StatusFileError, err} - } - res.Body.Close() - - outcid, err := c.Prefix().Sum(outbuf) - if err != nil { - return nil, err - } - - if !c.Equals(outcid) { - return nil, &CorruptReferenceError{StatusFileChanged, - fmt.Errorf("data in file did not match. %s offset %d", d.GetFilePath(), d.GetOffset())} - } - - return outbuf, nil -} - -// Has returns if the FileManager is storing a block reference. It does not -// validate the data, nor checks if the reference is valid. -func (f *FileManager) Has(c cid.Cid) (bool, error) { - // NOTE: interesting thing to consider. Has doesnt validate the data. - // So the data on disk could be invalid, and we could think we have it. - dsk := dshelp.CidToDsKey(c) - return f.ds.Has(dsk) -} - -type putter interface { - Put(ds.Key, []byte) error -} - -// Put adds a new reference block to the FileManager. It does not check -// that the reference is valid. -func (f *FileManager) Put(b *posinfo.FilestoreNode) error { - return f.putTo(b, f.ds) -} - -func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error { - var dobj pb.DataObj - - if IsURL(b.PosInfo.FullPath) { - if !f.AllowUrls { - return ErrUrlstoreNotEnabled - } - dobj.FilePath = b.PosInfo.FullPath - } else { - if !f.AllowFiles { - return ErrFilestoreNotEnabled - } - if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { //nolint:staticcheck - return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root) - } - - p, err := filepath.Rel(f.root, b.PosInfo.FullPath) - if err != nil { - return err - } - - dobj.FilePath = filepath.ToSlash(p) - } - dobj.Offset = b.PosInfo.Offset - dobj.Size_ = uint64(len(b.RawData())) - - data, err := proto.Marshal(&dobj) - if err != nil { - return err - } - - return to.Put(dshelp.CidToDsKey(b.Cid()), data) -} - -// PutMany is like Put() but takes a slice of blocks instead, -// allowing it to create a batch transaction. -func (f *FileManager) PutMany(bs []*posinfo.FilestoreNode) error { - batch, err := f.ds.Batch() - if err != nil { - return err - } - - for _, b := range bs { - if err := f.putTo(b, batch); err != nil { - return err - } - } - - return batch.Commit() -} - -// IsURL returns true if the string represents a valid URL that the -// urlstore can handle. More specifically it returns true if a string -// begins with 'http://' or 'https://'. -func IsURL(str string) bool { - return (len(str) > 7 && str[0] == 'h' && str[1] == 't' && str[2] == 't' && str[3] == 'p') && - ((len(str) > 8 && str[4] == 's' && str[5] == ':' && str[6] == '/' && str[7] == '/') || - (str[4] == ':' && str[5] == '/' && str[6] == '/')) -} diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/pb/Rules.mk b/vendor/github.com/ipfs/go-ipfs/filestore/pb/Rules.mk deleted file mode 100644 index 505f70e7..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/pb/Rules.mk +++ /dev/null @@ -1,8 +0,0 @@ -include mk/header.mk - -PB_$(d) = $(wildcard $(d)/*.proto) -TGTS_$(d) = $(PB_$(d):.proto=.pb.go) - -#DEPS_GO += $(TGTS_$(d)) - -include mk/footer.mk diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.pb.go b/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.pb.go deleted file mode 100644 index 59650a11..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.pb.go +++ /dev/null @@ -1,399 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: filestore/pb/dataobj.proto - -package datastore_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type DataObj struct { - FilePath string `protobuf:"bytes,1,opt,name=FilePath" json:"FilePath"` - Offset uint64 `protobuf:"varint,2,opt,name=Offset" json:"Offset"` - Size_ uint64 `protobuf:"varint,3,opt,name=Size" json:"Size"` -} - -func (m *DataObj) Reset() { *m = DataObj{} } -func (m *DataObj) String() string { return proto.CompactTextString(m) } -func (*DataObj) ProtoMessage() {} -func (*DataObj) Descriptor() ([]byte, []int) { - return fileDescriptor_86a3613fbaff9a6c, []int{0} -} -func (m *DataObj) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DataObj) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DataObj.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DataObj) XXX_Merge(src proto.Message) { - xxx_messageInfo_DataObj.Merge(m, src) -} -func (m *DataObj) XXX_Size() int { - return m.Size() -} -func (m *DataObj) XXX_DiscardUnknown() { - xxx_messageInfo_DataObj.DiscardUnknown(m) -} - -var xxx_messageInfo_DataObj proto.InternalMessageInfo - -func (m *DataObj) GetFilePath() string { - if m != nil { - return m.FilePath - } - return "" -} - -func (m *DataObj) GetOffset() uint64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *DataObj) GetSize_() uint64 { - if m != nil { - return m.Size_ - } - return 0 -} - -func init() { - proto.RegisterType((*DataObj)(nil), "datastore.pb.DataObj") -} - -func init() { proto.RegisterFile("filestore/pb/dataobj.proto", fileDescriptor_86a3613fbaff9a6c) } - -var fileDescriptor_86a3613fbaff9a6c = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xcb, 0xcc, 0x49, - 0x2d, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2f, 0x48, 0xd2, 0x4f, 0x49, 0x2c, 0x49, 0xcc, 0x4f, 0xca, - 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x71, 0xc1, 0x72, 0x7a, 0x05, 0x49, 0x4a, - 0xc9, 0x5c, 0xec, 0x2e, 0x89, 0x25, 0x89, 0xfe, 0x49, 0x59, 0x42, 0x0a, 0x5c, 0x1c, 0x6e, 0x99, - 0x39, 0xa9, 0x01, 0x89, 0x25, 0x19, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x2c, 0x27, 0xee, - 0xc9, 0x33, 0x04, 0xc1, 0x45, 0x85, 0x64, 0xb8, 0xd8, 0xfc, 0xd3, 0xd2, 0x8a, 0x53, 0x4b, 0x24, - 0x98, 0x14, 0x18, 0x35, 0x58, 0xa0, 0xf2, 0x50, 0x31, 0x21, 0x09, 0x2e, 0x96, 0xe0, 0xcc, 0xaa, - 0x54, 0x09, 0x66, 0x24, 0x39, 0xb0, 0x88, 0x93, 0xc4, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, - 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, - 0xcb, 0x31, 0x00, 0x02, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x87, 0xf5, 0x88, 0xa9, 0x00, 0x00, 0x00, -} - -func (m *DataObj) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DataObj) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintDataobj(dAtA, i, uint64(len(m.FilePath))) - i += copy(dAtA[i:], m.FilePath) - dAtA[i] = 0x10 - i++ - i = encodeVarintDataobj(dAtA, i, uint64(m.Offset)) - dAtA[i] = 0x18 - i++ - i = encodeVarintDataobj(dAtA, i, uint64(m.Size_)) - return i, nil -} - -func encodeVarintDataobj(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *DataObj) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FilePath) - n += 1 + l + sovDataobj(uint64(l)) - n += 1 + sovDataobj(uint64(m.Offset)) - n += 1 + sovDataobj(uint64(m.Size_)) - return n -} - -func sovDataobj(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozDataobj(x uint64) (n int) { - return sovDataobj(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *DataObj) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDataobj - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DataObj: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DataObj: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FilePath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDataobj - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthDataobj - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDataobj - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FilePath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDataobj - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) - } - m.Size_ = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDataobj - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Size_ |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipDataobj(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthDataobj - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthDataobj - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipDataobj(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDataobj - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDataobj - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDataobj - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthDataobj - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthDataobj - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDataobj - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipDataobj(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthDataobj - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthDataobj = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDataobj = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.proto b/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.proto deleted file mode 100644 index 909d22b7..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/pb/dataobj.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto2"; - -package datastore.pb; - -message DataObj { - optional string FilePath = 1; - optional uint64 Offset = 2; - optional uint64 Size = 3; -} diff --git a/vendor/github.com/ipfs/go-ipfs/filestore/util.go b/vendor/github.com/ipfs/go-ipfs/filestore/util.go deleted file mode 100644 index 4f394959..00000000 --- a/vendor/github.com/ipfs/go-ipfs/filestore/util.go +++ /dev/null @@ -1,287 +0,0 @@ -package filestore - -import ( - "fmt" - "sort" - - pb "github.com/ipfs/go-ipfs/filestore/pb" - - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" - blockstore "github.com/ipfs/go-ipfs-blockstore" - dshelp "github.com/ipfs/go-ipfs-ds-help" -) - -// Status is used to identify the state of the block data referenced -// by a FilestoreNode. Among other places, it is used by CorruptReferenceError. -type Status int32 - -// These are the supported Status codes. -const ( - StatusOk Status = 0 - StatusFileError Status = 10 // Backing File Error - StatusFileNotFound Status = 11 // Backing File Not Found - StatusFileChanged Status = 12 // Contents of the file changed - StatusOtherError Status = 20 // Internal Error, likely corrupt entry - StatusKeyNotFound Status = 30 -) - -// String provides a human-readable representation for Status codes. -func (s Status) String() string { - switch s { - case StatusOk: - return "ok" - case StatusFileError: - return "error" - case StatusFileNotFound: - return "no-file" - case StatusFileChanged: - return "changed" - case StatusOtherError: - return "ERROR" - case StatusKeyNotFound: - return "missing" - default: - return "???" - } -} - -// Format returns the status formatted as a string -// with leading 0s. -func (s Status) Format() string { - return fmt.Sprintf("%-7s", s.String()) -} - -// ListRes wraps the response of the List*() functions, which -// allows to obtain and verify blocks stored by the FileManager -// of a Filestore. It includes information about the referenced -// block. -type ListRes struct { - Status Status - ErrorMsg string - Key cid.Cid - FilePath string - Offset uint64 - Size uint64 -} - -// FormatLong returns a human readable string for a ListRes object -func (r *ListRes) FormatLong(enc func(cid.Cid) string) string { - if enc == nil { - enc = (cid.Cid).String - } - switch { - case !r.Key.Defined(): - return "" - case r.FilePath == "": - return r.Key.String() - default: - return fmt.Sprintf("%-50s %6d %s %d", enc(r.Key), r.Size, r.FilePath, r.Offset) - } -} - -// List fetches the block with the given key from the Filemanager -// of the given Filestore and returns a ListRes object with the information. -// List does not verify that the reference is valid or whether the -// raw data is accesible. See Verify(). -func List(fs *Filestore, key cid.Cid) *ListRes { - return list(fs, false, key) -} - -// ListAll returns a function as an iterator which, once invoked, returns -// one by one each block in the Filestore's FileManager. -// ListAll does not verify that the references are valid or whether -// the raw data is accessible. See VerifyAll(). -func ListAll(fs *Filestore, fileOrder bool) (func() *ListRes, error) { - if fileOrder { - return listAllFileOrder(fs, false) - } - return listAll(fs, false) -} - -// Verify fetches the block with the given key from the Filemanager -// of the given Filestore and returns a ListRes object with the information. -// Verify makes sure that the reference is valid and the block data can be -// read. -func Verify(fs *Filestore, key cid.Cid) *ListRes { - return list(fs, true, key) -} - -// VerifyAll returns a function as an iterator which, once invoked, -// returns one by one each block in the Filestore's FileManager. -// VerifyAll checks that the reference is valid and that the block data -// can be read. -func VerifyAll(fs *Filestore, fileOrder bool) (func() *ListRes, error) { - if fileOrder { - return listAllFileOrder(fs, true) - } - return listAll(fs, true) -} - -func list(fs *Filestore, verify bool, key cid.Cid) *ListRes { - dobj, err := fs.fm.getDataObj(key) - if err != nil { - return mkListRes(key, nil, err) - } - if verify { - _, err = fs.fm.readDataObj(key, dobj) - } - return mkListRes(key, dobj, err) -} - -func listAll(fs *Filestore, verify bool) (func() *ListRes, error) { - q := dsq.Query{} - qr, err := fs.fm.ds.Query(q) - if err != nil { - return nil, err - } - - return func() *ListRes { - cid, dobj, err := next(qr) - if dobj == nil && err == nil { - return nil - } else if err == nil && verify { - _, err = fs.fm.readDataObj(cid, dobj) - } - return mkListRes(cid, dobj, err) - }, nil -} - -func next(qr dsq.Results) (cid.Cid, *pb.DataObj, error) { - v, ok := qr.NextSync() - if !ok { - return cid.Cid{}, nil, nil - } - - k := ds.RawKey(v.Key) - c, err := dshelp.DsKeyToCid(k) - if err != nil { - return cid.Cid{}, nil, fmt.Errorf("decoding cid from filestore: %s", err) - } - - dobj, err := unmarshalDataObj(v.Value) - if err != nil { - return c, nil, err - } - - return c, dobj, nil -} - -func listAllFileOrder(fs *Filestore, verify bool) (func() *ListRes, error) { - q := dsq.Query{} - qr, err := fs.fm.ds.Query(q) - if err != nil { - return nil, err - } - - var entries listEntries - - for { - v, ok := qr.NextSync() - if !ok { - break - } - dobj, err := unmarshalDataObj(v.Value) - if err != nil { - entries = append(entries, &listEntry{ - dsKey: v.Key, - err: err, - }) - } else { - entries = append(entries, &listEntry{ - dsKey: v.Key, - filePath: dobj.GetFilePath(), - offset: dobj.GetOffset(), - size: dobj.GetSize_(), - }) - } - } - sort.Sort(entries) - - i := 0 - return func() *ListRes { - if i >= len(entries) { - return nil - } - v := entries[i] - i++ - // attempt to convert the datastore key to a CID, - // store the error but don't use it yet - cid, keyErr := dshelp.DsKeyToCid(ds.RawKey(v.dsKey)) - // first if they listRes already had an error return that error - if v.err != nil { - return mkListRes(cid, nil, v.err) - } - // now reconstruct the DataObj - dobj := pb.DataObj{ - FilePath: v.filePath, - Offset: v.offset, - Size_: v.size, - } - // now if we could not convert the datastore key return that - // error - if keyErr != nil { - return mkListRes(cid, &dobj, keyErr) - } - // finally verify the dataobj if requested - var err error - if verify { - _, err = fs.fm.readDataObj(cid, &dobj) - } - return mkListRes(cid, &dobj, err) - }, nil -} - -type listEntry struct { - filePath string - offset uint64 - dsKey string - size uint64 - err error -} - -type listEntries []*listEntry - -func (l listEntries) Len() int { return len(l) } -func (l listEntries) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -func (l listEntries) Less(i, j int) bool { - if l[i].filePath == l[j].filePath { - if l[i].offset == l[j].offset { - return l[i].dsKey < l[j].dsKey - } - return l[i].offset < l[j].offset - } - return l[i].filePath < l[j].filePath -} - -func mkListRes(c cid.Cid, d *pb.DataObj, err error) *ListRes { - status := StatusOk - errorMsg := "" - if err != nil { - if err == ds.ErrNotFound || err == blockstore.ErrNotFound { - status = StatusKeyNotFound - } else if err, ok := err.(*CorruptReferenceError); ok { - status = err.Code - } else { - status = StatusOtherError - } - errorMsg = err.Error() - } - if d == nil { - return &ListRes{ - Status: status, - ErrorMsg: errorMsg, - Key: c, - } - } - - return &ListRes{ - Status: status, - ErrorMsg: errorMsg, - Key: c, - FilePath: d.FilePath, - Size: d.Size_, - Offset: d.Offset, - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/fuse/mount/fuse.go b/vendor/github.com/ipfs/go-ipfs/fuse/mount/fuse.go deleted file mode 100644 index 41d14cc3..00000000 --- a/vendor/github.com/ipfs/go-ipfs/fuse/mount/fuse.go +++ /dev/null @@ -1,162 +0,0 @@ -// +build !nofuse -// +build !windows - -package mount - -import ( - "errors" - "fmt" - "sync" - "time" - - "bazil.org/fuse" - "bazil.org/fuse/fs" - "github.com/jbenet/goprocess" -) - -var ErrNotMounted = errors.New("not mounted") - -// mount implements go-ipfs/fuse/mount -type mount struct { - mpoint string - filesys fs.FS - fuseConn *fuse.Conn - - active bool - activeLock *sync.RWMutex - - proc goprocess.Process -} - -// Mount mounts a fuse fs.FS at a given location, and returns a Mount instance. -// parent is a ContextGroup to bind the mount's ContextGroup to. -func NewMount(p goprocess.Process, fsys fs.FS, mountpoint string, allow_other bool) (Mount, error) { - var conn *fuse.Conn - var err error - - if allow_other { - conn, err = fuse.Mount(mountpoint, fuse.AllowOther()) - } else { - conn, err = fuse.Mount(mountpoint) - } - - if err != nil { - return nil, err - } - - m := &mount{ - mpoint: mountpoint, - fuseConn: conn, - filesys: fsys, - active: false, - activeLock: &sync.RWMutex{}, - proc: goprocess.WithParent(p), // link it to parent. - } - m.proc.SetTeardown(m.unmount) - - // launch the mounting process. - if err := m.mount(); err != nil { - _ = m.Unmount() // just in case. - return nil, err - } - - return m, nil -} - -func (m *mount) mount() error { - log.Infof("Mounting %s", m.MountPoint()) - - errs := make(chan error, 1) - go func() { - // fs.Serve blocks until the filesystem is unmounted. - err := fs.Serve(m.fuseConn, m.filesys) - log.Debugf("%s is unmounted", m.MountPoint()) - if err != nil { - log.Debugf("fs.Serve returned (%s)", err) - errs <- err - } - m.setActive(false) - }() - - // wait for the mount process to be done, or timed out. - select { - case <-time.After(MountTimeout): - return fmt.Errorf("mounting %s timed out", m.MountPoint()) - case err := <-errs: - return err - case <-m.fuseConn.Ready: - } - - // check if the mount process has an error to report - if err := m.fuseConn.MountError; err != nil { - return err - } - - m.setActive(true) - - log.Infof("Mounted %s", m.MountPoint()) - return nil -} - -// umount is called exactly once to unmount this service. -// note that closing the connection will not always unmount -// properly. If that happens, we bring out the big guns -// (mount.ForceUnmountManyTimes, exec unmount). -func (m *mount) unmount() error { - log.Infof("Unmounting %s", m.MountPoint()) - - // try unmounting with fuse lib - err := fuse.Unmount(m.MountPoint()) - if err == nil { - m.setActive(false) - return nil - } - log.Warningf("fuse unmount err: %s", err) - - // try closing the fuseConn - err = m.fuseConn.Close() - if err == nil { - m.setActive(false) - return nil - } - log.Warningf("fuse conn error: %s", err) - - // try mount.ForceUnmountManyTimes - if err := ForceUnmountManyTimes(m, 10); err != nil { - return err - } - - log.Infof("Seemingly unmounted %s", m.MountPoint()) - m.setActive(false) - return nil -} - -func (m *mount) Process() goprocess.Process { - return m.proc -} - -func (m *mount) MountPoint() string { - return m.mpoint -} - -func (m *mount) Unmount() error { - if !m.IsActive() { - return ErrNotMounted - } - - // call Process Close(), which calls unmount() exactly once. - return m.proc.Close() -} - -func (m *mount) IsActive() bool { - m.activeLock.RLock() - defer m.activeLock.RUnlock() - - return m.active -} - -func (m *mount) setActive(a bool) { - m.activeLock.Lock() - m.active = a - m.activeLock.Unlock() -} diff --git a/vendor/github.com/ipfs/go-ipfs/fuse/mount/mount.go b/vendor/github.com/ipfs/go-ipfs/fuse/mount/mount.go deleted file mode 100644 index 84df699e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/fuse/mount/mount.go +++ /dev/null @@ -1,107 +0,0 @@ -// package mount provides a simple abstraction around a mount point -package mount - -import ( - "fmt" - "io" - "os/exec" - "runtime" - "time" - - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" -) - -var log = logging.Logger("mount") - -var MountTimeout = time.Second * 5 - -// Mount represents a filesystem mount -type Mount interface { - // MountPoint is the path at which this mount is mounted - MountPoint() string - - // Unmounts the mount - Unmount() error - - // Checks if the mount is still active. - IsActive() bool - - // Process returns the mount's Process to be able to link it - // to other processes. Unmount upon closing. - Process() goprocess.Process -} - -// ForceUnmount attempts to forcibly unmount a given mount. -// It does so by calling diskutil or fusermount directly. -func ForceUnmount(m Mount) error { - point := m.MountPoint() - log.Warningf("Force-Unmounting %s...", point) - - cmd, err := UnmountCmd(point) - if err != nil { - return err - } - - errc := make(chan error, 1) - go func() { - defer close(errc) - - // try vanilla unmount first. - if err := exec.Command("umount", point).Run(); err == nil { - return - } - - // retry to unmount with the fallback cmd - errc <- cmd.Run() - }() - - select { - case <-time.After(7 * time.Second): - return fmt.Errorf("umount timeout") - case err := <-errc: - return err - } -} - -// UnmountCmd creates an exec.Cmd that is GOOS-specific -// for unmount a FUSE mount -func UnmountCmd(point string) (*exec.Cmd, error) { - switch runtime.GOOS { - case "darwin": - return exec.Command("diskutil", "umount", "force", point), nil - case "linux": - return exec.Command("fusermount", "-u", point), nil - default: - return nil, fmt.Errorf("unmount: unimplemented") - } -} - -// ForceUnmountManyTimes attempts to forcibly unmount a given mount, -// many times. It does so by calling diskutil or fusermount directly. -// Attempts a given number of times. -func ForceUnmountManyTimes(m Mount, attempts int) error { - var err error - for i := 0; i < attempts; i++ { - err = ForceUnmount(m) - if err == nil { - return err - } - - <-time.After(time.Millisecond * 500) - } - return fmt.Errorf("unmount %s failed after 10 seconds of trying", m.MountPoint()) -} - -type closer struct { - M Mount -} - -func (c *closer) Close() error { - log.Warning(" (c *closer) Close(),", c.M.MountPoint()) - return c.M.Unmount() -} - -func Closer(m Mount) io.Closer { - return &closer{m} -} diff --git a/vendor/github.com/ipfs/go-ipfs/keystore/keystore.go b/vendor/github.com/ipfs/go-ipfs/keystore/keystore.go deleted file mode 100644 index 237d4b05..00000000 --- a/vendor/github.com/ipfs/go-ipfs/keystore/keystore.go +++ /dev/null @@ -1,176 +0,0 @@ -package keystore - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - - logging "github.com/ipfs/go-log" - ci "github.com/libp2p/go-libp2p-core/crypto" -) - -var log = logging.Logger("keystore") - -// Keystore provides a key management interface -type Keystore interface { - // Has returns whether or not a key exist in the Keystore - Has(string) (bool, error) - // Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists - Put(string, ci.PrivKey) error - // Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey - // otherwise. - Get(string) (ci.PrivKey, error) - // Delete removes a key from the Keystore - Delete(string) error - // List returns a list of key identifier - List() ([]string, error) -} - -var ErrNoSuchKey = fmt.Errorf("no key by the given name was found") -var ErrKeyExists = fmt.Errorf("key by that name already exists, refusing to overwrite") - -// FSKeystore is a keystore backed by files in a given directory stored on disk. -type FSKeystore struct { - dir string -} - -func validateName(name string) error { - if name == "" { - return fmt.Errorf("key names must be at least one character") - } - - if strings.Contains(name, "/") { - return fmt.Errorf("key names may not contain slashes") - } - - if strings.HasPrefix(name, ".") { - return fmt.Errorf("key names may not begin with a period") - } - - return nil -} - -func NewFSKeystore(dir string) (*FSKeystore, error) { - _, err := os.Stat(dir) - if err != nil { - if !os.IsNotExist(err) { - return nil, err - } - if err := os.Mkdir(dir, 0700); err != nil { - return nil, err - } - } - - return &FSKeystore{dir}, nil -} - -// Has returns whether or not a key exist in the Keystore -func (ks *FSKeystore) Has(name string) (bool, error) { - kp := filepath.Join(ks.dir, name) - - _, err := os.Stat(kp) - - if os.IsNotExist(err) { - return false, nil - } - - if err != nil { - return false, err - } - - if err := validateName(name); err != nil { - return false, err - } - - return true, nil -} - -// Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists -func (ks *FSKeystore) Put(name string, k ci.PrivKey) error { - if err := validateName(name); err != nil { - return err - } - - b, err := k.Bytes() - if err != nil { - return err - } - - kp := filepath.Join(ks.dir, name) - - _, err = os.Stat(kp) - if err == nil { - return ErrKeyExists - } else if !os.IsNotExist(err) { - return err - } - - fi, err := os.Create(kp) - if err != nil { - return err - } - defer fi.Close() - - _, err = fi.Write(b) - - return err -} - -// Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey -// otherwise. -func (ks *FSKeystore) Get(name string) (ci.PrivKey, error) { - if err := validateName(name); err != nil { - return nil, err - } - - kp := filepath.Join(ks.dir, name) - - data, err := ioutil.ReadFile(kp) - if err != nil { - if os.IsNotExist(err) { - return nil, ErrNoSuchKey - } - return nil, err - } - - return ci.UnmarshalPrivateKey(data) -} - -// Delete removes a key from the Keystore -func (ks *FSKeystore) Delete(name string) error { - if err := validateName(name); err != nil { - return err - } - - kp := filepath.Join(ks.dir, name) - - return os.Remove(kp) -} - -// List return a list of key identifier -func (ks *FSKeystore) List() ([]string, error) { - dir, err := os.Open(ks.dir) - if err != nil { - return nil, err - } - - dirs, err := dir.Readdirnames(0) - if err != nil { - return nil, err - } - - list := make([]string, 0, len(dirs)) - - for _, name := range dirs { - err := validateName(name) - if err == nil { - list = append(list, name) - } else { - log.Warningf("Ignoring the invalid keyfile: %s", name) - } - } - - return list, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/keystore/memkeystore.go b/vendor/github.com/ipfs/go-ipfs/keystore/memkeystore.go deleted file mode 100644 index 4067bbce..00000000 --- a/vendor/github.com/ipfs/go-ipfs/keystore/memkeystore.go +++ /dev/null @@ -1,67 +0,0 @@ -package keystore - -import ci "github.com/libp2p/go-libp2p-core/crypto" - -// MemKeystore is an in memory keystore implementation that is not persisted to -// any backing storage. -type MemKeystore struct { - keys map[string]ci.PrivKey -} - -func NewMemKeystore() *MemKeystore { - return &MemKeystore{make(map[string]ci.PrivKey)} -} - -// Has return whether or not a key exist in the Keystore -func (mk *MemKeystore) Has(name string) (bool, error) { - _, ok := mk.keys[name] - return ok, nil -} - -// Put store a key in the Keystore -func (mk *MemKeystore) Put(name string, k ci.PrivKey) error { - if err := validateName(name); err != nil { - return err - } - - _, ok := mk.keys[name] - if ok { - return ErrKeyExists - } - - mk.keys[name] = k - return nil -} - -// Get retrieve a key from the Keystore -func (mk *MemKeystore) Get(name string) (ci.PrivKey, error) { - if err := validateName(name); err != nil { - return nil, err - } - - k, ok := mk.keys[name] - if !ok { - return nil, ErrNoSuchKey - } - - return k, nil -} - -// Delete remove a key from the Keystore -func (mk *MemKeystore) Delete(name string) error { - if err := validateName(name); err != nil { - return err - } - - delete(mk.keys, name) - return nil -} - -// List return a list of key identifier -func (mk *MemKeystore) List() ([]string, error) { - out := make([]string, 0, len(mk.keys)) - for k := range mk.keys { - out = append(out, k) - } - return out, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/base.go b/vendor/github.com/ipfs/go-ipfs/namesys/base.go deleted file mode 100644 index 27cc38f8..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/base.go +++ /dev/null @@ -1,120 +0,0 @@ -package namesys - -import ( - "context" - "strings" - "time" - - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" -) - -type onceResult struct { - value path.Path - ttl time.Duration - err error -} - -type resolver interface { - resolveOnceAsync(ctx context.Context, name string, options opts.ResolveOpts) <-chan onceResult -} - -// resolve is a helper for implementing Resolver.ResolveN using resolveOnce. -func resolve(ctx context.Context, r resolver, name string, options opts.ResolveOpts) (path.Path, error) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - err := ErrResolveFailed - var p path.Path - - resCh := resolveAsync(ctx, r, name, options) - - for res := range resCh { - p, err = res.Path, res.Err - if err != nil { - break - } - } - - return p, err -} - -func resolveAsync(ctx context.Context, r resolver, name string, options opts.ResolveOpts) <-chan Result { - resCh := r.resolveOnceAsync(ctx, name, options) - depth := options.Depth - outCh := make(chan Result, 1) - - go func() { - defer close(outCh) - var subCh <-chan Result - var cancelSub context.CancelFunc - defer func() { - if cancelSub != nil { - cancelSub() - } - }() - - for { - select { - case res, ok := <-resCh: - if !ok { - resCh = nil - break - } - - if res.err != nil { - emitResult(ctx, outCh, Result{Err: res.err}) - return - } - log.Debugf("resolved %s to %s", name, res.value.String()) - if !strings.HasPrefix(res.value.String(), ipnsPrefix) { - emitResult(ctx, outCh, Result{Path: res.value}) - break - } - - if depth == 1 { - emitResult(ctx, outCh, Result{Path: res.value, Err: ErrResolveRecursion}) - break - } - - subopts := options - if subopts.Depth > 1 { - subopts.Depth-- - } - - var subCtx context.Context - if cancelSub != nil { - // Cancel previous recursive resolve since it won't be used anyways - cancelSub() - } - subCtx, cancelSub = context.WithCancel(ctx) - _ = cancelSub - - p := strings.TrimPrefix(res.value.String(), ipnsPrefix) - subCh = resolveAsync(subCtx, r, p, subopts) - case res, ok := <-subCh: - if !ok { - subCh = nil - break - } - - // We don't bother returning here in case of context timeout as there is - // no good reason to do that, and we may still be able to emit a result - emitResult(ctx, outCh, res) - case <-ctx.Done(): - return - } - if resCh == nil && subCh == nil { - return - } - } - }() - return outCh -} - -func emitResult(ctx context.Context, outCh chan<- Result, r Result) { - select { - case outCh <- r: - case <-ctx.Done(): - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/cache.go b/vendor/github.com/ipfs/go-ipfs/namesys/cache.go deleted file mode 100644 index 4a5cb511..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/cache.go +++ /dev/null @@ -1,47 +0,0 @@ -package namesys - -import ( - "time" - - path "github.com/ipfs/go-path" -) - -func (ns *mpns) cacheGet(name string) (path.Path, bool) { - if ns.cache == nil { - return "", false - } - - ientry, ok := ns.cache.Get(name) - if !ok { - return "", false - } - - entry, ok := ientry.(cacheEntry) - if !ok { - // should never happen, purely for sanity - log.Panicf("unexpected type %T in cache for %q.", ientry, name) - } - - if time.Now().Before(entry.eol) { - return entry.val, true - } - - ns.cache.Remove(name) - - return "", false -} - -func (ns *mpns) cacheSet(name string, val path.Path, ttl time.Duration) { - if ns.cache == nil || ttl <= 0 { - return - } - ns.cache.Add(name, cacheEntry{ - val: val, - eol: time.Now().Add(ttl), - }) -} - -type cacheEntry struct { - val path.Path - eol time.Time -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/dns.go b/vendor/github.com/ipfs/go-ipfs/namesys/dns.go deleted file mode 100644 index 931edec0..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/dns.go +++ /dev/null @@ -1,149 +0,0 @@ -package namesys - -import ( - "context" - "errors" - "net" - "strings" - - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" - isd "github.com/jbenet/go-is-domain" -) - -type LookupTXTFunc func(name string) (txt []string, err error) - -// DNSResolver implements a Resolver on DNS domains -type DNSResolver struct { - lookupTXT LookupTXTFunc - // TODO: maybe some sort of caching? - // cache would need a timeout -} - -// NewDNSResolver constructs a name resolver using DNS TXT records. -func NewDNSResolver() *DNSResolver { - return &DNSResolver{lookupTXT: net.LookupTXT} -} - -// Resolve implements Resolver. -func (r *DNSResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error) { - return resolve(ctx, r, name, opts.ProcessOpts(options)) -} - -// ResolveAsync implements Resolver. -func (r *DNSResolver) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result { - return resolveAsync(ctx, r, name, opts.ProcessOpts(options)) -} - -type lookupRes struct { - path path.Path - error error -} - -// resolveOnce implements resolver. -// TXT records for a given domain name should contain a b58 -// encoded multihash. -func (r *DNSResolver) resolveOnceAsync(ctx context.Context, name string, options opts.ResolveOpts) <-chan onceResult { - var fqdn string - out := make(chan onceResult, 1) - segments := strings.SplitN(name, "/", 2) - domain := segments[0] - - if !isd.IsDomain(domain) { - out <- onceResult{err: errors.New("not a valid domain name")} - close(out) - return out - } - log.Debugf("DNSResolver resolving %s", domain) - - if strings.HasSuffix(domain, ".") { - fqdn = domain - } else { - fqdn = domain + "." - } - - rootChan := make(chan lookupRes, 1) - go workDomain(r, fqdn, rootChan) - - subChan := make(chan lookupRes, 1) - go workDomain(r, "_dnslink."+fqdn, subChan) - - appendPath := func(p path.Path) (path.Path, error) { - if len(segments) > 1 { - return path.FromSegments("", strings.TrimRight(p.String(), "/"), segments[1]) - } - return p, nil - } - - go func() { - defer close(out) - for { - select { - case subRes, ok := <-subChan: - if !ok { - subChan = nil - break - } - if subRes.error == nil { - p, err := appendPath(subRes.path) - emitOnceResult(ctx, out, onceResult{value: p, err: err}) - return - } - case rootRes, ok := <-rootChan: - if !ok { - rootChan = nil - break - } - if rootRes.error == nil { - p, err := appendPath(rootRes.path) - emitOnceResult(ctx, out, onceResult{value: p, err: err}) - } - case <-ctx.Done(): - return - } - if subChan == nil && rootChan == nil { - return - } - } - }() - - return out -} - -func workDomain(r *DNSResolver, name string, res chan lookupRes) { - defer close(res) - - txt, err := r.lookupTXT(name) - if err != nil { - // Error is != nil - res <- lookupRes{"", err} - return - } - - for _, t := range txt { - p, err := parseEntry(t) - if err == nil { - res <- lookupRes{p, nil} - return - } - } - res <- lookupRes{"", ErrResolveFailed} -} - -func parseEntry(txt string) (path.Path, error) { - p, err := path.ParseCidToPath(txt) // bare IPFS multihashes - if err == nil { - return p, nil - } - - return tryParseDnsLink(txt) -} - -func tryParseDnsLink(txt string) (path.Path, error) { - parts := strings.SplitN(txt, "=", 2) - if len(parts) == 2 && parts[0] == "dnslink" { - return path.ParsePath(parts[1]) - } - - return "", errors.New("not a valid dnslink entry") -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/interface.go b/vendor/github.com/ipfs/go-ipfs/namesys/interface.go deleted file mode 100644 index ecd80943..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/interface.go +++ /dev/null @@ -1,106 +0,0 @@ -/* -Package namesys implements resolvers and publishers for the IPFS -naming system (IPNS). - -The core of IPFS is an immutable, content-addressable Merkle graph. -That works well for many use cases, but doesn't allow you to answer -questions like "what is Alice's current homepage?". The mutable name -system allows Alice to publish information like: - - The current homepage for alice.example.com is - /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj - -or: - - The current homepage for node - QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy - is - /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj - -The mutable name system also allows users to resolve those references -to find the immutable IPFS object currently referenced by a given -mutable name. - -For command-line bindings to this functionality, see: - - ipfs name - ipfs dns - ipfs resolve -*/ -package namesys - -import ( - "errors" - "time" - - context "context" - - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" - ci "github.com/libp2p/go-libp2p-core/crypto" -) - -// ErrResolveFailed signals an error when attempting to resolve. -var ErrResolveFailed = errors.New("could not resolve name") - -// ErrResolveRecursion signals a recursion-depth limit. -var ErrResolveRecursion = errors.New( - "could not resolve name (recursion limit exceeded)") - -// ErrPublishFailed signals an error when attempting to publish. -var ErrPublishFailed = errors.New("could not publish name") - -// Namesys represents a cohesive name publishing and resolving system. -// -// Publishing a name is the process of establishing a mapping, a key-value -// pair, according to naming rules and databases. -// -// Resolving a name is the process of looking up the value associated with the -// key (name). -type NameSystem interface { - Resolver - Publisher -} - -// Result is the return type for Resolver.ResolveAsync. -type Result struct { - Path path.Path - Err error -} - -// Resolver is an object capable of resolving names. -type Resolver interface { - - // Resolve performs a recursive lookup, returning the dereferenced - // path. For example, if ipfs.io has a DNS TXT record pointing to - // /ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy - // and there is a DHT IPNS entry for - // QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy - // -> /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj - // then - // Resolve(ctx, "/ipns/ipfs.io") - // will resolve both names, returning - // /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj - // - // There is a default depth-limit to avoid infinite recursion. Most - // users will be fine with this default limit, but if you need to - // adjust the limit you can specify it as an option. - Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (value path.Path, err error) - - // ResolveAsync performs recursive name lookup, like Resolve, but it returns - // entries as they are discovered in the DHT. Each returned result is guaranteed - // to be "better" (which usually means newer) than the previous one. - ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result -} - -// Publisher is an object capable of publishing particular names. -type Publisher interface { - - // Publish establishes a name-value mapping. - // TODO make this not PrivKey specific. - Publish(ctx context.Context, name ci.PrivKey, value path.Path) error - - // TODO: to be replaced by a more generic 'PublishWithValidity' type - // call once the records spec is implemented - PublishWithEOL(ctx context.Context, name ci.PrivKey, value path.Path, eol time.Time) error -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/namesys.go b/vendor/github.com/ipfs/go-ipfs/namesys/namesys.go deleted file mode 100644 index 6d59c62e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/namesys.go +++ /dev/null @@ -1,191 +0,0 @@ -package namesys - -import ( - "context" - "strings" - "time" - - lru "github.com/hashicorp/golang-lru" - ds "github.com/ipfs/go-datastore" - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" - isd "github.com/jbenet/go-is-domain" - ci "github.com/libp2p/go-libp2p-core/crypto" - peer "github.com/libp2p/go-libp2p-core/peer" - routing "github.com/libp2p/go-libp2p-core/routing" - mh "github.com/multiformats/go-multihash" -) - -// mpns (a multi-protocol NameSystem) implements generic IPFS naming. -// -// Uses several Resolvers: -// (a) IPFS routing naming: SFS-like PKI names. -// (b) dns domains: resolves using links in DNS TXT records -// (c) proquints: interprets string as the raw byte data. -// -// It can only publish to: (a) IPFS routing naming. -// -type mpns struct { - dnsResolver, proquintResolver, ipnsResolver resolver - ipnsPublisher Publisher - - cache *lru.Cache -} - -// NewNameSystem will construct the IPFS naming system based on Routing -func NewNameSystem(r routing.ValueStore, ds ds.Datastore, cachesize int) NameSystem { - var cache *lru.Cache - if cachesize > 0 { - cache, _ = lru.New(cachesize) - } - - return &mpns{ - dnsResolver: NewDNSResolver(), - proquintResolver: new(ProquintResolver), - ipnsResolver: NewIpnsResolver(r), - ipnsPublisher: NewIpnsPublisher(r, ds), - cache: cache, - } -} - -const DefaultResolverCacheTTL = time.Minute - -// Resolve implements Resolver. -func (ns *mpns) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error) { - if strings.HasPrefix(name, "/ipfs/") { - return path.ParsePath(name) - } - - if !strings.HasPrefix(name, "/") { - return path.ParsePath("/ipfs/" + name) - } - - return resolve(ctx, ns, name, opts.ProcessOpts(options)) -} - -func (ns *mpns) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result { - res := make(chan Result, 1) - if strings.HasPrefix(name, "/ipfs/") { - p, err := path.ParsePath(name) - res <- Result{p, err} - return res - } - - if !strings.HasPrefix(name, "/") { - p, err := path.ParsePath("/ipfs/" + name) - res <- Result{p, err} - return res - } - - return resolveAsync(ctx, ns, name, opts.ProcessOpts(options)) -} - -// resolveOnce implements resolver. -func (ns *mpns) resolveOnceAsync(ctx context.Context, name string, options opts.ResolveOpts) <-chan onceResult { - out := make(chan onceResult, 1) - - if !strings.HasPrefix(name, ipnsPrefix) { - name = ipnsPrefix + name - } - segments := strings.SplitN(name, "/", 4) - if len(segments) < 3 || segments[0] != "" { - log.Debugf("invalid name syntax for %s", name) - out <- onceResult{err: ErrResolveFailed} - close(out) - return out - } - - key := segments[2] - - if p, ok := ns.cacheGet(key); ok { - if len(segments) > 3 { - var err error - p, err = path.FromSegments("", strings.TrimRight(p.String(), "/"), segments[3]) - if err != nil { - emitOnceResult(ctx, out, onceResult{value: p, err: err}) - } - } - - out <- onceResult{value: p} - close(out) - return out - } - - // Resolver selection: - // 1. if it is a multihash resolve through "ipns". - // 2. if it is a domain name, resolve through "dns" - // 3. otherwise resolve through the "proquint" resolver - - var res resolver - if _, err := mh.FromB58String(key); err == nil { - res = ns.ipnsResolver - } else if isd.IsDomain(key) { - res = ns.dnsResolver - } else { - res = ns.proquintResolver - } - - resCh := res.resolveOnceAsync(ctx, key, options) - var best onceResult - go func() { - defer close(out) - for { - select { - case res, ok := <-resCh: - if !ok { - if best != (onceResult{}) { - ns.cacheSet(key, best.value, best.ttl) - } - return - } - if res.err == nil { - best = res - } - p := res.value - - // Attach rest of the path - if len(segments) > 3 { - var err error - p, err = path.FromSegments("", strings.TrimRight(p.String(), "/"), segments[3]) - if err != nil { - emitOnceResult(ctx, out, onceResult{value: p, ttl: res.ttl, err: err}) - } - } - - emitOnceResult(ctx, out, onceResult{value: p, ttl: res.ttl, err: res.err}) - case <-ctx.Done(): - return - } - } - }() - - return out -} - -func emitOnceResult(ctx context.Context, outCh chan<- onceResult, r onceResult) { - select { - case outCh <- r: - case <-ctx.Done(): - } -} - -// Publish implements Publisher -func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) error { - return ns.PublishWithEOL(ctx, name, value, time.Now().Add(DefaultRecordEOL)) -} - -func (ns *mpns) PublishWithEOL(ctx context.Context, name ci.PrivKey, value path.Path, eol time.Time) error { - id, err := peer.IDFromPrivateKey(name) - if err != nil { - return err - } - if err := ns.ipnsPublisher.PublishWithEOL(ctx, name, value, eol); err != nil { - return err - } - ttl := DefaultResolverCacheTTL - if ttEol := time.Until(eol); ttEol < ttl { - ttl = ttEol - } - ns.cacheSet(peer.IDB58Encode(id), value, ttl) - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/proquint.go b/vendor/github.com/ipfs/go-ipfs/namesys/proquint.go deleted file mode 100644 index 63cb62a0..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/proquint.go +++ /dev/null @@ -1,32 +0,0 @@ -package namesys - -import ( - "context" - "errors" - - proquint "github.com/bren2010/proquint" - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" -) - -type ProquintResolver struct{} - -// Resolve implements Resolver. -func (r *ProquintResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error) { - return resolve(ctx, r, name, opts.ProcessOpts(options)) -} - -// resolveOnce implements resolver. Decodes the proquint string. -func (r *ProquintResolver) resolveOnceAsync(ctx context.Context, name string, options opts.ResolveOpts) <-chan onceResult { - out := make(chan onceResult, 1) - defer close(out) - - ok, err := proquint.IsProquint(name) - if err != nil || !ok { - out <- onceResult{err: errors.New("not a valid proquint string")} - return out - } - // Return a 0 TTL as caching this result is pointless. - out <- onceResult{value: path.FromString(string(proquint.Decode(name)))} - return out -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/publisher.go b/vendor/github.com/ipfs/go-ipfs/namesys/publisher.go deleted file mode 100644 index c06deb79..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/publisher.go +++ /dev/null @@ -1,312 +0,0 @@ -package namesys - -import ( - "context" - "strings" - "sync" - "time" - - pin "github.com/ipfs/go-ipfs/pin" - - proto "github.com/gogo/protobuf/proto" - ds "github.com/ipfs/go-datastore" - dsquery "github.com/ipfs/go-datastore/query" - ipns "github.com/ipfs/go-ipns" - pb "github.com/ipfs/go-ipns/pb" - path "github.com/ipfs/go-path" - ft "github.com/ipfs/go-unixfs" - ci "github.com/libp2p/go-libp2p-core/crypto" - peer "github.com/libp2p/go-libp2p-core/peer" - routing "github.com/libp2p/go-libp2p-core/routing" - base32 "github.com/whyrusleeping/base32" -) - -const ipnsPrefix = "/ipns/" - -const PublishPutValTimeout = time.Minute -const DefaultRecordEOL = 24 * time.Hour - -// IpnsPublisher is capable of publishing and resolving names to the IPFS -// routing system. -type IpnsPublisher struct { - routing routing.ValueStore - ds ds.Datastore - - // Used to ensure we assign IPNS records *sequential* sequence numbers. - mu sync.Mutex -} - -// NewIpnsPublisher constructs a publisher for the IPFS Routing name system. -func NewIpnsPublisher(route routing.ValueStore, ds ds.Datastore) *IpnsPublisher { - if ds == nil { - panic("nil datastore") - } - return &IpnsPublisher{routing: route, ds: ds} -} - -// Publish implements Publisher. Accepts a keypair and a value, -// and publishes it out to the routing system -func (p *IpnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error { - log.Debugf("Publish %s", value) - return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecordEOL)) -} - -func IpnsDsKey(id peer.ID) ds.Key { - return ds.NewKey("/ipns/" + base32.RawStdEncoding.EncodeToString([]byte(id))) -} - -// PublishedNames returns the latest IPNS records published by this node and -// their expiration times. -// -// This method will not search the routing system for records published by other -// nodes. -func (p *IpnsPublisher) ListPublished(ctx context.Context) (map[peer.ID]*pb.IpnsEntry, error) { - query, err := p.ds.Query(dsquery.Query{ - Prefix: ipnsPrefix, - }) - if err != nil { - return nil, err - } - defer query.Close() - - records := make(map[peer.ID]*pb.IpnsEntry) - for { - select { - case result, ok := <-query.Next(): - if !ok { - return records, nil - } - if result.Error != nil { - return nil, result.Error - } - e := new(pb.IpnsEntry) - if err := proto.Unmarshal(result.Value, e); err != nil { - // Might as well return what we can. - log.Error("found an invalid IPNS entry:", err) - continue - } - if !strings.HasPrefix(result.Key, ipnsPrefix) { - log.Errorf("datastore query for keys with prefix %s returned a key: %s", ipnsPrefix, result.Key) - continue - } - k := result.Key[len(ipnsPrefix):] - pid, err := base32.RawStdEncoding.DecodeString(k) - if err != nil { - log.Errorf("ipns ds key invalid: %s", result.Key) - continue - } - records[peer.ID(pid)] = e - case <-ctx.Done(): - return nil, ctx.Err() - } - } -} - -// GetPublished returns the record this node has published corresponding to the -// given peer ID. -// -// If `checkRouting` is true and we have no existing record, this method will -// check the routing system for any existing records. -func (p *IpnsPublisher) GetPublished(ctx context.Context, id peer.ID, checkRouting bool) (*pb.IpnsEntry, error) { - ctx, cancel := context.WithTimeout(ctx, time.Second*30) - defer cancel() - - value, err := p.ds.Get(IpnsDsKey(id)) - switch err { - case nil: - case ds.ErrNotFound: - if !checkRouting { - return nil, nil - } - ipnskey := ipns.RecordKey(id) - value, err = p.routing.GetValue(ctx, ipnskey) - if err != nil { - // Not found or other network issue. Can't really do - // anything about this case. - if err != routing.ErrNotFound { - log.Debugf("error when determining the last published IPNS record for %s: %s", id, err) - } - - return nil, nil - } - default: - return nil, err - } - e := new(pb.IpnsEntry) - if err := proto.Unmarshal(value, e); err != nil { - return nil, err - } - return e, nil -} - -func (p *IpnsPublisher) updateRecord(ctx context.Context, k ci.PrivKey, value path.Path, eol time.Time) (*pb.IpnsEntry, error) { - id, err := peer.IDFromPrivateKey(k) - if err != nil { - return nil, err - } - - p.mu.Lock() - defer p.mu.Unlock() - - // get previous records sequence number - rec, err := p.GetPublished(ctx, id, true) - if err != nil { - return nil, err - } - - seqno := rec.GetSequence() // returns 0 if rec is nil - if rec != nil && value != path.Path(rec.GetValue()) { - // Don't bother incrementing the sequence number unless the - // value changes. - seqno++ - } - - // Create record - entry, err := ipns.Create(k, []byte(value), seqno, eol) - if err != nil { - return nil, err - } - - // Set the TTL - // TODO: Make this less hacky. - ttl, ok := checkCtxTTL(ctx) - if ok { - entry.Ttl = proto.Uint64(uint64(ttl.Nanoseconds())) - } - - data, err := proto.Marshal(entry) - if err != nil { - return nil, err - } - - // Put the new record. - if err := p.ds.Put(IpnsDsKey(id), data); err != nil { - return nil, err - } - return entry, nil -} - -// PublishWithEOL is a temporary stand in for the ipns records implementation -// see here for more details: https://github.com/ipfs/specs/tree/master/records -func (p *IpnsPublisher) PublishWithEOL(ctx context.Context, k ci.PrivKey, value path.Path, eol time.Time) error { - record, err := p.updateRecord(ctx, k, value, eol) - if err != nil { - return err - } - - return PutRecordToRouting(ctx, p.routing, k.GetPublic(), record) -} - -// setting the TTL on published records is an experimental feature. -// as such, i'm using the context to wire it through to avoid changing too -// much code along the way. -func checkCtxTTL(ctx context.Context) (time.Duration, bool) { - v := ctx.Value("ipns-publish-ttl") - if v == nil { - return 0, false - } - - d, ok := v.(time.Duration) - return d, ok -} - -func PutRecordToRouting(ctx context.Context, r routing.ValueStore, k ci.PubKey, entry *pb.IpnsEntry) error { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - errs := make(chan error, 2) // At most two errors (IPNS, and public key) - - if err := ipns.EmbedPublicKey(k, entry); err != nil { - return err - } - - id, err := peer.IDFromPublicKey(k) - if err != nil { - return err - } - - go func() { - errs <- PublishEntry(ctx, r, ipns.RecordKey(id), entry) - }() - - // Publish the public key if a public key cannot be extracted from the ID - // TODO: once v0.4.16 is widespread enough, we can stop doing this - // and at that point we can even deprecate the /pk/ namespace in the dht - // - // NOTE: This check actually checks if the public key has been embedded - // in the IPNS entry. This check is sufficient because we embed the - // public key in the IPNS entry if it can't be extracted from the ID. - if entry.PubKey != nil { - go func() { - errs <- PublishPublicKey(ctx, r, PkKeyForID(id), k) - }() - - if err := waitOnErrChan(ctx, errs); err != nil { - return err - } - } - - return waitOnErrChan(ctx, errs) -} - -func waitOnErrChan(ctx context.Context, errs chan error) error { - select { - case err := <-errs: - return err - case <-ctx.Done(): - return ctx.Err() - } -} - -func PublishPublicKey(ctx context.Context, r routing.ValueStore, k string, pubk ci.PubKey) error { - log.Debugf("Storing pubkey at: %s", k) - pkbytes, err := pubk.Bytes() - if err != nil { - return err - } - - // Store associated public key - timectx, cancel := context.WithTimeout(ctx, PublishPutValTimeout) - defer cancel() - return r.PutValue(timectx, k, pkbytes) -} - -func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec *pb.IpnsEntry) error { - timectx, cancel := context.WithTimeout(ctx, PublishPutValTimeout) - defer cancel() - - data, err := proto.Marshal(rec) - if err != nil { - return err - } - - log.Debugf("Storing ipns entry at: %s", ipnskey) - // Store ipns entry at "/ipns/"+h(pubkey) - return r.PutValue(timectx, ipnskey, data) -} - -// InitializeKeyspace sets the ipns record for the given key to -// point to an empty directory. -// TODO: this doesnt feel like it belongs here -func InitializeKeyspace(ctx context.Context, pub Publisher, pins pin.Pinner, key ci.PrivKey) error { - emptyDir := ft.EmptyDirNode() - - // pin recursively because this might already be pinned - // and doing a direct pin would throw an error in that case - err := pins.Pin(ctx, emptyDir, true) - if err != nil { - return err - } - - err = pins.Flush() - if err != nil { - return err - } - - return pub.Publish(ctx, key, path.FromCid(emptyDir.Cid())) -} - -// PkKeyForID returns the public key routing key for the given peer ID. -func PkKeyForID(id peer.ID) string { - return "/pk/" + string(id) -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/republisher/repub.go b/vendor/github.com/ipfs/go-ipfs/namesys/republisher/repub.go deleted file mode 100644 index 9e7272d3..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/republisher/repub.go +++ /dev/null @@ -1,158 +0,0 @@ -package republisher - -import ( - "context" - "errors" - "time" - - keystore "github.com/ipfs/go-ipfs/keystore" - namesys "github.com/ipfs/go-ipfs/namesys" - path "github.com/ipfs/go-path" - - proto "github.com/gogo/protobuf/proto" - ds "github.com/ipfs/go-datastore" - pb "github.com/ipfs/go-ipns/pb" - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" - gpctx "github.com/jbenet/goprocess/context" - ic "github.com/libp2p/go-libp2p-core/crypto" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -var errNoEntry = errors.New("no previous entry") - -var log = logging.Logger("ipns-repub") - -// DefaultRebroadcastInterval is the default interval at which we rebroadcast IPNS records -var DefaultRebroadcastInterval = time.Hour * 4 - -// InitialRebroadcastDelay is the delay before first broadcasting IPNS records on start -var InitialRebroadcastDelay = time.Minute * 1 - -// FailureRetryInterval is the interval at which we retry IPNS records broadcasts (when they fail) -var FailureRetryInterval = time.Minute * 5 - -// DefaultRecordLifetime is the default lifetime for IPNS records -const DefaultRecordLifetime = time.Hour * 24 - -type Republisher struct { - ns namesys.Publisher - ds ds.Datastore - self ic.PrivKey - ks keystore.Keystore - - Interval time.Duration - - // how long records that are republished should be valid for - RecordLifetime time.Duration -} - -// NewRepublisher creates a new Republisher -func NewRepublisher(ns namesys.Publisher, ds ds.Datastore, self ic.PrivKey, ks keystore.Keystore) *Republisher { - return &Republisher{ - ns: ns, - ds: ds, - self: self, - ks: ks, - Interval: DefaultRebroadcastInterval, - RecordLifetime: DefaultRecordLifetime, - } -} - -func (rp *Republisher) Run(proc goprocess.Process) { - timer := time.NewTimer(InitialRebroadcastDelay) - defer timer.Stop() - if rp.Interval < InitialRebroadcastDelay { - timer.Reset(rp.Interval) - } - - for { - select { - case <-timer.C: - timer.Reset(rp.Interval) - err := rp.republishEntries(proc) - if err != nil { - log.Info("republisher failed to republish: ", err) - if FailureRetryInterval < rp.Interval { - timer.Reset(FailureRetryInterval) - } - } - case <-proc.Closing(): - return - } - } -} - -func (rp *Republisher) republishEntries(p goprocess.Process) error { - ctx, cancel := context.WithCancel(gpctx.OnClosingContext(p)) - defer cancel() - - // TODO: Use rp.ipns.ListPublished(). We can't currently *do* that - // because: - // 1. There's no way to get keys from the keystore by ID. - // 2. We don't actually have access to the IPNS publisher. - err := rp.republishEntry(ctx, rp.self) - if err != nil { - return err - } - - if rp.ks != nil { - keyNames, err := rp.ks.List() - if err != nil { - return err - } - for _, name := range keyNames { - priv, err := rp.ks.Get(name) - if err != nil { - return err - } - err = rp.republishEntry(ctx, priv) - if err != nil { - return err - } - - } - } - - return nil -} - -func (rp *Republisher) republishEntry(ctx context.Context, priv ic.PrivKey) error { - id, err := peer.IDFromPrivateKey(priv) - if err != nil { - return err - } - - log.Debugf("republishing ipns entry for %s", id) - - // Look for it locally only - p, err := rp.getLastVal(id) - if err != nil { - if err == errNoEntry { - return nil - } - return err - } - - // update record with same sequence number - eol := time.Now().Add(rp.RecordLifetime) - return rp.ns.PublishWithEOL(ctx, priv, p, eol) -} - -func (rp *Republisher) getLastVal(id peer.ID) (path.Path, error) { - // Look for it locally only - val, err := rp.ds.Get(namesys.IpnsDsKey(id)) - switch err { - case nil: - case ds.ErrNotFound: - return "", errNoEntry - default: - return "", err - } - - e := new(pb.IpnsEntry) - if err := proto.Unmarshal(val, e); err != nil { - return "", err - } - return path.Path(e.Value), nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/namesys/routing.go b/vendor/github.com/ipfs/go-ipfs/namesys/routing.go deleted file mode 100644 index 94c12a72..00000000 --- a/vendor/github.com/ipfs/go-ipfs/namesys/routing.go +++ /dev/null @@ -1,161 +0,0 @@ -package namesys - -import ( - "context" - "strings" - "time" - - proto "github.com/gogo/protobuf/proto" - cid "github.com/ipfs/go-cid" - ipns "github.com/ipfs/go-ipns" - pb "github.com/ipfs/go-ipns/pb" - logging "github.com/ipfs/go-log" - path "github.com/ipfs/go-path" - opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" - peer "github.com/libp2p/go-libp2p-core/peer" - routing "github.com/libp2p/go-libp2p-core/routing" - dht "github.com/libp2p/go-libp2p-kad-dht" - mh "github.com/multiformats/go-multihash" -) - -var log = logging.Logger("namesys") - -// IpnsResolver implements NSResolver for the main IPFS SFS-like naming -type IpnsResolver struct { - routing routing.ValueStore -} - -// NewIpnsResolver constructs a name resolver using the IPFS Routing system -// to implement SFS-like naming on top. -func NewIpnsResolver(route routing.ValueStore) *IpnsResolver { - if route == nil { - panic("attempt to create resolver with nil routing system") - } - return &IpnsResolver{ - routing: route, - } -} - -// Resolve implements Resolver. -func (r *IpnsResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error) { - return resolve(ctx, r, name, opts.ProcessOpts(options)) -} - -// ResolveAsync implements Resolver. -func (r *IpnsResolver) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result { - return resolveAsync(ctx, r, name, opts.ProcessOpts(options)) -} - -// resolveOnce implements resolver. Uses the IPFS routing system to -// resolve SFS-like names. -func (r *IpnsResolver) resolveOnceAsync(ctx context.Context, name string, options opts.ResolveOpts) <-chan onceResult { - out := make(chan onceResult, 1) - log.Debugf("RoutingResolver resolving %s", name) - cancel := func() {} - - if options.DhtTimeout != 0 { - // Resolution must complete within the timeout - ctx, cancel = context.WithTimeout(ctx, options.DhtTimeout) - } - - name = strings.TrimPrefix(name, "/ipns/") - pid, err := peer.IDB58Decode(name) - if err != nil { - log.Debugf("RoutingResolver: could not convert public key hash %s to peer ID: %s\n", name, err) - out <- onceResult{err: err} - close(out) - cancel() - return out - } - - // Name should be the hash of a public key retrievable from ipfs. - // We retrieve the public key here to make certain that it's in the peer - // store before calling GetValue() on the DHT - the DHT will call the - // ipns validator, which in turn will get the public key from the peer - // store to verify the record signature - _, err = routing.GetPublicKey(r.routing, ctx, pid) - if err != nil { - log.Debugf("RoutingResolver: could not retrieve public key %s: %s\n", name, err) - out <- onceResult{err: err} - close(out) - cancel() - return out - } - - // Use the routing system to get the name. - // Note that the DHT will call the ipns validator when retrieving - // the value, which in turn verifies the ipns record signature - ipnsKey := ipns.RecordKey(pid) - - vals, err := r.routing.SearchValue(ctx, ipnsKey, dht.Quorum(int(options.DhtRecordCount))) - if err != nil { - log.Debugf("RoutingResolver: dht get for name %s failed: %s", name, err) - out <- onceResult{err: err} - close(out) - cancel() - return out - } - - go func() { - defer cancel() - defer close(out) - for { - select { - case val, ok := <-vals: - if !ok { - return - } - - entry := new(pb.IpnsEntry) - err = proto.Unmarshal(val, entry) - if err != nil { - log.Debugf("RoutingResolver: could not unmarshal value for name %s: %s", name, err) - emitOnceResult(ctx, out, onceResult{err: err}) - return - } - - var p path.Path - // check for old style record: - if valh, err := mh.Cast(entry.GetValue()); err == nil { - // Its an old style multihash record - log.Debugf("encountered CIDv0 ipns entry: %s", valh) - p = path.FromCid(cid.NewCidV0(valh)) - } else { - // Not a multihash, probably a new style record - p, err = path.ParsePath(string(entry.GetValue())) - if err != nil { - emitOnceResult(ctx, out, onceResult{err: err}) - return - } - } - - ttl := DefaultResolverCacheTTL - if entry.Ttl != nil { - ttl = time.Duration(*entry.Ttl) - } - switch eol, err := ipns.GetEOL(entry); err { - case ipns.ErrUnrecognizedValidity: - // No EOL. - case nil: - ttEol := time.Until(eol) - if ttEol < 0 { - // It *was* valid when we first resolved it. - ttl = 0 - } else if ttEol < ttl { - ttl = ttEol - } - default: - log.Errorf("encountered error when parsing EOL: %s", err) - emitOnceResult(ctx, out, onceResult{err: err}) - return - } - - emitOnceResult(ctx, out, onceResult{value: p, ttl: ttl}) - case <-ctx.Done(): - return - } - } - }() - - return out -} diff --git a/vendor/github.com/ipfs/go-ipfs/p2p/listener.go b/vendor/github.com/ipfs/go-ipfs/p2p/listener.go deleted file mode 100644 index 65fe87c2..00000000 --- a/vendor/github.com/ipfs/go-ipfs/p2p/listener.go +++ /dev/null @@ -1,96 +0,0 @@ -package p2p - -import ( - "errors" - "sync" - - p2phost "github.com/libp2p/go-libp2p-core/host" - net "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/protocol" - ma "github.com/multiformats/go-multiaddr" -) - -// Listener listens for connections and proxies them to a target -type Listener interface { - Protocol() protocol.ID - ListenAddress() ma.Multiaddr - TargetAddress() ma.Multiaddr - - key() string - - // close closes the listener. Does not affect child streams - close() -} - -// Listeners manages a group of Listener implementations, -// checking for conflicts and optionally dispatching connections -type Listeners struct { - sync.RWMutex - - Listeners map[string]Listener -} - -func newListenersLocal() *Listeners { - return &Listeners{ - Listeners: map[string]Listener{}, - } -} - -func newListenersP2P(host p2phost.Host) *Listeners { - reg := &Listeners{ - Listeners: map[string]Listener{}, - } - - host.SetStreamHandlerMatch("/x/", func(p string) bool { - reg.RLock() - defer reg.RUnlock() - - _, ok := reg.Listeners[p] - return ok - }, func(stream net.Stream) { - reg.RLock() - defer reg.RUnlock() - - l := reg.Listeners[string(stream.Protocol())] - if l != nil { - go l.(*remoteListener).handleStream(stream) - } - }) - - return reg -} - -// Register registers listenerInfo into this registry and starts it -func (r *Listeners) Register(l Listener) error { - r.Lock() - defer r.Unlock() - - if _, ok := r.Listeners[l.key()]; ok { - return errors.New("listener already registered") - } - - r.Listeners[l.key()] = l - return nil -} - -func (r *Listeners) Close(matchFunc func(listener Listener) bool) int { - todo := make([]Listener, 0) - r.Lock() - for _, l := range r.Listeners { - if !matchFunc(l) { - continue - } - - if _, ok := r.Listeners[l.key()]; ok { - delete(r.Listeners, l.key()) - todo = append(todo, l) - } - } - r.Unlock() - - for _, l := range todo { - l.close() - } - - return len(todo) -} diff --git a/vendor/github.com/ipfs/go-ipfs/p2p/local.go b/vendor/github.com/ipfs/go-ipfs/p2p/local.go deleted file mode 100644 index bff25e20..00000000 --- a/vendor/github.com/ipfs/go-ipfs/p2p/local.go +++ /dev/null @@ -1,121 +0,0 @@ -package p2p - -import ( - "context" - "time" - - tec "github.com/jbenet/go-temp-err-catcher" - net "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" - ma "github.com/multiformats/go-multiaddr" - "github.com/multiformats/go-multiaddr-net" -) - -// localListener manet streams and proxies them to libp2p services -type localListener struct { - ctx context.Context - - p2p *P2P - - proto protocol.ID - laddr ma.Multiaddr - peer peer.ID - - listener manet.Listener -} - -// ForwardLocal creates new P2P stream to a remote listener -func (p2p *P2P) ForwardLocal(ctx context.Context, peer peer.ID, proto protocol.ID, bindAddr ma.Multiaddr) (Listener, error) { - listener := &localListener{ - ctx: ctx, - p2p: p2p, - proto: proto, - peer: peer, - } - - maListener, err := manet.Listen(bindAddr) - if err != nil { - return nil, err - } - - listener.listener = maListener - listener.laddr = maListener.Multiaddr() - - if err := p2p.ListenersLocal.Register(listener); err != nil { - return nil, err - } - - go listener.acceptConns() - - return listener, nil -} - -func (l *localListener) dial(ctx context.Context) (net.Stream, error) { - cctx, cancel := context.WithTimeout(ctx, time.Second*30) //TODO: configurable? - defer cancel() - - return l.p2p.peerHost.NewStream(cctx, l.peer, l.proto) -} - -func (l *localListener) acceptConns() { - for { - local, err := l.listener.Accept() - if err != nil { - if tec.ErrIsTemporary(err) { - continue - } - return - } - - go l.setupStream(local) - } -} - -func (l *localListener) setupStream(local manet.Conn) { - remote, err := l.dial(l.ctx) - if err != nil { - local.Close() - log.Warningf("failed to dial to remote %s/%s", l.peer.Pretty(), l.proto) - return - } - - stream := &Stream{ - Protocol: l.proto, - - OriginAddr: local.RemoteMultiaddr(), - TargetAddr: l.TargetAddress(), - peer: l.peer, - - Local: local, - Remote: remote, - - Registry: l.p2p.Streams, - } - - l.p2p.Streams.Register(stream) -} - -func (l *localListener) close() { - l.listener.Close() -} - -func (l *localListener) Protocol() protocol.ID { - return l.proto -} - -func (l *localListener) ListenAddress() ma.Multiaddr { - return l.laddr -} - -func (l *localListener) TargetAddress() ma.Multiaddr { - addr, err := ma.NewMultiaddr(maPrefix + l.peer.Pretty()) - if err != nil { - panic(err) - } - return addr -} - -func (l *localListener) key() string { - return l.ListenAddress().String() -} diff --git a/vendor/github.com/ipfs/go-ipfs/p2p/p2p.go b/vendor/github.com/ipfs/go-ipfs/p2p/p2p.go deleted file mode 100644 index 078ba51c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/p2p/p2p.go +++ /dev/null @@ -1,53 +0,0 @@ -package p2p - -import ( - logging "github.com/ipfs/go-log" - p2phost "github.com/libp2p/go-libp2p-core/host" - peer "github.com/libp2p/go-libp2p-core/peer" - pstore "github.com/libp2p/go-libp2p-core/peerstore" -) - -var log = logging.Logger("p2p-mount") - -// P2P structure holds information on currently running streams/Listeners -type P2P struct { - ListenersLocal *Listeners - ListenersP2P *Listeners - Streams *StreamRegistry - - identity peer.ID - peerHost p2phost.Host - peerstore pstore.Peerstore -} - -// New creates new P2P struct -func New(identity peer.ID, peerHost p2phost.Host, peerstore pstore.Peerstore) *P2P { - return &P2P{ - identity: identity, - peerHost: peerHost, - peerstore: peerstore, - - ListenersLocal: newListenersLocal(), - ListenersP2P: newListenersP2P(peerHost), - - Streams: &StreamRegistry{ - Streams: map[uint64]*Stream{}, - ConnManager: peerHost.ConnManager(), - conns: map[peer.ID]int{}, - }, - } -} - -// CheckProtoExists checks whether a proto handler is registered to -// mux handler -func (p2p *P2P) CheckProtoExists(proto string) bool { - protos := p2p.peerHost.Mux().Protocols() - - for _, p := range protos { - if p != proto { - continue - } - return true - } - return false -} diff --git a/vendor/github.com/ipfs/go-ipfs/p2p/remote.go b/vendor/github.com/ipfs/go-ipfs/p2p/remote.go deleted file mode 100644 index a89b2f2f..00000000 --- a/vendor/github.com/ipfs/go-ipfs/p2p/remote.go +++ /dev/null @@ -1,106 +0,0 @@ -package p2p - -import ( - "context" - "fmt" - - net "github.com/libp2p/go-libp2p-core/network" - protocol "github.com/libp2p/go-libp2p-core/protocol" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -var maPrefix = "/" + ma.ProtocolWithCode(ma.P_IPFS).Name + "/" - -// remoteListener accepts libp2p streams and proxies them to a manet host -type remoteListener struct { - p2p *P2P - - // Application proto identifier. - proto protocol.ID - - // Address to proxy the incoming connections to - addr ma.Multiaddr - - // reportRemote if set to true makes the handler send '\n' - // to target before any data is forwarded - reportRemote bool -} - -// ForwardRemote creates new p2p listener -func (p2p *P2P) ForwardRemote(ctx context.Context, proto protocol.ID, addr ma.Multiaddr, reportRemote bool) (Listener, error) { - listener := &remoteListener{ - p2p: p2p, - - proto: proto, - addr: addr, - - reportRemote: reportRemote, - } - - if err := p2p.ListenersP2P.Register(listener); err != nil { - return nil, err - } - - return listener, nil -} - -func (l *remoteListener) handleStream(remote net.Stream) { - local, err := manet.Dial(l.addr) - if err != nil { - _ = remote.Reset() - return - } - - peer := remote.Conn().RemotePeer() - - if l.reportRemote { - if _, err := fmt.Fprintf(local, "%s\n", peer.Pretty()); err != nil { - _ = remote.Reset() - return - } - } - - peerMa, err := ma.NewMultiaddr(maPrefix + peer.Pretty()) - if err != nil { - _ = remote.Reset() - return - } - - stream := &Stream{ - Protocol: l.proto, - - OriginAddr: peerMa, - TargetAddr: l.addr, - peer: peer, - - Local: local, - Remote: remote, - - Registry: l.p2p.Streams, - } - - l.p2p.Streams.Register(stream) -} - -func (l *remoteListener) Protocol() protocol.ID { - return l.proto -} - -func (l *remoteListener) ListenAddress() ma.Multiaddr { - addr, err := ma.NewMultiaddr(maPrefix + l.p2p.identity.Pretty()) - if err != nil { - panic(err) - } - return addr -} - -func (l *remoteListener) TargetAddress() ma.Multiaddr { - return l.addr -} - -func (l *remoteListener) close() {} - -func (l *remoteListener) key() string { - return string(l.proto) -} diff --git a/vendor/github.com/ipfs/go-ipfs/p2p/stream.go b/vendor/github.com/ipfs/go-ipfs/p2p/stream.go deleted file mode 100644 index 137f14c1..00000000 --- a/vendor/github.com/ipfs/go-ipfs/p2p/stream.go +++ /dev/null @@ -1,120 +0,0 @@ -package p2p - -import ( - "io" - "sync" - - ifconnmgr "github.com/libp2p/go-libp2p-core/connmgr" - net "github.com/libp2p/go-libp2p-core/network" - peer "github.com/libp2p/go-libp2p-core/peer" - protocol "github.com/libp2p/go-libp2p-core/protocol" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -const cmgrTag = "stream-fwd" - -// Stream holds information on active incoming and outgoing p2p streams. -type Stream struct { - id uint64 - - Protocol protocol.ID - - OriginAddr ma.Multiaddr - TargetAddr ma.Multiaddr - peer peer.ID - - Local manet.Conn - Remote net.Stream - - Registry *StreamRegistry -} - -// close stream endpoints and deregister it -func (s *Stream) close() { - s.Registry.Close(s) -} - -// reset closes stream endpoints and deregisters it -func (s *Stream) reset() { - s.Registry.Reset(s) -} - -func (s *Stream) startStreaming() { - go func() { - _, err := io.Copy(s.Local, s.Remote) - if err != nil { - s.reset() - } else { - s.close() - } - }() - - go func() { - _, err := io.Copy(s.Remote, s.Local) - if err != nil { - s.reset() - } else { - s.close() - } - }() -} - -// StreamRegistry is a collection of active incoming and outgoing proto app streams. -type StreamRegistry struct { - sync.Mutex - - Streams map[uint64]*Stream - conns map[peer.ID]int - nextID uint64 - - ifconnmgr.ConnManager -} - -// Register registers a stream to the registry -func (r *StreamRegistry) Register(streamInfo *Stream) { - r.Lock() - defer r.Unlock() - - r.ConnManager.TagPeer(streamInfo.peer, cmgrTag, 20) - r.conns[streamInfo.peer]++ - - streamInfo.id = r.nextID - r.Streams[r.nextID] = streamInfo - r.nextID++ - - streamInfo.startStreaming() -} - -// Deregister deregisters stream from the registry -func (r *StreamRegistry) Deregister(streamID uint64) { - r.Lock() - defer r.Unlock() - - s, ok := r.Streams[streamID] - if !ok { - return - } - p := s.peer - r.conns[p]-- - if r.conns[p] < 1 { - delete(r.conns, p) - r.ConnManager.UntagPeer(p, cmgrTag) - } - - delete(r.Streams, streamID) -} - -// Close stream endpoints and deregister it -func (r *StreamRegistry) Close(s *Stream) { - _ = s.Local.Close() - _ = s.Remote.Close() - s.Registry.Deregister(s.id) -} - -// Reset closes stream endpoints and deregisters it -func (r *StreamRegistry) Reset(s *Stream) { - _ = s.Local.Close() - _ = s.Remote.Reset() - s.Registry.Deregister(s.id) -} diff --git a/vendor/github.com/ipfs/go-ipfs/package-list.json b/vendor/github.com/ipfs/go-ipfs/package-list.json deleted file mode 100644 index 5551193d..00000000 --- a/vendor/github.com/ipfs/go-ipfs/package-list.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "columns": [ - "Name", - "CI/Travis", - "Coverage", - "Description" - ], - "rows": [ - "Files", - ["ipfs/go-unixfs", "go-unixfs", "the core 'filesystem' logic"], - ["ipfs/go-mfs", "go-mfs", "a mutable filesystem editor for unixfs"], - ["ipfs/go-ipfs-posinfo", "go-ipfs-posinfo", "helper datatypes for the filestore"], - ["ipfs/go-ipfs-chunker", "go-ipfs-chunker", "file chunkers"], - - "Exchange", - ["ipfs/go-ipfs-exchange-interface", "go-ipfs-exchange-interface", "exchange service interface"], - ["ipfs/go-ipfs-exchange-offline", "go-ipfs-exchange-offline", "(dummy) offline implementation of the exchange service"], - ["ipfs/go-bitswap", "go-bitswap", "bitswap protocol implementation"], - ["ipfs/go-blockservice", "go-blockservice", "service that plugs a blockstore and an exchange together"], - - "Datastores", - ["ipfs/go-datastore", "go-datastore", "datastore interfaces, adapters, and basic implementations"], - ["ipfs/go-ipfs-ds-help", "go-ipfs-ds-help", "datastore utility functions"], - ["ipfs/go-ds-flatfs", "go-ds-flatfs", "a filesystem-based datastore"], - ["ipfs/go-ds-measure", "go-ds-measure", "a metric-collecting database adapter"], - ["ipfs/go-ds-leveldb", "go-ds-leveldb", "a leveldb based datastore"], - ["ipfs/go-ds-badger", "go-ds-badger", "a badgerdb based datastore"], - - "Namesys", - ["ipfs/go-ipns", "go-ipns", "IPNS datastructures and validation logic"], - - "Repo", - ["ipfs/go-ipfs-config", "go-ipfs-config", "go-ipfs config file definitions"], - ["ipfs/go-fs-lock", "go-fs-lock", "lockfile management functions"], - ["ipfs/fs-repo-migrations", "fs-repo-migrations", "repo migrations"], - - "Blocks", - ["ipfs/go-block-format", "go-block-format", "block interfaces and implementations"], - ["ipfs/go-ipfs-blockstore", "go-ipfs-blockstore", "blockstore interfaces and implementations"], - - "Commands", - ["ipfs/go-ipfs-cmds", "go-ipfs-cmds", "CLI & HTTP commands library"], - ["ipfs/go-ipfs-api", "go-ipfs-api", "a shell for the IPFS HTTP API"], - - "Metrics & Logging", - ["ipfs/go-metrics-interface", "go-metrics-interface", "metrics collection interfaces"], - ["ipfs/go-metrics-prometheus", "go-metrics-prometheus", "prometheus-backed metrics collector"], - ["ipfs/go-log", "go-log", "logging framework"], - - "Generics/Utils", - ["ipfs/go-ipfs-routing", "go-ipfs-routing", "routing (content, peer, value) helpers"], - ["ipfs/go-ipfs-util", "go-ipfs-util", "the kitchen sink"], - ["ipfs/go-ipfs-addr", "go-ipfs-addr", "utility functions for parsing IPFS multiaddrs"] - ] -} diff --git a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/Rules.mk b/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/Rules.mk deleted file mode 100644 index 505f70e7..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/Rules.mk +++ /dev/null @@ -1,8 +0,0 @@ -include mk/header.mk - -PB_$(d) = $(wildcard $(d)/*.proto) -TGTS_$(d) = $(PB_$(d):.proto=.pb.go) - -#DEPS_GO += $(TGTS_$(d)) - -include mk/footer.mk diff --git a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/doc.go b/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/doc.go deleted file mode 100644 index 95d4afe6..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -package pb - -//go:generate protoc --gogo_out=. header.proto diff --git a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.pb.go b/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.pb.go deleted file mode 100644 index 71196b26..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.pb.go +++ /dev/null @@ -1,381 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pin/internal/pb/header.proto - -package pb - -import ( - encoding_binary "encoding/binary" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Set struct { - // 1 for now, library will refuse to handle entries with an unrecognized version. - Version uint32 `protobuf:"varint,1,opt,name=version" json:"version"` - // how many of the links are subtrees - Fanout uint32 `protobuf:"varint,2,opt,name=fanout" json:"fanout"` - // hash seed for subtree selection, a random number - Seed uint32 `protobuf:"fixed32,3,opt,name=seed" json:"seed"` -} - -func (m *Set) Reset() { *m = Set{} } -func (m *Set) String() string { return proto.CompactTextString(m) } -func (*Set) ProtoMessage() {} -func (*Set) Descriptor() ([]byte, []int) { - return fileDescriptor_cda303a5a3ed87e7, []int{0} -} -func (m *Set) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Set) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Set.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Set) XXX_Merge(src proto.Message) { - xxx_messageInfo_Set.Merge(m, src) -} -func (m *Set) XXX_Size() int { - return m.Size() -} -func (m *Set) XXX_DiscardUnknown() { - xxx_messageInfo_Set.DiscardUnknown(m) -} - -var xxx_messageInfo_Set proto.InternalMessageInfo - -func (m *Set) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *Set) GetFanout() uint32 { - if m != nil { - return m.Fanout - } - return 0 -} - -func (m *Set) GetSeed() uint32 { - if m != nil { - return m.Seed - } - return 0 -} - -func init() { - proto.RegisterType((*Set)(nil), "ipfs.pin.Set") -} - -func init() { proto.RegisterFile("pin/internal/pb/header.proto", fileDescriptor_cda303a5a3ed87e7) } - -var fileDescriptor_cda303a5a3ed87e7 = []byte{ - // 162 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0xc8, 0xcc, 0xd3, - 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x48, 0xd2, 0xcf, 0x48, 0x4d, 0x4c, - 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc8, 0x2c, 0x48, 0x2b, 0xd6, 0x2b, - 0xc8, 0xcc, 0x53, 0x8a, 0xe5, 0x62, 0x0e, 0x4e, 0x2d, 0x11, 0x92, 0xe3, 0x62, 0x2f, 0x4b, 0x2d, - 0x2a, 0xce, 0xcc, 0xcf, 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x75, 0x62, 0x39, 0x71, 0x4f, 0x9e, - 0x21, 0x08, 0x26, 0x28, 0x24, 0xc3, 0xc5, 0x96, 0x96, 0x98, 0x97, 0x5f, 0x5a, 0x22, 0xc1, 0x84, - 0x24, 0x0d, 0x15, 0x13, 0x92, 0xe0, 0x62, 0x29, 0x4e, 0x4d, 0x4d, 0x91, 0x60, 0x56, 0x60, 0xd4, - 0x60, 0x87, 0xca, 0x81, 0x45, 0x9c, 0x64, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, - 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, - 0x21, 0x8a, 0xa9, 0x20, 0x09, 0x10, 0x00, 0x00, 0xff, 0xff, 0x20, 0x85, 0x2f, 0x24, 0xa5, 0x00, - 0x00, 0x00, -} - -func (m *Set) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Set) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintHeader(dAtA, i, uint64(m.Version)) - dAtA[i] = 0x10 - i++ - i = encodeVarintHeader(dAtA, i, uint64(m.Fanout)) - dAtA[i] = 0x1d - i++ - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(m.Seed)) - i += 4 - return i, nil -} - -func encodeVarintHeader(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Set) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovHeader(uint64(m.Version)) - n += 1 + sovHeader(uint64(m.Fanout)) - n += 5 - return n -} - -func sovHeader(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozHeader(x uint64) (n int) { - return sovHeader(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Set) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeader - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Set: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Set: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeader - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Fanout", wireType) - } - m.Fanout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHeader - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Fanout |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 5 { - return fmt.Errorf("proto: wrong wireType = %d for field Seed", wireType) - } - m.Seed = 0 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF - } - m.Seed = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) - iNdEx += 4 - default: - iNdEx = preIndex - skippy, err := skipHeader(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthHeader - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthHeader - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipHeader(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeader - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeader - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeader - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthHeader - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthHeader - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHeader - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipHeader(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthHeader - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthHeader = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHeader = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.proto b/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.proto deleted file mode 100644 index 36b32b36..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/internal/pb/header.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto2"; - -package ipfs.pin; - -option go_package = "pb"; - -message Set { - // 1 for now, library will refuse to handle entries with an unrecognized version. - optional uint32 version = 1; - // how many of the links are subtrees - optional uint32 fanout = 2; - // hash seed for subtree selection, a random number - optional fixed32 seed = 3; -} diff --git a/vendor/github.com/ipfs/go-ipfs/pin/pin.go b/vendor/github.com/ipfs/go-ipfs/pin/pin.go deleted file mode 100644 index 48a16f84..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/pin.go +++ /dev/null @@ -1,637 +0,0 @@ -// Package pin implements structures and methods to keep track of -// which objects a user wants to keep stored locally. -package pin - -import ( - "context" - "fmt" - "os" - "sync" - "time" - - "github.com/ipfs/go-ipfs/dagutils" - mdag "github.com/ipfs/go-merkledag" - - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("pin") - -var pinDatastoreKey = ds.NewKey("/local/pins") - -var emptyKey cid.Cid - -func init() { - e, err := cid.Decode("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n") - if err != nil { - log.Error("failed to decode empty key constant") - os.Exit(1) - } - emptyKey = e -} - -const ( - linkRecursive = "recursive" - linkDirect = "direct" - linkIndirect = "indirect" - linkInternal = "internal" - linkNotPinned = "not pinned" - linkAny = "any" - linkAll = "all" -) - -// Mode allows to specify different types of pin (recursive, direct etc.). -// See the Pin Modes constants for a full list. -type Mode int - -// Pin Modes -const ( - // Recursive pins pin the target cids along with any reachable children. - Recursive Mode = iota - - // Direct pins pin just the target cid. - Direct - - // Indirect pins are cids who have some ancestor pinned recursively. - Indirect - - // Internal pins are cids used to keep the internal state of the pinner. - Internal - - // NotPinned - NotPinned - - // Any refers to any pinned cid - Any -) - -// ModeToString returns a human-readable name for the Mode. -func ModeToString(mode Mode) (string, bool) { - m := map[Mode]string{ - Recursive: linkRecursive, - Direct: linkDirect, - Indirect: linkIndirect, - Internal: linkInternal, - NotPinned: linkNotPinned, - Any: linkAny, - } - s, ok := m[mode] - return s, ok -} - -// StringToMode parses the result of ModeToString() back to a Mode. -// It returns a boolean which is set to false if the mode is unknown. -func StringToMode(s string) (Mode, bool) { - m := map[string]Mode{ - linkRecursive: Recursive, - linkDirect: Direct, - linkIndirect: Indirect, - linkInternal: Internal, - linkNotPinned: NotPinned, - linkAny: Any, - linkAll: Any, // "all" and "any" means the same thing - } - mode, ok := m[s] - return mode, ok -} - -// A Pinner provides the necessary methods to keep track of Nodes which are -// to be kept locally, according to a pin mode. In practice, a Pinner is in -// in charge of keeping the list of items from the local storage that should -// not be garbage-collected. -type Pinner interface { - // IsPinned returns whether or not the given cid is pinned - // and an explanation of why its pinned - IsPinned(cid.Cid) (string, bool, error) - - // IsPinnedWithType returns whether or not the given cid is pinned with the - // given pin type, as well as returning the type of pin its pinned with. - IsPinnedWithType(cid.Cid, Mode) (string, bool, error) - - // Pin the given node, optionally recursively. - Pin(ctx context.Context, node ipld.Node, recursive bool) error - - // Unpin the given cid. If recursive is true, removes either a recursive or - // a direct pin. If recursive is false, only removes a direct pin. - Unpin(ctx context.Context, cid cid.Cid, recursive bool) error - - // Update updates a recursive pin from one cid to another - // this is more efficient than simply pinning the new one and unpinning the - // old one - Update(ctx context.Context, from, to cid.Cid, unpin bool) error - - // Check if a set of keys are pinned, more efficient than - // calling IsPinned for each key - CheckIfPinned(cids ...cid.Cid) ([]Pinned, error) - - // PinWithMode is for manually editing the pin structure. Use with - // care! If used improperly, garbage collection may not be - // successful. - PinWithMode(cid.Cid, Mode) - - // RemovePinWithMode is for manually editing the pin structure. - // Use with care! If used improperly, garbage collection may not - // be successful. - RemovePinWithMode(cid.Cid, Mode) - - // Flush writes the pin state to the backing datastore - Flush() error - - // DirectKeys returns all directly pinned cids - DirectKeys() []cid.Cid - - // DirectKeys returns all recursively pinned cids - RecursiveKeys() []cid.Cid - - // InternalPins returns all cids kept pinned for the internal state of the - // pinner - InternalPins() []cid.Cid -} - -// Pinned represents CID which has been pinned with a pinning strategy. -// The Via field allows to identify the pinning parent of this CID, in the -// case that the item is not pinned directly (but rather pinned recursively -// by some ascendant). -type Pinned struct { - Key cid.Cid - Mode Mode - Via cid.Cid -} - -// Pinned returns whether or not the given cid is pinned -func (p Pinned) Pinned() bool { - return p.Mode != NotPinned -} - -// String Returns pin status as string -func (p Pinned) String() string { - switch p.Mode { - case NotPinned: - return "not pinned" - case Indirect: - return fmt.Sprintf("pinned via %s", p.Via) - default: - modeStr, _ := ModeToString(p.Mode) - return fmt.Sprintf("pinned: %s", modeStr) - } -} - -// pinner implements the Pinner interface -type pinner struct { - lock sync.RWMutex - recursePin *cid.Set - directPin *cid.Set - - // Track the keys used for storing the pinning state, so gc does - // not delete them. - internalPin *cid.Set - dserv ipld.DAGService - internal ipld.DAGService // dagservice used to store internal objects - dstore ds.Datastore -} - -// NewPinner creates a new pinner using the given datastore as a backend -func NewPinner(dstore ds.Datastore, serv, internal ipld.DAGService) Pinner { - - rcset := cid.NewSet() - dirset := cid.NewSet() - - return &pinner{ - recursePin: rcset, - directPin: dirset, - dserv: serv, - dstore: dstore, - internal: internal, - internalPin: cid.NewSet(), - } -} - -// Pin the given node, optionally recursive -func (p *pinner) Pin(ctx context.Context, node ipld.Node, recurse bool) error { - p.lock.Lock() - defer p.lock.Unlock() - err := p.dserv.Add(ctx, node) - if err != nil { - return err - } - - c := node.Cid() - - if recurse { - if p.recursePin.Has(c) { - return nil - } - - if p.directPin.Has(c) { - p.directPin.Remove(c) - } - p.lock.Unlock() - // fetch entire graph - err := mdag.FetchGraph(ctx, c, p.dserv) - p.lock.Lock() - if err != nil { - return err - } - - if p.recursePin.Has(c) { - return nil - } - - if p.directPin.Has(c) { - p.directPin.Remove(c) - } - - p.recursePin.Add(c) - } else { - p.lock.Unlock() - _, err := p.dserv.Get(ctx, c) - p.lock.Lock() - if err != nil { - return err - } - - if p.recursePin.Has(c) { - return fmt.Errorf("%s already pinned recursively", c.String()) - } - - p.directPin.Add(c) - } - return nil -} - -// ErrNotPinned is returned when trying to unpin items which are not pinned. -var ErrNotPinned = fmt.Errorf("not pinned or pinned indirectly") - -// Unpin a given key -func (p *pinner) Unpin(ctx context.Context, c cid.Cid, recursive bool) error { - p.lock.Lock() - defer p.lock.Unlock() - if p.recursePin.Has(c) { - if !recursive { - return fmt.Errorf("%s is pinned recursively", c) - } - p.recursePin.Remove(c) - return nil - } - if p.directPin.Has(c) { - p.directPin.Remove(c) - return nil - } - return ErrNotPinned -} - -func (p *pinner) isInternalPin(c cid.Cid) bool { - return p.internalPin.Has(c) -} - -// IsPinned returns whether or not the given key is pinned -// and an explanation of why its pinned -func (p *pinner) IsPinned(c cid.Cid) (string, bool, error) { - p.lock.RLock() - defer p.lock.RUnlock() - return p.isPinnedWithType(c, Any) -} - -// IsPinnedWithType returns whether or not the given cid is pinned with the -// given pin type, as well as returning the type of pin its pinned with. -func (p *pinner) IsPinnedWithType(c cid.Cid, mode Mode) (string, bool, error) { - p.lock.RLock() - defer p.lock.RUnlock() - return p.isPinnedWithType(c, mode) -} - -// isPinnedWithType is the implementation of IsPinnedWithType that does not lock. -// intended for use by other pinned methods that already take locks -func (p *pinner) isPinnedWithType(c cid.Cid, mode Mode) (string, bool, error) { - switch mode { - case Any, Direct, Indirect, Recursive, Internal: - default: - err := fmt.Errorf("invalid Pin Mode '%d', must be one of {%d, %d, %d, %d, %d}", - mode, Direct, Indirect, Recursive, Internal, Any) - return "", false, err - } - if (mode == Recursive || mode == Any) && p.recursePin.Has(c) { - return linkRecursive, true, nil - } - if mode == Recursive { - return "", false, nil - } - - if (mode == Direct || mode == Any) && p.directPin.Has(c) { - return linkDirect, true, nil - } - if mode == Direct { - return "", false, nil - } - - if (mode == Internal || mode == Any) && p.isInternalPin(c) { - return linkInternal, true, nil - } - if mode == Internal { - return "", false, nil - } - - // Default is Indirect - visitedSet := cid.NewSet() - for _, rc := range p.recursePin.Keys() { - has, err := hasChild(p.dserv, rc, c, visitedSet.Visit) - if err != nil { - return "", false, err - } - if has { - return rc.String(), true, nil - } - } - return "", false, nil -} - -// CheckIfPinned Checks if a set of keys are pinned, more efficient than -// calling IsPinned for each key, returns the pinned status of cid(s) -func (p *pinner) CheckIfPinned(cids ...cid.Cid) ([]Pinned, error) { - p.lock.RLock() - defer p.lock.RUnlock() - pinned := make([]Pinned, 0, len(cids)) - toCheck := cid.NewSet() - - // First check for non-Indirect pins directly - for _, c := range cids { - if p.recursePin.Has(c) { - pinned = append(pinned, Pinned{Key: c, Mode: Recursive}) - } else if p.directPin.Has(c) { - pinned = append(pinned, Pinned{Key: c, Mode: Direct}) - } else if p.isInternalPin(c) { - pinned = append(pinned, Pinned{Key: c, Mode: Internal}) - } else { - toCheck.Add(c) - } - } - - // Now walk all recursive pins to check for indirect pins - var checkChildren func(cid.Cid, cid.Cid) error - checkChildren = func(rk, parentKey cid.Cid) error { - links, err := ipld.GetLinks(context.TODO(), p.dserv, parentKey) - if err != nil { - return err - } - for _, lnk := range links { - c := lnk.Cid - - if toCheck.Has(c) { - pinned = append(pinned, - Pinned{Key: c, Mode: Indirect, Via: rk}) - toCheck.Remove(c) - } - - err := checkChildren(rk, c) - if err != nil { - return err - } - - if toCheck.Len() == 0 { - return nil - } - } - return nil - } - - for _, rk := range p.recursePin.Keys() { - err := checkChildren(rk, rk) - if err != nil { - return nil, err - } - if toCheck.Len() == 0 { - break - } - } - - // Anything left in toCheck is not pinned - for _, k := range toCheck.Keys() { - pinned = append(pinned, Pinned{Key: k, Mode: NotPinned}) - } - - return pinned, nil -} - -// RemovePinWithMode is for manually editing the pin structure. -// Use with care! If used improperly, garbage collection may not -// be successful. -func (p *pinner) RemovePinWithMode(c cid.Cid, mode Mode) { - p.lock.Lock() - defer p.lock.Unlock() - switch mode { - case Direct: - p.directPin.Remove(c) - case Recursive: - p.recursePin.Remove(c) - default: - // programmer error, panic OK - panic("unrecognized pin type") - } -} - -func cidSetWithValues(cids []cid.Cid) *cid.Set { - out := cid.NewSet() - for _, c := range cids { - out.Add(c) - } - return out -} - -// LoadPinner loads a pinner and its keysets from the given datastore -func LoadPinner(d ds.Datastore, dserv, internal ipld.DAGService) (Pinner, error) { - p := new(pinner) - - rootKey, err := d.Get(pinDatastoreKey) - if err != nil { - return nil, fmt.Errorf("cannot load pin state: %v", err) - } - rootCid, err := cid.Cast(rootKey) - if err != nil { - return nil, err - } - - ctx, cancel := context.WithTimeout(context.TODO(), time.Second*5) - defer cancel() - - root, err := internal.Get(ctx, rootCid) - if err != nil { - return nil, fmt.Errorf("cannot find pinning root object: %v", err) - } - - rootpb, ok := root.(*mdag.ProtoNode) - if !ok { - return nil, mdag.ErrNotProtobuf - } - - internalset := cid.NewSet() - internalset.Add(rootCid) - recordInternal := internalset.Add - - { // load recursive set - recurseKeys, err := loadSet(ctx, internal, rootpb, linkRecursive, recordInternal) - if err != nil { - return nil, fmt.Errorf("cannot load recursive pins: %v", err) - } - p.recursePin = cidSetWithValues(recurseKeys) - } - - { // load direct set - directKeys, err := loadSet(ctx, internal, rootpb, linkDirect, recordInternal) - if err != nil { - return nil, fmt.Errorf("cannot load direct pins: %v", err) - } - p.directPin = cidSetWithValues(directKeys) - } - - p.internalPin = internalset - - // assign services - p.dserv = dserv - p.dstore = d - p.internal = internal - - return p, nil -} - -// DirectKeys returns a slice containing the directly pinned keys -func (p *pinner) DirectKeys() []cid.Cid { - p.lock.RLock() - defer p.lock.RUnlock() - - return p.directPin.Keys() -} - -// RecursiveKeys returns a slice containing the recursively pinned keys -func (p *pinner) RecursiveKeys() []cid.Cid { - p.lock.RLock() - defer p.lock.RUnlock() - - return p.recursePin.Keys() -} - -// Update updates a recursive pin from one cid to another -// this is more efficient than simply pinning the new one and unpinning the -// old one -func (p *pinner) Update(ctx context.Context, from, to cid.Cid, unpin bool) error { - p.lock.Lock() - defer p.lock.Unlock() - - if !p.recursePin.Has(from) { - return fmt.Errorf("'from' cid was not recursively pinned already") - } - - err := dagutils.DiffEnumerate(ctx, p.dserv, from, to) - if err != nil { - return err - } - - p.recursePin.Add(to) - if unpin { - p.recursePin.Remove(from) - } - return nil -} - -// Flush encodes and writes pinner keysets to the datastore -func (p *pinner) Flush() error { - p.lock.Lock() - defer p.lock.Unlock() - - ctx := context.TODO() - - internalset := cid.NewSet() - recordInternal := internalset.Add - - root := &mdag.ProtoNode{} - { - n, err := storeSet(ctx, p.internal, p.directPin.Keys(), recordInternal) - if err != nil { - return err - } - if err := root.AddNodeLink(linkDirect, n); err != nil { - return err - } - } - - { - n, err := storeSet(ctx, p.internal, p.recursePin.Keys(), recordInternal) - if err != nil { - return err - } - if err := root.AddNodeLink(linkRecursive, n); err != nil { - return err - } - } - - // add the empty node, its referenced by the pin sets but never created - err := p.internal.Add(ctx, new(mdag.ProtoNode)) - if err != nil { - return err - } - - err = p.internal.Add(ctx, root) - if err != nil { - return err - } - - k := root.Cid() - - internalset.Add(k) - if err := p.dstore.Put(pinDatastoreKey, k.Bytes()); err != nil { - return fmt.Errorf("cannot store pin state: %v", err) - } - p.internalPin = internalset - return nil -} - -// InternalPins returns all cids kept pinned for the internal state of the -// pinner -func (p *pinner) InternalPins() []cid.Cid { - p.lock.Lock() - defer p.lock.Unlock() - var out []cid.Cid - out = append(out, p.internalPin.Keys()...) - return out -} - -// PinWithMode allows the user to have fine grained control over pin -// counts -func (p *pinner) PinWithMode(c cid.Cid, mode Mode) { - p.lock.Lock() - defer p.lock.Unlock() - switch mode { - case Recursive: - p.recursePin.Add(c) - case Direct: - p.directPin.Add(c) - } -} - -// hasChild recursively looks for a Cid among the children of a root Cid. -// The visit function can be used to shortcut already-visited branches. -func hasChild(ng ipld.NodeGetter, root cid.Cid, child cid.Cid, visit func(cid.Cid) bool) (bool, error) { - links, err := ipld.GetLinks(context.TODO(), ng, root) - if err != nil { - return false, err - } - for _, lnk := range links { - c := lnk.Cid - if lnk.Cid.Equals(child) { - return true, nil - } - if visit(c) { - has, err := hasChild(ng, c, child, visit) - if err != nil { - return false, err - } - - if has { - return has, nil - } - } - } - return false, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/pin/set.go b/vendor/github.com/ipfs/go-ipfs/pin/set.go deleted file mode 100644 index b050c31c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/pin/set.go +++ /dev/null @@ -1,297 +0,0 @@ -package pin - -import ( - "bytes" - "context" - "encoding/binary" - "errors" - "fmt" - "hash/fnv" - "sort" - - "github.com/ipfs/go-ipfs/pin/internal/pb" - "github.com/ipfs/go-merkledag" - - "github.com/gogo/protobuf/proto" - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -const ( - // defaultFanout specifies the default number of fan-out links per layer - defaultFanout = 256 - - // maxItems is the maximum number of items that will fit in a single bucket - maxItems = 8192 -) - -func hash(seed uint32, c cid.Cid) uint32 { - var buf [4]byte - binary.LittleEndian.PutUint32(buf[:], seed) - h := fnv.New32a() - _, _ = h.Write(buf[:]) - _, _ = h.Write(c.Bytes()) - return h.Sum32() -} - -type itemIterator func() (c cid.Cid, ok bool) - -type keyObserver func(cid.Cid) - -type sortByHash struct { - links []*ipld.Link -} - -func (s sortByHash) Len() int { - return len(s.links) -} - -func (s sortByHash) Less(a, b int) bool { - return bytes.Compare(s.links[a].Cid.Bytes(), s.links[b].Cid.Bytes()) == -1 -} - -func (s sortByHash) Swap(a, b int) { - s.links[a], s.links[b] = s.links[b], s.links[a] -} - -func storeItems(ctx context.Context, dag ipld.DAGService, estimatedLen uint64, depth uint32, iter itemIterator, internalKeys keyObserver) (*merkledag.ProtoNode, error) { - links := make([]*ipld.Link, 0, defaultFanout+maxItems) - for i := 0; i < defaultFanout; i++ { - links = append(links, &ipld.Link{Cid: emptyKey}) - } - - // add emptyKey to our set of internal pinset objects - n := &merkledag.ProtoNode{} - n.SetLinks(links) - - internalKeys(emptyKey) - - hdr := &pb.Set{ - Version: 1, - Fanout: defaultFanout, - Seed: depth, - } - if err := writeHdr(n, hdr); err != nil { - return nil, err - } - - if estimatedLen < maxItems { - // it'll probably fit - links := n.Links() - for i := 0; i < maxItems; i++ { - k, ok := iter() - if !ok { - // all done - break - } - - links = append(links, &ipld.Link{Cid: k}) - } - - n.SetLinks(links) - - // sort by hash, also swap item Data - s := sortByHash{ - links: n.Links()[defaultFanout:], - } - sort.Stable(s) - } - - hashed := make([][]cid.Cid, defaultFanout) - for { - // This loop essentially enumerates every single item in the set - // and maps them all into a set of buckets. Each bucket will be recursively - // turned into its own sub-set, and so on down the chain. Each sub-set - // gets added to the dagservice, and put into its place in a set nodes - // links array. - // - // Previously, the bucket was selected by taking an int32 from the hash of - // the input key + seed. This was erroneous as we would later be assigning - // the created sub-sets into an array of length 256 by the modulus of the - // int32 hash value with 256. This resulted in overwriting existing sub-sets - // and losing pins. The fix (a few lines down from this comment), is to - // map the hash value down to the 8 bit keyspace here while creating the - // buckets. This way, we avoid any overlapping later on. - k, ok := iter() - if !ok { - break - } - h := hash(depth, k) % defaultFanout - hashed[h] = append(hashed[h], k) - } - - for h, items := range hashed { - if len(items) == 0 { - // recursion base case - continue - } - - childIter := getCidListIterator(items) - - // recursively create a pinset from the items for this bucket index - child, err := storeItems(ctx, dag, uint64(len(items)), depth+1, childIter, internalKeys) - if err != nil { - return nil, err - } - - size, err := child.Size() - if err != nil { - return nil, err - } - - err = dag.Add(ctx, child) - if err != nil { - return nil, err - } - childKey := child.Cid() - - internalKeys(childKey) - - // overwrite the 'empty key' in the existing links array - n.Links()[h] = &ipld.Link{ - Cid: childKey, - Size: size, - } - } - return n, nil -} - -func readHdr(n *merkledag.ProtoNode) (*pb.Set, error) { - hdrLenRaw, consumed := binary.Uvarint(n.Data()) - if consumed <= 0 { - return nil, errors.New("invalid Set header length") - } - - pbdata := n.Data()[consumed:] - if hdrLenRaw > uint64(len(pbdata)) { - return nil, errors.New("impossibly large Set header length") - } - // as hdrLenRaw was <= an int, we now know it fits in an int - hdrLen := int(hdrLenRaw) - var hdr pb.Set - if err := proto.Unmarshal(pbdata[:hdrLen], &hdr); err != nil { - return nil, err - } - - if v := hdr.GetVersion(); v != 1 { - return nil, fmt.Errorf("unsupported Set version: %d", v) - } - if uint64(hdr.GetFanout()) > uint64(len(n.Links())) { - return nil, errors.New("impossibly large Fanout") - } - return &hdr, nil -} - -func writeHdr(n *merkledag.ProtoNode, hdr *pb.Set) error { - hdrData, err := proto.Marshal(hdr) - if err != nil { - return err - } - - // make enough space for the length prefix and the marshaled header data - data := make([]byte, binary.MaxVarintLen64, binary.MaxVarintLen64+len(hdrData)) - - // write the uvarint length of the header data - uvarlen := binary.PutUvarint(data, uint64(len(hdrData))) - - // append the actual protobuf data *after* the length value we wrote - data = append(data[:uvarlen], hdrData...) - - n.SetData(data) - return nil -} - -type walkerFunc func(idx int, link *ipld.Link) error - -func walkItems(ctx context.Context, dag ipld.DAGService, n *merkledag.ProtoNode, fn walkerFunc, children keyObserver) error { - hdr, err := readHdr(n) - if err != nil { - return err - } - // readHdr guarantees fanout is a safe value - fanout := hdr.GetFanout() - for i, l := range n.Links()[fanout:] { - if err := fn(i, l); err != nil { - return err - } - } - for _, l := range n.Links()[:fanout] { - c := l.Cid - children(c) - if c.Equals(emptyKey) { - continue - } - subtree, err := l.GetNode(ctx, dag) - if err != nil { - return err - } - - stpb, ok := subtree.(*merkledag.ProtoNode) - if !ok { - return merkledag.ErrNotProtobuf - } - - if err := walkItems(ctx, dag, stpb, fn, children); err != nil { - return err - } - } - return nil -} - -func loadSet(ctx context.Context, dag ipld.DAGService, root *merkledag.ProtoNode, name string, internalKeys keyObserver) ([]cid.Cid, error) { - l, err := root.GetNodeLink(name) - if err != nil { - return nil, err - } - - lnkc := l.Cid - internalKeys(lnkc) - - n, err := l.GetNode(ctx, dag) - if err != nil { - return nil, err - } - - pbn, ok := n.(*merkledag.ProtoNode) - if !ok { - return nil, merkledag.ErrNotProtobuf - } - - var res []cid.Cid - walk := func(idx int, link *ipld.Link) error { - res = append(res, link.Cid) - return nil - } - - if err := walkItems(ctx, dag, pbn, walk, internalKeys); err != nil { - return nil, err - } - return res, nil -} - -func getCidListIterator(cids []cid.Cid) itemIterator { - return func() (c cid.Cid, ok bool) { - if len(cids) == 0 { - return cid.Cid{}, false - } - - first := cids[0] - cids = cids[1:] - return first, true - } -} - -func storeSet(ctx context.Context, dag ipld.DAGService, cids []cid.Cid, internalKeys keyObserver) (*merkledag.ProtoNode, error) { - iter := getCidListIterator(cids) - - n, err := storeItems(ctx, dag, uint64(len(cids)), 0, iter, internalKeys) - if err != nil { - return nil, err - } - err = dag.Add(ctx, n) - if err != nil { - return nil, err - } - internalKeys(n.Cid()) - return n, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/Rules.mk b/vendor/github.com/ipfs/go-ipfs/plugin/Rules.mk deleted file mode 100644 index 1e26d2a3..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/Rules.mk +++ /dev/null @@ -1,9 +0,0 @@ -include mk/header.mk - -dir := $(d)/loader -include $(dir)/Rules.mk - -dir := $(d)/plugins -include $(dir)/Rules.mk - -include mk/footer.mk diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/daemon.go b/vendor/github.com/ipfs/go-ipfs/plugin/daemon.go deleted file mode 100644 index 8ed86b76..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/daemon.go +++ /dev/null @@ -1,14 +0,0 @@ -package plugin - -import ( - coreiface "github.com/ipfs/interface-go-ipfs-core" -) - -// PluginDaemon is an interface for daemon plugins. These plugins will be run on -// the daemon and will be given access to an implementation of the CoreAPI. -type PluginDaemon interface { - Plugin - - Start(coreiface.CoreAPI) error - Close() error -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/datastore.go b/vendor/github.com/ipfs/go-ipfs/plugin/datastore.go deleted file mode 100644 index 735eedc9..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/datastore.go +++ /dev/null @@ -1,14 +0,0 @@ -package plugin - -import ( - "github.com/ipfs/go-ipfs/repo/fsrepo" -) - -// PluginDatastore is an interface that can be implemented to add handlers for -// for different datastores -type PluginDatastore interface { - Plugin - - DatastoreTypeName() string - DatastoreConfigParser() fsrepo.ConfigFromMap -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/ipld.go b/vendor/github.com/ipfs/go-ipfs/plugin/ipld.go deleted file mode 100644 index 5b45e9cd..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/ipld.go +++ /dev/null @@ -1,16 +0,0 @@ -package plugin - -import ( - "github.com/ipfs/go-ipfs/core/coredag" - - ipld "github.com/ipfs/go-ipld-format" -) - -// PluginIPLD is an interface that can be implemented to add handlers for -// for different IPLD formats -type PluginIPLD interface { - Plugin - - RegisterBlockDecoders(dec ipld.BlockDecoder) error - RegisterInputEncParsers(iec coredag.InputEncParsers) error -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/loader/Rules.mk b/vendor/github.com/ipfs/go-ipfs/plugin/loader/Rules.mk deleted file mode 100644 index 01f50e27..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/loader/Rules.mk +++ /dev/null @@ -1,10 +0,0 @@ -include mk/header.mk - -$(d)/preload.go: d:=$(d) -$(d)/preload.go: $(d)/preload_list $(d)/preload.sh - $(d)/preload.sh > $@ - go fmt $@ >/dev/null - -DEPS_GO += $(d)/preload.go - -include mk/footer.mk diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/loader/load_linux.go b/vendor/github.com/ipfs/go-ipfs/plugin/loader/load_linux.go deleted file mode 100644 index 19c1e994..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/loader/load_linux.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build !noplugin - -package loader - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "plugin" - - iplugin "github.com/ipfs/go-ipfs/plugin" -) - -func init() { - loadPluginsFunc = linuxLoadFunc -} - -func linuxLoadFunc(pluginDir string) ([]iplugin.Plugin, error) { - var plugins []iplugin.Plugin - - err := filepath.Walk(pluginDir, func(fi string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - if fi != pluginDir { - log.Warningf("found directory inside plugins directory: %s", fi) - } - return nil - } - - if info.Mode().Perm()&0111 == 0 { - // file is not executable let's not load it - // this is to prevent loading plugins from for example non-executable - // mounts, some /tmp mounts are marked as such for security - log.Errorf("non-executable file in plugins directory: %s", fi) - return nil - } - - if newPlugins, err := loadPlugin(fi); err == nil { - plugins = append(plugins, newPlugins...) - } else { - return fmt.Errorf("loading plugin %s: %s", fi, err) - } - return nil - }) - - return plugins, err -} - -func loadPlugin(fi string) ([]iplugin.Plugin, error) { - pl, err := plugin.Open(fi) - if err != nil { - return nil, err - } - pls, err := pl.Lookup("Plugins") - if err != nil { - return nil, err - } - - typePls, ok := pls.(*[]iplugin.Plugin) - if !ok { - return nil, errors.New("filed 'Plugins' didn't contain correct type") - } - - return *typePls, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/loader/loader.go b/vendor/github.com/ipfs/go-ipfs/plugin/loader/loader.go deleted file mode 100644 index b5a2d08e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/loader/loader.go +++ /dev/null @@ -1,170 +0,0 @@ -package loader - -import ( - "fmt" - "os" - "strings" - - coredag "github.com/ipfs/go-ipfs/core/coredag" - plugin "github.com/ipfs/go-ipfs/plugin" - fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" - - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" - coreiface "github.com/ipfs/interface-go-ipfs-core" - opentracing "github.com/opentracing/opentracing-go" -) - -var log = logging.Logger("plugin/loader") - -var loadPluginsFunc = func(string) ([]plugin.Plugin, error) { - return nil, nil -} - -// PluginLoader keeps track of loaded plugins -type PluginLoader struct { - plugins []plugin.Plugin -} - -// NewPluginLoader creates new plugin loader -func NewPluginLoader(pluginDir string) (*PluginLoader, error) { - plMap := make(map[string]plugin.Plugin) - for _, v := range preloadPlugins { - plMap[v.Name()] = v - } - - if pluginDir != "" { - newPls, err := loadDynamicPlugins(pluginDir) - if err != nil { - return nil, err - } - - for _, pl := range newPls { - if ppl, ok := plMap[pl.Name()]; ok { - // plugin is already preloaded - return nil, fmt.Errorf( - "plugin: %s, is duplicated in version: %s, "+ - "while trying to load dynamically: %s", - ppl.Name(), ppl.Version(), pl.Version()) - } - plMap[pl.Name()] = pl - } - } - - loader := &PluginLoader{plugins: make([]plugin.Plugin, 0, len(plMap))} - - for _, v := range plMap { - loader.plugins = append(loader.plugins, v) - } - - return loader, nil -} - -func loadDynamicPlugins(pluginDir string) ([]plugin.Plugin, error) { - _, err := os.Stat(pluginDir) - if os.IsNotExist(err) { - return nil, nil - } - if err != nil { - return nil, err - } - - return loadPluginsFunc(pluginDir) -} - -// Initialize initializes all loaded plugins -func (loader *PluginLoader) Initialize() error { - for _, p := range loader.plugins { - err := p.Init() - if err != nil { - return err - } - } - - return nil -} - -// Inject hooks all the plugins into the appropriate subsystems. -func (loader *PluginLoader) Inject() error { - for _, pl := range loader.plugins { - if pl, ok := pl.(plugin.PluginIPLD); ok { - err := injectIPLDPlugin(pl) - if err != nil { - return err - } - } - if pl, ok := pl.(plugin.PluginTracer); ok { - err := injectTracerPlugin(pl) - if err != nil { - return err - } - } - if pl, ok := pl.(plugin.PluginDatastore); ok { - err := injectDatastorePlugin(pl) - if err != nil { - return err - } - } - } - return nil -} - -// Start starts all long-running plugins. -func (loader *PluginLoader) Start(iface coreiface.CoreAPI) error { - for i, pl := range loader.plugins { - if pl, ok := pl.(plugin.PluginDaemon); ok { - err := pl.Start(iface) - if err != nil { - _ = closePlugins(loader.plugins[i:]) - return err - } - } - } - return nil -} - -// StopDaemon stops all long-running plugins. -func (loader *PluginLoader) Close() error { - return closePlugins(loader.plugins) -} - -func closePlugins(plugins []plugin.Plugin) error { - var errs []string - for _, pl := range plugins { - if pl, ok := pl.(plugin.PluginDaemon); ok { - err := pl.Close() - if err != nil { - errs = append(errs, fmt.Sprintf( - "error closing plugin %s: %s", - pl.Name(), - err.Error(), - )) - } - } - } - if errs != nil { - return fmt.Errorf(strings.Join(errs, "\n")) - } - return nil -} - -func injectDatastorePlugin(pl plugin.PluginDatastore) error { - return fsrepo.AddDatastoreConfigHandler(pl.DatastoreTypeName(), pl.DatastoreConfigParser()) -} - -func injectIPLDPlugin(pl plugin.PluginIPLD) error { - err := pl.RegisterBlockDecoders(ipld.DefaultBlockDecoder) - if err != nil { - return err - } - return pl.RegisterInputEncParsers(coredag.DefaultInputEncParsers) -} - -func injectTracerPlugin(pl plugin.PluginTracer) error { - tracer, err := pl.InitTracer() - if err != nil { - return err - } - opentracing.SetGlobalTracer(tracer) - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.go b/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.go deleted file mode 100644 index 35c0e4ec..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.go +++ /dev/null @@ -1,23 +0,0 @@ -package loader - -import ( - "github.com/ipfs/go-ipfs/plugin" - pluginbadgerds "github.com/ipfs/go-ipfs/plugin/plugins/badgerds" - pluginflatfs "github.com/ipfs/go-ipfs/plugin/plugins/flatfs" - pluginipldgit "github.com/ipfs/go-ipfs/plugin/plugins/git" - pluginlevelds "github.com/ipfs/go-ipfs/plugin/plugins/levelds" - pluginpostgresds "github.com/ipfs/go-ipfs/plugin/plugins/postgresds" -) - - -// DO NOT EDIT THIS FILE -// This file is being generated as part of plugin build process -// To change it, modify the plugin/loader/preload.sh - -var preloadPlugins = []plugin.Plugin{ - pluginipldgit.Plugins[0], - pluginbadgerds.Plugins[0], - pluginflatfs.Plugins[0], - pluginlevelds.Plugins[0], - pluginpostgresds.Plugins[0], -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.sh b/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.sh deleted file mode 100755 index 5d000d0a..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/loader/preload.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -to_preload() { - awk 'NF' "$DIR/preload_list" | sed '/^#/d' -} - -cat <::::", c.passfile) - } - c.host = envVars[0] - c.port = envVars[1] - c.dbname = envVars[2] - c.user = envVars[3] - c.password = envVars[4] - return &c, nil - } - c.host, ok = params["host"].(string) - if !ok { - return nil, fmt.Errorf("'path' field was not a string") - } - c.port, ok = params["port"].(string) - if !ok { - return nil, fmt.Errorf("'port' field was not a string") - } - c.user, ok = params["user"].(string) - if !ok { - return nil, fmt.Errorf("'user' field was not a string") - } - c.dbname, ok = params["dbname"].(string) - if !ok { - return nil, fmt.Errorf("'dbname' field was not a string") - } - c.password, ok = params["password"].(string) - if !ok { - return nil, fmt.Errorf("'password' field was not a string") - } - return &c, nil - } -} - -func (c *datastoreConfig) DiskSpec() fsrepo.DiskSpec { - return map[string]interface{}{ - "type": "postgres", - "user": c.user, - "database": c.dbname, - } -} - -func (c *datastoreConfig) Create(path string) (repo.Datastore, error) { - pg := postgresdb.Options{ - Host: c.host, - User: c.user, - Database: c.dbname, - Password: c.password, - Port: c.port, - } - ds, err := pg.Create() - if err != nil { - fmt.Println("error loading pg: ", err) - return ds, err - } - return ds, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/plugin/tracer.go b/vendor/github.com/ipfs/go-ipfs/plugin/tracer.go deleted file mode 100644 index 2f1d8f81..00000000 --- a/vendor/github.com/ipfs/go-ipfs/plugin/tracer.go +++ /dev/null @@ -1,11 +0,0 @@ -package plugin - -import ( - "github.com/opentracing/opentracing-go" -) - -// PluginTracer is an interface that can be implemented to add a tracer -type PluginTracer interface { - Plugin - InitTracer() (opentracing.Tracer, error) -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/offline.go b/vendor/github.com/ipfs/go-ipfs/provider/offline.go deleted file mode 100644 index 5511364e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/offline.go +++ /dev/null @@ -1,28 +0,0 @@ -package provider - -import ( - "context" - "github.com/ipfs/go-cid" -) - -type offlineProvider struct{} - -// NewOfflineProvider creates a ProviderSystem that does nothing -func NewOfflineProvider() System { - return &offlineProvider{} -} - -func (op *offlineProvider) Run() { -} - -func (op *offlineProvider) Close() error { - return nil -} - -func (op *offlineProvider) Provide(cid.Cid) error { - return nil -} - -func (op *offlineProvider) Reprovide(context.Context) error { - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/provider.go b/vendor/github.com/ipfs/go-ipfs/provider/provider.go deleted file mode 100644 index 7dec4c17..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/provider.go +++ /dev/null @@ -1,26 +0,0 @@ -package provider - -import ( - "context" - "github.com/ipfs/go-cid" -) - -// Provider announces blocks to the network -type Provider interface { - // Run is used to begin processing the provider work - Run() - // Provide takes a cid and makes an attempt to announce it to the network - Provide(cid.Cid) error - // Close stops the provider - Close() error -} - -// Reprovider reannounces blocks to the network -type Reprovider interface { - // Run is used to begin processing the reprovider work and waiting for reprovide triggers - Run() - // Trigger a reprovide - Trigger(context.Context) error - // Close stops the reprovider - Close() error -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/queue/queue.go b/vendor/github.com/ipfs/go-ipfs/provider/queue/queue.go deleted file mode 100644 index 2afbc81e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/queue/queue.go +++ /dev/null @@ -1,211 +0,0 @@ -package queue - -import ( - "context" - "fmt" - "strconv" - "strings" - - cid "github.com/ipfs/go-cid" - datastore "github.com/ipfs/go-datastore" - namespace "github.com/ipfs/go-datastore/namespace" - query "github.com/ipfs/go-datastore/query" - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("provider.queue") - -// Queue provides a durable, FIFO interface to the datastore for storing cids -// -// Durability just means that cids in the process of being provided when a -// crash or shutdown occurs will still be in the queue when the node is -// brought back online. -type Queue struct { - // used to differentiate queues in datastore - // e.g. provider vs reprovider - name string - ctx context.Context - tail uint64 - head uint64 - ds datastore.Datastore // Must be threadsafe - dequeue chan cid.Cid - enqueue chan cid.Cid - close context.CancelFunc - closed chan struct{} -} - -// NewQueue creates a queue for cids -func NewQueue(ctx context.Context, name string, ds datastore.Datastore) (*Queue, error) { - namespaced := namespace.Wrap(ds, datastore.NewKey("/"+name+"/queue/")) - head, tail, err := getQueueHeadTail(ctx, namespaced) - if err != nil { - return nil, err - } - cancelCtx, cancel := context.WithCancel(ctx) - q := &Queue{ - name: name, - ctx: cancelCtx, - head: head, - tail: tail, - ds: namespaced, - dequeue: make(chan cid.Cid), - enqueue: make(chan cid.Cid), - close: cancel, - closed: make(chan struct{}, 1), - } - q.work() - return q, nil -} - -// Close stops the queue -func (q *Queue) Close() error { - q.close() - <-q.closed - return nil -} - -// Enqueue puts a cid in the queue -func (q *Queue) Enqueue(cid cid.Cid) { - select { - case q.enqueue <- cid: - case <-q.ctx.Done(): - } -} - -// Dequeue returns a channel that if listened to will remove entries from the queue -func (q *Queue) Dequeue() <-chan cid.Cid { - return q.dequeue -} - -// Look for next Cid in the queue and return it. Skip over gaps and mangled data -func (q *Queue) nextEntry() (datastore.Key, cid.Cid) { - for { - if q.head >= q.tail { - return datastore.Key{}, cid.Undef - } - - key := q.queueKey(q.head) - value, err := q.ds.Get(key) - - if err != nil { - if err == datastore.ErrNotFound { - log.Warningf("Error missing entry in queue: %s", key) - } else { - log.Errorf("Error fetching from queue: %s", err) - } - q.head++ // move on - continue - } - - c, err := cid.Parse(value) - if err != nil { - log.Warningf("Error marshalling Cid from queue: ", err) - q.head++ - err = q.ds.Delete(key) - if err != nil { - log.Warningf("Provider queue failed to delete: %s", key) - } - continue - } - - return key, c - } -} - -// Run dequeues and enqueues when available. -func (q *Queue) work() { - go func() { - var k datastore.Key = datastore.Key{} - var c cid.Cid = cid.Undef - - defer func() { - close(q.closed) - }() - - for { - if c == cid.Undef { - k, c = q.nextEntry() - } - - // If c != cid.Undef set dequeue and attempt write, otherwise wait for enqueue - var dequeue chan cid.Cid - if c != cid.Undef { - dequeue = q.dequeue - } - - select { - case toQueue := <-q.enqueue: - nextKey := q.queueKey(q.tail) - - if err := q.ds.Put(nextKey, toQueue.Bytes()); err != nil { - log.Errorf("Failed to enqueue cid: %s", err) - continue - } - - q.tail++ - case dequeue <- c: - err := q.ds.Delete(k) - - if err != nil { - log.Errorf("Failed to delete queued cid %s with key %s: %s", c, k, err) - continue - } - c = cid.Undef - q.head++ - case <-q.ctx.Done(): - return - } - } - }() -} - -func (q *Queue) queueKey(id uint64) datastore.Key { - s := fmt.Sprintf("%016X", id) - return datastore.NewKey(s) -} - -func getQueueHeadTail(ctx context.Context, datastore datastore.Datastore) (uint64, uint64, error) { - head, err := getQueueHead(datastore) - if err != nil { - return 0, 0, err - } - tail, err := getQueueTail(datastore) - if err != nil { - return 0, 0, err - } - return head, tail, nil -} - -func getQueueHead(ds datastore.Datastore) (uint64, error) { - return getFirstIDByOrder(ds, query.OrderByKey{}) -} - -func getQueueTail(ds datastore.Datastore) (uint64, error) { - tail, err := getFirstIDByOrder(ds, query.OrderByKeyDescending{}) - if err != nil { - return 0, err - } - if tail > 0 { - tail++ - } - return tail, nil -} - -func getFirstIDByOrder(ds datastore.Datastore, order query.Order) (uint64, error) { - q := query.Query{Orders: []query.Order{order}} - results, err := ds.Query(q) - if err != nil { - return 0, err - } - defer results.Close() - r, ok := results.NextSync() - if !ok { - return 0, nil - } - trimmed := strings.TrimPrefix(r.Key, "/") - id, err := strconv.ParseUint(trimmed, 16, 64) - if err != nil { - return 0, err - } - return id, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/simple/provider.go b/vendor/github.com/ipfs/go-ipfs/provider/simple/provider.go deleted file mode 100644 index abe13ce5..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/simple/provider.go +++ /dev/null @@ -1,72 +0,0 @@ -// Package simple implements structures and methods to provide blocks, -// keep track of which blocks are provided, and to allow those blocks to -// be reprovided. -package simple - -import ( - "context" - - cid "github.com/ipfs/go-cid" - q "github.com/ipfs/go-ipfs/provider/queue" - logging "github.com/ipfs/go-log" - routing "github.com/libp2p/go-libp2p-core/routing" -) - -var logP = logging.Logger("provider.simple") - -const provideOutgoingWorkerLimit = 8 - -// Provider announces blocks to the network -type Provider struct { - ctx context.Context - // the CIDs for which provide announcements should be made - queue *q.Queue - // used to announce providing to the network - contentRouting routing.ContentRouting -} - -// NewProvider creates a provider that announces blocks to the network using a content router -func NewProvider(ctx context.Context, queue *q.Queue, contentRouting routing.ContentRouting) *Provider { - return &Provider{ - ctx: ctx, - queue: queue, - contentRouting: contentRouting, - } -} - -// Close stops the provider -func (p *Provider) Close() error { - p.queue.Close() - return nil -} - -// Run workers to handle provide requests. -func (p *Provider) Run() { - p.handleAnnouncements() -} - -// Provide the given cid using specified strategy. -func (p *Provider) Provide(root cid.Cid) error { - p.queue.Enqueue(root) - return nil -} - -// Handle all outgoing cids by providing (announcing) them -func (p *Provider) handleAnnouncements() { - for workers := 0; workers < provideOutgoingWorkerLimit; workers++ { - go func() { - for p.ctx.Err() == nil { - select { - case <-p.ctx.Done(): - return - case c := <-p.queue.Dequeue(): - logP.Info("announce - start - ", c) - if err := p.contentRouting.Provide(p.ctx, c, true); err != nil { - logP.Warningf("Unable to provide entry: %s, %s", c, err) - } - logP.Info("announce - end - ", c) - } - } - }() - } -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/simple/reprovide.go b/vendor/github.com/ipfs/go-ipfs/provider/simple/reprovide.go deleted file mode 100644 index ce5c7181..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/simple/reprovide.go +++ /dev/null @@ -1,225 +0,0 @@ -package simple - -import ( - "context" - "fmt" - "time" - - backoff "github.com/cenkalti/backoff" - cid "github.com/ipfs/go-cid" - cidutil "github.com/ipfs/go-cidutil" - blocks "github.com/ipfs/go-ipfs-blockstore" - pin "github.com/ipfs/go-ipfs/pin" - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" - merkledag "github.com/ipfs/go-merkledag" - verifcid "github.com/ipfs/go-verifcid" - routing "github.com/libp2p/go-libp2p-core/routing" -) - -var logR = logging.Logger("reprovider.simple") - -//KeyChanFunc is function streaming CIDs to pass to content routing -type KeyChanFunc func(context.Context) (<-chan cid.Cid, error) -type doneFunc func(error) - -// Reprovider reannounces blocks to the network -type Reprovider struct { - ctx context.Context - trigger chan doneFunc - - // The routing system to provide values through - rsys routing.ContentRouting - - keyProvider KeyChanFunc - - tick time.Duration -} - -// NewReprovider creates new Reprovider instance. -func NewReprovider(ctx context.Context, reprovideIniterval time.Duration, rsys routing.ContentRouting, keyProvider KeyChanFunc) *Reprovider { - return &Reprovider{ - ctx: ctx, - trigger: make(chan doneFunc), - - rsys: rsys, - keyProvider: keyProvider, - tick: reprovideIniterval, - } -} - -// Close the reprovider -func (rp *Reprovider) Close() error { - return nil -} - -// Run re-provides keys with 'tick' interval or when triggered -func (rp *Reprovider) Run() { - // dont reprovide immediately. - // may have just started the daemon and shutting it down immediately. - // probability( up another minute | uptime ) increases with uptime. - after := time.After(time.Minute) - var done doneFunc - for { - if rp.tick == 0 { - after = make(chan time.Time) - } - - select { - case <-rp.ctx.Done(): - return - case done = <-rp.trigger: - case <-after: - } - - //'mute' the trigger channel so when `ipfs bitswap reprovide` is called - //a 'reprovider is already running' error is returned - unmute := rp.muteTrigger() - - err := rp.Reprovide() - if err != nil { - logR.Debug(err) - } - - if done != nil { - done(err) - } - - unmute() - - after = time.After(rp.tick) - } -} - -// Reprovide registers all keys given by rp.keyProvider to libp2p content routing -func (rp *Reprovider) Reprovide() error { - keychan, err := rp.keyProvider(rp.ctx) - if err != nil { - return fmt.Errorf("failed to get key chan: %s", err) - } - for c := range keychan { - // hash security - if err := verifcid.ValidateCid(c); err != nil { - logR.Errorf("insecure hash in reprovider, %s (%s)", c, err) - continue - } - op := func() error { - err := rp.rsys.Provide(rp.ctx, c, true) - if err != nil { - logR.Debugf("Failed to provide key: %s", err) - } - return err - } - - // TODO: this backoff library does not respect our context, we should - // eventually work contexts into it. low priority. - err := backoff.Retry(op, backoff.NewExponentialBackOff()) - if err != nil { - logR.Debugf("Providing failed after number of retries: %s", err) - return err - } - } - return nil -} - -// Trigger starts reprovision process in rp.Run and waits for it -func (rp *Reprovider) Trigger(ctx context.Context) error { - progressCtx, done := context.WithCancel(ctx) - - var err error - df := func(e error) { - err = e - done() - } - - select { - case <-rp.ctx.Done(): - return context.Canceled - case <-ctx.Done(): - return context.Canceled - case rp.trigger <- df: - <-progressCtx.Done() - return err - } -} - -func (rp *Reprovider) muteTrigger() context.CancelFunc { - ctx, cf := context.WithCancel(rp.ctx) - go func() { - defer cf() - for { - select { - case <-ctx.Done(): - return - case done := <-rp.trigger: - done(fmt.Errorf("reprovider is already running")) - } - } - }() - - return cf -} - -// Strategies - -// NewBlockstoreProvider returns key provider using bstore.AllKeysChan -func NewBlockstoreProvider(bstore blocks.Blockstore) KeyChanFunc { - return func(ctx context.Context) (<-chan cid.Cid, error) { - return bstore.AllKeysChan(ctx) - } -} - -// NewPinnedProvider returns provider supplying pinned keys -func NewPinnedProvider(onlyRoots bool) func(pin.Pinner, ipld.DAGService) KeyChanFunc { - return func(pinning pin.Pinner, dag ipld.DAGService) KeyChanFunc { - return func(ctx context.Context) (<-chan cid.Cid, error) { - set, err := pinSet(ctx, pinning, dag, onlyRoots) - if err != nil { - return nil, err - } - - outCh := make(chan cid.Cid) - go func() { - defer close(outCh) - for c := range set.New { - select { - case <-ctx.Done(): - return - case outCh <- c: - } - } - - }() - - return outCh, nil - } - } -} - -func pinSet(ctx context.Context, pinning pin.Pinner, dag ipld.DAGService, onlyRoots bool) (*cidutil.StreamingSet, error) { - set := cidutil.NewStreamingSet() - - go func() { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - defer close(set.New) - - for _, key := range pinning.DirectKeys() { - set.Visitor(ctx)(key) - } - - for _, key := range pinning.RecursiveKeys() { - set.Visitor(ctx)(key) - - if !onlyRoots { - err := merkledag.EnumerateChildren(ctx, merkledag.GetLinksWithDAG(dag), key, set.Visitor(ctx)) - if err != nil { - logR.Errorf("reprovide indirect pins: %s", err) - return - } - } - } - }() - - return set, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/provider/system.go b/vendor/github.com/ipfs/go-ipfs/provider/system.go deleted file mode 100644 index b3e17ee4..00000000 --- a/vendor/github.com/ipfs/go-ipfs/provider/system.go +++ /dev/null @@ -1,59 +0,0 @@ -package provider - -import ( - "context" - "github.com/ipfs/go-cid" -) - -// System defines the interface for interacting with the value -// provider system -type System interface { - Run() - Close() error - Provide(cid.Cid) error - Reprovide(context.Context) error -} - -type system struct { - provider Provider - reprovider Reprovider -} - -// NewSystem constructs a new provider system from a provider and reprovider -func NewSystem(provider Provider, reprovider Reprovider) System { - return &system{provider, reprovider} -} - -// Run the provider system by running the provider and reprovider -func (s *system) Run() { - go s.provider.Run() - go s.reprovider.Run() -} - -// Close the provider and reprovider -func (s *system) Close() error { - var errs []error - - if err := s.provider.Close(); err != nil { - errs = append(errs, err) - } - - if err := s.reprovider.Close(); err != nil { - errs = append(errs, err) - } - - if len(errs) > 0 { - return errs[0] - } - return nil -} - -// Provide a value -func (s *system) Provide(cid cid.Cid) error { - return s.provider.Provide(cid) -} - -// Reprovide all the previously provided values -func (s *system) Reprovide(ctx context.Context) error { - return s.reprovider.Trigger(ctx) -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/common/common.go b/vendor/github.com/ipfs/go-ipfs/repo/common/common.go deleted file mode 100644 index dc1e7c50..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/common/common.go +++ /dev/null @@ -1,56 +0,0 @@ -package common - -import ( - "fmt" - "strings" -) - -func MapGetKV(v map[string]interface{}, key string) (interface{}, error) { - var ok bool - var mcursor map[string]interface{} - var cursor interface{} = v - - parts := strings.Split(key, ".") - for i, part := range parts { - sofar := strings.Join(parts[:i], ".") - - mcursor, ok = cursor.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("%s key is not a map", sofar) - } - - cursor, ok = mcursor[part] - if !ok { - return nil, fmt.Errorf("%s key has no attributes", sofar) - } - } - return cursor, nil -} - -func MapSetKV(v map[string]interface{}, key string, value interface{}) error { - var ok bool - var mcursor map[string]interface{} - var cursor interface{} = v - - parts := strings.Split(key, ".") - for i, part := range parts { - mcursor, ok = cursor.(map[string]interface{}) - if !ok { - sofar := strings.Join(parts[:i], ".") - return fmt.Errorf("%s key is not a map", sofar) - } - - // last part? set here - if i == (len(parts) - 1) { - mcursor[part] = value - break - } - - cursor, ok = mcursor[part] - if !ok || cursor == nil { // create map if this is empty or is null - mcursor[part] = map[string]interface{}{} - cursor = mcursor[part] - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/datastores.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/datastores.go deleted file mode 100644 index 8cdf25fc..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/datastores.go +++ /dev/null @@ -1,248 +0,0 @@ -package fsrepo - -import ( - "bytes" - "encoding/json" - "fmt" - "sort" - - "github.com/ipfs/go-ipfs/repo" - - ds "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/mount" - dssync "github.com/ipfs/go-datastore/sync" - "github.com/ipfs/go-ds-measure" -) - -// ConfigFromMap creates a new datastore config from a map -type ConfigFromMap func(map[string]interface{}) (DatastoreConfig, error) - -// DatastoreConfig is an abstraction of a datastore config. A "spec" -// is first converted to a DatastoreConfig and then Create() is called -// to instantiate a new datastore -type DatastoreConfig interface { - // DiskSpec returns a minimal configuration of the datastore - // represting what is stored on disk. Run time values are - // excluded. - DiskSpec() DiskSpec - - // Create instantiate a new datastore from this config - Create(path string) (repo.Datastore, error) -} - -// DiskSpec is a minimal representation of the characteristic values of the -// datastore. If two diskspecs are the same, the loader assumes that they refer -// to exactly the same datastore. If they differ at all, it is assumed they are -// completely different datastores and a migration will be performed. Runtime -// values such as cache options or concurrency options should not be added -// here. -type DiskSpec map[string]interface{} - -// Bytes returns a minimal JSON encoding of the DiskSpec -func (spec DiskSpec) Bytes() []byte { - b, err := json.Marshal(spec) - if err != nil { - // should not happen - panic(err) - } - return bytes.TrimSpace(b) -} - -// String returns a minimal JSON encoding of the DiskSpec -func (spec DiskSpec) String() string { - return string(spec.Bytes()) -} - -var datastores map[string]ConfigFromMap - -func init() { - datastores = map[string]ConfigFromMap{ - "mount": MountDatastoreConfig, - "mem": MemDatastoreConfig, - "log": LogDatastoreConfig, - "measure": MeasureDatastoreConfig, - } -} - -func AddDatastoreConfigHandler(name string, dsc ConfigFromMap) error { - _, ok := datastores[name] - if ok { - return fmt.Errorf("already have a datastore named %q", name) - } - - datastores[name] = dsc - return nil -} - -// AnyDatastoreConfig returns a DatastoreConfig from a spec based on -// the "type" parameter -func AnyDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) { - which, ok := params["type"].(string) - if !ok { - return nil, fmt.Errorf("'type' field missing or not a string") - } - fun, ok := datastores[which] - if !ok { - return nil, fmt.Errorf("unknown datastore type: %s", which) - } - return fun(params) -} - -type mountDatastoreConfig struct { - mounts []premount -} - -type premount struct { - ds DatastoreConfig - prefix ds.Key -} - -// MountDatastoreConfig returns a mount DatastoreConfig from a spec -func MountDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) { - var res mountDatastoreConfig - mounts, ok := params["mounts"].([]interface{}) - if !ok { - return nil, fmt.Errorf("'mounts' field is missing or not an array") - } - for _, iface := range mounts { - cfg, ok := iface.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("expected map for mountpoint") - } - - child, err := AnyDatastoreConfig(cfg) - if err != nil { - return nil, err - } - - prefix, found := cfg["mountpoint"] - if !found { - return nil, fmt.Errorf("no 'mountpoint' on mount") - } - - res.mounts = append(res.mounts, premount{ - ds: child, - prefix: ds.NewKey(prefix.(string)), - }) - } - sort.Slice(res.mounts, - func(i, j int) bool { - return res.mounts[i].prefix.String() > res.mounts[j].prefix.String() - }) - - return &res, nil -} - -func (c *mountDatastoreConfig) DiskSpec() DiskSpec { - cfg := map[string]interface{}{"type": "mount"} - mounts := make([]interface{}, len(c.mounts)) - for i, m := range c.mounts { - c := m.ds.DiskSpec() - if c == nil { - c = make(map[string]interface{}) - } - c["mountpoint"] = m.prefix.String() - mounts[i] = c - } - cfg["mounts"] = mounts - return cfg -} - -func (c *mountDatastoreConfig) Create(path string) (repo.Datastore, error) { - mounts := make([]mount.Mount, len(c.mounts)) - for i, m := range c.mounts { - ds, err := m.ds.Create(path) - if err != nil { - return nil, err - } - mounts[i].Datastore = ds - mounts[i].Prefix = m.prefix - } - return mount.New(mounts), nil -} - -type memDatastoreConfig struct { - cfg map[string]interface{} -} - -// MemDatastoreConfig returns a memory DatastoreConfig from a spec -func MemDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) { - return &memDatastoreConfig{params}, nil -} - -func (c *memDatastoreConfig) DiskSpec() DiskSpec { - return nil -} - -func (c *memDatastoreConfig) Create(string) (repo.Datastore, error) { - return dssync.MutexWrap(ds.NewMapDatastore()), nil -} - -type logDatastoreConfig struct { - child DatastoreConfig - name string -} - -// LogDatastoreConfig returns a log DatastoreConfig from a spec -func LogDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) { - childField, ok := params["child"].(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("'child' field is missing or not a map") - } - child, err := AnyDatastoreConfig(childField) - if err != nil { - return nil, err - } - name, ok := params["name"].(string) - if !ok { - return nil, fmt.Errorf("'name' field was missing or not a string") - } - return &logDatastoreConfig{child, name}, nil - -} - -func (c *logDatastoreConfig) Create(path string) (repo.Datastore, error) { - child, err := c.child.Create(path) - if err != nil { - return nil, err - } - return ds.NewLogDatastore(child, c.name), nil -} - -func (c *logDatastoreConfig) DiskSpec() DiskSpec { - return c.child.DiskSpec() -} - -type measureDatastoreConfig struct { - child DatastoreConfig - prefix string -} - -// MeasureDatastoreConfig returns a measure DatastoreConfig from a spec -func MeasureDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) { - childField, ok := params["child"].(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("'child' field is missing or not a map") - } - child, err := AnyDatastoreConfig(childField) - if err != nil { - return nil, err - } - prefix, ok := params["prefix"].(string) - if !ok { - return nil, fmt.Errorf("'prefix' field was missing or not a string") - } - return &measureDatastoreConfig{child, prefix}, nil -} - -func (c *measureDatastoreConfig) DiskSpec() DiskSpec { - return c.child.DiskSpec() -} - -func (c measureDatastoreConfig) Create(path string) (repo.Datastore, error) { - child, err := c.child.Create(path) - if err != nil { - return nil, err - } - return measure.New(c.prefix, child), nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/doc.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/doc.go deleted file mode 100644 index 50d52855..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// package fsrepo -// -// TODO explain the package roadmap... -// -// .ipfs/ -// ├── client/ -// | ├── client.lock <------ protects client/ + signals its own pid -// │ ├── ipfs-client.cpuprof -// │ └── ipfs-client.memprof -// ├── config -// ├── daemon/ -// │ ├── daemon.lock <------ protects daemon/ + signals its own address -// │ ├── ipfs-daemon.cpuprof -// │ └── ipfs-daemon.memprof -// ├── datastore/ -// ├── repo.lock <------ protects datastore/ and config -// └── version -package fsrepo - -// TODO prevent multiple daemons from running diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go deleted file mode 100644 index d35c9714..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go +++ /dev/null @@ -1,720 +0,0 @@ -package fsrepo - -import ( - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" - "sync" - - filestore "github.com/ipfs/go-ipfs/filestore" - keystore "github.com/ipfs/go-ipfs/keystore" - repo "github.com/ipfs/go-ipfs/repo" - "github.com/ipfs/go-ipfs/repo/common" - mfsr "github.com/ipfs/go-ipfs/repo/fsrepo/migrations" - dir "github.com/ipfs/go-ipfs/thirdparty/dir" - - ds "github.com/ipfs/go-datastore" - measure "github.com/ipfs/go-ds-measure" - lockfile "github.com/ipfs/go-fs-lock" - config "github.com/ipfs/go-ipfs-config" - serialize "github.com/ipfs/go-ipfs-config/serialize" - util "github.com/ipfs/go-ipfs-util" - logging "github.com/ipfs/go-log" - homedir "github.com/mitchellh/go-homedir" - ma "github.com/multiformats/go-multiaddr" -) - -// LockFile is the filename of the repo lock, relative to config dir -// TODO rename repo lock and hide name -const LockFile = "repo.lock" - -var log = logging.Logger("fsrepo") - -// version number that we are currently expecting to see -var RepoVersion = 7 - -var migrationInstructions = `See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md -Sorry for the inconvenience. In the future, these will run automatically.` - -var programTooLowMessage = `Your programs version (%d) is lower than your repos (%d). -Please update ipfs to a version that supports the existing repo, or run -a migration in reverse. - -See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md for details.` - -var ( - ErrNoVersion = errors.New("no version file found, please run 0-to-1 migration tool.\n" + migrationInstructions) - ErrOldRepo = errors.New("ipfs repo found in old '~/.go-ipfs' location, please run migration tool.\n" + migrationInstructions) - ErrNeedMigration = errors.New("ipfs repo needs migration") -) - -type NoRepoError struct { - Path string -} - -var _ error = NoRepoError{} - -func (err NoRepoError) Error() string { - return fmt.Sprintf("no IPFS repo found in %s.\nplease run: 'ipfs init'", err.Path) -} - -const apiFile = "api" -const swarmKeyFile = "swarm.key" - -const specFn = "datastore_spec" - -var ( - - // packageLock must be held to while performing any operation that modifies an - // FSRepo's state field. This includes Init, Open, Close, and Remove. - packageLock sync.Mutex - - // onlyOne keeps track of open FSRepo instances. - // - // TODO: once command Context / Repo integration is cleaned up, - // this can be removed. Right now, this makes ConfigCmd.Run - // function try to open the repo twice: - // - // $ ipfs daemon & - // $ ipfs config foo - // - // The reason for the above is that in standalone mode without the - // daemon, `ipfs config` tries to save work by not building the - // full IpfsNode, but accessing the Repo directly. - onlyOne repo.OnlyOne -) - -// FSRepo represents an IPFS FileSystem Repo. It is safe for use by multiple -// callers. -type FSRepo struct { - // has Close been called already - closed bool - // path is the file-system path - path string - // lockfile is the file system lock to prevent others from opening - // the same fsrepo path concurrently - lockfile io.Closer - config *config.Config - ds repo.Datastore - keystore keystore.Keystore - filemgr *filestore.FileManager -} - -var _ repo.Repo = (*FSRepo)(nil) - -// Open the FSRepo at path. Returns an error if the repo is not -// initialized. -func Open(repoPath string) (repo.Repo, error) { - fn := func() (repo.Repo, error) { - return open(repoPath) - } - return onlyOne.Open(repoPath, fn) -} - -func open(repoPath string) (repo.Repo, error) { - packageLock.Lock() - defer packageLock.Unlock() - - r, err := newFSRepo(repoPath) - if err != nil { - return nil, err - } - - // Check if its initialized - if err := checkInitialized(r.path); err != nil { - return nil, err - } - - r.lockfile, err = lockfile.Lock(r.path, LockFile) - if err != nil { - return nil, err - } - keepLocked := false - defer func() { - // unlock on error, leave it locked on success - if !keepLocked { - r.lockfile.Close() - } - }() - - // Check version, and error out if not matching - ver, err := mfsr.RepoPath(r.path).Version() - if err != nil { - if os.IsNotExist(err) { - return nil, ErrNoVersion - } - return nil, err - } - - if RepoVersion > ver { - return nil, ErrNeedMigration - } else if ver > RepoVersion { - // program version too low for existing repo - return nil, fmt.Errorf(programTooLowMessage, RepoVersion, ver) - } - - // check repo path, then check all constituent parts. - if err := dir.Writable(r.path); err != nil { - return nil, err - } - - if err := r.openConfig(); err != nil { - return nil, err - } - - if err := r.openDatastore(); err != nil { - return nil, err - } - - if err := r.openKeystore(); err != nil { - return nil, err - } - - if r.config.Experimental.FilestoreEnabled || r.config.Experimental.UrlstoreEnabled { - r.filemgr = filestore.NewFileManager(r.ds, filepath.Dir(r.path)) - r.filemgr.AllowFiles = r.config.Experimental.FilestoreEnabled - r.filemgr.AllowUrls = r.config.Experimental.UrlstoreEnabled - } - - keepLocked = true - return r, nil -} - -func newFSRepo(rpath string) (*FSRepo, error) { - expPath, err := homedir.Expand(filepath.Clean(rpath)) - if err != nil { - return nil, err - } - - return &FSRepo{path: expPath}, nil -} - -func checkInitialized(path string) error { - if !isInitializedUnsynced(path) { - alt := strings.Replace(path, ".ipfs", ".go-ipfs", 1) - if isInitializedUnsynced(alt) { - return ErrOldRepo - } - return NoRepoError{Path: path} - } - return nil -} - -// ConfigAt returns an error if the FSRepo at the given path is not -// initialized. This function allows callers to read the config file even when -// another process is running and holding the lock. -func ConfigAt(repoPath string) (*config.Config, error) { - - // packageLock must be held to ensure that the Read is atomic. - packageLock.Lock() - defer packageLock.Unlock() - - configFilename, err := config.Filename(repoPath) - if err != nil { - return nil, err - } - return serialize.Load(configFilename) -} - -// configIsInitialized returns true if the repo is initialized at -// provided |path|. -func configIsInitialized(path string) bool { - configFilename, err := config.Filename(path) - if err != nil { - return false - } - if !util.FileExists(configFilename) { - return false - } - return true -} - -func initConfig(path string, conf *config.Config) error { - if configIsInitialized(path) { - return nil - } - configFilename, err := config.Filename(path) - if err != nil { - return err - } - // initialization is the one time when it's okay to write to the config - // without reading the config from disk and merging any user-provided keys - // that may exist. - if err := serialize.WriteConfigFile(configFilename, conf); err != nil { - return err - } - - return nil -} - -func initSpec(path string, conf map[string]interface{}) error { - fn, err := config.Path(path, specFn) - if err != nil { - return err - } - - if util.FileExists(fn) { - return nil - } - - dsc, err := AnyDatastoreConfig(conf) - if err != nil { - return err - } - bytes := dsc.DiskSpec().Bytes() - - return ioutil.WriteFile(fn, bytes, 0600) -} - -// Init initializes a new FSRepo at the given path with the provided config. -// TODO add support for custom datastores. -func Init(repoPath string, conf *config.Config) error { - - // packageLock must be held to ensure that the repo is not initialized more - // than once. - packageLock.Lock() - defer packageLock.Unlock() - - if isInitializedUnsynced(repoPath) { - return nil - } - - if err := initConfig(repoPath, conf); err != nil { - return err - } - - if err := initSpec(repoPath, conf.Datastore.Spec); err != nil { - return err - } - - if err := mfsr.RepoPath(repoPath).WriteVersion(RepoVersion); err != nil { - return err - } - - return nil -} - -// LockedByOtherProcess returns true if the FSRepo is locked by another -// process. If true, then the repo cannot be opened by this process. -func LockedByOtherProcess(repoPath string) (bool, error) { - repoPath = filepath.Clean(repoPath) - locked, err := lockfile.Locked(repoPath, LockFile) - if locked { - log.Debugf("(%t)<->Lock is held at %s", locked, repoPath) - } - return locked, err -} - -// APIAddr returns the registered API addr, according to the api file -// in the fsrepo. This is a concurrent operation, meaning that any -// process may read this file. modifying this file, therefore, should -// use "mv" to replace the whole file and avoid interleaved read/writes. -func APIAddr(repoPath string) (ma.Multiaddr, error) { - repoPath = filepath.Clean(repoPath) - apiFilePath := filepath.Join(repoPath, apiFile) - - // if there is no file, assume there is no api addr. - f, err := os.Open(apiFilePath) - if err != nil { - if os.IsNotExist(err) { - return nil, repo.ErrApiNotRunning - } - return nil, err - } - defer f.Close() - - // read up to 2048 bytes. io.ReadAll is a vulnerability, as - // someone could hose the process by putting a massive file there. - // - // NOTE(@stebalien): @jbenet probably wasn't thinking straight when he - // wrote that comment but I'm leaving the limit here in case there was - // some hidden wisdom. However, I'm fixing it such that: - // 1. We don't read too little. - // 2. We don't truncate and succeed. - buf, err := ioutil.ReadAll(io.LimitReader(f, 2048)) - if err != nil { - return nil, err - } - if len(buf) == 2048 { - return nil, fmt.Errorf("API file too large, must be <2048 bytes long: %s", apiFilePath) - } - - s := string(buf) - s = strings.TrimSpace(s) - return ma.NewMultiaddr(s) -} - -func (r *FSRepo) Keystore() keystore.Keystore { - return r.keystore -} - -func (r *FSRepo) Path() string { - return r.path -} - -// SetAPIAddr writes the API Addr to the /api file. -func (r *FSRepo) SetAPIAddr(addr ma.Multiaddr) error { - f, err := os.Create(filepath.Join(r.path, apiFile)) - if err != nil { - return err - } - defer f.Close() - - _, err = f.WriteString(addr.String()) - return err -} - -// openConfig returns an error if the config file is not present. -func (r *FSRepo) openConfig() error { - configFilename, err := config.Filename(r.path) - if err != nil { - return err - } - conf, err := serialize.Load(configFilename) - if err != nil { - return err - } - r.config = conf - return nil -} - -func (r *FSRepo) openKeystore() error { - ksp := filepath.Join(r.path, "keystore") - ks, err := keystore.NewFSKeystore(ksp) - if err != nil { - return err - } - - r.keystore = ks - - return nil -} - -// openDatastore returns an error if the config file is not present. -func (r *FSRepo) openDatastore() error { - if r.config.Datastore.Type != "" || r.config.Datastore.Path != "" { - return fmt.Errorf("old style datatstore config detected") - } else if r.config.Datastore.Spec == nil { - return fmt.Errorf("required Datastore.Spec entry missing from config file") - } - if r.config.Datastore.NoSync { - log.Warning("NoSync is now deprecated in favor of datastore specific settings. If you want to disable fsync on flatfs set 'sync' to false. See https://github.com/ipfs/go-ipfs/blob/master/docs/datastores.md#flatfs.") - } - - dsc, err := AnyDatastoreConfig(r.config.Datastore.Spec) - if err != nil { - return err - } - spec := dsc.DiskSpec() - - oldSpec, err := r.readSpec() - if err != nil { - return err - } - if oldSpec != spec.String() { - return fmt.Errorf("datastore configuration of '%s' does not match what is on disk '%s'", - oldSpec, spec.String()) - } - - d, err := dsc.Create(r.path) - if err != nil { - return err - } - r.ds = d - - // Wrap it with metrics gathering - prefix := "ipfs.fsrepo.datastore" - r.ds = measure.New(prefix, r.ds) - - return nil -} - -func (r *FSRepo) readSpec() (string, error) { - fn, err := config.Path(r.path, specFn) - if err != nil { - return "", err - } - b, err := ioutil.ReadFile(fn) - if err != nil { - return "", err - } - return strings.TrimSpace(string(b)), nil -} - -// Close closes the FSRepo, releasing held resources. -func (r *FSRepo) Close() error { - packageLock.Lock() - defer packageLock.Unlock() - - if r.closed { - return errors.New("repo is closed") - } - - err := os.Remove(filepath.Join(r.path, apiFile)) - if err != nil && !os.IsNotExist(err) { - log.Warning("error removing api file: ", err) - } - - if err := r.ds.Close(); err != nil { - return err - } - - // This code existed in the previous versions, but - // EventlogComponent.Close was never called. Preserving here - // pending further discussion. - // - // TODO It isn't part of the current contract, but callers may like for us - // to disable logging once the component is closed. - // logging.Configure(logging.Output(os.Stderr)) - - r.closed = true - return r.lockfile.Close() -} - -// Config the current config. This function DOES NOT copy the config. The caller -// MUST NOT modify it without first calling `Clone`. -// -// Result when not Open is undefined. The method may panic if it pleases. -func (r *FSRepo) Config() (*config.Config, error) { - // It is not necessary to hold the package lock since the repo is in an - // opened state. The package lock is _not_ meant to ensure that the repo is - // thread-safe. The package lock is only meant to guard against removal and - // coordinate the lockfile. However, we provide thread-safety to keep - // things simple. - packageLock.Lock() - defer packageLock.Unlock() - - if r.closed { - return nil, errors.New("cannot access config, repo not open") - } - return r.config, nil -} - -func (r *FSRepo) FileManager() *filestore.FileManager { - return r.filemgr -} - -func (r *FSRepo) BackupConfig(prefix string) (string, error) { - temp, err := ioutil.TempFile(r.path, "config-"+prefix) - if err != nil { - return "", err - } - defer temp.Close() - - configFilename, err := config.Filename(r.path) - if err != nil { - return "", err - } - - orig, err := os.OpenFile(configFilename, os.O_RDONLY, 0600) - if err != nil { - return "", err - } - defer orig.Close() - - _, err = io.Copy(temp, orig) - if err != nil { - return "", err - } - - return orig.Name(), nil -} - -// setConfigUnsynced is for private use. -func (r *FSRepo) setConfigUnsynced(updated *config.Config) error { - configFilename, err := config.Filename(r.path) - if err != nil { - return err - } - // to avoid clobbering user-provided keys, must read the config from disk - // as a map, write the updated struct values to the map and write the map - // to disk. - var mapconf map[string]interface{} - if err := serialize.ReadConfigFile(configFilename, &mapconf); err != nil { - return err - } - m, err := config.ToMap(updated) - if err != nil { - return err - } - for k, v := range m { - mapconf[k] = v - } - if err := serialize.WriteConfigFile(configFilename, mapconf); err != nil { - return err - } - // Do not use `*r.config = ...`. This will modify the *shared* config - // returned by `r.Config`. - r.config = updated - return nil -} - -// SetConfig updates the FSRepo's config. The user must not modify the config -// object after calling this method. -func (r *FSRepo) SetConfig(updated *config.Config) error { - - // packageLock is held to provide thread-safety. - packageLock.Lock() - defer packageLock.Unlock() - - return r.setConfigUnsynced(updated) -} - -// GetConfigKey retrieves only the value of a particular key. -func (r *FSRepo) GetConfigKey(key string) (interface{}, error) { - packageLock.Lock() - defer packageLock.Unlock() - - if r.closed { - return nil, errors.New("repo is closed") - } - - filename, err := config.Filename(r.path) - if err != nil { - return nil, err - } - var cfg map[string]interface{} - if err := serialize.ReadConfigFile(filename, &cfg); err != nil { - return nil, err - } - return common.MapGetKV(cfg, key) -} - -// SetConfigKey writes the value of a particular key. -func (r *FSRepo) SetConfigKey(key string, value interface{}) error { - packageLock.Lock() - defer packageLock.Unlock() - - if r.closed { - return errors.New("repo is closed") - } - - filename, err := config.Filename(r.path) - if err != nil { - return err - } - var mapconf map[string]interface{} - if err := serialize.ReadConfigFile(filename, &mapconf); err != nil { - return err - } - - // Load private key to guard against it being overwritten. - // NOTE: this is a temporary measure to secure this field until we move - // keys out of the config file. - pkval, err := common.MapGetKV(mapconf, config.PrivKeySelector) - if err != nil { - return err - } - - // Get the type of the value associated with the key - oldValue, err := common.MapGetKV(mapconf, key) - ok := true - if err != nil { - // key-value does not exist yet - switch v := value.(type) { - case string: - value, err = strconv.ParseBool(v) - if err != nil { - value, err = strconv.Atoi(v) - if err != nil { - value, err = strconv.ParseFloat(v, 32) - if err != nil { - value = v - } - } - } - default: - } - } else { - switch oldValue.(type) { - case bool: - value, ok = value.(bool) - case int: - value, ok = value.(int) - case float32: - value, ok = value.(float32) - case string: - value, ok = value.(string) - default: - } - if !ok { - return fmt.Errorf("wrong config type, expected %T", oldValue) - } - } - - if err := common.MapSetKV(mapconf, key, value); err != nil { - return err - } - - // replace private key, in case it was overwritten. - if err := common.MapSetKV(mapconf, config.PrivKeySelector, pkval); err != nil { - return err - } - - // This step doubles as to validate the map against the struct - // before serialization - conf, err := config.FromMap(mapconf) - if err != nil { - return err - } - if err := serialize.WriteConfigFile(filename, mapconf); err != nil { - return err - } - return r.setConfigUnsynced(conf) // TODO roll this into this method -} - -// Datastore returns a repo-owned datastore. If FSRepo is Closed, return value -// is undefined. -func (r *FSRepo) Datastore() repo.Datastore { - packageLock.Lock() - d := r.ds - packageLock.Unlock() - return d -} - -// GetStorageUsage computes the storage space taken by the repo in bytes -func (r *FSRepo) GetStorageUsage() (uint64, error) { - return ds.DiskUsage(r.Datastore()) -} - -func (r *FSRepo) SwarmKey() ([]byte, error) { - repoPath := filepath.Clean(r.path) - spath := filepath.Join(repoPath, swarmKeyFile) - - f, err := os.Open(spath) - if err != nil { - if os.IsNotExist(err) { - err = nil - } - return nil, err - } - defer f.Close() - - return ioutil.ReadAll(f) -} - -var _ io.Closer = &FSRepo{} -var _ repo.Repo = &FSRepo{} - -// IsInitialized returns true if the repo is initialized at provided |path|. -func IsInitialized(path string) bool { - // packageLock is held to ensure that another caller doesn't attempt to - // Init or Remove the repo while this call is in progress. - packageLock.Lock() - defer packageLock.Unlock() - - return isInitializedUnsynced(path) -} - -// private methods below this point. NB: packageLock must held by caller. - -// isInitializedUnsynced reports whether the repo is initialized. Caller must -// hold the packageLock. -func isInitializedUnsynced(repoPath string) bool { - return configIsInitialized(repoPath) -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/mfsr.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/mfsr.go deleted file mode 100644 index c0f3b8b4..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/mfsr.go +++ /dev/null @@ -1,55 +0,0 @@ -package mfsr - -import ( - "fmt" - "io/ioutil" - "os" - "path" - "strconv" - "strings" -) - -const VersionFile = "version" - -type RepoPath string - -func (rp RepoPath) VersionFile() string { - return path.Join(string(rp), VersionFile) -} - -func (rp RepoPath) Version() (int, error) { - if rp == "" { - return 0, fmt.Errorf("invalid repo path \"%s\"", rp) - } - - fn := rp.VersionFile() - if _, err := os.Stat(fn); err != nil { - return 0, err - } - - c, err := ioutil.ReadFile(fn) - if err != nil { - return 0, err - } - - s := strings.TrimSpace(string(c)) - return strconv.Atoi(s) -} - -func (rp RepoPath) CheckVersion(version int) error { - v, err := rp.Version() - if err != nil { - return err - } - - if v != version { - return fmt.Errorf("versions differ (expected: %d, actual:%d)", version, v) - } - - return nil -} - -func (rp RepoPath) WriteVersion(version int) error { - fn := rp.VersionFile() - return ioutil.WriteFile(fn, []byte(fmt.Sprintf("%d\n", version)), 0644) -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/migrations.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/migrations.go deleted file mode 100644 index de71de60..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/migrations.go +++ /dev/null @@ -1,277 +0,0 @@ -package mfsr - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - "os/exec" - "path/filepath" - "runtime" - "strconv" - "strings" -) - -var DistPath = "https://ipfs.io/ipfs/QmZLYJBVBK8nqc5JTHp6CZU1v9Ja3MvGrkCe61PfCecc6E" - -func init() { - if dist := os.Getenv("IPFS_DIST_PATH"); dist != "" { - DistPath = dist - } -} - -const migrations = "fs-repo-migrations" - -func migrationsBinName() string { - switch runtime.GOOS { - case "windows": - return migrations + ".exe" - default: - return migrations - } -} - -func RunMigration(newv int) error { - migrateBin := migrationsBinName() - - fmt.Println(" => Looking for suitable fs-repo-migrations binary.") - - var err error - migrateBin, err = exec.LookPath(migrateBin) - if err == nil { - // check to make sure migrations binary supports our target version - err = verifyMigrationSupportsVersion(migrateBin, newv) - } - - if err != nil { - fmt.Println(" => None found, downloading.") - - loc, err := GetMigrations() - if err != nil { - fmt.Println(" => Failed to download fs-repo-migrations.") - return err - } - - err = verifyMigrationSupportsVersion(loc, newv) - if err != nil { - return fmt.Errorf("no fs-repo-migration binary found for version %d: %s", newv, err) - } - - migrateBin = loc - } - - cmd := exec.Command(migrateBin, "-to", fmt.Sprint(newv), "-y") - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - fmt.Printf(" => Running: %s -to %d -y\n", migrateBin, newv) - - err = cmd.Run() - if err != nil { - fmt.Printf(" => Failed: %s -to %d -y\n", migrateBin, newv) - return fmt.Errorf("migration failed: %s", err) - } - - fmt.Printf(" => Success: fs-repo has been migrated to version %d.\n", newv) - - return nil -} - -func GetMigrations() (string, error) { - latest, err := GetLatestVersion(DistPath, migrations) - if err != nil { - return "", fmt.Errorf("failed to find latest fs-repo-migrations: %s", err) - } - - dir, err := ioutil.TempDir("", "go-ipfs-migrate") - if err != nil { - return "", fmt.Errorf("failed to create fs-repo-migrations tempdir: %s", err) - } - - out := filepath.Join(dir, migrationsBinName()) - - err = GetBinaryForVersion(migrations, migrations, DistPath, latest, out) - if err != nil { - return "", fmt.Errorf("failed to download latest fs-repo-migrations: %s", err) - } - - err = os.Chmod(out, 0755) - if err != nil { - return "", err - } - - return out, nil -} - -func verifyMigrationSupportsVersion(fsrbin string, vn int) error { - sn, err := migrationsVersion(fsrbin) - if err != nil { - return err - } - - if sn >= vn { - return nil - } - - return fmt.Errorf("migrations binary doesnt support version %d: %s", vn, fsrbin) -} - -func migrationsVersion(bin string) (int, error) { - out, err := exec.Command(bin, "-v").CombinedOutput() - if err != nil { - return 0, fmt.Errorf("failed to check migrations version: %s", err) - } - - vs := strings.Trim(string(out), " \n\t") - vn, err := strconv.Atoi(vs) - if err != nil { - return 0, fmt.Errorf("migrations binary version check did not return a number: %s", err) - } - - return vn, nil -} - -func GetVersions(ipfspath, dist string) ([]string, error) { - rc, err := httpFetch(ipfspath + "/" + dist + "/versions") - if err != nil { - return nil, err - } - defer rc.Close() - - var out []string - scan := bufio.NewScanner(rc) - for scan.Scan() { - out = append(out, scan.Text()) - } - - return out, nil -} - -func GetLatestVersion(ipfspath, dist string) (string, error) { - vs, err := GetVersions(ipfspath, dist) - if err != nil { - return "", err - } - var latest string - for i := len(vs) - 1; i >= 0; i-- { - if !strings.Contains(vs[i], "-dev") { - latest = vs[i] - break - } - } - if latest == "" { - return "", fmt.Errorf("couldnt find a non dev version in the list") - } - return vs[len(vs)-1], nil -} - -func httpGet(url string) (*http.Response, error) { - req, err := http.NewRequest("GET", url, nil) - if err != nil { - return nil, fmt.Errorf("http.NewRequest error: %s", err) - } - - req.Header.Set("User-Agent", "go-ipfs") - - resp, err := http.DefaultClient.Do(req) - if err != nil { - return nil, fmt.Errorf("http.DefaultClient.Do error: %s", err) - } - - return resp, nil -} - -func httpFetch(url string) (io.ReadCloser, error) { - resp, err := httpGet(url) - if err != nil { - return nil, err - } - - if resp.StatusCode >= 400 { - mes, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error reading error body: %s", err) - } - - return nil, fmt.Errorf("GET %s error: %s: %s", url, resp.Status, string(mes)) - } - - return resp.Body, nil -} - -func GetBinaryForVersion(distname, binnom, root, vers, out string) error { - dir, err := ioutil.TempDir("", "go-ipfs-auto-migrate") - if err != nil { - return err - } - - var archive string - switch runtime.GOOS { - case "windows": - archive = "zip" - binnom += ".exe" - default: - archive = "tar.gz" - } - osv, err := osWithVariant() - if err != nil { - return err - } - finame := fmt.Sprintf("%s_%s_%s-%s.%s", distname, vers, osv, runtime.GOARCH, archive) - distpath := fmt.Sprintf("%s/%s/%s/%s", root, distname, vers, finame) - - data, err := httpFetch(distpath) - if err != nil { - return err - } - - arcpath := filepath.Join(dir, finame) - fi, err := os.Create(arcpath) - if err != nil { - return err - } - - _, err = io.Copy(fi, data) - if err != nil { - return err - } - fi.Close() - - return unpackArchive(distname, binnom, arcpath, out, archive) -} - -// osWithVariant returns the OS name with optional variant. -// Currently returns either runtime.GOOS, or "linux-musl". -func osWithVariant() (string, error) { - if runtime.GOOS != "linux" { - return runtime.GOOS, nil - } - - // ldd outputs the system's kind of libc. - // - on standard ubuntu: ldd (Ubuntu GLIBC 2.23-0ubuntu5) 2.23 - // - on alpine: musl libc (x86_64) - // - // we use the combined stdout+stderr, - // because ldd --version prints differently on different OSes. - // - on standard ubuntu: stdout - // - on alpine: stderr (it probably doesn't know the --version flag) - // - // we suppress non-zero exit codes (see last point about alpine). - out, err := exec.Command("sh", "-c", "ldd --version || true").CombinedOutput() - if err != nil { - return "", err - } - - // now just see if we can find "musl" somewhere in the output - scan := bufio.NewScanner(bytes.NewBuffer(out)) - for scan.Scan() { - if strings.Contains(scan.Text(), "musl") { - return "linux-musl", nil - } - } - - return "linux", nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/unpack.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/unpack.go deleted file mode 100644 index 5b563071..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/migrations/unpack.go +++ /dev/null @@ -1,98 +0,0 @@ -package mfsr - -import ( - "archive/tar" - "archive/zip" - "compress/gzip" - "fmt" - "io" - "os" -) - -func unpackArchive(dist, binnom, path, out, atype string) error { - switch atype { - case "zip": - return unpackZip(dist, binnom, path, out) - case "tar.gz": - return unpackTgz(dist, binnom, path, out) - default: - return fmt.Errorf("unrecognized archive type: %s", atype) - } -} - -func unpackTgz(dist, binnom, path, out string) error { - fi, err := os.Open(path) - if err != nil { - return err - } - defer fi.Close() - - gzr, err := gzip.NewReader(fi) - if err != nil { - return err - } - - defer gzr.Close() - - var bin io.Reader - tarr := tar.NewReader(gzr) - -loop: - for { - th, err := tarr.Next() - switch err { - default: - return err - case io.EOF: - break loop - case nil: - // continue - } - - if th.Name == dist+"/"+binnom { - bin = tarr - break - } - } - - if bin == nil { - return fmt.Errorf("no binary found in downloaded archive") - } - - return writeToPath(bin, out) -} - -func writeToPath(rc io.Reader, out string) error { - binfi, err := os.Create(out) - if err != nil { - return fmt.Errorf("error opening tmp bin path '%s': %s", out, err) - } - defer binfi.Close() - - _, err = io.Copy(binfi, rc) - - return err -} - -func unpackZip(dist, binnom, path, out string) error { - zipr, err := zip.OpenReader(path) - if err != nil { - return fmt.Errorf("error opening zipreader: %s", err) - } - - defer zipr.Close() - - var bin io.ReadCloser - for _, fis := range zipr.File { - if fis.Name == dist+"/"+binnom { - rc, err := fis.Open() - if err != nil { - return fmt.Errorf("error extracting binary from archive: %s", err) - } - - bin = rc - } - } - - return writeToPath(bin, out) -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/misc.go b/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/misc.go deleted file mode 100644 index 7f0c0164..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/fsrepo/misc.go +++ /dev/null @@ -1,23 +0,0 @@ -package fsrepo - -import ( - "os" - - config "github.com/ipfs/go-ipfs-config" - homedir "github.com/mitchellh/go-homedir" -) - -// BestKnownPath returns the best known fsrepo path. If the ENV override is -// present, this function returns that value. Otherwise, it returns the default -// repo path. -func BestKnownPath() (string, error) { - ipfsPath := config.DefaultPathRoot - if os.Getenv(config.EnvDir) != "" { - ipfsPath = os.Getenv(config.EnvDir) - } - ipfsPath, err := homedir.Expand(ipfsPath) - if err != nil { - return "", err - } - return ipfsPath, nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/mock.go b/vendor/github.com/ipfs/go-ipfs/repo/mock.go deleted file mode 100644 index 78ec9073..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/mock.go +++ /dev/null @@ -1,58 +0,0 @@ -package repo - -import ( - "errors" - - filestore "github.com/ipfs/go-ipfs/filestore" - keystore "github.com/ipfs/go-ipfs/keystore" - - config "github.com/ipfs/go-ipfs-config" - ma "github.com/multiformats/go-multiaddr" -) - -var errTODO = errors.New("TODO: mock repo") - -// Mock is not thread-safe -type Mock struct { - C config.Config - D Datastore - K keystore.Keystore - F *filestore.FileManager -} - -func (m *Mock) Config() (*config.Config, error) { - return &m.C, nil // FIXME threadsafety -} - -func (m *Mock) SetConfig(updated *config.Config) error { - m.C = *updated // FIXME threadsafety - return nil -} - -func (m *Mock) BackupConfig(prefix string) (string, error) { - return "", errTODO -} - -func (m *Mock) SetConfigKey(key string, value interface{}) error { - return errTODO -} - -func (m *Mock) GetConfigKey(key string) (interface{}, error) { - return nil, errTODO -} - -func (m *Mock) Datastore() Datastore { return m.D } - -func (m *Mock) GetStorageUsage() (uint64, error) { return 0, nil } - -func (m *Mock) Close() error { return errTODO } - -func (m *Mock) SetAPIAddr(addr ma.Multiaddr) error { return errTODO } - -func (m *Mock) Keystore() keystore.Keystore { return m.K } - -func (m *Mock) SwarmKey() ([]byte, error) { - return nil, nil -} - -func (m *Mock) FileManager() *filestore.FileManager { return m.F } diff --git a/vendor/github.com/ipfs/go-ipfs/repo/onlyone.go b/vendor/github.com/ipfs/go-ipfs/repo/onlyone.go deleted file mode 100644 index 860c166b..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/onlyone.go +++ /dev/null @@ -1,72 +0,0 @@ -package repo - -import ( - "sync" -) - -// OnlyOne tracks open Repos by arbitrary key and returns the already -// open one. -type OnlyOne struct { - mu sync.Mutex - active map[interface{}]*ref -} - -// Open a Repo identified by key. If Repo is not already open, the -// open function is called, and the result is remember for further -// use. -// -// Key must be comparable, or Open will panic. Make sure to pick keys -// that are unique across different concrete Repo implementations, -// e.g. by creating a local type: -// -// type repoKey string -// r, err := o.Open(repoKey(path), open) -// -// Call Repo.Close when done. -func (o *OnlyOne) Open(key interface{}, open func() (Repo, error)) (Repo, error) { - o.mu.Lock() - defer o.mu.Unlock() - if o.active == nil { - o.active = make(map[interface{}]*ref) - } - - item, found := o.active[key] - if !found { - repo, err := open() - if err != nil { - return nil, err - } - item = &ref{ - parent: o, - key: key, - Repo: repo, - } - o.active[key] = item - } - item.refs++ - return item, nil -} - -type ref struct { - parent *OnlyOne - key interface{} - refs uint32 - Repo -} - -var _ Repo = (*ref)(nil) - -func (r *ref) Close() error { - r.parent.mu.Lock() - defer r.parent.mu.Unlock() - - r.refs-- - if r.refs > 0 { - // others are holding it open - return nil - } - - // last one - delete(r.parent.active, r.key) - return r.Repo.Close() -} diff --git a/vendor/github.com/ipfs/go-ipfs/repo/repo.go b/vendor/github.com/ipfs/go-ipfs/repo/repo.go deleted file mode 100644 index ffb024af..00000000 --- a/vendor/github.com/ipfs/go-ipfs/repo/repo.go +++ /dev/null @@ -1,63 +0,0 @@ -package repo - -import ( - "errors" - "io" - - filestore "github.com/ipfs/go-ipfs/filestore" - keystore "github.com/ipfs/go-ipfs/keystore" - - ds "github.com/ipfs/go-datastore" - config "github.com/ipfs/go-ipfs-config" - ma "github.com/multiformats/go-multiaddr" -) - -var ( - ErrApiNotRunning = errors.New("api not running") -) - -// Repo represents all persistent data of a given ipfs node. -type Repo interface { - // Config returns the ipfs configuration file from the repo. Changes made - // to the returned config are not automatically persisted. - Config() (*config.Config, error) - - // BackupConfig creates a backup of the current configuration file using - // the given prefix for naming. - BackupConfig(prefix string) (string, error) - - // SetConfig persists the given configuration struct to storage. - SetConfig(*config.Config) error - - // SetConfigKey sets the given key-value pair within the config and persists it to storage. - SetConfigKey(key string, value interface{}) error - - // GetConfigKey reads the value for the given key from the configuration in storage. - GetConfigKey(key string) (interface{}, error) - - // Datastore returns a reference to the configured data storage backend. - Datastore() Datastore - - // GetStorageUsage returns the number of bytes stored. - GetStorageUsage() (uint64, error) - - // Keystore returns a reference to the key management interface. - Keystore() keystore.Keystore - - // FileManager returns a reference to the filestore file manager. - FileManager() *filestore.FileManager - - // SetAPIAddr sets the API address in the repo. - SetAPIAddr(addr ma.Multiaddr) error - - // SwarmKey returns the configured shared symmetric key for the private networks feature. - SwarmKey() ([]byte, error) - - io.Closer -} - -// Datastore is the interface required from a datastore to be -// acceptable to FSRepo. -type Datastore interface { - ds.Batching // must be thread-safe -} diff --git a/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-sleep/LICENSE b/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-sleep/LICENSE deleted file mode 100644 index 7a6cf794..00000000 --- a/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-sleep/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet -Copyright (c) 2015 Christian Couder - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-timeout/LICENSE b/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-timeout/LICENSE deleted file mode 100644 index 5c30e8cc..00000000 --- a/vendor/github.com/ipfs/go-ipfs/test/dependencies/go-timeout/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jakub "Kubuxu" Sztandera - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/github.com/ipfs/go-ipfs/test/dependencies/ma-pipe-unidir/LICENSE b/vendor/github.com/ipfs/go-ipfs/test/dependencies/ma-pipe-unidir/LICENSE deleted file mode 100644 index e1159e5d..00000000 --- a/vendor/github.com/ipfs/go-ipfs/test/dependencies/ma-pipe-unidir/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Łukasz Magiera - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/github.com/ipfs/go-ipfs/thirdparty/cidv0v1/blockstore.go b/vendor/github.com/ipfs/go-ipfs/thirdparty/cidv0v1/blockstore.go deleted file mode 100644 index 2f098dff..00000000 --- a/vendor/github.com/ipfs/go-ipfs/thirdparty/cidv0v1/blockstore.go +++ /dev/null @@ -1,87 +0,0 @@ -package cidv0v1 - -import ( - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - bs "github.com/ipfs/go-ipfs-blockstore" - mh "github.com/multiformats/go-multihash" -) - -type blockstore struct { - bs.Blockstore -} - -func NewBlockstore(b bs.Blockstore) bs.Blockstore { - return &blockstore{b} -} - -func (b *blockstore) Has(c cid.Cid) (bool, error) { - have, err := b.Blockstore.Has(c) - if have || err != nil { - return have, err - } - c1 := tryOtherCidVersion(c) - if !c1.Defined() { - return false, nil - } - return b.Blockstore.Has(c1) -} - -func (b *blockstore) Get(c cid.Cid) (blocks.Block, error) { - block, err := b.Blockstore.Get(c) - if err == nil { - return block, nil - } - if err != bs.ErrNotFound { - return nil, err - } - c1 := tryOtherCidVersion(c) - if !c1.Defined() { - return nil, bs.ErrNotFound - } - block, err = b.Blockstore.Get(c1) - if err != nil { - return nil, err - } - // modify block so it has the original CID - block, err = blocks.NewBlockWithCid(block.RawData(), c) - if err != nil { - return nil, err - } - // insert the block with the original CID to avoid problems - // with pinning - err = b.Blockstore.Put(block) - if err != nil { - return nil, err - } - return block, nil -} - -func (b *blockstore) GetSize(c cid.Cid) (int, error) { - size, err := b.Blockstore.GetSize(c) - if err == nil { - return size, nil - } - if err != bs.ErrNotFound { - return -1, err - } - c1 := tryOtherCidVersion(c) - if !c1.Defined() { - return -1, bs.ErrNotFound - } - return b.Blockstore.GetSize(c1) -} - -func tryOtherCidVersion(c cid.Cid) cid.Cid { - prefix := c.Prefix() - if prefix.Codec != cid.DagProtobuf || prefix.MhType != mh.SHA2_256 || prefix.MhLength != 32 { - return cid.Undef - } - var c1 cid.Cid - if prefix.Version == 0 { - c1 = cid.NewCidV1(cid.DagProtobuf, c.Hash()) - } else { - c1 = cid.NewCidV0(c.Hash()) - } - return c1 -} diff --git a/vendor/github.com/ipfs/go-ipfs/thirdparty/dir/dir.go b/vendor/github.com/ipfs/go-ipfs/thirdparty/dir/dir.go deleted file mode 100644 index 1549cc80..00000000 --- a/vendor/github.com/ipfs/go-ipfs/thirdparty/dir/dir.go +++ /dev/null @@ -1,25 +0,0 @@ -package dir - -// TODO move somewhere generic - -import ( - "errors" - "os" - "path/filepath" -) - -// Writable ensures the directory exists and is writable -func Writable(path string) error { - // Construct the path if missing - if err := os.MkdirAll(path, os.ModePerm); err != nil { - return err - } - // Check the directory is writable - if f, err := os.Create(filepath.Join(path, "._check_writable")); err == nil { - f.Close() - os.Remove(f.Name()) - } else { - return errors.New("'" + path + "' is not writable") - } - return nil -} diff --git a/vendor/github.com/ipfs/go-ipfs/thirdparty/verifbs/verifbs.go b/vendor/github.com/ipfs/go-ipfs/thirdparty/verifbs/verifbs.go deleted file mode 100644 index 53b6d13c..00000000 --- a/vendor/github.com/ipfs/go-ipfs/thirdparty/verifbs/verifbs.go +++ /dev/null @@ -1,62 +0,0 @@ -package verifbs - -import ( - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - bstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/ipfs/go-verifcid" -) - -type VerifBSGC struct { - bstore.GCBlockstore -} - -func (bs *VerifBSGC) Put(b blocks.Block) error { - if err := verifcid.ValidateCid(b.Cid()); err != nil { - return err - } - return bs.GCBlockstore.Put(b) -} - -func (bs *VerifBSGC) PutMany(blks []blocks.Block) error { - for _, b := range blks { - if err := verifcid.ValidateCid(b.Cid()); err != nil { - return err - } - } - return bs.GCBlockstore.PutMany(blks) -} - -func (bs *VerifBSGC) Get(c cid.Cid) (blocks.Block, error) { - if err := verifcid.ValidateCid(c); err != nil { - return nil, err - } - return bs.GCBlockstore.Get(c) -} - -type VerifBS struct { - bstore.Blockstore -} - -func (bs *VerifBS) Put(b blocks.Block) error { - if err := verifcid.ValidateCid(b.Cid()); err != nil { - return err - } - return bs.Blockstore.Put(b) -} - -func (bs *VerifBS) PutMany(blks []blocks.Block) error { - for _, b := range blks { - if err := verifcid.ValidateCid(b.Cid()); err != nil { - return err - } - } - return bs.Blockstore.PutMany(blks) -} - -func (bs *VerifBS) Get(c cid.Cid) (blocks.Block, error) { - if err := verifcid.ValidateCid(c); err != nil { - return nil, err - } - return bs.Blockstore.Get(c) -} diff --git a/vendor/github.com/ipfs/go-ipfs/version.go b/vendor/github.com/ipfs/go-ipfs/version.go deleted file mode 100644 index 5257125e..00000000 --- a/vendor/github.com/ipfs/go-ipfs/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package ipfs - -// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile -var CurrentCommit string - -// CurrentVersionNumber is the current application's version literal -const CurrentVersionNumber = "0.4.22-dev" - -const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/" diff --git a/vendor/github.com/ipfs/go-ipld-cbor/.travis.yml b/vendor/github.com/ipfs/go-ipld-cbor/.travis.yml deleted file mode 100644 index 923835bc..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipld-cbor/LICENSE b/vendor/github.com/ipfs/go-ipld-cbor/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipld-cbor/Makefile b/vendor/github.com/ipfs/go-ipld-cbor/Makefile deleted file mode 100644 index 7811c099..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -covertools: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -deps: gx covertools - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-ipld-cbor/README.md b/vendor/github.com/ipfs/go-ipld-cbor/README.md deleted file mode 100644 index 0cec10cc..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/README.md +++ /dev/null @@ -1,54 +0,0 @@ -go-ipld-cbor -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-floodsub/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-floodsub?branch=master) -[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-floodsub.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-floodsub) - -> An implementation of a cbor encoded merkledag object. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Usage - -TODO: Right now this package isn't the easiest to use, it will be getting better rapidly, soon. -```go -// Make an object -obj := map[interface{}]interface{}{ - "foo": "bar", - "baz": &Link{ - Target: myCid, - }, -} - -// Parse it into an ipldcbor node -nd, err := WrapMap(obj) - -fmt.Println(nd.Links()) - -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson diff --git a/vendor/github.com/ipfs/go-ipld-cbor/codecov.yml b/vendor/github.com/ipfs/go-ipld-cbor/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-ipld-cbor/encoding/cloner.go b/vendor/github.com/ipfs/go-ipld-cbor/encoding/cloner.go deleted file mode 100644 index 0a04a3c2..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/encoding/cloner.go +++ /dev/null @@ -1,33 +0,0 @@ -package encoding - -import ( - "sync" - - refmt "github.com/polydawn/refmt" - "github.com/polydawn/refmt/obj/atlas" -) - -// PooledCloner is a thread-safe pooled object cloner. -type PooledCloner struct { - pool sync.Pool -} - -// NewPooledCloner returns a PooledCloner with the given atlas. Do not copy -// after use. -func NewPooledCloner(atl atlas.Atlas) PooledCloner { - return PooledCloner{ - pool: sync.Pool{ - New: func() interface{} { - return refmt.NewCloner(atl) - }, - }, - } -} - -// Clone clones a into b using a cloner from the pool. -func (p *PooledCloner) Clone(a, b interface{}) error { - c := p.pool.Get().(refmt.Cloner) - err := c.Clone(a, b) - p.pool.Put(c) - return err -} diff --git a/vendor/github.com/ipfs/go-ipld-cbor/encoding/marshaller.go b/vendor/github.com/ipfs/go-ipld-cbor/encoding/marshaller.go deleted file mode 100644 index f4fe84be..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/encoding/marshaller.go +++ /dev/null @@ -1,82 +0,0 @@ -package encoding - -import ( - "bytes" - "io" - "sync" - - cbor "github.com/polydawn/refmt/cbor" - "github.com/polydawn/refmt/obj/atlas" -) - -type proxyWriter struct { - w io.Writer -} - -func (w *proxyWriter) Write(b []byte) (int, error) { - return w.w.Write(b) -} - -// Marshaller is a reusbale CBOR marshaller. -type Marshaller struct { - marshal *cbor.Marshaller - writer proxyWriter -} - -// NewMarshallerAtlased constructs a new cbor Marshaller using the given atlas. -func NewMarshallerAtlased(atl atlas.Atlas) *Marshaller { - m := new(Marshaller) - m.marshal = cbor.NewMarshallerAtlased(&m.writer, atl) - return m -} - -// Encode encodes the given object to the given writer. -func (m *Marshaller) Encode(obj interface{}, w io.Writer) error { - m.writer.w = w - err := m.marshal.Marshal(obj) - m.writer.w = nil - return err -} - -// Marshal marshels the given object to a byte slice. -func (m *Marshaller) Marshal(obj interface{}) ([]byte, error) { - var buf bytes.Buffer - if err := m.Encode(obj, &buf); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -// PooledMarshaller is a thread-safe pooled CBOR marshaller. -type PooledMarshaller struct { - pool sync.Pool -} - -// NewPooledMarshaller returns a PooledMarshaller with the given atlas. Do not -// copy after use. -func NewPooledMarshaller(atl atlas.Atlas) PooledMarshaller { - return PooledMarshaller{ - pool: sync.Pool{ - New: func() interface{} { - return NewMarshallerAtlased(atl) - }, - }, - } -} - -// Marshal marshals the passed object using the pool of marshallers. -func (p *PooledMarshaller) Marshal(obj interface{}) ([]byte, error) { - m := p.pool.Get().(*Marshaller) - bts, err := m.Marshal(obj) - p.pool.Put(m) - return bts, err -} - -// Encode encodes the passed object to the given writer using the pool of -// marshallers. -func (p *PooledMarshaller) Encode(obj interface{}, w io.Writer) error { - m := p.pool.Get().(*Marshaller) - err := m.Encode(obj, w) - p.pool.Put(m) - return err -} diff --git a/vendor/github.com/ipfs/go-ipld-cbor/encoding/unmarshaller.go b/vendor/github.com/ipfs/go-ipld-cbor/encoding/unmarshaller.go deleted file mode 100644 index 2561dd79..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/encoding/unmarshaller.go +++ /dev/null @@ -1,79 +0,0 @@ -package encoding - -import ( - "bytes" - "io" - "sync" - - cbor "github.com/polydawn/refmt/cbor" - "github.com/polydawn/refmt/obj/atlas" -) - -type proxyReader struct { - r io.Reader -} - -func (r *proxyReader) Read(b []byte) (int, error) { - return r.r.Read(b) -} - -// Unmarshaller is a reusable CBOR unmarshaller. -type Unmarshaller struct { - unmarshal *cbor.Unmarshaller - reader proxyReader -} - -// NewUnmarshallerAtlased creates a new reusable unmarshaller. -func NewUnmarshallerAtlased(atl atlas.Atlas) *Unmarshaller { - m := new(Unmarshaller) - m.unmarshal = cbor.NewUnmarshallerAtlased(cbor.DecodeOptions{CoerceUndefToNull: true}, &m.reader, atl) - return m -} - -// Decode reads a CBOR object from the given reader and decodes it into the -// given object. -func (m *Unmarshaller) Decode(r io.Reader, obj interface{}) error { - m.reader.r = r - err := m.unmarshal.Unmarshal(obj) - m.reader.r = nil - return err -} - -// Unmarshal unmarshals the given CBOR byte slice into the given object. -func (m *Unmarshaller) Unmarshal(b []byte, obj interface{}) error { - return m.Decode(bytes.NewReader(b), obj) -} - -// PooledUnmarshaller is a thread-safe pooled CBOR unmarshaller. -type PooledUnmarshaller struct { - pool sync.Pool -} - -// NewPooledUnmarshaller returns a PooledUnmarshaller with the given atlas. Do -// not copy after use. -func NewPooledUnmarshaller(atl atlas.Atlas) PooledUnmarshaller { - return PooledUnmarshaller{ - pool: sync.Pool{ - New: func() interface{} { - return NewUnmarshallerAtlased(atl) - }, - }, - } -} - -// Decode decodes an object from the passed reader into the given object using -// the pool of unmarshallers. -func (p *PooledUnmarshaller) Decode(r io.Reader, obj interface{}) error { - u := p.pool.Get().(*Unmarshaller) - err := u.Decode(r, obj) - p.pool.Put(u) - return err -} - -// Unmarshal unmarshals the passed object using the pool of unmarshallers. -func (p *PooledUnmarshaller) Unmarshal(b []byte, obj interface{}) error { - u := p.pool.Get().(*Unmarshaller) - err := u.Unmarshal(b, obj) - p.pool.Put(u) - return err -} diff --git a/vendor/github.com/ipfs/go-ipld-cbor/go.mod b/vendor/github.com/ipfs/go-ipld-cbor/go.mod deleted file mode 100644 index 80f8c276..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/ipfs/go-ipld-cbor - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-ipld-format v0.0.1 - github.com/multiformats/go-multihash v0.0.1 - github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 - github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect - github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 // indirect -) diff --git a/vendor/github.com/ipfs/go-ipld-cbor/go.sum b/vendor/github.com/ipfs/go-ipld-cbor/go.sum deleted file mode 100644 index 94987205..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/go.sum +++ /dev/null @@ -1,42 +0,0 @@ -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -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/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipld-cbor/node.go b/vendor/github.com/ipfs/go-ipld-cbor/node.go deleted file mode 100644 index 4a30cc3a..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/node.go +++ /dev/null @@ -1,541 +0,0 @@ -package cbornode - -import ( - "encoding/json" - "errors" - "io" - "math" - "strconv" - "strings" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" -) - -// CBORTagLink is the integer used to represent tags in CBOR. -const CBORTagLink = 42 - -// Node represents an IPLD node. -type Node struct { - obj interface{} - tree []string - links []*node.Link - raw []byte - cid cid.Cid -} - -// Compile time check to make sure Node implements the node.Node interface -var _ node.Node = (*Node)(nil) - -var ( - // ErrNoSuchLink is returned when no link with the given name was found. - ErrNoSuchLink = errors.New("no such link found") - ErrNonLink = errors.New("non-link found at given path") - ErrInvalidLink = errors.New("link value should have been bytes") - ErrInvalidKeys = errors.New("map keys must be strings") - ErrArrayOutOfRange = errors.New("array index out of range") - ErrNoLinks = errors.New("tried to resolve through object that had no links") - ErrEmptyLink = errors.New("link value was empty") - ErrInvalidMultibase = errors.New("invalid multibase on IPLD link") - ErrNonStringLink = errors.New("link should have been a string") -) - -// DecodeBlock decodes a CBOR encoded Block into an IPLD Node. -// -// This method *does not* canonicalize and *will* preserve the CID. As a matter -// of fact, it will assume that `block.Cid()` returns the correct CID and will -// make no effort to validate this assumption. -// -// In general, you should not be calling this method directly. Instead, you -// should be calling the `Decode` method from the `go-ipld-format` package. That -// method will pick the right decoder based on the Block's CID. -// -// Note: This function keeps a reference to `block` and assumes that it is -// immutable. -func DecodeBlock(block blocks.Block) (node.Node, error) { - return decodeBlock(block) -} - -func decodeBlock(block blocks.Block) (*Node, error) { - var m interface{} - if err := DecodeInto(block.RawData(), &m); err != nil { - return nil, err - } - return newObject(block, m) -} - -func newObject(block blocks.Block, m interface{}) (*Node, error) { - tree, links, err := compute(m) - if err != nil { - return nil, err - } - - return &Node{ - obj: m, - tree: tree, - links: links, - raw: block.RawData(), - cid: block.Cid(), - }, nil -} - -var _ node.DecodeBlockFunc = DecodeBlock - -// Decode decodes a CBOR object into an IPLD Node. -// -// If passed a non-canonical CBOR node, this function will canonicalize it. -// Therefore, `bytes.Equal(b, Decode(b).RawData())` may not hold. If you already -// have a CID for this data and want to ensure that it doesn't change, you -// should use `DecodeBlock`. -// mhType is multihash code to use for hashing, for example mh.SHA2_256 -// -// Note: This function does not hold onto `b`. You may reuse it. -func Decode(b []byte, mhType uint64, mhLen int) (*Node, error) { - var m interface{} - if err := DecodeInto(b, &m); err != nil { - return nil, err - } - - // We throw away `b` here to ensure that we canonicalize the encoded - // CBOR object. - return WrapObject(m, mhType, mhLen) -} - -// DecodeInto decodes a serialized IPLD cbor object into the given object. -func DecodeInto(b []byte, v interface{}) error { - return unmarshaller.Unmarshal(b, v) -} - -// WrapObject converts an arbitrary object into a Node. -func WrapObject(m interface{}, mhType uint64, mhLen int) (*Node, error) { - data, err := marshaller.Marshal(m) - if err != nil { - return nil, err - } - - var obj interface{} - err = cloner.Clone(m, &obj) - if err != nil { - return nil, err - } - - if mhType == math.MaxUint64 { - mhType = mh.SHA2_256 - } - - hash, err := mh.Sum(data, mhType, mhLen) - if err != nil { - return nil, err - } - c := cid.NewCidV1(cid.DagCBOR, hash) - - block, err := blocks.NewBlockWithCid(data, c) - if err != nil { - // TODO: Shouldn't this just panic? - return nil, err - } - // No need to deserialize. We can just deep copy. - return newObject(block, obj) -} - -// Resolve resolves a given path, and returns the object found at the end, as well -// as the possible tail of the path that was not resolved. -func (n *Node) Resolve(path []string) (interface{}, []string, error) { - var cur interface{} = n.obj - for i, val := range path { - switch curv := cur.(type) { - case map[string]interface{}: - next, ok := curv[val] - if !ok { - return nil, nil, ErrNoSuchLink - } - - cur = next - case map[interface{}]interface{}: - next, ok := curv[val] - if !ok { - return nil, nil, ErrNoSuchLink - } - - cur = next - case []interface{}: - n, err := strconv.Atoi(val) - if err != nil { - return nil, nil, err - } - - if n < 0 || n >= len(curv) { - return nil, nil, ErrArrayOutOfRange - } - - cur = curv[n] - case cid.Cid: - return &node.Link{Cid: curv}, path[i:], nil - default: - return nil, nil, ErrNoLinks - } - } - - lnk, ok := cur.(cid.Cid) - if ok { - return &node.Link{Cid: lnk}, nil, nil - } - - jsonish, err := convertToJSONIsh(cur) - if err != nil { - return nil, nil, err - } - - return jsonish, nil, nil -} - -// Copy creates a copy of the Node. -func (n *Node) Copy() node.Node { - links := make([]*node.Link, len(n.links)) - copy(links, n.links) - - raw := make([]byte, len(n.raw)) - copy(raw, n.raw) - - tree := make([]string, len(n.tree)) - copy(tree, n.tree) - - return &Node{ - obj: copyObj(n.obj), - links: links, - raw: raw, - tree: tree, - cid: n.cid, - } -} - -func copyObj(i interface{}) interface{} { - switch i := i.(type) { - case map[string]interface{}: - out := make(map[string]interface{}) - for k, v := range i { - out[k] = copyObj(v) - } - return out - case map[interface{}]interface{}: - out := make(map[interface{}]interface{}) - for k, v := range i { - out[k] = copyObj(v) - } - return out - case []interface{}: - var out []interface{} - for _, v := range i { - out = append(out, copyObj(v)) - } - return out - default: - // TODO: do not be lazy - // being lazy for now - // use caution - return i - } -} - -// ResolveLink resolves a path and returns the raw Link at the end, as well as -// the possible tail of the path that was not resolved. -func (n *Node) ResolveLink(path []string) (*node.Link, []string, error) { - obj, rest, err := n.Resolve(path) - if err != nil { - return nil, nil, err - } - - lnk, ok := obj.(*node.Link) - if !ok { - return nil, rest, ErrNonLink - } - - return lnk, rest, nil -} - -// Tree returns a flattend array of paths at the given path for the given depth. -func (n *Node) Tree(path string, depth int) []string { - if path == "" && depth == -1 { - return n.tree - } - - var out []string - for _, t := range n.tree { - if !strings.HasPrefix(t, path) { - continue - } - - sub := strings.TrimLeft(t[len(path):], "/") - if sub == "" { - continue - } - - if depth < 0 { - out = append(out, sub) - continue - } - - parts := strings.Split(sub, "/") - if len(parts) <= depth { - out = append(out, sub) - } - } - return out -} - -func compute(obj interface{}) (tree []string, links []*node.Link, err error) { - err = traverse(obj, "", func(name string, val interface{}) error { - if name != "" { - tree = append(tree, name[1:]) - } - if lnk, ok := val.(cid.Cid); ok { - links = append(links, &node.Link{Cid: lnk}) - } - return nil - }) - if err != nil { - return nil, nil, err - } - - return tree, links, nil -} - -// Links lists all known links of the Node. -func (n *Node) Links() []*node.Link { - return n.links -} - -func traverse(obj interface{}, cur string, cb func(string, interface{}) error) error { - if err := cb(cur, obj); err != nil { - return err - } - - switch obj := obj.(type) { - case map[string]interface{}: - for k, v := range obj { - this := cur + "/" + k - if err := traverse(v, this, cb); err != nil { - return err - } - } - return nil - case map[interface{}]interface{}: - for k, v := range obj { - ks, ok := k.(string) - if !ok { - return errors.New("map key was not a string") - } - this := cur + "/" + ks - if err := traverse(v, this, cb); err != nil { - return err - } - } - return nil - case []interface{}: - for i, v := range obj { - this := cur + "/" + strconv.Itoa(i) - if err := traverse(v, this, cb); err != nil { - return err - } - } - return nil - default: - return nil - } -} - -// RawData returns the raw bytes that represent the Node as serialized CBOR. -func (n *Node) RawData() []byte { - return n.raw -} - -// Cid returns the canonical Cid of the NOde. -func (n *Node) Cid() cid.Cid { - return n.cid -} - -// Loggable returns a loggable representation of the Node. -func (n *Node) Loggable() map[string]interface{} { - return map[string]interface{}{ - "node_type": "cbor", - "cid": n.Cid(), - } -} - -// Size returns the size of the binary representation of the Node. -func (n *Node) Size() (uint64, error) { - return uint64(len(n.RawData())), nil -} - -// Stat returns stats about the Node. -// TODO: implement? -func (n *Node) Stat() (*node.NodeStat, error) { - return &node.NodeStat{}, nil -} - -// String returns the string representation of the CID of the Node. -func (n *Node) String() string { - return n.Cid().String() -} - -// MarshalJSON converts the Node into its JSON representation. -func (n *Node) MarshalJSON() ([]byte, error) { - out, err := convertToJSONIsh(n.obj) - if err != nil { - return nil, err - } - - return json.Marshal(out) -} - -// DumpObject marshals any object into its CBOR serialized byte representation -// TODO: rename -func DumpObject(obj interface{}) (out []byte, err error) { - return marshaller.Marshal(obj) -} - -func toSaneMap(n map[interface{}]interface{}) (interface{}, error) { - if lnk, ok := n["/"]; ok && len(n) == 1 { - lnkb, ok := lnk.([]byte) - if !ok { - return nil, ErrInvalidLink - } - - c, err := cid.Cast(lnkb) - if err != nil { - return nil, err - } - - return map[string]interface{}{"/": c}, nil - } - out := make(map[string]interface{}) - for k, v := range n { - ks, ok := k.(string) - if !ok { - return nil, ErrInvalidKeys - } - - obj, err := convertToJSONIsh(v) - if err != nil { - return nil, err - } - - out[ks] = obj - } - - return out, nil -} - -func convertToJSONIsh(v interface{}) (interface{}, error) { - switch v := v.(type) { - case map[interface{}]interface{}: - return toSaneMap(v) - case []interface{}: - var out []interface{} - if len(v) == 0 && v != nil { - return []interface{}{}, nil - } - for _, i := range v { - obj, err := convertToJSONIsh(i) - if err != nil { - return nil, err - } - - out = append(out, obj) - } - return out, nil - default: - return v, nil - } -} - -// FromJSON converts incoming JSON into a Node. -func FromJSON(r io.Reader, mhType uint64, mhLen int) (*Node, error) { - var m interface{} - err := json.NewDecoder(r).Decode(&m) - if err != nil { - return nil, err - } - - obj, err := convertToCborIshObj(m) - if err != nil { - return nil, err - } - - return WrapObject(obj, mhType, mhLen) -} - -func convertToCborIshObj(i interface{}) (interface{}, error) { - switch v := i.(type) { - case map[string]interface{}: - if len(v) == 0 && v != nil { - return v, nil - } - - if lnk, ok := v["/"]; ok && len(v) == 1 { - // special case for links - vstr, ok := lnk.(string) - if !ok { - return nil, ErrNonStringLink - } - - return cid.Decode(vstr) - } - - for a, b := range v { - val, err := convertToCborIshObj(b) - if err != nil { - return nil, err - } - - v[a] = val - } - return v, nil - case []interface{}: - if len(v) == 0 && v != nil { - return v, nil - } - - var out []interface{} - for _, o := range v { - obj, err := convertToCborIshObj(o) - if err != nil { - return nil, err - } - - out = append(out, obj) - } - - return out, nil - default: - return v, nil - } -} - -func castBytesToCid(x []byte) (cid.Cid, error) { - if len(x) == 0 { - return cid.Cid{}, ErrEmptyLink - } - - // TODO: manually doing multibase checking here since our deps don't - // support binary multibase yet - if x[0] != 0 { - return cid.Cid{}, ErrInvalidMultibase - } - - c, err := cid.Cast(x[1:]) - if err != nil { - return cid.Cid{}, ErrInvalidLink - } - - return c, nil -} - -func castCidToBytes(link cid.Cid) ([]byte, error) { - if !link.Defined() { - return nil, ErrEmptyLink - } - return append([]byte{0}, link.Bytes()...), nil -} diff --git a/vendor/github.com/ipfs/go-ipld-cbor/readable.go b/vendor/github.com/ipfs/go-ipld-cbor/readable.go deleted file mode 100644 index cc9d03fa..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/readable.go +++ /dev/null @@ -1,33 +0,0 @@ -package cbornode - -import ( - "bufio" - "bytes" - - cbor "github.com/polydawn/refmt/cbor" - "github.com/polydawn/refmt/pretty" - "github.com/polydawn/refmt/shared" -) - -//HumanReadable returns a string representation of a CBOR blob -func HumanReadable(blob []byte) (string, error) { - reader := bytes.NewReader(blob) - - var buf bytes.Buffer - writer := bufio.NewWriter(&buf) - - err := shared.TokenPump{ - TokenSource: cbor.NewDecoder(cbor.DecodeOptions{}, reader), - TokenSink: pretty.NewEncoder(writer), - }.Run() - - if err != nil { - return "", err - } - - if err = writer.Flush(); err != nil { - return "", err - } - - return buf.String(), nil -} diff --git a/vendor/github.com/ipfs/go-ipld-cbor/refmt.go b/vendor/github.com/ipfs/go-ipld-cbor/refmt.go deleted file mode 100644 index e8bd7ded..00000000 --- a/vendor/github.com/ipfs/go-ipld-cbor/refmt.go +++ /dev/null @@ -1,72 +0,0 @@ -package cbornode - -import ( - "math/big" - - cid "github.com/ipfs/go-cid" - - encoding "github.com/ipfs/go-ipld-cbor/encoding" - - "github.com/polydawn/refmt/obj/atlas" -) - -// This atlas describes the CBOR Tag (42) for IPLD links, such that refmt can marshal and unmarshal them -var cidAtlasEntry = atlas.BuildEntry(cid.Cid{}). - UseTag(CBORTagLink). - Transform(). - TransformMarshal(atlas.MakeMarshalTransformFunc( - castCidToBytes, - )). - TransformUnmarshal(atlas.MakeUnmarshalTransformFunc( - castBytesToCid, - )). - Complete() - -// BigIntAtlasEntry gives a reasonable default encoding for big.Int. It is not -// included in the entries by default. -var BigIntAtlasEntry = atlas.BuildEntry(big.Int{}).Transform(). - TransformMarshal(atlas.MakeMarshalTransformFunc( - func(i big.Int) ([]byte, error) { - return i.Bytes(), nil - })). - TransformUnmarshal(atlas.MakeUnmarshalTransformFunc( - func(x []byte) (big.Int, error) { - return *big.NewInt(0).SetBytes(x), nil - })). - Complete() - -// CborAtlas is the refmt.Atlas used by the CBOR IPLD decoder/encoder. -var CborAtlas atlas.Atlas -var cborSortingMode = atlas.KeySortMode_RFC7049 -var atlasEntries = []*atlas.AtlasEntry{cidAtlasEntry} - -var ( - cloner encoding.PooledCloner - unmarshaller encoding.PooledUnmarshaller - marshaller encoding.PooledMarshaller -) - -func init() { - rebuildAtlas() -} - -func rebuildAtlas() { - CborAtlas = atlas.MustBuild(atlasEntries...). - WithMapMorphism(atlas.MapMorphism{KeySortMode: atlas.KeySortMode_RFC7049}) - - marshaller = encoding.NewPooledMarshaller(CborAtlas) - unmarshaller = encoding.NewPooledUnmarshaller(CborAtlas) - cloner = encoding.NewPooledCloner(CborAtlas) -} - -// RegisterCborType allows to register a custom cbor type -func RegisterCborType(i interface{}) { - var entry *atlas.AtlasEntry - if ae, ok := i.(*atlas.AtlasEntry); ok { - entry = ae - } else { - entry = atlas.BuildEntry(i).StructMap().AutogenerateWithSortingScheme(atlas.KeySortMode_RFC7049).Complete() - } - atlasEntries = append(atlasEntries, entry) - rebuildAtlas() -} diff --git a/vendor/github.com/ipfs/go-ipld-format/.travis.yml b/vendor/github.com/ipfs/go-ipld-format/.travis.yml deleted file mode 100644 index ba87d9a8..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.12.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipld-format/LICENSE b/vendor/github.com/ipfs/go-ipld-format/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-ipld-format/Makefile b/vendor/github.com/ipfs/go-ipld-format/Makefile deleted file mode 100644 index 7811c099..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -covertools: - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -deps: gx covertools - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-ipld-format/README.md b/vendor/github.com/ipfs/go-ipld-format/README.md deleted file mode 100644 index 7a2ccffa..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/README.md +++ /dev/null @@ -1,35 +0,0 @@ -go-ipld-format -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-ipld-format/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipld-format/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-ipld-format.svg?branch=master)](https://travis-ci.org/ipfs/go-ipld-format) - -> go-ipld-format is a set of interfaces that a type needs to implement in order to be a part of the ipld merkle-forest. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson diff --git a/vendor/github.com/ipfs/go-ipld-format/batch.go b/vendor/github.com/ipfs/go-ipld-format/batch.go deleted file mode 100644 index dc879d5f..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/batch.go +++ /dev/null @@ -1,295 +0,0 @@ -package format - -import ( - "context" - "errors" - "runtime" - - cid "github.com/ipfs/go-cid" -) - -// ParallelBatchCommits is the number of batch commits that can be in-flight before blocking. -// TODO(ipfs/go-ipfs#4299): Experiment with multiple datastores, storage -// devices, and CPUs to find the right value/formula. -var ParallelBatchCommits = runtime.NumCPU() * 2 - -// ErrNotCommited is returned when closing a batch that hasn't been successfully -// committed. -var ErrNotCommited = errors.New("error: batch not commited") - -// ErrClosed is returned when operating on a batch that has already been closed. -var ErrClosed = errors.New("error: batch closed") - -// NewBatch returns a node buffer (Batch) that buffers nodes internally and -// commits them to the underlying DAGService in batches. Use this if you intend -// to add or remove a lot of nodes all at once. -// -// If the passed context is canceled, any in-progress commits are aborted. -// -func NewBatch(ctx context.Context, na NodeAdder, opts ...BatchOption) *Batch { - ctx, cancel := context.WithCancel(ctx) - bopts := defaultBatchOptions - for _, o := range opts { - o(&bopts) - } - return &Batch{ - na: na, - ctx: ctx, - cancel: cancel, - commitResults: make(chan error, ParallelBatchCommits), - opts: bopts, - } -} - -// Batch is a buffer for batching adds to a dag. -type Batch struct { - na NodeAdder - - ctx context.Context - cancel func() - - activeCommits int - err error - commitResults chan error - - nodes []Node - size int - - opts batchOptions -} - -func (t *Batch) processResults() { - for t.activeCommits > 0 { - select { - case err := <-t.commitResults: - t.activeCommits-- - if err != nil { - t.setError(err) - return - } - default: - return - } - } -} - -func (t *Batch) asyncCommit() { - numBlocks := len(t.nodes) - if numBlocks == 0 { - return - } - if t.activeCommits >= ParallelBatchCommits { - select { - case err := <-t.commitResults: - t.activeCommits-- - - if err != nil { - t.setError(err) - return - } - case <-t.ctx.Done(): - t.setError(t.ctx.Err()) - return - } - } - go func(ctx context.Context, b []Node, result chan error, na NodeAdder) { - select { - case result <- na.AddMany(ctx, b): - case <-ctx.Done(): - } - }(t.ctx, t.nodes, t.commitResults, t.na) - - t.activeCommits++ - t.nodes = make([]Node, 0, numBlocks) - t.size = 0 - - return -} - -// Add adds a node to the batch and commits the batch if necessary. -func (t *Batch) Add(ctx context.Context, nd Node) error { - return t.AddMany(ctx, []Node{nd}) -} - -// AddMany many calls Add for every given Node, thus batching and -// commiting them as needed. -func (t *Batch) AddMany(ctx context.Context, nodes []Node) error { - if t.err != nil { - return t.err - } - // Not strictly necessary but allows us to catch errors early. - t.processResults() - - if t.err != nil { - return t.err - } - - t.nodes = append(t.nodes, nodes...) - for _, nd := range nodes { - t.size += len(nd.RawData()) - } - - if t.size > t.opts.maxSize || len(t.nodes) > t.opts.maxNodes { - t.asyncCommit() - } - return t.err -} - -// Commit commits batched nodes. -func (t *Batch) Commit() error { - if t.err != nil { - return t.err - } - - t.asyncCommit() - -loop: - for t.activeCommits > 0 { - select { - case err := <-t.commitResults: - t.activeCommits-- - if err != nil { - t.setError(err) - break loop - } - case <-t.ctx.Done(): - t.setError(t.ctx.Err()) - break loop - } - } - - return t.err -} - -func (t *Batch) setError(err error) { - t.err = err - - t.cancel() - - // Drain as much as we can without blocking. -loop: - for { - select { - case <-t.commitResults: - default: - break loop - } - } - - // Be nice and cleanup. These can take a *lot* of memory. - t.commitResults = nil - t.na = nil - t.ctx = nil - t.nodes = nil - t.size = 0 - t.activeCommits = 0 -} - -// BatchOption provides a way of setting internal options of -// a Batch. -// -// See this post about the "functional options" pattern: -// http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis -type BatchOption func(o *batchOptions) - -type batchOptions struct { - maxSize int - maxNodes int -} - -var defaultBatchOptions = batchOptions{ - maxSize: 8 << 20, - - // By default, only batch up to 128 nodes at a time. - // The current implementation of flatfs opens this many file - // descriptors at the same time for the optimized batch write. - maxNodes: 128, -} - -// MaxSizeBatchOption sets the maximum size of a Batch. -func MaxSizeBatchOption(size int) BatchOption { - return func(o *batchOptions) { - o.maxSize = size - } -} - -// MaxNodesBatchOption sets the maximum number of nodes in a Batch. -func MaxNodesBatchOption(num int) BatchOption { - return func(o *batchOptions) { - o.maxNodes = num - } -} - -// BufferedDAG implements DAGService using a Batch NodeAdder to wrap add -// operations in the given DAGService. It will trigger Commit() before any -// non-Add operations, but otherwise calling Commit() is left to the user. -type BufferedDAG struct { - ds DAGService - b *Batch -} - -// NewBufferedDAG creates a BufferedDAG using the given DAGService and the -// given options for the Batch NodeAdder. -func NewBufferedDAG(ctx context.Context, ds DAGService, opts ...BatchOption) *BufferedDAG { - return &BufferedDAG{ - ds: ds, - b: NewBatch(ctx, ds, opts...), - } -} - -// Commit calls commit on the Batch. -func (bd *BufferedDAG) Commit() error { - return bd.b.Commit() -} - -// Add adds a new node using Batch. -func (bd *BufferedDAG) Add(ctx context.Context, n Node) error { - return bd.b.Add(ctx, n) -} - -// AddMany adds many nodes using Batch. -func (bd *BufferedDAG) AddMany(ctx context.Context, nds []Node) error { - return bd.b.AddMany(ctx, nds) -} - -// Get commits and gets a node from the DAGService. -func (bd *BufferedDAG) Get(ctx context.Context, c cid.Cid) (Node, error) { - err := bd.b.Commit() - if err != nil { - return nil, err - } - return bd.ds.Get(ctx, c) -} - -// GetMany commits and gets nodes from the DAGService. -func (bd *BufferedDAG) GetMany(ctx context.Context, cs []cid.Cid) <-chan *NodeOption { - err := bd.b.Commit() - if err != nil { - ch := make(chan *NodeOption, 1) - defer close(ch) - ch <- &NodeOption{ - Node: nil, - Err: err, - } - return ch - } - return bd.ds.GetMany(ctx, cs) -} - -// Remove commits and removes a node from the DAGService. -func (bd *BufferedDAG) Remove(ctx context.Context, c cid.Cid) error { - err := bd.b.Commit() - if err != nil { - return err - } - return bd.ds.Remove(ctx, c) -} - -// RemoveMany commits and removes nodes from the DAGService. -func (bd *BufferedDAG) RemoveMany(ctx context.Context, cs []cid.Cid) error { - err := bd.b.Commit() - if err != nil { - return err - } - return bd.ds.RemoveMany(ctx, cs) -} diff --git a/vendor/github.com/ipfs/go-ipld-format/codecov.yml b/vendor/github.com/ipfs/go-ipld-format/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-ipld-format/coding.go b/vendor/github.com/ipfs/go-ipld-format/coding.go deleted file mode 100644 index e202f75a..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/coding.go +++ /dev/null @@ -1,62 +0,0 @@ -package format - -import ( - "fmt" - "sync" - - blocks "github.com/ipfs/go-block-format" -) - -// DecodeBlockFunc functions decode blocks into nodes. -type DecodeBlockFunc func(block blocks.Block) (Node, error) - -type BlockDecoder interface { - Register(codec uint64, decoder DecodeBlockFunc) - Decode(blocks.Block) (Node, error) -} -type safeBlockDecoder struct { - // Can be replaced with an RCU if necessary. - lock sync.RWMutex - decoders map[uint64]DecodeBlockFunc -} - -// Register registers decoder for all blocks with the passed codec. -// -// This will silently replace any existing registered block decoders. -func (d *safeBlockDecoder) Register(codec uint64, decoder DecodeBlockFunc) { - d.lock.Lock() - defer d.lock.Unlock() - d.decoders[codec] = decoder -} - -func (d *safeBlockDecoder) Decode(block blocks.Block) (Node, error) { - // Short-circuit by cast if we already have a Node. - if node, ok := block.(Node); ok { - return node, nil - } - - ty := block.Cid().Type() - - d.lock.RLock() - decoder, ok := d.decoders[ty] - d.lock.RUnlock() - - if ok { - return decoder(block) - } else { - // TODO: get the *long* name for this format - return nil, fmt.Errorf("unrecognized object type: %d", ty) - } -} - -var DefaultBlockDecoder BlockDecoder = &safeBlockDecoder{decoders: make(map[uint64]DecodeBlockFunc)} - -// Decode decodes the given block using the default BlockDecoder. -func Decode(block blocks.Block) (Node, error) { - return DefaultBlockDecoder.Decode(block) -} - -// Register registers block decoders with the default BlockDecoder. -func Register(codec uint64, decoder DecodeBlockFunc) { - DefaultBlockDecoder.Register(codec, decoder) -} diff --git a/vendor/github.com/ipfs/go-ipld-format/daghelpers.go b/vendor/github.com/ipfs/go-ipld-format/daghelpers.go deleted file mode 100644 index 70ad0b91..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/daghelpers.go +++ /dev/null @@ -1,118 +0,0 @@ -package format - -import ( - "context" - - cid "github.com/ipfs/go-cid" -) - -// GetLinks returns the CIDs of the children of the given node. Prefer this -// method over looking up the node itself and calling `Links()` on it as this -// method may be able to use a link cache. -func GetLinks(ctx context.Context, ng NodeGetter, c cid.Cid) ([]*Link, error) { - if c.Type() == cid.Raw { - return nil, nil - } - if gl, ok := ng.(LinkGetter); ok { - return gl.GetLinks(ctx, c) - } - node, err := ng.Get(ctx, c) - if err != nil { - return nil, err - } - return node.Links(), nil -} - -// GetDAG will fill out all of the links of the given Node. -// It returns an array of NodePromise with the linked nodes all in the proper -// order. -func GetDAG(ctx context.Context, ds NodeGetter, root Node) []*NodePromise { - var cids []cid.Cid - for _, lnk := range root.Links() { - cids = append(cids, lnk.Cid) - } - - return GetNodes(ctx, ds, cids) -} - -// GetNodes returns an array of 'FutureNode' promises, with each corresponding -// to the key with the same index as the passed in keys -func GetNodes(ctx context.Context, ds NodeGetter, keys []cid.Cid) []*NodePromise { - - // Early out if no work to do - if len(keys) == 0 { - return nil - } - - promises := make([]*NodePromise, len(keys)) - for i := range keys { - promises[i] = NewNodePromise(ctx) - } - - dedupedKeys := dedupeKeys(keys) - go func() { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - nodechan := ds.GetMany(ctx, dedupedKeys) - - for count := 0; count < len(keys); { - select { - case opt, ok := <-nodechan: - if !ok { - for _, p := range promises { - p.Fail(ErrNotFound) - } - return - } - - if opt.Err != nil { - for _, p := range promises { - p.Fail(opt.Err) - } - return - } - - nd := opt.Node - c := nd.Cid() - for i, lnk_c := range keys { - if c.Equals(lnk_c) { - count++ - promises[i].Send(nd) - } - } - case <-ctx.Done(): - return - } - } - }() - return promises -} - -func Copy(ctx context.Context, from, to DAGService, root cid.Cid) error { - node, err := from.Get(ctx, root) - if err != nil { - return err - } - links := node.Links() - for _, link := range links { - err := Copy(ctx, from, to, link.Cid) - if err != nil { - return err - } - } - err = to.Add(ctx, node) - if err != nil { - return err - } - return nil -} - -// Remove duplicates from a list of keys -func dedupeKeys(cids []cid.Cid) []cid.Cid { - set := cid.NewSet() - for _, c := range cids { - set.Add(c) - } - return set.Keys() -} diff --git a/vendor/github.com/ipfs/go-ipld-format/format.go b/vendor/github.com/ipfs/go-ipld-format/format.go deleted file mode 100644 index 990e1ce0..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/format.go +++ /dev/null @@ -1,90 +0,0 @@ -package format - -import ( - "context" - "fmt" - - blocks "github.com/ipfs/go-block-format" - - cid "github.com/ipfs/go-cid" -) - -type Resolver interface { - // Resolve resolves a path through this node, stopping at any link boundary - // and returning the object found as well as the remaining path to traverse - Resolve(path []string) (interface{}, []string, error) - - // Tree lists all paths within the object under 'path', and up to the given depth. - // To list the entire object (similar to `find .`) pass "" and -1 - Tree(path string, depth int) []string -} - -// Node is the base interface all IPLD nodes must implement. -// -// Nodes are **Immutable** and all methods defined on the interface are -// **Thread Safe**. -type Node interface { - blocks.Block - Resolver - - // ResolveLink is a helper function that calls resolve and asserts the - // output is a link - ResolveLink(path []string) (*Link, []string, error) - - // Copy returns a deep copy of this node - Copy() Node - - // Links is a helper function that returns all links within this object - Links() []*Link - - // TODO: not sure if stat deserves to stay - Stat() (*NodeStat, error) - - // Size returns the size in bytes of the serialized object - Size() (uint64, error) -} - -// Link represents an IPFS Merkle DAG Link between Nodes. -type Link struct { - // utf string name. should be unique per object - Name string // utf8 - - // cumulative size of target object - Size uint64 - - // multihash of the target object - Cid cid.Cid -} - -// NodeStat is a statistics object for a Node. Mostly sizes. -type NodeStat struct { - Hash string - NumLinks int // number of links in link table - BlockSize int // size of the raw, encoded data - LinksSize int // size of the links segment - DataSize int // size of the data segment - CumulativeSize int // cumulative size of object and its references -} - -func (ns NodeStat) String() string { - f := "NodeStat{NumLinks: %d, BlockSize: %d, LinksSize: %d, DataSize: %d, CumulativeSize: %d}" - return fmt.Sprintf(f, ns.NumLinks, ns.BlockSize, ns.LinksSize, ns.DataSize, ns.CumulativeSize) -} - -// MakeLink creates a link to the given node -func MakeLink(n Node) (*Link, error) { - s, err := n.Size() - if err != nil { - return nil, err - } - - return &Link{ - Size: s, - Cid: n.Cid(), - }, nil -} - -// GetNode returns the MDAG Node that this link points to -func (l *Link) GetNode(ctx context.Context, serv NodeGetter) (Node, error) { - return serv.Get(ctx, l.Cid) -} diff --git a/vendor/github.com/ipfs/go-ipld-format/go.mod b/vendor/github.com/ipfs/go-ipld-format/go.mod deleted file mode 100644 index f56c4536..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/ipfs/go-ipld-format - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.2 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipld-format/go.sum b/vendor/github.com/ipfs/go-ipld-format/go.sum deleted file mode 100644 index 79b1fea1..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/go.sum +++ /dev/null @@ -1,28 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipld-format/merkledag.go b/vendor/github.com/ipfs/go-ipld-format/merkledag.go deleted file mode 100644 index 755b90f6..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/merkledag.go +++ /dev/null @@ -1,67 +0,0 @@ -package format - -import ( - "context" - "fmt" - - cid "github.com/ipfs/go-cid" -) - -var ErrNotFound = fmt.Errorf("merkledag: not found") - -// Either a node or an error. -type NodeOption struct { - Node Node - Err error -} - -// The basic Node resolution service. -type NodeGetter interface { - // Get retrieves nodes by CID. Depending on the NodeGetter - // implementation, this may involve fetching the Node from a remote - // machine; consider setting a deadline in the context. - Get(context.Context, cid.Cid) (Node, error) - - // GetMany returns a channel of NodeOptions given a set of CIDs. - GetMany(context.Context, []cid.Cid) <-chan *NodeOption -} - -// NodeAdder adds nodes to a DAG. -type NodeAdder interface { - // Add adds a node to this DAG. - Add(context.Context, Node) error - - // AddMany adds many nodes to this DAG. - // - // Consider using the Batch NodeAdder (`NewBatch`) if you make - // extensive use of this function. - AddMany(context.Context, []Node) error -} - -// NodeGetters can optionally implement this interface to make finding linked -// objects faster. -type LinkGetter interface { - NodeGetter - - // TODO(ipfs/go-ipld-format#9): This should return []cid.Cid - - // GetLinks returns the children of the node refered to by the given - // CID. - GetLinks(ctx context.Context, nd cid.Cid) ([]*Link, error) -} - -// DAGService is an IPFS Merkle DAG service. -type DAGService interface { - NodeGetter - NodeAdder - - // Remove removes a node from this DAG. - // - // Remove returns no error if the requested node is not present in this DAG. - Remove(context.Context, cid.Cid) error - - // RemoveMany removes many nodes from this DAG. - // - // It returns success even if the nodes were not present in the DAG. - RemoveMany(context.Context, []cid.Cid) error -} diff --git a/vendor/github.com/ipfs/go-ipld-format/navipld.go b/vendor/github.com/ipfs/go-ipld-format/navipld.go deleted file mode 100644 index 12986737..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/navipld.go +++ /dev/null @@ -1,149 +0,0 @@ -package format - -import ( - "context" - - cid "github.com/ipfs/go-cid" -) - -// NavigableIPLDNode implements the `NavigableNode` interface wrapping -// an IPLD `Node` and providing support for node promises. -type NavigableIPLDNode struct { - node Node - - // The CID of each child of the node. - childCIDs []cid.Cid - - // Node promises for child nodes requested. - childPromises []*NodePromise - // TODO: Consider encapsulating it in a single structure alongside `childCIDs`. - - nodeGetter NodeGetter - // TODO: Should this be stored in the `Walker`'s context to avoid passing - // it along to every node? It seems like a structure that doesn't need - // to be replicated (the entire DAG will use the same `NodeGetter`). -} - -// NewNavigableIPLDNode returns a `NavigableIPLDNode` wrapping the provided -// `node`. -func NewNavigableIPLDNode(node Node, nodeGetter NodeGetter) *NavigableIPLDNode { - nn := &NavigableIPLDNode{ - node: node, - nodeGetter: nodeGetter, - } - - nn.childCIDs = getLinkCids(node) - nn.childPromises = make([]*NodePromise, len(nn.childCIDs)) - - return nn -} - -// FetchChild implements the `NavigableNode` interface using node promises -// to preload the following child nodes to `childIndex` leaving them ready -// for subsequent `FetchChild` calls. -func (nn *NavigableIPLDNode) FetchChild(ctx context.Context, childIndex uint) (NavigableNode, error) { - // This function doesn't check that `childIndex` is valid, that's - // the `Walker` responsibility. - - // If we drop to <= preloadSize/2 preloading nodes, preload the next 10. - for i := childIndex; i < childIndex+preloadSize/2 && i < uint(len(nn.childPromises)); i++ { - // TODO: Check if canceled. - if nn.childPromises[i] == nil { - nn.preload(ctx, i) - break - } - } - - child, err := nn.getPromiseValue(ctx, childIndex) - - switch err { - case nil: - case context.DeadlineExceeded, context.Canceled: - if ctx.Err() != nil { - return nil, ctx.Err() - } - - // In this case, the context used to *preload* the node (in a previous - // `FetchChild` call) has been canceled. We need to retry the load with - // the current context and we might as well preload some extra nodes - // while we're at it. - nn.preload(ctx, childIndex) - child, err = nn.getPromiseValue(ctx, childIndex) - if err != nil { - return nil, err - } - default: - return nil, err - } - - return NewNavigableIPLDNode(child, nn.nodeGetter), nil -} - -// Number of nodes to preload every time a child is requested. -// TODO: Give more visibility to this constant, it could be an attribute -// set in the `Walker` context that gets passed in `FetchChild`. -const preloadSize = 10 - -// Preload at most `preloadSize` child nodes from `beg` through promises -// created using this `ctx`. -func (nn *NavigableIPLDNode) preload(ctx context.Context, beg uint) { - end := beg + preloadSize - if end >= uint(len(nn.childCIDs)) { - end = uint(len(nn.childCIDs)) - } - - copy(nn.childPromises[beg:], GetNodes(ctx, nn.nodeGetter, nn.childCIDs[beg:end])) -} - -// Fetch the actual node (this is the blocking part of the mechanism) -// and invalidate the promise. `preload` should always be called first -// for the `childIndex` being fetch. -// -// TODO: Include `preload` into the beginning of this function? -// (And collapse the two calls in `FetchChild`). -func (nn *NavigableIPLDNode) getPromiseValue(ctx context.Context, childIndex uint) (Node, error) { - value, err := nn.childPromises[childIndex].Get(ctx) - nn.childPromises[childIndex] = nil - return value, err -} - -// Get the CID of all the links of this `node`. -func getLinkCids(node Node) []cid.Cid { - links := node.Links() - out := make([]cid.Cid, 0, len(links)) - - for _, l := range links { - out = append(out, l.Cid) - } - return out -} - -// GetIPLDNode returns the IPLD `Node` wrapped into this structure. -func (nn *NavigableIPLDNode) GetIPLDNode() Node { - return nn.node -} - -// ChildTotal implements the `NavigableNode` returning the number -// of links (of child nodes) in this node. -func (nn *NavigableIPLDNode) ChildTotal() uint { - return uint(len(nn.GetIPLDNode().Links())) -} - -// ExtractIPLDNode is a helper function that takes a `NavigableNode` -// and returns the IPLD `Node` wrapped inside. Used in the `Visitor` -// function. -// TODO: Check for errors to avoid a panic? -func ExtractIPLDNode(node NavigableNode) Node { - return node.(*NavigableIPLDNode).GetIPLDNode() -} - -// TODO: `Cleanup` is not supported at the moment in the `Walker`. -// -// Called in `Walker.up()` when the node is not part of the path anymore. -//func (nn *NavigableIPLDNode) Cleanup() { -// // TODO: Ideally this would be the place to issue a context `cancel()` -// // but since the DAG reader uses multiple contexts in the same session -// // (through `Read` and `CtxReadFull`) we would need to store an array -// // with the multiple contexts in `NavigableIPLDNode` with its corresponding -// // cancel functions. -//} diff --git a/vendor/github.com/ipfs/go-ipld-format/promise.go b/vendor/github.com/ipfs/go-ipld-format/promise.go deleted file mode 100644 index 02743b03..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/promise.go +++ /dev/null @@ -1,66 +0,0 @@ -package format - -import ( - "context" -) - -// NodePromise provides a promise like interface for a dag Node -// the first call to Get will block until the Node is received -// from its internal channels, subsequent calls will return the -// cached node. -// -// Thread Safety: This is multiple-consumer/single-producer safe. -func NewNodePromise(ctx context.Context) *NodePromise { - return &NodePromise{ - done: make(chan struct{}), - ctx: ctx, - } -} - -type NodePromise struct { - value Node - err error - done chan struct{} - - ctx context.Context -} - -// Call this function to fail a promise. -// -// Once a promise has been failed or fulfilled, further attempts to fail it will -// be silently dropped. -func (np *NodePromise) Fail(err error) { - if np.err != nil || np.value != nil { - // Already filled. - return - } - np.err = err - close(np.done) -} - -// Fulfill this promise. -// -// Once a promise has been fulfilled or failed, calling this function will -// panic. -func (np *NodePromise) Send(nd Node) { - // if promise has a value, don't fail it - if np.err != nil || np.value != nil { - panic("already filled") - } - np.value = nd - close(np.done) -} - -// Get the value of this promise. -// -// This function is safe to call concurrently from any number of goroutines. -func (np *NodePromise) Get(ctx context.Context) (Node, error) { - select { - case <-np.done: - return np.value, np.err - case <-np.ctx.Done(): - return nil, np.ctx.Err() - case <-ctx.Done(): - return nil, ctx.Err() - } -} diff --git a/vendor/github.com/ipfs/go-ipld-format/walker.go b/vendor/github.com/ipfs/go-ipld-format/walker.go deleted file mode 100644 index 81380936..00000000 --- a/vendor/github.com/ipfs/go-ipld-format/walker.go +++ /dev/null @@ -1,436 +0,0 @@ -package format - -import ( - "context" - "errors" -) - -// Walker provides methods to move through a DAG of nodes that implement -// the `NavigableNode` interface. It uses iterative algorithms (instead -// of recursive ones) that expose the `path` of nodes from the root to -// the `ActiveNode` it currently points to. -// -// It provides multiple ways to walk through the DAG (e.g. `Iterate` -// and `Seek`). When using them, you provide a Visitor function that -// will be called for each node the Walker traverses. The Visitor can -// read data from those nodes and, optionally, direct the movement of -// the Walker by calling `Pause` (to stop traversing and return) or -// `NextChild` (to skip a child and its descendants). See the DAG reader -// in `github.com/ipfs/go-unixfs/io/dagreader.go` for a usage example. -// TODO: This example isn't merged yet. -type Walker struct { - - // Sequence of nodes in the DAG from the root to the `ActiveNode`, each - // position in the slice being the parent of the next one. The `ActiveNode` - // resides in the position indexed by `currentDepth` (the slice may contain - // more elements past that point but they should be ignored since the slice - // is not truncated to leverage the already allocated space). - // - // Every time `down` is called the `currentDepth` increases and the child - // of the `ActiveNode` is inserted after it (effectively becoming the new - // `ActiveNode`). - // - // The slice must *always* have a length bigger than zero with the root - // of the DAG at the first position (empty DAGs are not valid). - path []NavigableNode - - // Depth of the `ActiveNode`. It grows downwards, root being 0, its child 1, - // and so on. It controls the effective length of `path` and `childIndex`. - // - // A currentDepth of -1 signals the start case of a new `Walker` that hasn't - // moved yet. Although this state is an invalid index to the slices, it - // allows to centralize all the visit calls in the `down` move (starting at - // zero would require a special visit case inside every walk operation like - // `Iterate()` and `Seek`). This value should never be returned to after - // the first `down` movement, moving up from the root should always return - // `errUpOnRoot`. - currentDepth int - - // This slice has the index of the child each node in `path` is pointing - // to. The child index in the node can be set past all of its child nodes - // (having a value equal to `ChildTotal`) to signal it has visited (or - // skipped) all of them. A leaf node with no children that has its index - // in zero would also comply with this format. - // - // Complement to `path`, not only do we need to know which nodes have been - // traversed to reach the `ActiveNode` but also which child nodes they are - // to correctly have the active path of the DAG. (Reword this paragraph.) - childIndex []uint - - // Flag to signal that a pause in the current walk operation has been - // requested by the user inside `Visitor`. - pauseRequested bool - - // Used to pass information from the central `Walker` structure to the - // distributed `NavigableNode`s (to have a centralized configuration - // structure to control the behavior of all of them), e.g., to tell - // the `NavigableIPLDNode` which context should be used to load node - // promises (but this could later be used in more elaborate ways). - ctx context.Context -} - -// `Walker` implementation details: -// -// The `Iterate` and `Seek` walk operations are implemented through two -// basic move methods `up` and `down`, that change which node is the -// `ActiveNode` (modifying the `path` that leads to it). The `NextChild` -// method allows to change which child the `ActiveNode` is pointing to -// in order to change the direction of the descent. -// -// The `down` method is the analogous of a recursive call and the one in -// charge of visiting (possible new) nodes (through `Visitor`) and performing -// some user-defined logic. A `Pause` method is available to interrupt the -// current walk operation after visiting a node. -// -// Key terms and concepts: -// * Walk operation (e.g., `Iterate`). -// * Move methods: `up` and `down`. -// * Active node. -// * Path to the active node. - -// Function called each time a node is arrived upon in a walk operation -// through the `down` method (not when going back `up`). It is the main -// API to implement DAG functionality (e.g., read and seek a file DAG) -// on top of the `Walker` structure. -// -// Its argument is the current `node` being visited (the `ActiveNode`). -// Any error it returns (apart from the internal `errPauseWalkOperation`) -// will be forwarded to the caller of the walk operation (pausing it). -// -// Any of the exported methods of this API should be allowed to be called -// from within this method, e.g., `NextChild`. -// TODO: Check that. Can `ResetPosition` be called without breaking -// the `Walker` integrity? -type Visitor func(node NavigableNode) error - -// NavigableNode is the interface the nodes of a DAG need to implement in -// order to be traversed by the `Walker`. -type NavigableNode interface { - - // FetchChild returns the child of this node pointed to by `childIndex`. - // A `Context` stored in the `Walker` is passed (`ctx`) that may contain - // configuration attributes stored by the user before initiating the - // walk operation. - FetchChild(ctx context.Context, childIndex uint) (NavigableNode, error) - - // ChildTotal returns the number of children of the `ActiveNode`. - ChildTotal() uint - - // TODO: Evaluate providing the `Cleanup` and `Reset` methods. - - // Cleanup is an optional method that is called by the `Walker` when - // this node leaves the active `path`, i.e., when this node is the - // `ActiveNode` and the `up` movement is called. - //Cleanup() - // Allow this method to return an error? That would imply - // modifying the `Walker` API, `up()` would now return an error - // different than `errUpOnRoot`. - - // Reset is an optional function that is called by the `Walker` when - // `ResetPosition` is called, it is only applied to the root node - // of the DAG. - //Reset() -} - -// NewWalker creates a new `Walker` structure from a `root` -// NavigableNode. -func NewWalker(ctx context.Context, root NavigableNode) *Walker { - return &Walker{ - ctx: ctx, - - path: []NavigableNode{root}, - childIndex: []uint{0}, - - currentDepth: -1, - // Starting position, "on top" of the root node, see `currentDepth`. - } -} - -// ActiveNode returns the `NavigableNode` that `Walker` is pointing -// to at the moment. It changes when `up` or `down` is called. -func (w *Walker) ActiveNode() NavigableNode { - return w.path[w.currentDepth] - // TODO: Add a check for the initial state of `currentDepth` -1? -} - -// ErrDownNoChild signals there is no child at `ActiveChildIndex` in the -// `ActiveNode` to go down to. -var ErrDownNoChild = errors.New("can't go down, the child does not exist") - -// errUpOnRoot signals the end of the DAG after returning to the root. -var errUpOnRoot = errors.New("can't go up, already on root") - -// EndOfDag wraps the `errUpOnRoot` and signals to the user that the -// entire DAG has been iterated. -var EndOfDag = errors.New("end of DAG") - -// ErrNextNoChild signals the end of this parent child nodes. -var ErrNextNoChild = errors.New("can't go to the next child, no more child nodes in this parent") - -// errPauseWalkOperation signals the pause of the walk operation. -var errPauseWalkOperation = errors.New("pause in the current walk operation") - -// ErrNilVisitor signals the lack of a `Visitor` function. -var ErrNilVisitor = errors.New("no Visitor function specified") - -// Iterate the DAG through the DFS pre-order walk algorithm, going down -// as much as possible, then `NextChild` to the other siblings, and then up -// (to go down again). The position is saved throughout iterations (and -// can be previously set in `Seek`) allowing `Iterate` to be called -// repeatedly (after a `Pause`) to continue the iteration. -// -// This function returns the errors received from `down` (generated either -// inside the `Visitor` call or any other errors while fetching the child -// nodes), the rest of the move errors are handled within the function and -// are not returned. -func (w *Walker) Iterate(visitor Visitor) error { - - // Iterate until either: the end of the DAG (`errUpOnRoot`), a `Pause` - // is requested (`errPauseWalkOperation`) or an error happens (while - // going down). - for { - - // First, go down as much as possible. - for { - err := w.down(visitor) - - if err == ErrDownNoChild { - break - // Can't keep going down from this node, try to move Next. - } - - if err == errPauseWalkOperation { - return nil - // Pause requested, `errPauseWalkOperation` is just an internal - // error to signal to pause, don't pass it along. - } - - if err != nil { - return err - // `down` is the only movement that can return *any* error. - } - } - - // Can't move down anymore, turn to the next child in the `ActiveNode` - // to go down a different path. If there are no more child nodes - // available, go back up. - for { - err := w.NextChild() - if err == nil { - break - // No error, it turned to the next child. Try to go down again. - } - - // It can't go Next (`ErrNextNoChild`), try to move up. - err = w.up() - if err != nil { - // Can't move up, on the root again (`errUpOnRoot`). - return EndOfDag - } - - // Moved up, try `NextChild` again. - } - - // Turned to the next child (after potentially many up moves), - // try going down again. - } -} - -// Seek a specific node in a downwards manner. The `Visitor` should be -// used to steer the seek selecting at each node which child will the -// seek continue to (extending the `path` in that direction) or pause it -// (if the desired node has been found). The seek always starts from -// the root. It modifies the position so it shouldn't be used in-between -// `Iterate` calls (it can be used to set the position *before* iterating). -// If the visitor returns any non-`nil` errors the seek will stop. -// -// TODO: The seek could be extended to seek from the current position. -// (Is there something in the logic that would prevent it at the moment?) -func (w *Walker) Seek(visitor Visitor) error { - - if visitor == nil { - return ErrNilVisitor - // Although valid, there is no point in calling `Seek` without - // any extra logic, it would just go down to the leftmost leaf, - // so this would probably be a user error. - } - - // Go down until it the desired node is found (that will be signaled - // pausing the seek with `errPauseWalkOperation`) or a leaf node is - // reached (end of the DAG). - for { - err := w.down(visitor) - - if err == errPauseWalkOperation { - return nil - // Found the node, `errPauseWalkOperation` is just an internal - // error to signal to pause, don't pass it along. - } - - if err == ErrDownNoChild { - return nil - // Can't keep going down from this node, either at a leaf node - // or the `Visitor` has moved the child index past the - // available index (probably because none indicated that the - // target node could be down from there). - } - - if err != nil { - return err - // `down()` is the only movement that can return *any* error. - } - } - // TODO: Copied from the first part of `Iterate()` (although conceptually - // different from it). Could this be encapsulated in a function to avoid - // repeating code? The way the pause signal is handled it wouldn't seem - // very useful: the `errPauseWalkOperation` needs to be processed at this - // depth to return from the function (and pause the seek, returning - // from another function here wouldn't cause it to stop). -} - -// Go down one level in the DAG to the child of the `ActiveNode` -// pointed to by `ActiveChildIndex` and perform some logic on it by -// through the user-specified `visitor`. -// -// This should always be the first move in any walk operation -// (to visit the root node and move the `currentDepth` away -// from the negative value). -func (w *Walker) down(visitor Visitor) error { - child, err := w.fetchChild() - if err != nil { - return err - } - - w.extendPath(child) - - return w.visitActiveNode(visitor) -} - -// Fetch the child from the `ActiveNode` through the `FetchChild` -// method of the `NavigableNode` interface. -func (w *Walker) fetchChild() (NavigableNode, error) { - if w.currentDepth == -1 { - // First time `down()` is called, `currentDepth` is -1, - // return the root node. Don't check available child nodes - // (as the `Walker` is not actually on any node just yet - // and `ActiveChildIndex` is of no use yet). - return w.path[0], nil - } - - // Check if the child to fetch exists. - if w.ActiveChildIndex() >= w.ActiveNode().ChildTotal() { - return nil, ErrDownNoChild - } - - return w.ActiveNode().FetchChild(w.ctx, w.ActiveChildIndex()) - - // TODO: Maybe call `extendPath` here and hide it away - // from `down`. -} - -// Increase the `currentDepth` and extend the `path` to the fetched -// `child` node (which now becomes the new `ActiveNode`) -func (w *Walker) extendPath(child NavigableNode) { - w.currentDepth++ - - // Extend the slices if needed (doubling its capacity). - if w.currentDepth >= len(w.path) { - w.path = append(w.path, make([]NavigableNode, len(w.path))...) - w.childIndex = append(w.childIndex, make([]uint, len(w.childIndex))...) - // TODO: Check the performance of this grow mechanism. - } - - // `child` now becomes the `ActiveNode()`. - w.path[w.currentDepth] = child - w.childIndex[w.currentDepth] = 0 -} - -// Call the `Visitor` on the `ActiveNode`. This function should only be -// called from `down`. This is a wrapper function to `Visitor` to process -// the `Pause` signal and do other minor checks (taking this logic away -// from `down`). -func (w *Walker) visitActiveNode(visitor Visitor) error { - if visitor == nil { - return nil - // No need to check `pauseRequested` as `Pause` should - // only be called from within the `Visitor`. - } - - err := visitor(w.ActiveNode()) - - if w.pauseRequested { - // If a pause was requested make sure an error is returned - // that will cause the current walk operation to return. If - // `Visitor` didn't return an error set an artificial one - // generated by the `Walker`. - if err == nil { - err = errPauseWalkOperation - } - - w.pauseRequested = false - } - - return err -} - -// Go up from the `ActiveNode`. The only possible error this method -// can return is to signal it's already at the root and can't go up. -func (w *Walker) up() error { - if w.currentDepth < 1 { - return errUpOnRoot - } - - w.currentDepth-- - - // w.ActiveNode().Cleanup() - // If `Cleanup` is supported this would be the place to call it. - - return nil -} - -// NextChild increases the child index of the `ActiveNode` to point -// to the next child (which may exist or may be the end of the available -// child nodes). -// -// This method doesn't change the `ActiveNode`, it just changes where -// is it pointing to next, it could be interpreted as "turn to the next -// child". -func (w *Walker) NextChild() error { - w.incrementActiveChildIndex() - - if w.ActiveChildIndex() == w.ActiveNode().ChildTotal() { - return ErrNextNoChild - // At the end of the available children, signal it. - } - - return nil -} - -// incrementActiveChildIndex increments the child index of the `ActiveNode` to -// point to the next child (if it exists) or to the position past all of -// the child nodes (`ChildTotal`) to signal that all of its children have -// been visited/skipped (if already at that last position, do nothing). -func (w *Walker) incrementActiveChildIndex() { - if w.ActiveChildIndex()+1 <= w.ActiveNode().ChildTotal() { - w.childIndex[w.currentDepth]++ - } -} - -// ActiveChildIndex returns the index of the child the `ActiveNode()` -// is pointing to. -func (w *Walker) ActiveChildIndex() uint { - return w.childIndex[w.currentDepth] -} - -// SetContext changes the internal `Walker` (that is provided to the -// `NavigableNode`s when calling `FetchChild`) with the one passed -// as argument. -func (w *Walker) SetContext(ctx context.Context) { - w.ctx = ctx -} - -// Pause the current walk operation. This function must be called from -// within the `Visitor` function. -func (w *Walker) Pause() { - w.pauseRequested = true -} diff --git a/vendor/github.com/ipfs/go-ipld-git/.travis.yml b/vendor/github.com/ipfs/go-ipld-git/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipld-git/README.md b/vendor/github.com/ipfs/go-ipld-git/README.md deleted file mode 100644 index db74e2bf..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/README.md +++ /dev/null @@ -1,99 +0,0 @@ -Git ipld format -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-ipld-git/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipld-git/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-ipld-git.svg?branch=master)](https://travis-ci.org/ipfs/go-ipld-git) - -> An ipld codec for git objects allowing path traversals across the git graph! - -Note: This is WIP and may not be an entirely correct parser. - -## Table of Contents - -- [Install](#install) -- [About](#about) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -go get github.com/ipfs/go-ipld-git -``` - -## About -This is an IPLD codec which handles git objects. Objects are transformed -into IPLD graph in the following way: - -* Commit: -```json -{ - "author": { - "date": "1503667703 +0200", - "email": "author@mail", - "name": "Author Name" - }, - "committer": { - "date": "1503667703 +0200", - "email": "author@mail", - "name": "Author Name" - }, - "message": "Commit Message\n", - "parents": [ - , , ... - ], - "tree": -} - -``` - -* Tag: -```json -{ - "message": "message\n", - "object": { - "/": "baf4bcfg3mbz3yj3njqyr3ifdaqyfv3prei6h6bq" - }, - "tag": "tagname", - "tagger": { - "date": "1503667703 +0200", - "email": "author@mail", - "name": "Author Name" - }, - "type": "commit" -} - -``` - -* Tree: -```json -{ - "file.name": { - "mode": "100664", - "hash": - }, - "directoryname": { - "mode": "40000", - "hash": - }, - ... -} -``` - - -* Blob: -```json -"\0'>" -``` -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson diff --git a/vendor/github.com/ipfs/go-ipld-git/blob.go b/vendor/github.com/ipfs/go-ipld-git/blob.go deleted file mode 100644 index 8a67b981..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/blob.go +++ /dev/null @@ -1,71 +0,0 @@ -package ipldgit - -import ( - "encoding/json" - "errors" - - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" -) - -type Blob struct { - rawData []byte - cid cid.Cid -} - -func (b *Blob) Cid() cid.Cid { - return b.cid -} - -func (b *Blob) Copy() node.Node { - nb := *b - return &nb -} - -func (b *Blob) Links() []*node.Link { - return nil -} - -func (b *Blob) Resolve(_ []string) (interface{}, []string, error) { - return nil, nil, errors.New("no such link") -} - -func (b *Blob) ResolveLink(_ []string) (*node.Link, []string, error) { - return nil, nil, errors.New("no such link") -} - -func (b *Blob) Loggable() map[string]interface{} { - return map[string]interface{}{ - "type": "git_blob", - } -} - -func (b *Blob) MarshalJSON() ([]byte, error) { - return json.Marshal(b.rawData) -} - -func (b *Blob) RawData() []byte { - return []byte(b.rawData) -} - -func (b *Blob) Size() (uint64, error) { - return uint64(len(b.rawData)), nil -} - -func (b *Blob) Stat() (*node.NodeStat, error) { - return &node.NodeStat{}, nil -} - -func (b *Blob) String() string { - return "[git blob]" -} - -func (b *Blob) Tree(p string, depth int) []string { - return nil -} - -func (b *Blob) GitSha() []byte { - return cidToSha(b.Cid()) -} - -var _ node.Node = (*Blob)(nil) diff --git a/vendor/github.com/ipfs/go-ipld-git/codecov.yml b/vendor/github.com/ipfs/go-ipld-git/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-ipld-git/commit.go b/vendor/github.com/ipfs/go-ipld-git/commit.go deleted file mode 100644 index 00b81e32..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/commit.go +++ /dev/null @@ -1,286 +0,0 @@ -package ipldgit - -import ( - "bytes" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "strconv" - "sync" - - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" -) - -type Commit struct { - DataSize string `json:"-"` - GitTree cid.Cid `json:"tree"` - Parents []cid.Cid `json:"parents"` - Message string `json:"message"` - Author *PersonInfo `json:"author"` - Committer *PersonInfo `json:"committer"` - Encoding string `json:"encoding,omitempty"` - Sig *GpgSig `json:"signature,omitempty"` - MergeTag []*MergeTag `json:"mergetag,omitempty"` - - // Other contains all the non-standard headers, such as 'HG:extra' - Other []string `json:"other,omitempty"` - - cid cid.Cid - - rawData []byte - rawDataOnce sync.Once -} - -type PersonInfo struct { - Name string - Email string - Date string - Timezone string -} - -func (pi *PersonInfo) MarshalJSON() ([]byte, error) { - return json.Marshal(map[string]string{ - "name": pi.Name, - "email": pi.Email, - "date": pi.Date + " " + pi.Timezone, - }) -} - -func (pi *PersonInfo) String() string { - f := "%s <%s>" - arg := []interface{}{pi.Name, pi.Email} - if pi.Date != "" { - f = f + " %s" - arg = append(arg, pi.Date) - } - - if pi.Timezone != "" { - f = f + " %s" - arg = append(arg, pi.Timezone) - } - return fmt.Sprintf(f, arg...) -} - -func (pi *PersonInfo) tree(name string, depth int) []string { - if depth == 1 { - return []string{name} - } - return []string{name + "/name", name + "/email", name + "/date"} -} - -func (pi *PersonInfo) resolve(p []string) (interface{}, []string, error) { - switch p[0] { - case "name": - return pi.Name, p[1:], nil - case "email": - return pi.Email, p[1:], nil - case "date": - return pi.Date + " " + pi.Timezone, p[1:], nil - default: - return nil, nil, errors.New("no such link") - } -} - -type MergeTag struct { - Object cid.Cid `json:"object"` - Type string `json:"type"` - Tag string `json:"tag"` - Tagger *PersonInfo `json:"tagger"` - Text string `json:"text"` -} - -type GpgSig struct { - Text string -} - -func (c *Commit) Cid() cid.Cid { - return c.cid -} - -func (c *Commit) Copy() node.Node { - nc := *c - return &nc -} - -func (c *Commit) Links() []*node.Link { - out := []*node.Link{ - {Cid: c.GitTree}, - } - - for _, p := range c.Parents { - out = append(out, &node.Link{Cid: p}) - } - return out -} - -func (c *Commit) Loggable() map[string]interface{} { - return map[string]interface{}{ - "type": "git_commit", - } -} - -func (c *Commit) RawData() []byte { - c.rawDataOnce.Do(func() { - buf := new(bytes.Buffer) - fmt.Fprintf(buf, "commit %s\x00", c.DataSize) - fmt.Fprintf(buf, "tree %s\n", hex.EncodeToString(cidToSha(c.GitTree))) - for _, p := range c.Parents { - fmt.Fprintf(buf, "parent %s\n", hex.EncodeToString(cidToSha(p))) - } - fmt.Fprintf(buf, "author %s\n", c.Author.String()) - fmt.Fprintf(buf, "committer %s\n", c.Committer.String()) - if len(c.Encoding) > 0 { - fmt.Fprintf(buf, "encoding %s\n", c.Encoding) - } - for _, mtag := range c.MergeTag { - fmt.Fprintf(buf, "mergetag object %s\n", hex.EncodeToString(cidToSha(mtag.Object))) - fmt.Fprintf(buf, " type %s\n", mtag.Type) - fmt.Fprintf(buf, " tag %s\n", mtag.Tag) - fmt.Fprintf(buf, " tagger %s\n \n", mtag.Tagger.String()) - fmt.Fprintf(buf, "%s", mtag.Text) - } - if c.Sig != nil { - fmt.Fprintln(buf, "gpgsig -----BEGIN PGP SIGNATURE-----") - fmt.Fprint(buf, c.Sig.Text) - fmt.Fprintln(buf, " -----END PGP SIGNATURE-----") - } - for _, line := range c.Other { - fmt.Fprintln(buf, line) - } - fmt.Fprintf(buf, "\n%s", c.Message) - c.rawData = buf.Bytes() - }) - - return c.rawData -} - -func (c *Commit) Resolve(path []string) (interface{}, []string, error) { - if len(path) == 0 { - return nil, nil, fmt.Errorf("zero length path") - } - - switch path[0] { - case "parents": - if len(path) == 1 { - return c.Parents, nil, nil - } - - i, err := strconv.Atoi(path[1]) - if err != nil { - return nil, nil, err - } - - if i < 0 || i >= len(c.Parents) { - return nil, nil, fmt.Errorf("index out of range") - } - - return &node.Link{Cid: c.Parents[i]}, path[2:], nil - case "author": - if len(path) == 1 { - return c.Author, nil, nil - } - return c.Author.resolve(path[1:]) - case "committer": - if len(path) == 1 { - return c.Committer, nil, nil - } - return c.Committer.resolve(path[1:]) - case "signature": - return c.Sig.Text, path[1:], nil - case "message": - return c.Message, path[1:], nil - case "tree": - return &node.Link{Cid: c.GitTree}, path[1:], nil - case "mergetag": - if len(path) == 1 { - return c.MergeTag, nil, nil - } - - i, err := strconv.Atoi(path[1]) - if err != nil { - return nil, nil, err - } - - if i < 0 || i >= len(c.MergeTag) { - return nil, nil, fmt.Errorf("index out of range") - } - - if len(path) == 2 { - return c.MergeTag[i], nil, nil - } - return c.MergeTag[i].resolve(path[2:]) - default: - return nil, nil, errors.New("no such link") - } -} - -func (c *Commit) ResolveLink(path []string) (*node.Link, []string, error) { - out, rest, err := c.Resolve(path) - if err != nil { - return nil, nil, err - } - - lnk, ok := out.(*node.Link) - if !ok { - return nil, nil, errors.New("not a link") - } - - return lnk, rest, nil -} - -func (c *Commit) Size() (uint64, error) { - return uint64(len(c.RawData())), nil -} - -func (c *Commit) Stat() (*node.NodeStat, error) { - return &node.NodeStat{}, nil -} - -func (c *Commit) String() string { - return "[git commit object]" -} - -func (c *Commit) Tree(p string, depth int) []string { - if depth != -1 { - panic("proper tree not yet implemented") - } - tree := []string{"tree", "parents", "message", "gpgsig"} - tree = append(tree, c.Author.tree("author", depth)...) - tree = append(tree, c.Committer.tree("committer", depth)...) - for i := range c.Parents { - tree = append(tree, fmt.Sprintf("parents/%d", i)) - } - return tree -} - -func (c *Commit) GitSha() []byte { - return cidToSha(c.Cid()) -} - -func (t *MergeTag) resolve(path []string) (interface{}, []string, error) { - if len(path) == 0 { - return nil, nil, fmt.Errorf("zero length path") - } - - switch path[0] { - case "object": - return &node.Link{Cid: t.Object}, path[1:], nil - case "tag": - return t.Tag, path[1:], nil - case "tagger": - if len(path) == 1 { - return t.Tagger, nil, nil - } - return t.Tagger.resolve(path[1:]) - case "text": - return t.Text, path[1:], nil - case "type": - return t.Type, path[1:], nil - default: - return nil, nil, errors.New("no such link") - } -} - -var _ node.Node = (*Commit)(nil) diff --git a/vendor/github.com/ipfs/go-ipld-git/git.go b/vendor/github.com/ipfs/go-ipld-git/git.go deleted file mode 100644 index 8a443e84..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/git.go +++ /dev/null @@ -1,478 +0,0 @@ -package ipldgit - -import ( - "bufio" - "bytes" - "compress/zlib" - "encoding/hex" - "errors" - "fmt" - "io" - "io/ioutil" - "strconv" - "strings" - - blocks "github.com/ipfs/go-block-format" - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" -) - -func DecodeBlock(block blocks.Block) (node.Node, error) { - prefix := block.Cid().Prefix() - - if prefix.Codec != cid.GitRaw || prefix.MhType != mh.SHA1 || prefix.MhLength != mh.DefaultLengths[mh.SHA1] { - return nil, errors.New("invalid CID prefix") - } - - return ParseObjectFromBuffer(block.RawData()) -} - -var _ node.DecodeBlockFunc = DecodeBlock - -func ParseObjectFromBuffer(b []byte) (node.Node, error) { - return ParseObject(bytes.NewReader(b)) -} - -func ParseCompressedObject(r io.Reader) (node.Node, error) { - rc, err := zlib.NewReader(r) - if err != nil { - return nil, err - } - defer rc.Close() - - return ParseObject(rc) -} - -func ParseObject(r io.Reader) (node.Node, error) { - rd := bufio.NewReader(r) - - typ, err := rd.ReadString(' ') - if err != nil { - return nil, err - } - typ = typ[:len(typ)-1] - - switch typ { - case "tree": - return ReadTree(rd) - case "commit": - return ReadCommit(rd) - case "blob": - return ReadBlob(rd) - case "tag": - return ReadTag(rd) - default: - return nil, fmt.Errorf("unrecognized object type: %s", typ) - } -} - -func ReadBlob(rd *bufio.Reader) (*Blob, error) { - size, err := rd.ReadString(0) - if err != nil { - return nil, err - } - - sizen, err := strconv.Atoi(size[:len(size)-1]) - if err != nil { - return nil, err - } - - buf := new(bytes.Buffer) - fmt.Fprintf(buf, "blob %d\x00", sizen) - - n, err := io.Copy(buf, rd) - if err != nil { - return nil, err - } - - if n != int64(sizen) { - return nil, fmt.Errorf("blob size was not accurate") - } - - out := &Blob{} - out.rawData = buf.Bytes() - out.cid = hashObject(out.RawData()) - - return out, nil -} - -func ReadCommit(rd *bufio.Reader) (*Commit, error) { - size, err := rd.ReadString(0) - if err != nil { - return nil, err - } - - out := &Commit{ - DataSize: size[:len(size)-1], - } - - for { - line, _, err := rd.ReadLine() - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - - err = parseCommitLine(out, line, rd) - if err != nil { - return nil, err - } - } - - out.cid = hashObject(out.RawData()) - - return out, nil -} - -func parseCommitLine(out *Commit, line []byte, rd *bufio.Reader) error { - switch { - case bytes.HasPrefix(line, []byte("tree ")): - sha, err := hex.DecodeString(string(line[5:])) - if err != nil { - return err - } - - out.GitTree = shaToCid(sha) - case bytes.HasPrefix(line, []byte("parent ")): - psha, err := hex.DecodeString(string(line[7:])) - if err != nil { - return err - } - - out.Parents = append(out.Parents, shaToCid(psha)) - case bytes.HasPrefix(line, []byte("author ")): - a, err := parsePersonInfo(line) - if err != nil { - return err - } - - out.Author = a - case bytes.HasPrefix(line, []byte("committer ")): - c, err := parsePersonInfo(line) - if err != nil { - return err - } - - out.Committer = c - case bytes.HasPrefix(line, []byte("encoding ")): - out.Encoding = string(line[9:]) - case bytes.HasPrefix(line, []byte("mergetag object ")): - sha, err := hex.DecodeString(string(line)[16:]) - if err != nil { - return err - } - - mt, rest, err := ReadMergeTag(sha, rd) - if err != nil { - return err - } - - out.MergeTag = append(out.MergeTag, mt) - - if rest != nil { - err = parseCommitLine(out, rest, rd) - if err != nil { - return err - } - } - case bytes.HasPrefix(line, []byte("gpgsig ")): - sig, err := ReadGpgSig(rd) - if err != nil { - return err - } - out.Sig = sig - case len(line) == 0: - rest, err := ioutil.ReadAll(rd) - if err != nil { - return err - } - - out.Message = string(rest) - default: - out.Other = append(out.Other, string(line)) - } - return nil -} - -func ReadTag(rd *bufio.Reader) (*Tag, error) { - size, err := rd.ReadString(0) - if err != nil { - return nil, err - } - - out := &Tag{ - dataSize: size[:len(size)-1], - } - - for { - line, _, err := rd.ReadLine() - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - - switch { - case bytes.HasPrefix(line, []byte("object ")): - sha, err := hex.DecodeString(string(line[7:])) - if err != nil { - return nil, err - } - - out.Object = shaToCid(sha) - case bytes.HasPrefix(line, []byte("tag ")): - out.Tag = string(line[4:]) - case bytes.HasPrefix(line, []byte("tagger ")): - c, err := parsePersonInfo(line) - if err != nil { - return nil, err - } - - out.Tagger = c - case bytes.HasPrefix(line, []byte("type ")): - out.Type = string(line[5:]) - case len(line) == 0: - rest, err := ioutil.ReadAll(rd) - if err != nil { - return nil, err - } - - out.Message = string(rest) - default: - fmt.Println("unhandled line: ", string(line)) - } - } - - out.cid = hashObject(out.RawData()) - - return out, nil -} - -func hashObject(data []byte) cid.Cid { - c, err := cid.Prefix{ - MhType: mh.SHA1, - MhLength: -1, - Codec: cid.GitRaw, - Version: 1, - }.Sum(data) - if err != nil { - panic(err) - } - return c -} - -func ReadMergeTag(hash []byte, rd *bufio.Reader) (*MergeTag, []byte, error) { - out := new(MergeTag) - - out.Object = shaToCid(hash) - for { - line, _, err := rd.ReadLine() - if err != nil { - if err == io.EOF { - break - } - return nil, nil, err - } - - switch { - case bytes.HasPrefix(line, []byte(" type ")): - out.Type = string(line[6:]) - case bytes.HasPrefix(line, []byte(" tag ")): - out.Tag = string(line[5:]) - case bytes.HasPrefix(line, []byte(" tagger ")): - tagger, err := parsePersonInfo(line[1:]) - if err != nil { - return nil, nil, err - } - out.Tagger = tagger - case string(line) == " ": - for { - line, _, err := rd.ReadLine() - if err != nil { - return nil, nil, err - } - - if !bytes.HasPrefix(line, []byte(" ")) { - return out, line, nil - } - - out.Text += string(line) + "\n" - } - } - } - return out, nil, nil -} - -func ReadGpgSig(rd *bufio.Reader) (*GpgSig, error) { - line, _, err := rd.ReadLine() - if err != nil { - return nil, err - } - - out := new(GpgSig) - - if string(line) != " " { - if strings.HasPrefix(string(line), " Version: ") || strings.HasPrefix(string(line), " Comment: ") { - out.Text += string(line) + "\n" - } else { - return nil, fmt.Errorf("expected first line of sig to be a single space or version") - } - } else { - out.Text += " \n" - } - - for { - line, _, err := rd.ReadLine() - if err != nil { - return nil, err - } - - if bytes.Equal(line, []byte(" -----END PGP SIGNATURE-----")) { - break - } - - out.Text += string(line) + "\n" - } - - return out, nil -} - -func parsePersonInfo(line []byte) (*PersonInfo, error) { - parts := bytes.Split(line, []byte{' '}) - if len(parts) < 3 { - fmt.Println(string(line)) - return nil, fmt.Errorf("incorrectly formatted person info line") - } - - //TODO: just use regex? - //skip prefix - at := 1 - - var pi PersonInfo - var name string - - for { - if at == len(parts) { - return nil, fmt.Errorf("invalid personInfo: %s\n", line) - } - part := parts[at] - if len(part) != 0 { - if part[0] == '<' { - break - } - name += string(part) + " " - } else if len(name) > 0 { - name += " " - } - at++ - } - if len(name) != 0 { - pi.Name = name[:len(name)-1] - } - - var email string - for { - if at == len(parts) { - return nil, fmt.Errorf("invalid personInfo: %s\n", line) - } - part := parts[at] - if part[0] == '<' { - part = part[1:] - } - - at++ - if part[len(part)-1] == '>' { - email += string(part[:len(part)-1]) - break - } - email += string(part) + " " - } - pi.Email = email - - if at == len(parts) { - return &pi, nil - } - pi.Date = string(parts[at]) - - at++ - if at == len(parts) { - return &pi, nil - } - pi.Timezone = string(parts[at]) - return &pi, nil -} - -func ReadTree(rd *bufio.Reader) (*Tree, error) { - lstr, err := rd.ReadString(0) - if err != nil { - return nil, err - } - lstr = lstr[:len(lstr)-1] - - n, err := strconv.Atoi(lstr) - if err != nil { - return nil, err - } - - t := &Tree{ - entries: make(map[string]*TreeEntry), - size: n, - } - var order []string - for { - e, err := ReadEntry(rd) - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - - order = append(order, e.name) - t.entries[e.name] = e - } - t.order = order - t.cid = hashObject(t.RawData()) - - return t, nil -} - -func cidToSha(c cid.Cid) []byte { - h := c.Hash() - return h[len(h)-20:] -} - -func shaToCid(sha []byte) cid.Cid { - h, _ := mh.Encode(sha, mh.SHA1) - return cid.NewCidV1(cid.GitRaw, h) -} - -func ReadEntry(r *bufio.Reader) (*TreeEntry, error) { - data, err := r.ReadString(' ') - if err != nil { - return nil, err - } - data = data[:len(data)-1] - - name, err := r.ReadString(0) - if err != nil { - return nil, err - } - name = name[:len(name)-1] - - sha := make([]byte, 20) - _, err = io.ReadFull(r, sha) - if err != nil { - return nil, err - } - - return &TreeEntry{ - name: name, - Mode: data, - Hash: shaToCid(sha), - }, nil -} diff --git a/vendor/github.com/ipfs/go-ipld-git/go.mod b/vendor/github.com/ipfs/go-ipld-git/go.mod deleted file mode 100644 index 433bb4e8..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/ipfs/go-ipld-git - -require ( - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-ipld-format v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipld-git/go.sum b/vendor/github.com/ipfs/go-ipld-git/go.sum deleted file mode 100644 index b524adb8..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/go.sum +++ /dev/null @@ -1,30 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-ipld-git/make-test-repo.sh b/vendor/github.com/ipfs/go-ipld-git/make-test-repo.sh deleted file mode 100755 index dbb3f230..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/make-test-repo.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env bash - -set -x -CUR_DIR=$(pwd) -TEST_DIR=$(mktemp -d) -cd ${TEST_DIR} - -git init - -# Test generic commit/blob - -git config user.name "John Doe" -git config user.email johndoe@example.com - -echo "Hello world" > file -git add file - -git commit -m "Init" - -# Test generic commit/tree/blob, weird person info - -mkdir dir -mkdir dir/subdir -mkdir dir2 - -echo "qwerty" > dir/f1 -echo "123456" > dir/subdir/f2 -echo "',.pyf" > dir2/f3 - -git add . - -git config user.name "John Doe & John Other" -git config user.email "johndoe@example.com, johnother@example.com" -git commit -m "Commit 2" - -# Test merge-tag -git config user.name "John Doe" -git config user.email johndoe@example.com - -git branch dev -git checkout dev - -echo ";qjkxb" > dir/f4 - -git add dir/f4 -git commit -m "Release" -git tag -a v1 -m "Some version" -git checkout master - -## defer eyes.Open() -## eyes.Close() - -git cat-file tag $(cat .git/refs/tags/v1) | head -n4 | sed 's/v1/v1sig/g' > sigobj -cat >>sigobj < sigtag -FILE=.git/objects/$(sha1sum sigtag | cut -d' ' -f1 | sed 's/../\0\//') -mkdir -p $(dirname ${FILE}) -cat sigtag | zlib-flate -compress > ${FILE} -echo $(sha1sum sigtag | cut -d' ' -f1) > .git/refs/tags/v1sig - -git merge v1sig --no-ff -m "Merge tag v1" - -# Test encoding -git config i18n.commitencoding "ISO-8859-1" -echo "fgcrl" > f6 -git add f6 -git commit -m "Encoded" - -# Test iplBlob/tree tags -git tag -a v1-file -m "Some file" 933b7583b7767b07ea4cf242c1be29162eb8bb85 -git tag -a v1-tree -m "Some tree" 672ef117424f54b71e5e058d1184de6a07450d0e - -# Create test 'signed' objects - -git cat-file commit $(cat .git/refs/heads/master) | head -n4 > sigobj -echo "gpgsig -----BEGIN PGP SIGNATURE-----" >> sigobj -echo " " >> sigobj -echo " NotReallyABase64Signature" >> sigobj -echo " ButItsGoodEnough" >> sigobj -echo " -----END PGP SIGNATURE-----" >> sigobj -echo "" >> sigobj -echo "Encoded" >> sigobj - -cat <(printf "commit %d\0" $(wc -c sigobj | cut -d' ' -f1); cat sigobj) > sigcommit -FILE=.git/objects/$(sha1sum sigcommit | cut -d' ' -f1 | sed 's/../\0\//') -mkdir -p $(dirname ${FILE}) -cat sigcommit | zlib-flate -compress > ${FILE} - -git cat-file commit $(cat .git/refs/heads/master) | head -n4 > sigobj -echo "gpgsig -----BEGIN PGP SIGNATURE-----" >> sigobj -echo " Version: 0.1.2" >> sigobj -echo " " >> sigobj -echo " NotReallyABase64Signature" >> sigobj -echo " ButItsGoodEnough" >> sigobj -echo " -----END PGP SIGNATURE-----" >> sigobj -echo " " >> sigobj -echo "" >> sigobj -echo "Encoded" >> sigobj - -cat <(printf "commit %d\0" $(wc -c sigobj | cut -d' ' -f1); cat sigobj) > sigcommit -FILE=.git/objects/$(sha1sum sigcommit | cut -d' ' -f1 | sed 's/../\0\//') -mkdir -p $(dirname ${FILE}) -cat sigcommit | zlib-flate -compress >> ${FILE} -rm sigobj sigcommit - -# Create test archive, clean up - -tar czf git.tar.gz .git -mv git.tar.gz ${CUR_DIR}/testdata.tar.gz -cd ${CUR_DIR} -rm -rf ${TEST_DIR} diff --git a/vendor/github.com/ipfs/go-ipld-git/package.json b/vendor/github.com/ipfs/go-ipld-git/package.json deleted file mode 100644 index cff29bcf..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/ipfs/go-ipld-git" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipld-git" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - } - ], - "gxVersion": "0.10.0", - "language": "go", - "license": "", - "name": "go-ipld-git", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.3.6" -} - diff --git a/vendor/github.com/ipfs/go-ipld-git/tag.go b/vendor/github.com/ipfs/go-ipld-git/tag.go deleted file mode 100644 index 25245ac9..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/tag.go +++ /dev/null @@ -1,136 +0,0 @@ -package ipldgit - -import ( - "bytes" - "encoding/hex" - "errors" - "fmt" - "sync" - - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" -) - -type Tag struct { - Object cid.Cid `json:"object"` - Type string `json:"type"` - Tag string `json:"tag"` - Tagger *PersonInfo `json:"tagger"` - Message string `json:"message"` - dataSize string - - cid cid.Cid - - rawData []byte - rawDataOnce sync.Once -} - -func (t *Tag) Cid() cid.Cid { - return t.cid -} - -func (t *Tag) Copy() node.Node { - nt := *t - return &nt -} - -func (t *Tag) Links() []*node.Link { - return []*node.Link{{Cid: t.Object}} -} - -func (t *Tag) Loggable() map[string]interface{} { - return map[string]interface{}{ - "type": "git_tag", - } -} - -func (t *Tag) RawData() []byte { - t.rawDataOnce.Do(func() { - buf := new(bytes.Buffer) - fmt.Fprintf(buf, "tag %s\x00", t.dataSize) - fmt.Fprintf(buf, "object %s\n", hex.EncodeToString(cidToSha(t.Object))) - fmt.Fprintf(buf, "type %s\n", t.Type) - fmt.Fprintf(buf, "tag %s\n", t.Tag) - if t.Tagger != nil { - fmt.Fprintf(buf, "tagger %s\n", t.Tagger.String()) - } - if t.Message != "" { - fmt.Fprintf(buf, "\n%s", t.Message) - } - t.rawData = buf.Bytes() - }) - - return t.rawData -} - -func (t *Tag) Resolve(path []string) (interface{}, []string, error) { - if len(path) == 0 { - return nil, nil, fmt.Errorf("zero length path") - } - - switch path[0] { - case "object": - return &node.Link{Cid: t.Object}, path[1:], nil - case "type": - return t.Type, path[1:], nil - case "tagger": - if len(path) == 1 { - return t.Tagger, nil, nil - } - return t.Tagger.resolve(path[1:]) - case "message": - return t.Message, path[1:], nil - case "tag": - return t.Tag, path[1:], nil - default: - return nil, nil, errors.New("no such link") - } -} - -func (t *Tag) ResolveLink(path []string) (*node.Link, []string, error) { - out, rest, err := t.Resolve(path) - if err != nil { - return nil, nil, err - } - - lnk, ok := out.(*node.Link) - if !ok { - return nil, nil, errors.New("not a link") - } - - return lnk, rest, nil -} - -func (t *Tag) Size() (uint64, error) { - return uint64(len(t.RawData())), nil -} - -func (t *Tag) Stat() (*node.NodeStat, error) { - return &node.NodeStat{}, nil -} - -func (t *Tag) String() string { - return "[git tag object]" -} - -func (t *Tag) Tree(p string, depth int) []string { - if p != "" { - if p == "tagger" { - return []string{"name", "email", "date"} - } - return nil - } - if depth == 0 { - return nil - } - - tree := []string{"object", "type", "tag", "message"} - tree = append(tree, t.Tagger.tree("tagger", depth)...) - return tree -} - -func (t *Tag) GitSha() []byte { - return cidToSha(t.Cid()) -} - -var _ node.Node = (*Tag)(nil) diff --git a/vendor/github.com/ipfs/go-ipld-git/testdata.tar.gz b/vendor/github.com/ipfs/go-ipld-git/testdata.tar.gz deleted file mode 100644 index 658dfe84..00000000 Binary files a/vendor/github.com/ipfs/go-ipld-git/testdata.tar.gz and /dev/null differ diff --git a/vendor/github.com/ipfs/go-ipld-git/tree.go b/vendor/github.com/ipfs/go-ipld-git/tree.go deleted file mode 100644 index 5ce354ac..00000000 --- a/vendor/github.com/ipfs/go-ipld-git/tree.go +++ /dev/null @@ -1,170 +0,0 @@ -package ipldgit - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "sync" - - cid "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" -) - -type Tree struct { - entries map[string]*TreeEntry - size int - order []string - cid cid.Cid - rawData []byte - rawDataOnce sync.Once -} - -type TreeEntry struct { - name string - Mode string `json:"mode"` - Hash cid.Cid `json:"hash"` -} - -func (t *Tree) Cid() cid.Cid { - return t.cid -} - -func (t *Tree) String() string { - return "[git tree object]" -} - -func (t *Tree) GitSha() []byte { - return cidToSha(t.cid) -} - -func (t *Tree) Copy() node.Node { - out := &Tree{ - entries: make(map[string]*TreeEntry), - cid: t.cid, - size: t.size, - order: t.order, // TODO: make a deep copy of this - } - - for k, v := range t.entries { - nv := *v - out.entries[k] = &nv - } - return out -} - -func (t *Tree) MarshalJSON() ([]byte, error) { - return json.Marshal(t.entries) -} - -func (t *Tree) Tree(p string, depth int) []string { - if p != "" { - _, ok := t.entries[p] - if !ok { - return nil - } - - return []string{"mode", "type", "hash"} - } - - if depth == 0 { - return nil - } - - if depth == 1 { - return t.order - } - - var out []string - for k, _ := range t.entries { - out = append(out, k, k+"/mode", k+"/type", k+"/hash") - } - return out -} - -func (t *Tree) Links() []*node.Link { - var out []*node.Link - for _, v := range t.entries { - out = append(out, &node.Link{Cid: v.Hash}) - } - return out -} - -func (t *Tree) Loggable() map[string]interface{} { - return map[string]interface{}{ - "type": "git tree object", - } -} - -func (t *Tree) RawData() []byte { - t.rawDataOnce.Do(func() { - buf := new(bytes.Buffer) - - fmt.Fprintf(buf, "tree %d\x00", t.size) - for _, s := range t.order { - t.entries[s].WriteTo(buf) - } - t.rawData = buf.Bytes() - }) - - return t.rawData -} - -func (t *Tree) Resolve(p []string) (interface{}, []string, error) { - e, ok := t.entries[p[0]] - if !ok { - return nil, nil, errors.New("no such link") - } - - if len(p) == 1 { - return e, nil, nil - } - - switch p[1] { - case "hash": - return &node.Link{Cid: e.Hash}, p[2:], nil - case "mode": - return e.Mode, p[2:], nil - default: - return nil, nil, errors.New("no such link") - } -} - -func (t Tree) ResolveLink(path []string) (*node.Link, []string, error) { - out, rest, err := t.Resolve(path) - if err != nil { - return nil, nil, err - } - - lnk, ok := out.(*node.Link) - if !ok { - return nil, nil, errors.New("not a link") - } - - return lnk, rest, nil -} - -func (t *Tree) Size() (uint64, error) { - return uint64(len(t.RawData())), nil -} - -func (t *Tree) Stat() (*node.NodeStat, error) { - return &node.NodeStat{}, nil -} - -func (te *TreeEntry) WriteTo(w io.Writer) (int, error) { - n, err := fmt.Fprintf(w, "%s %s\x00", te.Mode, te.name) - if err != nil { - return 0, err - } - - nn, err := w.Write(cidToSha(te.Hash)) - if err != nil { - return n, err - } - - return n + nn, nil -} - -var _ node.Node = (*Tree)(nil) diff --git a/vendor/github.com/ipfs/go-ipns/.travis.yml b/vendor/github.com/ipfs/go-ipns/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-ipns/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-ipns/LICENSE b/vendor/github.com/ipfs/go-ipns/LICENSE deleted file mode 100644 index 8ce02878..00000000 --- a/vendor/github.com/ipfs/go-ipns/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/ipfs/go-ipns/Makefile b/vendor/github.com/ipfs/go-ipns/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/ipfs/go-ipns/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/ipfs/go-ipns/README.md b/vendor/github.com/ipfs/go-ipns/README.md deleted file mode 100644 index 2ae0846a..00000000 --- a/vendor/github.com/ipfs/go-ipns/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# go-ipns - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-datastore?status.svg)](https://godoc.org/github.com/ipfs/go-ipns) - -> ipns record definitions - -This package contains all of the components necessary to create, understand, and validate IPNS records. It does *not* publish or resolve those records. [`go-ipfs`](https://github.com/ipfs/go-ipfs) uses this package internally to manipulate records. - -## Usage - -To create a new IPNS record: - -```go -import ( - "time" - - ipns "github.com/ipfs/go-ipns" - crypto "github.com/libp2p/go-libp2p-crypto" -) - -// Generate a private key to sign the IPNS record with. Most of the time, -// however, you'll want to retrieve an already-existing key from IPFS using the -// go-ipfs/core/coreapi CoreAPI.KeyAPI() interface. -privateKey, publicKey, err := crypto.GenerateKeyPair(crypto.RSA, 2048) -if err != nil { - panic(err) -} - -// Create an IPNS record that expires in one hour and points to the IPFS address -// /ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5 -ipnsRecord, err := ipns.Create(privateKey, []byte("/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5"), 0, time.Now().Add(1*time.Hour)) -if err != nil { - panic(err) -} -``` - -Once you have the record, you’ll need to use IPFS to *publish* it. - -There are several other major operations you can do with `go-ipns`. Check out the [API docs](https://godoc.org/github.com/ipfs/go-ipns) or look at the tests in this repo for examples. - -## Documentation - -https://godoc.org/github.com/ipfs/go-ipns - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-ipns/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) - -## License - -Copyright (c) Protocol Labs, Inc. under the **MIT license**. See [LICENSE file](./LICENSE) for details. diff --git a/vendor/github.com/ipfs/go-ipns/codecov.yml b/vendor/github.com/ipfs/go-ipns/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/ipfs/go-ipns/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/ipfs/go-ipns/errors.go b/vendor/github.com/ipfs/go-ipns/errors.go deleted file mode 100644 index ebcd4e26..00000000 --- a/vendor/github.com/ipfs/go-ipns/errors.go +++ /dev/null @@ -1,37 +0,0 @@ -package ipns - -import ( - "errors" -) - -// ErrExpiredRecord should be returned when an ipns record is -// invalid due to being too old -var ErrExpiredRecord = errors.New("expired record") - -// ErrUnrecognizedValidity is returned when an IpnsRecord has an -// unknown validity type. -var ErrUnrecognizedValidity = errors.New("unrecognized validity type") - -// ErrInvalidPath should be returned when an ipns record path -// is not in a valid format -var ErrInvalidPath = errors.New("record path invalid") - -// ErrSignature should be returned when an ipns record fails -// signature verification -var ErrSignature = errors.New("record signature verification failed") - -// ErrKeyFormat should be returned when an ipns record key is -// incorrectly formatted (not a peer ID) -var ErrKeyFormat = errors.New("record key could not be parsed into peer ID") - -// ErrPublicKeyNotFound should be returned when the public key -// corresponding to the ipns record path cannot be retrieved -// from the peer store -var ErrPublicKeyNotFound = errors.New("public key not found in peer store") - -// ErrPublicKeyMismatch should be returned when the public key embedded in the -// record doesn't match the expected public key. -var ErrPublicKeyMismatch = errors.New("public key in record did not match expected pubkey") - -// ErrBadRecord should be returned when an ipns record cannot be unmarshalled -var ErrBadRecord = errors.New("record could not be unmarshalled") diff --git a/vendor/github.com/ipfs/go-ipns/go.mod b/vendor/github.com/ipfs/go-ipns/go.mod deleted file mode 100644 index 842ca0d7..00000000 --- a/vendor/github.com/ipfs/go-ipns/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/ipfs/go-ipns - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-crypto v0.0.1 - github.com/libp2p/go-libp2p-peer v0.0.1 - github.com/libp2p/go-libp2p-peerstore v0.0.1 - github.com/libp2p/go-libp2p-record v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-ipns/go.sum b/vendor/github.com/ipfs/go-ipns/go.sum deleted file mode 100644 index 6ef36abf..00000000 --- a/vendor/github.com/ipfs/go-ipns/go.sum +++ /dev/null @@ -1,114 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-record v0.0.1 h1:zN7AS3X46qmwsw5JLxdDuI43cH5UYwovKxHPjKBYQxw= -github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-ipns/ipns.go b/vendor/github.com/ipfs/go-ipns/ipns.go deleted file mode 100644 index f145333b..00000000 --- a/vendor/github.com/ipfs/go-ipns/ipns.go +++ /dev/null @@ -1,168 +0,0 @@ -package ipns - -import ( - "bytes" - "fmt" - "time" - - pb "github.com/ipfs/go-ipns/pb" - - u "github.com/ipfs/go-ipfs-util" - ic "github.com/libp2p/go-libp2p-crypto" - peer "github.com/libp2p/go-libp2p-peer" -) - -// Create creates a new IPNS entry and signs it with the given private key. -// -// This function does not embed the public key. If you want to do that, use -// `EmbedPublicKey`. -func Create(sk ic.PrivKey, val []byte, seq uint64, eol time.Time) (*pb.IpnsEntry, error) { - entry := new(pb.IpnsEntry) - - entry.Value = val - typ := pb.IpnsEntry_EOL - entry.ValidityType = &typ - entry.Sequence = &seq - entry.Validity = []byte(u.FormatRFC3339(eol)) - - sig, err := sk.Sign(ipnsEntryDataForSig(entry)) - if err != nil { - return nil, err - } - entry.Signature = sig - - return entry, nil -} - -// Validates validates the given IPNS entry against the given public key. -func Validate(pk ic.PubKey, entry *pb.IpnsEntry) error { - // Check the ipns record signature with the public key - if ok, err := pk.Verify(ipnsEntryDataForSig(entry), entry.GetSignature()); err != nil || !ok { - return ErrSignature - } - - eol, err := GetEOL(entry) - if err != nil { - return err - } - if time.Now().After(eol) { - return ErrExpiredRecord - } - return nil -} - -// GetEOL returns the EOL of this IPNS entry -// -// This function returns ErrUnrecognizedValidity if the validity type of the -// record isn't EOL. Otherwise, it returns an error if it can't parse the EOL. -func GetEOL(entry *pb.IpnsEntry) (time.Time, error) { - if entry.GetValidityType() != pb.IpnsEntry_EOL { - return time.Time{}, ErrUnrecognizedValidity - } - return u.ParseRFC3339(string(entry.GetValidity())) -} - -// EmbedPublicKey embeds the given public key in the given ipns entry. While not -// strictly required, some nodes (e.g., DHT servers) may reject IPNS entries -// that don't embed their public keys as they may not be able to validate them -// efficiently. -func EmbedPublicKey(pk ic.PubKey, entry *pb.IpnsEntry) error { - // Try extracting the public key from the ID. If we can, *don't* embed - // it. - id, err := peer.IDFromPublicKey(pk) - if err != nil { - return err - } - if _, err := id.ExtractPublicKey(); err != peer.ErrNoPublicKey { - // Either a *real* error or nil. - return err - } - - // We failed to extract the public key from the peer ID, embed it in the - // record. - pkBytes, err := pk.Bytes() - if err != nil { - return err - } - entry.PubKey = pkBytes - return nil -} - -// ExtractPublicKey extracts a public key matching `pid` from the IPNS record, -// if possible. -// -// This function returns (nil, nil) when no public key can be extracted and -// nothing is malformed. -func ExtractPublicKey(pid peer.ID, entry *pb.IpnsEntry) (ic.PubKey, error) { - if entry.PubKey != nil { - pk, err := ic.UnmarshalPublicKey(entry.PubKey) - if err != nil { - return nil, fmt.Errorf("unmarshaling pubkey in record: %s", err) - } - - expPid, err := peer.IDFromPublicKey(pk) - if err != nil { - return nil, fmt.Errorf("could not regenerate peerID from pubkey: %s", err) - } - - if pid != expPid { - return nil, ErrPublicKeyMismatch - } - return pk, nil - } - - return pid.ExtractPublicKey() -} - -// Compare compares two IPNS entries. It returns: -// -// * -1 if a is older than b -// * 0 if a and b cannot be ordered (this doesn't mean that they are equal) -// * +1 if a is newer than b -// -// It returns an error when either a or b are malformed. -// -// NOTE: It *does not* validate the records, the caller is responsible for calling -// `Validate` first. -// -// NOTE: If a and b cannot be ordered by this function, you can determine their -// order by comparing their serialized byte representations (using -// `bytes.Compare`). You must do this if you are implementing a libp2p record -// validator (or you can just use the one provided for you by this package). -func Compare(a, b *pb.IpnsEntry) (int, error) { - as := a.GetSequence() - bs := b.GetSequence() - - if as > bs { - return 1, nil - } else if as < bs { - return -1, nil - } - - at, err := u.ParseRFC3339(string(a.GetValidity())) - if err != nil { - return 0, err - } - - bt, err := u.ParseRFC3339(string(b.GetValidity())) - if err != nil { - return 0, err - } - - if at.After(bt) { - return 1, nil - } else if bt.After(at) { - return -1, nil - } - - return 0, nil -} - -func ipnsEntryDataForSig(e *pb.IpnsEntry) []byte { - return bytes.Join([][]byte{ - e.Value, - e.Validity, - []byte(fmt.Sprint(e.GetValidityType())), - }, - []byte{}) -} diff --git a/vendor/github.com/ipfs/go-ipns/package.json b/vendor/github.com/ipfs/go-ipns/package.json deleted file mode 100644 index e728289c..00000000 --- a/vendor/github.com/ipfs/go-ipns/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "author": "stebalien", - "bugs": { - "url": "https://github.com/ipfs/go-ipns/issues" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipns" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "whyrusleeping", - "hash": "QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK", - "name": "go-libp2p-crypto", - "version": "2.0.7" - }, - { - "author": "whyrusleeping", - "hash": "QmYVXrKrKHDC9FobgmcmshCDyWwdrfwfanNQN4oxJ9Fk3h", - "name": "go-libp2p-peer", - "version": "3.1.2" - }, - { - "author": "whyrusleeping", - "hash": "QmaCTz9RkrU13bm9kMB54f7atgqM4qkjDZpRwRoJiWXEqs", - "name": "go-libp2p-peerstore", - "version": "2.0.19" - }, - { - "hash": "QmbeHtaBy9nZsW4cHRcvgVY4CnDhXudE2Dr6qDxS7yg9rX", - "name": "go-libp2p-record", - "version": "4.1.15" - }, - { - "author": "whyrusleeping", - "hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB", - "name": "gogo-protobuf", - "version": "1.2.1" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-ipns", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.23" -} - diff --git a/vendor/github.com/ipfs/go-ipns/pb/Makefile b/vendor/github.com/ipfs/go-ipns/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/ipfs/go-ipns/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/ipfs/go-ipns/pb/ipns.pb.go b/vendor/github.com/ipfs/go-ipns/pb/ipns.pb.go deleted file mode 100644 index b38ce4ea..00000000 --- a/vendor/github.com/ipfs/go-ipns/pb/ipns.pb.go +++ /dev/null @@ -1,678 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ipns.proto - -package ipns_pb - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type IpnsEntry_ValidityType int32 - -const ( - // setting an EOL says "this record is valid until..." - IpnsEntry_EOL IpnsEntry_ValidityType = 0 -) - -var IpnsEntry_ValidityType_name = map[int32]string{ - 0: "EOL", -} - -var IpnsEntry_ValidityType_value = map[string]int32{ - "EOL": 0, -} - -func (x IpnsEntry_ValidityType) Enum() *IpnsEntry_ValidityType { - p := new(IpnsEntry_ValidityType) - *p = x - return p -} - -func (x IpnsEntry_ValidityType) String() string { - return proto.EnumName(IpnsEntry_ValidityType_name, int32(x)) -} - -func (x *IpnsEntry_ValidityType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(IpnsEntry_ValidityType_value, data, "IpnsEntry_ValidityType") - if err != nil { - return err - } - *x = IpnsEntry_ValidityType(value) - return nil -} - -func (IpnsEntry_ValidityType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4d5b16fb32bfe8ea, []int{0, 0} -} - -type IpnsEntry struct { - Value []byte `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` - Signature []byte `protobuf:"bytes,2,req,name=signature" json:"signature,omitempty"` - ValidityType *IpnsEntry_ValidityType `protobuf:"varint,3,opt,name=validityType,enum=ipns.pb.IpnsEntry_ValidityType" json:"validityType,omitempty"` - Validity []byte `protobuf:"bytes,4,opt,name=validity" json:"validity,omitempty"` - Sequence *uint64 `protobuf:"varint,5,opt,name=sequence" json:"sequence,omitempty"` - Ttl *uint64 `protobuf:"varint,6,opt,name=ttl" json:"ttl,omitempty"` - // in order for nodes to properly validate a record upon receipt, they need the public - // key associated with it. For old RSA keys, its easiest if we just send this as part of - // the record itself. For newer ed25519 keys, the public key can be embedded in the - // peerID, making this field unnecessary. - PubKey []byte `protobuf:"bytes,7,opt,name=pubKey" json:"pubKey,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IpnsEntry) Reset() { *m = IpnsEntry{} } -func (m *IpnsEntry) String() string { return proto.CompactTextString(m) } -func (*IpnsEntry) ProtoMessage() {} -func (*IpnsEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_4d5b16fb32bfe8ea, []int{0} -} -func (m *IpnsEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IpnsEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IpnsEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *IpnsEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_IpnsEntry.Merge(m, src) -} -func (m *IpnsEntry) XXX_Size() int { - return m.Size() -} -func (m *IpnsEntry) XXX_DiscardUnknown() { - xxx_messageInfo_IpnsEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_IpnsEntry proto.InternalMessageInfo - -func (m *IpnsEntry) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *IpnsEntry) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *IpnsEntry) GetValidityType() IpnsEntry_ValidityType { - if m != nil && m.ValidityType != nil { - return *m.ValidityType - } - return IpnsEntry_EOL -} - -func (m *IpnsEntry) GetValidity() []byte { - if m != nil { - return m.Validity - } - return nil -} - -func (m *IpnsEntry) GetSequence() uint64 { - if m != nil && m.Sequence != nil { - return *m.Sequence - } - return 0 -} - -func (m *IpnsEntry) GetTtl() uint64 { - if m != nil && m.Ttl != nil { - return *m.Ttl - } - return 0 -} - -func (m *IpnsEntry) GetPubKey() []byte { - if m != nil { - return m.PubKey - } - return nil -} - -func init() { - proto.RegisterEnum("ipns.pb.IpnsEntry_ValidityType", IpnsEntry_ValidityType_name, IpnsEntry_ValidityType_value) - proto.RegisterType((*IpnsEntry)(nil), "ipns.pb.IpnsEntry") -} - -func init() { proto.RegisterFile("ipns.proto", fileDescriptor_4d5b16fb32bfe8ea) } - -var fileDescriptor_4d5b16fb32bfe8ea = []byte{ - // 221 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xca, 0x2c, 0xc8, 0x2b, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0xb0, 0x93, 0x94, 0xfe, 0x33, 0x72, 0x71, - 0x7a, 0x16, 0xe4, 0x15, 0xbb, 0xe6, 0x95, 0x14, 0x55, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, - 0x94, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x69, 0xf0, 0x04, 0x41, 0x38, 0x42, 0x32, 0x5c, 0x9c, 0xc5, - 0x99, 0xe9, 0x79, 0x89, 0x25, 0xa5, 0x45, 0xa9, 0x12, 0x4c, 0x60, 0x19, 0x84, 0x80, 0x90, 0x33, - 0x17, 0x4f, 0x59, 0x62, 0x4e, 0x66, 0x4a, 0x66, 0x49, 0x65, 0x48, 0x65, 0x41, 0xaa, 0x04, 0xb3, - 0x02, 0xa3, 0x06, 0x9f, 0x91, 0xbc, 0x1e, 0xd4, 0x06, 0x3d, 0xb8, 0xe9, 0x7a, 0x61, 0x48, 0xca, - 0x82, 0x50, 0x34, 0x09, 0x49, 0x71, 0x71, 0xc0, 0xf8, 0x12, 0x2c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, - 0x70, 0x3e, 0x48, 0xae, 0x38, 0xb5, 0xb0, 0x34, 0x35, 0x2f, 0x39, 0x55, 0x82, 0x55, 0x81, 0x51, - 0x83, 0x25, 0x08, 0xce, 0x17, 0x12, 0xe0, 0x62, 0x2e, 0x29, 0xc9, 0x91, 0x60, 0x03, 0x0b, 0x83, - 0x98, 0x42, 0x62, 0x5c, 0x6c, 0x05, 0xa5, 0x49, 0xde, 0xa9, 0x95, 0x12, 0xec, 0x60, 0x73, 0xa0, - 0x3c, 0x25, 0x71, 0x2e, 0x1e, 0x64, 0xfb, 0x85, 0xd8, 0xb9, 0x98, 0x5d, 0xfd, 0x7d, 0x04, 0x18, - 0x9c, 0x78, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0x46, 0x40, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x35, 0xc7, 0xf2, 0x25, 0x01, 0x00, 0x00, -} - -func (m *IpnsEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IpnsEntry) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintIpns(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Signature == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("signature") - } else { - dAtA[i] = 0x12 - i++ - i = encodeVarintIpns(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - if m.ValidityType != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintIpns(dAtA, i, uint64(*m.ValidityType)) - } - if m.Validity != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintIpns(dAtA, i, uint64(len(m.Validity))) - i += copy(dAtA[i:], m.Validity) - } - if m.Sequence != nil { - dAtA[i] = 0x28 - i++ - i = encodeVarintIpns(dAtA, i, uint64(*m.Sequence)) - } - if m.Ttl != nil { - dAtA[i] = 0x30 - i++ - i = encodeVarintIpns(dAtA, i, uint64(*m.Ttl)) - } - if m.PubKey != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintIpns(dAtA, i, uint64(len(m.PubKey))) - i += copy(dAtA[i:], m.PubKey) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintIpns(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *IpnsEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovIpns(uint64(l)) - } - if m.Signature != nil { - l = len(m.Signature) - n += 1 + l + sovIpns(uint64(l)) - } - if m.ValidityType != nil { - n += 1 + sovIpns(uint64(*m.ValidityType)) - } - if m.Validity != nil { - l = len(m.Validity) - n += 1 + l + sovIpns(uint64(l)) - } - if m.Sequence != nil { - n += 1 + sovIpns(uint64(*m.Sequence)) - } - if m.Ttl != nil { - n += 1 + sovIpns(uint64(*m.Ttl)) - } - if m.PubKey != nil { - l = len(m.PubKey) - n += 1 + l + sovIpns(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovIpns(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozIpns(x uint64) (n int) { - return sovIpns(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *IpnsEntry) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IpnsEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IpnsEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIpns - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIpns - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIpns - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIpns - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidityType", wireType) - } - var v IpnsEntry_ValidityType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= IpnsEntry_ValidityType(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ValidityType = &v - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validity", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIpns - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIpns - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validity = append(m.Validity[:0], dAtA[iNdEx:postIndex]...) - if m.Validity == nil { - m.Validity = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Sequence = &v - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ttl", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ttl = &v - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIpns - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIpns - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIpns - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) - if m.PubKey == nil { - m.PubKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIpns(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthIpns - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthIpns - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("value") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("signature") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipIpns(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIpns - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIpns - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIpns - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthIpns - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIpns - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIpns - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIpns(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIpns - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthIpns = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIpns = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-ipns/pb/ipns.proto b/vendor/github.com/ipfs/go-ipns/pb/ipns.proto deleted file mode 100644 index f2e79fef..00000000 --- a/vendor/github.com/ipfs/go-ipns/pb/ipns.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto2"; - -package ipns.pb; - -message IpnsEntry { - enum ValidityType { - // setting an EOL says "this record is valid until..." - EOL = 0; - } - required bytes value = 1; - required bytes signature = 2; - - optional ValidityType validityType = 3; - optional bytes validity = 4; - - optional uint64 sequence = 5; - - optional uint64 ttl = 6; - - // in order for nodes to properly validate a record upon receipt, they need the public - // key associated with it. For old RSA keys, its easiest if we just send this as part of - // the record itself. For newer ed25519 keys, the public key can be embedded in the - // peerID, making this field unnecessary. - optional bytes pubKey = 7; -} diff --git a/vendor/github.com/ipfs/go-ipns/record.go b/vendor/github.com/ipfs/go-ipns/record.go deleted file mode 100644 index eb60ce6f..00000000 --- a/vendor/github.com/ipfs/go-ipns/record.go +++ /dev/null @@ -1,126 +0,0 @@ -package ipns - -import ( - "bytes" - "errors" - - pb "github.com/ipfs/go-ipns/pb" - - proto "github.com/gogo/protobuf/proto" - logging "github.com/ipfs/go-log" - ic "github.com/libp2p/go-libp2p-crypto" - peer "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" - record "github.com/libp2p/go-libp2p-record" -) - -var log = logging.Logger("ipns") - -var _ record.Validator = Validator{} - -// RecordKey returns the libp2p record key for a given peer ID. -func RecordKey(pid peer.ID) string { - return "/ipns/" + string(pid) -} - -// Validator is an IPNS record validator that satisfies the libp2p record -// validator interface. -type Validator struct { - // KeyBook, if non-nil, will be used to lookup keys for validating IPNS - // records. - KeyBook pstore.KeyBook -} - -// Validate validates an IPNS record. -func (v Validator) Validate(key string, value []byte) error { - ns, pidString, err := record.SplitKey(key) - if err != nil || ns != "ipns" { - return ErrInvalidPath - } - - // Parse the value into an IpnsEntry - entry := new(pb.IpnsEntry) - err = proto.Unmarshal(value, entry) - if err != nil { - return ErrBadRecord - } - - // Get the public key defined by the ipns path - pid, err := peer.IDFromString(pidString) - if err != nil { - log.Debugf("failed to parse ipns record key %s into peer ID", pidString) - return ErrKeyFormat - } - - pubk, err := v.getPublicKey(pid, entry) - if err != nil { - return err - } - - return Validate(pubk, entry) -} - -func (v Validator) getPublicKey(pid peer.ID, entry *pb.IpnsEntry) (ic.PubKey, error) { - switch pk, err := ExtractPublicKey(pid, entry); err { - case peer.ErrNoPublicKey: - case nil: - return pk, nil - default: - return nil, err - } - - if v.KeyBook == nil { - log.Debugf("public key with hash %s not found in IPNS record and no peer store provided", pid) - return nil, ErrPublicKeyNotFound - } - - pubk := v.KeyBook.PubKey(pid) - if pubk == nil { - log.Debugf("public key with hash %s not found in peer store", pid) - return nil, ErrPublicKeyNotFound - } - return pubk, nil -} - -// Select selects the best record by checking which has the highest sequence -// number and latest EOL. -// -// This function returns an error if any of the records fail to parse. Validate -// your records first! -func (v Validator) Select(k string, vals [][]byte) (int, error) { - var recs []*pb.IpnsEntry - for _, v := range vals { - e := new(pb.IpnsEntry) - if err := proto.Unmarshal(v, e); err != nil { - return -1, err - } - recs = append(recs, e) - } - - return selectRecord(recs, vals) -} - -func selectRecord(recs []*pb.IpnsEntry, vals [][]byte) (int, error) { - switch len(recs) { - case 0: - return -1, errors.New("no usable records in given set") - case 1: - return 0, nil - } - - var i int - for j := 1; j < len(recs); j++ { - cmp, err := Compare(recs[i], recs[j]) - if err != nil { - return -1, err - } - if cmp == 0 { - cmp = bytes.Compare(vals[i], vals[j]) - } - if cmp < 0 { - i = j - } - } - - return i, nil -} diff --git a/vendor/github.com/ipfs/go-log/.travis.yml b/vendor/github.com/ipfs/go-log/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-log/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-log/LICENSE b/vendor/github.com/ipfs/go-log/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/ipfs/go-log/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-log/README.md b/vendor/github.com/ipfs/go-log/README.md deleted file mode 100644 index 344b25a4..00000000 --- a/vendor/github.com/ipfs/go-log/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# go-log - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-log?status.svg)](https://godoc.org/github.com/ipfs/go-log) -[![Build Status](https://travis-ci.org/ipfs/go-log.svg?branch=master)](https://travis-ci.org/ipfs/go-log) - - - - -> The logging library used by go-ipfs - -It currently uses a modified version of [go-logging](https://github.com/whyrusleeping/go-logging) to implement the standard printf-style log output. - -## Install - -```sh -go get github.com/ipfs/go-log -``` - -## Usage - -Once the pacakge is imported under the name `logging`, an instance of `EventLogger` can be created like so: - -```go -var log = logging.Logger("subsystem name") -``` - -It can then be used to emit log messages, either plain printf-style messages at six standard levels or structured messages using `Start`, `StartFromParentState`, `Finish` and `FinishWithErr` methods. - -## Example - -```go -func (s *Session) GetBlock(ctx context.Context, c *cid.Cid) (blk blocks.Block, err error) { - - // Starts Span called "Session.GetBlock", associates with `ctx` - ctx = log.Start(ctx, "Session.GetBlock") - - // defer so `blk` and `err` can be evaluated after call - defer func() { - // tag span associated with `ctx` - log.SetTags(ctx, map[string]interface{}{ - "cid": c, - "block", blk, - }) - // if err is non-nil tag the span with an error - log.FinishWithErr(ctx, err) - }() - - if shouldStartSomething() { - // log message on span associated with `ctx` - log.LogKV(ctx, "startSomething", true) - } - ... -} -``` -## Tracing - -`go-log` wraps the [opentracing-go](https://github.com/opentracing/opentracing-go) methods - `StartSpan`, `Finish`, `LogKV`, and `SetTag`. - -`go-log` implements its own tracer - `loggabletracer` - based on the [basictracer-go](https://github.com/opentracing/basictracer-go) implementation. If there is an active [`WriterGroup`](https://github.com/ipfs/go-log/blob/master/writer/option.go) the `loggabletracer` will [record](https://github.com/ipfs/go-log/blob/master/tracer/recorder.go) span data to the `WriterGroup`. An example of this can be seen in the [`log tail`](https://github.com/ipfs/go-ipfs/blob/master/core/commands/log.go) command of `go-ipfs`. - -Third party tracers may be used by calling `opentracing.SetGlobalTracer()` with your desired tracing implementation. An example of this can be seen using the [`go-jaeger-plugin`](https://github.com/ipfs/go-jaeger-plugin) and the `go-ipfs` [tracer plugin](https://github.com/ipfs/go-ipfs/blob/master/plugin/tracer.go) - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-log/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT diff --git a/vendor/github.com/ipfs/go-log/context.go b/vendor/github.com/ipfs/go-log/context.go deleted file mode 100644 index b8ef5bc8..00000000 --- a/vendor/github.com/ipfs/go-log/context.go +++ /dev/null @@ -1,38 +0,0 @@ -package log - -import ( - "context" - "errors" -) - -type key int - -const metadataKey key = 0 - -// ContextWithLoggable returns a derived context which contains the provided -// Loggable. Any Events logged with the derived context will include the -// provided Loggable. -func ContextWithLoggable(ctx context.Context, l Loggable) context.Context { - existing, err := MetadataFromContext(ctx) - if err != nil { - // context does not contain meta. just set the new metadata - child := context.WithValue(ctx, metadataKey, Metadata(l.Loggable())) - return child - } - - merged := DeepMerge(existing, l.Loggable()) - child := context.WithValue(ctx, metadataKey, merged) - return child -} - -// MetadataFromContext extracts Matadata from a given context's value. -func MetadataFromContext(ctx context.Context) (Metadata, error) { - value := ctx.Value(metadataKey) - if value != nil { - metadata, ok := value.(Metadata) - if ok { - return metadata, nil - } - } - return nil, errors.New("context contains no metadata") -} diff --git a/vendor/github.com/ipfs/go-log/entry.go b/vendor/github.com/ipfs/go-log/entry.go deleted file mode 100644 index 63c02135..00000000 --- a/vendor/github.com/ipfs/go-log/entry.go +++ /dev/null @@ -1,7 +0,0 @@ -package log - -type entry struct { - loggables []Loggable - system string - event string -} diff --git a/vendor/github.com/ipfs/go-log/go.mod b/vendor/github.com/ipfs/go-log/go.mod deleted file mode 100644 index c1716c85..00000000 --- a/vendor/github.com/ipfs/go-log/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/ipfs/go-log - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/mattn/go-colorable v0.1.1 - github.com/opentracing/opentracing-go v1.0.2 - github.com/stretchr/testify v1.3.0 // indirect - github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc - golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 // indirect -) diff --git a/vendor/github.com/ipfs/go-log/go.sum b/vendor/github.com/ipfs/go-log/go.sum deleted file mode 100644 index b9b0dc91..00000000 --- a/vendor/github.com/ipfs/go-log/go.sum +++ /dev/null @@ -1,24 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/ipfs/go-log/log.go b/vendor/github.com/ipfs/go-log/log.go deleted file mode 100644 index 735eebab..00000000 --- a/vendor/github.com/ipfs/go-log/log.go +++ /dev/null @@ -1,404 +0,0 @@ -// Package log is the logging library used by IPFS -// (https://github.com/ipfs/go-ipfs). It uses a modified version of -// https://godoc.org/github.com/whyrusleeping/go-logging . -package log - -import ( - "bytes" - "context" - "encoding/json" - "path" - "runtime" - "time" - - writer "github.com/ipfs/go-log/writer" - - opentrace "github.com/opentracing/opentracing-go" - otExt "github.com/opentracing/opentracing-go/ext" -) - -var log = Logger("eventlog") - -// StandardLogger provides API compatibility with standard printf loggers -// eg. go-logging -type StandardLogger interface { - Debug(args ...interface{}) - Debugf(format string, args ...interface{}) - Error(args ...interface{}) - Errorf(format string, args ...interface{}) - Fatal(args ...interface{}) - Fatalf(format string, args ...interface{}) - Info(args ...interface{}) - Infof(format string, args ...interface{}) - Panic(args ...interface{}) - Panicf(format string, args ...interface{}) - Warning(args ...interface{}) - Warningf(format string, args ...interface{}) -} - -// EventLogger extends the StandardLogger interface to allow for log items -// containing structured metadata -type EventLogger interface { - StandardLogger - - // Event merges structured data from the provided inputs into a single - // machine-readable log event. - // - // If the context contains metadata, a copy of this is used as the base - // metadata accumulator. - // - // If one or more loggable objects are provided, these are deep-merged into base blob. - // - // Next, the event name is added to the blob under the key "event". If - // the key "event" already exists, it will be over-written. - // - // Finally the timestamp and package name are added to the accumulator and - // the metadata is logged. - // DEPRECATED - Event(ctx context.Context, event string, m ...Loggable) - - // DEPRECATED - EventBegin(ctx context.Context, event string, m ...Loggable) *EventInProgress - - // Start starts an opentracing span with `name`, using - // any Span found within `ctx` as a ChildOfRef. If no such parent could be - // found, Start creates a root (parentless) Span. - // - // The return value is a context.Context object built around the - // returned Span. - // - // Example usage: - // - // SomeFunction(ctx context.Context, ...) { - // ctx := log.Start(ctx, "SomeFunction") - // defer log.Finish(ctx) - // ... - // } - Start(ctx context.Context, name string) context.Context - - // StartFromParentState starts an opentracing span with `name`, using - // any Span found within `ctx` as a ChildOfRef. If no such parent could be - // found, StartSpanFromParentState creates a root (parentless) Span. - // - // StartFromParentState will attempt to deserialize a SpanContext from `parent`, - // using any Span found within to continue the trace - // - // The return value is a context.Context object built around the - // returned Span. - // - // An error is returned when `parent` cannot be deserialized to a SpanContext - // - // Example usage: - // - // SomeFunction(ctx context.Context, bParent []byte) { - // ctx := log.StartFromParentState(ctx, "SomeFunction", bParent) - // defer log.Finish(ctx) - // ... - // } - StartFromParentState(ctx context.Context, name string, parent []byte) (context.Context, error) - - // Finish completes the span associated with `ctx`. - // - // Finish() must be the last call made to any span instance, and to do - // otherwise leads to undefined behavior. - // Finish will do its best to notify (log) when used in correctly - // .e.g called twice, or called on a spanless `ctx` - Finish(ctx context.Context) - - // FinishWithErr completes the span associated with `ctx` and also calls - // SetErr if `err` is non-nil - // - // FinishWithErr() must be the last call made to any span instance, and to do - // otherwise leads to undefined behavior. - // FinishWithErr will do its best to notify (log) when used in correctly - // .e.g called twice, or called on a spanless `ctx` - FinishWithErr(ctx context.Context, err error) - - // SetErr tags the span associated with `ctx` to reflect an error occured, and - // logs the value `err` under key `error`. - SetErr(ctx context.Context, err error) - - // LogKV records key:value logging data about an event stored in `ctx` - // Eexample: - // log.LogKV( - // "error", "resolve failure", - // "type", "cache timeout", - // "waited.millis", 1500) - LogKV(ctx context.Context, alternatingKeyValues ...interface{}) - - // SetTag tags key `k` and value `v` on the span associated with `ctx` - SetTag(ctx context.Context, key string, value interface{}) - - // SetTags tags keys from the `tags` maps on the span associated with `ctx` - // Example: - // log.SetTags(ctx, map[string]{ - // "type": bizStruct, - // "request": req, - // }) - SetTags(ctx context.Context, tags map[string]interface{}) - - // SerializeContext takes the SpanContext instance stored in `ctx` and Seralizes - // it to bytes. An error is returned if the `ctx` cannot be serialized to - // a bytes array - SerializeContext(ctx context.Context) ([]byte, error) -} - -// Logger retrieves an event logger by name -func Logger(system string) EventLogger { - - // TODO if we would like to adjust log levels at run-time. Store this event - // logger in a map (just like the util.Logger impl) - if len(system) == 0 { - setuplog := getLogger("setup-logger") - setuplog.Warning("Missing name parameter") - system = "undefined" - } - - logger := getLogger(system) - - return &eventLogger{system: system, StandardLogger: logger} -} - -// eventLogger implements the EventLogger and wraps a go-logging Logger -type eventLogger struct { - StandardLogger - - system string - // TODO add log-level -} - -func (el *eventLogger) Start(ctx context.Context, operationName string) context.Context { - span, ctx := opentrace.StartSpanFromContext(ctx, operationName) - span.SetTag("system", el.system) - return ctx -} - -func (el *eventLogger) StartFromParentState(ctx context.Context, operationName string, parent []byte) (context.Context, error) { - sc, err := deserializeContext(parent) - if err != nil { - return nil, err - } - - //TODO RPCServerOption is probably not the best tag, as this is likely from a peer - span, ctx := opentrace.StartSpanFromContext(ctx, operationName, otExt.RPCServerOption(sc)) - span.SetTag("system", el.system) - return ctx, nil -} - -func (el *eventLogger) SerializeContext(ctx context.Context) ([]byte, error) { - gTracer := opentrace.GlobalTracer() - b := make([]byte, 0) - carrier := bytes.NewBuffer(b) - span := opentrace.SpanFromContext(ctx) - if err := gTracer.Inject(span.Context(), opentrace.Binary, carrier); err != nil { - return nil, err - } - return carrier.Bytes(), nil -} - -func (el *eventLogger) LogKV(ctx context.Context, alternatingKeyValues ...interface{}) { - span := opentrace.SpanFromContext(ctx) - if span == nil { - _, file, line, _ := runtime.Caller(1) - log.Errorf("LogKV with no Span in context called on %s:%d", path.Base(file), line) - return - } - span.LogKV(alternatingKeyValues...) -} - -func (el *eventLogger) SetTag(ctx context.Context, k string, v interface{}) { - span := opentrace.SpanFromContext(ctx) - if span == nil { - _, file, line, _ := runtime.Caller(1) - log.Errorf("SetTag with no Span in context called on %s:%d", path.Base(file), line) - return - } - span.SetTag(k, v) -} - -func (el *eventLogger) SetTags(ctx context.Context, tags map[string]interface{}) { - span := opentrace.SpanFromContext(ctx) - if span == nil { - _, file, line, _ := runtime.Caller(1) - log.Errorf("SetTags with no Span in context called on %s:%d", path.Base(file), line) - return - } - for k, v := range tags { - span.SetTag(k, v) - } -} - -func (el *eventLogger) setErr(ctx context.Context, err error, skip int) { - span := opentrace.SpanFromContext(ctx) - if span == nil { - _, file, line, _ := runtime.Caller(skip) - log.Errorf("SetErr with no Span in context called on %s:%d", path.Base(file), line) - return - } - if err == nil { - return - } - - otExt.Error.Set(span, true) - span.LogKV("error", err.Error()) -} - -func (el *eventLogger) SetErr(ctx context.Context, err error) { - el.setErr(ctx, err, 1) -} - -func (el *eventLogger) Finish(ctx context.Context) { - span := opentrace.SpanFromContext(ctx) - if span == nil { - _, file, line, _ := runtime.Caller(1) - log.Errorf("Finish with no Span in context called on %s:%d", path.Base(file), line) - return - } - span.Finish() -} - -func (el *eventLogger) FinishWithErr(ctx context.Context, err error) { - el.setErr(ctx, err, 2) - el.Finish(ctx) -} - -func deserializeContext(bCtx []byte) (opentrace.SpanContext, error) { - gTracer := opentrace.GlobalTracer() - carrier := bytes.NewReader(bCtx) - spanContext, err := gTracer.Extract(opentrace.Binary, carrier) - if err != nil { - log.Warning("Failed to deserialize context %s", err) - return nil, err - } - return spanContext, nil -} - -// DEPRECATED use `Start` -func (el *eventLogger) EventBegin(ctx context.Context, event string, metadata ...Loggable) *EventInProgress { - ctx = el.Start(ctx, event) - - for _, m := range metadata { - for l, v := range m.Loggable() { - el.LogKV(ctx, l, v) - } - } - - eip := &EventInProgress{} - eip.doneFunc = func(additional []Loggable) { - // anything added during the operation - // e.g. deprecated methods event.Append(...) or event.SetError(...) - for _, m := range eip.loggables { - for l, v := range m.Loggable() { - el.LogKV(ctx, l, v) - } - } - el.Finish(ctx) - } - return eip -} - -type activeEventKeyType struct{} - -var activeEventKey = activeEventKeyType{} - -// DEPRECATED use `Start` -func (el *eventLogger) Event(ctx context.Context, event string, metadata ...Loggable) { - - // short circuit if theres nothing to write to - if !writer.WriterGroup.Active() { - return - } - - // Collect loggables for later logging - var loggables []Loggable - - // get any existing metadata from the context - existing, err := MetadataFromContext(ctx) - if err != nil { - existing = Metadata{} - } - loggables = append(loggables, existing) - - for _, datum := range metadata { - loggables = append(loggables, datum) - } - - e := entry{ - loggables: loggables, - system: el.system, - event: event, - } - - accum := Metadata{} - for _, loggable := range e.loggables { - accum = DeepMerge(accum, loggable.Loggable()) - } - - // apply final attributes to reserved keys - // TODO accum["level"] = level - accum["event"] = e.event - accum["system"] = e.system - accum["time"] = FormatRFC3339(time.Now()) - - var buf bytes.Buffer - encoder := json.NewEncoder(&buf) - encoder.SetEscapeHTML(false) - err = encoder.Encode(accum) - if err != nil { - el.Errorf("ERROR FORMATTING EVENT ENTRY: %s", err) - return - } - - writer.WriterGroup.Write(buf.Bytes()) -} - -// DEPRECATED -// EventInProgress represent and event which is happening -type EventInProgress struct { - loggables []Loggable - doneFunc func([]Loggable) -} - -// DEPRECATED use `LogKV` or `SetTag` -// Append adds loggables to be included in the call to Done -func (eip *EventInProgress) Append(l Loggable) { - eip.loggables = append(eip.loggables, l) -} - -// DEPRECATED use `SetError(ctx, error)` -// SetError includes the provided error -func (eip *EventInProgress) SetError(err error) { - eip.loggables = append(eip.loggables, LoggableMap{ - "error": err.Error(), - }) -} - -// DEPRECATED use `Finish` -// Done creates a new Event entry that includes the duration and appended -// loggables. -func (eip *EventInProgress) Done() { - eip.doneFunc(eip.loggables) // create final event with extra data -} - -// DEPRECATED use `FinishWithErr` -// DoneWithErr creates a new Event entry that includes the duration and appended -// loggables. DoneWithErr accepts an error, if err is non-nil, it is set on -// the EventInProgress. Otherwise the logic is the same as the `Done()` method -func (eip *EventInProgress) DoneWithErr(err error) { - if err != nil { - eip.SetError(err) - } - eip.doneFunc(eip.loggables) -} - -// DEPRECATED use `Finish` -// Close is an alias for done -func (eip *EventInProgress) Close() error { - eip.Done() - return nil -} - -// FormatRFC3339 returns the given time in UTC with RFC3999Nano format. -func FormatRFC3339(t time.Time) string { - return t.UTC().Format(time.RFC3339Nano) -} diff --git a/vendor/github.com/ipfs/go-log/loggable.go b/vendor/github.com/ipfs/go-log/loggable.go deleted file mode 100644 index f4edb268..00000000 --- a/vendor/github.com/ipfs/go-log/loggable.go +++ /dev/null @@ -1,42 +0,0 @@ -package log - -// Loggable describes objects that can be marshalled into Metadata for logging -type Loggable interface { - Loggable() map[string]interface{} -} - -// LoggableMap is just a generic map keyed by string. It -// implements the Loggable interface. -type LoggableMap map[string]interface{} - -// Loggable implements the Loggable interface for LoggableMap -func (l LoggableMap) Loggable() map[string]interface{} { - return l -} - -// LoggableF converts a func into a Loggable -type LoggableF func() map[string]interface{} - -// Loggable implements the Loggable interface by running -// the LoggableF function. -func (l LoggableF) Loggable() map[string]interface{} { - return l() -} - -// Deferred returns a LoggableF where the execution of the -// provided function is deferred. -func Deferred(key string, f func() string) Loggable { - function := func() map[string]interface{} { - return map[string]interface{}{ - key: f(), - } - } - return LoggableF(function) -} - -// Pair returns a Loggable where key is paired to Loggable. -func Pair(key string, l Loggable) Loggable { - return LoggableMap{ - key: l, - } -} diff --git a/vendor/github.com/ipfs/go-log/metadata.go b/vendor/github.com/ipfs/go-log/metadata.go deleted file mode 100644 index 07947b54..00000000 --- a/vendor/github.com/ipfs/go-log/metadata.go +++ /dev/null @@ -1,77 +0,0 @@ -package log - -import ( - "encoding/json" - "errors" - "reflect" -) - -// Metadata is a convenience type for generic maps -type Metadata map[string]interface{} - -// DeepMerge merges the second Metadata parameter into the first. -// Nested Metadata are merged recursively. Primitives are over-written. -func DeepMerge(b, a Metadata) Metadata { - out := Metadata{} - for k, v := range b { - out[k] = v - } - for k, v := range a { - - maybe, err := Metadatify(v) - if err != nil { - // if the new value is not meta. just overwrite the dest vaue - if out[k] != nil { - log.Debugf("Overwriting key: %s, old: %s, new: %s", k, out[k], v) - } - out[k] = v - continue - } - - // it is meta. What about dest? - outv, exists := out[k] - if !exists { - // the new value is meta, but there's no dest value. just write it - out[k] = v - continue - } - - outMetadataValue, err := Metadatify(outv) - if err != nil { - // the new value is meta and there's a dest value, but the dest - // value isn't meta. just overwrite - out[k] = v - continue - } - - // both are meta. merge them. - out[k] = DeepMerge(outMetadataValue, maybe) - } - return out -} - -// Loggable implements the Loggable interface. -func (m Metadata) Loggable() map[string]interface{} { - // NB: method defined on value to avoid de-referencing nil Metadata - return m -} - -// JsonString returns the marshaled JSON string for the metadata. -func (m Metadata) JsonString() (string, error) { - // NB: method defined on value - b, err := json.Marshal(m) - return string(b), err -} - -// Metadatify converts maps into Metadata. -func Metadatify(i interface{}) (Metadata, error) { - value := reflect.ValueOf(i) - if value.Kind() == reflect.Map { - m := map[string]interface{}{} - for _, k := range value.MapKeys() { - m[k.String()] = value.MapIndex(k).Interface() - } - return Metadata(m), nil - } - return nil, errors.New("is not a map") -} diff --git a/vendor/github.com/ipfs/go-log/oldlog.go b/vendor/github.com/ipfs/go-log/oldlog.go deleted file mode 100644 index c09ec849..00000000 --- a/vendor/github.com/ipfs/go-log/oldlog.go +++ /dev/null @@ -1,177 +0,0 @@ -package log - -import ( - "errors" - "fmt" - "os" - "sync" - - tracer "github.com/ipfs/go-log/tracer" - lwriter "github.com/ipfs/go-log/writer" - - colorable "github.com/mattn/go-colorable" - opentrace "github.com/opentracing/opentracing-go" - logging "github.com/whyrusleeping/go-logging" -) - -func init() { - SetupLogging() -} - -var ansiGray = "\033[0;37m" -var ansiBlue = "\033[0;34m" - -// LogFormats defines formats for logging (i.e. "color") -var LogFormats = map[string]string{ - "nocolor": "%{time:2006-01-02 15:04:05.000000} %{level} %{module} %{shortfile}: %{message}", - "color": ansiGray + "%{time:15:04:05.000} %{color}%{level:5.5s} " + ansiBlue + - "%{module:10.10s}: %{color:reset}%{message} " + ansiGray + "%{shortfile}%{color:reset}", -} - -var defaultLogFormat = "color" - -// Logging environment variables -const ( - // TODO these env names should be more general, IPFS is not the only project to - // use go-log - envLogging = "IPFS_LOGGING" - envLoggingFmt = "IPFS_LOGGING_FMT" - - envLoggingFile = "GOLOG_FILE" // /path/to/file - envTracingFile = "GOLOG_TRACING_FILE" // /path/to/file -) - -// ErrNoSuchLogger is returned when the util pkg is asked for a non existant logger -var ErrNoSuchLogger = errors.New("Error: No such logger") - -// loggers is the set of loggers in the system -var loggerMutex sync.RWMutex -var loggers = map[string]*logging.Logger{} - -// SetupLogging will initialize the logger backend and set the flags. -// TODO calling this in `init` pushes all configuration to env variables -// - move it out of `init`? then we need to change all the code (js-ipfs, go-ipfs) to call this explicitly -// - have it look for a config file? need to define what that is -func SetupLogging() { - - // colorful or plain - lfmt := LogFormats[os.Getenv(envLoggingFmt)] - if lfmt == "" { - lfmt = LogFormats[defaultLogFormat] - } - - // check if we log to a file - var lgbe []logging.Backend - if logfp := os.Getenv(envLoggingFile); len(logfp) > 0 { - f, err := os.Create(logfp) - if err != nil { - fmt.Fprintf(os.Stderr, "ERROR go-log: %s: failed to set logging file backend\n", err) - } else { - lgbe = append(lgbe, logging.NewLogBackend(f, "", 0)) - } - } - - // logs written to stderr - lgbe = append(lgbe, logging.NewLogBackend(colorable.NewColorableStderr(), "", 0)) - - // set the backend(s) - logging.SetBackend(lgbe...) - logging.SetFormatter(logging.MustStringFormatter(lfmt)) - - lvl := logging.ERROR - - if logenv := os.Getenv(envLogging); logenv != "" { - var err error - lvl, err = logging.LogLevel(logenv) - if err != nil { - fmt.Println("error setting log levels", err) - } - } - - // TracerPlugins are instantiated after this, so use loggable tracer - // by default, if a TracerPlugin is added it will override this - lgblRecorder := tracer.NewLoggableRecorder() - lgblTracer := tracer.New(lgblRecorder) - opentrace.SetGlobalTracer(lgblTracer) - - SetAllLoggers(lvl) - - if tracingfp := os.Getenv(envTracingFile); len(tracingfp) > 0 { - f, err := os.Create(tracingfp) - if err != nil { - log.Error("failed to create tracing file: %s", tracingfp) - } else { - lwriter.WriterGroup.AddWriter(f) - } - } -} - -// SetDebugLogging calls SetAllLoggers with logging.DEBUG -func SetDebugLogging() { - SetAllLoggers(logging.DEBUG) -} - -// SetAllLoggers changes the logging.Level of all loggers to lvl -func SetAllLoggers(lvl logging.Level) { - logging.SetLevel(lvl, "") - - loggerMutex.RLock() - defer loggerMutex.RUnlock() - - for n := range loggers { - logging.SetLevel(lvl, n) - } -} - -// SetLogLevel changes the log level of a specific subsystem -// name=="*" changes all subsystems -func SetLogLevel(name, level string) error { - lvl, err := logging.LogLevel(level) - if err != nil { - return err - } - - // wildcard, change all - if name == "*" { - SetAllLoggers(lvl) - return nil - } - - loggerMutex.RLock() - defer loggerMutex.RUnlock() - - // Check if we have a logger by that name - if _, ok := loggers[name]; !ok { - return ErrNoSuchLogger - } - - logging.SetLevel(lvl, name) - - return nil -} - -// GetSubsystems returns a slice containing the -// names of the current loggers -func GetSubsystems() []string { - loggerMutex.RLock() - defer loggerMutex.RUnlock() - subs := make([]string, 0, len(loggers)) - - for k := range loggers { - subs = append(subs, k) - } - return subs -} - -func getLogger(name string) *logging.Logger { - loggerMutex.Lock() - defer loggerMutex.Unlock() - - log := loggers[name] - if log == nil { - log = logging.MustGetLogger(name) - loggers[name] = log - } - - return log -} diff --git a/vendor/github.com/ipfs/go-log/package.json b/vendor/github.com/ipfs/go-log/package.json deleted file mode 100644 index adcf8cd0..00000000 --- a/vendor/github.com/ipfs/go-log/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/ipfs/go-log" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-log" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmcaSwFc5RBg8yCq54QURwEU4nwjfCpjbpmaAm4VbdGLKv", - "name": "go-logging", - "version": "0.0.0" - }, - { - "author": "frist", - "hash": "QmWLWmRVSiagqP15jczsGME1qpob6HDbtbHAY2he9W5iUo", - "name": "opentracing-go", - "version": "0.0.3" - }, - { - "author": "mattn", - "hash": "QmTsHcKgTQ4VeYZd8eKYpTXeLW7KNwkRD9wjnrwsV2sToq", - "name": "go-colorable", - "version": "0.2.0" - }, - { - "author": "whyrusleeping", - "hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB", - "name": "gogo-protobuf", - "version": "1.2.1" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-log", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.5.9" -} - diff --git a/vendor/github.com/ipfs/go-log/tracer/LICENSE b/vendor/github.com/ipfs/go-log/tracer/LICENSE deleted file mode 100644 index 148509a4..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 The OpenTracing Authors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-log/tracer/context.go b/vendor/github.com/ipfs/go-log/tracer/context.go deleted file mode 100644 index f1ebf61f..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/context.go +++ /dev/null @@ -1,42 +0,0 @@ -package loggabletracer - -// SpanContext holds the basic Span metadata. -type SpanContext struct { - // A probabilistically unique identifier for a [multi-span] trace. - TraceID uint64 - - // A probabilistically unique identifier for a span. - SpanID uint64 - - // Whether the trace is sampled. - Sampled bool - - // The span's associated baggage. - Baggage map[string]string // initialized on first use -} - -// ForeachBaggageItem belongs to the opentracing.SpanContext interface -func (c SpanContext) ForeachBaggageItem(handler func(k, v string) bool) { - for k, v := range c.Baggage { - if !handler(k, v) { - break - } - } -} - -// WithBaggageItem returns an entirely new loggabletracer SpanContext with the -// given key:value baggage pair set. -func (c SpanContext) WithBaggageItem(key, val string) SpanContext { - var newBaggage map[string]string - if c.Baggage == nil { - newBaggage = map[string]string{key: val} - } else { - newBaggage = make(map[string]string, len(c.Baggage)+1) - for k, v := range c.Baggage { - newBaggage[k] = v - } - newBaggage[key] = val - } - // Use positional parameters so the compiler will help catch new fields. - return SpanContext{c.TraceID, c.SpanID, c.Sampled, newBaggage} -} diff --git a/vendor/github.com/ipfs/go-log/tracer/debug.go b/vendor/github.com/ipfs/go-log/tracer/debug.go deleted file mode 100644 index 8c302b37..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/debug.go +++ /dev/null @@ -1,78 +0,0 @@ -package loggabletracer - -import ( - "bytes" - "fmt" - "runtime" - "strconv" - "sync" -) - -const debugGoroutineIDTag = "_initial_goroutine" - -type errAssertionFailed struct { - span *spanImpl - msg string -} - -// Error implements the error interface. -func (err *errAssertionFailed) Error() string { - return fmt.Sprintf("%s:\n%+v", err.msg, err.span) -} - -func (s *spanImpl) Lock() { - s.Mutex.Lock() - s.maybeAssertSanityLocked() -} - -func (s *spanImpl) maybeAssertSanityLocked() { - if s.tracer == nil { - s.Mutex.Unlock() - panic(&errAssertionFailed{span: s, msg: "span used after call to Finish()"}) - } - if s.tracer.options.DebugAssertSingleGoroutine { - startID := curGoroutineID() - curID, ok := s.raw.Tags[debugGoroutineIDTag].(uint64) - if !ok { - // This is likely invoked in the context of the SetTag which sets - // debugGoroutineTag. - return - } - if startID != curID { - s.Mutex.Unlock() - panic(&errAssertionFailed{ - span: s, - msg: fmt.Sprintf("span started on goroutine %d, but now running on %d", startID, curID), - }) - } - } -} - -var goroutineSpace = []byte("goroutine ") -var littleBuf = sync.Pool{ - New: func() interface{} { - buf := make([]byte, 64) - return &buf - }, -} - -// Credit to @bradfitz: -// https://github.com/golang/net/blob/master/http2/gotrack.go#L51 -func curGoroutineID() uint64 { - bp := littleBuf.Get().(*[]byte) - defer littleBuf.Put(bp) - b := *bp - b = b[:runtime.Stack(b, false)] - // Parse the 4707 out of "goroutine 4707 [" - b = bytes.TrimPrefix(b, goroutineSpace) - i := bytes.IndexByte(b, ' ') - if i < 0 { - panic(fmt.Sprintf("No space found in %q", b)) - } - b = b[:i] - n, err := strconv.ParseUint(string(b), 10, 64) - if err != nil { - panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", b, err)) - } - return n -} diff --git a/vendor/github.com/ipfs/go-log/tracer/event.go b/vendor/github.com/ipfs/go-log/tracer/event.go deleted file mode 100644 index 9dbcb76a..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/event.go +++ /dev/null @@ -1,62 +0,0 @@ -package loggabletracer - -import "github.com/opentracing/opentracing-go" - -// A SpanEvent is emitted when a mutating command is called on a Span. -type SpanEvent interface{} - -// EventCreate is emitted when a Span is created. -type EventCreate struct{ OperationName string } - -// EventTag is received when SetTag is called. -type EventTag struct { - Key string - Value interface{} -} - -// EventBaggage is received when SetBaggageItem is called. -type EventBaggage struct { - Key, Value string -} - -// EventLogFields is received when LogFields or LogKV is called. -type EventLogFields opentracing.LogRecord - -// EventLog is received when Log (or one of its derivatives) is called. -// -// DEPRECATED -type EventLog opentracing.LogData - -// EventFinish is received when Finish is called. -type EventFinish RawSpan - -func (s *spanImpl) onCreate(opName string) { - if s.event != nil { - s.event(EventCreate{OperationName: opName}) - } -} -func (s *spanImpl) onTag(key string, value interface{}) { - if s.event != nil { - s.event(EventTag{Key: key, Value: value}) - } -} -func (s *spanImpl) onLog(ld opentracing.LogData) { - if s.event != nil { - s.event(EventLog(ld)) - } -} -func (s *spanImpl) onLogFields(lr opentracing.LogRecord) { - if s.event != nil { - s.event(EventLogFields(lr)) - } -} -func (s *spanImpl) onBaggage(key, value string) { - if s.event != nil { - s.event(EventBaggage{Key: key, Value: value}) - } -} -func (s *spanImpl) onFinish(sp RawSpan) { - if s.event != nil { - s.event(EventFinish(sp)) - } -} diff --git a/vendor/github.com/ipfs/go-log/tracer/propagation.go b/vendor/github.com/ipfs/go-log/tracer/propagation.go deleted file mode 100644 index bb210659..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/propagation.go +++ /dev/null @@ -1,61 +0,0 @@ -package loggabletracer - -import opentracing "github.com/opentracing/opentracing-go" - -type accessorPropagator struct { - tracer *LoggableTracer -} - -// DelegatingCarrier is a flexible carrier interface which can be implemented -// by types which have a means of storing the trace metadata and already know -// how to serialize themselves (for example, protocol buffers). -type DelegatingCarrier interface { - SetState(traceID, spanID uint64, sampled bool) - State() (traceID, spanID uint64, sampled bool) - SetBaggageItem(key, value string) - GetBaggage(func(key, value string)) -} - -func (p *accessorPropagator) Inject( - spanContext opentracing.SpanContext, - carrier interface{}, -) error { - dc, ok := carrier.(DelegatingCarrier) - if !ok || dc == nil { - return opentracing.ErrInvalidCarrier - } - sc, ok := spanContext.(SpanContext) - if !ok { - return opentracing.ErrInvalidSpanContext - } - dc.SetState(sc.TraceID, sc.SpanID, sc.Sampled) - for k, v := range sc.Baggage { - dc.SetBaggageItem(k, v) - } - return nil -} - -func (p *accessorPropagator) Extract( - carrier interface{}, -) (opentracing.SpanContext, error) { - dc, ok := carrier.(DelegatingCarrier) - if !ok || dc == nil { - return nil, opentracing.ErrInvalidCarrier - } - - traceID, spanID, sampled := dc.State() - sc := SpanContext{ - TraceID: traceID, - SpanID: spanID, - Sampled: sampled, - Baggage: nil, - } - dc.GetBaggage(func(k, v string) { - if sc.Baggage == nil { - sc.Baggage = map[string]string{} - } - sc.Baggage[k] = v - }) - - return sc, nil -} diff --git a/vendor/github.com/ipfs/go-log/tracer/propagation_ot.go b/vendor/github.com/ipfs/go-log/tracer/propagation_ot.go deleted file mode 100644 index 4a4782ea..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/propagation_ot.go +++ /dev/null @@ -1,180 +0,0 @@ -package loggabletracer - -import ( - "encoding/binary" - "io" - "strconv" - "strings" - - "github.com/gogo/protobuf/proto" - "github.com/ipfs/go-log/tracer/wire" - opentracing "github.com/opentracing/opentracing-go" -) - -type textMapPropagator struct { - tracer *LoggableTracer -} -type binaryPropagator struct { - tracer *LoggableTracer -} - -const ( - prefixTracerState = "ot-tracer-" - prefixBaggage = "ot-baggage-" - - tracerStateFieldCount = 3 - fieldNameTraceID = prefixTracerState + "traceid" - fieldNameSpanID = prefixTracerState + "spanid" - fieldNameSampled = prefixTracerState + "sampled" -) - -func (p *textMapPropagator) Inject( - spanContext opentracing.SpanContext, - opaqueCarrier interface{}, -) error { - sc, ok := spanContext.(SpanContext) - if !ok { - return opentracing.ErrInvalidSpanContext - } - carrier, ok := opaqueCarrier.(opentracing.TextMapWriter) - if !ok { - return opentracing.ErrInvalidCarrier - } - carrier.Set(fieldNameTraceID, strconv.FormatUint(sc.TraceID, 16)) - carrier.Set(fieldNameSpanID, strconv.FormatUint(sc.SpanID, 16)) - carrier.Set(fieldNameSampled, strconv.FormatBool(sc.Sampled)) - - for k, v := range sc.Baggage { - carrier.Set(prefixBaggage+k, v) - } - return nil -} - -func (p *textMapPropagator) Extract( - opaqueCarrier interface{}, -) (opentracing.SpanContext, error) { - carrier, ok := opaqueCarrier.(opentracing.TextMapReader) - if !ok { - return nil, opentracing.ErrInvalidCarrier - } - requiredFieldCount := 0 - var traceID, spanID uint64 - var sampled bool - var err error - decodedBaggage := make(map[string]string) - err = carrier.ForeachKey(func(k, v string) error { - switch strings.ToLower(k) { - case fieldNameTraceID: - traceID, err = strconv.ParseUint(v, 16, 64) - if err != nil { - return opentracing.ErrSpanContextCorrupted - } - case fieldNameSpanID: - spanID, err = strconv.ParseUint(v, 16, 64) - if err != nil { - return opentracing.ErrSpanContextCorrupted - } - case fieldNameSampled: - sampled, err = strconv.ParseBool(v) - if err != nil { - return opentracing.ErrSpanContextCorrupted - } - default: - lowercaseK := strings.ToLower(k) - if strings.HasPrefix(lowercaseK, prefixBaggage) { - decodedBaggage[strings.TrimPrefix(lowercaseK, prefixBaggage)] = v - } - // Balance off the requiredFieldCount++ just below... - requiredFieldCount-- - } - requiredFieldCount++ - return nil - }) - if err != nil { - return nil, err - } - if requiredFieldCount < tracerStateFieldCount { - if requiredFieldCount == 0 { - return nil, opentracing.ErrSpanContextNotFound - } - return nil, opentracing.ErrSpanContextCorrupted - } - - return SpanContext{ - TraceID: traceID, - SpanID: spanID, - Sampled: sampled, - Baggage: decodedBaggage, - }, nil -} - -func (p *binaryPropagator) Inject( - spanContext opentracing.SpanContext, - opaqueCarrier interface{}, -) error { - sc, ok := spanContext.(SpanContext) - if !ok { - return opentracing.ErrInvalidSpanContext - } - carrier, ok := opaqueCarrier.(io.Writer) - if !ok { - return opentracing.ErrInvalidCarrier - } - - state := wire.TracerState{} - state.TraceId = sc.TraceID - state.SpanId = sc.SpanID - state.Sampled = sc.Sampled - state.BaggageItems = sc.Baggage - - b, err := proto.Marshal(&state) - if err != nil { - return err - } - - // Write the length of the marshalled binary to the writer. - length := uint32(len(b)) - if err := binary.Write(carrier, binary.BigEndian, &length); err != nil { - return err - } - - _, err = carrier.Write(b) - return err -} - -func (p *binaryPropagator) Extract( - opaqueCarrier interface{}, -) (opentracing.SpanContext, error) { - carrier, ok := opaqueCarrier.(io.Reader) - if !ok { - return nil, opentracing.ErrInvalidCarrier - } - - // Read the length of marshalled binary. io.ReadAll isn't that performant - // since it keeps resizing the underlying buffer as it encounters more bytes - // to read. By reading the length, we can allocate a fixed sized buf and read - // the exact amount of bytes into it. - var length uint32 - if err := binary.Read(carrier, binary.BigEndian, &length); err != nil { - return nil, opentracing.ErrSpanContextCorrupted - } - buf := make([]byte, length) - if n, err := carrier.Read(buf); err != nil { - if n > 0 { - return nil, opentracing.ErrSpanContextCorrupted - } - return nil, opentracing.ErrSpanContextNotFound - } - - ctx := wire.TracerState{} - if err := proto.Unmarshal(buf, &ctx); err != nil { - return nil, opentracing.ErrSpanContextCorrupted - } - - return SpanContext{ - TraceID: ctx.TraceId, - SpanID: ctx.SpanId, - Sampled: ctx.Sampled, - Baggage: ctx.BaggageItems, - }, nil -} diff --git a/vendor/github.com/ipfs/go-log/tracer/raw.go b/vendor/github.com/ipfs/go-log/tracer/raw.go deleted file mode 100644 index 75945427..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/raw.go +++ /dev/null @@ -1,34 +0,0 @@ -package loggabletracer - -import ( - "time" - - opentracing "github.com/opentracing/opentracing-go" -) - -// RawSpan encapsulates all state associated with a (finished) Span. -type RawSpan struct { - // Those recording the RawSpan should also record the contents of its - // SpanContext. - Context SpanContext - - // The SpanID of this SpanContext's first intra-trace reference (i.e., - // "parent"), or 0 if there is no parent. - ParentSpanID uint64 - - // The name of the "operation" this span is an instance of. (Called a "span - // name" in some implementations) - Operation string - - // We store rather than so that only - // one of the timestamps has global clock uncertainty issues. - Start time.Time - Duration time.Duration - - // Essentially an extension mechanism. Can be used for many purposes, - // not to be enumerated here. - Tags opentracing.Tags - - // The span's "microlog". - Logs []opentracing.LogRecord -} diff --git a/vendor/github.com/ipfs/go-log/tracer/recorder.go b/vendor/github.com/ipfs/go-log/tracer/recorder.go deleted file mode 100644 index f298d639..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/recorder.go +++ /dev/null @@ -1,103 +0,0 @@ -package loggabletracer - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "os" - "time" - - writer "github.com/ipfs/go-log/writer" - opentrace "github.com/opentracing/opentracing-go" -) - -// A SpanRecorder handles all of the `RawSpan` data generated via an -// associated `Tracer` (see `NewStandardTracer`) instance. It also names -// the containing process and provides access to a straightforward tag map. -type SpanRecorder interface { - // Implementations must determine whether and where to store `span`. - RecordSpan(span RawSpan) -} - -type LoggableSpanRecorder struct{} - -// NewLoggableRecorder creates new LoggableSpanRecorder -func NewLoggableRecorder() *LoggableSpanRecorder { - return new(LoggableSpanRecorder) -} - -// Loggable Representation of a span, treated as an event log -type LoggableSpan struct { - TraceID uint64 `json:"TraceID"` - SpanID uint64 `json:"SpanID"` - ParentSpanID uint64 `json:"ParentSpanID"` - Operation string `json:"Operation"` - Start time.Time `json:"Start"` - Duration time.Duration `json:"Duration"` - Tags opentrace.Tags `json:"Tags"` - Logs []SpanLog `json:"Logs"` -} - -type SpanLog struct { - Timestamp time.Time `json:"Timestamp"` - Field []SpanField `json:"Fields"` -} - -type SpanField struct { - Key string `json:"Key"` - Value string `json:"Value"` -} - -// RecordSpan implements the respective method of SpanRecorder. -func (r *LoggableSpanRecorder) RecordSpan(span RawSpan) { - // short circuit if theres nothing to write to - if !writer.WriterGroup.Active() { - return - } - - sl := make([]SpanLog, len(span.Logs)) - for i := range span.Logs { - sl[i].Timestamp = span.Logs[i].Timestamp - sf := make([]SpanField, len(span.Logs[i].Fields)) - sl[i].Field = sf - for j := range span.Logs[i].Fields { - sf[j].Key = span.Logs[i].Fields[j].Key() - sf[j].Value = fmt.Sprint(span.Logs[i].Fields[j].Value()) - } - } - - tags := make(map[string]interface{}, len(span.Tags)) - for k, v := range span.Tags { - switch vt := v.(type) { - case bool, string, int, int8, int16, int32, int64, uint, uint8, uint16, uint64: - tags[k] = v - case []byte: - base64.StdEncoding.EncodeToString(vt) - default: - tags[k] = fmt.Sprint(v) - } - } - - spanlog := &LoggableSpan{ - TraceID: span.Context.TraceID, - SpanID: span.Context.SpanID, - ParentSpanID: span.ParentSpanID, - Operation: span.Operation, - Start: span.Start, - Duration: span.Duration, - Tags: tags, - Logs: sl, - } - - var buf bytes.Buffer - encoder := json.NewEncoder(&buf) - encoder.SetEscapeHTML(false) - err := encoder.Encode(spanlog) - if err != nil { - fmt.Fprintf(os.Stderr, "ERROR FORMATTING SPAN ENTRY: %s\n", err) - return - } - - writer.WriterGroup.Write(buf.Bytes()) -} diff --git a/vendor/github.com/ipfs/go-log/tracer/span.go b/vendor/github.com/ipfs/go-log/tracer/span.go deleted file mode 100644 index a23a57c3..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/span.go +++ /dev/null @@ -1,274 +0,0 @@ -package loggabletracer - -import ( - "sync" - "time" - - opentracing "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/ext" - "github.com/opentracing/opentracing-go/log" -) - -// Span provides access to the essential details of the span, for use -// by loggabletracer consumers. These methods may only be called prior -// to (*opentracing.Span).Finish(). -type Span interface { - opentracing.Span - - // Operation names the work done by this span instance - Operation() string - - // Start indicates when the span began - Start() time.Time -} - -// Implements the `Span` interface. Created via LoggableTracer (see -// `loggabletracer.New()`). -type spanImpl struct { - tracer *LoggableTracer - event func(SpanEvent) - sync.Mutex // protects the fields below - raw RawSpan - // The number of logs dropped because of MaxLogsPerSpan. - numDroppedLogs int -} - -var spanPool = &sync.Pool{New: func() interface{} { - return &spanImpl{} -}} - -func (s *spanImpl) reset() { - s.tracer, s.event = nil, nil - // Note: Would like to do the following, but then the consumer of RawSpan - // (the recorder) needs to make sure that they're not holding on to the - // baggage or logs when they return (i.e. they need to copy if they care): - // - // logs, baggage := s.raw.Logs[:0], s.raw.Baggage - // for k := range baggage { - // delete(baggage, k) - // } - // s.raw.Logs, s.raw.Baggage = logs, baggage - // - // That's likely too much to ask for. But there is some magic we should - // be able to do with `runtime.SetFinalizer` to reclaim that memory into - // a buffer pool when GC considers them unreachable, which should ease - // some of the load. Hard to say how quickly that would be in practice - // though. - s.raw = RawSpan{ - Context: SpanContext{}, - } -} - -func (s *spanImpl) SetOperationName(operationName string) opentracing.Span { - s.Lock() - defer s.Unlock() - s.raw.Operation = operationName - return s -} - -func (s *spanImpl) trim() bool { - return !s.raw.Context.Sampled && s.tracer.options.TrimUnsampledSpans -} - -func (s *spanImpl) SetTag(key string, value interface{}) opentracing.Span { - defer s.onTag(key, value) - s.Lock() - defer s.Unlock() - if key == string(ext.SamplingPriority) { - if v, ok := value.(uint16); ok { - s.raw.Context.Sampled = v != 0 - return s - } - } - if s.trim() { - return s - } - - if s.raw.Tags == nil { - s.raw.Tags = opentracing.Tags{} - } - s.raw.Tags[key] = value - return s -} - -func (s *spanImpl) LogKV(keyValues ...interface{}) { - fields, err := log.InterleavedKVToFields(keyValues...) - if err != nil { - s.LogFields(log.Error(err), log.String("function", "LogKV")) - return - } - s.LogFields(fields...) -} - -func (s *spanImpl) appendLog(lr opentracing.LogRecord) { - maxLogs := s.tracer.options.MaxLogsPerSpan - if maxLogs == 0 || len(s.raw.Logs) < maxLogs { - s.raw.Logs = append(s.raw.Logs, lr) - return - } - - // We have too many logs. We don't touch the first numOld logs; we treat the - // rest as a circular buffer and overwrite the oldest log among those. - numOld := (maxLogs - 1) / 2 - numNew := maxLogs - numOld - s.raw.Logs[numOld+s.numDroppedLogs%numNew] = lr - s.numDroppedLogs++ -} - -func (s *spanImpl) LogFields(fields ...log.Field) { - lr := opentracing.LogRecord{ - Fields: fields, - } - defer s.onLogFields(lr) - s.Lock() - defer s.Unlock() - if s.trim() || s.tracer.options.DropAllLogs { - return - } - if lr.Timestamp.IsZero() { - lr.Timestamp = time.Now() - } - s.appendLog(lr) -} - -func (s *spanImpl) LogEvent(event string) { - s.Log(opentracing.LogData{ - Event: event, - }) -} - -func (s *spanImpl) LogEventWithPayload(event string, payload interface{}) { - s.Log(opentracing.LogData{ - Event: event, - Payload: payload, - }) -} - -func (s *spanImpl) Log(ld opentracing.LogData) { - defer s.onLog(ld) - s.Lock() - defer s.Unlock() - if s.trim() || s.tracer.options.DropAllLogs { - return - } - - if ld.Timestamp.IsZero() { - ld.Timestamp = time.Now() - } - - s.appendLog(ld.ToLogRecord()) -} - -func (s *spanImpl) Finish() { - s.FinishWithOptions(opentracing.FinishOptions{}) -} - -// rotateLogBuffer rotates the records in the buffer: records 0 to pos-1 move at -// the end (i.e. pos circular left shifts). -func rotateLogBuffer(buf []opentracing.LogRecord, pos int) { - // This algorithm is described in: - // http://www.cplusplus.com/reference/algorithm/rotate - for first, middle, next := 0, pos, pos; first != middle; { - buf[first], buf[next] = buf[next], buf[first] - first++ - next++ - if next == len(buf) { - next = middle - } else if first == middle { - middle = next - } - } -} - -func (s *spanImpl) FinishWithOptions(opts opentracing.FinishOptions) { - finishTime := opts.FinishTime - if finishTime.IsZero() { - finishTime = time.Now() - } - duration := finishTime.Sub(s.raw.Start) - - s.Lock() - defer s.Unlock() - - for _, lr := range opts.LogRecords { - s.appendLog(lr) - } - for _, ld := range opts.BulkLogData { - s.appendLog(ld.ToLogRecord()) - } - - if s.numDroppedLogs > 0 { - // We dropped some log events, which means that we used part of Logs as a - // circular buffer (see appendLog). De-circularize it. - numOld := (len(s.raw.Logs) - 1) / 2 - numNew := len(s.raw.Logs) - numOld - rotateLogBuffer(s.raw.Logs[numOld:], s.numDroppedLogs%numNew) - - // Replace the log in the middle (the oldest "new" log) with information - // about the dropped logs. This means that we are effectively dropping one - // more "new" log. - numDropped := s.numDroppedLogs + 1 - s.raw.Logs[numOld] = opentracing.LogRecord{ - // Keep the timestamp of the last dropped event. - Timestamp: s.raw.Logs[numOld].Timestamp, - Fields: []log.Field{ - log.String("event", "dropped Span logs"), - log.Int("dropped_log_count", numDropped), - log.String("component", "loggabletracer"), - }, - } - } - - s.raw.Duration = duration - - s.onFinish(s.raw) - s.tracer.options.Recorder.RecordSpan(s.raw) - - // Last chance to get options before the span is possibly reset. - poolEnabled := s.tracer.options.EnableSpanPool - if s.tracer.options.DebugAssertUseAfterFinish { - // This makes it much more likely to catch a panic on any subsequent - // operation since s.tracer is accessed on every call to `Lock`. - // We don't call `reset()` here to preserve the logs in the Span - // which are printed when the assertion triggers. - s.tracer = nil - } - - if poolEnabled { - spanPool.Put(s) - } -} - -func (s *spanImpl) Tracer() opentracing.Tracer { - return s.tracer -} - -func (s *spanImpl) Context() opentracing.SpanContext { - return s.raw.Context -} - -func (s *spanImpl) SetBaggageItem(key, val string) opentracing.Span { - s.onBaggage(key, val) - if s.trim() { - return s - } - - s.Lock() - defer s.Unlock() - s.raw.Context = s.raw.Context.WithBaggageItem(key, val) - return s -} - -func (s *spanImpl) BaggageItem(key string) string { - s.Lock() - defer s.Unlock() - return s.raw.Context.Baggage[key] -} - -func (s *spanImpl) Operation() string { - return s.raw.Operation -} - -func (s *spanImpl) Start() time.Time { - return s.raw.Start -} diff --git a/vendor/github.com/ipfs/go-log/tracer/tracer.go b/vendor/github.com/ipfs/go-log/tracer/tracer.go deleted file mode 100644 index a6ea3a22..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/tracer.go +++ /dev/null @@ -1,280 +0,0 @@ -package loggabletracer - -import ( - "time" - - writer "github.com/ipfs/go-log/writer" - opentracing "github.com/opentracing/opentracing-go" -) - -// Tracer extends the opentracing.Tracer interface with methods to -// probe implementation state, for use by loggabletracer consumers. -type Tracer interface { - opentracing.Tracer - - // Options gets the Options used in New() or NewWithOptions(). - Options() Options -} - -// Options allows creating a customized Tracer via NewWithOptions. The object -// must not be updated when there is an active tracer using it. -type Options struct { - // ShouldSample is a function which is called when creating a new Span and - // determines whether that Span is sampled. The randomized TraceID is supplied - // to allow deterministic sampling decisions to be made across different nodes. - // For example, - // - // func(traceID uint64) { return traceID % 64 == 0 } - // - // samples every 64th trace on average. - ShouldSample func(traceID uint64) bool - // TrimUnsampledSpans turns potentially expensive operations on unsampled - // Spans into no-ops. More precisely, tags and log events are silently - // discarded. If NewSpanEventListener is set, the callbacks will still fire. - TrimUnsampledSpans bool - // Recorder receives Spans which have been finished. - Recorder SpanRecorder - // NewSpanEventListener can be used to enhance the tracer by effectively - // attaching external code to trace events. See NetTraceIntegrator for a - // practical example, and event.go for the list of possible events. - NewSpanEventListener func() func(SpanEvent) - // DropAllLogs turns log events on all Spans into no-ops. - // If NewSpanEventListener is set, the callbacks will still fire. - DropAllLogs bool - // MaxLogsPerSpan limits the number of Logs in a span (if set to a nonzero - // value). If a span has more logs than this value, logs are dropped as - // necessary (and replaced with a log describing how many were dropped). - // - // About half of the MaxLogPerSpan logs kept are the oldest logs, and about - // half are the newest logs. - // - // If NewSpanEventListener is set, the callbacks will still fire for all log - // events. This value is ignored if DropAllLogs is true. - MaxLogsPerSpan int - // DebugAssertSingleGoroutine internally records the ID of the goroutine - // creating each Span and verifies that no operation is carried out on - // it on a different goroutine. - // Provided strictly for development purposes. - // Passing Spans between goroutine without proper synchronization often - // results in use-after-Finish() errors. For a simple example, consider the - // following pseudocode: - // - // func (s *Server) Handle(req http.Request) error { - // sp := s.StartSpan("server") - // defer sp.Finish() - // wait := s.queueProcessing(opentracing.ContextWithSpan(context.Background(), sp), req) - // select { - // case resp := <-wait: - // return resp.Error - // case <-time.After(10*time.Second): - // sp.LogEvent("timed out waiting for processing") - // return ErrTimedOut - // } - // } - // - // This looks reasonable at first, but a request which spends more than ten - // seconds in the queue is abandoned by the main goroutine and its trace - // finished, leading to use-after-finish when the request is finally - // processed. Note also that even joining on to a finished Span via - // StartSpanWithOptions constitutes an illegal operation. - // - // Code bases which do not require (or decide they do not want) Spans to - // be passed across goroutine boundaries can run with this flag enabled in - // tests to increase their chances of spotting wrong-doers. - DebugAssertSingleGoroutine bool - // DebugAssertUseAfterFinish is provided strictly for development purposes. - // When set, it attempts to exacerbate issues emanating from use of Spans - // after calling Finish by running additional assertions. - DebugAssertUseAfterFinish bool - // EnableSpanPool enables the use of a pool, so that the tracer reuses spans - // after Finish has been called on it. Adds a slight performance gain as it - // reduces allocations. However, if you have any use-after-finish race - // conditions the code may panic. - EnableSpanPool bool -} - -// DefaultOptions returns an Options object with a 1 in 64 sampling rate and -// all options disabled. A Recorder needs to be set manually before using the -// returned object with a Tracer. -func DefaultOptions() Options { - return Options{ - ShouldSample: func(traceID uint64) bool { return traceID%64 == 0 }, - MaxLogsPerSpan: 100, - } -} - -// NewWithOptions creates a customized Tracer. -func NewWithOptions(opts Options) opentracing.Tracer { - rval := &LoggableTracer{options: opts} - rval.accessorPropagator = &accessorPropagator{rval} - return rval -} - -// New creates and returns a standard Tracer which defers completed Spans to -// `recorder`. -// Spans created by this Tracer support the ext.SamplingPriority tag: Setting -// ext.SamplingPriority causes the Span to be Sampled from that point on. -func New(recorder SpanRecorder) opentracing.Tracer { - opts := DefaultOptions() - opts.Recorder = recorder - return NewWithOptions(opts) -} - -// Implements the `Tracer` interface. -type LoggableTracer struct { - options Options - textPropagator *textMapPropagator - binaryPropagator *binaryPropagator - accessorPropagator *accessorPropagator -} - -func (t *LoggableTracer) StartSpan( - operationName string, - opts ...opentracing.StartSpanOption, -) opentracing.Span { - - if !writer.WriterGroup.Active() { - return opentracing.NoopTracer.StartSpan(opentracing.NoopTracer{}, operationName) - } - - sso := opentracing.StartSpanOptions{} - for _, o := range opts { - o.Apply(&sso) - } - return t.StartSpanWithOptions(operationName, sso) -} - -func (t *LoggableTracer) getSpan() *spanImpl { - if t.options.EnableSpanPool { - sp := spanPool.Get().(*spanImpl) - sp.reset() - return sp - } - return &spanImpl{} -} - -func (t *LoggableTracer) StartSpanWithOptions( - operationName string, - opts opentracing.StartSpanOptions, -) opentracing.Span { - if !writer.WriterGroup.Active() { - return opentracing.NoopTracer.StartSpan(opentracing.NoopTracer{}, operationName) - } - // Start time. - startTime := opts.StartTime - if startTime.IsZero() { - startTime = time.Now() - } - - // Tags. - tags := opts.Tags - - // Build the new span. This is the only allocation: We'll return this as - // an opentracing.Span. - sp := t.getSpan() - // Look for a parent in the list of References. - // - // TODO: would be nice if loggabletracer did something with all - // References, not just the first one. -ReferencesLoop: - for _, ref := range opts.References { - switch ref.Type { - case opentracing.ChildOfRef, - opentracing.FollowsFromRef: - - refCtx, ok := ref.ReferencedContext.(SpanContext) - if !ok { - // Could be a noopSpanContext - // Ignore that parent. - continue - } - sp.raw.Context.TraceID = refCtx.TraceID - sp.raw.Context.SpanID = randomID() - sp.raw.Context.Sampled = refCtx.Sampled - sp.raw.ParentSpanID = refCtx.SpanID - - if l := len(refCtx.Baggage); l > 0 { - sp.raw.Context.Baggage = make(map[string]string, l) - for k, v := range refCtx.Baggage { - sp.raw.Context.Baggage[k] = v - } - } - break ReferencesLoop - } - } - if sp.raw.Context.TraceID == 0 { - // No parent Span found; allocate new trace and span ids and determine - // the Sampled status. - sp.raw.Context.TraceID, sp.raw.Context.SpanID = randomID2() - sp.raw.Context.Sampled = t.options.ShouldSample(sp.raw.Context.TraceID) - } - - return t.startSpanInternal( - sp, - operationName, - startTime, - tags, - ) -} - -func (t *LoggableTracer) startSpanInternal( - sp *spanImpl, - operationName string, - startTime time.Time, - tags opentracing.Tags, -) opentracing.Span { - sp.tracer = t - if t.options.NewSpanEventListener != nil { - sp.event = t.options.NewSpanEventListener() - } - sp.raw.Operation = operationName - sp.raw.Start = startTime - sp.raw.Duration = -1 - sp.raw.Tags = tags - if t.options.DebugAssertSingleGoroutine { - sp.SetTag(debugGoroutineIDTag, curGoroutineID()) - } - defer sp.onCreate(operationName) - return sp -} - -type delegatorType struct{} - -// Delegator is the format to use for DelegatingCarrier. -var Delegator delegatorType - -func (t *LoggableTracer) Inject(sc opentracing.SpanContext, format interface{}, carrier interface{}) error { - if !writer.WriterGroup.Active() { - return opentracing.NoopTracer.Inject(opentracing.NoopTracer{}, sc, format, carrier) - } - switch format { - case opentracing.TextMap, opentracing.HTTPHeaders: - return t.textPropagator.Inject(sc, carrier) - case opentracing.Binary: - return t.binaryPropagator.Inject(sc, carrier) - } - if _, ok := format.(delegatorType); ok { - return t.accessorPropagator.Inject(sc, carrier) - } - return opentracing.ErrUnsupportedFormat -} - -func (t *LoggableTracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error) { - if !writer.WriterGroup.Active() { - return opentracing.NoopTracer.Extract(opentracing.NoopTracer{}, format, carrier) - } - switch format { - case opentracing.TextMap, opentracing.HTTPHeaders: - return t.textPropagator.Extract(carrier) - case opentracing.Binary: - return t.binaryPropagator.Extract(carrier) - } - if _, ok := format.(delegatorType); ok { - return t.accessorPropagator.Extract(carrier) - } - return nil, opentracing.ErrUnsupportedFormat -} - -func (t *LoggableTracer) Options() Options { - return t.options -} diff --git a/vendor/github.com/ipfs/go-log/tracer/util.go b/vendor/github.com/ipfs/go-log/tracer/util.go deleted file mode 100644 index 279e2aca..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/util.go +++ /dev/null @@ -1,25 +0,0 @@ -package loggabletracer - -import ( - "math/rand" - "sync" - "time" -) - -var ( - seededIDGen = rand.New(rand.NewSource(time.Now().UnixNano())) - // The golang rand generators are *not* intrinsically thread-safe. - seededIDLock sync.Mutex -) - -func randomID() uint64 { - seededIDLock.Lock() - defer seededIDLock.Unlock() - return uint64(seededIDGen.Int63()) -} - -func randomID2() (uint64, uint64) { - seededIDLock.Lock() - defer seededIDLock.Unlock() - return uint64(seededIDGen.Int63()), uint64(seededIDGen.Int63()) -} diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/Makefile b/vendor/github.com/ipfs/go-log/tracer/wire/Makefile deleted file mode 100644 index 8677a371..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/wire/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -pbgos := $(patsubst %.proto,%.pb.go,$(wildcard *.proto)) - -all: $(pbgos) - -%.pb.go: %.proto - protoc --gogofaster_out=. --proto_path=$(GOPATH)/src:. $< diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/carrier.go b/vendor/github.com/ipfs/go-log/tracer/wire/carrier.go deleted file mode 100644 index 12ec98e9..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/wire/carrier.go +++ /dev/null @@ -1,40 +0,0 @@ -package wire - -// ProtobufCarrier is a DelegatingCarrier that uses protocol buffers as the -// the underlying datastructure. The reason for implementing DelagatingCarrier -// is to allow for end users to serialize the underlying protocol buffers using -// jsonpb or any other serialization forms they want. -type ProtobufCarrier TracerState - -// SetState set's the tracer state. -func (p *ProtobufCarrier) SetState(traceID, spanID uint64, sampled bool) { - p.TraceId = traceID - p.SpanId = spanID - p.Sampled = sampled -} - -// State returns the tracer state. -func (p *ProtobufCarrier) State() (traceID, spanID uint64, sampled bool) { - traceID = p.TraceId - spanID = p.SpanId - sampled = p.Sampled - return traceID, spanID, sampled -} - -// SetBaggageItem sets a baggage item. -func (p *ProtobufCarrier) SetBaggageItem(key, value string) { - if p.BaggageItems == nil { - p.BaggageItems = map[string]string{key: value} - return - } - - p.BaggageItems[key] = value -} - -// GetBaggage iterates over each baggage item and executes the callback with -// the key:value pair. -func (p *ProtobufCarrier) GetBaggage(f func(k, v string)) { - for k, v := range p.BaggageItems { - f(k, v) - } -} diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/gen.go b/vendor/github.com/ipfs/go-log/tracer/wire/gen.go deleted file mode 100644 index 7d951fa4..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/wire/gen.go +++ /dev/null @@ -1,6 +0,0 @@ -package wire - -//go:generate protoc --gogofaster_out=$GOPATH/src/github.com/ipfs/go-log/tracer/wire wire.proto - -// Run `go get github.com/gogo/protobuf/protoc-gen-gogofaster` to install the -// gogofaster generator binary. diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go b/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go deleted file mode 100644 index 2399892f..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go +++ /dev/null @@ -1,554 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: wire.proto - -package wire - -import ( - encoding_binary "encoding/binary" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type TracerState struct { - TraceId uint64 `protobuf:"fixed64,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` - SpanId uint64 `protobuf:"fixed64,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` - Sampled bool `protobuf:"varint,3,opt,name=sampled,proto3" json:"sampled,omitempty"` - BaggageItems map[string]string `protobuf:"bytes,4,rep,name=baggage_items,json=baggageItems,proto3" json:"baggage_items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *TracerState) Reset() { *m = TracerState{} } -func (m *TracerState) String() string { return proto.CompactTextString(m) } -func (*TracerState) ProtoMessage() {} -func (*TracerState) Descriptor() ([]byte, []int) { - return fileDescriptor_f2dcdddcdf68d8e0, []int{0} -} -func (m *TracerState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TracerState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TracerState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TracerState) XXX_Merge(src proto.Message) { - xxx_messageInfo_TracerState.Merge(m, src) -} -func (m *TracerState) XXX_Size() int { - return m.Size() -} -func (m *TracerState) XXX_DiscardUnknown() { - xxx_messageInfo_TracerState.DiscardUnknown(m) -} - -var xxx_messageInfo_TracerState proto.InternalMessageInfo - -func (m *TracerState) GetTraceId() uint64 { - if m != nil { - return m.TraceId - } - return 0 -} - -func (m *TracerState) GetSpanId() uint64 { - if m != nil { - return m.SpanId - } - return 0 -} - -func (m *TracerState) GetSampled() bool { - if m != nil { - return m.Sampled - } - return false -} - -func (m *TracerState) GetBaggageItems() map[string]string { - if m != nil { - return m.BaggageItems - } - return nil -} - -func init() { - proto.RegisterType((*TracerState)(nil), "loggabletracer.wire.TracerState") - proto.RegisterMapType((map[string]string)(nil), "loggabletracer.wire.TracerState.BaggageItemsEntry") -} - -func init() { proto.RegisterFile("wire.proto", fileDescriptor_f2dcdddcdf68d8e0) } - -var fileDescriptor_f2dcdddcdf68d8e0 = []byte{ - // 250 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, - 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xce, 0xc9, 0x4f, 0x4f, 0x4f, 0x4c, 0xca, 0x49, - 0x2d, 0x29, 0x4a, 0x4c, 0x4e, 0x2d, 0xd2, 0x03, 0x49, 0x29, 0x7d, 0x65, 0xe4, 0xe2, 0x0e, 0x01, - 0xf3, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x24, 0xb9, 0x38, 0xc0, 0xd2, 0xf1, 0x99, 0x29, 0x12, - 0x8c, 0x0a, 0x8c, 0x1a, 0x6c, 0x41, 0xec, 0x60, 0xbe, 0x67, 0x8a, 0x90, 0x38, 0x17, 0x7b, 0x71, - 0x41, 0x62, 0x1e, 0x48, 0x86, 0x09, 0x2c, 0xc3, 0x06, 0xe2, 0x7a, 0xa6, 0x08, 0x49, 0x70, 0xb1, - 0x17, 0x27, 0xe6, 0x16, 0xe4, 0xa4, 0xa6, 0x48, 0x30, 0x2b, 0x30, 0x6a, 0x70, 0x04, 0xc1, 0xb8, - 0x42, 0xe1, 0x5c, 0xbc, 0x49, 0x89, 0xe9, 0xe9, 0x89, 0xe9, 0xa9, 0xf1, 0x99, 0x25, 0xa9, 0xb9, - 0xc5, 0x12, 0x2c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x46, 0x7a, 0x58, 0x9c, 0xa2, 0x87, 0xe4, 0x0c, - 0x3d, 0x27, 0x88, 0x2e, 0x4f, 0x90, 0x26, 0xd7, 0xbc, 0x92, 0xa2, 0xca, 0x20, 0x9e, 0x24, 0x24, - 0x21, 0x29, 0x7b, 0x2e, 0x41, 0x0c, 0x25, 0x42, 0x02, 0x5c, 0xcc, 0xd9, 0xa9, 0x95, 0x60, 0x67, - 0x73, 0x06, 0x81, 0x98, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, 0xa9, 0x60, 0x07, 0x73, - 0x06, 0x41, 0x38, 0x56, 0x4c, 0x16, 0x8c, 0x4e, 0x72, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, - 0x2c, 0xc7, 0x10, 0xc5, 0x02, 0x72, 0x4c, 0x12, 0x1b, 0x38, 0xcc, 0x8c, 0x01, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xe4, 0x48, 0xf4, 0xf8, 0x41, 0x01, 0x00, 0x00, -} - -func (m *TracerState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TracerState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.TraceId != 0 { - dAtA[i] = 0x9 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.TraceId)) - i += 8 - } - if m.SpanId != 0 { - dAtA[i] = 0x11 - i++ - encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(m.SpanId)) - i += 8 - } - if m.Sampled { - dAtA[i] = 0x18 - i++ - if m.Sampled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if len(m.BaggageItems) > 0 { - for k, _ := range m.BaggageItems { - dAtA[i] = 0x22 - i++ - v := m.BaggageItems[k] - mapSize := 1 + len(k) + sovWire(uint64(len(k))) + 1 + len(v) + sovWire(uint64(len(v))) - i = encodeVarintWire(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintWire(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - dAtA[i] = 0x12 - i++ - i = encodeVarintWire(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) - } - } - return i, nil -} - -func encodeVarintWire(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *TracerState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TraceId != 0 { - n += 9 - } - if m.SpanId != 0 { - n += 9 - } - if m.Sampled { - n += 2 - } - if len(m.BaggageItems) > 0 { - for k, v := range m.BaggageItems { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovWire(uint64(len(k))) + 1 + len(v) + sovWire(uint64(len(v))) - n += mapEntrySize + 1 + sovWire(uint64(mapEntrySize)) - } - } - return n -} - -func sovWire(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozWire(x uint64) (n int) { - return sovWire(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *TracerState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TracerState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TracerState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) - } - m.TraceId = 0 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - m.TraceId = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field SpanId", wireType) - } - m.SpanId = 0 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - m.SpanId = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) - iNdEx += 8 - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sampled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Sampled = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaggageItems", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWire - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWire - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BaggageItems == nil { - m.BaggageItems = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthWire - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthWire - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthWire - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthWire - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipWire(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.BaggageItems[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWire(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipWire(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthWire - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthWire - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipWire(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthWire - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthWire = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWire = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/wire.proto b/vendor/github.com/ipfs/go-log/tracer/wire/wire.proto deleted file mode 100644 index 496fa198..00000000 --- a/vendor/github.com/ipfs/go-log/tracer/wire/wire.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; -package loggabletracer.wire; -option go_package = "wire"; - -message TracerState { - fixed64 trace_id = 1; - fixed64 span_id = 2; - bool sampled = 3; - map baggage_items = 4; -} diff --git a/vendor/github.com/ipfs/go-log/writer/option.go b/vendor/github.com/ipfs/go-log/writer/option.go deleted file mode 100644 index e467fc17..00000000 --- a/vendor/github.com/ipfs/go-log/writer/option.go +++ /dev/null @@ -1,55 +0,0 @@ -package log - -import ( - "io" - - logging "github.com/whyrusleeping/go-logging" -) - -// WriterGroup is the global writer group for logs to output to -var WriterGroup = NewMirrorWriter() - -// Option is a generic function -type Option func() - -// Configure applies the provided options sequentially from left to right -func Configure(options ...Option) { - for _, f := range options { - f() - } -} - -// LdJSONFormatter Option formats the event log as line-delimited JSON -var LdJSONFormatter = func() { - logging.SetFormatter(&PoliteJSONFormatter{}) -} - -// TextFormatter Option formats the event log as human-readable plain-text -var TextFormatter = func() { - logging.SetFormatter(logging.DefaultFormatter) -} - -// Output returns an option which sets the the given writer as the new -// logging backend -func Output(w io.Writer) Option { - return func() { - backend := logging.NewLogBackend(w, "", 0) - logging.SetBackend(backend) - // TODO return previous Output option - } -} - -// LevelDebug Option sets the log level to debug -var LevelDebug = func() { - logging.SetLevel(logging.DEBUG, "") -} - -// LevelError Option sets the log level to error -var LevelError = func() { - logging.SetLevel(logging.ERROR, "") -} - -// LevelInfo Option sets the log level to info -var LevelInfo = func() { - logging.SetLevel(logging.INFO, "") -} diff --git a/vendor/github.com/ipfs/go-log/writer/polite_json_formatter.go b/vendor/github.com/ipfs/go-log/writer/polite_json_formatter.go deleted file mode 100644 index c5e620fd..00000000 --- a/vendor/github.com/ipfs/go-log/writer/polite_json_formatter.go +++ /dev/null @@ -1,29 +0,0 @@ -package log - -import ( - "encoding/json" - "io" - - logging "github.com/whyrusleeping/go-logging" -) - -// PoliteJSONFormatter marshals entries into JSON encoded slices (without -// overwriting user-provided keys). How polite of it! -type PoliteJSONFormatter struct{} - -// Format encodes a logging.Record in JSON and writes it to Writer. -func (f *PoliteJSONFormatter) Format(calldepth int, r *logging.Record, w io.Writer) error { - entry := make(map[string]interface{}) - entry["id"] = r.Id - entry["level"] = r.Level - entry["time"] = r.Time - entry["module"] = r.Module - entry["message"] = r.Message() - err := json.NewEncoder(w).Encode(entry) - if err != nil { - return err - } - - w.Write([]byte{'\n'}) - return nil -} diff --git a/vendor/github.com/ipfs/go-log/writer/writer.go b/vendor/github.com/ipfs/go-log/writer/writer.go deleted file mode 100644 index ec5d7299..00000000 --- a/vendor/github.com/ipfs/go-log/writer/writer.go +++ /dev/null @@ -1,258 +0,0 @@ -package log - -import ( - "fmt" - "io" - "sync" - "sync/atomic" -) - -// MaxWriterBuffer specifies how big the writer buffer can get before -// killing the writer. -var MaxWriterBuffer = 512 * 1024 - -// MirrorWriter implements a WriteCloser which syncs incoming bytes to multiple -// [buffered] WriteClosers. They can be added with AddWriter(). -type MirrorWriter struct { - active uint32 - - // channel for incoming writers - writerAdd chan *writerAdd - - // slices of writer/sync-channel pairs - writers []*bufWriter - - // synchronization channel for incoming writes - msgSync chan []byte -} - -type writerSync struct { - w io.WriteCloser - br chan []byte -} - -// NewMirrorWriter initializes and returns a MirrorWriter. -func NewMirrorWriter() *MirrorWriter { - mw := &MirrorWriter{ - msgSync: make(chan []byte, 64), // sufficiently large buffer to avoid callers waiting - writerAdd: make(chan *writerAdd), - } - - go mw.logRoutine() - - return mw -} - -// Write broadcasts the written bytes to all Writers. -func (mw *MirrorWriter) Write(b []byte) (int, error) { - mycopy := make([]byte, len(b)) - copy(mycopy, b) - mw.msgSync <- mycopy - return len(b), nil -} - -// Close closes the MirrorWriter -func (mw *MirrorWriter) Close() error { - // it is up to the caller to ensure that write is not called during or - // after close is called. - close(mw.msgSync) - return nil -} - -func (mw *MirrorWriter) doClose() { - for _, w := range mw.writers { - w.writer.Close() - } -} - -func (mw *MirrorWriter) logRoutine() { - // rebind to avoid races on nilling out struct fields - msgSync := mw.msgSync - writerAdd := mw.writerAdd - - defer mw.doClose() - - for { - select { - case b, ok := <-msgSync: - if !ok { - return - } - - // write to all writers - dropped := mw.broadcastMessage(b) - - // consolidate the slice - if dropped { - mw.clearDeadWriters() - } - case wa := <-writerAdd: - mw.writers = append(mw.writers, newBufWriter(wa.w)) - - atomic.StoreUint32(&mw.active, 1) - close(wa.done) - } - } -} - -// broadcastMessage sends the given message to every writer -// if any writer is killed during the send, 'true' is returned -func (mw *MirrorWriter) broadcastMessage(b []byte) bool { - var dropped bool - for i, w := range mw.writers { - _, err := w.Write(b) - if err != nil { - mw.writers[i] = nil - dropped = true - } - } - return dropped -} - -func (mw *MirrorWriter) clearDeadWriters() { - writers := mw.writers - mw.writers = nil - for _, w := range writers { - if w != nil { - mw.writers = append(mw.writers, w) - } - } - if len(mw.writers) == 0 { - atomic.StoreUint32(&mw.active, 0) - } -} - -type writerAdd struct { - w io.WriteCloser - done chan struct{} -} - -// AddWriter attaches a new WriteCloser to this MirrorWriter. -// The new writer will start getting any bytes written to the mirror. -func (mw *MirrorWriter) AddWriter(w io.WriteCloser) { - wa := &writerAdd{ - w: w, - done: make(chan struct{}), - } - mw.writerAdd <- wa - <-wa.done -} - -// Active returns if there is at least one Writer -// attached to this MirrorWriter -func (mw *MirrorWriter) Active() (active bool) { - return atomic.LoadUint32(&mw.active) == 1 -} - -func newBufWriter(w io.WriteCloser) *bufWriter { - bw := &bufWriter{ - writer: w, - incoming: make(chan []byte, 1), - } - - go bw.loop() - return bw -} - -// writes incoming messages to a buffer and when it fills -// up, writes them to the writer -type bufWriter struct { - writer io.WriteCloser - - incoming chan []byte - - deathLock sync.Mutex - dead bool -} - -var errDeadWriter = fmt.Errorf("writer is dead") - -func (bw *bufWriter) Write(b []byte) (int, error) { - bw.deathLock.Lock() - dead := bw.dead - bw.deathLock.Unlock() - if dead { - if bw.incoming != nil { - close(bw.incoming) - bw.incoming = nil - } - return 0, errDeadWriter - } - - bw.incoming <- b - return len(b), nil -} - -func (bw *bufWriter) die() { - bw.deathLock.Lock() - bw.dead = true - bw.writer.Close() - bw.deathLock.Unlock() -} - -func (bw *bufWriter) loop() { - bufsize := 0 - bufBase := make([][]byte, 0, 16) // some initial memory - buffered := bufBase - nextCh := make(chan []byte) - - var nextMsg []byte - - go func() { - for b := range nextCh { - _, err := bw.writer.Write(b) - if err != nil { - // TODO: need a way to notify there was an error here - // wouldn't want to log here as it could casue an infinite loop - bw.die() - return - } - } - }() - - // collect and buffer messages - incoming := bw.incoming - for { - if nextMsg == nil || nextCh == nil { - // nextCh == nil implies we are 'dead' and draining the incoming channel - // until the caller notices and closes it for us - select { - case b, ok := <-incoming: - if !ok { - return - } - nextMsg = b - } - } - - select { - case b, ok := <-incoming: - if !ok { - return - } - bufsize += len(b) - buffered = append(buffered, b) - if bufsize > MaxWriterBuffer { - // if we have too many messages buffered, kill the writer - bw.die() - if nextCh != nil { - close(nextCh) - } - nextCh = nil - // explicity keep going here to drain incoming - } - case nextCh <- nextMsg: - nextMsg = nil - if len(buffered) > 0 { - nextMsg = buffered[0] - buffered = buffered[1:] - bufsize -= len(nextMsg) - } - - if len(buffered) == 0 { - // reset slice position - buffered = bufBase[:0] - } - } - } -} diff --git a/vendor/github.com/ipfs/go-merkledag/.travis.yml b/vendor/github.com/ipfs/go-merkledag/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-merkledag/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-merkledag/LICENSE b/vendor/github.com/ipfs/go-merkledag/LICENSE deleted file mode 100644 index 7d5dcac4..00000000 --- a/vendor/github.com/ipfs/go-merkledag/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-merkledag/README.md b/vendor/github.com/ipfs/go-merkledag/README.md deleted file mode 100644 index 8bf135a4..00000000 --- a/vendor/github.com/ipfs/go-merkledag/README.md +++ /dev/null @@ -1,36 +0,0 @@ -go-merkledag -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-merkledag/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-merkledag/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-merkledag.svg?branch=master)](https://travis-ci.org/ipfs/go-merkledag) - -> go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw - - - -## Table of Contents - -- [TODO](#todo) -- [Contribute](#contribute) -- [License](#license) - -## TODO - -- Pull out dag-pb stuff into go-ipld-pb -- Pull 'raw nodes' out into go-ipld-raw (maybe main one instead) -- Move most other logic to go-ipld -- Make dagservice constructor take a 'blockstore' to avoid the blockservice offline nonsense -- deprecate this package - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-merkledag/coding.go b/vendor/github.com/ipfs/go-merkledag/coding.go deleted file mode 100644 index 8b419281..00000000 --- a/vendor/github.com/ipfs/go-merkledag/coding.go +++ /dev/null @@ -1,139 +0,0 @@ -package merkledag - -import ( - "fmt" - "sort" - "strings" - - "github.com/ipfs/go-block-format" - - pb "github.com/ipfs/go-merkledag/pb" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// Make sure the user doesn't upgrade this file. -// We need to check *here* as well as inside the `pb` package *just* in case the -// user replaces *all* go files in that package. -const _ = pb.DoNotUpgradeFileEverItWillChangeYourHashes - -// for now, we use a PBNode intermediate thing. -// because native go objects are nice. - -// unmarshal decodes raw data into a *Node instance. -// The conversion uses an intermediate PBNode. -func (n *ProtoNode) unmarshal(encoded []byte) error { - var pbn pb.PBNode - if err := pbn.Unmarshal(encoded); err != nil { - return fmt.Errorf("unmarshal failed. %v", err) - } - - pbnl := pbn.GetLinks() - n.links = make([]*ipld.Link, len(pbnl)) - for i, l := range pbnl { - n.links[i] = &ipld.Link{Name: l.GetName(), Size: l.GetTsize()} - c, err := cid.Cast(l.GetHash()) - if err != nil { - return fmt.Errorf("link hash #%d is not valid multihash. %v", i, err) - } - n.links[i].Cid = c - } - sort.Stable(LinkSlice(n.links)) // keep links sorted - - n.data = pbn.GetData() - n.encoded = encoded - return nil -} - -// Marshal encodes a *Node instance into a new byte slice. -// The conversion uses an intermediate PBNode. -func (n *ProtoNode) Marshal() ([]byte, error) { - pbn := n.getPBNode() - data, err := pbn.Marshal() - if err != nil { - return data, fmt.Errorf("marshal failed. %v", err) - } - return data, nil -} - -func (n *ProtoNode) getPBNode() *pb.PBNode { - pbn := &pb.PBNode{} - if len(n.links) > 0 { - pbn.Links = make([]*pb.PBLink, len(n.links)) - } - - sort.Stable(LinkSlice(n.links)) // keep links sorted - for i, l := range n.links { - pbn.Links[i] = &pb.PBLink{} - pbn.Links[i].Name = &l.Name - pbn.Links[i].Tsize = &l.Size - if l.Cid.Defined() { - pbn.Links[i].Hash = l.Cid.Bytes() - } - } - - if len(n.data) > 0 { - pbn.Data = n.data - } - return pbn -} - -// EncodeProtobuf returns the encoded raw data version of a Node instance. -// It may use a cached encoded version, unless the force flag is given. -func (n *ProtoNode) EncodeProtobuf(force bool) ([]byte, error) { - sort.Stable(LinkSlice(n.links)) // keep links sorted - if n.encoded == nil || force { - n.cached = cid.Undef - var err error - n.encoded, err = n.Marshal() - if err != nil { - return nil, err - } - } - - if !n.cached.Defined() { - c, err := n.CidBuilder().Sum(n.encoded) - if err != nil { - return nil, err - } - - n.cached = c - } - - return n.encoded, nil -} - -// DecodeProtobuf decodes raw data and returns a new Node instance. -func DecodeProtobuf(encoded []byte) (*ProtoNode, error) { - n := new(ProtoNode) - err := n.unmarshal(encoded) - if err != nil { - return nil, fmt.Errorf("incorrectly formatted merkledag node: %s", err) - } - return n, nil -} - -// DecodeProtobufBlock is a block decoder for protobuf IPLD nodes conforming to -// node.DecodeBlockFunc -func DecodeProtobufBlock(b blocks.Block) (ipld.Node, error) { - c := b.Cid() - if c.Type() != cid.DagProtobuf { - return nil, fmt.Errorf("this function can only decode protobuf nodes") - } - - decnd, err := DecodeProtobuf(b.RawData()) - if err != nil { - if strings.Contains(err.Error(), "Unmarshal failed") { - return nil, fmt.Errorf("the block referred to by '%s' was not a valid merkledag node", c) - } - return nil, fmt.Errorf("failed to decode Protocol Buffers: %v", err) - } - - decnd.cached = c - decnd.builder = c.Prefix() - return decnd, nil -} - -// Type assertion -var _ ipld.DecodeBlockFunc = DecodeProtobufBlock diff --git a/vendor/github.com/ipfs/go-merkledag/errservice.go b/vendor/github.com/ipfs/go-merkledag/errservice.go deleted file mode 100644 index f4607615..00000000 --- a/vendor/github.com/ipfs/go-merkledag/errservice.go +++ /dev/null @@ -1,47 +0,0 @@ -package merkledag - -import ( - "context" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// ErrorService implements ipld.DAGService, returning 'Err' for every call. -type ErrorService struct { - Err error -} - -var _ ipld.DAGService = (*ErrorService)(nil) - -// Add returns the cs.Err. -func (cs *ErrorService) Add(ctx context.Context, nd ipld.Node) error { - return cs.Err -} - -// AddMany returns the cs.Err. -func (cs *ErrorService) AddMany(ctx context.Context, nds []ipld.Node) error { - return cs.Err -} - -// Get returns the cs.Err. -func (cs *ErrorService) Get(ctx context.Context, c cid.Cid) (ipld.Node, error) { - return nil, cs.Err -} - -// GetMany many returns the cs.Err. -func (cs *ErrorService) GetMany(ctx context.Context, cids []cid.Cid) <-chan *ipld.NodeOption { - ch := make(chan *ipld.NodeOption) - close(ch) - return ch -} - -// Remove returns the cs.Err. -func (cs *ErrorService) Remove(ctx context.Context, c cid.Cid) error { - return cs.Err -} - -// RemoveMany returns the cs.Err. -func (cs *ErrorService) RemoveMany(ctx context.Context, cids []cid.Cid) error { - return cs.Err -} diff --git a/vendor/github.com/ipfs/go-merkledag/go.mod b/vendor/github.com/ipfs/go-merkledag/go.mod deleted file mode 100644 index 6747fa35..00000000 --- a/vendor/github.com/ipfs/go-merkledag/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/ipfs/go-merkledag - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-block-format v0.0.2 - github.com/ipfs/go-blockservice v0.1.0 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-ipfs-blockstore v0.0.1 - github.com/ipfs/go-ipfs-exchange-offline v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-ipld-cbor v0.0.2 - github.com/ipfs/go-ipld-format v0.0.2 - github.com/multiformats/go-multihash v0.0.5 -) diff --git a/vendor/github.com/ipfs/go-merkledag/go.sum b/vendor/github.com/ipfs/go-merkledag/go.sum deleted file mode 100644 index 196e76bf..00000000 --- a/vendor/github.com/ipfs/go-merkledag/go.sum +++ /dev/null @@ -1,342 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.1.0 h1:28YsHYw9ut6wootnImPXH0WpnU5Dbo3qm6cvQ6e6wYY= -github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSAE1wsxj0= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-blockservice v0.1.0 h1:dh2i7xjMbCtf0ZSMyQAF2qpV/pEEmM7yVpQ00+gik6U= -github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ= -github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-cbor v0.0.2 h1:amzFztBQQQ69UA5+f7JRfoXF/z2l//MGfEDHVkS20+s= -github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs= -github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-peertaskqueue v0.1.0 h1:bpRbgv76eT4avutNPDFZuCPOQus6qTgurEYxfulgZW4= -github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -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/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.0 h1:8VXadcPNni74ODoZ+7326LMAppFYmz1fRQOUuT5iZvQ= -github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-testutil v0.1.0 h1:4QhjaWGO89udplblLVpgGDOQjzFlRavZOjuEnz2rLMc= -github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158 h1:v73Zw0Y1htnV0qaOAYSNiuIAviPSBkNtdy1tPi1+zpY= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-merkledag/merkledag.go b/vendor/github.com/ipfs/go-merkledag/merkledag.go deleted file mode 100644 index 3153cf41..00000000 --- a/vendor/github.com/ipfs/go-merkledag/merkledag.go +++ /dev/null @@ -1,478 +0,0 @@ -// Package merkledag implements the IPFS Merkle DAG data structures. -package merkledag - -import ( - "context" - "fmt" - "sync" - - blocks "github.com/ipfs/go-block-format" - bserv "github.com/ipfs/go-blockservice" - cid "github.com/ipfs/go-cid" - ipldcbor "github.com/ipfs/go-ipld-cbor" - ipld "github.com/ipfs/go-ipld-format" -) - -// TODO: We should move these registrations elsewhere. Really, most of the IPLD -// functionality should go in a `go-ipld` repo but that will take a lot of work -// and design. -func init() { - ipld.Register(cid.DagProtobuf, DecodeProtobufBlock) - ipld.Register(cid.Raw, DecodeRawBlock) - ipld.Register(cid.DagCBOR, ipldcbor.DecodeBlock) -} - -// contextKey is a type to use as value for the ProgressTracker contexts. -type contextKey string - -const progressContextKey contextKey = "progress" - -// NewDAGService constructs a new DAGService (using the default implementation). -// Note that the default implementation is also an ipld.LinkGetter. -func NewDAGService(bs bserv.BlockService) *dagService { - return &dagService{Blocks: bs} -} - -// dagService is an IPFS Merkle DAG service. -// - the root is virtual (like a forest) -// - stores nodes' data in a BlockService -// TODO: should cache Nodes that are in memory, and be -// able to free some of them when vm pressure is high -type dagService struct { - Blocks bserv.BlockService -} - -// Add adds a node to the dagService, storing the block in the BlockService -func (n *dagService) Add(ctx context.Context, nd ipld.Node) error { - if n == nil { // FIXME remove this assertion. protect with constructor invariant - return fmt.Errorf("dagService is nil") - } - - return n.Blocks.AddBlock(nd) -} - -func (n *dagService) AddMany(ctx context.Context, nds []ipld.Node) error { - blks := make([]blocks.Block, len(nds)) - for i, nd := range nds { - blks[i] = nd - } - return n.Blocks.AddBlocks(blks) -} - -// Get retrieves a node from the dagService, fetching the block in the BlockService -func (n *dagService) Get(ctx context.Context, c cid.Cid) (ipld.Node, error) { - if n == nil { - return nil, fmt.Errorf("dagService is nil") - } - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - b, err := n.Blocks.GetBlock(ctx, c) - if err != nil { - if err == bserv.ErrNotFound { - return nil, ipld.ErrNotFound - } - return nil, fmt.Errorf("failed to get block for %s: %v", c, err) - } - - return ipld.Decode(b) -} - -// GetLinks return the links for the node, the node doesn't necessarily have -// to exist locally. -func (n *dagService) GetLinks(ctx context.Context, c cid.Cid) ([]*ipld.Link, error) { - if c.Type() == cid.Raw { - return nil, nil - } - node, err := n.Get(ctx, c) - if err != nil { - return nil, err - } - return node.Links(), nil -} - -func (n *dagService) Remove(ctx context.Context, c cid.Cid) error { - return n.Blocks.DeleteBlock(c) -} - -// RemoveMany removes multiple nodes from the DAG. It will likely be faster than -// removing them individually. -// -// This operation is not atomic. If it returns an error, some nodes may or may -// not have been removed. -func (n *dagService) RemoveMany(ctx context.Context, cids []cid.Cid) error { - // TODO(#4608): make this batch all the way down. - for _, c := range cids { - if err := n.Blocks.DeleteBlock(c); err != nil { - return err - } - } - return nil -} - -// GetLinksDirect creates a function to get the links for a node, from -// the node, bypassing the LinkService. If the node does not exist -// locally (and can not be retrieved) an error will be returned. -func GetLinksDirect(serv ipld.NodeGetter) GetLinks { - return func(ctx context.Context, c cid.Cid) ([]*ipld.Link, error) { - nd, err := serv.Get(ctx, c) - if err != nil { - if err == bserv.ErrNotFound { - err = ipld.ErrNotFound - } - return nil, err - } - return nd.Links(), nil - } -} - -type sesGetter struct { - bs *bserv.Session -} - -// Get gets a single node from the DAG. -func (sg *sesGetter) Get(ctx context.Context, c cid.Cid) (ipld.Node, error) { - blk, err := sg.bs.GetBlock(ctx, c) - switch err { - case bserv.ErrNotFound: - return nil, ipld.ErrNotFound - default: - return nil, err - case nil: - // noop - } - - return ipld.Decode(blk) -} - -// GetMany gets many nodes at once, batching the request if possible. -func (sg *sesGetter) GetMany(ctx context.Context, keys []cid.Cid) <-chan *ipld.NodeOption { - return getNodesFromBG(ctx, sg.bs, keys) -} - -// Session returns a NodeGetter using a new session for block fetches. -func (n *dagService) Session(ctx context.Context) ipld.NodeGetter { - return &sesGetter{bserv.NewSession(ctx, n.Blocks)} -} - -// FetchGraph fetches all nodes that are children of the given node -func FetchGraph(ctx context.Context, root cid.Cid, serv ipld.DAGService) error { - return FetchGraphWithDepthLimit(ctx, root, -1, serv) -} - -// FetchGraphWithDepthLimit fetches all nodes that are children to the given -// node down to the given depth. maxDetph=0 means "only fetch root", -// maxDepth=1 means "fetch root and its direct children" and so on... -// maxDepth=-1 means unlimited. -func FetchGraphWithDepthLimit(ctx context.Context, root cid.Cid, depthLim int, serv ipld.DAGService) error { - var ng ipld.NodeGetter = serv - ds, ok := serv.(*dagService) - if ok { - ng = &sesGetter{bserv.NewSession(ctx, ds.Blocks)} - } - - set := make(map[string]int) - - // Visit function returns true when: - // * The element is not in the set and we're not over depthLim - // * The element is in the set but recorded depth is deeper - // than currently seen (if we find it higher in the tree we'll need - // to explore deeper than before). - // depthLim = -1 means we only return true if the element is not in the - // set. - visit := func(c cid.Cid, depth int) bool { - key := string(c.Bytes()) - oldDepth, ok := set[key] - - if (ok && depthLim < 0) || (depthLim >= 0 && depth > depthLim) { - return false - } - - if !ok || oldDepth > depth { - set[key] = depth - return true - } - return false - } - - v, _ := ctx.Value(progressContextKey).(*ProgressTracker) - if v == nil { - return EnumerateChildrenAsyncDepth(ctx, GetLinksDirect(ng), root, 0, visit) - } - - visitProgress := func(c cid.Cid, depth int) bool { - if visit(c, depth) { - v.Increment() - return true - } - return false - } - return EnumerateChildrenAsyncDepth(ctx, GetLinksDirect(ng), root, 0, visitProgress) -} - -// GetMany gets many nodes from the DAG at once. -// -// This method may not return all requested nodes (and may or may not return an -// error indicating that it failed to do so. It is up to the caller to verify -// that it received all nodes. -func (n *dagService) GetMany(ctx context.Context, keys []cid.Cid) <-chan *ipld.NodeOption { - return getNodesFromBG(ctx, n.Blocks, keys) -} - -func dedupKeys(keys []cid.Cid) []cid.Cid { - set := cid.NewSet() - for _, c := range keys { - set.Add(c) - } - if set.Len() == len(keys) { - return keys - } - return set.Keys() -} - -func getNodesFromBG(ctx context.Context, bs bserv.BlockGetter, keys []cid.Cid) <-chan *ipld.NodeOption { - keys = dedupKeys(keys) - - out := make(chan *ipld.NodeOption, len(keys)) - blocks := bs.GetBlocks(ctx, keys) - var count int - - go func() { - defer close(out) - for { - select { - case b, ok := <-blocks: - if !ok { - if count != len(keys) { - out <- &ipld.NodeOption{Err: fmt.Errorf("failed to fetch all nodes")} - } - return - } - - nd, err := ipld.Decode(b) - if err != nil { - out <- &ipld.NodeOption{Err: err} - return - } - - out <- &ipld.NodeOption{Node: nd} - count++ - - case <-ctx.Done(): - out <- &ipld.NodeOption{Err: ctx.Err()} - return - } - } - }() - return out -} - -// GetLinks is the type of function passed to the EnumerateChildren function(s) -// for getting the children of an IPLD node. -type GetLinks func(context.Context, cid.Cid) ([]*ipld.Link, error) - -// GetLinksWithDAG returns a GetLinks function that tries to use the given -// NodeGetter as a LinkGetter to get the children of a given IPLD node. This may -// allow us to traverse the DAG without actually loading and parsing the node in -// question (if we already have the links cached). -func GetLinksWithDAG(ng ipld.NodeGetter) GetLinks { - return func(ctx context.Context, c cid.Cid) ([]*ipld.Link, error) { - return ipld.GetLinks(ctx, ng, c) - } -} - -// EnumerateChildren will walk the dag below the given root node and add all -// unseen children to the passed in set. -// TODO: parallelize to avoid disk latency perf hits? -func EnumerateChildren(ctx context.Context, getLinks GetLinks, root cid.Cid, visit func(cid.Cid) bool) error { - visitDepth := func(c cid.Cid, depth int) bool { - return visit(c) - } - - return EnumerateChildrenDepth(ctx, getLinks, root, 0, visitDepth) -} - -// EnumerateChildrenDepth walks the dag below the given root and passes the -// current depth to a given visit function. The visit function can be used to -// limit DAG exploration. -func EnumerateChildrenDepth(ctx context.Context, getLinks GetLinks, root cid.Cid, depth int, visit func(cid.Cid, int) bool) error { - links, err := getLinks(ctx, root) - if err != nil { - return err - } - - for _, lnk := range links { - c := lnk.Cid - if visit(c, depth+1) { - err = EnumerateChildrenDepth(ctx, getLinks, c, depth+1, visit) - if err != nil { - return err - } - } - } - return nil -} - -// ProgressTracker is used to show progress when fetching nodes. -type ProgressTracker struct { - Total int - lk sync.Mutex -} - -// DeriveContext returns a new context with value "progress" derived from -// the given one. -func (p *ProgressTracker) DeriveContext(ctx context.Context) context.Context { - return context.WithValue(ctx, progressContextKey, p) -} - -// Increment adds one to the total progress. -func (p *ProgressTracker) Increment() { - p.lk.Lock() - defer p.lk.Unlock() - p.Total++ -} - -// Value returns the current progress. -func (p *ProgressTracker) Value() int { - p.lk.Lock() - defer p.lk.Unlock() - return p.Total -} - -// FetchGraphConcurrency is total number of concurrent fetches that -// 'fetchNodes' will start at a time -var FetchGraphConcurrency = 32 - -// EnumerateChildrenAsync is equivalent to EnumerateChildren *except* that it -// fetches children in parallel. -// -// NOTE: It *does not* make multiple concurrent calls to the passed `visit` function. -func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c cid.Cid, visit func(cid.Cid) bool) error { - visitDepth := func(c cid.Cid, depth int) bool { - return visit(c) - } - - return EnumerateChildrenAsyncDepth(ctx, getLinks, c, 0, visitDepth) -} - -// EnumerateChildrenAsyncDepth is equivalent to EnumerateChildrenDepth *except* -// that it fetches children in parallel (down to a maximum depth in the graph). -// -// NOTE: It *does not* make multiple concurrent calls to the passed `visit` function. -func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.Cid, startDepth int, visit func(cid.Cid, int) bool) error { - type cidDepth struct { - cid cid.Cid - depth int - } - - type linksDepth struct { - links []*ipld.Link - depth int - } - - feed := make(chan *cidDepth) - out := make(chan *linksDepth) - done := make(chan struct{}) - - var setlk sync.Mutex - var wg sync.WaitGroup - - errChan := make(chan error) - fetchersCtx, cancel := context.WithCancel(ctx) - defer wg.Wait() - defer cancel() - for i := 0; i < FetchGraphConcurrency; i++ { - wg.Add(1) - go func() { - defer wg.Done() - for cdepth := range feed { - ci := cdepth.cid - depth := cdepth.depth - - setlk.Lock() - shouldVisit := visit(ci, depth) - setlk.Unlock() - - if shouldVisit { - links, err := getLinks(ctx, ci) - if err != nil { - select { - case errChan <- err: - case <-fetchersCtx.Done(): - } - return - } - - outLinks := &linksDepth{ - links: links, - depth: depth + 1, - } - - select { - case out <- outLinks: - case <-fetchersCtx.Done(): - return - } - } - select { - case done <- struct{}{}: - case <-fetchersCtx.Done(): - } - } - }() - } - defer close(feed) - - send := feed - var todobuffer []*cidDepth - var inProgress int - - next := &cidDepth{ - cid: c, - depth: startDepth, - } - for { - select { - case send <- next: - inProgress++ - if len(todobuffer) > 0 { - next = todobuffer[0] - todobuffer = todobuffer[1:] - } else { - next = nil - send = nil - } - case <-done: - inProgress-- - if inProgress == 0 && next == nil { - return nil - } - case linksDepth := <-out: - for _, lnk := range linksDepth.links { - cd := &cidDepth{ - cid: lnk.Cid, - depth: linksDepth.depth, - } - - if next == nil { - next = cd - send = feed - } else { - todobuffer = append(todobuffer, cd) - } - } - case err := <-errChan: - return err - - case <-ctx.Done(): - return ctx.Err() - } - } - -} - -var _ ipld.LinkGetter = &dagService{} -var _ ipld.NodeGetter = &dagService{} -var _ ipld.NodeGetter = &sesGetter{} -var _ ipld.DAGService = &dagService{} diff --git a/vendor/github.com/ipfs/go-merkledag/node.go b/vendor/github.com/ipfs/go-merkledag/node.go deleted file mode 100644 index 09789040..00000000 --- a/vendor/github.com/ipfs/go-merkledag/node.go +++ /dev/null @@ -1,384 +0,0 @@ -package merkledag - -import ( - "context" - "encoding/json" - "fmt" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" -) - -// Common errors -var ( - ErrNotProtobuf = fmt.Errorf("expected protobuf dag node") - ErrLinkNotFound = fmt.Errorf("no link by that name") -) - -// ProtoNode represents a node in the IPFS Merkle DAG. -// nodes have opaque data and a set of navigable links. -type ProtoNode struct { - links []*ipld.Link - data []byte - - // cache encoded/marshaled value - encoded []byte - - cached cid.Cid - - // builder specifies cid version and hashing function - builder cid.Builder -} - -var v0CidPrefix = cid.Prefix{ - Codec: cid.DagProtobuf, - MhLength: -1, - MhType: mh.SHA2_256, - Version: 0, -} - -var v1CidPrefix = cid.Prefix{ - Codec: cid.DagProtobuf, - MhLength: -1, - MhType: mh.SHA2_256, - Version: 1, -} - -// V0CidPrefix returns a prefix for CIDv0 -func V0CidPrefix() cid.Prefix { return v0CidPrefix } - -// V1CidPrefix returns a prefix for CIDv1 with the default settings -func V1CidPrefix() cid.Prefix { return v1CidPrefix } - -// PrefixForCidVersion returns the Protobuf prefix for a given CID version -func PrefixForCidVersion(version int) (cid.Prefix, error) { - switch version { - case 0: - return v0CidPrefix, nil - case 1: - return v1CidPrefix, nil - default: - return cid.Prefix{}, fmt.Errorf("unknown CID version: %d", version) - } -} - -// CidBuilder returns the CID Builder for this ProtoNode, it is never nil -func (n *ProtoNode) CidBuilder() cid.Builder { - if n.builder == nil { - n.builder = v0CidPrefix - } - return n.builder -} - -// SetCidBuilder sets the CID builder if it is non nil, if nil then it -// is reset to the default value -func (n *ProtoNode) SetCidBuilder(builder cid.Builder) { - if builder == nil { - n.builder = v0CidPrefix - } else { - n.builder = builder.WithCodec(cid.DagProtobuf) - n.cached = cid.Undef - } -} - -// LinkSlice is a slice of ipld.Links -type LinkSlice []*ipld.Link - -func (ls LinkSlice) Len() int { return len(ls) } -func (ls LinkSlice) Swap(a, b int) { ls[a], ls[b] = ls[b], ls[a] } -func (ls LinkSlice) Less(a, b int) bool { return ls[a].Name < ls[b].Name } - -// NodeWithData builds a new Protonode with the given data. -func NodeWithData(d []byte) *ProtoNode { - return &ProtoNode{data: d} -} - -// AddNodeLink adds a link to another node. -func (n *ProtoNode) AddNodeLink(name string, that ipld.Node) error { - n.encoded = nil - - lnk, err := ipld.MakeLink(that) - if err != nil { - return err - } - - lnk.Name = name - - n.AddRawLink(name, lnk) - - return nil -} - -// AddRawLink adds a copy of a link to this node -func (n *ProtoNode) AddRawLink(name string, l *ipld.Link) error { - n.encoded = nil - n.links = append(n.links, &ipld.Link{ - Name: name, - Size: l.Size, - Cid: l.Cid, - }) - - return nil -} - -// RemoveNodeLink removes a link on this node by the given name. -func (n *ProtoNode) RemoveNodeLink(name string) error { - n.encoded = nil - - ref := n.links[:0] - found := false - - for _, v := range n.links { - if v.Name != name { - ref = append(ref, v) - } else { - found = true - } - } - - if !found { - return ipld.ErrNotFound - } - - n.links = ref - - return nil -} - -// GetNodeLink returns a copy of the link with the given name. -func (n *ProtoNode) GetNodeLink(name string) (*ipld.Link, error) { - for _, l := range n.links { - if l.Name == name { - return &ipld.Link{ - Name: l.Name, - Size: l.Size, - Cid: l.Cid, - }, nil - } - } - return nil, ErrLinkNotFound -} - -// GetLinkedProtoNode returns a copy of the ProtoNode with the given name. -func (n *ProtoNode) GetLinkedProtoNode(ctx context.Context, ds ipld.DAGService, name string) (*ProtoNode, error) { - nd, err := n.GetLinkedNode(ctx, ds, name) - if err != nil { - return nil, err - } - - pbnd, ok := nd.(*ProtoNode) - if !ok { - return nil, ErrNotProtobuf - } - - return pbnd, nil -} - -// GetLinkedNode returns a copy of the IPLD Node with the given name. -func (n *ProtoNode) GetLinkedNode(ctx context.Context, ds ipld.DAGService, name string) (ipld.Node, error) { - lnk, err := n.GetNodeLink(name) - if err != nil { - return nil, err - } - - return lnk.GetNode(ctx, ds) -} - -// Copy returns a copy of the node. -// NOTE: Does not make copies of Node objects in the links. -func (n *ProtoNode) Copy() ipld.Node { - nnode := new(ProtoNode) - if len(n.data) > 0 { - nnode.data = make([]byte, len(n.data)) - copy(nnode.data, n.data) - } - - if len(n.links) > 0 { - nnode.links = make([]*ipld.Link, len(n.links)) - copy(nnode.links, n.links) - } - - nnode.builder = n.builder - - return nnode -} - -// RawData returns the protobuf-encoded version of the node. -func (n *ProtoNode) RawData() []byte { - out, _ := n.EncodeProtobuf(false) - return out -} - -// Data returns the data stored by this node. -func (n *ProtoNode) Data() []byte { - return n.data -} - -// SetData stores data in this nodes. -func (n *ProtoNode) SetData(d []byte) { - n.encoded = nil - n.cached = cid.Undef - n.data = d -} - -// UpdateNodeLink return a copy of the node with the link name set to point to -// that. If a link of the same name existed, it is removed. -func (n *ProtoNode) UpdateNodeLink(name string, that *ProtoNode) (*ProtoNode, error) { - newnode := n.Copy().(*ProtoNode) - _ = newnode.RemoveNodeLink(name) // ignore error - err := newnode.AddNodeLink(name, that) - return newnode, err -} - -// Size returns the total size of the data addressed by node, -// including the total sizes of references. -func (n *ProtoNode) Size() (uint64, error) { - b, err := n.EncodeProtobuf(false) - if err != nil { - return 0, err - } - - s := uint64(len(b)) - for _, l := range n.links { - s += l.Size - } - return s, nil -} - -// Stat returns statistics on the node. -func (n *ProtoNode) Stat() (*ipld.NodeStat, error) { - enc, err := n.EncodeProtobuf(false) - if err != nil { - return nil, err - } - - cumSize, err := n.Size() - if err != nil { - return nil, err - } - - return &ipld.NodeStat{ - Hash: n.Cid().String(), - NumLinks: len(n.links), - BlockSize: len(enc), - LinksSize: len(enc) - len(n.data), // includes framing. - DataSize: len(n.data), - CumulativeSize: int(cumSize), - }, nil -} - -// Loggable implements the ipfs/go-log.Loggable interface. -func (n *ProtoNode) Loggable() map[string]interface{} { - return map[string]interface{}{ - "node": n.String(), - } -} - -// UnmarshalJSON reads the node fields from a JSON-encoded byte slice. -func (n *ProtoNode) UnmarshalJSON(b []byte) error { - s := struct { - Data []byte `json:"data"` - Links []*ipld.Link `json:"links"` - }{} - - err := json.Unmarshal(b, &s) - if err != nil { - return err - } - - n.data = s.Data - n.links = s.Links - return nil -} - -// MarshalJSON returns a JSON representation of the node. -func (n *ProtoNode) MarshalJSON() ([]byte, error) { - out := map[string]interface{}{ - "data": n.data, - "links": n.links, - } - - return json.Marshal(out) -} - -// Cid returns the node's Cid, calculated according to its prefix -// and raw data contents. -func (n *ProtoNode) Cid() cid.Cid { - if n.encoded != nil && n.cached.Defined() { - return n.cached - } - - c, err := n.builder.Sum(n.RawData()) - if err != nil { - // programmer error - err = fmt.Errorf("invalid CID of length %d: %x: %v", len(n.RawData()), n.RawData(), err) - panic(err) - } - - n.cached = c - return c -} - -// String prints the node's Cid. -func (n *ProtoNode) String() string { - return n.Cid().String() -} - -// Multihash hashes the encoded data of this node. -func (n *ProtoNode) Multihash() mh.Multihash { - // NOTE: EncodeProtobuf generates the hash and puts it in n.cached. - _, err := n.EncodeProtobuf(false) - if err != nil { - // Note: no possibility exists for an error to be returned through here - panic(err) - } - - return n.cached.Hash() -} - -// Links returns the node links. -func (n *ProtoNode) Links() []*ipld.Link { - return n.links -} - -// SetLinks replaces the node links with the given ones. -func (n *ProtoNode) SetLinks(links []*ipld.Link) { - n.links = links -} - -// Resolve is an alias for ResolveLink. -func (n *ProtoNode) Resolve(path []string) (interface{}, []string, error) { - return n.ResolveLink(path) -} - -// ResolveLink consumes the first element of the path and obtains the link -// corresponding to it from the node. It returns the link -// and the path without the consumed element. -func (n *ProtoNode) ResolveLink(path []string) (*ipld.Link, []string, error) { - if len(path) == 0 { - return nil, nil, fmt.Errorf("end of path, no more links to resolve") - } - - lnk, err := n.GetNodeLink(path[0]) - if err != nil { - return nil, nil, err - } - - return lnk, path[1:], nil -} - -// Tree returns the link names of the ProtoNode. -// ProtoNodes are only ever one path deep, so anything different than an empty -// string for p results in nothing. The depth parameter is ignored. -func (n *ProtoNode) Tree(p string, depth int) []string { - if p != "" { - return nil - } - - out := make([]string, 0, len(n.links)) - for _, lnk := range n.links { - out = append(out, lnk.Name) - } - return out -} diff --git a/vendor/github.com/ipfs/go-merkledag/package.json b/vendor/github.com/ipfs/go-merkledag/package.json deleted file mode 100644 index 24801a0a..00000000 --- a/vendor/github.com/ipfs/go-merkledag/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "author": "why", - "bugs": { - "url": "https://github.com/ipfs/go-merkledag" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-merkledag" - }, - "gxDependencies": [ - { - "author": "stebalien", - "hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK", - "name": "go-block-format", - "version": "0.2.2" - }, - { - "author": "whyrusleeping", - "hash": "QmVwsD9oGSAKcCoD4BGi3Hx8XRo4jNy6aMzsjDHVTgYv2D", - "name": "go-ipld-cbor", - "version": "1.5.10" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - }, - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "author": "hsanjuan", - "hash": "Qmb9fkAWgcyVRnFdXGqA6jcWGFj6q35oJjwRAYRhfEboGS", - "name": "go-ipfs-exchange-offline", - "version": "0.1.7" - }, - { - "author": "whyrusleeping", - "hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB", - "name": "gogo-protobuf", - "version": "1.2.1" - }, - { - "author": "why", - "hash": "QmTRbLgKn2BKNvr9z5JQ3uZC4FSyLkad9t7qTVPkbH1LRB", - "name": "go-blockservice", - "version": "1.1.31" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-merkledag", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.1.40" -} - diff --git a/vendor/github.com/ipfs/go-merkledag/pb/Rules.mk b/vendor/github.com/ipfs/go-merkledag/pb/Rules.mk deleted file mode 100644 index 505f70e7..00000000 --- a/vendor/github.com/ipfs/go-merkledag/pb/Rules.mk +++ /dev/null @@ -1,8 +0,0 @@ -include mk/header.mk - -PB_$(d) = $(wildcard $(d)/*.proto) -TGTS_$(d) = $(PB_$(d):.proto=.pb.go) - -#DEPS_GO += $(TGTS_$(d)) - -include mk/footer.mk diff --git a/vendor/github.com/ipfs/go-merkledag/pb/merkledag.pb.go b/vendor/github.com/ipfs/go-merkledag/pb/merkledag.pb.go deleted file mode 100644 index c6fc4360..00000000 --- a/vendor/github.com/ipfs/go-merkledag/pb/merkledag.pb.go +++ /dev/null @@ -1,1072 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: merkledag.proto - -package merkledag_pb - -import ( - bytes "bytes" - fmt "fmt" - io "io" - math "math" - reflect "reflect" - strings "strings" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" -) - -// DoNotUpgradeFileEverItWillChangeYourHashes warns users about not breaking -// their file hashes. -const DoNotUpgradeFileEverItWillChangeYourHashes = ` -This file does not produce canonical protobufs. Unfortunately, if we change it, -we'll change the hashes of the files we produce. - -Do *not regenerate this file. -` - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// An IPFS MerkleDAG Link -type PBLink struct { - // multihash of the target object - Hash []byte `protobuf:"bytes,1,opt,name=Hash" json:"Hash,omitempty"` - // utf string name. should be unique per object - Name *string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` - // cumulative size of target object - Tsize *uint64 `protobuf:"varint,3,opt,name=Tsize" json:"Tsize,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PBLink) Reset() { *m = PBLink{} } -func (*PBLink) ProtoMessage() {} -func (*PBLink) Descriptor() ([]byte, []int) { - return fileDescriptor_10837cc3557cec00, []int{0} -} -func (m *PBLink) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PBLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PBLink.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PBLink) XXX_Merge(src proto.Message) { - xxx_messageInfo_PBLink.Merge(m, src) -} -func (m *PBLink) XXX_Size() int { - return m.Size() -} -func (m *PBLink) XXX_DiscardUnknown() { - xxx_messageInfo_PBLink.DiscardUnknown(m) -} - -var xxx_messageInfo_PBLink proto.InternalMessageInfo - -func (m *PBLink) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *PBLink) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *PBLink) GetTsize() uint64 { - if m != nil && m.Tsize != nil { - return *m.Tsize - } - return 0 -} - -// An IPFS MerkleDAG Node -type PBNode struct { - // refs to other objects - Links []*PBLink `protobuf:"bytes,2,rep,name=Links" json:"Links,omitempty"` - // opaque user data - Data []byte `protobuf:"bytes,1,opt,name=Data" json:"Data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PBNode) Reset() { *m = PBNode{} } -func (*PBNode) ProtoMessage() {} -func (*PBNode) Descriptor() ([]byte, []int) { - return fileDescriptor_10837cc3557cec00, []int{1} -} -func (m *PBNode) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PBNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PBNode.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PBNode) XXX_Merge(src proto.Message) { - xxx_messageInfo_PBNode.Merge(m, src) -} -func (m *PBNode) XXX_Size() int { - return m.Size() -} -func (m *PBNode) XXX_DiscardUnknown() { - xxx_messageInfo_PBNode.DiscardUnknown(m) -} - -var xxx_messageInfo_PBNode proto.InternalMessageInfo - -func (m *PBNode) GetLinks() []*PBLink { - if m != nil { - return m.Links - } - return nil -} - -func (m *PBNode) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func init() { - proto.RegisterType((*PBLink)(nil), "merkledag.pb.PBLink") - proto.RegisterType((*PBNode)(nil), "merkledag.pb.PBNode") -} - -func init() { proto.RegisterFile("merkledag.proto", fileDescriptor_10837cc3557cec00) } - -var fileDescriptor_10837cc3557cec00 = []byte{ - // 227 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcf, 0x4d, 0x2d, 0xca, - 0xce, 0x49, 0x4d, 0x49, 0x4c, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x41, 0x12, 0x48, - 0x92, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, - 0xcf, 0xd7, 0x07, 0x2b, 0x4a, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2, 0x59, 0xc9, - 0x8d, 0x8b, 0x2d, 0xc0, 0xc9, 0x27, 0x33, 0x2f, 0x5b, 0x48, 0x88, 0x8b, 0xc5, 0x23, 0xb1, 0x38, - 0x43, 0x82, 0x51, 0x81, 0x51, 0x83, 0x27, 0x08, 0xcc, 0x06, 0x89, 0xf9, 0x25, 0xe6, 0xa6, 0x4a, - 0x30, 0x29, 0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x22, 0x5c, 0xac, 0x21, 0xc5, 0x99, 0x55, - 0xa9, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x2c, 0x41, 0x10, 0x8e, 0x92, 0x07, 0xc8, 0x1c, 0xbf, 0xfc, - 0x94, 0x54, 0x21, 0x2d, 0x2e, 0x56, 0x90, 0x79, 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, - 0x22, 0x7a, 0xc8, 0xce, 0xd3, 0x83, 0x58, 0x16, 0x04, 0x51, 0x02, 0x32, 0xdf, 0x25, 0xb1, 0x24, - 0x11, 0x66, 0x27, 0x88, 0xed, 0xa4, 0x73, 0xe3, 0xa1, 0x1c, 0xc3, 0x83, 0x87, 0x72, 0x8c, 0x1f, - 0x1e, 0xca, 0x31, 0xfe, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, - 0x1d, 0x8f, 0xe4, 0x18, 0x0f, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, - 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x56, 0xb5, 0x6e, 0x0e, - 0x01, 0x00, 0x00, -} - -func (this *PBLink) VerboseEqual(that interface{}) error { - if that == nil { - if this == nil { - return nil - } - return fmt.Errorf("that == nil && this != nil") - } - - that1, ok := that.(*PBLink) - if !ok { - that2, ok := that.(PBLink) - if ok { - that1 = &that2 - } else { - return fmt.Errorf("that is not of type *PBLink") - } - } - if that1 == nil { - if this == nil { - return nil - } - return fmt.Errorf("that is type *PBLink but is nil && this != nil") - } else if this == nil { - return fmt.Errorf("that is type *PBLink but is not nil && this == nil") - } - if !bytes.Equal(this.Hash, that1.Hash) { - return fmt.Errorf("Hash this(%v) Not Equal that(%v)", this.Hash, that1.Hash) - } - if this.Name != nil && that1.Name != nil { - if *this.Name != *that1.Name { - return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name) - } - } else if this.Name != nil { - return fmt.Errorf("this.Name == nil && that.Name != nil") - } else if that1.Name != nil { - return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) - } - if this.Tsize != nil && that1.Tsize != nil { - if *this.Tsize != *that1.Tsize { - return fmt.Errorf("Tsize this(%v) Not Equal that(%v)", *this.Tsize, *that1.Tsize) - } - } else if this.Tsize != nil { - return fmt.Errorf("this.Tsize == nil && that.Tsize != nil") - } else if that1.Tsize != nil { - return fmt.Errorf("Tsize this(%v) Not Equal that(%v)", this.Tsize, that1.Tsize) - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) - } - return nil -} -func (this *PBLink) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PBLink) - if !ok { - that2, ok := that.(PBLink) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Hash, that1.Hash) { - return false - } - if this.Name != nil && that1.Name != nil { - if *this.Name != *that1.Name { - return false - } - } else if this.Name != nil { - return false - } else if that1.Name != nil { - return false - } - if this.Tsize != nil && that1.Tsize != nil { - if *this.Tsize != *that1.Tsize { - return false - } - } else if this.Tsize != nil { - return false - } else if that1.Tsize != nil { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *PBNode) VerboseEqual(that interface{}) error { - if that == nil { - if this == nil { - return nil - } - return fmt.Errorf("that == nil && this != nil") - } - - that1, ok := that.(*PBNode) - if !ok { - that2, ok := that.(PBNode) - if ok { - that1 = &that2 - } else { - return fmt.Errorf("that is not of type *PBNode") - } - } - if that1 == nil { - if this == nil { - return nil - } - return fmt.Errorf("that is type *PBNode but is nil && this != nil") - } else if this == nil { - return fmt.Errorf("that is type *PBNode but is not nil && this == nil") - } - if len(this.Links) != len(that1.Links) { - return fmt.Errorf("Links this(%v) Not Equal that(%v)", len(this.Links), len(that1.Links)) - } - for i := range this.Links { - if !this.Links[i].Equal(that1.Links[i]) { - return fmt.Errorf("Links this[%v](%v) Not Equal that[%v](%v)", i, this.Links[i], i, that1.Links[i]) - } - } - if !bytes.Equal(this.Data, that1.Data) { - return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data) - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) - } - return nil -} -func (this *PBNode) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PBNode) - if !ok { - that2, ok := that.(PBNode) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Links) != len(that1.Links) { - return false - } - for i := range this.Links { - if !this.Links[i].Equal(that1.Links[i]) { - return false - } - } - if !bytes.Equal(this.Data, that1.Data) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *PBLink) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&merkledag_pb.PBLink{") - if this.Hash != nil { - s = append(s, "Hash: "+valueToGoStringMerkledag(this.Hash, "byte")+",\n") - } - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringMerkledag(this.Name, "string")+",\n") - } - if this.Tsize != nil { - s = append(s, "Tsize: "+valueToGoStringMerkledag(this.Tsize, "uint64")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *PBNode) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&merkledag_pb.PBNode{") - if this.Links != nil { - s = append(s, "Links: "+fmt.Sprintf("%#v", this.Links)+",\n") - } - if this.Data != nil { - s = append(s, "Data: "+valueToGoStringMerkledag(this.Data, "byte")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringMerkledag(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *PBLink) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PBLink) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Hash != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkledag(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - if m.Name != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintMerkledag(dAtA, i, uint64(len(*m.Name))) - i += copy(dAtA[i:], *m.Name) - } - if m.Tsize != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintMerkledag(dAtA, i, uint64(*m.Tsize)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PBNode) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PBNode) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Links) > 0 { - for _, msg := range m.Links { - dAtA[i] = 0x12 - i++ - i = encodeVarintMerkledag(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Data != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkledag(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintMerkledag(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedPBLink(r randyMerkledag, easy bool) *PBLink { - this := &PBLink{} - if r.Intn(10) != 0 { - v1 := r.Intn(100) - this.Hash = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Hash[i] = byte(r.Intn(256)) - } - } - if r.Intn(10) != 0 { - v2 := string(randStringMerkledag(r)) - this.Name = &v2 - } - if r.Intn(10) != 0 { - v3 := uint64(uint64(r.Uint32())) - this.Tsize = &v3 - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedMerkledag(r, 4) - } - return this -} - -func NewPopulatedPBNode(r randyMerkledag, easy bool) *PBNode { - this := &PBNode{} - if r.Intn(10) != 0 { - v4 := r.Intn(100) - this.Data = make([]byte, v4) - for i := 0; i < v4; i++ { - this.Data[i] = byte(r.Intn(256)) - } - } - if r.Intn(10) != 0 { - v5 := r.Intn(5) - this.Links = make([]*PBLink, v5) - for i := 0; i < v5; i++ { - this.Links[i] = NewPopulatedPBLink(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedMerkledag(r, 3) - } - return this -} - -type randyMerkledag interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneMerkledag(r randyMerkledag) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringMerkledag(r randyMerkledag) string { - v6 := r.Intn(100) - tmps := make([]rune, v6) - for i := 0; i < v6; i++ { - tmps[i] = randUTF8RuneMerkledag(r) - } - return string(tmps) -} -func randUnrecognizedMerkledag(r randyMerkledag, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldMerkledag(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldMerkledag(dAtA []byte, r randyMerkledag, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(key)) - v7 := r.Int63() - if r.Intn(2) == 0 { - v7 *= -1 - } - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(v7)) - case 1: - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateMerkledag(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateMerkledag(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *PBLink) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hash != nil { - l = len(m.Hash) - n += 1 + l + sovMerkledag(uint64(l)) - } - if m.Name != nil { - l = len(*m.Name) - n += 1 + l + sovMerkledag(uint64(l)) - } - if m.Tsize != nil { - n += 1 + sovMerkledag(uint64(*m.Tsize)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PBNode) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovMerkledag(uint64(l)) - } - if len(m.Links) > 0 { - for _, e := range m.Links { - l = e.Size() - n += 1 + l + sovMerkledag(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovMerkledag(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozMerkledag(x uint64) (n int) { - return sovMerkledag(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *PBLink) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PBLink{`, - `Hash:` + valueToStringMerkledag(this.Hash) + `,`, - `Name:` + valueToStringMerkledag(this.Name) + `,`, - `Tsize:` + valueToStringMerkledag(this.Tsize) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *PBNode) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PBNode{`, - `Data:` + valueToStringMerkledag(this.Data) + `,`, - `Links:` + strings.Replace(fmt.Sprintf("%v", this.Links), "PBLink", "PBLink", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func valueToStringMerkledag(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *PBLink) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PBLink: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PBLink: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMerkledag - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMerkledag - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMerkledag - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMerkledag - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Name = &s - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Tsize", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Tsize = &v - default: - iNdEx = preIndex - skippy, err := skipMerkledag(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMerkledag - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMerkledag - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PBNode) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PBNode: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PBNode: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMerkledag - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMerkledag - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Links", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMerkledag - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMerkledag - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMerkledag - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Links = append(m.Links, &PBLink{}) - if err := m.Links[len(m.Links)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMerkledag(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMerkledag - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMerkledag - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMerkledag(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMerkledag - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMerkledag - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMerkledag - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMerkledag - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthMerkledag - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMerkledag - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipMerkledag(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthMerkledag - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthMerkledag = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMerkledag = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/ipfs/go-merkledag/pb/merkledag.proto b/vendor/github.com/ipfs/go-merkledag/pb/merkledag.proto deleted file mode 100644 index 01219590..00000000 --- a/vendor/github.com/ipfs/go-merkledag/pb/merkledag.proto +++ /dev/null @@ -1,39 +0,0 @@ -package merkledag.pb; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.gostring_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.verbose_equal_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.populate_all) = true; -option (gogoproto.testgen_all) = true; -option (gogoproto.benchgen_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - - -// An IPFS MerkleDAG Link -message PBLink { - - // multihash of the target object - optional bytes Hash = 1; - - // utf string name. should be unique per object - optional string Name = 2; - - // cumulative size of target object - optional uint64 Tsize = 3; -} - -// An IPFS MerkleDAG Node -message PBNode { - - // refs to other objects - repeated PBLink Links = 2; - - // opaque user data - optional bytes Data = 1; -} diff --git a/vendor/github.com/ipfs/go-merkledag/pb/upgrade_check.go b/vendor/github.com/ipfs/go-merkledag/pb/upgrade_check.go deleted file mode 100644 index e5a6473c..00000000 --- a/vendor/github.com/ipfs/go-merkledag/pb/upgrade_check.go +++ /dev/null @@ -1,5 +0,0 @@ -package merkledag_pb - -// Make sure the user doesn't upgrade this package! -// This will fail to build if the user does. -const _ = DoNotUpgradeFileEverItWillChangeYourHashes diff --git a/vendor/github.com/ipfs/go-merkledag/raw.go b/vendor/github.com/ipfs/go-merkledag/raw.go deleted file mode 100644 index a0adb4a1..00000000 --- a/vendor/github.com/ipfs/go-merkledag/raw.go +++ /dev/null @@ -1,103 +0,0 @@ -package merkledag - -import ( - "encoding/json" - "fmt" - "github.com/ipfs/go-block-format" - - cid "github.com/ipfs/go-cid" - u "github.com/ipfs/go-ipfs-util" - ipld "github.com/ipfs/go-ipld-format" -) - -// RawNode represents a node which only contains data. -type RawNode struct { - blocks.Block -} - -// NewRawNode creates a RawNode using the default sha2-256 hash function. -func NewRawNode(data []byte) *RawNode { - h := u.Hash(data) - c := cid.NewCidV1(cid.Raw, h) - blk, _ := blocks.NewBlockWithCid(data, c) - - return &RawNode{blk} -} - -// DecodeRawBlock is a block decoder for raw IPLD nodes conforming to `node.DecodeBlockFunc`. -func DecodeRawBlock(block blocks.Block) (ipld.Node, error) { - if block.Cid().Type() != cid.Raw { - return nil, fmt.Errorf("raw nodes cannot be decoded from non-raw blocks: %d", block.Cid().Type()) - } - // Once you "share" a block, it should be immutable. Therefore, we can just use this block as-is. - return &RawNode{block}, nil -} - -var _ ipld.DecodeBlockFunc = DecodeRawBlock - -// NewRawNodeWPrefix creates a RawNode using the provided cid builder -func NewRawNodeWPrefix(data []byte, builder cid.Builder) (*RawNode, error) { - builder = builder.WithCodec(cid.Raw) - c, err := builder.Sum(data) - if err != nil { - return nil, err - } - blk, err := blocks.NewBlockWithCid(data, c) - if err != nil { - return nil, err - } - return &RawNode{blk}, nil -} - -// Links returns nil. -func (rn *RawNode) Links() []*ipld.Link { - return nil -} - -// ResolveLink returns an error. -func (rn *RawNode) ResolveLink(path []string) (*ipld.Link, []string, error) { - return nil, nil, ErrLinkNotFound -} - -// Resolve returns an error. -func (rn *RawNode) Resolve(path []string) (interface{}, []string, error) { - return nil, nil, ErrLinkNotFound -} - -// Tree returns nil. -func (rn *RawNode) Tree(p string, depth int) []string { - return nil -} - -// Copy performs a deep copy of this node and returns it as an ipld.Node -func (rn *RawNode) Copy() ipld.Node { - copybuf := make([]byte, len(rn.RawData())) - copy(copybuf, rn.RawData()) - nblk, err := blocks.NewBlockWithCid(rn.RawData(), rn.Cid()) - if err != nil { - // programmer error - panic("failure attempting to clone raw block: " + err.Error()) - } - - return &RawNode{nblk} -} - -// Size returns the size of this node -func (rn *RawNode) Size() (uint64, error) { - return uint64(len(rn.RawData())), nil -} - -// Stat returns some Stats about this node. -func (rn *RawNode) Stat() (*ipld.NodeStat, error) { - return &ipld.NodeStat{ - CumulativeSize: len(rn.RawData()), - DataSize: len(rn.RawData()), - }, nil -} - -// MarshalJSON is required for our "ipfs dag" commands. -func (rn *RawNode) MarshalJSON() ([]byte, error) { - return json.Marshal(string(rn.RawData())) -} - -var _ ipld.Node = (*RawNode)(nil) diff --git a/vendor/github.com/ipfs/go-merkledag/readonly.go b/vendor/github.com/ipfs/go-merkledag/readonly.go deleted file mode 100644 index 36242fbe..00000000 --- a/vendor/github.com/ipfs/go-merkledag/readonly.go +++ /dev/null @@ -1,20 +0,0 @@ -package merkledag - -import ( - "fmt" - - ipld "github.com/ipfs/go-ipld-format" -) - -// ErrReadOnly is used when a read-only datastructure is written to. -var ErrReadOnly = fmt.Errorf("cannot write to readonly DAGService") - -// NewReadOnlyDagService takes a NodeGetter, and returns a full DAGService -// implementation that returns ErrReadOnly when its 'write' methods are -// invoked. -func NewReadOnlyDagService(ng ipld.NodeGetter) ipld.DAGService { - return &ComboService{ - Read: ng, - Write: &ErrorService{ErrReadOnly}, - } -} diff --git a/vendor/github.com/ipfs/go-merkledag/rwservice.go b/vendor/github.com/ipfs/go-merkledag/rwservice.go deleted file mode 100644 index a916350a..00000000 --- a/vendor/github.com/ipfs/go-merkledag/rwservice.go +++ /dev/null @@ -1,47 +0,0 @@ -package merkledag - -import ( - "context" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// ComboService implements ipld.DAGService, using 'Read' for all fetch methods, -// and 'Write' for all methods that add new objects. -type ComboService struct { - Read ipld.NodeGetter - Write ipld.DAGService -} - -var _ ipld.DAGService = (*ComboService)(nil) - -// Add writes a new node using the Write DAGService. -func (cs *ComboService) Add(ctx context.Context, nd ipld.Node) error { - return cs.Write.Add(ctx, nd) -} - -// AddMany adds nodes using the Write DAGService. -func (cs *ComboService) AddMany(ctx context.Context, nds []ipld.Node) error { - return cs.Write.AddMany(ctx, nds) -} - -// Get fetches a node using the Read DAGService. -func (cs *ComboService) Get(ctx context.Context, c cid.Cid) (ipld.Node, error) { - return cs.Read.Get(ctx, c) -} - -// GetMany fetches nodes using the Read DAGService. -func (cs *ComboService) GetMany(ctx context.Context, cids []cid.Cid) <-chan *ipld.NodeOption { - return cs.Read.GetMany(ctx, cids) -} - -// Remove deletes a node using the Write DAGService. -func (cs *ComboService) Remove(ctx context.Context, c cid.Cid) error { - return cs.Write.Remove(ctx, c) -} - -// RemoveMany deletes nodes using the Write DAGService. -func (cs *ComboService) RemoveMany(ctx context.Context, cids []cid.Cid) error { - return cs.Write.RemoveMany(ctx, cids) -} diff --git a/vendor/github.com/ipfs/go-merkledag/session.go b/vendor/github.com/ipfs/go-merkledag/session.go deleted file mode 100644 index c7bbff16..00000000 --- a/vendor/github.com/ipfs/go-merkledag/session.go +++ /dev/null @@ -1,21 +0,0 @@ -package merkledag - -import ( - "context" - - ipld "github.com/ipfs/go-ipld-format" -) - -// SessionMaker is an object that can generate a new fetching session. -type SessionMaker interface { - Session(context.Context) ipld.NodeGetter -} - -// NewSession returns a session backed NodeGetter if the given NodeGetter -// implements SessionMaker. -func NewSession(ctx context.Context, g ipld.NodeGetter) ipld.NodeGetter { - if sm, ok := g.(SessionMaker); ok { - return sm.Session(ctx) - } - return g -} diff --git a/vendor/github.com/ipfs/go-metrics-interface/.gitignore b/vendor/github.com/ipfs/go-metrics-interface/.gitignore deleted file mode 100644 index daf913b1..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/ipfs/go-metrics-interface/.travis.yml b/vendor/github.com/ipfs/go-metrics-interface/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-metrics-interface/LICENSE b/vendor/github.com/ipfs/go-metrics-interface/LICENSE deleted file mode 100644 index ff687483..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-metrics-interface/context.go b/vendor/github.com/ipfs/go-metrics-interface/context.go deleted file mode 100644 index 8796b8b9..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/context.go +++ /dev/null @@ -1,26 +0,0 @@ -package metrics - -import "context" - -const CtxScopeKey = "ipfs.metrics.scope" - -func CtxGetScope(ctx context.Context) string { - s := ctx.Value(CtxScopeKey) - if s == nil { - return "" - } - str, ok := s.(string) - if !ok { - return "" - } - return str -} - -func CtxScope(ctx context.Context, scope string) context.Context { - return context.WithValue(ctx, CtxScopeKey, scope) -} - -func CtxSubScope(ctx context.Context, subscope string) context.Context { - curscope := CtxGetScope(ctx) - return CtxScope(ctx, curscope+"."+subscope) -} diff --git a/vendor/github.com/ipfs/go-metrics-interface/ctor.go b/vendor/github.com/ipfs/go-metrics-interface/ctor.go deleted file mode 100644 index aac694e5..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/ctor.go +++ /dev/null @@ -1,43 +0,0 @@ -package metrics - -import ( - "context" - "errors" -) - -var ErrImplemented = errors.New("there is implemenation already injected") - -var ctorImpl InternalNew = nil - -// name is dot spearated path -// must be uniqe, use system naming, and unit postfix, examples: -// ipfs.blockstore.bloomcache.bloom.miss.total -// ipfs.routing.dht.notresuingstream.total -// -// both arguemnts are obligatory -func New(name, helptext string) Creator { - if ctorImpl == nil { - return &noop{} - } else { - return ctorImpl(name, helptext) - } -} - -func NewCtx(ctx context.Context, name, helptext string) Creator { - return New(CtxGetScope(ctx)+"."+name, helptext) -} - -type InternalNew func(string, string) Creator - -func InjectImpl(newimpl InternalNew) error { - if ctorImpl != nil { - return ErrImplemented - } else { - ctorImpl = newimpl - return nil - } -} - -func Active() bool { - return ctorImpl != nil -} diff --git a/vendor/github.com/ipfs/go-metrics-interface/go.mod b/vendor/github.com/ipfs/go-metrics-interface/go.mod deleted file mode 100644 index 57654087..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/ipfs/go-metrics-interface diff --git a/vendor/github.com/ipfs/go-metrics-interface/interface.go b/vendor/github.com/ipfs/go-metrics-interface/interface.go deleted file mode 100644 index f1237593..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -package metrics - -import ( - "time" -) - -// Increment only metric -type Counter interface { - Inc() - Add(float64) // Only positive -} - -// Increse and decrese metric -type Gauge interface { - Set(float64) // Introduced discontinuity - Inc() - Dec() - Add(float64) - Sub(float64) -} - -type Histogram interface { - Observe(float64) // Adds observation to Histogram -} - -type Summary interface { - Observe(float64) // Adds observation to Summary -} - -// Consult http://godoc.org/github.com/prometheus/client_golang/prometheus#SummaryOpts -type SummaryOpts struct { - Objectives map[float64]float64 - MaxAge time.Duration - AgeBuckets uint32 - BufCap uint32 -} - -type Creator interface { - Counter() Counter - Gauge() Gauge - Histogram(buckets []float64) Histogram - - // opts cannot be nil, use empty summary instance - Summary(opts SummaryOpts) Summary -} diff --git a/vendor/github.com/ipfs/go-metrics-interface/noop.go b/vendor/github.com/ipfs/go-metrics-interface/noop.go deleted file mode 100644 index 5b59aa83..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/noop.go +++ /dev/null @@ -1,46 +0,0 @@ -package metrics - -// Also implements the Counter interface -type noop struct{} - -func (g *noop) Set(v float64) { - // Noop -} - -func (g *noop) Inc() { - // Noop -} - -func (g *noop) Dec() { - // Noop -} - -func (g *noop) Add(v float64) { - // Noop -} - -func (g *noop) Sub(v float64) { - // Noop -} - -func (g *noop) Observe(v float64) { - // Noop -} - -// Creator functions - -func (g *noop) Counter() Counter { - return g -} - -func (g *noop) Gauge() Gauge { - return g -} - -func (g *noop) Histogram(buckets []float64) Histogram { - return g -} - -func (g *noop) Summary(opts SummaryOpts) Summary { - return g -} diff --git a/vendor/github.com/ipfs/go-metrics-interface/package.json b/vendor/github.com/ipfs/go-metrics-interface/package.json deleted file mode 100644 index 6ba42d76..00000000 --- a/vendor/github.com/ipfs/go-metrics-interface/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "ipfs", - "bugs": { - "URL": "https://github.com/ipfs/go-metrics-interface/issues", - "url": "https://github.com/ipfs/go-metrics-interface/issues" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-metrics-interface" - }, - "gxVersion": "0.9.0", - "language": "go", - "license": "MIT", - "name": "go-metrics-interface", - "version": "0.2.0" -} - diff --git a/vendor/github.com/ipfs/go-mfs/.travis.yml b/vendor/github.com/ipfs/go-mfs/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/ipfs/go-mfs/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-mfs/CODEOWNERS b/vendor/github.com/ipfs/go-mfs/CODEOWNERS deleted file mode 100644 index ea812704..00000000 --- a/vendor/github.com/ipfs/go-mfs/CODEOWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Please see https://help.github.com/articles/about-codeowners/ for more information - -# Global owner -* @schomatis - -# Subsystem specific owners - - diff --git a/vendor/github.com/ipfs/go-mfs/LICENSE b/vendor/github.com/ipfs/go-mfs/LICENSE deleted file mode 100644 index e4224df5..00000000 --- a/vendor/github.com/ipfs/go-mfs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-mfs/Makefile b/vendor/github.com/ipfs/go-mfs/Makefile deleted file mode 100644 index 73f2841f..00000000 --- a/vendor/github.com/ipfs/go-mfs/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish - - diff --git a/vendor/github.com/ipfs/go-mfs/README.md b/vendor/github.com/ipfs/go-mfs/README.md deleted file mode 100644 index 4beaa661..00000000 --- a/vendor/github.com/ipfs/go-mfs/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# go-mfs - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/ipfs/go-mfs?status.svg)](https://godoc.org/github.com/ipfs/go-mfs) -[![Build Status](https://travis-ci.org/ipfs/go-mfs.svg?branch=master)](https://travis-ci.org/ipfs/go-mfs) - -> go-mfs implements an in-memory model of a mutable IPFS filesystem. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-mfs` works like a regular Go module: - -``` -> go get github.com/ipfs/go-mfs -``` - -It uses [Gx](https://github.com/whyrusleeping/gx) to manage dependencies. You can use `make all` to build it with the `gx` dependencies. - -## Usage - -``` -import "github.com/ipfs/go-mfs" -``` - -Check the [GoDoc documentation](https://godoc.org/github.com/ipfs/go-mfs) - -## Documentation - -Documentation around the MFS and the Files API in general around IPFS is a work in progress the following links may be of use: - -* [UnixFS](https://docs.ipfs.io/guides/concepts/unixfs/) -* [MFS](https://docs.ipfs.io/guides/concepts/mfs/) -* [General concept document about how are files handled in IPFS (WIP)](https://github.com/ipfs/docs/issues/133) - -## Repository Structure -This repository contains many files, all belonging to the root `mfs` package. - -* `file.go`: MFS `File`. -* `dir.go`: MFS `Directory`. -* `fd.go`: `FileDescriptor` used to operate on `File`s. -* `ops.go`: Functions that do not belong to either `File` nor `Directory` (although they mostly operate on them) that contain common operations to the MFS, e.g., find, move, add a file, make a directory. -* `root.go`: MFS `Root` (a `Directory` with republishing support). -* `repub.go`: `Republisher`. -* `mfs_test.go`: General tests (needs a [revision](https://github.com/ipfs/go-mfs/issues/9)). -* `repub_test.go`: Republisher-specific tests (contains only the `TestRepublisher` function). - -## Contribute - -PRs accepted. - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs, Inc. diff --git a/vendor/github.com/ipfs/go-mfs/dir.go b/vendor/github.com/ipfs/go-mfs/dir.go deleted file mode 100644 index 61f85d06..00000000 --- a/vendor/github.com/ipfs/go-mfs/dir.go +++ /dev/null @@ -1,450 +0,0 @@ -package mfs - -import ( - "context" - "errors" - "fmt" - "os" - "path" - "sync" - "time" - - dag "github.com/ipfs/go-merkledag" - ft "github.com/ipfs/go-unixfs" - uio "github.com/ipfs/go-unixfs/io" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -var ErrNotYetImplemented = errors.New("not yet implemented") -var ErrInvalidChild = errors.New("invalid child node") -var ErrDirExists = errors.New("directory already has entry by that name") - -// TODO: There's too much functionality associated with this structure, -// let's organize it (and if possible extract part of it elsewhere) -// and document the main features of `Directory` here. -type Directory struct { - inode - - // Internal cache with added entries to the directory, its cotents - // are synched with the underlying `unixfsDir` node in `sync()`. - entriesCache map[string]FSNode - - lock sync.Mutex - // TODO: What content is being protected here exactly? The entire directory? - - ctx context.Context - - // UnixFS directory implementation used for creating, - // reading and editing directories. - unixfsDir uio.Directory - - modTime time.Time -} - -// NewDirectory constructs a new MFS directory. -// -// You probably don't want to call this directly. Instead, construct a new root -// using NewRoot. -func NewDirectory(ctx context.Context, name string, node ipld.Node, parent parent, dserv ipld.DAGService) (*Directory, error) { - db, err := uio.NewDirectoryFromNode(dserv, node) - if err != nil { - return nil, err - } - - return &Directory{ - inode: inode{ - name: name, - parent: parent, - dagService: dserv, - }, - ctx: ctx, - unixfsDir: db, - entriesCache: make(map[string]FSNode), - modTime: time.Now(), - }, nil -} - -// GetCidBuilder gets the CID builder of the root node -func (d *Directory) GetCidBuilder() cid.Builder { - return d.unixfsDir.GetCidBuilder() -} - -// SetCidBuilder sets the CID builder -func (d *Directory) SetCidBuilder(b cid.Builder) { - d.unixfsDir.SetCidBuilder(b) -} - -// This method implements the `parent` interface. It first does the local -// update of the child entry in the underlying UnixFS directory and saves -// the newly created directory node with the updated entry in the DAG -// service. Then it propagates the update upwards (through this same -// interface) repeating the whole process in the parent. -func (d *Directory) updateChildEntry(c child) error { - newDirNode, err := d.localUpdate(c) - if err != nil { - return err - } - - // Continue to propagate the update process upwards - // (all the way up to the root). - return d.parent.updateChildEntry(child{d.name, newDirNode}) -} - -// This method implements the part of `updateChildEntry` that needs -// to be locked around: in charge of updating the UnixFS layer and -// generating the new node reflecting the update. It also stores the -// new node in the DAG layer. -func (d *Directory) localUpdate(c child) (*dag.ProtoNode, error) { - d.lock.Lock() - defer d.lock.Unlock() - - err := d.updateChild(c) - if err != nil { - return nil, err - } - // TODO: Clearly define how are we propagating changes to lower layers - // like UnixFS. - - nd, err := d.unixfsDir.GetNode() - if err != nil { - return nil, err - } - - pbnd, ok := nd.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - err = d.dagService.Add(d.ctx, nd) - if err != nil { - return nil, err - } - - return pbnd.Copy().(*dag.ProtoNode), nil - // TODO: Why do we need a copy? -} - -// Update child entry in the underlying UnixFS directory. -func (d *Directory) updateChild(c child) error { - err := d.addUnixFSChild(c) - if err != nil { - return err - } - - d.modTime = time.Now() - - return nil -} - -func (d *Directory) Type() NodeType { - return TDir -} - -// childNode returns a FSNode under this directory by the given name if it exists. -// it does *not* check the cached dirs and files -func (d *Directory) childNode(name string) (FSNode, error) { - nd, err := d.childFromDag(name) - if err != nil { - return nil, err - } - - return d.cacheNode(name, nd) -} - -// cacheNode caches a node into d.childDirs or d.files and returns the FSNode. -func (d *Directory) cacheNode(name string, nd ipld.Node) (FSNode, error) { - switch nd := nd.(type) { - case *dag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return nil, err - } - - switch fsn.Type() { - case ft.TDirectory, ft.THAMTShard: - ndir, err := NewDirectory(d.ctx, name, nd, d, d.dagService) - if err != nil { - return nil, err - } - - d.entriesCache[name] = ndir - return ndir, nil - case ft.TFile, ft.TRaw, ft.TSymlink: - nfi, err := NewFile(name, nd, d, d.dagService) - if err != nil { - return nil, err - } - d.entriesCache[name] = nfi - return nfi, nil - case ft.TMetadata: - return nil, ErrNotYetImplemented - default: - return nil, ErrInvalidChild - } - case *dag.RawNode: - nfi, err := NewFile(name, nd, d, d.dagService) - if err != nil { - return nil, err - } - d.entriesCache[name] = nfi - return nfi, nil - default: - return nil, fmt.Errorf("unrecognized node type in cache node") - } -} - -// Child returns the child of this directory by the given name -func (d *Directory) Child(name string) (FSNode, error) { - d.lock.Lock() - defer d.lock.Unlock() - return d.childUnsync(name) -} - -func (d *Directory) Uncache(name string) { - d.lock.Lock() - defer d.lock.Unlock() - delete(d.entriesCache, name) -} - -// childFromDag searches through this directories dag node for a child link -// with the given name -func (d *Directory) childFromDag(name string) (ipld.Node, error) { - return d.unixfsDir.Find(d.ctx, name) -} - -// childUnsync returns the child under this directory by the given name -// without locking, useful for operations which already hold a lock -func (d *Directory) childUnsync(name string) (FSNode, error) { - entry, ok := d.entriesCache[name] - if ok { - return entry, nil - } - - return d.childNode(name) -} - -type NodeListing struct { - Name string - Type int - Size int64 - Hash string -} - -func (d *Directory) ListNames(ctx context.Context) ([]string, error) { - d.lock.Lock() - defer d.lock.Unlock() - - var out []string - err := d.unixfsDir.ForEachLink(ctx, func(l *ipld.Link) error { - out = append(out, l.Name) - return nil - }) - if err != nil { - return nil, err - } - - return out, nil -} - -func (d *Directory) List(ctx context.Context) ([]NodeListing, error) { - var out []NodeListing - err := d.ForEachEntry(ctx, func(nl NodeListing) error { - out = append(out, nl) - return nil - }) - return out, err -} - -func (d *Directory) ForEachEntry(ctx context.Context, f func(NodeListing) error) error { - d.lock.Lock() - defer d.lock.Unlock() - return d.unixfsDir.ForEachLink(ctx, func(l *ipld.Link) error { - c, err := d.childUnsync(l.Name) - if err != nil { - return err - } - - nd, err := c.GetNode() - if err != nil { - return err - } - - child := NodeListing{ - Name: l.Name, - Type: int(c.Type()), - Hash: nd.Cid().String(), - } - - if c, ok := c.(*File); ok { - size, err := c.Size() - if err != nil { - return err - } - child.Size = size - } - - return f(child) - }) -} - -func (d *Directory) Mkdir(name string) (*Directory, error) { - d.lock.Lock() - defer d.lock.Unlock() - - fsn, err := d.childUnsync(name) - if err == nil { - switch fsn := fsn.(type) { - case *Directory: - return fsn, os.ErrExist - case *File: - return nil, os.ErrExist - default: - return nil, fmt.Errorf("unrecognized type: %#v", fsn) - } - } - - ndir := ft.EmptyDirNode() - ndir.SetCidBuilder(d.GetCidBuilder()) - - err = d.dagService.Add(d.ctx, ndir) - if err != nil { - return nil, err - } - - err = d.addUnixFSChild(child{name, ndir}) - if err != nil { - return nil, err - } - - dirobj, err := NewDirectory(d.ctx, name, ndir, d, d.dagService) - if err != nil { - return nil, err - } - - d.entriesCache[name] = dirobj - return dirobj, nil -} - -func (d *Directory) Unlink(name string) error { - d.lock.Lock() - defer d.lock.Unlock() - - delete(d.entriesCache, name) - - return d.unixfsDir.RemoveChild(d.ctx, name) -} - -func (d *Directory) Flush() error { - nd, err := d.GetNode() - if err != nil { - return err - } - - return d.parent.updateChildEntry(child{d.name, nd}) -} - -// AddChild adds the node 'nd' under this directory giving it the name 'name' -func (d *Directory) AddChild(name string, nd ipld.Node) error { - d.lock.Lock() - defer d.lock.Unlock() - - _, err := d.childUnsync(name) - if err == nil { - return ErrDirExists - } - - err = d.dagService.Add(d.ctx, nd) - if err != nil { - return err - } - - err = d.addUnixFSChild(child{name, nd}) - if err != nil { - return err - } - - d.modTime = time.Now() - return nil -} - -// addUnixFSChild adds a child to the inner UnixFS directory -// and transitions to a HAMT implementation if needed. -func (d *Directory) addUnixFSChild(c child) error { - if uio.UseHAMTSharding { - // If the directory HAMT implementation is being used and this - // directory is actually a basic implementation switch it to HAMT. - if basicDir, ok := d.unixfsDir.(*uio.BasicDirectory); ok { - hamtDir, err := basicDir.SwitchToSharding(d.ctx) - if err != nil { - return err - } - d.unixfsDir = hamtDir - } - } - - err := d.unixfsDir.AddChild(d.ctx, c.Name, c.Node) - if err != nil { - return err - } - - return nil -} - -func (d *Directory) sync() error { - for name, entry := range d.entriesCache { - nd, err := entry.GetNode() - if err != nil { - return err - } - - err = d.updateChild(child{name, nd}) - if err != nil { - return err - } - } - - // TODO: Should we clean the cache here? - - return nil -} - -func (d *Directory) Path() string { - cur := d - var out string - for cur != nil { - switch parent := cur.parent.(type) { - case *Directory: - out = path.Join(cur.name, out) - cur = parent - case *Root: - return "/" + out - default: - panic("directory parent neither a directory nor a root") - } - } - return out -} - -func (d *Directory) GetNode() (ipld.Node, error) { - d.lock.Lock() - defer d.lock.Unlock() - - err := d.sync() - if err != nil { - return nil, err - } - - nd, err := d.unixfsDir.GetNode() - if err != nil { - return nil, err - } - - err = d.dagService.Add(d.ctx, nd) - if err != nil { - return nil, err - } - - return nd.Copy(), err -} diff --git a/vendor/github.com/ipfs/go-mfs/fd.go b/vendor/github.com/ipfs/go-mfs/fd.go deleted file mode 100644 index 77a82d69..00000000 --- a/vendor/github.com/ipfs/go-mfs/fd.go +++ /dev/null @@ -1,197 +0,0 @@ -package mfs - -import ( - "fmt" - "io" - - mod "github.com/ipfs/go-unixfs/mod" - - context "context" - - ipld "github.com/ipfs/go-ipld-format" -) - -type state uint8 - -const ( - stateCreated state = iota - stateFlushed - stateDirty - stateClosed -) - -// One `File` can have many `FileDescriptor`s associated to it -// (only one if it's RW, many if they are RO, see `File.desclock`). -// A `FileDescriptor` contains the "view" of the file (through an -// instance of a `DagModifier`), that's why it (and not the `File`) -// has the responsibility to `Flush` (which crystallizes that view -// in the `File`'s `Node`). -type FileDescriptor interface { - io.Reader - CtxReadFull(context.Context, []byte) (int, error) - - io.Writer - io.WriterAt - - io.Closer - io.Seeker - - Truncate(int64) error - Size() (int64, error) - Flush() error -} - -type fileDescriptor struct { - inode *File - mod *mod.DagModifier - flags Flags - - state state -} - -func (fi *fileDescriptor) checkWrite() error { - if fi.state == stateClosed { - return ErrClosed - } - if !fi.flags.Write { - return fmt.Errorf("file is read-only") - } - return nil -} - -func (fi *fileDescriptor) checkRead() error { - if fi.state == stateClosed { - return ErrClosed - } - if !fi.flags.Read { - return fmt.Errorf("file is write-only") - } - return nil -} - -// Size returns the size of the file referred to by this descriptor -func (fi *fileDescriptor) Size() (int64, error) { - return fi.mod.Size() -} - -// Truncate truncates the file to size -func (fi *fileDescriptor) Truncate(size int64) error { - if err := fi.checkWrite(); err != nil { - return fmt.Errorf("truncate failed: %s", err) - } - fi.state = stateDirty - return fi.mod.Truncate(size) -} - -// Write writes the given data to the file at its current offset -func (fi *fileDescriptor) Write(b []byte) (int, error) { - if err := fi.checkWrite(); err != nil { - return 0, fmt.Errorf("write failed: %s", err) - } - fi.state = stateDirty - return fi.mod.Write(b) -} - -// Read reads into the given buffer from the current offset -func (fi *fileDescriptor) Read(b []byte) (int, error) { - if err := fi.checkRead(); err != nil { - return 0, fmt.Errorf("read failed: %s", err) - } - return fi.mod.Read(b) -} - -// Read reads into the given buffer from the current offset -func (fi *fileDescriptor) CtxReadFull(ctx context.Context, b []byte) (int, error) { - if err := fi.checkRead(); err != nil { - return 0, fmt.Errorf("read failed: %s", err) - } - return fi.mod.CtxReadFull(ctx, b) -} - -// Close flushes, then propogates the modified dag node up the directory structure -// and signals a republish to occur -func (fi *fileDescriptor) Close() error { - if fi.state == stateClosed { - return ErrClosed - } - if fi.flags.Write { - defer fi.inode.desclock.Unlock() - } else if fi.flags.Read { - defer fi.inode.desclock.RUnlock() - } - err := fi.flushUp(fi.flags.Sync) - fi.state = stateClosed - return err -} - -// Flush generates a new version of the node of the underlying -// UnixFS directory (adding it to the DAG service) and updates -// the entry in the parent directory (setting `fullSync` to -// propagate the update all the way to the root). -func (fi *fileDescriptor) Flush() error { - return fi.flushUp(true) -} - -// flushUp syncs the file and adds it to the dagservice -// it *must* be called with the File's lock taken -// If `fullSync` is set the changes are propagated upwards -// (the `Up` part of `flushUp`). -func (fi *fileDescriptor) flushUp(fullSync bool) error { - var nd ipld.Node - switch fi.state { - case stateCreated, stateDirty: - var err error - nd, err = fi.mod.GetNode() - if err != nil { - return err - } - err = fi.inode.dagService.Add(context.TODO(), nd) - if err != nil { - return err - } - - // TODO: Very similar logic to the update process in - // `Directory`, the logic should be unified, both structures - // (`File` and `Directory`) are backed by a IPLD node with - // a UnixFS format that is the actual target of the update - // (regenerating it and adding it to the DAG service). - fi.inode.nodeLock.Lock() - // Always update the file descriptor's inode with the created/modified node. - fi.inode.node = nd - // Save the members to be used for subsequent calls - parent := fi.inode.parent - name := fi.inode.name - fi.inode.nodeLock.Unlock() - - // Bubble up the update's to the parent, only if fullSync is set to true. - if fullSync { - if err := parent.updateChildEntry(child{name, nd}); err != nil { - return err - } - } - - fi.state = stateFlushed - return nil - case stateFlushed: - return nil - default: - panic("invalid state") - } -} - -// Seek implements io.Seeker -func (fi *fileDescriptor) Seek(offset int64, whence int) (int64, error) { - if fi.state == stateClosed { - return 0, fmt.Errorf("seek failed: %s", ErrClosed) - } - return fi.mod.Seek(offset, whence) -} - -// Write At writes the given bytes at the offset 'at' -func (fi *fileDescriptor) WriteAt(b []byte, at int64) (int, error) { - if err := fi.checkWrite(); err != nil { - return 0, fmt.Errorf("write-at failed: %s", err) - } - fi.state = stateDirty - return fi.mod.WriteAt(b, at) -} diff --git a/vendor/github.com/ipfs/go-mfs/file.go b/vendor/github.com/ipfs/go-mfs/file.go deleted file mode 100644 index 280bf93a..00000000 --- a/vendor/github.com/ipfs/go-mfs/file.go +++ /dev/null @@ -1,179 +0,0 @@ -package mfs - -import ( - "context" - "fmt" - "sync" - - dag "github.com/ipfs/go-merkledag" - ft "github.com/ipfs/go-unixfs" - mod "github.com/ipfs/go-unixfs/mod" - - chunker "github.com/ipfs/go-ipfs-chunker" - ipld "github.com/ipfs/go-ipld-format" -) - -// File represents a file in the MFS, its logic its mainly targeted -// to coordinating (potentially many) `FileDescriptor`s pointing to -// it. -type File struct { - inode - - // Lock to coordinate the `FileDescriptor`s associated to this file. - desclock sync.RWMutex - - // This isn't any node, it's the root node that represents the - // entire DAG of nodes that comprise the file. - // TODO: Rename, there should be an explicit term for these root nodes - // of a particular sub-DAG that abstract an upper layer's entity. - node ipld.Node - - // Lock around the `node` that represents this file, necessary because - // there may be many `FileDescriptor`s operating on this `File`. - nodeLock sync.RWMutex - - RawLeaves bool -} - -// NewFile returns a NewFile object with the given parameters. If the -// Cid version is non-zero RawLeaves will be enabled. -func NewFile(name string, node ipld.Node, parent parent, dserv ipld.DAGService) (*File, error) { - fi := &File{ - inode: inode{ - name: name, - parent: parent, - dagService: dserv, - }, - node: node, - } - if node.Cid().Prefix().Version > 0 { - fi.RawLeaves = true - } - return fi, nil -} - -func (fi *File) Open(flags Flags) (_ FileDescriptor, _retErr error) { - if flags.Write { - fi.desclock.Lock() - defer func() { - if _retErr != nil { - fi.desclock.Unlock() - } - }() - } else if flags.Read { - fi.desclock.RLock() - defer func() { - if _retErr != nil { - fi.desclock.Unlock() - } - }() - } else { - return nil, fmt.Errorf("file opened for neither reading nor writing") - } - - fi.nodeLock.RLock() - node := fi.node - fi.nodeLock.RUnlock() - - // TODO: Move this `switch` logic outside (maybe even - // to another package, this seems like a job of UnixFS), - // `NewDagModifier` uses the IPLD node, we're not - // extracting anything just doing a safety check. - switch node := node.(type) { - case *dag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(node.Data()) - if err != nil { - return nil, err - } - - switch fsn.Type() { - default: - return nil, fmt.Errorf("unsupported fsnode type for 'file'") - case ft.TSymlink: - return nil, fmt.Errorf("symlinks not yet supported") - case ft.TFile, ft.TRaw: - // OK case - } - case *dag.RawNode: - // Ok as well. - } - - dmod, err := mod.NewDagModifier(context.TODO(), node, fi.dagService, chunker.DefaultSplitter) - // TODO: Remove the use of the `chunker` package here, add a new `NewDagModifier` in - // `go-unixfs` with the `DefaultSplitter` already included. - if err != nil { - return nil, err - } - dmod.RawLeaves = fi.RawLeaves - - return &fileDescriptor{ - inode: fi, - flags: flags, - mod: dmod, - state: stateCreated, - }, nil -} - -// Size returns the size of this file -// TODO: Should we be providing this API? -// TODO: There's already a `FileDescriptor.Size()` that -// through the `DagModifier`'s `fileSize` function is doing -// pretty much the same thing as here, we should at least call -// that function and wrap the `ErrNotUnixfs` with an MFS text. -func (fi *File) Size() (int64, error) { - fi.nodeLock.RLock() - defer fi.nodeLock.RUnlock() - switch nd := fi.node.(type) { - case *dag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return 0, err - } - return int64(fsn.FileSize()), nil - case *dag.RawNode: - return int64(len(nd.RawData())), nil - default: - return 0, fmt.Errorf("unrecognized node type in mfs/file.Size()") - } -} - -// GetNode returns the dag node associated with this file -// TODO: Use this method and do not access the `nodeLock` directly anywhere else. -func (fi *File) GetNode() (ipld.Node, error) { - fi.nodeLock.RLock() - defer fi.nodeLock.RUnlock() - return fi.node, nil -} - -// TODO: Tight coupling with the `FileDescriptor`, at the -// very least this should be an independent function that -// takes a `File` argument and automates the open/flush/close -// operations. -// TODO: Why do we need to flush a file that isn't opened? -// (the `OpenWriteOnly` seems to implicitly be targeting a -// closed file, a file we forgot to flush? can we close -// a file without flushing?) -func (fi *File) Flush() error { - // open the file in fullsync mode - fd, err := fi.Open(Flags{Write: true, Sync: true}) - if err != nil { - return err - } - - defer fd.Close() - - return fd.Flush() -} - -func (fi *File) Sync() error { - // just being able to take the writelock means the descriptor is synced - // TODO: Why? - fi.desclock.Lock() - fi.desclock.Unlock() - return nil -} - -// Type returns the type FSNode this is -func (fi *File) Type() NodeType { - return TFile -} diff --git a/vendor/github.com/ipfs/go-mfs/go.mod b/vendor/github.com/ipfs/go-mfs/go.mod deleted file mode 100644 index 6e1d925f..00000000 --- a/vendor/github.com/ipfs/go-mfs/go.mod +++ /dev/null @@ -1,17 +0,0 @@ -module github.com/ipfs/go-mfs - -require ( - github.com/ipfs/go-blockservice v0.1.1 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-ipfs-blockstore v0.0.1 - github.com/ipfs/go-ipfs-chunker v0.0.1 - github.com/ipfs/go-ipfs-exchange-offline v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-ipld-format v0.0.2 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-merkledag v0.1.0 - github.com/ipfs/go-path v0.0.7 - github.com/ipfs/go-unixfs v0.1.0 - github.com/libp2p/go-libp2p-testing v0.0.4 -) diff --git a/vendor/github.com/ipfs/go-mfs/go.sum b/vendor/github.com/ipfs/go-mfs/go.sum deleted file mode 100644 index 7dbab573..00000000 --- a/vendor/github.com/ipfs/go-mfs/go.sum +++ /dev/null @@ -1,497 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/Stebalien/go-bitfield v0.0.1 h1:X3kbSSPUaJK60wV2hjOPZwmpljr6VGCqdq4cBLhbQBo= -github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50 h1:4i3KsuVA0o0KoBxAC5x+MY7RbteiMK1V7gf/G08NGIQ= -github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.0.9 h1:Dy0qvYlaOd2E2FOL2gApJ21qVjepJsGNNfstLrGf+0I= -github.com/ipfs/go-bitswap v0.0.9/go.mod h1:kAPf5qgn2W2DrgAcscZ3HrM9qh4pH+X8Fkk3UPrwvis= -github.com/ipfs/go-bitswap v0.1.0 h1:28YsHYw9ut6wootnImPXH0WpnU5Dbo3qm6cvQ6e6wYY= -github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSAE1wsxj0= -github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs= -github.com/ipfs/go-bitswap v0.1.3 h1:jAl9Z/TYObpGeGATUemnOZ7RYb0F/kzNVlhcYZesz+0= -github.com/ipfs/go-bitswap v0.1.3/go.mod h1:YEQlFy0kkxops5Vy+OxWdRSEZIoS7I7KDIwoa5Chkps= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-blockservice v0.0.7 h1:VRRVjgahs7r//MdO7yY5DJ2/i2fmkKOnxfSyfuPjTm0= -github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbRhbvNSdgc/7So= -github.com/ipfs/go-blockservice v0.1.0 h1:dh2i7xjMbCtf0ZSMyQAF2qpV/pEEmM7yVpQ00+gik6U= -github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= -github.com/ipfs/go-blockservice v0.1.1 h1:HHIvLuOhW0DQSrVserYcZYUl++nJPEzqZP+spRMaVzw= -github.com/ipfs/go-blockservice v0.1.1/go.mod h1:t+411r7psEUhLueM8C7aPA7cxCclv4O3VsUVxt9kz2I= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw= -github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-files v0.0.3 h1:ME+QnC3uOyla1ciRPezDW0ynQYK2ikOh9OCKAEg4uUA= -github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= -github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.0.1 h1:394mZeTLcbM/LDO12PneBYvkZAUA+nRnmC0lAzDXKOY= -github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= -github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ= -github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-cbor v0.0.2 h1:amzFztBQQQ69UA5+f7JRfoXF/z2l//MGfEDHVkS20+s= -github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs= -github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-merkledag v0.0.6 h1:rYZc0yzhO7y1cKi3Rw425a2HhEJDdLvNOWsqtmO3PF0= -github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto= -github.com/ipfs/go-merkledag v0.1.0 h1:CAEXjRFEDPvealQj3TgEjV1IJckwjvmxAqtq5QSXJrg= -github.com/ipfs/go-merkledag v0.1.0/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-path v0.0.7 h1:H06hKMquQ0aYtHiHryOMLpQC1qC3QwXwkahcEVD51Ho= -github.com/ipfs/go-path v0.0.7/go.mod h1:6KTKmeRnBXgqrTvzFrPV3CamxcgvXX/4z79tfAd2Sno= -github.com/ipfs/go-peertaskqueue v0.0.4 h1:i0JprfjjILYcWM1xguO/1MCS8XKVxLSl+ECEVr6i8nw= -github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ= -github.com/ipfs/go-peertaskqueue v0.1.0 h1:bpRbgv76eT4avutNPDFZuCPOQus6qTgurEYxfulgZW4= -github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= -github.com/ipfs/go-peertaskqueue v0.1.1 h1:+gPjbI+V3NktXZOqJA1kzbms2pYmhjgQQal0MzZrOAY= -github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= -github.com/ipfs/go-unixfs v0.1.0 h1:KkjcfqObdNwUN8heMtt5OdrgrRKYTIWEvpGl1bDYIho= -github.com/ipfs/go-unixfs v0.1.0/go.mod h1:lysk5ELhOso8+Fed9U1QTGey2ocsfaZ18h0NCO2Fj9s= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -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.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security v0.0.1 h1:4kMMrqrt9EUNCNjX1xagSJC+bq16uqjMe9lk1KBMVNs= -github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= -github.com/libp2p/go-conn-security-multistream v0.0.2 h1:Ykz0lnNjxk+0SdslUmlLNyrleqdpS1S/VW+dxFdt74Y= -github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.0.30 h1:mwCWAusLhRGUzZ/VaCatsrEQTsuWExmXqVcvGBV72EQ= -github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A= -github.com/libp2p/go-libp2p v0.1.0 h1:8VXadcPNni74ODoZ+7326LMAppFYmz1fRQOUuT5iZvQ= -github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM= -github.com/libp2p/go-libp2p v0.1.1 h1:52sB0TJuDk2nYMcMfHOKaPoaayDZjaYVCq6Vk1ejUTk= -github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8= -github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.0.1 h1:/mZuuiwntNR8RywnCFlGHLKrKLYne+qciBpQXWqp5fk= -github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= -github.com/libp2p/go-libp2p-core v0.0.3 h1:+IonUYY0nJZLb5Fdv6a6DOjtGP1L8Bb3faamiI2q5FY= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-host v0.0.1 h1:dnqusU+DheGcdxrE718kG4XgHNuL2n9eEv8Rg5zy8hQ= -github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= -github.com/libp2p/go-libp2p-host v0.0.3 h1:BB/1Z+4X0rjKP5lbQTmjEjLbDVbrcmLOlA6QDsN5/j4= -github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1 h1:Q9EkNSLAOF+u90L88qmE9z/fTdjLh8OsJwGw74mkwk4= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5 h1:KG/KNYL2tYzXAfMvQN5K1aAGTYSYUMJ1prgYa2/JI1E= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1 h1:7GnzRrBTJHEsofi1ahFdPN9Si6skwXQE9UqR2S+Pkh8= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k= -github.com/libp2p/go-libp2p-loggables v0.0.1 h1:HVww9oAnINIxbt69LJNkxD8lnbfgteXR97Xm4p3l9ps= -github.com/libp2p/go-libp2p-loggables v0.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= -github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= -github.com/libp2p/go-libp2p-mplex v0.1.1 h1:lSPS1VJ36P01gGO//KgcsmSah5uoC3X9r7WY5j+iP4c= -github.com/libp2p/go-libp2p-mplex v0.1.1/go.mod h1:KUQWpGkCzfV7UIpi8SKsAVxyBgz1c9R5EvxgnwLsb/I= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-net v0.0.1 h1:xJ4Vh4yKF/XKb8fd1Ev0ebAGzVjMxXzrxG2kjtU+F5Q= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-net v0.0.2 h1:qP06u4TYXfl7uW/hzqPhlVVTSA2nw1B/bHBJaUnbh6M= -github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-netutil v0.0.1 h1:LgD6+skofkOx8z6odD9+MZHKjupv3ng1u6KRhaADTnA= -github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlcjVk3UoJU3c= -github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= -github.com/libp2p/go-libp2p-record v0.0.1 h1:zN7AS3X46qmwsw5JLxdDuI43cH5UYwovKxHPjKBYQxw= -github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-routing v0.0.1 h1:hPMAWktf9rYi3ME4MG48qE7dq1ofJxiQbfdvpNntjhc= -github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= -github.com/libp2p/go-libp2p-secio v0.0.3 h1:h3fPeDrej7bvvARnC2oSjAfcLZOaS4REZKgWCRQNpE4= -github.com/libp2p/go-libp2p-secio v0.0.3/go.mod h1:hS7HQ00MgLhRO/Wyu1bTX6ctJKhVpm+j2/S2A5UqYb0= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.0.6 h1:gE0P/v2h+KEXtAi9YTw2UBOSODJ4m9VuuJ+ktc2LVUo= -github.com/libp2p/go-libp2p-swarm v0.0.6/go.mod h1:s5GZvzg9xXe8sbeESuFpjt8CJPTCa8mhEusweJqyFy8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= -github.com/libp2p/go-libp2p-transport v0.0.5 h1:pV6+UlRxyDpASSGD+60vMvdifSCby6JkJDfi+yUMHac= -github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4 h1:uGMOd14BL1oFlfb/cGfOxPjiTKBhzWV4aMjjoCF1Z1o= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8= -github.com/libp2p/go-libp2p-yamux v0.1.3 h1:HmKvv2jWJ4GEm3iP7cEKjuw0POa6rK+Hcsu1FBKzpLc= -github.com/libp2p/go-libp2p-yamux v0.1.3/go.mod h1:VGSQVrqkh6y4nm0189qqxMtvyBft44MOYYPpYKXiVt4= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.1 h1:apvYTg0aIxxQyBX+XHKOR+0+lYhGs1Yv+JmTH9nyl5I= -github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.0.4 h1:043XJ3Zr7/Oz5cfyUaJwxUZyP02TngTpt4oq8R5UizQ= -github.com/libp2p/go-mplex v0.0.4/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.3 h1:VsOlWispTivSsOMg70e0W77y6oiSBSRCyP6URrWvE04= -github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer v0.1.0 h1:3ToDXUzx8pDC6RfuOzGsUYP5roMDthbUKRdMRRhqAqY= -github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqXJyFvB0mR4A04sQ= -github.com/libp2p/go-stream-muxer-multistream v0.1.1 h1:DhHqb4nu1fQv/vQKeLAaZGmhLsUA4SF77IdYJiWE1d4= -github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.0.4 h1:2iRu994wCT/iEz62F+c60FUoSkijNEQ0q2Itc+79XlQ= -github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-testutil v0.0.1 h1:Xg+O0G2HIMfHqBOBDcMS1iSZJ3GEcId4qOxCQvsGZHk= -github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= -github.com/libp2p/go-testutil v0.1.0 h1:4QhjaWGO89udplblLVpgGDOQjzFlRavZOjuEnz2rLMc= -github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc= -github.com/libp2p/go-ws-transport v0.0.5/go.mod h1:Qbl4BxPfXXhhd/o0wcrgoaItHqA9tnZjoFZnxykuaXU= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.1/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.0.1 h1:JV4VfSdY9n7ECTtY59/TlSyFCzRILvYx4T4Ws8ZgihU= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14 h1:2m16U/rLwVaRdz7ANkHtHTodP3zTP3N451MADg64x5k= -github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8= -github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0= -github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY= -golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4 h1:VSJ45BzqrVgR4clSx415y1rHH7QAGhGt71J0ZmhLYrc= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4= -golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-mfs/inode.go b/vendor/github.com/ipfs/go-mfs/inode.go deleted file mode 100644 index 50bed0b3..00000000 --- a/vendor/github.com/ipfs/go-mfs/inode.go +++ /dev/null @@ -1,21 +0,0 @@ -package mfs - -import ( - ipld "github.com/ipfs/go-ipld-format" -) - -// inode abstracts the common characteristics of the MFS `File` -// and `Directory`. All of its attributes are initialized at -// creation. -type inode struct { - // name of this `inode` in the MFS path (the same value - // is also stored as the name of the DAG link). - name string - - // parent directory of this `inode` (which may be the `Root`). - parent parent - - // dagService used to store modifications made to the contents - // of the file or directory the `inode` belongs to. - dagService ipld.DAGService -} diff --git a/vendor/github.com/ipfs/go-mfs/ops.go b/vendor/github.com/ipfs/go-mfs/ops.go deleted file mode 100644 index 2b290728..00000000 --- a/vendor/github.com/ipfs/go-mfs/ops.go +++ /dev/null @@ -1,246 +0,0 @@ -package mfs - -import ( - "context" - "fmt" - "os" - gopath "path" - "strings" - - path "github.com/ipfs/go-path" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// TODO: Evaluate moving all this operations to as `Root` -// methods, since all of them use it as its first argument -// and there is no clear documentation that explains this -// separation. - -// Mv moves the file or directory at 'src' to 'dst' -// TODO: Document what the strings 'src' and 'dst' represent. -func Mv(r *Root, src, dst string) error { - srcDirName, srcFname := gopath.Split(src) - - var dstDirName string - var dstFname string - if dst[len(dst)-1] == '/' { - dstDirName = dst - dstFname = srcFname - } else { - dstDirName, dstFname = gopath.Split(dst) - } - - // get parent directories of both src and dest first - dstDir, err := lookupDir(r, dstDirName) - if err != nil { - return err - } - - srcDir, err := lookupDir(r, srcDirName) - if err != nil { - return err - } - - srcObj, err := srcDir.Child(srcFname) - if err != nil { - return err - } - - nd, err := srcObj.GetNode() - if err != nil { - return err - } - - fsn, err := dstDir.Child(dstFname) - if err == nil { - switch n := fsn.(type) { - case *File: - _ = dstDir.Unlink(dstFname) - case *Directory: - dstDir = n - dstFname = srcFname - default: - return fmt.Errorf("unexpected type at path: %s", dst) - } - } else if err != os.ErrNotExist { - return err - } - - err = dstDir.AddChild(dstFname, nd) - if err != nil { - return err - } - - if srcDir.name == dstDir.name && srcFname == dstFname { - return nil - } - - return srcDir.Unlink(srcFname) -} - -func lookupDir(r *Root, path string) (*Directory, error) { - di, err := Lookup(r, path) - if err != nil { - return nil, err - } - - d, ok := di.(*Directory) - if !ok { - return nil, fmt.Errorf("%s is not a directory", path) - } - - return d, nil -} - -// PutNode inserts 'nd' at 'path' in the given mfs -// TODO: Rename or clearly document that this is not about nodes but actually -// MFS files/directories (that in the underlying representation can be -// considered as just nodes). -// TODO: Document why are we handling IPLD nodes in the first place when we -// are actually referring to files/directories (that is, it can't be any -// node, it has to have a specific format). -// TODO: Can this function add directories or just files? What would be the -// difference between adding a directory with this method and creating it -// with `Mkdir`. -func PutNode(r *Root, path string, nd ipld.Node) error { - dirp, filename := gopath.Split(path) - if filename == "" { - return fmt.Errorf("cannot create file with empty name") - } - - pdir, err := lookupDir(r, dirp) - if err != nil { - return err - } - - return pdir.AddChild(filename, nd) -} - -// MkdirOpts is used by Mkdir -type MkdirOpts struct { - Mkparents bool - Flush bool - CidBuilder cid.Builder -} - -// Mkdir creates a directory at 'path' under the directory 'd', creating -// intermediary directories as needed if 'mkparents' is set to true -func Mkdir(r *Root, pth string, opts MkdirOpts) error { - if pth == "" { - return fmt.Errorf("no path given to Mkdir") - } - parts := path.SplitList(pth) - if parts[0] == "" { - parts = parts[1:] - } - - // allow 'mkdir /a/b/c/' to create c - if parts[len(parts)-1] == "" { - parts = parts[:len(parts)-1] - } - - if len(parts) == 0 { - // this will only happen on 'mkdir /' - if opts.Mkparents { - return nil - } - return fmt.Errorf("cannot create directory '/': Already exists") - } - - cur := r.GetDirectory() - for i, d := range parts[:len(parts)-1] { - fsn, err := cur.Child(d) - if err == os.ErrNotExist && opts.Mkparents { - mkd, err := cur.Mkdir(d) - if err != nil { - return err - } - if opts.CidBuilder != nil { - mkd.SetCidBuilder(opts.CidBuilder) - } - fsn = mkd - } else if err != nil { - return err - } - - next, ok := fsn.(*Directory) - if !ok { - return fmt.Errorf("%s was not a directory", path.Join(parts[:i])) - } - cur = next - } - - final, err := cur.Mkdir(parts[len(parts)-1]) - if err != nil { - if !opts.Mkparents || err != os.ErrExist || final == nil { - return err - } - } - if opts.CidBuilder != nil { - final.SetCidBuilder(opts.CidBuilder) - } - - if opts.Flush { - err := final.Flush() - if err != nil { - return err - } - } - - return nil -} - -// Lookup extracts the root directory and performs a lookup under it. -// TODO: Now that the root is always a directory, can this function -// be collapsed with `DirLookup`? Or at least be made a method of `Root`? -func Lookup(r *Root, path string) (FSNode, error) { - dir := r.GetDirectory() - - return DirLookup(dir, path) -} - -// DirLookup will look up a file or directory at the given path -// under the directory 'd' -func DirLookup(d *Directory, pth string) (FSNode, error) { - pth = strings.Trim(pth, "/") - parts := path.SplitList(pth) - if len(parts) == 1 && parts[0] == "" { - return d, nil - } - - var cur FSNode - cur = d - for i, p := range parts { - chdir, ok := cur.(*Directory) - if !ok { - return nil, fmt.Errorf("cannot access %s: Not a directory", path.Join(parts[:i+1])) - } - - child, err := chdir.Child(p) - if err != nil { - return nil, err - } - - cur = child - } - return cur, nil -} - -// TODO: Document this function and link its functionality -// with the republisher. -func FlushPath(ctx context.Context, rt *Root, pth string) (ipld.Node, error) { - nd, err := Lookup(rt, pth) - if err != nil { - return nil, err - } - - err = nd.Flush() - if err != nil { - return nil, err - } - - rt.repub.WaitPub(ctx) - return nd.GetNode() -} diff --git a/vendor/github.com/ipfs/go-mfs/options.go b/vendor/github.com/ipfs/go-mfs/options.go deleted file mode 100644 index 6bdcd710..00000000 --- a/vendor/github.com/ipfs/go-mfs/options.go +++ /dev/null @@ -1,7 +0,0 @@ -package mfs - -type Flags struct { - Read bool - Write bool - Sync bool -} diff --git a/vendor/github.com/ipfs/go-mfs/package.json b/vendor/github.com/ipfs/go-mfs/package.json deleted file mode 100644 index e8079f4c..00000000 --- a/vendor/github.com/ipfs/go-mfs/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "author": "hsanjuan", - "bugs": { - "url": "https://github.com/ipfs/go-mfs" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-mfs" - }, - "gxDependencies": [ - { - "author": "why", - "hash": "QmY6UwsN3D6uoxrRkYpJ8Wos8R66gwLmdn3wy7jM7CCRQ1", - "name": "go-merkledag", - "version": "1.1.40" - }, - { - "author": "why", - "hash": "QmVmueix5wxmr8UWpfpcKw6F1xT7T8AS7CXQRM37BE29eX", - "name": "go-unixfs", - "version": "1.3.15" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - }, - { - "author": "why", - "hash": "QmUquHAkyh9phs4ojSuHcHcZnUMGDwDNJZWnRXkNks1qLB", - "name": "go-path", - "version": "1.1.41" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "MIT", - "name": "go-mfs", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.54" -} - diff --git a/vendor/github.com/ipfs/go-mfs/repub.go b/vendor/github.com/ipfs/go-mfs/repub.go deleted file mode 100644 index 2c9dbd25..00000000 --- a/vendor/github.com/ipfs/go-mfs/repub.go +++ /dev/null @@ -1,197 +0,0 @@ -package mfs - -import ( - "context" - "time" - - cid "github.com/ipfs/go-cid" -) - -// PubFunc is the user-defined function that determines exactly what -// logic entails "publishing" a `Cid` value. -type PubFunc func(context.Context, cid.Cid) error - -// Republisher manages when to publish a given entry. -type Republisher struct { - TimeoutLong time.Duration - TimeoutShort time.Duration - RetryTimeout time.Duration - pubfunc PubFunc - - update chan cid.Cid - immediatePublish chan chan struct{} - - ctx context.Context - cancel func() -} - -// NewRepublisher creates a new Republisher object to republish the given root -// using the given short and long time intervals. -func NewRepublisher(ctx context.Context, pf PubFunc, tshort, tlong time.Duration) *Republisher { - ctx, cancel := context.WithCancel(ctx) - return &Republisher{ - TimeoutShort: tshort, - TimeoutLong: tlong, - RetryTimeout: tlong, - update: make(chan cid.Cid, 1), - pubfunc: pf, - immediatePublish: make(chan chan struct{}), - ctx: ctx, - cancel: cancel, - } -} - -// WaitPub waits for the current value to be published (or returns early -// if it already has). -func (rp *Republisher) WaitPub(ctx context.Context) error { - wait := make(chan struct{}) - select { - case rp.immediatePublish <- wait: - case <-ctx.Done(): - return ctx.Err() - } - select { - case <-wait: - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -func (rp *Republisher) Close() error { - // TODO(steb): Wait for `Run` to stop - err := rp.WaitPub(rp.ctx) - rp.cancel() - return err -} - -// Update the current value. The value will be published after a delay but each -// consecutive call to Update may extend this delay up to TimeoutLong. -func (rp *Republisher) Update(c cid.Cid) { - select { - case <-rp.update: - select { - case rp.update <- c: - default: - // Don't try again. If we hit this case, there's a - // concurrent publish and we can safely let that - // concurrent publish win. - } - case rp.update <- c: - } -} - -// Run contains the core logic of the `Republisher`. It calls the user-defined -// `pubfunc` function whenever the `Cid` value is updated to a *new* value. The -// complexity comes from the fact that `pubfunc` may be slow so we need to batch -// updates. -// -// Algorithm: -// 1. When we receive the first update after publishing, we set a `longer` timer. -// 2. When we receive any update, we reset the `quick` timer. -// 3. If either the `quick` timeout or the `longer` timeout elapses, -// we call `publish` with the latest updated value. -// -// The `longer` timer ensures that we delay publishing by at most -// `TimeoutLong`. The `quick` timer allows us to publish sooner if -// it looks like there are no more updates coming down the pipe. -// -// Note: If a publish fails, we retry repeatedly every TimeoutRetry. -func (rp *Republisher) Run(lastPublished cid.Cid) { - quick := time.NewTimer(0) - if !quick.Stop() { - <-quick.C - } - longer := time.NewTimer(0) - if !longer.Stop() { - <-longer.C - } - - var toPublish cid.Cid - for rp.ctx.Err() == nil { - var waiter chan struct{} - - select { - case <-rp.ctx.Done(): - return - case newValue := <-rp.update: - // Skip already published values. - if lastPublished.Equals(newValue) { - // Break to the end of the switch to cleanup any - // timers. - toPublish = cid.Undef - break - } - - // If we aren't already waiting to publish something, - // reset the long timeout. - if !toPublish.Defined() { - longer.Reset(rp.TimeoutLong) - } - - // Always reset the short timeout. - quick.Reset(rp.TimeoutShort) - - // Finally, set the new value to publish. - toPublish = newValue - continue - case waiter = <-rp.immediatePublish: - // Make sure to grab the *latest* value to publish. - select { - case toPublish = <-rp.update: - default: - } - - // Avoid publishing duplicate values - if lastPublished.Equals(toPublish) { - toPublish = cid.Undef - } - case <-quick.C: - case <-longer.C: - } - - // Cleanup, publish, and close waiters. - - // 1. Stop any timers. Don't use the `if !t.Stop() { ... }` - // idiom as these timers may not be running. - - quick.Stop() - select { - case <-quick.C: - default: - } - - longer.Stop() - select { - case <-longer.C: - default: - } - - // 2. If we have a value to publish, publish it now. - if toPublish.Defined() { - for { - err := rp.pubfunc(rp.ctx, toPublish) - if err == nil { - break - } - // Keep retrying until we succeed or we abort. - // TODO(steb): We could try pulling new values - // off `update` but that's not critical (and - // complicates this code a bit). We'll pull off - // a new value on the next loop through. - select { - case <-time.After(rp.RetryTimeout): - case <-rp.ctx.Done(): - return - } - } - lastPublished = toPublish - toPublish = cid.Undef - } - - // 3. Trigger anything waiting in `WaitPub`. - if waiter != nil { - close(waiter) - } - } -} diff --git a/vendor/github.com/ipfs/go-mfs/root.go b/vendor/github.com/ipfs/go-mfs/root.go deleted file mode 100644 index 026a3202..00000000 --- a/vendor/github.com/ipfs/go-mfs/root.go +++ /dev/null @@ -1,218 +0,0 @@ -// package mfs implements an in memory model of a mutable IPFS filesystem. -// TODO: Develop on this line (and move it to `doc.go`). - -package mfs - -import ( - "context" - "errors" - "fmt" - "time" - - dag "github.com/ipfs/go-merkledag" - ft "github.com/ipfs/go-unixfs" - - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" -) - -// TODO: Remove if not used. -var ErrNotExist = errors.New("no such rootfs") -var ErrClosed = errors.New("file closed") - -var log = logging.Logger("mfs") - -// TODO: Remove if not used. -var ErrIsDirectory = errors.New("error: is a directory") - -// The information that an MFS `Directory` has about its children -// when updating one of its entries: when a child mutates it signals -// its parent directory to update its entry (under `Name`) with the -// new content (in `Node`). -type child struct { - Name string - Node ipld.Node -} - -// This interface represents the basic property of MFS directories of updating -// children entries with modified content. Implemented by both the MFS -// `Directory` and `Root` (which is basically a `Directory` with republishing -// support). -// -// TODO: What is `fullsync`? (unnamed `bool` argument) -// TODO: There are two types of persistence/flush that need to be -// distinguished here, one at the DAG level (when I store the modified -// nodes in the DAG service) and one in the UnixFS/MFS level (when I modify -// the entry/link of the directory that pointed to the modified node). -type parent interface { - // Method called by a child to its parent to signal to update the content - // pointed to in the entry by that child's name. The child sends its own - // information in the `child` structure. As modifying a directory entry - // entails modifying its contents the parent will also call *its* parent's - // `updateChildEntry` to update the entry pointing to the new directory, - // this mechanism is in turn repeated until reaching the `Root`. - updateChildEntry(c child) error -} - -type NodeType int - -const ( - TFile NodeType = iota - TDir -) - -// FSNode abstracts the `Directory` and `File` structures, it represents -// any child node in the MFS (i.e., all the nodes besides the `Root`). It -// is the counterpart of the `parent` interface which represents any -// parent node in the MFS (`Root` and `Directory`). -// (Not to be confused with the `unixfs.FSNode`.) -type FSNode interface { - GetNode() (ipld.Node, error) - - Flush() error - Type() NodeType -} - -// IsDir checks whether the FSNode is dir type -func IsDir(fsn FSNode) bool { - return fsn.Type() == TDir -} - -// IsFile checks whether the FSNode is file type -func IsFile(fsn FSNode) bool { - return fsn.Type() == TFile -} - -// Root represents the root of a filesystem tree. -type Root struct { - - // Root directory of the MFS layout. - dir *Directory - - repub *Republisher -} - -// NewRoot creates a new Root and starts up a republisher routine for it. -func NewRoot(parent context.Context, ds ipld.DAGService, node *dag.ProtoNode, pf PubFunc) (*Root, error) { - - var repub *Republisher - if pf != nil { - repub = NewRepublisher(parent, pf, time.Millisecond*300, time.Second*3) - - // No need to take the lock here since we just created - // the `Republisher` and no one has access to it yet. - - go repub.Run(node.Cid()) - } - - root := &Root{ - repub: repub, - } - - fsn, err := ft.FSNodeFromBytes(node.Data()) - if err != nil { - log.Error("IPNS pointer was not unixfs node") - // TODO: IPNS pointer? - return nil, err - } - - switch fsn.Type() { - case ft.TDirectory, ft.THAMTShard: - newDir, err := NewDirectory(parent, node.String(), node, root, ds) - if err != nil { - return nil, err - } - - root.dir = newDir - case ft.TFile, ft.TMetadata, ft.TRaw: - return nil, fmt.Errorf("root can't be a file (unixfs type: %s)", fsn.Type()) - // TODO: This special error reporting case doesn't seem worth it, we either - // have a UnixFS directory or we don't. - default: - return nil, fmt.Errorf("unrecognized unixfs type: %s", fsn.Type()) - } - return root, nil -} - -// GetDirectory returns the root directory. -func (kr *Root) GetDirectory() *Directory { - return kr.dir -} - -// Flush signals that an update has occurred since the last publish, -// and updates the Root republisher. -// TODO: We are definitely abusing the "flush" terminology here. -func (kr *Root) Flush() error { - nd, err := kr.GetDirectory().GetNode() - if err != nil { - return err - } - - if kr.repub != nil { - kr.repub.Update(nd.Cid()) - } - return nil -} - -// FlushMemFree flushes the root directory and then uncaches all of its links. -// This has the effect of clearing out potentially stale references and allows -// them to be garbage collected. -// CAUTION: Take care not to ever call this while holding a reference to any -// child directories. Those directories will be bad references and using them -// may have unintended racy side effects. -// A better implemented mfs system (one that does smarter internal caching and -// refcounting) shouldnt need this method. -// TODO: Review the motivation behind this method once the cache system is -// refactored. -func (kr *Root) FlushMemFree(ctx context.Context) error { - dir := kr.GetDirectory() - - if err := dir.Flush(); err != nil { - return err - } - - dir.lock.Lock() - defer dir.lock.Unlock() - - for name := range dir.entriesCache { - delete(dir.entriesCache, name) - } - // TODO: Can't we just create new maps? - - return nil -} - -// updateChildEntry implements the `parent` interface, and signals -// to the publisher that there are changes ready to be published. -// This is the only thing that separates a `Root` from a `Directory`. -// TODO: Evaluate merging both. -// TODO: The `sync` argument isn't used here (we've already reached -// the top), document it and maybe make it an anonymous variable (if -// that's possible). -func (kr *Root) updateChildEntry(c child) error { - err := kr.GetDirectory().dagService.Add(context.TODO(), c.Node) - if err != nil { - return err - } - // TODO: Why are we not using the inner directory lock nor - // applying the same procedure as `Directory.updateChildEntry`? - - if kr.repub != nil { - kr.repub.Update(c.Node.Cid()) - } - return nil -} - -func (kr *Root) Close() error { - nd, err := kr.GetDirectory().GetNode() - if err != nil { - return err - } - - if kr.repub != nil { - kr.repub.Update(nd.Cid()) - return kr.repub.Close() - } - - return nil -} diff --git a/vendor/github.com/ipfs/go-path/.travis.yml b/vendor/github.com/ipfs/go-path/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-path/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-path/LICENSE b/vendor/github.com/ipfs/go-path/LICENSE deleted file mode 100644 index 7d5dcac4..00000000 --- a/vendor/github.com/ipfs/go-path/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-path/Makefile b/vendor/github.com/ipfs/go-path/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/ipfs/go-path/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-path/README.md b/vendor/github.com/ipfs/go-path/README.md deleted file mode 100644 index 79dd9289..00000000 --- a/vendor/github.com/ipfs/go-path/README.md +++ /dev/null @@ -1,32 +0,0 @@ -go-path -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-path/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-path/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-path.svg?branch=master)](https://travis-ci.org/ipfs/go-path) - -> go-path is a helper package that provides utilities for parsing and using ipfs paths - - -## Table of Contents - -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## TODO - -This package could probably be merged into go-ipld, or something along those lines. It -doesnt really make sense as its own standalone thing. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-path/error.go b/vendor/github.com/ipfs/go-path/error.go deleted file mode 100644 index ca2e8416..00000000 --- a/vendor/github.com/ipfs/go-path/error.go +++ /dev/null @@ -1,23 +0,0 @@ -package path - -import ( - "fmt" -) - -// helper type so path parsing errors include the path -type pathError struct { - error error - path string -} - -func (e *pathError) Error() string { - return fmt.Sprintf("invalid path %q: %s", e.path, e.error) -} - -func (e *pathError) Unwrap() error { - return e.error -} - -func (e *pathError) Path() string { - return e.path -} diff --git a/vendor/github.com/ipfs/go-path/go.mod b/vendor/github.com/ipfs/go-path/go.mod deleted file mode 100644 index a048a15a..00000000 --- a/vendor/github.com/ipfs/go-path/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/ipfs/go-path - -require ( - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-ipld-format v0.0.2 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-merkledag v0.0.6 -) diff --git a/vendor/github.com/ipfs/go-path/go.sum b/vendor/github.com/ipfs/go-path/go.sum deleted file mode 100644 index 3879972f..00000000 --- a/vendor/github.com/ipfs/go-path/go.sum +++ /dev/null @@ -1,391 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.0.9 h1:Dy0qvYlaOd2E2FOL2gApJ21qVjepJsGNNfstLrGf+0I= -github.com/ipfs/go-bitswap v0.0.9/go.mod h1:kAPf5qgn2W2DrgAcscZ3HrM9qh4pH+X8Fkk3UPrwvis= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-blockservice v0.0.7 h1:VRRVjgahs7r//MdO7yY5DJ2/i2fmkKOnxfSyfuPjTm0= -github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbRhbvNSdgc/7So= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.0.1 h1:394mZeTLcbM/LDO12PneBYvkZAUA+nRnmC0lAzDXKOY= -github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-cbor v0.0.2 h1:amzFztBQQQ69UA5+f7JRfoXF/z2l//MGfEDHVkS20+s= -github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs= -github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-merkledag v0.0.6 h1:rYZc0yzhO7y1cKi3Rw425a2HhEJDdLvNOWsqtmO3PF0= -github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-peertaskqueue v0.0.4 h1:i0JprfjjILYcWM1xguO/1MCS8XKVxLSl+ECEVr6i8nw= -github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -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/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security v0.0.1 h1:4kMMrqrt9EUNCNjX1xagSJC+bq16uqjMe9lk1KBMVNs= -github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= -github.com/libp2p/go-conn-security-multistream v0.0.2 h1:Ykz0lnNjxk+0SdslUmlLNyrleqdpS1S/VW+dxFdt74Y= -github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.0.30 h1:mwCWAusLhRGUzZ/VaCatsrEQTsuWExmXqVcvGBV72EQ= -github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A= -github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= -github.com/libp2p/go-libp2p-blankhost v0.0.1 h1:/mZuuiwntNR8RywnCFlGHLKrKLYne+qciBpQXWqp5fk= -github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= -github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I= -github.com/libp2p/go-libp2p-host v0.0.1 h1:dnqusU+DheGcdxrE718kG4XgHNuL2n9eEv8Rg5zy8hQ= -github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= -github.com/libp2p/go-libp2p-host v0.0.3 h1:BB/1Z+4X0rjKP5lbQTmjEjLbDVbrcmLOlA6QDsN5/j4= -github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1 h1:Q9EkNSLAOF+u90L88qmE9z/fTdjLh8OsJwGw74mkwk4= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5 h1:KG/KNYL2tYzXAfMvQN5K1aAGTYSYUMJ1prgYa2/JI1E= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1 h1:7GnzRrBTJHEsofi1ahFdPN9Si6skwXQE9UqR2S+Pkh8= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k= -github.com/libp2p/go-libp2p-loggables v0.0.1 h1:HVww9oAnINIxbt69LJNkxD8lnbfgteXR97Xm4p3l9ps= -github.com/libp2p/go-libp2p-loggables v0.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg= -github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= -github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= -github.com/libp2p/go-libp2p-mplex v0.1.1 h1:lSPS1VJ36P01gGO//KgcsmSah5uoC3X9r7WY5j+iP4c= -github.com/libp2p/go-libp2p-mplex v0.1.1/go.mod h1:KUQWpGkCzfV7UIpi8SKsAVxyBgz1c9R5EvxgnwLsb/I= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-net v0.0.1 h1:xJ4Vh4yKF/XKb8fd1Ev0ebAGzVjMxXzrxG2kjtU+F5Q= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-net v0.0.2 h1:qP06u4TYXfl7uW/hzqPhlVVTSA2nw1B/bHBJaUnbh6M= -github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-netutil v0.0.1 h1:LgD6+skofkOx8z6odD9+MZHKjupv3ng1u6KRhaADTnA= -github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlcjVk3UoJU3c= -github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= -github.com/libp2p/go-libp2p-record v0.0.1 h1:zN7AS3X46qmwsw5JLxdDuI43cH5UYwovKxHPjKBYQxw= -github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= -github.com/libp2p/go-libp2p-routing v0.0.1 h1:hPMAWktf9rYi3ME4MG48qE7dq1ofJxiQbfdvpNntjhc= -github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= -github.com/libp2p/go-libp2p-secio v0.0.3 h1:h3fPeDrej7bvvARnC2oSjAfcLZOaS4REZKgWCRQNpE4= -github.com/libp2p/go-libp2p-secio v0.0.3/go.mod h1:hS7HQ00MgLhRO/Wyu1bTX6ctJKhVpm+j2/S2A5UqYb0= -github.com/libp2p/go-libp2p-swarm v0.0.6 h1:gE0P/v2h+KEXtAi9YTw2UBOSODJ4m9VuuJ+ktc2LVUo= -github.com/libp2p/go-libp2p-swarm v0.0.6/go.mod h1:s5GZvzg9xXe8sbeESuFpjt8CJPTCa8mhEusweJqyFy8= -github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= -github.com/libp2p/go-libp2p-transport v0.0.5 h1:pV6+UlRxyDpASSGD+60vMvdifSCby6JkJDfi+yUMHac= -github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4 h1:uGMOd14BL1oFlfb/cGfOxPjiTKBhzWV4aMjjoCF1Z1o= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= -github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8= -github.com/libp2p/go-libp2p-yamux v0.1.3 h1:HmKvv2jWJ4GEm3iP7cEKjuw0POa6rK+Hcsu1FBKzpLc= -github.com/libp2p/go-libp2p-yamux v0.1.3/go.mod h1:VGSQVrqkh6y4nm0189qqxMtvyBft44MOYYPpYKXiVt4= -github.com/libp2p/go-maddr-filter v0.0.1 h1:apvYTg0aIxxQyBX+XHKOR+0+lYhGs1Yv+JmTH9nyl5I= -github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.0.4 h1:043XJ3Zr7/Oz5cfyUaJwxUZyP02TngTpt4oq8R5UizQ= -github.com/libp2p/go-mplex v0.0.4/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer v0.1.0 h1:3ToDXUzx8pDC6RfuOzGsUYP5roMDthbUKRdMRRhqAqY= -github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqXJyFvB0mR4A04sQ= -github.com/libp2p/go-stream-muxer-multistream v0.1.1 h1:DhHqb4nu1fQv/vQKeLAaZGmhLsUA4SF77IdYJiWE1d4= -github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw= -github.com/libp2p/go-tcp-transport v0.0.4 h1:2iRu994wCT/iEz62F+c60FUoSkijNEQ0q2Itc+79XlQ= -github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o= -github.com/libp2p/go-testutil v0.0.1 h1:Xg+O0G2HIMfHqBOBDcMS1iSZJ3GEcId4qOxCQvsGZHk= -github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= -github.com/libp2p/go-ws-transport v0.0.5/go.mod h1:Qbl4BxPfXXhhd/o0wcrgoaItHqA9tnZjoFZnxykuaXU= -github.com/libp2p/go-yamux v1.2.1/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.0.1 h1:JV4VfSdY9n7ECTtY59/TlSyFCzRILvYx4T4Ws8ZgihU= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4 h1:VSJ45BzqrVgR4clSx415y1rHH7QAGhGt71J0ZmhLYrc= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-path/package.json b/vendor/github.com/ipfs/go-path/package.json deleted file mode 100644 index 54689501..00000000 --- a/vendor/github.com/ipfs/go-path/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "author": "why", - "bugs": { - "url": "https://github.com/ipfs/go-path" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-path" - }, - "gxDependencies": [ - { - "author": "why", - "hash": "QmY6UwsN3D6uoxrRkYpJ8Wos8R66gwLmdn3wy7jM7CCRQ1", - "name": "go-merkledag", - "version": "1.1.40" - }, - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-path", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.1.41" -} - diff --git a/vendor/github.com/ipfs/go-path/path.go b/vendor/github.com/ipfs/go-path/path.go deleted file mode 100644 index 18a85a90..00000000 --- a/vendor/github.com/ipfs/go-path/path.go +++ /dev/null @@ -1,182 +0,0 @@ -// Package path contains utilities to work with ipfs paths. -package path - -import ( - "fmt" - "path" - "strings" - - cid "github.com/ipfs/go-cid" -) - -// A Path represents an ipfs content path: -// * //path/to/file -// * /ipfs/ -// * /ipns//path/to/folder -// * etc -type Path string - -// ^^^ -// TODO: debate making this a private struct wrapped in a public interface -// would allow us to control creation, and cache segments. - -// FromString safely converts a string type to a Path type. -func FromString(s string) Path { - return Path(s) -} - -// FromCid safely converts a cid.Cid type to a Path type. -func FromCid(c cid.Cid) Path { - return Path("/ipfs/" + c.String()) -} - -// Segments returns the different elements of a path -// (elements are delimited by a /). -func (p Path) Segments() []string { - cleaned := path.Clean(string(p)) - segments := strings.Split(cleaned, "/") - - // Ignore leading slash - if len(segments[0]) == 0 { - segments = segments[1:] - } - - return segments -} - -// String converts a path to string. -func (p Path) String() string { - return string(p) -} - -// IsJustAKey returns true if the path is of the form or /ipfs/, or -// /ipld/ -func (p Path) IsJustAKey() bool { - parts := p.Segments() - return len(parts) == 2 && (parts[0] == "ipfs" || parts[0] == "ipld") -} - -// PopLastSegment returns a new Path without its final segment, and the final -// segment, separately. If there is no more to pop (the path is just a key), -// the original path is returned. -func (p Path) PopLastSegment() (Path, string, error) { - - if p.IsJustAKey() { - return p, "", nil - } - - segs := p.Segments() - newPath, err := ParsePath("/" + strings.Join(segs[:len(segs)-1], "/")) - if err != nil { - return "", "", err - } - - return newPath, segs[len(segs)-1], nil -} - -// FromSegments returns a path given its different segments. -func FromSegments(prefix string, seg ...string) (Path, error) { - return ParsePath(prefix + strings.Join(seg, "/")) -} - -// ParsePath returns a well-formed ipfs Path. -// The returned path will always be prefixed with /ipfs/ or /ipns/. -// The prefix will be added if not present in the given string. -// This function will return an error when the given string is -// not a valid ipfs path. -func ParsePath(txt string) (Path, error) { - parts := strings.Split(txt, "/") - if len(parts) == 1 { - kp, err := ParseCidToPath(txt) - if err == nil { - return kp, nil - } - } - - // if the path doesnt begin with a '/' - // we expect this to start with a hash, and be an 'ipfs' path - if parts[0] != "" { - if _, err := cid.Decode(parts[0]); err != nil { - return "", &pathError{error: err, path: txt} - } - // The case when the path starts with hash without a protocol prefix - return Path("/ipfs/" + txt), nil - } - - if len(parts) < 3 { - return "", &pathError{error: fmt.Errorf("path does not begin with '/'"), path: txt} - } - - //TODO: make this smarter - switch parts[1] { - case "ipfs", "ipld": - if parts[2] == "" { - return "", &pathError{error: fmt.Errorf("not enough path components"), path: txt} - } - // Validate Cid. - _, err := cid.Decode(parts[2]) - if err != nil { - return "", &pathError{error: fmt.Errorf("invalid CID: %s", err), path: txt} - } - case "ipns": - if parts[2] == "" { - return "", &pathError{error: fmt.Errorf("not enough path components"), path: txt} - } - default: - return "", &pathError{error: fmt.Errorf("unknown namespace %q", parts[1]), path: txt} - } - - return Path(txt), nil -} - -// ParseCidToPath takes a CID in string form and returns a valid ipfs Path. -func ParseCidToPath(txt string) (Path, error) { - if txt == "" { - return "", &pathError{error: fmt.Errorf("empty"), path: txt} - } - - c, err := cid.Decode(txt) - if err != nil { - return "", &pathError{error: err, path: txt} - } - - return FromCid(c), nil -} - -// IsValid checks if a path is a valid ipfs Path. -func (p *Path) IsValid() error { - _, err := ParsePath(p.String()) - return err -} - -// Join joins strings slices using / -func Join(pths []string) string { - return strings.Join(pths, "/") -} - -// SplitList splits strings usings / -func SplitList(pth string) []string { - return strings.Split(pth, "/") -} - -// SplitAbsPath clean up and split fpath. It extracts the first component (which -// must be a Multihash) and return it separately. -func SplitAbsPath(fpath Path) (cid.Cid, []string, error) { - parts := fpath.Segments() - if parts[0] == "ipfs" || parts[0] == "ipld" { - parts = parts[1:] - } - - // if nothing, bail. - if len(parts) == 0 { - return cid.Cid{}, nil, &pathError{error: fmt.Errorf("empty"), path: string(fpath)} - } - - c, err := cid.Decode(parts[0]) - // first element in the path is a cid - if err != nil { - return cid.Cid{}, nil, &pathError{error: fmt.Errorf("invalid CID: %s", err), path: string(fpath)} - } - - return c, parts[1:], nil -} diff --git a/vendor/github.com/ipfs/go-path/resolver/resolver.go b/vendor/github.com/ipfs/go-path/resolver/resolver.go deleted file mode 100644 index 67bb9f6f..00000000 --- a/vendor/github.com/ipfs/go-path/resolver/resolver.go +++ /dev/null @@ -1,209 +0,0 @@ -// Package resolver implements utilities for resolving paths within ipfs. -package resolver - -import ( - "context" - "errors" - "fmt" - "time" - - path "github.com/ipfs/go-path" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - logging "github.com/ipfs/go-log" - dag "github.com/ipfs/go-merkledag" -) - -var log = logging.Logger("pathresolv") - -// ErrNoComponents is used when Paths after a protocol -// do not contain at least one component -var ErrNoComponents = errors.New( - "path must contain at least one component") - -// ErrNoLink is returned when a link is not found in a path -type ErrNoLink struct { - Name string - Node cid.Cid -} - -// Error implements the Error interface for ErrNoLink with a useful -// human readable message. -func (e ErrNoLink) Error() string { - return fmt.Sprintf("no link named %q under %s", e.Name, e.Node.String()) -} - -// ResolveOnce resolves path through a single node -type ResolveOnce func(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, names []string) (*ipld.Link, []string, error) - -// Resolver provides path resolution to IPFS -// It has a pointer to a DAGService, which is uses to resolve nodes. -// TODO: now that this is more modular, try to unify this code with the -// the resolvers in namesys -type Resolver struct { - DAG ipld.NodeGetter - - ResolveOnce ResolveOnce -} - -// NewBasicResolver constructs a new basic resolver. -func NewBasicResolver(ds ipld.DAGService) *Resolver { - return &Resolver{ - DAG: ds, - ResolveOnce: ResolveSingle, - } -} - -// ResolveToLastNode walks the given path and returns the cid of the last node -// referenced by the path -func (r *Resolver) ResolveToLastNode(ctx context.Context, fpath path.Path) (cid.Cid, []string, error) { - c, p, err := path.SplitAbsPath(fpath) - if err != nil { - return cid.Cid{}, nil, err - } - - if len(p) == 0 { - return c, nil, nil - } - - nd, err := r.DAG.Get(ctx, c) - if err != nil { - return cid.Cid{}, nil, err - } - - for len(p) > 0 { - lnk, rest, err := r.ResolveOnce(ctx, r.DAG, nd, p) - - // Note: have to drop the error here as `ResolveOnce` doesn't handle 'leaf' - // paths (so e.g. for `echo '{"foo":123}' | ipfs dag put` we wouldn't be - // able to resolve `zdpu[...]/foo`) - if lnk == nil { - break - } - - if err != nil { - if err == dag.ErrLinkNotFound { - err = ErrNoLink{Name: p[0], Node: nd.Cid()} - } - return cid.Cid{}, nil, err - } - - next, err := lnk.GetNode(ctx, r.DAG) - if err != nil { - return cid.Cid{}, nil, err - } - nd = next - p = rest - } - - if len(p) == 0 { - return nd.Cid(), nil, nil - } - - // Confirm the path exists within the object - val, rest, err := nd.Resolve(p) - if err != nil { - if err == dag.ErrLinkNotFound { - err = ErrNoLink{Name: p[0], Node: nd.Cid()} - } - return cid.Cid{}, nil, err - } - - if len(rest) > 0 { - return cid.Cid{}, nil, errors.New("path failed to resolve fully") - } - switch val.(type) { - case *ipld.Link: - return cid.Cid{}, nil, errors.New("inconsistent ResolveOnce / nd.Resolve") - default: - return nd.Cid(), p, nil - } -} - -// ResolvePath fetches the node for given path. It returns the last item -// returned by ResolvePathComponents. -func (r *Resolver) ResolvePath(ctx context.Context, fpath path.Path) (ipld.Node, error) { - // validate path - if err := fpath.IsValid(); err != nil { - return nil, err - } - - nodes, err := r.ResolvePathComponents(ctx, fpath) - if err != nil || nodes == nil { - return nil, err - } - return nodes[len(nodes)-1], err -} - -// ResolveSingle simply resolves one hop of a path through a graph with no -// extra context (does not opaquely resolve through sharded nodes) -func ResolveSingle(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, names []string) (*ipld.Link, []string, error) { - return nd.ResolveLink(names) -} - -// ResolvePathComponents fetches the nodes for each segment of the given path. -// It uses the first path component as a hash (key) of the first node, then -// resolves all other components walking the links, with ResolveLinks. -func (r *Resolver) ResolvePathComponents(ctx context.Context, fpath path.Path) ([]ipld.Node, error) { - evt := log.EventBegin(ctx, "resolvePathComponents", logging.LoggableMap{"fpath": fpath}) - defer evt.Done() - - h, parts, err := path.SplitAbsPath(fpath) - if err != nil { - evt.Append(logging.LoggableMap{"error": err.Error()}) - return nil, err - } - - log.Debug("resolve dag get") - nd, err := r.DAG.Get(ctx, h) - if err != nil { - evt.Append(logging.LoggableMap{"error": err.Error()}) - return nil, err - } - - return r.ResolveLinks(ctx, nd, parts) -} - -// ResolveLinks iteratively resolves names by walking the link hierarchy. -// Every node is fetched from the DAGService, resolving the next name. -// Returns the list of nodes forming the path, starting with ndd. This list is -// guaranteed never to be empty. -// -// ResolveLinks(nd, []string{"foo", "bar", "baz"}) -// would retrieve "baz" in ("bar" in ("foo" in nd.Links).Links).Links -func (r *Resolver) ResolveLinks(ctx context.Context, ndd ipld.Node, names []string) ([]ipld.Node, error) { - - evt := log.EventBegin(ctx, "resolveLinks", logging.LoggableMap{"names": names}) - defer evt.Done() - result := make([]ipld.Node, 0, len(names)+1) - result = append(result, ndd) - nd := ndd // dup arg workaround - - // for each of the path components - for len(names) > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, time.Minute) - defer cancel() - - lnk, rest, err := r.ResolveOnce(ctx, r.DAG, nd, names) - if err == dag.ErrLinkNotFound { - evt.Append(logging.LoggableMap{"error": err.Error()}) - return result, ErrNoLink{Name: names[0], Node: nd.Cid()} - } else if err != nil { - evt.Append(logging.LoggableMap{"error": err.Error()}) - return result, err - } - - nextnode, err := lnk.GetNode(ctx, r.DAG) - if err != nil { - evt.Append(logging.LoggableMap{"error": err.Error()}) - return result, err - } - - nd = nextnode - result = append(result, nextnode) - names = rest - } - return result, nil -} diff --git a/vendor/github.com/ipfs/go-peertaskqueue/.travis.yml b/vendor/github.com/ipfs/go-peertaskqueue/.travis.yml deleted file mode 100644 index c8102833..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false - - diff --git a/vendor/github.com/ipfs/go-peertaskqueue/COPYRIGHT b/vendor/github.com/ipfs/go-peertaskqueue/COPYRIGHT deleted file mode 100644 index 771e6f7c..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/COPYRIGHT +++ /dev/null @@ -1,3 +0,0 @@ -Copyright 2019. Protocol Labs, Inc. - -This library is dual-licensed under Apache 2.0 and MIT terms. diff --git a/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-APACHE b/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-APACHE deleted file mode 100644 index 54651436..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-APACHE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2019. Protocol Labs, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-MIT b/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-MIT deleted file mode 100644 index ea532a83..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2019. Protocol Labs, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ipfs/go-peertaskqueue/go.mod b/vendor/github.com/ipfs/go-peertaskqueue/go.mod deleted file mode 100644 index e093129c..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/ipfs/go-peertaskqueue - -go 1.12 - -require ( - github.com/ipfs/go-ipfs-pq v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multihash v0.0.5 // indirect -) diff --git a/vendor/github.com/ipfs/go-peertaskqueue/go.sum b/vendor/github.com/ipfs/go-peertaskqueue/go.sum deleted file mode 100644 index 9249ebfb..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/go.sum +++ /dev/null @@ -1,84 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-peertaskqueue/peertask/peertask.go b/vendor/github.com/ipfs/go-peertaskqueue/peertask/peertask.go deleted file mode 100644 index a91b4ecd..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/peertask/peertask.go +++ /dev/null @@ -1,97 +0,0 @@ -package peertask - -import ( - "time" - - pq "github.com/ipfs/go-ipfs-pq" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -// FIFOCompare is a basic task comparator that returns tasks in the order created. -var FIFOCompare = func(a, b *TaskBlock) bool { - return a.created.Before(b.created) -} - -// PriorityCompare respects the target peer's task priority. For tasks involving -// different peers, the oldest task is prioritized. -var PriorityCompare = func(a, b *TaskBlock) bool { - if a.Target == b.Target { - return a.Priority > b.Priority - } - return FIFOCompare(a, b) -} - -// WrapCompare wraps a TaskBlock comparison function so it can be used as -// comparison for a priority queue -func WrapCompare(f func(a, b *TaskBlock) bool) func(a, b pq.Elem) bool { - return func(a, b pq.Elem) bool { - return f(a.(*TaskBlock), b.(*TaskBlock)) - } -} - -// Identifier is a unique identifier for a task. It's used by the client library -// to act on a task once it exits the queue. -type Identifier interface{} - -// Task is a single task to be executed as part of a task block. -type Task struct { - Identifier Identifier - Priority int -} - -// TaskBlock is a block of tasks to execute on a single peer. -type TaskBlock struct { - Tasks []Task - Priority int - Target peer.ID - - // A callback to signal that this task block has been completed - Done func([]Task) - - // toPrune are the tasks that have already been taken care of as part of - // a different task block which can be removed from the task block. - toPrune map[Identifier]struct{} - created time.Time // created marks the time that the task was added to the queue - index int // book-keeping field used by the pq container -} - -// NewTaskBlock creates a new task block with the given tasks, priority, target -// peer, and task completion function. -func NewTaskBlock(tasks []Task, priority int, target peer.ID, done func([]Task)) *TaskBlock { - return &TaskBlock{ - Tasks: tasks, - Priority: priority, - Target: target, - Done: done, - toPrune: make(map[Identifier]struct{}, len(tasks)), - created: time.Now(), - } -} - -// MarkPrunable marks any tasks with the given identifier as prunable at the time -// the task block is pulled of the queue to execute (because they've already been removed). -func (pt *TaskBlock) MarkPrunable(identifier Identifier) { - pt.toPrune[identifier] = struct{}{} -} - -// PruneTasks removes all tasks previously marked as prunable from the lists of -// tasks in the block -func (pt *TaskBlock) PruneTasks() { - newTasks := make([]Task, 0, len(pt.Tasks)-len(pt.toPrune)) - for _, task := range pt.Tasks { - if _, ok := pt.toPrune[task.Identifier]; !ok { - newTasks = append(newTasks, task) - } - } - pt.Tasks = newTasks -} - -// Index implements pq.Elem. -func (pt *TaskBlock) Index() int { - return pt.index -} - -// SetIndex implements pq.Elem. -func (pt *TaskBlock) SetIndex(i int) { - pt.index = i -} diff --git a/vendor/github.com/ipfs/go-peertaskqueue/peertaskqueue.go b/vendor/github.com/ipfs/go-peertaskqueue/peertaskqueue.go deleted file mode 100644 index 40200bdc..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/peertaskqueue.go +++ /dev/null @@ -1,220 +0,0 @@ -package peertaskqueue - -import ( - "sync" - - pq "github.com/ipfs/go-ipfs-pq" - "github.com/ipfs/go-peertaskqueue/peertask" - "github.com/ipfs/go-peertaskqueue/peertracker" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -type peerTaskQueueEvent int - -const ( - peerAdded = peerTaskQueueEvent(1) - peerRemoved = peerTaskQueueEvent(2) -) - -type hookFunc func(p peer.ID, event peerTaskQueueEvent) - -// PeerTaskQueue is a prioritized list of tasks to be executed on peers. -// The queue puts tasks on in blocks, then alternates between peers (roughly) -// to execute the block with the highest priority, or otherwise the one added -// first if priorities are equal. -type PeerTaskQueue struct { - lock sync.Mutex - pQueue pq.PQ - peerTrackers map[peer.ID]*peertracker.PeerTracker - frozenPeers map[peer.ID]struct{} - hooks []hookFunc - ignoreFreezing bool -} - -// Option is a function that configures the peer task queue -type Option func(*PeerTaskQueue) Option - -func chain(firstOption Option, secondOption Option) Option { - return func(ptq *PeerTaskQueue) Option { - firstReverse := firstOption(ptq) - secondReverse := secondOption(ptq) - return chain(secondReverse, firstReverse) - } -} - -// IgnoreFreezing is an option that can make the task queue ignore freezing and unfreezing -func IgnoreFreezing(ignoreFreezing bool) Option { - return func(ptq *PeerTaskQueue) Option { - previous := ptq.ignoreFreezing - ptq.ignoreFreezing = ignoreFreezing - return IgnoreFreezing(previous) - } -} - -func removeHook(hook hookFunc) Option { - return func(ptq *PeerTaskQueue) Option { - for i, testHook := range ptq.hooks { - if &hook == &testHook { - ptq.hooks = append(ptq.hooks[:i], ptq.hooks[i+1:]...) - break - } - } - return addHook(hook) - } -} - -func addHook(hook hookFunc) Option { - return func(ptq *PeerTaskQueue) Option { - ptq.hooks = append(ptq.hooks, hook) - return removeHook(hook) - } -} - -// OnPeerAddedHook adds a hook function that gets called whenever the ptq adds a new peer -func OnPeerAddedHook(onPeerAddedHook func(p peer.ID)) Option { - hook := func(p peer.ID, event peerTaskQueueEvent) { - if event == peerAdded { - onPeerAddedHook(p) - } - } - return addHook(hook) -} - -// OnPeerRemovedHook adds a hook function that gets called whenever the ptq adds a new peer -func OnPeerRemovedHook(onPeerRemovedHook func(p peer.ID)) Option { - hook := func(p peer.ID, event peerTaskQueueEvent) { - if event == peerRemoved { - onPeerRemovedHook(p) - } - } - return addHook(hook) -} - -// New creates a new PeerTaskQueue -func New(options ...Option) *PeerTaskQueue { - ptq := &PeerTaskQueue{ - peerTrackers: make(map[peer.ID]*peertracker.PeerTracker), - frozenPeers: make(map[peer.ID]struct{}), - pQueue: pq.New(peertracker.PeerCompare), - } - ptq.Options(options...) - return ptq -} - -// Options uses configuration functions to configure the peer task queue. -// It returns an Option that can be called to reverse the changes. -func (ptq *PeerTaskQueue) Options(options ...Option) Option { - if len(options) == 0 { - return nil - } - if len(options) == 1 { - return options[0](ptq) - } - reverse := options[0](ptq) - return chain(ptq.Options(options[1:]...), reverse) -} - -func (ptq *PeerTaskQueue) callHooks(to peer.ID, event peerTaskQueueEvent) { - for _, hook := range ptq.hooks { - hook(to, event) - } -} - -// PushBlock adds a new block of tasks for the given peer to the queue -func (ptq *PeerTaskQueue) PushBlock(to peer.ID, tasks ...peertask.Task) { - ptq.lock.Lock() - defer ptq.lock.Unlock() - peerTracker, ok := ptq.peerTrackers[to] - if !ok { - peerTracker = peertracker.New(to) - ptq.pQueue.Push(peerTracker) - ptq.peerTrackers[to] = peerTracker - ptq.callHooks(to, peerAdded) - } - - peerTracker.PushBlock(to, tasks, func(e []peertask.Task) { - ptq.lock.Lock() - for _, task := range e { - peerTracker.TaskDone(task.Identifier) - } - ptq.pQueue.Update(peerTracker.Index()) - ptq.lock.Unlock() - }) - ptq.pQueue.Update(peerTracker.Index()) -} - -// PopBlock 'pops' the next block of tasks to be performed. Returns nil if no block exists. -func (ptq *PeerTaskQueue) PopBlock() *peertask.TaskBlock { - ptq.lock.Lock() - defer ptq.lock.Unlock() - if ptq.pQueue.Len() == 0 { - return nil - } - peerTracker := ptq.pQueue.Pop().(*peertracker.PeerTracker) - - out := peerTracker.PopBlock() - if peerTracker.IsIdle() { - target := peerTracker.Target() - delete(ptq.peerTrackers, target) - delete(ptq.frozenPeers, target) - ptq.callHooks(target, peerRemoved) - } else { - ptq.pQueue.Push(peerTracker) - } - return out -} - -// Remove removes a task from the queue. -func (ptq *PeerTaskQueue) Remove(identifier peertask.Identifier, p peer.ID) { - ptq.lock.Lock() - peerTracker, ok := ptq.peerTrackers[p] - if ok { - if peerTracker.Remove(identifier) { - // we now also 'freeze' that partner. If they sent us a cancel for a - // block we were about to send them, we should wait a short period of time - // to make sure we receive any other in-flight cancels before sending - // them a block they already potentially have - if !ptq.ignoreFreezing { - if !peerTracker.IsFrozen() { - ptq.frozenPeers[p] = struct{}{} - } - - peerTracker.Freeze() - } - ptq.pQueue.Update(peerTracker.Index()) - } - } - ptq.lock.Unlock() -} - -// FullThaw completely thaws all peers in the queue so they can execute tasks. -func (ptq *PeerTaskQueue) FullThaw() { - ptq.lock.Lock() - defer ptq.lock.Unlock() - - for p := range ptq.frozenPeers { - peerTracker, ok := ptq.peerTrackers[p] - if ok { - peerTracker.FullThaw() - delete(ptq.frozenPeers, p) - ptq.pQueue.Update(peerTracker.Index()) - } - } -} - -// ThawRound unthaws peers incrementally, so that those have been frozen the least -// become unfrozen and able to execute tasks first. -func (ptq *PeerTaskQueue) ThawRound() { - ptq.lock.Lock() - defer ptq.lock.Unlock() - - for p := range ptq.frozenPeers { - peerTracker, ok := ptq.peerTrackers[p] - if ok { - if peerTracker.Thaw() { - delete(ptq.frozenPeers, p) - } - ptq.pQueue.Update(peerTracker.Index()) - } - } -} diff --git a/vendor/github.com/ipfs/go-peertaskqueue/peertracker/peertracker.go b/vendor/github.com/ipfs/go-peertaskqueue/peertracker/peertracker.go deleted file mode 100644 index 3b7451b6..00000000 --- a/vendor/github.com/ipfs/go-peertaskqueue/peertracker/peertracker.go +++ /dev/null @@ -1,212 +0,0 @@ -package peertracker - -import ( - "sync" - - pq "github.com/ipfs/go-ipfs-pq" - "github.com/ipfs/go-peertaskqueue/peertask" - peer "github.com/libp2p/go-libp2p-core/peer" -) - -// PeerTracker tracks task blocks for a single peer, as well as active tasks -// for that peer -type PeerTracker struct { - target peer.ID - // Active is the number of track tasks this peer is currently - // processing - // active must be locked around as it will be updated externally - activelk sync.Mutex - active int - activeTasks map[peertask.Identifier]struct{} - - // total number of task tasks for this task - numTasks int - - // for the PQ interface - index int - - freezeVal int - - taskMap map[peertask.Identifier]*peertask.TaskBlock - - // priority queue of tasks belonging to this peer - taskBlockQueue pq.PQ -} - -// New creates a new PeerTracker -func New(target peer.ID) *PeerTracker { - return &PeerTracker{ - target: target, - taskBlockQueue: pq.New(peertask.WrapCompare(peertask.PriorityCompare)), - taskMap: make(map[peertask.Identifier]*peertask.TaskBlock), - activeTasks: make(map[peertask.Identifier]struct{}), - } -} - -// PeerCompare implements pq.ElemComparator -// returns true if peer 'a' has higher priority than peer 'b' -func PeerCompare(a, b pq.Elem) bool { - pa := a.(*PeerTracker) - pb := b.(*PeerTracker) - - // having no tasks means lowest priority - // having both of these checks ensures stability of the sort - if pa.numTasks == 0 { - return false - } - if pb.numTasks == 0 { - return true - } - - if pa.freezeVal > pb.freezeVal { - return false - } - if pa.freezeVal < pb.freezeVal { - return true - } - - if pa.active == pb.active { - // sorting by taskQueue.Len() aids in cleaning out trash tasks faster - // if we sorted instead by requests, one peer could potentially build up - // a huge number of cancelled tasks in the queue resulting in a memory leak - return pa.taskBlockQueue.Len() > pb.taskBlockQueue.Len() - } - return pa.active < pb.active -} - -// StartTask signals that a task was started for this peer. -func (p *PeerTracker) StartTask(identifier peertask.Identifier) { - p.activelk.Lock() - p.activeTasks[identifier] = struct{}{} - p.active++ - p.activelk.Unlock() -} - -// TaskDone signals that a task was completed for this peer. -func (p *PeerTracker) TaskDone(identifier peertask.Identifier) { - p.activelk.Lock() - delete(p.activeTasks, identifier) - p.active-- - if p.active < 0 { - panic("more tasks finished than started!") - } - p.activelk.Unlock() -} - -// Target returns the peer that this peer tracker tracks tasks for -func (p *PeerTracker) Target() peer.ID { - return p.target -} - -// IsIdle returns true if the peer has no active tasks or queued tasks -func (p *PeerTracker) IsIdle() bool { - p.activelk.Lock() - defer p.activelk.Unlock() - return p.numTasks == 0 && p.active == 0 -} - -// Index implements pq.Elem. -func (p *PeerTracker) Index() int { - return p.index -} - -// SetIndex implements pq.Elem. -func (p *PeerTracker) SetIndex(i int) { - p.index = i -} - -// PushBlock adds a new block of tasks on to a peers queue from the given -// peer ID, list of tasks, and task block completion function -func (p *PeerTracker) PushBlock(target peer.ID, tasks []peertask.Task, done func(e []peertask.Task)) { - - p.activelk.Lock() - defer p.activelk.Unlock() - - var priority int - newTasks := make([]peertask.Task, 0, len(tasks)) - for _, task := range tasks { - if _, ok := p.activeTasks[task.Identifier]; ok { - continue - } - if taskBlock, ok := p.taskMap[task.Identifier]; ok { - if task.Priority > taskBlock.Priority { - taskBlock.Priority = task.Priority - p.taskBlockQueue.Update(taskBlock.Index()) - } - continue - } - if task.Priority > priority { - priority = task.Priority - } - newTasks = append(newTasks, task) - } - - if len(newTasks) == 0 { - return - } - - taskBlock := peertask.NewTaskBlock(newTasks, priority, target, done) - p.taskBlockQueue.Push(taskBlock) - for _, task := range newTasks { - p.taskMap[task.Identifier] = taskBlock - } - p.numTasks += len(newTasks) -} - -// PopBlock removes a block of tasks from this peers queue -func (p *PeerTracker) PopBlock() *peertask.TaskBlock { - var out *peertask.TaskBlock - for p.taskBlockQueue.Len() > 0 && p.freezeVal == 0 { - out = p.taskBlockQueue.Pop().(*peertask.TaskBlock) - - for _, task := range out.Tasks { - delete(p.taskMap, task.Identifier) - } - out.PruneTasks() - - if len(out.Tasks) > 0 { - for _, task := range out.Tasks { - p.numTasks-- - p.StartTask(task.Identifier) - } - } else { - out = nil - continue - } - break - } - return out -} - -// Remove removes the task with the given identifier from this peers queue -func (p *PeerTracker) Remove(identifier peertask.Identifier) bool { - taskBlock, ok := p.taskMap[identifier] - if ok { - taskBlock.MarkPrunable(identifier) - p.numTasks-- - } - return ok -} - -// Freeze increments the freeze value for this peer. While a peer is frozen -// (freeze value > 0) it will not execute tasks. -func (p *PeerTracker) Freeze() { - p.freezeVal++ -} - -// Thaw decrements the freeze value for this peer. While a peer is frozen -// (freeze value > 0) it will not execute tasks. -func (p *PeerTracker) Thaw() bool { - p.freezeVal -= (p.freezeVal + 1) / 2 - return p.freezeVal <= 0 -} - -// FullThaw completely unfreezes this peer so it can execute tasks. -func (p *PeerTracker) FullThaw() { - p.freezeVal = 0 -} - -// IsFrozen returns whether this peer is frozen and unable to execute tasks. -func (p *PeerTracker) IsFrozen() bool { - return p.freezeVal > 0 -} diff --git a/vendor/github.com/ipfs/go-todocounter/.travis.yml b/vendor/github.com/ipfs/go-todocounter/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-todocounter/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-todocounter/LICENSE b/vendor/github.com/ipfs/go-todocounter/LICENSE deleted file mode 100644 index 808d2e01..00000000 --- a/vendor/github.com/ipfs/go-todocounter/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 libp2p - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/ipfs/go-todocounter/Makefile b/vendor/github.com/ipfs/go-todocounter/Makefile deleted file mode 100644 index 45d0c77e..00000000 --- a/vendor/github.com/ipfs/go-todocounter/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - go get ./... \ No newline at end of file diff --git a/vendor/github.com/ipfs/go-todocounter/README.md b/vendor/github.com/ipfs/go-todocounter/README.md deleted file mode 100644 index 7e8e4215..00000000 --- a/vendor/github.com/ipfs/go-todocounter/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# go-todocounter - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) - -> A threadsafe counter - -## Documenation - -See https://godoc.org/github.com/ipfs/go-todocounter. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-todocounter/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT \ No newline at end of file diff --git a/vendor/github.com/ipfs/go-todocounter/counter.go b/vendor/github.com/ipfs/go-todocounter/counter.go deleted file mode 100644 index 0df63820..00000000 --- a/vendor/github.com/ipfs/go-todocounter/counter.go +++ /dev/null @@ -1,118 +0,0 @@ -package todocounter - -import ( - "sync" -) - -// Counter records things remaining to process. It is needed for complicated -// cases where multiple goroutines are spawned to process items, and they may -// generate more items to process. For example, say a query over a set of nodes -// may yield either a result value, or more nodes to query. Signaling is subtly -// complicated, because the queue may be empty while items are being processed, -// that will end up adding more items to the queue. -// -// Use Counter like this: -// -// todos := make(chan int, 10) -// ctr := todoctr.NewCounter() -// -// process := func(item int) { -// fmt.Println("processing %d\n...", item) -// -// // this task may randomly generate more tasks -// if rand.Intn(5) == 0 { -// todos<- item + 1 -// ctr.Increment(1) // increment counter for new task. -// } -// -// ctr.Decrement(1) // decrement one to signal the task being done. -// } -// -// // add some tasks. -// todos<- 1 -// todos<- 2 -// todos<- 3 -// todos<- 4 -// ctr.Increment(4) -// -// for { -// select { -// case item := <- todos: -// go process(item) -// case <-ctr.Done(): -// fmt.Println("done processing everything.") -// close(todos) -// } -// } -type Counter interface { - // Incrememnt adds a number of todos to track. - // If the counter is **below** zero, it panics. - Increment(i uint32) - - // Decrement removes a number of todos to track. - // If the count drops to zero, signals done and destroys the counter. - // If the count drops **below** zero, panics. It means you have tried to remove - // more things than you added, i.e. sync issues. - Decrement(i uint32) - - // Done returns a channel to wait upon. Use it in selects: - // - // select { - // case <-ctr.Done(): - // // done processing all items - // } - // - Done() <-chan struct{} -} - -type todoCounter struct { - count int32 - done chan struct{} - sync.RWMutex -} - -// NewSyncCounter constructs a new counter -func NewSyncCounter() Counter { - return &todoCounter{ - done: make(chan struct{}), - } -} - -func (c *todoCounter) Increment(i uint32) { - c.Lock() - defer c.Unlock() - - if c.count < 0 { - panic("counter already signaled done. use a new counter.") - } - - // increment count - c.count += int32(i) -} - -// Decrement removes a number of todos to track. -// If the count drops to zero, signals done and destroys the counter. -// If the count drops **below** zero, panics. It means you have tried to remove -// more things than you added, i.e. sync issues. -func (c *todoCounter) Decrement(i uint32) { - c.Lock() - defer c.Unlock() - - if c.count < 0 { - panic("counter already signaled done. probably have sync issues.") - } - - if int32(i) > c.count { - panic("decrement amount creater than counter. sync issues.") - } - - c.count -= int32(i) - if c.count == 0 { // done! signal it. - c.count-- // set it to -1 to prevent reuse - close(c.done) // a closed channel will always return nil - } -} - -func (c *todoCounter) Done() <-chan struct{} { - return c.done -} diff --git a/vendor/github.com/ipfs/go-todocounter/go.mod b/vendor/github.com/ipfs/go-todocounter/go.mod deleted file mode 100644 index d631776e..00000000 --- a/vendor/github.com/ipfs/go-todocounter/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/ipfs/go-todocounter diff --git a/vendor/github.com/ipfs/go-todocounter/package.json b/vendor/github.com/ipfs/go-todocounter/package.json deleted file mode 100644 index 3141ae04..00000000 --- a/vendor/github.com/ipfs/go-todocounter/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/ipfs/go-todocounter/issues" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-todocounter" - }, - "gxVersion": "0.8.0", - "language": "go", - "license": "MIT", - "name": "go-todocounter", - "version": "1.0.1" -} diff --git a/vendor/github.com/ipfs/go-unixfs/.travis.yml b/vendor/github.com/ipfs/go-unixfs/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-unixfs/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-unixfs/CODEOWNERS b/vendor/github.com/ipfs/go-unixfs/CODEOWNERS deleted file mode 100644 index ea812704..00000000 --- a/vendor/github.com/ipfs/go-unixfs/CODEOWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Please see https://help.github.com/articles/about-codeowners/ for more information - -# Global owner -* @schomatis - -# Subsystem specific owners - - diff --git a/vendor/github.com/ipfs/go-unixfs/LICENSE b/vendor/github.com/ipfs/go-unixfs/LICENSE deleted file mode 100644 index 7d5dcac4..00000000 --- a/vendor/github.com/ipfs/go-unixfs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/go-unixfs/Makefile b/vendor/github.com/ipfs/go-unixfs/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/ipfs/go-unixfs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/ipfs/go-unixfs/README.md b/vendor/github.com/ipfs/go-unixfs/README.md deleted file mode 100644 index 9a22fbd3..00000000 --- a/vendor/github.com/ipfs/go-unixfs/README.md +++ /dev/null @@ -1,63 +0,0 @@ -go-unixfs -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Coverage Status](https://codecov.io/gh/ipfs/go-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-unixfs/branch/master) -[![Travis CI](https://travis-ci.org/ipfs/go-unixfs.svg?branch=master)](https://travis-ci.org/ipfs/go-unixfs) - -> go-unixfs implements unix-like filesystem utilities on top of an ipld merkledag - - -## Table of Contents - -- [Directory](#directory) -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Package Directory -This package contains many subpackages, each of which can be very large on its own. - -### Top Level -The top level unixfs package defines the unixfs format datastructures, and some helper methods around it. - -### importers -The `importer` subpackage is what you'll use when you want to turn a normal file into a unixfs file. - -### io -The `io` subpackage provides helpers for reading files and manipulating directories. The `DagReader` takes a -reference to a unixfs file and returns a file handle that can be read from and seeked through. The `Directory` -interface allows you to easily read items in a directory, add items to a directory, and do lookups. - -### mod -The `mod` subpackage implements a `DagModifier` type that can be used to write to an existing unixfs file, or -create a new one. The logic for this is significantly more complicated than for the dagreader, so its a separate -type. (TODO: maybe it still belongs in the `io` subpackage though?) - -### hamt -The `hamt` subpackage implements a CHAMP hamt that is used in unixfs directory sharding. - -### archive -The `archive` subpackage implements a `tar` importer and exporter. The objects created here are not officially unixfs, -but in the future, this may be integrated more directly. - -### test -The `test` subpackage provides several utilities to make testing unixfs related things easier. - -## Install - -```sh -go get github.com/ipfs/go-unixfs -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Juan Batiz-Benet diff --git a/vendor/github.com/ipfs/go-unixfs/go.mod b/vendor/github.com/ipfs/go-unixfs/go.mod deleted file mode 100644 index d44a3006..00000000 --- a/vendor/github.com/ipfs/go-unixfs/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/ipfs/go-unixfs - -require ( - github.com/Stebalien/go-bitfield v0.0.1 - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-ipfs-chunker v0.0.1 - github.com/ipfs/go-ipfs-files v0.0.3 - github.com/ipfs/go-ipfs-posinfo v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-ipld-format v0.0.2 - github.com/ipfs/go-merkledag v0.0.6 - github.com/multiformats/go-multihash v0.0.5 - github.com/spaolacci/murmur3 v1.1.0 -) diff --git a/vendor/github.com/ipfs/go-unixfs/go.sum b/vendor/github.com/ipfs/go-unixfs/go.sum deleted file mode 100644 index 9b8ea5f2..00000000 --- a/vendor/github.com/ipfs/go-unixfs/go.sum +++ /dev/null @@ -1,402 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/Stebalien/go-bitfield v0.0.1 h1:X3kbSSPUaJK60wV2hjOPZwmpljr6VGCqdq4cBLhbQBo= -github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.0.9 h1:Dy0qvYlaOd2E2FOL2gApJ21qVjepJsGNNfstLrGf+0I= -github.com/ipfs/go-bitswap v0.0.9/go.mod h1:kAPf5qgn2W2DrgAcscZ3HrM9qh4pH+X8Fkk3UPrwvis= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-blockservice v0.0.7 h1:VRRVjgahs7r//MdO7yY5DJ2/i2fmkKOnxfSyfuPjTm0= -github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbRhbvNSdgc/7So= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw= -github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-files v0.0.3 h1:ME+QnC3uOyla1ciRPezDW0ynQYK2ikOh9OCKAEg4uUA= -github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= -github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.0.1 h1:394mZeTLcbM/LDO12PneBYvkZAUA+nRnmC0lAzDXKOY= -github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-cbor v0.0.2 h1:amzFztBQQQ69UA5+f7JRfoXF/z2l//MGfEDHVkS20+s= -github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs= -github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-merkledag v0.0.6 h1:rYZc0yzhO7y1cKi3Rw425a2HhEJDdLvNOWsqtmO3PF0= -github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-peertaskqueue v0.0.4 h1:i0JprfjjILYcWM1xguO/1MCS8XKVxLSl+ECEVr6i8nw= -github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -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/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security v0.0.1 h1:4kMMrqrt9EUNCNjX1xagSJC+bq16uqjMe9lk1KBMVNs= -github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= -github.com/libp2p/go-conn-security-multistream v0.0.2 h1:Ykz0lnNjxk+0SdslUmlLNyrleqdpS1S/VW+dxFdt74Y= -github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.0.30 h1:mwCWAusLhRGUzZ/VaCatsrEQTsuWExmXqVcvGBV72EQ= -github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A= -github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE= -github.com/libp2p/go-libp2p-blankhost v0.0.1 h1:/mZuuiwntNR8RywnCFlGHLKrKLYne+qciBpQXWqp5fk= -github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= -github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I= -github.com/libp2p/go-libp2p-host v0.0.1 h1:dnqusU+DheGcdxrE718kG4XgHNuL2n9eEv8Rg5zy8hQ= -github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= -github.com/libp2p/go-libp2p-host v0.0.3 h1:BB/1Z+4X0rjKP5lbQTmjEjLbDVbrcmLOlA6QDsN5/j4= -github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1 h1:Q9EkNSLAOF+u90L88qmE9z/fTdjLh8OsJwGw74mkwk4= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5 h1:KG/KNYL2tYzXAfMvQN5K1aAGTYSYUMJ1prgYa2/JI1E= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.5/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1 h1:7GnzRrBTJHEsofi1ahFdPN9Si6skwXQE9UqR2S+Pkh8= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k= -github.com/libp2p/go-libp2p-loggables v0.0.1 h1:HVww9oAnINIxbt69LJNkxD8lnbfgteXR97Xm4p3l9ps= -github.com/libp2p/go-libp2p-loggables v0.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg= -github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= -github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= -github.com/libp2p/go-libp2p-mplex v0.1.1 h1:lSPS1VJ36P01gGO//KgcsmSah5uoC3X9r7WY5j+iP4c= -github.com/libp2p/go-libp2p-mplex v0.1.1/go.mod h1:KUQWpGkCzfV7UIpi8SKsAVxyBgz1c9R5EvxgnwLsb/I= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-net v0.0.1 h1:xJ4Vh4yKF/XKb8fd1Ev0ebAGzVjMxXzrxG2kjtU+F5Q= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-net v0.0.2 h1:qP06u4TYXfl7uW/hzqPhlVVTSA2nw1B/bHBJaUnbh6M= -github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-netutil v0.0.1 h1:LgD6+skofkOx8z6odD9+MZHKjupv3ng1u6KRhaADTnA= -github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlcjVk3UoJU3c= -github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= -github.com/libp2p/go-libp2p-record v0.0.1 h1:zN7AS3X46qmwsw5JLxdDuI43cH5UYwovKxHPjKBYQxw= -github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= -github.com/libp2p/go-libp2p-routing v0.0.1 h1:hPMAWktf9rYi3ME4MG48qE7dq1ofJxiQbfdvpNntjhc= -github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= -github.com/libp2p/go-libp2p-secio v0.0.3 h1:h3fPeDrej7bvvARnC2oSjAfcLZOaS4REZKgWCRQNpE4= -github.com/libp2p/go-libp2p-secio v0.0.3/go.mod h1:hS7HQ00MgLhRO/Wyu1bTX6ctJKhVpm+j2/S2A5UqYb0= -github.com/libp2p/go-libp2p-swarm v0.0.6 h1:gE0P/v2h+KEXtAi9YTw2UBOSODJ4m9VuuJ+ktc2LVUo= -github.com/libp2p/go-libp2p-swarm v0.0.6/go.mod h1:s5GZvzg9xXe8sbeESuFpjt8CJPTCa8mhEusweJqyFy8= -github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= -github.com/libp2p/go-libp2p-transport v0.0.5 h1:pV6+UlRxyDpASSGD+60vMvdifSCby6JkJDfi+yUMHac= -github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4 h1:uGMOd14BL1oFlfb/cGfOxPjiTKBhzWV4aMjjoCF1Z1o= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= -github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8= -github.com/libp2p/go-libp2p-yamux v0.1.3 h1:HmKvv2jWJ4GEm3iP7cEKjuw0POa6rK+Hcsu1FBKzpLc= -github.com/libp2p/go-libp2p-yamux v0.1.3/go.mod h1:VGSQVrqkh6y4nm0189qqxMtvyBft44MOYYPpYKXiVt4= -github.com/libp2p/go-maddr-filter v0.0.1 h1:apvYTg0aIxxQyBX+XHKOR+0+lYhGs1Yv+JmTH9nyl5I= -github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.0.4 h1:043XJ3Zr7/Oz5cfyUaJwxUZyP02TngTpt4oq8R5UizQ= -github.com/libp2p/go-mplex v0.0.4/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer v0.1.0 h1:3ToDXUzx8pDC6RfuOzGsUYP5roMDthbUKRdMRRhqAqY= -github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqXJyFvB0mR4A04sQ= -github.com/libp2p/go-stream-muxer-multistream v0.1.1 h1:DhHqb4nu1fQv/vQKeLAaZGmhLsUA4SF77IdYJiWE1d4= -github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw= -github.com/libp2p/go-tcp-transport v0.0.4 h1:2iRu994wCT/iEz62F+c60FUoSkijNEQ0q2Itc+79XlQ= -github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o= -github.com/libp2p/go-testutil v0.0.1 h1:Xg+O0G2HIMfHqBOBDcMS1iSZJ3GEcId4qOxCQvsGZHk= -github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= -github.com/libp2p/go-ws-transport v0.0.5/go.mod h1:Qbl4BxPfXXhhd/o0wcrgoaItHqA9tnZjoFZnxykuaXU= -github.com/libp2p/go-yamux v1.2.1/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.0.1 h1:JV4VfSdY9n7ECTtY59/TlSyFCzRILvYx4T4Ws8ZgihU= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4 h1:VSJ45BzqrVgR4clSx415y1rHH7QAGhGt71J0ZmhLYrc= -golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/go-unixfs/hamt/hamt.go b/vendor/github.com/ipfs/go-unixfs/hamt/hamt.go deleted file mode 100644 index 7947a2aa..00000000 --- a/vendor/github.com/ipfs/go-unixfs/hamt/hamt.go +++ /dev/null @@ -1,677 +0,0 @@ -// Package hamt implements a Hash Array Mapped Trie over ipfs merkledag nodes. -// It is implemented mostly as described in the wikipedia article on HAMTs, -// however the table size is variable (usually 256 in our usages) as opposed to -// 32 as suggested in the article. The hash function used is currently -// Murmur3, but this value is configurable (the datastructure reports which -// hash function its using). -// -// The one algorithmic change we implement that is not mentioned in the -// wikipedia article is the collapsing of empty shards. -// Given the following tree: ( '[' = shards, '{' = values ) -// [ 'A' ] -> [ 'B' ] -> { "ABC" } -// | L-> { "ABD" } -// L-> { "ASDF" } -// If we simply removed "ABC", we would end up with a tree where shard 'B' only -// has a single child. This causes two issues, the first, is that now we have -// an extra lookup required to get to "ABD". The second issue is that now we -// have a tree that contains only "ABD", but is not the same tree that we would -// get by simply inserting "ABD" into a new tree. To address this, we always -// check for empty shard nodes upon deletion and prune them to maintain a -// consistent tree, independent of insertion order. -package hamt - -import ( - "context" - "fmt" - "os" - - bitfield "github.com/Stebalien/go-bitfield" - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - dag "github.com/ipfs/go-merkledag" - format "github.com/ipfs/go-unixfs" -) - -const ( - // HashMurmur3 is the multiformats identifier for Murmur3 - HashMurmur3 uint64 = 0x22 -) - -func (ds *Shard) isValueNode() bool { - return ds.key != "" && ds.val != nil -} - -// A Shard represents the HAMT. It should be initialized with NewShard(). -type Shard struct { - cid cid.Cid - - childer *childer - - tableSize int - tableSizeLg2 int - - builder cid.Builder - hashFunc uint64 - - prefixPadStr string - maxpadlen int - - dserv ipld.DAGService - - // leaf node - key string - val *ipld.Link -} - -// NewShard creates a new, empty HAMT shard with the given size. -func NewShard(dserv ipld.DAGService, size int) (*Shard, error) { - ds, err := makeShard(dserv, size) - if err != nil { - return nil, err - } - - ds.hashFunc = HashMurmur3 - return ds, nil -} - -func makeShard(ds ipld.DAGService, size int) (*Shard, error) { - lg2s, err := logtwo(size) - if err != nil { - return nil, err - } - maxpadding := fmt.Sprintf("%X", size-1) - s := &Shard{ - tableSizeLg2: lg2s, - prefixPadStr: fmt.Sprintf("%%0%dX", len(maxpadding)), - maxpadlen: len(maxpadding), - childer: newChilder(ds, size), - tableSize: size, - dserv: ds, - } - - s.childer.sd = s - - return s, nil -} - -// NewHamtFromDag creates new a HAMT shard from the given DAG. -func NewHamtFromDag(dserv ipld.DAGService, nd ipld.Node) (*Shard, error) { - pbnd, ok := nd.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - fsn, err := format.FSNodeFromBytes(pbnd.Data()) - if err != nil { - return nil, err - } - - if fsn.Type() != format.THAMTShard { - return nil, fmt.Errorf("node was not a dir shard") - } - - if fsn.HashType() != HashMurmur3 { - return nil, fmt.Errorf("only murmur3 supported as hash function") - } - - size := int(fsn.Fanout()) - - ds, err := makeShard(dserv, size) - if err != nil { - return nil, err - } - - ds.childer.makeChilder(fsn.Data(), pbnd.Links()) - - ds.cid = pbnd.Cid() - ds.hashFunc = fsn.HashType() - ds.builder = pbnd.CidBuilder() - - return ds, nil -} - -// SetCidBuilder sets the CID Builder -func (ds *Shard) SetCidBuilder(builder cid.Builder) { - ds.builder = builder -} - -// CidBuilder gets the CID Builder, may be nil if unset -func (ds *Shard) CidBuilder() cid.Builder { - return ds.builder -} - -// Node serializes the HAMT structure into a merkledag node with unixfs formatting -func (ds *Shard) Node() (ipld.Node, error) { - out := new(dag.ProtoNode) - out.SetCidBuilder(ds.builder) - - sliceIndex := 0 - // TODO: optimized 'for each set bit' - for childIndex := 0; childIndex < ds.tableSize; childIndex++ { - if !ds.childer.has(childIndex) { - continue - } - - ch := ds.childer.child(sliceIndex) - if ch != nil { - clnk, err := ch.Link() - if err != nil { - return nil, err - } - - err = out.AddRawLink(ds.linkNamePrefix(childIndex)+ch.key, clnk) - if err != nil { - return nil, err - } - } else { - // child unloaded, just copy in link with updated name - lnk := ds.childer.link(sliceIndex) - label := lnk.Name[ds.maxpadlen:] - - err := out.AddRawLink(ds.linkNamePrefix(childIndex)+label, lnk) - if err != nil { - return nil, err - } - } - sliceIndex++ - } - - data, err := format.HAMTShardData(ds.childer.bitfield.Bytes(), uint64(ds.tableSize), HashMurmur3) - if err != nil { - return nil, err - } - - out.SetData(data) - - err = ds.dserv.Add(context.TODO(), out) - if err != nil { - return nil, err - } - - return out, nil -} - -func (ds *Shard) makeShardValue(lnk *ipld.Link) (*Shard, error) { - lnk2 := *lnk - s, err := makeShard(ds.dserv, ds.tableSize) - if err != nil { - return nil, err - } - - s.key = lnk.Name[ds.maxpadlen:] - s.val = &lnk2 - - return s, nil -} - -// Set sets 'name' = nd in the HAMT -func (ds *Shard) Set(ctx context.Context, name string, nd ipld.Node) error { - hv := &hashBits{b: hash([]byte(name))} - err := ds.dserv.Add(ctx, nd) - if err != nil { - return err - } - - lnk, err := ipld.MakeLink(nd) - if err != nil { - return err - } - lnk.Name = ds.linkNamePrefix(0) + name - - return ds.modifyValue(ctx, hv, name, lnk) -} - -// Remove deletes the named entry if it exists, this operation is idempotent. -func (ds *Shard) Remove(ctx context.Context, name string) error { - hv := &hashBits{b: hash([]byte(name))} - return ds.modifyValue(ctx, hv, name, nil) -} - -// Find searches for a child node by 'name' within this hamt -func (ds *Shard) Find(ctx context.Context, name string) (*ipld.Link, error) { - hv := &hashBits{b: hash([]byte(name))} - - var out *ipld.Link - err := ds.getValue(ctx, hv, name, func(sv *Shard) error { - out = sv.val - return nil - }) - if err != nil { - return nil, err - } - - return out, nil -} - -type linkType int - -const ( - invalidLink linkType = iota - shardLink - shardValueLink -) - -func (ds *Shard) childLinkType(lnk *ipld.Link) (linkType, error) { - if len(lnk.Name) < ds.maxpadlen { - return invalidLink, fmt.Errorf("invalid link name '%s'", lnk.Name) - } - if len(lnk.Name) == ds.maxpadlen { - return shardLink, nil - } - return shardValueLink, nil -} - -// Link returns a merklelink to this shard node -func (ds *Shard) Link() (*ipld.Link, error) { - if ds.isValueNode() { - return ds.val, nil - } - - nd, err := ds.Node() - if err != nil { - return nil, err - } - - err = ds.dserv.Add(context.TODO(), nd) - if err != nil { - return nil, err - } - - return ipld.MakeLink(nd) -} - -func (ds *Shard) getValue(ctx context.Context, hv *hashBits, key string, cb func(*Shard) error) error { - childIndex, err := hv.Next(ds.tableSizeLg2) - if err != nil { - return err - } - - if ds.childer.has(childIndex) { - child, err := ds.childer.get(ctx, ds.childer.sliceIndex(childIndex)) - if err != nil { - return err - } - - if child.isValueNode() { - if child.key == key { - return cb(child) - } - } else { - return child.getValue(ctx, hv, key, cb) - } - } - - return os.ErrNotExist -} - -// EnumLinks collects all links in the Shard. -func (ds *Shard) EnumLinks(ctx context.Context) ([]*ipld.Link, error) { - var links []*ipld.Link - - linkResults := ds.EnumLinksAsync(ctx) - - for linkResult := range linkResults { - if linkResult.Err != nil { - return links, linkResult.Err - } - links = append(links, linkResult.Link) - } - return links, nil -} - -// ForEachLink walks the Shard and calls the given function. -func (ds *Shard) ForEachLink(ctx context.Context, f func(*ipld.Link) error) error { - return ds.walkTrie(ctx, func(sv *Shard) error { - lnk := sv.val - lnk.Name = sv.key - - return f(lnk) - }) -} - -// EnumLinksAsync returns a channel which will receive Links in the directory -// as they are enumerated, where order is not gauranteed -func (ds *Shard) EnumLinksAsync(ctx context.Context) <-chan format.LinkResult { - linkResults := make(chan format.LinkResult) - ctx, cancel := context.WithCancel(ctx) - go func() { - defer close(linkResults) - defer cancel() - getLinks := makeAsyncTrieGetLinks(ds.dserv, linkResults) - cset := cid.NewSet() - err := dag.EnumerateChildrenAsync(ctx, getLinks, ds.cid, cset.Visit) - if err != nil { - emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err}) - } - }() - return linkResults -} - -// makeAsyncTrieGetLinks builds a getLinks function that can be used with EnumerateChildrenAsync -// to iterate a HAMT shard. It takes an IPLD Dag Service to fetch nodes, and a call back that will get called -// on all links to leaf nodes in a HAMT tree, so they can be collected for an EnumLinks operation -func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format.LinkResult) dag.GetLinks { - - return func(ctx context.Context, currentCid cid.Cid) ([]*ipld.Link, error) { - node, err := dagService.Get(ctx, currentCid) - if err != nil { - return nil, err - } - directoryShard, err := NewHamtFromDag(dagService, node) - if err != nil { - return nil, err - } - - childShards := make([]*ipld.Link, 0, directoryShard.childer.length()) - links := directoryShard.childer.links - for idx := range directoryShard.childer.children { - lnk := links[idx] - lnkLinkType, err := directoryShard.childLinkType(lnk) - - if err != nil { - return nil, err - } - if lnkLinkType == shardLink { - childShards = append(childShards, lnk) - } else { - sv, err := directoryShard.makeShardValue(lnk) - if err != nil { - return nil, err - } - formattedLink := sv.val - formattedLink.Name = sv.key - emitResult(ctx, linkResults, format.LinkResult{Link: formattedLink, Err: nil}) - } - } - return childShards, nil - } -} - -func emitResult(ctx context.Context, linkResults chan<- format.LinkResult, r format.LinkResult) { - // make sure that context cancel is processed first - // the reason is due to the concurrency of EnumerateChildrenAsync - // it's possible for EnumLinksAsync to complete and close the linkResults - // channel before this code runs - select { - case <-ctx.Done(): - return - default: - } - select { - case linkResults <- r: - case <-ctx.Done(): - } -} - -func (ds *Shard) walkTrie(ctx context.Context, cb func(*Shard) error) error { - return ds.childer.each(ctx, func(s *Shard) error { - if s.isValueNode() { - if err := cb(s); err != nil { - return err - } - } else { - if err := s.walkTrie(ctx, cb); err != nil { - return err - } - } - return nil - }) -} - -func (ds *Shard) modifyValue(ctx context.Context, hv *hashBits, key string, val *ipld.Link) error { - idx, err := hv.Next(ds.tableSizeLg2) - if err != nil { - return err - } - - if !ds.childer.has(idx) { - return ds.childer.insert(key, val, idx) - } - - i := ds.childer.sliceIndex(idx) - - child, err := ds.childer.get(ctx, i) - if err != nil { - return err - } - - if child.isValueNode() { - if child.key == key { - // value modification - if val == nil { - return ds.childer.rm(idx) - } - - child.val = val - return nil - } - - if val == nil { - return os.ErrNotExist - } - - // replace value with another shard, one level deeper - ns, err := NewShard(ds.dserv, ds.tableSize) - if err != nil { - return err - } - ns.builder = ds.builder - chhv := &hashBits{ - b: hash([]byte(child.key)), - consumed: hv.consumed, - } - - err = ns.modifyValue(ctx, hv, key, val) - if err != nil { - return err - } - - err = ns.modifyValue(ctx, chhv, child.key, child.val) - if err != nil { - return err - } - - ds.childer.set(ns, i) - return nil - } else { - err := child.modifyValue(ctx, hv, key, val) - if err != nil { - return err - } - - if val == nil { - switch child.childer.length() { - case 0: - // empty sub-shard, prune it - // Note: this shouldnt normally ever happen - // in the event of another implementation creates flawed - // structures, this will help to normalize them. - return ds.childer.rm(idx) - case 1: - nchild := child.childer.children[0] - if nchild.isValueNode() { - // sub-shard with a single value element, collapse it - ds.childer.set(nchild, i) - } - return nil - } - } - - return nil - } -} - -// linkNamePrefix takes in the bitfield index of an entry and returns its hex prefix -func (ds *Shard) linkNamePrefix(idx int) string { - return fmt.Sprintf(ds.prefixPadStr, idx) -} - -// childer wraps the links, children and bitfield -// and provides basic operation (get, rm, insert and set) of manipulating children. -// The slices `links` and `children` are always coordinated to have the entries -// in the same index. A `childIndex` belonging to one of the original `Shard.size` -// entries corresponds to a `sliceIndex` in `links` and `children` (the conversion -// is done through `bitfield`). -type childer struct { - sd *Shard - dserv ipld.DAGService - bitfield bitfield.Bitfield - links []*ipld.Link - children []*Shard -} - -func newChilder(ds ipld.DAGService, size int) *childer { - return &childer{ - dserv: ds, - bitfield: bitfield.NewBitfield(size), - } -} - -func (s *childer) makeChilder(data []byte, links []*ipld.Link) *childer { - s.children = make([]*Shard, len(links)) - s.bitfield.SetBytes(data) - if len(links) > 0 { - s.links = make([]*ipld.Link, len(links)) - copy(s.links, links) - } - - return s -} - -// Return the `sliceIndex` associated with a child. -func (s *childer) sliceIndex(childIndex int) (sliceIndex int) { - return s.bitfield.OnesBefore(childIndex) -} - -func (s *childer) child(sliceIndex int) *Shard { - return s.children[sliceIndex] -} - -func (s *childer) link(sliceIndex int) *ipld.Link { - return s.links[sliceIndex] -} - -func (s *childer) insert(key string, lnk *ipld.Link, idx int) error { - if lnk == nil { - return os.ErrNotExist - } - - lnk.Name = s.sd.linkNamePrefix(idx) + key - i := s.sliceIndex(idx) - sd := &Shard{key: key, val: lnk} - - s.children = append(s.children[:i], append([]*Shard{sd}, s.children[i:]...)...) - s.links = append(s.links[:i], append([]*ipld.Link{nil}, s.links[i:]...)...) - // Add a `nil` placeholder in `links` so the rest of the entries keep the same - // index as `children`. - s.bitfield.SetBit(idx) - - return nil -} - -func (s *childer) set(sd *Shard, i int) { - s.children[i] = sd -} - -func (s *childer) rm(childIndex int) error { - i := s.sliceIndex(childIndex) - - if err := s.check(i); err != nil { - return err - } - - copy(s.children[i:], s.children[i+1:]) - s.children = s.children[:len(s.children)-1] - - copy(s.links[i:], s.links[i+1:]) - s.links = s.links[:len(s.links)-1] - - s.bitfield.UnsetBit(childIndex) - - return nil -} - -// get returns the i'th child of this shard. If it is cached in the -// children array, it will return it from there. Otherwise, it loads the child -// node from disk. -func (s *childer) get(ctx context.Context, sliceIndex int) (*Shard, error) { - if err := s.check(sliceIndex); err != nil { - return nil, err - } - - c := s.child(sliceIndex) - if c != nil { - return c, nil - } - - return s.loadChild(ctx, sliceIndex) -} - -// loadChild reads the i'th child node of this shard from disk and returns it -// as a 'child' interface -func (s *childer) loadChild(ctx context.Context, sliceIndex int) (*Shard, error) { - lnk := s.link(sliceIndex) - lnkLinkType, err := s.sd.childLinkType(lnk) - if err != nil { - return nil, err - } - - var c *Shard - if lnkLinkType == shardLink { - nd, err := lnk.GetNode(ctx, s.dserv) - if err != nil { - return nil, err - } - cds, err := NewHamtFromDag(s.dserv, nd) - if err != nil { - return nil, err - } - - c = cds - } else { - s, err := s.sd.makeShardValue(lnk) - if err != nil { - return nil, err - } - c = s - } - - s.set(c, sliceIndex) - - return c, nil -} - -func (s *childer) has(childIndex int) bool { - return s.bitfield.Bit(childIndex) -} - -func (s *childer) length() int { - return len(s.children) -} - -func (s *childer) each(ctx context.Context, cb func(*Shard) error) error { - for i := range s.children { - c, err := s.get(ctx, i) - if err != nil { - return err - } - - if err := cb(c); err != nil { - return err - } - } - - return nil -} - -func (s *childer) check(sliceIndex int) error { - if sliceIndex >= len(s.children) || sliceIndex < 0 { - return fmt.Errorf("invalid index passed to operate children (likely corrupt bitfield)") - } - - if len(s.children) != len(s.links) { - return fmt.Errorf("inconsistent lengths between children array and Links array") - } - - return nil -} diff --git a/vendor/github.com/ipfs/go-unixfs/hamt/util.go b/vendor/github.com/ipfs/go-unixfs/hamt/util.go deleted file mode 100644 index 7ae02dfb..00000000 --- a/vendor/github.com/ipfs/go-unixfs/hamt/util.go +++ /dev/null @@ -1,68 +0,0 @@ -package hamt - -import ( - "fmt" - - "github.com/spaolacci/murmur3" - "math/bits" -) - -// hashBits is a helper that allows the reading of the 'next n bits' as an integer. -type hashBits struct { - b []byte - consumed int -} - -func mkmask(n int) byte { - return (1 << uint(n)) - 1 -} - -// Next returns the next 'i' bits of the hashBits value as an integer, or an -// error if there aren't enough bits. -func (hb *hashBits) Next(i int) (int, error) { - if hb.consumed+i > len(hb.b)*8 { - return 0, fmt.Errorf("sharded directory too deep") - } - return hb.next(i), nil -} - -func (hb *hashBits) next(i int) int { - curbi := hb.consumed / 8 - leftb := 8 - (hb.consumed % 8) - - curb := hb.b[curbi] - if i == leftb { - out := int(mkmask(i) & curb) - hb.consumed += i - return out - } else if i < leftb { - a := curb & mkmask(leftb) // mask out the high bits we don't want - b := a & ^mkmask(leftb-i) // mask out the low bits we don't want - c := b >> uint(leftb-i) // shift whats left down - hb.consumed += i - return int(c) - } else { - out := int(mkmask(leftb) & curb) - out <<= uint(i - leftb) - hb.consumed += leftb - out += hb.next(i - leftb) - return out - } -} - -func logtwo(v int) (int, error) { - if v <= 0 { - return 0, fmt.Errorf("hamt size should be a power of two") - } - lg2 := bits.TrailingZeros(uint(v)) - if 1< BlockSizeLimit { - return nil, ErrSizeLimitExceeded - } - - if db.rawLeaves { - // Encapsulate the data in a raw node. - if db.cidBuilder == nil { - return dag.NewRawNode(data), nil - } - rawnode, err := dag.NewRawNodeWPrefix(data, db.cidBuilder) - if err != nil { - return nil, err - } - return rawnode, nil - } - - // Encapsulate the data in UnixFS node (instead of a raw node). - fsNodeOverDag := db.NewFSNodeOverDag(fsNodeType) - fsNodeOverDag.SetFileData(data) - node, err := fsNodeOverDag.Commit() - if err != nil { - return nil, err - } - // TODO: Encapsulate this sequence of calls into a function that - // just returns the final `ipld.Node` avoiding going through - // `FSNodeOverDag`. - - return node, nil -} - -// FillNodeLayer will add datanodes as children to the give node until -// it is full in this layer or no more data. -// NOTE: This function creates raw data nodes so it only works -// for the `trickle.Layout`. -func (db *DagBuilderHelper) FillNodeLayer(node *FSNodeOverDag) error { - - // while we have room AND we're not done - for node.NumChildren() < db.maxlinks && !db.Done() { - child, childFileSize, err := db.NewLeafDataNode(ft.TRaw) - if err != nil { - return err - } - - if err := node.AddChild(child, childFileSize, db); err != nil { - return err - } - } - node.Commit() - // TODO: Do we need to commit here? The caller who created the - // `FSNodeOverDag` should be in charge of that. - - return nil -} - -// NewLeafDataNode builds the `node` with the data obtained from the -// Splitter with the given constraints (BlockSizeLimit, RawLeaves) -// specified when creating the DagBuilderHelper. It returns -// `ipld.Node` with the `dataSize` (that will be used to keep track of -// the DAG file size). The size of the data is computed here because -// after that it will be hidden by `NewLeafNode` inside a generic -// `ipld.Node` representation. -func (db *DagBuilderHelper) NewLeafDataNode(fsNodeType pb.Data_DataType) (node ipld.Node, dataSize uint64, err error) { - fileData, err := db.Next() - if err != nil { - return nil, 0, err - } - dataSize = uint64(len(fileData)) - - // Create a new leaf node containing the file chunk data. - node, err = db.NewLeafNode(fileData, fsNodeType) - if err != nil { - return nil, 0, err - } - - // Convert this leaf to a `FilestoreNode` if needed. - node = db.ProcessFileStore(node, dataSize) - - return node, dataSize, nil -} - -// ProcessFileStore generates, if Filestore is being used, the -// `FilestoreNode` representation of the `ipld.Node` that -// contains the file data. If Filestore is not being used just -// return the same node to continue with its addition to the DAG. -// -// The `db.offset` is updated at this point (instead of when -// `NewLeafDataNode` is called, both work in tandem but the -// offset is more related to this function). -func (db *DagBuilderHelper) ProcessFileStore(node ipld.Node, dataSize uint64) ipld.Node { - // Check if Filestore is being used. - if db.fullPath != "" { - // Check if the node is actually a raw node (needed for - // Filestore support). - if _, ok := node.(*dag.RawNode); ok { - fn := &pi.FilestoreNode{ - Node: node, - PosInfo: &pi.PosInfo{ - Offset: db.offset, - FullPath: db.fullPath, - Stat: db.stat, - }, - } - - // Update `offset` with the size of the data generated by `db.Next`. - db.offset += dataSize - - return fn - } - } - - // Filestore is not used, return the same `node` argument. - return node -} - -// Add inserts the given node in the DAGService. -func (db *DagBuilderHelper) Add(node ipld.Node) error { - return db.dserv.Add(context.TODO(), node) -} - -// Maxlinks returns the configured maximum number for links -// for nodes built with this helper. -func (db *DagBuilderHelper) Maxlinks() int { - return db.maxlinks -} - -// FSNodeOverDag encapsulates an `unixfs.FSNode` that will be stored in a -// `dag.ProtoNode`. Instead of just having a single `ipld.Node` that -// would need to be constantly (un)packed to access and modify its -// internal `FSNode` in the process of creating a UnixFS DAG, this -// structure stores an `FSNode` cache to manipulate it (add child nodes) -// directly , and only when the node has reached its final (immutable) state -// (signaled by calling `Commit()`) is it committed to a single (indivisible) -// `ipld.Node`. -// -// It is used mainly for internal (non-leaf) nodes, and for some -// representations of data leaf nodes (that don't use raw nodes or -// Filestore). -// -// It aims to replace the `UnixfsNode` structure which encapsulated too -// many possible node state combinations. -// -// TODO: Revisit the name. -type FSNodeOverDag struct { - dag *dag.ProtoNode - file *ft.FSNode -} - -// NewFSNodeOverDag creates a new `dag.ProtoNode` and `ft.FSNode` -// decoupled from one onther (and will continue in that way until -// `Commit` is called), with `fsNodeType` specifying the type of -// the UnixFS layer node (either `File` or `Raw`). -func (db *DagBuilderHelper) NewFSNodeOverDag(fsNodeType pb.Data_DataType) *FSNodeOverDag { - node := new(FSNodeOverDag) - node.dag = new(dag.ProtoNode) - node.dag.SetCidBuilder(db.GetCidBuilder()) - - node.file = ft.NewFSNode(fsNodeType) - - return node -} - -// NewFSNFromDag reconstructs a FSNodeOverDag node from a given dag node -func (db *DagBuilderHelper) NewFSNFromDag(nd *dag.ProtoNode) (*FSNodeOverDag, error) { - return NewFSNFromDag(nd) -} - -// NewFSNFromDag reconstructs a FSNodeOverDag node from a given dag node -func NewFSNFromDag(nd *dag.ProtoNode) (*FSNodeOverDag, error) { - mb, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return nil, err - } - - return &FSNodeOverDag{ - dag: nd, - file: mb, - }, nil -} - -// AddChild adds a `child` `ipld.Node` to both node layers. The -// `dag.ProtoNode` creates a link to the child node while the -// `ft.FSNode` stores its file size (that is, not the size of the -// node but the size of the file data that it is storing at the -// UnixFS layer). The child is also stored in the `DAGService`. -func (n *FSNodeOverDag) AddChild(child ipld.Node, fileSize uint64, db *DagBuilderHelper) error { - err := n.dag.AddNodeLink("", child) - if err != nil { - return err - } - - n.file.AddBlockSize(fileSize) - - return db.Add(child) -} - -// RemoveChild deletes the child node at the given index. -func (n *FSNodeOverDag) RemoveChild(index int, dbh *DagBuilderHelper) { - n.file.RemoveBlockSize(index) - n.dag.SetLinks(append(n.dag.Links()[:index], n.dag.Links()[index+1:]...)) -} - -// Commit unifies (resolves) the cache nodes into a single `ipld.Node` -// that represents them: the `ft.FSNode` is encoded inside the -// `dag.ProtoNode`. -// -// TODO: Make it read-only after committing, allow to commit only once. -func (n *FSNodeOverDag) Commit() (ipld.Node, error) { - fileData, err := n.file.GetBytes() - if err != nil { - return nil, err - } - n.dag.SetData(fileData) - - return n.dag, nil -} - -// NumChildren returns the number of children of the `ft.FSNode`. -func (n *FSNodeOverDag) NumChildren() int { - return n.file.NumChildren() -} - -// FileSize returns the `Filesize` attribute from the underlying -// representation of the `ft.FSNode`. -func (n *FSNodeOverDag) FileSize() uint64 { - return n.file.FileSize() -} - -// SetFileData stores the `fileData` in the `ft.FSNode`. It -// should be used only when `FSNodeOverDag` represents a leaf -// node (internal nodes don't carry data, just file sizes). -func (n *FSNodeOverDag) SetFileData(fileData []byte) { - n.file.SetData(fileData) -} - -// GetDagNode fills out the proper formatting for the FSNodeOverDag node -// inside of a DAG node and returns the dag node. -// TODO: Check if we have committed (passed the UnixFS information -// to the DAG layer) before returning this. -func (n *FSNodeOverDag) GetDagNode() (ipld.Node, error) { - return n.dag, nil -} - -// GetChild gets the ith child of this node from the given DAGService. -func (n *FSNodeOverDag) GetChild(ctx context.Context, i int, ds ipld.DAGService) (*FSNodeOverDag, error) { - nd, err := n.dag.Links()[i].GetNode(ctx, ds) - if err != nil { - return nil, err - } - - pbn, ok := nd.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - return NewFSNFromDag(pbn) -} diff --git a/vendor/github.com/ipfs/go-unixfs/importer/helpers/helpers.go b/vendor/github.com/ipfs/go-unixfs/importer/helpers/helpers.go deleted file mode 100644 index 075b2d2d..00000000 --- a/vendor/github.com/ipfs/go-unixfs/importer/helpers/helpers.go +++ /dev/null @@ -1,30 +0,0 @@ -package helpers - -import ( - "fmt" -) - -// BlockSizeLimit specifies the maximum size an imported block can have. -var BlockSizeLimit = 1048576 // 1 MB - -// rough estimates on expected sizes -var roughLinkBlockSize = 1 << 13 // 8KB -var roughLinkSize = 34 + 8 + 5 // sha256 multihash + size + no name + protobuf framing - -// DefaultLinksPerBlock governs how the importer decides how many links there -// will be per block. This calculation is based on expected distributions of: -// * the expected distribution of block sizes -// * the expected distribution of link sizes -// * desired access speed -// For now, we use: -// -// var roughLinkBlockSize = 1 << 13 // 8KB -// var roughLinkSize = 34 + 8 + 5 // sha256 multihash + size + no name -// // + protobuf framing -// var DefaultLinksPerBlock = (roughLinkBlockSize / roughLinkSize) -// = ( 8192 / 47 ) -// = (approximately) 174 -var DefaultLinksPerBlock = roughLinkBlockSize / roughLinkSize - -// ErrSizeLimitExceeded signals that a block is larger than BlockSizeLimit. -var ErrSizeLimitExceeded = fmt.Errorf("object size limit exceeded") diff --git a/vendor/github.com/ipfs/go-unixfs/importer/trickle/trickledag.go b/vendor/github.com/ipfs/go-unixfs/importer/trickle/trickledag.go deleted file mode 100644 index 3a631adb..00000000 --- a/vendor/github.com/ipfs/go-unixfs/importer/trickle/trickledag.go +++ /dev/null @@ -1,389 +0,0 @@ -// Package trickle allows to build trickle DAGs. -// In this type of DAG, non-leave nodes are first filled -// with data leaves, and then incorporate "layers" of subtrees -// as additional links. -// -// Each layer is a trickle sub-tree and is limited by an increasing -// maximum depth. Thus, the nodes first layer -// can only hold leaves (depth 1) but subsequent layers can grow deeper. -// By default, this module places 4 nodes per layer (that is, 4 subtrees -// of the same maximum depth before increasing it). -// -// Trickle DAGs are very good for sequentially reading data, as the -// first data leaves are directly reachable from the root and those -// coming next are always nearby. They are -// suited for things like streaming applications. -package trickle - -import ( - "context" - "errors" - "fmt" - - ft "github.com/ipfs/go-unixfs" - h "github.com/ipfs/go-unixfs/importer/helpers" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" - dag "github.com/ipfs/go-merkledag" -) - -// depthRepeat specifies how many times to append a child tree of a -// given depth. Higher values increase the width of a given node, which -// improves seek speeds. -const depthRepeat = 4 - -// Layout builds a new DAG with the trickle format using the provided -// DagBuilderHelper. See the module's description for a more detailed -// explanation. -func Layout(db *h.DagBuilderHelper) (ipld.Node, error) { - newRoot := db.NewFSNodeOverDag(ft.TFile) - root, _, err := fillTrickleRec(db, newRoot, -1) - if err != nil { - return nil, err - } - - return root, db.Add(root) -} - -// fillTrickleRec creates a trickle (sub-)tree with an optional maximum specified depth -// in the case maxDepth is greater than zero, or with unlimited depth otherwise -// (where the DAG builder will signal the end of data to end the function). -func fillTrickleRec(db *h.DagBuilderHelper, node *h.FSNodeOverDag, maxDepth int) (filledNode ipld.Node, nodeFileSize uint64, err error) { - // Always do this, even in the base case - if err := db.FillNodeLayer(node); err != nil { - return nil, 0, err - } - - // For each depth in [1, `maxDepth`) (or without limit if `maxDepth` is -1, - // initial call from `Layout`) add `depthRepeat` sub-graphs of that depth. - for depth := 1; maxDepth == -1 || depth < maxDepth; depth++ { - if db.Done() { - break - // No more data, stop here, posterior append calls will figure out - // where we left off. - } - - for repeatIndex := 0; repeatIndex < depthRepeat && !db.Done(); repeatIndex++ { - - childNode, childFileSize, err := fillTrickleRec(db, db.NewFSNodeOverDag(ft.TFile), depth) - if err != nil { - return nil, 0, err - } - - if err := node.AddChild(childNode, childFileSize, db); err != nil { - return nil, 0, err - } - } - } - - // Get the final `dag.ProtoNode` with the `FSNode` data encoded inside. - filledNode, err = node.Commit() - if err != nil { - return nil, 0, err - } - - return filledNode, node.FileSize(), nil -} - -// Append appends the data in `db` to the dag, using the Trickledag format -func Append(ctx context.Context, basen ipld.Node, db *h.DagBuilderHelper) (out ipld.Node, errOut error) { - base, ok := basen.(*dag.ProtoNode) - if !ok { - return nil, dag.ErrNotProtobuf - } - - // Convert to unixfs node for working with easily - - fsn, err := h.NewFSNFromDag(base) - if err != nil { - return nil, err - } - - // Get depth of this 'tree' - depth, repeatNumber := trickleDepthInfo(fsn, db.Maxlinks()) - if depth == 0 { - // If direct blocks not filled... - if err := db.FillNodeLayer(fsn); err != nil { - return nil, err - } - - if db.Done() { - // TODO: If `FillNodeLayer` stop `Commit`ing this should be - // the place (besides the function end) to call it. - return fsn.GetDagNode() - } - - // If continuing, our depth has increased by one - depth++ - } - - // Last child in this node may not be a full tree, lets fill it up. - if err := appendFillLastChild(ctx, fsn, depth-1, repeatNumber, db); err != nil { - return nil, err - } - - // after appendFillLastChild, our depth is now increased by one - if !db.Done() { - depth++ - } - - // Now, continue filling out tree like normal - for i := depth; !db.Done(); i++ { - for j := 0; j < depthRepeat && !db.Done(); j++ { - nextChild := db.NewFSNodeOverDag(ft.TFile) - childNode, childFileSize, err := fillTrickleRec(db, nextChild, i) - if err != nil { - return nil, err - } - err = fsn.AddChild(childNode, childFileSize, db) - if err != nil { - return nil, err - } - } - } - _, err = fsn.Commit() - if err != nil { - return nil, err - } - return fsn.GetDagNode() -} - -func appendFillLastChild(ctx context.Context, fsn *h.FSNodeOverDag, depth int, repeatNumber int, db *h.DagBuilderHelper) error { - if fsn.NumChildren() <= db.Maxlinks() { - return nil - } - // TODO: Why do we need this check, didn't the caller already take - // care of this? - - // Recursive step, grab last child - last := fsn.NumChildren() - 1 - lastChild, err := fsn.GetChild(ctx, last, db.GetDagServ()) - if err != nil { - return err - } - - // Fill out last child (may not be full tree) - newChild, nchildSize, err := appendRec(ctx, lastChild, db, depth-1) - if err != nil { - return err - } - - // Update changed child in parent node - fsn.RemoveChild(last, db) - filledNode, err := newChild.Commit() - if err != nil { - return err - } - err = fsn.AddChild(filledNode, nchildSize, db) - if err != nil { - return err - } - - // Partially filled depth layer - if repeatNumber != 0 { - for ; repeatNumber < depthRepeat && !db.Done(); repeatNumber++ { - nextChild := db.NewFSNodeOverDag(ft.TFile) - childNode, childFileSize, err := fillTrickleRec(db, nextChild, depth) - if err != nil { - return err - } - - if err := fsn.AddChild(childNode, childFileSize, db); err != nil { - return err - } - } - } - - return nil -} - -// recursive call for Append -func appendRec(ctx context.Context, fsn *h.FSNodeOverDag, db *h.DagBuilderHelper, maxDepth int) (*h.FSNodeOverDag, uint64, error) { - if maxDepth == 0 || db.Done() { - return fsn, fsn.FileSize(), nil - } - - // Get depth of this 'tree' - depth, repeatNumber := trickleDepthInfo(fsn, db.Maxlinks()) - if depth == 0 { - // If direct blocks not filled... - if err := db.FillNodeLayer(fsn); err != nil { - return nil, 0, err - } - depth++ - } - // TODO: Same as `appendFillLastChild`, when is this case possible? - - // If at correct depth, no need to continue - if depth == maxDepth { - return fsn, fsn.FileSize(), nil - } - - if err := appendFillLastChild(ctx, fsn, depth, repeatNumber, db); err != nil { - return nil, 0, err - } - - // after appendFillLastChild, our depth is now increased by one - if !db.Done() { - depth++ - } - - // Now, continue filling out tree like normal - for i := depth; i < maxDepth && !db.Done(); i++ { - for j := 0; j < depthRepeat && !db.Done(); j++ { - nextChild := db.NewFSNodeOverDag(ft.TFile) - childNode, childFileSize, err := fillTrickleRec(db, nextChild, i) - if err != nil { - return nil, 0, err - } - - if err := fsn.AddChild(childNode, childFileSize, db); err != nil { - return nil, 0, err - } - } - } - - return fsn, fsn.FileSize(), nil -} - -// Deduce where we left off in `fillTrickleRec`, returns the `depth` -// with which new sub-graphs were being added and, within that depth, -// in which `repeatNumber` of the total `depthRepeat` we should add. -func trickleDepthInfo(node *h.FSNodeOverDag, maxlinks int) (depth int, repeatNumber int) { - n := node.NumChildren() - - if n < maxlinks { - // We didn't even added the initial `maxlinks` leaf nodes (`FillNodeLayer`). - return 0, 0 - } - - nonLeafChildren := n - maxlinks - // The number of non-leaf child nodes added in `fillTrickleRec` (after - // the `FillNodeLayer` call). - - depth = nonLeafChildren/depthRepeat + 1 - // "Deduplicate" the added `depthRepeat` sub-graphs at each depth - // (rounding it up since we may be on an unfinished depth with less - // than `depthRepeat` sub-graphs). - - repeatNumber = nonLeafChildren % depthRepeat - // What's left after taking full depths of `depthRepeat` sub-graphs - // is the current `repeatNumber` we're at (this fractional part is - // what we rounded up before). - - return -} - -// VerifyParams is used by VerifyTrickleDagStructure -type VerifyParams struct { - Getter ipld.NodeGetter - Direct int - LayerRepeat int - Prefix *cid.Prefix - RawLeaves bool -} - -// VerifyTrickleDagStructure checks that the given dag matches exactly the trickle dag datastructure -// layout -func VerifyTrickleDagStructure(nd ipld.Node, p VerifyParams) error { - return verifyTDagRec(nd, -1, p) -} - -// Recursive call for verifying the structure of a trickledag -func verifyTDagRec(n ipld.Node, depth int, p VerifyParams) error { - codec := cid.DagProtobuf - if depth == 0 { - if len(n.Links()) > 0 { - return errors.New("expected direct block") - } - // zero depth dag is raw data block - switch nd := n.(type) { - case *dag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return err - } - - if fsn.Type() != ft.TRaw { - return errors.New("expected raw block") - } - - if p.RawLeaves { - return errors.New("expected raw leaf, got a protobuf node") - } - case *dag.RawNode: - if !p.RawLeaves { - return errors.New("expected protobuf node as leaf") - } - codec = cid.Raw - default: - return errors.New("expected ProtoNode or RawNode") - } - } - - // verify prefix - if p.Prefix != nil { - prefix := n.Cid().Prefix() - expect := *p.Prefix // make a copy - expect.Codec = uint64(codec) - if codec == cid.Raw && expect.Version == 0 { - expect.Version = 1 - } - if expect.MhLength == -1 { - expect.MhLength = prefix.MhLength - } - if prefix != expect { - return fmt.Errorf("unexpected cid prefix: expected: %v; got %v", expect, prefix) - } - } - - if depth == 0 { - return nil - } - - nd, ok := n.(*dag.ProtoNode) - if !ok { - return errors.New("expected ProtoNode") - } - - // Verify this is a branch node - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return err - } - - if fsn.Type() != ft.TFile { - return fmt.Errorf("expected file as branch node, got: %s", fsn.Type()) - } - - if len(fsn.Data()) > 0 { - return errors.New("branch node should not have data") - } - - for i := 0; i < len(nd.Links()); i++ { - child, err := nd.Links()[i].GetNode(context.TODO(), p.Getter) - if err != nil { - return err - } - - if i < p.Direct { - // Direct blocks - err := verifyTDagRec(child, 0, p) - if err != nil { - return err - } - } else { - // Recursive trickle dags - rdepth := ((i - p.Direct) / p.LayerRepeat) + 1 - if rdepth >= depth && depth > 0 { - return errors.New("child dag was too deep") - } - err := verifyTDagRec(child, rdepth, p) - if err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/ipfs/go-unixfs/io/dagreader.go b/vendor/github.com/ipfs/go-unixfs/io/dagreader.go deleted file mode 100644 index 75fb5c71..00000000 --- a/vendor/github.com/ipfs/go-unixfs/io/dagreader.go +++ /dev/null @@ -1,491 +0,0 @@ -package io - -import ( - "bytes" - "context" - "errors" - "io" - - ipld "github.com/ipfs/go-ipld-format" - mdag "github.com/ipfs/go-merkledag" - unixfs "github.com/ipfs/go-unixfs" -) - -// Common errors -var ( - ErrIsDir = errors.New("this dag node is a directory") - ErrCantReadSymlinks = errors.New("cannot currently read symlinks") - ErrUnkownNodeType = errors.New("unknown node type") -) - -// TODO: Rename the `DagReader` interface, this doesn't read *any* DAG, just -// DAGs with UnixFS node (and it *belongs* to the `unixfs` package). Some -// alternatives: `FileReader`, `UnixFSFileReader`, `UnixFSReader`. - -// A DagReader provides read-only read and seek acess to a unixfs file. -// Different implementations of readers are used for the different -// types of unixfs/protobuf-encoded nodes. -type DagReader interface { - ReadSeekCloser - Size() uint64 - CtxReadFull(context.Context, []byte) (int, error) -} - -// A ReadSeekCloser implements interfaces to read, copy, seek and close. -type ReadSeekCloser interface { - io.Reader - io.Seeker - io.Closer - io.WriterTo -} - -// NewDagReader creates a new reader object that reads the data represented by -// the given node, using the passed in DAGService for data retrieval. -func NewDagReader(ctx context.Context, n ipld.Node, serv ipld.NodeGetter) (DagReader, error) { - var size uint64 - - switch n := n.(type) { - case *mdag.RawNode: - size = uint64(len(n.RawData())) - - case *mdag.ProtoNode: - fsNode, err := unixfs.FSNodeFromBytes(n.Data()) - if err != nil { - return nil, err - } - - switch fsNode.Type() { - case unixfs.TFile, unixfs.TRaw: - size = fsNode.FileSize() - - case unixfs.TDirectory, unixfs.THAMTShard: - // Dont allow reading directories - return nil, ErrIsDir - - case unixfs.TMetadata: - if len(n.Links()) == 0 { - return nil, errors.New("incorrectly formatted metadata object") - } - child, err := n.Links()[0].GetNode(ctx, serv) - if err != nil { - return nil, err - } - - childpb, ok := child.(*mdag.ProtoNode) - if !ok { - return nil, mdag.ErrNotProtobuf - } - return NewDagReader(ctx, childpb, serv) - case unixfs.TSymlink: - return nil, ErrCantReadSymlinks - default: - return nil, unixfs.ErrUnrecognizedType - } - default: - return nil, ErrUnkownNodeType - } - - ctxWithCancel, cancel := context.WithCancel(ctx) - - return &dagReader{ - ctx: ctxWithCancel, - cancel: cancel, - serv: serv, - size: size, - rootNode: n, - dagWalker: ipld.NewWalker(ctxWithCancel, ipld.NewNavigableIPLDNode(n, serv)), - }, nil -} - -// dagReader provides a way to easily read the data contained in a dag. -type dagReader struct { - - // Structure to perform the DAG iteration and search, the reader - // just needs to add logic to the `Visitor` callback passed to - // `Iterate` and `Seek`. - dagWalker *ipld.Walker - - // Buffer with the data extracted from the current node being visited. - // To avoid revisiting a node to complete a (potential) partial read - // (or read after seek) the node's data is fully extracted in a single - // `readNodeDataBuffer` operation. - currentNodeData *bytes.Reader - - // Implements the `Size()` API. - size uint64 - - // Current offset for the read head within the DAG file. - offset int64 - - // Root node of the DAG, stored to re-create the `dagWalker` (effectively - // re-setting the position of the reader, used during `Seek`). - rootNode ipld.Node - - // Context passed to the `dagWalker`, the `cancel` function is used to - // cancel read operations (cancelling requested child node promises, - // see `ipld.NavigableIPLDNode.FetchChild` for details). - ctx context.Context - cancel func() - - // Passed to the `dagWalker` that will use it to request nodes. - // TODO: Revisit name. - serv ipld.NodeGetter -} - -// Size returns the total size of the data from the DAG structured file. -func (dr *dagReader) Size() uint64 { - return dr.size -} - -// Read implements the `io.Reader` interface through the `CtxReadFull` -// method using the DAG reader's internal context. -func (dr *dagReader) Read(b []byte) (int, error) { - return dr.CtxReadFull(dr.ctx, b) -} - -// CtxReadFull reads data from the DAG structured file. It always -// attempts a full read of the DAG until the `out` buffer is full. -// It uses the `Walker` structure to iterate the file DAG and read -// every node's data into the `out` buffer. -func (dr *dagReader) CtxReadFull(ctx context.Context, out []byte) (n int, err error) { - // Set the `dagWalker`'s context to the `ctx` argument, it will be used - // to fetch the child node promises (see - // `ipld.NavigableIPLDNode.FetchChild` for details). - dr.dagWalker.SetContext(ctx) - - // If there was a partially read buffer from the last visited - // node read it before visiting a new one. - if dr.currentNodeData != nil { - // TODO: Move this check inside `readNodeDataBuffer`? - n = dr.readNodeDataBuffer(out) - - if n == len(out) { - return n, nil - // Output buffer full, no need to traverse the DAG. - } - } - - // Iterate the DAG calling the passed `Visitor` function on every node - // to read its data into the `out` buffer, stop if there is an error or - // if the entire DAG is traversed (`EndOfDag`). - err = dr.dagWalker.Iterate(func(visitedNode ipld.NavigableNode) error { - node := ipld.ExtractIPLDNode(visitedNode) - - // Skip internal nodes, they shouldn't have any file data - // (see the `balanced` package for more details). - if len(node.Links()) > 0 { - return nil - } - - err = dr.saveNodeData(node) - if err != nil { - return err - } - // Save the leaf node file data in a buffer in case it is only - // partially read now and future `CtxReadFull` calls reclaim the - // rest (as each node is visited only once during `Iterate`). - // - // TODO: We could check if the entire node's data can fit in the - // remaining `out` buffer free space to skip this intermediary step. - - n += dr.readNodeDataBuffer(out[n:]) - - if n == len(out) { - // Output buffer full, no need to keep traversing the DAG, - // signal the `Walker` to pause the iteration. - dr.dagWalker.Pause() - } - - return nil - }) - - if err == ipld.EndOfDag { - return n, io.EOF - // Reached the end of the (DAG) file, no more data to read. - } else if err != nil { - return n, err - // Pass along any other errors from the `Visitor`. - } - - return n, nil -} - -// Save the UnixFS `node`'s data into the internal `currentNodeData` buffer to -// later move it to the output buffer (`Read`) or seek into it (`Seek`). -func (dr *dagReader) saveNodeData(node ipld.Node) error { - extractedNodeData, err := unixfs.ReadUnixFSNodeData(node) - if err != nil { - return err - } - - dr.currentNodeData = bytes.NewReader(extractedNodeData) - return nil -} - -// Read the `currentNodeData` buffer into `out`. This function can't have -// any errors as it's always reading from a `bytes.Reader` and asking only -// the available data in it. -func (dr *dagReader) readNodeDataBuffer(out []byte) int { - - n, _ := dr.currentNodeData.Read(out) - // Ignore the error as the EOF may not be returned in the first - // `Read` call, explicitly ask for an empty buffer below to check - // if we've reached the end. - - if dr.currentNodeData.Len() == 0 { - dr.currentNodeData = nil - // Signal that the buffer was consumed (for later `Read` calls). - // This shouldn't return an EOF error as it's just the end of a - // single node's data, not the entire DAG. - } - - dr.offset += int64(n) - // TODO: Should `offset` be incremented here or in the calling function? - // (Doing it here saves LoC but may be confusing as it's more hidden). - - return n -} - -// Similar to `readNodeDataBuffer` but it writes the contents to -// an `io.Writer` argument. -// -// TODO: Check what part of the logic between the two functions -// can be extracted away. -func (dr *dagReader) writeNodeDataBuffer(w io.Writer) (int64, error) { - - n, err := dr.currentNodeData.WriteTo(w) - if err != nil { - return n, err - } - - if dr.currentNodeData.Len() == 0 { - dr.currentNodeData = nil - // Signal that the buffer was consumed (for later `Read` calls). - // This shouldn't return an EOF error as it's just the end of a - // single node's data, not the entire DAG. - } - - dr.offset += int64(n) - return n, nil -} - -// WriteTo writes to the given writer. -// This follows the `bytes.Reader.WriteTo` implementation -// where it starts from the internal index that may have -// been modified by other `Read` calls. -// -// TODO: This implementation is very similar to `CtxReadFull`, -// the common parts should be abstracted away. -func (dr *dagReader) WriteTo(w io.Writer) (n int64, err error) { - // Use the internal reader's context to fetch the child node promises - // (see `ipld.NavigableIPLDNode.FetchChild` for details). - dr.dagWalker.SetContext(dr.ctx) - - // If there was a partially read buffer from the last visited - // node read it before visiting a new one. - if dr.currentNodeData != nil { - n, err = dr.writeNodeDataBuffer(w) - if err != nil { - return n, err - } - } - - // Iterate the DAG calling the passed `Visitor` function on every node - // to read its data into the `out` buffer, stop if there is an error or - // if the entire DAG is traversed (`EndOfDag`). - err = dr.dagWalker.Iterate(func(visitedNode ipld.NavigableNode) error { - node := ipld.ExtractIPLDNode(visitedNode) - - // Skip internal nodes, they shouldn't have any file data - // (see the `balanced` package for more details). - if len(node.Links()) > 0 { - return nil - } - - err = dr.saveNodeData(node) - if err != nil { - return err - } - // Save the leaf node file data in a buffer in case it is only - // partially read now and future `CtxReadFull` calls reclaim the - // rest (as each node is visited only once during `Iterate`). - - written, err := dr.writeNodeDataBuffer(w) - n += written - if err != nil { - return err - } - - return nil - }) - - if err == ipld.EndOfDag { - return n, nil - } - - return n, err -} - -// Close the reader (cancelling fetch node operations requested with -// the internal context, that is, `Read` calls but not `CtxReadFull` -// with user-supplied contexts). -func (dr *dagReader) Close() error { - dr.cancel() - return nil -} - -// Seek implements `io.Seeker` seeking to a given offset in the DAG file, -// it matches the standard unix `seek`. It moves the position of the internal -// `dagWalker` and may also leave a `currentNodeData` buffer loaded in case -// the seek is performed to the middle of the data in a node. -// -// TODO: Support seeking from the current position (relative seek) -// through the `dagWalker` in `io.SeekCurrent`. -func (dr *dagReader) Seek(offset int64, whence int) (int64, error) { - switch whence { - case io.SeekStart: - if offset < 0 { - return -1, errors.New("invalid offset") - } - - if offset == dr.offset { - return offset, nil - // Already at the requested `offset`, nothing to do. - } - - left := offset - // Amount left to seek. - - // Seek from the beginning of the DAG. - dr.resetPosition() - - // Use the internal reader's context to fetch the child node promises - // (see `ipld.NavigableIPLDNode.FetchChild` for details). - dr.dagWalker.SetContext(dr.ctx) - // TODO: Performance: we could adjust here `preloadSize` of - // `ipld.NavigableIPLDNode` also, when seeking we only want - // to fetch one child at a time. - - // Seek the DAG by calling the provided `Visitor` function on every - // node the `dagWalker` descends to while searching which can be - // either an internal or leaf node. In the internal node case, check - // the child node sizes and set the corresponding child index to go - // down to next. In the leaf case (last visit of the search), if there - // is still an amount `left` to seek do it inside the node's data - // saved in the `currentNodeData` buffer, leaving it ready for a `Read` - // call. - err := dr.dagWalker.Seek(func(visitedNode ipld.NavigableNode) error { - node := ipld.ExtractIPLDNode(visitedNode) - - if len(node.Links()) > 0 { - // Internal node, should be a `mdag.ProtoNode` containing a - // `unixfs.FSNode` (see the `balanced` package for more details). - fsNode, err := unixfs.ExtractFSNode(node) - if err != nil { - return err - } - - // If there aren't enough size hints don't seek - // (see the `io.EOF` handling error comment below). - if fsNode.NumChildren() != len(node.Links()) { - return io.EOF - } - - // Internal nodes have no data, so just iterate through the - // sizes of its children (advancing the child index of the - // `dagWalker`) to find where we need to go down to next in - // the search. - for { - childSize := fsNode.BlockSize(int(dr.dagWalker.ActiveChildIndex())) - - if childSize > uint64(left) { - // This child's data contains the position requested - // in `offset`, go down this child. - return nil - } - - // Else, skip this child. - left -= int64(childSize) - err := dr.dagWalker.NextChild() - if err == ipld.ErrNextNoChild { - // No more child nodes available, nothing to do, - // the `Seek` will stop on its own. - return nil - } else if err != nil { - return err - // Pass along any other errors (that may in future - // implementations be returned by `Next`) to stop - // the search. - } - } - - } else { - // Leaf node, seek inside its data. - err := dr.saveNodeData(node) - if err != nil { - return err - } - - _, err = dr.currentNodeData.Seek(left, io.SeekStart) - if err != nil { - return err - } - // The corner case of a DAG consisting only of a single (leaf) - // node should make no difference here. In that case, where the - // node doesn't have a parent UnixFS node with size hints, this - // implementation would allow this `Seek` to be called with an - // argument larger than the buffer size which normally wouldn't - // happen (because we would skip the node based on the size - // hint) but that would just mean that a future `CtxReadFull` - // call would read no data from the `currentNodeData` buffer. - // TODO: Re-check this reasoning. - - return nil - // In the leaf node case the search will stop here. - } - }) - - if err == io.EOF { - // TODO: Taken from https://github.com/ipfs/go-ipfs/pull/4320, - // check if still valid. - // Return negative number if we can't figure out the file size. Using io.EOF - // for this seems to be good(-enough) solution as it's only returned by - // precalcNextBuf when we step out of file range. - // This is needed for gateway to function properly - return -1, nil - } - - if err != nil { - return 0, err - } - - dr.offset = offset - return dr.offset, nil - - case io.SeekCurrent: - if offset == 0 { - return dr.offset, nil - } - - return dr.Seek(dr.offset+offset, io.SeekStart) - // TODO: Performance. This can be improved supporting relative - // searches in the `Walker` (see `Walker.Seek`). - - case io.SeekEnd: - return dr.Seek(int64(dr.Size())+offset, io.SeekStart) - - default: - return 0, errors.New("invalid whence") - } -} - -// Reset the reader position by resetting the `dagWalker` and discarding -// any partially used node's data in the `currentNodeData` buffer, used -// in the `SeekStart` case. -func (dr *dagReader) resetPosition() { - dr.currentNodeData = nil - - dr.dagWalker = ipld.NewWalker(dr.ctx, ipld.NewNavigableIPLDNode(dr.rootNode, dr.serv)) - // TODO: This could be avoided (along with storing the `dr.rootNode` and - // `dr.serv` just for this call) if `Reset` is supported in the `Walker`. -} diff --git a/vendor/github.com/ipfs/go-unixfs/io/directory.go b/vendor/github.com/ipfs/go-unixfs/io/directory.go deleted file mode 100644 index 2e022762..00000000 --- a/vendor/github.com/ipfs/go-unixfs/io/directory.go +++ /dev/null @@ -1,288 +0,0 @@ -package io - -import ( - "context" - "fmt" - "os" - - mdag "github.com/ipfs/go-merkledag" - - format "github.com/ipfs/go-unixfs" - hamt "github.com/ipfs/go-unixfs/hamt" - - cid "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// UseHAMTSharding is a global flag that signifies whether or not to use the -// HAMT sharding scheme for directory creation -var UseHAMTSharding = false - -// DefaultShardWidth is the default value used for hamt sharding width. -var DefaultShardWidth = 256 - -// Directory defines a UnixFS directory. It is used for creating, reading and -// editing directories. It allows to work with different directory schemes, -// like the basic or the HAMT implementation. -// -// It just allows to perform explicit edits on a single directory, working with -// directory trees is out of its scope, they are managed by the MFS layer -// (which is the main consumer of this interface). -type Directory interface { - - // SetCidBuilder sets the CID Builder of the root node. - SetCidBuilder(cid.Builder) - - // AddChild adds a (name, key) pair to the root node. - AddChild(context.Context, string, ipld.Node) error - - // ForEachLink applies the given function to Links in the directory. - ForEachLink(context.Context, func(*ipld.Link) error) error - - // EnumLinksAsync returns a channel which will receive Links in the directory - // as they are enumerated, where order is not gauranteed - EnumLinksAsync(context.Context) <-chan format.LinkResult - - // Links returns the all the links in the directory node. - Links(context.Context) ([]*ipld.Link, error) - - // Find returns the root node of the file named 'name' within this directory. - // In the case of HAMT-directories, it will traverse the tree. - Find(context.Context, string) (ipld.Node, error) - - // RemoveChild removes the child with the given name. - RemoveChild(context.Context, string) error - - // GetNode returns the root of this directory. - GetNode() (ipld.Node, error) - - // GetCidBuilder returns the CID Builder used. - GetCidBuilder() cid.Builder -} - -// TODO: Evaluate removing `dserv` from this layer and providing it in MFS. -// (The functions should in that case add a `DAGService` argument.) - -// BasicDirectory is the basic implementation of `Directory`. All the entries -// are stored in a single node. -type BasicDirectory struct { - node *mdag.ProtoNode - dserv ipld.DAGService -} - -// HAMTDirectory is the HAMT implementation of `Directory`. -// (See package `hamt` for more information.) -type HAMTDirectory struct { - shard *hamt.Shard - dserv ipld.DAGService -} - -// NewDirectory returns a Directory. It needs a `DAGService` to add the children. -func NewDirectory(dserv ipld.DAGService) Directory { - if UseHAMTSharding { - dir := new(HAMTDirectory) - s, err := hamt.NewShard(dserv, DefaultShardWidth) - if err != nil { - panic(err) // will only panic if DefaultShardWidth is a bad value - } - dir.shard = s - dir.dserv = dserv - return dir - } - - dir := new(BasicDirectory) - dir.node = format.EmptyDirNode() - dir.dserv = dserv - return dir -} - -// ErrNotADir implies that the given node was not a unixfs directory -var ErrNotADir = fmt.Errorf("merkledag node was not a directory or shard") - -// NewDirectoryFromNode loads a unixfs directory from the given IPLD node and -// DAGService. -func NewDirectoryFromNode(dserv ipld.DAGService, node ipld.Node) (Directory, error) { - protoBufNode, ok := node.(*mdag.ProtoNode) - if !ok { - return nil, ErrNotADir - } - - fsNode, err := format.FSNodeFromBytes(protoBufNode.Data()) - if err != nil { - return nil, err - } - - switch fsNode.Type() { - case format.TDirectory: - return &BasicDirectory{ - dserv: dserv, - node: protoBufNode.Copy().(*mdag.ProtoNode), - }, nil - case format.THAMTShard: - shard, err := hamt.NewHamtFromDag(dserv, node) - if err != nil { - return nil, err - } - return &HAMTDirectory{ - dserv: dserv, - shard: shard, - }, nil - } - - return nil, ErrNotADir -} - -// SetCidBuilder implements the `Directory` interface. -func (d *BasicDirectory) SetCidBuilder(builder cid.Builder) { - d.node.SetCidBuilder(builder) -} - -// AddChild implements the `Directory` interface. It adds (or replaces) -// a link to the given `node` under `name`. -func (d *BasicDirectory) AddChild(ctx context.Context, name string, node ipld.Node) error { - d.node.RemoveNodeLink(name) - // Remove old link (if it existed), don't check a potential `ErrNotFound`. - - return d.node.AddNodeLink(name, node) -} - -// EnumLinksAsync returns a channel which will receive Links in the directory -// as they are enumerated, where order is not gauranteed -func (d *BasicDirectory) EnumLinksAsync(ctx context.Context) <-chan format.LinkResult { - linkResults := make(chan format.LinkResult) - go func() { - defer close(linkResults) - for _, l := range d.node.Links() { - select { - case linkResults <- format.LinkResult{ - Link: l, - Err: nil, - }: - case <-ctx.Done(): - return - } - } - }() - return linkResults -} - -// ForEachLink implements the `Directory` interface. -func (d *BasicDirectory) ForEachLink(ctx context.Context, f func(*ipld.Link) error) error { - for _, l := range d.node.Links() { - if err := f(l); err != nil { - return err - } - } - return nil -} - -// Links implements the `Directory` interface. -func (d *BasicDirectory) Links(ctx context.Context) ([]*ipld.Link, error) { - return d.node.Links(), nil -} - -// Find implements the `Directory` interface. -func (d *BasicDirectory) Find(ctx context.Context, name string) (ipld.Node, error) { - lnk, err := d.node.GetNodeLink(name) - if err == mdag.ErrLinkNotFound { - err = os.ErrNotExist - } - if err != nil { - return nil, err - } - - return d.dserv.Get(ctx, lnk.Cid) -} - -// RemoveChild implements the `Directory` interface. -func (d *BasicDirectory) RemoveChild(ctx context.Context, name string) error { - return d.node.RemoveNodeLink(name) -} - -// GetNode implements the `Directory` interface. -func (d *BasicDirectory) GetNode() (ipld.Node, error) { - return d.node, nil -} - -// GetCidBuilder implements the `Directory` interface. -func (d *BasicDirectory) GetCidBuilder() cid.Builder { - return d.node.CidBuilder() -} - -// SwitchToSharding returns a HAMT implementation of this directory. -func (d *BasicDirectory) SwitchToSharding(ctx context.Context) (Directory, error) { - hamtDir := new(HAMTDirectory) - hamtDir.dserv = d.dserv - - shard, err := hamt.NewShard(d.dserv, DefaultShardWidth) - if err != nil { - return nil, err - } - shard.SetCidBuilder(d.node.CidBuilder()) - hamtDir.shard = shard - - for _, lnk := range d.node.Links() { - node, err := d.dserv.Get(ctx, lnk.Cid) - if err != nil { - return nil, err - } - - err = hamtDir.shard.Set(ctx, lnk.Name, node) - if err != nil { - return nil, err - } - } - - return hamtDir, nil -} - -// SetCidBuilder implements the `Directory` interface. -func (d *HAMTDirectory) SetCidBuilder(builder cid.Builder) { - d.shard.SetCidBuilder(builder) -} - -// AddChild implements the `Directory` interface. -func (d *HAMTDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error { - return d.shard.Set(ctx, name, nd) -} - -// ForEachLink implements the `Directory` interface. -func (d *HAMTDirectory) ForEachLink(ctx context.Context, f func(*ipld.Link) error) error { - return d.shard.ForEachLink(ctx, f) -} - -// EnumLinksAsync returns a channel which will receive Links in the directory -// as they are enumerated, where order is not gauranteed -func (d *HAMTDirectory) EnumLinksAsync(ctx context.Context) <-chan format.LinkResult { - return d.shard.EnumLinksAsync(ctx) -} - -// Links implements the `Directory` interface. -func (d *HAMTDirectory) Links(ctx context.Context) ([]*ipld.Link, error) { - return d.shard.EnumLinks(ctx) -} - -// Find implements the `Directory` interface. It will traverse the tree. -func (d *HAMTDirectory) Find(ctx context.Context, name string) (ipld.Node, error) { - lnk, err := d.shard.Find(ctx, name) - if err != nil { - return nil, err - } - - return lnk.GetNode(ctx, d.dserv) -} - -// RemoveChild implements the `Directory` interface. -func (d *HAMTDirectory) RemoveChild(ctx context.Context, name string) error { - return d.shard.Remove(ctx, name) -} - -// GetNode implements the `Directory` interface. -func (d *HAMTDirectory) GetNode() (ipld.Node, error) { - return d.shard.Node() -} - -// GetCidBuilder implements the `Directory` interface. -func (d *HAMTDirectory) GetCidBuilder() cid.Builder { - return d.shard.CidBuilder() -} diff --git a/vendor/github.com/ipfs/go-unixfs/io/doc.go b/vendor/github.com/ipfs/go-unixfs/io/doc.go deleted file mode 100644 index cf844bd2..00000000 --- a/vendor/github.com/ipfs/go-unixfs/io/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package io implements convenience objects for working with the ipfs -// unixfs data format. -package io diff --git a/vendor/github.com/ipfs/go-unixfs/io/resolve.go b/vendor/github.com/ipfs/go-unixfs/io/resolve.go deleted file mode 100644 index c3dcffc2..00000000 --- a/vendor/github.com/ipfs/go-unixfs/io/resolve.go +++ /dev/null @@ -1,41 +0,0 @@ -package io - -import ( - "context" - - dag "github.com/ipfs/go-merkledag" - ft "github.com/ipfs/go-unixfs" - hamt "github.com/ipfs/go-unixfs/hamt" - - ipld "github.com/ipfs/go-ipld-format" -) - -// ResolveUnixfsOnce resolves a single hop of a path through a graph in a -// unixfs context. This includes handling traversing sharded directories. -func ResolveUnixfsOnce(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, names []string) (*ipld.Link, []string, error) { - pn, ok := nd.(*dag.ProtoNode) - if ok { - fsn, err := ft.FSNodeFromBytes(pn.Data()) - if err != nil { - // Not a unixfs node, use standard object traversal code - return nd.ResolveLink(names) - } - - if fsn.Type() == ft.THAMTShard { - rods := dag.NewReadOnlyDagService(ds) - s, err := hamt.NewHamtFromDag(rods, nd) - if err != nil { - return nil, nil, err - } - - out, err := s.Find(ctx, names[0]) - if err != nil { - return nil, nil, err - } - - return out, names[1:], nil - } - } - - return nd.ResolveLink(names) -} diff --git a/vendor/github.com/ipfs/go-unixfs/mod/dagmodifier.go b/vendor/github.com/ipfs/go-unixfs/mod/dagmodifier.go deleted file mode 100644 index 1e2b2dcc..00000000 --- a/vendor/github.com/ipfs/go-unixfs/mod/dagmodifier.go +++ /dev/null @@ -1,605 +0,0 @@ -// Package mod provides DAG modification utilities to, for example, -// insert additional nodes in a unixfs DAG or truncate them. -package mod - -import ( - "bytes" - "context" - "errors" - "io" - - ft "github.com/ipfs/go-unixfs" - help "github.com/ipfs/go-unixfs/importer/helpers" - trickle "github.com/ipfs/go-unixfs/importer/trickle" - uio "github.com/ipfs/go-unixfs/io" - - cid "github.com/ipfs/go-cid" - chunker "github.com/ipfs/go-ipfs-chunker" - ipld "github.com/ipfs/go-ipld-format" - mdag "github.com/ipfs/go-merkledag" -) - -// Common errors -var ( - ErrSeekFail = errors.New("failed to seek properly") - ErrUnrecognizedWhence = errors.New("unrecognized whence") - ErrNotUnixfs = errors.New("dagmodifier only supports unixfs nodes (proto or raw)") -) - -// 2MB -var writebufferSize = 1 << 21 - -// DagModifier is the only struct licensed and able to correctly -// perform surgery on a DAG 'file' -// Dear god, please rename this to something more pleasant -type DagModifier struct { - dagserv ipld.DAGService - curNode ipld.Node - - splitter chunker.SplitterGen - ctx context.Context - readCancel func() - - writeStart uint64 - curWrOff uint64 - wrBuf *bytes.Buffer - - Prefix cid.Prefix - RawLeaves bool - - read uio.DagReader -} - -// NewDagModifier returns a new DagModifier, the Cid prefix for newly -// created nodes will be inhered from the passed in node. If the Cid -// version if not 0 raw leaves will also be enabled. The Prefix and -// RawLeaves options can be overridden by changing them after the call. -func NewDagModifier(ctx context.Context, from ipld.Node, serv ipld.DAGService, spl chunker.SplitterGen) (*DagModifier, error) { - switch from.(type) { - case *mdag.ProtoNode, *mdag.RawNode: - // ok - default: - return nil, ErrNotUnixfs - } - - prefix := from.Cid().Prefix() - prefix.Codec = cid.DagProtobuf - rawLeaves := false - if prefix.Version > 0 { - rawLeaves = true - } - - return &DagModifier{ - curNode: from.Copy(), - dagserv: serv, - splitter: spl, - ctx: ctx, - Prefix: prefix, - RawLeaves: rawLeaves, - }, nil -} - -// WriteAt will modify a dag file in place -func (dm *DagModifier) WriteAt(b []byte, offset int64) (int, error) { - // TODO: this is currently VERY inefficient - // each write that happens at an offset other than the current one causes a - // flush to disk, and dag rewrite - if offset == int64(dm.writeStart) && dm.wrBuf != nil { - // If we would overwrite the previous write - if len(b) >= dm.wrBuf.Len() { - dm.wrBuf.Reset() - } - } else if uint64(offset) != dm.curWrOff { - size, err := dm.Size() - if err != nil { - return 0, err - } - if offset > size { - err := dm.expandSparse(offset - size) - if err != nil { - return 0, err - } - } - - err = dm.Sync() - if err != nil { - return 0, err - } - dm.writeStart = uint64(offset) - } - - return dm.Write(b) -} - -// A reader that just returns zeros -type zeroReader struct{} - -func (zr zeroReader) Read(b []byte) (int, error) { - for i := range b { - b[i] = 0 - } - return len(b), nil -} - -// expandSparse grows the file with zero blocks of 4096 -// A small blocksize is chosen to aid in deduplication -func (dm *DagModifier) expandSparse(size int64) error { - r := io.LimitReader(zeroReader{}, size) - spl := chunker.NewSizeSplitter(r, 4096) - nnode, err := dm.appendData(dm.curNode, spl) - if err != nil { - return err - } - err = dm.dagserv.Add(dm.ctx, nnode) - return err -} - -// Write continues writing to the dag at the current offset -func (dm *DagModifier) Write(b []byte) (int, error) { - if dm.read != nil { - dm.read = nil - } - if dm.wrBuf == nil { - dm.wrBuf = new(bytes.Buffer) - } - - n, err := dm.wrBuf.Write(b) - if err != nil { - return n, err - } - dm.curWrOff += uint64(n) - if dm.wrBuf.Len() > writebufferSize { - err := dm.Sync() - if err != nil { - return n, err - } - } - return n, nil -} - -// Size returns the Filesize of the node -func (dm *DagModifier) Size() (int64, error) { - fileSize, err := fileSize(dm.curNode) - if err != nil { - return 0, err - } - if dm.wrBuf != nil && int64(dm.wrBuf.Len())+int64(dm.writeStart) > int64(fileSize) { - return int64(dm.wrBuf.Len()) + int64(dm.writeStart), nil - } - return int64(fileSize), nil -} - -func fileSize(n ipld.Node) (uint64, error) { - switch nd := n.(type) { - case *mdag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return 0, err - } - return fsn.FileSize(), nil - case *mdag.RawNode: - return uint64(len(nd.RawData())), nil - default: - return 0, ErrNotUnixfs - } -} - -// Sync writes changes to this dag to disk -func (dm *DagModifier) Sync() error { - // No buffer? Nothing to do - if dm.wrBuf == nil { - return nil - } - - // If we have an active reader, kill it - if dm.read != nil { - dm.read = nil - dm.readCancel() - } - - // Number of bytes we're going to write - buflen := dm.wrBuf.Len() - - fs, err := fileSize(dm.curNode) - if err != nil { - return err - } - if fs < dm.writeStart { - if err := dm.expandSparse(int64(dm.writeStart - fs)); err != nil { - return err - } - } - - // overwrite existing dag nodes - thisc, err := dm.modifyDag(dm.curNode, dm.writeStart) - if err != nil { - return err - } - - dm.curNode, err = dm.dagserv.Get(dm.ctx, thisc) - if err != nil { - return err - } - - // need to write past end of current dag - if dm.wrBuf.Len() > 0 { - dm.curNode, err = dm.appendData(dm.curNode, dm.splitter(dm.wrBuf)) - if err != nil { - return err - } - - err = dm.dagserv.Add(dm.ctx, dm.curNode) - if err != nil { - return err - } - } - - dm.writeStart += uint64(buflen) - dm.wrBuf = nil - - return nil -} - -// modifyDag writes the data in 'dm.wrBuf' over the data in 'node' starting at 'offset' -// returns the new key of the passed in node. -func (dm *DagModifier) modifyDag(n ipld.Node, offset uint64) (cid.Cid, error) { - // If we've reached a leaf node. - if len(n.Links()) == 0 { - switch nd0 := n.(type) { - case *mdag.ProtoNode: - fsn, err := ft.FSNodeFromBytes(nd0.Data()) - if err != nil { - return cid.Cid{}, err - } - - _, err = dm.wrBuf.Read(fsn.Data()[offset:]) - if err != nil && err != io.EOF { - return cid.Cid{}, err - } - - // Update newly written node.. - b, err := fsn.GetBytes() - if err != nil { - return cid.Cid{}, err - } - - nd := new(mdag.ProtoNode) - nd.SetData(b) - nd.SetCidBuilder(nd0.CidBuilder()) - err = dm.dagserv.Add(dm.ctx, nd) - if err != nil { - return cid.Cid{}, err - } - - return nd.Cid(), nil - case *mdag.RawNode: - origData := nd0.RawData() - bytes := make([]byte, len(origData)) - - // copy orig data up to offset - copy(bytes, origData[:offset]) - - // copy in new data - n, err := dm.wrBuf.Read(bytes[offset:]) - if err != nil && err != io.EOF { - return cid.Cid{}, err - } - - // copy remaining data - offsetPlusN := int(offset) + n - if offsetPlusN < len(origData) { - copy(bytes[offsetPlusN:], origData[offsetPlusN:]) - } - - nd, err := mdag.NewRawNodeWPrefix(bytes, nd0.Cid().Prefix()) - if err != nil { - return cid.Cid{}, err - } - err = dm.dagserv.Add(dm.ctx, nd) - if err != nil { - return cid.Cid{}, err - } - - return nd.Cid(), nil - } - } - - node, ok := n.(*mdag.ProtoNode) - if !ok { - return cid.Cid{}, ErrNotUnixfs - } - - fsn, err := ft.FSNodeFromBytes(node.Data()) - if err != nil { - return cid.Cid{}, err - } - - var cur uint64 - for i, bs := range fsn.BlockSizes() { - // We found the correct child to write into - if cur+bs > offset { - child, err := node.Links()[i].GetNode(dm.ctx, dm.dagserv) - if err != nil { - return cid.Cid{}, err - } - - k, err := dm.modifyDag(child, offset-cur) - if err != nil { - return cid.Cid{}, err - } - - node.Links()[i].Cid = k - - // Recache serialized node - _, err = node.EncodeProtobuf(true) - if err != nil { - return cid.Cid{}, err - } - - if dm.wrBuf.Len() == 0 { - // No more bytes to write! - break - } - offset = cur + bs - } - cur += bs - } - - err = dm.dagserv.Add(dm.ctx, node) - return node.Cid(), err -} - -// appendData appends the blocks from the given chan to the end of this dag -func (dm *DagModifier) appendData(nd ipld.Node, spl chunker.Splitter) (ipld.Node, error) { - switch nd := nd.(type) { - case *mdag.ProtoNode, *mdag.RawNode: - dbp := &help.DagBuilderParams{ - Dagserv: dm.dagserv, - Maxlinks: help.DefaultLinksPerBlock, - CidBuilder: dm.Prefix, - RawLeaves: dm.RawLeaves, - } - db, err := dbp.New(spl) - if err != nil { - return nil, err - } - return trickle.Append(dm.ctx, nd, db) - default: - return nil, ErrNotUnixfs - } -} - -// Read data from this dag starting at the current offset -func (dm *DagModifier) Read(b []byte) (int, error) { - err := dm.readPrep() - if err != nil { - return 0, err - } - - n, err := dm.read.Read(b) - dm.curWrOff += uint64(n) - return n, err -} - -func (dm *DagModifier) readPrep() error { - err := dm.Sync() - if err != nil { - return err - } - - if dm.read == nil { - ctx, cancel := context.WithCancel(dm.ctx) - dr, err := uio.NewDagReader(ctx, dm.curNode, dm.dagserv) - if err != nil { - cancel() - return err - } - - i, err := dr.Seek(int64(dm.curWrOff), io.SeekStart) - if err != nil { - cancel() - return err - } - - if i != int64(dm.curWrOff) { - cancel() - return ErrSeekFail - } - - dm.readCancel = cancel - dm.read = dr - } - - return nil -} - -// CtxReadFull reads data from this dag starting at the current offset -func (dm *DagModifier) CtxReadFull(ctx context.Context, b []byte) (int, error) { - err := dm.readPrep() - if err != nil { - return 0, err - } - - n, err := dm.read.CtxReadFull(ctx, b) - dm.curWrOff += uint64(n) - return n, err -} - -// GetNode gets the modified DAG Node -func (dm *DagModifier) GetNode() (ipld.Node, error) { - err := dm.Sync() - if err != nil { - return nil, err - } - return dm.curNode.Copy(), nil -} - -// HasChanges returned whether or not there are unflushed changes to this dag -func (dm *DagModifier) HasChanges() bool { - return dm.wrBuf != nil -} - -// Seek modifies the offset according to whence. See unixfs/io for valid whence -// values. -func (dm *DagModifier) Seek(offset int64, whence int) (int64, error) { - err := dm.Sync() - if err != nil { - return 0, err - } - - fisize, err := dm.Size() - if err != nil { - return 0, err - } - - var newoffset uint64 - switch whence { - case io.SeekCurrent: - newoffset = dm.curWrOff + uint64(offset) - case io.SeekStart: - newoffset = uint64(offset) - case io.SeekEnd: - newoffset = uint64(fisize) - uint64(offset) - default: - return 0, ErrUnrecognizedWhence - } - - if int64(newoffset) > fisize { - if err := dm.expandSparse(int64(newoffset) - fisize); err != nil { - return 0, err - } - } - dm.curWrOff = newoffset - dm.writeStart = newoffset - - if dm.read != nil { - _, err = dm.read.Seek(offset, whence) - if err != nil { - return 0, err - } - } - - return int64(dm.curWrOff), nil -} - -// Truncate truncates the current Node to 'size' and replaces it with the -// new one. -func (dm *DagModifier) Truncate(size int64) error { - err := dm.Sync() - if err != nil { - return err - } - - realSize, err := dm.Size() - if err != nil { - return err - } - if size == int64(realSize) { - return nil - } - - // Truncate can also be used to expand the file - if size > int64(realSize) { - return dm.expandSparse(int64(size) - realSize) - } - - nnode, err := dm.dagTruncate(dm.ctx, dm.curNode, uint64(size)) - if err != nil { - return err - } - - err = dm.dagserv.Add(dm.ctx, nnode) - if err != nil { - return err - } - - dm.curNode = nnode - return nil -} - -// dagTruncate truncates the given node to 'size' and returns the modified Node -func (dm *DagModifier) dagTruncate(ctx context.Context, n ipld.Node, size uint64) (ipld.Node, error) { - if len(n.Links()) == 0 { - switch nd := n.(type) { - case *mdag.ProtoNode: - // TODO: this can likely be done without marshaling and remarshaling - fsn, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return nil, err - } - nd.SetData(ft.WrapData(fsn.Data()[:size])) - return nd, nil - case *mdag.RawNode: - return mdag.NewRawNodeWPrefix(nd.RawData()[:size], nd.Cid().Prefix()) - } - } - - nd, ok := n.(*mdag.ProtoNode) - if !ok { - return nil, ErrNotUnixfs - } - - var cur uint64 - end := 0 - var modified ipld.Node - ndata, err := ft.FSNodeFromBytes(nd.Data()) - if err != nil { - return nil, err - } - // Reset the block sizes of the node to adjust them - // with the new values of the truncated children. - ndata.RemoveAllBlockSizes() - for i, lnk := range nd.Links() { - child, err := lnk.GetNode(ctx, dm.dagserv) - if err != nil { - return nil, err - } - - childsize, err := fileSize(child) - if err != nil { - return nil, err - } - - // found the child we want to cut - if size < cur+childsize { - nchild, err := dm.dagTruncate(ctx, child, size-cur) - if err != nil { - return nil, err - } - - ndata.AddBlockSize(size - cur) - - modified = nchild - end = i - break - } - cur += childsize - ndata.AddBlockSize(childsize) - } - - err = dm.dagserv.Add(ctx, modified) - if err != nil { - return nil, err - } - - nd.SetLinks(nd.Links()[:end]) - err = nd.AddNodeLink("", modified) - if err != nil { - return nil, err - } - - d, err := ndata.GetBytes() - if err != nil { - return nil, err - } - // Save the new block sizes to the original node. - nd.SetData(d) - - // invalidate cache and recompute serialized data - _, err = nd.EncodeProtobuf(true) - if err != nil { - return nil, err - } - - return nd, nil -} diff --git a/vendor/github.com/ipfs/go-unixfs/package.json b/vendor/github.com/ipfs/go-unixfs/package.json deleted file mode 100644 index 4d20bf8c..00000000 --- a/vendor/github.com/ipfs/go-unixfs/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "author": "why", - "bugs": { - "url": "https://github.com/ipfs/go-unixfs" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-unixfs" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmfJHywXQu98UeZtGJBQrPAR6AtmDjjbe3qjTo9piXHPnx", - "name": "murmur3", - "version": "0.0.0" - }, - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "why", - "hash": "QmY6UwsN3D6uoxrRkYpJ8Wos8R66gwLmdn3wy7jM7CCRQ1", - "name": "go-merkledag", - "version": "1.1.40" - }, - { - "author": "hector", - "hash": "QmdiZuFuiFD1Gbuu8PdqmsfrCR3z4QKSR2bN1NAvnJgTY7", - "name": "go-ipfs-posinfo", - "version": "0.1.5" - }, - { - "author": "Stebalien", - "hash": "QmVA2fUfgswyFdhZZA3MvUtfwTS7TER4Hv4vSBLvoQu1QZ", - "name": "go-bitfield", - "version": "0.1.3" - }, - { - "author": "hsanjuan", - "hash": "QmYmZ81dU5nnmBFy5MmktXLZpt8QCWhRJd6M1uxVF6vke8", - "name": "go-ipfs-chunker", - "version": "0.1.6" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - }, - { - "author": "whyrusleeping", - "hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB", - "name": "gogo-protobuf", - "version": "1.2.1" - }, - { - "author": "whyrusleeping", - "hash": "QmZ6nzCLwGLVfRzYLpD7pW6UNuBDKEcA2imJtVpbEx2rxy", - "name": "go-ipld-format", - "version": "0.8.1" - }, - { - "author": "magik6k", - "hash": "QmRHcZ5ngUxZo8phLR3fpoqk9wA7VdGc5mhwkGSnB2nZ9F", - "name": "go-ipfs-files", - "version": "2.0.7" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-unixfs", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.3.15" -} - diff --git a/vendor/github.com/ipfs/go-unixfs/pb/Makefile b/vendor/github.com/ipfs/go-unixfs/pb/Makefile deleted file mode 100644 index 51552a09..00000000 --- a/vendor/github.com/ipfs/go-unixfs/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogo_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/ipfs/go-unixfs/pb/unixfs.pb.go b/vendor/github.com/ipfs/go-unixfs/pb/unixfs.pb.go deleted file mode 100644 index 6f1c8fe8..00000000 --- a/vendor/github.com/ipfs/go-unixfs/pb/unixfs.pb.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: unixfs.proto - -package unixfs_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Data_DataType int32 - -const ( - Data_Raw Data_DataType = 0 - Data_Directory Data_DataType = 1 - Data_File Data_DataType = 2 - Data_Metadata Data_DataType = 3 - Data_Symlink Data_DataType = 4 - Data_HAMTShard Data_DataType = 5 -) - -var Data_DataType_name = map[int32]string{ - 0: "Raw", - 1: "Directory", - 2: "File", - 3: "Metadata", - 4: "Symlink", - 5: "HAMTShard", -} - -var Data_DataType_value = map[string]int32{ - "Raw": 0, - "Directory": 1, - "File": 2, - "Metadata": 3, - "Symlink": 4, - "HAMTShard": 5, -} - -func (x Data_DataType) Enum() *Data_DataType { - p := new(Data_DataType) - *p = x - return p -} - -func (x Data_DataType) String() string { - return proto.EnumName(Data_DataType_name, int32(x)) -} - -func (x *Data_DataType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Data_DataType_value, data, "Data_DataType") - if err != nil { - return err - } - *x = Data_DataType(value) - return nil -} - -func (Data_DataType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{0, 0} -} - -type Data struct { - Type *Data_DataType `protobuf:"varint,1,req,name=Type,enum=unixfs.pb.Data_DataType" json:"Type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data" json:"Data,omitempty"` - Filesize *uint64 `protobuf:"varint,3,opt,name=filesize" json:"filesize,omitempty"` - Blocksizes []uint64 `protobuf:"varint,4,rep,name=blocksizes" json:"blocksizes,omitempty"` - HashType *uint64 `protobuf:"varint,5,opt,name=hashType" json:"hashType,omitempty"` - Fanout *uint64 `protobuf:"varint,6,opt,name=fanout" json:"fanout,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Data) Reset() { *m = Data{} } -func (m *Data) String() string { return proto.CompactTextString(m) } -func (*Data) ProtoMessage() {} -func (*Data) Descriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{0} -} -func (m *Data) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Data.Unmarshal(m, b) -} -func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Data.Marshal(b, m, deterministic) -} -func (m *Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_Data.Merge(m, src) -} -func (m *Data) XXX_Size() int { - return xxx_messageInfo_Data.Size(m) -} -func (m *Data) XXX_DiscardUnknown() { - xxx_messageInfo_Data.DiscardUnknown(m) -} - -var xxx_messageInfo_Data proto.InternalMessageInfo - -func (m *Data) GetType() Data_DataType { - if m != nil && m.Type != nil { - return *m.Type - } - return Data_Raw -} - -func (m *Data) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *Data) GetFilesize() uint64 { - if m != nil && m.Filesize != nil { - return *m.Filesize - } - return 0 -} - -func (m *Data) GetBlocksizes() []uint64 { - if m != nil { - return m.Blocksizes - } - return nil -} - -func (m *Data) GetHashType() uint64 { - if m != nil && m.HashType != nil { - return *m.HashType - } - return 0 -} - -func (m *Data) GetFanout() uint64 { - if m != nil && m.Fanout != nil { - return *m.Fanout - } - return 0 -} - -type Metadata struct { - MimeType *string `protobuf:"bytes,1,opt,name=MimeType" json:"MimeType,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{1} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Metadata.Unmarshal(m, b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) -} -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return xxx_messageInfo_Metadata.Size(m) -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetMimeType() string { - if m != nil && m.MimeType != nil { - return *m.MimeType - } - return "" -} - -func init() { - proto.RegisterEnum("unixfs.pb.Data_DataType", Data_DataType_name, Data_DataType_value) - proto.RegisterType((*Data)(nil), "unixfs.pb.Data") - proto.RegisterType((*Metadata)(nil), "unixfs.pb.Metadata") -} - -func init() { proto.RegisterFile("unixfs.proto", fileDescriptor_e2fd76cc44dfc7c3) } - -var fileDescriptor_e2fd76cc44dfc7c3 = []byte{ - // 254 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xb1, 0x6a, 0xeb, 0x30, - 0x18, 0x85, 0xaf, 0x6c, 0x25, 0xb1, 0xff, 0xeb, 0x16, 0xf1, 0x0f, 0x45, 0x74, 0x28, 0xc6, 0x43, - 0xd1, 0x50, 0x3c, 0xf4, 0x0d, 0x0a, 0xa1, 0x74, 0xf1, 0xa2, 0x84, 0xee, 0x4a, 0x22, 0x63, 0x11, - 0xc7, 0x0a, 0xb6, 0x42, 0xeb, 0x3e, 0x45, 0x1f, 0xb9, 0xc8, 0x8e, 0xdd, 0x2e, 0x82, 0x4f, 0xe7, - 0x7c, 0xe2, 0x20, 0x48, 0x2e, 0x8d, 0xf9, 0x2c, 0xbb, 0xfc, 0xdc, 0x5a, 0x67, 0x31, 0x9e, 0x68, - 0x97, 0x7d, 0x07, 0x40, 0xd7, 0xca, 0x29, 0x7c, 0x02, 0xba, 0xed, 0xcf, 0x9a, 0x93, 0x34, 0x10, - 0xb7, 0xcf, 0x3c, 0x9f, 0x2b, 0xb9, 0x8f, 0x87, 0xc3, 0xe7, 0x72, 0x68, 0x21, 0x8e, 0x16, 0x0f, - 0x52, 0x22, 0x12, 0x39, 0xbe, 0x70, 0x0f, 0x51, 0x69, 0x6a, 0xdd, 0x99, 0x2f, 0xcd, 0xc3, 0x94, - 0x08, 0x2a, 0x67, 0xc6, 0x07, 0x80, 0x5d, 0x6d, 0xf7, 0x47, 0x0f, 0x1d, 0xa7, 0x69, 0x28, 0xa8, - 0xfc, 0x73, 0xe3, 0xdd, 0x4a, 0x75, 0xd5, 0xb0, 0x60, 0x31, 0xba, 0x13, 0xe3, 0x1d, 0x2c, 0x4b, - 0xd5, 0xd8, 0x8b, 0xe3, 0xcb, 0x21, 0xb9, 0x52, 0xf6, 0x0e, 0xd1, 0xb4, 0x0a, 0x57, 0x10, 0x4a, - 0xf5, 0xc1, 0xfe, 0xe1, 0x0d, 0xc4, 0x6b, 0xd3, 0xea, 0xbd, 0xb3, 0x6d, 0xcf, 0x08, 0x46, 0x40, - 0x5f, 0x4d, 0xad, 0x59, 0x80, 0x09, 0x44, 0x85, 0x76, 0xea, 0xa0, 0x9c, 0x62, 0x21, 0xfe, 0x87, - 0xd5, 0xa6, 0x3f, 0xd5, 0xa6, 0x39, 0x32, 0xea, 0x9d, 0xb7, 0x97, 0x62, 0xbb, 0xa9, 0x54, 0x7b, - 0x60, 0x8b, 0xec, 0xf1, 0xb7, 0xe9, 0x77, 0x15, 0xe6, 0xa4, 0xaf, 0x3f, 0x43, 0x44, 0x2c, 0x67, - 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xa0, 0x51, 0x10, 0x54, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/ipfs/go-unixfs/pb/unixfs.proto b/vendor/github.com/ipfs/go-unixfs/pb/unixfs.proto deleted file mode 100644 index ffc059e8..00000000 --- a/vendor/github.com/ipfs/go-unixfs/pb/unixfs.proto +++ /dev/null @@ -1,26 +0,0 @@ -syntax = "proto2"; - -package unixfs.pb; - -message Data { - enum DataType { - Raw = 0; - Directory = 1; - File = 2; - Metadata = 3; - Symlink = 4; - HAMTShard = 5; - } - - required DataType Type = 1; - optional bytes Data = 2; - optional uint64 filesize = 3; - repeated uint64 blocksizes = 4; - - optional uint64 hashType = 5; - optional uint64 fanout = 6; -} - -message Metadata { - optional string MimeType = 1; -} diff --git a/vendor/github.com/ipfs/go-unixfs/unixfs.go b/vendor/github.com/ipfs/go-unixfs/unixfs.go deleted file mode 100644 index 84caf6f4..00000000 --- a/vendor/github.com/ipfs/go-unixfs/unixfs.go +++ /dev/null @@ -1,408 +0,0 @@ -// Package unixfs implements a data format for files in the IPFS filesystem It -// is not the only format in ipfs, but it is the one that the filesystem -// assumes -package unixfs - -import ( - "errors" - "fmt" - - proto "github.com/gogo/protobuf/proto" - dag "github.com/ipfs/go-merkledag" - - ipld "github.com/ipfs/go-ipld-format" - pb "github.com/ipfs/go-unixfs/pb" -) - -// A LinkResult for any parallel enumeration of links -// TODO: Should this live in go-ipld-format? -type LinkResult struct { - Link *ipld.Link - Err error -} - -// Shorthands for protobuffer types -const ( - TRaw = pb.Data_Raw - TFile = pb.Data_File - TDirectory = pb.Data_Directory - TMetadata = pb.Data_Metadata - TSymlink = pb.Data_Symlink - THAMTShard = pb.Data_HAMTShard -) - -// Common errors -var ( - ErrMalformedFileFormat = errors.New("malformed data in file format") - ErrUnrecognizedType = errors.New("unrecognized node type") -) - -// FromBytes unmarshals a byte slice as protobuf Data. -// Deprecated: Use `FSNodeFromBytes` instead to avoid direct manipulation of `pb.Data`. -func FromBytes(data []byte) (*pb.Data, error) { - pbdata := new(pb.Data) - err := proto.Unmarshal(data, pbdata) - if err != nil { - return nil, err - } - return pbdata, nil -} - -// FilePBData creates a protobuf File with the given -// byte slice and returns the marshaled protobuf bytes representing it. -func FilePBData(data []byte, totalsize uint64) []byte { - pbfile := new(pb.Data) - typ := pb.Data_File - pbfile.Type = &typ - pbfile.Data = data - pbfile.Filesize = proto.Uint64(totalsize) - - data, err := proto.Marshal(pbfile) - if err != nil { - // This really shouldnt happen, i promise - // The only failure case for marshal is if required fields - // are not filled out, and they all are. If the proto object - // gets changed and nobody updates this function, the code - // should panic due to programmer error - panic(err) - } - return data -} - -//FolderPBData returns Bytes that represent a Directory. -func FolderPBData() []byte { - pbfile := new(pb.Data) - typ := pb.Data_Directory - pbfile.Type = &typ - - data, err := proto.Marshal(pbfile) - if err != nil { - //this really shouldnt happen, i promise - panic(err) - } - return data -} - -//WrapData marshals raw bytes into a `Data_Raw` type protobuf message. -func WrapData(b []byte) []byte { - pbdata := new(pb.Data) - typ := pb.Data_Raw - pbdata.Data = b - pbdata.Type = &typ - pbdata.Filesize = proto.Uint64(uint64(len(b))) - - out, err := proto.Marshal(pbdata) - if err != nil { - // This shouldnt happen. seriously. - panic(err) - } - - return out -} - -//SymlinkData returns a `Data_Symlink` protobuf message for the path you specify. -func SymlinkData(path string) ([]byte, error) { - pbdata := new(pb.Data) - typ := pb.Data_Symlink - pbdata.Data = []byte(path) - pbdata.Type = &typ - - out, err := proto.Marshal(pbdata) - if err != nil { - return nil, err - } - - return out, nil -} - -// HAMTShardData return a `Data_HAMTShard` protobuf message -func HAMTShardData(data []byte, fanout uint64, hashType uint64) ([]byte, error) { - pbdata := new(pb.Data) - typ := pb.Data_HAMTShard - pbdata.Type = &typ - pbdata.HashType = proto.Uint64(hashType) - pbdata.Data = data - pbdata.Fanout = proto.Uint64(fanout) - - out, err := proto.Marshal(pbdata) - if err != nil { - return nil, err - } - - return out, nil -} - -// UnwrapData unmarshals a protobuf messages and returns the contents. -func UnwrapData(data []byte) ([]byte, error) { - pbdata := new(pb.Data) - err := proto.Unmarshal(data, pbdata) - if err != nil { - return nil, err - } - return pbdata.GetData(), nil -} - -// DataSize returns the size of the contents in protobuf wrapped slice. -// For raw data it simply provides the length of it. For Data_Files, it -// will return the associated filesize. Note that Data_Directories will -// return an error. -func DataSize(data []byte) (uint64, error) { - pbdata := new(pb.Data) - err := proto.Unmarshal(data, pbdata) - if err != nil { - return 0, err - } - - switch pbdata.GetType() { - case pb.Data_Directory: - return 0, errors.New("can't get data size of directory") - case pb.Data_File: - return pbdata.GetFilesize(), nil - case pb.Data_Raw: - return uint64(len(pbdata.GetData())), nil - default: - return 0, errors.New("unrecognized node data type") - } -} - -// An FSNode represents a filesystem object using the UnixFS specification. -// -// The `NewFSNode` constructor should be used instead of just calling `new(FSNode)` -// to guarantee that the required (`Type` and `Filesize`) fields in the `format` -// structure are initialized before marshaling (in `GetBytes()`). -type FSNode struct { - - // UnixFS format defined as a protocol buffers message. - format pb.Data -} - -// FSNodeFromBytes unmarshal a protobuf message onto an FSNode. -func FSNodeFromBytes(b []byte) (*FSNode, error) { - n := new(FSNode) - err := proto.Unmarshal(b, &n.format) - if err != nil { - return nil, err - } - - return n, nil -} - -// NewFSNode creates a new FSNode structure with the given `dataType`. -// -// It initializes the (required) `Type` field (that doesn't have a `Set()` -// accessor so it must be specified at creation), otherwise the `Marshal()` -// method in `GetBytes()` would fail (`required field "Type" not set`). -// -// It also initializes the `Filesize` pointer field to ensure its value -// is never nil before marshaling, this is not a required field but it is -// done to be backwards compatible with previous `go-ipfs` versions hash. -// (If it wasn't initialized there could be cases where `Filesize` could -// have been left at nil, when the `FSNode` was created but no data or -// child nodes were set to adjust it, as is the case in `NewLeaf()`.) -func NewFSNode(dataType pb.Data_DataType) *FSNode { - n := new(FSNode) - n.format.Type = &dataType - - // Initialize by `Filesize` by updating it with a dummy (zero) value. - n.UpdateFilesize(0) - - return n -} - -// HashType gets hash type of format -func (n *FSNode) HashType() uint64 { - return n.format.GetHashType() -} - -// Fanout gets fanout of format -func (n *FSNode) Fanout() uint64 { - return n.format.GetFanout() -} - -// AddBlockSize adds the size of the next child block of this node -func (n *FSNode) AddBlockSize(s uint64) { - n.UpdateFilesize(int64(s)) - n.format.Blocksizes = append(n.format.Blocksizes, s) -} - -// RemoveBlockSize removes the given child block's size. -func (n *FSNode) RemoveBlockSize(i int) { - n.UpdateFilesize(-int64(n.format.Blocksizes[i])) - n.format.Blocksizes = append(n.format.Blocksizes[:i], n.format.Blocksizes[i+1:]...) -} - -// BlockSize returns the block size indexed by `i`. -// TODO: Evaluate if this function should be bounds checking. -func (n *FSNode) BlockSize(i int) uint64 { - return n.format.Blocksizes[i] -} - -// BlockSizes gets blocksizes of format -func (n *FSNode) BlockSizes() []uint64 { - return n.format.GetBlocksizes() -} - -// RemoveAllBlockSizes removes all the child block sizes of this node. -func (n *FSNode) RemoveAllBlockSizes() { - n.format.Blocksizes = []uint64{} - n.format.Filesize = proto.Uint64(uint64(len(n.Data()))) -} - -// GetBytes marshals this node as a protobuf message. -func (n *FSNode) GetBytes() ([]byte, error) { - return proto.Marshal(&n.format) -} - -// FileSize returns the total size of this tree. That is, the size of -// the data in this node plus the size of all its children. -func (n *FSNode) FileSize() uint64 { - return n.format.GetFilesize() -} - -// NumChildren returns the number of child blocks of this node -func (n *FSNode) NumChildren() int { - return len(n.format.Blocksizes) -} - -// Data retrieves the `Data` field from the internal `format`. -func (n *FSNode) Data() []byte { - return n.format.GetData() -} - -// SetData sets the `Data` field from the internal `format` -// updating its `Filesize`. -func (n *FSNode) SetData(newData []byte) { - n.UpdateFilesize(int64(len(newData) - len(n.Data()))) - n.format.Data = newData -} - -// UpdateFilesize updates the `Filesize` field from the internal `format` -// by a signed difference (`filesizeDiff`). -// TODO: Add assert to check for `Filesize` > 0? -func (n *FSNode) UpdateFilesize(filesizeDiff int64) { - n.format.Filesize = proto.Uint64(uint64( - int64(n.format.GetFilesize()) + filesizeDiff)) -} - -// Type retrieves the `Type` field from the internal `format`. -func (n *FSNode) Type() pb.Data_DataType { - return n.format.GetType() -} - -// IsDir checks whether the node represents a directory -func (n *FSNode) IsDir() bool { - switch n.Type() { - case pb.Data_Directory, pb.Data_HAMTShard: - return true - default: - return false - } -} - -// Metadata is used to store additional FSNode information. -type Metadata struct { - MimeType string - Size uint64 -} - -// MetadataFromBytes Unmarshals a protobuf Data message into Metadata. -// The provided slice should have been encoded with BytesForMetadata(). -func MetadataFromBytes(b []byte) (*Metadata, error) { - pbd := new(pb.Data) - err := proto.Unmarshal(b, pbd) - if err != nil { - return nil, err - } - if pbd.GetType() != pb.Data_Metadata { - return nil, errors.New("incorrect node type") - } - - pbm := new(pb.Metadata) - err = proto.Unmarshal(pbd.Data, pbm) - if err != nil { - return nil, err - } - md := new(Metadata) - md.MimeType = pbm.GetMimeType() - return md, nil -} - -// Bytes marshals Metadata as a protobuf message of Metadata type. -func (m *Metadata) Bytes() ([]byte, error) { - pbm := new(pb.Metadata) - pbm.MimeType = &m.MimeType - return proto.Marshal(pbm) -} - -// BytesForMetadata wraps the given Metadata as a profobuf message of Data type, -// setting the DataType to Metadata. The wrapped bytes are itself the -// result of calling m.Bytes(). -func BytesForMetadata(m *Metadata) ([]byte, error) { - pbd := new(pb.Data) - pbd.Filesize = proto.Uint64(m.Size) - typ := pb.Data_Metadata - pbd.Type = &typ - mdd, err := m.Bytes() - if err != nil { - return nil, err - } - - pbd.Data = mdd - return proto.Marshal(pbd) -} - -// EmptyDirNode creates an empty folder Protonode. -func EmptyDirNode() *dag.ProtoNode { - return dag.NodeWithData(FolderPBData()) -} - -// ReadUnixFSNodeData extracts the UnixFS data from an IPLD node. -// Raw nodes are (also) processed because they are used as leaf -// nodes containing (only) UnixFS data. -func ReadUnixFSNodeData(node ipld.Node) (data []byte, err error) { - switch node := node.(type) { - - case *dag.ProtoNode: - fsNode, err := FSNodeFromBytes(node.Data()) - if err != nil { - return nil, fmt.Errorf("incorrectly formatted protobuf: %s", err) - } - - switch fsNode.Type() { - case pb.Data_File, pb.Data_Raw: - return fsNode.Data(), nil - // Only leaf nodes (of type `Data_Raw`) contain data but due to a - // bug the `Data_File` type (normally used for internal nodes) is - // also used for leaf nodes, so both types are accepted here - // (see the `balanced` package for more details). - default: - return nil, fmt.Errorf("found %s node in unexpected place", - fsNode.Type().String()) - } - - case *dag.RawNode: - return node.RawData(), nil - - default: - return nil, ErrUnrecognizedType - // TODO: To avoid rewriting the error message, but a different error from - // `unixfs.ErrUnrecognizedType` should be used (defining it in the - // `merkledag` or `go-ipld-format` packages). - } -} - -// Extract the `unixfs.FSNode` from the `ipld.Node` (assuming this -// was implemented by a `mdag.ProtoNode`). -func ExtractFSNode(node ipld.Node) (*FSNode, error) { - protoNode, ok := node.(*dag.ProtoNode) - if !ok { - return nil, errors.New("expected a ProtoNode as internal node") - } - - fsNode, err := FSNodeFromBytes(protoNode.Data()) - if err != nil { - return nil, err - } - - return fsNode, nil -} diff --git a/vendor/github.com/ipfs/go-verifcid/.travis.yml b/vendor/github.com/ipfs/go-verifcid/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/ipfs/go-verifcid/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/go-verifcid/go.mod b/vendor/github.com/ipfs/go-verifcid/go.mod deleted file mode 100644 index 5db3e877..00000000 --- a/vendor/github.com/ipfs/go-verifcid/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/ipfs/go-verifcid - -require ( - github.com/ipfs/go-cid v0.0.1 - github.com/multiformats/go-multihash v0.0.1 -) diff --git a/vendor/github.com/ipfs/go-verifcid/go.sum b/vendor/github.com/ipfs/go-verifcid/go.sum deleted file mode 100644 index 4525c37e..00000000 --- a/vendor/github.com/ipfs/go-verifcid/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/ipfs/go-verifcid/package.json b/vendor/github.com/ipfs/go-verifcid/package.json deleted file mode 100644 index a066b1d8..00000000 --- a/vendor/github.com/ipfs/go-verifcid/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "author": "why", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/ipfs/go-verifcid" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - }, - { - "author": "whyrusleeping", - "hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN", - "name": "go-cid", - "version": "0.9.3" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-verifcid", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.1.2" -} - diff --git a/vendor/github.com/ipfs/go-verifcid/validate.go b/vendor/github.com/ipfs/go-verifcid/validate.go deleted file mode 100644 index 8a76e493..00000000 --- a/vendor/github.com/ipfs/go-verifcid/validate.go +++ /dev/null @@ -1,62 +0,0 @@ -package verifcid - -import ( - "fmt" - - cid "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" -) - -var ErrPossiblyInsecureHashFunction = fmt.Errorf("potentially insecure hash functions not allowed") -var ErrBelowMinimumHashLength = fmt.Errorf("hashes must be at %d least bytes long", minimumHashLength) - -const minimumHashLength = 20 - -var goodset = map[uint64]bool{ - mh.SHA2_256: true, - mh.SHA2_512: true, - mh.SHA3_224: true, - mh.SHA3_256: true, - mh.SHA3_384: true, - mh.SHA3_512: true, - mh.SHAKE_256: true, - mh.DBL_SHA2_256: true, - mh.KECCAK_224: true, - mh.KECCAK_256: true, - mh.KECCAK_384: true, - mh.KECCAK_512: true, - mh.ID: true, - - mh.SHA1: true, // not really secure but still useful -} - -func IsGoodHash(code uint64) bool { - good, found := goodset[code] - if good { - return true - } - - if !found { - if code >= mh.BLAKE2B_MIN+19 && code <= mh.BLAKE2B_MAX { - return true - } - if code >= mh.BLAKE2S_MIN+19 && code <= mh.BLAKE2S_MAX { - return true - } - } - - return false -} - -func ValidateCid(c cid.Cid) error { - pref := c.Prefix() - if !IsGoodHash(pref.MhType) { - return ErrPossiblyInsecureHashFunction - } - - if pref.MhType != mh.ID && pref.MhLength < minimumHashLength { - return ErrBelowMinimumHashLength - } - - return nil -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/.travis.yml b/vendor/github.com/ipfs/interface-go-ipfs-core/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/LICENSE b/vendor/github.com/ipfs/interface-go-ipfs-core/LICENSE deleted file mode 100644 index 14121ca7..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/Makefile b/vendor/github.com/ipfs/interface-go-ipfs-core/Makefile deleted file mode 100644 index 89fc88d7..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -test: deps - gx test -v -race -coverprofile=coverage.txt -covermode=atomic . -rw: - gx-go rewrite -rwundo: - gx-go rewrite --undo -publish: rwundo - gx publish -.PHONY: all gx deps test rw rwundo publish diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/block.go b/vendor/github.com/ipfs/interface-go-ipfs-core/block.go deleted file mode 100644 index b105b079..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/block.go +++ /dev/null @@ -1,37 +0,0 @@ -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - "io" - - "github.com/ipfs/interface-go-ipfs-core/options" -) - -// BlockStat contains information about a block -type BlockStat interface { - // Size is the size of a block - Size() int - - // Path returns path to the block - Path() path.Resolved -} - -// BlockAPI specifies the interface to the block layer -type BlockAPI interface { - // Put imports raw block data, hashing it using specified settings. - Put(context.Context, io.Reader, ...options.BlockPutOption) (BlockStat, error) - - // Get attempts to resolve the path and return a reader for data in the block - Get(context.Context, path.Path) (io.Reader, error) - - // Rm removes the block specified by the path from local blockstore. - // By default an error will be returned if the block can't be found locally. - // - // NOTE: If the specified block is pinned it won't be removed and no error - // will be returned - Rm(context.Context, path.Path, ...options.BlockRmOption) error - - // Stat returns information on - Stat(context.Context, path.Path) (BlockStat, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/coreapi.go b/vendor/github.com/ipfs/interface-go-ipfs-core/coreapi.go deleted file mode 100644 index 12cb166a..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/coreapi.go +++ /dev/null @@ -1,56 +0,0 @@ -// Package iface defines IPFS Core API which is a set of interfaces used to -// interact with IPFS nodes. -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/interface-go-ipfs-core/options" - - ipld "github.com/ipfs/go-ipld-format" -) - -// CoreAPI defines an unified interface to IPFS for Go programs -type CoreAPI interface { - // Unixfs returns an implementation of Unixfs API - Unixfs() UnixfsAPI - - // Block returns an implementation of Block API - Block() BlockAPI - - // Dag returns an implementation of Dag API - Dag() APIDagService - - // Name returns an implementation of Name API - Name() NameAPI - - // Key returns an implementation of Key API - Key() KeyAPI - - // Pin returns an implementation of Pin API - Pin() PinAPI - - // ObjectAPI returns an implementation of Object API - Object() ObjectAPI - - // Dht returns an implementation of Dht API - Dht() DhtAPI - - // Swarm returns an implementation of Swarm API - Swarm() SwarmAPI - - // PubSub returns an implementation of PubSub API - PubSub() PubSubAPI - - // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, path.Path) (path.Resolved, error) - - // ResolveNode resolves the path (if not resolved already) using Unixfs - // resolver, gets and returns the resolved Node - ResolveNode(context.Context, path.Path) (ipld.Node, error) - - // WithOptions creates new instance of CoreAPI based on this instance with - // a set of options applied - WithOptions(...options.ApiOption) (CoreAPI, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/dag.go b/vendor/github.com/ipfs/interface-go-ipfs-core/dag.go deleted file mode 100644 index 3cc3aeb4..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/dag.go +++ /dev/null @@ -1,13 +0,0 @@ -package iface - -import ( - ipld "github.com/ipfs/go-ipld-format" -) - -// APIDagService extends ipld.DAGService -type APIDagService interface { - ipld.DAGService - - // Pinning returns special NodeAdder which recursively pins added nodes - Pinning() ipld.NodeAdder -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/dht.go b/vendor/github.com/ipfs/interface-go-ipfs-core/dht.go deleted file mode 100644 index 5f49e74a..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/dht.go +++ /dev/null @@ -1,26 +0,0 @@ -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/interface-go-ipfs-core/options" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// DhtAPI specifies the interface to the DHT -// Note: This API will likely get deprecated in near future, see -// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context. -type DhtAPI interface { - // FindPeer queries the DHT for all of the multiaddresses associated with a - // Peer ID - FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) - - // FindProviders finds peers in the DHT who can provide a specific value - // given a key. - FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan peer.AddrInfo, error) - - // Provide announces to the network that you are providing given values - Provide(context.Context, path.Path, ...options.DhtProvideOption) error -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/errors.go b/vendor/github.com/ipfs/interface-go-ipfs-core/errors.go deleted file mode 100644 index e0bd7805..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package iface - -import "errors" - -var ( - ErrIsDir = errors.New("this dag node is a directory") - ErrNotFile = errors.New("this dag node is not a regular file") - ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") - ErrNotSupported = errors.New("operation not supported") -) diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/go.mod b/vendor/github.com/ipfs/interface-go-ipfs-core/go.mod deleted file mode 100644 index 89c92120..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -module github.com/ipfs/interface-go-ipfs-core - -require ( - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-ipfs-files v0.0.2 - github.com/ipfs/go-ipld-cbor v0.0.1 - github.com/ipfs/go-ipld-format v0.0.1 - github.com/ipfs/go-merkledag v0.0.3 - github.com/ipfs/go-path v0.0.3 - github.com/ipfs/go-unixfs v0.0.4 - github.com/libp2p/go-libp2p-core v0.0.2 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multihash v0.0.5 -) diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/go.sum b/vendor/github.com/ipfs/interface-go-ipfs-core/go.sum deleted file mode 100644 index 2df61ab6..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/go.sum +++ /dev/null @@ -1,343 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e/go.mod h1:3oM7gXIttpYDAJXpVNnSCiUMYBLIZ6cb1t+Ip982MRo= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= -github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fd/go-nat v1.0.0 h1:DPyQ97sxA9ThrWYRPcWUz/z9TnpTIGRYODIQc/dy64M= -github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824 h1:TF4mX7zXpeyz/xintezebSa7ZDxAGBnqDwcoobvaz2o= -github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824/go.mod h1:OiEWyHgK+CWrmOlVquHaIK1vhpUJydC9m0Je6mhaiNE= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324 h1:PV190X5/DzQ/tbFFG5YpT5mH6q+cHlfgqI5JuRnH9oE= -github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/ipfs/bbloom v0.0.1 h1:s7KkiBPfxCeDVo47KySjK0ACPc5GJRUxFpdyWEuDjhw= -github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= -github.com/ipfs/go-bitswap v0.0.3 h1:uFcSI9dkjUn67S7IM60vr2wA27aAvn8o9xYjaQCug3o= -github.com/ipfs/go-bitswap v0.0.3/go.mod h1:jadAZYsP/tcRMl47ZhFxhaNuDQoXawT8iHMg+iFoQbg= -github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= -github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= -github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= -github.com/ipfs/go-blockservice v0.0.3 h1:40OvwrxeudTAlUGUAKNYnNPcwQeLtXedjzTWecnUinQ= -github.com/ipfs/go-blockservice v0.0.3/go.mod h1:/NNihwTi6V2Yr6g8wBI+BSwPuURpBRMtYNGrlxZ8KuI= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-blockstore v0.0.1 h1:O9n3PbmTYZoNhkgkEyrXTznbmktIXif62xLX+8dPHzc= -github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08= -github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= -github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw= -github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM= -github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew= -github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0= -github.com/ipfs/go-ipfs-files v0.0.2 h1:fEEjF4H+1t8SFOHqUGp0KqcwgIRlbD2bu8CAS2sIggE= -github.com/ipfs/go-ipfs-files v0.0.2/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= -github.com/ipfs/go-ipfs-flags v0.0.1 h1:OH5cEkJYL0QgA+bvD55TNG9ud8HA2Nqaav47b2c/UJk= -github.com/ipfs/go-ipfs-flags v0.0.1/go.mod h1:RnXBb9WV53GSfTrSDVK61NLTFKvWc60n+K9EgCDh+rA= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= -github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= -github.com/ipfs/go-ipfs-pq v0.0.1 h1:zgUotX8dcAB/w/HidJh1zzc1yFq6Vm8J7T2F4itj/RU= -github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-routing v0.0.1 h1:394mZeTLcbM/LDO12PneBYvkZAUA+nRnmC0lAzDXKOY= -github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-ipld-cbor v0.0.1 h1:g7yh27SznWP4CUbkFgjR+WQRjEeyxCpTR4iKVmXx1wA= -github.com/ipfs/go-ipld-cbor v0.0.1/go.mod h1:RXHr8s4k0NE0TKhnrxqZC9M888QfsBN9rhS5NjfKzY8= -github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= -github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-merkledag v0.0.3 h1:A5DlOMzqTRDVmdgkf3dzCKCFmVWH4Zqwb0cbYXUs+Ro= -github.com/ipfs/go-merkledag v0.0.3/go.mod h1:Oc5kIXLHokkE1hWGMBHw+oxehkAaTOqtEb7Zbh6BhLA= -github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= -github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= -github.com/ipfs/go-path v0.0.3 h1:G/VFcCMXtp36JUPPyytYQ1I3UsBUBf47M//uSdTLnFg= -github.com/ipfs/go-path v0.0.3/go.mod h1:zIRQUez3LuQIU25zFjC2hpBTHimWx7VK5bjZgRLbbdo= -github.com/ipfs/go-unixfs v0.0.4 h1:IApzQ+SnY0tfjqM7aU2b80CFYLZNHvhLmEZDIWr4e/E= -github.com/ipfs/go-unixfs v0.0.4/go.mod h1:eIo/p9ADu/MFOuyxzwU+Th8D6xoxU//r590vUpWyfz8= -github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E= -github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0= -github.com/jackpal/gateway v1.0.4 h1:LS5EHkLuQ6jzaHwULi0vL+JO0mU/n4yUtK8oUjHHOlM= -github.com/jackpal/gateway v1.0.4/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -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/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-conn-security v0.0.1 h1:4kMMrqrt9EUNCNjX1xagSJC+bq16uqjMe9lk1KBMVNs= -github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= -github.com/libp2p/go-conn-security-multistream v0.0.1 h1:XefjAQRHcnUaxKb26RGupToucx3uU4ecbOZ3aACXlDU= -github.com/libp2p/go-conn-security-multistream v0.0.1/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.0.2 h1:+jvgi0Zy3y4TKXJKApchCk3pCBPZf1T54z3+vKie3gw= -github.com/libp2p/go-libp2p v0.0.2/go.mod h1:Qu8bWqFXiocPloabFGUcVG4kk94fLvfC8mWTDdFC9wE= -github.com/libp2p/go-libp2p-autonat v0.0.2/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4= -github.com/libp2p/go-libp2p-blankhost v0.0.1 h1:/mZuuiwntNR8RywnCFlGHLKrKLYne+qciBpQXWqp5fk= -github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= -github.com/libp2p/go-libp2p-circuit v0.0.1/go.mod h1:Dqm0s/BiV63j8EEAs8hr1H5HudqvCAeXxDyic59lCwE= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-discovery v0.0.1/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI= -github.com/libp2p/go-libp2p-host v0.0.1 h1:dnqusU+DheGcdxrE718kG4XgHNuL2n9eEv8Rg5zy8hQ= -github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1 h1:Q9EkNSLAOF+u90L88qmE9z/fTdjLh8OsJwGw74mkwk4= -github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1 h1:7GnzRrBTJHEsofi1ahFdPN9Si6skwXQE9UqR2S+Pkh8= -github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k= -github.com/libp2p/go-libp2p-loggables v0.0.1 h1:HVww9oAnINIxbt69LJNkxD8lnbfgteXR97Xm4p3l9ps= -github.com/libp2p/go-libp2p-loggables v0.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg= -github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= -github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= -github.com/libp2p/go-libp2p-nat v0.0.2 h1:sKI5hiCsGFhuEKdXMsF9mywQu2qhfoIGX6a+VG6zelE= -github.com/libp2p/go-libp2p-nat v0.0.2/go.mod h1:QrjXQSD5Dj4IJOdEcjHRkWTSomyxRo6HnUkf/TfQpLQ= -github.com/libp2p/go-libp2p-net v0.0.1 h1:xJ4Vh4yKF/XKb8fd1Ev0ebAGzVjMxXzrxG2kjtU+F5Q= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-netutil v0.0.1 h1:LgD6+skofkOx8z6odD9+MZHKjupv3ng1u6KRhaADTnA= -github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-record v0.0.1 h1:zN7AS3X46qmwsw5JLxdDuI43cH5UYwovKxHPjKBYQxw= -github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= -github.com/libp2p/go-libp2p-routing v0.0.1 h1:hPMAWktf9rYi3ME4MG48qE7dq1ofJxiQbfdvpNntjhc= -github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys= -github.com/libp2p/go-libp2p-secio v0.0.1 h1:CqE/RdsizOwItdgLe632iyft/w0tshDLmZGAiKDcUAI= -github.com/libp2p/go-libp2p-secio v0.0.1/go.mod h1:IdG6iQybdcYmbTzxp4J5dwtUEDTOvZrT0opIDVNPrJs= -github.com/libp2p/go-libp2p-swarm v0.0.1 h1:Vne+hjaDwXqzgNwQ2vb2YKbnbOTyXjtS47stT66Apc4= -github.com/libp2p/go-libp2p-swarm v0.0.1/go.mod h1:mh+KZxkbd3lQnveQ3j2q60BM1Cw2mX36XXQqwfPOShs= -github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk= -github.com/libp2p/go-libp2p-transport v0.0.4 h1:/CPHQMN75/IQwkhBxxIo6p6PtL3rwFZtlzBROT3e8mw= -github.com/libp2p/go-libp2p-transport v0.0.4/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.1 h1:rNtXkY6dty46mxYOHHAZQchI7gQdJStF683FhVnei/k= -github.com/libp2p/go-libp2p-transport-upgrader v0.0.1/go.mod h1:NJpUAgQab/8K6K0m+JmZCe5RUXG10UMEx4kWe9Ipj5c= -github.com/libp2p/go-maddr-filter v0.0.1 h1:apvYTg0aIxxQyBX+XHKOR+0+lYhGs1Yv+JmTH9nyl5I= -github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.1 h1:dn2XGSrUxLtz3/8u85bGrwhUEKPX8MOF3lpmcWBZCWc= -github.com/libp2p/go-mplex v0.0.1/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-msgio v0.0.1 h1:znj97n5FtXGCLDwe9x8jpHmY770SW4WStBGcCDh6GJw= -github.com/libp2p/go-msgio v0.0.1/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.1 h1:UIRneNxLDmEGNjGHpIiWzSWkZ5bhxMCP9x3Vh7BSc7E= -github.com/libp2p/go-reuseport-transport v0.0.1/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-tcp-transport v0.0.1 h1:WyvJVw2lYAnr6CU+GZZ4oCt06fvORlmvBlFX2+ZpZDM= -github.com/libp2p/go-tcp-transport v0.0.1/go.mod h1:mnjg0o0O5TmXUaUIanYPUqkW4+u6mK0en8rlpA6BBTs= -github.com/libp2p/go-testutil v0.0.1 h1:Xg+O0G2HIMfHqBOBDcMS1iSZJ3GEcId4qOxCQvsGZHk= -github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I= -github.com/libp2p/go-ws-transport v0.0.1/go.mod h1:p3bKjDWHEgtuKKj+2OdPYs5dAPIjtpQGHF2tJfGz7Ww= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.0.1 h1:JV4VfSdY9n7ECTtY59/TlSyFCzRILvYx4T4Ws8ZgihU= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= -github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= -github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible h1:iqksILj8STw03EJQe7Laj4ubnw+ojOyik18cd5vPL1o= -github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible/go.mod h1:34LEDbeKFZInPUrAG+bjuJmUXONGdEFW7XL0SpTY1y4= -github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible h1:BdYHctE9HJZLquG9tpTdwWcbG4FaX6tVKPGjCGgiVxo= -github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible/go.mod h1:dRWHHvc4HDQSHh9gbKEBbUZ+f2Q8iZTPG3UOGYODxSQ= -github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible h1:IGm/UP/JpEFS6D787sZnZg7RA6fZIR9c/Ms9DeAVNuk= -github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI= -github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible h1:nVkExQ7pYlN9e45LcqTCOiDD0904fjtm0flnHZGbXkw= -github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/whyrusleeping/yamux v1.1.5 h1:4CK3aUUJQu0qpKZv5gEWJjNOQtdbdDhVVS6PJ+HimdE= -github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= -golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/key.go b/vendor/github.com/ipfs/interface-go-ipfs-core/key.go deleted file mode 100644 index db729b3b..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/key.go +++ /dev/null @@ -1,42 +0,0 @@ -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/interface-go-ipfs-core/options" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// Key specifies the interface to Keys in KeyAPI Keystore -type Key interface { - // Key returns key name - Name() string - - // Path returns key path - Path() path.Path - - // ID returns key PeerID - ID() peer.ID -} - -// KeyAPI specifies the interface to Keystore -type KeyAPI interface { - // Generate generates new key, stores it in the keystore under the specified - // name and returns a base58 encoded multihash of it's public key - Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) - - // Rename renames oldName key to newName. Returns the key and whether another - // key was overwritten, or an error - Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) - - // List lists keys stored in keystore - List(ctx context.Context) ([]Key, error) - - // Self returns the 'main' node key - Self(ctx context.Context) (Key, error) - - // Remove removes keys from keystore. Returns ipns path of the removed key - Remove(ctx context.Context, name string) (Key, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/name.go b/vendor/github.com/ipfs/interface-go-ipfs-core/name.go deleted file mode 100644 index 3dc9f687..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/name.go +++ /dev/null @@ -1,47 +0,0 @@ -package iface - -import ( - "context" - "errors" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/interface-go-ipfs-core/options" -) - -var ErrResolveFailed = errors.New("could not resolve name") - -// IpnsEntry specifies the interface to IpnsEntries -type IpnsEntry interface { - // Name returns IpnsEntry name - Name() string - // Value returns IpnsEntry value - Value() path.Path -} - -type IpnsResult struct { - path.Path - Err error -} - -// NameAPI specifies the interface to IPNS. -// -// IPNS is a PKI namespace, where names are the hashes of public keys, and the -// private key enables publishing new (signed) values. In both publish and -// resolve, the default name used is the node's own PeerID, which is the hash of -// its public key. -// -// You can use .Key API to list and generate more names and their respective keys. -type NameAPI interface { - // Publish announces new IPNS name - Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (IpnsEntry, error) - - // Resolve attempts to resolve the newest version of the specified name - Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (path.Path, error) - - // Search is a version of Resolve which outputs paths as they are discovered, - // reducing the time to first entry - // - // Note: by default, all paths read from the channel are considered unsafe, - // except the latest (last path in channel read buffer). - Search(ctx context.Context, name string, opts ...options.NameResolveOption) (<-chan IpnsResult, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/object.go b/vendor/github.com/ipfs/interface-go-ipfs-core/object.go deleted file mode 100644 index 86536d42..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/object.go +++ /dev/null @@ -1,107 +0,0 @@ -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - "io" - - "github.com/ipfs/interface-go-ipfs-core/options" - - "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" -) - -// ObjectStat provides information about dag nodes -type ObjectStat struct { - // Cid is the CID of the node - Cid cid.Cid - - // NumLinks is number of links the node contains - NumLinks int - - // BlockSize is size of the raw serialized node - BlockSize int - - // LinksSize is size of the links block section - LinksSize int - - // DataSize is the size of data block section - DataSize int - - // CumulativeSize is size of the tree (BlockSize + link sizes) - CumulativeSize int -} - -// ChangeType denotes type of change in ObjectChange -type ChangeType int - -const ( - // DiffAdd is set when a link was added to the graph - DiffAdd ChangeType = iota - - // DiffRemove is set when a link was removed from the graph - DiffRemove - - // DiffMod is set when a link was changed in the graph - DiffMod -) - -// ObjectChange represents a change ia a graph -type ObjectChange struct { - // Type of the change, either: - // * DiffAdd - Added a link - // * DiffRemove - Removed a link - // * DiffMod - Modified a link - Type ChangeType - - // Path to the changed link - Path string - - // Before holds the link path before the change. Note that when a link is - // added, this will be nil. - Before path.Resolved - - // After holds the link path after the change. Note that when a link is - // removed, this will be nil. - After path.Resolved -} - -// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities -// for manipulating MerkleDAG data structures. -type ObjectAPI interface { - // New creates new, empty (by default) dag-node. - New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) - - // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.Resolved, error) - - // Get returns the node for the path - Get(context.Context, path.Path) (ipld.Node, error) - - // Data returns reader for data of the node - Data(context.Context, path.Path) (io.Reader, error) - - // Links returns lint or links the node contains - Links(context.Context, path.Path) ([]*ipld.Link, error) - - // Stat returns information about the node - Stat(context.Context, path.Path) (*ObjectStat, error) - - // AddLink adds a link under the specified path. child path can point to a - // subdirectory within the patent which must be present (can be overridden - // with WithCreate option). - AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.Resolved, error) - - // RmLink removes a link from the node - RmLink(ctx context.Context, base path.Path, link string) (path.Resolved, error) - - // AppendData appends data to the node - AppendData(context.Context, path.Path, io.Reader) (path.Resolved, error) - - // SetData sets the data contained in the node - SetData(context.Context, path.Path, io.Reader) (path.Resolved, error) - - // Diff returns a set of changes needed to transform the first object into the - // second. - Diff(context.Context, path.Path, path.Path) ([]ObjectChange, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/block.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/block.go deleted file mode 100644 index 043dfdea..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/block.go +++ /dev/null @@ -1,126 +0,0 @@ -package options - -import ( - "fmt" - cid "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" -) - -type BlockPutSettings struct { - Codec string - MhType uint64 - MhLength int - Pin bool -} - -type BlockRmSettings struct { - Force bool -} - -type BlockPutOption func(*BlockPutSettings) error -type BlockRmOption func(*BlockRmSettings) error - -func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, cid.Prefix, error) { - options := &BlockPutSettings{ - Codec: "", - MhType: mh.SHA2_256, - MhLength: -1, - Pin: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, cid.Prefix{}, err - } - } - - var pref cid.Prefix - pref.Version = 1 - - if options.Codec == "" { - if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { - options.Codec = "protobuf" - } else { - options.Codec = "v0" - } - } - - if options.Codec == "v0" && options.MhType == mh.SHA2_256 { - pref.Version = 0 - } - - formatval, ok := cid.Codecs[options.Codec] - if !ok { - return nil, cid.Prefix{}, fmt.Errorf("unrecognized format: %s", options.Codec) - } - - if options.Codec == "v0" { - if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { - return nil, cid.Prefix{}, fmt.Errorf("only sha2-255-32 is allowed with CIDv0") - } - } - - pref.Codec = formatval - - pref.MhType = options.MhType - pref.MhLength = options.MhLength - - return options, pref, nil -} - -func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) { - options := &BlockRmSettings{ - Force: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type blockOpts struct{} - -var Block blockOpts - -// Format is an option for Block.Put which specifies the multicodec to use to -// serialize the object. Default is "v0" -func (blockOpts) Format(codec string) BlockPutOption { - return func(settings *BlockPutSettings) error { - settings.Codec = codec - return nil - } -} - -// Hash is an option for Block.Put which specifies the multihash settings to use -// when hashing the object. Default is mh.SHA2_256 (0x12). -// If mhLen is set to -1, default length for the hash will be used -func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { - return func(settings *BlockPutSettings) error { - settings.MhType = mhType - settings.MhLength = mhLen - return nil - } -} - -// Pin is an option for Block.Put which specifies whether to (recursively) pin -// added blocks -func (blockOpts) Pin(pin bool) BlockPutOption { - return func(settings *BlockPutSettings) error { - settings.Pin = pin - return nil - } -} - -// Force is an option for Block.Rm which, when set to true, will ignore -// non-existing blocks -func (blockOpts) Force(force bool) BlockRmOption { - return func(settings *BlockRmSettings) error { - settings.Force = force - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/dht.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/dht.go deleted file mode 100644 index e13e1602..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/dht.go +++ /dev/null @@ -1,62 +0,0 @@ -package options - -type DhtProvideSettings struct { - Recursive bool -} - -type DhtFindProvidersSettings struct { - NumProviders int -} - -type DhtProvideOption func(*DhtProvideSettings) error -type DhtFindProvidersOption func(*DhtFindProvidersSettings) error - -func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { - options := &DhtProvideSettings{ - Recursive: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func DhtFindProvidersOptions(opts ...DhtFindProvidersOption) (*DhtFindProvidersSettings, error) { - options := &DhtFindProvidersSettings{ - NumProviders: 20, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type dhtOpts struct{} - -var Dht dhtOpts - -// Recursive is an option for Dht.Provide which specifies whether to provide -// the given path recursively -func (dhtOpts) Recursive(recursive bool) DhtProvideOption { - return func(settings *DhtProvideSettings) error { - settings.Recursive = recursive - return nil - } -} - -// NumProviders is an option for Dht.FindProviders which specifies the -// number of peers to look for. Default is 20 -func (dhtOpts) NumProviders(numProviders int) DhtFindProvidersOption { - return func(settings *DhtFindProvidersSettings) error { - settings.NumProviders = numProviders - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/global.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/global.go deleted file mode 100644 index 90e2586f..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/global.go +++ /dev/null @@ -1,47 +0,0 @@ -package options - -type ApiSettings struct { - Offline bool - FetchBlocks bool -} - -type ApiOption func(*ApiSettings) error - -func ApiOptions(opts ...ApiOption) (*ApiSettings, error) { - options := &ApiSettings{ - Offline: false, - FetchBlocks: true, - } - - return ApiOptionsTo(options, opts...) -} - -func ApiOptionsTo(options *ApiSettings, opts ...ApiOption) (*ApiSettings, error) { - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type apiOpts struct{} - -var Api apiOpts - -func (apiOpts) Offline(offline bool) ApiOption { - return func(settings *ApiSettings) error { - settings.Offline = offline - return nil - } -} - -// FetchBlocks when set to false prevents api from fetching blocks from the -// network while allowing other services such as IPNS to still be online -func (apiOpts) FetchBlocks(fetch bool) ApiOption { - return func(settings *ApiSettings) error { - settings.FetchBlocks = fetch - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/key.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/key.go deleted file mode 100644 index 80beea35..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/key.go +++ /dev/null @@ -1,87 +0,0 @@ -package options - -const ( - RSAKey = "rsa" - Ed25519Key = "ed25519" - - DefaultRSALen = 2048 -) - -type KeyGenerateSettings struct { - Algorithm string - Size int -} - -type KeyRenameSettings struct { - Force bool -} - -type KeyGenerateOption func(*KeyGenerateSettings) error -type KeyRenameOption func(*KeyRenameSettings) error - -func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { - options := &KeyGenerateSettings{ - Algorithm: RSAKey, - Size: -1, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) { - options := &KeyRenameSettings{ - Force: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type keyOpts struct{} - -var Key keyOpts - -// Type is an option for Key.Generate which specifies which algorithm -// should be used for the key. Default is options.RSAKey -// -// Supported key types: -// * options.RSAKey -// * options.Ed25519Key -func (keyOpts) Type(algorithm string) KeyGenerateOption { - return func(settings *KeyGenerateSettings) error { - settings.Algorithm = algorithm - return nil - } -} - -// Size is an option for Key.Generate which specifies the size of the key to -// generated. Default is -1 -// -// value of -1 means 'use default size for key type': -// * 2048 for RSA -func (keyOpts) Size(size int) KeyGenerateOption { - return func(settings *KeyGenerateSettings) error { - settings.Size = size - return nil - } -} - -// Force is an option for Key.Rename which specifies whether to allow to -// replace existing keys. -func (keyOpts) Force(force bool) KeyRenameOption { - return func(settings *KeyRenameSettings) error { - settings.Force = force - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/name.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/name.go deleted file mode 100644 index 59aaf2ca..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/name.go +++ /dev/null @@ -1,122 +0,0 @@ -package options - -import ( - "time" - - ropts "github.com/ipfs/interface-go-ipfs-core/options/namesys" -) - -const ( - DefaultNameValidTime = 24 * time.Hour -) - -type NamePublishSettings struct { - ValidTime time.Duration - Key string - - TTL *time.Duration - - AllowOffline bool -} - -type NameResolveSettings struct { - Cache bool - - ResolveOpts []ropts.ResolveOpt -} - -type NamePublishOption func(*NamePublishSettings) error -type NameResolveOption func(*NameResolveSettings) error - -func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) { - options := &NamePublishSettings{ - ValidTime: DefaultNameValidTime, - Key: "self", - - AllowOffline: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) { - options := &NameResolveSettings{ - Cache: true, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -type nameOpts struct{} - -var Name nameOpts - -// ValidTime is an option for Name.Publish which specifies for how long the -// entry will remain valid. Default value is 24h -func (nameOpts) ValidTime(validTime time.Duration) NamePublishOption { - return func(settings *NamePublishSettings) error { - settings.ValidTime = validTime - return nil - } -} - -// Key is an option for Name.Publish which specifies the key to use for -// publishing. Default value is "self" which is the node's own PeerID. -// The key parameter must be either PeerID or keystore key alias. -// -// You can use KeyAPI to list and generate more names and their respective keys. -func (nameOpts) Key(key string) NamePublishOption { - return func(settings *NamePublishSettings) error { - settings.Key = key - return nil - } -} - -// AllowOffline is an option for Name.Publish which specifies whether to allow -// publishing when the node is offline. Default value is false -func (nameOpts) AllowOffline(allow bool) NamePublishOption { - return func(settings *NamePublishSettings) error { - settings.AllowOffline = allow - return nil - } -} - -// TTL is an option for Name.Publish which specifies the time duration the -// published record should be cached for (caution: experimental). -func (nameOpts) TTL(ttl time.Duration) NamePublishOption { - return func(settings *NamePublishSettings) error { - settings.TTL = &ttl - return nil - } -} - -// Cache is an option for Name.Resolve which specifies if cache should be used. -// Default value is true -func (nameOpts) Cache(cache bool) NameResolveOption { - return func(settings *NameResolveSettings) error { - settings.Cache = cache - return nil - } -} - -// -func (nameOpts) ResolveOption(opt ropts.ResolveOpt) NameResolveOption { - return func(settings *NameResolveSettings) error { - settings.ResolveOpts = append(settings.ResolveOpts, opt) - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/namesys/opts.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/namesys/opts.go deleted file mode 100644 index ee2bd5ac..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/namesys/opts.go +++ /dev/null @@ -1,74 +0,0 @@ -package nsopts - -import ( - "time" -) - -const ( - // DefaultDepthLimit is the default depth limit used by Resolve. - DefaultDepthLimit = 32 - - // UnlimitedDepth allows infinite recursion in Resolve. You - // probably don't want to use this, but it's here if you absolutely - // trust resolution to eventually complete and can't put an upper - // limit on how many steps it will take. - UnlimitedDepth = 0 -) - -// ResolveOpts specifies options for resolving an IPNS path -type ResolveOpts struct { - // Recursion depth limit - Depth uint - // The number of IPNS records to retrieve from the DHT - // (the best record is selected from this set) - DhtRecordCount uint - // The amount of time to wait for DHT records to be fetched - // and verified. A zero value indicates that there is no explicit - // timeout (although there is an implicit timeout due to dial - // timeouts within the DHT) - DhtTimeout time.Duration -} - -// DefaultResolveOpts returns the default options for resolving -// an IPNS path -func DefaultResolveOpts() ResolveOpts { - return ResolveOpts{ - Depth: DefaultDepthLimit, - DhtRecordCount: 16, - DhtTimeout: time.Minute, - } -} - -// ResolveOpt is used to set an option -type ResolveOpt func(*ResolveOpts) - -// Depth is the recursion depth limit -func Depth(depth uint) ResolveOpt { - return func(o *ResolveOpts) { - o.Depth = depth - } -} - -// DhtRecordCount is the number of IPNS records to retrieve from the DHT -func DhtRecordCount(count uint) ResolveOpt { - return func(o *ResolveOpts) { - o.DhtRecordCount = count - } -} - -// DhtTimeout is the amount of time to wait for DHT records to be fetched -// and verified. A zero value indicates that there is no explicit timeout -func DhtTimeout(timeout time.Duration) ResolveOpt { - return func(o *ResolveOpts) { - o.DhtTimeout = timeout - } -} - -// ProcessOpts converts an array of ResolveOpt into a ResolveOpts object -func ProcessOpts(opts []ResolveOpt) ResolveOpts { - rsopts := DefaultResolveOpts() - for _, option := range opts { - option(&rsopts) - } - return rsopts -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/object.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/object.go deleted file mode 100644 index e484a9f3..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/object.go +++ /dev/null @@ -1,124 +0,0 @@ -package options - -type ObjectNewSettings struct { - Type string -} - -type ObjectPutSettings struct { - InputEnc string - DataType string - Pin bool -} - -type ObjectAddLinkSettings struct { - Create bool -} - -type ObjectNewOption func(*ObjectNewSettings) error -type ObjectPutOption func(*ObjectPutSettings) error -type ObjectAddLinkOption func(*ObjectAddLinkSettings) error - -func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { - options := &ObjectNewSettings{ - Type: "empty", - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func ObjectPutOptions(opts ...ObjectPutOption) (*ObjectPutSettings, error) { - options := &ObjectPutSettings{ - InputEnc: "json", - DataType: "text", - Pin: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func ObjectAddLinkOptions(opts ...ObjectAddLinkOption) (*ObjectAddLinkSettings, error) { - options := &ObjectAddLinkSettings{ - Create: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type objectOpts struct{} - -var Object objectOpts - -// Type is an option for Object.New which allows to change the type of created -// dag node. -// -// Supported types: -// * 'empty' - Empty node -// * 'unixfs-dir' - Empty UnixFS directory -func (objectOpts) Type(t string) ObjectNewOption { - return func(settings *ObjectNewSettings) error { - settings.Type = t - return nil - } -} - -// InputEnc is an option for Object.Put which specifies the input encoding of the -// data. Default is "json". -// -// Supported encodings: -// * "protobuf" -// * "json" -func (objectOpts) InputEnc(e string) ObjectPutOption { - return func(settings *ObjectPutSettings) error { - settings.InputEnc = e - return nil - } -} - -// DataType is an option for Object.Put which specifies the encoding of data -// field when using Json or XML input encoding. -// -// Supported types: -// * "text" (default) -// * "base64" -func (objectOpts) DataType(t string) ObjectPutOption { - return func(settings *ObjectPutSettings) error { - settings.DataType = t - return nil - } -} - -// Pin is an option for Object.Put which specifies whether to pin the added -// objects, default is false -func (objectOpts) Pin(pin bool) ObjectPutOption { - return func(settings *ObjectPutSettings) error { - settings.Pin = pin - return nil - } -} - -// Create is an option for Object.AddLink which specifies whether create required -// directories for the child -func (objectOpts) Create(create bool) ObjectAddLinkOption { - return func(settings *ObjectAddLinkSettings) error { - settings.Create = create - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/pin.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/pin.go deleted file mode 100644 index 6b211bb7..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/pin.go +++ /dev/null @@ -1,163 +0,0 @@ -package options - -type PinAddSettings struct { - Recursive bool -} - -type PinLsSettings struct { - Type string -} - -// PinRmSettings represents the settings of pin rm command -type PinRmSettings struct { - Recursive bool -} - -type PinUpdateSettings struct { - Unpin bool -} - -type PinAddOption func(*PinAddSettings) error - -// PinRmOption pin rm option func -type PinRmOption func(*PinRmSettings) error - -// PinLsOption pin ls option func -type PinLsOption func(*PinLsSettings) error -type PinUpdateOption func(*PinUpdateSettings) error - -func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { - options := &PinAddSettings{ - Recursive: true, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -// PinRmOptions pin rm options -func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { - options := &PinRmSettings{ - Recursive: true, - } - - for _, opt := range opts { - if err := opt(options); err != nil { - return nil, err - } - } - - return options, nil -} - -func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { - options := &PinLsSettings{ - Type: "all", - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { - options := &PinUpdateSettings{ - Unpin: true, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -type pinType struct{} - -type pinOpts struct { - Type pinType -} - -var Pin pinOpts - -// All is an option for Pin.Ls which will make it return all pins. It is -// the default -func (pinType) All() PinLsOption { - return Pin.pinType("all") -} - -// Recursive is an option for Pin.Ls which will make it only return recursive -// pins -func (pinType) Recursive() PinLsOption { - return Pin.pinType("recursive") -} - -// Direct is an option for Pin.Ls which will make it only return direct (non -// recursive) pins -func (pinType) Direct() PinLsOption { - return Pin.pinType("direct") -} - -// Indirect is an option for Pin.Ls which will make it only return indirect pins -// (objects referenced by other recursively pinned objects) -func (pinType) Indirect() PinLsOption { - return Pin.pinType("indirect") -} - -// Recursive is an option for Pin.Add which specifies whether to pin an entire -// object tree or just one object. Default: true -func (pinOpts) Recursive(recursive bool) PinAddOption { - return func(settings *PinAddSettings) error { - settings.Recursive = recursive - return nil - } -} - -// RmRecursive is an option for Pin.Rm which specifies whether to recursively -// unpin the object linked to by the specified object(s). This does not remove -// indirect pins referenced by other recursive pins. -func (pinOpts) RmRecursive(recursive bool) PinRmOption { - return func(settings *PinRmSettings) error { - settings.Recursive = recursive - return nil - } -} - -// Type is an option for Pin.Ls which allows to specify which pin types should -// be returned -// -// Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) -func (pinOpts) pinType(t string) PinLsOption { - return func(settings *PinLsSettings) error { - settings.Type = t - return nil - } -} - -// Unpin is an option for Pin.Update which specifies whether to remove the old pin. -// Default is true. -func (pinOpts) Unpin(unpin bool) PinUpdateOption { - return func(settings *PinUpdateSettings) error { - settings.Unpin = unpin - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/pubsub.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/pubsub.go deleted file mode 100644 index c387d613..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/pubsub.go +++ /dev/null @@ -1,58 +0,0 @@ -package options - -type PubSubPeersSettings struct { - Topic string -} - -type PubSubSubscribeSettings struct { - Discover bool -} - -type PubSubPeersOption func(*PubSubPeersSettings) error -type PubSubSubscribeOption func(*PubSubSubscribeSettings) error - -func PubSubPeersOptions(opts ...PubSubPeersOption) (*PubSubPeersSettings, error) { - options := &PubSubPeersSettings{ - Topic: "", - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func PubSubSubscribeOptions(opts ...PubSubSubscribeOption) (*PubSubSubscribeSettings, error) { - options := &PubSubSubscribeSettings{ - Discover: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type pubsubOpts struct{} - -var PubSub pubsubOpts - -func (pubsubOpts) Topic(topic string) PubSubPeersOption { - return func(settings *PubSubPeersSettings) error { - settings.Topic = topic - return nil - } -} - -func (pubsubOpts) Discover(discover bool) PubSubSubscribeOption { - return func(settings *PubSubSubscribeSettings) error { - settings.Discover = discover - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/options/unixfs.go b/vendor/github.com/ipfs/interface-go-ipfs-core/options/unixfs.go deleted file mode 100644 index 3fd96f77..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/options/unixfs.go +++ /dev/null @@ -1,285 +0,0 @@ -package options - -import ( - "errors" - "fmt" - - cid "github.com/ipfs/go-cid" - dag "github.com/ipfs/go-merkledag" - mh "github.com/multiformats/go-multihash" -) - -type Layout int - -const ( - BalancedLayout Layout = iota - TrickleLayout -) - -type UnixfsAddSettings struct { - CidVersion int - MhType uint64 - - Inline bool - InlineLimit int - RawLeaves bool - RawLeavesSet bool - - Chunker string - Layout Layout - - Pin bool - OnlyHash bool - FsCache bool - NoCopy bool - - Events chan<- interface{} - Silent bool - Progress bool -} - -type UnixfsLsSettings struct { - ResolveChildren bool -} - -type UnixfsAddOption func(*UnixfsAddSettings) error -type UnixfsLsOption func(*UnixfsLsSettings) error - -func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, error) { - options := &UnixfsAddSettings{ - CidVersion: -1, - MhType: mh.SHA2_256, - - Inline: false, - InlineLimit: 32, - RawLeaves: false, - RawLeavesSet: false, - - Chunker: "size-262144", - Layout: BalancedLayout, - - Pin: false, - OnlyHash: false, - FsCache: false, - NoCopy: false, - - Events: nil, - Silent: false, - Progress: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, cid.Prefix{}, err - } - } - - // nocopy -> rawblocks - if options.NoCopy && !options.RawLeaves { - // fixed? - if options.RawLeavesSet { - return nil, cid.Prefix{}, fmt.Errorf("nocopy option requires '--raw-leaves' to be enabled as well") - } - - // No, satisfy mandatory constraint. - options.RawLeaves = true - } - - // (hash != "sha2-256") -> CIDv1 - if options.MhType != mh.SHA2_256 { - switch options.CidVersion { - case 0: - return nil, cid.Prefix{}, errors.New("CIDv0 only supports sha2-256") - case 1, -1: - options.CidVersion = 1 - default: - return nil, cid.Prefix{}, fmt.Errorf("unknown CID version: %d", options.CidVersion) - } - } else { - if options.CidVersion < 0 { - // Default to CIDv0 - options.CidVersion = 0 - } - } - - // cidV1 -> raw blocks (by default) - if options.CidVersion > 0 && !options.RawLeavesSet { - options.RawLeaves = true - } - - prefix, err := dag.PrefixForCidVersion(options.CidVersion) - if err != nil { - return nil, cid.Prefix{}, err - } - - prefix.MhType = options.MhType - prefix.MhLength = -1 - - return options, prefix, nil -} - -func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) { - options := &UnixfsLsSettings{ - ResolveChildren: true, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - - return options, nil -} - -type unixfsOpts struct{} - -var Unixfs unixfsOpts - -// CidVersion specifies which CID version to use. Defaults to 0 unless an option -// that depends on CIDv1 is passed. -func (unixfsOpts) CidVersion(version int) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.CidVersion = version - return nil - } -} - -// Hash function to use. Implies CIDv1 if not set to sha2-256 (default). -// -// Table of functions is declared in https://github.com/multiformats/go-multihash/blob/master/multihash.go -func (unixfsOpts) Hash(mhtype uint64) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.MhType = mhtype - return nil - } -} - -// RawLeaves specifies whether to use raw blocks for leaves (data nodes with no -// links) instead of wrapping them with unixfs structures. -func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.RawLeaves = enable - settings.RawLeavesSet = true - return nil - } -} - -// Inline tells the adder to inline small blocks into CIDs -func (unixfsOpts) Inline(enable bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Inline = enable - return nil - } -} - -// InlineLimit sets the amount of bytes below which blocks will be encoded -// directly into CID instead of being stored and addressed by it's hash. -// Specifying this option won't enable block inlining. For that use `Inline` -// option. Default: 32 bytes -// -// Note that while there is no hard limit on the number of bytes, it should be -// kept at a reasonably low value, such as 64; implementations may choose to -// reject anything larger. -func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.InlineLimit = limit - return nil - } -} - -// Chunker specifies settings for the chunking algorithm to use. -// -// Default: size-262144, formats: -// size-[bytes] - Simple chunker splitting data into blocks of n bytes -// rabin-[min]-[avg]-[max] - Rabin chunker -func (unixfsOpts) Chunker(chunker string) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Chunker = chunker - return nil - } -} - -// Layout tells the adder how to balance data between leaves. -// options.BalancedLayout is the default, it's optimized for static seekable -// files. -// options.TrickleLayout is optimized for streaming data, -func (unixfsOpts) Layout(layout Layout) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Layout = layout - return nil - } -} - -// Pin tells the adder to pin the file root recursively after adding -func (unixfsOpts) Pin(pin bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Pin = pin - return nil - } -} - -// HashOnly will make the adder calculate data hash without storing it in the -// blockstore or announcing it to the network -func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.OnlyHash = hashOnly - return nil - } -} - -// Events specifies channel which will be used to report events about ongoing -// Add operation. -// -// Note that if this channel blocks it may slowdown the adder -func (unixfsOpts) Events(sink chan<- interface{}) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Events = sink - return nil - } -} - -// Silent reduces event output -func (unixfsOpts) Silent(silent bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Silent = silent - return nil - } -} - -// Progress tells the adder whether to enable progress events -func (unixfsOpts) Progress(enable bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Progress = enable - return nil - } -} - -// FsCache tells the adder to check the filestore for pre-existing blocks -// -// Experimental -func (unixfsOpts) FsCache(enable bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.FsCache = enable - return nil - } -} - -// NoCopy tells the adder to add the files using filestore. Implies RawLeaves. -// -// Experimental -func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.NoCopy = enable - return nil - } -} - -func (unixfsOpts) ResolveChildren(resolve bool) UnixfsLsOption { - return func(settings *UnixfsLsSettings) error { - settings.ResolveChildren = resolve - return nil - } -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/path/path.go b/vendor/github.com/ipfs/interface-go-ipfs-core/path/path.go deleted file mode 100644 index 01b1673b..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/path/path.go +++ /dev/null @@ -1,199 +0,0 @@ -package path - -import ( - "strings" - - cid "github.com/ipfs/go-cid" - ipfspath "github.com/ipfs/go-path" -) - -// Path is a generic wrapper for paths used in the API. A path can be resolved -// to a CID using one of Resolve functions in the API. -// -// Paths must be prefixed with a valid prefix: -// -// * /ipfs - Immutable unixfs path (files) -// * /ipld - Immutable ipld path (data) -// * /ipns - Mutable names. Usually resolves to one of the immutable paths -//TODO: /local (MFS) -type Path interface { - // String returns the path as a string. - String() string - - // Namespace returns the first component of the path. - // - // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" - // - // Calling this method on invalid paths (IsValid() != nil) will result in - // empty string - Namespace() string - - // Mutable returns false if the data pointed to by this path in guaranteed - // to not change. - // - // Note that resolved mutable path can be immutable. - Mutable() bool - - // IsValid checks if this path is a valid ipfs Path, returning nil iff it is - // valid - IsValid() error -} - -// Resolved is a path which was resolved to the last resolvable node. -// ResolvedPaths are guaranteed to return nil from `IsValid` -type Resolved interface { - // Cid returns the CID of the node referenced by the path. Remainder of the - // path is guaranteed to be within the node. - // - // Examples: - // If you have 3 linked objects: QmRoot -> A -> B: - // - // cidB := {"foo": {"bar": 42 }} - // cidA := {"B": {"/": cidB }} - // cidRoot := {"A": {"/": cidA }} - // - // And resolve paths: - // - // * "/ipfs/${cidRoot}" - // * Calling Cid() will return `cidRoot` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A" - // * Calling Cid() will return `cidA` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A/B/foo" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo` - // - // * "/ipfs/${cidRoot}/A/B/foo/bar" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo/bar` - Cid() cid.Cid - - // Root returns the CID of the root object of the path - // - // Example: - // If you have 3 linked objects: QmRoot -> A -> B, and resolve path - // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot - // - // For more examples see the documentation of Cid() method - Root() cid.Cid - - // Remainder returns unresolved part of the path - // - // Example: - // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node - // containing the following data: - // - // {"foo": {"bar": 42 }} - // - // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" - // - // For more examples see the documentation of Cid() method - Remainder() string - - Path -} - -// path implements coreiface.Path -type path struct { - path string -} - -// resolvedPath implements coreiface.resolvedPath -type resolvedPath struct { - path - cid cid.Cid - root cid.Cid - remainder string -} - -// Join appends provided segments to the base path -func Join(base Path, a ...string) Path { - s := strings.Join(append([]string{base.String()}, a...), "/") - return &path{path: s} -} - -// IpfsPath creates new /ipfs path from the provided CID -func IpfsPath(c cid.Cid) Resolved { - return &resolvedPath{ - path: path{"/ipfs/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// IpldPath creates new /ipld path from the provided CID -func IpldPath(c cid.Cid) Resolved { - return &resolvedPath{ - path: path{"/ipld/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// New parses string path to a Path -func New(p string) Path { - if pp, err := ipfspath.ParsePath(p); err == nil { - p = pp.String() - } - - return &path{path: p} -} - -// NewResolvedPath creates new Resolved path. This function performs no checks -// and is intended to be used by resolver implementations. Incorrect inputs may -// cause panics. Handle with care. -func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) Resolved { - return &resolvedPath{ - path: path{ipath.String()}, - cid: c, - root: root, - remainder: remainder, - } -} - -func (p *path) String() string { - return p.path -} - -func (p *path) Namespace() string { - ip, err := ipfspath.ParsePath(p.path) - if err != nil { - return "" - } - - if len(ip.Segments()) < 1 { - panic("path without namespace") // this shouldn't happen under any scenario - } - return ip.Segments()[0] -} - -func (p *path) Mutable() bool { - // TODO: MFS: check for /local - return p.Namespace() == "ipns" -} - -func (p *path) IsValid() error { - _, err := ipfspath.ParsePath(p.path) - return err -} - -func (p *resolvedPath) Cid() cid.Cid { - return p.cid -} - -func (p *resolvedPath) Root() cid.Cid { - return p.root -} - -func (p *resolvedPath) Remainder() string { - return p.remainder -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/pin.go b/vendor/github.com/ipfs/interface-go-ipfs-core/pin.go deleted file mode 100644 index 7df2956f..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/pin.go +++ /dev/null @@ -1,55 +0,0 @@ -package iface - -import ( - "context" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/interface-go-ipfs-core/options" -) - -// Pin holds information about pinned resource -type Pin interface { - // Path to the pinned object - Path() path.Resolved - - // Type of the pin - Type() string -} - -// PinStatus holds information about pin health -type PinStatus interface { - // Ok indicates whether the pin has been verified to be correct - Ok() bool - - // BadNodes returns any bad (usually missing) nodes from the pin - BadNodes() []BadPinNode -} - -// BadPinNode is a node that has been marked as bad by Pin.Verify -type BadPinNode interface { - // Path is the path of the node - Path() path.Resolved - - // Err is the reason why the node has been marked as bad - Err() error -} - -// PinAPI specifies the interface to pining -type PinAPI interface { - // Add creates new pin, be default recursive - pinning the whole referenced - // tree - Add(context.Context, path.Path, ...options.PinAddOption) error - - // Ls returns list of pinned objects on this node - Ls(context.Context, ...options.PinLsOption) ([]Pin, error) - - // Rm removes pin for object specified by the path - Rm(context.Context, path.Path, ...options.PinRmOption) error - - // Update changes one pin to another, skipping checks for matching paths in - // the old tree - Update(ctx context.Context, from path.Path, to path.Path, opts ...options.PinUpdateOption) error - - // Verify verifies the integrity of pinned objects - Verify(context.Context) (<-chan PinStatus, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/pubsub.go b/vendor/github.com/ipfs/interface-go-ipfs-core/pubsub.go deleted file mode 100644 index d9826551..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/pubsub.go +++ /dev/null @@ -1,48 +0,0 @@ -package iface - -import ( - "context" - "io" - - options "github.com/ipfs/interface-go-ipfs-core/options" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// PubSubSubscription is an active PubSub subscription -type PubSubSubscription interface { - io.Closer - - // Next return the next incoming message - Next(context.Context) (PubSubMessage, error) -} - -// PubSubMessage is a single PubSub message -type PubSubMessage interface { - // From returns id of a peer from which the message has arrived - From() peer.ID - - // Data returns the message body - Data() []byte - - // Seq returns message identifier - Seq() []byte - - // Topics returns list of topics this message was set to - Topics() []string -} - -// PubSubAPI specifies the interface to PubSub -type PubSubAPI interface { - // Ls lists subscribed topics by name - Ls(context.Context) ([]string, error) - - // Peers list peers we are currently pubsubbing with - Peers(context.Context, ...options.PubSubPeersOption) ([]peer.ID, error) - - // Publish a message to a given pubsub topic - Publish(context.Context, string, []byte) error - - // Subscribe to messages on a given topic - Subscribe(context.Context, string, ...options.PubSubSubscribeOption) (PubSubSubscription, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/swarm.go b/vendor/github.com/ipfs/interface-go-ipfs-core/swarm.go deleted file mode 100644 index d7b25d5e..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/swarm.go +++ /dev/null @@ -1,57 +0,0 @@ -package iface - -import ( - "context" - "errors" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" - - ma "github.com/multiformats/go-multiaddr" -) - -var ( - ErrNotConnected = errors.New("not connected") - ErrConnNotFound = errors.New("conn not found") -) - -// ConnectionInfo contains information about a peer -type ConnectionInfo interface { - // ID returns PeerID - ID() peer.ID - - // Address returns the multiaddress via which we are connected with the peer - Address() ma.Multiaddr - - // Direction returns which way the connection was established - Direction() network.Direction - - // Latency returns last known round trip time to the peer - Latency() (time.Duration, error) - - // Streams returns list of streams established with the peer - Streams() ([]protocol.ID, error) -} - -// SwarmAPI specifies the interface to libp2p swarm -type SwarmAPI interface { - // Connect to a given peer - Connect(context.Context, peer.AddrInfo) error - - // Disconnect from a given address - Disconnect(context.Context, ma.Multiaddr) error - - // Peers returns the list of peers we are connected to - Peers(context.Context) ([]ConnectionInfo, error) - - // KnownAddrs returns the list of all addresses this node is aware of - KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error) - - // LocalAddrs returns the list of announced listening addresses - LocalAddrs(context.Context) ([]ma.Multiaddr, error) - - // ListenAddrs returns the list of all listening addresses - ListenAddrs(context.Context) ([]ma.Multiaddr, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/unixfs.go b/vendor/github.com/ipfs/interface-go-ipfs-core/unixfs.go deleted file mode 100644 index 686c4029..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/unixfs.go +++ /dev/null @@ -1,79 +0,0 @@ -package iface - -import ( - "context" - "github.com/ipfs/interface-go-ipfs-core/options" - path "github.com/ipfs/interface-go-ipfs-core/path" - - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-files" -) - -type AddEvent struct { - Name string - Path path.Resolved `json:",omitempty"` - Bytes int64 `json:",omitempty"` - Size string `json:",omitempty"` -} - -// FileType is an enum of possible UnixFS file types. -type FileType int32 - -const ( - // TUnknown means the file type isn't known (e.g., it hasn't been - // resolved). - TUnknown FileType = iota - // TFile is a regular file. - TFile - // TDirectory is a directory. - TDirectory - // TSymlink is a symlink. - TSymlink -) - -func (t FileType) String() string { - switch t { - case TUnknown: - return "unknown" - case TFile: - return "file" - case TDirectory: - return "directory" - case TSymlink: - return "symlink" - default: - return "" - } -} - -// DirEntry is a directory entry returned by `Ls`. -type DirEntry struct { - Name string - Cid cid.Cid - - // Only filled when asked to resolve the directory entry. - Size uint64 // The size of the file in bytes (or the size of the symlink). - Type FileType // The type of the file. - Target string // The symlink target (if a symlink). - - Err error -} - -// UnixfsAPI is the basic interface to immutable files in IPFS -// NOTE: This API is heavily WIP, things are guaranteed to break frequently -type UnixfsAPI interface { - // Add imports the data from the reader into merkledag file - // - // TODO: a long useful comment on how to use this for many different scenarios - Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.Resolved, error) - - // Get returns a read-only handle to a file tree referenced by a path - // - // Note that some implementations of this API may apply the specified context - // to operations performed on the returned file - Get(context.Context, path.Path) (files.Node, error) - - // Ls returns the list of links in a directory. Links aren't guaranteed to be - // returned in order - Ls(context.Context, path.Path, ...options.UnixfsLsOption) (<-chan DirEntry, error) -} diff --git a/vendor/github.com/ipfs/interface-go-ipfs-core/util.go b/vendor/github.com/ipfs/interface-go-ipfs-core/util.go deleted file mode 100644 index 6d58bf40..00000000 --- a/vendor/github.com/ipfs/interface-go-ipfs-core/util.go +++ /dev/null @@ -1,20 +0,0 @@ -package iface - -import ( - "context" - "io" -) - -type Reader interface { - ReadSeekCloser - Size() uint64 - CtxReadFull(context.Context, []byte) (int, error) -} - -// A ReadSeekCloser implements interfaces to read, copy, seek and close. -type ReadSeekCloser interface { - io.Reader - io.Seeker - io.Closer - io.WriterTo -} diff --git a/vendor/github.com/jackpal/gateway/.travis.yml b/vendor/github.com/jackpal/gateway/.travis.yml deleted file mode 100644 index 9c3f6547..00000000 --- a/vendor/github.com/jackpal/gateway/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.6.2 - - tip - -allowed_failures: - - go: tip - -install: - - go get -d -v ./... && go install -race -v ./... - -script: go test -race -v ./... diff --git a/vendor/github.com/jackpal/gateway/LICENSE b/vendor/github.com/jackpal/gateway/LICENSE deleted file mode 100644 index c9efac32..00000000 --- a/vendor/github.com/jackpal/gateway/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2010 Jack Palevich. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/jackpal/gateway/README.md b/vendor/github.com/jackpal/gateway/README.md deleted file mode 100644 index 6a2b2125..00000000 --- a/vendor/github.com/jackpal/gateway/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# gateway - -A simple library for discovering the IP address of the default gateway. - - -[![Build Status](https://travis-ci.org/jackpal/gateway.svg)](https://travis-ci.org/jackpal/gateway) - -Provides implementations for: - -+ FreeBSD -+ Linux -+ OS X (Darwin) -+ Solaris -+ Windows - -Other platforms use an implementation that always returns an error. - -Pull requests for other OSs happily considered! diff --git a/vendor/github.com/jackpal/gateway/gateway_common.go b/vendor/github.com/jackpal/gateway/gateway_common.go deleted file mode 100644 index 441ea62e..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_common.go +++ /dev/null @@ -1,146 +0,0 @@ -package gateway - -import ( - "errors" - "net" - "strings" -) - -var errNoGateway = errors.New("no gateway found") - -func parseWindowsRoutePrint(output []byte) (net.IP, error) { - // Windows route output format is always like this: - // =========================================================================== - // Active Routes: - // Network Destination Netmask Gateway Interface Metric - // 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.100 20 - // =========================================================================== - // I'm trying to pick the active route, - // then jump 2 lines and pick the third IP - // Not using regex because output is quite standard from Windows XP to 8 (NEEDS TESTING) - lines := strings.Split(string(output), "\n") - for idx, line := range lines { - if strings.HasPrefix(line, "Active Routes:") { - if len(lines) <= idx+2 { - return nil, errNoGateway - } - - fields := strings.Fields(lines[idx+2]) - if len(fields) < 3 { - return nil, errNoGateway - } - - ip := net.ParseIP(fields[2]) - if ip != nil { - return ip, nil - } - } - } - return nil, errNoGateway -} - -func parseLinuxIPRouteShow(output []byte) (net.IP, error) { - // Linux '/usr/bin/ip route show' format looks like this: - // default via 192.168.178.1 dev wlp3s0 metric 303 - // 192.168.178.0/24 dev wlp3s0 proto kernel scope link src 192.168.178.76 metric 303 - lines := strings.Split(string(output), "\n") - for _, line := range lines { - fields := strings.Fields(line) - if len(fields) >= 3 && fields[0] == "default" { - ip := net.ParseIP(fields[2]) - if ip != nil { - return ip, nil - } - } - } - - return nil, errNoGateway -} - -func parseLinuxIPRouteGet(output []byte) (net.IP, error) { - // Linux '/usr/bin/ip route get 8.8.8.8' format looks like this: - // 8.8.8.8 via 10.0.1.1 dev eth0 src 10.0.1.36 uid 2000 - lines := strings.Split(string(output), "\n") - for _, line := range lines { - fields := strings.Fields(line) - if len(fields) >= 2 && fields[1] == "via" { - ip := net.ParseIP(fields[2]) - if ip != nil { - return ip, nil - } - } - } - - return nil, errNoGateway -} - -func parseLinuxRoute(output []byte) (net.IP, error) { - // Linux route out format is always like this: - // Kernel IP routing table - // Destination Gateway Genmask Flags Metric Ref Use Iface - // 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 - lines := strings.Split(string(output), "\n") - for _, line := range lines { - fields := strings.Fields(line) - if len(fields) >= 2 && fields[0] == "0.0.0.0" { - ip := net.ParseIP(fields[1]) - if ip != nil { - return ip, nil - } - } - } - - return nil, errNoGateway -} - -func parseDarwinRouteGet(output []byte) (net.IP, error) { - // Darwin route out format is always like this: - // route to: default - // destination: default - // mask: default - // gateway: 192.168.1.1 - lines := strings.Split(string(output), "\n") - for _, line := range lines { - fields := strings.Fields(line) - if len(fields) >= 2 && fields[0] == "gateway:" { - ip := net.ParseIP(fields[1]) - if ip != nil { - return ip, nil - } - } - } - - return nil, errNoGateway -} - -func parseBSDSolarisNetstat(output []byte) (net.IP, error) { - // netstat -rn produces the following on FreeBSD: - // Routing tables - // - // Internet: - // Destination Gateway Flags Netif Expire - // default 10.88.88.2 UGS em0 - // 10.88.88.0/24 link#1 U em0 - // 10.88.88.148 link#1 UHS lo0 - // 127.0.0.1 link#2 UH lo0 - // - // Internet6: - // Destination Gateway Flags Netif Expire - // ::/96 ::1 UGRS lo0 - // ::1 link#2 UH lo0 - // ::ffff:0.0.0.0/96 ::1 UGRS lo0 - // fe80::/10 ::1 UGRS lo0 - // ... - outputLines := strings.Split(string(output), "\n") - for _, line := range outputLines { - fields := strings.Fields(line) - if len(fields) >= 2 && fields[0] == "default" { - ip := net.ParseIP(fields[1]) - if ip != nil { - return ip, nil - } - } - } - - return nil, errNoGateway -} diff --git a/vendor/github.com/jackpal/gateway/gateway_darwin.go b/vendor/github.com/jackpal/gateway/gateway_darwin.go deleted file mode 100644 index 32e755cb..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_darwin.go +++ /dev/null @@ -1,16 +0,0 @@ -package gateway - -import ( - "net" - "os/exec" -) - -func DiscoverGateway() (net.IP, error) { - routeCmd := exec.Command("/sbin/route", "-n", "get", "0.0.0.0") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseDarwinRouteGet(output) -} diff --git a/vendor/github.com/jackpal/gateway/gateway_freebsd.go b/vendor/github.com/jackpal/gateway/gateway_freebsd.go deleted file mode 100644 index 3d669108..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_freebsd.go +++ /dev/null @@ -1,16 +0,0 @@ -package gateway - -import ( - "net" - "os/exec" -) - -func DiscoverGateway() (ip net.IP, err error) { - routeCmd := exec.Command("netstat", "-rn") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseBSDSolarisNetstat(output) -} diff --git a/vendor/github.com/jackpal/gateway/gateway_linux.go b/vendor/github.com/jackpal/gateway/gateway_linux.go deleted file mode 100644 index aacaa88e..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_linux.go +++ /dev/null @@ -1,47 +0,0 @@ -package gateway - -import ( - "net" - "os/exec" -) - -func DiscoverGateway() (ip net.IP, err error) { - ip, err = discoverGatewayUsingRoute() - if err != nil { - ip, err = discoverGatewayUsingIpRouteShow() - } - if err != nil { - ip, err = discoverGatewayUsingIpRouteGet() - } - return -} - -func discoverGatewayUsingIpRouteShow() (net.IP, error) { - routeCmd := exec.Command("ip", "route", "show") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseLinuxIPRouteShow(output) -} - -func discoverGatewayUsingIpRouteGet() (net.IP, error) { - routeCmd := exec.Command("ip", "route", "get", "8.8.8.8") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseLinuxIPRouteGet(output) -} - -func discoverGatewayUsingRoute() (net.IP, error) { - routeCmd := exec.Command("route", "-n") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseLinuxRoute(output) -} diff --git a/vendor/github.com/jackpal/gateway/gateway_solaris.go b/vendor/github.com/jackpal/gateway/gateway_solaris.go deleted file mode 100644 index 3d669108..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_solaris.go +++ /dev/null @@ -1,16 +0,0 @@ -package gateway - -import ( - "net" - "os/exec" -) - -func DiscoverGateway() (ip net.IP, err error) { - routeCmd := exec.Command("netstat", "-rn") - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseBSDSolarisNetstat(output) -} diff --git a/vendor/github.com/jackpal/gateway/gateway_unimplemented.go b/vendor/github.com/jackpal/gateway/gateway_unimplemented.go deleted file mode 100644 index 750ac4b7..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_unimplemented.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !darwin,!linux,!windows,!solaris,!freebsd - -package gateway - -import ( - "fmt" - "net" - "runtime" -) - -func DiscoverGateway() (ip net.IP, err error) { - err = fmt.Errorf("DiscoverGateway not implemented for OS %s", runtime.GOOS) - return -} diff --git a/vendor/github.com/jackpal/gateway/gateway_windows.go b/vendor/github.com/jackpal/gateway/gateway_windows.go deleted file mode 100644 index 2419c831..00000000 --- a/vendor/github.com/jackpal/gateway/gateway_windows.go +++ /dev/null @@ -1,18 +0,0 @@ -package gateway - -import ( - "net" - "os/exec" - "syscall" -) - -func DiscoverGateway() (ip net.IP, err error) { - routeCmd := exec.Command("route", "print", "0.0.0.0") - routeCmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} - output, err := routeCmd.CombinedOutput() - if err != nil { - return nil, err - } - - return parseWindowsRoutePrint(output) -} diff --git a/vendor/github.com/jbenet/go-is-domain/.travis.yml b/vendor/github.com/jbenet/go-is-domain/.travis.yml deleted file mode 100644 index 3590e6d9..00000000 --- a/vendor/github.com/jbenet/go-is-domain/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.12.x - -env: - GO111MODULE=on - -cache: - directories: - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/jbenet/go-is-domain/LICENSE b/vendor/github.com/jbenet/go-is-domain/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/jbenet/go-is-domain/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/jbenet/go-is-domain/README.md b/vendor/github.com/jbenet/go-is-domain/README.md deleted file mode 100644 index abf48bc1..00000000 --- a/vendor/github.com/jbenet/go-is-domain/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# go-is-domain - -This package is dedicated to [@whyrusleeping](https://github.com/whyrusleeping). - -Docs: https://godoc.org/github.com/jbenet/go-is-domain - - -Check whether something is a domain. - - -```Go - -import ( - isd "github.com/jbenet/go-is-domain" -) - -isd.IsDomain("foo.com") // true -isd.IsDomain("foo.bar.com.") // true -isd.IsDomain("foo.bar.baz") // false - -``` - -MIT Licensed - -## Updating TLDs - -To update non-extended TLDs, IANA publishes, you can retrieve them from [data.iana.org](https://data.iana.org/TLD/tlds-alpha-by-domain.txt). - -After retrieving the updated list, enter them into the file `tlds-alpha-by-domain.txt`. In order to update the `TLDs` map in `tlds.go`, you can run the `gen.sh` script which will generate the contents of a `string -> bool` map. After that, you'll want to replace the contents of the existing `TLDs` map, with the one that was generated and stored in `formatted_tlds.txt` diff --git a/vendor/github.com/jbenet/go-is-domain/doc.go b/vendor/github.com/jbenet/go-is-domain/doc.go deleted file mode 100644 index db6855c4..00000000 --- a/vendor/github.com/jbenet/go-is-domain/doc.go +++ /dev/null @@ -1,13 +0,0 @@ -/* -Package isdomain package allows users to check whether strings represent domain names. - - import ( - isd "github.com/jbenet/go-is-domain" - ) - - isd.IsDomain("foo.com") // true - isd.IsDomain("foo.bar.com.") // true - isd.IsDomain("foo.bar.baz") // false - -*/ -package isdomain diff --git a/vendor/github.com/jbenet/go-is-domain/domainre.go b/vendor/github.com/jbenet/go-is-domain/domainre.go deleted file mode 100644 index b6caf4a8..00000000 --- a/vendor/github.com/jbenet/go-is-domain/domainre.go +++ /dev/null @@ -1,12 +0,0 @@ -package isdomain - -import "regexp" - -// DomainRegexpStr is a regular expression string to validate domains. -const DomainRegexpStr = "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$" - -var domainRegexp *regexp.Regexp - -func init() { - domainRegexp = regexp.MustCompile(DomainRegexpStr) -} diff --git a/vendor/github.com/jbenet/go-is-domain/go.mod b/vendor/github.com/jbenet/go-is-domain/go.mod deleted file mode 100644 index 5a4885b3..00000000 --- a/vendor/github.com/jbenet/go-is-domain/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/jbenet/go-is-domain - -go 1.12 diff --git a/vendor/github.com/jbenet/go-is-domain/is_domain.go b/vendor/github.com/jbenet/go-is-domain/is_domain.go deleted file mode 100644 index 9e6f0469..00000000 --- a/vendor/github.com/jbenet/go-is-domain/is_domain.go +++ /dev/null @@ -1,54 +0,0 @@ -package isdomain - -import ( - "strings" -) - -//go:generate bash regenerate-tlds.sh - -// IsICANNTLD returns whether the given string is a TLD (Top Level Domain), -// according to ICANN. Well, really according to the TLDs listed in this -// package. -func IsICANNTLD(s string) bool { - s = strings.ToUpper(s) - _, found := TLDs[s] - return found -} - -// IsExtendedTLD returns whether the given string is a TLD (Top Level Domain), -// extended with a few other "TLDs": .bit, .onion -func IsExtendedTLD(s string) bool { - s = strings.ToUpper(s) - _, found := ExtendedTLDs[s] - return found -} - -// IsTLD returns whether the given string is a TLD (according to ICANN, or -// in the set of ExtendedTLDs listed in this package. -func IsTLD(s string) bool { - return IsICANNTLD(s) || IsExtendedTLD(s) -} - -// IsDomain returns whether given string is a domain. -// It first checks the TLD, and then uses a regular expression. -func IsDomain(s string) bool { - if strings.HasSuffix(s, ".") { - s = s[:len(s)-1] - } - split := strings.Split(s, ".") - - // Need a TLD and a domain. - if len(split) < 2 { - return false - } - - // Check the TLD - tld := split[len(split)-1] - if !IsTLD(tld) { - return false - } - - // Check the domain. - s = strings.ToLower(s) - return domainRegexp.MatchString(s) -} diff --git a/vendor/github.com/jbenet/go-is-domain/package.json b/vendor/github.com/jbenet/go-is-domain/package.json deleted file mode 100644 index 002aea25..00000000 --- a/vendor/github.com/jbenet/go-is-domain/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "jbenet", - "bugs": { - "URL": "https://github.com/jbenet/go-is-domain/issues", - "url": "https://github.com/jbenet/go-is-domain/issues" - }, - "gx": { - "dvcsimport": "github.com/jbenet/go-is-domain" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "MIT", - "name": "go-is-domain", - "version": "1.0.2" -} - diff --git a/vendor/github.com/jbenet/go-is-domain/regenerate-tlds.sh b/vendor/github.com/jbenet/go-is-domain/regenerate-tlds.sh deleted file mode 100755 index 2420cac7..00000000 --- a/vendor/github.com/jbenet/go-is-domain/regenerate-tlds.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -out=${1-tlds_iana.go} - -list=$(mktemp) - -wget https://data.iana.org/TLD/tlds-alpha-by-domain.txt -O $list - -header=$(head -1 $list) - -cat > $out <> $out - -echo '}' >> $out - -gofmt -w $out diff --git a/vendor/github.com/jbenet/go-is-domain/tlds_custom.go b/vendor/github.com/jbenet/go-is-domain/tlds_custom.go deleted file mode 100644 index 8fe80f8c..00000000 --- a/vendor/github.com/jbenet/go-is-domain/tlds_custom.go +++ /dev/null @@ -1,8 +0,0 @@ -package isdomain - -// ExtendedTLDs is a set of additional "TLDs", allowing decentralized name -// systems, like TOR and Namecoin. -var ExtendedTLDs = map[string]bool{ - "BIT": true, - "ONION": true, -} diff --git a/vendor/github.com/jbenet/go-is-domain/tlds_iana.go b/vendor/github.com/jbenet/go-is-domain/tlds_iana.go deleted file mode 100644 index 221c0d54..00000000 --- a/vendor/github.com/jbenet/go-is-domain/tlds_iana.go +++ /dev/null @@ -1,1537 +0,0 @@ -package isdomain - -// # Version 2019032100, Last Updated Thu Mar 21 07:07:01 2019 UTC -var TLDs = map[string]bool{ - "AAA": true, - "AARP": true, - "ABARTH": true, - "ABB": true, - "ABBOTT": true, - "ABBVIE": true, - "ABC": true, - "ABLE": true, - "ABOGADO": true, - "ABUDHABI": true, - "AC": true, - "ACADEMY": true, - "ACCENTURE": true, - "ACCOUNTANT": true, - "ACCOUNTANTS": true, - "ACO": true, - "ACTOR": true, - "AD": true, - "ADAC": true, - "ADS": true, - "ADULT": true, - "AE": true, - "AEG": true, - "AERO": true, - "AETNA": true, - "AF": true, - "AFAMILYCOMPANY": true, - "AFL": true, - "AFRICA": true, - "AG": true, - "AGAKHAN": true, - "AGENCY": true, - "AI": true, - "AIG": true, - "AIGO": true, - "AIRBUS": true, - "AIRFORCE": true, - "AIRTEL": true, - "AKDN": true, - "AL": true, - "ALFAROMEO": true, - "ALIBABA": true, - "ALIPAY": true, - "ALLFINANZ": true, - "ALLSTATE": true, - "ALLY": true, - "ALSACE": true, - "ALSTOM": true, - "AM": true, - "AMERICANEXPRESS": true, - "AMERICANFAMILY": true, - "AMEX": true, - "AMFAM": true, - "AMICA": true, - "AMSTERDAM": true, - "ANALYTICS": true, - "ANDROID": true, - "ANQUAN": true, - "ANZ": true, - "AO": true, - "AOL": true, - "APARTMENTS": true, - "APP": true, - "APPLE": true, - "AQ": true, - "AQUARELLE": true, - "AR": true, - "ARAB": true, - "ARAMCO": true, - "ARCHI": true, - "ARMY": true, - "ARPA": true, - "ART": true, - "ARTE": true, - "AS": true, - "ASDA": true, - "ASIA": true, - "ASSOCIATES": true, - "AT": true, - "ATHLETA": true, - "ATTORNEY": true, - "AU": true, - "AUCTION": true, - "AUDI": true, - "AUDIBLE": true, - "AUDIO": true, - "AUSPOST": true, - "AUTHOR": true, - "AUTO": true, - "AUTOS": true, - "AVIANCA": true, - "AW": true, - "AWS": true, - "AX": true, - "AXA": true, - "AZ": true, - "AZURE": true, - "BA": true, - "BABY": true, - "BAIDU": true, - "BANAMEX": true, - "BANANAREPUBLIC": true, - "BAND": true, - "BANK": true, - "BAR": true, - "BARCELONA": true, - "BARCLAYCARD": true, - "BARCLAYS": true, - "BAREFOOT": true, - "BARGAINS": true, - "BASEBALL": true, - "BASKETBALL": true, - "BAUHAUS": true, - "BAYERN": true, - "BB": true, - "BBC": true, - "BBT": true, - "BBVA": true, - "BCG": true, - "BCN": true, - "BD": true, - "BE": true, - "BEATS": true, - "BEAUTY": true, - "BEER": true, - "BENTLEY": true, - "BERLIN": true, - "BEST": true, - "BESTBUY": true, - "BET": true, - "BF": true, - "BG": true, - "BH": true, - "BHARTI": true, - "BI": true, - "BIBLE": true, - "BID": true, - "BIKE": true, - "BING": true, - "BINGO": true, - "BIO": true, - "BIZ": true, - "BJ": true, - "BLACK": true, - "BLACKFRIDAY": true, - "BLOCKBUSTER": true, - "BLOG": true, - "BLOOMBERG": true, - "BLUE": true, - "BM": true, - "BMS": true, - "BMW": true, - "BN": true, - "BNL": true, - "BNPPARIBAS": true, - "BO": true, - "BOATS": true, - "BOEHRINGER": true, - "BOFA": true, - "BOM": true, - "BOND": true, - "BOO": true, - "BOOK": true, - "BOOKING": true, - "BOSCH": true, - "BOSTIK": true, - "BOSTON": true, - "BOT": true, - "BOUTIQUE": true, - "BOX": true, - "BR": true, - "BRADESCO": true, - "BRIDGESTONE": true, - "BROADWAY": true, - "BROKER": true, - "BROTHER": true, - "BRUSSELS": true, - "BS": true, - "BT": true, - "BUDAPEST": true, - "BUGATTI": true, - "BUILD": true, - "BUILDERS": true, - "BUSINESS": true, - "BUY": true, - "BUZZ": true, - "BV": true, - "BW": true, - "BY": true, - "BZ": true, - "BZH": true, - "CA": true, - "CAB": true, - "CAFE": true, - "CAL": true, - "CALL": true, - "CALVINKLEIN": true, - "CAM": true, - "CAMERA": true, - "CAMP": true, - "CANCERRESEARCH": true, - "CANON": true, - "CAPETOWN": true, - "CAPITAL": true, - "CAPITALONE": true, - "CAR": true, - "CARAVAN": true, - "CARDS": true, - "CARE": true, - "CAREER": true, - "CAREERS": true, - "CARS": true, - "CARTIER": true, - "CASA": true, - "CASE": true, - "CASEIH": true, - "CASH": true, - "CASINO": true, - "CAT": true, - "CATERING": true, - "CATHOLIC": true, - "CBA": true, - "CBN": true, - "CBRE": true, - "CBS": true, - "CC": true, - "CD": true, - "CEB": true, - "CENTER": true, - "CEO": true, - "CERN": true, - "CF": true, - "CFA": true, - "CFD": true, - "CG": true, - "CH": true, - "CHANEL": true, - "CHANNEL": true, - "CHARITY": true, - "CHASE": true, - "CHAT": true, - "CHEAP": true, - "CHINTAI": true, - "CHRISTMAS": true, - "CHROME": true, - "CHRYSLER": true, - "CHURCH": true, - "CI": true, - "CIPRIANI": true, - "CIRCLE": true, - "CISCO": true, - "CITADEL": true, - "CITI": true, - "CITIC": true, - "CITY": true, - "CITYEATS": true, - "CK": true, - "CL": true, - "CLAIMS": true, - "CLEANING": true, - "CLICK": true, - "CLINIC": true, - "CLINIQUE": true, - "CLOTHING": true, - "CLOUD": true, - "CLUB": true, - "CLUBMED": true, - "CM": true, - "CN": true, - "CO": true, - "COACH": true, - "CODES": true, - "COFFEE": true, - "COLLEGE": true, - "COLOGNE": true, - "COM": true, - "COMCAST": true, - "COMMBANK": true, - "COMMUNITY": true, - "COMPANY": true, - "COMPARE": true, - "COMPUTER": true, - "COMSEC": true, - "CONDOS": true, - "CONSTRUCTION": true, - "CONSULTING": true, - "CONTACT": true, - "CONTRACTORS": true, - "COOKING": true, - "COOKINGCHANNEL": true, - "COOL": true, - "COOP": true, - "CORSICA": true, - "COUNTRY": true, - "COUPON": true, - "COUPONS": true, - "COURSES": true, - "CR": true, - "CREDIT": true, - "CREDITCARD": true, - "CREDITUNION": true, - "CRICKET": true, - "CROWN": true, - "CRS": true, - "CRUISE": true, - "CRUISES": true, - "CSC": true, - "CU": true, - "CUISINELLA": true, - "CV": true, - "CW": true, - "CX": true, - "CY": true, - "CYMRU": true, - "CYOU": true, - "CZ": true, - "DABUR": true, - "DAD": true, - "DANCE": true, - "DATA": true, - "DATE": true, - "DATING": true, - "DATSUN": true, - "DAY": true, - "DCLK": true, - "DDS": true, - "DE": true, - "DEAL": true, - "DEALER": true, - "DEALS": true, - "DEGREE": true, - "DELIVERY": true, - "DELL": true, - "DELOITTE": true, - "DELTA": true, - "DEMOCRAT": true, - "DENTAL": true, - "DENTIST": true, - "DESI": true, - "DESIGN": true, - "DEV": true, - "DHL": true, - "DIAMONDS": true, - "DIET": true, - "DIGITAL": true, - "DIRECT": true, - "DIRECTORY": true, - "DISCOUNT": true, - "DISCOVER": true, - "DISH": true, - "DIY": true, - "DJ": true, - "DK": true, - "DM": true, - "DNP": true, - "DO": true, - "DOCS": true, - "DOCTOR": true, - "DODGE": true, - "DOG": true, - "DOHA": true, - "DOMAINS": true, - "DOT": true, - "DOWNLOAD": true, - "DRIVE": true, - "DTV": true, - "DUBAI": true, - "DUCK": true, - "DUNLOP": true, - "DUNS": true, - "DUPONT": true, - "DURBAN": true, - "DVAG": true, - "DVR": true, - "DZ": true, - "EARTH": true, - "EAT": true, - "EC": true, - "ECO": true, - "EDEKA": true, - "EDU": true, - "EDUCATION": true, - "EE": true, - "EG": true, - "EMAIL": true, - "EMERCK": true, - "ENERGY": true, - "ENGINEER": true, - "ENGINEERING": true, - "ENTERPRISES": true, - "EPSON": true, - "EQUIPMENT": true, - "ER": true, - "ERICSSON": true, - "ERNI": true, - "ES": true, - "ESQ": true, - "ESTATE": true, - "ESURANCE": true, - "ET": true, - "ETISALAT": true, - "EU": true, - "EUROVISION": true, - "EUS": true, - "EVENTS": true, - "EVERBANK": true, - "EXCHANGE": true, - "EXPERT": true, - "EXPOSED": true, - "EXPRESS": true, - "EXTRASPACE": true, - "FAGE": true, - "FAIL": true, - "FAIRWINDS": true, - "FAITH": true, - "FAMILY": true, - "FAN": true, - "FANS": true, - "FARM": true, - "FARMERS": true, - "FASHION": true, - "FAST": true, - "FEDEX": true, - "FEEDBACK": true, - "FERRARI": true, - "FERRERO": true, - "FI": true, - "FIAT": true, - "FIDELITY": true, - "FIDO": true, - "FILM": true, - "FINAL": true, - "FINANCE": true, - "FINANCIAL": true, - "FIRE": true, - "FIRESTONE": true, - "FIRMDALE": true, - "FISH": true, - "FISHING": true, - "FIT": true, - "FITNESS": true, - "FJ": true, - "FK": true, - "FLICKR": true, - "FLIGHTS": true, - "FLIR": true, - "FLORIST": true, - "FLOWERS": true, - "FLY": true, - "FM": true, - "FO": true, - "FOO": true, - "FOOD": true, - "FOODNETWORK": true, - "FOOTBALL": true, - "FORD": true, - "FOREX": true, - "FORSALE": true, - "FORUM": true, - "FOUNDATION": true, - "FOX": true, - "FR": true, - "FREE": true, - "FRESENIUS": true, - "FRL": true, - "FROGANS": true, - "FRONTDOOR": true, - "FRONTIER": true, - "FTR": true, - "FUJITSU": true, - "FUJIXEROX": true, - "FUN": true, - "FUND": true, - "FURNITURE": true, - "FUTBOL": true, - "FYI": true, - "GA": true, - "GAL": true, - "GALLERY": true, - "GALLO": true, - "GALLUP": true, - "GAME": true, - "GAMES": true, - "GAP": true, - "GARDEN": true, - "GB": true, - "GBIZ": true, - "GD": true, - "GDN": true, - "GE": true, - "GEA": true, - "GENT": true, - "GENTING": true, - "GEORGE": true, - "GF": true, - "GG": true, - "GGEE": true, - "GH": true, - "GI": true, - "GIFT": true, - "GIFTS": true, - "GIVES": true, - "GIVING": true, - "GL": true, - "GLADE": true, - "GLASS": true, - "GLE": true, - "GLOBAL": true, - "GLOBO": true, - "GM": true, - "GMAIL": true, - "GMBH": true, - "GMO": true, - "GMX": true, - "GN": true, - "GODADDY": true, - "GOLD": true, - "GOLDPOINT": true, - "GOLF": true, - "GOO": true, - "GOODYEAR": true, - "GOOG": true, - "GOOGLE": true, - "GOP": true, - "GOT": true, - "GOV": true, - "GP": true, - "GQ": true, - "GR": true, - "GRAINGER": true, - "GRAPHICS": true, - "GRATIS": true, - "GREEN": true, - "GRIPE": true, - "GROCERY": true, - "GROUP": true, - "GS": true, - "GT": true, - "GU": true, - "GUARDIAN": true, - "GUCCI": true, - "GUGE": true, - "GUIDE": true, - "GUITARS": true, - "GURU": true, - "GW": true, - "GY": true, - "HAIR": true, - "HAMBURG": true, - "HANGOUT": true, - "HAUS": true, - "HBO": true, - "HDFC": true, - "HDFCBANK": true, - "HEALTH": true, - "HEALTHCARE": true, - "HELP": true, - "HELSINKI": true, - "HERE": true, - "HERMES": true, - "HGTV": true, - "HIPHOP": true, - "HISAMITSU": true, - "HITACHI": true, - "HIV": true, - "HK": true, - "HKT": true, - "HM": true, - "HN": true, - "HOCKEY": true, - "HOLDINGS": true, - "HOLIDAY": true, - "HOMEDEPOT": true, - "HOMEGOODS": true, - "HOMES": true, - "HOMESENSE": true, - "HONDA": true, - "HONEYWELL": true, - "HORSE": true, - "HOSPITAL": true, - "HOST": true, - "HOSTING": true, - "HOT": true, - "HOTELES": true, - "HOTELS": true, - "HOTMAIL": true, - "HOUSE": true, - "HOW": true, - "HR": true, - "HSBC": true, - "HT": true, - "HU": true, - "HUGHES": true, - "HYATT": true, - "HYUNDAI": true, - "IBM": true, - "ICBC": true, - "ICE": true, - "ICU": true, - "ID": true, - "IE": true, - "IEEE": true, - "IFM": true, - "IKANO": true, - "IL": true, - "IM": true, - "IMAMAT": true, - "IMDB": true, - "IMMO": true, - "IMMOBILIEN": true, - "IN": true, - "INC": true, - "INDUSTRIES": true, - "INFINITI": true, - "INFO": true, - "ING": true, - "INK": true, - "INSTITUTE": true, - "INSURANCE": true, - "INSURE": true, - "INT": true, - "INTEL": true, - "INTERNATIONAL": true, - "INTUIT": true, - "INVESTMENTS": true, - "IO": true, - "IPIRANGA": true, - "IQ": true, - "IR": true, - "IRISH": true, - "IS": true, - "ISELECT": true, - "ISMAILI": true, - "IST": true, - "ISTANBUL": true, - "IT": true, - "ITAU": true, - "ITV": true, - "IVECO": true, - "JAGUAR": true, - "JAVA": true, - "JCB": true, - "JCP": true, - "JE": true, - "JEEP": true, - "JETZT": true, - "JEWELRY": true, - "JIO": true, - "JLL": true, - "JM": true, - "JMP": true, - "JNJ": true, - "JO": true, - "JOBS": true, - "JOBURG": true, - "JOT": true, - "JOY": true, - "JP": true, - "JPMORGAN": true, - "JPRS": true, - "JUEGOS": true, - "JUNIPER": true, - "KAUFEN": true, - "KDDI": true, - "KE": true, - "KERRYHOTELS": true, - "KERRYLOGISTICS": true, - "KERRYPROPERTIES": true, - "KFH": true, - "KG": true, - "KH": true, - "KI": true, - "KIA": true, - "KIM": true, - "KINDER": true, - "KINDLE": true, - "KITCHEN": true, - "KIWI": true, - "KM": true, - "KN": true, - "KOELN": true, - "KOMATSU": true, - "KOSHER": true, - "KP": true, - "KPMG": true, - "KPN": true, - "KR": true, - "KRD": true, - "KRED": true, - "KUOKGROUP": true, - "KW": true, - "KY": true, - "KYOTO": true, - "KZ": true, - "LA": true, - "LACAIXA": true, - "LADBROKES": true, - "LAMBORGHINI": true, - "LAMER": true, - "LANCASTER": true, - "LANCIA": true, - "LANCOME": true, - "LAND": true, - "LANDROVER": true, - "LANXESS": true, - "LASALLE": true, - "LAT": true, - "LATINO": true, - "LATROBE": true, - "LAW": true, - "LAWYER": true, - "LB": true, - "LC": true, - "LDS": true, - "LEASE": true, - "LECLERC": true, - "LEFRAK": true, - "LEGAL": true, - "LEGO": true, - "LEXUS": true, - "LGBT": true, - "LI": true, - "LIAISON": true, - "LIDL": true, - "LIFE": true, - "LIFEINSURANCE": true, - "LIFESTYLE": true, - "LIGHTING": true, - "LIKE": true, - "LILLY": true, - "LIMITED": true, - "LIMO": true, - "LINCOLN": true, - "LINDE": true, - "LINK": true, - "LIPSY": true, - "LIVE": true, - "LIVING": true, - "LIXIL": true, - "LK": true, - "LLC": true, - "LOAN": true, - "LOANS": true, - "LOCKER": true, - "LOCUS": true, - "LOFT": true, - "LOL": true, - "LONDON": true, - "LOTTE": true, - "LOTTO": true, - "LOVE": true, - "LPL": true, - "LPLFINANCIAL": true, - "LR": true, - "LS": true, - "LT": true, - "LTD": true, - "LTDA": true, - "LU": true, - "LUNDBECK": true, - "LUPIN": true, - "LUXE": true, - "LUXURY": true, - "LV": true, - "LY": true, - "MA": true, - "MACYS": true, - "MADRID": true, - "MAIF": true, - "MAISON": true, - "MAKEUP": true, - "MAN": true, - "MANAGEMENT": true, - "MANGO": true, - "MAP": true, - "MARKET": true, - "MARKETING": true, - "MARKETS": true, - "MARRIOTT": true, - "MARSHALLS": true, - "MASERATI": true, - "MATTEL": true, - "MBA": true, - "MC": true, - "MCKINSEY": true, - "MD": true, - "ME": true, - "MED": true, - "MEDIA": true, - "MEET": true, - "MELBOURNE": true, - "MEME": true, - "MEMORIAL": true, - "MEN": true, - "MENU": true, - "MERCKMSD": true, - "METLIFE": true, - "MG": true, - "MH": true, - "MIAMI": true, - "MICROSOFT": true, - "MIL": true, - "MINI": true, - "MINT": true, - "MIT": true, - "MITSUBISHI": true, - "MK": true, - "ML": true, - "MLB": true, - "MLS": true, - "MM": true, - "MMA": true, - "MN": true, - "MO": true, - "MOBI": true, - "MOBILE": true, - "MOBILY": true, - "MODA": true, - "MOE": true, - "MOI": true, - "MOM": true, - "MONASH": true, - "MONEY": true, - "MONSTER": true, - "MOPAR": true, - "MORMON": true, - "MORTGAGE": true, - "MOSCOW": true, - "MOTO": true, - "MOTORCYCLES": true, - "MOV": true, - "MOVIE": true, - "MOVISTAR": true, - "MP": true, - "MQ": true, - "MR": true, - "MS": true, - "MSD": true, - "MT": true, - "MTN": true, - "MTR": true, - "MU": true, - "MUSEUM": true, - "MUTUAL": true, - "MV": true, - "MW": true, - "MX": true, - "MY": true, - "MZ": true, - "NA": true, - "NAB": true, - "NADEX": true, - "NAGOYA": true, - "NAME": true, - "NATIONWIDE": true, - "NATURA": true, - "NAVY": true, - "NBA": true, - "NC": true, - "NE": true, - "NEC": true, - "NET": true, - "NETBANK": true, - "NETFLIX": true, - "NETWORK": true, - "NEUSTAR": true, - "NEW": true, - "NEWHOLLAND": true, - "NEWS": true, - "NEXT": true, - "NEXTDIRECT": true, - "NEXUS": true, - "NF": true, - "NFL": true, - "NG": true, - "NGO": true, - "NHK": true, - "NI": true, - "NICO": true, - "NIKE": true, - "NIKON": true, - "NINJA": true, - "NISSAN": true, - "NISSAY": true, - "NL": true, - "NO": true, - "NOKIA": true, - "NORTHWESTERNMUTUAL": true, - "NORTON": true, - "NOW": true, - "NOWRUZ": true, - "NOWTV": true, - "NP": true, - "NR": true, - "NRA": true, - "NRW": true, - "NTT": true, - "NU": true, - "NYC": true, - "NZ": true, - "OBI": true, - "OBSERVER": true, - "OFF": true, - "OFFICE": true, - "OKINAWA": true, - "OLAYAN": true, - "OLAYANGROUP": true, - "OLDNAVY": true, - "OLLO": true, - "OM": true, - "OMEGA": true, - "ONE": true, - "ONG": true, - "ONL": true, - "ONLINE": true, - "ONYOURSIDE": true, - "OOO": true, - "OPEN": true, - "ORACLE": true, - "ORANGE": true, - "ORG": true, - "ORGANIC": true, - "ORIGINS": true, - "OSAKA": true, - "OTSUKA": true, - "OTT": true, - "OVH": true, - "PA": true, - "PAGE": true, - "PANASONIC": true, - "PARIS": true, - "PARS": true, - "PARTNERS": true, - "PARTS": true, - "PARTY": true, - "PASSAGENS": true, - "PAY": true, - "PCCW": true, - "PE": true, - "PET": true, - "PF": true, - "PFIZER": true, - "PG": true, - "PH": true, - "PHARMACY": true, - "PHD": true, - "PHILIPS": true, - "PHONE": true, - "PHOTO": true, - "PHOTOGRAPHY": true, - "PHOTOS": true, - "PHYSIO": true, - "PIAGET": true, - "PICS": true, - "PICTET": true, - "PICTURES": true, - "PID": true, - "PIN": true, - "PING": true, - "PINK": true, - "PIONEER": true, - "PIZZA": true, - "PK": true, - "PL": true, - "PLACE": true, - "PLAY": true, - "PLAYSTATION": true, - "PLUMBING": true, - "PLUS": true, - "PM": true, - "PN": true, - "PNC": true, - "POHL": true, - "POKER": true, - "POLITIE": true, - "PORN": true, - "POST": true, - "PR": true, - "PRAMERICA": true, - "PRAXI": true, - "PRESS": true, - "PRIME": true, - "PRO": true, - "PROD": true, - "PRODUCTIONS": true, - "PROF": true, - "PROGRESSIVE": true, - "PROMO": true, - "PROPERTIES": true, - "PROPERTY": true, - "PROTECTION": true, - "PRU": true, - "PRUDENTIAL": true, - "PS": true, - "PT": true, - "PUB": true, - "PW": true, - "PWC": true, - "PY": true, - "QA": true, - "QPON": true, - "QUEBEC": true, - "QUEST": true, - "QVC": true, - "RACING": true, - "RADIO": true, - "RAID": true, - "RE": true, - "READ": true, - "REALESTATE": true, - "REALTOR": true, - "REALTY": true, - "RECIPES": true, - "RED": true, - "REDSTONE": true, - "REDUMBRELLA": true, - "REHAB": true, - "REISE": true, - "REISEN": true, - "REIT": true, - "RELIANCE": true, - "REN": true, - "RENT": true, - "RENTALS": true, - "REPAIR": true, - "REPORT": true, - "REPUBLICAN": true, - "REST": true, - "RESTAURANT": true, - "REVIEW": true, - "REVIEWS": true, - "REXROTH": true, - "RICH": true, - "RICHARDLI": true, - "RICOH": true, - "RIGHTATHOME": true, - "RIL": true, - "RIO": true, - "RIP": true, - "RMIT": true, - "RO": true, - "ROCHER": true, - "ROCKS": true, - "RODEO": true, - "ROGERS": true, - "ROOM": true, - "RS": true, - "RSVP": true, - "RU": true, - "RUGBY": true, - "RUHR": true, - "RUN": true, - "RW": true, - "RWE": true, - "RYUKYU": true, - "SA": true, - "SAARLAND": true, - "SAFE": true, - "SAFETY": true, - "SAKURA": true, - "SALE": true, - "SALON": true, - "SAMSCLUB": true, - "SAMSUNG": true, - "SANDVIK": true, - "SANDVIKCOROMANT": true, - "SANOFI": true, - "SAP": true, - "SARL": true, - "SAS": true, - "SAVE": true, - "SAXO": true, - "SB": true, - "SBI": true, - "SBS": true, - "SC": true, - "SCA": true, - "SCB": true, - "SCHAEFFLER": true, - "SCHMIDT": true, - "SCHOLARSHIPS": true, - "SCHOOL": true, - "SCHULE": true, - "SCHWARZ": true, - "SCIENCE": true, - "SCJOHNSON": true, - "SCOR": true, - "SCOT": true, - "SD": true, - "SE": true, - "SEARCH": true, - "SEAT": true, - "SECURE": true, - "SECURITY": true, - "SEEK": true, - "SELECT": true, - "SENER": true, - "SERVICES": true, - "SES": true, - "SEVEN": true, - "SEW": true, - "SEX": true, - "SEXY": true, - "SFR": true, - "SG": true, - "SH": true, - "SHANGRILA": true, - "SHARP": true, - "SHAW": true, - "SHELL": true, - "SHIA": true, - "SHIKSHA": true, - "SHOES": true, - "SHOP": true, - "SHOPPING": true, - "SHOUJI": true, - "SHOW": true, - "SHOWTIME": true, - "SHRIRAM": true, - "SI": true, - "SILK": true, - "SINA": true, - "SINGLES": true, - "SITE": true, - "SJ": true, - "SK": true, - "SKI": true, - "SKIN": true, - "SKY": true, - "SKYPE": true, - "SL": true, - "SLING": true, - "SM": true, - "SMART": true, - "SMILE": true, - "SN": true, - "SNCF": true, - "SO": true, - "SOCCER": true, - "SOCIAL": true, - "SOFTBANK": true, - "SOFTWARE": true, - "SOHU": true, - "SOLAR": true, - "SOLUTIONS": true, - "SONG": true, - "SONY": true, - "SOY": true, - "SPACE": true, - "SPORT": true, - "SPOT": true, - "SPREADBETTING": true, - "SR": true, - "SRL": true, - "SRT": true, - "SS": true, - "ST": true, - "STADA": true, - "STAPLES": true, - "STAR": true, - "STARHUB": true, - "STATEBANK": true, - "STATEFARM": true, - "STC": true, - "STCGROUP": true, - "STOCKHOLM": true, - "STORAGE": true, - "STORE": true, - "STREAM": true, - "STUDIO": true, - "STUDY": true, - "STYLE": true, - "SU": true, - "SUCKS": true, - "SUPPLIES": true, - "SUPPLY": true, - "SUPPORT": true, - "SURF": true, - "SURGERY": true, - "SUZUKI": true, - "SV": true, - "SWATCH": true, - "SWIFTCOVER": true, - "SWISS": true, - "SX": true, - "SY": true, - "SYDNEY": true, - "SYMANTEC": true, - "SYSTEMS": true, - "SZ": true, - "TAB": true, - "TAIPEI": true, - "TALK": true, - "TAOBAO": true, - "TARGET": true, - "TATAMOTORS": true, - "TATAR": true, - "TATTOO": true, - "TAX": true, - "TAXI": true, - "TC": true, - "TCI": true, - "TD": true, - "TDK": true, - "TEAM": true, - "TECH": true, - "TECHNOLOGY": true, - "TEL": true, - "TELEFONICA": true, - "TEMASEK": true, - "TENNIS": true, - "TEVA": true, - "TF": true, - "TG": true, - "TH": true, - "THD": true, - "THEATER": true, - "THEATRE": true, - "TIAA": true, - "TICKETS": true, - "TIENDA": true, - "TIFFANY": true, - "TIPS": true, - "TIRES": true, - "TIROL": true, - "TJ": true, - "TJMAXX": true, - "TJX": true, - "TK": true, - "TKMAXX": true, - "TL": true, - "TM": true, - "TMALL": true, - "TN": true, - "TO": true, - "TODAY": true, - "TOKYO": true, - "TOOLS": true, - "TOP": true, - "TORAY": true, - "TOSHIBA": true, - "TOTAL": true, - "TOURS": true, - "TOWN": true, - "TOYOTA": true, - "TOYS": true, - "TR": true, - "TRADE": true, - "TRADING": true, - "TRAINING": true, - "TRAVEL": true, - "TRAVELCHANNEL": true, - "TRAVELERS": true, - "TRAVELERSINSURANCE": true, - "TRUST": true, - "TRV": true, - "TT": true, - "TUBE": true, - "TUI": true, - "TUNES": true, - "TUSHU": true, - "TV": true, - "TVS": true, - "TW": true, - "TZ": true, - "UA": true, - "UBANK": true, - "UBS": true, - "UCONNECT": true, - "UG": true, - "UK": true, - "UNICOM": true, - "UNIVERSITY": true, - "UNO": true, - "UOL": true, - "UPS": true, - "US": true, - "UY": true, - "UZ": true, - "VA": true, - "VACATIONS": true, - "VANA": true, - "VANGUARD": true, - "VC": true, - "VE": true, - "VEGAS": true, - "VENTURES": true, - "VERISIGN": true, - "VERSICHERUNG": true, - "VET": true, - "VG": true, - "VI": true, - "VIAJES": true, - "VIDEO": true, - "VIG": true, - "VIKING": true, - "VILLAS": true, - "VIN": true, - "VIP": true, - "VIRGIN": true, - "VISA": true, - "VISION": true, - "VISTAPRINT": true, - "VIVA": true, - "VIVO": true, - "VLAANDEREN": true, - "VN": true, - "VODKA": true, - "VOLKSWAGEN": true, - "VOLVO": true, - "VOTE": true, - "VOTING": true, - "VOTO": true, - "VOYAGE": true, - "VU": true, - "VUELOS": true, - "WALES": true, - "WALMART": true, - "WALTER": true, - "WANG": true, - "WANGGOU": true, - "WARMAN": true, - "WATCH": true, - "WATCHES": true, - "WEATHER": true, - "WEATHERCHANNEL": true, - "WEBCAM": true, - "WEBER": true, - "WEBSITE": true, - "WED": true, - "WEDDING": true, - "WEIBO": true, - "WEIR": true, - "WF": true, - "WHOSWHO": true, - "WIEN": true, - "WIKI": true, - "WILLIAMHILL": true, - "WIN": true, - "WINDOWS": true, - "WINE": true, - "WINNERS": true, - "WME": true, - "WOLTERSKLUWER": true, - "WOODSIDE": true, - "WORK": true, - "WORKS": true, - "WORLD": true, - "WOW": true, - "WS": true, - "WTC": true, - "WTF": true, - "XBOX": true, - "XEROX": true, - "XFINITY": true, - "XIHUAN": true, - "XIN": true, - "XN--11B4C3D": true, - "XN--1CK2E1B": true, - "XN--1QQW23A": true, - "XN--2SCRJ9C": true, - "XN--30RR7Y": true, - "XN--3BST00M": true, - "XN--3DS443G": true, - "XN--3E0B707E": true, - "XN--3HCRJ9C": true, - "XN--3OQ18VL8PN36A": true, - "XN--3PXU8K": true, - "XN--42C2D9A": true, - "XN--45BR5CYL": true, - "XN--45BRJ9C": true, - "XN--45Q11C": true, - "XN--4GBRIM": true, - "XN--54B7FTA0CC": true, - "XN--55QW42G": true, - "XN--55QX5D": true, - "XN--5SU34J936BGSG": true, - "XN--5TZM5G": true, - "XN--6FRZ82G": true, - "XN--6QQ986B3XL": true, - "XN--80ADXHKS": true, - "XN--80AO21A": true, - "XN--80AQECDR1A": true, - "XN--80ASEHDB": true, - "XN--80ASWG": true, - "XN--8Y0A063A": true, - "XN--90A3AC": true, - "XN--90AE": true, - "XN--90AIS": true, - "XN--9DBQ2A": true, - "XN--9ET52U": true, - "XN--9KRT00A": true, - "XN--B4W605FERD": true, - "XN--BCK1B9A5DRE4C": true, - "XN--C1AVG": true, - "XN--C2BR7G": true, - "XN--CCK2B3B": true, - "XN--CG4BKI": true, - "XN--CLCHC0EA0B2G2A9GCD": true, - "XN--CZR694B": true, - "XN--CZRS0T": true, - "XN--CZRU2D": true, - "XN--D1ACJ3B": true, - "XN--D1ALF": true, - "XN--E1A4C": true, - "XN--ECKVDTC9D": true, - "XN--EFVY88H": true, - "XN--ESTV75G": true, - "XN--FCT429K": true, - "XN--FHBEI": true, - "XN--FIQ228C5HS": true, - "XN--FIQ64B": true, - "XN--FIQS8S": true, - "XN--FIQZ9S": true, - "XN--FJQ720A": true, - "XN--FLW351E": true, - "XN--FPCRJ9C3D": true, - "XN--FZC2C9E2C": true, - "XN--FZYS8D69UVGM": true, - "XN--G2XX48C": true, - "XN--GCKR3F0F": true, - "XN--GECRJ9C": true, - "XN--GK3AT1E": true, - "XN--H2BREG3EVE": true, - "XN--H2BRJ9C": true, - "XN--H2BRJ9C8C": true, - "XN--HXT814E": true, - "XN--I1B6B1A6A2E": true, - "XN--IMR513N": true, - "XN--IO0A7I": true, - "XN--J1AEF": true, - "XN--J1AMH": true, - "XN--J6W193G": true, - "XN--JLQ61U9W7B": true, - "XN--JVR189M": true, - "XN--KCRX77D1X4A": true, - "XN--KPRW13D": true, - "XN--KPRY57D": true, - "XN--KPU716F": true, - "XN--KPUT3I": true, - "XN--L1ACC": true, - "XN--LGBBAT1AD8J": true, - "XN--MGB9AWBF": true, - "XN--MGBA3A3EJT": true, - "XN--MGBA3A4F16A": true, - "XN--MGBA7C0BBN0A": true, - "XN--MGBAAKC7DVF": true, - "XN--MGBAAM7A8H": true, - "XN--MGBAB2BD": true, - "XN--MGBAH1A3HJKRD": true, - "XN--MGBAI9AZGQP6J": true, - "XN--MGBAYH7GPA": true, - "XN--MGBB9FBPOB": true, - "XN--MGBBH1A": true, - "XN--MGBBH1A71E": true, - "XN--MGBC0A9AZCG": true, - "XN--MGBCA7DZDO": true, - "XN--MGBERP4A5D4AR": true, - "XN--MGBGU82A": true, - "XN--MGBI4ECEXP": true, - "XN--MGBPL2FH": true, - "XN--MGBT3DHD": true, - "XN--MGBTX2B": true, - "XN--MGBX4CD0AB": true, - "XN--MIX891F": true, - "XN--MK1BU44C": true, - "XN--MXTQ1M": true, - "XN--NGBC5AZD": true, - "XN--NGBE9E0A": true, - "XN--NGBRX": true, - "XN--NODE": true, - "XN--NQV7F": true, - "XN--NQV7FS00EMA": true, - "XN--NYQY26A": true, - "XN--O3CW4H": true, - "XN--OGBPF8FL": true, - "XN--OTU796D": true, - "XN--P1ACF": true, - "XN--P1AI": true, - "XN--PBT977C": true, - "XN--PGBS0DH": true, - "XN--PSSY2U": true, - "XN--Q9JYB4C": true, - "XN--QCKA1PMC": true, - "XN--QXAM": true, - "XN--RHQV96G": true, - "XN--ROVU88B": true, - "XN--RVC1E0AM3E": true, - "XN--S9BRJ9C": true, - "XN--SES554G": true, - "XN--T60B56A": true, - "XN--TCKWE": true, - "XN--TIQ49XQYJ": true, - "XN--UNUP4Y": true, - "XN--VERMGENSBERATER-CTB": true, - "XN--VERMGENSBERATUNG-PWB": true, - "XN--VHQUV": true, - "XN--VUQ861B": true, - "XN--W4R85EL8FHU5DNRA": true, - "XN--W4RS40L": true, - "XN--WGBH1C": true, - "XN--WGBL6A": true, - "XN--XHQ521B": true, - "XN--XKC2AL3HYE2A": true, - "XN--XKC2DL3A5EE0H": true, - "XN--Y9A3AQ": true, - "XN--YFRO4I67O": true, - "XN--YGBI2AMMX": true, - "XN--ZFR164B": true, - "XXX": true, - "XYZ": true, - "YACHTS": true, - "YAHOO": true, - "YAMAXUN": true, - "YANDEX": true, - "YE": true, - "YODOBASHI": true, - "YOGA": true, - "YOKOHAMA": true, - "YOU": true, - "YOUTUBE": true, - "YT": true, - "YUN": true, - "ZA": true, - "ZAPPOS": true, - "ZARA": true, - "ZERO": true, - "ZIP": true, - "ZM": true, - "ZONE": true, - "ZUERICH": true, - "ZW": true, -} diff --git a/vendor/github.com/jbenet/go-temp-err-catcher/.travis.yml b/vendor/github.com/jbenet/go-temp-err-catcher/.travis.yml deleted file mode 100644 index 7b571f40..00000000 --- a/vendor/github.com/jbenet/go-temp-err-catcher/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.3 - - release - - tip - -script: - - go test -race -cpu=5 -v ./... diff --git a/vendor/github.com/jbenet/go-temp-err-catcher/LICENSE b/vendor/github.com/jbenet/go-temp-err-catcher/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/jbenet/go-temp-err-catcher/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/jbenet/go-temp-err-catcher/README.md b/vendor/github.com/jbenet/go-temp-err-catcher/README.md deleted file mode 100644 index acd4cf53..00000000 --- a/vendor/github.com/jbenet/go-temp-err-catcher/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# go-temp-err-catcher - -This is a little package to use with your net.Listeners. - -Docs: https://godoc.org/github.com/jbenet/go-temp-err-catcher - -Get: - - go get github.com/jbenet/go-temp-err-catcher - -## Examples - -It is meant to be used with things like net.Lister.Accept: - -```go -import ( - tec "github.com/jbenet/go-temp-err-catcher" -) - -func listen(listener net.Listener) { - var c tec.TempErrCatcher - - for { - conn, err := listener.Accept() - if err != nil && c.IsTemporary(c) { - continue - } - return conn, err - } -} -``` - -You can make your errors implement `Temporary`: - -```go -type errTemp struct { - e error -} - -func (e errTemp) Temporary() bool { - return true -} - -func (e errTemp) Error() string { - return e.e.Error() -} - -err := errors.New("beep boop") -var c tec.TempErrCatcher -c.IsTemporary(err) // false -c.IsTemporary(errTemp{err}) // true -``` - -Or just use `ErrTemp`: - -```go -err := errors.New("beep boop") -var c tec.TempErrCatcher -c.IsTemporary(err) // false -c.IsTemporary(tec.ErrTemp{err}) // true -``` - - -You can also define an `IsTemp` function to classify errors: - -```go -var ErrSkip = errors.New("this should be skipped") -var ErrNotSkip = errors.New("this should not be skipped") - -var c tec.TempErrCatcher -c.IsTemp = func(e error) bool { - return e == ErrSkip -} - -c.IsTemporary(ErrSkip) // true -c.IsTemporary(ErrNotSkip) // false -c.IsTemporary(ErrTemp) // false! no longer accepts Temporary() -``` diff --git a/vendor/github.com/jbenet/go-temp-err-catcher/doc.go b/vendor/github.com/jbenet/go-temp-err-catcher/doc.go deleted file mode 100644 index 766c8b6f..00000000 --- a/vendor/github.com/jbenet/go-temp-err-catcher/doc.go +++ /dev/null @@ -1,62 +0,0 @@ -// Package temperrcatcher provides a TempErrCatcher object, -// which implements simple error-retrying functionality. -// It is meant to be used with things like net.Lister.Accept: -// -// import ( -// tec "github.com/jbenet/go-temp-err-catcher" -// ) -// -// func listen(listener net.Listener) { -// var c tec.TempErrCatcher -// -// for { -// conn, err := listener.Accept() -// if err != nil && c.IsTemporary(c) { -// continue -// } -// return conn, err -// } -// } -// -// You can make your errors implement `Temporary`: -// -// type errTemp struct { -// e error -// } -// -// func (e errTemp) Temporary() bool { -// return true -// } -// -// func (e errTemp) Error() string { -// return e.e.Error() -// } -// -// err := errors.New("beep boop") -// var c tec.TempErrCatcher -// c.IsTemporary(err) // false -// c.IsTemporary(errTemp{err}) // true -// -// Or just use `ErrTemp`: -// -// err := errors.New("beep boop") -// var c tec.TempErrCatcher -// c.IsTemporary(err) // false -// c.IsTemporary(tec.ErrTemp{err}) // true -// -// -// You can also define an `IsTemp` function to classify errors: -// -// var ErrSkip = errors.New("this should be skipped") -// var ErrNotSkip = errors.New("this should not be skipped") -// -// var c tec.TempErrCatcher -// c.IsTemp = func(e error) bool { -// return e == ErrSkip -// } -// -// c.IsTemporary(ErrSkip) // true -// c.IsTemporary(ErrNotSkip) // false -// c.IsTemporary(ErrTemp) // false! no longer accepts Temporary() -// -package temperrcatcher diff --git a/vendor/github.com/jbenet/go-temp-err-catcher/temp_err_catcher.go b/vendor/github.com/jbenet/go-temp-err-catcher/temp_err_catcher.go deleted file mode 100644 index fe8e780c..00000000 --- a/vendor/github.com/jbenet/go-temp-err-catcher/temp_err_catcher.go +++ /dev/null @@ -1,124 +0,0 @@ -// Package temperrcatcher provides a TempErrCatcher object, -// which implements simple error-retrying functionality. -package temperrcatcher - -import ( - "time" -) - -// InitialDelay governs how long to wait the first time. -// This is defaulted to time.Millisecond, which makes sense -// for network listener failures. You may want a much smaller -// delay. You can configure this package wide, or in each -// TempErrCatcher -var InitialDelay = time.Millisecond - -// Temporary is an interface errors can implement to -// ensure they are correctly classified by the default -// TempErrCatcher classifier -type Temporary interface { - Temporary() bool -} - -// ErrIsTemporary returns whether an error is Temporary(), -// iff it implements the Temporary interface. -func ErrIsTemporary(e error) bool { - te, ok := e.(Temporary) - return ok && te.Temporary() -} - -// TempErrCatcher catches temporary errors for you. It then sleeps -// for a bit before returning (you should then try again). This may -// seem odd, but it's exactly what net/http does: -// http://golang.org/src/net/http/server.go?s=51504:51550#L1728 -// -// You can set a few options in TempErrCatcher. They all have defaults -// so a zero TempErrCatcher is ready to be used: -// -// var c tec.TempErrCatcher -// c.IsTemporary(tempErr) -// -type TempErrCatcher struct { - IsTemp func(error) bool // the classifier to use. default: ErrIsTemporary - Wait func(time.Duration) // the wait func to call. default: time.Sleep - Max time.Duration // the maximum time to wait. default: time.Second - Start time.Duration // the delay to start with. default: InitialDelay - delay time.Duration - last time.Time -} - -func (tec *TempErrCatcher) init() { - if tec.Max == 0 { - tec.Max = time.Second - } - if tec.IsTemp == nil { - tec.IsTemp = ErrIsTemporary - } - if tec.Wait == nil { - tec.Wait = time.Sleep - } - if tec.Start == 0 { - tec.Start = InitialDelay - } -} - -// IsTemporary checks whether an error is temporary. It will call -// tec.Wait before returning, with a delay. The delay is also -// doubled, so we do not constantly spin. This is the strategy -// net.Listener uses. -// -// Note: you will want to call Reset() if you get a success, -// so that the stored delay is brough back to 0. -func (tec *TempErrCatcher) IsTemporary(e error) bool { - tec.init() - if tec.IsTemp(e) { - now := time.Now() - if now.Sub(tec.last) > (tec.delay * 5) { - // this is a "new streak" of temp failures. reset. - tec.Reset() - } - - if tec.delay == 0 { // init case. - tec.delay = tec.Start - } else { - tec.delay *= 2 - } - - if tec.delay > tec.Max { - tec.delay = tec.Max - } - tec.Wait(tec.delay) - tec.last = now - return true - } - tec.Reset() // different failure. call reset - return false -} - -// Reset sets the internal delay counter to 0 -func (tec *TempErrCatcher) Reset() { - tec.delay = 0 -} - -// ErrTemporary wraps any error and implements Temporary function. -// -// err := errors.New("beep boop") -// var c tec.TempErrCatcher -// c.IsTemporary(err) // false -// c.IsTemporary(tec.ErrTemp{err}) // true -// -type ErrTemporary struct { - Err error -} - -func (e ErrTemporary) Temporary() bool { - return true -} - -func (e ErrTemporary) Error() string { - return e.Err.Error() -} - -func (e ErrTemporary) String() string { - return e.Error() -} diff --git a/vendor/github.com/jbenet/goprocess/.travis.yml b/vendor/github.com/jbenet/goprocess/.travis.yml deleted file mode 100644 index 77d0e7d7..00000000 --- a/vendor/github.com/jbenet/goprocess/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -sudo: false - -language: go - -go: - - 1.12 - -script: - - go test -race -v ./... diff --git a/vendor/github.com/jbenet/goprocess/LICENSE b/vendor/github.com/jbenet/goprocess/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/jbenet/goprocess/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/jbenet/goprocess/README.md b/vendor/github.com/jbenet/goprocess/README.md deleted file mode 100644 index e2f12e16..00000000 --- a/vendor/github.com/jbenet/goprocess/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# goprocess - lifecycles in go - -[![travisbadge](https://travis-ci.org/jbenet/goprocess.svg)](https://travis-ci.org/jbenet/goprocess) - -(Based on https://github.com/jbenet/go-ctxgroup) - -- Godoc: https://godoc.org/github.com/jbenet/goprocess - -`goprocess` introduces a way to manage process lifecycles in go. It is -much like [go.net/context](https://godoc.org/code.google.com/p/go.net/context) -(it actually uses a Context), but it is more like a Context-WaitGroup hybrid. -`goprocess` is about being able to start and stop units of work, which may -receive `Close` signals from many clients. Think of it like a UNIX process -tree, but inside go. - -`goprocess` seeks to minimally affect your objects, so you can use it -with both embedding or composition. At the heart of `goprocess` is the -`Process` interface: - -```Go -// Process is the basic unit of work in goprocess. It defines a computation -// with a lifecycle: -// - running (before calling Close), -// - closing (after calling Close at least once), -// - closed (after Close returns, and all teardown has _completed_). -// -// More specifically, it fits this: -// -// p := WithTeardown(tf) // new process is created, it is now running. -// p.AddChild(q) // can register children **before** Closing. -// go p.Close() // blocks until done running teardown func. -// <-p.Closing() // would now return true. -// <-p.childrenDone() // wait on all children to be done -// p.teardown() // runs the user's teardown function tf. -// p.Close() // now returns, with error teardown returned. -// <-p.Closed() // would now return true. -// -// Processes can be arranged in a process "tree", where children are -// automatically Closed if their parents are closed. (Note, it is actually -// a Process DAG, children may have multiple parents). A process may also -// optionally wait for another to fully Close before beginning to Close. -// This makes it easy to ensure order of operations and proper sequential -// teardown of resurces. For example: -// -// p1 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 1") -// }) -// p2 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 2") -// }) -// p3 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 3") -// }) -// -// p1.AddChild(p2) -// p2.AddChild(p3) -// -// -// go p1.Close() -// go p2.Close() -// go p3.Close() -// -// // Output: -// // closing 3 -// // closing 2 -// // closing 1 -// -// Process is modelled after the UNIX processes group idea, and heavily -// informed by sync.WaitGroup and go.net/context.Context. -// -// In the function documentation of this interface, `p` always refers to -// the self Process. -type Process interface { - - // WaitFor makes p wait for q before exiting. Thus, p will _always_ close - // _after_ q. Note well: a waiting cycle is deadlock. - // - // If q is already Closed, WaitFor calls p.Close() - // If p is already Closing or Closed, WaitFor panics. This is the same thing - // as calling Add(1) _after_ calling Done() on a wait group. Calling WaitFor - // on an already-closed process is a programming error likely due to bad - // synchronization - WaitFor(q Process) - - // AddChildNoWait registers child as a "child" of Process. As in UNIX, - // when parent is Closed, child is Closed -- child may Close beforehand. - // This is the equivalent of calling: - // - // go func(parent, child Process) { - // <-parent.Closing() - // child.Close() - // }(p, q) - // - // Note: the naming of functions is `AddChildNoWait` and `AddChild` (instead - // of `AddChild` and `AddChildWaitFor`) because: - // - it is the more common operation, - // - explicitness is helpful in the less common case (no waiting), and - // - usual "child" semantics imply parent Processes should wait for children. - AddChildNoWait(q Process) - - // AddChild is the equivalent of calling: - // parent.AddChildNoWait(q) - // parent.WaitFor(q) - AddChild(q Process) - - // Go creates a new process, adds it as a child, and spawns the ProcessFunc f - // in its own goroutine. It is equivalent to: - // - // GoChild(p, f) - // - // It is useful to construct simple asynchronous workers, children of p. - Go(f ProcessFunc) Process - - // Close ends the process. Close blocks until the process has completely - // shut down, and any teardown has run _exactly once_. The returned error - // is available indefinitely: calling Close twice returns the same error. - // If the process has already been closed, Close returns immediately. - Close() error - - // Closing is a signal to wait upon. The returned channel is closed - // _after_ Close has been called at least once, but teardown may or may - // not be done yet. The primary use case of Closing is for children who - // need to know when a parent is shutting down, and therefore also shut - // down. - Closing() <-chan struct{} - - // Closed is a signal to wait upon. The returned channel is closed - // _after_ Close has completed; teardown has finished. The primary use case - // of Closed is waiting for a Process to Close without _causing_ the Close. - Closed() <-chan struct{} -} -``` diff --git a/vendor/github.com/jbenet/goprocess/background.go b/vendor/github.com/jbenet/goprocess/background.go deleted file mode 100644 index d6581570..00000000 --- a/vendor/github.com/jbenet/goprocess/background.go +++ /dev/null @@ -1,33 +0,0 @@ -package goprocess - -// Background returns the "bgProcess" Process: a statically allocated -// process that can _never_ close. It also never enters Closing() state. -// Calling Background().Close() will hang indefinitely. -func Background() Process { - return background -} - -var background = new(bgProcess) - -type bgProcess struct{} - -func (*bgProcess) WaitFor(q Process) {} -func (*bgProcess) AddChildNoWait(q Process) {} -func (*bgProcess) AddChild(q Process) {} -func (*bgProcess) Close() error { select {} } -func (*bgProcess) CloseAfterChildren() error { select {} } -func (*bgProcess) Closing() <-chan struct{} { return nil } -func (*bgProcess) Closed() <-chan struct{} { return nil } -func (*bgProcess) Err() error { select {} } - -func (*bgProcess) SetTeardown(tf TeardownFunc) { - panic("can't set teardown on bgProcess process") -} -func (*bgProcess) Go(f ProcessFunc) Process { - child := newProcess(nil) - go func() { - f(child) - child.Close() - }() - return child -} diff --git a/vendor/github.com/jbenet/goprocess/context/context.go b/vendor/github.com/jbenet/goprocess/context/context.go deleted file mode 100644 index 54d2d13c..00000000 --- a/vendor/github.com/jbenet/goprocess/context/context.go +++ /dev/null @@ -1,117 +0,0 @@ -package goprocessctx - -import ( - "context" - - goprocess "github.com/jbenet/goprocess" -) - -// WithContext constructs and returns a Process that respects -// given context. It is the equivalent of: -// -// func ProcessWithContext(ctx context.Context) goprocess.Process { -// p := goprocess.WithParent(goprocess.Background()) -// CloseAfterContext(p, ctx) -// return p -// } -// -func WithContext(ctx context.Context) goprocess.Process { - p := goprocess.WithParent(goprocess.Background()) - CloseAfterContext(p, ctx) - return p -} - -// WithContextAndTeardown is a helper function to set teardown at initiation -// of WithContext -func WithContextAndTeardown(ctx context.Context, tf goprocess.TeardownFunc) goprocess.Process { - p := goprocess.WithTeardown(tf) - CloseAfterContext(p, ctx) - return p -} - -// WaitForContext makes p WaitFor ctx. When Closing, p waits for -// ctx.Done(), before being Closed(). It is simply: -// -// p.WaitFor(goprocess.WithContext(ctx)) -// -func WaitForContext(ctx context.Context, p goprocess.Process) { - p.WaitFor(WithContext(ctx)) -} - -// CloseAfterContext schedules the process to close after the given -// context is done. It is the equivalent of: -// -// func CloseAfterContext(p goprocess.Process, ctx context.Context) { -// go func() { -// <-ctx.Done() -// p.Close() -// }() -// } -// -func CloseAfterContext(p goprocess.Process, ctx context.Context) { - if p == nil { - panic("nil Process") - } - if ctx == nil { - panic("nil Context") - } - - // Avoid a goroutine for both context.Background() and goprocess.Background(). - if ctx.Done() == nil || p.Closed() == nil { - return - } - - go func() { - select { - case <-ctx.Done(): - p.Close() - case <-p.Closed(): - } - }() -} - -// WithProcessClosing returns a context.Context derived from ctx that -// is cancelled as p is Closing (after: <-p.Closing()). It is simply: -// -// func WithProcessClosing(ctx context.Context, p goprocess.Process) context.Context { -// ctx, cancel := context.WithCancel(ctx) -// go func() { -// <-p.Closing() -// cancel() -// }() -// return ctx -// } -// -func WithProcessClosing(ctx context.Context, p goprocess.Process) context.Context { - ctx, cancel := context.WithCancel(ctx) - p.AddChildNoWait(goprocess.WithTeardown(func() error { - cancel() - return nil - })) - return ctx -} - -// WithProcessClosed returns a context.Context that is cancelled -// after Process p is Closed. It is the equivalent of: -// -// func WithProcessClosed(ctx context.Context, p goprocess.Process) context.Context { -// ctx, cancel := context.WithCancel(ctx) -// go func() { -// <-p.Closed() -// cancel() -// }() -// return ctx -// } -// -func WithProcessClosed(ctx context.Context, p goprocess.Process) context.Context { - ctx, cancel := context.WithCancel(ctx) - p.AddChildNoWait(goprocess.WithTeardown(func() error { - select { - case <-p.Closed(): - case <-ctx.Done(): - } - cancel() - return nil - })) - return ctx -} diff --git a/vendor/github.com/jbenet/goprocess/context/derive.go b/vendor/github.com/jbenet/goprocess/context/derive.go deleted file mode 100644 index 92e4d272..00000000 --- a/vendor/github.com/jbenet/goprocess/context/derive.go +++ /dev/null @@ -1,19 +0,0 @@ -package goprocessctx - -import ( - "context" - - goprocess "github.com/jbenet/goprocess" -) - -// OnClosingContext derives a context from a given goprocess that will -// be 'Done' when the process is closing -func OnClosingContext(p goprocess.Process) context.Context { - return WithProcessClosing(context.Background(), p) -} - -// OnClosedContext derives a context from a given goprocess that will -// be 'Done' when the process is closed -func OnClosedContext(p goprocess.Process) context.Context { - return WithProcessClosed(context.Background(), p) -} diff --git a/vendor/github.com/jbenet/goprocess/go.mod b/vendor/github.com/jbenet/goprocess/go.mod deleted file mode 100644 index e22f17f2..00000000 --- a/vendor/github.com/jbenet/goprocess/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/jbenet/goprocess - -go 1.12 - -require github.com/jbenet/go-cienv v0.1.0 diff --git a/vendor/github.com/jbenet/goprocess/go.sum b/vendor/github.com/jbenet/goprocess/go.sum deleted file mode 100644 index 82fea79c..00000000 --- a/vendor/github.com/jbenet/goprocess/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= diff --git a/vendor/github.com/jbenet/goprocess/goprocess.go b/vendor/github.com/jbenet/goprocess/goprocess.go deleted file mode 100644 index 48b76e2e..00000000 --- a/vendor/github.com/jbenet/goprocess/goprocess.go +++ /dev/null @@ -1,263 +0,0 @@ -// Package goprocess introduces a Process abstraction that allows simple -// organization, and orchestration of work. It is much like a WaitGroup, -// and much like a context.Context, but also ensures safe **exactly-once**, -// and well-ordered teardown semantics. -package goprocess - -import ( - "os" - "os/signal" -) - -// Process is the basic unit of work in goprocess. It defines a computation -// with a lifecycle: -// - running (before calling Close), -// - closing (after calling Close at least once), -// - closed (after Close returns, and all teardown has _completed_). -// -// More specifically, it fits this: -// -// p := WithTeardown(tf) // new process is created, it is now running. -// p.AddChild(q) // can register children **before** Closed(). -// go p.Close() // blocks until done running teardown func. -// <-p.Closing() // would now return true. -// <-p.childrenDone() // wait on all children to be done -// p.teardown() // runs the user's teardown function tf. -// p.Close() // now returns, with error teardown returned. -// <-p.Closed() // would now return true. -// -// Processes can be arranged in a process "tree", where children are -// automatically Closed if their parents are closed. (Note, it is actually -// a Process DAG, children may have multiple parents). A process may also -// optionally wait for another to fully Close before beginning to Close. -// This makes it easy to ensure order of operations and proper sequential -// teardown of resurces. For example: -// -// p1 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 1") -// }) -// p2 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 2") -// }) -// p3 := goprocess.WithTeardown(func() error { -// fmt.Println("closing 3") -// }) -// -// p1.AddChild(p2) -// p2.AddChild(p3) -// -// -// go p1.Close() -// go p2.Close() -// go p3.Close() -// -// // Output: -// // closing 3 -// // closing 2 -// // closing 1 -// -// Process is modelled after the UNIX processes group idea, and heavily -// informed by sync.WaitGroup and go.net/context.Context. -// -// In the function documentation of this interface, `p` always refers to -// the self Process. -type Process interface { - - // WaitFor makes p wait for q before exiting. Thus, p will _always_ close - // _after_ q. Note well: a waiting cycle is deadlock. - // - // If p is already Closed, WaitFor panics. This is the same thing as - // calling Add(1) _after_ calling Done() on a wait group. Calling - // WaitFor on an already-closed process is a programming error likely - // due to bad synchronization - WaitFor(q Process) - - // AddChildNoWait registers child as a "child" of Process. As in UNIX, - // when parent is Closed, child is Closed -- child may Close beforehand. - // This is the equivalent of calling: - // - // go func(parent, child Process) { - // <-parent.Closing() - // child.Close() - // }(p, q) - // - // Note: the naming of functions is `AddChildNoWait` and `AddChild` (instead - // of `AddChild` and `AddChildWaitFor`) because: - // - it is the more common operation, - // - explicitness is helpful in the less common case (no waiting), and - // - usual "child" semantics imply parent Processes should wait for children. - AddChildNoWait(q Process) - - // AddChild is the equivalent of calling: - // parent.AddChildNoWait(q) - // parent.WaitFor(q) - // - // It will _panic_ if the parent is already closed. - AddChild(q Process) - - // Go is much like `go`, as it runs a function in a newly spawned goroutine. - // The neat part of Process.Go is that the Process object you call it on will: - // * construct a child Process, and call AddChild(child) on it - // * spawn a goroutine, and call the given function - // * Close the child when the function exits. - // This way, you can rest assured each goroutine you spawn has its very own - // Process context, and that it will be closed when the function exits. - // It is the function's responsibility to respect the Closing of its Process, - // namely it should exit (return) when <-Closing() is ready. It is basically: - // - // func (p Process) Go(f ProcessFunc) Process { - // child := WithParent(p) - // go func () { - // f(child) - // child.Close() - // }() - // } - // - // It is useful to construct simple asynchronous workers, children of p. - Go(f ProcessFunc) Process - - // SetTeardown sets the process's teardown to tf. - SetTeardown(tf TeardownFunc) - - // Close ends the process. Close blocks until the process has completely - // shut down, and any teardown has run _exactly once_. The returned error - // is available indefinitely: calling Close twice returns the same error. - // If the process has already been closed, Close returns immediately. - Close() error - - // CloseAfterChildren calls Close _after_ its children have Closed - // normally (i.e. it _does not_ attempt to close them). - CloseAfterChildren() error - - // Closing is a signal to wait upon. The returned channel is closed - // _after_ Close has been called at least once, but teardown may or may - // not be done yet. The primary use case of Closing is for children who - // need to know when a parent is shutting down, and therefore also shut - // down. - Closing() <-chan struct{} - - // Closed is a signal to wait upon. The returned channel is closed - // _after_ Close has completed; teardown has finished. The primary use case - // of Closed is waiting for a Process to Close without _causing_ the Close. - Closed() <-chan struct{} - - // Err waits until the process is closed, and then returns any error that - // occurred during shutdown. - Err() error -} - -// TeardownFunc is a function used to cleanup state at the end of the -// lifecycle of a Process. -type TeardownFunc func() error - -// ProcessFunc is a function that takes a process. Its main use case is goprocess.Go, -// which spawns a ProcessFunc in its own goroutine, and returns a corresponding -// Process object. -type ProcessFunc func(proc Process) - -var nilProcessFunc = func(Process) {} - -// Go is much like `go`: it runs a function in a newly spawned goroutine. The neat -// part of Go is that it provides Process object to communicate between the -// function and the outside world. Thus, callers can easily WaitFor, or Close the -// function. It is the function's responsibility to respect the Closing of its Process, -// namely it should exit (return) when <-Closing() is ready. It is simply: -// -// func Go(f ProcessFunc) Process { -// p := WithParent(Background()) -// p.Go(f) -// return p -// } -// -// Note that a naive implementation of Go like the following would not work: -// -// func Go(f ProcessFunc) Process { -// return Background().Go(f) -// } -// -// This is because having the process you -func Go(f ProcessFunc) Process { - // return GoChild(Background(), f) - - // we use two processes, one for communication, and - // one for ensuring we wait on the function (unclosable from the outside). - p := newProcess(nil) - waitFor := newProcess(nil) - p.WaitFor(waitFor) // prevent p from closing - go func() { - f(p) - waitFor.Close() // allow p to close. - p.Close() // ensure p closes. - }() - return p -} - -// GoChild is like Go, but it registers the returned Process as a child of parent, -// **before** spawning the goroutine, which ensures proper synchronization with parent. -// It is somewhat like -// -// func GoChild(parent Process, f ProcessFunc) Process { -// p := WithParent(parent) -// p.Go(f) -// return p -// } -// -// And it is similar to the classic WaitGroup use case: -// -// func WaitGroupGo(wg sync.WaitGroup, child func()) { -// wg.Add(1) -// go func() { -// child() -// wg.Done() -// }() -// } -// -func GoChild(parent Process, f ProcessFunc) Process { - p := WithParent(parent) - p.Go(f) - return p -} - -// Spawn is an alias of `Go`. In many contexts, Spawn is a -// well-known Process launching word, which fits our use case. -var Spawn = Go - -// SpawnChild is an alias of `GoChild`. In many contexts, Spawn is a -// well-known Process launching word, which fits our use case. -var SpawnChild = GoChild - -// WithTeardown constructs and returns a Process with a TeardownFunc. -// TeardownFunc tf will be called **exactly-once** when Process is -// Closing, after all Children have fully closed, and before p is Closed. -// In fact, Process p will not be Closed until tf runs and exits. -// See lifecycle in Process doc. -func WithTeardown(tf TeardownFunc) Process { - if tf == nil { - panic("nil tf TeardownFunc") - } - return newProcess(tf) -} - -// WithParent constructs and returns a Process with a given parent. -func WithParent(parent Process) Process { - if parent == nil { - panic("nil parent Process") - } - q := newProcess(nil) - parent.AddChild(q) - return q -} - -// WithSignals returns a Process that will Close() when any given signal fires. -// This is useful to bind Process trees to syscall.SIGTERM, SIGKILL, etc. -func WithSignals(sig ...os.Signal) Process { - p := WithParent(Background()) - c := make(chan os.Signal, 1) - signal.Notify(c, sig...) - go func() { - <-c - signal.Stop(c) - p.Close() - }() - return p -} diff --git a/vendor/github.com/jbenet/goprocess/impl-mutex.go b/vendor/github.com/jbenet/goprocess/impl-mutex.go deleted file mode 100644 index 9cb6ae75..00000000 --- a/vendor/github.com/jbenet/goprocess/impl-mutex.go +++ /dev/null @@ -1,297 +0,0 @@ -package goprocess - -import ( - "sync" -) - -// process implements Process -type process struct { - children map[*processLink]struct{} // process to close with us - waitfors map[*processLink]struct{} // process to only wait for - waiters []*processLink // processes that wait for us. for gc. - - teardown TeardownFunc // called to run the teardown logic. - closing chan struct{} // closed once close starts. - closed chan struct{} // closed once close is done. - closeErr error // error to return to clients of Close() - - sync.Mutex -} - -// newProcess constructs and returns a Process. -// It will call tf TeardownFunc exactly once: -// **after** all children have fully Closed, -// **after** entering <-Closing(), and -// **before** <-Closed(). -func newProcess(tf TeardownFunc) *process { - return &process{ - teardown: tf, - closed: make(chan struct{}), - closing: make(chan struct{}), - waitfors: make(map[*processLink]struct{}), - children: make(map[*processLink]struct{}), - } -} - -func (p *process) WaitFor(q Process) { - if q == nil { - panic("waiting for nil process") - } - - p.Lock() - defer p.Unlock() - - select { - case <-p.Closed(): - panic("Process cannot wait after being closed") - default: - } - - pl := newProcessLink(p, q) - if p.waitfors == nil { - // This may be nil when we're closing. In close, we'll keep - // reading this map till it stays nil. - p.waitfors = make(map[*processLink]struct{}, 1) - } - p.waitfors[pl] = struct{}{} - go pl.AddToChild() -} - -func (p *process) AddChildNoWait(child Process) { - if child == nil { - panic("adding nil child process") - } - - p.Lock() - defer p.Unlock() - - select { - case <-p.Closing(): - // Either closed or closing, close child immediately. This is - // correct because we aren't asked to _wait_ on this child. - go child.Close() - // Wait for the child to start closing so the child is in the - // "correct" state after this function finishes (see #17). - <-child.Closing() - return - default: - } - - pl := newProcessLink(p, child) - p.children[pl] = struct{}{} - go pl.AddToChild() -} - -func (p *process) AddChild(child Process) { - if child == nil { - panic("adding nil child process") - } - - p.Lock() - defer p.Unlock() - - pl := newProcessLink(p, child) - - select { - case <-p.Closed(): - // AddChild must not be called on a dead process. Maybe that's - // too strict? - panic("Process cannot add children after being closed") - default: - } - - select { - case <-p.Closing(): - // Already closing, close child in background. - go child.Close() - // Wait for the child to start closing so the child is in the - // "correct" state after this function finishes (see #17). - <-child.Closing() - default: - // Only add the child when not closing. When closing, just add - // it to the "waitfors" list. - p.children[pl] = struct{}{} - } - - if p.waitfors == nil { - // This may be be nil when we're closing. In close, we'll keep - // reading this map till it stays nil. - p.waitfors = make(map[*processLink]struct{}, 1) - } - p.waitfors[pl] = struct{}{} - go pl.AddToChild() -} - -func (p *process) Go(f ProcessFunc) Process { - child := newProcess(nil) - waitFor := newProcess(nil) - child.WaitFor(waitFor) // prevent child from closing - - // add child last, to prevent a closing parent from - // closing all of them prematurely, before running the func. - p.AddChild(child) - go func() { - f(child) - waitFor.Close() // allow child to close. - child.CloseAfterChildren() // close to tear down. - }() - return child -} - -// SetTeardown to assign a teardown function -func (p *process) SetTeardown(tf TeardownFunc) { - if tf == nil { - panic("cannot set nil TeardownFunc") - } - - p.Lock() - if p.teardown != nil { - panic("cannot SetTeardown twice") - } - - p.teardown = tf - select { - case <-p.Closed(): - p.closeErr = tf() - default: - } - p.Unlock() -} - -// Close is the external close function. -// it's a wrapper around internalClose that waits on Closed() -func (p *process) Close() error { - p.Lock() - - // if already closing, or closed, get out. (but wait!) - select { - case <-p.Closing(): - p.Unlock() - <-p.Closed() - return p.closeErr - default: - } - - p.doClose() - p.Unlock() - return p.closeErr -} - -func (p *process) Closing() <-chan struct{} { - return p.closing -} - -func (p *process) Closed() <-chan struct{} { - return p.closed -} - -func (p *process) Err() error { - <-p.Closed() - return p.closeErr -} - -// the _actual_ close process. -func (p *process) doClose() { - // this function is only be called once (protected by p.Lock()). - // and it will panic (on closing channels) otherwise. - - close(p.closing) // signal that we're shutting down (Closing) - - // We won't add any children after we start closing so we can do this - // once. - for plc, _ := range p.children { - child := plc.Child() - if child != nil { // check because child may already have been removed. - go child.Close() // force all children to shut down - } - - // safe to call multiple times per link - plc.ParentClear() - } - p.children = nil // clear them. release memory. - - // We may repeatedly continue to add waiters while we wait to close so - // we have to do this in a loop. - for len(p.waitfors) > 0 { - // we must be careful not to iterate over waitfors directly, as it may - // change under our feet. - wf := p.waitfors - p.waitfors = nil // clear them. release memory. - for w, _ := range wf { - // Here, we wait UNLOCKED, so that waitfors who are in the middle of - // adding a child to us can finish. we will immediately close the child. - p.Unlock() - <-w.ChildClosed() // wait till all waitfors are fully closed (before teardown) - p.Lock() - - // safe to call multiple times per link - w.ParentClear() - } - } - - if p.teardown != nil { - p.closeErr = p.teardown() // actually run the close logic (ok safe to teardown) - } - close(p.closed) // signal that we're shut down (Closed) - - // go remove all the parents from the process links. optimization. - go func(waiters []*processLink) { - for _, pl := range waiters { - pl.ClearChild() - pr, ok := pl.Parent().(*process) - if !ok { - // parent has already been called to close - continue - } - pr.Lock() - delete(pr.waitfors, pl) - delete(pr.children, pl) - pr.Unlock() - } - }(p.waiters) // pass in so - p.waiters = nil // clear them. release memory. -} - -// We will only wait on the children we have now. -// We will not wait on children added subsequently. -// this may change in the future. -func (p *process) CloseAfterChildren() error { - p.Lock() - select { - case <-p.Closed(): - p.Unlock() - return p.Close() // get error. safe, after p.Closed() - default: - } - p.Unlock() - - // here only from one goroutine. - - nextToWaitFor := func() Process { - p.Lock() - defer p.Unlock() - for e, _ := range p.waitfors { - c := e.Child() - if c == nil { - continue - } - - select { - case <-c.Closed(): - default: - return c - } - } - return nil - } - - // wait for all processes we're waiting for are closed. - // the semantics here are simple: we will _only_ close - // if there are no processes currently waiting for. - for next := nextToWaitFor(); next != nil; next = nextToWaitFor() { - <-next.Closed() - } - - // YAY! we're done. close - return p.Close() -} diff --git a/vendor/github.com/jbenet/goprocess/link.go b/vendor/github.com/jbenet/goprocess/link.go deleted file mode 100644 index f46d81f6..00000000 --- a/vendor/github.com/jbenet/goprocess/link.go +++ /dev/null @@ -1,128 +0,0 @@ -package goprocess - -import ( - "sync" -) - -// closedCh is an alread-closed channel. used to return -// in cases where we already know a channel is closed. -var closedCh chan struct{} - -func init() { - closedCh = make(chan struct{}) - close(closedCh) -} - -// a processLink is an internal bookkeeping datastructure. -// it's used to form a relationship between two processes. -// It is mostly for keeping memory usage down (letting -// children close and be garbage-collected). -type processLink struct { - // guards all fields. - // DO NOT HOLD while holding process locks. - // it may be slow, and could deadlock if not careful. - sync.Mutex - parent Process - child Process -} - -func newProcessLink(p, c Process) *processLink { - return &processLink{ - parent: p, - child: c, - } -} - -// Closing returns whether the child is closing -func (pl *processLink) ChildClosing() <-chan struct{} { - // grab a hold of it, and unlock, as .Closing may block. - pl.Lock() - child := pl.child - pl.Unlock() - - if child == nil { // already closed? memory optimization. - return closedCh - } - return child.Closing() -} - -func (pl *processLink) ChildClosed() <-chan struct{} { - // grab a hold of it, and unlock, as .Closed may block. - pl.Lock() - child := pl.child - pl.Unlock() - - if child == nil { // already closed? memory optimization. - return closedCh - } - return child.Closed() -} - -func (pl *processLink) ChildClose() { - // grab a hold of it, and unlock, as .Closed may block. - pl.Lock() - child := pl.child - pl.Unlock() - - if child != nil { // already closed? memory optimization. - child.Close() - } -} - -func (pl *processLink) ClearChild() { - pl.Lock() - pl.child = nil - pl.Unlock() -} - -func (pl *processLink) ParentClear() { - pl.Lock() - pl.parent = nil - pl.Unlock() -} - -func (pl *processLink) Child() Process { - pl.Lock() - defer pl.Unlock() - return pl.child -} - -func (pl *processLink) Parent() Process { - pl.Lock() - defer pl.Unlock() - return pl.parent -} - -func (pl *processLink) AddToChild() { - cp := pl.Child() - - // is it a *process ? if not... panic. - var c *process - switch cp := cp.(type) { - case *process: - c = cp - case *bgProcess: - // Background process never closes so we don't need to do - // anything. - return - default: - panic("goprocess does not yet support other process impls.") - } - - // first, is it Closed? - c.Lock() - select { - case <-c.Closed(): - c.Unlock() - - // already closed. must not add. - // we must clear it, though. do so without the lock. - pl.ClearChild() - return - - default: - // put the process link into q's waiters - c.waiters = append(c.waiters, pl) - c.Unlock() - } -} diff --git a/vendor/github.com/jbenet/goprocess/package.json b/vendor/github.com/jbenet/goprocess/package.json deleted file mode 100644 index 07485337..00000000 --- a/vendor/github.com/jbenet/goprocess/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/jbenet/goprocess" - }, - "gx": { - "dvcsimport": "github.com/jbenet/goprocess" - }, - "gxVersion": "0.8.0", - "language": "go", - "license": "", - "name": "goprocess", - "version": "1.0.0" -} diff --git a/vendor/github.com/jbenet/goprocess/periodic/README.md b/vendor/github.com/jbenet/goprocess/periodic/README.md deleted file mode 100644 index 7a2c55db..00000000 --- a/vendor/github.com/jbenet/goprocess/periodic/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# goprocess/periodic - periodic process creation - -- goprocess: https://github.com/jbenet/goprocess -- Godoc: https://godoc.org/github.com/jbenet/goprocess/periodic diff --git a/vendor/github.com/jbenet/goprocess/periodic/periodic.go b/vendor/github.com/jbenet/goprocess/periodic/periodic.go deleted file mode 100644 index 823c43dc..00000000 --- a/vendor/github.com/jbenet/goprocess/periodic/periodic.go +++ /dev/null @@ -1,232 +0,0 @@ -// Package periodic is part of github.com/jbenet/goprocess. -// It provides a simple periodic processor that calls a function -// periodically based on some options. -// -// For example: -// -// // use a time.Duration -// p := periodicproc.Every(time.Second, func(proc goprocess.Process) { -// fmt.Printf("the time is %s and all is well", time.Now()) -// }) -// -// <-time.After(5*time.Second) -// p.Close() -// -// // use a time.Time channel (like time.Ticker) -// p := periodicproc.Tick(time.Tick(time.Second), func(proc goprocess.Process) { -// fmt.Printf("the time is %s and all is well", time.Now()) -// }) -// -// <-time.After(5*time.Second) -// p.Close() -// -// // or arbitrary signals -// signal := make(chan struct{}) -// p := periodicproc.OnSignal(signal, func(proc goprocess.Process) { -// fmt.Printf("the time is %s and all is well", time.Now()) -// }) -// -// signal<- struct{}{} -// signal<- struct{}{} -// <-time.After(5 * time.Second) -// signal<- struct{}{} -// p.Close() -// -package periodicproc - -import ( - "time" - - gp "github.com/jbenet/goprocess" -) - -// Every calls the given ProcessFunc at periodic intervals. Internally, it uses -// <-time.After(interval), so it will have the behavior of waiting _at least_ -// interval in between calls. If you'd prefer the time.Ticker behavior, use -// periodicproc.Tick instead. -// This is sequentially rate limited, only one call will be in-flight at a time. -func Every(interval time.Duration, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - for { - select { - case <-time.After(interval): - select { - case <-proc.Go(procfunc).Closed(): // spin it out as a child, and wait till it's done. - case <-proc.Closing(): // we're told to close - return - } - case <-proc.Closing(): // we're told to close - return - } - } - }) -} - -// EveryGo calls the given ProcessFunc at periodic intervals. Internally, it uses -// <-time.After(interval) -// This is not rate limited, multiple calls could be in-flight at the same time. -func EveryGo(interval time.Duration, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - for { - select { - case <-time.After(interval): - proc.Go(procfunc) - case <-proc.Closing(): // we're told to close - return - } - } - }) -} - -// Tick constructs a ticker with interval, and calls the given ProcessFunc every -// time the ticker fires. -// This is sequentially rate limited, only one call will be in-flight at a time. -// -// p := periodicproc.Tick(time.Second, func(proc goprocess.Process) { -// fmt.Println("fire!") -// }) -// -// <-time.After(3 * time.Second) -// p.Close() -// -// // Output: -// // fire! -// // fire! -// // fire! -func Tick(interval time.Duration, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - ticker := time.NewTicker(interval) - callOnTicker(ticker.C, procfunc)(proc) - ticker.Stop() - }) -} - -// TickGo constructs a ticker with interval, and calls the given ProcessFunc every -// time the ticker fires. -// This is not rate limited, multiple calls could be in-flight at the same time. -// -// p := periodicproc.TickGo(time.Second, func(proc goprocess.Process) { -// fmt.Println("fire!") -// <-time.After(10 * time.Second) // will not block sequential execution -// }) -// -// <-time.After(3 * time.Second) -// p.Close() -// -// // Output: -// // fire! -// // fire! -// // fire! -func TickGo(interval time.Duration, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - ticker := time.NewTicker(interval) - goCallOnTicker(ticker.C, procfunc)(proc) - ticker.Stop() - }) -} - -// Ticker calls the given ProcessFunc every time the ticker fires. -// This is sequentially rate limited, only one call will be in-flight at a time. -func Ticker(ticker <-chan time.Time, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(callOnTicker(ticker, procfunc)) -} - -// TickerGo calls the given ProcessFunc every time the ticker fires. -// This is not rate limited, multiple calls could be in-flight at the same time. -func TickerGo(ticker <-chan time.Time, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(goCallOnTicker(ticker, procfunc)) -} - -func callOnTicker(ticker <-chan time.Time, pf gp.ProcessFunc) gp.ProcessFunc { - return func(proc gp.Process) { - for { - select { - case <-ticker: - select { - case <-proc.Go(pf).Closed(): // spin it out as a child, and wait till it's done. - case <-proc.Closing(): // we're told to close - return - } - case <-proc.Closing(): // we're told to close - return - } - } - } -} - -func goCallOnTicker(ticker <-chan time.Time, pf gp.ProcessFunc) gp.ProcessFunc { - return func(proc gp.Process) { - for { - select { - case <-ticker: - proc.Go(pf) - case <-proc.Closing(): // we're told to close - return - } - } - } -} - -// OnSignal calls the given ProcessFunc every time the signal fires, and waits for it to exit. -// This is sequentially rate limited, only one call will be in-flight at a time. -// -// sig := make(chan struct{}) -// p := periodicproc.OnSignal(sig, func(proc goprocess.Process) { -// fmt.Println("fire!") -// <-time.After(time.Second) // delays sequential execution by 1 second -// }) -// -// sig<- struct{} -// sig<- struct{} -// sig<- struct{} -// -// // Output: -// // fire! -// // fire! -// // fire! -func OnSignal(sig <-chan struct{}, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - for { - select { - case <-sig: - select { - case <-proc.Go(procfunc).Closed(): // spin it out as a child, and wait till it's done. - case <-proc.Closing(): // we're told to close - return - } - case <-proc.Closing(): // we're told to close - return - } - } - }) -} - -// OnSignalGo calls the given ProcessFunc every time the signal fires. -// This is not rate limited, multiple calls could be in-flight at the same time. -// -// sig := make(chan struct{}) -// p := periodicproc.OnSignalGo(sig, func(proc goprocess.Process) { -// fmt.Println("fire!") -// <-time.After(time.Second) // wont block execution -// }) -// -// sig<- struct{} -// sig<- struct{} -// sig<- struct{} -// -// // Output: -// // fire! -// // fire! -// // fire! -func OnSignalGo(sig <-chan struct{}, procfunc gp.ProcessFunc) gp.Process { - return gp.Go(func(proc gp.Process) { - for { - select { - case <-sig: - proc.Go(procfunc) - case <-proc.Closing(): // we're told to close - return - } - } - }) -} diff --git a/vendor/github.com/jbenet/goprocess/ratelimit/README.md b/vendor/github.com/jbenet/goprocess/ratelimit/README.md deleted file mode 100644 index 3c91185e..00000000 --- a/vendor/github.com/jbenet/goprocess/ratelimit/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# goprocess/ratelimit - ratelimit children creation - -- goprocess: https://github.com/jbenet/goprocess -- Godoc: https://godoc.org/github.com/jbenet/goprocess/ratelimit diff --git a/vendor/github.com/jbenet/goprocess/ratelimit/ratelimit.go b/vendor/github.com/jbenet/goprocess/ratelimit/ratelimit.go deleted file mode 100644 index 1838d053..00000000 --- a/vendor/github.com/jbenet/goprocess/ratelimit/ratelimit.go +++ /dev/null @@ -1,68 +0,0 @@ -// Package ratelimit is part of github.com/jbenet/goprocess. -// It provides a simple process that ratelimits child creation. -// This is done internally with a channel/semaphore. -// So the call `RateLimiter.LimitedGo` may block until another -// child is Closed(). -package ratelimit - -import ( - process "github.com/jbenet/goprocess" -) - -// RateLimiter limits the spawning of children. It does so -// with an internal semaphore. Note that Go will continue -// to be the unlimited process.Process.Go, and ONLY the -// added function `RateLimiter.LimitedGo` will honor the -// limit. This is to improve readability and avoid confusion -// for the reader, particularly if code changes over time. -type RateLimiter struct { - process.Process - - limiter chan struct{} -} - -func NewRateLimiter(parent process.Process, limit int) *RateLimiter { - proc := process.WithParent(parent) - return &RateLimiter{Process: proc, limiter: LimitChan(limit)} -} - -// LimitedGo creates a new process, adds it as a child, and spawns the -// ProcessFunc f in its own goroutine, but may block according to the -// internal rate limit. It is equivalent to: -// -// func(f process.ProcessFunc) { -// <-limitch -// p.Go(func (child process.Process) { -// f(child) -// f.Close() // make sure its children close too! -// limitch<- struct{}{} -// }) -/// } -// -// It is useful to construct simple asynchronous workers, children of p, -// and rate limit their creation, to avoid spinning up too many, too fast. -// This is great for providing backpressure to producers. -func (rl *RateLimiter) LimitedGo(f process.ProcessFunc) { - - <-rl.limiter - p := rl.Go(f) - - // this <-closed() is here because the child may have spawned - // children of its own, and our rate limiter should capture that. - go func() { - <-p.Closed() - rl.limiter <- struct{}{} - }() -} - -// LimitChan returns a rate-limiting channel. it is the usual, simple, -// golang-idiomatic rate-limiting semaphore. This function merely -// initializes it with certain buffer size, and sends that many values, -// so it is ready to be used. -func LimitChan(limit int) chan struct{} { - limitch := make(chan struct{}, limit) - for i := 0; i < limit; i++ { - limitch <- struct{}{} - } - return limitch -} diff --git a/vendor/github.com/jmoiron/sqlx/.travis.yml b/vendor/github.com/jmoiron/sqlx/.travis.yml index d7281526..6bc68d67 100644 --- a/vendor/github.com/jmoiron/sqlx/.travis.yml +++ b/vendor/github.com/jmoiron/sqlx/.travis.yml @@ -18,9 +18,9 @@ before_install: # go versions to test go: + - "1.8" + - "1.9" - "1.10.x" - - "1.11.x" - - "1.12.x" # run tests w/ coverage script: diff --git a/vendor/github.com/jmoiron/sqlx/README.md b/vendor/github.com/jmoiron/sqlx/README.md index 6b586160..c0db7f78 100644 --- a/vendor/github.com/jmoiron/sqlx/README.md +++ b/vendor/github.com/jmoiron/sqlx/README.md @@ -15,13 +15,11 @@ Major additional concepts are: * `Get` and `Select` to go quickly from query to struct/slice In addition to the [godoc API documentation](http://godoc.org/github.com/jmoiron/sqlx), -there is also some [user documentation](http://jmoiron.github.io/sqlx/) that +there is also some [standard documentation](http://jmoiron.github.io/sqlx/) that explains how to use `database/sql` along with sqlx. ## Recent Changes -* The [introduction](https://github.com/jmoiron/sqlx/pull/387) of `sql.ColumnType` sets the required minimum Go version to 1.8. - * sqlx/types.JsonText has been renamed to JSONText to follow Go naming conventions. This breaks backwards compatibility, but it's in a way that is trivially fixable diff --git a/vendor/github.com/jmoiron/sqlx/bind.go b/vendor/github.com/jmoiron/sqlx/bind.go index a3fc22cf..0fdc4435 100644 --- a/vendor/github.com/jmoiron/sqlx/bind.go +++ b/vendor/github.com/jmoiron/sqlx/bind.go @@ -2,7 +2,6 @@ package sqlx import ( "bytes" - "database/sql/driver" "errors" "reflect" "strconv" @@ -17,13 +16,12 @@ const ( QUESTION DOLLAR NAMED - AT ) // BindType returns the bindtype for a given database given a drivername. func BindType(driverName string) int { switch driverName { - case "postgres", "pgx", "pq-timeouts", "cloudsqlpostgres", "ql": + case "postgres", "pgx", "pq-timeouts", "cloudsqlpostgres": return DOLLAR case "mysql": return QUESTION @@ -31,8 +29,6 @@ func BindType(driverName string) int { return QUESTION case "oci8", "ora", "goracle": return NAMED - case "sqlserver": - return AT } return UNKNOWN } @@ -60,8 +56,6 @@ func Rebind(bindType int, query string) string { rqb = append(rqb, '$') case NAMED: rqb = append(rqb, ':', 'a', 'r', 'g') - case AT: - rqb = append(rqb, '@', 'p') } j++ @@ -116,9 +110,6 @@ func In(query string, args ...interface{}) (string, []interface{}, error) { meta := make([]argMeta, len(args)) for i, arg := range args { - if a, ok := arg.(driver.Valuer); ok { - arg, _ = a.Value() - } v := reflect.ValueOf(arg) t := reflectx.Deref(v.Type()) @@ -146,7 +137,7 @@ func In(query string, args ...interface{}) (string, []interface{}, error) { } newArgs := make([]interface{}, 0, flatArgsCount) - buf := make([]byte, 0, len(query)+len(", ?")*flatArgsCount) + buf := bytes.NewBuffer(make([]byte, 0, len(query)+len(", ?")*flatArgsCount)) var arg, offset int @@ -172,10 +163,10 @@ func In(query string, args ...interface{}) (string, []interface{}, error) { } // write everything up to and including our ? character - buf = append(buf, query[:offset+i+1]...) + buf.WriteString(query[:offset+i+1]) for si := 1; si < argMeta.length; si++ { - buf = append(buf, ", ?"...) + buf.WriteString(", ?") } newArgs = appendReflectSlice(newArgs, argMeta.v, argMeta.length) @@ -186,13 +177,13 @@ func In(query string, args ...interface{}) (string, []interface{}, error) { offset = 0 } - buf = append(buf, query...) + buf.WriteString(query) if arg < len(meta) { return "", nil, errors.New("number of bindVars less than number arguments") } - return string(buf), newArgs, nil + return buf.String(), newArgs, nil } func appendReflectSlice(args []interface{}, v reflect.Value, vlen int) []interface{} { diff --git a/vendor/github.com/jmoiron/sqlx/go.mod b/vendor/github.com/jmoiron/sqlx/go.mod deleted file mode 100644 index 66c67561..00000000 --- a/vendor/github.com/jmoiron/sqlx/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/jmoiron/sqlx - -require ( - github.com/go-sql-driver/mysql v1.4.0 - github.com/lib/pq v1.0.0 - github.com/mattn/go-sqlite3 v1.9.0 -) diff --git a/vendor/github.com/jmoiron/sqlx/go.sum b/vendor/github.com/jmoiron/sqlx/go.sum deleted file mode 100644 index a3239ada..00000000 --- a/vendor/github.com/jmoiron/sqlx/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= diff --git a/vendor/github.com/jmoiron/sqlx/named.go b/vendor/github.com/jmoiron/sqlx/named.go index a4056de0..69eb9549 100644 --- a/vendor/github.com/jmoiron/sqlx/named.go +++ b/vendor/github.com/jmoiron/sqlx/named.go @@ -12,12 +12,10 @@ package sqlx // * bindArgs, bindMapArgs, bindAnyArgs - given a list of names, return an arglist // import ( - "bytes" "database/sql" "errors" "fmt" "reflect" - "regexp" "strconv" "unicode" @@ -210,56 +208,6 @@ func bindStruct(bindType int, query string, arg interface{}, m *reflectx.Mapper) return bound, arglist, nil } -var valueBracketReg = regexp.MustCompile(`\([^(]*\?+[^)]*\)`) - -func fixBound(bound string, loop int) string { - loc := valueBracketReg.FindStringIndex(bound) - if len(loc) != 2 { - return bound - } - var buffer bytes.Buffer - - buffer.WriteString(bound[0:loc[1]]) - for i := 0; i < loop-1; i++ { - buffer.WriteString(",") - buffer.WriteString(bound[loc[0]:loc[1]]) - } - buffer.WriteString(bound[loc[1]:]) - return buffer.String() -} - -// bindArray binds a named parameter query with fields from an array or slice of -// structs argument. -func bindArray(bindType int, query string, arg interface{}, m *reflectx.Mapper) (string, []interface{}, error) { - // do the initial binding with QUESTION; if bindType is not question, - // we can rebind it at the end. - bound, names, err := compileNamedQuery([]byte(query), QUESTION) - if err != nil { - return "", []interface{}{}, err - } - arrayValue := reflect.ValueOf(arg) - arrayLen := arrayValue.Len() - if arrayLen == 0 { - return "", []interface{}{}, fmt.Errorf("length of array is 0: %#v", arg) - } - var arglist []interface{} - for i := 0; i < arrayLen; i++ { - elemArglist, err := bindArgs(names, arrayValue.Index(i).Interface(), m) - if err != nil { - return "", []interface{}{}, err - } - arglist = append(arglist, elemArglist...) - } - if arrayLen > 1 { - bound = fixBound(bound, arrayLen) - } - // adjust binding type if we weren't on question - if bindType != QUESTION { - bound = Rebind(bindType, bound) - } - return bound, arglist, nil -} - // bindMap binds a named parameter query with a map of arguments. func bindMap(bindType int, query string, args map[string]interface{}) (string, []interface{}, error) { bound, names, err := compileNamedQuery([]byte(query), bindType) @@ -311,10 +259,6 @@ func compileNamedQuery(qs []byte, bindType int) (query string, names []string, e } inName = true name = []byte{} - } else if inName && i > 0 && b == '=' && len(name) == 0 { - rebound = append(rebound, ':', '=') - inName = false - continue // if we're in a name, and this is an allowed character, continue } else if inName && (unicode.IsOneOf(allowedBindRunes, rune(b)) || b == '_' || b == '.') && i != last { // append the byte to the name if we are in a name and not on the last byte @@ -343,12 +287,6 @@ func compileNamedQuery(qs []byte, bindType int) (query string, names []string, e rebound = append(rebound, byte(b)) } currentVar++ - case AT: - rebound = append(rebound, '@', 'p') - for _, b := range strconv.Itoa(currentVar) { - rebound = append(rebound, byte(b)) - } - currentVar++ } // add this byte to string unless it was not part of the name if i != last { @@ -382,12 +320,7 @@ func bindNamedMapper(bindType int, query string, arg interface{}, m *reflectx.Ma if maparg, ok := arg.(map[string]interface{}); ok { return bindMap(bindType, query, maparg) } - switch reflect.TypeOf(arg).Kind() { - case reflect.Array, reflect.Slice: - return bindArray(bindType, query, arg, m) - default: - return bindStruct(bindType, query, arg, m) - } + return bindStruct(bindType, query, arg, m) } // NamedQuery binds a named query and then runs Query on the result using the @@ -403,7 +336,7 @@ func NamedQuery(e Ext, query string, arg interface{}) (*Rows, error) { // NamedExec uses BindStruct to get a query executable by the driver and // then runs Exec on the result. Returns an error from the binding -// or the query execution itself. +// or the query excution itself. func NamedExec(e Ext, query string, arg interface{}) (sql.Result, error) { q, args, err := bindNamedMapper(BindType(e.DriverName()), query, arg, mapperFor(e)) if err != nil { diff --git a/vendor/github.com/jmoiron/sqlx/named_context.go b/vendor/github.com/jmoiron/sqlx/named_context.go index 07ad2165..9405007e 100644 --- a/vendor/github.com/jmoiron/sqlx/named_context.go +++ b/vendor/github.com/jmoiron/sqlx/named_context.go @@ -122,7 +122,7 @@ func NamedQueryContext(ctx context.Context, e ExtContext, query string, arg inte // NamedExecContext uses BindStruct to get a query executable by the driver and // then runs Exec on the result. Returns an error from the binding -// or the query execution itself. +// or the query excution itself. func NamedExecContext(ctx context.Context, e ExtContext, query string, arg interface{}) (sql.Result, error) { q, args, err := bindNamedMapper(BindType(e.DriverName()), query, arg, mapperFor(e)) if err != nil { diff --git a/vendor/github.com/jmoiron/sqlx/reflectx/reflect.go b/vendor/github.com/jmoiron/sqlx/reflectx/reflect.go index 458021dc..73c21eb3 100644 --- a/vendor/github.com/jmoiron/sqlx/reflectx/reflect.go +++ b/vendor/github.com/jmoiron/sqlx/reflectx/reflect.go @@ -269,7 +269,9 @@ type typeQueue struct { // A copying append that creates a new slice each time. func apnd(is []int, i int) []int { x := make([]int, len(is)+1) - copy(x, is) + for p, n := range is { + x[p] = n + } x[len(x)-1] = i return x } diff --git a/vendor/github.com/jmoiron/sqlx/sqlx.go b/vendor/github.com/jmoiron/sqlx/sqlx.go index ce64cbc9..4385c3fa 100644 --- a/vendor/github.com/jmoiron/sqlx/sqlx.go +++ b/vendor/github.com/jmoiron/sqlx/sqlx.go @@ -149,15 +149,15 @@ func isUnsafe(i interface{}) bool { } func mapperFor(i interface{}) *reflectx.Mapper { - switch i := i.(type) { + switch i.(type) { case DB: - return i.Mapper + return i.(DB).Mapper case *DB: - return i.Mapper + return i.(*DB).Mapper case Tx: - return i.Mapper + return i.(Tx).Mapper case *Tx: - return i.Mapper + return i.(*Tx).Mapper default: return mapper() } @@ -471,6 +471,8 @@ func (tx *Tx) Stmtx(stmt interface{}) *Stmt { s = v.Stmt case *Stmt: s = v.Stmt + case sql.Stmt: + s = &v case *sql.Stmt: s = v default: diff --git a/vendor/github.com/jmoiron/sqlx/sqlx_context.go b/vendor/github.com/jmoiron/sqlx/sqlx_context.go index 06033111..d58ff337 100644 --- a/vendor/github.com/jmoiron/sqlx/sqlx_context.go +++ b/vendor/github.com/jmoiron/sqlx/sqlx_context.go @@ -217,6 +217,8 @@ func (tx *Tx) StmtxContext(ctx context.Context, stmt interface{}) *Stmt { s = v.Stmt case *Stmt: s = v.Stmt + case sql.Stmt: + s = &v case *sql.Stmt: s = v default: diff --git a/vendor/github.com/karalabe/usb/usb_disabled.go b/vendor/github.com/karalabe/usb/usb_disabled.go index f7f42a4c..77c90076 100644 --- a/vendor/github.com/karalabe/usb/usb_disabled.go +++ b/vendor/github.com/karalabe/usb/usb_disabled.go @@ -44,3 +44,8 @@ func EnumerateRaw(vendorID uint16, productID uint16) ([]DeviceInfo, error) { func EnumerateHid(vendorID uint16, productID uint16) ([]DeviceInfo, error) { return nil, nil } + +// Open connects to a previsouly discovered USB device. +func (info DeviceInfo) Open() (Device, error) { + return nil, ErrUnsupportedPlatform +} diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md index 195333e5..949b77e3 100644 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md @@ -26,7 +26,6 @@ The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de). We thank all the authors who provided code to this library: * Felix Kollmann -* Nicolas Perraut ## License diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go deleted file mode 100644 index df61a6f2..00000000 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build linux darwin - -package sequences - -import ( - "fmt" -) - -func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error { - return fmt.Errorf("windows only package") -} diff --git a/vendor/github.com/koron/go-ssdp/.gitignore b/vendor/github.com/koron/go-ssdp/.gitignore deleted file mode 100644 index 6e55ea03..00000000 --- a/vendor/github.com/koron/go-ssdp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.exe -/tmp/ -tags diff --git a/vendor/github.com/koron/go-ssdp/LICENSE b/vendor/github.com/koron/go-ssdp/LICENSE deleted file mode 100644 index a00a41d5..00000000 --- a/vendor/github.com/koron/go-ssdp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 MURAOKA Taro - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/koron/go-ssdp/Makefile b/vendor/github.com/koron/go-ssdp/Makefile deleted file mode 100644 index d06fa31c..00000000 --- a/vendor/github.com/koron/go-ssdp/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -EXAMPLES = advertise alive bye monitor search - -default: test - -test: - go test . - -test-full: - go test -v -race . - -lint: - go vet ./... - @echo "" - golint ./... - -cyclo: - -gocyclo -top 10 -avg . - -report: - @echo "misspell" - @find . -name "*.go" | xargs misspell - @echo "" - -gocyclo -over 14 -avg . - @echo "" - go vet ./... - @echo "" - golint ./... - -deps: - go get -v -u -d -t ./... - -clean: examples-clean - -examples: examples-build - -examples-build: $(EXAMPLES) - -examples-clean: - rm -f $(EXAMPLES) - -advertise: examples/advertise/*.go *.go - go build ./examples/advertise - -alive: examples/alive/*.go *.go - go build ./examples/alive - -bye: examples/bye/*.go *.go - go build ./examples/bye - -monitor: examples/monitor/*.go *.go - go build ./examples/monitor - -search: examples/search/*.go *.go - go build ./examples/search - -.PHONY: test test-full lint cyclo report deps clean \ - examples examples-build examples-clean diff --git a/vendor/github.com/koron/go-ssdp/README.md b/vendor/github.com/koron/go-ssdp/README.md deleted file mode 100644 index b24f071c..00000000 --- a/vendor/github.com/koron/go-ssdp/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# SSDP libraries - - * diff --git a/vendor/github.com/koron/go-ssdp/advertise.go b/vendor/github.com/koron/go-ssdp/advertise.go deleted file mode 100644 index 75c54c16..00000000 --- a/vendor/github.com/koron/go-ssdp/advertise.go +++ /dev/null @@ -1,181 +0,0 @@ -package ssdp - -import ( - "bufio" - "bytes" - "fmt" - "io" - "net" - "net/http" - "sync" -) - -type message struct { - to *net.UDPAddr - data []byte -} - -// Advertiser is a server to advertise a service. -type Advertiser struct { - st string - usn string - location string - server string - maxAge int - - conn *net.UDPConn - ch chan *message - wg sync.WaitGroup - quit chan bool -} - -// Advertise starts advertisement of service. -func Advertise(st, usn, location, server string, maxAge int) (*Advertiser, error) { - conn, err := multicastListen("0.0.0.0:1900") - if err != nil { - return nil, err - } - logf("advertising on %s", conn.LocalAddr().String()) - a := &Advertiser{ - st: st, - usn: usn, - location: location, - server: server, - maxAge: maxAge, - conn: conn, - ch: make(chan *message), - quit: make(chan bool), - } - a.wg.Add(2) - go func() { - a.sendMain() - a.wg.Done() - }() - go func() { - a.serve() - a.wg.Done() - }() - return a, nil -} - -func (a *Advertiser) serve() error { - buf := make([]byte, 65535) - for { - n, addr, err := a.conn.ReadFromUDP(buf) - if err != nil { - if err == io.EOF { - return nil - } - return err - } - select { - case _ = <-a.quit: - return nil - default: - } - msg := buf[:n] - if err := a.handleRaw(addr, msg); err != nil { - logf("failed to handle message: %s", err) - } - } -} - -func (a *Advertiser) sendMain() error { - for { - select { - case msg, ok := <-a.ch: - if !ok { - return nil - } - _, err := sendTo(msg.to, msg.data) - if err != nil { - if nerr, ok := err.(net.Error); !ok || !nerr.Temporary() { - logf("failed to send: %s", err) - } - } - case _ = <-a.quit: - return nil - } - } -} - -func (a *Advertiser) handleRaw(from *net.UDPAddr, raw []byte) error { - if !bytes.HasPrefix(raw, []byte("M-SEARCH ")) { - // unexpected method. - return nil - } - req, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(raw))) - if err != nil { - return err - } - var ( - man = req.Header.Get("MAN") - st = req.Header.Get("ST") - ) - if man != `"ssdp:discover"` { - return fmt.Errorf("unexpected MAN: %s", man) - } - if st != All && st != RootDevice && st != a.st { - // skip when ST is not matched/expected. - return nil - } - logf("received M-SEARCH MAN=%s ST=%s from %s", man, st, from.String()) - // build and send a response. - msg, err := buildOK(a.st, a.usn, a.location, a.server, a.maxAge) - if err != nil { - return err - } - a.ch <- &message{to: from, data: msg} - return nil -} - -func buildOK(st, usn, location, server string, maxAge int) ([]byte, error) { - b := new(bytes.Buffer) - // FIXME: error should be checked. - b.WriteString("HTTP/1.1 200 OK\r\n") - fmt.Fprintf(b, "ST: %s\r\n", st) - fmt.Fprintf(b, "USN: %s\r\n", usn) - if location != "" { - fmt.Fprintf(b, "LOCATION: %s\r\n", location) - } - if server != "" { - fmt.Fprintf(b, "SERVER: %s\r\n", server) - } - fmt.Fprintf(b, "CACHE-CONTROL: max-age=%d\r\n", maxAge) - b.WriteString("\r\n") - return b.Bytes(), nil -} - -// Close stops advertisement. -func (a *Advertiser) Close() error { - if a.conn != nil { - // closing order is very important. be caraful to change. - close(a.quit) - a.conn.Close() - a.wg.Wait() - close(a.ch) - a.conn = nil - } - return nil -} - -// Alive announces ssdp:alive message. -func (a *Advertiser) Alive() error { - msg, err := buildAlive(ssdpAddrIPv4, a.st, a.usn, a.location, a.server, - a.maxAge) - if err != nil { - return err - } - a.ch <- &message{to: ssdpAddrIPv4, data: msg} - return nil -} - -// Bye announces ssdp:byebye message. -func (a *Advertiser) Bye() error { - msg, err := buildBye(ssdpAddrIPv4, a.st, a.usn) - if err != nil { - return err - } - a.ch <- &message{to: ssdpAddrIPv4, data: msg} - return nil -} diff --git a/vendor/github.com/koron/go-ssdp/announce.go b/vendor/github.com/koron/go-ssdp/announce.go deleted file mode 100644 index 28157efb..00000000 --- a/vendor/github.com/koron/go-ssdp/announce.go +++ /dev/null @@ -1,76 +0,0 @@ -package ssdp - -import ( - "bytes" - "fmt" - "net" -) - -// AnnounceAlive sends ssdp:alive message. -func AnnounceAlive(nt, usn, location, server string, maxAge int, localAddr string) error { - // dial multicast UDP packet. - conn, err := multicastListen(localAddr) - if err != nil { - return err - } - defer conn.Close() - // build and send message. - msg, err := buildAlive(ssdpAddrIPv4, nt, usn, location, server, maxAge) - if err != nil { - return err - } - if _, err := conn.WriteTo(msg, ssdpAddrIPv4); err != nil { - return err - } - return nil -} - -func buildAlive(raddr net.Addr, nt, usn, location, server string, maxAge int) ([]byte, error) { - b := new(bytes.Buffer) - // FIXME: error should be checked. - b.WriteString("NOTIFY * HTTP/1.1\r\n") - fmt.Fprintf(b, "HOST: %s\r\n", raddr.String()) - fmt.Fprintf(b, "NT: %s\r\n", nt) - fmt.Fprintf(b, "NTS: %s\r\n", "ssdp:alive") - fmt.Fprintf(b, "USN: %s\r\n", usn) - if location != "" { - fmt.Fprintf(b, "LOCATION: %s\r\n", location) - } - if server != "" { - fmt.Fprintf(b, "SERVER: %s\r\n", server) - } - fmt.Fprintf(b, "CACHE-CONTROL: max-age=%d\r\n", maxAge) - b.WriteString("\r\n") - return b.Bytes(), nil -} - -// AnnounceBye sends ssdp:byebye message. -func AnnounceBye(nt, usn, localAddr string) error { - // dial multicast UDP packet. - conn, err := multicastListen(localAddr) - if err != nil { - return err - } - defer conn.Close() - // build and send message. - msg, err := buildBye(ssdpAddrIPv4, nt, usn) - if err != nil { - return err - } - if _, err := conn.WriteTo(msg, ssdpAddrIPv4); err != nil { - return err - } - return nil -} - -func buildBye(raddr net.Addr, nt, usn string) ([]byte, error) { - b := new(bytes.Buffer) - // FIXME: error should be checked. - b.WriteString("NOTIFY * HTTP/1.1\r\n") - fmt.Fprintf(b, "HOST: %s\r\n", raddr.String()) - fmt.Fprintf(b, "NT: %s\r\n", nt) - fmt.Fprintf(b, "NTS: %s\r\n", "ssdp:byebye") - fmt.Fprintf(b, "USN: %s\r\n", usn) - b.WriteString("\r\n") - return b.Bytes(), nil -} diff --git a/vendor/github.com/koron/go-ssdp/interface.go b/vendor/github.com/koron/go-ssdp/interface.go deleted file mode 100644 index 8c4cf55d..00000000 --- a/vendor/github.com/koron/go-ssdp/interface.go +++ /dev/null @@ -1,39 +0,0 @@ -package ssdp - -import "net" - -// Interfaces specify target interfaces to multicast. If no interfaces are -// specified, all interfaces will be used. -var Interfaces []net.Interface - -func interfacesIPv4() []net.Interface { - iflist, err := net.Interfaces() - if err != nil { - return nil - } - list := make([]net.Interface, 0, len(iflist)) - for _, ifi := range iflist { - if !hasIPv4Address(&ifi) { - continue - } - list = append(list, ifi) - } - return list -} - -func hasIPv4Address(ifi *net.Interface) bool { - addrs, err := ifi.Addrs() - if err != nil { - return false - } - for _, a := range addrs { - ip, _, err := net.ParseCIDR(a.String()) - if err != nil { - continue - } - if len(ip.To4()) == net.IPv4len && !ip.IsUnspecified() { - return true - } - } - return false -} diff --git a/vendor/github.com/koron/go-ssdp/log.go b/vendor/github.com/koron/go-ssdp/log.go deleted file mode 100644 index a4be85ad..00000000 --- a/vendor/github.com/koron/go-ssdp/log.go +++ /dev/null @@ -1,12 +0,0 @@ -package ssdp - -import "log" - -// Logger is default logger for SSDP module. -var Logger *log.Logger - -func logf(s string, a ...interface{}) { - if Logger != nil { - Logger.Printf(s, a...) - } -} diff --git a/vendor/github.com/koron/go-ssdp/monitor.go b/vendor/github.com/koron/go-ssdp/monitor.go deleted file mode 100644 index 686d4f9f..00000000 --- a/vendor/github.com/koron/go-ssdp/monitor.go +++ /dev/null @@ -1,173 +0,0 @@ -package ssdp - -import ( - "bufio" - "bytes" - "fmt" - "io" - "net" - "net/http" - "sync" -) - -// Monitor monitors SSDP's alive and byebye messages. -type Monitor struct { - alive AliveHandler - bye ByeHandler - conn net.PacketConn - wg sync.WaitGroup -} - -// NewMonitor creates a new Monitor. -func NewMonitor(alive AliveHandler, bye ByeHandler) (*Monitor, error) { - if alive == nil { - alive = nullAlive - } - if bye == nil { - bye = nullBye - } - conn, err := multicastListen("0.0.0.0:1900") - if err != nil { - return nil, err - } - logf("monitoring on %s", conn.LocalAddr().String()) - m := &Monitor{ - alive: alive, - bye: bye, - conn: conn, - } - m.wg.Add(1) - go func() { - m.serve() - m.wg.Done() - }() - return m, nil -} - -func (m *Monitor) serve() error { - buf := make([]byte, 65535) - for { - n, addr, err := m.conn.ReadFrom(buf) - if err != nil { - if err == io.EOF { - return nil - } - return err - } - msg := make([]byte, n) - copy(msg, buf[:n]) - go m.handleRaw(addr, msg) - } -} - -func (m *Monitor) handleRaw(addr net.Addr, raw []byte) error { - req, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(raw))) - if err != nil { - return err - } - switch nts := req.Header.Get("NTS"); nts { - case "ssdp:alive": - if req.Method != "NOTIFY" { - return fmt.Errorf("unexpected method for %q: %s", "ssdp:alive", req.Method) - } - m.alive(&Alive{ - From: addr, - Type: req.Header.Get("NT"), - USN: req.Header.Get("USN"), - Location: req.Header.Get("LOCATION"), - Server: req.Header.Get("SERVER"), - rawHeader: req.Header, - }) - case "ssdp:byebye": - if req.Method != "NOTIFY" { - return fmt.Errorf("unexpected method for %q: %s", "ssdp:byebye", req.Method) - } - m.bye(&Bye{ - From: addr, - Type: req.Header.Get("NT"), - USN: req.Header.Get("USN"), - rawHeader: req.Header, - }) - default: - return fmt.Errorf("unknown NTS: %s", nts) - } - return nil -} - -// Close closes monitoring. -func (m *Monitor) Close() error { - if m.conn != nil { - m.conn.Close() - m.conn = nil - m.wg.Wait() - } - return nil -} - -// Alive represents SSDP's ssdp:alive message. -type Alive struct { - // From is a sender of this message - From net.Addr - - // Type is a property of "NT" - Type string - - // USN is a property of "USN" - USN string - - // Location is a property of "LOCATION" - Location string - - // Server is a property of "SERVER" - Server string - - rawHeader http.Header - maxAge *int -} - -// Header returns all properties in response of search. -func (m *Alive) Header() http.Header { - return m.rawHeader -} - -// MaxAge extracts "max-age" value from "CACHE-CONTROL" property. -func (m *Alive) MaxAge() int { - if m.maxAge == nil { - m.maxAge = new(int) - *m.maxAge = extractMaxAge(m.rawHeader.Get("CACHE-CONTROL"), -1) - } - return *m.maxAge -} - -// AliveHandler is handler of Alive message. -type AliveHandler func(*Alive) - -func nullAlive(*Alive) { - // nothing to do. -} - -// Bye represents SSDP's ssdp:byebye message. -type Bye struct { - // From is a sender of this message - From net.Addr - - // Type is a property of "NT" - Type string - - // USN is a property of "USN" - USN string - - rawHeader http.Header -} - -// Header returns all properties in response of search. -func (m *Bye) Header() http.Header { - return m.rawHeader -} - -// ByeHandler is handler of Bye message. -type ByeHandler func(*Bye) - -func nullBye(*Bye) { - // nothing to do. -} diff --git a/vendor/github.com/koron/go-ssdp/search.go b/vendor/github.com/koron/go-ssdp/search.go deleted file mode 100644 index 0bc07758..00000000 --- a/vendor/github.com/koron/go-ssdp/search.go +++ /dev/null @@ -1,139 +0,0 @@ -package ssdp - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "net" - "net/http" - "regexp" - "strconv" - "time" -) - -// Service is discovered service. -type Service struct { - // Type is a property of "ST" - Type string - - // USN is a property of "USN" - USN string - - // Location is a property of "LOCATION" - Location string - - // Server is a property of "SERVER" - Server string - - rawHeader http.Header - maxAge *int -} - -var rxMaxAge = regexp.MustCompile(`\bmax-age\s*=\s*(\d+)\b`) - -func extractMaxAge(s string, value int) int { - v := value - if m := rxMaxAge.FindStringSubmatch(s); m != nil { - i64, err := strconv.ParseInt(m[1], 10, 32) - if err == nil { - v = int(i64) - } - } - return v -} - -// MaxAge extracts "max-age" value from "CACHE-CONTROL" property. -func (s *Service) MaxAge() int { - if s.maxAge == nil { - s.maxAge = new(int) - *s.maxAge = extractMaxAge(s.rawHeader.Get("CACHE-CONTROL"), -1) - } - return *s.maxAge -} - -// Header returns all properties in response of search. -func (s *Service) Header() http.Header { - return s.rawHeader -} - -const ( - // All is a search type to search all services and devices. - All = "ssdp:all" - - // RootDevice is a search type to search UPnP root devices. - RootDevice = "upnp:rootdevice" -) - -// Search searchs services by SSDP. -func Search(searchType string, waitSec int, localAddr string) ([]Service, error) { - // dial multicast UDP packet. - conn, err := multicastListen(localAddr) - if err != nil { - return nil, err - } - defer conn.Close() - logf("search on %s", conn.LocalAddr().String()) - - // send request. - msg, err := buildSearch(ssdpAddrIPv4, searchType, waitSec) - if err != nil { - return nil, err - } - if _, err := conn.WriteTo(msg, ssdpAddrIPv4); err != nil { - return nil, err - } - - // wait response. - var list []Service - h := func(a net.Addr, d []byte) error { - srv, err := parseService(a, d) - if err != nil { - logf("invalid search response from %s: %s", a.String(), err) - return nil - } - list = append(list, *srv) - logf("search response from %s: %s", a.String(), srv.USN) - return nil - } - d := time.Second * time.Duration(waitSec) - if err := readPackets(conn, d, h); err != nil { - return nil, err - } - - return list, err -} - -func buildSearch(raddr net.Addr, searchType string, waitSec int) ([]byte, error) { - b := new(bytes.Buffer) - // FIXME: error should be checked. - b.WriteString("M-SEARCH * HTTP/1.1\r\n") - fmt.Fprintf(b, "HOST: %s\r\n", raddr.String()) - fmt.Fprintf(b, "MAN: %q\r\n", "ssdp:discover") - fmt.Fprintf(b, "MX: %d\r\n", waitSec) - fmt.Fprintf(b, "ST: %s\r\n", searchType) - b.WriteString("\r\n") - return b.Bytes(), nil -} - -var ( - errWithoutHTTPPrefix = errors.New("without HTTP prefix") -) - -func parseService(addr net.Addr, data []byte) (*Service, error) { - if !bytes.HasPrefix(data, []byte("HTTP")) { - return nil, errWithoutHTTPPrefix - } - resp, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(data)), nil) - if err != nil { - return nil, err - } - defer resp.Body.Close() - return &Service{ - Type: resp.Header.Get("ST"), - USN: resp.Header.Get("USN"), - Location: resp.Header.Get("LOCATION"), - Server: resp.Header.Get("SERVER"), - rawHeader: resp.Header, - }, nil -} diff --git a/vendor/github.com/koron/go-ssdp/udp.go b/vendor/github.com/koron/go-ssdp/udp.go deleted file mode 100644 index f227e3a3..00000000 --- a/vendor/github.com/koron/go-ssdp/udp.go +++ /dev/null @@ -1,96 +0,0 @@ -package ssdp - -import ( - "errors" - "net" - "time" - - "golang.org/x/net/ipv4" -) - -var ( - ssdpAddrIPv4 *net.UDPAddr -) - -func init() { - var err error - ssdpAddrIPv4, err = net.ResolveUDPAddr("udp4", "239.255.255.250:1900") - if err != nil { - panic(err) - } -} - -type packetHandler func(net.Addr, []byte) error - -func readPackets(conn *net.UDPConn, timeout time.Duration, h packetHandler) error { - buf := make([]byte, 65535) - conn.SetReadBuffer(len(buf)) - conn.SetReadDeadline(time.Now().Add(timeout)) - for { - n, addr, err := conn.ReadFrom(buf) - if err != nil { - if nerr, ok := err.(net.Error); ok && nerr.Timeout() { - return nil - } - return err - } - if err := h(addr, buf[:n]); err != nil { - return err - } - } -} - -func sendTo(to *net.UDPAddr, data []byte) (int, error) { - conn, err := net.DialUDP("udp4", nil, to) - if err != nil { - return 0, err - } - defer conn.Close() - n, err := conn.Write(data) - if err != nil { - return 0, err - } - return n, nil -} - -func multicastListen(localAddr string) (*net.UDPConn, error) { - // prepare parameters. - laddr, err := net.ResolveUDPAddr("udp4", localAddr) - if err != nil { - return nil, err - } - // connect. - conn, err := net.ListenUDP("udp4", laddr) - if err != nil { - return nil, err - } - // configure socket to use with multicast. - if err := joinGroupIPv4(conn, Interfaces, ssdpAddrIPv4); err != nil { - conn.Close() - return nil, err - } - return conn, err -} - -// joinGroupIPv4 makes the connection join to a group on interfaces. -func joinGroupIPv4(conn net.PacketConn, iflist []net.Interface, gaddr net.Addr) error { - wrap := ipv4.NewPacketConn(conn) - wrap.SetMulticastLoopback(true) - if len(iflist) == 0 { - iflist = interfacesIPv4() - } - // add interfaces to multicast group. - joined := 0 - for _, ifi := range iflist { - if err := wrap.JoinGroup(&ifi, gaddr); err != nil { - logf("failed to join group %s on %s: %s", gaddr.String(), ifi.Name, err) - continue - } - joined++ - logf("joined gropup %s on %s", gaddr.String(), ifi.Name) - } - if joined == 0 { - return errors.New("no interfaces had joined to group") - } - return nil -} diff --git a/vendor/github.com/lib/pq/.travis.sh b/vendor/github.com/lib/pq/.travis.sh index 21a52644..a297dc45 100755 --- a/vendor/github.com/lib/pq/.travis.sh +++ b/vendor/github.com/lib/pq/.travis.sh @@ -80,7 +80,7 @@ megacheck_install() { } golint_install() { - go get golang.org/x/lint/golint + go get github.com/golang/lint/golint } $1 diff --git a/vendor/github.com/lib/pq/.travis.yml b/vendor/github.com/lib/pq/.travis.yml index f0305809..18556e08 100644 --- a/vendor/github.com/lib/pq/.travis.yml +++ b/vendor/github.com/lib/pq/.travis.yml @@ -1,9 +1,9 @@ language: go go: + - 1.8.x - 1.9.x - 1.10.x - - 1.11.x - master sudo: true @@ -44,7 +44,7 @@ script: - > goimports -d -e $(find -name '*.go') | awk '{ print } END { exit NR == 0 ? 0 : 1 }' - go vet ./... - - megacheck -go 1.9 ./... + - megacheck -go 1.8 ./... - golint ./... - PQTEST_BINARY_PARAMETERS=no go test -race -v ./... - PQTEST_BINARY_PARAMETERS=yes go test -race -v ./... diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.md index 385fe735..d71f3c2c 100644 --- a/vendor/github.com/lib/pq/README.md +++ b/vendor/github.com/lib/pq/README.md @@ -10,7 +10,7 @@ ## Docs For detailed documentation and basic usage examples, please see the package -documentation at . +documentation at . ## Tests diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index 012c8c7c..43c8df29 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -2,9 +2,7 @@ package pq import ( "bufio" - "context" "crypto/md5" - "crypto/sha256" "database/sql" "database/sql/driver" "encoding/binary" @@ -22,7 +20,6 @@ import ( "unicode" "github.com/lib/pq/oid" - "github.com/lib/pq/scram" ) // Common error types @@ -92,24 +89,13 @@ type Dialer interface { DialTimeout(network, address string, timeout time.Duration) (net.Conn, error) } -type DialerContext interface { - DialContext(ctx context.Context, network, address string) (net.Conn, error) -} +type defaultDialer struct{} -type defaultDialer struct { - d net.Dialer +func (d defaultDialer) Dial(ntw, addr string) (net.Conn, error) { + return net.Dial(ntw, addr) } - -func (d defaultDialer) Dial(network, address string) (net.Conn, error) { - return d.d.Dial(network, address) -} -func (d defaultDialer) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error) { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - return d.DialContext(ctx, network, address) -} -func (d defaultDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { - return d.d.DialContext(ctx, network, address) +func (d defaultDialer) DialTimeout(ntw, addr string, timeout time.Duration) (net.Conn, error) { + return net.DialTimeout(ntw, addr, timeout) } type conn struct { @@ -258,35 +244,90 @@ func (cn *conn) writeBuf(b byte) *writeBuf { } } -// Open opens a new connection to the database. dsn is a connection string. +// Open opens a new connection to the database. name is a connection string. // Most users should only use it through database/sql package from the standard // library. -func Open(dsn string) (_ driver.Conn, err error) { - return DialOpen(defaultDialer{}, dsn) +func Open(name string) (_ driver.Conn, err error) { + return DialOpen(defaultDialer{}, name) } // DialOpen opens a new connection to the database using a dialer. -func DialOpen(d Dialer, dsn string) (_ driver.Conn, err error) { - c, err := NewConnector(dsn) - if err != nil { - return nil, err - } - c.dialer = d - return c.open(context.Background()) -} - -func (c *Connector) open(ctx context.Context) (cn *conn, err error) { +func DialOpen(d Dialer, name string) (_ driver.Conn, err error) { // Handle any panics during connection initialization. Note that we // specifically do *not* want to use errRecover(), as that would turn any // connection errors into ErrBadConns, hiding the real error message from // the user. defer errRecoverNoErrBadConn(&err) - o := c.opts + o := make(values) - cn = &conn{ + // A number of defaults are applied here, in this order: + // + // * Very low precedence defaults applied in every situation + // * Environment variables + // * Explicitly passed connection information + o["host"] = "localhost" + o["port"] = "5432" + // N.B.: Extra float digits should be set to 3, but that breaks + // Postgres 8.4 and older, where the max is 2. + o["extra_float_digits"] = "2" + for k, v := range parseEnviron(os.Environ()) { + o[k] = v + } + + if strings.HasPrefix(name, "postgres://") || strings.HasPrefix(name, "postgresql://") { + name, err = ParseURL(name) + if err != nil { + return nil, err + } + } + + if err := parseOpts(name, o); err != nil { + return nil, err + } + + // Use the "fallback" application name if necessary + if fallback, ok := o["fallback_application_name"]; ok { + if _, ok := o["application_name"]; !ok { + o["application_name"] = fallback + } + } + + // We can't work with any client_encoding other than UTF-8 currently. + // However, we have historically allowed the user to set it to UTF-8 + // explicitly, and there's no reason to break such programs, so allow that. + // Note that the "options" setting could also set client_encoding, but + // parsing its value is not worth it. Instead, we always explicitly send + // client_encoding as a separate run-time parameter, which should override + // anything set in options. + if enc, ok := o["client_encoding"]; ok && !isUTF8(enc) { + return nil, errors.New("client_encoding must be absent or 'UTF8'") + } + o["client_encoding"] = "UTF8" + // DateStyle needs a similar treatment. + if datestyle, ok := o["datestyle"]; ok { + if datestyle != "ISO, MDY" { + panic(fmt.Sprintf("setting datestyle must be absent or %v; got %v", + "ISO, MDY", datestyle)) + } + } else { + o["datestyle"] = "ISO, MDY" + } + + // If a user is not provided by any other means, the last + // resort is to use the current operating system provided user + // name. + if _, ok := o["user"]; !ok { + u, err := userCurrent() + if err != nil { + return nil, err + } + o["user"] = u + } + + cn := &conn{ opts: o, - dialer: c.dialer, + dialer: d, } err = cn.handleDriverSettings(o) if err != nil { @@ -294,16 +335,13 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) { } cn.handlePgpass(o) - cn.c, err = dial(ctx, c.dialer, o) + cn.c, err = dial(d, o) if err != nil { return nil, err } err = cn.ssl(o) if err != nil { - if cn.c != nil { - cn.c.Close() - } return nil, err } @@ -326,10 +364,10 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) { return cn, err } -func dial(ctx context.Context, d Dialer, o values) (net.Conn, error) { - network, address := network(o) +func dial(d Dialer, o values) (net.Conn, error) { + ntw, addr := network(o) // SSL is not necessary or supported over UNIX domain sockets - if network == "unix" { + if ntw == "unix" { o["sslmode"] = "disable" } @@ -340,30 +378,19 @@ func dial(ctx context.Context, d Dialer, o values) (net.Conn, error) { return nil, fmt.Errorf("invalid value for parameter connect_timeout: %s", err) } duration := time.Duration(seconds) * time.Second - // connect_timeout should apply to the entire connection establishment // procedure, so we both use a timeout for the TCP connection // establishment and set a deadline for doing the initial handshake. // The deadline is then reset after startup() is done. deadline := time.Now().Add(duration) - var conn net.Conn - if dctx, ok := d.(DialerContext); ok { - ctx, cancel := context.WithTimeout(ctx, duration) - defer cancel() - conn, err = dctx.DialContext(ctx, network, address) - } else { - conn, err = d.DialTimeout(network, address, duration) - } + conn, err := d.DialTimeout(ntw, addr, duration) if err != nil { return nil, err } err = conn.SetDeadline(deadline) return conn, err } - if dctx, ok := d.(DialerContext); ok { - return dctx.DialContext(ctx, network, address) - } - return d.Dial(network, address) + return d.Dial(ntw, addr) } func network(o values) (string, string) { @@ -677,7 +704,7 @@ func (cn *conn) simpleQuery(q string) (res *rows, err error) { // res might be non-nil here if we received a previous // CommandComplete, but that's fine; just overwrite it res = &rows{cn: cn} - res.rowsHeader = parsePortalRowDescribe(r) + res.colNames, res.colFmts, res.colTyps = parsePortalRowDescribe(r) // To work around a bug in QueryRow in Go 1.2 and earlier, wait // until the first DataRow has been received. @@ -834,15 +861,17 @@ func (cn *conn) query(query string, args []driver.Value) (_ *rows, err error) { cn.readParseResponse() cn.readBindResponse() rows := &rows{cn: cn} - rows.rowsHeader = cn.readPortalDescribeResponse() + rows.colNames, rows.colFmts, rows.colTyps = cn.readPortalDescribeResponse() cn.postExecuteWorkaround() return rows, nil } st := cn.prepareTo(query, "") st.exec(args) return &rows{ - cn: cn, - rowsHeader: st.rowsHeader, + cn: cn, + colNames: st.colNames, + colTyps: st.colTyps, + colFmts: st.colFmts, }, nil } @@ -963,6 +992,7 @@ func (cn *conn) recv() (t byte, r *readBuf) { if err != nil { panic(err) } + switch t { case 'E': panic(parseError(r)) @@ -1133,55 +1163,6 @@ func (cn *conn) auth(r *readBuf, o values) { if r.int32() != 0 { errorf("unexpected authentication response: %q", t) } - case 10: - sc := scram.NewClient(sha256.New, o["user"], o["password"]) - sc.Step(nil) - if sc.Err() != nil { - errorf("SCRAM-SHA-256 error: %s", sc.Err().Error()) - } - scOut := sc.Out() - - w := cn.writeBuf('p') - w.string("SCRAM-SHA-256") - w.int32(len(scOut)) - w.bytes(scOut) - cn.send(w) - - t, r := cn.recv() - if t != 'R' { - errorf("unexpected password response: %q", t) - } - - if r.int32() != 11 { - errorf("unexpected authentication response: %q", t) - } - - nextStep := r.next(len(*r)) - sc.Step(nextStep) - if sc.Err() != nil { - errorf("SCRAM-SHA-256 error: %s", sc.Err().Error()) - } - - scOut = sc.Out() - w = cn.writeBuf('p') - w.bytes(scOut) - cn.send(w) - - t, r = cn.recv() - if t != 'R' { - errorf("unexpected password response: %q", t) - } - - if r.int32() != 12 { - errorf("unexpected authentication response: %q", t) - } - - nextStep = r.next(len(*r)) - sc.Step(nextStep) - if sc.Err() != nil { - errorf("SCRAM-SHA-256 error: %s", sc.Err().Error()) - } - default: errorf("unknown authentication response: %d", code) } @@ -1199,10 +1180,12 @@ var colFmtDataAllBinary = []byte{0, 1, 0, 1} var colFmtDataAllText = []byte{0, 0} type stmt struct { - cn *conn - name string - rowsHeader + cn *conn + name string + colNames []string + colFmts []format colFmtData []byte + colTyps []fieldDesc paramTyps []oid.Oid closed bool } @@ -1248,8 +1231,10 @@ func (st *stmt) Query(v []driver.Value) (r driver.Rows, err error) { st.exec(v) return &rows{ - cn: st.cn, - rowsHeader: st.rowsHeader, + cn: st.cn, + colNames: st.colNames, + colTyps: st.colTyps, + colFmts: st.colFmts, }, nil } @@ -1359,22 +1344,16 @@ func (cn *conn) parseComplete(commandTag string) (driver.Result, string) { return driver.RowsAffected(n), commandTag } -type rowsHeader struct { +type rows struct { + cn *conn + finish func() colNames []string colTyps []fieldDesc colFmts []format -} - -type rows struct { - cn *conn - finish func() - rowsHeader - done bool - rb readBuf - result driver.Result - tag string - - next *rowsHeader + done bool + rb readBuf + result driver.Result + tag string } func (rs *rows) Close() error { @@ -1461,8 +1440,7 @@ func (rs *rows) Next(dest []driver.Value) (err error) { } return case 'T': - next := parsePortalRowDescribe(&rs.rb) - rs.next = &next + rs.colNames, rs.colFmts, rs.colTyps = parsePortalRowDescribe(&rs.rb) return io.EOF default: errorf("unexpected message after execute: %q", t) @@ -1471,16 +1449,10 @@ func (rs *rows) Next(dest []driver.Value) (err error) { } func (rs *rows) HasNextResultSet() bool { - hasNext := rs.next != nil && !rs.done - return hasNext + return !rs.done } func (rs *rows) NextResultSet() error { - if rs.next == nil { - return io.EOF - } - rs.rowsHeader = *rs.next - rs.next = nil return nil } @@ -1503,39 +1475,6 @@ func QuoteIdentifier(name string) string { return `"` + strings.Replace(name, `"`, `""`, -1) + `"` } -// QuoteLiteral quotes a 'literal' (e.g. a parameter, often used to pass literal -// to DDL and other statements that do not accept parameters) to be used as part -// of an SQL statement. For example: -// -// exp_date := pq.QuoteLiteral("2023-01-05 15:00:00Z") -// err := db.Exec(fmt.Sprintf("CREATE ROLE my_user VALID UNTIL %s", exp_date)) -// -// Any single quotes in name will be escaped. Any backslashes (i.e. "\") will be -// replaced by two backslashes (i.e. "\\") and the C-style escape identifier -// that PostgreSQL provides ('E') will be prepended to the string. -func QuoteLiteral(literal string) string { - // This follows the PostgreSQL internal algorithm for handling quoted literals - // from libpq, which can be found in the "PQEscapeStringInternal" function, - // which is found in the libpq/fe-exec.c source file: - // https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/interfaces/libpq/fe-exec.c - // - // substitute any single-quotes (') with two single-quotes ('') - literal = strings.Replace(literal, `'`, `''`, -1) - // determine if the string has any backslashes (\) in it. - // if it does, replace any backslashes (\) with two backslashes (\\) - // then, we need to wrap the entire string with a PostgreSQL - // C-style escape. Per how "PQEscapeStringInternal" handles this case, we - // also add a space before the "E" - if strings.Contains(literal, `\`) { - literal = strings.Replace(literal, `\`, `\\`, -1) - literal = ` E'` + literal + `'` - } else { - // otherwise, we can just wrap the literal with a pair of single quotes - literal = `'` + literal + `'` - } - return literal -} - func md5s(s string) string { h := md5.New() h.Write([]byte(s)) @@ -1691,13 +1630,13 @@ func (cn *conn) readStatementDescribeResponse() (paramTyps []oid.Oid, colNames [ } } -func (cn *conn) readPortalDescribeResponse() rowsHeader { +func (cn *conn) readPortalDescribeResponse() (colNames []string, colFmts []format, colTyps []fieldDesc) { t, r := cn.recv1() switch t { case 'T': return parsePortalRowDescribe(r) case 'n': - return rowsHeader{} + return nil, nil, nil case 'E': err := parseError(r) cn.readReadyForQuery() @@ -1803,11 +1742,11 @@ func parseStatementRowDescribe(r *readBuf) (colNames []string, colTyps []fieldDe return } -func parsePortalRowDescribe(r *readBuf) rowsHeader { +func parsePortalRowDescribe(r *readBuf) (colNames []string, colFmts []format, colTyps []fieldDesc) { n := r.int16() - colNames := make([]string, n) - colFmts := make([]format, n) - colTyps := make([]fieldDesc, n) + colNames = make([]string, n) + colFmts = make([]format, n) + colTyps = make([]fieldDesc, n) for i := range colNames { colNames[i] = r.string() r.next(6) @@ -1816,11 +1755,7 @@ func parsePortalRowDescribe(r *readBuf) rowsHeader { colTyps[i].Mod = r.int32() colFmts[i] = format(r.int16()) } - return rowsHeader{ - colNames: colNames, - colFmts: colFmts, - colTyps: colTyps, - } + return } // parseEnviron tries to mimic some of libpq's environment handling diff --git a/vendor/github.com/lib/pq/conn_go18.go b/vendor/github.com/lib/pq/conn_go18.go index 0fdd06a6..a5254f2b 100644 --- a/vendor/github.com/lib/pq/conn_go18.go +++ b/vendor/github.com/lib/pq/conn_go18.go @@ -1,3 +1,5 @@ +// +build go1.8 + package pq import ( @@ -7,7 +9,6 @@ import ( "fmt" "io" "io/ioutil" - "time" ) // Implement the "QueryerContext" interface @@ -75,32 +76,13 @@ func (cn *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, return tx, nil } -func (cn *conn) Ping(ctx context.Context) error { - if finish := cn.watchCancel(ctx); finish != nil { - defer finish() - } - rows, err := cn.simpleQuery("SELECT 'lib/pq ping test';") - if err != nil { - return driver.ErrBadConn // https://golang.org/pkg/database/sql/driver/#Pinger - } - rows.Close() - return nil -} - func (cn *conn) watchCancel(ctx context.Context) func() { if done := ctx.Done(); done != nil { finished := make(chan struct{}) go func() { select { case <-done: - // At this point the function level context is canceled, - // so it must not be used for the additional network - // request to cancel the query. - // Create a new context to pass into the dial. - ctxCancel, cancel := context.WithTimeout(context.Background(), time.Second*10) - defer cancel() - - _ = cn.cancel(ctxCancel) + _ = cn.cancel() finished <- struct{}{} case <-finished: } @@ -115,8 +97,8 @@ func (cn *conn) watchCancel(ctx context.Context) func() { return nil } -func (cn *conn) cancel(ctx context.Context) error { - c, err := dial(ctx, cn.dialer, cn.opts) +func (cn *conn) cancel() error { + c, err := dial(cn.dialer, cn.opts) if err != nil { return err } diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.go index 2f8ced67..9e66eb5d 100644 --- a/vendor/github.com/lib/pq/connector.go +++ b/vendor/github.com/lib/pq/connector.go @@ -1,12 +1,10 @@ +// +build go1.10 + package pq import ( "context" "database/sql/driver" - "errors" - "fmt" - "os" - "strings" ) // Connector represents a fixed configuration for the pq driver with a given @@ -16,95 +14,30 @@ import ( // // See https://golang.org/pkg/database/sql/driver/#Connector. // See https://golang.org/pkg/database/sql/#OpenDB. -type Connector struct { - opts values - dialer Dialer +type connector struct { + name string } // Connect returns a connection to the database using the fixed configuration // of this Connector. Context is not used. -func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) { - return c.open(ctx) +func (c *connector) Connect(_ context.Context) (driver.Conn, error) { + return (&Driver{}).Open(c.name) } // Driver returnst the underlying driver of this Connector. -func (c *Connector) Driver() driver.Driver { +func (c *connector) Driver() driver.Driver { return &Driver{} } +var _ driver.Connector = &connector{} + // NewConnector returns a connector for the pq driver in a fixed configuration -// with the given dsn. The returned connector can be used to create any number +// with the given name. The returned connector can be used to create any number // of equivalent Conn's. The returned connector is intended to be used with // database/sql.OpenDB. // // See https://golang.org/pkg/database/sql/driver/#Connector. // See https://golang.org/pkg/database/sql/#OpenDB. -func NewConnector(dsn string) (*Connector, error) { - var err error - o := make(values) - - // A number of defaults are applied here, in this order: - // - // * Very low precedence defaults applied in every situation - // * Environment variables - // * Explicitly passed connection information - o["host"] = "localhost" - o["port"] = "5432" - // N.B.: Extra float digits should be set to 3, but that breaks - // Postgres 8.4 and older, where the max is 2. - o["extra_float_digits"] = "2" - for k, v := range parseEnviron(os.Environ()) { - o[k] = v - } - - if strings.HasPrefix(dsn, "postgres://") || strings.HasPrefix(dsn, "postgresql://") { - dsn, err = ParseURL(dsn) - if err != nil { - return nil, err - } - } - - if err := parseOpts(dsn, o); err != nil { - return nil, err - } - - // Use the "fallback" application name if necessary - if fallback, ok := o["fallback_application_name"]; ok { - if _, ok := o["application_name"]; !ok { - o["application_name"] = fallback - } - } - - // We can't work with any client_encoding other than UTF-8 currently. - // However, we have historically allowed the user to set it to UTF-8 - // explicitly, and there's no reason to break such programs, so allow that. - // Note that the "options" setting could also set client_encoding, but - // parsing its value is not worth it. Instead, we always explicitly send - // client_encoding as a separate run-time parameter, which should override - // anything set in options. - if enc, ok := o["client_encoding"]; ok && !isUTF8(enc) { - return nil, errors.New("client_encoding must be absent or 'UTF8'") - } - o["client_encoding"] = "UTF8" - // DateStyle needs a similar treatment. - if datestyle, ok := o["datestyle"]; ok { - if datestyle != "ISO, MDY" { - return nil, fmt.Errorf("setting datestyle must be absent or %v; got %v", "ISO, MDY", datestyle) - } - } else { - o["datestyle"] = "ISO, MDY" - } - - // If a user is not provided by any other means, the last - // resort is to use the current operating system provided user - // name. - if _, ok := o["user"]; !ok { - u, err := userCurrent() - if err != nil { - return nil, err - } - o["user"] = u - } - - return &Connector{opts: o, dialer: defaultDialer{}}, nil +func NewConnector(name string) (driver.Connector, error) { + return &connector{name: name}, nil } diff --git a/vendor/github.com/lib/pq/doc.go b/vendor/github.com/lib/pq/doc.go index 2a60054e..a1b02971 100644 --- a/vendor/github.com/lib/pq/doc.go +++ b/vendor/github.com/lib/pq/doc.go @@ -239,7 +239,7 @@ for more information). Note that the channel name will be truncated to 63 bytes by the PostgreSQL server. You can find a complete, working example of Listener usage at -https://godoc.org/github.com/lib/pq/example/listen. +http://godoc.org/github.com/lib/pq/example/listen. */ package pq diff --git a/vendor/github.com/lib/pq/encode.go b/vendor/github.com/lib/pq/encode.go index a6902fae..3b0d365f 100644 --- a/vendor/github.com/lib/pq/encode.go +++ b/vendor/github.com/lib/pq/encode.go @@ -117,10 +117,11 @@ func textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interfa } return i case oid.T_float4, oid.T_float8: - // We always use 64 bit parsing, regardless of whether the input text is for - // a float4 or float8, because clients expect float64s for all float datatypes - // and returning a 32-bit parsed float64 produces lossy results. - f, err := strconv.ParseFloat(string(s), 64) + bits := 64 + if typ == oid.T_float4 { + bits = 32 + } + f, err := strconv.ParseFloat(string(s), bits) if err != nil { errorf("%s", err) } diff --git a/vendor/github.com/lib/pq/scram/scram.go b/vendor/github.com/lib/pq/scram/scram.go deleted file mode 100644 index 5d0358f8..00000000 --- a/vendor/github.com/lib/pq/scram/scram.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) 2014 - Gustavo Niemeyer -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802. -// -// http://tools.ietf.org/html/rfc5802 -// -package scram - -import ( - "bytes" - "crypto/hmac" - "crypto/rand" - "encoding/base64" - "fmt" - "hash" - "strconv" - "strings" -) - -// Client implements a SCRAM-* client (SCRAM-SHA-1, SCRAM-SHA-256, etc). -// -// A Client may be used within a SASL conversation with logic resembling: -// -// var in []byte -// var client = scram.NewClient(sha1.New, user, pass) -// for client.Step(in) { -// out := client.Out() -// // send out to server -// in := serverOut -// } -// if client.Err() != nil { -// // auth failed -// } -// -type Client struct { - newHash func() hash.Hash - - user string - pass string - step int - out bytes.Buffer - err error - - clientNonce []byte - serverNonce []byte - saltedPass []byte - authMsg bytes.Buffer -} - -// NewClient returns a new SCRAM-* client with the provided hash algorithm. -// -// For SCRAM-SHA-256, for example, use: -// -// client := scram.NewClient(sha256.New, user, pass) -// -func NewClient(newHash func() hash.Hash, user, pass string) *Client { - c := &Client{ - newHash: newHash, - user: user, - pass: pass, - } - c.out.Grow(256) - c.authMsg.Grow(256) - return c -} - -// Out returns the data to be sent to the server in the current step. -func (c *Client) Out() []byte { - if c.out.Len() == 0 { - return nil - } - return c.out.Bytes() -} - -// Err returns the error that ocurred, or nil if there were no errors. -func (c *Client) Err() error { - return c.err -} - -// SetNonce sets the client nonce to the provided value. -// If not set, the nonce is generated automatically out of crypto/rand on the first step. -func (c *Client) SetNonce(nonce []byte) { - c.clientNonce = nonce -} - -var escaper = strings.NewReplacer("=", "=3D", ",", "=2C") - -// Step processes the incoming data from the server and makes the -// next round of data for the server available via Client.Out. -// Step returns false if there are no errors and more data is -// still expected. -func (c *Client) Step(in []byte) bool { - c.out.Reset() - if c.step > 2 || c.err != nil { - return false - } - c.step++ - switch c.step { - case 1: - c.err = c.step1(in) - case 2: - c.err = c.step2(in) - case 3: - c.err = c.step3(in) - } - return c.step > 2 || c.err != nil -} - -func (c *Client) step1(in []byte) error { - if len(c.clientNonce) == 0 { - const nonceLen = 16 - buf := make([]byte, nonceLen+b64.EncodedLen(nonceLen)) - if _, err := rand.Read(buf[:nonceLen]); err != nil { - return fmt.Errorf("cannot read random SCRAM-SHA-256 nonce from operating system: %v", err) - } - c.clientNonce = buf[nonceLen:] - b64.Encode(c.clientNonce, buf[:nonceLen]) - } - c.authMsg.WriteString("n=") - escaper.WriteString(&c.authMsg, c.user) - c.authMsg.WriteString(",r=") - c.authMsg.Write(c.clientNonce) - - c.out.WriteString("n,,") - c.out.Write(c.authMsg.Bytes()) - return nil -} - -var b64 = base64.StdEncoding - -func (c *Client) step2(in []byte) error { - c.authMsg.WriteByte(',') - c.authMsg.Write(in) - - fields := bytes.Split(in, []byte(",")) - if len(fields) != 3 { - return fmt.Errorf("expected 3 fields in first SCRAM-SHA-256 server message, got %d: %q", len(fields), in) - } - if !bytes.HasPrefix(fields[0], []byte("r=")) || len(fields[0]) < 2 { - return fmt.Errorf("server sent an invalid SCRAM-SHA-256 nonce: %q", fields[0]) - } - if !bytes.HasPrefix(fields[1], []byte("s=")) || len(fields[1]) < 6 { - return fmt.Errorf("server sent an invalid SCRAM-SHA-256 salt: %q", fields[1]) - } - if !bytes.HasPrefix(fields[2], []byte("i=")) || len(fields[2]) < 6 { - return fmt.Errorf("server sent an invalid SCRAM-SHA-256 iteration count: %q", fields[2]) - } - - c.serverNonce = fields[0][2:] - if !bytes.HasPrefix(c.serverNonce, c.clientNonce) { - return fmt.Errorf("server SCRAM-SHA-256 nonce is not prefixed by client nonce: got %q, want %q+\"...\"", c.serverNonce, c.clientNonce) - } - - salt := make([]byte, b64.DecodedLen(len(fields[1][2:]))) - n, err := b64.Decode(salt, fields[1][2:]) - if err != nil { - return fmt.Errorf("cannot decode SCRAM-SHA-256 salt sent by server: %q", fields[1]) - } - salt = salt[:n] - iterCount, err := strconv.Atoi(string(fields[2][2:])) - if err != nil { - return fmt.Errorf("server sent an invalid SCRAM-SHA-256 iteration count: %q", fields[2]) - } - c.saltPassword(salt, iterCount) - - c.authMsg.WriteString(",c=biws,r=") - c.authMsg.Write(c.serverNonce) - - c.out.WriteString("c=biws,r=") - c.out.Write(c.serverNonce) - c.out.WriteString(",p=") - c.out.Write(c.clientProof()) - return nil -} - -func (c *Client) step3(in []byte) error { - var isv, ise bool - var fields = bytes.Split(in, []byte(",")) - if len(fields) == 1 { - isv = bytes.HasPrefix(fields[0], []byte("v=")) - ise = bytes.HasPrefix(fields[0], []byte("e=")) - } - if ise { - return fmt.Errorf("SCRAM-SHA-256 authentication error: %s", fields[0][2:]) - } else if !isv { - return fmt.Errorf("unsupported SCRAM-SHA-256 final message from server: %q", in) - } - if !bytes.Equal(c.serverSignature(), fields[0][2:]) { - return fmt.Errorf("cannot authenticate SCRAM-SHA-256 server signature: %q", fields[0][2:]) - } - return nil -} - -func (c *Client) saltPassword(salt []byte, iterCount int) { - mac := hmac.New(c.newHash, []byte(c.pass)) - mac.Write(salt) - mac.Write([]byte{0, 0, 0, 1}) - ui := mac.Sum(nil) - hi := make([]byte, len(ui)) - copy(hi, ui) - for i := 1; i < iterCount; i++ { - mac.Reset() - mac.Write(ui) - mac.Sum(ui[:0]) - for j, b := range ui { - hi[j] ^= b - } - } - c.saltedPass = hi -} - -func (c *Client) clientProof() []byte { - mac := hmac.New(c.newHash, c.saltedPass) - mac.Write([]byte("Client Key")) - clientKey := mac.Sum(nil) - hash := c.newHash() - hash.Write(clientKey) - storedKey := hash.Sum(nil) - mac = hmac.New(c.newHash, storedKey) - mac.Write(c.authMsg.Bytes()) - clientProof := mac.Sum(nil) - for i, b := range clientKey { - clientProof[i] ^= b - } - clientProof64 := make([]byte, b64.EncodedLen(len(clientProof))) - b64.Encode(clientProof64, clientProof) - return clientProof64 -} - -func (c *Client) serverSignature() []byte { - mac := hmac.New(c.newHash, c.saltedPass) - mac.Write([]byte("Server Key")) - serverKey := mac.Sum(nil) - - mac = hmac.New(c.newHash, serverKey) - mac.Write(c.authMsg.Bytes()) - serverSignature := mac.Sum(nil) - - encoded := make([]byte, b64.EncodedLen(len(serverSignature))) - b64.Encode(encoded, serverSignature) - return encoded -} diff --git a/vendor/github.com/lib/pq/ssl.go b/vendor/github.com/lib/pq/ssl.go index d9020845..e1a326a0 100644 --- a/vendor/github.com/lib/pq/ssl.go +++ b/vendor/github.com/lib/pq/ssl.go @@ -58,13 +58,7 @@ func ssl(o values) (func(net.Conn) (net.Conn, error), error) { if err != nil { return nil, err } - - // Accept renegotiation requests initiated by the backend. - // - // Renegotiation was deprecated then removed from PostgreSQL 9.5, but - // the default configuration of older versions has it enabled. Redshift - // also initiates renegotiations and cannot be reconfigured. - tlsConf.Renegotiation = tls.RenegotiateFreelyAsClient + sslRenegotiation(&tlsConf) return func(conn net.Conn) (net.Conn, error) { client := tls.Client(conn, &tlsConf) diff --git a/vendor/github.com/lib/pq/ssl_go1.7.go b/vendor/github.com/lib/pq/ssl_go1.7.go new file mode 100644 index 00000000..d7ba43b3 --- /dev/null +++ b/vendor/github.com/lib/pq/ssl_go1.7.go @@ -0,0 +1,14 @@ +// +build go1.7 + +package pq + +import "crypto/tls" + +// Accept renegotiation requests initiated by the backend. +// +// Renegotiation was deprecated then removed from PostgreSQL 9.5, but +// the default configuration of older versions has it enabled. Redshift +// also initiates renegotiations and cannot be reconfigured. +func sslRenegotiation(conf *tls.Config) { + conf.Renegotiation = tls.RenegotiateFreelyAsClient +} diff --git a/vendor/github.com/lib/pq/ssl_renegotiation.go b/vendor/github.com/lib/pq/ssl_renegotiation.go new file mode 100644 index 00000000..85ed5e43 --- /dev/null +++ b/vendor/github.com/lib/pq/ssl_renegotiation.go @@ -0,0 +1,8 @@ +// +build !go1.7 + +package pq + +import "crypto/tls" + +// Renegotiation is not supported by crypto/tls until Go 1.7. +func sslRenegotiation(*tls.Config) {} diff --git a/vendor/github.com/libp2p/go-addr-util/.travis.yml b/vendor/github.com/libp2p/go-addr-util/.travis.yml deleted file mode 100644 index dde69d1a..00000000 --- a/vendor/github.com/libp2p/go-addr-util/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - /Users/raul/go/src/gx - - /Users/raul/go/pkg/mod - - /Users/raul/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-addr-util/LICENSE b/vendor/github.com/libp2p/go-addr-util/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-addr-util/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-addr-util/Makefile b/vendor/github.com/libp2p/go-addr-util/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/libp2p/go-addr-util/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/libp2p/go-addr-util/README.md b/vendor/github.com/libp2p/go-addr-util/README.md deleted file mode 100644 index 617ea6af..00000000 --- a/vendor/github.com/libp2p/go-addr-util/README.md +++ /dev/null @@ -1,34 +0,0 @@ -go-addr-util -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![codecov](https://codecov.io/gh/libp2p/go-addr-util/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-addr-util) -[![Travis CI](https://travis-ci.org/libp2p/go-addr-util.svg?branch=master)](https://travis-ci.org/libp2p/go-addr-util) - -> Address utilities for libp2p swarm. - -## Table of Contents - -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-addr-util/issues)! - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © Jeromy Johnson diff --git a/vendor/github.com/libp2p/go-addr-util/addr.go b/vendor/github.com/libp2p/go-addr-util/addr.go deleted file mode 100644 index 3a922a6e..00000000 --- a/vendor/github.com/libp2p/go-addr-util/addr.go +++ /dev/null @@ -1,197 +0,0 @@ -package addrutil - -import ( - "context" - "fmt" - - logging "github.com/ipfs/go-log" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -var log = logging.Logger("addrutil") - -// FilterAddrs is a filter that removes certain addresses, according to the given filters. -// If all filters return true, the address is kept. -func FilterAddrs(a []ma.Multiaddr, filters ...func(ma.Multiaddr) bool) []ma.Multiaddr { - b := make([]ma.Multiaddr, 0, len(a)) - for _, addr := range a { - good := true - for _, filter := range filters { - good = good && filter(addr) - } - if good { - b = append(b, addr) - } - } - return b -} - -// AddrOverNonLocalIP returns whether the addr uses a non-local ip link -func AddrOverNonLocalIP(a ma.Multiaddr) bool { - split := ma.Split(a) - if len(split) < 1 { - return false - } - if manet.IsIP6LinkLocal(split[0]) { - return false - } - return true -} - -// ResolveUnspecifiedAddress expands an unspecified ip addresses (/ip4/0.0.0.0, /ip6/::) to -// use the known local interfaces. If ifaceAddr is nil, we request interface addresses -// from the network stack. (this is so you can provide a cached value if resolving many addrs) -func ResolveUnspecifiedAddress(resolve ma.Multiaddr, ifaceAddrs []ma.Multiaddr) ([]ma.Multiaddr, error) { - // split address into its components - split := ma.Split(resolve) - - // if first component (ip) is not unspecified, use it as is. - if !manet.IsIPUnspecified(split[0]) { - return []ma.Multiaddr{resolve}, nil - } - - out := make([]ma.Multiaddr, 0, len(ifaceAddrs)) - for _, ia := range ifaceAddrs { - // must match the first protocol to be resolve. - if ia.Protocols()[0].Code != resolve.Protocols()[0].Code { - continue - } - - split[0] = ia - joined := ma.Join(split...) - out = append(out, joined) - log.Debug("adding resolved addr:", resolve, joined, out) - } - if len(out) < 1 { - return nil, fmt.Errorf("failed to resolve: %s", resolve) - } - return out, nil -} - -// ResolveUnspecifiedAddresses expands unspecified ip addresses (/ip4/0.0.0.0, /ip6/::) to -// use the known local interfaces. -func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.Multiaddr, error) { - - // todo optimize: only fetch these if we have a "any" addr. - if len(ifaceAddrs) < 1 { - var err error - ifaceAddrs, err = InterfaceAddresses() - if err != nil { - return nil, err - } - // log.Debug("InterfaceAddresses:", ifaceAddrs) - } - - var outputAddrs []ma.Multiaddr - for _, a := range unspecAddrs { - // unspecified? - resolved, err := ResolveUnspecifiedAddress(a, ifaceAddrs) - if err != nil { - continue // optimistic. if we cant resolve anything, we'll know at the bottom. - } - // log.Debug("resolved:", a, resolved) - outputAddrs = append(outputAddrs, resolved...) - } - - if len(outputAddrs) < 1 { - return nil, fmt.Errorf("failed to specify addrs: %s", unspecAddrs) - } - - log.Event(context.TODO(), "interfaceListenAddresses", func() logging.Loggable { - var addrs []string - for _, addr := range outputAddrs { - addrs = append(addrs, addr.String()) - } - return logging.Metadata{"addresses": addrs} - }()) - - log.Debug("ResolveUnspecifiedAddresses:", unspecAddrs, ifaceAddrs, outputAddrs) - return outputAddrs, nil -} - -// InterfaceAddresses returns a list of addresses associated with local machine -// Note: we do not return link local addresses. IP loopback is ok, because we -// may be connecting to other nodes in the same machine. -func InterfaceAddresses() ([]ma.Multiaddr, error) { - maddrs, err := manet.InterfaceMultiaddrs() - if err != nil { - return nil, err - } - log.Debug("InterfaceAddresses: from manet:", maddrs) - - var out []ma.Multiaddr - for _, a := range maddrs { - if !AddrOverNonLocalIP(a) { - // log.Debug("InterfaceAddresses: skipping unusable:", a) - continue - } - - out = append(out, a) - } - - log.Debug("InterfaceAddresses: usable:", out) - return out, nil -} - -// AddrInList returns whether or not an address is part of a list. -// this is useful to check if NAT is happening (or other bugs?) -func AddrInList(addr ma.Multiaddr, list []ma.Multiaddr) bool { - for _, addr2 := range list { - if addr.Equal(addr2) { - return true - } - } - return false -} - -// AddrIsShareableOnWAN returns whether the given address should be shareable on the -// wide area network (wide internet). -func AddrIsShareableOnWAN(addr ma.Multiaddr) bool { - s := ma.Split(addr) - if len(s) < 1 { - return false - } - a := s[0] - if manet.IsIPLoopback(a) || manet.IsIP6LinkLocal(a) || manet.IsIPUnspecified(a) { - return false - } - return manet.IsThinWaist(a) -} - -// WANShareableAddrs filters addresses based on whether they're shareable on WAN -func WANShareableAddrs(inp []ma.Multiaddr) []ma.Multiaddr { - return FilterAddrs(inp, AddrIsShareableOnWAN) -} - -// Subtract filters out all addrs in b from a -func Subtract(a, b []ma.Multiaddr) []ma.Multiaddr { - return FilterAddrs(a, func(m ma.Multiaddr) bool { - for _, bb := range b { - if m.Equal(bb) { - return false - } - } - return true - }) -} - -// CheckNATWarning checks if our observed addresses differ. if so, -// informs the user that certain things might not work yet -func CheckNATWarning(observed, expected ma.Multiaddr, listen []ma.Multiaddr) { - if observed.Equal(expected) { - return - } - - if !AddrInList(observed, listen) { // probably a nat - log.Warningf(natWarning, observed, listen) - } -} - -const natWarning = `Remote peer observed our address to be: %s -The local addresses are: %s -Thus, connection is going through NAT, and other connections may fail. - -IPFS NAT traversal is still under development. Please bug us on github or irc to fix this. -Baby steps: http://jbenet.static.s3.amazonaws.com/271dfcf/baby-steps.gif -` diff --git a/vendor/github.com/libp2p/go-addr-util/codecov.yml b/vendor/github.com/libp2p/go-addr-util/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-addr-util/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-addr-util/filter.go b/vendor/github.com/libp2p/go-addr-util/filter.go deleted file mode 100644 index dc9cddbf..00000000 --- a/vendor/github.com/libp2p/go-addr-util/filter.go +++ /dev/null @@ -1,31 +0,0 @@ -package addrutil - -import ( - ma "github.com/multiformats/go-multiaddr" - mafmt "github.com/whyrusleeping/mafmt" -) - -// SubtractFilter returns a filter func that filters all of the given addresses -func SubtractFilter(addrs ...ma.Multiaddr) func(ma.Multiaddr) bool { - addrmap := make(map[string]bool, len(addrs)) - for _, a := range addrs { - addrmap[string(a.Bytes())] = true - } - - return func(a ma.Multiaddr) bool { - return !addrmap[string(a.Bytes())] - } -} - -// IsFDCostlyTransport returns true for transports that require a new file -// descriptor per connection created -func IsFDCostlyTransport(a ma.Multiaddr) bool { - return mafmt.TCP.Matches(a) -} - -// FilterNeg returns a negated version of the passed in filter -func FilterNeg(f func(ma.Multiaddr) bool) func(ma.Multiaddr) bool { - return func(a ma.Multiaddr) bool { - return !f(a) - } -} diff --git a/vendor/github.com/libp2p/go-addr-util/go.mod b/vendor/github.com/libp2p/go-addr-util/go.mod deleted file mode 100644 index f13ba7fc..00000000 --- a/vendor/github.com/libp2p/go-addr-util/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-addr-util - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/whyrusleeping/mafmt v1.2.8 -) diff --git a/vendor/github.com/libp2p/go-addr-util/go.sum b/vendor/github.com/libp2p/go-addr-util/go.sum deleted file mode 100644 index a9e0c634..00000000 --- a/vendor/github.com/libp2p/go-addr-util/go.sum +++ /dev/null @@ -1,49 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/libp2p/go-addr-util/package.json b/vendor/github.com/libp2p/go-addr-util/package.json deleted file mode 100644 index 55abab99..00000000 --- a/vendor/github.com/libp2p/go-addr-util/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/libp2p/go-addr-util/issues" - }, - "gx": { - "dvcsimport": "github.com/libp2p/go-addr-util" - }, - "gxDependencies": [ - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "jbenet", - "hash": "Qmc85NSvmSG4Frn9Vb2cBc1rMyULH6D3TNVEfCzSKoUpip", - "name": "go-multiaddr-net", - "version": "1.7.2" - }, - { - "author": "whyrusleeping", - "hash": "QmUrZZavcArYChpibtP8KgQXsAEpvgzUk73B2oj3HLbWc4", - "name": "mafmt", - "version": "1.2.11" - }, - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - } - ], - "gxVersion": "0.9.1", - "language": "go", - "license": "MIT", - "name": "go-addr-util", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "2.0.11" -} - diff --git a/vendor/github.com/libp2p/go-buffer-pool/.travis.yml b/vendor/github.com/libp2p/go-buffer-pool/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-buffer-pool/LICENSE b/vendor/github.com/libp2p/go-buffer-pool/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-buffer-pool/LICENSE-BSD b/vendor/github.com/libp2p/go-buffer-pool/LICENSE-BSD deleted file mode 100644 index 97ece789..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/LICENSE-BSD +++ /dev/null @@ -1,29 +0,0 @@ -### Applies to buffer.go and buffer_test.go ### - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/libp2p/go-buffer-pool/README.md b/vendor/github.com/libp2p/go-buffer-pool/README.md deleted file mode 100644 index 830cb562..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/README.md +++ /dev/null @@ -1,53 +0,0 @@ -go-buffer-pool -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23libp2p) -[![codecov](https://codecov.io/gh/libp2p/go-buffer-pool/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-buffer-pool) -[![Travis CI](https://travis-ci.org/libp2p/go-buffer-pool.svg?branch=master)](https://travis-ci.org/libp2p/go-buffer-pool) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A variable size buffer pool for go. - -## Table of Contents - -- [Use Case](#use-case) - - [Advantages over GC](#advantages-over-gc) - - [Disadvantages over GC:](#disadvantages-over-gc) -- [Contribute](#contribute) -- [License](#license) - -## Use Case - -Use this when you need to repeatedly allocate and free a bunch of temporary buffers of approximately the same size. - -### Advantages over GC - -* Reduces Memory Usage: - * We don't have to wait for a GC to run before we can reuse memory. This is essential if you're repeatedly allocating large short-lived buffers. - -* Reduces CPU usage: - * It takes some load off of the GC (due to buffer reuse). - * We don't have to zero buffers (fewer wasteful memory writes). - -### Disadvantages over GC: - -* Can leak memory contents. Unlike the go GC, we *don't* zero memory. -* All buffers have a capacity of a power of 2. This is fine if you either (a) actually need buffers with this size or (b) expect these buffers to be temporary. -* Requires that buffers be returned explicitly. This can lead to race conditions and memory corruption if the buffer is released while it's still in use. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs -BSD © The Go Authors - ---- - -The last gx published version of this module was: 0.1.3: QmQDvJoB6aJWN3sjr3xsgXqKCXf4jU5zdMXpDMsBkYVNqa diff --git a/vendor/github.com/libp2p/go-buffer-pool/buffer.go b/vendor/github.com/libp2p/go-buffer-pool/buffer.go deleted file mode 100644 index 2e4645a9..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/buffer.go +++ /dev/null @@ -1,302 +0,0 @@ -// This is a derivitive work of Go's bytes.Buffer implementation. -// -// Originally copyright 2009 The Go Authors. All rights reserved. -// -// Modifications copyright 2018 Steven Allen. All rights reserved. -// -// Use of this source code is governed by both a BSD-style and an MIT-style -// license that can be found in the LICENSE_BSD and LICENSE files. - -package pool - -import ( - "io" -) - -// Buffer is a buffer like bytes.Buffer that: -// -// 1. Uses a buffer pool. -// 2. Frees memory on read. -// -// If you only have a few buffers and read/write at a steady rate, *don't* use -// this package, it'll be slower. -// -// However: -// -// 1. If you frequently create/destroy buffers, this implementation will be -// significantly nicer to the allocator. -// 2. If you have many buffers with bursty traffic, this implementation will use -// significantly less memory. -type Buffer struct { - // Pool is the buffer pool to use. If nil, this Buffer will use the - // global buffer pool. - Pool *BufferPool - - buf []byte - rOff int - - // Preallocated slice for samll reads/writes. - // This is *really* important for performance and only costs 8 words. - bootstrap [64]byte -} - -// NewBuffer constructs a new buffer initialized to `buf`. -// Unlike `bytes.Buffer`, we *copy* the buffer but don't reuse it (to ensure -// that we *only* use buffers from the pool). -func NewBuffer(buf []byte) *Buffer { - b := new(Buffer) - if len(buf) > 0 { - b.buf = b.getBuf(len(buf)) - copy(b.buf, buf) - } - return b -} - -// NewBufferString is identical to NewBuffer *except* that it allows one to -// initialize the buffer from a string (without having to allocate an -// intermediate bytes slice). -func NewBufferString(buf string) *Buffer { - b := new(Buffer) - if len(buf) > 0 { - b.buf = b.getBuf(len(buf)) - copy(b.buf, buf) - } - return b -} - -func (b *Buffer) grow(n int) int { - wOff := len(b.buf) - bCap := cap(b.buf) - - if bCap >= wOff+n { - b.buf = b.buf[:wOff+n] - return wOff - } - - bSize := b.Len() - - minCap := 2*bSize + n - - // Slide if cap >= minCap. - // Reallocate otherwise. - if bCap >= minCap { - copy(b.buf, b.buf[b.rOff:]) - } else { - // Needs new buffer. - newBuf := b.getBuf(minCap) - copy(newBuf, b.buf[b.rOff:]) - b.returnBuf() - b.buf = newBuf - } - - b.rOff = 0 - b.buf = b.buf[:bSize+n] - return bSize -} - -func (b *Buffer) getPool() *BufferPool { - if b.Pool == nil { - return GlobalPool - } - return b.Pool -} - -func (b *Buffer) returnBuf() { - if cap(b.buf) > len(b.bootstrap) { - b.getPool().Put(b.buf) - } - b.buf = nil -} - -func (b *Buffer) getBuf(n int) []byte { - if n <= len(b.bootstrap) { - return b.bootstrap[:n] - } - return b.getPool().Get(n) -} - -// Len returns the number of bytes that can be read from this buffer. -func (b *Buffer) Len() int { - return len(b.buf) - b.rOff -} - -// Cap returns the current capacity of the buffer. -// -// Note: Buffer *may* re-allocate when writing (or growing by) `n` bytes even if -// `Cap() < Len() + n` to avoid excessive copying. -func (b *Buffer) Cap() int { - return cap(b.buf) -} - -// Bytes returns the slice of bytes currently buffered in the Buffer. -// -// The buffer returned by Bytes is valid until the next call grow, truncate, -// read, or write. Really, just don't touch the Buffer until you're done with -// the return value of this function. -func (b *Buffer) Bytes() []byte { - return b.buf[b.rOff:] -} - -// String returns the string representation of the buffer. -// -// It returns `` the buffer is a nil pointer. -func (b *Buffer) String() string { - if b == nil { - return "" - } - return string(b.buf[b.rOff:]) -} - -// WriteString writes a string to the buffer. -// -// This function is identical to Write except that it allows one to write a -// string directly without allocating an intermediate byte slice. -func (b *Buffer) WriteString(buf string) (int, error) { - wOff := b.grow(len(buf)) - return copy(b.buf[wOff:], buf), nil -} - -// Truncate truncates the Buffer. -// -// Panics if `n > b.Len()`. -// -// This function may free memory by shrinking the internal buffer. -func (b *Buffer) Truncate(n int) { - if n < 0 || n > b.Len() { - panic("truncation out of range") - } - b.buf = b.buf[:b.rOff+n] - b.shrink() -} - -// Reset is equivalent to Truncate(0). -func (b *Buffer) Reset() { - b.returnBuf() - b.rOff = 0 -} - -// ReadByte reads a single byte from the Buffer. -func (b *Buffer) ReadByte() (byte, error) { - if b.rOff >= len(b.buf) { - return 0, io.EOF - } - c := b.buf[b.rOff] - b.rOff++ - return c, nil -} - -// WriteByte writes a single byte to the Buffer. -func (b *Buffer) WriteByte(c byte) error { - wOff := b.grow(1) - b.buf[wOff] = c - return nil -} - -// Grow grows the internal buffer such that `n` bytes can be written without -// reallocating. -func (b *Buffer) Grow(n int) { - wOff := b.grow(n) - b.buf = b.buf[:wOff] -} - -// Next is an alternative to `Read` that returns a byte slice instead of taking -// one. -// -// The returned byte slice is valid until the next read, write, grow, or -// truncate. -func (b *Buffer) Next(n int) []byte { - m := b.Len() - if m < n { - n = m - } - data := b.buf[b.rOff : b.rOff+n] - b.rOff += n - return data -} - -// Write writes the byte slice to the buffer. -func (b *Buffer) Write(buf []byte) (int, error) { - wOff := b.grow(len(buf)) - return copy(b.buf[wOff:], buf), nil -} - -// WriteTo copies from the buffer into the given writer until the buffer is -// empty. -func (b *Buffer) WriteTo(w io.Writer) (int64, error) { - if b.rOff < len(b.buf) { - n, err := w.Write(b.buf[b.rOff:]) - b.rOff += n - if b.rOff > len(b.buf) { - panic("invalid write count") - } - b.shrink() - return int64(n), err - } - return 0, nil -} - -// MinRead is the minimum slice size passed to a Read call by -// Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond -// what is required to hold the contents of r, ReadFrom will not grow the -// underlying buffer. -const MinRead = 512 - -// ReadFrom reads from the given reader into the buffer. -func (b *Buffer) ReadFrom(r io.Reader) (int64, error) { - n := int64(0) - for { - wOff := b.grow(MinRead) - // Use *entire* buffer. - b.buf = b.buf[:cap(b.buf)] - - read, err := r.Read(b.buf[wOff:]) - b.buf = b.buf[:wOff+read] - n += int64(read) - switch err { - case nil: - case io.EOF: - err = nil - fallthrough - default: - b.shrink() - return n, err - } - } -} - -// Read reads at most `len(buf)` bytes from the internal buffer into the given -// buffer. -func (b *Buffer) Read(buf []byte) (int, error) { - if len(buf) == 0 { - return 0, nil - } - if b.rOff >= len(b.buf) { - return 0, io.EOF - } - n := copy(buf, b.buf[b.rOff:]) - b.rOff += n - b.shrink() - return n, nil -} - -func (b *Buffer) shrink() { - c := b.Cap() - // Either nil or bootstrap. - if c <= len(b.bootstrap) { - return - } - - l := b.Len() - if l == 0 { - // Shortcut if empty. - b.returnBuf() - b.rOff = 0 - } else if l*8 < c { - // Only shrink when capacity > 8x length. Avoids shrinking too aggressively. - newBuf := b.getBuf(l) - copy(newBuf, b.buf[b.rOff:]) - b.returnBuf() - b.rOff = 0 - b.buf = newBuf[:l] - } -} diff --git a/vendor/github.com/libp2p/go-buffer-pool/codecov.yml b/vendor/github.com/libp2p/go-buffer-pool/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-buffer-pool/go.mod b/vendor/github.com/libp2p/go-buffer-pool/go.mod deleted file mode 100644 index 02b140dd..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/libp2p/go-buffer-pool - -go 1.12 diff --git a/vendor/github.com/libp2p/go-buffer-pool/pool.go b/vendor/github.com/libp2p/go-buffer-pool/pool.go deleted file mode 100644 index d812840a..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/pool.go +++ /dev/null @@ -1,115 +0,0 @@ -// Package pool provides a sync.Pool equivalent that buckets incoming -// requests to one of 32 sub-pools, one for each power of 2, 0-32. -// -// import (pool "github.com/libp2p/go-buffer-pool") -// var p pool.BufferPool -// -// small := make([]byte, 1024) -// large := make([]byte, 4194304) -// p.Put(small) -// p.Put(large) -// -// small2 := p.Get(1024) -// large2 := p.Get(4194304) -// fmt.Println("small2 len:", len(small2)) -// fmt.Println("large2 len:", len(large2)) -// -// // Output: -// // small2 len: 1024 -// // large2 len: 4194304 -// -package pool - -import ( - "math" - "math/bits" - "sync" -) - -// GlobalPool is a static Pool for reusing byteslices of various sizes. -var GlobalPool = new(BufferPool) - -// MaxLength is the maximum length of an element that can be added to the Pool. -const MaxLength = math.MaxInt32 - -// BufferPool is a pool to handle cases of reusing elements of varying sizes. It -// maintains 32 internal pools, for each power of 2 in 0-32. -// -// You should generally just call the package level Get and Put methods or use -// the GlobalPool BufferPool instead of constructing your own. -// -// You MUST NOT copy Pool after using. -type BufferPool struct { - pools [32]sync.Pool // a list of singlePools - ptrs sync.Pool -} - -type bufp struct { - buf []byte -} - -// Get retrieves a buffer of the appropriate length from the buffer pool or -// allocates a new one. Get may choose to ignore the pool and treat it as empty. -// Callers should not assume any relation between values passed to Put and the -// values returned by Get. -// -// If no suitable buffer exists in the pool, Get creates one. -func (p *BufferPool) Get(length int) []byte { - if length == 0 { - return nil - } - if length > MaxLength { - return make([]byte, length) - } - idx := nextLogBase2(uint32(length)) - if ptr := p.pools[idx].Get(); ptr != nil { - bp := ptr.(*bufp) - buf := bp.buf[:uint32(length)] - bp.buf = nil - p.ptrs.Put(ptr) - return buf - } - return make([]byte, 1< MaxLength { - return // drop it - } - idx := prevLogBase2(uint32(capacity)) - var bp *bufp - if ptr := p.ptrs.Get(); ptr != nil { - bp = ptr.(*bufp) - } else { - bp = new(bufp) - } - bp.buf = buf - p.pools[idx].Put(bp) -} - -// Get retrieves a buffer of the appropriate length from the global buffer pool -// (or allocates a new one). -func Get(length int) []byte { - return GlobalPool.Get(length) -} - -// Put returns a buffer to the global buffer pool. -func Put(slice []byte) { - GlobalPool.Put(slice) -} - -// Log of base two, round up (for v > 0). -func nextLogBase2(v uint32) uint32 { - return uint32(bits.Len32(v - 1)) -} - -// Log of base two, round down (for v > 0) -func prevLogBase2(num uint32) uint32 { - next := nextLogBase2(num) - if num == (1 << uint32(next)) { - return next - } - return next - 1 -} diff --git a/vendor/github.com/libp2p/go-buffer-pool/writer.go b/vendor/github.com/libp2p/go-buffer-pool/writer.go deleted file mode 100644 index cea83f92..00000000 --- a/vendor/github.com/libp2p/go-buffer-pool/writer.go +++ /dev/null @@ -1,119 +0,0 @@ -package pool - -import ( - "bufio" - "io" - "sync" -) - -const WriterBufferSize = 4096 - -var bufioWriterPool = sync.Pool{ - New: func() interface{} { - return bufio.NewWriterSize(nil, WriterBufferSize) - }, -} - -// Writer is a buffered writer that returns its internal buffer in a pool when -// not in use. -type Writer struct { - W io.Writer - bufw *bufio.Writer -} - -func (w *Writer) ensureBuffer() { - if w.bufw == nil { - w.bufw = bufioWriterPool.Get().(*bufio.Writer) - w.bufw.Reset(w.W) - } -} - -// Write writes the given byte slice to the underlying connection. -// -// Note: Write won't return the write buffer to the pool even if it ends up -// being empty after the write. You must call Flush() to do that. -func (w *Writer) Write(b []byte) (int, error) { - if w.bufw == nil { - if len(b) >= WriterBufferSize { - return w.W.Write(b) - } - w.bufw = bufioWriterPool.Get().(*bufio.Writer) - w.bufw.Reset(w.W) - } - return w.bufw.Write(b) -} - -// Size returns the size of the underlying buffer. -func (w *Writer) Size() int { - return WriterBufferSize -} - -// Available returns the amount buffer space available. -func (w *Writer) Available() int { - if w.bufw != nil { - return w.bufw.Available() - } - return WriterBufferSize -} - -// Buffered returns the amount of data buffered. -func (w *Writer) Buffered() int { - if w.bufw != nil { - return w.bufw.Buffered() - } - return 0 -} - -// WriteByte writes a single byte. -func (w *Writer) WriteByte(b byte) error { - w.ensureBuffer() - return w.bufw.WriteByte(b) -} - -// WriteRune writes a single rune, returning the number of bytes written. -func (w *Writer) WriteRune(r rune) (int, error) { - w.ensureBuffer() - return w.bufw.WriteRune(r) -} - -// WriteString writes a string, returning the number of bytes written. -func (w *Writer) WriteString(s string) (int, error) { - w.ensureBuffer() - return w.bufw.WriteString(s) -} - -// Flush flushes the write buffer, if any, and returns it to the pool. -func (w *Writer) Flush() error { - if w.bufw == nil { - return nil - } - if err := w.bufw.Flush(); err != nil { - return err - } - w.bufw.Reset(nil) - bufioWriterPool.Put(w.bufw) - w.bufw = nil - return nil -} - -// Close flushes the underlying writer and closes it if it implements the -// io.Closer interface. -// -// Note: Close() closes the writer even if Flush() fails to avoid leaking system -// resources. If you want to make sure Flush() succeeds, call it first. -func (w *Writer) Close() error { - var ( - ferr, cerr error - ) - ferr = w.Flush() - - // always close even if flush fails. - if closer, ok := w.W.(io.Closer); ok { - cerr = closer.Close() - } - - if ferr != nil { - return ferr - } - return cerr -} diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/.travis.yml b/vendor/github.com/libp2p/go-conn-security-multistream/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/LICENSE b/vendor/github.com/libp2p/go-conn-security-multistream/LICENSE deleted file mode 100644 index 6cccfc2b..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/README.md b/vendor/github.com/libp2p/go-conn-security-multistream/README.md deleted file mode 100644 index fdffd716..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# go-conn-security-multistream - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) -[![GoDoc](https://godoc.org/github.com/libp2p/go-conn-security-multistream?status.svg)](https://godoc.org/github.com/libp2p/go-conn-security-multistream) - -> Connection security multistream multiplexer - -This package provides a multistream multiplexed [security transport](https://github.com/libp2p/go-conn-security). It: - -1. Selects a security security transport using multistream-select. -2. Secures the stream using the selected transport. - -Known libp2p security transports include: - -* [go-libp2p-secio](https://github.com/libp2p/go-libp2p-secio) - -## Install - -`go-conn-security-multistream` is a standard Go module which can be installed with: - -```sh -go get github.com/libp2p/go-conn-security-multistream -``` - -This repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of -go 1.11 and later with modules enabled will automatically pull the latest tagged release -by referencing this package. Upgrades to future releases can be managed using `go get`, -or by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies). - -## Usage - -For more information about how `go-conn-security-multistream` is used in the libp2p context, you can see the [go-libp2p-conn](https://github.com/libp2p/go-libp2p-conn) module. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-conn-security-multistream/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 0.1.26: QmZWmFkMm28sWeDr5Xh1LexdKBGYGp946MNCfgtLqfX73z diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/go.mod b/vendor/github.com/libp2p/go-conn-security-multistream/go.mod deleted file mode 100644 index 2556ff56..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/libp2p/go-conn-security-multistream - -go 1.12 - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-testing v0.0.2 - github.com/multiformats/go-multistream v0.1.0 -) diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/go.sum b/vendor/github.com/libp2p/go-conn-security-multistream/go.sum deleted file mode 100644 index ac3782da..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/go.sum +++ /dev/null @@ -1,89 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-conn-security v0.1.0 h1:q8ii9TUOtSBD1gIoKTSOZIzPFP/agPM28amrCCoeIIA= -github.com/libp2p/go-conn-security v0.1.0/go.mod h1:NQdPF4opCZ5twtEUadzPL0tNSdkrbFc/HmLO7eWqEzY= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multistream v0.0.1 h1:JV4VfSdY9n7ECTtY59/TlSyFCzRILvYx4T4Ws8ZgihU= -github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-conn-security-multistream/ssms.go b/vendor/github.com/libp2p/go-conn-security-multistream/ssms.go deleted file mode 100644 index 219ee6fc..00000000 --- a/vendor/github.com/libp2p/go-conn-security-multistream/ssms.go +++ /dev/null @@ -1,88 +0,0 @@ -package csms - -import ( - "context" - "fmt" - "net" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" - mss "github.com/multiformats/go-multistream" -) - -// SSMuxer is a multistream stream security transport multiplexer. -// -// SSMuxer is safe to use without initialization. However, it's not safe to move -// after use. -type SSMuxer struct { - mux mss.MultistreamMuxer - tpts map[string]sec.SecureTransport - OrderPreference []string -} - -var _ sec.SecureTransport = (*SSMuxer)(nil) - -// AddTransport adds a stream security transport to this multistream muxer. -// -// This method is *not* thread-safe. It should be called only when initializing -// the SSMuxer. -func (sm *SSMuxer) AddTransport(path string, transport sec.SecureTransport) { - if sm.tpts == nil { - sm.tpts = make(map[string]sec.SecureTransport, 1) - } - - sm.mux.AddHandler(path, nil) - sm.tpts[path] = transport - sm.OrderPreference = append(sm.OrderPreference, path) -} - -// SecureInbound secures an inbound connection using this multistream -// multiplexed stream security transport. -func (sm *SSMuxer) SecureInbound(ctx context.Context, insecure net.Conn) (sec.SecureConn, error) { - tpt, err := sm.selectProto(ctx, insecure, true) - if err != nil { - return nil, err - } - return tpt.SecureInbound(ctx, insecure) -} - -// SecureOutbound secures an outbound connection using this multistream -// multiplexed stream security transport. -func (sm *SSMuxer) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error) { - tpt, err := sm.selectProto(ctx, insecure, false) - if err != nil { - return nil, err - } - return tpt.SecureOutbound(ctx, insecure, p) -} - -func (sm *SSMuxer) selectProto(ctx context.Context, insecure net.Conn, server bool) (sec.SecureTransport, error) { - var proto string - var err error - done := make(chan struct{}) - go func() { - defer close(done) - if server { - proto, _, err = sm.mux.Negotiate(insecure) - } else { - proto, err = mss.SelectOneOf(sm.OrderPreference, insecure) - } - }() - - select { - case <-done: - if err != nil { - return nil, err - } - if tpt, ok := sm.tpts[proto]; ok { - return tpt, nil - } - return nil, fmt.Errorf("selected unknown security transport") - case <-ctx.Done(): - // We *must* do this. We have outstanding work on the connection - // and it's no longer safe to use. - insecure.Close() - <-done // wait to stop using the connection. - return nil, ctx.Err() - } -} diff --git a/vendor/github.com/libp2p/go-flow-metrics/.travis.yml b/vendor/github.com/libp2p/go-flow-metrics/.travis.yml deleted file mode 100644 index dde69d1a..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - /Users/raul/go/src/gx - - /Users/raul/go/pkg/mod - - /Users/raul/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-flow-metrics/LICENSE b/vendor/github.com/libp2p/go-flow-metrics/LICENSE deleted file mode 100644 index fa878af7..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-flow-metrics/Makefile b/vendor/github.com/libp2p/go-flow-metrics/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/libp2p/go-flow-metrics/README.md b/vendor/github.com/libp2p/go-flow-metrics/README.md deleted file mode 100644 index 11470a68..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/README.md +++ /dev/null @@ -1,33 +0,0 @@ -go-flow-metrics -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![Travis CI](https://travis-ci.org/libp2p/go-flow-metrics.svg?branch=master)](https://travis-ci.org/libp2p/go-flow-metrics) - -> A simple library for tracking flow metrics. - -A simple alternative to [rcrowley's -go-metrics](https://github.com/rcrowley/go-metrics) that's a lot faster (and -only does simple bandwidth metrics). - -## Table of Contents - -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Protocol Labs diff --git a/vendor/github.com/libp2p/go-flow-metrics/go.mod b/vendor/github.com/libp2p/go-flow-metrics/go.mod deleted file mode 100644 index 908c4c39..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/libp2p/go-flow-metrics diff --git a/vendor/github.com/libp2p/go-flow-metrics/meter.go b/vendor/github.com/libp2p/go-flow-metrics/meter.go deleted file mode 100644 index 412dd3de..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/meter.go +++ /dev/null @@ -1,44 +0,0 @@ -package flow - -import ( - "fmt" - "sync/atomic" -) - -// Snapshot is a rate/total snapshot. -type Snapshot struct { - Rate float64 - Total uint64 -} - -func (s Snapshot) String() string { - return fmt.Sprintf("%d (%f/s)", s.Total, s.Rate) -} - -// Meter is a meter for monitoring a flow. -type Meter struct { - accumulator uint64 - - // Take lock. - snapshot Snapshot -} - -// Mark updates the total. -func (m *Meter) Mark(count uint64) { - if count > 0 && atomic.AddUint64(&m.accumulator, count) == count { - // I'm the first one to bump this above 0. - // Register it. - globalSweeper.Register(m) - } -} - -// Snapshot gets a consistent snapshot of the total and rate. -func (m *Meter) Snapshot() Snapshot { - globalSweeper.mutex.RLock() - defer globalSweeper.mutex.RUnlock() - return m.snapshot -} - -func (m *Meter) String() string { - return m.Snapshot().String() -} diff --git a/vendor/github.com/libp2p/go-flow-metrics/package.json b/vendor/github.com/libp2p/go-flow-metrics/package.json deleted file mode 100644 index df05d207..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "Stebalien", - "bugs": { - "url": "github.com/libp2p/go-flow-metrics" - }, - "gx": { - "dvcsimport": "github.com/libp2p/go-flow-metrics" - }, - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-flow-metrics", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.2.0" -} - diff --git a/vendor/github.com/libp2p/go-flow-metrics/registry.go b/vendor/github.com/libp2p/go-flow-metrics/registry.go deleted file mode 100644 index 226a4827..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/registry.go +++ /dev/null @@ -1,35 +0,0 @@ -package flow - -import ( - "sync" -) - -// MeterRegistry is a registry for named meters. -type MeterRegistry struct { - meters sync.Map -} - -// Get gets (or creates) a meter by name. -func (r *MeterRegistry) Get(name string) *Meter { - if m, ok := r.meters.Load(name); ok { - return m.(*Meter) - } - m, _ := r.meters.LoadOrStore(name, new(Meter)) - return m.(*Meter) -} - -// Remove removes the named meter from the registry. -// -// Note: The only reason to do this is to save a bit of memory. Unused meters -// don't consume any CPU (after they go idle). -func (r *MeterRegistry) Remove(name string) { - r.meters.Delete(name) -} - -// ForEach calls the passed function for each registered meter. -func (r *MeterRegistry) ForEach(iterFunc func(string, *Meter)) { - r.meters.Range(func(k, v interface{}) bool { - iterFunc(k.(string), v.(*Meter)) - return true - }) -} diff --git a/vendor/github.com/libp2p/go-flow-metrics/sweeper.go b/vendor/github.com/libp2p/go-flow-metrics/sweeper.go deleted file mode 100644 index 21ecf31c..00000000 --- a/vendor/github.com/libp2p/go-flow-metrics/sweeper.go +++ /dev/null @@ -1,153 +0,0 @@ -package flow - -import ( - "math" - "sync" - "sync/atomic" - "time" -) - -// IdleRate the rate at which we declare a meter idle (and stop tracking it -// until it's re-registered). -// -// The default ensures that 1 event every ~30s will keep the meter from going -// idle. -var IdleRate = 1e-13 - -// Alpha for EWMA of 1s -var alpha = 1 - math.Exp(-1.0) - -// The global sweeper. -var globalSweeper sweeper - -type sweeper struct { - sweepOnce sync.Once - meters []*Meter - mutex sync.RWMutex - lastUpdateTime time.Time - registerChannel chan *Meter -} - -func (sw *sweeper) start() { - sw.registerChannel = make(chan *Meter, 16) - go sw.run() -} - -func (sw *sweeper) run() { - for m := range sw.registerChannel { - sw.register(m) - sw.runActive() - } -} - -func (sw *sweeper) register(m *Meter) { - // Add back the snapshot total. If we unregistered this - // one, we set it to zero. - atomic.AddUint64(&m.accumulator, m.snapshot.Total) - sw.meters = append(sw.meters, m) -} - -func (sw *sweeper) runActive() { - ticker := time.NewTicker(time.Second) - defer ticker.Stop() - - sw.lastUpdateTime = time.Now() - for len(sw.meters) > 0 { - // Scale back allocation. - if len(sw.meters)*2 < cap(sw.meters) { - newMeters := make([]*Meter, len(sw.meters)) - copy(newMeters, sw.meters) - sw.meters = newMeters - } - - select { - case <-ticker.C: - sw.update() - case m := <-sw.registerChannel: - sw.register(m) - } - } - sw.meters = nil - // Till next time. -} - -func (sw *sweeper) update() { - sw.mutex.Lock() - defer sw.mutex.Unlock() - - now := time.Now() - tdiff := now.Sub(sw.lastUpdateTime) - if tdiff <= 0 { - return - } - sw.lastUpdateTime = now - timeMultiplier := float64(time.Second) / float64(tdiff) - - newLen := len(sw.meters) - - for i, m := range sw.meters { - total := atomic.LoadUint64(&m.accumulator) - instant := timeMultiplier * float64(total-m.snapshot.Total) - - if m.snapshot.Rate == 0 { - m.snapshot.Rate = instant - } else { - m.snapshot.Rate += alpha * (instant - m.snapshot.Rate) - } - m.snapshot.Total = total - - // This is equivalent to one zeros, then one, then 30 zeros. - // We'll consider that to be "idle". - if m.snapshot.Rate > IdleRate { - continue - } - - // Ok, so we are idle... - - // Mark this as idle by zeroing the accumulator. - swappedTotal := atomic.SwapUint64(&m.accumulator, 0) - - // So..., are we really idle? - if swappedTotal > total { - // Not so idle... - // Now we need to make sure this gets re-registered. - - // First, add back what we removed. If we can do this - // fast enough, we can put it back before anyone - // notices. - currentTotal := atomic.AddUint64(&m.accumulator, swappedTotal) - - // Did we make it? - if currentTotal == swappedTotal { - // Yes! Nobody noticed, move along. - continue - } - // No. Someone noticed and will (or has) put back into - // the registration channel. - // - // Remove the snapshot total, it'll get added back on - // registration. - // - // `^uint64(total - 1)` is the two's complement of - // `total`. It's the "correct" way to subtract - // atomically in go. - atomic.AddUint64(&m.accumulator, ^uint64(m.snapshot.Total-1)) - } - - // Reset the rate, keep the total. - m.snapshot.Rate = 0 - newLen-- - sw.meters[i] = sw.meters[newLen] - } - - // trim the meter list - for i := newLen; i < len(sw.meters); i++ { - sw.meters[i] = nil - } - sw.meters = sw.meters[:newLen] -} - -func (sw *sweeper) Register(m *Meter) { - sw.sweepOnce.Do(sw.start) - sw.registerChannel <- m -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/.gitignore b/vendor/github.com/libp2p/go-libp2p-autonat-svc/.gitignore deleted file mode 100644 index f1c181ec..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/.travis.yml b/vendor/github.com/libp2p/go-libp2p-autonat-svc/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/LICENSE b/vendor/github.com/libp2p/go-libp2p-autonat-svc/LICENSE deleted file mode 100644 index 3f05397b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 libp2p - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/README.md b/vendor/github.com/libp2p/go-libp2p-autonat-svc/README.md deleted file mode 100644 index 181415db..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# go-libp2p-autonat-svc - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) - [![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - - -> AutoNAT service implementation - -This package provides an implementation of the AutoNATService; see [autonat](https://github.com/libp2p/go-libp2p-autonat). - -## Documentation - -See https://godoc.org/github.com/libp2p/go-libp2p-autonat-svc. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-discovery/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -## License - -MIT - ---- - -The last gx published version of this module was: 1.0.15: QmS4vFMsoH5BwxfWdMBeMt6sBdcBAB5mik1ATADySymLZW diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.mod b/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.mod deleted file mode 100644 index 9c726a4a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/libp2p/go-libp2p-autonat-svc - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p v0.1.0 - github.com/libp2p/go-libp2p-autonat v0.1.0 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 -) diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.sum b/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.sum deleted file mode 100644 index 2116a4ed..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/go.sum +++ /dev/null @@ -1,252 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.0 h1:8VXadcPNni74ODoZ+7326LMAppFYmz1fRQOUuT5iZvQ= -github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM= -github.com/libp2p/go-libp2p-autonat v0.1.0 h1:aCWAu43Ri4nU0ZPO7NyLzUvvfqd0nE3dX0R/ZGYVgOU= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0 h1:eniLL3Y9aq/sryfyV1IAHj5rlvuyj3b7iz8tSiZpdhY= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0 h1:j+R6cokKcGbnZLf4kcNwpx6mDEUPF3N6SrqMymQhmvs= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3 h1:YiMaevQcZtFU6DmKIF8xEO0vaui5kM5HJ1V1xkWQv14= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-ws-transport v0.1.0 h1:F+0OvvdmPTDsVc4AjPHjV7L7Pk1B7D5QwtDcKE2oag4= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/proto.go b/vendor/github.com/libp2p/go-libp2p-autonat-svc/proto.go deleted file mode 100644 index c0bd44a8..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/proto.go +++ /dev/null @@ -1,24 +0,0 @@ -package autonat - -import ( - pb "github.com/libp2p/go-libp2p-autonat/pb" - - logging "github.com/ipfs/go-log" - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("autonat-svc") - -func newDialResponseOK(addr ma.Multiaddr) *pb.Message_DialResponse { - dr := new(pb.Message_DialResponse) - dr.Status = pb.Message_OK.Enum() - dr.Addr = addr.Bytes() - return dr -} - -func newDialResponseError(status pb.Message_ResponseStatus, text string) *pb.Message_DialResponse { - dr := new(pb.Message_DialResponse) - dr.Status = status.Enum() - dr.StatusText = &text - return dr -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat-svc/svc.go b/vendor/github.com/libp2p/go-libp2p-autonat-svc/svc.go deleted file mode 100644 index a685f3d3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat-svc/svc.go +++ /dev/null @@ -1,217 +0,0 @@ -package autonat - -import ( - "context" - "sync" - "time" - - "github.com/libp2p/go-libp2p" - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - pb "github.com/libp2p/go-libp2p-autonat/pb" - - ggio "github.com/gogo/protobuf/io" - autonat "github.com/libp2p/go-libp2p-autonat" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -const P_CIRCUIT = 290 - -var ( - AutoNATServiceDialTimeout = 15 * time.Second - AutoNATServiceResetInterval = 1 * time.Minute - - AutoNATServiceThrottle = 3 -) - -// AutoNATService provides NAT autodetection services to other peers -type AutoNATService struct { - ctx context.Context - dialer host.Host - - // rate limiter - mx sync.Mutex - reqs map[peer.ID]int -} - -// NewAutoNATService creates a new AutoNATService instance attached to a host -func NewAutoNATService(ctx context.Context, h host.Host, opts ...libp2p.Option) (*AutoNATService, error) { - opts = append(opts, libp2p.NoListenAddrs) - dialer, err := libp2p.New(ctx, opts...) - if err != nil { - return nil, err - } - - as := &AutoNATService{ - ctx: ctx, - dialer: dialer, - reqs: make(map[peer.ID]int), - } - h.SetStreamHandler(autonat.AutoNATProto, as.handleStream) - - go as.resetRateLimiter() - - return as, nil -} - -func (as *AutoNATService) handleStream(s network.Stream) { - defer helpers.FullClose(s) - - pid := s.Conn().RemotePeer() - log.Debugf("New stream from %s", pid.Pretty()) - - r := ggio.NewDelimitedReader(s, network.MessageSizeMax) - w := ggio.NewDelimitedWriter(s) - - var req pb.Message - var res pb.Message - - err := r.ReadMsg(&req) - if err != nil { - log.Debugf("Error reading message from %s: %s", pid.Pretty(), err.Error()) - s.Reset() - return - } - - t := req.GetType() - if t != pb.Message_DIAL { - log.Debugf("Unexpected message from %s: %s (%d)", pid.Pretty(), t.String(), t) - s.Reset() - return - } - - dr := as.handleDial(pid, s.Conn().RemoteMultiaddr(), req.GetDial().GetPeer()) - res.Type = pb.Message_DIAL_RESPONSE.Enum() - res.DialResponse = dr - - err = w.WriteMsg(&res) - if err != nil { - log.Debugf("Error writing response to %s: %s", pid.Pretty(), err.Error()) - s.Reset() - return - } -} - -func (as *AutoNATService) handleDial(p peer.ID, obsaddr ma.Multiaddr, mpi *pb.Message_PeerInfo) *pb.Message_DialResponse { - if mpi == nil { - return newDialResponseError(pb.Message_E_BAD_REQUEST, "missing peer info") - } - - mpid := mpi.GetId() - if mpid != nil { - mp, err := peer.IDFromBytes(mpid) - if err != nil { - return newDialResponseError(pb.Message_E_BAD_REQUEST, "bad peer id") - } - - if mp != p { - return newDialResponseError(pb.Message_E_BAD_REQUEST, "peer id mismatch") - } - } - - addrs := make([]ma.Multiaddr, 0) - seen := make(map[string]struct{}) - - // add observed addr to the list of addresses to dial - if !as.skipDial(obsaddr) { - addrs = append(addrs, obsaddr) - seen[obsaddr.String()] = struct{}{} - } - - for _, maddr := range mpi.GetAddrs() { - addr, err := ma.NewMultiaddrBytes(maddr) - if err != nil { - log.Debugf("Error parsing multiaddr: %s", err.Error()) - continue - } - - if as.skipDial(addr) { - continue - } - - str := addr.String() - _, ok := seen[str] - if ok { - continue - } - - addrs = append(addrs, addr) - seen[str] = struct{}{} - } - - if len(addrs) == 0 { - return newDialResponseError(pb.Message_E_DIAL_ERROR, "no dialable addresses") - } - - return as.doDial(peer.AddrInfo{ID: p, Addrs: addrs}) -} - -func (as *AutoNATService) skipDial(addr ma.Multiaddr) bool { - // skip relay addresses - _, err := addr.ValueForProtocol(P_CIRCUIT) - if err == nil { - return true - } - - // skip private network (unroutable) addresses - if !manet.IsPublicAddr(addr) { - return true - } - - return false -} - -func (as *AutoNATService) doDial(pi peer.AddrInfo) *pb.Message_DialResponse { - // rate limit check - as.mx.Lock() - count := as.reqs[pi.ID] - if count >= AutoNATServiceThrottle { - as.mx.Unlock() - return newDialResponseError(pb.Message_E_DIAL_REFUSED, "too many dials") - } - as.reqs[pi.ID] = count + 1 - as.mx.Unlock() - - ctx, cancel := context.WithTimeout(as.ctx, AutoNATServiceDialTimeout) - defer cancel() - - err := as.dialer.Connect(ctx, pi) - if err != nil { - log.Debugf("error dialing %s: %s", pi.ID.Pretty(), err.Error()) - // wait for the context to timeout to avoid leaking timing information - // this renders the service ineffective as a port scanner - <-ctx.Done() - return newDialResponseError(pb.Message_E_DIAL_ERROR, "dial failed") - } - - conns := as.dialer.Network().ConnsToPeer(pi.ID) - if len(conns) == 0 { - log.Errorf("supposedly connected to %s, but no connection to peer", pi.ID.Pretty()) - return newDialResponseError(pb.Message_E_INTERNAL_ERROR, "internal service error") - } - - ra := conns[0].RemoteMultiaddr() - as.dialer.Network().ClosePeer(pi.ID) - return newDialResponseOK(ra) -} - -func (as *AutoNATService) resetRateLimiter() { - ticker := time.NewTicker(AutoNATServiceResetInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - as.mx.Lock() - as.reqs = make(map[peer.ID]int) - as.mx.Unlock() - - case <-as.ctx.Done(): - return - } - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/.gitignore b/vendor/github.com/libp2p/go-libp2p-autonat/.gitignore deleted file mode 100644 index a1338d68..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 -.glide/ diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/.travis.yml b/vendor/github.com/libp2p/go-libp2p-autonat/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/LICENSE b/vendor/github.com/libp2p/go-libp2p-autonat/LICENSE deleted file mode 100644 index 3f05397b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 libp2p - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/README.md b/vendor/github.com/libp2p/go-libp2p-autonat/README.md deleted file mode 100644 index 97420373..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# go-libp2p-autonat - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) - [![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - - - -> Ambient NAT discovery - -This package provides an ambient NAT autodiscovery service. -It allows peers to figure out their NAT dialability situation by using test dial backs through peers providing the AutoNAT service. - -## Documentation - -See https://godoc.org/github.com/libp2p/go-libp2p-autonat - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-discovery/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -## License - -MIT - ---- - -The last gx published version of this module was: 1.0.14: QmNnJhrc4ZtcPZg3oXDVdJ7HRtxDfLE2ccH56cZZjZ6y3p diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/autonat.go b/vendor/github.com/libp2p/go-libp2p-autonat/autonat.go deleted file mode 100644 index 7e839ddd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/autonat.go +++ /dev/null @@ -1,253 +0,0 @@ -package autonat - -import ( - "context" - "errors" - "math/rand" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - ma "github.com/multiformats/go-multiaddr" -) - -// NATStatus is the state of NAT as detected by the ambient service. -type NATStatus int - -const ( - // NAT status is unknown; this means that the ambient service has not been - // able to decide the presence of NAT in the most recent attempt to test - // dial through known autonat peers. initial state. - NATStatusUnknown NATStatus = iota - // NAT status is publicly dialable - NATStatusPublic - // NAT status is private network - NATStatusPrivate -) - -var ( - AutoNATBootDelay = 15 * time.Second - AutoNATRetryInterval = 90 * time.Second - AutoNATRefreshInterval = 15 * time.Minute - AutoNATRequestTimeout = 30 * time.Second -) - -// AutoNAT is the interface for ambient NAT autodiscovery -type AutoNAT interface { - // Status returns the current NAT status - Status() NATStatus - // PublicAddr returns the public dial address when NAT status is public and an - // error otherwise - PublicAddr() (ma.Multiaddr, error) -} - -// AmbientAutoNAT is the implementation of ambient NAT autodiscovery -type AmbientAutoNAT struct { - ctx context.Context - host host.Host - - getAddrs GetAddrs - - mx sync.Mutex - peers map[peer.ID][]ma.Multiaddr - status NATStatus - addr ma.Multiaddr - // Reflects the confidence on of the NATStatus being private, as a single - // dialback may fail for reasons unrelated to NAT. - // If it is <3, then multiple autoNAT peers may be contacted for dialback - // If only a single autoNAT peer is known, then the confidence increases - // for each failure until it reaches 3. - confidence int -} - -// NewAutoNAT creates a new ambient NAT autodiscovery instance attached to a host -// If getAddrs is nil, h.Addrs will be used -func NewAutoNAT(ctx context.Context, h host.Host, getAddrs GetAddrs) AutoNAT { - if getAddrs == nil { - getAddrs = h.Addrs - } - - as := &AmbientAutoNAT{ - ctx: ctx, - host: h, - getAddrs: getAddrs, - peers: make(map[peer.ID][]ma.Multiaddr), - status: NATStatusUnknown, - } - - h.Network().Notify(as) - go as.background() - - return as -} - -func (as *AmbientAutoNAT) Status() NATStatus { - as.mx.Lock() - defer as.mx.Unlock() - return as.status -} - -func (as *AmbientAutoNAT) PublicAddr() (ma.Multiaddr, error) { - as.mx.Lock() - defer as.mx.Unlock() - - if as.status != NATStatusPublic { - return nil, errors.New("NAT Status is not public") - } - - return as.addr, nil -} - -func (as *AmbientAutoNAT) background() { - // wait a bit for the node to come online and establish some connections - // before starting autodetection - select { - case <-time.After(AutoNATBootDelay): - case <-as.ctx.Done(): - return - } - - for { - as.autodetect() - - delay := AutoNATRefreshInterval - if as.status == NATStatusUnknown { - delay = AutoNATRetryInterval - } - - select { - case <-time.After(delay): - case <-as.ctx.Done(): - return - } - } -} - -func (as *AmbientAutoNAT) autodetect() { - peers := as.getPeers() - - if len(peers) == 0 { - log.Debugf("skipping NAT auto detection; no autonat peers") - return - } - - cli := NewAutoNATClient(as.host, as.getAddrs) - ctx, cancel := context.WithTimeout(as.ctx, AutoNATRequestTimeout) - defer cancel() - - var result struct { - sync.Mutex - private int - public int - pubaddr ma.Multiaddr - } - - probe := 3 - as.confidence - if probe == 0 { - probe = 1 - } - if probe > len(peers) { - probe = len(peers) - } - - var wg sync.WaitGroup - - for _, pi := range peers[:probe] { - wg.Add(1) - go func(pi peer.AddrInfo) { - defer wg.Done() - - as.host.Peerstore().AddAddrs(pi.ID, pi.Addrs, peerstore.TempAddrTTL) - a, err := cli.DialBack(ctx, pi.ID) - - switch { - case err == nil: - log.Debugf("Dialback through %s successful; public address is %s", pi.ID.Pretty(), a.String()) - result.Lock() - result.public++ - result.pubaddr = a - result.Unlock() - - case IsDialError(err): - log.Debugf("Dialback through %s failed", pi.ID.Pretty()) - result.Lock() - result.private++ - result.Unlock() - - default: - log.Debugf("Dialback error through %s: %s", pi.ID.Pretty(), err) - } - }(pi) - } - - wg.Wait() - - as.mx.Lock() - if result.public > 0 { - log.Debugf("NAT status is public") - if as.status == NATStatusPrivate { - // we are flipping our NATStatus, so confidence drops to 0 - as.confidence = 0 - } else if as.confidence < 3 { - as.confidence++ - } - as.status = NATStatusPublic - as.addr = result.pubaddr - } else if result.private > 0 { - log.Debugf("NAT status is private") - if as.status == NATStatusPublic { - // we are flipping our NATStatus, so confidence drops to 0 - as.confidence = 0 - } else if as.confidence < 3 { - as.confidence++ - } - as.status = NATStatusPrivate - as.addr = nil - } else if as.confidence > 0 { - // don't just flip to unknown, reduce confidence first - as.confidence-- - } else { - log.Debugf("NAT status is unknown") - as.status = NATStatusUnknown - as.addr = nil - } - as.mx.Unlock() -} - -func (as *AmbientAutoNAT) getPeers() []peer.AddrInfo { - as.mx.Lock() - defer as.mx.Unlock() - - if len(as.peers) == 0 { - return nil - } - - var connected, others []peer.AddrInfo - - for p, addrs := range as.peers { - if as.host.Network().Connectedness(p) == network.Connected { - connected = append(connected, peer.AddrInfo{ID: p, Addrs: addrs}) - } else { - others = append(others, peer.AddrInfo{ID: p, Addrs: addrs}) - } - } - - shufflePeers(connected) - - if len(connected) < 3 { - shufflePeers(others) - return append(connected, others...) - } else { - return connected - } -} - -func shufflePeers(peers []peer.AddrInfo) { - for i := range peers { - j := rand.Intn(i + 1) - peers[i], peers[j] = peers[j], peers[i] - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/client.go b/vendor/github.com/libp2p/go-libp2p-autonat/client.go deleted file mode 100644 index 0d8549b4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/client.go +++ /dev/null @@ -1,110 +0,0 @@ -package autonat - -import ( - "context" - "fmt" - - pb "github.com/libp2p/go-libp2p-autonat/pb" - "github.com/libp2p/go-libp2p-core/helpers" - - ggio "github.com/gogo/protobuf/io" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" -) - -// AutoNATClient is a stateless client interface to AutoNAT peers -type AutoNATClient interface { - // DialBack requests from a peer providing AutoNAT services to test dial back - // and report the address on a successful connection. - DialBack(ctx context.Context, p peer.ID) (ma.Multiaddr, error) -} - -// AutoNATError is the class of errors signalled by AutoNAT services -type AutoNATError struct { - Status pb.Message_ResponseStatus - Text string -} - -// GetAddrs is a function that returns the addresses to dial back -type GetAddrs func() []ma.Multiaddr - -// NewAutoNATClient creates a fresh instance of an AutoNATClient -// If getAddrs is nil, h.Addrs will be used -func NewAutoNATClient(h host.Host, getAddrs GetAddrs) AutoNATClient { - if getAddrs == nil { - getAddrs = h.Addrs - } - return &client{h: h, getAddrs: getAddrs} -} - -type client struct { - h host.Host - getAddrs GetAddrs -} - -func (c *client) DialBack(ctx context.Context, p peer.ID) (ma.Multiaddr, error) { - s, err := c.h.NewStream(ctx, p, AutoNATProto) - if err != nil { - return nil, err - } - // Might as well just reset the stream. Once we get to this point, we - // don't care about being nice. - defer helpers.FullClose(s) - - r := ggio.NewDelimitedReader(s, network.MessageSizeMax) - w := ggio.NewDelimitedWriter(s) - - req := newDialMessage(peer.AddrInfo{ID: c.h.ID(), Addrs: c.getAddrs()}) - err = w.WriteMsg(req) - if err != nil { - s.Reset() - return nil, err - } - - var res pb.Message - err = r.ReadMsg(&res) - if err != nil { - s.Reset() - return nil, err - } - - if res.GetType() != pb.Message_DIAL_RESPONSE { - return nil, fmt.Errorf("Unexpected response: %s", res.GetType().String()) - } - - status := res.GetDialResponse().GetStatus() - switch status { - case pb.Message_OK: - addr := res.GetDialResponse().GetAddr() - return ma.NewMultiaddrBytes(addr) - - default: - return nil, AutoNATError{Status: status, Text: res.GetDialResponse().GetStatusText()} - } -} - -func (e AutoNATError) Error() string { - return fmt.Sprintf("AutoNAT error: %s (%s)", e.Text, e.Status.String()) -} - -func (e AutoNATError) IsDialError() bool { - return e.Status == pb.Message_E_DIAL_ERROR -} - -func (e AutoNATError) IsDialRefused() bool { - return e.Status == pb.Message_E_DIAL_REFUSED -} - -// IsDialError returns true if the AutoNAT peer signalled an error dialing back -func IsDialError(e error) bool { - ae, ok := e.(AutoNATError) - return ok && ae.IsDialError() -} - -// IsDialRefused returns true if the AutoNAT peer signalled refusal to dial back -func IsDialRefused(e error) bool { - ae, ok := e.(AutoNATError) - return ok && ae.IsDialRefused() -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/go.mod b/vendor/github.com/libp2p/go-libp2p-autonat/go.mod deleted file mode 100644 index 531d4b2e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/libp2p/go-libp2p-autonat - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/multiformats/go-multiaddr v0.0.4 -) diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/go.sum b/vendor/github.com/libp2p/go-libp2p-autonat/go.sum deleted file mode 100644 index e2d20f17..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/go.sum +++ /dev/null @@ -1,216 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/notify.go b/vendor/github.com/libp2p/go-libp2p-autonat/notify.go deleted file mode 100644 index 4ea65616..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/notify.go +++ /dev/null @@ -1,42 +0,0 @@ -package autonat - -import ( - "time" - - "github.com/libp2p/go-libp2p-core/network" - - ma "github.com/multiformats/go-multiaddr" -) - -var _ network.Notifiee = (*AmbientAutoNAT)(nil) - -var AutoNATIdentifyDelay = 5 * time.Second - -func (as *AmbientAutoNAT) Listen(net network.Network, a ma.Multiaddr) {} -func (as *AmbientAutoNAT) ListenClose(net network.Network, a ma.Multiaddr) {} -func (as *AmbientAutoNAT) OpenedStream(net network.Network, s network.Stream) {} -func (as *AmbientAutoNAT) ClosedStream(net network.Network, s network.Stream) {} - -func (as *AmbientAutoNAT) Connected(net network.Network, c network.Conn) { - p := c.RemotePeer() - - go func() { - // add some delay for identify - time.Sleep(AutoNATIdentifyDelay) - - protos, err := as.host.Peerstore().SupportsProtocols(p, AutoNATProto) - if err != nil { - log.Debugf("error retrieving supported protocols for peer %s: %s", p, err) - return - } - - if len(protos) > 0 { - log.Infof("Discovered AutoNAT peer %s", p.Pretty()) - as.mx.Lock() - as.peers[p] = as.host.Peerstore().Addrs(p) - as.mx.Unlock() - } - }() -} - -func (as *AmbientAutoNAT) Disconnected(net network.Network, c network.Conn) {} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-autonat/pb/Makefile deleted file mode 100644 index dd21e878..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/pb/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -pbgos := $(patsubst %.proto,%.pb.go,$(wildcard *.proto)) - -all: $(pbgos) - -%.pb.go: %.proto - protoc --gogofast_out=. --proto_path=$(GOPATH)/src:. $< diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.pb.go b/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.pb.go deleted file mode 100644 index 3617b461..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.pb.go +++ /dev/null @@ -1,1242 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: autonat.proto - -package autonat_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Message_MessageType int32 - -const ( - Message_DIAL Message_MessageType = 0 - Message_DIAL_RESPONSE Message_MessageType = 1 -) - -var Message_MessageType_name = map[int32]string{ - 0: "DIAL", - 1: "DIAL_RESPONSE", -} - -var Message_MessageType_value = map[string]int32{ - "DIAL": 0, - "DIAL_RESPONSE": 1, -} - -func (x Message_MessageType) Enum() *Message_MessageType { - p := new(Message_MessageType) - *p = x - return p -} - -func (x Message_MessageType) String() string { - return proto.EnumName(Message_MessageType_name, int32(x)) -} - -func (x *Message_MessageType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Message_MessageType_value, data, "Message_MessageType") - if err != nil { - return err - } - *x = Message_MessageType(value) - return nil -} - -func (Message_MessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 0} -} - -type Message_ResponseStatus int32 - -const ( - Message_OK Message_ResponseStatus = 0 - Message_E_DIAL_ERROR Message_ResponseStatus = 100 - Message_E_DIAL_REFUSED Message_ResponseStatus = 101 - Message_E_BAD_REQUEST Message_ResponseStatus = 200 - Message_E_INTERNAL_ERROR Message_ResponseStatus = 300 -) - -var Message_ResponseStatus_name = map[int32]string{ - 0: "OK", - 100: "E_DIAL_ERROR", - 101: "E_DIAL_REFUSED", - 200: "E_BAD_REQUEST", - 300: "E_INTERNAL_ERROR", -} - -var Message_ResponseStatus_value = map[string]int32{ - "OK": 0, - "E_DIAL_ERROR": 100, - "E_DIAL_REFUSED": 101, - "E_BAD_REQUEST": 200, - "E_INTERNAL_ERROR": 300, -} - -func (x Message_ResponseStatus) Enum() *Message_ResponseStatus { - p := new(Message_ResponseStatus) - *p = x - return p -} - -func (x Message_ResponseStatus) String() string { - return proto.EnumName(Message_ResponseStatus_name, int32(x)) -} - -func (x *Message_ResponseStatus) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Message_ResponseStatus_value, data, "Message_ResponseStatus") - if err != nil { - return err - } - *x = Message_ResponseStatus(value) - return nil -} - -func (Message_ResponseStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 1} -} - -type Message struct { - Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=autonat.pb.Message_MessageType" json:"type,omitempty"` - Dial *Message_Dial `protobuf:"bytes,2,opt,name=dial" json:"dial,omitempty"` - DialResponse *Message_DialResponse `protobuf:"bytes,3,opt,name=dialResponse" json:"dialResponse,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetType() Message_MessageType { - if m != nil && m.Type != nil { - return *m.Type - } - return Message_DIAL -} - -func (m *Message) GetDial() *Message_Dial { - if m != nil { - return m.Dial - } - return nil -} - -func (m *Message) GetDialResponse() *Message_DialResponse { - if m != nil { - return m.DialResponse - } - return nil -} - -type Message_PeerInfo struct { - Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message_PeerInfo) Reset() { *m = Message_PeerInfo{} } -func (m *Message_PeerInfo) String() string { return proto.CompactTextString(m) } -func (*Message_PeerInfo) ProtoMessage() {} -func (*Message_PeerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 0} -} -func (m *Message_PeerInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_PeerInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_PeerInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_PeerInfo.Merge(m, src) -} -func (m *Message_PeerInfo) XXX_Size() int { - return m.Size() -} -func (m *Message_PeerInfo) XXX_DiscardUnknown() { - xxx_messageInfo_Message_PeerInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_PeerInfo proto.InternalMessageInfo - -func (m *Message_PeerInfo) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *Message_PeerInfo) GetAddrs() [][]byte { - if m != nil { - return m.Addrs - } - return nil -} - -type Message_Dial struct { - Peer *Message_PeerInfo `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message_Dial) Reset() { *m = Message_Dial{} } -func (m *Message_Dial) String() string { return proto.CompactTextString(m) } -func (*Message_Dial) ProtoMessage() {} -func (*Message_Dial) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 1} -} -func (m *Message_Dial) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Dial) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Dial.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Dial) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Dial.Merge(m, src) -} -func (m *Message_Dial) XXX_Size() int { - return m.Size() -} -func (m *Message_Dial) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Dial.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_Dial proto.InternalMessageInfo - -func (m *Message_Dial) GetPeer() *Message_PeerInfo { - if m != nil { - return m.Peer - } - return nil -} - -type Message_DialResponse struct { - Status *Message_ResponseStatus `protobuf:"varint,1,opt,name=status,enum=autonat.pb.Message_ResponseStatus" json:"status,omitempty"` - StatusText *string `protobuf:"bytes,2,opt,name=statusText" json:"statusText,omitempty"` - Addr []byte `protobuf:"bytes,3,opt,name=addr" json:"addr,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message_DialResponse) Reset() { *m = Message_DialResponse{} } -func (m *Message_DialResponse) String() string { return proto.CompactTextString(m) } -func (*Message_DialResponse) ProtoMessage() {} -func (*Message_DialResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a04e278ef61ac07a, []int{0, 2} -} -func (m *Message_DialResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_DialResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_DialResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_DialResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_DialResponse.Merge(m, src) -} -func (m *Message_DialResponse) XXX_Size() int { - return m.Size() -} -func (m *Message_DialResponse) XXX_DiscardUnknown() { - xxx_messageInfo_Message_DialResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_DialResponse proto.InternalMessageInfo - -func (m *Message_DialResponse) GetStatus() Message_ResponseStatus { - if m != nil && m.Status != nil { - return *m.Status - } - return Message_OK -} - -func (m *Message_DialResponse) GetStatusText() string { - if m != nil && m.StatusText != nil { - return *m.StatusText - } - return "" -} - -func (m *Message_DialResponse) GetAddr() []byte { - if m != nil { - return m.Addr - } - return nil -} - -func init() { - proto.RegisterEnum("autonat.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value) - proto.RegisterEnum("autonat.pb.Message_ResponseStatus", Message_ResponseStatus_name, Message_ResponseStatus_value) - proto.RegisterType((*Message)(nil), "autonat.pb.Message") - proto.RegisterType((*Message_PeerInfo)(nil), "autonat.pb.Message.PeerInfo") - proto.RegisterType((*Message_Dial)(nil), "autonat.pb.Message.Dial") - proto.RegisterType((*Message_DialResponse)(nil), "autonat.pb.Message.DialResponse") -} - -func init() { proto.RegisterFile("autonat.proto", fileDescriptor_a04e278ef61ac07a) } - -var fileDescriptor_a04e278ef61ac07a = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcf, 0x8a, 0xda, 0x50, - 0x14, 0xc6, 0xbd, 0x31, 0xb5, 0xf6, 0x18, 0xc3, 0xed, 0xa1, 0x85, 0x20, 0x25, 0x0d, 0x59, 0x49, - 0x29, 0x22, 0x76, 0x53, 0xba, 0x53, 0x72, 0x0b, 0xd2, 0x56, 0xed, 0x49, 0x5c, 0x87, 0x94, 0xdc, - 0x0e, 0x01, 0x31, 0x21, 0x89, 0x30, 0x6e, 0xe6, 0x89, 0x66, 0x3b, 0xef, 0xe0, 0x72, 0x1e, 0x61, - 0xf0, 0x49, 0x86, 0x5c, 0xa3, 0xa3, 0xe0, 0xac, 0xce, 0x1f, 0x7e, 0xdf, 0x39, 0x1f, 0x1f, 0x74, - 0xa3, 0x4d, 0x99, 0xae, 0xa3, 0x72, 0x90, 0xe5, 0x69, 0x99, 0x22, 0x9c, 0xc6, 0x7f, 0xee, 0x83, - 0x0e, 0x6f, 0xff, 0xc8, 0xa2, 0x88, 0x6e, 0x24, 0x7e, 0x03, 0xbd, 0xdc, 0x66, 0xd2, 0x62, 0x0e, - 0xeb, 0x9b, 0xa3, 0xcf, 0x83, 0x17, 0x6c, 0x50, 0x23, 0xc7, 0x1a, 0x6c, 0x33, 0x49, 0x0a, 0xc6, - 0xaf, 0xa0, 0xc7, 0x49, 0xb4, 0xb2, 0x34, 0x87, 0xf5, 0x3b, 0x23, 0xeb, 0x9a, 0xc8, 0x4b, 0xa2, - 0x15, 0x29, 0x0a, 0x3d, 0x30, 0xaa, 0x4a, 0xb2, 0xc8, 0xd2, 0x75, 0x21, 0xad, 0xa6, 0x52, 0x39, - 0xaf, 0xaa, 0x6a, 0x8e, 0x2e, 0x54, 0xbd, 0x21, 0xb4, 0x17, 0x52, 0xe6, 0xd3, 0xf5, 0xff, 0x14, - 0x4d, 0xd0, 0x92, 0x58, 0x59, 0x36, 0x48, 0x4b, 0x62, 0xfc, 0x00, 0x6f, 0xa2, 0x38, 0xce, 0x0b, - 0x4b, 0x73, 0x9a, 0x7d, 0x83, 0x0e, 0x43, 0xef, 0x3b, 0xe8, 0xd5, 0x3d, 0x1c, 0x82, 0x9e, 0x49, - 0x99, 0x2b, 0xbe, 0x33, 0xfa, 0x74, 0xed, 0xef, 0xf1, 0x32, 0x29, 0xb2, 0x77, 0x07, 0xc6, 0xb9, - 0x13, 0xfc, 0x01, 0xad, 0xa2, 0x8c, 0xca, 0x4d, 0x51, 0xc7, 0xe4, 0x5e, 0xbb, 0x71, 0xa4, 0x7d, - 0x45, 0x52, 0xad, 0x40, 0x1b, 0xe0, 0xd0, 0x05, 0xf2, 0xb6, 0x54, 0x89, 0xbd, 0xa3, 0xb3, 0x0d, - 0x22, 0xe8, 0x95, 0x5d, 0x95, 0x8a, 0x41, 0xaa, 0x77, 0xbf, 0x40, 0xe7, 0x2c, 0x74, 0x6c, 0x83, - 0xee, 0x4d, 0xc7, 0xbf, 0x79, 0x03, 0xdf, 0x43, 0xb7, 0xea, 0x42, 0x12, 0xfe, 0x62, 0x3e, 0xf3, - 0x05, 0x67, 0x6e, 0x02, 0xe6, 0xe5, 0x67, 0x6c, 0x81, 0x36, 0xff, 0xc5, 0x1b, 0xc8, 0xc1, 0x10, - 0xa1, 0xc2, 0x05, 0xd1, 0x9c, 0x78, 0x8c, 0x08, 0x66, 0xbd, 0x21, 0xf1, 0x73, 0xe9, 0x0b, 0x8f, - 0x4b, 0x44, 0xe8, 0x8a, 0x70, 0x32, 0xf6, 0x42, 0x12, 0x7f, 0x97, 0xc2, 0x0f, 0xf8, 0x8e, 0xe1, - 0x47, 0xe0, 0x22, 0x9c, 0xce, 0x02, 0x41, 0xb3, 0x93, 0xfa, 0x5e, 0x9b, 0x18, 0xbb, 0xbd, 0xcd, - 0x1e, 0xf7, 0x36, 0x7b, 0xda, 0xdb, 0xec, 0x39, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xe2, 0x93, 0x4e, - 0x61, 0x02, 0x00, 0x00, -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Type != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintAutonat(dAtA, i, uint64(*m.Type)) - } - if m.Dial != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintAutonat(dAtA, i, uint64(m.Dial.Size())) - n1, err := m.Dial.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.DialResponse != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintAutonat(dAtA, i, uint64(m.DialResponse.Size())) - n2, err := m.DialResponse.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message_PeerInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_PeerInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintAutonat(dAtA, i, uint64(len(m.Id))) - i += copy(dAtA[i:], m.Id) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - dAtA[i] = 0x12 - i++ - i = encodeVarintAutonat(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message_Dial) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_Dial) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Peer != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintAutonat(dAtA, i, uint64(m.Peer.Size())) - n3, err := m.Peer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message_DialResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_DialResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Status != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintAutonat(dAtA, i, uint64(*m.Status)) - } - if m.StatusText != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintAutonat(dAtA, i, uint64(len(*m.StatusText))) - i += copy(dAtA[i:], *m.StatusText) - } - if m.Addr != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintAutonat(dAtA, i, uint64(len(m.Addr))) - i += copy(dAtA[i:], m.Addr) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintAutonat(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovAutonat(uint64(*m.Type)) - } - if m.Dial != nil { - l = m.Dial.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.DialResponse != nil { - l = m.DialResponse.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message_PeerInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovAutonat(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovAutonat(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message_Dial) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message_DialResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != nil { - n += 1 + sovAutonat(uint64(*m.Status)) - } - if m.StatusText != nil { - l = len(*m.StatusText) - n += 1 + l + sovAutonat(uint64(l)) - } - if m.Addr != nil { - l = len(m.Addr) - n += 1 + l + sovAutonat(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovAutonat(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozAutonat(x uint64) (n int) { - return sovAutonat(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v Message_MessageType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Message_MessageType(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dial", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dial == nil { - m.Dial = &Message_Dial{} - } - if err := m.Dial.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DialResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DialResponse == nil { - m.DialResponse = &Message_DialResponse{} - } - if err := m.DialResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_PeerInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PeerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PeerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_Dial) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Dial: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Dial: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &Message_PeerInfo{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_DialResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DialResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DialResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var v Message_ResponseStatus - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= Message_ResponseStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Status = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusText", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.StatusText = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAutonat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAutonat - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAutonat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addr = append(m.Addr[:0], dAtA[iNdEx:postIndex]...) - if m.Addr == nil { - m.Addr = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAutonat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAutonat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAutonat(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAutonat - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthAutonat - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAutonat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipAutonat(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthAutonat - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthAutonat = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAutonat = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.proto b/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.proto deleted file mode 100644 index 7107e1c0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/pb/autonat.proto +++ /dev/null @@ -1,35 +0,0 @@ -package autonat.pb; - -message Message { - enum MessageType { - DIAL = 0; - DIAL_RESPONSE = 1; - } - - enum ResponseStatus { - OK = 0; - E_DIAL_ERROR = 100; - E_DIAL_REFUSED = 101; - E_BAD_REQUEST = 200; - E_INTERNAL_ERROR = 300; - } - - message PeerInfo { - optional bytes id = 1; - repeated bytes addrs = 2; - } - - message Dial { - optional PeerInfo peer = 1; - } - - message DialResponse { - optional ResponseStatus status = 1; - optional string statusText = 2; - optional bytes addr = 3; - } - - optional MessageType type = 1; - optional Dial dial = 2; - optional DialResponse dialResponse = 3; -} diff --git a/vendor/github.com/libp2p/go-libp2p-autonat/proto.go b/vendor/github.com/libp2p/go-libp2p-autonat/proto.go deleted file mode 100644 index 61ef986d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-autonat/proto.go +++ /dev/null @@ -1,27 +0,0 @@ -package autonat - -import ( - pb "github.com/libp2p/go-libp2p-autonat/pb" - - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" -) - -const AutoNATProto = "/libp2p/autonat/1.0.0" - -var log = logging.Logger("autonat") - -func newDialMessage(pi peer.AddrInfo) *pb.Message { - msg := new(pb.Message) - msg.Type = pb.Message_DIAL.Enum() - msg.Dial = new(pb.Message_Dial) - msg.Dial.Peer = new(pb.Message_PeerInfo) - msg.Dial.Peer.Id = []byte(pi.ID) - msg.Dial.Peer.Addrs = make([][]byte, len(pi.Addrs)) - for i, addr := range pi.Addrs { - msg.Dial.Peer.Addrs[i] = addr.Bytes() - } - - return msg -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/.travis.yml b/vendor/github.com/libp2p/go-libp2p-circuit/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/LICENSE b/vendor/github.com/libp2p/go-libp2p-circuit/LICENSE deleted file mode 100644 index 2f06d0eb..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/README.md b/vendor/github.com/libp2p/go-libp2p-circuit/README.md deleted file mode 100644 index b777eb3b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/README.md +++ /dev/null @@ -1,43 +0,0 @@ -go-libp2p-circuit -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23libp2p) -[![Coverage Status](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-circuit.svg?style=flat-square&branch=master)](https://codecov.io/github/libp2p/go-libp2p-circuit?branch=master) -[![Travis CI](https://travis-ci.org/libp2p/go-libp2p-circuit.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-circuit) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - - -> The libp2p relay allows peers to relay connections on behalf of others. - - -## Table of Contents - -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -go get -u github.com/libp2p/go-libp2p-circuit -``` - -## Usage - -Refer to the [relay example](https://github.com/libp2p/go-libp2p-examples/tree/master/relay) in the `go-libp2p-examples` repository for usage instructions. - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson - ---- - -The last gx published version of this module was: 2.3.15: QmRTkLxADQRbgnhpt2zzQQJr8Ri764b7dujoDkZw33b3iE diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/codecov.yml b/vendor/github.com/libp2p/go-libp2p-circuit/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/conn.go b/vendor/github.com/libp2p/go-libp2p-circuit/conn.go deleted file mode 100644 index 8fa53b3d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/conn.go +++ /dev/null @@ -1,102 +0,0 @@ -package relay - -import ( - "fmt" - "net" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -type Conn struct { - stream network.Stream - remote peer.AddrInfo - host host.Host -} - -type NetAddr struct { - Relay string - Remote string -} - -func (n *NetAddr) Network() string { - return "libp2p-circuit-relay" -} - -func (n *NetAddr) String() string { - return fmt.Sprintf("relay[%s-%s]", n.Remote, n.Relay) -} - -func (c *Conn) Close() error { - c.untagHop() - return c.stream.Reset() -} - -func (c *Conn) Read(buf []byte) (int, error) { - return c.stream.Read(buf) -} - -func (c *Conn) Write(buf []byte) (int, error) { - return c.stream.Write(buf) -} - -func (c *Conn) SetDeadline(t time.Time) error { - return c.stream.SetDeadline(t) -} - -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.stream.SetReadDeadline(t) -} - -func (c *Conn) SetWriteDeadline(t time.Time) error { - return c.stream.SetWriteDeadline(t) -} - -func (c *Conn) RemoteAddr() net.Addr { - return &NetAddr{ - Relay: c.stream.Conn().RemotePeer().Pretty(), - Remote: c.remote.ID.Pretty(), - } -} - -// Increment the underlying relay connection tag by 1, thus increasing its protection from -// connection pruning. This ensures that connections to relays are not accidentally closed, -// by the connection manager, taking with them all the relayed connections (that may themselves -// be protected). -func (c *Conn) tagHop() { - c.host.ConnManager().UpsertTag(c.stream.Conn().RemotePeer(), "relay-hop-stream", incrementTag) -} - -// Decrement the underlying relay connection tag by 1; this is performed when we close the -// relayed connection. -func (c *Conn) untagHop() { - c.host.ConnManager().UpsertTag(c.stream.Conn().RemotePeer(), "relay-hop-stream", decrementTag) -} - -// TODO: is it okay to cast c.Conn().RemotePeer() into a multiaddr? might be "user input" -func (c *Conn) RemoteMultiaddr() ma.Multiaddr { - proto := ma.ProtocolWithCode(ma.P_P2P).Name - peerid := c.stream.Conn().RemotePeer().Pretty() - p2paddr := ma.StringCast(fmt.Sprintf("/%s/%s", proto, peerid)) - - circaddr := ma.Cast(ma.CodeToVarint(P_CIRCUIT)) - return p2paddr.Encapsulate(circaddr) -} - -func (c *Conn) LocalMultiaddr() ma.Multiaddr { - return c.stream.Conn().LocalMultiaddr() -} - -func (c *Conn) LocalAddr() net.Addr { - na, err := manet.ToNetAddr(c.stream.Conn().LocalMultiaddr()) - if err != nil { - log.Error("failed to convert local multiaddr to net addr:", err) - return nil - } - return na -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/dial.go b/vendor/github.com/libp2p/go-libp2p-circuit/dial.go deleted file mode 100644 index 6668f397..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/dial.go +++ /dev/null @@ -1,89 +0,0 @@ -package relay - -import ( - "context" - "fmt" - "math/rand" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - ma "github.com/multiformats/go-multiaddr" -) - -func (d *RelayTransport) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (transport.CapableConn, error) { - c, err := d.Relay().Dial(ctx, a, p) - if err != nil { - return nil, err - } - c.tagHop() - return d.upgrader.UpgradeOutbound(ctx, d, c, p) -} - -func (r *Relay) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (*Conn, error) { - if !r.Matches(a) { - return nil, fmt.Errorf("%s is not a relay address", a) - } - parts := ma.Split(a) - - spl := ma.Cast(ma.CodeToVarint(P_CIRCUIT)) - - var relayaddr, destaddr ma.Multiaddr - for i, p := range parts { - if p.Equal(spl) { - relayaddr = ma.Join(parts[:i]...) - destaddr = ma.Join(parts[i+1:]...) - break - } - } - - dinfo := &peer.AddrInfo{ID: p, Addrs: []ma.Multiaddr{}} - if len(destaddr.Bytes()) > 0 { - dinfo.Addrs = append(dinfo.Addrs, destaddr) - } - - if len(relayaddr.Bytes()) == 0 { - // unspecific relay address, try dialing using known hop relays - return r.tryDialRelays(ctx, *dinfo) - } - - var rinfo *peer.AddrInfo - rinfo, err := peer.AddrInfoFromP2pAddr(relayaddr) - if err != nil { - return nil, fmt.Errorf("error parsing multiaddr '%s': %s", relayaddr.String(), err) - } - - return r.DialPeer(ctx, *rinfo, *dinfo) -} - -func (r *Relay) tryDialRelays(ctx context.Context, dinfo peer.AddrInfo) (*Conn, error) { - var relays []peer.ID - r.mx.Lock() - for p := range r.relays { - relays = append(relays, p) - } - r.mx.Unlock() - - // shuffle list of relays, avoid overloading a specific relay - for i := range relays { - j := rand.Intn(i + 1) - relays[i], relays[j] = relays[j], relays[i] - } - - for _, relay := range relays { - if len(r.host.Network().ConnsToPeer(relay)) == 0 { - continue - } - - rctx, cancel := context.WithTimeout(ctx, HopConnectTimeout) - c, err := r.DialPeer(rctx, peer.AddrInfo{ID: relay}, dinfo) - cancel() - - if err == nil { - return c, nil - } - - log.Debugf("error opening relay connection through %s: %s", dinfo.ID, err.Error()) - } - - return nil, fmt.Errorf("Failed to dial through %d known relay hosts", len(relays)) -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/go.mod b/vendor/github.com/libp2p/go-libp2p-circuit/go.mod deleted file mode 100644 index c9fb8216..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/libp2p/go-libp2p-circuit - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-buffer-pool v0.0.2 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 -) diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/go.sum b/vendor/github.com/libp2p/go-libp2p-circuit/go.sum deleted file mode 100644 index fd879b2b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/go.sum +++ /dev/null @@ -1,207 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/listen.go b/vendor/github.com/libp2p/go-libp2p-circuit/listen.go deleted file mode 100644 index b00015b5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/listen.go +++ /dev/null @@ -1,59 +0,0 @@ -package relay - -import ( - "net" - - pb "github.com/libp2p/go-libp2p-circuit/pb" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -var _ manet.Listener = (*RelayListener)(nil) - -type RelayListener Relay - -func (l *RelayListener) Relay() *Relay { - return (*Relay)(l) -} - -func (r *Relay) Listener() *RelayListener { - // TODO: Only allow one! - return (*RelayListener)(r) -} - -func (l *RelayListener) Accept() (manet.Conn, error) { - select { - case c := <-l.incoming: - err := l.Relay().writeResponse(c.stream, pb.CircuitRelay_SUCCESS) - if err != nil { - log.Debugf("error writing relay response: %s", err.Error()) - c.stream.Reset() - return nil, err - } - - // TODO: Pretty print. - log.Infof("accepted relay connection: %q", c) - - c.tagHop() - return c, nil - case <-l.ctx.Done(): - return nil, l.ctx.Err() - } -} - -func (l *RelayListener) Addr() net.Addr { - return &NetAddr{ - Relay: "any", - Remote: "any", - } -} - -func (l *RelayListener) Multiaddr() ma.Multiaddr { - return ma.Cast(ma.CodeToVarint(P_CIRCUIT)) -} - -func (l *RelayListener) Close() error { - // TODO: noop? - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/notify.go b/vendor/github.com/libp2p/go-libp2p-circuit/notify.go deleted file mode 100644 index 813daed4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/notify.go +++ /dev/null @@ -1,54 +0,0 @@ -package relay - -import ( - "context" - "time" - - inet "github.com/libp2p/go-libp2p-core/network" - peer "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" -) - -var _ inet.Notifiee = (*RelayNotifiee)(nil) - -type RelayNotifiee Relay - -func (r *Relay) notifiee() inet.Notifiee { - return (*RelayNotifiee)(r) -} - -func (n *RelayNotifiee) Relay() *Relay { - return (*Relay)(n) -} - -func (n *RelayNotifiee) Listen(net inet.Network, a ma.Multiaddr) {} -func (n *RelayNotifiee) ListenClose(net inet.Network, a ma.Multiaddr) {} -func (n *RelayNotifiee) OpenedStream(net inet.Network, s inet.Stream) {} -func (n *RelayNotifiee) ClosedStream(net inet.Network, s inet.Stream) {} - -func (n *RelayNotifiee) Connected(s inet.Network, c inet.Conn) { - if n.Relay().Matches(c.RemoteMultiaddr()) { - return - } - - go func(id peer.ID) { - ctx, cancel := context.WithTimeout(n.ctx, time.Second) - defer cancel() - - canhop, err := n.Relay().CanHop(ctx, id) - if err != nil { - log.Debugf("Error testing relay hop: %s", err.Error()) - return - } - - if canhop { - log.Debugf("Discovered hop relay %s", id.Pretty()) - n.mx.Lock() - n.relays[id] = struct{}{} - n.mx.Unlock() - n.host.ConnManager().TagPeer(id, "relay-hop", 2) - } - }(c.RemotePeer()) -} - -func (n *RelayNotifiee) Disconnected(s inet.Network, c inet.Conn) {} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-circuit/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.pb.go b/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.pb.go deleted file mode 100644 index ca165ee6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.pb.go +++ /dev/null @@ -1,880 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: relay.proto - -package relay_pb - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type CircuitRelay_Status int32 - -const ( - CircuitRelay_SUCCESS CircuitRelay_Status = 100 - CircuitRelay_HOP_SRC_ADDR_TOO_LONG CircuitRelay_Status = 220 - CircuitRelay_HOP_DST_ADDR_TOO_LONG CircuitRelay_Status = 221 - CircuitRelay_HOP_SRC_MULTIADDR_INVALID CircuitRelay_Status = 250 - CircuitRelay_HOP_DST_MULTIADDR_INVALID CircuitRelay_Status = 251 - CircuitRelay_HOP_NO_CONN_TO_DST CircuitRelay_Status = 260 - CircuitRelay_HOP_CANT_DIAL_DST CircuitRelay_Status = 261 - CircuitRelay_HOP_CANT_OPEN_DST_STREAM CircuitRelay_Status = 262 - CircuitRelay_HOP_CANT_SPEAK_RELAY CircuitRelay_Status = 270 - CircuitRelay_HOP_CANT_RELAY_TO_SELF CircuitRelay_Status = 280 - CircuitRelay_STOP_SRC_ADDR_TOO_LONG CircuitRelay_Status = 320 - CircuitRelay_STOP_DST_ADDR_TOO_LONG CircuitRelay_Status = 321 - CircuitRelay_STOP_SRC_MULTIADDR_INVALID CircuitRelay_Status = 350 - CircuitRelay_STOP_DST_MULTIADDR_INVALID CircuitRelay_Status = 351 - CircuitRelay_STOP_RELAY_REFUSED CircuitRelay_Status = 390 - CircuitRelay_MALFORMED_MESSAGE CircuitRelay_Status = 400 -) - -var CircuitRelay_Status_name = map[int32]string{ - 100: "SUCCESS", - 220: "HOP_SRC_ADDR_TOO_LONG", - 221: "HOP_DST_ADDR_TOO_LONG", - 250: "HOP_SRC_MULTIADDR_INVALID", - 251: "HOP_DST_MULTIADDR_INVALID", - 260: "HOP_NO_CONN_TO_DST", - 261: "HOP_CANT_DIAL_DST", - 262: "HOP_CANT_OPEN_DST_STREAM", - 270: "HOP_CANT_SPEAK_RELAY", - 280: "HOP_CANT_RELAY_TO_SELF", - 320: "STOP_SRC_ADDR_TOO_LONG", - 321: "STOP_DST_ADDR_TOO_LONG", - 350: "STOP_SRC_MULTIADDR_INVALID", - 351: "STOP_DST_MULTIADDR_INVALID", - 390: "STOP_RELAY_REFUSED", - 400: "MALFORMED_MESSAGE", -} - -var CircuitRelay_Status_value = map[string]int32{ - "SUCCESS": 100, - "HOP_SRC_ADDR_TOO_LONG": 220, - "HOP_DST_ADDR_TOO_LONG": 221, - "HOP_SRC_MULTIADDR_INVALID": 250, - "HOP_DST_MULTIADDR_INVALID": 251, - "HOP_NO_CONN_TO_DST": 260, - "HOP_CANT_DIAL_DST": 261, - "HOP_CANT_OPEN_DST_STREAM": 262, - "HOP_CANT_SPEAK_RELAY": 270, - "HOP_CANT_RELAY_TO_SELF": 280, - "STOP_SRC_ADDR_TOO_LONG": 320, - "STOP_DST_ADDR_TOO_LONG": 321, - "STOP_SRC_MULTIADDR_INVALID": 350, - "STOP_DST_MULTIADDR_INVALID": 351, - "STOP_RELAY_REFUSED": 390, - "MALFORMED_MESSAGE": 400, -} - -func (x CircuitRelay_Status) Enum() *CircuitRelay_Status { - p := new(CircuitRelay_Status) - *p = x - return p -} - -func (x CircuitRelay_Status) String() string { - return proto.EnumName(CircuitRelay_Status_name, int32(x)) -} - -func (x *CircuitRelay_Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Status_value, data, "CircuitRelay_Status") - if err != nil { - return err - } - *x = CircuitRelay_Status(value) - return nil -} - -func (CircuitRelay_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 0} -} - -type CircuitRelay_Type int32 - -const ( - CircuitRelay_HOP CircuitRelay_Type = 1 - CircuitRelay_STOP CircuitRelay_Type = 2 - CircuitRelay_STATUS CircuitRelay_Type = 3 - CircuitRelay_CAN_HOP CircuitRelay_Type = 4 -) - -var CircuitRelay_Type_name = map[int32]string{ - 1: "HOP", - 2: "STOP", - 3: "STATUS", - 4: "CAN_HOP", -} - -var CircuitRelay_Type_value = map[string]int32{ - "HOP": 1, - "STOP": 2, - "STATUS": 3, - "CAN_HOP": 4, -} - -func (x CircuitRelay_Type) Enum() *CircuitRelay_Type { - p := new(CircuitRelay_Type) - *p = x - return p -} - -func (x CircuitRelay_Type) String() string { - return proto.EnumName(CircuitRelay_Type_name, int32(x)) -} - -func (x *CircuitRelay_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CircuitRelay_Type_value, data, "CircuitRelay_Type") - if err != nil { - return err - } - *x = CircuitRelay_Type(value) - return nil -} - -func (CircuitRelay_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 1} -} - -type CircuitRelay struct { - Type *CircuitRelay_Type `protobuf:"varint,1,opt,name=type,enum=relay.pb.CircuitRelay_Type" json:"type,omitempty"` - SrcPeer *CircuitRelay_Peer `protobuf:"bytes,2,opt,name=srcPeer" json:"srcPeer,omitempty"` - DstPeer *CircuitRelay_Peer `protobuf:"bytes,3,opt,name=dstPeer" json:"dstPeer,omitempty"` - Code *CircuitRelay_Status `protobuf:"varint,4,opt,name=code,enum=relay.pb.CircuitRelay_Status" json:"code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitRelay) Reset() { *m = CircuitRelay{} } -func (m *CircuitRelay) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay) ProtoMessage() {} -func (*CircuitRelay) Descriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0} -} -func (m *CircuitRelay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CircuitRelay) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay.Merge(m, src) -} -func (m *CircuitRelay) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitRelay proto.InternalMessageInfo - -func (m *CircuitRelay) GetType() CircuitRelay_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return CircuitRelay_HOP -} - -func (m *CircuitRelay) GetSrcPeer() *CircuitRelay_Peer { - if m != nil { - return m.SrcPeer - } - return nil -} - -func (m *CircuitRelay) GetDstPeer() *CircuitRelay_Peer { - if m != nil { - return m.DstPeer - } - return nil -} - -func (m *CircuitRelay) GetCode() CircuitRelay_Status { - if m != nil && m.Code != nil { - return *m.Code - } - return CircuitRelay_SUCCESS -} - -type CircuitRelay_Peer struct { - Id []byte `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitRelay_Peer) Reset() { *m = CircuitRelay_Peer{} } -func (m *CircuitRelay_Peer) String() string { return proto.CompactTextString(m) } -func (*CircuitRelay_Peer) ProtoMessage() {} -func (*CircuitRelay_Peer) Descriptor() ([]byte, []int) { - return fileDescriptor_9f69a7d5a802d584, []int{0, 0} -} -func (m *CircuitRelay_Peer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CircuitRelay_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CircuitRelay_Peer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CircuitRelay_Peer) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitRelay_Peer.Merge(m, src) -} -func (m *CircuitRelay_Peer) XXX_Size() int { - return m.Size() -} -func (m *CircuitRelay_Peer) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitRelay_Peer.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitRelay_Peer proto.InternalMessageInfo - -func (m *CircuitRelay_Peer) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *CircuitRelay_Peer) GetAddrs() [][]byte { - if m != nil { - return m.Addrs - } - return nil -} - -func init() { - proto.RegisterEnum("relay.pb.CircuitRelay_Status", CircuitRelay_Status_name, CircuitRelay_Status_value) - proto.RegisterEnum("relay.pb.CircuitRelay_Type", CircuitRelay_Type_name, CircuitRelay_Type_value) - proto.RegisterType((*CircuitRelay)(nil), "relay.pb.CircuitRelay") - proto.RegisterType((*CircuitRelay_Peer)(nil), "relay.pb.CircuitRelay.Peer") -} - -func init() { proto.RegisterFile("relay.proto", fileDescriptor_9f69a7d5a802d584) } - -var fileDescriptor_9f69a7d5a802d584 = []byte{ - // 473 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x65, 0x27, 0xbf, 0x76, 0x7a, 0x5a, 0x4d, 0xfe, 0x59, 0x63, 0x64, 0x9d, 0x56, 0xaa, - 0x9e, 0x7a, 0x40, 0x45, 0x4c, 0xe2, 0x05, 0x98, 0xc4, 0xdd, 0x2a, 0xd2, 0x38, 0xb2, 0x5d, 0x24, - 0x4e, 0x56, 0x69, 0x72, 0xa8, 0x84, 0xd4, 0x2a, 0xcd, 0x0e, 0xbd, 0xc3, 0xb8, 0x21, 0x8e, 0xbc, - 0x1c, 0xe0, 0xc4, 0x91, 0x17, 0xc0, 0x3f, 0xf5, 0x65, 0xc0, 0x05, 0xd9, 0x5d, 0x33, 0x44, 0x37, - 0x89, 0xa3, 0x9f, 0xef, 0xe7, 0xe3, 0x3c, 0xf9, 0x26, 0xd0, 0x28, 0xf2, 0x17, 0x93, 0x55, 0x7f, - 0x51, 0xcc, 0xcb, 0x39, 0xdd, 0xbb, 0x3a, 0x3c, 0xef, 0xbe, 0xae, 0x41, 0x33, 0x9c, 0x15, 0xd3, - 0x8b, 0x59, 0x29, 0xed, 0x8c, 0x3e, 0x00, 0xbf, 0x5c, 0x2d, 0xf2, 0x00, 0x75, 0x50, 0x6f, 0xff, - 0xf4, 0xb8, 0xbf, 0x25, 0xfb, 0x7f, 0x52, 0x7d, 0xbd, 0x5a, 0xe4, 0xd2, 0x81, 0xf4, 0x11, 0xd4, - 0x97, 0xc5, 0x34, 0xcd, 0xf3, 0x22, 0xc0, 0x1d, 0xd4, 0x6b, 0xdc, 0xea, 0x58, 0x44, 0x6e, 0x59, - 0xab, 0x65, 0xcb, 0xd2, 0x69, 0xde, 0x3f, 0x68, 0x57, 0x2c, 0x7d, 0x08, 0xfe, 0x74, 0x9e, 0xe5, - 0x81, 0xef, 0xd6, 0x3b, 0xb9, 0xc5, 0x51, 0xe5, 0xa4, 0xbc, 0x58, 0x4a, 0x87, 0xb6, 0xee, 0x83, - 0xef, 0xd4, 0x7d, 0xc0, 0xb3, 0x2c, 0x40, 0x1d, 0xdc, 0x6b, 0x4a, 0x3c, 0xcb, 0xe8, 0x01, 0xfc, - 0x37, 0xc9, 0xb2, 0x62, 0x19, 0xe0, 0x8e, 0xd7, 0x6b, 0xca, 0xcd, 0xa1, 0xfb, 0xd1, 0x83, 0xda, - 0x46, 0xa7, 0x0d, 0xa8, 0xab, 0x71, 0x18, 0x72, 0xa5, 0x48, 0x46, 0x5b, 0x70, 0xe7, 0x5c, 0xa4, - 0x46, 0xc9, 0xd0, 0xb0, 0x28, 0x92, 0x46, 0x0b, 0x61, 0x62, 0x91, 0x9c, 0x91, 0x2f, 0x68, 0x9b, - 0x45, 0x4a, 0xff, 0x95, 0x7d, 0x45, 0xb4, 0x0d, 0x47, 0x5b, 0x6f, 0x34, 0x8e, 0xf5, 0xd0, 0x01, - 0xc3, 0xe4, 0x29, 0x8b, 0x87, 0x11, 0xf9, 0x59, 0xe5, 0xd6, 0xdd, 0xcd, 0x7f, 0x21, 0x7a, 0x17, - 0xa8, 0xcd, 0x13, 0x61, 0x42, 0x91, 0x24, 0x46, 0x0b, 0x8b, 0x92, 0x97, 0x98, 0x1e, 0xc2, 0xff, - 0x36, 0x08, 0x59, 0xa2, 0x4d, 0x34, 0x64, 0xb1, 0x9b, 0xbf, 0xc2, 0xf4, 0x04, 0x82, 0x6a, 0x2e, - 0x52, 0x9e, 0xb8, 0xab, 0x95, 0x96, 0x9c, 0x8d, 0xc8, 0x25, 0xa6, 0x47, 0x70, 0x50, 0xc5, 0x2a, - 0xe5, 0xec, 0x89, 0x91, 0x3c, 0x66, 0xcf, 0xc8, 0x1b, 0x4c, 0x8f, 0xe1, 0xb0, 0x8a, 0xdc, 0xd0, - 0x3e, 0x4d, 0xf1, 0x78, 0x40, 0xde, 0xb9, 0x50, 0xe9, 0x1b, 0x0b, 0x78, 0x7f, 0x1d, 0xee, 0x36, - 0xf0, 0x01, 0xd3, 0x7b, 0xd0, 0xaa, 0xcc, 0xdd, 0x57, 0xfc, 0x76, 0x0d, 0xdc, 0xdc, 0xc1, 0x77, - 0x6c, 0x3b, 0x70, 0xc0, 0x66, 0x29, 0xc9, 0x07, 0x63, 0xc5, 0x23, 0x72, 0xe9, 0xd9, 0x0e, 0x46, - 0x2c, 0x1e, 0x08, 0x39, 0xe2, 0x91, 0x19, 0x71, 0xa5, 0xd8, 0x19, 0x27, 0x6f, 0xbd, 0xee, 0x29, - 0xf8, 0xf6, 0x0f, 0xa5, 0x75, 0xf0, 0xce, 0x45, 0x4a, 0x10, 0xdd, 0x03, 0xdf, 0xde, 0x40, 0x30, - 0x05, 0xa8, 0x29, 0xcd, 0xf4, 0x58, 0x11, 0xcf, 0x7e, 0xe0, 0x90, 0x25, 0xc6, 0x22, 0xfe, 0xe3, - 0xe6, 0xa7, 0x75, 0x1b, 0x7d, 0x5e, 0xb7, 0xd1, 0x8f, 0x75, 0x1b, 0xfd, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0x6b, 0x22, 0x33, 0xbb, 0x2f, 0x03, 0x00, 0x00, -} - -func (m *CircuitRelay) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CircuitRelay) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Type != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRelay(dAtA, i, uint64(*m.Type)) - } - if m.SrcPeer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRelay(dAtA, i, uint64(m.SrcPeer.Size())) - n1, err := m.SrcPeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.DstPeer != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRelay(dAtA, i, uint64(m.DstPeer.Size())) - n2, err := m.DstPeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Code != nil { - dAtA[i] = 0x20 - i++ - i = encodeVarintRelay(dAtA, i, uint64(*m.Code)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *CircuitRelay_Peer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CircuitRelay_Peer) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintRelay(dAtA, i, uint64(len(m.Id))) - i += copy(dAtA[i:], m.Id) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - dAtA[i] = 0x12 - i++ - i = encodeVarintRelay(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintRelay(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *CircuitRelay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != nil { - n += 1 + sovRelay(uint64(*m.Type)) - } - if m.SrcPeer != nil { - l = m.SrcPeer.Size() - n += 1 + l + sovRelay(uint64(l)) - } - if m.DstPeer != nil { - l = m.DstPeer.Size() - n += 1 + l + sovRelay(uint64(l)) - } - if m.Code != nil { - n += 1 + sovRelay(uint64(*m.Code)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CircuitRelay_Peer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != nil { - l = len(m.Id) - n += 1 + l + sovRelay(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovRelay(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovRelay(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozRelay(x uint64) (n int) { - return sovRelay(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *CircuitRelay) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CircuitRelay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CircuitRelay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var v CircuitRelay_Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Type = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SrcPeer == nil { - m.SrcPeer = &CircuitRelay_Peer{} - } - if err := m.SrcPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DstPeer == nil { - m.DstPeer = &CircuitRelay_Peer{} - } - if err := m.DstPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - var v CircuitRelay_Status - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= CircuitRelay_Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Code = &v - default: - iNdEx = preIndex - skippy, err := skipRelay(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CircuitRelay_Peer) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Peer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRelay - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRelay - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRelay - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRelay(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRelay - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("id") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRelay(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRelay - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRelay - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRelay - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRelay(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRelay - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthRelay = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRelay = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.proto b/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.proto deleted file mode 100644 index de3e637b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/pb/relay.proto +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto2"; - -package relay.pb; - -message CircuitRelay { - - enum Status { - SUCCESS = 100; - HOP_SRC_ADDR_TOO_LONG = 220; - HOP_DST_ADDR_TOO_LONG = 221; - HOP_SRC_MULTIADDR_INVALID = 250; - HOP_DST_MULTIADDR_INVALID = 251; - HOP_NO_CONN_TO_DST = 260; - HOP_CANT_DIAL_DST = 261; - HOP_CANT_OPEN_DST_STREAM = 262; - HOP_CANT_SPEAK_RELAY = 270; - HOP_CANT_RELAY_TO_SELF = 280; - STOP_SRC_ADDR_TOO_LONG = 320; - STOP_DST_ADDR_TOO_LONG = 321; - STOP_SRC_MULTIADDR_INVALID = 350; - STOP_DST_MULTIADDR_INVALID = 351; - STOP_RELAY_REFUSED = 390; - MALFORMED_MESSAGE = 400; - } - - enum Type { // RPC identifier, either HOP, STOP or STATUS - HOP = 1; - STOP = 2; - STATUS = 3; - CAN_HOP = 4; - } - - message Peer { - required bytes id = 1; // peer id - repeated bytes addrs = 2; // peer's known addresses - } - - optional Type type = 1; // Type of the message - - optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STOP - optional Peer dstPeer = 3; - - optional Status code = 4; // Status code, used when Type is STATUS -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/relay.go b/vendor/github.com/libp2p/go-libp2p-circuit/relay.go deleted file mode 100644 index 1bb7cc0d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/relay.go +++ /dev/null @@ -1,491 +0,0 @@ -package relay - -import ( - "context" - "fmt" - "io" - "sync" - "sync/atomic" - "time" - - pb "github.com/libp2p/go-libp2p-circuit/pb" - - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - - pool "github.com/libp2p/go-buffer-pool" - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - - logging "github.com/ipfs/go-log" - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("relay") - -const ProtoID = "/libp2p/circuit/relay/0.1.0" - -const maxMessageSize = 4096 - -var ( - RelayAcceptTimeout = 10 * time.Second - HopConnectTimeout = 30 * time.Second - StopHandshakeTimeout = 1 * time.Minute - - HopStreamBufferSize = 4096 - HopStreamLimit = 1 << 19 // 512K hops for 1M goroutines -) - -// Relay is the relay transport and service. -type Relay struct { - host host.Host - upgrader *tptu.Upgrader - ctx context.Context - self peer.ID - - active bool - hop bool - discovery bool - - incoming chan *Conn - - relays map[peer.ID]struct{} - mx sync.Mutex - - // atomic counters - streamCount int32 - liveHopCount int32 -} - -// RelayOpts are options for configuring the relay transport. -type RelayOpt int - -var ( - // OptActive configures the relay transport to actively establish - // outbound connections on behalf of clients. You probably don't want to - // enable this unless you know what you're doing. - OptActive = RelayOpt(0) - // OptHop configures the relay transport to accept requests to relay - // traffic on behalf of third-parties. Unless OptActive is specified, - // this will only relay traffic between peers already connected to this - // node. - OptHop = RelayOpt(1) - // OptDiscovery configures this relay transport to discover new relays - // by probing every new peer. You almost _certainly_ don't want to - // enable this. - OptDiscovery = RelayOpt(2) -) - -type RelayError struct { - Code pb.CircuitRelay_Status -} - -func (e RelayError) Error() string { - return fmt.Sprintf("error opening relay circuit: %s (%d)", pb.CircuitRelay_Status_name[int32(e.Code)], e.Code) -} - -// NewRelay constructs a new relay. -func NewRelay(ctx context.Context, h host.Host, upgrader *tptu.Upgrader, opts ...RelayOpt) (*Relay, error) { - r := &Relay{ - upgrader: upgrader, - host: h, - ctx: ctx, - self: h.ID(), - incoming: make(chan *Conn), - relays: make(map[peer.ID]struct{}), - } - - for _, opt := range opts { - switch opt { - case OptActive: - r.active = true - case OptHop: - r.hop = true - case OptDiscovery: - r.discovery = true - default: - return nil, fmt.Errorf("unrecognized option: %d", opt) - } - } - - h.SetStreamHandler(ProtoID, r.handleNewStream) - - if r.discovery { - h.Network().Notify(r.notifiee()) - } - - return r, nil -} - -// Increment the live hop count and increment the connection manager tags by 1 for the two -// sides of the hop stream. This ensures that connections with many hop streams will be protected -// from pruning, thus minimizing disruption from connection trimming in a relay node. -func (r *Relay) addLiveHop(from, to peer.ID) { - atomic.AddInt32(&r.liveHopCount, 1) - r.host.ConnManager().UpsertTag(from, "relay-hop-stream", incrementTag) - r.host.ConnManager().UpsertTag(to, "relay-hop-stream", incrementTag) -} - -// Decrement the live hpo count and decrement the connection manager tags for the two sides -// of the hop stream. -func (r *Relay) rmLiveHop(from, to peer.ID) { - atomic.AddInt32(&r.liveHopCount, -1) - r.host.ConnManager().UpsertTag(from, "relay-hop-stream", decrementTag) - r.host.ConnManager().UpsertTag(to, "relay-hop-stream", decrementTag) - -} - -func (r *Relay) GetActiveHops() int32 { - return atomic.LoadInt32(&r.liveHopCount) -} - -func (r *Relay) DialPeer(ctx context.Context, relay peer.AddrInfo, dest peer.AddrInfo) (*Conn, error) { - - log.Debugf("dialing peer %s through relay %s", dest.ID, relay.ID) - - if len(relay.Addrs) > 0 { - r.host.Peerstore().AddAddrs(relay.ID, relay.Addrs, peerstore.TempAddrTTL) - } - - s, err := r.host.NewStream(ctx, relay.ID, ProtoID) - if err != nil { - return nil, err - } - - rd := newDelimitedReader(s, maxMessageSize) - wr := newDelimitedWriter(s) - defer rd.Close() - - var msg pb.CircuitRelay - - msg.Type = pb.CircuitRelay_HOP.Enum() - msg.SrcPeer = peerInfoToPeer(r.host.Peerstore().PeerInfo(r.self)) - msg.DstPeer = peerInfoToPeer(dest) - - err = wr.WriteMsg(&msg) - if err != nil { - s.Reset() - return nil, err - } - - msg.Reset() - - err = rd.ReadMsg(&msg) - if err != nil { - s.Reset() - return nil, err - } - - if msg.GetType() != pb.CircuitRelay_STATUS { - s.Reset() - return nil, fmt.Errorf("unexpected relay response; not a status message (%d)", msg.GetType()) - } - - if msg.GetCode() != pb.CircuitRelay_SUCCESS { - s.Reset() - return nil, RelayError{msg.GetCode()} - } - - return &Conn{stream: s, remote: dest, host: r.host}, nil -} - -func (r *Relay) Matches(addr ma.Multiaddr) bool { - // TODO: Look at the prefix transport as well. - _, err := addr.ValueForProtocol(P_CIRCUIT) - return err == nil -} - -func (r *Relay) CanHop(ctx context.Context, id peer.ID) (bool, error) { - s, err := r.host.NewStream(ctx, id, ProtoID) - if err != nil { - return false, err - } - - rd := newDelimitedReader(s, maxMessageSize) - wr := newDelimitedWriter(s) - defer rd.Close() - - var msg pb.CircuitRelay - - msg.Type = pb.CircuitRelay_CAN_HOP.Enum() - - if err := wr.WriteMsg(&msg); err != nil { - s.Reset() - return false, err - } - - msg.Reset() - - if err := rd.ReadMsg(&msg); err != nil { - s.Reset() - return false, err - } - if err := helpers.FullClose(s); err != nil { - return false, err - } - - if msg.GetType() != pb.CircuitRelay_STATUS { - return false, fmt.Errorf("unexpected relay response; not a status message (%d)", msg.GetType()) - } - - return msg.GetCode() == pb.CircuitRelay_SUCCESS, nil -} - -func (r *Relay) handleNewStream(s network.Stream) { - log.Infof("new relay stream from: %s", s.Conn().RemotePeer()) - - rd := newDelimitedReader(s, maxMessageSize) - defer rd.Close() - - var msg pb.CircuitRelay - - err := rd.ReadMsg(&msg) - if err != nil { - r.handleError(s, pb.CircuitRelay_MALFORMED_MESSAGE) - return - } - - switch msg.GetType() { - case pb.CircuitRelay_HOP: - r.handleHopStream(s, &msg) - case pb.CircuitRelay_STOP: - r.handleStopStream(s, &msg) - case pb.CircuitRelay_CAN_HOP: - r.handleCanHop(s, &msg) - default: - log.Warningf("unexpected relay handshake: %d", msg.GetType()) - r.handleError(s, pb.CircuitRelay_MALFORMED_MESSAGE) - } -} - -func (r *Relay) handleHopStream(s network.Stream, msg *pb.CircuitRelay) { - if !r.hop { - r.handleError(s, pb.CircuitRelay_HOP_CANT_SPEAK_RELAY) - return - } - - streamCount := atomic.AddInt32(&r.streamCount, 1) - liveHopCount := atomic.LoadInt32(&r.liveHopCount) - defer atomic.AddInt32(&r.streamCount, -1) - - if (streamCount + liveHopCount) > int32(HopStreamLimit) { - log.Warning("hop stream limit exceeded; resetting stream") - s.Reset() - return - } - - src, err := peerToPeerInfo(msg.GetSrcPeer()) - if err != nil { - r.handleError(s, pb.CircuitRelay_HOP_SRC_MULTIADDR_INVALID) - return - } - - if src.ID != s.Conn().RemotePeer() { - r.handleError(s, pb.CircuitRelay_HOP_SRC_MULTIADDR_INVALID) - return - } - - dst, err := peerToPeerInfo(msg.GetDstPeer()) - if err != nil { - r.handleError(s, pb.CircuitRelay_HOP_DST_MULTIADDR_INVALID) - return - } - - if dst.ID == r.self { - r.handleError(s, pb.CircuitRelay_HOP_CANT_RELAY_TO_SELF) - return - } - - // open stream - ctx, cancel := context.WithTimeout(r.ctx, HopConnectTimeout) - defer cancel() - - if !r.active { - ctx = network.WithNoDial(ctx, "relay hop") - } else if len(dst.Addrs) > 0 { - r.host.Peerstore().AddAddrs(dst.ID, dst.Addrs, peerstore.TempAddrTTL) - } - - bs, err := r.host.NewStream(ctx, dst.ID, ProtoID) - if err != nil { - log.Debugf("error opening relay stream to %s: %s", dst.ID.Pretty(), err.Error()) - if err == network.ErrNoConn { - r.handleError(s, pb.CircuitRelay_HOP_NO_CONN_TO_DST) - } else { - r.handleError(s, pb.CircuitRelay_HOP_CANT_DIAL_DST) - } - return - } - - // stop handshake - rd := newDelimitedReader(bs, maxMessageSize) - wr := newDelimitedWriter(bs) - defer rd.Close() - - // set handshake deadline - bs.SetDeadline(time.Now().Add(StopHandshakeTimeout)) - - msg.Type = pb.CircuitRelay_STOP.Enum() - - err = wr.WriteMsg(msg) - if err != nil { - log.Debugf("error writing stop handshake: %s", err.Error()) - bs.Reset() - r.handleError(s, pb.CircuitRelay_HOP_CANT_OPEN_DST_STREAM) - return - } - - msg.Reset() - - err = rd.ReadMsg(msg) - if err != nil { - log.Debugf("error reading stop response: %s", err.Error()) - bs.Reset() - r.handleError(s, pb.CircuitRelay_HOP_CANT_OPEN_DST_STREAM) - return - } - - if msg.GetType() != pb.CircuitRelay_STATUS { - log.Debugf("unexpected relay stop response: not a status message (%d)", msg.GetType()) - bs.Reset() - r.handleError(s, pb.CircuitRelay_HOP_CANT_OPEN_DST_STREAM) - return - } - - if msg.GetCode() != pb.CircuitRelay_SUCCESS { - log.Debugf("relay stop failure: %d", msg.GetCode()) - bs.Reset() - r.handleError(s, msg.GetCode()) - return - } - - err = r.writeResponse(s, pb.CircuitRelay_SUCCESS) - if err != nil { - log.Debugf("error writing relay response: %s", err.Error()) - bs.Reset() - s.Reset() - return - } - - // relay connection - log.Infof("relaying connection between %s and %s", src.ID.Pretty(), dst.ID.Pretty()) - - // reset deadline - bs.SetDeadline(time.Time{}) - - r.addLiveHop(src.ID, dst.ID) - - goroutines := new(int32) - *goroutines = 2 - done := func() { - if atomic.AddInt32(goroutines, -1) == 0 { - r.rmLiveHop(src.ID, dst.ID) - } - } - - // Don't reset streams after finishing or the other side will get an - // error, not an EOF. - go func() { - defer done() - - buf := pool.Get(HopStreamBufferSize) - defer pool.Put(buf) - - count, err := io.CopyBuffer(s, bs, buf) - if err != nil { - log.Debugf("relay copy error: %s", err) - // Reset both. - s.Reset() - bs.Reset() - } else { - // propagate the close - s.Close() - } - log.Debugf("relayed %d bytes from %s to %s", count, dst.ID.Pretty(), src.ID.Pretty()) - }() - - go func() { - defer done() - - buf := pool.Get(HopStreamBufferSize) - defer pool.Put(buf) - - count, err := io.CopyBuffer(bs, s, buf) - if err != nil { - log.Debugf("relay copy error: %s", err) - // Reset both. - bs.Reset() - s.Reset() - } else { - // propagate the close - bs.Close() - } - log.Debugf("relayed %d bytes from %s to %s", count, src.ID.Pretty(), dst.ID.Pretty()) - }() -} - -func (r *Relay) handleStopStream(s network.Stream, msg *pb.CircuitRelay) { - src, err := peerToPeerInfo(msg.GetSrcPeer()) - if err != nil { - r.handleError(s, pb.CircuitRelay_STOP_SRC_MULTIADDR_INVALID) - return - } - - dst, err := peerToPeerInfo(msg.GetDstPeer()) - if err != nil || dst.ID != r.self { - r.handleError(s, pb.CircuitRelay_STOP_DST_MULTIADDR_INVALID) - return - } - - log.Infof("relay connection from: %s", src.ID) - - if len(src.Addrs) > 0 { - r.host.Peerstore().AddAddrs(src.ID, src.Addrs, peerstore.TempAddrTTL) - } - - select { - case r.incoming <- &Conn{stream: s, remote: src, host: r.host}: - case <-time.After(RelayAcceptTimeout): - r.handleError(s, pb.CircuitRelay_STOP_RELAY_REFUSED) - } -} - -func (r *Relay) handleCanHop(s network.Stream, msg *pb.CircuitRelay) { - var err error - - if r.hop { - err = r.writeResponse(s, pb.CircuitRelay_SUCCESS) - } else { - err = r.writeResponse(s, pb.CircuitRelay_HOP_CANT_SPEAK_RELAY) - } - - if err != nil { - s.Reset() - log.Debugf("error writing relay response: %s", err.Error()) - } else { - helpers.FullClose(s) - } -} - -func (r *Relay) handleError(s network.Stream, code pb.CircuitRelay_Status) { - log.Warningf("relay error: %s (%d)", pb.CircuitRelay_Status_name[int32(code)], code) - err := r.writeResponse(s, code) - if err != nil { - s.Reset() - log.Debugf("error writing relay response: %s", err.Error()) - } else { - helpers.FullClose(s) - } -} - -func (r *Relay) writeResponse(s network.Stream, code pb.CircuitRelay_Status) error { - wr := newDelimitedWriter(s) - - var msg pb.CircuitRelay - msg.Type = pb.CircuitRelay_STATUS.Enum() - msg.Code = code.Enum() - - return wr.WriteMsg(&msg) -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/transport.go b/vendor/github.com/libp2p/go-libp2p-circuit/transport.go deleted file mode 100644 index 57a65779..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/transport.go +++ /dev/null @@ -1,81 +0,0 @@ -package relay - -import ( - "context" - "fmt" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/transport" - - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - ma "github.com/multiformats/go-multiaddr" -) - -const P_CIRCUIT = 290 - -var Protocol = ma.Protocol{ - Code: P_CIRCUIT, - Size: 0, - Name: "p2p-circuit", - VCode: ma.CodeToVarint(P_CIRCUIT), -} - -func init() { - ma.AddProtocol(Protocol) -} - -var _ transport.Transport = (*RelayTransport)(nil) - -type RelayTransport Relay - -func (t *RelayTransport) Relay() *Relay { - return (*Relay)(t) -} - -func (r *Relay) Transport() *RelayTransport { - return (*RelayTransport)(r) -} - -func (t *RelayTransport) Listen(laddr ma.Multiaddr) (transport.Listener, error) { - // TODO: Ensure we have a connection to the relay, if specified. Also, - // make sure the multiaddr makes sense. - if !t.Relay().Matches(laddr) { - return nil, fmt.Errorf("%s is not a relay address", laddr) - } - return t.upgrader.UpgradeListener(t, t.Relay().Listener()), nil -} - -func (t *RelayTransport) CanDial(raddr ma.Multiaddr) bool { - return t.Relay().Matches(raddr) -} - -func (t *RelayTransport) Proxy() bool { - return true -} - -func (t *RelayTransport) Protocols() []int { - return []int{P_CIRCUIT} -} - -// AddRelayTransport constructs a relay and adds it as a transport to the host network. -func AddRelayTransport(ctx context.Context, h host.Host, upgrader *tptu.Upgrader, opts ...RelayOpt) error { - n, ok := h.Network().(transport.TransportNetwork) - if !ok { - return fmt.Errorf("%v is not a transport network", h.Network()) - } - - r, err := NewRelay(ctx, h, upgrader, opts...) - if err != nil { - return err - } - - // There's no nice way to handle these errors as we have no way to tear - // down the relay. - // TODO - if err := n.AddTransport(r.Transport()); err != nil { - log.Error("failed to add relay transport:", err) - } else if err := n.Listen(r.Listener().Multiaddr()); err != nil { - log.Error("failed to listen on relay transport:", err) - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-circuit/util.go b/vendor/github.com/libp2p/go-libp2p-circuit/util.go deleted file mode 100644 index ca7a23f3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-circuit/util.go +++ /dev/null @@ -1,117 +0,0 @@ -package relay - -import ( - "encoding/binary" - "errors" - "io" - - pb "github.com/libp2p/go-libp2p-circuit/pb" - - "github.com/libp2p/go-libp2p-core/peer" - - ggio "github.com/gogo/protobuf/io" - proto "github.com/gogo/protobuf/proto" - pool "github.com/libp2p/go-buffer-pool" - ma "github.com/multiformats/go-multiaddr" -) - -func peerToPeerInfo(p *pb.CircuitRelay_Peer) (peer.AddrInfo, error) { - if p == nil { - return peer.AddrInfo{}, errors.New("nil peer") - } - - id, err := peer.IDFromBytes(p.Id) - if err != nil { - return peer.AddrInfo{}, err - } - - addrs := make([]ma.Multiaddr, 0, len(p.Addrs)) - for _, addrBytes := range p.Addrs { - a, err := ma.NewMultiaddrBytes(addrBytes) - if err == nil { - addrs = append(addrs, a) - } - } - - return peer.AddrInfo{ID: id, Addrs: addrs}, nil -} - -func peerInfoToPeer(pi peer.AddrInfo) *pb.CircuitRelay_Peer { - addrs := make([][]byte, len(pi.Addrs)) - for i, addr := range pi.Addrs { - addrs[i] = addr.Bytes() - } - - p := new(pb.CircuitRelay_Peer) - p.Id = []byte(pi.ID) - p.Addrs = addrs - - return p -} - -func incrementTag(v int) int { - return v + 1 -} - -func decrementTag(v int) int { - if v > 0 { - return v - 1 - } else { - return v - } -} - -type delimitedReader struct { - r io.Reader - buf []byte -} - -// The gogo protobuf NewDelimitedReader is buffered, which may eat up stream data. -// So we need to implement a compatible delimited reader that reads unbuffered. -// There is a slowdown from unbuffered reading: when reading the message -// it can take multiple single byte Reads to read the length and another Read -// to read the message payload. -// However, this is not critical performance degradation as -// - the reader is utilized to read one (dialer, stop) or two messages (hop) during -// the handshake, so it's a drop in the water for the connection lifetime. -// - messages are small (max 4k) and the length fits in a couple of bytes, -// so overall we have at most three reads per message. -func newDelimitedReader(r io.Reader, maxSize int) *delimitedReader { - return &delimitedReader{r: r, buf: pool.Get(maxSize)} -} - -func (d *delimitedReader) Close() { - if d.buf != nil { - pool.Put(d.buf) - d.buf = nil - } -} - -func (d *delimitedReader) ReadByte() (byte, error) { - buf := d.buf[:1] - _, err := d.r.Read(buf) - return buf[0], err -} - -func (d *delimitedReader) ReadMsg(msg proto.Message) error { - mlen, err := binary.ReadUvarint(d) - if err != nil { - return err - } - - if uint64(len(d.buf)) < mlen { - return errors.New("Message too large") - } - - buf := d.buf[:mlen] - _, err = io.ReadFull(d.r, buf) - if err != nil { - return err - } - - return proto.Unmarshal(buf, msg) -} - -func newDelimitedWriter(w io.Writer) ggio.WriteCloser { - return ggio.NewDelimitedWriter(w) -} diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/.travis.yml b/vendor/github.com/libp2p/go-libp2p-connmgr/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/LICENSE b/vendor/github.com/libp2p/go-libp2p-connmgr/LICENSE deleted file mode 100644 index 83f48ce5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Whyrusleeping - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/README.md b/vendor/github.com/libp2p/go-libp2p-connmgr/README.md deleted file mode 100644 index 3373fb26..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/README.md +++ /dev/null @@ -1,38 +0,0 @@ -go-libp2p-connmgr -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Travis CI](https://travis-ci.com/libp2p/go-libp2p-connmgr.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-connmgr) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - - -> A package to help manage connections in go-libp2p. - - -## Table of Contents - -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -go get github.com/libp2p/go-libp2p-connmgr -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Whyrusleeping - ---- - -The last gx published version of this module was: 0.3.34: QmSTKY2v62v9RjcfTMCFKMVAWvVjWGixkYWEi68iG7e1TT diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/codecov.yml b/vendor/github.com/libp2p/go-libp2p-connmgr/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/connmgr.go b/vendor/github.com/libp2p/go-libp2p-connmgr/connmgr.go deleted file mode 100644 index 0ee89017..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/connmgr.go +++ /dev/null @@ -1,476 +0,0 @@ -package connmgr - -import ( - "context" - "sort" - "sync" - "sync/atomic" - "time" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" - ma "github.com/multiformats/go-multiaddr" -) - -var SilencePeriod = 10 * time.Second - -var log = logging.Logger("connmgr") - -// BasicConnMgr is a ConnManager that trims connections whenever the count exceeds the -// high watermark. New connections are given a grace period before they're subject -// to trimming. Trims are automatically run on demand, only if the time from the -// previous trim is higher than 10 seconds. Furthermore, trims can be explicitly -// requested through the public interface of this struct (see TrimOpenConns). -// -// See configuration parameters in NewConnManager. -type BasicConnMgr struct { - highWater int - lowWater int - connCount int32 - gracePeriod time.Duration - segments segments - - plk sync.RWMutex - protected map[peer.ID]map[string]struct{} - - // channel-based semaphore that enforces only a single trim is in progress - trimRunningCh chan struct{} - lastTrim time.Time - silencePeriod time.Duration - - ctx context.Context - cancel func() -} - -var _ connmgr.ConnManager = (*BasicConnMgr)(nil) - -type segment struct { - sync.Mutex - peers map[peer.ID]*peerInfo -} - -type segments [256]*segment - -func (ss *segments) get(p peer.ID) *segment { - return ss[byte(p[len(p)-1])] -} - -func (ss *segments) countPeers() (count int) { - for _, seg := range ss { - seg.Lock() - count += len(seg.peers) - seg.Unlock() - } - return count -} - -func (s *segment) tagInfoFor(p peer.ID) *peerInfo { - pi, ok := s.peers[p] - if ok { - return pi - } - // create a temporary peer to buffer early tags before the Connected notification arrives. - pi = &peerInfo{ - id: p, - firstSeen: time.Now(), // this timestamp will be updated when the first Connected notification arrives. - temp: true, - tags: make(map[string]int), - conns: make(map[network.Conn]time.Time), - } - s.peers[p] = pi - return pi -} - -// NewConnManager creates a new BasicConnMgr with the provided params: -// * lo and hi are watermarks governing the number of connections that'll be maintained. -// When the peer count exceeds the 'high watermark', as many peers will be pruned (and -// their connections terminated) until 'low watermark' peers remain. -// * grace is the amount of time a newly opened connection is given before it becomes -// subject to pruning. -func NewConnManager(low, hi int, grace time.Duration) *BasicConnMgr { - ctx, cancel := context.WithCancel(context.Background()) - cm := &BasicConnMgr{ - highWater: hi, - lowWater: low, - gracePeriod: grace, - trimRunningCh: make(chan struct{}, 1), - protected: make(map[peer.ID]map[string]struct{}, 16), - silencePeriod: SilencePeriod, - ctx: ctx, - cancel: cancel, - segments: func() (ret segments) { - for i := range ret { - ret[i] = &segment{ - peers: make(map[peer.ID]*peerInfo), - } - } - return ret - }(), - } - - go cm.background() - return cm -} - -func (cm *BasicConnMgr) Close() error { - cm.cancel() - return nil -} - -func (cm *BasicConnMgr) Protect(id peer.ID, tag string) { - cm.plk.Lock() - defer cm.plk.Unlock() - - tags, ok := cm.protected[id] - if !ok { - tags = make(map[string]struct{}, 2) - cm.protected[id] = tags - } - tags[tag] = struct{}{} -} - -func (cm *BasicConnMgr) Unprotect(id peer.ID, tag string) (protected bool) { - cm.plk.Lock() - defer cm.plk.Unlock() - - tags, ok := cm.protected[id] - if !ok { - return false - } - if delete(tags, tag); len(tags) == 0 { - delete(cm.protected, id) - return false - } - return true -} - -// peerInfo stores metadata for a given peer. -type peerInfo struct { - id peer.ID - tags map[string]int // value for each tag - value int // cached sum of all tag values - temp bool // this is a temporary entry holding early tags, and awaiting connections - - conns map[network.Conn]time.Time // start time of each connection - - firstSeen time.Time // timestamp when we began tracking this peer. -} - -// TrimOpenConns closes the connections of as many peers as needed to make the peer count -// equal the low watermark. Peers are sorted in ascending order based on their total value, -// pruning those peers with the lowest scores first, as long as they are not within their -// grace period. -// -// TODO: error return value so we can cleanly signal we are aborting because: -// (a) there's another trim in progress, or (b) the silence period is in effect. -func (cm *BasicConnMgr) TrimOpenConns(ctx context.Context) { - select { - case cm.trimRunningCh <- struct{}{}: - default: - return - } - defer func() { <-cm.trimRunningCh }() - if time.Since(cm.lastTrim) < cm.silencePeriod { - // skip this attempt to trim as the last one just took place. - return - } - - defer log.EventBegin(ctx, "connCleanup").Done() - for _, c := range cm.getConnsToClose(ctx) { - log.Info("closing conn: ", c.RemotePeer()) - log.Event(ctx, "closeConn", c.RemotePeer()) - c.Close() - } - - cm.lastTrim = time.Now() -} - -func (cm *BasicConnMgr) background() { - ticker := time.NewTicker(time.Minute) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - if atomic.LoadInt32(&cm.connCount) > int32(cm.highWater) { - cm.TrimOpenConns(cm.ctx) - } - - case <-cm.ctx.Done(): - return - } - } -} - -// getConnsToClose runs the heuristics described in TrimOpenConns and returns the -// connections to close. -func (cm *BasicConnMgr) getConnsToClose(ctx context.Context) []network.Conn { - if cm.lowWater == 0 || cm.highWater == 0 { - // disabled - return nil - } - now := time.Now() - nconns := int(atomic.LoadInt32(&cm.connCount)) - if nconns <= cm.lowWater { - log.Info("open connection count below limit") - return nil - } - - npeers := cm.segments.countPeers() - candidates := make([]*peerInfo, 0, npeers) - cm.plk.RLock() - for _, s := range cm.segments { - s.Lock() - for id, inf := range s.peers { - if _, ok := cm.protected[id]; ok { - // skip over protected peer. - continue - } - candidates = append(candidates, inf) - } - s.Unlock() - } - cm.plk.RUnlock() - - // Sort peers according to their value. - sort.Slice(candidates, func(i, j int) bool { - left, right := candidates[i], candidates[j] - // temporary peers are preferred for pruning. - if left.temp != right.temp { - return left.temp - } - // otherwise, compare by value. - return left.value < right.value - }) - - target := nconns - cm.lowWater - - // slightly overallocate because we may have more than one conns per peer - selected := make([]network.Conn, 0, target+10) - - for _, inf := range candidates { - if target <= 0 { - break - } - // TODO: should we be using firstSeen or the time associated with the connection itself? - if inf.firstSeen.Add(cm.gracePeriod).After(now) { - continue - } - - // lock this to protect from concurrent modifications from connect/disconnect events - s := cm.segments.get(inf.id) - s.Lock() - - if len(inf.conns) == 0 && inf.temp { - // handle temporary entries for early tags -- this entry has gone past the grace period - // and still holds no connections, so prune it. - delete(s.peers, inf.id) - } else { - for c := range inf.conns { - selected = append(selected, c) - } - } - target -= len(inf.conns) - s.Unlock() - } - - return selected -} - -// GetTagInfo is called to fetch the tag information associated with a given -// peer, nil is returned if p refers to an unknown peer. -func (cm *BasicConnMgr) GetTagInfo(p peer.ID) *connmgr.TagInfo { - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - pi, ok := s.peers[p] - if !ok { - return nil - } - - out := &connmgr.TagInfo{ - FirstSeen: pi.firstSeen, - Value: pi.value, - Tags: make(map[string]int), - Conns: make(map[string]time.Time), - } - - for t, v := range pi.tags { - out.Tags[t] = v - } - for c, t := range pi.conns { - out.Conns[c.RemoteMultiaddr().String()] = t - } - - return out -} - -// TagPeer is called to associate a string and integer with a given peer. -func (cm *BasicConnMgr) TagPeer(p peer.ID, tag string, val int) { - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - pi := s.tagInfoFor(p) - - // Update the total value of the peer. - pi.value += val - pi.tags[tag] - pi.tags[tag] = val -} - -// UntagPeer is called to disassociate a string and integer from a given peer. -func (cm *BasicConnMgr) UntagPeer(p peer.ID, tag string) { - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - pi, ok := s.peers[p] - if !ok { - log.Info("tried to remove tag from untracked peer: ", p) - return - } - - // Update the total value of the peer. - pi.value -= pi.tags[tag] - delete(pi.tags, tag) -} - -// UpsertTag is called to insert/update a peer tag -func (cm *BasicConnMgr) UpsertTag(p peer.ID, tag string, upsert func(int) int) { - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - pi := s.tagInfoFor(p) - - oldval := pi.tags[tag] - newval := upsert(oldval) - pi.value += newval - oldval - pi.tags[tag] = newval -} - -// CMInfo holds the configuration for BasicConnMgr, as well as status data. -type CMInfo struct { - // The low watermark, as described in NewConnManager. - LowWater int - - // The high watermark, as described in NewConnManager. - HighWater int - - // The timestamp when the last trim was triggered. - LastTrim time.Time - - // The configured grace period, as described in NewConnManager. - GracePeriod time.Duration - - // The current connection count. - ConnCount int -} - -// GetInfo returns the configuration and status data for this connection manager. -func (cm *BasicConnMgr) GetInfo() CMInfo { - return CMInfo{ - HighWater: cm.highWater, - LowWater: cm.lowWater, - LastTrim: cm.lastTrim, - GracePeriod: cm.gracePeriod, - ConnCount: int(atomic.LoadInt32(&cm.connCount)), - } -} - -// Notifee returns a sink through which Notifiers can inform the BasicConnMgr when -// events occur. Currently, the notifee only reacts upon connection events -// {Connected, Disconnected}. -func (cm *BasicConnMgr) Notifee() network.Notifiee { - return (*cmNotifee)(cm) -} - -type cmNotifee BasicConnMgr - -func (nn *cmNotifee) cm() *BasicConnMgr { - return (*BasicConnMgr)(nn) -} - -// Connected is called by notifiers to inform that a new connection has been established. -// The notifee updates the BasicConnMgr to start tracking the connection. If the new connection -// count exceeds the high watermark, a trim may be triggered. -func (nn *cmNotifee) Connected(n network.Network, c network.Conn) { - cm := nn.cm() - - p := c.RemotePeer() - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - id := c.RemotePeer() - pinfo, ok := s.peers[id] - if !ok { - pinfo = &peerInfo{ - id: id, - firstSeen: time.Now(), - tags: make(map[string]int), - conns: make(map[network.Conn]time.Time), - } - s.peers[id] = pinfo - } else if pinfo.temp { - // we had created a temporary entry for this peer to buffer early tags before the - // Connected notification arrived: flip the temporary flag, and update the firstSeen - // timestamp to the real one. - pinfo.temp = false - pinfo.firstSeen = time.Now() - } - - _, ok = pinfo.conns[c] - if ok { - log.Error("received connected notification for conn we are already tracking: ", p) - return - } - - pinfo.conns[c] = time.Now() - atomic.AddInt32(&cm.connCount, 1) -} - -// Disconnected is called by notifiers to inform that an existing connection has been closed or terminated. -// The notifee updates the BasicConnMgr accordingly to stop tracking the connection, and performs housekeeping. -func (nn *cmNotifee) Disconnected(n network.Network, c network.Conn) { - cm := nn.cm() - - p := c.RemotePeer() - s := cm.segments.get(p) - s.Lock() - defer s.Unlock() - - cinf, ok := s.peers[p] - if !ok { - log.Error("received disconnected notification for peer we are not tracking: ", p) - return - } - - _, ok = cinf.conns[c] - if !ok { - log.Error("received disconnected notification for conn we are not tracking: ", p) - return - } - - delete(cinf.conns, c) - if len(cinf.conns) == 0 { - delete(s.peers, p) - } - atomic.AddInt32(&cm.connCount, -1) -} - -// Listen is no-op in this implementation. -func (nn *cmNotifee) Listen(n network.Network, addr ma.Multiaddr) {} - -// ListenClose is no-op in this implementation. -func (nn *cmNotifee) ListenClose(n network.Network, addr ma.Multiaddr) {} - -// OpenedStream is no-op in this implementation. -func (nn *cmNotifee) OpenedStream(network.Network, network.Stream) {} - -// ClosedStream is no-op in this implementation. -func (nn *cmNotifee) ClosedStream(network.Network, network.Stream) {} diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/go.mod b/vendor/github.com/libp2p/go-libp2p-connmgr/go.mod deleted file mode 100644 index 227a85dc..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-libp2p-connmgr - -require ( - github.com/ipfs/go-detect-race v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multiaddr v0.0.2 -) diff --git a/vendor/github.com/libp2p/go-libp2p-connmgr/go.sum b/vendor/github.com/libp2p/go-libp2p-connmgr/go.sum deleted file mode 100644 index 663f0401..00000000 --- a/vendor/github.com/libp2p/go-libp2p-connmgr/go.sum +++ /dev/null @@ -1,90 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-core/connmgr/connmgr.go b/vendor/github.com/libp2p/go-libp2p-core/connmgr/connmgr.go deleted file mode 100644 index 98baf8b9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/connmgr/connmgr.go +++ /dev/null @@ -1,78 +0,0 @@ -// Package connmgr provides connection tracking and management interfaces for libp2p. -// -// The ConnManager interface exported from this package allows libp2p to enforce an -// upper bound on the total number of open connections. To avoid service disruptions, -// connections can be tagged with metadata and optionally "protected" to ensure that -// essential connections are not arbitrarily cut. -package connmgr - -import ( - "context" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" -) - -// ConnManager tracks connections to peers, and allows consumers to associate metadata -// with each peer. -// -// It enables connections to be trimmed based on implementation-defined heuristics. -// The ConnManager allows libp2p to enforce an upper bound on the total number of -// open connections. -type ConnManager interface { - - // TagPeer tags a peer with a string, associating a weight with the tag. - TagPeer(peer.ID, string, int) - - // Untag removes the tagged value from the peer. - UntagPeer(p peer.ID, tag string) - - // UpsertTag updates an existing tag or inserts a new one. - // - // The connection manager calls the upsert function supplying the current - // value of the tag (or zero if inexistent). The return value is used as - // the new value of the tag. - UpsertTag(p peer.ID, tag string, upsert func(int) int) - - // GetTagInfo returns the metadata associated with the peer, - // or nil if no metadata has been recorded for the peer. - GetTagInfo(p peer.ID) *TagInfo - - // TrimOpenConns terminates open connections based on an implementation-defined - // heuristic. - TrimOpenConns(ctx context.Context) - - // Notifee returns an implementation that can be called back to inform of - // opened and closed connections. - Notifee() network.Notifiee - - // Protect protects a peer from having its connection(s) pruned. - // - // Tagging allows different parts of the system to manage protections without interfering with one another. - // - // Calls to Protect() with the same tag are idempotent. They are not refcounted, so after multiple calls - // to Protect() with the same tag, a single Unprotect() call bearing the same tag will revoke the protection. - Protect(id peer.ID, tag string) - - // Unprotect removes a protection that may have been placed on a peer, under the specified tag. - // - // The return value indicates whether the peer continues to be protected after this call, by way of a different tag. - // See notes on Protect() for more info. - Unprotect(id peer.ID, tag string) (protected bool) - - // Close closes the connection manager and stops background processes - Close() error -} - -// TagInfo stores metadata associated with a peer. -type TagInfo struct { - FirstSeen time.Time - Value int - - // Tags maps tag ids to the numerical values. - Tags map[string]int - - // Conns maps connection ids (such as remote multiaddr) to their creation time. - Conns map[string]time.Time -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/connmgr/null.go b/vendor/github.com/libp2p/go-libp2p-core/connmgr/null.go deleted file mode 100644 index 473af328..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/connmgr/null.go +++ /dev/null @@ -1,23 +0,0 @@ -package connmgr - -import ( - "context" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" -) - -// NullConnMgr is a ConnMgr that provides no functionality. -type NullConnMgr struct{} - -var _ ConnManager = (*NullConnMgr)(nil) - -func (_ NullConnMgr) TagPeer(peer.ID, string, int) {} -func (_ NullConnMgr) UntagPeer(peer.ID, string) {} -func (_ NullConnMgr) UpsertTag(peer.ID, string, func(int) int) {} -func (_ NullConnMgr) GetTagInfo(peer.ID) *TagInfo { return &TagInfo{} } -func (_ NullConnMgr) TrimOpenConns(ctx context.Context) {} -func (_ NullConnMgr) Notifee() network.Notifiee { return network.GlobalNoopNotifiee } -func (_ NullConnMgr) Protect(peer.ID, string) {} -func (_ NullConnMgr) Unprotect(peer.ID, string) bool { return false } -func (_ NullConnMgr) Close() error { return nil } diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/ecdsa.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/ecdsa.go deleted file mode 100644 index 58e5d5f5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/ecdsa.go +++ /dev/null @@ -1,186 +0,0 @@ -package crypto - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/x509" - "encoding/asn1" - "errors" - "io" - "math/big" - - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - sha256 "github.com/minio/sha256-simd" -) - -// ECDSAPrivateKey is an implementation of an ECDSA private key -type ECDSAPrivateKey struct { - priv *ecdsa.PrivateKey -} - -// ECDSAPublicKey is an implementation of an ECDSA public key -type ECDSAPublicKey struct { - pub *ecdsa.PublicKey -} - -// ECDSASig holds the r and s values of an ECDSA signature -type ECDSASig struct { - R, S *big.Int -} - -var ( - // ErrNotECDSAPubKey is returned when the public key passed is not an ecdsa public key - ErrNotECDSAPubKey = errors.New("not an ecdsa public key") - // ErrNilSig is returned when the signature is nil - ErrNilSig = errors.New("sig is nil") - // ErrNilPrivateKey is returned when a nil private key is provided - ErrNilPrivateKey = errors.New("private key is nil") - // ECDSACurve is the default ecdsa curve used - ECDSACurve = elliptic.P256() -) - -// GenerateECDSAKeyPair generates a new ecdsa private and public key -func GenerateECDSAKeyPair(src io.Reader) (PrivKey, PubKey, error) { - return GenerateECDSAKeyPairWithCurve(ECDSACurve, src) -} - -// GenerateECDSAKeyPairWithCurve generates a new ecdsa private and public key with a speicified curve -func GenerateECDSAKeyPairWithCurve(curve elliptic.Curve, src io.Reader) (PrivKey, PubKey, error) { - priv, err := ecdsa.GenerateKey(curve, src) - if err != nil { - return nil, nil, err - } - - return &ECDSAPrivateKey{priv}, &ECDSAPublicKey{&priv.PublicKey}, nil -} - -// ECDSAKeyPairFromKey generates a new ecdsa private and public key from an input private key -func ECDSAKeyPairFromKey(priv *ecdsa.PrivateKey) (PrivKey, PubKey, error) { - if priv == nil { - return nil, nil, ErrNilPrivateKey - } - - return &ECDSAPrivateKey{priv}, &ECDSAPublicKey{&priv.PublicKey}, nil -} - -// MarshalECDSAPrivateKey returns x509 bytes from a private key -func MarshalECDSAPrivateKey(ePriv ECDSAPrivateKey) ([]byte, error) { - return x509.MarshalECPrivateKey(ePriv.priv) -} - -// MarshalECDSAPublicKey returns x509 bytes from a public key -func MarshalECDSAPublicKey(ePub ECDSAPublicKey) ([]byte, error) { - return x509.MarshalPKIXPublicKey(ePub.pub) -} - -// UnmarshalECDSAPrivateKey returns a private key from x509 bytes -func UnmarshalECDSAPrivateKey(data []byte) (PrivKey, error) { - priv, err := x509.ParseECPrivateKey(data) - if err != nil { - return nil, err - } - - return &ECDSAPrivateKey{priv}, nil -} - -// UnmarshalECDSAPublicKey returns the public key from x509 bytes -func UnmarshalECDSAPublicKey(data []byte) (PubKey, error) { - pubIfc, err := x509.ParsePKIXPublicKey(data) - if err != nil { - return nil, err - } - - pub, ok := pubIfc.(*ecdsa.PublicKey) - if !ok { - return nil, ErrNotECDSAPubKey - } - - return &ECDSAPublicKey{pub}, nil -} - -// Bytes returns the private key as protobuf bytes -func (ePriv *ECDSAPrivateKey) Bytes() ([]byte, error) { - return MarshalPrivateKey(ePriv) -} - -// Type returns the key type -func (ePriv *ECDSAPrivateKey) Type() pb.KeyType { - return pb.KeyType_ECDSA -} - -// Raw returns x509 bytes from a private key -func (ePriv *ECDSAPrivateKey) Raw() ([]byte, error) { - return x509.MarshalECPrivateKey(ePriv.priv) -} - -// Equals compares to private keys -func (ePriv *ECDSAPrivateKey) Equals(o Key) bool { - oPriv, ok := o.(*ECDSAPrivateKey) - if !ok { - return false - } - - return ePriv.priv.D.Cmp(oPriv.priv.D) == 0 -} - -// Sign returns the signature of the input data -func (ePriv *ECDSAPrivateKey) Sign(data []byte) ([]byte, error) { - hash := sha256.Sum256(data) - r, s, err := ecdsa.Sign(rand.Reader, ePriv.priv, hash[:]) - if err != nil { - return nil, err - } - - return asn1.Marshal(ECDSASig{ - R: r, - S: s, - }) -} - -// GetPublic returns a public key -func (ePriv *ECDSAPrivateKey) GetPublic() PubKey { - return &ECDSAPublicKey{&ePriv.priv.PublicKey} -} - -// Bytes returns the public key as protobuf bytes -func (ePub *ECDSAPublicKey) Bytes() ([]byte, error) { - return MarshalPublicKey(ePub) -} - -// Type returns the key type -func (ePub *ECDSAPublicKey) Type() pb.KeyType { - return pb.KeyType_ECDSA -} - -// Raw returns x509 bytes from a public key -func (ePub ECDSAPublicKey) Raw() ([]byte, error) { - return x509.MarshalPKIXPublicKey(ePub.pub) -} - -// Equals compares to public keys -func (ePub *ECDSAPublicKey) Equals(o Key) bool { - oPub, ok := o.(*ECDSAPublicKey) - if !ok { - return false - } - - return ePub.pub.X != nil && ePub.pub.Y != nil && oPub.pub.X != nil && oPub.pub.Y != nil && - 0 == ePub.pub.X.Cmp(oPub.pub.X) && 0 == ePub.pub.Y.Cmp(oPub.pub.Y) -} - -// Verify compares data to a signature -func (ePub *ECDSAPublicKey) Verify(data, sigBytes []byte) (bool, error) { - sig := new(ECDSASig) - if _, err := asn1.Unmarshal(sigBytes, sig); err != nil { - return false, err - } - if sig == nil { - return false, ErrNilSig - } - - hash := sha256.Sum256(data) - - return ecdsa.Verify(ePub.pub, hash[:], sig.R, sig.S), nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/ed25519.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/ed25519.go deleted file mode 100644 index b6e55314..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/ed25519.go +++ /dev/null @@ -1,155 +0,0 @@ -package crypto - -import ( - "bytes" - "errors" - "fmt" - "io" - - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - "golang.org/x/crypto/ed25519" -) - -// Ed25519PrivateKey is an ed25519 private key. -type Ed25519PrivateKey struct { - k ed25519.PrivateKey -} - -// Ed25519PublicKey is an ed25519 public key. -type Ed25519PublicKey struct { - k ed25519.PublicKey -} - -// GenerateEd25519Key generates a new ed25519 private and public key pair. -func GenerateEd25519Key(src io.Reader) (PrivKey, PubKey, error) { - pub, priv, err := ed25519.GenerateKey(src) - if err != nil { - return nil, nil, err - } - - return &Ed25519PrivateKey{ - k: priv, - }, - &Ed25519PublicKey{ - k: pub, - }, - nil -} - -// Type of the private key (Ed25519). -func (k *Ed25519PrivateKey) Type() pb.KeyType { - return pb.KeyType_Ed25519 -} - -// Bytes marshals an ed25519 private key to protobuf bytes. -func (k *Ed25519PrivateKey) Bytes() ([]byte, error) { - return MarshalPrivateKey(k) -} - -// Raw private key bytes. -func (k *Ed25519PrivateKey) Raw() ([]byte, error) { - // The Ed25519 private key contains two 32-bytes curve points, the private - // key and the public key. - // It makes it more efficient to get the public key without re-computing an - // elliptic curve multiplication. - buf := make([]byte, len(k.k)) - copy(buf, k.k) - - return buf, nil -} - -func (k *Ed25519PrivateKey) pubKeyBytes() []byte { - return k.k[ed25519.PrivateKeySize-ed25519.PublicKeySize:] -} - -// Equals compares two ed25519 private keys. -func (k *Ed25519PrivateKey) Equals(o Key) bool { - edk, ok := o.(*Ed25519PrivateKey) - if !ok { - return false - } - - return bytes.Equal(k.k, edk.k) -} - -// GetPublic returns an ed25519 public key from a private key. -func (k *Ed25519PrivateKey) GetPublic() PubKey { - return &Ed25519PublicKey{k: k.pubKeyBytes()} -} - -// Sign returns a signature from an input message. -func (k *Ed25519PrivateKey) Sign(msg []byte) ([]byte, error) { - return ed25519.Sign(k.k, msg), nil -} - -// Type of the public key (Ed25519). -func (k *Ed25519PublicKey) Type() pb.KeyType { - return pb.KeyType_Ed25519 -} - -// Bytes returns a ed25519 public key as protobuf bytes. -func (k *Ed25519PublicKey) Bytes() ([]byte, error) { - return MarshalPublicKey(k) -} - -// Raw public key bytes. -func (k *Ed25519PublicKey) Raw() ([]byte, error) { - return k.k, nil -} - -// Equals compares two ed25519 public keys. -func (k *Ed25519PublicKey) Equals(o Key) bool { - edk, ok := o.(*Ed25519PublicKey) - if !ok { - return false - } - - return bytes.Equal(k.k, edk.k) -} - -// Verify checks a signature agains the input data. -func (k *Ed25519PublicKey) Verify(data []byte, sig []byte) (bool, error) { - return ed25519.Verify(k.k, data, sig), nil -} - -// UnmarshalEd25519PublicKey returns a public key from input bytes. -func UnmarshalEd25519PublicKey(data []byte) (PubKey, error) { - if len(data) != 32 { - return nil, errors.New("expect ed25519 public key data size to be 32") - } - - return &Ed25519PublicKey{ - k: ed25519.PublicKey(data), - }, nil -} - -// UnmarshalEd25519PrivateKey returns a private key from input bytes. -func UnmarshalEd25519PrivateKey(data []byte) (PrivKey, error) { - switch len(data) { - case ed25519.PrivateKeySize + ed25519.PublicKeySize: - // Remove the redundant public key. See issue #36. - redundantPk := data[ed25519.PrivateKeySize:] - pk := data[ed25519.PrivateKeySize-ed25519.PublicKeySize : ed25519.PrivateKeySize] - if !bytes.Equal(pk, redundantPk) { - return nil, errors.New("expected redundant ed25519 public key to be redundant") - } - - // No point in storing the extra data. - newKey := make([]byte, ed25519.PrivateKeySize) - copy(newKey, data[:ed25519.PrivateKeySize]) - data = newKey - case ed25519.PrivateKeySize: - default: - return nil, fmt.Errorf( - "expected ed25519 data size to be %d or %d, got %d", - ed25519.PrivateKeySize, - ed25519.PrivateKeySize+ed25519.PublicKeySize, - len(data), - ) - } - - return &Ed25519PrivateKey{ - k: ed25519.PrivateKey(data), - }, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/key.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/key.go deleted file mode 100644 index 50167dbe..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/key.go +++ /dev/null @@ -1,351 +0,0 @@ -// Package crypto implements various cryptographic utilities used by libp2p. -// This includes a Public and Private key interface and key implementations -// for supported key algorithms. -package crypto - -import ( - "bytes" - "crypto/elliptic" - "crypto/hmac" - "crypto/rand" - "crypto/sha1" - "crypto/sha512" - "encoding/base64" - "errors" - "fmt" - "hash" - "io" - - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - "github.com/gogo/protobuf/proto" - sha256 "github.com/minio/sha256-simd" -) - -const ( - // RSA is an enum for the supported RSA key type - RSA = iota - // Ed25519 is an enum for the supported Ed25519 key type - Ed25519 - // Secp256k1 is an enum for the supported Secp256k1 key type - Secp256k1 - // ECDSA is an enum for the supported ECDSA key type - ECDSA -) - -var ( - // ErrBadKeyType is returned when a key is not supported - ErrBadKeyType = errors.New("invalid or unsupported key type") - // KeyTypes is a list of supported keys - KeyTypes = []int{ - RSA, - Ed25519, - Secp256k1, - ECDSA, - } -) - -// PubKeyUnmarshaller is a func that creates a PubKey from a given slice of bytes -type PubKeyUnmarshaller func(data []byte) (PubKey, error) - -// PrivKeyUnmarshaller is a func that creates a PrivKey from a given slice of bytes -type PrivKeyUnmarshaller func(data []byte) (PrivKey, error) - -// PubKeyUnmarshallers is a map of unmarshallers by key type -var PubKeyUnmarshallers = map[pb.KeyType]PubKeyUnmarshaller{ - pb.KeyType_RSA: UnmarshalRsaPublicKey, - pb.KeyType_Ed25519: UnmarshalEd25519PublicKey, - pb.KeyType_Secp256k1: UnmarshalSecp256k1PublicKey, - pb.KeyType_ECDSA: UnmarshalECDSAPublicKey, -} - -// PrivKeyUnmarshallers is a map of unmarshallers by key type -var PrivKeyUnmarshallers = map[pb.KeyType]PrivKeyUnmarshaller{ - pb.KeyType_RSA: UnmarshalRsaPrivateKey, - pb.KeyType_Ed25519: UnmarshalEd25519PrivateKey, - pb.KeyType_Secp256k1: UnmarshalSecp256k1PrivateKey, - pb.KeyType_ECDSA: UnmarshalECDSAPrivateKey, -} - -// Key represents a crypto key that can be compared to another key -type Key interface { - // Bytes returns a serialized, storeable representation of this key - // DEPRECATED in favor of Marshal / Unmarshal - Bytes() ([]byte, error) - - // Equals checks whether two PubKeys are the same - Equals(Key) bool - - // Raw returns the raw bytes of the key (not wrapped in the - // libp2p-crypto protobuf). - // - // This function is the inverse of {Priv,Pub}KeyUnmarshaler. - Raw() ([]byte, error) - - // Type returns the protobof key type. - Type() pb.KeyType -} - -// PrivKey represents a private key that can be used to generate a public key and sign data -type PrivKey interface { - Key - - // Cryptographically sign the given bytes - Sign([]byte) ([]byte, error) - - // Return a public key paired with this private key - GetPublic() PubKey -} - -// PubKey is a public key that can be used to verifiy data signed with the corresponding private key -type PubKey interface { - Key - - // Verify that 'sig' is the signed hash of 'data' - Verify(data []byte, sig []byte) (bool, error) -} - -// GenSharedKey generates the shared key from a given private key -type GenSharedKey func([]byte) ([]byte, error) - -// GenerateKeyPair generates a private and public key -func GenerateKeyPair(typ, bits int) (PrivKey, PubKey, error) { - return GenerateKeyPairWithReader(typ, bits, rand.Reader) -} - -// GenerateKeyPairWithReader returns a keypair of the given type and bitsize -func GenerateKeyPairWithReader(typ, bits int, src io.Reader) (PrivKey, PubKey, error) { - switch typ { - case RSA: - return GenerateRSAKeyPair(bits, src) - case Ed25519: - return GenerateEd25519Key(src) - case Secp256k1: - return GenerateSecp256k1Key(src) - case ECDSA: - return GenerateECDSAKeyPair(src) - default: - return nil, nil, ErrBadKeyType - } -} - -// GenerateEKeyPair returns an ephemeral public key and returns a function that will compute -// the shared secret key. Used in the identify module. -// -// Focuses only on ECDH now, but can be made more general in the future. -func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) { - var curve elliptic.Curve - - switch curveName { - case "P-256": - curve = elliptic.P256() - case "P-384": - curve = elliptic.P384() - case "P-521": - curve = elliptic.P521() - } - - priv, x, y, err := elliptic.GenerateKey(curve, rand.Reader) - if err != nil { - return nil, nil, err - } - - pubKey := elliptic.Marshal(curve, x, y) - - done := func(theirPub []byte) ([]byte, error) { - // Verify and unpack node's public key. - x, y := elliptic.Unmarshal(curve, theirPub) - if x == nil { - return nil, fmt.Errorf("malformed public key: %d %v", len(theirPub), theirPub) - } - - if !curve.IsOnCurve(x, y) { - return nil, errors.New("invalid public key") - } - - // Generate shared secret. - secret, _ := curve.ScalarMult(x, y, priv) - - return secret.Bytes(), nil - } - - return pubKey, done, nil -} - -// StretchedKeys ... -type StretchedKeys struct { - IV []byte - MacKey []byte - CipherKey []byte -} - -// KeyStretcher returns a set of keys for each party by stretching the shared key. -// (myIV, theirIV, myCipherKey, theirCipherKey, myMACKey, theirMACKey) -func KeyStretcher(cipherType string, hashType string, secret []byte) (StretchedKeys, StretchedKeys) { - var cipherKeySize int - var ivSize int - switch cipherType { - case "AES-128": - ivSize = 16 - cipherKeySize = 16 - case "AES-256": - ivSize = 16 - cipherKeySize = 32 - case "Blowfish": - ivSize = 8 - // Note: cypherKeySize arbitrarily selected, needs more thought - cipherKeySize = 32 - } - - hmacKeySize := 20 - - seed := []byte("key expansion") - - result := make([]byte, 2*(ivSize+cipherKeySize+hmacKeySize)) - - var h func() hash.Hash - - switch hashType { - case "SHA1": - h = sha1.New - case "SHA256": - h = sha256.New - case "SHA512": - h = sha512.New - default: - panic("Unrecognized hash function, programmer error?") - } - - m := hmac.New(h, secret) - // note: guaranteed to never return an error - m.Write(seed) - - a := m.Sum(nil) - - j := 0 - for j < len(result) { - m.Reset() - - // note: guaranteed to never return an error. - m.Write(a) - m.Write(seed) - - b := m.Sum(nil) - - todo := len(b) - - if j+todo > len(result) { - todo = len(result) - j - } - - copy(result[j:j+todo], b) - - j += todo - - m.Reset() - - // note: guaranteed to never return an error. - m.Write(a) - - a = m.Sum(nil) - } - - half := len(result) / 2 - r1 := result[:half] - r2 := result[half:] - - var k1 StretchedKeys - var k2 StretchedKeys - - k1.IV = r1[0:ivSize] - k1.CipherKey = r1[ivSize : ivSize+cipherKeySize] - k1.MacKey = r1[ivSize+cipherKeySize:] - - k2.IV = r2[0:ivSize] - k2.CipherKey = r2[ivSize : ivSize+cipherKeySize] - k2.MacKey = r2[ivSize+cipherKeySize:] - - return k1, k2 -} - -// UnmarshalPublicKey converts a protobuf serialized public key into its -// representative object -func UnmarshalPublicKey(data []byte) (PubKey, error) { - pmes := new(pb.PublicKey) - err := proto.Unmarshal(data, pmes) - if err != nil { - return nil, err - } - - um, ok := PubKeyUnmarshallers[pmes.GetType()] - if !ok { - return nil, ErrBadKeyType - } - - return um(pmes.GetData()) -} - -// MarshalPublicKey converts a public key object into a protobuf serialized -// public key -func MarshalPublicKey(k PubKey) ([]byte, error) { - pbmes := new(pb.PublicKey) - pbmes.Type = k.Type() - data, err := k.Raw() - if err != nil { - return nil, err - } - pbmes.Data = data - - return proto.Marshal(pbmes) -} - -// UnmarshalPrivateKey converts a protobuf serialized private key into its -// representative object -func UnmarshalPrivateKey(data []byte) (PrivKey, error) { - pmes := new(pb.PrivateKey) - err := proto.Unmarshal(data, pmes) - if err != nil { - return nil, err - } - - um, ok := PrivKeyUnmarshallers[pmes.GetType()] - if !ok { - return nil, ErrBadKeyType - } - - return um(pmes.GetData()) -} - -// MarshalPrivateKey converts a key object into its protobuf serialized form. -func MarshalPrivateKey(k PrivKey) ([]byte, error) { - pbmes := new(pb.PrivateKey) - pbmes.Type = k.Type() - data, err := k.Raw() - if err != nil { - return nil, err - } - - pbmes.Data = data - return proto.Marshal(pbmes) -} - -// ConfigDecodeKey decodes from b64 (for config file), and unmarshals. -func ConfigDecodeKey(b string) ([]byte, error) { - return base64.StdEncoding.DecodeString(b) -} - -// ConfigEncodeKey encodes to b64 (for config file), and marshals. -func ConfigEncodeKey(b []byte) string { - return base64.StdEncoding.EncodeToString(b) -} - -// KeyEqual checks whether two Keys are equivalent (have identical byte representations). -func KeyEqual(k1, k2 Key) bool { - if k1 == k2 { - return true - } - - b1, err1 := k1.Bytes() - b2, err2 := k2.Bytes() - return bytes.Equal(b1, b2) && err1 == err2 -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/openssl_common.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/openssl_common.go deleted file mode 100644 index f235e75f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/openssl_common.go +++ /dev/null @@ -1,98 +0,0 @@ -// +build openssl - -package crypto - -import ( - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - openssl "github.com/spacemonkeygo/openssl" -) - -// define these as separate types so we can add more key types later and reuse -// code. - -type opensslPublicKey struct { - key openssl.PublicKey -} - -type opensslPrivateKey struct { - key openssl.PrivateKey -} - -func unmarshalOpensslPrivateKey(b []byte) (opensslPrivateKey, error) { - sk, err := openssl.LoadPrivateKeyFromDER(b) - if err != nil { - return opensslPrivateKey{}, err - } - return opensslPrivateKey{sk}, nil -} - -func unmarshalOpensslPublicKey(b []byte) (opensslPublicKey, error) { - sk, err := openssl.LoadPublicKeyFromDER(b) - if err != nil { - return opensslPublicKey{}, err - } - return opensslPublicKey{sk}, nil -} - -// Verify compares a signature against input data -func (pk *opensslPublicKey) Verify(data, sig []byte) (bool, error) { - err := pk.key.VerifyPKCS1v15(openssl.SHA256_Method, data, sig) - return err == nil, err -} - -func (pk *opensslPublicKey) Type() pb.KeyType { - switch pk.key.KeyType() { - case openssl.KeyTypeRSA: - return pb.KeyType_RSA - default: - return -1 - } -} - -// Bytes returns protobuf bytes of a public key -func (pk *opensslPublicKey) Bytes() ([]byte, error) { - return MarshalPublicKey(pk) -} - -func (pk *opensslPublicKey) Raw() ([]byte, error) { - return pk.key.MarshalPKIXPublicKeyDER() -} - -// Equals checks whether this key is equal to another -func (pk *opensslPublicKey) Equals(k Key) bool { - return KeyEqual(pk, k) -} - -// Sign returns a signature of the input data -func (sk *opensslPrivateKey) Sign(message []byte) ([]byte, error) { - return sk.key.SignPKCS1v15(openssl.SHA256_Method, message) -} - -// GetPublic returns a public key -func (sk *opensslPrivateKey) GetPublic() PubKey { - return &opensslPublicKey{sk.key} -} - -func (sk *opensslPrivateKey) Type() pb.KeyType { - switch sk.key.KeyType() { - case openssl.KeyTypeRSA: - return pb.KeyType_RSA - default: - return -1 - } -} - -// Bytes returns protobuf bytes from a private key -func (sk *opensslPrivateKey) Bytes() ([]byte, error) { - return MarshalPrivateKey(sk) -} - -func (sk *opensslPrivateKey) Raw() ([]byte, error) { - return sk.key.MarshalPKCS1PrivateKeyDER() -} - -// Equals checks whether this key is equal to another -func (sk *opensslPrivateKey) Equals(k Key) bool { - return KeyEqual(sk, k) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/Makefile deleted file mode 100644 index df34e54b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.pb.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.pb.go deleted file mode 100644 index 5fa7aec7..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.pb.go +++ /dev/null @@ -1,643 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crypto.proto - -package crypto_pb - -import ( - fmt "fmt" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type KeyType int32 - -const ( - KeyType_RSA KeyType = 0 - KeyType_Ed25519 KeyType = 1 - KeyType_Secp256k1 KeyType = 2 - KeyType_ECDSA KeyType = 3 -) - -var KeyType_name = map[int32]string{ - 0: "RSA", - 1: "Ed25519", - 2: "Secp256k1", - 3: "ECDSA", -} - -var KeyType_value = map[string]int32{ - "RSA": 0, - "Ed25519": 1, - "Secp256k1": 2, - "ECDSA": 3, -} - -func (x KeyType) Enum() *KeyType { - p := new(KeyType) - *p = x - return p -} - -func (x KeyType) String() string { - return proto.EnumName(KeyType_name, int32(x)) -} - -func (x *KeyType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(KeyType_value, data, "KeyType") - if err != nil { - return err - } - *x = KeyType(value) - return nil -} - -func (KeyType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{0} -} - -type PublicKey struct { - Type KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type"` - Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` -} - -func (m *PublicKey) Reset() { *m = PublicKey{} } -func (m *PublicKey) String() string { return proto.CompactTextString(m) } -func (*PublicKey) ProtoMessage() {} -func (*PublicKey) Descriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{0} -} -func (m *PublicKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PublicKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PublicKey.Merge(m, src) -} -func (m *PublicKey) XXX_Size() int { - return m.Size() -} -func (m *PublicKey) XXX_DiscardUnknown() { - xxx_messageInfo_PublicKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PublicKey proto.InternalMessageInfo - -func (m *PublicKey) GetType() KeyType { - if m != nil { - return m.Type - } - return KeyType_RSA -} - -func (m *PublicKey) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -type PrivateKey struct { - Type KeyType `protobuf:"varint,1,req,name=Type,enum=crypto.pb.KeyType" json:"Type"` - Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data"` -} - -func (m *PrivateKey) Reset() { *m = PrivateKey{} } -func (m *PrivateKey) String() string { return proto.CompactTextString(m) } -func (*PrivateKey) ProtoMessage() {} -func (*PrivateKey) Descriptor() ([]byte, []int) { - return fileDescriptor_527278fb02d03321, []int{1} -} -func (m *PrivateKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivateKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivateKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PrivateKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivateKey.Merge(m, src) -} -func (m *PrivateKey) XXX_Size() int { - return m.Size() -} -func (m *PrivateKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivateKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivateKey proto.InternalMessageInfo - -func (m *PrivateKey) GetType() KeyType { - if m != nil { - return m.Type - } - return KeyType_RSA -} - -func (m *PrivateKey) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func init() { - proto.RegisterEnum("crypto.pb.KeyType", KeyType_name, KeyType_value) - proto.RegisterType((*PublicKey)(nil), "crypto.pb.PublicKey") - proto.RegisterType((*PrivateKey)(nil), "crypto.pb.PrivateKey") -} - -func init() { proto.RegisterFile("crypto.proto", fileDescriptor_527278fb02d03321) } - -var fileDescriptor_527278fb02d03321 = []byte{ - // 203 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0xf1, 0x92, 0x94, 0x82, 0xb9, - 0x38, 0x03, 0x4a, 0x93, 0x72, 0x32, 0x93, 0xbd, 0x53, 0x2b, 0x85, 0x74, 0xb8, 0x58, 0x42, 0x2a, - 0x0b, 0x52, 0x25, 0x18, 0x15, 0x98, 0x34, 0xf8, 0x8c, 0x84, 0xf4, 0xe0, 0xca, 0xf4, 0xbc, 0x53, - 0x2b, 0x41, 0x32, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x81, 0x55, 0x09, 0x49, 0x70, 0xb1, - 0xb8, 0x24, 0x96, 0x24, 0x4a, 0x30, 0x29, 0x30, 0x69, 0xf0, 0xc0, 0x64, 0x40, 0x22, 0x4a, 0x21, - 0x5c, 0x5c, 0x01, 0x45, 0x99, 0x65, 0x89, 0x25, 0xa9, 0x54, 0x34, 0x55, 0xcb, 0x92, 0x8b, 0x1d, - 0xaa, 0x41, 0x88, 0x9d, 0x8b, 0x39, 0x28, 0xd8, 0x51, 0x80, 0x41, 0x88, 0x9b, 0x8b, 0xdd, 0x35, - 0xc5, 0xc8, 0xd4, 0xd4, 0xd0, 0x52, 0x80, 0x51, 0x88, 0x97, 0x8b, 0x33, 0x38, 0x35, 0xb9, 0xc0, - 0xc8, 0xd4, 0x2c, 0xdb, 0x50, 0x80, 0x49, 0x88, 0x93, 0x8b, 0xd5, 0xd5, 0xd9, 0x25, 0xd8, 0x51, - 0x80, 0xd9, 0x49, 0xe2, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, - 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0x00, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x13, 0xbe, 0xd4, 0xff, 0x19, 0x01, 0x00, 0x00, -} - -func (m *PublicKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) - if m.Data != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - return i, nil -} - -func (m *PrivateKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(m.Type)) - if m.Data != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintCrypto(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - return i, nil -} - -func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *PublicKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCrypto(uint64(m.Type)) - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovCrypto(uint64(l)) - } - return n -} - -func (m *PrivateKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCrypto(uint64(m.Type)) - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovCrypto(uint64(l)) - } - return n -} - -func sovCrypto(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozCrypto(x uint64) (n int) { - return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PublicKey) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= KeyType(b&0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCrypto - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCrypto - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipCrypto(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivateKey) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrivateKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivateKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= KeyType(b&0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCrypto - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCrypto - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthCrypto - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipCrypto(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCrypto - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Type") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Data") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCrypto(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCrypto - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthCrypto - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCrypto - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCrypto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthCrypto - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.proto b/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.proto deleted file mode 100644 index cb5cee8a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/pb/crypto.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto2"; - -package crypto.pb; - -enum KeyType { - RSA = 0; - Ed25519 = 1; - Secp256k1 = 2; - ECDSA = 3; -} - -message PublicKey { - required KeyType Type = 1; - required bytes Data = 2; -} - -message PrivateKey { - required KeyType Type = 1; - required bytes Data = 2; -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_common.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_common.go deleted file mode 100644 index d50651f2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_common.go +++ /dev/null @@ -1,10 +0,0 @@ -package crypto - -import ( - "errors" -) - -// ErrRsaKeyTooSmall is returned when trying to generate or parse an RSA key -// that's smaller than 512 bits. Keys need to be larger enough to sign a 256bit -// hash so this is a reasonable absolute minimum. -var ErrRsaKeyTooSmall = errors.New("rsa keys must be >= 512 bits to be useful") diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_go.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_go.go deleted file mode 100644 index e9813779..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_go.go +++ /dev/null @@ -1,125 +0,0 @@ -// +build !openssl - -package crypto - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "errors" - "io" - - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - "github.com/minio/sha256-simd" -) - -// RsaPrivateKey is an rsa private key -type RsaPrivateKey struct { - sk rsa.PrivateKey -} - -// RsaPublicKey is an rsa public key -type RsaPublicKey struct { - k rsa.PublicKey -} - -// GenerateRSAKeyPair generates a new rsa private and public key -func GenerateRSAKeyPair(bits int, src io.Reader) (PrivKey, PubKey, error) { - if bits < 512 { - return nil, nil, ErrRsaKeyTooSmall - } - priv, err := rsa.GenerateKey(src, bits) - if err != nil { - return nil, nil, err - } - pk := priv.PublicKey - return &RsaPrivateKey{sk: *priv}, &RsaPublicKey{pk}, nil -} - -// Verify compares a signature against input data -func (pk *RsaPublicKey) Verify(data, sig []byte) (bool, error) { - hashed := sha256.Sum256(data) - err := rsa.VerifyPKCS1v15(&pk.k, crypto.SHA256, hashed[:], sig) - if err != nil { - return false, err - } - return true, nil -} - -func (pk *RsaPublicKey) Type() pb.KeyType { - return pb.KeyType_RSA -} - -// Bytes returns protobuf bytes of a public key -func (pk *RsaPublicKey) Bytes() ([]byte, error) { - return MarshalPublicKey(pk) -} - -func (pk *RsaPublicKey) Raw() ([]byte, error) { - return x509.MarshalPKIXPublicKey(&pk.k) -} - -// Equals checks whether this key is equal to another -func (pk *RsaPublicKey) Equals(k Key) bool { - return KeyEqual(pk, k) -} - -// Sign returns a signature of the input data -func (sk *RsaPrivateKey) Sign(message []byte) ([]byte, error) { - hashed := sha256.Sum256(message) - return rsa.SignPKCS1v15(rand.Reader, &sk.sk, crypto.SHA256, hashed[:]) -} - -// GetPublic returns a public key -func (sk *RsaPrivateKey) GetPublic() PubKey { - return &RsaPublicKey{sk.sk.PublicKey} -} - -func (sk *RsaPrivateKey) Type() pb.KeyType { - return pb.KeyType_RSA -} - -// Bytes returns protobuf bytes from a private key -func (sk *RsaPrivateKey) Bytes() ([]byte, error) { - return MarshalPrivateKey(sk) -} - -func (sk *RsaPrivateKey) Raw() ([]byte, error) { - b := x509.MarshalPKCS1PrivateKey(&sk.sk) - return b, nil -} - -// Equals checks whether this key is equal to another -func (sk *RsaPrivateKey) Equals(k Key) bool { - return KeyEqual(sk, k) -} - -// UnmarshalRsaPrivateKey returns a private key from the input x509 bytes -func UnmarshalRsaPrivateKey(b []byte) (PrivKey, error) { - sk, err := x509.ParsePKCS1PrivateKey(b) - if err != nil { - return nil, err - } - if sk.N.BitLen() < 512 { - return nil, ErrRsaKeyTooSmall - } - return &RsaPrivateKey{sk: *sk}, nil -} - -// UnmarshalRsaPublicKey returns a public key from the input x509 bytes -func UnmarshalRsaPublicKey(b []byte) (PubKey, error) { - pub, err := x509.ParsePKIXPublicKey(b) - if err != nil { - return nil, err - } - pk, ok := pub.(*rsa.PublicKey) - if !ok { - return nil, errors.New("not actually an rsa public key") - } - if pk.N.BitLen() < 512 { - return nil, ErrRsaKeyTooSmall - } - return &RsaPublicKey{*pk}, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_openssl.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_openssl.go deleted file mode 100644 index 96c55886..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/rsa_openssl.go +++ /dev/null @@ -1,62 +0,0 @@ -// +build openssl - -package crypto - -import ( - "errors" - "io" - - openssl "github.com/spacemonkeygo/openssl" -) - -// RsaPrivateKey is an rsa private key -type RsaPrivateKey struct { - opensslPrivateKey -} - -// RsaPublicKey is an rsa public key -type RsaPublicKey struct { - opensslPublicKey -} - -// GenerateRSAKeyPair generates a new rsa private and public key -func GenerateRSAKeyPair(bits int, _ io.Reader) (PrivKey, PubKey, error) { - if bits < 512 { - return nil, nil, ErrRsaKeyTooSmall - } - - key, err := openssl.GenerateRSAKey(bits) - if err != nil { - return nil, nil, err - } - return &RsaPrivateKey{opensslPrivateKey{key}}, &RsaPublicKey{opensslPublicKey{key}}, nil -} - -// GetPublic returns a public key -func (sk *RsaPrivateKey) GetPublic() PubKey { - return &RsaPublicKey{opensslPublicKey{sk.opensslPrivateKey.key}} -} - -// UnmarshalRsaPrivateKey returns a private key from the input x509 bytes -func UnmarshalRsaPrivateKey(b []byte) (PrivKey, error) { - key, err := unmarshalOpensslPrivateKey(b) - if err != nil { - return nil, err - } - if key.Type() != RSA { - return nil, errors.New("not actually an rsa public key") - } - return &RsaPrivateKey{key}, nil -} - -// UnmarshalRsaPublicKey returns a public key from the input x509 bytes -func UnmarshalRsaPublicKey(b []byte) (PubKey, error) { - key, err := unmarshalOpensslPublicKey(b) - if err != nil { - return nil, err - } - if key.Type() != RSA { - return nil, errors.New("not actually an rsa public key") - } - return &RsaPublicKey{key}, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/crypto/secp256k1.go b/vendor/github.com/libp2p/go-libp2p-core/crypto/secp256k1.go deleted file mode 100644 index d2ac74b9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/crypto/secp256k1.go +++ /dev/null @@ -1,125 +0,0 @@ -package crypto - -import ( - "fmt" - "io" - - pb "github.com/libp2p/go-libp2p-core/crypto/pb" - - btcec "github.com/btcsuite/btcd/btcec" - sha256 "github.com/minio/sha256-simd" -) - -// Secp256k1PrivateKey is an Secp256k1 private key -type Secp256k1PrivateKey btcec.PrivateKey - -// Secp256k1PublicKey is an Secp256k1 public key -type Secp256k1PublicKey btcec.PublicKey - -// GenerateSecp256k1Key generates a new Secp256k1 private and public key pair -func GenerateSecp256k1Key(src io.Reader) (PrivKey, PubKey, error) { - privk, err := btcec.NewPrivateKey(btcec.S256()) - if err != nil { - return nil, nil, err - } - - k := (*Secp256k1PrivateKey)(privk) - return k, k.GetPublic(), nil -} - -// UnmarshalSecp256k1PrivateKey returns a private key from bytes -func UnmarshalSecp256k1PrivateKey(data []byte) (PrivKey, error) { - if len(data) != btcec.PrivKeyBytesLen { - return nil, fmt.Errorf("expected secp256k1 data size to be %d", btcec.PrivKeyBytesLen) - } - - privk, _ := btcec.PrivKeyFromBytes(btcec.S256(), data) - return (*Secp256k1PrivateKey)(privk), nil -} - -// UnmarshalSecp256k1PublicKey returns a public key from bytes -func UnmarshalSecp256k1PublicKey(data []byte) (PubKey, error) { - k, err := btcec.ParsePubKey(data, btcec.S256()) - if err != nil { - return nil, err - } - - return (*Secp256k1PublicKey)(k), nil -} - -// Bytes returns protobuf bytes from a private key -func (k *Secp256k1PrivateKey) Bytes() ([]byte, error) { - return MarshalPrivateKey(k) -} - -// Type returns the private key type -func (k *Secp256k1PrivateKey) Type() pb.KeyType { - return pb.KeyType_Secp256k1 -} - -// Raw returns the bytes of the key -func (k *Secp256k1PrivateKey) Raw() ([]byte, error) { - return (*btcec.PrivateKey)(k).Serialize(), nil -} - -// Equals compares two private keys -func (k *Secp256k1PrivateKey) Equals(o Key) bool { - sk, ok := o.(*Secp256k1PrivateKey) - if !ok { - return false - } - - return k.D.Cmp(sk.D) == 0 -} - -// Sign returns a signature from input data -func (k *Secp256k1PrivateKey) Sign(data []byte) ([]byte, error) { - hash := sha256.Sum256(data) - sig, err := (*btcec.PrivateKey)(k).Sign(hash[:]) - if err != nil { - return nil, err - } - - return sig.Serialize(), nil -} - -// GetPublic returns a public key -func (k *Secp256k1PrivateKey) GetPublic() PubKey { - return (*Secp256k1PublicKey)((*btcec.PrivateKey)(k).PubKey()) -} - -// Bytes returns protobuf bytes from a public key -func (k *Secp256k1PublicKey) Bytes() ([]byte, error) { - return MarshalPublicKey(k) -} - -// Type returns the public key type -func (k *Secp256k1PublicKey) Type() pb.KeyType { - return pb.KeyType_Secp256k1 -} - -// Raw returns the bytes of the key -func (k *Secp256k1PublicKey) Raw() ([]byte, error) { - return (*btcec.PublicKey)(k).SerializeCompressed(), nil -} - -// Equals compares two public keys -func (k *Secp256k1PublicKey) Equals(o Key) bool { - sk, ok := o.(*Secp256k1PublicKey) - if !ok { - return false - } - - return (*btcec.PublicKey)(k).IsEqual((*btcec.PublicKey)(sk)) -} - -// Verify compares a signature against the input data -func (k *Secp256k1PublicKey) Verify(data []byte, sigStr []byte) (bool, error) { - sig, err := btcec.ParseDERSignature(sigStr, btcec.S256()) - if err != nil { - return false, err - } - - hash := sha256.Sum256(data) - return sig.Verify(hash[:], (*btcec.PublicKey)(k)), nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/discovery/discovery.go b/vendor/github.com/libp2p/go-libp2p-core/discovery/discovery.go deleted file mode 100644 index f463e0e8..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/discovery/discovery.go +++ /dev/null @@ -1,27 +0,0 @@ -// Package discovery provides service advertisement and peer discovery interfaces for libp2p. -package discovery - -import ( - "context" - "time" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// Advertiser is an interface for advertising services -type Advertiser interface { - // Advertise advertises a service - Advertise(ctx context.Context, ns string, opts ...Option) (time.Duration, error) -} - -// Discoverer is an interface for peer discovery -type Discoverer interface { - // FindPeers discovers peers providing a service - FindPeers(ctx context.Context, ns string, opts ...Option) (<-chan peer.AddrInfo, error) -} - -// Discovery is an interface that combines service advertisement and peer discovery -type Discovery interface { - Advertiser - Discoverer -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/discovery/options.go b/vendor/github.com/libp2p/go-libp2p-core/discovery/options.go deleted file mode 100644 index 7b283052..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/discovery/options.go +++ /dev/null @@ -1,41 +0,0 @@ -package discovery - -import "time" - -// DiscoveryOpt is a single discovery option. -type Option func(opts *Options) error - -// DiscoveryOpts is a set of discovery options. -type Options struct { - Ttl time.Duration - Limit int - - // Other (implementation-specific) options - Other map[interface{}]interface{} -} - -// Apply applies the given options to this DiscoveryOpts -func (opts *Options) Apply(options ...Option) error { - for _, o := range options { - if err := o(opts); err != nil { - return err - } - } - return nil -} - -// TTL is an option that provides a hint for the duration of an advertisement -func TTL(ttl time.Duration) Option { - return func(opts *Options) error { - opts.Ttl = ttl - return nil - } -} - -// Limit is an option that provides an upper bound on the peer count for discovery -func Limit(limit int) Option { - return func(opts *Options) error { - opts.Limit = limit - return nil - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/helpers/match.go b/vendor/github.com/libp2p/go-libp2p-core/helpers/match.go deleted file mode 100644 index 2e246678..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/helpers/match.go +++ /dev/null @@ -1,42 +0,0 @@ -package helpers - -import ( - "strings" - - "github.com/coreos/go-semver/semver" - "github.com/libp2p/go-libp2p-core/protocol" -) - -// MultistreamSemverMatcher returns a matcher function for a given base protocol. -// The matcher function will return a boolean indicating whether a protocol ID -// matches the base protocol. A given protocol ID matches the base protocol if -// the IDs are the same and if the semantic version of the base protocol is the -// same or higher than that of the protocol ID provided. -// TODO -func MultistreamSemverMatcher(base protocol.ID) (func(string) bool, error) { - parts := strings.Split(string(base), "/") - vers, err := semver.NewVersion(parts[len(parts)-1]) - if err != nil { - return nil, err - } - - return func(check string) bool { - chparts := strings.Split(check, "/") - if len(chparts) != len(parts) { - return false - } - - for i, v := range chparts[:len(chparts)-1] { - if parts[i] != v { - return false - } - } - - chvers, err := semver.NewVersion(chparts[len(chparts)-1]) - if err != nil { - return false - } - - return vers.Major == chvers.Major && vers.Minor >= chvers.Minor - }, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/helpers/stream.go b/vendor/github.com/libp2p/go-libp2p-core/helpers/stream.go deleted file mode 100644 index 0b4c1f3e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/helpers/stream.go +++ /dev/null @@ -1,56 +0,0 @@ -package helpers - -import ( - "errors" - "io" - "time" - - "github.com/libp2p/go-libp2p-core/network" -) - -// EOFTimeout is the maximum amount of time to wait to successfully observe an -// EOF on the stream. Defaults to 60 seconds. -var EOFTimeout = time.Second * 60 - -// ErrExpectedEOF is returned when we read data while expecting an EOF. -var ErrExpectedEOF = errors.New("read data when expecting EOF") - -// FullClose closes the stream and waits to read an EOF from the other side. -// -// * If it reads any data *before* the EOF, it resets the stream. -// * If it doesn't read an EOF within EOFTimeout, it resets the stream. -// -// You'll likely want to invoke this as `go FullClose(stream)` to close the -// stream in the background. -func FullClose(s network.Stream) error { - if err := s.Close(); err != nil { - s.Reset() - return err - } - return AwaitEOF(s) -} - -// AwaitEOF waits for an EOF on the given stream, returning an error if that -// fails. It waits at most EOFTimeout (defaults to 1 minute) after which it -// resets the stream. -func AwaitEOF(s network.Stream) error { - // So we don't wait forever - s.SetDeadline(time.Now().Add(EOFTimeout)) - - // We *have* to observe the EOF. Otherwise, we leak the stream. - // Now, technically, we should do this *before* - // returning from SendMessage as the message - // hasn't really been sent yet until we see the - // EOF but we don't actually *know* what - // protocol the other side is speaking. - n, err := s.Read([]byte{0}) - if n > 0 || err == nil { - s.Reset() - return ErrExpectedEOF - } - if err != io.EOF { - s.Reset() - return err - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/host/helpers.go b/vendor/github.com/libp2p/go-libp2p-core/host/helpers.go deleted file mode 100644 index a24beb1b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/host/helpers.go +++ /dev/null @@ -1,11 +0,0 @@ -package host - -import "github.com/libp2p/go-libp2p-core/peer" - -// InfoFromHost returns a peer.AddrInfo struct with the Host's ID and all of its Addrs. -func InfoFromHost(h Host) *peer.AddrInfo { - return &peer.AddrInfo{ - ID: h.ID(), - Addrs: h.Addrs(), - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/host/host.go b/vendor/github.com/libp2p/go-libp2p-core/host/host.go deleted file mode 100644 index d4b3c03f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/host/host.go +++ /dev/null @@ -1,71 +0,0 @@ -// Package host provides the core Host interface for libp2p. -// -// Host represents a single libp2p node in a peer-to-peer network. -package host - -import ( - "context" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/protocol" - - ma "github.com/multiformats/go-multiaddr" -) - -// Host is an object participating in a p2p network, which -// implements protocols or provides services. It handles -// requests like a Server, and issues requests like a Client. -// It is called Host because it is both Server and Client (and Peer -// may be confusing). -type Host interface { - // ID returns the (local) peer.ID associated with this Host - ID() peer.ID - - // Peerstore returns the Host's repository of Peer Addresses and Keys. - Peerstore() peerstore.Peerstore - - // Returns the listen addresses of the Host - Addrs() []ma.Multiaddr - - // Networks returns the Network interface of the Host - Network() network.Network - - // Mux returns the Mux multiplexing incoming streams to protocol handlers - Mux() protocol.Switch - - // Connect ensures there is a connection between this host and the peer with - // given peer.ID. Connect will absorb the addresses in pi into its internal - // peerstore. If there is not an active connection, Connect will issue a - // h.Network.Dial, and block until a connection is open, or an error is - // returned. // TODO: Relay + NAT. - Connect(ctx context.Context, pi peer.AddrInfo) error - - // SetStreamHandler sets the protocol handler on the Host's Mux. - // This is equivalent to: - // host.Mux().SetHandler(proto, handler) - // (Threadsafe) - SetStreamHandler(pid protocol.ID, handler network.StreamHandler) - - // SetStreamHandlerMatch sets the protocol handler on the Host's Mux - // using a matching function for protocol selection. - SetStreamHandlerMatch(protocol.ID, func(string) bool, network.StreamHandler) - - // RemoveStreamHandler removes a handler on the mux that was set by - // SetStreamHandler - RemoveStreamHandler(pid protocol.ID) - - // NewStream opens a new stream to given peer p, and writes a p2p/protocol - // header with given ProtocolID. If there is no connection to p, attempts - // to create one. If ProtocolID is "", writes no header. - // (Threadsafe) - NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error) - - // Close shuts down the host, its Network, and services. - Close() error - - // ConnManager returns this hosts connection manager - ConnManager() connmgr.ConnManager -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/metrics/bandwidth.go b/vendor/github.com/libp2p/go-libp2p-core/metrics/bandwidth.go deleted file mode 100644 index e2c8acf3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/metrics/bandwidth.go +++ /dev/null @@ -1,153 +0,0 @@ -// Package metrics provides metrics collection and reporting interfaces for libp2p. -package metrics - -import ( - "github.com/libp2p/go-flow-metrics" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -// BandwidthCounter tracks incoming and outgoing data transferred by the local peer. -// Metrics are available for total bandwidth across all peers / protocols, as well -// as segmented by remote peer ID and protocol ID. -type BandwidthCounter struct { - totalIn flow.Meter - totalOut flow.Meter - - protocolIn flow.MeterRegistry - protocolOut flow.MeterRegistry - - peerIn flow.MeterRegistry - peerOut flow.MeterRegistry -} - -// NewBandwidthCounter creates a new BandwidthCounter. -func NewBandwidthCounter() *BandwidthCounter { - return new(BandwidthCounter) -} - -// LogSentMessage records the size of an outgoing message -// without associating the bandwidth to a specific peer or protocol. -func (bwc *BandwidthCounter) LogSentMessage(size int64) { - bwc.totalOut.Mark(uint64(size)) -} - -// LogRecvMessage records the size of an incoming message -// without associating the bandwith to a specific peer or protocol. -func (bwc *BandwidthCounter) LogRecvMessage(size int64) { - bwc.totalIn.Mark(uint64(size)) -} - -// LogSentMessageStream records the size of an outgoing message over a single logical stream. -// Bandwidth is associated with the given protocol.ID and peer.ID. -func (bwc *BandwidthCounter) LogSentMessageStream(size int64, proto protocol.ID, p peer.ID) { - bwc.protocolOut.Get(string(proto)).Mark(uint64(size)) - bwc.peerOut.Get(string(p)).Mark(uint64(size)) -} - -// LogRecvMessageStream records the size of an incoming message over a single logical stream. -// Bandwidth is associated with the given protocol.ID and peer.ID. -func (bwc *BandwidthCounter) LogRecvMessageStream(size int64, proto protocol.ID, p peer.ID) { - bwc.protocolIn.Get(string(proto)).Mark(uint64(size)) - bwc.peerIn.Get(string(p)).Mark(uint64(size)) -} - -// GetBandwidthForPeer returns a Stats struct with bandwidth metrics associated with the given peer.ID. -// The metrics returned include all traffic sent / received for the peer, regardless of protocol. -func (bwc *BandwidthCounter) GetBandwidthForPeer(p peer.ID) (out Stats) { - inSnap := bwc.peerIn.Get(string(p)).Snapshot() - outSnap := bwc.peerOut.Get(string(p)).Snapshot() - - return Stats{ - TotalIn: int64(inSnap.Total), - TotalOut: int64(outSnap.Total), - RateIn: inSnap.Rate, - RateOut: outSnap.Rate, - } -} - -// GetBandwidthForProtocol returns a Stats struct with bandwidth metrics associated with the given protocol.ID. -// The metrics returned include all traffic sent / recieved for the protocol, regardless of which peers were -// involved. -func (bwc *BandwidthCounter) GetBandwidthForProtocol(proto protocol.ID) (out Stats) { - inSnap := bwc.protocolIn.Get(string(proto)).Snapshot() - outSnap := bwc.protocolOut.Get(string(proto)).Snapshot() - - return Stats{ - TotalIn: int64(inSnap.Total), - TotalOut: int64(outSnap.Total), - RateIn: inSnap.Rate, - RateOut: outSnap.Rate, - } -} - -// GetBandwidthTotals returns a Stats struct with bandwidth metrics for all data sent / recieved by the -// local peer, regardless of protocol or remote peer IDs. -func (bwc *BandwidthCounter) GetBandwidthTotals() (out Stats) { - inSnap := bwc.totalIn.Snapshot() - outSnap := bwc.totalOut.Snapshot() - - return Stats{ - TotalIn: int64(inSnap.Total), - TotalOut: int64(outSnap.Total), - RateIn: inSnap.Rate, - RateOut: outSnap.Rate, - } -} - -// GetBandwidthByPeer returns a map of all remembered peers and the bandwidth -// metrics with respect to each. This method may be very expensive. -func (bwc *BandwidthCounter) GetBandwidthByPeer() map[peer.ID]Stats { - peers := make(map[peer.ID]Stats) - - bwc.peerIn.ForEach(func(p string, meter *flow.Meter) { - id := peer.ID(p) - snap := meter.Snapshot() - - stat := peers[id] - stat.TotalIn = int64(snap.Total) - stat.RateIn = snap.Rate - peers[id] = stat - }) - - bwc.peerOut.ForEach(func(p string, meter *flow.Meter) { - id := peer.ID(p) - snap := meter.Snapshot() - - stat := peers[id] - stat.TotalOut = int64(snap.Total) - stat.RateOut = snap.Rate - peers[id] = stat - }) - - return peers -} - -// GetBandwidthByProtocol returns a map of all remembered protocols and -// the bandwidth metrics with respect to each. This method may be moderately -// expensive. -func (bwc *BandwidthCounter) GetBandwidthByProtocol() map[protocol.ID]Stats { - protocols := make(map[protocol.ID]Stats) - - bwc.protocolIn.ForEach(func(p string, meter *flow.Meter) { - id := protocol.ID(p) - snap := meter.Snapshot() - - stat := protocols[id] - stat.TotalIn = int64(snap.Total) - stat.RateIn = snap.Rate - protocols[id] = stat - }) - - bwc.protocolOut.ForEach(func(p string, meter *flow.Meter) { - id := protocol.ID(p) - snap := meter.Snapshot() - - stat := protocols[id] - stat.TotalOut = int64(snap.Total) - stat.RateOut = snap.Rate - protocols[id] = stat - }) - - return protocols -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/metrics/reporter.go b/vendor/github.com/libp2p/go-libp2p-core/metrics/reporter.go deleted file mode 100644 index 860345d6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/metrics/reporter.go +++ /dev/null @@ -1,31 +0,0 @@ -// Package metrics provides metrics collection and reporting interfaces for libp2p. -package metrics - -import ( - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -// Stats represents a point-in-time snapshot of bandwidth metrics. -// -// The TotalIn and TotalOut fields record cumulative bytes sent / received. -// The RateIn and RateOut fields record bytes sent / received per second. -type Stats struct { - TotalIn int64 - TotalOut int64 - RateIn float64 - RateOut float64 -} - -// Reporter provides methods for logging and retrieving metrics. -type Reporter interface { - LogSentMessage(int64) - LogRecvMessage(int64) - LogSentMessageStream(int64, protocol.ID, peer.ID) - LogRecvMessageStream(int64, protocol.ID, peer.ID) - GetBandwidthForPeer(peer.ID) Stats - GetBandwidthForProtocol(protocol.ID) Stats - GetBandwidthTotals() Stats - GetBandwidthByPeer() map[peer.ID]Stats - GetBandwidthByProtocol() map[protocol.ID]Stats -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/mux/mux.go b/vendor/github.com/libp2p/go-libp2p-core/mux/mux.go deleted file mode 100644 index 39f2e51c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/mux/mux.go +++ /dev/null @@ -1,70 +0,0 @@ -// Package mux provides stream multiplexing interfaces for libp2p. -// -// For a conceptual overview of stream multiplexing in libp2p, see -// https://docs.libp2p.io/concepts/stream-multiplexing/ -package mux - -import ( - "errors" - "io" - "net" - "time" -) - -// ErrReset is returned when reading or writing on a reset stream. -var ErrReset = errors.New("stream reset") - -// Stream is a bidirectional io pipe within a connection. -type MuxedStream interface { - io.Reader - io.Writer - - // Close closes the stream for writing. Reading will still work (that - // is, the remote side can still write). - io.Closer - - // Reset closes both ends of the stream. Use this to tell the remote - // side to hang up and go away. - Reset() error - - SetDeadline(time.Time) error - SetReadDeadline(time.Time) error - SetWriteDeadline(time.Time) error -} - -// NoopHandler do nothing. Resets streams as soon as they are opened. -var NoopHandler = func(s MuxedStream) { s.Reset() } - -// MuxedConn represents a connection to a remote peer that has been -// extended to support stream multiplexing. -// -// A MuxedConn allows a single net.Conn connection to carry many logically -// independent bidirectional streams of binary data. -// -// Together with network.ConnSecurity, MuxedConn is a component of the -// transport.CapableConn interface, which represents a "raw" network -// connection that has been "upgraded" to support the libp2p capabilities -// of secure communication and stream multiplexing. -type MuxedConn interface { - // Close closes the stream muxer and the the underlying net.Conn. - io.Closer - - // IsClosed returns whether a connection is fully closed, so it can - // be garbage collected. - IsClosed() bool - - // OpenStream creates a new stream. - OpenStream() (MuxedStream, error) - - // AcceptStream accepts a stream opened by the other side. - AcceptStream() (MuxedStream, error) -} - -// Multiplexer wraps a net.Conn with a stream multiplexing -// implementation and returns a MuxedConn that supports opening -// multiple streams over the underlying net.Conn -type Multiplexer interface { - - // NewConn constructs a new connection - NewConn(c net.Conn, isServer bool) (MuxedConn, error) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/conn.go b/vendor/github.com/libp2p/go-libp2p-core/network/conn.go deleted file mode 100644 index e7844a0e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/conn.go +++ /dev/null @@ -1,58 +0,0 @@ -package network - -import ( - "io" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - - ma "github.com/multiformats/go-multiaddr" -) - -// Conn is a connection to a remote peer. It multiplexes streams. -// Usually there is no need to use a Conn directly, but it may -// be useful to get information about the peer on the other side: -// stream.Conn().RemotePeer() -type Conn interface { - io.Closer - - ConnSecurity - ConnMultiaddrs - - // NewStream constructs a new Stream over this conn. - NewStream() (Stream, error) - - // GetStreams returns all open streams over this conn. - GetStreams() []Stream - - // Stat stores metadata pertaining to this conn. - Stat() Stat -} - -// ConnSecurity is the interface that one can mix into a connection interface to -// give it the security methods. -type ConnSecurity interface { - // LocalPeer returns our peer ID - LocalPeer() peer.ID - - // LocalPrivateKey returns our private key - LocalPrivateKey() ic.PrivKey - - // RemotePeer returns the peer ID of the remote peer. - RemotePeer() peer.ID - - // RemotePublicKey returns the public key of the remote peer. - RemotePublicKey() ic.PubKey -} - -// ConnMultiaddrs is an interface mixin for connection types that provide multiaddr -// addresses for the endpoints. -type ConnMultiaddrs interface { - // LocalMultiaddr returns the local Multiaddr associated - // with this connection - LocalMultiaddr() ma.Multiaddr - - // RemoteMultiaddr returns the remote Multiaddr associated - // with this connection - RemoteMultiaddr() ma.Multiaddr -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/context.go b/vendor/github.com/libp2p/go-libp2p-core/network/context.go deleted file mode 100644 index 9025f83a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/context.go +++ /dev/null @@ -1,48 +0,0 @@ -package network - -import ( - "context" - "time" -) - -// DialPeerTimeout is the default timeout for a single call to `DialPeer`. When -// there are multiple concurrent calls to `DialPeer`, this timeout will apply to -// each independently. -var DialPeerTimeout = 60 * time.Second - -type noDialCtxKey struct{} -type dialPeerTimeoutCtxKey struct{} - -var noDial = noDialCtxKey{} - -// WithNoDial constructs a new context with an option that instructs the network -// to not attempt a new dial when opening a stream. -func WithNoDial(ctx context.Context, reason string) context.Context { - return context.WithValue(ctx, noDial, reason) -} - -// GetNoDial returns true if the no dial option is set in the context. -func GetNoDial(ctx context.Context) (nodial bool, reason string) { - v := ctx.Value(noDial) - if v != nil { - return true, v.(string) - } - - return false, "" -} - -// GetDialPeerTimeout returns the current DialPeer timeout (or the default). -func GetDialPeerTimeout(ctx context.Context) time.Duration { - if to, ok := ctx.Value(dialPeerTimeoutCtxKey{}).(time.Duration); ok { - return to - } - return DialPeerTimeout -} - -// WithDialPeerTimeout returns a new context with the DialPeer timeout applied. -// -// This timeout overrides the default DialPeerTimeout and applies per-dial -// independently. -func WithDialPeerTimeout(ctx context.Context, timeout time.Duration) context.Context { - return context.WithValue(ctx, dialPeerTimeoutCtxKey{}, timeout) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/errors.go b/vendor/github.com/libp2p/go-libp2p-core/network/errors.go deleted file mode 100644 index f0cf7291..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package network - -import "errors" - -// ErrNoRemoteAddrs is returned when there are no addresses associated with a peer during a dial. -var ErrNoRemoteAddrs = errors.New("no remote addresses") - -// ErrNoConn is returned when attempting to open a stream to a peer with the NoDial -// option and no usable connection is available. -var ErrNoConn = errors.New("no usable connection to peer") diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/network.go b/vendor/github.com/libp2p/go-libp2p-core/network/network.go deleted file mode 100644 index 467109c4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/network.go +++ /dev/null @@ -1,138 +0,0 @@ -// Package network provides core networking abstractions for libp2p. -// -// The network package provides the high-level Network interface for interacting -// with other libp2p peers, which is the primary public API for initiating and -// accepting connections to remote peers. -package network - -import ( - "context" - "io" - - "github.com/jbenet/goprocess" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - - ma "github.com/multiformats/go-multiaddr" -) - -// MessageSizeMax is a soft (recommended) maximum for network messages. -// One can write more, as the interface is a stream. But it is useful -// to bunch it up into multiple read/writes when the whole message is -// a single, large serialized object. -const MessageSizeMax = 1 << 22 // 4 MB - -// Direction represents which peer in a stream initiated a connection. -type Direction int - -const ( - // DirUnknown is the default direction. - DirUnknown Direction = iota - // DirInbound is for when the remote peer initiated a connection. - DirInbound - // DirOutbound is for when the local peer initiated a connection. - DirOutbound -) - -// Connectedness signals the capacity for a connection with a given node. -// It is used to signal to services and other peers whether a node is reachable. -type Connectedness int - -const ( - // NotConnected means no connection to peer, and no extra information (default) - NotConnected Connectedness = iota - - // Connected means has an open, live connection to peer - Connected - - // CanConnect means recently connected to peer, terminated gracefully - CanConnect - - // CannotConnect means recently attempted connecting but failed to connect. - // (should signal "made effort, failed") - CannotConnect -) - -// Stat stores metadata pertaining to a given Stream/Conn. -type Stat struct { - Direction Direction - Extra map[interface{}]interface{} -} - -// StreamHandler is the type of function used to listen for -// streams opened by the remote side. -type StreamHandler func(Stream) - -// ConnHandler is the type of function used to listen for -// connections opened by the remote side. -type ConnHandler func(Conn) - -// Network is the interface used to connect to the outside world. -// It dials and listens for connections. it uses a Swarm to pool -// connections (see swarm pkg, and peerstream.Swarm). Connections -// are encrypted with a TLS-like protocol. -type Network interface { - Dialer - io.Closer - - // SetStreamHandler sets the handler for new streams opened by the - // remote side. This operation is threadsafe. - SetStreamHandler(StreamHandler) - - // SetConnHandler sets the handler for new connections opened by the - // remote side. This operation is threadsafe. - SetConnHandler(ConnHandler) - - // NewStream returns a new stream to given peer p. - // If there is no connection to p, attempts to create one. - NewStream(context.Context, peer.ID) (Stream, error) - - // Listen tells the network to start listening on given multiaddrs. - Listen(...ma.Multiaddr) error - - // ListenAddresses returns a list of addresses at which this network listens. - ListenAddresses() []ma.Multiaddr - - // InterfaceListenAddresses returns a list of addresses at which this network - // listens. It expands "any interface" addresses (/ip4/0.0.0.0, /ip6/::) to - // use the known local interfaces. - InterfaceListenAddresses() ([]ma.Multiaddr, error) - - // Process returns the network's Process - Process() goprocess.Process -} - -// Dialer represents a service that can dial out to peers -// (this is usually just a Network, but other services may not need the whole -// stack, and thus it becomes easier to mock) -type Dialer interface { - // Peerstore returns the internal peerstore - // This is useful to tell the dialer about a new address for a peer. - // Or use one of the public keys found out over the network. - Peerstore() peerstore.Peerstore - - // LocalPeer returns the local peer associated with this network - LocalPeer() peer.ID - - // DialPeer establishes a connection to a given peer - DialPeer(context.Context, peer.ID) (Conn, error) - - // ClosePeer closes the connection to a given peer - ClosePeer(peer.ID) error - - // Connectedness returns a state signaling connection capabilities - Connectedness(peer.ID) Connectedness - - // Peers returns the peers connected - Peers() []peer.ID - - // Conns returns the connections in this Netowrk - Conns() []Conn - - // ConnsToPeer returns the connections in this Netowrk for given peer. - ConnsToPeer(p peer.ID) []Conn - - // Notify/StopNotify register and unregister a notifiee for signals - Notify(Notifiee) - StopNotify(Notifiee) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/notifee.go b/vendor/github.com/libp2p/go-libp2p-core/network/notifee.go deleted file mode 100644 index 10ef72f1..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/notifee.go +++ /dev/null @@ -1,92 +0,0 @@ -package network - -import ( - ma "github.com/multiformats/go-multiaddr" -) - -// Notifiee is an interface for an object wishing to receive -// notifications from a Network. -type Notifiee interface { - Listen(Network, ma.Multiaddr) // called when network starts listening on an addr - ListenClose(Network, ma.Multiaddr) // called when network stops listening on an addr - Connected(Network, Conn) // called when a connection opened - Disconnected(Network, Conn) // called when a connection closed - OpenedStream(Network, Stream) // called when a stream opened - ClosedStream(Network, Stream) // called when a stream closed - - // TODO - // PeerConnected(Network, peer.ID) // called when a peer connected - // PeerDisconnected(Network, peer.ID) // called when a peer disconnected -} - -// NotifyBundle implements Notifiee by calling any of the functions set on it, -// and nop'ing if they are unset. This is the easy way to register for -// notifications. -type NotifyBundle struct { - ListenF func(Network, ma.Multiaddr) - ListenCloseF func(Network, ma.Multiaddr) - - ConnectedF func(Network, Conn) - DisconnectedF func(Network, Conn) - - OpenedStreamF func(Network, Stream) - ClosedStreamF func(Network, Stream) -} - -var _ Notifiee = (*NotifyBundle)(nil) - -// Listen calls ListenF if it is not null. -func (nb *NotifyBundle) Listen(n Network, a ma.Multiaddr) { - if nb.ListenF != nil { - nb.ListenF(n, a) - } -} - -// ListenClose calls ListenCloseF if it is not null. -func (nb *NotifyBundle) ListenClose(n Network, a ma.Multiaddr) { - if nb.ListenCloseF != nil { - nb.ListenCloseF(n, a) - } -} - -// Connected calls ConnectedF if it is not null. -func (nb *NotifyBundle) Connected(n Network, c Conn) { - if nb.ConnectedF != nil { - nb.ConnectedF(n, c) - } -} - -// Disconnected calls DisconnectedF if it is not null. -func (nb *NotifyBundle) Disconnected(n Network, c Conn) { - if nb.DisconnectedF != nil { - nb.DisconnectedF(n, c) - } -} - -// OpenedStream calls OpenedStreamF if it is not null. -func (nb *NotifyBundle) OpenedStream(n Network, s Stream) { - if nb.OpenedStreamF != nil { - nb.OpenedStreamF(n, s) - } -} - -// ClosedStream calls ClosedStreamF if it is not null. -func (nb *NotifyBundle) ClosedStream(n Network, s Stream) { - if nb.ClosedStreamF != nil { - nb.ClosedStreamF(n, s) - } -} - -// Global noop notifiee. Do not change. -var GlobalNoopNotifiee = &NoopNotifiee{} - -type NoopNotifiee struct{} - -var _ Notifiee = (*NoopNotifiee)(nil) - -func (nn *NoopNotifiee) Connected(n Network, c Conn) {} -func (nn *NoopNotifiee) Disconnected(n Network, c Conn) {} -func (nn *NoopNotifiee) Listen(n Network, addr ma.Multiaddr) {} -func (nn *NoopNotifiee) ListenClose(n Network, addr ma.Multiaddr) {} -func (nn *NoopNotifiee) OpenedStream(Network, Stream) {} -func (nn *NoopNotifiee) ClosedStream(Network, Stream) {} diff --git a/vendor/github.com/libp2p/go-libp2p-core/network/stream.go b/vendor/github.com/libp2p/go-libp2p-core/network/stream.go deleted file mode 100644 index d13dc305..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/network/stream.go +++ /dev/null @@ -1,24 +0,0 @@ -package network - -import ( - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/protocol" -) - -// Stream represents a bidirectional channel between two agents in -// a libp2p network. "agent" is as granular as desired, potentially -// being a "request -> reply" pair, or whole protocols. -// -// Streams are backed by a multiplexer underneath the hood. -type Stream interface { - mux.MuxedStream - - Protocol() protocol.ID - SetProtocol(id protocol.ID) - - // Stat returns metadata pertaining to this stream. - Stat() Stat - - // Conn returns the connection this stream is part of. - Conn() Conn -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo.go b/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo.go deleted file mode 100644 index 6423d846..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo.go +++ /dev/null @@ -1,98 +0,0 @@ -package peer - -import ( - "fmt" - - ma "github.com/multiformats/go-multiaddr" -) - -// AddrInfo is a small struct used to pass around a peer with -// a set of addresses (and later, keys?). -type AddrInfo struct { - ID ID - Addrs []ma.Multiaddr -} - -var _ fmt.Stringer = AddrInfo{} - -func (pi AddrInfo) String() string { - return fmt.Sprintf("{%v: %v}", pi.ID, pi.Addrs) -} - -var ErrInvalidAddr = fmt.Errorf("invalid p2p multiaddr") - -// AddrInfosFromP2pAddrs converts a set of Multiaddrs to a set of AddrInfos. -func AddrInfosFromP2pAddrs(maddrs ...ma.Multiaddr) ([]AddrInfo, error) { - m := make(map[ID][]ma.Multiaddr) - for _, maddr := range maddrs { - transport, id := SplitAddr(maddr) - if id == "" { - return nil, ErrInvalidAddr - } - if transport == nil { - if _, ok := m[id]; !ok { - m[id] = nil - } - } else { - m[id] = append(m[id], transport) - } - } - ais := make([]AddrInfo, 0, len(m)) - for id, maddrs := range m { - ais = append(ais, AddrInfo{ID: id, Addrs: maddrs}) - } - return ais, nil -} - -// SplitAddr splits a p2p Multiaddr into a transport multiaddr and a peer ID. -// -// * Returns a nil transport if the address only contains a /p2p part. -// * Returns a empty peer ID if the address doesn't contain a /p2p part. -func SplitAddr(m ma.Multiaddr) (transport ma.Multiaddr, id ID) { - if m == nil { - return nil, "" - } - - transport, p2ppart := ma.SplitLast(m) - if p2ppart == nil || p2ppart.Protocol().Code != ma.P_P2P { - return m, "" - } - id = ID(p2ppart.RawValue()) // already validated by the multiaddr library. - return transport, id -} - -// AddrInfoFromP2pAddr converts a Multiaddr to an AddrInfo. -func AddrInfoFromP2pAddr(m ma.Multiaddr) (*AddrInfo, error) { - transport, id := SplitAddr(m) - if id == "" { - return nil, ErrInvalidAddr - } - info := &AddrInfo{ID: id} - if transport != nil { - info.Addrs = []ma.Multiaddr{transport} - } - return info, nil -} - -// AddrInfoToP2pAddr converts an AddrInfo to a list of Multiaddrs. -func AddrInfoToP2pAddrs(pi *AddrInfo) ([]ma.Multiaddr, error) { - var addrs []ma.Multiaddr - p2ppart, err := ma.NewComponent("p2p", IDB58Encode(pi.ID)) - if err != nil { - return nil, err - } - if len(pi.Addrs) == 0 { - return []ma.Multiaddr{p2ppart}, nil - } - for _, addr := range pi.Addrs { - addrs = append(addrs, addr.Encapsulate(p2ppart)) - } - return addrs, nil -} - -func (pi *AddrInfo) Loggable() map[string]interface{} { - return map[string]interface{}{ - "peerID": pi.ID.Pretty(), - "addrs": pi.Addrs, - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo_serde.go b/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo_serde.go deleted file mode 100644 index 1df24e2b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peer/addrinfo_serde.go +++ /dev/null @@ -1,38 +0,0 @@ -package peer - -import ( - "encoding/json" - - ma "github.com/multiformats/go-multiaddr" -) - -func (pi AddrInfo) MarshalJSON() ([]byte, error) { - out := make(map[string]interface{}) - out["ID"] = pi.ID.Pretty() - var addrs []string - for _, a := range pi.Addrs { - addrs = append(addrs, a.String()) - } - out["Addrs"] = addrs - return json.Marshal(out) -} - -func (pi *AddrInfo) UnmarshalJSON(b []byte) error { - var data map[string]interface{} - err := json.Unmarshal(b, &data) - if err != nil { - return err - } - pid, err := IDB58Decode(data["ID"].(string)) - if err != nil { - return err - } - pi.ID = pid - addrs, ok := data["Addrs"].([]interface{}) - if ok { - for _, a := range addrs { - pi.Addrs = append(pi.Addrs, ma.StringCast(a.(string))) - } - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/peer/peer.go b/vendor/github.com/libp2p/go-libp2p-core/peer/peer.go deleted file mode 100644 index db307ee1..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peer/peer.go +++ /dev/null @@ -1,186 +0,0 @@ -// Package peer implements an object used to represent peers in the libp2p network. -package peer - -import ( - "encoding/hex" - "errors" - "fmt" - - ic "github.com/libp2p/go-libp2p-core/crypto" - b58 "github.com/mr-tron/base58/base58" - mh "github.com/multiformats/go-multihash" -) - -var ( - // ErrEmptyPeerID is an error for empty peer ID. - ErrEmptyPeerID = errors.New("empty peer ID") - // ErrNoPublicKey is an error for peer IDs that don't embed public keys - ErrNoPublicKey = errors.New("public key is not embedded in peer ID") -) - -// AdvancedEnableInlining enables automatically inlining keys shorter than -// 42 bytes into the peer ID (using the "identity" multihash function). -// -// WARNING: This flag will likely be set to false in the future and eventually -// be removed in favor of using a hash function specified by the key itself. -// See: https://github.com/libp2p/specs/issues/138 -// -// DO NOT change this flag unless you know what you're doing. -// -// This currently defaults to true for backwards compatibility but will likely -// be set to false by default when an upgrade path is determined. -var AdvancedEnableInlining = true - -const maxInlineKeyLength = 42 - -// ID is a libp2p peer identity. -// -// Peer IDs are derived by hashing a peer's public key and encoding the -// hash output as a multihash. See IDFromPublicKey for details. -type ID string - -// Pretty returns a base58-encoded string representation of the ID. -func (id ID) Pretty() string { - return IDB58Encode(id) -} - -// Loggable returns a pretty peer ID string in loggable JSON format. -func (id ID) Loggable() map[string]interface{} { - return map[string]interface{}{ - "peerID": id.Pretty(), - } -} - -func (id ID) String() string { - return id.Pretty() -} - -// String prints out the peer ID. -// -// TODO(brian): ensure correctness at ID generation and -// enforce this by only exposing functions that generate -// IDs safely. Then any peer.ID type found in the -// codebase is known to be correct. -func (id ID) ShortString() string { - pid := id.Pretty() - if len(pid) <= 10 { - return fmt.Sprintf("", pid) - } - return fmt.Sprintf("", pid[:2], pid[len(pid)-6:]) -} - -// MatchesPrivateKey tests whether this ID was derived from the secret key sk. -func (id ID) MatchesPrivateKey(sk ic.PrivKey) bool { - return id.MatchesPublicKey(sk.GetPublic()) -} - -// MatchesPublicKey tests whether this ID was derived from the public key pk. -func (id ID) MatchesPublicKey(pk ic.PubKey) bool { - oid, err := IDFromPublicKey(pk) - if err != nil { - return false - } - return oid == id -} - -// ExtractPublicKey attempts to extract the public key from an ID -// -// This method returns ErrNoPublicKey if the peer ID looks valid but it can't extract -// the public key. -func (id ID) ExtractPublicKey() (ic.PubKey, error) { - decoded, err := mh.Decode([]byte(id)) - if err != nil { - return nil, err - } - if decoded.Code != mh.ID { - return nil, ErrNoPublicKey - } - pk, err := ic.UnmarshalPublicKey(decoded.Digest) - if err != nil { - return nil, err - } - return pk, nil -} - -// Validate checks if ID is empty or not. -func (id ID) Validate() error { - if id == ID("") { - return ErrEmptyPeerID - } - - return nil -} - -// IDFromString casts a string to the ID type, and validates -// the value to make sure it is a multihash. -func IDFromString(s string) (ID, error) { - if _, err := mh.Cast([]byte(s)); err != nil { - return ID(""), err - } - return ID(s), nil -} - -// IDFromBytes casts a byte slice to the ID type, and validates -// the value to make sure it is a multihash. -func IDFromBytes(b []byte) (ID, error) { - if _, err := mh.Cast(b); err != nil { - return ID(""), err - } - return ID(b), nil -} - -// IDB58Decode accepts a base58-encoded multihash representing a peer ID -// and returns the decoded ID if the input is valid. -func IDB58Decode(s string) (ID, error) { - m, err := mh.FromB58String(s) - if err != nil { - return "", err - } - return ID(m), err -} - -// IDB58Encode returns the base58-encoded multihash representation of the ID. -func IDB58Encode(id ID) string { - return b58.Encode([]byte(id)) -} - -// IDHexDecode accepts a hex-encoded multihash representing a peer ID -// and returns the decoded ID if the input is valid. -func IDHexDecode(s string) (ID, error) { - m, err := mh.FromHexString(s) - if err != nil { - return "", err - } - return ID(m), err -} - -// IDHexEncode returns the hex-encoded multihash representation of the ID. -func IDHexEncode(id ID) string { - return hex.EncodeToString([]byte(id)) -} - -// IDFromPublicKey returns the Peer ID corresponding to the public key pk. -func IDFromPublicKey(pk ic.PubKey) (ID, error) { - b, err := pk.Bytes() - if err != nil { - return "", err - } - var alg uint64 = mh.SHA2_256 - if AdvancedEnableInlining && len(b) <= maxInlineKeyLength { - alg = mh.ID - } - hash, _ := mh.Sum(b, alg, -1) - return ID(hash), nil -} - -// IDFromPrivateKey returns the Peer ID corresponding to the secret key sk. -func IDFromPrivateKey(sk ic.PrivKey) (ID, error) { - return IDFromPublicKey(sk.GetPublic()) -} - -// IDSlice for sorting peers -type IDSlice []ID - -func (es IDSlice) Len() int { return len(es) } -func (es IDSlice) Swap(i, j int) { es[i], es[j] = es[j], es[i] } -func (es IDSlice) Less(i, j int) bool { return string(es[i]) < string(es[j]) } diff --git a/vendor/github.com/libp2p/go-libp2p-core/peer/peer_serde.go b/vendor/github.com/libp2p/go-libp2p-core/peer/peer_serde.go deleted file mode 100644 index 7f1b3e6a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peer/peer_serde.go +++ /dev/null @@ -1,75 +0,0 @@ -// This file contains Protobuf and JSON serialization/deserialization methods for peer IDs. -package peer - -import ( - "encoding" - "encoding/json" -) - -// Interface assertions commented out to avoid introducing hard dependencies to protobuf. -// var _ proto.Marshaler = (*ID)(nil) -// var _ proto.Unmarshaler = (*ID)(nil) -var _ json.Marshaler = (*ID)(nil) -var _ json.Unmarshaler = (*ID)(nil) - -var _ encoding.BinaryMarshaler = (*ID)(nil) -var _ encoding.BinaryUnmarshaler = (*ID)(nil) -var _ encoding.TextMarshaler = (*ID)(nil) -var _ encoding.TextUnmarshaler = (*ID)(nil) - -func (id ID) Marshal() ([]byte, error) { - return []byte(id), nil -} - -// BinaryMarshal returns the byte representation of the peer ID. -func (id ID) MarshalBinary() ([]byte, error) { - return id.Marshal() -} - -func (id ID) MarshalTo(data []byte) (n int, err error) { - return copy(data, []byte(id)), nil -} - -func (id *ID) Unmarshal(data []byte) (err error) { - *id, err = IDFromBytes(data) - return err -} - -// BinaryUnmarshal sets the ID from its binary representation. -func (id *ID) UnmarshalBinary(data []byte) error { - return id.Unmarshal(data) -} - -// Implements Gogo's proto.Sizer, but we omit the compile-time assertion to avoid introducing a hard -// dependency on gogo. -func (id ID) Size() int { - return len([]byte(id)) -} - -func (id ID) MarshalJSON() ([]byte, error) { - return json.Marshal(IDB58Encode(id)) -} - -func (id *ID) UnmarshalJSON(data []byte) (err error) { - var v string - if err = json.Unmarshal(data, &v); err != nil { - return err - } - *id, err = IDB58Decode(v) - return err -} - -// TextMarshal returns the text encoding of the ID. -func (id ID) MarshalText() ([]byte, error) { - return []byte(IDB58Encode(id)), nil -} - -// TextUnmarshal restores the ID from its text encoding. -func (id *ID) UnmarshalText(data []byte) error { - pid, err := IDB58Decode(string(data)) - if err != nil { - return err - } - *id = pid - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/peer/set.go b/vendor/github.com/libp2p/go-libp2p-core/peer/set.go deleted file mode 100644 index ea82ea80..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peer/set.go +++ /dev/null @@ -1,71 +0,0 @@ -package peer - -import ( - "sync" -) - -// PeerSet is a threadsafe set of peers -type Set struct { - lk sync.RWMutex - ps map[ID]struct{} - - size int -} - -func NewSet() *Set { - ps := new(Set) - ps.ps = make(map[ID]struct{}) - ps.size = -1 - return ps -} - -func NewLimitedSet(size int) *Set { - ps := new(Set) - ps.ps = make(map[ID]struct{}) - ps.size = size - return ps -} - -func (ps *Set) Add(p ID) { - ps.lk.Lock() - ps.ps[p] = struct{}{} - ps.lk.Unlock() -} - -func (ps *Set) Contains(p ID) bool { - ps.lk.RLock() - _, ok := ps.ps[p] - ps.lk.RUnlock() - return ok -} - -func (ps *Set) Size() int { - ps.lk.RLock() - defer ps.lk.RUnlock() - return len(ps.ps) -} - -// TryAdd Attempts to add the given peer into the set. -// This operation can fail for one of two reasons: -// 1) The given peer is already in the set -// 2) The number of peers in the set is equal to size -func (ps *Set) TryAdd(p ID) bool { - var success bool - ps.lk.Lock() - if _, ok := ps.ps[p]; !ok && (len(ps.ps) < ps.size || ps.size == -1) { - success = true - ps.ps[p] = struct{}{} - } - ps.lk.Unlock() - return success -} - -func (ps *Set) Peers() []ID { - ps.lk.Lock() - out := make([]ID, 0, len(ps.ps)) - for p, _ := range ps.ps { - out = append(out, p) - } - ps.lk.Unlock() - return out -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/peerstore/peerstore.go b/vendor/github.com/libp2p/go-libp2p-core/peerstore/peerstore.go deleted file mode 100644 index 2e1b6449..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/peerstore/peerstore.go +++ /dev/null @@ -1,162 +0,0 @@ -// Package peerstore provides types and interfaces for local storage of address information, -// metadata, and public key material about libp2p peers. -package peerstore - -import ( - "context" - "errors" - "io" - "math" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - - ic "github.com/libp2p/go-libp2p-core/crypto" - - ma "github.com/multiformats/go-multiaddr" -) - -var ErrNotFound = errors.New("item not found") - -var ( - // AddressTTL is the expiration time of addresses. - AddressTTL = time.Hour - - // TempAddrTTL is the ttl used for a short lived address - TempAddrTTL = time.Minute * 2 - - // ProviderAddrTTL is the TTL of an address we've received from a provider. - // This is also a temporary address, but lasts longer. After this expires, - // the records we return will require an extra lookup. - ProviderAddrTTL = time.Minute * 10 - - // RecentlyConnectedAddrTTL is used when we recently connected to a peer. - // It means that we are reasonably certain of the peer's address. - RecentlyConnectedAddrTTL = time.Minute * 10 - - // OwnObservedAddrTTL is used for our own external addresses observed by peers. - OwnObservedAddrTTL = time.Minute * 10 -) - -// Permanent TTLs (distinct so we can distinguish between them, constant as they -// are, in fact, permanent) -const ( - // PermanentAddrTTL is the ttl for a "permanent address" (e.g. bootstrap nodes). - PermanentAddrTTL = math.MaxInt64 - iota - - // ConnectedAddrTTL is the ttl used for the addresses of a peer to whom - // we're connected directly. This is basically permanent, as we will - // clear them + re-add under a TempAddrTTL after disconnecting. - ConnectedAddrTTL -) - -// Peerstore provides a threadsafe store of Peer related -// information. -type Peerstore interface { - io.Closer - - AddrBook - KeyBook - PeerMetadata - Metrics - ProtoBook - - // PeerInfo returns a peer.PeerInfo struct for given peer.ID. - // This is a small slice of the information Peerstore has on - // that peer, useful to other services. - PeerInfo(peer.ID) peer.AddrInfo - - // Peers returns all of the peer IDs stored across all inner stores. - Peers() peer.IDSlice -} - -// PeerMetadata can handle values of any type. Serializing values is -// up to the implementation. Dynamic type introspection may not be -// supported, in which case explicitly enlisting types in the -// serializer may be required. -// -// Refer to the docs of the underlying implementation for more -// information. -type PeerMetadata interface { - // Get/Put is a simple registry for other peer-related key/value pairs. - // if we find something we use often, it should become its own set of - // methods. this is a last resort. - Get(p peer.ID, key string) (interface{}, error) - Put(p peer.ID, key string, val interface{}) error -} - -// AddrBook holds the multiaddrs of peers. -type AddrBook interface { - - // AddAddr calls AddAddrs(p, []ma.Multiaddr{addr}, ttl) - AddAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration) - - // AddAddrs gives this AddrBook addresses to use, with a given ttl - // (time-to-live), after which the address is no longer valid. - // If the manager has a longer TTL, the operation is a no-op for that address - AddAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration) - - // SetAddr calls mgr.SetAddrs(p, addr, ttl) - SetAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration) - - // SetAddrs sets the ttl on addresses. This clears any TTL there previously. - // This is used when we receive the best estimate of the validity of an address. - SetAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration) - - // UpdateAddrs updates the addresses associated with the given peer that have - // the given oldTTL to have the given newTTL. - UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time.Duration) - - // Addresses returns all known (and valid) addresses for a given peer - Addrs(p peer.ID) []ma.Multiaddr - - // AddrStream returns a channel that gets all addresses for a given - // peer sent on it. If new addresses are added after the call is made - // they will be sent along through the channel as well. - AddrStream(context.Context, peer.ID) <-chan ma.Multiaddr - - // ClearAddresses removes all previously stored addresses - ClearAddrs(p peer.ID) - - // PeersWithAddrs returns all of the peer IDs stored in the AddrBook - PeersWithAddrs() peer.IDSlice -} - -// KeyBook tracks the keys of Peers. -type KeyBook interface { - // PubKey stores the public key of a peer. - PubKey(peer.ID) ic.PubKey - - // AddPubKey stores the public key of a peer. - AddPubKey(peer.ID, ic.PubKey) error - - // PrivKey returns the private key of a peer, if known. Generally this might only be our own - // private key, see - // https://discuss.libp2p.io/t/what-is-the-purpose-of-having-map-peer-id-privatekey-in-peerstore/74. - PrivKey(peer.ID) ic.PrivKey - - // AddPrivKey stores the private key of a peer. - AddPrivKey(peer.ID, ic.PrivKey) error - - // PeersWithKeys returns all the peer IDs stored in the KeyBook - PeersWithKeys() peer.IDSlice -} - -// Metrics is just an object that tracks metrics -// across a set of peers. -type Metrics interface { - // RecordLatency records a new latency measurement - RecordLatency(peer.ID, time.Duration) - - // LatencyEWMA returns an exponentially-weighted moving avg. - // of all measurements of a peer's latency. - LatencyEWMA(peer.ID) time.Duration -} - -// ProtoBook tracks the protocols supported by peers -type ProtoBook interface { - GetProtocols(peer.ID) ([]string, error) - AddProtocols(peer.ID, ...string) error - SetProtocols(peer.ID, ...string) error - SupportsProtocols(peer.ID, ...string) ([]string, error) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/pnet/env.go b/vendor/github.com/libp2p/go-libp2p-core/pnet/env.go deleted file mode 100644 index c8db5e3c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/pnet/env.go +++ /dev/null @@ -1,19 +0,0 @@ -package pnet - -import "os" - -// EnvKey defines environment variable name for forcing usage of PNet in libp2p -// When environment variable of this name is set to "1" the ForcePrivateNetwork -// variable will be set to true. -const EnvKey = "LIBP2P_FORCE_PNET" - -// ForcePrivateNetwork is boolean variable that forces usage of PNet in libp2p -// Setting this variable to true or setting LIBP2P_FORCE_PNET environment variable -// to true will make libp2p to require private network protector. -// If no network protector is provided and this variable is set to true libp2p will -// refuse to connect. -var ForcePrivateNetwork = false - -func init() { - ForcePrivateNetwork = os.Getenv(EnvKey) == "1" -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/pnet/error.go b/vendor/github.com/libp2p/go-libp2p-core/pnet/error.go deleted file mode 100644 index 184b71d6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/pnet/error.go +++ /dev/null @@ -1,34 +0,0 @@ -package pnet - -// ErrNotInPrivateNetwork is an error that should be returned by libp2p when it -// tries to dial with ForcePrivateNetwork set and no PNet Protector -var ErrNotInPrivateNetwork = NewError("private network was not configured but" + - " is enforced by the environment") - -// Error is error type for ease of detecting PNet errors -type Error interface { - IsPNetError() bool -} - -// NewError creates new Error -func NewError(err string) error { - return pnetErr("privnet: " + err) -} - -// IsPNetError checks if given error is PNet Error -func IsPNetError(err error) bool { - v, ok := err.(Error) - return ok && v.IsPNetError() -} - -type pnetErr string - -var _ Error = (*pnetErr)(nil) - -func (p pnetErr) Error() string { - return string(p) -} - -func (pnetErr) IsPNetError() bool { - return true -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/pnet/protector.go b/vendor/github.com/libp2p/go-libp2p-core/pnet/protector.go deleted file mode 100644 index c443ee8f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/pnet/protector.go +++ /dev/null @@ -1,15 +0,0 @@ -// Package pnet provides interfaces for private networking in libp2p. -package pnet - -import "net" - -// Protector interface is a way for private network implementation to be transparent in -// libp2p. It is created by implementation and use by libp2p-conn to secure connections -// so they can be only established with selected number of peers. -type Protector interface { - // Wraps passed connection to protect it - Protect(net.Conn) (net.Conn, error) - - // Returns key fingerprint that is safe to expose - Fingerprint() []byte -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/protocol/id.go b/vendor/github.com/libp2p/go-libp2p-core/protocol/id.go deleted file mode 100644 index f7e4a32b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/protocol/id.go +++ /dev/null @@ -1,9 +0,0 @@ -package protocol - -// ID is an identifier used to write protocol headers in streams. -type ID string - -// These are reserved protocol.IDs. -const ( - TestingID ID = "/p2p/_testing" -) diff --git a/vendor/github.com/libp2p/go-libp2p-core/protocol/switch.go b/vendor/github.com/libp2p/go-libp2p-core/protocol/switch.go deleted file mode 100644 index f3ac369b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/protocol/switch.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package protocol provides core interfaces for protocol routing and negotiation in libp2p. -package protocol - -import ( - "io" -) - -// HandlerFunc is a user-provided function used by the Router to -// handle a protocol/stream. -// -// Will be invoked with the protocol ID string as the first argument, -// which may differ from the ID used for registration if the handler -// was registered using a match function. -type HandlerFunc = func(protocol string, rwc io.ReadWriteCloser) error - -// Router is an interface that allows users to add and remove protocol handlers, -// which will be invoked when incoming stream requests for registered protocols -// are accepted. -// -// Upon receiving an incoming stream request, the Router will check all registered -// protocol handlers to determine which (if any) is capable of handling the stream. -// The handlers are checked in order of registration; if multiple handlers are -// eligible, only the first to be registered will be invoked. -type Router interface { - - // AddHandler registers the given handler to be invoked for - // an exact literal match of the given protocol ID string. - AddHandler(protocol string, handler HandlerFunc) - - // AddHandlerWithFunc registers the given handler to be invoked - // when the provided match function returns true. - // - // The match function will be invoked with an incoming protocol - // ID string, and should return true if the handler supports - // the protocol. Note that the protocol ID argument is not - // used for matching; if you want to match the protocol ID - // string exactly, you must check for it in your match function. - AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc) - - // RemoveHandler removes the registered handler (if any) for the - // given protocol ID string. - RemoveHandler(protocol string) - - // Protocols returns a list of all registered protocol ID strings. - // Note that the Router may be able to handle protocol IDs not - // included in this list if handlers were added with match functions - // using AddHandlerWithFunc. - Protocols() []string -} - -// Negotiator is a component capable of reaching agreement over what protocols -// to use for inbound streams of communication. -type Negotiator interface { - - // NegotiateLazy will return the registered protocol handler to use - // for a given inbound stream, returning as soon as the protocol has been - // determined. Returns an error if negotiation fails. - // - // NegotiateLazy may return before all protocol negotiation responses have been - // written to the stream. This is in contrast to Negotiate, which will block until - // the Negotiator is finished with the stream. - NegotiateLazy(rwc io.ReadWriteCloser) (io.ReadWriteCloser, string, HandlerFunc, error) - - // Negotiate will return the registered protocol handler to use for a given - // inbound stream, returning after the protocol has been determined and the - // Negotiator has finished using the stream for negotiation. Returns an - // error if negotiation fails. - Negotiate(rwc io.ReadWriteCloser) (string, HandlerFunc, error) - - // Handle calls Negotiate to determine which protocol handler to use for an - // inbound stream, then invokes the protocol handler function, passing it - // the protocol ID and the stream. Returns an error if negotiation fails. - Handle(rwc io.ReadWriteCloser) error -} - -// Switch is the component responsible for "dispatching" incoming stream requests to -// their corresponding stream handlers. It is both a Negotiator and a Router. -type Switch interface { - Router - Negotiator -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/routing/options.go b/vendor/github.com/libp2p/go-libp2p-core/routing/options.go deleted file mode 100644 index 4b235cbf..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/routing/options.go +++ /dev/null @@ -1,50 +0,0 @@ -package routing - -// Option is a single routing option. -type Option func(opts *Options) error - -// Options is a set of routing options -type Options struct { - // Allow expired values. - Expired bool - Offline bool - // Other (ValueStore implementation specific) options. - Other map[interface{}]interface{} -} - -// Apply applies the given options to this Options -func (opts *Options) Apply(options ...Option) error { - for _, o := range options { - if err := o(opts); err != nil { - return err - } - } - return nil -} - -// ToOption converts this Options to a single Option. -func (opts *Options) ToOption() Option { - return func(nopts *Options) error { - *nopts = *opts - if opts.Other != nil { - nopts.Other = make(map[interface{}]interface{}, len(opts.Other)) - for k, v := range opts.Other { - nopts.Other[k] = v - } - } - return nil - } -} - -// Expired is an option that tells the routing system to return expired records -// when no newer records are known. -var Expired Option = func(opts *Options) error { - opts.Expired = true - return nil -} - -// Offline is an option that tells the routing system to operate offline (i.e., rely on cached/local data only). -var Offline Option = func(opts *Options) error { - opts.Offline = true - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/routing/query.go b/vendor/github.com/libp2p/go-libp2p-core/routing/query.go deleted file mode 100644 index 3769d1c2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/routing/query.go +++ /dev/null @@ -1,86 +0,0 @@ -package routing - -import ( - "context" - "sync" - - "github.com/libp2p/go-libp2p-core/peer" -) - -type QueryEventType int - -// Number of events to buffer. -var QueryEventBufferSize = 16 - -const ( - SendingQuery QueryEventType = iota - PeerResponse - FinalPeer - QueryError - Provider - Value - AddingPeer - DialingPeer -) - -type QueryEvent struct { - ID peer.ID - Type QueryEventType - Responses []*peer.AddrInfo - Extra string -} - -type routingQueryKey struct{} -type eventChannel struct { - mu sync.Mutex - ctx context.Context - ch chan<- *QueryEvent -} - -// waitThenClose is spawned in a goroutine when the channel is registered. This -// safely cleans up the channel when the context has been canceled. -func (e *eventChannel) waitThenClose() { - <-e.ctx.Done() - e.mu.Lock() - close(e.ch) - // 1. Signals that we're done. - // 2. Frees memory (in case we end up hanging on to this for a while). - e.ch = nil - e.mu.Unlock() -} - -// send sends an event on the event channel, aborting if either the passed or -// the internal context expire. -func (e *eventChannel) send(ctx context.Context, ev *QueryEvent) { - e.mu.Lock() - // Closed. - if e.ch == nil { - e.mu.Unlock() - return - } - // in case the passed context is unrelated, wait on both. - select { - case e.ch <- ev: - case <-e.ctx.Done(): - case <-ctx.Done(): - } - e.mu.Unlock() -} - -func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *QueryEvent) { - ch := make(chan *QueryEvent, QueryEventBufferSize) - ech := &eventChannel{ch: ch, ctx: ctx} - go ech.waitThenClose() - return context.WithValue(ctx, routingQueryKey{}, ech), ch -} - -func PublishQueryEvent(ctx context.Context, ev *QueryEvent) { - ich := ctx.Value(routingQueryKey{}) - if ich == nil { - return - } - - // We *want* to panic here. - ech := ich.(*eventChannel) - ech.send(ctx, ev) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/routing/query_serde.go b/vendor/github.com/libp2p/go-libp2p-core/routing/query_serde.go deleted file mode 100644 index c7423ffe..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/routing/query_serde.go +++ /dev/null @@ -1,40 +0,0 @@ -package routing - -import ( - "encoding/json" - - "github.com/libp2p/go-libp2p-core/peer" -) - -func (qe *QueryEvent) MarshalJSON() ([]byte, error) { - return json.Marshal(map[string]interface{}{ - "ID": peer.IDB58Encode(qe.ID), - "Type": int(qe.Type), - "Responses": qe.Responses, - "Extra": qe.Extra, - }) -} - -func (qe *QueryEvent) UnmarshalJSON(b []byte) error { - temp := struct { - ID string - Type int - Responses []*peer.AddrInfo - Extra string - }{} - err := json.Unmarshal(b, &temp) - if err != nil { - return err - } - if len(temp.ID) > 0 { - pid, err := peer.IDB58Decode(temp.ID) - if err != nil { - return err - } - qe.ID = pid - } - qe.Type = QueryEventType(temp.Type) - qe.Responses = temp.Responses - qe.Extra = temp.Extra - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/routing/routing.go b/vendor/github.com/libp2p/go-libp2p-core/routing/routing.go deleted file mode 100644 index c7078054..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/routing/routing.go +++ /dev/null @@ -1,125 +0,0 @@ -// Package routing provides interfaces for peer routing and content routing in libp2p. -package routing - -import ( - "context" - "errors" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - - cid "github.com/ipfs/go-cid" -) - -// ErrNotFound is returned when the router fails to find the requested record. -var ErrNotFound = errors.New("routing: not found") - -// ErrNotSupported is returned when the router doesn't support the given record -// type/operation. -var ErrNotSupported = errors.New("routing: operation or key not supported") - -// ContentRouting is a value provider layer of indirection. It is used to find -// information about who has what content. -// -// Content is identified by CID (content identifier), which encodes a hash -// of the identified content in a future-proof manner. -type ContentRouting interface { - // Provide adds the given cid to the content routing system. If 'true' is - // passed, it also announces it, otherwise it is just kept in the local - // accounting of which objects are being provided. - Provide(context.Context, cid.Cid, bool) error - - // Search for peers who are able to provide a given key - FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.AddrInfo -} - -// PeerRouting is a way to find address information about certain peers. -// This can be implemented by a simple lookup table, a tracking server, -// or even a DHT. -type PeerRouting interface { - // Find specific Peer - // FindPeer searches for a peer with given ID, returns a peer.AddrInfo - // with relevant addresses. - FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) -} - -// ValueStore is a basic Put/Get interface. -type ValueStore interface { - - // PutValue adds value corresponding to given Key. - PutValue(context.Context, string, []byte, ...Option) error - - // GetValue searches for the value corresponding to given Key. - GetValue(context.Context, string, ...Option) ([]byte, error) - - // SearchValue searches for better and better values from this value - // store corresponding to the given Key. By default implementations must - // stop the search after a good value is found. A 'good' value is a value - // that would be returned from GetValue. - // - // Useful when you want a result *now* but still want to hear about - // better/newer results. - // - // Implementations of this methods won't return ErrNotFound. When a value - // couldn't be found, the channel will get closed without passing any results - SearchValue(context.Context, string, ...Option) (<-chan []byte, error) -} - -// Routing is the combination of different routing types supported by libp2p. -// It can be satisfied by a single item (such as a DHT) or multiple different -// pieces that are more optimized to each task. -type Routing interface { - ContentRouting - PeerRouting - ValueStore - - // Bootstrap allows callers to hint to the routing system to get into a - // Boostrapped state and remain there. It is not a synchronous call. - Bootstrap(context.Context) error - - // TODO expose io.Closer or plain-old Close error -} - -// PubKeyFetcher is an interfaces that should be implemented by value stores -// that can optimize retrieval of public keys. -// -// TODO(steb): Consider removing, see https://github.com/libp2p/go-libp2p-routing/issues/22. -type PubKeyFetcher interface { - // GetPublicKey returns the public key for the given peer. - GetPublicKey(context.Context, peer.ID) (ci.PubKey, error) -} - -// KeyForPublicKey returns the key used to retrieve public keys -// from a value store. -func KeyForPublicKey(id peer.ID) string { - return "/pk/" + string(id) -} - -// GetPublicKey retrieves the public key associated with the given peer ID from -// the value store. -// -// If the ValueStore is also a PubKeyFetcher, this method will call GetPublicKey -// (which may be better optimized) instead of GetValue. -func GetPublicKey(r ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) { - switch k, err := p.ExtractPublicKey(); err { - case peer.ErrNoPublicKey: - // check the datastore - case nil: - return k, nil - default: - return nil, err - } - - if dht, ok := r.(PubKeyFetcher); ok { - // If we have a DHT as our routing system, use optimized fetcher - return dht.GetPublicKey(ctx, p) - } - key := KeyForPublicKey(p) - pkval, err := r.GetValue(ctx, key) - if err != nil { - return nil, err - } - - // get PublicKey from node.Data - return ci.UnmarshalPublicKey(pkval) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/sec/insecure/insecure.go b/vendor/github.com/libp2p/go-libp2p-core/sec/insecure/insecure.go deleted file mode 100644 index 801569cb..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/sec/insecure/insecure.go +++ /dev/null @@ -1,90 +0,0 @@ -// Package insecure provides an insecure, unencrypted implementation of the the SecureConn and SecureTransport interfaces. -// -// Recommended only for testing and other non-production usage. -package insecure - -import ( - "context" - "net" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" - - ci "github.com/libp2p/go-libp2p-core/crypto" -) - -// ID is the multistream-select protocol ID that should be used when identifying -// this security transport. -const ID = "/plaintext/1.0.0" - -// Transport is a no-op stream security transport. It provides no -// security and simply mocks the security and identity methods to -// return peer IDs known ahead of time. -type Transport struct { - id peer.ID -} - -// New constructs a new insecure transport. -func New(id peer.ID) *Transport { - return &Transport{ - id: id, - } -} - -// LocalPeer returns the transports local peer ID. -func (t *Transport) LocalPeer() peer.ID { - return t.id -} - -// LocalPrivateKey returns nil. This transport is not secure. -func (t *Transport) LocalPrivateKey() ci.PrivKey { - return nil -} - -// SecureInbound *pretends to secure* an outbound connection to the given peer. -func (t *Transport) SecureInbound(ctx context.Context, insecure net.Conn) (sec.SecureConn, error) { - return &Conn{ - Conn: insecure, - local: t.id, - }, nil -} - -// SecureOutbound *pretends to secure* an outbound connection to the given peer. -func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error) { - return &Conn{ - Conn: insecure, - local: t.id, - remote: p, - }, nil -} - -// Conn is the connection type returned by the insecure transport. -type Conn struct { - net.Conn - local peer.ID - remote peer.ID -} - -// LocalPeer returns the local peer ID. -func (ic *Conn) LocalPeer() peer.ID { - return ic.local -} - -// RemotePeer returns the remote peer ID if we initiated the dial. Otherwise, it -// returns "" (because this connection isn't actually secure). -func (ic *Conn) RemotePeer() peer.ID { - return ic.remote -} - -// RemotePublicKey returns nil. This connection is not secure -func (ic *Conn) RemotePublicKey() ci.PubKey { - return nil -} - -// LocalPrivateKey returns nil. This connection is not secure. -func (ic *Conn) LocalPrivateKey() ci.PrivKey { - return nil -} - -var _ sec.SecureTransport = (*Transport)(nil) -var _ sec.SecureConn = (*Conn)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-core/sec/security.go b/vendor/github.com/libp2p/go-libp2p-core/sec/security.go deleted file mode 100644 index 95c8e6a6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/sec/security.go +++ /dev/null @@ -1,26 +0,0 @@ -// Package sec provides secure connection and transport interfaces for libp2p. -package sec - -import ( - "context" - "net" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" -) - -// SecureConn is an authenticated, encrypted connection. -type SecureConn interface { - net.Conn - network.ConnSecurity -} - -// A SecureTransport turns inbound and outbound unauthenticated, -// plain-text, native connections into authenticated, encrypted connections. -type SecureTransport interface { - // SecureInbound secures an inbound connection. - SecureInbound(ctx context.Context, insecure net.Conn) (SecureConn, error) - - // SecureOutbound secures an outbound connection. - SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (SecureConn, error) -} diff --git a/vendor/github.com/libp2p/go-libp2p-core/transport/transport.go b/vendor/github.com/libp2p/go-libp2p-core/transport/transport.go deleted file mode 100644 index 774b8d82..00000000 --- a/vendor/github.com/libp2p/go-libp2p-core/transport/transport.go +++ /dev/null @@ -1,113 +0,0 @@ -// Package transport provides the Transport interface, which represents -// the devices and network protocols used to send and recieve data. -package transport - -import ( - "context" - "net" - "time" - - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - ma "github.com/multiformats/go-multiaddr" -) - -// DialTimeout is the maximum duration a Dial is allowed to take. -// This includes the time between dialing the raw network connection, -// protocol selection as well the handshake, if applicable. -var DialTimeout = 60 * time.Second - -// AcceptTimeout is the maximum duration an Accept is allowed to take. -// This includes the time between accepting the raw network connection, -// protocol selection as well as the handshake, if applicable. -var AcceptTimeout = 60 * time.Second - -// A CapableConn represents a connection that has offers the basic -// capabilities required by libp2p: stream multiplexing, encryption and -// peer authentication. -// -// These capabilities may be natively provided by the transport, or they -// may be shimmed via the "connection upgrade" process, which converts a -// "raw" network connection into one that supports such capabilities by -// layering an encryption channel and a stream multiplexer. -// -// CapableConn provides accessors for the local and remote multiaddrs used to -// establish the connection and an accessor for the underlying Transport. -type CapableConn interface { - mux.MuxedConn - network.ConnSecurity - network.ConnMultiaddrs - - // Transport returns the transport to which this connection belongs. - Transport() Transport -} - -// Transport represents any device by which you can connect to and accept -// connections from other peers. -// -// The Transport interface allows you to open connections to other peers -// by dialing them, and also lets you listen for incoming connections. -// -// Connections returned by Dial and passed into Listeners are of type -// CapableConn, which means that they have been upgraded to support -// stream multiplexing and connection security (encryption and authentication). -// -// For a conceptual overview, see https://docs.libp2p.io/concepts/transport/ -type Transport interface { - // Dial dials a remote peer. It should try to reuse local listener - // addresses if possible but it may choose not to. - Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (CapableConn, error) - - // CanDial returns true if this transport knows how to dial the given - // multiaddr. - // - // Returning true does not guarantee that dialing this multiaddr will - // succeed. This function should *only* be used to preemptively filter - // out addresses that we can't dial. - CanDial(addr ma.Multiaddr) bool - - // Listen listens on the passed multiaddr. - Listen(laddr ma.Multiaddr) (Listener, error) - - // Protocol returns the set of protocols handled by this transport. - // - // See the Network interface for an explanation of how this is used. - Protocols() []int - - // Proxy returns true if this is a proxy transport. - // - // See the Network interface for an explanation of how this is used. - // TODO: Make this a part of the go-multiaddr protocol instead? - Proxy() bool -} - -// Listener is an interface closely resembling the net.Listener interface. The -// only real difference is that Accept() returns Conn's of the type in this -// package, and also exposes a Multiaddr method as opposed to a regular Addr -// method -type Listener interface { - Accept() (CapableConn, error) - Close() error - Addr() net.Addr - Multiaddr() ma.Multiaddr -} - -// Network is an inet.Network with methods for managing transports. -type TransportNetwork interface { - network.Network - - // AddTransport adds a transport to this Network. - // - // When dialing, this Network will iterate over the protocols in the - // remote multiaddr and pick the first protocol registered with a proxy - // transport, if any. Otherwise, it'll pick the transport registered to - // handle the last protocol in the multiaddr. - // - // When listening, this Network will iterate over the protocols in the - // local multiaddr and pick the *last* protocol registered with a proxy - // transport, if any. Otherwise, it'll pick the transport registered to - // handle the last protocol in the multiaddr. - AddTransport(t Transport) error -} diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/.gitignore b/vendor/github.com/libp2p/go-libp2p-crypto/.gitignore deleted file mode 100644 index cc53fd51..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store - -# vim -.swp -*~ -*.swp -*.swo diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/.travis.yml b/vendor/github.com/libp2p/go-libp2p-crypto/.travis.yml deleted file mode 100644 index 97be2f5c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - BUILD_DEPTYPE=gomod - matrix: - - GOTFLAGS="-race" - - GOTFLAGS="-race -tags=openssl" - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/LICENSE b/vendor/github.com/libp2p/go-libp2p-crypto/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/README.md b/vendor/github.com/libp2p/go-libp2p-crypto/README.md deleted file mode 100644 index 1d61419b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-libp2p-crypto -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-crypto?status.svg)](https://godoc.org/github.com/ipfs/go-libp2p-crypto) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-crypto.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-crypto) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> Various cryptographic utilities used by ipfs - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) - - [Want to hack on IPFS?](#want-to-hack-on-ipfs) -- [License](#license) - -## Install - -```sh -go get github.com/libp2p/go-libp2p-crypto -``` - -## Usage - -Go to https://godoc.org/github.com/libp2p/go-libp2p-crypto. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-crypto/issues)! - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2016 Jeromy Johnson - ---- - -The last gx published version of this module was: 2.0.7: QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/codecov.yml b/vendor/github.com/libp2p/go-libp2p-crypto/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/ecdsa_deprecated.go b/vendor/github.com/libp2p/go-libp2p-crypto/ecdsa_deprecated.go deleted file mode 100644 index f37d6618..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/ecdsa_deprecated.go +++ /dev/null @@ -1,64 +0,0 @@ -package crypto - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "io" - - core "github.com/libp2p/go-libp2p-core/crypto" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSAPrivateKey instead. -type ECDSAPrivateKey = core.ECDSAPrivateKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSAPublicKey instead. -type ECDSAPublicKey = core.ECDSAPublicKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSASig instead. -type ECDSASig = core.ECDSASig - -var ( - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ErrNotECDSAPubKey instead. - ErrNotECDSAPubKey = core.ErrNotECDSAPubKey - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ErrNilSig instead. - ErrNilSig = core.ErrNilSig - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ErrNilPrivateKey instead. - ErrNilPrivateKey = core.ErrNilPrivateKey - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSACurve instead. - ECDSACurve = core.ECDSACurve -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateECDSAKeyPair instead. -func GenerateECDSAKeyPair(src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateECDSAKeyPair(src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateECDSAKeyPairWithCurve instead. -func GenerateECDSAKeyPairWithCurve(curve elliptic.Curve, src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateECDSAKeyPairWithCurve(curve, src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSAKeyPairFromKey instead. -func ECDSAKeyPairFromKey(priv *ecdsa.PrivateKey) (PrivKey, PubKey, error) { - return core.ECDSAKeyPairFromKey(priv) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.MarshalECDSAPrivateKey instead. -func MarshalECDSAPrivateKey(ePriv ECDSAPrivateKey) ([]byte, error) { - return core.MarshalECDSAPrivateKey(ePriv) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.MarshalECDSAPublicKey instead. -func MarshalECDSAPublicKey(ePub ECDSAPublicKey) ([]byte, error) { - return core.MarshalECDSAPublicKey(ePub) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalECDSAPrivateKey instead. -func UnmarshalECDSAPrivateKey(data []byte) (PrivKey, error) { - return core.UnmarshalECDSAPrivateKey(data) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalECDSAPublicKey instead. -func UnmarshalECDSAPublicKey(data []byte) (PubKey, error) { - return core.UnmarshalECDSAPublicKey(data) -} diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/ed25519_deprecated.go b/vendor/github.com/libp2p/go-libp2p-crypto/ed25519_deprecated.go deleted file mode 100644 index 3d9a4b47..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/ed25519_deprecated.go +++ /dev/null @@ -1,28 +0,0 @@ -package crypto - -import ( - "io" - - core "github.com/libp2p/go-libp2p-core/crypto" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Ed25519PrivateKey instead. -type Ed25519PrivateKey = core.Ed25519PrivateKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Ed25519PublicKey instead. -type Ed25519PublicKey = core.Ed25519PublicKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateEd25519Key instead. -func GenerateEd25519Key(src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateEd25519Key(src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalEd25519PublicKey instead. -func UnmarshalEd25519PublicKey(data []byte) (PubKey, error) { - return core.UnmarshalEd25519PublicKey(data) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalEd25519PrivateKey instead. -func UnmarshalEd25519PrivateKey(data []byte) (PrivKey, error) { - return core.UnmarshalEd25519PrivateKey(data) -} diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/go.mod b/vendor/github.com/libp2p/go-libp2p-crypto/go.mod deleted file mode 100644 index 38a007ab..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/libp2p/go-libp2p-crypto - -require github.com/libp2p/go-libp2p-core v0.0.1 diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/go.sum b/vendor/github.com/libp2p/go-libp2p-crypto/go.sum deleted file mode 100644 index 669c0351..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/go.sum +++ /dev/null @@ -1,67 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/key_deprecated.go b/vendor/github.com/libp2p/go-libp2p-crypto/key_deprecated.go deleted file mode 100644 index 57342690..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/key_deprecated.go +++ /dev/null @@ -1,108 +0,0 @@ -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto instead. -package crypto - -import ( - "io" - - core "github.com/libp2p/go-libp2p-core/crypto" -) - -const ( - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.RSA instead. - RSA = core.RSA - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Ed25519 instead. - Ed25519 = core.Ed25519 - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Secp256k1 instead. - Secp256k1 = core.Secp256k1 - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ECDSA instead. - ECDSA = core.ECDSA -) - -var ( - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ErrBadKeyType instead. - ErrBadKeyType = core.ErrBadKeyType - // Deprecated: use github.com/libp2p/go-libp2p-core/crypto.KeyTypes instead. - KeyTypes = core.KeyTypes -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PubKeyUnmarshaller instead. -type PubKeyUnmarshaller = core.PubKeyUnmarshaller - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PrivKeyUnmarshaller instead. -type PrivKeyUnmarshaller = core.PrivKeyUnmarshaller - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PubKeyUnmarshallers instead. -var PubKeyUnmarshallers = core.PubKeyUnmarshallers - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PrivKeyUnmarshallers instead. -var PrivKeyUnmarshallers = core.PrivKeyUnmarshallers - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Key instead. -type Key = core.Key - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PrivKey instead. -type PrivKey = core.PrivKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.PubKey instead. -type PubKey = core.PubKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenSharedKey instead. -type GenSharedKey = core.GenSharedKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateKeyPair instead. -func GenerateKeyPair(typ, bits int) (PrivKey, PubKey, error) { - return core.GenerateKeyPair(typ, bits) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateKeyPairWithReader instead. -func GenerateKeyPairWithReader(typ, bits int, src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateKeyPairWithReader(typ, bits, src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateEKeyPair instead. -func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) { - return core.GenerateEKeyPair(curveName) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenSharedKey instead. -type StretchedKeys = core.StretchedKeys - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.KeyStretcher instead. -func KeyStretcher(cipherType string, hashType string, secret []byte) (StretchedKeys, StretchedKeys) { - return core.KeyStretcher(cipherType, hashType, secret) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalPublicKey instead. -func UnmarshalPublicKey(data []byte) (PubKey, error) { - return core.UnmarshalPublicKey(data) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.MarshalPublicKey instead. -func MarshalPublicKey(k PubKey) ([]byte, error) { - return core.MarshalPublicKey(k) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalPrivateKey instead. -func UnmarshalPrivateKey(data []byte) (PrivKey, error) { - return core.UnmarshalPrivateKey(data) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.MarshalPrivateKey instead. -func MarshalPrivateKey(k PrivKey) ([]byte, error) { - return core.MarshalPrivateKey(k) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ConfigDecodeKey instead. -func ConfigDecodeKey(b string) ([]byte, error) { - return core.ConfigDecodeKey(b) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ConfigEncodeKey instead. -func ConfigEncodeKey(b []byte) string { - return core.ConfigEncodeKey(b) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.KeyEqual instead. -func KeyEqual(k1, k2 Key) bool { - return core.KeyEqual(k1, k2) -} diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/rsa_deprecated.go b/vendor/github.com/libp2p/go-libp2p-crypto/rsa_deprecated.go deleted file mode 100644 index 8c3e4c4c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/rsa_deprecated.go +++ /dev/null @@ -1,31 +0,0 @@ -package crypto - -import ( - "io" - - core "github.com/libp2p/go-libp2p-core/crypto" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.ErrRsaKeyTooSmall instead. -var ErrRsaKeyTooSmall = core.ErrRsaKeyTooSmall - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.RsaPrivateKey instead. -type RsaPrivateKey = core.RsaPrivateKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.RsaPublicKey instead. -type RsaPublicKey = core.RsaPublicKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateRSAKeyPair instead. -func GenerateRSAKeyPair(bits int, src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateRSAKeyPair(bits, src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalRsaPrivateKey instead. -func UnmarshalRsaPrivateKey(b []byte) (PrivKey, error) { - return core.UnmarshalRsaPrivateKey(b) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalRsaPublicKey instead. -func UnmarshalRsaPublicKey(b []byte) (PubKey, error) { - return core.UnmarshalRsaPublicKey(b) -} diff --git a/vendor/github.com/libp2p/go-libp2p-crypto/secp256k1_deprecated.go b/vendor/github.com/libp2p/go-libp2p-crypto/secp256k1_deprecated.go deleted file mode 100644 index 741321c2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-crypto/secp256k1_deprecated.go +++ /dev/null @@ -1,28 +0,0 @@ -package crypto - -import ( - "io" - - core "github.com/libp2p/go-libp2p-core/crypto" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Secp256k1PrivateKey instead. -type Secp256k1PrivateKey = core.Secp256k1PrivateKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.Secp256k1PublicKey instead. -type Secp256k1PublicKey = core.Secp256k1PublicKey - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.GenerateSecp256k1Key instead. -func GenerateSecp256k1Key(src io.Reader) (PrivKey, PubKey, error) { - return core.GenerateSecp256k1Key(src) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalSecp256k1PrivateKey instead. -func UnmarshalSecp256k1PrivateKey(data []byte) (PrivKey, error) { - return core.UnmarshalSecp256k1PrivateKey(data) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/crypto.UnmarshalSecp256k1PublicKey instead. -func UnmarshalSecp256k1PublicKey(data []byte) (PubKey, error) { - return core.UnmarshalSecp256k1PublicKey(data) -} diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/.gitignore b/vendor/github.com/libp2p/go-libp2p-discovery/.gitignore deleted file mode 100644 index f1c181ec..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/.travis.yml b/vendor/github.com/libp2p/go-libp2p-discovery/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/LICENSE b/vendor/github.com/libp2p/go-libp2p-discovery/LICENSE deleted file mode 100644 index 3f05397b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 libp2p - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/README.md b/vendor/github.com/libp2p/go-libp2p-discovery/README.md deleted file mode 100644 index 4ab7fe40..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# go-libp2p-discovery - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> Interfaces for active peer discovery - -This package contains interfaces and utilities for active peer discovery. -Peers providing a service use the interface to advertise their presence in some namespace. -Vice versa, peers seeking a service use the interface to discover peers that have previously advertised -as service providers. -The package also includes a baseline implementation for discovery through [Content Routing](https://github.com/libp2p/go-libp2p-routing). - -## Documenation - -See https://godoc.org/github.com/libp2p/go-libp2p-discovery. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-discovery/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -## License - -MIT - ---- - -The last gx published version of this module was: 1.0.15: QmWA8k8apx6egshEjemkuxpKNJS7W7heCgzTnBhAvX9yoB diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/deprecated.go b/vendor/github.com/libp2p/go-libp2p-discovery/deprecated.go deleted file mode 100644 index 7ad4149e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/deprecated.go +++ /dev/null @@ -1,32 +0,0 @@ -package discovery - -import ( - "time" - - core "github.com/libp2p/go-libp2p-core/discovery" -) - -// Deprecated: use skel.Advertiser instead. -type Advertiser = core.Advertiser - -// Deprecated: use skel.Discoverer instead. -type Discoverer = core.Discoverer - -// Deprecated: use skel.Discovery instead. -type Discovery = core.Discovery - -// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Option instead. -type Option = core.Option - -// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Options instead. -type Options = core.Options - -// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.TTL instead. -func TTL(ttl time.Duration) core.Option { - return core.TTL(ttl) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/discovery.Limit instead. -func Limit(limit int) core.Option { - return core.Limit(limit) -} diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/go.mod b/vendor/github.com/libp2p/go-libp2p-discovery/go.mod deleted file mode 100644 index f8ea495a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/libp2p/go-libp2p-discovery - -require ( - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/multiformats/go-multihash v0.0.5 -) diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/go.sum b/vendor/github.com/libp2p/go-libp2p-discovery/go.sum deleted file mode 100644 index eed16efc..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/go.sum +++ /dev/null @@ -1,227 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/routing.go b/vendor/github.com/libp2p/go-libp2p-discovery/routing.go deleted file mode 100644 index 70e70870..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/routing.go +++ /dev/null @@ -1,85 +0,0 @@ -package discovery - -import ( - "context" - "time" - - cid "github.com/ipfs/go-cid" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - mh "github.com/multiformats/go-multihash" -) - -// RoutingDiscovery is an implementation of discovery using ContentRouting -// Namespaces are translated to Cids using the SHA256 hash. -type RoutingDiscovery struct { - routing.ContentRouting -} - -func NewRoutingDiscovery(router routing.ContentRouting) *RoutingDiscovery { - return &RoutingDiscovery{router} -} - -func (d *RoutingDiscovery) Advertise(ctx context.Context, ns string, opts ...Option) (time.Duration, error) { - var options Options - err := options.Apply(opts...) - if err != nil { - return 0, err - } - - ttl := options.Ttl - if ttl == 0 || ttl > 3*time.Hour { - // the DHT provider record validity is 24hrs, but it is recommnded to republish at least every 6hrs - // we go one step further and republish every 3hrs - ttl = 3 * time.Hour - } - - cid, err := nsToCid(ns) - if err != nil { - return 0, err - } - - // this context requires a timeout; it determines how long the DHT looks for - // closest peers to the key/CID before it goes on to provide the record to them. - // Not setting a timeout here will make the DHT wander forever. - pctx, cancel := context.WithTimeout(ctx, 60*time.Second) - defer cancel() - - err = d.Provide(pctx, cid, true) - if err != nil { - return 0, err - } - - return ttl, nil -} - -func (d *RoutingDiscovery) FindPeers(ctx context.Context, ns string, opts ...Option) (<-chan peer.AddrInfo, error) { - var options Options - err := options.Apply(opts...) - if err != nil { - return nil, err - } - - limit := options.Limit - if limit == 0 { - limit = 100 // that's just arbitrary, but FindProvidersAsync needs a count - } - - cid, err := nsToCid(ns) - if err != nil { - return nil, err - } - - return d.FindProvidersAsync(ctx, cid, limit), nil -} - -func nsToCid(ns string) (cid.Cid, error) { - h, err := mh.Sum([]byte(ns), mh.SHA2_256, -1) - if err != nil { - return cid.Undef, err - } - - return cid.NewCidV1(cid.Raw, h), nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-discovery/util.go b/vendor/github.com/libp2p/go-libp2p-discovery/util.go deleted file mode 100644 index f2f2d2b0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-discovery/util.go +++ /dev/null @@ -1,57 +0,0 @@ -package discovery - -import ( - "context" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("discovery") - -// FindPeers is a utility function that synchronously collects peers from a Discoverer. -func FindPeers(ctx context.Context, d Discoverer, ns string, opts ...Option) ([]peer.AddrInfo, error) { - var res []peer.AddrInfo - - ch, err := d.FindPeers(ctx, ns, opts...) - if err != nil { - return nil, err - } - - for pi := range ch { - res = append(res, pi) - } - - return res, nil -} - -// Advertise is a utility function that persistently advertises a service through an Advertiser. -func Advertise(ctx context.Context, a Advertiser, ns string, opts ...Option) { - go func() { - for { - ttl, err := a.Advertise(ctx, ns, opts...) - if err != nil { - log.Debugf("Error advertising %s: %s", ns, err.Error()) - if ctx.Err() != nil { - return - } - - select { - case <-time.After(2 * time.Minute): - continue - case <-ctx.Done(): - return - } - } - - wait := 7 * ttl / 8 - select { - case <-time.After(wait): - case <-ctx.Done(): - return - } - } - }() -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/.travis.yml b/vendor/github.com/libp2p/go-libp2p-kad-dht/.travis.yml deleted file mode 100644 index ea3900d9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.12.x - -env: - global: - - GOTFLAGS="-race" - - IPFS_REUSEPORT=false - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/LICENSE b/vendor/github.com/libp2p/go-libp2p-kad-dht/LICENSE deleted file mode 100644 index 0e323020..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Protocol Labs, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/README.md b/vendor/github.com/libp2p/go-libp2p-kad-dht/README.md deleted file mode 100644 index c774998a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# go-libp2p-kad-dht - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23yellow) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-kad-dht?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-kad-dht) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-kad-dht.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-kad-dht) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A Kademlia DHT implementation on go-libp2p - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -go get github.com/libp2p/go-libp2p-kad-dht -``` - -## Usage - -Go to https://godoc.org/github.com/libp2p/go-libp2p-kad-dht. - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/libp2p/go-libp2p-kad-dht/issues). - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © Protocol Labs Inc. - ---- - -The last gx published version of this module was: 4.4.34: QmXuNFLZc6Nb5akB4sZsxK3doShsFKT1sZFvxLXJvZQwAW diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/codecov.yml b/vendor/github.com/libp2p/go-libp2p-kad-dht/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/dht.go deleted file mode 100644 index da3c5cc3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht.go +++ /dev/null @@ -1,439 +0,0 @@ -package dht - -import ( - "bytes" - "context" - "errors" - "fmt" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/protocol" - "github.com/libp2p/go-libp2p-core/routing" - - "go.opencensus.io/tag" - "golang.org/x/xerrors" - - "github.com/libp2p/go-libp2p-kad-dht/metrics" - opts "github.com/libp2p/go-libp2p-kad-dht/opts" - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - providers "github.com/libp2p/go-libp2p-kad-dht/providers" - - proto "github.com/gogo/protobuf/proto" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" - goprocessctx "github.com/jbenet/goprocess/context" - kb "github.com/libp2p/go-libp2p-kbucket" - record "github.com/libp2p/go-libp2p-record" - recpb "github.com/libp2p/go-libp2p-record/pb" - base32 "github.com/whyrusleeping/base32" -) - -var logger = logging.Logger("dht") - -// NumBootstrapQueries defines the number of random dht queries to do to -// collect members of the routing table. -const NumBootstrapQueries = 5 - -// IpfsDHT is an implementation of Kademlia with S/Kademlia modifications. -// It is used to implement the base Routing module. -type IpfsDHT struct { - host host.Host // the network services we need - self peer.ID // Local peer (yourself) - peerstore peerstore.Peerstore // Peer Registry - - datastore ds.Datastore // Local data - - routingTable *kb.RoutingTable // Array of routing tables for differently distanced nodes - providers *providers.ProviderManager - - birth time.Time // When this peer started up - - Validator record.Validator - - ctx context.Context - proc goprocess.Process - - strmap map[peer.ID]*messageSender - smlk sync.Mutex - - plk sync.Mutex - - protocols []protocol.ID // DHT protocols -} - -// Assert that IPFS assumptions about interfaces aren't broken. These aren't a -// guarantee, but we can use them to aid refactoring. -var ( - _ routing.ContentRouting = (*IpfsDHT)(nil) - _ routing.Routing = (*IpfsDHT)(nil) - _ routing.PeerRouting = (*IpfsDHT)(nil) - _ routing.PubKeyFetcher = (*IpfsDHT)(nil) - _ routing.ValueStore = (*IpfsDHT)(nil) -) - -// New creates a new DHT with the specified host and options. -func New(ctx context.Context, h host.Host, options ...opts.Option) (*IpfsDHT, error) { - var cfg opts.Options - if err := cfg.Apply(append([]opts.Option{opts.Defaults}, options...)...); err != nil { - return nil, err - } - dht := makeDHT(ctx, h, cfg.Datastore, cfg.Protocols) - - // register for network notifs. - dht.host.Network().Notify((*netNotifiee)(dht)) - - dht.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { - // remove ourselves from network notifs. - dht.host.Network().StopNotify((*netNotifiee)(dht)) - return nil - }) - - dht.proc.AddChild(dht.providers.Process()) - dht.Validator = cfg.Validator - - if !cfg.Client { - for _, p := range cfg.Protocols { - h.SetStreamHandler(p, dht.handleNewStream) - } - } - return dht, nil -} - -// NewDHT creates a new DHT object with the given peer as the 'local' host. -// IpfsDHT's initialized with this function will respond to DHT requests, -// whereas IpfsDHT's initialized with NewDHTClient will not. -func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT { - dht, err := New(ctx, h, opts.Datastore(dstore)) - if err != nil { - panic(err) - } - return dht -} - -// NewDHTClient creates a new DHT object with the given peer as the 'local' -// host. IpfsDHT clients initialized with this function will not respond to DHT -// requests. If you need a peer to respond to DHT requests, use NewDHT instead. -// NewDHTClient creates a new DHT object with the given peer as the 'local' host -func NewDHTClient(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT { - dht, err := New(ctx, h, opts.Datastore(dstore), opts.Client(true)) - if err != nil { - panic(err) - } - return dht -} - -func makeDHT(ctx context.Context, h host.Host, dstore ds.Batching, protocols []protocol.ID) *IpfsDHT { - rt := kb.NewRoutingTable(KValue, kb.ConvertPeerID(h.ID()), time.Minute, h.Peerstore()) - - cmgr := h.ConnManager() - rt.PeerAdded = func(p peer.ID) { - cmgr.TagPeer(p, "kbucket", 5) - } - rt.PeerRemoved = func(p peer.ID) { - cmgr.UntagPeer(p, "kbucket") - } - - dht := &IpfsDHT{ - datastore: dstore, - self: h.ID(), - peerstore: h.Peerstore(), - host: h, - strmap: make(map[peer.ID]*messageSender), - ctx: ctx, - providers: providers.NewProviderManager(ctx, h.ID(), dstore), - birth: time.Now(), - routingTable: rt, - protocols: protocols, - } - - dht.ctx = dht.newContextWithLocalTags(ctx) - - return dht -} - -// putValueToPeer stores the given key/value pair at the peer 'p' -func (dht *IpfsDHT) putValueToPeer(ctx context.Context, p peer.ID, rec *recpb.Record) error { - - pmes := pb.NewMessage(pb.Message_PUT_VALUE, rec.Key, 0) - pmes.Record = rec - rpmes, err := dht.sendRequest(ctx, p, pmes) - if err != nil { - logger.Debugf("putValueToPeer: %v. (peer: %s, key: %s)", err, p.Pretty(), loggableKey(string(rec.Key))) - return err - } - - if !bytes.Equal(rpmes.GetRecord().Value, pmes.GetRecord().Value) { - logger.Warningf("putValueToPeer: value not put correctly. (%v != %v)", pmes, rpmes) - return errors.New("value not put correctly") - } - - return nil -} - -var errInvalidRecord = errors.New("received invalid record") - -// getValueOrPeers queries a particular peer p for the value for -// key. It returns either the value or a list of closer peers. -// NOTE: It will update the dht's peerstore with any new addresses -// it finds for the given peer. -func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.ID, key string) (*recpb.Record, []*peer.AddrInfo, error) { - - pmes, err := dht.getValueSingle(ctx, p, key) - if err != nil { - return nil, nil, err - } - - // Perhaps we were given closer peers - peers := pb.PBPeersToPeerInfos(pmes.GetCloserPeers()) - - if record := pmes.GetRecord(); record != nil { - // Success! We were given the value - logger.Debug("getValueOrPeers: got value") - - // make sure record is valid. - err = dht.Validator.Validate(string(record.GetKey()), record.GetValue()) - if err != nil { - logger.Info("Received invalid record! (discarded)") - // return a sentinal to signify an invalid record was received - err = errInvalidRecord - record = new(recpb.Record) - } - return record, peers, err - } - - if len(peers) > 0 { - logger.Debug("getValueOrPeers: peers") - return nil, peers, nil - } - - logger.Warning("getValueOrPeers: routing.ErrNotFound") - return nil, nil, routing.ErrNotFound -} - -// getValueSingle simply performs the get value RPC with the given parameters -func (dht *IpfsDHT) getValueSingle(ctx context.Context, p peer.ID, key string) (*pb.Message, error) { - meta := logging.LoggableMap{ - "key": key, - "peer": p, - } - - eip := logger.EventBegin(ctx, "getValueSingle", meta) - defer eip.Done() - - pmes := pb.NewMessage(pb.Message_GET_VALUE, []byte(key), 0) - resp, err := dht.sendRequest(ctx, p, pmes) - switch err { - case nil: - return resp, nil - case ErrReadTimeout: - logger.Warningf("getValueSingle: read timeout %s %s", p.Pretty(), key) - fallthrough - default: - eip.SetError(err) - return nil, err - } -} - -// getLocal attempts to retrieve the value from the datastore -func (dht *IpfsDHT) getLocal(key string) (*recpb.Record, error) { - logger.Debugf("getLocal %s", key) - rec, err := dht.getRecordFromDatastore(mkDsKey(key)) - if err != nil { - logger.Warningf("getLocal: %s", err) - return nil, err - } - - // Double check the key. Can't hurt. - if rec != nil && string(rec.GetKey()) != key { - logger.Errorf("BUG getLocal: found a DHT record that didn't match it's key: %s != %s", rec.GetKey(), key) - return nil, nil - - } - return rec, nil -} - -// putLocal stores the key value pair in the datastore -func (dht *IpfsDHT) putLocal(key string, rec *recpb.Record) error { - logger.Debugf("putLocal: %v %v", key, rec) - data, err := proto.Marshal(rec) - if err != nil { - logger.Warningf("putLocal: %s", err) - return err - } - - return dht.datastore.Put(mkDsKey(key), data) -} - -// Update signals the routingTable to Update its last-seen status -// on the given peer. -func (dht *IpfsDHT) Update(ctx context.Context, p peer.ID) { - logger.Event(ctx, "updatePeer", p) - dht.routingTable.Update(p) -} - -// FindLocal looks for a peer with a given ID connected to this dht and returns the peer and the table it was found in. -func (dht *IpfsDHT) FindLocal(id peer.ID) peer.AddrInfo { - switch dht.host.Network().Connectedness(id) { - case network.Connected, network.CanConnect: - return dht.peerstore.PeerInfo(id) - default: - return peer.AddrInfo{} - } -} - -// findPeerSingle asks peer 'p' if they know where the peer with id 'id' is -func (dht *IpfsDHT) findPeerSingle(ctx context.Context, p peer.ID, id peer.ID) (*pb.Message, error) { - eip := logger.EventBegin(ctx, "findPeerSingle", - logging.LoggableMap{ - "peer": p, - "target": id, - }) - defer eip.Done() - - pmes := pb.NewMessage(pb.Message_FIND_NODE, []byte(id), 0) - resp, err := dht.sendRequest(ctx, p, pmes) - switch err { - case nil: - return resp, nil - case ErrReadTimeout: - logger.Warningf("read timeout: %s %s", p.Pretty(), id) - fallthrough - default: - eip.SetError(err) - return nil, err - } -} - -func (dht *IpfsDHT) findProvidersSingle(ctx context.Context, p peer.ID, key cid.Cid) (*pb.Message, error) { - eip := logger.EventBegin(ctx, "findProvidersSingle", p, key) - defer eip.Done() - - pmes := pb.NewMessage(pb.Message_GET_PROVIDERS, key.Bytes(), 0) - resp, err := dht.sendRequest(ctx, p, pmes) - switch err { - case nil: - return resp, nil - case ErrReadTimeout: - logger.Warningf("read timeout: %s %s", p.Pretty(), key) - fallthrough - default: - eip.SetError(err) - return nil, err - } -} - -// nearestPeersToQuery returns the routing tables closest peers. -func (dht *IpfsDHT) nearestPeersToQuery(pmes *pb.Message, count int) []peer.ID { - closer := dht.routingTable.NearestPeers(kb.ConvertKey(string(pmes.GetKey())), count) - return closer -} - -// betterPeersToQuery returns nearestPeersToQuery, but if and only if closer than self. -func (dht *IpfsDHT) betterPeersToQuery(pmes *pb.Message, p peer.ID, count int) []peer.ID { - closer := dht.nearestPeersToQuery(pmes, count) - - // no node? nil - if closer == nil { - logger.Warning("betterPeersToQuery: no closer peers to send:", p) - return nil - } - - filtered := make([]peer.ID, 0, len(closer)) - for _, clp := range closer { - - // == to self? thats bad - if clp == dht.self { - logger.Error("BUG betterPeersToQuery: attempted to return self! this shouldn't happen...") - return nil - } - // Dont send a peer back themselves - if clp == p { - continue - } - - filtered = append(filtered, clp) - } - - // ok seems like closer nodes - return filtered -} - -// Context return dht's context -func (dht *IpfsDHT) Context() context.Context { - return dht.ctx -} - -// Process return dht's process -func (dht *IpfsDHT) Process() goprocess.Process { - return dht.proc -} - -// RoutingTable return dht's routingTable -func (dht *IpfsDHT) RoutingTable() *kb.RoutingTable { - return dht.routingTable -} - -// Close calls Process Close -func (dht *IpfsDHT) Close() error { - return dht.proc.Close() -} - -func (dht *IpfsDHT) protocolStrs() []string { - pstrs := make([]string, len(dht.protocols)) - for idx, proto := range dht.protocols { - pstrs[idx] = string(proto) - } - - return pstrs -} - -func mkDsKey(s string) ds.Key { - return ds.NewKey(base32.RawStdEncoding.EncodeToString([]byte(s))) -} - -func (dht *IpfsDHT) PeerID() peer.ID { - return dht.self -} - -func (dht *IpfsDHT) PeerKey() []byte { - return kb.ConvertPeerID(dht.self) -} - -func (dht *IpfsDHT) Host() host.Host { - return dht.host -} - -func (dht *IpfsDHT) Ping(ctx context.Context, p peer.ID) error { - req := pb.NewMessage(pb.Message_PING, nil, 0) - resp, err := dht.sendRequest(ctx, p, req) - if err != nil { - return xerrors.Errorf("sending request: %w", err) - } - if resp.Type != pb.Message_PING { - return xerrors.Errorf("got unexpected response type: %v", resp.Type) - } - return nil -} - -// newContextWithLocalTags returns a new context.Context with the InstanceID and -// PeerID keys populated. It will also take any extra tags that need adding to -// the context as tag.Mutators. -func (dht *IpfsDHT) newContextWithLocalTags(ctx context.Context, extraTags ...tag.Mutator) context.Context { - extraTags = append( - extraTags, - tag.Upsert(metrics.KeyPeerID, dht.self.Pretty()), - tag.Upsert(metrics.KeyInstanceID, fmt.Sprintf("%p", dht)), - ) - ctx, _ = tag.New( - ctx, - extraTags..., - ) // ignoring error as it is unrelated to the actual function of this code. - return ctx -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_bootstrap.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_bootstrap.go deleted file mode 100644 index 0dd18848..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_bootstrap.go +++ /dev/null @@ -1,184 +0,0 @@ -package dht - -import ( - "context" - "crypto/rand" - "fmt" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - u "github.com/ipfs/go-ipfs-util" - "github.com/multiformats/go-multiaddr" - _ "github.com/multiformats/go-multiaddr-dns" -) - -var DefaultBootstrapPeers []multiaddr.Multiaddr - -func init() { - for _, s := range []string{ - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", - "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", - "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", // mars.i.ipfs.io - "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM", // pluto.i.ipfs.io - "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu", // saturn.i.ipfs.io - "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", // venus.i.ipfs.io - "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd", // earth.i.ipfs.io - "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM", // pluto.i.ipfs.io - "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu", // saturn.i.ipfs.io - "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", // venus.i.ipfs.io - "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd", // earth.i.ipfs.io - } { - ma, err := multiaddr.NewMultiaddr(s) - if err != nil { - panic(err) - } - DefaultBootstrapPeers = append(DefaultBootstrapPeers, ma) - } -} - -// BootstrapConfig specifies parameters used bootstrapping the DHT. -// -// Note there is a tradeoff between the bootstrap period and the -// number of queries. We could support a higher period with less -// queries. -type BootstrapConfig struct { - Queries int // how many queries to run per period - Period time.Duration // how often to run periodic bootstrap. - Timeout time.Duration // how long to wait for a bootstrap query to run -} - -var DefaultBootstrapConfig = BootstrapConfig{ - // For now, this is set to 1 query. - // We are currently more interested in ensuring we have a properly formed - // DHT than making sure our dht minimizes traffic. Once we are more certain - // of our implementation's robustness, we should lower this down to 8 or 4. - Queries: 1, - - // For now, this is set to 5 minutes, which is a medium period. We are - // We are currently more interested in ensuring we have a properly formed - // DHT than making sure our dht minimizes traffic. - Period: time.Duration(5 * time.Minute), - - Timeout: time.Duration(10 * time.Second), -} - -// A method in the IpfsRouting interface. It calls BootstrapWithConfig with -// the default bootstrap config. -func (dht *IpfsDHT) Bootstrap(ctx context.Context) error { - return dht.BootstrapWithConfig(ctx, DefaultBootstrapConfig) -} - -// Runs cfg.Queries bootstrap queries every cfg.Period. -func (dht *IpfsDHT) BootstrapWithConfig(ctx context.Context, cfg BootstrapConfig) error { - // Because this method is not synchronous, we have to duplicate sanity - // checks on the config so that callers aren't oblivious. - if cfg.Queries <= 0 { - return fmt.Errorf("invalid number of queries: %d", cfg.Queries) - } - go func() { - for { - err := dht.runBootstrap(ctx, cfg) - if err != nil { - logger.Warningf("error bootstrapping: %s", err) - } - select { - case <-time.After(cfg.Period): - case <-ctx.Done(): - return - } - } - }() - return nil -} - -// This is a synchronous bootstrap. cfg.Queries queries will run each with a -// timeout of cfg.Timeout. cfg.Period is not used. -func (dht *IpfsDHT) BootstrapOnce(ctx context.Context, cfg BootstrapConfig) error { - if cfg.Queries <= 0 { - return fmt.Errorf("invalid number of queries: %d", cfg.Queries) - } - return dht.runBootstrap(ctx, cfg) -} - -func newRandomPeerId() peer.ID { - id := make([]byte, 32) // SHA256 is the default. TODO: Use a more canonical way to generate random IDs. - rand.Read(id) - id = u.Hash(id) // TODO: Feed this directly into the multihash instead of hashing it. - return peer.ID(id) -} - -// Traverse the DHT toward the given ID. -func (dht *IpfsDHT) walk(ctx context.Context, target peer.ID) (peer.AddrInfo, error) { - // TODO: Extract the query action (traversal logic?) inside FindPeer, - // don't actually call through the FindPeer machinery, which can return - // things out of the peer store etc. - return dht.FindPeer(ctx, target) -} - -// Traverse the DHT toward a random ID. -func (dht *IpfsDHT) randomWalk(ctx context.Context) error { - id := newRandomPeerId() - p, err := dht.walk(ctx, id) - switch err { - case routing.ErrNotFound: - return nil - case nil: - // We found a peer from a randomly generated ID. This should be very - // unlikely. - logger.Warningf("random walk toward %s actually found peer: %s", id, p) - return nil - default: - return err - } -} - -// Traverse the DHT toward the self ID -func (dht *IpfsDHT) selfWalk(ctx context.Context) error { - _, err := dht.walk(ctx, dht.self) - if err == routing.ErrNotFound { - return nil - } - return err -} - -// runBootstrap builds up list of peers by requesting random peer IDs -func (dht *IpfsDHT) runBootstrap(ctx context.Context, cfg BootstrapConfig) error { - doQuery := func(n int, target string, f func(context.Context) error) error { - logger.Infof("starting bootstrap query (%d/%d) to %s (routing table size was %d)", - n, cfg.Queries, target, dht.routingTable.Size()) - defer func() { - logger.Infof("finished bootstrap query (%d/%d) to %s (routing table size is now %d)", - n, cfg.Queries, target, dht.routingTable.Size()) - }() - queryCtx, cancel := context.WithTimeout(ctx, cfg.Timeout) - defer cancel() - err := f(queryCtx) - if err == context.DeadlineExceeded && queryCtx.Err() == context.DeadlineExceeded && ctx.Err() == nil { - return nil - } - return err - } - - // Do all but one of the bootstrap queries as random walks. - for i := 0; i < cfg.Queries; i++ { - err := doQuery(i, "random ID", dht.randomWalk) - if err != nil { - return err - } - } - - // Find self to distribute peer info to our neighbors. - return doQuery(cfg.Queries, fmt.Sprintf("self: %s", dht.self), dht.selfWalk) -} - -func (dht *IpfsDHT) BootstrapRandom(ctx context.Context) error { - return dht.randomWalk(ctx) -} - -func (dht *IpfsDHT) BootstrapSelf(ctx context.Context) error { - return dht.selfWalk(ctx) -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_net.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_net.go deleted file mode 100644 index ce9e5de3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/dht_net.go +++ /dev/null @@ -1,410 +0,0 @@ -package dht - -import ( - "bufio" - "context" - "fmt" - "io" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - "github.com/libp2p/go-libp2p-kad-dht/metrics" - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - - ggio "github.com/gogo/protobuf/io" - - "go.opencensus.io/stats" - "go.opencensus.io/tag" -) - -var dhtReadMessageTimeout = time.Minute -var dhtStreamIdleTimeout = 10 * time.Minute -var ErrReadTimeout = fmt.Errorf("timed out reading response") - -// The Protobuf writer performs multiple small writes when writing a message. -// We need to buffer those writes, to make sure that we're not sending a new -// packet for every single write. -type bufferedDelimitedWriter struct { - *bufio.Writer - ggio.WriteCloser -} - -var writerPool = sync.Pool{ - New: func() interface{} { - w := bufio.NewWriter(nil) - return &bufferedDelimitedWriter{ - Writer: w, - WriteCloser: ggio.NewDelimitedWriter(w), - } - }, -} - -func writeMsg(w io.Writer, mes *pb.Message) error { - bw := writerPool.Get().(*bufferedDelimitedWriter) - bw.Reset(w) - err := bw.WriteMsg(mes) - if err == nil { - err = bw.Flush() - } - bw.Reset(nil) - writerPool.Put(bw) - return err -} - -func (w *bufferedDelimitedWriter) Flush() error { - return w.Writer.Flush() -} - -// handleNewStream implements the network.StreamHandler -func (dht *IpfsDHT) handleNewStream(s network.Stream) { - defer s.Reset() - if dht.handleNewMessage(s) { - // Gracefully close the stream for writes. - s.Close() - } -} - -// Returns true on orderly completion of writes (so we can Close the stream). -func (dht *IpfsDHT) handleNewMessage(s network.Stream) bool { - ctx := dht.ctx - r := ggio.NewDelimitedReader(s, network.MessageSizeMax) - - mPeer := s.Conn().RemotePeer() - - timer := time.AfterFunc(dhtStreamIdleTimeout, func() { s.Reset() }) - defer timer.Stop() - - for { - var req pb.Message - switch err := r.ReadMsg(&req); err { - case io.EOF: - return true - default: - // This string test is necessary because there isn't a single stream reset error - // instance in use. - if err.Error() != "stream reset" { - logger.Debugf("error reading message: %#v", err) - } - stats.RecordWithTags( - ctx, - []tag.Mutator{tag.Upsert(metrics.KeyMessageType, "UNKNOWN")}, - metrics.ReceivedMessageErrors.M(1), - ) - return false - case nil: - } - - timer.Reset(dhtStreamIdleTimeout) - - startTime := time.Now() - ctx, _ = tag.New( - ctx, - tag.Upsert(metrics.KeyMessageType, req.GetType().String()), - ) - - stats.Record( - ctx, - metrics.ReceivedMessages.M(1), - metrics.ReceivedBytes.M(int64(req.Size())), - ) - - handler := dht.handlerForMsgType(req.GetType()) - if handler == nil { - stats.Record(ctx, metrics.ReceivedMessageErrors.M(1)) - logger.Warningf("can't handle received message of type %v", req.GetType()) - return false - } - - resp, err := handler(ctx, mPeer, &req) - if err != nil { - stats.Record(ctx, metrics.ReceivedMessageErrors.M(1)) - logger.Debugf("error handling message: %v", err) - return false - } - - dht.updateFromMessage(ctx, mPeer, &req) - - if resp == nil { - continue - } - - // send out response msg - err = writeMsg(s, resp) - if err != nil { - stats.Record(ctx, metrics.ReceivedMessageErrors.M(1)) - logger.Debugf("error writing response: %v", err) - return false - } - - elapsedTime := time.Since(startTime) - latencyMillis := float64(elapsedTime) / float64(time.Millisecond) - stats.Record(ctx, metrics.InboundRequestLatency.M(latencyMillis)) - } -} - -// sendRequest sends out a request, but also makes sure to -// measure the RTT for latency measurements. -func (dht *IpfsDHT) sendRequest(ctx context.Context, p peer.ID, pmes *pb.Message) (*pb.Message, error) { - ctx, _ = tag.New(ctx, metrics.UpsertMessageType(pmes)) - - ms, err := dht.messageSenderForPeer(ctx, p) - if err != nil { - stats.Record(ctx, metrics.SentRequestErrors.M(1)) - return nil, err - } - - start := time.Now() - - rpmes, err := ms.SendRequest(ctx, pmes) - if err != nil { - stats.Record(ctx, metrics.SentRequestErrors.M(1)) - return nil, err - } - - // update the peer (on valid msgs only) - dht.updateFromMessage(ctx, p, rpmes) - - stats.Record( - ctx, - metrics.SentRequests.M(1), - metrics.SentBytes.M(int64(pmes.Size())), - metrics.OutboundRequestLatency.M( - float64(time.Since(start))/float64(time.Millisecond), - ), - ) - dht.peerstore.RecordLatency(p, time.Since(start)) - logger.Event(ctx, "dhtReceivedMessage", dht.self, p, rpmes) - return rpmes, nil -} - -// sendMessage sends out a message -func (dht *IpfsDHT) sendMessage(ctx context.Context, p peer.ID, pmes *pb.Message) error { - ctx, _ = tag.New(ctx, metrics.UpsertMessageType(pmes)) - - ms, err := dht.messageSenderForPeer(ctx, p) - if err != nil { - stats.Record(ctx, metrics.SentMessageErrors.M(1)) - return err - } - - if err := ms.SendMessage(ctx, pmes); err != nil { - stats.Record(ctx, metrics.SentMessageErrors.M(1)) - return err - } - - stats.Record( - ctx, - metrics.SentMessages.M(1), - metrics.SentBytes.M(int64(pmes.Size())), - ) - logger.Event(ctx, "dhtSentMessage", dht.self, p, pmes) - return nil -} - -func (dht *IpfsDHT) updateFromMessage(ctx context.Context, p peer.ID, mes *pb.Message) error { - // Make sure that this node is actually a DHT server, not just a client. - protos, err := dht.peerstore.SupportsProtocols(p, dht.protocolStrs()...) - if err == nil && len(protos) > 0 { - dht.Update(ctx, p) - } - return nil -} - -func (dht *IpfsDHT) messageSenderForPeer(ctx context.Context, p peer.ID) (*messageSender, error) { - dht.smlk.Lock() - ms, ok := dht.strmap[p] - if ok { - dht.smlk.Unlock() - return ms, nil - } - ms = &messageSender{p: p, dht: dht} - dht.strmap[p] = ms - dht.smlk.Unlock() - - if err := ms.prepOrInvalidate(ctx); err != nil { - dht.smlk.Lock() - defer dht.smlk.Unlock() - - if msCur, ok := dht.strmap[p]; ok { - // Changed. Use the new one, old one is invalid and - // not in the map so we can just throw it away. - if ms != msCur { - return msCur, nil - } - // Not changed, remove the now invalid stream from the - // map. - delete(dht.strmap, p) - } - // Invalid but not in map. Must have been removed by a disconnect. - return nil, err - } - // All ready to go. - return ms, nil -} - -type messageSender struct { - s network.Stream - r ggio.ReadCloser - lk sync.Mutex - p peer.ID - dht *IpfsDHT - - invalid bool - singleMes int -} - -// invalidate is called before this messageSender is removed from the strmap. -// It prevents the messageSender from being reused/reinitialized and then -// forgotten (leaving the stream open). -func (ms *messageSender) invalidate() { - ms.invalid = true - if ms.s != nil { - ms.s.Reset() - ms.s = nil - } -} - -func (ms *messageSender) prepOrInvalidate(ctx context.Context) error { - ms.lk.Lock() - defer ms.lk.Unlock() - if err := ms.prep(ctx); err != nil { - ms.invalidate() - return err - } - return nil -} - -func (ms *messageSender) prep(ctx context.Context) error { - if ms.invalid { - return fmt.Errorf("message sender has been invalidated") - } - if ms.s != nil { - return nil - } - - nstr, err := ms.dht.host.NewStream(ctx, ms.p, ms.dht.protocols...) - if err != nil { - return err - } - - ms.r = ggio.NewDelimitedReader(nstr, network.MessageSizeMax) - ms.s = nstr - - return nil -} - -// streamReuseTries is the number of times we will try to reuse a stream to a -// given peer before giving up and reverting to the old one-message-per-stream -// behaviour. -const streamReuseTries = 3 - -func (ms *messageSender) SendMessage(ctx context.Context, pmes *pb.Message) error { - ms.lk.Lock() - defer ms.lk.Unlock() - retry := false - for { - if err := ms.prep(ctx); err != nil { - return err - } - - if err := ms.writeMsg(pmes); err != nil { - ms.s.Reset() - ms.s = nil - - if retry { - logger.Info("error writing message, bailing: ", err) - return err - } - logger.Info("error writing message, trying again: ", err) - retry = true - continue - } - - logger.Event(ctx, "dhtSentMessage", ms.dht.self, ms.p, pmes) - - if ms.singleMes > streamReuseTries { - go helpers.FullClose(ms.s) - ms.s = nil - } else if retry { - ms.singleMes++ - } - - return nil - } -} - -func (ms *messageSender) SendRequest(ctx context.Context, pmes *pb.Message) (*pb.Message, error) { - ms.lk.Lock() - defer ms.lk.Unlock() - retry := false - for { - if err := ms.prep(ctx); err != nil { - return nil, err - } - - if err := ms.writeMsg(pmes); err != nil { - ms.s.Reset() - ms.s = nil - - if retry { - logger.Info("error writing message, bailing: ", err) - return nil, err - } - logger.Info("error writing message, trying again: ", err) - retry = true - continue - } - - mes := new(pb.Message) - if err := ms.ctxReadMsg(ctx, mes); err != nil { - ms.s.Reset() - ms.s = nil - - if retry { - logger.Info("error reading message, bailing: ", err) - return nil, err - } - logger.Info("error reading message, trying again: ", err) - retry = true - continue - } - - logger.Event(ctx, "dhtSentMessage", ms.dht.self, ms.p, pmes) - - if ms.singleMes > streamReuseTries { - go helpers.FullClose(ms.s) - ms.s = nil - } else if retry { - ms.singleMes++ - } - - return mes, nil - } -} - -func (ms *messageSender) writeMsg(pmes *pb.Message) error { - return writeMsg(ms.s, pmes) -} - -func (ms *messageSender) ctxReadMsg(ctx context.Context, mes *pb.Message) error { - errc := make(chan error, 1) - go func(r ggio.ReadCloser) { - errc <- r.ReadMsg(mes) - }(ms.r) - - t := time.NewTimer(dhtReadMessageTimeout) - defer t.Stop() - - select { - case err := <-errc: - return err - case <-ctx.Done(): - return ctx.Err() - case <-t.C: - return ErrReadTimeout - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go deleted file mode 100644 index 23bd352d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go +++ /dev/null @@ -1,354 +0,0 @@ -package dht - -import ( - "context" - "math" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - queue "github.com/libp2p/go-libp2p-peerstore/queue" -) - -const ( - // DefaultDialQueueMinParallelism is the default value for the minimum number of worker dial goroutines that will - // be alive at any time. - DefaultDialQueueMinParallelism = 6 - // DefaultDialQueueMaxParallelism is the default value for the maximum number of worker dial goroutines that can - // be alive at any time. - DefaultDialQueueMaxParallelism = 20 - // DefaultDialQueueMaxIdle is the default value for the period that a worker dial goroutine waits before signalling - // a worker pool downscaling. - DefaultDialQueueMaxIdle = 5 * time.Second - // DefaultDialQueueScalingMutePeriod is the default value for the amount of time to ignore further worker pool - // scaling events, after one is processed. Its role is to reduce jitter. - DefaultDialQueueScalingMutePeriod = 1 * time.Second - // DefaultDialQueueScalingFactor is the default factor by which the current number of workers will be multiplied - // or divided when upscaling and downscaling events occur, respectively. - DefaultDialQueueScalingFactor = 1.5 -) - -type dialQueue struct { - *dqParams - - nWorkers uint - out *queue.ChanQueue - startOnce sync.Once - - waitingCh chan waitingCh - dieCh chan struct{} - growCh chan struct{} - shrinkCh chan struct{} -} - -type dqParams struct { - ctx context.Context - target string - dialFn func(context.Context, peer.ID) error - in *queue.ChanQueue - config dqConfig -} - -type dqConfig struct { - // minParallelism is the minimum number of worker dial goroutines that will be alive at any time. - minParallelism uint - // maxParallelism is the maximum number of worker dial goroutines that can be alive at any time. - maxParallelism uint - // scalingFactor is the factor by which the current number of workers will be multiplied or divided when upscaling - // and downscaling events occur, respectively. - scalingFactor float64 - // mutePeriod is the amount of time to ignore further worker pool scaling events, after one is processed. - // Its role is to reduce jitter. - mutePeriod time.Duration - // maxIdle is the period that a worker dial goroutine waits before signalling a worker pool downscaling. - maxIdle time.Duration -} - -// dqDefaultConfig returns the default configuration for dial queues. See const documentation to learn the default values. -func dqDefaultConfig() dqConfig { - return dqConfig{ - minParallelism: DefaultDialQueueMinParallelism, - maxParallelism: DefaultDialQueueMaxParallelism, - scalingFactor: DefaultDialQueueScalingFactor, - maxIdle: DefaultDialQueueMaxIdle, - mutePeriod: DefaultDialQueueScalingMutePeriod, - } -} - -type waitingCh struct { - ch chan<- peer.ID - ts time.Time -} - -// newDialQueue returns an _unstarted_ adaptive dial queue that spawns a dynamically sized set of goroutines to -// preemptively stage dials for later handoff to the DHT protocol for RPC. It identifies backpressure on both -// ends (dial consumers and dial producers), and takes compensating action by adjusting the worker pool. To -// activate the dial queue, call Start(). -// -// Why? Dialing is expensive. It's orders of magnitude slower than running an RPC on an already-established -// connection, as it requires establishing a TCP connection, multistream handshake, crypto handshake, mux handshake, -// and protocol negotiation. -// -// We start with config.minParallelism number of workers, and scale up and down based on demand and supply of -// dialled peers. -// -// The following events trigger scaling: -// - we scale up when we can't immediately return a successful dial to a new consumer. -// - we scale down when we've been idle for a while waiting for new dial attempts. -// - we scale down when we complete a dial and realise nobody was waiting for it. -// -// Dialler throttling (e.g. FD limit exceeded) is a concern, as we can easily spin up more workers to compensate, and -// end up adding fuel to the fire. Since we have no deterministic way to detect this for now, we hard-limit concurrency -// to config.maxParallelism. -func newDialQueue(params *dqParams) (*dialQueue, error) { - dq := &dialQueue{ - dqParams: params, - out: queue.NewChanQueue(params.ctx, queue.NewXORDistancePQ(params.target)), - growCh: make(chan struct{}, 1), - shrinkCh: make(chan struct{}, 1), - waitingCh: make(chan waitingCh), - dieCh: make(chan struct{}, params.config.maxParallelism), - } - - return dq, nil -} - -// Start initiates action on this dial queue. It should only be called once; subsequent calls are ignored. -func (dq *dialQueue) Start() { - dq.startOnce.Do(func() { - go dq.control() - }) -} - -func (dq *dialQueue) control() { - var ( - dialled <-chan peer.ID - waiting []waitingCh - lastScalingEvt = time.Now() - ) - - defer func() { - for _, w := range waiting { - close(w.ch) - } - waiting = nil - }() - - // start workers - - tgt := int(dq.dqParams.config.minParallelism) - for i := 0; i < tgt; i++ { - go dq.worker() - } - dq.nWorkers = uint(tgt) - - // control workers - - for { - // First process any backlog of dial jobs and waiters -- making progress is the priority. - // This block is copied below; couldn't find a more concise way of doing this. - select { - case <-dq.ctx.Done(): - return - case w := <-dq.waitingCh: - waiting = append(waiting, w) - dialled = dq.out.DeqChan - continue // onto the top. - case p, ok := <-dialled: - if !ok { - return // we're done if the ChanQueue is closed, which happens when the context is closed. - } - w := waiting[0] - logger.Debugf("delivering dialled peer to DHT; took %dms.", time.Since(w.ts)/time.Millisecond) - w.ch <- p - close(w.ch) - waiting = waiting[1:] - if len(waiting) == 0 { - // no more waiters, so stop consuming dialled jobs. - dialled = nil - } - continue // onto the top. - default: - // there's nothing to process, so proceed onto the main select block. - } - - select { - case <-dq.ctx.Done(): - return - case w := <-dq.waitingCh: - waiting = append(waiting, w) - dialled = dq.out.DeqChan - case p, ok := <-dialled: - if !ok { - return // we're done if the ChanQueue is closed, which happens when the context is closed. - } - w := waiting[0] - logger.Debugf("delivering dialled peer to DHT; took %dms.", time.Since(w.ts)/time.Millisecond) - w.ch <- p - close(w.ch) - waiting = waiting[1:] - if len(waiting) == 0 { - // no more waiters, so stop consuming dialled jobs. - dialled = nil - } - case <-dq.growCh: - if time.Since(lastScalingEvt) < dq.config.mutePeriod { - continue - } - dq.grow() - lastScalingEvt = time.Now() - case <-dq.shrinkCh: - if time.Since(lastScalingEvt) < dq.config.mutePeriod { - continue - } - dq.shrink() - lastScalingEvt = time.Now() - } - } -} - -func (dq *dialQueue) Consume() <-chan peer.ID { - ch := make(chan peer.ID, 1) - - select { - case p, ok := <-dq.out.DeqChan: - // short circuit and return a dialled peer if it's immediately available, or abort if DeqChan is closed. - if ok { - ch <- p - } - close(ch) - return ch - case <-dq.ctx.Done(): - // return a closed channel with no value if we're done. - close(ch) - return ch - default: - } - - // we have no finished dials to return, trigger a scale up. - select { - case dq.growCh <- struct{}{}: - default: - } - - // park the channel until a dialled peer becomes available. - select { - case dq.waitingCh <- waitingCh{ch, time.Now()}: - // all good - case <-dq.ctx.Done(): - // return a closed channel with no value if we're done. - close(ch) - } - return ch -} - -func (dq *dialQueue) grow() { - // no mutex needed as this is only called from the (single-threaded) control loop. - defer func(prev uint) { - if prev == dq.nWorkers { - return - } - logger.Debugf("grew dial worker pool: %d => %d", prev, dq.nWorkers) - }(dq.nWorkers) - - if dq.nWorkers == dq.config.maxParallelism { - return - } - // choosing not to worry about uint wrapping beyond max value. - target := uint(math.Floor(float64(dq.nWorkers) * dq.config.scalingFactor)) - if target > dq.config.maxParallelism { - target = dq.config.maxParallelism - } - for ; dq.nWorkers < target; dq.nWorkers++ { - go dq.worker() - } -} - -func (dq *dialQueue) shrink() { - // no mutex needed as this is only called from the (single-threaded) control loop. - defer func(prev uint) { - if prev == dq.nWorkers { - return - } - logger.Debugf("shrunk dial worker pool: %d => %d", prev, dq.nWorkers) - }(dq.nWorkers) - - if dq.nWorkers == dq.config.minParallelism { - return - } - target := uint(math.Floor(float64(dq.nWorkers) / dq.config.scalingFactor)) - if target < dq.config.minParallelism { - target = dq.config.minParallelism - } - // send as many die signals as workers we have to prune. - for ; dq.nWorkers > target; dq.nWorkers-- { - select { - case dq.dieCh <- struct{}{}: - default: - logger.Debugf("too many die signals queued up.") - } - } -} - -func (dq *dialQueue) worker() { - // This idle timer tracks if the environment is slow. If we're waiting to long to acquire a peer to dial, - // it means that the DHT query is progressing slow and we should shrink the worker pool. - idleTimer := time.NewTimer(24 * time.Hour) // placeholder init value which will be overridden immediately. - for { - // trap exit signals first. - select { - case <-dq.ctx.Done(): - return - case <-dq.dieCh: - return - default: - } - - idleTimer.Stop() - select { - case <-idleTimer.C: - default: - } - idleTimer.Reset(dq.config.maxIdle) - - select { - case <-dq.dieCh: - return - case <-dq.ctx.Done(): - return - case <-idleTimer.C: - // no new dial requests during our idle period; time to scale down. - case p, ok := <-dq.in.DeqChan: - if !ok { - return - } - - t := time.Now() - if err := dq.dialFn(dq.ctx, p); err != nil { - logger.Debugf("discarding dialled peer because of error: %v", err) - continue - } - logger.Debugf("dialling %v took %dms (as observed by the dht subsystem).", p, time.Since(t)/time.Millisecond) - waiting := len(dq.waitingCh) - - // by the time we're done dialling, it's possible that the context is closed, in which case there will - // be nobody listening on dq.out.EnqChan and we could block forever. - select { - case dq.out.EnqChan <- p: - case <-dq.ctx.Done(): - return - } - if waiting > 0 { - // we have somebody to deliver this value to, so no need to shrink. - continue - } - } - - // scaling down; control only arrives here if the idle timer fires, or if there are no goroutines - // waiting for the value we just produced. - select { - case dq.shrinkCh <- struct{}{}: - default: - } - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/doc.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/doc.go deleted file mode 100644 index acbb1814..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package dht implements a distributed hash table that satisfies the ipfs routing -// interface. This DHT is modeled after kademlia with S/Kademlia modifications. -package dht diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/go.mod b/vendor/github.com/libp2p/go-libp2p-kad-dht/go.mod deleted file mode 100644 index a29d2756..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/go.mod +++ /dev/null @@ -1,28 +0,0 @@ -module github.com/libp2p/go-libp2p-kad-dht - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/ipfs/go-todocounter v0.0.1 - github.com/jbenet/goprocess v0.1.3 - github.com/libp2p/go-libp2p v0.1.0 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-kbucket v0.2.0 - github.com/libp2p/go-libp2p-peerstore v0.1.0 - github.com/libp2p/go-libp2p-record v0.1.0 - github.com/libp2p/go-libp2p-routing v0.1.0 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/libp2p/go-libp2p-testing v0.0.3 - github.com/mr-tron/base58 v1.1.2 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-dns v0.0.2 - github.com/multiformats/go-multistream v0.1.0 - github.com/stretchr/testify v1.3.0 - github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc - go.opencensus.io v0.21.0 - golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522 -) diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/go.sum b/vendor/github.com/libp2p/go-libp2p-kad-dht/go.sum deleted file mode 100644 index 2a04aeb9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/go.sum +++ /dev/null @@ -1,315 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-todocounter v0.0.1 h1:kITWA5ZcQZfrUnDNkRn04Xzh0YFaDFXsoO2A81Eb6Lw= -github.com/ipfs/go-todocounter v0.0.1/go.mod h1:l5aErvQc8qKE2r7NDMjmq5UNAvuZy0rC8BHOplkWvZ4= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.0 h1:8VXadcPNni74ODoZ+7326LMAppFYmz1fRQOUuT5iZvQ= -github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-kbucket v0.2.0 h1:FB2a0VkOTNGTP5gu/I444u4WabNM9V1zCkQcWb7zajI= -github.com/libp2p/go-libp2p-kbucket v0.2.0/go.mod h1:JNymBToym3QXKBMKGy3m29+xprg0EVr/GJFHxFEdgh8= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-routing v0.1.0 h1:hFnj3WR3E2tOcKaGpyzfP4gvFZ3t8JkQmbapN0Ct+oU= -github.com/libp2p/go-libp2p-routing v0.1.0/go.mod h1:zfLhI1RI8RLEzmEaaPwzonRvXeeSHddONWkcTcB54nE= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3 h1:YiMaevQcZtFU6DmKIF8xEO0vaui5kM5HJ1V1xkWQv14= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc h1:BCPnHtcboadS0DvysUuJXZ4lWVv5Bh5i7+tbIyi+ck4= -github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc/go.mod h1:r45hJU7yEoA81k6MWNhpMj/kms0n14dkzkxYHoB96UM= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -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-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -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/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522 h1:bhOzK9QyoD0ogCnFro1m2mz41+Ib0oOhfJnBp5MR4K4= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/handlers.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/handlers.go deleted file mode 100644 index aaeef7ca..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/handlers.go +++ /dev/null @@ -1,387 +0,0 @@ -package dht - -import ( - "bytes" - "context" - "errors" - "fmt" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - pstore "github.com/libp2p/go-libp2p-peerstore" - - proto "github.com/gogo/protobuf/proto" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - u "github.com/ipfs/go-ipfs-util" - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - recpb "github.com/libp2p/go-libp2p-record/pb" - base32 "github.com/whyrusleeping/base32" -) - -// The number of closer peers to send on requests. -var CloserPeerCount = KValue - -// dhthandler specifies the signature of functions that handle DHT messages. -type dhtHandler func(context.Context, peer.ID, *pb.Message) (*pb.Message, error) - -func (dht *IpfsDHT) handlerForMsgType(t pb.Message_MessageType) dhtHandler { - switch t { - case pb.Message_GET_VALUE: - return dht.handleGetValue - case pb.Message_PUT_VALUE: - return dht.handlePutValue - case pb.Message_FIND_NODE: - return dht.handleFindPeer - case pb.Message_ADD_PROVIDER: - return dht.handleAddProvider - case pb.Message_GET_PROVIDERS: - return dht.handleGetProviders - case pb.Message_PING: - return dht.handlePing - default: - return nil - } -} - -func (dht *IpfsDHT) handleGetValue(ctx context.Context, p peer.ID, pmes *pb.Message) (_ *pb.Message, err error) { - ctx = logger.Start(ctx, "handleGetValue") - logger.SetTag(ctx, "peer", p) - defer func() { logger.FinishWithErr(ctx, err) }() - logger.Debugf("%s handleGetValue for key: %s", dht.self, pmes.GetKey()) - - // setup response - resp := pb.NewMessage(pmes.GetType(), pmes.GetKey(), pmes.GetClusterLevel()) - - // first, is there even a key? - k := pmes.GetKey() - if len(k) == 0 { - return nil, errors.New("handleGetValue but no key was provided") - // TODO: send back an error response? could be bad, but the other node's hanging. - } - - rec, err := dht.checkLocalDatastore(k) - if err != nil { - return nil, err - } - resp.Record = rec - - // Find closest peer on given cluster to desired key and reply with that info - closer := dht.betterPeersToQuery(pmes, p, CloserPeerCount) - if len(closer) > 0 { - // TODO: pstore.PeerInfos should move to core (=> peerstore.AddrInfos). - closerinfos := pstore.PeerInfos(dht.peerstore, closer) - for _, pi := range closerinfos { - logger.Debugf("handleGetValue returning closer peer: '%s'", pi.ID) - if len(pi.Addrs) < 1 { - logger.Warningf(`no addresses on peer being sent! - [local:%s] - [sending:%s] - [remote:%s]`, dht.self, pi.ID, p) - } - } - - resp.CloserPeers = pb.PeerInfosToPBPeers(dht.host.Network(), closerinfos) - } - - return resp, nil -} - -func (dht *IpfsDHT) checkLocalDatastore(k []byte) (*recpb.Record, error) { - logger.Debugf("%s handleGetValue looking into ds", dht.self) - dskey := convertToDsKey(k) - buf, err := dht.datastore.Get(dskey) - logger.Debugf("%s handleGetValue looking into ds GOT %v", dht.self, buf) - - if err == ds.ErrNotFound { - return nil, nil - } - - // if we got an unexpected error, bail. - if err != nil { - return nil, err - } - - // if we have the value, send it back - logger.Debugf("%s handleGetValue success!", dht.self) - - rec := new(recpb.Record) - err = proto.Unmarshal(buf, rec) - if err != nil { - logger.Debug("failed to unmarshal DHT record from datastore") - return nil, err - } - - var recordIsBad bool - recvtime, err := u.ParseRFC3339(rec.GetTimeReceived()) - if err != nil { - logger.Info("either no receive time set on record, or it was invalid: ", err) - recordIsBad = true - } - - if time.Since(recvtime) > MaxRecordAge { - logger.Debug("old record found, tossing.") - recordIsBad = true - } - - // NOTE: We do not verify the record here beyond checking these timestamps. - // we put the burden of checking the records on the requester as checking a record - // may be computationally expensive - - if recordIsBad { - err := dht.datastore.Delete(dskey) - if err != nil { - logger.Error("Failed to delete bad record from datastore: ", err) - } - - return nil, nil // can treat this as not having the record at all - } - - return rec, nil -} - -// Cleans the record (to avoid storing arbitrary data). -func cleanRecord(rec *recpb.Record) { - rec.TimeReceived = "" -} - -// Store a value in this peer local storage -func (dht *IpfsDHT) handlePutValue(ctx context.Context, p peer.ID, pmes *pb.Message) (_ *pb.Message, err error) { - ctx = logger.Start(ctx, "handlePutValue") - logger.SetTag(ctx, "peer", p) - defer func() { logger.FinishWithErr(ctx, err) }() - - rec := pmes.GetRecord() - if rec == nil { - logger.Infof("Got nil record from: %s", p.Pretty()) - return nil, errors.New("nil record") - } - - if !bytes.Equal(pmes.GetKey(), rec.GetKey()) { - return nil, errors.New("put key doesn't match record key") - } - - cleanRecord(rec) - - // Make sure the record is valid (not expired, valid signature etc) - if err = dht.Validator.Validate(string(rec.GetKey()), rec.GetValue()); err != nil { - logger.Warningf("Bad dht record in PUT from: %s. %s", p.Pretty(), err) - return nil, err - } - - dskey := convertToDsKey(rec.GetKey()) - - // Make sure the new record is "better" than the record we have locally. - // This prevents a record with for example a lower sequence number from - // overwriting a record with a higher sequence number. - existing, err := dht.getRecordFromDatastore(dskey) - if err != nil { - return nil, err - } - - if existing != nil { - recs := [][]byte{rec.GetValue(), existing.GetValue()} - i, err := dht.Validator.Select(string(rec.GetKey()), recs) - if err != nil { - logger.Warningf("Bad dht record in PUT from %s: %s", p.Pretty(), err) - return nil, err - } - if i != 0 { - logger.Infof("DHT record in PUT from %s is older than existing record. Ignoring", p.Pretty()) - return nil, errors.New("old record") - } - } - - // record the time we receive every record - rec.TimeReceived = u.FormatRFC3339(time.Now()) - - data, err := proto.Marshal(rec) - if err != nil { - return nil, err - } - - err = dht.datastore.Put(dskey, data) - logger.Debugf("%s handlePutValue %v", dht.self, dskey) - return pmes, err -} - -// returns nil, nil when either nothing is found or the value found doesn't properly validate. -// returns nil, some_error when there's a *datastore* error (i.e., something goes very wrong) -func (dht *IpfsDHT) getRecordFromDatastore(dskey ds.Key) (*recpb.Record, error) { - buf, err := dht.datastore.Get(dskey) - if err == ds.ErrNotFound { - return nil, nil - } - if err != nil { - logger.Errorf("Got error retrieving record with key %s from datastore: %s", dskey, err) - return nil, err - } - rec := new(recpb.Record) - err = proto.Unmarshal(buf, rec) - if err != nil { - // Bad data in datastore, log it but don't return an error, we'll just overwrite it - logger.Errorf("Bad record data stored in datastore with key %s: could not unmarshal record", dskey) - return nil, nil - } - - err = dht.Validator.Validate(string(rec.GetKey()), rec.GetValue()) - if err != nil { - // Invalid record in datastore, probably expired but don't return an error, - // we'll just overwrite it - logger.Debugf("Local record verify failed: %s (discarded)", err) - return nil, nil - } - - return rec, nil -} - -func (dht *IpfsDHT) handlePing(_ context.Context, p peer.ID, pmes *pb.Message) (*pb.Message, error) { - logger.Debugf("%s Responding to ping from %s!\n", dht.self, p) - return pmes, nil -} - -func (dht *IpfsDHT) handleFindPeer(ctx context.Context, p peer.ID, pmes *pb.Message) (_ *pb.Message, _err error) { - ctx = logger.Start(ctx, "handleFindPeer") - defer func() { logger.FinishWithErr(ctx, _err) }() - logger.SetTag(ctx, "peer", p) - resp := pb.NewMessage(pmes.GetType(), nil, pmes.GetClusterLevel()) - var closest []peer.ID - - // if looking for self... special case where we send it on CloserPeers. - targetPid := peer.ID(pmes.GetKey()) - if targetPid == dht.self { - closest = []peer.ID{dht.self} - } else { - closest = dht.betterPeersToQuery(pmes, p, CloserPeerCount) - - // Never tell a peer about itself. - if targetPid != p { - // If we're connected to the target peer, report their - // peer info. This makes FindPeer work even if the - // target peer isn't in our routing table. - // - // Alternatively, we could just check our peerstore. - // However, we don't want to return out of date - // information. We can change this in the future when we - // add a progressive, asynchronous `SearchPeer` function - // and improve peer routing in the host. - switch dht.host.Network().Connectedness(targetPid) { - case network.Connected, network.CanConnect: - closest = append(closest, targetPid) - } - } - } - - if closest == nil { - logger.Infof("%s handleFindPeer %s: could not find anything.", dht.self, p) - return resp, nil - } - - // TODO: pstore.PeerInfos should move to core (=> peerstore.AddrInfos). - closestinfos := pstore.PeerInfos(dht.peerstore, closest) - // possibly an over-allocation but this array is temporary anyways. - withAddresses := make([]peer.AddrInfo, 0, len(closestinfos)) - for _, pi := range closestinfos { - if len(pi.Addrs) > 0 { - withAddresses = append(withAddresses, pi) - } - } - - resp.CloserPeers = pb.PeerInfosToPBPeers(dht.host.Network(), withAddresses) - return resp, nil -} - -func (dht *IpfsDHT) handleGetProviders(ctx context.Context, p peer.ID, pmes *pb.Message) (_ *pb.Message, _err error) { - ctx = logger.Start(ctx, "handleGetProviders") - defer func() { logger.FinishWithErr(ctx, _err) }() - logger.SetTag(ctx, "peer", p) - - resp := pb.NewMessage(pmes.GetType(), pmes.GetKey(), pmes.GetClusterLevel()) - c, err := cid.Cast([]byte(pmes.GetKey())) - if err != nil { - return nil, err - } - logger.SetTag(ctx, "key", c) - - // debug logging niceness. - reqDesc := fmt.Sprintf("%s handleGetProviders(%s, %s): ", dht.self, p, c) - logger.Debugf("%s begin", reqDesc) - defer logger.Debugf("%s end", reqDesc) - - // check if we have this value, to add ourselves as provider. - has, err := dht.datastore.Has(convertToDsKey(c.Bytes())) - if err != nil && err != ds.ErrNotFound { - logger.Debugf("unexpected datastore error: %v\n", err) - has = false - } - - // setup providers - providers := dht.providers.GetProviders(ctx, c) - if has { - providers = append(providers, dht.self) - logger.Debugf("%s have the value. added self as provider", reqDesc) - } - - if len(providers) > 0 { - // TODO: pstore.PeerInfos should move to core (=> peerstore.AddrInfos). - infos := pstore.PeerInfos(dht.peerstore, providers) - resp.ProviderPeers = pb.PeerInfosToPBPeers(dht.host.Network(), infos) - logger.Debugf("%s have %d providers: %s", reqDesc, len(providers), infos) - } - - // Also send closer peers. - closer := dht.betterPeersToQuery(pmes, p, CloserPeerCount) - if closer != nil { - // TODO: pstore.PeerInfos should move to core (=> peerstore.AddrInfos). - infos := pstore.PeerInfos(dht.peerstore, closer) - resp.CloserPeers = pb.PeerInfosToPBPeers(dht.host.Network(), infos) - logger.Debugf("%s have %d closer peers: %s", reqDesc, len(closer), infos) - } - - return resp, nil -} - -func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.Message) (_ *pb.Message, _err error) { - ctx = logger.Start(ctx, "handleAddProvider") - defer func() { logger.FinishWithErr(ctx, _err) }() - logger.SetTag(ctx, "peer", p) - - c, err := cid.Cast([]byte(pmes.GetKey())) - if err != nil { - return nil, err - } - logger.SetTag(ctx, "key", c) - - logger.Debugf("%s adding %s as a provider for '%s'\n", dht.self, p, c) - - // add provider should use the address given in the message - pinfos := pb.PBPeersToPeerInfos(pmes.GetProviderPeers()) - for _, pi := range pinfos { - if pi.ID != p { - // we should ignore this provider record! not from originator. - // (we should sign them and check signature later...) - logger.Debugf("handleAddProvider received provider %s from %s. Ignore.", pi.ID, p) - continue - } - - if len(pi.Addrs) < 1 { - logger.Debugf("%s got no valid addresses for provider %s. Ignore.", dht.self, p) - continue - } - - logger.Debugf("received provider %s for %s (addrs: %s)", p, c, pi.Addrs) - if pi.ID != dht.self { // don't add own addrs. - // add the received addresses to our peerstore. - dht.peerstore.AddAddrs(pi.ID, pi.Addrs, peerstore.ProviderAddrTTL) - } - dht.providers.AddProvider(ctx, c, p) - } - - return nil, nil -} - -func convertToDsKey(s []byte) ds.Key { - return ds.NewKey(base32.RawStdEncoding.EncodeToString(s)) -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/lookup.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/lookup.go deleted file mode 100644 index ea5bb31a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/lookup.go +++ /dev/null @@ -1,115 +0,0 @@ -package dht - -import ( - "context" - "fmt" - "strings" - - "github.com/libp2p/go-libp2p-core/peer" - - cid "github.com/ipfs/go-cid" - logging "github.com/ipfs/go-log" - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - kb "github.com/libp2p/go-libp2p-kbucket" - notif "github.com/libp2p/go-libp2p-routing/notifications" -) - -func tryFormatLoggableKey(k string) (string, error) { - if len(k) == 0 { - return "", fmt.Errorf("loggableKey is empty") - } - var proto, cstr string - if k[0] == '/' { - // it's a path (probably) - protoEnd := strings.IndexByte(k[1:], '/') - if protoEnd < 0 { - return k, fmt.Errorf("loggableKey starts with '/' but is not a path: %x", k) - } - proto = k[1 : protoEnd+1] - cstr = k[protoEnd+2:] - } else { - proto = "provider" - cstr = k - } - - c, err := cid.Cast([]byte(cstr)) - if err != nil { - return "", fmt.Errorf("loggableKey could not cast key to a CID: %x %v", k, err) - } - return fmt.Sprintf("/%s/%s", proto, c.String()), nil -} - -func loggableKey(k string) logging.LoggableMap { - newKey, err := tryFormatLoggableKey(k) - if err != nil { - logger.Debug(err) - } else { - k = newKey - } - - return logging.LoggableMap{ - "key": k, - } -} - -// Kademlia 'node lookup' operation. Returns a channel of the K closest peers -// to the given key -func (dht *IpfsDHT) GetClosestPeers(ctx context.Context, key string) (<-chan peer.ID, error) { - e := logger.EventBegin(ctx, "getClosestPeers", loggableKey(key)) - tablepeers := dht.routingTable.NearestPeers(kb.ConvertKey(key), AlphaValue) - if len(tablepeers) == 0 { - return nil, kb.ErrLookupFailure - } - - out := make(chan peer.ID, KValue) - - // since the query doesnt actually pass our context down - // we have to hack this here. whyrusleeping isnt a huge fan of goprocess - parent := ctx - query := dht.newQuery(key, func(ctx context.Context, p peer.ID) (*dhtQueryResult, error) { - // For DHT query command - notif.PublishQueryEvent(parent, ¬if.QueryEvent{ - Type: notif.SendingQuery, - ID: p, - }) - - pmes, err := dht.findPeerSingle(ctx, p, peer.ID(key)) - if err != nil { - logger.Debugf("error getting closer peers: %s", err) - return nil, err - } - peers := pb.PBPeersToPeerInfos(pmes.GetCloserPeers()) - - // For DHT query command - notif.PublishQueryEvent(parent, ¬if.QueryEvent{ - Type: notif.PeerResponse, - ID: p, - Responses: peers, - }) - - return &dhtQueryResult{closerPeers: peers}, nil - }) - - go func() { - defer close(out) - defer e.Done() - // run it! - res, err := query.Run(ctx, tablepeers) - if err != nil { - logger.Debugf("closestPeers query run error: %s", err) - } - - if res != nil && res.queriedSet != nil { - sorted := kb.SortClosestPeers(res.queriedSet.Peers(), kb.ConvertKey(key)) - if len(sorted) > KValue { - sorted = sorted[:KValue] - } - - for _, p := range sorted { - out <- p - } - } - }() - - return out, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/metrics/metrics.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/metrics/metrics.go deleted file mode 100644 index bbe48015..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/metrics/metrics.go +++ /dev/null @@ -1,95 +0,0 @@ -package metrics - -import ( - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - "go.opencensus.io/stats" - "go.opencensus.io/stats/view" - "go.opencensus.io/tag" -) - -var ( - defaultBytesDistribution = view.Distribution(1024, 2048, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824, 4294967296) - defaultMillisecondsDistribution = view.Distribution(0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000) -) - -// Keys -var ( - KeyMessageType, _ = tag.NewKey("message_type") - KeyPeerID, _ = tag.NewKey("peer_id") - // KeyInstanceID identifies a dht instance by the pointer address. - // Useful for differentiating between different dhts that have the same peer id. - KeyInstanceID, _ = tag.NewKey("instance_id") -) - -// UpsertMessageType is a convenience upserts the message type -// of a pb.Message into the KeyMessageType. -func UpsertMessageType(m *pb.Message) tag.Mutator { - return tag.Upsert(KeyMessageType, m.Type.String()) -} - -// Measures -var ( - ReceivedMessages = stats.Int64("libp2p.io/dht/kad/received_messages", "Total number of messages received per RPC", stats.UnitDimensionless) - ReceivedMessageErrors = stats.Int64("libp2p.io/dht/kad/received_message_errors", "Total number of errors for messages received per RPC", stats.UnitDimensionless) - ReceivedBytes = stats.Int64("libp2p.io/dht/kad/received_bytes", "Total received bytes per RPC", stats.UnitBytes) - InboundRequestLatency = stats.Float64("libp2p.io/dht/kad/inbound_request_latency", "Latency per RPC", stats.UnitMilliseconds) - OutboundRequestLatency = stats.Float64("libp2p.io/dht/kad/outbound_request_latency", "Latency per RPC", stats.UnitMilliseconds) - SentMessages = stats.Int64("libp2p.io/dht/kad/sent_messages", "Total number of messages sent per RPC", stats.UnitDimensionless) - SentMessageErrors = stats.Int64("libp2p.io/dht/kad/sent_message_errors", "Total number of errors for messages sent per RPC", stats.UnitDimensionless) - SentRequests = stats.Int64("libp2p.io/dht/kad/sent_requests", "Total number of requests sent per RPC", stats.UnitDimensionless) - SentRequestErrors = stats.Int64("libp2p.io/dht/kad/sent_request_errors", "Total number of errors for requests sent per RPC", stats.UnitDimensionless) - SentBytes = stats.Int64("libp2p.io/dht/kad/sent_bytes", "Total sent bytes per RPC", stats.UnitBytes) -) - -var DefaultViews = []*view.View{ - &view.View{ - Measure: ReceivedMessages, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: ReceivedMessageErrors, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: ReceivedBytes, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: defaultBytesDistribution, - }, - &view.View{ - Measure: InboundRequestLatency, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: defaultMillisecondsDistribution, - }, - &view.View{ - Measure: OutboundRequestLatency, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: defaultMillisecondsDistribution, - }, - &view.View{ - Measure: SentMessages, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: SentMessageErrors, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: SentRequests, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: SentRequestErrors, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: view.Count(), - }, - &view.View{ - Measure: SentBytes, - TagKeys: []tag.Key{KeyMessageType, KeyPeerID, KeyInstanceID}, - Aggregation: defaultBytesDistribution, - }, -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_posix.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_posix.go deleted file mode 100644 index efd1b383..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_posix.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !windows,!wasm - -package dht - -import "syscall" - -func curFileLimit() uint64 { - var n syscall.Rlimit - syscall.Getrlimit(syscall.RLIMIT_NOFILE, &n) - // cast because some platforms use int64 (e.g., freebsd) - return uint64(n.Cur) -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_windows.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_windows.go deleted file mode 100644 index 888aec0c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/nofile_test_windows.go +++ /dev/null @@ -1,5 +0,0 @@ -package dht - -func curFileLimit() uint64 { - return 16 * 1024 * 1024 -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/notif.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/notif.go deleted file mode 100644 index 3af75849..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/notif.go +++ /dev/null @@ -1,118 +0,0 @@ -package dht - -import ( - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/network" - - ma "github.com/multiformats/go-multiaddr" - mstream "github.com/multiformats/go-multistream" -) - -// netNotifiee defines methods to be used with the IpfsDHT -type netNotifiee IpfsDHT - -func (nn *netNotifiee) DHT() *IpfsDHT { - return (*IpfsDHT)(nn) -} - -func (nn *netNotifiee) Connected(n network.Network, v network.Conn) { - dht := nn.DHT() - select { - case <-dht.Process().Closing(): - return - default: - } - - p := v.RemotePeer() - protos, err := dht.peerstore.SupportsProtocols(p, dht.protocolStrs()...) - if err == nil && len(protos) != 0 { - // We lock here for consistency with the lock in testConnection. - // This probably isn't necessary because (dis)connect - // notifications are serialized but it's nice to be consistent. - dht.plk.Lock() - defer dht.plk.Unlock() - if dht.host.Network().Connectedness(p) == network.Connected { - dht.Update(dht.Context(), p) - } - return - } - - // Note: Unfortunately, the peerstore may not yet know that this peer is - // a DHT server. So, if it didn't return a positive response above, test - // manually. - go nn.testConnection(v) -} - -func (nn *netNotifiee) testConnection(v network.Conn) { - dht := nn.DHT() - p := v.RemotePeer() - - // Forcibly use *this* connection. Otherwise, if we have two connections, we could: - // 1. Test it twice. - // 2. Have it closed from under us leaving the second (open) connection untested. - s, err := v.NewStream() - if err != nil { - // Connection error - return - } - defer helpers.FullClose(s) - - selected, err := mstream.SelectOneOf(dht.protocolStrs(), s) - if err != nil { - // Doesn't support the protocol - return - } - // Remember this choice (makes subsequent negotiations faster) - dht.peerstore.AddProtocols(p, selected) - - // We lock here as we race with disconnect. If we didn't lock, we could - // finish processing a connect after handling the associated disconnect - // event and add the peer to the routing table after removing it. - dht.plk.Lock() - defer dht.plk.Unlock() - if dht.host.Network().Connectedness(p) == network.Connected { - dht.Update(dht.Context(), p) - } -} - -func (nn *netNotifiee) Disconnected(n network.Network, v network.Conn) { - dht := nn.DHT() - select { - case <-dht.Process().Closing(): - return - default: - } - - p := v.RemotePeer() - - // Lock and check to see if we're still connected. We lock to make sure - // we don't concurrently process a connect event. - dht.plk.Lock() - defer dht.plk.Unlock() - if dht.host.Network().Connectedness(p) == network.Connected { - // We're still connected. - return - } - - dht.routingTable.Remove(p) - - dht.smlk.Lock() - defer dht.smlk.Unlock() - ms, ok := dht.strmap[p] - if !ok { - return - } - delete(dht.strmap, p) - - // Do this asynchronously as ms.lk can block for a while. - go func() { - ms.lk.Lock() - defer ms.lk.Unlock() - ms.invalidate() - }() -} - -func (nn *netNotifiee) OpenedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) ClosedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) Listen(n network.Network, a ma.Multiaddr) {} -func (nn *netNotifiee) ListenClose(n network.Network, a ma.Multiaddr) {} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/opts/options.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/opts/options.go deleted file mode 100644 index 93ce6c0d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/opts/options.go +++ /dev/null @@ -1,109 +0,0 @@ -package dhtopts - -import ( - "fmt" - - ds "github.com/ipfs/go-datastore" - dssync "github.com/ipfs/go-datastore/sync" - protocol "github.com/libp2p/go-libp2p-core/protocol" - record "github.com/libp2p/go-libp2p-record" -) - -// Deprecated: The old format did not support more than one message per stream, and is not supported -// or relevant with stream pooling. ProtocolDHT should be used instead. -const ProtocolDHTOld protocol.ID = "/ipfs/dht" - -var ( - ProtocolDHT protocol.ID = "/ipfs/kad/1.0.0" - DefaultProtocols = []protocol.ID{ProtocolDHT} -) - -// Options is a structure containing all the options that can be used when constructing a DHT. -type Options struct { - Datastore ds.Batching - Validator record.Validator - Client bool - Protocols []protocol.ID -} - -// Apply applies the given options to this Option -func (o *Options) Apply(opts ...Option) error { - for i, opt := range opts { - if err := opt(o); err != nil { - return fmt.Errorf("dht option %d failed: %s", i, err) - } - } - return nil -} - -// Option DHT option type. -type Option func(*Options) error - -// Defaults are the default DHT options. This option will be automatically -// prepended to any options you pass to the DHT constructor. -var Defaults = func(o *Options) error { - o.Validator = record.NamespacedValidator{ - "pk": record.PublicKeyValidator{}, - } - o.Datastore = dssync.MutexWrap(ds.NewMapDatastore()) - o.Protocols = DefaultProtocols - return nil -} - -// Datastore configures the DHT to use the specified datastore. -// -// Defaults to an in-memory (temporary) map. -func Datastore(ds ds.Batching) Option { - return func(o *Options) error { - o.Datastore = ds - return nil - } -} - -// Client configures whether or not the DHT operates in client-only mode. -// -// Defaults to false. -func Client(only bool) Option { - return func(o *Options) error { - o.Client = only - return nil - } -} - -// Validator configures the DHT to use the specified validator. -// -// Defaults to a namespaced validator that can only validate public keys. -func Validator(v record.Validator) Option { - return func(o *Options) error { - o.Validator = v - return nil - } -} - -// NamespacedValidator adds a validator namespaced under `ns`. This option fails -// if the DHT is not using a `record.NamespacedValidator` as it's validator (it -// uses one by default but this can be overridden with the `Validator` option). -// -// Example: Given a validator registered as `NamespacedValidator("ipns", -// myValidator)`, all records with keys starting with `/ipns/` will be validated -// with `myValidator`. -func NamespacedValidator(ns string, v record.Validator) Option { - return func(o *Options) error { - nsval, ok := o.Validator.(record.NamespacedValidator) - if !ok { - return fmt.Errorf("can only add namespaced validators to a NamespacedValidator") - } - nsval[ns] = v - return nil - } -} - -// Protocols sets the protocols for the DHT -// -// Defaults to dht.DefaultProtocols -func Protocols(protocols ...protocol.ID) Option { - return func(o *Options) error { - o.Protocols = protocols - return nil - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.pb.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.pb.go deleted file mode 100644 index eb59b73c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.pb.go +++ /dev/null @@ -1,976 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: dht.proto - -package dht_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - pb "github.com/libp2p/go-libp2p-record/pb" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Message_MessageType int32 - -const ( - Message_PUT_VALUE Message_MessageType = 0 - Message_GET_VALUE Message_MessageType = 1 - Message_ADD_PROVIDER Message_MessageType = 2 - Message_GET_PROVIDERS Message_MessageType = 3 - Message_FIND_NODE Message_MessageType = 4 - Message_PING Message_MessageType = 5 -) - -var Message_MessageType_name = map[int32]string{ - 0: "PUT_VALUE", - 1: "GET_VALUE", - 2: "ADD_PROVIDER", - 3: "GET_PROVIDERS", - 4: "FIND_NODE", - 5: "PING", -} - -var Message_MessageType_value = map[string]int32{ - "PUT_VALUE": 0, - "GET_VALUE": 1, - "ADD_PROVIDER": 2, - "GET_PROVIDERS": 3, - "FIND_NODE": 4, - "PING": 5, -} - -func (x Message_MessageType) String() string { - return proto.EnumName(Message_MessageType_name, int32(x)) -} - -func (Message_MessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_616a434b24c97ff4, []int{0, 0} -} - -type Message_ConnectionType int32 - -const ( - // sender does not have a connection to peer, and no extra information (default) - Message_NOT_CONNECTED Message_ConnectionType = 0 - // sender has a live connection to peer - Message_CONNECTED Message_ConnectionType = 1 - // sender recently connected to peer - Message_CAN_CONNECT Message_ConnectionType = 2 - // sender recently tried to connect to peer repeatedly but failed to connect - // ("try" here is loose, but this should signal "made strong effort, failed") - Message_CANNOT_CONNECT Message_ConnectionType = 3 -) - -var Message_ConnectionType_name = map[int32]string{ - 0: "NOT_CONNECTED", - 1: "CONNECTED", - 2: "CAN_CONNECT", - 3: "CANNOT_CONNECT", -} - -var Message_ConnectionType_value = map[string]int32{ - "NOT_CONNECTED": 0, - "CONNECTED": 1, - "CAN_CONNECT": 2, - "CANNOT_CONNECT": 3, -} - -func (x Message_ConnectionType) String() string { - return proto.EnumName(Message_ConnectionType_name, int32(x)) -} - -func (Message_ConnectionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_616a434b24c97ff4, []int{0, 1} -} - -type Message struct { - // defines what type of message it is. - Type Message_MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=dht.pb.Message_MessageType" json:"type,omitempty"` - // defines what coral cluster level this query/response belongs to. - // in case we want to implement coral's cluster rings in the future. - ClusterLevelRaw int32 `protobuf:"varint,10,opt,name=clusterLevelRaw,proto3" json:"clusterLevelRaw,omitempty"` - // Used to specify the key associated with this message. - // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - // Used to return a value - // PUT_VALUE, GET_VALUE - Record *pb.Record `protobuf:"bytes,3,opt,name=record,proto3" json:"record,omitempty"` - // Used to return peers closer to a key in a query - // GET_VALUE, GET_PROVIDERS, FIND_NODE - CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closerPeers,proto3" json:"closerPeers,omitempty"` - // Used to return Providers - // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS - ProviderPeers []*Message_Peer `protobuf:"bytes,9,rep,name=providerPeers,proto3" json:"providerPeers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_616a434b24c97ff4, []int{0} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetType() Message_MessageType { - if m != nil { - return m.Type - } - return Message_PUT_VALUE -} - -func (m *Message) GetClusterLevelRaw() int32 { - if m != nil { - return m.ClusterLevelRaw - } - return 0 -} - -func (m *Message) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Message) GetRecord() *pb.Record { - if m != nil { - return m.Record - } - return nil -} - -func (m *Message) GetCloserPeers() []*Message_Peer { - if m != nil { - return m.CloserPeers - } - return nil -} - -func (m *Message) GetProviderPeers() []*Message_Peer { - if m != nil { - return m.ProviderPeers - } - return nil -} - -type Message_Peer struct { - // ID of a given peer. - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // multiaddrs for a given peer - Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"` - // used to signal the sender's connection capabilities to the peer - Connection Message_ConnectionType `protobuf:"varint,3,opt,name=connection,proto3,enum=dht.pb.Message_ConnectionType" json:"connection,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message_Peer) Reset() { *m = Message_Peer{} } -func (m *Message_Peer) String() string { return proto.CompactTextString(m) } -func (*Message_Peer) ProtoMessage() {} -func (*Message_Peer) Descriptor() ([]byte, []int) { - return fileDescriptor_616a434b24c97ff4, []int{0, 0} -} -func (m *Message_Peer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message_Peer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message_Peer.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message_Peer) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message_Peer.Merge(m, src) -} -func (m *Message_Peer) XXX_Size() int { - return m.Size() -} -func (m *Message_Peer) XXX_DiscardUnknown() { - xxx_messageInfo_Message_Peer.DiscardUnknown(m) -} - -var xxx_messageInfo_Message_Peer proto.InternalMessageInfo - -func (m *Message_Peer) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -func (m *Message_Peer) GetAddrs() [][]byte { - if m != nil { - return m.Addrs - } - return nil -} - -func (m *Message_Peer) GetConnection() Message_ConnectionType { - if m != nil { - return m.Connection - } - return Message_NOT_CONNECTED -} - -func init() { - proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value) - proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value) - proto.RegisterType((*Message)(nil), "dht.pb.Message") - proto.RegisterType((*Message_Peer)(nil), "dht.pb.Message.Peer") -} - -func init() { proto.RegisterFile("dht.proto", fileDescriptor_616a434b24c97ff4) } - -var fileDescriptor_616a434b24c97ff4 = []byte{ - // 428 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xc1, 0x6e, 0x9b, 0x40, - 0x10, 0xed, 0x02, 0x76, 0xe3, 0x01, 0x93, 0xcd, 0x28, 0x07, 0x94, 0x4a, 0x16, 0xf2, 0x89, 0x1e, - 0x02, 0x12, 0x95, 0x7a, 0xe8, 0xa1, 0x92, 0x0b, 0x34, 0xb2, 0x94, 0x62, 0x6b, 0xeb, 0xa4, 0x47, - 0xcb, 0xc0, 0xca, 0x41, 0xa5, 0x5e, 0x04, 0x24, 0x95, 0xbf, 0xb0, 0x3d, 0xf6, 0x13, 0x2a, 0x7f, - 0x49, 0x05, 0x84, 0x16, 0xfb, 0xd0, 0xd3, 0xbe, 0x37, 0xf3, 0xde, 0xce, 0xdb, 0xd1, 0xc2, 0x28, - 0x79, 0xa8, 0xec, 0xbc, 0x10, 0x95, 0xc0, 0x61, 0x03, 0xa3, 0x2b, 0x77, 0x9b, 0x56, 0x0f, 0x8f, - 0x91, 0x1d, 0x8b, 0x6f, 0x4e, 0x96, 0x46, 0xb9, 0x9b, 0x3b, 0x5b, 0x71, 0xdd, 0xa2, 0xeb, 0x82, - 0xc7, 0xa2, 0x48, 0x9c, 0x3c, 0x72, 0x5a, 0xd4, 0x7a, 0xa7, 0x3f, 0x14, 0x78, 0xf9, 0x89, 0x97, - 0xe5, 0x66, 0xcb, 0xd1, 0x01, 0xa5, 0xda, 0xe7, 0xdc, 0x20, 0x26, 0xb1, 0x74, 0xf7, 0x95, 0xdd, - 0x5e, 0x6b, 0x3f, 0xb7, 0xbb, 0x73, 0xb5, 0xcf, 0x39, 0x6b, 0x84, 0x68, 0xc1, 0x79, 0x9c, 0x3d, - 0x96, 0x15, 0x2f, 0x6e, 0xf9, 0x13, 0xcf, 0xd8, 0xe6, 0xbb, 0x01, 0x26, 0xb1, 0x06, 0xec, 0xb4, - 0x8c, 0x14, 0xe4, 0xaf, 0x7c, 0x6f, 0x48, 0x26, 0xb1, 0x34, 0x56, 0x43, 0x7c, 0x0d, 0xc3, 0x36, - 0x88, 0x21, 0x9b, 0xc4, 0x52, 0xdd, 0x0b, 0xbb, 0xcb, 0x15, 0xd9, 0xac, 0x41, 0xec, 0x59, 0x80, - 0x6f, 0x41, 0x8d, 0x33, 0x51, 0xf2, 0x62, 0xc9, 0x79, 0x51, 0x1a, 0x67, 0xa6, 0x6c, 0xa9, 0xee, - 0xe5, 0x69, 0xbc, 0xba, 0xc9, 0xfa, 0x42, 0x7c, 0x07, 0xe3, 0xbc, 0x10, 0x4f, 0x69, 0xd2, 0x39, - 0x47, 0xff, 0x71, 0x1e, 0x4b, 0xaf, 0x32, 0x50, 0x6a, 0x80, 0x3a, 0x48, 0x69, 0xd2, 0x6c, 0x44, - 0x63, 0x52, 0x9a, 0xe0, 0x25, 0x0c, 0x36, 0x49, 0x52, 0x94, 0x86, 0x64, 0xca, 0x96, 0xc6, 0x5a, - 0x82, 0xef, 0x01, 0x62, 0xb1, 0xdb, 0xf1, 0xb8, 0x4a, 0xc5, 0xae, 0x79, 0x90, 0xee, 0x4e, 0x4e, - 0xc7, 0x78, 0x7f, 0x15, 0xcd, 0x0a, 0x7b, 0x8e, 0x69, 0x0a, 0x6a, 0x6f, 0xbb, 0x38, 0x86, 0xd1, - 0xf2, 0x6e, 0xb5, 0xbe, 0x9f, 0xdd, 0xde, 0x05, 0xf4, 0x45, 0x4d, 0x6f, 0x82, 0x8e, 0x12, 0xa4, - 0xa0, 0xcd, 0x7c, 0x7f, 0xbd, 0x64, 0x8b, 0xfb, 0xb9, 0x1f, 0x30, 0x2a, 0xe1, 0x05, 0x8c, 0x6b, - 0x41, 0x57, 0xf9, 0x4c, 0xe5, 0xda, 0xf3, 0x71, 0x1e, 0xfa, 0xeb, 0x70, 0xe1, 0x07, 0x54, 0xc1, - 0x33, 0x50, 0x96, 0xf3, 0xf0, 0x86, 0x0e, 0xa6, 0x5f, 0x40, 0x3f, 0x0e, 0x52, 0xbb, 0xc3, 0xc5, - 0x6a, 0xed, 0x2d, 0xc2, 0x30, 0xf0, 0x56, 0x81, 0xdf, 0x4e, 0xfc, 0x47, 0x09, 0x9e, 0x83, 0xea, - 0xcd, 0xc2, 0x4e, 0x41, 0x25, 0x44, 0xd0, 0xbd, 0x59, 0xd8, 0x73, 0x51, 0xf9, 0x83, 0xf6, 0xf3, - 0x30, 0x21, 0xbf, 0x0e, 0x13, 0xf2, 0xfb, 0x30, 0x21, 0xd1, 0xb0, 0xf9, 0x5e, 0x6f, 0xfe, 0x04, - 0x00, 0x00, 0xff, 0xff, 0xf4, 0x3c, 0x3f, 0x3f, 0xa7, 0x02, 0x00, 0x00, -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintDht(dAtA, i, uint64(m.Type)) - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintDht(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.Record != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintDht(dAtA, i, uint64(m.Record.Size())) - n1, err := m.Record.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.CloserPeers) > 0 { - for _, msg := range m.CloserPeers { - dAtA[i] = 0x42 - i++ - i = encodeVarintDht(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.ProviderPeers) > 0 { - for _, msg := range m.ProviderPeers { - dAtA[i] = 0x4a - i++ - i = encodeVarintDht(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.ClusterLevelRaw != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintDht(dAtA, i, uint64(m.ClusterLevelRaw)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message_Peer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message_Peer) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Id) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintDht(dAtA, i, uint64(len(m.Id))) - i += copy(dAtA[i:], m.Id) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - dAtA[i] = 0x12 - i++ - i = encodeVarintDht(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.Connection != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintDht(dAtA, i, uint64(m.Connection)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintDht(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovDht(uint64(m.Type)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovDht(uint64(l)) - } - if m.Record != nil { - l = m.Record.Size() - n += 1 + l + sovDht(uint64(l)) - } - if len(m.CloserPeers) > 0 { - for _, e := range m.CloserPeers { - l = e.Size() - n += 1 + l + sovDht(uint64(l)) - } - } - if len(m.ProviderPeers) > 0 { - for _, e := range m.ProviderPeers { - l = e.Size() - n += 1 + l + sovDht(uint64(l)) - } - } - if m.ClusterLevelRaw != 0 { - n += 1 + sovDht(uint64(m.ClusterLevelRaw)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message_Peer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovDht(uint64(l)) - } - if len(m.Addrs) > 0 { - for _, b := range m.Addrs { - l = len(b) - n += 1 + l + sovDht(uint64(l)) - } - } - if m.Connection != 0 { - n += 1 + sovDht(uint64(m.Connection)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovDht(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozDht(x uint64) (n int) { - return sovDht(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Message_MessageType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Record == nil { - m.Record = &pb.Record{} - } - if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CloserPeers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CloserPeers = append(m.CloserPeers, &Message_Peer{}) - if err := m.CloserPeers[len(m.CloserPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderPeers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderPeers = append(m.ProviderPeers, &Message_Peer{}) - if err := m.ProviderPeers[len(m.ProviderPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterLevelRaw", wireType) - } - m.ClusterLevelRaw = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClusterLevelRaw |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipDht(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthDht - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthDht - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message_Peer) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Peer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Peer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDht - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDht - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addrs = append(m.Addrs, make([]byte, postIndex-iNdEx)) - copy(m.Addrs[len(m.Addrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Connection", wireType) - } - m.Connection = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDht - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Connection |= Message_ConnectionType(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipDht(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthDht - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthDht - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipDht(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDht - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDht - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDht - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthDht - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthDht - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDht - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipDht(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthDht - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthDht = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDht = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.proto b/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.proto deleted file mode 100644 index 4d2d1fd2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/dht.proto +++ /dev/null @@ -1,71 +0,0 @@ -// In order to re-generate the golang packages for `Message` you will need... -// 1. Protobuf binary (tested with protoc 3.0.0). - https://github.com/gogo/protobuf/releases -// 2. Gogo Protobuf (tested with gogo 0.3). - https://github.com/gogo/protobuf -// 3. To have cloned `libp2p/go-libp2p-{record,kad-dht}` under the same directory. -// Now from `libp2p/go-libp2p-kad-dht/pb` you can run... -// `protoc --gogo_out=. --proto_path=../../go-libp2p-record/pb/ --proto_path=./ dht.proto` - -syntax = "proto3"; -package dht.pb; - -import "github.com/libp2p/go-libp2p-record/pb/record.proto"; - -message Message { - enum MessageType { - PUT_VALUE = 0; - GET_VALUE = 1; - ADD_PROVIDER = 2; - GET_PROVIDERS = 3; - FIND_NODE = 4; - PING = 5; - } - - enum ConnectionType { - // sender does not have a connection to peer, and no extra information (default) - NOT_CONNECTED = 0; - - // sender has a live connection to peer - CONNECTED = 1; - - // sender recently connected to peer - CAN_CONNECT = 2; - - // sender recently tried to connect to peer repeatedly but failed to connect - // ("try" here is loose, but this should signal "made strong effort, failed") - CANNOT_CONNECT = 3; - } - - message Peer { - // ID of a given peer. - bytes id = 1; - - // multiaddrs for a given peer - repeated bytes addrs = 2; - - // used to signal the sender's connection capabilities to the peer - ConnectionType connection = 3; - } - - // defines what type of message it is. - MessageType type = 1; - - // defines what coral cluster level this query/response belongs to. - // in case we want to implement coral's cluster rings in the future. - int32 clusterLevelRaw = 10; - - // Used to specify the key associated with this message. - // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS - bytes key = 2; - - // Used to return a value - // PUT_VALUE, GET_VALUE - record.pb.Record record = 3; - - // Used to return peers closer to a key in a query - // GET_VALUE, GET_PROVIDERS, FIND_NODE - repeated Peer closerPeers = 8; - - // Used to return Providers - // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS - repeated Peer providerPeers = 9; -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/message.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/message.go deleted file mode 100644 index d8fd2727..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/pb/message.go +++ /dev/null @@ -1,183 +0,0 @@ -package dht_pb - -import ( - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" - b58 "github.com/mr-tron/base58/base58" - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("dht.pb") - -type PeerRoutingInfo struct { - peer.AddrInfo - network.Connectedness -} - -// NewMessage constructs a new dht message with given type, key, and level -func NewMessage(typ Message_MessageType, key []byte, level int) *Message { - m := &Message{ - Type: typ, - Key: key, - } - m.SetClusterLevel(level) - return m -} - -func peerRoutingInfoToPBPeer(p PeerRoutingInfo) *Message_Peer { - pbp := new(Message_Peer) - - pbp.Addrs = make([][]byte, len(p.Addrs)) - for i, maddr := range p.Addrs { - pbp.Addrs[i] = maddr.Bytes() // Bytes, not String. Compressed. - } - s := string(p.ID) - pbp.Id = []byte(s) - c := ConnectionType(p.Connectedness) - pbp.Connection = c - return pbp -} - -func peerInfoToPBPeer(p peer.AddrInfo) *Message_Peer { - pbp := new(Message_Peer) - - pbp.Addrs = make([][]byte, len(p.Addrs)) - for i, maddr := range p.Addrs { - pbp.Addrs[i] = maddr.Bytes() // Bytes, not String. Compressed. - } - pbp.Id = []byte(p.ID) - return pbp -} - -// PBPeerToPeer turns a *Message_Peer into its peer.AddrInfo counterpart -func PBPeerToPeerInfo(pbp *Message_Peer) *peer.AddrInfo { - return &peer.AddrInfo{ - ID: peer.ID(pbp.GetId()), - Addrs: pbp.Addresses(), - } -} - -// RawPeerInfosToPBPeers converts a slice of Peers into a slice of *Message_Peers, -// ready to go out on the wire. -func RawPeerInfosToPBPeers(peers []peer.AddrInfo) []*Message_Peer { - pbpeers := make([]*Message_Peer, len(peers)) - for i, p := range peers { - pbpeers[i] = peerInfoToPBPeer(p) - } - return pbpeers -} - -// PeersToPBPeers converts given []peer.Peer into a set of []*Message_Peer, -// which can be written to a message and sent out. the key thing this function -// does (in addition to PeersToPBPeers) is set the ConnectionType with -// information from the given network.Network. -func PeerInfosToPBPeers(n network.Network, peers []peer.AddrInfo) []*Message_Peer { - pbps := RawPeerInfosToPBPeers(peers) - for i, pbp := range pbps { - c := ConnectionType(n.Connectedness(peers[i].ID)) - pbp.Connection = c - } - return pbps -} - -func PeerRoutingInfosToPBPeers(peers []PeerRoutingInfo) []*Message_Peer { - pbpeers := make([]*Message_Peer, len(peers)) - for i, p := range peers { - pbpeers[i] = peerRoutingInfoToPBPeer(p) - } - return pbpeers -} - -// PBPeersToPeerInfos converts given []*Message_Peer into []peer.AddrInfo -// Invalid addresses will be silently omitted. -func PBPeersToPeerInfos(pbps []*Message_Peer) []*peer.AddrInfo { - peers := make([]*peer.AddrInfo, 0, len(pbps)) - for _, pbp := range pbps { - peers = append(peers, PBPeerToPeerInfo(pbp)) - } - return peers -} - -// Addresses returns a multiaddr associated with the Message_Peer entry -func (m *Message_Peer) Addresses() []ma.Multiaddr { - if m == nil { - return nil - } - - maddrs := make([]ma.Multiaddr, 0, len(m.Addrs)) - for _, addr := range m.Addrs { - maddr, err := ma.NewMultiaddrBytes(addr) - if err != nil { - log.Warningf("error decoding Multiaddr for peer: %s", m.GetId()) - continue - } - - maddrs = append(maddrs, maddr) - } - return maddrs -} - -// GetClusterLevel gets and adjusts the cluster level on the message. -// a +/- 1 adjustment is needed to distinguish a valid first level (1) and -// default "no value" protobuf behavior (0) -func (m *Message) GetClusterLevel() int { - level := m.GetClusterLevelRaw() - 1 - if level < 0 { - return 0 - } - return int(level) -} - -// SetClusterLevel adjusts and sets the cluster level on the message. -// a +/- 1 adjustment is needed to distinguish a valid first level (1) and -// default "no value" protobuf behavior (0) -func (m *Message) SetClusterLevel(level int) { - lvl := int32(level) - m.ClusterLevelRaw = lvl -} - -// Loggable turns a Message into machine-readable log output -func (m *Message) Loggable() map[string]interface{} { - return map[string]interface{}{ - "message": map[string]string{ - "type": m.Type.String(), - "key": b58.Encode([]byte(m.GetKey())), - }, - } -} - -// ConnectionType returns a Message_ConnectionType associated with the -// network.Connectedness. -func ConnectionType(c network.Connectedness) Message_ConnectionType { - switch c { - default: - return Message_NOT_CONNECTED - case network.NotConnected: - return Message_NOT_CONNECTED - case network.Connected: - return Message_CONNECTED - case network.CanConnect: - return Message_CAN_CONNECT - case network.CannotConnect: - return Message_CANNOT_CONNECT - } -} - -// Connectedness returns an network.Connectedness associated with the -// Message_ConnectionType. -func Connectedness(c Message_ConnectionType) network.Connectedness { - switch c { - default: - return network.NotConnected - case Message_NOT_CONNECTED: - return network.NotConnected - case Message_CONNECTED: - return network.Connected - case Message_CAN_CONNECT: - return network.CanConnect - case Message_CANNOT_CONNECT: - return network.CannotConnect - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/providers/providers.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/providers/providers.go deleted file mode 100644 index ec44cc51..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/providers/providers.go +++ /dev/null @@ -1,351 +0,0 @@ -package providers - -import ( - "context" - "encoding/binary" - "fmt" - "strings" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - - lru "github.com/hashicorp/golang-lru/simplelru" - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - autobatch "github.com/ipfs/go-datastore/autobatch" - dsq "github.com/ipfs/go-datastore/query" - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" - goprocessctx "github.com/jbenet/goprocess/context" - base32 "github.com/whyrusleeping/base32" -) - -var batchBufferSize = 256 - -var log = logging.Logger("providers") - -var lruCacheSize = 256 -var ProvideValidity = time.Hour * 24 -var defaultCleanupInterval = time.Hour - -type ProviderManager struct { - // all non channel fields are meant to be accessed only within - // the run method - providers *lru.LRU - dstore *autobatch.Datastore - - newprovs chan *addProv - getprovs chan *getProv - proc goprocess.Process - - cleanupInterval time.Duration -} - -type providerSet struct { - providers []peer.ID - set map[peer.ID]time.Time -} - -type addProv struct { - k cid.Cid - val peer.ID -} - -type getProv struct { - k cid.Cid - resp chan []peer.ID -} - -func NewProviderManager(ctx context.Context, local peer.ID, dstore ds.Batching) *ProviderManager { - pm := new(ProviderManager) - pm.getprovs = make(chan *getProv) - pm.newprovs = make(chan *addProv) - pm.dstore = autobatch.NewAutoBatching(dstore, batchBufferSize) - cache, err := lru.NewLRU(lruCacheSize, nil) - if err != nil { - panic(err) //only happens if negative value is passed to lru constructor - } - pm.providers = cache - - pm.proc = goprocessctx.WithContext(ctx) - pm.cleanupInterval = defaultCleanupInterval - pm.proc.Go(pm.run) - - return pm -} - -const providersKeyPrefix = "/providers/" - -func mkProvKey(k cid.Cid) string { - return providersKeyPrefix + base32.RawStdEncoding.EncodeToString(k.Bytes()) -} - -func (pm *ProviderManager) Process() goprocess.Process { - return pm.proc -} - -func (pm *ProviderManager) providersForKey(k cid.Cid) ([]peer.ID, error) { - pset, err := pm.getProvSet(k) - if err != nil { - return nil, err - } - return pset.providers, nil -} - -func (pm *ProviderManager) getProvSet(k cid.Cid) (*providerSet, error) { - cached, ok := pm.providers.Get(k) - if ok { - return cached.(*providerSet), nil - } - - pset, err := loadProvSet(pm.dstore, k) - if err != nil { - return nil, err - } - - if len(pset.providers) > 0 { - pm.providers.Add(k, pset) - } - - return pset, nil -} - -func loadProvSet(dstore ds.Datastore, k cid.Cid) (*providerSet, error) { - res, err := dstore.Query(dsq.Query{Prefix: mkProvKey(k)}) - if err != nil { - return nil, err - } - defer res.Close() - - now := time.Now() - out := newProviderSet() - for { - e, ok := res.NextSync() - if !ok { - break - } - if e.Error != nil { - log.Error("got an error: ", e.Error) - continue - } - - // check expiration time - t, err := readTimeValue(e.Value) - switch { - case err != nil: - // couldn't parse the time - log.Warning("parsing providers record from disk: ", err) - fallthrough - case now.Sub(t) > ProvideValidity: - // or just expired - err = dstore.Delete(ds.RawKey(e.Key)) - if err != nil && err != ds.ErrNotFound { - log.Warning("failed to remove provider record from disk: ", err) - } - continue - } - - lix := strings.LastIndex(e.Key, "/") - - decstr, err := base32.RawStdEncoding.DecodeString(e.Key[lix+1:]) - if err != nil { - log.Error("base32 decoding error: ", err) - err = dstore.Delete(ds.RawKey(e.Key)) - if err != nil && err != ds.ErrNotFound { - log.Warning("failed to remove provider record from disk: ", err) - } - continue - } - - pid := peer.ID(decstr) - - out.setVal(pid, t) - } - - return out, nil -} - -func readTimeValue(data []byte) (time.Time, error) { - nsec, n := binary.Varint(data) - if n <= 0 { - return time.Time{}, fmt.Errorf("failed to parse time") - } - - return time.Unix(0, nsec), nil -} - -func (pm *ProviderManager) addProv(k cid.Cid, p peer.ID) error { - now := time.Now() - if provs, ok := pm.providers.Get(k); ok { - provs.(*providerSet).setVal(p, now) - } // else not cached, just write through - - return writeProviderEntry(pm.dstore, k, p, now) -} - -func mkProvKeyFor(k cid.Cid, p peer.ID) string { - return mkProvKey(k) + "/" + base32.RawStdEncoding.EncodeToString([]byte(p)) -} - -func writeProviderEntry(dstore ds.Datastore, k cid.Cid, p peer.ID, t time.Time) error { - dsk := mkProvKeyFor(k, p) - - buf := make([]byte, 16) - n := binary.PutVarint(buf, t.UnixNano()) - - return dstore.Put(ds.NewKey(dsk), buf[:n]) -} - -func (pm *ProviderManager) run(proc goprocess.Process) { - var ( - gcQuery dsq.Results - gcQueryRes <-chan dsq.Result - gcSkip map[string]struct{} - gcTime time.Time - gcTimer = time.NewTimer(pm.cleanupInterval) - ) - - defer func() { - gcTimer.Stop() - if gcQuery != nil { - // don't really care if this fails. - _ = gcQuery.Close() - } - if err := pm.dstore.Flush(); err != nil { - log.Error("failed to flush datastore: ", err) - } - }() - - for { - select { - case np := <-pm.newprovs: - err := pm.addProv(np.k, np.val) - if err != nil { - log.Error("error adding new providers: ", err) - continue - } - if gcSkip != nil { - // we have an gc, tell it to skip this provider - // as we've updated it since the GC started. - gcSkip[mkProvKeyFor(np.k, np.val)] = struct{}{} - } - case gp := <-pm.getprovs: - provs, err := pm.providersForKey(gp.k) - if err != nil && err != ds.ErrNotFound { - log.Error("error reading providers: ", err) - } - - // set the cap so the user can't append to this. - gp.resp <- provs[0:len(provs):len(provs)] - case res, ok := <-gcQueryRes: - if !ok { - if err := gcQuery.Close(); err != nil { - log.Error("failed to close provider GC query: ", err) - } - gcTimer.Reset(pm.cleanupInterval) - - // cleanup GC round - gcQueryRes = nil - gcSkip = nil - gcQuery = nil - continue - } - if res.Error != nil { - log.Error("got error from GC query: ", res.Error) - continue - } - if _, ok := gcSkip[res.Key]; ok { - // We've updated this record since starting the - // GC round, skip it. - continue - } - - // check expiration time - t, err := readTimeValue(res.Value) - switch { - case err != nil: - // couldn't parse the time - log.Warning("parsing providers record from disk: ", err) - fallthrough - case gcTime.Sub(t) > ProvideValidity: - // or expired - err = pm.dstore.Delete(ds.RawKey(res.Key)) - if err != nil && err != ds.ErrNotFound { - log.Warning("failed to remove provider record from disk: ", err) - } - } - - case gcTime = <-gcTimer.C: - // You know the wonderful thing about caches? You can - // drop them. - // - // Much faster than GCing. - pm.providers.Purge() - - // Now, kick off a GC of the datastore. - q, err := pm.dstore.Query(dsq.Query{ - Prefix: providersKeyPrefix, - }) - if err != nil { - log.Error("provider record GC query failed: ", err) - continue - } - gcQuery = q - gcQueryRes = q.Next() - gcSkip = make(map[string]struct{}) - case <-proc.Closing(): - return - } - } -} - -// AddProvider adds a provider. -func (pm *ProviderManager) AddProvider(ctx context.Context, k cid.Cid, val peer.ID) { - prov := &addProv{ - k: k, - val: val, - } - select { - case pm.newprovs <- prov: - case <-ctx.Done(): - } -} - -// GetProviders returns the set of providers for the given key. -// This method _does not_ copy the set. Do not modify it. -func (pm *ProviderManager) GetProviders(ctx context.Context, k cid.Cid) []peer.ID { - gp := &getProv{ - k: k, - resp: make(chan []peer.ID, 1), // buffered to prevent sender from blocking - } - select { - case <-ctx.Done(): - return nil - case pm.getprovs <- gp: - } - select { - case <-ctx.Done(): - return nil - case peers := <-gp.resp: - return peers - } -} - -func newProviderSet() *providerSet { - return &providerSet{ - set: make(map[peer.ID]time.Time), - } -} - -func (ps *providerSet) Add(p peer.ID) { - ps.setVal(p, time.Now()) -} - -func (ps *providerSet) setVal(p peer.ID, t time.Time) { - _, found := ps.set[p] - if !found { - ps.providers = append(ps.providers, p) - } - - ps.set[p] = t -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/query.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/query.go deleted file mode 100644 index c0211a56..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/query.go +++ /dev/null @@ -1,315 +0,0 @@ -package dht - -import ( - "context" - "errors" - "sync" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" - todoctr "github.com/ipfs/go-todocounter" - process "github.com/jbenet/goprocess" - ctxproc "github.com/jbenet/goprocess/context" - kb "github.com/libp2p/go-libp2p-kbucket" - - pstore "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/routing" - queue "github.com/libp2p/go-libp2p-peerstore/queue" - notif "github.com/libp2p/go-libp2p-routing/notifications" -) - -// ErrNoPeersQueried is returned when we failed to connect to any peers. -var ErrNoPeersQueried = errors.New("failed to query any peers") - -var maxQueryConcurrency = AlphaValue - -type dhtQuery struct { - dht *IpfsDHT - key string // the key we're querying for - qfunc queryFunc // the function to execute per peer - concurrency int // the concurrency parameter -} - -type dhtQueryResult struct { - peer *peer.AddrInfo // FindPeer - closerPeers []*peer.AddrInfo // * - success bool - - finalSet *peer.Set - queriedSet *peer.Set -} - -// constructs query -func (dht *IpfsDHT) newQuery(k string, f queryFunc) *dhtQuery { - return &dhtQuery{ - key: k, - dht: dht, - qfunc: f, - concurrency: maxQueryConcurrency, - } -} - -// QueryFunc is a function that runs a particular query with a given peer. -// It returns either: -// - the value -// - a list of peers potentially better able to serve the query -// - an error -type queryFunc func(context.Context, peer.ID) (*dhtQueryResult, error) - -// Run runs the query at hand. pass in a list of peers to use first. -func (q *dhtQuery) Run(ctx context.Context, peers []peer.ID) (*dhtQueryResult, error) { - if len(peers) == 0 { - logger.Warning("Running query with no peers!") - return nil, kb.ErrLookupFailure - } - - select { - case <-ctx.Done(): - return nil, ctx.Err() - default: - } - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - runner := newQueryRunner(q) - return runner.Run(ctx, peers) -} - -type dhtQueryRunner struct { - query *dhtQuery // query to run - peersSeen *peer.Set // all peers queried. prevent querying same peer 2x - peersQueried *peer.Set // peers successfully connected to and queried - peersDialed *dialQueue // peers we have dialed to - peersToQuery *queue.ChanQueue // peers remaining to be queried - peersRemaining todoctr.Counter // peersToQuery + currently processing - - result *dhtQueryResult // query result - - rateLimit chan struct{} // processing semaphore - log logging.EventLogger - - runCtx context.Context - - proc process.Process - sync.RWMutex -} - -func newQueryRunner(q *dhtQuery) *dhtQueryRunner { - proc := process.WithParent(process.Background()) - ctx := ctxproc.OnClosingContext(proc) - peersToQuery := queue.NewChanQueue(ctx, queue.NewXORDistancePQ(string(q.key))) - r := &dhtQueryRunner{ - query: q, - peersRemaining: todoctr.NewSyncCounter(), - peersSeen: peer.NewSet(), - peersQueried: peer.NewSet(), - rateLimit: make(chan struct{}, q.concurrency), - peersToQuery: peersToQuery, - proc: proc, - } - dq, err := newDialQueue(&dqParams{ - ctx: ctx, - target: q.key, - in: peersToQuery, - dialFn: r.dialPeer, - config: dqDefaultConfig(), - }) - if err != nil { - panic(err) - } - r.peersDialed = dq - return r -} - -func (r *dhtQueryRunner) Run(ctx context.Context, peers []peer.ID) (*dhtQueryResult, error) { - r.log = logger - r.runCtx = ctx - - // setup concurrency rate limiting - for i := 0; i < r.query.concurrency; i++ { - r.rateLimit <- struct{}{} - } - - // add all the peers we got first. - for _, p := range peers { - r.addPeerToQuery(p) - } - - // start the dial queue only after we've added the initial set of peers. - // this is to avoid race conditions that could cause the peersRemaining todoctr - // to be done too early if the initial dial fails before others make it into the queue. - r.peersDialed.Start() - - // go do this thing. - // do it as a child proc to make sure Run exits - // ONLY AFTER spawn workers has exited. - r.proc.Go(r.spawnWorkers) - - // wait until they're done. - var err error - - // now, if the context finishes, close the proc. - // we have to do it here because the logic before is setup, which - // should run without closing the proc. - ctxproc.CloseAfterContext(r.proc, ctx) - - select { - case <-r.peersRemaining.Done(): - r.proc.Close() - if r.peersQueried.Size() == 0 { - err = ErrNoPeersQueried - } else { - err = routing.ErrNotFound - } - - case <-r.proc.Closed(): - err = r.runCtx.Err() - } - - r.RLock() - defer r.RUnlock() - - if r.result != nil && r.result.success { - return r.result, nil - } - - return &dhtQueryResult{ - finalSet: r.peersSeen, - queriedSet: r.peersQueried, - }, err -} - -func (r *dhtQueryRunner) addPeerToQuery(next peer.ID) { - // if new peer is ourselves... - if next == r.query.dht.self { - r.log.Debug("addPeerToQuery skip self") - return - } - - if !r.peersSeen.TryAdd(next) { - return - } - - notif.PublishQueryEvent(r.runCtx, ¬if.QueryEvent{ - Type: notif.AddingPeer, - ID: next, - }) - - r.peersRemaining.Increment(1) - select { - case r.peersToQuery.EnqChan <- next: - case <-r.proc.Closing(): - } -} - -func (r *dhtQueryRunner) spawnWorkers(proc process.Process) { - for { - select { - case <-r.peersRemaining.Done(): - return - - case <-r.proc.Closing(): - return - - case <-r.rateLimit: - ch := r.peersDialed.Consume() - select { - case p, ok := <-ch: - if !ok { - // this signals context cancellation. - return - } - // do it as a child func to make sure Run exits - // ONLY AFTER spawn workers has exited. - proc.Go(func(proc process.Process) { - r.queryPeer(proc, p) - }) - case <-r.proc.Closing(): - return - case <-r.peersRemaining.Done(): - return - } - } - } -} - -func (r *dhtQueryRunner) dialPeer(ctx context.Context, p peer.ID) error { - // short-circuit if we're already connected. - if r.query.dht.host.Network().Connectedness(p) == network.Connected { - return nil - } - - logger.Debug("not connected. dialing.") - notif.PublishQueryEvent(r.runCtx, ¬if.QueryEvent{ - Type: notif.DialingPeer, - ID: p, - }) - - pi := peer.AddrInfo{ID: p} - if err := r.query.dht.host.Connect(ctx, pi); err != nil { - logger.Debugf("error connecting: %s", err) - notif.PublishQueryEvent(r.runCtx, ¬if.QueryEvent{ - Type: notif.QueryError, - Extra: err.Error(), - ID: p, - }) - - // This peer is dropping out of the race. - r.peersRemaining.Decrement(1) - return err - } - logger.Debugf("connected. dial success.") - return nil -} - -func (r *dhtQueryRunner) queryPeer(proc process.Process, p peer.ID) { - // ok let's do this! - - // create a context from our proc. - ctx := ctxproc.OnClosingContext(proc) - - // make sure we do this when we exit - defer func() { - // signal we're done processing peer p - r.peersRemaining.Decrement(1) - r.rateLimit <- struct{}{} - }() - - // finally, run the query against this peer - res, err := r.query.qfunc(ctx, p) - - r.peersQueried.Add(p) - - if err != nil { - logger.Debugf("ERROR worker for: %v %v", p, err) - } else if res.success { - logger.Debugf("SUCCESS worker for: %v %s", p, res) - r.Lock() - r.result = res - r.Unlock() - if res.peer != nil { - r.query.dht.peerstore.AddAddrs(res.peer.ID, res.peer.Addrs, pstore.TempAddrTTL) - } - go r.proc.Close() // signal to everyone that we're done. - // must be async, as we're one of the children, and Close blocks. - - } else if len(res.closerPeers) > 0 { - logger.Debugf("PEERS CLOSER -- worker for: %v (%d closer peers)", p, len(res.closerPeers)) - for _, next := range res.closerPeers { - if next.ID == r.query.dht.self { // don't add self. - logger.Debugf("PEERS CLOSER -- worker for: %v found self", p) - continue - } - - // add their addresses to the dialer's peerstore - r.query.dht.peerstore.AddAddrs(next.ID, next.Addrs, pstore.TempAddrTTL) - r.addPeerToQuery(next.ID) - logger.Debugf("PEERS CLOSER -- worker for: %v added %v (%v)", p, next.ID, next.Addrs) - } - } else { - logger.Debugf("QUERY worker for: %v - not found, and no closer peers.", p) - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/records.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/records.go deleted file mode 100644 index 5f641b05..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/records.go +++ /dev/null @@ -1,137 +0,0 @@ -package dht - -import ( - "context" - "fmt" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - ci "github.com/libp2p/go-libp2p-core/crypto" -) - -// MaxRecordAge specifies the maximum time that any node will hold onto a record -// from the time its received. This does not apply to any other forms of validity that -// the record may contain. -// For example, a record may contain an ipns entry with an EOL saying its valid -// until the year 2020 (a great time in the future). For that record to stick around -// it must be rebroadcasted more frequently than once every 'MaxRecordAge' -const MaxRecordAge = time.Hour * 36 - -type pubkrs struct { - pubk ci.PubKey - err error -} - -func (dht *IpfsDHT) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) { - logger.Debugf("getPublicKey for: %s", p) - - // Check locally. Will also try to extract the public key from the peer - // ID itself if possible (if inlined). - pk := dht.peerstore.PubKey(p) - if pk != nil { - return pk, nil - } - - // Try getting the public key both directly from the node it identifies - // and from the DHT, in parallel - ctx, cancel := context.WithCancel(ctx) - defer cancel() - resp := make(chan pubkrs, 2) - go func() { - pubk, err := dht.getPublicKeyFromNode(ctx, p) - resp <- pubkrs{pubk, err} - }() - - // Note that the number of open connections is capped by the dial - // limiter, so there is a chance that getPublicKeyFromDHT(), which - // potentially opens a lot of connections, will block - // getPublicKeyFromNode() from getting a connection. - // Currently this doesn't seem to cause an issue so leaving as is - // for now. - go func() { - pubk, err := dht.getPublicKeyFromDHT(ctx, p) - resp <- pubkrs{pubk, err} - }() - - // Wait for one of the two go routines to return - // a public key (or for both to error out) - var err error - for i := 0; i < 2; i++ { - r := <-resp - if r.err == nil { - // Found the public key - err := dht.peerstore.AddPubKey(p, r.pubk) - if err != nil { - logger.Warningf("Failed to add public key to peerstore for %v", p) - } - return r.pubk, nil - } - err = r.err - } - - // Both go routines failed to find a public key - return nil, err -} - -func (dht *IpfsDHT) getPublicKeyFromDHT(ctx context.Context, p peer.ID) (ci.PubKey, error) { - // Only retrieve one value, because the public key is immutable - // so there's no need to retrieve multiple versions - pkkey := routing.KeyForPublicKey(p) - val, err := dht.GetValue(ctx, pkkey, Quorum(1)) - if err != nil { - return nil, err - } - - pubk, err := ci.UnmarshalPublicKey(val) - if err != nil { - logger.Errorf("Could not unmarshall public key retrieved from DHT for %v", p) - return nil, err - } - - // Note: No need to check that public key hash matches peer ID - // because this is done by GetValues() - logger.Debugf("Got public key for %s from DHT", p) - return pubk, nil -} - -func (dht *IpfsDHT) getPublicKeyFromNode(ctx context.Context, p peer.ID) (ci.PubKey, error) { - // check locally, just in case... - pk := dht.peerstore.PubKey(p) - if pk != nil { - return pk, nil - } - - // Get the key from the node itself - pkkey := routing.KeyForPublicKey(p) - pmes, err := dht.getValueSingle(ctx, p, pkkey) - if err != nil { - return nil, err - } - - // node doesn't have key :( - record := pmes.GetRecord() - if record == nil { - return nil, fmt.Errorf("node %v not responding with its public key", p) - } - - pubk, err := ci.UnmarshalPublicKey(record.GetValue()) - if err != nil { - logger.Errorf("Could not unmarshall public key for %v", p) - return nil, err - } - - // Make sure the public key matches the peer ID - id, err := peer.IDFromPublicKey(pubk) - if err != nil { - logger.Errorf("Could not extract peer id from public key for %v", p) - return nil, err - } - if id != p { - return nil, fmt.Errorf("public key %v does not match peer %v", id, p) - } - - logger.Debugf("Got public key from node %v itself", p) - return pubk, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/routing.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/routing.go deleted file mode 100644 index 9050ef51..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/routing.go +++ /dev/null @@ -1,717 +0,0 @@ -package dht - -import ( - "bytes" - "context" - "fmt" - "runtime" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/routing" - - cid "github.com/ipfs/go-cid" - u "github.com/ipfs/go-ipfs-util" - logging "github.com/ipfs/go-log" - pb "github.com/libp2p/go-libp2p-kad-dht/pb" - kb "github.com/libp2p/go-libp2p-kbucket" - record "github.com/libp2p/go-libp2p-record" -) - -// asyncQueryBuffer is the size of buffered channels in async queries. This -// buffer allows multiple queries to execute simultaneously, return their -// results and continue querying closer peers. Note that different query -// results will wait for the channel to drain. -var asyncQueryBuffer = 10 - -// This file implements the Routing interface for the IpfsDHT struct. - -// Basic Put/Get - -// PutValue adds value corresponding to given Key. -// This is the top level "Store" operation of the DHT -func (dht *IpfsDHT) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) (err error) { - eip := logger.EventBegin(ctx, "PutValue") - defer func() { - eip.Append(loggableKey(key)) - if err != nil { - eip.SetError(err) - } - eip.Done() - }() - logger.Debugf("PutValue %s", key) - - // don't even allow local users to put bad values. - if err := dht.Validator.Validate(key, value); err != nil { - return err - } - - old, err := dht.getLocal(key) - if err != nil { - // Means something is wrong with the datastore. - return err - } - - // Check if we have an old value that's not the same as the new one. - if old != nil && !bytes.Equal(old.GetValue(), value) { - // Check to see if the new one is better. - i, err := dht.Validator.Select(key, [][]byte{value, old.GetValue()}) - if err != nil { - return err - } - if i != 0 { - return fmt.Errorf("can't replace a newer value with an older value") - } - } - - rec := record.MakePutRecord(key, value) - rec.TimeReceived = u.FormatRFC3339(time.Now()) - err = dht.putLocal(key, rec) - if err != nil { - return err - } - - pchan, err := dht.GetClosestPeers(ctx, key) - if err != nil { - return err - } - - wg := sync.WaitGroup{} - for p := range pchan { - wg.Add(1) - go func(p peer.ID) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - defer wg.Done() - routing.PublishQueryEvent(ctx, &routing.QueryEvent{ - Type: routing.Value, - ID: p, - }) - - err := dht.putValueToPeer(ctx, p, rec) - if err != nil { - logger.Debugf("failed putting value to peer: %s", err) - } - }(p) - } - wg.Wait() - return nil -} - -// RecvdVal stores a value and the peer from which we got the value. -type RecvdVal struct { - Val []byte - From peer.ID -} - -// GetValue searches for the value corresponding to given Key. -func (dht *IpfsDHT) GetValue(ctx context.Context, key string, opts ...routing.Option) (_ []byte, err error) { - eip := logger.EventBegin(ctx, "GetValue") - defer func() { - eip.Append(loggableKey(key)) - if err != nil { - eip.SetError(err) - } - eip.Done() - }() - - // apply defaultQuorum if relevant - var cfg routing.Options - if err := cfg.Apply(opts...); err != nil { - return nil, err - } - opts = append(opts, Quorum(getQuorum(&cfg, defaultQuorum))) - - responses, err := dht.SearchValue(ctx, key, opts...) - if err != nil { - return nil, err - } - var best []byte - - for r := range responses { - best = r - } - - if ctx.Err() != nil { - return best, ctx.Err() - } - - if best == nil { - return nil, routing.ErrNotFound - } - logger.Debugf("GetValue %v %v", key, best) - return best, nil -} - -func (dht *IpfsDHT) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - var cfg routing.Options - if err := cfg.Apply(opts...); err != nil { - return nil, err - } - - responsesNeeded := 0 - if !cfg.Offline { - responsesNeeded = getQuorum(&cfg, -1) - } - - valCh, err := dht.getValues(ctx, key, responsesNeeded) - if err != nil { - return nil, err - } - - out := make(chan []byte) - go func() { - defer close(out) - - maxVals := responsesNeeded - if maxVals < 0 { - maxVals = defaultQuorum * 4 // we want some upper bound on how - // much correctional entries we will send - } - - // vals is used collect entries we got so far and send corrections to peers - // when we exit this function - vals := make([]RecvdVal, 0, maxVals) - var best *RecvdVal - - defer func() { - if len(vals) <= 1 || best == nil { - return - } - fixupRec := record.MakePutRecord(key, best.Val) - for _, v := range vals { - // if someone sent us a different 'less-valid' record, lets correct them - if !bytes.Equal(v.Val, best.Val) { - go func(v RecvdVal) { - if v.From == dht.self { - err := dht.putLocal(key, fixupRec) - if err != nil { - logger.Error("Error correcting local dht entry:", err) - } - return - } - ctx, cancel := context.WithTimeout(dht.Context(), time.Second*30) - defer cancel() - err := dht.putValueToPeer(ctx, v.From, fixupRec) - if err != nil { - logger.Debug("Error correcting DHT entry: ", err) - } - }(v) - } - } - }() - - for { - select { - case v, ok := <-valCh: - if !ok { - return - } - - if len(vals) < maxVals { - vals = append(vals, v) - } - - if v.Val == nil { - continue - } - // Select best value - if best != nil { - if bytes.Equal(best.Val, v.Val) { - continue - } - sel, err := dht.Validator.Select(key, [][]byte{best.Val, v.Val}) - if err != nil { - logger.Warning("Failed to select dht key: ", err) - continue - } - if sel != 1 { - continue - } - } - best = &v - select { - case out <- v.Val: - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } - }() - - return out, nil -} - -// GetValues gets nvals values corresponding to the given key. -func (dht *IpfsDHT) GetValues(ctx context.Context, key string, nvals int) (_ []RecvdVal, err error) { - eip := logger.EventBegin(ctx, "GetValues") - - eip.Append(loggableKey(key)) - defer eip.Done() - - valCh, err := dht.getValues(ctx, key, nvals) - if err != nil { - eip.SetError(err) - return nil, err - } - - out := make([]RecvdVal, 0, nvals) - for val := range valCh { - out = append(out, val) - } - - return out, ctx.Err() -} - -func (dht *IpfsDHT) getValues(ctx context.Context, key string, nvals int) (<-chan RecvdVal, error) { - vals := make(chan RecvdVal, 1) - - done := func(err error) (<-chan RecvdVal, error) { - defer close(vals) - return vals, err - } - - // If we have it local, don't bother doing an RPC! - lrec, err := dht.getLocal(key) - if err != nil { - // something is wrong with the datastore. - return done(err) - } - if lrec != nil { - // TODO: this is tricky, we don't always want to trust our own value - // what if the authoritative source updated it? - logger.Debug("have it locally") - vals <- RecvdVal{ - Val: lrec.GetValue(), - From: dht.self, - } - - if nvals == 0 || nvals == 1 { - return done(nil) - } - - nvals-- - } else if nvals == 0 { - return done(routing.ErrNotFound) - } - - // get closest peers in the routing table - rtp := dht.routingTable.NearestPeers(kb.ConvertKey(key), AlphaValue) - logger.Debugf("peers in rt: %d %s", len(rtp), rtp) - if len(rtp) == 0 { - logger.Warning("No peers from routing table!") - return done(kb.ErrLookupFailure) - } - - var valslock sync.Mutex - var got int - - // setup the Query - parent := ctx - query := dht.newQuery(key, func(ctx context.Context, p peer.ID) (*dhtQueryResult, error) { - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.SendingQuery, - ID: p, - }) - - rec, peers, err := dht.getValueOrPeers(ctx, p, key) - switch err { - case routing.ErrNotFound: - // in this case, they responded with nothing, - // still send a notification so listeners can know the - // request has completed 'successfully' - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.PeerResponse, - ID: p, - }) - return nil, err - default: - return nil, err - - case nil, errInvalidRecord: - // in either of these cases, we want to keep going - } - - res := &dhtQueryResult{closerPeers: peers} - - if rec.GetValue() != nil || err == errInvalidRecord { - rv := RecvdVal{ - Val: rec.GetValue(), - From: p, - } - valslock.Lock() - select { - case vals <- rv: - case <-ctx.Done(): - valslock.Unlock() - return nil, ctx.Err() - } - got++ - - // If we have collected enough records, we're done - if nvals == got { - res.success = true - } - valslock.Unlock() - } - - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.PeerResponse, - ID: p, - Responses: peers, - }) - - return res, nil - }) - - go func() { - reqCtx, cancel := context.WithTimeout(ctx, time.Minute) - defer cancel() - - _, err = query.Run(reqCtx, rtp) - - // We do have some values but we either ran out of peers to query or - // searched for a whole minute. - // - // We'll just call this a success. - if got > 0 && (err == routing.ErrNotFound || reqCtx.Err() == context.DeadlineExceeded) { - err = nil - } - done(err) - }() - - return vals, nil -} - -// Provider abstraction for indirect stores. -// Some DHTs store values directly, while an indirect store stores pointers to -// locations of the value, similarly to Coral and Mainline DHT. - -// Provide makes this node announce that it can provide a value for the given key -func (dht *IpfsDHT) Provide(ctx context.Context, key cid.Cid, brdcst bool) (err error) { - eip := logger.EventBegin(ctx, "Provide", key, logging.LoggableMap{"broadcast": brdcst}) - defer func() { - if err != nil { - eip.SetError(err) - } - eip.Done() - }() - - // add self locally - dht.providers.AddProvider(ctx, key, dht.self) - if !brdcst { - return nil - } - - peers, err := dht.GetClosestPeers(ctx, key.KeyString()) - if err != nil { - return err - } - - mes, err := dht.makeProvRecord(key) - if err != nil { - return err - } - - wg := sync.WaitGroup{} - for p := range peers { - wg.Add(1) - go func(p peer.ID) { - defer wg.Done() - logger.Debugf("putProvider(%s, %s)", key, p) - err := dht.sendMessage(ctx, p, mes) - if err != nil { - logger.Debug(err) - } - }(p) - } - wg.Wait() - return nil -} -func (dht *IpfsDHT) makeProvRecord(skey cid.Cid) (*pb.Message, error) { - pi := peer.AddrInfo{ - ID: dht.self, - Addrs: dht.host.Addrs(), - } - - // // only share WAN-friendly addresses ?? - // pi.Addrs = addrutil.WANShareableAddrs(pi.Addrs) - if len(pi.Addrs) < 1 { - return nil, fmt.Errorf("no known addresses for self. cannot put provider.") - } - - pmes := pb.NewMessage(pb.Message_ADD_PROVIDER, skey.Bytes(), 0) - pmes.ProviderPeers = pb.RawPeerInfosToPBPeers([]peer.AddrInfo{pi}) - return pmes, nil -} - -// FindProviders searches until the context expires. -func (dht *IpfsDHT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrInfo, error) { - var providers []peer.AddrInfo - for p := range dht.FindProvidersAsync(ctx, c, KValue) { - providers = append(providers, p) - } - return providers, nil -} - -// FindProvidersAsync is the same thing as FindProviders, but returns a channel. -// Peers will be returned on the channel as soon as they are found, even before -// the search query completes. -func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key cid.Cid, count int) <-chan peer.AddrInfo { - logger.Event(ctx, "findProviders", key) - peerOut := make(chan peer.AddrInfo, count) - go dht.findProvidersAsyncRoutine(ctx, key, count, peerOut) - return peerOut -} - -func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key cid.Cid, count int, peerOut chan peer.AddrInfo) { - defer logger.EventBegin(ctx, "findProvidersAsync", key).Done() - defer close(peerOut) - - ps := peer.NewLimitedSet(count) - provs := dht.providers.GetProviders(ctx, key) - for _, p := range provs { - // NOTE: Assuming that this list of peers is unique - if ps.TryAdd(p) { - pi := dht.peerstore.PeerInfo(p) - select { - case peerOut <- pi: - case <-ctx.Done(): - return - } - } - - // If we have enough peers locally, don't bother with remote RPC - // TODO: is this a DOS vector? - if ps.Size() >= count { - return - } - } - - peers := dht.routingTable.NearestPeers(kb.ConvertKey(key.KeyString()), AlphaValue) - if len(peers) == 0 { - routing.PublishQueryEvent(ctx, &routing.QueryEvent{ - Type: routing.QueryError, - Extra: kb.ErrLookupFailure.Error(), - }) - return - } - - // setup the Query - parent := ctx - query := dht.newQuery(key.KeyString(), func(ctx context.Context, p peer.ID) (*dhtQueryResult, error) { - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.SendingQuery, - ID: p, - }) - pmes, err := dht.findProvidersSingle(ctx, p, key) - if err != nil { - return nil, err - } - - logger.Debugf("%d provider entries", len(pmes.GetProviderPeers())) - provs := pb.PBPeersToPeerInfos(pmes.GetProviderPeers()) - logger.Debugf("%d provider entries decoded", len(provs)) - - // Add unique providers from request, up to 'count' - for _, prov := range provs { - if prov.ID != dht.self { - dht.peerstore.AddAddrs(prov.ID, prov.Addrs, peerstore.TempAddrTTL) - } - logger.Debugf("got provider: %s", prov) - if ps.TryAdd(prov.ID) { - logger.Debugf("using provider: %s", prov) - select { - case peerOut <- *prov: - case <-ctx.Done(): - logger.Debug("context timed out sending more providers") - return nil, ctx.Err() - } - } - if ps.Size() >= count { - logger.Debugf("got enough providers (%d/%d)", ps.Size(), count) - return &dhtQueryResult{success: true}, nil - } - } - - // Give closer peers back to the query to be queried - closer := pmes.GetCloserPeers() - clpeers := pb.PBPeersToPeerInfos(closer) - logger.Debugf("got closer peers: %d %s", len(clpeers), clpeers) - - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.PeerResponse, - ID: p, - Responses: clpeers, - }) - return &dhtQueryResult{closerPeers: clpeers}, nil - }) - - _, err := query.Run(ctx, peers) - if err != nil { - logger.Debugf("Query error: %s", err) - // Special handling for issue: https://github.com/ipfs/go-ipfs/issues/3032 - if fmt.Sprint(err) == "" { - logger.Error("reproduced bug 3032:") - logger.Errorf("Errors type information: %#v", err) - logger.Errorf("go version: %s", runtime.Version()) - logger.Error("please report this information to: https://github.com/ipfs/go-ipfs/issues/3032") - - // replace problematic error with something that won't crash the daemon - err = fmt.Errorf("") - } - routing.PublishQueryEvent(ctx, &routing.QueryEvent{ - Type: routing.QueryError, - Extra: err.Error(), - }) - } -} - -// FindPeer searches for a peer with given ID. -func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (_ peer.AddrInfo, err error) { - eip := logger.EventBegin(ctx, "FindPeer", id) - defer func() { - if err != nil { - eip.SetError(err) - } - eip.Done() - }() - - // Check if were already connected to them - if pi := dht.FindLocal(id); pi.ID != "" { - return pi, nil - } - - peers := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) - if len(peers) == 0 { - return peer.AddrInfo{}, kb.ErrLookupFailure - } - - // Sanity... - for _, p := range peers { - if p == id { - logger.Debug("found target peer in list of closest peers...") - return dht.peerstore.PeerInfo(p), nil - } - } - - // setup the Query - parent := ctx - query := dht.newQuery(string(id), func(ctx context.Context, p peer.ID) (*dhtQueryResult, error) { - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.SendingQuery, - ID: p, - }) - - pmes, err := dht.findPeerSingle(ctx, p, id) - if err != nil { - return nil, err - } - - closer := pmes.GetCloserPeers() - clpeerInfos := pb.PBPeersToPeerInfos(closer) - - // see if we got the peer here - for _, npi := range clpeerInfos { - if npi.ID == id { - return &dhtQueryResult{ - peer: npi, - success: true, - }, nil - } - } - - routing.PublishQueryEvent(parent, &routing.QueryEvent{ - Type: routing.PeerResponse, - ID: p, - Responses: clpeerInfos, - }) - - return &dhtQueryResult{closerPeers: clpeerInfos}, nil - }) - - // run it! - result, err := query.Run(ctx, peers) - if err != nil { - return peer.AddrInfo{}, err - } - - logger.Debugf("FindPeer %v %v", id, result.success) - if result.peer.ID == "" { - return peer.AddrInfo{}, routing.ErrNotFound - } - - return *result.peer, nil -} - -// FindPeersConnectedToPeer searches for peers directly connected to a given peer. -func (dht *IpfsDHT) FindPeersConnectedToPeer(ctx context.Context, id peer.ID) (<-chan *peer.AddrInfo, error) { - - peerchan := make(chan *peer.AddrInfo, asyncQueryBuffer) - peersSeen := make(map[peer.ID]struct{}) - var peersSeenMx sync.Mutex - - peers := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) - if len(peers) == 0 { - return nil, kb.ErrLookupFailure - } - - // setup the Query - query := dht.newQuery(string(id), func(ctx context.Context, p peer.ID) (*dhtQueryResult, error) { - - pmes, err := dht.findPeerSingle(ctx, p, id) - if err != nil { - return nil, err - } - - var clpeers []*peer.AddrInfo - closer := pmes.GetCloserPeers() - for _, pbp := range closer { - pi := pb.PBPeerToPeerInfo(pbp) - - // skip peers already seen - peersSeenMx.Lock() - if _, found := peersSeen[pi.ID]; found { - peersSeenMx.Unlock() - continue - } - peersSeen[pi.ID] = struct{}{} - peersSeenMx.Unlock() - - // if peer is connected, send it to our client. - if pb.Connectedness(pbp.Connection) == network.Connected { - select { - case <-ctx.Done(): - return nil, ctx.Err() - case peerchan <- pi: - } - } - - // if peer is the peer we're looking for, don't bother querying it. - // TODO maybe query it? - if pb.Connectedness(pbp.Connection) != network.Connected { - clpeers = append(clpeers, pi) - } - } - - return &dhtQueryResult{closerPeers: clpeers}, nil - }) - - // run it! run it asynchronously to gen peers as results are found. - // this does no error checking - go func() { - if _, err := query.Run(ctx, peers); err != nil { - logger.Debug(err) - } - - // close the peerchan channel when done. - close(peerchan) - }() - - return peerchan, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/routing_options.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/routing_options.go deleted file mode 100644 index 591ce54c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/routing_options.go +++ /dev/null @@ -1,29 +0,0 @@ -package dht - -import "github.com/libp2p/go-libp2p-core/routing" - -type quorumOptionKey struct{} - -const defaultQuorum = 16 - -// Quorum is a DHT option that tells the DHT how many peers it needs to get -// values from before returning the best one. -// -// Default: 16 -func Quorum(n int) routing.Option { - return func(opts *routing.Options) error { - if opts.Other == nil { - opts.Other = make(map[interface{}]interface{}, 1) - } - opts.Other[quorumOptionKey{}] = n - return nil - } -} - -func getQuorum(opts *routing.Options, ndefault int) int { - responsesNeeded, ok := opts.Other[quorumOptionKey{}].(int) - if !ok { - responsesNeeded = ndefault - } - return responsesNeeded -} diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht/util.go b/vendor/github.com/libp2p/go-libp2p-kad-dht/util.go deleted file mode 100644 index 6ab5c006..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht/util.go +++ /dev/null @@ -1,10 +0,0 @@ -package dht - -// Pool size is the number of nodes used for group find/set RPC calls -var PoolSize = 6 - -// K is the maximum number of requests to perform before returning failure. -var KValue = 20 - -// Alpha is the concurrency factor for asynchronous requests. -var AlphaValue = 3 diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/.travis.yml b/vendor/github.com/libp2p/go-libp2p-kbucket/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/LICENSE b/vendor/github.com/libp2p/go-libp2p-kbucket/LICENSE deleted file mode 100644 index 55a2d036..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/README.md b/vendor/github.com/libp2p/go-libp2p-kbucket/README.md deleted file mode 100644 index 6ce5db6f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# go-libp2p-kbucket - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A kbucket implementation for use as a routing table in go-libp2p-kad-dht - -## Documenation - -See https://godoc.org/github.com/libp2p/go-libp2p-kbucket. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-key/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on libp2p? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 2.2.23: QmSNE1XryoCMnZCbRaj1D23k6YKCaTQ386eJciu1pAfu8M diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/bucket.go b/vendor/github.com/libp2p/go-libp2p-kbucket/bucket.go deleted file mode 100644 index bf3f2ee6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/bucket.go +++ /dev/null @@ -1,110 +0,0 @@ -package kbucket - -import ( - "container/list" - "sync" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// Bucket holds a list of peers. -type Bucket struct { - lk sync.RWMutex - list *list.List -} - -func newBucket() *Bucket { - b := new(Bucket) - b.list = list.New() - return b -} - -func (b *Bucket) Peers() []peer.ID { - b.lk.RLock() - defer b.lk.RUnlock() - ps := make([]peer.ID, 0, b.list.Len()) - for e := b.list.Front(); e != nil; e = e.Next() { - id := e.Value.(peer.ID) - ps = append(ps, id) - } - return ps -} - -func (b *Bucket) Has(id peer.ID) bool { - b.lk.RLock() - defer b.lk.RUnlock() - for e := b.list.Front(); e != nil; e = e.Next() { - if e.Value.(peer.ID) == id { - return true - } - } - return false -} - -func (b *Bucket) Remove(id peer.ID) bool { - b.lk.Lock() - defer b.lk.Unlock() - for e := b.list.Front(); e != nil; e = e.Next() { - if e.Value.(peer.ID) == id { - b.list.Remove(e) - return true - } - } - return false -} - -func (b *Bucket) MoveToFront(id peer.ID) { - b.lk.Lock() - defer b.lk.Unlock() - for e := b.list.Front(); e != nil; e = e.Next() { - if e.Value.(peer.ID) == id { - b.list.MoveToFront(e) - } - } -} - -func (b *Bucket) PushFront(p peer.ID) { - b.lk.Lock() - b.list.PushFront(p) - b.lk.Unlock() -} - -func (b *Bucket) PopBack() peer.ID { - b.lk.Lock() - defer b.lk.Unlock() - last := b.list.Back() - b.list.Remove(last) - return last.Value.(peer.ID) -} - -func (b *Bucket) Len() int { - b.lk.RLock() - defer b.lk.RUnlock() - return b.list.Len() -} - -// Split splits a buckets peers into two buckets, the methods receiver will have -// peers with CPL equal to cpl, the returned bucket will have peers with CPL -// greater than cpl (returned bucket has closer peers) -func (b *Bucket) Split(cpl int, target ID) *Bucket { - b.lk.Lock() - defer b.lk.Unlock() - - out := list.New() - newbuck := newBucket() - newbuck.list = out - e := b.list.Front() - for e != nil { - peerID := ConvertPeerID(e.Value.(peer.ID)) - peerCPL := CommonPrefixLen(peerID, target) - if peerCPL > cpl { - cur := e - out.PushBack(e.Value) - e = e.Next() - b.list.Remove(cur) - continue - } - e = e.Next() - } - return newbuck -} diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/codecov.yml b/vendor/github.com/libp2p/go-libp2p-kbucket/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/go.mod b/vendor/github.com/libp2p/go-libp2p-kbucket/go.mod deleted file mode 100644 index 982ac344..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/libp2p/go-libp2p-kbucket - -require ( - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-peerstore v0.1.0 - github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 -) diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/go.sum b/vendor/github.com/libp2p/go-libp2p-kbucket/go.sum deleted file mode 100644 index ac70a977..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/go.sum +++ /dev/null @@ -1,121 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/keyspace.go b/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/keyspace.go deleted file mode 100644 index e26a0e6d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/keyspace.go +++ /dev/null @@ -1,97 +0,0 @@ -package keyspace - -import ( - "sort" - - "math/big" -) - -// Key represents an identifier in a KeySpace. It holds a reference to the -// associated KeySpace, as well references to both the Original identifier, -// as well as the new, KeySpace Bytes one. -type Key struct { - - // Space is the KeySpace this Key is related to. - Space KeySpace - - // Original is the original value of the identifier - Original []byte - - // Bytes is the new value of the identifier, in the KeySpace. - Bytes []byte -} - -// Equal returns whether this key is equal to another. -func (k1 Key) Equal(k2 Key) bool { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Equal(k1, k2) -} - -// Less returns whether this key comes before another. -func (k1 Key) Less(k2 Key) bool { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Less(k1, k2) -} - -// Distance returns this key's distance to another -func (k1 Key) Distance(k2 Key) *big.Int { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Distance(k1, k2) -} - -// KeySpace is an object used to do math on identifiers. Each keyspace has its -// own properties and rules. See XorKeySpace. -type KeySpace interface { - - // Key converts an identifier into a Key in this space. - Key([]byte) Key - - // Equal returns whether keys are equal in this key space - Equal(Key, Key) bool - - // Distance returns the distance metric in this key space - Distance(Key, Key) *big.Int - - // Less returns whether the first key is smaller than the second. - Less(Key, Key) bool -} - -// byDistanceToCenter is a type used to sort Keys by proximity to a center. -type byDistanceToCenter struct { - Center Key - Keys []Key -} - -func (s byDistanceToCenter) Len() int { - return len(s.Keys) -} - -func (s byDistanceToCenter) Swap(i, j int) { - s.Keys[i], s.Keys[j] = s.Keys[j], s.Keys[i] -} - -func (s byDistanceToCenter) Less(i, j int) bool { - a := s.Center.Distance(s.Keys[i]) - b := s.Center.Distance(s.Keys[j]) - return a.Cmp(b) == -1 -} - -// SortByDistance takes a KeySpace, a center Key, and a list of Keys toSort. -// It returns a new list, where the Keys toSort have been sorted by their -// distance to the center Key. -func SortByDistance(sp KeySpace, center Key, toSort []Key) []Key { - toSortCopy := make([]Key, len(toSort)) - copy(toSortCopy, toSort) - bdtc := &byDistanceToCenter{ - Center: center, - Keys: toSortCopy, // copy - } - sort.Sort(bdtc) - return bdtc.Keys -} diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/xor.go b/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/xor.go deleted file mode 100644 index 6750b0bb..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/keyspace/xor.go +++ /dev/null @@ -1,59 +0,0 @@ -package keyspace - -import ( - "bytes" - "math/big" - "math/bits" - - u "github.com/ipfs/go-ipfs-util" - sha256 "github.com/minio/sha256-simd" -) - -// XORKeySpace is a KeySpace which: -// - normalizes identifiers using a cryptographic hash (sha256) -// - measures distance by XORing keys together -var XORKeySpace = &xorKeySpace{} -var _ KeySpace = XORKeySpace // ensure it conforms - -type xorKeySpace struct{} - -// Key converts an identifier into a Key in this space. -func (s *xorKeySpace) Key(id []byte) Key { - hash := sha256.Sum256(id) - key := hash[:] - return Key{ - Space: s, - Original: id, - Bytes: key, - } -} - -// Equal returns whether keys are equal in this key space -func (s *xorKeySpace) Equal(k1, k2 Key) bool { - return bytes.Equal(k1.Bytes, k2.Bytes) -} - -// Distance returns the distance metric in this key space -func (s *xorKeySpace) Distance(k1, k2 Key) *big.Int { - // XOR the keys - k3 := u.XOR(k1.Bytes, k2.Bytes) - - // interpret it as an integer - dist := big.NewInt(0).SetBytes(k3) - return dist -} - -// Less returns whether the first key is smaller than the second. -func (s *xorKeySpace) Less(k1, k2 Key) bool { - return bytes.Compare(k1.Bytes, k2.Bytes) < 0 -} - -// ZeroPrefixLen returns the number of consecutive zeroes in a byte slice. -func ZeroPrefixLen(id []byte) int { - for i, b := range id { - if b != 0 { - return i*8 + bits.LeadingZeros8(uint8(b)) - } - } - return len(id) * 8 -} diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/sorting.go b/vendor/github.com/libp2p/go-libp2p-kbucket/sorting.go deleted file mode 100644 index 3b670723..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/sorting.go +++ /dev/null @@ -1,62 +0,0 @@ -package kbucket - -import ( - "container/list" - "sort" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// A helper struct to sort peers by their distance to the local node -type peerDistance struct { - p peer.ID - distance ID -} - -// peerDistanceSorter implements sort.Interface to sort peers by xor distance -type peerDistanceSorter struct { - peers []peerDistance - target ID -} - -func (pds *peerDistanceSorter) Len() int { return len(pds.peers) } -func (pds *peerDistanceSorter) Swap(a, b int) { pds.peers[a], pds.peers[b] = pds.peers[b], pds.peers[a] } -func (pds *peerDistanceSorter) Less(a, b int) bool { - return pds.peers[a].distance.less(pds.peers[b].distance) -} - -// Append the peer.ID to the sorter's slice. It may no longer be sorted. -func (pds *peerDistanceSorter) appendPeer(p peer.ID) { - pds.peers = append(pds.peers, peerDistance{ - p: p, - distance: xor(pds.target, ConvertPeerID(p)), - }) -} - -// Append the peer.ID values in the list to the sorter's slice. It may no longer be sorted. -func (pds *peerDistanceSorter) appendPeersFromList(l *list.List) { - for e := l.Front(); e != nil; e = e.Next() { - pds.appendPeer(e.Value.(peer.ID)) - } -} - -func (pds *peerDistanceSorter) sort() { - sort.Sort(pds) -} - -// Sort the given peers by their ascending distance from the target. A new slice is returned. -func SortClosestPeers(peers []peer.ID, target ID) []peer.ID { - sorter := peerDistanceSorter{ - peers: make([]peerDistance, 0, len(peers)), - target: target, - } - for _, p := range peers { - sorter.appendPeer(p) - } - sorter.sort() - out := make([]peer.ID, 0, sorter.Len()) - for _, p := range sorter.peers { - out = append(out, p.p) - } - return out -} diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/table.go b/vendor/github.com/libp2p/go-libp2p-kbucket/table.go deleted file mode 100644 index ec8bfd0e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/table.go +++ /dev/null @@ -1,253 +0,0 @@ -// package kbucket implements a kademlia 'k-bucket' routing table. -package kbucket - -import ( - "errors" - "fmt" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("table") - -var ErrPeerRejectedHighLatency = errors.New("peer rejected; latency too high") -var ErrPeerRejectedNoCapacity = errors.New("peer rejected; insufficient capacity") - -// RoutingTable defines the routing table. -type RoutingTable struct { - - // ID of the local peer - local ID - - // Blanket lock, refine later for better performance - tabLock sync.RWMutex - - // latency metrics - metrics peerstore.Metrics - - // Maximum acceptable latency for peers in this cluster - maxLatency time.Duration - - // kBuckets define all the fingers to other nodes. - Buckets []*Bucket - bucketsize int - - // notification functions - PeerRemoved func(peer.ID) - PeerAdded func(peer.ID) -} - -// NewRoutingTable creates a new routing table with a given bucketsize, local ID, and latency tolerance. -func NewRoutingTable(bucketsize int, localID ID, latency time.Duration, m peerstore.Metrics) *RoutingTable { - rt := &RoutingTable{ - Buckets: []*Bucket{newBucket()}, - bucketsize: bucketsize, - local: localID, - maxLatency: latency, - metrics: m, - PeerRemoved: func(peer.ID) {}, - PeerAdded: func(peer.ID) {}, - } - - return rt -} - -// Update adds or moves the given peer to the front of its respective bucket -func (rt *RoutingTable) Update(p peer.ID) (evicted peer.ID, err error) { - peerID := ConvertPeerID(p) - cpl := CommonPrefixLen(peerID, rt.local) - - rt.tabLock.Lock() - defer rt.tabLock.Unlock() - bucketID := cpl - if bucketID >= len(rt.Buckets) { - bucketID = len(rt.Buckets) - 1 - } - - bucket := rt.Buckets[bucketID] - if bucket.Has(p) { - // If the peer is already in the table, move it to the front. - // This signifies that it it "more active" and the less active nodes - // Will as a result tend towards the back of the list - bucket.MoveToFront(p) - return "", nil - } - - if rt.metrics.LatencyEWMA(p) > rt.maxLatency { - // Connection doesnt meet requirements, skip! - return "", ErrPeerRejectedHighLatency - } - - // We have enough space in the bucket (whether spawned or grouped). - if bucket.Len() < rt.bucketsize { - bucket.PushFront(p) - rt.PeerAdded(p) - return "", nil - } - - if bucketID == len(rt.Buckets)-1 { - // if the bucket is too large and this is the last bucket (i.e. wildcard), unfold it. - rt.nextBucket() - // the structure of the table has changed, so let's recheck if the peer now has a dedicated bucket. - bucketID = cpl - if bucketID >= len(rt.Buckets) { - bucketID = len(rt.Buckets) - 1 - } - bucket = rt.Buckets[bucketID] - if bucket.Len() >= rt.bucketsize { - // if after all the unfolding, we're unable to find room for this peer, scrap it. - return "", ErrPeerRejectedNoCapacity - } - bucket.PushFront(p) - rt.PeerAdded(p) - return "", nil - } - - return "", ErrPeerRejectedNoCapacity -} - -// Remove deletes a peer from the routing table. This is to be used -// when we are sure a node has disconnected completely. -func (rt *RoutingTable) Remove(p peer.ID) { - peerID := ConvertPeerID(p) - cpl := CommonPrefixLen(peerID, rt.local) - - rt.tabLock.Lock() - defer rt.tabLock.Unlock() - - bucketID := cpl - if bucketID >= len(rt.Buckets) { - bucketID = len(rt.Buckets) - 1 - } - - bucket := rt.Buckets[bucketID] - if bucket.Remove(p) { - rt.PeerRemoved(p) - } -} - -func (rt *RoutingTable) nextBucket() { - // This is the last bucket, which allegedly is a mixed bag containing peers not belonging in dedicated (unfolded) buckets. - // _allegedly_ is used here to denote that *all* peers in the last bucket might feasibly belong to another bucket. - // This could happen if e.g. we've unfolded 4 buckets, and all peers in folded bucket 5 really belong in bucket 8. - bucket := rt.Buckets[len(rt.Buckets)-1] - newBucket := bucket.Split(len(rt.Buckets)-1, rt.local) - rt.Buckets = append(rt.Buckets, newBucket) - - // The newly formed bucket still contains too many peers. We probably just unfolded a empty bucket. - if newBucket.Len() >= rt.bucketsize { - // Keep unfolding the table until the last bucket is not overflowing. - rt.nextBucket() - } -} - -// Find a specific peer by ID or return nil -func (rt *RoutingTable) Find(id peer.ID) peer.ID { - srch := rt.NearestPeers(ConvertPeerID(id), 1) - if len(srch) == 0 || srch[0] != id { - return "" - } - return srch[0] -} - -// NearestPeer returns a single peer that is nearest to the given ID -func (rt *RoutingTable) NearestPeer(id ID) peer.ID { - peers := rt.NearestPeers(id, 1) - if len(peers) > 0 { - return peers[0] - } - - log.Debugf("NearestPeer: Returning nil, table size = %d", rt.Size()) - return "" -} - -// NearestPeers returns a list of the 'count' closest peers to the given ID -func (rt *RoutingTable) NearestPeers(id ID, count int) []peer.ID { - cpl := CommonPrefixLen(id, rt.local) - - // It's assumed that this also protects the buckets. - rt.tabLock.RLock() - - // Get bucket at cpl index or last bucket - var bucket *Bucket - if cpl >= len(rt.Buckets) { - cpl = len(rt.Buckets) - 1 - } - bucket = rt.Buckets[cpl] - - pds := peerDistanceSorter{ - peers: make([]peerDistance, 0, 3*rt.bucketsize), - target: id, - } - pds.appendPeersFromList(bucket.list) - if pds.Len() < count { - // In the case of an unusual split, one bucket may be short or empty. - // if this happens, search both surrounding buckets for nearby peers - if cpl > 0 { - pds.appendPeersFromList(rt.Buckets[cpl-1].list) - } - if cpl < len(rt.Buckets)-1 { - pds.appendPeersFromList(rt.Buckets[cpl+1].list) - } - } - rt.tabLock.RUnlock() - - // Sort by distance to local peer - pds.sort() - - if count < pds.Len() { - pds.peers = pds.peers[:count] - } - - out := make([]peer.ID, 0, pds.Len()) - for _, p := range pds.peers { - out = append(out, p.p) - } - - return out -} - -// Size returns the total number of peers in the routing table -func (rt *RoutingTable) Size() int { - var tot int - rt.tabLock.RLock() - for _, buck := range rt.Buckets { - tot += buck.Len() - } - rt.tabLock.RUnlock() - return tot -} - -// ListPeers takes a RoutingTable and returns a list of all peers from all buckets in the table. -func (rt *RoutingTable) ListPeers() []peer.ID { - var peers []peer.ID - rt.tabLock.RLock() - for _, buck := range rt.Buckets { - peers = append(peers, buck.Peers()...) - } - rt.tabLock.RUnlock() - return peers -} - -// Print prints a descriptive statement about the provided RoutingTable -func (rt *RoutingTable) Print() { - fmt.Printf("Routing Table, bs = %d, Max latency = %d\n", rt.bucketsize, rt.maxLatency) - rt.tabLock.RLock() - - for i, b := range rt.Buckets { - fmt.Printf("\tbucket: %d\n", i) - - b.lk.RLock() - for e := b.list.Front(); e != nil; e = e.Next() { - p := e.Value.(peer.ID) - fmt.Printf("\t\t- %s %s\n", p.Pretty(), rt.metrics.LatencyEWMA(p).String()) - } - b.lk.RUnlock() - } - rt.tabLock.RUnlock() -} diff --git a/vendor/github.com/libp2p/go-libp2p-kbucket/util.go b/vendor/github.com/libp2p/go-libp2p-kbucket/util.go deleted file mode 100644 index 71d8709f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-kbucket/util.go +++ /dev/null @@ -1,63 +0,0 @@ -package kbucket - -import ( - "bytes" - "errors" - - "github.com/libp2p/go-libp2p-core/peer" - ks "github.com/libp2p/go-libp2p-kbucket/keyspace" - - u "github.com/ipfs/go-ipfs-util" - sha256 "github.com/minio/sha256-simd" -) - -// Returned if a routing table query returns no results. This is NOT expected -// behaviour -var ErrLookupFailure = errors.New("failed to find any peer in table") - -// ID for IpfsDHT is in the XORKeySpace -// -// The type dht.ID signifies that its contents have been hashed from either a -// peer.ID or a util.Key. This unifies the keyspace -type ID []byte - -func (id ID) equal(other ID) bool { - return bytes.Equal(id, other) -} - -func (id ID) less(other ID) bool { - a := ks.Key{Space: ks.XORKeySpace, Bytes: id} - b := ks.Key{Space: ks.XORKeySpace, Bytes: other} - return a.Less(b) -} - -func xor(a, b ID) ID { - return ID(u.XOR(a, b)) -} - -func CommonPrefixLen(a, b ID) int { - return ks.ZeroPrefixLen(u.XOR(a, b)) -} - -// ConvertPeerID creates a DHT ID by hashing a Peer ID (Multihash) -func ConvertPeerID(id peer.ID) ID { - hash := sha256.Sum256([]byte(id)) - return hash[:] -} - -// ConvertKey creates a DHT ID by hashing a local key (String) -func ConvertKey(id string) ID { - hash := sha256.Sum256([]byte(id)) - return hash[:] -} - -// Closer returns true if a is closer to key than b is -func Closer(a, b peer.ID, key string) bool { - aid := ConvertPeerID(a) - bid := ConvertPeerID(b) - tgt := ConvertKey(key) - adist := xor(aid, tgt) - bdist := xor(bid, tgt) - - return adist.less(bdist) -} diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/.travis.yml b/vendor/github.com/libp2p/go-libp2p-loggables/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/LICENSE b/vendor/github.com/libp2p/go-libp2p-loggables/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/README.md b/vendor/github.com/libp2p/go-libp2p-loggables/README.md deleted file mode 100644 index 3fce6e7b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# go-libp2p-loggables - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellpw.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> logging helpers for go-libp2p - -## Install - -``` -go get github.com/libp2p/go-libp2p-loggables -``` - -## Usage - -See https://godoc.org/github.com/libp2p/go-libp2p-loggables. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-loggables/issues)! - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2016 Jeromy Johnson. - ---- - -The last gx published version of this module was: 1.1.33: QmUbSLukzZYZvEYxynj9Dtd1WrGLxxg9R4U68vCMPWHmRU diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/codecov.yml b/vendor/github.com/libp2p/go-libp2p-loggables/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/go.mod b/vendor/github.com/libp2p/go-libp2p-loggables/go.mod deleted file mode 100644 index 56d6b8ff..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-libp2p-loggables - -require ( - github.com/google/uuid v1.1.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multiaddr v0.0.2 -) diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/go.sum b/vendor/github.com/libp2p/go-libp2p-loggables/go.sum deleted file mode 100644 index 8d11a7b3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/go.sum +++ /dev/null @@ -1,88 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-loggables/loggables.go b/vendor/github.com/libp2p/go-libp2p-loggables/loggables.go deleted file mode 100644 index 30b2a3ab..00000000 --- a/vendor/github.com/libp2p/go-libp2p-loggables/loggables.go +++ /dev/null @@ -1,80 +0,0 @@ -// Package loggables includes a bunch of transaltor functions for commonplace/stdlib -// objects. This is boilerplate code that shouldn't change much, and not sprinkled -// all over the place (i.e. gather it here). -// -// Note: it may make sense to put all stdlib Loggable functions in the eventlog -// package. Putting it here for now in case we don't want to polute it. -package loggables - -import ( - "net" - - uuid "github.com/google/uuid" - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" -) - -// NetConn returns an eventlog.Metadata with the conn addresses -func NetConn(c net.Conn) logging.Loggable { - return logging.Metadata{ - "localAddr": c.LocalAddr(), - "remoteAddr": c.RemoteAddr(), - } -} - -// Error returns an eventlog.Metadata with an error -func Error(e error) logging.Loggable { - return logging.Metadata{ - "error": e.Error(), - } -} - -func Uuid(key string) logging.Metadata { - ids := "#UUID-ERROR#" - if id, err := uuid.NewRandom(); err == nil { - ids = id.String() - } - return logging.Metadata{ - key: ids, - } -} - -// Dial metadata is metadata for dial events -func Dial(sys string, lid, rid peer.ID, laddr, raddr ma.Multiaddr) DeferredMap { - m := DeferredMap{} - m["subsystem"] = sys - if lid != "" { - m["localPeer"] = func() interface{} { return lid.Pretty() } - } - if laddr != nil { - m["localAddr"] = func() interface{} { return laddr.String() } - } - if rid != "" { - m["remotePeer"] = func() interface{} { return rid.Pretty() } - } - if raddr != nil { - m["remoteAddr"] = func() interface{} { return raddr.String() } - } - return m -} - -// DeferredMap is a Loggable which may contain deferred values. -type DeferredMap map[string]interface{} - -// Loggable describes objects that can be marshalled into Metadata for logging -func (m DeferredMap) Loggable() map[string]interface{} { - m2 := map[string]interface{}{} - for k, v := range m { - - if vf, ok := v.(func() interface{}); ok { - // if it's a DeferredVal, call it. - m2[k] = vf() - - } else { - // else use the value as is. - m2[k] = v - } - } - return m2 -} diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/.gitignore b/vendor/github.com/libp2p/go-libp2p-mplex/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/.travis.yml b/vendor/github.com/libp2p/go-libp2p-mplex/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/LICENSE b/vendor/github.com/libp2p/go-libp2p-mplex/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/Makefile b/vendor/github.com/libp2p/go-libp2p-mplex/Makefile deleted file mode 100644 index 3907e857..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -build: deps - go build ./... - -test: deps - go test ./... - -test_race: deps - go test -race ./... - -gx-bins: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx-bins - gx --verbose install --global - gx-go rewrite - -clean: gx-bins - gx-go rewrite --undo diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/README.md b/vendor/github.com/libp2p/go-libp2p-mplex/README.md deleted file mode 100644 index fc3d7889..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# go-libp2p-mplex - a go-stream-muxer shim for multiplex - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) ![](https://raw.githubusercontent.com/libp2p/go-stream-muxer/master/img/badge.png) - -This is an implementation of the [go-stream-muxer](https://github.com/libp2p/go-stream-muxer) interface for [multiplex](https://github.com/libp2p/go-mplex). For more information, see that repo. - -## Installation - -```sh -go get -d github.com/libp2p/go-libp2p-mplex -cd $GOPATH/src/github.com/libp2p/go-libp2p-mplex -make deps -``` diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/go.mod b/vendor/github.com/libp2p/go-libp2p-mplex/go.mod deleted file mode 100644 index 08091671..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/libp2p/go-libp2p-mplex - -go 1.12 - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-testing v0.0.3 - github.com/libp2p/go-mplex v0.1.0 -) diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/go.sum b/vendor/github.com/libp2p/go-libp2p-mplex/go.sum deleted file mode 100644 index 44811af3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/go.sum +++ /dev/null @@ -1,81 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-mplex/multiplex.go b/vendor/github.com/libp2p/go-libp2p-mplex/multiplex.go deleted file mode 100644 index bf53c9e7..00000000 --- a/vendor/github.com/libp2p/go-libp2p-mplex/multiplex.go +++ /dev/null @@ -1,42 +0,0 @@ -package peerstream_multiplex - -import ( - "net" - - "github.com/libp2p/go-libp2p-core/mux" - - mp "github.com/libp2p/go-mplex" -) - -type conn struct { - *mp.Multiplex -} - -func (c *conn) Close() error { - return c.Multiplex.Close() -} - -func (c *conn) IsClosed() bool { - return c.Multiplex.IsClosed() -} - -// OpenStream creates a new stream. -func (c *conn) OpenStream() (mux.MuxedStream, error) { - return c.Multiplex.NewStream() -} - -// AcceptStream accepts a stream opened by the other side. -func (c *conn) AcceptStream() (mux.MuxedStream, error) { - return c.Multiplex.Accept() -} - -// Transport is a go-peerstream transport that constructs -// multiplex-backed connections. -type Transport struct{} - -// DefaultTransport has default settings for multiplex -var DefaultTransport = &Transport{} - -func (t *Transport) NewConn(nc net.Conn, isServer bool) (mux.MuxedConn, error) { - return &conn{mp.NewMultiplex(nc, isServer)}, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-nat/.travis.yml b/vendor/github.com/libp2p/go-libp2p-nat/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-nat/LICENSE b/vendor/github.com/libp2p/go-libp2p-nat/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-nat/README.md b/vendor/github.com/libp2p/go-libp2p-nat/README.md deleted file mode 100644 index 5d1ac972..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/README.md +++ /dev/null @@ -1,46 +0,0 @@ -go-libp2p-nat -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Travis CI](https://travis-ci.org/libp2p/go-libp2p-nat.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-nat) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> NAT port mapping library for go-libp2p. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Usage - -```sh -# TODO -``` - -## Contribute - -PRs are welcome! Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-libp2p-nat/issues)! - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © Jeromy Johnson - ---- - -The last gx published version of this module was: 0.8.13: QmRbx7DYHgw3uNn2RuU2nv9Bdh96ZdtT65CG1CGPNRQcGZ diff --git a/vendor/github.com/libp2p/go-libp2p-nat/codecov.yml b/vendor/github.com/libp2p/go-libp2p-nat/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-nat/go.mod b/vendor/github.com/libp2p/go-libp2p-nat/go.mod deleted file mode 100644 index e43298be..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/libp2p/go-libp2p-nat - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec // indirect - github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 - github.com/libp2p/go-nat v0.0.3 - github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f -) diff --git a/vendor/github.com/libp2p/go-libp2p-nat/go.sum b/vendor/github.com/libp2p/go-libp2p-nat/go.sum deleted file mode 100644 index 39da03d4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/go.sum +++ /dev/null @@ -1,46 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec h1:DQqZhhDvrTrEQ3Qod5yfavcA064e53xlQ+xajiorXgM= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/libp2p/go-libp2p-nat/mapping.go b/vendor/github.com/libp2p/go-libp2p-nat/mapping.go deleted file mode 100644 index 33f25f61..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/mapping.go +++ /dev/null @@ -1,122 +0,0 @@ -package nat - -import ( - "fmt" - "net" - "sync" - "time" - - "github.com/jbenet/goprocess" -) - -// Mapping represents a port mapping in a NAT. -type Mapping interface { - // NAT returns the NAT object this Mapping belongs to. - NAT() *NAT - - // Protocol returns the protocol of this port mapping. This is either - // "tcp" or "udp" as no other protocols are likely to be NAT-supported. - Protocol() string - - // InternalPort returns the internal device port. Mapping will continue to - // try to map InternalPort() to an external facing port. - InternalPort() int - - // ExternalPort returns the external facing port. If the mapping is not - // established, port will be 0 - ExternalPort() int - - // ExternalAddr returns the external facing address. If the mapping is not - // established, addr will be nil, and and ErrNoMapping will be returned. - ExternalAddr() (addr net.Addr, err error) - - // Close closes the port mapping - Close() error -} - -// keeps republishing -type mapping struct { - sync.Mutex // guards all fields - - nat *NAT - proto string - intport int - extport int - permanent bool - proc goprocess.Process - - cached net.IP - cacheTime time.Time - cacheLk sync.Mutex -} - -func (m *mapping) NAT() *NAT { - m.Lock() - defer m.Unlock() - return m.nat -} - -func (m *mapping) Protocol() string { - m.Lock() - defer m.Unlock() - return m.proto -} - -func (m *mapping) InternalPort() int { - m.Lock() - defer m.Unlock() - return m.intport -} - -func (m *mapping) ExternalPort() int { - m.Lock() - defer m.Unlock() - return m.extport -} - -func (m *mapping) setExternalPort(p int) { - m.Lock() - defer m.Unlock() - m.extport = p -} - -func (m *mapping) ExternalAddr() (net.Addr, error) { - m.cacheLk.Lock() - defer m.cacheLk.Unlock() - oport := m.ExternalPort() - if oport == 0 { - // dont even try right now. - return nil, ErrNoMapping - } - - if time.Since(m.cacheTime) >= CacheTime { - m.nat.natmu.Lock() - cval, err := m.nat.nat.GetExternalAddress() - m.nat.natmu.Unlock() - - if err != nil { - return nil, err - } - - m.cached = cval - m.cacheTime = time.Now() - } - switch m.Protocol() { - case "tcp": - return &net.TCPAddr{ - IP: m.cached, - Port: oport, - }, nil - case "udp": - return &net.UDPAddr{ - IP: m.cached, - Port: oport, - }, nil - default: - panic(fmt.Sprintf("invalid protocol %q", m.Protocol())) - } -} - -func (m *mapping) Close() error { - return m.proc.Close() -} diff --git a/vendor/github.com/libp2p/go-libp2p-nat/nat.go b/vendor/github.com/libp2p/go-libp2p-nat/nat.go deleted file mode 100644 index 178f7d01..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/nat.go +++ /dev/null @@ -1,210 +0,0 @@ -package nat - -import ( - "context" - "errors" - "fmt" - "sync" - "time" - - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" - periodic "github.com/jbenet/goprocess/periodic" - nat "github.com/libp2p/go-nat" -) - -var ( - // ErrNoMapping signals no mapping exists for an address - ErrNoMapping = errors.New("mapping not established") -) - -var log = logging.Logger("nat") - -// MappingDuration is a default port mapping duration. -// Port mappings are renewed every (MappingDuration / 3) -const MappingDuration = time.Second * 60 - -// CacheTime is the time a mapping will cache an external address for -const CacheTime = time.Second * 15 - -// DiscoverNAT looks for a NAT device in the network and -// returns an object that can manage port mappings. -func DiscoverNAT(ctx context.Context) (*NAT, error) { - var ( - natInstance nat.NAT - err error - ) - - done := make(chan struct{}) - go func() { - defer close(done) - // This will abort in 10 seconds anyways. - natInstance, err = nat.DiscoverGateway() - }() - - select { - case <-done: - case <-ctx.Done(): - return nil, ctx.Err() - } - - if err != nil { - return nil, err - } - - // Log the device addr. - addr, err := natInstance.GetDeviceAddress() - if err != nil { - log.Debug("DiscoverGateway address error:", err) - } else { - log.Debug("DiscoverGateway address:", addr) - } - - return newNAT(natInstance), nil -} - -// NAT is an object that manages address port mappings in -// NATs (Network Address Translators). It is a long-running -// service that will periodically renew port mappings, -// and keep an up-to-date list of all the external addresses. -type NAT struct { - natmu sync.Mutex - nat nat.NAT - proc goprocess.Process - - mappingmu sync.RWMutex // guards mappings - mappings map[*mapping]struct{} - - Notifier -} - -func newNAT(realNAT nat.NAT) *NAT { - return &NAT{ - nat: realNAT, - proc: goprocess.WithParent(goprocess.Background()), - mappings: make(map[*mapping]struct{}), - } -} - -// Close shuts down all port mappings. NAT can no longer be used. -func (nat *NAT) Close() error { - return nat.proc.Close() -} - -// Process returns the nat's life-cycle manager, for making it listen -// to close signals. -func (nat *NAT) Process() goprocess.Process { - return nat.proc -} - -// Mappings returns a slice of all NAT mappings -func (nat *NAT) Mappings() []Mapping { - nat.mappingmu.Lock() - maps2 := make([]Mapping, 0, len(nat.mappings)) - for m := range nat.mappings { - maps2 = append(maps2, m) - } - nat.mappingmu.Unlock() - return maps2 -} - -func (nat *NAT) addMapping(m *mapping) { - // make mapping automatically close when nat is closed. - nat.proc.AddChild(m.proc) - - nat.mappingmu.Lock() - nat.mappings[m] = struct{}{} - nat.mappingmu.Unlock() -} - -func (nat *NAT) rmMapping(m *mapping) { - nat.mappingmu.Lock() - delete(nat.mappings, m) - nat.mappingmu.Unlock() -} - -// NewMapping attemps to construct a mapping on protocol and internal port -// It will also periodically renew the mapping until the returned Mapping -// -- or its parent NAT -- is Closed. -// -// May not succeed, and mappings may change over time; -// NAT devices may not respect our port requests, and even lie. -// Clients should not store the mapped results, but rather always -// poll our object for the latest mappings. -func (nat *NAT) NewMapping(protocol string, port int) (Mapping, error) { - if nat == nil { - return nil, fmt.Errorf("no nat available") - } - - switch protocol { - case "tcp", "udp": - default: - return nil, fmt.Errorf("invalid protocol: %s", protocol) - } - - m := &mapping{ - intport: port, - nat: nat, - proto: protocol, - } - - m.proc = goprocess.WithTeardown(func() error { - nat.rmMapping(m) - nat.natmu.Lock() - defer nat.natmu.Unlock() - nat.nat.DeletePortMapping(m.Protocol(), m.InternalPort()) - return nil - }) - - nat.addMapping(m) - - m.proc.AddChild(periodic.Every(MappingDuration/3, func(worker goprocess.Process) { - nat.establishMapping(m) - })) - - // do it once synchronously, so first mapping is done right away, and before exiting, - // allowing users -- in the optimistic case -- to use results right after. - nat.establishMapping(m) - return m, nil -} - -func (nat *NAT) establishMapping(m *mapping) { - oldport := m.ExternalPort() - - log.Debugf("Attempting port map: %s/%d", m.Protocol(), m.InternalPort()) - comment := "libp2p" - - nat.natmu.Lock() - newport, err := nat.nat.AddPortMapping(m.Protocol(), m.InternalPort(), comment, MappingDuration) - if err != nil { - // Some hardware does not support mappings with timeout, so try that - newport, err = nat.nat.AddPortMapping(m.Protocol(), m.InternalPort(), comment, 0) - } - nat.natmu.Unlock() - - if err != nil || newport == 0 { - m.setExternalPort(0) // clear mapping - // TODO: log.Event - log.Warningf("failed to establish port mapping: %s", err) - nat.Notifier.notifyAll(func(n Notifiee) { - n.MappingFailed(nat, m, oldport, err) - }) - - // we do not close if the mapping failed, - // because it may work again next time. - return - } - - m.setExternalPort(newport) - log.Debugf("NAT Mapping: %s --> %s (%s)", m.ExternalPort(), m.InternalPort(), m.Protocol()) - if oldport != 0 && newport != oldport { - log.Debugf("failed to renew same port mapping: ch %d -> %d", oldport, newport) - nat.Notifier.notifyAll(func(n Notifiee) { - n.MappingChanged(nat, m, oldport, newport) - }) - } - - nat.Notifier.notifyAll(func(n Notifiee) { - n.MappingSuccess(nat, m) - }) -} diff --git a/vendor/github.com/libp2p/go-libp2p-nat/notifier.go b/vendor/github.com/libp2p/go-libp2p-nat/notifier.go deleted file mode 100644 index 10fb6ac6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-nat/notifier.go +++ /dev/null @@ -1,47 +0,0 @@ -package nat - -import ( - notifier "github.com/whyrusleeping/go-notifier" -) - -// Notifier is an object that assists NAT in notifying listeners. -// It is implemented using thirdparty/notifier -type Notifier struct { - n notifier.Notifier -} - -func (n *Notifier) notifyAll(notify func(n Notifiee)) { - n.n.NotifyAll(func(n notifier.Notifiee) { - notify(n.(Notifiee)) - }) -} - -// Notify signs up notifiee to listen to NAT events. -func (n *Notifier) Notify(notifiee Notifiee) { - n.n.Notify(n) -} - -// StopNotify stops signaling events to notifiee. -func (n *Notifier) StopNotify(notifiee Notifiee) { - n.n.StopNotify(notifiee) -} - -// Notifiee is an interface objects must implement to listen to NAT events. -type Notifiee interface { - - // Called every time a successful mapping happens - // Warning: the port mapping may have changed. If that is the - // case, both MappingSuccess and MappingChanged are called. - MappingSuccess(nat *NAT, m Mapping) - - // Called when mapping a port succeeds, but the mapping is - // with a different port than an earlier success. - MappingChanged(nat *NAT, m Mapping, oldport, newport int) - - // Called when a port mapping fails. NAT will continue attempting after - // the next period. To stop trying, use: mapping.Close(). After this failure, - // mapping.ExternalPort() will be zero, and nat.ExternalAddrs() will not - // return the address for this mapping. With luck, the next attempt will - // succeed, without the client needing to do anything. - MappingFailed(nat *NAT, m Mapping, oldport int, err error) -} diff --git a/vendor/github.com/libp2p/go-libp2p-peer/.travis.yml b/vendor/github.com/libp2p/go-libp2p-peer/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-peer/LICENSE b/vendor/github.com/libp2p/go-libp2p-peer/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-peer/README.md b/vendor/github.com/libp2p/go-libp2p-peer/README.md deleted file mode 100644 index ab9b684e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# go-libp2p-peer - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23libp2p) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-peer?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-peer) -[![Coverage Status](https://codecov.io/gh/libp2p/go-libp2p-peer/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-peer/branch/master) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-peer.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-peer) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> PKI based identities for use in go-libp2p - -## Install - -TODO - -## Usage - -TODO - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-peer/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 3.1.2: QmYVXrKrKHDC9FobgmcmshCDyWwdrfwfanNQN4oxJ9Fk3h diff --git a/vendor/github.com/libp2p/go-libp2p-peer/codecov.yml b/vendor/github.com/libp2p/go-libp2p-peer/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-peer/deprecated.go b/vendor/github.com/libp2p/go-libp2p-peer/deprecated.go deleted file mode 100644 index 600b5ece..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/deprecated.go +++ /dev/null @@ -1,65 +0,0 @@ -// Deprecated: use github.com/libp2p/go-libp2p-core/peer instead. -package peer - -import ( - core "github.com/libp2p/go-libp2p-core/peer" - ic "github.com/libp2p/go-libp2p-crypto" -) - -var ( - // Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrEmptyPeerID instead. - ErrEmptyPeerID = core.ErrEmptyPeerID - // Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrNoPublicKey instead. - ErrNoPublicKey = core.ErrNoPublicKey -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AdvanceEnableInlining instead. -// Warning: this variable's type makes it impossible to alias by reference. -// Reads and writes from/to this variable may be inaccurate or not have the intended effect. -var AdvancedEnableInlining = core.AdvancedEnableInlining - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.ID instead. -type ID = core.ID - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDSlice instead. -type IDSlice = core.IDSlice - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDFromString instead. -func IDFromString(s string) (core.ID, error) { - return core.IDFromString(s) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDFromBytes instead. -func IDFromBytes(b []byte) (core.ID, error) { - return core.IDFromBytes(b) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDB58Decode instead. -func IDB58Decode(s string) (core.ID, error) { - return core.IDB58Decode(s) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDB58Encode instead. -func IDB58Encode(id ID) string { - return core.IDB58Encode(id) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDHexDecode instead. -func IDHexDecode(s string) (core.ID, error) { - return core.IDHexDecode(s) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDHexEncode instead. -func IDHexEncode(id ID) string { - return core.IDHexEncode(id) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDFromPublicKey instead. -func IDFromPublicKey(pk ic.PubKey) (core.ID, error) { - return core.IDFromPublicKey(pk) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.IDFromPrivateKey instead. -func IDFromPrivateKey(sk ic.PrivKey) (core.ID, error) { - return core.IDFromPrivateKey(sk) -} diff --git a/vendor/github.com/libp2p/go-libp2p-peer/go.mod b/vendor/github.com/libp2p/go-libp2p-peer/go.mod deleted file mode 100644 index c2e26e78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/libp2p/go-libp2p-peer - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-crypto v0.1.0 - golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect -) diff --git a/vendor/github.com/libp2p/go-libp2p-peer/go.sum b/vendor/github.com/libp2p/go-libp2p-peer/go.sum deleted file mode 100644 index e5bf65d5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peer/go.sum +++ /dev/null @@ -1,70 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/.gitignore b/vendor/github.com/libp2p/go-libp2p-peerstore/.gitignore deleted file mode 100644 index bea702c0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.swp -cover.out diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/.travis.yml b/vendor/github.com/libp2p/go-libp2p-peerstore/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/LICENSE b/vendor/github.com/libp2p/go-libp2p-peerstore/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/README.md b/vendor/github.com/libp2p/go-libp2p-peerstore/README.md deleted file mode 100644 index 0ad7cf97..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# go-libp2p-peerstore -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-peerstore?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-peerstore) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-libp2p-peerstore/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-libp2p-peerstore?branch=master) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-peerstore.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-peerstore) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> An object to manage peers, their addresses, and other metadata about them. - -## Install - -```sh -go get github.com/libp2p/go-libp2p-peerstore -``` - -## Usage - -Check out the [GoDocs](https://godoc.org/github.com/libp2p/go-libp2p-peerstore). - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-libp2p-peerstore/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) - -## License -MIT - ---- - -The last gx published version of this module was: 2.0.19: QmaCTz9RkrU13bm9kMB54f7atgqM4qkjDZpRwRoJiWXEqs diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/addr/addrsrcs.go b/vendor/github.com/libp2p/go-libp2p-peerstore/addr/addrsrcs.go deleted file mode 100644 index 9be78d5c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/addr/addrsrcs.go +++ /dev/null @@ -1,70 +0,0 @@ -// Package addr provides utility functions to handle peer addresses. -package addr - -import ( - ma "github.com/multiformats/go-multiaddr" -) - -// AddrSource is a source of addresses. It allows clients to retrieve -// a set of addresses at a last possible moment in time. It is used -// to query a set of addresses that may change over time, as a result -// of the network changing interfaces or mappings. -type Source interface { - Addrs() []ma.Multiaddr -} - -// CombineSources returns a new AddrSource which is the -// concatenation of all input AddrSources: -// -// combined := CombinedSources(a, b) -// combined.Addrs() // append(a.Addrs(), b.Addrs()...) -// -func CombineSources(srcs ...Source) Source { - return combinedAS(srcs) -} - -type combinedAS []Source - -func (cas combinedAS) Addrs() []ma.Multiaddr { - var addrs []ma.Multiaddr - for _, s := range cas { - addrs = append(addrs, s.Addrs()...) - } - return addrs -} - -// UniqueSource returns a new AddrSource which omits duplicate -// addresses from the inputs: -// -// unique := UniqueSource(a, b) -// unique.Addrs() // append(a.Addrs(), b.Addrs()...) -// // but only adds each addr once. -// -func UniqueSource(srcs ...Source) Source { - return uniqueAS(srcs) -} - -type uniqueAS []Source - -func (uas uniqueAS) Addrs() []ma.Multiaddr { - seen := make(map[string]struct{}) - var addrs []ma.Multiaddr - for _, s := range uas { - for _, a := range s.Addrs() { - s := a.String() - if _, found := seen[s]; !found { - addrs = append(addrs, a) - seen[s] = struct{}{} - } - } - } - return addrs -} - -// Slice is a simple slice of addresses that implements -// the AddrSource interface. -type Slice []ma.Multiaddr - -func (as Slice) Addrs() []ma.Multiaddr { - return as -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/addr/sorting.go b/vendor/github.com/libp2p/go-libp2p-peerstore/addr/sorting.go deleted file mode 100644 index f8a89150..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/addr/sorting.go +++ /dev/null @@ -1,62 +0,0 @@ -package addr - -import ( - "bytes" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" - mafmt "github.com/whyrusleeping/mafmt" -) - -func isFDCostlyTransport(a ma.Multiaddr) bool { - return mafmt.TCP.Matches(a) -} - -type AddrList []ma.Multiaddr - -func (al AddrList) Len() int { - return len(al) -} - -func (al AddrList) Swap(i, j int) { - al[i], al[j] = al[j], al[i] -} - -func (al AddrList) Less(i, j int) bool { - a := al[i] - b := al[j] - - // dial localhost addresses next, they should fail immediately - lba := manet.IsIPLoopback(a) - lbb := manet.IsIPLoopback(b) - if lba { - if !lbb { - return true - } - } - - // dial utp and similar 'non-fd-consuming' addresses first - fda := isFDCostlyTransport(a) - fdb := isFDCostlyTransport(b) - if !fda { - if fdb { - return true - } - - // if neither consume fd's, assume equal ordering - return false - } - - // if 'b' doesnt take a file descriptor - if !fdb { - return false - } - - // if 'b' is loopback and both take file descriptors - if lbb { - return false - } - - // for the rest, just sort by bytes - return bytes.Compare(a.Bytes(), b.Bytes()) > 0 -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/codecov.yml b/vendor/github.com/libp2p/go-libp2p-peerstore/codecov.yml deleted file mode 100644 index 96dcfd78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/codecov.yml +++ /dev/null @@ -1,5 +0,0 @@ -coverage: - range: "50...100" -comment: off -ignore: - - "pb/*.pb.go" \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/go.mod b/vendor/github.com/libp2p/go-libp2p-peerstore/go.mod deleted file mode 100644 index 86338f38..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/go.mod +++ /dev/null @@ -1,21 +0,0 @@ -module github.com/libp2p/go-libp2p-peerstore - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/go-datastore v0.0.1 - github.com/ipfs/go-ds-badger v0.0.2 - github.com/ipfs/go-ds-leveldb v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-buffer-pool v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-crypto v0.1.0 - github.com/libp2p/go-libp2p-peer v0.2.0 - github.com/multiformats/go-base32 v0.0.3 - github.com/multiformats/go-multiaddr v0.0.2 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/multiformats/go-multihash v0.0.1 - github.com/pkg/errors v0.8.1 - github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 - github.com/whyrusleeping/mafmt v1.2.8 -) diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/go.sum b/vendor/github.com/libp2p/go-libp2p-peerstore/go.sum deleted file mode 100644 index 6df7a493..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/go.sum +++ /dev/null @@ -1,151 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1 h1:EJiD2VUQyh5A9hWJLmc6iWg6yIcJ7jpBcwC8GMGXfDk= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f h1:6itBiEUtu+gOzXZWn46bM5/qm8LlV6/byR7Yflx/y6M= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f h1:dDxpBYafY/GYpcl+LS4Bn3ziLPuEdGRkRjYAbSlWxSA= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -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/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1 h1:AW/KZCScnBWlSb5JbnEnLKFWXL224LBEh/9KXXOrUms= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2 h1:7ToQt7QByBhOTuZF2USMv+PGlMcBC7FW7FdgQ4FCsoo= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1 h1:Z0lsTFciec9qYsyngAw1f/czhRU35qBLR2vhavPFgqA= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/interface.go b/vendor/github.com/libp2p/go-libp2p-peerstore/interface.go deleted file mode 100644 index 105dedc7..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -package peerstore - -import core "github.com/libp2p/go-libp2p-core/peerstore" - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ErrNotFound instead. -var ErrNotFound = core.ErrNotFound - -var ( - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.AddressTTL instead. - AddressTTL = core.AddressTTL - - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.TempAddrTTL instead. - TempAddrTTL = core.TempAddrTTL - - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ProviderAddrTTL instead. - ProviderAddrTTL = core.ProviderAddrTTL - - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.RecentlyConnectedAddrTTL instead. - RecentlyConnectedAddrTTL = core.RecentlyConnectedAddrTTL - - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.OwnObservedAddrTTL instead. - OwnObservedAddrTTL = core.OwnObservedAddrTTL -) - -const ( - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.PermanentAddrTTL instead. - PermanentAddrTTL = core.PermanentAddrTTL - - // Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ConnectedAddrTTL instead. - ConnectedAddrTTL = core.ConnectedAddrTTL -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.Peerstore instead. -type Peerstore = core.Peerstore - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.PeerMetadata instead. -type PeerMetadata = core.PeerMetadata - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.AddrBook instead. -type AddrBook = core.AddrBook - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.KeyBook instead. -type KeyBook = core.KeyBook - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.ProtoBook instead. -type ProtoBook = core.ProtoBook diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/metrics.go b/vendor/github.com/libp2p/go-libp2p-peerstore/metrics.go deleted file mode 100644 index f6d0ccb5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/metrics.go +++ /dev/null @@ -1,57 +0,0 @@ -package peerstore - -import ( - "sync" - "time" - - moved "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-peer" -) - -// LatencyEWMASmooting governs the decay of the EWMA (the speed -// at which it changes). This must be a normalized (0-1) value. -// 1 is 100% change, 0 is no change. -var LatencyEWMASmoothing = 0.1 - -// Deprecated: use github.com/libp2p/go-libp2p-core/peerstore.Metrics instead. -type Metrics = moved.Metrics - -type metrics struct { - latmap map[peer.ID]time.Duration - latmu sync.RWMutex -} - -func NewMetrics() *metrics { - return &metrics{ - latmap: make(map[peer.ID]time.Duration), - } -} - -// RecordLatency records a new latency measurement -func (m *metrics) RecordLatency(p peer.ID, next time.Duration) { - nextf := float64(next) - s := LatencyEWMASmoothing - if s > 1 || s < 0 { - s = 0.1 // ignore the knob. it's broken. look, it jiggles. - } - - m.latmu.Lock() - ewma, found := m.latmap[p] - ewmaf := float64(ewma) - if !found { - m.latmap[p] = next // when no data, just take it as the mean. - } else { - nextf = ((1.0 - s) * ewmaf) + (s * nextf) - m.latmap[p] = time.Duration(nextf) - } - m.latmu.Unlock() -} - -// LatencyEWMA returns an exponentially-weighted moving avg. -// of all measurements of a peer's latency. -func (m *metrics) LatencyEWMA(p peer.ID) time.Duration { - m.latmu.RLock() - lat := m.latmap[p] - m.latmu.RUnlock() - return time.Duration(lat) -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/peerinfo.go b/vendor/github.com/libp2p/go-libp2p-peerstore/peerinfo.go deleted file mode 100644 index 24c8c31f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/peerinfo.go +++ /dev/null @@ -1,22 +0,0 @@ -package peerstore - -import ( - core "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.Info instead. -type PeerInfo = core.AddrInfo - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.ErrInvalidAddr instead. -var ErrInvalidAddr = core.ErrInvalidAddr - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfoFromP2pAddr instead. -func InfoFromP2pAddr(m ma.Multiaddr) (*core.AddrInfo, error) { - return core.AddrInfoFromP2pAddr(m) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/peer.AddrInfoToP2pAddrs instead. -func InfoToP2pAddrs(pi *core.AddrInfo) ([]ma.Multiaddr, error) { - return core.AddrInfoToP2pAddrs(pi) -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go b/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go deleted file mode 100644 index ea29a17f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go +++ /dev/null @@ -1,91 +0,0 @@ -package peerstore - -import ( - "fmt" - "io" - - peer "github.com/libp2p/go-libp2p-peer" -) - -var _ Peerstore = (*peerstore)(nil) - -type peerstore struct { - Metrics - - KeyBook - AddrBook - ProtoBook - PeerMetadata -} - -// NewPeerstore creates a data structure that stores peer data, backed by the -// supplied implementations of KeyBook, AddrBook and PeerMetadata. -func NewPeerstore(kb KeyBook, ab AddrBook, pb ProtoBook, md PeerMetadata) Peerstore { - return &peerstore{ - KeyBook: kb, - AddrBook: ab, - ProtoBook: pb, - PeerMetadata: md, - Metrics: NewMetrics(), - } -} - -func (ps *peerstore) Close() (err error) { - var errs []error - weakClose := func(name string, c interface{}) { - if cl, ok := c.(io.Closer); ok { - if err = cl.Close(); err != nil { - errs = append(errs, fmt.Errorf("%s error: %s", name, err)) - } - } - } - - weakClose("keybook", ps.KeyBook) - weakClose("addressbook", ps.AddrBook) - weakClose("protobook", ps.ProtoBook) - weakClose("peermetadata", ps.PeerMetadata) - - if len(errs) > 0 { - return fmt.Errorf("failed while closing peerstore; err(s): %q", errs) - } - return nil -} - -func (ps *peerstore) Peers() peer.IDSlice { - set := map[peer.ID]struct{}{} - for _, p := range ps.PeersWithKeys() { - set[p] = struct{}{} - } - for _, p := range ps.PeersWithAddrs() { - set[p] = struct{}{} - } - - pps := make(peer.IDSlice, 0, len(set)) - for p := range set { - pps = append(pps, p) - } - return pps -} - -func (ps *peerstore) PeerInfo(p peer.ID) PeerInfo { - return PeerInfo{ - ID: p, - Addrs: ps.AddrBook.Addrs(p), - } -} - -func PeerInfos(ps Peerstore, peers peer.IDSlice) []PeerInfo { - pi := make([]PeerInfo, len(peers)) - for i, p := range peers { - pi[i] = ps.PeerInfo(p) - } - return pi -} - -func PeerInfoIDs(pis []PeerInfo) peer.IDSlice { - ps := make(peer.IDSlice, len(pis)) - for i, pi := range pis { - ps[i] = pi.ID - } - return ps -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/addr_book.go b/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/addr_book.go deleted file mode 100644 index a497821d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/addr_book.go +++ /dev/null @@ -1,401 +0,0 @@ -package pstoremem - -import ( - "context" - "sort" - "sync" - "time" - - logging "github.com/ipfs/go-log" - peer "github.com/libp2p/go-libp2p-peer" - ma "github.com/multiformats/go-multiaddr" - - pstore "github.com/libp2p/go-libp2p-peerstore" - addr "github.com/libp2p/go-libp2p-peerstore/addr" -) - -var log = logging.Logger("peerstore") - -type expiringAddr struct { - Addr ma.Multiaddr - TTL time.Duration - Expires time.Time -} - -func (e *expiringAddr) ExpiredBy(t time.Time) bool { - return t.After(e.Expires) -} - -type addrSegments [256]*addrSegment - -type addrSegment struct { - sync.RWMutex - - // Use pointers to save memory. Maps always leave some fraction of their - // space unused. storing the *values* directly in the map will - // drastically increase the space waste. In our case, by 6x. - addrs map[peer.ID]map[string]*expiringAddr -} - -func (s *addrSegments) get(p peer.ID) *addrSegment { - return s[byte(p[len(p)-1])] -} - -// memoryAddrBook manages addresses. -type memoryAddrBook struct { - segments addrSegments - - ctx context.Context - cancel func() - - subManager *AddrSubManager -} - -var _ pstore.AddrBook = (*memoryAddrBook)(nil) - -func NewAddrBook() pstore.AddrBook { - ctx, cancel := context.WithCancel(context.Background()) - - ab := &memoryAddrBook{ - segments: func() (ret addrSegments) { - for i, _ := range ret { - ret[i] = &addrSegment{addrs: make(map[peer.ID]map[string]*expiringAddr)} - } - return ret - }(), - subManager: NewAddrSubManager(), - ctx: ctx, - cancel: cancel, - } - - go ab.background() - return ab -} - -// background periodically schedules a gc -func (mab *memoryAddrBook) background() { - ticker := time.NewTicker(1 * time.Hour) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - mab.gc() - - case <-mab.ctx.Done(): - return - } - } -} - -func (mab *memoryAddrBook) Close() error { - mab.cancel() - return nil -} - -// gc garbage collects the in-memory address book. -func (mab *memoryAddrBook) gc() { - now := time.Now() - for _, s := range mab.segments { - s.Lock() - for p, amap := range s.addrs { - for k, addr := range amap { - if addr.ExpiredBy(now) { - delete(amap, k) - } - } - if len(amap) == 0 { - delete(s.addrs, p) - } - } - s.Unlock() - } - -} - -func (mab *memoryAddrBook) PeersWithAddrs() peer.IDSlice { - var pids peer.IDSlice - for _, s := range mab.segments { - s.RLock() - for pid, _ := range s.addrs { - pids = append(pids, pid) - } - s.RUnlock() - } - return pids -} - -// AddAddr calls AddAddrs(p, []ma.Multiaddr{addr}, ttl) -func (mab *memoryAddrBook) AddAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration) { - mab.AddAddrs(p, []ma.Multiaddr{addr}, ttl) -} - -// AddAddrs gives memoryAddrBook addresses to use, with a given ttl -// (time-to-live), after which the address is no longer valid. -// If the manager has a longer TTL, the operation is a no-op for that address -func (mab *memoryAddrBook) AddAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration) { - // if ttl is zero, exit. nothing to do. - if ttl <= 0 { - return - } - - s := mab.segments.get(p) - s.Lock() - defer s.Unlock() - - amap := s.addrs[p] - if amap == nil { - amap = make(map[string]*expiringAddr, len(addrs)) - s.addrs[p] = amap - } - exp := time.Now().Add(ttl) - for _, addr := range addrs { - if addr == nil { - log.Warningf("was passed nil multiaddr for %s", p) - continue - } - addrstr := string(addr.Bytes()) - a, found := amap[addrstr] - if !found || exp.After(a.Expires) { - amap[addrstr] = &expiringAddr{Addr: addr, Expires: exp, TTL: ttl} - - mab.subManager.BroadcastAddr(p, addr) - } - } -} - -// SetAddr calls mgr.SetAddrs(p, addr, ttl) -func (mab *memoryAddrBook) SetAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration) { - mab.SetAddrs(p, []ma.Multiaddr{addr}, ttl) -} - -// SetAddrs sets the ttl on addresses. This clears any TTL there previously. -// This is used when we receive the best estimate of the validity of an address. -func (mab *memoryAddrBook) SetAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration) { - s := mab.segments.get(p) - s.Lock() - defer s.Unlock() - - amap := s.addrs[p] - if amap == nil { - amap = make(map[string]*expiringAddr, len(addrs)) - s.addrs[p] = amap - } - - exp := time.Now().Add(ttl) - for _, addr := range addrs { - if addr == nil { - log.Warningf("was passed nil multiaddr for %s", p) - continue - } - // re-set all of them for new ttl. - addrstr := string(addr.Bytes()) - - if ttl > 0 { - amap[addrstr] = &expiringAddr{Addr: addr, Expires: exp, TTL: ttl} - mab.subManager.BroadcastAddr(p, addr) - } else { - delete(amap, addrstr) - } - } -} - -// UpdateAddrs updates the addresses associated with the given peer that have -// the given oldTTL to have the given newTTL. -func (mab *memoryAddrBook) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time.Duration) { - s := mab.segments.get(p) - s.Lock() - defer s.Unlock() - - amap, found := s.addrs[p] - if !found { - return - } - - exp := time.Now().Add(newTTL) - for k, addr := range amap { - if oldTTL == addr.TTL { - addr.TTL = newTTL - addr.Expires = exp - amap[k] = addr - } - } -} - -// Addresses returns all known (and valid) addresses for a given -func (mab *memoryAddrBook) Addrs(p peer.ID) []ma.Multiaddr { - s := mab.segments.get(p) - s.RLock() - defer s.RUnlock() - - amap, found := s.addrs[p] - if !found { - return nil - } - - now := time.Now() - good := make([]ma.Multiaddr, 0, len(amap)) - for _, m := range amap { - if !m.ExpiredBy(now) { - good = append(good, m.Addr) - } - } - - return good -} - -// ClearAddrs removes all previously stored addresses -func (mab *memoryAddrBook) ClearAddrs(p peer.ID) { - s := mab.segments.get(p) - s.Lock() - defer s.Unlock() - - delete(s.addrs, p) -} - -// AddrStream returns a channel on which all new addresses discovered for a -// given peer ID will be published. -func (mab *memoryAddrBook) AddrStream(ctx context.Context, p peer.ID) <-chan ma.Multiaddr { - s := mab.segments.get(p) - s.RLock() - defer s.RUnlock() - - baseaddrslice := s.addrs[p] - initial := make([]ma.Multiaddr, 0, len(baseaddrslice)) - for _, a := range baseaddrslice { - initial = append(initial, a.Addr) - } - - return mab.subManager.AddrStream(ctx, p, initial) -} - -type addrSub struct { - pubch chan ma.Multiaddr - lk sync.Mutex - buffer []ma.Multiaddr - ctx context.Context -} - -func (s *addrSub) pubAddr(a ma.Multiaddr) { - select { - case s.pubch <- a: - case <-s.ctx.Done(): - } -} - -// An abstracted, pub-sub manager for address streams. Extracted from -// memoryAddrBook in order to support additional implementations. -type AddrSubManager struct { - mu sync.RWMutex - subs map[peer.ID][]*addrSub -} - -// NewAddrSubManager initializes an AddrSubManager. -func NewAddrSubManager() *AddrSubManager { - return &AddrSubManager{ - subs: make(map[peer.ID][]*addrSub), - } -} - -// Used internally by the address stream coroutine to remove a subscription -// from the manager. -func (mgr *AddrSubManager) removeSub(p peer.ID, s *addrSub) { - mgr.mu.Lock() - defer mgr.mu.Unlock() - - subs := mgr.subs[p] - if len(subs) == 1 { - if subs[0] != s { - return - } - delete(mgr.subs, p) - return - } - - for i, v := range subs { - if v == s { - subs[i] = subs[len(subs)-1] - subs[len(subs)-1] = nil - mgr.subs[p] = subs[:len(subs)-1] - return - } - } -} - -// BroadcastAddr broadcasts a new address to all subscribed streams. -func (mgr *AddrSubManager) BroadcastAddr(p peer.ID, addr ma.Multiaddr) { - mgr.mu.RLock() - defer mgr.mu.RUnlock() - - if subs, ok := mgr.subs[p]; ok { - for _, sub := range subs { - sub.pubAddr(addr) - } - } -} - -// AddrStream creates a new subscription for a given peer ID, pre-populating the -// channel with any addresses we might already have on file. -func (mgr *AddrSubManager) AddrStream(ctx context.Context, p peer.ID, initial []ma.Multiaddr) <-chan ma.Multiaddr { - sub := &addrSub{pubch: make(chan ma.Multiaddr), ctx: ctx} - out := make(chan ma.Multiaddr) - - mgr.mu.Lock() - if _, ok := mgr.subs[p]; ok { - mgr.subs[p] = append(mgr.subs[p], sub) - } else { - mgr.subs[p] = []*addrSub{sub} - } - mgr.mu.Unlock() - - sort.Sort(addr.AddrList(initial)) - - go func(buffer []ma.Multiaddr) { - defer close(out) - - sent := make(map[string]bool, len(buffer)) - var outch chan ma.Multiaddr - - for _, a := range buffer { - sent[string(a.Bytes())] = true - } - - var next ma.Multiaddr - if len(buffer) > 0 { - next = buffer[0] - buffer = buffer[1:] - outch = out - } - - for { - select { - case outch <- next: - if len(buffer) > 0 { - next = buffer[0] - buffer = buffer[1:] - } else { - outch = nil - next = nil - } - case naddr := <-sub.pubch: - if sent[string(naddr.Bytes())] { - continue - } - - sent[string(naddr.Bytes())] = true - if next == nil { - next = naddr - outch = out - } else { - buffer = append(buffer, naddr) - } - case <-ctx.Done(): - mgr.removeSub(p, sub) - return - } - } - - }(initial) - - return out -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/keybook.go b/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/keybook.go deleted file mode 100644 index 87baea24..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/keybook.go +++ /dev/null @@ -1,93 +0,0 @@ -package pstoremem - -import ( - "errors" - "sync" - - ic "github.com/libp2p/go-libp2p-crypto" - peer "github.com/libp2p/go-libp2p-peer" - - pstore "github.com/libp2p/go-libp2p-peerstore" -) - -type memoryKeyBook struct { - sync.RWMutex // same lock. wont happen a ton. - pks map[peer.ID]ic.PubKey - sks map[peer.ID]ic.PrivKey -} - -var _ pstore.KeyBook = (*memoryKeyBook)(nil) - -// noop new, but in the future we may want to do some init work. -func NewKeyBook() pstore.KeyBook { - return &memoryKeyBook{ - pks: map[peer.ID]ic.PubKey{}, - sks: map[peer.ID]ic.PrivKey{}, - } -} - -func (mkb *memoryKeyBook) PeersWithKeys() peer.IDSlice { - mkb.RLock() - ps := make(peer.IDSlice, 0, len(mkb.pks)+len(mkb.sks)) - for p := range mkb.pks { - ps = append(ps, p) - } - for p := range mkb.sks { - if _, found := mkb.pks[p]; !found { - ps = append(ps, p) - } - } - mkb.RUnlock() - return ps -} - -func (mkb *memoryKeyBook) PubKey(p peer.ID) ic.PubKey { - mkb.RLock() - pk := mkb.pks[p] - mkb.RUnlock() - if pk != nil { - return pk - } - pk, err := p.ExtractPublicKey() - if err == nil { - mkb.Lock() - mkb.pks[p] = pk - mkb.Unlock() - } - return pk -} - -func (mkb *memoryKeyBook) AddPubKey(p peer.ID, pk ic.PubKey) error { - // check it's correct first - if !p.MatchesPublicKey(pk) { - return errors.New("ID does not match PublicKey") - } - - mkb.Lock() - mkb.pks[p] = pk - mkb.Unlock() - return nil -} - -func (mkb *memoryKeyBook) PrivKey(p peer.ID) ic.PrivKey { - mkb.RLock() - sk := mkb.sks[p] - mkb.RUnlock() - return sk -} - -func (mkb *memoryKeyBook) AddPrivKey(p peer.ID, sk ic.PrivKey) error { - if sk == nil { - return errors.New("sk is nil (PrivKey)") - } - - // check it's correct first - if !p.MatchesPrivateKey(sk) { - return errors.New("ID does not match PrivateKey") - } - - mkb.Lock() - mkb.sks[p] = sk - mkb.Unlock() - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/metadata.go b/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/metadata.go deleted file mode 100644 index 162bee50..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/metadata.go +++ /dev/null @@ -1,45 +0,0 @@ -package pstoremem - -import ( - "sync" - - peer "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" -) - -type metakey struct { - id peer.ID - key string -} - -type memoryPeerMetadata struct { - // store other data, like versions - //ds ds.ThreadSafeDatastore - ds map[metakey]interface{} - dslock sync.RWMutex -} - -var _ pstore.PeerMetadata = (*memoryPeerMetadata)(nil) - -func NewPeerMetadata() pstore.PeerMetadata { - return &memoryPeerMetadata{ - ds: make(map[metakey]interface{}), - } -} - -func (ps *memoryPeerMetadata) Put(p peer.ID, key string, val interface{}) error { - ps.dslock.Lock() - defer ps.dslock.Unlock() - ps.ds[metakey{p, key}] = val - return nil -} - -func (ps *memoryPeerMetadata) Get(p peer.ID, key string) (interface{}, error) { - ps.dslock.RLock() - defer ps.dslock.RUnlock() - i, ok := ps.ds[metakey{p, key}] - if !ok { - return nil, pstore.ErrNotFound - } - return i, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/peerstore.go b/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/peerstore.go deleted file mode 100644 index c7cbd672..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/peerstore.go +++ /dev/null @@ -1,12 +0,0 @@ -package pstoremem - -import pstore "github.com/libp2p/go-libp2p-peerstore" - -// NewPeerstore creates an in-memory threadsafe collection of peers. -func NewPeerstore() pstore.Peerstore { - return pstore.NewPeerstore( - NewKeyBook(), - NewAddrBook(), - NewProtoBook(), - NewPeerMetadata()) -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/protobook.go b/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/protobook.go deleted file mode 100644 index 04cd1459..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/pstoremem/protobook.go +++ /dev/null @@ -1,142 +0,0 @@ -package pstoremem - -import ( - "sync" - - peer "github.com/libp2p/go-libp2p-peer" - - pstore "github.com/libp2p/go-libp2p-peerstore" -) - -const ( - maxInternedProtocols = 512 - maxInternedProtocolSize = 256 -) - -type protoSegment struct { - sync.RWMutex - protocols map[peer.ID]map[string]struct{} -} - -type protoSegments [256]*protoSegment - -func (s *protoSegments) get(p peer.ID) *protoSegment { - return s[byte(p[len(p)-1])] -} - -type memoryProtoBook struct { - segments protoSegments - - lk sync.RWMutex - interned map[string]string -} - -var _ pstore.ProtoBook = (*memoryProtoBook)(nil) - -func NewProtoBook() pstore.ProtoBook { - return &memoryProtoBook{ - interned: make(map[string]string, maxInternedProtocols), - segments: func() (ret protoSegments) { - for i := range ret { - ret[i] = &protoSegment{ - protocols: make(map[peer.ID]map[string]struct{}), - } - } - return ret - }(), - } -} - -func (pb *memoryProtoBook) internProtocol(proto string) string { - if len(proto) > maxInternedProtocolSize { - return proto - } - - // check if it is interned with the read lock - pb.lk.RLock() - interned, ok := pb.interned[proto] - pb.lk.RUnlock() - - if ok { - return interned - } - - // intern with the write lock - pb.lk.Lock() - defer pb.lk.Unlock() - - // check again in case it got interned in between locks - interned, ok = pb.interned[proto] - if ok { - return interned - } - - // if we've filled the table, throw it away and start over - if len(pb.interned) >= maxInternedProtocols { - pb.interned = make(map[string]string, maxInternedProtocols) - } - - pb.interned[proto] = proto - return proto -} - -func (pb *memoryProtoBook) SetProtocols(p peer.ID, protos ...string) error { - s := pb.segments.get(p) - s.Lock() - defer s.Unlock() - - newprotos := make(map[string]struct{}, len(protos)) - for _, proto := range protos { - newprotos[pb.internProtocol(proto)] = struct{}{} - } - - s.protocols[p] = newprotos - - return nil -} - -func (pb *memoryProtoBook) AddProtocols(p peer.ID, protos ...string) error { - s := pb.segments.get(p) - s.Lock() - defer s.Unlock() - - protomap, ok := s.protocols[p] - if !ok { - protomap = make(map[string]struct{}) - s.protocols[p] = protomap - } - - for _, proto := range protos { - protomap[pb.internProtocol(proto)] = struct{}{} - } - - return nil -} - -func (pb *memoryProtoBook) GetProtocols(p peer.ID) ([]string, error) { - s := pb.segments.get(p) - s.RLock() - defer s.RUnlock() - - out := make([]string, 0, len(s.protocols)) - for k := range s.protocols[p] { - out = append(out, k) - } - - return out, nil -} - -func (pb *memoryProtoBook) SupportsProtocols(p peer.ID, protos ...string) ([]string, error) { - s := pb.segments.get(p) - s.RLock() - defer s.RUnlock() - - out := make([]string, 0, len(protos)) - for _, proto := range protos { - if _, ok := s.protocols[p][proto]; ok { - out = append(out, proto) - } - } - - return out, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/distance.go b/vendor/github.com/libp2p/go-libp2p-peerstore/queue/distance.go deleted file mode 100644 index 9c3e026e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/distance.go +++ /dev/null @@ -1,100 +0,0 @@ -package queue - -import ( - "container/heap" - "math/big" - "sync" - - "github.com/libp2p/go-libp2p-peer" - ks "github.com/whyrusleeping/go-keyspace" -) - -// peerMetric tracks a peer and its distance to something else. -type peerMetric struct { - // the peer - peer peer.ID - - // big.Int for XOR metric - metric *big.Int -} - -// peerMetricHeap implements a heap of peerDistances -type peerMetricHeap []*peerMetric - -func (ph peerMetricHeap) Len() int { - return len(ph) -} - -func (ph peerMetricHeap) Less(i, j int) bool { - return -1 == ph[i].metric.Cmp(ph[j].metric) -} - -func (ph peerMetricHeap) Swap(i, j int) { - ph[i], ph[j] = ph[j], ph[i] -} - -func (ph *peerMetricHeap) Push(x interface{}) { - item := x.(*peerMetric) - *ph = append(*ph, item) -} - -func (ph *peerMetricHeap) Pop() interface{} { - old := *ph - n := len(old) - item := old[n-1] - *ph = old[0 : n-1] - return item -} - -// distancePQ implements heap.Interface and PeerQueue -type distancePQ struct { - // from is the Key this PQ measures against - from ks.Key - - // heap is a heap of peerDistance items - heap peerMetricHeap - - sync.RWMutex -} - -func (pq *distancePQ) Len() int { - pq.Lock() - defer pq.Unlock() - return len(pq.heap) -} - -func (pq *distancePQ) Enqueue(p peer.ID) { - pq.Lock() - defer pq.Unlock() - - distance := ks.XORKeySpace.Key([]byte(p)).Distance(pq.from) - - heap.Push(&pq.heap, &peerMetric{ - peer: p, - metric: distance, - }) -} - -func (pq *distancePQ) Dequeue() peer.ID { - pq.Lock() - defer pq.Unlock() - - if len(pq.heap) < 1 { - panic("called Dequeue on an empty PeerQueue") - // will panic internally anyway, but we can help debug here - } - - o := heap.Pop(&pq.heap) - p := o.(*peerMetric) - return p.peer -} - -// NewXORDistancePQ returns a PeerQueue which maintains its peers sorted -// in terms of their distances to each other in an XORKeySpace (i.e. using -// XOR as a metric of distance). -func NewXORDistancePQ(from string) PeerQueue { - return &distancePQ{ - from: ks.XORKeySpace.Key([]byte(from)), - heap: peerMetricHeap{}, - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/interface.go b/vendor/github.com/libp2p/go-libp2p-peerstore/queue/interface.go deleted file mode 100644 index 26e1d48b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/interface.go +++ /dev/null @@ -1,18 +0,0 @@ -package queue - -import "github.com/libp2p/go-libp2p-peer" - -// PeerQueue maintains a set of peers ordered according to a metric. -// Implementations of PeerQueue could order peers based on distances along -// a KeySpace, latency measurements, trustworthiness, reputation, etc. -type PeerQueue interface { - - // Len returns the number of items in PeerQueue - Len() int - - // Enqueue adds this node to the queue. - Enqueue(peer.ID) - - // Dequeue retrieves the highest (smallest int) priority node - Dequeue() peer.ID -} diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/sync.go b/vendor/github.com/libp2p/go-libp2p-peerstore/queue/sync.go deleted file mode 100644 index 3815ec78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/queue/sync.go +++ /dev/null @@ -1,85 +0,0 @@ -package queue - -import ( - "context" - - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p-peer" -) - -var log = logging.Logger("peerqueue") - -// ChanQueue makes any PeerQueue synchronizable through channels. -type ChanQueue struct { - Queue PeerQueue - EnqChan chan<- peer.ID - DeqChan <-chan peer.ID -} - -// NewChanQueue creates a ChanQueue by wrapping pq. -func NewChanQueue(ctx context.Context, pq PeerQueue) *ChanQueue { - cq := &ChanQueue{Queue: pq} - cq.process(ctx) - return cq -} - -func (cq *ChanQueue) process(ctx context.Context) { - // construct the channels here to be able to use them bidirectionally - enqChan := make(chan peer.ID) - deqChan := make(chan peer.ID) - - cq.EnqChan = enqChan - cq.DeqChan = deqChan - - go func() { - log.Debug("processing") - defer log.Debug("closed") - defer close(deqChan) - - var next peer.ID - var item peer.ID - var more bool - - for { - if cq.Queue.Len() == 0 { - // log.Debug("wait for enqueue") - select { - case next, more = <-enqChan: - if !more { - return - } - // log.Debug("got", next) - - case <-ctx.Done(): - return - } - - } else { - next = cq.Queue.Dequeue() - // log.Debug("peek", next) - } - - select { - case item, more = <-enqChan: - if !more { - if cq.Queue.Len() > 0 { - return // we're done done. - } - enqChan = nil // closed, so no use. - } - // log.Debug("got", item) - cq.Queue.Enqueue(item) - cq.Queue.Enqueue(next) // order may have changed. - next = "" - - case deqChan <- next: - // log.Debug("dequeued", next) - next = "" - - case <-ctx.Done(): - return - } - } - - }() -} diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/.travis.yml b/vendor/github.com/libp2p/go-libp2p-pnet/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/LICENSE b/vendor/github.com/libp2p/go-libp2p-pnet/LICENSE deleted file mode 100644 index 4ddb347c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Jakub Sztandera - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/README.md b/vendor/github.com/libp2p/go-libp2p-pnet/README.md deleted file mode 100644 index 77ea2881..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/README.md +++ /dev/null @@ -1,36 +0,0 @@ -go-libp2p-pnet -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Travis CI](https://img.shields.io/travis/libp2p/go-libp2p-pnet.svg?style=flat-square&branch=master)](https://travis-ci.org/libp2p/go-libp2p-pnet) -[![codecov.io](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-pnet.svg?style=flat-square&branch=master)](https://codecov.io/github/libp2p/go-libp2p-pnet?branch=master) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> An implementation of go-libp2p-interface-pnet - - -## Table of Contents - -- [Usage](#usage) -- [Contribute](#contribute) -- [License](#license) - -## Usage - -See [Godocs](https://godoc.org/github.com/libp2p/go-libp2p-pnet) - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jakub Sztandera - ---- - -The last gx published version of this module was: 3.0.5: QmTwDsJUPioMKoiuXkAmiPxL1i4tjuG5vkxJgNpiHpXb3Y diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/codec.go b/vendor/github.com/libp2p/go-libp2p-pnet/codec.go deleted file mode 100644 index 19b929f6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/codec.go +++ /dev/null @@ -1,66 +0,0 @@ -package pnet - -import ( - "bufio" - "bytes" - "encoding/base64" - "encoding/hex" - "fmt" - "io" -) - -var ( - pathPSKv1 = []byte("/key/swarm/psk/1.0.0/") - pathBin = "/bin/" - pathBase16 = "/base16/" - pathBase64 = "/base64/" -) - -func readHeader(r *bufio.Reader) ([]byte, error) { - header, err := r.ReadBytes('\n') - if err != nil { - return nil, err - } - - return bytes.TrimRight(header, "\r\n"), nil -} - -func expectHeader(r *bufio.Reader, expected []byte) error { - header, err := readHeader(r) - if err != nil { - return err - } - if !bytes.Equal(header, expected) { - return fmt.Errorf("expected file header %s, got: %s", pathPSKv1, header) - } - return nil -} - -func decodeV1PSK(in io.Reader) (*[32]byte, error) { - reader := bufio.NewReader(in) - if err := expectHeader(reader, pathPSKv1); err != nil { - return nil, err - } - header, err := readHeader(reader) - if err != nil { - return nil, err - } - - var decoder io.Reader - switch string(header) { - case pathBase16: - decoder = hex.NewDecoder(reader) - case pathBase64: - decoder = base64.NewDecoder(base64.StdEncoding, reader) - case pathBin: - decoder = reader - default: - return nil, fmt.Errorf("unknown encoding: %s", header) - } - out := new([32]byte) - _, err = io.ReadFull(decoder, out[:]) - if err != nil { - return nil, err - } - return out, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/codecov.yml b/vendor/github.com/libp2p/go-libp2p-pnet/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/fingerprint.go b/vendor/github.com/libp2p/go-libp2p-pnet/fingerprint.go deleted file mode 100644 index 978a46b6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/fingerprint.go +++ /dev/null @@ -1,24 +0,0 @@ -package pnet - -import ( - "golang.org/x/crypto/salsa20" - "golang.org/x/crypto/sha3" -) - -var zero64 = make([]byte, 64) - -func fingerprint(psk *[32]byte) []byte { - enc := make([]byte, 64) - - // We encrypt data first so we don't feed PSK to hash function. - // Salsa20 function is not reversible thus increasing our security margin. - salsa20.XORKeyStream(enc, zero64, []byte("finprint"), psk) - - out := make([]byte, 16) - // Then do Shake-128 hash to reduce its length. - // This way if for some reason Shake is broken and Salsa20 preimage is possible, - // attacker has only half of the bytes necessary to recreate psk. - sha3.ShakeSum128(out, enc) - - return out -} diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/generate.go b/vendor/github.com/libp2p/go-libp2p-pnet/generate.go deleted file mode 100644 index cf220ced..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/generate.go +++ /dev/null @@ -1,38 +0,0 @@ -package pnet - -import ( - "bytes" - "crypto/rand" - "encoding/hex" - "io" -) - -func newLine() io.Reader { - return bytes.NewReader([]byte("\n")) -} - -// GenerateV1PSK generates new PSK key that can be used with NewProtector -func GenerateV1PSK() (io.Reader, error) { - psk, err := GenerateV1Bytes() - if err != nil { - return nil, err - } - - hexPsk := make([]byte, len(psk)*2) - hex.Encode(hexPsk, psk[:]) - - // just a shortcut to NewReader - nr := func(b []byte) io.Reader { - return bytes.NewReader(b) - } - return io.MultiReader(nr(pathPSKv1), newLine(), nr([]byte("/base16/")), newLine(), nr(hexPsk)), nil -} - -func GenerateV1Bytes() (*[32]byte, error) { - psk := [32]byte{} - _, err := rand.Read(psk[:]) - if err != nil { - return nil, err - } - return &psk, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/go.mod b/vendor/github.com/libp2p/go-libp2p-pnet/go.mod deleted file mode 100644 index 6cd9a515..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-libp2p-pnet - -require ( - github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 - github.com/libp2p/go-buffer-pool v0.0.2 - github.com/libp2p/go-libp2p-core v0.0.1 - golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f -) diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/go.sum b/vendor/github.com/libp2p/go-libp2p-pnet/go.sum deleted file mode 100644 index 281a6348..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/go.sum +++ /dev/null @@ -1,64 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 h1:6xT9KW8zLC5IlbaIF5Q7JNieBoACT7iW0YTxQHR0in0= -github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/protector.go b/vendor/github.com/libp2p/go-libp2p-pnet/protector.go deleted file mode 100644 index 8b8d2dd0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/protector.go +++ /dev/null @@ -1,41 +0,0 @@ -package pnet - -import ( - "fmt" - "io" - "net" - - ipnet "github.com/libp2p/go-libp2p-core/pnet" -) - -var _ ipnet.Protector = (*protector)(nil) - -// NewProtector creates ipnet.Protector instance from a io.Reader stream -// that should include Multicodec encoded V1 PSK. -func NewProtector(input io.Reader) (ipnet.Protector, error) { - psk, err := decodeV1PSK(input) - if err != nil { - return nil, fmt.Errorf("malformed private network key: %s", err) - } - return NewV1ProtectorFromBytes(psk) -} - -// NewV1ProtectorFromBytes creates ipnet.Protector of the V1 version. -func NewV1ProtectorFromBytes(psk *[32]byte) (ipnet.Protector, error) { - return &protector{ - psk: psk, - fingerprint: fingerprint(psk), - }, nil -} - -type protector struct { - psk *[32]byte - fingerprint []byte -} - -func (p protector) Protect(in net.Conn) (net.Conn, error) { - return newPSKConn(p.psk, in) -} -func (p protector) Fingerprint() []byte { - return p.fingerprint -} diff --git a/vendor/github.com/libp2p/go-libp2p-pnet/psk_conn.go b/vendor/github.com/libp2p/go-libp2p-pnet/psk_conn.go deleted file mode 100644 index 5d35d879..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pnet/psk_conn.go +++ /dev/null @@ -1,83 +0,0 @@ -package pnet - -import ( - "crypto/cipher" - "crypto/rand" - "io" - "net" - - "github.com/libp2p/go-libp2p-core/pnet" - - "github.com/davidlazar/go-crypto/salsa20" - pool "github.com/libp2p/go-buffer-pool" -) - -// we are using buffer pool as user needs their slice back -// so we can't do XOR cripter in place -var ( - errShortNonce = pnet.NewError("could not read full nonce") - errInsecureNil = pnet.NewError("insecure is nil") - errPSKNil = pnet.NewError("pre-shread key is nil") -) - -type pskConn struct { - net.Conn - psk *[32]byte - - writeS20 cipher.Stream - readS20 cipher.Stream -} - -func (c *pskConn) Read(out []byte) (int, error) { - if c.readS20 == nil { - nonce := make([]byte, 24) - _, err := io.ReadFull(c.Conn, nonce) - if err != nil { - return 0, errShortNonce - } - c.readS20 = salsa20.New(c.psk, nonce) - } - - n, err := c.Conn.Read(out) // read to in - if n > 0 { - c.readS20.XORKeyStream(out[:n], out[:n]) // decrypt to out buffer - } - return n, err -} - -func (c *pskConn) Write(in []byte) (int, error) { - if c.writeS20 == nil { - nonce := make([]byte, 24) - _, err := rand.Read(nonce) - if err != nil { - return 0, err - } - _, err = c.Conn.Write(nonce) - if err != nil { - return 0, err - } - - c.writeS20 = salsa20.New(c.psk, nonce) - } - out := pool.Get(len(in)) - defer pool.Put(out) - - c.writeS20.XORKeyStream(out, in) // encrypt - - return c.Conn.Write(out) // send -} - -var _ net.Conn = (*pskConn)(nil) - -func newPSKConn(psk *[32]byte, insecure net.Conn) (net.Conn, error) { - if insecure == nil { - return nil, errInsecureNil - } - if psk == nil { - return nil, errPSKNil - } - return &pskConn{ - Conn: insecure, - psk: psk, - }, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/.travis.yml b/vendor/github.com/libp2p/go-libp2p-pubsub-router/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/LICENSE b/vendor/github.com/libp2p/go-libp2p-pubsub-router/LICENSE deleted file mode 100644 index 6cccfc2b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/README.md b/vendor/github.com/libp2p/go-libp2p-pubsub-router/README.md deleted file mode 100644 index 00890fdd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# go-libp2p-pubsub-router - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-pubsub-router?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-pubsub-router) -[![Coverage Status](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-pubsub-router.svg?style=flat-square&branch=master)](https://codecov.io/github/libp2p/go-libp2p-pubsub-router?branch=master) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-pubsub-router.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-pubsub-router) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A libp2p router that uses pubsub. - -We currently only use this for IPNS over PubSub. - -## Documenation - -See https://godoc.org/github.com/libp2p/go-libp2p-pubsub-router. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-pubsub-router/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 0.5.18: QmaHVH3EqQD6DsE1yPgwfCThvFCwfkJ396uyrRSo3Ku1kH diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.mod b/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.mod deleted file mode 100644 index 6b013d63..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/libp2p/go-libp2p-pubsub-router - -require ( - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-datastore v0.0.5 - github.com/ipfs/go-ipfs-ds-help v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-pubsub v0.1.0 - github.com/libp2p/go-libp2p-record v0.1.0 - github.com/libp2p/go-libp2p-routing-helpers v0.1.0 - github.com/libp2p/go-libp2p-swarm v0.1.0 -) diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.sum b/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.sum deleted file mode 100644 index 6479b98a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/go.sum +++ /dev/null @@ -1,231 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-datastore v0.0.5 h1:q3OfiOZV5rlsK1H5V8benjeUApRfMGs4Mrhmr6NriQo= -github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= -github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-pubsub v0.1.0 h1:SmQeMa7IUv5vadh0fYgYsafWCBA1sCy5d/68kIYqGcU= -github.com/libp2p/go-libp2p-pubsub v0.1.0/go.mod h1:ZwlKzRSe1eGvSIdU5bD7+8RZN/Uzw0t1Bp9R1znpR/Q= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/libp2p/go-libp2p-routing-helpers v0.1.0 h1:BaFvpyv8TyhCN7TihawTiKuzeu8/Pyw7ZnMA4IvqIN8= -github.com/libp2p/go-libp2p-routing-helpers v0.1.0/go.mod h1:oUs0h39vNwYtYXnQWOTU5BaafbedSyWCCal3gqHuoOQ= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= -github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub-router/pubsub.go b/vendor/github.com/libp2p/go-libp2p-pubsub-router/pubsub.go deleted file mode 100644 index 7023cb35..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub-router/pubsub.go +++ /dev/null @@ -1,385 +0,0 @@ -package namesys - -import ( - "bytes" - "context" - "encoding/base64" - "errors" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - pubsub "github.com/libp2p/go-libp2p-pubsub" - record "github.com/libp2p/go-libp2p-record" - - "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - dssync "github.com/ipfs/go-datastore/sync" - dshelp "github.com/ipfs/go-ipfs-ds-help" - u "github.com/ipfs/go-ipfs-util" - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("pubsub-valuestore") - -type watchGroup struct { - // Note: this chan must be buffered, see notifyWatchers - listeners map[chan []byte]struct{} -} - -type PubsubValueStore struct { - ctx context.Context - ds ds.Datastore - host host.Host - cr routing.ContentRouting - ps *pubsub.PubSub - - // Map of keys to subscriptions. - // - // If a key is present but the subscription is nil, we've bootstrapped - // but haven't subscribed. - mx sync.Mutex - subs map[string]*pubsub.Subscription - - watchLk sync.Mutex - watching map[string]*watchGroup - - Validator record.Validator -} - -// KeyToTopic converts a binary record key to a pubsub topic key. -func KeyToTopic(key string) string { - // Record-store keys are arbitrary binary. However, pubsub requires UTF-8 string topic IDs. - // Encodes to "/record/base64url(key)" - return "/record/" + base64.RawURLEncoding.EncodeToString([]byte(key)) -} - -// NewPubsubPublisher constructs a new Publisher that publishes IPNS records through pubsub. -// The constructor interface is complicated by the need to bootstrap the pubsub topic. -// This could be greatly simplified if the pubsub implementation handled bootstrap itself -func NewPubsubValueStore(ctx context.Context, host host.Host, cr routing.ContentRouting, ps *pubsub.PubSub, validator record.Validator) *PubsubValueStore { - return &PubsubValueStore{ - ctx: ctx, - - ds: dssync.MutexWrap(ds.NewMapDatastore()), - host: host, // needed for pubsub bootstrap - cr: cr, // needed for pubsub bootstrap - ps: ps, - - subs: make(map[string]*pubsub.Subscription), - watching: make(map[string]*watchGroup), - - Validator: validator, - } -} - -// Publish publishes an IPNS record through pubsub with default TTL -func (p *PubsubValueStore) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) error { - // Record-store keys are arbitrary binary. However, pubsub requires UTF-8 string topic IDs. - // Encode to "/record/base64url(key)" - topic := KeyToTopic(key) - - if err := p.Subscribe(key); err != nil { - return err - } - - log.Debugf("PubsubPublish: publish value for key", key) - return p.ps.Publish(topic, value) -} - -func (p *PubsubValueStore) isBetter(key string, val []byte) bool { - if p.Validator.Validate(key, val) != nil { - return false - } - - old, err := p.getLocal(key) - if err != nil { - // If the old one is invalid, the new one is *always* better. - return true - } - - // Same record. Possible DoS vector, should consider failing? - if bytes.Equal(old, val) { - return true - } - - i, err := p.Validator.Select(key, [][]byte{val, old}) - return err == nil && i == 0 -} - -func (p *PubsubValueStore) Subscribe(key string) error { - p.mx.Lock() - // see if we already have a pubsub subscription; if not, subscribe - sub := p.subs[key] - p.mx.Unlock() - - if sub != nil { - return nil - } - - topic := KeyToTopic(key) - - // Ignore the error. We have to check again anyways to make sure the - // record hasn't expired. - // - // Also, make sure to do this *before* subscribing. - p.ps.RegisterTopicValidator(topic, func(ctx context.Context, _ peer.ID, msg *pubsub.Message) bool { - return p.isBetter(key, msg.GetData()) - }) - - sub, err := p.ps.Subscribe(topic) - if err != nil { - p.mx.Unlock() - return err - } - - p.mx.Lock() - existingSub, bootstraped := p.subs[key] - if existingSub != nil { - p.mx.Unlock() - sub.Cancel() - return nil - } - - p.subs[key] = sub - ctx, cancel := context.WithCancel(p.ctx) - go p.handleSubscription(sub, key, cancel) - p.mx.Unlock() - - log.Debugf("PubsubResolve: subscribed to %s", key) - - if !bootstraped { - // TODO: Deal with publish then resolve case? Cancel behaviour changes. - go bootstrapPubsub(ctx, p.cr, p.host, topic) - } - return nil -} - -func (p *PubsubValueStore) getLocal(key string) ([]byte, error) { - val, err := p.ds.Get(dshelp.NewKeyFromBinary([]byte(key))) - if err != nil { - // Don't invalidate due to ds errors. - if err == ds.ErrNotFound { - err = routing.ErrNotFound - } - return nil, err - } - - // If the old one is invalid, the new one is *always* better. - if err := p.Validator.Validate(key, val); err != nil { - return nil, err - } - return val, nil -} - -func (p *PubsubValueStore) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error) { - if err := p.Subscribe(key); err != nil { - return nil, err - } - - return p.getLocal(key) -} - -func (p *PubsubValueStore) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - if err := p.Subscribe(key); err != nil { - return nil, err - } - - p.watchLk.Lock() - defer p.watchLk.Unlock() - - out := make(chan []byte, 1) - lv, err := p.getLocal(key) - if err == nil { - out <- lv - close(out) - return out, nil - } - - wg, ok := p.watching[key] - if !ok { - wg = &watchGroup{ - listeners: map[chan []byte]struct{}{}, - } - p.watching[key] = wg - } - - proxy := make(chan []byte, 1) - - ctx, cancel := context.WithCancel(ctx) - wg.listeners[proxy] = struct{}{} - - go func() { - defer func() { - cancel() - - p.watchLk.Lock() - delete(wg.listeners, proxy) - - if _, ok := p.watching[key]; len(wg.listeners) == 0 && ok { - delete(p.watching, key) - } - p.watchLk.Unlock() - - close(out) - }() - - for { - select { - case val, ok := <-proxy: - if !ok { - return - } - - // outCh is buffered, so we just put the value or swap it for the newer one - select { - case out <- val: - case <-out: - out <- val - } - - // 1 is good enough - return - case <-ctx.Done(): - return - } - } - }() - - return out, nil -} - -// GetSubscriptions retrieves a list of active topic subscriptions -func (p *PubsubValueStore) GetSubscriptions() []string { - p.mx.Lock() - defer p.mx.Unlock() - - var res []string - for sub := range p.subs { - res = append(res, sub) - } - - return res -} - -// Cancel cancels a topic subscription; returns true if an active -// subscription was canceled -func (p *PubsubValueStore) Cancel(name string) (bool, error) { - p.mx.Lock() - defer p.mx.Unlock() - - p.watchLk.Lock() - if _, wok := p.watching[name]; wok { - p.watchLk.Unlock() - return false, errors.New("key has active subscriptions") - } - p.watchLk.Unlock() - - sub, ok := p.subs[name] - if ok { - sub.Cancel() - delete(p.subs, name) - } - - return ok, nil -} - -func (p *PubsubValueStore) handleSubscription(sub *pubsub.Subscription, key string, cancel func()) { - defer sub.Cancel() - defer cancel() - - for { - msg, err := sub.Next(p.ctx) - if err != nil { - if err != context.Canceled { - log.Warningf("PubsubResolve: subscription error in %s: %s", key, err.Error()) - } - return - } - if p.isBetter(key, msg.GetData()) { - err := p.ds.Put(dshelp.NewKeyFromBinary([]byte(key)), msg.GetData()) - if err != nil { - log.Warningf("PubsubResolve: error writing update for %s: %s", key, err) - } - p.notifyWatchers(key, msg.GetData()) - } - } -} - -func (p *PubsubValueStore) notifyWatchers(key string, data []byte) { - p.watchLk.Lock() - defer p.watchLk.Unlock() - sg, ok := p.watching[key] - if !ok { - return - } - - for watcher := range sg.listeners { - select { - case <-watcher: - watcher <- data - case watcher <- data: - } - } -} - -// rendezvous with peers in the name topic through provider records -// Note: rendezvous/boostrap should really be handled by the pubsub implementation itself! -func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host host.Host, name string) { - // TODO: consider changing this to `pubsub:...` - topic := "floodsub:" + name - hash := u.Hash([]byte(topic)) - rz := cid.NewCidV1(cid.Raw, hash) - - go func() { - err := cr.Provide(ctx, rz, true) - if err != nil { - log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error()) - } - - for { - select { - case <-time.After(8 * time.Hour): - err := cr.Provide(ctx, rz, true) - if err != nil { - log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error()) - } - case <-ctx.Done(): - return - } - } - }() - - rzctx, cancel := context.WithTimeout(ctx, time.Second*10) - defer cancel() - - wg := &sync.WaitGroup{} - for pi := range cr.FindProvidersAsync(rzctx, rz, 10) { - if pi.ID == host.ID() { - continue - } - wg.Add(1) - go func(pi peer.AddrInfo) { - defer wg.Done() - - ctx, cancel := context.WithTimeout(ctx, time.Second*10) - defer cancel() - - err := host.Connect(ctx, pi) - if err != nil { - log.Debugf("Error connecting to pubsub peer %s: %s", pi.ID, err.Error()) - return - } - - // delay to let pubsub perform its handshake - time.Sleep(time.Millisecond * 250) - - log.Debugf("Connected to pubsub peer %s", pi.ID) - }(pi) - } - - wg.Wait() -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/.gitignore b/vendor/github.com/libp2p/go-libp2p-pubsub/.gitignore deleted file mode 100644 index 5b98de78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -cover.out -prof.out -go-floodsub.test diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/.travis.yml b/vendor/github.com/libp2p/go-libp2p-pubsub/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/LICENSE b/vendor/github.com/libp2p/go-libp2p-pubsub/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/README.md b/vendor/github.com/libp2p/go-libp2p-pubsub/README.md deleted file mode 100644 index c571e7c4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# go-libp2p-pubsub - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://github.com/libp2p/libp2p) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A pubsub system with flooding and gossiping variants. - -This is the canonical pubsub implementation for libp2p. - -We currently provide three implementations: -- floodsub, which is the baseline flooding protocol. -- gossipsub, which is a more advanced router with mesh formation and gossip propagation. - See [spec](https://github.com/libp2p/specs/tree/master/pubsub/gossipsub) and [implementation](https://github.com/libp2p/go-libp2p-pubsub/blob/master/gossipsub.go) for more details. -- randomsub, which is a simple probabilistic router that propagates to random subsets of peers. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Documentation](#documentation) -- [Contribute](#contribute) -- [License](#license) - -## Install - -``` -go get github.com/libp2p/go-libp2p-pubsub -``` - -## Usage - -To be used for messaging in p2p instrastructure (as part of libp2p) such as IPFS, Ethereum, other blockchains, etc. - -## Implementations - -See [libp2p/specs/pubsub#Implementations](https://github.com/libp2p/specs/tree/master/pubsub#Implementations). - -## Documentation - -See the [libp2p specs](https://github.com/libp2p/specs/tree/master/pubsub) for high level documentation -and [godoc](https://godoc.org/github.com/libp2p/go-libp2p-pubsub) for API documentation. - - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/libp2p/go-libp2p-pubsub/issues). - -Check out our [contributing document](https://github.com/libp2p/community/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © Jeromy Johnson - ---- - -The last gx published version of this module was: 0.11.16: QmfB4oDUTiaGEqT13P1JqCEhqW7cB1wpKtq3PP4BN8PhQd diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/blacklist.go b/vendor/github.com/libp2p/go-libp2p-pubsub/blacklist.go deleted file mode 100644 index ba747d81..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/blacklist.go +++ /dev/null @@ -1,53 +0,0 @@ -package pubsub - -import ( - lru "github.com/hashicorp/golang-lru" - "github.com/libp2p/go-libp2p-core/peer" -) - -// Blacklist is an interface for peer blacklisting. -type Blacklist interface { - Add(peer.ID) - Contains(peer.ID) bool -} - -// MapBlacklist is a blacklist implementation using a perfect map -type MapBlacklist map[peer.ID]struct{} - -// NewMapBlacklist creates a new MapBlacklist -func NewMapBlacklist() Blacklist { - return MapBlacklist(make(map[peer.ID]struct{})) -} - -func (b MapBlacklist) Add(p peer.ID) { - b[p] = struct{}{} -} - -func (b MapBlacklist) Contains(p peer.ID) bool { - _, ok := b[p] - return ok -} - -// LRUBlacklist is a blacklist implementation using an LRU cache -type LRUBlacklist struct { - lru *lru.Cache -} - -// NewLRUBlacklist creates a new LRUBlacklist with capacity cap -func NewLRUBlacklist(cap int) (Blacklist, error) { - c, err := lru.New(cap) - if err != nil { - return nil, err - } - - b := &LRUBlacklist{lru: c} - return b, nil -} - -func (b LRUBlacklist) Add(p peer.ID) { - b.lru.Add(p, nil) -} - -func (b LRUBlacklist) Contains(p peer.ID) bool { - return b.lru.Contains(p) -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/codecov.yml b/vendor/github.com/libp2p/go-libp2p-pubsub/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/comm.go b/vendor/github.com/libp2p/go-libp2p-pubsub/comm.go deleted file mode 100644 index d0d40da5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/comm.go +++ /dev/null @@ -1,174 +0,0 @@ -package pubsub - -import ( - "bufio" - "context" - "io" - - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - - ggio "github.com/gogo/protobuf/io" - proto "github.com/gogo/protobuf/proto" - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - ms "github.com/multiformats/go-multistream" -) - -// get the initial RPC containing all of our subscriptions to send to new peers -func (p *PubSub) getHelloPacket() *RPC { - var rpc RPC - for t := range p.myTopics { - as := &pb.RPC_SubOpts{ - Topicid: proto.String(t), - Subscribe: proto.Bool(true), - } - rpc.Subscriptions = append(rpc.Subscriptions, as) - } - return &rpc -} - -func (p *PubSub) handleNewStream(s network.Stream) { - r := ggio.NewDelimitedReader(s, 1<<20) - for { - rpc := new(RPC) - err := r.ReadMsg(&rpc.RPC) - if err != nil { - if err != io.EOF { - s.Reset() - log.Infof("error reading rpc from %s: %s", s.Conn().RemotePeer(), err) - } else { - // Just be nice. They probably won't read this - // but it doesn't hurt to send it. - s.Close() - } - return - } - - rpc.from = s.Conn().RemotePeer() - select { - case p.incoming <- rpc: - case <-p.ctx.Done(): - // Close is useless because the other side isn't reading. - s.Reset() - return - } - } -} - -func (p *PubSub) handleNewPeer(ctx context.Context, pid peer.ID, outgoing <-chan *RPC) { - s, err := p.host.NewStream(p.ctx, pid, p.rt.Protocols()...) - if err != nil { - log.Warning("opening new stream to peer: ", err, pid) - - var ch chan peer.ID - if err == ms.ErrNotSupported { - ch = p.newPeerError - } else { - ch = p.peerDead - } - - select { - case ch <- pid: - case <-ctx.Done(): - } - return - } - - go p.handleSendingMessages(ctx, s, outgoing) - go p.handlePeerEOF(ctx, s) - select { - case p.newPeerStream <- s: - case <-ctx.Done(): - } -} - -func (p *PubSub) handlePeerEOF(ctx context.Context, s network.Stream) { - r := ggio.NewDelimitedReader(s, 1<<20) - rpc := new(RPC) - for { - err := r.ReadMsg(&rpc.RPC) - if err != nil { - select { - case p.peerDead <- s.Conn().RemotePeer(): - case <-ctx.Done(): - } - return - } - log.Warning("unexpected message from ", s.Conn().RemotePeer()) - } -} - -func (p *PubSub) handleSendingMessages(ctx context.Context, s network.Stream, outgoing <-chan *RPC) { - bufw := bufio.NewWriter(s) - wc := ggio.NewDelimitedWriter(bufw) - - writeMsg := func(msg proto.Message) error { - err := wc.WriteMsg(msg) - if err != nil { - return err - } - - return bufw.Flush() - } - - defer helpers.FullClose(s) - for { - select { - case rpc, ok := <-outgoing: - if !ok { - return - } - - err := writeMsg(&rpc.RPC) - if err != nil { - s.Reset() - log.Infof("writing message to %s: %s", s.Conn().RemotePeer(), err) - return - } - case <-ctx.Done(): - return - } - } -} - -func rpcWithSubs(subs ...*pb.RPC_SubOpts) *RPC { - return &RPC{ - RPC: pb.RPC{ - Subscriptions: subs, - }, - } -} - -func rpcWithMessages(msgs ...*pb.Message) *RPC { - return &RPC{RPC: pb.RPC{Publish: msgs}} -} - -func rpcWithControl(msgs []*pb.Message, - ihave []*pb.ControlIHave, - iwant []*pb.ControlIWant, - graft []*pb.ControlGraft, - prune []*pb.ControlPrune) *RPC { - return &RPC{ - RPC: pb.RPC{ - Publish: msgs, - Control: &pb.ControlMessage{ - Ihave: ihave, - Iwant: iwant, - Graft: graft, - Prune: prune, - }, - }, - } -} - -func copyRPC(rpc *RPC) *RPC { - res := new(RPC) - *res = *rpc - if rpc.Control != nil { - res.Control = new(pb.ControlMessage) - *res.Control = *rpc.Control - } - return res -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/doc.go b/vendor/github.com/libp2p/go-libp2p-pubsub/doc.go deleted file mode 100644 index e8a5ac89..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/doc.go +++ /dev/null @@ -1,27 +0,0 @@ -// The pubsub package provides facilities for the Publish/Subscribe pattern of message -// propagation, also known as overlay multicast. -// The implementation provides topic-based pubsub, with pluggable routing algorithms. -// -// The main interface to the library is the PubSub object. -// You can construct this object with the following constructors: -// -// - NewFloodSub creates an instance that uses the floodsub routing algorithm. -// -// - NewGossipSub creates an instance that uses the gossipsub routing algorithm. -// -// - NewRandomSub creates an instance that uses the randomsub routing algorithm. -// -// In addition, there is a generic constructor that creates a pubsub instance with -// a custom PubSubRouter interface. This procedure is currently reserved for internal -// use within the package. -// -// Once you have constructed a PubSub instance, you need to establish some connections -// to your peers; the implementation relies on ambient peer discovery, leaving bootstrap -// and active peer discovery up to the client. -// -// To publish a message to some topic, use Publish; you don't need to be subscribed -// to the topic in order to publish. -// -// To subscribe to a topic, use Subscribe; this will give you a subscription interface -// from which new messages can be pumped. -package pubsub diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/floodsub.go b/vendor/github.com/libp2p/go-libp2p-pubsub/floodsub.go deleted file mode 100644 index 0d57c991..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/floodsub.go +++ /dev/null @@ -1,84 +0,0 @@ -package pubsub - -import ( - "context" - - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -const ( - FloodSubID = protocol.ID("/floodsub/1.0.0") -) - -// NewFloodsubWithProtocols returns a new floodsub-enabled PubSub objecting using the protocols specified in ps. -func NewFloodsubWithProtocols(ctx context.Context, h host.Host, ps []protocol.ID, opts ...Option) (*PubSub, error) { - rt := &FloodSubRouter{ - protocols: ps, - } - return NewPubSub(ctx, h, rt, opts...) -} - -// NewFloodSub returns a new PubSub object using the FloodSubRouter. -func NewFloodSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) { - return NewFloodsubWithProtocols(ctx, h, []protocol.ID{FloodSubID}, opts...) -} - -type FloodSubRouter struct { - p *PubSub - protocols []protocol.ID -} - -func (fs *FloodSubRouter) Protocols() []protocol.ID { - return fs.protocols -} - -func (fs *FloodSubRouter) Attach(p *PubSub) { - fs.p = p -} - -func (fs *FloodSubRouter) AddPeer(peer.ID, protocol.ID) {} - -func (fs *FloodSubRouter) RemovePeer(peer.ID) {} - -func (fs *FloodSubRouter) HandleRPC(rpc *RPC) {} - -func (fs *FloodSubRouter) Publish(from peer.ID, msg *pb.Message) { - tosend := make(map[peer.ID]struct{}) - for _, topic := range msg.GetTopicIDs() { - tmap, ok := fs.p.topics[topic] - if !ok { - continue - } - - for p := range tmap { - tosend[p] = struct{}{} - } - } - - out := rpcWithMessages(msg) - for pid := range tosend { - if pid == from || pid == peer.ID(msg.GetFrom()) { - continue - } - - mch, ok := fs.p.peers[pid] - if !ok { - continue - } - - select { - case mch <- out: - default: - log.Infof("dropping message to peer %s: queue full", pid) - // Drop it. The peer is too slow. - } - } -} - -func (fs *FloodSubRouter) Join(topic string) {} - -func (fs *FloodSubRouter) Leave(topic string) {} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/go.mod b/vendor/github.com/libp2p/go-libp2p-pubsub/go.mod deleted file mode 100644 index c22fa9b7..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/libp2p/go-libp2p-pubsub - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multistream v0.1.0 - github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee -) diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/go.sum b/vendor/github.com/libp2p/go-libp2p-pubsub/go.sum deleted file mode 100644 index 2352c3cd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/go.sum +++ /dev/null @@ -1,219 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= -github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/gossipsub.go b/vendor/github.com/libp2p/go-libp2p-pubsub/gossipsub.go deleted file mode 100644 index 3bb9eda1..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/gossipsub.go +++ /dev/null @@ -1,669 +0,0 @@ -package pubsub - -import ( - "context" - "fmt" - "math/rand" - "time" - - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -const ( - GossipSubID = protocol.ID("/meshsub/1.0.0") -) - -var ( - // overlay parameters - GossipSubD = 6 - GossipSubDlo = 4 - GossipSubDhi = 12 - - // gossip parameters - GossipSubHistoryLength = 5 - GossipSubHistoryGossip = 3 - - // heartbeat interval - GossipSubHeartbeatInitialDelay = 100 * time.Millisecond - GossipSubHeartbeatInterval = 1 * time.Second - - // fanout ttl - GossipSubFanoutTTL = 60 * time.Second -) - -// NewGossipSub returns a new PubSub object using GossipSubRouter as the router. -func NewGossipSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) { - rt := &GossipSubRouter{ - peers: make(map[peer.ID]protocol.ID), - mesh: make(map[string]map[peer.ID]struct{}), - fanout: make(map[string]map[peer.ID]struct{}), - lastpub: make(map[string]int64), - gossip: make(map[peer.ID][]*pb.ControlIHave), - control: make(map[peer.ID]*pb.ControlMessage), - mcache: NewMessageCache(GossipSubHistoryGossip, GossipSubHistoryLength), - } - return NewPubSub(ctx, h, rt, opts...) -} - -// GossipSubRouter is a router that implements the gossipsub protocol. -// For each topic we have joined, we maintain an overlay through which -// messages flow; this is the mesh map. -// For each topic we publish to without joining, we maintain a list of peers -// to use for injecting our messages in the overlay with stable routes; this -// is the fanout map. Fanout peer lists are expired if we don't publish any -// messages to their topic for GossipSubFanoutTTL. -type GossipSubRouter struct { - p *PubSub - peers map[peer.ID]protocol.ID // peer protocols - mesh map[string]map[peer.ID]struct{} // topic meshes - fanout map[string]map[peer.ID]struct{} // topic fanout - lastpub map[string]int64 // last publish time for fanout topics - gossip map[peer.ID][]*pb.ControlIHave // pending gossip - control map[peer.ID]*pb.ControlMessage // pending control messages - mcache *MessageCache -} - -func (gs *GossipSubRouter) Protocols() []protocol.ID { - return []protocol.ID{GossipSubID, FloodSubID} -} - -func (gs *GossipSubRouter) Attach(p *PubSub) { - gs.p = p - go gs.heartbeatTimer() -} - -func (gs *GossipSubRouter) AddPeer(p peer.ID, proto protocol.ID) { - log.Debugf("PEERUP: Add new peer %s using %s", p, proto) - gs.peers[p] = proto -} - -func (gs *GossipSubRouter) RemovePeer(p peer.ID) { - log.Debugf("PEERDOWN: Remove disconnected peer %s", p) - delete(gs.peers, p) - for _, peers := range gs.mesh { - delete(peers, p) - } - for _, peers := range gs.fanout { - delete(peers, p) - } - delete(gs.gossip, p) - delete(gs.control, p) -} - -func (gs *GossipSubRouter) HandleRPC(rpc *RPC) { - ctl := rpc.GetControl() - if ctl == nil { - return - } - - iwant := gs.handleIHave(rpc.from, ctl) - ihave := gs.handleIWant(rpc.from, ctl) - prune := gs.handleGraft(rpc.from, ctl) - gs.handlePrune(rpc.from, ctl) - - if len(iwant) == 0 && len(ihave) == 0 && len(prune) == 0 { - return - } - - out := rpcWithControl(ihave, nil, iwant, nil, prune) - gs.sendRPC(rpc.from, out) -} - -func (gs *GossipSubRouter) handleIHave(p peer.ID, ctl *pb.ControlMessage) []*pb.ControlIWant { - iwant := make(map[string]struct{}) - - for _, ihave := range ctl.GetIhave() { - topic := ihave.GetTopicID() - _, ok := gs.mesh[topic] - if !ok { - continue - } - - for _, mid := range ihave.GetMessageIDs() { - if gs.p.seenMessage(mid) { - continue - } - iwant[mid] = struct{}{} - } - } - - if len(iwant) == 0 { - return nil - } - - log.Debugf("IHAVE: Asking for %d messages from %s", len(iwant), p) - - iwantlst := make([]string, 0, len(iwant)) - for mid := range iwant { - iwantlst = append(iwantlst, mid) - } - - return []*pb.ControlIWant{&pb.ControlIWant{MessageIDs: iwantlst}} -} - -func (gs *GossipSubRouter) handleIWant(p peer.ID, ctl *pb.ControlMessage) []*pb.Message { - ihave := make(map[string]*pb.Message) - for _, iwant := range ctl.GetIwant() { - for _, mid := range iwant.GetMessageIDs() { - msg, ok := gs.mcache.Get(mid) - if ok { - ihave[mid] = msg - } - } - } - - if len(ihave) == 0 { - return nil - } - - log.Debugf("IWANT: Sending %d messages to %s", len(ihave), p) - - msgs := make([]*pb.Message, 0, len(ihave)) - for _, msg := range ihave { - msgs = append(msgs, msg) - } - - return msgs -} - -func (gs *GossipSubRouter) handleGraft(p peer.ID, ctl *pb.ControlMessage) []*pb.ControlPrune { - var prune []string - for _, graft := range ctl.GetGraft() { - topic := graft.GetTopicID() - peers, ok := gs.mesh[topic] - if !ok { - prune = append(prune, topic) - } else { - log.Debugf("GRAFT: Add mesh link from %s in %s", p, topic) - peers[p] = struct{}{} - gs.tagPeer(p, topic) - } - } - - if len(prune) == 0 { - return nil - } - - cprune := make([]*pb.ControlPrune, 0, len(prune)) - for _, topic := range prune { - cprune = append(cprune, &pb.ControlPrune{TopicID: &topic}) - } - - return cprune -} - -func (gs *GossipSubRouter) handlePrune(p peer.ID, ctl *pb.ControlMessage) { - for _, prune := range ctl.GetPrune() { - topic := prune.GetTopicID() - peers, ok := gs.mesh[topic] - if ok { - log.Debugf("PRUNE: Remove mesh link to %s in %s", p, topic) - delete(peers, p) - gs.untagPeer(p, topic) - } - } -} - -func (gs *GossipSubRouter) Publish(from peer.ID, msg *pb.Message) { - gs.mcache.Put(msg) - - tosend := make(map[peer.ID]struct{}) - for _, topic := range msg.GetTopicIDs() { - // any peers in the topic? - tmap, ok := gs.p.topics[topic] - if !ok { - continue - } - - // floodsub peers - for p := range tmap { - if gs.peers[p] == FloodSubID { - tosend[p] = struct{}{} - } - } - - // gossipsub peers - gmap, ok := gs.mesh[topic] - if !ok { - // we are not in the mesh for topic, use fanout peers - gmap, ok = gs.fanout[topic] - if !ok { - // we don't have any, pick some - peers := gs.getPeers(topic, GossipSubD, func(peer.ID) bool { return true }) - - if len(peers) > 0 { - gmap = peerListToMap(peers) - gs.fanout[topic] = gmap - } - } - gs.lastpub[topic] = time.Now().UnixNano() - } - - for p := range gmap { - tosend[p] = struct{}{} - } - } - - out := rpcWithMessages(msg) - for pid := range tosend { - if pid == from || pid == peer.ID(msg.GetFrom()) { - continue - } - - gs.sendRPC(pid, out) - } -} - -func (gs *GossipSubRouter) Join(topic string) { - gmap, ok := gs.mesh[topic] - if ok { - return - } - - log.Debugf("JOIN %s", topic) - - gmap, ok = gs.fanout[topic] - if ok { - gs.mesh[topic] = gmap - delete(gs.fanout, topic) - delete(gs.lastpub, topic) - } else { - peers := gs.getPeers(topic, GossipSubD, func(peer.ID) bool { return true }) - gmap = peerListToMap(peers) - gs.mesh[topic] = gmap - } - - for p := range gmap { - log.Debugf("JOIN: Add mesh link to %s in %s", p, topic) - gs.sendGraft(p, topic) - gs.tagPeer(p, topic) - } -} - -func (gs *GossipSubRouter) Leave(topic string) { - gmap, ok := gs.mesh[topic] - if !ok { - return - } - - log.Debugf("LEAVE %s", topic) - - delete(gs.mesh, topic) - - for p := range gmap { - log.Debugf("LEAVE: Remove mesh link to %s in %s", p, topic) - gs.sendPrune(p, topic) - gs.untagPeer(p, topic) - } -} - -func (gs *GossipSubRouter) sendGraft(p peer.ID, topic string) { - graft := []*pb.ControlGraft{&pb.ControlGraft{TopicID: &topic}} - out := rpcWithControl(nil, nil, nil, graft, nil) - gs.sendRPC(p, out) -} - -func (gs *GossipSubRouter) sendPrune(p peer.ID, topic string) { - prune := []*pb.ControlPrune{&pb.ControlPrune{TopicID: &topic}} - out := rpcWithControl(nil, nil, nil, nil, prune) - gs.sendRPC(p, out) -} - -func (gs *GossipSubRouter) sendRPC(p peer.ID, out *RPC) { - // do we own the RPC? - own := false - - // piggyback control message retries - ctl, ok := gs.control[p] - if ok { - out = copyRPC(out) - own = true - gs.piggybackControl(p, out, ctl) - delete(gs.control, p) - } - - // piggyback gossip - ihave, ok := gs.gossip[p] - if ok { - if !own { - out = copyRPC(out) - own = true - } - gs.piggybackGossip(p, out, ihave) - delete(gs.gossip, p) - } - - mch, ok := gs.p.peers[p] - if !ok { - return - } - - select { - case mch <- out: - default: - log.Infof("dropping message to peer %s: queue full", p) - // push control messages that need to be retried - ctl := out.GetControl() - if ctl != nil { - gs.pushControl(p, ctl) - } - } -} - -func (gs *GossipSubRouter) heartbeatTimer() { - time.Sleep(GossipSubHeartbeatInitialDelay) - select { - case gs.p.eval <- gs.heartbeat: - case <-gs.p.ctx.Done(): - return - } - - ticker := time.NewTicker(GossipSubHeartbeatInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - select { - case gs.p.eval <- gs.heartbeat: - case <-gs.p.ctx.Done(): - return - } - case <-gs.p.ctx.Done(): - return - } - } -} - -func (gs *GossipSubRouter) heartbeat() { - defer log.EventBegin(gs.p.ctx, "heartbeat").Done() - - // flush pending control message from retries and gossip - // that hasn't been piggybacked since the last heartbeat - gs.flush() - - tograft := make(map[peer.ID][]string) - toprune := make(map[peer.ID][]string) - - // maintain the mesh for topics we have joined - for topic, peers := range gs.mesh { - - // do we have enough peers? - if len(peers) < GossipSubDlo { - ineed := GossipSubD - len(peers) - plst := gs.getPeers(topic, ineed, func(p peer.ID) bool { - // filter our current peers - _, ok := peers[p] - return !ok - }) - - for _, p := range plst { - log.Debugf("HEARTBEAT: Add mesh link to %s in %s", p, topic) - peers[p] = struct{}{} - gs.tagPeer(p, topic) - topics := tograft[p] - tograft[p] = append(topics, topic) - } - } - - // do we have too many peers? - if len(peers) > GossipSubDhi { - idontneed := len(peers) - GossipSubD - plst := peerMapToList(peers) - shufflePeers(plst) - - for _, p := range plst[:idontneed] { - log.Debugf("HEARTBEAT: Remove mesh link to %s in %s", p, topic) - delete(peers, p) - gs.untagPeer(p, topic) - topics := toprune[p] - toprune[p] = append(topics, topic) - } - } - - gs.emitGossip(topic, peers) - } - - // expire fanout for topics we haven't published to in a while - now := time.Now().UnixNano() - for topic, lastpub := range gs.lastpub { - if lastpub+int64(GossipSubFanoutTTL) < now { - delete(gs.fanout, topic) - delete(gs.lastpub, topic) - } - } - - // maintain our fanout for topics we are publishing but we have not joined - for topic, peers := range gs.fanout { - // check whether our peers are still in the topic - for p := range peers { - _, ok := gs.p.topics[topic][p] - if !ok { - delete(peers, p) - } - } - - // do we need more peers? - if len(peers) < GossipSubD { - ineed := GossipSubD - len(peers) - plst := gs.getPeers(topic, ineed, func(p peer.ID) bool { - // filter our current peers - _, ok := peers[p] - return !ok - }) - - for _, p := range plst { - peers[p] = struct{}{} - } - } - - gs.emitGossip(topic, peers) - } - - // send coalesced GRAFT/PRUNE messages (will piggyback gossip) - gs.sendGraftPrune(tograft, toprune) - - // advance the message history window - gs.mcache.Shift() -} - -func (gs *GossipSubRouter) sendGraftPrune(tograft, toprune map[peer.ID][]string) { - for p, topics := range tograft { - graft := make([]*pb.ControlGraft, 0, len(topics)) - for _, topic := range topics { - graft = append(graft, &pb.ControlGraft{TopicID: &topic}) - } - - var prune []*pb.ControlPrune - pruning, ok := toprune[p] - if ok { - delete(toprune, p) - prune = make([]*pb.ControlPrune, 0, len(pruning)) - for _, topic := range pruning { - prune = append(prune, &pb.ControlPrune{TopicID: &topic}) - } - } - - out := rpcWithControl(nil, nil, nil, graft, prune) - gs.sendRPC(p, out) - } - - for p, topics := range toprune { - prune := make([]*pb.ControlPrune, 0, len(topics)) - for _, topic := range topics { - prune = append(prune, &pb.ControlPrune{TopicID: &topic}) - } - - out := rpcWithControl(nil, nil, nil, nil, prune) - gs.sendRPC(p, out) - } - -} - -func (gs *GossipSubRouter) emitGossip(topic string, peers map[peer.ID]struct{}) { - mids := gs.mcache.GetGossipIDs(topic) - if len(mids) == 0 { - return - } - - gpeers := gs.getPeers(topic, GossipSubD, func(peer.ID) bool { return true }) - for _, p := range gpeers { - // skip mesh peers - _, ok := peers[p] - if !ok { - gs.pushGossip(p, &pb.ControlIHave{TopicID: &topic, MessageIDs: mids}) - } - } -} - -func (gs *GossipSubRouter) flush() { - // send gossip first, which will also piggyback control - for p, ihave := range gs.gossip { - delete(gs.gossip, p) - out := rpcWithControl(nil, ihave, nil, nil, nil) - gs.sendRPC(p, out) - } - - // send the remaining control messages - for p, ctl := range gs.control { - delete(gs.control, p) - out := rpcWithControl(nil, nil, nil, ctl.Graft, ctl.Prune) - gs.sendRPC(p, out) - } -} - -func (gs *GossipSubRouter) pushGossip(p peer.ID, ihave *pb.ControlIHave) { - gossip := gs.gossip[p] - gossip = append(gossip, ihave) - gs.gossip[p] = gossip -} - -func (gs *GossipSubRouter) piggybackGossip(p peer.ID, out *RPC, ihave []*pb.ControlIHave) { - ctl := out.GetControl() - if ctl == nil { - ctl = &pb.ControlMessage{} - out.Control = ctl - } - - ctl.Ihave = ihave -} - -func (gs *GossipSubRouter) pushControl(p peer.ID, ctl *pb.ControlMessage) { - // remove IHAVE/IWANT from control message, gossip is not retried - ctl.Ihave = nil - ctl.Iwant = nil - if ctl.Graft != nil || ctl.Prune != nil { - gs.control[p] = ctl - } -} - -func (gs *GossipSubRouter) piggybackControl(p peer.ID, out *RPC, ctl *pb.ControlMessage) { - // check control message for staleness first - var tograft []*pb.ControlGraft - var toprune []*pb.ControlPrune - - for _, graft := range ctl.GetGraft() { - topic := graft.GetTopicID() - peers, ok := gs.mesh[topic] - if !ok { - continue - } - _, ok = peers[p] - if ok { - tograft = append(tograft, graft) - } - } - - for _, prune := range ctl.GetPrune() { - topic := prune.GetTopicID() - peers, ok := gs.mesh[topic] - if !ok { - toprune = append(toprune, prune) - continue - } - _, ok = peers[p] - if !ok { - toprune = append(toprune, prune) - } - } - - if len(tograft) == 0 && len(toprune) == 0 { - return - } - - xctl := out.Control - if xctl == nil { - xctl = &pb.ControlMessage{} - out.Control = xctl - } - - if len(tograft) > 0 { - xctl.Graft = append(xctl.Graft, tograft...) - } - if len(toprune) > 0 { - xctl.Prune = append(xctl.Prune, toprune...) - } -} - -func (gs *GossipSubRouter) getPeers(topic string, count int, filter func(peer.ID) bool) []peer.ID { - tmap, ok := gs.p.topics[topic] - if !ok { - return nil - } - - peers := make([]peer.ID, 0, len(tmap)) - for p := range tmap { - if gs.peers[p] == GossipSubID && filter(p) { - peers = append(peers, p) - } - } - - shufflePeers(peers) - - if count > 0 && len(peers) > count { - peers = peers[:count] - } - - return peers -} - -func (gs *GossipSubRouter) tagPeer(p peer.ID, topic string) { - tag := topicTag(topic) - gs.p.host.ConnManager().TagPeer(p, tag, 2) -} - -func (gs *GossipSubRouter) untagPeer(p peer.ID, topic string) { - tag := topicTag(topic) - gs.p.host.ConnManager().UntagPeer(p, tag) -} - -func topicTag(topic string) string { - return fmt.Sprintf("pubsub:%s", topic) -} - -func peerListToMap(peers []peer.ID) map[peer.ID]struct{} { - pmap := make(map[peer.ID]struct{}) - for _, p := range peers { - pmap[p] = struct{}{} - } - return pmap -} - -func peerMapToList(peers map[peer.ID]struct{}) []peer.ID { - plst := make([]peer.ID, 0, len(peers)) - for p := range peers { - plst = append(plst, p) - } - return plst -} - -func shufflePeers(peers []peer.ID) { - for i := range peers { - j := rand.Intn(i + 1) - peers[i], peers[j] = peers[j], peers[i] - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/mcache.go b/vendor/github.com/libp2p/go-libp2p-pubsub/mcache.go deleted file mode 100644 index 827987aa..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/mcache.go +++ /dev/null @@ -1,61 +0,0 @@ -package pubsub - -import ( - pb "github.com/libp2p/go-libp2p-pubsub/pb" -) - -func NewMessageCache(gossip, history int) *MessageCache { - return &MessageCache{ - msgs: make(map[string]*pb.Message), - history: make([][]CacheEntry, history), - gossip: gossip, - } -} - -type MessageCache struct { - msgs map[string]*pb.Message - history [][]CacheEntry - gossip int -} - -type CacheEntry struct { - mid string - topics []string -} - -func (mc *MessageCache) Put(msg *pb.Message) { - mid := msgID(msg) - mc.msgs[mid] = msg - mc.history[0] = append(mc.history[0], CacheEntry{mid: mid, topics: msg.GetTopicIDs()}) -} - -func (mc *MessageCache) Get(mid string) (*pb.Message, bool) { - m, ok := mc.msgs[mid] - return m, ok -} - -func (mc *MessageCache) GetGossipIDs(topic string) []string { - var mids []string - for _, entries := range mc.history[:mc.gossip] { - for _, entry := range entries { - for _, t := range entry.topics { - if t == topic { - mids = append(mids, entry.mid) - break - } - } - } - } - return mids -} - -func (mc *MessageCache) Shift() { - last := mc.history[len(mc.history)-1] - for _, entry := range last { - delete(mc.msgs, entry.mid) - } - for i := len(mc.history) - 2; i >= 0; i-- { - mc.history[i+1] = mc.history[i] - } - mc.history[0] = nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/notify.go b/vendor/github.com/libp2p/go-libp2p-pubsub/notify.go deleted file mode 100644 index 1067cb4e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/notify.go +++ /dev/null @@ -1,34 +0,0 @@ -package pubsub - -import ( - "github.com/libp2p/go-libp2p-core/network" - ma "github.com/multiformats/go-multiaddr" -) - -var _ network.Notifiee = (*PubSubNotif)(nil) - -type PubSubNotif PubSub - -func (p *PubSubNotif) OpenedStream(n network.Network, s network.Stream) { -} - -func (p *PubSubNotif) ClosedStream(n network.Network, s network.Stream) { -} - -func (p *PubSubNotif) Connected(n network.Network, c network.Conn) { - go func() { - select { - case p.newPeers <- c.RemotePeer(): - case <-p.ctx.Done(): - } - }() -} - -func (p *PubSubNotif) Disconnected(n network.Network, c network.Conn) { -} - -func (p *PubSubNotif) Listen(n network.Network, _ ma.Multiaddr) { -} - -func (p *PubSubNotif) ListenClose(n network.Network, _ ma.Multiaddr) { -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-pubsub/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.pb.go b/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.pb.go deleted file mode 100644 index 12bc805c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.pb.go +++ /dev/null @@ -1,3141 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rpc.proto - -package pubsub_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type TopicDescriptor_AuthOpts_AuthMode int32 - -const ( - TopicDescriptor_AuthOpts_NONE TopicDescriptor_AuthOpts_AuthMode = 0 - TopicDescriptor_AuthOpts_KEY TopicDescriptor_AuthOpts_AuthMode = 1 - TopicDescriptor_AuthOpts_WOT TopicDescriptor_AuthOpts_AuthMode = 2 -) - -var TopicDescriptor_AuthOpts_AuthMode_name = map[int32]string{ - 0: "NONE", - 1: "KEY", - 2: "WOT", -} - -var TopicDescriptor_AuthOpts_AuthMode_value = map[string]int32{ - "NONE": 0, - "KEY": 1, - "WOT": 2, -} - -func (x TopicDescriptor_AuthOpts_AuthMode) Enum() *TopicDescriptor_AuthOpts_AuthMode { - p := new(TopicDescriptor_AuthOpts_AuthMode) - *p = x - return p -} - -func (x TopicDescriptor_AuthOpts_AuthMode) String() string { - return proto.EnumName(TopicDescriptor_AuthOpts_AuthMode_name, int32(x)) -} - -func (x *TopicDescriptor_AuthOpts_AuthMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(TopicDescriptor_AuthOpts_AuthMode_value, data, "TopicDescriptor_AuthOpts_AuthMode") - if err != nil { - return err - } - *x = TopicDescriptor_AuthOpts_AuthMode(value) - return nil -} - -func (TopicDescriptor_AuthOpts_AuthMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7, 0, 0} -} - -type TopicDescriptor_EncOpts_EncMode int32 - -const ( - TopicDescriptor_EncOpts_NONE TopicDescriptor_EncOpts_EncMode = 0 - TopicDescriptor_EncOpts_SHAREDKEY TopicDescriptor_EncOpts_EncMode = 1 - TopicDescriptor_EncOpts_WOT TopicDescriptor_EncOpts_EncMode = 2 -) - -var TopicDescriptor_EncOpts_EncMode_name = map[int32]string{ - 0: "NONE", - 1: "SHAREDKEY", - 2: "WOT", -} - -var TopicDescriptor_EncOpts_EncMode_value = map[string]int32{ - "NONE": 0, - "SHAREDKEY": 1, - "WOT": 2, -} - -func (x TopicDescriptor_EncOpts_EncMode) Enum() *TopicDescriptor_EncOpts_EncMode { - p := new(TopicDescriptor_EncOpts_EncMode) - *p = x - return p -} - -func (x TopicDescriptor_EncOpts_EncMode) String() string { - return proto.EnumName(TopicDescriptor_EncOpts_EncMode_name, int32(x)) -} - -func (x *TopicDescriptor_EncOpts_EncMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(TopicDescriptor_EncOpts_EncMode_value, data, "TopicDescriptor_EncOpts_EncMode") - if err != nil { - return err - } - *x = TopicDescriptor_EncOpts_EncMode(value) - return nil -} - -func (TopicDescriptor_EncOpts_EncMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7, 1, 0} -} - -type RPC struct { - Subscriptions []*RPC_SubOpts `protobuf:"bytes,1,rep,name=subscriptions" json:"subscriptions,omitempty"` - Publish []*Message `protobuf:"bytes,2,rep,name=publish" json:"publish,omitempty"` - Control *ControlMessage `protobuf:"bytes,3,opt,name=control" json:"control,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RPC) Reset() { *m = RPC{} } -func (m *RPC) String() string { return proto.CompactTextString(m) } -func (*RPC) ProtoMessage() {} -func (*RPC) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{0} -} -func (m *RPC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RPC.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RPC) XXX_Merge(src proto.Message) { - xxx_messageInfo_RPC.Merge(m, src) -} -func (m *RPC) XXX_Size() int { - return m.Size() -} -func (m *RPC) XXX_DiscardUnknown() { - xxx_messageInfo_RPC.DiscardUnknown(m) -} - -var xxx_messageInfo_RPC proto.InternalMessageInfo - -func (m *RPC) GetSubscriptions() []*RPC_SubOpts { - if m != nil { - return m.Subscriptions - } - return nil -} - -func (m *RPC) GetPublish() []*Message { - if m != nil { - return m.Publish - } - return nil -} - -func (m *RPC) GetControl() *ControlMessage { - if m != nil { - return m.Control - } - return nil -} - -type RPC_SubOpts struct { - Subscribe *bool `protobuf:"varint,1,opt,name=subscribe" json:"subscribe,omitempty"` - Topicid *string `protobuf:"bytes,2,opt,name=topicid" json:"topicid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RPC_SubOpts) Reset() { *m = RPC_SubOpts{} } -func (m *RPC_SubOpts) String() string { return proto.CompactTextString(m) } -func (*RPC_SubOpts) ProtoMessage() {} -func (*RPC_SubOpts) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{0, 0} -} -func (m *RPC_SubOpts) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RPC_SubOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RPC_SubOpts.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RPC_SubOpts) XXX_Merge(src proto.Message) { - xxx_messageInfo_RPC_SubOpts.Merge(m, src) -} -func (m *RPC_SubOpts) XXX_Size() int { - return m.Size() -} -func (m *RPC_SubOpts) XXX_DiscardUnknown() { - xxx_messageInfo_RPC_SubOpts.DiscardUnknown(m) -} - -var xxx_messageInfo_RPC_SubOpts proto.InternalMessageInfo - -func (m *RPC_SubOpts) GetSubscribe() bool { - if m != nil && m.Subscribe != nil { - return *m.Subscribe - } - return false -} - -func (m *RPC_SubOpts) GetTopicid() string { - if m != nil && m.Topicid != nil { - return *m.Topicid - } - return "" -} - -type Message struct { - From []byte `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` - Seqno []byte `protobuf:"bytes,3,opt,name=seqno" json:"seqno,omitempty"` - TopicIDs []string `protobuf:"bytes,4,rep,name=topicIDs" json:"topicIDs,omitempty"` - Signature []byte `protobuf:"bytes,5,opt,name=signature" json:"signature,omitempty"` - Key []byte `protobuf:"bytes,6,opt,name=key" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{1} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetFrom() []byte { - if m != nil { - return m.From - } - return nil -} - -func (m *Message) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *Message) GetSeqno() []byte { - if m != nil { - return m.Seqno - } - return nil -} - -func (m *Message) GetTopicIDs() []string { - if m != nil { - return m.TopicIDs - } - return nil -} - -func (m *Message) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *Message) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type ControlMessage struct { - Ihave []*ControlIHave `protobuf:"bytes,1,rep,name=ihave" json:"ihave,omitempty"` - Iwant []*ControlIWant `protobuf:"bytes,2,rep,name=iwant" json:"iwant,omitempty"` - Graft []*ControlGraft `protobuf:"bytes,3,rep,name=graft" json:"graft,omitempty"` - Prune []*ControlPrune `protobuf:"bytes,4,rep,name=prune" json:"prune,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlMessage) Reset() { *m = ControlMessage{} } -func (m *ControlMessage) String() string { return proto.CompactTextString(m) } -func (*ControlMessage) ProtoMessage() {} -func (*ControlMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{2} -} -func (m *ControlMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControlMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControlMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ControlMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlMessage.Merge(m, src) -} -func (m *ControlMessage) XXX_Size() int { - return m.Size() -} -func (m *ControlMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ControlMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlMessage proto.InternalMessageInfo - -func (m *ControlMessage) GetIhave() []*ControlIHave { - if m != nil { - return m.Ihave - } - return nil -} - -func (m *ControlMessage) GetIwant() []*ControlIWant { - if m != nil { - return m.Iwant - } - return nil -} - -func (m *ControlMessage) GetGraft() []*ControlGraft { - if m != nil { - return m.Graft - } - return nil -} - -func (m *ControlMessage) GetPrune() []*ControlPrune { - if m != nil { - return m.Prune - } - return nil -} - -type ControlIHave struct { - TopicID *string `protobuf:"bytes,1,opt,name=topicID" json:"topicID,omitempty"` - MessageIDs []string `protobuf:"bytes,2,rep,name=messageIDs" json:"messageIDs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlIHave) Reset() { *m = ControlIHave{} } -func (m *ControlIHave) String() string { return proto.CompactTextString(m) } -func (*ControlIHave) ProtoMessage() {} -func (*ControlIHave) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{3} -} -func (m *ControlIHave) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControlIHave) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControlIHave.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ControlIHave) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlIHave.Merge(m, src) -} -func (m *ControlIHave) XXX_Size() int { - return m.Size() -} -func (m *ControlIHave) XXX_DiscardUnknown() { - xxx_messageInfo_ControlIHave.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlIHave proto.InternalMessageInfo - -func (m *ControlIHave) GetTopicID() string { - if m != nil && m.TopicID != nil { - return *m.TopicID - } - return "" -} - -func (m *ControlIHave) GetMessageIDs() []string { - if m != nil { - return m.MessageIDs - } - return nil -} - -type ControlIWant struct { - MessageIDs []string `protobuf:"bytes,1,rep,name=messageIDs" json:"messageIDs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlIWant) Reset() { *m = ControlIWant{} } -func (m *ControlIWant) String() string { return proto.CompactTextString(m) } -func (*ControlIWant) ProtoMessage() {} -func (*ControlIWant) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{4} -} -func (m *ControlIWant) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControlIWant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControlIWant.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ControlIWant) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlIWant.Merge(m, src) -} -func (m *ControlIWant) XXX_Size() int { - return m.Size() -} -func (m *ControlIWant) XXX_DiscardUnknown() { - xxx_messageInfo_ControlIWant.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlIWant proto.InternalMessageInfo - -func (m *ControlIWant) GetMessageIDs() []string { - if m != nil { - return m.MessageIDs - } - return nil -} - -type ControlGraft struct { - TopicID *string `protobuf:"bytes,1,opt,name=topicID" json:"topicID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlGraft) Reset() { *m = ControlGraft{} } -func (m *ControlGraft) String() string { return proto.CompactTextString(m) } -func (*ControlGraft) ProtoMessage() {} -func (*ControlGraft) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{5} -} -func (m *ControlGraft) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControlGraft) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControlGraft.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ControlGraft) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlGraft.Merge(m, src) -} -func (m *ControlGraft) XXX_Size() int { - return m.Size() -} -func (m *ControlGraft) XXX_DiscardUnknown() { - xxx_messageInfo_ControlGraft.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlGraft proto.InternalMessageInfo - -func (m *ControlGraft) GetTopicID() string { - if m != nil && m.TopicID != nil { - return *m.TopicID - } - return "" -} - -type ControlPrune struct { - TopicID *string `protobuf:"bytes,1,opt,name=topicID" json:"topicID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlPrune) Reset() { *m = ControlPrune{} } -func (m *ControlPrune) String() string { return proto.CompactTextString(m) } -func (*ControlPrune) ProtoMessage() {} -func (*ControlPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{6} -} -func (m *ControlPrune) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ControlPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ControlPrune.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ControlPrune) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlPrune.Merge(m, src) -} -func (m *ControlPrune) XXX_Size() int { - return m.Size() -} -func (m *ControlPrune) XXX_DiscardUnknown() { - xxx_messageInfo_ControlPrune.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlPrune proto.InternalMessageInfo - -func (m *ControlPrune) GetTopicID() string { - if m != nil && m.TopicID != nil { - return *m.TopicID - } - return "" -} - -type TopicDescriptor struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Auth *TopicDescriptor_AuthOpts `protobuf:"bytes,2,opt,name=auth" json:"auth,omitempty"` - Enc *TopicDescriptor_EncOpts `protobuf:"bytes,3,opt,name=enc" json:"enc,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TopicDescriptor) Reset() { *m = TopicDescriptor{} } -func (m *TopicDescriptor) String() string { return proto.CompactTextString(m) } -func (*TopicDescriptor) ProtoMessage() {} -func (*TopicDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7} -} -func (m *TopicDescriptor) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TopicDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TopicDescriptor.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TopicDescriptor) XXX_Merge(src proto.Message) { - xxx_messageInfo_TopicDescriptor.Merge(m, src) -} -func (m *TopicDescriptor) XXX_Size() int { - return m.Size() -} -func (m *TopicDescriptor) XXX_DiscardUnknown() { - xxx_messageInfo_TopicDescriptor.DiscardUnknown(m) -} - -var xxx_messageInfo_TopicDescriptor proto.InternalMessageInfo - -func (m *TopicDescriptor) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *TopicDescriptor) GetAuth() *TopicDescriptor_AuthOpts { - if m != nil { - return m.Auth - } - return nil -} - -func (m *TopicDescriptor) GetEnc() *TopicDescriptor_EncOpts { - if m != nil { - return m.Enc - } - return nil -} - -type TopicDescriptor_AuthOpts struct { - Mode *TopicDescriptor_AuthOpts_AuthMode `protobuf:"varint,1,opt,name=mode,enum=pubsub.pb.TopicDescriptor_AuthOpts_AuthMode" json:"mode,omitempty"` - Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TopicDescriptor_AuthOpts) Reset() { *m = TopicDescriptor_AuthOpts{} } -func (m *TopicDescriptor_AuthOpts) String() string { return proto.CompactTextString(m) } -func (*TopicDescriptor_AuthOpts) ProtoMessage() {} -func (*TopicDescriptor_AuthOpts) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7, 0} -} -func (m *TopicDescriptor_AuthOpts) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TopicDescriptor_AuthOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TopicDescriptor_AuthOpts.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TopicDescriptor_AuthOpts) XXX_Merge(src proto.Message) { - xxx_messageInfo_TopicDescriptor_AuthOpts.Merge(m, src) -} -func (m *TopicDescriptor_AuthOpts) XXX_Size() int { - return m.Size() -} -func (m *TopicDescriptor_AuthOpts) XXX_DiscardUnknown() { - xxx_messageInfo_TopicDescriptor_AuthOpts.DiscardUnknown(m) -} - -var xxx_messageInfo_TopicDescriptor_AuthOpts proto.InternalMessageInfo - -func (m *TopicDescriptor_AuthOpts) GetMode() TopicDescriptor_AuthOpts_AuthMode { - if m != nil && m.Mode != nil { - return *m.Mode - } - return TopicDescriptor_AuthOpts_NONE -} - -func (m *TopicDescriptor_AuthOpts) GetKeys() [][]byte { - if m != nil { - return m.Keys - } - return nil -} - -type TopicDescriptor_EncOpts struct { - Mode *TopicDescriptor_EncOpts_EncMode `protobuf:"varint,1,opt,name=mode,enum=pubsub.pb.TopicDescriptor_EncOpts_EncMode" json:"mode,omitempty"` - KeyHashes [][]byte `protobuf:"bytes,2,rep,name=keyHashes" json:"keyHashes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TopicDescriptor_EncOpts) Reset() { *m = TopicDescriptor_EncOpts{} } -func (m *TopicDescriptor_EncOpts) String() string { return proto.CompactTextString(m) } -func (*TopicDescriptor_EncOpts) ProtoMessage() {} -func (*TopicDescriptor_EncOpts) Descriptor() ([]byte, []int) { - return fileDescriptor_77a6da22d6a3feb1, []int{7, 1} -} -func (m *TopicDescriptor_EncOpts) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TopicDescriptor_EncOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TopicDescriptor_EncOpts.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TopicDescriptor_EncOpts) XXX_Merge(src proto.Message) { - xxx_messageInfo_TopicDescriptor_EncOpts.Merge(m, src) -} -func (m *TopicDescriptor_EncOpts) XXX_Size() int { - return m.Size() -} -func (m *TopicDescriptor_EncOpts) XXX_DiscardUnknown() { - xxx_messageInfo_TopicDescriptor_EncOpts.DiscardUnknown(m) -} - -var xxx_messageInfo_TopicDescriptor_EncOpts proto.InternalMessageInfo - -func (m *TopicDescriptor_EncOpts) GetMode() TopicDescriptor_EncOpts_EncMode { - if m != nil && m.Mode != nil { - return *m.Mode - } - return TopicDescriptor_EncOpts_NONE -} - -func (m *TopicDescriptor_EncOpts) GetKeyHashes() [][]byte { - if m != nil { - return m.KeyHashes - } - return nil -} - -func init() { - proto.RegisterEnum("pubsub.pb.TopicDescriptor_AuthOpts_AuthMode", TopicDescriptor_AuthOpts_AuthMode_name, TopicDescriptor_AuthOpts_AuthMode_value) - proto.RegisterEnum("pubsub.pb.TopicDescriptor_EncOpts_EncMode", TopicDescriptor_EncOpts_EncMode_name, TopicDescriptor_EncOpts_EncMode_value) - proto.RegisterType((*RPC)(nil), "pubsub.pb.RPC") - proto.RegisterType((*RPC_SubOpts)(nil), "pubsub.pb.RPC.SubOpts") - proto.RegisterType((*Message)(nil), "pubsub.pb.Message") - proto.RegisterType((*ControlMessage)(nil), "pubsub.pb.ControlMessage") - proto.RegisterType((*ControlIHave)(nil), "pubsub.pb.ControlIHave") - proto.RegisterType((*ControlIWant)(nil), "pubsub.pb.ControlIWant") - proto.RegisterType((*ControlGraft)(nil), "pubsub.pb.ControlGraft") - proto.RegisterType((*ControlPrune)(nil), "pubsub.pb.ControlPrune") - proto.RegisterType((*TopicDescriptor)(nil), "pubsub.pb.TopicDescriptor") - proto.RegisterType((*TopicDescriptor_AuthOpts)(nil), "pubsub.pb.TopicDescriptor.AuthOpts") - proto.RegisterType((*TopicDescriptor_EncOpts)(nil), "pubsub.pb.TopicDescriptor.EncOpts") -} - -func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } - -var fileDescriptor_77a6da22d6a3feb1 = []byte{ - // 599 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xd9, 0x38, 0xc5, 0xf1, 0xd4, 0x2d, 0xd1, 0x0a, 0x81, 0x89, 0xaa, 0x28, 0x32, 0x12, - 0xb2, 0xa0, 0xf8, 0x10, 0x90, 0xb8, 0x20, 0x44, 0x69, 0x22, 0x12, 0xa1, 0x7e, 0x68, 0x5b, 0xa9, - 0xe2, 0xb8, 0x76, 0xb6, 0x89, 0x95, 0xc6, 0x36, 0xf6, 0xba, 0x28, 0x6f, 0xc0, 0x1d, 0x9e, 0x85, - 0x67, 0xe0, 0xc0, 0x81, 0x47, 0x40, 0xb9, 0xf1, 0x16, 0x68, 0xc7, 0x4e, 0xe2, 0xa4, 0x1f, 0x70, - 0xf2, 0xec, 0xec, 0xef, 0xbf, 0xf3, 0x9f, 0xd9, 0x35, 0x18, 0x49, 0xec, 0xbb, 0x71, 0x12, 0xc9, - 0x88, 0x1a, 0x71, 0xe6, 0xa5, 0x99, 0xe7, 0xc6, 0x9e, 0xfd, 0x87, 0x80, 0xc6, 0x8e, 0xf7, 0xe9, - 0x6b, 0xd8, 0x4a, 0x33, 0x2f, 0xf5, 0x93, 0x20, 0x96, 0x41, 0x14, 0xa6, 0x16, 0x69, 0x69, 0xce, - 0x66, 0xfb, 0x81, 0xbb, 0x40, 0x5d, 0x76, 0xbc, 0xef, 0x9e, 0x64, 0xde, 0x51, 0x2c, 0x53, 0xb6, - 0x0a, 0xd3, 0x5d, 0xd0, 0xe3, 0xcc, 0xbb, 0x08, 0xd2, 0x91, 0x55, 0x41, 0x1d, 0x2d, 0xe9, 0x0e, - 0x44, 0x9a, 0xf2, 0xa1, 0x60, 0x73, 0x84, 0xbe, 0x00, 0xdd, 0x8f, 0x42, 0x99, 0x44, 0x17, 0x96, - 0xd6, 0x22, 0xce, 0x66, 0xfb, 0x51, 0x89, 0xde, 0xcf, 0x77, 0x16, 0xa2, 0x82, 0x6c, 0xec, 0x81, - 0x5e, 0x14, 0xa7, 0x3b, 0x60, 0x14, 0xe5, 0x3d, 0x61, 0x91, 0x16, 0x71, 0x6a, 0x6c, 0x99, 0xa0, - 0x16, 0xe8, 0x32, 0x8a, 0x03, 0x3f, 0x18, 0x58, 0x95, 0x16, 0x71, 0x0c, 0x36, 0x5f, 0xda, 0x5f, - 0x09, 0xe8, 0xc5, 0xb9, 0x94, 0x42, 0xf5, 0x3c, 0x89, 0x26, 0x28, 0x37, 0x19, 0xc6, 0x2a, 0x37, - 0xe0, 0x92, 0xa3, 0xcc, 0x64, 0x18, 0xd3, 0xfb, 0xb0, 0x91, 0x8a, 0x4f, 0x61, 0x84, 0x4e, 0x4d, - 0x96, 0x2f, 0x68, 0x03, 0x6a, 0x78, 0x68, 0xbf, 0x93, 0x5a, 0xd5, 0x96, 0xe6, 0x18, 0x6c, 0xb1, - 0x46, 0x77, 0xc1, 0x30, 0xe4, 0x32, 0x4b, 0x84, 0xb5, 0x81, 0xaa, 0x65, 0x82, 0xd6, 0x41, 0x1b, - 0x8b, 0xa9, 0x75, 0x17, 0xf3, 0x2a, 0xb4, 0x7f, 0x12, 0xd8, 0x5e, 0x6d, 0x9a, 0x3e, 0x87, 0x8d, - 0x60, 0xc4, 0x2f, 0x45, 0x71, 0x09, 0x0f, 0xaf, 0x8e, 0xa7, 0xdf, 0xe3, 0x97, 0x82, 0xe5, 0x14, - 0xe2, 0x9f, 0x79, 0x28, 0x8b, 0xd9, 0x5f, 0x87, 0x9f, 0xf1, 0x50, 0xb2, 0x9c, 0x52, 0xf8, 0x30, - 0xe1, 0xe7, 0xd2, 0xd2, 0x6e, 0xc2, 0xdf, 0xab, 0x6d, 0x96, 0x53, 0x0a, 0x8f, 0x93, 0x2c, 0x14, - 0xd8, 0xe8, 0xb5, 0xf8, 0xb1, 0xda, 0x66, 0x39, 0x65, 0xf7, 0xc0, 0x2c, 0x7b, 0x5c, 0x5c, 0x47, - 0xbf, 0x83, 0xb3, 0x9e, 0x5f, 0x47, 0xbf, 0x43, 0x9b, 0x00, 0x93, 0xbc, 0x61, 0x35, 0xc6, 0x0a, - 0x8e, 0xb1, 0x94, 0xb1, 0xdd, 0xe5, 0x49, 0xca, 0xfe, 0x1a, 0x4f, 0xae, 0xf0, 0xce, 0x82, 0x47, - 0xff, 0x37, 0x57, 0x2e, 0x91, 0x68, 0xfd, 0x16, 0xf2, 0xbb, 0x06, 0xf7, 0x4e, 0x55, 0xdc, 0x11, - 0xf9, 0x73, 0x8f, 0x12, 0xf5, 0x4c, 0x42, 0x3e, 0x11, 0x05, 0x8a, 0x31, 0x7d, 0x05, 0x55, 0x9e, - 0xc9, 0x11, 0x3e, 0x9d, 0xcd, 0xf6, 0xe3, 0xd2, 0x8c, 0xd6, 0xd4, 0xee, 0x5e, 0x26, 0x47, 0xf8, - 0x0b, 0xa1, 0x80, 0xbe, 0x04, 0x4d, 0x84, 0x7e, 0xf1, 0x1f, 0xd8, 0xb7, 0xe8, 0xba, 0xa1, 0x8f, - 0x32, 0x85, 0x37, 0xbe, 0x10, 0xa8, 0xcd, 0x0f, 0xa2, 0x6f, 0xa1, 0x3a, 0x89, 0x06, 0xb9, 0x9f, - 0xed, 0xf6, 0xee, 0x7f, 0xd4, 0xc6, 0xe0, 0x20, 0x1a, 0x08, 0x86, 0x4a, 0xd5, 0xd1, 0x58, 0x4c, - 0xf3, 0x3b, 0x30, 0x19, 0xc6, 0xf6, 0x93, 0xbc, 0x82, 0xa2, 0x68, 0x0d, 0xaa, 0x87, 0x47, 0x87, - 0xdd, 0xfa, 0x1d, 0xaa, 0x83, 0xf6, 0xa1, 0xfb, 0xb1, 0x4e, 0x54, 0x70, 0x76, 0x74, 0x5a, 0xaf, - 0x34, 0xbe, 0x11, 0xd0, 0x0b, 0x6f, 0xf4, 0xcd, 0x8a, 0x93, 0xa7, 0xff, 0xee, 0x46, 0x7d, 0x4b, - 0x3e, 0x76, 0xc0, 0x18, 0x8b, 0x69, 0x8f, 0xa7, 0x23, 0x31, 0x37, 0xb3, 0x4c, 0xd8, 0xcf, 0xb0, - 0xd0, 0x9a, 0xa1, 0x2d, 0x30, 0x4e, 0x7a, 0x7b, 0xac, 0xdb, 0x59, 0xb5, 0xf5, 0xce, 0xfc, 0x31, - 0x6b, 0x92, 0x5f, 0xb3, 0x26, 0xf9, 0x3d, 0x6b, 0x92, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf8, - 0xb0, 0xae, 0x4e, 0xfc, 0x04, 0x00, 0x00, -} - -func (m *RPC) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RPC) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Subscriptions) > 0 { - for _, msg := range m.Subscriptions { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Publish) > 0 { - for _, msg := range m.Publish { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Control != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Control.Size())) - n1, err := m.Control.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RPC_SubOpts) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RPC_SubOpts) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Subscribe != nil { - dAtA[i] = 0x8 - i++ - if *m.Subscribe { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.Topicid != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(*m.Topicid))) - i += copy(dAtA[i:], *m.Topicid) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.From != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.From))) - i += copy(dAtA[i:], m.From) - } - if m.Data != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.Seqno != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Seqno))) - i += copy(dAtA[i:], m.Seqno) - } - if len(m.TopicIDs) > 0 { - for _, s := range m.TopicIDs { - dAtA[i] = 0x22 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.Signature != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - if m.Key != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ControlMessage) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ControlMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Ihave) > 0 { - for _, msg := range m.Ihave { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Iwant) > 0 { - for _, msg := range m.Iwant { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Graft) > 0 { - for _, msg := range m.Graft { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Prune) > 0 { - for _, msg := range m.Prune { - dAtA[i] = 0x22 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ControlIHave) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ControlIHave) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.TopicID != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(*m.TopicID))) - i += copy(dAtA[i:], *m.TopicID) - } - if len(m.MessageIDs) > 0 { - for _, s := range m.MessageIDs { - dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ControlIWant) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ControlIWant) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.MessageIDs) > 0 { - for _, s := range m.MessageIDs { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ControlGraft) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ControlGraft) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.TopicID != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(*m.TopicID))) - i += copy(dAtA[i:], *m.TopicID) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ControlPrune) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ControlPrune) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.TopicID != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(*m.TopicID))) - i += copy(dAtA[i:], *m.TopicID) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TopicDescriptor) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TopicDescriptor) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Name != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(*m.Name))) - i += copy(dAtA[i:], *m.Name) - } - if m.Auth != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Auth.Size())) - n2, err := m.Auth.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Enc != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Enc.Size())) - n3, err := m.Enc.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TopicDescriptor_AuthOpts) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TopicDescriptor_AuthOpts) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Mode != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(*m.Mode)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TopicDescriptor_EncOpts) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TopicDescriptor_EncOpts) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Mode != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(*m.Mode)) - } - if len(m.KeyHashes) > 0 { - for _, b := range m.KeyHashes { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *RPC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Subscriptions) > 0 { - for _, e := range m.Subscriptions { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Publish) > 0 { - for _, e := range m.Publish { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.Control != nil { - l = m.Control.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RPC_SubOpts) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Subscribe != nil { - n += 2 - } - if m.Topicid != nil { - l = len(*m.Topicid) - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.From != nil { - l = len(m.From) - n += 1 + l + sovRpc(uint64(l)) - } - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovRpc(uint64(l)) - } - if m.Seqno != nil { - l = len(m.Seqno) - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.TopicIDs) > 0 { - for _, s := range m.TopicIDs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.Signature != nil { - l = len(m.Signature) - n += 1 + l + sovRpc(uint64(l)) - } - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControlMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Ihave) > 0 { - for _, e := range m.Ihave { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Iwant) > 0 { - for _, e := range m.Iwant { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Graft) > 0 { - for _, e := range m.Graft { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if len(m.Prune) > 0 { - for _, e := range m.Prune { - l = e.Size() - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControlIHave) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TopicID != nil { - l = len(*m.TopicID) - n += 1 + l + sovRpc(uint64(l)) - } - if len(m.MessageIDs) > 0 { - for _, s := range m.MessageIDs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControlIWant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MessageIDs) > 0 { - for _, s := range m.MessageIDs { - l = len(s) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControlGraft) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TopicID != nil { - l = len(*m.TopicID) - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ControlPrune) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TopicID != nil { - l = len(*m.TopicID) - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TopicDescriptor) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Name != nil { - l = len(*m.Name) - n += 1 + l + sovRpc(uint64(l)) - } - if m.Auth != nil { - l = m.Auth.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.Enc != nil { - l = m.Enc.Size() - n += 1 + l + sovRpc(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TopicDescriptor_AuthOpts) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != nil { - n += 1 + sovRpc(uint64(*m.Mode)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TopicDescriptor_EncOpts) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != nil { - n += 1 + sovRpc(uint64(*m.Mode)) - } - if len(m.KeyHashes) > 0 { - for _, b := range m.KeyHashes { - l = len(b) - n += 1 + l + sovRpc(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovRpc(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozRpc(x uint64) (n int) { - return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RPC) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RPC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RPC: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscriptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subscriptions = append(m.Subscriptions, &RPC_SubOpts{}) - if err := m.Subscriptions[len(m.Subscriptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Publish", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Publish = append(m.Publish, &Message{}) - if err := m.Publish[len(m.Publish)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Control", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Control == nil { - m.Control = &ControlMessage{} - } - if err := m.Control.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RPC_SubOpts) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscribe", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Subscribe = &b - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topicid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Topicid = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = append(m.From[:0], dAtA[iNdEx:postIndex]...) - if m.From == nil { - m.From = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Seqno", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Seqno = append(m.Seqno[:0], dAtA[iNdEx:postIndex]...) - if m.Seqno == nil { - m.Seqno = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TopicIDs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TopicIDs = append(m.TopicIDs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ControlMessage) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ControlMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControlMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ihave", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ihave = append(m.Ihave, &ControlIHave{}) - if err := m.Ihave[len(m.Ihave)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Iwant", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Iwant = append(m.Iwant, &ControlIWant{}) - if err := m.Iwant[len(m.Iwant)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Graft", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Graft = append(m.Graft, &ControlGraft{}) - if err := m.Graft[len(m.Graft)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prune", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prune = append(m.Prune, &ControlPrune{}) - if err := m.Prune[len(m.Prune)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ControlIHave) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ControlIHave: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControlIHave: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TopicID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.TopicID = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageIDs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MessageIDs = append(m.MessageIDs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ControlIWant) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ControlIWant: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControlIWant: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageIDs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MessageIDs = append(m.MessageIDs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ControlGraft) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ControlGraft: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControlGraft: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TopicID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.TopicID = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ControlPrune) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ControlPrune: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ControlPrune: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TopicID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.TopicID = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TopicDescriptor) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TopicDescriptor: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TopicDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Name = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Auth", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Auth == nil { - m.Auth = &TopicDescriptor_AuthOpts{} - } - if err := m.Auth.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Enc", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Enc == nil { - m.Enc = &TopicDescriptor_EncOpts{} - } - if err := m.Enc.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TopicDescriptor_AuthOpts) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AuthOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - var v TopicDescriptor_AuthOpts_AuthMode - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= TopicDescriptor_AuthOpts_AuthMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Mode = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TopicDescriptor_EncOpts) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EncOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EncOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - var v TopicDescriptor_EncOpts_EncMode - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= TopicDescriptor_EncOpts_EncMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Mode = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyHashes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRpc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRpc - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRpc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeyHashes = append(m.KeyHashes, make([]byte, postIndex-iNdEx)) - copy(m.KeyHashes[len(m.KeyHashes)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRpc(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRpc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRpc(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRpc - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRpc - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRpc - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRpc(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRpc - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.proto b/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.proto deleted file mode 100644 index 4a058288..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/pb/rpc.proto +++ /dev/null @@ -1,76 +0,0 @@ -syntax = "proto2"; - -package pubsub.pb; - -message RPC { - repeated SubOpts subscriptions = 1; - repeated Message publish = 2; - - message SubOpts { - optional bool subscribe = 1; // subscribe or unsubcribe - optional string topicid = 2; - } - - optional ControlMessage control = 3; -} - -message Message { - optional bytes from = 1; - optional bytes data = 2; - optional bytes seqno = 3; - repeated string topicIDs = 4; - optional bytes signature = 5; - optional bytes key = 6; -} - -message ControlMessage { - repeated ControlIHave ihave = 1; - repeated ControlIWant iwant = 2; - repeated ControlGraft graft = 3; - repeated ControlPrune prune = 4; -} - -message ControlIHave { - optional string topicID = 1; - repeated string messageIDs = 2; -} - -message ControlIWant { - repeated string messageIDs = 1; -} - -message ControlGraft { - optional string topicID = 1; -} - -message ControlPrune { - optional string topicID = 1; -} - -message TopicDescriptor { - optional string name = 1; - optional AuthOpts auth = 2; - optional EncOpts enc = 3; - - message AuthOpts { - optional AuthMode mode = 1; - repeated bytes keys = 2; // root keys to trust - - enum AuthMode { - NONE = 0; // no authentication, anyone can publish - KEY = 1; // only messages signed by keys in the topic descriptor are accepted - WOT = 2; // web of trust, certificates can allow publisher set to grow - } - } - - message EncOpts { - optional EncMode mode = 1; - repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted) - - enum EncMode { - NONE = 0; // no encryption, anyone can read - SHAREDKEY = 1; // messages are encrypted with shared key - WOT = 2; // web of trust, certificates can allow publisher set to grow - } - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/pubsub.go b/vendor/github.com/libp2p/go-libp2p-pubsub/pubsub.go deleted file mode 100644 index 6df169d8..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/pubsub.go +++ /dev/null @@ -1,784 +0,0 @@ -package pubsub - -import ( - "context" - "encoding/binary" - "fmt" - "math/rand" - "sync" - "sync/atomic" - "time" - - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" - - logging "github.com/ipfs/go-log" - timecache "github.com/whyrusleeping/timecache" -) - -var ( - TimeCacheDuration = 120 * time.Second -) - -var log = logging.Logger("pubsub") - -// PubSub is the implementation of the pubsub system. -type PubSub struct { - // atomic counter for seqnos - // NOTE: Must be declared at the top of the struct as we perform atomic - // operations on this field. - // - // See: https://golang.org/pkg/sync/atomic/#pkg-note-BUG - counter uint64 - - host host.Host - - rt PubSubRouter - - val *validation - - // incoming messages from other peers - incoming chan *RPC - - // messages we are publishing out to our peers - publish chan *Message - - // addSub is a control channel for us to add and remove subscriptions - addSub chan *addSubReq - - // get list of topics we are subscribed to - getTopics chan *topicReq - - // get chan of peers we are connected to - getPeers chan *listPeerReq - - // send subscription here to cancel it - cancelCh chan *Subscription - - // a notification channel for new peer connections - newPeers chan peer.ID - - // a notification channel for new outoging peer streams - newPeerStream chan network.Stream - - // a notification channel for errors opening new peer streams - newPeerError chan peer.ID - - // a notification channel for when our peers die - peerDead chan peer.ID - - // The set of topics we are subscribed to - myTopics map[string]map[*Subscription]struct{} - - // topics tracks which topics each of our peers are subscribed to - topics map[string]map[peer.ID]struct{} - - // sendMsg handles messages that have been validated - sendMsg chan *sendReq - - // addVal handles validator registration requests - addVal chan *addValReq - - // rmVal handles validator unregistration requests - rmVal chan *rmValReq - - // eval thunk in event loop - eval chan func() - - // peer blacklist - blacklist Blacklist - blacklistPeer chan peer.ID - - peers map[peer.ID]chan *RPC - - seenMessagesMx sync.Mutex - seenMessages *timecache.TimeCache - - // key for signing messages; nil when signing is disabled (default for now) - signKey crypto.PrivKey - // source ID for signed messages; corresponds to signKey - signID peer.ID - // strict mode rejects all unsigned messages prior to validation - signStrict bool - - ctx context.Context -} - -// PubSubRouter is the message router component of PubSub. -type PubSubRouter interface { - // Protocols returns the list of protocols supported by the router. - Protocols() []protocol.ID - // Attach is invoked by the PubSub constructor to attach the router to a - // freshly initialized PubSub instance. - Attach(*PubSub) - // AddPeer notifies the router that a new peer has been connected. - AddPeer(peer.ID, protocol.ID) - // RemovePeer notifies the router that a peer has been disconnected. - RemovePeer(peer.ID) - // HandleRPC is invoked to process control messages in the RPC envelope. - // It is invoked after subscriptions and payload messages have been processed. - HandleRPC(*RPC) - // Publish is invoked to forward a new message that has been validated. - Publish(peer.ID, *pb.Message) - // Join notifies the router that we want to receive and forward messages in a topic. - // It is invoked after the subscription announcement. - Join(topic string) - // Leave notifies the router that we are no longer interested in a topic. - // It is invoked after the unsubscription announcement. - Leave(topic string) -} - -type Message struct { - *pb.Message -} - -func (m *Message) GetFrom() peer.ID { - return peer.ID(m.Message.GetFrom()) -} - -type RPC struct { - pb.RPC - - // unexported on purpose, not sending this over the wire - from peer.ID -} - -type Option func(*PubSub) error - -// NewPubSub returns a new PubSub management object. -func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option) (*PubSub, error) { - ps := &PubSub{ - host: h, - ctx: ctx, - rt: rt, - val: newValidation(), - signID: h.ID(), - signKey: h.Peerstore().PrivKey(h.ID()), - signStrict: true, - incoming: make(chan *RPC, 32), - publish: make(chan *Message), - newPeers: make(chan peer.ID), - newPeerStream: make(chan network.Stream), - newPeerError: make(chan peer.ID), - peerDead: make(chan peer.ID), - cancelCh: make(chan *Subscription), - getPeers: make(chan *listPeerReq), - addSub: make(chan *addSubReq), - getTopics: make(chan *topicReq), - sendMsg: make(chan *sendReq, 32), - addVal: make(chan *addValReq), - rmVal: make(chan *rmValReq), - eval: make(chan func()), - myTopics: make(map[string]map[*Subscription]struct{}), - topics: make(map[string]map[peer.ID]struct{}), - peers: make(map[peer.ID]chan *RPC), - blacklist: NewMapBlacklist(), - blacklistPeer: make(chan peer.ID), - seenMessages: timecache.NewTimeCache(TimeCacheDuration), - counter: uint64(time.Now().UnixNano()), - } - - for _, opt := range opts { - err := opt(ps) - if err != nil { - return nil, err - } - } - - if ps.signStrict && ps.signKey == nil { - return nil, fmt.Errorf("strict signature verification enabled but message signing is disabled") - } - - rt.Attach(ps) - - for _, id := range rt.Protocols() { - h.SetStreamHandler(id, ps.handleNewStream) - } - h.Network().Notify((*PubSubNotif)(ps)) - - ps.val.Start(ps) - - go ps.processLoop(ctx) - - return ps, nil -} - -// WithMessageSigning enables or disables message signing (enabled by default). -func WithMessageSigning(enabled bool) Option { - return func(p *PubSub) error { - if enabled { - p.signKey = p.host.Peerstore().PrivKey(p.signID) - if p.signKey == nil { - return fmt.Errorf("can't sign for peer %s: no private key", p.signID) - } - } else { - p.signKey = nil - p.signStrict = false - } - return nil - } -} - -// WithMessageAuthor sets the author for outbound messages to the given peer ID -// (defaults to the host's ID). If message signing is enabled, the private key -// must be available in the host's peerstore. -func WithMessageAuthor(author peer.ID) Option { - return func(p *PubSub) error { - if author == "" { - author = p.host.ID() - } - if p.signKey != nil { - newSignKey := p.host.Peerstore().PrivKey(author) - if newSignKey == nil { - return fmt.Errorf("can't sign for peer %s: no private key", p.signID) - } - p.signKey = newSignKey - } - p.signID = author - return nil - } -} - -// WithStrictSignatureVerification is an option to enable or disable strict message signing. -// When enabled (which is the default), unsigned messages will be discarded. -func WithStrictSignatureVerification(required bool) Option { - return func(p *PubSub) error { - p.signStrict = required - return nil - } -} - -// WithBlacklist provides an implementation of the blacklist; the default is a -// MapBlacklist -func WithBlacklist(b Blacklist) Option { - return func(p *PubSub) error { - p.blacklist = b - return nil - } -} - -// processLoop handles all inputs arriving on the channels -func (p *PubSub) processLoop(ctx context.Context) { - defer func() { - // Clean up go routines. - for _, ch := range p.peers { - close(ch) - } - p.peers = nil - p.topics = nil - }() - - for { - select { - case pid := <-p.newPeers: - if _, ok := p.peers[pid]; ok { - log.Warning("already have connection to peer: ", pid) - continue - } - - if p.blacklist.Contains(pid) { - log.Warning("ignoring connection from blacklisted peer: ", pid) - continue - } - - messages := make(chan *RPC, 32) - messages <- p.getHelloPacket() - go p.handleNewPeer(ctx, pid, messages) - p.peers[pid] = messages - - case s := <-p.newPeerStream: - pid := s.Conn().RemotePeer() - - ch, ok := p.peers[pid] - if !ok { - log.Warning("new stream for unknown peer: ", pid) - s.Reset() - continue - } - - if p.blacklist.Contains(pid) { - log.Warning("closing stream for blacklisted peer: ", pid) - close(ch) - s.Reset() - continue - } - - p.rt.AddPeer(pid, s.Protocol()) - - case pid := <-p.newPeerError: - delete(p.peers, pid) - - case pid := <-p.peerDead: - ch, ok := p.peers[pid] - if !ok { - continue - } - - close(ch) - - if p.host.Network().Connectedness(pid) == network.Connected { - // still connected, must be a duplicate connection being closed. - // we respawn the writer as we need to ensure there is a stream active - log.Warning("peer declared dead but still connected; respawning writer: ", pid) - messages := make(chan *RPC, 32) - messages <- p.getHelloPacket() - go p.handleNewPeer(ctx, pid, messages) - p.peers[pid] = messages - continue - } - - delete(p.peers, pid) - for _, t := range p.topics { - delete(t, pid) - } - - p.rt.RemovePeer(pid) - - case treq := <-p.getTopics: - var out []string - for t := range p.myTopics { - out = append(out, t) - } - treq.resp <- out - case sub := <-p.cancelCh: - p.handleRemoveSubscription(sub) - case sub := <-p.addSub: - p.handleAddSubscription(sub) - case preq := <-p.getPeers: - tmap, ok := p.topics[preq.topic] - if preq.topic != "" && !ok { - preq.resp <- nil - continue - } - var peers []peer.ID - for p := range p.peers { - if preq.topic != "" { - _, ok := tmap[p] - if !ok { - continue - } - } - peers = append(peers, p) - } - preq.resp <- peers - case rpc := <-p.incoming: - p.handleIncomingRPC(rpc) - - case msg := <-p.publish: - p.pushMsg(p.host.ID(), msg) - - case req := <-p.sendMsg: - p.publishMessage(req.from, req.msg.Message) - - case req := <-p.addVal: - p.val.AddValidator(req) - - case req := <-p.rmVal: - p.val.RemoveValidator(req) - - case thunk := <-p.eval: - thunk() - - case pid := <-p.blacklistPeer: - log.Infof("Blacklisting peer %s", pid) - p.blacklist.Add(pid) - - ch, ok := p.peers[pid] - if ok { - close(ch) - delete(p.peers, pid) - for _, t := range p.topics { - delete(t, pid) - } - p.rt.RemovePeer(pid) - } - - case <-ctx.Done(): - log.Info("pubsub processloop shutting down") - return - } - } -} - -// handleRemoveSubscription removes Subscription sub from bookeeping. -// If this was the last Subscription for a given topic, it will also announce -// that this node is not subscribing to this topic anymore. -// Only called from processLoop. -func (p *PubSub) handleRemoveSubscription(sub *Subscription) { - subs := p.myTopics[sub.topic] - - if subs == nil { - return - } - - sub.err = fmt.Errorf("subscription cancelled by calling sub.Cancel()") - close(sub.ch) - delete(subs, sub) - - if len(subs) == 0 { - delete(p.myTopics, sub.topic) - p.announce(sub.topic, false) - p.rt.Leave(sub.topic) - } -} - -// handleAddSubscription adds a Subscription for a particular topic. If it is -// the first Subscription for the topic, it will announce that this node -// subscribes to the topic. -// Only called from processLoop. -func (p *PubSub) handleAddSubscription(req *addSubReq) { - sub := req.sub - subs := p.myTopics[sub.topic] - - // announce we want this topic - if len(subs) == 0 { - p.announce(sub.topic, true) - p.rt.Join(sub.topic) - } - - // make new if not there - if subs == nil { - p.myTopics[sub.topic] = make(map[*Subscription]struct{}) - subs = p.myTopics[sub.topic] - } - - sub.ch = make(chan *Message, 32) - sub.cancelCh = p.cancelCh - - p.myTopics[sub.topic][sub] = struct{}{} - - req.resp <- sub -} - -// announce announces whether or not this node is interested in a given topic -// Only called from processLoop. -func (p *PubSub) announce(topic string, sub bool) { - subopt := &pb.RPC_SubOpts{ - Topicid: &topic, - Subscribe: &sub, - } - - out := rpcWithSubs(subopt) - for pid, peer := range p.peers { - select { - case peer <- out: - default: - log.Infof("Can't send announce message to peer %s: queue full; scheduling retry", pid) - go p.announceRetry(pid, topic, sub) - } - } -} - -func (p *PubSub) announceRetry(pid peer.ID, topic string, sub bool) { - time.Sleep(time.Duration(1+rand.Intn(1000)) * time.Millisecond) - - retry := func() { - _, ok := p.myTopics[topic] - if (ok && sub) || (!ok && !sub) { - p.doAnnounceRetry(pid, topic, sub) - } - } - - select { - case p.eval <- retry: - case <-p.ctx.Done(): - } -} - -func (p *PubSub) doAnnounceRetry(pid peer.ID, topic string, sub bool) { - peer, ok := p.peers[pid] - if !ok { - return - } - - subopt := &pb.RPC_SubOpts{ - Topicid: &topic, - Subscribe: &sub, - } - - out := rpcWithSubs(subopt) - select { - case peer <- out: - default: - log.Infof("Can't send announce message to peer %s: queue full; scheduling retry", pid) - go p.announceRetry(pid, topic, sub) - } -} - -// notifySubs sends a given message to all corresponding subscribers. -// Only called from processLoop. -func (p *PubSub) notifySubs(msg *pb.Message) { - for _, topic := range msg.GetTopicIDs() { - subs := p.myTopics[topic] - for f := range subs { - select { - case f.ch <- &Message{msg}: - default: - log.Infof("Can't deliver message to subscription for topic %s; subscriber too slow", topic) - } - } - } -} - -// seenMessage returns whether we already saw this message before -func (p *PubSub) seenMessage(id string) bool { - p.seenMessagesMx.Lock() - defer p.seenMessagesMx.Unlock() - return p.seenMessages.Has(id) -} - -// markSeen marks a message as seen such that seenMessage returns `true' for the given id -// returns true if the message was freshly marked -func (p *PubSub) markSeen(id string) bool { - p.seenMessagesMx.Lock() - defer p.seenMessagesMx.Unlock() - if p.seenMessages.Has(id) { - return false - } - - p.seenMessages.Add(id) - return true -} - -// subscribedToMessage returns whether we are subscribed to one of the topics -// of a given message -func (p *PubSub) subscribedToMsg(msg *pb.Message) bool { - if len(p.myTopics) == 0 { - return false - } - - for _, t := range msg.GetTopicIDs() { - if _, ok := p.myTopics[t]; ok { - return true - } - } - return false -} - -func (p *PubSub) handleIncomingRPC(rpc *RPC) { - for _, subopt := range rpc.GetSubscriptions() { - t := subopt.GetTopicid() - if subopt.GetSubscribe() { - tmap, ok := p.topics[t] - if !ok { - tmap = make(map[peer.ID]struct{}) - p.topics[t] = tmap - } - - tmap[rpc.from] = struct{}{} - } else { - tmap, ok := p.topics[t] - if !ok { - continue - } - delete(tmap, rpc.from) - } - } - - for _, pmsg := range rpc.GetPublish() { - if !p.subscribedToMsg(pmsg) { - log.Warning("received message we didn't subscribe to. Dropping.") - continue - } - - msg := &Message{pmsg} - p.pushMsg(rpc.from, msg) - } - - p.rt.HandleRPC(rpc) -} - -// msgID returns a unique ID of the passed Message -func msgID(pmsg *pb.Message) string { - return string(pmsg.GetFrom()) + string(pmsg.GetSeqno()) -} - -// pushMsg pushes a message performing validation as necessary -func (p *PubSub) pushMsg(src peer.ID, msg *Message) { - // reject messages from blacklisted peers - if p.blacklist.Contains(src) { - log.Warningf("dropping message from blacklisted peer %s", src) - return - } - - // even if they are forwarded by good peers - if p.blacklist.Contains(msg.GetFrom()) { - log.Warningf("dropping message from blacklisted source %s", src) - return - } - - // reject unsigned messages when strict before we even process the id - if p.signStrict && msg.Signature == nil { - log.Debugf("dropping unsigned message from %s", src) - return - } - - // have we already seen and validated this message? - id := msgID(msg.Message) - if p.seenMessage(id) { - return - } - - if !p.val.Push(src, msg) { - return - } - - if p.markSeen(id) { - p.publishMessage(src, msg.Message) - } -} - -func (p *PubSub) publishMessage(from peer.ID, pmsg *pb.Message) { - p.notifySubs(pmsg) - p.rt.Publish(from, pmsg) -} - -type addSubReq struct { - sub *Subscription - resp chan *Subscription -} - -type SubOpt func(sub *Subscription) error - -// Subscribe returns a new Subscription for the given topic. -// Note that subscription is not an instanteneous operation. It may take some time -// before the subscription is processed by the pubsub main loop and propagated to our peers. -func (p *PubSub) Subscribe(topic string, opts ...SubOpt) (*Subscription, error) { - td := pb.TopicDescriptor{Name: &topic} - - return p.SubscribeByTopicDescriptor(&td, opts...) -} - -// SubscribeByTopicDescriptor lets you subscribe a topic using a pb.TopicDescriptor. -func (p *PubSub) SubscribeByTopicDescriptor(td *pb.TopicDescriptor, opts ...SubOpt) (*Subscription, error) { - if td.GetAuth().GetMode() != pb.TopicDescriptor_AuthOpts_NONE { - return nil, fmt.Errorf("auth mode not yet supported") - } - - if td.GetEnc().GetMode() != pb.TopicDescriptor_EncOpts_NONE { - return nil, fmt.Errorf("encryption mode not yet supported") - } - - sub := &Subscription{ - topic: td.GetName(), - } - - for _, opt := range opts { - err := opt(sub) - if err != nil { - return nil, err - } - } - - out := make(chan *Subscription, 1) - p.addSub <- &addSubReq{ - sub: sub, - resp: out, - } - - return <-out, nil -} - -type topicReq struct { - resp chan []string -} - -// GetTopics returns the topics this node is subscribed to. -func (p *PubSub) GetTopics() []string { - out := make(chan []string, 1) - p.getTopics <- &topicReq{resp: out} - return <-out -} - -// Publish publishes data to the given topic. -func (p *PubSub) Publish(topic string, data []byte) error { - seqno := p.nextSeqno() - m := &pb.Message{ - Data: data, - TopicIDs: []string{topic}, - From: []byte(p.host.ID()), - Seqno: seqno, - } - if p.signKey != nil { - m.From = []byte(p.signID) - err := signMessage(p.signID, p.signKey, m) - if err != nil { - return err - } - } - p.publish <- &Message{m} - return nil -} - -func (p *PubSub) nextSeqno() []byte { - seqno := make([]byte, 8) - counter := atomic.AddUint64(&p.counter, 1) - binary.BigEndian.PutUint64(seqno, counter) - return seqno -} - -type listPeerReq struct { - resp chan []peer.ID - topic string -} - -// sendReq is a request to call publishMessage. -// It is issued after message validation is done. -type sendReq struct { - from peer.ID - msg *Message -} - -// ListPeers returns a list of peers we are connected to in the given topic. -func (p *PubSub) ListPeers(topic string) []peer.ID { - out := make(chan []peer.ID) - p.getPeers <- &listPeerReq{ - resp: out, - topic: topic, - } - return <-out -} - -// BlacklistPeer blacklists a peer; all messages from this peer will be unconditionally dropped. -func (p *PubSub) BlacklistPeer(pid peer.ID) { - p.blacklistPeer <- pid -} - -// RegisterTopicValidator registers a validator for topic. -// By default validators are asynchronous, which means they will run in a separate goroutine. -// The number of active goroutines is controlled by global and per topic validator -// throttles; if it exceeds the throttle threshold, messages will be dropped. -func (p *PubSub) RegisterTopicValidator(topic string, val Validator, opts ...ValidatorOpt) error { - addVal := &addValReq{ - topic: topic, - validate: val, - resp: make(chan error, 1), - } - - for _, opt := range opts { - err := opt(addVal) - if err != nil { - return err - } - } - - p.addVal <- addVal - return <-addVal.resp -} - -// UnregisterTopicValidator removes a validator from a topic. -// Returns an error if there was no validator registered with the topic. -func (p *PubSub) UnregisterTopicValidator(topic string) error { - rmVal := &rmValReq{ - topic: topic, - resp: make(chan error, 1), - } - - p.rmVal <- rmVal - return <-rmVal.resp -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/randomsub.go b/vendor/github.com/libp2p/go-libp2p-pubsub/randomsub.go deleted file mode 100644 index e4304d23..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/randomsub.go +++ /dev/null @@ -1,108 +0,0 @@ -package pubsub - -import ( - "context" - - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" -) - -const ( - RandomSubID = protocol.ID("/randomsub/1.0.0") -) - -var ( - RandomSubD = 6 -) - -// NewRandomSub returns a new PubSub object using RandomSubRouter as the router. -func NewRandomSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) { - rt := &RandomSubRouter{ - peers: make(map[peer.ID]protocol.ID), - } - return NewPubSub(ctx, h, rt, opts...) -} - -// RandomSubRouter is a router that implements a random propagation strategy. -// For each message, it selects RandomSubD peers and forwards the message to them. -type RandomSubRouter struct { - p *PubSub - peers map[peer.ID]protocol.ID -} - -func (rs *RandomSubRouter) Protocols() []protocol.ID { - return []protocol.ID{RandomSubID, FloodSubID} -} - -func (rs *RandomSubRouter) Attach(p *PubSub) { - rs.p = p -} - -func (rs *RandomSubRouter) AddPeer(p peer.ID, proto protocol.ID) { - rs.peers[p] = proto -} - -func (rs *RandomSubRouter) RemovePeer(p peer.ID) { - delete(rs.peers, p) -} - -func (rs *RandomSubRouter) HandleRPC(rpc *RPC) {} - -func (rs *RandomSubRouter) Publish(from peer.ID, msg *pb.Message) { - tosend := make(map[peer.ID]struct{}) - rspeers := make(map[peer.ID]struct{}) - src := peer.ID(msg.GetFrom()) - - for _, topic := range msg.GetTopicIDs() { - tmap, ok := rs.p.topics[topic] - if !ok { - continue - } - - for p := range tmap { - if p == from || p == src { - continue - } - - if rs.peers[p] == FloodSubID { - tosend[p] = struct{}{} - } else { - rspeers[p] = struct{}{} - } - } - } - - if len(rspeers) > RandomSubD { - xpeers := peerMapToList(rspeers) - shufflePeers(xpeers) - xpeers = xpeers[:RandomSubD] - for _, p := range xpeers { - tosend[p] = struct{}{} - } - } else { - for p := range rspeers { - tosend[p] = struct{}{} - } - } - - out := rpcWithMessages(msg) - for p := range tosend { - mch, ok := rs.p.peers[p] - if !ok { - continue - } - - select { - case mch <- out: - default: - log.Infof("dropping message to peer %s: queue full", p) - } - } -} - -func (rs *RandomSubRouter) Join(topic string) {} - -func (rs *RandomSubRouter) Leave(topic string) {} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/sign.go b/vendor/github.com/libp2p/go-libp2p-pubsub/sign.go deleted file mode 100644 index ea76214e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/sign.go +++ /dev/null @@ -1,103 +0,0 @@ -package pubsub - -import ( - "fmt" - - pb "github.com/libp2p/go-libp2p-pubsub/pb" - - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" -) - -const SignPrefix = "libp2p-pubsub:" - -func verifyMessageSignature(m *pb.Message) error { - pubk, err := messagePubKey(m) - if err != nil { - return err - } - - xm := *m - xm.Signature = nil - xm.Key = nil - bytes, err := xm.Marshal() - if err != nil { - return err - } - - bytes = withSignPrefix(bytes) - - valid, err := pubk.Verify(bytes, m.Signature) - if err != nil { - return err - } - - if !valid { - return fmt.Errorf("invalid signature") - } - - return nil -} - -func messagePubKey(m *pb.Message) (crypto.PubKey, error) { - var pubk crypto.PubKey - - pid, err := peer.IDFromBytes(m.From) - if err != nil { - return nil, err - } - - if m.Key == nil { - // no attached key, it must be extractable from the source ID - pubk, err = pid.ExtractPublicKey() - if err != nil { - return nil, fmt.Errorf("cannot extract signing key: %s", err.Error()) - } - if pubk == nil { - return nil, fmt.Errorf("cannot extract signing key") - } - } else { - pubk, err = crypto.UnmarshalPublicKey(m.Key) - if err != nil { - return nil, fmt.Errorf("cannot unmarshal signing key: %s", err.Error()) - } - - // verify that the source ID matches the attached key - if !pid.MatchesPublicKey(pubk) { - return nil, fmt.Errorf("bad signing key; source ID %s doesn't match key", pid) - } - } - - return pubk, nil -} - -func signMessage(pid peer.ID, key crypto.PrivKey, m *pb.Message) error { - bytes, err := m.Marshal() - if err != nil { - return err - } - - bytes = withSignPrefix(bytes) - - sig, err := key.Sign(bytes) - if err != nil { - return err - } - - m.Signature = sig - - pk, _ := pid.ExtractPublicKey() - if pk == nil { - pubk, err := key.GetPublic().Bytes() - if err != nil { - return err - } - m.Key = pubk - } - - return nil -} - -func withSignPrefix(bytes []byte) []byte { - return append([]byte(SignPrefix), bytes...) -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/subscription.go b/vendor/github.com/libp2p/go-libp2p-pubsub/subscription.go deleted file mode 100644 index 66a9e513..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/subscription.go +++ /dev/null @@ -1,33 +0,0 @@ -package pubsub - -import ( - "context" -) - -type Subscription struct { - topic string - ch chan *Message - cancelCh chan<- *Subscription - err error -} - -func (sub *Subscription) Topic() string { - return sub.topic -} - -func (sub *Subscription) Next(ctx context.Context) (*Message, error) { - select { - case msg, ok := <-sub.ch: - if !ok { - return msg, sub.err - } - - return msg, nil - case <-ctx.Done(): - return nil, ctx.Err() - } -} - -func (sub *Subscription) Cancel() { - sub.cancelCh <- sub -} diff --git a/vendor/github.com/libp2p/go-libp2p-pubsub/validation.go b/vendor/github.com/libp2p/go-libp2p-pubsub/validation.go deleted file mode 100644 index b7e473d9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-pubsub/validation.go +++ /dev/null @@ -1,391 +0,0 @@ -package pubsub - -import ( - "context" - "fmt" - "runtime" - "time" - - "github.com/libp2p/go-libp2p-core/peer" -) - -const ( - defaultValidateConcurrency = 1024 - defaultValidateThrottle = 8192 -) - -// Validator is a function that validates a message. -type Validator func(context.Context, peer.ID, *Message) bool - -// ValidatorOpt is an option for RegisterTopicValidator. -type ValidatorOpt func(addVal *addValReq) error - -// validation represents the validator pipeline. -// The validator pipeline performs signature validation and runs a -// sequence of user-configured validators per-topic. It is possible to -// adjust various concurrency parameters, such as the number of -// workers and the max number of simultaneous validations. The user -// can also attach inline validators that will be executed -// synchronously; this may be useful to prevent superfluous -// context-switching for lightweight tasks. -type validation struct { - p *PubSub - - // topicVals tracks per topic validators - topicVals map[string]*topicVal - - // validateQ is the front-end to the validation pipeline - validateQ chan *validateReq - - // validateThrottle limits the number of active validation goroutines - validateThrottle chan struct{} - - // this is the number of synchronous validation workers - validateWorkers int -} - -// validation requests -type validateReq struct { - vals []*topicVal - src peer.ID - msg *Message -} - -// representation of topic validators -type topicVal struct { - topic string - validate Validator - validateTimeout time.Duration - validateThrottle chan struct{} - validateInline bool -} - -// async request to add a topic validators -type addValReq struct { - topic string - validate Validator - timeout time.Duration - throttle int - inline bool - resp chan error -} - -// async request to remove a topic validator -type rmValReq struct { - topic string - resp chan error -} - -// newValidation creates a new validation pipeline -func newValidation() *validation { - return &validation{ - topicVals: make(map[string]*topicVal), - validateQ: make(chan *validateReq, 32), - validateThrottle: make(chan struct{}, defaultValidateThrottle), - validateWorkers: runtime.NumCPU(), - } -} - -// Start attaches the validation pipeline to a pubsub instance and starts background -// workers -func (v *validation) Start(p *PubSub) { - v.p = p - for i := 0; i < v.validateWorkers; i++ { - go v.validateWorker() - } -} - -// AddValidator adds a new validator -func (v *validation) AddValidator(req *addValReq) { - topic := req.topic - - _, ok := v.topicVals[topic] - if ok { - req.resp <- fmt.Errorf("Duplicate validator for topic %s", topic) - return - } - - val := &topicVal{ - topic: topic, - validate: req.validate, - validateTimeout: 0, - validateThrottle: make(chan struct{}, defaultValidateConcurrency), - validateInline: req.inline, - } - - if req.timeout > 0 { - val.validateTimeout = req.timeout - } - - if req.throttle > 0 { - val.validateThrottle = make(chan struct{}, req.throttle) - } - - v.topicVals[topic] = val - req.resp <- nil -} - -// RemoveValidator removes an existing validator -func (v *validation) RemoveValidator(req *rmValReq) { - topic := req.topic - - _, ok := v.topicVals[topic] - if ok { - delete(v.topicVals, topic) - req.resp <- nil - } else { - req.resp <- fmt.Errorf("No validator for topic %s", topic) - } -} - -// Push pushes a message into the validation pipeline. -// It returns true if the message can be forwarded immediately without validation. -func (v *validation) Push(src peer.ID, msg *Message) bool { - vals := v.getValidators(msg) - - if len(vals) > 0 || msg.Signature != nil { - select { - case v.validateQ <- &validateReq{vals, src, msg}: - default: - log.Warningf("message validation throttled; dropping message from %s", src) - } - return false - } - - return true -} - -// getValidators returns all validators that apply to a given message -func (v *validation) getValidators(msg *Message) []*topicVal { - var vals []*topicVal - - for _, topic := range msg.GetTopicIDs() { - val, ok := v.topicVals[topic] - if !ok { - continue - } - - vals = append(vals, val) - } - - return vals -} - -// validateWorker is an active goroutine performing inline validation -func (v *validation) validateWorker() { - for { - select { - case req := <-v.validateQ: - v.validate(req.vals, req.src, req.msg) - case <-v.p.ctx.Done(): - return - } - } -} - -// validate performs validation and only sends the message if all validators succeed -// signature validation is performed synchronously, while user validators are invoked -// asynchronously, throttled by the global validation throttle. -func (v *validation) validate(vals []*topicVal, src peer.ID, msg *Message) { - if msg.Signature != nil { - if !v.validateSignature(msg) { - log.Warningf("message signature validation failed; dropping message from %s", src) - return - } - } - - // we can mark the message as seen now that we have verified the signature - // and avoid invoking user validators more than once - id := msgID(msg.Message) - if !v.p.markSeen(id) { - return - } - - var inline, async []*topicVal - for _, val := range vals { - if val.validateInline { - inline = append(inline, val) - } else { - async = append(async, val) - } - } - - // apply inline (synchronous) validators - for _, val := range inline { - if !val.validateMsg(v.p.ctx, src, msg) { - log.Debugf("message validation failed; dropping message from %s", src) - return - } - } - - // apply async validators - if len(async) > 0 { - select { - case v.validateThrottle <- struct{}{}: - go func() { - v.doValidateTopic(async, src, msg) - <-v.validateThrottle - }() - default: - log.Warningf("message validation throttled; dropping message from %s", src) - } - return - } - - // no async validators, send the message - v.p.sendMsg <- &sendReq{ - from: src, - msg: msg, - } -} - -func (v *validation) validateSignature(msg *Message) bool { - err := verifyMessageSignature(msg.Message) - if err != nil { - log.Debugf("signature verification error: %s", err.Error()) - return false - } - - return true -} - -func (v *validation) doValidateTopic(vals []*topicVal, src peer.ID, msg *Message) { - if !v.validateTopic(vals, src, msg) { - log.Warningf("message validation failed; dropping message from %s", src) - return - } - - v.p.sendMsg <- &sendReq{ - from: src, - msg: msg, - } -} - -func (v *validation) validateTopic(vals []*topicVal, src peer.ID, msg *Message) bool { - if len(vals) == 1 { - return v.validateSingleTopic(vals[0], src, msg) - } - - ctx, cancel := context.WithCancel(v.p.ctx) - defer cancel() - - rch := make(chan bool, len(vals)) - rcount := 0 - throttle := false - -loop: - for _, val := range vals { - rcount++ - - select { - case val.validateThrottle <- struct{}{}: - go func(val *topicVal) { - rch <- val.validateMsg(ctx, src, msg) - <-val.validateThrottle - }(val) - - default: - log.Debugf("validation throttled for topic %s", val.topic) - throttle = true - break loop - } - } - - if throttle { - return false - } - - for i := 0; i < rcount; i++ { - valid := <-rch - if !valid { - return false - } - } - - return true -} - -// fast path for single topic validation that avoids the extra goroutine -func (v *validation) validateSingleTopic(val *topicVal, src peer.ID, msg *Message) bool { - select { - case val.validateThrottle <- struct{}{}: - res := val.validateMsg(v.p.ctx, src, msg) - <-val.validateThrottle - - return res - - default: - log.Debugf("validation throttled for topic %s", val.topic) - return false - } -} - -func (val *topicVal) validateMsg(ctx context.Context, src peer.ID, msg *Message) bool { - if val.validateTimeout > 0 { - var cancel func() - ctx, cancel = context.WithTimeout(ctx, val.validateTimeout) - defer cancel() - } - - valid := val.validate(ctx, src, msg) - if !valid { - log.Debugf("validation failed for topic %s", val.topic) - } - - return valid -} - -/// Options - -// WithValidateThrottle sets the upper bound on the number of active validation -// goroutines across all topics. The default is 8192. -func WithValidateThrottle(n int) Option { - return func(ps *PubSub) error { - ps.val.validateThrottle = make(chan struct{}, n) - return nil - } -} - -// WithValidateWorkers sets the number of synchronous validation worker goroutines. -// Defaults to NumCPU. -// -// The synchronous validation workers perform signature validation, apply inline -// user validators, and schedule asynchronous user validators. -// You can adjust this parameter to devote less cpu time to synchronous validation. -func WithValidateWorkers(n int) Option { - return func(ps *PubSub) error { - if n > 0 { - ps.val.validateWorkers = n - return nil - } - return fmt.Errorf("number of validation workers must be > 0") - } -} - -// WithValidatorTimeout is an option that sets a timeout for an (asynchronous) topic validator. -// By default there is no timeout in asynchronous validators. -func WithValidatorTimeout(timeout time.Duration) ValidatorOpt { - return func(addVal *addValReq) error { - addVal.timeout = timeout - return nil - } -} - -// WithValidatorConcurrency is an option that sets the topic validator throttle. -// This controls the number of active validation goroutines for the topic; the default is 1024. -func WithValidatorConcurrency(n int) ValidatorOpt { - return func(addVal *addValReq) error { - addVal.throttle = n - return nil - } -} - -// WithValidatorInline is an option that sets the validation disposition to synchronous: -// it will be executed inline in validation front-end, without spawning a new goroutine. -// This is suitable for simple or cpu-bound validators that do not block. -func WithValidatorInline(inline bool) ValidatorOpt { - return func(addVal *addValReq) error { - addVal.inline = inline - return nil - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/.travis.yml b/vendor/github.com/libp2p/go-libp2p-quic-transport/.travis.yml deleted file mode 100644 index 6188a488..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: go - -go: - - "1.12.x" - -# first part of the GOARCH workaround -# setting the GOARCH directly doesn't work, since the value will be overwritten later -# so set it to a temporary environment variable first -env: - - TRAVIS_GOARCH=amd64 - - TRAVIS_GOARCH=386 - -# second part of the GOARCH workaround -# now actually set the GOARCH env variable to the value of the temporary variable set earlier -before_install: - - export GO111MODULE=on - - go get golang.org/x/tools/cmd/cover - - go get github.com/onsi/ginkgo/ginkgo - - go get github.com/onsi/gomega - - export GOARCH=$TRAVIS_GOARCH - - go env # for debugging - -# see https://github.com/travis-ci/travis-ci/issues/8361#issuecomment-350090030 -before_script: - - sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' - -script: - - ginkgo -r -v --cover --randomizeAllSpecs --randomizeSuites --trace --progress - -after_success: - - cat go-libp2p-quic-transport.coverprofile > coverage.txt - - cat */*.coverprofile >> coverage.txt - - bash <(curl -s https://codecov.io/bash) -f coverage.txt - -cache: - directories: diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/README.md b/vendor/github.com/libp2p/go-libp2p-quic-transport/README.md deleted file mode 100644 index e480b1bd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# go-quic-transport - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Godoc Reference](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/libp2p/go-libp2p-quic-transport) -[![Linux Build Status](https://img.shields.io/travis/libp2p/go-libp2p-quic-transport/master.svg?style=flat-square&label=linux+build)](https://travis-ci.org/libp2p/go-libp2p-quic-transport) -[![Code Coverage](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-quic-transport/master.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p-quic-transport/) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -This is an implementation of the [libp2p transport](https://github.com/libp2p/go-libp2p-transport/blob/master/transport.go) and the [libp2p stream muxer](https://github.com/libp2p/go-stream-muxer) using QUIC. - -## Known limitations - -* currently only works with RSA host keys - ---- - -The last gx published version of this module was: diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/codecov.yml b/vendor/github.com/libp2p/go-libp2p-quic-transport/codecov.yml deleted file mode 100644 index 21e0c484..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/codecov.yml +++ /dev/null @@ -1,7 +0,0 @@ -coverage: - round: nearest - status: - project: - default: - threshold: 0.5 - patch: false diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/conn.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/conn.go deleted file mode 100644 index bf173458..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/conn.go +++ /dev/null @@ -1,81 +0,0 @@ -package libp2pquic - -import ( - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/peer" - tpt "github.com/libp2p/go-libp2p-core/transport" - - quic "github.com/lucas-clemente/quic-go" - ma "github.com/multiformats/go-multiaddr" -) - -type conn struct { - sess quic.Session - transport tpt.Transport - - localPeer peer.ID - privKey ic.PrivKey - localMultiaddr ma.Multiaddr - - remotePeerID peer.ID - remotePubKey ic.PubKey - remoteMultiaddr ma.Multiaddr -} - -var _ tpt.CapableConn = &conn{} - -func (c *conn) Close() error { - return c.sess.Close() -} - -// IsClosed returns whether a connection is fully closed. -func (c *conn) IsClosed() bool { - return c.sess.Context().Err() != nil -} - -// OpenStream creates a new stream. -func (c *conn) OpenStream() (mux.MuxedStream, error) { - qstr, err := c.sess.OpenStreamSync() - return &stream{Stream: qstr}, err -} - -// AcceptStream accepts a stream opened by the other side. -func (c *conn) AcceptStream() (mux.MuxedStream, error) { - qstr, err := c.sess.AcceptStream() - return &stream{Stream: qstr}, err -} - -// LocalPeer returns our peer ID -func (c *conn) LocalPeer() peer.ID { - return c.localPeer -} - -// LocalPrivateKey returns our private key -func (c *conn) LocalPrivateKey() ic.PrivKey { - return c.privKey -} - -// RemotePeer returns the peer ID of the remote peer. -func (c *conn) RemotePeer() peer.ID { - return c.remotePeerID -} - -// RemotePublicKey returns the public key of the remote peer. -func (c *conn) RemotePublicKey() ic.PubKey { - return c.remotePubKey -} - -// LocalMultiaddr returns the local Multiaddr associated -func (c *conn) LocalMultiaddr() ma.Multiaddr { - return c.localMultiaddr -} - -// RemoteMultiaddr returns the remote Multiaddr associated -func (c *conn) RemoteMultiaddr() ma.Multiaddr { - return c.remoteMultiaddr -} - -func (c *conn) Transport() tpt.Transport { - return c.transport -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/crypto.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/crypto.go deleted file mode 100644 index 68a30a62..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/crypto.go +++ /dev/null @@ -1,120 +0,0 @@ -package libp2pquic - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "errors" - "math/big" - "time" - - "github.com/gogo/protobuf/proto" - ic "github.com/libp2p/go-libp2p-core/crypto" - pb "github.com/libp2p/go-libp2p-core/crypto/pb" -) - -// mint certificate selection is broken. -const hostname = "quic.ipfs" - -const certValidityPeriod = 180 * 24 * time.Hour - -func generateConfig(privKey ic.PrivKey) (*tls.Config, error) { - key, hostCert, err := keyToCertificate(privKey) - if err != nil { - return nil, err - } - // The ephemeral key used just for a couple of connections (or a limited time). - ephemeralKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - return nil, err - } - // Sign the ephemeral key using the host key. - // This is the only time that the host's private key of the peer is needed. - // Note that this step could be done asynchronously, such that a running node doesn't need access its private key at all. - certTemplate := &x509.Certificate{ - DNSNames: []string{hostname}, - SerialNumber: big.NewInt(1), - NotBefore: time.Now().Add(-24 * time.Hour), - NotAfter: time.Now().Add(certValidityPeriod), - } - certDER, err := x509.CreateCertificate(rand.Reader, certTemplate, hostCert, ephemeralKey.Public(), key) - if err != nil { - return nil, err - } - cert, err := x509.ParseCertificate(certDER) - if err != nil { - return nil, err - } - return &tls.Config{ - ServerName: hostname, - InsecureSkipVerify: true, // This is not insecure here. We will verify the cert chain ourselves. - ClientAuth: tls.RequireAnyClientCert, - Certificates: []tls.Certificate{{ - Certificate: [][]byte{cert.Raw, hostCert.Raw}, - PrivateKey: ephemeralKey, - }}, - }, nil -} - -func getRemotePubKey(chain []*x509.Certificate) (ic.PubKey, error) { - if len(chain) != 2 { - return nil, errors.New("expected 2 certificates in the chain") - } - pool := x509.NewCertPool() - pool.AddCert(chain[1]) - if _, err := chain[0].Verify(x509.VerifyOptions{Roots: pool}); err != nil { - return nil, err - } - remotePubKey, err := x509.MarshalPKIXPublicKey(chain[1].PublicKey) - if err != nil { - return nil, err - } - return ic.UnmarshalRsaPublicKey(remotePubKey) -} - -func keyToCertificate(sk ic.PrivKey) (interface{}, *x509.Certificate, error) { - sn, err := rand.Int(rand.Reader, big.NewInt(1<<62)) - if err != nil { - return nil, nil, err - } - tmpl := &x509.Certificate{ - SerialNumber: sn, - NotBefore: time.Now().Add(-24 * time.Hour), - NotAfter: time.Now().Add(certValidityPeriod), - IsCA: true, - BasicConstraintsValid: true, - } - - var publicKey, privateKey interface{} - keyBytes, err := sk.Bytes() - if err != nil { - return nil, nil, err - } - pbmes := new(pb.PrivateKey) - if err := proto.Unmarshal(keyBytes, pbmes); err != nil { - return nil, nil, err - } - switch pbmes.GetType() { - case pb.KeyType_RSA: - k, err := x509.ParsePKCS1PrivateKey(pbmes.GetData()) - if err != nil { - return nil, nil, err - } - publicKey = &k.PublicKey - privateKey = k - // TODO: add support for ECDSA - default: - return nil, nil, errors.New("unsupported key type for TLS") - } - certDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, publicKey, privateKey) - if err != nil { - return nil, nil, err - } - cert, err := x509.ParseCertificate(certDER) - if err != nil { - return nil, nil, err - } - return privateKey, cert, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/go.mod b/vendor/github.com/libp2p/go-libp2p-quic-transport/go.mod deleted file mode 100644 index c5bdc64c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/libp2p/go-libp2p-quic-transport - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/lucas-clemente/quic-go v0.11.2 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/onsi/ginkgo v1.7.0 - github.com/onsi/gomega v1.4.3 - github.com/whyrusleeping/mafmt v1.2.8 -) diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/go.sum b/vendor/github.com/libp2p/go-libp2p-quic-transport/go.sum deleted file mode 100644 index 9018cdf2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/go.sum +++ /dev/null @@ -1,103 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/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/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -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/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/lucas-clemente/quic-go v0.11.2 h1:Mop0ac3zALaBR3wGs6j8OYe/tcFvFsxTUFMkE/7yUOI= -github.com/lucas-clemente/quic-go v0.11.2/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw= -github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA= -github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/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= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/listener.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/listener.go deleted file mode 100644 index 327af2f4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/listener.go +++ /dev/null @@ -1,114 +0,0 @@ -package libp2pquic - -import ( - "crypto/tls" - "net" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - tpt "github.com/libp2p/go-libp2p-core/transport" - - quic "github.com/lucas-clemente/quic-go" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -var quicListenAddr = quic.ListenAddr - -// A listener listens for QUIC connections. -type listener struct { - quicListener quic.Listener - transport tpt.Transport - - privKey ic.PrivKey - localPeer peer.ID - localMultiaddr ma.Multiaddr -} - -var _ tpt.Listener = &listener{} - -func newListener(addr ma.Multiaddr, transport tpt.Transport, localPeer peer.ID, key ic.PrivKey, tlsConf *tls.Config) (tpt.Listener, error) { - lnet, host, err := manet.DialArgs(addr) - if err != nil { - return nil, err - } - laddr, err := net.ResolveUDPAddr(lnet, host) - if err != nil { - return nil, err - } - conn, err := net.ListenUDP(lnet, laddr) - if err != nil { - return nil, err - } - ln, err := quic.Listen(conn, tlsConf, quicConfig) - if err != nil { - return nil, err - } - localMultiaddr, err := toQuicMultiaddr(ln.Addr()) - if err != nil { - return nil, err - } - return &listener{ - quicListener: ln, - transport: transport, - privKey: key, - localPeer: localPeer, - localMultiaddr: localMultiaddr, - }, nil -} - -// Accept accepts new connections. -func (l *listener) Accept() (tpt.CapableConn, error) { - for { - sess, err := l.quicListener.Accept() - if err != nil { - return nil, err - } - conn, err := l.setupConn(sess) - if err != nil { - sess.CloseWithError(0, err) - continue - } - return conn, nil - } -} - -func (l *listener) setupConn(sess quic.Session) (tpt.CapableConn, error) { - remotePubKey, err := getRemotePubKey(sess.ConnectionState().PeerCertificates) - if err != nil { - return nil, err - } - remotePeerID, err := peer.IDFromPublicKey(remotePubKey) - if err != nil { - return nil, err - } - remoteMultiaddr, err := toQuicMultiaddr(sess.RemoteAddr()) - if err != nil { - return nil, err - } - return &conn{ - sess: sess, - transport: l.transport, - localPeer: l.localPeer, - localMultiaddr: l.localMultiaddr, - privKey: l.privKey, - remoteMultiaddr: remoteMultiaddr, - remotePeerID: remotePeerID, - remotePubKey: remotePubKey, - }, nil -} - -// Close closes the listener. -func (l *listener) Close() error { - return l.quicListener.Close() -} - -// Addr returns the address of this listener. -func (l *listener) Addr() net.Addr { - return l.quicListener.Addr() -} - -// Multiaddr returns the multiaddress of this listener. -func (l *listener) Multiaddr() ma.Multiaddr { - return l.localMultiaddr -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/quic_multiaddr.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/quic_multiaddr.go deleted file mode 100644 index 8b182b76..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/quic_multiaddr.go +++ /dev/null @@ -1,30 +0,0 @@ -package libp2pquic - -import ( - "net" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -var quicMA ma.Multiaddr - -func init() { - var err error - quicMA, err = ma.NewMultiaddr("/quic") - if err != nil { - panic(err) - } -} - -func toQuicMultiaddr(na net.Addr) (ma.Multiaddr, error) { - udpMA, err := manet.FromNetAddr(na) - if err != nil { - return nil, err - } - return udpMA.Encapsulate(quicMA), nil -} - -func fromQuicMultiaddr(addr ma.Multiaddr) (net.Addr, error) { - return manet.ToNetAddr(addr.Decapsulate(quicMA)) -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/stream.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/stream.go deleted file mode 100644 index e757de20..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/stream.go +++ /dev/null @@ -1,19 +0,0 @@ -package libp2pquic - -import ( - "github.com/libp2p/go-libp2p-core/mux" - - quic "github.com/lucas-clemente/quic-go" -) - -type stream struct { - quic.Stream -} - -var _ mux.MuxedStream = &stream{} - -func (s *stream) Reset() error { - s.Stream.CancelRead(0) - s.Stream.CancelWrite(0) - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-quic-transport/transport.go b/vendor/github.com/libp2p/go-libp2p-quic-transport/transport.go deleted file mode 100644 index c33b2417..00000000 --- a/vendor/github.com/libp2p/go-libp2p-quic-transport/transport.go +++ /dev/null @@ -1,182 +0,0 @@ -package libp2pquic - -import ( - "context" - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "net" - "sync" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - tpt "github.com/libp2p/go-libp2p-core/transport" - - quic "github.com/lucas-clemente/quic-go" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" - "github.com/whyrusleeping/mafmt" -) - -var quicConfig = &quic.Config{ - MaxIncomingStreams: 1000, - MaxIncomingUniStreams: -1, // disable unidirectional streams - MaxReceiveStreamFlowControlWindow: 3 * (1 << 20), // 3 MB - MaxReceiveConnectionFlowControlWindow: 4.5 * (1 << 20), // 4.5 MB - AcceptCookie: func(clientAddr net.Addr, cookie *quic.Cookie) bool { - // TODO(#6): require source address validation when under load - return true - }, - KeepAlive: true, -} - -type connManager struct { - mutex sync.Mutex - - connIPv4 net.PacketConn - connIPv6 net.PacketConn -} - -func (c *connManager) GetConnForAddr(network string) (net.PacketConn, error) { - c.mutex.Lock() - defer c.mutex.Unlock() - - switch network { - case "udp4": - if c.connIPv4 != nil { - return c.connIPv4, nil - } - var err error - c.connIPv4, err = c.createConn(network, "0.0.0.0:0") - return c.connIPv4, err - case "udp6": - if c.connIPv6 != nil { - return c.connIPv6, nil - } - var err error - c.connIPv6, err = c.createConn(network, ":0") - return c.connIPv6, err - default: - return nil, fmt.Errorf("unsupported network: %s", network) - } -} - -func (c *connManager) createConn(network, host string) (net.PacketConn, error) { - addr, err := net.ResolveUDPAddr(network, host) - if err != nil { - return nil, err - } - return net.ListenUDP(network, addr) -} - -// The Transport implements the tpt.Transport interface for QUIC connections. -type transport struct { - privKey ic.PrivKey - localPeer peer.ID - tlsConf *tls.Config - connManager *connManager -} - -var _ tpt.Transport = &transport{} - -// NewTransport creates a new QUIC transport -func NewTransport(key ic.PrivKey) (tpt.Transport, error) { - localPeer, err := peer.IDFromPrivateKey(key) - if err != nil { - return nil, err - } - tlsConf, err := generateConfig(key) - if err != nil { - return nil, err - } - - return &transport{ - privKey: key, - localPeer: localPeer, - tlsConf: tlsConf, - connManager: &connManager{}, - }, nil -} - -// Dial dials a new QUIC connection -func (t *transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error) { - network, host, err := manet.DialArgs(raddr) - if err != nil { - return nil, err - } - pconn, err := t.connManager.GetConnForAddr(network) - if err != nil { - return nil, err - } - addr, err := fromQuicMultiaddr(raddr) - if err != nil { - return nil, err - } - var remotePubKey ic.PubKey - tlsConf := t.tlsConf.Clone() - // We need to check the peer ID in the VerifyPeerCertificate callback. - // The tls.Config it is also used for listening, and we might also have concurrent dials. - // Clone it so we can check for the specific peer ID we're dialing here. - tlsConf.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error { - chain := make([]*x509.Certificate, len(rawCerts)) - for i := 0; i < len(rawCerts); i++ { - cert, err := x509.ParseCertificate(rawCerts[i]) - if err != nil { - return err - } - chain[i] = cert - } - var err error - remotePubKey, err = getRemotePubKey(chain) - if err != nil { - return err - } - if !p.MatchesPublicKey(remotePubKey) { - return errors.New("peer IDs don't match") - } - return nil - } - sess, err := quic.DialContext(ctx, pconn, addr, host, tlsConf, quicConfig) - if err != nil { - return nil, err - } - localMultiaddr, err := toQuicMultiaddr(sess.LocalAddr()) - if err != nil { - return nil, err - } - return &conn{ - sess: sess, - transport: t, - privKey: t.privKey, - localPeer: t.localPeer, - localMultiaddr: localMultiaddr, - remotePubKey: remotePubKey, - remotePeerID: p, - remoteMultiaddr: raddr, - }, nil -} - -// CanDial determines if we can dial to an address -func (t *transport) CanDial(addr ma.Multiaddr) bool { - return mafmt.QUIC.Matches(addr) -} - -// Listen listens for new QUIC connections on the passed multiaddr. -func (t *transport) Listen(addr ma.Multiaddr) (tpt.Listener, error) { - return newListener(addr, t, t.localPeer, t.privKey, t.tlsConf) -} - -// Proxy returns true if this transport proxies. -func (t *transport) Proxy() bool { - return false -} - -// Protocols returns the set of protocols handled by this transport. -func (t *transport) Protocols() []int { - return []int{ma.P_QUIC} -} - -func (t *transport) String() string { - return "QUIC" -} diff --git a/vendor/github.com/libp2p/go-libp2p-record/.travis.yml b/vendor/github.com/libp2p/go-libp2p-record/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-record/LICENSE b/vendor/github.com/libp2p/go-libp2p-record/LICENSE deleted file mode 100644 index 808d2e01..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 libp2p - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-libp2p-record/README.md b/vendor/github.com/libp2p/go-libp2p-record/README.md deleted file mode 100644 index 63fe5011..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# go-libp2p-record - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> signed records for use with routing systems - -## Documenation - -See https://godoc.org/github.com/libp2p/go-libp2p-record. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-key/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 4.1.15: QmbeHtaBy9nZsW4cHRcvgVY4CnDhXudE2Dr6qDxS7yg9rX diff --git a/vendor/github.com/libp2p/go-libp2p-record/codecov.yml b/vendor/github.com/libp2p/go-libp2p-record/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-record/go.mod b/vendor/github.com/libp2p/go-libp2p-record/go.mod deleted file mode 100644 index 3e24bfb4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/libp2p/go-libp2p-record - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multihash v0.0.5 -) diff --git a/vendor/github.com/libp2p/go-libp2p-record/go.sum b/vendor/github.com/libp2p/go-libp2p-record/go.sum deleted file mode 100644 index fd61127d..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/go.sum +++ /dev/null @@ -1,90 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-record/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-record/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-record/pb/record.pb.go b/vendor/github.com/libp2p/go-libp2p-record/pb/record.pb.go deleted file mode 100644 index e8b679b6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/pb/record.pb.go +++ /dev/null @@ -1,458 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: record.proto - -package record_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// Record represents a dht record that contains a value -// for a key value pair -type Record struct { - // The key that references this record - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The actual value this record is storing - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - // Time the record was received, set by receiver - TimeReceived string `protobuf:"bytes,5,opt,name=timeReceived,proto3" json:"timeReceived,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Record) Reset() { *m = Record{} } -func (m *Record) String() string { return proto.CompactTextString(m) } -func (*Record) ProtoMessage() {} -func (*Record) Descriptor() ([]byte, []int) { - return fileDescriptor_bf94fd919e302a1d, []int{0} -} -func (m *Record) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Record.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Record) XXX_Merge(src proto.Message) { - xxx_messageInfo_Record.Merge(m, src) -} -func (m *Record) XXX_Size() int { - return m.Size() -} -func (m *Record) XXX_DiscardUnknown() { - xxx_messageInfo_Record.DiscardUnknown(m) -} - -var xxx_messageInfo_Record proto.InternalMessageInfo - -func (m *Record) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Record) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *Record) GetTimeReceived() string { - if m != nil { - return m.TimeReceived - } - return "" -} - -func init() { - proto.RegisterType((*Record)(nil), "record.pb.Record") -} - -func init() { proto.RegisterFile("record.proto", fileDescriptor_bf94fd919e302a1d) } - -var fileDescriptor_bf94fd919e302a1d = []byte{ - // 125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0xf1, 0x92, 0x94, 0x42, 0xb8, - 0xd8, 0x82, 0xc0, 0x1c, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0x09, 0x46, 0x05, 0x46, 0x0d, - 0x9e, 0x20, 0x10, 0x53, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, - 0x06, 0xe1, 0x08, 0x29, 0x71, 0xf1, 0x94, 0x64, 0xe6, 0xa6, 0x06, 0xa5, 0x26, 0xa7, 0x66, 0x96, - 0xa5, 0xa6, 0x48, 0xb0, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0xa1, 0x88, 0x39, 0xf1, 0x9c, 0x78, 0x24, - 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x5b, 0x8d, 0x01, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x64, 0x43, 0x08, 0x1c, 0x85, 0x00, 0x00, 0x00, -} - -func (m *Record) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Record) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRecord(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRecord(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if len(m.TimeReceived) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintRecord(dAtA, i, uint64(len(m.TimeReceived))) - i += copy(dAtA[i:], m.TimeReceived) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintRecord(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Record) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - l = len(m.TimeReceived) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovRecord(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozRecord(x uint64) (n int) { - return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Record) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Record: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRecord - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeReceived", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TimeReceived = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRecord - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRecord - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRecord(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthRecord - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthRecord - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRecord - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRecord(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthRecord - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-record/pb/record.proto b/vendor/github.com/libp2p/go-libp2p-record/pb/record.proto deleted file mode 100644 index 0720c8bc..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/pb/record.proto +++ /dev/null @@ -1,27 +0,0 @@ -// In order to re-generate the golang packages for `Record` you will need... -// 1. Protobuf binary (tested with protoc 3.0.0). - https://github.com/gogo/protobuf/releases -// 2. Gogo Protobuf (tested with gogo 0.3). - https://github.com/gogo/protobuf -// Now from `libp2p/go-libp2p-record/pb` you can run... -// `protoc --gogo_out=. record.proto` - -syntax = "proto3"; -package record.pb; - -// Record represents a dht record that contains a value -// for a key value pair -message Record { - // The key that references this record - bytes key = 1; - - // The actual value this record is storing - bytes value = 2; - - // Note: These fields were removed from the Record message - // hash of the authors public key - //optional string author = 3; - // A PKI signature for the key+value+author - //optional bytes signature = 4; - - // Time the record was received, set by receiver - string timeReceived = 5; -} diff --git a/vendor/github.com/libp2p/go-libp2p-record/pubkey.go b/vendor/github.com/libp2p/go-libp2p-record/pubkey.go deleted file mode 100644 index 02fc88b0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/pubkey.go +++ /dev/null @@ -1,47 +0,0 @@ -package record - -import ( - "bytes" - "errors" - "fmt" - - u "github.com/ipfs/go-ipfs-util" - mh "github.com/multiformats/go-multihash" -) - -// PublicKeyValidator is a Validator that validates public keys. -type PublicKeyValidator struct{} - -// Validate conforms to the Validator interface. -// -// It verifies that the passed in record value is the PublicKey that matches the -// passed in key. -func (pkv PublicKeyValidator) Validate(key string, value []byte) error { - ns, key, err := SplitKey(key) - if err != nil { - return err - } - if ns != "pk" { - return errors.New("namespace not 'pk'") - } - - keyhash := []byte(key) - if _, err := mh.Cast(keyhash); err != nil { - return fmt.Errorf("key did not contain valid multihash: %s", err) - } - - pkh := u.Hash(value) - if !bytes.Equal(keyhash, pkh) { - return errors.New("public key does not match storage key") - } - return nil -} - -// Select conforms to the Validator interface. -// -// It always returns 0 as all public keys are equivalently valid. -func (pkv PublicKeyValidator) Select(k string, vals [][]byte) (int, error) { - return 0, nil -} - -var _ Validator = PublicKeyValidator{} diff --git a/vendor/github.com/libp2p/go-libp2p-record/record.go b/vendor/github.com/libp2p/go-libp2p-record/record.go deleted file mode 100644 index 86b16d09..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/record.go +++ /dev/null @@ -1,13 +0,0 @@ -package record - -import ( - pb "github.com/libp2p/go-libp2p-record/pb" -) - -// MakePutRecord creates a dht record for the given key/value pair -func MakePutRecord(key string, value []byte) *pb.Record { - record := new(pb.Record) - record.Key = []byte(key) - record.Value = value - return record -} diff --git a/vendor/github.com/libp2p/go-libp2p-record/util.go b/vendor/github.com/libp2p/go-libp2p-record/util.go deleted file mode 100644 index 3870600f..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/util.go +++ /dev/null @@ -1,22 +0,0 @@ -package record - -import ( - "strings" -) - -// SplitKey takes a key in the form `/$namespace/$path` and splits it into -// `$namespace` and `$path`. -func SplitKey(key string) (string, string, error) { - if len(key) == 0 || key[0] != '/' { - return "", "", ErrInvalidRecordType - } - - key = key[1:] - - i := strings.IndexByte(key, '/') - if i <= 0 { - return "", "", ErrInvalidRecordType - } - - return key[:i], key[i+1:], nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-record/validator.go b/vendor/github.com/libp2p/go-libp2p-record/validator.go deleted file mode 100644 index ed0475f1..00000000 --- a/vendor/github.com/libp2p/go-libp2p-record/validator.go +++ /dev/null @@ -1,63 +0,0 @@ -package record - -import ( - "errors" - - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("routing/record") - -// ErrInvalidRecordType is returned if a DHTRecord keys prefix -// is not found in the Validator map of the DHT. -var ErrInvalidRecordType = errors.New("invalid record keytype") - -// Validator is an interface that should be implemented by record validators. -type Validator interface { - // Validate validates the given record, returning an error if it's - // invalid (e.g., expired, signed by the wrong key, etc.). - Validate(key string, value []byte) error - - // Select selects the best record from the set of records (e.g., the - // newest). - // - // Decisions made by select should be stable. - Select(key string, values [][]byte) (int, error) -} - -// NamespacedValidator is a validator that delegates to sub-validators by -// namespace. -type NamespacedValidator map[string]Validator - -// ValidatorByKey looks up the validator responsible for validating the given -// key. -func (v NamespacedValidator) ValidatorByKey(key string) Validator { - ns, _, err := SplitKey(key) - if err != nil { - return nil - } - return v[ns] -} - -// Validate conforms to the Validator interface. -func (v NamespacedValidator) Validate(key string, value []byte) error { - vi := v.ValidatorByKey(key) - if vi == nil { - return ErrInvalidRecordType - } - return vi.Validate(key, value) -} - -// Select conforms to the Validator interface. -func (v NamespacedValidator) Select(key string, values [][]byte) (int, error) { - if len(values) == 0 { - return 0, errors.New("can't select from no values") - } - vi := v.ValidatorByKey(key) - if vi == nil { - return 0, ErrInvalidRecordType - } - return vi.Select(key, values) -} - -var _ Validator = NamespacedValidator{} diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/.travis.yml b/vendor/github.com/libp2p/go-libp2p-routing-helpers/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/LICENSE b/vendor/github.com/libp2p/go-libp2p-routing-helpers/LICENSE deleted file mode 100644 index 6cccfc2b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/README.md b/vendor/github.com/libp2p/go-libp2p-routing-helpers/README.md deleted file mode 100644 index 9a551e7b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# go-libp2p-routing-helpers - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-routing-helpers?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-routing-helpers) -[![Coverage Status](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-routing-helpers.svg?style=flat-square&branch=master)](https://codecov.io/github/libp2p/go-libp2p-routing-helpers?branch=master) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-routing-helpers.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-routing-helpers) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A collection of helper types for composing different types of routers. - -## Documenation - -See https://godoc.org/github.com/libp2p/go-libp2p-routing-helpers. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-routing-helpers/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 0.4.0: QmXwV9RskR8vpoYWu9bvKAeAWaBKyxEsEiM9yy6ezbpNBm diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/bootstrap.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/bootstrap.go deleted file mode 100644 index e8bb5e8a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/bootstrap.go +++ /dev/null @@ -1,14 +0,0 @@ -package routinghelpers - -import ( - "context" -) - -// TODO: Consider moving this to the routing package? - -// Bootstrap is an interface that should be implemented by any routers wishing -// to be bootstrapped. -type Bootstrap interface { - // Bootstrap bootstraps the router. - Bootstrap(ctx context.Context) error -} diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/composed.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/composed.go deleted file mode 100644 index 5ffa0d02..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/composed.go +++ /dev/null @@ -1,122 +0,0 @@ -package routinghelpers - -import ( - "context" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - multierror "github.com/hashicorp/go-multierror" - cid "github.com/ipfs/go-cid" -) - -// Compose composes the components into a single router. Not specifying a -// component (leaving it nil) is equivalent to specifying the Null router. -// -// It also implements Bootstrap. All *distinct* components implementing -// Bootstrap will be bootstrapped in parallel. Identical components will not be -// bootstrapped twice. -type Compose struct { - ValueStore routing.ValueStore - PeerRouting routing.PeerRouting - ContentRouting routing.ContentRouting -} - -// note: we implement these methods explicitly to avoid having to manually -// specify the Null router everywhere we don't want to implement some -// functionality. - -// PutValue adds value corresponding to given Key. -func (cr *Compose) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) error { - if cr.ValueStore == nil { - return routing.ErrNotSupported - } - return cr.ValueStore.PutValue(ctx, key, value, opts...) -} - -// GetValue searches for the value corresponding to given Key. -func (cr *Compose) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error) { - if cr.ValueStore == nil { - return nil, routing.ErrNotFound - } - return cr.ValueStore.GetValue(ctx, key, opts...) -} - -// SearchValue searches for the value corresponding to given Key. -func (cr *Compose) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - if cr.ValueStore == nil { - out := make(chan []byte) - close(out) - return out, nil - } - return cr.ValueStore.SearchValue(ctx, key, opts...) -} - -// Provide adds the given cid to the content routing system. If 'true' is -// passed, it also announces it, otherwise it is just kept in the local -// accounting of which objects are being provided. -func (cr *Compose) Provide(ctx context.Context, c cid.Cid, local bool) error { - if cr.ContentRouting == nil { - return routing.ErrNotSupported - } - return cr.ContentRouting.Provide(ctx, c, local) -} - -// FindProvidersAsync searches for peers who are able to provide a given key -func (cr *Compose) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan peer.AddrInfo { - if cr.ContentRouting == nil { - ch := make(chan peer.AddrInfo) - close(ch) - return ch - } - return cr.ContentRouting.FindProvidersAsync(ctx, c, count) -} - -// FindPeer searches for a peer with given ID, returns a peer.AddrInfo -// with relevant addresses. -func (cr *Compose) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error) { - if cr.PeerRouting == nil { - return peer.AddrInfo{}, routing.ErrNotFound - } - return cr.PeerRouting.FindPeer(ctx, p) -} - -// GetPublicKey returns the public key for the given peer. -func (cr *Compose) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) { - if cr.ValueStore == nil { - return nil, routing.ErrNotFound - } - return routing.GetPublicKey(cr.ValueStore, ctx, p) -} - -// Bootstrap the router. -func (cr *Compose) Bootstrap(ctx context.Context) error { - // Deduplicate. Technically, calling bootstrap multiple times shouldn't - // be an issue but using the same router for multiple fields of Compose - // is common. - routers := make(map[Bootstrap]struct{}, 3) - for _, value := range [...]interface{}{ - cr.ValueStore, - cr.ContentRouting, - cr.PeerRouting, - } { - switch b := value.(type) { - case nil: - case Null: - case Bootstrap: - routers[b] = struct{}{} - } - } - - var me multierror.Error - for b := range routers { - if err := b.Bootstrap(ctx); err != nil { - me.Errors = append(me.Errors, err) - } - } - return me.ErrorOrNil() -} - -var _ routing.Routing = (*Compose)(nil) -var _ routing.PubKeyFetcher = (*Compose)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.mod b/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.mod deleted file mode 100644 index 43aeb8ce..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/libp2p/go-libp2p-routing-helpers - -require ( - github.com/hashicorp/errwrap v1.0.0 - github.com/hashicorp/go-multierror v1.0.0 - github.com/ipfs/go-cid v0.0.2 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-record v0.1.0 - github.com/multiformats/go-multihash v0.0.5 -) diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.sum b/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.sum deleted file mode 100644 index 2917e51e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/go.sum +++ /dev/null @@ -1,118 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1 h1:GBjWPktLnNyX0JiQCNFpUuUSoMw5KMyqrsejHYlILBE= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-record v0.1.0 h1:wHwBGbFzymoIl69BpgwIu0O6ta3TXGcMPvHUAcodzRc= -github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/limited.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/limited.go deleted file mode 100644 index bc1187f5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/limited.go +++ /dev/null @@ -1,81 +0,0 @@ -package routinghelpers - -import ( - "context" - "strings" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" -) - -// LimitedValueStore limits the internal value store to the given namespaces. -type LimitedValueStore struct { - routing.ValueStore - Namespaces []string -} - -// GetPublicKey returns the public key for the given peer. -func (lvs *LimitedValueStore) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) { - for _, ns := range lvs.Namespaces { - if ns == "pk" { - return routing.GetPublicKey(lvs.ValueStore, ctx, p) - } - } - return nil, routing.ErrNotFound -} - -// PutValue returns ErrNotSupported -func (lvs *LimitedValueStore) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) error { - if !lvs.KeySupported(key) { - return routing.ErrNotSupported - } - return lvs.ValueStore.PutValue(ctx, key, value, opts...) -} - -// KeySupported returns true if the passed key is supported by this value store. -func (lvs *LimitedValueStore) KeySupported(key string) bool { - if len(key) < 3 { - return false - } - if key[0] != '/' { - return false - } - key = key[1:] - for _, ns := range lvs.Namespaces { - if len(ns) < len(key) && strings.HasPrefix(key, ns) && key[len(ns)] == '/' { - return true - } - } - return false -} - -// GetValue returns routing.ErrNotFound if key isn't supported -func (lvs *LimitedValueStore) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error) { - if !lvs.KeySupported(key) { - return nil, routing.ErrNotFound - } - return lvs.ValueStore.GetValue(ctx, key, opts...) -} - -// SearchValue returns empty channel if key isn't supported or calls SearchValue -// on the underlying ValueStore -func (lvs *LimitedValueStore) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - if !lvs.KeySupported(key) { - out := make(chan []byte) - close(out) - return out, nil - } - return lvs.ValueStore.SearchValue(ctx, key, opts...) -} - -func (lvs *LimitedValueStore) Bootstrap(ctx context.Context) error { - if bs, ok := lvs.ValueStore.(Bootstrap); ok { - return bs.Bootstrap(ctx) - } - return nil -} - -var _ routing.PubKeyFetcher = (*LimitedValueStore)(nil) -var _ routing.ValueStore = (*LimitedValueStore)(nil) -var _ Bootstrap = (*LimitedValueStore)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/null.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/null.go deleted file mode 100644 index 6a69d697..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/null.go +++ /dev/null @@ -1,52 +0,0 @@ -package routinghelpers - -import ( - "context" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - "github.com/ipfs/go-cid" -) - -// Null is a router that doesn't do anything. -type Null struct{} - -// PutValue always returns ErrNotSupported -func (nr Null) PutValue(context.Context, string, []byte, ...routing.Option) error { - return routing.ErrNotSupported -} - -// GetValue always returns ErrNotFound -func (nr Null) GetValue(context.Context, string, ...routing.Option) ([]byte, error) { - return nil, routing.ErrNotFound -} - -// SearchValue always returns ErrNotFound -func (nr Null) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - return nil, routing.ErrNotFound -} - -// Provide always returns ErrNotSupported -func (nr Null) Provide(context.Context, cid.Cid, bool) error { - return routing.ErrNotSupported -} - -// FindProvidersAsync always returns a closed channel -func (nr Null) FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.AddrInfo { - ch := make(chan peer.AddrInfo) - close(ch) - return ch -} - -// FindPeer always returns ErrNotFound -func (nr Null) FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) { - return peer.AddrInfo{}, routing.ErrNotFound -} - -// Bootstrap always succeeds instantly -func (nr Null) Bootstrap(context.Context) error { - return nil -} - -var _ routing.Routing = Null{} diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/parallel.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/parallel.go deleted file mode 100644 index 14e272a5..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/parallel.go +++ /dev/null @@ -1,508 +0,0 @@ -package routinghelpers - -import ( - "bytes" - "context" - "reflect" - "sync" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - multierror "github.com/hashicorp/go-multierror" - cid "github.com/ipfs/go-cid" - record "github.com/libp2p/go-libp2p-record" -) - -// Parallel operates on the slice of routers in parallel. -type Parallel struct { - Routers []routing.Routing - Validator record.Validator -} - -// Helper function that sees through router composition to avoid unnecessary -// go routines. -func supportsKey(vs routing.ValueStore, key string) bool { - switch vs := vs.(type) { - case Null: - return false - case *Compose: - return vs.ValueStore != nil && supportsKey(vs.ValueStore, key) - case Parallel: - for _, ri := range vs.Routers { - if supportsKey(ri, key) { - return true - } - } - return false - case Tiered: - for _, ri := range vs.Routers { - if supportsKey(ri, key) { - return true - } - } - return false - case *LimitedValueStore: - return vs.KeySupported(key) && supportsKey(vs.ValueStore, key) - default: - return true - } -} - -func supportsPeer(vs routing.PeerRouting) bool { - switch vs := vs.(type) { - case Null: - return false - case *Compose: - return vs.PeerRouting != nil && supportsPeer(vs.PeerRouting) - case Parallel: - for _, ri := range vs.Routers { - if supportsPeer(ri) { - return true - } - } - return false - case Tiered: - for _, ri := range vs.Routers { - if supportsPeer(ri) { - return true - } - } - return false - default: - return true - } -} - -func supportsContent(vs routing.ContentRouting) bool { - switch vs := vs.(type) { - case Null: - return false - case *Compose: - return vs.ContentRouting != nil && supportsContent(vs.ContentRouting) - case Parallel: - for _, ri := range vs.Routers { - if supportsContent(ri) { - return true - } - } - return false - case Tiered: - for _, ri := range vs.Routers { - if supportsContent(ri) { - return true - } - } - return false - default: - return true - } -} - -func (r Parallel) filter(filter func(routing.Routing) bool) Parallel { - cpy := make([]routing.Routing, 0, len(r.Routers)) - for _, ri := range r.Routers { - if filter(ri) { - cpy = append(cpy, ri) - } - } - return Parallel{Routers: cpy, Validator: r.Validator} -} - -func (r Parallel) put(do func(routing.Routing) error) error { - switch len(r.Routers) { - case 0: - return routing.ErrNotSupported - case 1: - return do(r.Routers[0]) - } - - var wg sync.WaitGroup - results := make([]error, len(r.Routers)) - wg.Add(len(r.Routers)) - for i, ri := range r.Routers { - go func(ri routing.Routing, i int) { - results[i] = do(ri) - wg.Done() - }(ri, i) - } - wg.Wait() - - var ( - errs []error - success bool - ) - for _, err := range results { - switch err { - case nil: - // at least one router supports this. - success = true - case routing.ErrNotSupported: - default: - errs = append(errs, err) - } - } - - switch len(errs) { - case 0: - if success { - // No errors and at least one router succeeded. - return nil - } - // No routers supported this operation. - return routing.ErrNotSupported - case 1: - return errs[0] - default: - return &multierror.Error{Errors: errs} - } -} - -func (r Parallel) search(ctx context.Context, do func(routing.Routing) (<-chan []byte, error)) (<-chan []byte, error) { - switch len(r.Routers) { - case 0: - return nil, routing.ErrNotFound - case 1: - return do(r.Routers[0]) - } - - ctx, cancel := context.WithCancel(ctx) - - out := make(chan []byte) - var errs []error - - var wg sync.WaitGroup - for _, ri := range r.Routers { - vchan, err := do(ri) - switch err { - case nil: - case routing.ErrNotFound, routing.ErrNotSupported: - continue - default: - errs = append(errs, err) - } - - wg.Add(1) - go func() { - var sent int - defer wg.Done() - - for { - select { - case v, ok := <-vchan: - if !ok { - if sent > 0 { - cancel() - } - return - } - - select { - case out <- v: - sent++ - case <-ctx.Done(): - return - } - case <-ctx.Done(): - return - } - } - }() - } - - go func() { - wg.Wait() - close(out) - cancel() - }() - - return out, nil -} - -func (r Parallel) get(ctx context.Context, do func(routing.Routing) (interface{}, error)) (interface{}, error) { - switch len(r.Routers) { - case 0: - return nil, routing.ErrNotFound - case 1: - return do(r.Routers[0]) - } - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - results := make(chan struct { - val interface{} - err error - }) - for _, ri := range r.Routers { - go func(ri routing.Routing) { - value, err := do(ri) - select { - case results <- struct { - val interface{} - err error - }{ - val: value, - err: err, - }: - case <-ctx.Done(): - } - }(ri) - } - - var errs []error - for range r.Routers { - select { - case res := <-results: - switch res.err { - case nil: - return res.val, nil - case routing.ErrNotFound, routing.ErrNotSupported: - continue - } - // If the context has expired, just return that error - // and ignore the other errors. - if ctx.Err() != nil { - return nil, ctx.Err() - } - errs = append(errs, res.err) - case <-ctx.Done(): - return nil, ctx.Err() - } - } - - switch len(errs) { - case 0: - return nil, routing.ErrNotFound - case 1: - return nil, errs[0] - default: - return nil, &multierror.Error{Errors: errs} - } -} - -func (r Parallel) forKey(key string) Parallel { - return r.filter(func(ri routing.Routing) bool { - return supportsKey(ri, key) - }) -} - -func (r Parallel) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) error { - return r.forKey(key).put(func(ri routing.Routing) error { - return ri.PutValue(ctx, key, value, opts...) - }) -} - -func (r Parallel) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error) { - vInt, err := r.forKey(key).get(ctx, func(ri routing.Routing) (interface{}, error) { - return ri.GetValue(ctx, key, opts...) - }) - val, _ := vInt.([]byte) - return val, err -} - -func (r Parallel) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - resCh, err := r.forKey(key).search(ctx, func(ri routing.Routing) (<-chan []byte, error) { - return ri.SearchValue(ctx, key, opts...) - }) - if err != nil { - return nil, err - } - - valid := make(chan []byte) - var best []byte - go func() { - defer close(valid) - - for v := range resCh { - if best != nil { - n, err := r.Validator.Select(key, [][]byte{best, v}) - if err != nil { - continue - } - if n != 1 { - continue - } - } - if bytes.Equal(best, v) && len(v) != 0 { - continue - } - - best = v - select { - case valid <- v: - case <-ctx.Done(): - return - } - } - }() - - return valid, err -} - -func (r Parallel) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) { - vInt, err := r. - forKey(routing.KeyForPublicKey(p)). - get(ctx, func(ri routing.Routing) (interface{}, error) { - return routing.GetPublicKey(ri, ctx, p) - }) - val, _ := vInt.(ci.PubKey) - return val, err -} - -func (r Parallel) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error) { - vInt, err := r.filter(func(ri routing.Routing) bool { - return supportsPeer(ri) - }).get(ctx, func(ri routing.Routing) (interface{}, error) { - return ri.FindPeer(ctx, p) - }) - pi, _ := vInt.(peer.AddrInfo) - return pi, err -} - -func (r Parallel) Provide(ctx context.Context, c cid.Cid, local bool) error { - return r.filter(func(ri routing.Routing) bool { - return supportsContent(ri) - }).put(func(ri routing.Routing) error { - return ri.Provide(ctx, c, local) - }) -} - -func (r Parallel) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan peer.AddrInfo { - routers := r.filter(func(ri routing.Routing) bool { - return supportsContent(ri) - }) - - switch len(routers.Routers) { - case 0: - ch := make(chan peer.AddrInfo) - close(ch) - return ch - case 1: - return routers.Routers[0].FindProvidersAsync(ctx, c, count) - } - - out := make(chan peer.AddrInfo) - - ctx, cancel := context.WithCancel(ctx) - - providers := make([]<-chan peer.AddrInfo, len(routers.Routers)) - for i, ri := range routers.Routers { - providers[i] = ri.FindProvidersAsync(ctx, c, count) - } - - go func() { - defer cancel() - defer close(out) - if len(providers) > 8 { - manyProviders(ctx, out, providers, count) - } else { - fewProviders(ctx, out, providers, count) - } - }() - return out -} - -// Unoptimized many provider case. Doing this with reflection is a bit slow but -// definitely simpler. If we start having more than 8 peer routers running in -// parallel, we can revisit this. -func manyProviders(ctx context.Context, out chan<- peer.AddrInfo, in []<-chan peer.AddrInfo, count int) { - found := make(map[peer.ID]struct{}, count) - - selectCases := make([]reflect.SelectCase, len(in)) - for i, ch := range in { - selectCases[i] = reflect.SelectCase{ - Dir: reflect.SelectRecv, - Chan: reflect.ValueOf(ch), - } - } - for count > 0 && len(selectCases) > 0 { - chosen, val, ok := reflect.Select(selectCases) - if !ok { - // Remove the channel - selectCases[chosen] = selectCases[len(selectCases)-1] - selectCases = selectCases[:len(selectCases)-1] - continue - } - - pi := val.Interface().(peer.AddrInfo) - if _, ok := found[pi.ID]; ok { - continue - } - - select { - case out <- pi: - found[pi.ID] = struct{}{} - count-- - case <-ctx.Done(): - return - } - } -} - -// Optimization for few providers (<=8). -func fewProviders(ctx context.Context, out chan<- peer.AddrInfo, in []<-chan peer.AddrInfo, count int) { - if len(in) > 8 { - panic("case only valid for combining fewer than 8 channels") - } - - found := make(map[peer.ID]struct{}, count) - - cases := make([]<-chan peer.AddrInfo, 8) - copy(cases, in) - - // Oh go, what would we do without you! - nch := len(in) - var pi peer.AddrInfo - for nch > 0 && count > 0 { - var ok bool - var selected int - select { - case pi, ok = <-cases[0]: - selected = 0 - case pi, ok = <-cases[1]: - selected = 1 - case pi, ok = <-cases[2]: - selected = 2 - case pi, ok = <-cases[3]: - selected = 3 - case pi, ok = <-cases[4]: - selected = 4 - case pi, ok = <-cases[5]: - selected = 5 - case pi, ok = <-cases[6]: - selected = 6 - case pi, ok = <-cases[7]: - selected = 7 - } - if !ok { - cases[selected] = nil - nch-- - continue - } - if _, ok = found[pi.ID]; ok { - continue - } - - select { - case out <- pi: - found[pi.ID] = struct{}{} - count-- - case <-ctx.Done(): - return - } - } -} - -func (r Parallel) Bootstrap(ctx context.Context) error { - var me multierror.Error - for _, b := range r.Routers { - if err := b.Bootstrap(ctx); err != nil { - me.Errors = append(me.Errors, err) - } - } - return me.ErrorOrNil() -} - -var _ routing.Routing = Parallel{} diff --git a/vendor/github.com/libp2p/go-libp2p-routing-helpers/tiered.go b/vendor/github.com/libp2p/go-libp2p-routing-helpers/tiered.go deleted file mode 100644 index 36fa6caf..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing-helpers/tiered.go +++ /dev/null @@ -1,91 +0,0 @@ -package routinghelpers - -import ( - "context" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - multierror "github.com/hashicorp/go-multierror" - cid "github.com/ipfs/go-cid" - record "github.com/libp2p/go-libp2p-record" -) - -// Tiered is like the Parallel except that GetValue and FindPeer -// are called in series. -type Tiered struct { - Routers []routing.Routing - Validator record.Validator -} - -func (r Tiered) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) error { - return Parallel{Routers: r.Routers}.PutValue(ctx, key, value, opts...) -} - -func (r Tiered) get(ctx context.Context, do func(routing.Routing) (interface{}, error)) (interface{}, error) { - var errs []error - for _, ri := range r.Routers { - val, err := do(ri) - switch err { - case nil: - return val, nil - case routing.ErrNotFound, routing.ErrNotSupported: - continue - } - if ctx.Err() != nil { - return nil, ctx.Err() - } - errs = append(errs, err) - } - switch len(errs) { - case 0: - return nil, routing.ErrNotFound - case 1: - return nil, errs[0] - default: - return nil, &multierror.Error{Errors: errs} - } -} - -func (r Tiered) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error) { - valInt, err := r.get(ctx, func(ri routing.Routing) (interface{}, error) { - return ri.GetValue(ctx, key, opts...) - }) - val, _ := valInt.([]byte) - return val, err -} - -func (r Tiered) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error) { - return Parallel{Routers: r.Routers, Validator: r.Validator}.SearchValue(ctx, key, opts...) -} - -func (r Tiered) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error) { - vInt, err := r.get(ctx, func(ri routing.Routing) (interface{}, error) { - return routing.GetPublicKey(ri, ctx, p) - }) - val, _ := vInt.(ci.PubKey) - return val, err -} - -func (r Tiered) Provide(ctx context.Context, c cid.Cid, local bool) error { - return Parallel{Routers: r.Routers}.Provide(ctx, c, local) -} - -func (r Tiered) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan peer.AddrInfo { - return Parallel{Routers: r.Routers}.FindProvidersAsync(ctx, c, count) -} - -func (r Tiered) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error) { - valInt, err := r.get(ctx, func(ri routing.Routing) (interface{}, error) { - return ri.FindPeer(ctx, p) - }) - val, _ := valInt.(peer.AddrInfo) - return val, err -} - -func (r Tiered) Bootstrap(ctx context.Context) error { - return Parallel{Routers: r.Routers}.Bootstrap(ctx) -} - -var _ routing.Routing = Tiered{} diff --git a/vendor/github.com/libp2p/go-libp2p-routing/LICENSE b/vendor/github.com/libp2p/go-libp2p-routing/LICENSE deleted file mode 100644 index 55a2d036..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-routing/notifications/deprecated.go b/vendor/github.com/libp2p/go-libp2p-routing/notifications/deprecated.go deleted file mode 100644 index 29e9e925..00000000 --- a/vendor/github.com/libp2p/go-libp2p-routing/notifications/deprecated.go +++ /dev/null @@ -1,48 +0,0 @@ -// Deprecated: use github.com/libp2p/go-libp2p-core/routing instead. -package notifications - -import ( - "context" - - core "github.com/libp2p/go-libp2p-core/routing" -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEventType instead. -type QueryEventType = core.QueryEventType - -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEventBufferSize instead. -// Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate -// or not have the intended effect. -var QueryEventBufferSize = core.QueryEventBufferSize - -const ( - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/SendingQuery instead. - SendingQuery = core.SendingQuery - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/PeerResponse instead. - PeerResponse = core.PeerResponse - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/FinalPeer instead. - FinalPeer = core.FinalPeer - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryError instead. - QueryError = core.QueryError - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/Provider instead. - Provider = core.Provider - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/Value instead. - Value = core.Value - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/AddingPeer instead. - AddingPeer = core.AddingPeer - // Deprecated: use github.com/libp2p/go-libp2p-core/routing/DialingPeer instead. - DialingPeer = core.DialingPeer -) - -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/QueryEvent instead. -type QueryEvent = core.QueryEvent - -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/RegisterForQueryEvents instead. -func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *core.QueryEvent) { - return core.RegisterForQueryEvents(ctx) -} - -// Deprecated: use github.com/libp2p/go-libp2p-core/routing/PublishQueryEvent instead. -func PublishQueryEvent(ctx context.Context, ev *core.QueryEvent) { - core.PublishQueryEvent(ctx, ev) -} diff --git a/vendor/github.com/libp2p/go-libp2p-secio/.travis.yml b/vendor/github.com/libp2p/go-libp2p-secio/.travis.yml deleted file mode 100644 index ab4bd3db..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - - 1.12.x - -env: - global: - - GOTFLAGS="-race -count 2" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-secio/LICENSE b/vendor/github.com/libp2p/go-libp2p-secio/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-secio/README.md b/vendor/github.com/libp2p/go-libp2p-secio/README.md deleted file mode 100644 index ca84a4fd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# go-libp2p-secio - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-secio?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-secio) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-secio.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-secio) - -> go-libp2p's secio encrypted transport - -Package `go-libp2p-secio` is a libp2p [stream security transport](https://github.com/libp2p/go-stream-security). Connections wrapped by `secio` use secure sessions provided by this package to encrypt all traffic. A TLS-like handshake is used to setup the communication channel. - -## Install - -`go-libp2p-secio` is a standard Go module which can be installed with: - -```sh -go get github.com/libp2p/go-libp2p-secio -``` - -This repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of -go 1.11 and later with modules enabled will automatically pull the latest tagged release -by referencing this package. Upgrades to future releases can be managed using `go get`, -or by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies). - -## Usage - -For more information about how `go-libp2p-secio` is used in the libp2p context, you can see the [go-libp2p-conn](https://github.com/libp2p/go-libp2p-conn) module. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-secio/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 2.0.30: QmSVaJe1aRjc78cZARTtf4pqvXERYwihyYhZWoVWceHnsK diff --git a/vendor/github.com/libp2p/go-libp2p-secio/al.go b/vendor/github.com/libp2p/go-libp2p-secio/al.go deleted file mode 100644 index 6423f3f2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/al.go +++ /dev/null @@ -1,122 +0,0 @@ -package secio - -import ( - "errors" - "fmt" - "strings" - - "crypto/aes" - "crypto/cipher" - "crypto/hmac" - "crypto/sha1" - "crypto/sha512" - "hash" - - ci "github.com/libp2p/go-libp2p-core/crypto" - sha256 "github.com/minio/sha256-simd" - bfish "golang.org/x/crypto/blowfish" -) - -// SupportedExchanges is the list of supported ECDH curves -var SupportedExchanges = DefaultSupportedExchanges - -const DefaultSupportedExchanges = "P-256,P-384,P-521" - -// SupportedCiphers is the list of supported Ciphers -var SupportedCiphers = DefaultSupportedCiphers - -const DefaultSupportedCiphers = "AES-256,AES-128,Blowfish" - -// SupportedHashes is the list of supported Hashes -var SupportedHashes = DefaultSupportedHashes - -const DefaultSupportedHashes = "SHA256,SHA512" - -// HMAC carries a hash and its size -type HMAC struct { - hash.Hash - size int -} - -// encParams represent encryption parameters -type encParams struct { - // keys - permanentPubKey ci.PubKey - ephemeralPubKey []byte - keys ci.StretchedKeys - - // selections - curveT string - cipherT string - hashT string - - // cipher + mac - cipher cipher.Stream - mac HMAC -} - -func (e *encParams) makeMacAndCipher() error { - m, err := newMac(e.hashT, e.keys.MacKey) - if err != nil { - return err - } - - bc, err := newBlockCipher(e.cipherT, e.keys.CipherKey) - if err != nil { - return err - } - - e.cipher = cipher.NewCTR(bc, e.keys.IV) - e.mac = m - return nil -} - -func newMac(hashType string, key []byte) (HMAC, error) { - switch hashType { - case "SHA1": - return HMAC{hmac.New(sha1.New, key), sha1.Size}, nil - case "SHA512": - return HMAC{hmac.New(sha512.New, key), sha512.Size}, nil - case "SHA256": - return HMAC{hmac.New(sha256.New, key), sha256.Size}, nil - default: - return HMAC{}, fmt.Errorf("Unrecognized hash type: %s", hashType) - } -} - -func newBlockCipher(cipherT string, key []byte) (cipher.Block, error) { - switch cipherT { - case "AES-128", "AES-256": - return aes.NewCipher(key) - case "Blowfish": - return bfish.NewCipher(key) - default: - return nil, fmt.Errorf("Unrecognized cipher type: %s", cipherT) - } -} - -// Determines which algorithm to use. Note: f(a, b) = f(b, a) -func selectBest(order int, p1, p2 string) (string, error) { - var f, s []string - switch { - case order < 0: - f = strings.Split(p2, ",") - s = strings.Split(p1, ",") - case order > 0: - f = strings.Split(p1, ",") - s = strings.Split(p2, ",") - default: // Exact same preferences. - p := strings.Split(p1, ",") - return p[0], nil - } - - for _, fc := range f { - for _, sc := range s { - if fc == sc { - return fc, nil - } - } - } - - return "", errors.New("No algorithms in common!") -} diff --git a/vendor/github.com/libp2p/go-libp2p-secio/codecov.yml b/vendor/github.com/libp2p/go-libp2p-secio/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-secio/go.mod b/vendor/github.com/libp2p/go-libp2p-secio/go.mod deleted file mode 100644 index 259f7549..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/libp2p/go-libp2p-secio - -go 1.12 - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-buffer-pool v0.0.2 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-testing v0.0.2 - github.com/libp2p/go-msgio v0.0.2 - github.com/minio/sha256-simd v0.1.0 - github.com/multiformats/go-multihash v0.0.5 - golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f -) diff --git a/vendor/github.com/libp2p/go-libp2p-secio/go.sum b/vendor/github.com/libp2p/go-libp2p-secio/go.sum deleted file mode 100644 index 80a4d90c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/go.sum +++ /dev/null @@ -1,159 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security v0.0.1 h1:4kMMrqrt9EUNCNjX1xagSJC+bq16uqjMe9lk1KBMVNs= -github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178 h1:+wsyafI3SBZy7fMT8bTdHyrzKnPJfDShnbfjxXM3uqk= -github.com/libp2p/go-libp2p-core v0.0.0-20190422125857-3a54eb68d178/go.mod h1:GYAqGjbAd2HxtkR5D6HsOp1ZPBrGvCD0eCLX8rQtNMw= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= -github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= -github.com/libp2p/go-libp2p-crypto v0.0.2-0.20190422130203-0dad27f616de/go.mod h1:WJ6wEfm4tBdTVrgE7Mle69TjHcAxZArSmhNasnU5HXg= -github.com/libp2p/go-libp2p-net v0.0.1 h1:xJ4Vh4yKF/XKb8fd1Ev0ebAGzVjMxXzrxG2kjtU+F5Q= -github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c= -github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= -github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= -github.com/libp2p/go-libp2p-peerstore v0.0.1 h1:twKovq8YK5trLrd3nB7PD2Zu9JcyAIdm7Bz9yBWjhq8= -github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20= -github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= -github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-testing v0.0.2 h1:p9ySW7MFvGGs83hAAe0MPGnjy/tPjl5KyxpMkojdZ+g= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-secio/pb/Makefile b/vendor/github.com/libp2p/go-libp2p-secio/pb/Makefile deleted file mode 100644 index df34e54b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofaster_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.pb.go b/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.pb.go deleted file mode 100644 index 0f3236e2..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.pb.go +++ /dev/null @@ -1,757 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: spipe.proto - -package spipe_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Propose struct { - Rand []byte `protobuf:"bytes,1,opt,name=rand" json:"rand"` - Pubkey []byte `protobuf:"bytes,2,opt,name=pubkey" json:"pubkey"` - Exchanges string `protobuf:"bytes,3,opt,name=exchanges" json:"exchanges"` - Ciphers string `protobuf:"bytes,4,opt,name=ciphers" json:"ciphers"` - Hashes string `protobuf:"bytes,5,opt,name=hashes" json:"hashes"` -} - -func (m *Propose) Reset() { *m = Propose{} } -func (m *Propose) String() string { return proto.CompactTextString(m) } -func (*Propose) ProtoMessage() {} -func (*Propose) Descriptor() ([]byte, []int) { - return fileDescriptor_c474ec75f0379e64, []int{0} -} -func (m *Propose) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Propose) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Propose.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Propose) XXX_Merge(src proto.Message) { - xxx_messageInfo_Propose.Merge(m, src) -} -func (m *Propose) XXX_Size() int { - return m.Size() -} -func (m *Propose) XXX_DiscardUnknown() { - xxx_messageInfo_Propose.DiscardUnknown(m) -} - -var xxx_messageInfo_Propose proto.InternalMessageInfo - -func (m *Propose) GetRand() []byte { - if m != nil { - return m.Rand - } - return nil -} - -func (m *Propose) GetPubkey() []byte { - if m != nil { - return m.Pubkey - } - return nil -} - -func (m *Propose) GetExchanges() string { - if m != nil { - return m.Exchanges - } - return "" -} - -func (m *Propose) GetCiphers() string { - if m != nil { - return m.Ciphers - } - return "" -} - -func (m *Propose) GetHashes() string { - if m != nil { - return m.Hashes - } - return "" -} - -type Exchange struct { - Epubkey []byte `protobuf:"bytes,1,opt,name=epubkey" json:"epubkey"` - Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature"` -} - -func (m *Exchange) Reset() { *m = Exchange{} } -func (m *Exchange) String() string { return proto.CompactTextString(m) } -func (*Exchange) ProtoMessage() {} -func (*Exchange) Descriptor() ([]byte, []int) { - return fileDescriptor_c474ec75f0379e64, []int{1} -} -func (m *Exchange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Exchange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Exchange.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Exchange) XXX_Merge(src proto.Message) { - xxx_messageInfo_Exchange.Merge(m, src) -} -func (m *Exchange) XXX_Size() int { - return m.Size() -} -func (m *Exchange) XXX_DiscardUnknown() { - xxx_messageInfo_Exchange.DiscardUnknown(m) -} - -var xxx_messageInfo_Exchange proto.InternalMessageInfo - -func (m *Exchange) GetEpubkey() []byte { - if m != nil { - return m.Epubkey - } - return nil -} - -func (m *Exchange) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func init() { - proto.RegisterType((*Propose)(nil), "spipe.pb.Propose") - proto.RegisterType((*Exchange)(nil), "spipe.pb.Exchange") -} - -func init() { proto.RegisterFile("spipe.proto", fileDescriptor_c474ec75f0379e64) } - -var fileDescriptor_c474ec75f0379e64 = []byte{ - // 207 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x2e, 0xc8, 0x2c, - 0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0x72, 0x92, 0x94, 0x16, 0x33, 0x72, - 0xb1, 0x07, 0x14, 0xe5, 0x17, 0xe4, 0x17, 0xa7, 0x0a, 0x49, 0x70, 0xb1, 0x14, 0x25, 0xe6, 0xa5, - 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x16, 0x11, - 0x92, 0xe1, 0x62, 0x2b, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0x94, 0x60, 0x42, 0x92, 0x83, 0x8a, 0x09, - 0x29, 0x71, 0x71, 0xa6, 0x56, 0x24, 0x67, 0x24, 0xe6, 0xa5, 0xa7, 0x16, 0x4b, 0x30, 0x2b, 0x30, - 0x6a, 0x70, 0x42, 0x15, 0x20, 0x84, 0x85, 0xe4, 0xb8, 0xd8, 0x93, 0x33, 0x0b, 0x32, 0x52, 0x8b, - 0x8a, 0x25, 0x58, 0x90, 0x54, 0xc0, 0x04, 0x41, 0x36, 0x64, 0x24, 0x16, 0x67, 0xa4, 0x16, 0x4b, - 0xb0, 0x22, 0x49, 0x43, 0xc5, 0x94, 0xfc, 0xb8, 0x38, 0x5c, 0xa1, 0x46, 0x81, 0x4c, 0x4a, 0x85, - 0x3a, 0x06, 0xd9, 0xa1, 0x30, 0x41, 0x90, 0x6b, 0x8a, 0x33, 0xd3, 0xf3, 0x12, 0x4b, 0x4a, 0x8b, - 0x52, 0x51, 0x9c, 0x8b, 0x10, 0x76, 0x92, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, - 0x06, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x0d, 0xc4, 0xcb, 0x27, 0x01, 0x00, 0x00, -} - -func (m *Propose) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Propose) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Rand != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Rand))) - i += copy(dAtA[i:], m.Rand) - } - if m.Pubkey != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Pubkey))) - i += copy(dAtA[i:], m.Pubkey) - } - dAtA[i] = 0x1a - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Exchanges))) - i += copy(dAtA[i:], m.Exchanges) - dAtA[i] = 0x22 - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Ciphers))) - i += copy(dAtA[i:], m.Ciphers) - dAtA[i] = 0x2a - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Hashes))) - i += copy(dAtA[i:], m.Hashes) - return i, nil -} - -func (m *Exchange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Exchange) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Epubkey != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Epubkey))) - i += copy(dAtA[i:], m.Epubkey) - } - if m.Signature != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintSpipe(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - return i, nil -} - -func encodeVarintSpipe(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Propose) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Rand != nil { - l = len(m.Rand) - n += 1 + l + sovSpipe(uint64(l)) - } - if m.Pubkey != nil { - l = len(m.Pubkey) - n += 1 + l + sovSpipe(uint64(l)) - } - l = len(m.Exchanges) - n += 1 + l + sovSpipe(uint64(l)) - l = len(m.Ciphers) - n += 1 + l + sovSpipe(uint64(l)) - l = len(m.Hashes) - n += 1 + l + sovSpipe(uint64(l)) - return n -} - -func (m *Exchange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Epubkey != nil { - l = len(m.Epubkey) - n += 1 + l + sovSpipe(uint64(l)) - } - if m.Signature != nil { - l = len(m.Signature) - n += 1 + l + sovSpipe(uint64(l)) - } - return n -} - -func sovSpipe(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozSpipe(x uint64) (n int) { - return sovSpipe(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Propose) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Propose: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Propose: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rand", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Rand = append(m.Rand[:0], dAtA[iNdEx:postIndex]...) - if m.Rand == nil { - m.Rand = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pubkey = append(m.Pubkey[:0], dAtA[iNdEx:postIndex]...) - if m.Pubkey == nil { - m.Pubkey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exchanges", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Exchanges = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ciphers", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ciphers = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hashes = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpipe(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSpipe - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthSpipe - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Exchange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Exchange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Exchange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Epubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Epubkey = append(m.Epubkey[:0], dAtA[iNdEx:postIndex]...) - if m.Epubkey == nil { - m.Epubkey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpipe - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSpipe - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSpipe - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpipe(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSpipe - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthSpipe - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSpipe(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSpipe - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSpipe - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSpipe - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthSpipe - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthSpipe - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSpipe - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipSpipe(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthSpipe - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthSpipe = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSpipe = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.proto b/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.proto deleted file mode 100644 index ed5f3a78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/pb/spipe.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto2"; - -package spipe.pb; - -message Propose { - optional bytes rand = 1; - optional bytes pubkey = 2; - optional string exchanges = 3; - optional string ciphers = 4; - optional string hashes = 5; -} - -message Exchange { - optional bytes epubkey = 1; - optional bytes signature = 2; -} diff --git a/vendor/github.com/libp2p/go-libp2p-secio/protocol.go b/vendor/github.com/libp2p/go-libp2p-secio/protocol.go deleted file mode 100644 index 40848ddd..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/protocol.go +++ /dev/null @@ -1,387 +0,0 @@ -package secio - -import ( - "bytes" - "context" - "crypto/rand" - "errors" - "fmt" - "net" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" - - proto "github.com/gogo/protobuf/proto" - logging "github.com/ipfs/go-log" - ci "github.com/libp2p/go-libp2p-core/crypto" - pb "github.com/libp2p/go-libp2p-secio/pb" - msgio "github.com/libp2p/go-msgio" - mh "github.com/multiformats/go-multihash" -) - -var log = logging.Logger("secio") - -// ErrUnsupportedKeyType is returned when a private key cast/type switch fails. -var ErrUnsupportedKeyType = errors.New("unsupported key type") - -// ErrClosed signals the closing of a connection. -var ErrClosed = errors.New("connection closed") - -// ErrWrongPeer is returned when we attempt to handshake with the wrong peer. -var ErrWrongPeer = errors.New("connected to wrong peer") - -// ErrBadSig signals that the peer sent us a handshake packet with a bad signature. -var ErrBadSig = errors.New("bad signature") - -// ErrEcho is returned when we're attempting to handshake with the same keys and nonces. -var ErrEcho = errors.New("same keys and nonces. one side talking to self") - -// HandshakeTimeout governs how long the handshake will be allowed to take place for. -// Making this number large means there could be many bogus connections waiting to -// timeout in flight. Typical handshakes take ~3RTTs, so it should be completed within -// seconds across a typical planet in the solar system. -var HandshakeTimeout = time.Second * 30 - -// nonceSize is the size of our nonces (in bytes) -const nonceSize = 16 - -// secureSession encapsulates all the parameters needed for encrypting -// and decrypting traffic from an insecure channel. -type secureSession struct { - msgio.ReadWriteCloser - - insecure net.Conn - insecureM msgio.ReadWriter - - localKey ci.PrivKey - localPeer peer.ID - remotePeer peer.ID - - local encParams - remote encParams - - sharedSecret []byte -} - -var _ sec.SecureConn = &secureSession{} - -func (s *secureSession) Loggable() map[string]interface{} { - m := make(map[string]interface{}) - m["localPeer"] = s.localPeer.Pretty() - m["remotePeer"] = s.remotePeer.Pretty() - m["established"] = (s.ReadWriteCloser != nil) - return m -} - -func newSecureSession(ctx context.Context, local peer.ID, key ci.PrivKey, insecure net.Conn, remotePeer peer.ID) (*secureSession, error) { - s := &secureSession{localPeer: local, localKey: key} - - switch { - case s.localPeer == "": - return nil, errors.New("no local id provided") - case s.localKey == nil: - return nil, errors.New("no local private key provided") - case !s.localPeer.MatchesPrivateKey(s.localKey): - return nil, fmt.Errorf("peer.ID does not match PrivateKey") - case insecure == nil: - return nil, fmt.Errorf("insecure ReadWriter is nil") - } - - s.insecure = insecure - s.insecureM = msgio.NewReadWriter(insecure) - s.remotePeer = remotePeer - - handshakeCtx, cancel := context.WithTimeout(ctx, HandshakeTimeout) // remove - defer cancel() - if err := s.runHandshake(handshakeCtx); err != nil { - return nil, err - } - - return s, nil -} - -func hashSha256(data []byte) mh.Multihash { - h, err := mh.Sum(data, mh.SHA2_256, -1) - if err != nil { - // this error can be safely ignored (panic) because multihash only fails - // from the selection of hash function. If the fn + length are valid, it - // won't error. - panic("multihash failed to hash using SHA2_256.") - } - return h -} - -// runHandshake performs initial communication over insecure channel to share -// keys, IDs, and initiate communication, assigning all necessary params. -// requires the duplex channel to be a msgio.ReadWriter (for framed messaging) -func (s *secureSession) runHandshake(ctx context.Context) error { - defer log.EventBegin(ctx, "secureHandshake", s).Done() - - result := make(chan error, 1) - go func() { - // do *not* close the channel (will look like a success). - result <- s.runHandshakeSync() - }() - - var err error - select { - case <-ctx.Done(): - // State unknown. We *have* to close this. - s.insecure.Close() - err = ctx.Err() - case err = <-result: - } - return err -} - -func (s *secureSession) runHandshakeSync() error { - // ============================================================================= - // step 1. Propose -- propose cipher suite + send pubkeys + nonce - - // Generate and send Hello packet. - // Hello = (rand, PublicKey, Supported) - nonceOut := make([]byte, nonceSize) - _, err := rand.Read(nonceOut) - if err != nil { - return err - } - - s.local.permanentPubKey = s.localKey.GetPublic() - myPubKeyBytes, err := s.local.permanentPubKey.Bytes() - if err != nil { - return err - } - - proposeOut := new(pb.Propose) - proposeOut.Rand = nonceOut - proposeOut.Pubkey = myPubKeyBytes - proposeOut.Exchanges = SupportedExchanges - proposeOut.Ciphers = SupportedCiphers - proposeOut.Hashes = SupportedHashes - - // log.Debugf("1.0 Propose: nonce:%s exchanges:%s ciphers:%s hashes:%s", - // nonceOut, SupportedExchanges, SupportedCiphers, SupportedHashes) - - // Marshal our propose packet - proposeOutBytes, err := proto.Marshal(proposeOut) - if err != nil { - return err - } - - // Send Propose packet and Receive their Propose packet - proposeInBytes, err := readWriteMsg(s.insecureM, proposeOutBytes) - if err != nil { - return err - } - defer s.insecureM.ReleaseMsg(proposeInBytes) - - // Parse their propose packet - proposeIn := new(pb.Propose) - if err = proto.Unmarshal(proposeInBytes, proposeIn); err != nil { - return err - } - - // log.Debugf("1.0.1 Propose recv: nonce:%s exchanges:%s ciphers:%s hashes:%s", - // proposeIn.GetRand(), proposeIn.GetExchanges(), proposeIn.GetCiphers(), proposeIn.GetHashes()) - - // ============================================================================= - // step 1.1 Identify -- get identity from their key - - // get remote identity - s.remote.permanentPubKey, err = ci.UnmarshalPublicKey(proposeIn.GetPubkey()) - if err != nil { - return err - } - - // get peer id - actualRemotePeer, err := peer.IDFromPublicKey(s.remote.permanentPubKey) - if err != nil { - return err - } - switch s.remotePeer { - case actualRemotePeer: - // All good. - case "": - // No peer set. We're accepting a remote connection. - s.remotePeer = actualRemotePeer - default: - // Peer mismatch. Bail. - s.insecure.Close() - log.Debugf("expected peer %s, got peer %s", s.remotePeer, actualRemotePeer) - return ErrWrongPeer - } - - log.Debugf("1.1 Identify: %s Remote Peer Identified as %s", s.localPeer, s.remotePeer) - - // ============================================================================= - // step 1.2 Selection -- select/agree on best encryption parameters - - // to determine order, use cmp(H(remote_pubkey||local_rand), H(local_pubkey||remote_rand)). - oh1 := hashSha256(append(proposeIn.GetPubkey(), nonceOut...)) - oh2 := hashSha256(append(myPubKeyBytes, proposeIn.GetRand()...)) - order := bytes.Compare(oh1, oh2) - if order == 0 { - return ErrEcho // talking to self (same socket. must be reuseport + dialing self) - } - - s.local.curveT, err = selectBest(order, SupportedExchanges, proposeIn.GetExchanges()) - if err != nil { - return err - } - - s.local.cipherT, err = selectBest(order, SupportedCiphers, proposeIn.GetCiphers()) - if err != nil { - return err - } - - s.local.hashT, err = selectBest(order, SupportedHashes, proposeIn.GetHashes()) - if err != nil { - return err - } - - // we use the same params for both directions (must choose same curve) - // WARNING: if they dont SelectBest the same way, this won't work... - s.remote.curveT = s.local.curveT - s.remote.cipherT = s.local.cipherT - s.remote.hashT = s.local.hashT - - // log.Debugf("1.2 selection: exchange:%s cipher:%s hash:%s", - // s.local.curveT, s.local.cipherT, s.local.hashT) - - // ============================================================================= - // step 2. Exchange -- exchange (signed) ephemeral keys. verify signatures. - - // Generate EphemeralPubKey - var genSharedKey ci.GenSharedKey - s.local.ephemeralPubKey, genSharedKey, err = ci.GenerateEKeyPair(s.local.curveT) - if err != nil { - return err - } - - // Gather corpus to sign. - selectionOut := new(bytes.Buffer) - selectionOut.Write(proposeOutBytes) - selectionOut.Write(proposeInBytes) - selectionOut.Write(s.local.ephemeralPubKey) - selectionOutBytes := selectionOut.Bytes() - - // log.Debugf("2.0 exchange: %v", selectionOutBytes) - exchangeOut := new(pb.Exchange) - exchangeOut.Epubkey = s.local.ephemeralPubKey - exchangeOut.Signature, err = s.localKey.Sign(selectionOutBytes) - if err != nil { - return err - } - - // Marshal our exchange packet - exchangeOutBytes, err := proto.Marshal(exchangeOut) - if err != nil { - return err - } - - // Send Exchange packet and receive their Exchange packet - exchangeInBytes, err := readWriteMsg(s.insecureM, exchangeOutBytes) - if err != nil { - return err - } - defer s.insecureM.ReleaseMsg(exchangeInBytes) - - // Parse their Exchange packet. - exchangeIn := new(pb.Exchange) - if err = proto.Unmarshal(exchangeInBytes, exchangeIn); err != nil { - return err - } - - // ============================================================================= - // step 2.1. Verify -- verify their exchange packet is good. - - // get their ephemeral pub key - s.remote.ephemeralPubKey = exchangeIn.GetEpubkey() - - selectionIn := new(bytes.Buffer) - selectionIn.Write(proposeInBytes) - selectionIn.Write(proposeOutBytes) - selectionIn.Write(s.remote.ephemeralPubKey) - selectionInBytes := selectionIn.Bytes() - // log.Debugf("2.0.1 exchange recv: %v", selectionInBytes) - - // u.POut("Remote Peer Identified as %s\n", s.remote) - sigOK, err := s.remote.permanentPubKey.Verify(selectionInBytes, exchangeIn.GetSignature()) - if err != nil { - // log.Error("2.1 Verify: failed: %s", err) - return err - } - - if !sigOK { - // log.Error("2.1 Verify: failed: %s", ErrBadSig) - return ErrBadSig - } - // log.Debugf("2.1 Verify: signature verified.") - - // ============================================================================= - // step 2.2. Keys -- generate keys for mac + encryption - - // OK! seems like we're good to go. - s.sharedSecret, err = genSharedKey(exchangeIn.GetEpubkey()) - if err != nil { - return err - } - - // generate two sets of keys (stretching) - k1, k2 := ci.KeyStretcher(s.local.cipherT, s.local.hashT, s.sharedSecret) - - // use random nonces to decide order. - switch { - case order > 0: - // just break - case order < 0: - k1, k2 = k2, k1 // swap - default: - // we should've bailed before this. but if not, bail here. - return ErrEcho - } - s.local.keys = k1 - s.remote.keys = k2 - - // log.Debug("2.2 keys:\n\tshared: %v\n\tk1: %v\n\tk2: %v", - // s.sharedSecret, s.local.keys, s.remote.keys) - - // ============================================================================= - // step 2.3. MAC + Cipher -- prepare MAC + cipher - - if err := s.local.makeMacAndCipher(); err != nil { - return err - } - - if err := s.remote.makeMacAndCipher(); err != nil { - return err - } - - // log.Debug("2.3 mac + cipher.") - - // ============================================================================= - // step 3. Finish -- send expected message to verify encryption works (send local nonce) - - // setup ETM ReadWriter - w := NewETMWriter(s.insecure, s.local.cipher, s.local.mac) - r := NewETMReader(s.insecure, s.remote.cipher, s.remote.mac) - s.ReadWriteCloser = msgio.Combine(w, r).(msgio.ReadWriteCloser) - - // log.Debug("3.0 finish. sending: %v", proposeIn.GetRand()) - - // send their Nonce and receive ours - nonceOut2, err := readWriteMsg(s.ReadWriteCloser, proposeIn.GetRand()) - if err != nil { - return err - } - defer s.ReleaseMsg(nonceOut2) - - // log.Debug("3.0 finish.\n\texpect: %v\n\tactual: %v", nonceOut, nonceOut2) - if !bytes.Equal(nonceOut, nonceOut2) { - return fmt.Errorf("Failed to read our encrypted nonce: %s != %s", nonceOut2, nonceOut) - } - - // Whew! ok, that's all folks. - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-secio/rw.go b/vendor/github.com/libp2p/go-libp2p-secio/rw.go deleted file mode 100644 index 6a084023..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/rw.go +++ /dev/null @@ -1,268 +0,0 @@ -package secio - -import ( - "crypto/cipher" - "crypto/hmac" - "encoding/binary" - "errors" - "fmt" - "io" - "sync" - - pool "github.com/libp2p/go-buffer-pool" - msgio "github.com/libp2p/go-msgio" -) - -// ErrMACInvalid signals that a MAC verification failed -var ErrMACInvalid = errors.New("MAC verification failed") - -type etmWriter struct { - str cipher.Stream // the stream cipher to encrypt with - mac HMAC // the mac to authenticate data with - w io.Writer - - sync.Mutex -} - -// NewETMWriter Encrypt-Then-MAC -func NewETMWriter(w io.Writer, s cipher.Stream, mac HMAC) msgio.WriteCloser { - return &etmWriter{w: w, str: s, mac: mac} -} - -// Write writes passed in buffer as a single message. -func (w *etmWriter) Write(b []byte) (int, error) { - if err := w.WriteMsg(b); err != nil { - return 0, err - } - return len(b), nil -} - -// WriteMsg writes the msg in the passed in buffer. -func (w *etmWriter) WriteMsg(b []byte) error { - w.Lock() - defer w.Unlock() - - // encrypt. - buf := pool.Get(4 + len(b) + w.mac.Size()) - defer pool.Put(buf) - data := buf[4 : 4+len(b)] - w.str.XORKeyStream(data, b) - - // log.Debugf("ENC plaintext (%d): %s %v", len(b), b, b) - // log.Debugf("ENC ciphertext (%d): %s %v", len(data), data, data) - - // then, mac. - if _, err := w.mac.Write(data); err != nil { - return err - } - - // Sum appends. - data = w.mac.Sum(data) - w.mac.Reset() - binary.BigEndian.PutUint32(buf[:4], uint32(len(data))) - - _, err := w.w.Write(buf) - return err -} - -func (w *etmWriter) Close() error { - if c, ok := w.w.(io.Closer); ok { - return c.Close() - } - return nil -} - -type etmReader struct { - msgio.Reader - io.Closer - - // internal buffer returned from the msgio - buf []byte - - // low and high watermark for the buffered data - lowat int - hiwat int - - // params - msg msgio.ReadCloser // msgio for knowing where boundaries lie - str cipher.Stream // the stream cipher to encrypt with - mac HMAC // the mac to authenticate data with - - // internal buffer used for checking MACs, this saves us quite a few - // allocations and should be quite small. - macBuf []byte - - sync.Mutex -} - -// NewETMReader Encrypt-Then-MAC -func NewETMReader(r io.Reader, s cipher.Stream, mac HMAC) msgio.ReadCloser { - return &etmReader{msg: msgio.NewReader(r), str: s, mac: mac} -} - -func (r *etmReader) NextMsgLen() (int, error) { - return r.msg.NextMsgLen() -} - -func (r *etmReader) drain(buf []byte) int { - // Return zero if there is no data remaining in the internal buffer. - if r.lowat == r.hiwat { - return 0 - } - - // Copy data to the output buffer. - n := copy(buf, r.buf[r.lowat:r.hiwat]) - - // Update the low watermark. - r.lowat += n - - // Release the buffer and reset the watermarks if it has been fully read. - if r.lowat == r.hiwat { - r.msg.ReleaseMsg(r.buf) - r.buf = nil - r.lowat = 0 - r.hiwat = 0 - } - - return n -} - -func (r *etmReader) fill() error { - // Read a message from the underlying msgio. - msg, err := r.msg.ReadMsg() - if err != nil { - return err - } - - // Check the MAC. - n, err := r.macCheckThenDecrypt(msg) - if err != nil { - r.msg.ReleaseMsg(msg) - return err - } - - // Retain the buffer so it can be drained from and later released. - r.buf = msg - r.lowat = 0 - r.hiwat = n - - return nil -} - -func (r *etmReader) Read(buf []byte) (int, error) { - r.Lock() - defer r.Unlock() - - // Return buffered data without reading more, if possible. - copied := r.drain(buf) - if copied > 0 { - return copied, nil - } - - // Check the length of the next message. - fullLen, err := r.msg.NextMsgLen() - if err != nil { - return 0, err - } - - // If the destination buffer is too short, fill an internal buffer and then - // drain as much of that into the output buffer as will fit. - if len(buf) < fullLen { - err := r.fill() - if err != nil { - return 0, err - } - - copied := r.drain(buf) - return copied, nil - } - - // Otherwise, read directly into the destination buffer. - n, err := io.ReadFull(r.msg, buf[:fullLen]) - if err != nil { - return 0, err - } - - m, err := r.macCheckThenDecrypt(buf[:n]) - if err != nil { - return 0, err - } - - return m, nil -} - -func (r *etmReader) ReadMsg() ([]byte, error) { - r.Lock() - defer r.Unlock() - - msg, err := r.msg.ReadMsg() - if err != nil { - return nil, err - } - - n, err := r.macCheckThenDecrypt(msg) - if err != nil { - r.msg.ReleaseMsg(msg) - return nil, err - } - return msg[:n], nil -} - -func (r *etmReader) macCheckThenDecrypt(m []byte) (int, error) { - l := len(m) - if l < r.mac.size { - return 0, fmt.Errorf("buffer (%d) shorter than MAC size (%d)", l, r.mac.size) - } - - mark := l - r.mac.size - data := m[:mark] - macd := m[mark:] - - r.mac.Write(data) - r.macBuf = r.mac.Sum(r.macBuf[:0]) - r.mac.Reset() - - // check mac. if failed, return error. - if !hmac.Equal(macd, r.macBuf) { - log.Debug("MAC Invalid:", r.macBuf, "!=", macd) - return 0, ErrMACInvalid - } - - // ok seems good. decrypt. (can decrypt in place, yay!) - // log.Debugf("DEC ciphertext (%d): %s %v", len(data), data, data) - r.str.XORKeyStream(data, data) - // log.Debugf("DEC plaintext (%d): %s %v", len(data), data, data) - - return mark, nil -} - -func (r *etmReader) Close() error { - return r.msg.Close() -} - -// ReleaseMsg signals a buffer can be reused. -func (r *etmReader) ReleaseMsg(b []byte) { - r.msg.ReleaseMsg(b) -} - -// read and write a message at the same time. -func readWriteMsg(c msgio.ReadWriter, out []byte) ([]byte, error) { - wresult := make(chan error) - go func() { - wresult <- c.WriteMsg(out) - }() - - msg, err1 := c.ReadMsg() - - // Always wait for the read to finish. - err2 := <-wresult - - if err1 != nil { - return nil, err1 - } - if err2 != nil { - c.ReleaseMsg(msg) - return nil, err2 - } - return msg, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-secio/transport.go b/vendor/github.com/libp2p/go-libp2p-secio/transport.go deleted file mode 100644 index edd6f8ef..00000000 --- a/vendor/github.com/libp2p/go-libp2p-secio/transport.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package secio is used to encrypt `go-libp2p-conn` connections. Connections wrapped by secio use secure sessions provided by this package to encrypt all traffic. A TLS-like handshake is used to setup the communication channel. -package secio - -import ( - "context" - "net" - "time" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" -) - -// ID is secio's protocol ID (used when negotiating with multistream) -const ID = "/secio/1.0.0" - -// SessionGenerator constructs secure communication sessions for a peer. -type Transport struct { - LocalID peer.ID - PrivateKey ci.PrivKey -} - -func New(sk ci.PrivKey) (*Transport, error) { - id, err := peer.IDFromPrivateKey(sk) - if err != nil { - return nil, err - } - return &Transport{ - LocalID: id, - PrivateKey: sk, - }, nil -} - -var _ sec.SecureTransport = (*Transport)(nil) - -func (sg *Transport) SecureInbound(ctx context.Context, insecure net.Conn) (sec.SecureConn, error) { - return newSecureSession(ctx, sg.LocalID, sg.PrivateKey, insecure, "") -} -func (sg *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error) { - return newSecureSession(ctx, sg.LocalID, sg.PrivateKey, insecure, p) -} - -func (s *secureSession) SetReadDeadline(t time.Time) error { - return s.insecure.SetReadDeadline(t) -} - -func (s *secureSession) SetWriteDeadline(t time.Time) error { - return s.insecure.SetWriteDeadline(t) -} - -func (s *secureSession) SetDeadline(t time.Time) error { - return s.insecure.SetDeadline(t) -} - -func (s *secureSession) RemoteAddr() net.Addr { - return s.insecure.RemoteAddr() -} - -func (s *secureSession) LocalAddr() net.Addr { - return s.insecure.LocalAddr() -} - -// LocalPeer retrieves the local peer. -func (s *secureSession) LocalPeer() peer.ID { - return s.localPeer -} - -// LocalPrivateKey retrieves the local peer's PrivateKey -func (s *secureSession) LocalPrivateKey() ci.PrivKey { - return s.localKey -} - -// RemotePeer retrieves the remote peer. -func (s *secureSession) RemotePeer() peer.ID { - return s.remotePeer -} - -// RemotePublicKey retrieves the remote public key. -func (s *secureSession) RemotePublicKey() ci.PubKey { - return s.remote.permanentPubKey -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/.travis.yml b/vendor/github.com/libp2p/go-libp2p-swarm/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/LICENSE b/vendor/github.com/libp2p/go-libp2p-swarm/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/README.md b/vendor/github.com/libp2p/go-libp2p-swarm/README.md deleted file mode 100644 index 0675fc25..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/README.md +++ /dev/null @@ -1,156 +0,0 @@ -go-libp2p-swarm -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-libp2p-swarm/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-libp2p-swarm?branch=master) -[![Travis CI](https://travis-ci.org/libp2p/go-libp2p-swarm.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-swarm) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> The libp2p swarm manages groups of connections to peers, and handles incoming and outgoing streams. - -The libp2p swarm is the 'low level' interface for working with a given libp2p -network. It gives you more fine grained control over various aspects of the -system. Most applications don't need this level of access, so the `Swarm` is -generally wrapped in a `Host` abstraction that provides a more friendly -interface. See [the host interface](https://github.com/libp2p/go-libp2p-host) -for more info on that. - -## Table of Contents - -- [Install](#install) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Usage - -### Creating a swarm -To construct a swarm, you'll be calling `NewSwarm`. That function looks like this: -```go -swarm, err := NewSwarm(ctx, laddrs, pid, pstore, bwc) -``` - -It takes five items to fully construct a swarm, the first is a go -`context.Context`. This controls the lifetime of the swarm, and all swarm -processes have their lifespan derived from the given context. You can just use -`context.Background()` if you're not concerned with that. - -The next argument is an array of multiaddrs that the swarm will open up -listeners for. Once started, the swarm will start accepting and handling -incoming connections on every given address. This argument is optional, you can -pass `nil` and the swarm will not listen for any incoming connections (but will -still be able to dial out to other peers). - -After that, you'll need to give the swarm an identity in the form of a peer.ID. -If you're not wanting to enable secio (libp2p's transport layer encryption), -then you can pick any string for this value. For example `peer.ID("FooBar123")` -would work. Note that passing a random string ID will result in your node not -being able to communicate with other peers that have correctly generated IDs. -To see how to generate a proper ID, see the below section on "Identity -Generation". - -The fourth argument is a peerstore. This is essentially a database that the -swarm will use to store peer IDs, addresses, public keys, protocol preferences -and more. You can construct one by importing -`github.com/libp2p/go-libp2p-peerstore` and calling `peerstore.NewPeerstore()`. - -The final argument is a bandwidth metrics collector, This is used to track -incoming and outgoing bandwidth on connections managed by this swarm. It is -optional, and passing `nil` will simply result in no metrics for connections -being available. - -#### Identity Generation -A proper libp2p identity is PKI based. We currently have support for RSA and ed25519 keys. To create a 'correct' ID, you'll need to either load or generate a new keypair. Here is an example of doing so: - -```go -import ( - "fmt" - "crypto/rand" - - ci "github.com/libp2p/go-libp2p-crypto" - pstore "github.com/libp2p/go-libp2p-peerstore" - peer "github.com/libp2p/go-libp2p-peer" -) - -func demo() { - // First, select a source of entropy. We're using the stdlib's crypto reader here - src := rand.Reader - - // Now create a 2048 bit RSA key using that - priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, src) - if err != nil { - panic(err) // oh no! - } - - // Now that we have a keypair, lets create our identity from it - pid, err := peer.IDFromPrivateKey(priv) - if err != nil { - panic(err) - } - - // Woo! Identity acquired! - fmt.Println("I am ", pid) - - // Now, for the purposes of building a swarm, lets add this all to a peerstore. - ps := pstore.NewPeerstore() - ps.AddPubKey(pid, pub) - ps.AddPrivKey(pid, priv) - - // Once you've got all that, creating a basic swarm can be as easy as - ctx := context.Background() - swarm, err := NewSwarm(ctx, nil, pid, ps, nil) - - // voila! A functioning swarm! -} -``` - -### Streams -The swarm is designed around using multiplexed streams to communicate with -other peers. When working with a swarm, you will want to set a function to -handle incoming streams from your peers: - -```go -swrm.SetStreamHandler(func(s inet.Stream) { - defer s.Close() - fmt.Println("Got a stream from: ", s.SwarmConn().RemotePeer()) - fmt.Fprintln(s, "Hello Friend!") -}) -``` - -Tip: Always make sure to close streams when you're done with them. - -Opening streams is also pretty simple: -```go -s, err := swrm.NewStreamWithPeer(ctx, rpid) -if err != nil { - panic(err) -} -defer s.Close() - -io.Copy(os.Stdout, s) // pipe the stream to stdout -``` - -Just pass a context and the ID of the peer you want a stream to, and you'll get -back a stream to read and write on. - - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson - ---- - -The last gx published version of this module was: 3.0.35: QmQVoMEL1CxrVusTSUdYsiJXVBnvSqNUpBsGybkwSfksEF diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/addrs.go b/vendor/github.com/libp2p/go-libp2p-swarm/addrs.go deleted file mode 100644 index ed510f26..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/addrs.go +++ /dev/null @@ -1,35 +0,0 @@ -package swarm - -import ( - mafilter "github.com/libp2p/go-maddr-filter" - mamask "github.com/whyrusleeping/multiaddr-filter" -) - -// http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml -var lowTimeoutFilters = mafilter.NewFilters() - -func init() { - for _, p := range []string{ - "/ip4/10.0.0.0/ipcidr/8", - "/ip4/100.64.0.0/ipcidr/10", - "/ip4/169.254.0.0/ipcidr/16", - "/ip4/172.16.0.0/ipcidr/12", - "/ip4/192.0.0.0/ipcidr/24", - "/ip4/192.0.0.0/ipcidr/29", - "/ip4/192.0.0.8/ipcidr/32", - "/ip4/192.0.0.170/ipcidr/32", - "/ip4/192.0.0.171/ipcidr/32", - "/ip4/192.0.2.0/ipcidr/24", - "/ip4/192.168.0.0/ipcidr/16", - "/ip4/198.18.0.0/ipcidr/15", - "/ip4/198.51.100.0/ipcidr/24", - "/ip4/203.0.113.0/ipcidr/24", - "/ip4/240.0.0.0/ipcidr/4", - } { - f, err := mamask.NewMask(p) - if err != nil { - panic("error in lowTimeoutFilters init: " + err.Error()) - } - lowTimeoutFilters.AddDialFilter(f) - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/codecov.yml b/vendor/github.com/libp2p/go-libp2p-swarm/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/dial_error.go b/vendor/github.com/libp2p/go-libp2p-swarm/dial_error.go deleted file mode 100644 index d2179617..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/dial_error.go +++ /dev/null @@ -1,70 +0,0 @@ -package swarm - -import ( - "fmt" - "strings" - - "github.com/libp2p/go-libp2p-core/peer" - - ma "github.com/multiformats/go-multiaddr" -) - -// maxDialDialErrors is the maximum number of dial errors we record -const maxDialDialErrors = 16 - -// DialError is the error type returned when dialing. -type DialError struct { - Peer peer.ID - DialErrors []TransportError - Cause error - Skipped int -} - -func (e *DialError) recordErr(addr ma.Multiaddr, err error) { - if len(e.DialErrors) >= maxDialDialErrors { - e.Skipped++ - return - } - e.DialErrors = append(e.DialErrors, TransportError{ - Address: addr, - Cause: err, - }) -} - -func (e *DialError) Error() string { - var builder strings.Builder - fmt.Fprintf(&builder, "failed to dial %s:", e.Peer) - if e.Cause != nil { - fmt.Fprintf(&builder, " %s", e.Cause) - } - for _, te := range e.DialErrors { - fmt.Fprintf(&builder, "\n * [%s] %s", te.Address, te.Cause) - } - if e.Skipped > 0 { - fmt.Fprintf(&builder, "\n ... skipping %d errors ...", e.Skipped) - } - return builder.String() -} - -// Unwrap implements https://godoc.org/golang.org/x/xerrors#Wrapper. -func (e *DialError) Unwrap() error { - // If we have a context error, that's the "ultimate" error. - if e.Cause != nil { - return e.Cause - } - return nil -} - -var _ error = (*DialError)(nil) - -// TransportError is the error returned when dialing a specific address. -type TransportError struct { - Address ma.Multiaddr - Cause error -} - -func (e *TransportError) Error() string { - return fmt.Sprintf("failed to dial %s: %s", e.Address, e.Cause) -} - -var _ error = (*TransportError)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/dial_sync.go b/vendor/github.com/libp2p/go-libp2p-swarm/dial_sync.go deleted file mode 100644 index f746b9a9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/dial_sync.go +++ /dev/null @@ -1,122 +0,0 @@ -package swarm - -import ( - "context" - "sync" - - "github.com/libp2p/go-libp2p-core/peer" -) - -// DialFunc is the type of function expected by DialSync. -type DialFunc func(context.Context, peer.ID) (*Conn, error) - -// NewDialSync constructs a new DialSync -func NewDialSync(dfn DialFunc) *DialSync { - return &DialSync{ - dials: make(map[peer.ID]*activeDial), - dialFunc: dfn, - } -} - -// DialSync is a dial synchronization helper that ensures that at most one dial -// to any given peer is active at any given time. -type DialSync struct { - dials map[peer.ID]*activeDial - dialsLk sync.Mutex - dialFunc DialFunc -} - -type activeDial struct { - id peer.ID - refCnt int - refCntLk sync.Mutex - cancel func() - - err error - conn *Conn - waitch chan struct{} - - ds *DialSync -} - -func (ad *activeDial) wait(ctx context.Context) (*Conn, error) { - defer ad.decref() - select { - case <-ad.waitch: - return ad.conn, ad.err - case <-ctx.Done(): - return nil, ctx.Err() - } -} - -func (ad *activeDial) incref() { - ad.refCntLk.Lock() - defer ad.refCntLk.Unlock() - ad.refCnt++ -} - -func (ad *activeDial) decref() { - ad.refCntLk.Lock() - ad.refCnt-- - maybeZero := (ad.refCnt <= 0) - ad.refCntLk.Unlock() - - // make sure to always take locks in correct order. - if maybeZero { - ad.ds.dialsLk.Lock() - ad.refCntLk.Lock() - // check again after lock swap drop to make sure nobody else called incref - // in between locks - if ad.refCnt <= 0 { - ad.cancel() - delete(ad.ds.dials, ad.id) - } - ad.refCntLk.Unlock() - ad.ds.dialsLk.Unlock() - } -} - -func (ad *activeDial) start(ctx context.Context) { - ad.conn, ad.err = ad.ds.dialFunc(ctx, ad.id) - close(ad.waitch) - ad.cancel() -} - -func (ds *DialSync) getActiveDial(p peer.ID) *activeDial { - ds.dialsLk.Lock() - defer ds.dialsLk.Unlock() - - actd, ok := ds.dials[p] - if !ok { - adctx, cancel := context.WithCancel(context.Background()) - actd = &activeDial{ - id: p, - cancel: cancel, - waitch: make(chan struct{}), - ds: ds, - } - ds.dials[p] = actd - - go actd.start(adctx) - } - - // increase ref count before dropping dialsLk - actd.incref() - - return actd -} - -// DialLock initiates a dial to the given peer if there are none in progress -// then waits for the dial to that peer to complete. -func (ds *DialSync) DialLock(ctx context.Context, p peer.ID) (*Conn, error) { - return ds.getActiveDial(p).wait(ctx) -} - -// CancelDial cancels all in-progress dials to the given peer. -func (ds *DialSync) CancelDial(p peer.ID) { - ds.dialsLk.Lock() - defer ds.dialsLk.Unlock() - if ad, ok := ds.dials[p]; ok { - ad.cancel() - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/go.mod b/vendor/github.com/libp2p/go-libp2p-swarm/go.mod deleted file mode 100644 index 6d3662d9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/go.mod +++ /dev/null @@ -1,22 +0,0 @@ -module github.com/libp2p/go-libp2p-swarm - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/goprocess v0.1.3 - github.com/libp2p/go-addr-util v0.0.1 - github.com/libp2p/go-conn-security-multistream v0.1.0 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-loggables v0.1.0 - github.com/libp2p/go-libp2p-peerstore v0.1.0 - github.com/libp2p/go-libp2p-secio v0.1.0 - github.com/libp2p/go-libp2p-testing v0.0.3 - github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 - github.com/libp2p/go-libp2p-yamux v0.2.0 - github.com/libp2p/go-maddr-filter v0.0.4 - github.com/libp2p/go-stream-muxer-multistream v0.2.0 - github.com/libp2p/go-tcp-transport v0.1.0 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/whyrusleeping/mafmt v1.2.8 - github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 -) diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/go.sum b/vendor/github.com/libp2p/go-libp2p-swarm/go.sum deleted file mode 100644 index 256f3314..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/go.sum +++ /dev/null @@ -1,202 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/limiter.go b/vendor/github.com/libp2p/go-libp2p-swarm/limiter.go deleted file mode 100644 index 6808dd71..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/limiter.go +++ /dev/null @@ -1,226 +0,0 @@ -package swarm - -import ( - "context" - "os" - "strconv" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - - addrutil "github.com/libp2p/go-addr-util" - ma "github.com/multiformats/go-multiaddr" -) - -type dialResult struct { - Conn transport.CapableConn - Addr ma.Multiaddr - Err error -} - -type dialJob struct { - addr ma.Multiaddr - peer peer.ID - ctx context.Context - resp chan dialResult -} - -func (dj *dialJob) cancelled() bool { - return dj.ctx.Err() != nil -} - -func (dj *dialJob) dialTimeout() time.Duration { - timeout := transport.DialTimeout - if lowTimeoutFilters.AddrBlocked(dj.addr) { - timeout = DialTimeoutLocal - } - - return timeout -} - -type dialLimiter struct { - lk sync.Mutex - - fdConsuming int - fdLimit int - waitingOnFd []*dialJob - - dialFunc dialfunc - - activePerPeer map[peer.ID]int - perPeerLimit int - waitingOnPeerLimit map[peer.ID][]*dialJob -} - -type dialfunc func(context.Context, peer.ID, ma.Multiaddr) (transport.CapableConn, error) - -func newDialLimiter(df dialfunc) *dialLimiter { - fd := ConcurrentFdDials - if env := os.Getenv("LIBP2P_SWARM_FD_LIMIT"); env != "" { - if n, err := strconv.ParseInt(env, 10, 32); err == nil { - fd = int(n) - } - } - return newDialLimiterWithParams(df, fd, DefaultPerPeerRateLimit) -} - -func newDialLimiterWithParams(df dialfunc, fdLimit, perPeerLimit int) *dialLimiter { - return &dialLimiter{ - fdLimit: fdLimit, - perPeerLimit: perPeerLimit, - waitingOnPeerLimit: make(map[peer.ID][]*dialJob), - activePerPeer: make(map[peer.ID]int), - dialFunc: df, - } -} - -// freeFDToken frees FD token and if there are any schedules another waiting dialJob -// in it's place -func (dl *dialLimiter) freeFDToken() { - log.Debugf("[limiter] freeing FD token; waiting: %d; consuming: %d", len(dl.waitingOnFd), dl.fdConsuming) - dl.fdConsuming-- - - for len(dl.waitingOnFd) > 0 { - next := dl.waitingOnFd[0] - dl.waitingOnFd[0] = nil // clear out memory - dl.waitingOnFd = dl.waitingOnFd[1:] - - if len(dl.waitingOnFd) == 0 { - // clear out memory. - dl.waitingOnFd = nil - } - - // Skip over canceled dials instead of queuing up a goroutine. - if next.cancelled() { - dl.freePeerToken(next) - continue - } - dl.fdConsuming++ - - // we already have activePerPeer token at this point so we can just dial - go dl.executeDial(next) - return - } -} - -func (dl *dialLimiter) freePeerToken(dj *dialJob) { - log.Debugf("[limiter] freeing peer token; peer %s; addr: %s; active for peer: %d; waiting on peer limit: %d", - dj.peer, dj.addr, dl.activePerPeer[dj.peer], len(dl.waitingOnPeerLimit[dj.peer])) - // release tokens in reverse order than we take them - dl.activePerPeer[dj.peer]-- - if dl.activePerPeer[dj.peer] == 0 { - delete(dl.activePerPeer, dj.peer) - } - - waitlist := dl.waitingOnPeerLimit[dj.peer] - for len(waitlist) > 0 { - next := waitlist[0] - waitlist[0] = nil // clear out memory - waitlist = waitlist[1:] - - if len(waitlist) == 0 { - delete(dl.waitingOnPeerLimit, next.peer) - } else { - dl.waitingOnPeerLimit[next.peer] = waitlist - } - - if next.cancelled() { - continue - } - - dl.activePerPeer[next.peer]++ // just kidding, we still want this token - - dl.addCheckFdLimit(next) - return - } -} - -func (dl *dialLimiter) finishedDial(dj *dialJob) { - dl.lk.Lock() - defer dl.lk.Unlock() - - if addrutil.IsFDCostlyTransport(dj.addr) { - dl.freeFDToken() - } - - dl.freePeerToken(dj) -} - -func (dl *dialLimiter) addCheckFdLimit(dj *dialJob) { - if addrutil.IsFDCostlyTransport(dj.addr) { - if dl.fdConsuming >= dl.fdLimit { - log.Debugf("[limiter] blocked dial waiting on FD token; peer: %s; addr: %s; consuming: %d; "+ - "limit: %d; waiting: %d", dj.peer, dj.addr, dl.fdConsuming, dl.fdLimit, len(dl.waitingOnFd)) - dl.waitingOnFd = append(dl.waitingOnFd, dj) - return - } - - log.Debugf("[limiter] taking FD token: peer: %s; addr: %s; prev consuming: %d", - dj.peer, dj.addr, dl.fdConsuming) - // take token - dl.fdConsuming++ - } - - log.Debugf("[limiter] executing dial; peer: %s; addr: %s; FD consuming: %d; waiting: %d", - dj.peer, dj.addr, dl.fdConsuming, len(dl.waitingOnFd)) - go dl.executeDial(dj) -} - -func (dl *dialLimiter) addCheckPeerLimit(dj *dialJob) { - if dl.activePerPeer[dj.peer] >= dl.perPeerLimit { - log.Debugf("[limiter] blocked dial waiting on peer limit; peer: %s; addr: %s; active: %d; "+ - "peer limit: %d; waiting: %d", dj.peer, dj.addr, dl.activePerPeer[dj.peer], dl.perPeerLimit, - len(dl.waitingOnPeerLimit[dj.peer])) - wlist := dl.waitingOnPeerLimit[dj.peer] - dl.waitingOnPeerLimit[dj.peer] = append(wlist, dj) - return - } - dl.activePerPeer[dj.peer]++ - - dl.addCheckFdLimit(dj) -} - -// AddDialJob tries to take the needed tokens for starting the given dial job. -// If it acquires all needed tokens, it immediately starts the dial, otherwise -// it will put it on the waitlist for the requested token. -func (dl *dialLimiter) AddDialJob(dj *dialJob) { - dl.lk.Lock() - defer dl.lk.Unlock() - - log.Debugf("[limiter] adding a dial job through limiter: %v", dj.addr) - dl.addCheckPeerLimit(dj) -} - -func (dl *dialLimiter) clearAllPeerDials(p peer.ID) { - dl.lk.Lock() - defer dl.lk.Unlock() - delete(dl.waitingOnPeerLimit, p) - log.Debugf("[limiter] clearing all peer dials: %v", p) - // NB: the waitingOnFd list doesn't need to be cleaned out here, we will - // remove them as we encounter them because they are 'cancelled' at this - // point -} - -// executeDial calls the dialFunc, and reports the result through the response -// channel when finished. Once the response is sent it also releases all tokens -// it held during the dial. -func (dl *dialLimiter) executeDial(j *dialJob) { - defer dl.finishedDial(j) - if j.cancelled() { - return - } - - dctx, cancel := context.WithTimeout(j.ctx, j.dialTimeout()) - defer cancel() - - con, err := dl.dialFunc(dctx, j.peer, j.addr) - select { - case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}: - case <-j.ctx.Done(): - if err == nil { - con.Close() - } - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go deleted file mode 100644 index b14e9cf0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go +++ /dev/null @@ -1,506 +0,0 @@ -package swarm - -import ( - "context" - "errors" - "fmt" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/libp2p/go-libp2p-core/metrics" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/transport" - - logging "github.com/ipfs/go-log" - "github.com/jbenet/goprocess" - goprocessctx "github.com/jbenet/goprocess/context" - - filter "github.com/libp2p/go-maddr-filter" - mafilter "github.com/whyrusleeping/multiaddr-filter" -) - -// DialTimeoutLocal is the maximum duration a Dial to local network address -// is allowed to take. -// This includes the time between dialing the raw network connection, -// protocol selection as well the handshake, if applicable. -var DialTimeoutLocal = 5 * time.Second - -var log = logging.Logger("swarm2") - -// ErrSwarmClosed is returned when one attempts to operate on a closed swarm. -var ErrSwarmClosed = errors.New("swarm closed") - -// ErrAddrFiltered is returned when trying to register a connection to a -// filtered address. You shouldn't see this error unless some underlying -// transport is misbehaving. -var ErrAddrFiltered = errors.New("address filtered") - -// Swarm is a connection muxer, allowing connections to other peers to -// be opened and closed, while still using the same Chan for all -// communication. The Chan sends/receives Messages, which note the -// destination or source Peer. -type Swarm struct { - // Close refcount. This allows us to fully wait for the swarm to be torn - // down before continuing. - refs sync.WaitGroup - - local peer.ID - peers peerstore.Peerstore - - conns struct { - sync.RWMutex - m map[peer.ID][]*Conn - } - - listeners struct { - sync.RWMutex - m map[transport.Listener]struct{} - } - - notifs struct { - sync.RWMutex - m map[network.Notifiee]struct{} - } - - transports struct { - sync.RWMutex - m map[int]transport.Transport - } - - // new connection and stream handlers - connh atomic.Value - streamh atomic.Value - - // dialing helpers - dsync *DialSync - backf DialBackoff - limiter *dialLimiter - - // filters for addresses that shouldnt be dialed (or accepted) - Filters *filter.Filters - - proc goprocess.Process - ctx context.Context - bwc metrics.Reporter -} - -// NewSwarm constructs a Swarm -func NewSwarm(ctx context.Context, local peer.ID, peers peerstore.Peerstore, bwc metrics.Reporter) *Swarm { - s := &Swarm{ - local: local, - peers: peers, - bwc: bwc, - Filters: filter.NewFilters(), - } - - s.conns.m = make(map[peer.ID][]*Conn) - s.listeners.m = make(map[transport.Listener]struct{}) - s.transports.m = make(map[int]transport.Transport) - s.notifs.m = make(map[network.Notifiee]struct{}) - - s.dsync = NewDialSync(s.doDial) - s.limiter = newDialLimiter(s.dialAddr) - s.proc = goprocessctx.WithContextAndTeardown(ctx, s.teardown) - s.ctx = goprocessctx.OnClosingContext(s.proc) - - return s -} - -func (s *Swarm) teardown() error { - // Prevents new connections and/or listeners from being added to the swarm. - - s.listeners.Lock() - listeners := s.listeners.m - s.listeners.m = nil - s.listeners.Unlock() - - s.conns.Lock() - conns := s.conns.m - s.conns.m = nil - s.conns.Unlock() - - // Lots of goroutines but we might as well do this in parallel. We want to shut down as fast as - // possible. - - for l := range listeners { - go func(l transport.Listener) { - if err := l.Close(); err != nil { - log.Errorf("error when shutting down listener: %s", err) - } - }(l) - } - - for _, cs := range conns { - for _, c := range cs { - go func(c *Conn) { - if err := c.Close(); err != nil { - log.Errorf("error when shutting down connection: %s", err) - } - }(c) - } - } - - // Wait for everything to finish. - s.refs.Wait() - - return nil -} - -// AddAddrFilter adds a multiaddr filter to the set of filters the swarm will use to determine which -// addresses not to dial to. -func (s *Swarm) AddAddrFilter(f string) error { - m, err := mafilter.NewMask(f) - if err != nil { - return err - } - - s.Filters.AddDialFilter(m) - return nil -} - -// Process returns the Process of the swarm -func (s *Swarm) Process() goprocess.Process { - return s.proc -} - -func (s *Swarm) addConn(tc transport.CapableConn, dir network.Direction) (*Conn, error) { - // The underlying transport (or the dialer) *should* filter it's own - // connections but we should double check anyways. - raddr := tc.RemoteMultiaddr() - if s.Filters.AddrBlocked(raddr) { - tc.Close() - return nil, ErrAddrFiltered - } - - p := tc.RemotePeer() - - // Add the public key. - if pk := tc.RemotePublicKey(); pk != nil { - s.peers.AddPubKey(p, pk) - } - - // Clear any backoffs - s.backf.Clear(p) - - // Finally, add the peer. - s.conns.Lock() - // Check if we're still online - if s.conns.m == nil { - s.conns.Unlock() - tc.Close() - return nil, ErrSwarmClosed - } - - // Wrap and register the connection. - stat := network.Stat{Direction: dir} - c := &Conn{ - conn: tc, - swarm: s, - stat: stat, - } - c.streams.m = make(map[*Stream]struct{}) - s.conns.m[p] = append(s.conns.m[p], c) - - // Add two swarm refs: - // * One will be decremented after the close notifications fire in Conn.doClose - // * The other will be decremented when Conn.start exits. - s.refs.Add(2) - - // Take the notification lock before releasing the conns lock to block - // Disconnect notifications until after the Connect notifications done. - c.notifyLk.Lock() - s.conns.Unlock() - - // We have a connection now. Cancel all other in-progress dials. - // This should be fast, no reason to wait till later. - s.dsync.CancelDial(p) - - s.notifyAll(func(f network.Notifiee) { - f.Connected(s, c) - }) - c.notifyLk.Unlock() - - c.start() - - // TODO: Get rid of this. We use it for identify but that happen much - // earlier (really, inside the transport and, if not then, during the - // notifications). - if h := s.ConnHandler(); h != nil { - go h(c) - } - - return c, nil -} - -// Peerstore returns this swarms internal Peerstore. -func (s *Swarm) Peerstore() peerstore.Peerstore { - return s.peers -} - -// Context returns the context of the swarm -func (s *Swarm) Context() context.Context { - return s.ctx -} - -// Close stops the Swarm. -func (s *Swarm) Close() error { - return s.proc.Close() -} - -// TODO: We probably don't need the conn handlers. - -// SetConnHandler assigns the handler for new connections. -// You will rarely use this. See SetStreamHandler -func (s *Swarm) SetConnHandler(handler network.ConnHandler) { - s.connh.Store(handler) -} - -// ConnHandler gets the handler for new connections. -func (s *Swarm) ConnHandler() network.ConnHandler { - handler, _ := s.connh.Load().(network.ConnHandler) - return handler -} - -// SetStreamHandler assigns the handler for new streams. -func (s *Swarm) SetStreamHandler(handler network.StreamHandler) { - s.streamh.Store(handler) -} - -// StreamHandler gets the handler for new streams. -func (s *Swarm) StreamHandler() network.StreamHandler { - handler, _ := s.streamh.Load().(network.StreamHandler) - return handler -} - -// NewStream creates a new stream on any available connection to peer, dialing -// if necessary. -func (s *Swarm) NewStream(ctx context.Context, p peer.ID) (network.Stream, error) { - log.Debugf("[%s] opening stream to peer [%s]", s.local, p) - - // Algorithm: - // 1. Find the best connection, otherwise, dial. - // 2. Try opening a stream. - // 3. If the underlying connection is, in fact, closed, close the outer - // connection and try again. We do this in case we have a closed - // connection but don't notice it until we actually try to open a - // stream. - // - // Note: We only dial once. - // - // TODO: Try all connections even if we get an error opening a stream on - // a non-closed connection. - dials := 0 - for { - c := s.bestConnToPeer(p) - if c == nil { - if nodial, _ := network.GetNoDial(ctx); nodial { - return nil, network.ErrNoConn - } - - if dials >= DialAttempts { - return nil, errors.New("max dial attempts exceeded") - } - dials++ - - var err error - c, err = s.dialPeer(ctx, p) - if err != nil { - return nil, err - } - } - s, err := c.NewStream() - if err != nil { - if c.conn.IsClosed() { - continue - } - return nil, err - } - return s, nil - } -} - -// ConnsToPeer returns all the live connections to peer. -func (s *Swarm) ConnsToPeer(p peer.ID) []network.Conn { - // TODO: Consider sorting the connection list best to worst. Currently, - // it's sorted oldest to newest. - s.conns.RLock() - defer s.conns.RUnlock() - conns := s.conns.m[p] - output := make([]network.Conn, len(conns)) - for i, c := range conns { - output[i] = c - } - return output -} - -// bestConnToPeer returns the best connection to peer. -func (s *Swarm) bestConnToPeer(p peer.ID) *Conn { - // Selects the best connection we have to the peer. - // TODO: Prefer some transports over others. Currently, we just select - // the newest non-closed connection with the most streams. - s.conns.RLock() - defer s.conns.RUnlock() - - var best *Conn - bestLen := 0 - for _, c := range s.conns.m[p] { - if c.conn.IsClosed() { - // We *will* garbage collect this soon anyways. - continue - } - c.streams.Lock() - cLen := len(c.streams.m) - c.streams.Unlock() - - if cLen >= bestLen { - best = c - bestLen = cLen - } - - } - return best -} - -// Connectedness returns our "connectedness" state with the given peer. -// -// To check if we have an open connection, use `s.Connectedness(p) == -// network.Connected`. -func (s *Swarm) Connectedness(p peer.ID) network.Connectedness { - if s.bestConnToPeer(p) != nil { - return network.Connected - } - return network.NotConnected -} - -// Conns returns a slice of all connections. -func (s *Swarm) Conns() []network.Conn { - s.conns.RLock() - defer s.conns.RUnlock() - - conns := make([]network.Conn, 0, len(s.conns.m)) - for _, cs := range s.conns.m { - for _, c := range cs { - conns = append(conns, c) - } - } - return conns -} - -// ClosePeer closes all connections to the given peer. -func (s *Swarm) ClosePeer(p peer.ID) error { - conns := s.ConnsToPeer(p) - switch len(conns) { - case 0: - return nil - case 1: - return conns[0].Close() - default: - errCh := make(chan error) - for _, c := range conns { - go func(c network.Conn) { - errCh <- c.Close() - }(c) - } - - var errs []string - for _ = range conns { - err := <-errCh - if err != nil { - errs = append(errs, err.Error()) - } - } - if len(errs) > 0 { - return fmt.Errorf("when disconnecting from peer %s: %s", p, strings.Join(errs, ", ")) - } - return nil - } -} - -// Peers returns a copy of the set of peers swarm is connected to. -func (s *Swarm) Peers() []peer.ID { - s.conns.RLock() - defer s.conns.RUnlock() - peers := make([]peer.ID, 0, len(s.conns.m)) - for p := range s.conns.m { - peers = append(peers, p) - } - - return peers -} - -// LocalPeer returns the local peer swarm is associated to. -func (s *Swarm) LocalPeer() peer.ID { - return s.local -} - -// Backoff returns the DialBackoff object for this swarm. -func (s *Swarm) Backoff() *DialBackoff { - return &s.backf -} - -// notifyAll sends a signal to all Notifiees -func (s *Swarm) notifyAll(notify func(network.Notifiee)) { - var wg sync.WaitGroup - - s.notifs.RLock() - wg.Add(len(s.notifs.m)) - for f := range s.notifs.m { - go func(f network.Notifiee) { - defer wg.Done() - notify(f) - }(f) - } - - wg.Wait() - s.notifs.RUnlock() -} - -// Notify signs up Notifiee to receive signals when events happen -func (s *Swarm) Notify(f network.Notifiee) { - s.notifs.Lock() - s.notifs.m[f] = struct{}{} - s.notifs.Unlock() -} - -// StopNotify unregisters Notifiee fromr receiving signals -func (s *Swarm) StopNotify(f network.Notifiee) { - s.notifs.Lock() - delete(s.notifs.m, f) - s.notifs.Unlock() -} - -func (s *Swarm) removeConn(c *Conn) { - p := c.RemotePeer() - - s.conns.Lock() - defer s.conns.Unlock() - cs := s.conns.m[p] - for i, ci := range cs { - if ci == c { - if len(cs) == 1 { - delete(s.conns.m, p) - } else { - // NOTE: We're intentionally preserving order. - // This way, connections to a peer are always - // sorted oldest to newest. - copy(cs[i:], cs[i+1:]) - cs[len(cs)-1] = nil - s.conns.m[p] = cs[:len(cs)-1] - } - return - } - } -} - -// String returns a string representation of Network. -func (s *Swarm) String() string { - return fmt.Sprintf("", s.LocalPeer()) -} - -// Swarm is a Network. -var _ network.Network = (*Swarm)(nil) -var _ transport.TransportNetwork = (*Swarm)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_addr.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_addr.go deleted file mode 100644 index c86d58bb..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_addr.go +++ /dev/null @@ -1,24 +0,0 @@ -package swarm - -import ( - addrutil "github.com/libp2p/go-addr-util" - ma "github.com/multiformats/go-multiaddr" -) - -// ListenAddresses returns a list of addresses at which this swarm listens. -func (s *Swarm) ListenAddresses() []ma.Multiaddr { - s.listeners.RLock() - defer s.listeners.RUnlock() - addrs := make([]ma.Multiaddr, 0, len(s.listeners.m)) - for l := range s.listeners.m { - addrs = append(addrs, l.Multiaddr()) - } - return addrs -} - -// InterfaceListenAddresses returns a list of addresses at which this swarm -// listens. It expands "any interface" addresses (/ip4/0.0.0.0, /ip6/::) to -// use the known local interfaces. -func (s *Swarm) InterfaceListenAddresses() ([]ma.Multiaddr, error) { - return addrutil.ResolveUnspecifiedAddresses(s.ListenAddresses(), nil) -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_conn.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_conn.go deleted file mode 100644 index cdb9866a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_conn.go +++ /dev/null @@ -1,223 +0,0 @@ -package swarm - -import ( - "errors" - "fmt" - "sync" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - - ma "github.com/multiformats/go-multiaddr" -) - -// TODO: Put this elsewhere. - -// ErrConnClosed is returned when operating on a closed connection. -var ErrConnClosed = errors.New("connection closed") - -// Conn is the connection type used by swarm. In general, you won't use this -// type directly. -type Conn struct { - conn transport.CapableConn - swarm *Swarm - - closeOnce sync.Once - err error - - notifyLk sync.Mutex - - streams struct { - sync.Mutex - m map[*Stream]struct{} - } - - stat network.Stat -} - -// Close closes this connection. -// -// Note: This method won't wait for the close notifications to finish as that -// would create a deadlock when called from an open notification (because all -// open notifications must finish before we can fire off the close -// notifications). -func (c *Conn) Close() error { - c.closeOnce.Do(c.doClose) - return c.err -} - -func (c *Conn) doClose() { - c.swarm.removeConn(c) - - // Prevent new streams from opening. - c.streams.Lock() - streams := c.streams.m - c.streams.m = nil - c.streams.Unlock() - - c.err = c.conn.Close() - - // This is just for cleaning up state. The connection has already been closed. - // We *could* optimize this but it really isn't worth it. - for s := range streams { - s.Reset() - } - - // do this in a goroutine to avoid deadlocking if we call close in an open notification. - go func() { - // prevents us from issuing close notifications before finishing the open notifications - c.notifyLk.Lock() - defer c.notifyLk.Unlock() - - c.swarm.notifyAll(func(f network.Notifiee) { - f.Disconnected(c.swarm, c) - }) - c.swarm.refs.Done() // taken in Swarm.addConn - }() -} - -func (c *Conn) removeStream(s *Stream) { - c.streams.Lock() - delete(c.streams.m, s) - c.streams.Unlock() -} - -// listens for new streams. -// -// The caller must take a swarm ref before calling. This function decrements the -// swarm ref count. -func (c *Conn) start() { - go func() { - defer c.swarm.refs.Done() - defer c.Close() - - for { - ts, err := c.conn.AcceptStream() - if err != nil { - return - } - c.swarm.refs.Add(1) - go func() { - s, err := c.addStream(ts, network.DirInbound) - - // Don't defer this. We don't want to block - // swarm shutdown on the connection handler. - c.swarm.refs.Done() - - // We only get an error here when the swarm is closed or closing. - if err != nil { - return - } - - if h := c.swarm.StreamHandler(); h != nil { - h(s) - } - }() - } - }() -} - -func (c *Conn) String() string { - return fmt.Sprintf( - " %s (%s)>", - c.conn.Transport(), - c.conn.LocalMultiaddr(), - c.conn.LocalPeer().Pretty(), - c.conn.RemoteMultiaddr(), - c.conn.RemotePeer().Pretty(), - ) -} - -// LocalMultiaddr is the Multiaddr on this side -func (c *Conn) LocalMultiaddr() ma.Multiaddr { - return c.conn.LocalMultiaddr() -} - -// LocalPeer is the Peer on our side of the connection -func (c *Conn) LocalPeer() peer.ID { - return c.conn.LocalPeer() -} - -// RemoteMultiaddr is the Multiaddr on the remote side -func (c *Conn) RemoteMultiaddr() ma.Multiaddr { - return c.conn.RemoteMultiaddr() -} - -// RemotePeer is the Peer on the remote side -func (c *Conn) RemotePeer() peer.ID { - return c.conn.RemotePeer() -} - -// LocalPrivateKey is the public key of the peer on this side -func (c *Conn) LocalPrivateKey() ic.PrivKey { - return c.conn.LocalPrivateKey() -} - -// RemotePublicKey is the public key of the peer on the remote side -func (c *Conn) RemotePublicKey() ic.PubKey { - return c.conn.RemotePublicKey() -} - -// Stat returns metadata pertaining to this connection -func (c *Conn) Stat() network.Stat { - return c.stat -} - -// NewStream returns a new Stream from this connection -func (c *Conn) NewStream() (network.Stream, error) { - ts, err := c.conn.OpenStream() - if err != nil { - return nil, err - } - return c.addStream(ts, network.DirOutbound) -} - -func (c *Conn) addStream(ts mux.MuxedStream, dir network.Direction) (*Stream, error) { - c.streams.Lock() - // Are we still online? - if c.streams.m == nil { - c.streams.Unlock() - ts.Reset() - return nil, ErrConnClosed - } - - // Wrap and register the stream. - stat := network.Stat{Direction: dir} - s := &Stream{ - stream: ts, - conn: c, - stat: stat, - } - c.streams.m[s] = struct{}{} - - // Released once the stream disconnect notifications have finished - // firing (in Swarm.remove). - c.swarm.refs.Add(1) - - // Take the notification lock before releasing the streams lock to block - // StreamClose notifications until after the StreamOpen notifications - // done. - s.notifyLk.Lock() - c.streams.Unlock() - - c.swarm.notifyAll(func(f network.Notifiee) { - f.OpenedStream(c.swarm, s) - }) - s.notifyLk.Unlock() - - return s, nil -} - -// GetStreams returns the streams associated with this connection. -func (c *Conn) GetStreams() []network.Stream { - c.streams.Lock() - defer c.streams.Unlock() - streams := make([]network.Stream, 0, len(c.streams.m)) - for s := range c.streams.m { - streams = append(streams, s) - } - return streams -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_dial.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_dial.go deleted file mode 100644 index 40faad78..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_dial.go +++ /dev/null @@ -1,477 +0,0 @@ -package swarm - -import ( - "context" - "errors" - "fmt" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - lgbl "github.com/libp2p/go-libp2p-loggables" - - logging "github.com/ipfs/go-log" - addrutil "github.com/libp2p/go-addr-util" - ma "github.com/multiformats/go-multiaddr" -) - -// Diagram of dial sync: -// -// many callers of Dial() synched w. dials many addrs results to callers -// ----------------------\ dialsync use earliest /-------------- -// -----------------------\ |----------\ /---------------- -// ------------------------>------------<------- >---------<----------------- -// -----------------------| \----x \---------------- -// ----------------------| \-----x \--------------- -// any may fail if no addr at end -// retry dialAttempt x - -var ( - // ErrDialBackoff is returned by the backoff code when a given peer has - // been dialed too frequently - ErrDialBackoff = errors.New("dial backoff") - - // ErrDialToSelf is returned if we attempt to dial our own peer - ErrDialToSelf = errors.New("dial to self attempted") - - // ErrNoTransport is returned when we don't know a transport for the - // given multiaddr. - ErrNoTransport = errors.New("no transport for protocol") - - // ErrAllDialsFailed is returned when connecting to a peer has ultimately failed - ErrAllDialsFailed = errors.New("all dials failed") - - // ErrNoAddresses is returned when we fail to find any addresses for a - // peer we're trying to dial. - ErrNoAddresses = errors.New("no addresses") - - // ErrNoAddresses is returned when we find addresses for a peer but - // can't use any of them. - ErrNoGoodAddresses = errors.New("no good addresses") -) - -// DialAttempts governs how many times a goroutine will try to dial a given peer. -// Note: this is down to one, as we have _too many dials_ atm. To add back in, -// add loop back in Dial(.) -const DialAttempts = 1 - -// ConcurrentFdDials is the number of concurrent outbound dials over transports -// that consume file descriptors -const ConcurrentFdDials = 160 - -// DefaultPerPeerRateLimit is the number of concurrent outbound dials to make -// per peer -const DefaultPerPeerRateLimit = 8 - -// dialbackoff is a struct used to avoid over-dialing the same, dead peers. -// Whenever we totally time out on a peer (all three attempts), we add them -// to dialbackoff. Then, whenevers goroutines would _wait_ (dialsync), they -// check dialbackoff. If it's there, they don't wait and exit promptly with -// an error. (the single goroutine that is actually dialing continues to -// dial). If a dial is successful, the peer is removed from backoff. -// Example: -// -// for { -// if ok, wait := dialsync.Lock(p); !ok { -// if backoff.Backoff(p) { -// return errDialFailed -// } -// <-wait -// continue -// } -// defer dialsync.Unlock(p) -// c, err := actuallyDial(p) -// if err != nil { -// dialbackoff.AddBackoff(p) -// continue -// } -// dialbackoff.Clear(p) -// } -// - -// DialBackoff is a type for tracking peer dial backoffs. -// -// * It's safe to use its zero value. -// * It's thread-safe. -// * It's *not* safe to move this type after using. -type DialBackoff struct { - entries map[peer.ID]*backoffPeer - lock sync.RWMutex -} - -type backoffPeer struct { - tries int - until time.Time -} - -func (db *DialBackoff) init() { - if db.entries == nil { - db.entries = make(map[peer.ID]*backoffPeer) - } -} - -// Backoff returns whether the client should backoff from dialing -// peer p -func (db *DialBackoff) Backoff(p peer.ID) (backoff bool) { - db.lock.Lock() - defer db.lock.Unlock() - db.init() - bp, found := db.entries[p] - if found && time.Now().Before(bp.until) { - return true - } - - return false -} - -// BackoffBase is the base amount of time to backoff (default: 5s). -var BackoffBase = time.Second * 5 - -// BackoffCoef is the backoff coefficient (default: 1s). -var BackoffCoef = time.Second - -// BackoffMax is the maximum backoff time (default: 5m). -var BackoffMax = time.Minute * 5 - -// AddBackoff lets other nodes know that we've entered backoff with -// peer p, so dialers should not wait unnecessarily. We still will -// attempt to dial with one goroutine, in case we get through. -// -// Backoff is not exponential, it's quadratic and computed according to the -// following formula: -// -// BackoffBase + BakoffCoef * PriorBackoffs^2 -// -// Where PriorBackoffs is the number of previous backoffs. -func (db *DialBackoff) AddBackoff(p peer.ID) { - db.lock.Lock() - defer db.lock.Unlock() - db.init() - bp, ok := db.entries[p] - if !ok { - db.entries[p] = &backoffPeer{ - tries: 1, - until: time.Now().Add(BackoffBase), - } - return - } - - backoffTime := BackoffBase + BackoffCoef*time.Duration(bp.tries*bp.tries) - if backoffTime > BackoffMax { - backoffTime = BackoffMax - } - bp.until = time.Now().Add(backoffTime) - bp.tries++ -} - -// Clear removes a backoff record. Clients should call this after a -// successful Dial. -func (db *DialBackoff) Clear(p peer.ID) { - db.lock.Lock() - defer db.lock.Unlock() - db.init() - delete(db.entries, p) -} - -// DialPeer connects to a peer. -// -// The idea is that the client of Swarm does not need to know what network -// the connection will happen over. Swarm can use whichever it choses. -// This allows us to use various transport protocols, do NAT traversal/relay, -// etc. to achieve connection. -func (s *Swarm) DialPeer(ctx context.Context, p peer.ID) (network.Conn, error) { - return s.dialPeer(ctx, p) -} - -// internal dial method that returns an unwrapped conn -// -// It is gated by the swarm's dial synchronization systems: dialsync and -// dialbackoff. -func (s *Swarm) dialPeer(ctx context.Context, p peer.ID) (*Conn, error) { - log.Debugf("[%s] swarm dialing peer [%s]", s.local, p) - var logdial = lgbl.Dial("swarm", s.LocalPeer(), p, nil, nil) - err := p.Validate() - if err != nil { - return nil, err - } - - if p == s.local { - log.Event(ctx, "swarmDialSelf", logdial) - return nil, ErrDialToSelf - } - - defer log.EventBegin(ctx, "swarmDialAttemptSync", p).Done() - - // check if we already have an open connection first - conn := s.bestConnToPeer(p) - if conn != nil { - return conn, nil - } - - // if this peer has been backed off, lets get out of here - if s.backf.Backoff(p) { - log.Event(ctx, "swarmDialBackoff", p) - return nil, ErrDialBackoff - } - - // apply the DialPeer timeout - ctx, cancel := context.WithTimeout(ctx, network.GetDialPeerTimeout(ctx)) - defer cancel() - - conn, err = s.dsync.DialLock(ctx, p) - if err != nil { - return nil, err - } - - log.Debugf("network for %s finished dialing %s", s.local, p) - return conn, err -} - -// doDial is an ugly shim method to retain all the logging and backoff logic -// of the old dialsync code -func (s *Swarm) doDial(ctx context.Context, p peer.ID) (*Conn, error) { - // Short circuit. - // By the time we take the dial lock, we may already *have* a connection - // to the peer. - c := s.bestConnToPeer(p) - if c != nil { - return c, nil - } - - logdial := lgbl.Dial("swarm", s.LocalPeer(), p, nil, nil) - - // ok, we have been charged to dial! let's do it. - // if it succeeds, dial will add the conn to the swarm itself. - defer log.EventBegin(ctx, "swarmDialAttemptStart", logdial).Done() - - conn, err := s.dial(ctx, p) - if err != nil { - conn = s.bestConnToPeer(p) - if conn != nil { - // Hm? What error? - // Could have canceled the dial because we received a - // connection or some other random reason. - // Just ignore the error and return the connection. - log.Debugf("ignoring dial error because we have a connection: %s", err) - return conn, nil - } - if err != context.Canceled { - log.Event(ctx, "swarmDialBackoffAdd", logdial) - s.backf.AddBackoff(p) // let others know to backoff - } - - // ok, we failed. - return nil, err - } - return conn, nil -} - -func (s *Swarm) canDial(addr ma.Multiaddr) bool { - t := s.TransportForDialing(addr) - return t != nil && t.CanDial(addr) -} - -// dial is the actual swarm's dial logic, gated by Dial. -func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) { - var logdial = lgbl.Dial("swarm", s.LocalPeer(), p, nil, nil) - if p == s.local { - log.Event(ctx, "swarmDialDoDialSelf", logdial) - return nil, ErrDialToSelf - } - defer log.EventBegin(ctx, "swarmDialDo", logdial).Done() - logdial["dial"] = "failure" // start off with failure. set to "success" at the end. - - sk := s.peers.PrivKey(s.local) - logdial["encrypted"] = sk != nil // log whether this will be an encrypted dial or not. - if sk == nil { - // fine for sk to be nil, just log. - log.Debug("Dial not given PrivateKey, so WILL NOT SECURE conn.") - } - - ////// - /* - This slice-to-chan code is temporary, the peerstore can currently provide - a channel as an interface for receiving addresses, but more thought - needs to be put into the execution. For now, this allows us to use - the improved rate limiter, while maintaining the outward behaviour - that we previously had (halting a dial when we run out of addrs) - */ - peerAddrs := s.peers.Addrs(p) - if len(peerAddrs) == 0 { - return nil, &DialError{Peer: p, Cause: ErrNoAddresses} - } - goodAddrs := s.filterKnownUndialables(peerAddrs) - if len(goodAddrs) == 0 { - return nil, &DialError{Peer: p, Cause: ErrNoGoodAddresses} - } - goodAddrsChan := make(chan ma.Multiaddr, len(goodAddrs)) - for _, a := range goodAddrs { - goodAddrsChan <- a - } - close(goodAddrsChan) - ///////// - - // try to get a connection to any addr - connC, dialErr := s.dialAddrs(ctx, p, goodAddrsChan) - if dialErr != nil { - logdial["error"] = dialErr.Cause.Error() - if dialErr.Cause == context.Canceled { - // always prefer the "context canceled" error. - // we rely on behing able to check `err == context.Canceled` - // - // Removing this will BREAK backoff (causing us to - // backoff when canceling dials). - return nil, context.Canceled - } - return nil, dialErr - } - logdial["conn"] = logging.Metadata{ - "localAddr": connC.LocalMultiaddr(), - "remoteAddr": connC.RemoteMultiaddr(), - } - swarmC, err := s.addConn(connC, network.DirOutbound) - if err != nil { - logdial["error"] = err.Error() - connC.Close() // close the connection. didn't work out :( - return nil, &DialError{Peer: p, Cause: err} - } - - logdial["dial"] = "success" - return swarmC, nil -} - -// filterKnownUndialables takes a list of multiaddrs, and removes those -// that we definitely don't want to dial: addresses configured to be blocked, -// IPv6 link-local addresses, addresses without a dial-capable transport, -// and addresses that we know to be our own. -// This is an optimization to avoid wasting time on dials that we know are going to fail. -func (s *Swarm) filterKnownUndialables(addrs []ma.Multiaddr) []ma.Multiaddr { - lisAddrs, _ := s.InterfaceListenAddresses() - var ourAddrs []ma.Multiaddr - for _, addr := range lisAddrs { - protos := addr.Protocols() - // we're only sure about filtering out /ip4 and /ip6 addresses, so far - if len(protos) == 2 && (protos[0].Code == ma.P_IP4 || protos[0].Code == ma.P_IP6) { - ourAddrs = append(ourAddrs, addr) - } - } - - return addrutil.FilterAddrs(addrs, - addrutil.SubtractFilter(ourAddrs...), - s.canDial, - // TODO: Consider allowing link-local addresses - addrutil.AddrOverNonLocalIP, - addrutil.FilterNeg(s.Filters.AddrBlocked), - ) -} - -func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.Multiaddr) (transport.CapableConn, *DialError) { - log.Debugf("%s swarm dialing %s", s.local, p) - - ctx, cancel := context.WithCancel(ctx) - defer cancel() // cancel work when we exit func - - // use a single response type instead of errs and conns, reduces complexity *a ton* - respch := make(chan dialResult) - err := new(DialError) - - defer s.limiter.clearAllPeerDials(p) - - var active int -dialLoop: - for remoteAddrs != nil || active > 0 { - // Check for context cancellations and/or responses first. - select { - case <-ctx.Done(): - break dialLoop - case resp := <-respch: - active-- - if resp.Err != nil { - // Errors are normal, lots of dials will fail - log.Infof("got error on dial: %s", resp.Err) - err.recordErr(resp.Addr, resp.Err) - } else if resp.Conn != nil { - return resp.Conn, nil - } - - // We got a result, try again from the top. - continue - default: - } - - // Now, attempt to dial. - select { - case addr, ok := <-remoteAddrs: - if !ok { - remoteAddrs = nil - continue - } - - s.limitedDial(ctx, p, addr, respch) - active++ - case <-ctx.Done(): - break dialLoop - case resp := <-respch: - active-- - if resp.Err != nil { - // Errors are normal, lots of dials will fail - log.Infof("got error on dial: %s", resp.Err) - err.recordErr(resp.Addr, resp.Err) - } else if resp.Conn != nil { - return resp.Conn, nil - } - } - } - - if ctxErr := ctx.Err(); ctxErr != nil { - err.Cause = ctxErr - } else if len(err.DialErrors) == 0 { - err.Cause = network.ErrNoRemoteAddrs - } else { - err.Cause = ErrAllDialsFailed - } - return nil, err -} - -// limitedDial will start a dial to the given peer when -// it is able, respecting the various different types of rate -// limiting that occur without using extra goroutines per addr -func (s *Swarm) limitedDial(ctx context.Context, p peer.ID, a ma.Multiaddr, resp chan dialResult) { - s.limiter.AddDialJob(&dialJob{ - addr: a, - peer: p, - resp: resp, - ctx: ctx, - }) -} - -func (s *Swarm) dialAddr(ctx context.Context, p peer.ID, addr ma.Multiaddr) (transport.CapableConn, error) { - // Just to double check. Costs nothing. - if s.local == p { - return nil, ErrDialToSelf - } - log.Debugf("%s swarm dialing %s %s", s.local, p, addr) - - tpt := s.TransportForDialing(addr) - if tpt == nil { - return nil, ErrNoTransport - } - - connC, err := tpt.Dial(ctx, addr, p) - if err != nil { - return nil, err - } - - // Trust the transport? Yeah... right. - if connC.RemotePeer() != p { - connC.Close() - err = fmt.Errorf("BUG in transport %T: tried to dial %s, dialed %s", p, connC.RemotePeer(), tpt) - log.Error(err) - return nil, err - } - - // success! we got one! - return connC, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_listen.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_listen.go deleted file mode 100644 index 85060c4e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_listen.go +++ /dev/null @@ -1,97 +0,0 @@ -package swarm - -import ( - "fmt" - - "github.com/libp2p/go-libp2p-core/network" - - ma "github.com/multiformats/go-multiaddr" -) - -// Listen sets up listeners for all of the given addresses. -// It returns as long as we successfully listen on at least *one* address. -func (s *Swarm) Listen(addrs ...ma.Multiaddr) error { - errs := make([]error, len(addrs)) - var succeeded int - for i, a := range addrs { - if err := s.AddListenAddr(a); err != nil { - errs[i] = err - } else { - succeeded++ - } - } - - for i, e := range errs { - if e != nil { - log.Warningf("listen on %s failed: %s", addrs[i], errs[i]) - } - } - - if succeeded == 0 && len(addrs) > 0 { - return fmt.Errorf("failed to listen on any addresses: %s", errs) - } - - return nil -} - -// AddListenAddr tells the swarm to listen on a single address. Unlike Listen, -// this method does not attempt to filter out bad addresses. -func (s *Swarm) AddListenAddr(a ma.Multiaddr) error { - tpt := s.TransportForListening(a) - if tpt == nil { - return ErrNoTransport - } - - list, err := tpt.Listen(a) - if err != nil { - return err - } - - s.listeners.Lock() - if s.listeners.m == nil { - s.listeners.Unlock() - list.Close() - return ErrSwarmClosed - } - s.refs.Add(1) - s.listeners.m[list] = struct{}{} - s.listeners.Unlock() - - maddr := list.Multiaddr() - - // signal to our notifiees on successful conn. - s.notifyAll(func(n network.Notifiee) { - n.Listen(s, maddr) - }) - - go func() { - defer func() { - list.Close() - s.listeners.Lock() - delete(s.listeners.m, list) - s.listeners.Unlock() - s.refs.Done() - }() - for { - c, err := list.Accept() - if err != nil { - if s.ctx.Err() == nil { - log.Errorf("swarm listener accept error: %s", err) - } - return - } - log.Debugf("swarm listener accepted connection: %s", c) - s.refs.Add(1) - go func() { - defer s.refs.Done() - _, err := s.addConn(c, network.DirInbound) - if err != nil { - // Probably just means that the swarm has been closed. - log.Warningf("add conn failed: ", err) - return - } - }() - } - }() - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_stream.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_stream.go deleted file mode 100644 index 9dded2a9..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_stream.go +++ /dev/null @@ -1,177 +0,0 @@ -package swarm - -import ( - "fmt" - "io" - "sync" - "sync/atomic" - "time" - - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/protocol" -) - -type streamState int - -const ( - streamOpen streamState = iota - streamCloseRead - streamCloseWrite - streamCloseBoth - streamReset -) - -// Validate Stream conforms to the go-libp2p-net Stream interface -var _ network.Stream = &Stream{} - -// Stream is the stream type used by swarm. In general, you won't use this type -// directly. -type Stream struct { - stream mux.MuxedStream - conn *Conn - - state struct { - sync.Mutex - v streamState - } - - notifyLk sync.Mutex - - protocol atomic.Value - - stat network.Stat -} - -func (s *Stream) String() string { - return fmt.Sprintf( - " %s (%s)>", - s.conn.conn.Transport(), - s.conn.LocalMultiaddr(), - s.conn.LocalPeer(), - s.conn.RemoteMultiaddr(), - s.conn.RemotePeer(), - ) -} - -// Conn returns the Conn associated with this stream, as an network.Conn -func (s *Stream) Conn() network.Conn { - return s.conn -} - -// Read reads bytes from a stream. -func (s *Stream) Read(p []byte) (int, error) { - n, err := s.stream.Read(p) - // TODO: push this down to a lower level for better accuracy. - if s.conn.swarm.bwc != nil { - s.conn.swarm.bwc.LogRecvMessage(int64(n)) - s.conn.swarm.bwc.LogRecvMessageStream(int64(n), s.Protocol(), s.Conn().RemotePeer()) - } - // If we observe an EOF, this stream is now closed for reading. - // If we're already closed for writing, this stream is now fully closed. - if err == io.EOF { - s.state.Lock() - switch s.state.v { - case streamCloseWrite: - s.state.v = streamCloseBoth - s.remove() - case streamOpen: - s.state.v = streamCloseRead - } - s.state.Unlock() - } - return n, err -} - -// Write writes bytes to a stream, flushing for each call. -func (s *Stream) Write(p []byte) (int, error) { - n, err := s.stream.Write(p) - // TODO: push this down to a lower level for better accuracy. - if s.conn.swarm.bwc != nil { - s.conn.swarm.bwc.LogSentMessage(int64(n)) - s.conn.swarm.bwc.LogSentMessageStream(int64(n), s.Protocol(), s.Conn().RemotePeer()) - } - return n, err -} - -// Close closes the stream, indicating this side is finished -// with the stream. -func (s *Stream) Close() error { - err := s.stream.Close() - - s.state.Lock() - switch s.state.v { - case streamCloseRead: - s.state.v = streamCloseBoth - s.remove() - case streamOpen: - s.state.v = streamCloseWrite - } - s.state.Unlock() - return err -} - -// Reset resets the stream, closing both ends. -func (s *Stream) Reset() error { - err := s.stream.Reset() - s.state.Lock() - switch s.state.v { - case streamOpen, streamCloseRead, streamCloseWrite: - s.state.v = streamReset - s.remove() - } - s.state.Unlock() - return err -} - -func (s *Stream) remove() { - s.conn.removeStream(s) - - // We *must* do this in a goroutine. This can be called during a - // an open notification and will block until that notification is done. - go func() { - s.notifyLk.Lock() - defer s.notifyLk.Unlock() - - s.conn.swarm.notifyAll(func(f network.Notifiee) { - f.ClosedStream(s.conn.swarm, s) - }) - s.conn.swarm.refs.Done() - }() -} - -// Protocol returns the protocol negotiated on this stream (if set). -func (s *Stream) Protocol() protocol.ID { - // Ignore type error. It means that the protocol is unset. - p, _ := s.protocol.Load().(protocol.ID) - return p -} - -// SetProtocol sets the protocol for this stream. -// -// This doesn't actually *do* anything other than record the fact that we're -// speaking the given protocol over this stream. It's still up to the user to -// negotiate the protocol. This is usually done by the Host. -func (s *Stream) SetProtocol(p protocol.ID) { - s.protocol.Store(p) -} - -// SetDeadline sets the read and write deadlines for this stream. -func (s *Stream) SetDeadline(t time.Time) error { - return s.stream.SetDeadline(t) -} - -// SetReadDeadline sets the read deadline for this stream. -func (s *Stream) SetReadDeadline(t time.Time) error { - return s.stream.SetReadDeadline(t) -} - -// SetWriteDeadline sets the write deadline for this stream. -func (s *Stream) SetWriteDeadline(t time.Time) error { - return s.stream.SetWriteDeadline(t) -} - -// Stat returns metadata information for this stream. -func (s *Stream) Stat() network.Stat { - return s.stat -} diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_transport.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm_transport.go deleted file mode 100644 index 307bfe64..00000000 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm_transport.go +++ /dev/null @@ -1,102 +0,0 @@ -package swarm - -import ( - "fmt" - "strings" - - "github.com/libp2p/go-libp2p-core/transport" - - ma "github.com/multiformats/go-multiaddr" -) - -// TransportForDialing retrieves the appropriate transport for dialing the given -// multiaddr. -func (s *Swarm) TransportForDialing(a ma.Multiaddr) transport.Transport { - protocols := a.Protocols() - if len(protocols) == 0 { - return nil - } - - s.transports.RLock() - defer s.transports.RUnlock() - if len(s.transports.m) == 0 { - log.Error("you have no transports configured") - return nil - } - - for _, p := range protocols { - transport, ok := s.transports.m[p.Code] - if !ok { - continue - } - if transport.Proxy() { - return transport - } - } - - return s.transports.m[protocols[len(protocols)-1].Code] -} - -// TransportForListening retrieves the appropriate transport for listening on -// the given multiaddr. -func (s *Swarm) TransportForListening(a ma.Multiaddr) transport.Transport { - protocols := a.Protocols() - if len(protocols) == 0 { - return nil - } - - s.transports.RLock() - defer s.transports.RUnlock() - if len(s.transports.m) == 0 { - log.Error("you have no transports configured") - return nil - } - - selected := s.transports.m[protocols[len(protocols)-1].Code] - for _, p := range protocols { - transport, ok := s.transports.m[p.Code] - if !ok { - continue - } - if transport.Proxy() { - selected = transport - } - } - return selected -} - -// AddTransport adds a transport to this swarm. -// -// Satisfies the Network interface from go-libp2p-transport. -func (s *Swarm) AddTransport(t transport.Transport) error { - protocols := t.Protocols() - - if len(protocols) == 0 { - return fmt.Errorf("useless transport handles no protocols: %T", t) - } - - s.transports.Lock() - defer s.transports.Unlock() - var registered []string - for _, p := range protocols { - if _, ok := s.transports.m[p]; ok { - proto := ma.ProtocolWithCode(p) - name := proto.Name - if name == "" { - name = fmt.Sprintf("unknown (%d)", p) - } - registered = append(registered, name) - } - } - if len(registered) > 0 { - return fmt.Errorf( - "transports already registered for protocol(s): %s", - strings.Join(registered, ", "), - ) - } - - for _, p := range protocols { - s.transports.m[p] = t - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-tls/.travis.yml b/vendor/github.com/libp2p/go-libp2p-tls/.travis.yml deleted file mode 100644 index 4f8a4d25..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: go - -go: - - "1.12.x" - -# first part of the GOARCH workaround -# setting the GOARCH directly doesn't work, since the value will be overwritten later -# so set it to a temporary environment variable first -env: - - TRAVIS_GOARCH=amd64 - - TRAVIS_GOARCH=386 - -# second part of the GOARCH workaround -# now actually set the GOARCH env variable to the value of the temporary variable set earlier -before_install: - - | - export GO111MODULE=on; - go get golang.org/x/tools/cmd/cover; - go get github.com/onsi/ginkgo/ginkgo; - go get github.com/onsi/gomega; - - export GOARCH=$TRAVIS_GOARCH - - go env - -script: - # some tests are randomized. Run them a few times. - - for i in `seq 1 10`; do - ginkgo -r -v --cover --randomizeAllSpecs --randomizeSuites --trace --progress; - done - -after_success: - - cat go-libp2p-tls.coverprofile > coverage.txt - - cat */*.coverprofile >> coverage.txt - - bash <(curl -s https://codecov.io/bash) -f coverage.txt - -cache: - directories: diff --git a/vendor/github.com/libp2p/go-libp2p-tls/LICENSE.md b/vendor/github.com/libp2p/go-libp2p-tls/LICENSE.md deleted file mode 100644 index a94e82cc..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/LICENSE.md +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2018 Marten Seemann - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-tls/README.md b/vendor/github.com/libp2p/go-libp2p-tls/README.md deleted file mode 100644 index 64390a04..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# go-libp2p-tls - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-tls?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-tls) -[![Linux Build Status](https://img.shields.io/travis/libp2p/go-libp2p-tls/master.svg?style=flat-square&label=linux+build)](https://travis-ci.org/libp2p/go-libp2p-tls) -[![Code Coverage](https://img.shields.io/codecov/c/github/libp2p/go-libp2p-tls/master.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p-tls/) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> go-libp2p's TLS encrypted transport - -Package `go-libp2p-tls` is a libp2p [conn security transport](https://github.com/libp2p/go-conn-security). It uses TLS to setup the communication channel. - -## Install - -`go-libp2p-tls` is a standard Go module which can be installed with: - -```sh -go get github.com/libp2p/go-libp2p-tls -``` - -This repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of -go 1.11 and later with modules enabled will automatically pull the latest tagged release -by referencing this package. Upgrades to future releases can be managed using `go get`, -or by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies). - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-tls/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 0.1.0: QmR4qpcxA1UoHg7SZ89hJHYCpfrxToPjH9xSCug1cQeH1M diff --git a/vendor/github.com/libp2p/go-libp2p-tls/codecov.yml b/vendor/github.com/libp2p/go-libp2p-tls/codecov.yml deleted file mode 100644 index 00064af3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/codecov.yml +++ /dev/null @@ -1,7 +0,0 @@ -coverage: - round: nearest - status: - project: - default: - threshold: 1 - patch: false diff --git a/vendor/github.com/libp2p/go-libp2p-tls/conn.go b/vendor/github.com/libp2p/go-libp2p-tls/conn.go deleted file mode 100644 index cf32fa45..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/conn.go +++ /dev/null @@ -1,37 +0,0 @@ -package libp2ptls - -import ( - "crypto/tls" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" -) - -type conn struct { - *tls.Conn - - localPeer peer.ID - privKey ci.PrivKey - - remotePeer peer.ID - remotePubKey ci.PubKey -} - -var _ sec.SecureConn = &conn{} - -func (c *conn) LocalPeer() peer.ID { - return c.localPeer -} - -func (c *conn) LocalPrivateKey() ci.PrivKey { - return c.privKey -} - -func (c *conn) RemotePeer() peer.ID { - return c.remotePeer -} - -func (c *conn) RemotePublicKey() ci.PubKey { - return c.remotePubKey -} diff --git a/vendor/github.com/libp2p/go-libp2p-tls/crypto.go b/vendor/github.com/libp2p/go-libp2p-tls/crypto.go deleted file mode 100644 index 917c65a6..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/crypto.go +++ /dev/null @@ -1,223 +0,0 @@ -package libp2ptls - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "errors" - "fmt" - "math/big" - "time" - - crypto "github.com/libp2p/go-libp2p-crypto" - "golang.org/x/sys/cpu" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" -) - -const certValidityPeriod = 100 * 365 * 24 * time.Hour // ~100 years -const certificatePrefix = "libp2p-tls-handshake:" - -var extensionID = getPrefixedExtensionID([]int{1, 1}) - -type signedKey struct { - PubKey []byte - Signature []byte -} - -// Identity is used to secure connections -type Identity struct { - config tls.Config -} - -// NewIdentity creates a new identity -func NewIdentity(privKey ic.PrivKey) (*Identity, error) { - cert, err := keyToCertificate(privKey) - if err != nil { - return nil, err - } - return &Identity{ - config: tls.Config{ - MinVersion: tls.VersionTLS13, - PreferServerCipherSuites: preferServerCipherSuites(), - InsecureSkipVerify: true, // This is not insecure here. We will verify the cert chain ourselves. - ClientAuth: tls.RequireAnyClientCert, - Certificates: []tls.Certificate{*cert}, - VerifyPeerCertificate: func(_ [][]byte, _ [][]*x509.Certificate) error { - panic("tls config not specialized for peer") - }, - SessionTicketsDisabled: true, - }, - }, nil -} - -// ConfigForAny is a short-hand for ConfigForPeer(""). -func (i *Identity) ConfigForAny() (*tls.Config, <-chan ic.PubKey) { - return i.ConfigForPeer("") -} - -// ConfigForPeer creates a new single-use tls.Config that verifies the peer's -// certificate chain and returns the peer's public key via the channel. If the -// peer ID is empty, the returned config will accept any peer. -// -// It should be used to create a new tls.Config before securing either an -// incoming or outgoing connection. -func (i *Identity) ConfigForPeer( - remote peer.ID, -) (*tls.Config, <-chan ic.PubKey) { - keyCh := make(chan ic.PubKey, 1) - // We need to check the peer ID in the VerifyPeerCertificate callback. - // The tls.Config it is also used for listening, and we might also have concurrent dials. - // Clone it so we can check for the specific peer ID we're dialing here. - conf := i.config.Clone() - // We're using InsecureSkipVerify, so the verifiedChains parameter will always be empty. - // We need to parse the certificates ourselves from the raw certs. - conf.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error { - defer close(keyCh) - - chain := make([]*x509.Certificate, len(rawCerts)) - for i := 0; i < len(rawCerts); i++ { - cert, err := x509.ParseCertificate(rawCerts[i]) - if err != nil { - return err - } - chain[i] = cert - } - - pubKey, err := getRemotePubKey(chain) - if err != nil { - return err - } - if remote != "" && !remote.MatchesPublicKey(pubKey) { - return errors.New("peer IDs don't match") - } - keyCh <- pubKey - return nil - } - return conf, keyCh -} - -// getRemotePubKey derives the remote's public key from the certificate chain. -func getRemotePubKey(chain []*x509.Certificate) (ic.PubKey, error) { - if len(chain) != 1 { - return nil, errors.New("expected one certificates in the chain") - } - cert := chain[0] - pool := x509.NewCertPool() - pool.AddCert(cert) - if _, err := cert.Verify(x509.VerifyOptions{Roots: pool}); err != nil { - // If we return an x509 error here, it will be sent on the wire. - // Wrap the error to avoid that. - return nil, fmt.Errorf("certificate verification failed: %s", err) - } - - var found bool - var keyExt pkix.Extension - // find the libp2p key extension, skipping all unknown extensions - for _, ext := range cert.Extensions { - if extensionIDEqual(ext.Id, extensionID) { - keyExt = ext - found = true - break - } - } - if !found { - return nil, errors.New("expected certificate to contain the key extension") - } - var sk signedKey - if _, err := asn1.Unmarshal(keyExt.Value, &sk); err != nil { - return nil, fmt.Errorf("unmarshalling signed certificate failed: %s", err) - } - pubKey, err := ic.UnmarshalPublicKey(sk.PubKey) - if err != nil { - return nil, fmt.Errorf("unmarshalling public key failed: %s", err) - } - certKeyPub, err := x509.MarshalPKIXPublicKey(cert.PublicKey) - if err != nil { - return nil, err - } - valid, err := pubKey.Verify(append([]byte(certificatePrefix), certKeyPub...), sk.Signature) - if err != nil { - return nil, fmt.Errorf("signature verification failed: %s", err) - } - if !valid { - return nil, errors.New("signature invalid") - } - return pubKey, nil -} - -func keyToCertificate(sk ic.PrivKey) (*tls.Certificate, error) { - certKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - return nil, err - } - - keyBytes, err := crypto.MarshalPublicKey(sk.GetPublic()) - if err != nil { - return nil, err - } - certKeyPub, err := x509.MarshalPKIXPublicKey(certKey.Public()) - if err != nil { - return nil, err - } - signature, err := sk.Sign(append([]byte(certificatePrefix), certKeyPub...)) - if err != nil { - return nil, err - } - value, err := asn1.Marshal(signedKey{ - PubKey: keyBytes, - Signature: signature, - }) - if err != nil { - return nil, err - } - - sn, err := rand.Int(rand.Reader, big.NewInt(1<<62)) - if err != nil { - return nil, err - } - tmpl := &x509.Certificate{ - SerialNumber: sn, - NotBefore: time.Time{}, - NotAfter: time.Now().Add(certValidityPeriod), - // after calling CreateCertificate, these will end up in Certificate.Extensions - ExtraExtensions: []pkix.Extension{ - {Id: extensionID, Value: value}, - }, - } - certDER, err := x509.CreateCertificate(rand.Reader, tmpl, tmpl, certKey.Public(), certKey) - if err != nil { - return nil, err - } - return &tls.Certificate{ - Certificate: [][]byte{certDER}, - PrivateKey: certKey, - }, nil -} - -// We want nodes without AES hardware (e.g. ARM) support to always use ChaCha. -// Only if both nodes have AES hardware support (e.g. x86), AES should be used. -// x86->x86: AES, ARM->x86: ChaCha, x86->ARM: ChaCha and ARM->ARM: Chacha -// This function returns true if we don't have AES hardware support, and false otherwise. -// Thus, ARM servers will always use their own cipher suite preferences (ChaCha first), -// and x86 servers will aways use the client's cipher suite preferences. -func preferServerCipherSuites() bool { - // Copied from the Go TLS implementation. - - // Check the cpu flags for each platform that has optimized GCM implementations. - // Worst case, these variables will just all be false. - var ( - hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL - // Keep in sync with crypto/aes/cipher_s390x.go. - hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR && (cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM) - - hasGCMAsm = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X - ) - return !hasGCMAsm -} diff --git a/vendor/github.com/libp2p/go-libp2p-tls/extension.go b/vendor/github.com/libp2p/go-libp2p-tls/extension.go deleted file mode 100644 index 9472c77e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/extension.go +++ /dev/null @@ -1,22 +0,0 @@ -package libp2ptls - -var extensionPrefix = []int{1, 3, 6, 1, 4, 1, 53594} - -// getPrefixedExtensionID returns an Object Identifier -// that can be used in x509 Certificates. -func getPrefixedExtensionID(suffix []int) []int { - return append(extensionPrefix, suffix...) -} - -// extensionIDEqual compares two extension IDs. -func extensionIDEqual(a, b []int) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -} diff --git a/vendor/github.com/libp2p/go-libp2p-tls/go.mod b/vendor/github.com/libp2p/go-libp2p-tls/go.mod deleted file mode 100644 index f299848c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/libp2p/go-libp2p-tls - -go 1.12 - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-crypto v0.1.0 - github.com/onsi/ginkgo v1.7.0 - github.com/onsi/gomega v1.4.3 - golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09 -) diff --git a/vendor/github.com/libp2p/go-libp2p-tls/go.sum b/vendor/github.com/libp2p/go-libp2p-tls/go.sum deleted file mode 100644 index 508f4305..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/go.sum +++ /dev/null @@ -1,83 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/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/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -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/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09 h1:IlD35wZE03o2qJy2o37WIskL33b7PT6cHdGnE8bieZs= -golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-tls/transport.go b/vendor/github.com/libp2p/go-libp2p-tls/transport.go deleted file mode 100644 index 2dc4257a..00000000 --- a/vendor/github.com/libp2p/go-libp2p-tls/transport.go +++ /dev/null @@ -1,136 +0,0 @@ -package libp2ptls - -import ( - "context" - "crypto/tls" - "errors" - "net" - "os" - - ci "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" -) - -// TLS 1.3 is opt-in in Go 1.12 -// Activate it by setting the tls13 GODEBUG flag. -func init() { - os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") -} - -// ID is the protocol ID (used when negotiating with multistream) -const ID = "/tls/1.0.0" - -// Transport constructs secure communication sessions for a peer. -type Transport struct { - identity *Identity - - localPeer peer.ID - privKey ci.PrivKey -} - -// New creates a TLS encrypted transport -func New(key ci.PrivKey) (*Transport, error) { - id, err := peer.IDFromPrivateKey(key) - if err != nil { - return nil, err - } - t := &Transport{ - localPeer: id, - privKey: key, - } - - identity, err := NewIdentity(key) - if err != nil { - return nil, err - } - t.identity = identity - return t, nil -} - -var _ sec.SecureTransport = &Transport{} - -// SecureInbound runs the TLS handshake as a server. -func (t *Transport) SecureInbound(ctx context.Context, insecure net.Conn) (sec.SecureConn, error) { - config, keyCh := t.identity.ConfigForAny() - return t.handshake(ctx, tls.Server(insecure, config), keyCh) -} - -// SecureOutbound runs the TLS handshake as a client. -// Note that SecureOutbound will not return an error if the server doesn't -// accept the certificate. This is due to the fact that in TLS 1.3, the client -// sends its certificate and the ClientFinished in the same flight, and can send -// application data immediately afterwards. -// If the handshake fails, the server will close the connection. The client will -// notice this after 1 RTT when calling Read. -func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error) { - config, keyCh := t.identity.ConfigForPeer(p) - return t.handshake(ctx, tls.Client(insecure, config), keyCh) -} - -func (t *Transport) handshake( - ctx context.Context, - tlsConn *tls.Conn, - keyCh <-chan ci.PubKey, -) (sec.SecureConn, error) { - // There's no way to pass a context to tls.Conn.Handshake(). - // See https://github.com/golang/go/issues/18482. - // Close the connection instead. - select { - case <-ctx.Done(): - tlsConn.Close() - default: - } - done := make(chan struct{}) - defer close(done) - go func() { - select { - case <-done: - case <-ctx.Done(): - tlsConn.Close() - } - }() - - if err := tlsConn.Handshake(); err != nil { - // if the context was canceled, return the context error - if ctxErr := ctx.Err(); ctxErr != nil { - return nil, ctxErr - } - return nil, err - } - - // Should be ready by this point, don't block. - var remotePubKey ci.PubKey - select { - case remotePubKey = <-keyCh: - default: - } - - conn, err := t.setupConn(tlsConn, remotePubKey) - if err != nil { - // if the context was canceled, return the context error - if ctxErr := ctx.Err(); ctxErr != nil { - return nil, ctxErr - } - return nil, err - } - return conn, nil -} - -func (t *Transport) setupConn(tlsConn *tls.Conn, remotePubKey ci.PubKey) (sec.SecureConn, error) { - if remotePubKey == nil { - return nil, errors.New("go-libp2p-tls BUG: expected remote pub key to be set") - } - - remotePeerID, err := peer.IDFromPublicKey(remotePubKey) - if err != nil { - return nil, err - } - return &conn{ - Conn: tlsConn, - localPeer: t.localPeer, - privKey: t.privKey, - remotePeer: remotePeerID, - remotePubKey: remotePubKey, - }, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/.travis.yml b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/LICENSE b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/LICENSE deleted file mode 100644 index 6cccfc2b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Protocol Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/README.md b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/README.md deleted file mode 100644 index ef143810..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# go-libp2p-transport-upgrader - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-transport-upgrader?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-transport-upgrader) -[![Build Status](https://travis-ci.org/libp2p/go-libp2p-transport-upgrader.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-transport-upgrader) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> Stream connection to libp2p connection upgrader - -This package provides the necessary logic to upgrade [multiaddr-net][manet] connections listeners into full [libp2p-transport][tpt] connections and listeners. - -To use, construct a new `Upgrader` with: - -* An optional [pnet][pnet] `Protector`. -* An optional [multiaddr-net][manet] address `Filter`. -* A mandatory [stream security transport][ss]. -* A mandatory [stream multiplexer transport][smux]. - -[tpt]: https://github.com/libp2p/go-libp2p-transport -[manet]: https://github.com/multiformats/go-multiaddr-net -[ss]: https://github.com/libp2p/go-conn-security -[smux]: https://github.com/libp2p/go-stream-muxer -[pnet]: https://github.com/libp2p/go-libp2p-interface-pnet - -Note: This package largely replaces the functionality of [go-libp2p-conn](https://github.com/libp2p/go-libp2p-conn) but with half the code. - -## Install - -`go-libp2p-transport-upgrader` is a standard Go module which can be installed with: - -```sh -go get github.com/libp2p/go-libp2p-transport-upgrader -``` - -This repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of -go 1.11 and later with modules enabled will automatically pull the latest tagged release -by referencing this package. Upgrades to future releases can be managed using `go get`, -or by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies). - -## Usage - -## Example - -Below is a simplified TCP transport implementation using the transport upgrader. In practice, you'll want to use [go-tcp-transport](https://github.com/libp2p/go-tcp-transport) (which has reuseport support). - -```go -package tcptransport - -import ( - "context" - - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - - ma "github.com/multiformats/go-multiaddr" - mafmt "github.com/whyrusleeping/mafmt" - manet "github.com/multiformats/go-multiaddr-net" - tpt "github.com/libp2p/go-libp2p-transport" -) - -// TcpTransport is a simple TCP transport. -type TcpTransport struct { - // Connection upgrader for upgrading insecure stream connections to - // secure multiplex connections. - Upgrader *tptu.Upgrader -} - -var _ tpt.Transport = &TcpTransport{} - -// NewTCPTransport creates a new TCP transport instance. -func NewTCPTransport(upgrader *tptu.Upgrader) *TcpTransport { - return &TcpTransport{Upgrader: upgrader} -} - -// CanDial returns true if this transport believes it can dial the given -// multiaddr. -func (t *TcpTransport) CanDial(addr ma.Multiaddr) bool { - return mafmt.TCP.Matches(addr) -} - -// Dial dials the peer at the remote address. -func (t *TcpTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tpt.Conn, error) { - var dialer manet.Dialer - conn, err := dialer.DialContext(ctx, raddr) - if err != nil { - return nil, err - } - return t.Upgrader.UpgradeOutbound(ctx, t, conn, p) -} - -// Listen listens on the given multiaddr. -func (t *TcpTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error) { - list, err := manet.Listen(laddr) - if err != nil { - return nil, err - } - return t.Upgrader.UpgradeListener(t, list), nil -} - -// Protocols returns the list of terminal protocols this transport can dial. -func (t *TcpTransport) Protocols() []int { - return []int{ma.P_TCP} -} - -// Proxy always returns false for the TCP transport. -func (t *TcpTransport) Proxy() bool { - return false -} -``` - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-libp2p-transport-upgrader/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 0.1.28: QmeqC5shQjEBRG9B8roZqQCJ9xb7Pq6AbWxJFMyLgqBBWh diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/codecov.yml b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/conn.go b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/conn.go deleted file mode 100644 index 2098b151..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/conn.go +++ /dev/null @@ -1,35 +0,0 @@ -package stream - -import ( - "fmt" - - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/transport" -) - -type transportConn struct { - mux.MuxedConn - network.ConnMultiaddrs - network.ConnSecurity - transport transport.Transport -} - -func (t *transportConn) Transport() transport.Transport { - return t.transport -} - -func (t *transportConn) String() string { - ts := "" - if s, ok := t.transport.(fmt.Stringer); ok { - ts = "[" + s.String() + "]" - } - return fmt.Sprintf( - " %s (%s)>", - ts, - t.LocalMultiaddr(), - t.LocalPeer(), - t.RemoteMultiaddr(), - t.RemotePeer(), - ) -} diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.mod b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.mod deleted file mode 100644 index d7b59886..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/libp2p/go-libp2p-transport-upgrader - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-mplex v0.2.0 - github.com/libp2p/go-maddr-filter v0.0.4 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/onsi/ginkgo v1.8.0 - github.com/onsi/gomega v1.5.0 -) diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.sum b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.sum deleted file mode 100644 index 83358689..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/go.sum +++ /dev/null @@ -1,120 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/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/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -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/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-mplex v0.2.0 h1:vnR+/fUnL5d2kTB1Lfce1KVSP+bCCy2aJIvqvb9cFqE= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3 h1:YiMaevQcZtFU6DmKIF8xEO0vaui5kM5HJ1V1xkWQv14= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/listener.go b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/listener.go deleted file mode 100644 index f792c991..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/listener.go +++ /dev/null @@ -1,160 +0,0 @@ -package stream - -import ( - "context" - "fmt" - "sync" - - "github.com/libp2p/go-libp2p-core/transport" - - logging "github.com/ipfs/go-log" - tec "github.com/jbenet/go-temp-err-catcher" - manet "github.com/multiformats/go-multiaddr-net" -) - -var log = logging.Logger("stream-upgrader") - -type connErr struct { - conn transport.CapableConn - err error -} - -type listener struct { - manet.Listener - - transport transport.Transport - upgrader *Upgrader - - incoming chan transport.CapableConn - err error - - // Used for backpressure - threshold *threshold - - // Canceling this context isn't sufficient to tear down the listener. - // Call close. - ctx context.Context - cancel func() -} - -// Close closes the listener. -func (l *listener) Close() error { - // Do this first to try to get any relevent errors. - err := l.Listener.Close() - - l.cancel() - // Drain and wait. - for c := range l.incoming { - c.Close() - } - return err -} - -// handles inbound connections. -// -// This function does a few interesting things that should be noted: -// -// 1. It logs and discards temporary/transient errors (errors with a Temporary() -// function that returns true). -// 2. It stops accepting new connections once AcceptQueueLength connections have -// been fully negotiated but not accepted. This gives us a basic backpressure -// mechanism while still allowing us to negotiate connections in parallel. -func (l *listener) handleIncoming() { - var wg sync.WaitGroup - defer func() { - // make sure we're closed - l.Listener.Close() - if l.err == nil { - l.err = fmt.Errorf("listener closed") - } - - wg.Wait() - close(l.incoming) - }() - - var catcher tec.TempErrCatcher - for l.ctx.Err() == nil { - maconn, err := l.Listener.Accept() - if err != nil { - // Note: function may pause the accept loop. - if catcher.IsTemporary(err) { - log.Infof("temporary accept error: %s", err) - continue - } - l.err = err - return - } - - // The go routine below calls Release when the context is - // canceled so there's no need to wait on it here. - l.threshold.Wait() - - log.Debugf("listener %s got connection: %s <---> %s", - l, - maconn.LocalMultiaddr(), - maconn.RemoteMultiaddr()) - - wg.Add(1) - go func() { - defer wg.Done() - - ctx, cancel := context.WithTimeout(l.ctx, transport.AcceptTimeout) - defer cancel() - - conn, err := l.upgrader.UpgradeInbound(ctx, l.transport, maconn) - if err != nil { - // Don't bother bubbling this up. We just failed - // to completely negotiate the connection. - log.Debugf("accept upgrade error: %s (%s <--> %s)", - err, - maconn.LocalMultiaddr(), - maconn.RemoteMultiaddr()) - return - } - - log.Debugf("listener %s accepted connection: %s", l, conn) - - // This records the fact that the connection has been - // setup and is waiting to be accepted. This call - // *never* blocks, even if we go over the threshold. It - // simply ensures that calls to Wait block while we're - // over the threshold. - l.threshold.Acquire() - defer l.threshold.Release() - - select { - case l.incoming <- conn: - case <-ctx.Done(): - if l.ctx.Err() == nil { - // Listener *not* closed but the accept timeout expired. - log.Warningf("listener dropped connection due to slow accept") - } - // Wait on the context with a timeout. This way, - // if we stop accepting connections for some reason, - // we'll eventually close all the open ones - // instead of hanging onto them. - conn.Close() - } - }() - } -} - -// Accept accepts a connection. -func (l *listener) Accept() (transport.CapableConn, error) { - for c := range l.incoming { - // Could have been sitting there for a while. - if !c.IsClosed() { - return c, nil - } - } - return nil, l.err -} - -func (l *listener) String() string { - if s, ok := l.transport.(fmt.Stringer); ok { - return fmt.Sprintf("", s, l.Multiaddr()) - } - return fmt.Sprintf("", l.Multiaddr()) -} - -var _ transport.Listener = (*listener)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/threshold.go b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/threshold.go deleted file mode 100644 index 2c278bd3..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/threshold.go +++ /dev/null @@ -1,50 +0,0 @@ -package stream - -import ( - "sync" -) - -func newThreshold(cutoff int) *threshold { - t := &threshold{ - threshold: cutoff, - } - t.cond.L = &t.mu - return t -} - -type threshold struct { - mu sync.Mutex - cond sync.Cond - - count int - threshold int -} - -// Acquire increments the counter. It will not block. -func (t *threshold) Acquire() { - t.mu.Lock() - t.count++ - t.mu.Unlock() -} - -// Release decrements the counter. -func (t *threshold) Release() { - t.mu.Lock() - if t.count == 0 { - panic("negative count") - } - if t.threshold == t.count { - t.cond.Broadcast() - } - t.count-- - t.mu.Unlock() -} - -// Wait waits for the counter to drop below the threshold -func (t *threshold) Wait() { - t.mu.Lock() - for t.count >= t.threshold { - t.cond.Wait() - } - t.mu.Unlock() -} diff --git a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/upgrader.go b/vendor/github.com/libp2p/go-libp2p-transport-upgrader/upgrader.go deleted file mode 100644 index 5e3854b0..00000000 --- a/vendor/github.com/libp2p/go-libp2p-transport-upgrader/upgrader.go +++ /dev/null @@ -1,132 +0,0 @@ -package stream - -import ( - "context" - "errors" - "fmt" - "net" - - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/pnet" - "github.com/libp2p/go-libp2p-core/sec" - "github.com/libp2p/go-libp2p-core/transport" - - filter "github.com/libp2p/go-maddr-filter" - manet "github.com/multiformats/go-multiaddr-net" -) - -// ErrNilPeer is returned when attempting to upgrade an outbound connection -// without specifying a peer ID. -var ErrNilPeer = errors.New("nil peer") - -// AcceptQueueLength is the number of connections to fully setup before not accepting any new connections -var AcceptQueueLength = 16 - -// Upgrader is a multistream upgrader that can upgrade an underlying connection -// to a full transport connection (secure and multiplexed). -type Upgrader struct { - Protector pnet.Protector - Secure sec.SecureTransport - Muxer mux.Multiplexer - Filters *filter.Filters -} - -// UpgradeListener upgrades the passed multiaddr-net listener into a full libp2p-transport listener. -func (u *Upgrader) UpgradeListener(t transport.Transport, list manet.Listener) transport.Listener { - ctx, cancel := context.WithCancel(context.Background()) - l := &listener{ - Listener: list, - upgrader: u, - transport: t, - threshold: newThreshold(AcceptQueueLength), - incoming: make(chan transport.CapableConn), - cancel: cancel, - ctx: ctx, - } - go l.handleIncoming() - return l -} - -// UpgradeOutbound upgrades the given outbound multiaddr-net connection into a -// full libp2p-transport connection. -func (u *Upgrader) UpgradeOutbound(ctx context.Context, t transport.Transport, maconn manet.Conn, p peer.ID) (transport.CapableConn, error) { - if p == "" { - return nil, ErrNilPeer - } - return u.upgrade(ctx, t, maconn, p) -} - -// UpgradeInbound upgrades the given inbound multiaddr-net connection into a -// full libp2p-transport connection. -func (u *Upgrader) UpgradeInbound(ctx context.Context, t transport.Transport, maconn manet.Conn) (transport.CapableConn, error) { - return u.upgrade(ctx, t, maconn, "") -} - -func (u *Upgrader) upgrade(ctx context.Context, t transport.Transport, maconn manet.Conn, p peer.ID) (transport.CapableConn, error) { - if u.Filters != nil && u.Filters.AddrBlocked(maconn.RemoteMultiaddr()) { - log.Debugf("blocked connection from %s", maconn.RemoteMultiaddr()) - maconn.Close() - return nil, fmt.Errorf("blocked connection from %s", maconn.RemoteMultiaddr()) - } - - var conn net.Conn = maconn - if u.Protector != nil { - pconn, err := u.Protector.Protect(conn) - if err != nil { - conn.Close() - return nil, fmt.Errorf("failed to setup private network protector: %s", err) - } - conn = pconn - } else if pnet.ForcePrivateNetwork { - log.Error("tried to dial with no Private Network Protector but usage" + - " of Private Networks is forced by the enviroment") - return nil, pnet.ErrNotInPrivateNetwork - } - sconn, err := u.setupSecurity(ctx, conn, p) - if err != nil { - conn.Close() - return nil, fmt.Errorf("failed to negotiate security protocol: %s", err) - } - smconn, err := u.setupMuxer(ctx, sconn, p) - if err != nil { - sconn.Close() - return nil, fmt.Errorf("failed to negotiate security stream multiplexer: %s", err) - } - return &transportConn{ - MuxedConn: smconn, - ConnMultiaddrs: maconn, - ConnSecurity: sconn, - transport: t, - }, nil -} - -func (u *Upgrader) setupSecurity(ctx context.Context, conn net.Conn, p peer.ID) (sec.SecureConn, error) { - if p == "" { - return u.Secure.SecureInbound(ctx, conn) - } - return u.Secure.SecureOutbound(ctx, conn, p) -} - -func (u *Upgrader) setupMuxer(ctx context.Context, conn net.Conn, p peer.ID) (mux.MuxedConn, error) { - // TODO: The muxer should take a context. - done := make(chan struct{}) - - var smconn mux.MuxedConn - var err error - go func() { - defer close(done) - smconn, err = u.Muxer.NewConn(conn, p == "") - }() - - select { - case <-done: - return smconn, err - case <-ctx.Done(): - // interrupt this process - conn.Close() - // wait to finish - <-done - return nil, ctx.Err() - } -} diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/.gitignore b/vendor/github.com/libp2p/go-libp2p-yamux/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/.travis.yml b/vendor/github.com/libp2p/go-libp2p-yamux/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/LICENSE b/vendor/github.com/libp2p/go-libp2p-yamux/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/Makefile b/vendor/github.com/libp2p/go-libp2p-yamux/Makefile deleted file mode 100644 index 3907e857..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -build: deps - go build ./... - -test: deps - go test ./... - -test_race: deps - go test -race ./... - -gx-bins: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx-bins - gx --verbose install --global - gx-go rewrite - -clean: gx-bins - gx-go rewrite --undo diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/README.md b/vendor/github.com/libp2p/go-libp2p-yamux/README.md deleted file mode 100644 index 46165b7c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# go-libp2p-yamux - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p-yamux?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p-yamux) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-libp2p-yamux/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-libp2p-yamux?branch=master) -[![Build Status](https://travis-ci.com/libp2p/go-libp2p-yamux.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-yamux) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> An adapter to integrate the yamux multiplexer into libp2p as a stream muxer. - -## Install - -```sh -go get github.com/libp2p/go-libp2p-yamux -``` - -## Usage - -Check out the [GoDocs](https://godoc.org/github.com/libp2p/go-libp2p-yamux). - -## License - -Dual-licensed under MIT and ASLv2, by way of the [Permissive License Stack](https://protocol.ai/blog/announcing-the-permissive-license-stack/). diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/go.mod b/vendor/github.com/libp2p/go-libp2p-yamux/go.mod deleted file mode 100644 index d935b0b4..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/libp2p/go-libp2p-yamux - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-testing v0.0.4 - github.com/libp2p/go-yamux v1.2.3 -) diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/go.sum b/vendor/github.com/libp2p/go-libp2p-yamux/go.sum deleted file mode 100644 index d2bf1dea..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/go.sum +++ /dev/null @@ -1,59 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/package.json b/vendor/github.com/libp2p/go-libp2p-yamux/package.json deleted file mode 100644 index 72c6f64b..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/go-smux-yamux" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/go-smux-yamux" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmUNMbRUsVYHi1D14annF7Rr7pQAX7TNLwpRCa975ojKnw", - "name": "yamux", - "version": "1.1.5" - }, - { - "author": "whyrusleeping", - "hash": "QmVtV1y2e8W4eQgzsP6qfSpCCZ6zWYE4m6NzJjB7iswwrT", - "name": "go-stream-muxer", - "version": "3.1.0" - } - ], - "gxVersion": "0.7.0", - "language": "go", - "license": "", - "name": "go-smux-yamux", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "2.0.10" -} - diff --git a/vendor/github.com/libp2p/go-libp2p-yamux/yamux.go b/vendor/github.com/libp2p/go-libp2p-yamux/yamux.go deleted file mode 100644 index 4875761c..00000000 --- a/vendor/github.com/libp2p/go-libp2p-yamux/yamux.go +++ /dev/null @@ -1,77 +0,0 @@ -package sm_yamux - -import ( - "io/ioutil" - "net" - - mux "github.com/libp2p/go-libp2p-core/mux" - yamux "github.com/libp2p/go-yamux" -) - -// Conn is a connection to a remote peer. -type conn yamux.Session - -func (c *conn) yamuxSession() *yamux.Session { - return (*yamux.Session)(c) -} - -func (c *conn) Close() error { - return c.yamuxSession().Close() -} - -func (c *conn) IsClosed() bool { - return c.yamuxSession().IsClosed() -} - -// OpenStream creates a new stream. -func (c *conn) OpenStream() (mux.MuxedStream, error) { - s, err := c.yamuxSession().OpenStream() - if err != nil { - return nil, err - } - - return s, nil -} - -// AcceptStream accepts a stream opened by the other side. -func (c *conn) AcceptStream() (mux.MuxedStream, error) { - s, err := c.yamuxSession().AcceptStream() - return s, err -} - -// Transport is a go-peerstream transport that constructs -// yamux-backed connections. -type Transport yamux.Config - -var DefaultTransport *Transport - -func init() { - config := yamux.DefaultConfig() - // We've bumped this to 16MiB as this critically limits throughput. - // - // 1MiB means a best case of 10MiB/s (83.89Mbps) on a connection with - // 100ms latency. The default gave us 2.4MiB *best case* which was - // totally unacceptable. - config.MaxStreamWindowSize = uint32(16 * 1024 * 1024) - // don't spam - config.LogOutput = ioutil.Discard - // We always run over a security transport that buffers internally - // (i.e., uses a block cipher). - config.ReadBufSize = 0 - DefaultTransport = (*Transport)(config) -} - -func (t *Transport) NewConn(nc net.Conn, isServer bool) (mux.MuxedConn, error) { - var s *yamux.Session - var err error - if isServer { - s, err = yamux.Server(nc, t.Config()) - } else { - s, err = yamux.Client(nc, t.Config()) - } - return (*conn)(s), err -} - -func (t *Transport) Config() *yamux.Config { - return (*yamux.Config)(t) -} diff --git a/vendor/github.com/libp2p/go-libp2p/.gitignore b/vendor/github.com/libp2p/go-libp2p/.gitignore deleted file mode 100644 index 895adf13..00000000 --- a/vendor/github.com/libp2p/go-libp2p/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.swp -examples/echo/echo -examples/multicodecs/multicodecs -.idea \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-libp2p/.travis.yml b/vendor/github.com/libp2p/go-libp2p/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-libp2p/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-libp2p/LICENSE b/vendor/github.com/libp2p/go-libp2p/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-libp2p/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-libp2p/NEWS.md b/vendor/github.com/libp2p/go-libp2p/NEWS.md deleted file mode 100644 index ff497d72..00000000 --- a/vendor/github.com/libp2p/go-libp2p/NEWS.md +++ /dev/null @@ -1,304 +0,0 @@ -# go-libp2p release notes - -## 6.0.0 - -We're pleased to announce go-libp2p 6.0.0. This release includes a massive -refactor of go-libp2p that paves the way for new transports such as QUIC. -Unfortunately, as it is broad sweeping, there are some breaking changes, -*especially* for maintainers of custom transports. - -Below, we cover the changes you'll likely care about. For convenience, we've -broken this into a section for users and transport authors/maintainers. However, -transport maintainers should really read both sections. - -### For Users - -Libp2p users should be aware of a few major changes. - -* Guarantees and performance concerning connect/disconnect notification - processing have improved. -* Handling of half-closed streams has changed (READ THIS SECTION). -* Some constructors and method signatures have changed slightly. - -#### Dialing And Source Addresses - -We've improved the logic that selects the source address when dialing. In the -past, you may have run into an issue where you couldn't dial non-local nodes -when listening on 127.0.0.1 as opposed to 0.0.0.0. This happened because -go-libp2p would randomly pick the source address from the set of addresses on -which the node was listening. We did this to ensure that the other end could -dial us back at the same address. Unfortunately, one can't use 127.0.0.1 as a -source address when dialing any non-local address so outbound dials failed. - -go-libp2p now tries to be smarter about this and avoids picking source addresses -that have no route to the destination address. - -#### Bandwidth Metrics - -To start out on an unhappy note, bandwidth metrics are now less accurate. In the -past, transports returned "minimal" connections (e.g., a TCP connection) so we -could wrap these transport connections in "metrics" connections that counted -every byte sent and received. - -Unfortunately, now that we've moved encryption and multiplexing down into the -transport layer, the connection we're wrapping has significantly more -under-the-covers overhead. - -However, we do hope to improve this and get even *better* bandwidth metrics than -we did before. See [libp2p/go-libp2p-transport#31][] for details. - -[libp2p/go-libp2p-transport#31]: https://github.com/libp2p/go-libp2p-transport/issues/31 - -#### Notifications - -This release brings performance improvements and easy to reason about ordering -guarantees libp2p connect/disconnect events: - -1. For any given connection/stream, libp2p will wait for all connect/open event - handlers to finish exit before triggering a disconnect/close event for the - connection/stream. -2. When a user calls the Close (or `Reset`) method on a connection or stream, - go-libp2p will process the close event asynchronously (i.e., not block the - call to `Close`). Otherwise, a call to `Close` from within a connect event - handler would deadlock. -3. Unless otherwise noted, events will be handled in parallel. - -What does this mean for end users? Well: - -1. Reference counting connections to a peer using connect/disconnect events - should "just work" and should never go negative. -2. Under heavy connect/disconnect loads, connecting to new peers should be - faster (usually). - -For those interested in the history of this issue, ... - -In the past, (dis)connect and stream open/close notifications have been a bit of -a pain point. For a long time, they were fired off in parallel and one could, for -example, process a disconnect notification before a connect notification (we had -to support *negative* ref-counts in several places to account for this). - -After no end of trouble, we finally "fixed" this by synchronizing notification -delivery. We still delivered notifications to all notifiees in parallel, we just -processed the events in series. - -Unfortunately, under heavy connect/disconnect load, new connections could easily -get stuck on open behind a queue of connect events all being handled in series. -In theory, these events should have been handled quickly but in practice, it's -very hard to avoid locks *entirely* (bitswap's event handlers were especially -problematic). - -Worse, this serial delivery guarantee didn't actually provide us with an -*in-order* delivery guarantee as it was still possible for a disconnect to -happen before we even *started* to fire the connect event. The situation was -slightly better than before because the events couldn't overlap but still far -from optimal. - -However, this has all been resolved now. From now on, you'll never receive a -disconnect event before a connect event. - -#### Conn.GetStreams Signature Change - -The signature of the `GetStreams` method on `go-libp2p-net.Conn` has changed from: - -```go -GetStreams() ([]Stream, error) -``` - -To: - -```go -GetStreams() []Stream -``` - -Listing the streams on an open connection should never involve IO or do anything -that can fail so we removed this error to improve usability. - -#### Libp2p Constructor - -If you're not already doing so, you should be using the `libp2p.New` constructor -to make your libp2p nodes. This release brings quite a few new options to the -libp2p constructor so if it hasn't been flexible enough for you in the past, I -recommend that you try again. A simple example can be found in the -[echo][example:echo] example. - -Given this work and in an attempt to consolidate all of our configuration logic -in one place, we've removed all default transports from go-libp2p-swarm. - -TL;DR: Please use the libp2p constructor. - -#### Zombie Streams - -From this release on, when you're done with a stream, you must either call -`Reset` on it (in case of an error) or close it and read an EOF (or some other -error). Otherwise, libp2p can't determine if the stream is *actually* closed and -will hang onto it indefinitely. - -To make properly closing streams a bit easier, we've added two methods to -[go-libp2p-net][]: `AwaitEOF` and `FullClose`. - -* `AwaitEOF(stream)` tries to read a single byte from the stream. If `Read` -returns an EOF, `AwaitEOF` returns success. Otherwise, if `Read` either reads -some data or returns some other error, `AwaitEOF` resets the stream and returns -an error. To avoid waiting indefinitely, `AwaitEOF` resets the stream -unconditionally after 1 minute. -* `FullClose(stream)` is a convenience function that closes the stream and then -calls `AwaitEOF` on it. - -Like with libp2p notifications, this issue has a bit of history... - -In the beginning, libp2p assumed that calling `Close` on a stream would close -the stream for both reading and writing. Unfortunately, *none* of our stream -multiplexers actually behaved this way. In practice, `Close` always closed the -stream for writing. - -After realizing this, we made two changes: - -1. We accepted the fact that `Close` only closed the stream for writing. -2. We added a `Reset` method for killing the stream (closing it in both - directions, throwing away any buffered data). - -However, we ran into a bit of a snag because we try to track open streams and -need some way to tell when a stream has been closed. In the past this was easy: -when the user calls `Close` on the stream, stop tracking it. However, now that -`Close` only closes the stream for writing, we still *technically* needed to -track it until the *other* end closed the stream as well. Unfortunately, without -actually reading from the stream, we have no way of knowing about this. -Therefore, if the user calls `Close` on a stream and then walks away, we'd have -to hang onto the stream indefinitely. - -Our solution was to simply stop tracking streams once they were closed for -writing. This wasn't the *correct* behavior but it avoided leaking memory in the -common case: - -1. The user calls `Close` and drops all references to the stream. -2. The other end calls `Close` without writing any additional data. -3. The stream multiplexer observes both closes and drops *its* reference to the stream. -4. The garbage collector garbage collects the stream. - -However, this meant that: - -1. The list of "open" streams was technically incomplete. -2. If the other side either failed to call `Close` or tried to send data before - closing, the stream would remain "open" (until the connection was closed). - -In this release, we've changed this behavior. Now, when you `Close` a stream for -writing, libp2p *continues* to track it. We only stop tracking it when either: - -1. You call `Reset` (throwing away the stream). -2. You finish reading any data off of it and observe either an EOF or an error. - -This way, we never "forget" about open streams or leave them in a half-forgotten -state. - -In the future, I'd like to add a `CloseAndForget` method to streams that: - -1. Closes the stream (sends an EOF). -2. Tells the swarm to stop tracking the stream. -3. Tells the stream muxer to stop tracking the stream and throw away any data - the other side may send (possibly resetting the stream on unexpected data). - -However: - -1. This would likely require modifying our stream muxers which may not be - feasible. -2. Explicitly waiting for an EOF is still the correct thing to do unless you - really don't care if the operation succeeded. - -### For Transport Maintainers - -For transport maintainers, quite a bit has changed. Before this change, -transports created simple, unencrypted, stream connections and it was the job of -the libp2p Network (go-libp2p-swarm) to negotiate security, multiplexing, etc. - -However, when attempting to add support for the QUIC protocol, we realized that -this was going to be a problem: QUIC already handles authentication and -encryption (using TLS1.3) and multiplexing. After much debate, we inverted our -current architecture and made transports responsible for encrypting/multiplexing -their connections (before returning them). - -To make this palatable, we've also introduced a new ["upgrader" -library][go-libp2p-transport-upgrader] for upgrading go-multiaddr-net -connections/listeners to full libp2p transport connections/listeners. Transports -that don't support encryption/multiplexing out of the box can expect to have an -upgrader passed into the constructor. - -To get a feel for how this new transport system works, take a look at the TCP -and WebSocket transports and the transport interface documentation: - -* [TCP Transport][go-tcp-transport] -* [WebSocket Transport][go-ws-transport] -* [Transport Interface][doc:go-libp2p-transport] - -#### Deprecated Packages - -This release sees the deprecation of a few packages: - -* [go-peerstream][] has been deprecated and all functionality has been merged - into [go-libp2p-swarm][]. [go-peerstream][] was written as a general-purpose - (not libp2p specific) listener, connection, and stream manager. However, this - package caused more problems than it solved and was incompatible with the new - transport interface. -* [go-libp2p-interface-conn][] has been deprecated. These interfaces to bridge - the gap between transport-level connections and [go-libp2p-net][] connections - however, now that transport connections are fully multiplexed/encrypted, this - is no longer needed. -* [go-libp2p-conn][] has also been deprecated and most of the functionality has - been moved to [go-libp2p-transport-upgrader][]. This package used to provide - connection "upgrade" logic for upgrading transport-level connections to - [go-libp2p-interface-conn][] connections however, transport-level connections - now provide the required functionality out of the box. - -#### Testing - -We've moved `GenSwarmNetwork` in [go-libp2p-netutil][] to `GenSwarm` in -[go-libp2p-swarm/testing][] because: - -1. The swarm duplicated this exact function for its own tests. -2. The swarm couldn't depend on [go-libp2p-netutil][] because - [go-libp2p-netutil][] depends on [go-libp2p-swarm][]. - -We've also added a new transport test suit -[go-libp2p-transport/test][]. If you implement a new transport, please consider -testing against these suite. If you find a bug in an existing transport, please -consider adding a test to this suite. - -#### go-addr-util - -In go-addr-util, we've removed the `SupportedTransportStrings` and -`SupportedTransportProtocols` transport registries and the associated -`AddTransport` function. These registries were updated by `init` functions in -packages providing transports and were used to keep track of known transports. - -However, *importing* a transport doesn't mean any libp2p nodes have been -configured to actually *use* that transport. Therefore, in the new go-libp2p, -it's go-libp2p-swarm's job to keep track of which transports are supported -(i.e., which transports have been registered with the swarm). - -We've also removed the associated `AddrUsable`, `FilterUsableAddrs`, and -`AddrUsableFunc` functions. - -#### Pluggable Security Transports - -This release brings a new pluggable security transport framework. Implementing a -new security framework is now as simple as: - -1. Implement the interfaces defined in [go-conn-security][]. -2. Pass it into the libp2p constructor using the `Security` option. - -[go-conn-security]: https://github.com/libp2p/go-conn-security -[go-libp2p-conn]: https://github.com/libp2p/go-libp2p-conn -[go-libp2p-interface-conn]: https://github.com/libp2p/go-libp2p-interface-conn -[go-libp2p-net]: https://github.com/libp2p/go-libp2p-net -[go-libp2p-netutil]: https://github.com/libp2p/go-libp2p-netutil -[go-libp2p-swarm]: https://github.com/libp2p/go-libp2p-swarm -[go-libp2p-swarm/testing]: https://github.com/libp2p/go-libp2p-swarm/tree/master/testing -[go-libp2p-transport]: https://github.com/libp2p/go-libp2p-transport -[go-libp2p-transport/test]: https://github.com/libp2p/go-libp2p-transport/tree/master/test -[go-libp2p-transport-upgrader]: https://github.com/libp2p/go-libp2p-transport-upgrader -[go-peerstream]: https://github.com/libp2p/go-peerstream -[go-tcp-transport]: https://github.com/libp2p/go-tcp-transport -[go-ws-transport]: https://github.com/libp2p/go-ws-transport - -[example:echo]: https://github.com/libp2p/go-libp2p-examples/tree/master/echo - -[doc:go-libp2p-transport]: https://godoc.org/github.com/libp2p/go-libp2p-transport diff --git a/vendor/github.com/libp2p/go-libp2p/README.md b/vendor/github.com/libp2p/go-libp2p/README.md deleted file mode 100644 index 47ea441d..00000000 --- a/vendor/github.com/libp2p/go-libp2p/README.md +++ /dev/null @@ -1,214 +0,0 @@ - -

- libp2p hex logo -

- -

The Go implementation of the libp2p Networking Stack.

- -

- - - - - -

- -

- -
- - - -
-

- -# Project status - -[![Throughput Graph](https://graphs.waffle.io/libp2p/go-libp2p/throughput.svg)](https://waffle.io/libp2p/go-libp2p/metrics/throughput) - -[**`Weekly Core Dev Calls`**](https://github.com/ipfs/pm/issues/674) - -# Table of Contents - -- [Background](#background) -- [Usage](#usage) - - [API](#api) - - [Examples](#examples) -- [Development](#development) - - [Using the libp2p Workspace](#using-the-libp2p-workspace) - - [About gx](#about-gx) - - [Tests](#tests) - - [Packages](#packages) -- [Contribute](#contribute) - -## Background - -[libp2p](https://github.com/libp2p/specs) is a networking stack and library modularized out of [The IPFS Project](https://github.com/ipfs/ipfs), and bundled separately for other tools to use. -> -libp2p is the product of a long, and arduous quest of understanding -- a deep dive into the internet's network stack, and plentiful peer-to-peer protocols from the past. Building large scale peer-to-peer systems has been complex and difficult in the last 15 years, and libp2p is a way to fix that. It is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects. -> -> We will be writing a set of docs, posts, tutorials, and talks to explain what p2p is, why it is tremendously useful, and how it can help your existing and new projects. But in the meantime, check out -> -> - [**Our developing collection of docs**](https://docs.libp2p.io) -> - [**Our community discussion forums**](https://discuss.libp2p.io) -> - [**The libp2p Specification**](https://github.com/libp2p/specs) -> - [**go-libp2p implementation**](https://github.com/libp2p/go-libp2p) -> - [**js-libp2p implementation**](https://github.com/libp2p/js-libp2p) -> - [**rust-libp2p implementation**](https://github.com/libp2p/rust-libp2p) - -## Usage - -This repository (`go-libp2p`) serves as the entrypoint to the universe of modules that compose the Go implementation of the libp2p stack. - -We mainly use [Go modules](https://github.com/golang/go/wiki/Modules) for our dependency and release management (and thus require go >= 1.11). In order to get the best developer experience, we recommend you do too. Otherwise, you may ocassionally encounter a breaking build as you'll be running off master (which, by definition, is not guaranteed to be stable). - -You can start using go-libp2p in your Go application simply by adding imports from our repos, e.g.: - -```go -import "github.com/libp2p/go-libp2p" -``` - -The next time you run `go get` or `go build`, the Go build tools will look for [available releases](https://github.com/libp2p/go-libp2p/releases), and will pick the highest available one. - -As new releases of go-libp2p are made available, you can upgrade your application by manually editing your `go.mod` file, or using the [Go tools](https://golang.org/cmd/go/#hdr-Maintaining_module_requirements) to maintain module requirements. - -### API - -[![GoDoc](https://godoc.org/github.com/libp2p/go-libp2p?status.svg)](https://godoc.org/github.com/libp2p/go-libp2p) - -### Examples - -Examples can be found in the [examples repo](https://github.com/libp2p/go-libp2p-examples). - -## Development - -### Using the libp2p Workspace - -While developing, you may need to make changes to several modules at once, or you may want changes made locally in one module to be available for import by another. - -The [go libp2p workspace](https://github.com/libp2p/workspace-go-libp2p) provides a developer-oriented view of the modules that comprise go-libp2p. - -Using the tooling in the workspace repository, you can checkout all of go-libp2p's module repos and enter "local mode", which adds [replace directives](https://github.com/golang/go/wiki/Modules#gomod) to the go.mod files in each local working copy. When you build locally, the libp2p depdendencies will be resolved from your local working copies. - -Once you've committed your changes, you can switch back to "remote mode", which removes the replace directives and pulls imports from the main go module cache. - -See the [workspace repo](https://github.com/libp2p/workspace-go-libp2p) for more information. - -### About gx - -Before adopting gomod, libp2p used [gx](https://github.com/whyrusleeping/gx) to manage dependencies using [IPFS](https://ipfs.io). - -Due to the difficulties in keeping both dependency management solutions up-to-date, gx support was ended in April 2019. - -Ending gx support does not mean that existing gx builds will break. Because gx references dependencies by their immutable IPFS hash, any currently working gx builds will continue to work for as long as the dependencies are resolvable in IPFS. - -However, new changes to go-libp2p will not be published via gx, and users are encouraged to adopt gomod to stay up-to-date. - -If you experience any issues migrating from gx to gomod, please [join the discussion at the libp2p forums](https://discuss.libp2p.io/t/gomod-and-go-libp2p/44). - -### Tests - -`go test ./...` will run all tests in the repo. - -### Packages - -> This table is generated using the module [`package-table`](https://github.com/ipfs-shipyard/package-table) with `package-table --data=package-list.json`. - -List of packages currently in existence for libp2p: - -| Name | CI | Coverage | Description | -| ---------|---------|---------|--------- | -| **Libp2p** | -| [`go-libp2p`](//github.com/libp2p/go-libp2p) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p) | go-libp2p entry point | -| [`go-libp2p-host`](//github.com/libp2p/go-libp2p-host) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-host.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-host) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-host/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-host) | libp2p "host" interface | -| [`go-libp2p-blankhost`](//github.com/libp2p/go-libp2p-blankhost) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-blankhost.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-blankhost) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-blankhost/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-blankhost) | minimal implementation of the "host" interface | -| **Network** | -| [`go-libp2p-net`](//github.com/libp2p/go-libp2p-net) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-net.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-net) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-net/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-net) | libp2p connection and "network" interfaces | -| [`go-libp2p-swarm`](//github.com/libp2p/go-libp2p-swarm) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-swarm.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-swarm) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-swarm/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-swarm) | reference implementation | -| **Transport** | -| [`go-libp2p-transport`](//github.com/libp2p/go-libp2p-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-transport) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-transport) | interfaces | -| [`go-ws-transport`](//github.com/libp2p/go-ws-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-ws-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-ws-transport) | [![codecov](https://codecov.io/gh/libp2p/go-ws-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-ws-transport) | WebSocket transport | -| [`go-tcp-transport`](//github.com/libp2p/go-tcp-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-tcp-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-tcp-transport) | [![codecov](https://codecov.io/gh/libp2p/go-tcp-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-tcp-transport) | TCP transport | -| [`go-libp2p-quic-transport`](//github.com/libp2p/go-libp2p-quic-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-quic-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-quic-transport) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-quic-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-quic-transport) | QUIC transport | -| [`go-udp-transport`](//github.com/libp2p/go-udp-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-udp-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-udp-transport) | [![codecov](https://codecov.io/gh/libp2p/go-udp-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-udp-transport) | UDP transport | -| [`go-utp-transport`](//github.com/libp2p/go-utp-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-utp-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-utp-transport) | [![codecov](https://codecov.io/gh/libp2p/go-utp-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-utp-transport) | uTorrent transport (UTP) | -| [`go-libp2p-circuit`](//github.com/libp2p/go-libp2p-circuit) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-circuit.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-circuit) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-circuit/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-circuit) | relay transport | -| [`go-libp2p-transport-upgrader`](//github.com/libp2p/go-libp2p-transport-upgrader) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-transport-upgrader.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-transport-upgrader) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-transport-upgrader/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-transport-upgrader) | upgrades multiaddr-net connections into full libp2p transports | -| [`go-libp2p-reuseport-transport`](//github.com/libp2p/go-libp2p-reuseport-transport) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-reuseport-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-reuseport-transport) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-reuseport-transport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-reuseport-transport) | partial transport for building transports that reuse ports | -| **Encrypted Channels** | -| [`go-conn-security`](//github.com/libp2p/go-conn-security) | [![Travis CI](https://travis-ci.com/libp2p/go-conn-security.svg?branch=master)](https://travis-ci.com/libp2p/go-conn-security) | [![codecov](https://codecov.io/gh/libp2p/go-conn-security/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-conn-security) | interfaces | -| [`go-libp2p-secio`](//github.com/libp2p/go-libp2p-secio) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-secio.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-secio) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-secio/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-secio) | SecIO crypto channel | -| [`go-conn-security-multistream`](//github.com/libp2p/go-conn-security-multistream) | [![Travis CI](https://travis-ci.com/libp2p/go-conn-security-multistream.svg?branch=master)](https://travis-ci.com/libp2p/go-conn-security-multistream) | [![codecov](https://codecov.io/gh/libp2p/go-conn-security-multistream/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-conn-security-multistream) | multistream multiplexed meta crypto channel | -| **Private Network** | -| [`go-libp2p-interface-pnet`](//github.com/libp2p/go-libp2p-interface-pnet) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-interface-pnet.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-interface-pnet) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-interface-pnet/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-interface-pnet) | interfaces | -| [`go-libp2p-pnet`](//github.com/libp2p/go-libp2p-pnet) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-pnet.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-pnet) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-pnet/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-pnet) | reference implementation | -| **Stream Muxers** | -| [`go-stream-muxer`](//github.com/libp2p/go-stream-muxer) | [![Travis CI](https://travis-ci.com/libp2p/go-stream-muxer.svg?branch=master)](https://travis-ci.com/libp2p/go-stream-muxer) | [![codecov](https://codecov.io/gh/libp2p/go-stream-muxer/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-stream-muxer) | interfaces | -| [`go-smux-yamux`](//github.com/whyrusleeping/go-smux-yamux) | [![Travis CI](https://travis-ci.com/whyrusleeping/go-smux-yamux.svg?branch=master)](https://travis-ci.com/whyrusleeping/go-smux-yamux) | [![codecov](https://codecov.io/gh/whyrusleeping/go-smux-yamux/branch/master/graph/badge.svg)](https://codecov.io/gh/whyrusleeping/go-smux-yamux) | YAMUX stream multiplexer | -| [`go-smux-multiplex`](//github.com/whyrusleeping/go-smux-multiplex) | [![Travis CI](https://travis-ci.com/whyrusleeping/go-smux-multiplex.svg?branch=master)](https://travis-ci.com/whyrusleeping/go-smux-multiplex) | [![codecov](https://codecov.io/gh/whyrusleeping/go-smux-multiplex/branch/master/graph/badge.svg)](https://codecov.io/gh/whyrusleeping/go-smux-multiplex) | MPLEX stream multiplexer | -| **NAT Traversal** | -| [`go-libp2p-nat`](//github.com/libp2p/go-libp2p-nat) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-nat.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-nat) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-nat/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-nat) | | -| **Peerstore** | -| [`go-libp2p-peerstore`](//github.com/libp2p/go-libp2p-peerstore) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-peerstore.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-peerstore) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-peerstore/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-peerstore) | interfaces and reference implementation | -| **Connection Manager** | -| [`go-libp2p-interface-connmgr`](//github.com/libp2p/go-libp2p-interface-connmgr) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-interface-connmgr.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-interface-connmgr) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-interface-connmgr/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-interface-connmgr) | interface | -| [`go-libp2p-connmgr`](//github.com/libp2p/go-libp2p-connmgr) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-connmgr.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-connmgr) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-connmgr/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-connmgr) | reference implementation | -| **Routing** | -| [`go-libp2p-routing`](//github.com/libp2p/go-libp2p-routing) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-routing.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-routing) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-routing/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-routing) | routing interfaces | -| [`go-libp2p-record`](//github.com/libp2p/go-libp2p-record) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-record.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-record) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-record/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-record) | record type and validator logic | -| [`go-libp2p-routing-helpers`](//github.com/libp2p/go-libp2p-routing-helpers) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-routing-helpers.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-routing-helpers) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-routing-helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-routing-helpers) | helpers for composing routers | -| [`go-libp2p-kad-dht`](//github.com/libp2p/go-libp2p-kad-dht) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-kad-dht.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-kad-dht) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-kad-dht/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-kad-dht) | Kademlia-like router | -| [`go-libp2p-pubsub-router`](//github.com/libp2p/go-libp2p-pubsub-router) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-pubsub-router.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-pubsub-router) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-pubsub-router/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-pubsub-router) | record-store over pubsub adapter | -| **Consensus** | -| [`go-libp2p-consensus`](//github.com/libp2p/go-libp2p-consensus) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-consensus.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-consensus) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-consensus/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-consensus) | consensus protocols interfaces | -| [`go-libp2p-raft`](//github.com/libp2p/go-libp2p-raft) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-raft.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-raft) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-raft/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-raft) | consensus implementation over raft | -| **Pubsub** | -| [`go-libp2p-pubsub`](//github.com/libp2p/go-libp2p-pubsub) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-pubsub.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-pubsub) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-pubsub/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-pubsub) | multiple pubsub over libp2p implementations | -| **RPC** | -| [`go-libp2p-gorpc`](//github.com/libp2p/go-libp2p-gorpc) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-gorpc.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-gorpc) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-gorpc/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-gorpc) | a simple RPC library for libp2p | -| **Metrics** | -| [`go-libp2p-metrics`](//github.com/libp2p/go-libp2p-metrics) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-metrics.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-metrics) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-metrics/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-metrics) | libp2p metrics interfaces/collectors | -| **Data Types** | -| [`go-libp2p-peer`](//github.com/libp2p/go-libp2p-peer) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-peer.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-peer) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-peer/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-peer) | libp2p peer-ID datatype | -| [`go-libp2p-crypto`](//github.com/libp2p/go-libp2p-crypto) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-crypto.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-crypto) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-crypto/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-crypto) | libp2p key types | -| [`go-libp2p-protocol`](//github.com/libp2p/go-libp2p-protocol) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-protocol.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-protocol) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-protocol/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-protocol) | libp2p protocol datatype | -| [`go-libp2p-kbucket`](//github.com/libp2p/go-libp2p-kbucket) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-kbucket.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-kbucket) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-kbucket/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-kbucket) | Kademlia routing table helper types | -| **Utilities/miscellaneous** | -| [`go-libp2p-loggables`](//github.com/libp2p/go-libp2p-loggables) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-loggables.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-loggables) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-loggables/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-loggables) | logging helpers | -| [`go-maddr-filter`](//github.com/libp2p/go-maddr-filter) | [![Travis CI](https://travis-ci.com/libp2p/go-maddr-filter.svg?branch=master)](https://travis-ci.com/libp2p/go-maddr-filter) | [![codecov](https://codecov.io/gh/libp2p/go-maddr-filter/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-maddr-filter) | multiaddr filtering helpers | -| [`go-libp2p-netutil`](//github.com/libp2p/go-libp2p-netutil) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-netutil.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-netutil) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-netutil/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-netutil) | misc utilities | -| [`go-msgio`](//github.com/libp2p/go-msgio) | [![Travis CI](https://travis-ci.com/libp2p/go-msgio.svg?branch=master)](https://travis-ci.com/libp2p/go-msgio) | [![codecov](https://codecov.io/gh/libp2p/go-msgio/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-msgio) | length prefixed data channel | -| [`go-addr-util`](//github.com/libp2p/go-addr-util) | [![Travis CI](https://travis-ci.com/libp2p/go-addr-util.svg?branch=master)](https://travis-ci.com/libp2p/go-addr-util) | [![codecov](https://codecov.io/gh/libp2p/go-addr-util/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-addr-util) | address utilities for libp2p swarm | -| [`go-buffer-pool`](//github.com/libp2p/go-buffer-pool) | [![Travis CI](https://travis-ci.com/libp2p/go-buffer-pool.svg?branch=master)](https://travis-ci.com/libp2p/go-buffer-pool) | [![codecov](https://codecov.io/gh/libp2p/go-buffer-pool/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-buffer-pool) | a variable size buffer pool for go | -| [`go-libp2p-routing-helpers`](//github.com/libp2p/go-libp2p-routing-helpers) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-routing-helpers.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-routing-helpers) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-routing-helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-routing-helpers) | routing helpers | -| [`go-reuseport`](//github.com/libp2p/go-reuseport) | [![Travis CI](https://travis-ci.com/libp2p/go-reuseport.svg?branch=master)](https://travis-ci.com/libp2p/go-reuseport) | [![codecov](https://codecov.io/gh/libp2p/go-reuseport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-reuseport) | enables reuse of addresses | -| [`go-sockaddr`](//github.com/libp2p/go-sockaddr) | [![Travis CI](https://travis-ci.com/libp2p/go-sockaddr.svg?branch=master)](https://travis-ci.com/libp2p/go-sockaddr) | [![codecov](https://codecov.io/gh/libp2p/go-sockaddr/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-sockaddr) | utils for sockaddr conversions | -| [`go-flow-metrics`](//github.com/libp2p/go-flow-metrics) | [![Travis CI](https://travis-ci.com/libp2p/go-flow-metrics.svg?branch=master)](https://travis-ci.com/libp2p/go-flow-metrics) | [![codecov](https://codecov.io/gh/libp2p/go-flow-metrics/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-flow-metrics) | metrics library | -| **Testing and examples** | -| [`go-testutil`](//github.com/libp2p/go-testutil) | [![Travis CI](https://travis-ci.com/libp2p/go-testutil.svg?branch=master)](https://travis-ci.com/libp2p/go-testutil) | [![codecov](https://codecov.io/gh/libp2p/go-testutil/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-testutil) | a collection of testing utilities for ipfs and libp2p | -| [`go-libp2p-examples`](//github.com/libp2p/go-libp2p-examples) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-examples.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-examples) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-examples/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-examples) | go-libp2p examples and tutorials | -| [`go-libp2p-circuit-progs`](//github.com/libp2p/go-libp2p-circuit-progs) | [![Travis CI](https://travis-ci.com/libp2p/go-libp2p-circuit-progs.svg?branch=master)](https://travis-ci.com/libp2p/go-libp2p-circuit-progs) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-circuit-progs/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-circuit-progs) | testing programs for go-libp2p-circuit | - -# Contribute - -go-libp2p is part of [The IPFS Project](https://github.com/ipfs/ipfs), and is MIT licensed open source software. We welcome contributions big and small! Take a look at the [community contributing notes](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md). Please make sure to check the [issues](https://github.com/ipfs/go-libp2p/issues). Search the closed ones before reporting things, and help us with the open ones. - -Guidelines: - -- read the [libp2p spec](https://github.com/libp2p/specs) -- please make branches + pull-request, even if working on the main repository -- ask questions or talk about things in [Issues](https://github.com/libp2p/go-libp2p/issues), our [discussion forums](https://discuss.libp2p.io), or #libp2p or #ipfs on freenode. -- ensure you are able to contribute (no legal issues please-- we use the DCO) -- run `go fmt` before pushing any code -- run `golint` and `go vet` too -- some things (like protobuf files) are expected to fail. -- get in touch with @jbenet and @diasdavid about how best to contribute -- have fun! - -There's a few things you can do right now to help out: - - Go through the modules below and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrasture behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. - - **Perform code reviews**. - - **Add tests**. There can never be enough tests. - ---- - -The last gx published version of this module was: 6.0.41: QmTRN7hRxvGkxKxDdeudty7sRet4L7ZKZCqKsXHa79wmAc diff --git a/vendor/github.com/libp2p/go-libp2p/codecov.yml b/vendor/github.com/libp2p/go-libp2p/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-libp2p/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-libp2p/config/config.go b/vendor/github.com/libp2p/go-libp2p/config/config.go deleted file mode 100644 index 3bb51bf1..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/config.go +++ /dev/null @@ -1,258 +0,0 @@ -package config - -import ( - "context" - "fmt" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/metrics" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/pnet" - "github.com/libp2p/go-libp2p-core/routing" - - bhost "github.com/libp2p/go-libp2p/p2p/host/basic" - relay "github.com/libp2p/go-libp2p/p2p/host/relay" - routed "github.com/libp2p/go-libp2p/p2p/host/routed" - - circuit "github.com/libp2p/go-libp2p-circuit" - discovery "github.com/libp2p/go-libp2p-discovery" - swarm "github.com/libp2p/go-libp2p-swarm" - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - - logging "github.com/ipfs/go-log" - filter "github.com/libp2p/go-maddr-filter" - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("p2p-config") - -// AddrsFactory is a function that takes a set of multiaddrs we're listening on and -// returns the set of multiaddrs we should advertise to the network. -type AddrsFactory = bhost.AddrsFactory - -// NATManagerC is a NATManager constructor. -type NATManagerC func(network.Network) bhost.NATManager - -type RoutingC func(host.Host) (routing.PeerRouting, error) - -// Config describes a set of settings for a libp2p node -// -// This is *not* a stable interface. Use the options defined in the root -// package. -type Config struct { - PeerKey crypto.PrivKey - - Transports []TptC - Muxers []MsMuxC - SecurityTransports []MsSecC - Insecure bool - Protector pnet.Protector - - RelayCustom bool - Relay bool - RelayOpts []circuit.RelayOpt - - ListenAddrs []ma.Multiaddr - AddrsFactory bhost.AddrsFactory - Filters *filter.Filters - - ConnManager connmgr.ConnManager - NATManager NATManagerC - Peerstore peerstore.Peerstore - Reporter metrics.Reporter - - DisablePing bool - - Routing RoutingC - - EnableAutoRelay bool -} - -// NewNode constructs a new libp2p Host from the Config. -// -// This function consumes the config. Do not reuse it (really!). -func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { - // Check this early. Prevents us from even *starting* without verifying this. - if pnet.ForcePrivateNetwork && cfg.Protector == nil { - log.Error("tried to create a libp2p node with no Private" + - " Network Protector but usage of Private Networks" + - " is forced by the enviroment") - // Note: This is *also* checked the upgrader itself so it'll be - // enforced even *if* you don't use the libp2p constructor. - return nil, pnet.ErrNotInPrivateNetwork - } - - if cfg.PeerKey == nil { - return nil, fmt.Errorf("no peer key specified") - } - - // Obtain Peer ID from public key - pid, err := peer.IDFromPublicKey(cfg.PeerKey.GetPublic()) - if err != nil { - return nil, err - } - - if cfg.Peerstore == nil { - return nil, fmt.Errorf("no peerstore specified") - } - - if !cfg.Insecure { - if err := cfg.Peerstore.AddPrivKey(pid, cfg.PeerKey); err != nil { - return nil, err - } - if err := cfg.Peerstore.AddPubKey(pid, cfg.PeerKey.GetPublic()); err != nil { - return nil, err - } - } - - // TODO: Make the swarm implementation configurable. - swrm := swarm.NewSwarm(ctx, pid, cfg.Peerstore, cfg.Reporter) - if cfg.Filters != nil { - swrm.Filters = cfg.Filters - } - - h, err := bhost.NewHost(ctx, swrm, &bhost.HostOpts{ - ConnManager: cfg.ConnManager, - AddrsFactory: cfg.AddrsFactory, - NATManager: cfg.NATManager, - EnablePing: !cfg.DisablePing, - }) - - if err != nil { - swrm.Close() - return nil, err - } - - if cfg.Relay { - // If we've enabled the relay, we should filter out relay - // addresses by default. - // - // TODO: We shouldn't be doing this here. - oldFactory := h.AddrsFactory - h.AddrsFactory = func(addrs []ma.Multiaddr) []ma.Multiaddr { - return oldFactory(relay.Filter(addrs)) - } - } - - upgrader := new(tptu.Upgrader) - upgrader.Protector = cfg.Protector - upgrader.Filters = swrm.Filters - if cfg.Insecure { - upgrader.Secure = makeInsecureTransport(pid) - } else { - upgrader.Secure, err = makeSecurityTransport(h, cfg.SecurityTransports) - if err != nil { - h.Close() - return nil, err - } - } - - upgrader.Muxer, err = makeMuxer(h, cfg.Muxers) - if err != nil { - h.Close() - return nil, err - } - - tpts, err := makeTransports(h, upgrader, cfg.Transports) - if err != nil { - h.Close() - return nil, err - } - for _, t := range tpts { - err = swrm.AddTransport(t) - if err != nil { - h.Close() - return nil, err - } - } - - if cfg.Relay { - err := circuit.AddRelayTransport(swrm.Context(), h, upgrader, cfg.RelayOpts...) - if err != nil { - h.Close() - return nil, err - } - } - - // TODO: This method succeeds if listening on one address succeeds. We - // should probably fail if listening on *any* addr fails. - if err := h.Network().Listen(cfg.ListenAddrs...); err != nil { - h.Close() - return nil, err - } - - // Configure routing and autorelay - var router routing.PeerRouting - if cfg.Routing != nil { - router, err = cfg.Routing(h) - if err != nil { - h.Close() - return nil, err - } - } - - if cfg.EnableAutoRelay { - if !cfg.Relay { - h.Close() - return nil, fmt.Errorf("cannot enable autorelay; relay is not enabled") - } - - if router == nil { - h.Close() - return nil, fmt.Errorf("cannot enable autorelay; no routing for discovery") - } - - crouter, ok := router.(routing.ContentRouting) - if !ok { - h.Close() - return nil, fmt.Errorf("cannot enable autorelay; no suitable routing for discovery") - } - - discovery := discovery.NewRoutingDiscovery(crouter) - - hop := false - for _, opt := range cfg.RelayOpts { - if opt == circuit.OptHop { - hop = true - break - } - } - - if hop { - // advertise ourselves - relay.Advertise(ctx, discovery) - } else { - _ = relay.NewAutoRelay(swrm.Context(), h, discovery, router) - } - } - - // start the host background tasks - h.Start() - - if router != nil { - return routed.Wrap(h, router), nil - } - return h, nil -} - -// Option is a libp2p config option that can be given to the libp2p constructor -// (`libp2p.New`). -type Option func(cfg *Config) error - -// Apply applies the given options to the config, returning the first error -// encountered (if any). -func (cfg *Config) Apply(opts ...Option) error { - for _, opt := range opts { - if opt == nil { - continue - } - if err := opt(cfg); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/config/constructor_types.go b/vendor/github.com/libp2p/go-libp2p/config/constructor_types.go deleted file mode 100644 index 6f58c266..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/constructor_types.go +++ /dev/null @@ -1,63 +0,0 @@ -package config - -import ( - "fmt" - "reflect" - - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/mux" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/pnet" - "github.com/libp2p/go-libp2p-core/sec" - "github.com/libp2p/go-libp2p-core/transport" - - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - filter "github.com/libp2p/go-maddr-filter" -) - -var ( - // interfaces - hostType = reflect.TypeOf((*host.Host)(nil)).Elem() - networkType = reflect.TypeOf((*network.Network)(nil)).Elem() - transportType = reflect.TypeOf((*transport.Transport)(nil)).Elem() - muxType = reflect.TypeOf((*mux.Multiplexer)(nil)).Elem() - securityType = reflect.TypeOf((*sec.SecureTransport)(nil)).Elem() - protectorType = reflect.TypeOf((*pnet.Protector)(nil)).Elem() - privKeyType = reflect.TypeOf((*crypto.PrivKey)(nil)).Elem() - pubKeyType = reflect.TypeOf((*crypto.PubKey)(nil)).Elem() - pstoreType = reflect.TypeOf((*peerstore.Peerstore)(nil)).Elem() - - // concrete types - peerIDType = reflect.TypeOf((peer.ID)("")) - filtersType = reflect.TypeOf((*filter.Filters)(nil)) - upgraderType = reflect.TypeOf((*tptu.Upgrader)(nil)) -) - -var argTypes = map[reflect.Type]constructor{ - upgraderType: func(h host.Host, u *tptu.Upgrader) interface{} { return u }, - hostType: func(h host.Host, u *tptu.Upgrader) interface{} { return h }, - networkType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Network() }, - muxType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Muxer }, - securityType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Secure }, - protectorType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Protector }, - filtersType: func(h host.Host, u *tptu.Upgrader) interface{} { return u.Filters }, - peerIDType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.ID() }, - privKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PrivKey(h.ID()) }, - pubKeyType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore().PubKey(h.ID()) }, - pstoreType: func(h host.Host, u *tptu.Upgrader) interface{} { return h.Peerstore() }, -} - -func newArgTypeSet(types ...reflect.Type) map[reflect.Type]constructor { - result := make(map[reflect.Type]constructor, len(types)) - for _, ty := range types { - c, ok := argTypes[ty] - if !ok { - panic(fmt.Sprintf("missing constructor for type %s", ty)) - } - result[ty] = c - } - return result -} diff --git a/vendor/github.com/libp2p/go-libp2p/config/muxer.go b/vendor/github.com/libp2p/go-libp2p/config/muxer.go deleted file mode 100644 index 6f99336c..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/muxer.go +++ /dev/null @@ -1,63 +0,0 @@ -package config - -import ( - "fmt" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/mux" - msmux "github.com/libp2p/go-stream-muxer-multistream" -) - -// MuxC is a stream multiplex transport constructor -type MuxC func(h host.Host) (mux.Multiplexer, error) - -// MsMuxC is a tuple containing a multiplex transport constructor and a protocol -// ID. -type MsMuxC struct { - MuxC - ID string -} - -var muxArgTypes = newArgTypeSet(hostType, networkType, peerIDType, pstoreType) - -// MuxerConstructor creates a multiplex constructor from the passed parameter -// using reflection. -func MuxerConstructor(m interface{}) (MuxC, error) { - // Already constructed? - if t, ok := m.(mux.Multiplexer); ok { - return func(_ host.Host) (mux.Multiplexer, error) { - return t, nil - }, nil - } - - ctor, err := makeConstructor(m, muxType, muxArgTypes) - if err != nil { - return nil, err - } - return func(h host.Host) (mux.Multiplexer, error) { - t, err := ctor(h, nil) - if err != nil { - return nil, err - } - return t.(mux.Multiplexer), nil - }, nil -} - -func makeMuxer(h host.Host, tpts []MsMuxC) (mux.Multiplexer, error) { - muxMuxer := msmux.NewBlankTransport() - transportSet := make(map[string]struct{}, len(tpts)) - for _, tptC := range tpts { - if _, ok := transportSet[tptC.ID]; ok { - return nil, fmt.Errorf("duplicate muxer transport: %s", tptC.ID) - } - transportSet[tptC.ID] = struct{}{} - } - for _, tptC := range tpts { - tpt, err := tptC.MuxC(h) - if err != nil { - return nil, err - } - muxMuxer.AddTransport(tptC.ID, tpt) - } - return muxMuxer, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/config/reflection_magic.go b/vendor/github.com/libp2p/go-libp2p/config/reflection_magic.go deleted file mode 100644 index b422cf71..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/reflection_magic.go +++ /dev/null @@ -1,126 +0,0 @@ -package config - -import ( - "fmt" - "reflect" - "runtime" - - "github.com/libp2p/go-libp2p-core/host" - tptu "github.com/libp2p/go-libp2p-transport-upgrader" -) - -var errorType = reflect.TypeOf((*error)(nil)).Elem() - -// checks if a function returns either the specified type or the specified type -// and an error. -func checkReturnType(fnType, tptType reflect.Type) error { - switch fnType.NumOut() { - case 2: - if fnType.Out(1) != errorType { - return fmt.Errorf("expected (optional) second return value from transport constructor to be an error") - } - - fallthrough - case 1: - if !fnType.Out(0).Implements(tptType) { - return fmt.Errorf("transport constructor returns %s which doesn't implement %s", fnType.Out(0), tptType) - } - default: - return fmt.Errorf("expected transport constructor to return a transport and, optionally, an error") - } - return nil -} - -// Handles return values with optional errors. That is, return values of the -// form `(something, error)` or just `something`. -// -// Panics if the return value isn't of the correct form. -func handleReturnValue(out []reflect.Value) (interface{}, error) { - switch len(out) { - case 2: - err := out[1] - if err != (reflect.Value{}) && !err.IsNil() { - return nil, err.Interface().(error) - } - fallthrough - case 1: - tpt := out[0] - - // Check for nil value and nil error. - if tpt == (reflect.Value{}) { - return nil, fmt.Errorf("unspecified error") - } - switch tpt.Kind() { - case reflect.Ptr, reflect.Interface, reflect.Func: - if tpt.IsNil() { - return nil, fmt.Errorf("unspecified error") - } - } - - return tpt.Interface(), nil - default: - panic("expected 1 or 2 return values from transport constructor") - } -} - -// calls the transport constructor and annotates the error with the name of the constructor. -func callConstructor(c reflect.Value, args []reflect.Value) (interface{}, error) { - val, err := handleReturnValue(c.Call(args)) - if err != nil { - name := runtime.FuncForPC(c.Pointer()).Name() - if name != "" { - // makes debugging easier - return nil, fmt.Errorf("transport constructor %s failed: %s", name, err) - } - } - return val, err -} - -type constructor func(h host.Host, u *tptu.Upgrader) interface{} - -func makeArgumentConstructors(fnType reflect.Type, argTypes map[reflect.Type]constructor) ([]constructor, error) { - out := make([]constructor, fnType.NumIn()) - for i := range out { - argType := fnType.In(i) - c, ok := argTypes[argType] - if !ok { - return nil, fmt.Errorf("argument %d has an unexpected type %s", i, argType.Name()) - } - out[i] = c - } - return out, nil -} - -// makes a transport constructor. -func makeConstructor( - tpt interface{}, - tptType reflect.Type, - argTypes map[reflect.Type]constructor, -) (func(host.Host, *tptu.Upgrader) (interface{}, error), error) { - v := reflect.ValueOf(tpt) - // avoid panicing on nil/zero value. - if v == (reflect.Value{}) { - return nil, fmt.Errorf("expected a transport or transport constructor, got a %T", tpt) - } - t := v.Type() - if t.Kind() != reflect.Func { - return nil, fmt.Errorf("expected a transport or transport constructor, got a %T", tpt) - } - - if err := checkReturnType(t, tptType); err != nil { - return nil, err - } - - argConstructors, err := makeArgumentConstructors(t, argTypes) - if err != nil { - return nil, err - } - - return func(h host.Host, u *tptu.Upgrader) (interface{}, error) { - arguments := make([]reflect.Value, len(argConstructors)) - for i, makeArg := range argConstructors { - arguments[i] = reflect.ValueOf(makeArg(h, u)) - } - return callConstructor(v, arguments) - }, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/config/security.go b/vendor/github.com/libp2p/go-libp2p/config/security.go deleted file mode 100644 index 8e1c710c..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/security.go +++ /dev/null @@ -1,78 +0,0 @@ -package config - -import ( - "fmt" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/sec" - "github.com/libp2p/go-libp2p-core/sec/insecure" - - csms "github.com/libp2p/go-conn-security-multistream" -) - -// SecC is a security transport constructor -type SecC func(h host.Host) (sec.SecureTransport, error) - -// MsSecC is a tuple containing a security transport constructor and a protocol -// ID. -type MsSecC struct { - SecC - ID string -} - -var securityArgTypes = newArgTypeSet( - hostType, networkType, peerIDType, - privKeyType, pubKeyType, pstoreType, -) - -// SecurityConstructor creates a security constructor from the passed parameter -// using reflection. -func SecurityConstructor(security interface{}) (SecC, error) { - // Already constructed? - if t, ok := security.(sec.SecureTransport); ok { - return func(_ host.Host) (sec.SecureTransport, error) { - return t, nil - }, nil - } - - ctor, err := makeConstructor(security, securityType, securityArgTypes) - if err != nil { - return nil, err - } - return func(h host.Host) (sec.SecureTransport, error) { - t, err := ctor(h, nil) - if err != nil { - return nil, err - } - return t.(sec.SecureTransport), nil - }, nil -} - -func makeInsecureTransport(id peer.ID) sec.SecureTransport { - secMuxer := new(csms.SSMuxer) - secMuxer.AddTransport(insecure.ID, insecure.New(id)) - return secMuxer -} - -func makeSecurityTransport(h host.Host, tpts []MsSecC) (sec.SecureTransport, error) { - secMuxer := new(csms.SSMuxer) - transportSet := make(map[string]struct{}, len(tpts)) - for _, tptC := range tpts { - if _, ok := transportSet[tptC.ID]; ok { - return nil, fmt.Errorf("duplicate security transport: %s", tptC.ID) - } - transportSet[tptC.ID] = struct{}{} - } - for _, tptC := range tpts { - tpt, err := tptC.SecC(h) - if err != nil { - return nil, err - } - if _, ok := tpt.(*insecure.Transport); ok { - return nil, fmt.Errorf("cannot construct libp2p with an insecure transport, set the Insecure config option instead") - } - secMuxer.AddTransport(tptC.ID, tpt) - } - return secMuxer, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/config/transport.go b/vendor/github.com/libp2p/go-libp2p/config/transport.go deleted file mode 100644 index ac8f8ee7..00000000 --- a/vendor/github.com/libp2p/go-libp2p/config/transport.go +++ /dev/null @@ -1,67 +0,0 @@ -package config - -import ( - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/transport" - - tptu "github.com/libp2p/go-libp2p-transport-upgrader" -) - -// TptC is the type for libp2p transport constructors. You probably won't ever -// implement this function interface directly. Instead, pass your transport -// constructor to TransportConstructor. -type TptC func(h host.Host, u *tptu.Upgrader) (transport.Transport, error) - -var transportArgTypes = argTypes - -// TransportConstructor uses reflection to turn a function that constructs a -// transport into a TptC. -// -// You can pass either a constructed transport (something that implements -// `transport.Transport`) or a function that takes any of: -// -// * The local peer ID. -// * A transport connection upgrader. -// * A private key. -// * A public key. -// * A Host. -// * A Network. -// * A Peerstore. -// * An address filter. -// * A security transport. -// * A stream multiplexer transport. -// * A private network protector. -// -// And returns a type implementing transport.Transport and, optionally, an error -// (as the second argument). -func TransportConstructor(tpt interface{}) (TptC, error) { - // Already constructed? - if t, ok := tpt.(transport.Transport); ok { - return func(_ host.Host, _ *tptu.Upgrader) (transport.Transport, error) { - return t, nil - }, nil - } - ctor, err := makeConstructor(tpt, transportType, transportArgTypes) - if err != nil { - return nil, err - } - return func(h host.Host, u *tptu.Upgrader) (transport.Transport, error) { - t, err := ctor(h, u) - if err != nil { - return nil, err - } - return t.(transport.Transport), nil - }, nil -} - -func makeTransports(h host.Host, u *tptu.Upgrader, tpts []TptC) ([]transport.Transport, error) { - transports := make([]transport.Transport, len(tpts)) - for i, tC := range tpts { - t, err := tC(h, u) - if err != nil { - return nil, err - } - transports[i] = t - } - return transports, nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/defaults.go b/vendor/github.com/libp2p/go-libp2p/defaults.go deleted file mode 100644 index 18de400d..00000000 --- a/vendor/github.com/libp2p/go-libp2p/defaults.go +++ /dev/null @@ -1,140 +0,0 @@ -package libp2p - -// This file contains all the default configuration options. - -import ( - "crypto/rand" - - crypto "github.com/libp2p/go-libp2p-core/crypto" - mplex "github.com/libp2p/go-libp2p-mplex" - pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem" - secio "github.com/libp2p/go-libp2p-secio" - yamux "github.com/libp2p/go-libp2p-yamux" - tcp "github.com/libp2p/go-tcp-transport" - ws "github.com/libp2p/go-ws-transport" - multiaddr "github.com/multiformats/go-multiaddr" -) - -// DefaultSecurity is the default security option. -// -// Useful when you want to extend, but not replace, the supported transport -// security protocols. -var DefaultSecurity = Security(secio.ID, secio.New) - -// DefaultMuxers configures libp2p to use the stream connection multiplexers. -// -// Use this option when you want to *extend* the set of multiplexers used by -// libp2p instead of replacing them. -var DefaultMuxers = ChainOptions( - Muxer("/yamux/1.0.0", yamux.DefaultTransport), - Muxer("/mplex/6.7.0", mplex.DefaultTransport), -) - -// DefaultTransports are the default libp2p transports. -// -// Use this option when you want to *extend* the set of transports used by -// libp2p instead of replacing them. -var DefaultTransports = ChainOptions( - Transport(tcp.NewTCPTransport), - Transport(ws.New), -) - -// DefaultPeerstore configures libp2p to use the default peerstore. -var DefaultPeerstore Option = func(cfg *Config) error { - return cfg.Apply(Peerstore(pstoremem.NewPeerstore())) -} - -// RandomIdentity generates a random identity (default behaviour) -var RandomIdentity = func(cfg *Config) error { - priv, _, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader) - if err != nil { - return err - } - return cfg.Apply(Identity(priv)) -} - -// DefaultListenAddrs configures libp2p to use default listen address -var DefaultListenAddrs = func(cfg *Config) error { - defaultIP4ListenAddr, err := multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0") - if err != nil { - return err - } - - defaultIP6ListenAddr, err := multiaddr.NewMultiaddr("/ip6/::/tcp/0") - if err != nil { - return err - } - return cfg.Apply(ListenAddrs( - defaultIP4ListenAddr, - defaultIP6ListenAddr, - )) -} - -// DefaultEnableRelay enables relay dialing and listening by default -var DefaultEnableRelay = func(cfg *Config) error { - return cfg.Apply(EnableRelay()) -} - -// Complete list of default options and when to fallback on them. -// -// Please *DON'T* specify default options any other way. Putting this all here -// makes tracking defaults *much* easier. -var defaults = []struct { - fallback func(cfg *Config) bool - opt Option -}{ - { - fallback: func(cfg *Config) bool { return cfg.Transports == nil && cfg.ListenAddrs == nil }, - opt: DefaultListenAddrs, - }, - { - fallback: func(cfg *Config) bool { return cfg.Transports == nil }, - opt: DefaultTransports, - }, - { - fallback: func(cfg *Config) bool { return cfg.Muxers == nil }, - opt: DefaultMuxers, - }, - { - fallback: func(cfg *Config) bool { return !cfg.Insecure && cfg.SecurityTransports == nil }, - opt: DefaultSecurity, - }, - { - fallback: func(cfg *Config) bool { return cfg.PeerKey == nil }, - opt: RandomIdentity, - }, - { - fallback: func(cfg *Config) bool { return cfg.Peerstore == nil }, - opt: DefaultPeerstore, - }, - { - fallback: func(cfg *Config) bool { return !cfg.RelayCustom }, - opt: DefaultEnableRelay, - }, -} - -// Defaults configures libp2p to use the default options. Can be combined with -// other options to *extend* the default options. -var Defaults Option = func(cfg *Config) error { - for _, def := range defaults { - if err := cfg.Apply(def.opt); err != nil { - return err - } - } - return nil -} - -// FallbackDefaults applies default options to the libp2p node if and only if no -// other relevent options have been applied. will be appended to the options -// passed into New. -var FallbackDefaults Option = func(cfg *Config) error { - for _, def := range defaults { - if !def.fallback(cfg) { - continue - } - if err := cfg.Apply(def.opt); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/error_util.go b/vendor/github.com/libp2p/go-libp2p/error_util.go deleted file mode 100644 index 86827f4e..00000000 --- a/vendor/github.com/libp2p/go-libp2p/error_util.go +++ /dev/null @@ -1,17 +0,0 @@ -package libp2p - -import ( - "fmt" - "runtime" -) - -func traceError(err error, skip int) error { - if err == nil { - return nil - } - _, file, line, ok := runtime.Caller(skip + 1) - if !ok { - return err - } - return fmt.Errorf("%s:%d: %s", file, line, err) -} diff --git a/vendor/github.com/libp2p/go-libp2p/go.mod b/vendor/github.com/libp2p/go-libp2p/go.mod deleted file mode 100644 index d951ad3a..00000000 --- a/vendor/github.com/libp2p/go-libp2p/go.mod +++ /dev/null @@ -1,37 +0,0 @@ -module github.com/libp2p/go-libp2p - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/ipfs/go-cid v0.0.2 - github.com/ipfs/go-detect-race v0.0.1 - github.com/ipfs/go-ipfs-util v0.0.1 - github.com/ipfs/go-log v0.0.1 - github.com/jbenet/go-cienv v0.1.0 - github.com/jbenet/goprocess v0.1.3 - github.com/libp2p/go-conn-security-multistream v0.1.0 - github.com/libp2p/go-libp2p-autonat v0.1.0 - github.com/libp2p/go-libp2p-blankhost v0.1.1 - github.com/libp2p/go-libp2p-circuit v0.1.0 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-discovery v0.1.0 - github.com/libp2p/go-libp2p-loggables v0.1.0 - github.com/libp2p/go-libp2p-mplex v0.2.1 - github.com/libp2p/go-libp2p-nat v0.0.4 - github.com/libp2p/go-libp2p-netutil v0.1.0 - github.com/libp2p/go-libp2p-peerstore v0.1.0 - github.com/libp2p/go-libp2p-secio v0.1.0 - github.com/libp2p/go-libp2p-swarm v0.1.0 - github.com/libp2p/go-libp2p-testing v0.0.4 - github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 - github.com/libp2p/go-libp2p-yamux v0.2.1 - github.com/libp2p/go-maddr-filter v0.0.4 - github.com/libp2p/go-stream-muxer-multistream v0.2.0 - github.com/libp2p/go-tcp-transport v0.1.0 - github.com/libp2p/go-ws-transport v0.1.0 - github.com/miekg/dns v1.1.12 // indirect - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-dns v0.0.2 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/multiformats/go-multistream v0.1.0 - github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30 -) diff --git a/vendor/github.com/libp2p/go-libp2p/go.sum b/vendor/github.com/libp2p/go-libp2p/go.sum deleted file mode 100644 index 47c9026c..00000000 --- a/vendor/github.com/libp2p/go-libp2p/go.sum +++ /dev/null @@ -1,264 +0,0 @@ -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2 h1:tuuKaZPU1M6HcejsO3AcYWW8sZ8MTvyxfc4uqB4eFE8= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0 h1:aqGmto+ttL/uJgX0JtQI0tD21CIEy5eYd1Hlp0juHY0= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-autonat v0.1.0 h1:aCWAu43Ri4nU0ZPO7NyLzUvvfqd0nE3dX0R/ZGYVgOU= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-circuit v0.1.0 h1:eniLL3Y9aq/sryfyV1IAHj5rlvuyj3b7iz8tSiZpdhY= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0 h1:j+R6cokKcGbnZLf4kcNwpx6mDEUPF3N6SrqMymQhmvs= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4 h1:+KXK324yaY701On8a0aGjTnw8467kW3ExKcqW2wwmyw= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0 h1:MKh7pRNPHSh1fLPj8u/M/s/napdmeNpoi9BRy9lPN0E= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-secio v0.1.0 h1:NNP5KLxuP97sE5Bu3iuwOWyT/dKEGMN5zSLMWdB7GTQ= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-swarm v0.1.0 h1:HrFk2p0awrGEgch9JXK/qp/hfjqQfgNxpLWnCiWPg5s= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4 h1:Qev57UR47GcLPXWjrunv5aLIQGO4n9mhI/8/EIrEEFc= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0 h1:TSPZ5cMMz/wdoYsye/wU1TE4G3LDGMoeEN0xgnCKU/I= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1 h1:Q3XYNiKCC2vIxrvUJL+Jg1kiyeEaIDNKLjgEjo3VQdI= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2 h1:ivPvEKHxmVkTClHzg6RXTYHqaJQ0V9cDbq+6lKb3UV0= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3 h1:l6fKV+p0Xa354EqQOQP+d8CivdLM4kl5GxC1hSc/UeI= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0 h1:714bRJ4Zy9mdhyTLJ+ZKiROmAFwUHpeRidG+q7LTQOg= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0 h1:IGhowvEqyMFknOar4FWCKSWE0zL36UFKQtiRQD60/8o= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-ws-transport v0.1.0 h1:F+0OvvdmPTDsVc4AjPHjV7L7Pk1B7D5QwtDcKE2oag4= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-yamux v1.2.2 h1:s6J6o7+ajoQMjHe7BEnq+EynOj5D2EoG8CuQgL3F2vg= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/miekg/dns v1.1.12 h1:WMhc1ik4LNkTg8U9l3hI1LvxKmIL+f1+WV/SZtCbDDA= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f h1:M/lL30eFZTKnomXY6huvM6G0+gVquFNf6mxghaWlFUg= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30 h1:nMCC9Pwz1pxfC1Y6mYncdk+kq8d5aLx0Q+/gyZGE44M= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-libp2p/libp2p.go b/vendor/github.com/libp2p/go-libp2p/libp2p.go deleted file mode 100644 index 32fddbdb..00000000 --- a/vendor/github.com/libp2p/go-libp2p/libp2p.go +++ /dev/null @@ -1,72 +0,0 @@ -package libp2p - -import ( - "context" - - config "github.com/libp2p/go-libp2p/config" - - "github.com/libp2p/go-libp2p-core/host" -) - -// Config describes a set of settings for a libp2p node -type Config = config.Config - -// Option is a libp2p config option that can be given to the libp2p constructor -// (`libp2p.New`). -type Option = config.Option - -// ChainOptions chains multiple options into a single option. -func ChainOptions(opts ...Option) Option { - return func(cfg *Config) error { - for _, opt := range opts { - if opt == nil { - continue - } - if err := opt(cfg); err != nil { - return err - } - } - return nil - } -} - -// New constructs a new libp2p node with the given options, falling back on -// reasonable defaults. The defaults are: -// -// - If no transport and listen addresses are provided, the node listens to -// the multiaddresses "/ip4/0.0.0.0/tcp/0" and "/ip6/::/tcp/0"; -// -// - If no transport options are provided, the node uses TCP and websocket -// transport protocols; -// -// - If no multiplexer configuration is provided, the node is configured by -// default to use the "yamux/1.0.0" and "mplux/6.7.0" stream connection -// multiplexers; -// -// - If no security transport is provided, the host uses the go-libp2p's secio -// encrypted transport to encrypt all traffic; -// -// - If no peer identity is provided, it generates a random RSA 2048 key-par -// and derives a new identity from it; -// -// - If no peerstore is provided, the host is initialized with an empty -// peerstore. -// -// Canceling the passed context will stop the returned libp2p node. -func New(ctx context.Context, opts ...Option) (host.Host, error) { - return NewWithoutDefaults(ctx, append(opts, FallbackDefaults)...) -} - -// NewWithoutDefaults constructs a new libp2p node with the given options but -// *without* falling back on reasonable defaults. -// -// Warning: This function should not be considered a stable interface. We may -// choose to add required services at any time and, by using this function, you -// opt-out of any defaults we may provide. -func NewWithoutDefaults(ctx context.Context, opts ...Option) (host.Host, error) { - var cfg Config - if err := cfg.Apply(opts...); err != nil { - return nil, err - } - return cfg.NewNode(ctx) -} diff --git a/vendor/github.com/libp2p/go-libp2p/options.go b/vendor/github.com/libp2p/go-libp2p/options.go deleted file mode 100644 index 6d310f1a..00000000 --- a/vendor/github.com/libp2p/go-libp2p/options.go +++ /dev/null @@ -1,321 +0,0 @@ -package libp2p - -// This file contains all libp2p configuration options (except the defaults, -// those are in defaults.go) - -import ( - "fmt" - "net" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/metrics" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/pnet" - - circuit "github.com/libp2p/go-libp2p-circuit" - config "github.com/libp2p/go-libp2p/config" - bhost "github.com/libp2p/go-libp2p/p2p/host/basic" - - filter "github.com/libp2p/go-maddr-filter" - ma "github.com/multiformats/go-multiaddr" -) - -// ListenAddrStrings configures libp2p to listen on the given (unparsed) -// addresses. -func ListenAddrStrings(s ...string) Option { - return func(cfg *Config) error { - for _, addrstr := range s { - a, err := ma.NewMultiaddr(addrstr) - if err != nil { - return err - } - cfg.ListenAddrs = append(cfg.ListenAddrs, a) - } - return nil - } -} - -// ListenAddrs configures libp2p to listen on the given addresses. -func ListenAddrs(addrs ...ma.Multiaddr) Option { - return func(cfg *Config) error { - cfg.ListenAddrs = append(cfg.ListenAddrs, addrs...) - return nil - } -} - -// Security configures libp2p to use the given security transport (or transport -// constructor). -// -// Name is the protocol name. -// -// The transport can be a constructed security.Transport or a function taking -// any subset of this libp2p node's: -// * Public key -// * Private key -// * Peer ID -// * Host -// * Network -// * Peerstore -func Security(name string, tpt interface{}) Option { - stpt, err := config.SecurityConstructor(tpt) - err = traceError(err, 1) - return func(cfg *Config) error { - if err != nil { - return err - } - if cfg.Insecure { - return fmt.Errorf("cannot use security transports with an insecure libp2p configuration") - } - cfg.SecurityTransports = append(cfg.SecurityTransports, config.MsSecC{SecC: stpt, ID: name}) - return nil - } -} - -// NoSecurity is an option that completely disables all transport security. -// It's incompatible with all other transport security protocols. -var NoSecurity Option = func(cfg *Config) error { - if len(cfg.SecurityTransports) > 0 { - return fmt.Errorf("cannot use security transports with an insecure libp2p configuration") - } - cfg.Insecure = true - return nil -} - -// Muxer configures libp2p to use the given stream multiplexer (or stream -// multiplexer constructor). -// -// Name is the protocol name. -// -// The transport can be a constructed mux.Transport or a function taking any -// subset of this libp2p node's: -// * Peer ID -// * Host -// * Network -// * Peerstore -func Muxer(name string, tpt interface{}) Option { - mtpt, err := config.MuxerConstructor(tpt) - err = traceError(err, 1) - return func(cfg *Config) error { - if err != nil { - return err - } - cfg.Muxers = append(cfg.Muxers, config.MsMuxC{MuxC: mtpt, ID: name}) - return nil - } -} - -// Transport configures libp2p to use the given transport (or transport -// constructor). -// -// The transport can be a constructed transport.Transport or a function taking -// any subset of this libp2p node's: -// * Transport Upgrader (*tptu.Upgrader) -// * Host -// * Stream muxer (muxer.Transport) -// * Security transport (security.Transport) -// * Private network protector (pnet.Protector) -// * Peer ID -// * Private Key -// * Public Key -// * Address filter (filter.Filter) -// * Peerstore -func Transport(tpt interface{}) Option { - tptc, err := config.TransportConstructor(tpt) - err = traceError(err, 1) - return func(cfg *Config) error { - if err != nil { - return err - } - cfg.Transports = append(cfg.Transports, tptc) - return nil - } -} - -// Peerstore configures libp2p to use the given peerstore. -func Peerstore(ps peerstore.Peerstore) Option { - return func(cfg *Config) error { - if cfg.Peerstore != nil { - return fmt.Errorf("cannot specify multiple peerstore options") - } - - cfg.Peerstore = ps - return nil - } -} - -// PrivateNetwork configures libp2p to use the given private network protector. -func PrivateNetwork(prot pnet.Protector) Option { - return func(cfg *Config) error { - if cfg.Protector != nil { - return fmt.Errorf("cannot specify multiple private network options") - } - - cfg.Protector = prot - return nil - } -} - -// BandwidthReporter configures libp2p to use the given bandwidth reporter. -func BandwidthReporter(rep metrics.Reporter) Option { - return func(cfg *Config) error { - if cfg.Reporter != nil { - return fmt.Errorf("cannot specify multiple bandwidth reporter options") - } - - cfg.Reporter = rep - return nil - } -} - -// Identity configures libp2p to use the given private key to identify itself. -func Identity(sk crypto.PrivKey) Option { - return func(cfg *Config) error { - if cfg.PeerKey != nil { - return fmt.Errorf("cannot specify multiple identities") - } - - cfg.PeerKey = sk - return nil - } -} - -// ConnectionManager configures libp2p to use the given connection manager. -func ConnectionManager(connman connmgr.ConnManager) Option { - return func(cfg *Config) error { - if cfg.ConnManager != nil { - return fmt.Errorf("cannot specify multiple connection managers") - } - cfg.ConnManager = connman - return nil - } -} - -// AddrsFactory configures libp2p to use the given address factory. -func AddrsFactory(factory config.AddrsFactory) Option { - return func(cfg *Config) error { - if cfg.AddrsFactory != nil { - return fmt.Errorf("cannot specify multiple address factories") - } - cfg.AddrsFactory = factory - return nil - } -} - -// EnableRelay configures libp2p to enable the relay transport with -// configuration options. By default, this option only configures libp2p to -// accept inbound connections from relays and make outbound connections -// _through_ relays when requested by the remote peer. (default: enabled) -// -// To _act_ as a relay, pass the circuit.OptHop option. -func EnableRelay(options ...circuit.RelayOpt) Option { - return func(cfg *Config) error { - cfg.RelayCustom = true - cfg.Relay = true - cfg.RelayOpts = options - return nil - } -} - -// DisableRelay configures libp2p to disable the relay transport. -func DisableRelay() Option { - return func(cfg *Config) error { - cfg.RelayCustom = true - cfg.Relay = false - return nil - } -} - -// EnableAutoRelay configures libp2p to enable the AutoRelay subsystem. It is an -// error to enable AutoRelay without enabling relay (enabled by default) and -// routing (not enabled by default). -// -// This subsystem performs two functions: -// -// 1. When this libp2p node is configured to act as a relay "hop" -// (circuit.OptHop is passed to EnableRelay), this node will advertise itself -// as a public relay using the provided routing system. -// 2. When this libp2p node is _not_ configured as a relay "hop", it will -// automatically detect if it is unreachable (e.g., behind a NAT). If so, it will -// find, configure, and announce a set of public relays. -func EnableAutoRelay() Option { - return func(cfg *Config) error { - cfg.EnableAutoRelay = true - return nil - } -} - -// FilterAddresses configures libp2p to never dial nor accept connections from -// the given addresses. -func FilterAddresses(addrs ...*net.IPNet) Option { - return func(cfg *Config) error { - if cfg.Filters == nil { - cfg.Filters = filter.NewFilters() - } - for _, addr := range addrs { - cfg.Filters.AddDialFilter(addr) - } - return nil - } -} - -// NATPortMap configures libp2p to use the default NATManager. The default -// NATManager will attempt to open a port in your network's firewall using UPnP. -func NATPortMap() Option { - return NATManager(bhost.NewNATManager) -} - -// NATManager will configure libp2p to use the requested NATManager. This -// function should be passed a NATManager *constructor* that takes a libp2p Network. -func NATManager(nm config.NATManagerC) Option { - return func(cfg *Config) error { - if cfg.NATManager != nil { - return fmt.Errorf("cannot specify multiple NATManagers") - } - cfg.NATManager = nm - return nil - } -} - -// Ping will configure libp2p to support the ping service; enable by default. -func Ping(enable bool) Option { - return func(cfg *Config) error { - cfg.DisablePing = !enable - return nil - } -} - -// Routing will configure libp2p to use routing. -func Routing(rt config.RoutingC) Option { - return func(cfg *Config) error { - if cfg.Routing != nil { - return fmt.Errorf("cannot specify multiple routing options") - } - cfg.Routing = rt - return nil - } -} - -// NoListenAddrs will configure libp2p to not listen by default. -// -// This will both clear any configured listen addrs and prevent libp2p from -// applying the default listen address option. It also disables relay, unless the -// user explicitly specifies with an option, as the transport creates an implicit -// listen address that would make the node dialable through any relay it was connected to. -var NoListenAddrs = func(cfg *Config) error { - cfg.ListenAddrs = []ma.Multiaddr{} - if !cfg.RelayCustom { - cfg.RelayCustom = true - cfg.Relay = false - } - return nil -} - -// NoTransports will configure libp2p to not enable any transports. -// -// This will both clear any configured transports (specified in prior libp2p -// options) and prevent libp2p from applying the default transports. -var NoTransports = func(cfg *Config) error { - cfg.Transports = []config.TptC{} - return nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/discovery/mdns.go b/vendor/github.com/libp2p/go-libp2p/p2p/discovery/mdns.go deleted file mode 100644 index 3476e6eb..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/discovery/mdns.go +++ /dev/null @@ -1,207 +0,0 @@ -package discovery - -import ( - "context" - "errors" - "io" - "net" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/peer" - - logging "github.com/ipfs/go-log" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" - "github.com/whyrusleeping/mdns" -) - -func init() { - // don't let mdns use logging... - mdns.DisableLogging = true -} - -var log = logging.Logger("mdns") - -const ServiceTag = "_ipfs-discovery._udp" - -type Service interface { - io.Closer - RegisterNotifee(Notifee) - UnregisterNotifee(Notifee) -} - -type Notifee interface { - HandlePeerFound(peer.AddrInfo) -} - -type mdnsService struct { - server *mdns.Server - service *mdns.MDNSService - host host.Host - tag string - - lk sync.Mutex - notifees []Notifee - interval time.Duration -} - -func getDialableListenAddrs(ph host.Host) ([]*net.TCPAddr, error) { - var out []*net.TCPAddr - for _, addr := range ph.Addrs() { - na, err := manet.ToNetAddr(addr) - if err != nil { - continue - } - tcp, ok := na.(*net.TCPAddr) - if ok { - out = append(out, tcp) - } - } - if len(out) == 0 { - return nil, errors.New("failed to find good external addr from peerhost") - } - return out, nil -} - -func NewMdnsService(ctx context.Context, peerhost host.Host, interval time.Duration, serviceTag string) (Service, error) { - - var ipaddrs []net.IP - port := 4001 - - addrs, err := getDialableListenAddrs(peerhost) - if err != nil { - log.Warning(err) - } else { - port = addrs[0].Port - for _, a := range addrs { - ipaddrs = append(ipaddrs, a.IP) - } - } - - myid := peerhost.ID().Pretty() - - info := []string{myid} - if serviceTag == "" { - serviceTag = ServiceTag - } - service, err := mdns.NewMDNSService(myid, serviceTag, "", "", port, ipaddrs, info) - if err != nil { - return nil, err - } - - // Create the mDNS server, defer shutdown - server, err := mdns.NewServer(&mdns.Config{Zone: service}) - if err != nil { - return nil, err - } - - s := &mdnsService{ - server: server, - service: service, - host: peerhost, - interval: interval, - tag: serviceTag, - } - - go s.pollForEntries(ctx) - - return s, nil -} - -func (m *mdnsService) Close() error { - return m.server.Shutdown() -} - -func (m *mdnsService) pollForEntries(ctx context.Context) { - - ticker := time.NewTicker(m.interval) - for { - //execute mdns query right away at method call and then with every tick - entriesCh := make(chan *mdns.ServiceEntry, 16) - go func() { - for entry := range entriesCh { - m.handleEntry(entry) - } - }() - - log.Debug("starting mdns query") - qp := &mdns.QueryParam{ - Domain: "local", - Entries: entriesCh, - Service: m.tag, - Timeout: time.Second * 5, - } - - err := mdns.Query(qp) - if err != nil { - log.Error("mdns lookup error: ", err) - } - close(entriesCh) - log.Debug("mdns query complete") - - select { - case <-ticker.C: - continue - case <-ctx.Done(): - log.Debug("mdns service halting") - return - } - } -} - -func (m *mdnsService) handleEntry(e *mdns.ServiceEntry) { - log.Debugf("Handling MDNS entry: %s:%d %s", e.AddrV4, e.Port, e.Info) - mpeer, err := peer.IDB58Decode(e.Info) - if err != nil { - log.Warning("Error parsing peer ID from mdns entry: ", err) - return - } - - if mpeer == m.host.ID() { - log.Debug("got our own mdns entry, skipping") - return - } - - maddr, err := manet.FromNetAddr(&net.TCPAddr{ - IP: e.AddrV4, - Port: e.Port, - }) - if err != nil { - log.Warning("Error parsing multiaddr from mdns entry: ", err) - return - } - - pi := peer.AddrInfo{ - ID: mpeer, - Addrs: []ma.Multiaddr{maddr}, - } - - m.lk.Lock() - for _, n := range m.notifees { - go n.HandlePeerFound(pi) - } - m.lk.Unlock() -} - -func (m *mdnsService) RegisterNotifee(n Notifee) { - m.lk.Lock() - m.notifees = append(m.notifees, n) - m.lk.Unlock() -} - -func (m *mdnsService) UnregisterNotifee(n Notifee) { - m.lk.Lock() - found := -1 - for i, notif := range m.notifees { - if notif == n { - found = i - break - } - } - if found != -1 { - m.notifees = append(m.notifees[:found], m.notifees[found+1:]...) - } - m.lk.Unlock() -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/basic_host.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/basic_host.go deleted file mode 100644 index b1d8cbcd..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/basic_host.go +++ /dev/null @@ -1,743 +0,0 @@ -package basichost - -import ( - "context" - "io" - "net" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/protocol" - - logging "github.com/ipfs/go-log" - goprocess "github.com/jbenet/goprocess" - goprocessctx "github.com/jbenet/goprocess/context" - - inat "github.com/libp2p/go-libp2p-nat" - - identify "github.com/libp2p/go-libp2p/p2p/protocol/identify" - ping "github.com/libp2p/go-libp2p/p2p/protocol/ping" - ma "github.com/multiformats/go-multiaddr" - madns "github.com/multiformats/go-multiaddr-dns" - manet "github.com/multiformats/go-multiaddr-net" - msmux "github.com/multiformats/go-multistream" -) - -var log = logging.Logger("basichost") - -var ( - // DefaultNegotiationTimeout is the default value for HostOpts.NegotiationTimeout. - DefaultNegotiationTimeout = time.Second * 60 - - // DefaultAddrsFactory is the default value for HostOpts.AddrsFactory. - DefaultAddrsFactory = func(addrs []ma.Multiaddr) []ma.Multiaddr { return addrs } -) - -// AddrsFactory functions can be passed to New in order to override -// addresses returned by Addrs. -type AddrsFactory func([]ma.Multiaddr) []ma.Multiaddr - -// Option is a type used to pass in options to the host. -// -// Deprecated in favor of HostOpts and NewHost. -type Option int - -// NATPortMap makes the host attempt to open port-mapping in NAT devices -// for all its listeners. Pass in this option in the constructor to -// asynchronously a) find a gateway, b) open port mappings, c) republish -// port mappings periodically. The NATed addresses are included in the -// Host's Addrs() list. -// -// This option is deprecated in favor of HostOpts and NewHost. -const NATPortMap Option = iota - -// BasicHost is the basic implementation of the host.Host interface. This -// particular host implementation: -// * uses a protocol muxer to mux per-protocol streams -// * uses an identity service to send + receive node information -// * uses a nat service to establish NAT port mappings -type BasicHost struct { - network network.Network - mux *msmux.MultistreamMuxer - ids *identify.IDService - pings *ping.PingService - natmgr NATManager - maResolver *madns.Resolver - cmgr connmgr.ConnManager - - AddrsFactory AddrsFactory - - negtimeout time.Duration - - proc goprocess.Process - - ctx context.Context - cancel func() - mx sync.Mutex - lastAddrs []ma.Multiaddr -} - -var _ host.Host = (*BasicHost)(nil) - -// HostOpts holds options that can be passed to NewHost in order to -// customize construction of the *BasicHost. -type HostOpts struct { - - // MultistreamMuxer is essential for the *BasicHost and will use a sensible default value if omitted. - MultistreamMuxer *msmux.MultistreamMuxer - - // NegotiationTimeout determines the read and write timeouts on streams. - // If 0 or omitted, it will use DefaultNegotiationTimeout. - // If below 0, timeouts on streams will be deactivated. - NegotiationTimeout time.Duration - - // IdentifyService holds an implementation of the /ipfs/id/ protocol. - // If omitted, a new *identify.IDService will be used. - IdentifyService *identify.IDService - - // AddrsFactory holds a function which can be used to override or filter the result of Addrs. - // If omitted, there's no override or filtering, and the results of Addrs and AllAddrs are the same. - AddrsFactory AddrsFactory - - // MultiaddrResolves holds the go-multiaddr-dns.Resolver used for resolving - // /dns4, /dns6, and /dnsaddr addresses before trying to connect to a peer. - MultiaddrResolver *madns.Resolver - - // NATManager takes care of setting NAT port mappings, and discovering external addresses. - // If omitted, this will simply be disabled. - NATManager func(network.Network) NATManager - - // ConnManager is a libp2p connection manager - ConnManager connmgr.ConnManager - - // EnablePing indicates whether to instantiate the ping service - EnablePing bool -} - -// NewHost constructs a new *BasicHost and activates it by attaching its stream and connection handlers to the given inet.Network. -func NewHost(ctx context.Context, net network.Network, opts *HostOpts) (*BasicHost, error) { - bgctx, cancel := context.WithCancel(ctx) - - h := &BasicHost{ - network: net, - mux: msmux.NewMultistreamMuxer(), - negtimeout: DefaultNegotiationTimeout, - AddrsFactory: DefaultAddrsFactory, - maResolver: madns.DefaultResolver, - ctx: bgctx, - cancel: cancel, - } - - h.proc = goprocessctx.WithContextAndTeardown(ctx, func() error { - if h.natmgr != nil { - h.natmgr.Close() - } - return h.Network().Close() - }) - - if opts.MultistreamMuxer != nil { - h.mux = opts.MultistreamMuxer - } - - if opts.IdentifyService != nil { - h.ids = opts.IdentifyService - } else { - // we can't set this as a default above because it depends on the *BasicHost. - h.ids = identify.NewIDService(bgctx, h) - } - - if uint64(opts.NegotiationTimeout) != 0 { - h.negtimeout = opts.NegotiationTimeout - } - - if opts.AddrsFactory != nil { - h.AddrsFactory = opts.AddrsFactory - } - - if opts.NATManager != nil { - h.natmgr = opts.NATManager(net) - } - - if opts.MultiaddrResolver != nil { - h.maResolver = opts.MultiaddrResolver - } - - if opts.ConnManager == nil { - h.cmgr = &connmgr.NullConnMgr{} - } else { - h.cmgr = opts.ConnManager - net.Notify(h.cmgr.Notifee()) - } - - if opts.EnablePing { - h.pings = ping.NewPingService(h) - } - - net.SetConnHandler(h.newConnHandler) - net.SetStreamHandler(h.newStreamHandler) - - return h, nil -} - -// New constructs and sets up a new *BasicHost with given Network and options. -// The following options can be passed: -// * NATPortMap -// * AddrsFactory -// * connmgr.ConnManager -// * madns.Resolver -// -// This function is deprecated in favor of NewHost and HostOpts. -func New(net network.Network, opts ...interface{}) *BasicHost { - hostopts := &HostOpts{} - - for _, o := range opts { - switch o := o.(type) { - case Option: - switch o { - case NATPortMap: - hostopts.NATManager = NewNATManager - } - case AddrsFactory: - hostopts.AddrsFactory = AddrsFactory(o) - case connmgr.ConnManager: - hostopts.ConnManager = o - case *madns.Resolver: - hostopts.MultiaddrResolver = o - } - } - - h, err := NewHost(context.Background(), net, hostopts) - if err != nil { - // this cannot happen with legacy options - // plus we want to keep the (deprecated) legacy interface unchanged - panic(err) - } - - return h -} - -// Start starts background tasks in the host -func (h *BasicHost) Start() { - go h.background() -} - -// newConnHandler is the remote-opened conn handler for inet.Network -func (h *BasicHost) newConnHandler(c network.Conn) { - // Clear protocols on connecting to new peer to avoid issues caused - // by misremembering protocols between reconnects - h.Peerstore().SetProtocols(c.RemotePeer()) - h.ids.IdentifyConn(c) -} - -// newStreamHandler is the remote-opened stream handler for network.Network -// TODO: this feels a bit wonky -func (h *BasicHost) newStreamHandler(s network.Stream) { - before := time.Now() - - if h.negtimeout > 0 { - if err := s.SetDeadline(time.Now().Add(h.negtimeout)); err != nil { - log.Error("setting stream deadline: ", err) - s.Reset() - return - } - } - - lzc, protoID, handle, err := h.Mux().NegotiateLazy(s) - took := time.Now().Sub(before) - if err != nil { - if err == io.EOF { - logf := log.Debugf - if took > time.Second*10 { - logf = log.Warningf - } - logf("protocol EOF: %s (took %s)", s.Conn().RemotePeer(), took) - } else { - log.Debugf("protocol mux failed: %s (took %s)", err, took) - } - s.Reset() - return - } - - s = &streamWrapper{ - Stream: s, - rw: lzc, - } - - if h.negtimeout > 0 { - if err := s.SetDeadline(time.Time{}); err != nil { - log.Error("resetting stream deadline: ", err) - s.Reset() - return - } - } - - s.SetProtocol(protocol.ID(protoID)) - log.Debugf("protocol negotiation took %s", took) - - go handle(protoID, s) -} - -// PushIdentify pushes an identify update through the identify push protocol -// Warning: this interface is unstable and may disappear in the future. -func (h *BasicHost) PushIdentify() { - push := false - - h.mx.Lock() - addrs := h.Addrs() - if !sameAddrs(addrs, h.lastAddrs) { - push = true - h.lastAddrs = addrs - } - h.mx.Unlock() - - if push { - h.ids.Push() - } -} - -func (h *BasicHost) background() { - // periodically schedules an IdentifyPush to update our peers for changes - // in our address set (if needed) - ticker := time.NewTicker(1 * time.Minute) - defer ticker.Stop() - - // initialize lastAddrs - h.mx.Lock() - if h.lastAddrs == nil { - h.lastAddrs = h.Addrs() - } - h.mx.Unlock() - - for { - select { - case <-ticker.C: - h.PushIdentify() - - case <-h.ctx.Done(): - return - } - } -} - -func sameAddrs(a, b []ma.Multiaddr) bool { - if len(a) != len(b) { - return false - } - - bmap := make(map[string]struct{}, len(b)) - for _, addr := range b { - bmap[string(addr.Bytes())] = struct{}{} - } - - for _, addr := range a { - _, ok := bmap[string(addr.Bytes())] - if !ok { - return false - } - } - - return true -} - -// ID returns the (local) peer.ID associated with this Host -func (h *BasicHost) ID() peer.ID { - return h.Network().LocalPeer() -} - -// Peerstore returns the Host's repository of Peer Addresses and Keys. -func (h *BasicHost) Peerstore() peerstore.Peerstore { - return h.Network().Peerstore() -} - -// Network returns the Network interface of the Host -func (h *BasicHost) Network() network.Network { - return h.network -} - -// Mux returns the Mux multiplexing incoming streams to protocol handlers -func (h *BasicHost) Mux() protocol.Switch { - return h.mux -} - -// IDService returns -func (h *BasicHost) IDService() *identify.IDService { - return h.ids -} - -// SetStreamHandler sets the protocol handler on the Host's Mux. -// This is equivalent to: -// host.Mux().SetHandler(proto, handler) -// (Threadsafe) -func (h *BasicHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler) { - h.Mux().AddHandler(string(pid), func(p string, rwc io.ReadWriteCloser) error { - is := rwc.(network.Stream) - is.SetProtocol(protocol.ID(p)) - handler(is) - return nil - }) -} - -// SetStreamHandlerMatch sets the protocol handler on the Host's Mux -// using a matching function to do protocol comparisons -func (h *BasicHost) SetStreamHandlerMatch(pid protocol.ID, m func(string) bool, handler network.StreamHandler) { - h.Mux().AddHandlerWithFunc(string(pid), m, func(p string, rwc io.ReadWriteCloser) error { - is := rwc.(network.Stream) - is.SetProtocol(protocol.ID(p)) - handler(is) - return nil - }) -} - -// RemoveStreamHandler returns .. -func (h *BasicHost) RemoveStreamHandler(pid protocol.ID) { - h.Mux().RemoveHandler(string(pid)) -} - -// NewStream opens a new stream to given peer p, and writes a p2p/protocol -// header with given protocol.ID. If there is no connection to p, attempts -// to create one. If ProtocolID is "", writes no header. -// (Threadsafe) -func (h *BasicHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error) { - pref, err := h.preferredProtocol(p, pids) - if err != nil { - return nil, err - } - - if pref != "" { - return h.newStream(ctx, p, pref) - } - - var protoStrs []string - for _, pid := range pids { - protoStrs = append(protoStrs, string(pid)) - } - - s, err := h.Network().NewStream(ctx, p) - if err != nil { - return nil, err - } - - selected, err := msmux.SelectOneOf(protoStrs, s) - if err != nil { - s.Reset() - return nil, err - } - selpid := protocol.ID(selected) - s.SetProtocol(selpid) - h.Peerstore().AddProtocols(p, selected) - - return s, nil -} - -func pidsToStrings(pids []protocol.ID) []string { - out := make([]string, len(pids)) - for i, p := range pids { - out[i] = string(p) - } - return out -} - -func (h *BasicHost) preferredProtocol(p peer.ID, pids []protocol.ID) (protocol.ID, error) { - pidstrs := pidsToStrings(pids) - supported, err := h.Peerstore().SupportsProtocols(p, pidstrs...) - if err != nil { - return "", err - } - - var out protocol.ID - if len(supported) > 0 { - out = protocol.ID(supported[0]) - } - return out, nil -} - -func (h *BasicHost) newStream(ctx context.Context, p peer.ID, pid protocol.ID) (network.Stream, error) { - s, err := h.Network().NewStream(ctx, p) - if err != nil { - return nil, err - } - - s.SetProtocol(pid) - - lzcon := msmux.NewMSSelect(s, string(pid)) - return &streamWrapper{ - Stream: s, - rw: lzcon, - }, nil -} - -// Connect ensures there is a connection between this host and the peer with -// given peer.ID. If there is not an active connection, Connect will issue a -// h.Network.Dial, and block until a connection is open, or an error is returned. -// Connect will absorb the addresses in pi into its internal peerstore. -// It will also resolve any /dns4, /dns6, and /dnsaddr addresses. -func (h *BasicHost) Connect(ctx context.Context, pi peer.AddrInfo) error { - // absorb addresses into peerstore - h.Peerstore().AddAddrs(pi.ID, pi.Addrs, peerstore.TempAddrTTL) - - if h.Network().Connectedness(pi.ID) == network.Connected { - return nil - } - - resolved, err := h.resolveAddrs(ctx, h.Peerstore().PeerInfo(pi.ID)) - if err != nil { - return err - } - h.Peerstore().AddAddrs(pi.ID, resolved, peerstore.TempAddrTTL) - - return h.dialPeer(ctx, pi.ID) -} - -func (h *BasicHost) resolveAddrs(ctx context.Context, pi peer.AddrInfo) ([]ma.Multiaddr, error) { - proto := ma.ProtocolWithCode(ma.P_P2P).Name - p2paddr, err := ma.NewMultiaddr("/" + proto + "/" + pi.ID.Pretty()) - if err != nil { - return nil, err - } - - var addrs []ma.Multiaddr - for _, addr := range pi.Addrs { - addrs = append(addrs, addr) - if !madns.Matches(addr) { - continue - } - - reqaddr := addr.Encapsulate(p2paddr) - resaddrs, err := h.maResolver.Resolve(ctx, reqaddr) - if err != nil { - log.Infof("error resolving %s: %s", reqaddr, err) - } - for _, res := range resaddrs { - pi, err := peer.AddrInfoFromP2pAddr(res) - if err != nil { - log.Infof("error parsing %s: %s", res, err) - } - addrs = append(addrs, pi.Addrs...) - } - } - - return addrs, nil -} - -// dialPeer opens a connection to peer, and makes sure to identify -// the connection once it has been opened. -func (h *BasicHost) dialPeer(ctx context.Context, p peer.ID) error { - log.Debugf("host %s dialing %s", h.ID(), p) - c, err := h.Network().DialPeer(ctx, p) - if err != nil { - return err - } - - // Clear protocols on connecting to new peer to avoid issues caused - // by misremembering protocols between reconnects - h.Peerstore().SetProtocols(p) - - // identify the connection before returning. - done := make(chan struct{}) - go func() { - h.ids.IdentifyConn(c) - close(done) - }() - - // respect don contexteone - select { - case <-done: - case <-ctx.Done(): - return ctx.Err() - } - - log.Debugf("host %s finished dialing %s", h.ID(), p) - return nil -} - -func (h *BasicHost) ConnManager() connmgr.ConnManager { - return h.cmgr -} - -// Addrs returns listening addresses that are safe to announce to the network. -// The output is the same as AllAddrs, but processed by AddrsFactory. -func (h *BasicHost) Addrs() []ma.Multiaddr { - return h.AddrsFactory(h.AllAddrs()) -} - -// mergeAddrs merges input address lists, leave only unique addresses -func dedupAddrs(addrs []ma.Multiaddr) (uniqueAddrs []ma.Multiaddr) { - exists := make(map[string]bool) - for _, addr := range addrs { - k := string(addr.Bytes()) - if exists[k] { - continue - } - exists[k] = true - uniqueAddrs = append(uniqueAddrs, addr) - } - return uniqueAddrs -} - -// AllAddrs returns all the addresses of BasicHost at this moment in time. -// It's ok to not include addresses if they're not available to be used now. -func (h *BasicHost) AllAddrs() []ma.Multiaddr { - listenAddrs, err := h.Network().InterfaceListenAddresses() - if err != nil { - log.Debug("error retrieving network interface addrs") - } - var natMappings []inat.Mapping - - // natmgr is nil if we do not use nat option; - // h.natmgr.NAT() is nil if not ready, or no nat is available. - if h.natmgr != nil && h.natmgr.NAT() != nil { - natMappings = h.natmgr.NAT().Mappings() - } - - finalAddrs := listenAddrs - if len(natMappings) > 0 { - - // We have successfully mapped ports on our NAT. Use those - // instead of observed addresses (mostly). - - // First, generate a mapping table. - // protocol -> internal port -> external addr - ports := make(map[string]map[int]net.Addr) - for _, m := range natMappings { - addr, err := m.ExternalAddr() - if err != nil { - // mapping not ready yet. - continue - } - protoPorts, ok := ports[m.Protocol()] - if !ok { - protoPorts = make(map[int]net.Addr) - ports[m.Protocol()] = protoPorts - } - protoPorts[m.InternalPort()] = addr - } - - // Next, apply this mapping to our addresses. - for _, listen := range listenAddrs { - found := false - transport, rest := ma.SplitFunc(listen, func(c ma.Component) bool { - if found { - return true - } - switch c.Protocol().Code { - case ma.P_TCP, ma.P_UDP: - found = true - } - return false - }) - if !manet.IsThinWaist(transport) { - continue - } - - naddr, err := manet.ToNetAddr(transport) - if err != nil { - log.Error("error parsing net multiaddr %q: %s", transport, err) - continue - } - - var ( - ip net.IP - iport int - protocol string - ) - switch naddr := naddr.(type) { - case *net.TCPAddr: - ip = naddr.IP - iport = naddr.Port - protocol = "tcp" - case *net.UDPAddr: - ip = naddr.IP - iport = naddr.Port - protocol = "udp" - default: - continue - } - - if !ip.IsGlobalUnicast() { - // We only map global unicast ports. - continue - } - - mappedAddr, ok := ports[protocol][iport] - if !ok { - // Not mapped. - continue - } - - mappedMaddr, err := manet.FromNetAddr(mappedAddr) - if err != nil { - log.Errorf("mapped addr can't be turned into a multiaddr %q: %s", mappedAddr, err) - continue - } - - // Did the router give us a routable public addr? - if manet.IsPublicAddr(mappedMaddr) { - // Yes, use it. - extMaddr := mappedMaddr - if rest != nil { - extMaddr = ma.Join(extMaddr, rest) - } - - // Add in the mapped addr. - finalAddrs = append(finalAddrs, extMaddr) - continue - } - - // No. Ok, let's try our observed addresses. - - // Now, check if we have any observed addresses that - // differ from the one reported by the router. Routers - // don't always give the most accurate information. - observed := h.ids.ObservedAddrsFor(listen) - - if len(observed) == 0 { - continue - } - - // Drop the IP from the external maddr - _, extMaddrNoIP := ma.SplitFirst(mappedMaddr) - - for _, obsMaddr := range observed { - // Extract a public observed addr. - ip, _ := ma.SplitFirst(obsMaddr) - if ip == nil || !manet.IsPublicAddr(ip) { - continue - } - - finalAddrs = append(finalAddrs, ma.Join(ip, extMaddrNoIP)) - } - } - } else { - var observedAddrs []ma.Multiaddr - if h.ids != nil { - observedAddrs = h.ids.OwnObservedAddrs() - } - finalAddrs = append(finalAddrs, observedAddrs...) - } - return dedupAddrs(finalAddrs) -} - -// Close shuts down the Host's services (network, etc). -func (h *BasicHost) Close() error { - h.cancel() - h.cmgr.Close() - return h.proc.Close() -} - -type streamWrapper struct { - network.Stream - rw io.ReadWriter -} - -func (s *streamWrapper) Read(b []byte) (int, error) { - return s.rw.Read(b) -} - -func (s *streamWrapper) Write(b []byte) (int, error) { - return s.rw.Write(b) -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/natmgr.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/natmgr.go deleted file mode 100644 index c0bf96a8..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/basic/natmgr.go +++ /dev/null @@ -1,243 +0,0 @@ -package basichost - -import ( - "net" - "strconv" - "sync" - - goprocess "github.com/jbenet/goprocess" - goprocessctx "github.com/jbenet/goprocess/context" - "github.com/libp2p/go-libp2p-core/network" - inat "github.com/libp2p/go-libp2p-nat" - ma "github.com/multiformats/go-multiaddr" -) - -// A simple interface to manage NAT devices. -type NATManager interface { - - // Get the NAT device managed by the NAT manager. - NAT() *inat.NAT - - // Receive a notification when the NAT device is ready for use. - Ready() <-chan struct{} - - // Close all resources associated with a NAT manager. - Close() error -} - -// Create a NAT manager. -func NewNATManager(net network.Network) NATManager { - return newNatManager(net) -} - -// natManager takes care of adding + removing port mappings to the nat. -// Initialized with the host if it has a NATPortMap option enabled. -// natManager receives signals from the network, and check on nat mappings: -// * natManager listens to the network and adds or closes port mappings -// as the network signals Listen() or ListenClose(). -// * closing the natManager closes the nat and its mappings. -type natManager struct { - net network.Network - natmu sync.RWMutex - nat *inat.NAT - - ready chan struct{} // closed once the nat is ready to process port mappings - - syncMu sync.Mutex - - proc goprocess.Process // natManager has a process + children. can be closed. -} - -func newNatManager(net network.Network) *natManager { - nmgr := &natManager{ - net: net, - ready: make(chan struct{}), - } - - nmgr.proc = goprocess.WithTeardown(func() error { - // on closing, unregister from network notifications. - net.StopNotify((*nmgrNetNotifiee)(nmgr)) - return nil - }) - - // discover the nat. - nmgr.discoverNAT() - return nmgr -} - -// Close closes the natManager, closing the underlying nat -// and unregistering from network events. -func (nmgr *natManager) Close() error { - return nmgr.proc.Close() -} - -// Ready returns a channel which will be closed when the NAT has been found -// and is ready to be used, or the search process is done. -func (nmgr *natManager) Ready() <-chan struct{} { - return nmgr.ready -} - -func (nmgr *natManager) discoverNAT() { - nmgr.proc.Go(func(worker goprocess.Process) { - // inat.DiscoverNAT blocks until the nat is found or a timeout - // is reached. we unfortunately cannot specify timeouts-- the - // library we're using just blocks. - // - // Note: on early shutdown, there may be a case where we're trying - // to close before DiscoverNAT() returns. Since we cant cancel it - // (library) we can choose to (1) drop the result and return early, - // or (2) wait until it times out to exit. For now we choose (2), - // to avoid leaking resources in a non-obvious way. the only case - // this affects is when the daemon is being started up and _immediately_ - // asked to close. other services are also starting up, so ok to wait. - - natInstance, err := inat.DiscoverNAT(goprocessctx.OnClosingContext(worker)) - if err != nil { - log.Info("DiscoverNAT error:", err) - close(nmgr.ready) - return - } - - nmgr.natmu.Lock() - nmgr.nat = natInstance - nmgr.natmu.Unlock() - close(nmgr.ready) - - // wire up the nat to close when nmgr closes. - // nmgr.proc is our parent, and waiting for us. - nmgr.proc.AddChild(nmgr.nat.Process()) - - // sign natManager up for network notifications - // we need to sign up here to avoid missing some notifs - // before the NAT has been found. - nmgr.net.Notify((*nmgrNetNotifiee)(nmgr)) - nmgr.sync() - }) -} - -// syncs the current NAT mappings, removing any outdated mappings and adding any -// new mappings. -func (nmgr *natManager) sync() { - nat := nmgr.NAT() - if nat == nil { - // Nothing to do. - return - } - - nmgr.proc.Go(func(_ goprocess.Process) { - nmgr.syncMu.Lock() - defer nmgr.syncMu.Unlock() - - ports := map[string]map[int]bool{ - "tcp": map[int]bool{}, - "udp": map[int]bool{}, - } - for _, maddr := range nmgr.net.ListenAddresses() { - // Strip the IP - maIP, rest := ma.SplitFirst(maddr) - if maIP == nil || rest == nil { - continue - } - - switch maIP.Protocol().Code { - case ma.P_IP6, ma.P_IP4: - default: - continue - } - - // Only bother if we're listening on a - // unicast/unspecified IP. - ip := net.IP(maIP.RawValue()) - if !(ip.IsGlobalUnicast() || ip.IsUnspecified()) { - continue - } - - // Extract the port/protocol - proto, _ := ma.SplitFirst(rest) - if proto == nil { - continue - } - - var protocol string - switch proto.Protocol().Code { - case ma.P_TCP: - protocol = "tcp" - case ma.P_UDP: - protocol = "udp" - default: - continue - } - - port, err := strconv.ParseUint(proto.Value(), 10, 16) - if err != nil { - // bug in multiaddr - panic(err) - } - ports[protocol][int(port)] = false - } - - var wg sync.WaitGroup - defer wg.Wait() - - // Close old mappings - for _, m := range nat.Mappings() { - mappedPort := m.InternalPort() - if _, ok := ports[m.Protocol()][mappedPort]; !ok { - // No longer need this mapping. - wg.Add(1) - go func(m inat.Mapping) { - defer wg.Done() - m.Close() - }(m) - } else { - // already mapped - ports[m.Protocol()][mappedPort] = true - } - } - - // Create new mappings. - for proto, pports := range ports { - for port, mapped := range pports { - if mapped { - continue - } - wg.Add(1) - go func(proto string, port int) { - defer wg.Done() - _, err := nat.NewMapping(proto, port) - if err != nil { - log.Errorf("failed to port-map %s port %d: %s", proto, port, err) - } - }(proto, port) - } - } - }) -} - -// NAT returns the natManager's nat object. this may be nil, if -// (a) the search process is still ongoing, or (b) the search process -// found no nat. Clients must check whether the return value is nil. -func (nmgr *natManager) NAT() *inat.NAT { - nmgr.natmu.Lock() - defer nmgr.natmu.Unlock() - return nmgr.nat -} - -type nmgrNetNotifiee natManager - -func (nn *nmgrNetNotifiee) natManager() *natManager { - return (*natManager)(nn) -} - -func (nn *nmgrNetNotifiee) Listen(n network.Network, addr ma.Multiaddr) { - nn.natManager().sync() -} - -func (nn *nmgrNetNotifiee) ListenClose(n network.Network, addr ma.Multiaddr) { - nn.natManager().sync() -} - -func (nn *nmgrNetNotifiee) Connected(network.Network, network.Conn) {} -func (nn *nmgrNetNotifiee) Disconnected(network.Network, network.Conn) {} -func (nn *nmgrNetNotifiee) OpenedStream(network.Network, network.Stream) {} -func (nn *nmgrNetNotifiee) ClosedStream(network.Network, network.Stream) {} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/addrsplosion.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/addrsplosion.go deleted file mode 100644 index 89965bca..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/addrsplosion.go +++ /dev/null @@ -1,167 +0,0 @@ -package relay - -import ( - "encoding/binary" - - circuit "github.com/libp2p/go-libp2p-circuit" - ma "github.com/multiformats/go-multiaddr" - dns "github.com/multiformats/go-multiaddr-dns" - manet "github.com/multiformats/go-multiaddr-net" -) - -// This function cleans up a relay's address set to remove private addresses and curtail -// addrsplosion. -func cleanupAddressSet(addrs []ma.Multiaddr) []ma.Multiaddr { - var public, private []ma.Multiaddr - - for _, a := range addrs { - if isRelayAddr(a) { - continue - } - - if manet.IsPublicAddr(a) || isDNSAddr(a) { - public = append(public, a) - continue - } - - // discard unroutable addrs - if manet.IsPrivateAddr(a) { - private = append(private, a) - } - } - - if !hasAddrsplosion(public) { - return public - } - - return sanitizeAddrsplodedSet(public, private) -} - -func isRelayAddr(a ma.Multiaddr) bool { - isRelay := false - - ma.ForEach(a, func(c ma.Component) bool { - switch c.Protocol().Code { - case circuit.P_CIRCUIT: - isRelay = true - return false - default: - return true - } - }) - - return isRelay -} - -func isDNSAddr(a ma.Multiaddr) bool { - if first, _ := ma.SplitFirst(a); first != nil { - switch first.Protocol().Code { - case dns.P_DNS4, dns.P_DNS6, dns.P_DNSADDR: - return true - } - } - return false -} - -// we have addrsplosion if for some protocol we advertise multiple ports on -// the same base address. -func hasAddrsplosion(addrs []ma.Multiaddr) bool { - aset := make(map[string]int) - - for _, a := range addrs { - key, port := addrKeyAndPort(a) - xport, ok := aset[key] - if ok && port != xport { - return true - } - aset[key] = port - } - - return false -} - -func addrKeyAndPort(a ma.Multiaddr) (string, int) { - var ( - key string - port int - ) - - ma.ForEach(a, func(c ma.Component) bool { - switch c.Protocol().Code { - case ma.P_TCP, ma.P_UDP: - port = int(binary.BigEndian.Uint16(c.RawValue())) - key += "/" + c.Protocol().Name - default: - val := c.Value() - if val == "" { - val = c.Protocol().Name - } - key += "/" + val - } - return true - }) - - return key, port -} - -// clean up addrsplosion -// the following heuristic is used: -// - for each base address/protocol combination, if there are multiple ports advertised then -// only accept the default port if present. -// - If the default port is not present, we check for non-standard ports by tracking -// private port bindings if present. -// - If there is no default or private port binding, then we can't infer the correct -// port and give up and return all addrs (for that base address) -func sanitizeAddrsplodedSet(public, private []ma.Multiaddr) []ma.Multiaddr { - type portAndAddr struct { - addr ma.Multiaddr - port int - } - - privports := make(map[int]struct{}) - pubaddrs := make(map[string][]portAndAddr) - - for _, a := range private { - _, port := addrKeyAndPort(a) - privports[port] = struct{}{} - } - - for _, a := range public { - key, port := addrKeyAndPort(a) - pubaddrs[key] = append(pubaddrs[key], portAndAddr{addr: a, port: port}) - } - - var result []ma.Multiaddr - for _, pas := range pubaddrs { - if len(pas) == 1 { - // it's not addrsploded - result = append(result, pas[0].addr) - continue - } - - haveAddr := false - for _, pa := range pas { - if _, ok := privports[pa.port]; ok { - // it matches a privately bound port, use it - result = append(result, pa.addr) - haveAddr = true - continue - } - - if pa.port == 4001 || pa.port == 4002 { - // it's a default port, use it - result = append(result, pa.addr) - haveAddr = true - } - } - - if !haveAddr { - // we weren't able to select a port; bite the bullet and use them all - for _, pa := range pas { - result = append(result, pa.addr) - } - } - } - - return result -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/autorelay.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/autorelay.go deleted file mode 100644 index ac381ac6..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/autorelay.go +++ /dev/null @@ -1,332 +0,0 @@ -package relay - -import ( - "context" - "fmt" - "math/rand" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/routing" - - autonat "github.com/libp2p/go-libp2p-autonat" - _ "github.com/libp2p/go-libp2p-circuit" - discovery "github.com/libp2p/go-libp2p-discovery" - basic "github.com/libp2p/go-libp2p/p2p/host/basic" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -const ( - RelayRendezvous = "/libp2p/relay" -) - -var ( - DesiredRelays = 3 - - BootDelay = 20 * time.Second -) - -// AutoRelay is a Host that uses relays for connectivity when a NAT is detected. -type AutoRelay struct { - host *basic.BasicHost - discover discovery.Discoverer - router routing.PeerRouting - autonat autonat.AutoNAT - addrsF basic.AddrsFactory - - disconnect chan struct{} - - mx sync.Mutex - relays map[peer.ID]struct{} - status autonat.NATStatus - - cachedAddrs []ma.Multiaddr - cachedAddrsExpiry time.Time -} - -func NewAutoRelay(ctx context.Context, bhost *basic.BasicHost, discover discovery.Discoverer, router routing.PeerRouting) *AutoRelay { - ar := &AutoRelay{ - host: bhost, - discover: discover, - router: router, - addrsF: bhost.AddrsFactory, - relays: make(map[peer.ID]struct{}), - disconnect: make(chan struct{}, 1), - status: autonat.NATStatusUnknown, - } - ar.autonat = autonat.NewAutoNAT(ctx, bhost, ar.baseAddrs) - bhost.AddrsFactory = ar.hostAddrs - bhost.Network().Notify(ar) - go ar.background(ctx) - return ar -} - -func (ar *AutoRelay) baseAddrs() []ma.Multiaddr { - return ar.addrsF(ar.host.AllAddrs()) -} - -func (ar *AutoRelay) hostAddrs(addrs []ma.Multiaddr) []ma.Multiaddr { - return ar.relayAddrs(ar.addrsF(addrs)) -} - -func (ar *AutoRelay) background(ctx context.Context) { - select { - case <-time.After(autonat.AutoNATBootDelay + BootDelay): - case <-ctx.Done(): - return - } - - // when true, we need to identify push - push := false - - for { - wait := autonat.AutoNATRefreshInterval - switch ar.autonat.Status() { - case autonat.NATStatusUnknown: - ar.mx.Lock() - ar.status = autonat.NATStatusUnknown - ar.mx.Unlock() - wait = autonat.AutoNATRetryInterval - - case autonat.NATStatusPublic: - ar.mx.Lock() - if ar.status != autonat.NATStatusPublic { - push = true - } - ar.status = autonat.NATStatusPublic - ar.mx.Unlock() - - case autonat.NATStatusPrivate: - update := ar.findRelays(ctx) - ar.mx.Lock() - if update || ar.status != autonat.NATStatusPrivate { - push = true - } - ar.status = autonat.NATStatusPrivate - ar.mx.Unlock() - } - - if push { - ar.mx.Lock() - ar.cachedAddrs = nil - ar.mx.Unlock() - push = false - ar.host.PushIdentify() - } - - select { - case <-ar.disconnect: - push = true - case <-time.After(wait): - case <-ctx.Done(): - return - } - } -} - -func (ar *AutoRelay) findRelays(ctx context.Context) bool { - if ar.numRelays() >= DesiredRelays { - return false - } - - update := false - for retry := 0; retry < 5; retry++ { - if retry > 0 { - log.Debug("no relays connected; retrying in 30s") - select { - case <-time.After(30 * time.Second): - case <-ctx.Done(): - return update - } - } - - update = ar.findRelaysOnce(ctx) || update - if ar.numRelays() > 0 { - return update - } - } - return update -} - -func (ar *AutoRelay) findRelaysOnce(ctx context.Context) bool { - pis, err := ar.discoverRelays(ctx) - if err != nil { - log.Debugf("error discovering relays: %s", err) - return false - } - log.Debugf("discovered %d relays", len(pis)) - pis = ar.selectRelays(ctx, pis) - log.Debugf("selected %d relays", len(pis)) - - update := false - for _, pi := range pis { - update = ar.tryRelay(ctx, pi) || update - if ar.numRelays() >= DesiredRelays { - break - } - } - return update -} - -func (ar *AutoRelay) numRelays() int { - ar.mx.Lock() - defer ar.mx.Unlock() - return len(ar.relays) -} - -// usingRelay returns if we're currently using the given relay. -func (ar *AutoRelay) usingRelay(p peer.ID) bool { - ar.mx.Lock() - defer ar.mx.Unlock() - _, ok := ar.relays[p] - return ok -} - -// addRelay adds the given relay to our set of relays. -// returns true when we add a new relay -func (ar *AutoRelay) tryRelay(ctx context.Context, pi peer.AddrInfo) bool { - if ar.usingRelay(pi.ID) { - return false - } - - if !ar.connect(ctx, pi) { - return false - } - - ar.mx.Lock() - defer ar.mx.Unlock() - - // make sure we're still connected. - if ar.host.Network().Connectedness(pi.ID) != network.Connected { - return false - } - ar.relays[pi.ID] = struct{}{} - - return true -} - -func (ar *AutoRelay) connect(ctx context.Context, pi peer.AddrInfo) bool { - ctx, cancel := context.WithTimeout(ctx, 60*time.Second) - defer cancel() - - if len(pi.Addrs) == 0 { - var err error - pi, err = ar.router.FindPeer(ctx, pi.ID) - if err != nil { - log.Debugf("error finding relay peer %s: %s", pi.ID, err.Error()) - return false - } - } - - err := ar.host.Connect(ctx, pi) - if err != nil { - log.Debugf("error connecting to relay %s: %s", pi.ID, err.Error()) - return false - } - - // tag the connection as very important - ar.host.ConnManager().TagPeer(pi.ID, "relay", 42) - return true -} - -func (ar *AutoRelay) discoverRelays(ctx context.Context) ([]peer.AddrInfo, error) { - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - return discovery.FindPeers(ctx, ar.discover, RelayRendezvous, discovery.Limit(1000)) -} - -func (ar *AutoRelay) selectRelays(ctx context.Context, pis []peer.AddrInfo) []peer.AddrInfo { - // TODO better relay selection strategy; this just selects random relays - // but we should probably use ping latency as the selection metric - - shuffleRelays(pis) - return pis -} - -// This function is computes the NATed relay addrs when our status is private: -// - The public addrs are removed from the address set. -// - The non-public addrs are included verbatim so that peers behind the same NAT/firewall -// can still dial us directly. -// - On top of those, we add the relay-specific addrs for the relays to which we are -// connected. For each non-private relay addr, we encapsulate the p2p-circuit addr -// through which we can be dialed. -func (ar *AutoRelay) relayAddrs(addrs []ma.Multiaddr) []ma.Multiaddr { - ar.mx.Lock() - defer ar.mx.Unlock() - - if ar.status != autonat.NATStatusPrivate { - return addrs - } - - if ar.cachedAddrs != nil && time.Now().Before(ar.cachedAddrsExpiry) { - return ar.cachedAddrs - } - - raddrs := make([]ma.Multiaddr, 0, 4*len(ar.relays)+4) - - // only keep private addrs from the original addr set - for _, addr := range addrs { - if manet.IsPrivateAddr(addr) { - raddrs = append(raddrs, addr) - } - } - - // add relay specific addrs to the list - for p := range ar.relays { - addrs := cleanupAddressSet(ar.host.Peerstore().Addrs(p)) - - circuit, err := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s/p2p-circuit", p.Pretty())) - if err != nil { - panic(err) - } - - for _, addr := range addrs { - pub := addr.Encapsulate(circuit) - raddrs = append(raddrs, pub) - } - } - - ar.cachedAddrs = raddrs - ar.cachedAddrsExpiry = time.Now().Add(30 * time.Second) - - return raddrs -} - -func shuffleRelays(pis []peer.AddrInfo) { - for i := range pis { - j := rand.Intn(i + 1) - pis[i], pis[j] = pis[j], pis[i] - } -} - -// Notifee -func (ar *AutoRelay) Listen(network.Network, ma.Multiaddr) {} -func (ar *AutoRelay) ListenClose(network.Network, ma.Multiaddr) {} -func (ar *AutoRelay) Connected(network.Network, network.Conn) {} - -func (ar *AutoRelay) Disconnected(net network.Network, c network.Conn) { - p := c.RemotePeer() - - ar.mx.Lock() - defer ar.mx.Unlock() - - if ar.host.Network().Connectedness(p) == network.Connected { - // We have a second connection. - return - } - - if _, ok := ar.relays[p]; ok { - delete(ar.relays, p) - select { - case ar.disconnect <- struct{}{}: - default: - } - } -} - -func (ar *AutoRelay) OpenedStream(network.Network, network.Stream) {} -func (ar *AutoRelay) ClosedStream(network.Network, network.Stream) {} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/doc.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/doc.go deleted file mode 100644 index f7511ad9..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/doc.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -The relay package contains the components necessary to implement the "autorelay" -feature. - -Warning: the internal interfaces are unstable. - -System Components: -- A discovery service to discover public relays. -- An AutoNAT client used to determine if the node is behind a NAT/firewall. -- One or more autonat services, instances of `AutoNATServices`. These are used - by the autonat client. -- One or more relays, instances of `RelayHost`. -- The AutoRelay service. This is the service that actually: - -AutoNATService: https://github.com/libp2p/go-libp2p-autonat-svc -AutoNAT: https://github.com/libp2p/go-libp2p-autonat - -How it works: -- `AutoNATService` instances are instantiated in the bootstrappers (or other - well known publicly reachable hosts) -- `AutoRelay`s are constructed with `libp2p.New(libp2p.Routing(makeDHT))` - They passively discover autonat service instances and test dialability of - their listen address set through them. When the presence of NAT is detected, - they discover relays through the DHT, connect to some of them and begin - advertising relay addresses. The new set of addresses is propagated to - connected peers through the `identify/push` protocol. -*/ -package relay diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/log.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/log.go deleted file mode 100644 index eca0fa45..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/log.go +++ /dev/null @@ -1,7 +0,0 @@ -package relay - -import ( - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("autorelay") diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/relay.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/relay.go deleted file mode 100644 index f72b74ff..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/relay/relay.go +++ /dev/null @@ -1,39 +0,0 @@ -package relay - -import ( - "context" - "time" - - "github.com/libp2p/go-libp2p-discovery" - - ma "github.com/multiformats/go-multiaddr" -) - -var ( - // this is purposefully long to require some node stability before advertising as a relay - AdvertiseBootDelay = 15 * time.Minute - AdvertiseTTL = 30 * time.Minute -) - -// Advertise advertises this node as a libp2p relay. -func Advertise(ctx context.Context, advertise discovery.Advertiser) { - go func() { - select { - case <-time.After(AdvertiseBootDelay): - discovery.Advertise(ctx, advertise, RelayRendezvous, discovery.TTL(AdvertiseTTL)) - case <-ctx.Done(): - } - }() -} - -// Filter filters out all relay addresses. -func Filter(addrs []ma.Multiaddr) []ma.Multiaddr { - raddrs := make([]ma.Multiaddr, 0, len(addrs)) - for _, addr := range addrs { - if isRelayAddr(addr) { - continue - } - raddrs = append(raddrs, addr) - } - return raddrs -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/host/routed/routed.go b/vendor/github.com/libp2p/go-libp2p/p2p/host/routed/routed.go deleted file mode 100644 index 1282020b..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/host/routed/routed.go +++ /dev/null @@ -1,190 +0,0 @@ -package routedhost - -import ( - "context" - "fmt" - "time" - - "github.com/libp2p/go-libp2p-core/connmgr" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - "github.com/libp2p/go-libp2p-core/protocol" - - logging "github.com/ipfs/go-log" - circuit "github.com/libp2p/go-libp2p-circuit" - lgbl "github.com/libp2p/go-libp2p-loggables" - - ma "github.com/multiformats/go-multiaddr" -) - -var log = logging.Logger("routedhost") - -// AddressTTL is the expiry time for our addresses. -// We expire them quickly. -const AddressTTL = time.Second * 10 - -// RoutedHost is a p2p Host that includes a routing system. -// This allows the Host to find the addresses for peers when -// it does not have them. -type RoutedHost struct { - host host.Host // embedded other host. - route Routing -} - -type Routing interface { - FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) -} - -func Wrap(h host.Host, r Routing) *RoutedHost { - return &RoutedHost{h, r} -} - -// Connect ensures there is a connection between this host and the peer with -// given peer.ID. See (host.Host).Connect for more information. -// -// RoutedHost's Connect differs in that if the host has no addresses for a -// given peer, it will use its routing system to try to find some. -func (rh *RoutedHost) Connect(ctx context.Context, pi peer.AddrInfo) error { - // first, check if we're already connected. - if rh.Network().Connectedness(pi.ID) == network.Connected { - return nil - } - - // if we were given some addresses, keep + use them. - if len(pi.Addrs) > 0 { - rh.Peerstore().AddAddrs(pi.ID, pi.Addrs, peerstore.TempAddrTTL) - } - - // Check if we have some addresses in our recent memory. - addrs := rh.Peerstore().Addrs(pi.ID) - if len(addrs) < 1 { - // no addrs? find some with the routing system. - var err error - addrs, err = rh.findPeerAddrs(ctx, pi.ID) - if err != nil { - return err - } - } - - // Issue 448: if our address set includes routed specific relay addrs, - // we need to make sure the relay's addr itself is in the peerstore or else - // we wont be able to dial it. - for _, addr := range addrs { - _, err := addr.ValueForProtocol(circuit.P_CIRCUIT) - if err != nil { - // not a relay address - continue - } - - if addr.Protocols()[0].Code != ma.P_P2P { - // not a routed relay specific address - continue - } - - relay, _ := addr.ValueForProtocol(ma.P_P2P) - - relayID, err := peer.IDFromString(relay) - if err != nil { - log.Debugf("failed to parse relay ID in address %s: %s", relay, err) - continue - } - - if len(rh.Peerstore().Addrs(relayID)) > 0 { - // we already have addrs for this relay - continue - } - - relayAddrs, err := rh.findPeerAddrs(ctx, relayID) - if err != nil { - log.Debugf("failed to find relay %s: %s", relay, err) - continue - } - - rh.Peerstore().AddAddrs(relayID, relayAddrs, peerstore.TempAddrTTL) - } - - // if we're here, we got some addrs. let's use our wrapped host to connect. - pi.Addrs = addrs - return rh.host.Connect(ctx, pi) -} - -func (rh *RoutedHost) findPeerAddrs(ctx context.Context, id peer.ID) ([]ma.Multiaddr, error) { - pi, err := rh.route.FindPeer(ctx, id) - if err != nil { - return nil, err // couldnt find any :( - } - - if pi.ID != id { - err = fmt.Errorf("routing failure: provided addrs for different peer") - logRoutingErrDifferentPeers(ctx, id, pi.ID, err) - return nil, err - } - - return pi.Addrs, nil -} - -func logRoutingErrDifferentPeers(ctx context.Context, wanted, got peer.ID, err error) { - lm := make(lgbl.DeferredMap) - lm["error"] = err - lm["wantedPeer"] = func() interface{} { return wanted.Pretty() } - lm["gotPeer"] = func() interface{} { return got.Pretty() } - log.Event(ctx, "routingError", lm) -} - -func (rh *RoutedHost) ID() peer.ID { - return rh.host.ID() -} - -func (rh *RoutedHost) Peerstore() peerstore.Peerstore { - return rh.host.Peerstore() -} - -func (rh *RoutedHost) Addrs() []ma.Multiaddr { - return rh.host.Addrs() -} - -func (rh *RoutedHost) Network() network.Network { - return rh.host.Network() -} - -func (rh *RoutedHost) Mux() protocol.Switch { - return rh.host.Mux() -} - -func (rh *RoutedHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler) { - rh.host.SetStreamHandler(pid, handler) -} - -func (rh *RoutedHost) SetStreamHandlerMatch(pid protocol.ID, m func(string) bool, handler network.StreamHandler) { - rh.host.SetStreamHandlerMatch(pid, m, handler) -} - -func (rh *RoutedHost) RemoveStreamHandler(pid protocol.ID) { - rh.host.RemoveStreamHandler(pid) -} - -func (rh *RoutedHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error) { - // Ensure we have a connection, with peer addresses resolved by the routing system (#207) - // It is not sufficient to let the underlying host connect, it will most likely not have - // any addresses for the peer without any prior connections. - // If the caller wants to prevent the host from dialing, it should use the NoDial option. - if nodial, _ := network.GetNoDial(ctx); !nodial { - err := rh.Connect(ctx, peer.AddrInfo{ID: p}) - if err != nil { - return nil, err - } - } - - return rh.host.NewStream(ctx, p, pids...) -} -func (rh *RoutedHost) Close() error { - // no need to close IpfsRouting. we dont own it. - return rh.host.Close() -} -func (rh *RoutedHost) ConnManager() connmgr.ConnManager { - return rh.host.ConnManager() -} - -var _ (host.Host) = (*RoutedHost)(nil) diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/id.go b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/id.go deleted file mode 100644 index a3ddddaa..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/id.go +++ /dev/null @@ -1,519 +0,0 @@ -package identify - -import ( - "context" - "sync" - "time" - - ic "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/helpers" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/peerstore" - - pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb" - - ggio "github.com/gogo/protobuf/io" - logging "github.com/ipfs/go-log" - - lgbl "github.com/libp2p/go-libp2p-loggables" - - ma "github.com/multiformats/go-multiaddr" - msmux "github.com/multiformats/go-multistream" -) - -var log = logging.Logger("net/identify") - -// ID is the protocol.ID of the Identify Service. -const ID = "/ipfs/id/1.0.0" - -// IDPush is the protocol.ID of the Identify push protocol -const IDPush = "/ipfs/id/push/1.0.0" - -// LibP2PVersion holds the current protocol version for a client running this code -// TODO(jbenet): fix the versioning mess. -const LibP2PVersion = "ipfs/0.1.0" - -var ClientVersion = "go-libp2p/3.3.4" - -// transientTTL is a short ttl for invalidated previously connected addrs -const transientTTL = 10 * time.Second - -// IDService is a structure that implements ProtocolIdentify. -// It is a trivial service that gives the other peer some -// useful information about the local peer. A sort of hello. -// -// The IDService sends: -// * Our IPFS Protocol Version -// * Our IPFS Agent Version -// * Our public Listen Addresses -type IDService struct { - Host host.Host - - ctx context.Context - - // connections undergoing identification - // for wait purposes - currid map[network.Conn]chan struct{} - currmu sync.RWMutex - - addrMu sync.Mutex - - // our own observed addresses. - // TODO: instead of expiring, remove these when we disconnect - observedAddrs *ObservedAddrSet -} - -// NewIDService constructs a new *IDService and activates it by -// attaching its stream handler to the given host.Host. -func NewIDService(ctx context.Context, h host.Host) *IDService { - s := &IDService{ - Host: h, - ctx: ctx, - currid: make(map[network.Conn]chan struct{}), - observedAddrs: NewObservedAddrSet(ctx), - } - h.SetStreamHandler(ID, s.requestHandler) - h.SetStreamHandler(IDPush, s.pushHandler) - h.Network().Notify((*netNotifiee)(s)) - return s -} - -// OwnObservedAddrs returns the addresses peers have reported we've dialed from -func (ids *IDService) OwnObservedAddrs() []ma.Multiaddr { - return ids.observedAddrs.Addrs() -} - -func (ids *IDService) ObservedAddrsFor(local ma.Multiaddr) []ma.Multiaddr { - return ids.observedAddrs.AddrsFor(local) -} - -func (ids *IDService) IdentifyConn(c network.Conn) { - ids.currmu.Lock() - if wait, found := ids.currid[c]; found { - ids.currmu.Unlock() - log.Debugf("IdentifyConn called twice on: %s", c) - <-wait // already identifying it. wait for it. - return - } - ch := make(chan struct{}) - ids.currid[c] = ch - ids.currmu.Unlock() - - defer func() { - close(ch) - ids.currmu.Lock() - delete(ids.currid, c) - ids.currmu.Unlock() - }() - - s, err := c.NewStream() - if err != nil { - log.Debugf("error opening initial stream for %s: %s", ID, err) - log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer()) - c.Close() - return - } - - s.SetProtocol(ID) - - // ok give the response to our handler. - if err := msmux.SelectProtoOrFail(ID, s); err != nil { - log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer(), logging.Metadata{"error": err}) - s.Reset() - return - } - - ids.responseHandler(s) -} - -func (ids *IDService) requestHandler(s network.Stream) { - defer helpers.FullClose(s) - c := s.Conn() - - w := ggio.NewDelimitedWriter(s) - mes := pb.Identify{} - ids.populateMessage(&mes, s.Conn()) - w.WriteMsg(&mes) - - log.Debugf("%s sent message to %s %s", ID, - c.RemotePeer(), c.RemoteMultiaddr()) -} - -func (ids *IDService) responseHandler(s network.Stream) { - c := s.Conn() - - r := ggio.NewDelimitedReader(s, 2048) - mes := pb.Identify{} - if err := r.ReadMsg(&mes); err != nil { - log.Warning("error reading identify message: ", err) - s.Reset() - return - } - ids.consumeMessage(&mes, c) - log.Debugf("%s received message from %s %s", ID, - c.RemotePeer(), c.RemoteMultiaddr()) - - go helpers.FullClose(s) -} - -func (ids *IDService) pushHandler(s network.Stream) { - ids.responseHandler(s) -} - -func (ids *IDService) Push() { - var wg sync.WaitGroup - - ctx, cancel := context.WithTimeout(ids.ctx, 30*time.Second) - ctx = network.WithNoDial(ctx, "identify push") - - for _, p := range ids.Host.Network().Peers() { - wg.Add(1) - go func(p peer.ID) { - defer wg.Done() - - s, err := ids.Host.NewStream(ctx, p, IDPush) - if err != nil { - log.Debugf("error opening push stream to %s: %s", p, err.Error()) - return - } - - rch := make(chan struct{}, 1) - go func() { - ids.requestHandler(s) - rch <- struct{}{} - }() - - select { - case <-rch: - case <-ctx.Done(): - // this is taking too long, abort! - s.Reset() - } - }(p) - } - - // this supervisory goroutine is necessary to cancel the context - go func() { - wg.Wait() - cancel() - }() -} - -func (ids *IDService) populateMessage(mes *pb.Identify, c network.Conn) { - - // set protocols this node is currently handling - protos := ids.Host.Mux().Protocols() - mes.Protocols = make([]string, len(protos)) - for i, p := range protos { - mes.Protocols[i] = string(p) - } - - // observed address so other side is informed of their - // "public" address, at least in relation to us. - mes.ObservedAddr = c.RemoteMultiaddr().Bytes() - - // set listen addrs, get our latest addrs from Host. - laddrs := ids.Host.Addrs() - mes.ListenAddrs = make([][]byte, len(laddrs)) - for i, addr := range laddrs { - mes.ListenAddrs[i] = addr.Bytes() - } - log.Debugf("%s sent listen addrs to %s: %s", c.LocalPeer(), c.RemotePeer(), laddrs) - - // set our public key - ownKey := ids.Host.Peerstore().PubKey(ids.Host.ID()) - - // check if we even have a public key. - if ownKey == nil { - // public key is nil. We are either using insecure transport or something erratic happened. - // check if we're even operating in "secure mode" - if ids.Host.Peerstore().PrivKey(ids.Host.ID()) != nil { - // private key is present. But NO public key. Something bad happened. - log.Errorf("did not have own public key in Peerstore") - } - // if neither of the key is present it is safe to assume that we are using an insecure transport. - } else { - // public key is present. Safe to proceed. - if kb, err := ownKey.Bytes(); err != nil { - log.Errorf("failed to convert key to bytes") - } else { - mes.PublicKey = kb - } - } - - // set protocol versions - pv := LibP2PVersion - av := ClientVersion - mes.ProtocolVersion = &pv - mes.AgentVersion = &av -} - -func (ids *IDService) consumeMessage(mes *pb.Identify, c network.Conn) { - p := c.RemotePeer() - - // mes.Protocols - ids.Host.Peerstore().SetProtocols(p, mes.Protocols...) - - // mes.ObservedAddr - ids.consumeObservedAddress(mes.GetObservedAddr(), c) - - // mes.ListenAddrs - laddrs := mes.GetListenAddrs() - lmaddrs := make([]ma.Multiaddr, 0, len(laddrs)) - for _, addr := range laddrs { - maddr, err := ma.NewMultiaddrBytes(addr) - if err != nil { - log.Debugf("%s failed to parse multiaddr from %s %s", ID, - p, c.RemoteMultiaddr()) - continue - } - lmaddrs = append(lmaddrs, maddr) - } - - // NOTE: Do not add `c.RemoteMultiaddr()` to the peerstore if the remote - // peer doesn't tell us to do so. Otherwise, we'll advertise it. - // - // This can cause an "addr-splosion" issue where the network will slowly - // gossip and collect observed but unadvertised addresses. Given a NAT - // that picks random source ports, this can cause DHT nodes to collect - // many undialable addresses for other peers. - - // Extend the TTLs on the known (probably) good addresses. - // Taking the lock ensures that we don't concurrently process a disconnect. - ids.addrMu.Lock() - switch ids.Host.Network().Connectedness(p) { - case network.Connected: - // invalidate previous addrs -- we use a transient ttl instead of 0 to ensure there - // is no period of having no good addrs whatsoever - ids.Host.Peerstore().UpdateAddrs(p, peerstore.ConnectedAddrTTL, transientTTL) - ids.Host.Peerstore().AddAddrs(p, lmaddrs, peerstore.ConnectedAddrTTL) - default: - ids.Host.Peerstore().UpdateAddrs(p, peerstore.ConnectedAddrTTL, transientTTL) - ids.Host.Peerstore().AddAddrs(p, lmaddrs, peerstore.RecentlyConnectedAddrTTL) - } - ids.addrMu.Unlock() - - log.Debugf("%s received listen addrs for %s: %s", c.LocalPeer(), c.RemotePeer(), lmaddrs) - - // get protocol versions - pv := mes.GetProtocolVersion() - av := mes.GetAgentVersion() - - ids.Host.Peerstore().Put(p, "ProtocolVersion", pv) - ids.Host.Peerstore().Put(p, "AgentVersion", av) - - // get the key from the other side. we may not have it (no-auth transport) - ids.consumeReceivedPubKey(c, mes.PublicKey) -} - -func (ids *IDService) consumeReceivedPubKey(c network.Conn, kb []byte) { - lp := c.LocalPeer() - rp := c.RemotePeer() - - if kb == nil { - log.Debugf("%s did not receive public key for remote peer: %s", lp, rp) - return - } - - newKey, err := ic.UnmarshalPublicKey(kb) - if err != nil { - log.Warningf("%s cannot unmarshal key from remote peer: %s, %s", lp, rp, err) - return - } - - // verify key matches peer.ID - np, err := peer.IDFromPublicKey(newKey) - if err != nil { - log.Debugf("%s cannot get peer.ID from key of remote peer: %s, %s", lp, rp, err) - return - } - - if np != rp { - // if the newKey's peer.ID does not match known peer.ID... - - if rp == "" && np != "" { - // if local peerid is empty, then use the new, sent key. - err := ids.Host.Peerstore().AddPubKey(rp, newKey) - if err != nil { - log.Debugf("%s could not add key for %s to peerstore: %s", lp, rp, err) - } - - } else { - // we have a local peer.ID and it does not match the sent key... error. - log.Errorf("%s received key for remote peer %s mismatch: %s", lp, rp, np) - } - return - } - - currKey := ids.Host.Peerstore().PubKey(rp) - if currKey == nil { - // no key? no auth transport. set this one. - err := ids.Host.Peerstore().AddPubKey(rp, newKey) - if err != nil { - log.Debugf("%s could not add key for %s to peerstore: %s", lp, rp, err) - } - return - } - - // ok, we have a local key, we should verify they match. - if currKey.Equals(newKey) { - return // ok great. we're done. - } - - // weird, got a different key... but the different key MATCHES the peer.ID. - // this odd. let's log error and investigate. this should basically never happen - // and it means we have something funky going on and possibly a bug. - log.Errorf("%s identify got a different key for: %s", lp, rp) - - // okay... does ours NOT match the remote peer.ID? - cp, err := peer.IDFromPublicKey(currKey) - if err != nil { - log.Errorf("%s cannot get peer.ID from local key of remote peer: %s, %s", lp, rp, err) - return - } - if cp != rp { - log.Errorf("%s local key for remote peer %s yields different peer.ID: %s", lp, rp, cp) - return - } - - // okay... curr key DOES NOT match new key. both match peer.ID. wat? - log.Errorf("%s local key and received key for %s do not match, but match peer.ID", lp, rp) -} - -// HasConsistentTransport returns true if the address 'a' shares a -// protocol set with any address in the green set. This is used -// to check if a given address might be one of the addresses a peer is -// listening on. -func HasConsistentTransport(a ma.Multiaddr, green []ma.Multiaddr) bool { - protosMatch := func(a, b []ma.Protocol) bool { - if len(a) != len(b) { - return false - } - - for i, p := range a { - if b[i].Code != p.Code { - return false - } - } - return true - } - - protos := a.Protocols() - - for _, ga := range green { - if protosMatch(protos, ga.Protocols()) { - return true - } - } - - return false -} - -// IdentifyWait returns a channel which will be closed once -// "ProtocolIdentify" (handshake3) finishes on given conn. -// This happens async so the connection can start to be used -// even if handshake3 knowledge is not necesary. -// Users **MUST** call IdentifyWait _after_ IdentifyConn -func (ids *IDService) IdentifyWait(c network.Conn) <-chan struct{} { - ids.currmu.Lock() - ch, found := ids.currid[c] - ids.currmu.Unlock() - if found { - return ch - } - - // if not found, it means we are already done identifying it, or - // haven't even started. either way, return a new channel closed. - ch = make(chan struct{}) - close(ch) - return ch -} - -func (ids *IDService) consumeObservedAddress(observed []byte, c network.Conn) { - if observed == nil { - return - } - - maddr, err := ma.NewMultiaddrBytes(observed) - if err != nil { - log.Debugf("error parsing received observed addr for %s: %s", c, err) - return - } - - // we should only use ObservedAddr when our connection's LocalAddr is one - // of our ListenAddrs. If we Dial out using an ephemeral addr, knowing that - // address's external mapping is not very useful because the port will not be - // the same as the listen addr. - ifaceaddrs, err := ids.Host.Network().InterfaceListenAddresses() - if err != nil { - log.Infof("failed to get interface listen addrs", err) - return - } - - log.Debugf("identify identifying observed multiaddr: %s %s", c.LocalMultiaddr(), ifaceaddrs) - if !addrInAddrs(c.LocalMultiaddr(), ifaceaddrs) && !addrInAddrs(c.LocalMultiaddr(), ids.Host.Network().ListenAddresses()) { - // not in our list - return - } - - if !HasConsistentTransport(maddr, ids.Host.Addrs()) { - log.Debugf("ignoring observed multiaddr that doesn't match the transports of any addresses we're announcing", c.RemoteMultiaddr()) - return - } - - // ok! we have the observed version of one of our ListenAddresses! - log.Debugf("added own observed listen addr: %s --> %s", c.LocalMultiaddr(), maddr) - ids.observedAddrs.Add(maddr, c.LocalMultiaddr(), c.RemoteMultiaddr(), - c.Stat().Direction) -} - -func addrInAddrs(a ma.Multiaddr, as []ma.Multiaddr) bool { - for _, b := range as { - if a.Equal(b) { - return true - } - } - return false -} - -// netNotifiee defines methods to be used with the IpfsDHT -type netNotifiee IDService - -func (nn *netNotifiee) IDService() *IDService { - return (*IDService)(nn) -} - -func (nn *netNotifiee) Connected(n network.Network, v network.Conn) { - // TODO: deprecate the setConnHandler hook, and kick off - // identification here. -} - -func (nn *netNotifiee) Disconnected(n network.Network, v network.Conn) { - // undo the setting of addresses to peer.ConnectedAddrTTL we did - ids := nn.IDService() - ids.addrMu.Lock() - defer ids.addrMu.Unlock() - - if ids.Host.Network().Connectedness(v.RemotePeer()) != network.Connected { - // Last disconnect. - ps := ids.Host.Peerstore() - ps.UpdateAddrs(v.RemotePeer(), peerstore.ConnectedAddrTTL, peerstore.RecentlyConnectedAddrTTL) - } -} - -func (nn *netNotifiee) OpenedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) ClosedStream(n network.Network, v network.Stream) {} -func (nn *netNotifiee) Listen(n network.Network, a ma.Multiaddr) {} -func (nn *netNotifiee) ListenClose(n network.Network, a ma.Multiaddr) {} - -func logProtocolMismatchDisconnect(c network.Conn, protocol, agent string) { - lm := make(lgbl.DeferredMap) - lm["remotePeer"] = func() interface{} { return c.RemotePeer().Pretty() } - lm["remoteAddr"] = func() interface{} { return c.RemoteMultiaddr().String() } - lm["protocolVersion"] = protocol - lm["agentVersion"] = agent - log.Event(context.TODO(), "IdentifyProtocolMismatch", lm) - log.Debugf("IdentifyProtocolMismatch %s %s %s (disconnected)", c.RemotePeer(), protocol, agent) -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/obsaddr.go b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/obsaddr.go deleted file mode 100644 index 12e22860..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/obsaddr.go +++ /dev/null @@ -1,230 +0,0 @@ -package identify - -import ( - "context" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peerstore" - - ma "github.com/multiformats/go-multiaddr" -) - -const ActivationThresh = 4 - -var GCInterval = 10 * time.Minute - -type observation struct { - seenTime time.Time - connDirection network.Direction -} - -// ObservedAddr is an entry for an address reported by our peers. -// We only use addresses that: -// - have been observed at least 4 times in last 1h. (counter symmetric nats) -// - have been observed at least once recently (1h), because our position in the -// network, or network port mapppings, may have changed. -type ObservedAddr struct { - Addr ma.Multiaddr - SeenBy map[string]observation // peer(observer) address -> observation info - LastSeen time.Time -} - -func (oa *ObservedAddr) activated(ttl time.Duration) bool { - // We only activate if in the TTL other peers observed the same address - // of ours at least 4 times. - return len(oa.SeenBy) >= ActivationThresh -} - -type newObservation struct { - observed, local, observer ma.Multiaddr - direction network.Direction -} - -// ObservedAddrSet keeps track of a set of ObservedAddrs -// the zero-value is ready to be used. -type ObservedAddrSet struct { - sync.RWMutex // guards whole datastruct. - - // local(internal) address -> list of observed(external) addresses - addrs map[string][]*ObservedAddr - ttl time.Duration - - // this is the worker channel - wch chan newObservation -} - -func NewObservedAddrSet(ctx context.Context) *ObservedAddrSet { - oas := &ObservedAddrSet{ - addrs: make(map[string][]*ObservedAddr), - ttl: peerstore.OwnObservedAddrTTL, - wch: make(chan newObservation, 16), - } - go oas.worker(ctx) - return oas -} - -// AddrsFor return all activated observed addresses associated with the given -// (resolved) listen address. -func (oas *ObservedAddrSet) AddrsFor(addr ma.Multiaddr) (addrs []ma.Multiaddr) { - oas.RLock() - defer oas.RUnlock() - - if len(oas.addrs) == 0 { - return nil - } - - key := string(addr.Bytes()) - observedAddrs, ok := oas.addrs[key] - if !ok { - return - } - - now := time.Now() - for _, a := range observedAddrs { - if now.Sub(a.LastSeen) <= oas.ttl && a.activated(oas.ttl) { - addrs = append(addrs, a.Addr) - } - } - - return addrs -} - -// Addrs return all activated observed addresses -func (oas *ObservedAddrSet) Addrs() (addrs []ma.Multiaddr) { - oas.RLock() - defer oas.RUnlock() - - if len(oas.addrs) == 0 { - return nil - } - - now := time.Now() - for _, observedAddrs := range oas.addrs { - for _, a := range observedAddrs { - if now.Sub(a.LastSeen) <= oas.ttl && a.activated(oas.ttl) { - addrs = append(addrs, a.Addr) - } - } - } - return addrs -} - -func (oas *ObservedAddrSet) Add(observed, local, observer ma.Multiaddr, - direction network.Direction) { - select { - case oas.wch <- newObservation{observed: observed, local: local, observer: observer, direction: direction}: - default: - log.Debugf("dropping address observation of %s; buffer full", observed) - } -} - -func (oas *ObservedAddrSet) worker(ctx context.Context) { - ticker := time.NewTicker(GCInterval) - defer ticker.Stop() - - for { - select { - case obs := <-oas.wch: - oas.doAdd(obs.observed, obs.local, obs.observer, obs.direction) - - case <-ticker.C: - oas.gc() - - case <-ctx.Done(): - return - } - } -} - -func (oas *ObservedAddrSet) gc() { - oas.Lock() - defer oas.Unlock() - - now := time.Now() - for local, observedAddrs := range oas.addrs { - // TODO we can do this without allocating by compacting the array in place - filteredAddrs := make([]*ObservedAddr, 0, len(observedAddrs)) - - for _, a := range observedAddrs { - // clean up SeenBy set - for k, ob := range a.SeenBy { - if now.Sub(ob.seenTime) > oas.ttl*ActivationThresh { - delete(a.SeenBy, k) - } - } - - // leave only alive observed addresses - if now.Sub(a.LastSeen) <= oas.ttl { - filteredAddrs = append(filteredAddrs, a) - } - } - if len(filteredAddrs) > 0 { - oas.addrs[local] = filteredAddrs - } else { - delete(oas.addrs, local) - } - } -} - -func (oas *ObservedAddrSet) doAdd(observed, local, observer ma.Multiaddr, - direction network.Direction) { - - now := time.Now() - observerString := observerGroup(observer) - localString := string(local.Bytes()) - ob := observation{ - seenTime: now, - connDirection: direction, - } - - oas.Lock() - defer oas.Unlock() - - observedAddrs := oas.addrs[localString] - // check if observed address seen yet, if so, update it - for i, previousObserved := range observedAddrs { - if previousObserved.Addr.Equal(observed) { - observedAddrs[i].SeenBy[observerString] = ob - observedAddrs[i].LastSeen = now - return - } - } - // observed address not seen yet, append it - oas.addrs[localString] = append(oas.addrs[localString], &ObservedAddr{ - Addr: observed, - SeenBy: map[string]observation{ - observerString: ob, - }, - LastSeen: now, - }) -} - -// observerGroup is a function that determines what part of -// a multiaddr counts as a different observer. for example, -// two ipfs nodes at the same IP/TCP transport would get -// the exact same NAT mapping; they would count as the -// same observer. This may protect against NATs who assign -// different ports to addresses at different IP hosts, but -// not TCP ports. -// -// Here, we use the root multiaddr address. This is mostly -// IP addresses. In practice, this is what we want. -func observerGroup(m ma.Multiaddr) string { - //TODO: If IPv6 rolls out we should mark /64 routing zones as one group - first, _ := ma.SplitFirst(m) - return string(first.Bytes()) -} - -func (oas *ObservedAddrSet) SetTTL(ttl time.Duration) { - oas.Lock() - defer oas.Unlock() - oas.ttl = ttl -} - -func (oas *ObservedAddrSet) TTL() time.Duration { - oas.RLock() - defer oas.RUnlock() - return oas.ttl -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/Makefile b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/Makefile deleted file mode 100644 index eb14b576..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogofast_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.pb.go b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.pb.go deleted file mode 100644 index de1275ba..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.pb.go +++ /dev/null @@ -1,635 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: identify.proto - -package identify_pb - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Identify struct { - // protocolVersion determines compatibility between peers - ProtocolVersion *string `protobuf:"bytes,5,opt,name=protocolVersion" json:"protocolVersion,omitempty"` - // agentVersion is like a UserAgent string in browsers, or client version in bittorrent - // includes the client name and client. - AgentVersion *string `protobuf:"bytes,6,opt,name=agentVersion" json:"agentVersion,omitempty"` - // publicKey is this node's public key (which also gives its node.ID) - // - may not need to be sent, as secure channel implies it has been sent. - // - then again, if we change / disable secure channel, may still want it. - PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"` - // listenAddrs are the multiaddrs the sender node listens for open connections on - ListenAddrs [][]byte `protobuf:"bytes,2,rep,name=listenAddrs" json:"listenAddrs,omitempty"` - // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives - // this is useful information to convey to the other side, as it helps the remote endpoint - // determine whether its connection to the local peer goes through NAT. - ObservedAddr []byte `protobuf:"bytes,4,opt,name=observedAddr" json:"observedAddr,omitempty"` - // protocols are the services this node is running - Protocols []string `protobuf:"bytes,3,rep,name=protocols" json:"protocols,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Identify) Reset() { *m = Identify{} } -func (m *Identify) String() string { return proto.CompactTextString(m) } -func (*Identify) ProtoMessage() {} -func (*Identify) Descriptor() ([]byte, []int) { - return fileDescriptor_83f1e7e6b485409f, []int{0} -} -func (m *Identify) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Identify) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Identify.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Identify) XXX_Merge(src proto.Message) { - xxx_messageInfo_Identify.Merge(m, src) -} -func (m *Identify) XXX_Size() int { - return m.Size() -} -func (m *Identify) XXX_DiscardUnknown() { - xxx_messageInfo_Identify.DiscardUnknown(m) -} - -var xxx_messageInfo_Identify proto.InternalMessageInfo - -func (m *Identify) GetProtocolVersion() string { - if m != nil && m.ProtocolVersion != nil { - return *m.ProtocolVersion - } - return "" -} - -func (m *Identify) GetAgentVersion() string { - if m != nil && m.AgentVersion != nil { - return *m.AgentVersion - } - return "" -} - -func (m *Identify) GetPublicKey() []byte { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *Identify) GetListenAddrs() [][]byte { - if m != nil { - return m.ListenAddrs - } - return nil -} - -func (m *Identify) GetObservedAddr() []byte { - if m != nil { - return m.ObservedAddr - } - return nil -} - -func (m *Identify) GetProtocols() []string { - if m != nil { - return m.Protocols - } - return nil -} - -func init() { - proto.RegisterType((*Identify)(nil), "identify.pb.Identify") -} - -func init() { proto.RegisterFile("identify.proto", fileDescriptor_83f1e7e6b485409f) } - -var fileDescriptor_83f1e7e6b485409f = []byte{ - // 187 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x4c, 0x49, 0xcd, - 0x2b, 0xc9, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x46, 0xf0, 0x93, 0x94, - 0x6e, 0x31, 0x72, 0x71, 0x78, 0x42, 0xf9, 0x42, 0x1a, 0x5c, 0xfc, 0x60, 0x25, 0xc9, 0xf9, 0x39, - 0x61, 0xa9, 0x45, 0xc5, 0x99, 0xf9, 0x79, 0x12, 0xac, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0xe8, 0xc2, - 0x42, 0x4a, 0x5c, 0x3c, 0x89, 0xe9, 0xa9, 0x79, 0x25, 0x30, 0x65, 0x6c, 0x60, 0x65, 0x28, 0x62, - 0x42, 0x32, 0x5c, 0x9c, 0x05, 0xa5, 0x49, 0x39, 0x99, 0xc9, 0xde, 0xa9, 0x95, 0x12, 0x8c, 0x0a, - 0x8c, 0x1a, 0x3c, 0x41, 0x08, 0x01, 0x21, 0x05, 0x2e, 0xee, 0x9c, 0xcc, 0xe2, 0x92, 0xd4, 0x3c, - 0xc7, 0x94, 0x94, 0xa2, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x64, 0x21, 0x90, 0x1d, - 0xf9, 0x49, 0xc5, 0xa9, 0x45, 0x65, 0xa9, 0x29, 0x20, 0x01, 0x09, 0x16, 0xb0, 0x11, 0x28, 0x62, - 0x60, 0x3b, 0xa0, 0x4e, 0x2b, 0x96, 0x60, 0x56, 0x60, 0xd6, 0xe0, 0x0c, 0x42, 0x08, 0x38, 0xf1, - 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x80, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xc2, 0x2c, 0x19, 0x46, 0x08, 0x01, 0x00, 0x00, -} - -func (m *Identify) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identify) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.PublicKey != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintIdentify(dAtA, i, uint64(len(m.PublicKey))) - i += copy(dAtA[i:], m.PublicKey) - } - if len(m.ListenAddrs) > 0 { - for _, b := range m.ListenAddrs { - dAtA[i] = 0x12 - i++ - i = encodeVarintIdentify(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if len(m.Protocols) > 0 { - for _, s := range m.Protocols { - dAtA[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.ObservedAddr != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintIdentify(dAtA, i, uint64(len(m.ObservedAddr))) - i += copy(dAtA[i:], m.ObservedAddr) - } - if m.ProtocolVersion != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintIdentify(dAtA, i, uint64(len(*m.ProtocolVersion))) - i += copy(dAtA[i:], *m.ProtocolVersion) - } - if m.AgentVersion != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintIdentify(dAtA, i, uint64(len(*m.AgentVersion))) - i += copy(dAtA[i:], *m.AgentVersion) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintIdentify(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Identify) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = len(m.PublicKey) - n += 1 + l + sovIdentify(uint64(l)) - } - if len(m.ListenAddrs) > 0 { - for _, b := range m.ListenAddrs { - l = len(b) - n += 1 + l + sovIdentify(uint64(l)) - } - } - if len(m.Protocols) > 0 { - for _, s := range m.Protocols { - l = len(s) - n += 1 + l + sovIdentify(uint64(l)) - } - } - if m.ObservedAddr != nil { - l = len(m.ObservedAddr) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.ProtocolVersion != nil { - l = len(*m.ProtocolVersion) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.AgentVersion != nil { - l = len(*m.AgentVersion) - n += 1 + l + sovIdentify(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovIdentify(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozIdentify(x uint64) (n int) { - return sovIdentify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Identify) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Identify: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Identify: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddrs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenAddrs = append(m.ListenAddrs, make([]byte, postIndex-iNdEx)) - copy(m.ListenAddrs[len(m.ListenAddrs)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Protocols", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Protocols = append(m.Protocols, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObservedAddr = append(m.ObservedAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ObservedAddr == nil { - m.ObservedAddr = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ProtocolVersion = &s - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AgentVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIdentify - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIdentify - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIdentify - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.AgentVersion = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIdentify(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthIdentify - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthIdentify - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipIdentify(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthIdentify - } - iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthIdentify - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowIdentify - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipIdentify(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthIdentify - } - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthIdentify = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIdentify = fmt.Errorf("proto: integer overflow") -) diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.proto b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.proto deleted file mode 100644 index 5270c4cf..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/identify/pb/identify.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto2"; - -package identify.pb; - -message Identify { - - // protocolVersion determines compatibility between peers - optional string protocolVersion = 5; // e.g. ipfs/1.0.0 - - // agentVersion is like a UserAgent string in browsers, or client version in bittorrent - // includes the client name and client. - optional string agentVersion = 6; // e.g. go-ipfs/0.1.0 - - // publicKey is this node's public key (which also gives its node.ID) - // - may not need to be sent, as secure channel implies it has been sent. - // - then again, if we change / disable secure channel, may still want it. - optional bytes publicKey = 1; - - // listenAddrs are the multiaddrs the sender node listens for open connections on - repeated bytes listenAddrs = 2; - - // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives - // this is useful information to convey to the other side, as it helps the remote endpoint - // determine whether its connection to the local peer goes through NAT. - optional bytes observedAddr = 4; - - // protocols are the services this node is running - repeated string protocols = 3; -} diff --git a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/ping/ping.go b/vendor/github.com/libp2p/go-libp2p/p2p/protocol/ping/ping.go deleted file mode 100644 index 9d9b571e..00000000 --- a/vendor/github.com/libp2p/go-libp2p/p2p/protocol/ping/ping.go +++ /dev/null @@ -1,153 +0,0 @@ -package ping - -import ( - "bytes" - "context" - "errors" - "io" - "time" - - u "github.com/ipfs/go-ipfs-util" - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p-core/host" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" -) - -var log = logging.Logger("ping") - -const PingSize = 32 - -const ID = "/ipfs/ping/1.0.0" - -const pingTimeout = time.Second * 60 - -type PingService struct { - Host host.Host -} - -func NewPingService(h host.Host) *PingService { - ps := &PingService{h} - h.SetStreamHandler(ID, ps.PingHandler) - return ps -} - -func (p *PingService) PingHandler(s network.Stream) { - buf := make([]byte, PingSize) - - errCh := make(chan error, 1) - defer close(errCh) - timer := time.NewTimer(pingTimeout) - defer timer.Stop() - - go func() { - select { - case <-timer.C: - log.Debug("ping timeout") - case err, ok := <-errCh: - if ok { - log.Debug(err) - } else { - log.Error("ping loop failed without error") - } - } - s.Reset() - }() - - for { - _, err := io.ReadFull(s, buf) - if err != nil { - errCh <- err - return - } - - _, err = s.Write(buf) - if err != nil { - errCh <- err - return - } - - timer.Reset(pingTimeout) - } -} - -// Result is a result of a ping attempt, either an RTT or an error. -type Result struct { - RTT time.Duration - Error error -} - -func (ps *PingService) Ping(ctx context.Context, p peer.ID) <-chan Result { - return Ping(ctx, ps.Host, p) -} - -// Ping pings the remote peer until the context is canceled, returning a stream -// of RTTs or errors. -func Ping(ctx context.Context, h host.Host, p peer.ID) <-chan Result { - s, err := h.NewStream(ctx, p, ID) - if err != nil { - ch := make(chan Result, 1) - ch <- Result{Error: err} - close(ch) - return ch - } - - ctx, cancel := context.WithCancel(ctx) - - out := make(chan Result) - go func() { - defer close(out) - defer cancel() - - for ctx.Err() == nil { - var res Result - res.RTT, res.Error = ping(s) - - // canceled, ignore everything. - if ctx.Err() != nil { - return - } - - // No error, record the RTT. - if res.Error == nil { - h.Peerstore().RecordLatency(p, res.RTT) - } - - select { - case out <- res: - case <-ctx.Done(): - return - } - } - }() - go func() { - // forces the ping to abort. - <-ctx.Done() - s.Reset() - }() - - return out -} - -func ping(s network.Stream) (time.Duration, error) { - buf := make([]byte, PingSize) - u.NewTimeSeededRand().Read(buf) - - before := time.Now() - _, err := s.Write(buf) - if err != nil { - return 0, err - } - - rbuf := make([]byte, PingSize) - _, err = io.ReadFull(s, rbuf) - if err != nil { - return 0, err - } - - if !bytes.Equal(buf, rbuf) { - return 0, errors.New("ping packet was incorrect!") - } - - return time.Since(before), nil -} diff --git a/vendor/github.com/libp2p/go-libp2p/package-list.json b/vendor/github.com/libp2p/go-libp2p/package-list.json deleted file mode 100644 index e29a7410..00000000 --- a/vendor/github.com/libp2p/go-libp2p/package-list.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "columns": [ - "Name", - "CI/Travis", - "Coverage", - "Description" - ], - "rows": [ - "Libp2p", - ["libp2p/go-libp2p", "go-libp2p", "go-libp2p entry point"], - ["libp2p/go-libp2p-host", "go-libp2p-host", "libp2p \"host\" interface"], - ["libp2p/go-libp2p-blankhost", "go-libp2p-blankhost", "minimal implementation of the \"host\" interface"], - - "Network", - ["libp2p/go-libp2p-net", "go-libp2p-net", "libp2p connection and \"network\" interfaces"], - ["libp2p/go-libp2p-swarm", "go-libp2p-swarm", "reference implementation"], - - "Transport", - ["libp2p/go-libp2p-transport", "go-libp2p-transport", "interfaces"], - ["libp2p/go-ws-transport", "go-ws-transport", "WebSocket transport"], - ["libp2p/go-tcp-transport", "go-tcp-transport", "TCP transport"], - ["libp2p/go-libp2p-quic-transport", "go-libp2p-quic-transport", "QUIC transport"], - ["libp2p/go-udp-transport", "go-udp-transport", "UDP transport"], - ["libp2p/go-utp-transport", "go-utp-transport", "uTorrent transport (UTP)"], - ["libp2p/go-libp2p-circuit", "go-libp2p-circuit", "relay transport"], - ["libp2p/go-libp2p-transport-upgrader", "go-libp2p-transport-upgrader", "upgrades multiaddr-net connections into full libp2p transports"], - ["libp2p/go-libp2p-reuseport-transport", "go-libp2p-reuseport-transport", "partial transport for building transports that reuse ports"], - - "Encrypted Channels", - ["libp2p/go-conn-security", "go-conn-security", "interfaces"], - ["libp2p/go-libp2p-secio", "go-libp2p-secio", "SecIO crypto channel"], - ["libp2p/go-conn-security-multistream", "go-conn-security-multistream", "multistream multiplexed meta crypto channel"], - - "Private Network", - ["libp2p/go-libp2p-interface-pnet", "go-libp2p-interface-pnet", "interfaces"], - ["libp2p/go-libp2p-pnet", "go-libp2p-pnet", "reference implementation"], - - "Stream Muxers", - ["libp2p/go-stream-muxer", "go-stream-muxer", "interfaces"], - ["whyrusleeping/go-smux-yamux", "go-smux-yamux", "YAMUX stream multiplexer"], - ["whyrusleeping/go-smux-mplex", "go-smux-mplex", "MPLEX stream multiplexer"], - - "NAT Traversal", - ["libp2p/go-libp2p-nat", "go-libp2p-nat"], - - "Peerstore", - ["libp2p/go-libp2p-peerstore", "go-libp2p-peerstore", "interfaces and reference implementation"], - - "Connection Manager", - ["libp2p/go-libp2p-interface-connmgr", "go-libp2p-interface-connmgr", "interface"], - ["libp2p/go-libp2p-connmgr", "go-libp2p-connmgr", "reference implementation"], - - "Routing", - ["libp2p/go-libp2p-routing", "go-libp2p-routing", "routing interfaces"], - ["libp2p/go-libp2p-record", "go-libp2p-record", "record type and validator logic"], - ["libp2p/go-libp2p-routing-helpers", "go-libp2p-routing-helpers", "helpers for composing routers"], - ["libp2p/go-libp2p-kad-dht", "go-libp2p-kad-dht", "Kademlia-like router"], - ["libp2p/go-libp2p-pubsub-router", "go-libp2p-pubsub-router", "record-store over pubsub adapter"], - - "Consensus", - ["libp2p/go-libp2p-consensus", "go-libp2p-consensus", "consensus protocols interfaces"], - ["libp2p/go-libp2p-raft", "go-libp2p-raft", "consensus implementation over raft"], - - "Pubsub", - ["libp2p/go-libp2p-pubsub", "go-libp2p-pubsub", "multiple pubsub over libp2p implementations"], - - "RPC", - ["libp2p/go-libp2p-gorpc", "go-libp2p-gorpc", "a simple RPC library for libp2p"], - - "Metrics", - ["libp2p/go-libp2p-metrics", "go-libp2p-metrics", "libp2p metrics interfaces/collectors"], - - "Data Types", - ["libp2p/go-libp2p-peer", "go-libp2p-peer", "libp2p peer-ID datatype"], - ["libp2p/go-libp2p-crypto", "go-libp2p-crypto", "libp2p key types"], - ["libp2p/go-libp2p-protocol", "go-libp2p-protocol", "libp2p protocol datatype"], - ["libp2p/go-libp2p-kbucket", "go-libp2p-kbucket", "Kademlia routing table helper types"], - - "Utilities/miscellaneous", - ["libp2p/go-libp2p-loggables", "go-libp2p-loggables", "logging helpers"], - ["libp2p/go-maddr-filter", "go-maddr-filter", "multiaddr filtering helpers"], - ["libp2p/go-libp2p-netutil", "go-libp2p-netutil", "misc utilities"], - ["libp2p/go-msgio", "go-msgio", "length prefixed data channel"], - ["libp2p/go-addr-util", "go-addr-util", "address utilities for libp2p swarm"], - ["libp2p/go-buffer-pool", "go-buffer-pool", "a variable size buffer pool for go"], - ["libp2p/go-libp2p-routing-helpers", "go-libp2p-routing-helpers", "routing helpers"], - ["libp2p/go-reuseport", "go-reuseport", "enables reuse of addresses"], - ["libp2p/go-sockaddr", "go-sockaddr", "utils for sockaddr conversions"], - ["libp2p/go-flow-metrics", "go-flow-metrics", "metrics library"], - - "Testing and examples", - ["libp2p/go-testutil", "go-testutil", "a collection of testing utilities for ipfs and libp2p"], - ["libp2p/go-libp2p-examples", "go-libp2p-examples", "go-libp2p examples and tutorials"], - ["libp2p/go-libp2p-circuit-progs", "go-libp2p-circuit-progs", "testing programs for go-libp2p-circuit"] - - ] -} diff --git a/vendor/github.com/libp2p/go-maddr-filter/.travis.yml b/vendor/github.com/libp2p/go-maddr-filter/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-maddr-filter/LICENSE b/vendor/github.com/libp2p/go-maddr-filter/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-maddr-filter/README.md b/vendor/github.com/libp2p/go-maddr-filter/README.md deleted file mode 100644 index db9ba5e0..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/README.md +++ /dev/null @@ -1,64 +0,0 @@ -go-maddr-filter -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-maddr-filter/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-maddr-filter?branch=master) -[![Travis CI](https://travis-ci.org/libp2p/go-maddr-filter.svg?branch=master)](https://travis-ci.org/libp2p/go-maddr-filter) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -> A library to perform filtering of [multiaddrs](https://github.com/multiformats/multiaddr). - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Examples - -```go -// make a new filterset -f := NewFilters() - -// filter out addresses on the 192.168 subnet -_, ipnet, _ := net.ParseCIDR("192.168.0.0/16") -f.AddFilter(ipnet, ActionDeny) - -// check if an address is blocked -lanaddr, _ := ma.NewMultiaddr("/ip4/192.168.0.17/tcp/4050") -fmt.Println(f.AddrBlocked(lanaddr)) - -// the default for a filter is accept, but we can change that -f.RemoveLiteral(ipnet) -f.DefaultAction = ActionDeny -fmt.Println(f.AddrBlocked(lanaddr)) - -// we can now allow the local LAN, denying everything else -f.AddFilter(ipnet, ActionAccept) -fmt.Println(f.AddrBlocked(lanaddr)) -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson - ---- - -The last gx published version of this module was: 1.1.13: QmT6C5ebDy92zyRzdmSNyda5q7zkNXy68X47RDJiHpvaxd diff --git a/vendor/github.com/libp2p/go-maddr-filter/codecov.yml b/vendor/github.com/libp2p/go-maddr-filter/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-maddr-filter/filter.go b/vendor/github.com/libp2p/go-maddr-filter/filter.go deleted file mode 100644 index a555df51..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/filter.go +++ /dev/null @@ -1,174 +0,0 @@ -package filter - -import ( - "net" - "sync" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -// Action is an enum modelling all possible filter actions. -type Action int32 - -const ( - ActionNone Action = iota // zero value. - ActionAccept - ActionDeny -) - -type filterEntry struct { - f net.IPNet - action Action -} - -// Filters is a structure representing a collection of accept/deny -// net.IPNet filters, together with the DefaultAction flag, which -// represents the default filter policy. -// -// Note that the last policy added to the Filters is authoritative. -type Filters struct { - DefaultAction Action - - mu sync.RWMutex - filters []*filterEntry -} - -// NewFilters constructs and returns a new set of net.IPNet filters. -// By default, the new filter accepts all addresses. -func NewFilters() *Filters { - return &Filters{ - DefaultAction: ActionAccept, - filters: make([]*filterEntry, 0), - } -} - -func (fs *Filters) find(ipnet net.IPNet) (int, *filterEntry) { - s := ipnet.String() - for idx, ft := range fs.filters { - if ft.f.String() == s { - return idx, ft - } - } - return -1, nil -} - -// AddDialFilter adds a deny rule to this Filters set. Hosts -// matching the given net.IPNet filter will be denied, unless -// another rule is added which states that they should be accepted. -// -// No effort is made to prevent duplication of filters, or to simplify -// the filters list. -// -// Deprecated: Use AddFilter(). -func (fs *Filters) AddDialFilter(f *net.IPNet) { - fs.AddFilter(*f, ActionDeny) -} - -// AddFilter adds a rule to the Filters set, enforcing the desired action for -// the provided IPNet mask. -func (fs *Filters) AddFilter(ipnet net.IPNet, action Action) { - fs.mu.Lock() - defer fs.mu.Unlock() - - if _, f := fs.find(ipnet); f != nil { - f.action = action - } else { - fs.filters = append(fs.filters, &filterEntry{ipnet, action}) - } -} - -// RemoveLiteral removes the first filter associated with the supplied IPNet, -// returning whether something was removed or not. It makes no distinction -// between whether the rule is an accept or a deny. -// -// Deprecated: use RemoveLiteral() instead. -func (fs *Filters) Remove(ipnet *net.IPNet) (removed bool) { - return fs.RemoveLiteral(*ipnet) -} - -// RemoveLiteral removes the first filter associated with the supplied IPNet, -// returning whether something was removed or not. It makes no distinction -// between whether the rule is an accept or a deny. -func (fs *Filters) RemoveLiteral(ipnet net.IPNet) (removed bool) { - fs.mu.Lock() - defer fs.mu.Unlock() - - if idx, _ := fs.find(ipnet); idx != -1 { - fs.filters = append(fs.filters[:idx], fs.filters[idx+1:]...) - return true - } - return false -} - -// AddrBlocked parses a ma.Multiaddr and, if a valid netip is found, it applies the -// Filter set rules, returning true if the given address should be denied, and false if -// the given address is accepted. -// -// If a parsing error occurs, or no filter matches, the Filters' -// default is returned. -// -// TODO: currently, the last filter to match wins always, but it shouldn't be that way. -// Instead, the highest-specific last filter should win; that way more specific filters -// override more general ones. -func (fs *Filters) AddrBlocked(a ma.Multiaddr) (deny bool) { - maddr := ma.Split(a) - if len(maddr) == 0 { - return fs.DefaultAction == ActionDeny - } - netaddr, err := manet.ToNetAddr(maddr[0]) - if err != nil { - // if we can't parse it, it's probably not blocked. - return fs.DefaultAction == ActionDeny - } - netip := net.ParseIP(netaddr.String()) - if netip == nil { - return fs.DefaultAction == ActionDeny - } - - fs.mu.RLock() - defer fs.mu.RUnlock() - - action := fs.DefaultAction - for _, ft := range fs.filters { - if ft.f.Contains(netip) { - action = ft.action - } - } - - return action == ActionDeny -} - -// Filters returns the list of DENY net.IPNet masks. For backwards compatibility. -// -// A copy of the filters is made prior to returning, so the inner state is not exposed. -// -// Deprecated: Use FiltersForAction(). -func (fs *Filters) Filters() (result []*net.IPNet) { - ffa := fs.FiltersForAction(ActionDeny) - for _, res := range ffa { - res := res // allocate a new copy - result = append(result, &res) - } - return result -} - -func (fs *Filters) ActionForFilter(ipnet net.IPNet) (action Action, ok bool) { - if _, f := fs.find(ipnet); f != nil { - return f.action, true - } - return ActionNone, false -} - -// FiltersForAction returns the filters associated with the indicated action. -func (fs *Filters) FiltersForAction(action Action) (result []net.IPNet) { - fs.mu.RLock() - defer fs.mu.RUnlock() - - for _, ff := range fs.filters { - if ff.action == action { - result = append(result, ff.f) - } - } - return result -} diff --git a/vendor/github.com/libp2p/go-maddr-filter/go.mod b/vendor/github.com/libp2p/go-maddr-filter/go.mod deleted file mode 100644 index 4adb057d..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/libp2p/go-maddr-filter - -require ( - github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-net v0.0.1 -) diff --git a/vendor/github.com/libp2p/go-maddr-filter/go.sum b/vendor/github.com/libp2p/go-maddr-filter/go.sum deleted file mode 100644 index 11cfae50..00000000 --- a/vendor/github.com/libp2p/go-maddr-filter/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/libp2p/go-mplex/.travis.yml b/vendor/github.com/libp2p/go-mplex/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-mplex/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-mplex/LICENSE b/vendor/github.com/libp2p/go-mplex/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-mplex/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-mplex/README.md b/vendor/github.com/libp2p/go-mplex/README.md deleted file mode 100644 index ff7cc708..00000000 --- a/vendor/github.com/libp2p/go-mplex/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# go-mplex - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -A super simple [stream muxing](https://docs.libp2p.io/concepts/stream-multiplexing/) library implementing [mplex](https://github.com/libp2p/specs/tree/master/mplex). - -## Usage - -```go -mplex := multiplex.NewMultiplex(mysocket) - -s, _ := mplex.NewStream() -s.Write([]byte("Hello World!")) -s.Close() - -os, _ := mplex.Accept() -// echo back everything received -io.Copy(os, os) -``` - ---- - -The last gx published version of this module was: 0.2.35: QmWGQQ6Tz8AdUpxktLf3zgnVN9Vy8fcWVezZJSU3ZmiANj diff --git a/vendor/github.com/libp2p/go-mplex/codecov.yml b/vendor/github.com/libp2p/go-mplex/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-mplex/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-mplex/deadline.go b/vendor/github.com/libp2p/go-mplex/deadline.go deleted file mode 100644 index dd2dfaf9..00000000 --- a/vendor/github.com/libp2p/go-mplex/deadline.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copied from the go standard library. -// -// Copyright 2010 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-BSD file. - -package multiplex - -import ( - "sync" - "time" -) - -// pipeDeadline is an abstraction for handling timeouts. -type pipeDeadline struct { - mu sync.Mutex // Guards timer and cancel - timer *time.Timer - cancel chan struct{} // Must be non-nil -} - -func makePipeDeadline() pipeDeadline { - return pipeDeadline{cancel: make(chan struct{})} -} - -// set sets the point in time when the deadline will time out. -// A timeout event is signaled by closing the channel returned by waiter. -// Once a timeout has occurred, the deadline can be refreshed by specifying a -// t value in the future. -// -// A zero value for t prevents timeout. -func (d *pipeDeadline) set(t time.Time) { - d.mu.Lock() - defer d.mu.Unlock() - - if d.timer != nil && !d.timer.Stop() { - <-d.cancel // Wait for the timer callback to finish and close cancel - } - d.timer = nil - - // Time is zero, then there is no deadline. - closed := isClosedChan(d.cancel) - if t.IsZero() { - if closed { - d.cancel = make(chan struct{}) - } - return - } - - // Time in the future, setup a timer to cancel in the future. - if dur := time.Until(t); dur > 0 { - if closed { - d.cancel = make(chan struct{}) - } - d.timer = time.AfterFunc(dur, func() { - close(d.cancel) - }) - return - } - - // Time in the past, so close immediately. - if !closed { - close(d.cancel) - } -} - -// wait returns a channel that is closed when the deadline is exceeded. -func (d *pipeDeadline) wait() chan struct{} { - d.mu.Lock() - defer d.mu.Unlock() - return d.cancel -} - -func isClosedChan(c <-chan struct{}) bool { - select { - case <-c: - return true - default: - return false - } -} diff --git a/vendor/github.com/libp2p/go-mplex/go.mod b/vendor/github.com/libp2p/go-mplex/go.mod deleted file mode 100644 index 8f9939fc..00000000 --- a/vendor/github.com/libp2p/go-mplex/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/libp2p/go-mplex - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-buffer-pool v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 -) diff --git a/vendor/github.com/libp2p/go-mplex/go.sum b/vendor/github.com/libp2p/go-mplex/go.sum deleted file mode 100644 index 09699363..00000000 --- a/vendor/github.com/libp2p/go-mplex/go.sum +++ /dev/null @@ -1,77 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-mplex/multiplex.go b/vendor/github.com/libp2p/go-mplex/multiplex.go deleted file mode 100644 index 1c75baa7..00000000 --- a/vendor/github.com/libp2p/go-mplex/multiplex.go +++ /dev/null @@ -1,591 +0,0 @@ -package multiplex - -import ( - "bufio" - "context" - "encoding/binary" - "errors" - "fmt" - "io" - "net" - "sync" - "time" - - logging "github.com/ipfs/go-log" - pool "github.com/libp2p/go-buffer-pool" -) - -var log = logging.Logger("mplex") - -var MaxMessageSize = 1 << 20 - -// Max time to block waiting for a slow reader to read from a stream before -// resetting it. Preferably, we'd have some form of back-pressure mechanism but -// we don't have that in this protocol. -var ReceiveTimeout = 5 * time.Second - -// ErrShutdown is returned when operating on a shutdown session -var ErrShutdown = errors.New("session shut down") - -// ErrTwoInitiators is returned when both sides think they're the initiator -var ErrTwoInitiators = errors.New("two initiators") - -// ErrInvalidState is returned when the other side does something it shouldn't. -// In this case, we close the connection to be safe. -var ErrInvalidState = errors.New("received an unexpected message from the peer") - -var errTimeout = timeout{} -var errStreamClosed = errors.New("stream closed") - -var ( - NewStreamTimeout = time.Minute - ResetStreamTimeout = 2 * time.Minute - - WriteCoalesceDelay = 100 * time.Microsecond -) - -type timeout struct{} - -func (_ timeout) Error() string { - return "i/o deadline exceeded" -} - -func (_ timeout) Temporary() bool { - return true -} - -func (_ timeout) Timeout() bool { - return true -} - -// +1 for initiator -const ( - newStreamTag = 0 - messageTag = 2 - closeTag = 4 - resetTag = 6 -) - -// Multiplex is a mplex session. -type Multiplex struct { - con net.Conn - buf *bufio.Reader - nextID uint64 - initiator bool - - closed chan struct{} - shutdown chan struct{} - shutdownErr error - shutdownLock sync.Mutex - - writeCh chan []byte - writeTimer *time.Timer - writeTimerFired bool - - nstreams chan *Stream - - channels map[streamID]*Stream - chLock sync.Mutex -} - -// NewMultiplex creates a new multiplexer session. -func NewMultiplex(con net.Conn, initiator bool) *Multiplex { - mp := &Multiplex{ - con: con, - initiator: initiator, - buf: bufio.NewReader(con), - channels: make(map[streamID]*Stream), - closed: make(chan struct{}), - shutdown: make(chan struct{}), - writeCh: make(chan []byte, 16), - writeTimer: time.NewTimer(0), - nstreams: make(chan *Stream, 16), - } - - go mp.handleIncoming() - go mp.handleOutgoing() - - return mp -} - -func (mp *Multiplex) newStream(id streamID, name string) (s *Stream) { - s = &Stream{ - id: id, - name: name, - dataIn: make(chan []byte, 8), - reset: make(chan struct{}), - rDeadline: makePipeDeadline(), - wDeadline: makePipeDeadline(), - mp: mp, - } - - s.closedLocal, s.doCloseLocal = context.WithCancel(context.Background()) - return -} - -// Accept accepts the next stream from the connection. -func (m *Multiplex) Accept() (*Stream, error) { - select { - case s, ok := <-m.nstreams: - if !ok { - return nil, errors.New("multiplex closed") - } - return s, nil - case <-m.closed: - return nil, m.shutdownErr - } -} - -// Close closes the session. -func (mp *Multiplex) Close() error { - mp.closeNoWait() - - // Wait for the receive loop to finish. - <-mp.closed - - return nil -} - -func (mp *Multiplex) closeNoWait() { - mp.shutdownLock.Lock() - select { - case <-mp.shutdown: - default: - mp.con.Close() - close(mp.shutdown) - } - mp.shutdownLock.Unlock() -} - -// IsClosed returns true if the session is closed. -func (mp *Multiplex) IsClosed() bool { - select { - case <-mp.closed: - return true - default: - return false - } -} - -func (mp *Multiplex) sendMsg(done <-chan struct{}, header uint64, data []byte) error { - buf := pool.Get(len(data) + 20) - - n := 0 - n += binary.PutUvarint(buf[n:], header) - n += binary.PutUvarint(buf[n:], uint64(len(data))) - n += copy(buf[n:], data) - - select { - case mp.writeCh <- buf[:n]: - return nil - case <-mp.shutdown: - return ErrShutdown - case <-done: - return errTimeout - } -} - -func (mp *Multiplex) handleOutgoing() { - for { - select { - case <-mp.shutdown: - return - - case data := <-mp.writeCh: - // FIXME: https://github.com/libp2p/go-libp2p/issues/644 - // write coalescing disabled until this can be fixed. - //err := mp.writeMsg(data) - err := mp.doWriteMsg(data) - pool.Put(data) - if err != nil { - // the connection is closed by this time - log.Warningf("error writing data: %s", err.Error()) - return - } - } - } -} - -func (mp *Multiplex) writeMsg(data []byte) error { - if len(data) >= 512 { - err := mp.doWriteMsg(data) - pool.Put(data) - return err - } - - buf := pool.Get(4096) - defer pool.Put(buf) - - n := copy(buf, data) - pool.Put(data) - - if !mp.writeTimerFired { - if !mp.writeTimer.Stop() { - <-mp.writeTimer.C - } - } - mp.writeTimer.Reset(WriteCoalesceDelay) - mp.writeTimerFired = false - - for { - select { - case data = <-mp.writeCh: - wr := copy(buf[n:], data) - if wr < len(data) { - // we filled the buffer, send it - err := mp.doWriteMsg(buf) - if err != nil { - pool.Put(data) - return err - } - - if len(data)-wr >= 512 { - // the remaining data is not a small write, send it - err := mp.doWriteMsg(data[wr:]) - pool.Put(data) - return err - } - - n = copy(buf, data[wr:]) - - // we've written some, reset the timer to coalesce the rest - if !mp.writeTimer.Stop() { - <-mp.writeTimer.C - } - mp.writeTimer.Reset(WriteCoalesceDelay) - } else { - n += wr - } - - pool.Put(data) - - case <-mp.writeTimer.C: - mp.writeTimerFired = true - return mp.doWriteMsg(buf[:n]) - - case <-mp.shutdown: - return ErrShutdown - } - } -} - -func (mp *Multiplex) doWriteMsg(data []byte) error { - if mp.isShutdown() { - return ErrShutdown - } - - _, err := mp.con.Write(data) - if err != nil { - mp.closeNoWait() - } - - return err -} - -func (mp *Multiplex) nextChanID() uint64 { - out := mp.nextID - mp.nextID++ - return out -} - -// NewStream creates a new stream. -func (mp *Multiplex) NewStream() (*Stream, error) { - return mp.NewNamedStream("") -} - -// NewNamedStream creates a new named stream. -func (mp *Multiplex) NewNamedStream(name string) (*Stream, error) { - mp.chLock.Lock() - - // We could call IsClosed but this is faster (given that we already have - // the lock). - if mp.channels == nil { - mp.chLock.Unlock() - return nil, ErrShutdown - } - - sid := mp.nextChanID() - header := (sid << 3) | newStreamTag - - if name == "" { - name = fmt.Sprint(sid) - } - s := mp.newStream(streamID{ - id: sid, - initiator: true, - }, name) - mp.channels[s.id] = s - mp.chLock.Unlock() - - ctx, cancel := context.WithTimeout(context.Background(), NewStreamTimeout) - defer cancel() - - err := mp.sendMsg(ctx.Done(), header, []byte(name)) - if err != nil { - return nil, err - } - - return s, nil -} - -func (mp *Multiplex) cleanup() { - mp.closeNoWait() - mp.chLock.Lock() - defer mp.chLock.Unlock() - for _, msch := range mp.channels { - msch.clLock.Lock() - if !msch.closedRemote { - msch.closedRemote = true - // Cancel readers - close(msch.reset) - } - - msch.doCloseLocal() - msch.clLock.Unlock() - } - // Don't remove this nil assignment. We check if this is nil to check if - // the connection is closed when we already have the lock (faster than - // checking if the stream is closed). - mp.channels = nil - if mp.shutdownErr == nil { - mp.shutdownErr = ErrShutdown - } - close(mp.closed) -} - -func (mp *Multiplex) handleIncoming() { - defer mp.cleanup() - - recvTimeout := time.NewTimer(0) - defer recvTimeout.Stop() - - if !recvTimeout.Stop() { - <-recvTimeout.C - } - - for { - chID, tag, err := mp.readNextHeader() - if err != nil { - mp.shutdownErr = err - return - } - - remoteIsInitiator := tag&1 == 0 - ch := streamID{ - // true if *I'm* the initiator. - initiator: !remoteIsInitiator, - id: chID, - } - // Rounds up the tag: - // 0 -> 0 - // 1 -> 2 - // 2 -> 2 - // 3 -> 4 - // etc... - tag += (tag & 1) - - b, err := mp.readNext() - if err != nil { - mp.shutdownErr = err - return - } - - mp.chLock.Lock() - msch, ok := mp.channels[ch] - mp.chLock.Unlock() - - switch tag { - case newStreamTag: - if ok { - log.Debugf("received NewStream message for existing stream: %d", ch) - mp.shutdownErr = ErrInvalidState - return - } - - name := string(b) - pool.Put(b) - - msch = mp.newStream(ch, name) - mp.chLock.Lock() - mp.channels[ch] = msch - mp.chLock.Unlock() - select { - case mp.nstreams <- msch: - case <-mp.shutdown: - return - } - - case resetTag: - if !ok { - // This is *ok*. We forget the stream on reset. - continue - } - msch.clLock.Lock() - - isClosed := msch.isClosed() - - if !msch.closedRemote { - close(msch.reset) - msch.closedRemote = true - } - - if !isClosed { - msch.doCloseLocal() - } - - msch.clLock.Unlock() - - msch.cancelDeadlines() - - mp.chLock.Lock() - delete(mp.channels, ch) - mp.chLock.Unlock() - case closeTag: - if !ok { - continue - } - - msch.clLock.Lock() - - if msch.closedRemote { - msch.clLock.Unlock() - // Technically a bug on the other side. We - // should consider killing the connection. - continue - } - - close(msch.dataIn) - msch.closedRemote = true - - cleanup := msch.isClosed() - - msch.clLock.Unlock() - - if cleanup { - msch.cancelDeadlines() - mp.chLock.Lock() - delete(mp.channels, ch) - mp.chLock.Unlock() - } - case messageTag: - if !ok { - // reset stream, return b - pool.Put(b) - - // This is a perfectly valid case when we reset - // and forget about the stream. - log.Debugf("message for non-existant stream, dropping data: %d", ch) - // go mp.sendResetMsg(ch.header(resetTag), false) - continue - } - - msch.clLock.Lock() - remoteClosed := msch.closedRemote - msch.clLock.Unlock() - if remoteClosed { - // closed stream, return b - pool.Put(b) - - log.Warningf("Received data from remote after stream was closed by them. (len = %d)", len(b)) - // go mp.sendResetMsg(msch.id.header(resetTag), false) - continue - } - - recvTimeout.Reset(ReceiveTimeout) - select { - case msch.dataIn <- b: - case <-msch.reset: - pool.Put(b) - case <-recvTimeout.C: - pool.Put(b) - log.Warningf("timed out receiving message into stream queue.") - // Do not do this asynchronously. Otherwise, we - // could drop a message, then receive a message, - // then reset. - msch.Reset() - continue - case <-mp.shutdown: - pool.Put(b) - return - } - if !recvTimeout.Stop() { - <-recvTimeout.C - } - default: - log.Debugf("message with unknown header on stream %s", ch) - if ok { - msch.Reset() - } - } - } -} - -func (mp *Multiplex) isShutdown() bool { - select { - case <-mp.shutdown: - return true - default: - return false - } -} - -func (mp *Multiplex) sendResetMsg(header uint64, hard bool) { - ctx, cancel := context.WithTimeout(context.Background(), ResetStreamTimeout) - defer cancel() - - err := mp.sendMsg(ctx.Done(), header, nil) - if err != nil && !mp.isShutdown() { - if hard { - log.Warningf("error sending reset message: %s; killing connection", err.Error()) - mp.Close() - } else { - log.Debugf("error sending reset message: %s", err.Error()) - } - } -} - -func (mp *Multiplex) readNextHeader() (uint64, uint64, error) { - h, err := binary.ReadUvarint(mp.buf) - if err != nil { - return 0, 0, err - } - - // get channel ID - ch := h >> 3 - - rem := h & 7 - - return ch, rem, nil -} - -func (mp *Multiplex) readNext() ([]byte, error) { - // get length - l, err := binary.ReadUvarint(mp.buf) - if err != nil { - return nil, err - } - - if l > uint64(MaxMessageSize) { - return nil, fmt.Errorf("message size too large!") - } - - if l == 0 { - return nil, nil - } - - buf := pool.Get(int(l)) - n, err := io.ReadFull(mp.buf, buf) - if err != nil { - return nil, err - } - - return buf[:n], nil -} - -func isFatalNetworkError(err error) bool { - nerr, ok := err.(net.Error) - if ok { - return !(nerr.Timeout() || nerr.Temporary()) - } - return false -} diff --git a/vendor/github.com/libp2p/go-mplex/stream.go b/vendor/github.com/libp2p/go-mplex/stream.go deleted file mode 100644 index 4004ed12..00000000 --- a/vendor/github.com/libp2p/go-mplex/stream.go +++ /dev/null @@ -1,292 +0,0 @@ -package multiplex - -import ( - "context" - "errors" - "io" - "sync" - "time" - - "github.com/libp2p/go-libp2p-core/mux" - - pool "github.com/libp2p/go-buffer-pool" -) - -// streamID is a convenience type for operating on stream IDs -type streamID struct { - id uint64 - initiator bool -} - -// header computes the header for the given tag -func (id *streamID) header(tag uint64) uint64 { - header := id.id<<3 | tag - if !id.initiator { - header-- - } - return header -} - -type Stream struct { - id streamID - name string - dataIn chan []byte - mp *Multiplex - - extra []byte - - // exbuf is for holding the reference to the beginning of the extra slice - // for later memory pool freeing - exbuf []byte - - rDeadline, wDeadline pipeDeadline - - clLock sync.Mutex - closedRemote bool - - // Closed when the connection is reset. - reset chan struct{} - - // Closed when the writer is closed (reset will also be closed) - closedLocal context.Context - doCloseLocal context.CancelFunc -} - -func (s *Stream) Name() string { - return s.name -} - -// tries to preload pending data -func (s *Stream) preloadData() { - select { - case read, ok := <-s.dataIn: - if !ok { - return - } - s.extra = read - s.exbuf = read - default: - } -} - -func (s *Stream) waitForData() error { - select { - case <-s.reset: - // This is the only place where it's safe to return these. - s.returnBuffers() - return mux.ErrReset - case read, ok := <-s.dataIn: - if !ok { - return io.EOF - } - s.extra = read - s.exbuf = read - return nil - case <-s.rDeadline.wait(): - return errTimeout - } -} - -func (s *Stream) returnBuffers() { - if s.exbuf != nil { - pool.Put(s.exbuf) - s.exbuf = nil - s.extra = nil - } - for { - select { - case read, ok := <-s.dataIn: - if !ok { - return - } - if read == nil { - continue - } - pool.Put(read) - default: - return - } - } -} - -func (s *Stream) Read(b []byte) (int, error) { - select { - case <-s.reset: - return 0, mux.ErrReset - default: - } - if s.extra == nil { - err := s.waitForData() - if err != nil { - return 0, err - } - } - n := 0 - for s.extra != nil && n < len(b) { - read := copy(b[n:], s.extra) - n += read - if read < len(s.extra) { - s.extra = s.extra[read:] - } else { - if s.exbuf != nil { - pool.Put(s.exbuf) - } - s.extra = nil - s.exbuf = nil - s.preloadData() - } - } - return n, nil -} - -func (s *Stream) Write(b []byte) (int, error) { - var written int - for written < len(b) { - wl := len(b) - written - if wl > MaxMessageSize { - wl = MaxMessageSize - } - - n, err := s.write(b[written : written+wl]) - if err != nil { - return written, err - } - - written += n - } - - return written, nil -} - -func (s *Stream) write(b []byte) (int, error) { - if s.isClosed() { - return 0, errors.New("cannot write to closed stream") - } - - err := s.mp.sendMsg(s.wDeadline.wait(), s.id.header(messageTag), b) - - if err != nil { - if err == context.Canceled { - err = errors.New("cannot write to closed stream") - } - return 0, err - } - - return len(b), nil -} - -func (s *Stream) isClosed() bool { - return s.closedLocal.Err() != nil -} - -func (s *Stream) Close() error { - ctx, cancel := context.WithTimeout(context.Background(), ResetStreamTimeout) - defer cancel() - - err := s.mp.sendMsg(ctx.Done(), s.id.header(closeTag), nil) - - if s.isClosed() { - return nil - } - - s.clLock.Lock() - remote := s.closedRemote - s.clLock.Unlock() - - s.doCloseLocal() - - if remote { - s.cancelDeadlines() - s.mp.chLock.Lock() - delete(s.mp.channels, s.id) - s.mp.chLock.Unlock() - } - - if err != nil && !s.mp.isShutdown() { - log.Warningf("Error closing stream: %s; killing connection", err.Error()) - s.mp.Close() - } - - return err -} - -func (s *Stream) Reset() error { - s.clLock.Lock() - - // Don't reset when fully closed. - if s.closedRemote && s.isClosed() { - s.clLock.Unlock() - return nil - } - - // Don't reset twice. - select { - case <-s.reset: - s.clLock.Unlock() - return nil - default: - } - - close(s.reset) - s.doCloseLocal() - s.closedRemote = true - s.cancelDeadlines() - - go s.mp.sendResetMsg(s.id.header(resetTag), true) - - s.clLock.Unlock() - - s.mp.chLock.Lock() - delete(s.mp.channels, s.id) - s.mp.chLock.Unlock() - - return nil -} - -func (s *Stream) cancelDeadlines() { - s.rDeadline.set(time.Time{}) - s.wDeadline.set(time.Time{}) -} - -func (s *Stream) SetDeadline(t time.Time) error { - s.clLock.Lock() - defer s.clLock.Unlock() - - if s.closedRemote && s.isClosed() { - return errStreamClosed - } - - if !s.closedRemote { - s.rDeadline.set(t) - } - - if !s.isClosed() { - s.wDeadline.set(t) - } - - return nil -} - -func (s *Stream) SetReadDeadline(t time.Time) error { - s.clLock.Lock() - defer s.clLock.Unlock() - - if s.closedRemote { - return errStreamClosed - } - - s.rDeadline.set(t) - return nil -} - -func (s *Stream) SetWriteDeadline(t time.Time) error { - s.clLock.Lock() - defer s.clLock.Unlock() - - if s.isClosed() { - return errStreamClosed - } - - s.wDeadline.set(t) - return nil -} diff --git a/vendor/github.com/libp2p/go-msgio/.gxignore b/vendor/github.com/libp2p/go-msgio/.gxignore deleted file mode 100644 index 39217cdd..00000000 --- a/vendor/github.com/libp2p/go-msgio/.gxignore +++ /dev/null @@ -1 +0,0 @@ -Godeps/* \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-msgio/.travis.yml b/vendor/github.com/libp2p/go-msgio/.travis.yml deleted file mode 100644 index b86c124d..00000000 --- a/vendor/github.com/libp2p/go-msgio/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race -cpu=5" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-msgio/LICENSE b/vendor/github.com/libp2p/go-msgio/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-msgio/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-msgio/README.md b/vendor/github.com/libp2p/go-msgio/README.md deleted file mode 100644 index c2196ec5..00000000 --- a/vendor/github.com/libp2p/go-msgio/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# go-msgio - Message IO - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![codecov](https://codecov.io/gh/libp2p/go-libp2p-netutil/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-msgio) -[![Travis CI](https://travis-ci.org/libp2p/go-libp2p-netutil.svg?branch=master)](https://travis-ci.org/libp2p/go-msgio) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) - -This is a simple package that helps read and write length-delimited slices. It's helpful for building wire protocols. - -## Usage - -### Reading - -```go -import "github.com/libp2p/go-msgio" -rdr := ... // some reader from a wire -mrdr := msgio.NewReader(rdr) - -for { - msg, err := mrdr.ReadMsg() - if err != nil { - return err - } - - doSomething(msg) -} -``` - -### Writing - -```go -import "github.com/libp2p/go-msgio" -wtr := genReader() -mwtr := msgio.NewWriter(wtr) - -for { - msg := genMessage() - err := mwtr.WriteMsg(msg) - if err != nil { - return err - } -} -``` - -### Duplex - -```go -import "github.com/libp2p/go-msgio" -rw := genReadWriter() -mrw := msgio.NewReadWriter(rw) - -for { - msg, err := mrdr.ReadMsg() - if err != nil { - return err - } - - // echo it back :) - err = mwtr.WriteMsg(msg) - if err != nil { - return err - } -} -``` - -### Channels - -```go -import "github.com/libp2p/go-msgio" -rw := genReadWriter() -rch := msgio.NewReadChannel(rw) -wch := msgio.NewWriteChannel(rw) - -for { - msg, err := <-rch - if err != nil { - return err - } - - // echo it back :) - wch<- rw -} -``` - ---- - -The last gx published version of this module was: 0.0.6: QmcxL9MDzSU5Mj1GcWZD8CXkAFuJXjdbjotZ93o371bKSf diff --git a/vendor/github.com/libp2p/go-msgio/chan.go b/vendor/github.com/libp2p/go-msgio/chan.go deleted file mode 100644 index 571393c1..00000000 --- a/vendor/github.com/libp2p/go-msgio/chan.go +++ /dev/null @@ -1,109 +0,0 @@ -package msgio - -import ( - "io" - - pool "github.com/libp2p/go-buffer-pool" -) - -// Chan is a msgio duplex channel. It is used to have a channel interface -// around a msgio.Reader or Writer. -type Chan struct { - MsgChan chan []byte - ErrChan chan error - CloseChan chan bool -} - -// NewChan constructs a Chan with a given buffer size. -func NewChan(chanSize int) *Chan { - return &Chan{ - MsgChan: make(chan []byte, chanSize), - ErrChan: make(chan error, 1), - CloseChan: make(chan bool, 2), - } -} - -// ReadFrom wraps the given io.Reader with a msgio.Reader, reads all -// messages, ands sends them down the channel. -func (s *Chan) ReadFrom(r io.Reader) { - s.readFrom(NewReader(r)) -} - -// ReadFromWithPool wraps the given io.Reader with a msgio.Reader, reads all -// messages, ands sends them down the channel. Uses given BufferPool. -func (s *Chan) ReadFromWithPool(r io.Reader, p *pool.BufferPool) { - s.readFrom(NewReaderWithPool(r, p)) -} - -// ReadFrom wraps the given io.Reader with a msgio.Reader, reads all -// messages, ands sends them down the channel. -func (s *Chan) readFrom(mr Reader) { -Loop: - for { - buf, err := mr.ReadMsg() - if err != nil { - if err == io.EOF { - break Loop // done - } - - // unexpected error. tell the client. - s.ErrChan <- err - break Loop - } - - select { - case <-s.CloseChan: - break Loop // told we're done - case s.MsgChan <- buf: - // ok seems fine. send it away - } - } - - close(s.MsgChan) - // signal we're done - s.CloseChan <- true -} - -// WriteTo wraps the given io.Writer with a msgio.Writer, listens on the -// channel and writes all messages to the writer. -func (s *Chan) WriteTo(w io.Writer) { - // new buffer per message - // if bottleneck, cycle around a set of buffers - mw := NewWriter(w) - -Loop: - for { - select { - case <-s.CloseChan: - break Loop // told we're done - - case msg, ok := <-s.MsgChan: - if !ok { // chan closed - break Loop - } - - if err := mw.WriteMsg(msg); err != nil { - if err != io.EOF { - // unexpected error. tell the client. - s.ErrChan <- err - } - - break Loop - } - } - } - - // signal we're done - s.CloseChan <- true -} - -// Close the Chan -func (s *Chan) Close() { - s.CloseChan <- true -} - -// nullLocker conforms to the sync.Locker interface but does nothing. -type nullLocker struct{} - -func (l *nullLocker) Lock() {} -func (l *nullLocker) Unlock() {} diff --git a/vendor/github.com/libp2p/go-msgio/codecov.yml b/vendor/github.com/libp2p/go-msgio/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-msgio/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-msgio/fuzz.go b/vendor/github.com/libp2p/go-msgio/fuzz.go deleted file mode 100644 index 055abdbb..00000000 --- a/vendor/github.com/libp2p/go-msgio/fuzz.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build gofuzz - -package msgio - -import "bytes" - -// get the go-fuzz tools and build a fuzzer -// $ go get -u github.com/dvyukov/go-fuzz/... -// $ go-fuzz-build github.com/libp2p/go-msgio - -// put a corpus of random (even better if actual, structured) data in a corpus directry -// $ go-fuzz -bin ./msgio-fuzz -corpus corpus -workdir=wdir -timeout=15 - -func Fuzz(data []byte) int { - rc := NewReader(bytes.NewReader(data)) - // rc := NewVarintReader(bytes.NewReader(data)) - - if _, err := rc.ReadMsg(); err != nil { - return 0 - } - - return 1 -} diff --git a/vendor/github.com/libp2p/go-msgio/go.mod b/vendor/github.com/libp2p/go-msgio/go.mod deleted file mode 100644 index dff70980..00000000 --- a/vendor/github.com/libp2p/go-msgio/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/libp2p/go-msgio - -require github.com/libp2p/go-buffer-pool v0.0.1 diff --git a/vendor/github.com/libp2p/go-msgio/go.sum b/vendor/github.com/libp2p/go-msgio/go.sum deleted file mode 100644 index f65bc04e..00000000 --- a/vendor/github.com/libp2p/go-msgio/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= diff --git a/vendor/github.com/libp2p/go-msgio/limit.go b/vendor/github.com/libp2p/go-msgio/limit.go deleted file mode 100644 index bce33cff..00000000 --- a/vendor/github.com/libp2p/go-msgio/limit.go +++ /dev/null @@ -1,45 +0,0 @@ -package msgio - -import ( - "bytes" - "io" - "sync" -) - -// LimitedReader wraps an io.Reader with a msgio framed reader. The LimitedReader -// will return a reader which will io.EOF when the msg length is done. -func LimitedReader(r io.Reader) (io.Reader, error) { - l, err := ReadLen(r, nil) - return io.LimitReader(r, int64(l)), err -} - -// LimitedWriter wraps an io.Writer with a msgio framed writer. It is the inverse -// of LimitedReader: it will buffer all writes until "Flush" is called. When Flush -// is called, it will write the size of the buffer first, flush the buffer, reset -// the buffer, and begin accept more incoming writes. -func NewLimitedWriter(w io.Writer) *LimitedWriter { - return &LimitedWriter{W: w} -} - -type LimitedWriter struct { - W io.Writer - B bytes.Buffer - M sync.Mutex -} - -func (w *LimitedWriter) Write(buf []byte) (n int, err error) { - w.M.Lock() - n, err = w.B.Write(buf) - w.M.Unlock() - return n, err -} - -func (w *LimitedWriter) Flush() error { - w.M.Lock() - defer w.M.Unlock() - if err := WriteLen(w.W, w.B.Len()); err != nil { - return err - } - _, err := w.B.WriteTo(w.W) - return err -} diff --git a/vendor/github.com/libp2p/go-msgio/msgio.go b/vendor/github.com/libp2p/go-msgio/msgio.go deleted file mode 100644 index 5e61142c..00000000 --- a/vendor/github.com/libp2p/go-msgio/msgio.go +++ /dev/null @@ -1,305 +0,0 @@ -package msgio - -import ( - "errors" - "io" - "sync" - - pool "github.com/libp2p/go-buffer-pool" -) - -// ErrMsgTooLarge is returned when the message length is exessive -var ErrMsgTooLarge = errors.New("message too large") - -const ( - lengthSize = 4 - defaultMaxSize = 8 * 1024 * 1024 // 8mb -) - -// Writer is the msgio Writer interface. It writes len-framed messages. -type Writer interface { - - // Write writes passed in buffer as a single message. - Write([]byte) (int, error) - - // WriteMsg writes the msg in the passed in buffer. - WriteMsg([]byte) error -} - -// WriteCloser is a Writer + Closer interface. Like in `golang/pkg/io` -type WriteCloser interface { - Writer - io.Closer -} - -// Reader is the msgio Reader interface. It reads len-framed messages. -type Reader interface { - - // Read reads the next message from the Reader. - // The client must pass a buffer large enough, or io.ErrShortBuffer will be - // returned. - Read([]byte) (int, error) - - // ReadMsg reads the next message from the Reader. - // Uses a pool.BufferPool internally to reuse buffers. User may call - // ReleaseMsg(msg) to signal a buffer can be reused. - ReadMsg() ([]byte, error) - - // ReleaseMsg signals a buffer can be reused. - ReleaseMsg([]byte) - - // NextMsgLen returns the length of the next (peeked) message. Does - // not destroy the message or have other adverse effects - NextMsgLen() (int, error) -} - -// ReadCloser combines a Reader and Closer. -type ReadCloser interface { - Reader - io.Closer -} - -// ReadWriter combines a Reader and Writer. -type ReadWriter interface { - Reader - Writer -} - -// ReadWriteCloser combines a Reader, a Writer, and Closer. -type ReadWriteCloser interface { - Reader - Writer - io.Closer -} - -// writer is the underlying type that implements the Writer interface. -type writer struct { - W io.Writer - - pool *pool.BufferPool - lock sync.Mutex -} - -// NewWriter wraps an io.Writer with a msgio framed writer. The msgio.Writer -// will write the length prefix of every message written. -func NewWriter(w io.Writer) WriteCloser { - return NewWriterWithPool(w, pool.GlobalPool) -} - -// NewWriterWithPool is identical to NewWriter but allows the user to pass a -// custom buffer pool. -func NewWriterWithPool(w io.Writer, p *pool.BufferPool) WriteCloser { - return &writer{W: w, pool: p} -} - -func (s *writer) Write(msg []byte) (int, error) { - err := s.WriteMsg(msg) - if err != nil { - return 0, err - } - return len(msg), nil -} - -func (s *writer) WriteMsg(msg []byte) (err error) { - s.lock.Lock() - defer s.lock.Unlock() - - buf := s.pool.Get(len(msg) + lengthSize) - NBO.PutUint32(buf, uint32(len(msg))) - copy(buf[lengthSize:], msg) - _, err = s.W.Write(buf) - s.pool.Put(buf) - - return err -} - -func (s *writer) Close() error { - if c, ok := s.W.(io.Closer); ok { - return c.Close() - } - return nil -} - -// reader is the underlying type that implements the Reader interface. -type reader struct { - R io.Reader - - lbuf [lengthSize]byte - next int - pool *pool.BufferPool - lock sync.Mutex - max int // the maximal message size (in bytes) this reader handles -} - -// NewReader wraps an io.Reader with a msgio framed reader. The msgio.Reader -// will read whole messages at a time (using the length). Assumes an equivalent -// writer on the other side. -func NewReader(r io.Reader) ReadCloser { - return NewReaderWithPool(r, pool.GlobalPool) -} - -// NewReaderSize is equivalent to NewReader but allows one to -// specify a max message size. -func NewReaderSize(r io.Reader, maxMessageSize int) ReadCloser { - return NewReaderSizeWithPool(r, maxMessageSize, pool.GlobalPool) -} - -// NewReaderWithPool is the same as NewReader but allows one to specify a buffer -// pool. -func NewReaderWithPool(r io.Reader, p *pool.BufferPool) ReadCloser { - return NewReaderSizeWithPool(r, defaultMaxSize, p) -} - -// NewReaderWithPool is the same as NewReader but allows one to specify a buffer -// pool and a max message size. -func NewReaderSizeWithPool(r io.Reader, maxMessageSize int, p *pool.BufferPool) ReadCloser { - if p == nil { - panic("nil pool") - } - return &reader{ - R: r, - next: -1, - pool: p, - max: maxMessageSize, - } -} - -// NextMsgLen reads the length of the next msg into s.lbuf, and returns it. -// WARNING: like Read, NextMsgLen is destructive. It reads from the internal -// reader. -func (s *reader) NextMsgLen() (int, error) { - s.lock.Lock() - defer s.lock.Unlock() - return s.nextMsgLen() -} - -func (s *reader) nextMsgLen() (int, error) { - if s.next == -1 { - n, err := ReadLen(s.R, s.lbuf[:]) - if err != nil { - return 0, err - } - - s.next = n - } - return s.next, nil -} - -func (s *reader) Read(msg []byte) (int, error) { - s.lock.Lock() - defer s.lock.Unlock() - - length, err := s.nextMsgLen() - if err != nil { - return 0, err - } - - if length > len(msg) { - return 0, io.ErrShortBuffer - } - - read, err := io.ReadFull(s.R, msg[:length]) - if read < length { - s.next = length - read // we only partially consumed the message. - } else { - s.next = -1 // signal we've consumed this msg - } - return read, err -} - -func (s *reader) ReadMsg() ([]byte, error) { - s.lock.Lock() - defer s.lock.Unlock() - - length, err := s.nextMsgLen() - if err != nil { - return nil, err - } - - if length == 0 { - s.next = -1 - return nil, nil - } - - if length > s.max || length < 0 { - return nil, ErrMsgTooLarge - } - - msg := s.pool.Get(length) - read, err := io.ReadFull(s.R, msg) - if read < length { - s.next = length - read // we only partially consumed the message. - } else { - s.next = -1 // signal we've consumed this msg - } - return msg[:read], err -} - -func (s *reader) ReleaseMsg(msg []byte) { - s.pool.Put(msg) -} - -func (s *reader) Close() error { - if c, ok := s.R.(io.Closer); ok { - return c.Close() - } - return nil -} - -// readWriter is the underlying type that implements a ReadWriter. -type readWriter struct { - Reader - Writer -} - -// NewReadWriter wraps an io.ReadWriter with a msgio.ReadWriter. Writing -// and Reading will be appropriately framed. -func NewReadWriter(rw io.ReadWriter) ReadWriteCloser { - return &readWriter{ - Reader: NewReader(rw), - Writer: NewWriter(rw), - } -} - -// Combine wraps a pair of msgio.Writer and msgio.Reader with a msgio.ReadWriter. -func Combine(w Writer, r Reader) ReadWriteCloser { - return &readWriter{Reader: r, Writer: w} -} - -func (rw *readWriter) Close() error { - var errs []error - - if w, ok := rw.Writer.(WriteCloser); ok { - if err := w.Close(); err != nil { - errs = append(errs, err) - } - } - if r, ok := rw.Reader.(ReadCloser); ok { - if err := r.Close(); err != nil { - errs = append(errs, err) - } - } - - if len(errs) > 0 { - return multiErr(errs) - } - return nil -} - -// multiErr is a util to return multiple errors -type multiErr []error - -func (m multiErr) Error() string { - if len(m) == 0 { - return "no errors" - } - - s := "Multiple errors: " - for i, e := range m { - if i != 0 { - s += ", " - } - s += e.Error() - } - return s -} diff --git a/vendor/github.com/libp2p/go-msgio/num.go b/vendor/github.com/libp2p/go-msgio/num.go deleted file mode 100644 index 513c1994..00000000 --- a/vendor/github.com/libp2p/go-msgio/num.go +++ /dev/null @@ -1,33 +0,0 @@ -package msgio - -import ( - "encoding/binary" - "io" -) - -// NBO is NetworkByteOrder -var NBO = binary.BigEndian - -// WriteLen writes a length to the given writer. -func WriteLen(w io.Writer, l int) error { - ul := uint32(l) - return binary.Write(w, NBO, &ul) -} - -// ReadLen reads a length from the given reader. -// if buf is non-nil, it reuses the buffer. Ex: -// l, err := ReadLen(r, nil) -// _, err := ReadLen(r, buf) -func ReadLen(r io.Reader, buf []byte) (int, error) { - if len(buf) < 4 { - buf = make([]byte, 4) - } - buf = buf[:4] - - if _, err := io.ReadFull(r, buf); err != nil { - return 0, err - } - - n := int(NBO.Uint32(buf)) - return n, nil -} diff --git a/vendor/github.com/libp2p/go-msgio/varint.go b/vendor/github.com/libp2p/go-msgio/varint.go deleted file mode 100644 index 0872fc36..00000000 --- a/vendor/github.com/libp2p/go-msgio/varint.go +++ /dev/null @@ -1,188 +0,0 @@ -package msgio - -import ( - "encoding/binary" - "io" - "sync" - - pool "github.com/libp2p/go-buffer-pool" -) - -// varintWriter is the underlying type that implements the Writer interface. -type varintWriter struct { - W io.Writer - - pool *pool.BufferPool - lock sync.Mutex // for threadsafe writes -} - -// NewVarintWriter wraps an io.Writer with a varint msgio framed writer. -// The msgio.Writer will write the length prefix of every message written -// as a varint, using https://golang.org/pkg/encoding/binary/#PutUvarint -func NewVarintWriter(w io.Writer) WriteCloser { - return NewVarintWriterWithPool(w, pool.GlobalPool) -} - -func NewVarintWriterWithPool(w io.Writer, p *pool.BufferPool) WriteCloser { - return &varintWriter{ - pool: p, - W: w, - } -} - -func (s *varintWriter) Write(msg []byte) (int, error) { - err := s.WriteMsg(msg) - if err != nil { - return 0, err - } - return len(msg), nil -} - -func (s *varintWriter) WriteMsg(msg []byte) error { - s.lock.Lock() - defer s.lock.Unlock() - - buf := s.pool.Get(len(msg) + binary.MaxVarintLen64) - n := binary.PutUvarint(buf, uint64(len(msg))) - n += copy(buf[n:], msg) - _, err := s.W.Write(buf[:n]) - s.pool.Put(buf) - - return err -} - -func (s *varintWriter) Close() error { - if c, ok := s.W.(io.Closer); ok { - return c.Close() - } - return nil -} - -// varintReader is the underlying type that implements the Reader interface. -type varintReader struct { - R io.Reader - br io.ByteReader // for reading varints. - - next int - pool *pool.BufferPool - lock sync.Mutex - max int // the maximal message size (in bytes) this reader handles -} - -// NewVarintReader wraps an io.Reader with a varint msgio framed reader. -// The msgio.Reader will read whole messages at a time (using the length). -// Varints read according to https://golang.org/pkg/encoding/binary/#ReadUvarint -// Assumes an equivalent writer on the other side. -func NewVarintReader(r io.Reader) ReadCloser { - return NewVarintReaderSize(r, defaultMaxSize) -} - -// NewVarintReaderSize is equivalent to NewVarintReader but allows one to -// specify a max message size. -func NewVarintReaderSize(r io.Reader, maxMessageSize int) ReadCloser { - return NewVarintReaderSizeWithPool(r, maxMessageSize, pool.GlobalPool) -} - -// NewVarintReaderWithPool is the same as NewVarintReader but allows one to -// specify a buffer pool. -func NewVarintReaderWithPool(r io.Reader, p *pool.BufferPool) ReadCloser { - return NewVarintReaderSizeWithPool(r, defaultMaxSize, p) -} - -// NewVarintReaderWithPool is the same as NewVarintReader but allows one to -// specify a buffer pool and a max message size. -func NewVarintReaderSizeWithPool(r io.Reader, maxMessageSize int, p *pool.BufferPool) ReadCloser { - if p == nil { - panic("nil pool") - } - return &varintReader{ - R: r, - br: &simpleByteReader{R: r}, - next: -1, - pool: p, - max: maxMessageSize, - } -} - -// NextMsgLen reads the length of the next msg into s.lbuf, and returns it. -// WARNING: like Read, NextMsgLen is destructive. It reads from the internal -// reader. -func (s *varintReader) NextMsgLen() (int, error) { - s.lock.Lock() - defer s.lock.Unlock() - return s.nextMsgLen() -} - -func (s *varintReader) nextMsgLen() (int, error) { - if s.next == -1 { - length, err := binary.ReadUvarint(s.br) - if err != nil { - return 0, err - } - s.next = int(length) - } - return s.next, nil -} - -func (s *varintReader) Read(msg []byte) (int, error) { - s.lock.Lock() - defer s.lock.Unlock() - - length, err := s.nextMsgLen() - if err != nil { - return 0, err - } - - if length > len(msg) { - return 0, io.ErrShortBuffer - } - _, err = io.ReadFull(s.R, msg[:length]) - s.next = -1 // signal we've consumed this msg - return length, err -} - -func (s *varintReader) ReadMsg() ([]byte, error) { - s.lock.Lock() - defer s.lock.Unlock() - - length, err := s.nextMsgLen() - if err != nil { - return nil, err - } - if length == 0 { - s.next = -1 - return nil, nil - } - - if length > s.max { - return nil, ErrMsgTooLarge - } - - msg := s.pool.Get(length) - _, err = io.ReadFull(s.R, msg) - s.next = -1 // signal we've consumed this msg - return msg, err -} - -func (s *varintReader) ReleaseMsg(msg []byte) { - s.pool.Put(msg) -} - -func (s *varintReader) Close() error { - if c, ok := s.R.(io.Closer); ok { - return c.Close() - } - return nil -} - -type simpleByteReader struct { - R io.Reader - buf [1]byte -} - -func (r *simpleByteReader) ReadByte() (c byte, err error) { - if _, err := io.ReadFull(r.R, r.buf[:]); err != nil { - return 0, err - } - return r.buf[0], nil -} diff --git a/vendor/github.com/libp2p/go-nat/.travis.yml b/vendor/github.com/libp2p/go-nat/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-nat/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-nat/LICENSE b/vendor/github.com/libp2p/go-nat/LICENSE deleted file mode 100644 index 37ec93a1..00000000 --- a/vendor/github.com/libp2p/go-nat/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/libp2p/go-nat/README.md b/vendor/github.com/libp2p/go-nat/README.md deleted file mode 100644 index 61b5cc88..00000000 --- a/vendor/github.com/libp2p/go-nat/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# go-nat - -[![GoDoc](https://godoc.org/github.com/libp2p/go-nat?status.svg)](https://godoc.org/github.com/libp2p/go-nat) [![status](https://sourcegraph.com/api/repos/github.com/libp2p/go-nat/.badges/status.png)](https://sourcegraph.com/github.com/libp2p/go-nat) - -Forked from: [fd/go-nat](https://github.com/fd/go-nat). - ---- - -The last gx published version of this module was: 1.0.3: QmdwkZHamNNrj7k3G29rnurmW3mFzsDhnyXppNcgYsiBVz diff --git a/vendor/github.com/libp2p/go-nat/go.mod b/vendor/github.com/libp2p/go-nat/go.mod deleted file mode 100644 index 718fdbdf..00000000 --- a/vendor/github.com/libp2p/go-nat/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-nat - -require ( - github.com/huin/goupnp v1.0.0 - github.com/jackpal/gateway v1.0.5 - github.com/jackpal/go-nat-pmp v1.0.1 - github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b -) diff --git a/vendor/github.com/libp2p/go-nat/go.sum b/vendor/github.com/libp2p/go-nat/go.sum deleted file mode 100644 index 1a3a280e..00000000 --- a/vendor/github.com/libp2p/go-nat/go.sum +++ /dev/null @@ -1,13 +0,0 @@ -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b h1:wxtKgYHEncAU00muMD06dzLiahtGM1eouRNOzVV7tdQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 h1:Y/KGZSOdz/2r0WJ9Mkmz6NJBusp0kiNx1Cn82lzJQ6w= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/libp2p/go-nat/nat.go b/vendor/github.com/libp2p/go-nat/nat.go deleted file mode 100644 index 371fdb03..00000000 --- a/vendor/github.com/libp2p/go-nat/nat.go +++ /dev/null @@ -1,129 +0,0 @@ -// Package nat implements NAT handling facilities -package nat - -import ( - "context" - "errors" - "math" - "math/rand" - "net" - "time" - - "github.com/jackpal/gateway" -) - -var ErrNoExternalAddress = errors.New("no external address") -var ErrNoInternalAddress = errors.New("no internal address") -var ErrNoNATFound = errors.New("no NAT found") - -// protocol is either "udp" or "tcp" -type NAT interface { - // Type returns the kind of NAT port mapping service that is used - Type() string - - // GetDeviceAddress returns the internal address of the gateway device. - GetDeviceAddress() (addr net.IP, err error) - - // GetExternalAddress returns the external address of the gateway device. - GetExternalAddress() (addr net.IP, err error) - - // GetInternalAddress returns the address of the local host. - GetInternalAddress() (addr net.IP, err error) - - // AddPortMapping maps a port on the local host to an external port. - AddPortMapping(protocol string, internalPort int, description string, timeout time.Duration) (mappedExternalPort int, err error) - - // DeletePortMapping removes a port mapping. - DeletePortMapping(protocol string, internalPort int) (err error) -} - -// DiscoverNATs returns all NATs discovered in the network. -func DiscoverNATs(ctx context.Context) <-chan NAT { - nats := make(chan NAT) - - go func() { - defer close(nats) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - upnpIg1 := discoverUPNP_IG1(ctx) - upnpIg2 := discoverUPNP_IG2(ctx) - natpmp := discoverNATPMP(ctx) - upnpGenIGDev := discoverUPNP_GenIGDev(ctx) - for upnpIg1 != nil || upnpIg2 != nil || natpmp != nil || upnpGenIGDev != nil { - var ( - nat NAT - ok bool - ) - select { - case nat, ok = <-upnpIg1: - if !ok { - upnpIg1 = nil - } - case nat, ok = <-upnpIg2: - if !ok { - upnpIg2 = nil - } - case nat, ok = <-upnpGenIGDev: - if !ok { - upnpGenIGDev = nil - } - case nat, ok = <-natpmp: - if !ok { - natpmp = nil - } - } - if ok { - select { - case nats <- nat: - case <-ctx.Done(): - return - } - } - } - }() - return nats -} - -// DiscoverGateway attempts to find a gateway device. -func DiscoverGateway() (NAT, error) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - - var nats []NAT - for nat := range DiscoverNATs(ctx) { - nats = append(nats, nat) - } - switch len(nats) { - case 0: - return nil, ErrNoNATFound - case 1: - return nats[0], nil - } - gw, _ := gateway.DiscoverGateway() - bestNAT := nats[0] - natGw, _ := bestNAT.GetDeviceAddress() - bestNATIsGw := gw != nil && natGw.Equal(gw) - // 1. Prefer gateways discovered _last_. This is an OK heuristic for - // discovering the most-upstream (furthest) NAT. - // 2. Prefer gateways that actually match our known gateway address. - // Some relays like to claim to be NATs even if they aren't. - for _, nat := range nats[1:] { - natGw, _ := nat.GetDeviceAddress() - natIsGw := gw != nil && natGw.Equal(gw) - - if bestNATIsGw && !natIsGw { - continue - } - - bestNATIsGw = natIsGw - bestNAT = nat - } - return bestNAT, nil -} - -func randomPort() int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(math.MaxUint16-10000) + 10000 -} diff --git a/vendor/github.com/libp2p/go-nat/natpmp.go b/vendor/github.com/libp2p/go-nat/natpmp.go deleted file mode 100644 index a31a4999..00000000 --- a/vendor/github.com/libp2p/go-nat/natpmp.go +++ /dev/null @@ -1,133 +0,0 @@ -package nat - -import ( - "context" - "net" - "time" - - "github.com/jackpal/gateway" - "github.com/jackpal/go-nat-pmp" -) - -var ( - _ NAT = (*natpmpNAT)(nil) -) - -func discoverNATPMP(ctx context.Context) <-chan NAT { - res := make(chan NAT, 1) - - ip, err := gateway.DiscoverGateway() - if err == nil { - go func() { - defer close(res) - // Unfortunately, we can't actually _stop_ the natpmp - // library. However, we can at least close _our_ channel - // and walk away. - select { - case client, ok := <-discoverNATPMPWithAddr(ip): - if ok { - res <- &natpmpNAT{client, ip, make(map[int]int)} - } - case <-ctx.Done(): - } - }() - } else { - close(res) - } - return res -} - -func discoverNATPMPWithAddr(ip net.IP) <-chan *natpmp.Client { - res := make(chan *natpmp.Client, 1) - go func() { - defer close(res) - client := natpmp.NewClient(ip) - _, err := client.GetExternalAddress() - if err != nil { - return - } - res <- client - }() - return res -} - -type natpmpNAT struct { - c *natpmp.Client - gateway net.IP - ports map[int]int -} - -func (n *natpmpNAT) GetDeviceAddress() (addr net.IP, err error) { - return n.gateway, nil -} - -func (n *natpmpNAT) GetInternalAddress() (addr net.IP, err error) { - ifaces, err := net.Interfaces() - if err != nil { - return nil, err - } - - for _, iface := range ifaces { - addrs, err := iface.Addrs() - if err != nil { - return nil, err - } - - for _, addr := range addrs { - switch x := addr.(type) { - case *net.IPNet: - if x.Contains(n.gateway) { - return x.IP, nil - } - } - } - } - - return nil, ErrNoInternalAddress -} - -func (n *natpmpNAT) GetExternalAddress() (addr net.IP, err error) { - res, err := n.c.GetExternalAddress() - if err != nil { - return nil, err - } - - d := res.ExternalIPAddress - return net.IPv4(d[0], d[1], d[2], d[3]), nil -} - -func (n *natpmpNAT) AddPortMapping(protocol string, internalPort int, description string, timeout time.Duration) (int, error) { - var ( - err error - ) - - timeoutInSeconds := int(timeout / time.Second) - - if externalPort := n.ports[internalPort]; externalPort > 0 { - _, err = n.c.AddPortMapping(protocol, internalPort, externalPort, timeoutInSeconds) - if err == nil { - n.ports[internalPort] = externalPort - return externalPort, nil - } - } - - for i := 0; i < 3; i++ { - externalPort := randomPort() - _, err = n.c.AddPortMapping(protocol, internalPort, externalPort, timeoutInSeconds) - if err == nil { - n.ports[internalPort] = externalPort - return externalPort, nil - } - } - - return 0, err -} - -func (n *natpmpNAT) DeletePortMapping(protocol string, internalPort int) (err error) { - delete(n.ports, internalPort) - return nil -} - -func (n *natpmpNAT) Type() string { - return "NAT-PMP" -} diff --git a/vendor/github.com/libp2p/go-nat/upnp.go b/vendor/github.com/libp2p/go-nat/upnp.go deleted file mode 100644 index ccfeb14a..00000000 --- a/vendor/github.com/libp2p/go-nat/upnp.go +++ /dev/null @@ -1,327 +0,0 @@ -package nat - -import ( - "context" - "net" - "net/url" - "strings" - "time" - - "github.com/huin/goupnp" - "github.com/huin/goupnp/dcps/internetgateway1" - "github.com/huin/goupnp/dcps/internetgateway2" - - "github.com/koron/go-ssdp" -) - -var ( - _ NAT = (*upnp_NAT)(nil) -) - -func discoverUPNP_IG1(ctx context.Context) <-chan NAT { - res := make(chan NAT) - go func() { - defer close(res) - - // find devices - devs, err := goupnp.DiscoverDevices(internetgateway1.URN_WANConnectionDevice_1) - if err != nil { - return - } - - for _, dev := range devs { - if dev.Root == nil { - continue - } - - dev.Root.Device.VisitServices(func(srv *goupnp.Service) { - if ctx.Err() != nil { - return - } - switch srv.ServiceType { - case internetgateway1.URN_WANIPConnection_1: - client := &internetgateway1.WANIPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: dev.Root, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG1-IP1)", dev.Root}: - case <-ctx.Done(): - } - } - - case internetgateway1.URN_WANPPPConnection_1: - client := &internetgateway1.WANPPPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: dev.Root, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG1-PPP1)", dev.Root}: - case <-ctx.Done(): - } - } - - } - }) - } - - }() - return res -} - -func discoverUPNP_IG2(ctx context.Context) <-chan NAT { - res := make(chan NAT) - go func() { - defer close(res) - - // find devices - devs, err := goupnp.DiscoverDevices(internetgateway2.URN_WANConnectionDevice_2) - if err != nil { - return - } - - for _, dev := range devs { - if dev.Root == nil { - continue - } - - dev.Root.Device.VisitServices(func(srv *goupnp.Service) { - if ctx.Err() != nil { - return - } - switch srv.ServiceType { - case internetgateway2.URN_WANIPConnection_1: - client := &internetgateway2.WANIPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: dev.Root, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG2-IP1)", dev.Root}: - case <-ctx.Done(): - } - } - - case internetgateway2.URN_WANIPConnection_2: - client := &internetgateway2.WANIPConnection2{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: dev.Root, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG2-IP2)", dev.Root}: - case <-ctx.Done(): - } - } - - case internetgateway2.URN_WANPPPConnection_1: - client := &internetgateway2.WANPPPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: dev.Root, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG2-PPP1)", dev.Root}: - case <-ctx.Done(): - } - } - - } - }) - } - - }() - return res -} - -func discoverUPNP_GenIGDev(ctx context.Context) <-chan NAT { - res := make(chan NAT, 1) - go func() { - defer close(res) - - DeviceList, err := ssdp.Search(ssdp.All, 5, "") - if err != nil { - return - } - var gw ssdp.Service - for _, Service := range DeviceList { - if strings.Contains(Service.Type, "InternetGatewayDevice") { - gw = Service - break - } - } - - DeviceURL, err := url.Parse(gw.Location) - if err != nil { - return - } - RootDevice, err := goupnp.DeviceByURL(DeviceURL) - if err != nil { - return - } - - RootDevice.Device.VisitServices(func(srv *goupnp.Service) { - if ctx.Err() != nil { - return - } - switch srv.ServiceType { - case internetgateway1.URN_WANIPConnection_1: - client := &internetgateway1.WANIPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: RootDevice, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG1-IP1)", RootDevice}: - case <-ctx.Done(): - } - } - - case internetgateway1.URN_WANPPPConnection_1: - client := &internetgateway1.WANPPPConnection1{ServiceClient: goupnp.ServiceClient{ - SOAPClient: srv.NewSOAPClient(), - RootDevice: RootDevice, - Service: srv, - }} - _, isNat, err := client.GetNATRSIPStatus() - if err == nil && isNat { - select { - case res <- &upnp_NAT{client, make(map[int]int), "UPNP (IG1-PPP1)", RootDevice}: - case <-ctx.Done(): - } - } - - } - }) - }() - return res -} - -type upnp_NAT_Client interface { - GetExternalIPAddress() (string, error) - AddPortMapping(string, uint16, string, uint16, string, bool, string, uint32) error - DeletePortMapping(string, uint16, string) error -} - -type upnp_NAT struct { - c upnp_NAT_Client - ports map[int]int - typ string - rootDevice *goupnp.RootDevice -} - -func (u *upnp_NAT) GetExternalAddress() (addr net.IP, err error) { - ipString, err := u.c.GetExternalIPAddress() - if err != nil { - return nil, err - } - - ip := net.ParseIP(ipString) - if ip == nil { - return nil, ErrNoExternalAddress - } - - return ip, nil -} - -func mapProtocol(s string) string { - switch s { - case "udp": - return "UDP" - case "tcp": - return "TCP" - default: - panic("invalid protocol: " + s) - } -} - -func (u *upnp_NAT) AddPortMapping(protocol string, internalPort int, description string, timeout time.Duration) (int, error) { - ip, err := u.GetInternalAddress() - if err != nil { - return 0, nil - } - - timeoutInSeconds := uint32(timeout / time.Second) - - if externalPort := u.ports[internalPort]; externalPort > 0 { - err = u.c.AddPortMapping("", uint16(externalPort), mapProtocol(protocol), uint16(internalPort), ip.String(), true, description, timeoutInSeconds) - if err == nil { - return externalPort, nil - } - } - - for i := 0; i < 3; i++ { - externalPort := randomPort() - err = u.c.AddPortMapping("", uint16(externalPort), mapProtocol(protocol), uint16(internalPort), ip.String(), true, description, timeoutInSeconds) - if err == nil { - u.ports[internalPort] = externalPort - return externalPort, nil - } - } - - return 0, err -} - -func (u *upnp_NAT) DeletePortMapping(protocol string, internalPort int) error { - if externalPort := u.ports[internalPort]; externalPort > 0 { - delete(u.ports, internalPort) - return u.c.DeletePortMapping("", uint16(externalPort), mapProtocol(protocol)) - } - - return nil -} - -func (u *upnp_NAT) GetDeviceAddress() (net.IP, error) { - addr, err := net.ResolveUDPAddr("udp4", u.rootDevice.URLBase.Host) - if err != nil { - return nil, err - } - - return addr.IP, nil -} - -func (u *upnp_NAT) GetInternalAddress() (net.IP, error) { - devAddr, err := u.GetDeviceAddress() - if err != nil { - return nil, err - } - - ifaces, err := net.Interfaces() - if err != nil { - return nil, err - } - - for _, iface := range ifaces { - addrs, err := iface.Addrs() - if err != nil { - return nil, err - } - - for _, addr := range addrs { - switch x := addr.(type) { - case *net.IPNet: - if x.Contains(devAddr) { - return x.IP, nil - } - } - } - } - - return nil, ErrNoInternalAddress -} - -func (n *upnp_NAT) Type() string { return n.typ } diff --git a/vendor/github.com/libp2p/go-reuseport-transport/.travis.yml b/vendor/github.com/libp2p/go-reuseport-transport/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-reuseport-transport/LICENSE b/vendor/github.com/libp2p/go-reuseport-transport/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-reuseport-transport/Makefile b/vendor/github.com/libp2p/go-reuseport-transport/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/libp2p/go-reuseport-transport/README.md b/vendor/github.com/libp2p/go-reuseport-transport/README.md deleted file mode 100644 index ff707568..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# go-reuseport-transport - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) -[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/libp2p/go-reuseport-transport?status.svg)](https://godoc.org/github.com/libp2p/go-reuseport-transport) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-reuseport-transport/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-reuseport-transport?branch=master) -[![Build Status](https://travis-ci.org/libp2p/go-reuseport-transport.svg?branch=master)](https://travis-ci.org/libp2p/go-reuseport-transport) - -> Basic reuseport TCP transport - -This package provides a basic transport for automatically (and intelligently) reusing TCP ports. - -To use, construct a new `Transport` (the zero value is safe to use) and configure any listeners (`tr.Listen(...)`). - -Then, when dialing (`tr.Dial(...)`), the transport will attempt to reuse the ports it's currently listening on, choosing the best one depending on the destination address. - - -NOTE: Currently, we don't make any attempts to prevent two reusport transports from interfering with each other (reusing each other's ports). However, we reserve the right to fix this in the future. - -## Install - -`go-reuseport-transport` is a standard Go module which can be installed with: - -```sh -go get github.com/libp2p/go-reuseport-transport -``` - -Note that `go-reuseport-transport` is packaged with Gx, so it is recommended to use Gx to install and use it (see the Usage section). - -## Usage - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project it is recommended that you: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/libp2p/go-reuseport-transport -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -This package is *currently* used by the [go-tcp-transport](https://github.com/libp2p/go-tcp-transport) libp2p transport and will likely be used by more libp2p transports in the future. - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-reuseport-transport/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/libp2p/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT diff --git a/vendor/github.com/libp2p/go-reuseport-transport/codecov.yml b/vendor/github.com/libp2p/go-reuseport-transport/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-reuseport-transport/dial.go b/vendor/github.com/libp2p/go-reuseport-transport/dial.go deleted file mode 100644 index a16b5b2b..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/dial.go +++ /dev/null @@ -1,113 +0,0 @@ -package tcpreuse - -import ( - "context" - "net" - - reuseport "github.com/libp2p/go-reuseport" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -type dialer interface { - Dial(network, addr string) (net.Conn, error) - DialContext(ctx context.Context, network, addr string) (net.Conn, error) -} - -// Dial dials the given multiaddr, reusing ports we're currently listening on if -// possible. -// -// Dial attempts to be smart about choosing the source port. For example, If -// we're dialing a loopback address and we're listening on one or more loopback -// ports, Dial will randomly choose one of the loopback ports and addresses and -// reuse it. -func (t *Transport) Dial(raddr ma.Multiaddr) (manet.Conn, error) { - return t.DialContext(context.Background(), raddr) -} - -// DialContext is like Dial but takes a context. -func (t *Transport) DialContext(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error) { - network, addr, err := manet.DialArgs(raddr) - if err != nil { - return nil, err - } - var d dialer - switch network { - case "tcp4": - d = t.v4.getDialer(network) - case "tcp6": - d = t.v6.getDialer(network) - default: - return nil, ErrWrongProto - } - conn, err := d.DialContext(ctx, network, addr) - if err != nil { - return nil, err - } - maconn, err := manet.WrapNetConn(conn) - if err != nil { - conn.Close() - return nil, err - } - return maconn, nil -} - -func (n *network) getDialer(network string) dialer { - n.mu.RLock() - d := n.dialer - n.mu.RUnlock() - if d == nil { - n.mu.Lock() - defer n.mu.Unlock() - - if n.dialer == nil { - n.dialer = n.makeDialer(network) - } - d = n.dialer - } - return d -} - -func (n *network) makeDialer(network string) dialer { - if !reuseport.Available() { - log.Debug("reuseport not available") - return &net.Dialer{} - } - - var unspec net.IP - switch network { - case "tcp4": - unspec = net.IPv4zero - case "tcp6": - unspec = net.IPv6unspecified - default: - panic("invalid network: must be either tcp4 or tcp6") - } - - // How many ports are we listening on. - var port = 0 - for l := range n.listeners { - newPort := l.Addr().(*net.TCPAddr).Port - switch { - case newPort == 0: // Any port, ignore (really, we shouldn't get this case...). - case port == 0: // Haven't selected a port yet, choose this one. - port = newPort - case newPort == port: // Same as the selected port, continue... - default: // Multiple ports, use the multi dialer - return newMultiDialer(unspec, n.listeners) - } - } - - // None. - if port == 0 { - return &net.Dialer{} - } - - // One. Always dial from the single port we're listening on. - laddr := &net.TCPAddr{ - IP: unspec, - Port: port, - } - - return (*singleDialer)(laddr) -} diff --git a/vendor/github.com/libp2p/go-reuseport-transport/go.mod b/vendor/github.com/libp2p/go-reuseport-transport/go.mod deleted file mode 100644 index 190ba681..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-reuseport-transport - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-reuseport v0.0.1 - github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-net v0.0.1 -) diff --git a/vendor/github.com/libp2p/go-reuseport-transport/go.sum b/vendor/github.com/libp2p/go-reuseport-transport/go.sum deleted file mode 100644 index a7abc2e2..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/go.sum +++ /dev/null @@ -1,52 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/libp2p/go-reuseport-transport/listen.go b/vendor/github.com/libp2p/go-reuseport-transport/listen.go deleted file mode 100644 index 7b2a4c39..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/listen.go +++ /dev/null @@ -1,80 +0,0 @@ -package tcpreuse - -import ( - "net" - - reuseport "github.com/libp2p/go-reuseport" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -type listener struct { - manet.Listener - network *network -} - -func (l *listener) Close() error { - l.network.mu.Lock() - delete(l.network.listeners, l) - l.network.dialer = nil - l.network.mu.Unlock() - return l.Listener.Close() -} - -// Listen listens on the given multiaddr. -// -// If reuseport is supported, it will be enabled for this listener and future -// dials from this transport may reuse the port. -// -// Note: You can listen on the same multiaddr as many times as you want -// (although only *one* listener will end up handling the inbound connection). -func (t *Transport) Listen(laddr ma.Multiaddr) (manet.Listener, error) { - nw, naddr, err := manet.DialArgs(laddr) - if err != nil { - return nil, err - } - var n *network - switch nw { - case "tcp4": - n = &t.v4 - case "tcp6": - n = &t.v6 - default: - return nil, ErrWrongProto - } - - if !reuseport.Available() { - return manet.Listen(laddr) - } - nl, err := reuseport.Listen(nw, naddr) - if err != nil { - return manet.Listen(laddr) - } - - if _, ok := nl.Addr().(*net.TCPAddr); !ok { - nl.Close() - return nil, ErrWrongProto - } - - malist, err := manet.WrapNetListener(nl) - if err != nil { - nl.Close() - return nil, err - } - - list := &listener{ - Listener: malist, - network: n, - } - - n.mu.Lock() - defer n.mu.Unlock() - - if n.listeners == nil { - n.listeners = make(map[*listener]struct{}) - } - n.listeners[list] = struct{}{} - n.dialer = nil - - return list, nil -} diff --git a/vendor/github.com/libp2p/go-reuseport-transport/multidialer.go b/vendor/github.com/libp2p/go-reuseport-transport/multidialer.go deleted file mode 100644 index c7d388c1..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/multidialer.go +++ /dev/null @@ -1,110 +0,0 @@ -package tcpreuse - -import ( - "context" - "fmt" - "math/rand" - "net" -) - -type multiDialer struct { - loopback []*net.TCPAddr - unspecified []*net.TCPAddr - global *net.TCPAddr -} - -func (d *multiDialer) Dial(network, addr string) (net.Conn, error) { - return d.DialContext(context.Background(), network, addr) -} - -func randAddr(addrs []*net.TCPAddr) *net.TCPAddr { - if len(addrs) > 0 { - return addrs[rand.Intn(len(addrs))] - } - return nil -} - -func (d *multiDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { - tcpAddr, err := net.ResolveTCPAddr(network, addr) - if err != nil { - return nil, err - } - - // We pick the source *port* based on the following algorithm. - // - // 1. If we're dialing loopback, choose a source-port in order of - // preference: - // 1. A port in-use by an explicit loopback listener. - // 2. A port in-use by a listener on an unspecified address (must - // also be listening on localhost). - // 3. A port in-use by a listener on a global address. We don't have - // any other better options (other than picking a random port). - // 2. If we're dialing a global address, choose a source-port in order - // of preference: - // 1. A port in-use by a listener on an unspecified address (the most - // general case). - // 2. A port in-use by a listener on the global address. - // 3. Fail on link-local dials (go-ipfs currently forbids this and I - // figured we could try lifting this restriction later). - // - // - // Note: We *always* dial from the unspecified address (regardless of - // the port we pick). In the future, we could use netlink (on Linux) to - // figure out the right source address but we're going to punt on that. - - ip := tcpAddr.IP - source := d.global - switch { - case ip.IsLoopback(): - switch { - case len(d.loopback) > 0: - source = randAddr(d.loopback) - case len(d.unspecified) > 0: - source = randAddr(d.unspecified) - } - case ip.IsGlobalUnicast(): - switch { - case len(d.unspecified) > 0: - source = randAddr(d.unspecified) - } - default: - return nil, fmt.Errorf("undialable IP: %s", tcpAddr.IP) - } - return reuseDial(ctx, source, network, addr) -} - -func newMultiDialer(unspec net.IP, listeners map[*listener]struct{}) dialer { - m := new(multiDialer) - for l := range listeners { - laddr := l.Addr().(*net.TCPAddr) - switch { - case laddr.IP.IsLoopback(): - m.loopback = append(m.loopback, laddr) - case laddr.IP.IsGlobalUnicast(): - // Different global ports? Crap. - // - // The *proper* way to deal with this is to, e.g., use - // netlink to figure out which source address we would - // normally use to dial a destination address and then - // pick one of the ports we're listening on on that - // source address. However, this is a pain in the ass. - // - // Instead, we're just going to always dial from the - // unspecified address with the first global port we - // find. - // - // TODO: Port priority? Addr priority? - if m.global == nil { - m.global = &net.TCPAddr{ - IP: unspec, - Port: laddr.Port, - } - } else { - log.Warning("listening on external interfaces on multiple ports, will dial from %d, not %s", m.global, laddr) - } - case laddr.IP.IsUnspecified(): - m.unspecified = append(m.unspecified, laddr) - } - } - return m -} diff --git a/vendor/github.com/libp2p/go-reuseport-transport/package.json b/vendor/github.com/libp2p/go-reuseport-transport/package.json deleted file mode 100644 index a0b9189d..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "author": "stebalien", - "bugs": { - "url": "https://github.com/libp2p/go-reuseport-transport" - }, - "gx": { - "dvcsimport": "github.com/libp2p/go-reuseport-transport" - }, - "gxDependencies": [ - { - "hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF", - "name": "go-log", - "version": "1.5.9" - }, - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - }, - { - "author": "multiformats", - "hash": "Qmc85NSvmSG4Frn9Vb2cBc1rMyULH6D3TNVEfCzSKoUpip", - "name": "go-multiaddr-net", - "version": "1.7.2" - }, - { - "author": "whyrusleeping", - "hash": "Qme8kdM7thoCqLqd7GYCRqipoZJS64rhJo5MBcTpyWfsL9", - "name": "go-reuseport", - "version": "0.2.2" - } - ], - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "go-reuseport-transport", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.2.3" -} - diff --git a/vendor/github.com/libp2p/go-reuseport-transport/reuseport.go b/vendor/github.com/libp2p/go-reuseport-transport/reuseport.go deleted file mode 100644 index 82f9f37c..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/reuseport.go +++ /dev/null @@ -1,64 +0,0 @@ -package tcpreuse - -import ( - "context" - "net" - "syscall" - - reuseport "github.com/libp2p/go-reuseport" -) - -var fallbackDialer net.Dialer - -// reuseErrShouldRetry diagnoses whether to retry after a reuse error. -// if we failed to bind, we should retry. if bind worked and this is a -// real dial error (remote end didnt answer) then we should not retry. -func reuseErrShouldRetry(err error) bool { - if err == nil { - return false // hey, it worked! no need to retry. - } - - // if it's a network timeout error, it's a legitimate failure. - if nerr, ok := err.(net.Error); ok && nerr.Timeout() { - return false - } - - errno, ok := err.(syscall.Errno) - if !ok { // not an errno? who knows what this is. retry. - return true - } - - switch errno { - case syscall.EADDRINUSE, syscall.EADDRNOTAVAIL: - return true // failure to bind. retry. - case syscall.ECONNREFUSED: - return false // real dial error - default: - return true // optimistically default to retry. - } -} - -// Dials using reuseport and then redials normally if that fails. -func reuseDial(ctx context.Context, laddr *net.TCPAddr, network, raddr string) (con net.Conn, err error) { - if laddr == nil { - return fallbackDialer.DialContext(ctx, network, raddr) - } - - d := net.Dialer{ - LocalAddr: laddr, - Control: reuseport.Control, - } - - con, err = d.DialContext(ctx, network, raddr) - if err == nil { - return con, nil - } - - if reuseErrShouldRetry(err) && ctx.Err() == nil { - // We could have an existing socket open or we could have one - // stuck in TIME-WAIT. - log.Debugf("failed to reuse port, dialing with a random port: %s", err) - con, err = fallbackDialer.DialContext(ctx, network, raddr) - } - return con, err -} diff --git a/vendor/github.com/libp2p/go-reuseport-transport/singledialer.go b/vendor/github.com/libp2p/go-reuseport-transport/singledialer.go deleted file mode 100644 index efb96eb1..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/singledialer.go +++ /dev/null @@ -1,16 +0,0 @@ -package tcpreuse - -import ( - "context" - "net" -) - -type singleDialer net.TCPAddr - -func (d *singleDialer) Dial(network, address string) (net.Conn, error) { - return d.DialContext(context.Background(), network, address) -} - -func (d *singleDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { - return reuseDial(ctx, (*net.TCPAddr)(d), network, address) -} diff --git a/vendor/github.com/libp2p/go-reuseport-transport/transport.go b/vendor/github.com/libp2p/go-reuseport-transport/transport.go deleted file mode 100644 index 5f094d1a..00000000 --- a/vendor/github.com/libp2p/go-reuseport-transport/transport.go +++ /dev/null @@ -1,25 +0,0 @@ -package tcpreuse - -import ( - "errors" - "sync" - - logging "github.com/ipfs/go-log" -) - -var log = logging.Logger("reuseport-transport") - -// ErrWrongProto is returned when dialing a protocol other than tcp. -var ErrWrongProto = errors.New("can only dial TCP over IPv4 or IPv6") - -// Transport is a TCP reuse transport that reuses listener ports. -type Transport struct { - v4 network - v6 network -} - -type network struct { - mu sync.RWMutex - listeners map[*listener]struct{} - dialer dialer -} diff --git a/vendor/github.com/libp2p/go-reuseport/.travis.yml b/vendor/github.com/libp2p/go-reuseport/.travis.yml deleted file mode 100644 index 4cfe98c2..00000000 --- a/vendor/github.com/libp2p/go-reuseport/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-reuseport/LICENSE b/vendor/github.com/libp2p/go-reuseport/LICENSE deleted file mode 100644 index 0d760cbb..00000000 --- a/vendor/github.com/libp2p/go-reuseport/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2013 Conformal Systems LLC. - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-reuseport/Makefile b/vendor/github.com/libp2p/go-reuseport/Makefile deleted file mode 100644 index 601c56d0..00000000 --- a/vendor/github.com/libp2p/go-reuseport/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - - -SUPPORTED_OS = windows linux darwin freebsd openbsd netbsd -SUPPORTED_ARCH = 386 arm amd64p32 arm64 amd64 -XBUILD_TARGETS=$(foreach os,$(SUPPORTED_OS),$(foreach arch,$(SUPPORTED_ARCH),test-xbuild-$(os)/$(arch))) - -$(XBUILD_TARGETS): PLATFORM = $(subst /, ,$(patsubst test-xbuild-%,%,$@)) -$(XBUILD_TARGETS): GOOS = $(word 1,$(PLATFORM)) -$(XBUILD_TARGETS): GOARCH = $(word 2,$(PLATFORM)) -$(XBUILD_TARGETS): - @ if GOOS=$(GOOS) GOARCH=$(GOARCH) go version >/dev/null 2>&1 ; then \ - echo "building $(GOOS)/$(GOARCH)"; \ - GOOS=$(GOOS) GOARCH=$(GOARCH) go build; \ - fi - -test-xbuild: $(XBUILD_TARGETS) diff --git a/vendor/github.com/libp2p/go-reuseport/README.md b/vendor/github.com/libp2p/go-reuseport/README.md deleted file mode 100644 index 4a4605ba..00000000 --- a/vendor/github.com/libp2p/go-reuseport/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# go-reuseport - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-blue.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23libp2p) -[![codecov](https://codecov.io/gh/libp2p/go-reuseport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-reuseport) -[![Travis CI](https://travis-ci.org/libp2p/go-reuseport.svg?branch=master)](https://travis-ci.org/libp2p/go-reuseport) - -**NOTE:** This package REQUIRES go >= 1.11. - -This package enables listening and dialing from _the same_ TCP or UDP port. -This means that the following sockopts may be set: - -``` -SO_REUSEADDR -SO_REUSEPORT -``` - -- godoc: https://godoc.org/github.com/libp2p/go-reuseport - -This is a simple package to help with address reuse. This is particularly -important when attempting to do TCP NAT holepunching, which requires a process -to both Listen and Dial on the same TCP port. This package provides some -utilities around enabling this behaviour on various OS. - -## Examples - - -```Go -// listen on the same port. oh yeah. -l1, _ := reuse.Listen("tcp", "127.0.0.1:1234") -l2, _ := reuse.Listen("tcp", "127.0.0.1:1234") -``` - -```Go -// dial from the same port. oh yeah. -l1, _ := reuse.Listen("tcp", "127.0.0.1:1234") -l2, _ := reuse.Listen("tcp", "127.0.0.1:1235") -c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235") -``` - -**Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections, and doing so would clash.** - -## Tested - -Tested on `darwin`, `linux`, and `windows`. diff --git a/vendor/github.com/libp2p/go-reuseport/addr.go b/vendor/github.com/libp2p/go-reuseport/addr.go deleted file mode 100644 index cfffc7c8..00000000 --- a/vendor/github.com/libp2p/go-reuseport/addr.go +++ /dev/null @@ -1,20 +0,0 @@ -package reuseport - -import ( - "net" -) - -func ResolveAddr(network, address string) (net.Addr, error) { - switch network { - default: - return nil, net.UnknownNetworkError(network) - case "ip", "ip4", "ip6": - return net.ResolveIPAddr(network, address) - case "tcp", "tcp4", "tcp6": - return net.ResolveTCPAddr(network, address) - case "udp", "udp4", "udp6": - return net.ResolveUDPAddr(network, address) - case "unix", "unixgram", "unixpacket": - return net.ResolveUnixAddr(network, address) - } -} diff --git a/vendor/github.com/libp2p/go-reuseport/codecov.yml b/vendor/github.com/libp2p/go-reuseport/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-reuseport/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-reuseport/control_unix.go b/vendor/github.com/libp2p/go-reuseport/control_unix.go deleted file mode 100644 index e75242a8..00000000 --- a/vendor/github.com/libp2p/go-reuseport/control_unix.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build !windows,!wasm - -package reuseport - -import ( - "syscall" - - "golang.org/x/sys/unix" -) - -func Control(network, address string, c syscall.RawConn) error { - var err error - c.Control(func(fd uintptr) { - err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1) - if err != nil { - return - } - - err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) - if err != nil { - return - } - }) - return err -} diff --git a/vendor/github.com/libp2p/go-reuseport/control_wasm.go b/vendor/github.com/libp2p/go-reuseport/control_wasm.go deleted file mode 100644 index d5d0a523..00000000 --- a/vendor/github.com/libp2p/go-reuseport/control_wasm.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build wasm - -package reuseport - -import ( - "syscall" -) - -func Control(network, address string, c syscall.RawConn) error { - return nil -} diff --git a/vendor/github.com/libp2p/go-reuseport/control_windows.go b/vendor/github.com/libp2p/go-reuseport/control_windows.go deleted file mode 100644 index 840534c9..00000000 --- a/vendor/github.com/libp2p/go-reuseport/control_windows.go +++ /dev/null @@ -1,13 +0,0 @@ -package reuseport - -import ( - "syscall" - - "golang.org/x/sys/windows" -) - -func Control(network, address string, c syscall.RawConn) (err error) { - return c.Control(func(fd uintptr) { - err = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1) - }) -} diff --git a/vendor/github.com/libp2p/go-reuseport/go.mod b/vendor/github.com/libp2p/go-reuseport/go.mod deleted file mode 100644 index f8053c7d..00000000 --- a/vendor/github.com/libp2p/go-reuseport/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/libp2p/go-reuseport - -require ( - github.com/pkg/errors v0.8.1 - github.com/stretchr/testify v1.3.0 - golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e -) diff --git a/vendor/github.com/libp2p/go-reuseport/go.sum b/vendor/github.com/libp2p/go-reuseport/go.sum deleted file mode 100644 index af928c2c..00000000 --- a/vendor/github.com/libp2p/go-reuseport/go.sum +++ /dev/null @@ -1,11 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/libp2p/go-reuseport/interface.go b/vendor/github.com/libp2p/go-reuseport/interface.go deleted file mode 100644 index 64b48af8..00000000 --- a/vendor/github.com/libp2p/go-reuseport/interface.go +++ /dev/null @@ -1,64 +0,0 @@ -// Package reuseport provides Listen and Dial functions that set socket -// options in order to be able to reuse ports. You should only use this -// package if you know what SO_REUSEADDR and SO_REUSEPORT are. -// -// For example: -// -// // listen on the same port. oh yeah. -// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234") -// l2, _ := reuse.Listen("tcp", "127.0.0.1:1234") -// -// // dial from the same port. oh yeah. -// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234") -// l2, _ := reuse.Listen("tcp", "127.0.0.1:1235") -// c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235") -// -// Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections, -// and doing so would clash. -package reuseport - -import ( - "context" - "net" - - "github.com/pkg/errors" -) - -// Available returns whether or not SO_REUSEPORT or equivalent behaviour is -// available in the OS. -func Available() bool { - return true -} - -var listenConfig = net.ListenConfig{ - Control: Control, -} - -// Listen listens at the given network and address. see net.Listen -// Returns a net.Listener created from a file discriptor for a socket -// with SO_REUSEPORT and SO_REUSEADDR option set. -func Listen(network, address string) (net.Listener, error) { - return listenConfig.Listen(context.Background(), network, address) -} - -// ListenPacket listens at the given network and address. see net.ListenPacket -// Returns a net.Listener created from a file discriptor for a socket -// with SO_REUSEPORT and SO_REUSEADDR option set. -func ListenPacket(network, address string) (net.PacketConn, error) { - return listenConfig.ListenPacket(context.Background(), network, address) -} - -// Dial dials the given network and address. see net.Dialer.Dial -// Returns a net.Conn created from a file descriptor for a socket -// with SO_REUSEPORT and SO_REUSEADDR option set. -func Dial(network, laddr, raddr string) (net.Conn, error) { - nla, err := ResolveAddr(network, laddr) - if err != nil { - return nil, errors.Wrap(err, "resolving local addr") - } - d := net.Dialer{ - Control: Control, - LocalAddr: nla, - } - return d.Dial(network, raddr) -} diff --git a/vendor/github.com/libp2p/go-reuseport/package.json b/vendor/github.com/libp2p/go-reuseport/package.json deleted file mode 100644 index 391d13f0..00000000 --- a/vendor/github.com/libp2p/go-reuseport/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/libp2p/go-reuseport" - }, - "gx": { - "dvcsimport": "github.com/libp2p/go-reuseport" - }, - "gxDependencies": [ - { - "author": "The Go Authors", - "hash": "QmVGjyM9i2msKvLXwh9VosCTgP4mL91kC7hDmqnwTTx6Hu", - "name": "sys", - "version": "0.2.0" - }, - { - "author": "whyrusleeping", - "hash": "QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy", - "name": "errors", - "version": "0.0.1" - }, - { - "author": "magik6k", - "hash": "QmPVkJMTeRC6iBByPWdrRkD3BE5UXsj5HPzb4kPqL186mS", - "name": "testify", - "version": "1.0.0" - } - ], - "gxVersion": "0.9.0", - "language": "go", - "license": "", - "name": "go-reuseport", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.2.2" -} - diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/.gitignore b/vendor/github.com/libp2p/go-stream-muxer-multistream/.gitignore deleted file mode 100644 index 1377554e..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/.travis.yml b/vendor/github.com/libp2p/go-stream-muxer-multistream/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/LICENSE b/vendor/github.com/libp2p/go-stream-muxer-multistream/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/Makefile b/vendor/github.com/libp2p/go-stream-muxer-multistream/Makefile deleted file mode 100644 index 3907e857..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -build: deps - go build ./... - -test: deps - go test ./... - -test_race: deps - go test -race ./... - -gx-bins: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx-bins - gx --verbose install --global - gx-go rewrite - -clean: gx-bins - gx-go rewrite --undo diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/README.md b/vendor/github.com/libp2p/go-stream-muxer-multistream/README.md deleted file mode 100644 index 68bc2da6..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# go-smux-multistream - a go-stream-muxer shim for multistream - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) ![](https://raw.githubusercontent.com/libp2p/go-stream-muxer/master/img/badge.png) - -This is an implementation of the [go-stream-muxer](https://github.com/libp2p/go-stream-muxer) interface for [multistream](https://github.com/whyrusleeping/go-multistream). For more information, see that repo. - -## Installation - -```sh -go get -d github.com/libp2p/go-stream-muxer-multistream -cd $GOPATH/src/github.com/libp2p/go-stream-muxer-multistream -make deps -``` diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/go.mod b/vendor/github.com/libp2p/go-stream-muxer-multistream/go.mod deleted file mode 100644 index bce71707..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/libp2p/go-stream-muxer-multistream - -go 1.12 - -require ( - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/multiformats/go-multistream v0.1.0 -) diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/go.sum b/vendor/github.com/libp2p/go-stream-muxer-multistream/go.sum deleted file mode 100644 index 3c9d3258..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/go.sum +++ /dev/null @@ -1,55 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-stream-muxer-multistream/multistream.go b/vendor/github.com/libp2p/go-stream-muxer-multistream/multistream.go deleted file mode 100644 index c7b58879..00000000 --- a/vendor/github.com/libp2p/go-stream-muxer-multistream/multistream.go +++ /dev/null @@ -1,75 +0,0 @@ -// package multistream implements a peerstream transport using -// go-multistream to select the underlying stream muxer -package multistream - -import ( - "fmt" - "net" - "time" - - "github.com/libp2p/go-libp2p-core/mux" - - mss "github.com/multiformats/go-multistream" -) - -var DefaultNegotiateTimeout = time.Second * 60 - -type Transport struct { - mux *mss.MultistreamMuxer - - tpts map[string]mux.Multiplexer - - NegotiateTimeout time.Duration - - OrderPreference []string -} - -func NewBlankTransport() *Transport { - return &Transport{ - mux: mss.NewMultistreamMuxer(), - tpts: make(map[string]mux.Multiplexer), - NegotiateTimeout: DefaultNegotiateTimeout, - } -} - -func (t *Transport) AddTransport(path string, tpt mux.Multiplexer) { - t.mux.AddHandler(path, nil) - t.tpts[path] = tpt - t.OrderPreference = append(t.OrderPreference, path) -} - -func (t *Transport) NewConn(nc net.Conn, isServer bool) (mux.MuxedConn, error) { - if t.NegotiateTimeout != 0 { - if err := nc.SetDeadline(time.Now().Add(t.NegotiateTimeout)); err != nil { - return nil, err - } - } - - var proto string - if isServer { - selected, _, err := t.mux.Negotiate(nc) - if err != nil { - return nil, err - } - proto = selected - } else { - selected, err := mss.SelectOneOf(t.OrderPreference, nc) - if err != nil { - return nil, err - } - proto = selected - } - - if t.NegotiateTimeout != 0 { - if err := nc.SetDeadline(time.Time{}); err != nil { - return nil, err - } - } - - tpt, ok := t.tpts[proto] - if !ok { - return nil, fmt.Errorf("selected protocol we don't have a transport for") - } - - return tpt.NewConn(nc, isServer) -} diff --git a/vendor/github.com/libp2p/go-tcp-transport/.travis.yml b/vendor/github.com/libp2p/go-tcp-transport/.travis.yml deleted file mode 100644 index cc4a155f..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - - TEST_STRESS_TIMEOUT_MS=180000 - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-tcp-transport/LICENSE b/vendor/github.com/libp2p/go-tcp-transport/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/libp2p/go-tcp-transport/README.md b/vendor/github.com/libp2p/go-tcp-transport/README.md deleted file mode 100644 index ce8ad967..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/README.md +++ /dev/null @@ -1,40 +0,0 @@ -go-tcp-transport -================== - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-tcp-transport/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-tcp-transport?branch=master) -[![Travis CI](https://travis-ci.com/libp2p/go-tcp-transport.svg?branch=master)](https://travis-ci.com/libp2p/go-tcp-transport) - -> A libp2p transport implementation for tcp, including reuseport socket options. - - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [API](#api) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -make install -``` - -## Contribute - -PRs are welcome! - -Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -MIT © Jeromy Johnson - ---- - -The last gx published version of this module was: 2.0.28: QmTGiDkw4eeKq31wwpQRk5GwWiReaxrcTQLuCCLWgfKo5M diff --git a/vendor/github.com/libp2p/go-tcp-transport/codecov.yml b/vendor/github.com/libp2p/go-tcp-transport/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-tcp-transport/go.mod b/vendor/github.com/libp2p/go-tcp-transport/go.mod deleted file mode 100644 index acfb03f4..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/libp2p/go-tcp-transport - -require ( - github.com/ipfs/go-log v0.0.1 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-mplex v0.2.1 - github.com/libp2p/go-libp2p-testing v0.0.3 - github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 - github.com/libp2p/go-reuseport v0.0.1 - github.com/libp2p/go-reuseport-transport v0.0.2 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-fmt v0.0.1 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/multiformats/go-multihash v0.0.5 // indirect -) diff --git a/vendor/github.com/libp2p/go-tcp-transport/go.sum b/vendor/github.com/libp2p/go-tcp-transport/go.sum deleted file mode 100644 index b81940b2..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/go.sum +++ /dev/null @@ -1,158 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/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/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -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/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-mplex v0.2.0 h1:vnR+/fUnL5d2kTB1Lfce1KVSP+bCCy2aJIvqvb9cFqE= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1 h1:E1xaJBQnbSiTHGI1gaBKmKhu1TUKkErKJnE8iGvirYI= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0 h1:/nBTy5+1yRyY82YaO6HXQRnO5IAGsXTjEJaR3LdTPc0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-reuseport v0.0.1 h1:7PhkfH73VXfPJYKQ6JwS5I/eVcoyYi9IMNGc6FWpFLw= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2 h1:WglMwyXyBu61CMkjCCtnmqNqnjib0GIEjMiHTwR/KN4= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-fmt v0.0.1 h1:5YjeOIzbX8OTKVaN72aOzGIYW7PnrZrnkDyOfAWRSMA= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-tcp-transport/reuseport.go b/vendor/github.com/libp2p/go-tcp-transport/reuseport.go deleted file mode 100644 index e3b7e125..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/reuseport.go +++ /dev/null @@ -1,44 +0,0 @@ -package tcp - -import ( - "os" - "strings" - - "github.com/libp2p/go-reuseport" -) - -// envReuseport is the env variable name used to turn off reuse port. -// It default to true. -const envReuseport = "LIBP2P_TCP_REUSEPORT" -const deprecatedEnvReuseport = "IPFS_REUSEPORT" - -// envReuseportVal stores the value of envReuseport. defaults to true. -var envReuseportVal = true - -func init() { - v := strings.ToLower(os.Getenv(envReuseport)) - if v == "false" || v == "f" || v == "0" { - envReuseportVal = false - log.Infof("REUSEPORT disabled (LIBP2P_TCP_REUSEPORT=%s)", v) - } - v, exist := os.LookupEnv(deprecatedEnvReuseport) - if exist { - log.Warning("IPFS_REUSEPORT is deprecated, use LIBP2P_TCP_REUSEPORT instead") - if v == "false" || v == "f" || v == "0" { - envReuseportVal = false - log.Infof("REUSEPORT disabled (IPFS_REUSEPORT=%s)", v) - } - } -} - -// reuseportIsAvailable returns whether reuseport is available to be used. This -// is here because we want to be able to turn reuseport on and off selectively. -// For now we use an ENV variable, as this handles our pressing need: -// -// LIBP2P_TCP_REUSEPORT=false ipfs daemon -// -// If this becomes a sought after feature, we could add this to the config. -// In the end, reuseport is a stop-gap. -func ReuseportIsAvailable() bool { - return envReuseportVal && reuseport.Available() -} diff --git a/vendor/github.com/libp2p/go-tcp-transport/tcp.go b/vendor/github.com/libp2p/go-tcp-transport/tcp.go deleted file mode 100644 index 1483d67e..00000000 --- a/vendor/github.com/libp2p/go-tcp-transport/tcp.go +++ /dev/null @@ -1,144 +0,0 @@ -package tcp - -import ( - "context" - "net" - "time" - - logging "github.com/ipfs/go-log" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - rtpt "github.com/libp2p/go-reuseport-transport" - - ma "github.com/multiformats/go-multiaddr" - mafmt "github.com/multiformats/go-multiaddr-fmt" - manet "github.com/multiformats/go-multiaddr-net" -) - -// DefaultConnectTimeout is the (default) maximum amount of time the TCP -// transport will spend on the initial TCP connect before giving up. -var DefaultConnectTimeout = 5 * time.Second - -var log = logging.Logger("tcp-tpt") - -// try to set linger on the connection, if possible. -func tryLinger(conn net.Conn, sec int) { - type canLinger interface { - SetLinger(int) error - } - - if lingerConn, ok := conn.(canLinger); ok { - _ = lingerConn.SetLinger(sec) - } -} - -type lingerListener struct { - manet.Listener - sec int -} - -func (ll *lingerListener) Accept() (manet.Conn, error) { - c, err := ll.Listener.Accept() - if err != nil { - return nil, err - } - tryLinger(c, ll.sec) - return c, nil -} - -// TcpTransport is the TCP transport. -type TcpTransport struct { - // Connection upgrader for upgrading insecure stream connections to - // secure multiplex connections. - Upgrader *tptu.Upgrader - - // Explicitly disable reuseport. - DisableReuseport bool - - // TCP connect timeout - ConnectTimeout time.Duration - - reuse rtpt.Transport -} - -var _ transport.Transport = &TcpTransport{} - -// NewTCPTransport creates a tcp transport object that tracks dialers and listeners -// created. It represents an entire tcp stack (though it might not necessarily be) -func NewTCPTransport(upgrader *tptu.Upgrader) *TcpTransport { - return &TcpTransport{Upgrader: upgrader, ConnectTimeout: DefaultConnectTimeout} -} - -// CanDial returns true if this transport believes it can dial the given -// multiaddr. -func (t *TcpTransport) CanDial(addr ma.Multiaddr) bool { - return mafmt.TCP.Matches(addr) -} - -func (t *TcpTransport) maDial(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error) { - // Apply the deadline iff applicable - if t.ConnectTimeout > 0 { - deadline := time.Now().Add(t.ConnectTimeout) - if d, ok := ctx.Deadline(); !ok || deadline.Before(d) { - var cancel func() - ctx, cancel = context.WithDeadline(ctx, deadline) - defer cancel() - } - } - - if t.UseReuseport() { - return t.reuse.DialContext(ctx, raddr) - } - var d manet.Dialer - return d.DialContext(ctx, raddr) -} - -// Dial dials the peer at the remote address. -func (t *TcpTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error) { - conn, err := t.maDial(ctx, raddr) - if err != nil { - return nil, err - } - // Set linger to 0 so we never get stuck in the TIME-WAIT state. When - // linger is 0, connections are _reset_ instead of closed with a FIN. - // This means we can immediately reuse the 5-tuple and reconnect. - tryLinger(conn, 0) - return t.Upgrader.UpgradeOutbound(ctx, t, conn, p) -} - -// UseReuseport returns true if reuseport is enabled and available. -func (t *TcpTransport) UseReuseport() bool { - return !t.DisableReuseport && ReuseportIsAvailable() -} - -func (t *TcpTransport) maListen(laddr ma.Multiaddr) (manet.Listener, error) { - if t.UseReuseport() { - return t.reuse.Listen(laddr) - } - return manet.Listen(laddr) -} - -// Listen listens on the given multiaddr. -func (t *TcpTransport) Listen(laddr ma.Multiaddr) (transport.Listener, error) { - list, err := t.maListen(laddr) - if err != nil { - return nil, err - } - list = &lingerListener{list, 0} - return t.Upgrader.UpgradeListener(t, list), nil -} - -// Protocols returns the list of terminal protocols this transport can dial. -func (t *TcpTransport) Protocols() []int { - return []int{ma.P_TCP} -} - -// Proxy always returns false for the TCP transport. -func (t *TcpTransport) Proxy() bool { - return false -} - -func (t *TcpTransport) String() string { - return "TCP" -} diff --git a/vendor/github.com/libp2p/go-ws-transport/.travis.yml b/vendor/github.com/libp2p/go-ws-transport/.travis.yml deleted file mode 100644 index 5163d693..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - $HOME/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/libp2p/go-ws-transport/README.md b/vendor/github.com/libp2p/go-ws-transport/README.md deleted file mode 100644 index e9c52a0d..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# go-ws-transport - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) -[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/) -[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p) -[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io) -[![GoDoc](https://godoc.org/github.com/libp2p/go-ws-transport?status.svg)](https://godoc.org/github.com/libp2p/go-ws-transport) -[![Coverage Status](https://coveralls.io/repos/github/libp2p/go-ws-transport/badge.svg?branch=master)](https://coveralls.io/github/libp2p/go-ws-transport?branch=master) -[![Build Status](https://travis-ci.org/libp2p/go-ws-transport.svg?branch=master)](https://travis-ci.org/libp2p/go-ws-transport) - -> go-libp2p websocket transport - -## Install - -```sh -> go get github.com/libp2p/go-ws-transport -``` - -This repo is [gomod](https://github.com/golang/go/wiki/Modules)-compatible, and users of -go 1.11 and later with modules enabled will automatically pull the latest tagged release -by referencing this package. Upgrades to future releases can be managed using `go get`, -or by editing your `go.mod` file as [described by the gomod documentation](https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies). - -## Usage - - -## Contribute - -Feel free to join in. All welcome. Open an [issue](https://github.com/libp2p/go-ws-transport/issues)! - -This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -### Want to hack on IPFS? - -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) - -## License - -MIT - ---- - -The last gx published version of this module was: 2.0.27: QmaSWc4ox6SZQF6DHZvDuM9sP1syNajkKuPXmKR1t5BAz5 diff --git a/vendor/github.com/libp2p/go-ws-transport/addrs.go b/vendor/github.com/libp2p/go-ws-transport/addrs.go deleted file mode 100644 index e5dbc46e..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/addrs.go +++ /dev/null @@ -1,73 +0,0 @@ -package websocket - -import ( - "fmt" - "net" - "net/url" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -// Addr is an implementation of net.Addr for WebSocket. -type Addr struct { - *url.URL -} - -var _ net.Addr = (*Addr)(nil) - -// Network returns the network type for a WebSocket, "websocket". -func (addr *Addr) Network() string { - return "websocket" -} - -// NewAddr creates a new Addr using the given host string -func NewAddr(host string) *Addr { - return &Addr{ - URL: &url.URL{ - Host: host, - }, - } -} - -func ConvertWebsocketMultiaddrToNetAddr(maddr ma.Multiaddr) (net.Addr, error) { - _, host, err := manet.DialArgs(maddr) - if err != nil { - return nil, err - } - - return NewAddr(host), nil -} - -func ParseWebsocketNetAddr(a net.Addr) (ma.Multiaddr, error) { - wsa, ok := a.(*Addr) - if !ok { - return nil, fmt.Errorf("not a websocket address") - } - - tcpaddr, err := net.ResolveTCPAddr("tcp", wsa.Host) - if err != nil { - return nil, err - } - - tcpma, err := manet.FromNetAddr(tcpaddr) - if err != nil { - return nil, err - } - - wsma, err := ma.NewMultiaddr("/ws") - if err != nil { - return nil, err - } - - return tcpma.Encapsulate(wsma), nil -} - -func parseMultiaddr(a ma.Multiaddr) (string, error) { - _, host, err := manet.DialArgs(a) - if err != nil { - return "", err - } - - return "ws://" + host, nil -} diff --git a/vendor/github.com/libp2p/go-ws-transport/codecov.yml b/vendor/github.com/libp2p/go-ws-transport/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/libp2p/go-ws-transport/conn.go b/vendor/github.com/libp2p/go-ws-transport/conn.go deleted file mode 100644 index b63a28a9..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/conn.go +++ /dev/null @@ -1,129 +0,0 @@ -package websocket - -import ( - "io" - "net" - "sync" - "time" - - ws "github.com/gorilla/websocket" -) - -// GracefulCloseTimeout is the time to wait trying to gracefully close a -// connection before simply cutting it. -var GracefulCloseTimeout = 100 * time.Millisecond - -var _ net.Conn = (*Conn)(nil) - -// Conn implements net.Conn interface for gorilla/websocket. -type Conn struct { - *ws.Conn - DefaultMessageType int - reader io.Reader - closeOnce sync.Once -} - -func (c *Conn) Read(b []byte) (int, error) { - if c.reader == nil { - if err := c.prepNextReader(); err != nil { - return 0, err - } - } - - for { - n, err := c.reader.Read(b) - switch err { - case io.EOF: - c.reader = nil - - if n > 0 { - return n, nil - } - - if err := c.prepNextReader(); err != nil { - return 0, err - } - - // explicitly looping - default: - return n, err - } - } -} - -func (c *Conn) prepNextReader() error { - t, r, err := c.Conn.NextReader() - if err != nil { - if wserr, ok := err.(*ws.CloseError); ok { - if wserr.Code == 1000 || wserr.Code == 1005 { - return io.EOF - } - } - return err - } - - if t == ws.CloseMessage { - return io.EOF - } - - c.reader = r - return nil -} - -func (c *Conn) Write(b []byte) (n int, err error) { - if err := c.Conn.WriteMessage(c.DefaultMessageType, b); err != nil { - return 0, err - } - - return len(b), nil -} - -// Close closes the connection. Only the first call to Close will receive the -// close error, subsequent and concurrent calls will return nil. -// This method is thread-safe. -func (c *Conn) Close() error { - var err error - c.closeOnce.Do(func() { - err1 := c.Conn.WriteControl(ws.CloseMessage, nil, time.Now().Add(GracefulCloseTimeout)) - err2 := c.Conn.Close() - switch { - case err1 != nil: - err = err1 - case err2 != nil: - err = err2 - } - }) - return err -} - -func (c *Conn) LocalAddr() net.Addr { - return NewAddr(c.Conn.LocalAddr().String()) -} - -func (c *Conn) RemoteAddr() net.Addr { - return NewAddr(c.Conn.RemoteAddr().String()) -} - -func (c *Conn) SetDeadline(t time.Time) error { - if err := c.SetReadDeadline(t); err != nil { - return err - } - - return c.SetWriteDeadline(t) -} - -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.Conn.SetReadDeadline(t) -} - -func (c *Conn) SetWriteDeadline(t time.Time) error { - return c.Conn.SetWriteDeadline(t) -} - -// NewConn creates a Conn given a regular gorilla/websocket Conn. -func NewConn(raw *ws.Conn) *Conn { - return &Conn{ - Conn: raw, - DefaultMessageType: ws.BinaryMessage, - } -} diff --git a/vendor/github.com/libp2p/go-ws-transport/go.mod b/vendor/github.com/libp2p/go-ws-transport/go.mod deleted file mode 100644 index b25b7dff..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/libp2p/go-ws-transport - -require ( - github.com/gorilla/websocket v1.4.0 - github.com/libp2p/go-libp2p-core v0.0.1 - github.com/libp2p/go-libp2p-mplex v0.2.0 - github.com/libp2p/go-libp2p-testing v0.0.3 - github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 - github.com/multiformats/go-multiaddr v0.0.4 - github.com/multiformats/go-multiaddr-net v0.0.1 - github.com/whyrusleeping/mafmt v1.2.8 -) diff --git a/vendor/github.com/libp2p/go-ws-transport/go.sum b/vendor/github.com/libp2p/go-ws-transport/go.sum deleted file mode 100644 index ad6d7b54..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/go.sum +++ /dev/null @@ -1,126 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 h1:qkOC5Gd33k54tobS36cXdAzJbeHaduLtnLQQwNoIi78= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/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/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -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/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-log v0.0.1 h1:9XTUN/rW64BCG1YhPK9Hoy3q8nr4gOmHHBpgFdfw6Lc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2 h1:vhC1OXXiT9R2pczegwz6moDvuRpggaroAXhPIseh57A= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-mplex v0.2.0 h1:vnR+/fUnL5d2kTB1Lfce1KVSP+bCCy2aJIvqvb9cFqE= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-testing v0.0.3 h1:bdij4bKaaND7tCsaXVjRfYkMpvoOeKj9AVQGJllA6jM= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 h1:PZMS9lhjK9VytzMCW3tWHAXtKXmlURSc3ZdvwEcKCzw= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-maddr-filter v0.0.4 h1:hx8HIuuwk34KePddrp2mM5ivgPkZ09JH4AvsALRbFUs= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-mplex v0.0.3 h1:YiMaevQcZtFU6DmKIF8xEO0vaui5kM5HJ1V1xkWQv14= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-stream-muxer v0.0.1 h1:Ce6e2Pyu+b5MC1k3eeFtAax0pW4gc6MosYSLV05UeLw= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1 h1:OJIdWOWYe2l5PQNgimGtuwHY8nDskvJ5vvs//YnzRLs= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -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/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc h1:9lDbC6Rz4bwmou+oE6Dt4Cb2BGMur5eR/GYptkKUVHo= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mafmt v1.2.8 h1:TCghSl5kkwEE0j+sU/gudyhVMRlpBin8fMBBHg59EbA= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7 h1:C2F/nMkR/9sfUTpvR3QrjBuTdvMUC/cFajkphs1YLQo= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/libp2p/go-ws-transport/listener.go b/vendor/github.com/libp2p/go-ws-transport/listener.go deleted file mode 100644 index 517c719a..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/listener.go +++ /dev/null @@ -1,62 +0,0 @@ -package websocket - -import ( - "fmt" - "net" - "net/http" - - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" -) - -type listener struct { - net.Listener - - laddr ma.Multiaddr - - closed chan struct{} - incoming chan *Conn -} - -func (l *listener) serve() { - defer close(l.closed) - _ = http.Serve(l.Listener, l) -} - -func (l *listener) ServeHTTP(w http.ResponseWriter, r *http.Request) { - c, err := upgrader.Upgrade(w, r, nil) - if err != nil { - // The upgrader writes a response for us. - return - } - - select { - case l.incoming <- NewConn(c): - case <-l.closed: - c.Close() - } - // The connection has been hijacked, it's safe to return. -} - -func (l *listener) Accept() (manet.Conn, error) { - select { - case c, ok := <-l.incoming: - if !ok { - return nil, fmt.Errorf("listener is closed") - } - - mnc, err := manet.WrapNetConn(c) - if err != nil { - c.Close() - return nil, err - } - - return mnc, nil - case <-l.closed: - return nil, fmt.Errorf("listener is closed") - } -} - -func (l *listener) Multiaddr() ma.Multiaddr { - return l.laddr -} diff --git a/vendor/github.com/libp2p/go-ws-transport/websocket.go b/vendor/github.com/libp2p/go-ws-transport/websocket.go deleted file mode 100644 index 972681a6..00000000 --- a/vendor/github.com/libp2p/go-ws-transport/websocket.go +++ /dev/null @@ -1,160 +0,0 @@ -// Package websocket implements a websocket based transport for go-libp2p. -package websocket - -import ( - "context" - "fmt" - "net" - "net/http" - "net/url" - - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/transport" - - tptu "github.com/libp2p/go-libp2p-transport-upgrader" - - ws "github.com/gorilla/websocket" - ma "github.com/multiformats/go-multiaddr" - manet "github.com/multiformats/go-multiaddr-net" - mafmt "github.com/whyrusleeping/mafmt" -) - -// WsProtocol is the multiaddr protocol definition for this transport. -var WsProtocol = ma.Protocol{ - Code: 477, - Name: "ws", - VCode: ma.CodeToVarint(477), -} - -// WsFmt is multiaddr formatter for WsProtocol -var WsFmt = mafmt.And(mafmt.TCP, mafmt.Base(WsProtocol.Code)) - -// WsCodec is the multiaddr-net codec definition for the websocket transport -var WsCodec = &manet.NetCodec{ - NetAddrNetworks: []string{"websocket"}, - ProtocolName: "ws", - ConvertMultiaddr: ConvertWebsocketMultiaddrToNetAddr, - ParseNetAddr: ParseWebsocketNetAddr, -} - -// Default gorilla upgrader -var upgrader = ws.Upgrader{ - // Allow requests from *all* origins. - CheckOrigin: func(r *http.Request) bool { - return true - }, -} - -func init() { - err := ma.AddProtocol(WsProtocol) - if err != nil { - panic(fmt.Errorf("error registering websocket protocol: %s", err)) - } - - manet.RegisterNetCodec(WsCodec) -} - -// WebsocketTransport is the actual go-libp2p transport -type WebsocketTransport struct { - Upgrader *tptu.Upgrader -} - -func New(u *tptu.Upgrader) *WebsocketTransport { - return &WebsocketTransport{u} -} - -var _ transport.Transport = (*WebsocketTransport)(nil) - -func (t *WebsocketTransport) CanDial(a ma.Multiaddr) bool { - return WsFmt.Matches(a) -} - -func (t *WebsocketTransport) Protocols() []int { - return []int{WsProtocol.Code} -} - -func (t *WebsocketTransport) Proxy() bool { - return false -} - -func (t *WebsocketTransport) maDial(ctx context.Context, raddr ma.Multiaddr) (manet.Conn, error) { - wsurl, err := parseMultiaddr(raddr) - if err != nil { - return nil, err - } - - wscon, _, err := ws.DefaultDialer.Dial(wsurl, nil) - if err != nil { - return nil, err - } - - mnc, err := manet.WrapNetConn(NewConn(wscon)) - if err != nil { - wscon.Close() - return nil, err - } - return mnc, nil -} - -func (t *WebsocketTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error) { - macon, err := t.maDial(ctx, raddr) - if err != nil { - return nil, err - } - return t.Upgrader.UpgradeOutbound(ctx, t, macon, p) -} - -func (t *WebsocketTransport) maListen(a ma.Multiaddr) (manet.Listener, error) { - lnet, lnaddr, err := manet.DialArgs(a) - if err != nil { - return nil, err - } - - nl, err := net.Listen(lnet, lnaddr) - if err != nil { - return nil, err - } - - u, err := url.Parse("http://" + nl.Addr().String()) - if err != nil { - nl.Close() - return nil, err - } - - malist, err := t.wrapListener(nl, u) - if err != nil { - nl.Close() - return nil, err - } - - go malist.serve() - - return malist, nil -} - -func (t *WebsocketTransport) Listen(a ma.Multiaddr) (transport.Listener, error) { - malist, err := t.maListen(a) - if err != nil { - return nil, err - } - return t.Upgrader.UpgradeListener(t, malist), nil -} - -func (t *WebsocketTransport) wrapListener(l net.Listener, origin *url.URL) (*listener, error) { - laddr, err := manet.FromNetAddr(l.Addr()) - if err != nil { - return nil, err - } - wsma, err := ma.NewMultiaddr("/ws") - if err != nil { - return nil, err - } - laddr = laddr.Encapsulate(wsma) - - return &listener{ - laddr: laddr, - Listener: l, - incoming: make(chan *Conn), - closed: make(chan struct{}), - }, nil -} diff --git a/vendor/github.com/libp2p/go-yamux/.gitignore b/vendor/github.com/libp2p/go-yamux/.gitignore deleted file mode 100644 index 83656241..00000000 --- a/vendor/github.com/libp2p/go-yamux/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test diff --git a/vendor/github.com/libp2p/go-yamux/LICENSE b/vendor/github.com/libp2p/go-yamux/LICENSE deleted file mode 100644 index f0e5c79e..00000000 --- a/vendor/github.com/libp2p/go-yamux/LICENSE +++ /dev/null @@ -1,362 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. \ No newline at end of file diff --git a/vendor/github.com/libp2p/go-yamux/LICENSE-BSD b/vendor/github.com/libp2p/go-yamux/LICENSE-BSD deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/github.com/libp2p/go-yamux/LICENSE-BSD +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/libp2p/go-yamux/README.md b/vendor/github.com/libp2p/go-yamux/README.md deleted file mode 100644 index dabeec72..00000000 --- a/vendor/github.com/libp2p/go-yamux/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# Yamux - -Yamux (Yet another Multiplexer) is a multiplexing library for Golang. -It relies on an underlying connection to provide reliability -and ordering, such as TCP or Unix domain sockets, and provides -stream-oriented multiplexing. It is inspired by SPDY but is not -interoperable with it. - -Yamux features include: - -* Bi-directional streams - * Streams can be opened by either client or server - * Useful for NAT traversal - * Server-side push support -* Flow control - * Avoid starvation - * Back-pressure to prevent overwhelming a receiver -* Keep Alives - * Enables persistent connections over a load balancer -* Efficient - * Enables thousands of logical streams with low overhead - -## Documentation - -For complete documentation, see the associated [Godoc](http://godoc.org/github.com/libp2p/go-yamux). - -## Specification - -The full specification for Yamux is provided in the `spec.md` file. -It can be used as a guide to implementors of interoperable libraries. - -## Usage - -Using Yamux is remarkably simple: - -```go - -func client() { - // Get a TCP connection - conn, err := net.Dial(...) - if err != nil { - panic(err) - } - - // Setup client side of yamux - session, err := yamux.Client(conn, nil) - if err != nil { - panic(err) - } - - // Open a new stream - stream, err := session.Open() - if err != nil { - panic(err) - } - - // Stream implements net.Conn - stream.Write([]byte("ping")) -} - -func server() { - // Accept a TCP connection - conn, err := listener.Accept() - if err != nil { - panic(err) - } - - // Setup server side of yamux - session, err := yamux.Server(conn, nil) - if err != nil { - panic(err) - } - - // Accept a stream - stream, err := session.Accept() - if err != nil { - panic(err) - } - - // Listen for a message - buf := make([]byte, 4) - stream.Read(buf) -} - -``` - diff --git a/vendor/github.com/libp2p/go-yamux/addr.go b/vendor/github.com/libp2p/go-yamux/addr.go deleted file mode 100644 index be6ebca9..00000000 --- a/vendor/github.com/libp2p/go-yamux/addr.go +++ /dev/null @@ -1,60 +0,0 @@ -package yamux - -import ( - "fmt" - "net" -) - -// hasAddr is used to get the address from the underlying connection -type hasAddr interface { - LocalAddr() net.Addr - RemoteAddr() net.Addr -} - -// yamuxAddr is used when we cannot get the underlying address -type yamuxAddr struct { - Addr string -} - -func (*yamuxAddr) Network() string { - return "yamux" -} - -func (y *yamuxAddr) String() string { - return fmt.Sprintf("yamux:%s", y.Addr) -} - -// Addr is used to get the address of the listener. -func (s *Session) Addr() net.Addr { - return s.LocalAddr() -} - -// LocalAddr is used to get the local address of the -// underlying connection. -func (s *Session) LocalAddr() net.Addr { - addr, ok := s.conn.(hasAddr) - if !ok { - return &yamuxAddr{"local"} - } - return addr.LocalAddr() -} - -// RemoteAddr is used to get the address of remote end -// of the underlying connection -func (s *Session) RemoteAddr() net.Addr { - addr, ok := s.conn.(hasAddr) - if !ok { - return &yamuxAddr{"remote"} - } - return addr.RemoteAddr() -} - -// LocalAddr returns the local address -func (s *Stream) LocalAddr() net.Addr { - return s.session.LocalAddr() -} - -// LocalAddr returns the remote address -func (s *Stream) RemoteAddr() net.Addr { - return s.session.RemoteAddr() -} diff --git a/vendor/github.com/libp2p/go-yamux/const.go b/vendor/github.com/libp2p/go-yamux/const.go deleted file mode 100644 index ca9c14cf..00000000 --- a/vendor/github.com/libp2p/go-yamux/const.go +++ /dev/null @@ -1,176 +0,0 @@ -package yamux - -import ( - "encoding/binary" - "fmt" -) - -type YamuxError struct { - msg string - timeout, temporary bool -} - -func (ye YamuxError) Error() string { - return ye.msg -} - -func (ye YamuxError) Timeout() bool { - return ye.timeout -} - -func (ye YamuxError) Temporary() bool { - return ye.temporary -} - -var ( - // ErrInvalidVersion means we received a frame with an - // invalid version - ErrInvalidVersion = &YamuxError{msg: "invalid protocol version"} - - // ErrInvalidMsgType means we received a frame with an - // invalid message type - ErrInvalidMsgType = &YamuxError{msg: "invalid msg type"} - - // ErrSessionShutdown is used if there is a shutdown during - // an operation - ErrSessionShutdown = &YamuxError{msg: "session shutdown"} - - // ErrStreamsExhausted is returned if we have no more - // stream ids to issue - ErrStreamsExhausted = &YamuxError{msg: "streams exhausted"} - - // ErrDuplicateStream is used if a duplicate stream is - // opened inbound - ErrDuplicateStream = &YamuxError{msg: "duplicate stream initiated"} - - // ErrReceiveWindowExceeded indicates the window was exceeded - ErrRecvWindowExceeded = &YamuxError{msg: "recv window exceeded"} - - // ErrTimeout is used when we reach an IO deadline - ErrTimeout = &YamuxError{msg: "i/o deadline reached", timeout: true, temporary: true} - - // ErrStreamClosed is returned when using a closed stream - ErrStreamClosed = &YamuxError{msg: "stream closed"} - - // ErrUnexpectedFlag is set when we get an unexpected flag - ErrUnexpectedFlag = &YamuxError{msg: "unexpected flag"} - - // ErrRemoteGoAway is used when we get a go away from the other side - ErrRemoteGoAway = &YamuxError{msg: "remote end is not accepting connections"} - - // ErrConnectionReset is sent if a stream is reset. This can happen - // if the backlog is exceeded, or if there was a remote GoAway. - ErrConnectionReset = &YamuxError{msg: "stream reset"} - - // ErrConnectionWriteTimeout indicates that we hit the "safety valve" - // timeout writing to the underlying stream connection. - ErrConnectionWriteTimeout = &YamuxError{msg: "connection write timeout", timeout: true} - - // ErrKeepAliveTimeout is sent if a missed keepalive caused the stream close - ErrKeepAliveTimeout = &YamuxError{msg: "keepalive timeout", timeout: true} -) - -const ( - // protoVersion is the only version we support - protoVersion uint8 = 0 -) - -const ( - // Data is used for data frames. They are followed - // by length bytes worth of payload. - typeData uint8 = iota - - // WindowUpdate is used to change the window of - // a given stream. The length indicates the delta - // update to the window. - typeWindowUpdate - - // Ping is sent as a keep-alive or to measure - // the RTT. The StreamID and Length value are echoed - // back in the response. - typePing - - // GoAway is sent to terminate a session. The StreamID - // should be 0 and the length is an error code. - typeGoAway -) - -const ( - // SYN is sent to signal a new stream. May - // be sent with a data payload - flagSYN uint16 = 1 << iota - - // ACK is sent to acknowledge a new stream. May - // be sent with a data payload - flagACK - - // FIN is sent to half-close the given stream. - // May be sent with a data payload. - flagFIN - - // RST is used to hard close a given stream. - flagRST -) - -const ( - // initialStreamWindow is the initial stream window size - initialStreamWindow uint32 = 256 * 1024 -) - -const ( - // goAwayNormal is sent on a normal termination - goAwayNormal uint32 = iota - - // goAwayProtoErr sent on a protocol error - goAwayProtoErr - - // goAwayInternalErr sent on an internal error - goAwayInternalErr -) - -const ( - sizeOfVersion = 1 - sizeOfType = 1 - sizeOfFlags = 2 - sizeOfStreamID = 4 - sizeOfLength = 4 - headerSize = sizeOfVersion + sizeOfType + sizeOfFlags + - sizeOfStreamID + sizeOfLength -) - -type header [headerSize]byte - -func (h header) Version() uint8 { - return h[0] -} - -func (h header) MsgType() uint8 { - return h[1] -} - -func (h header) Flags() uint16 { - return binary.BigEndian.Uint16(h[2:4]) -} - -func (h header) StreamID() uint32 { - return binary.BigEndian.Uint32(h[4:8]) -} - -func (h header) Length() uint32 { - return binary.BigEndian.Uint32(h[8:12]) -} - -func (h header) String() string { - return fmt.Sprintf("Vsn:%d Type:%d Flags:%d StreamID:%d Length:%d", - h.Version(), h.MsgType(), h.Flags(), h.StreamID(), h.Length()) -} - -func encode(msgType uint8, flags uint16, streamID uint32, length uint32) header { - var h header - h[0] = protoVersion - h[1] = msgType - binary.BigEndian.PutUint16(h[2:4], flags) - binary.BigEndian.PutUint32(h[4:8], streamID) - binary.BigEndian.PutUint32(h[8:12], length) - return h -} diff --git a/vendor/github.com/libp2p/go-yamux/deadline.go b/vendor/github.com/libp2p/go-yamux/deadline.go deleted file mode 100644 index 16da56dd..00000000 --- a/vendor/github.com/libp2p/go-yamux/deadline.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copied from the go standard library. -// -// Copyright 2010 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-BSD file. - -package yamux - -import ( - "sync" - "time" -) - -// pipeDeadline is an abstraction for handling timeouts. -type pipeDeadline struct { - mu sync.Mutex // Guards timer and cancel - timer *time.Timer - cancel chan struct{} // Must be non-nil -} - -func makePipeDeadline() pipeDeadline { - return pipeDeadline{cancel: make(chan struct{})} -} - -// set sets the point in time when the deadline will time out. -// A timeout event is signaled by closing the channel returned by waiter. -// Once a timeout has occurred, the deadline can be refreshed by specifying a -// t value in the future. -// -// A zero value for t prevents timeout. -func (d *pipeDeadline) set(t time.Time) { - d.mu.Lock() - defer d.mu.Unlock() - - if d.timer != nil && !d.timer.Stop() { - <-d.cancel // Wait for the timer callback to finish and close cancel - } - d.timer = nil - - // Time is zero, then there is no deadline. - closed := isClosedChan(d.cancel) - if t.IsZero() { - if closed { - d.cancel = make(chan struct{}) - } - return - } - - // Time in the future, setup a timer to cancel in the future. - if dur := time.Until(t); dur > 0 { - if closed { - d.cancel = make(chan struct{}) - } - d.timer = time.AfterFunc(dur, func() { - close(d.cancel) - }) - return - } - - // Time in the past, so close immediately. - if !closed { - close(d.cancel) - } -} - -// wait returns a channel that is closed when the deadline is exceeded. -func (d *pipeDeadline) wait() chan struct{} { - d.mu.Lock() - defer d.mu.Unlock() - return d.cancel -} - -func isClosedChan(c <-chan struct{}) bool { - select { - case <-c: - return true - default: - return false - } -} diff --git a/vendor/github.com/libp2p/go-yamux/go.mod b/vendor/github.com/libp2p/go-yamux/go.mod deleted file mode 100644 index 0feb3c92..00000000 --- a/vendor/github.com/libp2p/go-yamux/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/libp2p/go-yamux - -go 1.12 - -require github.com/libp2p/go-buffer-pool v0.0.2 diff --git a/vendor/github.com/libp2p/go-yamux/go.sum b/vendor/github.com/libp2p/go-yamux/go.sum deleted file mode 100644 index 012e1223..00000000 --- a/vendor/github.com/libp2p/go-yamux/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= diff --git a/vendor/github.com/libp2p/go-yamux/mux.go b/vendor/github.com/libp2p/go-yamux/mux.go deleted file mode 100644 index a8d7064a..00000000 --- a/vendor/github.com/libp2p/go-yamux/mux.go +++ /dev/null @@ -1,111 +0,0 @@ -package yamux - -import ( - "fmt" - "io" - "net" - "os" - "time" -) - -// Config is used to tune the Yamux session -type Config struct { - // AcceptBacklog is used to limit how many streams may be - // waiting an accept. - AcceptBacklog int - - // EnableKeepalive is used to do a period keep alive - // messages using a ping. - EnableKeepAlive bool - - // KeepAliveInterval is how often to perform the keep alive - KeepAliveInterval time.Duration - - // ConnectionWriteTimeout is meant to be a "safety valve" timeout after - // we which will suspect a problem with the underlying connection and - // close it. This is only applied to writes, where's there's generally - // an expectation that things will move along quickly. - ConnectionWriteTimeout time.Duration - - // MaxStreamWindowSize is used to control the maximum - // window size that we allow for a stream. - MaxStreamWindowSize uint32 - - // LogOutput is used to control the log destination - LogOutput io.Writer - - // ReadBufSize controls the size of the read buffer. - // - // Set to 0 to disable it. - ReadBufSize int - - // WriteCoalesceDelay is the maximum amount of time we'll delay - // coalescing a packet before sending it. This should be on the order of - // micro-milliseconds. - WriteCoalesceDelay time.Duration - - // MaxMessageSize is the maximum size of a message that we'll send on a - // stream. This ensures that a single stream doesn't hog a connection. - MaxMessageSize uint32 -} - -// DefaultConfig is used to return a default configuration -func DefaultConfig() *Config { - return &Config{ - AcceptBacklog: 256, - EnableKeepAlive: true, - KeepAliveInterval: 30 * time.Second, - ConnectionWriteTimeout: 10 * time.Second, - MaxStreamWindowSize: initialStreamWindow, - LogOutput: os.Stderr, - ReadBufSize: 4096, - MaxMessageSize: 64 * 1024, // Means 64KiB/10s = 52kbps minimum speed. - WriteCoalesceDelay: 100 * time.Microsecond, - } -} - -// VerifyConfig is used to verify the sanity of configuration -func VerifyConfig(config *Config) error { - if config.AcceptBacklog <= 0 { - return fmt.Errorf("backlog must be positive") - } - if config.KeepAliveInterval == 0 { - return fmt.Errorf("keep-alive interval must be positive") - } - if config.MaxStreamWindowSize < initialStreamWindow { - return fmt.Errorf("MaxStreamWindowSize must be larger than %d", initialStreamWindow) - } - if config.MaxMessageSize < 1024 { - return fmt.Errorf("MaxMessageSize must be greater than a kilobyte") - } - if config.WriteCoalesceDelay < 0 { - return fmt.Errorf("WriteCoalesceDelay must be >= 0") - } - return nil -} - -// Server is used to initialize a new server-side connection. -// There must be at most one server-side connection. If a nil config is -// provided, the DefaultConfiguration will be used. -func Server(conn net.Conn, config *Config) (*Session, error) { - if config == nil { - config = DefaultConfig() - } - if err := VerifyConfig(config); err != nil { - return nil, err - } - return newSession(config, conn, false, config.ReadBufSize), nil -} - -// Client is used to initialize a new client-side connection. -// There must be at most one client-side connection. -func Client(conn net.Conn, config *Config) (*Session, error) { - if config == nil { - config = DefaultConfig() - } - - if err := VerifyConfig(config); err != nil { - return nil, err - } - return newSession(config, conn, true, config.ReadBufSize), nil -} diff --git a/vendor/github.com/libp2p/go-yamux/session.go b/vendor/github.com/libp2p/go-yamux/session.go deleted file mode 100644 index 4af4c055..00000000 --- a/vendor/github.com/libp2p/go-yamux/session.go +++ /dev/null @@ -1,704 +0,0 @@ -package yamux - -import ( - "bufio" - "fmt" - "io" - "io/ioutil" - "log" - "math" - "net" - "os" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/libp2p/go-buffer-pool" -) - -// Session is used to wrap a reliable ordered connection and to -// multiplex it into multiple streams. -type Session struct { - // remoteGoAway indicates the remote side does - // not want futher connections. Must be first for alignment. - remoteGoAway int32 - - // localGoAway indicates that we should stop - // accepting futher connections. Must be first for alignment. - localGoAway int32 - - // nextStreamID is the next stream we should - // send. This depends if we are a client/server. - nextStreamID uint32 - - // config holds our configuration - config *Config - - // logger is used for our logs - logger *log.Logger - - // conn is the underlying connection - conn net.Conn - - // reader is a buffered reader - reader io.Reader - - // pings is used to track inflight pings - pings map[uint32]chan struct{} - pingID uint32 - pingLock sync.Mutex - - // streams maps a stream id to a stream, and inflight has an entry - // for any outgoing stream that has not yet been established. Both are - // protected by streamLock. - streams map[uint32]*Stream - inflight map[uint32]struct{} - streamLock sync.Mutex - - // synCh acts like a semaphore. It is sized to the AcceptBacklog which - // is assumed to be symmetric between the client and server. This allows - // the client to avoid exceeding the backlog and instead blocks the open. - synCh chan struct{} - - // acceptCh is used to pass ready streams to the client - acceptCh chan *Stream - - // sendCh is used to send messages - sendCh chan []byte - - // recvDoneCh is closed when recv() exits to avoid a race - // between stream registration and stream shutdown - recvDoneCh chan struct{} - - // sendDoneCh is closed when send() exits to avoid a race - // between returning from a Stream.Write and exiting from the send loop - // (which may be reading a buffer on-load-from Stream.Write). - sendDoneCh chan struct{} - - // client is true if we're the client and our stream IDs should be odd. - client bool - - // shutdown is used to safely close a session - shutdown bool - shutdownErr error - shutdownCh chan struct{} - shutdownLock sync.Mutex - - // keepaliveTimer is a periodic timer for keepalive messages. It's nil - // when keepalives are disabled. - keepaliveLock sync.Mutex - keepaliveTimer *time.Timer -} - -const ( - stageInitial uint32 = iota - stageFinal -) - -// newSession is used to construct a new session -func newSession(config *Config, conn net.Conn, client bool, readBuf int) *Session { - var reader io.Reader = conn - if readBuf > 0 { - reader = bufio.NewReaderSize(reader, readBuf) - } - s := &Session{ - config: config, - client: client, - logger: log.New(config.LogOutput, "", log.LstdFlags), - conn: conn, - reader: reader, - pings: make(map[uint32]chan struct{}), - streams: make(map[uint32]*Stream), - inflight: make(map[uint32]struct{}), - synCh: make(chan struct{}, config.AcceptBacklog), - acceptCh: make(chan *Stream, config.AcceptBacklog), - sendCh: make(chan []byte, 64), - recvDoneCh: make(chan struct{}), - sendDoneCh: make(chan struct{}), - shutdownCh: make(chan struct{}), - } - if client { - s.nextStreamID = 1 - } else { - s.nextStreamID = 2 - } - if config.EnableKeepAlive { - s.startKeepalive() - } - go s.recv() - go s.send() - return s -} - -// IsClosed does a safe check to see if we have shutdown -func (s *Session) IsClosed() bool { - select { - case <-s.shutdownCh: - return true - default: - return false - } -} - -// CloseChan returns a read-only channel which is closed as -// soon as the session is closed. -func (s *Session) CloseChan() <-chan struct{} { - return s.shutdownCh -} - -// NumStreams returns the number of currently open streams -func (s *Session) NumStreams() int { - s.streamLock.Lock() - num := len(s.streams) - s.streamLock.Unlock() - return num -} - -// Open is used to create a new stream as a net.Conn -func (s *Session) Open() (net.Conn, error) { - conn, err := s.OpenStream() - if err != nil { - return nil, err - } - return conn, nil -} - -// OpenStream is used to create a new stream -func (s *Session) OpenStream() (*Stream, error) { - if s.IsClosed() { - return nil, s.shutdownErr - } - if atomic.LoadInt32(&s.remoteGoAway) == 1 { - return nil, ErrRemoteGoAway - } - - // Block if we have too many inflight SYNs - select { - case s.synCh <- struct{}{}: - case <-s.shutdownCh: - return nil, s.shutdownErr - } - -GET_ID: - // Get an ID, and check for stream exhaustion - id := atomic.LoadUint32(&s.nextStreamID) - if id >= math.MaxUint32-1 { - return nil, ErrStreamsExhausted - } - if !atomic.CompareAndSwapUint32(&s.nextStreamID, id, id+2) { - goto GET_ID - } - - // Register the stream - stream := newStream(s, id, streamInit) - s.streamLock.Lock() - s.streams[id] = stream - s.inflight[id] = struct{}{} - s.streamLock.Unlock() - - // Send the window update to create - if err := stream.sendWindowUpdate(); err != nil { - select { - case <-s.synCh: - default: - s.logger.Printf("[ERR] yamux: aborted stream open without inflight syn semaphore") - } - return nil, err - } - return stream, nil -} - -// Accept is used to block until the next available stream -// is ready to be accepted. -func (s *Session) Accept() (net.Conn, error) { - conn, err := s.AcceptStream() - if err != nil { - return nil, err - } - return conn, err -} - -// AcceptStream is used to block until the next available stream -// is ready to be accepted. -func (s *Session) AcceptStream() (*Stream, error) { - select { - case stream := <-s.acceptCh: - if err := stream.sendWindowUpdate(); err != nil { - return nil, err - } - return stream, nil - case <-s.shutdownCh: - return nil, s.shutdownErr - } -} - -// Close is used to close the session and all streams. -// Attempts to send a GoAway before closing the connection. -func (s *Session) Close() error { - s.shutdownLock.Lock() - defer s.shutdownLock.Unlock() - - if s.shutdown { - return nil - } - s.shutdown = true - if s.shutdownErr == nil { - s.shutdownErr = ErrSessionShutdown - } - close(s.shutdownCh) - s.conn.Close() - s.stopKeepalive() - <-s.recvDoneCh - <-s.sendDoneCh - - s.streamLock.Lock() - defer s.streamLock.Unlock() - for _, stream := range s.streams { - stream.forceClose() - } - return nil -} - -// exitErr is used to handle an error that is causing the -// session to terminate. -func (s *Session) exitErr(err error) { - s.shutdownLock.Lock() - if s.shutdownErr == nil { - s.shutdownErr = err - } - s.shutdownLock.Unlock() - s.Close() -} - -// GoAway can be used to prevent accepting further -// connections. It does not close the underlying conn. -func (s *Session) GoAway() error { - return s.sendMsg(s.goAway(goAwayNormal), nil, nil) -} - -// goAway is used to send a goAway message -func (s *Session) goAway(reason uint32) header { - atomic.SwapInt32(&s.localGoAway, 1) - hdr := encode(typeGoAway, 0, 0, reason) - return hdr -} - -// Ping is used to measure the RTT response time -func (s *Session) Ping() (time.Duration, error) { - // Get a channel for the ping - ch := make(chan struct{}) - - // Get a new ping id, mark as pending - s.pingLock.Lock() - id := s.pingID - s.pingID++ - s.pings[id] = ch - s.pingLock.Unlock() - - // Send the ping request - hdr := encode(typePing, flagSYN, 0, id) - if err := s.sendMsg(hdr, nil, nil); err != nil { - return 0, err - } - - // Wait for a response - start := time.Now() - select { - case <-ch: - case <-time.After(s.config.ConnectionWriteTimeout): - s.pingLock.Lock() - delete(s.pings, id) // Ignore it if a response comes later. - s.pingLock.Unlock() - return 0, ErrTimeout - case <-s.shutdownCh: - return 0, s.shutdownErr - } - - // Compute the RTT - return time.Now().Sub(start), nil -} - -// startKeepalive starts the keepalive process. -func (s *Session) startKeepalive() { - s.keepaliveLock.Lock() - defer s.keepaliveLock.Unlock() - s.keepaliveTimer = time.AfterFunc(s.config.KeepAliveInterval, func() { - s.keepaliveLock.Lock() - - if s.keepaliveTimer == nil { - s.keepaliveLock.Unlock() - // keepalives have been stopped. - return - } - _, err := s.Ping() - if err != nil { - // Make sure to unlock before exiting so we don't - // deadlock trying to shutdown keepalives. - s.keepaliveLock.Unlock() - s.logger.Printf("[ERR] yamux: keepalive failed: %v", err) - s.exitErr(ErrKeepAliveTimeout) - return - } - s.keepaliveTimer.Reset(s.config.KeepAliveInterval) - s.keepaliveLock.Unlock() - }) -} - -// stopKeepalive stops the keepalive process. -func (s *Session) stopKeepalive() { - s.keepaliveLock.Lock() - defer s.keepaliveLock.Unlock() - if s.keepaliveTimer != nil { - s.keepaliveTimer.Stop() - } -} - -// send sends the header and body. -func (s *Session) sendMsg(hdr header, body []byte, deadline <-chan struct{}) error { - select { - case <-s.shutdownCh: - return s.shutdownErr - default: - } - - // duplicate as we're sending this async. - buf := pool.Get(headerSize + len(body)) - copy(buf[:headerSize], hdr[:]) - copy(buf[headerSize:], body) - - select { - case <-s.shutdownCh: - pool.Put(buf) - return s.shutdownErr - case s.sendCh <- buf: - return nil - case <-deadline: - pool.Put(buf) - return ErrTimeout - } -} - -// send is a long running goroutine that sends data -func (s *Session) send() { - if err := s.sendLoop(); err != nil { - s.exitErr(err) - } -} - -func (s *Session) sendLoop() error { - defer close(s.sendDoneCh) - - // Extend the write deadline if we've passed the halfway point. This can - // be expensive so this ensures we only have to do this once every - // ConnectionWriteTimeout/2 (usually 5s). - var lastWriteDeadline time.Time - extendWriteDeadline := func() error { - now := time.Now() - // If over half of the deadline has elapsed, extend it. - if now.Add(s.config.ConnectionWriteTimeout / 2).After(lastWriteDeadline) { - lastWriteDeadline = now.Add(s.config.ConnectionWriteTimeout) - return s.conn.SetWriteDeadline(lastWriteDeadline) - } - return nil - } - - writer := s.conn - - // FIXME: https://github.com/libp2p/go-libp2p/issues/644 - // Write coalescing is disabled for now. - - //writer := pool.Writer{W: s.conn} - - //var writeTimeout *time.Timer - //var writeTimeoutCh <-chan time.Time - //if s.config.WriteCoalesceDelay > 0 { - // writeTimeout = time.NewTimer(s.config.WriteCoalesceDelay) - // defer writeTimeout.Stop() - - // writeTimeoutCh = writeTimeout.C - //} else { - // ch := make(chan time.Time) - // close(ch) - // writeTimeoutCh = ch - //} - - for { - // yield after processing the last message, if we've shutdown. - // s.sendCh is a buffered channel and Go doesn't guarantee select order. - select { - case <-s.shutdownCh: - return nil - default: - } - - // Flushes at least once every 100 microseconds unless we're - // constantly writing. - var buf []byte - select { - case buf = <-s.sendCh: - case <-s.shutdownCh: - return nil - //default: - // select { - // case buf = <-s.sendCh: - // case <-s.shutdownCh: - // return nil - // case <-writeTimeoutCh: - // if err := writer.Flush(); err != nil { - // if os.IsTimeout(err) { - // err = ErrConnectionWriteTimeout - // } - // return err - // } - - // select { - // case buf = <-s.sendCh: - // case <-s.shutdownCh: - // return nil - // } - - // if writeTimeout != nil { - // writeTimeout.Reset(s.config.WriteCoalesceDelay) - // } - // } - } - - if err := extendWriteDeadline(); err != nil { - pool.Put(buf) - return err - } - - _, err := writer.Write(buf) - pool.Put(buf) - - if err != nil { - if os.IsTimeout(err) { - err = ErrConnectionWriteTimeout - } - return err - } - } -} - -// recv is a long running goroutine that accepts new data -func (s *Session) recv() { - if err := s.recvLoop(); err != nil { - s.exitErr(err) - } -} - -// Ensure that the index of the handler (typeData/typeWindowUpdate/etc) matches the message type -var ( - handlers = []func(*Session, header) error{ - typeData: (*Session).handleStreamMessage, - typeWindowUpdate: (*Session).handleStreamMessage, - typePing: (*Session).handlePing, - typeGoAway: (*Session).handleGoAway, - } -) - -// recvLoop continues to receive data until a fatal error is encountered -func (s *Session) recvLoop() error { - defer close(s.recvDoneCh) - var hdr header - for { - // Read the header - if _, err := io.ReadFull(s.reader, hdr[:]); err != nil { - if err != io.EOF && !strings.Contains(err.Error(), "closed") && !strings.Contains(err.Error(), "reset by peer") { - s.logger.Printf("[ERR] yamux: Failed to read header: %v", err) - } - return err - } - - // Verify the version - if hdr.Version() != protoVersion { - s.logger.Printf("[ERR] yamux: Invalid protocol version: %d", hdr.Version()) - return ErrInvalidVersion - } - - mt := hdr.MsgType() - if mt < typeData || mt > typeGoAway { - return ErrInvalidMsgType - } - - if err := handlers[mt](s, hdr); err != nil { - return err - } - } -} - -// handleStreamMessage handles either a data or window update frame -func (s *Session) handleStreamMessage(hdr header) error { - // Check for a new stream creation - id := hdr.StreamID() - flags := hdr.Flags() - if flags&flagSYN == flagSYN { - if err := s.incomingStream(id); err != nil { - return err - } - } - - // Get the stream - s.streamLock.Lock() - stream := s.streams[id] - s.streamLock.Unlock() - - // If we do not have a stream, likely we sent a RST - if stream == nil { - // Drain any data on the wire - if hdr.MsgType() == typeData && hdr.Length() > 0 { - s.logger.Printf("[WARN] yamux: Discarding data for stream: %d", id) - if _, err := io.CopyN(ioutil.Discard, s.reader, int64(hdr.Length())); err != nil { - s.logger.Printf("[ERR] yamux: Failed to discard data: %v", err) - return nil - } - } else { - s.logger.Printf("[WARN] yamux: frame for missing stream: %v", hdr) - } - return nil - } - - // Check if this is a window update - if hdr.MsgType() == typeWindowUpdate { - if err := stream.incrSendWindow(hdr, flags); err != nil { - if sendErr := s.sendMsg(s.goAway(goAwayProtoErr), nil, nil); sendErr != nil { - s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr) - } - return err - } - return nil - } - - // Read the new data - if err := stream.readData(hdr, flags, s.reader); err != nil { - if sendErr := s.sendMsg(s.goAway(goAwayProtoErr), nil, nil); sendErr != nil { - s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr) - } - return err - } - return nil -} - -// handlePing is invokde for a typePing frame -func (s *Session) handlePing(hdr header) error { - flags := hdr.Flags() - pingID := hdr.Length() - - // Check if this is a query, respond back in a separate context so we - // don't interfere with the receiving thread blocking for the write. - if flags&flagSYN == flagSYN { - go func() { - hdr := encode(typePing, flagACK, 0, pingID) - if err := s.sendMsg(hdr, nil, nil); err != nil { - s.logger.Printf("[WARN] yamux: failed to send ping reply: %v", err) - } - }() - return nil - } - - // Handle a response - s.pingLock.Lock() - ch := s.pings[pingID] - if ch != nil { - delete(s.pings, pingID) - close(ch) - } - s.pingLock.Unlock() - return nil -} - -// handleGoAway is invokde for a typeGoAway frame -func (s *Session) handleGoAway(hdr header) error { - code := hdr.Length() - switch code { - case goAwayNormal: - atomic.SwapInt32(&s.remoteGoAway, 1) - case goAwayProtoErr: - s.logger.Printf("[ERR] yamux: received protocol error go away") - return fmt.Errorf("yamux protocol error") - case goAwayInternalErr: - s.logger.Printf("[ERR] yamux: received internal error go away") - return fmt.Errorf("remote yamux internal error") - default: - s.logger.Printf("[ERR] yamux: received unexpected go away") - return fmt.Errorf("unexpected go away received") - } - return nil -} - -// incomingStream is used to create a new incoming stream -func (s *Session) incomingStream(id uint32) error { - if s.client != (id%2 == 0) { - s.logger.Printf("[ERR] yamux: both endpoints are clients") - return fmt.Errorf("both yamux endpoints are clients") - } - // Reject immediately if we are doing a go away - if atomic.LoadInt32(&s.localGoAway) == 1 { - hdr := encode(typeWindowUpdate, flagRST, id, 0) - return s.sendMsg(hdr, nil, nil) - } - - // Allocate a new stream - stream := newStream(s, id, streamSYNReceived) - - s.streamLock.Lock() - defer s.streamLock.Unlock() - - // Check if stream already exists - if _, ok := s.streams[id]; ok { - s.logger.Printf("[ERR] yamux: duplicate stream declared") - if sendErr := s.sendMsg(s.goAway(goAwayProtoErr), nil, nil); sendErr != nil { - s.logger.Printf("[WARN] yamux: failed to send go away: %v", sendErr) - } - return ErrDuplicateStream - } - - // Register the stream - s.streams[id] = stream - - // Check if we've exceeded the backlog - select { - case s.acceptCh <- stream: - return nil - default: - // Backlog exceeded! RST the stream - s.logger.Printf("[WARN] yamux: backlog exceeded, forcing connection reset") - delete(s.streams, id) - hdr := encode(typeWindowUpdate, flagRST, id, 0) - return s.sendMsg(hdr, nil, nil) - } -} - -// closeStream is used to close a stream once both sides have -// issued a close. If there was an in-flight SYN and the stream -// was not yet established, then this will give the credit back. -func (s *Session) closeStream(id uint32) { - s.streamLock.Lock() - if _, ok := s.inflight[id]; ok { - select { - case <-s.synCh: - default: - s.logger.Printf("[ERR] yamux: SYN tracking out of sync") - } - } - delete(s.streams, id) - s.streamLock.Unlock() -} - -// establishStream is used to mark a stream that was in the -// SYN Sent state as established. -func (s *Session) establishStream(id uint32) { - s.streamLock.Lock() - if _, ok := s.inflight[id]; ok { - delete(s.inflight, id) - } else { - s.logger.Printf("[ERR] yamux: established stream without inflight SYN (no tracking entry)") - } - select { - case <-s.synCh: - default: - s.logger.Printf("[ERR] yamux: established stream without inflight SYN (didn't have semaphore)") - } - s.streamLock.Unlock() -} diff --git a/vendor/github.com/libp2p/go-yamux/spec.md b/vendor/github.com/libp2p/go-yamux/spec.md deleted file mode 100644 index 183d797b..00000000 --- a/vendor/github.com/libp2p/go-yamux/spec.md +++ /dev/null @@ -1,140 +0,0 @@ -# Specification - -We use this document to detail the internal specification of Yamux. -This is used both as a guide for implementing Yamux, but also for -alternative interoperable libraries to be built. - -# Framing - -Yamux uses a streaming connection underneath, but imposes a message -framing so that it can be shared between many logical streams. Each -frame contains a header like: - -* Version (8 bits) -* Type (8 bits) -* Flags (16 bits) -* StreamID (32 bits) -* Length (32 bits) - -This means that each header has a 12 byte overhead. -All fields are encoded in network order (big endian). -Each field is described below: - -## Version Field - -The version field is used for future backward compatibility. At the -current time, the field is always set to 0, to indicate the initial -version. - -## Type Field - -The type field is used to switch the frame message type. The following -message types are supported: - -* 0x0 Data - Used to transmit data. May transmit zero length payloads - depending on the flags. - -* 0x1 Window Update - Used to updated the senders receive window size. - This is used to implement per-session flow control. - -* 0x2 Ping - Used to measure RTT. It can also be used to heart-beat - and do keep-alives over TCP. - -* 0x3 Go Away - Used to close a session. - -## Flag Field - -The flags field is used to provide additional information related -to the message type. The following flags are supported: - -* 0x1 SYN - Signals the start of a new stream. May be sent with a data or - window update message. Also sent with a ping to indicate outbound. - -* 0x2 ACK - Acknowledges the start of a new stream. May be sent with a data - or window update message. Also sent with a ping to indicate response. - -* 0x4 FIN - Performs a half-close of a stream. May be sent with a data - message or window update. - -* 0x8 RST - Reset a stream immediately. May be sent with a data or - window update message. - -## StreamID Field - -The StreamID field is used to identify the logical stream the frame -is addressing. The client side should use odd ID's, and the server even. -This prevents any collisions. Additionally, the 0 ID is reserved to represent -the session. - -Both Ping and Go Away messages should always use the 0 StreamID. - -## Length Field - -The meaning of the length field depends on the message type: - -* Data - provides the length of bytes following the header -* Window update - provides a delta update to the window size -* Ping - Contains an opaque value, echoed back -* Go Away - Contains an error code - -# Message Flow - -There is no explicit connection setup, as Yamux relies on an underlying -transport to be provided. However, there is a distinction between client -and server side of the connection. - -## Opening a stream - -To open a stream, an initial data or window update frame is sent -with a new StreamID. The SYN flag should be set to signal a new stream. - -The receiver must then reply with either a data or window update frame -with the StreamID along with the ACK flag to accept the stream or with -the RST flag to reject the stream. - -Because we are relying on the reliable stream underneath, a connection -can begin sending data once the SYN flag is sent. The corresponding -ACK does not need to be received. This is particularly well suited -for an RPC system where a client wants to open a stream and immediately -fire a request without waiting for the RTT of the ACK. - -This does introduce the possibility of a connection being rejected -after data has been sent already. This is a slight semantic difference -from TCP, where the conection cannot be refused after it is opened. -Clients should be prepared to handle this by checking for an error -that indicates a RST was received. - -## Closing a stream - -To close a stream, either side sends a data or window update frame -along with the FIN flag. This does a half-close indicating the sender -will send no further data. - -Once both sides have closed the connection, the stream is closed. - -Alternatively, if an error occurs, the RST flag can be used to -hard close a stream immediately. - -## Flow Control - -When Yamux is initially starts each stream with a 256KB window size. -There is no window size for the session. - -To prevent the streams from stalling, window update frames should be -sent regularly. Yamux can be configured to provide a larger limit for -windows sizes. Both sides assume the initial 256KB window, but can -immediately send a window update as part of the SYN/ACK indicating a -larger window. - -Both sides should track the number of bytes sent in Data frames -only, as only they are tracked as part of the window size. - -## Session termination - -When a session is being terminated, the Go Away message should -be sent. The Length should be set to one of the following to -provide an error code: - -* 0x0 Normal termination -* 0x1 Protocol error -* 0x2 Internal error diff --git a/vendor/github.com/libp2p/go-yamux/stream.go b/vendor/github.com/libp2p/go-yamux/stream.go deleted file mode 100644 index 74ffe205..00000000 --- a/vendor/github.com/libp2p/go-yamux/stream.go +++ /dev/null @@ -1,473 +0,0 @@ -package yamux - -import ( - "io" - "sync" - "sync/atomic" - "time" - - "github.com/libp2p/go-buffer-pool" -) - -type streamState int - -const ( - streamInit streamState = iota - streamSYNSent - streamSYNReceived - streamEstablished - streamLocalClose - streamRemoteClose - streamClosed - streamReset -) - -// Stream is used to represent a logical stream -// within a session. -type Stream struct { - recvWindow uint32 - sendWindow uint32 - - id uint32 - session *Session - - state streamState - stateLock sync.Mutex - - recvLock sync.Mutex - recvBuf pool.Buffer - - sendLock sync.Mutex - - recvNotifyCh chan struct{} - sendNotifyCh chan struct{} - - readDeadline, writeDeadline pipeDeadline -} - -// newStream is used to construct a new stream within -// a given session for an ID -func newStream(session *Session, id uint32, state streamState) *Stream { - s := &Stream{ - id: id, - session: session, - state: state, - recvWindow: initialStreamWindow, - sendWindow: initialStreamWindow, - readDeadline: makePipeDeadline(), - writeDeadline: makePipeDeadline(), - recvNotifyCh: make(chan struct{}, 1), - sendNotifyCh: make(chan struct{}, 1), - } - return s -} - -// Session returns the associated stream session -func (s *Stream) Session() *Session { - return s.session -} - -// StreamID returns the ID of this stream -func (s *Stream) StreamID() uint32 { - return s.id -} - -// Read is used to read from the stream -func (s *Stream) Read(b []byte) (n int, err error) { - defer asyncNotify(s.recvNotifyCh) -START: - s.stateLock.Lock() - switch s.state { - case streamRemoteClose: - fallthrough - case streamClosed: - s.recvLock.Lock() - if s.recvBuf.Len() == 0 { - s.recvLock.Unlock() - s.stateLock.Unlock() - return 0, io.EOF - } - s.recvLock.Unlock() - case streamReset: - s.stateLock.Unlock() - return 0, ErrConnectionReset - } - s.stateLock.Unlock() - - // If there is no data available, block - s.recvLock.Lock() - if s.recvBuf.Len() == 0 { - s.recvLock.Unlock() - goto WAIT - } - - // Read any bytes - n, _ = s.recvBuf.Read(b) - s.recvLock.Unlock() - - // Send a window update potentially - err = s.sendWindowUpdate() - return n, err - -WAIT: - select { - case <-s.recvNotifyCh: - goto START - case <-s.readDeadline.wait(): - return 0, ErrTimeout - } -} - -// Write is used to write to the stream -func (s *Stream) Write(b []byte) (n int, err error) { - s.sendLock.Lock() - defer s.sendLock.Unlock() - total := 0 - - for total < len(b) { - n, err := s.write(b[total:]) - total += n - if err != nil { - return total, err - } - } - return total, nil -} - -// write is used to write to the stream, may return on -// a short write. -func (s *Stream) write(b []byte) (n int, err error) { - var flags uint16 - var max uint32 - var hdr header - -START: - s.stateLock.Lock() - switch s.state { - case streamLocalClose: - fallthrough - case streamClosed: - s.stateLock.Unlock() - return 0, ErrStreamClosed - case streamReset: - s.stateLock.Unlock() - return 0, ErrConnectionReset - } - s.stateLock.Unlock() - - // If there is no data available, block - window := atomic.LoadUint32(&s.sendWindow) - if window == 0 { - goto WAIT - } - - // Determine the flags if any - flags = s.sendFlags() - - // Send up to min(message, window - max = min(window, s.session.config.MaxMessageSize-headerSize, uint32(len(b))) - - // Send the header - hdr = encode(typeData, flags, s.id, max) - if err = s.session.sendMsg(hdr, b[:max], s.writeDeadline.wait()); err != nil { - return 0, err - } - - // Reduce our send window - atomic.AddUint32(&s.sendWindow, ^uint32(max-1)) - - // Unlock - return int(max), err - -WAIT: - select { - case <-s.sendNotifyCh: - goto START - case <-s.writeDeadline.wait(): - return 0, ErrTimeout - } -} - -// sendFlags determines any flags that are appropriate -// based on the current stream state -func (s *Stream) sendFlags() uint16 { - s.stateLock.Lock() - defer s.stateLock.Unlock() - var flags uint16 - switch s.state { - case streamInit: - flags |= flagSYN - s.state = streamSYNSent - case streamSYNReceived: - flags |= flagACK - s.state = streamEstablished - } - return flags -} - -// sendWindowUpdate potentially sends a window update enabling -// further writes to take place. Must be invoked with the lock. -func (s *Stream) sendWindowUpdate() error { - // Determine the delta update - max := s.session.config.MaxStreamWindowSize - s.recvLock.Lock() - delta := (max - uint32(s.recvBuf.Len())) - s.recvWindow - - // Determine the flags if any - flags := s.sendFlags() - - // Check if we can omit the update - if delta < (max/2) && flags == 0 { - s.recvLock.Unlock() - return nil - } - - // Update our window - s.recvWindow += delta - s.recvLock.Unlock() - - // Send the header - hdr := encode(typeWindowUpdate, flags, s.id, delta) - if err := s.session.sendMsg(hdr, nil, nil); err != nil { - return err - } - return nil -} - -// sendClose is used to send a FIN -func (s *Stream) sendClose() error { - flags := s.sendFlags() - flags |= flagFIN - hdr := encode(typeWindowUpdate, flags, s.id, 0) - return s.session.sendMsg(hdr, nil, nil) -} - -// sendReset is used to send a RST -func (s *Stream) sendReset() error { - hdr := encode(typeWindowUpdate, flagRST, s.id, 0) - return s.session.sendMsg(hdr, nil, nil) -} - -// Reset resets the stream (forcibly closes the stream) -func (s *Stream) Reset() error { - s.stateLock.Lock() - switch s.state { - case streamInit: - // No need to send anything. - s.state = streamReset - s.stateLock.Unlock() - return nil - case streamClosed, streamReset: - s.stateLock.Unlock() - return nil - case streamSYNSent, streamSYNReceived, streamEstablished: - case streamLocalClose, streamRemoteClose: - default: - panic("unhandled state") - } - s.state = streamReset - s.stateLock.Unlock() - - err := s.sendReset() - s.notifyWaiting() - s.cleanup() - - return err -} - -// Close is used to close the stream -func (s *Stream) Close() error { - closeStream := false - s.stateLock.Lock() - switch s.state { - case streamInit, streamSYNSent, streamSYNReceived, streamEstablished: - s.state = streamLocalClose - goto SEND_CLOSE - - case streamLocalClose: - case streamRemoteClose: - s.state = streamClosed - closeStream = true - goto SEND_CLOSE - - case streamClosed: - case streamReset: - default: - panic("unhandled state") - } - s.stateLock.Unlock() - return nil -SEND_CLOSE: - s.stateLock.Unlock() - err := s.sendClose() - s.notifyWaiting() - if closeStream { - s.cleanup() - } - return err -} - -// forceClose is used for when the session is exiting -func (s *Stream) forceClose() { - s.stateLock.Lock() - switch s.state { - case streamClosed: - // Already successfully closed. It just hasn't been removed from - // the list of streams yet. - default: - s.state = streamReset - } - s.stateLock.Unlock() - s.notifyWaiting() - - s.readDeadline.set(time.Time{}) - s.readDeadline.set(time.Time{}) -} - -// called when fully closed to release any system resources. -func (s *Stream) cleanup() { - s.session.closeStream(s.id) - s.readDeadline.set(time.Time{}) - s.readDeadline.set(time.Time{}) -} - -// processFlags is used to update the state of the stream -// based on set flags, if any. Lock must be held -func (s *Stream) processFlags(flags uint16) error { - // Close the stream without holding the state lock - closeStream := false - defer func() { - if closeStream { - s.cleanup() - } - }() - - s.stateLock.Lock() - defer s.stateLock.Unlock() - if flags&flagACK == flagACK { - if s.state == streamSYNSent { - s.state = streamEstablished - } - s.session.establishStream(s.id) - } - if flags&flagFIN == flagFIN { - switch s.state { - case streamSYNSent: - fallthrough - case streamSYNReceived: - fallthrough - case streamEstablished: - s.state = streamRemoteClose - s.notifyWaiting() - case streamLocalClose: - s.state = streamClosed - closeStream = true - s.notifyWaiting() - default: - s.session.logger.Printf("[ERR] yamux: unexpected FIN flag in state %d", s.state) - return ErrUnexpectedFlag - } - } - if flags&flagRST == flagRST { - s.state = streamReset - closeStream = true - s.notifyWaiting() - } - return nil -} - -// notifyWaiting notifies all the waiting channels -func (s *Stream) notifyWaiting() { - asyncNotify(s.recvNotifyCh) - asyncNotify(s.sendNotifyCh) -} - -// incrSendWindow updates the size of our send window -func (s *Stream) incrSendWindow(hdr header, flags uint16) error { - if err := s.processFlags(flags); err != nil { - return err - } - - // Increase window, unblock a sender - atomic.AddUint32(&s.sendWindow, hdr.Length()) - asyncNotify(s.sendNotifyCh) - return nil -} - -// readData is used to handle a data frame -func (s *Stream) readData(hdr header, flags uint16, conn io.Reader) error { - if err := s.processFlags(flags); err != nil { - return err - } - - // Check that our recv window is not exceeded - length := hdr.Length() - if length == 0 { - return nil - } - - // Wrap in a limited reader - conn = &io.LimitedReader{R: conn, N: int64(length)} - - // Copy into buffer - s.recvLock.Lock() - - if length > s.recvWindow { - s.session.logger.Printf("[ERR] yamux: receive window exceeded (stream: %d, remain: %d, recv: %d)", s.id, s.recvWindow, length) - return ErrRecvWindowExceeded - } - - s.recvBuf.Grow(int(length)) - if _, err := io.Copy(&s.recvBuf, conn); err != nil { - s.session.logger.Printf("[ERR] yamux: Failed to read stream data: %v", err) - s.recvLock.Unlock() - return err - } - - // Decrement the receive window - s.recvWindow -= length - s.recvLock.Unlock() - - // Unblock any readers - asyncNotify(s.recvNotifyCh) - return nil -} - -// SetDeadline sets the read and write deadlines -func (s *Stream) SetDeadline(t time.Time) error { - if err := s.SetReadDeadline(t); err != nil { - return err - } - if err := s.SetWriteDeadline(t); err != nil { - return err - } - return nil -} - -// SetReadDeadline sets the deadline for future Read calls. -func (s *Stream) SetReadDeadline(t time.Time) error { - s.stateLock.Lock() - defer s.stateLock.Unlock() - switch s.state { - case streamClosed, streamRemoteClose, streamReset: - return nil - } - s.readDeadline.set(t) - return nil -} - -// SetWriteDeadline sets the deadline for future Write calls -func (s *Stream) SetWriteDeadline(t time.Time) error { - s.stateLock.Lock() - defer s.stateLock.Unlock() - switch s.state { - case streamClosed, streamLocalClose, streamReset: - return nil - } - s.writeDeadline.set(t) - return nil -} - -// Shrink is a no-op. The internal buffer automatically shrinks itself. -func (s *Stream) Shrink() { -} diff --git a/vendor/github.com/libp2p/go-yamux/util.go b/vendor/github.com/libp2p/go-yamux/util.go deleted file mode 100644 index b7e427fd..00000000 --- a/vendor/github.com/libp2p/go-yamux/util.go +++ /dev/null @@ -1,31 +0,0 @@ -package yamux - -// asyncSendErr is used to try an async send of an error -func asyncSendErr(ch chan error, err error) { - if ch == nil { - return - } - select { - case ch <- err: - default: - } -} - -// asyncNotify is used to signal a waiting goroutine -func asyncNotify(ch chan struct{}) { - select { - case ch <- struct{}{}: - default: - } -} - -// min computes the minimum of a set of values -func min(values ...uint32) uint32 { - m := values[0] - for _, v := range values[1:] { - if v < m { - m = v - } - } - return m -} diff --git a/vendor/github.com/lucas-clemente/quic-go/.editorconfig b/vendor/github.com/lucas-clemente/quic-go/.editorconfig deleted file mode 100644 index 538ba2b2..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/.editorconfig +++ /dev/null @@ -1,5 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 2 diff --git a/vendor/github.com/lucas-clemente/quic-go/.gitignore b/vendor/github.com/lucas-clemente/quic-go/.gitignore deleted file mode 100644 index 040b55ac..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -debug -debug.test -main diff --git a/vendor/github.com/lucas-clemente/quic-go/.golangci.yml b/vendor/github.com/lucas-clemente/quic-go/.golangci.yml deleted file mode 100644 index eb9de2f3..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/.golangci.yml +++ /dev/null @@ -1,25 +0,0 @@ -run: - skip-files: - - h2quic/response_writer_closenotifier.go - - internal/handshake/unsafe_test.go - -linters-settings: - misspell: - ignore-words: - - ect - -linters: - disable-all: true - enable: - - deadcode - - goconst - - goimports - - gosimple - - ineffassign - - misspell - - staticcheck - - structcheck - - unconvert - - unused - - varcheck - - vet diff --git a/vendor/github.com/lucas-clemente/quic-go/.travis.yml b/vendor/github.com/lucas-clemente/quic-go/.travis.yml deleted file mode 100644 index a57287e6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -dist: trusty -group: travis_latest - -language: go - -go: - - "1.12.x" - -# first part of the GOARCH workaround -# setting the GOARCH directly doesn't work, since the value will be overwritten later -# so set it to a temporary environment variable first -env: - global: - - TIMESCALE_FACTOR=20 - - GO111MODULE=on - matrix: - - TRAVIS_GOARCH=amd64 TESTMODE=lint - - TRAVIS_GOARCH=amd64 TESTMODE=unit - - TRAVIS_GOARCH=amd64 TESTMODE=integration - - TRAVIS_GOARCH=386 TESTMODE=unit - - TRAVIS_GOARCH=386 TESTMODE=integration - - -# second part of the GOARCH workaround -# now actually set the GOARCH env variable to the value of the temporary variable set earlier -before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/onsi/ginkgo/ginkgo - - go get github.com/onsi/gomega - - export GOARCH=$TRAVIS_GOARCH - - go env # for debugging - - "export DISPLAY=:99.0" - - "Xvfb $DISPLAY &> /dev/null &" - -script: - - .travis/script.sh - -after_success: - - .travis/after_success.sh diff --git a/vendor/github.com/lucas-clemente/quic-go/Changelog.md b/vendor/github.com/lucas-clemente/quic-go/Changelog.md deleted file mode 100644 index 47b115dc..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/Changelog.md +++ /dev/null @@ -1,52 +0,0 @@ -# Changelog - -## v0.11.0 (2019-04-05) - -- Drop support for gQUIC. For qQUIC support, please switch to the *gquic* branch. -- Implement QUIC WG draft-19. -- Use [qtls](https://github.com/marten-seemann/qtls) for TLS 1.3. -- Return a `tls.ConnectionState` from `quic.Session.ConnectionState()`. -- Remove the error return values from `quic.Stream.CancelRead()` and `quic.Stream.CancelWrite()` - -## v0.10.0 (2018-08-28) - -- Add support for QUIC 44, drop support for QUIC 42. - -## v0.9.0 (2018-08-15) - -- Add a `quic.Config` option for the length of the connection ID (for IETF QUIC). -- Split Session.Close into one method for regular closing and one for closing with an error. - -## v0.8.0 (2018-06-26) - -- Add support for unidirectional streams (for IETF QUIC). -- Add a `quic.Config` option for the maximum number of incoming streams. -- Add support for QUIC 42 and 43. -- Add dial functions that use a context. -- Multiplex clients on a net.PacketConn, when using Dial(conn). - -## v0.7.0 (2018-02-03) - -- The lower boundary for packets included in ACKs is now derived, and the value sent in STOP_WAITING frames is ignored. -- Remove `DialNonFWSecure` and `DialAddrNonFWSecure`. -- Expose the `ConnectionState` in the `Session` (experimental API). -- Implement packet pacing. - -## v0.6.0 (2017-12-12) - -- Add support for QUIC 39, drop support for QUIC 35 - 37 -- Added `quic.Config` options for maximal flow control windows -- Add a `quic.Config` option for QUIC versions -- Add a `quic.Config` option to request omission of the connection ID from a server -- Add a `quic.Config` option to configure the source address validation -- Add a `quic.Config` option to configure the handshake timeout -- Add a `quic.Config` option to configure the idle timeout -- Add a `quic.Config` option to configure keep-alive -- Rename the STK to Cookie -- Implement `net.Conn`-style deadlines for streams -- Remove the `tls.Config` from the `quic.Config`. The `tls.Config` must now be passed to the `Dial` and `Listen` functions as a separate parameter. See the [Godoc](https://godoc.org/github.com/lucas-clemente/quic-go) for details. -- Changed the log level environment variable to only accept strings ("DEBUG", "INFO", "ERROR"), see [the wiki](https://github.com/lucas-clemente/quic-go/wiki/Logging) for more details. -- Rename the `h2quic.QuicRoundTripper` to `h2quic.RoundTripper` -- Changed `h2quic.Server.Serve()` to accept a `net.PacketConn` -- Drop support for Go 1.7 and 1.8. -- Various bugfixes diff --git a/vendor/github.com/lucas-clemente/quic-go/LICENSE b/vendor/github.com/lucas-clemente/quic-go/LICENSE deleted file mode 100644 index 51378bef..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 the quic-go authors & Google, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/lucas-clemente/quic-go/README.md b/vendor/github.com/lucas-clemente/quic-go/README.md deleted file mode 100644 index 19f987a4..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# A QUIC implementation in pure Go - - - -[![Godoc Reference](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/lucas-clemente/quic-go) -[![Travis Build Status](https://img.shields.io/travis/lucas-clemente/quic-go/master.svg?style=flat-square&label=Travis+build)](https://travis-ci.org/lucas-clemente/quic-go) -[![CircleCI Build Status](https://img.shields.io/circleci/project/github/lucas-clemente/quic-go.svg?style=flat-square&label=CircleCI+build)](https://circleci.com/gh/lucas-clemente/quic-go) -[![Windows Build Status](https://img.shields.io/appveyor/ci/lucas-clemente/quic-go/master.svg?style=flat-square&label=windows+build)](https://ci.appveyor.com/project/lucas-clemente/quic-go/branch/master) -[![Code Coverage](https://img.shields.io/codecov/c/github/lucas-clemente/quic-go/master.svg?style=flat-square)](https://codecov.io/gh/lucas-clemente/quic-go/) - -quic-go is an implementation of the [QUIC](https://en.wikipedia.org/wiki/QUIC) protocol in Go. It roughly implements the [IETF QUIC draft](https://github.com/quicwg/base-drafts), although we don't fully support any of the draft versions at the moment. - -## Version compatibility - -Since quic-go is under active development, there's no guarantee that two builds of different commits are interoperable. The QUIC version used in the *master* branch is just a placeholder, and should not be considered stable. - -If you want to use quic-go as a library in other projects, please consider using a [tagged release](https://github.com/lucas-clemente/quic-go/releases). These releases expose [experimental QUIC versions](https://github.com/quicwg/base-drafts/wiki/QUIC-Versions), which are guaranteed to be stable. - -## Google QUIC - -quic-go used to support both the QUIC versions supported by Google Chrome and QUIC as deployed on Google's servers, as well as IETF QUIC. Due to the divergence of the two protocols, we decided to not support both versions any more. - -The *master* branch **only** supports IETF QUIC. For Google QUIC support, please refer to the [gquic branch](https://github.com/lucas-clemente/quic-go/tree/gquic). - -## Guides - -We currently support Go 1.12+. - -Installing and updating dependencies: - - go get -t -u ./... - -Running tests: - - go test ./... - -### HTTP mapping - -We're currently not implementing the HTTP mapping as described in the [QUIC over HTTP draft](https://quicwg.org/base-drafts/draft-ietf-quic-http.html). The HTTP mapping here is a leftover from Google QUIC. - -### QUIC without HTTP/2 - -Take a look at [this echo example](example/echo/echo.go). - -## Usage - -### As a server - -See the [example server](example/main.go). Starting a QUIC server is very similar to the standard lib http in go: - -```go -http.Handle("/", http.FileServer(http.Dir(wwwDir))) -h2quic.ListenAndServeQUIC("localhost:4242", "/path/to/cert/chain.pem", "/path/to/privkey.pem", nil) -``` - -### As a client - -See the [example client](example/client/main.go). Use a `h2quic.RoundTripper` as a `Transport` in a `http.Client`. - -```go -http.Client{ - Transport: &h2quic.RoundTripper{}, -} -``` - -## Contributing - -We are always happy to welcome new contributors! We have a number of self-contained issues that are suitable for first-time contributors, they are tagged with [help wanted](https://github.com/lucas-clemente/quic-go/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). If you have any questions, please feel free to reach out by opening an issue or leaving a comment. diff --git a/vendor/github.com/lucas-clemente/quic-go/appveyor.yml b/vendor/github.com/lucas-clemente/quic-go/appveyor.yml deleted file mode 100644 index 9ecd2d04..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/appveyor.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: "{build}" - -os: Windows Server 2012 R2 - -environment: - GOPATH: c:\gopath - CGO_ENABLED: 0 - TIMESCALE_FACTOR: 20 - matrix: - - GOARCH: 386 - - GOARCH: amd64 - -clone_folder: c:\gopath\src\github.com\lucas-clemente\quic-go - -install: - - rmdir c:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go1.12.windows-amd64.zip - - 7z x go1.12.windows-amd64.zip -y -oC:\ > NUL - - set PATH=%PATH%;%GOPATH%\bin\windows_%GOARCH%;%GOPATH%\bin - - set GO111MODULE=on - - echo %PATH% - - echo %GOPATH% - - go get github.com/onsi/ginkgo/ginkgo - - go get github.com/onsi/gomega - - go version - - go env - -build_script: - - ginkgo -r -v -randomizeAllSpecs -randomizeSuites -trace -skipPackage benchmark,integrationtests - - ginkgo -randomizeAllSpecs -randomizeSuites -trace benchmark -- -samples=1 - -test: off - -deploy: off diff --git a/vendor/github.com/lucas-clemente/quic-go/buffer_pool.go b/vendor/github.com/lucas-clemente/quic-go/buffer_pool.go deleted file mode 100644 index d6fb7673..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/buffer_pool.go +++ /dev/null @@ -1,75 +0,0 @@ -package quic - -import ( - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -type packetBuffer struct { - Slice []byte - - // refCount counts how many packets the Slice is used in. - // It doesn't support concurrent use. - // It is > 1 when used for coalesced packet. - refCount int -} - -// Split increases the refCount. -// It must be called when a packet buffer is used for more than one packet, -// e.g. when splitting coalesced packets. -func (b *packetBuffer) Split() { - b.refCount++ -} - -// Decrement decrements the reference counter. -// It doesn't put the buffer back into the pool. -func (b *packetBuffer) Decrement() { - b.refCount-- - if b.refCount < 0 { - panic("negative packetBuffer refCount") - } -} - -// MaybeRelease puts the packet buffer back into the pool, -// if the reference counter already reached 0. -func (b *packetBuffer) MaybeRelease() { - // only put the packetBuffer back if it's not used any more - if b.refCount == 0 { - b.putBack() - } -} - -// Release puts back the packet buffer into the pool. -// It should be called when processing is definitely finished. -func (b *packetBuffer) Release() { - b.Decrement() - if b.refCount != 0 { - panic("packetBuffer refCount not zero") - } - b.putBack() -} - -func (b *packetBuffer) putBack() { - if cap(b.Slice) != int(protocol.MaxReceivePacketSize) { - panic("putPacketBuffer called with packet of wrong size!") - } - bufferPool.Put(b) -} - -var bufferPool sync.Pool - -func getPacketBuffer() *packetBuffer { - buf := bufferPool.Get().(*packetBuffer) - buf.refCount = 1 - buf.Slice = buf.Slice[:protocol.MaxReceivePacketSize] - return buf -} - -func init() { - bufferPool.New = func() interface{} { - return &packetBuffer{ - Slice: make([]byte, 0, protocol.MaxReceivePacketSize), - } - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/client.go b/vendor/github.com/lucas-clemente/quic-go/client.go deleted file mode 100644 index 9ede391f..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/client.go +++ /dev/null @@ -1,413 +0,0 @@ -package quic - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "sync" - - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type client struct { - mutex sync.Mutex - - conn connection - // If the client is created with DialAddr, we create a packet conn. - // If it is started with Dial, we take a packet conn as a parameter. - createdPacketConn bool - - packetHandlers packetHandlerManager - - versionNegotiated utils.AtomicBool // has the server accepted our version - receivedVersionNegotiationPacket bool - negotiatedVersions []protocol.VersionNumber // the list of versions from the version negotiation packet - - tlsConf *tls.Config - config *Config - - srcConnID protocol.ConnectionID - destConnID protocol.ConnectionID - - initialPacketNumber protocol.PacketNumber - - initialVersion protocol.VersionNumber - version protocol.VersionNumber - - handshakeChan chan struct{} - - session quicSession - - logger utils.Logger -} - -var _ packetHandler = &client{} - -var ( - // make it possible to mock connection ID generation in the tests - generateConnectionID = protocol.GenerateConnectionID - generateConnectionIDForInitial = protocol.GenerateConnectionIDForInitial -) - -// DialAddr establishes a new QUIC connection to a server. -// It uses a new UDP connection and closes this connection when the QUIC session is closed. -// The hostname for SNI is taken from the given address. -func DialAddr( - addr string, - tlsConf *tls.Config, - config *Config, -) (Session, error) { - return DialAddrContext(context.Background(), addr, tlsConf, config) -} - -// DialAddrContext establishes a new QUIC connection to a server using the provided context. -// See DialAddr for details. -func DialAddrContext( - ctx context.Context, - addr string, - tlsConf *tls.Config, - config *Config, -) (Session, error) { - udpAddr, err := net.ResolveUDPAddr("udp", addr) - if err != nil { - return nil, err - } - udpConn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0}) - if err != nil { - return nil, err - } - return dialContext(ctx, udpConn, udpAddr, addr, tlsConf, config, true) -} - -// Dial establishes a new QUIC connection to a server using a net.PacketConn. -// The same PacketConn can be used for multiple calls to Dial and Listen, -// QUIC connection IDs are used for demultiplexing the different connections. -// The host parameter is used for SNI. -func Dial( - pconn net.PacketConn, - remoteAddr net.Addr, - host string, - tlsConf *tls.Config, - config *Config, -) (Session, error) { - return DialContext(context.Background(), pconn, remoteAddr, host, tlsConf, config) -} - -// DialContext establishes a new QUIC connection to a server using a net.PacketConn using the provided context. -// See Dial for details. -func DialContext( - ctx context.Context, - pconn net.PacketConn, - remoteAddr net.Addr, - host string, - tlsConf *tls.Config, - config *Config, -) (Session, error) { - return dialContext(ctx, pconn, remoteAddr, host, tlsConf, config, false) -} - -func dialContext( - ctx context.Context, - pconn net.PacketConn, - remoteAddr net.Addr, - host string, - tlsConf *tls.Config, - config *Config, - createdPacketConn bool, -) (Session, error) { - config = populateClientConfig(config, createdPacketConn) - packetHandlers, err := getMultiplexer().AddConn(pconn, config.ConnectionIDLength, config.StatelessResetKey) - if err != nil { - return nil, err - } - c, err := newClient(pconn, remoteAddr, config, tlsConf, host, createdPacketConn) - if err != nil { - return nil, err - } - c.packetHandlers = packetHandlers - if err := c.dial(ctx); err != nil { - return nil, err - } - return c.session, nil -} - -func newClient( - pconn net.PacketConn, - remoteAddr net.Addr, - config *Config, - tlsConf *tls.Config, - host string, - createdPacketConn bool, -) (*client, error) { - if tlsConf == nil { - tlsConf = &tls.Config{} - } - if tlsConf.ServerName == "" { - var err error - tlsConf.ServerName, _, err = net.SplitHostPort(host) - if err != nil { - return nil, err - } - } - - // check that all versions are actually supported - if config != nil { - for _, v := range config.Versions { - if !protocol.IsValidVersion(v) { - return nil, fmt.Errorf("%s is not a valid QUIC version", v) - } - } - } - - srcConnID, err := generateConnectionID(config.ConnectionIDLength) - if err != nil { - return nil, err - } - destConnID, err := generateConnectionIDForInitial() - if err != nil { - return nil, err - } - c := &client{ - srcConnID: srcConnID, - destConnID: destConnID, - conn: &conn{pconn: pconn, currentAddr: remoteAddr}, - createdPacketConn: createdPacketConn, - tlsConf: tlsConf, - config: config, - version: config.Versions[0], - handshakeChan: make(chan struct{}), - logger: utils.DefaultLogger.WithPrefix("client"), - } - return c, nil -} - -// populateClientConfig populates fields in the quic.Config with their default values, if none are set -// it may be called with nil -func populateClientConfig(config *Config, createdPacketConn bool) *Config { - if config == nil { - config = &Config{} - } - versions := config.Versions - if len(versions) == 0 { - versions = protocol.SupportedVersions - } - - handshakeTimeout := protocol.DefaultHandshakeTimeout - if config.HandshakeTimeout != 0 { - handshakeTimeout = config.HandshakeTimeout - } - idleTimeout := protocol.DefaultIdleTimeout - if config.IdleTimeout != 0 { - idleTimeout = config.IdleTimeout - } - - maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow - if maxReceiveStreamFlowControlWindow == 0 { - maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow - } - maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow - if maxReceiveConnectionFlowControlWindow == 0 { - maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow - } - maxIncomingStreams := config.MaxIncomingStreams - if maxIncomingStreams == 0 { - maxIncomingStreams = protocol.DefaultMaxIncomingStreams - } else if maxIncomingStreams < 0 { - maxIncomingStreams = 0 - } - maxIncomingUniStreams := config.MaxIncomingUniStreams - if maxIncomingUniStreams == 0 { - maxIncomingUniStreams = protocol.DefaultMaxIncomingUniStreams - } else if maxIncomingUniStreams < 0 { - maxIncomingUniStreams = 0 - } - connIDLen := config.ConnectionIDLength - if connIDLen == 0 && !createdPacketConn { - connIDLen = protocol.DefaultConnectionIDLength - } - - return &Config{ - Versions: versions, - HandshakeTimeout: handshakeTimeout, - IdleTimeout: idleTimeout, - ConnectionIDLength: connIDLen, - MaxReceiveStreamFlowControlWindow: maxReceiveStreamFlowControlWindow, - MaxReceiveConnectionFlowControlWindow: maxReceiveConnectionFlowControlWindow, - MaxIncomingStreams: maxIncomingStreams, - MaxIncomingUniStreams: maxIncomingUniStreams, - KeepAlive: config.KeepAlive, - StatelessResetKey: config.StatelessResetKey, - } -} - -func (c *client) dial(ctx context.Context) error { - c.logger.Infof("Starting new connection to %s (%s -> %s), source connection ID %s, destination connection ID %s, version %s", c.tlsConf.ServerName, c.conn.LocalAddr(), c.conn.RemoteAddr(), c.srcConnID, c.destConnID, c.version) - - if err := c.createNewTLSSession(c.version); err != nil { - return err - } - err := c.establishSecureConnection(ctx) - if err == errCloseForRecreating { - return c.dial(ctx) - } - return err -} - -// establishSecureConnection runs the session, and tries to establish a secure connection -// It returns: -// - errCloseForRecreating when the server sends a version negotiation packet -// - any other error that might occur -// - when the connection is forward-secure -func (c *client) establishSecureConnection(ctx context.Context) error { - errorChan := make(chan error, 1) - - go func() { - err := c.session.run() // returns as soon as the session is closed - if err != errCloseForRecreating && c.createdPacketConn { - c.packetHandlers.Close() - } - errorChan <- err - }() - - select { - case <-ctx.Done(): - // The session will send a PeerGoingAway error to the server. - c.session.Close() - return ctx.Err() - case err := <-errorChan: - return err - case <-c.handshakeChan: - // handshake successfully completed - return nil - } -} - -func (c *client) handlePacket(p *receivedPacket) { - if wire.IsVersionNegotiationPacket(p.data) { - go c.handleVersionNegotiationPacket(p) - return - } - - // this is the first packet we are receiving - // since it is not a Version Negotiation Packet, this means the server supports the suggested version - if !c.versionNegotiated.Get() { - c.versionNegotiated.Set(true) - } - - c.session.handlePacket(p) -} - -func (c *client) handleVersionNegotiationPacket(p *receivedPacket) { - c.mutex.Lock() - defer c.mutex.Unlock() - - hdr, _, _, err := wire.ParsePacket(p.data, 0) - if err != nil { - c.logger.Debugf("Error parsing Version Negotiation packet: %s", err) - return - } - - // ignore delayed / duplicated version negotiation packets - if c.receivedVersionNegotiationPacket || c.versionNegotiated.Get() { - c.logger.Debugf("Received a delayed Version Negotiation packet.") - return - } - - for _, v := range hdr.SupportedVersions { - if v == c.version { - // The Version Negotiation packet contains the version that we offered. - // This might be a packet sent by an attacker (or by a terribly broken server implementation). - return - } - } - - c.logger.Infof("Received a Version Negotiation packet. Supported Versions: %s", hdr.SupportedVersions) - newVersion, ok := protocol.ChooseSupportedVersion(c.config.Versions, hdr.SupportedVersions) - if !ok { - c.session.destroy(fmt.Errorf("No compatible QUIC version found. We support %s, server offered %s", c.config.Versions, hdr.SupportedVersions)) - c.logger.Debugf("No compatible QUIC version found.") - return - } - c.receivedVersionNegotiationPacket = true - c.negotiatedVersions = hdr.SupportedVersions - - // switch to negotiated version - c.initialVersion = c.version - c.version = newVersion - - c.logger.Infof("Switching to QUIC version %s. New connection ID: %s", newVersion, c.destConnID) - c.initialPacketNumber = c.session.closeForRecreating() -} - -func (c *client) createNewTLSSession(version protocol.VersionNumber) error { - params := &handshake.TransportParameters{ - InitialMaxStreamDataBidiRemote: protocol.InitialMaxStreamData, - InitialMaxStreamDataBidiLocal: protocol.InitialMaxStreamData, - InitialMaxStreamDataUni: protocol.InitialMaxStreamData, - InitialMaxData: protocol.InitialMaxData, - IdleTimeout: c.config.IdleTimeout, - MaxBidiStreams: uint64(c.config.MaxIncomingStreams), - MaxUniStreams: uint64(c.config.MaxIncomingUniStreams), - AckDelayExponent: protocol.AckDelayExponent, - DisableMigration: true, - } - - c.mutex.Lock() - defer c.mutex.Unlock() - runner := &runner{ - packetHandlerManager: c.packetHandlers, - onHandshakeCompleteImpl: func(_ Session) { close(c.handshakeChan) }, - } - sess, err := newClientSession( - c.conn, - runner, - c.destConnID, - c.srcConnID, - c.config, - c.tlsConf, - c.initialPacketNumber, - params, - c.initialVersion, - c.logger, - c.version, - ) - if err != nil { - return err - } - c.session = sess - c.packetHandlers.Add(c.srcConnID, c) - return nil -} - -func (c *client) Close() error { - c.mutex.Lock() - defer c.mutex.Unlock() - if c.session == nil { - return nil - } - return c.session.Close() -} - -func (c *client) destroy(e error) { - c.mutex.Lock() - defer c.mutex.Unlock() - if c.session == nil { - return - } - c.session.destroy(e) -} - -func (c *client) GetVersion() protocol.VersionNumber { - c.mutex.Lock() - v := c.version - c.mutex.Unlock() - return v -} - -func (c *client) getPerspective() protocol.Perspective { - return protocol.PerspectiveClient -} diff --git a/vendor/github.com/lucas-clemente/quic-go/codecov.yml b/vendor/github.com/lucas-clemente/quic-go/codecov.yml deleted file mode 100644 index f077c1ad..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/codecov.yml +++ /dev/null @@ -1,18 +0,0 @@ -coverage: - round: nearest - ignore: - - streams_map_incoming_bidi.go - - streams_map_incoming_uni.go - - streams_map_outgoing_bidi.go - - streams_map_outgoing_uni.go - - h2quic/gzipreader.go - - h2quic/response.go - - internal/ackhandler/packet_linkedlist.go - - internal/utils/byteinterval_linkedlist.go - - internal/utils/packetinterval_linkedlist.go - - internal/utils/linkedlist/linkedlist.go - status: - project: - default: - threshold: 0.5 - patch: false diff --git a/vendor/github.com/lucas-clemente/quic-go/conn.go b/vendor/github.com/lucas-clemente/quic-go/conn.go deleted file mode 100644 index 700c1471..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/conn.go +++ /dev/null @@ -1,54 +0,0 @@ -package quic - -import ( - "net" - "sync" -) - -type connection interface { - Write([]byte) error - Read([]byte) (int, net.Addr, error) - Close() error - LocalAddr() net.Addr - RemoteAddr() net.Addr - SetCurrentRemoteAddr(net.Addr) -} - -type conn struct { - mutex sync.RWMutex - - pconn net.PacketConn - currentAddr net.Addr -} - -var _ connection = &conn{} - -func (c *conn) Write(p []byte) error { - _, err := c.pconn.WriteTo(p, c.currentAddr) - return err -} - -func (c *conn) Read(p []byte) (int, net.Addr, error) { - return c.pconn.ReadFrom(p) -} - -func (c *conn) SetCurrentRemoteAddr(addr net.Addr) { - c.mutex.Lock() - c.currentAddr = addr - c.mutex.Unlock() -} - -func (c *conn) LocalAddr() net.Addr { - return c.pconn.LocalAddr() -} - -func (c *conn) RemoteAddr() net.Addr { - c.mutex.RLock() - addr := c.currentAddr - c.mutex.RUnlock() - return addr -} - -func (c *conn) Close() error { - return c.pconn.Close() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/crypto_stream.go b/vendor/github.com/lucas-clemente/quic-go/crypto_stream.go deleted file mode 100644 index 095feb1d..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/crypto_stream.go +++ /dev/null @@ -1,135 +0,0 @@ -package quic - -import ( - "errors" - "fmt" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type cryptoStream interface { - // for receiving data - HandleCryptoFrame(*wire.CryptoFrame) error - GetCryptoData() []byte - Finish() error - // for sending data - io.Writer - HasData() bool - PopCryptoFrame(protocol.ByteCount) *wire.CryptoFrame -} - -type postHandshakeCryptoStream struct { - cryptoStream - - framer framer -} - -func newPostHandshakeCryptoStream(framer framer) cryptoStream { - return &postHandshakeCryptoStream{ - cryptoStream: newCryptoStream(), - framer: framer, - } -} - -// Write writes post-handshake messages. -// For simplicity, post-handshake crypto messages are treated as control frames. -// The framer functions as a stack (LIFO), so if there are multiple writes, -// they will be returned in the opposite order. -// This is acceptable, since post-handshake crypto messages are very rare. -func (s *postHandshakeCryptoStream) Write(p []byte) (int, error) { - n, err := s.cryptoStream.Write(p) - if err != nil { - return n, err - } - for s.cryptoStream.HasData() { - s.framer.QueueControlFrame(s.PopCryptoFrame(protocol.MaxPostHandshakeCryptoFrameSize)) - } - return n, nil -} - -type cryptoStreamImpl struct { - queue *frameSorter - msgBuf []byte - - highestOffset protocol.ByteCount - finished bool - - writeOffset protocol.ByteCount - writeBuf []byte -} - -func newCryptoStream() cryptoStream { - return &cryptoStreamImpl{queue: newFrameSorter()} -} - -func (s *cryptoStreamImpl) HandleCryptoFrame(f *wire.CryptoFrame) error { - highestOffset := f.Offset + protocol.ByteCount(len(f.Data)) - if maxOffset := highestOffset; maxOffset > protocol.MaxCryptoStreamOffset { - return fmt.Errorf("received invalid offset %d on crypto stream, maximum allowed %d", maxOffset, protocol.MaxCryptoStreamOffset) - } - if s.finished { - if highestOffset > s.highestOffset { - // reject crypto data received after this stream was already finished - return errors.New("received crypto data after change of encryption level") - } - // ignore data with a smaller offset than the highest received - // could e.g. be a retransmission - return nil - } - s.highestOffset = utils.MaxByteCount(s.highestOffset, highestOffset) - if err := s.queue.Push(f.Data, f.Offset); err != nil { - return err - } - for { - _, data := s.queue.Pop() - if data == nil { - return nil - } - s.msgBuf = append(s.msgBuf, data...) - } -} - -// GetCryptoData retrieves data that was received in CRYPTO frames -func (s *cryptoStreamImpl) GetCryptoData() []byte { - if len(s.msgBuf) < 4 { - return nil - } - msgLen := 4 + int(s.msgBuf[1])<<16 + int(s.msgBuf[2])<<8 + int(s.msgBuf[3]) - if len(s.msgBuf) < msgLen { - return nil - } - msg := make([]byte, msgLen) - copy(msg, s.msgBuf[:msgLen]) - s.msgBuf = s.msgBuf[msgLen:] - return msg -} - -func (s *cryptoStreamImpl) Finish() error { - if s.queue.HasMoreData() { - return errors.New("encryption level changed, but crypto stream has more data to read") - } - s.finished = true - return nil -} - -// Writes writes data that should be sent out in CRYPTO frames -func (s *cryptoStreamImpl) Write(p []byte) (int, error) { - s.writeBuf = append(s.writeBuf, p...) - return len(p), nil -} - -func (s *cryptoStreamImpl) HasData() bool { - return len(s.writeBuf) > 0 -} - -func (s *cryptoStreamImpl) PopCryptoFrame(maxLen protocol.ByteCount) *wire.CryptoFrame { - f := &wire.CryptoFrame{Offset: s.writeOffset} - n := utils.MinByteCount(f.MaxDataLen(maxLen), protocol.ByteCount(len(s.writeBuf))) - f.Data = s.writeBuf[:n] - s.writeBuf = s.writeBuf[n:] - s.writeOffset += n - return f -} diff --git a/vendor/github.com/lucas-clemente/quic-go/crypto_stream_manager.go b/vendor/github.com/lucas-clemente/quic-go/crypto_stream_manager.go deleted file mode 100644 index 489b306a..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/crypto_stream_manager.go +++ /dev/null @@ -1,60 +0,0 @@ -package quic - -import ( - "fmt" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type cryptoDataHandler interface { - HandleMessage([]byte, protocol.EncryptionLevel) bool -} - -type cryptoStreamManager struct { - cryptoHandler cryptoDataHandler - - initialStream cryptoStream - handshakeStream cryptoStream - oneRTTStream cryptoStream -} - -func newCryptoStreamManager( - cryptoHandler cryptoDataHandler, - initialStream cryptoStream, - handshakeStream cryptoStream, - oneRTTStream cryptoStream, -) *cryptoStreamManager { - return &cryptoStreamManager{ - cryptoHandler: cryptoHandler, - initialStream: initialStream, - handshakeStream: handshakeStream, - oneRTTStream: oneRTTStream, - } -} - -func (m *cryptoStreamManager) HandleCryptoFrame(frame *wire.CryptoFrame, encLevel protocol.EncryptionLevel) (bool /* encryption level changed */, error) { - var str cryptoStream - switch encLevel { - case protocol.EncryptionInitial: - str = m.initialStream - case protocol.EncryptionHandshake: - str = m.handshakeStream - case protocol.Encryption1RTT: - str = m.oneRTTStream - default: - return false, fmt.Errorf("received CRYPTO frame with unexpected encryption level: %s", encLevel) - } - if err := str.HandleCryptoFrame(frame); err != nil { - return false, err - } - for { - data := str.GetCryptoData() - if data == nil { - return false, nil - } - if encLevelFinished := m.cryptoHandler.HandleMessage(data, encLevel); encLevelFinished { - return true, str.Finish() - } - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/frame_sorter.go b/vendor/github.com/lucas-clemente/quic-go/frame_sorter.go deleted file mode 100644 index 609c35dd..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/frame_sorter.go +++ /dev/null @@ -1,159 +0,0 @@ -package quic - -import ( - "errors" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -type frameSorter struct { - queue map[protocol.ByteCount][]byte - readPos protocol.ByteCount - gaps *utils.ByteIntervalList -} - -var errDuplicateStreamData = errors.New("Duplicate Stream Data") - -func newFrameSorter() *frameSorter { - s := frameSorter{ - gaps: utils.NewByteIntervalList(), - queue: make(map[protocol.ByteCount][]byte), - } - s.gaps.PushFront(utils.ByteInterval{Start: 0, End: protocol.MaxByteCount}) - return &s -} - -func (s *frameSorter) Push(data []byte, offset protocol.ByteCount) error { - err := s.push(data, offset) - if err == errDuplicateStreamData { - return nil - } - return err -} - -func (s *frameSorter) push(data []byte, offset protocol.ByteCount) error { - if len(data) == 0 { - return nil - } - - var wasCut bool - if oldData, ok := s.queue[offset]; ok { - if len(data) <= len(oldData) { - return errDuplicateStreamData - } - data = data[len(oldData):] - offset += protocol.ByteCount(len(oldData)) - wasCut = true - } - - start := offset - end := offset + protocol.ByteCount(len(data)) - - // skip all gaps that are before this stream frame - var gap *utils.ByteIntervalElement - for gap = s.gaps.Front(); gap != nil; gap = gap.Next() { - // the frame is a duplicate. Ignore it - if end <= gap.Value.Start { - return errDuplicateStreamData - } - if end > gap.Value.Start && start <= gap.Value.End { - break - } - } - - if gap == nil { - return errors.New("StreamFrameSorter BUG: no gap found") - } - - if start < gap.Value.Start { - add := gap.Value.Start - start - offset += add - start += add - data = data[add:] - wasCut = true - } - - // find the highest gaps whose Start lies before the end of the frame - endGap := gap - for end >= endGap.Value.End { - nextEndGap := endGap.Next() - if nextEndGap == nil { - return errors.New("StreamFrameSorter BUG: no end gap found") - } - if endGap != gap { - s.gaps.Remove(endGap) - } - if end <= nextEndGap.Value.Start { - break - } - // delete queued frames completely covered by the current frame - delete(s.queue, endGap.Value.End) - endGap = nextEndGap - } - - if end > endGap.Value.End { - cutLen := end - endGap.Value.End - len := protocol.ByteCount(len(data)) - cutLen - end -= cutLen - data = data[:len] - wasCut = true - } - - if start == gap.Value.Start { - if end >= gap.Value.End { - // the frame completely fills this gap - // delete the gap - s.gaps.Remove(gap) - } - if end < endGap.Value.End { - // the frame covers the beginning of the gap - // adjust the Start value to shrink the gap - endGap.Value.Start = end - } - } else if end == endGap.Value.End { - // the frame covers the end of the gap - // adjust the End value to shrink the gap - gap.Value.End = start - } else { - if gap == endGap { - // the frame lies within the current gap, splitting it into two - // insert a new gap and adjust the current one - intv := utils.ByteInterval{Start: end, End: gap.Value.End} - s.gaps.InsertAfter(intv, gap) - gap.Value.End = start - } else { - gap.Value.End = start - endGap.Value.Start = end - } - } - - if s.gaps.Len() > protocol.MaxStreamFrameSorterGaps { - return errors.New("Too many gaps in received data") - } - - if wasCut { - newData := make([]byte, len(data)) - copy(newData, data) - data = newData - } - - s.queue[offset] = data - return nil -} - -func (s *frameSorter) Pop() (protocol.ByteCount, []byte) { - data, ok := s.queue[s.readPos] - if !ok { - return s.readPos, nil - } - delete(s.queue, s.readPos) - offset := s.readPos - s.readPos += protocol.ByteCount(len(data)) - return offset, data -} - -// HasMoreData says if there is any more data queued at *any* offset. -func (s *frameSorter) HasMoreData() bool { - return len(s.queue) > 0 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/framer.go b/vendor/github.com/lucas-clemente/quic-go/framer.go deleted file mode 100644 index fbfe9bb7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/framer.go +++ /dev/null @@ -1,109 +0,0 @@ -package quic - -import ( - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type framer interface { - QueueControlFrame(wire.Frame) - AppendControlFrames([]wire.Frame, protocol.ByteCount) ([]wire.Frame, protocol.ByteCount) - - AddActiveStream(protocol.StreamID) - AppendStreamFrames([]wire.Frame, protocol.ByteCount) []wire.Frame -} - -type framerI struct { - mutex sync.Mutex - - streamGetter streamGetter - version protocol.VersionNumber - - activeStreams map[protocol.StreamID]struct{} - streamQueue []protocol.StreamID - - controlFrameMutex sync.Mutex - controlFrames []wire.Frame -} - -var _ framer = &framerI{} - -func newFramer( - streamGetter streamGetter, - v protocol.VersionNumber, -) framer { - return &framerI{ - streamGetter: streamGetter, - activeStreams: make(map[protocol.StreamID]struct{}), - version: v, - } -} - -func (f *framerI) QueueControlFrame(frame wire.Frame) { - f.controlFrameMutex.Lock() - f.controlFrames = append(f.controlFrames, frame) - f.controlFrameMutex.Unlock() -} - -func (f *framerI) AppendControlFrames(frames []wire.Frame, maxLen protocol.ByteCount) ([]wire.Frame, protocol.ByteCount) { - var length protocol.ByteCount - f.controlFrameMutex.Lock() - for len(f.controlFrames) > 0 { - frame := f.controlFrames[len(f.controlFrames)-1] - frameLen := frame.Length(f.version) - if length+frameLen > maxLen { - break - } - frames = append(frames, frame) - length += frameLen - f.controlFrames = f.controlFrames[:len(f.controlFrames)-1] - } - f.controlFrameMutex.Unlock() - return frames, length -} - -func (f *framerI) AddActiveStream(id protocol.StreamID) { - f.mutex.Lock() - if _, ok := f.activeStreams[id]; !ok { - f.streamQueue = append(f.streamQueue, id) - f.activeStreams[id] = struct{}{} - } - f.mutex.Unlock() -} - -func (f *framerI) AppendStreamFrames(frames []wire.Frame, maxLen protocol.ByteCount) []wire.Frame { - var length protocol.ByteCount - f.mutex.Lock() - // pop STREAM frames, until less than MinStreamFrameSize bytes are left in the packet - numActiveStreams := len(f.streamQueue) - for i := 0; i < numActiveStreams; i++ { - if maxLen-length < protocol.MinStreamFrameSize { - break - } - id := f.streamQueue[0] - f.streamQueue = f.streamQueue[1:] - // This should never return an error. Better check it anyway. - // The stream will only be in the streamQueue, if it enqueued itself there. - str, err := f.streamGetter.GetOrOpenSendStream(id) - // The stream can be nil if it completed after it said it had data. - if str == nil || err != nil { - delete(f.activeStreams, id) - continue - } - frame, hasMoreData := str.popStreamFrame(maxLen - length) - if hasMoreData { // put the stream back in the queue (at the end) - f.streamQueue = append(f.streamQueue, id) - } else { // no more data to send. Stream is not active any more - delete(f.activeStreams, id) - } - if frame == nil { // can happen if the receiveStream was canceled after it said it had data - continue - } - frames = append(frames, frame) - length += frame.Length(f.version) - } - f.mutex.Unlock() - return frames -} diff --git a/vendor/github.com/lucas-clemente/quic-go/go.mod b/vendor/github.com/lucas-clemente/quic-go/go.mod deleted file mode 100644 index 63d9d89b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/lucas-clemente/quic-go - -go 1.12 - -require ( - github.com/cheekybits/genny v1.0.0 - github.com/golang/mock v1.2.0 - github.com/marten-seemann/qtls v0.2.3 - github.com/onsi/ginkgo v1.7.0 - github.com/onsi/gomega v1.4.3 - golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 - golang.org/x/net v0.0.0-20180906233101-161cd47e91fd -) diff --git a/vendor/github.com/lucas-clemente/quic-go/go.sum b/vendor/github.com/lucas-clemente/quic-go/go.sum deleted file mode 100644 index c5efe853..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/go.sum +++ /dev/null @@ -1,37 +0,0 @@ -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= -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/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -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/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA= -github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -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/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/lucas-clemente/quic-go/interface.go b/vendor/github.com/lucas-clemente/quic-go/interface.go deleted file mode 100644 index a83d09b8..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/interface.go +++ /dev/null @@ -1,224 +0,0 @@ -package quic - -import ( - "context" - "crypto/tls" - "io" - "net" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// The StreamID is the ID of a QUIC stream. -type StreamID = protocol.StreamID - -// A VersionNumber is a QUIC version number. -type VersionNumber = protocol.VersionNumber - -// A Cookie can be used to verify the ownership of the client address. -type Cookie struct { - RemoteAddr string - SentTime time.Time -} - -// An ErrorCode is an application-defined error code. -type ErrorCode = protocol.ApplicationErrorCode - -// Stream is the interface implemented by QUIC streams -type Stream interface { - // StreamID returns the stream ID. - StreamID() StreamID - // Read reads data from the stream. - // Read can be made to time out and return a net.Error with Timeout() == true - // after a fixed time limit; see SetDeadline and SetReadDeadline. - // If the stream was canceled by the peer, the error implements the StreamError - // interface, and Canceled() == true. - // If the session was closed due to a timeout, the error satisfies - // the net.Error interface, and Timeout() will be true. - io.Reader - // Write writes data to the stream. - // Write can be made to time out and return a net.Error with Timeout() == true - // after a fixed time limit; see SetDeadline and SetWriteDeadline. - // If the stream was canceled by the peer, the error implements the StreamError - // interface, and Canceled() == true. - // If the session was closed due to a timeout, the error satisfies - // the net.Error interface, and Timeout() will be true. - io.Writer - // Close closes the write-direction of the stream. - // Future calls to Write are not permitted after calling Close. - // It must not be called concurrently with Write. - // It must not be called after calling CancelWrite. - io.Closer - // CancelWrite aborts sending on this stream. - // Data already written, but not yet delivered to the peer is not guaranteed to be delivered reliably. - // Write will unblock immediately, and future calls to Write will fail. - // When called multiple times or after closing the stream it is a no-op. - CancelWrite(ErrorCode) - // CancelRead aborts receiving on this stream. - // It will ask the peer to stop transmitting stream data. - // Read will unblock immediately, and future Read calls will fail. - // When called multiple times or after reading the io.EOF it is a no-op. - CancelRead(ErrorCode) - // The context is canceled as soon as the write-side of the stream is closed. - // This happens when Close() or CancelWrite() is called, or when the peer - // cancels the read-side of their stream. - // Warning: This API should not be considered stable and might change soon. - Context() context.Context - // SetReadDeadline sets the deadline for future Read calls and - // any currently-blocked Read call. - // A zero value for t means Read will not time out. - SetReadDeadline(t time.Time) error - // SetWriteDeadline sets the deadline for future Write calls - // and any currently-blocked Write call. - // Even if write times out, it may return n > 0, indicating that - // some of the data was successfully written. - // A zero value for t means Write will not time out. - SetWriteDeadline(t time.Time) error - // SetDeadline sets the read and write deadlines associated - // with the connection. It is equivalent to calling both - // SetReadDeadline and SetWriteDeadline. - SetDeadline(t time.Time) error -} - -// A ReceiveStream is a unidirectional Receive Stream. -type ReceiveStream interface { - // see Stream.StreamID - StreamID() StreamID - // see Stream.Read - io.Reader - // see Stream.CancelRead - CancelRead(ErrorCode) - // see Stream.SetReadDealine - SetReadDeadline(t time.Time) error -} - -// A SendStream is a unidirectional Send Stream. -type SendStream interface { - // see Stream.StreamID - StreamID() StreamID - // see Stream.Write - io.Writer - // see Stream.Close - io.Closer - // see Stream.CancelWrite - CancelWrite(ErrorCode) - // see Stream.Context - Context() context.Context - // see Stream.SetWriteDeadline - SetWriteDeadline(t time.Time) error -} - -// StreamError is returned by Read and Write when the peer cancels the stream. -type StreamError interface { - error - Canceled() bool - ErrorCode() ErrorCode -} - -// A Session is a QUIC connection between two peers. -type Session interface { - // AcceptStream returns the next stream opened by the peer, blocking until one is available. - // If the session was closed due to a timeout, the error satisfies - // the net.Error interface, and Timeout() will be true. - AcceptStream() (Stream, error) - // AcceptUniStream returns the next unidirectional stream opened by the peer, blocking until one is available. - // If the session was closed due to a timeout, the error satisfies - // the net.Error interface, and Timeout() will be true. - AcceptUniStream() (ReceiveStream, error) - // OpenStream opens a new bidirectional QUIC stream. - // There is no signaling to the peer about new streams: - // The peer can only accept the stream after data has been sent on the stream. - // If the error is non-nil, it satisfies the net.Error interface. - // When reaching the peer's stream limit, err.Temporary() will be true. - // If the session was closed due to a timeout, Timeout() will be true. - OpenStream() (Stream, error) - // OpenStreamSync opens a new bidirectional QUIC stream. - // It blocks until a new stream can be opened. - // If the error is non-nil, it satisfies the net.Error interface. - // If the session was closed due to a timeout, Timeout() will be true. - OpenStreamSync() (Stream, error) - // OpenUniStream opens a new outgoing unidirectional QUIC stream. - // If the error is non-nil, it satisfies the net.Error interface. - // When reaching the peer's stream limit, Temporary() will be true. - // If the session was closed due to a timeout, Timeout() will be true. - OpenUniStream() (SendStream, error) - // OpenUniStreamSync opens a new outgoing unidirectional QUIC stream. - // It blocks until a new stream can be opened. - // If the error is non-nil, it satisfies the net.Error interface. - // If the session was closed due to a timeout, Timeout() will be true. - OpenUniStreamSync() (SendStream, error) - // LocalAddr returns the local address. - LocalAddr() net.Addr - // RemoteAddr returns the address of the peer. - RemoteAddr() net.Addr - // Close the connection. - io.Closer - // Close the connection with an error. - // The error must not be nil. - CloseWithError(ErrorCode, error) error - // The context is cancelled when the session is closed. - // Warning: This API should not be considered stable and might change soon. - Context() context.Context - // ConnectionState returns basic details about the QUIC connection. - // Warning: This API should not be considered stable and might change soon. - ConnectionState() tls.ConnectionState -} - -// Config contains all configuration data needed for a QUIC server or client. -type Config struct { - // The QUIC versions that can be negotiated. - // If not set, it uses all versions available. - // Warning: This API should not be considered stable and will change soon. - Versions []VersionNumber - // The length of the connection ID in bytes. - // It can be 0, or any value between 4 and 18. - // If not set, the interpretation depends on where the Config is used: - // If used for dialing an address, a 0 byte connection ID will be used. - // If used for a server, or dialing on a packet conn, a 4 byte connection ID will be used. - // When dialing on a packet conn, the ConnectionIDLength value must be the same for every Dial call. - ConnectionIDLength int - // HandshakeTimeout is the maximum duration that the cryptographic handshake may take. - // If the timeout is exceeded, the connection is closed. - // If this value is zero, the timeout is set to 10 seconds. - HandshakeTimeout time.Duration - // IdleTimeout is the maximum duration that may pass without any incoming network activity. - // This value only applies after the handshake has completed. - // If the timeout is exceeded, the connection is closed. - // If this value is zero, the timeout is set to 30 seconds. - IdleTimeout time.Duration - // AcceptCookie determines if a Cookie is accepted. - // It is called with cookie = nil if the client didn't send an Cookie. - // If not set, it verifies that the address matches, and that the Cookie was issued within the last 24 hours. - // This option is only valid for the server. - AcceptCookie func(clientAddr net.Addr, cookie *Cookie) bool - // MaxReceiveStreamFlowControlWindow is the maximum stream-level flow control window for receiving data. - // If this value is zero, it will default to 1 MB for the server and 6 MB for the client. - MaxReceiveStreamFlowControlWindow uint64 - // MaxReceiveConnectionFlowControlWindow is the connection-level flow control window for receiving data. - // If this value is zero, it will default to 1.5 MB for the server and 15 MB for the client. - MaxReceiveConnectionFlowControlWindow uint64 - // MaxIncomingStreams is the maximum number of concurrent bidirectional streams that a peer is allowed to open. - // If not set, it will default to 100. - // If set to a negative value, it doesn't allow any bidirectional streams. - MaxIncomingStreams int - // MaxIncomingUniStreams is the maximum number of concurrent unidirectional streams that a peer is allowed to open. - // If not set, it will default to 100. - // If set to a negative value, it doesn't allow any unidirectional streams. - MaxIncomingUniStreams int - // The StatelessResetKey is used to generate stateless reset tokens. - // If no key is configured, sending of stateless resets is disabled. - StatelessResetKey []byte - // KeepAlive defines whether this peer will periodically send a packet to keep the connection alive. - KeepAlive bool -} - -// A Listener for incoming QUIC connections -type Listener interface { - // Close the server. All active sessions will be closed. - Close() error - // Addr returns the local network addr that the server is listening on. - Addr() net.Addr - // Accept returns new sessions. It should be called in a loop. - Accept() (Session, error) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/gen.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/gen.go deleted file mode 100644 index 32235f81..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/gen.go +++ /dev/null @@ -1,3 +0,0 @@ -package ackhandler - -//go:generate genny -pkg ackhandler -in ../utils/linkedlist/linkedlist.go -out packet_linkedlist.go gen Item=Packet diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/interfaces.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/interfaces.go deleted file mode 100644 index 362b9fbe..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/interfaces.go +++ /dev/null @@ -1,50 +0,0 @@ -package ackhandler - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// SentPacketHandler handles ACKs received for outgoing packets -type SentPacketHandler interface { - // SentPacket may modify the packet - SentPacket(packet *Packet) - SentPacketsAsRetransmission(packets []*Packet, retransmissionOf protocol.PacketNumber) - ReceivedAck(ackFrame *wire.AckFrame, withPacketNumber protocol.PacketNumber, encLevel protocol.EncryptionLevel, recvTime time.Time) error - SetHandshakeComplete() - ResetForRetry() error - - // The SendMode determines if and what kind of packets can be sent. - SendMode() SendMode - // TimeUntilSend is the time when the next packet should be sent. - // It is used for pacing packets. - TimeUntilSend() time.Time - // ShouldSendNumPackets returns the number of packets that should be sent immediately. - // It always returns a number greater or equal than 1. - // A number greater than 1 is returned when the pacing delay is smaller than the minimum pacing delay. - // Note that the number of packets is only calculated based on the pacing algorithm. - // Before sending any packet, SendingAllowed() must be called to learn if we can actually send it. - ShouldSendNumPackets() int - - // only to be called once the handshake is complete - GetLowestPacketNotConfirmedAcked() protocol.PacketNumber - DequeuePacketForRetransmission() *Packet - DequeueProbePacket() (*Packet, error) - - PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen) - PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber - - GetAlarmTimeout() time.Time - OnAlarm() error -} - -// ReceivedPacketHandler handles ACKs needed to send for incoming packets -type ReceivedPacketHandler interface { - ReceivedPacket(pn protocol.PacketNumber, encLevel protocol.EncryptionLevel, rcvTime time.Time, shouldInstigateAck bool) error - IgnoreBelow(protocol.PacketNumber) - - GetAlarmTimeout() time.Time - GetAckFrame(protocol.EncryptionLevel) *wire.AckFrame -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet.go deleted file mode 100644 index 9673a85c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet.go +++ /dev/null @@ -1,29 +0,0 @@ -package ackhandler - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// A Packet is a packet -type Packet struct { - PacketNumber protocol.PacketNumber - PacketType protocol.PacketType - Frames []wire.Frame - Length protocol.ByteCount - EncryptionLevel protocol.EncryptionLevel - SendTime time.Time - - largestAcked protocol.PacketNumber // if the packet contains an ACK, the LargestAcked value of that ACK - - // There are two reasons why a packet cannot be retransmitted: - // * it was already retransmitted - // * this packet is a retransmission, and we already received an ACK for the original packet - canBeRetransmitted bool - includedInBytesInFlight bool - retransmittedAs []protocol.PacketNumber - isRetransmission bool // we need a separate bool here because 0 is a valid packet number - retransmissionOf protocol.PacketNumber -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_linkedlist.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_linkedlist.go deleted file mode 100644 index bb74f4ef..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_linkedlist.go +++ /dev/null @@ -1,217 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package ackhandler - -// Linked list implementation from the Go standard library. - -// PacketElement is an element of a linked list. -type PacketElement struct { - // Next and previous pointers in the doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.root is both the next element of the last - // list element (l.Back()) and the previous element of the first list - // element (l.Front()). - next, prev *PacketElement - - // The list to which this element belongs. - list *PacketList - - // The value stored with this element. - Value Packet -} - -// Next returns the next list element or nil. -func (e *PacketElement) Next() *PacketElement { - if p := e.next; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// Prev returns the previous list element or nil. -func (e *PacketElement) Prev() *PacketElement { - if p := e.prev; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// PacketList is a linked list of Packets. -type PacketList struct { - root PacketElement // sentinel list element, only &root, root.prev, and root.next are used - len int // current list length excluding (this) sentinel element -} - -// Init initializes or clears list l. -func (l *PacketList) Init() *PacketList { - l.root.next = &l.root - l.root.prev = &l.root - l.len = 0 - return l -} - -// NewPacketList returns an initialized list. -func NewPacketList() *PacketList { return new(PacketList).Init() } - -// Len returns the number of elements of list l. -// The complexity is O(1). -func (l *PacketList) Len() int { return l.len } - -// Front returns the first element of list l or nil if the list is empty. -func (l *PacketList) Front() *PacketElement { - if l.len == 0 { - return nil - } - return l.root.next -} - -// Back returns the last element of list l or nil if the list is empty. -func (l *PacketList) Back() *PacketElement { - if l.len == 0 { - return nil - } - return l.root.prev -} - -// lazyInit lazily initializes a zero List value. -func (l *PacketList) lazyInit() { - if l.root.next == nil { - l.Init() - } -} - -// insert inserts e after at, increments l.len, and returns e. -func (l *PacketList) insert(e, at *PacketElement) *PacketElement { - n := at.next - at.next = e - e.prev = at - e.next = n - n.prev = e - e.list = l - l.len++ - return e -} - -// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). -func (l *PacketList) insertValue(v Packet, at *PacketElement) *PacketElement { - return l.insert(&PacketElement{Value: v}, at) -} - -// remove removes e from its list, decrements l.len, and returns e. -func (l *PacketList) remove(e *PacketElement) *PacketElement { - e.prev.next = e.next - e.next.prev = e.prev - e.next = nil // avoid memory leaks - e.prev = nil // avoid memory leaks - e.list = nil - l.len-- - return e -} - -// Remove removes e from l if e is an element of list l. -// It returns the element value e.Value. -// The element must not be nil. -func (l *PacketList) Remove(e *PacketElement) Packet { - if e.list == l { - // if e.list == l, l must have been initialized when e was inserted - // in l or l == nil (e is a zero Element) and l.remove will crash - l.remove(e) - } - return e.Value -} - -// PushFront inserts a new element e with value v at the front of list l and returns e. -func (l *PacketList) PushFront(v Packet) *PacketElement { - l.lazyInit() - return l.insertValue(v, &l.root) -} - -// PushBack inserts a new element e with value v at the back of list l and returns e. -func (l *PacketList) PushBack(v Packet) *PacketElement { - l.lazyInit() - return l.insertValue(v, l.root.prev) -} - -// InsertBefore inserts a new element e with value v immediately before mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *PacketList) InsertBefore(v Packet, mark *PacketElement) *PacketElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark.prev) -} - -// InsertAfter inserts a new element e with value v immediately after mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *PacketList) InsertAfter(v Packet, mark *PacketElement) *PacketElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark) -} - -// MoveToFront moves element e to the front of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *PacketList) MoveToFront(e *PacketElement) { - if e.list != l || l.root.next == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), &l.root) -} - -// MoveToBack moves element e to the back of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *PacketList) MoveToBack(e *PacketElement) { - if e.list != l || l.root.prev == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), l.root.prev) -} - -// MoveBefore moves element e to its new position before mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *PacketList) MoveBefore(e, mark *PacketElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark.prev) -} - -// MoveAfter moves element e to its new position after mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *PacketList) MoveAfter(e, mark *PacketElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark) -} - -// PushBackList inserts a copy of an other list at the back of list l. -// The lists l and other may be the same. They must not be nil. -func (l *PacketList) PushBackList(other *PacketList) { - l.lazyInit() - for i, e := other.Len(), other.Front(); i > 0; i, e = i-1, e.Next() { - l.insertValue(e.Value, l.root.prev) - } -} - -// PushFrontList inserts a copy of an other list at the front of list l. -// The lists l and other may be the same. They must not be nil. -func (l *PacketList) PushFrontList(other *PacketList) { - l.lazyInit() - for i, e := other.Len(), other.Back(); i > 0; i, e = i-1, e.Prev() { - l.insertValue(e.Value, &l.root) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_number_generator.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_number_generator.go deleted file mode 100644 index 56fbf3d8..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/packet_number_generator.go +++ /dev/null @@ -1,78 +0,0 @@ -package ackhandler - -import ( - "crypto/rand" - "math" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// The packetNumberGenerator generates the packet number for the next packet -// it randomly skips a packet number every averagePeriod packets (on average) -// it is guarantued to never skip two consecutive packet numbers -type packetNumberGenerator struct { - averagePeriod protocol.PacketNumber - - next protocol.PacketNumber - nextToSkip protocol.PacketNumber - - history []protocol.PacketNumber -} - -func newPacketNumberGenerator(initial, averagePeriod protocol.PacketNumber) *packetNumberGenerator { - g := &packetNumberGenerator{ - next: initial, - averagePeriod: averagePeriod, - } - g.generateNewSkip() - return g -} - -func (p *packetNumberGenerator) Peek() protocol.PacketNumber { - return p.next -} - -func (p *packetNumberGenerator) Pop() protocol.PacketNumber { - next := p.next - - // generate a new packet number for the next packet - p.next++ - - if p.next == p.nextToSkip { - if len(p.history)+1 > protocol.MaxTrackedSkippedPackets { - p.history = p.history[1:] - } - p.history = append(p.history, p.next) - p.next++ - p.generateNewSkip() - } - - return next -} - -func (p *packetNumberGenerator) generateNewSkip() { - num := p.getRandomNumber() - skip := protocol.PacketNumber(num) * (p.averagePeriod - 1) / (math.MaxUint16 / 2) - // make sure that there are never two consecutive packet numbers that are skipped - p.nextToSkip = p.next + 2 + skip -} - -// getRandomNumber() generates a cryptographically secure random number between 0 and MaxUint16 (= 65535) -// The expectation value is 65535/2 -func (p *packetNumberGenerator) getRandomNumber() uint16 { - b := make([]byte, 2) - rand.Read(b) // ignore the error here - - num := uint16(b[0])<<8 + uint16(b[1]) - return num -} - -func (p *packetNumberGenerator) Validate(ack *wire.AckFrame) bool { - for _, pn := range p.history { - if ack.AcksPacket(pn) { - return false - } - } - return true -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_handler.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_handler.go deleted file mode 100644 index 1df64ea8..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_handler.go +++ /dev/null @@ -1,98 +0,0 @@ -package ackhandler - -import ( - "fmt" - "time" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -const ( - // maximum delay that can be applied to an ACK for a retransmittable packet - ackSendDelay = 25 * time.Millisecond - // initial maximum number of retransmittable packets received before sending an ack. - initialRetransmittablePacketsBeforeAck = 2 - // number of retransmittable that an ACK is sent for - retransmittablePacketsBeforeAck = 10 - // 1/5 RTT delay when doing ack decimation - ackDecimationDelay = 1.0 / 4 - // 1/8 RTT delay when doing ack decimation - shortAckDecimationDelay = 1.0 / 8 - // Minimum number of packets received before ack decimation is enabled. - // This intends to avoid the beginning of slow start, when CWNDs may be - // rapidly increasing. - minReceivedBeforeAckDecimation = 100 - // Maximum number of packets to ack immediately after a missing packet for - // fast retransmission to kick in at the sender. This limit is created to - // reduce the number of acks sent that have no benefit for fast retransmission. - // Set to the number of nacks needed for fast retransmit plus one for protection - // against an ack loss - maxPacketsAfterNewMissing = 4 -) - -type receivedPacketHandler struct { - initialPackets *receivedPacketTracker - handshakePackets *receivedPacketTracker - oneRTTPackets *receivedPacketTracker -} - -var _ ReceivedPacketHandler = &receivedPacketHandler{} - -// NewReceivedPacketHandler creates a new receivedPacketHandler -func NewReceivedPacketHandler( - rttStats *congestion.RTTStats, - logger utils.Logger, - version protocol.VersionNumber, -) ReceivedPacketHandler { - return &receivedPacketHandler{ - initialPackets: newReceivedPacketTracker(rttStats, logger, version), - handshakePackets: newReceivedPacketTracker(rttStats, logger, version), - oneRTTPackets: newReceivedPacketTracker(rttStats, logger, version), - } -} - -func (h *receivedPacketHandler) ReceivedPacket( - pn protocol.PacketNumber, - encLevel protocol.EncryptionLevel, - rcvTime time.Time, - shouldInstigateAck bool, -) error { - switch encLevel { - case protocol.EncryptionInitial: - return h.initialPackets.ReceivedPacket(pn, rcvTime, shouldInstigateAck) - case protocol.EncryptionHandshake: - return h.handshakePackets.ReceivedPacket(pn, rcvTime, shouldInstigateAck) - case protocol.Encryption1RTT: - return h.oneRTTPackets.ReceivedPacket(pn, rcvTime, shouldInstigateAck) - default: - return fmt.Errorf("received packet with unknown encryption level: %s", encLevel) - } -} - -// only to be used with 1-RTT packets -func (h *receivedPacketHandler) IgnoreBelow(pn protocol.PacketNumber) { - h.oneRTTPackets.IgnoreBelow(pn) -} - -func (h *receivedPacketHandler) GetAlarmTimeout() time.Time { - initialAlarm := h.initialPackets.GetAlarmTimeout() - handshakeAlarm := h.handshakePackets.GetAlarmTimeout() - oneRTTAlarm := h.oneRTTPackets.GetAlarmTimeout() - return utils.MinNonZeroTime(utils.MinNonZeroTime(initialAlarm, handshakeAlarm), oneRTTAlarm) -} - -func (h *receivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel) *wire.AckFrame { - switch encLevel { - case protocol.EncryptionInitial: - return h.initialPackets.GetAckFrame() - case protocol.EncryptionHandshake: - return h.handshakePackets.GetAckFrame() - case protocol.Encryption1RTT: - return h.oneRTTPackets.GetAckFrame() - default: - return nil - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_history.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_history.go deleted file mode 100644 index 0daba413..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_history.go +++ /dev/null @@ -1,122 +0,0 @@ -package ackhandler - -import ( - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// The receivedPacketHistory stores if a packet number has already been received. -// It generates ACK ranges which can be used to assemble an ACK frame. -// It does not store packet contents. -type receivedPacketHistory struct { - ranges *utils.PacketIntervalList - - lowestInReceivedPacketNumbers protocol.PacketNumber -} - -var errTooManyOutstandingReceivedAckRanges = qerr.Error(qerr.InternalError, "Too many outstanding received ACK ranges") - -// newReceivedPacketHistory creates a new received packet history -func newReceivedPacketHistory() *receivedPacketHistory { - return &receivedPacketHistory{ - ranges: utils.NewPacketIntervalList(), - } -} - -// ReceivedPacket registers a packet with PacketNumber p and updates the ranges -func (h *receivedPacketHistory) ReceivedPacket(p protocol.PacketNumber) error { - if h.ranges.Len() >= protocol.MaxTrackedReceivedAckRanges { - return errTooManyOutstandingReceivedAckRanges - } - - if h.ranges.Len() == 0 { - h.ranges.PushBack(utils.PacketInterval{Start: p, End: p}) - return nil - } - - for el := h.ranges.Back(); el != nil; el = el.Prev() { - // p already included in an existing range. Nothing to do here - if p >= el.Value.Start && p <= el.Value.End { - return nil - } - - var rangeExtended bool - if el.Value.End == p-1 { // extend a range at the end - rangeExtended = true - el.Value.End = p - } else if el.Value.Start == p+1 { // extend a range at the beginning - rangeExtended = true - el.Value.Start = p - } - - // if a range was extended (either at the beginning or at the end, maybe it is possible to merge two ranges into one) - if rangeExtended { - prev := el.Prev() - if prev != nil && prev.Value.End+1 == el.Value.Start { // merge two ranges - prev.Value.End = el.Value.End - h.ranges.Remove(el) - return nil - } - return nil // if the two ranges were not merge, we're done here - } - - // create a new range at the end - if p > el.Value.End { - h.ranges.InsertAfter(utils.PacketInterval{Start: p, End: p}, el) - return nil - } - } - - // create a new range at the beginning - h.ranges.InsertBefore(utils.PacketInterval{Start: p, End: p}, h.ranges.Front()) - - return nil -} - -// DeleteBelow deletes all entries below (but not including) p -func (h *receivedPacketHistory) DeleteBelow(p protocol.PacketNumber) { - if p <= h.lowestInReceivedPacketNumbers { - return - } - h.lowestInReceivedPacketNumbers = p - - nextEl := h.ranges.Front() - for el := h.ranges.Front(); nextEl != nil; el = nextEl { - nextEl = el.Next() - - if p > el.Value.Start && p <= el.Value.End { - el.Value.Start = p - } else if el.Value.End < p { // delete a whole range - h.ranges.Remove(el) - } else { // no ranges affected. Nothing to do - return - } - } -} - -// GetAckRanges gets a slice of all AckRanges that can be used in an AckFrame -func (h *receivedPacketHistory) GetAckRanges() []wire.AckRange { - if h.ranges.Len() == 0 { - return nil - } - - ackRanges := make([]wire.AckRange, h.ranges.Len()) - i := 0 - for el := h.ranges.Back(); el != nil; el = el.Prev() { - ackRanges[i] = wire.AckRange{Smallest: el.Value.Start, Largest: el.Value.End} - i++ - } - return ackRanges -} - -func (h *receivedPacketHistory) GetHighestAckRange() wire.AckRange { - ackRange := wire.AckRange{} - if h.ranges.Len() > 0 { - r := h.ranges.Back().Value - ackRange.Smallest = r.Start - ackRange.Largest = r.End - } - return ackRange -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_tracker.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_tracker.go deleted file mode 100644 index b7840490..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/received_packet_tracker.go +++ /dev/null @@ -1,191 +0,0 @@ -package ackhandler - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type receivedPacketTracker struct { - largestObserved protocol.PacketNumber - ignoreBelow protocol.PacketNumber - largestObservedReceivedTime time.Time - - packetHistory *receivedPacketHistory - - ackSendDelay time.Duration - rttStats *congestion.RTTStats - - packetsReceivedSinceLastAck int - retransmittablePacketsReceivedSinceLastAck int - ackQueued bool - ackAlarm time.Time - lastAck *wire.AckFrame - - logger utils.Logger - - version protocol.VersionNumber -} - -func newReceivedPacketTracker( - rttStats *congestion.RTTStats, - logger utils.Logger, - version protocol.VersionNumber, -) *receivedPacketTracker { - return &receivedPacketTracker{ - packetHistory: newReceivedPacketHistory(), - ackSendDelay: ackSendDelay, - rttStats: rttStats, - logger: logger, - version: version, - } -} - -func (h *receivedPacketTracker) ReceivedPacket(packetNumber protocol.PacketNumber, rcvTime time.Time, shouldInstigateAck bool) error { - if packetNumber < h.ignoreBelow { - return nil - } - - isMissing := h.isMissing(packetNumber) - if packetNumber >= h.largestObserved { - h.largestObserved = packetNumber - h.largestObservedReceivedTime = rcvTime - } - - if err := h.packetHistory.ReceivedPacket(packetNumber); err != nil { - return err - } - h.maybeQueueAck(packetNumber, rcvTime, shouldInstigateAck, isMissing) - return nil -} - -// IgnoreBelow sets a lower limit for acking packets. -// Packets with packet numbers smaller than p will not be acked. -func (h *receivedPacketTracker) IgnoreBelow(p protocol.PacketNumber) { - if p <= h.ignoreBelow { - return - } - h.ignoreBelow = p - h.packetHistory.DeleteBelow(p) - if h.logger.Debug() { - h.logger.Debugf("\tIgnoring all packets below %#x.", p) - } -} - -// isMissing says if a packet was reported missing in the last ACK. -func (h *receivedPacketTracker) isMissing(p protocol.PacketNumber) bool { - if h.lastAck == nil || p < h.ignoreBelow { - return false - } - return p < h.lastAck.LargestAcked() && !h.lastAck.AcksPacket(p) -} - -func (h *receivedPacketTracker) hasNewMissingPackets() bool { - if h.lastAck == nil { - return false - } - highestRange := h.packetHistory.GetHighestAckRange() - return highestRange.Smallest >= h.lastAck.LargestAcked() && highestRange.Len() <= maxPacketsAfterNewMissing -} - -// maybeQueueAck queues an ACK, if necessary. -// It is implemented analogously to Chrome's QuicConnection::MaybeQueueAck() -// in ACK_DECIMATION_WITH_REORDERING mode. -func (h *receivedPacketTracker) maybeQueueAck(packetNumber protocol.PacketNumber, rcvTime time.Time, shouldInstigateAck, wasMissing bool) { - h.packetsReceivedSinceLastAck++ - - // always ack the first packet - if h.lastAck == nil { - h.logger.Debugf("\tQueueing ACK because the first packet should be acknowledged.") - h.ackQueued = true - return - } - - // Send an ACK if this packet was reported missing in an ACK sent before. - // Ack decimation with reordering relies on the timer to send an ACK, but if - // missing packets we reported in the previous ack, send an ACK immediately. - if wasMissing { - if h.logger.Debug() { - h.logger.Debugf("\tQueueing ACK because packet %#x was missing before.", packetNumber) - } - h.ackQueued = true - } - - if !h.ackQueued && shouldInstigateAck { - h.retransmittablePacketsReceivedSinceLastAck++ - - if packetNumber > minReceivedBeforeAckDecimation { - // ack up to 10 packets at once - if h.retransmittablePacketsReceivedSinceLastAck >= retransmittablePacketsBeforeAck { - h.ackQueued = true - if h.logger.Debug() { - h.logger.Debugf("\tQueueing ACK because packet %d packets were received after the last ACK (using threshold: %d).", h.retransmittablePacketsReceivedSinceLastAck, retransmittablePacketsBeforeAck) - } - } else if h.ackAlarm.IsZero() { - // wait for the minimum of the ack decimation delay or the delayed ack time before sending an ack - ackDelay := utils.MinDuration(ackSendDelay, time.Duration(float64(h.rttStats.MinRTT())*float64(ackDecimationDelay))) - h.ackAlarm = rcvTime.Add(ackDelay) - if h.logger.Debug() { - h.logger.Debugf("\tSetting ACK timer to min(1/4 min-RTT, max ack delay): %s (%s from now)", ackDelay, time.Until(h.ackAlarm)) - } - } - } else { - // send an ACK every 2 retransmittable packets - if h.retransmittablePacketsReceivedSinceLastAck >= initialRetransmittablePacketsBeforeAck { - if h.logger.Debug() { - h.logger.Debugf("\tQueueing ACK because packet %d packets were received after the last ACK (using initial threshold: %d).", h.retransmittablePacketsReceivedSinceLastAck, initialRetransmittablePacketsBeforeAck) - } - h.ackQueued = true - } else if h.ackAlarm.IsZero() { - if h.logger.Debug() { - h.logger.Debugf("\tSetting ACK timer to max ack delay: %s", ackSendDelay) - } - h.ackAlarm = rcvTime.Add(ackSendDelay) - } - } - // If there are new missing packets to report, set a short timer to send an ACK. - if h.hasNewMissingPackets() { - // wait the minimum of 1/8 min RTT and the existing ack time - ackDelay := time.Duration(float64(h.rttStats.MinRTT()) * float64(shortAckDecimationDelay)) - ackTime := rcvTime.Add(ackDelay) - if h.ackAlarm.IsZero() || h.ackAlarm.After(ackTime) { - h.ackAlarm = ackTime - if h.logger.Debug() { - h.logger.Debugf("\tSetting ACK timer to 1/8 min-RTT: %s (%s from now)", ackDelay, time.Until(h.ackAlarm)) - } - } - } - } - - if h.ackQueued { - // cancel the ack alarm - h.ackAlarm = time.Time{} - } -} - -func (h *receivedPacketTracker) GetAckFrame() *wire.AckFrame { - now := time.Now() - if !h.ackQueued && (h.ackAlarm.IsZero() || h.ackAlarm.After(now)) { - return nil - } - if h.logger.Debug() && !h.ackQueued && !h.ackAlarm.IsZero() { - h.logger.Debugf("Sending ACK because the ACK timer expired.") - } - - ack := &wire.AckFrame{ - AckRanges: h.packetHistory.GetAckRanges(), - DelayTime: now.Sub(h.largestObservedReceivedTime), - } - - h.lastAck = ack - h.ackAlarm = time.Time{} - h.ackQueued = false - h.packetsReceivedSinceLastAck = 0 - h.retransmittablePacketsReceivedSinceLastAck = 0 - return ack -} - -func (h *receivedPacketTracker) GetAlarmTimeout() time.Time { return h.ackAlarm } diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/retransmittable.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/retransmittable.go deleted file mode 100644 index ae622afd..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/retransmittable.go +++ /dev/null @@ -1,34 +0,0 @@ -package ackhandler - -import "github.com/lucas-clemente/quic-go/internal/wire" - -// Returns a new slice with all non-retransmittable frames deleted. -func stripNonRetransmittableFrames(fs []wire.Frame) []wire.Frame { - res := make([]wire.Frame, 0, len(fs)) - for _, f := range fs { - if IsFrameRetransmittable(f) { - res = append(res, f) - } - } - return res -} - -// IsFrameRetransmittable returns true if the frame should be retransmitted. -func IsFrameRetransmittable(f wire.Frame) bool { - switch f.(type) { - case *wire.AckFrame: - return false - default: - return true - } -} - -// HasRetransmittableFrames returns true if at least one frame is retransmittable. -func HasRetransmittableFrames(fs []wire.Frame) bool { - for _, f := range fs { - if IsFrameRetransmittable(f) { - return true - } - } - return false -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/send_mode.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/send_mode.go deleted file mode 100644 index 8cdaa7e6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/send_mode.go +++ /dev/null @@ -1,36 +0,0 @@ -package ackhandler - -import "fmt" - -// The SendMode says what kind of packets can be sent. -type SendMode uint8 - -const ( - // SendNone means that no packets should be sent - SendNone SendMode = iota - // SendAck means an ACK-only packet should be sent - SendAck - // SendRetransmission means that retransmissions should be sent - SendRetransmission - // SendPTO means that a probe packet should be sent - SendPTO - // SendAny means that any packet should be sent - SendAny -) - -func (s SendMode) String() string { - switch s { - case SendNone: - return "none" - case SendAck: - return "ack" - case SendRetransmission: - return "retransmission" - case SendPTO: - return "pto" - case SendAny: - return "any" - default: - return fmt.Sprintf("invalid send mode: %d", s) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_handler.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_handler.go deleted file mode 100644 index 51e28fc0..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_handler.go +++ /dev/null @@ -1,647 +0,0 @@ -package ackhandler - -import ( - "errors" - "fmt" - "math" - "time" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -const ( - // Maximum reordering in time space before time based loss detection considers a packet lost. - // In fraction of an RTT. - timeReorderingFraction = 1.0 / 8 - // Timer granularity. The timer will not be set to a value smaller than granularity. - granularity = time.Millisecond -) - -type packetNumberSpace struct { - history *sentPacketHistory - pns *packetNumberGenerator - - largestAcked protocol.PacketNumber - largestSent protocol.PacketNumber -} - -func newPacketNumberSpace(initialPN protocol.PacketNumber) *packetNumberSpace { - return &packetNumberSpace{ - history: newSentPacketHistory(), - pns: newPacketNumberGenerator(initialPN, protocol.SkipPacketAveragePeriodLength), - } -} - -type sentPacketHandler struct { - lastSentRetransmittablePacketTime time.Time // only applies to the application-data packet number space - lastSentCryptoPacketTime time.Time - - nextSendTime time.Time - - initialPackets *packetNumberSpace - handshakePackets *packetNumberSpace - oneRTTPackets *packetNumberSpace - - // lowestNotConfirmedAcked is the lowest packet number that we sent an ACK for, but haven't received confirmation, that this ACK actually arrived - // example: we send an ACK for packets 90-100 with packet number 20 - // once we receive an ACK from the peer for packet 20, the lowestNotConfirmedAcked is 101 - // Only applies to the application-data packet number space. - lowestNotConfirmedAcked protocol.PacketNumber - - retransmissionQueue []*Packet - - bytesInFlight protocol.ByteCount - - congestion congestion.SendAlgorithm - rttStats *congestion.RTTStats - - handshakeComplete bool - - // The number of times the crypto packets have been retransmitted without receiving an ack. - cryptoCount uint32 - // The number of times a PTO has been sent without receiving an ack. - ptoCount uint32 - // The number of PTO probe packets that should be sent. - // Only applies to the application-data packet number space. - numProbesToSend int - - // The time at which the next packet will be considered lost based on early transmit or exceeding the reordering window in time. - lossTime time.Time - - // The alarm timeout - alarm time.Time - - logger utils.Logger -} - -// NewSentPacketHandler creates a new sentPacketHandler -func NewSentPacketHandler( - initialPacketNumber protocol.PacketNumber, - rttStats *congestion.RTTStats, - logger utils.Logger, -) SentPacketHandler { - congestion := congestion.NewCubicSender( - congestion.DefaultClock{}, - rttStats, - false, /* don't use reno since chromium doesn't (why?) */ - protocol.InitialCongestionWindow, - protocol.DefaultMaxCongestionWindow, - ) - - return &sentPacketHandler{ - initialPackets: newPacketNumberSpace(initialPacketNumber), - handshakePackets: newPacketNumberSpace(0), - oneRTTPackets: newPacketNumberSpace(0), - rttStats: rttStats, - congestion: congestion, - logger: logger, - } -} - -func (h *sentPacketHandler) SetHandshakeComplete() { - h.logger.Debugf("Handshake complete. Discarding all outstanding crypto packets.") - var queue []*Packet - for _, packet := range h.retransmissionQueue { - if packet.EncryptionLevel == protocol.Encryption1RTT { - queue = append(queue, packet) - } - } - for _, pnSpace := range []*packetNumberSpace{h.initialPackets, h.handshakePackets} { - var cryptoPackets []*Packet - pnSpace.history.Iterate(func(p *Packet) (bool, error) { - cryptoPackets = append(cryptoPackets, p) - return true, nil - }) - for _, p := range cryptoPackets { - pnSpace.history.Remove(p.PacketNumber) - } - } - h.retransmissionQueue = queue - h.handshakeComplete = true -} - -func (h *sentPacketHandler) SentPacket(packet *Packet) { - if isRetransmittable := h.sentPacketImpl(packet); isRetransmittable { - h.getPacketNumberSpace(packet.EncryptionLevel).history.SentPacket(packet) - h.updateLossDetectionAlarm() - } -} - -func (h *sentPacketHandler) SentPacketsAsRetransmission(packets []*Packet, retransmissionOf protocol.PacketNumber) { - var p []*Packet - for _, packet := range packets { - if isRetransmittable := h.sentPacketImpl(packet); isRetransmittable { - p = append(p, packet) - } - } - h.getPacketNumberSpace(p[0].EncryptionLevel).history.SentPacketsAsRetransmission(p, retransmissionOf) - h.updateLossDetectionAlarm() -} - -func (h *sentPacketHandler) getPacketNumberSpace(encLevel protocol.EncryptionLevel) *packetNumberSpace { - switch encLevel { - case protocol.EncryptionInitial: - return h.initialPackets - case protocol.EncryptionHandshake: - return h.handshakePackets - case protocol.Encryption1RTT: - return h.oneRTTPackets - default: - panic("invalid packet number space") - } -} - -func (h *sentPacketHandler) sentPacketImpl(packet *Packet) bool /* isRetransmittable */ { - pnSpace := h.getPacketNumberSpace(packet.EncryptionLevel) - - if h.logger.Debug() && pnSpace.largestSent != 0 { - for p := pnSpace.largestSent + 1; p < packet.PacketNumber; p++ { - h.logger.Debugf("Skipping packet number %#x", p) - } - } - - pnSpace.largestSent = packet.PacketNumber - - if len(packet.Frames) > 0 { - if ackFrame, ok := packet.Frames[0].(*wire.AckFrame); ok { - packet.largestAcked = ackFrame.LargestAcked() - } - } - - packet.Frames = stripNonRetransmittableFrames(packet.Frames) - isRetransmittable := len(packet.Frames) != 0 - - if isRetransmittable { - if packet.EncryptionLevel != protocol.Encryption1RTT { - h.lastSentCryptoPacketTime = packet.SendTime - } - h.lastSentRetransmittablePacketTime = packet.SendTime - packet.includedInBytesInFlight = true - h.bytesInFlight += packet.Length - packet.canBeRetransmitted = true - if h.numProbesToSend > 0 { - h.numProbesToSend-- - } - } - h.congestion.OnPacketSent(packet.SendTime, h.bytesInFlight, packet.PacketNumber, packet.Length, isRetransmittable) - - h.nextSendTime = utils.MaxTime(h.nextSendTime, packet.SendTime).Add(h.congestion.TimeUntilSend(h.bytesInFlight)) - return isRetransmittable -} - -func (h *sentPacketHandler) ReceivedAck(ackFrame *wire.AckFrame, withPacketNumber protocol.PacketNumber, encLevel protocol.EncryptionLevel, rcvTime time.Time) error { - pnSpace := h.getPacketNumberSpace(encLevel) - - largestAcked := ackFrame.LargestAcked() - if largestAcked > pnSpace.largestSent { - return qerr.Error(qerr.ProtocolViolation, "Received ACK for an unsent packet") - } - - pnSpace.largestAcked = utils.MaxPacketNumber(pnSpace.largestAcked, largestAcked) - - if !pnSpace.pns.Validate(ackFrame) { - return qerr.Error(qerr.ProtocolViolation, "Received an ACK for a skipped packet number") - } - - // maybe update the RTT - if p := pnSpace.history.GetPacket(ackFrame.LargestAcked()); p != nil { - h.rttStats.UpdateRTT(rcvTime.Sub(p.SendTime), ackFrame.DelayTime, rcvTime) - if h.logger.Debug() { - h.logger.Debugf("\tupdated RTT: %s (σ: %s)", h.rttStats.SmoothedRTT(), h.rttStats.MeanDeviation()) - } - h.congestion.MaybeExitSlowStart() - } - - ackedPackets, err := h.determineNewlyAckedPackets(ackFrame, encLevel) - if err != nil { - return err - } - if len(ackedPackets) == 0 { - return nil - } - - priorInFlight := h.bytesInFlight - for _, p := range ackedPackets { - // largestAcked == 0 either means that the packet didn't contain an ACK, or it just acked packet 0 - // It is safe to ignore the corner case of packets that just acked packet 0, because - // the lowestPacketNotConfirmedAcked is only used to limit the number of ACK ranges we will send. - if p.largestAcked != 0 && encLevel == protocol.Encryption1RTT { - h.lowestNotConfirmedAcked = utils.MaxPacketNumber(h.lowestNotConfirmedAcked, p.largestAcked+1) - } - if err := h.onPacketAcked(p, rcvTime); err != nil { - return err - } - if p.includedInBytesInFlight { - h.congestion.OnPacketAcked(p.PacketNumber, p.Length, priorInFlight, rcvTime) - } - } - - if err := h.detectLostPackets(rcvTime, encLevel, priorInFlight); err != nil { - return err - } - - h.ptoCount = 0 - h.cryptoCount = 0 - h.numProbesToSend = 0 - - h.updateLossDetectionAlarm() - return nil -} - -func (h *sentPacketHandler) GetLowestPacketNotConfirmedAcked() protocol.PacketNumber { - return h.lowestNotConfirmedAcked -} - -func (h *sentPacketHandler) determineNewlyAckedPackets( - ackFrame *wire.AckFrame, - encLevel protocol.EncryptionLevel, -) ([]*Packet, error) { - pnSpace := h.getPacketNumberSpace(encLevel) - var ackedPackets []*Packet - ackRangeIndex := 0 - lowestAcked := ackFrame.LowestAcked() - largestAcked := ackFrame.LargestAcked() - err := pnSpace.history.Iterate(func(p *Packet) (bool, error) { - // Ignore packets below the lowest acked - if p.PacketNumber < lowestAcked { - return true, nil - } - // Break after largest acked is reached - if p.PacketNumber > largestAcked { - return false, nil - } - - if ackFrame.HasMissingRanges() { - ackRange := ackFrame.AckRanges[len(ackFrame.AckRanges)-1-ackRangeIndex] - - for p.PacketNumber > ackRange.Largest && ackRangeIndex < len(ackFrame.AckRanges)-1 { - ackRangeIndex++ - ackRange = ackFrame.AckRanges[len(ackFrame.AckRanges)-1-ackRangeIndex] - } - - if p.PacketNumber >= ackRange.Smallest { // packet i contained in ACK range - if p.PacketNumber > ackRange.Largest { - return false, fmt.Errorf("BUG: ackhandler would have acked wrong packet 0x%x, while evaluating range 0x%x -> 0x%x", p.PacketNumber, ackRange.Smallest, ackRange.Largest) - } - ackedPackets = append(ackedPackets, p) - } - } else { - ackedPackets = append(ackedPackets, p) - } - return true, nil - }) - if h.logger.Debug() && len(ackedPackets) > 0 { - pns := make([]protocol.PacketNumber, len(ackedPackets)) - for i, p := range ackedPackets { - pns[i] = p.PacketNumber - } - h.logger.Debugf("\tnewly acked packets (%d): %#x", len(pns), pns) - } - return ackedPackets, err -} - -func (h *sentPacketHandler) hasOutstandingCryptoPackets() bool { - return h.initialPackets.history.HasOutstandingPackets() || h.handshakePackets.history.HasOutstandingPackets() -} - -func (h *sentPacketHandler) hasOutstandingPackets() bool { - return h.oneRTTPackets.history.HasOutstandingPackets() || h.hasOutstandingCryptoPackets() -} - -func (h *sentPacketHandler) updateLossDetectionAlarm() { - // Cancel the alarm if no packets are outstanding - if !h.hasOutstandingPackets() { - h.alarm = time.Time{} - return - } - - if h.hasOutstandingCryptoPackets() { - h.alarm = h.lastSentCryptoPacketTime.Add(h.computeCryptoTimeout()) - } else if !h.lossTime.IsZero() { - // Early retransmit timer or time loss detection. - h.alarm = h.lossTime - } else { // PTO alarm - h.alarm = h.lastSentRetransmittablePacketTime.Add(h.computePTOTimeout()) - } -} - -func (h *sentPacketHandler) detectLostPackets( - now time.Time, - encLevel protocol.EncryptionLevel, - priorInFlight protocol.ByteCount, -) error { - if encLevel == protocol.Encryption1RTT { - h.lossTime = time.Time{} - } - pnSpace := h.getPacketNumberSpace(encLevel) - - maxRTT := float64(utils.MaxDuration(h.rttStats.LatestRTT(), h.rttStats.SmoothedRTT())) - delayUntilLost := time.Duration((1.0 + timeReorderingFraction) * maxRTT) - - var lostPackets []*Packet - pnSpace.history.Iterate(func(packet *Packet) (bool, error) { - if packet.PacketNumber > pnSpace.largestAcked { - return false, nil - } - - timeSinceSent := now.Sub(packet.SendTime) - if timeSinceSent > delayUntilLost { - lostPackets = append(lostPackets, packet) - } else if h.lossTime.IsZero() && encLevel == protocol.Encryption1RTT { - if h.logger.Debug() { - h.logger.Debugf("\tsetting loss timer for packet %#x to %s (in %s)", packet.PacketNumber, delayUntilLost, delayUntilLost-timeSinceSent) - } - // Note: This conditional is only entered once per call - h.lossTime = now.Add(delayUntilLost - timeSinceSent) - } - return true, nil - }) - - if h.logger.Debug() && len(lostPackets) > 0 { - pns := make([]protocol.PacketNumber, len(lostPackets)) - for i, p := range lostPackets { - pns[i] = p.PacketNumber - } - h.logger.Debugf("\tlost packets (%d): %#x", len(pns), pns) - } - - for _, p := range lostPackets { - // the bytes in flight need to be reduced no matter if this packet will be retransmitted - if p.includedInBytesInFlight { - h.bytesInFlight -= p.Length - h.congestion.OnPacketLost(p.PacketNumber, p.Length, priorInFlight) - } - if p.canBeRetransmitted { - // queue the packet for retransmission, and report the loss to the congestion controller - if err := h.queuePacketForRetransmission(p, pnSpace); err != nil { - return err - } - } - pnSpace.history.Remove(p.PacketNumber) - } - return nil -} - -func (h *sentPacketHandler) OnAlarm() error { - // When all outstanding are acknowledged, the alarm is canceled in - // updateLossDetectionAlarm. This doesn't reset the timer in the session though. - // When OnAlarm is called, we therefore need to make sure that there are - // actually packets outstanding. - if h.hasOutstandingPackets() { - if err := h.onVerifiedAlarm(); err != nil { - return err - } - } - h.updateLossDetectionAlarm() - return nil -} - -func (h *sentPacketHandler) onVerifiedAlarm() error { - var err error - if h.hasOutstandingCryptoPackets() { - if h.logger.Debug() { - h.logger.Debugf("Loss detection alarm fired in crypto mode. Crypto count: %d", h.cryptoCount) - } - h.cryptoCount++ - err = h.queueCryptoPacketsForRetransmission() - } else if !h.lossTime.IsZero() { - if h.logger.Debug() { - h.logger.Debugf("Loss detection alarm fired in loss timer mode. Loss time: %s", h.lossTime) - } - // Early retransmit or time loss detection - err = h.detectLostPackets(time.Now(), protocol.Encryption1RTT, h.bytesInFlight) - } else { // PTO - if h.logger.Debug() { - h.logger.Debugf("Loss detection alarm fired in PTO mode. PTO count: %d", h.ptoCount) - } - h.ptoCount++ - h.numProbesToSend += 2 - } - return err -} - -func (h *sentPacketHandler) GetAlarmTimeout() time.Time { - return h.alarm -} - -func (h *sentPacketHandler) onPacketAcked(p *Packet, rcvTime time.Time) error { - pnSpace := h.getPacketNumberSpace(p.EncryptionLevel) - // This happens if a packet and its retransmissions is acked in the same ACK. - // As soon as we process the first one, this will remove all the retransmissions, - // so we won't find the retransmitted packet number later. - if packet := pnSpace.history.GetPacket(p.PacketNumber); packet == nil { - return nil - } - - // only report the acking of this packet to the congestion controller if: - // * it is a retransmittable packet - // * this packet wasn't retransmitted yet - if p.isRetransmission { - // that the parent doesn't exist is expected to happen every time the original packet was already acked - if parent := pnSpace.history.GetPacket(p.retransmissionOf); parent != nil { - if len(parent.retransmittedAs) == 1 { - parent.retransmittedAs = nil - } else { - // remove this packet from the slice of retransmission - retransmittedAs := make([]protocol.PacketNumber, 0, len(parent.retransmittedAs)-1) - for _, pn := range parent.retransmittedAs { - if pn != p.PacketNumber { - retransmittedAs = append(retransmittedAs, pn) - } - } - parent.retransmittedAs = retransmittedAs - } - } - } - // this also applies to packets that have been retransmitted as probe packets - if p.includedInBytesInFlight { - h.bytesInFlight -= p.Length - } - if err := h.stopRetransmissionsFor(p, pnSpace); err != nil { - return err - } - return pnSpace.history.Remove(p.PacketNumber) -} - -func (h *sentPacketHandler) stopRetransmissionsFor(p *Packet, pnSpace *packetNumberSpace) error { - if err := pnSpace.history.MarkCannotBeRetransmitted(p.PacketNumber); err != nil { - return err - } - for _, r := range p.retransmittedAs { - packet := pnSpace.history.GetPacket(r) - if packet == nil { - return fmt.Errorf("sent packet handler BUG: marking packet as not retransmittable %d (retransmission of %d) not found in history", r, p.PacketNumber) - } - h.stopRetransmissionsFor(packet, pnSpace) - } - return nil -} - -func (h *sentPacketHandler) DequeuePacketForRetransmission() *Packet { - if len(h.retransmissionQueue) == 0 { - return nil - } - packet := h.retransmissionQueue[0] - // Shift the slice and don't retain anything that isn't needed. - copy(h.retransmissionQueue, h.retransmissionQueue[1:]) - h.retransmissionQueue[len(h.retransmissionQueue)-1] = nil - h.retransmissionQueue = h.retransmissionQueue[:len(h.retransmissionQueue)-1] - return packet -} - -func (h *sentPacketHandler) DequeueProbePacket() (*Packet, error) { - pnSpace := h.getPacketNumberSpace(protocol.Encryption1RTT) - if len(h.retransmissionQueue) == 0 { - p := pnSpace.history.FirstOutstanding() - if p == nil { - return nil, errors.New("cannot dequeue a probe packet. No outstanding packets") - } - if err := h.queuePacketForRetransmission(p, pnSpace); err != nil { - return nil, err - } - } - return h.DequeuePacketForRetransmission(), nil -} - -func (h *sentPacketHandler) PeekPacketNumber(encLevel protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen) { - pnSpace := h.getPacketNumberSpace(encLevel) - - var lowestUnacked protocol.PacketNumber - if p := pnSpace.history.FirstOutstanding(); p != nil { - lowestUnacked = p.PacketNumber - } else { - lowestUnacked = pnSpace.largestAcked + 1 - } - - pn := pnSpace.pns.Peek() - return pn, protocol.GetPacketNumberLengthForHeader(pn, lowestUnacked) -} - -func (h *sentPacketHandler) PopPacketNumber(encLevel protocol.EncryptionLevel) protocol.PacketNumber { - return h.getPacketNumberSpace(encLevel).pns.Pop() -} - -func (h *sentPacketHandler) SendMode() SendMode { - numTrackedPackets := len(h.retransmissionQueue) + h.initialPackets.history.Len() + - h.handshakePackets.history.Len() + h.oneRTTPackets.history.Len() - - // Don't send any packets if we're keeping track of the maximum number of packets. - // Note that since MaxOutstandingSentPackets is smaller than MaxTrackedSentPackets, - // we will stop sending out new data when reaching MaxOutstandingSentPackets, - // but still allow sending of retransmissions and ACKs. - if numTrackedPackets >= protocol.MaxTrackedSentPackets { - if h.logger.Debug() { - h.logger.Debugf("Limited by the number of tracked packets: tracking %d packets, maximum %d", numTrackedPackets, protocol.MaxTrackedSentPackets) - } - return SendNone - } - if h.numProbesToSend > 0 { - return SendPTO - } - // Only send ACKs if we're congestion limited. - if cwnd := h.congestion.GetCongestionWindow(); h.bytesInFlight > cwnd { - if h.logger.Debug() { - h.logger.Debugf("Congestion limited: bytes in flight %d, window %d", h.bytesInFlight, cwnd) - } - return SendAck - } - // Send retransmissions first, if there are any. - if len(h.retransmissionQueue) > 0 { - return SendRetransmission - } - if numTrackedPackets >= protocol.MaxOutstandingSentPackets { - if h.logger.Debug() { - h.logger.Debugf("Max outstanding limited: tracking %d packets, maximum: %d", numTrackedPackets, protocol.MaxOutstandingSentPackets) - } - return SendAck - } - return SendAny -} - -func (h *sentPacketHandler) TimeUntilSend() time.Time { - return h.nextSendTime -} - -func (h *sentPacketHandler) ShouldSendNumPackets() int { - if h.numProbesToSend > 0 { - // RTO probes should not be paced, but must be sent immediately. - return h.numProbesToSend - } - delay := h.congestion.TimeUntilSend(h.bytesInFlight) - if delay == 0 || delay > protocol.MinPacingDelay { - return 1 - } - return int(math.Ceil(float64(protocol.MinPacingDelay) / float64(delay))) -} - -func (h *sentPacketHandler) queueCryptoPacketsForRetransmission() error { - if err := h.queueAllPacketsForRetransmission(protocol.EncryptionInitial); err != nil { - return err - } - return h.queueAllPacketsForRetransmission(protocol.EncryptionHandshake) -} - -func (h *sentPacketHandler) queueAllPacketsForRetransmission(encLevel protocol.EncryptionLevel) error { - var packets []*Packet - pnSpace := h.getPacketNumberSpace(encLevel) - pnSpace.history.Iterate(func(p *Packet) (bool, error) { - if p.canBeRetransmitted { - packets = append(packets, p) - } - return true, nil - }) - for _, p := range packets { - h.logger.Debugf("Queueing packet %#x (%s) as a crypto retransmission", p.PacketNumber, encLevel) - if err := h.queuePacketForRetransmission(p, pnSpace); err != nil { - return err - } - } - return nil -} - -func (h *sentPacketHandler) queuePacketForRetransmission(p *Packet, pnSpace *packetNumberSpace) error { - if !p.canBeRetransmitted { - return fmt.Errorf("sent packet handler BUG: packet %d already queued for retransmission", p.PacketNumber) - } - if err := pnSpace.history.MarkCannotBeRetransmitted(p.PacketNumber); err != nil { - return err - } - h.retransmissionQueue = append(h.retransmissionQueue, p) - return nil -} - -func (h *sentPacketHandler) computeCryptoTimeout() time.Duration { - duration := utils.MaxDuration(2*h.rttStats.SmoothedOrInitialRTT(), granularity) - // exponential backoff - // There's an implicit limit to this set by the crypto timeout. - return duration << h.cryptoCount -} - -func (h *sentPacketHandler) computePTOTimeout() time.Duration { - // TODO(#1236): include the max_ack_delay - duration := utils.MaxDuration(h.rttStats.SmoothedOrInitialRTT()+4*h.rttStats.MeanDeviation(), granularity) - return duration << h.ptoCount -} - -func (h *sentPacketHandler) ResetForRetry() error { - h.cryptoCount = 0 - h.bytesInFlight = 0 - var packets []*Packet - h.initialPackets.history.Iterate(func(p *Packet) (bool, error) { - if p.canBeRetransmitted { - packets = append(packets, p) - } - return true, nil - }) - for _, p := range packets { - h.logger.Debugf("Queueing packet %#x for retransmission.", p.PacketNumber) - h.retransmissionQueue = append(h.retransmissionQueue, p) - } - h.initialPackets = newPacketNumberSpace(h.initialPackets.pns.Pop()) - h.updateLossDetectionAlarm() - return nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_history.go b/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_history.go deleted file mode 100644 index 393ebba6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/ackhandler/sent_packet_history.go +++ /dev/null @@ -1,148 +0,0 @@ -package ackhandler - -import ( - "fmt" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -type sentPacketHistory struct { - packetList *PacketList - packetMap map[protocol.PacketNumber]*PacketElement - - numOutstandingPackets int - - firstOutstanding *PacketElement -} - -func newSentPacketHistory() *sentPacketHistory { - return &sentPacketHistory{ - packetList: NewPacketList(), - packetMap: make(map[protocol.PacketNumber]*PacketElement), - } -} - -func (h *sentPacketHistory) SentPacket(p *Packet) { - h.sentPacketImpl(p) -} - -func (h *sentPacketHistory) sentPacketImpl(p *Packet) *PacketElement { - el := h.packetList.PushBack(*p) - h.packetMap[p.PacketNumber] = el - if h.firstOutstanding == nil { - h.firstOutstanding = el - } - if p.canBeRetransmitted { - h.numOutstandingPackets++ - } - return el -} - -func (h *sentPacketHistory) SentPacketsAsRetransmission(packets []*Packet, retransmissionOf protocol.PacketNumber) { - retransmission, ok := h.packetMap[retransmissionOf] - // The retransmitted packet is not present anymore. - // This can happen if it was acked in between dequeueing of the retransmission and sending. - // Just treat the retransmissions as normal packets. - // TODO: This won't happen if we clear packets queued for retransmission on new ACKs. - if !ok { - for _, packet := range packets { - h.sentPacketImpl(packet) - } - return - } - retransmission.Value.retransmittedAs = make([]protocol.PacketNumber, len(packets)) - for i, packet := range packets { - retransmission.Value.retransmittedAs[i] = packet.PacketNumber - el := h.sentPacketImpl(packet) - el.Value.isRetransmission = true - el.Value.retransmissionOf = retransmissionOf - } -} - -func (h *sentPacketHistory) GetPacket(p protocol.PacketNumber) *Packet { - if el, ok := h.packetMap[p]; ok { - return &el.Value - } - return nil -} - -// Iterate iterates through all packets. -// The callback must not modify the history. -func (h *sentPacketHistory) Iterate(cb func(*Packet) (cont bool, err error)) error { - cont := true - for el := h.packetList.Front(); cont && el != nil; el = el.Next() { - var err error - cont, err = cb(&el.Value) - if err != nil { - return err - } - } - return nil -} - -// FirstOutStanding returns the first outstanding packet. -// It must not be modified (e.g. retransmitted). -// Use DequeueFirstPacketForRetransmission() to retransmit it. -func (h *sentPacketHistory) FirstOutstanding() *Packet { - if h.firstOutstanding == nil { - return nil - } - return &h.firstOutstanding.Value -} - -// QueuePacketForRetransmission marks a packet for retransmission. -// A packet can only be queued once. -func (h *sentPacketHistory) MarkCannotBeRetransmitted(pn protocol.PacketNumber) error { - el, ok := h.packetMap[pn] - if !ok { - return fmt.Errorf("sent packet history: packet %d not found", pn) - } - if el.Value.canBeRetransmitted { - h.numOutstandingPackets-- - if h.numOutstandingPackets < 0 { - panic("numOutstandingHandshakePackets negative") - } - } - el.Value.canBeRetransmitted = false - if el == h.firstOutstanding { - h.readjustFirstOutstanding() - } - return nil -} - -// readjustFirstOutstanding readjusts the pointer to the first outstanding packet. -// This is necessary every time the first outstanding packet is deleted or retransmitted. -func (h *sentPacketHistory) readjustFirstOutstanding() { - el := h.firstOutstanding.Next() - for el != nil && !el.Value.canBeRetransmitted { - el = el.Next() - } - h.firstOutstanding = el -} - -func (h *sentPacketHistory) Len() int { - return len(h.packetMap) -} - -func (h *sentPacketHistory) Remove(p protocol.PacketNumber) error { - el, ok := h.packetMap[p] - if !ok { - return fmt.Errorf("packet %d not found in sent packet history", p) - } - if el == h.firstOutstanding { - h.readjustFirstOutstanding() - } - if el.Value.canBeRetransmitted { - h.numOutstandingPackets-- - if h.numOutstandingPackets < 0 { - panic("numOutstandingHandshakePackets negative") - } - } - h.packetList.Remove(el) - delete(h.packetMap, p) - return nil -} - -func (h *sentPacketHistory) HasOutstandingPackets() bool { - return h.numOutstandingPackets > 0 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/bandwidth.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/bandwidth.go deleted file mode 100644 index 54269c56..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/bandwidth.go +++ /dev/null @@ -1,22 +0,0 @@ -package congestion - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// Bandwidth of a connection -type Bandwidth uint64 - -const ( - // BitsPerSecond is 1 bit per second - BitsPerSecond Bandwidth = 1 - // BytesPerSecond is 1 byte per second - BytesPerSecond = 8 * BitsPerSecond -) - -// BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta -func BandwidthFromDelta(bytes protocol.ByteCount, delta time.Duration) Bandwidth { - return Bandwidth(bytes) * Bandwidth(time.Second) / Bandwidth(delta) * BytesPerSecond -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/clock.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/clock.go deleted file mode 100644 index 405fae70..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/clock.go +++ /dev/null @@ -1,18 +0,0 @@ -package congestion - -import "time" - -// A Clock returns the current time -type Clock interface { - Now() time.Time -} - -// DefaultClock implements the Clock interface using the Go stdlib clock. -type DefaultClock struct{} - -var _ Clock = DefaultClock{} - -// Now gets the current time -func (DefaultClock) Now() time.Time { - return time.Now() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic.go deleted file mode 100644 index dcf91fc6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic.go +++ /dev/null @@ -1,210 +0,0 @@ -package congestion - -import ( - "math" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// This cubic implementation is based on the one found in Chromiums's QUIC -// implementation, in the files net/quic/congestion_control/cubic.{hh,cc}. - -// Constants based on TCP defaults. -// The following constants are in 2^10 fractions of a second instead of ms to -// allow a 10 shift right to divide. - -// 1024*1024^3 (first 1024 is from 0.100^3) -// where 0.100 is 100 ms which is the scaling round trip time. -const cubeScale = 40 -const cubeCongestionWindowScale = 410 -const cubeFactor protocol.ByteCount = 1 << cubeScale / cubeCongestionWindowScale / protocol.DefaultTCPMSS - -const defaultNumConnections = 2 - -// Default Cubic backoff factor -const beta float32 = 0.7 - -// Additional backoff factor when loss occurs in the concave part of the Cubic -// curve. This additional backoff factor is expected to give up bandwidth to -// new concurrent flows and speed up convergence. -const betaLastMax float32 = 0.85 - -// Cubic implements the cubic algorithm from TCP -type Cubic struct { - clock Clock - - // Number of connections to simulate. - numConnections int - - // Time when this cycle started, after last loss event. - epoch time.Time - - // Max congestion window used just before last loss event. - // Note: to improve fairness to other streams an additional back off is - // applied to this value if the new value is below our latest value. - lastMaxCongestionWindow protocol.ByteCount - - // Number of acked bytes since the cycle started (epoch). - ackedBytesCount protocol.ByteCount - - // TCP Reno equivalent congestion window in packets. - estimatedTCPcongestionWindow protocol.ByteCount - - // Origin point of cubic function. - originPointCongestionWindow protocol.ByteCount - - // Time to origin point of cubic function in 2^10 fractions of a second. - timeToOriginPoint uint32 - - // Last congestion window in packets computed by cubic function. - lastTargetCongestionWindow protocol.ByteCount -} - -// NewCubic returns a new Cubic instance -func NewCubic(clock Clock) *Cubic { - c := &Cubic{ - clock: clock, - numConnections: defaultNumConnections, - } - c.Reset() - return c -} - -// Reset is called after a timeout to reset the cubic state -func (c *Cubic) Reset() { - c.epoch = time.Time{} - c.lastMaxCongestionWindow = 0 - c.ackedBytesCount = 0 - c.estimatedTCPcongestionWindow = 0 - c.originPointCongestionWindow = 0 - c.timeToOriginPoint = 0 - c.lastTargetCongestionWindow = 0 -} - -func (c *Cubic) alpha() float32 { - // TCPFriendly alpha is described in Section 3.3 of the CUBIC paper. Note that - // beta here is a cwnd multiplier, and is equal to 1-beta from the paper. - // We derive the equivalent alpha for an N-connection emulation as: - b := c.beta() - return 3 * float32(c.numConnections) * float32(c.numConnections) * (1 - b) / (1 + b) -} - -func (c *Cubic) beta() float32 { - // kNConnectionBeta is the backoff factor after loss for our N-connection - // emulation, which emulates the effective backoff of an ensemble of N - // TCP-Reno connections on a single loss event. The effective multiplier is - // computed as: - return (float32(c.numConnections) - 1 + beta) / float32(c.numConnections) -} - -func (c *Cubic) betaLastMax() float32 { - // betaLastMax is the additional backoff factor after loss for our - // N-connection emulation, which emulates the additional backoff of - // an ensemble of N TCP-Reno connections on a single loss event. The - // effective multiplier is computed as: - return (float32(c.numConnections) - 1 + betaLastMax) / float32(c.numConnections) -} - -// OnApplicationLimited is called on ack arrival when sender is unable to use -// the available congestion window. Resets Cubic state during quiescence. -func (c *Cubic) OnApplicationLimited() { - // When sender is not using the available congestion window, the window does - // not grow. But to be RTT-independent, Cubic assumes that the sender has been - // using the entire window during the time since the beginning of the current - // "epoch" (the end of the last loss recovery period). Since - // application-limited periods break this assumption, we reset the epoch when - // in such a period. This reset effectively freezes congestion window growth - // through application-limited periods and allows Cubic growth to continue - // when the entire window is being used. - c.epoch = time.Time{} -} - -// CongestionWindowAfterPacketLoss computes a new congestion window to use after -// a loss event. Returns the new congestion window in packets. The new -// congestion window is a multiplicative decrease of our current window. -func (c *Cubic) CongestionWindowAfterPacketLoss(currentCongestionWindow protocol.ByteCount) protocol.ByteCount { - if currentCongestionWindow+protocol.DefaultTCPMSS < c.lastMaxCongestionWindow { - // We never reached the old max, so assume we are competing with another - // flow. Use our extra back off factor to allow the other flow to go up. - c.lastMaxCongestionWindow = protocol.ByteCount(c.betaLastMax() * float32(currentCongestionWindow)) - } else { - c.lastMaxCongestionWindow = currentCongestionWindow - } - c.epoch = time.Time{} // Reset time. - return protocol.ByteCount(float32(currentCongestionWindow) * c.beta()) -} - -// CongestionWindowAfterAck computes a new congestion window to use after a received ACK. -// Returns the new congestion window in packets. The new congestion window -// follows a cubic function that depends on the time passed since last -// packet loss. -func (c *Cubic) CongestionWindowAfterAck( - ackedBytes protocol.ByteCount, - currentCongestionWindow protocol.ByteCount, - delayMin time.Duration, - eventTime time.Time, -) protocol.ByteCount { - c.ackedBytesCount += ackedBytes - - if c.epoch.IsZero() { - // First ACK after a loss event. - c.epoch = eventTime // Start of epoch. - c.ackedBytesCount = ackedBytes // Reset count. - // Reset estimated_tcp_congestion_window_ to be in sync with cubic. - c.estimatedTCPcongestionWindow = currentCongestionWindow - if c.lastMaxCongestionWindow <= currentCongestionWindow { - c.timeToOriginPoint = 0 - c.originPointCongestionWindow = currentCongestionWindow - } else { - c.timeToOriginPoint = uint32(math.Cbrt(float64(cubeFactor * (c.lastMaxCongestionWindow - currentCongestionWindow)))) - c.originPointCongestionWindow = c.lastMaxCongestionWindow - } - } - - // Change the time unit from microseconds to 2^10 fractions per second. Take - // the round trip time in account. This is done to allow us to use shift as a - // divide operator. - elapsedTime := int64(eventTime.Add(delayMin).Sub(c.epoch)/time.Microsecond) << 10 / (1000 * 1000) - - // Right-shifts of negative, signed numbers have implementation-dependent - // behavior, so force the offset to be positive, as is done in the kernel. - offset := int64(c.timeToOriginPoint) - elapsedTime - if offset < 0 { - offset = -offset - } - - deltaCongestionWindow := protocol.ByteCount(cubeCongestionWindowScale*offset*offset*offset) * protocol.DefaultTCPMSS >> cubeScale - var targetCongestionWindow protocol.ByteCount - if elapsedTime > int64(c.timeToOriginPoint) { - targetCongestionWindow = c.originPointCongestionWindow + deltaCongestionWindow - } else { - targetCongestionWindow = c.originPointCongestionWindow - deltaCongestionWindow - } - // Limit the CWND increase to half the acked bytes. - targetCongestionWindow = utils.MinByteCount(targetCongestionWindow, currentCongestionWindow+c.ackedBytesCount/2) - - // Increase the window by approximately Alpha * 1 MSS of bytes every - // time we ack an estimated tcp window of bytes. For small - // congestion windows (less than 25), the formula below will - // increase slightly slower than linearly per estimated tcp window - // of bytes. - c.estimatedTCPcongestionWindow += protocol.ByteCount(float32(c.ackedBytesCount) * c.alpha() * float32(protocol.DefaultTCPMSS) / float32(c.estimatedTCPcongestionWindow)) - c.ackedBytesCount = 0 - - // We have a new cubic congestion window. - c.lastTargetCongestionWindow = targetCongestionWindow - - // Compute target congestion_window based on cubic target and estimated TCP - // congestion_window, use highest (fastest). - if targetCongestionWindow < c.estimatedTCPcongestionWindow { - targetCongestionWindow = c.estimatedTCPcongestionWindow - } - return targetCongestionWindow -} - -// SetNumConnections sets the number of emulated connections -func (c *Cubic) SetNumConnections(n int) { - c.numConnections = n -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic_sender.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic_sender.go deleted file mode 100644 index 6f3d3289..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/cubic_sender.go +++ /dev/null @@ -1,314 +0,0 @@ -package congestion - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -const ( - maxBurstBytes = 3 * protocol.DefaultTCPMSS - renoBeta float32 = 0.7 // Reno backoff factor. - defaultMinimumCongestionWindow protocol.ByteCount = 2 * protocol.DefaultTCPMSS -) - -type cubicSender struct { - hybridSlowStart HybridSlowStart - prr PrrSender - rttStats *RTTStats - stats connectionStats - cubic *Cubic - - reno bool - - // Track the largest packet that has been sent. - largestSentPacketNumber protocol.PacketNumber - - // Track the largest packet that has been acked. - largestAckedPacketNumber protocol.PacketNumber - - // Track the largest packet number outstanding when a CWND cutback occurs. - largestSentAtLastCutback protocol.PacketNumber - - // Whether the last loss event caused us to exit slowstart. - // Used for stats collection of slowstartPacketsLost - lastCutbackExitedSlowstart bool - - // When true, exit slow start with large cutback of congestion window. - slowStartLargeReduction bool - - // Congestion window in packets. - congestionWindow protocol.ByteCount - - // Minimum congestion window in packets. - minCongestionWindow protocol.ByteCount - - // Maximum congestion window. - maxCongestionWindow protocol.ByteCount - - // Slow start congestion window in bytes, aka ssthresh. - slowstartThreshold protocol.ByteCount - - // Number of connections to simulate. - numConnections int - - // ACK counter for the Reno implementation. - numAckedPackets uint64 - - initialCongestionWindow protocol.ByteCount - initialMaxCongestionWindow protocol.ByteCount - - minSlowStartExitWindow protocol.ByteCount -} - -var _ SendAlgorithm = &cubicSender{} -var _ SendAlgorithmWithDebugInfo = &cubicSender{} - -// NewCubicSender makes a new cubic sender -func NewCubicSender(clock Clock, rttStats *RTTStats, reno bool, initialCongestionWindow, initialMaxCongestionWindow protocol.ByteCount) SendAlgorithmWithDebugInfo { - return &cubicSender{ - rttStats: rttStats, - initialCongestionWindow: initialCongestionWindow, - initialMaxCongestionWindow: initialMaxCongestionWindow, - congestionWindow: initialCongestionWindow, - minCongestionWindow: defaultMinimumCongestionWindow, - slowstartThreshold: initialMaxCongestionWindow, - maxCongestionWindow: initialMaxCongestionWindow, - numConnections: defaultNumConnections, - cubic: NewCubic(clock), - reno: reno, - } -} - -// TimeUntilSend returns when the next packet should be sent. -func (c *cubicSender) TimeUntilSend(bytesInFlight protocol.ByteCount) time.Duration { - if c.InRecovery() { - // PRR is used when in recovery. - if c.prr.CanSend(c.GetCongestionWindow(), bytesInFlight, c.GetSlowStartThreshold()) { - return 0 - } - } - return c.rttStats.SmoothedRTT() * time.Duration(protocol.DefaultTCPMSS) / time.Duration(2*c.GetCongestionWindow()) -} - -func (c *cubicSender) OnPacketSent( - sentTime time.Time, - bytesInFlight protocol.ByteCount, - packetNumber protocol.PacketNumber, - bytes protocol.ByteCount, - isRetransmittable bool, -) { - if !isRetransmittable { - return - } - if c.InRecovery() { - // PRR is used when in recovery. - c.prr.OnPacketSent(bytes) - } - c.largestSentPacketNumber = packetNumber - c.hybridSlowStart.OnPacketSent(packetNumber) -} - -func (c *cubicSender) InRecovery() bool { - return c.largestAckedPacketNumber <= c.largestSentAtLastCutback && c.largestAckedPacketNumber != 0 -} - -func (c *cubicSender) InSlowStart() bool { - return c.GetCongestionWindow() < c.GetSlowStartThreshold() -} - -func (c *cubicSender) GetCongestionWindow() protocol.ByteCount { - return c.congestionWindow -} - -func (c *cubicSender) GetSlowStartThreshold() protocol.ByteCount { - return c.slowstartThreshold -} - -func (c *cubicSender) ExitSlowstart() { - c.slowstartThreshold = c.congestionWindow -} - -func (c *cubicSender) SlowstartThreshold() protocol.ByteCount { - return c.slowstartThreshold -} - -func (c *cubicSender) MaybeExitSlowStart() { - if c.InSlowStart() && c.hybridSlowStart.ShouldExitSlowStart(c.rttStats.LatestRTT(), c.rttStats.MinRTT(), c.GetCongestionWindow()/protocol.DefaultTCPMSS) { - c.ExitSlowstart() - } -} - -func (c *cubicSender) OnPacketAcked( - ackedPacketNumber protocol.PacketNumber, - ackedBytes protocol.ByteCount, - priorInFlight protocol.ByteCount, - eventTime time.Time, -) { - c.largestAckedPacketNumber = utils.MaxPacketNumber(ackedPacketNumber, c.largestAckedPacketNumber) - if c.InRecovery() { - // PRR is used when in recovery. - c.prr.OnPacketAcked(ackedBytes) - return - } - c.maybeIncreaseCwnd(ackedPacketNumber, ackedBytes, priorInFlight, eventTime) - if c.InSlowStart() { - c.hybridSlowStart.OnPacketAcked(ackedPacketNumber) - } -} - -func (c *cubicSender) OnPacketLost( - packetNumber protocol.PacketNumber, - lostBytes protocol.ByteCount, - priorInFlight protocol.ByteCount, -) { - // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets - // already sent should be treated as a single loss event, since it's expected. - if packetNumber <= c.largestSentAtLastCutback { - if c.lastCutbackExitedSlowstart { - c.stats.slowstartPacketsLost++ - c.stats.slowstartBytesLost += lostBytes - if c.slowStartLargeReduction { - // Reduce congestion window by lost_bytes for every loss. - c.congestionWindow = utils.MaxByteCount(c.congestionWindow-lostBytes, c.minSlowStartExitWindow) - c.slowstartThreshold = c.congestionWindow - } - } - return - } - c.lastCutbackExitedSlowstart = c.InSlowStart() - if c.InSlowStart() { - c.stats.slowstartPacketsLost++ - } - - c.prr.OnPacketLost(priorInFlight) - - // TODO(chromium): Separate out all of slow start into a separate class. - if c.slowStartLargeReduction && c.InSlowStart() { - if c.congestionWindow >= 2*c.initialCongestionWindow { - c.minSlowStartExitWindow = c.congestionWindow / 2 - } - c.congestionWindow -= protocol.DefaultTCPMSS - } else if c.reno { - c.congestionWindow = protocol.ByteCount(float32(c.congestionWindow) * c.RenoBeta()) - } else { - c.congestionWindow = c.cubic.CongestionWindowAfterPacketLoss(c.congestionWindow) - } - if c.congestionWindow < c.minCongestionWindow { - c.congestionWindow = c.minCongestionWindow - } - c.slowstartThreshold = c.congestionWindow - c.largestSentAtLastCutback = c.largestSentPacketNumber - // reset packet count from congestion avoidance mode. We start - // counting again when we're out of recovery. - c.numAckedPackets = 0 -} - -func (c *cubicSender) RenoBeta() float32 { - // kNConnectionBeta is the backoff factor after loss for our N-connection - // emulation, which emulates the effective backoff of an ensemble of N - // TCP-Reno connections on a single loss event. The effective multiplier is - // computed as: - return (float32(c.numConnections) - 1. + renoBeta) / float32(c.numConnections) -} - -// Called when we receive an ack. Normal TCP tracks how many packets one ack -// represents, but quic has a separate ack for each packet. -func (c *cubicSender) maybeIncreaseCwnd( - ackedPacketNumber protocol.PacketNumber, - ackedBytes protocol.ByteCount, - priorInFlight protocol.ByteCount, - eventTime time.Time, -) { - // Do not increase the congestion window unless the sender is close to using - // the current window. - if !c.isCwndLimited(priorInFlight) { - c.cubic.OnApplicationLimited() - return - } - if c.congestionWindow >= c.maxCongestionWindow { - return - } - if c.InSlowStart() { - // TCP slow start, exponential growth, increase by one for each ACK. - c.congestionWindow += protocol.DefaultTCPMSS - return - } - // Congestion avoidance - if c.reno { - // Classic Reno congestion avoidance. - c.numAckedPackets++ - // Divide by num_connections to smoothly increase the CWND at a faster - // rate than conventional Reno. - if c.numAckedPackets*uint64(c.numConnections) >= uint64(c.congestionWindow)/uint64(protocol.DefaultTCPMSS) { - c.congestionWindow += protocol.DefaultTCPMSS - c.numAckedPackets = 0 - } - } else { - c.congestionWindow = utils.MinByteCount(c.maxCongestionWindow, c.cubic.CongestionWindowAfterAck(ackedBytes, c.congestionWindow, c.rttStats.MinRTT(), eventTime)) - } -} - -func (c *cubicSender) isCwndLimited(bytesInFlight protocol.ByteCount) bool { - congestionWindow := c.GetCongestionWindow() - if bytesInFlight >= congestionWindow { - return true - } - availableBytes := congestionWindow - bytesInFlight - slowStartLimited := c.InSlowStart() && bytesInFlight > congestionWindow/2 - return slowStartLimited || availableBytes <= maxBurstBytes -} - -// BandwidthEstimate returns the current bandwidth estimate -func (c *cubicSender) BandwidthEstimate() Bandwidth { - srtt := c.rttStats.SmoothedRTT() - if srtt == 0 { - // If we haven't measured an rtt, the bandwidth estimate is unknown. - return 0 - } - return BandwidthFromDelta(c.GetCongestionWindow(), srtt) -} - -// HybridSlowStart returns the hybrid slow start instance for testing -func (c *cubicSender) HybridSlowStart() *HybridSlowStart { - return &c.hybridSlowStart -} - -// SetNumEmulatedConnections sets the number of emulated connections -func (c *cubicSender) SetNumEmulatedConnections(n int) { - c.numConnections = utils.Max(n, 1) - c.cubic.SetNumConnections(c.numConnections) -} - -// OnRetransmissionTimeout is called on an retransmission timeout -func (c *cubicSender) OnRetransmissionTimeout(packetsRetransmitted bool) { - c.largestSentAtLastCutback = 0 - if !packetsRetransmitted { - return - } - c.hybridSlowStart.Restart() - c.cubic.Reset() - c.slowstartThreshold = c.congestionWindow / 2 - c.congestionWindow = c.minCongestionWindow -} - -// OnConnectionMigration is called when the connection is migrated (?) -func (c *cubicSender) OnConnectionMigration() { - c.hybridSlowStart.Restart() - c.prr = PrrSender{} - c.largestSentPacketNumber = 0 - c.largestAckedPacketNumber = 0 - c.largestSentAtLastCutback = 0 - c.lastCutbackExitedSlowstart = false - c.cubic.Reset() - c.numAckedPackets = 0 - c.congestionWindow = c.initialCongestionWindow - c.slowstartThreshold = c.initialMaxCongestionWindow - c.maxCongestionWindow = c.initialMaxCongestionWindow -} - -// SetSlowStartLargeReduction allows enabling the SSLR experiment -func (c *cubicSender) SetSlowStartLargeReduction(enabled bool) { - c.slowStartLargeReduction = enabled -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/hybrid_slow_start.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/hybrid_slow_start.go deleted file mode 100644 index f41c1e5c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/hybrid_slow_start.go +++ /dev/null @@ -1,111 +0,0 @@ -package congestion - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// Note(pwestin): the magic clamping numbers come from the original code in -// tcp_cubic.c. -const hybridStartLowWindow = protocol.ByteCount(16) - -// Number of delay samples for detecting the increase of delay. -const hybridStartMinSamples = uint32(8) - -// Exit slow start if the min rtt has increased by more than 1/8th. -const hybridStartDelayFactorExp = 3 // 2^3 = 8 -// The original paper specifies 2 and 8ms, but those have changed over time. -const hybridStartDelayMinThresholdUs = int64(4000) -const hybridStartDelayMaxThresholdUs = int64(16000) - -// HybridSlowStart implements the TCP hybrid slow start algorithm -type HybridSlowStart struct { - endPacketNumber protocol.PacketNumber - lastSentPacketNumber protocol.PacketNumber - started bool - currentMinRTT time.Duration - rttSampleCount uint32 - hystartFound bool -} - -// StartReceiveRound is called for the start of each receive round (burst) in the slow start phase. -func (s *HybridSlowStart) StartReceiveRound(lastSent protocol.PacketNumber) { - s.endPacketNumber = lastSent - s.currentMinRTT = 0 - s.rttSampleCount = 0 - s.started = true -} - -// IsEndOfRound returns true if this ack is the last packet number of our current slow start round. -func (s *HybridSlowStart) IsEndOfRound(ack protocol.PacketNumber) bool { - return s.endPacketNumber < ack -} - -// ShouldExitSlowStart should be called on every new ack frame, since a new -// RTT measurement can be made then. -// rtt: the RTT for this ack packet. -// minRTT: is the lowest delay (RTT) we have seen during the session. -// congestionWindow: the congestion window in packets. -func (s *HybridSlowStart) ShouldExitSlowStart(latestRTT time.Duration, minRTT time.Duration, congestionWindow protocol.ByteCount) bool { - if !s.started { - // Time to start the hybrid slow start. - s.StartReceiveRound(s.lastSentPacketNumber) - } - if s.hystartFound { - return true - } - // Second detection parameter - delay increase detection. - // Compare the minimum delay (s.currentMinRTT) of the current - // burst of packets relative to the minimum delay during the session. - // Note: we only look at the first few(8) packets in each burst, since we - // only want to compare the lowest RTT of the burst relative to previous - // bursts. - s.rttSampleCount++ - if s.rttSampleCount <= hybridStartMinSamples { - if s.currentMinRTT == 0 || s.currentMinRTT > latestRTT { - s.currentMinRTT = latestRTT - } - } - // We only need to check this once per round. - if s.rttSampleCount == hybridStartMinSamples { - // Divide minRTT by 8 to get a rtt increase threshold for exiting. - minRTTincreaseThresholdUs := int64(minRTT / time.Microsecond >> hybridStartDelayFactorExp) - // Ensure the rtt threshold is never less than 2ms or more than 16ms. - minRTTincreaseThresholdUs = utils.MinInt64(minRTTincreaseThresholdUs, hybridStartDelayMaxThresholdUs) - minRTTincreaseThreshold := time.Duration(utils.MaxInt64(minRTTincreaseThresholdUs, hybridStartDelayMinThresholdUs)) * time.Microsecond - - if s.currentMinRTT > (minRTT + minRTTincreaseThreshold) { - s.hystartFound = true - } - } - // Exit from slow start if the cwnd is greater than 16 and - // increasing delay is found. - return congestionWindow >= hybridStartLowWindow && s.hystartFound -} - -// OnPacketSent is called when a packet was sent -func (s *HybridSlowStart) OnPacketSent(packetNumber protocol.PacketNumber) { - s.lastSentPacketNumber = packetNumber -} - -// OnPacketAcked gets invoked after ShouldExitSlowStart, so it's best to end -// the round when the final packet of the burst is received and start it on -// the next incoming ack. -func (s *HybridSlowStart) OnPacketAcked(ackedPacketNumber protocol.PacketNumber) { - if s.IsEndOfRound(ackedPacketNumber) { - s.started = false - } -} - -// Started returns true if started -func (s *HybridSlowStart) Started() bool { - return s.started -} - -// Restart the slow start phase -func (s *HybridSlowStart) Restart() { - s.started = false - s.hystartFound = false -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/interface.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/interface.go deleted file mode 100644 index 7c27da64..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/interface.go +++ /dev/null @@ -1,36 +0,0 @@ -package congestion - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A SendAlgorithm performs congestion control and calculates the congestion window -type SendAlgorithm interface { - TimeUntilSend(bytesInFlight protocol.ByteCount) time.Duration - OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool) - GetCongestionWindow() protocol.ByteCount - MaybeExitSlowStart() - OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime time.Time) - OnPacketLost(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount) - SetNumEmulatedConnections(n int) - OnRetransmissionTimeout(packetsRetransmitted bool) - OnConnectionMigration() - - // Experiments - SetSlowStartLargeReduction(enabled bool) -} - -// SendAlgorithmWithDebugInfo adds some debug functions to SendAlgorithm -type SendAlgorithmWithDebugInfo interface { - SendAlgorithm - BandwidthEstimate() Bandwidth - - // Stuff only used in testing - - HybridSlowStart() *HybridSlowStart - SlowstartThreshold() protocol.ByteCount - RenoBeta() float32 - InRecovery() bool -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/prr_sender.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/prr_sender.go deleted file mode 100644 index 5c807d19..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/prr_sender.go +++ /dev/null @@ -1,54 +0,0 @@ -package congestion - -import ( - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// PrrSender implements the Proportional Rate Reduction (PRR) per RFC 6937 -type PrrSender struct { - bytesSentSinceLoss protocol.ByteCount - bytesDeliveredSinceLoss protocol.ByteCount - ackCountSinceLoss protocol.ByteCount - bytesInFlightBeforeLoss protocol.ByteCount -} - -// OnPacketSent should be called after a packet was sent -func (p *PrrSender) OnPacketSent(sentBytes protocol.ByteCount) { - p.bytesSentSinceLoss += sentBytes -} - -// OnPacketLost should be called on the first loss that triggers a recovery -// period and all other methods in this class should only be called when in -// recovery. -func (p *PrrSender) OnPacketLost(priorInFlight protocol.ByteCount) { - p.bytesSentSinceLoss = 0 - p.bytesInFlightBeforeLoss = priorInFlight - p.bytesDeliveredSinceLoss = 0 - p.ackCountSinceLoss = 0 -} - -// OnPacketAcked should be called after a packet was acked -func (p *PrrSender) OnPacketAcked(ackedBytes protocol.ByteCount) { - p.bytesDeliveredSinceLoss += ackedBytes - p.ackCountSinceLoss++ -} - -// CanSend returns if packets can be sent -func (p *PrrSender) CanSend(congestionWindow, bytesInFlight, slowstartThreshold protocol.ByteCount) bool { - // Return QuicTime::Zero In order to ensure limited transmit always works. - if p.bytesSentSinceLoss == 0 || bytesInFlight < protocol.DefaultTCPMSS { - return true - } - if congestionWindow > bytesInFlight { - // During PRR-SSRB, limit outgoing packets to 1 extra MSS per ack, instead - // of sending the entire available window. This prevents burst retransmits - // when more packets are lost than the CWND reduction. - // limit = MAX(prr_delivered - prr_out, DeliveredData) + MSS - return p.bytesDeliveredSinceLoss+p.ackCountSinceLoss*protocol.DefaultTCPMSS > p.bytesSentSinceLoss - } - // Implement Proportional Rate Reduction (RFC6937). - // Checks a simplified version of the PRR formula that doesn't use division: - // AvailableSendWindow = - // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent - return p.bytesDeliveredSinceLoss*slowstartThreshold > p.bytesSentSinceLoss*p.bytesInFlightBeforeLoss -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/rtt_stats.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/rtt_stats.go deleted file mode 100644 index f0ebbb23..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/rtt_stats.go +++ /dev/null @@ -1,101 +0,0 @@ -package congestion - -import ( - "time" - - "github.com/lucas-clemente/quic-go/internal/utils" -) - -const ( - rttAlpha float32 = 0.125 - oneMinusAlpha float32 = (1 - rttAlpha) - rttBeta float32 = 0.25 - oneMinusBeta float32 = (1 - rttBeta) - // The default RTT used before an RTT sample is taken. - defaultInitialRTT = 100 * time.Millisecond -) - -// RTTStats provides round-trip statistics -type RTTStats struct { - minRTT time.Duration - latestRTT time.Duration - smoothedRTT time.Duration - meanDeviation time.Duration -} - -// NewRTTStats makes a properly initialized RTTStats object -func NewRTTStats() *RTTStats { - return &RTTStats{} -} - -// MinRTT Returns the minRTT for the entire connection. -// May return Zero if no valid updates have occurred. -func (r *RTTStats) MinRTT() time.Duration { return r.minRTT } - -// LatestRTT returns the most recent rtt measurement. -// May return Zero if no valid updates have occurred. -func (r *RTTStats) LatestRTT() time.Duration { return r.latestRTT } - -// SmoothedRTT returns the EWMA smoothed RTT for the connection. -// May return Zero if no valid updates have occurred. -func (r *RTTStats) SmoothedRTT() time.Duration { return r.smoothedRTT } - -// SmoothedOrInitialRTT returns the EWMA smoothed RTT for the connection. -// If no valid updates have occurred, it returns the initial RTT. -func (r *RTTStats) SmoothedOrInitialRTT() time.Duration { - if r.smoothedRTT != 0 { - return r.smoothedRTT - } - return defaultInitialRTT -} - -// MeanDeviation gets the mean deviation -func (r *RTTStats) MeanDeviation() time.Duration { return r.meanDeviation } - -// UpdateRTT updates the RTT based on a new sample. -func (r *RTTStats) UpdateRTT(sendDelta, ackDelay time.Duration, now time.Time) { - if sendDelta == utils.InfDuration || sendDelta <= 0 { - return - } - - // Update r.minRTT first. r.minRTT does not use an rttSample corrected for - // ackDelay but the raw observed sendDelta, since poor clock granularity at - // the client may cause a high ackDelay to result in underestimation of the - // r.minRTT. - if r.minRTT == 0 || r.minRTT > sendDelta { - r.minRTT = sendDelta - } - - // Correct for ackDelay if information received from the peer results in a - // an RTT sample at least as large as minRTT. Otherwise, only use the - // sendDelta. - sample := sendDelta - if sample-r.minRTT >= ackDelay { - sample -= ackDelay - } - r.latestRTT = sample - // First time call. - if r.smoothedRTT == 0 { - r.smoothedRTT = sample - r.meanDeviation = sample / 2 - } else { - r.meanDeviation = time.Duration(oneMinusBeta*float32(r.meanDeviation/time.Microsecond)+rttBeta*float32(utils.AbsDuration(r.smoothedRTT-sample)/time.Microsecond)) * time.Microsecond - r.smoothedRTT = time.Duration((float32(r.smoothedRTT/time.Microsecond)*oneMinusAlpha)+(float32(sample/time.Microsecond)*rttAlpha)) * time.Microsecond - } -} - -// OnConnectionMigration is called when connection migrates and rtt measurement needs to be reset. -func (r *RTTStats) OnConnectionMigration() { - r.latestRTT = 0 - r.minRTT = 0 - r.smoothedRTT = 0 - r.meanDeviation = 0 -} - -// ExpireSmoothedMetrics causes the smoothed_rtt to be increased to the latest_rtt if the latest_rtt -// is larger. The mean deviation is increased to the most recent deviation if -// it's larger. -func (r *RTTStats) ExpireSmoothedMetrics() { - r.meanDeviation = utils.MaxDuration(r.meanDeviation, utils.AbsDuration(r.smoothedRTT-r.latestRTT)) - r.smoothedRTT = utils.MaxDuration(r.smoothedRTT, r.latestRTT) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/stats.go b/vendor/github.com/lucas-clemente/quic-go/internal/congestion/stats.go deleted file mode 100644 index ed669c14..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/congestion/stats.go +++ /dev/null @@ -1,8 +0,0 @@ -package congestion - -import "github.com/lucas-clemente/quic-go/internal/protocol" - -type connectionStats struct { - slowstartPacketsLost protocol.PacketNumber - slowstartBytesLost protocol.ByteCount -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/base_flow_controller.go b/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/base_flow_controller.go deleted file mode 100644 index 6a0aa3c5..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/base_flow_controller.go +++ /dev/null @@ -1,122 +0,0 @@ -package flowcontrol - -import ( - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -type baseFlowController struct { - // for sending data - bytesSent protocol.ByteCount - sendWindow protocol.ByteCount - lastBlockedAt protocol.ByteCount - - // for receiving data - mutex sync.RWMutex - bytesRead protocol.ByteCount - highestReceived protocol.ByteCount - receiveWindow protocol.ByteCount - receiveWindowSize protocol.ByteCount - maxReceiveWindowSize protocol.ByteCount - - epochStartTime time.Time - epochStartOffset protocol.ByteCount - rttStats *congestion.RTTStats - - logger utils.Logger -} - -// IsNewlyBlocked says if it is newly blocked by flow control. -// For every offset, it only returns true once. -// If it is blocked, the offset is returned. -func (c *baseFlowController) IsNewlyBlocked() (bool, protocol.ByteCount) { - if c.sendWindowSize() != 0 || c.sendWindow == c.lastBlockedAt { - return false, 0 - } - c.lastBlockedAt = c.sendWindow - return true, c.sendWindow -} - -func (c *baseFlowController) AddBytesSent(n protocol.ByteCount) { - c.bytesSent += n -} - -// UpdateSendWindow should be called after receiving a WindowUpdateFrame -// it returns true if the window was actually updated -func (c *baseFlowController) UpdateSendWindow(offset protocol.ByteCount) { - if offset > c.sendWindow { - c.sendWindow = offset - } -} - -func (c *baseFlowController) sendWindowSize() protocol.ByteCount { - // this only happens during connection establishment, when data is sent before we receive the peer's transport parameters - if c.bytesSent > c.sendWindow { - return 0 - } - return c.sendWindow - c.bytesSent -} - -func (c *baseFlowController) AddBytesRead(n protocol.ByteCount) { - c.mutex.Lock() - defer c.mutex.Unlock() - - // pretend we sent a WindowUpdate when reading the first byte - // this way auto-tuning of the window size already works for the first WindowUpdate - if c.bytesRead == 0 { - c.startNewAutoTuningEpoch() - } - c.bytesRead += n -} - -func (c *baseFlowController) hasWindowUpdate() bool { - bytesRemaining := c.receiveWindow - c.bytesRead - // update the window when more than the threshold was consumed - return bytesRemaining <= protocol.ByteCount((float64(c.receiveWindowSize) * float64((1 - protocol.WindowUpdateThreshold)))) -} - -// getWindowUpdate updates the receive window, if necessary -// it returns the new offset -func (c *baseFlowController) getWindowUpdate() protocol.ByteCount { - if !c.hasWindowUpdate() { - return 0 - } - - c.maybeAdjustWindowSize() - c.receiveWindow = c.bytesRead + c.receiveWindowSize - return c.receiveWindow -} - -// maybeAdjustWindowSize increases the receiveWindowSize if we're sending updates too often. -// For details about auto-tuning, see https://docs.google.com/document/d/1SExkMmGiz8VYzV3s9E35JQlJ73vhzCekKkDi85F1qCE/edit?usp=sharing. -func (c *baseFlowController) maybeAdjustWindowSize() { - bytesReadInEpoch := c.bytesRead - c.epochStartOffset - // don't do anything if less than half the window has been consumed - if bytesReadInEpoch <= c.receiveWindowSize/2 { - return - } - rtt := c.rttStats.SmoothedRTT() - if rtt == 0 { - return - } - - fraction := float64(bytesReadInEpoch) / float64(c.receiveWindowSize) - if time.Since(c.epochStartTime) < time.Duration(4*fraction*float64(rtt)) { - // window is consumed too fast, try to increase the window size - c.receiveWindowSize = utils.MinByteCount(2*c.receiveWindowSize, c.maxReceiveWindowSize) - } - c.startNewAutoTuningEpoch() -} - -func (c *baseFlowController) startNewAutoTuningEpoch() { - c.epochStartTime = time.Now() - c.epochStartOffset = c.bytesRead -} - -func (c *baseFlowController) checkFlowControlViolation() bool { - return c.highestReceived > c.receiveWindow -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/connection_flow_controller.go b/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/connection_flow_controller.go deleted file mode 100644 index 1393335b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/connection_flow_controller.go +++ /dev/null @@ -1,92 +0,0 @@ -package flowcontrol - -import ( - "fmt" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -type connectionFlowController struct { - baseFlowController - - queueWindowUpdate func() -} - -var _ ConnectionFlowController = &connectionFlowController{} - -// NewConnectionFlowController gets a new flow controller for the connection -// It is created before we receive the peer's transport paramenters, thus it starts with a sendWindow of 0. -func NewConnectionFlowController( - receiveWindow protocol.ByteCount, - maxReceiveWindow protocol.ByteCount, - queueWindowUpdate func(), - rttStats *congestion.RTTStats, - logger utils.Logger, -) ConnectionFlowController { - return &connectionFlowController{ - baseFlowController: baseFlowController{ - rttStats: rttStats, - receiveWindow: receiveWindow, - receiveWindowSize: receiveWindow, - maxReceiveWindowSize: maxReceiveWindow, - logger: logger, - }, - queueWindowUpdate: queueWindowUpdate, - } -} - -func (c *connectionFlowController) SendWindowSize() protocol.ByteCount { - return c.baseFlowController.sendWindowSize() -} - -// IncrementHighestReceived adds an increment to the highestReceived value -func (c *connectionFlowController) IncrementHighestReceived(increment protocol.ByteCount) error { - c.mutex.Lock() - defer c.mutex.Unlock() - - c.highestReceived += increment - if c.checkFlowControlViolation() { - return qerr.Error(qerr.FlowControlError, fmt.Sprintf("Received %d bytes for the connection, allowed %d bytes", c.highestReceived, c.receiveWindow)) - } - return nil -} - -func (c *connectionFlowController) AddBytesRead(n protocol.ByteCount) { - c.baseFlowController.AddBytesRead(n) - c.maybeQueueWindowUpdate() -} - -func (c *connectionFlowController) maybeQueueWindowUpdate() { - c.mutex.Lock() - hasWindowUpdate := c.hasWindowUpdate() - c.mutex.Unlock() - if hasWindowUpdate { - c.queueWindowUpdate() - } -} - -func (c *connectionFlowController) GetWindowUpdate() protocol.ByteCount { - c.mutex.Lock() - oldWindowSize := c.receiveWindowSize - offset := c.baseFlowController.getWindowUpdate() - if oldWindowSize < c.receiveWindowSize { - c.logger.Debugf("Increasing receive flow control window for the connection to %d kB", c.receiveWindowSize/(1<<10)) - } - c.mutex.Unlock() - return offset -} - -// EnsureMinimumWindowSize sets a minimum window size -// it should make sure that the connection-level window is increased when a stream-level window grows -func (c *connectionFlowController) EnsureMinimumWindowSize(inc protocol.ByteCount) { - c.mutex.Lock() - if inc > c.receiveWindowSize { - c.logger.Debugf("Increasing receive flow control window for the connection to %d kB, in response to stream flow control window increase", c.receiveWindowSize/(1<<10)) - c.receiveWindowSize = utils.MinByteCount(inc, c.maxReceiveWindowSize) - c.startNewAutoTuningEpoch() - } - c.mutex.Unlock() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/interface.go b/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/interface.go deleted file mode 100644 index a47e7cd7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -package flowcontrol - -import "github.com/lucas-clemente/quic-go/internal/protocol" - -type flowController interface { - // for sending - SendWindowSize() protocol.ByteCount - UpdateSendWindow(protocol.ByteCount) - AddBytesSent(protocol.ByteCount) - // for receiving - AddBytesRead(protocol.ByteCount) - GetWindowUpdate() protocol.ByteCount // returns 0 if no update is necessary - IsNewlyBlocked() (bool, protocol.ByteCount) -} - -// A StreamFlowController is a flow controller for a QUIC stream. -type StreamFlowController interface { - flowController - // for receiving - // UpdateHighestReceived should be called when a new highest offset is received - // final has to be to true if this is the final offset of the stream, - // as contained in a STREAM frame with FIN bit, and the RESET_STREAM frame - UpdateHighestReceived(offset protocol.ByteCount, final bool) error - // Abandon should be called when reading from the stream is aborted early, - // and there won't be any further calls to AddBytesRead. - Abandon() -} - -// The ConnectionFlowController is the flow controller for the connection. -type ConnectionFlowController interface { - flowController -} - -type connectionFlowControllerI interface { - ConnectionFlowController - // The following two methods are not supposed to be called from outside this packet, but are needed internally - // for sending - EnsureMinimumWindowSize(protocol.ByteCount) - // for receiving - IncrementHighestReceived(protocol.ByteCount) error -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/stream_flow_controller.go b/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/stream_flow_controller.go deleted file mode 100644 index bb22337d..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol/stream_flow_controller.go +++ /dev/null @@ -1,139 +0,0 @@ -package flowcontrol - -import ( - "fmt" - - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -type streamFlowController struct { - baseFlowController - - streamID protocol.StreamID - - queueWindowUpdate func() - - connection connectionFlowControllerI - - receivedFinalOffset bool -} - -var _ StreamFlowController = &streamFlowController{} - -// NewStreamFlowController gets a new flow controller for a stream -func NewStreamFlowController( - streamID protocol.StreamID, - cfc ConnectionFlowController, - receiveWindow protocol.ByteCount, - maxReceiveWindow protocol.ByteCount, - initialSendWindow protocol.ByteCount, - queueWindowUpdate func(protocol.StreamID), - rttStats *congestion.RTTStats, - logger utils.Logger, -) StreamFlowController { - return &streamFlowController{ - streamID: streamID, - connection: cfc.(connectionFlowControllerI), - queueWindowUpdate: func() { queueWindowUpdate(streamID) }, - baseFlowController: baseFlowController{ - rttStats: rttStats, - receiveWindow: receiveWindow, - receiveWindowSize: receiveWindow, - maxReceiveWindowSize: maxReceiveWindow, - sendWindow: initialSendWindow, - logger: logger, - }, - } -} - -// UpdateHighestReceived updates the highestReceived value, if the offset is higher. -func (c *streamFlowController) UpdateHighestReceived(offset protocol.ByteCount, final bool) error { - c.mutex.Lock() - defer c.mutex.Unlock() - - // If the final offset for this stream is already known, check for consistency. - if c.receivedFinalOffset { - // If we receive another final offset, check that it's the same. - if final && offset != c.highestReceived { - return qerr.Error(qerr.FinalSizeError, fmt.Sprintf("Received inconsistent final offset for stream %d (old: %#x, new: %#x bytes)", c.streamID, c.highestReceived, offset)) - } - // Check that the offset is below the final offset. - if offset > c.highestReceived { - return qerr.Error(qerr.FinalSizeError, fmt.Sprintf("Received offset %#x for stream %d. Final offset was already received at %#x", offset, c.streamID, c.highestReceived)) - } - } - - if final { - c.receivedFinalOffset = true - } - if offset == c.highestReceived { - return nil - } - // A higher offset was received before. - // This can happen due to reordering. - if offset <= c.highestReceived { - if final { - return qerr.Error(qerr.FinalSizeError, fmt.Sprintf("Received final offset %#x for stream %d, but already received offset %#x before", offset, c.streamID, c.highestReceived)) - } - return nil - } - - increment := offset - c.highestReceived - c.highestReceived = offset - if c.checkFlowControlViolation() { - return qerr.Error(qerr.FlowControlError, fmt.Sprintf("Received %#x bytes on stream %d, allowed %#x bytes", offset, c.streamID, c.receiveWindow)) - } - return c.connection.IncrementHighestReceived(increment) -} - -func (c *streamFlowController) AddBytesRead(n protocol.ByteCount) { - c.baseFlowController.AddBytesRead(n) - c.maybeQueueWindowUpdate() - c.connection.AddBytesRead(n) -} - -func (c *streamFlowController) Abandon() { - if unread := c.highestReceived - c.bytesRead; unread > 0 { - c.connection.AddBytesRead(unread) - } -} - -func (c *streamFlowController) AddBytesSent(n protocol.ByteCount) { - c.baseFlowController.AddBytesSent(n) - c.connection.AddBytesSent(n) -} - -func (c *streamFlowController) SendWindowSize() protocol.ByteCount { - return utils.MinByteCount(c.baseFlowController.sendWindowSize(), c.connection.SendWindowSize()) -} - -func (c *streamFlowController) maybeQueueWindowUpdate() { - c.mutex.Lock() - hasWindowUpdate := !c.receivedFinalOffset && c.hasWindowUpdate() - c.mutex.Unlock() - if hasWindowUpdate { - c.queueWindowUpdate() - } -} - -func (c *streamFlowController) GetWindowUpdate() protocol.ByteCount { - // don't use defer for unlocking the mutex here, GetWindowUpdate() is called frequently and defer shows up in the profiler - c.mutex.Lock() - // if we already received the final offset for this stream, the peer won't need any additional flow control credit - if c.receivedFinalOffset { - c.mutex.Unlock() - return 0 - } - - oldWindowSize := c.receiveWindowSize - offset := c.baseFlowController.getWindowUpdate() - if c.receiveWindowSize > oldWindowSize { // auto-tuning enlarged the window size - c.logger.Debugf("Increasing receive flow control window for stream %d to %d kB", c.streamID, c.receiveWindowSize/(1<<10)) - c.connection.EnsureMinimumWindowSize(protocol.ByteCount(float64(c.receiveWindowSize) * protocol.ConnectionFlowControlMultiplier)) - } - c.mutex.Unlock() - return offset -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/aead.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/aead.go deleted file mode 100644 index 07ce74f7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/aead.go +++ /dev/null @@ -1,104 +0,0 @@ -package handshake - -import ( - "crypto/cipher" - "encoding/binary" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -type sealer struct { - aead cipher.AEAD - hpEncrypter cipher.Block - - // use a single slice to avoid allocations - nonceBuf []byte - hpMask []byte - - // short headers protect 5 bits in the first byte, long headers only 4 - is1RTT bool -} - -var _ Sealer = &sealer{} - -func newSealer(aead cipher.AEAD, hpEncrypter cipher.Block, is1RTT bool) Sealer { - return &sealer{ - aead: aead, - nonceBuf: make([]byte, aead.NonceSize()), - is1RTT: is1RTT, - hpEncrypter: hpEncrypter, - hpMask: make([]byte, hpEncrypter.BlockSize()), - } -} - -func (s *sealer) Seal(dst, src []byte, pn protocol.PacketNumber, ad []byte) []byte { - binary.BigEndian.PutUint64(s.nonceBuf[len(s.nonceBuf)-8:], uint64(pn)) - // The AEAD we're using here will be the qtls.aeadAESGCM13. - // It uses the nonce provided here and XOR it with the IV. - return s.aead.Seal(dst, s.nonceBuf, src, ad) -} - -func (s *sealer) EncryptHeader(sample []byte, firstByte *byte, pnBytes []byte) { - if len(sample) != s.hpEncrypter.BlockSize() { - panic("invalid sample size") - } - s.hpEncrypter.Encrypt(s.hpMask, sample) - if s.is1RTT { - *firstByte ^= s.hpMask[0] & 0x1f - } else { - *firstByte ^= s.hpMask[0] & 0xf - } - for i := range pnBytes { - pnBytes[i] ^= s.hpMask[i+1] - } -} - -func (s *sealer) Overhead() int { - return s.aead.Overhead() -} - -type opener struct { - aead cipher.AEAD - pnDecrypter cipher.Block - - // use a single slice to avoid allocations - nonceBuf []byte - hpMask []byte - - // short headers protect 5 bits in the first byte, long headers only 4 - is1RTT bool -} - -var _ Opener = &opener{} - -func newOpener(aead cipher.AEAD, pnDecrypter cipher.Block, is1RTT bool) Opener { - return &opener{ - aead: aead, - nonceBuf: make([]byte, aead.NonceSize()), - is1RTT: is1RTT, - pnDecrypter: pnDecrypter, - hpMask: make([]byte, pnDecrypter.BlockSize()), - } -} - -func (o *opener) Open(dst, src []byte, pn protocol.PacketNumber, ad []byte) ([]byte, error) { - binary.BigEndian.PutUint64(o.nonceBuf[len(o.nonceBuf)-8:], uint64(pn)) - // The AEAD we're using here will be the qtls.aeadAESGCM13. - // It uses the nonce provided here and XOR it with the IV. - return o.aead.Open(dst, o.nonceBuf, src, ad) -} - -func (o *opener) DecryptHeader(sample []byte, firstByte *byte, pnBytes []byte) { - if len(sample) != o.pnDecrypter.BlockSize() { - panic("invalid sample size") - } - o.pnDecrypter.Encrypt(o.hpMask, sample) - if o.is1RTT { - *firstByte ^= o.hpMask[0] & 0x1f - } else { - *firstByte ^= o.hpMask[0] & 0xf - } - for i := range pnBytes { - pnBytes[i] ^= o.hpMask[i+1] - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_generator.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_generator.go deleted file mode 100644 index 6d1288ed..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_generator.go +++ /dev/null @@ -1,109 +0,0 @@ -package handshake - -import ( - "encoding/asn1" - "fmt" - "net" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -const ( - cookiePrefixIP byte = iota - cookiePrefixString -) - -// A Cookie is derived from the client address and can be used to verify the ownership of this address. -type Cookie struct { - RemoteAddr string - OriginalDestConnectionID protocol.ConnectionID - // The time that the Cookie was issued (resolution 1 second) - SentTime time.Time -} - -// token is the struct that is used for ASN1 serialization and deserialization -type token struct { - RemoteAddr []byte - OriginalDestConnectionID []byte - - Timestamp int64 -} - -// A CookieGenerator generates Cookies -type CookieGenerator struct { - cookieProtector cookieProtector -} - -// NewCookieGenerator initializes a new CookieGenerator -func NewCookieGenerator() (*CookieGenerator, error) { - cookieProtector, err := newCookieProtector() - if err != nil { - return nil, err - } - return &CookieGenerator{ - cookieProtector: cookieProtector, - }, nil -} - -// NewToken generates a new Cookie for a given source address -func (g *CookieGenerator) NewToken(raddr net.Addr, origConnID protocol.ConnectionID) ([]byte, error) { - data, err := asn1.Marshal(token{ - RemoteAddr: encodeRemoteAddr(raddr), - OriginalDestConnectionID: origConnID, - Timestamp: time.Now().Unix(), - }) - if err != nil { - return nil, err - } - return g.cookieProtector.NewToken(data) -} - -// DecodeToken decodes a Cookie -func (g *CookieGenerator) DecodeToken(encrypted []byte) (*Cookie, error) { - // if the client didn't send any Cookie, DecodeToken will be called with a nil-slice - if len(encrypted) == 0 { - return nil, nil - } - - data, err := g.cookieProtector.DecodeToken(encrypted) - if err != nil { - return nil, err - } - t := &token{} - rest, err := asn1.Unmarshal(data, t) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, fmt.Errorf("rest when unpacking token: %d", len(rest)) - } - cookie := &Cookie{ - RemoteAddr: decodeRemoteAddr(t.RemoteAddr), - SentTime: time.Unix(t.Timestamp, 0), - } - if len(t.OriginalDestConnectionID) > 0 { - cookie.OriginalDestConnectionID = protocol.ConnectionID(t.OriginalDestConnectionID) - } - return cookie, nil -} - -// encodeRemoteAddr encodes a remote address such that it can be saved in the Cookie -func encodeRemoteAddr(remoteAddr net.Addr) []byte { - if udpAddr, ok := remoteAddr.(*net.UDPAddr); ok { - return append([]byte{cookiePrefixIP}, udpAddr.IP...) - } - return append([]byte{cookiePrefixString}, []byte(remoteAddr.String())...) -} - -// decodeRemoteAddr decodes the remote address saved in the Cookie -func decodeRemoteAddr(data []byte) string { - // data will never be empty for a Cookie that we generated. Check it to be on the safe side - if len(data) == 0 { - return "" - } - if data[0] == cookiePrefixIP { - return net.IP(data[1:]).String() - } - return string(data[1:]) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_protector.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_protector.go deleted file mode 100644 index 7ebdfa18..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/cookie_protector.go +++ /dev/null @@ -1,86 +0,0 @@ -package handshake - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "crypto/sha256" - "fmt" - "io" - - "golang.org/x/crypto/hkdf" -) - -// CookieProtector is used to create and verify a cookie -type cookieProtector interface { - // NewToken creates a new token - NewToken([]byte) ([]byte, error) - // DecodeToken decodes a token - DecodeToken([]byte) ([]byte, error) -} - -const ( - cookieSecretSize = 32 - cookieNonceSize = 32 -) - -// cookieProtector is used to create and verify a cookie -type cookieProtectorImpl struct { - secret []byte -} - -// newCookieProtector creates a source for source address tokens -func newCookieProtector() (cookieProtector, error) { - secret := make([]byte, cookieSecretSize) - if _, err := rand.Read(secret); err != nil { - return nil, err - } - return &cookieProtectorImpl{secret: secret}, nil -} - -// NewToken encodes data into a new token. -func (s *cookieProtectorImpl) NewToken(data []byte) ([]byte, error) { - nonce := make([]byte, cookieNonceSize) - if _, err := rand.Read(nonce); err != nil { - return nil, err - } - aead, aeadNonce, err := s.createAEAD(nonce) - if err != nil { - return nil, err - } - return append(nonce, aead.Seal(nil, aeadNonce, data, nil)...), nil -} - -// DecodeToken decodes a token. -func (s *cookieProtectorImpl) DecodeToken(p []byte) ([]byte, error) { - if len(p) < cookieNonceSize { - return nil, fmt.Errorf("Token too short: %d", len(p)) - } - nonce := p[:cookieNonceSize] - aead, aeadNonce, err := s.createAEAD(nonce) - if err != nil { - return nil, err - } - return aead.Open(nil, aeadNonce, p[cookieNonceSize:], nil) -} - -func (s *cookieProtectorImpl) createAEAD(nonce []byte) (cipher.AEAD, []byte, error) { - h := hkdf.New(sha256.New, s.secret, nonce, []byte("quic-go cookie source")) - key := make([]byte, 32) // use a 32 byte key, in order to select AES-256 - if _, err := io.ReadFull(h, key); err != nil { - return nil, nil, err - } - aeadNonce := make([]byte, 12) - if _, err := io.ReadFull(h, aeadNonce); err != nil { - return nil, nil, err - } - c, err := aes.NewCipher(key) - if err != nil { - return nil, nil, err - } - aead, err := cipher.NewGCM(c) - if err != nil { - return nil, nil, err - } - return aead, aeadNonce, nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/crypto_setup.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/crypto_setup.go deleted file mode 100644 index f153750c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/crypto_setup.go +++ /dev/null @@ -1,584 +0,0 @@ -package handshake - -import ( - "crypto/aes" - "crypto/tls" - "errors" - "fmt" - "io" - "net" - "sync" - "unsafe" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/marten-seemann/qtls" -) - -// TLS unexpected_message alert -const alertUnexpectedMessage uint8 = 10 - -type messageType uint8 - -// TLS handshake message types. -const ( - typeClientHello messageType = 1 - typeServerHello messageType = 2 - typeNewSessionTicket messageType = 4 - typeEncryptedExtensions messageType = 8 - typeCertificate messageType = 11 - typeCertificateRequest messageType = 13 - typeCertificateVerify messageType = 15 - typeFinished messageType = 20 -) - -func (m messageType) String() string { - switch m { - case typeClientHello: - return "ClientHello" - case typeServerHello: - return "ServerHello" - case typeNewSessionTicket: - return "NewSessionTicket" - case typeEncryptedExtensions: - return "EncryptedExtensions" - case typeCertificate: - return "Certificate" - case typeCertificateRequest: - return "CertificateRequest" - case typeCertificateVerify: - return "CertificateVerify" - case typeFinished: - return "Finished" - default: - return fmt.Sprintf("unknown message type: %d", m) - } -} - -// ErrOpenerNotYetAvailable is returned when an opener is requested for an encryption level, -// but the corresponding opener has not yet been initialized -// This can happen when packets arrive out of order. -var ErrOpenerNotYetAvailable = errors.New("CryptoSetup: opener at this encryption level not yet available") - -type cryptoSetup struct { - tlsConf *qtls.Config - conn *qtls.Conn - - messageChan chan []byte - - paramsChan <-chan []byte - handleParamsCallback func([]byte) - - alertChan chan uint8 - // HandleData() sends errors on the messageErrChan - messageErrChan chan error - // handshakeDone is closed as soon as the go routine running qtls.Handshake() returns - handshakeDone chan struct{} - // is closed when Close() is called - closeChan chan struct{} - - clientHelloWritten bool - clientHelloWrittenChan chan struct{} - - receivedWriteKey chan struct{} - receivedReadKey chan struct{} - // WriteRecord does a non-blocking send on this channel. - // This way, handleMessage can see if qtls tries to write a message. - // This is necessary: - // for servers: to see if a HelloRetryRequest should be sent in response to a ClientHello - // for clients: to see if a ServerHello is a HelloRetryRequest - writeRecord chan struct{} - - logger utils.Logger - - perspective protocol.Perspective - - mutex sync.Mutex // protects all members below - - readEncLevel protocol.EncryptionLevel - writeEncLevel protocol.EncryptionLevel - - initialStream io.Writer - initialOpener Opener - initialSealer Sealer - - handshakeStream io.Writer - handshakeOpener Opener - handshakeSealer Sealer - - oneRTTStream io.Writer - opener Opener - sealer Sealer -} - -var _ qtls.RecordLayer = &cryptoSetup{} -var _ CryptoSetup = &cryptoSetup{} - -// NewCryptoSetupClient creates a new crypto setup for the client -func NewCryptoSetupClient( - initialStream io.Writer, - handshakeStream io.Writer, - oneRTTStream io.Writer, - connID protocol.ConnectionID, - remoteAddr net.Addr, - tp *TransportParameters, - handleParams func([]byte), - tlsConf *tls.Config, - logger utils.Logger, -) (CryptoSetup, <-chan struct{} /* ClientHello written */, error) { - cs, clientHelloWritten, err := newCryptoSetup( - initialStream, - handshakeStream, - oneRTTStream, - connID, - tp, - handleParams, - tlsConf, - logger, - protocol.PerspectiveClient, - ) - if err != nil { - return nil, nil, err - } - cs.conn = qtls.Client(newConn(remoteAddr), cs.tlsConf) - return cs, clientHelloWritten, nil -} - -// NewCryptoSetupServer creates a new crypto setup for the server -func NewCryptoSetupServer( - initialStream io.Writer, - handshakeStream io.Writer, - oneRTTStream io.Writer, - connID protocol.ConnectionID, - remoteAddr net.Addr, - tp *TransportParameters, - handleParams func([]byte), - tlsConf *tls.Config, - logger utils.Logger, -) (CryptoSetup, error) { - cs, _, err := newCryptoSetup( - initialStream, - handshakeStream, - oneRTTStream, - connID, - tp, - handleParams, - tlsConf, - logger, - protocol.PerspectiveServer, - ) - if err != nil { - return nil, err - } - cs.conn = qtls.Server(newConn(remoteAddr), cs.tlsConf) - return cs, nil -} - -func newCryptoSetup( - initialStream io.Writer, - handshakeStream io.Writer, - oneRTTStream io.Writer, - connID protocol.ConnectionID, - tp *TransportParameters, - handleParams func([]byte), - tlsConf *tls.Config, - logger utils.Logger, - perspective protocol.Perspective, -) (*cryptoSetup, <-chan struct{} /* ClientHello written */, error) { - initialSealer, initialOpener, err := NewInitialAEAD(connID, perspective) - if err != nil { - return nil, nil, err - } - extHandler := newExtensionHandler(tp.Marshal(), perspective) - cs := &cryptoSetup{ - initialStream: initialStream, - initialSealer: initialSealer, - initialOpener: initialOpener, - handshakeStream: handshakeStream, - oneRTTStream: oneRTTStream, - readEncLevel: protocol.EncryptionInitial, - writeEncLevel: protocol.EncryptionInitial, - handleParamsCallback: handleParams, - paramsChan: extHandler.TransportParameters(), - logger: logger, - perspective: perspective, - handshakeDone: make(chan struct{}), - alertChan: make(chan uint8), - messageErrChan: make(chan error, 1), - clientHelloWrittenChan: make(chan struct{}), - messageChan: make(chan []byte, 100), - receivedReadKey: make(chan struct{}), - receivedWriteKey: make(chan struct{}), - writeRecord: make(chan struct{}, 1), - closeChan: make(chan struct{}), - } - qtlsConf := tlsConfigToQtlsConfig(tlsConf, cs, extHandler) - cs.tlsConf = qtlsConf - return cs, cs.clientHelloWrittenChan, nil -} - -func (h *cryptoSetup) ChangeConnectionID(id protocol.ConnectionID) error { - initialSealer, initialOpener, err := NewInitialAEAD(id, h.perspective) - if err != nil { - return err - } - h.initialSealer = initialSealer - h.initialOpener = initialOpener - return nil -} - -func (h *cryptoSetup) RunHandshake() error { - // Handle errors that might occur when HandleData() is called. - handshakeComplete := make(chan struct{}) - handshakeErrChan := make(chan error, 1) - go func() { - defer close(h.handshakeDone) - if err := h.conn.Handshake(); err != nil { - handshakeErrChan <- err - return - } - close(handshakeComplete) - }() - - select { - case <-h.closeChan: - close(h.messageChan) - // wait until the Handshake() go routine has returned - return errors.New("Handshake aborted") - case <-handshakeComplete: // return when the handshake is done - return nil - case alert := <-h.alertChan: - err := <-handshakeErrChan - return qerr.CryptoError(alert, err.Error()) - case err := <-h.messageErrChan: - // If the handshake errored because of an error that occurred during HandleData(), - // that error message will be more useful than the error message generated by Handshake(). - // Close the message chan that qtls is receiving messages from. - // This will make qtls.Handshake() return. - // Thereby the go routine running qtls.Handshake() will return. - close(h.messageChan) - return err - } -} - -func (h *cryptoSetup) Close() error { - close(h.closeChan) - // wait until qtls.Handshake() actually returned - <-h.handshakeDone - return nil -} - -// handleMessage handles a TLS handshake message. -// It is called by the crypto streams when a new message is available. -// It returns if it is done with messages on the same encryption level. -func (h *cryptoSetup) HandleMessage(data []byte, encLevel protocol.EncryptionLevel) bool /* stream finished */ { - msgType := messageType(data[0]) - h.logger.Debugf("Received %s message (%d bytes, encryption level: %s)", msgType, len(data), encLevel) - if err := h.checkEncryptionLevel(msgType, encLevel); err != nil { - h.messageErrChan <- err - return false - } - h.messageChan <- data - switch h.perspective { - case protocol.PerspectiveClient: - return h.handleMessageForClient(msgType) - case protocol.PerspectiveServer: - return h.handleMessageForServer(msgType) - default: - panic("") - } -} - -func (h *cryptoSetup) checkEncryptionLevel(msgType messageType, encLevel protocol.EncryptionLevel) error { - var expected protocol.EncryptionLevel - switch msgType { - case typeClientHello, - typeServerHello: - expected = protocol.EncryptionInitial - case typeEncryptedExtensions, - typeCertificate, - typeCertificateRequest, - typeCertificateVerify, - typeFinished: - expected = protocol.EncryptionHandshake - case typeNewSessionTicket: - expected = protocol.Encryption1RTT - default: - return qerr.CryptoError(alertUnexpectedMessage, fmt.Sprintf("unexpected handshake message: %d", msgType)) - } - if encLevel != expected { - return qerr.CryptoError(alertUnexpectedMessage, fmt.Sprintf("expected handshake message %s to have encryption level %s, has %s", msgType, expected, encLevel)) - } - return nil -} - -func (h *cryptoSetup) handleMessageForServer(msgType messageType) bool { - switch msgType { - case typeClientHello: - select { - case <-h.writeRecord: - // If qtls sends a HelloRetryRequest, it will only write the record. - // If it accepts the ClientHello, it will first read the transport parameters. - h.logger.Debugf("Sending HelloRetryRequest") - return false - case data := <-h.paramsChan: - h.handleParamsCallback(data) - case <-h.handshakeDone: - return false - } - // get the handshake read key - select { - case <-h.receivedReadKey: - case <-h.handshakeDone: - return false - } - // get the handshake write key - select { - case <-h.receivedWriteKey: - case <-h.handshakeDone: - return false - } - // get the 1-RTT write key - select { - case <-h.receivedWriteKey: - case <-h.handshakeDone: - return false - } - return true - case typeCertificate, typeCertificateVerify: - // nothing to do - return false - case typeFinished: - // get the 1-RTT read key - select { - case <-h.receivedReadKey: - case <-h.handshakeDone: - return false - } - return true - default: - h.messageErrChan <- qerr.CryptoError(alertUnexpectedMessage, fmt.Sprintf("unexpected handshake message: %d", msgType)) - return false - } -} - -func (h *cryptoSetup) handleMessageForClient(msgType messageType) bool { - switch msgType { - case typeServerHello: - // get the handshake write key - select { - case <-h.writeRecord: - // If qtls writes in response to a ServerHello, this means that this ServerHello - // is a HelloRetryRequest. - // Otherwise, we'd just wait for the Certificate message. - h.logger.Debugf("ServerHello is a HelloRetryRequest") - return false - case <-h.receivedWriteKey: - case <-h.handshakeDone: - return false - } - // get the handshake read key - select { - case <-h.receivedReadKey: - case <-h.handshakeDone: - return false - } - return true - case typeEncryptedExtensions: - select { - case data := <-h.paramsChan: - h.handleParamsCallback(data) - case <-h.handshakeDone: - return false - } - return false - case typeCertificateRequest, typeCertificate, typeCertificateVerify: - // nothing to do - return false - case typeFinished: - // get the 1-RTT read key - select { - case <-h.receivedReadKey: - case <-h.handshakeDone: - return false - } - // get the handshake write key - select { - case <-h.receivedWriteKey: - case <-h.handshakeDone: - return false - } - return true - case typeNewSessionTicket: - <-h.handshakeDone // don't process session tickets before the handshake has completed - h.conn.HandlePostHandshakeMessage() - return false - default: - h.messageErrChan <- qerr.CryptoError(alertUnexpectedMessage, fmt.Sprintf("unexpected handshake message: %d", msgType)) - return false - } -} - -// ReadHandshakeMessage is called by TLS. -// It blocks until a new handshake message is available. -func (h *cryptoSetup) ReadHandshakeMessage() ([]byte, error) { - msg, ok := <-h.messageChan - if !ok { - return nil, errors.New("error while handling the handshake message") - } - return msg, nil -} - -func (h *cryptoSetup) SetReadKey(suite *qtls.CipherSuite, trafficSecret []byte) { - key := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic key", suite.KeyLen()) - iv := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic iv", suite.IVLen()) - hpKey := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic hp", suite.KeyLen()) - hpDecrypter, err := aes.NewCipher(hpKey) - if err != nil { - panic(fmt.Sprintf("error creating new AES cipher: %s", err)) - } - - h.mutex.Lock() - switch h.readEncLevel { - case protocol.EncryptionInitial: - h.readEncLevel = protocol.EncryptionHandshake - h.handshakeOpener = newOpener(suite.AEAD(key, iv), hpDecrypter, false) - h.logger.Debugf("Installed Handshake Read keys") - case protocol.EncryptionHandshake: - h.readEncLevel = protocol.Encryption1RTT - h.opener = newOpener(suite.AEAD(key, iv), hpDecrypter, true) - h.logger.Debugf("Installed 1-RTT Read keys") - default: - panic("unexpected read encryption level") - } - h.mutex.Unlock() - h.receivedReadKey <- struct{}{} -} - -func (h *cryptoSetup) SetWriteKey(suite *qtls.CipherSuite, trafficSecret []byte) { - key := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic key", suite.KeyLen()) - iv := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic iv", suite.IVLen()) - hpKey := qtls.HkdfExpandLabel(suite.Hash(), trafficSecret, []byte{}, "quic hp", suite.KeyLen()) - hpEncrypter, err := aes.NewCipher(hpKey) - if err != nil { - panic(fmt.Sprintf("error creating new AES cipher: %s", err)) - } - - h.mutex.Lock() - switch h.writeEncLevel { - case protocol.EncryptionInitial: - h.writeEncLevel = protocol.EncryptionHandshake - h.handshakeSealer = newSealer(suite.AEAD(key, iv), hpEncrypter, false) - h.logger.Debugf("Installed Handshake Write keys") - case protocol.EncryptionHandshake: - h.writeEncLevel = protocol.Encryption1RTT - h.sealer = newSealer(suite.AEAD(key, iv), hpEncrypter, true) - h.logger.Debugf("Installed 1-RTT Write keys") - default: - panic("unexpected write encryption level") - } - h.mutex.Unlock() - h.receivedWriteKey <- struct{}{} -} - -// WriteRecord is called when TLS writes data -func (h *cryptoSetup) WriteRecord(p []byte) (int, error) { - h.mutex.Lock() - defer h.mutex.Unlock() - - switch h.writeEncLevel { - case protocol.EncryptionInitial: - // assume that the first WriteRecord call contains the ClientHello - n, err := h.initialStream.Write(p) - if !h.clientHelloWritten && h.perspective == protocol.PerspectiveClient { - h.clientHelloWritten = true - close(h.clientHelloWrittenChan) - } else { - // We need additional signaling to properly detect HelloRetryRequests. - // For servers: when the ServerHello is written. - // For clients: when a reply is sent in response to a ServerHello. - h.writeRecord <- struct{}{} - } - return n, err - case protocol.EncryptionHandshake: - return h.handshakeStream.Write(p) - case protocol.Encryption1RTT: - return h.oneRTTStream.Write(p) - default: - panic(fmt.Sprintf("unexpected write encryption level: %s", h.writeEncLevel)) - } -} - -func (h *cryptoSetup) SendAlert(alert uint8) { - h.alertChan <- alert -} - -func (h *cryptoSetup) GetSealer() (protocol.EncryptionLevel, Sealer) { - h.mutex.Lock() - defer h.mutex.Unlock() - - if h.sealer != nil { - return protocol.Encryption1RTT, h.sealer - } - if h.handshakeSealer != nil { - return protocol.EncryptionHandshake, h.handshakeSealer - } - return protocol.EncryptionInitial, h.initialSealer -} - -func (h *cryptoSetup) GetSealerWithEncryptionLevel(level protocol.EncryptionLevel) (Sealer, error) { - errNoSealer := fmt.Errorf("CryptoSetup: no sealer with encryption level %s", level.String()) - - h.mutex.Lock() - defer h.mutex.Unlock() - - switch level { - case protocol.EncryptionInitial: - return h.initialSealer, nil - case protocol.EncryptionHandshake: - if h.handshakeSealer == nil { - return nil, errNoSealer - } - return h.handshakeSealer, nil - case protocol.Encryption1RTT: - if h.sealer == nil { - return nil, errNoSealer - } - return h.sealer, nil - default: - return nil, errNoSealer - } -} - -func (h *cryptoSetup) GetOpener(level protocol.EncryptionLevel) (Opener, error) { - h.mutex.Lock() - defer h.mutex.Unlock() - - switch level { - case protocol.EncryptionInitial: - return h.initialOpener, nil - case protocol.EncryptionHandshake: - if h.handshakeOpener == nil { - return nil, ErrOpenerNotYetAvailable - } - return h.handshakeOpener, nil - case protocol.Encryption1RTT: - if h.opener == nil { - return nil, ErrOpenerNotYetAvailable - } - return h.opener, nil - default: - return nil, fmt.Errorf("CryptoSetup: no opener with encryption level %s", level) - } -} - -func (h *cryptoSetup) ConnectionState() tls.ConnectionState { - cs := h.conn.ConnectionState() - // h.conn is a qtls.Conn, which returns a qtls.ConnectionState. - // qtls.ConnectionState is identical to the tls.ConnectionState. - // It contains an unexported field which is used ExportKeyingMaterial(). - // The only way to return a tls.ConnectionState is to use unsafe. - // In unsafe.go we check that the two objects are actually identical. - return *(*tls.ConnectionState)(unsafe.Pointer(&cs)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/initial_aead.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/initial_aead.go deleted file mode 100644 index 5d78bbe2..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/initial_aead.go +++ /dev/null @@ -1,52 +0,0 @@ -package handshake - -import ( - "crypto" - "crypto/aes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/marten-seemann/qtls" -) - -var quicVersion1Salt = []byte{0xef, 0x4f, 0xb0, 0xab, 0xb4, 0x74, 0x70, 0xc4, 0x1b, 0xef, 0xcf, 0x80, 0x31, 0x33, 0x4f, 0xae, 0x48, 0x5e, 0x09, 0xa0} - -// NewInitialAEAD creates a new AEAD for Initial encryption / decryption. -func NewInitialAEAD(connID protocol.ConnectionID, pers protocol.Perspective) (Sealer, Opener, error) { - clientSecret, serverSecret := computeSecrets(connID) - var mySecret, otherSecret []byte - if pers == protocol.PerspectiveClient { - mySecret = clientSecret - otherSecret = serverSecret - } else { - mySecret = serverSecret - otherSecret = clientSecret - } - myKey, myHPKey, myIV := computeInitialKeyAndIV(mySecret) - otherKey, otherHPKey, otherIV := computeInitialKeyAndIV(otherSecret) - - encrypter := qtls.AEADAESGCMTLS13(myKey, myIV) - hpEncrypter, err := aes.NewCipher(myHPKey) - if err != nil { - return nil, nil, err - } - decrypter := qtls.AEADAESGCMTLS13(otherKey, otherIV) - hpDecrypter, err := aes.NewCipher(otherHPKey) - if err != nil { - return nil, nil, err - } - return newSealer(encrypter, hpEncrypter, false), newOpener(decrypter, hpDecrypter, false), nil -} - -func computeSecrets(connID protocol.ConnectionID) (clientSecret, serverSecret []byte) { - initialSecret := qtls.HkdfExtract(crypto.SHA256, connID, quicVersion1Salt) - clientSecret = qtls.HkdfExpandLabel(crypto.SHA256, initialSecret, []byte{}, "client in", crypto.SHA256.Size()) - serverSecret = qtls.HkdfExpandLabel(crypto.SHA256, initialSecret, []byte{}, "server in", crypto.SHA256.Size()) - return -} - -func computeInitialKeyAndIV(secret []byte) (key, hpKey, iv []byte) { - key = qtls.HkdfExpandLabel(crypto.SHA256, secret, []byte{}, "quic key", 16) - hpKey = qtls.HkdfExpandLabel(crypto.SHA256, secret, []byte{}, "quic hp", 16) - iv = qtls.HkdfExpandLabel(crypto.SHA256, secret, []byte{}, "quic iv", 12) - return -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/interface.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/interface.go deleted file mode 100644 index 22522513..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/interface.go +++ /dev/null @@ -1,52 +0,0 @@ -package handshake - -import ( - "crypto/tls" - "crypto/x509" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/marten-seemann/qtls" -) - -// Opener opens a packet -type Opener interface { - Open(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) ([]byte, error) - DecryptHeader(sample []byte, firstByte *byte, pnBytes []byte) -} - -// Sealer seals a packet -type Sealer interface { - Seal(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) []byte - EncryptHeader(sample []byte, firstByte *byte, pnBytes []byte) - Overhead() int -} - -// A tlsExtensionHandler sends and received the QUIC TLS extension. -type tlsExtensionHandler interface { - GetExtensions(msgType uint8) []qtls.Extension - ReceivedExtensions(msgType uint8, exts []qtls.Extension) - TransportParameters() <-chan []byte -} - -// CryptoSetup handles the handshake and protecting / unprotecting packets -type CryptoSetup interface { - RunHandshake() error - io.Closer - ChangeConnectionID(protocol.ConnectionID) error - - HandleMessage([]byte, protocol.EncryptionLevel) bool - ConnectionState() tls.ConnectionState - - GetSealer() (protocol.EncryptionLevel, Sealer) - GetSealerWithEncryptionLevel(protocol.EncryptionLevel) (Sealer, error) - GetOpener(protocol.EncryptionLevel) (Opener, error) -} - -// ConnectionState records basic details about the QUIC connection. -// Warning: This API should not be considered stable and might change soon. -type ConnectionState struct { - HandshakeComplete bool // handshake is complete - ServerName string // server name requested by client, if any (server side only) - PeerCertificates []*x509.Certificate // certificate chain presented by remote peer -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/qtls.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/qtls.go deleted file mode 100644 index 8880d9cb..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/qtls.go +++ /dev/null @@ -1,132 +0,0 @@ -package handshake - -import ( - "crypto/tls" - "net" - "time" - "unsafe" - - "github.com/marten-seemann/qtls" -) - -type conn struct { - remoteAddr net.Addr -} - -func newConn(remote net.Addr) net.Conn { - return &conn{remoteAddr: remote} -} - -var _ net.Conn = &conn{} - -func (c *conn) Read([]byte) (int, error) { return 0, nil } -func (c *conn) Write([]byte) (int, error) { return 0, nil } -func (c *conn) Close() error { return nil } -func (c *conn) RemoteAddr() net.Addr { return c.remoteAddr } -func (c *conn) LocalAddr() net.Addr { return nil } -func (c *conn) SetReadDeadline(time.Time) error { return nil } -func (c *conn) SetWriteDeadline(time.Time) error { return nil } -func (c *conn) SetDeadline(time.Time) error { return nil } - -type clientSessionCache struct { - tls.ClientSessionCache -} - -var _ qtls.ClientSessionCache = &clientSessionCache{} - -func (c *clientSessionCache) Get(sessionKey string) (*qtls.ClientSessionState, bool) { - sess, ok := c.ClientSessionCache.Get(sessionKey) - if sess == nil { - return nil, ok - } - // qtls.ClientSessionState is identical to the tls.ClientSessionState. - // In order to allow users of quic-go to use a tls.Config, - // we need this workaround to use the ClientSessionCache. - // In unsafe.go we check that the two structs are actually identical. - usess := (*[unsafe.Sizeof(*sess)]byte)(unsafe.Pointer(sess))[:] - var session qtls.ClientSessionState - usession := (*[unsafe.Sizeof(session)]byte)(unsafe.Pointer(&session))[:] - copy(usession, usess) - return &session, ok -} - -func (c *clientSessionCache) Put(sessionKey string, cs *qtls.ClientSessionState) { - // qtls.ClientSessionState is identical to the tls.ClientSessionState. - // In order to allow users of quic-go to use a tls.Config, - // we need this workaround to use the ClientSessionCache. - // In unsafe.go we check that the two structs are actually identical. - usess := (*[unsafe.Sizeof(*cs)]byte)(unsafe.Pointer(cs))[:] - var session tls.ClientSessionState - usession := (*[unsafe.Sizeof(session)]byte)(unsafe.Pointer(&session))[:] - copy(usession, usess) - c.ClientSessionCache.Put(sessionKey, &session) -} - -func tlsConfigToQtlsConfig( - c *tls.Config, - recordLayer qtls.RecordLayer, - extHandler tlsExtensionHandler, -) *qtls.Config { - if c == nil { - c = &tls.Config{} - } - // Clone the config first. This executes the tls.Config.serverInit(). - // This sets the SessionTicketKey, if the user didn't supply one. - c = c.Clone() - // QUIC requires TLS 1.3 or newer - minVersion := c.MinVersion - if minVersion < qtls.VersionTLS13 { - minVersion = qtls.VersionTLS13 - } - maxVersion := c.MaxVersion - if maxVersion < qtls.VersionTLS13 { - maxVersion = qtls.VersionTLS13 - } - var getConfigForClient func(ch *tls.ClientHelloInfo) (*qtls.Config, error) - if c.GetConfigForClient != nil { - getConfigForClient = func(ch *tls.ClientHelloInfo) (*qtls.Config, error) { - tlsConf, err := c.GetConfigForClient(ch) - if err != nil { - return nil, err - } - if tlsConf == nil { - return nil, nil - } - return tlsConfigToQtlsConfig(tlsConf, recordLayer, extHandler), nil - } - } - var csc qtls.ClientSessionCache - if c.ClientSessionCache != nil { - csc = &clientSessionCache{c.ClientSessionCache} - } - return &qtls.Config{ - Rand: c.Rand, - Time: c.Time, - Certificates: c.Certificates, - NameToCertificate: c.NameToCertificate, - GetCertificate: c.GetCertificate, - GetClientCertificate: c.GetClientCertificate, - GetConfigForClient: getConfigForClient, - VerifyPeerCertificate: c.VerifyPeerCertificate, - RootCAs: c.RootCAs, - NextProtos: c.NextProtos, - ServerName: c.ServerName, - ClientAuth: c.ClientAuth, - ClientCAs: c.ClientCAs, - InsecureSkipVerify: c.InsecureSkipVerify, - CipherSuites: c.CipherSuites, - PreferServerCipherSuites: c.PreferServerCipherSuites, - SessionTicketsDisabled: c.SessionTicketsDisabled, - SessionTicketKey: c.SessionTicketKey, - ClientSessionCache: csc, - MinVersion: minVersion, - MaxVersion: maxVersion, - CurvePreferences: c.CurvePreferences, - DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, - // no need to copy Renegotiation, it's not supported by TLS 1.3 - KeyLogWriter: c.KeyLogWriter, - AlternativeRecordLayer: recordLayer, - GetExtensions: extHandler.GetExtensions, - ReceivedExtensions: extHandler.ReceivedExtensions, - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/tls_extension_handler.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/tls_extension_handler.go deleted file mode 100644 index 590aafd1..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/tls_extension_handler.go +++ /dev/null @@ -1,58 +0,0 @@ -package handshake - -import ( - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/marten-seemann/qtls" -) - -const quicTLSExtensionType = 0xffa5 - -type extensionHandler struct { - ourParams []byte - paramsChan chan []byte - - perspective protocol.Perspective -} - -var _ tlsExtensionHandler = &extensionHandler{} - -// newExtensionHandler creates a new extension handler -func newExtensionHandler(params []byte, pers protocol.Perspective) tlsExtensionHandler { - return &extensionHandler{ - ourParams: params, - paramsChan: make(chan []byte), - perspective: pers, - } -} - -func (h *extensionHandler) GetExtensions(msgType uint8) []qtls.Extension { - if (h.perspective == protocol.PerspectiveClient && messageType(msgType) != typeClientHello) || - (h.perspective == protocol.PerspectiveServer && messageType(msgType) != typeEncryptedExtensions) { - return nil - } - return []qtls.Extension{{ - Type: quicTLSExtensionType, - Data: h.ourParams, - }} -} - -func (h *extensionHandler) ReceivedExtensions(msgType uint8, exts []qtls.Extension) { - if (h.perspective == protocol.PerspectiveClient && messageType(msgType) != typeEncryptedExtensions) || - (h.perspective == protocol.PerspectiveServer && messageType(msgType) != typeClientHello) { - return - } - - var data []byte - for _, ext := range exts { - if ext.Type == quicTLSExtensionType { - data = ext.Data - break - } - } - - h.paramsChan <- data -} - -func (h *extensionHandler) TransportParameters() <-chan []byte { - return h.paramsChan -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/transport_parameters.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/transport_parameters.go deleted file mode 100644 index 6810cbc3..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/transport_parameters.go +++ /dev/null @@ -1,260 +0,0 @@ -package handshake - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "sort" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -type transportParameterID uint16 - -const ( - originalConnectionIDParameterID transportParameterID = 0x0 - idleTimeoutParameterID transportParameterID = 0x1 - statelessResetTokenParameterID transportParameterID = 0x2 - maxPacketSizeParameterID transportParameterID = 0x3 - initialMaxDataParameterID transportParameterID = 0x4 - initialMaxStreamDataBidiLocalParameterID transportParameterID = 0x5 - initialMaxStreamDataBidiRemoteParameterID transportParameterID = 0x6 - initialMaxStreamDataUniParameterID transportParameterID = 0x7 - initialMaxStreamsBidiParameterID transportParameterID = 0x8 - initialMaxStreamsUniParameterID transportParameterID = 0x9 - ackDelayExponentParameterID transportParameterID = 0xa - disableMigrationParameterID transportParameterID = 0xc -) - -// TransportParameters are parameters sent to the peer during the handshake -type TransportParameters struct { - InitialMaxStreamDataBidiLocal protocol.ByteCount - InitialMaxStreamDataBidiRemote protocol.ByteCount - InitialMaxStreamDataUni protocol.ByteCount - InitialMaxData protocol.ByteCount - - AckDelayExponent uint8 - - MaxPacketSize protocol.ByteCount - - MaxUniStreams uint64 - MaxBidiStreams uint64 - - IdleTimeout time.Duration - DisableMigration bool - - StatelessResetToken *[16]byte - OriginalConnectionID protocol.ConnectionID -} - -// Unmarshal the transport parameters -func (p *TransportParameters) Unmarshal(data []byte, sentBy protocol.Perspective) error { - if len(data) < 2 { - return errors.New("transport parameter data too short") - } - length := binary.BigEndian.Uint16(data[:2]) - if len(data)-2 < int(length) { - return fmt.Errorf("expected transport parameters to be %d bytes long, have %d", length, len(data)-2) - } - - // needed to check that every parameter is only sent at most once - var parameterIDs []transportParameterID - - var readAckDelayExponent bool - - r := bytes.NewReader(data[2:]) - for r.Len() >= 4 { - paramIDInt, _ := utils.BigEndian.ReadUint16(r) - paramID := transportParameterID(paramIDInt) - paramLen, _ := utils.BigEndian.ReadUint16(r) - parameterIDs = append(parameterIDs, paramID) - switch paramID { - case ackDelayExponentParameterID: - readAckDelayExponent = true - fallthrough - case initialMaxStreamDataBidiLocalParameterID, - initialMaxStreamDataBidiRemoteParameterID, - initialMaxStreamDataUniParameterID, - initialMaxDataParameterID, - initialMaxStreamsBidiParameterID, - initialMaxStreamsUniParameterID, - idleTimeoutParameterID, - maxPacketSizeParameterID: - if err := p.readNumericTransportParameter(r, paramID, int(paramLen)); err != nil { - return err - } - default: - if r.Len() < int(paramLen) { - return fmt.Errorf("remaining length (%d) smaller than parameter length (%d)", r.Len(), paramLen) - } - switch paramID { - case disableMigrationParameterID: - if paramLen != 0 { - return fmt.Errorf("wrong length for disable_migration: %d (expected empty)", paramLen) - } - p.DisableMigration = true - case statelessResetTokenParameterID: - if sentBy == protocol.PerspectiveClient { - return errors.New("client sent a stateless_reset_token") - } - if paramLen != 16 { - return fmt.Errorf("wrong length for stateless_reset_token: %d (expected 16)", paramLen) - } - var token [16]byte - r.Read(token[:]) - p.StatelessResetToken = &token - case originalConnectionIDParameterID: - if sentBy == protocol.PerspectiveClient { - return errors.New("client sent an original_connection_id") - } - p.OriginalConnectionID, _ = protocol.ReadConnectionID(r, int(paramLen)) - default: - r.Seek(int64(paramLen), io.SeekCurrent) - } - } - } - - if !readAckDelayExponent { - p.AckDelayExponent = protocol.DefaultAckDelayExponent - } - - // check that every transport parameter was sent at most once - sort.Slice(parameterIDs, func(i, j int) bool { return parameterIDs[i] < parameterIDs[j] }) - for i := 0; i < len(parameterIDs)-1; i++ { - if parameterIDs[i] == parameterIDs[i+1] { - return fmt.Errorf("received duplicate transport parameter %#x", parameterIDs[i]) - } - } - - if r.Len() != 0 { - return fmt.Errorf("should have read all data. Still have %d bytes", r.Len()) - } - return nil -} - -func (p *TransportParameters) readNumericTransportParameter( - r *bytes.Reader, - paramID transportParameterID, - expectedLen int, -) error { - remainingLen := r.Len() - val, err := utils.ReadVarInt(r) - if err != nil { - return fmt.Errorf("error while reading transport parameter %d: %s", paramID, err) - } - if remainingLen-r.Len() != expectedLen { - return fmt.Errorf("inconsistent transport parameter length for %d", paramID) - } - switch paramID { - case initialMaxStreamDataBidiLocalParameterID: - p.InitialMaxStreamDataBidiLocal = protocol.ByteCount(val) - case initialMaxStreamDataBidiRemoteParameterID: - p.InitialMaxStreamDataBidiRemote = protocol.ByteCount(val) - case initialMaxStreamDataUniParameterID: - p.InitialMaxStreamDataUni = protocol.ByteCount(val) - case initialMaxDataParameterID: - p.InitialMaxData = protocol.ByteCount(val) - case initialMaxStreamsBidiParameterID: - p.MaxBidiStreams = val - case initialMaxStreamsUniParameterID: - p.MaxUniStreams = val - case idleTimeoutParameterID: - p.IdleTimeout = utils.MaxDuration(protocol.MinRemoteIdleTimeout, time.Duration(val)*time.Millisecond) - case maxPacketSizeParameterID: - if val < 1200 { - return fmt.Errorf("invalid value for max_packet_size: %d (minimum 1200)", val) - } - p.MaxPacketSize = protocol.ByteCount(val) - case ackDelayExponentParameterID: - if val > protocol.MaxAckDelayExponent { - return fmt.Errorf("invalid value for ack_delay_exponent: %d (maximum %d)", val, protocol.MaxAckDelayExponent) - } - p.AckDelayExponent = uint8(val) - default: - return fmt.Errorf("TransportParameter BUG: transport parameter %d not found", paramID) - } - return nil -} - -// Marshal the transport parameters -func (p *TransportParameters) Marshal() []byte { - b := &bytes.Buffer{} - b.Write([]byte{0, 0}) // length. Will be replaced later - - // initial_max_stream_data_bidi_local - utils.BigEndian.WriteUint16(b, uint16(initialMaxStreamDataBidiLocalParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(p.InitialMaxStreamDataBidiLocal)))) - utils.WriteVarInt(b, uint64(p.InitialMaxStreamDataBidiLocal)) - // initial_max_stream_data_bidi_remote - utils.BigEndian.WriteUint16(b, uint16(initialMaxStreamDataBidiRemoteParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(p.InitialMaxStreamDataBidiRemote)))) - utils.WriteVarInt(b, uint64(p.InitialMaxStreamDataBidiRemote)) - // initial_max_stream_data_uni - utils.BigEndian.WriteUint16(b, uint16(initialMaxStreamDataUniParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(p.InitialMaxStreamDataUni)))) - utils.WriteVarInt(b, uint64(p.InitialMaxStreamDataUni)) - // initial_max_data - utils.BigEndian.WriteUint16(b, uint16(initialMaxDataParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(p.InitialMaxData)))) - utils.WriteVarInt(b, uint64(p.InitialMaxData)) - // initial_max_bidi_streams - utils.BigEndian.WriteUint16(b, uint16(initialMaxStreamsBidiParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(p.MaxBidiStreams))) - utils.WriteVarInt(b, p.MaxBidiStreams) - // initial_max_uni_streams - utils.BigEndian.WriteUint16(b, uint16(initialMaxStreamsUniParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(p.MaxUniStreams))) - utils.WriteVarInt(b, p.MaxUniStreams) - // idle_timeout - idleTimeout := uint64(p.IdleTimeout / time.Millisecond) - utils.BigEndian.WriteUint16(b, uint16(idleTimeoutParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(idleTimeout))) - utils.WriteVarInt(b, idleTimeout) - // max_packet_size - utils.BigEndian.WriteUint16(b, uint16(maxPacketSizeParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(protocol.MaxReceivePacketSize)))) - utils.WriteVarInt(b, uint64(protocol.MaxReceivePacketSize)) - // ack_delay_exponent - // Only send it if is different from the default value. - if p.AckDelayExponent != protocol.DefaultAckDelayExponent { - utils.BigEndian.WriteUint16(b, uint16(ackDelayExponentParameterID)) - utils.BigEndian.WriteUint16(b, uint16(utils.VarIntLen(uint64(p.AckDelayExponent)))) - utils.WriteVarInt(b, uint64(p.AckDelayExponent)) - } - // disable_migration - if p.DisableMigration { - utils.BigEndian.WriteUint16(b, uint16(disableMigrationParameterID)) - utils.BigEndian.WriteUint16(b, 0) - } - if p.StatelessResetToken != nil { - utils.BigEndian.WriteUint16(b, uint16(statelessResetTokenParameterID)) - utils.BigEndian.WriteUint16(b, 16) - b.Write(p.StatelessResetToken[:]) - } - // original_connection_id - if p.OriginalConnectionID.Len() > 0 { - utils.BigEndian.WriteUint16(b, uint16(originalConnectionIDParameterID)) - utils.BigEndian.WriteUint16(b, uint16(p.OriginalConnectionID.Len())) - b.Write(p.OriginalConnectionID.Bytes()) - } - - data := b.Bytes() - binary.BigEndian.PutUint16(data[:2], uint16(b.Len()-2)) - return data -} - -// String returns a string representation, intended for logging. -func (p *TransportParameters) String() string { - logString := "&handshake.TransportParameters{OriginalConnectionID: %s, InitialMaxStreamDataBidiLocal: %#x, InitialMaxStreamDataBidiRemote: %#x, InitialMaxStreamDataUni: %#x, InitialMaxData: %#x, MaxBidiStreams: %d, MaxUniStreams: %d, IdleTimeout: %s, AckDelayExponent: %d" - logParams := []interface{}{p.OriginalConnectionID, p.InitialMaxStreamDataBidiLocal, p.InitialMaxStreamDataBidiRemote, p.InitialMaxStreamDataUni, p.InitialMaxData, p.MaxBidiStreams, p.MaxUniStreams, p.IdleTimeout, p.AckDelayExponent} - if p.StatelessResetToken != nil { // the client never sends a stateless reset token - logString += ", StatelessResetToken: %#x" - logParams = append(logParams, *p.StatelessResetToken) - } - logString += "}" - return fmt.Sprintf(logString, logParams...) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/unsafe.go b/vendor/github.com/lucas-clemente/quic-go/internal/handshake/unsafe.go deleted file mode 100644 index fb051aeb..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/handshake/unsafe.go +++ /dev/null @@ -1,38 +0,0 @@ -package handshake - -// This package uses unsafe to convert between: -// * qtls.ConnectionState and tls.ConnectionState -// * qtls.ClientSessionState and tls.ClientSessionState -// We check in init() that this conversion actually is safe. - -import ( - "crypto/tls" - "reflect" - - "github.com/marten-seemann/qtls" -) - -func init() { - if !structsEqual(&tls.ConnectionState{}, &qtls.ConnectionState{}) { - panic("qtls.ConnectionState not compatible with tls.ConnectionState") - } - if !structsEqual(&tls.ClientSessionState{}, &qtls.ClientSessionState{}) { - panic("qtls.ClientSessionState not compatible with tls.ClientSessionState") - } -} - -func structsEqual(a, b interface{}) bool { - sa := reflect.ValueOf(a).Elem() - sb := reflect.ValueOf(b).Elem() - if sa.NumField() != sb.NumField() { - return false - } - for i := 0; i < sa.NumField(); i++ { - fa := sa.Type().Field(i) - fb := sb.Type().Field(i) - if !reflect.DeepEqual(fa.Index, fb.Index) || fa.Name != fb.Name || fa.Anonymous != fb.Anonymous || fa.Offset != fb.Offset || !reflect.DeepEqual(fa.Type, fb.Type) { - return false - } - } - return true -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/connection_id.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/connection_id.go deleted file mode 100644 index f99461b2..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/connection_id.go +++ /dev/null @@ -1,69 +0,0 @@ -package protocol - -import ( - "bytes" - "crypto/rand" - "fmt" - "io" -) - -// A ConnectionID in QUIC -type ConnectionID []byte - -const maxConnectionIDLen = 18 - -// GenerateConnectionID generates a connection ID using cryptographic random -func GenerateConnectionID(len int) (ConnectionID, error) { - b := make([]byte, len) - if _, err := rand.Read(b); err != nil { - return nil, err - } - return ConnectionID(b), nil -} - -// GenerateConnectionIDForInitial generates a connection ID for the Initial packet. -// It uses a length randomly chosen between 8 and 18 bytes. -func GenerateConnectionIDForInitial() (ConnectionID, error) { - r := make([]byte, 1) - if _, err := rand.Read(r); err != nil { - return nil, err - } - len := MinConnectionIDLenInitial + int(r[0])%(maxConnectionIDLen-MinConnectionIDLenInitial+1) - return GenerateConnectionID(len) -} - -// ReadConnectionID reads a connection ID of length len from the given io.Reader. -// It returns io.EOF if there are not enough bytes to read. -func ReadConnectionID(r io.Reader, len int) (ConnectionID, error) { - if len == 0 { - return nil, nil - } - c := make(ConnectionID, len) - _, err := io.ReadFull(r, c) - if err == io.ErrUnexpectedEOF { - return nil, io.EOF - } - return c, err -} - -// Equal says if two connection IDs are equal -func (c ConnectionID) Equal(other ConnectionID) bool { - return bytes.Equal(c, other) -} - -// Len returns the length of the connection ID in bytes -func (c ConnectionID) Len() int { - return len(c) -} - -// Bytes returns the byte representation -func (c ConnectionID) Bytes() []byte { - return []byte(c) -} - -func (c ConnectionID) String() string { - if c.Len() == 0 { - return "(empty)" - } - return fmt.Sprintf("%#x", c.Bytes()) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/encryption_level.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/encryption_level.go deleted file mode 100644 index 4b059b3a..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/encryption_level.go +++ /dev/null @@ -1,28 +0,0 @@ -package protocol - -// EncryptionLevel is the encryption level -// Default value is Unencrypted -type EncryptionLevel int - -const ( - // EncryptionUnspecified is a not specified encryption level - EncryptionUnspecified EncryptionLevel = iota - // EncryptionInitial is the Initial encryption level - EncryptionInitial - // EncryptionHandshake is the Handshake encryption level - EncryptionHandshake - // Encryption1RTT is the 1-RTT encryption level - Encryption1RTT -) - -func (e EncryptionLevel) String() string { - switch e { - case EncryptionInitial: - return "Initial" - case EncryptionHandshake: - return "Handshake" - case Encryption1RTT: - return "1-RTT" - } - return "unknown" -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/packet_number.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/packet_number.go deleted file mode 100644 index 405a07ac..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/packet_number.go +++ /dev/null @@ -1,85 +0,0 @@ -package protocol - -// PacketNumberLen is the length of the packet number in bytes -type PacketNumberLen uint8 - -const ( - // PacketNumberLenInvalid is the default value and not a valid length for a packet number - PacketNumberLenInvalid PacketNumberLen = 0 - // PacketNumberLen1 is a packet number length of 1 byte - PacketNumberLen1 PacketNumberLen = 1 - // PacketNumberLen2 is a packet number length of 2 bytes - PacketNumberLen2 PacketNumberLen = 2 - // PacketNumberLen3 is a packet number length of 3 bytes - PacketNumberLen3 PacketNumberLen = 3 - // PacketNumberLen4 is a packet number length of 4 bytes - PacketNumberLen4 PacketNumberLen = 4 -) - -// DecodePacketNumber calculates the packet number based on the received packet number, its length and the last seen packet number -func DecodePacketNumber( - packetNumberLength PacketNumberLen, - lastPacketNumber PacketNumber, - wirePacketNumber PacketNumber, -) PacketNumber { - var epochDelta PacketNumber - switch packetNumberLength { - case PacketNumberLen1: - epochDelta = PacketNumber(1) << 8 - case PacketNumberLen2: - epochDelta = PacketNumber(1) << 16 - case PacketNumberLen3: - epochDelta = PacketNumber(1) << 24 - case PacketNumberLen4: - epochDelta = PacketNumber(1) << 32 - } - epoch := lastPacketNumber & ^(epochDelta - 1) - prevEpochBegin := epoch - epochDelta - nextEpochBegin := epoch + epochDelta - return closestTo( - lastPacketNumber+1, - epoch+wirePacketNumber, - closestTo(lastPacketNumber+1, prevEpochBegin+wirePacketNumber, nextEpochBegin+wirePacketNumber), - ) -} - -func closestTo(target, a, b PacketNumber) PacketNumber { - if delta(target, a) < delta(target, b) { - return a - } - return b -} - -func delta(a, b PacketNumber) PacketNumber { - if a < b { - return b - a - } - return a - b -} - -// GetPacketNumberLengthForHeader gets the length of the packet number for the public header -// it never chooses a PacketNumberLen of 1 byte, since this is too short under certain circumstances -func GetPacketNumberLengthForHeader(packetNumber, leastUnacked PacketNumber) PacketNumberLen { - diff := uint64(packetNumber - leastUnacked) - if diff < (1 << (16 - 1)) { - return PacketNumberLen2 - } - if diff < (1 << (24 - 1)) { - return PacketNumberLen3 - } - return PacketNumberLen4 -} - -// GetPacketNumberLength gets the minimum length needed to fully represent the packet number -func GetPacketNumberLength(packetNumber PacketNumber) PacketNumberLen { - if packetNumber < (1 << (uint8(PacketNumberLen1) * 8)) { - return PacketNumberLen1 - } - if packetNumber < (1 << (uint8(PacketNumberLen2) * 8)) { - return PacketNumberLen2 - } - if packetNumber < (1 << (uint8(PacketNumberLen3) * 8)) { - return PacketNumberLen3 - } - return PacketNumberLen4 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/params.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/params.go deleted file mode 100644 index 88e0ae45..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/params.go +++ /dev/null @@ -1,126 +0,0 @@ -package protocol - -import "time" - -// MaxPacketSizeIPv4 is the maximum packet size that we use for sending IPv4 packets. -const MaxPacketSizeIPv4 = 1252 - -// MaxPacketSizeIPv6 is the maximum packet size that we use for sending IPv6 packets. -const MaxPacketSizeIPv6 = 1232 - -const defaultMaxCongestionWindowPackets = 1000 - -// DefaultMaxCongestionWindow is the default for the max congestion window -const DefaultMaxCongestionWindow ByteCount = defaultMaxCongestionWindowPackets * DefaultTCPMSS - -// InitialCongestionWindow is the initial congestion window in QUIC packets -const InitialCongestionWindow ByteCount = 32 * DefaultTCPMSS - -// MaxUndecryptablePackets limits the number of undecryptable packets that are queued in the session. -const MaxUndecryptablePackets = 10 - -// ConnectionFlowControlMultiplier determines how much larger the connection flow control windows needs to be relative to any stream's flow control window -// This is the value that Chromium is using -const ConnectionFlowControlMultiplier = 1.5 - -// InitialMaxStreamData is the stream-level flow control window for receiving data -const InitialMaxStreamData = (1 << 10) * 512 // 512 kb - -// InitialMaxData is the connection-level flow control window for receiving data -const InitialMaxData = ConnectionFlowControlMultiplier * InitialMaxStreamData - -// DefaultMaxReceiveStreamFlowControlWindow is the default maximum stream-level flow control window for receiving data, for the server -const DefaultMaxReceiveStreamFlowControlWindow = 6 * (1 << 20) // 6 MB - -// DefaultMaxReceiveConnectionFlowControlWindow is the default connection-level flow control window for receiving data, for the server -const DefaultMaxReceiveConnectionFlowControlWindow = 15 * (1 << 20) // 12 MB - -// WindowUpdateThreshold is the fraction of the receive window that has to be consumed before an higher offset is advertised to the client -const WindowUpdateThreshold = 0.25 - -// DefaultMaxIncomingStreams is the maximum number of streams that a peer may open -const DefaultMaxIncomingStreams = 100 - -// DefaultMaxIncomingUniStreams is the maximum number of unidirectional streams that a peer may open -const DefaultMaxIncomingUniStreams = 100 - -// MaxSessionUnprocessedPackets is the max number of packets stored in each session that are not yet processed. -const MaxSessionUnprocessedPackets = defaultMaxCongestionWindowPackets - -// SkipPacketAveragePeriodLength is the average period length in which one packet number is skipped to prevent an Optimistic ACK attack -const SkipPacketAveragePeriodLength PacketNumber = 500 - -// MaxTrackedSkippedPackets is the maximum number of skipped packet numbers the SentPacketHandler keep track of for Optimistic ACK attack mitigation -const MaxTrackedSkippedPackets = 10 - -// MaxAcceptQueueSize is the maximum number of sessions that the server queues for accepting. -// If the queue is full, new connection attempts will be rejected. -const MaxAcceptQueueSize = 32 - -// CookieExpiryTime is the valid time of a cookie -const CookieExpiryTime = 24 * time.Hour - -// MaxOutstandingSentPackets is maximum number of packets saved for retransmission. -// When reached, it imposes a soft limit on sending new packets: -// Sending ACKs and retransmission is still allowed, but now new regular packets can be sent. -const MaxOutstandingSentPackets = 2 * defaultMaxCongestionWindowPackets - -// MaxTrackedSentPackets is maximum number of sent packets saved for retransmission. -// When reached, no more packets will be sent. -// This value *must* be larger than MaxOutstandingSentPackets. -const MaxTrackedSentPackets = MaxOutstandingSentPackets * 5 / 4 - -// MaxTrackedReceivedAckRanges is the maximum number of ACK ranges tracked -const MaxTrackedReceivedAckRanges = defaultMaxCongestionWindowPackets - -// MaxNonRetransmittableAcks is the maximum number of packets containing an ACK, but no retransmittable frames, that we send in a row -const MaxNonRetransmittableAcks = 19 - -// MaxStreamFrameSorterGaps is the maximum number of gaps between received StreamFrames -// prevents DoS attacks against the streamFrameSorter -const MaxStreamFrameSorterGaps = 1000 - -// MaxCryptoStreamOffset is the maximum offset allowed on any of the crypto streams. -// This limits the size of the ClientHello and Certificates that can be received. -const MaxCryptoStreamOffset = 16 * (1 << 10) - -// MinRemoteIdleTimeout is the minimum value that we accept for the remote idle timeout -const MinRemoteIdleTimeout = 5 * time.Second - -// DefaultIdleTimeout is the default idle timeout -const DefaultIdleTimeout = 30 * time.Second - -// DefaultHandshakeTimeout is the default timeout for a connection until the crypto handshake succeeds. -const DefaultHandshakeTimeout = 10 * time.Second - -// RetiredConnectionIDDeleteTimeout is the time we keep closed sessions around in order to retransmit the CONNECTION_CLOSE. -// after this time all information about the old connection will be deleted -const RetiredConnectionIDDeleteTimeout = 5 * time.Second - -// MinStreamFrameSize is the minimum size that has to be left in a packet, so that we add another STREAM frame. -// This avoids splitting up STREAM frames into small pieces, which has 2 advantages: -// 1. it reduces the framing overhead -// 2. it reduces the head-of-line blocking, when a packet is lost -const MinStreamFrameSize ByteCount = 128 - -// MaxPostHandshakeCryptoFrameSize is the maximum size of CRYPTO frames -// we send after the handshake completes. -const MaxPostHandshakeCryptoFrameSize ByteCount = 1000 - -// MaxAckFrameSize is the maximum size for an ACK frame that we write -// Due to the varint encoding, ACK frames can grow (almost) indefinitely large. -// The MaxAckFrameSize should be large enough to encode many ACK range, -// but must ensure that a maximum size ACK frame fits into one packet. -const MaxAckFrameSize ByteCount = 1000 - -// MinPacingDelay is the minimum duration that is used for packet pacing -// If the packet packing frequency is higher, multiple packets might be sent at once. -// Example: For a packet pacing delay of 20 microseconds, we would send 5 packets at once, wait for 100 microseconds, and so forth. -const MinPacingDelay time.Duration = 100 * time.Microsecond - -// DefaultConnectionIDLength is the connection ID length that is used for multiplexed connections -// if no other value is configured. -const DefaultConnectionIDLength = 4 - -// AckDelayExponent is the ack delay exponent used when sending ACKs. -const AckDelayExponent = 3 diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/perspective.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/perspective.go deleted file mode 100644 index 43358fec..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/perspective.go +++ /dev/null @@ -1,26 +0,0 @@ -package protocol - -// Perspective determines if we're acting as a server or a client -type Perspective int - -// the perspectives -const ( - PerspectiveServer Perspective = 1 - PerspectiveClient Perspective = 2 -) - -// Opposite returns the perspective of the peer -func (p Perspective) Opposite() Perspective { - return 3 - p -} - -func (p Perspective) String() string { - switch p { - case PerspectiveServer: - return "Server" - case PerspectiveClient: - return "Client" - default: - return "invalid perspective" - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/protocol.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/protocol.go deleted file mode 100644 index 6e59afcb..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/protocol.go +++ /dev/null @@ -1,75 +0,0 @@ -package protocol - -import ( - "fmt" -) - -// A PacketNumber in QUIC -type PacketNumber uint64 - -// The PacketType is the Long Header Type -type PacketType uint8 - -const ( - // PacketTypeInitial is the packet type of an Initial packet - PacketTypeInitial PacketType = 1 + iota - // PacketTypeRetry is the packet type of a Retry packet - PacketTypeRetry - // PacketTypeHandshake is the packet type of a Handshake packet - PacketTypeHandshake - // PacketType0RTT is the packet type of a 0-RTT packet - PacketType0RTT -) - -func (t PacketType) String() string { - switch t { - case PacketTypeInitial: - return "Initial" - case PacketTypeRetry: - return "Retry" - case PacketTypeHandshake: - return "Handshake" - case PacketType0RTT: - return "0-RTT Protected" - default: - return fmt.Sprintf("unknown packet type: %d", t) - } -} - -// A ByteCount in QUIC -type ByteCount uint64 - -// MaxByteCount is the maximum value of a ByteCount -const MaxByteCount = ByteCount(1<<62 - 1) - -// An ApplicationErrorCode is an application-defined error code. -type ApplicationErrorCode uint16 - -// MaxReceivePacketSize maximum packet size of any QUIC packet, based on -// ethernet's max size, minus the IP and UDP headers. IPv6 has a 40 byte header, -// UDP adds an additional 8 bytes. This is a total overhead of 48 bytes. -// Ethernet's max packet size is 1500 bytes, 1500 - 48 = 1452. -const MaxReceivePacketSize ByteCount = 1452 - -// DefaultTCPMSS is the default maximum packet size used in the Linux TCP implementation. -// Used in QUIC for congestion window computations in bytes. -const DefaultTCPMSS ByteCount = 1460 - -// MinInitialPacketSize is the minimum size an Initial packet is required to have. -const MinInitialPacketSize = 1200 - -// MinStatelessResetSize is the minimum size of a stateless reset packet -const MinStatelessResetSize = 1 /* first byte */ + 22 /* random bytes */ + 16 /* token */ - -// MinConnectionIDLenInitial is the minimum length of the destination connection ID on an Initial packet. -const MinConnectionIDLenInitial = 8 - -// MaxStreamCount is the maximum stream count value that can be sent in MAX_STREAMS frames -// and as the stream count in the transport parameters -const MaxStreamCount = 1 << 60 - -// DefaultAckDelayExponent is the default ack delay exponent -const DefaultAckDelayExponent = 3 - -// MaxAckDelayExponent is the maximum ack delay exponent -const MaxAckDelayExponent = 20 diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/stream_id.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/stream_id.go deleted file mode 100644 index b96e0c2b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/stream_id.go +++ /dev/null @@ -1,67 +0,0 @@ -package protocol - -// A StreamID in QUIC -type StreamID uint64 - -// StreamType encodes if this is a unidirectional or bidirectional stream -type StreamType uint8 - -const ( - // StreamTypeUni is a unidirectional stream - StreamTypeUni StreamType = iota - // StreamTypeBidi is a bidirectional stream - StreamTypeBidi -) - -// InitiatedBy says if the stream was initiated by the client or by the server -func (s StreamID) InitiatedBy() Perspective { - if s%2 == 0 { - return PerspectiveClient - } - return PerspectiveServer -} - -//Type says if this is a unidirectional or bidirectional stream -func (s StreamID) Type() StreamType { - if s%4 >= 2 { - return StreamTypeUni - } - return StreamTypeBidi -} - -// StreamNum returns how many streams in total are below this -// Example: for stream 9 it returns 3 (i.e. streams 1, 5 and 9) -func (s StreamID) StreamNum() uint64 { - return uint64(s/4) + 1 -} - -// MaxStreamID is the highest stream ID that a peer is allowed to open, -// when it is allowed to open numStreams. -func MaxStreamID(stype StreamType, numStreams uint64, pers Perspective) StreamID { - if numStreams == 0 { - return 0 - } - var first StreamID - switch stype { - case StreamTypeBidi: - switch pers { - case PerspectiveClient: - first = 0 - case PerspectiveServer: - first = 1 - } - case StreamTypeUni: - switch pers { - case PerspectiveClient: - first = 2 - case PerspectiveServer: - first = 3 - } - } - return first + 4*StreamID(numStreams-1) -} - -// FirstStream returns the first valid stream ID -func FirstStream(stype StreamType, pers Perspective) StreamID { - return MaxStreamID(stype, 1, pers) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/version.go b/vendor/github.com/lucas-clemente/quic-go/internal/protocol/version.go deleted file mode 100644 index 410028b2..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/protocol/version.go +++ /dev/null @@ -1,119 +0,0 @@ -package protocol - -import ( - "crypto/rand" - "encoding/binary" - "fmt" - "math" -) - -// VersionNumber is a version number as int -type VersionNumber uint32 - -// gQUIC version range as defined in the wiki: https://github.com/quicwg/base-drafts/wiki/QUIC-Versions -const ( - gquicVersion0 = 0x51303030 - maxGquicVersion = 0x51303439 -) - -// The version numbers, making grepping easier -const ( - VersionTLS VersionNumber = VersionMilestone0_11_2 - VersionWhatever VersionNumber = 1 // for when the version doesn't matter - VersionUnknown VersionNumber = math.MaxUint32 - - VersionMilestone0_11_2 VersionNumber = 0xff000013 // QUIC WG draft-19 -) - -// SupportedVersions lists the versions that the server supports -// must be in sorted descending order -var SupportedVersions = []VersionNumber{VersionMilestone0_11_2} - -// IsValidVersion says if the version is known to quic-go -func IsValidVersion(v VersionNumber) bool { - return v == VersionTLS || IsSupportedVersion(SupportedVersions, v) -} - -func (vn VersionNumber) String() string { - switch vn { - case VersionWhatever: - return "whatever" - case VersionUnknown: - return "unknown" - case VersionMilestone0_11_2: - return "QUIC WG draft-19" - default: - if vn.isGQUIC() { - return fmt.Sprintf("gQUIC %d", vn.toGQUICVersion()) - } - return fmt.Sprintf("%#x", uint32(vn)) - } -} - -// ToAltSvc returns the representation of the version for the H2 Alt-Svc parameters -func (vn VersionNumber) ToAltSvc() string { - return fmt.Sprintf("%d", vn) -} - -func (vn VersionNumber) isGQUIC() bool { - return vn > gquicVersion0 && vn <= maxGquicVersion -} - -func (vn VersionNumber) toGQUICVersion() int { - return int(10*(vn-gquicVersion0)/0x100) + int(vn%0x10) -} - -// IsSupportedVersion returns true if the server supports this version -func IsSupportedVersion(supported []VersionNumber, v VersionNumber) bool { - for _, t := range supported { - if t == v { - return true - } - } - return false -} - -// ChooseSupportedVersion finds the best version in the overlap of ours and theirs -// ours is a slice of versions that we support, sorted by our preference (descending) -// theirs is a slice of versions offered by the peer. The order does not matter. -// The bool returned indicates if a matching version was found. -func ChooseSupportedVersion(ours, theirs []VersionNumber) (VersionNumber, bool) { - for _, ourVer := range ours { - for _, theirVer := range theirs { - if ourVer == theirVer { - return ourVer, true - } - } - } - return 0, false -} - -// generateReservedVersion generates a reserved version number (v & 0x0f0f0f0f == 0x0a0a0a0a) -func generateReservedVersion() VersionNumber { - b := make([]byte, 4) - _, _ = rand.Read(b) // ignore the error here. Failure to read random data doesn't break anything - return VersionNumber((binary.BigEndian.Uint32(b) | 0x0a0a0a0a) & 0xfafafafa) -} - -// GetGreasedVersions adds one reserved version number to a slice of version numbers, at a random position -func GetGreasedVersions(supported []VersionNumber) []VersionNumber { - b := make([]byte, 1) - _, _ = rand.Read(b) // ignore the error here. Failure to read random data doesn't break anything - randPos := int(b[0]) % (len(supported) + 1) - greased := make([]VersionNumber, len(supported)+1) - copy(greased, supported[:randPos]) - greased[randPos] = generateReservedVersion() - copy(greased[randPos+1:], supported[randPos:]) - return greased -} - -// StripGreasedVersions strips all greased versions from a slice of versions -func StripGreasedVersions(versions []VersionNumber) []VersionNumber { - realVersions := make([]VersionNumber, 0, len(versions)) - for _, v := range versions { - if v&0x0f0f0f0f != 0x0a0a0a0a { - realVersions = append(realVersions, v) - } - } - return realVersions -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/qerr/error_codes.go b/vendor/github.com/lucas-clemente/quic-go/internal/qerr/error_codes.go deleted file mode 100644 index 091de1ca..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/qerr/error_codes.go +++ /dev/null @@ -1,71 +0,0 @@ -package qerr - -import ( - "fmt" - - "github.com/marten-seemann/qtls" -) - -// ErrorCode can be used as a normal error without reason. -type ErrorCode uint16 - -// The error codes defined by QUIC -const ( - NoError ErrorCode = 0x0 - InternalError ErrorCode = 0x1 - ServerBusy ErrorCode = 0x2 - FlowControlError ErrorCode = 0x3 - StreamLimitError ErrorCode = 0x4 - StreamStateError ErrorCode = 0x5 - FinalSizeError ErrorCode = 0x6 - FrameEncodingError ErrorCode = 0x7 - TransportParameterError ErrorCode = 0x8 - VersionNegotiationError ErrorCode = 0x9 - ProtocolViolation ErrorCode = 0xa - InvalidMigration ErrorCode = 0xc -) - -func (e ErrorCode) isCryptoError() bool { - return e >= 0x100 && e < 0x200 -} - -func (e ErrorCode) Error() string { - if e.isCryptoError() { - return fmt.Sprintf("%s: %s", e.String(), qtls.Alert(e-0x100).Error()) - } - return e.String() -} - -func (e ErrorCode) String() string { - switch e { - case NoError: - return "NO_ERROR" - case InternalError: - return "INTERNAL_ERROR" - case ServerBusy: - return "SERVER_BUSY" - case FlowControlError: - return "FLOW_CONTROL_ERROR" - case StreamLimitError: - return "STREAM_LIMIT_ERROR" - case StreamStateError: - return "STREAM_STATE_ERROR" - case FinalSizeError: - return "FINAL_SIZE_ERROR" - case FrameEncodingError: - return "FRAME_ENCODING_ERROR" - case TransportParameterError: - return "TRANSPORT_PARAMETER_ERROR" - case VersionNegotiationError: - return "VERSION_NEGOTIATION_ERROR" - case ProtocolViolation: - return "PROTOCOL_VIOLATION" - case InvalidMigration: - return "INVALID_MIGRATION" - default: - if e.isCryptoError() { - return "CRYPTO_ERROR" - } - return fmt.Sprintf("unknown error code: %#x", uint16(e)) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/qerr/quic_error.go b/vendor/github.com/lucas-clemente/quic-go/internal/qerr/quic_error.go deleted file mode 100644 index 3a1718b0..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/qerr/quic_error.go +++ /dev/null @@ -1,73 +0,0 @@ -package qerr - -import ( - "fmt" - "net" -) - -// A QuicError consists of an error code plus a error reason -type QuicError struct { - ErrorCode ErrorCode - ErrorMessage string - isTimeout bool -} - -var _ net.Error = &QuicError{} - -// Error creates a new QuicError instance -func Error(errorCode ErrorCode, errorMessage string) *QuicError { - return &QuicError{ - ErrorCode: errorCode, - ErrorMessage: errorMessage, - } -} - -// TimeoutError creates a new QuicError instance for a timeout error -func TimeoutError(errorMessage string) *QuicError { - return &QuicError{ - ErrorMessage: errorMessage, - isTimeout: true, - } -} - -// CryptoError create a new QuicError instance for a crypto error -func CryptoError(tlsAlert uint8, errorMessage string) *QuicError { - return &QuicError{ - ErrorCode: 0x100 + ErrorCode(tlsAlert), - ErrorMessage: errorMessage, - } -} - -func (e *QuicError) Error() string { - if len(e.ErrorMessage) == 0 { - return e.ErrorCode.Error() - } - return fmt.Sprintf("%s: %s", e.ErrorCode.String(), e.ErrorMessage) -} - -// IsCryptoError says if this error is a crypto error -func (e *QuicError) IsCryptoError() bool { - return e.ErrorCode.isCryptoError() -} - -// Temporary says if the error is temporary. -func (e *QuicError) Temporary() bool { - return false -} - -// Timeout says if this error is a timeout. -func (e *QuicError) Timeout() bool { - return e.isTimeout -} - -// ToQuicError converts an arbitrary error to a QuicError. It leaves QuicErrors -// unchanged, and properly handles `ErrorCode`s. -func ToQuicError(err error) *QuicError { - switch e := err.(type) { - case *QuicError: - return e - case ErrorCode: - return Error(e, "") - } - return Error(InternalError, err.Error()) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/atomic_bool.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/atomic_bool.go deleted file mode 100644 index cf464250..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/atomic_bool.go +++ /dev/null @@ -1,22 +0,0 @@ -package utils - -import "sync/atomic" - -// An AtomicBool is an atomic bool -type AtomicBool struct { - v int32 -} - -// Set sets the value -func (a *AtomicBool) Set(value bool) { - var n int32 - if value { - n = 1 - } - atomic.StoreInt32(&a.v, n) -} - -// Get gets the value -func (a *AtomicBool) Get() bool { - return atomic.LoadInt32(&a.v) != 0 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteinterval_linkedlist.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteinterval_linkedlist.go deleted file mode 100644 index 096023ef..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteinterval_linkedlist.go +++ /dev/null @@ -1,217 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package utils - -// Linked list implementation from the Go standard library. - -// ByteIntervalElement is an element of a linked list. -type ByteIntervalElement struct { - // Next and previous pointers in the doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.root is both the next element of the last - // list element (l.Back()) and the previous element of the first list - // element (l.Front()). - next, prev *ByteIntervalElement - - // The list to which this element belongs. - list *ByteIntervalList - - // The value stored with this element. - Value ByteInterval -} - -// Next returns the next list element or nil. -func (e *ByteIntervalElement) Next() *ByteIntervalElement { - if p := e.next; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// Prev returns the previous list element or nil. -func (e *ByteIntervalElement) Prev() *ByteIntervalElement { - if p := e.prev; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// ByteIntervalList is a linked list of ByteIntervals. -type ByteIntervalList struct { - root ByteIntervalElement // sentinel list element, only &root, root.prev, and root.next are used - len int // current list length excluding (this) sentinel element -} - -// Init initializes or clears list l. -func (l *ByteIntervalList) Init() *ByteIntervalList { - l.root.next = &l.root - l.root.prev = &l.root - l.len = 0 - return l -} - -// NewByteIntervalList returns an initialized list. -func NewByteIntervalList() *ByteIntervalList { return new(ByteIntervalList).Init() } - -// Len returns the number of elements of list l. -// The complexity is O(1). -func (l *ByteIntervalList) Len() int { return l.len } - -// Front returns the first element of list l or nil if the list is empty. -func (l *ByteIntervalList) Front() *ByteIntervalElement { - if l.len == 0 { - return nil - } - return l.root.next -} - -// Back returns the last element of list l or nil if the list is empty. -func (l *ByteIntervalList) Back() *ByteIntervalElement { - if l.len == 0 { - return nil - } - return l.root.prev -} - -// lazyInit lazily initializes a zero List value. -func (l *ByteIntervalList) lazyInit() { - if l.root.next == nil { - l.Init() - } -} - -// insert inserts e after at, increments l.len, and returns e. -func (l *ByteIntervalList) insert(e, at *ByteIntervalElement) *ByteIntervalElement { - n := at.next - at.next = e - e.prev = at - e.next = n - n.prev = e - e.list = l - l.len++ - return e -} - -// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). -func (l *ByteIntervalList) insertValue(v ByteInterval, at *ByteIntervalElement) *ByteIntervalElement { - return l.insert(&ByteIntervalElement{Value: v}, at) -} - -// remove removes e from its list, decrements l.len, and returns e. -func (l *ByteIntervalList) remove(e *ByteIntervalElement) *ByteIntervalElement { - e.prev.next = e.next - e.next.prev = e.prev - e.next = nil // avoid memory leaks - e.prev = nil // avoid memory leaks - e.list = nil - l.len-- - return e -} - -// Remove removes e from l if e is an element of list l. -// It returns the element value e.Value. -// The element must not be nil. -func (l *ByteIntervalList) Remove(e *ByteIntervalElement) ByteInterval { - if e.list == l { - // if e.list == l, l must have been initialized when e was inserted - // in l or l == nil (e is a zero Element) and l.remove will crash - l.remove(e) - } - return e.Value -} - -// PushFront inserts a new element e with value v at the front of list l and returns e. -func (l *ByteIntervalList) PushFront(v ByteInterval) *ByteIntervalElement { - l.lazyInit() - return l.insertValue(v, &l.root) -} - -// PushBack inserts a new element e with value v at the back of list l and returns e. -func (l *ByteIntervalList) PushBack(v ByteInterval) *ByteIntervalElement { - l.lazyInit() - return l.insertValue(v, l.root.prev) -} - -// InsertBefore inserts a new element e with value v immediately before mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *ByteIntervalList) InsertBefore(v ByteInterval, mark *ByteIntervalElement) *ByteIntervalElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark.prev) -} - -// InsertAfter inserts a new element e with value v immediately after mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *ByteIntervalList) InsertAfter(v ByteInterval, mark *ByteIntervalElement) *ByteIntervalElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark) -} - -// MoveToFront moves element e to the front of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *ByteIntervalList) MoveToFront(e *ByteIntervalElement) { - if e.list != l || l.root.next == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), &l.root) -} - -// MoveToBack moves element e to the back of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *ByteIntervalList) MoveToBack(e *ByteIntervalElement) { - if e.list != l || l.root.prev == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), l.root.prev) -} - -// MoveBefore moves element e to its new position before mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *ByteIntervalList) MoveBefore(e, mark *ByteIntervalElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark.prev) -} - -// MoveAfter moves element e to its new position after mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *ByteIntervalList) MoveAfter(e, mark *ByteIntervalElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark) -} - -// PushBackList inserts a copy of an other list at the back of list l. -// The lists l and other may be the same. They must not be nil. -func (l *ByteIntervalList) PushBackList(other *ByteIntervalList) { - l.lazyInit() - for i, e := other.Len(), other.Front(); i > 0; i, e = i-1, e.Next() { - l.insertValue(e.Value, l.root.prev) - } -} - -// PushFrontList inserts a copy of an other list at the front of list l. -// The lists l and other may be the same. They must not be nil. -func (l *ByteIntervalList) PushFrontList(other *ByteIntervalList) { - l.lazyInit() - for i, e := other.Len(), other.Back(); i > 0; i, e = i-1, e.Prev() { - l.insertValue(e.Value, &l.root) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder.go deleted file mode 100644 index 6b92cfa2..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder.go +++ /dev/null @@ -1,17 +0,0 @@ -package utils - -import ( - "bytes" - "io" -) - -// A ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers. -type ByteOrder interface { - ReadUintN(b io.ByteReader, length uint8) (uint64, error) - ReadUint32(io.ByteReader) (uint32, error) - ReadUint16(io.ByteReader) (uint16, error) - - WriteUintN(b *bytes.Buffer, length uint8, value uint64) - WriteUint32(*bytes.Buffer, uint32) - WriteUint16(*bytes.Buffer, uint16) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder_big_endian.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder_big_endian.go deleted file mode 100644 index eede9cd7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/byteorder_big_endian.go +++ /dev/null @@ -1,74 +0,0 @@ -package utils - -import ( - "bytes" - "io" -) - -// BigEndian is the big-endian implementation of ByteOrder. -var BigEndian ByteOrder = bigEndian{} - -type bigEndian struct{} - -var _ ByteOrder = &bigEndian{} - -// ReadUintN reads N bytes -func (bigEndian) ReadUintN(b io.ByteReader, length uint8) (uint64, error) { - var res uint64 - for i := uint8(0); i < length; i++ { - bt, err := b.ReadByte() - if err != nil { - return 0, err - } - res ^= uint64(bt) << ((length - 1 - i) * 8) - } - return res, nil -} - -// ReadUint32 reads a uint32 -func (bigEndian) ReadUint32(b io.ByteReader) (uint32, error) { - var b1, b2, b3, b4 uint8 - var err error - if b4, err = b.ReadByte(); err != nil { - return 0, err - } - if b3, err = b.ReadByte(); err != nil { - return 0, err - } - if b2, err = b.ReadByte(); err != nil { - return 0, err - } - if b1, err = b.ReadByte(); err != nil { - return 0, err - } - return uint32(b1) + uint32(b2)<<8 + uint32(b3)<<16 + uint32(b4)<<24, nil -} - -// ReadUint16 reads a uint16 -func (bigEndian) ReadUint16(b io.ByteReader) (uint16, error) { - var b1, b2 uint8 - var err error - if b2, err = b.ReadByte(); err != nil { - return 0, err - } - if b1, err = b.ReadByte(); err != nil { - return 0, err - } - return uint16(b1) + uint16(b2)<<8, nil -} - -func (bigEndian) WriteUintN(b *bytes.Buffer, length uint8, i uint64) { - for j := length; j > 0; j-- { - b.WriteByte(uint8(i >> (8 * (j - 1)))) - } -} - -// WriteUint32 writes a uint32 -func (bigEndian) WriteUint32(b *bytes.Buffer, i uint32) { - b.Write([]byte{uint8(i >> 24), uint8(i >> 16), uint8(i >> 8), uint8(i)}) -} - -// WriteUint16 writes a uint16 -func (bigEndian) WriteUint16(b *bytes.Buffer, i uint16) { - b.Write([]byte{uint8(i >> 8), uint8(i)}) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/gen.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/gen.go deleted file mode 100644 index bb839be6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/gen.go +++ /dev/null @@ -1,4 +0,0 @@ -package utils - -//go:generate genny -pkg utils -in linkedlist/linkedlist.go -out byteinterval_linkedlist.go gen Item=ByteInterval -//go:generate genny -pkg utils -in linkedlist/linkedlist.go -out packetinterval_linkedlist.go gen Item=PacketInterval diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/host.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/host.go deleted file mode 100644 index a1d6453b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/host.go +++ /dev/null @@ -1,27 +0,0 @@ -package utils - -import ( - "net/url" - "strings" -) - -// HostnameFromAddr determines the hostname in an address string -func HostnameFromAddr(addr string) (string, error) { - p, err := url.Parse(addr) - if err != nil { - return "", err - } - h := p.Host - - // copied from https://golang.org/src/net/http/transport.go - if hasPort(h) { - h = h[:strings.LastIndex(h, ":")] - } - - return h, nil -} - -// copied from https://golang.org/src/net/http/http.go -func hasPort(s string) bool { - return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/log.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/log.go deleted file mode 100644 index e27f01b4..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/log.go +++ /dev/null @@ -1,131 +0,0 @@ -package utils - -import ( - "fmt" - "log" - "os" - "strings" - "time" -) - -// LogLevel of quic-go -type LogLevel uint8 - -const ( - // LogLevelNothing disables - LogLevelNothing LogLevel = iota - // LogLevelError enables err logs - LogLevelError - // LogLevelInfo enables info logs (e.g. packets) - LogLevelInfo - // LogLevelDebug enables debug logs (e.g. packet contents) - LogLevelDebug -) - -const logEnv = "QUIC_GO_LOG_LEVEL" - -// A Logger logs. -type Logger interface { - SetLogLevel(LogLevel) - SetLogTimeFormat(format string) - WithPrefix(prefix string) Logger - Debug() bool - - Errorf(format string, args ...interface{}) - Infof(format string, args ...interface{}) - Debugf(format string, args ...interface{}) -} - -// DefaultLogger is used by quic-go for logging. -var DefaultLogger Logger - -type defaultLogger struct { - prefix string - - logLevel LogLevel - timeFormat string -} - -var _ Logger = &defaultLogger{} - -// SetLogLevel sets the log level -func (l *defaultLogger) SetLogLevel(level LogLevel) { - l.logLevel = level -} - -// SetLogTimeFormat sets the format of the timestamp -// an empty string disables the logging of timestamps -func (l *defaultLogger) SetLogTimeFormat(format string) { - log.SetFlags(0) // disable timestamp logging done by the log package - l.timeFormat = format -} - -// Debugf logs something -func (l *defaultLogger) Debugf(format string, args ...interface{}) { - if l.logLevel == LogLevelDebug { - l.logMessage(format, args...) - } -} - -// Infof logs something -func (l *defaultLogger) Infof(format string, args ...interface{}) { - if l.logLevel >= LogLevelInfo { - l.logMessage(format, args...) - } -} - -// Errorf logs something -func (l *defaultLogger) Errorf(format string, args ...interface{}) { - if l.logLevel >= LogLevelError { - l.logMessage(format, args...) - } -} - -func (l *defaultLogger) logMessage(format string, args ...interface{}) { - var pre string - - if len(l.timeFormat) > 0 { - pre = time.Now().Format(l.timeFormat) + " " - } - if len(l.prefix) > 0 { - pre += l.prefix + " " - } - log.Printf(pre+format, args...) -} - -func (l *defaultLogger) WithPrefix(prefix string) Logger { - if len(l.prefix) > 0 { - prefix = l.prefix + " " + prefix - } - return &defaultLogger{ - logLevel: l.logLevel, - timeFormat: l.timeFormat, - prefix: prefix, - } -} - -// Debug returns true if the log level is LogLevelDebug -func (l *defaultLogger) Debug() bool { - return l.logLevel == LogLevelDebug -} - -func init() { - DefaultLogger = &defaultLogger{} - DefaultLogger.SetLogLevel(readLoggingEnv()) -} - -func readLoggingEnv() LogLevel { - switch strings.ToLower(os.Getenv(logEnv)) { - case "": - return LogLevelNothing - case "debug": - return LogLevelDebug - case "info": - return LogLevelInfo - case "error": - return LogLevelError - default: - fmt.Fprintln(os.Stderr, "invalid quic-go log level, see https://github.com/lucas-clemente/quic-go/wiki/Logging") - return LogLevelNothing - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/minmax.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/minmax.go deleted file mode 100644 index 84cbec7b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/minmax.go +++ /dev/null @@ -1,159 +0,0 @@ -package utils - -import ( - "math" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// InfDuration is a duration of infinite length -const InfDuration = time.Duration(math.MaxInt64) - -// Max returns the maximum of two Ints -func Max(a, b int) int { - if a < b { - return b - } - return a -} - -// MaxUint32 returns the maximum of two uint32 -func MaxUint32(a, b uint32) uint32 { - if a < b { - return b - } - return a -} - -// MaxUint64 returns the maximum of two uint64 -func MaxUint64(a, b uint64) uint64 { - if a < b { - return b - } - return a -} - -// MinUint64 returns the maximum of two uint64 -func MinUint64(a, b uint64) uint64 { - if a < b { - return a - } - return b -} - -// Min returns the minimum of two Ints -func Min(a, b int) int { - if a < b { - return a - } - return b -} - -// MinUint32 returns the maximum of two uint32 -func MinUint32(a, b uint32) uint32 { - if a < b { - return a - } - return b -} - -// MinInt64 returns the minimum of two int64 -func MinInt64(a, b int64) int64 { - if a < b { - return a - } - return b -} - -// MaxInt64 returns the minimum of two int64 -func MaxInt64(a, b int64) int64 { - if a > b { - return a - } - return b -} - -// MinByteCount returns the minimum of two ByteCounts -func MinByteCount(a, b protocol.ByteCount) protocol.ByteCount { - if a < b { - return a - } - return b -} - -// MaxByteCount returns the maximum of two ByteCounts -func MaxByteCount(a, b protocol.ByteCount) protocol.ByteCount { - if a < b { - return b - } - return a -} - -// MaxDuration returns the max duration -func MaxDuration(a, b time.Duration) time.Duration { - if a > b { - return a - } - return b -} - -// MinDuration returns the minimum duration -func MinDuration(a, b time.Duration) time.Duration { - if a > b { - return b - } - return a -} - -// AbsDuration returns the absolute value of a time duration -func AbsDuration(d time.Duration) time.Duration { - if d >= 0 { - return d - } - return -d -} - -// MinTime returns the earlier time -func MinTime(a, b time.Time) time.Time { - if a.After(b) { - return b - } - return a -} - -// MinNonZeroTime returns the earlist time that is not time.Time{} -// If both a and b are time.Time{}, it returns time.Time{} -func MinNonZeroTime(a, b time.Time) time.Time { - if a.IsZero() { - return b - } - if b.IsZero() { - return a - } - return MinTime(a, b) -} - -// MaxTime returns the later time -func MaxTime(a, b time.Time) time.Time { - if a.After(b) { - return a - } - return b -} - -// MaxPacketNumber returns the max packet number -func MaxPacketNumber(a, b protocol.PacketNumber) protocol.PacketNumber { - if a > b { - return a - } - return b -} - -// MinPacketNumber returns the min packet number -func MinPacketNumber(a, b protocol.PacketNumber) protocol.PacketNumber { - if a < b { - return a - } - return b -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/packet_interval.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/packet_interval.go deleted file mode 100644 index 62cc8b9c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/packet_interval.go +++ /dev/null @@ -1,9 +0,0 @@ -package utils - -import "github.com/lucas-clemente/quic-go/internal/protocol" - -// PacketInterval is an interval from one PacketNumber to the other -type PacketInterval struct { - Start protocol.PacketNumber - End protocol.PacketNumber -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/packetinterval_linkedlist.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/packetinterval_linkedlist.go deleted file mode 100644 index b461e85a..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/packetinterval_linkedlist.go +++ /dev/null @@ -1,217 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package utils - -// Linked list implementation from the Go standard library. - -// PacketIntervalElement is an element of a linked list. -type PacketIntervalElement struct { - // Next and previous pointers in the doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.root is both the next element of the last - // list element (l.Back()) and the previous element of the first list - // element (l.Front()). - next, prev *PacketIntervalElement - - // The list to which this element belongs. - list *PacketIntervalList - - // The value stored with this element. - Value PacketInterval -} - -// Next returns the next list element or nil. -func (e *PacketIntervalElement) Next() *PacketIntervalElement { - if p := e.next; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// Prev returns the previous list element or nil. -func (e *PacketIntervalElement) Prev() *PacketIntervalElement { - if p := e.prev; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// PacketIntervalList is a linked list of PacketIntervals. -type PacketIntervalList struct { - root PacketIntervalElement // sentinel list element, only &root, root.prev, and root.next are used - len int // current list length excluding (this) sentinel element -} - -// Init initializes or clears list l. -func (l *PacketIntervalList) Init() *PacketIntervalList { - l.root.next = &l.root - l.root.prev = &l.root - l.len = 0 - return l -} - -// NewPacketIntervalList returns an initialized list. -func NewPacketIntervalList() *PacketIntervalList { return new(PacketIntervalList).Init() } - -// Len returns the number of elements of list l. -// The complexity is O(1). -func (l *PacketIntervalList) Len() int { return l.len } - -// Front returns the first element of list l or nil if the list is empty. -func (l *PacketIntervalList) Front() *PacketIntervalElement { - if l.len == 0 { - return nil - } - return l.root.next -} - -// Back returns the last element of list l or nil if the list is empty. -func (l *PacketIntervalList) Back() *PacketIntervalElement { - if l.len == 0 { - return nil - } - return l.root.prev -} - -// lazyInit lazily initializes a zero List value. -func (l *PacketIntervalList) lazyInit() { - if l.root.next == nil { - l.Init() - } -} - -// insert inserts e after at, increments l.len, and returns e. -func (l *PacketIntervalList) insert(e, at *PacketIntervalElement) *PacketIntervalElement { - n := at.next - at.next = e - e.prev = at - e.next = n - n.prev = e - e.list = l - l.len++ - return e -} - -// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). -func (l *PacketIntervalList) insertValue(v PacketInterval, at *PacketIntervalElement) *PacketIntervalElement { - return l.insert(&PacketIntervalElement{Value: v}, at) -} - -// remove removes e from its list, decrements l.len, and returns e. -func (l *PacketIntervalList) remove(e *PacketIntervalElement) *PacketIntervalElement { - e.prev.next = e.next - e.next.prev = e.prev - e.next = nil // avoid memory leaks - e.prev = nil // avoid memory leaks - e.list = nil - l.len-- - return e -} - -// Remove removes e from l if e is an element of list l. -// It returns the element value e.Value. -// The element must not be nil. -func (l *PacketIntervalList) Remove(e *PacketIntervalElement) PacketInterval { - if e.list == l { - // if e.list == l, l must have been initialized when e was inserted - // in l or l == nil (e is a zero Element) and l.remove will crash - l.remove(e) - } - return e.Value -} - -// PushFront inserts a new element e with value v at the front of list l and returns e. -func (l *PacketIntervalList) PushFront(v PacketInterval) *PacketIntervalElement { - l.lazyInit() - return l.insertValue(v, &l.root) -} - -// PushBack inserts a new element e with value v at the back of list l and returns e. -func (l *PacketIntervalList) PushBack(v PacketInterval) *PacketIntervalElement { - l.lazyInit() - return l.insertValue(v, l.root.prev) -} - -// InsertBefore inserts a new element e with value v immediately before mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *PacketIntervalList) InsertBefore(v PacketInterval, mark *PacketIntervalElement) *PacketIntervalElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark.prev) -} - -// InsertAfter inserts a new element e with value v immediately after mark and returns e. -// If mark is not an element of l, the list is not modified. -// The mark must not be nil. -func (l *PacketIntervalList) InsertAfter(v PacketInterval, mark *PacketIntervalElement) *PacketIntervalElement { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark) -} - -// MoveToFront moves element e to the front of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *PacketIntervalList) MoveToFront(e *PacketIntervalElement) { - if e.list != l || l.root.next == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), &l.root) -} - -// MoveToBack moves element e to the back of list l. -// If e is not an element of l, the list is not modified. -// The element must not be nil. -func (l *PacketIntervalList) MoveToBack(e *PacketIntervalElement) { - if e.list != l || l.root.prev == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), l.root.prev) -} - -// MoveBefore moves element e to its new position before mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *PacketIntervalList) MoveBefore(e, mark *PacketIntervalElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark.prev) -} - -// MoveAfter moves element e to its new position after mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -// The element and mark must not be nil. -func (l *PacketIntervalList) MoveAfter(e, mark *PacketIntervalElement) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark) -} - -// PushBackList inserts a copy of an other list at the back of list l. -// The lists l and other may be the same. They must not be nil. -func (l *PacketIntervalList) PushBackList(other *PacketIntervalList) { - l.lazyInit() - for i, e := other.Len(), other.Front(); i > 0; i, e = i-1, e.Next() { - l.insertValue(e.Value, l.root.prev) - } -} - -// PushFrontList inserts a copy of an other list at the front of list l. -// The lists l and other may be the same. They must not be nil. -func (l *PacketIntervalList) PushFrontList(other *PacketIntervalList) { - l.lazyInit() - for i, e := other.Len(), other.Back(); i > 0; i, e = i-1, e.Prev() { - l.insertValue(e.Value, &l.root) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/streamframe_interval.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/streamframe_interval.go deleted file mode 100644 index ec16d251..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/streamframe_interval.go +++ /dev/null @@ -1,9 +0,0 @@ -package utils - -import "github.com/lucas-clemente/quic-go/internal/protocol" - -// ByteInterval is an interval from one ByteCount to the other -type ByteInterval struct { - Start protocol.ByteCount - End protocol.ByteCount -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/timer.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/timer.go deleted file mode 100644 index 1fefc6ec..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/timer.go +++ /dev/null @@ -1,48 +0,0 @@ -package utils - -import ( - "math" - "time" -) - -// A Timer wrapper that behaves correctly when resetting -type Timer struct { - t *time.Timer - read bool - deadline time.Time -} - -// NewTimer creates a new timer that is not set -func NewTimer() *Timer { - return &Timer{t: time.NewTimer(time.Duration(math.MaxInt64))} -} - -// Chan returns the channel of the wrapped timer -func (t *Timer) Chan() <-chan time.Time { - return t.t.C -} - -// Reset the timer, no matter whether the value was read or not -func (t *Timer) Reset(deadline time.Time) { - if deadline.Equal(t.deadline) && !t.read { - // No need to reset the timer - return - } - - // We need to drain the timer if the value from its channel was not read yet. - // See https://groups.google.com/forum/#!topic/golang-dev/c9UUfASVPoU - if !t.t.Stop() && !t.read { - <-t.t.C - } - if !deadline.IsZero() { - t.t.Reset(time.Until(deadline)) - } - - t.read = false - t.deadline = deadline -} - -// SetRead should be called after the value from the chan was read -func (t *Timer) SetRead() { - t.read = true -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/utils/varint.go b/vendor/github.com/lucas-clemente/quic-go/internal/utils/varint.go deleted file mode 100644 index 35e8674e..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/utils/varint.go +++ /dev/null @@ -1,101 +0,0 @@ -package utils - -import ( - "bytes" - "fmt" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// taken from the QUIC draft -const ( - maxVarInt1 = 63 - maxVarInt2 = 16383 - maxVarInt4 = 1073741823 - maxVarInt8 = 4611686018427387903 -) - -// ReadVarInt reads a number in the QUIC varint format -func ReadVarInt(b io.ByteReader) (uint64, error) { - firstByte, err := b.ReadByte() - if err != nil { - return 0, err - } - // the first two bits of the first byte encode the length - len := 1 << ((firstByte & 0xc0) >> 6) - b1 := firstByte & (0xff - 0xc0) - if len == 1 { - return uint64(b1), nil - } - b2, err := b.ReadByte() - if err != nil { - return 0, err - } - if len == 2 { - return uint64(b2) + uint64(b1)<<8, nil - } - b3, err := b.ReadByte() - if err != nil { - return 0, err - } - b4, err := b.ReadByte() - if err != nil { - return 0, err - } - if len == 4 { - return uint64(b4) + uint64(b3)<<8 + uint64(b2)<<16 + uint64(b1)<<24, nil - } - b5, err := b.ReadByte() - if err != nil { - return 0, err - } - b6, err := b.ReadByte() - if err != nil { - return 0, err - } - b7, err := b.ReadByte() - if err != nil { - return 0, err - } - b8, err := b.ReadByte() - if err != nil { - return 0, err - } - return uint64(b8) + uint64(b7)<<8 + uint64(b6)<<16 + uint64(b5)<<24 + uint64(b4)<<32 + uint64(b3)<<40 + uint64(b2)<<48 + uint64(b1)<<56, nil -} - -// WriteVarInt writes a number in the QUIC varint format -func WriteVarInt(b *bytes.Buffer, i uint64) { - if i <= maxVarInt1 { - b.WriteByte(uint8(i)) - } else if i <= maxVarInt2 { - b.Write([]byte{uint8(i>>8) | 0x40, uint8(i)}) - } else if i <= maxVarInt4 { - b.Write([]byte{uint8(i>>24) | 0x80, uint8(i >> 16), uint8(i >> 8), uint8(i)}) - } else if i <= maxVarInt8 { - b.Write([]byte{ - uint8(i>>56) | 0xc0, uint8(i >> 48), uint8(i >> 40), uint8(i >> 32), - uint8(i >> 24), uint8(i >> 16), uint8(i >> 8), uint8(i), - }) - } else { - panic(fmt.Sprintf("%#x doesn't fit into 62 bits", i)) - } -} - -// VarIntLen determines the number of bytes that will be needed to write a number -func VarIntLen(i uint64) protocol.ByteCount { - if i <= maxVarInt1 { - return 1 - } - if i <= maxVarInt2 { - return 2 - } - if i <= maxVarInt4 { - return 4 - } - if i <= maxVarInt8 { - return 8 - } - panic(fmt.Sprintf("%#x doesn't fit into 62 bits", i)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_frame.go deleted file mode 100644 index 7909bffa..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_frame.go +++ /dev/null @@ -1,226 +0,0 @@ -package wire - -import ( - "bytes" - "errors" - "sort" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -var errInvalidAckRanges = errors.New("AckFrame: ACK frame contains invalid ACK ranges") - -// An AckFrame is an ACK frame -type AckFrame struct { - AckRanges []AckRange // has to be ordered. The highest ACK range goes first, the lowest ACK range goes last - DelayTime time.Duration -} - -// parseAckFrame reads an ACK frame -func parseAckFrame(r *bytes.Reader, ackDelayExponent uint8, version protocol.VersionNumber) (*AckFrame, error) { - typeByte, err := r.ReadByte() - if err != nil { - return nil, err - } - ecn := typeByte&0x1 > 0 - - frame := &AckFrame{} - - la, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - largestAcked := protocol.PacketNumber(la) - delay, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - frame.DelayTime = time.Duration(delay*1< largestAcked { - return nil, errors.New("invalid first ACK range") - } - smallest := largestAcked - ackBlock - - // read all the other ACK ranges - frame.AckRanges = append(frame.AckRanges, AckRange{Smallest: smallest, Largest: largestAcked}) - for i := uint64(0); i < numBlocks; i++ { - g, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - gap := protocol.PacketNumber(g) - if smallest < gap+2 { - return nil, errInvalidAckRanges - } - largest := smallest - gap - 2 - - ab, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - ackBlock := protocol.PacketNumber(ab) - - if ackBlock > largest { - return nil, errInvalidAckRanges - } - smallest = largest - ackBlock - frame.AckRanges = append(frame.AckRanges, AckRange{Smallest: smallest, Largest: largest}) - } - - if !frame.validateAckRanges() { - return nil, errInvalidAckRanges - } - - // parse (and skip) the ECN section - if ecn { - for i := 0; i < 3; i++ { - if _, err := utils.ReadVarInt(r); err != nil { - return nil, err - } - } - } - - return frame, nil -} - -// Write writes an ACK frame. -func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x2) - utils.WriteVarInt(b, uint64(f.LargestAcked())) - utils.WriteVarInt(b, encodeAckDelay(f.DelayTime)) - - numRanges := f.numEncodableAckRanges() - utils.WriteVarInt(b, uint64(numRanges-1)) - - // write the first range - _, firstRange := f.encodeAckRange(0) - utils.WriteVarInt(b, firstRange) - - // write all the other range - for i := 1; i < numRanges; i++ { - gap, len := f.encodeAckRange(i) - utils.WriteVarInt(b, gap) - utils.WriteVarInt(b, len) - } - return nil -} - -// Length of a written frame -func (f *AckFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - largestAcked := f.AckRanges[0].Largest - numRanges := f.numEncodableAckRanges() - - length := 1 + utils.VarIntLen(uint64(largestAcked)) + utils.VarIntLen(encodeAckDelay(f.DelayTime)) - - length += utils.VarIntLen(uint64(numRanges - 1)) - lowestInFirstRange := f.AckRanges[0].Smallest - length += utils.VarIntLen(uint64(largestAcked - lowestInFirstRange)) - - for i := 1; i < numRanges; i++ { - gap, len := f.encodeAckRange(i) - length += utils.VarIntLen(gap) - length += utils.VarIntLen(len) - } - return length -} - -// gets the number of ACK ranges that can be encoded -// such that the resulting frame is smaller than the maximum ACK frame size -func (f *AckFrame) numEncodableAckRanges() int { - length := 1 + utils.VarIntLen(uint64(f.LargestAcked())) + utils.VarIntLen(encodeAckDelay(f.DelayTime)) - length += 2 // assume that the number of ranges will consume 2 bytes - for i := 1; i < len(f.AckRanges); i++ { - gap, len := f.encodeAckRange(i) - rangeLen := utils.VarIntLen(gap) + utils.VarIntLen(len) - if length+rangeLen > protocol.MaxAckFrameSize { - // Writing range i would exceed the MaxAckFrameSize. - // So encode one range less than that. - return i - 1 - } - length += rangeLen - } - return len(f.AckRanges) -} - -func (f *AckFrame) encodeAckRange(i int) (uint64 /* gap */, uint64 /* length */) { - if i == 0 { - return 0, uint64(f.AckRanges[0].Largest - f.AckRanges[0].Smallest) - } - return uint64(f.AckRanges[i-1].Smallest - f.AckRanges[i].Largest - 2), - uint64(f.AckRanges[i].Largest - f.AckRanges[i].Smallest) -} - -// HasMissingRanges returns if this frame reports any missing packets -func (f *AckFrame) HasMissingRanges() bool { - return len(f.AckRanges) > 1 -} - -func (f *AckFrame) validateAckRanges() bool { - if len(f.AckRanges) == 0 { - return false - } - - // check the validity of every single ACK range - for _, ackRange := range f.AckRanges { - if ackRange.Smallest > ackRange.Largest { - return false - } - } - - // check the consistency for ACK with multiple NACK ranges - for i, ackRange := range f.AckRanges { - if i == 0 { - continue - } - lastAckRange := f.AckRanges[i-1] - if lastAckRange.Smallest <= ackRange.Smallest { - return false - } - if lastAckRange.Smallest <= ackRange.Largest+1 { - return false - } - } - - return true -} - -// LargestAcked is the largest acked packet number -func (f *AckFrame) LargestAcked() protocol.PacketNumber { - return f.AckRanges[0].Largest -} - -// LowestAcked is the lowest acked packet number -func (f *AckFrame) LowestAcked() protocol.PacketNumber { - return f.AckRanges[len(f.AckRanges)-1].Smallest -} - -// AcksPacket determines if this ACK frame acks a certain packet number -func (f *AckFrame) AcksPacket(p protocol.PacketNumber) bool { - if p < f.LowestAcked() || p > f.LargestAcked() { - return false - } - - i := sort.Search(len(f.AckRanges), func(i int) bool { - return p >= f.AckRanges[i].Smallest - }) - // i will always be < len(f.AckRanges), since we checked above that p is not bigger than the largest acked - return p <= f.AckRanges[i].Largest -} - -func encodeAckDelay(delay time.Duration) uint64 { - return uint64(delay.Nanoseconds() / (1000 * (1 << protocol.AckDelayExponent))) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_range.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_range.go deleted file mode 100644 index 0f418580..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ack_range.go +++ /dev/null @@ -1,14 +0,0 @@ -package wire - -import "github.com/lucas-clemente/quic-go/internal/protocol" - -// AckRange is an ACK range -type AckRange struct { - Smallest protocol.PacketNumber - Largest protocol.PacketNumber -} - -// Len returns the number of packets contained in this ACK range -func (r AckRange) Len() protocol.PacketNumber { - return r.Largest - r.Smallest + 1 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/connection_close_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/connection_close_frame.go deleted file mode 100644 index 60378a5d..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/connection_close_frame.go +++ /dev/null @@ -1,81 +0,0 @@ -package wire - -import ( - "bytes" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A ConnectionCloseFrame is a CONNECTION_CLOSE frame -type ConnectionCloseFrame struct { - IsApplicationError bool - ErrorCode qerr.ErrorCode - ReasonPhrase string -} - -func parseConnectionCloseFrame(r *bytes.Reader, version protocol.VersionNumber) (*ConnectionCloseFrame, error) { - typeByte, err := r.ReadByte() - if err != nil { - return nil, err - } - - f := &ConnectionCloseFrame{IsApplicationError: typeByte == 0x1d} - ec, err := utils.BigEndian.ReadUint16(r) - if err != nil { - return nil, err - } - f.ErrorCode = qerr.ErrorCode(ec) - // read the Frame Type, if this is not an application error - if !f.IsApplicationError { - if _, err := utils.ReadVarInt(r); err != nil { - return nil, err - } - } - var reasonPhraseLen uint64 - reasonPhraseLen, err = utils.ReadVarInt(r) - if err != nil { - return nil, err - } - // shortcut to prevent the unnecessary allocation of dataLen bytes - // if the dataLen is larger than the remaining length of the packet - // reading the whole reason phrase would result in EOF when attempting to READ - if int(reasonPhraseLen) > r.Len() { - return nil, io.EOF - } - - reasonPhrase := make([]byte, reasonPhraseLen) - if _, err := io.ReadFull(r, reasonPhrase); err != nil { - // this should never happen, since we already checked the reasonPhraseLen earlier - return nil, err - } - f.ReasonPhrase = string(reasonPhrase) - return f, nil -} - -// Length of a written frame -func (f *ConnectionCloseFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - length := 1 + 2 + utils.VarIntLen(uint64(len(f.ReasonPhrase))) + protocol.ByteCount(len(f.ReasonPhrase)) - if !f.IsApplicationError { - length++ // for the frame type - } - return length -} - -func (f *ConnectionCloseFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - if f.IsApplicationError { - b.WriteByte(0x1d) - } else { - b.WriteByte(0x1c) - } - - utils.BigEndian.WriteUint16(b, uint16(f.ErrorCode)) - if !f.IsApplicationError { - utils.WriteVarInt(b, 0) - } - utils.WriteVarInt(b, uint64(len(f.ReasonPhrase))) - b.WriteString(f.ReasonPhrase) - return nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/crypto_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/crypto_frame.go deleted file mode 100644 index eeafea97..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/crypto_frame.go +++ /dev/null @@ -1,71 +0,0 @@ -package wire - -import ( - "bytes" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A CryptoFrame is a CRYPTO frame -type CryptoFrame struct { - Offset protocol.ByteCount - Data []byte -} - -func parseCryptoFrame(r *bytes.Reader, _ protocol.VersionNumber) (*CryptoFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - frame := &CryptoFrame{} - offset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - frame.Offset = protocol.ByteCount(offset) - dataLen, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - if dataLen > uint64(r.Len()) { - return nil, io.EOF - } - if dataLen != 0 { - frame.Data = make([]byte, dataLen) - if _, err := io.ReadFull(r, frame.Data); err != nil { - // this should never happen, since we already checked the dataLen earlier - return nil, err - } - } - return frame, nil -} - -func (f *CryptoFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x6) - utils.WriteVarInt(b, uint64(f.Offset)) - utils.WriteVarInt(b, uint64(len(f.Data))) - b.Write(f.Data) - return nil -} - -// Length of a written frame -func (f *CryptoFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.Offset)) + utils.VarIntLen(uint64(len(f.Data))) + protocol.ByteCount(len(f.Data)) -} - -// MaxDataLen returns the maximum data length -func (f *CryptoFrame) MaxDataLen(maxSize protocol.ByteCount) protocol.ByteCount { - // pretend that the data size will be 1 bytes - // if it turns out that varint encoding the length will consume 2 bytes, we need to adjust the data length afterwards - headerLen := 1 + utils.VarIntLen(uint64(f.Offset)) + 1 - if headerLen > maxSize { - return 0 - } - maxDataLen := maxSize - headerLen - if utils.VarIntLen(uint64(maxDataLen)) != 1 { - maxDataLen-- - } - return maxDataLen -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/data_blocked_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/data_blocked_frame.go deleted file mode 100644 index 91c05ccf..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/data_blocked_frame.go +++ /dev/null @@ -1,38 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A DataBlockedFrame is a DATA_BLOCKED frame -type DataBlockedFrame struct { - DataLimit protocol.ByteCount -} - -func parseDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*DataBlockedFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - offset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - return &DataBlockedFrame{ - DataLimit: protocol.ByteCount(offset), - }, nil -} - -func (f *DataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - typeByte := uint8(0x14) - b.WriteByte(typeByte) - utils.WriteVarInt(b, uint64(f.DataLimit)) - return nil -} - -// Length of a written frame -func (f *DataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.DataLimit)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/extended_header.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/extended_header.go deleted file mode 100644 index 19a0b064..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/extended_header.go +++ /dev/null @@ -1,204 +0,0 @@ -package wire - -import ( - "bytes" - "errors" - "fmt" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// ExtendedHeader is the header of a QUIC packet. -type ExtendedHeader struct { - Header - - typeByte byte - - PacketNumberLen protocol.PacketNumberLen - PacketNumber protocol.PacketNumber - - KeyPhase int -} - -func (h *ExtendedHeader) parse(b *bytes.Reader, v protocol.VersionNumber) (*ExtendedHeader, error) { - // read the (now unencrypted) first byte - var err error - h.typeByte, err = b.ReadByte() - if err != nil { - return nil, err - } - if _, err := b.Seek(int64(h.ParsedLen())-1, io.SeekCurrent); err != nil { - return nil, err - } - if h.IsLongHeader { - return h.parseLongHeader(b, v) - } - return h.parseShortHeader(b, v) -} - -func (h *ExtendedHeader) parseLongHeader(b *bytes.Reader, v protocol.VersionNumber) (*ExtendedHeader, error) { - if h.typeByte&0xc != 0 { - return nil, errors.New("5th and 6th bit must be 0") - } - if err := h.readPacketNumber(b); err != nil { - return nil, err - } - return h, nil -} - -func (h *ExtendedHeader) parseShortHeader(b *bytes.Reader, v protocol.VersionNumber) (*ExtendedHeader, error) { - if h.typeByte&0x18 != 0 { - return nil, errors.New("4th and 5th bit must be 0") - } - - h.KeyPhase = int(h.typeByte&0x4) >> 2 - - if err := h.readPacketNumber(b); err != nil { - return nil, err - } - return h, nil -} - -func (h *ExtendedHeader) readPacketNumber(b *bytes.Reader) error { - h.PacketNumberLen = protocol.PacketNumberLen(h.typeByte&0x3) + 1 - pn, err := utils.BigEndian.ReadUintN(b, uint8(h.PacketNumberLen)) - if err != nil { - return err - } - h.PacketNumber = protocol.PacketNumber(pn) - return nil -} - -// Write writes the Header. -func (h *ExtendedHeader) Write(b *bytes.Buffer, ver protocol.VersionNumber) error { - if h.IsLongHeader { - return h.writeLongHeader(b, ver) - } - return h.writeShortHeader(b, ver) -} - -func (h *ExtendedHeader) writeLongHeader(b *bytes.Buffer, v protocol.VersionNumber) error { - var packetType uint8 - switch h.Type { - case protocol.PacketTypeInitial: - packetType = 0x0 - case protocol.PacketType0RTT: - packetType = 0x1 - case protocol.PacketTypeHandshake: - packetType = 0x2 - case protocol.PacketTypeRetry: - packetType = 0x3 - } - firstByte := 0xc0 | packetType<<4 - if h.Type == protocol.PacketTypeRetry { - odcil, err := encodeSingleConnIDLen(h.OrigDestConnectionID) - if err != nil { - return err - } - firstByte |= odcil - } else { // Retry packets don't have a packet number - firstByte |= uint8(h.PacketNumberLen - 1) - } - - b.WriteByte(firstByte) - utils.BigEndian.WriteUint32(b, uint32(h.Version)) - connIDLen, err := encodeConnIDLen(h.DestConnectionID, h.SrcConnectionID) - if err != nil { - return err - } - b.WriteByte(connIDLen) - b.Write(h.DestConnectionID.Bytes()) - b.Write(h.SrcConnectionID.Bytes()) - - switch h.Type { - case protocol.PacketTypeRetry: - b.Write(h.OrigDestConnectionID.Bytes()) - b.Write(h.Token) - return nil - case protocol.PacketTypeInitial: - utils.WriteVarInt(b, uint64(len(h.Token))) - b.Write(h.Token) - } - - utils.WriteVarInt(b, uint64(h.Length)) - return h.writePacketNumber(b) -} - -// TODO: add support for the key phase -func (h *ExtendedHeader) writeShortHeader(b *bytes.Buffer, v protocol.VersionNumber) error { - typeByte := 0x40 | uint8(h.PacketNumberLen-1) - typeByte |= byte(h.KeyPhase << 2) - - b.WriteByte(typeByte) - b.Write(h.DestConnectionID.Bytes()) - return h.writePacketNumber(b) -} - -func (h *ExtendedHeader) writePacketNumber(b *bytes.Buffer) error { - if h.PacketNumberLen == protocol.PacketNumberLenInvalid || h.PacketNumberLen > protocol.PacketNumberLen4 { - return fmt.Errorf("invalid packet number length: %d", h.PacketNumberLen) - } - utils.BigEndian.WriteUintN(b, uint8(h.PacketNumberLen), uint64(h.PacketNumber)) - return nil -} - -// GetLength determines the length of the Header. -func (h *ExtendedHeader) GetLength(v protocol.VersionNumber) protocol.ByteCount { - if h.IsLongHeader { - length := 1 /* type byte */ + 4 /* version */ + 1 /* conn id len byte */ + protocol.ByteCount(h.DestConnectionID.Len()+h.SrcConnectionID.Len()) + protocol.ByteCount(h.PacketNumberLen) + utils.VarIntLen(uint64(h.Length)) - if h.Type == protocol.PacketTypeInitial { - length += utils.VarIntLen(uint64(len(h.Token))) + protocol.ByteCount(len(h.Token)) - } - return length - } - - length := protocol.ByteCount(1 /* type byte */ + h.DestConnectionID.Len()) - length += protocol.ByteCount(h.PacketNumberLen) - return length -} - -// Log logs the Header -func (h *ExtendedHeader) Log(logger utils.Logger) { - if h.IsLongHeader { - var token string - if h.Type == protocol.PacketTypeInitial || h.Type == protocol.PacketTypeRetry { - if len(h.Token) == 0 { - token = "Token: (empty), " - } else { - token = fmt.Sprintf("Token: %#x, ", h.Token) - } - if h.Type == protocol.PacketTypeRetry { - logger.Debugf("\tLong Header{Type: %s, DestConnectionID: %s, SrcConnectionID: %s, %sOrigDestConnectionID: %s, Version: %s}", h.Type, h.DestConnectionID, h.SrcConnectionID, token, h.OrigDestConnectionID, h.Version) - return - } - } - logger.Debugf("\tLong Header{Type: %s, DestConnectionID: %s, SrcConnectionID: %s, %sPacketNumber: %#x, PacketNumberLen: %d, Length: %d, Version: %s}", h.Type, h.DestConnectionID, h.SrcConnectionID, token, h.PacketNumber, h.PacketNumberLen, h.Length, h.Version) - } else { - logger.Debugf("\tShort Header{DestConnectionID: %s, PacketNumber: %#x, PacketNumberLen: %d, KeyPhase: %d}", h.DestConnectionID, h.PacketNumber, h.PacketNumberLen, h.KeyPhase) - } -} - -func encodeConnIDLen(dest, src protocol.ConnectionID) (byte, error) { - dcil, err := encodeSingleConnIDLen(dest) - if err != nil { - return 0, err - } - scil, err := encodeSingleConnIDLen(src) - if err != nil { - return 0, err - } - return scil | dcil<<4, nil -} - -func encodeSingleConnIDLen(id protocol.ConnectionID) (byte, error) { - len := id.Len() - if len == 0 { - return 0, nil - } - if len < 4 || len > 18 { - return 0, fmt.Errorf("invalid connection ID length: %d bytes", len) - } - return byte(len - 3), nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/frame_parser.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/frame_parser.go deleted file mode 100644 index e9d3d6a5..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/frame_parser.go +++ /dev/null @@ -1,97 +0,0 @@ -package wire - -import ( - "bytes" - "fmt" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" -) - -type frameParser struct { - ackDelayExponent uint8 - - version protocol.VersionNumber -} - -// NewFrameParser creates a new frame parser. -func NewFrameParser(v protocol.VersionNumber) FrameParser { - return &frameParser{version: v} -} - -// ParseNextFrame parses the next frame -// It skips PADDING frames. -func (p *frameParser) ParseNext(r *bytes.Reader, encLevel protocol.EncryptionLevel) (Frame, error) { - for r.Len() != 0 { - typeByte, _ := r.ReadByte() - if typeByte == 0x0 { // PADDING frame - continue - } - r.UnreadByte() - - return p.parseFrame(r, typeByte, encLevel) - } - return nil, nil -} - -func (p *frameParser) parseFrame(r *bytes.Reader, typeByte byte, encLevel protocol.EncryptionLevel) (Frame, error) { - var frame Frame - var err error - if typeByte&0xf8 == 0x8 { - frame, err = parseStreamFrame(r, p.version) - if err != nil { - return nil, qerr.Error(qerr.FrameEncodingError, err.Error()) - } - return frame, nil - } - switch typeByte { - case 0x1: - frame, err = parsePingFrame(r, p.version) - case 0x2, 0x3: - ackDelayExponent := p.ackDelayExponent - if encLevel != protocol.Encryption1RTT { - ackDelayExponent = protocol.DefaultAckDelayExponent - } - frame, err = parseAckFrame(r, ackDelayExponent, p.version) - case 0x4: - frame, err = parseResetStreamFrame(r, p.version) - case 0x5: - frame, err = parseStopSendingFrame(r, p.version) - case 0x6: - frame, err = parseCryptoFrame(r, p.version) - case 0x7: - frame, err = parseNewTokenFrame(r, p.version) - case 0x10: - frame, err = parseMaxDataFrame(r, p.version) - case 0x11: - frame, err = parseMaxStreamDataFrame(r, p.version) - case 0x12, 0x13: - frame, err = parseMaxStreamsFrame(r, p.version) - case 0x14: - frame, err = parseDataBlockedFrame(r, p.version) - case 0x15: - frame, err = parseStreamDataBlockedFrame(r, p.version) - case 0x16, 0x17: - frame, err = parseStreamsBlockedFrame(r, p.version) - case 0x18: - frame, err = parseNewConnectionIDFrame(r, p.version) - case 0x19: - frame, err = parseRetireConnectionIDFrame(r, p.version) - case 0x1a: - frame, err = parsePathChallengeFrame(r, p.version) - case 0x1b: - frame, err = parsePathResponseFrame(r, p.version) - case 0x1c, 0x1d: - frame, err = parseConnectionCloseFrame(r, p.version) - default: - err = fmt.Errorf("unknown type byte 0x%x", typeByte) - } - if err != nil { - return nil, qerr.Error(qerr.FrameEncodingError, err.Error()) - } - return frame, nil -} - -func (p *frameParser) SetAckDelayExponent(exp uint8) { - p.ackDelayExponent = exp -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go deleted file mode 100644 index 21eb784c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go +++ /dev/null @@ -1,251 +0,0 @@ -package wire - -import ( - "bytes" - "errors" - "fmt" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// ParseConnectionID parses the destination connection ID of a packet. -// It uses the data slice for the connection ID. -// That means that the connection ID must not be used after the packet buffer is released. -func ParseConnectionID(data []byte, shortHeaderConnIDLen int) (protocol.ConnectionID, error) { - if len(data) == 0 { - return nil, io.EOF - } - isLongHeader := data[0]&0x80 > 0 - if !isLongHeader { - if len(data) < shortHeaderConnIDLen+1 { - return nil, io.EOF - } - return protocol.ConnectionID(data[1 : 1+shortHeaderConnIDLen]), nil - } - if len(data) < 6 { - return nil, io.EOF - } - destConnIDLen, _ := decodeConnIDLen(data[5]) - if len(data) < 6+destConnIDLen { - return nil, io.EOF - } - return protocol.ConnectionID(data[6 : 6+destConnIDLen]), nil -} - -// IsVersionNegotiationPacket says if this is a version negotiation packet -func IsVersionNegotiationPacket(b []byte) bool { - if len(b) < 5 { - return false - } - return b[0]&0x80 > 0 && b[1] == 0 && b[2] == 0 && b[3] == 0 && b[4] == 0 -} - -var errUnsupportedVersion = errors.New("unsupported version") - -// The Header is the version independent part of the header -type Header struct { - Version protocol.VersionNumber - SrcConnectionID protocol.ConnectionID - DestConnectionID protocol.ConnectionID - - IsLongHeader bool - Type protocol.PacketType - Length protocol.ByteCount - - Token []byte - SupportedVersions []protocol.VersionNumber // sent in a Version Negotiation Packet - OrigDestConnectionID protocol.ConnectionID // sent in the Retry packet - - typeByte byte - parsedLen protocol.ByteCount // how many bytes were read while parsing this header -} - -// ParsePacket parses a packet. -// If the packet has a long header, the packet is cut according to the length field. -// If we understand the version, the packet is header up unto the packet number. -// Otherwise, only the invariant part of the header is parsed. -func ParsePacket(data []byte, shortHeaderConnIDLen int) (*Header, []byte /* packet data */, []byte /* rest */, error) { - hdr, err := parseHeader(bytes.NewReader(data), shortHeaderConnIDLen) - if err != nil { - if err == errUnsupportedVersion { - return hdr, nil, nil, nil - } - return nil, nil, nil, err - } - var rest []byte - if hdr.IsLongHeader { - if protocol.ByteCount(len(data)) < hdr.ParsedLen()+hdr.Length { - return nil, nil, nil, fmt.Errorf("packet length (%d bytes) is smaller than the expected length (%d bytes)", len(data)-int(hdr.ParsedLen()), hdr.Length) - } - packetLen := int(hdr.ParsedLen() + hdr.Length) - rest = data[packetLen:] - data = data[:packetLen] - } - return hdr, data, rest, nil -} - -// ParseHeader parses the header. -// For short header packets: up to the packet number. -// For long header packets: -// * if we understand the version: up to the packet number -// * if not, only the invariant part of the header -func parseHeader(b *bytes.Reader, shortHeaderConnIDLen int) (*Header, error) { - startLen := b.Len() - h, err := parseHeaderImpl(b, shortHeaderConnIDLen) - if err != nil { - return h, err - } - h.parsedLen = protocol.ByteCount(startLen - b.Len()) - return h, err -} - -func parseHeaderImpl(b *bytes.Reader, shortHeaderConnIDLen int) (*Header, error) { - typeByte, err := b.ReadByte() - if err != nil { - return nil, err - } - - h := &Header{ - typeByte: typeByte, - IsLongHeader: typeByte&0x80 > 0, - } - - if !h.IsLongHeader { - if h.typeByte&0x40 == 0 { - return nil, errors.New("not a QUIC packet") - } - if err := h.parseShortHeader(b, shortHeaderConnIDLen); err != nil { - return nil, err - } - return h, nil - } - return h, h.parseLongHeader(b) -} - -func (h *Header) parseShortHeader(b *bytes.Reader, shortHeaderConnIDLen int) error { - var err error - h.DestConnectionID, err = protocol.ReadConnectionID(b, shortHeaderConnIDLen) - return err -} - -func (h *Header) parseLongHeader(b *bytes.Reader) error { - v, err := utils.BigEndian.ReadUint32(b) - if err != nil { - return err - } - h.Version = protocol.VersionNumber(v) - if h.Version != 0 && h.typeByte&0x40 == 0 { - return errors.New("not a QUIC packet") - } - connIDLenByte, err := b.ReadByte() - if err != nil { - return err - } - dcil, scil := decodeConnIDLen(connIDLenByte) - h.DestConnectionID, err = protocol.ReadConnectionID(b, dcil) - if err != nil { - return err - } - h.SrcConnectionID, err = protocol.ReadConnectionID(b, scil) - if err != nil { - return err - } - if h.Version == 0 { - return h.parseVersionNegotiationPacket(b) - } - // If we don't understand the version, we have no idea how to interpret the rest of the bytes - if !protocol.IsSupportedVersion(protocol.SupportedVersions, h.Version) { - return errUnsupportedVersion - } - - switch (h.typeByte & 0x30) >> 4 { - case 0x0: - h.Type = protocol.PacketTypeInitial - case 0x1: - h.Type = protocol.PacketType0RTT - case 0x2: - h.Type = protocol.PacketTypeHandshake - case 0x3: - h.Type = protocol.PacketTypeRetry - } - - if h.Type == protocol.PacketTypeRetry { - odcil := decodeSingleConnIDLen(h.typeByte & 0xf) - h.OrigDestConnectionID, err = protocol.ReadConnectionID(b, odcil) - if err != nil { - return err - } - h.Token = make([]byte, b.Len()) - if _, err := io.ReadFull(b, h.Token); err != nil { - return err - } - return nil - } - - if h.Type == protocol.PacketTypeInitial { - tokenLen, err := utils.ReadVarInt(b) - if err != nil { - return err - } - if tokenLen > uint64(b.Len()) { - return io.EOF - } - h.Token = make([]byte, tokenLen) - if _, err := io.ReadFull(b, h.Token); err != nil { - return err - } - } - - pl, err := utils.ReadVarInt(b) - if err != nil { - return err - } - h.Length = protocol.ByteCount(pl) - return nil -} - -func (h *Header) parseVersionNegotiationPacket(b *bytes.Reader) error { - if b.Len() == 0 { - return errors.New("Version Negoation packet has empty version list") - } - if b.Len()%4 != 0 { - return errors.New("Version Negotation packet has a version list with an invalid length") - } - h.SupportedVersions = make([]protocol.VersionNumber, b.Len()/4) - for i := 0; b.Len() > 0; i++ { - v, err := utils.BigEndian.ReadUint32(b) - if err != nil { - return err - } - h.SupportedVersions[i] = protocol.VersionNumber(v) - } - return nil -} - -// ParsedLen returns the number of bytes that were consumed when parsing the header -func (h *Header) ParsedLen() protocol.ByteCount { - return h.parsedLen -} - -// ParseExtended parses the version dependent part of the header. -// The Reader has to be set such that it points to the first byte of the header. -func (h *Header) ParseExtended(b *bytes.Reader, ver protocol.VersionNumber) (*ExtendedHeader, error) { - return h.toExtendedHeader().parse(b, ver) -} - -func (h *Header) toExtendedHeader() *ExtendedHeader { - return &ExtendedHeader{Header: *h} -} - -func decodeConnIDLen(enc byte) (int /*dest conn id len*/, int /*src conn id len*/) { - return decodeSingleConnIDLen(enc >> 4), decodeSingleConnIDLen(enc & 0xf) -} - -func decodeSingleConnIDLen(enc uint8) int { - if enc == 0 { - return 0 - } - return int(enc) + 3 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/interface.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/interface.go deleted file mode 100644 index 99fdc80f..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/interface.go +++ /dev/null @@ -1,19 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A Frame in QUIC -type Frame interface { - Write(b *bytes.Buffer, version protocol.VersionNumber) error - Length(version protocol.VersionNumber) protocol.ByteCount -} - -// A FrameParser parses QUIC frames, one by one. -type FrameParser interface { - ParseNext(*bytes.Reader, protocol.EncryptionLevel) (Frame, error) - SetAckDelayExponent(uint8) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/log.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/log.go deleted file mode 100644 index 3c56ac45..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/log.go +++ /dev/null @@ -1,43 +0,0 @@ -package wire - -import ( - "fmt" - "strings" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// LogFrame logs a frame, either sent or received -func LogFrame(logger utils.Logger, frame Frame, sent bool) { - if !logger.Debug() { - return - } - dir := "<-" - if sent { - dir = "->" - } - switch f := frame.(type) { - case *CryptoFrame: - dataLen := protocol.ByteCount(len(f.Data)) - logger.Debugf("\t%s &wire.CryptoFrame{Offset: 0x%x, Data length: 0x%x, Offset + Data length: 0x%x}", dir, f.Offset, dataLen, f.Offset+dataLen) - case *StreamFrame: - logger.Debugf("\t%s &wire.StreamFrame{StreamID: %d, FinBit: %t, Offset: 0x%x, Data length: 0x%x, Offset + Data length: 0x%x}", dir, f.StreamID, f.FinBit, f.Offset, f.DataLen(), f.Offset+f.DataLen()) - case *AckFrame: - if len(f.AckRanges) > 1 { - ackRanges := make([]string, len(f.AckRanges)) - for i, r := range f.AckRanges { - ackRanges[i] = fmt.Sprintf("{Largest: %#x, Smallest: %#x}", r.Largest, r.Smallest) - } - logger.Debugf("\t%s &wire.AckFrame{LargestAcked: %#x, LowestAcked: %#x, AckRanges: {%s}, DelayTime: %s}", dir, f.LargestAcked(), f.LowestAcked(), strings.Join(ackRanges, ", "), f.DelayTime.String()) - } else { - logger.Debugf("\t%s &wire.AckFrame{LargestAcked: %#x, LowestAcked: %#x, DelayTime: %s}", dir, f.LargestAcked(), f.LowestAcked(), f.DelayTime.String()) - } - case *NewConnectionIDFrame: - logger.Debugf("\t%s &wire.NewConnectionIDFrame{SequenceNumber: %d, ConnectionID: %s, StatelessResetToken: %#x}", dir, f.SequenceNumber, f.ConnectionID, f.StatelessResetToken) - case *NewTokenFrame: - logger.Debugf("\t%s &wire.NewTokenFrame{Token: %#x}", dir, f.Token) - default: - logger.Debugf("\t%s %#v", dir, frame) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_data_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_data_frame.go deleted file mode 100644 index c4a9be0d..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_data_frame.go +++ /dev/null @@ -1,40 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A MaxDataFrame carries flow control information for the connection -type MaxDataFrame struct { - ByteOffset protocol.ByteCount -} - -// parseMaxDataFrame parses a MAX_DATA frame -func parseMaxDataFrame(r *bytes.Reader, version protocol.VersionNumber) (*MaxDataFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - frame := &MaxDataFrame{} - byteOffset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - frame.ByteOffset = protocol.ByteCount(byteOffset) - return frame, nil -} - -//Write writes a MAX_STREAM_DATA frame -func (f *MaxDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x10) - utils.WriteVarInt(b, uint64(f.ByteOffset)) - return nil -} - -// Length of a written frame -func (f *MaxDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.ByteOffset)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_stream_data_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_stream_data_frame.go deleted file mode 100644 index 2566f1c9..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_stream_data_frame.go +++ /dev/null @@ -1,46 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A MaxStreamDataFrame is a MAX_STREAM_DATA frame -type MaxStreamDataFrame struct { - StreamID protocol.StreamID - ByteOffset protocol.ByteCount -} - -func parseMaxStreamDataFrame(r *bytes.Reader, version protocol.VersionNumber) (*MaxStreamDataFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - sid, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - offset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - - return &MaxStreamDataFrame{ - StreamID: protocol.StreamID(sid), - ByteOffset: protocol.ByteCount(offset), - }, nil -} - -func (f *MaxStreamDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x11) - utils.WriteVarInt(b, uint64(f.StreamID)) - utils.WriteVarInt(b, uint64(f.ByteOffset)) - return nil -} - -// Length of a written frame -func (f *MaxStreamDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.StreamID)) + utils.VarIntLen(uint64(f.ByteOffset)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_streams_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_streams_frame.go deleted file mode 100644 index c7a3cd41..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/max_streams_frame.go +++ /dev/null @@ -1,51 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A MaxStreamsFrame is a MAX_STREAMS frame -type MaxStreamsFrame struct { - Type protocol.StreamType - MaxStreams uint64 -} - -func parseMaxStreamsFrame(r *bytes.Reader, _ protocol.VersionNumber) (*MaxStreamsFrame, error) { - typeByte, err := r.ReadByte() - if err != nil { - return nil, err - } - - f := &MaxStreamsFrame{} - switch typeByte { - case 0x12: - f.Type = protocol.StreamTypeBidi - case 0x13: - f.Type = protocol.StreamTypeUni - } - streamID, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - f.MaxStreams = streamID - return f, nil -} - -func (f *MaxStreamsFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - switch f.Type { - case protocol.StreamTypeBidi: - b.WriteByte(0x12) - case protocol.StreamTypeUni: - b.WriteByte(0x13) - } - utils.WriteVarInt(b, f.MaxStreams) - return nil -} - -// Length of a written frame -func (f *MaxStreamsFrame) Length(protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(f.MaxStreams) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_connection_id_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_connection_id_frame.go deleted file mode 100644 index 9a612aa6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_connection_id_frame.go +++ /dev/null @@ -1,70 +0,0 @@ -package wire - -import ( - "bytes" - "fmt" - "io" - - "github.com/lucas-clemente/quic-go/internal/utils" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A NewConnectionIDFrame is a NEW_CONNECTION_ID frame -type NewConnectionIDFrame struct { - SequenceNumber uint64 - ConnectionID protocol.ConnectionID - StatelessResetToken [16]byte -} - -func parseNewConnectionIDFrame(r *bytes.Reader, _ protocol.VersionNumber) (*NewConnectionIDFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - seq, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - connIDLen, err := r.ReadByte() - if err != nil { - return nil, err - } - if connIDLen < 4 || connIDLen > 18 { - return nil, fmt.Errorf("invalid connection ID length: %d", connIDLen) - } - connID, err := protocol.ReadConnectionID(r, int(connIDLen)) - if err != nil { - return nil, err - } - frame := &NewConnectionIDFrame{ - SequenceNumber: seq, - ConnectionID: connID, - } - if _, err := io.ReadFull(r, frame.StatelessResetToken[:]); err != nil { - if err == io.ErrUnexpectedEOF { - return nil, io.EOF - } - return nil, err - } - - return frame, nil -} - -func (f *NewConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x18) - utils.WriteVarInt(b, f.SequenceNumber) - connIDLen := f.ConnectionID.Len() - if connIDLen < 4 || connIDLen > 18 { - return fmt.Errorf("invalid connection ID length: %d", connIDLen) - } - b.WriteByte(uint8(connIDLen)) - b.Write(f.ConnectionID.Bytes()) - b.Write(f.StatelessResetToken[:]) - return nil -} - -// Length of a written frame -func (f *NewConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(f.SequenceNumber) + 1 /* connection ID length */ + protocol.ByteCount(f.ConnectionID.Len()) + 16 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_token_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_token_frame.go deleted file mode 100644 index 2cf6fce5..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/new_token_frame.go +++ /dev/null @@ -1,44 +0,0 @@ -package wire - -import ( - "bytes" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A NewTokenFrame is a NEW_TOKEN frame -type NewTokenFrame struct { - Token []byte -} - -func parseNewTokenFrame(r *bytes.Reader, _ protocol.VersionNumber) (*NewTokenFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - tokenLen, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - if uint64(r.Len()) < tokenLen { - return nil, io.EOF - } - token := make([]byte, int(tokenLen)) - if _, err := io.ReadFull(r, token); err != nil { - return nil, err - } - return &NewTokenFrame{Token: token}, nil -} - -func (f *NewTokenFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x7) - utils.WriteVarInt(b, uint64(len(f.Token))) - b.Write(f.Token) - return nil -} - -// Length of a written frame -func (f *NewTokenFrame) Length(protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(len(f.Token))) + protocol.ByteCount(len(f.Token)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_challenge_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_challenge_frame.go deleted file mode 100644 index d35ee3b5..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_challenge_frame.go +++ /dev/null @@ -1,38 +0,0 @@ -package wire - -import ( - "bytes" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A PathChallengeFrame is a PATH_CHALLENGE frame -type PathChallengeFrame struct { - Data [8]byte -} - -func parsePathChallengeFrame(r *bytes.Reader, version protocol.VersionNumber) (*PathChallengeFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - frame := &PathChallengeFrame{} - if _, err := io.ReadFull(r, frame.Data[:]); err != nil { - if err == io.ErrUnexpectedEOF { - return nil, io.EOF - } - return nil, err - } - return frame, nil -} - -func (f *PathChallengeFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x1a) - b.Write(f.Data[:]) - return nil -} - -// Length of a written frame -func (f *PathChallengeFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { - return 1 + 8 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_response_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_response_frame.go deleted file mode 100644 index 20d8fd72..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/path_response_frame.go +++ /dev/null @@ -1,38 +0,0 @@ -package wire - -import ( - "bytes" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A PathResponseFrame is a PATH_RESPONSE frame -type PathResponseFrame struct { - Data [8]byte -} - -func parsePathResponseFrame(r *bytes.Reader, version protocol.VersionNumber) (*PathResponseFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - frame := &PathResponseFrame{} - if _, err := io.ReadFull(r, frame.Data[:]); err != nil { - if err == io.ErrUnexpectedEOF { - return nil, io.EOF - } - return nil, err - } - return frame, nil -} - -func (f *PathResponseFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x1b) - b.Write(f.Data[:]) - return nil -} - -// Length of a written frame -func (f *PathResponseFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { - return 1 + 8 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go deleted file mode 100644 index aed6857b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go +++ /dev/null @@ -1,27 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// A PingFrame is a PING frame -type PingFrame struct{} - -func parsePingFrame(r *bytes.Reader, version protocol.VersionNumber) (*PingFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - return &PingFrame{}, nil -} - -func (f *PingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x1) - return nil -} - -// Length of a written frame -func (f *PingFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/reset_stream_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/reset_stream_frame.go deleted file mode 100644 index d3a40dcf..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/reset_stream_frame.go +++ /dev/null @@ -1,58 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A ResetStreamFrame is a RESET_STREAM frame in QUIC -type ResetStreamFrame struct { - StreamID protocol.StreamID - ErrorCode protocol.ApplicationErrorCode - ByteOffset protocol.ByteCount -} - -func parseResetStreamFrame(r *bytes.Reader, version protocol.VersionNumber) (*ResetStreamFrame, error) { - if _, err := r.ReadByte(); err != nil { // read the TypeByte - return nil, err - } - - var streamID protocol.StreamID - var errorCode uint16 - var byteOffset protocol.ByteCount - sid, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - streamID = protocol.StreamID(sid) - errorCode, err = utils.BigEndian.ReadUint16(r) - if err != nil { - return nil, err - } - bo, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - byteOffset = protocol.ByteCount(bo) - - return &ResetStreamFrame{ - StreamID: streamID, - ErrorCode: protocol.ApplicationErrorCode(errorCode), - ByteOffset: byteOffset, - }, nil -} - -func (f *ResetStreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x4) - utils.WriteVarInt(b, uint64(f.StreamID)) - utils.BigEndian.WriteUint16(b, uint16(f.ErrorCode)) - utils.WriteVarInt(b, uint64(f.ByteOffset)) - return nil -} - -// Length of a written frame -func (f *ResetStreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.StreamID)) + 2 + utils.VarIntLen(uint64(f.ByteOffset)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/retire_connection_id_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/retire_connection_id_frame.go deleted file mode 100644 index 9a715a4c..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/retire_connection_id_frame.go +++ /dev/null @@ -1,36 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame -type RetireConnectionIDFrame struct { - SequenceNumber uint64 -} - -func parseRetireConnectionIDFrame(r *bytes.Reader, _ protocol.VersionNumber) (*RetireConnectionIDFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - seq, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - return &RetireConnectionIDFrame{SequenceNumber: seq}, nil -} - -func (f *RetireConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x19) - utils.WriteVarInt(b, f.SequenceNumber) - return nil -} - -// Length of a written frame -func (f *RetireConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(f.SequenceNumber) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stop_sending_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/stop_sending_frame.go deleted file mode 100644 index f9a5d60b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stop_sending_frame.go +++ /dev/null @@ -1,47 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A StopSendingFrame is a STOP_SENDING frame -type StopSendingFrame struct { - StreamID protocol.StreamID - ErrorCode protocol.ApplicationErrorCode -} - -// parseStopSendingFrame parses a STOP_SENDING frame -func parseStopSendingFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StopSendingFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - streamID, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - errorCode, err := utils.BigEndian.ReadUint16(r) - if err != nil { - return nil, err - } - - return &StopSendingFrame{ - StreamID: protocol.StreamID(streamID), - ErrorCode: protocol.ApplicationErrorCode(errorCode), - }, nil -} - -// Length of a written frame -func (f *StopSendingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.StreamID)) + 2 -} - -func (f *StopSendingFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - b.WriteByte(0x5) - utils.WriteVarInt(b, uint64(f.StreamID)) - utils.BigEndian.WriteUint16(b, uint16(f.ErrorCode)) - return nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_data_blocked_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_data_blocked_frame.go deleted file mode 100644 index 9f2e90be..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_data_blocked_frame.go +++ /dev/null @@ -1,46 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame -type StreamDataBlockedFrame struct { - StreamID protocol.StreamID - DataLimit protocol.ByteCount -} - -func parseStreamDataBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamDataBlockedFrame, error) { - if _, err := r.ReadByte(); err != nil { - return nil, err - } - - sid, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - offset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - - return &StreamDataBlockedFrame{ - StreamID: protocol.StreamID(sid), - DataLimit: protocol.ByteCount(offset), - }, nil -} - -func (f *StreamDataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - b.WriteByte(0x15) - utils.WriteVarInt(b, uint64(f.StreamID)) - utils.WriteVarInt(b, uint64(f.DataLimit)) - return nil -} - -// Length of a written frame -func (f *StreamDataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(uint64(f.StreamID)) + utils.VarIntLen(uint64(f.DataLimit)) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_frame.go deleted file mode 100644 index dfc1d1ad..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/stream_frame.go +++ /dev/null @@ -1,168 +0,0 @@ -package wire - -import ( - "bytes" - "errors" - "io" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A StreamFrame of QUIC -type StreamFrame struct { - StreamID protocol.StreamID - FinBit bool - DataLenPresent bool - Offset protocol.ByteCount - Data []byte -} - -func parseStreamFrame(r *bytes.Reader, version protocol.VersionNumber) (*StreamFrame, error) { - typeByte, err := r.ReadByte() - if err != nil { - return nil, err - } - - hasOffset := typeByte&0x4 > 0 - frame := &StreamFrame{ - FinBit: typeByte&0x1 > 0, - DataLenPresent: typeByte&0x2 > 0, - } - - streamID, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - frame.StreamID = protocol.StreamID(streamID) - if hasOffset { - offset, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - frame.Offset = protocol.ByteCount(offset) - } - - var dataLen uint64 - if frame.DataLenPresent { - var err error - dataLen, err = utils.ReadVarInt(r) - if err != nil { - return nil, err - } - // shortcut to prevent the unnecessary allocation of dataLen bytes - // if the dataLen is larger than the remaining length of the packet - // reading the packet contents would result in EOF when attempting to READ - if dataLen > uint64(r.Len()) { - return nil, io.EOF - } - } else { - // The rest of the packet is data - dataLen = uint64(r.Len()) - } - if dataLen != 0 { - frame.Data = make([]byte, dataLen) - if _, err := io.ReadFull(r, frame.Data); err != nil { - // this should never happen, since we already checked the dataLen earlier - return nil, err - } - } - if frame.Offset+frame.DataLen() > protocol.MaxByteCount { - return nil, qerr.Error(qerr.FrameEncodingError, "stream data overflows maximum offset") - } - return frame, nil -} - -// Write writes a STREAM frame -func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error { - if len(f.Data) == 0 && !f.FinBit { - return errors.New("StreamFrame: attempting to write empty frame without FIN") - } - - typeByte := byte(0x8) - if f.FinBit { - typeByte ^= 0x1 - } - hasOffset := f.Offset != 0 - if f.DataLenPresent { - typeByte ^= 0x2 - } - if hasOffset { - typeByte ^= 0x4 - } - b.WriteByte(typeByte) - utils.WriteVarInt(b, uint64(f.StreamID)) - if hasOffset { - utils.WriteVarInt(b, uint64(f.Offset)) - } - if f.DataLenPresent { - utils.WriteVarInt(b, uint64(f.DataLen())) - } - b.Write(f.Data) - return nil -} - -// Length returns the total length of the STREAM frame -func (f *StreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount { - length := 1 + utils.VarIntLen(uint64(f.StreamID)) - if f.Offset != 0 { - length += utils.VarIntLen(uint64(f.Offset)) - } - if f.DataLenPresent { - length += utils.VarIntLen(uint64(f.DataLen())) - } - return length + f.DataLen() -} - -// DataLen gives the length of data in bytes -func (f *StreamFrame) DataLen() protocol.ByteCount { - return protocol.ByteCount(len(f.Data)) -} - -// MaxDataLen returns the maximum data length -// If 0 is returned, writing will fail (a STREAM frame must contain at least 1 byte of data). -func (f *StreamFrame) MaxDataLen(maxSize protocol.ByteCount, version protocol.VersionNumber) protocol.ByteCount { - headerLen := 1 + utils.VarIntLen(uint64(f.StreamID)) - if f.Offset != 0 { - headerLen += utils.VarIntLen(uint64(f.Offset)) - } - if f.DataLenPresent { - // pretend that the data size will be 1 bytes - // if it turns out that varint encoding the length will consume 2 bytes, we need to adjust the data length afterwards - headerLen++ - } - if headerLen > maxSize { - return 0 - } - maxDataLen := maxSize - headerLen - if f.DataLenPresent && utils.VarIntLen(uint64(maxDataLen)) != 1 { - maxDataLen-- - } - return maxDataLen -} - -// MaybeSplitOffFrame splits a frame such that it is not bigger than n bytes. -// If n >= len(frame), nil is returned and nothing is modified. -func (f *StreamFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.VersionNumber) (*StreamFrame, error) { - if maxSize >= f.Length(version) { - return nil, nil - } - - n := f.MaxDataLen(maxSize, version) - if n == 0 { - return nil, errors.New("too small") - } - newFrame := &StreamFrame{ - FinBit: false, - StreamID: f.StreamID, - Offset: f.Offset, - Data: f.Data[:n], - DataLenPresent: f.DataLenPresent, - } - - f.Data = f.Data[n:] - f.Offset += n - - return newFrame, nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/streams_blocked_frame.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/streams_blocked_frame.go deleted file mode 100644 index b41d68f1..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/streams_blocked_frame.go +++ /dev/null @@ -1,52 +0,0 @@ -package wire - -import ( - "bytes" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// A StreamsBlockedFrame is a STREAMS_BLOCKED frame -type StreamsBlockedFrame struct { - Type protocol.StreamType - StreamLimit uint64 -} - -func parseStreamsBlockedFrame(r *bytes.Reader, _ protocol.VersionNumber) (*StreamsBlockedFrame, error) { - typeByte, err := r.ReadByte() - if err != nil { - return nil, err - } - - f := &StreamsBlockedFrame{} - switch typeByte { - case 0x16: - f.Type = protocol.StreamTypeBidi - case 0x17: - f.Type = protocol.StreamTypeUni - } - streamLimit, err := utils.ReadVarInt(r) - if err != nil { - return nil, err - } - f.StreamLimit = streamLimit - - return f, nil -} - -func (f *StreamsBlockedFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error { - switch f.Type { - case protocol.StreamTypeBidi: - b.WriteByte(0x16) - case protocol.StreamTypeUni: - b.WriteByte(0x17) - } - utils.WriteVarInt(b, f.StreamLimit) - return nil -} - -// Length of a written frame -func (f *StreamsBlockedFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { - return 1 + utils.VarIntLen(f.StreamLimit) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/internal/wire/version_negotiation.go b/vendor/github.com/lucas-clemente/quic-go/internal/wire/version_negotiation.go deleted file mode 100644 index bfc27af7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/internal/wire/version_negotiation.go +++ /dev/null @@ -1,31 +0,0 @@ -package wire - -import ( - "bytes" - "crypto/rand" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" -) - -// ComposeVersionNegotiation composes a Version Negotiation -func ComposeVersionNegotiation(destConnID, srcConnID protocol.ConnectionID, versions []protocol.VersionNumber) ([]byte, error) { - greasedVersions := protocol.GetGreasedVersions(versions) - expectedLen := 1 /* type byte */ + 4 /* version field */ + 1 /* connection ID length field */ + destConnID.Len() + srcConnID.Len() + len(greasedVersions)*4 - buf := bytes.NewBuffer(make([]byte, 0, expectedLen)) - r := make([]byte, 1) - _, _ = rand.Read(r) // ignore the error here. It is not critical to have perfect random here. - buf.WriteByte(r[0] | 0xc0) - utils.BigEndian.WriteUint32(buf, 0) // version 0 - connIDLen, err := encodeConnIDLen(destConnID, srcConnID) - if err != nil { - return nil, err - } - buf.WriteByte(connIDLen) - buf.Write(destConnID) - buf.Write(srcConnID) - for _, v := range greasedVersions { - utils.BigEndian.WriteUint32(buf, uint32(v)) - } - return buf.Bytes(), nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/mockgen.go b/vendor/github.com/lucas-clemente/quic-go/mockgen.go deleted file mode 100644 index 1a882c35..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/mockgen.go +++ /dev/null @@ -1,21 +0,0 @@ -package quic - -//go:generate sh -c "./mockgen_private.sh quic mock_stream_internal_test.go github.com/lucas-clemente/quic-go streamI" -//go:generate sh -c "./mockgen_private.sh quic mock_crypto_stream_test.go github.com/lucas-clemente/quic-go cryptoStream" -//go:generate sh -c "./mockgen_private.sh quic mock_receive_stream_internal_test.go github.com/lucas-clemente/quic-go receiveStreamI" -//go:generate sh -c "./mockgen_private.sh quic mock_send_stream_internal_test.go github.com/lucas-clemente/quic-go sendStreamI" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_sender_test.go github.com/lucas-clemente/quic-go streamSender" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_getter_test.go github.com/lucas-clemente/quic-go streamGetter" -//go:generate sh -c "./mockgen_private.sh quic mock_crypto_data_handler_test.go github.com/lucas-clemente/quic-go cryptoDataHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_frame_source_test.go github.com/lucas-clemente/quic-go frameSource" -//go:generate sh -c "./mockgen_private.sh quic mock_ack_frame_source_test.go github.com/lucas-clemente/quic-go ackFrameSource" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_manager_test.go github.com/lucas-clemente/quic-go streamManager" -//go:generate sh -c "./mockgen_private.sh quic mock_sealing_manager_test.go github.com/lucas-clemente/quic-go sealingManager" -//go:generate sh -c "./mockgen_private.sh quic mock_unpacker_test.go github.com/lucas-clemente/quic-go unpacker" -//go:generate sh -c "./mockgen_private.sh quic mock_packer_test.go github.com/lucas-clemente/quic-go packer" -//go:generate sh -c "./mockgen_private.sh quic mock_session_runner_test.go github.com/lucas-clemente/quic-go sessionRunner" -//go:generate sh -c "./mockgen_private.sh quic mock_quic_session_test.go github.com/lucas-clemente/quic-go quicSession" -//go:generate sh -c "./mockgen_private.sh quic mock_packet_handler_test.go github.com/lucas-clemente/quic-go packetHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_unknown_packet_handler_test.go github.com/lucas-clemente/quic-go unknownPacketHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_packet_handler_manager_test.go github.com/lucas-clemente/quic-go packetHandlerManager" -//go:generate sh -c "./mockgen_private.sh quic mock_multiplexer_test.go github.com/lucas-clemente/quic-go multiplexer" diff --git a/vendor/github.com/lucas-clemente/quic-go/mockgen_private.sh b/vendor/github.com/lucas-clemente/quic-go/mockgen_private.sh deleted file mode 100755 index 0ba5f64e..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/mockgen_private.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Mockgen refuses to generate mocks private types. -# This script copies the quic package to a temporary directory, and adds an public alias for the private type. -# It then creates a mock for this public (alias) type. - -TEMP_DIR=$(mktemp -d) -mkdir -p $TEMP_DIR/src/github.com/lucas-clemente/quic-go/ - -# uppercase the name of the interface -INTERFACE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${4:0:1})${4:1}" - -# copy all .go files to a temporary directory -rsync -r --exclude 'vendor' --include='*.go' --include '*/' --exclude '*' $GOPATH/src/github.com/lucas-clemente/quic-go/ $TEMP_DIR/src/github.com/lucas-clemente/quic-go/ - -# create a public alias for the interface, so that mockgen can process it -echo -e "package $1\n" > $TEMP_DIR/src/github.com/lucas-clemente/quic-go/mockgen_interface.go -echo "type $INTERFACE_NAME = $4" >> $TEMP_DIR/src/github.com/lucas-clemente/quic-go/mockgen_interface.go - -export GOPATH="$TEMP_DIR:$GOPATH" - -mockgen -package $1 -self_package $1 -destination $2 $3 $INTERFACE_NAME - -# mockgen imports quic-go as 'import quic_go github.com/lucas_clemente/quic-go' -sed -i '' 's/quic_go.//g' $2 -goimports -w $2 - -rm -r "$TEMP_DIR" diff --git a/vendor/github.com/lucas-clemente/quic-go/multiplexer.go b/vendor/github.com/lucas-clemente/quic-go/multiplexer.go deleted file mode 100644 index eeffca53..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/multiplexer.go +++ /dev/null @@ -1,89 +0,0 @@ -package quic - -import ( - "bytes" - "fmt" - "net" - "sync" - - "github.com/lucas-clemente/quic-go/internal/utils" -) - -var ( - connMuxerOnce sync.Once - connMuxer multiplexer -) - -type multiplexer interface { - AddConn(c net.PacketConn, connIDLen int, statelessResetKey []byte) (packetHandlerManager, error) - RemoveConn(net.PacketConn) error -} - -type connManager struct { - connIDLen int - statelessResetKey []byte - manager packetHandlerManager -} - -// The connMultiplexer listens on multiple net.PacketConns and dispatches -// incoming packets to the session handler. -type connMultiplexer struct { - mutex sync.Mutex - - conns map[net.PacketConn]connManager - newPacketHandlerManager func(net.PacketConn, int, []byte, utils.Logger) packetHandlerManager // so it can be replaced in the tests - - logger utils.Logger -} - -var _ multiplexer = &connMultiplexer{} - -func getMultiplexer() multiplexer { - connMuxerOnce.Do(func() { - connMuxer = &connMultiplexer{ - conns: make(map[net.PacketConn]connManager), - logger: utils.DefaultLogger.WithPrefix("muxer"), - newPacketHandlerManager: newPacketHandlerMap, - } - }) - return connMuxer -} - -func (m *connMultiplexer) AddConn( - c net.PacketConn, - connIDLen int, - statelessResetKey []byte, -) (packetHandlerManager, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - p, ok := m.conns[c] - if !ok { - manager := m.newPacketHandlerManager(c, connIDLen, statelessResetKey, m.logger) - p = connManager{ - connIDLen: connIDLen, - statelessResetKey: statelessResetKey, - manager: manager, - } - m.conns[c] = p - } - if p.connIDLen != connIDLen { - return nil, fmt.Errorf("cannot use %d byte connection IDs on a connection that is already using %d byte connction IDs", connIDLen, p.connIDLen) - } - if statelessResetKey != nil && !bytes.Equal(p.statelessResetKey, statelessResetKey) { - return nil, fmt.Errorf("cannot use different stateless reset keys on the same packet conn") - } - return p.manager, nil -} - -func (m *connMultiplexer) RemoveConn(c net.PacketConn) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - if _, ok := m.conns[c]; !ok { - return fmt.Errorf("cannote remove connection, connection is unknown") - } - - delete(m.conns, c) - return nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/packet_handler_map.go b/vendor/github.com/lucas-clemente/quic-go/packet_handler_map.go deleted file mode 100644 index 0af6a407..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/packet_handler_map.go +++ /dev/null @@ -1,274 +0,0 @@ -package quic - -import ( - "crypto/hmac" - "crypto/rand" - "crypto/sha256" - "errors" - "hash" - "net" - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// The packetHandlerMap stores packetHandlers, identified by connection ID. -// It is used: -// * by the server to store sessions -// * when multiplexing outgoing connections to store clients -type packetHandlerMap struct { - mutex sync.RWMutex - - conn net.PacketConn - connIDLen int - - handlers map[string] /* string(ConnectionID)*/ packetHandler - resetTokens map[[16]byte] /* stateless reset token */ packetHandler - server unknownPacketHandler - - listening chan struct{} // is closed when listen returns - closed bool - - deleteRetiredSessionsAfter time.Duration - - statelessResetEnabled bool - statelessResetHasher hash.Hash - - logger utils.Logger -} - -var _ packetHandlerManager = &packetHandlerMap{} - -func newPacketHandlerMap( - conn net.PacketConn, - connIDLen int, - statelessResetKey []byte, - logger utils.Logger, -) packetHandlerManager { - m := &packetHandlerMap{ - conn: conn, - connIDLen: connIDLen, - listening: make(chan struct{}), - handlers: make(map[string]packetHandler), - resetTokens: make(map[[16]byte]packetHandler), - deleteRetiredSessionsAfter: protocol.RetiredConnectionIDDeleteTimeout, - statelessResetEnabled: len(statelessResetKey) > 0, - statelessResetHasher: hmac.New(sha256.New, statelessResetKey), - logger: logger, - } - go m.listen() - return m -} - -func (h *packetHandlerMap) Add(id protocol.ConnectionID, handler packetHandler) { - h.mutex.Lock() - h.handlers[string(id)] = handler - h.mutex.Unlock() -} - -func (h *packetHandlerMap) Remove(id protocol.ConnectionID) { - h.removeByConnectionIDAsString(string(id)) -} - -func (h *packetHandlerMap) removeByConnectionIDAsString(id string) { - h.mutex.Lock() - delete(h.handlers, id) - h.mutex.Unlock() -} - -func (h *packetHandlerMap) Retire(id protocol.ConnectionID) { - h.retireByConnectionIDAsString(string(id)) -} - -func (h *packetHandlerMap) retireByConnectionIDAsString(id string) { - time.AfterFunc(h.deleteRetiredSessionsAfter, func() { - h.removeByConnectionIDAsString(id) - }) -} - -func (h *packetHandlerMap) AddResetToken(token [16]byte, handler packetHandler) { - h.mutex.Lock() - h.resetTokens[token] = handler - h.mutex.Unlock() -} - -func (h *packetHandlerMap) RemoveResetToken(token [16]byte) { - h.mutex.Lock() - delete(h.resetTokens, token) - h.mutex.Unlock() -} - -func (h *packetHandlerMap) SetServer(s unknownPacketHandler) { - h.mutex.Lock() - h.server = s - h.mutex.Unlock() -} - -func (h *packetHandlerMap) CloseServer() { - h.mutex.Lock() - h.server = nil - var wg sync.WaitGroup - for id, handler := range h.handlers { - if handler.getPerspective() == protocol.PerspectiveServer { - wg.Add(1) - go func(id string, handler packetHandler) { - // session.Close() blocks until the CONNECTION_CLOSE has been sent and the run-loop has stopped - _ = handler.Close() - h.retireByConnectionIDAsString(id) - wg.Done() - }(id, handler) - } - } - h.mutex.Unlock() - wg.Wait() -} - -// Close the underlying connection and wait until listen() has returned. -func (h *packetHandlerMap) Close() error { - if err := h.conn.Close(); err != nil { - return err - } - <-h.listening // wait until listening returns - return nil -} - -func (h *packetHandlerMap) close(e error) error { - h.mutex.Lock() - if h.closed { - h.mutex.Unlock() - return nil - } - h.closed = true - - var wg sync.WaitGroup - for _, handler := range h.handlers { - wg.Add(1) - go func(handler packetHandler) { - handler.destroy(e) - wg.Done() - }(handler) - } - - if h.server != nil { - h.server.closeWithError(e) - } - h.mutex.Unlock() - wg.Wait() - return getMultiplexer().RemoveConn(h.conn) -} - -func (h *packetHandlerMap) listen() { - defer close(h.listening) - for { - buffer := getPacketBuffer() - data := buffer.Slice - // The packet size should not exceed protocol.MaxReceivePacketSize bytes - // If it does, we only read a truncated packet, which will then end up undecryptable - n, addr, err := h.conn.ReadFrom(data) - if err != nil { - h.close(err) - return - } - h.handlePacket(addr, buffer, data[:n]) - } -} - -func (h *packetHandlerMap) handlePacket( - addr net.Addr, - buffer *packetBuffer, - data []byte, -) { - connID, err := wire.ParseConnectionID(data, h.connIDLen) - if err != nil { - h.logger.Debugf("error parsing connection ID on packet from %s: %s", addr, err) - return - } - rcvTime := time.Now() - - h.mutex.RLock() - defer h.mutex.RUnlock() - - if isStatelessReset := h.maybeHandleStatelessReset(data); isStatelessReset { - return - } - - handler, handlerFound := h.handlers[string(connID)] - - p := &receivedPacket{ - remoteAddr: addr, - rcvTime: rcvTime, - buffer: buffer, - data: data, - } - if handlerFound { // existing session - handler.handlePacket(p) - return - } - if data[0]&0x80 == 0 { - go h.maybeSendStatelessReset(p, connID) - return - } - if h.server == nil { // no server set - h.logger.Debugf("received a packet with an unexpected connection ID %s", connID) - return - } - h.server.handlePacket(p) -} - -func (h *packetHandlerMap) maybeHandleStatelessReset(data []byte) bool { - // stateless resets are always short header packets - if data[0]&0x80 != 0 { - return false - } - if len(data) < protocol.MinStatelessResetSize { - return false - } - - var token [16]byte - copy(token[:], data[len(data)-16:]) - if sess, ok := h.resetTokens[token]; ok { - h.logger.Debugf("Received a stateless retry with token %#x. Closing session.", token) - go sess.destroy(errors.New("received a stateless reset")) - return true - } - return false -} - -func (h *packetHandlerMap) GetStatelessResetToken(connID protocol.ConnectionID) [16]byte { - var token [16]byte - if !h.statelessResetEnabled { - // Return a random stateless reset token. - // This token will be sent in the server's transport parameters. - // By using a random token, an off-path attacker won't be able to disrupt the connection. - rand.Read(token[:]) - return token - } - h.statelessResetHasher.Write(connID.Bytes()) - copy(token[:], h.statelessResetHasher.Sum(nil)) - h.statelessResetHasher.Reset() - return token -} - -func (h *packetHandlerMap) maybeSendStatelessReset(p *receivedPacket, connID protocol.ConnectionID) { - defer p.buffer.Release() - if !h.statelessResetEnabled { - return - } - // Don't send a stateless reset in response to very small packets. - // This includes packets that could be stateless resets. - if len(p.data) <= protocol.MinStatelessResetSize { - return - } - token := h.GetStatelessResetToken(connID) - h.logger.Debugf("Sending stateless reset to %s (connection ID: %s). Token: %#x", p.remoteAddr, connID, token) - data := make([]byte, 23) - rand.Read(data) - data[0] = (data[0] & 0x7f) | 0x40 - data = append(data, token[:]...) - if _, err := h.conn.WriteTo(data, p.remoteAddr); err != nil { - h.logger.Debugf("Error sending Stateless Reset: %s", err) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/packet_packer.go b/vendor/github.com/lucas-clemente/quic-go/packet_packer.go deleted file mode 100644 index 7fae340e..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/packet_packer.go +++ /dev/null @@ -1,491 +0,0 @@ -package quic - -import ( - "bytes" - "errors" - "fmt" - "net" - "time" - - "github.com/lucas-clemente/quic-go/internal/ackhandler" - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type packer interface { - PackPacket() (*packedPacket, error) - MaybePackAckPacket() (*packedPacket, error) - PackRetransmission(packet *ackhandler.Packet) ([]*packedPacket, error) - PackConnectionClose(*wire.ConnectionCloseFrame) (*packedPacket, error) - - HandleTransportParameters(*handshake.TransportParameters) - SetToken([]byte) - ChangeDestConnectionID(protocol.ConnectionID) -} - -type packedPacket struct { - header *wire.ExtendedHeader - raw []byte - frames []wire.Frame - - buffer *packetBuffer -} - -func (p *packedPacket) EncryptionLevel() protocol.EncryptionLevel { - if !p.header.IsLongHeader { - return protocol.Encryption1RTT - } - switch p.header.Type { - case protocol.PacketTypeInitial: - return protocol.EncryptionInitial - case protocol.PacketTypeHandshake: - return protocol.EncryptionHandshake - default: - return protocol.EncryptionUnspecified - } -} - -func (p *packedPacket) IsRetransmittable() bool { - return ackhandler.HasRetransmittableFrames(p.frames) -} - -func (p *packedPacket) ToAckHandlerPacket() *ackhandler.Packet { - return &ackhandler.Packet{ - PacketNumber: p.header.PacketNumber, - PacketType: p.header.Type, - Frames: p.frames, - Length: protocol.ByteCount(len(p.raw)), - EncryptionLevel: p.EncryptionLevel(), - SendTime: time.Now(), - } -} - -func getMaxPacketSize(addr net.Addr) protocol.ByteCount { - maxSize := protocol.ByteCount(protocol.MinInitialPacketSize) - // If this is not a UDP address, we don't know anything about the MTU. - // Use the minimum size of an Initial packet as the max packet size. - if udpAddr, ok := addr.(*net.UDPAddr); ok { - // If ip is not an IPv4 address, To4 returns nil. - // Note that there might be some corner cases, where this is not correct. - // See https://stackoverflow.com/questions/22751035/golang-distinguish-ipv4-ipv6. - if udpAddr.IP.To4() == nil { - maxSize = protocol.MaxPacketSizeIPv6 - } else { - maxSize = protocol.MaxPacketSizeIPv4 - } - } - return maxSize -} - -type packetNumberManager interface { - PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen) - PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber -} - -type sealingManager interface { - GetSealer() (protocol.EncryptionLevel, handshake.Sealer) - GetSealerWithEncryptionLevel(protocol.EncryptionLevel) (handshake.Sealer, error) -} - -type frameSource interface { - AppendStreamFrames([]wire.Frame, protocol.ByteCount) []wire.Frame - AppendControlFrames([]wire.Frame, protocol.ByteCount) ([]wire.Frame, protocol.ByteCount) -} - -type ackFrameSource interface { - GetAckFrame(protocol.EncryptionLevel) *wire.AckFrame -} - -type packetPacker struct { - destConnID protocol.ConnectionID - srcConnID protocol.ConnectionID - - perspective protocol.Perspective - version protocol.VersionNumber - cryptoSetup sealingManager - - initialStream cryptoStream - handshakeStream cryptoStream - - token []byte - - pnManager packetNumberManager - framer frameSource - acks ackFrameSource - - maxPacketSize protocol.ByteCount - numNonRetransmittableAcks int -} - -var _ packer = &packetPacker{} - -func newPacketPacker( - destConnID protocol.ConnectionID, - srcConnID protocol.ConnectionID, - initialStream cryptoStream, - handshakeStream cryptoStream, - packetNumberManager packetNumberManager, - remoteAddr net.Addr, // only used for determining the max packet size - cryptoSetup sealingManager, - framer frameSource, - acks ackFrameSource, - perspective protocol.Perspective, - version protocol.VersionNumber, -) *packetPacker { - return &packetPacker{ - cryptoSetup: cryptoSetup, - destConnID: destConnID, - srcConnID: srcConnID, - initialStream: initialStream, - handshakeStream: handshakeStream, - perspective: perspective, - version: version, - framer: framer, - acks: acks, - pnManager: packetNumberManager, - maxPacketSize: getMaxPacketSize(remoteAddr), - } -} - -// PackConnectionClose packs a packet that ONLY contains a ConnectionCloseFrame -func (p *packetPacker) PackConnectionClose(ccf *wire.ConnectionCloseFrame) (*packedPacket, error) { - frames := []wire.Frame{ccf} - encLevel, sealer := p.cryptoSetup.GetSealer() - header := p.getHeader(encLevel) - return p.writeAndSealPacket(header, frames, encLevel, sealer) -} - -func (p *packetPacker) MaybePackAckPacket() (*packedPacket, error) { - ack := p.acks.GetAckFrame(protocol.Encryption1RTT) - if ack == nil { - return nil, nil - } - // TODO(#1534): only pack ACKs with the right encryption level - encLevel, sealer := p.cryptoSetup.GetSealer() - header := p.getHeader(encLevel) - frames := []wire.Frame{ack} - return p.writeAndSealPacket(header, frames, encLevel, sealer) -} - -// PackRetransmission packs a retransmission -// For packets sent after completion of the handshake, it might happen that 2 packets have to be sent. -// This can happen e.g. when a longer packet number is used in the header. -func (p *packetPacker) PackRetransmission(packet *ackhandler.Packet) ([]*packedPacket, error) { - var controlFrames []wire.Frame - var streamFrames []*wire.StreamFrame - for _, f := range packet.Frames { - // CRYPTO frames are treated as control frames here. - // Since we're making sure that the header can never be larger for a retransmission, - // we never have to split CRYPTO frames. - if sf, ok := f.(*wire.StreamFrame); ok { - sf.DataLenPresent = true - streamFrames = append(streamFrames, sf) - } else { - controlFrames = append(controlFrames, f) - } - } - - var packets []*packedPacket - encLevel := packet.EncryptionLevel - sealer, err := p.cryptoSetup.GetSealerWithEncryptionLevel(encLevel) - if err != nil { - return nil, err - } - for len(controlFrames) > 0 || len(streamFrames) > 0 { - var frames []wire.Frame - var length protocol.ByteCount - - header := p.getHeader(encLevel) - headerLen := header.GetLength(p.version) - maxSize := p.maxPacketSize - protocol.ByteCount(sealer.Overhead()) - headerLen - - for len(controlFrames) > 0 { - frame := controlFrames[0] - frameLen := frame.Length(p.version) - if length+frameLen > maxSize { - break - } - length += frameLen - frames = append(frames, frame) - controlFrames = controlFrames[1:] - } - - for len(streamFrames) > 0 && length+protocol.MinStreamFrameSize < maxSize { - frame := streamFrames[0] - frame.DataLenPresent = false - frameToAdd := frame - - sf, err := frame.MaybeSplitOffFrame(maxSize-length, p.version) - if err != nil { - return nil, err - } - if sf != nil { - frameToAdd = sf - } else { - streamFrames = streamFrames[1:] - } - frame.DataLenPresent = true - length += frameToAdd.Length(p.version) - frames = append(frames, frameToAdd) - } - if sf, ok := frames[len(frames)-1].(*wire.StreamFrame); ok { - sf.DataLenPresent = false - } - p, err := p.writeAndSealPacket(header, frames, encLevel, sealer) - if err != nil { - return nil, err - } - packets = append(packets, p) - } - return packets, nil -} - -// PackPacket packs a new packet -// the other controlFrames are sent in the next packet, but might be queued and sent in the next packet if the packet would overflow MaxPacketSize otherwise -func (p *packetPacker) PackPacket() (*packedPacket, error) { - packet, err := p.maybePackCryptoPacket() - if err != nil { - return nil, err - } - if packet != nil { - return packet, nil - } - - encLevel, sealer := p.cryptoSetup.GetSealer() - header := p.getHeader(encLevel) - headerLen := header.GetLength(p.version) - if err != nil { - return nil, err - } - - maxSize := p.maxPacketSize - protocol.ByteCount(sealer.Overhead()) - headerLen - frames, err := p.composeNextPacket(maxSize) - if err != nil { - return nil, err - } - - // Check if we have enough frames to send - if len(frames) == 0 { - return nil, nil - } - // check if this packet only contains an ACK - if !ackhandler.HasRetransmittableFrames(frames) { - if p.numNonRetransmittableAcks >= protocol.MaxNonRetransmittableAcks { - frames = append(frames, &wire.PingFrame{}) - p.numNonRetransmittableAcks = 0 - } else { - p.numNonRetransmittableAcks++ - } - } else { - p.numNonRetransmittableAcks = 0 - } - - return p.writeAndSealPacket(header, frames, encLevel, sealer) -} - -func (p *packetPacker) maybePackCryptoPacket() (*packedPacket, error) { - var s cryptoStream - var encLevel protocol.EncryptionLevel - - hasData := p.initialStream.HasData() - ack := p.acks.GetAckFrame(protocol.EncryptionInitial) - if hasData || ack != nil { - s = p.initialStream - encLevel = protocol.EncryptionInitial - } else { - hasData = p.handshakeStream.HasData() - ack = p.acks.GetAckFrame(protocol.EncryptionHandshake) - if hasData || ack != nil { - s = p.handshakeStream - encLevel = protocol.EncryptionHandshake - } - } - if s == nil { - return nil, nil - } - sealer, err := p.cryptoSetup.GetSealerWithEncryptionLevel(encLevel) - if err != nil { - // The sealer - return nil, err - } - - hdr := p.getHeader(encLevel) - hdrLen := hdr.GetLength(p.version) - var length protocol.ByteCount - frames := make([]wire.Frame, 0, 2) - if ack != nil { - frames = append(frames, ack) - length += ack.Length(p.version) - } - if hasData { - cf := s.PopCryptoFrame(p.maxPacketSize - hdrLen - protocol.ByteCount(sealer.Overhead()) - length) - frames = append(frames, cf) - } - return p.writeAndSealPacket(hdr, frames, encLevel, sealer) -} - -func (p *packetPacker) composeNextPacket(maxFrameSize protocol.ByteCount) ([]wire.Frame, error) { - var length protocol.ByteCount - var frames []wire.Frame - - // ACKs need to go first, so that the sentPacketHandler will recognize them - if ack := p.acks.GetAckFrame(protocol.Encryption1RTT); ack != nil { - frames = append(frames, ack) - length += ack.Length(p.version) - } - - var lengthAdded protocol.ByteCount - frames, lengthAdded = p.framer.AppendControlFrames(frames, maxFrameSize-length) - length += lengthAdded - - // temporarily increase the maxFrameSize by the (minimum) length of the DataLen field - // this leads to a properly sized packet in all cases, since we do all the packet length calculations with STREAM frames that have the DataLen set - // however, for the last STREAM frame in the packet, we can omit the DataLen, thus yielding a packet of exactly the correct size - // the length is encoded to either 1 or 2 bytes - maxFrameSize++ - - frames = p.framer.AppendStreamFrames(frames, maxFrameSize-length) - if len(frames) > 0 { - lastFrame := frames[len(frames)-1] - if sf, ok := lastFrame.(*wire.StreamFrame); ok { - sf.DataLenPresent = false - } - } - return frames, nil -} - -func (p *packetPacker) getHeader(encLevel protocol.EncryptionLevel) *wire.ExtendedHeader { - pn, pnLen := p.pnManager.PeekPacketNumber(encLevel) - header := &wire.ExtendedHeader{} - header.PacketNumber = pn - header.PacketNumberLen = pnLen - header.Version = p.version - header.DestConnectionID = p.destConnID - - if encLevel != protocol.Encryption1RTT { - header.IsLongHeader = true - // Always send Initial and Handshake packets with the maximum packet number length. - // This simplifies retransmissions: Since the header can't get any larger, - // we don't need to split CRYPTO frames. - header.PacketNumberLen = protocol.PacketNumberLen4 - header.SrcConnectionID = p.srcConnID - // Set the length to the maximum packet size. - // Since it is encoded as a varint, this guarantees us that the header will end up at most as big as GetLength() returns. - header.Length = p.maxPacketSize - switch encLevel { - case protocol.EncryptionInitial: - header.Type = protocol.PacketTypeInitial - case protocol.EncryptionHandshake: - header.Type = protocol.PacketTypeHandshake - } - } - - return header -} - -func (p *packetPacker) writeAndSealPacket( - header *wire.ExtendedHeader, - frames []wire.Frame, - encLevel protocol.EncryptionLevel, - sealer handshake.Sealer, -) (*packedPacket, error) { - packetBuffer := getPacketBuffer() - buffer := bytes.NewBuffer(packetBuffer.Slice[:0]) - - addPaddingForInitial := p.perspective == protocol.PerspectiveClient && header.Type == protocol.PacketTypeInitial - - if header.IsLongHeader { - if p.perspective == protocol.PerspectiveClient && header.Type == protocol.PacketTypeInitial { - header.Token = p.token - } - if addPaddingForInitial { - headerLen := header.GetLength(p.version) - header.Length = protocol.ByteCount(header.PacketNumberLen) + protocol.MinInitialPacketSize - headerLen - } else { - // long header packets always use 4 byte packet number, so we never need to pad short payloads - length := protocol.ByteCount(sealer.Overhead()) + protocol.ByteCount(header.PacketNumberLen) - for _, frame := range frames { - length += frame.Length(p.version) - } - header.Length = length - } - } - - if err := header.Write(buffer, p.version); err != nil { - return nil, err - } - payloadOffset := buffer.Len() - - // write all frames but the last one - for _, frame := range frames[:len(frames)-1] { - if err := frame.Write(buffer, p.version); err != nil { - return nil, err - } - } - lastFrame := frames[len(frames)-1] - if addPaddingForInitial { - // when appending padding, we need to make sure that the last STREAM frames has the data length set - if sf, ok := lastFrame.(*wire.StreamFrame); ok { - sf.DataLenPresent = true - } - } else { - payloadLen := buffer.Len() - payloadOffset + int(lastFrame.Length(p.version)) - if paddingLen := 4 - int(header.PacketNumberLen) - payloadLen; paddingLen > 0 { - // Pad the packet such that packet number length + payload length is 4 bytes. - // This is needed to enable the peer to get a 16 byte sample for header protection. - buffer.Write(bytes.Repeat([]byte{0}, paddingLen)) - } - } - if err := lastFrame.Write(buffer, p.version); err != nil { - return nil, err - } - - if addPaddingForInitial { - paddingLen := protocol.MinInitialPacketSize - sealer.Overhead() - buffer.Len() - if paddingLen > 0 { - buffer.Write(bytes.Repeat([]byte{0}, paddingLen)) - } - } - - if size := protocol.ByteCount(buffer.Len() + sealer.Overhead()); size > p.maxPacketSize { - return nil, fmt.Errorf("PacketPacker BUG: packet too large (%d bytes, allowed %d bytes)", size, p.maxPacketSize) - } - - raw := buffer.Bytes() - _ = sealer.Seal(raw[payloadOffset:payloadOffset], raw[payloadOffset:], header.PacketNumber, raw[:payloadOffset]) - raw = raw[0 : buffer.Len()+sealer.Overhead()] - - pnOffset := payloadOffset - int(header.PacketNumberLen) - sealer.EncryptHeader( - raw[pnOffset+4:pnOffset+4+16], - &raw[0], - raw[pnOffset:payloadOffset], - ) - - num := p.pnManager.PopPacketNumber(encLevel) - if num != header.PacketNumber { - return nil, errors.New("packetPacker BUG: Peeked and Popped packet numbers do not match") - } - return &packedPacket{ - header: header, - raw: raw, - frames: frames, - buffer: packetBuffer, - }, nil -} - -func (p *packetPacker) ChangeDestConnectionID(connID protocol.ConnectionID) { - p.destConnID = connID -} - -func (p *packetPacker) SetToken(token []byte) { - p.token = token -} - -func (p *packetPacker) HandleTransportParameters(params *handshake.TransportParameters) { - if params.MaxPacketSize != 0 { - p.maxPacketSize = utils.MinByteCount(p.maxPacketSize, params.MaxPacketSize) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/packet_unpacker.go b/vendor/github.com/lucas-clemente/quic-go/packet_unpacker.go deleted file mode 100644 index f3b5a2f7..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/packet_unpacker.go +++ /dev/null @@ -1,102 +0,0 @@ -package quic - -import ( - "bytes" - "fmt" - - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type unpackedPacket struct { - packetNumber protocol.PacketNumber // the decoded packet number - hdr *wire.ExtendedHeader - encryptionLevel protocol.EncryptionLevel - data []byte -} - -// The packetUnpacker unpacks QUIC packets. -type packetUnpacker struct { - cs handshake.CryptoSetup - - largestRcvdPacketNumber protocol.PacketNumber - - version protocol.VersionNumber -} - -var _ unpacker = &packetUnpacker{} - -func newPacketUnpacker(cs handshake.CryptoSetup, version protocol.VersionNumber) unpacker { - return &packetUnpacker{ - cs: cs, - version: version, - } -} - -func (u *packetUnpacker) Unpack(hdr *wire.Header, data []byte) (*unpackedPacket, error) { - r := bytes.NewReader(data) - - var encLevel protocol.EncryptionLevel - switch hdr.Type { - case protocol.PacketTypeInitial: - encLevel = protocol.EncryptionInitial - case protocol.PacketTypeHandshake: - encLevel = protocol.EncryptionHandshake - default: - if hdr.IsLongHeader { - return nil, fmt.Errorf("unknown packet type: %s", hdr.Type) - } - encLevel = protocol.Encryption1RTT - } - opener, err := u.cs.GetOpener(encLevel) - if err != nil { - return nil, err - } - hdrLen := int(hdr.ParsedLen()) - if len(data) < hdrLen+4+16 { - return nil, fmt.Errorf("Packet too small. Expected at least 20 bytes after the header, got %d", len(data)-hdrLen) - } - // The packet number can be up to 4 bytes long, but we won't know the length until we decrypt it. - // 1. save a copy of the 4 bytes - origPNBytes := make([]byte, 4) - copy(origPNBytes, data[hdrLen:hdrLen+4]) - // 2. decrypt the header, assuming a 4 byte packet number - opener.DecryptHeader( - data[hdrLen+4:hdrLen+4+16], - &data[0], - data[hdrLen:hdrLen+4], - ) - // 3. parse the header (and learn the actual length of the packet number) - extHdr, err := hdr.ParseExtended(r, u.version) - if err != nil { - return nil, fmt.Errorf("error parsing extended header: %s", err) - } - extHdrLen := hdrLen + int(extHdr.PacketNumberLen) - // 4. if the packet number is shorter than 4 bytes, replace the remaining bytes with the copy we saved earlier - if extHdr.PacketNumberLen != protocol.PacketNumberLen4 { - copy(data[extHdrLen:hdrLen+4], origPNBytes[int(extHdr.PacketNumberLen):]) - } - - pn := protocol.DecodePacketNumber( - extHdr.PacketNumberLen, - u.largestRcvdPacketNumber, - extHdr.PacketNumber, - ) - - decrypted, err := opener.Open(data[extHdrLen:extHdrLen], data[extHdrLen:], pn, data[:extHdrLen]) - if err != nil { - return nil, err - } - - // Only do this after decrypting, so we are sure the packet is not attacker-controlled - u.largestRcvdPacketNumber = utils.MaxPacketNumber(u.largestRcvdPacketNumber, pn) - - return &unpackedPacket{ - hdr: extHdr, - packetNumber: pn, - encryptionLevel: encLevel, - data: decrypted, - }, nil -} diff --git a/vendor/github.com/lucas-clemente/quic-go/receive_stream.go b/vendor/github.com/lucas-clemente/quic-go/receive_stream.go deleted file mode 100644 index de76335e..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/receive_stream.go +++ /dev/null @@ -1,324 +0,0 @@ -package quic - -import ( - "fmt" - "io" - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type receiveStreamI interface { - ReceiveStream - - handleStreamFrame(*wire.StreamFrame) error - handleResetStreamFrame(*wire.ResetStreamFrame) error - closeForShutdown(error) - getWindowUpdate() protocol.ByteCount -} - -type receiveStream struct { - mutex sync.Mutex - - streamID protocol.StreamID - - sender streamSender - - frameQueue *frameSorter - readOffset protocol.ByteCount - finalOffset protocol.ByteCount - - currentFrame []byte - currentFrameIsLast bool // is the currentFrame the last frame on this stream - readPosInFrame int - - closeForShutdownErr error - cancelReadErr error - resetRemotelyErr StreamError - - closedForShutdown bool // set when CloseForShutdown() is called - finRead bool // set once we read a frame with a FinBit - canceledRead bool // set when CancelRead() is called - resetRemotely bool // set when HandleResetStreamFrame() is called - - readChan chan struct{} - deadline time.Time - - flowController flowcontrol.StreamFlowController - version protocol.VersionNumber -} - -var _ ReceiveStream = &receiveStream{} -var _ receiveStreamI = &receiveStream{} - -func newReceiveStream( - streamID protocol.StreamID, - sender streamSender, - flowController flowcontrol.StreamFlowController, - version protocol.VersionNumber, -) *receiveStream { - return &receiveStream{ - streamID: streamID, - sender: sender, - flowController: flowController, - frameQueue: newFrameSorter(), - readChan: make(chan struct{}, 1), - finalOffset: protocol.MaxByteCount, - version: version, - } -} - -func (s *receiveStream) StreamID() protocol.StreamID { - return s.streamID -} - -// Read implements io.Reader. It is not thread safe! -func (s *receiveStream) Read(p []byte) (int, error) { - s.mutex.Lock() - completed, n, err := s.readImpl(p) - s.mutex.Unlock() - - if completed { - s.streamCompleted() - } - return n, err -} - -func (s *receiveStream) readImpl(p []byte) (bool /*stream completed */, int, error) { - if s.finRead { - return false, 0, io.EOF - } - if s.canceledRead { - return false, 0, s.cancelReadErr - } - if s.resetRemotely { - return false, 0, s.resetRemotelyErr - } - if s.closedForShutdown { - return false, 0, s.closeForShutdownErr - } - - bytesRead := 0 - for bytesRead < len(p) { - if s.currentFrame == nil || s.readPosInFrame >= len(s.currentFrame) { - s.dequeueNextFrame() - } - if s.currentFrame == nil && bytesRead > 0 { - return false, bytesRead, s.closeForShutdownErr - } - - var deadlineTimer *utils.Timer - for { - // Stop waiting on errors - if s.closedForShutdown { - return false, bytesRead, s.closeForShutdownErr - } - if s.canceledRead { - return false, bytesRead, s.cancelReadErr - } - if s.resetRemotely { - return false, bytesRead, s.resetRemotelyErr - } - - deadline := s.deadline - if !deadline.IsZero() { - if !time.Now().Before(deadline) { - return false, bytesRead, errDeadline - } - if deadlineTimer == nil { - deadlineTimer = utils.NewTimer() - } - deadlineTimer.Reset(deadline) - } - - if s.currentFrame != nil || s.currentFrameIsLast { - break - } - - s.mutex.Unlock() - if deadline.IsZero() { - <-s.readChan - } else { - select { - case <-s.readChan: - case <-deadlineTimer.Chan(): - deadlineTimer.SetRead() - } - } - s.mutex.Lock() - if s.currentFrame == nil { - s.dequeueNextFrame() - } - } - - if bytesRead > len(p) { - return false, bytesRead, fmt.Errorf("BUG: bytesRead (%d) > len(p) (%d) in stream.Read", bytesRead, len(p)) - } - if s.readPosInFrame > len(s.currentFrame) { - return false, bytesRead, fmt.Errorf("BUG: readPosInFrame (%d) > frame.DataLen (%d) in stream.Read", s.readPosInFrame, len(s.currentFrame)) - } - - s.mutex.Unlock() - - m := copy(p[bytesRead:], s.currentFrame[s.readPosInFrame:]) - s.readPosInFrame += m - bytesRead += m - s.readOffset += protocol.ByteCount(m) - - s.mutex.Lock() - // when a RESET_STREAM was received, the was already informed about the final byteOffset for this stream - if !s.resetRemotely { - s.flowController.AddBytesRead(protocol.ByteCount(m)) - } - - if s.readPosInFrame >= len(s.currentFrame) && s.currentFrameIsLast { - s.finRead = true - return true, bytesRead, io.EOF - } - } - return false, bytesRead, nil -} - -func (s *receiveStream) dequeueNextFrame() { - var offset protocol.ByteCount - offset, s.currentFrame = s.frameQueue.Pop() - s.currentFrameIsLast = offset+protocol.ByteCount(len(s.currentFrame)) >= s.finalOffset - s.readPosInFrame = 0 -} - -func (s *receiveStream) CancelRead(errorCode protocol.ApplicationErrorCode) { - s.mutex.Lock() - completed := s.cancelReadImpl(errorCode) - s.mutex.Unlock() - - if completed { - s.streamCompleted() - } -} - -func (s *receiveStream) cancelReadImpl(errorCode protocol.ApplicationErrorCode) bool /* completed */ { - if s.finRead || s.canceledRead || s.resetRemotely { - return false - } - s.canceledRead = true - s.cancelReadErr = fmt.Errorf("Read on stream %d canceled with error code %d", s.streamID, errorCode) - s.signalRead() - s.sender.queueControlFrame(&wire.StopSendingFrame{ - StreamID: s.streamID, - ErrorCode: errorCode, - }) - // We're done with this stream if the final offset was already received. - return s.finalOffset != protocol.MaxByteCount -} - -func (s *receiveStream) handleStreamFrame(frame *wire.StreamFrame) error { - s.mutex.Lock() - completed, err := s.handleStreamFrameImpl(frame) - s.mutex.Unlock() - - if completed { - s.streamCompleted() - } - return err -} - -func (s *receiveStream) handleStreamFrameImpl(frame *wire.StreamFrame) (bool /* completed */, error) { - maxOffset := frame.Offset + frame.DataLen() - if err := s.flowController.UpdateHighestReceived(maxOffset, frame.FinBit); err != nil { - return false, err - } - if frame.FinBit { - s.finalOffset = maxOffset - } - if s.canceledRead { - return frame.FinBit, nil - } - if err := s.frameQueue.Push(frame.Data, frame.Offset); err != nil { - return false, err - } - s.signalRead() - return false, nil -} - -func (s *receiveStream) handleResetStreamFrame(frame *wire.ResetStreamFrame) error { - s.mutex.Lock() - completed, err := s.handleResetStreamFrameImpl(frame) - s.mutex.Unlock() - - if completed { - s.streamCompleted() - } - return err -} - -func (s *receiveStream) handleResetStreamFrameImpl(frame *wire.ResetStreamFrame) (bool /*completed */, error) { - if s.closedForShutdown { - return false, nil - } - if err := s.flowController.UpdateHighestReceived(frame.ByteOffset, true); err != nil { - return false, err - } - s.finalOffset = frame.ByteOffset - - // ignore duplicate RESET_STREAM frames for this stream (after checking their final offset) - if s.resetRemotely { - return false, nil - } - s.resetRemotely = true - s.resetRemotelyErr = streamCanceledError{ - errorCode: frame.ErrorCode, - error: fmt.Errorf("Stream %d was reset with error code %d", s.streamID, frame.ErrorCode), - } - s.signalRead() - return true, nil -} - -func (s *receiveStream) CloseRemote(offset protocol.ByteCount) { - s.handleStreamFrame(&wire.StreamFrame{FinBit: true, Offset: offset}) -} - -func (s *receiveStream) SetReadDeadline(t time.Time) error { - s.mutex.Lock() - s.deadline = t - s.mutex.Unlock() - s.signalRead() - return nil -} - -// CloseForShutdown closes a stream abruptly. -// It makes Read unblock (and return the error) immediately. -// The peer will NOT be informed about this: the stream is closed without sending a FIN or RESET. -func (s *receiveStream) closeForShutdown(err error) { - s.mutex.Lock() - s.closedForShutdown = true - s.closeForShutdownErr = err - s.mutex.Unlock() - s.signalRead() -} - -func (s *receiveStream) getWindowUpdate() protocol.ByteCount { - return s.flowController.GetWindowUpdate() -} - -func (s *receiveStream) streamCompleted() { - s.mutex.Lock() - finRead := s.finRead - s.mutex.Unlock() - - if !finRead { - s.flowController.Abandon() - } - s.sender.onStreamCompleted(s.streamID) -} - -// signalRead performs a non-blocking send on the readChan -func (s *receiveStream) signalRead() { - select { - case s.readChan <- struct{}{}: - default: - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/send_stream.go b/vendor/github.com/lucas-clemente/quic-go/send_stream.go deleted file mode 100644 index 46f24c4b..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/send_stream.go +++ /dev/null @@ -1,332 +0,0 @@ -package quic - -import ( - "context" - "fmt" - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type sendStreamI interface { - SendStream - handleStopSendingFrame(*wire.StopSendingFrame) - hasData() bool - popStreamFrame(maxBytes protocol.ByteCount) (*wire.StreamFrame, bool) - closeForShutdown(error) - handleMaxStreamDataFrame(*wire.MaxStreamDataFrame) -} - -type sendStream struct { - mutex sync.Mutex - - ctx context.Context - ctxCancel context.CancelFunc - - streamID protocol.StreamID - sender streamSender - - writeOffset protocol.ByteCount - - cancelWriteErr error - closeForShutdownErr error - - closedForShutdown bool // set when CloseForShutdown() is called - finishedWriting bool // set once Close() is called - canceledWrite bool // set when CancelWrite() is called, or a STOP_SENDING frame is received - finSent bool // set when a STREAM_FRAME with FIN bit has b - - dataForWriting []byte - - writeChan chan struct{} - deadline time.Time - - flowController flowcontrol.StreamFlowController - - version protocol.VersionNumber -} - -var _ SendStream = &sendStream{} -var _ sendStreamI = &sendStream{} - -func newSendStream( - streamID protocol.StreamID, - sender streamSender, - flowController flowcontrol.StreamFlowController, - version protocol.VersionNumber, -) *sendStream { - s := &sendStream{ - streamID: streamID, - sender: sender, - flowController: flowController, - writeChan: make(chan struct{}, 1), - version: version, - } - s.ctx, s.ctxCancel = context.WithCancel(context.Background()) - return s -} - -func (s *sendStream) StreamID() protocol.StreamID { - return s.streamID // same for receiveStream and sendStream -} - -func (s *sendStream) Write(p []byte) (int, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - if s.finishedWriting { - return 0, fmt.Errorf("write on closed stream %d", s.streamID) - } - if s.canceledWrite { - return 0, s.cancelWriteErr - } - if s.closeForShutdownErr != nil { - return 0, s.closeForShutdownErr - } - if !s.deadline.IsZero() && !time.Now().Before(s.deadline) { - return 0, errDeadline - } - if len(p) == 0 { - return 0, nil - } - - s.dataForWriting = p - - var ( - deadlineTimer *utils.Timer - bytesWritten int - notifiedSender bool - ) - for { - bytesWritten = len(p) - len(s.dataForWriting) - deadline := s.deadline - if !deadline.IsZero() { - if !time.Now().Before(deadline) { - s.dataForWriting = nil - return bytesWritten, errDeadline - } - if deadlineTimer == nil { - deadlineTimer = utils.NewTimer() - } - deadlineTimer.Reset(deadline) - } - if s.dataForWriting == nil || s.canceledWrite || s.closedForShutdown { - break - } - - s.mutex.Unlock() - if !notifiedSender { - s.sender.onHasStreamData(s.streamID) // must be called without holding the mutex - notifiedSender = true - } - if deadline.IsZero() { - <-s.writeChan - } else { - select { - case <-s.writeChan: - case <-deadlineTimer.Chan(): - deadlineTimer.SetRead() - } - } - s.mutex.Lock() - } - - if s.closeForShutdownErr != nil { - return bytesWritten, s.closeForShutdownErr - } else if s.cancelWriteErr != nil { - return bytesWritten, s.cancelWriteErr - } - return bytesWritten, nil -} - -// popStreamFrame returns the next STREAM frame that is supposed to be sent on this stream -// maxBytes is the maximum length this frame (including frame header) will have. -func (s *sendStream) popStreamFrame(maxBytes protocol.ByteCount) (*wire.StreamFrame, bool /* has more data to send */) { - s.mutex.Lock() - completed, frame, hasMoreData := s.popStreamFrameImpl(maxBytes) - s.mutex.Unlock() - - if completed { - s.sender.onStreamCompleted(s.streamID) - } - return frame, hasMoreData -} - -func (s *sendStream) popStreamFrameImpl(maxBytes protocol.ByteCount) (bool /* completed */, *wire.StreamFrame, bool /* has more data to send */) { - if s.canceledWrite || s.closeForShutdownErr != nil { - return false, nil, false - } - - frame := &wire.StreamFrame{ - StreamID: s.streamID, - Offset: s.writeOffset, - DataLenPresent: true, - } - maxDataLen := frame.MaxDataLen(maxBytes, s.version) - if maxDataLen == 0 { // a STREAM frame must have at least one byte of data - return false, nil, s.dataForWriting != nil - } - frame.Data, frame.FinBit = s.getDataForWriting(maxDataLen) - if len(frame.Data) == 0 && !frame.FinBit { - // this can happen if: - // - popStreamFrame is called but there's no data for writing - // - there's data for writing, but the stream is stream-level flow control blocked - // - there's data for writing, but the stream is connection-level flow control blocked - if s.dataForWriting == nil { - return false, nil, false - } - if isBlocked, offset := s.flowController.IsNewlyBlocked(); isBlocked { - s.sender.queueControlFrame(&wire.StreamDataBlockedFrame{ - StreamID: s.streamID, - DataLimit: offset, - }) - return false, nil, false - } - return false, nil, true - } - if frame.FinBit { - s.finSent = true - } - return frame.FinBit, frame, s.dataForWriting != nil -} - -func (s *sendStream) hasData() bool { - s.mutex.Lock() - hasData := len(s.dataForWriting) > 0 - s.mutex.Unlock() - return hasData -} - -func (s *sendStream) getDataForWriting(maxBytes protocol.ByteCount) ([]byte, bool /* should send FIN */) { - if s.dataForWriting == nil { - return nil, s.finishedWriting && !s.finSent - } - - maxBytes = utils.MinByteCount(maxBytes, s.flowController.SendWindowSize()) - if maxBytes == 0 { - return nil, false - } - - var ret []byte - if protocol.ByteCount(len(s.dataForWriting)) > maxBytes { - ret = make([]byte, int(maxBytes)) - copy(ret, s.dataForWriting[:maxBytes]) - s.dataForWriting = s.dataForWriting[maxBytes:] - } else { - ret = make([]byte, len(s.dataForWriting)) - copy(ret, s.dataForWriting) - s.dataForWriting = nil - s.signalWrite() - } - s.writeOffset += protocol.ByteCount(len(ret)) - s.flowController.AddBytesSent(protocol.ByteCount(len(ret))) - return ret, s.finishedWriting && s.dataForWriting == nil && !s.finSent -} - -func (s *sendStream) Close() error { - s.mutex.Lock() - if s.canceledWrite { - s.mutex.Unlock() - return fmt.Errorf("Close called for canceled stream %d", s.streamID) - } - s.finishedWriting = true - s.mutex.Unlock() - - s.sender.onHasStreamData(s.streamID) // need to send the FIN, must be called without holding the mutex - s.ctxCancel() - return nil -} - -func (s *sendStream) CancelWrite(errorCode protocol.ApplicationErrorCode) { - s.mutex.Lock() - completed := s.cancelWriteImpl(errorCode, fmt.Errorf("Write on stream %d canceled with error code %d", s.streamID, errorCode)) - s.mutex.Unlock() - - if completed { - s.sender.onStreamCompleted(s.streamID) // must be called without holding the mutex - } -} - -// must be called after locking the mutex -func (s *sendStream) cancelWriteImpl(errorCode protocol.ApplicationErrorCode, writeErr error) bool /*completed */ { - if s.canceledWrite || s.finishedWriting { - return false - } - s.canceledWrite = true - s.cancelWriteErr = writeErr - s.signalWrite() - s.sender.queueControlFrame(&wire.ResetStreamFrame{ - StreamID: s.streamID, - ByteOffset: s.writeOffset, - ErrorCode: errorCode, - }) - // TODO(#991): cancel retransmissions for this stream - s.ctxCancel() - return true -} - -func (s *sendStream) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) { - s.mutex.Lock() - hasStreamData := s.dataForWriting != nil - s.mutex.Unlock() - - s.flowController.UpdateSendWindow(frame.ByteOffset) - if hasStreamData { - s.sender.onHasStreamData(s.streamID) - } -} - -func (s *sendStream) handleStopSendingFrame(frame *wire.StopSendingFrame) { - s.mutex.Lock() - completed := s.handleStopSendingFrameImpl(frame) - s.mutex.Unlock() - - if completed { - s.sender.onStreamCompleted(s.streamID) - } -} - -// must be called after locking the mutex -func (s *sendStream) handleStopSendingFrameImpl(frame *wire.StopSendingFrame) bool /*completed*/ { - writeErr := streamCanceledError{ - errorCode: frame.ErrorCode, - error: fmt.Errorf("Stream %d was reset with error code %d", s.streamID, frame.ErrorCode), - } - return s.cancelWriteImpl(errorCodeStopping, writeErr) -} - -func (s *sendStream) Context() context.Context { - return s.ctx -} - -func (s *sendStream) SetWriteDeadline(t time.Time) error { - s.mutex.Lock() - s.deadline = t - s.mutex.Unlock() - s.signalWrite() - return nil -} - -// CloseForShutdown closes a stream abruptly. -// It makes Write unblock (and return the error) immediately. -// The peer will NOT be informed about this: the stream is closed without sending a FIN or RST. -func (s *sendStream) closeForShutdown(err error) { - s.mutex.Lock() - s.closedForShutdown = true - s.closeForShutdownErr = err - s.mutex.Unlock() - s.signalWrite() - s.ctxCancel() -} - -// signalWrite performs a non-blocking send on the writeChan -func (s *sendStream) signalWrite() { - select { - case s.writeChan <- struct{}{}: - default: - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/server.go b/vendor/github.com/lucas-clemente/quic-go/server.go deleted file mode 100644 index fe2f9388..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/server.go +++ /dev/null @@ -1,558 +0,0 @@ -package quic - -import ( - "bytes" - "crypto/tls" - "errors" - "fmt" - "io" - "net" - "sync" - "sync/atomic" - "time" - - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -// packetHandler handles packets -type packetHandler interface { - handlePacket(*receivedPacket) - io.Closer - destroy(error) - getPerspective() protocol.Perspective -} - -type unknownPacketHandler interface { - handlePacket(*receivedPacket) - closeWithError(error) error -} - -type packetHandlerManager interface { - io.Closer - Add(protocol.ConnectionID, packetHandler) - Retire(protocol.ConnectionID) - Remove(protocol.ConnectionID) - AddResetToken([16]byte, packetHandler) - RemoveResetToken([16]byte) - GetStatelessResetToken(protocol.ConnectionID) [16]byte - SetServer(unknownPacketHandler) - CloseServer() -} - -type quicSession interface { - Session - handlePacket(*receivedPacket) - GetVersion() protocol.VersionNumber - getPerspective() protocol.Perspective - run() error - destroy(error) - closeForRecreating() protocol.PacketNumber - closeRemote(error) -} - -type sessionRunner interface { - OnHandshakeComplete(Session) - Retire(protocol.ConnectionID) - Remove(protocol.ConnectionID) - AddResetToken([16]byte, packetHandler) - RemoveResetToken([16]byte) -} - -type runner struct { - packetHandlerManager - - onHandshakeCompleteImpl func(Session) -} - -func (r *runner) OnHandshakeComplete(s Session) { r.onHandshakeCompleteImpl(s) } - -var _ sessionRunner = &runner{} - -// A Listener of QUIC -type server struct { - mutex sync.Mutex - - tlsConf *tls.Config - config *Config - - conn net.PacketConn - // If the server is started with ListenAddr, we create a packet conn. - // If it is started with Listen, we take a packet conn as a parameter. - createdPacketConn bool - - cookieGenerator *handshake.CookieGenerator - - sessionHandler packetHandlerManager - - // set as a member, so they can be set in the tests - newSession func(connection, sessionRunner, protocol.ConnectionID /* original connection ID */, protocol.ConnectionID /* destination connection ID */, protocol.ConnectionID /* source connection ID */, *Config, *tls.Config, *handshake.TransportParameters, utils.Logger, protocol.VersionNumber) (quicSession, error) - - serverError error - errorChan chan struct{} - closed bool - - sessionQueue chan Session - sessionQueueLen int32 // to be used as an atomic - - sessionRunner sessionRunner - - logger utils.Logger -} - -var _ Listener = &server{} -var _ unknownPacketHandler = &server{} - -// ListenAddr creates a QUIC server listening on a given address. -// The tls.Config must not be nil and must contain a certificate configuration. -// The quic.Config may be nil, in that case the default values will be used. -func ListenAddr(addr string, tlsConf *tls.Config, config *Config) (Listener, error) { - udpAddr, err := net.ResolveUDPAddr("udp", addr) - if err != nil { - return nil, err - } - conn, err := net.ListenUDP("udp", udpAddr) - if err != nil { - return nil, err - } - serv, err := listen(conn, tlsConf, config) - if err != nil { - return nil, err - } - serv.createdPacketConn = true - return serv, nil -} - -// Listen listens for QUIC connections on a given net.PacketConn. -// A single PacketConn only be used for a single call to Listen. -// The PacketConn can be used for simultaneous calls to Dial. -// QUIC connection IDs are used for demultiplexing the different connections. -// The tls.Config must not be nil and must contain a certificate configuration. -// The quic.Config may be nil, in that case the default values will be used. -func Listen(conn net.PacketConn, tlsConf *tls.Config, config *Config) (Listener, error) { - return listen(conn, tlsConf, config) -} - -func listen(conn net.PacketConn, tlsConf *tls.Config, config *Config) (*server, error) { - // TODO(#1655): only require that tls.Config.Certificates or tls.Config.GetCertificate is set - if tlsConf == nil || len(tlsConf.Certificates) == 0 { - return nil, errors.New("quic: Certificates not set in tls.Config") - } - config = populateServerConfig(config) - for _, v := range config.Versions { - if !protocol.IsValidVersion(v) { - return nil, fmt.Errorf("%s is not a valid QUIC version", v) - } - } - - sessionHandler, err := getMultiplexer().AddConn(conn, config.ConnectionIDLength, config.StatelessResetKey) - if err != nil { - return nil, err - } - s := &server{ - conn: conn, - tlsConf: tlsConf, - config: config, - sessionHandler: sessionHandler, - sessionQueue: make(chan Session), - errorChan: make(chan struct{}), - newSession: newSession, - logger: utils.DefaultLogger.WithPrefix("server"), - } - if err := s.setup(); err != nil { - return nil, err - } - sessionHandler.SetServer(s) - s.logger.Debugf("Listening for %s connections on %s", conn.LocalAddr().Network(), conn.LocalAddr().String()) - return s, nil -} - -func (s *server) setup() error { - s.sessionRunner = &runner{ - packetHandlerManager: s.sessionHandler, - onHandshakeCompleteImpl: func(sess Session) { - go func() { - atomic.AddInt32(&s.sessionQueueLen, 1) - defer atomic.AddInt32(&s.sessionQueueLen, -1) - select { - case s.sessionQueue <- sess: - // blocks until the session is accepted - case <-sess.Context().Done(): - // don't pass sessions that were already closed to Accept() - } - }() - }, - } - cookieGenerator, err := handshake.NewCookieGenerator() - if err != nil { - return err - } - s.cookieGenerator = cookieGenerator - return nil -} - -var defaultAcceptCookie = func(clientAddr net.Addr, cookie *Cookie) bool { - if cookie == nil { - return false - } - if time.Now().After(cookie.SentTime.Add(protocol.CookieExpiryTime)) { - return false - } - var sourceAddr string - if udpAddr, ok := clientAddr.(*net.UDPAddr); ok { - sourceAddr = udpAddr.IP.String() - } else { - sourceAddr = clientAddr.String() - } - return sourceAddr == cookie.RemoteAddr -} - -// populateServerConfig populates fields in the quic.Config with their default values, if none are set -// it may be called with nil -func populateServerConfig(config *Config) *Config { - if config == nil { - config = &Config{} - } - versions := config.Versions - if len(versions) == 0 { - versions = protocol.SupportedVersions - } - - vsa := defaultAcceptCookie - if config.AcceptCookie != nil { - vsa = config.AcceptCookie - } - - handshakeTimeout := protocol.DefaultHandshakeTimeout - if config.HandshakeTimeout != 0 { - handshakeTimeout = config.HandshakeTimeout - } - idleTimeout := protocol.DefaultIdleTimeout - if config.IdleTimeout != 0 { - idleTimeout = config.IdleTimeout - } - - maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow - if maxReceiveStreamFlowControlWindow == 0 { - maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow - } - maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow - if maxReceiveConnectionFlowControlWindow == 0 { - maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow - } - maxIncomingStreams := config.MaxIncomingStreams - if maxIncomingStreams == 0 { - maxIncomingStreams = protocol.DefaultMaxIncomingStreams - } else if maxIncomingStreams < 0 { - maxIncomingStreams = 0 - } - maxIncomingUniStreams := config.MaxIncomingUniStreams - if maxIncomingUniStreams == 0 { - maxIncomingUniStreams = protocol.DefaultMaxIncomingUniStreams - } else if maxIncomingUniStreams < 0 { - maxIncomingUniStreams = 0 - } - connIDLen := config.ConnectionIDLength - if connIDLen == 0 { - connIDLen = protocol.DefaultConnectionIDLength - } - - return &Config{ - Versions: versions, - HandshakeTimeout: handshakeTimeout, - IdleTimeout: idleTimeout, - AcceptCookie: vsa, - KeepAlive: config.KeepAlive, - MaxReceiveStreamFlowControlWindow: maxReceiveStreamFlowControlWindow, - MaxReceiveConnectionFlowControlWindow: maxReceiveConnectionFlowControlWindow, - MaxIncomingStreams: maxIncomingStreams, - MaxIncomingUniStreams: maxIncomingUniStreams, - ConnectionIDLength: connIDLen, - StatelessResetKey: config.StatelessResetKey, - } -} - -// Accept returns newly openend sessions -func (s *server) Accept() (Session, error) { - var sess Session - select { - case sess = <-s.sessionQueue: - return sess, nil - case <-s.errorChan: - return nil, s.serverError - } -} - -// Close the server -func (s *server) Close() error { - s.mutex.Lock() - defer s.mutex.Unlock() - if s.closed { - return nil - } - return s.closeWithMutex() -} - -func (s *server) closeWithMutex() error { - s.sessionHandler.CloseServer() - if s.serverError == nil { - s.serverError = errors.New("server closed") - } - var err error - // If the server was started with ListenAddr, we created the packet conn. - // We need to close it in order to make the go routine reading from that conn return. - if s.createdPacketConn { - err = s.sessionHandler.Close() - } - s.closed = true - close(s.errorChan) - return err -} - -func (s *server) closeWithError(e error) error { - s.mutex.Lock() - defer s.mutex.Unlock() - if s.closed { - return nil - } - s.serverError = e - return s.closeWithMutex() -} - -// Addr returns the server's network address -func (s *server) Addr() net.Addr { - return s.conn.LocalAddr() -} - -func (s *server) handlePacket(p *receivedPacket) { - go func() { - if shouldReleaseBuffer := s.handlePacketImpl(p); !shouldReleaseBuffer { - p.buffer.Release() - } - }() -} - -func (s *server) handlePacketImpl(p *receivedPacket) bool /* was the packet passed on to a session */ { - if len(p.data) < protocol.MinInitialPacketSize { - s.logger.Debugf("Dropping a packet that is too small to be a valid Initial (%d bytes)", len(p.data)) - return false - } - // If we're creating a new session, the packet will be passed to the session. - // The header will then be parsed again. - hdr, _, _, err := wire.ParsePacket(p.data, s.config.ConnectionIDLength) - if err != nil { - s.logger.Debugf("Error parsing packet: %s", err) - return false - } - // Short header packets should never end up here in the first place - if !hdr.IsLongHeader { - return false - } - // send a Version Negotiation Packet if the client is speaking a different protocol version - if !protocol.IsSupportedVersion(s.config.Versions, hdr.Version) { - s.sendVersionNegotiationPacket(p, hdr) - return false - } - if hdr.IsLongHeader && hdr.Type != protocol.PacketTypeInitial { - // Drop long header packets. - // There's litte point in sending a Stateless Reset, since the client - // might not have received the token yet. - return false - } - - s.logger.Debugf("<- Received Initial packet.") - - sess, connID, err := s.handleInitialImpl(p, hdr) - if err != nil { - s.logger.Errorf("Error occurred handling initial packet: %s", err) - return false - } - if sess == nil { // a retry was done, or the connection attempt was rejected - return false - } - // Don't put the packet buffer back if a new session was created. - // The session will handle the packet and take of that. - s.sessionHandler.Add(connID, sess) - return true -} - -func (s *server) handleInitialImpl(p *receivedPacket, hdr *wire.Header) (quicSession, protocol.ConnectionID, error) { - if len(hdr.Token) == 0 && hdr.DestConnectionID.Len() < protocol.MinConnectionIDLenInitial { - return nil, nil, errors.New("too short connection ID") - } - - var cookie *Cookie - var origDestConnectionID protocol.ConnectionID - if len(hdr.Token) > 0 { - c, err := s.cookieGenerator.DecodeToken(hdr.Token) - if err == nil { - cookie = &Cookie{ - RemoteAddr: c.RemoteAddr, - SentTime: c.SentTime, - } - origDestConnectionID = c.OriginalDestConnectionID - } - } - if !s.config.AcceptCookie(p.remoteAddr, cookie) { - // Log the Initial packet now. - // If no Retry is sent, the packet will be logged by the session. - (&wire.ExtendedHeader{Header: *hdr}).Log(s.logger) - return nil, nil, s.sendRetry(p.remoteAddr, hdr) - } - - if queueLen := atomic.LoadInt32(&s.sessionQueueLen); queueLen >= protocol.MaxAcceptQueueSize { - s.logger.Debugf("Rejecting new connection. Server currently busy. Accept queue length: %d (max %d)", queueLen, protocol.MaxAcceptQueueSize) - return nil, nil, s.sendServerBusy(p.remoteAddr, hdr) - } - - connID, err := protocol.GenerateConnectionID(s.config.ConnectionIDLength) - if err != nil { - return nil, nil, err - } - s.logger.Debugf("Changing connection ID to %s.", connID) - sess, err := s.createNewSession( - p.remoteAddr, - origDestConnectionID, - hdr.DestConnectionID, - hdr.SrcConnectionID, - connID, - hdr.Version, - ) - if err != nil { - return nil, nil, err - } - sess.handlePacket(p) - return sess, connID, nil -} - -func (s *server) createNewSession( - remoteAddr net.Addr, - origDestConnID protocol.ConnectionID, - clientDestConnID protocol.ConnectionID, - destConnID protocol.ConnectionID, - srcConnID protocol.ConnectionID, - version protocol.VersionNumber, -) (quicSession, error) { - token := s.sessionHandler.GetStatelessResetToken(srcConnID) - params := &handshake.TransportParameters{ - InitialMaxStreamDataBidiLocal: protocol.InitialMaxStreamData, - InitialMaxStreamDataBidiRemote: protocol.InitialMaxStreamData, - InitialMaxStreamDataUni: protocol.InitialMaxStreamData, - InitialMaxData: protocol.InitialMaxData, - IdleTimeout: s.config.IdleTimeout, - MaxBidiStreams: uint64(s.config.MaxIncomingStreams), - MaxUniStreams: uint64(s.config.MaxIncomingUniStreams), - AckDelayExponent: protocol.AckDelayExponent, - DisableMigration: true, - StatelessResetToken: &token, - OriginalConnectionID: origDestConnID, - } - sess, err := s.newSession( - &conn{pconn: s.conn, currentAddr: remoteAddr}, - s.sessionRunner, - clientDestConnID, - destConnID, - srcConnID, - s.config, - s.tlsConf, - params, - s.logger, - version, - ) - if err != nil { - return nil, err - } - go sess.run() - return sess, nil -} - -func (s *server) sendRetry(remoteAddr net.Addr, hdr *wire.Header) error { - token, err := s.cookieGenerator.NewToken(remoteAddr, hdr.DestConnectionID) - if err != nil { - return err - } - connID, err := protocol.GenerateConnectionID(s.config.ConnectionIDLength) - if err != nil { - return err - } - replyHdr := &wire.ExtendedHeader{} - replyHdr.IsLongHeader = true - replyHdr.Type = protocol.PacketTypeRetry - replyHdr.Version = hdr.Version - replyHdr.SrcConnectionID = connID - replyHdr.DestConnectionID = hdr.SrcConnectionID - replyHdr.OrigDestConnectionID = hdr.DestConnectionID - replyHdr.Token = token - s.logger.Debugf("Changing connection ID to %s.\n-> Sending Retry", connID) - replyHdr.Log(s.logger) - buf := &bytes.Buffer{} - if err := replyHdr.Write(buf, hdr.Version); err != nil { - return err - } - if _, err := s.conn.WriteTo(buf.Bytes(), remoteAddr); err != nil { - s.logger.Debugf("Error sending Retry: %s", err) - } - return nil -} - -func (s *server) sendServerBusy(remoteAddr net.Addr, hdr *wire.Header) error { - sealer, _, err := handshake.NewInitialAEAD(hdr.DestConnectionID, protocol.PerspectiveServer) - if err != nil { - return err - } - packetBuffer := getPacketBuffer() - defer packetBuffer.Release() - buf := bytes.NewBuffer(packetBuffer.Slice[:0]) - - ccf := &wire.ConnectionCloseFrame{ErrorCode: qerr.ServerBusy} - - replyHdr := &wire.ExtendedHeader{} - replyHdr.IsLongHeader = true - replyHdr.Type = protocol.PacketTypeInitial - replyHdr.Version = hdr.Version - replyHdr.SrcConnectionID = hdr.DestConnectionID - replyHdr.DestConnectionID = hdr.SrcConnectionID - replyHdr.PacketNumberLen = protocol.PacketNumberLen4 - replyHdr.Length = 4 /* packet number len */ + ccf.Length(hdr.Version) + protocol.ByteCount(sealer.Overhead()) - if err := replyHdr.Write(buf, hdr.Version); err != nil { - return err - } - payloadOffset := buf.Len() - - if err := ccf.Write(buf, hdr.Version); err != nil { - return err - } - - raw := buf.Bytes() - _ = sealer.Seal(raw[payloadOffset:payloadOffset], raw[payloadOffset:], replyHdr.PacketNumber, raw[:payloadOffset]) - raw = raw[0 : buf.Len()+sealer.Overhead()] - - pnOffset := payloadOffset - int(replyHdr.PacketNumberLen) - sealer.EncryptHeader( - raw[pnOffset+4:pnOffset+4+16], - &raw[0], - raw[pnOffset:payloadOffset], - ) - - replyHdr.Log(s.logger) - wire.LogFrame(s.logger, ccf, true) - if _, err := s.conn.WriteTo(raw, remoteAddr); err != nil { - s.logger.Debugf("Error rejecting connection: %s", err) - } - return nil -} - -func (s *server) sendVersionNegotiationPacket(p *receivedPacket, hdr *wire.Header) { - s.logger.Debugf("Client offered version %s, sending Version Negotiation", hdr.Version) - data, err := wire.ComposeVersionNegotiation(hdr.SrcConnectionID, hdr.DestConnectionID, s.config.Versions) - if err != nil { - s.logger.Debugf("Error composing Version Negotiation: %s", err) - return - } - if _, err := s.conn.WriteTo(data, p.remoteAddr); err != nil { - s.logger.Debugf("Error sending Version Negotiation: %s", err) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/session.go b/vendor/github.com/lucas-clemente/quic-go/session.go deleted file mode 100644 index ba1f5566..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/session.go +++ /dev/null @@ -1,1287 +0,0 @@ -package quic - -import ( - "bytes" - "context" - "crypto/tls" - "errors" - "fmt" - "io" - "net" - "reflect" - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/ackhandler" - "github.com/lucas-clemente/quic-go/internal/congestion" - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/utils" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type unpacker interface { - Unpack(hdr *wire.Header, data []byte) (*unpackedPacket, error) -} - -type streamGetter interface { - GetOrOpenReceiveStream(protocol.StreamID) (receiveStreamI, error) - GetOrOpenSendStream(protocol.StreamID) (sendStreamI, error) -} - -type streamManager interface { - GetOrOpenSendStream(protocol.StreamID) (sendStreamI, error) - GetOrOpenReceiveStream(protocol.StreamID) (receiveStreamI, error) - OpenStream() (Stream, error) - OpenUniStream() (SendStream, error) - OpenStreamSync() (Stream, error) - OpenUniStreamSync() (SendStream, error) - AcceptStream() (Stream, error) - AcceptUniStream() (ReceiveStream, error) - DeleteStream(protocol.StreamID) error - UpdateLimits(*handshake.TransportParameters) error - HandleMaxStreamsFrame(*wire.MaxStreamsFrame) error - CloseWithError(error) -} - -type cryptoStreamHandler interface { - RunHandshake() error - ChangeConnectionID(protocol.ConnectionID) error - io.Closer - ConnectionState() tls.ConnectionState -} - -type receivedPacket struct { - remoteAddr net.Addr - rcvTime time.Time - data []byte - - buffer *packetBuffer -} - -func (p *receivedPacket) Clone() *receivedPacket { - return &receivedPacket{ - remoteAddr: p.remoteAddr, - rcvTime: p.rcvTime, - data: p.data, - buffer: p.buffer, - } -} - -type closeError struct { - err error - remote bool - sendClose bool -} - -var errCloseForRecreating = errors.New("closing session in order to recreate it") - -// A Session is a QUIC session -type session struct { - sessionRunner sessionRunner - - destConnID protocol.ConnectionID - origDestConnID protocol.ConnectionID // if the server sends a Retry, this is the connection ID we used initially - srcConnID protocol.ConnectionID - - perspective protocol.Perspective - initialVersion protocol.VersionNumber // if version negotiation is performed, this is the version we initially tried - version protocol.VersionNumber - config *Config - - conn connection - - streamsMap streamManager - - rttStats *congestion.RTTStats - - cryptoStreamManager *cryptoStreamManager - sentPacketHandler ackhandler.SentPacketHandler - receivedPacketHandler ackhandler.ReceivedPacketHandler - framer framer - windowUpdateQueue *windowUpdateQueue - connFlowController flowcontrol.ConnectionFlowController - - unpacker unpacker - frameParser wire.FrameParser - packer packer - - cryptoStreamHandler cryptoStreamHandler - - receivedPackets chan *receivedPacket - sendingScheduled chan struct{} - - closeOnce sync.Once - closed utils.AtomicBool - // closeChan is used to notify the run loop that it should terminate - closeChan chan closeError - connectionClosePacket *packedPacket - packetsReceivedAfterClose int - - ctx context.Context - ctxCancel context.CancelFunc - - undecryptablePackets []*receivedPacket - - clientHelloWritten <-chan struct{} - handshakeCompleteChan chan struct{} // is closed when the handshake completes - handshakeComplete bool - - receivedRetry bool - receivedFirstPacket bool - receivedFirstForwardSecurePacket bool - - sessionCreationTime time.Time - // The idle timeout is set based on the max of the time we received the last packet... - lastPacketReceivedTime time.Time - // ... and the time we sent a new retransmittable packet after receiving a packet. - firstRetransmittablePacketAfterIdleSentTime time.Time - // pacingDeadline is the time when the next packet should be sent - pacingDeadline time.Time - - peerParams *handshake.TransportParameters - - timer *utils.Timer - // keepAlivePingSent stores whether a Ping frame was sent to the peer or not - // it is reset as soon as we receive a packet from the peer - keepAlivePingSent bool - - logger utils.Logger -} - -var _ Session = &session{} -var _ streamSender = &session{} - -var newSession = func( - conn connection, - runner sessionRunner, - clientDestConnID protocol.ConnectionID, - destConnID protocol.ConnectionID, - srcConnID protocol.ConnectionID, - conf *Config, - tlsConf *tls.Config, - params *handshake.TransportParameters, - logger utils.Logger, - v protocol.VersionNumber, -) (quicSession, error) { - s := &session{ - conn: conn, - sessionRunner: runner, - config: conf, - srcConnID: srcConnID, - destConnID: destConnID, - perspective: protocol.PerspectiveServer, - handshakeCompleteChan: make(chan struct{}), - logger: logger, - version: v, - } - s.preSetup() - s.sentPacketHandler = ackhandler.NewSentPacketHandler(0, s.rttStats, s.logger) - s.streamsMap = newStreamsMap( - s, - s.newFlowController, - uint64(s.config.MaxIncomingStreams), - uint64(s.config.MaxIncomingUniStreams), - s.perspective, - s.version, - ) - s.framer = newFramer(s.streamsMap, s.version) - initialStream := newCryptoStream() - handshakeStream := newCryptoStream() - oneRTTStream := newPostHandshakeCryptoStream(s.framer) - cs, err := handshake.NewCryptoSetupServer( - initialStream, - handshakeStream, - oneRTTStream, - clientDestConnID, - conn.RemoteAddr(), - params, - s.processTransportParameters, - tlsConf, - logger, - ) - if err != nil { - return nil, err - } - s.cryptoStreamHandler = cs - s.packer = newPacketPacker( - s.destConnID, - s.srcConnID, - initialStream, - handshakeStream, - s.sentPacketHandler, - s.RemoteAddr(), - cs, - s.framer, - s.receivedPacketHandler, - s.perspective, - s.version, - ) - s.cryptoStreamManager = newCryptoStreamManager(cs, initialStream, handshakeStream, oneRTTStream) - - if err := s.postSetup(); err != nil { - return nil, err - } - s.unpacker = newPacketUnpacker(cs, s.version) - return s, nil -} - -// declare this as a variable, such that we can it mock it in the tests -var newClientSession = func( - conn connection, - runner sessionRunner, - destConnID protocol.ConnectionID, - srcConnID protocol.ConnectionID, - conf *Config, - tlsConf *tls.Config, - initialPacketNumber protocol.PacketNumber, - params *handshake.TransportParameters, - initialVersion protocol.VersionNumber, - logger utils.Logger, - v protocol.VersionNumber, -) (quicSession, error) { - s := &session{ - conn: conn, - sessionRunner: runner, - config: conf, - srcConnID: srcConnID, - destConnID: destConnID, - perspective: protocol.PerspectiveClient, - handshakeCompleteChan: make(chan struct{}), - logger: logger, - initialVersion: initialVersion, - version: v, - } - s.preSetup() - s.sentPacketHandler = ackhandler.NewSentPacketHandler(initialPacketNumber, s.rttStats, s.logger) - initialStream := newCryptoStream() - handshakeStream := newCryptoStream() - oneRTTStream := newPostHandshakeCryptoStream(s.framer) - cs, clientHelloWritten, err := handshake.NewCryptoSetupClient( - initialStream, - handshakeStream, - oneRTTStream, - s.destConnID, - conn.RemoteAddr(), - params, - s.processTransportParameters, - tlsConf, - logger, - ) - if err != nil { - return nil, err - } - s.clientHelloWritten = clientHelloWritten - s.cryptoStreamHandler = cs - s.cryptoStreamManager = newCryptoStreamManager(cs, initialStream, handshakeStream, oneRTTStream) - s.unpacker = newPacketUnpacker(cs, s.version) - s.streamsMap = newStreamsMap( - s, - s.newFlowController, - uint64(s.config.MaxIncomingStreams), - uint64(s.config.MaxIncomingUniStreams), - s.perspective, - s.version, - ) - s.framer = newFramer(s.streamsMap, s.version) - s.packer = newPacketPacker( - s.destConnID, - s.srcConnID, - initialStream, - handshakeStream, - s.sentPacketHandler, - s.RemoteAddr(), - cs, - s.framer, - s.receivedPacketHandler, - s.perspective, - s.version, - ) - return s, s.postSetup() -} - -func (s *session) preSetup() { - s.frameParser = wire.NewFrameParser(s.version) - s.rttStats = &congestion.RTTStats{} - s.receivedPacketHandler = ackhandler.NewReceivedPacketHandler(s.rttStats, s.logger, s.version) - s.connFlowController = flowcontrol.NewConnectionFlowController( - protocol.InitialMaxData, - protocol.ByteCount(s.config.MaxReceiveConnectionFlowControlWindow), - s.onHasConnectionWindowUpdate, - s.rttStats, - s.logger, - ) -} - -func (s *session) postSetup() error { - s.receivedPackets = make(chan *receivedPacket, protocol.MaxSessionUnprocessedPackets) - s.closeChan = make(chan closeError, 1) - s.sendingScheduled = make(chan struct{}, 1) - s.undecryptablePackets = make([]*receivedPacket, 0, protocol.MaxUndecryptablePackets) - s.ctx, s.ctxCancel = context.WithCancel(context.Background()) - - s.timer = utils.NewTimer() - now := time.Now() - s.lastPacketReceivedTime = now - s.sessionCreationTime = now - - s.windowUpdateQueue = newWindowUpdateQueue(s.streamsMap, s.connFlowController, s.framer.QueueControlFrame) - return nil -} - -// run the session main loop -func (s *session) run() error { - defer s.ctxCancel() - - go func() { - if err := s.cryptoStreamHandler.RunHandshake(); err != nil { - s.closeLocal(err) - return - } - close(s.handshakeCompleteChan) - }() - if s.perspective == protocol.PerspectiveClient { - select { - case <-s.clientHelloWritten: - s.scheduleSending() - case closeErr := <-s.closeChan: - // put the close error back into the channel, so that the run loop can receive it - s.closeChan <- closeErr - } - } - - var closeErr closeError - -runLoop: - for { - // Close immediately if requested - select { - case closeErr = <-s.closeChan: - break runLoop - case <-s.handshakeCompleteChan: - s.handleHandshakeComplete() - default: - } - - s.maybeResetTimer() - - select { - case closeErr = <-s.closeChan: - break runLoop - case <-s.timer.Chan(): - s.timer.SetRead() - // We do all the interesting stuff after the switch statement, so - // nothing to see here. - case <-s.sendingScheduled: - // We do all the interesting stuff after the switch statement, so - // nothing to see here. - case p := <-s.receivedPackets: - // Only reset the timers if this packet was actually processed. - // This avoids modifying any state when handling undecryptable packets, - // which could be injected by an attacker. - if wasProcessed := s.handlePacketImpl(p); !wasProcessed { - continue - } - case <-s.handshakeCompleteChan: - s.handleHandshakeComplete() - } - - now := time.Now() - if timeout := s.sentPacketHandler.GetAlarmTimeout(); !timeout.IsZero() && timeout.Before(now) { - // This could cause packets to be retransmitted. - // Check it before trying to send packets. - if err := s.sentPacketHandler.OnAlarm(); err != nil { - s.closeLocal(err) - } - } - - var pacingDeadline time.Time - if s.pacingDeadline.IsZero() { // the timer didn't have a pacing deadline set - pacingDeadline = s.sentPacketHandler.TimeUntilSend() - } - if s.config.KeepAlive && !s.keepAlivePingSent && s.handshakeComplete && s.firstRetransmittablePacketAfterIdleSentTime.IsZero() && time.Since(s.lastPacketReceivedTime) >= s.peerParams.IdleTimeout/2 { - // send a PING frame since there is no activity in the session - s.logger.Debugf("Sending a keep-alive ping to keep the connection alive.") - s.framer.QueueControlFrame(&wire.PingFrame{}) - s.keepAlivePingSent = true - } else if !pacingDeadline.IsZero() && now.Before(pacingDeadline) { - // If we get to this point before the pacing deadline, we should wait until that deadline. - // This can happen when scheduleSending is called, or a packet is received. - // Set the timer and restart the run loop. - s.pacingDeadline = pacingDeadline - continue - } - - if !s.handshakeComplete && now.Sub(s.sessionCreationTime) >= s.config.HandshakeTimeout { - s.destroy(qerr.TimeoutError("Handshake did not complete in time")) - continue - } - if s.handshakeComplete && now.Sub(s.idleTimeoutStartTime()) >= s.config.IdleTimeout { - s.destroy(qerr.TimeoutError("No recent network activity")) - continue - } - - if err := s.sendPackets(); err != nil { - s.closeLocal(err) - } - } - - s.handleCloseError(closeErr) - s.closed.Set(true) - s.logger.Infof("Connection %s closed.", s.srcConnID) - s.cryptoStreamHandler.Close() - return closeErr.err -} - -func (s *session) Context() context.Context { - return s.ctx -} - -func (s *session) ConnectionState() tls.ConnectionState { - return s.cryptoStreamHandler.ConnectionState() -} - -func (s *session) maybeResetTimer() { - var deadline time.Time - if s.config.KeepAlive && s.handshakeComplete && !s.keepAlivePingSent { - deadline = s.idleTimeoutStartTime().Add(s.peerParams.IdleTimeout / 2) - } else { - deadline = s.idleTimeoutStartTime().Add(s.config.IdleTimeout) - } - - if ackAlarm := s.receivedPacketHandler.GetAlarmTimeout(); !ackAlarm.IsZero() { - deadline = utils.MinTime(deadline, ackAlarm) - } - if lossTime := s.sentPacketHandler.GetAlarmTimeout(); !lossTime.IsZero() { - deadline = utils.MinTime(deadline, lossTime) - } - if !s.handshakeComplete { - handshakeDeadline := s.sessionCreationTime.Add(s.config.HandshakeTimeout) - deadline = utils.MinTime(deadline, handshakeDeadline) - } - if !s.pacingDeadline.IsZero() { - deadline = utils.MinTime(deadline, s.pacingDeadline) - } - - s.timer.Reset(deadline) -} - -func (s *session) idleTimeoutStartTime() time.Time { - return utils.MaxTime(s.lastPacketReceivedTime, s.firstRetransmittablePacketAfterIdleSentTime) -} - -func (s *session) handleHandshakeComplete() { - s.handshakeComplete = true - s.handshakeCompleteChan = nil // prevent this case from ever being selected again - s.sessionRunner.OnHandshakeComplete(s) - - // The client completes the handshake first (after sending the CFIN). - // We need to make sure they learn about the peer completing the handshake, - // in order to stop retransmitting handshake packets. - // They will stop retransmitting handshake packets when receiving the first forward-secure packet. - // We need to make sure that a retransmittable forward-secure packet is sent, - // independent from the application protocol. - if s.perspective == protocol.PerspectiveServer { - s.queueControlFrame(&wire.PingFrame{}) - s.sentPacketHandler.SetHandshakeComplete() - } -} - -func (s *session) handlePacketImpl(rp *receivedPacket) bool { - var counter uint8 - var lastConnID protocol.ConnectionID - var processed bool - data := rp.data - p := rp - for len(data) > 0 { - if counter > 0 { - p = p.Clone() - p.data = data - } - - hdr, packetData, rest, err := wire.ParsePacket(p.data, s.srcConnID.Len()) - if err != nil { - s.logger.Debugf("error parsing packet: %s", err) - break - } - - if counter > 0 && !hdr.DestConnectionID.Equal(lastConnID) { - s.logger.Debugf("coalesced packet has different destination connection ID: %s, expected %s", hdr.DestConnectionID, lastConnID) - break - } - lastConnID = hdr.DestConnectionID - - if counter > 0 { - p.buffer.Split() - } - counter++ - - // only log if this actually a coalesced packet - if s.logger.Debug() && (counter > 1 || len(rest) > 0) { - s.logger.Debugf("Parsed a coalesced packet. Part %d: %d bytes. Remaining: %d bytes.", counter, len(packetData), len(rest)) - } - p.data = packetData - if wasProcessed := s.handleSinglePacket(p, hdr); wasProcessed { - processed = true - } - data = rest - } - p.buffer.MaybeRelease() - return processed -} - -func (s *session) handleSinglePacket(p *receivedPacket, hdr *wire.Header) bool /* was the packet successfully processed */ { - var wasQueued bool - - defer func() { - // Put back the packet buffer if the packet wasn't queued for later decryption. - if !wasQueued { - p.buffer.Decrement() - } - }() - - if hdr.Type == protocol.PacketTypeRetry { - return s.handleRetryPacket(p, hdr) - } - - // The server can change the source connection ID with the first Handshake packet. - // After this, all packets with a different source connection have to be ignored. - if s.receivedFirstPacket && hdr.IsLongHeader && !hdr.SrcConnectionID.Equal(s.destConnID) { - s.logger.Debugf("Dropping packet with unexpected source connection ID: %s (expected %s)", hdr.SrcConnectionID, s.destConnID) - return false - } - // drop 0-RTT packets - if hdr.Type == protocol.PacketType0RTT { - return false - } - - packet, err := s.unpacker.Unpack(hdr, p.data) - if err != nil { - if err == handshake.ErrOpenerNotYetAvailable { - // Sealer for this encryption level not yet available. - // Try again later. - wasQueued = true - s.tryQueueingUndecryptablePacket(p) - return false - } - // This might be a packet injected by an attacker. - // Drop it. - s.logger.Debugf("Dropping packet that could not be unpacked. Unpack error: %s", err) - return false - } - - if s.logger.Debug() { - s.logger.Debugf("<- Reading packet %#x (%d bytes) for connection %s, %s", packet.packetNumber, len(p.data), hdr.DestConnectionID, packet.encryptionLevel) - packet.hdr.Log(s.logger) - } - - if err := s.handleUnpackedPacket(packet, p.rcvTime); err != nil { - s.closeLocal(err) - return false - } - return true -} - -func (s *session) handleRetryPacket(p *receivedPacket, hdr *wire.Header) bool /* was this a valid Retry */ { - if s.perspective == protocol.PerspectiveServer { - s.logger.Debugf("Ignoring Retry.") - return false - } - if s.receivedFirstPacket { - s.logger.Debugf("Ignoring Retry, since we already received a packet.") - return false - } - (&wire.ExtendedHeader{Header: *hdr}).Log(s.logger) - if !hdr.OrigDestConnectionID.Equal(s.destConnID) { - s.logger.Debugf("Ignoring spoofed Retry. Original Destination Connection ID: %s, expected: %s", hdr.OrigDestConnectionID, s.destConnID) - return false - } - if hdr.SrcConnectionID.Equal(s.destConnID) { - s.logger.Debugf("Ignoring Retry, since the server didn't change the Source Connection ID.") - return false - } - // If a token is already set, this means that we already received a Retry from the server. - // Ignore this Retry packet. - if s.receivedRetry { - s.logger.Debugf("Ignoring Retry, since a Retry was already received.") - return false - } - s.logger.Debugf("<- Received Retry") - s.logger.Debugf("Switching destination connection ID to: %s", hdr.SrcConnectionID) - s.origDestConnID = s.destConnID - s.destConnID = hdr.SrcConnectionID - s.receivedRetry = true - if err := s.sentPacketHandler.ResetForRetry(); err != nil { - s.closeLocal(err) - return false - } - s.cryptoStreamHandler.ChangeConnectionID(s.destConnID) - s.packer.SetToken(hdr.Token) - s.packer.ChangeDestConnectionID(s.destConnID) - s.scheduleSending() - return true -} - -func (s *session) handleUnpackedPacket(packet *unpackedPacket, rcvTime time.Time) error { - if len(packet.data) == 0 { - return qerr.Error(qerr.ProtocolViolation, "empty packet") - } - - // The server can change the source connection ID with the first Handshake packet. - if s.perspective == protocol.PerspectiveClient && !s.receivedFirstPacket && packet.hdr.IsLongHeader && !packet.hdr.SrcConnectionID.Equal(s.destConnID) { - s.logger.Debugf("Received first packet. Switching destination connection ID to: %s", packet.hdr.SrcConnectionID) - s.destConnID = packet.hdr.SrcConnectionID - s.packer.ChangeDestConnectionID(s.destConnID) - } - - s.receivedFirstPacket = true - s.lastPacketReceivedTime = rcvTime - s.firstRetransmittablePacketAfterIdleSentTime = time.Time{} - s.keepAlivePingSent = false - - // The client completes the handshake first (after sending the CFIN). - // We know that the server completed the handshake as soon as we receive a forward-secure packet. - if s.perspective == protocol.PerspectiveClient { - if !s.receivedFirstForwardSecurePacket && packet.encryptionLevel == protocol.Encryption1RTT { - s.receivedFirstForwardSecurePacket = true - s.sentPacketHandler.SetHandshakeComplete() - } - } - - r := bytes.NewReader(packet.data) - var isRetransmittable bool - for { - frame, err := s.frameParser.ParseNext(r, packet.encryptionLevel) - if err != nil { - return err - } - if frame == nil { - break - } - if ackhandler.IsFrameRetransmittable(frame) { - isRetransmittable = true - } - if err := s.handleFrame(frame, packet.packetNumber, packet.encryptionLevel); err != nil { - return err - } - } - - if err := s.receivedPacketHandler.ReceivedPacket(packet.packetNumber, packet.encryptionLevel, rcvTime, isRetransmittable); err != nil { - return err - } - return nil -} - -func (s *session) handleFrame(f wire.Frame, pn protocol.PacketNumber, encLevel protocol.EncryptionLevel) error { - var err error - wire.LogFrame(s.logger, f, false) - switch frame := f.(type) { - case *wire.CryptoFrame: - err = s.handleCryptoFrame(frame, encLevel) - case *wire.StreamFrame: - err = s.handleStreamFrame(frame, encLevel) - case *wire.AckFrame: - err = s.handleAckFrame(frame, pn, encLevel) - case *wire.ConnectionCloseFrame: - s.closeRemote(qerr.Error(frame.ErrorCode, frame.ReasonPhrase)) - case *wire.ResetStreamFrame: - err = s.handleResetStreamFrame(frame) - case *wire.MaxDataFrame: - s.handleMaxDataFrame(frame) - case *wire.MaxStreamDataFrame: - err = s.handleMaxStreamDataFrame(frame) - case *wire.MaxStreamsFrame: - err = s.handleMaxStreamsFrame(frame) - case *wire.DataBlockedFrame: - case *wire.StreamDataBlockedFrame: - case *wire.StreamsBlockedFrame: - case *wire.StopSendingFrame: - err = s.handleStopSendingFrame(frame) - case *wire.PingFrame: - case *wire.PathChallengeFrame: - s.handlePathChallengeFrame(frame) - case *wire.PathResponseFrame: - // since we don't send PATH_CHALLENGEs, we don't expect PATH_RESPONSEs - err = errors.New("unexpected PATH_RESPONSE frame") - case *wire.NewTokenFrame: - case *wire.NewConnectionIDFrame: - case *wire.RetireConnectionIDFrame: - // since we don't send new connection IDs, we don't expect retirements - err = errors.New("unexpected RETIRE_CONNECTION_ID frame") - default: - err = fmt.Errorf("unexpected frame type: %s", reflect.ValueOf(&frame).Elem().Type().Name()) - } - return err -} - -// handlePacket is called by the server with a new packet -func (s *session) handlePacket(p *receivedPacket) { - if s.closed.Get() { - s.handlePacketAfterClosed(p) - } - // Discard packets once the amount of queued packets is larger than - // the channel size, protocol.MaxSessionUnprocessedPackets - select { - case s.receivedPackets <- p: - default: - } -} - -func (s *session) handlePacketAfterClosed(p *receivedPacket) { - s.packetsReceivedAfterClose++ - if s.connectionClosePacket == nil { - return - } - // exponential backoff - // only send a CONNECTION_CLOSE for the 1st, 2nd, 4th, 8th, 16th, ... packet arriving - for n := s.packetsReceivedAfterClose; n > 1; n = n / 2 { - if n%2 != 0 { - return - } - } - s.logger.Debugf("Received %d packets after sending CONNECTION_CLOSE. Retransmitting.", s.packetsReceivedAfterClose) - if err := s.conn.Write(s.connectionClosePacket.raw); err != nil { - s.logger.Debugf("Error retransmitting CONNECTION_CLOSE: %s", err) - } -} - -func (s *session) handleCryptoFrame(frame *wire.CryptoFrame, encLevel protocol.EncryptionLevel) error { - encLevelChanged, err := s.cryptoStreamManager.HandleCryptoFrame(frame, encLevel) - if err != nil { - return err - } - s.logger.Debugf("Handled crypto frame at level %s. encLevelChanged: %t", encLevel, encLevelChanged) - if encLevelChanged { - s.tryDecryptingQueuedPackets() - } - return nil -} - -func (s *session) handleStreamFrame(frame *wire.StreamFrame, encLevel protocol.EncryptionLevel) error { - // TODO(#1261): implement strict rules for frames types in unencrypted packets - if encLevel < protocol.Encryption1RTT { - return qerr.Error(qerr.ProtocolViolation, fmt.Sprintf("received unencrypted stream data on stream %d", frame.StreamID)) - } - str, err := s.streamsMap.GetOrOpenReceiveStream(frame.StreamID) - if err != nil { - return err - } - if str == nil { - // Stream is closed and already garbage collected - // ignore this StreamFrame - return nil - } - return str.handleStreamFrame(frame) -} - -func (s *session) handleMaxDataFrame(frame *wire.MaxDataFrame) { - s.connFlowController.UpdateSendWindow(frame.ByteOffset) -} - -func (s *session) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) error { - str, err := s.streamsMap.GetOrOpenSendStream(frame.StreamID) - if err != nil { - return err - } - if str == nil { - // stream is closed and already garbage collected - return nil - } - str.handleMaxStreamDataFrame(frame) - return nil -} - -func (s *session) handleMaxStreamsFrame(frame *wire.MaxStreamsFrame) error { - return s.streamsMap.HandleMaxStreamsFrame(frame) -} - -func (s *session) handleResetStreamFrame(frame *wire.ResetStreamFrame) error { - str, err := s.streamsMap.GetOrOpenReceiveStream(frame.StreamID) - if err != nil { - return err - } - if str == nil { - // stream is closed and already garbage collected - return nil - } - return str.handleResetStreamFrame(frame) -} - -func (s *session) handleStopSendingFrame(frame *wire.StopSendingFrame) error { - str, err := s.streamsMap.GetOrOpenSendStream(frame.StreamID) - if err != nil { - return err - } - if str == nil { - // stream is closed and already garbage collected - return nil - } - str.handleStopSendingFrame(frame) - return nil -} - -func (s *session) handlePathChallengeFrame(frame *wire.PathChallengeFrame) { - s.queueControlFrame(&wire.PathResponseFrame{Data: frame.Data}) -} - -func (s *session) handleAckFrame(frame *wire.AckFrame, pn protocol.PacketNumber, encLevel protocol.EncryptionLevel) error { - if err := s.sentPacketHandler.ReceivedAck(frame, pn, encLevel, s.lastPacketReceivedTime); err != nil { - return err - } - if encLevel == protocol.Encryption1RTT { - s.receivedPacketHandler.IgnoreBelow(s.sentPacketHandler.GetLowestPacketNotConfirmedAcked()) - } - return nil -} - -// closeLocal closes the session and send a CONNECTION_CLOSE containing the error -func (s *session) closeLocal(e error) { - s.closeOnce.Do(func() { - if e == nil { - s.logger.Infof("Closing session.") - } else { - s.logger.Errorf("Closing session with error: %s", e) - } - s.sessionRunner.Retire(s.srcConnID) - s.closeChan <- closeError{err: e, sendClose: true, remote: false} - }) -} - -// destroy closes the session without sending the error on the wire -func (s *session) destroy(e error) { - s.closeOnce.Do(func() { - if nerr, ok := e.(net.Error); ok && nerr.Timeout() { - s.logger.Errorf("Destroying session %s: %s", s.destConnID, e) - } else { - s.logger.Errorf("Destroying session %s with error: %s", s.destConnID, e) - } - s.sessionRunner.Remove(s.srcConnID) - s.closeChan <- closeError{err: e, sendClose: false, remote: false} - }) -} - -// closeForRecreating closes the session in order to recreate it immediately afterwards -// It returns the first packet number that should be used in the new session. -func (s *session) closeForRecreating() protocol.PacketNumber { - s.destroy(errCloseForRecreating) - nextPN, _ := s.sentPacketHandler.PeekPacketNumber(protocol.EncryptionInitial) - return nextPN -} - -func (s *session) closeRemote(e error) { - s.closeOnce.Do(func() { - s.logger.Errorf("Peer closed session with error: %s", e) - s.sessionRunner.Remove(s.srcConnID) - s.closeChan <- closeError{err: e, remote: true} - }) -} - -// Close the connection. It sends a qerr.NoError. -// It waits until the run loop has stopped before returning -func (s *session) Close() error { - s.closeLocal(nil) - <-s.ctx.Done() - return nil -} - -func (s *session) CloseWithError(code protocol.ApplicationErrorCode, e error) error { - s.closeLocal(qerr.Error(qerr.ErrorCode(code), e.Error())) - <-s.ctx.Done() - return nil -} - -func (s *session) handleCloseError(closeErr closeError) { - if closeErr.err == nil { - closeErr.err = qerr.NoError - } - - var quicErr *qerr.QuicError - var ok bool - if quicErr, ok = closeErr.err.(*qerr.QuicError); !ok { - quicErr = qerr.ToQuicError(closeErr.err) - } - - s.streamsMap.CloseWithError(quicErr) - - if !closeErr.sendClose { - return - } - // If this is a remote close we're done here - if closeErr.remote { - return - } - if err := s.sendConnectionClose(quicErr); err != nil { - s.logger.Debugf("Error sending CONNECTION_CLOSE: %s", err) - } -} - -func (s *session) processTransportParameters(data []byte) { - var params *handshake.TransportParameters - var err error - switch s.perspective { - case protocol.PerspectiveClient: - params, err = s.processTransportParametersForClient(data) - case protocol.PerspectiveServer: - params, err = s.processTransportParametersForServer(data) - } - if err != nil { - s.closeLocal(err) - return - } - s.logger.Debugf("Received Transport Parameters: %s", params) - s.peerParams = params - if err := s.streamsMap.UpdateLimits(params); err != nil { - s.closeLocal(err) - return - } - s.packer.HandleTransportParameters(params) - s.frameParser.SetAckDelayExponent(params.AckDelayExponent) - s.connFlowController.UpdateSendWindow(params.InitialMaxData) - if params.StatelessResetToken != nil { - s.sessionRunner.AddResetToken(*params.StatelessResetToken, s) - } -} - -func (s *session) processTransportParametersForClient(data []byte) (*handshake.TransportParameters, error) { - params := &handshake.TransportParameters{} - if err := params.Unmarshal(data, s.perspective.Opposite()); err != nil { - return nil, err - } - - // check the Retry token - if !params.OriginalConnectionID.Equal(s.origDestConnID) { - return nil, fmt.Errorf("expected original_connection_id to equal %s, is %s", s.origDestConnID, params.OriginalConnectionID) - } - - return params, nil -} - -func (s *session) processTransportParametersForServer(data []byte) (*handshake.TransportParameters, error) { - params := &handshake.TransportParameters{} - if err := params.Unmarshal(data, s.perspective.Opposite()); err != nil { - return nil, err - } - return params, nil -} - -func (s *session) sendPackets() error { - s.pacingDeadline = time.Time{} - - sendMode := s.sentPacketHandler.SendMode() - if sendMode == ackhandler.SendNone { // shortcut: return immediately if there's nothing to send - return nil - } - - numPackets := s.sentPacketHandler.ShouldSendNumPackets() - var numPacketsSent int -sendLoop: - for { - switch sendMode { - case ackhandler.SendNone: - break sendLoop - case ackhandler.SendAck: - // If we already sent packets, and the send mode switches to SendAck, - // we've just become congestion limited. - // There's no need to try to send an ACK at this moment. - if numPacketsSent > 0 { - return nil - } - // We can at most send a single ACK only packet. - // There will only be a new ACK after receiving new packets. - // SendAck is only returned when we're congestion limited, so we don't need to set the pacingt timer. - return s.maybeSendAckOnlyPacket() - case ackhandler.SendPTO: - if err := s.sendProbePacket(); err != nil { - return err - } - numPacketsSent++ - case ackhandler.SendRetransmission: - sentPacket, err := s.maybeSendRetransmission() - if err != nil { - return err - } - if sentPacket { - numPacketsSent++ - // This can happen if a retransmission queued, but it wasn't necessary to send it. - // e.g. when an Initial is queued, but we already received a packet from the server. - } - case ackhandler.SendAny: - sentPacket, err := s.sendPacket() - if err != nil { - return err - } - if !sentPacket { - break sendLoop - } - numPacketsSent++ - default: - return fmt.Errorf("BUG: invalid send mode %d", sendMode) - } - if numPacketsSent >= numPackets { - break - } - sendMode = s.sentPacketHandler.SendMode() - } - // Only start the pacing timer if we sent as many packets as we were allowed. - // There will probably be more to send when calling sendPacket again. - if numPacketsSent == numPackets { - s.pacingDeadline = s.sentPacketHandler.TimeUntilSend() - } - return nil -} - -func (s *session) maybeSendAckOnlyPacket() error { - packet, err := s.packer.MaybePackAckPacket() - if err != nil { - return err - } - if packet == nil { - return nil - } - s.sentPacketHandler.SentPacket(packet.ToAckHandlerPacket()) - return s.sendPackedPacket(packet) -} - -// maybeSendRetransmission sends retransmissions for at most one packet. -// It takes care that Initials aren't retransmitted, if a packet from the server was already received. -func (s *session) maybeSendRetransmission() (bool, error) { - retransmitPacket := s.sentPacketHandler.DequeuePacketForRetransmission() - if retransmitPacket == nil { - return false, nil - } - - s.logger.Debugf("Dequeueing retransmission for packet 0x%x (%s)", retransmitPacket.PacketNumber, retransmitPacket.EncryptionLevel) - packets, err := s.packer.PackRetransmission(retransmitPacket) - if err != nil { - return false, err - } - ackhandlerPackets := make([]*ackhandler.Packet, len(packets)) - for i, packet := range packets { - ackhandlerPackets[i] = packet.ToAckHandlerPacket() - } - s.sentPacketHandler.SentPacketsAsRetransmission(ackhandlerPackets, retransmitPacket.PacketNumber) - for _, packet := range packets { - if err := s.sendPackedPacket(packet); err != nil { - return false, err - } - } - return true, nil -} - -func (s *session) sendProbePacket() error { - p, err := s.sentPacketHandler.DequeueProbePacket() - if err != nil { - return err - } - s.logger.Debugf("Sending a retransmission for %#x as a probe packet.", p.PacketNumber) - - packets, err := s.packer.PackRetransmission(p) - if err != nil { - return err - } - ackhandlerPackets := make([]*ackhandler.Packet, len(packets)) - for i, packet := range packets { - ackhandlerPackets[i] = packet.ToAckHandlerPacket() - } - s.sentPacketHandler.SentPacketsAsRetransmission(ackhandlerPackets, p.PacketNumber) - for _, packet := range packets { - if err := s.sendPackedPacket(packet); err != nil { - return err - } - } - return nil -} - -func (s *session) sendPacket() (bool, error) { - if isBlocked, offset := s.connFlowController.IsNewlyBlocked(); isBlocked { - s.framer.QueueControlFrame(&wire.DataBlockedFrame{DataLimit: offset}) - } - s.windowUpdateQueue.QueueAll() - - packet, err := s.packer.PackPacket() - if err != nil || packet == nil { - return false, err - } - s.sentPacketHandler.SentPacket(packet.ToAckHandlerPacket()) - if err := s.sendPackedPacket(packet); err != nil { - return false, err - } - return true, nil -} - -func (s *session) sendPackedPacket(packet *packedPacket) error { - defer packet.buffer.Release() - if s.firstRetransmittablePacketAfterIdleSentTime.IsZero() && packet.IsRetransmittable() { - s.firstRetransmittablePacketAfterIdleSentTime = time.Now() - } - s.logPacket(packet) - return s.conn.Write(packet.raw) -} - -func (s *session) sendConnectionClose(quicErr *qerr.QuicError) error { - var reason string - // don't send details of crypto errors - if !quicErr.IsCryptoError() { - reason = quicErr.ErrorMessage - } - packet, err := s.packer.PackConnectionClose(&wire.ConnectionCloseFrame{ - ErrorCode: quicErr.ErrorCode, - ReasonPhrase: reason, - }) - if err != nil { - return err - } - s.connectionClosePacket = packet - s.logPacket(packet) - return s.conn.Write(packet.raw) -} - -func (s *session) logPacket(packet *packedPacket) { - if !s.logger.Debug() { - // We don't need to allocate the slices for calling the format functions - return - } - s.logger.Debugf("-> Sending packet 0x%x (%d bytes) for connection %s, %s", packet.header.PacketNumber, len(packet.raw), s.srcConnID, packet.EncryptionLevel()) - packet.header.Log(s.logger) - for _, frame := range packet.frames { - wire.LogFrame(s.logger, frame, true) - } -} - -// GetOrOpenStream either returns an existing stream, a newly opened stream, or nil if a stream with the provided ID is already closed. -// It is *only* needed for gQUIC's H2. -// It will be removed as soon as gQUIC moves towards the IETF H2/QUIC stream mapping. -func (s *session) GetOrOpenStream(id protocol.StreamID) (Stream, error) { - str, err := s.streamsMap.GetOrOpenSendStream(id) - if str != nil { - if bstr, ok := str.(Stream); ok { - return bstr, err - } - return nil, fmt.Errorf("Stream %d is not a bidirectional stream", id) - } - // make sure to return an actual nil value here, not an Stream with value nil - return nil, err -} - -// AcceptStream returns the next stream openend by the peer -func (s *session) AcceptStream() (Stream, error) { - return s.streamsMap.AcceptStream() -} - -func (s *session) AcceptUniStream() (ReceiveStream, error) { - return s.streamsMap.AcceptUniStream() -} - -// OpenStream opens a stream -func (s *session) OpenStream() (Stream, error) { - return s.streamsMap.OpenStream() -} - -func (s *session) OpenStreamSync() (Stream, error) { - return s.streamsMap.OpenStreamSync() -} - -func (s *session) OpenUniStream() (SendStream, error) { - return s.streamsMap.OpenUniStream() -} - -func (s *session) OpenUniStreamSync() (SendStream, error) { - return s.streamsMap.OpenUniStreamSync() -} - -func (s *session) newFlowController(id protocol.StreamID) flowcontrol.StreamFlowController { - var initialSendWindow protocol.ByteCount - if s.peerParams != nil { - if id.Type() == protocol.StreamTypeUni { - initialSendWindow = s.peerParams.InitialMaxStreamDataUni - } else { - if id.InitiatedBy() == s.perspective { - initialSendWindow = s.peerParams.InitialMaxStreamDataBidiRemote - } else { - initialSendWindow = s.peerParams.InitialMaxStreamDataBidiLocal - } - } - } - return flowcontrol.NewStreamFlowController( - id, - s.connFlowController, - protocol.InitialMaxStreamData, - protocol.ByteCount(s.config.MaxReceiveStreamFlowControlWindow), - initialSendWindow, - s.onHasStreamWindowUpdate, - s.rttStats, - s.logger, - ) -} - -// scheduleSending signals that we have data for sending -func (s *session) scheduleSending() { - select { - case s.sendingScheduled <- struct{}{}: - default: - } -} - -func (s *session) tryQueueingUndecryptablePacket(p *receivedPacket) { - if s.handshakeComplete { - s.logger.Debugf("Received undecryptable packet from %s after the handshake (%d bytes)", p.remoteAddr.String(), len(p.data)) - return - } - if len(s.undecryptablePackets)+1 > protocol.MaxUndecryptablePackets { - s.logger.Infof("Dropping undecrytable packet (%d bytes). Undecryptable packet queue full.", len(p.data)) - return - } - s.logger.Infof("Queueing packet (%d bytes) for later decryption", len(p.data)) - s.undecryptablePackets = append(s.undecryptablePackets, p) -} - -func (s *session) tryDecryptingQueuedPackets() { - for _, p := range s.undecryptablePackets { - s.handlePacket(p) - } - s.undecryptablePackets = s.undecryptablePackets[:0] -} - -func (s *session) queueControlFrame(f wire.Frame) { - s.framer.QueueControlFrame(f) - s.scheduleSending() -} - -func (s *session) onHasStreamWindowUpdate(id protocol.StreamID) { - s.windowUpdateQueue.AddStream(id) - s.scheduleSending() -} - -func (s *session) onHasConnectionWindowUpdate() { - s.windowUpdateQueue.AddConnection() - s.scheduleSending() -} - -func (s *session) onHasStreamData(id protocol.StreamID) { - s.framer.AddActiveStream(id) - s.scheduleSending() -} - -func (s *session) onStreamCompleted(id protocol.StreamID) { - if err := s.streamsMap.DeleteStream(id); err != nil { - s.closeLocal(err) - } -} - -func (s *session) LocalAddr() net.Addr { - return s.conn.LocalAddr() -} - -func (s *session) RemoteAddr() net.Addr { - return s.conn.RemoteAddr() -} - -func (s *session) getPerspective() protocol.Perspective { - return s.perspective -} - -func (s *session) GetVersion() protocol.VersionNumber { - return s.version -} diff --git a/vendor/github.com/lucas-clemente/quic-go/stream.go b/vendor/github.com/lucas-clemente/quic-go/stream.go deleted file mode 100644 index dfd0cc6a..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/stream.go +++ /dev/null @@ -1,163 +0,0 @@ -package quic - -import ( - "net" - "sync" - "time" - - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -const errorCodeStopping protocol.ApplicationErrorCode = 0 - -// The streamSender is notified by the stream about various events. -type streamSender interface { - queueControlFrame(wire.Frame) - onHasStreamData(protocol.StreamID) - // must be called without holding the mutex that is acquired by closeForShutdown - onStreamCompleted(protocol.StreamID) -} - -// Each of the both stream halves gets its own uniStreamSender. -// This is necessary in order to keep track when both halves have been completed. -type uniStreamSender struct { - streamSender - onStreamCompletedImpl func() -} - -func (s *uniStreamSender) queueControlFrame(f wire.Frame) { - s.streamSender.queueControlFrame(f) -} - -func (s *uniStreamSender) onHasStreamData(id protocol.StreamID) { - s.streamSender.onHasStreamData(id) -} - -func (s *uniStreamSender) onStreamCompleted(protocol.StreamID) { - s.onStreamCompletedImpl() -} - -var _ streamSender = &uniStreamSender{} - -type streamI interface { - Stream - closeForShutdown(error) - // for receiving - handleStreamFrame(*wire.StreamFrame) error - handleResetStreamFrame(*wire.ResetStreamFrame) error - getWindowUpdate() protocol.ByteCount - // for sending - hasData() bool - handleStopSendingFrame(*wire.StopSendingFrame) - popStreamFrame(maxBytes protocol.ByteCount) (*wire.StreamFrame, bool) - handleMaxStreamDataFrame(*wire.MaxStreamDataFrame) -} - -var _ receiveStreamI = (streamI)(nil) -var _ sendStreamI = (streamI)(nil) - -// A Stream assembles the data from StreamFrames and provides a super-convenient Read-Interface -// -// Read() and Write() may be called concurrently, but multiple calls to Read() or Write() individually must be synchronized manually. -type stream struct { - receiveStream - sendStream - - completedMutex sync.Mutex - sender streamSender - receiveStreamCompleted bool - sendStreamCompleted bool - - version protocol.VersionNumber -} - -var _ Stream = &stream{} - -type deadlineError struct{} - -func (deadlineError) Error() string { return "deadline exceeded" } -func (deadlineError) Temporary() bool { return true } -func (deadlineError) Timeout() bool { return true } - -var errDeadline net.Error = &deadlineError{} - -type streamCanceledError struct { - error - errorCode protocol.ApplicationErrorCode -} - -func (streamCanceledError) Canceled() bool { return true } -func (e streamCanceledError) ErrorCode() protocol.ApplicationErrorCode { return e.errorCode } - -var _ StreamError = &streamCanceledError{} - -// newStream creates a new Stream -func newStream(streamID protocol.StreamID, - sender streamSender, - flowController flowcontrol.StreamFlowController, - version protocol.VersionNumber, -) *stream { - s := &stream{sender: sender, version: version} - senderForSendStream := &uniStreamSender{ - streamSender: sender, - onStreamCompletedImpl: func() { - s.completedMutex.Lock() - s.sendStreamCompleted = true - s.checkIfCompleted() - s.completedMutex.Unlock() - }, - } - s.sendStream = *newSendStream(streamID, senderForSendStream, flowController, version) - senderForReceiveStream := &uniStreamSender{ - streamSender: sender, - onStreamCompletedImpl: func() { - s.completedMutex.Lock() - s.receiveStreamCompleted = true - s.checkIfCompleted() - s.completedMutex.Unlock() - }, - } - s.receiveStream = *newReceiveStream(streamID, senderForReceiveStream, flowController, version) - return s -} - -// need to define StreamID() here, since both receiveStream and readStream have a StreamID() -func (s *stream) StreamID() protocol.StreamID { - // the result is same for receiveStream and sendStream - return s.sendStream.StreamID() -} - -func (s *stream) Close() error { - if err := s.sendStream.Close(); err != nil { - return err - } - return nil -} - -func (s *stream) SetDeadline(t time.Time) error { - _ = s.SetReadDeadline(t) // SetReadDeadline never errors - _ = s.SetWriteDeadline(t) // SetWriteDeadline never errors - return nil -} - -// CloseForShutdown closes a stream abruptly. -// It makes Read and Write unblock (and return the error) immediately. -// The peer will NOT be informed about this: the stream is closed without sending a FIN or RST. -func (s *stream) closeForShutdown(err error) { - s.sendStream.closeForShutdown(err) - s.receiveStream.closeForShutdown(err) -} - -func (s *stream) handleResetStreamFrame(frame *wire.ResetStreamFrame) error { - return s.receiveStream.handleResetStreamFrame(frame) -} - -// checkIfCompleted is called from the uniStreamSender, when one of the stream halves is completed. -// It makes sure that the onStreamCompleted callback is only called if both receive and send side have completed. -func (s *stream) checkIfCompleted() { - if s.sendStreamCompleted && s.receiveStreamCompleted { - s.sender.onStreamCompleted(s.StreamID()) - } -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map.go b/vendor/github.com/lucas-clemente/quic-go/streams_map.go deleted file mode 100644 index 846ece00..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map.go +++ /dev/null @@ -1,192 +0,0 @@ -package quic - -import ( - "errors" - "fmt" - "net" - - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/handshake" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type streamOpenErr struct{ error } - -var _ net.Error = &streamOpenErr{} - -func (e streamOpenErr) Temporary() bool { return e.error == errTooManyOpenStreams } -func (streamOpenErr) Timeout() bool { return false } - -// errTooManyOpenStreams is used internally by the outgoing streams maps. -var errTooManyOpenStreams = errors.New("too many open streams") - -type streamsMap struct { - perspective protocol.Perspective - - sender streamSender - newFlowController func(protocol.StreamID) flowcontrol.StreamFlowController - - outgoingBidiStreams *outgoingBidiStreamsMap - outgoingUniStreams *outgoingUniStreamsMap - incomingBidiStreams *incomingBidiStreamsMap - incomingUniStreams *incomingUniStreamsMap -} - -var _ streamManager = &streamsMap{} - -func newStreamsMap( - sender streamSender, - newFlowController func(protocol.StreamID) flowcontrol.StreamFlowController, - maxIncomingStreams uint64, - maxIncomingUniStreams uint64, - perspective protocol.Perspective, - version protocol.VersionNumber, -) streamManager { - m := &streamsMap{ - perspective: perspective, - newFlowController: newFlowController, - sender: sender, - } - newBidiStream := func(id protocol.StreamID) streamI { - return newStream(id, m.sender, m.newFlowController(id), version) - } - newUniSendStream := func(id protocol.StreamID) sendStreamI { - return newSendStream(id, m.sender, m.newFlowController(id), version) - } - newUniReceiveStream := func(id protocol.StreamID) receiveStreamI { - return newReceiveStream(id, m.sender, m.newFlowController(id), version) - } - m.outgoingBidiStreams = newOutgoingBidiStreamsMap( - protocol.FirstStream(protocol.StreamTypeBidi, perspective), - newBidiStream, - sender.queueControlFrame, - ) - m.incomingBidiStreams = newIncomingBidiStreamsMap( - protocol.FirstStream(protocol.StreamTypeBidi, perspective.Opposite()), - protocol.MaxStreamID(protocol.StreamTypeBidi, maxIncomingStreams, perspective.Opposite()), - maxIncomingStreams, - sender.queueControlFrame, - newBidiStream, - ) - m.outgoingUniStreams = newOutgoingUniStreamsMap( - protocol.FirstStream(protocol.StreamTypeUni, perspective), - newUniSendStream, - sender.queueControlFrame, - ) - m.incomingUniStreams = newIncomingUniStreamsMap( - protocol.FirstStream(protocol.StreamTypeUni, perspective.Opposite()), - protocol.MaxStreamID(protocol.StreamTypeUni, maxIncomingUniStreams, perspective.Opposite()), - maxIncomingUniStreams, - sender.queueControlFrame, - newUniReceiveStream, - ) - return m -} - -func (m *streamsMap) OpenStream() (Stream, error) { - return m.outgoingBidiStreams.OpenStream() -} - -func (m *streamsMap) OpenStreamSync() (Stream, error) { - return m.outgoingBidiStreams.OpenStreamSync() -} - -func (m *streamsMap) OpenUniStream() (SendStream, error) { - return m.outgoingUniStreams.OpenStream() -} - -func (m *streamsMap) OpenUniStreamSync() (SendStream, error) { - return m.outgoingUniStreams.OpenStreamSync() -} - -func (m *streamsMap) AcceptStream() (Stream, error) { - return m.incomingBidiStreams.AcceptStream() -} - -func (m *streamsMap) AcceptUniStream() (ReceiveStream, error) { - return m.incomingUniStreams.AcceptStream() -} - -func (m *streamsMap) DeleteStream(id protocol.StreamID) error { - switch id.Type() { - case protocol.StreamTypeUni: - if id.InitiatedBy() == m.perspective { - return m.outgoingUniStreams.DeleteStream(id) - } - return m.incomingUniStreams.DeleteStream(id) - case protocol.StreamTypeBidi: - if id.InitiatedBy() == m.perspective { - return m.outgoingBidiStreams.DeleteStream(id) - } - return m.incomingBidiStreams.DeleteStream(id) - } - panic("") -} - -func (m *streamsMap) GetOrOpenReceiveStream(id protocol.StreamID) (receiveStreamI, error) { - switch id.Type() { - case protocol.StreamTypeUni: - if id.InitiatedBy() == m.perspective { - // an outgoing unidirectional stream is a send stream, not a receive stream - return nil, fmt.Errorf("peer attempted to open receive stream %d", id) - } - return m.incomingUniStreams.GetOrOpenStream(id) - case protocol.StreamTypeBidi: - if id.InitiatedBy() == m.perspective { - return m.outgoingBidiStreams.GetStream(id) - } - return m.incomingBidiStreams.GetOrOpenStream(id) - } - panic("") -} - -func (m *streamsMap) GetOrOpenSendStream(id protocol.StreamID) (sendStreamI, error) { - switch id.Type() { - case protocol.StreamTypeUni: - if id.InitiatedBy() == m.perspective { - return m.outgoingUniStreams.GetStream(id) - } - // an incoming unidirectional stream is a receive stream, not a send stream - return nil, fmt.Errorf("peer attempted to open send stream %d", id) - case protocol.StreamTypeBidi: - if id.InitiatedBy() == m.perspective { - return m.outgoingBidiStreams.GetStream(id) - } - return m.incomingBidiStreams.GetOrOpenStream(id) - } - panic("") -} - -func (m *streamsMap) HandleMaxStreamsFrame(f *wire.MaxStreamsFrame) error { - if f.MaxStreams > protocol.MaxStreamCount { - return qerr.StreamLimitError - } - id := protocol.MaxStreamID(f.Type, f.MaxStreams, m.perspective) - switch id.Type() { - case protocol.StreamTypeUni: - m.outgoingUniStreams.SetMaxStream(id) - case protocol.StreamTypeBidi: - fmt.Printf("") - m.outgoingBidiStreams.SetMaxStream(id) - } - return nil -} - -func (m *streamsMap) UpdateLimits(p *handshake.TransportParameters) error { - if p.MaxBidiStreams > protocol.MaxStreamCount || p.MaxUniStreams > protocol.MaxStreamCount { - return qerr.StreamLimitError - } - // Max{Uni,Bidi}StreamID returns the highest stream ID that the peer is allowed to open. - m.outgoingBidiStreams.SetMaxStream(protocol.MaxStreamID(protocol.StreamTypeBidi, p.MaxBidiStreams, m.perspective)) - m.outgoingUniStreams.SetMaxStream(protocol.MaxStreamID(protocol.StreamTypeUni, p.MaxUniStreams, m.perspective)) - return nil -} - -func (m *streamsMap) CloseWithError(err error) { - m.outgoingBidiStreams.CloseWithError(err) - m.outgoingUniStreams.CloseWithError(err) - m.incomingBidiStreams.CloseWithError(err) - m.incomingUniStreams.CloseWithError(err) -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_generic_helper.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_generic_helper.go deleted file mode 100644 index 692f093e..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_generic_helper.go +++ /dev/null @@ -1,17 +0,0 @@ -package quic - -import ( - "github.com/cheekybits/genny/generic" - - "github.com/lucas-clemente/quic-go/internal/protocol" -) - -// In the auto-generated streams maps, we need to be able to close the streams. -// Therefore, extend the generic.Type with the stream close method. -// This definition must be in a file that Genny doesn't process. -type item interface { - generic.Type - closeForShutdown(error) -} - -const streamTypeGeneric protocol.StreamType = protocol.StreamTypeUni diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_bidi.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_bidi.go deleted file mode 100644 index 787c3d90..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_bidi.go +++ /dev/null @@ -1,162 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type incomingBidiStreamsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]streamI - // When a stream is deleted before it was accepted, we can't delete it immediately. - // We need to wait until the application accepts it, and delete it immediately then. - streamsToDelete map[protocol.StreamID]struct{} // used as a set - - nextStreamToAccept protocol.StreamID // the next stream that will be returned by AcceptStream() - nextStreamToOpen protocol.StreamID // the highest stream that the peer openend - maxStream protocol.StreamID // the highest stream that the peer is allowed to open - maxNumStreams uint64 // maximum number of streams - - newStream func(protocol.StreamID) streamI - queueMaxStreamID func(*wire.MaxStreamsFrame) - - closeErr error -} - -func newIncomingBidiStreamsMap( - nextStreamToAccept protocol.StreamID, - initialMaxStreamID protocol.StreamID, - maxNumStreams uint64, - queueControlFrame func(wire.Frame), - newStream func(protocol.StreamID) streamI, -) *incomingBidiStreamsMap { - m := &incomingBidiStreamsMap{ - streams: make(map[protocol.StreamID]streamI), - streamsToDelete: make(map[protocol.StreamID]struct{}), - nextStreamToAccept: nextStreamToAccept, - nextStreamToOpen: nextStreamToAccept, - maxStream: initialMaxStreamID, - maxNumStreams: maxNumStreams, - newStream: newStream, - queueMaxStreamID: func(f *wire.MaxStreamsFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *incomingBidiStreamsMap) AcceptStream() (streamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var id protocol.StreamID - var str streamI - for { - id = m.nextStreamToAccept - var ok bool - if m.closeErr != nil { - return nil, m.closeErr - } - str, ok = m.streams[id] - if ok { - break - } - m.cond.Wait() - } - m.nextStreamToAccept += 4 - // If this stream was completed before being accepted, we can delete it now. - if _, ok := m.streamsToDelete[id]; ok { - delete(m.streamsToDelete, id) - if err := m.deleteStream(id); err != nil { - return nil, err - } - } - return str, nil -} - -func (m *incomingBidiStreamsMap) GetOrOpenStream(id protocol.StreamID) (streamI, error) { - m.mutex.RLock() - if id > m.maxStream { - m.mutex.RUnlock() - return nil, fmt.Errorf("peer tried to open stream %d (current limit: %d)", id, m.maxStream) - } - // if the id is smaller than the highest we accepted - // * this stream exists in the map, and we can return it, or - // * this stream was already closed, then we can return the nil - if id < m.nextStreamToOpen { - var s streamI - // If the stream was already queued for deletion, and is just waiting to be accepted, don't return it. - if _, ok := m.streamsToDelete[id]; !ok { - s = m.streams[id] - } - m.mutex.RUnlock() - return s, nil - } - m.mutex.RUnlock() - - m.mutex.Lock() - // no need to check the two error conditions from above again - // * maxStream can only increase, so if the id was valid before, it definitely is valid now - // * highestStream is only modified by this function - for newID := m.nextStreamToOpen; newID <= id; newID += 4 { - m.streams[newID] = m.newStream(newID) - m.cond.Signal() - } - m.nextStreamToOpen = id + 4 - s := m.streams[id] - m.mutex.Unlock() - return s, nil -} - -func (m *incomingBidiStreamsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - return m.deleteStream(id) -} - -func (m *incomingBidiStreamsMap) deleteStream(id protocol.StreamID) error { - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - - // Don't delete this stream yet, if it was not yet accepted. - // Just save it to streamsToDelete map, to make sure it is deleted as soon as it gets accepted. - if id >= m.nextStreamToAccept { - if _, ok := m.streamsToDelete[id]; ok { - return fmt.Errorf("Tried to delete stream %d multiple times", id) - } - m.streamsToDelete[id] = struct{}{} - return nil - } - - delete(m.streams, id) - // queue a MAX_STREAM_ID frame, giving the peer the option to open a new stream - if m.maxNumStreams > uint64(len(m.streams)) { - numNewStreams := m.maxNumStreams - uint64(len(m.streams)) - m.maxStream = m.nextStreamToOpen + protocol.StreamID((numNewStreams-1)*4) - m.queueMaxStreamID(&wire.MaxStreamsFrame{ - Type: protocol.StreamTypeBidi, - MaxStreams: m.maxStream.StreamNum(), - }) - } - return nil -} - -func (m *incomingBidiStreamsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.mutex.Unlock() - m.cond.Broadcast() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_generic.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_generic.go deleted file mode 100644 index 503f0290..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_generic.go +++ /dev/null @@ -1,160 +0,0 @@ -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -//go:generate genny -in $GOFILE -out streams_map_incoming_bidi.go gen "item=streamI Item=BidiStream streamTypeGeneric=protocol.StreamTypeBidi" -//go:generate genny -in $GOFILE -out streams_map_incoming_uni.go gen "item=receiveStreamI Item=UniStream streamTypeGeneric=protocol.StreamTypeUni" -type incomingItemsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]item - // When a stream is deleted before it was accepted, we can't delete it immediately. - // We need to wait until the application accepts it, and delete it immediately then. - streamsToDelete map[protocol.StreamID]struct{} // used as a set - - nextStreamToAccept protocol.StreamID // the next stream that will be returned by AcceptStream() - nextStreamToOpen protocol.StreamID // the highest stream that the peer openend - maxStream protocol.StreamID // the highest stream that the peer is allowed to open - maxNumStreams uint64 // maximum number of streams - - newStream func(protocol.StreamID) item - queueMaxStreamID func(*wire.MaxStreamsFrame) - - closeErr error -} - -func newIncomingItemsMap( - nextStreamToAccept protocol.StreamID, - initialMaxStreamID protocol.StreamID, - maxNumStreams uint64, - queueControlFrame func(wire.Frame), - newStream func(protocol.StreamID) item, -) *incomingItemsMap { - m := &incomingItemsMap{ - streams: make(map[protocol.StreamID]item), - streamsToDelete: make(map[protocol.StreamID]struct{}), - nextStreamToAccept: nextStreamToAccept, - nextStreamToOpen: nextStreamToAccept, - maxStream: initialMaxStreamID, - maxNumStreams: maxNumStreams, - newStream: newStream, - queueMaxStreamID: func(f *wire.MaxStreamsFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *incomingItemsMap) AcceptStream() (item, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var id protocol.StreamID - var str item - for { - id = m.nextStreamToAccept - var ok bool - if m.closeErr != nil { - return nil, m.closeErr - } - str, ok = m.streams[id] - if ok { - break - } - m.cond.Wait() - } - m.nextStreamToAccept += 4 - // If this stream was completed before being accepted, we can delete it now. - if _, ok := m.streamsToDelete[id]; ok { - delete(m.streamsToDelete, id) - if err := m.deleteStream(id); err != nil { - return nil, err - } - } - return str, nil -} - -func (m *incomingItemsMap) GetOrOpenStream(id protocol.StreamID) (item, error) { - m.mutex.RLock() - if id > m.maxStream { - m.mutex.RUnlock() - return nil, fmt.Errorf("peer tried to open stream %d (current limit: %d)", id, m.maxStream) - } - // if the id is smaller than the highest we accepted - // * this stream exists in the map, and we can return it, or - // * this stream was already closed, then we can return the nil - if id < m.nextStreamToOpen { - var s item - // If the stream was already queued for deletion, and is just waiting to be accepted, don't return it. - if _, ok := m.streamsToDelete[id]; !ok { - s = m.streams[id] - } - m.mutex.RUnlock() - return s, nil - } - m.mutex.RUnlock() - - m.mutex.Lock() - // no need to check the two error conditions from above again - // * maxStream can only increase, so if the id was valid before, it definitely is valid now - // * highestStream is only modified by this function - for newID := m.nextStreamToOpen; newID <= id; newID += 4 { - m.streams[newID] = m.newStream(newID) - m.cond.Signal() - } - m.nextStreamToOpen = id + 4 - s := m.streams[id] - m.mutex.Unlock() - return s, nil -} - -func (m *incomingItemsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - return m.deleteStream(id) -} - -func (m *incomingItemsMap) deleteStream(id protocol.StreamID) error { - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - - // Don't delete this stream yet, if it was not yet accepted. - // Just save it to streamsToDelete map, to make sure it is deleted as soon as it gets accepted. - if id >= m.nextStreamToAccept { - if _, ok := m.streamsToDelete[id]; ok { - return fmt.Errorf("Tried to delete stream %d multiple times", id) - } - m.streamsToDelete[id] = struct{}{} - return nil - } - - delete(m.streams, id) - // queue a MAX_STREAM_ID frame, giving the peer the option to open a new stream - if m.maxNumStreams > uint64(len(m.streams)) { - numNewStreams := m.maxNumStreams - uint64(len(m.streams)) - m.maxStream = m.nextStreamToOpen + protocol.StreamID((numNewStreams-1)*4) - m.queueMaxStreamID(&wire.MaxStreamsFrame{ - Type: streamTypeGeneric, - MaxStreams: m.maxStream.StreamNum(), - }) - } - return nil -} - -func (m *incomingItemsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.mutex.Unlock() - m.cond.Broadcast() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_uni.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_uni.go deleted file mode 100644 index f36fcee5..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_incoming_uni.go +++ /dev/null @@ -1,162 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type incomingUniStreamsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]receiveStreamI - // When a stream is deleted before it was accepted, we can't delete it immediately. - // We need to wait until the application accepts it, and delete it immediately then. - streamsToDelete map[protocol.StreamID]struct{} // used as a set - - nextStreamToAccept protocol.StreamID // the next stream that will be returned by AcceptStream() - nextStreamToOpen protocol.StreamID // the highest stream that the peer openend - maxStream protocol.StreamID // the highest stream that the peer is allowed to open - maxNumStreams uint64 // maximum number of streams - - newStream func(protocol.StreamID) receiveStreamI - queueMaxStreamID func(*wire.MaxStreamsFrame) - - closeErr error -} - -func newIncomingUniStreamsMap( - nextStreamToAccept protocol.StreamID, - initialMaxStreamID protocol.StreamID, - maxNumStreams uint64, - queueControlFrame func(wire.Frame), - newStream func(protocol.StreamID) receiveStreamI, -) *incomingUniStreamsMap { - m := &incomingUniStreamsMap{ - streams: make(map[protocol.StreamID]receiveStreamI), - streamsToDelete: make(map[protocol.StreamID]struct{}), - nextStreamToAccept: nextStreamToAccept, - nextStreamToOpen: nextStreamToAccept, - maxStream: initialMaxStreamID, - maxNumStreams: maxNumStreams, - newStream: newStream, - queueMaxStreamID: func(f *wire.MaxStreamsFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *incomingUniStreamsMap) AcceptStream() (receiveStreamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var id protocol.StreamID - var str receiveStreamI - for { - id = m.nextStreamToAccept - var ok bool - if m.closeErr != nil { - return nil, m.closeErr - } - str, ok = m.streams[id] - if ok { - break - } - m.cond.Wait() - } - m.nextStreamToAccept += 4 - // If this stream was completed before being accepted, we can delete it now. - if _, ok := m.streamsToDelete[id]; ok { - delete(m.streamsToDelete, id) - if err := m.deleteStream(id); err != nil { - return nil, err - } - } - return str, nil -} - -func (m *incomingUniStreamsMap) GetOrOpenStream(id protocol.StreamID) (receiveStreamI, error) { - m.mutex.RLock() - if id > m.maxStream { - m.mutex.RUnlock() - return nil, fmt.Errorf("peer tried to open stream %d (current limit: %d)", id, m.maxStream) - } - // if the id is smaller than the highest we accepted - // * this stream exists in the map, and we can return it, or - // * this stream was already closed, then we can return the nil - if id < m.nextStreamToOpen { - var s receiveStreamI - // If the stream was already queued for deletion, and is just waiting to be accepted, don't return it. - if _, ok := m.streamsToDelete[id]; !ok { - s = m.streams[id] - } - m.mutex.RUnlock() - return s, nil - } - m.mutex.RUnlock() - - m.mutex.Lock() - // no need to check the two error conditions from above again - // * maxStream can only increase, so if the id was valid before, it definitely is valid now - // * highestStream is only modified by this function - for newID := m.nextStreamToOpen; newID <= id; newID += 4 { - m.streams[newID] = m.newStream(newID) - m.cond.Signal() - } - m.nextStreamToOpen = id + 4 - s := m.streams[id] - m.mutex.Unlock() - return s, nil -} - -func (m *incomingUniStreamsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - return m.deleteStream(id) -} - -func (m *incomingUniStreamsMap) deleteStream(id protocol.StreamID) error { - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - - // Don't delete this stream yet, if it was not yet accepted. - // Just save it to streamsToDelete map, to make sure it is deleted as soon as it gets accepted. - if id >= m.nextStreamToAccept { - if _, ok := m.streamsToDelete[id]; ok { - return fmt.Errorf("Tried to delete stream %d multiple times", id) - } - m.streamsToDelete[id] = struct{}{} - return nil - } - - delete(m.streams, id) - // queue a MAX_STREAM_ID frame, giving the peer the option to open a new stream - if m.maxNumStreams > uint64(len(m.streams)) { - numNewStreams := m.maxNumStreams - uint64(len(m.streams)) - m.maxStream = m.nextStreamToOpen + protocol.StreamID((numNewStreams-1)*4) - m.queueMaxStreamID(&wire.MaxStreamsFrame{ - Type: protocol.StreamTypeUni, - MaxStreams: m.maxStream.StreamNum(), - }) - } - return nil -} - -func (m *incomingUniStreamsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.mutex.Unlock() - m.cond.Broadcast() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_bidi.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_bidi.go deleted file mode 100644 index a4457775..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_bidi.go +++ /dev/null @@ -1,147 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type outgoingBidiStreamsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]streamI - - nextStream protocol.StreamID // stream ID of the stream returned by OpenStream(Sync) - maxStream protocol.StreamID // the maximum stream ID we're allowed to open - maxStreamSet bool // was maxStream set. If not, it's not possible to any stream (also works for stream 0) - blockedSent bool // was a STREAMS_BLOCKED sent for the current maxStream - - newStream func(protocol.StreamID) streamI - queueStreamIDBlocked func(*wire.StreamsBlockedFrame) - - closeErr error -} - -func newOutgoingBidiStreamsMap( - nextStream protocol.StreamID, - newStream func(protocol.StreamID) streamI, - queueControlFrame func(wire.Frame), -) *outgoingBidiStreamsMap { - m := &outgoingBidiStreamsMap{ - streams: make(map[protocol.StreamID]streamI), - nextStream: nextStream, - newStream: newStream, - queueStreamIDBlocked: func(f *wire.StreamsBlockedFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *outgoingBidiStreamsMap) OpenStream() (streamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.closeErr != nil { - return nil, m.closeErr - } - - str, err := m.openStreamImpl() - if err != nil { - return nil, streamOpenErr{err} - } - return str, nil -} - -func (m *outgoingBidiStreamsMap) OpenStreamSync() (streamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - for { - if m.closeErr != nil { - return nil, m.closeErr - } - str, err := m.openStreamImpl() - if err == nil { - return str, nil - } - if err != nil && err != errTooManyOpenStreams { - return nil, streamOpenErr{err} - } - m.cond.Wait() - } -} - -func (m *outgoingBidiStreamsMap) openStreamImpl() (streamI, error) { - if !m.maxStreamSet || m.nextStream > m.maxStream { - if !m.blockedSent { - if m.maxStreamSet { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: protocol.StreamTypeBidi, - StreamLimit: m.maxStream.StreamNum(), - }) - } else { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: protocol.StreamTypeBidi, - StreamLimit: 0, - }) - } - m.blockedSent = true - } - return nil, errTooManyOpenStreams - } - s := m.newStream(m.nextStream) - m.streams[m.nextStream] = s - m.nextStream += 4 - return s, nil -} - -func (m *outgoingBidiStreamsMap) GetStream(id protocol.StreamID) (streamI, error) { - m.mutex.RLock() - if id >= m.nextStream { - m.mutex.RUnlock() - return nil, qerr.Error(qerr.StreamStateError, fmt.Sprintf("peer attempted to open stream %d", id)) - } - s := m.streams[id] - m.mutex.RUnlock() - return s, nil -} - -func (m *outgoingBidiStreamsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - delete(m.streams, id) - return nil -} - -func (m *outgoingBidiStreamsMap) SetMaxStream(id protocol.StreamID) { - m.mutex.Lock() - if !m.maxStreamSet || id > m.maxStream { - m.maxStream = id - m.maxStreamSet = true - m.blockedSent = false - m.cond.Broadcast() - } - m.mutex.Unlock() -} - -func (m *outgoingBidiStreamsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.cond.Broadcast() - m.mutex.Unlock() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_generic.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_generic.go deleted file mode 100644 index c0657b90..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_generic.go +++ /dev/null @@ -1,145 +0,0 @@ -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -//go:generate genny -in $GOFILE -out streams_map_outgoing_bidi.go gen "item=streamI Item=BidiStream streamTypeGeneric=protocol.StreamTypeBidi" -//go:generate genny -in $GOFILE -out streams_map_outgoing_uni.go gen "item=sendStreamI Item=UniStream streamTypeGeneric=protocol.StreamTypeUni" -type outgoingItemsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]item - - nextStream protocol.StreamID // stream ID of the stream returned by OpenStream(Sync) - maxStream protocol.StreamID // the maximum stream ID we're allowed to open - maxStreamSet bool // was maxStream set. If not, it's not possible to any stream (also works for stream 0) - blockedSent bool // was a STREAMS_BLOCKED sent for the current maxStream - - newStream func(protocol.StreamID) item - queueStreamIDBlocked func(*wire.StreamsBlockedFrame) - - closeErr error -} - -func newOutgoingItemsMap( - nextStream protocol.StreamID, - newStream func(protocol.StreamID) item, - queueControlFrame func(wire.Frame), -) *outgoingItemsMap { - m := &outgoingItemsMap{ - streams: make(map[protocol.StreamID]item), - nextStream: nextStream, - newStream: newStream, - queueStreamIDBlocked: func(f *wire.StreamsBlockedFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *outgoingItemsMap) OpenStream() (item, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.closeErr != nil { - return nil, m.closeErr - } - - str, err := m.openStreamImpl() - if err != nil { - return nil, streamOpenErr{err} - } - return str, nil -} - -func (m *outgoingItemsMap) OpenStreamSync() (item, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - for { - if m.closeErr != nil { - return nil, m.closeErr - } - str, err := m.openStreamImpl() - if err == nil { - return str, nil - } - if err != nil && err != errTooManyOpenStreams { - return nil, streamOpenErr{err} - } - m.cond.Wait() - } -} - -func (m *outgoingItemsMap) openStreamImpl() (item, error) { - if !m.maxStreamSet || m.nextStream > m.maxStream { - if !m.blockedSent { - if m.maxStreamSet { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: streamTypeGeneric, - StreamLimit: m.maxStream.StreamNum(), - }) - } else { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: streamTypeGeneric, - StreamLimit: 0, - }) - } - m.blockedSent = true - } - return nil, errTooManyOpenStreams - } - s := m.newStream(m.nextStream) - m.streams[m.nextStream] = s - m.nextStream += 4 - return s, nil -} - -func (m *outgoingItemsMap) GetStream(id protocol.StreamID) (item, error) { - m.mutex.RLock() - if id >= m.nextStream { - m.mutex.RUnlock() - return nil, qerr.Error(qerr.StreamStateError, fmt.Sprintf("peer attempted to open stream %d", id)) - } - s := m.streams[id] - m.mutex.RUnlock() - return s, nil -} - -func (m *outgoingItemsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - delete(m.streams, id) - return nil -} - -func (m *outgoingItemsMap) SetMaxStream(id protocol.StreamID) { - m.mutex.Lock() - if !m.maxStreamSet || id > m.maxStream { - m.maxStream = id - m.maxStreamSet = true - m.blockedSent = false - m.cond.Broadcast() - } - m.mutex.Unlock() -} - -func (m *outgoingItemsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.cond.Broadcast() - m.mutex.Unlock() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_uni.go b/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_uni.go deleted file mode 100644 index a38240a6..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/streams_map_outgoing_uni.go +++ /dev/null @@ -1,147 +0,0 @@ -// This file was automatically generated by genny. -// Any changes will be lost if this file is regenerated. -// see https://github.com/cheekybits/genny - -package quic - -import ( - "fmt" - "sync" - - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/qerr" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type outgoingUniStreamsMap struct { - mutex sync.RWMutex - cond sync.Cond - - streams map[protocol.StreamID]sendStreamI - - nextStream protocol.StreamID // stream ID of the stream returned by OpenStream(Sync) - maxStream protocol.StreamID // the maximum stream ID we're allowed to open - maxStreamSet bool // was maxStream set. If not, it's not possible to any stream (also works for stream 0) - blockedSent bool // was a STREAMS_BLOCKED sent for the current maxStream - - newStream func(protocol.StreamID) sendStreamI - queueStreamIDBlocked func(*wire.StreamsBlockedFrame) - - closeErr error -} - -func newOutgoingUniStreamsMap( - nextStream protocol.StreamID, - newStream func(protocol.StreamID) sendStreamI, - queueControlFrame func(wire.Frame), -) *outgoingUniStreamsMap { - m := &outgoingUniStreamsMap{ - streams: make(map[protocol.StreamID]sendStreamI), - nextStream: nextStream, - newStream: newStream, - queueStreamIDBlocked: func(f *wire.StreamsBlockedFrame) { queueControlFrame(f) }, - } - m.cond.L = &m.mutex - return m -} - -func (m *outgoingUniStreamsMap) OpenStream() (sendStreamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.closeErr != nil { - return nil, m.closeErr - } - - str, err := m.openStreamImpl() - if err != nil { - return nil, streamOpenErr{err} - } - return str, nil -} - -func (m *outgoingUniStreamsMap) OpenStreamSync() (sendStreamI, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - for { - if m.closeErr != nil { - return nil, m.closeErr - } - str, err := m.openStreamImpl() - if err == nil { - return str, nil - } - if err != nil && err != errTooManyOpenStreams { - return nil, streamOpenErr{err} - } - m.cond.Wait() - } -} - -func (m *outgoingUniStreamsMap) openStreamImpl() (sendStreamI, error) { - if !m.maxStreamSet || m.nextStream > m.maxStream { - if !m.blockedSent { - if m.maxStreamSet { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: protocol.StreamTypeUni, - StreamLimit: m.maxStream.StreamNum(), - }) - } else { - m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{ - Type: protocol.StreamTypeUni, - StreamLimit: 0, - }) - } - m.blockedSent = true - } - return nil, errTooManyOpenStreams - } - s := m.newStream(m.nextStream) - m.streams[m.nextStream] = s - m.nextStream += 4 - return s, nil -} - -func (m *outgoingUniStreamsMap) GetStream(id protocol.StreamID) (sendStreamI, error) { - m.mutex.RLock() - if id >= m.nextStream { - m.mutex.RUnlock() - return nil, qerr.Error(qerr.StreamStateError, fmt.Sprintf("peer attempted to open stream %d", id)) - } - s := m.streams[id] - m.mutex.RUnlock() - return s, nil -} - -func (m *outgoingUniStreamsMap) DeleteStream(id protocol.StreamID) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - if _, ok := m.streams[id]; !ok { - return fmt.Errorf("Tried to delete unknown stream %d", id) - } - delete(m.streams, id) - return nil -} - -func (m *outgoingUniStreamsMap) SetMaxStream(id protocol.StreamID) { - m.mutex.Lock() - if !m.maxStreamSet || id > m.maxStream { - m.maxStream = id - m.maxStreamSet = true - m.blockedSent = false - m.cond.Broadcast() - } - m.mutex.Unlock() -} - -func (m *outgoingUniStreamsMap) CloseWithError(err error) { - m.mutex.Lock() - m.closeErr = err - for _, str := range m.streams { - str.closeForShutdown(err) - } - m.cond.Broadcast() - m.mutex.Unlock() -} diff --git a/vendor/github.com/lucas-clemente/quic-go/window_update_queue.go b/vendor/github.com/lucas-clemente/quic-go/window_update_queue.go deleted file mode 100644 index 64b912a3..00000000 --- a/vendor/github.com/lucas-clemente/quic-go/window_update_queue.go +++ /dev/null @@ -1,71 +0,0 @@ -package quic - -import ( - "sync" - - "github.com/lucas-clemente/quic-go/internal/flowcontrol" - "github.com/lucas-clemente/quic-go/internal/protocol" - "github.com/lucas-clemente/quic-go/internal/wire" -) - -type windowUpdateQueue struct { - mutex sync.Mutex - - queue map[protocol.StreamID]bool // used as a set - queuedConn bool // connection-level window update - - streamGetter streamGetter - connFlowController flowcontrol.ConnectionFlowController - callback func(wire.Frame) -} - -func newWindowUpdateQueue( - streamGetter streamGetter, - connFC flowcontrol.ConnectionFlowController, - cb func(wire.Frame), -) *windowUpdateQueue { - return &windowUpdateQueue{ - queue: make(map[protocol.StreamID]bool), - streamGetter: streamGetter, - connFlowController: connFC, - callback: cb, - } -} - -func (q *windowUpdateQueue) AddStream(id protocol.StreamID) { - q.mutex.Lock() - q.queue[id] = true - q.mutex.Unlock() -} - -func (q *windowUpdateQueue) AddConnection() { - q.mutex.Lock() - q.queuedConn = true - q.mutex.Unlock() -} - -func (q *windowUpdateQueue) QueueAll() { - q.mutex.Lock() - // queue a connection-level window update - if q.queuedConn { - q.callback(&wire.MaxDataFrame{ByteOffset: q.connFlowController.GetWindowUpdate()}) - q.queuedConn = false - } - // queue all stream-level window updates - for id := range q.queue { - str, err := q.streamGetter.GetOrOpenReceiveStream(id) - if err != nil || str == nil { // the stream can be nil if it was completed before dequeing the window update - continue - } - offset := str.getWindowUpdate() - if offset == 0 { // can happen if we received a final offset, right after queueing the window update - continue - } - q.callback(&wire.MaxStreamDataFrame{ - StreamID: id, - ByteOffset: offset, - }) - delete(q.queue, id) - } - q.mutex.Unlock() -} diff --git a/vendor/github.com/magiconair/properties/.travis.yml b/vendor/github.com/magiconair/properties/.travis.yml index f07376f9..3e7c3d2c 100644 --- a/vendor/github.com/magiconair/properties/.travis.yml +++ b/vendor/github.com/magiconair/properties/.travis.yml @@ -7,6 +7,4 @@ go: - 1.8.x - 1.9.x - "1.10.x" - - "1.11.x" - - "1.12.x" - tip diff --git a/vendor/github.com/magiconair/properties/CHANGELOG.md b/vendor/github.com/magiconair/properties/CHANGELOG.md index 176626a1..f83adc20 100644 --- a/vendor/github.com/magiconair/properties/CHANGELOG.md +++ b/vendor/github.com/magiconair/properties/CHANGELOG.md @@ -1,13 +1,5 @@ ## Changelog -### [1.8.1](https://github.com/magiconair/properties/tree/v1.8.1) - 10 May 2019 - - * [PR #26](https://github.com/magiconair/properties/pull/35): Close body always after request - - This patch ensures that in `LoadURL` the response body is always closed. - - Thanks to [@liubog2008](https://github.com/liubog2008) for the patch. - ### [1.8](https://github.com/magiconair/properties/tree/v1.8) - 15 May 2018 * [PR #26](https://github.com/magiconair/properties/pull/26): Disable expansion during loading diff --git a/vendor/github.com/magiconair/properties/README.md b/vendor/github.com/magiconair/properties/README.md index 42ed5c37..2c05f290 100644 --- a/vendor/github.com/magiconair/properties/README.md +++ b/vendor/github.com/magiconair/properties/README.md @@ -1,6 +1,6 @@ [![](https://img.shields.io/github/tag/magiconair/properties.svg?style=flat-square&label=release)](https://github.com/magiconair/properties/releases) [![Travis CI Status](https://img.shields.io/travis/magiconair/properties.svg?branch=master&style=flat-square&label=travis)](https://travis-ci.org/magiconair/properties) -[![CircleCI Status](https://img.shields.io/circleci/project/github/magiconair/properties.svg?label=circle+ci&style=flat-square)](https://circleci.com/gh/magiconair/properties) +[![Codeship CI Status](https://img.shields.io/codeship/16aaf660-f615-0135-b8f0-7e33b70920c0/master.svg?label=codeship&style=flat-square)](https://app.codeship.com/projects/274177") [![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg?style=flat-square)](https://raw.githubusercontent.com/magiconair/properties/master/LICENSE) [![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](http://godoc.org/github.com/magiconair/properties) @@ -30,7 +30,7 @@ changed from `panic` to `log.Fatal` but this is configurable and custom error handling functions can be provided. See the package documentation for details. -Read the full documentation on [![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](http://godoc.org/github.com/magiconair/properties) +Read the full documentation on [GoDoc](https://godoc.org/github.com/magiconair/properties) [![GoDoc](https://godoc.org/github.com/magiconair/properties?status.png)](https://godoc.org/github.com/magiconair/properties) ## Getting Started diff --git a/vendor/github.com/magiconair/properties/go.mod b/vendor/github.com/magiconair/properties/go.mod deleted file mode 100644 index 02a6f865..00000000 --- a/vendor/github.com/magiconair/properties/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/magiconair/properties diff --git a/vendor/github.com/magiconair/properties/load.go b/vendor/github.com/magiconair/properties/load.go index ab953253..c8e1b580 100644 --- a/vendor/github.com/magiconair/properties/load.go +++ b/vendor/github.com/magiconair/properties/load.go @@ -115,7 +115,6 @@ func (l *Loader) LoadURL(url string) (*Properties, error) { if err != nil { return nil, fmt.Errorf("properties: error fetching %q. %s", url, err) } - defer resp.Body.Close() if resp.StatusCode == 404 && l.IgnoreMissing { LogPrintf("properties: %s returned %d. skipping", url, resp.StatusCode) @@ -130,6 +129,7 @@ func (l *Loader) LoadURL(url string) (*Properties, error) { if err != nil { return nil, fmt.Errorf("properties: %s error reading response. %s", url, err) } + defer resp.Body.Close() ct := resp.Header.Get("Content-Type") var enc Encoding diff --git a/vendor/github.com/marten-seemann/qtls/.travis.yml b/vendor/github.com/marten-seemann/qtls/.travis.yml deleted file mode 100644 index 2179c96e..00000000 --- a/vendor/github.com/marten-seemann/qtls/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -dist: trusty -group: travis_latest - -language: go - -go: - - "1.12.x" - -# first part of the GOARCH workaround -# setting the GOARCH directly doesn't work, since the value will be overwritten later -# so set it to a temporary environment variable first -env: - global: - - GO111MODULE=on - matrix: - - TRAVIS_GOARCH=amd64 - - TRAVIS_GOARCH=386 - - -# second part of the GOARCH workaround -# now actually set the GOARCH env variable to the value of the temporary variable set earlier -before_install: - - export GOARCH=$TRAVIS_GOARCH - - go env # for debugging - -script: - - go test - - if [ ${TRAVIS_GOARCH} == 'amd64' ]; then go test -race; fi diff --git a/vendor/github.com/marten-seemann/qtls/LICENSE b/vendor/github.com/marten-seemann/qtls/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/github.com/marten-seemann/qtls/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/marten-seemann/qtls/README.md b/vendor/github.com/marten-seemann/qtls/README.md deleted file mode 100644 index f765e86f..00000000 --- a/vendor/github.com/marten-seemann/qtls/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# qtls - -[![Godoc Reference](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/marten-seemann/qtls) -[![Travis Build Status](https://img.shields.io/travis/marten-seemann/qtls/master.svg?style=flat-square&label=Travis+build)](https://travis-ci.org/marten-seemann/qtls) - -This repository contains a modified version of the standard library's TLS implementation, modified for the QUIC protocol. It is used by [quic-go](https://github.com/lucas-clemente/quic-go). diff --git a/vendor/github.com/marten-seemann/qtls/alert.go b/vendor/github.com/marten-seemann/qtls/alert.go deleted file mode 100644 index ba1c9ce3..00000000 --- a/vendor/github.com/marten-seemann/qtls/alert.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import "strconv" - -type alert uint8 - -// Alert is a TLS alert -type Alert = alert - -const ( - // alert level - alertLevelWarning = 1 - alertLevelError = 2 -) - -const ( - alertCloseNotify alert = 0 - alertUnexpectedMessage alert = 10 - alertBadRecordMAC alert = 20 - alertDecryptionFailed alert = 21 - alertRecordOverflow alert = 22 - alertDecompressionFailure alert = 30 - alertHandshakeFailure alert = 40 - alertBadCertificate alert = 42 - alertUnsupportedCertificate alert = 43 - alertCertificateRevoked alert = 44 - alertCertificateExpired alert = 45 - alertCertificateUnknown alert = 46 - alertIllegalParameter alert = 47 - alertUnknownCA alert = 48 - alertAccessDenied alert = 49 - alertDecodeError alert = 50 - alertDecryptError alert = 51 - alertProtocolVersion alert = 70 - alertInsufficientSecurity alert = 71 - alertInternalError alert = 80 - alertInappropriateFallback alert = 86 - alertUserCanceled alert = 90 - alertNoRenegotiation alert = 100 - alertMissingExtension alert = 109 - alertUnsupportedExtension alert = 110 - alertNoApplicationProtocol alert = 120 -) - -var alertText = map[alert]string{ - alertCloseNotify: "close notify", - alertUnexpectedMessage: "unexpected message", - alertBadRecordMAC: "bad record MAC", - alertDecryptionFailed: "decryption failed", - alertRecordOverflow: "record overflow", - alertDecompressionFailure: "decompression failure", - alertHandshakeFailure: "handshake failure", - alertBadCertificate: "bad certificate", - alertUnsupportedCertificate: "unsupported certificate", - alertCertificateRevoked: "revoked certificate", - alertCertificateExpired: "expired certificate", - alertCertificateUnknown: "unknown certificate", - alertIllegalParameter: "illegal parameter", - alertUnknownCA: "unknown certificate authority", - alertAccessDenied: "access denied", - alertDecodeError: "error decoding message", - alertDecryptError: "error decrypting message", - alertProtocolVersion: "protocol version not supported", - alertInsufficientSecurity: "insufficient security level", - alertInternalError: "internal error", - alertInappropriateFallback: "inappropriate fallback", - alertUserCanceled: "user canceled", - alertNoRenegotiation: "no renegotiation", - alertMissingExtension: "missing extension", - alertUnsupportedExtension: "unsupported extension", - alertNoApplicationProtocol: "no application protocol", -} - -func (e alert) String() string { - s, ok := alertText[e] - if ok { - return "tls: " + s - } - return "tls: alert(" + strconv.Itoa(int(e)) + ")" -} - -func (e alert) Error() string { - return e.String() -} diff --git a/vendor/github.com/marten-seemann/qtls/auth.go b/vendor/github.com/marten-seemann/qtls/auth.go deleted file mode 100644 index b8fd7f9b..00000000 --- a/vendor/github.com/marten-seemann/qtls/auth.go +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rsa" - "encoding/asn1" - "errors" - "fmt" - "hash" - "io" -) - -// pickSignatureAlgorithm selects a signature algorithm that is compatible with -// the given public key and the list of algorithms from the peer and this side. -// The lists of signature algorithms (peerSigAlgs and ourSigAlgs) are ignored -// for tlsVersion < VersionTLS12. -// -// The returned SignatureScheme codepoint is only meaningful for TLS 1.2, -// previous TLS versions have a fixed hash function. -func pickSignatureAlgorithm(pubkey crypto.PublicKey, peerSigAlgs, ourSigAlgs []SignatureScheme, tlsVersion uint16) (sigAlg SignatureScheme, sigType uint8, hashFunc crypto.Hash, err error) { - if tlsVersion < VersionTLS12 || len(peerSigAlgs) == 0 { - // For TLS 1.1 and before, the signature algorithm could not be - // negotiated and the hash is fixed based on the signature type. For TLS - // 1.2, if the client didn't send signature_algorithms extension then we - // can assume that it supports SHA1. See RFC 5246, Section 7.4.1.4.1. - switch pubkey.(type) { - case *rsa.PublicKey: - if tlsVersion < VersionTLS12 { - return 0, signaturePKCS1v15, crypto.MD5SHA1, nil - } else { - return PKCS1WithSHA1, signaturePKCS1v15, crypto.SHA1, nil - } - case *ecdsa.PublicKey: - return ECDSAWithSHA1, signatureECDSA, crypto.SHA1, nil - default: - return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey) - } - } - for _, sigAlg := range peerSigAlgs { - if !isSupportedSignatureAlgorithm(sigAlg, ourSigAlgs) { - continue - } - hashAlg, err := hashFromSignatureScheme(sigAlg) - if err != nil { - panic("tls: supported signature algorithm has an unknown hash function") - } - sigType := signatureFromSignatureScheme(sigAlg) - switch pubkey.(type) { - case *rsa.PublicKey: - if sigType == signaturePKCS1v15 || sigType == signatureRSAPSS { - return sigAlg, sigType, hashAlg, nil - } - case *ecdsa.PublicKey: - if sigType == signatureECDSA { - return sigAlg, sigType, hashAlg, nil - } - default: - return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey) - } - } - return 0, 0, 0, errors.New("tls: peer doesn't support any common signature algorithms") -} - -// verifyHandshakeSignature verifies a signature against pre-hashed handshake -// contents. -func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, digest, sig []byte) error { - switch sigType { - case signatureECDSA: - pubKey, ok := pubkey.(*ecdsa.PublicKey) - if !ok { - return errors.New("tls: ECDSA signing requires a ECDSA public key") - } - ecdsaSig := new(ecdsaSignature) - if _, err := asn1.Unmarshal(sig, ecdsaSig); err != nil { - return err - } - if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { - return errors.New("tls: ECDSA signature contained zero or negative values") - } - if !ecdsa.Verify(pubKey, digest, ecdsaSig.R, ecdsaSig.S) { - return errors.New("tls: ECDSA verification failure") - } - case signaturePKCS1v15: - pubKey, ok := pubkey.(*rsa.PublicKey) - if !ok { - return errors.New("tls: RSA signing requires a RSA public key") - } - if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, digest, sig); err != nil { - return err - } - case signatureRSAPSS: - pubKey, ok := pubkey.(*rsa.PublicKey) - if !ok { - return errors.New("tls: RSA signing requires a RSA public key") - } - signOpts := &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash} - if err := rsa.VerifyPSS(pubKey, hashFunc, digest, sig, signOpts); err != nil { - return err - } - default: - return errors.New("tls: unknown signature algorithm") - } - return nil -} - -const ( - serverSignatureContext = "TLS 1.3, server CertificateVerify\x00" - clientSignatureContext = "TLS 1.3, client CertificateVerify\x00" -) - -var signaturePadding = []byte{ - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -} - -// writeSignedMessage writes the content to be signed by certificate keys in TLS -// 1.3 to sigHash. See RFC 8446, Section 4.4.3. -func writeSignedMessage(sigHash io.Writer, context string, transcript hash.Hash) { - sigHash.Write(signaturePadding) - io.WriteString(sigHash, context) - sigHash.Write(transcript.Sum(nil)) -} - -// signatureSchemesForCertificate returns the list of supported SignatureSchemes -// for a given certificate, based on the public key and the protocol version. It -// does not support the crypto.Decrypter interface, so shouldn't be used on the -// server side in TLS 1.2 and earlier. -func signatureSchemesForCertificate(version uint16, cert *Certificate) []SignatureScheme { - priv, ok := cert.PrivateKey.(crypto.Signer) - if !ok { - return nil - } - - switch pub := priv.Public().(type) { - case *ecdsa.PublicKey: - if version != VersionTLS13 { - // In TLS 1.2 and earlier, ECDSA algorithms are not - // constrained to a single curve. - return []SignatureScheme{ - ECDSAWithP256AndSHA256, - ECDSAWithP384AndSHA384, - ECDSAWithP521AndSHA512, - ECDSAWithSHA1, - } - } - switch pub.Curve { - case elliptic.P256(): - return []SignatureScheme{ECDSAWithP256AndSHA256} - case elliptic.P384(): - return []SignatureScheme{ECDSAWithP384AndSHA384} - case elliptic.P521(): - return []SignatureScheme{ECDSAWithP521AndSHA512} - default: - return nil - } - case *rsa.PublicKey: - if version != VersionTLS13 { - return []SignatureScheme{ - PSSWithSHA256, - PSSWithSHA384, - PSSWithSHA512, - PKCS1WithSHA256, - PKCS1WithSHA384, - PKCS1WithSHA512, - PKCS1WithSHA1, - } - } - // RSA keys with RSA-PSS OID are not supported by crypto/x509. - return []SignatureScheme{ - PSSWithSHA256, - PSSWithSHA384, - PSSWithSHA512, - } - default: - return nil - } -} - -// unsupportedCertificateError returns a helpful error for certificates with -// an unsupported private key. -func unsupportedCertificateError(cert *Certificate) error { - switch cert.PrivateKey.(type) { - case rsa.PrivateKey, ecdsa.PrivateKey: - return fmt.Errorf("tls: unsupported certificate: private key is %T, expected *%T", - cert.PrivateKey, cert.PrivateKey) - } - - signer, ok := cert.PrivateKey.(crypto.Signer) - if !ok { - return fmt.Errorf("tls: certificate private key (%T) does not implement crypto.Signer", - cert.PrivateKey) - } - - switch pub := signer.Public().(type) { - case *ecdsa.PublicKey: - switch pub.Curve { - case elliptic.P256(): - case elliptic.P384(): - case elliptic.P521(): - default: - return fmt.Errorf("tls: unsupported certificate curve (%s)", pub.Curve.Params().Name) - } - case *rsa.PublicKey: - default: - return fmt.Errorf("tls: unsupported certificate key (%T)", pub) - } - - return fmt.Errorf("tls: internal error: unsupported key (%T)", cert.PrivateKey) -} diff --git a/vendor/github.com/marten-seemann/qtls/cipher_suites.go b/vendor/github.com/marten-seemann/qtls/cipher_suites.go deleted file mode 100644 index e0b7e2f1..00000000 --- a/vendor/github.com/marten-seemann/qtls/cipher_suites.go +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/des" - "crypto/hmac" - "crypto/rc4" - "crypto/sha1" - "crypto/sha256" - "crypto/x509" - "hash" - - "golang.org/x/crypto/chacha20poly1305" -) - -// a keyAgreement implements the client and server side of a TLS key agreement -// protocol by generating and processing key exchange messages. -type keyAgreement interface { - // On the server side, the first two methods are called in order. - - // In the case that the key agreement protocol doesn't use a - // ServerKeyExchange message, generateServerKeyExchange can return nil, - // nil. - generateServerKeyExchange(*Config, *Certificate, *clientHelloMsg, *serverHelloMsg) (*serverKeyExchangeMsg, error) - processClientKeyExchange(*Config, *Certificate, *clientKeyExchangeMsg, uint16) ([]byte, error) - - // On the client side, the next two methods are called in order. - - // This method may not be called if the server doesn't send a - // ServerKeyExchange message. - processServerKeyExchange(*Config, *clientHelloMsg, *serverHelloMsg, *x509.Certificate, *serverKeyExchangeMsg) error - generateClientKeyExchange(*Config, *clientHelloMsg, *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) -} - -const ( - // suiteECDH indicates that the cipher suite involves elliptic curve - // Diffie-Hellman. This means that it should only be selected when the - // client indicates that it supports ECC with a curve and point format - // that we're happy with. - suiteECDHE = 1 << iota - // suiteECDSA indicates that the cipher suite involves an ECDSA - // signature and therefore may only be selected when the server's - // certificate is ECDSA. If this is not set then the cipher suite is - // RSA based. - suiteECDSA - // suiteTLS12 indicates that the cipher suite should only be advertised - // and accepted when using TLS 1.2. - suiteTLS12 - // suiteSHA384 indicates that the cipher suite uses SHA384 as the - // handshake hash. - suiteSHA384 - // suiteDefaultOff indicates that this cipher suite is not included by - // default. - suiteDefaultOff -) - -type CipherSuite struct { - *cipherSuiteTLS13 -} - -func (c *CipherSuite) Hash() crypto.Hash { return c.hash } -func (c *CipherSuite) KeyLen() int { return c.keyLen } -func (c *CipherSuite) IVLen() int { return aeadNonceLength } -func (c *CipherSuite) AEAD(key, fixedNonce []byte) cipher.AEAD { return c.aead(key, fixedNonce) } - -// A cipherSuite is a specific combination of key agreement, cipher and MAC function. -type cipherSuite struct { - id uint16 - // the lengths, in bytes, of the key material needed for each component. - keyLen int - macLen int - ivLen int - ka func(version uint16) keyAgreement - // flags is a bitmask of the suite* values, above. - flags int - cipher func(key, iv []byte, isRead bool) interface{} - mac func(version uint16, macKey []byte) macFunction - aead func(key, fixedNonce []byte) aead -} - -var cipherSuites = []*cipherSuite{ - // Ciphersuite order is chosen so that ECDHE comes before plain RSA and - // AEADs are the top preference. - {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, - {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12, nil, nil, aeadChaCha20Poly1305}, - {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, - {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, - {TLS_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, rsaKA, suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, rsaKA, suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, rsaKA, suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil}, - {TLS_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, - {TLS_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, ecdheRSAKA, suiteECDHE, cipher3DES, macSHA1, nil}, - {TLS_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, rsaKA, 0, cipher3DES, macSHA1, nil}, - - // RC4-based cipher suites are disabled by default. - {TLS_RSA_WITH_RC4_128_SHA, 16, 20, 0, rsaKA, suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheRSAKA, suiteECDHE | suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteDefaultOff, cipherRC4, macSHA1, nil}, -} - -// A cipherSuiteTLS13 defines only the pair of the AEAD algorithm and hash -// algorithm to be used with HKDF. See RFC 8446, Appendix B.4. -type cipherSuiteTLS13 struct { - id uint16 - keyLen int - aead func(key, fixedNonce []byte) aead - hash crypto.Hash -} - -var cipherSuitesTLS13 = []*cipherSuiteTLS13{ - {TLS_AES_128_GCM_SHA256, 16, aeadAESGCMTLS13, crypto.SHA256}, - {TLS_CHACHA20_POLY1305_SHA256, 32, aeadChaCha20Poly1305, crypto.SHA256}, - {TLS_AES_256_GCM_SHA384, 32, aeadAESGCMTLS13, crypto.SHA384}, -} - -func cipherRC4(key, iv []byte, isRead bool) interface{} { - cipher, _ := rc4.NewCipher(key) - return cipher -} - -func cipher3DES(key, iv []byte, isRead bool) interface{} { - block, _ := des.NewTripleDESCipher(key) - if isRead { - return cipher.NewCBCDecrypter(block, iv) - } - return cipher.NewCBCEncrypter(block, iv) -} - -func cipherAES(key, iv []byte, isRead bool) interface{} { - block, _ := aes.NewCipher(key) - if isRead { - return cipher.NewCBCDecrypter(block, iv) - } - return cipher.NewCBCEncrypter(block, iv) -} - -// macSHA1 returns a macFunction for the given protocol version. -func macSHA1(version uint16, key []byte) macFunction { - if version == VersionSSL30 { - mac := ssl30MAC{ - h: sha1.New(), - key: make([]byte, len(key)), - } - copy(mac.key, key) - return mac - } - return tls10MAC{h: hmac.New(newConstantTimeHash(sha1.New), key)} -} - -// macSHA256 returns a SHA-256 based MAC. These are only supported in TLS 1.2 -// so the given version is ignored. -func macSHA256(version uint16, key []byte) macFunction { - return tls10MAC{h: hmac.New(sha256.New, key)} -} - -type macFunction interface { - // Size returns the length of the MAC. - Size() int - // MAC appends the MAC of (seq, header, data) to out. The extra data is fed - // into the MAC after obtaining the result to normalize timing. The result - // is only valid until the next invocation of MAC as the buffer is reused. - MAC(seq, header, data, extra []byte) []byte -} - -type aead interface { - cipher.AEAD - - // explicitNonceLen returns the number of bytes of explicit nonce - // included in each record. This is eight for older AEADs and - // zero for modern ones. - explicitNonceLen() int -} - -const ( - aeadNonceLength = 12 - noncePrefixLength = 4 -) - -// prefixNonceAEAD wraps an AEAD and prefixes a fixed portion of the nonce to -// each call. -type prefixNonceAEAD struct { - // nonce contains the fixed part of the nonce in the first four bytes. - nonce [aeadNonceLength]byte - aead cipher.AEAD -} - -func (f *prefixNonceAEAD) NonceSize() int { return aeadNonceLength - noncePrefixLength } -func (f *prefixNonceAEAD) Overhead() int { return f.aead.Overhead() } -func (f *prefixNonceAEAD) explicitNonceLen() int { return f.NonceSize() } - -func (f *prefixNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte { - copy(f.nonce[4:], nonce) - return f.aead.Seal(out, f.nonce[:], plaintext, additionalData) -} - -func (f *prefixNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) { - copy(f.nonce[4:], nonce) - return f.aead.Open(out, f.nonce[:], ciphertext, additionalData) -} - -// xoredNonceAEAD wraps an AEAD by XORing in a fixed pattern to the nonce -// before each call. -type xorNonceAEAD struct { - nonceMask [aeadNonceLength]byte - aead cipher.AEAD -} - -func (f *xorNonceAEAD) NonceSize() int { return 8 } // 64-bit sequence number -func (f *xorNonceAEAD) Overhead() int { return f.aead.Overhead() } -func (f *xorNonceAEAD) explicitNonceLen() int { return 0 } - -func (f *xorNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte { - for i, b := range nonce { - f.nonceMask[4+i] ^= b - } - result := f.aead.Seal(out, f.nonceMask[:], plaintext, additionalData) - for i, b := range nonce { - f.nonceMask[4+i] ^= b - } - - return result -} - -func (f *xorNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) { - for i, b := range nonce { - f.nonceMask[4+i] ^= b - } - result, err := f.aead.Open(out, f.nonceMask[:], ciphertext, additionalData) - for i, b := range nonce { - f.nonceMask[4+i] ^= b - } - - return result, err -} - -func aeadAESGCM(key, noncePrefix []byte) aead { - if len(noncePrefix) != noncePrefixLength { - panic("tls: internal error: wrong nonce length") - } - aes, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - aead, err := cipher.NewGCM(aes) - if err != nil { - panic(err) - } - - ret := &prefixNonceAEAD{aead: aead} - copy(ret.nonce[:], noncePrefix) - return ret -} - -// AEADAESGCMTLS13 creates a new AES-GCM AEAD for TLS 1.3 -func AEADAESGCMTLS13(key, fixedNonce []byte) cipher.AEAD { - return aeadAESGCMTLS13(key, fixedNonce) -} - -func aeadAESGCMTLS13(key, nonceMask []byte) aead { - if len(nonceMask) != aeadNonceLength { - panic("tls: internal error: wrong nonce length") - } - aes, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - aead, err := cipher.NewGCM(aes) - if err != nil { - panic(err) - } - - ret := &xorNonceAEAD{aead: aead} - copy(ret.nonceMask[:], nonceMask) - return ret -} - -func aeadChaCha20Poly1305(key, nonceMask []byte) aead { - if len(nonceMask) != aeadNonceLength { - panic("tls: internal error: wrong nonce length") - } - aead, err := chacha20poly1305.New(key) - if err != nil { - panic(err) - } - - ret := &xorNonceAEAD{aead: aead} - copy(ret.nonceMask[:], nonceMask) - return ret -} - -// ssl30MAC implements the SSLv3 MAC function, as defined in -// www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt section 5.2.3.1 -type ssl30MAC struct { - h hash.Hash - key []byte - buf []byte -} - -func (s ssl30MAC) Size() int { - return s.h.Size() -} - -var ssl30Pad1 = [48]byte{0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36} - -var ssl30Pad2 = [48]byte{0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c} - -// MAC does not offer constant timing guarantees for SSL v3.0, since it's deemed -// useless considering the similar, protocol-level POODLE vulnerability. -func (s ssl30MAC) MAC(seq, header, data, extra []byte) []byte { - padLength := 48 - if s.h.Size() == 20 { - padLength = 40 - } - - s.h.Reset() - s.h.Write(s.key) - s.h.Write(ssl30Pad1[:padLength]) - s.h.Write(seq) - s.h.Write(header[:1]) - s.h.Write(header[3:5]) - s.h.Write(data) - s.buf = s.h.Sum(s.buf[:0]) - - s.h.Reset() - s.h.Write(s.key) - s.h.Write(ssl30Pad2[:padLength]) - s.h.Write(s.buf) - return s.h.Sum(s.buf[:0]) -} - -type constantTimeHash interface { - hash.Hash - ConstantTimeSum(b []byte) []byte -} - -// cthWrapper wraps any hash.Hash that implements ConstantTimeSum, and replaces -// with that all calls to Sum. It's used to obtain a ConstantTimeSum-based HMAC. -type cthWrapper struct { - h constantTimeHash -} - -func (c *cthWrapper) Size() int { return c.h.Size() } -func (c *cthWrapper) BlockSize() int { return c.h.BlockSize() } -func (c *cthWrapper) Reset() { c.h.Reset() } -func (c *cthWrapper) Write(p []byte) (int, error) { return c.h.Write(p) } -func (c *cthWrapper) Sum(b []byte) []byte { return c.h.ConstantTimeSum(b) } - -func newConstantTimeHash(h func() hash.Hash) func() hash.Hash { - return func() hash.Hash { - return &cthWrapper{h().(constantTimeHash)} - } -} - -// tls10MAC implements the TLS 1.0 MAC function. RFC 2246, Section 6.2.3. -type tls10MAC struct { - h hash.Hash - buf []byte -} - -func (s tls10MAC) Size() int { - return s.h.Size() -} - -// MAC is guaranteed to take constant time, as long as -// len(seq)+len(header)+len(data)+len(extra) is constant. extra is not fed into -// the MAC, but is only provided to make the timing profile constant. -func (s tls10MAC) MAC(seq, header, data, extra []byte) []byte { - s.h.Reset() - s.h.Write(seq) - s.h.Write(header) - s.h.Write(data) - res := s.h.Sum(s.buf[:0]) - if extra != nil { - s.h.Write(extra) - } - return res -} - -func rsaKA(version uint16) keyAgreement { - return rsaKeyAgreement{} -} - -func ecdheECDSAKA(version uint16) keyAgreement { - return &ecdheKeyAgreement{ - isRSA: false, - version: version, - } -} - -func ecdheRSAKA(version uint16) keyAgreement { - return &ecdheKeyAgreement{ - isRSA: true, - version: version, - } -} - -// mutualCipherSuite returns a cipherSuite given a list of supported -// ciphersuites and the id requested by the peer. -func mutualCipherSuite(have []uint16, want uint16) *cipherSuite { - for _, id := range have { - if id == want { - return cipherSuiteByID(id) - } - } - return nil -} - -func cipherSuiteByID(id uint16) *cipherSuite { - for _, cipherSuite := range cipherSuites { - if cipherSuite.id == id { - return cipherSuite - } - } - return nil -} - -func mutualCipherSuiteTLS13(have []uint16, want uint16) *cipherSuiteTLS13 { - for _, id := range have { - if id == want { - return cipherSuiteTLS13ByID(id) - } - } - return nil -} - -func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13 { - for _, cipherSuite := range cipherSuitesTLS13 { - if cipherSuite.id == id { - return cipherSuite - } - } - return nil -} - -// A list of cipher suite IDs that are, or have been, implemented by this -// package. -// -// Taken from https://www.iana.org/assignments/tls-parameters/tls-parameters.xml -const ( - // TLS 1.0 - 1.2 cipher suites. - TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 - TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a - TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f - TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 - TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003c - TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009c - TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009d - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007 - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009 - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a - TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc023 - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc027 - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030 - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 uint16 = 0xcca8 - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 uint16 = 0xcca9 - - // TLS 1.3 cipher suites. - TLS_AES_128_GCM_SHA256 uint16 = 0x1301 - TLS_AES_256_GCM_SHA384 uint16 = 0x1302 - TLS_CHACHA20_POLY1305_SHA256 uint16 = 0x1303 - - // TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator - // that the client is doing version fallback. See RFC 7507. - TLS_FALLBACK_SCSV uint16 = 0x5600 -) diff --git a/vendor/github.com/marten-seemann/qtls/common.go b/vendor/github.com/marten-seemann/qtls/common.go deleted file mode 100644 index 2a6c64d8..00000000 --- a/vendor/github.com/marten-seemann/qtls/common.go +++ /dev/null @@ -1,1155 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "container/list" - "crypto/rand" - "crypto/sha512" - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "io" - "math/big" - "os" - "strings" - "sync" - "time" - - "golang.org/x/sys/cpu" -) - -const ( - VersionSSL30 = 0x0300 - VersionTLS10 = 0x0301 - VersionTLS11 = 0x0302 - VersionTLS12 = 0x0303 - VersionTLS13 = 0x0304 -) - -const ( - maxPlaintext = 16384 // maximum plaintext payload length - maxCiphertext = 16384 + 2048 // maximum ciphertext payload length - maxCiphertextTLS13 = 16384 + 256 // maximum ciphertext length in TLS 1.3 - recordHeaderLen = 5 // record header length - maxHandshake = 65536 // maximum handshake we support (protocol max is 16 MB) - maxUselessRecords = 16 // maximum number of consecutive non-advancing records -) - -// TLS record types. -type recordType uint8 - -const ( - recordTypeChangeCipherSpec recordType = 20 - recordTypeAlert recordType = 21 - recordTypeHandshake recordType = 22 - recordTypeApplicationData recordType = 23 -) - -// TLS handshake message types. -const ( - typeHelloRequest uint8 = 0 - typeClientHello uint8 = 1 - typeServerHello uint8 = 2 - typeNewSessionTicket uint8 = 4 - typeEndOfEarlyData uint8 = 5 - typeEncryptedExtensions uint8 = 8 - typeCertificate uint8 = 11 - typeServerKeyExchange uint8 = 12 - typeCertificateRequest uint8 = 13 - typeServerHelloDone uint8 = 14 - typeCertificateVerify uint8 = 15 - typeClientKeyExchange uint8 = 16 - typeFinished uint8 = 20 - typeCertificateStatus uint8 = 22 - typeKeyUpdate uint8 = 24 - typeNextProtocol uint8 = 67 // Not IANA assigned - typeMessageHash uint8 = 254 // synthetic message -) - -// TLS compression types. -const ( - compressionNone uint8 = 0 -) - -type Extension struct { - Type uint16 - Data []byte -} - -// TLS extension numbers -const ( - extensionServerName uint16 = 0 - extensionStatusRequest uint16 = 5 - extensionSupportedCurves uint16 = 10 // supported_groups in TLS 1.3, see RFC 8446, Section 4.2.7 - extensionSupportedPoints uint16 = 11 - extensionSignatureAlgorithms uint16 = 13 - extensionALPN uint16 = 16 - extensionSCT uint16 = 18 - extensionSessionTicket uint16 = 35 - extensionPreSharedKey uint16 = 41 - extensionEarlyData uint16 = 42 - extensionSupportedVersions uint16 = 43 - extensionCookie uint16 = 44 - extensionPSKModes uint16 = 45 - extensionCertificateAuthorities uint16 = 47 - extensionSignatureAlgorithmsCert uint16 = 50 - extensionKeyShare uint16 = 51 - extensionNextProtoNeg uint16 = 13172 // not IANA assigned - extensionRenegotiationInfo uint16 = 0xff01 -) - -// TLS signaling cipher suite values -const ( - scsvRenegotiation uint16 = 0x00ff -) - -// CurveID is a tls.CurveID -type CurveID = tls.CurveID - -const ( - CurveP256 CurveID = 23 - CurveP384 CurveID = 24 - CurveP521 CurveID = 25 - X25519 CurveID = 29 -) - -// TLS 1.3 Key Share. See RFC 8446, Section 4.2.8. -type keyShare struct { - group CurveID - data []byte -} - -// TLS 1.3 PSK Key Exchange Modes. See RFC 8446, Section 4.2.9. -const ( - pskModePlain uint8 = 0 - pskModeDHE uint8 = 1 -) - -// TLS 1.3 PSK Identity. Can be a Session Ticket, or a reference to a saved -// session. See RFC 8446, Section 4.2.11. -type pskIdentity struct { - label []byte - obfuscatedTicketAge uint32 -} - -// TLS Elliptic Curve Point Formats -// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-9 -const ( - pointFormatUncompressed uint8 = 0 -) - -// TLS CertificateStatusType (RFC 3546) -const ( - statusTypeOCSP uint8 = 1 -) - -// Certificate types (for certificateRequestMsg) -const ( - certTypeRSASign = 1 - certTypeECDSASign = 64 // RFC 4492, Section 5.5 -) - -// Signature algorithms (for internal signaling use). Starting at 16 to avoid overlap with -// TLS 1.2 codepoints (RFC 5246, Appendix A.4.1), with which these have nothing to do. -const ( - signaturePKCS1v15 uint8 = iota + 16 - signatureECDSA - signatureRSAPSS -) - -// supportedSignatureAlgorithms contains the signature and hash algorithms that -// the code advertises as supported in a TLS 1.2+ ClientHello and in a TLS 1.2+ -// CertificateRequest. The two fields are merged to match with TLS 1.3. -// Note that in TLS 1.2, the ECDSA algorithms are not constrained to P-256, etc. -var supportedSignatureAlgorithms = []SignatureScheme{ - PSSWithSHA256, - PSSWithSHA384, - PSSWithSHA512, - PKCS1WithSHA256, - ECDSAWithP256AndSHA256, - PKCS1WithSHA384, - ECDSAWithP384AndSHA384, - PKCS1WithSHA512, - ECDSAWithP521AndSHA512, - PKCS1WithSHA1, - ECDSAWithSHA1, -} - -// RSA-PSS is disabled in TLS 1.2 for Go 1.12. See Issue 30055. -var supportedSignatureAlgorithmsTLS12 = supportedSignatureAlgorithms[3:] - -// helloRetryRequestRandom is set as the Random value of a ServerHello -// to signal that the message is actually a HelloRetryRequest. -var helloRetryRequestRandom = []byte{ // See RFC 8446, Section 4.1.3. - 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, - 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, - 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E, - 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33, 0x9C, -} - -const ( - // downgradeCanaryTLS12 or downgradeCanaryTLS11 is embedded in the server - // random as a downgrade protection if the server would be capable of - // negotiating a higher version. See RFC 8446, Section 4.1.3. - downgradeCanaryTLS12 = "DOWNGRD\x01" - downgradeCanaryTLS11 = "DOWNGRD\x00" -) - -// ConnectionState records basic TLS details about the connection. -type ConnectionState struct { - Version uint16 // TLS version used by the connection (e.g. VersionTLS12) - HandshakeComplete bool // TLS handshake is complete - DidResume bool // connection resumes a previous TLS connection - CipherSuite uint16 // cipher suite in use (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, ...) - NegotiatedProtocol string // negotiated next protocol (not guaranteed to be from Config.NextProtos) - NegotiatedProtocolIsMutual bool // negotiated protocol was advertised by server (client side only) - ServerName string // server name requested by client, if any (server side only) - PeerCertificates []*x509.Certificate // certificate chain presented by remote peer - VerifiedChains [][]*x509.Certificate // verified chains built from PeerCertificates - SignedCertificateTimestamps [][]byte // SCTs from the peer, if any - OCSPResponse []byte // stapled OCSP response from peer, if any - - // ekm is a closure exposed via ExportKeyingMaterial. - ekm func(label string, context []byte, length int) ([]byte, error) - - // TLSUnique contains the "tls-unique" channel binding value (see RFC - // 5929, section 3). For resumed sessions this value will be nil - // because resumption does not include enough context (see - // https://mitls.org/pages/attacks/3SHAKE#channelbindings). This will - // change in future versions of Go once the TLS master-secret fix has - // been standardized and implemented. It is not defined in TLS 1.3. - TLSUnique []byte -} - -// ExportKeyingMaterial returns length bytes of exported key material in a new -// slice as defined in RFC 5705. If context is nil, it is not used as part of -// the seed. If the connection was set to allow renegotiation via -// Config.Renegotiation, this function will return an error. -func (cs *ConnectionState) ExportKeyingMaterial(label string, context []byte, length int) ([]byte, error) { - return cs.ekm(label, context, length) -} - -// ClientAuthType is tls.ClientAuthType -type ClientAuthType = tls.ClientAuthType - -const ( - NoClientCert ClientAuthType = iota - RequestClientCert - RequireAnyClientCert - VerifyClientCertIfGiven - RequireAndVerifyClientCert -) - -// requiresClientCert reports whether the ClientAuthType requires a client -// certificate to be provided. -func requiresClientCert(c ClientAuthType) bool { - switch c { - case RequireAnyClientCert, RequireAndVerifyClientCert: - return true - default: - return false - } -} - -// ClientSessionState contains the state needed by clients to resume TLS -// sessions. -type ClientSessionState struct { - sessionTicket []uint8 // Encrypted ticket used for session resumption with server - vers uint16 // SSL/TLS version negotiated for the session - cipherSuite uint16 // Ciphersuite negotiated for the session - masterSecret []byte // Full handshake MasterSecret, or TLS 1.3 resumption_master_secret - serverCertificates []*x509.Certificate // Certificate chain presented by the server - verifiedChains [][]*x509.Certificate // Certificate chains we built for verification - receivedAt time.Time // When the session ticket was received from the server - - // TLS 1.3 fields. - nonce []byte // Ticket nonce sent by the server, to derive PSK - useBy time.Time // Expiration of the ticket lifetime as set by the server - ageAdd uint32 // Random obfuscation factor for sending the ticket age -} - -// ClientSessionCache is a cache of ClientSessionState objects that can be used -// by a client to resume a TLS session with a given server. ClientSessionCache -// implementations should expect to be called concurrently from different -// goroutines. Up to TLS 1.2, only ticket-based resumption is supported, not -// SessionID-based resumption. In TLS 1.3 they were merged into PSK modes, which -// are supported via this interface. -type ClientSessionCache interface { - // Get searches for a ClientSessionState associated with the given key. - // On return, ok is true if one was found. - Get(sessionKey string) (session *ClientSessionState, ok bool) - - // Put adds the ClientSessionState to the cache with the given key. It might - // get called multiple times in a connection if a TLS 1.3 server provides - // more than one session ticket. If called with a nil *ClientSessionState, - // it should remove the cache entry. - Put(sessionKey string, cs *ClientSessionState) -} - -// SignatureScheme is a tls.SignatureScheme -type SignatureScheme = tls.SignatureScheme - -const ( - // RSASSA-PKCS1-v1_5 algorithms. - PKCS1WithSHA256 SignatureScheme = 0x0401 - PKCS1WithSHA384 SignatureScheme = 0x0501 - PKCS1WithSHA512 SignatureScheme = 0x0601 - - // RSASSA-PSS algorithms with public key OID rsaEncryption. - PSSWithSHA256 SignatureScheme = 0x0804 - PSSWithSHA384 SignatureScheme = 0x0805 - PSSWithSHA512 SignatureScheme = 0x0806 - - // ECDSA algorithms. Only constrained to a specific curve in TLS 1.3. - ECDSAWithP256AndSHA256 SignatureScheme = 0x0403 - ECDSAWithP384AndSHA384 SignatureScheme = 0x0503 - ECDSAWithP521AndSHA512 SignatureScheme = 0x0603 - - // Legacy signature and hash algorithms for TLS 1.2. - PKCS1WithSHA1 SignatureScheme = 0x0201 - ECDSAWithSHA1 SignatureScheme = 0x0203 -) - -// A ClientHelloInfo is a tls.ClientHelloInfo -type ClientHelloInfo = tls.ClientHelloInfo - -// The CertificateRequestInfo is a tls.CertificateRequestInfo -type CertificateRequestInfo = tls.CertificateRequestInfo - -// RenegotiationSupport enumerates the different levels of support for TLS -// renegotiation. TLS renegotiation is the act of performing subsequent -// handshakes on a connection after the first. This significantly complicates -// the state machine and has been the source of numerous, subtle security -// issues. Initiating a renegotiation is not supported, but support for -// accepting renegotiation requests may be enabled. -// -// Even when enabled, the server may not change its identity between handshakes -// (i.e. the leaf certificate must be the same). Additionally, concurrent -// handshake and application data flow is not permitted so renegotiation can -// only be used with protocols that synchronise with the renegotiation, such as -// HTTPS. -// -// Renegotiation is not defined in TLS 1.3. -type RenegotiationSupport int - -const ( - // RenegotiateNever disables renegotiation. - RenegotiateNever RenegotiationSupport = iota - - // RenegotiateOnceAsClient allows a remote server to request - // renegotiation once per connection. - RenegotiateOnceAsClient - - // RenegotiateFreelyAsClient allows a remote server to repeatedly - // request renegotiation. - RenegotiateFreelyAsClient -) - -// A Config structure is used to configure a TLS client or server. -// After one has been passed to a TLS function it must not be -// modified. A Config may be reused; the tls package will also not -// modify it. -type Config struct { - // Rand provides the source of entropy for nonces and RSA blinding. - // If Rand is nil, TLS uses the cryptographic random reader in package - // crypto/rand. - // The Reader must be safe for use by multiple goroutines. - Rand io.Reader - - // Time returns the current time as the number of seconds since the epoch. - // If Time is nil, TLS uses time.Now. - Time func() time.Time - - // Certificates contains one or more certificate chains to present to - // the other side of the connection. Server configurations must include - // at least one certificate or else set GetCertificate. Clients doing - // client-authentication may set either Certificates or - // GetClientCertificate. - Certificates []Certificate - - // NameToCertificate maps from a certificate name to an element of - // Certificates. Note that a certificate name can be of the form - // '*.example.com' and so doesn't have to be a domain name as such. - // See Config.BuildNameToCertificate - // The nil value causes the first element of Certificates to be used - // for all connections. - NameToCertificate map[string]*Certificate - - // GetCertificate returns a Certificate based on the given - // ClientHelloInfo. It will only be called if the client supplies SNI - // information or if Certificates is empty. - // - // If GetCertificate is nil or returns nil, then the certificate is - // retrieved from NameToCertificate. If NameToCertificate is nil, the - // first element of Certificates will be used. - GetCertificate func(*ClientHelloInfo) (*Certificate, error) - - // GetClientCertificate, if not nil, is called when a server requests a - // certificate from a client. If set, the contents of Certificates will - // be ignored. - // - // If GetClientCertificate returns an error, the handshake will be - // aborted and that error will be returned. Otherwise - // GetClientCertificate must return a non-nil Certificate. If - // Certificate.Certificate is empty then no certificate will be sent to - // the server. If this is unacceptable to the server then it may abort - // the handshake. - // - // GetClientCertificate may be called multiple times for the same - // connection if renegotiation occurs or if TLS 1.3 is in use. - GetClientCertificate func(*CertificateRequestInfo) (*Certificate, error) - - // GetConfigForClient, if not nil, is called after a ClientHello is - // received from a client. It may return a non-nil Config in order to - // change the Config that will be used to handle this connection. If - // the returned Config is nil, the original Config will be used. The - // Config returned by this callback may not be subsequently modified. - // - // If GetConfigForClient is nil, the Config passed to Server() will be - // used for all connections. - // - // Uniquely for the fields in the returned Config, session ticket keys - // will be duplicated from the original Config if not set. - // Specifically, if SetSessionTicketKeys was called on the original - // config but not on the returned config then the ticket keys from the - // original config will be copied into the new config before use. - // Otherwise, if SessionTicketKey was set in the original config but - // not in the returned config then it will be copied into the returned - // config before use. If neither of those cases applies then the key - // material from the returned config will be used for session tickets. - GetConfigForClient func(*ClientHelloInfo) (*Config, error) - - // VerifyPeerCertificate, if not nil, is called after normal - // certificate verification by either a TLS client or server. It - // receives the raw ASN.1 certificates provided by the peer and also - // any verified chains that normal processing found. If it returns a - // non-nil error, the handshake is aborted and that error results. - // - // If normal verification fails then the handshake will abort before - // considering this callback. If normal verification is disabled by - // setting InsecureSkipVerify, or (for a server) when ClientAuth is - // RequestClientCert or RequireAnyClientCert, then this callback will - // be considered but the verifiedChains argument will always be nil. - VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error - - // RootCAs defines the set of root certificate authorities - // that clients use when verifying server certificates. - // If RootCAs is nil, TLS uses the host's root CA set. - RootCAs *x509.CertPool - - // NextProtos is a list of supported application level protocols, in - // order of preference. - NextProtos []string - - // ServerName is used to verify the hostname on the returned - // certificates unless InsecureSkipVerify is given. It is also included - // in the client's handshake to support virtual hosting unless it is - // an IP address. - ServerName string - - // ClientAuth determines the server's policy for - // TLS Client Authentication. The default is NoClientCert. - ClientAuth ClientAuthType - - // ClientCAs defines the set of root certificate authorities - // that servers use if required to verify a client certificate - // by the policy in ClientAuth. - ClientCAs *x509.CertPool - - // InsecureSkipVerify controls whether a client verifies the - // server's certificate chain and host name. - // If InsecureSkipVerify is true, TLS accepts any certificate - // presented by the server and any host name in that certificate. - // In this mode, TLS is susceptible to man-in-the-middle attacks. - // This should be used only for testing. - InsecureSkipVerify bool - - // CipherSuites is a list of supported cipher suites for TLS versions up to - // TLS 1.2. If CipherSuites is nil, a default list of secure cipher suites - // is used, with a preference order based on hardware performance. The - // default cipher suites might change over Go versions. Note that TLS 1.3 - // ciphersuites are not configurable. - CipherSuites []uint16 - - // PreferServerCipherSuites controls whether the server selects the - // client's most preferred ciphersuite, or the server's most preferred - // ciphersuite. If true then the server's preference, as expressed in - // the order of elements in CipherSuites, is used. - PreferServerCipherSuites bool - - // SessionTicketsDisabled may be set to true to disable session ticket and - // PSK (resumption) support. Note that on clients, session ticket support is - // also disabled if ClientSessionCache is nil. - SessionTicketsDisabled bool - - // SessionTicketKey is used by TLS servers to provide session resumption. - // See RFC 5077 and the PSK mode of RFC 8446. If zero, it will be filled - // with random data before the first server handshake. - // - // If multiple servers are terminating connections for the same host - // they should all have the same SessionTicketKey. If the - // SessionTicketKey leaks, previously recorded and future TLS - // connections using that key might be compromised. - SessionTicketKey [32]byte - - // ClientSessionCache is a cache of ClientSessionState entries for TLS - // session resumption. It is only used by clients. - ClientSessionCache ClientSessionCache - - // MinVersion contains the minimum SSL/TLS version that is acceptable. - // If zero, then TLS 1.0 is taken as the minimum. - MinVersion uint16 - - // MaxVersion contains the maximum SSL/TLS version that is acceptable. - // If zero, then the maximum version supported by this package is used, - // which is currently TLS 1.3. - MaxVersion uint16 - - // CurvePreferences contains the elliptic curves that will be used in - // an ECDHE handshake, in preference order. If empty, the default will - // be used. The client will use the first preference as the type for - // its key share in TLS 1.3. This may change in the future. - CurvePreferences []CurveID - - // DynamicRecordSizingDisabled disables adaptive sizing of TLS records. - // When true, the largest possible TLS record size is always used. When - // false, the size of TLS records may be adjusted in an attempt to - // improve latency. - DynamicRecordSizingDisabled bool - - // Renegotiation controls what types of renegotiation are supported. - // The default, none, is correct for the vast majority of applications. - Renegotiation RenegotiationSupport - - // KeyLogWriter optionally specifies a destination for TLS master secrets - // in NSS key log format that can be used to allow external programs - // such as Wireshark to decrypt TLS connections. - // See https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format. - // Use of KeyLogWriter compromises security and should only be - // used for debugging. - KeyLogWriter io.Writer - - // GetExtensions, if not nil, is called before a message that allows - // sending of extensions is sent. - // Currently only implemented for the ClientHello message (for the client) - // and for the EncryptedExtensions message (for the server). - // Only valid for TLS 1.3. - GetExtensions func(handshakeMessageType uint8) []Extension - - // ReceivedExtensions, if not nil, is called when a message that allows the - // inclusion of extensions is received. - // It is called with an empty slice of extensions, if the message didn't - // contain any extensions. - // Currently only implemented for the ClientHello message (sent by the - // client) and for the EncryptedExtensions message (sent by the server). - // Only valid for TLS 1.3. - ReceivedExtensions func(handshakeMessageType uint8, exts []Extension) - - serverInitOnce sync.Once // guards calling (*Config).serverInit - - // mutex protects sessionTicketKeys. - mutex sync.RWMutex - // sessionTicketKeys contains zero or more ticket keys. If the length - // is zero, SessionTicketsDisabled must be true. The first key is used - // for new tickets and any subsequent keys can be used to decrypt old - // tickets. - sessionTicketKeys []ticketKey - - // AlternativeRecordLayer is used by QUIC - AlternativeRecordLayer RecordLayer - - // Enforce the selection of a supported application protocol. - // Only works for TLS 1.3. - // If enabled, client and server have to agree on an application protocol. - // Otherwise, connection establishment fails. - EnforceNextProtoSelection bool -} - -type RecordLayer interface { - SetReadKey(suite *CipherSuite, trafficSecret []byte) - SetWriteKey(suite *CipherSuite, trafficSecret []byte) - ReadHandshakeMessage() ([]byte, error) - WriteRecord([]byte) (int, error) - SendAlert(uint8) -} - -// ticketKeyNameLen is the number of bytes of identifier that is prepended to -// an encrypted session ticket in order to identify the key used to encrypt it. -const ticketKeyNameLen = 16 - -// ticketKey is the internal representation of a session ticket key. -type ticketKey struct { - // keyName is an opaque byte string that serves to identify the session - // ticket key. It's exposed as plaintext in every session ticket. - keyName [ticketKeyNameLen]byte - aesKey [16]byte - hmacKey [16]byte -} - -// ticketKeyFromBytes converts from the external representation of a session -// ticket key to a ticketKey. Externally, session ticket keys are 32 random -// bytes and this function expands that into sufficient name and key material. -func ticketKeyFromBytes(b [32]byte) (key ticketKey) { - hashed := sha512.Sum512(b[:]) - copy(key.keyName[:], hashed[:ticketKeyNameLen]) - copy(key.aesKey[:], hashed[ticketKeyNameLen:ticketKeyNameLen+16]) - copy(key.hmacKey[:], hashed[ticketKeyNameLen+16:ticketKeyNameLen+32]) - return key -} - -// maxSessionTicketLifetime is the maximum allowed lifetime of a TLS 1.3 session -// ticket, and the lifetime we set for tickets we send. -const maxSessionTicketLifetime = 7 * 24 * time.Hour - -// Clone returns a shallow clone of c. It is safe to clone a Config that is -// being used concurrently by a TLS client or server. -func (c *Config) Clone() *Config { - // Running serverInit ensures that it's safe to read - // SessionTicketsDisabled. - c.serverInitOnce.Do(func() { c.serverInit(nil) }) - - var sessionTicketKeys []ticketKey - c.mutex.RLock() - sessionTicketKeys = c.sessionTicketKeys - c.mutex.RUnlock() - - return &Config{ - Rand: c.Rand, - Time: c.Time, - Certificates: c.Certificates, - NameToCertificate: c.NameToCertificate, - GetCertificate: c.GetCertificate, - GetClientCertificate: c.GetClientCertificate, - GetConfigForClient: c.GetConfigForClient, - VerifyPeerCertificate: c.VerifyPeerCertificate, - RootCAs: c.RootCAs, - NextProtos: c.NextProtos, - ServerName: c.ServerName, - ClientAuth: c.ClientAuth, - ClientCAs: c.ClientCAs, - InsecureSkipVerify: c.InsecureSkipVerify, - CipherSuites: c.CipherSuites, - PreferServerCipherSuites: c.PreferServerCipherSuites, - SessionTicketsDisabled: c.SessionTicketsDisabled, - SessionTicketKey: c.SessionTicketKey, - ClientSessionCache: c.ClientSessionCache, - MinVersion: c.MinVersion, - MaxVersion: c.MaxVersion, - CurvePreferences: c.CurvePreferences, - DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, - Renegotiation: c.Renegotiation, - KeyLogWriter: c.KeyLogWriter, - GetExtensions: c.GetExtensions, - ReceivedExtensions: c.ReceivedExtensions, - sessionTicketKeys: sessionTicketKeys, - EnforceNextProtoSelection: c.EnforceNextProtoSelection, - } -} - -// serverInit is run under c.serverInitOnce to do initialization of c. If c was -// returned by a GetConfigForClient callback then the argument should be the -// Config that was passed to Server, otherwise it should be nil. -func (c *Config) serverInit(originalConfig *Config) { - if c.SessionTicketsDisabled || len(c.ticketKeys()) != 0 { - return - } - - alreadySet := false - for _, b := range c.SessionTicketKey { - if b != 0 { - alreadySet = true - break - } - } - - if !alreadySet { - if originalConfig != nil { - copy(c.SessionTicketKey[:], originalConfig.SessionTicketKey[:]) - } else if _, err := io.ReadFull(c.rand(), c.SessionTicketKey[:]); err != nil { - c.SessionTicketsDisabled = true - return - } - } - - if originalConfig != nil { - originalConfig.mutex.RLock() - c.sessionTicketKeys = originalConfig.sessionTicketKeys - originalConfig.mutex.RUnlock() - } else { - c.sessionTicketKeys = []ticketKey{ticketKeyFromBytes(c.SessionTicketKey)} - } -} - -func (c *Config) ticketKeys() []ticketKey { - c.mutex.RLock() - // c.sessionTicketKeys is constant once created. SetSessionTicketKeys - // will only update it by replacing it with a new value. - ret := c.sessionTicketKeys - c.mutex.RUnlock() - return ret -} - -// SetSessionTicketKeys updates the session ticket keys for a server. The first -// key will be used when creating new tickets, while all keys can be used for -// decrypting tickets. It is safe to call this function while the server is -// running in order to rotate the session ticket keys. The function will panic -// if keys is empty. -func (c *Config) SetSessionTicketKeys(keys [][32]byte) { - if len(keys) == 0 { - panic("tls: keys must have at least one key") - } - - newKeys := make([]ticketKey, len(keys)) - for i, bytes := range keys { - newKeys[i] = ticketKeyFromBytes(bytes) - } - - c.mutex.Lock() - c.sessionTicketKeys = newKeys - c.mutex.Unlock() -} - -func (c *Config) rand() io.Reader { - r := c.Rand - if r == nil { - return rand.Reader - } - return r -} - -func (c *Config) time() time.Time { - t := c.Time - if t == nil { - t = time.Now - } - return t() -} - -func (c *Config) cipherSuites() []uint16 { - s := c.CipherSuites - if s == nil { - s = defaultCipherSuites() - } - return s -} - -var supportedVersions = []uint16{ - VersionTLS13, - VersionTLS12, - VersionTLS11, - VersionTLS10, - VersionSSL30, -} - -func (c *Config) supportedVersions(isClient bool) []uint16 { - versions := make([]uint16, 0, len(supportedVersions)) - for _, v := range supportedVersions { - if c != nil && c.MinVersion != 0 && v < c.MinVersion { - continue - } - if c != nil && c.MaxVersion != 0 && v > c.MaxVersion { - continue - } - // TLS 1.0 is the minimum version supported as a client. - if isClient && v < VersionTLS10 { - continue - } - // TLS 1.3 is opt-in in Go 1.12. - if v == VersionTLS13 && !isTLS13Supported() { - continue - } - versions = append(versions, v) - } - return versions -} - -// tls13Support caches the result for isTLS13Supported. -var tls13Support struct { - sync.Once - cached bool -} - -// isTLS13Supported returns whether the program opted into TLS 1.3 via -// GODEBUG=tls13=1. It's cached after the first execution. -func isTLS13Supported() bool { - return true - tls13Support.Do(func() { - tls13Support.cached = goDebugString("tls13") == "1" - }) - return tls13Support.cached -} - -// goDebugString returns the value of the named GODEBUG key. -// GODEBUG is of the form "key=val,key2=val2". -func goDebugString(key string) string { - s := os.Getenv("GODEBUG") - for i := 0; i < len(s)-len(key)-1; i++ { - if i > 0 && s[i-1] != ',' { - continue - } - afterKey := s[i+len(key):] - if afterKey[0] != '=' || s[i:i+len(key)] != key { - continue - } - val := afterKey[1:] - for i, b := range val { - if b == ',' { - return val[:i] - } - } - return val - } - return "" -} - -func (c *Config) maxSupportedVersion(isClient bool) uint16 { - supportedVersions := c.supportedVersions(isClient) - if len(supportedVersions) == 0 { - return 0 - } - return supportedVersions[0] -} - -// supportedVersionsFromMax returns a list of supported versions derived from a -// legacy maximum version value. Note that only versions supported by this -// library are returned. Any newer peer will use supportedVersions anyway. -func supportedVersionsFromMax(maxVersion uint16) []uint16 { - versions := make([]uint16, 0, len(supportedVersions)) - for _, v := range supportedVersions { - if v > maxVersion { - continue - } - versions = append(versions, v) - } - return versions -} - -var defaultCurvePreferences = []CurveID{X25519, CurveP256, CurveP384, CurveP521} - -func (c *Config) curvePreferences() []CurveID { - if c == nil || len(c.CurvePreferences) == 0 { - return defaultCurvePreferences - } - return c.CurvePreferences -} - -// mutualVersion returns the protocol version to use given the advertised -// versions of the peer. Priority is given to the peer preference order. -func (c *Config) mutualVersion(isClient bool, peerVersions []uint16) (uint16, bool) { - supportedVersions := c.supportedVersions(isClient) - for _, peerVersion := range peerVersions { - for _, v := range supportedVersions { - if v == peerVersion { - return v, true - } - } - } - return 0, false -} - -// getCertificate returns the best certificate for the given ClientHelloInfo, -// defaulting to the first element of c.Certificates. -func (c *Config) getCertificate(clientHello *ClientHelloInfo) (*Certificate, error) { - if c.GetCertificate != nil && - (len(c.Certificates) == 0 || len(clientHello.ServerName) > 0) { - cert, err := c.GetCertificate(clientHello) - if cert != nil || err != nil { - return cert, err - } - } - - if len(c.Certificates) == 0 { - return nil, errors.New("tls: no certificates configured") - } - - if len(c.Certificates) == 1 || c.NameToCertificate == nil { - // There's only one choice, so no point doing any work. - return &c.Certificates[0], nil - } - - name := strings.ToLower(clientHello.ServerName) - for len(name) > 0 && name[len(name)-1] == '.' { - name = name[:len(name)-1] - } - - if cert, ok := c.NameToCertificate[name]; ok { - return cert, nil - } - - // try replacing labels in the name with wildcards until we get a - // match. - labels := strings.Split(name, ".") - for i := range labels { - labels[i] = "*" - candidate := strings.Join(labels, ".") - if cert, ok := c.NameToCertificate[candidate]; ok { - return cert, nil - } - } - - // If nothing matches, return the first certificate. - return &c.Certificates[0], nil -} - -// BuildNameToCertificate parses c.Certificates and builds c.NameToCertificate -// from the CommonName and SubjectAlternateName fields of each of the leaf -// certificates. -func (c *Config) BuildNameToCertificate() { - c.NameToCertificate = make(map[string]*Certificate) - for i := range c.Certificates { - cert := &c.Certificates[i] - x509Cert := cert.Leaf - if x509Cert == nil { - var err error - x509Cert, err = x509.ParseCertificate(cert.Certificate[0]) - if err != nil { - continue - } - } - if len(x509Cert.Subject.CommonName) > 0 { - c.NameToCertificate[x509Cert.Subject.CommonName] = cert - } - for _, san := range x509Cert.DNSNames { - c.NameToCertificate[san] = cert - } - } -} - -const ( - keyLogLabelTLS12 = "CLIENT_RANDOM" - keyLogLabelClientHandshake = "CLIENT_HANDSHAKE_TRAFFIC_SECRET" - keyLogLabelServerHandshake = "SERVER_HANDSHAKE_TRAFFIC_SECRET" - keyLogLabelClientTraffic = "CLIENT_TRAFFIC_SECRET_0" - keyLogLabelServerTraffic = "SERVER_TRAFFIC_SECRET_0" -) - -func (c *Config) writeKeyLog(label string, clientRandom, secret []byte) error { - if c.KeyLogWriter == nil { - return nil - } - - logLine := []byte(fmt.Sprintf("%s %x %x\n", label, clientRandom, secret)) - - writerMutex.Lock() - _, err := c.KeyLogWriter.Write(logLine) - writerMutex.Unlock() - - return err -} - -// writerMutex protects all KeyLogWriters globally. It is rarely enabled, -// and is only for debugging, so a global mutex saves space. -var writerMutex sync.Mutex - -// A Certificate is a tls.Certificate -type Certificate = tls.Certificate - -type handshakeMessage interface { - marshal() []byte - unmarshal([]byte) bool -} - -// lruSessionCache is a ClientSessionCache implementation that uses an LRU -// caching strategy. -type lruSessionCache struct { - sync.Mutex - - m map[string]*list.Element - q *list.List - capacity int -} - -type lruSessionCacheEntry struct { - sessionKey string - state *ClientSessionState -} - -// NewLRUClientSessionCache returns a ClientSessionCache with the given -// capacity that uses an LRU strategy. If capacity is < 1, a default capacity -// is used instead. -func NewLRUClientSessionCache(capacity int) ClientSessionCache { - const defaultSessionCacheCapacity = 64 - - if capacity < 1 { - capacity = defaultSessionCacheCapacity - } - return &lruSessionCache{ - m: make(map[string]*list.Element), - q: list.New(), - capacity: capacity, - } -} - -// Put adds the provided (sessionKey, cs) pair to the cache. If cs is nil, the entry -// corresponding to sessionKey is removed from the cache instead. -func (c *lruSessionCache) Put(sessionKey string, cs *ClientSessionState) { - c.Lock() - defer c.Unlock() - - if elem, ok := c.m[sessionKey]; ok { - if cs == nil { - c.q.Remove(elem) - delete(c.m, sessionKey) - } else { - entry := elem.Value.(*lruSessionCacheEntry) - entry.state = cs - c.q.MoveToFront(elem) - } - return - } - - if c.q.Len() < c.capacity { - entry := &lruSessionCacheEntry{sessionKey, cs} - c.m[sessionKey] = c.q.PushFront(entry) - return - } - - elem := c.q.Back() - entry := elem.Value.(*lruSessionCacheEntry) - delete(c.m, entry.sessionKey) - entry.sessionKey = sessionKey - entry.state = cs - c.q.MoveToFront(elem) - c.m[sessionKey] = elem -} - -// Get returns the ClientSessionState value associated with a given key. It -// returns (nil, false) if no value is found. -func (c *lruSessionCache) Get(sessionKey string) (*ClientSessionState, bool) { - c.Lock() - defer c.Unlock() - - if elem, ok := c.m[sessionKey]; ok { - c.q.MoveToFront(elem) - return elem.Value.(*lruSessionCacheEntry).state, true - } - return nil, false -} - -// TODO(jsing): Make these available to both crypto/x509 and crypto/tls. -type dsaSignature struct { - R, S *big.Int -} - -type ecdsaSignature dsaSignature - -var emptyConfig Config - -func defaultConfig() *Config { - return &emptyConfig -} - -var ( - once sync.Once - varDefaultCipherSuites []uint16 - varDefaultCipherSuitesTLS13 []uint16 -) - -func defaultCipherSuites() []uint16 { - once.Do(initDefaultCipherSuites) - return varDefaultCipherSuites -} - -func defaultCipherSuitesTLS13() []uint16 { - once.Do(initDefaultCipherSuites) - return varDefaultCipherSuitesTLS13 -} - -func initDefaultCipherSuites() { - var topCipherSuites []uint16 - - // Check the cpu flags for each platform that has optimized GCM implementations. - // Worst case, these variables will just all be false. - var ( - hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ - hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL - // Keep in sync with crypto/aes/cipher_s390x.go. - // TODO: check for s390 - // hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR && (cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM) - hasGCMAsmS390X = false - - hasGCMAsm = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X - ) - - if hasGCMAsm { - // If AES-GCM hardware is provided then prioritise AES-GCM - // cipher suites. - topCipherSuites = []uint16{ - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, - } - varDefaultCipherSuitesTLS13 = []uint16{ - TLS_AES_128_GCM_SHA256, - TLS_CHACHA20_POLY1305_SHA256, - TLS_AES_256_GCM_SHA384, - } - } else { - // Without AES-GCM hardware, we put the ChaCha20-Poly1305 - // cipher suites first. - topCipherSuites = []uint16{ - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - } - varDefaultCipherSuitesTLS13 = []uint16{ - TLS_CHACHA20_POLY1305_SHA256, - TLS_AES_128_GCM_SHA256, - TLS_AES_256_GCM_SHA384, - } - } - - varDefaultCipherSuites = make([]uint16, 0, len(cipherSuites)) - varDefaultCipherSuites = append(varDefaultCipherSuites, topCipherSuites...) - -NextCipherSuite: - for _, suite := range cipherSuites { - if suite.flags&suiteDefaultOff != 0 { - continue - } - for _, existing := range varDefaultCipherSuites { - if existing == suite.id { - continue NextCipherSuite - } - } - varDefaultCipherSuites = append(varDefaultCipherSuites, suite.id) - } -} - -func unexpectedMessageError(wanted, got interface{}) error { - return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted) -} - -func isSupportedSignatureAlgorithm(sigAlg SignatureScheme, supportedSignatureAlgorithms []SignatureScheme) bool { - for _, s := range supportedSignatureAlgorithms { - if s == sigAlg { - return true - } - } - return false -} - -// signatureFromSignatureScheme maps a signature algorithm to the underlying -// signature method (without hash function). -func signatureFromSignatureScheme(signatureAlgorithm SignatureScheme) uint8 { - switch signatureAlgorithm { - case PKCS1WithSHA1, PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512: - return signaturePKCS1v15 - case PSSWithSHA256, PSSWithSHA384, PSSWithSHA512: - return signatureRSAPSS - case ECDSAWithSHA1, ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512: - return signatureECDSA - default: - return 0 - } -} diff --git a/vendor/github.com/marten-seemann/qtls/conn.go b/vendor/github.com/marten-seemann/qtls/conn.go deleted file mode 100644 index bbb67e56..00000000 --- a/vendor/github.com/marten-seemann/qtls/conn.go +++ /dev/null @@ -1,1467 +0,0 @@ -// Copyright 2010 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. - -// TLS low level connection and record layer - -package qtls - -import ( - "bytes" - "crypto/cipher" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - "net" - "sync" - "sync/atomic" - "time" -) - -// A Conn represents a secured connection. -// It implements the net.Conn interface. -type Conn struct { - // constant - conn net.Conn - isClient bool - - // handshakeStatus is 1 if the connection is currently transferring - // application data (i.e. is not currently processing a handshake). - // This field is only to be accessed with sync/atomic. - handshakeStatus uint32 - // constant after handshake; protected by handshakeMutex - handshakeMutex sync.Mutex - handshakeErr error // error resulting from handshake - vers uint16 // TLS version - haveVers bool // version has been negotiated - config *Config // configuration passed to constructor - // handshakes counts the number of handshakes performed on the - // connection so far. If renegotiation is disabled then this is either - // zero or one. - handshakes int - didResume bool // whether this connection was a session resumption - cipherSuite uint16 - ocspResponse []byte // stapled OCSP response - scts [][]byte // signed certificate timestamps from server - peerCertificates []*x509.Certificate - // verifiedChains contains the certificate chains that we built, as - // opposed to the ones presented by the server. - verifiedChains [][]*x509.Certificate - // serverName contains the server name indicated by the client, if any. - serverName string - // secureRenegotiation is true if the server echoed the secure - // renegotiation extension. (This is meaningless as a server because - // renegotiation is not supported in that case.) - secureRenegotiation bool - // ekm is a closure for exporting keying material. - ekm func(label string, context []byte, length int) ([]byte, error) - // resumptionSecret is the resumption_master_secret for handling - // NewSessionTicket messages. nil if config.SessionTicketsDisabled. - resumptionSecret []byte - - // clientFinishedIsFirst is true if the client sent the first Finished - // message during the most recent handshake. This is recorded because - // the first transmitted Finished message is the tls-unique - // channel-binding value. - clientFinishedIsFirst bool - - // closeNotifyErr is any error from sending the alertCloseNotify record. - closeNotifyErr error - // closeNotifySent is true if the Conn attempted to send an - // alertCloseNotify record. - closeNotifySent bool - - // clientFinished and serverFinished contain the Finished message sent - // by the client or server in the most recent handshake. This is - // retained to support the renegotiation extension and tls-unique - // channel-binding. - clientFinished [12]byte - serverFinished [12]byte - - clientProtocol string - clientProtocolFallback bool - - // input/output - in, out halfConn - rawInput bytes.Buffer // raw input, starting with a record header - input bytes.Reader // application data waiting to be read, from rawInput.Next - hand bytes.Buffer // handshake data waiting to be read - outBuf []byte // scratch buffer used by out.encrypt - buffering bool // whether records are buffered in sendBuf - sendBuf []byte // a buffer of records waiting to be sent - - // bytesSent counts the bytes of application data sent. - // packetsSent counts packets. - bytesSent int64 - packetsSent int64 - - // retryCount counts the number of consecutive non-advancing records - // received by Conn.readRecord. That is, records that neither advance the - // handshake, nor deliver application data. Protected by in.Mutex. - retryCount int - - // activeCall is an atomic int32; the low bit is whether Close has - // been called. the rest of the bits are the number of goroutines - // in Conn.Write. - activeCall int32 - - tmp [16]byte -} - -// Access to net.Conn methods. -// Cannot just embed net.Conn because that would -// export the struct field too. - -// LocalAddr returns the local network address. -func (c *Conn) LocalAddr() net.Addr { - return c.conn.LocalAddr() -} - -// RemoteAddr returns the remote network address. -func (c *Conn) RemoteAddr() net.Addr { - return c.conn.RemoteAddr() -} - -// SetDeadline sets the read and write deadlines associated with the connection. -// A zero value for t means Read and Write will not time out. -// After a Write has timed out, the TLS state is corrupt and all future writes will return the same error. -func (c *Conn) SetDeadline(t time.Time) error { - return c.conn.SetDeadline(t) -} - -// SetReadDeadline sets the read deadline on the underlying connection. -// A zero value for t means Read will not time out. -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.conn.SetReadDeadline(t) -} - -// SetWriteDeadline sets the write deadline on the underlying connection. -// A zero value for t means Write will not time out. -// After a Write has timed out, the TLS state is corrupt and all future writes will return the same error. -func (c *Conn) SetWriteDeadline(t time.Time) error { - return c.conn.SetWriteDeadline(t) -} - -// A halfConn represents one direction of the record layer -// connection, either sending or receiving. -type halfConn struct { - sync.Mutex - - err error // first permanent error - version uint16 // protocol version - cipher interface{} // cipher algorithm - mac macFunction - seq [8]byte // 64-bit sequence number - additionalData [13]byte // to avoid allocs; interface method args escape - - nextCipher interface{} // next encryption state - nextMac macFunction // next MAC algorithm - - trafficSecret []byte // current TLS 1.3 traffic secret - - setKeyCallback func(suite *CipherSuite, trafficSecret []byte) -} - -func (hc *halfConn) setErrorLocked(err error) error { - hc.err = err - return err -} - -// prepareCipherSpec sets the encryption and MAC states -// that a subsequent changeCipherSpec will use. -func (hc *halfConn) prepareCipherSpec(version uint16, cipher interface{}, mac macFunction) { - hc.version = version - hc.nextCipher = cipher - hc.nextMac = mac -} - -// changeCipherSpec changes the encryption and MAC states -// to the ones previously passed to prepareCipherSpec. -func (hc *halfConn) changeCipherSpec() error { - if hc.nextCipher == nil || hc.version == VersionTLS13 { - return alertInternalError - } - hc.cipher = hc.nextCipher - hc.mac = hc.nextMac - hc.nextCipher = nil - hc.nextMac = nil - for i := range hc.seq { - hc.seq[i] = 0 - } - return nil -} - -func (hc *halfConn) exportKey(suite *cipherSuiteTLS13, trafficSecret []byte) { - if hc.setKeyCallback != nil { - hc.setKeyCallback(&CipherSuite{suite}, trafficSecret) - } -} - -func (hc *halfConn) setTrafficSecret(suite *cipherSuiteTLS13, secret []byte) { - hc.trafficSecret = secret - key, iv := suite.trafficKey(secret) - hc.cipher = suite.aead(key, iv) - for i := range hc.seq { - hc.seq[i] = 0 - } -} - -// incSeq increments the sequence number. -func (hc *halfConn) incSeq() { - for i := 7; i >= 0; i-- { - hc.seq[i]++ - if hc.seq[i] != 0 { - return - } - } - - // Not allowed to let sequence number wrap. - // Instead, must renegotiate before it does. - // Not likely enough to bother. - panic("TLS: sequence number wraparound") -} - -// explicitNonceLen returns the number of bytes of explicit nonce or IV included -// in each record. Explicit nonces are present only in CBC modes after TLS 1.0 -// and in certain AEAD modes in TLS 1.2. -func (hc *halfConn) explicitNonceLen() int { - if hc.cipher == nil { - return 0 - } - - switch c := hc.cipher.(type) { - case cipher.Stream: - return 0 - case aead: - return c.explicitNonceLen() - case cbcMode: - // TLS 1.1 introduced a per-record explicit IV to fix the BEAST attack. - if hc.version >= VersionTLS11 { - return c.BlockSize() - } - return 0 - default: - panic("unknown cipher type") - } -} - -// extractPadding returns, in constant time, the length of the padding to remove -// from the end of payload. It also returns a byte which is equal to 255 if the -// padding was valid and 0 otherwise. See RFC 2246, Section 6.2.3.2. -func extractPadding(payload []byte) (toRemove int, good byte) { - if len(payload) < 1 { - return 0, 0 - } - - paddingLen := payload[len(payload)-1] - t := uint(len(payload)-1) - uint(paddingLen) - // if len(payload) >= (paddingLen - 1) then the MSB of t is zero - good = byte(int32(^t) >> 31) - - // The maximum possible padding length plus the actual length field - toCheck := 256 - // The length of the padded data is public, so we can use an if here - if toCheck > len(payload) { - toCheck = len(payload) - } - - for i := 0; i < toCheck; i++ { - t := uint(paddingLen) - uint(i) - // if i <= paddingLen then the MSB of t is zero - mask := byte(int32(^t) >> 31) - b := payload[len(payload)-1-i] - good &^= mask&paddingLen ^ mask&b - } - - // We AND together the bits of good and replicate the result across - // all the bits. - good &= good << 4 - good &= good << 2 - good &= good << 1 - good = uint8(int8(good) >> 7) - - toRemove = int(paddingLen) + 1 - return -} - -// extractPaddingSSL30 is a replacement for extractPadding in the case that the -// protocol version is SSLv3. In this version, the contents of the padding -// are random and cannot be checked. -func extractPaddingSSL30(payload []byte) (toRemove int, good byte) { - if len(payload) < 1 { - return 0, 0 - } - - paddingLen := int(payload[len(payload)-1]) + 1 - if paddingLen > len(payload) { - return 0, 0 - } - - return paddingLen, 255 -} - -func roundUp(a, b int) int { - return a + (b-a%b)%b -} - -// cbcMode is an interface for block ciphers using cipher block chaining. -type cbcMode interface { - cipher.BlockMode - SetIV([]byte) -} - -// decrypt authenticates and decrypts the record if protection is active at -// this stage. The returned plaintext might overlap with the input. -func (hc *halfConn) decrypt(record []byte) ([]byte, recordType, error) { - var plaintext []byte - typ := recordType(record[0]) - payload := record[recordHeaderLen:] - - // In TLS 1.3, change_cipher_spec messages are to be ignored without being - // decrypted. See RFC 8446, Appendix D.4. - if hc.version == VersionTLS13 && typ == recordTypeChangeCipherSpec { - return payload, typ, nil - } - - paddingGood := byte(255) - paddingLen := 0 - - explicitNonceLen := hc.explicitNonceLen() - - if hc.cipher != nil { - switch c := hc.cipher.(type) { - case cipher.Stream: - c.XORKeyStream(payload, payload) - case aead: - if len(payload) < explicitNonceLen { - return nil, 0, alertBadRecordMAC - } - nonce := payload[:explicitNonceLen] - if len(nonce) == 0 { - nonce = hc.seq[:] - } - payload = payload[explicitNonceLen:] - - additionalData := hc.additionalData[:] - if hc.version == VersionTLS13 { - additionalData = record[:recordHeaderLen] - } else { - copy(additionalData, hc.seq[:]) - copy(additionalData[8:], record[:3]) - n := len(payload) - c.Overhead() - additionalData[11] = byte(n >> 8) - additionalData[12] = byte(n) - } - - var err error - plaintext, err = c.Open(payload[:0], nonce, payload, additionalData) - if err != nil { - return nil, 0, alertBadRecordMAC - } - case cbcMode: - blockSize := c.BlockSize() - minPayload := explicitNonceLen + roundUp(hc.mac.Size()+1, blockSize) - if len(payload)%blockSize != 0 || len(payload) < minPayload { - return nil, 0, alertBadRecordMAC - } - - if explicitNonceLen > 0 { - c.SetIV(payload[:explicitNonceLen]) - payload = payload[explicitNonceLen:] - } - c.CryptBlocks(payload, payload) - - // In a limited attempt to protect against CBC padding oracles like - // Lucky13, the data past paddingLen (which is secret) is passed to - // the MAC function as extra data, to be fed into the HMAC after - // computing the digest. This makes the MAC roughly constant time as - // long as the digest computation is constant time and does not - // affect the subsequent write, modulo cache effects. - if hc.version == VersionSSL30 { - paddingLen, paddingGood = extractPaddingSSL30(payload) - } else { - paddingLen, paddingGood = extractPadding(payload) - } - default: - panic("unknown cipher type") - } - - if hc.version == VersionTLS13 { - if typ != recordTypeApplicationData { - return nil, 0, alertUnexpectedMessage - } - if len(plaintext) > maxPlaintext+1 { - return nil, 0, alertRecordOverflow - } - // Remove padding and find the ContentType scanning from the end. - for i := len(plaintext) - 1; i >= 0; i-- { - if plaintext[i] != 0 { - typ = recordType(plaintext[i]) - plaintext = plaintext[:i] - break - } - if i == 0 { - return nil, 0, alertUnexpectedMessage - } - } - } - } else { - plaintext = payload - } - - if hc.mac != nil { - macSize := hc.mac.Size() - if len(payload) < macSize { - return nil, 0, alertBadRecordMAC - } - - n := len(payload) - macSize - paddingLen - n = subtle.ConstantTimeSelect(int(uint32(n)>>31), 0, n) // if n < 0 { n = 0 } - record[3] = byte(n >> 8) - record[4] = byte(n) - remoteMAC := payload[n : n+macSize] - localMAC := hc.mac.MAC(hc.seq[0:], record[:recordHeaderLen], payload[:n], payload[n+macSize:]) - - if subtle.ConstantTimeCompare(localMAC, remoteMAC) != 1 || paddingGood != 255 { - return nil, 0, alertBadRecordMAC - } - - plaintext = payload[:n] - } - - hc.incSeq() - return plaintext, typ, nil -} - -func (c *Conn) setAlternativeRecordLayer() { - if c.config.AlternativeRecordLayer != nil { - c.in.setKeyCallback = c.config.AlternativeRecordLayer.SetReadKey - c.out.setKeyCallback = c.config.AlternativeRecordLayer.SetWriteKey - } -} - -// sliceForAppend extends the input slice by n bytes. head is the full extended -// slice, while tail is the appended part. If the original slice has sufficient -// capacity no allocation is performed. -func sliceForAppend(in []byte, n int) (head, tail []byte) { - if total := len(in) + n; cap(in) >= total { - head = in[:total] - } else { - head = make([]byte, total) - copy(head, in) - } - tail = head[len(in):] - return -} - -// encrypt encrypts payload, adding the appropriate nonce and/or MAC, and -// appends it to record, which contains the record header. -func (hc *halfConn) encrypt(record, payload []byte, rand io.Reader) ([]byte, error) { - if hc.cipher == nil { - return append(record, payload...), nil - } - - var explicitNonce []byte - if explicitNonceLen := hc.explicitNonceLen(); explicitNonceLen > 0 { - record, explicitNonce = sliceForAppend(record, explicitNonceLen) - if _, isCBC := hc.cipher.(cbcMode); !isCBC && explicitNonceLen < 16 { - // The AES-GCM construction in TLS has an explicit nonce so that the - // nonce can be random. However, the nonce is only 8 bytes which is - // too small for a secure, random nonce. Therefore we use the - // sequence number as the nonce. The 3DES-CBC construction also has - // an 8 bytes nonce but its nonces must be unpredictable (see RFC - // 5246, Appendix F.3), forcing us to use randomness. That's not - // 3DES' biggest problem anyway because the birthday bound on block - // collision is reached first due to its simlarly small block size - // (see the Sweet32 attack). - copy(explicitNonce, hc.seq[:]) - } else { - if _, err := io.ReadFull(rand, explicitNonce); err != nil { - return nil, err - } - } - } - - var mac []byte - if hc.mac != nil { - mac = hc.mac.MAC(hc.seq[:], record[:recordHeaderLen], payload, nil) - } - - var dst []byte - switch c := hc.cipher.(type) { - case cipher.Stream: - record, dst = sliceForAppend(record, len(payload)+len(mac)) - c.XORKeyStream(dst[:len(payload)], payload) - c.XORKeyStream(dst[len(payload):], mac) - case aead: - nonce := explicitNonce - if len(nonce) == 0 { - nonce = hc.seq[:] - } - - if hc.version == VersionTLS13 { - record = append(record, payload...) - - // Encrypt the actual ContentType and replace the plaintext one. - record = append(record, record[0]) - record[0] = byte(recordTypeApplicationData) - - n := len(payload) + 1 + c.Overhead() - record[3] = byte(n >> 8) - record[4] = byte(n) - - record = c.Seal(record[:recordHeaderLen], - nonce, record[recordHeaderLen:], record[:recordHeaderLen]) - } else { - copy(hc.additionalData[:], hc.seq[:]) - copy(hc.additionalData[8:], record) - record = c.Seal(record, nonce, payload, hc.additionalData[:]) - } - case cbcMode: - blockSize := c.BlockSize() - plaintextLen := len(payload) + len(mac) - paddingLen := blockSize - plaintextLen%blockSize - record, dst = sliceForAppend(record, plaintextLen+paddingLen) - copy(dst, payload) - copy(dst[len(payload):], mac) - for i := plaintextLen; i < len(dst); i++ { - dst[i] = byte(paddingLen - 1) - } - if len(explicitNonce) > 0 { - c.SetIV(explicitNonce) - } - c.CryptBlocks(dst, dst) - default: - panic("unknown cipher type") - } - - // Update length to include nonce, MAC and any block padding needed. - n := len(record) - recordHeaderLen - record[3] = byte(n >> 8) - record[4] = byte(n) - hc.incSeq() - - return record, nil -} - -// RecordHeaderError is returned when a TLS record header is invalid. -type RecordHeaderError struct { - // Msg contains a human readable string that describes the error. - Msg string - // RecordHeader contains the five bytes of TLS record header that - // triggered the error. - RecordHeader [5]byte - // Conn provides the underlying net.Conn in the case that a client - // sent an initial handshake that didn't look like TLS. - // It is nil if there's already been a handshake or a TLS alert has - // been written to the connection. - Conn net.Conn -} - -func (e RecordHeaderError) Error() string { return "tls: " + e.Msg } - -func (c *Conn) newRecordHeaderError(conn net.Conn, msg string) (err RecordHeaderError) { - err.Msg = msg - err.Conn = conn - copy(err.RecordHeader[:], c.rawInput.Bytes()) - return err -} - -func (c *Conn) readRecord() error { - return c.readRecordOrCCS(false) -} - -func (c *Conn) readChangeCipherSpec() error { - return c.readRecordOrCCS(true) -} - -// readRecordOrCCS reads one or more TLS records from the connection and -// updates the record layer state. Some invariants: -// * c.in must be locked -// * c.input must be empty -// During the handshake one and only one of the following will happen: -// - c.hand grows -// - c.in.changeCipherSpec is called -// - an error is returned -// After the handshake one and only one of the following will happen: -// - c.hand grows -// - c.input is set -// - an error is returned -func (c *Conn) readRecordOrCCS(expectChangeCipherSpec bool) error { - if c.in.err != nil { - return c.in.err - } - handshakeComplete := c.handshakeComplete() - - // This function modifies c.rawInput, which owns the c.input memory. - if c.input.Len() != 0 { - return c.in.setErrorLocked(errors.New("tls: internal error: attempted to read record with pending application data")) - } - c.input.Reset(nil) - - // Read header, payload. - if err := c.readFromUntil(c.conn, recordHeaderLen); err != nil { - // RFC 8446, Section 6.1 suggests that EOF without an alertCloseNotify - // is an error, but popular web sites seem to do this, so we accept it - // if and only if at the record boundary. - if err == io.ErrUnexpectedEOF && c.rawInput.Len() == 0 { - err = io.EOF - } - if e, ok := err.(net.Error); !ok || !e.Temporary() { - c.in.setErrorLocked(err) - } - return err - } - hdr := c.rawInput.Bytes()[:recordHeaderLen] - typ := recordType(hdr[0]) - - // No valid TLS record has a type of 0x80, however SSLv2 handshakes - // start with a uint16 length where the MSB is set and the first record - // is always < 256 bytes long. Therefore typ == 0x80 strongly suggests - // an SSLv2 client. - if !handshakeComplete && typ == 0x80 { - c.sendAlert(alertProtocolVersion) - return c.in.setErrorLocked(c.newRecordHeaderError(nil, "unsupported SSLv2 handshake received")) - } - - vers := uint16(hdr[1])<<8 | uint16(hdr[2]) - n := int(hdr[3])<<8 | int(hdr[4]) - if c.haveVers && c.vers != VersionTLS13 && vers != c.vers { - c.sendAlert(alertProtocolVersion) - msg := fmt.Sprintf("received record with version %x when expecting version %x", vers, c.vers) - return c.in.setErrorLocked(c.newRecordHeaderError(nil, msg)) - } - if !c.haveVers { - // First message, be extra suspicious: this might not be a TLS - // client. Bail out before reading a full 'body', if possible. - // The current max version is 3.3 so if the version is >= 16.0, - // it's probably not real. - if (typ != recordTypeAlert && typ != recordTypeHandshake) || vers >= 0x1000 { - return c.in.setErrorLocked(c.newRecordHeaderError(c.conn, "first record does not look like a TLS handshake")) - } - } - if c.vers == VersionTLS13 && n > maxCiphertextTLS13 || n > maxCiphertext { - c.sendAlert(alertRecordOverflow) - msg := fmt.Sprintf("oversized record received with length %d", n) - return c.in.setErrorLocked(c.newRecordHeaderError(nil, msg)) - } - if err := c.readFromUntil(c.conn, recordHeaderLen+n); err != nil { - if e, ok := err.(net.Error); !ok || !e.Temporary() { - c.in.setErrorLocked(err) - } - return err - } - - // Process message. - record := c.rawInput.Next(recordHeaderLen + n) - data, typ, err := c.in.decrypt(record) - if err != nil { - return c.in.setErrorLocked(c.sendAlert(err.(alert))) - } - if len(data) > maxPlaintext { - return c.in.setErrorLocked(c.sendAlert(alertRecordOverflow)) - } - - // Application Data messages are always protected. - if c.in.cipher == nil && typ == recordTypeApplicationData { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - if typ != recordTypeAlert && typ != recordTypeChangeCipherSpec && len(data) > 0 { - // This is a state-advancing message: reset the retry count. - c.retryCount = 0 - } - - // Handshake messages MUST NOT be interleaved with other record types in TLS 1.3. - if c.vers == VersionTLS13 && typ != recordTypeHandshake && c.hand.Len() > 0 { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - switch typ { - default: - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - - case recordTypeAlert: - if len(data) != 2 { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - if alert(data[1]) == alertCloseNotify { - return c.in.setErrorLocked(io.EOF) - } - if c.vers == VersionTLS13 { - return c.in.setErrorLocked(&net.OpError{Op: "remote error", Err: alert(data[1])}) - } - switch data[0] { - case alertLevelWarning: - // Drop the record on the floor and retry. - return c.retryReadRecord(expectChangeCipherSpec) - case alertLevelError: - return c.in.setErrorLocked(&net.OpError{Op: "remote error", Err: alert(data[1])}) - default: - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - case recordTypeChangeCipherSpec: - if len(data) != 1 || data[0] != 1 { - return c.in.setErrorLocked(c.sendAlert(alertDecodeError)) - } - // Handshake messages are not allowed to fragment across the CCS. - if c.hand.Len() > 0 { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - // In TLS 1.3, change_cipher_spec records are ignored until the - // Finished. See RFC 8446, Appendix D.4. Note that according to Section - // 5, a server can send a ChangeCipherSpec before its ServerHello, when - // c.vers is still unset. That's not useful though and suspicious if the - // server then selects a lower protocol version, so don't allow that. - if c.vers == VersionTLS13 { - return c.retryReadRecord(expectChangeCipherSpec) - } - if !expectChangeCipherSpec { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - if err := c.in.changeCipherSpec(); err != nil { - return c.in.setErrorLocked(c.sendAlert(err.(alert))) - } - - case recordTypeApplicationData: - if !handshakeComplete || expectChangeCipherSpec { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - // Some OpenSSL servers send empty records in order to randomize the - // CBC IV. Ignore a limited number of empty records. - if len(data) == 0 { - return c.retryReadRecord(expectChangeCipherSpec) - } - // Note that data is owned by c.rawInput, following the Next call above, - // to avoid copying the plaintext. This is safe because c.rawInput is - // not read from or written to until c.input is drained. - c.input.Reset(data) - - case recordTypeHandshake: - if len(data) == 0 || expectChangeCipherSpec { - return c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - c.hand.Write(data) - } - - return nil -} - -// retryReadRecord recurses into readRecordOrCCS to drop a non-advancing record, like -// a warning alert, empty application_data, or a change_cipher_spec in TLS 1.3. -func (c *Conn) retryReadRecord(expectChangeCipherSpec bool) error { - c.retryCount++ - if c.retryCount > maxUselessRecords { - c.sendAlert(alertUnexpectedMessage) - return c.in.setErrorLocked(errors.New("tls: too many ignored records")) - } - return c.readRecordOrCCS(expectChangeCipherSpec) -} - -// atLeastReader reads from R, stopping with EOF once at least N bytes have been -// read. It is different from an io.LimitedReader in that it doesn't cut short -// the last Read call, and in that it considers an early EOF an error. -type atLeastReader struct { - R io.Reader - N int64 -} - -func (r *atLeastReader) Read(p []byte) (int, error) { - if r.N <= 0 { - return 0, io.EOF - } - n, err := r.R.Read(p) - r.N -= int64(n) // won't underflow unless len(p) >= n > 9223372036854775809 - if r.N > 0 && err == io.EOF { - return n, io.ErrUnexpectedEOF - } - if r.N <= 0 && err == nil { - return n, io.EOF - } - return n, err -} - -// readFromUntil reads from r into c.rawInput until c.rawInput contains -// at least n bytes or else returns an error. -func (c *Conn) readFromUntil(r io.Reader, n int) error { - if c.rawInput.Len() >= n { - return nil - } - needs := n - c.rawInput.Len() - // There might be extra input waiting on the wire. Make a best effort - // attempt to fetch it so that it can be used in (*Conn).Read to - // "predict" closeNotify alerts. - c.rawInput.Grow(needs + bytes.MinRead) - _, err := c.rawInput.ReadFrom(&atLeastReader{r, int64(needs)}) - return err -} - -// sendAlert sends a TLS alert message. -func (c *Conn) sendAlertLocked(err alert) error { - switch err { - case alertNoRenegotiation, alertCloseNotify: - c.tmp[0] = alertLevelWarning - default: - c.tmp[0] = alertLevelError - } - c.tmp[1] = byte(err) - - _, writeErr := c.writeRecordLocked(recordTypeAlert, c.tmp[0:2]) - if err == alertCloseNotify { - // closeNotify is a special case in that it isn't an error. - return writeErr - } - - return c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err}) -} - -// sendAlert sends a TLS alert message. -func (c *Conn) sendAlert(err alert) error { - if c.config.AlternativeRecordLayer != nil { - c.config.AlternativeRecordLayer.SendAlert(uint8(err)) - return &net.OpError{Op: "local error", Err: err} - } - - c.out.Lock() - defer c.out.Unlock() - return c.sendAlertLocked(err) -} - -const ( - // tcpMSSEstimate is a conservative estimate of the TCP maximum segment - // size (MSS). A constant is used, rather than querying the kernel for - // the actual MSS, to avoid complexity. The value here is the IPv6 - // minimum MTU (1280 bytes) minus the overhead of an IPv6 header (40 - // bytes) and a TCP header with timestamps (32 bytes). - tcpMSSEstimate = 1208 - - // recordSizeBoostThreshold is the number of bytes of application data - // sent after which the TLS record size will be increased to the - // maximum. - recordSizeBoostThreshold = 128 * 1024 -) - -// maxPayloadSizeForWrite returns the maximum TLS payload size to use for the -// next application data record. There is the following trade-off: -// -// - For latency-sensitive applications, such as web browsing, each TLS -// record should fit in one TCP segment. -// - For throughput-sensitive applications, such as large file transfers, -// larger TLS records better amortize framing and encryption overheads. -// -// A simple heuristic that works well in practice is to use small records for -// the first 1MB of data, then use larger records for subsequent data, and -// reset back to smaller records after the connection becomes idle. See "High -// Performance Web Networking", Chapter 4, or: -// https://www.igvita.com/2013/10/24/optimizing-tls-record-size-and-buffering-latency/ -// -// In the interests of simplicity and determinism, this code does not attempt -// to reset the record size once the connection is idle, however. -func (c *Conn) maxPayloadSizeForWrite(typ recordType) int { - if c.config.DynamicRecordSizingDisabled || typ != recordTypeApplicationData { - return maxPlaintext - } - - if c.bytesSent >= recordSizeBoostThreshold { - return maxPlaintext - } - - // Subtract TLS overheads to get the maximum payload size. - payloadBytes := tcpMSSEstimate - recordHeaderLen - c.out.explicitNonceLen() - if c.out.cipher != nil { - switch ciph := c.out.cipher.(type) { - case cipher.Stream: - payloadBytes -= c.out.mac.Size() - case cipher.AEAD: - payloadBytes -= ciph.Overhead() - case cbcMode: - blockSize := ciph.BlockSize() - // The payload must fit in a multiple of blockSize, with - // room for at least one padding byte. - payloadBytes = (payloadBytes & ^(blockSize - 1)) - 1 - // The MAC is appended before padding so affects the - // payload size directly. - payloadBytes -= c.out.mac.Size() - default: - panic("unknown cipher type") - } - } - if c.vers == VersionTLS13 { - payloadBytes-- // encrypted ContentType - } - - // Allow packet growth in arithmetic progression up to max. - pkt := c.packetsSent - c.packetsSent++ - if pkt > 1000 { - return maxPlaintext // avoid overflow in multiply below - } - - n := payloadBytes * int(pkt+1) - if n > maxPlaintext { - n = maxPlaintext - } - return n -} - -func (c *Conn) write(data []byte) (int, error) { - if c.buffering { - c.sendBuf = append(c.sendBuf, data...) - return len(data), nil - } - - n, err := c.conn.Write(data) - c.bytesSent += int64(n) - return n, err -} - -func (c *Conn) flush() (int, error) { - if len(c.sendBuf) == 0 { - return 0, nil - } - - n, err := c.conn.Write(c.sendBuf) - c.bytesSent += int64(n) - c.sendBuf = nil - c.buffering = false - return n, err -} - -// writeRecordLocked writes a TLS record with the given type and payload to the -// connection and updates the record layer state. -func (c *Conn) writeRecordLocked(typ recordType, data []byte) (int, error) { - var n int - for len(data) > 0 { - m := len(data) - if maxPayload := c.maxPayloadSizeForWrite(typ); m > maxPayload { - m = maxPayload - } - - _, c.outBuf = sliceForAppend(c.outBuf[:0], recordHeaderLen) - c.outBuf[0] = byte(typ) - vers := c.vers - if vers == 0 { - // Some TLS servers fail if the record version is - // greater than TLS 1.0 for the initial ClientHello. - vers = VersionTLS10 - } else if vers == VersionTLS13 { - // TLS 1.3 froze the record layer version to 1.2. - // See RFC 8446, Section 5.1. - vers = VersionTLS12 - } - c.outBuf[1] = byte(vers >> 8) - c.outBuf[2] = byte(vers) - c.outBuf[3] = byte(m >> 8) - c.outBuf[4] = byte(m) - - var err error - c.outBuf, err = c.out.encrypt(c.outBuf, data[:m], c.config.rand()) - if err != nil { - return n, err - } - if _, err := c.write(c.outBuf); err != nil { - return n, err - } - n += m - data = data[m:] - } - - if typ == recordTypeChangeCipherSpec && c.vers != VersionTLS13 { - if err := c.out.changeCipherSpec(); err != nil { - return n, c.sendAlertLocked(err.(alert)) - } - } - - return n, nil -} - -// writeRecord writes a TLS record with the given type and payload to the -// connection and updates the record layer state. -func (c *Conn) writeRecord(typ recordType, data []byte) (int, error) { - if c.config.AlternativeRecordLayer != nil { - if typ == recordTypeChangeCipherSpec { - return len(data), nil - } - return c.config.AlternativeRecordLayer.WriteRecord(data) - } - - c.out.Lock() - defer c.out.Unlock() - - return c.writeRecordLocked(typ, data) -} - -// readHandshake reads the next handshake message from -// the record layer. -func (c *Conn) readHandshake() (interface{}, error) { - var data []byte - if c.config.AlternativeRecordLayer != nil { - var err error - data, err = c.config.AlternativeRecordLayer.ReadHandshakeMessage() - if err != nil { - return nil, err - } - } else { - for c.hand.Len() < 4 { - if err := c.readRecord(); err != nil { - return nil, err - } - } - - data = c.hand.Bytes() - n := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - if n > maxHandshake { - c.sendAlertLocked(alertInternalError) - return nil, c.in.setErrorLocked(fmt.Errorf("tls: handshake message of length %d bytes exceeds maximum of %d bytes", n, maxHandshake)) - } - for c.hand.Len() < 4+n { - if err := c.readRecord(); err != nil { - return nil, err - } - } - data = c.hand.Next(4 + n) - } - var m handshakeMessage - switch data[0] { - case typeHelloRequest: - m = new(helloRequestMsg) - case typeClientHello: - m = new(clientHelloMsg) - case typeServerHello: - m = new(serverHelloMsg) - case typeNewSessionTicket: - if c.vers == VersionTLS13 { - m = new(newSessionTicketMsgTLS13) - } else { - m = new(newSessionTicketMsg) - } - case typeCertificate: - if c.vers == VersionTLS13 { - m = new(certificateMsgTLS13) - } else { - m = new(certificateMsg) - } - case typeCertificateRequest: - if c.vers == VersionTLS13 { - m = new(certificateRequestMsgTLS13) - } else { - m = &certificateRequestMsg{ - hasSignatureAlgorithm: c.vers >= VersionTLS12, - } - } - case typeCertificateStatus: - m = new(certificateStatusMsg) - case typeServerKeyExchange: - m = new(serverKeyExchangeMsg) - case typeServerHelloDone: - m = new(serverHelloDoneMsg) - case typeClientKeyExchange: - m = new(clientKeyExchangeMsg) - case typeCertificateVerify: - m = &certificateVerifyMsg{ - hasSignatureAlgorithm: c.vers >= VersionTLS12, - } - case typeNextProtocol: - m = new(nextProtoMsg) - case typeFinished: - m = new(finishedMsg) - case typeEncryptedExtensions: - m = new(encryptedExtensionsMsg) - case typeEndOfEarlyData: - m = new(endOfEarlyDataMsg) - case typeKeyUpdate: - m = new(keyUpdateMsg) - default: - return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - // The handshake message unmarshalers - // expect to be able to keep references to data, - // so pass in a fresh copy that won't be overwritten. - data = append([]byte(nil), data...) - - if !m.unmarshal(data) { - return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - return m, nil -} - -var ( - errClosed = errors.New("tls: use of closed connection") - errShutdown = errors.New("tls: protocol is shutdown") -) - -// Write writes data to the connection. -func (c *Conn) Write(b []byte) (int, error) { - // interlock with Close below - for { - x := atomic.LoadInt32(&c.activeCall) - if x&1 != 0 { - return 0, errClosed - } - if atomic.CompareAndSwapInt32(&c.activeCall, x, x+2) { - defer atomic.AddInt32(&c.activeCall, -2) - break - } - } - - if err := c.Handshake(); err != nil { - return 0, err - } - - c.out.Lock() - defer c.out.Unlock() - - if err := c.out.err; err != nil { - return 0, err - } - - if !c.handshakeComplete() { - return 0, alertInternalError - } - - if c.closeNotifySent { - return 0, errShutdown - } - - // SSL 3.0 and TLS 1.0 are susceptible to a chosen-plaintext - // attack when using block mode ciphers due to predictable IVs. - // This can be prevented by splitting each Application Data - // record into two records, effectively randomizing the IV. - // - // https://www.openssl.org/~bodo/tls-cbc.txt - // https://bugzilla.mozilla.org/show_bug.cgi?id=665814 - // https://www.imperialviolet.org/2012/01/15/beastfollowup.html - - var m int - if len(b) > 1 && c.vers <= VersionTLS10 { - if _, ok := c.out.cipher.(cipher.BlockMode); ok { - n, err := c.writeRecordLocked(recordTypeApplicationData, b[:1]) - if err != nil { - return n, c.out.setErrorLocked(err) - } - m, b = 1, b[1:] - } - } - - n, err := c.writeRecordLocked(recordTypeApplicationData, b) - return n + m, c.out.setErrorLocked(err) -} - -// handleRenegotiation processes a HelloRequest handshake message. -func (c *Conn) handleRenegotiation() error { - if c.vers == VersionTLS13 { - return errors.New("tls: internal error: unexpected renegotiation") - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - helloReq, ok := msg.(*helloRequestMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(helloReq, msg) - } - - if !c.isClient { - return c.sendAlert(alertNoRenegotiation) - } - - switch c.config.Renegotiation { - case RenegotiateNever: - return c.sendAlert(alertNoRenegotiation) - case RenegotiateOnceAsClient: - if c.handshakes > 1 { - return c.sendAlert(alertNoRenegotiation) - } - case RenegotiateFreelyAsClient: - // Ok. - default: - c.sendAlert(alertInternalError) - return errors.New("tls: unknown Renegotiation value") - } - - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - atomic.StoreUint32(&c.handshakeStatus, 0) - if c.handshakeErr = c.clientHandshake(); c.handshakeErr == nil { - c.handshakes++ - } - return c.handshakeErr -} - -func (c *Conn) HandlePostHandshakeMessage() error { - return c.handlePostHandshakeMessage() -} - -// handlePostHandshakeMessage processes a handshake message arrived after the -// handshake is complete. Up to TLS 1.2, it indicates the start of a renegotiation. -func (c *Conn) handlePostHandshakeMessage() error { - if c.vers != VersionTLS13 { - return c.handleRenegotiation() - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - c.retryCount++ - if c.retryCount > maxUselessRecords { - c.sendAlert(alertUnexpectedMessage) - return c.in.setErrorLocked(errors.New("tls: too many non-advancing records")) - } - - switch msg := msg.(type) { - case *newSessionTicketMsgTLS13: - return c.handleNewSessionTicket(msg) - case *keyUpdateMsg: - return c.handleKeyUpdate(msg) - default: - c.sendAlert(alertUnexpectedMessage) - return fmt.Errorf("tls: received unexpected handshake message of type %T", msg) - } -} - -func (c *Conn) handleKeyUpdate(keyUpdate *keyUpdateMsg) error { - cipherSuite := cipherSuiteTLS13ByID(c.cipherSuite) - if cipherSuite == nil { - return c.in.setErrorLocked(c.sendAlert(alertInternalError)) - } - - newSecret := cipherSuite.nextTrafficSecret(c.in.trafficSecret) - c.in.setTrafficSecret(cipherSuite, newSecret) - - if keyUpdate.updateRequested { - c.out.Lock() - defer c.out.Unlock() - - msg := &keyUpdateMsg{} - _, err := c.writeRecordLocked(recordTypeHandshake, msg.marshal()) - if err != nil { - // Surface the error at the next write. - c.out.setErrorLocked(err) - return nil - } - - newSecret := cipherSuite.nextTrafficSecret(c.out.trafficSecret) - c.out.setTrafficSecret(cipherSuite, newSecret) - } - - return nil -} - -// Read can be made to time out and return a net.Error with Timeout() == true -// after a fixed time limit; see SetDeadline and SetReadDeadline. -func (c *Conn) Read(b []byte) (int, error) { - if err := c.Handshake(); err != nil { - return 0, err - } - if len(b) == 0 { - // Put this after Handshake, in case people were calling - // Read(nil) for the side effect of the Handshake. - return 0, nil - } - - c.in.Lock() - defer c.in.Unlock() - - for c.input.Len() == 0 { - if err := c.readRecord(); err != nil { - return 0, err - } - for c.hand.Len() > 0 { - if err := c.handlePostHandshakeMessage(); err != nil { - return 0, err - } - } - } - - n, _ := c.input.Read(b) - - // If a close-notify alert is waiting, read it so that we can return (n, - // EOF) instead of (n, nil), to signal to the HTTP response reading - // goroutine that the connection is now closed. This eliminates a race - // where the HTTP response reading goroutine would otherwise not observe - // the EOF until its next read, by which time a client goroutine might - // have already tried to reuse the HTTP connection for a new request. - // See https://golang.org/cl/76400046 and https://golang.org/issue/3514 - if n != 0 && c.input.Len() == 0 && c.rawInput.Len() > 0 && - recordType(c.rawInput.Bytes()[0]) == recordTypeAlert { - if err := c.readRecord(); err != nil { - return n, err // will be io.EOF on closeNotify - } - } - - return n, nil -} - -// Close closes the connection. -func (c *Conn) Close() error { - // Interlock with Conn.Write above. - var x int32 - for { - x = atomic.LoadInt32(&c.activeCall) - if x&1 != 0 { - return errClosed - } - if atomic.CompareAndSwapInt32(&c.activeCall, x, x|1) { - break - } - } - if x != 0 { - // io.Writer and io.Closer should not be used concurrently. - // If Close is called while a Write is currently in-flight, - // interpret that as a sign that this Close is really just - // being used to break the Write and/or clean up resources and - // avoid sending the alertCloseNotify, which may block - // waiting on handshakeMutex or the c.out mutex. - return c.conn.Close() - } - - var alertErr error - - if c.handshakeComplete() { - alertErr = c.closeNotify() - } - - if err := c.conn.Close(); err != nil { - return err - } - return alertErr -} - -var errEarlyCloseWrite = errors.New("tls: CloseWrite called before handshake complete") - -// CloseWrite shuts down the writing side of the connection. It should only be -// called once the handshake has completed and does not call CloseWrite on the -// underlying connection. Most callers should just use Close. -func (c *Conn) CloseWrite() error { - if !c.handshakeComplete() { - return errEarlyCloseWrite - } - - return c.closeNotify() -} - -func (c *Conn) closeNotify() error { - c.out.Lock() - defer c.out.Unlock() - - if !c.closeNotifySent { - c.closeNotifyErr = c.sendAlertLocked(alertCloseNotify) - c.closeNotifySent = true - } - return c.closeNotifyErr -} - -// Handshake runs the client or server handshake -// protocol if it has not yet been run. -// Most uses of this package need not call Handshake -// explicitly: the first Read or Write will call it automatically. -func (c *Conn) Handshake() error { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - if err := c.handshakeErr; err != nil { - return err - } - if c.handshakeComplete() { - return nil - } - - c.in.Lock() - defer c.in.Unlock() - - if c.isClient { - c.handshakeErr = c.clientHandshake() - } else { - c.handshakeErr = c.serverHandshake() - } - if c.handshakeErr == nil { - c.handshakes++ - } else { - // If an error occurred during the hadshake try to flush the - // alert that might be left in the buffer. - c.flush() - } - - if c.handshakeErr == nil && !c.handshakeComplete() { - c.handshakeErr = errors.New("tls: internal error: handshake should have had a result") - } - - return c.handshakeErr -} - -// ConnectionState returns basic TLS details about the connection. -func (c *Conn) ConnectionState() ConnectionState { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - var state ConnectionState - state.HandshakeComplete = c.handshakeComplete() - state.ServerName = c.serverName - - if state.HandshakeComplete { - state.Version = c.vers - state.NegotiatedProtocol = c.clientProtocol - state.DidResume = c.didResume - state.NegotiatedProtocolIsMutual = !c.clientProtocolFallback - state.CipherSuite = c.cipherSuite - state.PeerCertificates = c.peerCertificates - state.VerifiedChains = c.verifiedChains - state.SignedCertificateTimestamps = c.scts - state.OCSPResponse = c.ocspResponse - if !c.didResume && c.vers != VersionTLS13 { - if c.clientFinishedIsFirst { - state.TLSUnique = c.clientFinished[:] - } else { - state.TLSUnique = c.serverFinished[:] - } - } - if c.config.Renegotiation != RenegotiateNever { - state.ekm = noExportedKeyingMaterial - } else { - state.ekm = c.ekm - } - } - - return state -} - -// OCSPResponse returns the stapled OCSP response from the TLS server, if -// any. (Only valid for client connections.) -func (c *Conn) OCSPResponse() []byte { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - return c.ocspResponse -} - -// VerifyHostname checks that the peer certificate chain is valid for -// connecting to host. If so, it returns nil; if not, it returns an error -// describing the problem. -func (c *Conn) VerifyHostname(host string) error { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - if !c.isClient { - return errors.New("tls: VerifyHostname called on TLS server connection") - } - if !c.handshakeComplete() { - return errors.New("tls: handshake has not yet been performed") - } - if len(c.verifiedChains) == 0 { - return errors.New("tls: handshake did not verify certificate chain") - } - return c.peerCertificates[0].VerifyHostname(host) -} - -func (c *Conn) handshakeComplete() bool { - return atomic.LoadUint32(&c.handshakeStatus) == 1 -} diff --git a/vendor/github.com/marten-seemann/qtls/generate_cert.go b/vendor/github.com/marten-seemann/qtls/generate_cert.go deleted file mode 100644 index 8d012be7..00000000 --- a/vendor/github.com/marten-seemann/qtls/generate_cert.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// Generate a self-signed X.509 certificate for a TLS server. Outputs to -// 'cert.pem' and 'key.pem' and will overwrite existing files. - -package main - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "flag" - "fmt" - "log" - "math/big" - "net" - "os" - "strings" - "time" -) - -var ( - host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for") - validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011") - validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for") - isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") - rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") - ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521") -) - -func publicKey(priv interface{}) interface{} { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &k.PublicKey - case *ecdsa.PrivateKey: - return &k.PublicKey - default: - return nil - } -} - -func pemBlockForKey(priv interface{}) *pem.Block { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)} - case *ecdsa.PrivateKey: - b, err := x509.MarshalECPrivateKey(k) - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to marshal ECDSA private key: %v", err) - os.Exit(2) - } - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} - default: - return nil - } -} - -func main() { - flag.Parse() - - if len(*host) == 0 { - log.Fatalf("Missing required --host parameter") - } - - var priv interface{} - var err error - switch *ecdsaCurve { - case "": - priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) - case "P224": - priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - case "P256": - priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - case "P384": - priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) - case "P521": - priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - default: - fmt.Fprintf(os.Stderr, "Unrecognized elliptic curve: %q", *ecdsaCurve) - os.Exit(1) - } - if err != nil { - log.Fatalf("failed to generate private key: %s", err) - } - - var notBefore time.Time - if len(*validFrom) == 0 { - notBefore = time.Now() - } else { - notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) - if err != nil { - fmt.Fprintf(os.Stderr, "Failed to parse creation date: %s\n", err) - os.Exit(1) - } - } - - notAfter := notBefore.Add(*validFor) - - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - log.Fatalf("failed to generate serial number: %s", err) - } - - template := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - Organization: []string{"Acme Co"}, - }, - NotBefore: notBefore, - NotAfter: notAfter, - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - hosts := strings.Split(*host, ",") - for _, h := range hosts { - if ip := net.ParseIP(h); ip != nil { - template.IPAddresses = append(template.IPAddresses, ip) - } else { - template.DNSNames = append(template.DNSNames, h) - } - } - - if *isCA { - template.IsCA = true - template.KeyUsage |= x509.KeyUsageCertSign - } - - derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) - if err != nil { - log.Fatalf("Failed to create certificate: %s", err) - } - - certOut, err := os.Create("cert.pem") - if err != nil { - log.Fatalf("failed to open cert.pem for writing: %s", err) - } - if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { - log.Fatalf("failed to write data to cert.pem: %s", err) - } - if err := certOut.Close(); err != nil { - log.Fatalf("error closing cert.pem: %s", err) - } - log.Print("wrote cert.pem\n") - - keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - log.Print("failed to open key.pem for writing:", err) - return - } - if err := pem.Encode(keyOut, pemBlockForKey(priv)); err != nil { - log.Fatalf("failed to write data to key.pem: %s", err) - } - if err := keyOut.Close(); err != nil { - log.Fatalf("error closing key.pem: %s", err) - } - log.Print("wrote key.pem\n") -} diff --git a/vendor/github.com/marten-seemann/qtls/go.mod b/vendor/github.com/marten-seemann/qtls/go.mod deleted file mode 100644 index 9cd2ced5..00000000 --- a/vendor/github.com/marten-seemann/qtls/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/marten-seemann/qtls - -go 1.12 - -require ( - golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 - golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e -) diff --git a/vendor/github.com/marten-seemann/qtls/go.sum b/vendor/github.com/marten-seemann/qtls/go.sum deleted file mode 100644 index a47aabd2..00000000 --- a/vendor/github.com/marten-seemann/qtls/go.sum +++ /dev/null @@ -1,5 +0,0 @@ -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/marten-seemann/qtls/handshake_client.go b/vendor/github.com/marten-seemann/qtls/handshake_client.go deleted file mode 100644 index 1d2903d5..00000000 --- a/vendor/github.com/marten-seemann/qtls/handshake_client.go +++ /dev/null @@ -1,1023 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "bytes" - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - "net" - "strconv" - "strings" - "sync/atomic" - "time" -) - -type clientHandshakeState struct { - c *Conn - serverHello *serverHelloMsg - hello *clientHelloMsg - suite *cipherSuite - finishedHash finishedHash - masterSecret []byte - session *ClientSessionState -} - -func (c *Conn) makeClientHello() (*clientHelloMsg, ecdheParameters, error) { - config := c.config - if len(config.ServerName) == 0 && !config.InsecureSkipVerify { - return nil, nil, errors.New("tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config") - } - - nextProtosLength := 0 - for _, proto := range config.NextProtos { - if l := len(proto); l == 0 || l > 255 { - return nil, nil, errors.New("tls: invalid NextProtos value") - } else { - nextProtosLength += 1 + l - } - } - if nextProtosLength > 0xffff { - return nil, nil, errors.New("tls: NextProtos values too large") - } - - supportedVersions := config.supportedVersions(true) - if len(supportedVersions) == 0 { - return nil, nil, errors.New("tls: no supported versions satisfy MinVersion and MaxVersion") - } - - clientHelloVersion := supportedVersions[0] - // The version at the beginning of the ClientHello was capped at TLS 1.2 - // for compatibility reasons. The supported_versions extension is used - // to negotiate versions now. See RFC 8446, Section 4.2.1. - if clientHelloVersion > VersionTLS12 { - clientHelloVersion = VersionTLS12 - } - - hello := &clientHelloMsg{ - vers: clientHelloVersion, - compressionMethods: []uint8{compressionNone}, - random: make([]byte, 32), - sessionId: make([]byte, 32), - ocspStapling: true, - scts: true, - serverName: hostnameInSNI(config.ServerName), - supportedCurves: config.curvePreferences(), - supportedPoints: []uint8{pointFormatUncompressed}, - nextProtoNeg: len(config.NextProtos) > 0, - secureRenegotiationSupported: true, - alpnProtocols: config.NextProtos, - supportedVersions: supportedVersions, - } - - if c.handshakes > 0 { - hello.secureRenegotiation = c.clientFinished[:] - } - - possibleCipherSuites := config.cipherSuites() - hello.cipherSuites = make([]uint16, 0, len(possibleCipherSuites)) - -NextCipherSuite: - for _, suiteId := range possibleCipherSuites { - for _, suite := range cipherSuites { - if suite.id != suiteId { - continue - } - // Don't advertise TLS 1.2-only cipher suites unless - // we're attempting TLS 1.2. - if hello.vers < VersionTLS12 && suite.flags&suiteTLS12 != 0 { - continue - } - hello.cipherSuites = append(hello.cipherSuites, suiteId) - continue NextCipherSuite - } - } - - _, err := io.ReadFull(config.rand(), hello.random) - if err != nil { - return nil, nil, errors.New("tls: short read from Rand: " + err.Error()) - } - - // A random session ID is used to detect when the server accepted a ticket - // and is resuming a session (see RFC 5077). In TLS 1.3, it's always set as - // a compatibility measure (see RFC 8446, Section 4.1.2). - if _, err := io.ReadFull(config.rand(), hello.sessionId); err != nil { - return nil, nil, errors.New("tls: short read from Rand: " + err.Error()) - } - - if hello.vers >= VersionTLS12 { - hello.supportedSignatureAlgorithms = supportedSignatureAlgorithms - } - - var params ecdheParameters - if hello.supportedVersions[0] == VersionTLS13 { - hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13()...) - - curveID := config.curvePreferences()[0] - if _, ok := curveForCurveID(curveID); curveID != X25519 && !ok { - return nil, nil, errors.New("tls: CurvePreferences includes unsupported curve") - } - params, err = generateECDHEParameters(config.rand(), curveID) - if err != nil { - return nil, nil, err - } - hello.keyShares = []keyShare{{group: curveID, data: params.PublicKey()}} - } - - if hello.supportedVersions[0] == VersionTLS13 && config.GetExtensions != nil { - hello.additionalExtensions = config.GetExtensions(typeClientHello) - } - - return hello, params, nil -} - -func (c *Conn) clientHandshake() (err error) { - if c.config == nil { - c.config = defaultConfig() - } - c.setAlternativeRecordLayer() - - // This may be a renegotiation handshake, in which case some fields - // need to be reset. - c.didResume = false - - hello, ecdheParams, err := c.makeClientHello() - if err != nil { - return err - } - - cacheKey, session, earlySecret, binderKey := c.loadSession(hello) - if cacheKey != "" && session != nil { - defer func() { - // If we got a handshake failure when resuming a session, throw away - // the session ticket. See RFC 5077, Section 3.2. - // - // RFC 8446 makes no mention of dropping tickets on failure, but it - // does require servers to abort on invalid binders, so we need to - // delete tickets to recover from a corrupted PSK. - if err != nil { - c.config.ClientSessionCache.Put(cacheKey, nil) - } - }() - } - - if _, err := c.writeRecord(recordTypeHandshake, hello.marshal()); err != nil { - return err - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - serverHello, ok := msg.(*serverHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(serverHello, msg) - } - - if err := c.pickTLSVersion(serverHello); err != nil { - return err - } - - if c.vers == VersionTLS13 { - hs := &clientHandshakeStateTLS13{ - c: c, - serverHello: serverHello, - hello: hello, - ecdheParams: ecdheParams, - session: session, - earlySecret: earlySecret, - binderKey: binderKey, - } - - // In TLS 1.3, session tickets are delivered after the handshake. - return hs.handshake() - } - - hs := &clientHandshakeState{ - c: c, - serverHello: serverHello, - hello: hello, - session: session, - } - - if err := hs.handshake(); err != nil { - return err - } - - // If we had a successful handshake and hs.session is different from - // the one already cached - cache a new one. - if cacheKey != "" && hs.session != nil && session != hs.session { - c.config.ClientSessionCache.Put(cacheKey, hs.session) - } - - return nil -} - -func (c *Conn) loadSession(hello *clientHelloMsg) (cacheKey string, - session *ClientSessionState, earlySecret, binderKey []byte) { - if c.config.SessionTicketsDisabled || c.config.ClientSessionCache == nil { - return "", nil, nil, nil - } - - hello.ticketSupported = true - - if hello.supportedVersions[0] == VersionTLS13 { - // Require DHE on resumption as it guarantees forward secrecy against - // compromise of the session ticket key. See RFC 8446, Section 4.2.9. - hello.pskModes = []uint8{pskModeDHE} - } - - // Session resumption is not allowed if renegotiating because - // renegotiation is primarily used to allow a client to send a client - // certificate, which would be skipped if session resumption occurred. - if c.handshakes != 0 { - return "", nil, nil, nil - } - - // Try to resume a previously negotiated TLS session, if available. - cacheKey = clientSessionCacheKey(c.conn.RemoteAddr(), c.config) - session, ok := c.config.ClientSessionCache.Get(cacheKey) - if !ok || session == nil { - return cacheKey, nil, nil, nil - } - - // Check that version used for the previous session is still valid. - versOk := false - for _, v := range hello.supportedVersions { - if v == session.vers { - versOk = true - break - } - } - if !versOk { - return cacheKey, nil, nil, nil - } - - // Check that the cached server certificate is not expired, and that it's - // valid for the ServerName. This should be ensured by the cache key, but - // protect the application from a faulty ClientSessionCache implementation. - if !c.config.InsecureSkipVerify { - if len(session.verifiedChains) == 0 { - // The original connection had InsecureSkipVerify, while this doesn't. - return cacheKey, nil, nil, nil - } - serverCert := session.serverCertificates[0] - if c.config.time().After(serverCert.NotAfter) { - // Expired certificate, delete the entry. - c.config.ClientSessionCache.Put(cacheKey, nil) - return cacheKey, nil, nil, nil - } - if err := serverCert.VerifyHostname(c.config.ServerName); err != nil { - return cacheKey, nil, nil, nil - } - } - - if session.vers != VersionTLS13 { - // In TLS 1.2 the cipher suite must match the resumed session. Ensure we - // are still offering it. - if mutualCipherSuite(hello.cipherSuites, session.cipherSuite) == nil { - return cacheKey, nil, nil, nil - } - - hello.sessionTicket = session.sessionTicket - return - } - - // Check that the session ticket is not expired. - if c.config.time().After(session.useBy) { - c.config.ClientSessionCache.Put(cacheKey, nil) - return cacheKey, nil, nil, nil - } - - // In TLS 1.3 the KDF hash must match the resumed session. Ensure we - // offer at least one cipher suite with that hash. - cipherSuite := cipherSuiteTLS13ByID(session.cipherSuite) - if cipherSuite == nil { - return cacheKey, nil, nil, nil - } - cipherSuiteOk := false - for _, offeredID := range hello.cipherSuites { - offeredSuite := cipherSuiteTLS13ByID(offeredID) - if offeredSuite != nil && offeredSuite.hash == cipherSuite.hash { - cipherSuiteOk = true - break - } - } - if !cipherSuiteOk { - return cacheKey, nil, nil, nil - } - - // Set the pre_shared_key extension. See RFC 8446, Section 4.2.11.1. - ticketAge := uint32(c.config.time().Sub(session.receivedAt) / time.Millisecond) - identity := pskIdentity{ - label: session.sessionTicket, - obfuscatedTicketAge: ticketAge + session.ageAdd, - } - hello.pskIdentities = []pskIdentity{identity} - hello.pskBinders = [][]byte{make([]byte, cipherSuite.hash.Size())} - - // Compute the PSK binders. See RFC 8446, Section 4.2.11.2. - psk := cipherSuite.expandLabel(session.masterSecret, "resumption", - session.nonce, cipherSuite.hash.Size()) - earlySecret = cipherSuite.extract(psk, nil) - binderKey = cipherSuite.deriveSecret(earlySecret, resumptionBinderLabel, nil) - transcript := cipherSuite.hash.New() - transcript.Write(hello.marshalWithoutBinders()) - pskBinders := [][]byte{cipherSuite.finishedHash(binderKey, transcript)} - hello.updateBinders(pskBinders) - - return -} - -func (c *Conn) pickTLSVersion(serverHello *serverHelloMsg) error { - peerVersion := serverHello.vers - if serverHello.supportedVersion != 0 { - peerVersion = serverHello.supportedVersion - } - - vers, ok := c.config.mutualVersion(true, []uint16{peerVersion}) - if !ok { - c.sendAlert(alertProtocolVersion) - return fmt.Errorf("tls: server selected unsupported protocol version %x", peerVersion) - } - - c.vers = vers - c.haveVers = true - c.in.version = vers - c.out.version = vers - - return nil -} - -// Does the handshake, either a full one or resumes old session. Requires hs.c, -// hs.hello, hs.serverHello, and, optionally, hs.session to be set. -func (hs *clientHandshakeState) handshake() error { - c := hs.c - - isResume, err := hs.processServerHello() - if err != nil { - return err - } - - hs.finishedHash = newFinishedHash(c.vers, hs.suite) - - // No signatures of the handshake are needed in a resumption. - // Otherwise, in a full handshake, if we don't have any certificates - // configured then we will never send a CertificateVerify message and - // thus no signatures are needed in that case either. - if isResume || (len(c.config.Certificates) == 0 && c.config.GetClientCertificate == nil) { - hs.finishedHash.discardHandshakeBuffer() - } - - hs.finishedHash.Write(hs.hello.marshal()) - hs.finishedHash.Write(hs.serverHello.marshal()) - - c.buffering = true - if isResume { - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.readSessionTicket(); err != nil { - return err - } - if err := hs.readFinished(c.serverFinished[:]); err != nil { - return err - } - c.clientFinishedIsFirst = false - if err := hs.sendFinished(c.clientFinished[:]); err != nil { - return err - } - if _, err := c.flush(); err != nil { - return err - } - } else { - if err := hs.doFullHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.sendFinished(c.clientFinished[:]); err != nil { - return err - } - if _, err := c.flush(); err != nil { - return err - } - c.clientFinishedIsFirst = true - if err := hs.readSessionTicket(); err != nil { - return err - } - if err := hs.readFinished(c.serverFinished[:]); err != nil { - return err - } - } - - c.ekm = ekmFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random) - c.didResume = isResume - atomic.StoreUint32(&c.handshakeStatus, 1) - - return nil -} - -func (hs *clientHandshakeState) pickCipherSuite() error { - if hs.suite = mutualCipherSuite(hs.hello.cipherSuites, hs.serverHello.cipherSuite); hs.suite == nil { - hs.c.sendAlert(alertHandshakeFailure) - return errors.New("tls: server chose an unconfigured cipher suite") - } - - hs.c.cipherSuite = hs.suite.id - return nil -} - -func (hs *clientHandshakeState) doFullHandshake() error { - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return err - } - certMsg, ok := msg.(*certificateMsg) - if !ok || len(certMsg.certificates) == 0 { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - hs.finishedHash.Write(certMsg.marshal()) - - if c.handshakes == 0 { - // If this is the first handshake on a connection, process and - // (optionally) verify the server's certificates. - if err := c.verifyServerCertificate(certMsg.certificates); err != nil { - return err - } - } else { - // This is a renegotiation handshake. We require that the - // server's identity (i.e. leaf certificate) is unchanged and - // thus any previous trust decision is still valid. - // - // See https://mitls.org/pages/attacks/3SHAKE for the - // motivation behind this requirement. - if !bytes.Equal(c.peerCertificates[0].Raw, certMsg.certificates[0]) { - c.sendAlert(alertBadCertificate) - return errors.New("tls: server's identity changed during renegotiation") - } - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - - cs, ok := msg.(*certificateStatusMsg) - if ok { - // RFC4366 on Certificate Status Request: - // The server MAY return a "certificate_status" message. - - if !hs.serverHello.ocspStapling { - // If a server returns a "CertificateStatus" message, then the - // server MUST have included an extension of type "status_request" - // with empty "extension_data" in the extended server hello. - - c.sendAlert(alertUnexpectedMessage) - return errors.New("tls: received unexpected CertificateStatus message") - } - hs.finishedHash.Write(cs.marshal()) - - c.ocspResponse = cs.response - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - keyAgreement := hs.suite.ka(c.vers) - - skx, ok := msg.(*serverKeyExchangeMsg) - if ok { - hs.finishedHash.Write(skx.marshal()) - err = keyAgreement.processServerKeyExchange(c.config, hs.hello, hs.serverHello, c.peerCertificates[0], skx) - if err != nil { - c.sendAlert(alertUnexpectedMessage) - return err - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - var chainToSend *Certificate - var certRequested bool - certReq, ok := msg.(*certificateRequestMsg) - if ok { - certRequested = true - hs.finishedHash.Write(certReq.marshal()) - - cri := certificateRequestInfoFromMsg(certReq) - if chainToSend, err = c.getClientCertificate(cri); err != nil { - c.sendAlert(alertInternalError) - return err - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - shd, ok := msg.(*serverHelloDoneMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(shd, msg) - } - hs.finishedHash.Write(shd.marshal()) - - // If the server requested a certificate then we have to send a - // Certificate message, even if it's empty because we don't have a - // certificate to send. - if certRequested { - certMsg = new(certificateMsg) - certMsg.certificates = chainToSend.Certificate - hs.finishedHash.Write(certMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certMsg.marshal()); err != nil { - return err - } - } - - preMasterSecret, ckx, err := keyAgreement.generateClientKeyExchange(c.config, hs.hello, c.peerCertificates[0]) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - if ckx != nil { - hs.finishedHash.Write(ckx.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, ckx.marshal()); err != nil { - return err - } - } - - if chainToSend != nil && len(chainToSend.Certificate) > 0 { - certVerify := &certificateVerifyMsg{ - hasSignatureAlgorithm: c.vers >= VersionTLS12, - } - - key, ok := chainToSend.PrivateKey.(crypto.Signer) - if !ok { - c.sendAlert(alertInternalError) - return fmt.Errorf("tls: client certificate private key of type %T does not implement crypto.Signer", chainToSend.PrivateKey) - } - - signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, hs.hello.supportedSignatureAlgorithms, c.vers) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - // SignatureAndHashAlgorithm was introduced in TLS 1.2. - if certVerify.hasSignatureAlgorithm { - certVerify.signatureAlgorithm = signatureAlgorithm - } - digest, err := hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - signOpts := crypto.SignerOpts(hashFunc) - if sigType == signatureRSAPSS { - signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: hashFunc} - } - certVerify.signature, err = key.Sign(c.config.rand(), digest, signOpts) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - hs.finishedHash.Write(certVerify.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certVerify.marshal()); err != nil { - return err - } - } - - hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.hello.random, hs.serverHello.random) - if err := c.config.writeKeyLog(keyLogLabelTLS12, hs.hello.random, hs.masterSecret); err != nil { - c.sendAlert(alertInternalError) - return errors.New("tls: failed to write to key log: " + err.Error()) - } - - hs.finishedHash.discardHandshakeBuffer() - - return nil -} - -func (hs *clientHandshakeState) establishKeys() error { - c := hs.c - - clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := - keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) - var clientCipher, serverCipher interface{} - var clientHash, serverHash macFunction - if hs.suite.cipher != nil { - clientCipher = hs.suite.cipher(clientKey, clientIV, false /* not for reading */) - clientHash = hs.suite.mac(c.vers, clientMAC) - serverCipher = hs.suite.cipher(serverKey, serverIV, true /* for reading */) - serverHash = hs.suite.mac(c.vers, serverMAC) - } else { - clientCipher = hs.suite.aead(clientKey, clientIV) - serverCipher = hs.suite.aead(serverKey, serverIV) - } - - c.in.prepareCipherSpec(c.vers, serverCipher, serverHash) - c.out.prepareCipherSpec(c.vers, clientCipher, clientHash) - return nil -} - -func (hs *clientHandshakeState) serverResumedSession() bool { - // If the server responded with the same sessionId then it means the - // sessionTicket is being used to resume a TLS session. - return hs.session != nil && hs.hello.sessionId != nil && - bytes.Equal(hs.serverHello.sessionId, hs.hello.sessionId) -} - -func (hs *clientHandshakeState) processServerHello() (bool, error) { - c := hs.c - - if err := hs.pickCipherSuite(); err != nil { - return false, err - } - - if hs.serverHello.compressionMethod != compressionNone { - c.sendAlert(alertUnexpectedMessage) - return false, errors.New("tls: server selected unsupported compression format") - } - - if c.handshakes == 0 && hs.serverHello.secureRenegotiationSupported { - c.secureRenegotiation = true - if len(hs.serverHello.secureRenegotiation) != 0 { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: initial handshake had non-empty renegotiation extension") - } - } - - if c.handshakes > 0 && c.secureRenegotiation { - var expectedSecureRenegotiation [24]byte - copy(expectedSecureRenegotiation[:], c.clientFinished[:]) - copy(expectedSecureRenegotiation[12:], c.serverFinished[:]) - if !bytes.Equal(hs.serverHello.secureRenegotiation, expectedSecureRenegotiation[:]) { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: incorrect renegotiation extension contents") - } - } - - clientDidNPN := hs.hello.nextProtoNeg - clientDidALPN := len(hs.hello.alpnProtocols) > 0 - serverHasNPN := hs.serverHello.nextProtoNeg - serverHasALPN := len(hs.serverHello.alpnProtocol) > 0 - - if !clientDidNPN && serverHasNPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: server advertised unrequested NPN extension") - } - - if !clientDidALPN && serverHasALPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: server advertised unrequested ALPN extension") - } - - if serverHasNPN && serverHasALPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: server advertised both NPN and ALPN extensions") - } - - if serverHasALPN { - c.clientProtocol = hs.serverHello.alpnProtocol - c.clientProtocolFallback = false - } - c.scts = hs.serverHello.scts - - if !hs.serverResumedSession() { - return false, nil - } - - if hs.session.vers != c.vers { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: server resumed a session with a different version") - } - - if hs.session.cipherSuite != hs.suite.id { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: server resumed a session with a different cipher suite") - } - - // Restore masterSecret and peerCerts from previous state - hs.masterSecret = hs.session.masterSecret - c.peerCertificates = hs.session.serverCertificates - c.verifiedChains = hs.session.verifiedChains - return true, nil -} - -func (hs *clientHandshakeState) readFinished(out []byte) error { - c := hs.c - - if err := c.readChangeCipherSpec(); err != nil { - return err - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - serverFinished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(serverFinished, msg) - } - - verify := hs.finishedHash.serverSum(hs.masterSecret) - if len(verify) != len(serverFinished.verifyData) || - subtle.ConstantTimeCompare(verify, serverFinished.verifyData) != 1 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: server's Finished message was incorrect") - } - hs.finishedHash.Write(serverFinished.marshal()) - copy(out, verify) - return nil -} - -func (hs *clientHandshakeState) readSessionTicket() error { - if !hs.serverHello.ticketSupported { - return nil - } - - c := hs.c - msg, err := c.readHandshake() - if err != nil { - return err - } - sessionTicketMsg, ok := msg.(*newSessionTicketMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(sessionTicketMsg, msg) - } - hs.finishedHash.Write(sessionTicketMsg.marshal()) - - hs.session = &ClientSessionState{ - sessionTicket: sessionTicketMsg.ticket, - vers: c.vers, - cipherSuite: hs.suite.id, - masterSecret: hs.masterSecret, - serverCertificates: c.peerCertificates, - verifiedChains: c.verifiedChains, - receivedAt: c.config.time(), - } - - return nil -} - -func (hs *clientHandshakeState) sendFinished(out []byte) error { - c := hs.c - - if _, err := c.writeRecord(recordTypeChangeCipherSpec, []byte{1}); err != nil { - return err - } - if hs.serverHello.nextProtoNeg { - nextProto := new(nextProtoMsg) - proto, fallback := mutualProtocol(c.config.NextProtos, hs.serverHello.nextProtos) - nextProto.proto = proto - c.clientProtocol = proto - c.clientProtocolFallback = fallback - - hs.finishedHash.Write(nextProto.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, nextProto.marshal()); err != nil { - return err - } - } - - finished := new(finishedMsg) - finished.verifyData = hs.finishedHash.clientSum(hs.masterSecret) - hs.finishedHash.Write(finished.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, finished.marshal()); err != nil { - return err - } - copy(out, finished.verifyData) - return nil -} - -// verifyServerCertificate parses and verifies the provided chain, setting -// c.verifiedChains and c.peerCertificates or sending the appropriate alert. -func (c *Conn) verifyServerCertificate(certificates [][]byte) error { - certs := make([]*x509.Certificate, len(certificates)) - for i, asn1Data := range certificates { - cert, err := x509.ParseCertificate(asn1Data) - if err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: failed to parse certificate from server: " + err.Error()) - } - certs[i] = cert - } - - if !c.config.InsecureSkipVerify { - opts := x509.VerifyOptions{ - Roots: c.config.RootCAs, - CurrentTime: c.config.time(), - DNSName: c.config.ServerName, - Intermediates: x509.NewCertPool(), - } - - for i, cert := range certs { - if i == 0 { - continue - } - opts.Intermediates.AddCert(cert) - } - var err error - c.verifiedChains, err = certs[0].Verify(opts) - if err != nil { - c.sendAlert(alertBadCertificate) - return err - } - } - - if c.config.VerifyPeerCertificate != nil { - if err := c.config.VerifyPeerCertificate(certificates, c.verifiedChains); err != nil { - c.sendAlert(alertBadCertificate) - return err - } - } - - switch certs[0].PublicKey.(type) { - case *rsa.PublicKey, *ecdsa.PublicKey: - break - default: - c.sendAlert(alertUnsupportedCertificate) - return fmt.Errorf("tls: server's certificate contains an unsupported type of public key: %T", certs[0].PublicKey) - } - - c.peerCertificates = certs - - return nil -} - -// tls11SignatureSchemes contains the signature schemes that we synthesise for -// a TLS <= 1.1 connection, based on the supported certificate types. -var ( - tls11SignatureSchemes = []SignatureScheme{ECDSAWithP256AndSHA256, ECDSAWithP384AndSHA384, ECDSAWithP521AndSHA512, PKCS1WithSHA256, PKCS1WithSHA384, PKCS1WithSHA512, PKCS1WithSHA1} - tls11SignatureSchemesECDSA = tls11SignatureSchemes[:3] - tls11SignatureSchemesRSA = tls11SignatureSchemes[3:] -) - -// certificateRequestInfoFromMsg generates a CertificateRequestInfo from a TLS -// <= 1.2 CertificateRequest, making an effort to fill in missing information. -func certificateRequestInfoFromMsg(certReq *certificateRequestMsg) *CertificateRequestInfo { - var rsaAvail, ecdsaAvail bool - for _, certType := range certReq.certificateTypes { - switch certType { - case certTypeRSASign: - rsaAvail = true - case certTypeECDSASign: - ecdsaAvail = true - } - } - - cri := &CertificateRequestInfo{ - AcceptableCAs: certReq.certificateAuthorities, - } - - if !certReq.hasSignatureAlgorithm { - // Prior to TLS 1.2, the signature schemes were not - // included in the certificate request message. In this - // case we use a plausible list based on the acceptable - // certificate types. - switch { - case rsaAvail && ecdsaAvail: - cri.SignatureSchemes = tls11SignatureSchemes - case rsaAvail: - cri.SignatureSchemes = tls11SignatureSchemesRSA - case ecdsaAvail: - cri.SignatureSchemes = tls11SignatureSchemesECDSA - } - return cri - } - - // In TLS 1.2, the signature schemes apply to both the certificate chain and - // the leaf key, while the certificate types only apply to the leaf key. - // See RFC 5246, Section 7.4.4 (where it calls this "somewhat complicated"). - // Filter the signature schemes based on the certificate type. - cri.SignatureSchemes = make([]SignatureScheme, 0, len(certReq.supportedSignatureAlgorithms)) - for _, sigScheme := range certReq.supportedSignatureAlgorithms { - switch signatureFromSignatureScheme(sigScheme) { - case signatureECDSA: - if ecdsaAvail { - cri.SignatureSchemes = append(cri.SignatureSchemes, sigScheme) - } - case signatureRSAPSS, signaturePKCS1v15: - if rsaAvail { - cri.SignatureSchemes = append(cri.SignatureSchemes, sigScheme) - } - } - } - - return cri -} - -func (c *Conn) getClientCertificate(cri *CertificateRequestInfo) (*Certificate, error) { - if c.config.GetClientCertificate != nil { - return c.config.GetClientCertificate(cri) - } - - // We need to search our list of client certs for one - // where SignatureAlgorithm is acceptable to the server and the - // Issuer is in AcceptableCAs. - for i, chain := range c.config.Certificates { - sigOK := false - for _, alg := range signatureSchemesForCertificate(c.vers, &chain) { - if isSupportedSignatureAlgorithm(alg, cri.SignatureSchemes) { - sigOK = true - break - } - } - if !sigOK { - continue - } - - if len(cri.AcceptableCAs) == 0 { - return &chain, nil - } - - for j, cert := range chain.Certificate { - x509Cert := chain.Leaf - // Parse the certificate if this isn't the leaf node, or if - // chain.Leaf was nil. - if j != 0 || x509Cert == nil { - var err error - if x509Cert, err = x509.ParseCertificate(cert); err != nil { - c.sendAlert(alertInternalError) - return nil, errors.New("tls: failed to parse configured certificate chain #" + strconv.Itoa(i) + ": " + err.Error()) - } - } - - for _, ca := range cri.AcceptableCAs { - if bytes.Equal(x509Cert.RawIssuer, ca) { - return &chain, nil - } - } - } - } - - // No acceptable certificate found. Don't send a certificate. - return new(Certificate), nil -} - -// clientSessionCacheKey returns a key used to cache sessionTickets that could -// be used to resume previously negotiated TLS sessions with a server. -func clientSessionCacheKey(serverAddr net.Addr, config *Config) string { - if len(config.ServerName) > 0 { - return config.ServerName - } - return serverAddr.String() -} - -// mutualProtocol finds the mutual Next Protocol Negotiation or ALPN protocol -// given list of possible protocols and a list of the preference order. The -// first list must not be empty. It returns the resulting protocol and flag -// indicating if the fallback case was reached. -func mutualProtocol(protos, preferenceProtos []string) (string, bool) { - for _, s := range preferenceProtos { - for _, c := range protos { - if s == c { - return s, false - } - } - } - - return protos[0], true -} - -// hostnameInSNI converts name into an approriate hostname for SNI. -// Literal IP addresses and absolute FQDNs are not permitted as SNI values. -// See RFC 6066, Section 3. -func hostnameInSNI(name string) string { - host := name - if len(host) > 0 && host[0] == '[' && host[len(host)-1] == ']' { - host = host[1 : len(host)-1] - } - if i := strings.LastIndex(host, "%"); i > 0 { - host = host[:i] - } - if net.ParseIP(host) != nil { - return "" - } - for len(name) > 0 && name[len(name)-1] == '.' { - name = name[:len(name)-1] - } - return name -} diff --git a/vendor/github.com/marten-seemann/qtls/handshake_client_tls13.go b/vendor/github.com/marten-seemann/qtls/handshake_client_tls13.go deleted file mode 100644 index f89830e0..00000000 --- a/vendor/github.com/marten-seemann/qtls/handshake_client_tls13.go +++ /dev/null @@ -1,692 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "bytes" - "crypto" - "crypto/hmac" - "crypto/rsa" - "errors" - "hash" - "sync/atomic" - "time" -) - -type clientHandshakeStateTLS13 struct { - c *Conn - serverHello *serverHelloMsg - hello *clientHelloMsg - ecdheParams ecdheParameters - - session *ClientSessionState - earlySecret []byte - binderKey []byte - - certReq *certificateRequestMsgTLS13 - usingPSK bool - sentDummyCCS bool - suite *cipherSuiteTLS13 - transcript hash.Hash - masterSecret []byte - trafficSecret []byte // client_application_traffic_secret_0 -} - -// handshake requires hs.c, hs.hello, hs.serverHello, hs.ecdheParams, and, -// optionally, hs.session, hs.earlySecret and hs.binderKey to be set. -func (hs *clientHandshakeStateTLS13) handshake() error { - c := hs.c - - // The server must not select TLS 1.3 in a renegotiation. See RFC 8446, - // sections 4.1.2 and 4.1.3. - if c.handshakes > 0 { - c.sendAlert(alertProtocolVersion) - return errors.New("tls: server selected TLS 1.3 in a renegotiation") - } - - // Consistency check on the presence of a keyShare and its parameters. - if hs.ecdheParams == nil || len(hs.hello.keyShares) != 1 { - return c.sendAlert(alertInternalError) - } - - if err := hs.checkServerHelloOrHRR(); err != nil { - return err - } - - hs.transcript = hs.suite.hash.New() - hs.transcript.Write(hs.hello.marshal()) - - if bytes.Equal(hs.serverHello.random, helloRetryRequestRandom) { - if err := hs.sendDummyChangeCipherSpec(); err != nil { - return err - } - if err := hs.processHelloRetryRequest(); err != nil { - return err - } - } - - hs.transcript.Write(hs.serverHello.marshal()) - - c.buffering = true - if err := hs.processServerHello(); err != nil { - return err - } - if err := hs.sendDummyChangeCipherSpec(); err != nil { - return err - } - if err := hs.establishHandshakeKeys(); err != nil { - return err - } - if err := hs.readServerParameters(); err != nil { - return err - } - if err := hs.readServerCertificate(); err != nil { - return err - } - if err := hs.readServerFinished(); err != nil { - return err - } - if err := hs.sendClientCertificate(); err != nil { - return err - } - if err := hs.sendClientFinished(); err != nil { - return err - } - if _, err := c.flush(); err != nil { - return err - } - - atomic.StoreUint32(&c.handshakeStatus, 1) - - return nil -} - -// checkServerHelloOrHRR does validity checks that apply to both ServerHello and -// HelloRetryRequest messages. It sets hs.suite. -func (hs *clientHandshakeStateTLS13) checkServerHelloOrHRR() error { - c := hs.c - - if hs.serverHello.supportedVersion == 0 { - c.sendAlert(alertMissingExtension) - return errors.New("tls: server selected TLS 1.3 using the legacy version field") - } - - if hs.serverHello.supportedVersion != VersionTLS13 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected an invalid version after a HelloRetryRequest") - } - - if hs.serverHello.vers != VersionTLS12 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server sent an incorrect legacy version") - } - - if hs.serverHello.nextProtoNeg || - len(hs.serverHello.nextProtos) != 0 || - hs.serverHello.ocspStapling || - hs.serverHello.ticketSupported || - hs.serverHello.secureRenegotiationSupported || - len(hs.serverHello.secureRenegotiation) != 0 || - len(hs.serverHello.alpnProtocol) != 0 || - len(hs.serverHello.scts) != 0 { - c.sendAlert(alertUnsupportedExtension) - return errors.New("tls: server sent a ServerHello extension forbidden in TLS 1.3") - } - - if !bytes.Equal(hs.hello.sessionId, hs.serverHello.sessionId) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server did not echo the legacy session ID") - } - - if hs.serverHello.compressionMethod != compressionNone { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected unsupported compression format") - } - - selectedSuite := mutualCipherSuiteTLS13(hs.hello.cipherSuites, hs.serverHello.cipherSuite) - if hs.suite != nil && selectedSuite != hs.suite { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server changed cipher suite after a HelloRetryRequest") - } - if selectedSuite == nil { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server chose an unconfigured cipher suite") - } - hs.suite = selectedSuite - c.cipherSuite = hs.suite.id - - return nil -} - -// sendDummyChangeCipherSpec sends a ChangeCipherSpec record for compatibility -// with middleboxes that didn't implement TLS correctly. See RFC 8446, Appendix D.4. -func (hs *clientHandshakeStateTLS13) sendDummyChangeCipherSpec() error { - if hs.sentDummyCCS { - return nil - } - hs.sentDummyCCS = true - - _, err := hs.c.writeRecord(recordTypeChangeCipherSpec, []byte{1}) - return err -} - -// processHelloRetryRequest handles the HRR in hs.serverHello, modifies and -// resends hs.hello, and reads the new ServerHello into hs.serverHello. -func (hs *clientHandshakeStateTLS13) processHelloRetryRequest() error { - c := hs.c - - // The first ClientHello gets double-hashed into the transcript upon a - // HelloRetryRequest. See RFC 8446, Section 4.4.1. - chHash := hs.transcript.Sum(nil) - hs.transcript.Reset() - hs.transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) - hs.transcript.Write(chHash) - hs.transcript.Write(hs.serverHello.marshal()) - - if hs.serverHello.serverShare.group != 0 { - c.sendAlert(alertDecodeError) - return errors.New("tls: received malformed key_share extension") - } - - curveID := hs.serverHello.selectedGroup - if curveID == 0 { - c.sendAlert(alertMissingExtension) - return errors.New("tls: received HelloRetryRequest without selected group") - } - curveOK := false - for _, id := range hs.hello.supportedCurves { - if id == curveID { - curveOK = true - break - } - } - if !curveOK { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected unsupported group") - } - if hs.ecdheParams.CurveID() == curveID { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server sent an unnecessary HelloRetryRequest message") - } - if _, ok := curveForCurveID(curveID); curveID != X25519 && !ok { - c.sendAlert(alertInternalError) - return errors.New("tls: CurvePreferences includes unsupported curve") - } - params, err := generateECDHEParameters(c.config.rand(), curveID) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - hs.ecdheParams = params - hs.hello.keyShares = []keyShare{{group: curveID, data: params.PublicKey()}} - - hs.hello.cookie = hs.serverHello.cookie - - hs.hello.raw = nil - if len(hs.hello.pskIdentities) > 0 { - pskSuite := cipherSuiteTLS13ByID(hs.session.cipherSuite) - if pskSuite == nil { - return c.sendAlert(alertInternalError) - } - if pskSuite.hash == hs.suite.hash { - // Update binders and obfuscated_ticket_age. - ticketAge := uint32(c.config.time().Sub(hs.session.receivedAt) / time.Millisecond) - hs.hello.pskIdentities[0].obfuscatedTicketAge = ticketAge + hs.session.ageAdd - - transcript := hs.suite.hash.New() - transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) - transcript.Write(chHash) - transcript.Write(hs.serverHello.marshal()) - transcript.Write(hs.hello.marshalWithoutBinders()) - pskBinders := [][]byte{hs.suite.finishedHash(hs.binderKey, transcript)} - hs.hello.updateBinders(pskBinders) - } else { - // Server selected a cipher suite incompatible with the PSK. - hs.hello.pskIdentities = nil - hs.hello.pskBinders = nil - } - } - - hs.transcript.Write(hs.hello.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, hs.hello.marshal()); err != nil { - return err - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - serverHello, ok := msg.(*serverHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(serverHello, msg) - } - hs.serverHello = serverHello - - if err := hs.checkServerHelloOrHRR(); err != nil { - return err - } - - return nil -} - -func (hs *clientHandshakeStateTLS13) processServerHello() error { - c := hs.c - - if bytes.Equal(hs.serverHello.random, helloRetryRequestRandom) { - c.sendAlert(alertUnexpectedMessage) - return errors.New("tls: server sent two HelloRetryRequest messages") - } - - if len(hs.serverHello.cookie) != 0 { - c.sendAlert(alertUnsupportedExtension) - return errors.New("tls: server sent a cookie in a normal ServerHello") - } - - if hs.serverHello.selectedGroup != 0 { - c.sendAlert(alertDecodeError) - return errors.New("tls: malformed key_share extension") - } - - if hs.serverHello.serverShare.group == 0 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server did not send a key share") - } - if hs.serverHello.serverShare.group != hs.ecdheParams.CurveID() { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected unsupported group") - } - - if !hs.serverHello.selectedIdentityPresent { - return nil - } - - if int(hs.serverHello.selectedIdentity) >= len(hs.hello.pskIdentities) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected an invalid PSK") - } - - if len(hs.hello.pskIdentities) != 1 || hs.session == nil { - return c.sendAlert(alertInternalError) - } - pskSuite := cipherSuiteTLS13ByID(hs.session.cipherSuite) - if pskSuite == nil { - return c.sendAlert(alertInternalError) - } - if pskSuite.hash != hs.suite.hash { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: server selected an invalid PSK and cipher suite pair") - } - - hs.usingPSK = true - c.didResume = true - c.peerCertificates = hs.session.serverCertificates - c.verifiedChains = hs.session.verifiedChains - return nil -} - -func (hs *clientHandshakeStateTLS13) establishHandshakeKeys() error { - c := hs.c - - sharedKey := hs.ecdheParams.SharedKey(hs.serverHello.serverShare.data) - if sharedKey == nil { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid server key share") - } - - earlySecret := hs.earlySecret - if !hs.usingPSK { - earlySecret = hs.suite.extract(nil, nil) - } - handshakeSecret := hs.suite.extract(sharedKey, - hs.suite.deriveSecret(earlySecret, "derived", nil)) - - clientSecret := hs.suite.deriveSecret(handshakeSecret, - clientHandshakeTrafficLabel, hs.transcript) - c.out.exportKey(hs.suite, clientSecret) - c.out.setTrafficSecret(hs.suite, clientSecret) - serverSecret := hs.suite.deriveSecret(handshakeSecret, - serverHandshakeTrafficLabel, hs.transcript) - c.in.exportKey(hs.suite, serverSecret) - c.in.setTrafficSecret(hs.suite, serverSecret) - - err := c.config.writeKeyLog(keyLogLabelClientHandshake, hs.hello.random, clientSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - err = c.config.writeKeyLog(keyLogLabelServerHandshake, hs.hello.random, serverSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - hs.masterSecret = hs.suite.extract(nil, - hs.suite.deriveSecret(handshakeSecret, "derived", nil)) - - return nil -} - -func (hs *clientHandshakeStateTLS13) readServerParameters() error { - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return err - } - - encryptedExtensions, ok := msg.(*encryptedExtensionsMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(encryptedExtensions, msg) - } - if hs.c.config.ReceivedExtensions != nil { - hs.c.config.ReceivedExtensions(typeEncryptedExtensions, encryptedExtensions.additionalExtensions) - } - hs.transcript.Write(encryptedExtensions.marshal()) - - if len(encryptedExtensions.alpnProtocol) != 0 && len(hs.hello.alpnProtocols) == 0 { - c.sendAlert(alertUnsupportedExtension) - return errors.New("tls: server advertised unrequested ALPN extension") - } - if c.config.EnforceNextProtoSelection { - if len(encryptedExtensions.alpnProtocol) == 0 { - // the server didn't select an ALPN - c.sendAlert(alertNoApplicationProtocol) - return errors.New("ALPN negotiation failed") - } - if _, fallback := mutualProtocol([]string{encryptedExtensions.alpnProtocol}, hs.c.config.NextProtos); fallback { - // the protocol selected by the server was not offered - c.sendAlert(alertNoApplicationProtocol) - return errors.New("ALPN negotiation failed") - } - } - c.clientProtocol = encryptedExtensions.alpnProtocol - - return nil -} - -func (hs *clientHandshakeStateTLS13) readServerCertificate() error { - c := hs.c - - // Either a PSK or a certificate is always used, but not both. - // See RFC 8446, Section 4.1.1. - if hs.usingPSK { - return nil - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - certReq, ok := msg.(*certificateRequestMsgTLS13) - if ok { - hs.transcript.Write(certReq.marshal()) - - hs.certReq = certReq - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - certMsg, ok := msg.(*certificateMsgTLS13) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - if len(certMsg.certificate.Certificate) == 0 { - c.sendAlert(alertDecodeError) - return errors.New("tls: received empty certificates message") - } - hs.transcript.Write(certMsg.marshal()) - - c.scts = certMsg.certificate.SignedCertificateTimestamps - c.ocspResponse = certMsg.certificate.OCSPStaple - - if err := c.verifyServerCertificate(certMsg.certificate.Certificate); err != nil { - return err - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - - certVerify, ok := msg.(*certificateVerifyMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certVerify, msg) - } - - // See RFC 8446, Section 4.4.3. - if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid certificate signature algorithm") - } - sigType := signatureFromSignatureScheme(certVerify.signatureAlgorithm) - sigHash, err := hashFromSignatureScheme(certVerify.signatureAlgorithm) - if sigType == 0 || err != nil { - c.sendAlert(alertInternalError) - return err - } - if sigType == signaturePKCS1v15 || sigHash == crypto.SHA1 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid certificate signature algorithm") - } - h := sigHash.New() - writeSignedMessage(h, serverSignatureContext, hs.transcript) - if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, - sigHash, h.Sum(nil), certVerify.signature); err != nil { - c.sendAlert(alertDecryptError) - return errors.New("tls: invalid certificate signature") - } - - hs.transcript.Write(certVerify.marshal()) - - return nil -} - -func (hs *clientHandshakeStateTLS13) readServerFinished() error { - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return err - } - - finished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(finished, msg) - } - - expectedMAC := hs.suite.finishedHash(c.in.trafficSecret, hs.transcript) - if !hmac.Equal(expectedMAC, finished.verifyData) { - c.sendAlert(alertDecryptError) - return errors.New("tls: invalid server finished hash") - } - - hs.transcript.Write(finished.marshal()) - - // Derive secrets that take context through the server Finished. - - hs.trafficSecret = hs.suite.deriveSecret(hs.masterSecret, - clientApplicationTrafficLabel, hs.transcript) - serverSecret := hs.suite.deriveSecret(hs.masterSecret, - serverApplicationTrafficLabel, hs.transcript) - c.in.exportKey(hs.suite, serverSecret) - c.in.setTrafficSecret(hs.suite, serverSecret) - - err = c.config.writeKeyLog(keyLogLabelClientTraffic, hs.hello.random, hs.trafficSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - err = c.config.writeKeyLog(keyLogLabelServerTraffic, hs.hello.random, serverSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - c.ekm = hs.suite.exportKeyingMaterial(hs.masterSecret, hs.transcript) - - return nil -} - -func (hs *clientHandshakeStateTLS13) sendClientCertificate() error { - c := hs.c - - if hs.certReq == nil { - return nil - } - - cert, err := c.getClientCertificate(&CertificateRequestInfo{ - AcceptableCAs: hs.certReq.certificateAuthorities, - SignatureSchemes: hs.certReq.supportedSignatureAlgorithms, - }) - if err != nil { - return err - } - - certMsg := new(certificateMsgTLS13) - - certMsg.certificate = *cert - certMsg.scts = hs.certReq.scts && len(cert.SignedCertificateTimestamps) > 0 - certMsg.ocspStapling = hs.certReq.ocspStapling && len(cert.OCSPStaple) > 0 - - hs.transcript.Write(certMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certMsg.marshal()); err != nil { - return err - } - - // If we sent an empty certificate message, skip the CertificateVerify. - if len(cert.Certificate) == 0 { - return nil - } - - certVerifyMsg := new(certificateVerifyMsg) - certVerifyMsg.hasSignatureAlgorithm = true - - supportedAlgs := signatureSchemesForCertificate(c.vers, cert) - if supportedAlgs == nil { - c.sendAlert(alertInternalError) - return unsupportedCertificateError(cert) - } - // Pick signature scheme in server preference order, as the client - // preference order is not configurable. - for _, preferredAlg := range hs.certReq.supportedSignatureAlgorithms { - if isSupportedSignatureAlgorithm(preferredAlg, supportedAlgs) { - certVerifyMsg.signatureAlgorithm = preferredAlg - break - } - } - if certVerifyMsg.signatureAlgorithm == 0 { - // getClientCertificate returned a certificate incompatible with the - // CertificateRequestInfo supported signature algorithms. - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: server doesn't support selected certificate") - } - - sigType := signatureFromSignatureScheme(certVerifyMsg.signatureAlgorithm) - sigHash, err := hashFromSignatureScheme(certVerifyMsg.signatureAlgorithm) - if sigType == 0 || err != nil { - return c.sendAlert(alertInternalError) - } - h := sigHash.New() - writeSignedMessage(h, clientSignatureContext, hs.transcript) - - signOpts := crypto.SignerOpts(sigHash) - if sigType == signatureRSAPSS { - signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} - } - sig, err := cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), h.Sum(nil), signOpts) - if err != nil { - c.sendAlert(alertInternalError) - return errors.New("tls: failed to sign handshake: " + err.Error()) - } - certVerifyMsg.signature = sig - - hs.transcript.Write(certVerifyMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certVerifyMsg.marshal()); err != nil { - return err - } - - return nil -} - -func (hs *clientHandshakeStateTLS13) sendClientFinished() error { - c := hs.c - - finished := &finishedMsg{ - verifyData: hs.suite.finishedHash(c.out.trafficSecret, hs.transcript), - } - - hs.transcript.Write(finished.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, finished.marshal()); err != nil { - return err - } - - c.out.exportKey(hs.suite, hs.trafficSecret) - c.out.setTrafficSecret(hs.suite, hs.trafficSecret) - - if !c.config.SessionTicketsDisabled && c.config.ClientSessionCache != nil { - c.resumptionSecret = hs.suite.deriveSecret(hs.masterSecret, - resumptionLabel, hs.transcript) - } - - return nil -} - -func (c *Conn) handleNewSessionTicket(msg *newSessionTicketMsgTLS13) error { - if !c.isClient { - c.sendAlert(alertUnexpectedMessage) - return errors.New("tls: received new session ticket from a client") - } - - if c.config.SessionTicketsDisabled || c.config.ClientSessionCache == nil { - return nil - } - - // See RFC 8446, Section 4.6.1. - if msg.lifetime == 0 { - return nil - } - lifetime := time.Duration(msg.lifetime) * time.Second - if lifetime > maxSessionTicketLifetime { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: received a session ticket with invalid lifetime") - } - - cipherSuite := cipherSuiteTLS13ByID(c.cipherSuite) - if cipherSuite == nil || c.resumptionSecret == nil { - return c.sendAlert(alertInternalError) - } - - // Save the resumption_master_secret and nonce instead of deriving the PSK - // to do the least amount of work on NewSessionTicket messages before we - // know if the ticket will be used. Forward secrecy of resumed connections - // is guaranteed by the requirement for pskModeDHE. - session := &ClientSessionState{ - sessionTicket: msg.label, - vers: c.vers, - cipherSuite: c.cipherSuite, - masterSecret: c.resumptionSecret, - serverCertificates: c.peerCertificates, - verifiedChains: c.verifiedChains, - receivedAt: c.config.time(), - nonce: msg.nonce, - useBy: c.config.time().Add(lifetime), - ageAdd: msg.ageAdd, - } - - cacheKey := clientSessionCacheKey(c.conn.RemoteAddr(), c.config) - c.config.ClientSessionCache.Put(cacheKey, session) - - return nil -} diff --git a/vendor/github.com/marten-seemann/qtls/handshake_messages.go b/vendor/github.com/marten-seemann/qtls/handshake_messages.go deleted file mode 100644 index 9c2ffa1d..00000000 --- a/vendor/github.com/marten-seemann/qtls/handshake_messages.go +++ /dev/null @@ -1,1900 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "fmt" - "strings" - - "golang.org/x/crypto/cryptobyte" -) - -// The marshalingFunction type is an adapter to allow the use of ordinary -// functions as cryptobyte.MarshalingValue. -type marshalingFunction func(b *cryptobyte.Builder) error - -func (f marshalingFunction) Marshal(b *cryptobyte.Builder) error { - return f(b) -} - -// addBytesWithLength appends a sequence of bytes to the cryptobyte.Builder. If -// the length of the sequence is not the value specified, it produces an error. -func addBytesWithLength(b *cryptobyte.Builder, v []byte, n int) { - b.AddValue(marshalingFunction(func(b *cryptobyte.Builder) error { - if len(v) != n { - return fmt.Errorf("invalid value length: expected %d, got %d", n, len(v)) - } - b.AddBytes(v) - return nil - })) -} - -// addUint64 appends a big-endian, 64-bit value to the cryptobyte.Builder. -func addUint64(b *cryptobyte.Builder, v uint64) { - b.AddUint32(uint32(v >> 32)) - b.AddUint32(uint32(v)) -} - -// readUint64 decodes a big-endian, 64-bit value into out and advances over it. -// It reports whether the read was successful. -func readUint64(s *cryptobyte.String, out *uint64) bool { - var hi, lo uint32 - if !s.ReadUint32(&hi) || !s.ReadUint32(&lo) { - return false - } - *out = uint64(hi)<<32 | uint64(lo) - return true -} - -// readUint8LengthPrefixed acts like s.ReadUint8LengthPrefixed, but targets a -// []byte instead of a cryptobyte.String. -func readUint8LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { - return s.ReadUint8LengthPrefixed((*cryptobyte.String)(out)) -} - -// readUint16LengthPrefixed acts like s.ReadUint16LengthPrefixed, but targets a -// []byte instead of a cryptobyte.String. -func readUint16LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { - return s.ReadUint16LengthPrefixed((*cryptobyte.String)(out)) -} - -// readUint24LengthPrefixed acts like s.ReadUint24LengthPrefixed, but targets a -// []byte instead of a cryptobyte.String. -func readUint24LengthPrefixed(s *cryptobyte.String, out *[]byte) bool { - return s.ReadUint24LengthPrefixed((*cryptobyte.String)(out)) -} - -type clientHelloMsg struct { - raw []byte - vers uint16 - random []byte - sessionId []byte - cipherSuites []uint16 - compressionMethods []uint8 - nextProtoNeg bool - serverName string - ocspStapling bool - supportedCurves []CurveID - supportedPoints []uint8 - ticketSupported bool - sessionTicket []uint8 - supportedSignatureAlgorithms []SignatureScheme - supportedSignatureAlgorithmsCert []SignatureScheme - secureRenegotiationSupported bool - secureRenegotiation []byte - alpnProtocols []string - scts bool - supportedVersions []uint16 - cookie []byte - keyShares []keyShare - earlyData bool - pskModes []uint8 - pskIdentities []pskIdentity - pskBinders [][]byte - additionalExtensions []Extension -} - -func (m *clientHelloMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeClientHello) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(m.vers) - addBytesWithLength(b, m.random, 32) - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.sessionId) - }) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, suite := range m.cipherSuites { - b.AddUint16(suite) - } - }) - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.compressionMethods) - }) - - // If extensions aren't present, omit them. - var extensionsPresent bool - bWithoutExtensions := *b - - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if m.nextProtoNeg { - // draft-agl-tls-nextprotoneg-04 - b.AddUint16(extensionNextProtoNeg) - b.AddUint16(0) // empty extension_data - } - if len(m.serverName) > 0 { - // RFC 6066, Section 3 - b.AddUint16(extensionServerName) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8(0) // name_type = host_name - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte(m.serverName)) - }) - }) - }) - } - if m.ocspStapling { - // RFC 4366, Section 3.6 - b.AddUint16(extensionStatusRequest) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8(1) // status_type = ocsp - b.AddUint16(0) // empty responder_id_list - b.AddUint16(0) // empty request_extensions - }) - } - if len(m.supportedCurves) > 0 { - // RFC 4492, sections 5.1.1 and RFC 8446, Section 4.2.7 - b.AddUint16(extensionSupportedCurves) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, curve := range m.supportedCurves { - b.AddUint16(uint16(curve)) - } - }) - }) - } - if len(m.supportedPoints) > 0 { - // RFC 4492, Section 5.1.2 - b.AddUint16(extensionSupportedPoints) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.supportedPoints) - }) - }) - } - if m.ticketSupported { - // RFC 5077, Section 3.2 - b.AddUint16(extensionSessionTicket) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.sessionTicket) - }) - } - if len(m.supportedSignatureAlgorithms) > 0 { - // RFC 5246, Section 7.4.1.4.1 - b.AddUint16(extensionSignatureAlgorithms) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sigAlgo := range m.supportedSignatureAlgorithms { - b.AddUint16(uint16(sigAlgo)) - } - }) - }) - } - if len(m.supportedSignatureAlgorithmsCert) > 0 { - // RFC 8446, Section 4.2.3 - b.AddUint16(extensionSignatureAlgorithmsCert) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sigAlgo := range m.supportedSignatureAlgorithmsCert { - b.AddUint16(uint16(sigAlgo)) - } - }) - }) - } - if m.secureRenegotiationSupported { - // RFC 5746, Section 3.2 - b.AddUint16(extensionRenegotiationInfo) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.secureRenegotiation) - }) - }) - } - if len(m.alpnProtocols) > 0 { - // RFC 7301, Section 3.1 - b.AddUint16(extensionALPN) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, proto := range m.alpnProtocols { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte(proto)) - }) - } - }) - }) - } - if m.scts { - // RFC 6962, Section 3.3.1 - b.AddUint16(extensionSCT) - b.AddUint16(0) // empty extension_data - } - if len(m.supportedVersions) > 0 { - // RFC 8446, Section 4.2.1 - b.AddUint16(extensionSupportedVersions) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - for _, vers := range m.supportedVersions { - b.AddUint16(vers) - } - }) - }) - } - if len(m.cookie) > 0 { - // RFC 8446, Section 4.2.2 - b.AddUint16(extensionCookie) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.cookie) - }) - }) - } - if len(m.keyShares) > 0 { - // RFC 8446, Section 4.2.8 - b.AddUint16(extensionKeyShare) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, ks := range m.keyShares { - b.AddUint16(uint16(ks.group)) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(ks.data) - }) - } - }) - }) - } - if m.earlyData { - // RFC 8446, Section 4.2.10 - b.AddUint16(extensionEarlyData) - b.AddUint16(0) // empty extension_data - } - if len(m.pskModes) > 0 { - // RFC 8446, Section 4.2.9 - b.AddUint16(extensionPSKModes) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.pskModes) - }) - }) - } - for _, ext := range m.additionalExtensions { - b.AddUint16(ext.Type) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(ext.Data) - }) - } - if len(m.pskIdentities) > 0 { // pre_shared_key must be the last extension - // RFC 8446, Section 4.2.11 - b.AddUint16(extensionPreSharedKey) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, psk := range m.pskIdentities { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(psk.label) - }) - b.AddUint32(psk.obfuscatedTicketAge) - } - }) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, binder := range m.pskBinders { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(binder) - }) - } - }) - }) - } - - extensionsPresent = len(b.BytesOrPanic()) > 2 - }) - - if !extensionsPresent { - *b = bWithoutExtensions - } - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -// marshalWithoutBinders returns the ClientHello through the -// PreSharedKeyExtension.identities field, according to RFC 8446, Section -// 4.2.11.2. Note that m.pskBinders must be set to slices of the correct length. -func (m *clientHelloMsg) marshalWithoutBinders() []byte { - bindersLen := 2 // uint16 length prefix - for _, binder := range m.pskBinders { - bindersLen += 1 // uint8 length prefix - bindersLen += len(binder) - } - - fullMessage := m.marshal() - return fullMessage[:len(fullMessage)-bindersLen] -} - -// updateBinders updates the m.pskBinders field, if necessary updating the -// cached marshalled representation. The supplied binders must have the same -// length as the current m.pskBinders. -func (m *clientHelloMsg) updateBinders(pskBinders [][]byte) { - if len(pskBinders) != len(m.pskBinders) { - panic("tls: internal error: pskBinders length mismatch") - } - for i := range m.pskBinders { - if len(pskBinders[i]) != len(m.pskBinders[i]) { - panic("tls: internal error: pskBinders length mismatch") - } - } - m.pskBinders = pskBinders - if m.raw != nil { - lenWithoutBinders := len(m.marshalWithoutBinders()) - // TODO(filippo): replace with NewFixedBuilder once CL 148882 is imported. - b := cryptobyte.NewBuilder(m.raw[:lenWithoutBinders]) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, binder := range m.pskBinders { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(binder) - }) - } - }) - if len(b.BytesOrPanic()) != len(m.raw) { - panic("tls: internal error: failed to update binders") - } - } -} - -func (m *clientHelloMsg) unmarshal(data []byte) bool { - *m = clientHelloMsg{raw: data} - s := cryptobyte.String(data) - - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint16(&m.vers) || !s.ReadBytes(&m.random, 32) || - !readUint8LengthPrefixed(&s, &m.sessionId) { - return false - } - - var cipherSuites cryptobyte.String - if !s.ReadUint16LengthPrefixed(&cipherSuites) { - return false - } - m.cipherSuites = []uint16{} - m.secureRenegotiationSupported = false - for !cipherSuites.Empty() { - var suite uint16 - if !cipherSuites.ReadUint16(&suite) { - return false - } - if suite == scsvRenegotiation { - m.secureRenegotiationSupported = true - } - m.cipherSuites = append(m.cipherSuites, suite) - } - - if !readUint8LengthPrefixed(&s, &m.compressionMethods) { - return false - } - - if s.Empty() { - // ClientHello is optionally followed by extension data - return true - } - - var extensions cryptobyte.String - if !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { - return false - } - - for !extensions.Empty() { - var ext uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&ext) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - - switch ext { - case extensionServerName: - // RFC 6066, Section 3 - var nameList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&nameList) || nameList.Empty() { - return false - } - for !nameList.Empty() { - var nameType uint8 - var serverName cryptobyte.String - if !nameList.ReadUint8(&nameType) || - !nameList.ReadUint16LengthPrefixed(&serverName) || - serverName.Empty() { - return false - } - if nameType != 0 { - continue - } - if len(m.serverName) != 0 { - // Multiple names of the same name_type are prohibited. - return false - } - m.serverName = string(serverName) - // An SNI value may not include a trailing dot. - if strings.HasSuffix(m.serverName, ".") { - return false - } - } - case extensionNextProtoNeg: - // draft-agl-tls-nextprotoneg-04 - m.nextProtoNeg = true - case extensionStatusRequest: - // RFC 4366, Section 3.6 - var statusType uint8 - var ignored cryptobyte.String - if !extData.ReadUint8(&statusType) || - !extData.ReadUint16LengthPrefixed(&ignored) || - !extData.ReadUint16LengthPrefixed(&ignored) { - return false - } - m.ocspStapling = statusType == statusTypeOCSP - case extensionSupportedCurves: - // RFC 4492, sections 5.1.1 and RFC 8446, Section 4.2.7 - var curves cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&curves) || curves.Empty() { - return false - } - for !curves.Empty() { - var curve uint16 - if !curves.ReadUint16(&curve) { - return false - } - m.supportedCurves = append(m.supportedCurves, CurveID(curve)) - } - case extensionSupportedPoints: - // RFC 4492, Section 5.1.2 - if !readUint8LengthPrefixed(&extData, &m.supportedPoints) || - len(m.supportedPoints) == 0 { - return false - } - case extensionSessionTicket: - // RFC 5077, Section 3.2 - m.ticketSupported = true - extData.ReadBytes(&m.sessionTicket, len(extData)) - case extensionSignatureAlgorithms: - // RFC 5246, Section 7.4.1.4.1 - var sigAndAlgs cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { - return false - } - for !sigAndAlgs.Empty() { - var sigAndAlg uint16 - if !sigAndAlgs.ReadUint16(&sigAndAlg) { - return false - } - m.supportedSignatureAlgorithms = append( - m.supportedSignatureAlgorithms, SignatureScheme(sigAndAlg)) - } - case extensionSignatureAlgorithmsCert: - // RFC 8446, Section 4.2.3 - var sigAndAlgs cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { - return false - } - for !sigAndAlgs.Empty() { - var sigAndAlg uint16 - if !sigAndAlgs.ReadUint16(&sigAndAlg) { - return false - } - m.supportedSignatureAlgorithmsCert = append( - m.supportedSignatureAlgorithmsCert, SignatureScheme(sigAndAlg)) - } - case extensionRenegotiationInfo: - // RFC 5746, Section 3.2 - if !readUint8LengthPrefixed(&extData, &m.secureRenegotiation) { - return false - } - m.secureRenegotiationSupported = true - case extensionALPN: - // RFC 7301, Section 3.1 - var protoList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { - return false - } - for !protoList.Empty() { - var proto cryptobyte.String - if !protoList.ReadUint8LengthPrefixed(&proto) || proto.Empty() { - return false - } - m.alpnProtocols = append(m.alpnProtocols, string(proto)) - } - case extensionSCT: - // RFC 6962, Section 3.3.1 - m.scts = true - case extensionSupportedVersions: - // RFC 8446, Section 4.2.1 - var versList cryptobyte.String - if !extData.ReadUint8LengthPrefixed(&versList) || versList.Empty() { - return false - } - for !versList.Empty() { - var vers uint16 - if !versList.ReadUint16(&vers) { - return false - } - m.supportedVersions = append(m.supportedVersions, vers) - } - case extensionCookie: - // RFC 8446, Section 4.2.2 - if !readUint16LengthPrefixed(&extData, &m.cookie) || - len(m.cookie) == 0 { - return false - } - case extensionKeyShare: - // RFC 8446, Section 4.2.8 - var clientShares cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&clientShares) { - return false - } - for !clientShares.Empty() { - var ks keyShare - if !clientShares.ReadUint16((*uint16)(&ks.group)) || - !readUint16LengthPrefixed(&clientShares, &ks.data) || - len(ks.data) == 0 { - return false - } - m.keyShares = append(m.keyShares, ks) - } - case extensionEarlyData: - // RFC 8446, Section 4.2.10 - m.earlyData = true - case extensionPSKModes: - // RFC 8446, Section 4.2.9 - if !readUint8LengthPrefixed(&extData, &m.pskModes) { - return false - } - case extensionPreSharedKey: - // RFC 8446, Section 4.2.11 - if !extensions.Empty() { - return false // pre_shared_key must be the last extension - } - var identities cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&identities) || identities.Empty() { - return false - } - for !identities.Empty() { - var psk pskIdentity - if !readUint16LengthPrefixed(&identities, &psk.label) || - !identities.ReadUint32(&psk.obfuscatedTicketAge) || - len(psk.label) == 0 { - return false - } - m.pskIdentities = append(m.pskIdentities, psk) - } - var binders cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&binders) || binders.Empty() { - return false - } - for !binders.Empty() { - var binder []byte - if !readUint8LengthPrefixed(&binders, &binder) || - len(binder) == 0 { - return false - } - m.pskBinders = append(m.pskBinders, binder) - } - default: - m.additionalExtensions = append(m.additionalExtensions, Extension{Type: ext, Data: extData}) - continue - } - - if !extData.Empty() { - return false - } - } - - return true -} - -type serverHelloMsg struct { - raw []byte - vers uint16 - random []byte - sessionId []byte - cipherSuite uint16 - compressionMethod uint8 - nextProtoNeg bool - nextProtos []string - ocspStapling bool - ticketSupported bool - secureRenegotiationSupported bool - secureRenegotiation []byte - alpnProtocol string - scts [][]byte - supportedVersion uint16 - serverShare keyShare - selectedIdentityPresent bool - selectedIdentity uint16 - - // HelloRetryRequest extensions - cookie []byte - selectedGroup CurveID -} - -func (m *serverHelloMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeServerHello) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(m.vers) - addBytesWithLength(b, m.random, 32) - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.sessionId) - }) - b.AddUint16(m.cipherSuite) - b.AddUint8(m.compressionMethod) - - // If extensions aren't present, omit them. - var extensionsPresent bool - bWithoutExtensions := *b - - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if m.nextProtoNeg { - b.AddUint16(extensionNextProtoNeg) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, proto := range m.nextProtos { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte(proto)) - }) - } - }) - } - if m.ocspStapling { - b.AddUint16(extensionStatusRequest) - b.AddUint16(0) // empty extension_data - } - if m.ticketSupported { - b.AddUint16(extensionSessionTicket) - b.AddUint16(0) // empty extension_data - } - if m.secureRenegotiationSupported { - b.AddUint16(extensionRenegotiationInfo) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.secureRenegotiation) - }) - }) - } - if len(m.alpnProtocol) > 0 { - b.AddUint16(extensionALPN) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte(m.alpnProtocol)) - }) - }) - }) - } - if len(m.scts) > 0 { - b.AddUint16(extensionSCT) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sct := range m.scts { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(sct) - }) - } - }) - }) - } - if m.supportedVersion != 0 { - b.AddUint16(extensionSupportedVersions) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(m.supportedVersion) - }) - } - if m.serverShare.group != 0 { - b.AddUint16(extensionKeyShare) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(uint16(m.serverShare.group)) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.serverShare.data) - }) - }) - } - if m.selectedIdentityPresent { - b.AddUint16(extensionPreSharedKey) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(m.selectedIdentity) - }) - } - - if len(m.cookie) > 0 { - b.AddUint16(extensionCookie) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.cookie) - }) - }) - } - if m.selectedGroup != 0 { - b.AddUint16(extensionKeyShare) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16(uint16(m.selectedGroup)) - }) - } - - extensionsPresent = len(b.BytesOrPanic()) > 2 - }) - - if !extensionsPresent { - *b = bWithoutExtensions - } - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *serverHelloMsg) unmarshal(data []byte) bool { - *m = serverHelloMsg{raw: data} - s := cryptobyte.String(data) - - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint16(&m.vers) || !s.ReadBytes(&m.random, 32) || - !readUint8LengthPrefixed(&s, &m.sessionId) || - !s.ReadUint16(&m.cipherSuite) || - !s.ReadUint8(&m.compressionMethod) { - return false - } - - if s.Empty() { - // ServerHello is optionally followed by extension data - return true - } - - var extensions cryptobyte.String - if !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { - return false - } - - for !extensions.Empty() { - var extension uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&extension) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - - switch extension { - case extensionNextProtoNeg: - m.nextProtoNeg = true - for !extData.Empty() { - var proto cryptobyte.String - if !extData.ReadUint8LengthPrefixed(&proto) || - proto.Empty() { - return false - } - m.nextProtos = append(m.nextProtos, string(proto)) - } - case extensionStatusRequest: - m.ocspStapling = true - case extensionSessionTicket: - m.ticketSupported = true - case extensionRenegotiationInfo: - if !readUint8LengthPrefixed(&extData, &m.secureRenegotiation) { - return false - } - m.secureRenegotiationSupported = true - case extensionALPN: - var protoList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { - return false - } - var proto cryptobyte.String - if !protoList.ReadUint8LengthPrefixed(&proto) || - proto.Empty() || !protoList.Empty() { - return false - } - m.alpnProtocol = string(proto) - case extensionSCT: - var sctList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sctList) || sctList.Empty() { - return false - } - for !sctList.Empty() { - var sct []byte - if !readUint16LengthPrefixed(&sctList, &sct) || - len(sct) == 0 { - return false - } - m.scts = append(m.scts, sct) - } - case extensionSupportedVersions: - if !extData.ReadUint16(&m.supportedVersion) { - return false - } - case extensionCookie: - if !readUint16LengthPrefixed(&extData, &m.cookie) || - len(m.cookie) == 0 { - return false - } - case extensionKeyShare: - // This extension has different formats in SH and HRR, accept either - // and let the handshake logic decide. See RFC 8446, Section 4.2.8. - if len(extData) == 2 { - if !extData.ReadUint16((*uint16)(&m.selectedGroup)) { - return false - } - } else { - if !extData.ReadUint16((*uint16)(&m.serverShare.group)) || - !readUint16LengthPrefixed(&extData, &m.serverShare.data) { - return false - } - } - case extensionPreSharedKey: - m.selectedIdentityPresent = true - if !extData.ReadUint16(&m.selectedIdentity) { - return false - } - default: - // Ignore unknown extensions. - continue - } - - if !extData.Empty() { - return false - } - } - - return true -} - -type encryptedExtensionsMsg struct { - raw []byte - alpnProtocol string - - additionalExtensions []Extension -} - -func (m *encryptedExtensionsMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeEncryptedExtensions) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if len(m.alpnProtocol) > 0 { - b.AddUint16(extensionALPN) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte(m.alpnProtocol)) - }) - }) - }) - } - for _, ext := range m.additionalExtensions { - b.AddUint16(ext.Type) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(ext.Data) - }) - } - }) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *encryptedExtensionsMsg) unmarshal(data []byte) bool { - *m = encryptedExtensionsMsg{raw: data} - s := cryptobyte.String(data) - - var extensions cryptobyte.String - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint16LengthPrefixed(&extensions) || !s.Empty() { - return false - } - - for !extensions.Empty() { - var ext uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&ext) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - - switch ext { - case extensionALPN: - var protoList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&protoList) || protoList.Empty() { - return false - } - var proto cryptobyte.String - if !protoList.ReadUint8LengthPrefixed(&proto) || - proto.Empty() || !protoList.Empty() { - return false - } - m.alpnProtocol = string(proto) - default: - m.additionalExtensions = append(m.additionalExtensions, Extension{Type: ext, Data: extData}) - continue - } - - if !extData.Empty() { - return false - } - } - - return true -} - -type endOfEarlyDataMsg struct{} - -func (m *endOfEarlyDataMsg) marshal() []byte { - x := make([]byte, 4) - x[0] = typeEndOfEarlyData - return x -} - -func (m *endOfEarlyDataMsg) unmarshal(data []byte) bool { - return len(data) == 4 -} - -type keyUpdateMsg struct { - raw []byte - updateRequested bool -} - -func (m *keyUpdateMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeKeyUpdate) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - if m.updateRequested { - b.AddUint8(1) - } else { - b.AddUint8(0) - } - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *keyUpdateMsg) unmarshal(data []byte) bool { - m.raw = data - s := cryptobyte.String(data) - - var updateRequested uint8 - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint8(&updateRequested) || !s.Empty() { - return false - } - switch updateRequested { - case 0: - m.updateRequested = false - case 1: - m.updateRequested = true - default: - return false - } - return true -} - -type newSessionTicketMsgTLS13 struct { - raw []byte - lifetime uint32 - ageAdd uint32 - nonce []byte - label []byte - maxEarlyData uint32 -} - -func (m *newSessionTicketMsgTLS13) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeNewSessionTicket) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint32(m.lifetime) - b.AddUint32(m.ageAdd) - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.nonce) - }) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.label) - }) - - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if m.maxEarlyData > 0 { - b.AddUint16(extensionEarlyData) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint32(m.maxEarlyData) - }) - } - }) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *newSessionTicketMsgTLS13) unmarshal(data []byte) bool { - *m = newSessionTicketMsgTLS13{raw: data} - s := cryptobyte.String(data) - - var extensions cryptobyte.String - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint32(&m.lifetime) || - !s.ReadUint32(&m.ageAdd) || - !readUint8LengthPrefixed(&s, &m.nonce) || - !readUint16LengthPrefixed(&s, &m.label) || - !s.ReadUint16LengthPrefixed(&extensions) || - !s.Empty() { - return false - } - - for !extensions.Empty() { - var extension uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&extension) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - - switch extension { - case extensionEarlyData: - if !extData.ReadUint32(&m.maxEarlyData) { - return false - } - default: - // Ignore unknown extensions. - continue - } - - if !extData.Empty() { - return false - } - } - - return true -} - -type certificateRequestMsgTLS13 struct { - raw []byte - ocspStapling bool - scts bool - supportedSignatureAlgorithms []SignatureScheme - supportedSignatureAlgorithmsCert []SignatureScheme - certificateAuthorities [][]byte -} - -func (m *certificateRequestMsgTLS13) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeCertificateRequest) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - // certificate_request_context (SHALL be zero length unless used for - // post-handshake authentication) - b.AddUint8(0) - - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if m.ocspStapling { - b.AddUint16(extensionStatusRequest) - b.AddUint16(0) // empty extension_data - } - if m.scts { - // RFC 8446, Section 4.4.2.1 makes no mention of - // signed_certificate_timestamp in CertificateRequest, but - // "Extensions in the Certificate message from the client MUST - // correspond to extensions in the CertificateRequest message - // from the server." and it appears in the table in Section 4.2. - b.AddUint16(extensionSCT) - b.AddUint16(0) // empty extension_data - } - if len(m.supportedSignatureAlgorithms) > 0 { - b.AddUint16(extensionSignatureAlgorithms) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sigAlgo := range m.supportedSignatureAlgorithms { - b.AddUint16(uint16(sigAlgo)) - } - }) - }) - } - if len(m.supportedSignatureAlgorithmsCert) > 0 { - b.AddUint16(extensionSignatureAlgorithmsCert) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sigAlgo := range m.supportedSignatureAlgorithmsCert { - b.AddUint16(uint16(sigAlgo)) - } - }) - }) - } - if len(m.certificateAuthorities) > 0 { - b.AddUint16(extensionCertificateAuthorities) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, ca := range m.certificateAuthorities { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(ca) - }) - } - }) - }) - } - }) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *certificateRequestMsgTLS13) unmarshal(data []byte) bool { - *m = certificateRequestMsgTLS13{raw: data} - s := cryptobyte.String(data) - - var context, extensions cryptobyte.String - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint8LengthPrefixed(&context) || !context.Empty() || - !s.ReadUint16LengthPrefixed(&extensions) || - !s.Empty() { - return false - } - - for !extensions.Empty() { - var extension uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&extension) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - - switch extension { - case extensionStatusRequest: - m.ocspStapling = true - case extensionSCT: - m.scts = true - case extensionSignatureAlgorithms: - var sigAndAlgs cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { - return false - } - for !sigAndAlgs.Empty() { - var sigAndAlg uint16 - if !sigAndAlgs.ReadUint16(&sigAndAlg) { - return false - } - m.supportedSignatureAlgorithms = append( - m.supportedSignatureAlgorithms, SignatureScheme(sigAndAlg)) - } - case extensionSignatureAlgorithmsCert: - var sigAndAlgs cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sigAndAlgs) || sigAndAlgs.Empty() { - return false - } - for !sigAndAlgs.Empty() { - var sigAndAlg uint16 - if !sigAndAlgs.ReadUint16(&sigAndAlg) { - return false - } - m.supportedSignatureAlgorithmsCert = append( - m.supportedSignatureAlgorithmsCert, SignatureScheme(sigAndAlg)) - } - case extensionCertificateAuthorities: - var auths cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&auths) || auths.Empty() { - return false - } - for !auths.Empty() { - var ca []byte - if !readUint16LengthPrefixed(&auths, &ca) || len(ca) == 0 { - return false - } - m.certificateAuthorities = append(m.certificateAuthorities, ca) - } - default: - // Ignore unknown extensions. - continue - } - - if !extData.Empty() { - return false - } - } - - return true -} - -type certificateMsg struct { - raw []byte - certificates [][]byte -} - -func (m *certificateMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - var i int - for _, slice := range m.certificates { - i += len(slice) - } - - length := 3 + 3*len(m.certificates) + i - x = make([]byte, 4+length) - x[0] = typeCertificate - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - certificateOctets := length - 3 - x[4] = uint8(certificateOctets >> 16) - x[5] = uint8(certificateOctets >> 8) - x[6] = uint8(certificateOctets) - - y := x[7:] - for _, slice := range m.certificates { - y[0] = uint8(len(slice) >> 16) - y[1] = uint8(len(slice) >> 8) - y[2] = uint8(len(slice)) - copy(y[3:], slice) - y = y[3+len(slice):] - } - - m.raw = x - return -} - -func (m *certificateMsg) unmarshal(data []byte) bool { - if len(data) < 7 { - return false - } - - m.raw = data - certsLen := uint32(data[4])<<16 | uint32(data[5])<<8 | uint32(data[6]) - if uint32(len(data)) != certsLen+7 { - return false - } - - numCerts := 0 - d := data[7:] - for certsLen > 0 { - if len(d) < 4 { - return false - } - certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) - if uint32(len(d)) < 3+certLen { - return false - } - d = d[3+certLen:] - certsLen -= 3 + certLen - numCerts++ - } - - m.certificates = make([][]byte, numCerts) - d = data[7:] - for i := 0; i < numCerts; i++ { - certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) - m.certificates[i] = d[3 : 3+certLen] - d = d[3+certLen:] - } - - return true -} - -type certificateMsgTLS13 struct { - raw []byte - certificate Certificate - ocspStapling bool - scts bool -} - -func (m *certificateMsgTLS13) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeCertificate) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8(0) // certificate_request_context - - certificate := m.certificate - if !m.ocspStapling { - certificate.OCSPStaple = nil - } - if !m.scts { - certificate.SignedCertificateTimestamps = nil - } - marshalCertificate(b, certificate) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func marshalCertificate(b *cryptobyte.Builder, certificate Certificate) { - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - for i, cert := range certificate.Certificate { - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(cert) - }) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - if i > 0 { - // This library only supports OCSP and SCT for leaf certificates. - return - } - if certificate.OCSPStaple != nil { - b.AddUint16(extensionStatusRequest) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8(statusTypeOCSP) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(certificate.OCSPStaple) - }) - }) - } - if certificate.SignedCertificateTimestamps != nil { - b.AddUint16(extensionSCT) - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - for _, sct := range certificate.SignedCertificateTimestamps { - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(sct) - }) - } - }) - }) - } - }) - } - }) -} - -func (m *certificateMsgTLS13) unmarshal(data []byte) bool { - *m = certificateMsgTLS13{raw: data} - s := cryptobyte.String(data) - - var context cryptobyte.String - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint8LengthPrefixed(&context) || !context.Empty() || - !unmarshalCertificate(&s, &m.certificate) || - !s.Empty() { - return false - } - - m.scts = m.certificate.SignedCertificateTimestamps != nil - m.ocspStapling = m.certificate.OCSPStaple != nil - - return true -} - -func unmarshalCertificate(s *cryptobyte.String, certificate *Certificate) bool { - var certList cryptobyte.String - if !s.ReadUint24LengthPrefixed(&certList) { - return false - } - for !certList.Empty() { - var cert []byte - var extensions cryptobyte.String - if !readUint24LengthPrefixed(&certList, &cert) || - !certList.ReadUint16LengthPrefixed(&extensions) { - return false - } - certificate.Certificate = append(certificate.Certificate, cert) - for !extensions.Empty() { - var extension uint16 - var extData cryptobyte.String - if !extensions.ReadUint16(&extension) || - !extensions.ReadUint16LengthPrefixed(&extData) { - return false - } - if len(certificate.Certificate) > 1 { - // This library only supports OCSP and SCT for leaf certificates. - continue - } - - switch extension { - case extensionStatusRequest: - var statusType uint8 - if !extData.ReadUint8(&statusType) || statusType != statusTypeOCSP || - !readUint24LengthPrefixed(&extData, &certificate.OCSPStaple) || - len(certificate.OCSPStaple) == 0 { - return false - } - case extensionSCT: - var sctList cryptobyte.String - if !extData.ReadUint16LengthPrefixed(&sctList) || sctList.Empty() { - return false - } - for !sctList.Empty() { - var sct []byte - if !readUint16LengthPrefixed(&sctList, &sct) || - len(sct) == 0 { - return false - } - certificate.SignedCertificateTimestamps = append( - certificate.SignedCertificateTimestamps, sct) - } - default: - // Ignore unknown extensions. - continue - } - - if !extData.Empty() { - return false - } - } - } - return true -} - -type serverKeyExchangeMsg struct { - raw []byte - key []byte -} - -func (m *serverKeyExchangeMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - length := len(m.key) - x := make([]byte, length+4) - x[0] = typeServerKeyExchange - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - copy(x[4:], m.key) - - m.raw = x - return x -} - -func (m *serverKeyExchangeMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 4 { - return false - } - m.key = data[4:] - return true -} - -type certificateStatusMsg struct { - raw []byte - response []byte -} - -func (m *certificateStatusMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeCertificateStatus) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddUint8(statusTypeOCSP) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.response) - }) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *certificateStatusMsg) unmarshal(data []byte) bool { - m.raw = data - s := cryptobyte.String(data) - - var statusType uint8 - if !s.Skip(4) || // message type and uint24 length field - !s.ReadUint8(&statusType) || statusType != statusTypeOCSP || - !readUint24LengthPrefixed(&s, &m.response) || - len(m.response) == 0 || !s.Empty() { - return false - } - return true -} - -type serverHelloDoneMsg struct{} - -func (m *serverHelloDoneMsg) marshal() []byte { - x := make([]byte, 4) - x[0] = typeServerHelloDone - return x -} - -func (m *serverHelloDoneMsg) unmarshal(data []byte) bool { - return len(data) == 4 -} - -type clientKeyExchangeMsg struct { - raw []byte - ciphertext []byte -} - -func (m *clientKeyExchangeMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - length := len(m.ciphertext) - x := make([]byte, length+4) - x[0] = typeClientKeyExchange - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - copy(x[4:], m.ciphertext) - - m.raw = x - return x -} - -func (m *clientKeyExchangeMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 4 { - return false - } - l := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - if l != len(data)-4 { - return false - } - m.ciphertext = data[4:] - return true -} - -type finishedMsg struct { - raw []byte - verifyData []byte -} - -func (m *finishedMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeFinished) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.verifyData) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *finishedMsg) unmarshal(data []byte) bool { - m.raw = data - s := cryptobyte.String(data) - return s.Skip(1) && - readUint24LengthPrefixed(&s, &m.verifyData) && - s.Empty() -} - -type nextProtoMsg struct { - raw []byte - proto string -} - -func (m *nextProtoMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - l := len(m.proto) - if l > 255 { - l = 255 - } - - padding := 32 - (l+2)%32 - length := l + padding + 2 - x := make([]byte, length+4) - x[0] = typeNextProtocol - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - y := x[4:] - y[0] = byte(l) - copy(y[1:], []byte(m.proto[0:l])) - y = y[1+l:] - y[0] = byte(padding) - - m.raw = x - - return x -} - -func (m *nextProtoMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 5 { - return false - } - data = data[4:] - protoLen := int(data[0]) - data = data[1:] - if len(data) < protoLen { - return false - } - m.proto = string(data[0:protoLen]) - data = data[protoLen:] - - if len(data) < 1 { - return false - } - paddingLen := int(data[0]) - data = data[1:] - if len(data) != paddingLen { - return false - } - - return true -} - -type certificateRequestMsg struct { - raw []byte - // hasSignatureAlgorithm indicates whether this message includes a list of - // supported signature algorithms. This change was introduced with TLS 1.2. - hasSignatureAlgorithm bool - - certificateTypes []byte - supportedSignatureAlgorithms []SignatureScheme - certificateAuthorities [][]byte -} - -func (m *certificateRequestMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - // See RFC 4346, Section 7.4.4. - length := 1 + len(m.certificateTypes) + 2 - casLength := 0 - for _, ca := range m.certificateAuthorities { - casLength += 2 + len(ca) - } - length += casLength - - if m.hasSignatureAlgorithm { - length += 2 + 2*len(m.supportedSignatureAlgorithms) - } - - x = make([]byte, 4+length) - x[0] = typeCertificateRequest - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - x[4] = uint8(len(m.certificateTypes)) - - copy(x[5:], m.certificateTypes) - y := x[5+len(m.certificateTypes):] - - if m.hasSignatureAlgorithm { - n := len(m.supportedSignatureAlgorithms) * 2 - y[0] = uint8(n >> 8) - y[1] = uint8(n) - y = y[2:] - for _, sigAlgo := range m.supportedSignatureAlgorithms { - y[0] = uint8(sigAlgo >> 8) - y[1] = uint8(sigAlgo) - y = y[2:] - } - } - - y[0] = uint8(casLength >> 8) - y[1] = uint8(casLength) - y = y[2:] - for _, ca := range m.certificateAuthorities { - y[0] = uint8(len(ca) >> 8) - y[1] = uint8(len(ca)) - y = y[2:] - copy(y, ca) - y = y[len(ca):] - } - - m.raw = x - return -} - -func (m *certificateRequestMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 5 { - return false - } - - length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) - if uint32(len(data))-4 != length { - return false - } - - numCertTypes := int(data[4]) - data = data[5:] - if numCertTypes == 0 || len(data) <= numCertTypes { - return false - } - - m.certificateTypes = make([]byte, numCertTypes) - if copy(m.certificateTypes, data) != numCertTypes { - return false - } - - data = data[numCertTypes:] - - if m.hasSignatureAlgorithm { - if len(data) < 2 { - return false - } - sigAndHashLen := uint16(data[0])<<8 | uint16(data[1]) - data = data[2:] - if sigAndHashLen&1 != 0 { - return false - } - if len(data) < int(sigAndHashLen) { - return false - } - numSigAlgos := sigAndHashLen / 2 - m.supportedSignatureAlgorithms = make([]SignatureScheme, numSigAlgos) - for i := range m.supportedSignatureAlgorithms { - m.supportedSignatureAlgorithms[i] = SignatureScheme(data[0])<<8 | SignatureScheme(data[1]) - data = data[2:] - } - } - - if len(data) < 2 { - return false - } - casLength := uint16(data[0])<<8 | uint16(data[1]) - data = data[2:] - if len(data) < int(casLength) { - return false - } - cas := make([]byte, casLength) - copy(cas, data) - data = data[casLength:] - - m.certificateAuthorities = nil - for len(cas) > 0 { - if len(cas) < 2 { - return false - } - caLen := uint16(cas[0])<<8 | uint16(cas[1]) - cas = cas[2:] - - if len(cas) < int(caLen) { - return false - } - - m.certificateAuthorities = append(m.certificateAuthorities, cas[:caLen]) - cas = cas[caLen:] - } - - return len(data) == 0 -} - -type certificateVerifyMsg struct { - raw []byte - hasSignatureAlgorithm bool // format change introduced in TLS 1.2 - signatureAlgorithm SignatureScheme - signature []byte -} - -func (m *certificateVerifyMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - var b cryptobyte.Builder - b.AddUint8(typeCertificateVerify) - b.AddUint24LengthPrefixed(func(b *cryptobyte.Builder) { - if m.hasSignatureAlgorithm { - b.AddUint16(uint16(m.signatureAlgorithm)) - } - b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.signature) - }) - }) - - m.raw = b.BytesOrPanic() - return m.raw -} - -func (m *certificateVerifyMsg) unmarshal(data []byte) bool { - m.raw = data - s := cryptobyte.String(data) - - if !s.Skip(4) { // message type and uint24 length field - return false - } - if m.hasSignatureAlgorithm { - if !s.ReadUint16((*uint16)(&m.signatureAlgorithm)) { - return false - } - } - return readUint16LengthPrefixed(&s, &m.signature) && s.Empty() -} - -type newSessionTicketMsg struct { - raw []byte - ticket []byte -} - -func (m *newSessionTicketMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - // See RFC 5077, Section 3.3. - ticketLen := len(m.ticket) - length := 2 + 4 + ticketLen - x = make([]byte, 4+length) - x[0] = typeNewSessionTicket - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - x[8] = uint8(ticketLen >> 8) - x[9] = uint8(ticketLen) - copy(x[10:], m.ticket) - - m.raw = x - - return -} - -func (m *newSessionTicketMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 10 { - return false - } - - length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) - if uint32(len(data))-4 != length { - return false - } - - ticketLen := int(data[8])<<8 + int(data[9]) - if len(data)-10 != ticketLen { - return false - } - - m.ticket = data[10:] - - return true -} - -type helloRequestMsg struct { -} - -func (*helloRequestMsg) marshal() []byte { - return []byte{typeHelloRequest, 0, 0, 0} -} - -func (*helloRequestMsg) unmarshal(data []byte) bool { - return len(data) == 4 -} diff --git a/vendor/github.com/marten-seemann/qtls/handshake_server.go b/vendor/github.com/marten-seemann/qtls/handshake_server.go deleted file mode 100644 index 2f3b4144..00000000 --- a/vendor/github.com/marten-seemann/qtls/handshake_server.go +++ /dev/null @@ -1,822 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - "sync/atomic" -) - -// serverHandshakeState contains details of a server handshake in progress. -// It's discarded once the handshake has completed. -type serverHandshakeState struct { - c *Conn - clientHello *clientHelloMsg - hello *serverHelloMsg - suite *cipherSuite - ellipticOk bool - ecdsaOk bool - rsaDecryptOk bool - rsaSignOk bool - sessionState *sessionState - finishedHash finishedHash - masterSecret []byte - cert *Certificate -} - -// serverHandshake performs a TLS handshake as a server. -func (c *Conn) serverHandshake() error { - // If this is the first server handshake, we generate a random key to - // encrypt the tickets with. - c.config.serverInitOnce.Do(func() { c.config.serverInit(nil) }) - c.setAlternativeRecordLayer() - - clientHello, err := c.readClientHello() - if err != nil { - return err - } - - if c.vers == VersionTLS13 { - hs := serverHandshakeStateTLS13{ - c: c, - clientHello: clientHello, - } - return hs.handshake() - } - - hs := serverHandshakeState{ - c: c, - clientHello: clientHello, - } - return hs.handshake() -} - -func (hs *serverHandshakeState) handshake() error { - c := hs.c - - if err := hs.processClientHello(); err != nil { - return err - } - - // For an overview of TLS handshaking, see RFC 5246, Section 7.3. - c.buffering = true - if hs.checkForResumption() { - // The client has included a session ticket and so we do an abbreviated handshake. - if err := hs.doResumeHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - // ticketSupported is set in a resumption handshake if the - // ticket from the client was encrypted with an old session - // ticket key and thus a refreshed ticket should be sent. - if hs.hello.ticketSupported { - if err := hs.sendSessionTicket(); err != nil { - return err - } - } - if err := hs.sendFinished(c.serverFinished[:]); err != nil { - return err - } - if _, err := c.flush(); err != nil { - return err - } - c.clientFinishedIsFirst = false - if err := hs.readFinished(nil); err != nil { - return err - } - c.didResume = true - } else { - // The client didn't include a session ticket, or it wasn't - // valid so we do a full handshake. - if err := hs.pickCipherSuite(); err != nil { - return err - } - if err := hs.doFullHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.readFinished(c.clientFinished[:]); err != nil { - return err - } - c.clientFinishedIsFirst = true - c.buffering = true - if err := hs.sendSessionTicket(); err != nil { - return err - } - if err := hs.sendFinished(nil); err != nil { - return err - } - if _, err := c.flush(); err != nil { - return err - } - } - - c.ekm = ekmFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random) - atomic.StoreUint32(&c.handshakeStatus, 1) - - return nil -} - -// readClientHello reads a ClientHello message and selects the protocol version. -func (c *Conn) readClientHello() (*clientHelloMsg, error) { - msg, err := c.readHandshake() - if err != nil { - return nil, err - } - clientHello, ok := msg.(*clientHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return nil, unexpectedMessageError(clientHello, msg) - } - - if c.config.GetConfigForClient != nil { - chi := clientHelloInfo(c, clientHello) - if newConfig, err := c.config.GetConfigForClient(chi); err != nil { - c.sendAlert(alertInternalError) - return nil, err - } else if newConfig != nil { - newConfig.serverInitOnce.Do(func() { newConfig.serverInit(c.config) }) - c.config = newConfig - } - } - - clientVersions := clientHello.supportedVersions - if len(clientHello.supportedVersions) == 0 { - clientVersions = supportedVersionsFromMax(clientHello.vers) - } - c.vers, ok = c.config.mutualVersion(false, clientVersions) - if !ok { - c.sendAlert(alertProtocolVersion) - return nil, fmt.Errorf("tls: client offered only unsupported versions: %x", clientVersions) - } - c.haveVers = true - c.in.version = c.vers - c.out.version = c.vers - - return clientHello, nil -} - -func (hs *serverHandshakeState) processClientHello() error { - c := hs.c - - hs.hello = new(serverHelloMsg) - hs.hello.vers = c.vers - - supportedCurve := false - preferredCurves := c.config.curvePreferences() -Curves: - for _, curve := range hs.clientHello.supportedCurves { - for _, supported := range preferredCurves { - if supported == curve { - supportedCurve = true - break Curves - } - } - } - - supportedPointFormat := false - for _, pointFormat := range hs.clientHello.supportedPoints { - if pointFormat == pointFormatUncompressed { - supportedPointFormat = true - break - } - } - hs.ellipticOk = supportedCurve && supportedPointFormat - - foundCompression := false - // We only support null compression, so check that the client offered it. - for _, compression := range hs.clientHello.compressionMethods { - if compression == compressionNone { - foundCompression = true - break - } - } - - if !foundCompression { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: client does not support uncompressed connections") - } - - hs.hello.random = make([]byte, 32) - serverRandom := hs.hello.random - // Downgrade protection canaries. See RFC 8446, Section 4.1.3. - maxVers := c.config.maxSupportedVersion(false) - if maxVers >= VersionTLS12 && c.vers < maxVers { - if c.vers == VersionTLS12 { - copy(serverRandom[24:], downgradeCanaryTLS12) - } else { - copy(serverRandom[24:], downgradeCanaryTLS11) - } - serverRandom = serverRandom[:24] - } - _, err := io.ReadFull(c.config.rand(), serverRandom) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - if len(hs.clientHello.secureRenegotiation) != 0 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: initial handshake had non-empty renegotiation extension") - } - - hs.hello.secureRenegotiationSupported = hs.clientHello.secureRenegotiationSupported - hs.hello.compressionMethod = compressionNone - if len(hs.clientHello.serverName) > 0 { - c.serverName = hs.clientHello.serverName - } - - if len(hs.clientHello.alpnProtocols) > 0 { - if selectedProto, fallback := mutualProtocol(hs.clientHello.alpnProtocols, c.config.NextProtos); !fallback { - hs.hello.alpnProtocol = selectedProto - c.clientProtocol = selectedProto - } - } else { - // Although sending an empty NPN extension is reasonable, Firefox has - // had a bug around this. Best to send nothing at all if - // c.config.NextProtos is empty. See - // https://golang.org/issue/5445. - if hs.clientHello.nextProtoNeg && len(c.config.NextProtos) > 0 { - hs.hello.nextProtoNeg = true - hs.hello.nextProtos = c.config.NextProtos - } - } - - hs.cert, err = c.config.getCertificate(clientHelloInfo(c, hs.clientHello)) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - if hs.clientHello.scts { - hs.hello.scts = hs.cert.SignedCertificateTimestamps - } - - if priv, ok := hs.cert.PrivateKey.(crypto.Signer); ok { - switch priv.Public().(type) { - case *ecdsa.PublicKey: - hs.ecdsaOk = true - case *rsa.PublicKey: - hs.rsaSignOk = true - default: - c.sendAlert(alertInternalError) - return fmt.Errorf("tls: unsupported signing key type (%T)", priv.Public()) - } - } - if priv, ok := hs.cert.PrivateKey.(crypto.Decrypter); ok { - switch priv.Public().(type) { - case *rsa.PublicKey: - hs.rsaDecryptOk = true - default: - c.sendAlert(alertInternalError) - return fmt.Errorf("tls: unsupported decryption key type (%T)", priv.Public()) - } - } - - return nil -} - -func (hs *serverHandshakeState) pickCipherSuite() error { - c := hs.c - - var preferenceList, supportedList []uint16 - if c.config.PreferServerCipherSuites { - preferenceList = c.config.cipherSuites() - supportedList = hs.clientHello.cipherSuites - } else { - preferenceList = hs.clientHello.cipherSuites - supportedList = c.config.cipherSuites() - } - - for _, id := range preferenceList { - if hs.setCipherSuite(id, supportedList, c.vers) { - break - } - } - - if hs.suite == nil { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: no cipher suite supported by both client and server") - } - - for _, id := range hs.clientHello.cipherSuites { - if id == TLS_FALLBACK_SCSV { - // The client is doing a fallback connection. See RFC 7507. - if hs.clientHello.vers < c.config.maxSupportedVersion(false) { - c.sendAlert(alertInappropriateFallback) - return errors.New("tls: client using inappropriate protocol fallback") - } - break - } - } - - return nil -} - -// checkForResumption reports whether we should perform resumption on this connection. -func (hs *serverHandshakeState) checkForResumption() bool { - c := hs.c - - if c.config.SessionTicketsDisabled { - return false - } - - plaintext, usedOldKey := c.decryptTicket(hs.clientHello.sessionTicket) - if plaintext == nil { - return false - } - hs.sessionState = &sessionState{usedOldKey: usedOldKey} - ok := hs.sessionState.unmarshal(plaintext) - if !ok { - return false - } - - // Never resume a session for a different TLS version. - if c.vers != hs.sessionState.vers { - return false - } - - cipherSuiteOk := false - // Check that the client is still offering the ciphersuite in the session. - for _, id := range hs.clientHello.cipherSuites { - if id == hs.sessionState.cipherSuite { - cipherSuiteOk = true - break - } - } - if !cipherSuiteOk { - return false - } - - // Check that we also support the ciphersuite from the session. - if !hs.setCipherSuite(hs.sessionState.cipherSuite, c.config.cipherSuites(), hs.sessionState.vers) { - return false - } - - sessionHasClientCerts := len(hs.sessionState.certificates) != 0 - needClientCerts := requiresClientCert(c.config.ClientAuth) - if needClientCerts && !sessionHasClientCerts { - return false - } - if sessionHasClientCerts && c.config.ClientAuth == NoClientCert { - return false - } - - return true -} - -func (hs *serverHandshakeState) doResumeHandshake() error { - c := hs.c - - hs.hello.cipherSuite = hs.suite.id - // We echo the client's session ID in the ServerHello to let it know - // that we're doing a resumption. - hs.hello.sessionId = hs.clientHello.sessionId - hs.hello.ticketSupported = hs.sessionState.usedOldKey - hs.finishedHash = newFinishedHash(c.vers, hs.suite) - hs.finishedHash.discardHandshakeBuffer() - hs.finishedHash.Write(hs.clientHello.marshal()) - hs.finishedHash.Write(hs.hello.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, hs.hello.marshal()); err != nil { - return err - } - - if err := c.processCertsFromClient(Certificate{ - Certificate: hs.sessionState.certificates, - }); err != nil { - return err - } - - hs.masterSecret = hs.sessionState.masterSecret - - return nil -} - -func (hs *serverHandshakeState) doFullHandshake() error { - c := hs.c - - if hs.clientHello.ocspStapling && len(hs.cert.OCSPStaple) > 0 { - hs.hello.ocspStapling = true - } - - hs.hello.ticketSupported = hs.clientHello.ticketSupported && !c.config.SessionTicketsDisabled - hs.hello.cipherSuite = hs.suite.id - - hs.finishedHash = newFinishedHash(hs.c.vers, hs.suite) - if c.config.ClientAuth == NoClientCert { - // No need to keep a full record of the handshake if client - // certificates won't be used. - hs.finishedHash.discardHandshakeBuffer() - } - hs.finishedHash.Write(hs.clientHello.marshal()) - hs.finishedHash.Write(hs.hello.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, hs.hello.marshal()); err != nil { - return err - } - - certMsg := new(certificateMsg) - certMsg.certificates = hs.cert.Certificate - hs.finishedHash.Write(certMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certMsg.marshal()); err != nil { - return err - } - - if hs.hello.ocspStapling { - certStatus := new(certificateStatusMsg) - certStatus.response = hs.cert.OCSPStaple - hs.finishedHash.Write(certStatus.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certStatus.marshal()); err != nil { - return err - } - } - - keyAgreement := hs.suite.ka(c.vers) - skx, err := keyAgreement.generateServerKeyExchange(c.config, hs.cert, hs.clientHello, hs.hello) - if err != nil { - c.sendAlert(alertHandshakeFailure) - return err - } - if skx != nil { - hs.finishedHash.Write(skx.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, skx.marshal()); err != nil { - return err - } - } - - if c.config.ClientAuth >= RequestClientCert { - // Request a client certificate - certReq := new(certificateRequestMsg) - certReq.certificateTypes = []byte{ - byte(certTypeRSASign), - byte(certTypeECDSASign), - } - if c.vers >= VersionTLS12 { - certReq.hasSignatureAlgorithm = true - certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithmsTLS12 - } - - // An empty list of certificateAuthorities signals to - // the client that it may send any certificate in response - // to our request. When we know the CAs we trust, then - // we can send them down, so that the client can choose - // an appropriate certificate to give to us. - if c.config.ClientCAs != nil { - certReq.certificateAuthorities = c.config.ClientCAs.Subjects() - } - hs.finishedHash.Write(certReq.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certReq.marshal()); err != nil { - return err - } - } - - helloDone := new(serverHelloDoneMsg) - hs.finishedHash.Write(helloDone.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, helloDone.marshal()); err != nil { - return err - } - - if _, err := c.flush(); err != nil { - return err - } - - var pub crypto.PublicKey // public key for client auth, if any - - msg, err := c.readHandshake() - if err != nil { - return err - } - - // If we requested a client certificate, then the client must send a - // certificate message, even if it's empty. - if c.config.ClientAuth >= RequestClientCert { - certMsg, ok := msg.(*certificateMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - hs.finishedHash.Write(certMsg.marshal()) - - if err := c.processCertsFromClient(Certificate{ - Certificate: certMsg.certificates, - }); err != nil { - return err - } - if len(certMsg.certificates) != 0 { - pub = c.peerCertificates[0].PublicKey - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - // Get client key exchange - ckx, ok := msg.(*clientKeyExchangeMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(ckx, msg) - } - hs.finishedHash.Write(ckx.marshal()) - - preMasterSecret, err := keyAgreement.processClientKeyExchange(c.config, hs.cert, ckx, c.vers) - if err != nil { - c.sendAlert(alertHandshakeFailure) - return err - } - hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.clientHello.random, hs.hello.random) - if err := c.config.writeKeyLog(keyLogLabelTLS12, hs.clientHello.random, hs.masterSecret); err != nil { - c.sendAlert(alertInternalError) - return err - } - - // If we received a client cert in response to our certificate request message, - // the client will send us a certificateVerifyMsg immediately after the - // clientKeyExchangeMsg. This message is a digest of all preceding - // handshake-layer messages that is signed using the private key corresponding - // to the client's certificate. This allows us to verify that the client is in - // possession of the private key of the certificate. - if len(c.peerCertificates) > 0 { - msg, err = c.readHandshake() - if err != nil { - return err - } - certVerify, ok := msg.(*certificateVerifyMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certVerify, msg) - } - - // Determine the signature type. - _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithmsTLS12, c.vers) - if err != nil { - c.sendAlert(alertIllegalParameter) - return err - } - - var digest []byte - if digest, err = hs.finishedHash.hashForClientCertificate(sigType, hashFunc, hs.masterSecret); err == nil { - err = verifyHandshakeSignature(sigType, pub, hashFunc, digest, certVerify.signature) - } - if err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: could not validate signature of connection nonces: " + err.Error()) - } - - hs.finishedHash.Write(certVerify.marshal()) - } - - hs.finishedHash.discardHandshakeBuffer() - - return nil -} - -func (hs *serverHandshakeState) establishKeys() error { - c := hs.c - - clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := - keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) - - var clientCipher, serverCipher interface{} - var clientHash, serverHash macFunction - - if hs.suite.aead == nil { - clientCipher = hs.suite.cipher(clientKey, clientIV, true /* for reading */) - clientHash = hs.suite.mac(c.vers, clientMAC) - serverCipher = hs.suite.cipher(serverKey, serverIV, false /* not for reading */) - serverHash = hs.suite.mac(c.vers, serverMAC) - } else { - clientCipher = hs.suite.aead(clientKey, clientIV) - serverCipher = hs.suite.aead(serverKey, serverIV) - } - - c.in.prepareCipherSpec(c.vers, clientCipher, clientHash) - c.out.prepareCipherSpec(c.vers, serverCipher, serverHash) - - return nil -} - -func (hs *serverHandshakeState) readFinished(out []byte) error { - c := hs.c - - if err := c.readChangeCipherSpec(); err != nil { - return err - } - - if hs.hello.nextProtoNeg { - msg, err := c.readHandshake() - if err != nil { - return err - } - nextProto, ok := msg.(*nextProtoMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(nextProto, msg) - } - hs.finishedHash.Write(nextProto.marshal()) - c.clientProtocol = nextProto.proto - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - clientFinished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(clientFinished, msg) - } - - verify := hs.finishedHash.clientSum(hs.masterSecret) - if len(verify) != len(clientFinished.verifyData) || - subtle.ConstantTimeCompare(verify, clientFinished.verifyData) != 1 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: client's Finished message is incorrect") - } - - hs.finishedHash.Write(clientFinished.marshal()) - copy(out, verify) - return nil -} - -func (hs *serverHandshakeState) sendSessionTicket() error { - if !hs.hello.ticketSupported { - return nil - } - - c := hs.c - m := new(newSessionTicketMsg) - - var certsFromClient [][]byte - for _, cert := range c.peerCertificates { - certsFromClient = append(certsFromClient, cert.Raw) - } - state := sessionState{ - vers: c.vers, - cipherSuite: hs.suite.id, - masterSecret: hs.masterSecret, - certificates: certsFromClient, - } - var err error - m.ticket, err = c.encryptTicket(state.marshal()) - if err != nil { - return err - } - - hs.finishedHash.Write(m.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, m.marshal()); err != nil { - return err - } - - return nil -} - -func (hs *serverHandshakeState) sendFinished(out []byte) error { - c := hs.c - - if _, err := c.writeRecord(recordTypeChangeCipherSpec, []byte{1}); err != nil { - return err - } - - finished := new(finishedMsg) - finished.verifyData = hs.finishedHash.serverSum(hs.masterSecret) - hs.finishedHash.Write(finished.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, finished.marshal()); err != nil { - return err - } - - c.cipherSuite = hs.suite.id - copy(out, finished.verifyData) - - return nil -} - -// processCertsFromClient takes a chain of client certificates either from a -// Certificates message or from a sessionState and verifies them. It returns -// the public key of the leaf certificate. -func (c *Conn) processCertsFromClient(certificate Certificate) error { - certificates := certificate.Certificate - certs := make([]*x509.Certificate, len(certificates)) - var err error - for i, asn1Data := range certificates { - if certs[i], err = x509.ParseCertificate(asn1Data); err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: failed to parse client certificate: " + err.Error()) - } - } - - if len(certs) == 0 && requiresClientCert(c.config.ClientAuth) { - c.sendAlert(alertBadCertificate) - return errors.New("tls: client didn't provide a certificate") - } - - if c.config.ClientAuth >= VerifyClientCertIfGiven && len(certs) > 0 { - opts := x509.VerifyOptions{ - Roots: c.config.ClientCAs, - CurrentTime: c.config.time(), - Intermediates: x509.NewCertPool(), - KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, - } - - for _, cert := range certs[1:] { - opts.Intermediates.AddCert(cert) - } - - chains, err := certs[0].Verify(opts) - if err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: failed to verify client's certificate: " + err.Error()) - } - - c.verifiedChains = chains - } - - if c.config.VerifyPeerCertificate != nil { - if err := c.config.VerifyPeerCertificate(certificates, c.verifiedChains); err != nil { - c.sendAlert(alertBadCertificate) - return err - } - } - - if len(certs) == 0 { - return nil - } - - switch certs[0].PublicKey.(type) { - case *ecdsa.PublicKey, *rsa.PublicKey: - default: - c.sendAlert(alertUnsupportedCertificate) - return fmt.Errorf("tls: client's certificate contains an unsupported public key of type %T", certs[0].PublicKey) - } - - c.peerCertificates = certs - c.ocspResponse = certificate.OCSPStaple - c.scts = certificate.SignedCertificateTimestamps - return nil -} - -// setCipherSuite sets a cipherSuite with the given id as the serverHandshakeState -// suite if that cipher suite is acceptable to use. -// It returns a bool indicating if the suite was set. -func (hs *serverHandshakeState) setCipherSuite(id uint16, supportedCipherSuites []uint16, version uint16) bool { - for _, supported := range supportedCipherSuites { - if id == supported { - candidate := cipherSuiteByID(id) - if candidate == nil { - continue - } - // Don't select a ciphersuite which we can't - // support for this client. - if candidate.flags&suiteECDHE != 0 { - if !hs.ellipticOk { - continue - } - if candidate.flags&suiteECDSA != 0 { - if !hs.ecdsaOk { - continue - } - } else if !hs.rsaSignOk { - continue - } - } else if !hs.rsaDecryptOk { - continue - } - if version < VersionTLS12 && candidate.flags&suiteTLS12 != 0 { - continue - } - hs.suite = candidate - return true - } - } - return false -} - -func clientHelloInfo(c *Conn, clientHello *clientHelloMsg) *ClientHelloInfo { - supportedVersions := clientHello.supportedVersions - if len(clientHello.supportedVersions) == 0 { - supportedVersions = supportedVersionsFromMax(clientHello.vers) - } - - return &ClientHelloInfo{ - CipherSuites: clientHello.cipherSuites, - ServerName: clientHello.serverName, - SupportedCurves: clientHello.supportedCurves, - SupportedPoints: clientHello.supportedPoints, - SignatureSchemes: clientHello.supportedSignatureAlgorithms, - SupportedProtos: clientHello.alpnProtocols, - SupportedVersions: supportedVersions, - Conn: c.conn, - } -} diff --git a/vendor/github.com/marten-seemann/qtls/handshake_server_tls13.go b/vendor/github.com/marten-seemann/qtls/handshake_server_tls13.go deleted file mode 100644 index c7cce068..00000000 --- a/vendor/github.com/marten-seemann/qtls/handshake_server_tls13.go +++ /dev/null @@ -1,876 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "bytes" - "crypto" - "crypto/hmac" - "crypto/rsa" - "errors" - "hash" - "io" - "sync/atomic" - "time" -) - -// maxClientPSKIdentities is the number of client PSK identities the server will -// attempt to validate. It will ignore the rest not to let cheap ClientHello -// messages cause too much work in session ticket decryption attempts. -const maxClientPSKIdentities = 5 - -type serverHandshakeStateTLS13 struct { - c *Conn - clientHello *clientHelloMsg - hello *serverHelloMsg - sentDummyCCS bool - usingPSK bool - suite *cipherSuiteTLS13 - cert *Certificate - sigAlg SignatureScheme - earlySecret []byte - sharedKey []byte - handshakeSecret []byte - masterSecret []byte - trafficSecret []byte // client_application_traffic_secret_0 - transcript hash.Hash - clientFinished []byte -} - -func (hs *serverHandshakeStateTLS13) handshake() error { - c := hs.c - - // For an overview of the TLS 1.3 handshake, see RFC 8446, Section 2. - if err := hs.processClientHello(); err != nil { - return err - } - if err := hs.checkForResumption(); err != nil { - return err - } - if err := hs.pickCertificate(); err != nil { - return err - } - c.buffering = true - if err := hs.sendServerParameters(); err != nil { - return err - } - if err := hs.sendServerCertificate(); err != nil { - return err - } - if err := hs.sendServerFinished(); err != nil { - return err - } - // Note that at this point we could start sending application data without - // waiting for the client's second flight, but the application might not - // expect the lack of replay protection of the ClientHello parameters. - if _, err := c.flush(); err != nil { - return err - } - if err := hs.readClientCertificate(); err != nil { - return err - } - if err := hs.readClientFinished(); err != nil { - return err - } - - atomic.StoreUint32(&c.handshakeStatus, 1) - - return nil -} - -func (hs *serverHandshakeStateTLS13) processClientHello() error { - c := hs.c - - hs.hello = new(serverHelloMsg) - - // TLS 1.3 froze the ServerHello.legacy_version field, and uses - // supported_versions instead. See RFC 8446, sections 4.1.3 and 4.2.1. - hs.hello.vers = VersionTLS12 - hs.hello.supportedVersion = c.vers - - if len(hs.clientHello.supportedVersions) == 0 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: client used the legacy version field to negotiate TLS 1.3") - } - - // Abort if the client is doing a fallback and landing lower than what we - // support. See RFC 7507, which however does not specify the interaction - // with supported_versions. The only difference is that with - // supported_versions a client has a chance to attempt a [TLS 1.2, TLS 1.4] - // handshake in case TLS 1.3 is broken but 1.2 is not. Alas, in that case, - // it will have to drop the TLS_FALLBACK_SCSV protection if it falls back to - // TLS 1.2, because a TLS 1.3 server would abort here. The situation before - // supported_versions was not better because there was just no way to do a - // TLS 1.4 handshake without risking the server selecting TLS 1.3. - for _, id := range hs.clientHello.cipherSuites { - if id == TLS_FALLBACK_SCSV { - // Use c.vers instead of max(supported_versions) because an attacker - // could defeat this by adding an arbitrary high version otherwise. - if c.vers < c.config.maxSupportedVersion(false) { - c.sendAlert(alertInappropriateFallback) - return errors.New("tls: client using inappropriate protocol fallback") - } - break - } - } - - if len(hs.clientHello.compressionMethods) != 1 || - hs.clientHello.compressionMethods[0] != compressionNone { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: TLS 1.3 client supports illegal compression methods") - } - - hs.hello.random = make([]byte, 32) - if _, err := io.ReadFull(c.config.rand(), hs.hello.random); err != nil { - c.sendAlert(alertInternalError) - return err - } - - if len(hs.clientHello.secureRenegotiation) != 0 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: initial handshake had non-empty renegotiation extension") - } - - if hs.clientHello.earlyData { - // See RFC 8446, Section 4.2.10 for the complicated behavior required - // here. The scenario is that a different server at our address offered - // to accept early data in the past, which we can't handle. For now, all - // 0-RTT enabled session tickets need to expire before a Go server can - // replace a server or join a pool. That's the same requirement that - // applies to mixing or replacing with any TLS 1.2 server. - c.sendAlert(alertUnsupportedExtension) - return errors.New("tls: client sent unexpected early data") - } - - hs.hello.sessionId = hs.clientHello.sessionId - hs.hello.compressionMethod = compressionNone - - var preferenceList, supportedList []uint16 - if c.config.PreferServerCipherSuites { - preferenceList = defaultCipherSuitesTLS13() - supportedList = hs.clientHello.cipherSuites - } else { - preferenceList = hs.clientHello.cipherSuites - supportedList = defaultCipherSuitesTLS13() - } - for _, suiteID := range preferenceList { - hs.suite = mutualCipherSuiteTLS13(supportedList, suiteID) - if hs.suite != nil { - break - } - } - if hs.suite == nil { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: no cipher suite supported by both client and server") - } - c.cipherSuite = hs.suite.id - hs.hello.cipherSuite = hs.suite.id - hs.transcript = hs.suite.hash.New() - - // Pick the ECDHE group in server preference order, but give priority to - // groups with a key share, to avoid a HelloRetryRequest round-trip. - var selectedGroup CurveID - var clientKeyShare *keyShare -GroupSelection: - for _, preferredGroup := range c.config.curvePreferences() { - for _, ks := range hs.clientHello.keyShares { - if ks.group == preferredGroup { - selectedGroup = ks.group - clientKeyShare = &ks - break GroupSelection - } - } - if selectedGroup != 0 { - continue - } - for _, group := range hs.clientHello.supportedCurves { - if group == preferredGroup { - selectedGroup = group - break - } - } - } - if selectedGroup == 0 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: no ECDHE curve supported by both client and server") - } - if clientKeyShare == nil { - if err := hs.doHelloRetryRequest(selectedGroup); err != nil { - return err - } - clientKeyShare = &hs.clientHello.keyShares[0] - } - - if _, ok := curveForCurveID(selectedGroup); selectedGroup != X25519 && !ok { - c.sendAlert(alertInternalError) - return errors.New("tls: CurvePreferences includes unsupported curve") - } - params, err := generateECDHEParameters(c.config.rand(), selectedGroup) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - hs.hello.serverShare = keyShare{group: selectedGroup, data: params.PublicKey()} - hs.sharedKey = params.SharedKey(clientKeyShare.data) - if hs.sharedKey == nil { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid client key share") - } - - c.serverName = hs.clientHello.serverName - - if c.config.ReceivedExtensions != nil { - c.config.ReceivedExtensions(typeClientHello, hs.clientHello.additionalExtensions) - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) checkForResumption() error { - c := hs.c - - if c.config.SessionTicketsDisabled { - return nil - } - - modeOK := false - for _, mode := range hs.clientHello.pskModes { - if mode == pskModeDHE { - modeOK = true - break - } - } - if !modeOK { - return nil - } - - if len(hs.clientHello.pskIdentities) != len(hs.clientHello.pskBinders) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid or missing PSK binders") - } - if len(hs.clientHello.pskIdentities) == 0 { - return nil - } - - for i, identity := range hs.clientHello.pskIdentities { - if i >= maxClientPSKIdentities { - break - } - - plaintext, _ := c.decryptTicket(identity.label) - if plaintext == nil { - continue - } - sessionState := new(sessionStateTLS13) - if ok := sessionState.unmarshal(plaintext); !ok { - continue - } - - createdAt := time.Unix(int64(sessionState.createdAt), 0) - if c.config.time().Sub(createdAt) > maxSessionTicketLifetime { - continue - } - - // We don't check the obfuscated ticket age because it's affected by - // clock skew and it's only a freshness signal useful for shrinking the - // window for replay attacks, which don't affect us as we don't do 0-RTT. - - pskSuite := cipherSuiteTLS13ByID(sessionState.cipherSuite) - if pskSuite == nil || pskSuite.hash != hs.suite.hash { - continue - } - - // PSK connections don't re-establish client certificates, but carry - // them over in the session ticket. Ensure the presence of client certs - // in the ticket is consistent with the configured requirements. - sessionHasClientCerts := len(sessionState.certificate.Certificate) != 0 - needClientCerts := requiresClientCert(c.config.ClientAuth) - if needClientCerts && !sessionHasClientCerts { - continue - } - if sessionHasClientCerts && c.config.ClientAuth == NoClientCert { - continue - } - - psk := hs.suite.expandLabel(sessionState.resumptionSecret, "resumption", - nil, hs.suite.hash.Size()) - hs.earlySecret = hs.suite.extract(psk, nil) - binderKey := hs.suite.deriveSecret(hs.earlySecret, resumptionBinderLabel, nil) - // Clone the transcript in case a HelloRetryRequest was recorded. - transcript := cloneHash(hs.transcript, hs.suite.hash) - if transcript == nil { - c.sendAlert(alertInternalError) - return errors.New("tls: internal error: failed to clone hash") - } - transcript.Write(hs.clientHello.marshalWithoutBinders()) - pskBinder := hs.suite.finishedHash(binderKey, transcript) - if !hmac.Equal(hs.clientHello.pskBinders[i], pskBinder) { - c.sendAlert(alertDecryptError) - return errors.New("tls: invalid PSK binder") - } - - if err := c.processCertsFromClient(sessionState.certificate); err != nil { - return err - } - - hs.hello.selectedIdentityPresent = true - hs.hello.selectedIdentity = uint16(i) - hs.usingPSK = true - c.didResume = true - return nil - } - - return nil -} - -// cloneHash uses the encoding.BinaryMarshaler and encoding.BinaryUnmarshaler -// interfaces implemented by standard library hashes to clone the state of in -// to a new instance of h. It returns nil if the operation fails. -func cloneHash(in hash.Hash, h crypto.Hash) hash.Hash { - // Recreate the interface to avoid importing encoding. - type binaryMarshaler interface { - MarshalBinary() (data []byte, err error) - UnmarshalBinary(data []byte) error - } - marshaler, ok := in.(binaryMarshaler) - if !ok { - return nil - } - state, err := marshaler.MarshalBinary() - if err != nil { - return nil - } - out := h.New() - unmarshaler, ok := out.(binaryMarshaler) - if !ok { - return nil - } - if err := unmarshaler.UnmarshalBinary(state); err != nil { - return nil - } - return out -} - -func (hs *serverHandshakeStateTLS13) pickCertificate() error { - c := hs.c - - // Only one of PSK and certificates are used at a time. - if hs.usingPSK { - return nil - } - - // This implements a very simplistic certificate selection strategy for now: - // getCertificate delegates to the application Config.GetCertificate, or - // selects based on the server_name only. If the selected certificate's - // public key does not match the client signature_algorithms, the handshake - // is aborted. No attention is given to signature_algorithms_cert, and it is - // not passed to the application Config.GetCertificate. This will need to - // improve according to RFC 8446, sections 4.4.2.2 and 4.2.3. - certificate, err := c.config.getCertificate(clientHelloInfo(c, hs.clientHello)) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - supportedAlgs := signatureSchemesForCertificate(c.vers, certificate) - if supportedAlgs == nil { - c.sendAlert(alertInternalError) - return unsupportedCertificateError(certificate) - } - // Pick signature scheme in client preference order, as the server - // preference order is not configurable. - for _, preferredAlg := range hs.clientHello.supportedSignatureAlgorithms { - if isSupportedSignatureAlgorithm(preferredAlg, supportedAlgs) { - hs.sigAlg = preferredAlg - break - } - } - if hs.sigAlg == 0 { - // getCertificate returned a certificate incompatible with the - // ClientHello supported signature algorithms. - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: client doesn't support selected certificate") - } - hs.cert = certificate - - return nil -} - -// sendDummyChangeCipherSpec sends a ChangeCipherSpec record for compatibility -// with middleboxes that didn't implement TLS correctly. See RFC 8446, Appendix D.4. -func (hs *serverHandshakeStateTLS13) sendDummyChangeCipherSpec() error { - if hs.sentDummyCCS { - return nil - } - hs.sentDummyCCS = true - - _, err := hs.c.writeRecord(recordTypeChangeCipherSpec, []byte{1}) - return err -} - -func (hs *serverHandshakeStateTLS13) doHelloRetryRequest(selectedGroup CurveID) error { - c := hs.c - - // The first ClientHello gets double-hashed into the transcript upon a - // HelloRetryRequest. See RFC 8446, Section 4.4.1. - hs.transcript.Write(hs.clientHello.marshal()) - chHash := hs.transcript.Sum(nil) - hs.transcript.Reset() - hs.transcript.Write([]byte{typeMessageHash, 0, 0, uint8(len(chHash))}) - hs.transcript.Write(chHash) - - helloRetryRequest := &serverHelloMsg{ - vers: hs.hello.vers, - random: helloRetryRequestRandom, - sessionId: hs.hello.sessionId, - cipherSuite: hs.hello.cipherSuite, - compressionMethod: hs.hello.compressionMethod, - supportedVersion: hs.hello.supportedVersion, - selectedGroup: selectedGroup, - } - - hs.transcript.Write(helloRetryRequest.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, helloRetryRequest.marshal()); err != nil { - return err - } - - if err := hs.sendDummyChangeCipherSpec(); err != nil { - return err - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - - clientHello, ok := msg.(*clientHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(clientHello, msg) - } - - if len(clientHello.keyShares) != 1 || clientHello.keyShares[0].group != selectedGroup { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: client sent invalid key share in second ClientHello") - } - - if clientHello.earlyData { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: client indicated early data in second ClientHello") - } - - if illegalClientHelloChange(clientHello, hs.clientHello) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: client illegally modified second ClientHello") - } - - hs.clientHello = clientHello - return nil -} - -// illegalClientHelloChange reports whether the two ClientHello messages are -// different, with the exception of the changes allowed before and after a -// HelloRetryRequest. See RFC 8446, Section 4.1.2. -func illegalClientHelloChange(ch, ch1 *clientHelloMsg) bool { - if len(ch.supportedVersions) != len(ch1.supportedVersions) || - len(ch.cipherSuites) != len(ch1.cipherSuites) || - len(ch.supportedCurves) != len(ch1.supportedCurves) || - len(ch.supportedSignatureAlgorithms) != len(ch1.supportedSignatureAlgorithms) || - len(ch.supportedSignatureAlgorithmsCert) != len(ch1.supportedSignatureAlgorithmsCert) || - len(ch.alpnProtocols) != len(ch1.alpnProtocols) { - return true - } - for i := range ch.supportedVersions { - if ch.supportedVersions[i] != ch1.supportedVersions[i] { - return true - } - } - for i := range ch.cipherSuites { - if ch.cipherSuites[i] != ch1.cipherSuites[i] { - return true - } - } - for i := range ch.supportedCurves { - if ch.supportedCurves[i] != ch1.supportedCurves[i] { - return true - } - } - for i := range ch.supportedSignatureAlgorithms { - if ch.supportedSignatureAlgorithms[i] != ch1.supportedSignatureAlgorithms[i] { - return true - } - } - for i := range ch.supportedSignatureAlgorithmsCert { - if ch.supportedSignatureAlgorithmsCert[i] != ch1.supportedSignatureAlgorithmsCert[i] { - return true - } - } - for i := range ch.alpnProtocols { - if ch.alpnProtocols[i] != ch1.alpnProtocols[i] { - return true - } - } - return ch.vers != ch1.vers || - !bytes.Equal(ch.random, ch1.random) || - !bytes.Equal(ch.sessionId, ch1.sessionId) || - !bytes.Equal(ch.compressionMethods, ch1.compressionMethods) || - ch.nextProtoNeg != ch1.nextProtoNeg || - ch.serverName != ch1.serverName || - ch.ocspStapling != ch1.ocspStapling || - !bytes.Equal(ch.supportedPoints, ch1.supportedPoints) || - ch.ticketSupported != ch1.ticketSupported || - !bytes.Equal(ch.sessionTicket, ch1.sessionTicket) || - ch.secureRenegotiationSupported != ch1.secureRenegotiationSupported || - !bytes.Equal(ch.secureRenegotiation, ch1.secureRenegotiation) || - ch.scts != ch1.scts || - !bytes.Equal(ch.cookie, ch1.cookie) || - !bytes.Equal(ch.pskModes, ch1.pskModes) -} - -func (hs *serverHandshakeStateTLS13) sendServerParameters() error { - c := hs.c - - hs.transcript.Write(hs.clientHello.marshal()) - hs.transcript.Write(hs.hello.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, hs.hello.marshal()); err != nil { - return err - } - - if err := hs.sendDummyChangeCipherSpec(); err != nil { - return err - } - - earlySecret := hs.earlySecret - if earlySecret == nil { - earlySecret = hs.suite.extract(nil, nil) - } - hs.handshakeSecret = hs.suite.extract(hs.sharedKey, - hs.suite.deriveSecret(earlySecret, "derived", nil)) - - clientSecret := hs.suite.deriveSecret(hs.handshakeSecret, - clientHandshakeTrafficLabel, hs.transcript) - c.in.exportKey(hs.suite, clientSecret) - c.in.setTrafficSecret(hs.suite, clientSecret) - serverSecret := hs.suite.deriveSecret(hs.handshakeSecret, - serverHandshakeTrafficLabel, hs.transcript) - c.out.exportKey(hs.suite, serverSecret) - c.out.setTrafficSecret(hs.suite, serverSecret) - - err := c.config.writeKeyLog(keyLogLabelClientHandshake, hs.clientHello.random, clientSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - err = c.config.writeKeyLog(keyLogLabelServerHandshake, hs.clientHello.random, serverSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - encryptedExtensions := new(encryptedExtensionsMsg) - - if len(hs.clientHello.alpnProtocols) > 0 { - if selectedProto, fallback := mutualProtocol(hs.clientHello.alpnProtocols, c.config.NextProtos); !fallback { - encryptedExtensions.alpnProtocol = selectedProto - c.clientProtocol = selectedProto - } - } - if c.config.EnforceNextProtoSelection && len(c.clientProtocol) == 0 { - c.sendAlert(alertNoApplicationProtocol) - return errors.New("ALPN negotiation failed") - } - if hs.c.config.GetExtensions != nil { - encryptedExtensions.additionalExtensions = hs.c.config.GetExtensions(typeEncryptedExtensions) - } - - hs.transcript.Write(encryptedExtensions.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, encryptedExtensions.marshal()); err != nil { - return err - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) requestClientCert() bool { - return hs.c.config.ClientAuth >= RequestClientCert && !hs.usingPSK -} - -func (hs *serverHandshakeStateTLS13) sendServerCertificate() error { - c := hs.c - - // Only one of PSK and certificates are used at a time. - if hs.usingPSK { - return nil - } - - if hs.requestClientCert() { - // Request a client certificate - certReq := new(certificateRequestMsgTLS13) - certReq.ocspStapling = true - certReq.scts = true - certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms - if c.config.ClientCAs != nil { - certReq.certificateAuthorities = c.config.ClientCAs.Subjects() - } - - hs.transcript.Write(certReq.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certReq.marshal()); err != nil { - return err - } - } - - certMsg := new(certificateMsgTLS13) - - certMsg.certificate = *hs.cert - certMsg.scts = hs.clientHello.scts && len(hs.cert.SignedCertificateTimestamps) > 0 - certMsg.ocspStapling = hs.clientHello.ocspStapling && len(hs.cert.OCSPStaple) > 0 - - hs.transcript.Write(certMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certMsg.marshal()); err != nil { - return err - } - - certVerifyMsg := new(certificateVerifyMsg) - certVerifyMsg.hasSignatureAlgorithm = true - certVerifyMsg.signatureAlgorithm = hs.sigAlg - - sigType := signatureFromSignatureScheme(hs.sigAlg) - sigHash, err := hashFromSignatureScheme(hs.sigAlg) - if sigType == 0 || err != nil { - return c.sendAlert(alertInternalError) - } - h := sigHash.New() - writeSignedMessage(h, serverSignatureContext, hs.transcript) - - signOpts := crypto.SignerOpts(sigHash) - if sigType == signatureRSAPSS { - signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: sigHash} - } - sig, err := hs.cert.PrivateKey.(crypto.Signer).Sign(c.config.rand(), h.Sum(nil), signOpts) - if err != nil { - public := hs.cert.PrivateKey.(crypto.Signer).Public() - if rsaKey, ok := public.(*rsa.PublicKey); ok && sigType == signatureRSAPSS && - rsaKey.N.BitLen()/8 < sigHash.Size()*2+2 { // key too small for RSA-PSS - c.sendAlert(alertHandshakeFailure) - } else { - c.sendAlert(alertInternalError) - } - return errors.New("tls: failed to sign handshake: " + err.Error()) - } - certVerifyMsg.signature = sig - - hs.transcript.Write(certVerifyMsg.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, certVerifyMsg.marshal()); err != nil { - return err - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) sendServerFinished() error { - c := hs.c - - finished := &finishedMsg{ - verifyData: hs.suite.finishedHash(c.out.trafficSecret, hs.transcript), - } - - hs.transcript.Write(finished.marshal()) - if _, err := c.writeRecord(recordTypeHandshake, finished.marshal()); err != nil { - return err - } - - // Derive secrets that take context through the server Finished. - - hs.masterSecret = hs.suite.extract(nil, - hs.suite.deriveSecret(hs.handshakeSecret, "derived", nil)) - - hs.trafficSecret = hs.suite.deriveSecret(hs.masterSecret, - clientApplicationTrafficLabel, hs.transcript) - serverSecret := hs.suite.deriveSecret(hs.masterSecret, - serverApplicationTrafficLabel, hs.transcript) - c.out.exportKey(hs.suite, serverSecret) - c.out.setTrafficSecret(hs.suite, serverSecret) - - err := c.config.writeKeyLog(keyLogLabelClientTraffic, hs.clientHello.random, hs.trafficSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - err = c.config.writeKeyLog(keyLogLabelServerTraffic, hs.clientHello.random, serverSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - c.ekm = hs.suite.exportKeyingMaterial(hs.masterSecret, hs.transcript) - - // If we did not request client certificates, at this point we can - // precompute the client finished and roll the transcript forward to send - // session tickets in our first flight. - if !hs.requestClientCert() { - if err := hs.sendSessionTickets(); err != nil { - return err - } - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) shouldSendSessionTickets() bool { - if hs.c.config.SessionTicketsDisabled { - return false - } - - // Don't send tickets the client wouldn't use. See RFC 8446, Section 4.2.9. - for _, pskMode := range hs.clientHello.pskModes { - if pskMode == pskModeDHE { - return true - } - } - return false -} - -func (hs *serverHandshakeStateTLS13) sendSessionTickets() error { - c := hs.c - - hs.clientFinished = hs.suite.finishedHash(c.in.trafficSecret, hs.transcript) - finishedMsg := &finishedMsg{ - verifyData: hs.clientFinished, - } - hs.transcript.Write(finishedMsg.marshal()) - - if !hs.shouldSendSessionTickets() { - return nil - } - - resumptionSecret := hs.suite.deriveSecret(hs.masterSecret, - resumptionLabel, hs.transcript) - - m := new(newSessionTicketMsgTLS13) - - var certsFromClient [][]byte - for _, cert := range c.peerCertificates { - certsFromClient = append(certsFromClient, cert.Raw) - } - state := sessionStateTLS13{ - cipherSuite: hs.suite.id, - createdAt: uint64(c.config.time().Unix()), - resumptionSecret: resumptionSecret, - certificate: Certificate{ - Certificate: certsFromClient, - OCSPStaple: c.ocspResponse, - SignedCertificateTimestamps: c.scts, - }, - } - var err error - m.label, err = c.encryptTicket(state.marshal()) - if err != nil { - return err - } - m.lifetime = uint32(maxSessionTicketLifetime / time.Second) - - if _, err := c.writeRecord(recordTypeHandshake, m.marshal()); err != nil { - return err - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) readClientCertificate() error { - c := hs.c - - if !hs.requestClientCert() { - return nil - } - - // If we requested a client certificate, then the client must send a - // certificate message. If it's empty, no CertificateVerify is sent. - - msg, err := c.readHandshake() - if err != nil { - return err - } - - certMsg, ok := msg.(*certificateMsgTLS13) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - hs.transcript.Write(certMsg.marshal()) - - if err := c.processCertsFromClient(certMsg.certificate); err != nil { - return err - } - - if len(certMsg.certificate.Certificate) != 0 { - msg, err = c.readHandshake() - if err != nil { - return err - } - - certVerify, ok := msg.(*certificateVerifyMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certVerify, msg) - } - - // See RFC 8446, Section 4.4.3. - if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms) { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid certificate signature algorithm") - } - sigType := signatureFromSignatureScheme(certVerify.signatureAlgorithm) - sigHash, err := hashFromSignatureScheme(certVerify.signatureAlgorithm) - if sigType == 0 || err != nil { - c.sendAlert(alertInternalError) - return err - } - if sigType == signaturePKCS1v15 || sigHash == crypto.SHA1 { - c.sendAlert(alertIllegalParameter) - return errors.New("tls: invalid certificate signature algorithm") - } - h := sigHash.New() - writeSignedMessage(h, clientSignatureContext, hs.transcript) - if err := verifyHandshakeSignature(sigType, c.peerCertificates[0].PublicKey, - sigHash, h.Sum(nil), certVerify.signature); err != nil { - c.sendAlert(alertDecryptError) - return errors.New("tls: invalid certificate signature") - } - - hs.transcript.Write(certVerify.marshal()) - } - - // If we waited until the client certificates to send session tickets, we - // are ready to do it now. - if err := hs.sendSessionTickets(); err != nil { - return err - } - - return nil -} - -func (hs *serverHandshakeStateTLS13) readClientFinished() error { - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return err - } - - finished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(finished, msg) - } - - if !hmac.Equal(hs.clientFinished, finished.verifyData) { - c.sendAlert(alertDecryptError) - return errors.New("tls: invalid client finished hash") - } - - c.in.exportKey(hs.suite, hs.trafficSecret) - c.in.setTrafficSecret(hs.suite, hs.trafficSecret) - - return nil -} diff --git a/vendor/github.com/marten-seemann/qtls/key_agreement.go b/vendor/github.com/marten-seemann/qtls/key_agreement.go deleted file mode 100644 index 477aae4a..00000000 --- a/vendor/github.com/marten-seemann/qtls/key_agreement.go +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/md5" - "crypto/rsa" - "crypto/sha1" - "crypto/x509" - "errors" - "io" -) - -var errClientKeyExchange = errors.New("tls: invalid ClientKeyExchange message") -var errServerKeyExchange = errors.New("tls: invalid ServerKeyExchange message") - -// rsaKeyAgreement implements the standard TLS key agreement where the client -// encrypts the pre-master secret to the server's public key. -type rsaKeyAgreement struct{} - -func (ka rsaKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { - return nil, nil -} - -func (ka rsaKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { - if len(ckx.ciphertext) < 2 { - return nil, errClientKeyExchange - } - - ciphertext := ckx.ciphertext - if version != VersionSSL30 { - ciphertextLen := int(ckx.ciphertext[0])<<8 | int(ckx.ciphertext[1]) - if ciphertextLen != len(ckx.ciphertext)-2 { - return nil, errClientKeyExchange - } - ciphertext = ckx.ciphertext[2:] - } - priv, ok := cert.PrivateKey.(crypto.Decrypter) - if !ok { - return nil, errors.New("tls: certificate private key does not implement crypto.Decrypter") - } - // Perform constant time RSA PKCS#1 v1.5 decryption - preMasterSecret, err := priv.Decrypt(config.rand(), ciphertext, &rsa.PKCS1v15DecryptOptions{SessionKeyLen: 48}) - if err != nil { - return nil, err - } - // We don't check the version number in the premaster secret. For one, - // by checking it, we would leak information about the validity of the - // encrypted pre-master secret. Secondly, it provides only a small - // benefit against a downgrade attack and some implementations send the - // wrong version anyway. See the discussion at the end of section - // 7.4.7.1 of RFC 4346. - return preMasterSecret, nil -} - -func (ka rsaKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { - return errors.New("tls: unexpected ServerKeyExchange") -} - -func (ka rsaKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { - preMasterSecret := make([]byte, 48) - preMasterSecret[0] = byte(clientHello.vers >> 8) - preMasterSecret[1] = byte(clientHello.vers) - _, err := io.ReadFull(config.rand(), preMasterSecret[2:]) - if err != nil { - return nil, nil, err - } - - encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), preMasterSecret) - if err != nil { - return nil, nil, err - } - ckx := new(clientKeyExchangeMsg) - ckx.ciphertext = make([]byte, len(encrypted)+2) - ckx.ciphertext[0] = byte(len(encrypted) >> 8) - ckx.ciphertext[1] = byte(len(encrypted)) - copy(ckx.ciphertext[2:], encrypted) - return preMasterSecret, ckx, nil -} - -// sha1Hash calculates a SHA1 hash over the given byte slices. -func sha1Hash(slices [][]byte) []byte { - hsha1 := sha1.New() - for _, slice := range slices { - hsha1.Write(slice) - } - return hsha1.Sum(nil) -} - -// md5SHA1Hash implements TLS 1.0's hybrid hash function which consists of the -// concatenation of an MD5 and SHA1 hash. -func md5SHA1Hash(slices [][]byte) []byte { - md5sha1 := make([]byte, md5.Size+sha1.Size) - hmd5 := md5.New() - for _, slice := range slices { - hmd5.Write(slice) - } - copy(md5sha1, hmd5.Sum(nil)) - copy(md5sha1[md5.Size:], sha1Hash(slices)) - return md5sha1 -} - -// hashForServerKeyExchange hashes the given slices and returns their digest -// using the given hash function (for >= TLS 1.2) or using a default based on -// the sigType (for earlier TLS versions). -func hashForServerKeyExchange(sigType uint8, hashFunc crypto.Hash, version uint16, slices ...[]byte) ([]byte, error) { - if version >= VersionTLS12 { - h := hashFunc.New() - for _, slice := range slices { - h.Write(slice) - } - digest := h.Sum(nil) - return digest, nil - } - if sigType == signatureECDSA { - return sha1Hash(slices), nil - } - return md5SHA1Hash(slices), nil -} - -// ecdheKeyAgreement implements a TLS key agreement where the server -// generates an ephemeral EC public/private key pair and signs it. The -// pre-master secret is then calculated using ECDH. The signature may -// either be ECDSA or RSA. -type ecdheKeyAgreement struct { - version uint16 - isRSA bool - params ecdheParameters - - // ckx and preMasterSecret are generated in processServerKeyExchange - // and returned in generateClientKeyExchange. - ckx *clientKeyExchangeMsg - preMasterSecret []byte -} - -func (ka *ecdheKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { - preferredCurves := config.curvePreferences() - - var curveID CurveID -NextCandidate: - for _, candidate := range preferredCurves { - for _, c := range clientHello.supportedCurves { - if candidate == c { - curveID = c - break NextCandidate - } - } - } - - if curveID == 0 { - return nil, errors.New("tls: no supported elliptic curves offered") - } - if _, ok := curveForCurveID(curveID); curveID != X25519 && !ok { - return nil, errors.New("tls: CurvePreferences includes unsupported curve") - } - - params, err := generateECDHEParameters(config.rand(), curveID) - if err != nil { - return nil, err - } - ka.params = params - - // See RFC 4492, Section 5.4. - ecdhePublic := params.PublicKey() - serverECDHParams := make([]byte, 1+2+1+len(ecdhePublic)) - serverECDHParams[0] = 3 // named curve - serverECDHParams[1] = byte(curveID >> 8) - serverECDHParams[2] = byte(curveID) - serverECDHParams[3] = byte(len(ecdhePublic)) - copy(serverECDHParams[4:], ecdhePublic) - - priv, ok := cert.PrivateKey.(crypto.Signer) - if !ok { - return nil, errors.New("tls: certificate private key does not implement crypto.Signer") - } - - signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithmsTLS12, ka.version) - if err != nil { - return nil, err - } - if (sigType == signaturePKCS1v15 || sigType == signatureRSAPSS) != ka.isRSA { - return nil, errors.New("tls: certificate cannot be used with the selected cipher suite") - } - - digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, hello.random, serverECDHParams) - if err != nil { - return nil, err - } - - signOpts := crypto.SignerOpts(hashFunc) - if sigType == signatureRSAPSS { - signOpts = &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash, Hash: hashFunc} - } - sig, err := priv.Sign(config.rand(), digest, signOpts) - if err != nil { - return nil, errors.New("tls: failed to sign ECDHE parameters: " + err.Error()) - } - - skx := new(serverKeyExchangeMsg) - sigAndHashLen := 0 - if ka.version >= VersionTLS12 { - sigAndHashLen = 2 - } - skx.key = make([]byte, len(serverECDHParams)+sigAndHashLen+2+len(sig)) - copy(skx.key, serverECDHParams) - k := skx.key[len(serverECDHParams):] - if ka.version >= VersionTLS12 { - k[0] = byte(signatureAlgorithm >> 8) - k[1] = byte(signatureAlgorithm) - k = k[2:] - } - k[0] = byte(len(sig) >> 8) - k[1] = byte(len(sig)) - copy(k[2:], sig) - - return skx, nil -} - -func (ka *ecdheKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { - if len(ckx.ciphertext) == 0 || int(ckx.ciphertext[0]) != len(ckx.ciphertext)-1 { - return nil, errClientKeyExchange - } - - preMasterSecret := ka.params.SharedKey(ckx.ciphertext[1:]) - if preMasterSecret == nil { - return nil, errClientKeyExchange - } - - return preMasterSecret, nil -} - -func (ka *ecdheKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { - if len(skx.key) < 4 { - return errServerKeyExchange - } - if skx.key[0] != 3 { // named curve - return errors.New("tls: server selected unsupported curve") - } - curveID := CurveID(skx.key[1])<<8 | CurveID(skx.key[2]) - - publicLen := int(skx.key[3]) - if publicLen+4 > len(skx.key) { - return errServerKeyExchange - } - serverECDHParams := skx.key[:4+publicLen] - publicKey := serverECDHParams[4:] - - sig := skx.key[4+publicLen:] - if len(sig) < 2 { - return errServerKeyExchange - } - - if _, ok := curveForCurveID(curveID); curveID != X25519 && !ok { - return errors.New("tls: server selected unsupported curve") - } - - params, err := generateECDHEParameters(config.rand(), curveID) - if err != nil { - return err - } - ka.params = params - - ka.preMasterSecret = params.SharedKey(publicKey) - if ka.preMasterSecret == nil { - return errServerKeyExchange - } - - ourPublicKey := params.PublicKey() - ka.ckx = new(clientKeyExchangeMsg) - ka.ckx.ciphertext = make([]byte, 1+len(ourPublicKey)) - ka.ckx.ciphertext[0] = byte(len(ourPublicKey)) - copy(ka.ckx.ciphertext[1:], ourPublicKey) - - var signatureAlgorithm SignatureScheme - if ka.version >= VersionTLS12 { - // handle SignatureAndHashAlgorithm - signatureAlgorithm = SignatureScheme(sig[0])<<8 | SignatureScheme(sig[1]) - sig = sig[2:] - if len(sig) < 2 { - return errServerKeyExchange - } - } - _, sigType, hashFunc, err := pickSignatureAlgorithm(cert.PublicKey, []SignatureScheme{signatureAlgorithm}, clientHello.supportedSignatureAlgorithms, ka.version) - if err != nil { - return err - } - if (sigType == signaturePKCS1v15 || sigType == signatureRSAPSS) != ka.isRSA { - return errServerKeyExchange - } - - sigLen := int(sig[0])<<8 | int(sig[1]) - if sigLen+2 != len(sig) { - return errServerKeyExchange - } - sig = sig[2:] - - digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, serverHello.random, serverECDHParams) - if err != nil { - return err - } - return verifyHandshakeSignature(sigType, cert.PublicKey, hashFunc, digest, sig) -} - -func (ka *ecdheKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { - if ka.ckx == nil { - return nil, nil, errors.New("tls: missing ServerKeyExchange message") - } - - return ka.preMasterSecret, ka.ckx, nil -} diff --git a/vendor/github.com/marten-seemann/qtls/key_schedule.go b/vendor/github.com/marten-seemann/qtls/key_schedule.go deleted file mode 100644 index 24bae2e6..00000000 --- a/vendor/github.com/marten-seemann/qtls/key_schedule.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/elliptic" - "crypto/hmac" - "errors" - "hash" - "io" - "math/big" - - "golang.org/x/crypto/cryptobyte" - "golang.org/x/crypto/curve25519" - "golang.org/x/crypto/hkdf" -) - -// This file contains the functions necessary to compute the TLS 1.3 key -// schedule. See RFC 8446, Section 7. - -const ( - resumptionBinderLabel = "res binder" - clientHandshakeTrafficLabel = "c hs traffic" - serverHandshakeTrafficLabel = "s hs traffic" - clientApplicationTrafficLabel = "c ap traffic" - serverApplicationTrafficLabel = "s ap traffic" - exporterLabel = "exp master" - resumptionLabel = "res master" - trafficUpdateLabel = "traffic upd" -) - -// HkdfExtract generates a pseudorandom key for use with Expand from an input secret and an optional independent salt. -func HkdfExtract(hash crypto.Hash, newSecret, currentSecret []byte) []byte { - if newSecret == nil { - newSecret = make([]byte, hash.Size()) - } - return hkdf.Extract(hash.New, newSecret, currentSecret) -} - -// HkdfExpandLabel HKDF expands a label -func HkdfExpandLabel(hash crypto.Hash, secret, hashValue []byte, label string, L int) []byte { - return hkdfExpandLabel(hash, secret, hashValue, label, L) -} - -func hkdfExpandLabel(hash crypto.Hash, secret, context []byte, label string, length int) []byte { - var hkdfLabel cryptobyte.Builder - hkdfLabel.AddUint16(uint16(length)) - hkdfLabel.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes([]byte("tls13 ")) - b.AddBytes([]byte(label)) - }) - hkdfLabel.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(context) - }) - out := make([]byte, length) - n, err := hkdf.Expand(hash.New, secret, hkdfLabel.BytesOrPanic()).Read(out) - if err != nil || n != length { - panic("tls: HKDF-Expand-Label invocation failed unexpectedly") - } - return out -} - -// expandLabel implements HKDF-Expand-Label from RFC 8446, Section 7.1. -func (c *cipherSuiteTLS13) expandLabel(secret []byte, label string, context []byte, length int) []byte { - return hkdfExpandLabel(c.hash, secret, context, label, length) -} - -// deriveSecret implements Derive-Secret from RFC 8446, Section 7.1. -func (c *cipherSuiteTLS13) deriveSecret(secret []byte, label string, transcript hash.Hash) []byte { - if transcript == nil { - transcript = c.hash.New() - } - return c.expandLabel(secret, label, transcript.Sum(nil), c.hash.Size()) -} - -// extract implements HKDF-Extract with the cipher suite hash. -func (c *cipherSuiteTLS13) extract(newSecret, currentSecret []byte) []byte { - return HkdfExtract(c.hash, newSecret, currentSecret) -} - -// nextTrafficSecret generates the next traffic secret, given the current one, -// according to RFC 8446, Section 7.2. -func (c *cipherSuiteTLS13) nextTrafficSecret(trafficSecret []byte) []byte { - return c.expandLabel(trafficSecret, trafficUpdateLabel, nil, c.hash.Size()) -} - -// trafficKey generates traffic keys according to RFC 8446, Section 7.3. -func (c *cipherSuiteTLS13) trafficKey(trafficSecret []byte) (key, iv []byte) { - key = c.expandLabel(trafficSecret, "key", nil, c.keyLen) - iv = c.expandLabel(trafficSecret, "iv", nil, aeadNonceLength) - return -} - -// finishedHash generates the Finished verify_data or PskBinderEntry according -// to RFC 8446, Section 4.4.4. See sections 4.4 and 4.2.11.2 for the baseKey -// selection. -func (c *cipherSuiteTLS13) finishedHash(baseKey []byte, transcript hash.Hash) []byte { - finishedKey := c.expandLabel(baseKey, "finished", nil, c.hash.Size()) - verifyData := hmac.New(c.hash.New, finishedKey) - verifyData.Write(transcript.Sum(nil)) - return verifyData.Sum(nil) -} - -// exportKeyingMaterial implements RFC5705 exporters for TLS 1.3 according to -// RFC 8446, Section 7.5. -func (c *cipherSuiteTLS13) exportKeyingMaterial(masterSecret []byte, transcript hash.Hash) func(string, []byte, int) ([]byte, error) { - expMasterSecret := c.deriveSecret(masterSecret, exporterLabel, transcript) - return func(label string, context []byte, length int) ([]byte, error) { - secret := c.deriveSecret(expMasterSecret, label, nil) - h := c.hash.New() - h.Write(context) - return c.expandLabel(secret, "exporter", h.Sum(nil), length), nil - } -} - -// ecdheParameters implements Diffie-Hellman with either NIST curves or X25519, -// according to RFC 8446, Section 4.2.8.2. -type ecdheParameters interface { - CurveID() CurveID - PublicKey() []byte - SharedKey(peerPublicKey []byte) []byte -} - -func generateECDHEParameters(rand io.Reader, curveID CurveID) (ecdheParameters, error) { - if curveID == X25519 { - p := &x25519Parameters{} - if _, err := io.ReadFull(rand, p.privateKey[:]); err != nil { - return nil, err - } - curve25519.ScalarBaseMult(&p.publicKey, &p.privateKey) - return p, nil - } - - curve, ok := curveForCurveID(curveID) - if !ok { - return nil, errors.New("tls: internal error: unsupported curve") - } - - p := &nistParameters{curveID: curveID} - var err error - p.privateKey, p.x, p.y, err = elliptic.GenerateKey(curve, rand) - if err != nil { - return nil, err - } - return p, nil -} - -func curveForCurveID(id CurveID) (elliptic.Curve, bool) { - switch id { - case CurveP256: - return elliptic.P256(), true - case CurveP384: - return elliptic.P384(), true - case CurveP521: - return elliptic.P521(), true - default: - return nil, false - } -} - -type nistParameters struct { - privateKey []byte - x, y *big.Int // public key - curveID CurveID -} - -func (p *nistParameters) CurveID() CurveID { - return p.curveID -} - -func (p *nistParameters) PublicKey() []byte { - curve, _ := curveForCurveID(p.curveID) - return elliptic.Marshal(curve, p.x, p.y) -} - -func (p *nistParameters) SharedKey(peerPublicKey []byte) []byte { - curve, _ := curveForCurveID(p.curveID) - // Unmarshal also checks whether the given point is on the curve. - x, y := elliptic.Unmarshal(curve, peerPublicKey) - if x == nil { - return nil - } - - xShared, _ := curve.ScalarMult(x, y, p.privateKey) - sharedKey := make([]byte, (curve.Params().BitSize+7)>>3) - xBytes := xShared.Bytes() - copy(sharedKey[len(sharedKey)-len(xBytes):], xBytes) - - return sharedKey -} - -type x25519Parameters struct { - privateKey [32]byte - publicKey [32]byte -} - -func (p *x25519Parameters) CurveID() CurveID { - return X25519 -} - -func (p *x25519Parameters) PublicKey() []byte { - return p.publicKey[:] -} - -func (p *x25519Parameters) SharedKey(peerPublicKey []byte) []byte { - if len(peerPublicKey) != 32 { - return nil - } - var theirPublicKey, sharedKey [32]byte - copy(theirPublicKey[:], peerPublicKey) - curve25519.ScalarMult(&sharedKey, &p.privateKey, &theirPublicKey) - return sharedKey[:] -} diff --git a/vendor/github.com/marten-seemann/qtls/prf.go b/vendor/github.com/marten-seemann/qtls/prf.go deleted file mode 100644 index a973d6ad..00000000 --- a/vendor/github.com/marten-seemann/qtls/prf.go +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "crypto" - "crypto/hmac" - "crypto/md5" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "errors" - "fmt" - "hash" -) - -// Split a premaster secret in two as specified in RFC 4346, Section 5. -func splitPreMasterSecret(secret []byte) (s1, s2 []byte) { - s1 = secret[0 : (len(secret)+1)/2] - s2 = secret[len(secret)/2:] - return -} - -// pHash implements the P_hash function, as defined in RFC 4346, Section 5. -func pHash(result, secret, seed []byte, hash func() hash.Hash) { - h := hmac.New(hash, secret) - h.Write(seed) - a := h.Sum(nil) - - j := 0 - for j < len(result) { - h.Reset() - h.Write(a) - h.Write(seed) - b := h.Sum(nil) - copy(result[j:], b) - j += len(b) - - h.Reset() - h.Write(a) - a = h.Sum(nil) - } -} - -// prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5. -func prf10(result, secret, label, seed []byte) { - hashSHA1 := sha1.New - hashMD5 := md5.New - - labelAndSeed := make([]byte, len(label)+len(seed)) - copy(labelAndSeed, label) - copy(labelAndSeed[len(label):], seed) - - s1, s2 := splitPreMasterSecret(secret) - pHash(result, s1, labelAndSeed, hashMD5) - result2 := make([]byte, len(result)) - pHash(result2, s2, labelAndSeed, hashSHA1) - - for i, b := range result2 { - result[i] ^= b - } -} - -// prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, Section 5. -func prf12(hashFunc func() hash.Hash) func(result, secret, label, seed []byte) { - return func(result, secret, label, seed []byte) { - labelAndSeed := make([]byte, len(label)+len(seed)) - copy(labelAndSeed, label) - copy(labelAndSeed[len(label):], seed) - - pHash(result, secret, labelAndSeed, hashFunc) - } -} - -// prf30 implements the SSL 3.0 pseudo-random function, as defined in -// www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt section 6. -func prf30(result, secret, label, seed []byte) { - hashSHA1 := sha1.New() - hashMD5 := md5.New() - - done := 0 - i := 0 - // RFC 5246 section 6.3 says that the largest PRF output needed is 128 - // bytes. Since no more ciphersuites will be added to SSLv3, this will - // remain true. Each iteration gives us 16 bytes so 10 iterations will - // be sufficient. - var b [11]byte - for done < len(result) { - for j := 0; j <= i; j++ { - b[j] = 'A' + byte(i) - } - - hashSHA1.Reset() - hashSHA1.Write(b[:i+1]) - hashSHA1.Write(secret) - hashSHA1.Write(seed) - digest := hashSHA1.Sum(nil) - - hashMD5.Reset() - hashMD5.Write(secret) - hashMD5.Write(digest) - - done += copy(result[done:], hashMD5.Sum(nil)) - i++ - } -} - -const ( - masterSecretLength = 48 // Length of a master secret in TLS 1.1. - finishedVerifyLength = 12 // Length of verify_data in a Finished message. -) - -var masterSecretLabel = []byte("master secret") -var keyExpansionLabel = []byte("key expansion") -var clientFinishedLabel = []byte("client finished") -var serverFinishedLabel = []byte("server finished") - -func prfAndHashForVersion(version uint16, suite *cipherSuite) (func(result, secret, label, seed []byte), crypto.Hash) { - switch version { - case VersionSSL30: - return prf30, crypto.Hash(0) - case VersionTLS10, VersionTLS11: - return prf10, crypto.Hash(0) - case VersionTLS12: - if suite.flags&suiteSHA384 != 0 { - return prf12(sha512.New384), crypto.SHA384 - } - return prf12(sha256.New), crypto.SHA256 - default: - panic("unknown version") - } -} - -func prfForVersion(version uint16, suite *cipherSuite) func(result, secret, label, seed []byte) { - prf, _ := prfAndHashForVersion(version, suite) - return prf -} - -// masterFromPreMasterSecret generates the master secret from the pre-master -// secret. See RFC 5246, Section 8.1. -func masterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, clientRandom, serverRandom []byte) []byte { - seed := make([]byte, 0, len(clientRandom)+len(serverRandom)) - seed = append(seed, clientRandom...) - seed = append(seed, serverRandom...) - - masterSecret := make([]byte, masterSecretLength) - prfForVersion(version, suite)(masterSecret, preMasterSecret, masterSecretLabel, seed) - return masterSecret -} - -// keysFromMasterSecret generates the connection keys from the master -// secret, given the lengths of the MAC key, cipher key and IV, as defined in -// RFC 2246, Section 6.3. -func keysFromMasterSecret(version uint16, suite *cipherSuite, masterSecret, clientRandom, serverRandom []byte, macLen, keyLen, ivLen int) (clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV []byte) { - seed := make([]byte, 0, len(serverRandom)+len(clientRandom)) - seed = append(seed, serverRandom...) - seed = append(seed, clientRandom...) - - n := 2*macLen + 2*keyLen + 2*ivLen - keyMaterial := make([]byte, n) - prfForVersion(version, suite)(keyMaterial, masterSecret, keyExpansionLabel, seed) - clientMAC = keyMaterial[:macLen] - keyMaterial = keyMaterial[macLen:] - serverMAC = keyMaterial[:macLen] - keyMaterial = keyMaterial[macLen:] - clientKey = keyMaterial[:keyLen] - keyMaterial = keyMaterial[keyLen:] - serverKey = keyMaterial[:keyLen] - keyMaterial = keyMaterial[keyLen:] - clientIV = keyMaterial[:ivLen] - keyMaterial = keyMaterial[ivLen:] - serverIV = keyMaterial[:ivLen] - return -} - -// hashFromSignatureScheme returns the corresponding crypto.Hash for a given -// hash from a TLS SignatureScheme. -func hashFromSignatureScheme(signatureAlgorithm SignatureScheme) (crypto.Hash, error) { - switch signatureAlgorithm { - case PKCS1WithSHA1, ECDSAWithSHA1: - return crypto.SHA1, nil - case PKCS1WithSHA256, PSSWithSHA256, ECDSAWithP256AndSHA256: - return crypto.SHA256, nil - case PKCS1WithSHA384, PSSWithSHA384, ECDSAWithP384AndSHA384: - return crypto.SHA384, nil - case PKCS1WithSHA512, PSSWithSHA512, ECDSAWithP521AndSHA512: - return crypto.SHA512, nil - default: - return 0, fmt.Errorf("tls: unsupported signature algorithm: %#04x", signatureAlgorithm) - } -} - -func newFinishedHash(version uint16, cipherSuite *cipherSuite) finishedHash { - var buffer []byte - if version == VersionSSL30 || version >= VersionTLS12 { - buffer = []byte{} - } - - prf, hash := prfAndHashForVersion(version, cipherSuite) - if hash != 0 { - return finishedHash{hash.New(), hash.New(), nil, nil, buffer, version, prf} - } - - return finishedHash{sha1.New(), sha1.New(), md5.New(), md5.New(), buffer, version, prf} -} - -// A finishedHash calculates the hash of a set of handshake messages suitable -// for including in a Finished message. -type finishedHash struct { - client hash.Hash - server hash.Hash - - // Prior to TLS 1.2, an additional MD5 hash is required. - clientMD5 hash.Hash - serverMD5 hash.Hash - - // In TLS 1.2, a full buffer is sadly required. - buffer []byte - - version uint16 - prf func(result, secret, label, seed []byte) -} - -func (h *finishedHash) Write(msg []byte) (n int, err error) { - h.client.Write(msg) - h.server.Write(msg) - - if h.version < VersionTLS12 { - h.clientMD5.Write(msg) - h.serverMD5.Write(msg) - } - - if h.buffer != nil { - h.buffer = append(h.buffer, msg...) - } - - return len(msg), nil -} - -func (h finishedHash) Sum() []byte { - if h.version >= VersionTLS12 { - return h.client.Sum(nil) - } - - out := make([]byte, 0, md5.Size+sha1.Size) - out = h.clientMD5.Sum(out) - return h.client.Sum(out) -} - -// finishedSum30 calculates the contents of the verify_data member of a SSLv3 -// Finished message given the MD5 and SHA1 hashes of a set of handshake -// messages. -func finishedSum30(md5, sha1 hash.Hash, masterSecret []byte, magic []byte) []byte { - md5.Write(magic) - md5.Write(masterSecret) - md5.Write(ssl30Pad1[:]) - md5Digest := md5.Sum(nil) - - md5.Reset() - md5.Write(masterSecret) - md5.Write(ssl30Pad2[:]) - md5.Write(md5Digest) - md5Digest = md5.Sum(nil) - - sha1.Write(magic) - sha1.Write(masterSecret) - sha1.Write(ssl30Pad1[:40]) - sha1Digest := sha1.Sum(nil) - - sha1.Reset() - sha1.Write(masterSecret) - sha1.Write(ssl30Pad2[:40]) - sha1.Write(sha1Digest) - sha1Digest = sha1.Sum(nil) - - ret := make([]byte, len(md5Digest)+len(sha1Digest)) - copy(ret, md5Digest) - copy(ret[len(md5Digest):], sha1Digest) - return ret -} - -var ssl3ClientFinishedMagic = [4]byte{0x43, 0x4c, 0x4e, 0x54} -var ssl3ServerFinishedMagic = [4]byte{0x53, 0x52, 0x56, 0x52} - -// clientSum returns the contents of the verify_data member of a client's -// Finished message. -func (h finishedHash) clientSum(masterSecret []byte) []byte { - if h.version == VersionSSL30 { - return finishedSum30(h.clientMD5, h.client, masterSecret, ssl3ClientFinishedMagic[:]) - } - - out := make([]byte, finishedVerifyLength) - h.prf(out, masterSecret, clientFinishedLabel, h.Sum()) - return out -} - -// serverSum returns the contents of the verify_data member of a server's -// Finished message. -func (h finishedHash) serverSum(masterSecret []byte) []byte { - if h.version == VersionSSL30 { - return finishedSum30(h.serverMD5, h.server, masterSecret, ssl3ServerFinishedMagic[:]) - } - - out := make([]byte, finishedVerifyLength) - h.prf(out, masterSecret, serverFinishedLabel, h.Sum()) - return out -} - -// hashForClientCertificate returns a digest over the handshake messages so far, -// suitable for signing by a TLS client certificate. -func (h finishedHash) hashForClientCertificate(sigType uint8, hashAlg crypto.Hash, masterSecret []byte) ([]byte, error) { - if (h.version == VersionSSL30 || h.version >= VersionTLS12) && h.buffer == nil { - panic("a handshake hash for a client-certificate was requested after discarding the handshake buffer") - } - - if h.version == VersionSSL30 { - if sigType != signaturePKCS1v15 { - return nil, errors.New("tls: unsupported signature type for client certificate") - } - - md5Hash := md5.New() - md5Hash.Write(h.buffer) - sha1Hash := sha1.New() - sha1Hash.Write(h.buffer) - return finishedSum30(md5Hash, sha1Hash, masterSecret, nil), nil - } - if h.version >= VersionTLS12 { - hash := hashAlg.New() - hash.Write(h.buffer) - return hash.Sum(nil), nil - } - - if sigType == signatureECDSA { - return h.server.Sum(nil), nil - } - - return h.Sum(), nil -} - -// discardHandshakeBuffer is called when there is no more need to -// buffer the entirety of the handshake messages. -func (h *finishedHash) discardHandshakeBuffer() { - h.buffer = nil -} - -// noExportedKeyingMaterial is used as a value of -// ConnectionState.ekm when renegotation is enabled and thus -// we wish to fail all key-material export requests. -func noExportedKeyingMaterial(label string, context []byte, length int) ([]byte, error) { - return nil, errors.New("crypto/tls: ExportKeyingMaterial is unavailable when renegotiation is enabled") -} - -// ekmFromMasterSecret generates exported keying material as defined in RFC 5705. -func ekmFromMasterSecret(version uint16, suite *cipherSuite, masterSecret, clientRandom, serverRandom []byte) func(string, []byte, int) ([]byte, error) { - return func(label string, context []byte, length int) ([]byte, error) { - switch label { - case "client finished", "server finished", "master secret", "key expansion": - // These values are reserved and may not be used. - return nil, fmt.Errorf("crypto/tls: reserved ExportKeyingMaterial label: %s", label) - } - - seedLen := len(serverRandom) + len(clientRandom) - if context != nil { - seedLen += 2 + len(context) - } - seed := make([]byte, 0, seedLen) - - seed = append(seed, clientRandom...) - seed = append(seed, serverRandom...) - - if context != nil { - if len(context) >= 1<<16 { - return nil, fmt.Errorf("crypto/tls: ExportKeyingMaterial context too long") - } - seed = append(seed, byte(len(context)>>8), byte(len(context))) - seed = append(seed, context...) - } - - keyMaterial := make([]byte, length) - prfForVersion(version, suite)(keyMaterial, masterSecret, []byte(label), seed) - return keyMaterial, nil - } -} diff --git a/vendor/github.com/marten-seemann/qtls/ticket.go b/vendor/github.com/marten-seemann/qtls/ticket.go deleted file mode 100644 index 989c9787..00000000 --- a/vendor/github.com/marten-seemann/qtls/ticket.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package qtls - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/hmac" - "crypto/sha256" - "crypto/subtle" - "errors" - "io" - - "golang.org/x/crypto/cryptobyte" -) - -// sessionState contains the information that is serialized into a session -// ticket in order to later resume a connection. -type sessionState struct { - vers uint16 - cipherSuite uint16 - masterSecret []byte - certificates [][]byte - // usedOldKey is true if the ticket from which this session came from - // was encrypted with an older key and thus should be refreshed. - usedOldKey bool -} - -func (s *sessionState) marshal() []byte { - length := 2 + 2 + 2 + len(s.masterSecret) + 2 - for _, cert := range s.certificates { - length += 4 + len(cert) - } - - ret := make([]byte, length) - x := ret - x[0] = byte(s.vers >> 8) - x[1] = byte(s.vers) - x[2] = byte(s.cipherSuite >> 8) - x[3] = byte(s.cipherSuite) - x[4] = byte(len(s.masterSecret) >> 8) - x[5] = byte(len(s.masterSecret)) - x = x[6:] - copy(x, s.masterSecret) - x = x[len(s.masterSecret):] - - x[0] = byte(len(s.certificates) >> 8) - x[1] = byte(len(s.certificates)) - x = x[2:] - - for _, cert := range s.certificates { - x[0] = byte(len(cert) >> 24) - x[1] = byte(len(cert) >> 16) - x[2] = byte(len(cert) >> 8) - x[3] = byte(len(cert)) - copy(x[4:], cert) - x = x[4+len(cert):] - } - - return ret -} - -func (s *sessionState) unmarshal(data []byte) bool { - if len(data) < 8 { - return false - } - - s.vers = uint16(data[0])<<8 | uint16(data[1]) - s.cipherSuite = uint16(data[2])<<8 | uint16(data[3]) - masterSecretLen := int(data[4])<<8 | int(data[5]) - data = data[6:] - if len(data) < masterSecretLen { - return false - } - - s.masterSecret = data[:masterSecretLen] - data = data[masterSecretLen:] - - if len(data) < 2 { - return false - } - - numCerts := int(data[0])<<8 | int(data[1]) - data = data[2:] - - s.certificates = make([][]byte, numCerts) - for i := range s.certificates { - if len(data) < 4 { - return false - } - certLen := int(data[0])<<24 | int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - data = data[4:] - if certLen < 0 { - return false - } - if len(data) < certLen { - return false - } - s.certificates[i] = data[:certLen] - data = data[certLen:] - } - - return len(data) == 0 -} - -// sessionStateTLS13 is the content of a TLS 1.3 session ticket. Its first -// version (revision = 0) doesn't carry any of the information needed for 0-RTT -// validation and the nonce is always empty. -type sessionStateTLS13 struct { - // uint8 version = 0x0304; - // uint8 revision = 0; - cipherSuite uint16 - createdAt uint64 - resumptionSecret []byte // opaque resumption_master_secret<1..2^8-1>; - certificate Certificate // CertificateEntry certificate_list<0..2^24-1>; -} - -func (m *sessionStateTLS13) marshal() []byte { - var b cryptobyte.Builder - b.AddUint16(VersionTLS13) - b.AddUint8(0) // revision - b.AddUint16(m.cipherSuite) - addUint64(&b, m.createdAt) - b.AddUint8LengthPrefixed(func(b *cryptobyte.Builder) { - b.AddBytes(m.resumptionSecret) - }) - marshalCertificate(&b, m.certificate) - return b.BytesOrPanic() -} - -func (m *sessionStateTLS13) unmarshal(data []byte) bool { - *m = sessionStateTLS13{} - s := cryptobyte.String(data) - var version uint16 - var revision uint8 - return s.ReadUint16(&version) && - version == VersionTLS13 && - s.ReadUint8(&revision) && - revision == 0 && - s.ReadUint16(&m.cipherSuite) && - readUint64(&s, &m.createdAt) && - readUint8LengthPrefixed(&s, &m.resumptionSecret) && - len(m.resumptionSecret) != 0 && - unmarshalCertificate(&s, &m.certificate) && - s.Empty() -} - -func (c *Conn) encryptTicket(state []byte) ([]byte, error) { - encrypted := make([]byte, ticketKeyNameLen+aes.BlockSize+len(state)+sha256.Size) - keyName := encrypted[:ticketKeyNameLen] - iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] - macBytes := encrypted[len(encrypted)-sha256.Size:] - - if _, err := io.ReadFull(c.config.rand(), iv); err != nil { - return nil, err - } - key := c.config.ticketKeys()[0] - copy(keyName, key.keyName[:]) - block, err := aes.NewCipher(key.aesKey[:]) - if err != nil { - return nil, errors.New("tls: failed to create cipher while encrypting ticket: " + err.Error()) - } - cipher.NewCTR(block, iv).XORKeyStream(encrypted[ticketKeyNameLen+aes.BlockSize:], state) - - mac := hmac.New(sha256.New, key.hmacKey[:]) - mac.Write(encrypted[:len(encrypted)-sha256.Size]) - mac.Sum(macBytes[:0]) - - return encrypted, nil -} - -func (c *Conn) decryptTicket(encrypted []byte) (plaintext []byte, usedOldKey bool) { - if len(encrypted) < ticketKeyNameLen+aes.BlockSize+sha256.Size { - return nil, false - } - - keyName := encrypted[:ticketKeyNameLen] - iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] - macBytes := encrypted[len(encrypted)-sha256.Size:] - ciphertext := encrypted[ticketKeyNameLen+aes.BlockSize : len(encrypted)-sha256.Size] - - keys := c.config.ticketKeys() - keyIndex := -1 - for i, candidateKey := range keys { - if bytes.Equal(keyName, candidateKey.keyName[:]) { - keyIndex = i - break - } - } - - if keyIndex == -1 { - return nil, false - } - key := &keys[keyIndex] - - mac := hmac.New(sha256.New, key.hmacKey[:]) - mac.Write(encrypted[:len(encrypted)-sha256.Size]) - expected := mac.Sum(nil) - - if subtle.ConstantTimeCompare(macBytes, expected) != 1 { - return nil, false - } - - block, err := aes.NewCipher(key.aesKey[:]) - if err != nil { - return nil, false - } - plaintext = make([]byte, len(ciphertext)) - cipher.NewCTR(block, iv).XORKeyStream(plaintext, ciphertext) - - return plaintext, keyIndex > 0 -} diff --git a/vendor/github.com/marten-seemann/qtls/tls.go b/vendor/github.com/marten-seemann/qtls/tls.go deleted file mode 100644 index 818997d3..00000000 --- a/vendor/github.com/marten-seemann/qtls/tls.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// package qtls partially implements TLS 1.2, as specified in RFC 5246, -// and TLS 1.3, as specified in RFC 8446. -// -// TLS 1.3 is available only on an opt-in basis in Go 1.12. To enable -// it, set the GODEBUG environment variable (comma-separated key=value -// options) such that it includes "tls13=1". To enable it from within -// the process, set the environment variable before any use of TLS: -// -// func init() { -// os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") -// } -package qtls - -// BUG(agl): The crypto/tls package only implements some countermeasures -// against Lucky13 attacks on CBC-mode encryption, and only on SHA1 -// variants. See http://www.isg.rhul.ac.uk/tls/TLStiming.pdf and -// https://www.imperialviolet.org/2013/02/04/luckythirteen.html. - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" - "fmt" - "io/ioutil" - "net" - "strings" - "time" -) - -// Server returns a new TLS server side connection -// using conn as the underlying transport. -// The configuration config must be non-nil and must include -// at least one certificate or else set GetCertificate. -func Server(conn net.Conn, config *Config) *Conn { - return &Conn{conn: conn, config: config} -} - -// Client returns a new TLS client side connection -// using conn as the underlying transport. -// The config cannot be nil: users must set either ServerName or -// InsecureSkipVerify in the config. -func Client(conn net.Conn, config *Config) *Conn { - return &Conn{conn: conn, config: config, isClient: true} -} - -// A listener implements a network listener (net.Listener) for TLS connections. -type listener struct { - net.Listener - config *Config -} - -// Accept waits for and returns the next incoming TLS connection. -// The returned connection is of type *Conn. -func (l *listener) Accept() (net.Conn, error) { - c, err := l.Listener.Accept() - if err != nil { - return nil, err - } - return Server(c, l.config), nil -} - -// NewListener creates a Listener which accepts connections from an inner -// Listener and wraps each connection with Server. -// The configuration config must be non-nil and must include -// at least one certificate or else set GetCertificate. -func NewListener(inner net.Listener, config *Config) net.Listener { - l := new(listener) - l.Listener = inner - l.config = config - return l -} - -// Listen creates a TLS listener accepting connections on the -// given network address using net.Listen. -// The configuration config must be non-nil and must include -// at least one certificate or else set GetCertificate. -func Listen(network, laddr string, config *Config) (net.Listener, error) { - if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) { - return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config") - } - l, err := net.Listen(network, laddr) - if err != nil { - return nil, err - } - return NewListener(l, config), nil -} - -type timeoutError struct{} - -func (timeoutError) Error() string { return "tls: DialWithDialer timed out" } -func (timeoutError) Timeout() bool { return true } -func (timeoutError) Temporary() bool { return true } - -// DialWithDialer connects to the given network address using dialer.Dial and -// then initiates a TLS handshake, returning the resulting TLS connection. Any -// timeout or deadline given in the dialer apply to connection and TLS -// handshake as a whole. -// -// DialWithDialer interprets a nil configuration as equivalent to the zero -// configuration; see the documentation of Config for the defaults. -func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*Conn, error) { - // We want the Timeout and Deadline values from dialer to cover the - // whole process: TCP connection and TLS handshake. This means that we - // also need to start our own timers now. - timeout := dialer.Timeout - - if !dialer.Deadline.IsZero() { - deadlineTimeout := time.Until(dialer.Deadline) - if timeout == 0 || deadlineTimeout < timeout { - timeout = deadlineTimeout - } - } - - var errChannel chan error - - if timeout != 0 { - errChannel = make(chan error, 2) - time.AfterFunc(timeout, func() { - errChannel <- timeoutError{} - }) - } - - rawConn, err := dialer.Dial(network, addr) - if err != nil { - return nil, err - } - - colonPos := strings.LastIndex(addr, ":") - if colonPos == -1 { - colonPos = len(addr) - } - hostname := addr[:colonPos] - - if config == nil { - config = defaultConfig() - } - // If no ServerName is set, infer the ServerName - // from the hostname we're connecting to. - if config.ServerName == "" { - // Make a copy to avoid polluting argument or default. - c := config.Clone() - c.ServerName = hostname - config = c - } - - conn := Client(rawConn, config) - - if timeout == 0 { - err = conn.Handshake() - } else { - go func() { - errChannel <- conn.Handshake() - }() - - err = <-errChannel - } - - if err != nil { - rawConn.Close() - return nil, err - } - - return conn, nil -} - -// Dial connects to the given network address using net.Dial -// and then initiates a TLS handshake, returning the resulting -// TLS connection. -// Dial interprets a nil configuration as equivalent to -// the zero configuration; see the documentation of Config -// for the defaults. -func Dial(network, addr string, config *Config) (*Conn, error) { - return DialWithDialer(new(net.Dialer), network, addr, config) -} - -// LoadX509KeyPair reads and parses a public/private key pair from a pair -// of files. The files must contain PEM encoded data. The certificate file -// may contain intermediate certificates following the leaf certificate to -// form a certificate chain. On successful return, Certificate.Leaf will -// be nil because the parsed form of the certificate is not retained. -func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) { - certPEMBlock, err := ioutil.ReadFile(certFile) - if err != nil { - return Certificate{}, err - } - keyPEMBlock, err := ioutil.ReadFile(keyFile) - if err != nil { - return Certificate{}, err - } - return X509KeyPair(certPEMBlock, keyPEMBlock) -} - -// X509KeyPair parses a public/private key pair from a pair of -// PEM encoded data. On successful return, Certificate.Leaf will be nil because -// the parsed form of the certificate is not retained. -func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { - fail := func(err error) (Certificate, error) { return Certificate{}, err } - - var cert Certificate - var skippedBlockTypes []string - for { - var certDERBlock *pem.Block - certDERBlock, certPEMBlock = pem.Decode(certPEMBlock) - if certDERBlock == nil { - break - } - if certDERBlock.Type == "CERTIFICATE" { - cert.Certificate = append(cert.Certificate, certDERBlock.Bytes) - } else { - skippedBlockTypes = append(skippedBlockTypes, certDERBlock.Type) - } - } - - if len(cert.Certificate) == 0 { - if len(skippedBlockTypes) == 0 { - return fail(errors.New("tls: failed to find any PEM data in certificate input")) - } - if len(skippedBlockTypes) == 1 && strings.HasSuffix(skippedBlockTypes[0], "PRIVATE KEY") { - return fail(errors.New("tls: failed to find certificate PEM data in certificate input, but did find a private key; PEM inputs may have been switched")) - } - return fail(fmt.Errorf("tls: failed to find \"CERTIFICATE\" PEM block in certificate input after skipping PEM blocks of the following types: %v", skippedBlockTypes)) - } - - skippedBlockTypes = skippedBlockTypes[:0] - var keyDERBlock *pem.Block - for { - keyDERBlock, keyPEMBlock = pem.Decode(keyPEMBlock) - if keyDERBlock == nil { - if len(skippedBlockTypes) == 0 { - return fail(errors.New("tls: failed to find any PEM data in key input")) - } - if len(skippedBlockTypes) == 1 && skippedBlockTypes[0] == "CERTIFICATE" { - return fail(errors.New("tls: found a certificate rather than a key in the PEM for the private key")) - } - return fail(fmt.Errorf("tls: failed to find PEM block with type ending in \"PRIVATE KEY\" in key input after skipping PEM blocks of the following types: %v", skippedBlockTypes)) - } - if keyDERBlock.Type == "PRIVATE KEY" || strings.HasSuffix(keyDERBlock.Type, " PRIVATE KEY") { - break - } - skippedBlockTypes = append(skippedBlockTypes, keyDERBlock.Type) - } - - // We don't need to parse the public key for TLS, but we so do anyway - // to check that it looks sane and matches the private key. - x509Cert, err := x509.ParseCertificate(cert.Certificate[0]) - if err != nil { - return fail(err) - } - - cert.PrivateKey, err = parsePrivateKey(keyDERBlock.Bytes) - if err != nil { - return fail(err) - } - - switch pub := x509Cert.PublicKey.(type) { - case *rsa.PublicKey: - priv, ok := cert.PrivateKey.(*rsa.PrivateKey) - if !ok { - return fail(errors.New("tls: private key type does not match public key type")) - } - if pub.N.Cmp(priv.N) != 0 { - return fail(errors.New("tls: private key does not match public key")) - } - case *ecdsa.PublicKey: - priv, ok := cert.PrivateKey.(*ecdsa.PrivateKey) - if !ok { - return fail(errors.New("tls: private key type does not match public key type")) - } - if pub.X.Cmp(priv.X) != 0 || pub.Y.Cmp(priv.Y) != 0 { - return fail(errors.New("tls: private key does not match public key")) - } - default: - return fail(errors.New("tls: unknown public key algorithm")) - } - - return cert, nil -} - -// Attempt to parse the given private key DER block. OpenSSL 0.9.8 generates -// PKCS#1 private keys by default, while OpenSSL 1.0.0 generates PKCS#8 keys. -// OpenSSL ecparam generates SEC1 EC private keys for ECDSA. We try all three. -func parsePrivateKey(der []byte) (crypto.PrivateKey, error) { - if key, err := x509.ParsePKCS1PrivateKey(der); err == nil { - return key, nil - } - if key, err := x509.ParsePKCS8PrivateKey(der); err == nil { - switch key := key.(type) { - case *rsa.PrivateKey, *ecdsa.PrivateKey: - return key, nil - default: - return nil, errors.New("tls: found unknown private key type in PKCS#8 wrapping") - } - } - if key, err := x509.ParseECPrivateKey(der); err == nil { - return key, nil - } - - return nil, errors.New("tls: failed to parse private key") -} diff --git a/vendor/github.com/miekg/dns/.codecov.yml b/vendor/github.com/miekg/dns/.codecov.yml deleted file mode 100644 index f91e5c1f..00000000 --- a/vendor/github.com/miekg/dns/.codecov.yml +++ /dev/null @@ -1,8 +0,0 @@ -coverage: - status: - project: - default: - target: 40% - threshold: null - patch: false - changes: false diff --git a/vendor/github.com/miekg/dns/.gitignore b/vendor/github.com/miekg/dns/.gitignore deleted file mode 100644 index 776cd950..00000000 --- a/vendor/github.com/miekg/dns/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.6 -tags -test.out -a.out diff --git a/vendor/github.com/miekg/dns/.travis.yml b/vendor/github.com/miekg/dns/.travis.yml deleted file mode 100644 index 013b5ae4..00000000 --- a/vendor/github.com/miekg/dns/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go -sudo: false - -go: - - 1.10.x - - 1.11.x - - 1.12.x - - tip - -before_install: - # don't use the miekg/dns when testing forks - - mkdir -p $GOPATH/src/github.com/miekg - - ln -s $TRAVIS_BUILD_DIR $GOPATH/src/github.com/miekg/ || true - -script: - - go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/miekg/dns/AUTHORS b/vendor/github.com/miekg/dns/AUTHORS deleted file mode 100644 index 19656835..00000000 --- a/vendor/github.com/miekg/dns/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Miek Gieben diff --git a/vendor/github.com/miekg/dns/CONTRIBUTORS b/vendor/github.com/miekg/dns/CONTRIBUTORS deleted file mode 100644 index 5903779d..00000000 --- a/vendor/github.com/miekg/dns/CONTRIBUTORS +++ /dev/null @@ -1,10 +0,0 @@ -Alex A. Skinner -Andrew Tunnell-Jones -Ask Bjørn Hansen -Dave Cheney -Dusty Wilson -Marek Majkowski -Peter van Dijk -Omri Bahumi -Alex Sergeyev -James Hartig diff --git a/vendor/github.com/miekg/dns/COPYRIGHT b/vendor/github.com/miekg/dns/COPYRIGHT deleted file mode 100644 index 35702b10..00000000 --- a/vendor/github.com/miekg/dns/COPYRIGHT +++ /dev/null @@ -1,9 +0,0 @@ -Copyright 2009 The Go Authors. All rights reserved. Use of this source code -is governed by a BSD-style license that can be found in the LICENSE file. -Extensions of the original work are copyright (c) 2011 Miek Gieben - -Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is -governed by a BSD-style license that can be found in the LICENSE file. - -Copyright 2014 CloudFlare. All rights reserved. Use of this source code is -governed by a BSD-style license that can be found in the LICENSE file. diff --git a/vendor/github.com/miekg/dns/Gopkg.lock b/vendor/github.com/miekg/dns/Gopkg.lock deleted file mode 100644 index 66be346a..00000000 --- a/vendor/github.com/miekg/dns/Gopkg.lock +++ /dev/null @@ -1,33 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ed25519","ed25519/internal/edwards25519"] - revision = "20be4c3c3ed52bfccdb2d59a412ee1a936d175a7" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["bpf","internal/iana","internal/socket","ipv4","ipv6"] - revision = "60506f45cf65977eb3a9c6e30f995f54a721c271" - -[[projects]] - branch = "master" - name = "golang.org/x/sync" - packages = ["errgroup"] - revision = "112230192c580c3556b8cee6403af37a4fc5f28c" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix","windows"] - revision = "4c4f7f33c9ed00de01c4c741d2177abfcfe19307" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "fc70ece982d3660454fe1b9ccd5c91162a1cc080b58ad82aa065ad4a2ec93ce9" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/miekg/dns/Gopkg.toml b/vendor/github.com/miekg/dns/Gopkg.toml deleted file mode 100644 index 85e6ff31..00000000 --- a/vendor/github.com/miekg/dns/Gopkg.toml +++ /dev/null @@ -1,38 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - branch = "master" - name = "golang.org/x/crypto" - -[[constraint]] - branch = "master" - name = "golang.org/x/net" - -[[constraint]] - branch = "master" - name = "golang.org/x/sys" - -[[constraint]] - branch = "master" - name = "golang.org/x/sync" diff --git a/vendor/github.com/miekg/dns/LICENSE b/vendor/github.com/miekg/dns/LICENSE deleted file mode 100644 index 5763fa7f..00000000 --- a/vendor/github.com/miekg/dns/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -Extensions of the original work are copyright (c) 2011 Miek Gieben - -As this is fork of the official Go code the same license applies: - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/miekg/dns/Makefile.fuzz b/vendor/github.com/miekg/dns/Makefile.fuzz deleted file mode 100644 index dc158c4a..00000000 --- a/vendor/github.com/miekg/dns/Makefile.fuzz +++ /dev/null @@ -1,33 +0,0 @@ -# Makefile for fuzzing -# -# Use go-fuzz and needs the tools installed. -# See https://blog.cloudflare.com/dns-parser-meet-go-fuzzer/ -# -# Installing go-fuzz: -# $ make -f Makefile.fuzz get -# Installs: -# * github.com/dvyukov/go-fuzz/go-fuzz -# * get github.com/dvyukov/go-fuzz/go-fuzz-build - -all: build - -.PHONY: build -build: - go-fuzz-build -tags fuzz github.com/miekg/dns - -.PHONY: build-newrr -build-newrr: - go-fuzz-build -func FuzzNewRR -tags fuzz github.com/miekg/dns - -.PHONY: fuzz -fuzz: - go-fuzz -bin=dns-fuzz.zip -workdir=fuzz - -.PHONY: get -get: - go get github.com/dvyukov/go-fuzz/go-fuzz - go get github.com/dvyukov/go-fuzz/go-fuzz-build - -.PHONY: clean -clean: - rm *-fuzz.zip diff --git a/vendor/github.com/miekg/dns/Makefile.release b/vendor/github.com/miekg/dns/Makefile.release deleted file mode 100644 index 8fb748e8..00000000 --- a/vendor/github.com/miekg/dns/Makefile.release +++ /dev/null @@ -1,52 +0,0 @@ -# Makefile for releasing. -# -# The release is controlled from version.go. The version found there is -# used to tag the git repo, we're not building any artifects so there is nothing -# to upload to github. -# -# * Up the version in version.go -# * Run: make -f Makefile.release release -# * will *commit* your change with 'Release $VERSION' -# * push to github -# - -define GO -//+build ignore - -package main - -import ( - "fmt" - - "github.com/miekg/dns" -) - -func main() { - fmt.Println(dns.Version.String()) -} -endef - -$(file > version_release.go,$(GO)) -VERSION:=$(shell go run version_release.go) -TAG="v$(VERSION)" - -all: - @echo Use the \'release\' target to start a release $(VERSION) - rm -f version_release.go - -.PHONY: release -release: commit push - @echo Released $(VERSION) - rm -f version_release.go - -.PHONY: commit -commit: - @echo Committing release $(VERSION) - git commit -am"Release $(VERSION)" - git tag $(TAG) - -.PHONY: push -push: - @echo Pushing release $(VERSION) to master - git push --tags - git push diff --git a/vendor/github.com/miekg/dns/README.md b/vendor/github.com/miekg/dns/README.md deleted file mode 100644 index de4afed6..00000000 --- a/vendor/github.com/miekg/dns/README.md +++ /dev/null @@ -1,174 +0,0 @@ -[![Build Status](https://travis-ci.org/miekg/dns.svg?branch=master)](https://travis-ci.org/miekg/dns) -[![Code Coverage](https://img.shields.io/codecov/c/github/miekg/dns/master.svg)](https://codecov.io/github/miekg/dns?branch=master) -[![Go Report Card](https://goreportcard.com/badge/github.com/miekg/dns)](https://goreportcard.com/report/miekg/dns) -[![](https://godoc.org/github.com/miekg/dns?status.svg)](https://godoc.org/github.com/miekg/dns) - -# Alternative (more granular) approach to a DNS library - -> Less is more. - -Complete and usable DNS library. All Resource Records are supported, including the DNSSEC types. -It follows a lean and mean philosophy. If there is stuff you should know as a DNS programmer there -isn't a convenience function for it. Server side and client side programming is supported, i.e. you -can build servers and resolvers with it. - -We try to keep the "master" branch as sane as possible and at the bleeding edge of standards, -avoiding breaking changes wherever reasonable. We support the last two versions of Go. - -# Goals - -* KISS; -* Fast; -* Small API. If it's easy to code in Go, don't make a function for it. - -# Users - -A not-so-up-to-date-list-that-may-be-actually-current: - -* https://github.com/coredns/coredns -* https://cloudflare.com -* https://github.com/abh/geodns -* http://www.statdns.com/ -* http://www.dnsinspect.com/ -* https://github.com/chuangbo/jianbing-dictionary-dns -* http://www.dns-lg.com/ -* https://github.com/fcambus/rrda -* https://github.com/kenshinx/godns -* https://github.com/skynetservices/skydns -* https://github.com/hashicorp/consul -* https://github.com/DevelopersPL/godnsagent -* https://github.com/duedil-ltd/discodns -* https://github.com/StalkR/dns-reverse-proxy -* https://github.com/tianon/rawdns -* https://mesosphere.github.io/mesos-dns/ -* https://pulse.turbobytes.com/ -* https://github.com/fcambus/statzone -* https://github.com/benschw/dns-clb-go -* https://github.com/corny/dnscheck for -* https://namesmith.io -* https://github.com/miekg/unbound -* https://github.com/miekg/exdns -* https://dnslookup.org -* https://github.com/looterz/grimd -* https://github.com/phamhongviet/serf-dns -* https://github.com/mehrdadrad/mylg -* https://github.com/bamarni/dockness -* https://github.com/fffaraz/microdns -* http://kelda.io -* https://github.com/ipdcode/hades -* https://github.com/StackExchange/dnscontrol/ -* https://www.dnsperf.com/ -* https://dnssectest.net/ -* https://dns.apebits.com -* https://github.com/oif/apex -* https://github.com/jedisct1/dnscrypt-proxy -* https://github.com/jedisct1/rpdns -* https://github.com/xor-gate/sshfp -* https://github.com/rs/dnstrace -* https://blitiri.com.ar/p/dnss ([github mirror](https://github.com/albertito/dnss)) -* https://github.com/semihalev/sdns -* https://render.com -* https://github.com/peterzen/goresolver -* https://github.com/folbricht/routedns - -Send pull request if you want to be listed here. - -# Features - -* UDP/TCP queries, IPv4 and IPv6 -* RFC 1035 zone file parsing ($INCLUDE, $ORIGIN, $TTL and $GENERATE (for all record types) are supported -* Fast -* Server side programming (mimicking the net/http package) -* Client side programming -* DNSSEC: signing, validating and key generation for DSA, RSA, ECDSA and Ed25519 -* EDNS0, NSID, Cookies -* AXFR/IXFR -* TSIG, SIG(0) -* DNS over TLS (DoT): encrypted connection between client and server over TCP -* DNS name compression - -Have fun! - -Miek Gieben - 2010-2012 - -DNS Authors 2012- - -# Building - -Building is done with the `go` tool. If you have setup your GOPATH correctly, the following should -work: - - go get github.com/miekg/dns - go build github.com/miekg/dns - -## Examples - -A short "how to use the API" is at the beginning of doc.go (this also will show when you call `godoc -github.com/miekg/dns`). - -Example programs can be found in the `github.com/miekg/exdns` repository. - -## Supported RFCs - -*all of them* - -* 103{4,5} - DNS standard -* 1348 - NSAP record (removed the record) -* 1982 - Serial Arithmetic -* 1876 - LOC record -* 1995 - IXFR -* 1996 - DNS notify -* 2136 - DNS Update (dynamic updates) -* 2181 - RRset definition - there is no RRset type though, just []RR -* 2537 - RSAMD5 DNS keys -* 2065 - DNSSEC (updated in later RFCs) -* 2671 - EDNS record -* 2782 - SRV record -* 2845 - TSIG record -* 2915 - NAPTR record -* 2929 - DNS IANA Considerations -* 3110 - RSASHA1 DNS keys -* 3225 - DO bit (DNSSEC OK) -* 340{1,2,3} - NAPTR record -* 3445 - Limiting the scope of (DNS)KEY -* 3597 - Unknown RRs -* 403{3,4,5} - DNSSEC + validation functions -* 4255 - SSHFP record -* 4343 - Case insensitivity -* 4408 - SPF record -* 4509 - SHA256 Hash in DS -* 4592 - Wildcards in the DNS -* 4635 - HMAC SHA TSIG -* 4701 - DHCID -* 4892 - id.server -* 5001 - NSID -* 5155 - NSEC3 record -* 5205 - HIP record -* 5702 - SHA2 in the DNS -* 5936 - AXFR -* 5966 - TCP implementation recommendations -* 6605 - ECDSA -* 6725 - IANA Registry Update -* 6742 - ILNP DNS -* 6840 - Clarifications and Implementation Notes for DNS Security -* 6844 - CAA record -* 6891 - EDNS0 update -* 6895 - DNS IANA considerations -* 6944 - DNSSEC DNSKEY Algorithm Status -* 6975 - Algorithm Understanding in DNSSEC -* 7043 - EUI48/EUI64 records -* 7314 - DNS (EDNS) EXPIRE Option -* 7477 - CSYNC RR -* 7828 - edns-tcp-keepalive EDNS0 Option -* 7553 - URI record -* 7858 - DNS over TLS: Initiation and Performance Considerations -* 7871 - EDNS0 Client Subnet -* 7873 - Domain Name System (DNS) Cookies -* 8080 - EdDSA for DNSSEC -* 8499 - DNS Terminology - -## Loosely Based Upon - -* ldns - -* NSD - -* Net::DNS - -* GRONG - diff --git a/vendor/github.com/miekg/dns/acceptfunc.go b/vendor/github.com/miekg/dns/acceptfunc.go deleted file mode 100644 index 94e7c9d9..00000000 --- a/vendor/github.com/miekg/dns/acceptfunc.go +++ /dev/null @@ -1,53 +0,0 @@ -package dns - -// MsgAcceptFunc is used early in the server code to accept or reject a message with RcodeFormatError. -// It returns a MsgAcceptAction to indicate what should happen with the message. -type MsgAcceptFunc func(dh Header) MsgAcceptAction - -// DefaultMsgAcceptFunc checks the request and will reject if: -// -// * isn't a request (don't respond in that case). -// * opcode isn't OpcodeQuery or OpcodeNotify -// * Zero bit isn't zero -// * has more than 1 question in the question section -// * has more than 1 RR in the Answer section -// * has more than 0 RRs in the Authority section -// * has more than 2 RRs in the Additional section -var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc - -// MsgAcceptAction represents the action to be taken. -type MsgAcceptAction int - -const ( - MsgAccept MsgAcceptAction = iota // Accept the message - MsgReject // Reject the message with a RcodeFormatError - MsgIgnore // Ignore the error and send nothing back. -) - -func defaultMsgAcceptFunc(dh Header) MsgAcceptAction { - if isResponse := dh.Bits&_QR != 0; isResponse { - return MsgIgnore - } - - // Don't allow dynamic updates, because then the sections can contain a whole bunch of RRs. - opcode := int(dh.Bits>>11) & 0xF - if opcode != OpcodeQuery && opcode != OpcodeNotify { - return MsgReject - } - - if dh.Qdcount != 1 { - return MsgReject - } - // NOTIFY requests can have a SOA in the ANSWER section. See RFC 1996 Section 3.7 and 3.11. - if dh.Ancount > 1 { - return MsgReject - } - // IXFR request could have one SOA RR in the NS section. See RFC 1995, section 3. - if dh.Nscount > 1 { - return MsgReject - } - if dh.Arcount > 2 { - return MsgReject - } - return MsgAccept -} diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go deleted file mode 100644 index db2761d4..00000000 --- a/vendor/github.com/miekg/dns/client.go +++ /dev/null @@ -1,415 +0,0 @@ -package dns - -// A client implementation. - -import ( - "context" - "crypto/tls" - "encoding/binary" - "fmt" - "io" - "net" - "strings" - "time" -) - -const ( - dnsTimeout time.Duration = 2 * time.Second - tcpIdleTimeout time.Duration = 8 * time.Second -) - -// A Conn represents a connection to a DNS server. -type Conn struct { - net.Conn // a net.Conn holding the connection - UDPSize uint16 // minimum receive buffer for UDP messages - TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2) - tsigRequestMAC string -} - -// A Client defines parameters for a DNS client. -type Client struct { - Net string // if "tcp" or "tcp-tls" (DNS over TLS) a TCP query will be initiated, otherwise an UDP one (default is "" for UDP) - UDPSize uint16 // minimum receive buffer for UDP messages - TLSConfig *tls.Config // TLS connection configuration - Dialer *net.Dialer // a net.Dialer used to set local address, timeouts and more - // Timeout is a cumulative timeout for dial, write and read, defaults to 0 (disabled) - overrides DialTimeout, ReadTimeout, - // WriteTimeout when non-zero. Can be overridden with net.Dialer.Timeout (see Client.ExchangeWithDialer and - // Client.Dialer) or context.Context.Deadline (see the deprecated ExchangeContext) - Timeout time.Duration - DialTimeout time.Duration // net.DialTimeout, defaults to 2 seconds, or net.Dialer.Timeout if expiring earlier - overridden by Timeout when that value is non-zero - ReadTimeout time.Duration // net.Conn.SetReadTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero - WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero - TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2) - SingleInflight bool // if true suppress multiple outstanding queries for the same Qname, Qtype and Qclass - group singleflight -} - -// Exchange performs a synchronous UDP query. It sends the message m to the address -// contained in a and waits for a reply. Exchange does not retry a failed query, nor -// will it fall back to TCP in case of truncation. -// See client.Exchange for more information on setting larger buffer sizes. -func Exchange(m *Msg, a string) (r *Msg, err error) { - client := Client{Net: "udp"} - r, _, err = client.Exchange(m, a) - return r, err -} - -func (c *Client) dialTimeout() time.Duration { - if c.Timeout != 0 { - return c.Timeout - } - if c.DialTimeout != 0 { - return c.DialTimeout - } - return dnsTimeout -} - -func (c *Client) readTimeout() time.Duration { - if c.ReadTimeout != 0 { - return c.ReadTimeout - } - return dnsTimeout -} - -func (c *Client) writeTimeout() time.Duration { - if c.WriteTimeout != 0 { - return c.WriteTimeout - } - return dnsTimeout -} - -// Dial connects to the address on the named network. -func (c *Client) Dial(address string) (conn *Conn, err error) { - // create a new dialer with the appropriate timeout - var d net.Dialer - if c.Dialer == nil { - d = net.Dialer{Timeout: c.getTimeoutForRequest(c.dialTimeout())} - } else { - d = *c.Dialer - } - - network := c.Net - if network == "" { - network = "udp" - } - - useTLS := strings.HasPrefix(network, "tcp") && strings.HasSuffix(network, "-tls") - - conn = new(Conn) - if useTLS { - network = strings.TrimSuffix(network, "-tls") - - conn.Conn, err = tls.DialWithDialer(&d, network, address, c.TLSConfig) - } else { - conn.Conn, err = d.Dial(network, address) - } - if err != nil { - return nil, err - } - - return conn, nil -} - -// Exchange performs a synchronous query. It sends the message m to the address -// contained in a and waits for a reply. Basic use pattern with a *dns.Client: -// -// c := new(dns.Client) -// in, rtt, err := c.Exchange(message, "127.0.0.1:53") -// -// Exchange does not retry a failed query, nor will it fall back to TCP in -// case of truncation. -// It is up to the caller to create a message that allows for larger responses to be -// returned. Specifically this means adding an EDNS0 OPT RR that will advertise a larger -// buffer, see SetEdns0. Messages without an OPT RR will fallback to the historic limit -// of 512 bytes -// To specify a local address or a timeout, the caller has to set the `Client.Dialer` -// attribute appropriately -func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, err error) { - if !c.SingleInflight { - return c.exchange(m, address) - } - - q := m.Question[0] - key := fmt.Sprintf("%s:%d:%d", q.Name, q.Qtype, q.Qclass) - r, rtt, err, shared := c.group.Do(key, func() (*Msg, time.Duration, error) { - return c.exchange(m, address) - }) - if r != nil && shared { - r = r.Copy() - } - - return r, rtt, err -} - -func (c *Client) exchange(m *Msg, a string) (r *Msg, rtt time.Duration, err error) { - var co *Conn - - co, err = c.Dial(a) - - if err != nil { - return nil, 0, err - } - defer co.Close() - - opt := m.IsEdns0() - // If EDNS0 is used use that for size. - if opt != nil && opt.UDPSize() >= MinMsgSize { - co.UDPSize = opt.UDPSize() - } - // Otherwise use the client's configured UDP size. - if opt == nil && c.UDPSize >= MinMsgSize { - co.UDPSize = c.UDPSize - } - - co.TsigSecret = c.TsigSecret - t := time.Now() - // write with the appropriate write timeout - co.SetWriteDeadline(t.Add(c.getTimeoutForRequest(c.writeTimeout()))) - if err = co.WriteMsg(m); err != nil { - return nil, 0, err - } - - co.SetReadDeadline(time.Now().Add(c.getTimeoutForRequest(c.readTimeout()))) - r, err = co.ReadMsg() - if err == nil && r.Id != m.Id { - err = ErrId - } - rtt = time.Since(t) - return r, rtt, err -} - -// ReadMsg reads a message from the connection co. -// If the received message contains a TSIG record the transaction signature -// is verified. This method always tries to return the message, however if an -// error is returned there are no guarantees that the returned message is a -// valid representation of the packet read. -func (co *Conn) ReadMsg() (*Msg, error) { - p, err := co.ReadMsgHeader(nil) - if err != nil { - return nil, err - } - - m := new(Msg) - if err := m.Unpack(p); err != nil { - // If an error was returned, we still want to allow the user to use - // the message, but naively they can just check err if they don't want - // to use an erroneous message - return m, err - } - if t := m.IsTsig(); t != nil { - if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { - return m, ErrSecret - } - // Need to work on the original message p, as that was used to calculate the tsig. - err = TsigVerify(p, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) - } - return m, err -} - -// ReadMsgHeader reads a DNS message, parses and populates hdr (when hdr is not nil). -// Returns message as a byte slice to be parsed with Msg.Unpack later on. -// Note that error handling on the message body is not possible as only the header is parsed. -func (co *Conn) ReadMsgHeader(hdr *Header) ([]byte, error) { - var ( - p []byte - n int - err error - ) - - if _, ok := co.Conn.(net.PacketConn); ok { - if co.UDPSize > MinMsgSize { - p = make([]byte, co.UDPSize) - } else { - p = make([]byte, MinMsgSize) - } - n, err = co.Read(p) - } else { - var length uint16 - if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil { - return nil, err - } - - p = make([]byte, length) - n, err = io.ReadFull(co.Conn, p) - } - - if err != nil { - return nil, err - } else if n < headerSize { - return nil, ErrShortRead - } - - p = p[:n] - if hdr != nil { - dh, _, err := unpackMsgHdr(p, 0) - if err != nil { - return nil, err - } - *hdr = dh - } - return p, err -} - -// Read implements the net.Conn read method. -func (co *Conn) Read(p []byte) (n int, err error) { - if co.Conn == nil { - return 0, ErrConnEmpty - } - - if _, ok := co.Conn.(net.PacketConn); ok { - // UDP connection - return co.Conn.Read(p) - } - - var length uint16 - if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil { - return 0, err - } - if int(length) > len(p) { - return 0, io.ErrShortBuffer - } - - return io.ReadFull(co.Conn, p[:length]) -} - -// WriteMsg sends a message through the connection co. -// If the message m contains a TSIG record the transaction -// signature is calculated. -func (co *Conn) WriteMsg(m *Msg) (err error) { - var out []byte - if t := m.IsTsig(); t != nil { - mac := "" - if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { - return ErrSecret - } - out, mac, err = TsigGenerate(m, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) - // Set for the next read, although only used in zone transfers - co.tsigRequestMAC = mac - } else { - out, err = m.Pack() - } - if err != nil { - return err - } - _, err = co.Write(out) - return err -} - -// Write implements the net.Conn Write method. -func (co *Conn) Write(p []byte) (int, error) { - if len(p) > MaxMsgSize { - return 0, &Error{err: "message too large"} - } - - if _, ok := co.Conn.(net.PacketConn); ok { - return co.Conn.Write(p) - } - - l := make([]byte, 2) - binary.BigEndian.PutUint16(l, uint16(len(p))) - - n, err := (&net.Buffers{l, p}).WriteTo(co.Conn) - return int(n), err -} - -// Return the appropriate timeout for a specific request -func (c *Client) getTimeoutForRequest(timeout time.Duration) time.Duration { - var requestTimeout time.Duration - if c.Timeout != 0 { - requestTimeout = c.Timeout - } else { - requestTimeout = timeout - } - // net.Dialer.Timeout has priority if smaller than the timeouts computed so - // far - if c.Dialer != nil && c.Dialer.Timeout != 0 { - if c.Dialer.Timeout < requestTimeout { - requestTimeout = c.Dialer.Timeout - } - } - return requestTimeout -} - -// Dial connects to the address on the named network. -func Dial(network, address string) (conn *Conn, err error) { - conn = new(Conn) - conn.Conn, err = net.Dial(network, address) - if err != nil { - return nil, err - } - return conn, nil -} - -// ExchangeContext performs a synchronous UDP query, like Exchange. It -// additionally obeys deadlines from the passed Context. -func ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg, err error) { - client := Client{Net: "udp"} - r, _, err = client.ExchangeContext(ctx, m, a) - // ignorint rtt to leave the original ExchangeContext API unchanged, but - // this function will go away - return r, err -} - -// ExchangeConn performs a synchronous query. It sends the message m via the connection -// c and waits for a reply. The connection c is not closed by ExchangeConn. -// Deprecated: This function is going away, but can easily be mimicked: -// -// co := &dns.Conn{Conn: c} // c is your net.Conn -// co.WriteMsg(m) -// in, _ := co.ReadMsg() -// co.Close() -// -func ExchangeConn(c net.Conn, m *Msg) (r *Msg, err error) { - println("dns: ExchangeConn: this function is deprecated") - co := new(Conn) - co.Conn = c - if err = co.WriteMsg(m); err != nil { - return nil, err - } - r, err = co.ReadMsg() - if err == nil && r.Id != m.Id { - err = ErrId - } - return r, err -} - -// DialTimeout acts like Dial but takes a timeout. -func DialTimeout(network, address string, timeout time.Duration) (conn *Conn, err error) { - client := Client{Net: network, Dialer: &net.Dialer{Timeout: timeout}} - return client.Dial(address) -} - -// DialWithTLS connects to the address on the named network with TLS. -func DialWithTLS(network, address string, tlsConfig *tls.Config) (conn *Conn, err error) { - if !strings.HasSuffix(network, "-tls") { - network += "-tls" - } - client := Client{Net: network, TLSConfig: tlsConfig} - return client.Dial(address) -} - -// DialTimeoutWithTLS acts like DialWithTLS but takes a timeout. -func DialTimeoutWithTLS(network, address string, tlsConfig *tls.Config, timeout time.Duration) (conn *Conn, err error) { - if !strings.HasSuffix(network, "-tls") { - network += "-tls" - } - client := Client{Net: network, Dialer: &net.Dialer{Timeout: timeout}, TLSConfig: tlsConfig} - return client.Dial(address) -} - -// ExchangeContext acts like Exchange, but honors the deadline on the provided -// context, if present. If there is both a context deadline and a configured -// timeout on the client, the earliest of the two takes effect. -func (c *Client) ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg, rtt time.Duration, err error) { - var timeout time.Duration - if deadline, ok := ctx.Deadline(); !ok { - timeout = 0 - } else { - timeout = time.Until(deadline) - } - // 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. - // TODO(tmthrgd,miekg): this is a race condition. - c.Dialer = &net.Dialer{Timeout: timeout} - return c.Exchange(m, a) -} diff --git a/vendor/github.com/miekg/dns/clientconfig.go b/vendor/github.com/miekg/dns/clientconfig.go deleted file mode 100644 index e11b630d..00000000 --- a/vendor/github.com/miekg/dns/clientconfig.go +++ /dev/null @@ -1,135 +0,0 @@ -package dns - -import ( - "bufio" - "io" - "os" - "strconv" - "strings" -) - -// ClientConfig wraps the contents of the /etc/resolv.conf file. -type ClientConfig struct { - Servers []string // servers to use - Search []string // suffixes to append to local name - Port string // what port to use - Ndots int // number of dots in name to trigger absolute lookup - Timeout int // seconds before giving up on packet - Attempts int // lost packets before giving up on server, not used in the package dns -} - -// ClientConfigFromFile parses a resolv.conf(5) like file and returns -// a *ClientConfig. -func ClientConfigFromFile(resolvconf string) (*ClientConfig, error) { - file, err := os.Open(resolvconf) - if err != nil { - return nil, err - } - defer file.Close() - return ClientConfigFromReader(file) -} - -// ClientConfigFromReader works like ClientConfigFromFile but takes an io.Reader as argument -func ClientConfigFromReader(resolvconf io.Reader) (*ClientConfig, error) { - c := new(ClientConfig) - scanner := bufio.NewScanner(resolvconf) - c.Servers = make([]string, 0) - c.Search = make([]string, 0) - c.Port = "53" - c.Ndots = 1 - c.Timeout = 5 - c.Attempts = 2 - - for scanner.Scan() { - if err := scanner.Err(); err != nil { - return nil, err - } - line := scanner.Text() - f := strings.Fields(line) - if len(f) < 1 { - continue - } - switch f[0] { - case "nameserver": // add one name server - if len(f) > 1 { - // One more check: make sure server name is - // just an IP address. Otherwise we need DNS - // to look it up. - name := f[1] - c.Servers = append(c.Servers, name) - } - - case "domain": // set search path to just this domain - if len(f) > 1 { - c.Search = make([]string, 1) - c.Search[0] = f[1] - } else { - c.Search = make([]string, 0) - } - - case "search": // set search path to given servers - c.Search = append([]string(nil), f[1:]...) - - case "options": // magic options - for _, s := range f[1:] { - switch { - case len(s) >= 6 && s[:6] == "ndots:": - n, _ := strconv.Atoi(s[6:]) - if n < 0 { - n = 0 - } else if n > 15 { - n = 15 - } - c.Ndots = n - case len(s) >= 8 && s[:8] == "timeout:": - n, _ := strconv.Atoi(s[8:]) - if n < 1 { - n = 1 - } - c.Timeout = n - case len(s) >= 9 && s[:9] == "attempts:": - n, _ := strconv.Atoi(s[9:]) - if n < 1 { - n = 1 - } - c.Attempts = n - case s == "rotate": - /* not imp */ - } - } - } - } - return c, nil -} - -// NameList returns all of the names that should be queried based on the -// config. It is based off of go's net/dns name building, but it does not -// check the length of the resulting names. -func (c *ClientConfig) NameList(name string) []string { - // if this domain is already fully qualified, no append needed. - if IsFqdn(name) { - return []string{name} - } - - // Check to see if the name has more labels than Ndots. Do this before making - // the domain fully qualified. - hasNdots := CountLabel(name) > c.Ndots - // Make the domain fully qualified. - name = Fqdn(name) - - // Make a list of names based off search. - names := []string{} - - // If name has enough dots, try that first. - if hasNdots { - names = append(names, name) - } - for _, s := range c.Search { - names = append(names, Fqdn(name+s)) - } - // If we didn't have enough dots, try after suffixes. - if !hasNdots { - names = append(names, name) - } - return names -} diff --git a/vendor/github.com/miekg/dns/dane.go b/vendor/github.com/miekg/dns/dane.go deleted file mode 100644 index 8c4a14ef..00000000 --- a/vendor/github.com/miekg/dns/dane.go +++ /dev/null @@ -1,43 +0,0 @@ -package dns - -import ( - "crypto/sha256" - "crypto/sha512" - "crypto/x509" - "encoding/hex" - "errors" -) - -// CertificateToDANE converts a certificate to a hex string as used in the TLSA or SMIMEA records. -func CertificateToDANE(selector, matchingType uint8, cert *x509.Certificate) (string, error) { - switch matchingType { - case 0: - switch selector { - case 0: - return hex.EncodeToString(cert.Raw), nil - case 1: - return hex.EncodeToString(cert.RawSubjectPublicKeyInfo), nil - } - case 1: - h := sha256.New() - switch selector { - case 0: - h.Write(cert.Raw) - return hex.EncodeToString(h.Sum(nil)), nil - case 1: - h.Write(cert.RawSubjectPublicKeyInfo) - return hex.EncodeToString(h.Sum(nil)), nil - } - case 2: - h := sha512.New() - switch selector { - case 0: - h.Write(cert.Raw) - return hex.EncodeToString(h.Sum(nil)), nil - case 1: - h.Write(cert.RawSubjectPublicKeyInfo) - return hex.EncodeToString(h.Sum(nil)), nil - } - } - return "", errors.New("dns: bad MatchingType or Selector") -} diff --git a/vendor/github.com/miekg/dns/defaults.go b/vendor/github.com/miekg/dns/defaults.go deleted file mode 100644 index b059f6fc..00000000 --- a/vendor/github.com/miekg/dns/defaults.go +++ /dev/null @@ -1,378 +0,0 @@ -package dns - -import ( - "errors" - "net" - "strconv" - "strings" -) - -const hexDigit = "0123456789abcdef" - -// Everything is assumed in ClassINET. - -// SetReply creates a reply message from a request message. -func (dns *Msg) SetReply(request *Msg) *Msg { - dns.Id = request.Id - dns.Response = true - dns.Opcode = request.Opcode - if dns.Opcode == OpcodeQuery { - dns.RecursionDesired = request.RecursionDesired // Copy rd bit - dns.CheckingDisabled = request.CheckingDisabled // Copy cd bit - } - dns.Rcode = RcodeSuccess - if len(request.Question) > 0 { - dns.Question = make([]Question, 1) - dns.Question[0] = request.Question[0] - } - return dns -} - -// SetQuestion creates a question message, it sets the Question -// section, generates an Id and sets the RecursionDesired (RD) -// bit to true. -func (dns *Msg) SetQuestion(z string, t uint16) *Msg { - dns.Id = Id() - dns.RecursionDesired = true - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, t, ClassINET} - return dns -} - -// SetNotify creates a notify message, it sets the Question -// section, generates an Id and sets the Authoritative (AA) -// bit to true. -func (dns *Msg) SetNotify(z string) *Msg { - dns.Opcode = OpcodeNotify - dns.Authoritative = true - dns.Id = Id() - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, TypeSOA, ClassINET} - return dns -} - -// SetRcode creates an error message suitable for the request. -func (dns *Msg) SetRcode(request *Msg, rcode int) *Msg { - dns.SetReply(request) - dns.Rcode = rcode - return dns -} - -// SetRcodeFormatError creates a message with FormError set. -func (dns *Msg) SetRcodeFormatError(request *Msg) *Msg { - dns.Rcode = RcodeFormatError - dns.Opcode = OpcodeQuery - dns.Response = true - dns.Authoritative = false - dns.Id = request.Id - return dns -} - -// SetUpdate makes the message a dynamic update message. It -// sets the ZONE section to: z, TypeSOA, ClassINET. -func (dns *Msg) SetUpdate(z string) *Msg { - dns.Id = Id() - dns.Response = false - dns.Opcode = OpcodeUpdate - dns.Compress = false // BIND9 cannot handle compression - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, TypeSOA, ClassINET} - return dns -} - -// SetIxfr creates message for requesting an IXFR. -func (dns *Msg) SetIxfr(z string, serial uint32, ns, mbox string) *Msg { - dns.Id = Id() - dns.Question = make([]Question, 1) - dns.Ns = make([]RR, 1) - s := new(SOA) - s.Hdr = RR_Header{z, TypeSOA, ClassINET, defaultTtl, 0} - s.Serial = serial - s.Ns = ns - s.Mbox = mbox - dns.Question[0] = Question{z, TypeIXFR, ClassINET} - dns.Ns[0] = s - return dns -} - -// SetAxfr creates message for requesting an AXFR. -func (dns *Msg) SetAxfr(z string) *Msg { - dns.Id = Id() - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, TypeAXFR, ClassINET} - return dns -} - -// SetTsig appends a TSIG RR to the message. -// This is only a skeleton TSIG RR that is added as the last RR in the -// additional section. The Tsig is calculated when the message is being send. -func (dns *Msg) SetTsig(z, algo string, fudge uint16, timesigned int64) *Msg { - t := new(TSIG) - t.Hdr = RR_Header{z, TypeTSIG, ClassANY, 0, 0} - t.Algorithm = algo - t.Fudge = fudge - t.TimeSigned = uint64(timesigned) - t.OrigId = dns.Id - dns.Extra = append(dns.Extra, t) - return dns -} - -// SetEdns0 appends a EDNS0 OPT RR to the message. -// TSIG should always the last RR in a message. -func (dns *Msg) SetEdns0(udpsize uint16, do bool) *Msg { - e := new(OPT) - e.Hdr.Name = "." - e.Hdr.Rrtype = TypeOPT - e.SetUDPSize(udpsize) - if do { - e.SetDo() - } - dns.Extra = append(dns.Extra, e) - return dns -} - -// IsTsig checks if the message has a TSIG record as the last record -// in the additional section. It returns the TSIG record found or nil. -func (dns *Msg) IsTsig() *TSIG { - if len(dns.Extra) > 0 { - if dns.Extra[len(dns.Extra)-1].Header().Rrtype == TypeTSIG { - return dns.Extra[len(dns.Extra)-1].(*TSIG) - } - } - return nil -} - -// IsEdns0 checks if the message has a EDNS0 (OPT) record, any EDNS0 -// record in the additional section will do. It returns the OPT record -// found or nil. -func (dns *Msg) IsEdns0() *OPT { - // RFC 6891, Section 6.1.1 allows the OPT record to appear - // anywhere in the additional record section, but it's usually at - // the end so start there. - for i := len(dns.Extra) - 1; i >= 0; i-- { - if dns.Extra[i].Header().Rrtype == TypeOPT { - return dns.Extra[i].(*OPT) - } - } - return nil -} - -// popEdns0 is like IsEdns0, but it removes the record from the message. -func (dns *Msg) popEdns0() *OPT { - // RFC 6891, Section 6.1.1 allows the OPT record to appear - // anywhere in the additional record section, but it's usually at - // the end so start there. - for i := len(dns.Extra) - 1; i >= 0; i-- { - if dns.Extra[i].Header().Rrtype == TypeOPT { - opt := dns.Extra[i].(*OPT) - dns.Extra = append(dns.Extra[:i], dns.Extra[i+1:]...) - return opt - } - } - return nil -} - -// IsDomainName checks if s is a valid domain name, it returns the number of -// labels and true, when a domain name is valid. Note that non fully qualified -// domain name is considered valid, in this case the last label is counted in -// the number of labels. When false is returned the number of labels is not -// defined. Also note that this function is extremely liberal; almost any -// string is a valid domain name as the DNS is 8 bit protocol. It checks if each -// label fits in 63 characters and that the entire name will fit into the 255 -// octet wire format limit. -func IsDomainName(s string) (labels int, ok bool) { - // XXX: The logic in this function was copied from packDomainName and - // should be kept in sync with that function. - - const lenmsg = 256 - - if len(s) == 0 { // Ok, for instance when dealing with update RR without any rdata. - return 0, false - } - - s = Fqdn(s) - - // Each dot ends a segment of the name. Except for escaped dots (\.), which - // are normal dots. - - var ( - off int - begin int - wasDot bool - ) - for i := 0; i < len(s); i++ { - switch s[i] { - case '\\': - if off+1 > lenmsg { - return labels, false - } - - // check for \DDD - if i+3 < len(s) && isDigit(s[i+1]) && isDigit(s[i+2]) && isDigit(s[i+3]) { - i += 3 - begin += 3 - } else { - i++ - begin++ - } - - wasDot = false - case '.': - if wasDot { - // two dots back to back is not legal - return labels, false - } - wasDot = true - - labelLen := i - begin - if labelLen >= 1<<6 { // top two bits of length must be clear - return labels, false - } - - // off can already (we're in a loop) be bigger than lenmsg - // this happens when a name isn't fully qualified - off += 1 + labelLen - if off > lenmsg { - return labels, false - } - - labels++ - begin = i + 1 - default: - wasDot = false - } - } - - return labels, true -} - -// IsSubDomain checks if child is indeed a child of the parent. If child and parent -// are the same domain true is returned as well. -func IsSubDomain(parent, child string) bool { - // Entire child is contained in parent - return CompareDomainName(parent, child) == CountLabel(parent) -} - -// IsMsg sanity checks buf and returns an error if it isn't a valid DNS packet. -// The checking is performed on the binary payload. -func IsMsg(buf []byte) error { - // Header - if len(buf) < headerSize { - return errors.New("dns: bad message header") - } - // Header: Opcode - // TODO(miek): more checks here, e.g. check all header bits. - return nil -} - -// IsFqdn checks if a domain name is fully qualified. -func IsFqdn(s string) bool { - s2 := strings.TrimSuffix(s, ".") - if s == s2 { - return false - } - - i := strings.LastIndexFunc(s2, func(r rune) bool { - return r != '\\' - }) - - // Test whether we have an even number of escape sequences before - // the dot or none. - return (len(s2)-i)%2 != 0 -} - -// IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181. -// This means the RRs need to have the same type, name, and class. Returns true -// if the RR set is valid, otherwise false. -func IsRRset(rrset []RR) bool { - if len(rrset) == 0 { - return false - } - if len(rrset) == 1 { - return true - } - rrHeader := rrset[0].Header() - rrType := rrHeader.Rrtype - rrClass := rrHeader.Class - rrName := rrHeader.Name - - for _, rr := range rrset[1:] { - curRRHeader := rr.Header() - if curRRHeader.Rrtype != rrType || curRRHeader.Class != rrClass || curRRHeader.Name != rrName { - // Mismatch between the records, so this is not a valid rrset for - //signing/verifying - return false - } - } - - return true -} - -// Fqdn return the fully qualified domain name from s. -// If s is already fully qualified, it behaves as the identity function. -func Fqdn(s string) string { - if IsFqdn(s) { - return s - } - return s + "." -} - -// Copied from the official Go code. - -// ReverseAddr returns the in-addr.arpa. or ip6.arpa. hostname of the IP -// address suitable for reverse DNS (PTR) record lookups or an error if it fails -// to parse the IP address. -func ReverseAddr(addr string) (arpa string, err error) { - ip := net.ParseIP(addr) - if ip == nil { - return "", &Error{err: "unrecognized address: " + addr} - } - if v4 := ip.To4(); v4 != nil { - buf := make([]byte, 0, net.IPv4len*4+len("in-addr.arpa.")) - // Add it, in reverse, to the buffer - for i := len(v4) - 1; i >= 0; i-- { - buf = strconv.AppendInt(buf, int64(v4[i]), 10) - buf = append(buf, '.') - } - // Append "in-addr.arpa." and return (buf already has the final .) - buf = append(buf, "in-addr.arpa."...) - return string(buf), nil - } - // Must be IPv6 - buf := make([]byte, 0, net.IPv6len*4+len("ip6.arpa.")) - // Add it, in reverse, to the buffer - for i := len(ip) - 1; i >= 0; i-- { - v := ip[i] - buf = append(buf, hexDigit[v&0xF]) - buf = append(buf, '.') - buf = append(buf, hexDigit[v>>4]) - buf = append(buf, '.') - } - // Append "ip6.arpa." and return (buf already has the final .) - buf = append(buf, "ip6.arpa."...) - return string(buf), nil -} - -// String returns the string representation for the type t. -func (t Type) String() string { - if t1, ok := TypeToString[uint16(t)]; ok { - return t1 - } - return "TYPE" + strconv.Itoa(int(t)) -} - -// String returns the string representation for the class c. -func (c Class) String() string { - if s, ok := ClassToString[uint16(c)]; ok { - // Only emit mnemonics when they are unambiguous, specically ANY is in both. - if _, ok := StringToType[s]; !ok { - return s - } - } - return "CLASS" + strconv.Itoa(int(c)) -} - -// String returns the string representation for the name n. -func (n Name) String() string { - return sprintName(string(n)) -} diff --git a/vendor/github.com/miekg/dns/dns.go b/vendor/github.com/miekg/dns/dns.go deleted file mode 100644 index ad83a27e..00000000 --- a/vendor/github.com/miekg/dns/dns.go +++ /dev/null @@ -1,134 +0,0 @@ -package dns - -import "strconv" - -const ( - year68 = 1 << 31 // For RFC1982 (Serial Arithmetic) calculations in 32 bits. - defaultTtl = 3600 // Default internal TTL. - - // DefaultMsgSize is the standard default for messages larger than 512 bytes. - DefaultMsgSize = 4096 - // MinMsgSize is the minimal size of a DNS packet. - MinMsgSize = 512 - // MaxMsgSize is the largest possible DNS packet. - MaxMsgSize = 65535 -) - -// Error represents a DNS error. -type Error struct{ err string } - -func (e *Error) Error() string { - if e == nil { - return "dns: " - } - return "dns: " + e.err -} - -// An RR represents a resource record. -type RR interface { - // Header returns the header of an resource record. The header contains - // everything up to the rdata. - Header() *RR_Header - // String returns the text representation of the resource record. - String() string - - // copy returns a copy of the RR - copy() RR - - // len returns the length (in octets) of the compressed or uncompressed RR in wire format. - // - // If compression is nil, the uncompressed size will be returned, otherwise the compressed - // size will be returned and domain names will be added to the map for future compression. - len(off int, compression map[string]struct{}) int - - // pack packs the records RDATA into wire format. The header will - // already have been packed into msg. - pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) - - // unpack unpacks an RR from wire format. - // - // This will only be called on a new and empty RR type with only the header populated. It - // will only be called if the record's RDATA is non-empty. - unpack(msg []byte, off int) (off1 int, err error) - - // parse parses an RR from zone file format. - // - // This will only be called on a new and empty RR type with only the header populated. - parse(c *zlexer, origin string) *ParseError - - // isDuplicate returns whether the two RRs are duplicates. - isDuplicate(r2 RR) bool -} - -// RR_Header is the header all DNS resource records share. -type RR_Header struct { - Name string `dns:"cdomain-name"` - Rrtype uint16 - Class uint16 - Ttl uint32 - Rdlength uint16 // Length of data after header. -} - -// Header returns itself. This is here to make RR_Header implements the RR interface. -func (h *RR_Header) Header() *RR_Header { return h } - -// Just to implement the RR interface. -func (h *RR_Header) copy() RR { return nil } - -func (h *RR_Header) String() string { - var s string - - if h.Rrtype == TypeOPT { - s = ";" - // and maybe other things - } - - s += sprintName(h.Name) + "\t" - s += strconv.FormatInt(int64(h.Ttl), 10) + "\t" - s += Class(h.Class).String() + "\t" - s += Type(h.Rrtype).String() + "\t" - return s -} - -func (h *RR_Header) len(off int, compression map[string]struct{}) int { - l := domainNameLen(h.Name, off, compression, true) - l += 10 // rrtype(2) + class(2) + ttl(4) + rdlength(2) - return l -} - -func (h *RR_Header) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - // RR_Header has no RDATA to pack. - return off, nil -} - -func (h *RR_Header) unpack(msg []byte, off int) (int, error) { - panic("dns: internal error: unpack should never be called on RR_Header") -} - -func (h *RR_Header) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on RR_Header") -} - -// ToRFC3597 converts a known RR to the unknown RR representation from RFC 3597. -func (rr *RFC3597) ToRFC3597(r RR) error { - buf := make([]byte, Len(r)*2) - headerEnd, off, err := packRR(r, buf, 0, compressionMap{}, false) - if err != nil { - return err - } - buf = buf[:off] - - *rr = RFC3597{Hdr: *r.Header()} - rr.Hdr.Rdlength = uint16(off - headerEnd) - - if noRdata(rr.Hdr) { - return nil - } - - _, err = rr.unpack(buf, headerEnd) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/miekg/dns/dnssec.go b/vendor/github.com/miekg/dns/dnssec.go deleted file mode 100644 index 12a693f9..00000000 --- a/vendor/github.com/miekg/dns/dnssec.go +++ /dev/null @@ -1,794 +0,0 @@ -package dns - -import ( - "bytes" - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - _ "crypto/md5" - "crypto/rand" - "crypto/rsa" - _ "crypto/sha1" - _ "crypto/sha256" - _ "crypto/sha512" - "encoding/asn1" - "encoding/binary" - "encoding/hex" - "math/big" - "sort" - "strings" - "time" - - "golang.org/x/crypto/ed25519" -) - -// DNSSEC encryption algorithm codes. -const ( - _ uint8 = iota - RSAMD5 - DH - DSA - _ // Skip 4, RFC 6725, section 2.1 - RSASHA1 - DSANSEC3SHA1 - RSASHA1NSEC3SHA1 - RSASHA256 - _ // Skip 9, RFC 6725, section 2.1 - RSASHA512 - _ // Skip 11, RFC 6725, section 2.1 - ECCGOST - ECDSAP256SHA256 - ECDSAP384SHA384 - ED25519 - ED448 - INDIRECT uint8 = 252 - PRIVATEDNS uint8 = 253 // Private (experimental keys) - PRIVATEOID uint8 = 254 -) - -// AlgorithmToString is a map of algorithm IDs to algorithm names. -var AlgorithmToString = map[uint8]string{ - RSAMD5: "RSAMD5", - DH: "DH", - DSA: "DSA", - RSASHA1: "RSASHA1", - DSANSEC3SHA1: "DSA-NSEC3-SHA1", - RSASHA1NSEC3SHA1: "RSASHA1-NSEC3-SHA1", - RSASHA256: "RSASHA256", - RSASHA512: "RSASHA512", - ECCGOST: "ECC-GOST", - ECDSAP256SHA256: "ECDSAP256SHA256", - ECDSAP384SHA384: "ECDSAP384SHA384", - ED25519: "ED25519", - ED448: "ED448", - INDIRECT: "INDIRECT", - PRIVATEDNS: "PRIVATEDNS", - PRIVATEOID: "PRIVATEOID", -} - -// AlgorithmToHash is a map of algorithm crypto hash IDs to crypto.Hash's. -var AlgorithmToHash = map[uint8]crypto.Hash{ - RSAMD5: crypto.MD5, // Deprecated in RFC 6725 - DSA: crypto.SHA1, - RSASHA1: crypto.SHA1, - RSASHA1NSEC3SHA1: crypto.SHA1, - RSASHA256: crypto.SHA256, - ECDSAP256SHA256: crypto.SHA256, - ECDSAP384SHA384: crypto.SHA384, - RSASHA512: crypto.SHA512, - ED25519: crypto.Hash(0), -} - -// DNSSEC hashing algorithm codes. -const ( - _ uint8 = iota - SHA1 // RFC 4034 - SHA256 // RFC 4509 - GOST94 // RFC 5933 - SHA384 // Experimental - SHA512 // Experimental -) - -// HashToString is a map of hash IDs to names. -var HashToString = map[uint8]string{ - SHA1: "SHA1", - SHA256: "SHA256", - GOST94: "GOST94", - SHA384: "SHA384", - SHA512: "SHA512", -} - -// DNSKEY flag values. -const ( - SEP = 1 - REVOKE = 1 << 7 - ZONE = 1 << 8 -) - -// The RRSIG needs to be converted to wireformat with some of the rdata (the signature) missing. -type rrsigWireFmt struct { - TypeCovered uint16 - Algorithm uint8 - Labels uint8 - OrigTtl uint32 - Expiration uint32 - Inception uint32 - KeyTag uint16 - SignerName string `dns:"domain-name"` - /* No Signature */ -} - -// Used for converting DNSKEY's rdata to wirefmt. -type dnskeyWireFmt struct { - Flags uint16 - Protocol uint8 - Algorithm uint8 - PublicKey string `dns:"base64"` - /* Nothing is left out */ -} - -func divRoundUp(a, b int) int { - return (a + b - 1) / b -} - -// KeyTag calculates the keytag (or key-id) of the DNSKEY. -func (k *DNSKEY) KeyTag() uint16 { - if k == nil { - return 0 - } - var keytag int - switch k.Algorithm { - case RSAMD5: - // Look at the bottom two bytes of the modules, which the last - // item in the pubkey. - // This algorithm has been deprecated, but keep this key-tag calculation. - modulus, _ := fromBase64([]byte(k.PublicKey)) - if len(modulus) > 1 { - x := binary.BigEndian.Uint16(modulus[len(modulus)-2:]) - keytag = int(x) - } - default: - keywire := new(dnskeyWireFmt) - keywire.Flags = k.Flags - keywire.Protocol = k.Protocol - keywire.Algorithm = k.Algorithm - keywire.PublicKey = k.PublicKey - wire := make([]byte, DefaultMsgSize) - n, err := packKeyWire(keywire, wire) - if err != nil { - return 0 - } - wire = wire[:n] - for i, v := range wire { - if i&1 != 0 { - keytag += int(v) // must be larger than uint32 - } else { - keytag += int(v) << 8 - } - } - keytag += keytag >> 16 & 0xFFFF - keytag &= 0xFFFF - } - return uint16(keytag) -} - -// ToDS converts a DNSKEY record to a DS record. -func (k *DNSKEY) ToDS(h uint8) *DS { - if k == nil { - return nil - } - ds := new(DS) - ds.Hdr.Name = k.Hdr.Name - ds.Hdr.Class = k.Hdr.Class - ds.Hdr.Rrtype = TypeDS - ds.Hdr.Ttl = k.Hdr.Ttl - ds.Algorithm = k.Algorithm - ds.DigestType = h - ds.KeyTag = k.KeyTag() - - keywire := new(dnskeyWireFmt) - keywire.Flags = k.Flags - keywire.Protocol = k.Protocol - keywire.Algorithm = k.Algorithm - keywire.PublicKey = k.PublicKey - wire := make([]byte, DefaultMsgSize) - n, err := packKeyWire(keywire, wire) - if err != nil { - return nil - } - wire = wire[:n] - - owner := make([]byte, 255) - off, err1 := PackDomainName(strings.ToLower(k.Hdr.Name), owner, 0, nil, false) - if err1 != nil { - return nil - } - owner = owner[:off] - // RFC4034: - // digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA); - // "|" denotes concatenation - // DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key. - - var hash crypto.Hash - switch h { - case SHA1: - hash = crypto.SHA1 - case SHA256: - hash = crypto.SHA256 - case SHA384: - hash = crypto.SHA384 - case SHA512: - hash = crypto.SHA512 - default: - return nil - } - - s := hash.New() - s.Write(owner) - s.Write(wire) - ds.Digest = hex.EncodeToString(s.Sum(nil)) - return ds -} - -// ToCDNSKEY converts a DNSKEY record to a CDNSKEY record. -func (k *DNSKEY) ToCDNSKEY() *CDNSKEY { - c := &CDNSKEY{DNSKEY: *k} - c.Hdr = k.Hdr - c.Hdr.Rrtype = TypeCDNSKEY - return c -} - -// ToCDS converts a DS record to a CDS record. -func (d *DS) ToCDS() *CDS { - c := &CDS{DS: *d} - c.Hdr = d.Hdr - c.Hdr.Rrtype = TypeCDS - return c -} - -// Sign signs an RRSet. The signature needs to be filled in with the values: -// Inception, Expiration, KeyTag, SignerName and Algorithm. The rest is copied -// from the RRset. Sign returns a non-nill error when the signing went OK. -// There is no check if RRSet is a proper (RFC 2181) RRSet. If OrigTTL is non -// zero, it is used as-is, otherwise the TTL of the RRset is used as the -// OrigTTL. -func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error { - if k == nil { - return ErrPrivKey - } - // s.Inception and s.Expiration may be 0 (rollover etc.), the rest must be set - if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 { - return ErrKey - } - - h0 := rrset[0].Header() - rr.Hdr.Rrtype = TypeRRSIG - rr.Hdr.Name = h0.Name - rr.Hdr.Class = h0.Class - if rr.OrigTtl == 0 { // If set don't override - rr.OrigTtl = h0.Ttl - } - rr.TypeCovered = h0.Rrtype - rr.Labels = uint8(CountLabel(h0.Name)) - - if strings.HasPrefix(h0.Name, "*") { - rr.Labels-- // wildcard, remove from label count - } - - sigwire := new(rrsigWireFmt) - sigwire.TypeCovered = rr.TypeCovered - sigwire.Algorithm = rr.Algorithm - sigwire.Labels = rr.Labels - sigwire.OrigTtl = rr.OrigTtl - sigwire.Expiration = rr.Expiration - sigwire.Inception = rr.Inception - sigwire.KeyTag = rr.KeyTag - // For signing, lowercase this name - sigwire.SignerName = strings.ToLower(rr.SignerName) - - // Create the desired binary blob - signdata := make([]byte, DefaultMsgSize) - n, err := packSigWire(sigwire, signdata) - if err != nil { - return err - } - signdata = signdata[:n] - wire, err := rawSignatureData(rrset, rr) - if err != nil { - return err - } - - hash, ok := AlgorithmToHash[rr.Algorithm] - if !ok { - return ErrAlg - } - - switch rr.Algorithm { - case ED25519: - // ed25519 signs the raw message and performs hashing internally. - // All other supported signature schemes operate over the pre-hashed - // message, and thus ed25519 must be handled separately here. - // - // The raw message is passed directly into sign and crypto.Hash(0) is - // used to signal to the crypto.Signer that the data has not been hashed. - signature, err := sign(k, append(signdata, wire...), crypto.Hash(0), rr.Algorithm) - if err != nil { - return err - } - - rr.Signature = toBase64(signature) - case RSAMD5, DSA, DSANSEC3SHA1: - // See RFC 6944. - return ErrAlg - default: - h := hash.New() - h.Write(signdata) - h.Write(wire) - - signature, err := sign(k, h.Sum(nil), hash, rr.Algorithm) - if err != nil { - return err - } - - rr.Signature = toBase64(signature) - } - - return nil -} - -func sign(k crypto.Signer, hashed []byte, hash crypto.Hash, alg uint8) ([]byte, error) { - signature, err := k.Sign(rand.Reader, hashed, hash) - if err != nil { - return nil, err - } - - switch alg { - case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512: - return signature, nil - - case ECDSAP256SHA256, ECDSAP384SHA384: - ecdsaSignature := &struct { - R, S *big.Int - }{} - if _, err := asn1.Unmarshal(signature, ecdsaSignature); err != nil { - return nil, err - } - - var intlen int - switch alg { - case ECDSAP256SHA256: - intlen = 32 - case ECDSAP384SHA384: - intlen = 48 - } - - signature := intToBytes(ecdsaSignature.R, intlen) - signature = append(signature, intToBytes(ecdsaSignature.S, intlen)...) - return signature, nil - - // There is no defined interface for what a DSA backed crypto.Signer returns - case DSA, DSANSEC3SHA1: - // t := divRoundUp(divRoundUp(p.PublicKey.Y.BitLen(), 8)-64, 8) - // signature := []byte{byte(t)} - // signature = append(signature, intToBytes(r1, 20)...) - // signature = append(signature, intToBytes(s1, 20)...) - // rr.Signature = signature - - case ED25519: - return signature, nil - } - - return nil, ErrAlg -} - -// Verify validates an RRSet with the signature and key. This is only the -// cryptographic test, the signature validity period must be checked separately. -// This function copies the rdata of some RRs (to lowercase domain names) for the validation to work. -func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { - // First the easy checks - if !IsRRset(rrset) { - return ErrRRset - } - if rr.KeyTag != k.KeyTag() { - return ErrKey - } - if rr.Hdr.Class != k.Hdr.Class { - return ErrKey - } - if rr.Algorithm != k.Algorithm { - return ErrKey - } - if !strings.EqualFold(rr.SignerName, k.Hdr.Name) { - return ErrKey - } - if k.Protocol != 3 { - return ErrKey - } - - // IsRRset checked that we have at least one RR and that the RRs in - // the set have consistent type, class, and name. Also check that type and - // class matches the RRSIG record. - if h0 := rrset[0].Header(); h0.Class != rr.Hdr.Class || h0.Rrtype != rr.TypeCovered { - return ErrRRset - } - - // RFC 4035 5.3.2. Reconstructing the Signed Data - // Copy the sig, except the rrsig data - sigwire := new(rrsigWireFmt) - sigwire.TypeCovered = rr.TypeCovered - sigwire.Algorithm = rr.Algorithm - sigwire.Labels = rr.Labels - sigwire.OrigTtl = rr.OrigTtl - sigwire.Expiration = rr.Expiration - sigwire.Inception = rr.Inception - sigwire.KeyTag = rr.KeyTag - sigwire.SignerName = strings.ToLower(rr.SignerName) - // Create the desired binary blob - signeddata := make([]byte, DefaultMsgSize) - n, err := packSigWire(sigwire, signeddata) - if err != nil { - return err - } - signeddata = signeddata[:n] - wire, err := rawSignatureData(rrset, rr) - if err != nil { - return err - } - - sigbuf := rr.sigBuf() // Get the binary signature data - if rr.Algorithm == PRIVATEDNS { // PRIVATEOID - // TODO(miek) - // remove the domain name and assume its ours? - } - - hash, ok := AlgorithmToHash[rr.Algorithm] - if !ok { - return ErrAlg - } - - switch rr.Algorithm { - case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512, RSAMD5: - // TODO(mg): this can be done quicker, ie. cache the pubkey data somewhere?? - pubkey := k.publicKeyRSA() // Get the key - if pubkey == nil { - return ErrKey - } - - h := hash.New() - h.Write(signeddata) - h.Write(wire) - return rsa.VerifyPKCS1v15(pubkey, hash, h.Sum(nil), sigbuf) - - case ECDSAP256SHA256, ECDSAP384SHA384: - pubkey := k.publicKeyECDSA() - if pubkey == nil { - return ErrKey - } - - // Split sigbuf into the r and s coordinates - r := new(big.Int).SetBytes(sigbuf[:len(sigbuf)/2]) - s := new(big.Int).SetBytes(sigbuf[len(sigbuf)/2:]) - - h := hash.New() - h.Write(signeddata) - h.Write(wire) - if ecdsa.Verify(pubkey, h.Sum(nil), r, s) { - return nil - } - return ErrSig - - case ED25519: - pubkey := k.publicKeyED25519() - if pubkey == nil { - return ErrKey - } - - if ed25519.Verify(pubkey, append(signeddata, wire...), sigbuf) { - return nil - } - return ErrSig - - default: - return ErrAlg - } -} - -// ValidityPeriod uses RFC1982 serial arithmetic to calculate -// if a signature period is valid. If t is the zero time, the -// current time is taken other t is. Returns true if the signature -// is valid at the given time, otherwise returns false. -func (rr *RRSIG) ValidityPeriod(t time.Time) bool { - var utc int64 - if t.IsZero() { - utc = time.Now().UTC().Unix() - } else { - utc = t.UTC().Unix() - } - modi := (int64(rr.Inception) - utc) / year68 - mode := (int64(rr.Expiration) - utc) / year68 - ti := int64(rr.Inception) + modi*year68 - te := int64(rr.Expiration) + mode*year68 - return ti <= utc && utc <= te -} - -// Return the signatures base64 encodedig sigdata as a byte slice. -func (rr *RRSIG) sigBuf() []byte { - sigbuf, err := fromBase64([]byte(rr.Signature)) - if err != nil { - return nil - } - return sigbuf -} - -// publicKeyRSA returns the RSA public key from a DNSKEY record. -func (k *DNSKEY) publicKeyRSA() *rsa.PublicKey { - keybuf, err := fromBase64([]byte(k.PublicKey)) - if err != 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 - // Length is in the 0th byte, unless its zero, then it - // it in bytes 1 and 2 and its a 16 bit number - explen := uint16(keybuf[0]) - keyoff := 1 - if explen == 0 { - explen = uint16(keybuf[1])<<8 | uint16(keybuf[2]) - keyoff = 3 - } - - if explen > 4 || explen == 0 || keybuf[keyoff] == 0 { - // Exponent larger than supported by the crypto package, - // empty, or contains prohibited leading zero. - 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) - - var expo uint64 - // The exponent of length explen is between keyoff and modoff. - for _, v := range keybuf[keyoff:modoff] { - expo <<= 8 - expo |= uint64(v) - } - if expo > 1<<31-1 { - // Larger exponent than supported by the crypto package. - return nil - } - - pubkey.E = int(expo) - pubkey.N = new(big.Int).SetBytes(keybuf[modoff:]) - return pubkey -} - -// publicKeyECDSA returns the Curve public key from the DNSKEY record. -func (k *DNSKEY) publicKeyECDSA() *ecdsa.PublicKey { - keybuf, err := fromBase64([]byte(k.PublicKey)) - if err != nil { - return nil - } - pubkey := new(ecdsa.PublicKey) - switch k.Algorithm { - case ECDSAP256SHA256: - pubkey.Curve = elliptic.P256() - if len(keybuf) != 64 { - // wrongly encoded key - return nil - } - case ECDSAP384SHA384: - pubkey.Curve = elliptic.P384() - if len(keybuf) != 96 { - // Wrongly encoded key - return nil - } - } - pubkey.X = new(big.Int).SetBytes(keybuf[:len(keybuf)/2]) - pubkey.Y = new(big.Int).SetBytes(keybuf[len(keybuf)/2:]) - return pubkey -} - -func (k *DNSKEY) publicKeyDSA() *dsa.PublicKey { - keybuf, err := fromBase64([]byte(k.PublicKey)) - if err != nil { - return nil - } - if len(keybuf) < 22 { - return nil - } - t, keybuf := int(keybuf[0]), keybuf[1:] - size := 64 + t*8 - q, keybuf := keybuf[:20], keybuf[20:] - if len(keybuf) != 3*size { - return nil - } - p, keybuf := keybuf[:size], keybuf[size:] - g, y := keybuf[:size], keybuf[size:] - pubkey := new(dsa.PublicKey) - pubkey.Parameters.Q = new(big.Int).SetBytes(q) - pubkey.Parameters.P = new(big.Int).SetBytes(p) - pubkey.Parameters.G = new(big.Int).SetBytes(g) - pubkey.Y = new(big.Int).SetBytes(y) - return pubkey -} - -func (k *DNSKEY) publicKeyED25519() ed25519.PublicKey { - keybuf, err := fromBase64([]byte(k.PublicKey)) - if err != nil { - return nil - } - if len(keybuf) != ed25519.PublicKeySize { - return nil - } - return keybuf -} - -type wireSlice [][]byte - -func (p wireSlice) Len() int { return len(p) } -func (p wireSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p wireSlice) Less(i, j int) bool { - _, ioff, _ := UnpackDomainName(p[i], 0) - _, joff, _ := UnpackDomainName(p[j], 0) - return bytes.Compare(p[i][ioff+10:], p[j][joff+10:]) < 0 -} - -// Return the raw signature data. -func rawSignatureData(rrset []RR, s *RRSIG) (buf []byte, err error) { - wires := make(wireSlice, len(rrset)) - for i, r := range rrset { - r1 := r.copy() - h := r1.Header() - h.Ttl = s.OrigTtl - labels := SplitDomainName(h.Name) - // 6.2. Canonical RR Form. (4) - wildcards - if len(labels) > int(s.Labels) { - // Wildcard - h.Name = "*." + strings.Join(labels[len(labels)-int(s.Labels):], ".") + "." - } - // RFC 4034: 6.2. Canonical RR Form. (2) - domain name to lowercase - h.Name = strings.ToLower(h.Name) - // 6.2. Canonical RR Form. (3) - domain rdata to lowercase. - // NS, MD, MF, CNAME, SOA, MB, MG, MR, PTR, - // HINFO, MINFO, MX, RP, AFSDB, RT, SIG, PX, NXT, NAPTR, KX, - // SRV, DNAME, A6 - // - // RFC 6840 - Clarifications and Implementation Notes for DNS Security (DNSSEC): - // Section 6.2 of [RFC4034] also erroneously lists HINFO as a record - // that needs conversion to lowercase, and twice at that. Since HINFO - // records contain no domain names, they are not subject to case - // conversion. - switch x := r1.(type) { - case *NS: - x.Ns = strings.ToLower(x.Ns) - case *MD: - x.Md = strings.ToLower(x.Md) - case *MF: - x.Mf = strings.ToLower(x.Mf) - case *CNAME: - x.Target = strings.ToLower(x.Target) - case *SOA: - x.Ns = strings.ToLower(x.Ns) - x.Mbox = strings.ToLower(x.Mbox) - case *MB: - x.Mb = strings.ToLower(x.Mb) - case *MG: - x.Mg = strings.ToLower(x.Mg) - case *MR: - x.Mr = strings.ToLower(x.Mr) - case *PTR: - x.Ptr = strings.ToLower(x.Ptr) - case *MINFO: - x.Rmail = strings.ToLower(x.Rmail) - x.Email = strings.ToLower(x.Email) - case *MX: - x.Mx = strings.ToLower(x.Mx) - case *RP: - x.Mbox = strings.ToLower(x.Mbox) - x.Txt = strings.ToLower(x.Txt) - case *AFSDB: - x.Hostname = strings.ToLower(x.Hostname) - case *RT: - x.Host = strings.ToLower(x.Host) - case *SIG: - x.SignerName = strings.ToLower(x.SignerName) - case *PX: - x.Map822 = strings.ToLower(x.Map822) - x.Mapx400 = strings.ToLower(x.Mapx400) - case *NAPTR: - x.Replacement = strings.ToLower(x.Replacement) - case *KX: - x.Exchanger = strings.ToLower(x.Exchanger) - case *SRV: - x.Target = strings.ToLower(x.Target) - case *DNAME: - x.Target = strings.ToLower(x.Target) - } - // 6.2. Canonical RR Form. (5) - origTTL - wire := make([]byte, Len(r1)+1) // +1 to be safe(r) - off, err1 := PackRR(r1, wire, 0, nil, false) - if err1 != nil { - return nil, err1 - } - wire = wire[:off] - wires[i] = wire - } - sort.Sort(wires) - for i, wire := range wires { - if i > 0 && bytes.Equal(wire, wires[i-1]) { - continue - } - buf = append(buf, wire...) - } - return buf, nil -} - -func packSigWire(sw *rrsigWireFmt, msg []byte) (int, error) { - // copied from zmsg.go RRSIG packing - off, err := packUint16(sw.TypeCovered, msg, 0) - if err != nil { - return off, err - } - off, err = packUint8(sw.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(sw.Labels, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(sw.OrigTtl, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(sw.Expiration, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(sw.Inception, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(sw.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = PackDomainName(sw.SignerName, msg, off, nil, false) - if err != nil { - return off, err - } - return off, nil -} - -func packKeyWire(dw *dnskeyWireFmt, msg []byte) (int, error) { - // copied from zmsg.go DNSKEY packing - off, err := packUint16(dw.Flags, msg, 0) - if err != nil { - return off, err - } - off, err = packUint8(dw.Protocol, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(dw.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(dw.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} diff --git a/vendor/github.com/miekg/dns/dnssec_keygen.go b/vendor/github.com/miekg/dns/dnssec_keygen.go deleted file mode 100644 index 60737e5b..00000000 --- a/vendor/github.com/miekg/dns/dnssec_keygen.go +++ /dev/null @@ -1,140 +0,0 @@ -package dns - -import ( - "crypto" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "math/big" - - "golang.org/x/crypto/ed25519" -) - -// Generate generates a DNSKEY of the given bit size. -// The public part is put inside the DNSKEY record. -// The Algorithm in the key must be set as this will define -// what kind of DNSKEY will be generated. -// The ECDSA algorithms imply a fixed keysize, in that case -// bits should be set to the size of the algorithm. -func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) { - switch k.Algorithm { - case RSAMD5, DSA, DSANSEC3SHA1: - return nil, ErrAlg - case RSASHA1, RSASHA256, RSASHA1NSEC3SHA1: - if bits < 512 || bits > 4096 { - return nil, ErrKeySize - } - case RSASHA512: - if bits < 1024 || bits > 4096 { - return nil, ErrKeySize - } - case ECDSAP256SHA256: - if bits != 256 { - return nil, ErrKeySize - } - case ECDSAP384SHA384: - if bits != 384 { - return nil, ErrKeySize - } - case ED25519: - if bits != 256 { - return nil, ErrKeySize - } - } - - switch k.Algorithm { - case RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1: - priv, err := rsa.GenerateKey(rand.Reader, bits) - if err != nil { - return nil, err - } - k.setPublicKeyRSA(priv.PublicKey.E, priv.PublicKey.N) - return priv, nil - case ECDSAP256SHA256, ECDSAP384SHA384: - var c elliptic.Curve - switch k.Algorithm { - case ECDSAP256SHA256: - c = elliptic.P256() - case ECDSAP384SHA384: - c = elliptic.P384() - } - priv, err := ecdsa.GenerateKey(c, rand.Reader) - if err != nil { - return nil, err - } - k.setPublicKeyECDSA(priv.PublicKey.X, priv.PublicKey.Y) - return priv, nil - case ED25519: - pub, priv, err := ed25519.GenerateKey(rand.Reader) - if err != nil { - return nil, err - } - k.setPublicKeyED25519(pub) - return priv, nil - default: - return nil, ErrAlg - } -} - -// Set the public key (the value E and N) -func (k *DNSKEY) setPublicKeyRSA(_E int, _N *big.Int) bool { - if _E == 0 || _N == nil { - return false - } - buf := exponentToBuf(_E) - buf = append(buf, _N.Bytes()...) - k.PublicKey = toBase64(buf) - return true -} - -// Set the public key for Elliptic Curves -func (k *DNSKEY) setPublicKeyECDSA(_X, _Y *big.Int) bool { - if _X == nil || _Y == nil { - return false - } - var intlen int - switch k.Algorithm { - case ECDSAP256SHA256: - intlen = 32 - case ECDSAP384SHA384: - intlen = 48 - } - k.PublicKey = toBase64(curveToBuf(_X, _Y, intlen)) - return true -} - -// Set the public key for Ed25519 -func (k *DNSKEY) setPublicKeyED25519(_K ed25519.PublicKey) bool { - if _K == nil { - return false - } - k.PublicKey = toBase64(_K) - return true -} - -// Set the public key (the values E and N) for RSA -// RFC 3110: Section 2. RSA Public KEY Resource Records -func exponentToBuf(_E int) []byte { - var buf []byte - i := big.NewInt(int64(_E)).Bytes() - if len(i) < 256 { - buf = make([]byte, 1, 1+len(i)) - buf[0] = uint8(len(i)) - } else { - buf = make([]byte, 3, 3+len(i)) - buf[0] = 0 - buf[1] = uint8(len(i) >> 8) - buf[2] = uint8(len(i)) - } - buf = append(buf, i...) - return buf -} - -// Set the public key for X and Y for Curve. The two -// values are just concatenated. -func curveToBuf(_X, _Y *big.Int, intlen int) []byte { - buf := intToBytes(_X, intlen) - buf = append(buf, intToBytes(_Y, intlen)...) - return buf -} diff --git a/vendor/github.com/miekg/dns/dnssec_keyscan.go b/vendor/github.com/miekg/dns/dnssec_keyscan.go deleted file mode 100644 index 0e6f3201..00000000 --- a/vendor/github.com/miekg/dns/dnssec_keyscan.go +++ /dev/null @@ -1,322 +0,0 @@ -package dns - -import ( - "bufio" - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "io" - "math/big" - "strconv" - "strings" - - "golang.org/x/crypto/ed25519" -) - -// NewPrivateKey returns a PrivateKey by parsing the string s. -// s should be in the same form of the BIND private key files. -func (k *DNSKEY) NewPrivateKey(s string) (crypto.PrivateKey, error) { - if s == "" || s[len(s)-1] != '\n' { // We need a closing newline - return k.ReadPrivateKey(strings.NewReader(s+"\n"), "") - } - return k.ReadPrivateKey(strings.NewReader(s), "") -} - -// ReadPrivateKey reads a private key from the io.Reader q. The string file is -// only used in error reporting. -// The public key must be known, because some cryptographic algorithms embed -// the public inside the privatekey. -func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, error) { - m, err := parseKey(q, file) - if m == nil { - return nil, err - } - if _, ok := m["private-key-format"]; !ok { - return nil, ErrPrivKey - } - if m["private-key-format"] != "v1.2" && m["private-key-format"] != "v1.3" { - return nil, ErrPrivKey - } - // TODO(mg): check if the pubkey matches the private key - algo, err := strconv.ParseUint(strings.SplitN(m["algorithm"], " ", 2)[0], 10, 8) - if err != nil { - return nil, ErrPrivKey - } - switch uint8(algo) { - case RSAMD5, DSA, DSANSEC3SHA1: - return nil, ErrAlg - case RSASHA1: - fallthrough - case RSASHA1NSEC3SHA1: - fallthrough - case RSASHA256: - fallthrough - case RSASHA512: - priv, err := readPrivateKeyRSA(m) - if err != nil { - return nil, err - } - pub := k.publicKeyRSA() - if pub == nil { - return nil, ErrKey - } - priv.PublicKey = *pub - return priv, nil - case ECCGOST: - return nil, ErrPrivKey - case ECDSAP256SHA256: - fallthrough - case ECDSAP384SHA384: - priv, err := readPrivateKeyECDSA(m) - if err != nil { - return nil, err - } - pub := k.publicKeyECDSA() - if pub == nil { - return nil, ErrKey - } - priv.PublicKey = *pub - return priv, nil - case ED25519: - return readPrivateKeyED25519(m) - default: - return nil, ErrPrivKey - } -} - -// Read a private key (file) string and create a public key. Return the private key. -func readPrivateKeyRSA(m map[string]string) (*rsa.PrivateKey, error) { - p := new(rsa.PrivateKey) - p.Primes = []*big.Int{nil, nil} - for k, v := range m { - switch k { - case "modulus", "publicexponent", "privateexponent", "prime1", "prime2": - v1, err := fromBase64([]byte(v)) - if err != nil { - return nil, err - } - switch k { - case "modulus": - p.PublicKey.N = new(big.Int).SetBytes(v1) - case "publicexponent": - i := new(big.Int).SetBytes(v1) - p.PublicKey.E = int(i.Int64()) // int64 should be large enough - case "privateexponent": - p.D = new(big.Int).SetBytes(v1) - case "prime1": - p.Primes[0] = new(big.Int).SetBytes(v1) - case "prime2": - p.Primes[1] = new(big.Int).SetBytes(v1) - } - case "exponent1", "exponent2", "coefficient": - // not used in Go (yet) - case "created", "publish", "activate": - // not used in Go (yet) - } - } - return p, nil -} - -func readPrivateKeyECDSA(m map[string]string) (*ecdsa.PrivateKey, error) { - p := new(ecdsa.PrivateKey) - p.D = new(big.Int) - // TODO: validate that the required flags are present - for k, v := range m { - switch k { - case "privatekey": - v1, err := fromBase64([]byte(v)) - if err != nil { - return nil, err - } - p.D.SetBytes(v1) - case "created", "publish", "activate": - /* not used in Go (yet) */ - } - } - return p, nil -} - -func readPrivateKeyED25519(m map[string]string) (ed25519.PrivateKey, error) { - var p ed25519.PrivateKey - // TODO: validate that the required flags are present - for k, v := range m { - switch k { - case "privatekey": - p1, err := fromBase64([]byte(v)) - if err != nil { - return nil, err - } - if len(p1) != ed25519.SeedSize { - return nil, ErrPrivKey - } - p = ed25519.NewKeyFromSeed(p1) - case "created", "publish", "activate": - /* not used in Go (yet) */ - } - } - return p, nil -} - -// parseKey reads a private key from r. It returns a map[string]string, -// with the key-value pairs, or an error when the file is not correct. -func parseKey(r io.Reader, file string) (map[string]string, error) { - m := make(map[string]string) - var k string - - c := newKLexer(r) - - for l, ok := c.Next(); ok; l, ok = c.Next() { - // It should alternate - switch l.value { - case zKey: - k = l.token - case zValue: - if k == "" { - return nil, &ParseError{file, "no private key seen", l} - } - - m[strings.ToLower(k)] = l.token - k = "" - } - } - - // Surface any read errors from r. - if err := c.Err(); err != nil { - return nil, &ParseError{file: file, err: err.Error()} - } - - return m, nil -} - -type klexer struct { - br io.ByteReader - - readErr error - - line int - column int - - key bool - - eol bool // end-of-line -} - -func newKLexer(r io.Reader) *klexer { - br, ok := r.(io.ByteReader) - if !ok { - br = bufio.NewReaderSize(r, 1024) - } - - return &klexer{ - br: br, - - line: 1, - - key: true, - } -} - -func (kl *klexer) Err() error { - if kl.readErr == io.EOF { - return nil - } - - return kl.readErr -} - -// readByte returns the next byte from the input -func (kl *klexer) readByte() (byte, bool) { - if kl.readErr != nil { - return 0, false - } - - c, err := kl.br.ReadByte() - if err != nil { - kl.readErr = err - return 0, false - } - - // delay the newline handling until the next token is delivered, - // fixes off-by-one errors when reporting a parse error. - if kl.eol { - kl.line++ - kl.column = 0 - kl.eol = false - } - - if c == '\n' { - kl.eol = true - } else { - kl.column++ - } - - return c, true -} - -func (kl *klexer) Next() (lex, bool) { - var ( - l lex - - str strings.Builder - - commt bool - ) - - for x, ok := kl.readByte(); ok; x, ok = kl.readByte() { - l.line, l.column = kl.line, kl.column - - switch x { - case ':': - if commt || !kl.key { - break - } - - kl.key = false - - // Next token is a space, eat it - kl.readByte() - - l.value = zKey - l.token = str.String() - return l, true - case ';': - commt = true - case '\n': - if commt { - // Reset a comment - commt = false - } - - if kl.key && str.Len() == 0 { - // ignore empty lines - break - } - - kl.key = true - - l.value = zValue - l.token = str.String() - return l, true - default: - if commt { - break - } - - str.WriteByte(x) - } - } - - if kl.readErr != nil && kl.readErr != io.EOF { - // Don't return any tokens after a read error occurs. - return lex{value: zEOF}, false - } - - if str.Len() > 0 { - // Send remainder - l.value = zValue - l.token = str.String() - return l, true - } - - return lex{value: zEOF}, false -} diff --git a/vendor/github.com/miekg/dns/dnssec_privkey.go b/vendor/github.com/miekg/dns/dnssec_privkey.go deleted file mode 100644 index 4493c9d5..00000000 --- a/vendor/github.com/miekg/dns/dnssec_privkey.go +++ /dev/null @@ -1,94 +0,0 @@ -package dns - -import ( - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "crypto/rsa" - "math/big" - "strconv" - - "golang.org/x/crypto/ed25519" -) - -const format = "Private-key-format: v1.3\n" - -var bigIntOne = big.NewInt(1) - -// PrivateKeyString converts a PrivateKey to a string. This string has the same -// format as the private-key-file of BIND9 (Private-key-format: v1.3). -// It needs some info from the key (the algorithm), so its a method of the DNSKEY -// It supports rsa.PrivateKey, ecdsa.PrivateKey and dsa.PrivateKey -func (r *DNSKEY) PrivateKeyString(p crypto.PrivateKey) string { - algorithm := strconv.Itoa(int(r.Algorithm)) - algorithm += " (" + AlgorithmToString[r.Algorithm] + ")" - - switch p := p.(type) { - case *rsa.PrivateKey: - modulus := toBase64(p.PublicKey.N.Bytes()) - e := big.NewInt(int64(p.PublicKey.E)) - publicExponent := toBase64(e.Bytes()) - privateExponent := toBase64(p.D.Bytes()) - prime1 := toBase64(p.Primes[0].Bytes()) - prime2 := toBase64(p.Primes[1].Bytes()) - // Calculate Exponent1/2 and Coefficient as per: http://en.wikipedia.org/wiki/RSA#Using_the_Chinese_remainder_algorithm - // and from: http://code.google.com/p/go/issues/detail?id=987 - p1 := new(big.Int).Sub(p.Primes[0], bigIntOne) - q1 := new(big.Int).Sub(p.Primes[1], bigIntOne) - exp1 := new(big.Int).Mod(p.D, p1) - exp2 := new(big.Int).Mod(p.D, q1) - coeff := new(big.Int).ModInverse(p.Primes[1], p.Primes[0]) - - exponent1 := toBase64(exp1.Bytes()) - exponent2 := toBase64(exp2.Bytes()) - coefficient := toBase64(coeff.Bytes()) - - return format + - "Algorithm: " + algorithm + "\n" + - "Modulus: " + modulus + "\n" + - "PublicExponent: " + publicExponent + "\n" + - "PrivateExponent: " + privateExponent + "\n" + - "Prime1: " + prime1 + "\n" + - "Prime2: " + prime2 + "\n" + - "Exponent1: " + exponent1 + "\n" + - "Exponent2: " + exponent2 + "\n" + - "Coefficient: " + coefficient + "\n" - - case *ecdsa.PrivateKey: - var intlen int - switch r.Algorithm { - case ECDSAP256SHA256: - intlen = 32 - case ECDSAP384SHA384: - intlen = 48 - } - private := toBase64(intToBytes(p.D, intlen)) - return format + - "Algorithm: " + algorithm + "\n" + - "PrivateKey: " + private + "\n" - - case *dsa.PrivateKey: - T := divRoundUp(divRoundUp(p.PublicKey.Parameters.G.BitLen(), 8)-64, 8) - prime := toBase64(intToBytes(p.PublicKey.Parameters.P, 64+T*8)) - subprime := toBase64(intToBytes(p.PublicKey.Parameters.Q, 20)) - base := toBase64(intToBytes(p.PublicKey.Parameters.G, 64+T*8)) - priv := toBase64(intToBytes(p.X, 20)) - pub := toBase64(intToBytes(p.PublicKey.Y, 64+T*8)) - return format + - "Algorithm: " + algorithm + "\n" + - "Prime(p): " + prime + "\n" + - "Subprime(q): " + subprime + "\n" + - "Base(g): " + base + "\n" + - "Private_value(x): " + priv + "\n" + - "Public_value(y): " + pub + "\n" - - case ed25519.PrivateKey: - private := toBase64(p.Seed()) - return format + - "Algorithm: " + algorithm + "\n" + - "PrivateKey: " + private + "\n" - - default: - return "" - } -} diff --git a/vendor/github.com/miekg/dns/doc.go b/vendor/github.com/miekg/dns/doc.go deleted file mode 100644 index d3d7cec9..00000000 --- a/vendor/github.com/miekg/dns/doc.go +++ /dev/null @@ -1,269 +0,0 @@ -/* -Package dns implements a full featured interface to the Domain Name System. -Both server- and client-side programming is supported. The package allows -complete control over what is sent out to the DNS. The API follows the -less-is-more principle, by presenting a small, clean interface. - -It supports (asynchronous) querying/replying, incoming/outgoing zone transfers, -TSIG, EDNS0, dynamic updates, notifies and DNSSEC validation/signing. - -Note that domain names MUST be fully qualified before sending them, unqualified -names in a message will result in a packing failure. - -Resource records are native types. They are not stored in wire format. Basic -usage pattern for creating a new resource record: - - r := new(dns.MX) - r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 3600} - r.Preference = 10 - r.Mx = "mx.miek.nl." - -Or directly from a string: - - mx, err := dns.NewRR("miek.nl. 3600 IN MX 10 mx.miek.nl.") - -Or when the default origin (.) and TTL (3600) and class (IN) suit you: - - mx, err := dns.NewRR("miek.nl MX 10 mx.miek.nl") - -Or even: - - mx, err := dns.NewRR("$ORIGIN nl.\nmiek 1H IN MX 10 mx.miek") - -In the DNS messages are exchanged, these messages contain resource records -(sets). Use pattern for creating a message: - - m := new(dns.Msg) - m.SetQuestion("miek.nl.", dns.TypeMX) - -Or when not certain if the domain name is fully qualified: - - m.SetQuestion(dns.Fqdn("miek.nl"), dns.TypeMX) - -The message m is now a message with the question section set to ask the MX -records for the miek.nl. zone. - -The following is slightly more verbose, but more flexible: - - m1 := new(dns.Msg) - m1.Id = dns.Id() - m1.RecursionDesired = true - m1.Question = make([]dns.Question, 1) - m1.Question[0] = dns.Question{"miek.nl.", dns.TypeMX, dns.ClassINET} - -After creating a message it can be sent. Basic use pattern for synchronous -querying the DNS at a server configured on 127.0.0.1 and port 53: - - c := new(dns.Client) - in, rtt, err := c.Exchange(m1, "127.0.0.1:53") - -Suppressing multiple outstanding queries (with the same question, type and -class) is as easy as setting: - - c.SingleInflight = true - -More advanced options are available using a net.Dialer and the corresponding API. -For example it is possible to set a timeout, or to specify a source IP address -and port to use for the connection: - - c := new(dns.Client) - laddr := net.UDPAddr{ - IP: net.ParseIP("[::1]"), - Port: 12345, - Zone: "", - } - c.Dialer := &net.Dialer{ - Timeout: 200 * time.Millisecond, - LocalAddr: &laddr, - } - in, rtt, err := c.Exchange(m1, "8.8.8.8:53") - -If these "advanced" features are not needed, a simple UDP query can be sent, -with: - - in, err := dns.Exchange(m1, "127.0.0.1:53") - -When this functions returns you will get dns message. A dns message consists -out of four sections. -The question section: in.Question, the answer section: in.Answer, -the authority section: in.Ns and the additional section: in.Extra. - -Each of these sections (except the Question section) contain a []RR. Basic -use pattern for accessing the rdata of a TXT RR as the first RR in -the Answer section: - - if t, ok := in.Answer[0].(*dns.TXT); ok { - // do something with t.Txt - } - -Domain Name and TXT Character String Representations - -Both domain names and TXT character strings are converted to presentation form -both when unpacked and when converted to strings. - -For TXT character strings, tabs, carriage returns and line feeds will be -converted to \t, \r and \n respectively. Back slashes and quotations marks will -be escaped. Bytes below 32 and above 127 will be converted to \DDD form. - -For domain names, in addition to the above rules brackets, periods, spaces, -semicolons and the at symbol are escaped. - -DNSSEC - -DNSSEC (DNS Security Extension) adds a layer of security to the DNS. It uses -public key cryptography to sign resource records. The public keys are stored in -DNSKEY records and the signatures in RRSIG records. - -Requesting DNSSEC information for a zone is done by adding the DO (DNSSEC OK) -bit to a request. - - m := new(dns.Msg) - m.SetEdns0(4096, true) - -Signature generation, signature verification and key generation are all supported. - -DYNAMIC UPDATES - -Dynamic updates reuses the DNS message format, but renames three of the -sections. Question is Zone, Answer is Prerequisite, Authority is Update, only -the Additional is not renamed. See RFC 2136 for the gory details. - -You can set a rather complex set of rules for the existence of absence of -certain resource records or names in a zone to specify if resource records -should be added or removed. The table from RFC 2136 supplemented with the Go -DNS function shows which functions exist to specify the prerequisites. - - 3.2.4 - Table Of Metavalues Used In Prerequisite Section - - CLASS TYPE RDATA Meaning Function - -------------------------------------------------------------- - ANY ANY empty Name is in use dns.NameUsed - ANY rrset empty RRset exists (value indep) dns.RRsetUsed - NONE ANY empty Name is not in use dns.NameNotUsed - NONE rrset empty RRset does not exist dns.RRsetNotUsed - zone rrset rr RRset exists (value dep) dns.Used - -The prerequisite section can also be left empty. If you have decided on the -prerequisites you can tell what RRs should be added or deleted. The next table -shows the options you have and what functions to call. - - 3.4.2.6 - Table Of Metavalues Used In Update Section - - CLASS TYPE RDATA Meaning Function - --------------------------------------------------------------- - ANY ANY empty Delete all RRsets from name dns.RemoveName - ANY rrset empty Delete an RRset dns.RemoveRRset - NONE rrset rr Delete an RR from RRset dns.Remove - zone rrset rr Add to an RRset dns.Insert - -TRANSACTION SIGNATURE - -An TSIG or transaction signature adds a HMAC TSIG record to each message sent. -The supported algorithms include: HmacMD5, HmacSHA1, HmacSHA256 and HmacSHA512. - -Basic use pattern when querying with a TSIG name "axfr." (note that these key names -must be fully qualified - as they are domain names) and the base64 secret -"so6ZGir4GPAqINNh9U5c3A==": - -If an incoming message contains a TSIG record it MUST be the last record in -the additional section (RFC2845 3.2). This means that you should make the -call to SetTsig last, right before executing the query. If you make any -changes to the RRset after calling SetTsig() the signature will be incorrect. - - c := new(dns.Client) - c.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} - m := new(dns.Msg) - m.SetQuestion("miek.nl.", dns.TypeMX) - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) - ... - // When sending the TSIG RR is calculated and filled in before sending - -When requesting an zone transfer (almost all TSIG usage is when requesting zone -transfers), with TSIG, this is the basic use pattern. In this example we -request an AXFR for miek.nl. with TSIG key named "axfr." and secret -"so6ZGir4GPAqINNh9U5c3A==" and using the server 176.58.119.54: - - t := new(dns.Transfer) - m := new(dns.Msg) - t.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} - m.SetAxfr("miek.nl.") - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) - c, err := t.In(m, "176.58.119.54:53") - for r := range c { ... } - -You can now read the records from the transfer as they come in. Each envelope -is checked with TSIG. If something is not correct an error is returned. - -Basic use pattern validating and replying to a message that has TSIG set. - - server := &dns.Server{Addr: ":53", Net: "udp"} - server.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} - go server.ListenAndServe() - dns.HandleFunc(".", handleRequest) - - func handleRequest(w dns.ResponseWriter, r *dns.Msg) { - m := new(dns.Msg) - m.SetReply(r) - if r.IsTsig() != nil { - if w.TsigStatus() == nil { - // *Msg r has an TSIG record and it was validated - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) - } else { - // *Msg r has an TSIG records and it was not valided - } - } - w.WriteMsg(m) - } - -PRIVATE RRS - -RFC 6895 sets aside a range of type codes for private use. This range is 65,280 -- 65,534 (0xFF00 - 0xFFFE). When experimenting with new Resource Records these -can be used, before requesting an official type code from IANA. - -See https://miek.nl/2014/September/21/idn-and-private-rr-in-go-dns/ for more -information. - -EDNS0 - -EDNS0 is an extension mechanism for the DNS defined in RFC 2671 and updated by -RFC 6891. It defines an new RR type, the OPT RR, which is then completely -abused. - -Basic use pattern for creating an (empty) OPT RR: - - o := new(dns.OPT) - o.Hdr.Name = "." // MUST be the root zone, per definition. - o.Hdr.Rrtype = dns.TypeOPT - -The rdata of an OPT RR consists out of a slice of EDNS0 (RFC 6891) interfaces. -Currently only a few have been standardized: EDNS0_NSID (RFC 5001) and -EDNS0_SUBNET (draft-vandergaast-edns-client-subnet-02). Note that these options -may be combined in an OPT RR. Basic use pattern for a server to check if (and -which) options are set: - - // o is a dns.OPT - for _, s := range o.Option { - switch e := s.(type) { - case *dns.EDNS0_NSID: - // do stuff with e.Nsid - case *dns.EDNS0_SUBNET: - // access e.Family, e.Address, etc. - } - } - -SIG(0) - -From RFC 2931: - - SIG(0) provides protection for DNS transactions and requests .... - ... protection for glue records, DNS requests, protection for message headers - on requests and responses, and protection of the overall integrity of a response. - -It works like TSIG, except that SIG(0) uses public key cryptography, instead of -the shared secret approach in TSIG. Supported algorithms: DSA, ECDSAP256SHA256, -ECDSAP384SHA384, RSASHA1, RSASHA256 and RSASHA512. - -Signing subsequent messages in multi-message sessions is not implemented. -*/ -package dns diff --git a/vendor/github.com/miekg/dns/duplicate.go b/vendor/github.com/miekg/dns/duplicate.go deleted file mode 100644 index 00cda0aa..00000000 --- a/vendor/github.com/miekg/dns/duplicate.go +++ /dev/null @@ -1,38 +0,0 @@ -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 { - // Check whether the record header is identical. - if !r1.Header().isDuplicate(r2.Header()) { - return false - } - - // Check whether the RDATA is identical. - return r1.isDuplicate(r2) -} - -func (r1 *RR_Header) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RR_Header) - if !ok { - return false - } - if r1.Class != r2.Class { - return false - } - if r1.Rrtype != r2.Rrtype { - return false - } - if !isDuplicateName(r1.Name, r2.Name) { - return false - } - // ignore TTL - return true -} - -// isDuplicateName checks if the domain names s1 and s2 are equal. -func isDuplicateName(s1, s2 string) bool { return equal(s1, s2) } diff --git a/vendor/github.com/miekg/dns/duplicate_generate.go b/vendor/github.com/miekg/dns/duplicate_generate.go deleted file mode 100644 index 9b7a71b1..00000000 --- a/vendor/github.com/miekg/dns/duplicate_generate.go +++ /dev/null @@ -1,144 +0,0 @@ -//+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 == "OPT" { - continue - } - - namedTypes = append(namedTypes, o.Name()) - } - - b := &bytes.Buffer{} - b.WriteString(packageHdr) - - // 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 (r1 *%s) isDuplicate(_r2 RR) bool {\n", name) - fmt.Fprintf(b, "r2, ok := _r2.(*%s)\n", name) - fmt.Fprint(b, "if !ok { return false }\n") - fmt.Fprint(b, "_ = r2\n") - 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 { - 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 !isDuplicateName(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:"a"`, `dns:"aaaa"`: - o2("if !r1.%s.Equal(r2.%s) {\nreturn false\n}") - case `dns:"cdomain-name"`, `dns:"domain-name"`: - o2("if !isDuplicateName(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) - } -} diff --git a/vendor/github.com/miekg/dns/edns.go b/vendor/github.com/miekg/dns/edns.go deleted file mode 100644 index 8cdbfb0b..00000000 --- a/vendor/github.com/miekg/dns/edns.go +++ /dev/null @@ -1,659 +0,0 @@ -package dns - -import ( - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "net" - "strconv" -) - -// EDNS0 Option codes. -const ( - EDNS0LLQ = 0x1 // long lived queries: http://tools.ietf.org/html/draft-sekar-dns-llq-01 - EDNS0UL = 0x2 // update lease draft: http://files.dns-sd.org/draft-sekar-dns-ul.txt - EDNS0NSID = 0x3 // nsid (See RFC 5001) - EDNS0DAU = 0x5 // DNSSEC Algorithm Understood - EDNS0DHU = 0x6 // DS Hash Understood - EDNS0N3U = 0x7 // NSEC3 Hash Understood - EDNS0SUBNET = 0x8 // client-subnet (See RFC 7871) - EDNS0EXPIRE = 0x9 // EDNS0 expire - EDNS0COOKIE = 0xa // EDNS0 Cookie - EDNS0TCPKEEPALIVE = 0xb // EDNS0 tcp keep alive (See RFC 7828) - EDNS0PADDING = 0xc // EDNS0 padding (See RFC 7830) - EDNS0LOCALSTART = 0xFDE9 // Beginning of range reserved for local/experimental use (See RFC 6891) - EDNS0LOCALEND = 0xFFFE // End of range reserved for local/experimental use (See RFC 6891) - _DO = 1 << 15 // DNSSEC OK -) - -// OPT is the EDNS0 RR appended to messages to convey extra (meta) information. -// See RFC 6891. -type OPT struct { - Hdr RR_Header - Option []EDNS0 `dns:"opt"` -} - -func (rr *OPT) String() string { - s := "\n;; OPT PSEUDOSECTION:\n; EDNS: version " + strconv.Itoa(int(rr.Version())) + "; " - if rr.Do() { - s += "flags: do; " - } else { - s += "flags: ; " - } - s += "udp: " + strconv.Itoa(int(rr.UDPSize())) - - for _, o := range rr.Option { - switch o.(type) { - case *EDNS0_NSID: - s += "\n; NSID: " + o.String() - h, e := o.pack() - var r string - if e == nil { - for _, c := range h { - r += "(" + string(c) + ")" - } - s += " " + r - } - case *EDNS0_SUBNET: - s += "\n; SUBNET: " + o.String() - case *EDNS0_COOKIE: - s += "\n; COOKIE: " + o.String() - case *EDNS0_UL: - s += "\n; UPDATE LEASE: " + o.String() - case *EDNS0_LLQ: - s += "\n; LONG LIVED QUERIES: " + o.String() - case *EDNS0_DAU: - s += "\n; DNSSEC ALGORITHM UNDERSTOOD: " + o.String() - case *EDNS0_DHU: - s += "\n; DS HASH UNDERSTOOD: " + o.String() - case *EDNS0_N3U: - s += "\n; NSEC3 HASH UNDERSTOOD: " + o.String() - case *EDNS0_LOCAL: - s += "\n; LOCAL OPT: " + o.String() - case *EDNS0_PADDING: - s += "\n; PADDING: " + o.String() - } - } - return s -} - -func (rr *OPT) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - for _, o := range rr.Option { - l += 4 // Account for 2-byte option code and 2-byte option length. - lo, _ := o.pack() - l += len(lo) - } - return l -} - -func (rr *OPT) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on OPT") -} - -func (r1 *OPT) isDuplicate(r2 RR) bool { return false } - -// return the old value -> delete SetVersion? - -// Version returns the EDNS version used. Only zero is defined. -func (rr *OPT) Version() uint8 { - return uint8(rr.Hdr.Ttl & 0x00FF0000 >> 16) -} - -// SetVersion sets the version of EDNS. This is usually zero. -func (rr *OPT) SetVersion(v uint8) { - rr.Hdr.Ttl = rr.Hdr.Ttl&0xFF00FFFF | uint32(v)<<16 -} - -// ExtendedRcode returns the EDNS extended RCODE field (the upper 8 bits of the TTL). -func (rr *OPT) ExtendedRcode() int { - return int(rr.Hdr.Ttl&0xFF000000>>24) << 4 -} - -// SetExtendedRcode sets the EDNS extended RCODE field. -// -// If the RCODE is not an extended RCODE, will reset the extended RCODE field to 0. -func (rr *OPT) SetExtendedRcode(v uint16) { - rr.Hdr.Ttl = rr.Hdr.Ttl&0x00FFFFFF | uint32(v>>4)<<24 -} - -// UDPSize returns the UDP buffer size. -func (rr *OPT) UDPSize() uint16 { - return rr.Hdr.Class -} - -// SetUDPSize sets the UDP buffer size. -func (rr *OPT) SetUDPSize(size uint16) { - rr.Hdr.Class = size -} - -// Do returns the value of the DO (DNSSEC OK) bit. -func (rr *OPT) Do() bool { - return rr.Hdr.Ttl&_DO == _DO -} - -// SetDo sets the DO (DNSSEC OK) bit. -// If we pass an argument, set the DO bit to that value. -// It is possible to pass 2 or more arguments. Any arguments after the 1st is silently ignored. -func (rr *OPT) SetDo(do ...bool) { - if len(do) == 1 { - if do[0] { - rr.Hdr.Ttl |= _DO - } else { - rr.Hdr.Ttl &^= _DO - } - } else { - rr.Hdr.Ttl |= _DO - } -} - -// EDNS0 defines an EDNS0 Option. An OPT RR can have multiple options appended to it. -type EDNS0 interface { - // Option returns the option code for the option. - Option() uint16 - // pack returns the bytes of the option data. - pack() ([]byte, error) - // unpack sets the data as found in the buffer. Is also sets - // the length of the slice as the length of the option data. - unpack([]byte) error - // String returns the string representation of the option. - String() string - // copy returns a deep-copy of the option. - copy() EDNS0 -} - -// EDNS0_NSID option is used to retrieve a nameserver -// identifier. When sending a request Nsid must be set to the empty string -// The identifier is an opaque string encoded as hex. -// Basic use pattern for creating an nsid option: -// -// o := new(dns.OPT) -// o.Hdr.Name = "." -// o.Hdr.Rrtype = dns.TypeOPT -// e := new(dns.EDNS0_NSID) -// e.Code = dns.EDNS0NSID -// e.Nsid = "AA" -// o.Option = append(o.Option, e) -type EDNS0_NSID struct { - Code uint16 // Always EDNS0NSID - Nsid string // This string needs to be hex encoded -} - -func (e *EDNS0_NSID) pack() ([]byte, error) { - h, err := hex.DecodeString(e.Nsid) - if err != nil { - return nil, err - } - return h, nil -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_NSID) Option() uint16 { return EDNS0NSID } // Option returns the option code. -func (e *EDNS0_NSID) unpack(b []byte) error { e.Nsid = hex.EncodeToString(b); return nil } -func (e *EDNS0_NSID) String() string { return e.Nsid } -func (e *EDNS0_NSID) copy() EDNS0 { return &EDNS0_NSID{e.Code, e.Nsid} } - -// EDNS0_SUBNET is the subnet option that is used to give the remote nameserver -// an idea of where the client lives. See RFC 7871. It can then give back a different -// answer depending on the location or network topology. -// Basic use pattern for creating an subnet option: -// -// o := new(dns.OPT) -// o.Hdr.Name = "." -// o.Hdr.Rrtype = dns.TypeOPT -// e := new(dns.EDNS0_SUBNET) -// e.Code = dns.EDNS0SUBNET -// e.Family = 1 // 1 for IPv4 source address, 2 for IPv6 -// e.SourceNetmask = 32 // 32 for IPV4, 128 for IPv6 -// e.SourceScope = 0 -// e.Address = net.ParseIP("127.0.0.1").To4() // for IPv4 -// // e.Address = net.ParseIP("2001:7b8:32a::2") // for IPV6 -// o.Option = append(o.Option, e) -// -// This code will parse all the available bits when unpacking (up to optlen). -// When packing it will apply SourceNetmask. If you need more advanced logic, -// patches welcome and good luck. -type EDNS0_SUBNET struct { - Code uint16 // Always EDNS0SUBNET - Family uint16 // 1 for IP, 2 for IP6 - SourceNetmask uint8 - SourceScope uint8 - Address net.IP -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_SUBNET) Option() uint16 { return EDNS0SUBNET } - -func (e *EDNS0_SUBNET) pack() ([]byte, error) { - b := make([]byte, 4) - binary.BigEndian.PutUint16(b[0:], e.Family) - b[2] = e.SourceNetmask - b[3] = e.SourceScope - switch e.Family { - case 0: - // "dig" sets AddressFamily to 0 if SourceNetmask is also 0 - // We might don't need to complain either - if e.SourceNetmask != 0 { - return nil, errors.New("dns: bad address family") - } - case 1: - if e.SourceNetmask > net.IPv4len*8 { - return nil, errors.New("dns: bad netmask") - } - if len(e.Address.To4()) != net.IPv4len { - return nil, errors.New("dns: bad address") - } - ip := e.Address.To4().Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv4len*8)) - needLength := (e.SourceNetmask + 8 - 1) / 8 // division rounding up - b = append(b, ip[:needLength]...) - case 2: - if e.SourceNetmask > net.IPv6len*8 { - return nil, errors.New("dns: bad netmask") - } - if len(e.Address) != net.IPv6len { - return nil, errors.New("dns: bad address") - } - ip := e.Address.Mask(net.CIDRMask(int(e.SourceNetmask), net.IPv6len*8)) - needLength := (e.SourceNetmask + 8 - 1) / 8 // division rounding up - b = append(b, ip[:needLength]...) - default: - return nil, errors.New("dns: bad address family") - } - return b, nil -} - -func (e *EDNS0_SUBNET) unpack(b []byte) error { - if len(b) < 4 { - return ErrBuf - } - e.Family = binary.BigEndian.Uint16(b) - e.SourceNetmask = b[2] - e.SourceScope = b[3] - switch e.Family { - case 0: - // "dig" sets AddressFamily to 0 if SourceNetmask is also 0 - // It's okay to accept such a packet - if e.SourceNetmask != 0 { - return errors.New("dns: bad address family") - } - e.Address = net.IPv4(0, 0, 0, 0) - case 1: - if e.SourceNetmask > net.IPv4len*8 || e.SourceScope > net.IPv4len*8 { - return errors.New("dns: bad netmask") - } - addr := make(net.IP, net.IPv4len) - copy(addr, b[4:]) - e.Address = addr.To16() - case 2: - if e.SourceNetmask > net.IPv6len*8 || e.SourceScope > net.IPv6len*8 { - return errors.New("dns: bad netmask") - } - addr := make(net.IP, net.IPv6len) - copy(addr, b[4:]) - e.Address = addr - default: - return errors.New("dns: bad address family") - } - return nil -} - -func (e *EDNS0_SUBNET) String() (s string) { - if e.Address == nil { - s = "" - } else if e.Address.To4() != nil { - s = e.Address.String() - } else { - s = "[" + e.Address.String() + "]" - } - s += "/" + strconv.Itoa(int(e.SourceNetmask)) + "/" + strconv.Itoa(int(e.SourceScope)) - return -} - -func (e *EDNS0_SUBNET) copy() EDNS0 { - return &EDNS0_SUBNET{ - e.Code, - e.Family, - e.SourceNetmask, - e.SourceScope, - e.Address, - } -} - -// The EDNS0_COOKIE option is used to add a DNS Cookie to a message. -// -// o := new(dns.OPT) -// o.Hdr.Name = "." -// o.Hdr.Rrtype = dns.TypeOPT -// e := new(dns.EDNS0_COOKIE) -// e.Code = dns.EDNS0COOKIE -// e.Cookie = "24a5ac.." -// o.Option = append(o.Option, e) -// -// The Cookie field consists out of a client cookie (RFC 7873 Section 4), that is -// always 8 bytes. It may then optionally be followed by the server cookie. The server -// cookie is of variable length, 8 to a maximum of 32 bytes. In other words: -// -// cCookie := o.Cookie[:16] -// sCookie := o.Cookie[16:] -// -// There is no guarantee that the Cookie string has a specific length. -type EDNS0_COOKIE struct { - Code uint16 // Always EDNS0COOKIE - Cookie string // Hex-encoded cookie data -} - -func (e *EDNS0_COOKIE) pack() ([]byte, error) { - h, err := hex.DecodeString(e.Cookie) - if err != nil { - return nil, err - } - return h, nil -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_COOKIE) Option() uint16 { return EDNS0COOKIE } -func (e *EDNS0_COOKIE) unpack(b []byte) error { e.Cookie = hex.EncodeToString(b); return nil } -func (e *EDNS0_COOKIE) String() string { return e.Cookie } -func (e *EDNS0_COOKIE) copy() EDNS0 { return &EDNS0_COOKIE{e.Code, e.Cookie} } - -// The EDNS0_UL (Update Lease) (draft RFC) option is used to tell the server to set -// an expiration on an update RR. This is helpful for clients that cannot clean -// up after themselves. This is a draft RFC and more information can be found at -// http://files.dns-sd.org/draft-sekar-dns-ul.txt -// -// o := new(dns.OPT) -// o.Hdr.Name = "." -// o.Hdr.Rrtype = dns.TypeOPT -// e := new(dns.EDNS0_UL) -// e.Code = dns.EDNS0UL -// e.Lease = 120 // in seconds -// o.Option = append(o.Option, e) -type EDNS0_UL struct { - Code uint16 // Always EDNS0UL - Lease uint32 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_UL) Option() uint16 { return EDNS0UL } -func (e *EDNS0_UL) String() string { return strconv.FormatUint(uint64(e.Lease), 10) } -func (e *EDNS0_UL) copy() EDNS0 { return &EDNS0_UL{e.Code, e.Lease} } - -// Copied: http://golang.org/src/pkg/net/dnsmsg.go -func (e *EDNS0_UL) pack() ([]byte, error) { - b := make([]byte, 4) - binary.BigEndian.PutUint32(b, e.Lease) - return b, nil -} - -func (e *EDNS0_UL) unpack(b []byte) error { - if len(b) < 4 { - return ErrBuf - } - e.Lease = binary.BigEndian.Uint32(b) - return nil -} - -// EDNS0_LLQ stands for Long Lived Queries: http://tools.ietf.org/html/draft-sekar-dns-llq-01 -// Implemented for completeness, as the EDNS0 type code is assigned. -type EDNS0_LLQ struct { - Code uint16 // Always EDNS0LLQ - Version uint16 - Opcode uint16 - Error uint16 - Id uint64 - LeaseLife uint32 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_LLQ) Option() uint16 { return EDNS0LLQ } - -func (e *EDNS0_LLQ) pack() ([]byte, error) { - b := make([]byte, 18) - binary.BigEndian.PutUint16(b[0:], e.Version) - binary.BigEndian.PutUint16(b[2:], e.Opcode) - binary.BigEndian.PutUint16(b[4:], e.Error) - binary.BigEndian.PutUint64(b[6:], e.Id) - binary.BigEndian.PutUint32(b[14:], e.LeaseLife) - return b, nil -} - -func (e *EDNS0_LLQ) unpack(b []byte) error { - if len(b) < 18 { - return ErrBuf - } - e.Version = binary.BigEndian.Uint16(b[0:]) - e.Opcode = binary.BigEndian.Uint16(b[2:]) - e.Error = binary.BigEndian.Uint16(b[4:]) - e.Id = binary.BigEndian.Uint64(b[6:]) - e.LeaseLife = binary.BigEndian.Uint32(b[14:]) - return nil -} - -func (e *EDNS0_LLQ) String() string { - s := strconv.FormatUint(uint64(e.Version), 10) + " " + strconv.FormatUint(uint64(e.Opcode), 10) + - " " + strconv.FormatUint(uint64(e.Error), 10) + " " + strconv.FormatUint(e.Id, 10) + - " " + strconv.FormatUint(uint64(e.LeaseLife), 10) - return s -} -func (e *EDNS0_LLQ) copy() EDNS0 { - return &EDNS0_LLQ{e.Code, e.Version, e.Opcode, e.Error, e.Id, e.LeaseLife} -} - -// EDNS0_DUA implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975. -type EDNS0_DAU struct { - Code uint16 // Always EDNS0DAU - AlgCode []uint8 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_DAU) Option() uint16 { return EDNS0DAU } -func (e *EDNS0_DAU) pack() ([]byte, error) { return e.AlgCode, nil } -func (e *EDNS0_DAU) unpack(b []byte) error { e.AlgCode = b; return nil } - -func (e *EDNS0_DAU) String() string { - s := "" - for _, alg := range e.AlgCode { - if a, ok := AlgorithmToString[alg]; ok { - s += " " + a - } else { - s += " " + strconv.Itoa(int(alg)) - } - } - return s -} -func (e *EDNS0_DAU) copy() EDNS0 { return &EDNS0_DAU{e.Code, e.AlgCode} } - -// EDNS0_DHU implements the EDNS0 "DS Hash Understood" option. See RFC 6975. -type EDNS0_DHU struct { - Code uint16 // Always EDNS0DHU - AlgCode []uint8 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_DHU) Option() uint16 { return EDNS0DHU } -func (e *EDNS0_DHU) pack() ([]byte, error) { return e.AlgCode, nil } -func (e *EDNS0_DHU) unpack(b []byte) error { e.AlgCode = b; return nil } - -func (e *EDNS0_DHU) String() string { - s := "" - for _, alg := range e.AlgCode { - if a, ok := HashToString[alg]; ok { - s += " " + a - } else { - s += " " + strconv.Itoa(int(alg)) - } - } - return s -} -func (e *EDNS0_DHU) copy() EDNS0 { return &EDNS0_DHU{e.Code, e.AlgCode} } - -// EDNS0_N3U implements the EDNS0 "NSEC3 Hash Understood" option. See RFC 6975. -type EDNS0_N3U struct { - Code uint16 // Always EDNS0N3U - AlgCode []uint8 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_N3U) Option() uint16 { return EDNS0N3U } -func (e *EDNS0_N3U) pack() ([]byte, error) { return e.AlgCode, nil } -func (e *EDNS0_N3U) unpack(b []byte) error { e.AlgCode = b; return nil } - -func (e *EDNS0_N3U) String() string { - // Re-use the hash map - s := "" - for _, alg := range e.AlgCode { - if a, ok := HashToString[alg]; ok { - s += " " + a - } else { - s += " " + strconv.Itoa(int(alg)) - } - } - return s -} -func (e *EDNS0_N3U) copy() EDNS0 { return &EDNS0_N3U{e.Code, e.AlgCode} } - -// EDNS0_EXPIRE implementes the EDNS0 option as described in RFC 7314. -type EDNS0_EXPIRE struct { - Code uint16 // Always EDNS0EXPIRE - Expire uint32 -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_EXPIRE) Option() uint16 { return EDNS0EXPIRE } -func (e *EDNS0_EXPIRE) String() string { return strconv.FormatUint(uint64(e.Expire), 10) } -func (e *EDNS0_EXPIRE) copy() EDNS0 { return &EDNS0_EXPIRE{e.Code, e.Expire} } - -func (e *EDNS0_EXPIRE) pack() ([]byte, error) { - b := make([]byte, 4) - binary.BigEndian.PutUint32(b, e.Expire) - return b, nil -} - -func (e *EDNS0_EXPIRE) unpack(b []byte) error { - if len(b) < 4 { - return ErrBuf - } - e.Expire = binary.BigEndian.Uint32(b) - return nil -} - -// The EDNS0_LOCAL option is used for local/experimental purposes. The option -// code is recommended to be within the range [EDNS0LOCALSTART, EDNS0LOCALEND] -// (RFC6891), although any unassigned code can actually be used. The content of -// the option is made available in Data, unaltered. -// Basic use pattern for creating a local option: -// -// o := new(dns.OPT) -// o.Hdr.Name = "." -// o.Hdr.Rrtype = dns.TypeOPT -// e := new(dns.EDNS0_LOCAL) -// e.Code = dns.EDNS0LOCALSTART -// e.Data = []byte{72, 82, 74} -// o.Option = append(o.Option, e) -type EDNS0_LOCAL struct { - Code uint16 - Data []byte -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_LOCAL) Option() uint16 { return e.Code } -func (e *EDNS0_LOCAL) String() string { - return strconv.FormatInt(int64(e.Code), 10) + ":0x" + hex.EncodeToString(e.Data) -} -func (e *EDNS0_LOCAL) copy() EDNS0 { - b := make([]byte, len(e.Data)) - copy(b, e.Data) - return &EDNS0_LOCAL{e.Code, b} -} - -func (e *EDNS0_LOCAL) pack() ([]byte, error) { - b := make([]byte, len(e.Data)) - copied := copy(b, e.Data) - if copied != len(e.Data) { - return nil, ErrBuf - } - return b, nil -} - -func (e *EDNS0_LOCAL) unpack(b []byte) error { - e.Data = make([]byte, len(b)) - copied := copy(e.Data, b) - if copied != len(b) { - return ErrBuf - } - return nil -} - -// EDNS0_TCP_KEEPALIVE is an EDNS0 option that instructs the server to keep -// the TCP connection alive. See RFC 7828. -type EDNS0_TCP_KEEPALIVE struct { - Code uint16 // Always EDNSTCPKEEPALIVE - Length uint16 // the value 0 if the TIMEOUT is omitted, the value 2 if it is present; - Timeout uint16 // an idle timeout value for the TCP connection, specified in units of 100 milliseconds, encoded in network byte order. -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_TCP_KEEPALIVE) Option() uint16 { return EDNS0TCPKEEPALIVE } - -func (e *EDNS0_TCP_KEEPALIVE) pack() ([]byte, error) { - if e.Timeout != 0 && e.Length != 2 { - return nil, errors.New("dns: timeout specified but length is not 2") - } - if e.Timeout == 0 && e.Length != 0 { - return nil, errors.New("dns: timeout not specified but length is not 0") - } - b := make([]byte, 4+e.Length) - binary.BigEndian.PutUint16(b[0:], e.Code) - binary.BigEndian.PutUint16(b[2:], e.Length) - if e.Length == 2 { - binary.BigEndian.PutUint16(b[4:], e.Timeout) - } - return b, nil -} - -func (e *EDNS0_TCP_KEEPALIVE) unpack(b []byte) error { - if len(b) < 4 { - return ErrBuf - } - e.Length = binary.BigEndian.Uint16(b[2:4]) - if e.Length != 0 && e.Length != 2 { - return errors.New("dns: length mismatch, want 0/2 but got " + strconv.FormatUint(uint64(e.Length), 10)) - } - if e.Length == 2 { - if len(b) < 6 { - return ErrBuf - } - e.Timeout = binary.BigEndian.Uint16(b[4:6]) - } - return nil -} - -func (e *EDNS0_TCP_KEEPALIVE) String() (s string) { - s = "use tcp keep-alive" - if e.Length == 0 { - s += ", timeout omitted" - } else { - s += fmt.Sprintf(", timeout %dms", e.Timeout*100) - } - return -} -func (e *EDNS0_TCP_KEEPALIVE) copy() EDNS0 { return &EDNS0_TCP_KEEPALIVE{e.Code, e.Length, e.Timeout} } - -// EDNS0_PADDING option is used to add padding to a request/response. The default -// value of padding SHOULD be 0x0 but other values MAY be used, for instance if -// compression is applied before encryption which may break signatures. -type EDNS0_PADDING struct { - Padding []byte -} - -// Option implements the EDNS0 interface. -func (e *EDNS0_PADDING) Option() uint16 { return EDNS0PADDING } -func (e *EDNS0_PADDING) pack() ([]byte, error) { return e.Padding, nil } -func (e *EDNS0_PADDING) unpack(b []byte) error { e.Padding = b; return nil } -func (e *EDNS0_PADDING) String() string { return fmt.Sprintf("%0X", e.Padding) } -func (e *EDNS0_PADDING) copy() EDNS0 { - b := make([]byte, len(e.Padding)) - copy(b, e.Padding) - return &EDNS0_PADDING{b} -} diff --git a/vendor/github.com/miekg/dns/format.go b/vendor/github.com/miekg/dns/format.go deleted file mode 100644 index 0ec79f2f..00000000 --- a/vendor/github.com/miekg/dns/format.go +++ /dev/null @@ -1,93 +0,0 @@ -package dns - -import ( - "net" - "reflect" - "strconv" -) - -// NumField returns the number of rdata fields r has. -func NumField(r RR) int { - return reflect.ValueOf(r).Elem().NumField() - 1 // Remove RR_Header -} - -// Field returns the rdata field i as a string. Fields are indexed starting from 1. -// RR types that holds slice data, for instance the NSEC type bitmap will return a single -// string where the types are concatenated using a space. -// Accessing non existing fields will cause a panic. -func Field(r RR, i int) string { - if i == 0 { - return "" - } - d := reflect.ValueOf(r).Elem().Field(i) - switch d.Kind() { - case reflect.String: - return d.String() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(d.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return strconv.FormatUint(d.Uint(), 10) - case reflect.Slice: - switch reflect.ValueOf(r).Elem().Type().Field(i).Tag { - case `dns:"a"`: - // TODO(miek): Hmm store this as 16 bytes - if d.Len() < net.IPv4len { - return "" - } - if d.Len() < net.IPv6len { - return net.IPv4(byte(d.Index(0).Uint()), - byte(d.Index(1).Uint()), - byte(d.Index(2).Uint()), - byte(d.Index(3).Uint())).String() - } - return net.IPv4(byte(d.Index(12).Uint()), - byte(d.Index(13).Uint()), - byte(d.Index(14).Uint()), - byte(d.Index(15).Uint())).String() - case `dns:"aaaa"`: - if d.Len() < net.IPv6len { - return "" - } - return net.IP{ - byte(d.Index(0).Uint()), - byte(d.Index(1).Uint()), - byte(d.Index(2).Uint()), - byte(d.Index(3).Uint()), - byte(d.Index(4).Uint()), - byte(d.Index(5).Uint()), - byte(d.Index(6).Uint()), - byte(d.Index(7).Uint()), - byte(d.Index(8).Uint()), - byte(d.Index(9).Uint()), - byte(d.Index(10).Uint()), - byte(d.Index(11).Uint()), - byte(d.Index(12).Uint()), - byte(d.Index(13).Uint()), - byte(d.Index(14).Uint()), - byte(d.Index(15).Uint()), - }.String() - case `dns:"nsec"`: - if d.Len() == 0 { - return "" - } - s := Type(d.Index(0).Uint()).String() - for i := 1; i < d.Len(); i++ { - s += " " + Type(d.Index(i).Uint()).String() - } - return s - default: - // if it does not have a tag its a string slice - fallthrough - case `dns:"txt"`: - if d.Len() == 0 { - return "" - } - s := d.Index(0).String() - for i := 1; i < d.Len(); i++ { - s += " " + d.Index(i).String() - } - return s - } - } - return "" -} diff --git a/vendor/github.com/miekg/dns/fuzz.go b/vendor/github.com/miekg/dns/fuzz.go deleted file mode 100644 index a8a09184..00000000 --- a/vendor/github.com/miekg/dns/fuzz.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build fuzz - -package dns - -func Fuzz(data []byte) int { - msg := new(Msg) - - if err := msg.Unpack(data); err != nil { - return 0 - } - if _, err := msg.Pack(); err != nil { - return 0 - } - - return 1 -} - -func FuzzNewRR(data []byte) int { - if _, err := NewRR(string(data)); err != nil { - return 0 - } - return 1 -} diff --git a/vendor/github.com/miekg/dns/generate.go b/vendor/github.com/miekg/dns/generate.go deleted file mode 100644 index 97bc39f5..00000000 --- a/vendor/github.com/miekg/dns/generate.go +++ /dev/null @@ -1,242 +0,0 @@ -package dns - -import ( - "bytes" - "fmt" - "io" - "strconv" - "strings" -) - -// Parse the $GENERATE statement as used in BIND9 zones. -// See http://www.zytrax.com/books/dns/ch8/generate.html for instance. -// We are called after '$GENERATE '. After which we expect: -// * the range (12-24/2) -// * lhs (ownername) -// * [[ttl][class]] -// * type -// * rhs (rdata) -// But we are lazy here, only the range is parsed *all* occurrences -// of $ after that are interpreted. -func (zp *ZoneParser) generate(l lex) (RR, bool) { - token := l.token - step := 1 - if i := strings.IndexByte(token, '/'); i >= 0 { - if i+1 == len(token) { - return zp.setParseError("bad step in $GENERATE range", l) - } - - s, err := strconv.Atoi(token[i+1:]) - if err != nil || s <= 0 { - return zp.setParseError("bad step in $GENERATE range", l) - } - - step = s - token = token[:i] - } - - sx := strings.SplitN(token, "-", 2) - if len(sx) != 2 { - return zp.setParseError("bad start-stop in $GENERATE range", l) - } - - start, err := strconv.Atoi(sx[0]) - if err != nil { - return zp.setParseError("bad start in $GENERATE range", l) - } - - end, err := strconv.Atoi(sx[1]) - if err != nil { - return zp.setParseError("bad stop in $GENERATE range", l) - } - if end < 0 || start < 0 || end < start { - return zp.setParseError("bad range in $GENERATE range", l) - } - - zp.c.Next() // _BLANK - - // Create a complete new string, which we then parse again. - var s string - for l, ok := zp.c.Next(); ok; l, ok = zp.c.Next() { - if l.err { - return zp.setParseError("bad data in $GENERATE directive", l) - } - if l.value == zNewline { - break - } - - s += l.token - } - - r := &generateReader{ - s: s, - - cur: start, - start: start, - end: end, - step: step, - - file: zp.file, - lex: &l, - } - zp.sub = NewZoneParser(r, zp.origin, zp.file) - zp.sub.includeDepth, zp.sub.includeAllowed = zp.includeDepth, zp.includeAllowed - zp.sub.SetDefaultTTL(defaultTtl) - return zp.subNext() -} - -type generateReader struct { - s string - si int - - cur int - start int - end int - step int - - mod bytes.Buffer - - escape bool - - eof bool - - file string - lex *lex -} - -func (r *generateReader) parseError(msg string, end int) *ParseError { - r.eof = true // Make errors sticky. - - l := *r.lex - l.token = r.s[r.si-1 : end] - l.column += r.si // l.column starts one zBLANK before r.s - - return &ParseError{r.file, msg, l} -} - -func (r *generateReader) Read(p []byte) (int, error) { - // NewZLexer, through NewZoneParser, should use ReadByte and - // not end up here. - - panic("not implemented") -} - -func (r *generateReader) ReadByte() (byte, error) { - if r.eof { - return 0, io.EOF - } - if r.mod.Len() > 0 { - return r.mod.ReadByte() - } - - if r.si >= len(r.s) { - r.si = 0 - r.cur += r.step - - r.eof = r.cur > r.end || r.cur < 0 - return '\n', nil - } - - si := r.si - r.si++ - - switch r.s[si] { - case '\\': - if r.escape { - r.escape = false - return '\\', nil - } - - r.escape = true - return r.ReadByte() - case '$': - if r.escape { - r.escape = false - return '$', nil - } - - mod := "%d" - - if si >= len(r.s)-1 { - // End of the string - fmt.Fprintf(&r.mod, mod, r.cur) - return r.mod.ReadByte() - } - - if r.s[si+1] == '$' { - r.si++ - return '$', nil - } - - var offset int - - // Search for { and } - if r.s[si+1] == '{' { - // Modifier block - sep := strings.Index(r.s[si+2:], "}") - if sep < 0 { - return 0, r.parseError("bad modifier in $GENERATE", len(r.s)) - } - - var errMsg string - mod, offset, errMsg = modToPrintf(r.s[si+2 : si+2+sep]) - if errMsg != "" { - return 0, r.parseError(errMsg, si+3+sep) - } - if r.start+offset < 0 || r.end+offset > 1<<31-1 { - return 0, r.parseError("bad offset in $GENERATE", si+3+sep) - } - - r.si += 2 + sep // Jump to it - } - - fmt.Fprintf(&r.mod, mod, r.cur+offset) - return r.mod.ReadByte() - default: - if r.escape { // Pretty useless here - r.escape = false - return r.ReadByte() - } - - return r.s[si], nil - } -} - -// Convert a $GENERATE modifier 0,0,d to something Printf can deal with. -func modToPrintf(s string) (string, int, string) { - // Modifier is { offset [ ,width [ ,base ] ] } - provide default - // values for optional width and type, if necessary. - var offStr, widthStr, base string - switch xs := strings.Split(s, ","); len(xs) { - case 1: - offStr, widthStr, base = xs[0], "0", "d" - case 2: - offStr, widthStr, base = xs[0], xs[1], "d" - case 3: - offStr, widthStr, base = xs[0], xs[1], xs[2] - default: - return "", 0, "bad modifier in $GENERATE" - } - - switch base { - case "o", "d", "x", "X": - default: - return "", 0, "bad base in $GENERATE" - } - - offset, err := strconv.Atoi(offStr) - if err != nil { - return "", 0, "bad offset in $GENERATE" - } - - width, err := strconv.Atoi(widthStr) - if err != nil || width < 0 || width > 255 { - return "", 0, "bad width in $GENERATE" - } - - if width == 0 { - return "%" + base, offset, "" - } - - return "%0" + widthStr + base, offset, "" -} diff --git a/vendor/github.com/miekg/dns/labels.go b/vendor/github.com/miekg/dns/labels.go deleted file mode 100644 index e32d2a1d..00000000 --- a/vendor/github.com/miekg/dns/labels.go +++ /dev/null @@ -1,188 +0,0 @@ -package dns - -// Holds a bunch of helper functions for dealing with labels. - -// SplitDomainName splits a name string into it's labels. -// www.miek.nl. returns []string{"www", "miek", "nl"} -// .www.miek.nl. returns []string{"", "www", "miek", "nl"}, -// The root label (.) returns nil. Note that using -// strings.Split(s) will work in most cases, but does not handle -// escaped dots (\.) for instance. -// s must be a syntactically valid domain name, see IsDomainName. -func SplitDomainName(s string) (labels []string) { - if len(s) == 0 { - return nil - } - fqdnEnd := 0 // offset of the final '.' or the length of the name - idx := Split(s) - begin := 0 - if IsFqdn(s) { - fqdnEnd = len(s) - 1 - } else { - fqdnEnd = len(s) - } - - switch len(idx) { - case 0: - return nil - case 1: - // no-op - default: - for _, end := range idx[1:] { - labels = append(labels, s[begin:end-1]) - begin = end - } - } - - return append(labels, s[begin:fqdnEnd]) -} - -// CompareDomainName compares the names s1 and s2 and -// returns how many labels they have in common starting from the *right*. -// The comparison stops at the first inequality. The names are downcased -// before the comparison. -// -// www.miek.nl. and miek.nl. have two labels in common: miek and nl -// www.miek.nl. and www.bla.nl. have one label in common: nl -// -// s1 and s2 must be syntactically valid domain names. -func CompareDomainName(s1, s2 string) (n int) { - // the first check: root label - if s1 == "." || s2 == "." { - return 0 - } - - l1 := Split(s1) - l2 := Split(s2) - - j1 := len(l1) - 1 // end - i1 := len(l1) - 2 // start - j2 := len(l2) - 1 - i2 := len(l2) - 2 - // the second check can be done here: last/only label - // before we fall through into the for-loop below - if equal(s1[l1[j1]:], s2[l2[j2]:]) { - n++ - } else { - return - } - for { - if i1 < 0 || i2 < 0 { - break - } - if equal(s1[l1[i1]:l1[j1]], s2[l2[i2]:l2[j2]]) { - n++ - } else { - break - } - j1-- - i1-- - j2-- - i2-- - } - return -} - -// CountLabel counts the the number of labels in the string s. -// s must be a syntactically valid domain name. -func CountLabel(s string) (labels int) { - if s == "." { - return - } - off := 0 - end := false - for { - off, end = NextLabel(s, off) - labels++ - if end { - return - } - } -} - -// Split splits a name s into its label indexes. -// www.miek.nl. returns []int{0, 4, 9}, www.miek.nl also returns []int{0, 4, 9}. -// The root name (.) returns nil. Also see SplitDomainName. -// s must be a syntactically valid domain name. -func Split(s string) []int { - if s == "." { - return nil - } - idx := make([]int, 1, 3) - off := 0 - end := false - - for { - off, end = NextLabel(s, off) - if end { - return idx - } - idx = append(idx, off) - } -} - -// NextLabel returns the index of the start of the next label in the -// string s starting at offset. -// The bool end is true when the end of the string has been reached. -// Also see PrevLabel. -func NextLabel(s string, offset int) (i int, end bool) { - quote := false - for i = offset; i < len(s)-1; i++ { - switch s[i] { - case '\\': - quote = !quote - default: - quote = false - case '.': - if quote { - quote = !quote - continue - } - return i + 1, false - } - } - return i + 1, true -} - -// PrevLabel returns the index of the label when starting from the right and -// jumping n labels to the left. -// The bool start is true when the start of the string has been overshot. -// Also see NextLabel. -func PrevLabel(s string, n int) (i int, start bool) { - if n == 0 { - return len(s), false - } - lab := Split(s) - if lab == nil { - return 0, true - } - if n > len(lab) { - return 0, true - } - return lab[len(lab)-n], false -} - -// equal compares a and b while ignoring case. It returns true when equal otherwise false. -func equal(a, b string) bool { - // might be lifted into API function. - la := len(a) - lb := len(b) - if la != lb { - return false - } - - for i := la - 1; i >= 0; i-- { - ai := a[i] - bi := b[i] - if ai >= 'A' && ai <= 'Z' { - ai |= 'a' - 'A' - } - if bi >= 'A' && bi <= 'Z' { - bi |= 'a' - 'A' - } - if ai != bi { - return false - } - } - return true -} diff --git a/vendor/github.com/miekg/dns/listen_go111.go b/vendor/github.com/miekg/dns/listen_go111.go deleted file mode 100644 index fad195cf..00000000 --- a/vendor/github.com/miekg/dns/listen_go111.go +++ /dev/null @@ -1,44 +0,0 @@ -// +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) -} diff --git a/vendor/github.com/miekg/dns/listen_go_not111.go b/vendor/github.com/miekg/dns/listen_go_not111.go deleted file mode 100644 index b9201417..00000000 --- a/vendor/github.com/miekg/dns/listen_go_not111.go +++ /dev/null @@ -1,23 +0,0 @@ -// +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) -} diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go deleted file mode 100644 index e04fb5d7..00000000 --- a/vendor/github.com/miekg/dns/msg.go +++ /dev/null @@ -1,1228 +0,0 @@ -// DNS packet assembly, see RFC 1035. Converting from - Unpack() - -// and to - Pack() - wire format. -// All the packers and unpackers take a (msg []byte, off int) -// and return (off1 int, ok bool). If they return ok==false, they -// also return off1==len(msg), so that the next unpacker will -// also fail. This lets us avoid checks of ok until the end of a -// packing sequence. - -package dns - -//go:generate go run msg_generate.go - -import ( - crand "crypto/rand" - "encoding/binary" - "fmt" - "math/big" - "math/rand" - "strconv" - "strings" - "sync" -) - -const ( - maxCompressionOffset = 2 << 13 // We have 14 bits for the compression pointer - maxDomainNameWireOctets = 255 // See RFC 1035 section 2.3.4 - - // This is the maximum number of compression pointers that should occur in a - // semantically valid message. Each label in a domain name must be at least one - // octet and is separated by a period. The root label won't be represented by a - // compression pointer to a compression pointer, hence the -2 to exclude the - // smallest valid root label. - // - // It is possible to construct a valid message that has more compression pointers - // than this, and still doesn't loop, by pointing to a previous pointer. This is - // not something a well written implementation should ever do, so we leave them - // to trip the maximum compression pointer check. - maxCompressionPointers = (maxDomainNameWireOctets+1)/2 - 2 - - // This is the maximum length of a domain name in presentation format. The - // maximum wire length of a domain name is 255 octets (see above), with the - // maximum label length being 63. The wire format requires one extra byte over - // the presentation format, reducing the number of octets by 1. Each label in - // the name will be separated by a single period, with each octet in the label - // expanding to at most 4 bytes (\DDD). If all other labels are of the maximum - // length, then the final label can only be 61 octets long to not exceed the - // maximum allowed wire length. - maxDomainNamePresentationLength = 61*4 + 1 + 63*4 + 1 + 63*4 + 1 + 63*4 + 1 -) - -// Errors defined in this package. -var ( - ErrAlg error = &Error{err: "bad algorithm"} // ErrAlg indicates an error with the (DNSSEC) algorithm. - ErrAuth error = &Error{err: "bad authentication"} // ErrAuth indicates an error in the TSIG authentication. - ErrBuf error = &Error{err: "buffer size too small"} // ErrBuf indicates that the buffer used is too small for the message. - ErrConnEmpty error = &Error{err: "conn has no connection"} // ErrConnEmpty indicates a connection is being used before it is initialized. - ErrExtendedRcode error = &Error{err: "bad extended rcode"} // ErrExtendedRcode ... - ErrFqdn error = &Error{err: "domain must be fully qualified"} // ErrFqdn indicates that a domain name does not have a closing dot. - ErrId error = &Error{err: "id mismatch"} // ErrId indicates there is a mismatch with the message's ID. - ErrKeyAlg error = &Error{err: "bad key algorithm"} // ErrKeyAlg indicates that the algorithm in the key is not valid. - ErrKey error = &Error{err: "bad key"} - ErrKeySize error = &Error{err: "bad key size"} - ErrLongDomain error = &Error{err: fmt.Sprintf("domain name exceeded %d wire-format octets", maxDomainNameWireOctets)} - ErrNoSig error = &Error{err: "no signature found"} - ErrPrivKey error = &Error{err: "bad private key"} - ErrRcode error = &Error{err: "bad rcode"} - ErrRdata error = &Error{err: "bad rdata"} - ErrRRset error = &Error{err: "bad rrset"} - ErrSecret error = &Error{err: "no secrets defined"} - ErrShortRead error = &Error{err: "short read"} - ErrSig error = &Error{err: "bad signature"} // ErrSig indicates that a signature can not be cryptographically validated. - ErrSoa error = &Error{err: "no SOA"} // ErrSOA indicates that no SOA RR was seen when doing zone transfers. - ErrTime error = &Error{err: "bad time"} // ErrTime indicates a timing error in TSIG authentication. -) - -// Id by default, returns a 16 bits random number to be used as a -// message id. The random provided should be good enough. This being a -// variable the function can be reassigned to a custom function. -// For instance, to make it return a static value: -// -// dns.Id = func() uint16 { return 3 } -var Id = id - -var ( - idLock sync.Mutex - idRand *rand.Rand -) - -// id returns a 16 bits random number to be used as a -// message id. The random provided should be good enough. -func id() uint16 { - idLock.Lock() - - if idRand == nil { - // This (partially) works around - // https://github.com/golang/go/issues/11833 by only - // seeding idRand upon the first call to id. - - var seed int64 - var buf [8]byte - - if _, err := crand.Read(buf[:]); err == nil { - seed = int64(binary.LittleEndian.Uint64(buf[:])) - } else { - seed = rand.Int63() - } - - idRand = rand.New(rand.NewSource(seed)) - } - - // The call to idRand.Uint32 must be within the - // mutex lock because *rand.Rand is not safe for - // concurrent use. - // - // There is no added performance overhead to calling - // idRand.Uint32 inside a mutex lock over just - // calling rand.Uint32 as the global math/rand rng - // is internally protected by a sync.Mutex. - id := uint16(idRand.Uint32()) - - idLock.Unlock() - return id -} - -// MsgHdr is a a manually-unpacked version of (id, bits). -type MsgHdr struct { - Id uint16 - Response bool - Opcode int - Authoritative bool - Truncated bool - RecursionDesired bool - RecursionAvailable bool - Zero bool - AuthenticatedData bool - CheckingDisabled bool - Rcode int -} - -// Msg contains the layout of a DNS message. -type Msg struct { - MsgHdr - Compress bool `json:"-"` // If true, the message will be compressed when converted to wire format. - Question []Question // Holds the RR(s) of the question section. - Answer []RR // Holds the RR(s) of the answer section. - Ns []RR // Holds the RR(s) of the authority section. - Extra []RR // Holds the RR(s) of the additional section. -} - -// ClassToString is a maps Classes to strings for each CLASS wire type. -var ClassToString = map[uint16]string{ - ClassINET: "IN", - ClassCSNET: "CS", - ClassCHAOS: "CH", - ClassHESIOD: "HS", - ClassNONE: "NONE", - ClassANY: "ANY", -} - -// OpcodeToString maps Opcodes to strings. -var OpcodeToString = map[int]string{ - OpcodeQuery: "QUERY", - OpcodeIQuery: "IQUERY", - OpcodeStatus: "STATUS", - OpcodeNotify: "NOTIFY", - OpcodeUpdate: "UPDATE", -} - -// RcodeToString maps Rcodes to strings. -var RcodeToString = map[int]string{ - RcodeSuccess: "NOERROR", - RcodeFormatError: "FORMERR", - RcodeServerFailure: "SERVFAIL", - RcodeNameError: "NXDOMAIN", - RcodeNotImplemented: "NOTIMP", - RcodeRefused: "REFUSED", - RcodeYXDomain: "YXDOMAIN", // See RFC 2136 - RcodeYXRrset: "YXRRSET", - RcodeNXRrset: "NXRRSET", - RcodeNotAuth: "NOTAUTH", - RcodeNotZone: "NOTZONE", - RcodeBadSig: "BADSIG", // Also known as RcodeBadVers, see RFC 6891 - // RcodeBadVers: "BADVERS", - RcodeBadKey: "BADKEY", - RcodeBadTime: "BADTIME", - RcodeBadMode: "BADMODE", - RcodeBadName: "BADNAME", - RcodeBadAlg: "BADALG", - RcodeBadTrunc: "BADTRUNC", - RcodeBadCookie: "BADCOOKIE", -} - -// compressionMap is used to allow a more efficient compression map -// to be used for internal packDomainName calls without changing the -// signature or functionality of public API. -// -// In particular, map[string]uint16 uses 25% less per-entry memory -// than does map[string]int. -type compressionMap struct { - ext map[string]int // external callers - int map[string]uint16 // internal callers -} - -func (m compressionMap) valid() bool { - return m.int != nil || m.ext != nil -} - -func (m compressionMap) insert(s string, pos int) { - if m.ext != nil { - m.ext[s] = pos - } else { - m.int[s] = uint16(pos) - } -} - -func (m compressionMap) find(s string) (int, bool) { - if m.ext != nil { - pos, ok := m.ext[s] - return pos, ok - } - - pos, ok := m.int[s] - return int(pos), ok -} - -// Domain names are a sequence of counted strings -// split at the dots. They end with a zero-length string. - -// PackDomainName packs a domain name s into msg[off:]. -// If compression is wanted compress must be true and the compression -// map needs to hold a mapping between domain names and offsets -// pointing into msg. -func PackDomainName(s string, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) { - return packDomainName(s, msg, off, compressionMap{ext: compression}, compress) -} - -func packDomainName(s string, msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - // XXX: A logical copy of this function exists in IsDomainName and - // should be kept in sync with this function. - - ls := len(s) - if ls == 0 { // Ok, for instance when dealing with update RR without any rdata. - return off, nil - } - - // If not fully qualified, error out. - if !IsFqdn(s) { - return len(msg), ErrFqdn - } - - // Each dot ends a segment of the name. - // We trade each dot byte for a length byte. - // Except for escaped dots (\.), which are normal dots. - // There is also a trailing zero. - - // Compression - pointer := -1 - - // Emit sequence of counted strings, chopping at dots. - var ( - begin int - compBegin int - compOff int - bs []byte - wasDot bool - ) -loop: - for i := 0; i < ls; i++ { - var c byte - if bs == nil { - c = s[i] - } else { - c = bs[i] - } - - switch c { - case '\\': - if off+1 > len(msg) { - return len(msg), ErrBuf - } - - if bs == nil { - bs = []byte(s) - } - - // check for \DDD - if i+3 < ls && isDigit(bs[i+1]) && isDigit(bs[i+2]) && isDigit(bs[i+3]) { - bs[i] = dddToByte(bs[i+1:]) - copy(bs[i+1:ls-3], bs[i+4:]) - ls -= 3 - compOff += 3 - } else { - copy(bs[i:ls-1], bs[i+1:]) - ls-- - compOff++ - } - - wasDot = false - case '.': - if wasDot { - // two dots back to back is not legal - return len(msg), ErrRdata - } - wasDot = true - - labelLen := i - begin - if labelLen >= 1<<6 { // top two bits of length must be clear - return len(msg), ErrRdata - } - - // off can already (we're in a loop) be bigger than len(msg) - // this happens when a name isn't fully qualified - if off+1+labelLen > len(msg) { - return len(msg), ErrBuf - } - - // Don't try to compress '.' - // We should only compress when compress is true, but we should also still pick - // up names that can be used for *future* compression(s). - if compression.valid() && !isRootLabel(s, bs, begin, ls) { - if p, ok := compression.find(s[compBegin:]); ok { - // The first hit is the longest matching dname - // keep the pointer offset we get back and store - // the offset of the current name, because that's - // where we need to insert the pointer later - - // If compress is true, we're allowed to compress this dname - if compress { - pointer = p // Where to point to - break loop - } - } else if off < maxCompressionOffset { - // Only offsets smaller than maxCompressionOffset can be used. - compression.insert(s[compBegin:], off) - } - } - - // The following is covered by the length check above. - msg[off] = byte(labelLen) - - if bs == nil { - copy(msg[off+1:], s[begin:i]) - } else { - copy(msg[off+1:], bs[begin:i]) - } - off += 1 + labelLen - - begin = i + 1 - compBegin = begin + compOff - default: - wasDot = false - } - } - - // Root label is special - if isRootLabel(s, bs, 0, ls) { - return off, nil - } - - // If we did compression and we find something add the pointer here - if pointer != -1 { - // We have two bytes (14 bits) to put the pointer in - binary.BigEndian.PutUint16(msg[off:], uint16(pointer^0xC000)) - return off + 2, nil - } - - if off < len(msg) { - msg[off] = 0 - } - - return off + 1, nil -} - -// isRootLabel returns whether s or bs, from off to end, is the root -// label ".". -// -// If bs is nil, s will be checked, otherwise bs will be checked. -func isRootLabel(s string, bs []byte, off, end int) bool { - if bs == nil { - return s[off:end] == "." - } - - return end-off == 1 && bs[off] == '.' -} - -// Unpack a domain name. -// In addition to the simple sequences of counted strings above, -// domain names are allowed to refer to strings elsewhere in the -// packet, to avoid repeating common suffixes when returning -// many entries in a single domain. The pointers are marked -// by a length byte with the top two bits set. Ignoring those -// two bits, that byte and the next give a 14 bit offset from msg[0] -// where we should pick up the trail. -// Note that if we jump elsewhere in the packet, -// we return off1 == the offset after the first pointer we found, -// which is where the next record will start. -// In theory, the pointers are only allowed to jump backward. -// We let them jump anywhere and stop jumping after a while. - -// UnpackDomainName unpacks a domain name into a string. It returns -// the name, the new offset into msg and any error that occurred. -// -// When an error is encountered, the unpacked name will be discarded -// and len(msg) will be returned as the offset. -func UnpackDomainName(msg []byte, off int) (string, int, error) { - s := make([]byte, 0, maxDomainNamePresentationLength) - off1 := 0 - lenmsg := len(msg) - budget := maxDomainNameWireOctets - ptr := 0 // number of pointers followed -Loop: - for { - if off >= lenmsg { - return "", lenmsg, ErrBuf - } - c := int(msg[off]) - off++ - switch c & 0xC0 { - case 0x00: - if c == 0x00 { - // end of name - break Loop - } - // literal string - if off+c > lenmsg { - return "", lenmsg, ErrBuf - } - budget -= c + 1 // +1 for the label separator - if budget <= 0 { - return "", lenmsg, ErrLongDomain - } - for _, b := range msg[off : off+c] { - switch b { - case '.', '(', ')', ';', ' ', '@': - fallthrough - case '"', '\\': - s = append(s, '\\', b) - default: - if b < ' ' || b > '~' { // unprintable, use \DDD - s = append(s, escapeByte(b)...) - } else { - s = append(s, b) - } - } - } - s = append(s, '.') - off += c - case 0xC0: - // pointer to somewhere else in msg. - // remember location after first ptr, - // since that's how many bytes we consumed. - // also, don't follow too many pointers -- - // maybe there's a loop. - if off >= lenmsg { - return "", lenmsg, ErrBuf - } - c1 := msg[off] - off++ - if ptr == 0 { - off1 = off - } - if ptr++; ptr > maxCompressionPointers { - return "", lenmsg, &Error{err: "too many compression pointers"} - } - // pointer should guarantee that it advances and points forwards at least - // but the condition on previous three lines guarantees that it's - // at least loop-free - off = (c^0xC0)<<8 | int(c1) - default: - // 0x80 and 0x40 are reserved - return "", lenmsg, ErrRdata - } - } - if ptr == 0 { - off1 = off - } - if len(s) == 0 { - return ".", off1, nil - } - return string(s), off1, nil -} - -func packTxt(txt []string, msg []byte, offset int, tmp []byte) (int, error) { - if len(txt) == 0 { - if offset >= len(msg) { - return offset, ErrBuf - } - msg[offset] = 0 - return offset, nil - } - var err error - for _, s := range txt { - if len(s) > len(tmp) { - return offset, ErrBuf - } - offset, err = packTxtString(s, msg, offset, tmp) - if err != nil { - return offset, err - } - } - return offset, nil -} - -func packTxtString(s string, msg []byte, offset int, tmp []byte) (int, error) { - lenByteOffset := offset - if offset >= len(msg) || len(s) > len(tmp) { - return offset, ErrBuf - } - offset++ - bs := tmp[:len(s)] - copy(bs, s) - for i := 0; i < len(bs); i++ { - if len(msg) <= offset { - return offset, ErrBuf - } - if bs[i] == '\\' { - i++ - if i == len(bs) { - break - } - // check for \DDD - if i+2 < len(bs) && isDigit(bs[i]) && isDigit(bs[i+1]) && isDigit(bs[i+2]) { - msg[offset] = dddToByte(bs[i:]) - i += 2 - } else { - msg[offset] = bs[i] - } - } else { - msg[offset] = bs[i] - } - offset++ - } - l := offset - lenByteOffset - 1 - if l > 255 { - return offset, &Error{err: "string exceeded 255 bytes in txt"} - } - msg[lenByteOffset] = byte(l) - return offset, nil -} - -func packOctetString(s string, msg []byte, offset int, tmp []byte) (int, error) { - if offset >= len(msg) || len(s) > len(tmp) { - return offset, ErrBuf - } - bs := tmp[:len(s)] - copy(bs, s) - for i := 0; i < len(bs); i++ { - if len(msg) <= offset { - return offset, ErrBuf - } - if bs[i] == '\\' { - i++ - if i == len(bs) { - break - } - // check for \DDD - if i+2 < len(bs) && isDigit(bs[i]) && isDigit(bs[i+1]) && isDigit(bs[i+2]) { - msg[offset] = dddToByte(bs[i:]) - i += 2 - } else { - msg[offset] = bs[i] - } - } else { - msg[offset] = bs[i] - } - offset++ - } - return offset, nil -} - -func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) { - off = off0 - var s string - for off < len(msg) && err == nil { - s, off, err = unpackString(msg, off) - if err == nil { - ss = append(ss, s) - } - } - return -} - -// Helpers for dealing with escaped bytes -func isDigit(b byte) bool { return b >= '0' && b <= '9' } - -func dddToByte(s []byte) byte { - _ = s[2] // bounds check hint to compiler; see golang.org/issue/14808 - return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0')) -} - -func dddStringToByte(s string) byte { - _ = s[2] // bounds check hint to compiler; see golang.org/issue/14808 - return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0')) -} - -// Helper function for packing and unpacking -func intToBytes(i *big.Int, length int) []byte { - buf := i.Bytes() - if len(buf) < length { - b := make([]byte, length) - copy(b[length-len(buf):], buf) - return b - } - return buf -} - -// PackRR packs a resource record rr into msg[off:]. -// See PackDomainName for documentation about the compression. -func PackRR(rr RR, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) { - headerEnd, off1, err := packRR(rr, msg, off, compressionMap{ext: compression}, compress) - if err == nil { - // packRR no longer sets the Rdlength field on the rr, but - // callers might be expecting it so we set it here. - rr.Header().Rdlength = uint16(off1 - headerEnd) - } - return off1, err -} - -func packRR(rr RR, msg []byte, off int, compression compressionMap, compress bool) (headerEnd int, off1 int, err error) { - if rr == nil { - return len(msg), len(msg), &Error{err: "nil rr"} - } - - headerEnd, err = rr.Header().packHeader(msg, off, compression, compress) - if err != nil { - return headerEnd, len(msg), err - } - - off1, err = rr.pack(msg, headerEnd, compression, compress) - if err != nil { - return headerEnd, len(msg), err - } - - rdlength := off1 - headerEnd - if int(uint16(rdlength)) != rdlength { // overflow - return headerEnd, len(msg), ErrRdata - } - - // The RDLENGTH field is the last field in the header and we set it here. - binary.BigEndian.PutUint16(msg[headerEnd-2:], uint16(rdlength)) - return headerEnd, off1, nil -} - -// UnpackRR unpacks msg[off:] into an RR. -func UnpackRR(msg []byte, off int) (rr RR, off1 int, err error) { - h, off, msg, err := unpackHeader(msg, off) - if err != nil { - return nil, len(msg), err - } - - return UnpackRRWithHeader(h, msg, off) -} - -// UnpackRRWithHeader unpacks the record type specific payload given an existing -// RR_Header. -func UnpackRRWithHeader(h RR_Header, msg []byte, off int) (rr RR, off1 int, err error) { - if newFn, ok := TypeToRR[h.Rrtype]; ok { - rr = newFn() - *rr.Header() = h - } else { - rr = &RFC3597{Hdr: h} - } - - if noRdata(h) { - return rr, off, nil - } - - end := off + int(h.Rdlength) - - off, err = rr.unpack(msg, off) - if err != nil { - return nil, end, err - } - if off != end { - return &h, end, &Error{err: "bad rdlength"} - } - - return rr, off, nil -} - -// unpackRRslice unpacks msg[off:] into an []RR. -// If we cannot unpack the whole array, then it will return nil -func unpackRRslice(l int, msg []byte, off int) (dst1 []RR, off1 int, err error) { - var r RR - // Don't pre-allocate, l may be under attacker control - var dst []RR - for i := 0; i < l; i++ { - off1 := off - r, off, err = UnpackRR(msg, off) - if err != nil { - off = len(msg) - break - } - // If offset does not increase anymore, l is a lie - if off1 == off { - l = i - break - } - dst = append(dst, r) - } - if err != nil && off == len(msg) { - dst = nil - } - return dst, off, err -} - -// Convert a MsgHdr to a string, with dig-like headers: -// -//;; opcode: QUERY, status: NOERROR, id: 48404 -// -//;; flags: qr aa rd ra; -func (h *MsgHdr) String() string { - if h == nil { - return " MsgHdr" - } - - s := ";; opcode: " + OpcodeToString[h.Opcode] - s += ", status: " + RcodeToString[h.Rcode] - s += ", id: " + strconv.Itoa(int(h.Id)) + "\n" - - s += ";; flags:" - if h.Response { - s += " qr" - } - if h.Authoritative { - s += " aa" - } - if h.Truncated { - s += " tc" - } - if h.RecursionDesired { - s += " rd" - } - if h.RecursionAvailable { - s += " ra" - } - if h.Zero { // Hmm - s += " z" - } - if h.AuthenticatedData { - s += " ad" - } - if h.CheckingDisabled { - s += " cd" - } - - s += ";" - return s -} - -// Pack packs a Msg: it is converted to to wire format. -// If the dns.Compress is true the message will be in compressed wire format. -func (dns *Msg) Pack() (msg []byte, err error) { - return dns.PackBuffer(nil) -} - -// PackBuffer packs a Msg, using the given buffer buf. If buf is too small a new buffer is allocated. -func (dns *Msg) PackBuffer(buf []byte) (msg []byte, err error) { - // If this message can't be compressed, avoid filling the - // compression map and creating garbage. - if dns.Compress && dns.isCompressible() { - compression := make(map[string]uint16) // Compression pointer mappings. - return dns.packBufferWithCompressionMap(buf, compressionMap{int: compression}, true) - } - - return dns.packBufferWithCompressionMap(buf, compressionMap{}, false) -} - -// packBufferWithCompressionMap packs a Msg, using the given buffer buf. -func (dns *Msg) packBufferWithCompressionMap(buf []byte, compression compressionMap, compress bool) (msg []byte, err error) { - if dns.Rcode < 0 || dns.Rcode > 0xFFF { - return nil, ErrRcode - } - - // Set extended rcode unconditionally if we have an opt, this will allow - // reseting the extended rcode bits if they need to. - if opt := dns.IsEdns0(); opt != nil { - opt.SetExtendedRcode(uint16(dns.Rcode)) - } else if dns.Rcode > 0xF { - // If Rcode is an extended one and opt is nil, error out. - return nil, ErrExtendedRcode - } - - // Convert convenient Msg into wire-like Header. - var dh Header - dh.Id = dns.Id - dh.Bits = uint16(dns.Opcode)<<11 | uint16(dns.Rcode&0xF) - if dns.Response { - dh.Bits |= _QR - } - if dns.Authoritative { - dh.Bits |= _AA - } - if dns.Truncated { - dh.Bits |= _TC - } - if dns.RecursionDesired { - dh.Bits |= _RD - } - if dns.RecursionAvailable { - dh.Bits |= _RA - } - if dns.Zero { - dh.Bits |= _Z - } - if dns.AuthenticatedData { - dh.Bits |= _AD - } - if dns.CheckingDisabled { - dh.Bits |= _CD - } - - dh.Qdcount = uint16(len(dns.Question)) - dh.Ancount = uint16(len(dns.Answer)) - dh.Nscount = uint16(len(dns.Ns)) - dh.Arcount = uint16(len(dns.Extra)) - - // We need the uncompressed length here, because we first pack it and then compress it. - msg = buf - uncompressedLen := msgLenWithCompressionMap(dns, nil) - if packLen := uncompressedLen + 1; len(msg) < packLen { - msg = make([]byte, packLen) - } - - // Pack it in: header and then the pieces. - off := 0 - off, err = dh.pack(msg, off, compression, compress) - if err != nil { - return nil, err - } - for _, r := range dns.Question { - off, err = r.pack(msg, off, compression, compress) - if err != nil { - return nil, err - } - } - for _, r := range dns.Answer { - _, off, err = packRR(r, msg, off, compression, compress) - if err != nil { - return nil, err - } - } - for _, r := range dns.Ns { - _, off, err = packRR(r, msg, off, compression, compress) - if err != nil { - return nil, err - } - } - for _, r := range dns.Extra { - _, off, err = packRR(r, msg, off, compression, compress) - if err != nil { - return nil, err - } - } - return msg[:off], nil -} - -func (dns *Msg) unpack(dh Header, msg []byte, off int) (err error) { - // If we are at the end of the message we should return *just* the - // header. This can still be useful to the caller. 9.9.9.9 sends these - // when responding with REFUSED for instance. - if off == len(msg) { - // reset sections before returning - dns.Question, dns.Answer, dns.Ns, dns.Extra = nil, nil, nil, nil - return nil - } - - // Qdcount, Ancount, Nscount, Arcount can't be trusted, as they are - // attacker controlled. This means we can't use them to pre-allocate - // slices. - dns.Question = nil - for i := 0; i < int(dh.Qdcount); i++ { - off1 := off - var q Question - q, off, err = unpackQuestion(msg, off) - if err != nil { - return err - } - if off1 == off { // Offset does not increase anymore, dh.Qdcount is a lie! - dh.Qdcount = uint16(i) - break - } - dns.Question = append(dns.Question, q) - } - - dns.Answer, off, err = unpackRRslice(int(dh.Ancount), msg, off) - // The header counts might have been wrong so we need to update it - dh.Ancount = uint16(len(dns.Answer)) - if err == nil { - dns.Ns, off, err = unpackRRslice(int(dh.Nscount), msg, off) - } - // The header counts might have been wrong so we need to update it - dh.Nscount = uint16(len(dns.Ns)) - if err == nil { - dns.Extra, off, err = unpackRRslice(int(dh.Arcount), msg, off) - } - // The header counts might have been wrong so we need to update it - dh.Arcount = uint16(len(dns.Extra)) - - // Set extended Rcode - if opt := dns.IsEdns0(); opt != nil { - dns.Rcode |= opt.ExtendedRcode() - } - - if off != len(msg) { - // TODO(miek) make this an error? - // use PackOpt to let people tell how detailed the error reporting should be? - // println("dns: extra bytes in dns packet", off, "<", len(msg)) - } - return err - -} - -// Unpack unpacks a binary message to a Msg structure. -func (dns *Msg) Unpack(msg []byte) (err error) { - dh, off, err := unpackMsgHdr(msg, 0) - if err != nil { - return err - } - - dns.setHdr(dh) - return dns.unpack(dh, msg, off) -} - -// Convert a complete message to a string with dig-like output. -func (dns *Msg) String() string { - if dns == nil { - return " MsgHdr" - } - s := dns.MsgHdr.String() + " " - s += "QUERY: " + strconv.Itoa(len(dns.Question)) + ", " - s += "ANSWER: " + strconv.Itoa(len(dns.Answer)) + ", " - s += "AUTHORITY: " + strconv.Itoa(len(dns.Ns)) + ", " - s += "ADDITIONAL: " + strconv.Itoa(len(dns.Extra)) + "\n" - if len(dns.Question) > 0 { - s += "\n;; QUESTION SECTION:\n" - for _, r := range dns.Question { - s += r.String() + "\n" - } - } - if len(dns.Answer) > 0 { - s += "\n;; ANSWER SECTION:\n" - for _, r := range dns.Answer { - if r != nil { - s += r.String() + "\n" - } - } - } - if len(dns.Ns) > 0 { - s += "\n;; AUTHORITY SECTION:\n" - for _, r := range dns.Ns { - if r != nil { - s += r.String() + "\n" - } - } - } - if len(dns.Extra) > 0 { - s += "\n;; ADDITIONAL SECTION:\n" - for _, r := range dns.Extra { - if r != nil { - s += r.String() + "\n" - } - } - } - return s -} - -// isCompressible returns whether the msg may be compressible. -func (dns *Msg) isCompressible() bool { - // If we only have one question, there is nothing we can ever compress. - return len(dns.Question) > 1 || len(dns.Answer) > 0 || - len(dns.Ns) > 0 || len(dns.Extra) > 0 -} - -// Len returns the message length when in (un)compressed wire format. -// If dns.Compress is true compression it is taken into account. Len() -// is provided to be a faster way to get the size of the resulting packet, -// than packing it, measuring the size and discarding the buffer. -func (dns *Msg) Len() int { - // If this message can't be compressed, avoid filling the - // compression map and creating garbage. - if dns.Compress && dns.isCompressible() { - compression := make(map[string]struct{}) - return msgLenWithCompressionMap(dns, compression) - } - - return msgLenWithCompressionMap(dns, nil) -} - -func msgLenWithCompressionMap(dns *Msg, compression map[string]struct{}) int { - l := headerSize - - for _, r := range dns.Question { - l += r.len(l, compression) - } - for _, r := range dns.Answer { - if r != nil { - l += r.len(l, compression) - } - } - for _, r := range dns.Ns { - if r != nil { - l += r.len(l, compression) - } - } - for _, r := range dns.Extra { - if r != nil { - l += r.len(l, compression) - } - } - - return l -} - -func domainNameLen(s string, off int, compression map[string]struct{}, compress bool) int { - if s == "" || s == "." { - return 1 - } - - escaped := strings.Contains(s, "\\") - - if compression != nil && (compress || off < maxCompressionOffset) { - // compressionLenSearch will insert the entry into the compression - // map if it doesn't contain it. - if l, ok := compressionLenSearch(compression, s, off); ok && compress { - if escaped { - return escapedNameLen(s[:l]) + 2 - } - - return l + 2 - } - } - - if escaped { - return escapedNameLen(s) + 1 - } - - return len(s) + 1 -} - -func escapedNameLen(s string) int { - nameLen := len(s) - for i := 0; i < len(s); i++ { - if s[i] != '\\' { - continue - } - - if i+3 < len(s) && isDigit(s[i+1]) && isDigit(s[i+2]) && isDigit(s[i+3]) { - nameLen -= 3 - i += 3 - } else { - nameLen-- - i++ - } - } - - return nameLen -} - -func compressionLenSearch(c map[string]struct{}, s string, msgOff int) (int, bool) { - for off, end := 0, false; !end; off, end = NextLabel(s, off) { - if _, ok := c[s[off:]]; ok { - return off, true - } - - if msgOff+off < maxCompressionOffset { - c[s[off:]] = struct{}{} - } - } - - return 0, false -} - -// Copy returns a new RR which is a deep-copy of r. -func Copy(r RR) RR { return r.copy() } - -// Len returns the length (in octets) of the uncompressed RR in wire format. -func Len(r RR) int { return r.len(0, nil) } - -// Copy returns a new *Msg which is a deep-copy of dns. -func (dns *Msg) Copy() *Msg { return dns.CopyTo(new(Msg)) } - -// CopyTo copies the contents to the provided message using a deep-copy and returns the copy. -func (dns *Msg) CopyTo(r1 *Msg) *Msg { - r1.MsgHdr = dns.MsgHdr - r1.Compress = dns.Compress - - if len(dns.Question) > 0 { - r1.Question = make([]Question, len(dns.Question)) - copy(r1.Question, dns.Question) // TODO(miek): Question is an immutable value, ok to do a shallow-copy - } - - rrArr := make([]RR, len(dns.Answer)+len(dns.Ns)+len(dns.Extra)) - r1.Answer, rrArr = rrArr[:0:len(dns.Answer)], rrArr[len(dns.Answer):] - r1.Ns, rrArr = rrArr[:0:len(dns.Ns)], rrArr[len(dns.Ns):] - r1.Extra = rrArr[:0:len(dns.Extra)] - - for _, r := range dns.Answer { - r1.Answer = append(r1.Answer, r.copy()) - } - - for _, r := range dns.Ns { - r1.Ns = append(r1.Ns, r.copy()) - } - - for _, r := range dns.Extra { - r1.Extra = append(r1.Extra, r.copy()) - } - - return r1 -} - -func (q *Question) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) { - off, err := packDomainName(q.Name, msg, off, compression, compress) - if err != nil { - return off, err - } - off, err = packUint16(q.Qtype, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(q.Qclass, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func unpackQuestion(msg []byte, off int) (Question, int, error) { - var ( - q Question - err error - ) - q.Name, off, err = UnpackDomainName(msg, off) - if err != nil { - return q, off, err - } - if off == len(msg) { - return q, off, nil - } - q.Qtype, off, err = unpackUint16(msg, off) - if err != nil { - return q, off, err - } - if off == len(msg) { - return q, off, nil - } - q.Qclass, off, err = unpackUint16(msg, off) - if off == len(msg) { - return q, off, nil - } - return q, off, err -} - -func (dh *Header) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) { - off, err := packUint16(dh.Id, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(dh.Bits, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(dh.Qdcount, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(dh.Ancount, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(dh.Nscount, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(dh.Arcount, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func unpackMsgHdr(msg []byte, off int) (Header, int, error) { - var ( - dh Header - err error - ) - dh.Id, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - dh.Bits, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - dh.Qdcount, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - dh.Ancount, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - dh.Nscount, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - dh.Arcount, off, err = unpackUint16(msg, off) - if err != nil { - return dh, off, err - } - return dh, off, nil -} - -// setHdr set the header in the dns using the binary data in dh. -func (dns *Msg) setHdr(dh Header) { - dns.Id = dh.Id - dns.Response = dh.Bits&_QR != 0 - dns.Opcode = int(dh.Bits>>11) & 0xF - dns.Authoritative = dh.Bits&_AA != 0 - dns.Truncated = dh.Bits&_TC != 0 - dns.RecursionDesired = dh.Bits&_RD != 0 - dns.RecursionAvailable = dh.Bits&_RA != 0 - dns.Zero = dh.Bits&_Z != 0 // _Z covers the zero bit, which should be zero; not sure why we set it to the opposite. - dns.AuthenticatedData = dh.Bits&_AD != 0 - dns.CheckingDisabled = dh.Bits&_CD != 0 - dns.Rcode = int(dh.Bits & 0xF) -} diff --git a/vendor/github.com/miekg/dns/msg_generate.go b/vendor/github.com/miekg/dns/msg_generate.go deleted file mode 100644 index 721a0fce..00000000 --- a/vendor/github.com/miekg/dns/msg_generate.go +++ /dev/null @@ -1,328 +0,0 @@ -//+build ignore - -// msg_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 pack/unpack methods based on the struct tags. The generated source is -// written to zmsg.go, and is meant to be checked into git. -package main - -import ( - "bytes" - "fmt" - "go/format" - "go/importer" - "go/types" - "log" - "os" - "strings" -) - -var packageHdr = ` -// Code generated by "go run msg_generate.go"; DO NOT EDIT. - -package dns - -` - -// getTypeStruct will take a type and the package scope, and return the -// (innermost) struct if the type is considered a RR type (currently defined as -// those structs beginning with a RR_Header, could be redefined as implementing -// the RR interface). The bool return value indicates if embedded structs were -// resolved. -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" { - continue - } - - // Check if corresponding TypeX exists - if scope.Lookup("Type"+o.Name()) == nil && o.Name() != "RFC3597" { - log.Fatalf("Constant Type%s does not exist.", o.Name()) - } - - namedTypes = append(namedTypes, o.Name()) - } - - b := &bytes.Buffer{} - b.WriteString(packageHdr) - - fmt.Fprint(b, "// pack*() functions\n\n") - for _, name := range namedTypes { - o := scope.Lookup(name) - st, _ := getTypeStruct(o.Type(), scope) - - fmt.Fprintf(b, "func (rr *%s) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {\n", name) - for i := 1; i < st.NumFields(); i++ { - o := func(s string) { - fmt.Fprintf(b, s, st.Field(i).Name()) - fmt.Fprint(b, `if err != nil { -return off, err -} -`) - } - - if _, ok := st.Field(i).Type().(*types.Slice); ok { - switch st.Tag(i) { - case `dns:"-"`: // ignored - case `dns:"txt"`: - o("off, err = packStringTxt(rr.%s, msg, off)\n") - case `dns:"opt"`: - o("off, err = packDataOpt(rr.%s, msg, off)\n") - case `dns:"nsec"`: - o("off, err = packDataNsec(rr.%s, msg, off)\n") - case `dns:"domain-name"`: - o("off, err = packDataDomainNames(rr.%s, msg, off, compression, false)\n") - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - continue - } - - switch { - case st.Tag(i) == `dns:"-"`: // ignored - case st.Tag(i) == `dns:"cdomain-name"`: - o("off, err = packDomainName(rr.%s, msg, off, compression, compress)\n") - case st.Tag(i) == `dns:"domain-name"`: - o("off, err = packDomainName(rr.%s, msg, off, compression, false)\n") - case st.Tag(i) == `dns:"a"`: - o("off, err = packDataA(rr.%s, msg, off)\n") - case st.Tag(i) == `dns:"aaaa"`: - o("off, err = packDataAAAA(rr.%s, msg, off)\n") - case st.Tag(i) == `dns:"uint48"`: - o("off, err = packUint48(rr.%s, msg, off)\n") - case st.Tag(i) == `dns:"txt"`: - o("off, err = packString(rr.%s, msg, off)\n") - - case strings.HasPrefix(st.Tag(i), `dns:"size-base32`): // size-base32 can be packed just like base32 - fallthrough - case st.Tag(i) == `dns:"base32"`: - o("off, err = packStringBase32(rr.%s, msg, off)\n") - - case strings.HasPrefix(st.Tag(i), `dns:"size-base64`): // size-base64 can be packed just like base64 - fallthrough - case st.Tag(i) == `dns:"base64"`: - o("off, err = packStringBase64(rr.%s, msg, off)\n") - - case strings.HasPrefix(st.Tag(i), `dns:"size-hex:SaltLength`): - // directly write instead of using o() so we get the error check in the correct place - field := st.Field(i).Name() - fmt.Fprintf(b, `// Only pack salt if value is not "-", i.e. empty -if rr.%s != "-" { - off, err = packStringHex(rr.%s, msg, off) - if err != nil { - return off, err - } -} -`, field, field) - continue - case strings.HasPrefix(st.Tag(i), `dns:"size-hex`): // size-hex can be packed just like hex - fallthrough - case st.Tag(i) == `dns:"hex"`: - o("off, err = packStringHex(rr.%s, msg, off)\n") - case st.Tag(i) == `dns:"any"`: - o("off, err = packStringAny(rr.%s, msg, off)\n") - case st.Tag(i) == `dns:"octet"`: - o("off, err = packStringOctet(rr.%s, msg, off)\n") - case st.Tag(i) == "": - switch st.Field(i).Type().(*types.Basic).Kind() { - case types.Uint8: - o("off, err = packUint8(rr.%s, msg, off)\n") - case types.Uint16: - o("off, err = packUint16(rr.%s, msg, off)\n") - case types.Uint32: - o("off, err = packUint32(rr.%s, msg, off)\n") - case types.Uint64: - o("off, err = packUint64(rr.%s, msg, off)\n") - case types.String: - o("off, err = packString(rr.%s, msg, off)\n") - default: - log.Fatalln(name, st.Field(i).Name()) - } - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - } - fmt.Fprintln(b, "return off, nil }\n") - } - - fmt.Fprint(b, "// unpack*() functions\n\n") - for _, name := range namedTypes { - o := scope.Lookup(name) - st, _ := getTypeStruct(o.Type(), scope) - - fmt.Fprintf(b, "func (rr *%s) unpack(msg []byte, off int) (off1 int, err error) {\n", name) - fmt.Fprint(b, `rdStart := off -_ = rdStart - -`) - for i := 1; i < st.NumFields(); i++ { - o := func(s string) { - fmt.Fprintf(b, s, st.Field(i).Name()) - fmt.Fprint(b, `if err != nil { -return off, err -} -`) - } - - // size-* are special, because they reference a struct member we should use for the length. - if strings.HasPrefix(st.Tag(i), `dns:"size-`) { - structMember := structMember(st.Tag(i)) - structTag := structTag(st.Tag(i)) - switch structTag { - case "hex": - fmt.Fprintf(b, "rr.%s, off, err = unpackStringHex(msg, off, off + int(rr.%s))\n", st.Field(i).Name(), structMember) - case "base32": - fmt.Fprintf(b, "rr.%s, off, err = unpackStringBase32(msg, off, off + int(rr.%s))\n", st.Field(i).Name(), structMember) - case "base64": - fmt.Fprintf(b, "rr.%s, off, err = unpackStringBase64(msg, off, off + int(rr.%s))\n", st.Field(i).Name(), structMember) - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - fmt.Fprint(b, `if err != nil { -return off, err -} -`) - continue - } - - if _, ok := st.Field(i).Type().(*types.Slice); ok { - switch st.Tag(i) { - case `dns:"-"`: // ignored - case `dns:"txt"`: - o("rr.%s, off, err = unpackStringTxt(msg, off)\n") - case `dns:"opt"`: - o("rr.%s, off, err = unpackDataOpt(msg, off)\n") - case `dns:"nsec"`: - o("rr.%s, off, err = unpackDataNsec(msg, off)\n") - case `dns:"domain-name"`: - o("rr.%s, off, err = unpackDataDomainNames(msg, off, rdStart + int(rr.Hdr.Rdlength))\n") - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - continue - } - - switch st.Tag(i) { - case `dns:"-"`: // ignored - case `dns:"cdomain-name"`: - fallthrough - case `dns:"domain-name"`: - o("rr.%s, off, err = UnpackDomainName(msg, off)\n") - case `dns:"a"`: - o("rr.%s, off, err = unpackDataA(msg, off)\n") - case `dns:"aaaa"`: - o("rr.%s, off, err = unpackDataAAAA(msg, off)\n") - case `dns:"uint48"`: - o("rr.%s, off, err = unpackUint48(msg, off)\n") - case `dns:"txt"`: - o("rr.%s, off, err = unpackString(msg, off)\n") - case `dns:"base32"`: - o("rr.%s, off, err = unpackStringBase32(msg, off, rdStart + int(rr.Hdr.Rdlength))\n") - case `dns:"base64"`: - o("rr.%s, off, err = unpackStringBase64(msg, off, rdStart + int(rr.Hdr.Rdlength))\n") - case `dns:"hex"`: - o("rr.%s, off, err = unpackStringHex(msg, off, rdStart + int(rr.Hdr.Rdlength))\n") - case `dns:"any"`: - o("rr.%s, off, err = unpackStringAny(msg, off, rdStart + int(rr.Hdr.Rdlength))\n") - case `dns:"octet"`: - o("rr.%s, off, err = unpackStringOctet(msg, off)\n") - case "": - switch st.Field(i).Type().(*types.Basic).Kind() { - case types.Uint8: - o("rr.%s, off, err = unpackUint8(msg, off)\n") - case types.Uint16: - o("rr.%s, off, err = unpackUint16(msg, off)\n") - case types.Uint32: - o("rr.%s, off, err = unpackUint32(msg, off)\n") - case types.Uint64: - o("rr.%s, off, err = unpackUint64(msg, off)\n") - case types.String: - o("rr.%s, off, err = unpackString(msg, off)\n") - default: - log.Fatalln(name, st.Field(i).Name()) - } - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - // If we've hit len(msg) we return without error. - if i < st.NumFields()-1 { - fmt.Fprintf(b, `if off == len(msg) { -return off, nil - } -`) - } - } - fmt.Fprintf(b, "return off, nil }\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("zmsg.go") - fatalIfErr(err) - defer f.Close() - f.Write(res) -} - -// structMember will take a tag like dns:"size-base32:SaltLength" and return the last part of this string. -func structMember(s string) string { - fields := strings.Split(s, ":") - if len(fields) == 0 { - return "" - } - f := fields[len(fields)-1] - // f should have a closing " - if len(f) > 1 { - return f[:len(f)-1] - } - return f -} - -// structTag will take a tag like dns:"size-base32:SaltLength" and return base32. -func structTag(s string) string { - fields := strings.Split(s, ":") - if len(fields) < 2 { - return "" - } - return fields[1][len("\"size-"):] -} - -func fatalIfErr(err error) { - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go deleted file mode 100644 index cb4ae764..00000000 --- a/vendor/github.com/miekg/dns/msg_helpers.go +++ /dev/null @@ -1,671 +0,0 @@ -package dns - -import ( - "encoding/base32" - "encoding/base64" - "encoding/binary" - "encoding/hex" - "net" - "strings" -) - -// helper functions called from the generated zmsg.go - -// These function are named after the tag to help pack/unpack, if there is no tag it is the name -// of the type they pack/unpack (string, int, etc). We prefix all with unpackData or packData, so packDataA or -// packDataDomainName. - -func unpackDataA(msg []byte, off int) (net.IP, int, error) { - if off+net.IPv4len > len(msg) { - return nil, len(msg), &Error{err: "overflow unpacking a"} - } - a := append(make(net.IP, 0, net.IPv4len), msg[off:off+net.IPv4len]...) - off += net.IPv4len - return a, off, nil -} - -func packDataA(a net.IP, msg []byte, off int) (int, error) { - switch len(a) { - case net.IPv4len, net.IPv6len: - // It must be a slice of 4, even if it is 16, we encode only the first 4 - if off+net.IPv4len > len(msg) { - return len(msg), &Error{err: "overflow packing a"} - } - - copy(msg[off:], a.To4()) - off += net.IPv4len - case 0: - // Allowed, for dynamic updates. - default: - return len(msg), &Error{err: "overflow packing a"} - } - return off, nil -} - -func unpackDataAAAA(msg []byte, off int) (net.IP, int, error) { - if off+net.IPv6len > len(msg) { - return nil, len(msg), &Error{err: "overflow unpacking aaaa"} - } - aaaa := append(make(net.IP, 0, net.IPv6len), msg[off:off+net.IPv6len]...) - off += net.IPv6len - return aaaa, off, nil -} - -func packDataAAAA(aaaa net.IP, msg []byte, off int) (int, error) { - switch len(aaaa) { - case net.IPv6len: - if off+net.IPv6len > len(msg) { - return len(msg), &Error{err: "overflow packing aaaa"} - } - - copy(msg[off:], aaaa) - off += net.IPv6len - case 0: - // Allowed, dynamic updates. - default: - return len(msg), &Error{err: "overflow packing aaaa"} - } - return off, nil -} - -// unpackHeader unpacks an RR header, returning the offset to the end of the header and a -// re-sliced msg according to the expected length of the RR. -func unpackHeader(msg []byte, off int) (rr RR_Header, off1 int, truncmsg []byte, err error) { - hdr := RR_Header{} - if off == len(msg) { - return hdr, off, msg, nil - } - - hdr.Name, off, err = UnpackDomainName(msg, off) - if err != nil { - return hdr, len(msg), msg, err - } - hdr.Rrtype, off, err = unpackUint16(msg, off) - if err != nil { - return hdr, len(msg), msg, err - } - hdr.Class, off, err = unpackUint16(msg, off) - if err != nil { - return hdr, len(msg), msg, err - } - hdr.Ttl, off, err = unpackUint32(msg, off) - if err != nil { - return hdr, len(msg), msg, err - } - hdr.Rdlength, off, err = unpackUint16(msg, off) - if err != nil { - return hdr, len(msg), msg, err - } - msg, err = truncateMsgFromRdlength(msg, off, hdr.Rdlength) - return hdr, off, msg, err -} - -// packHeader packs an RR header, returning the offset to the end of the header. -// See PackDomainName for documentation about the compression. -func (hdr RR_Header) packHeader(msg []byte, off int, compression compressionMap, compress bool) (int, error) { - if off == len(msg) { - return off, nil - } - - off, err := packDomainName(hdr.Name, msg, off, compression, compress) - if err != nil { - return len(msg), err - } - off, err = packUint16(hdr.Rrtype, msg, off) - if err != nil { - return len(msg), err - } - off, err = packUint16(hdr.Class, msg, off) - if err != nil { - return len(msg), err - } - off, err = packUint32(hdr.Ttl, msg, off) - if err != nil { - return len(msg), err - } - off, err = packUint16(0, msg, off) // The RDLENGTH field will be set later in packRR. - if err != nil { - return len(msg), err - } - return off, nil -} - -// helper helper functions. - -// truncateMsgFromRdLength truncates msg to match the expected length of the RR. -// Returns an error if msg is smaller than the expected size. -func truncateMsgFromRdlength(msg []byte, off int, rdlength uint16) (truncmsg []byte, err error) { - lenrd := off + int(rdlength) - if lenrd > len(msg) { - return msg, &Error{err: "overflowing header size"} - } - return msg[:lenrd], nil -} - -var base32HexNoPadEncoding = base32.HexEncoding.WithPadding(base32.NoPadding) - -func fromBase32(s []byte) (buf []byte, err error) { - for i, b := range s { - if b >= 'a' && b <= 'z' { - s[i] = b - 32 - } - } - buflen := base32HexNoPadEncoding.DecodedLen(len(s)) - buf = make([]byte, buflen) - n, err := base32HexNoPadEncoding.Decode(buf, s) - buf = buf[:n] - return -} - -func toBase32(b []byte) string { - return base32HexNoPadEncoding.EncodeToString(b) -} - -func fromBase64(s []byte) (buf []byte, err error) { - buflen := base64.StdEncoding.DecodedLen(len(s)) - buf = make([]byte, buflen) - n, err := base64.StdEncoding.Decode(buf, s) - buf = buf[:n] - return -} - -func toBase64(b []byte) string { return base64.StdEncoding.EncodeToString(b) } - -// dynamicUpdate returns true if the Rdlength is zero. -func noRdata(h RR_Header) bool { return h.Rdlength == 0 } - -func unpackUint8(msg []byte, off int) (i uint8, off1 int, err error) { - if off+1 > len(msg) { - return 0, len(msg), &Error{err: "overflow unpacking uint8"} - } - return msg[off], off + 1, nil -} - -func packUint8(i uint8, msg []byte, off int) (off1 int, err error) { - if off+1 > len(msg) { - return len(msg), &Error{err: "overflow packing uint8"} - } - msg[off] = i - return off + 1, nil -} - -func unpackUint16(msg []byte, off int) (i uint16, off1 int, err error) { - if off+2 > len(msg) { - return 0, len(msg), &Error{err: "overflow unpacking uint16"} - } - return binary.BigEndian.Uint16(msg[off:]), off + 2, nil -} - -func packUint16(i uint16, msg []byte, off int) (off1 int, err error) { - if off+2 > len(msg) { - return len(msg), &Error{err: "overflow packing uint16"} - } - binary.BigEndian.PutUint16(msg[off:], i) - return off + 2, nil -} - -func unpackUint32(msg []byte, off int) (i uint32, off1 int, err error) { - if off+4 > len(msg) { - return 0, len(msg), &Error{err: "overflow unpacking uint32"} - } - return binary.BigEndian.Uint32(msg[off:]), off + 4, nil -} - -func packUint32(i uint32, msg []byte, off int) (off1 int, err error) { - if off+4 > len(msg) { - return len(msg), &Error{err: "overflow packing uint32"} - } - binary.BigEndian.PutUint32(msg[off:], i) - return off + 4, nil -} - -func unpackUint48(msg []byte, off int) (i uint64, off1 int, err error) { - if off+6 > len(msg) { - 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) - i = 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]) - off += 6 - return i, off, nil -} - -func packUint48(i uint64, msg []byte, off int) (off1 int, err error) { - if off+6 > len(msg) { - return len(msg), &Error{err: "overflow packing uint64 as uint48"} - } - msg[off] = byte(i >> 40) - msg[off+1] = byte(i >> 32) - msg[off+2] = byte(i >> 24) - msg[off+3] = byte(i >> 16) - msg[off+4] = byte(i >> 8) - msg[off+5] = byte(i) - off += 6 - return off, nil -} - -func unpackUint64(msg []byte, off int) (i uint64, off1 int, err error) { - if off+8 > len(msg) { - return 0, len(msg), &Error{err: "overflow unpacking uint64"} - } - return binary.BigEndian.Uint64(msg[off:]), off + 8, nil -} - -func packUint64(i uint64, msg []byte, off int) (off1 int, err error) { - if off+8 > len(msg) { - return len(msg), &Error{err: "overflow packing uint64"} - } - binary.BigEndian.PutUint64(msg[off:], i) - off += 8 - return off, nil -} - -func unpackString(msg []byte, off int) (string, int, error) { - if off+1 > len(msg) { - return "", off, &Error{err: "overflow unpacking txt"} - } - l := int(msg[off]) - if off+l+1 > len(msg) { - return "", off, &Error{err: "overflow unpacking txt"} - } - var s strings.Builder - s.Grow(l) - for _, b := range msg[off+1 : off+1+l] { - switch { - case b == '"' || b == '\\': - s.WriteByte('\\') - s.WriteByte(b) - case b < ' ' || b > '~': // unprintable - s.WriteString(escapeByte(b)) - default: - s.WriteByte(b) - } - } - off += 1 + l - return s.String(), off, nil -} - -func packString(s string, msg []byte, off int) (int, error) { - txtTmp := make([]byte, 256*4+1) - off, err := packTxtString(s, msg, off, txtTmp) - if err != nil { - return len(msg), err - } - return off, nil -} - -func unpackStringBase32(msg []byte, off, end int) (string, int, error) { - if end > len(msg) { - return "", len(msg), &Error{err: "overflow unpacking base32"} - } - s := toBase32(msg[off:end]) - return s, end, nil -} - -func packStringBase32(s string, msg []byte, off int) (int, error) { - b32, err := fromBase32([]byte(s)) - if err != nil { - return len(msg), err - } - if off+len(b32) > len(msg) { - return len(msg), &Error{err: "overflow packing base32"} - } - copy(msg[off:off+len(b32)], b32) - off += len(b32) - return off, nil -} - -func unpackStringBase64(msg []byte, off, end int) (string, int, error) { - // Rest of the RR is base64 encoded value, so we don't need an explicit length - // to be set. Thus far all RR's that have base64 encoded fields have those as their - // last one. What we do need is the end of the RR! - if end > len(msg) { - return "", len(msg), &Error{err: "overflow unpacking base64"} - } - s := toBase64(msg[off:end]) - return s, end, nil -} - -func packStringBase64(s string, msg []byte, off int) (int, error) { - b64, err := fromBase64([]byte(s)) - if err != nil { - return len(msg), err - } - if off+len(b64) > len(msg) { - return len(msg), &Error{err: "overflow packing base64"} - } - copy(msg[off:off+len(b64)], b64) - off += len(b64) - return off, nil -} - -func unpackStringHex(msg []byte, off, end int) (string, int, error) { - // Rest of the RR is hex encoded value, so we don't need an explicit length - // to be set. NSEC and TSIG have hex fields with a length field. - // What we do need is the end of the RR! - if end > len(msg) { - return "", len(msg), &Error{err: "overflow unpacking hex"} - } - - s := hex.EncodeToString(msg[off:end]) - return s, end, nil -} - -func packStringHex(s string, msg []byte, off int) (int, error) { - h, err := hex.DecodeString(s) - if err != nil { - return len(msg), err - } - if off+len(h) > len(msg) { - return len(msg), &Error{err: "overflow packing hex"} - } - copy(msg[off:off+len(h)], h) - off += len(h) - return off, nil -} - -func unpackStringAny(msg []byte, off, end int) (string, int, error) { - if end > len(msg) { - return "", len(msg), &Error{err: "overflow unpacking anything"} - } - return string(msg[off:end]), end, nil -} - -func packStringAny(s string, msg []byte, off int) (int, error) { - if off+len(s) > len(msg) { - return len(msg), &Error{err: "overflow packing anything"} - } - copy(msg[off:off+len(s)], s) - off += len(s) - return off, nil -} - -func unpackStringTxt(msg []byte, off int) ([]string, int, error) { - txt, off, err := unpackTxt(msg, off) - if err != nil { - return nil, len(msg), err - } - return txt, off, nil -} - -func packStringTxt(s []string, msg []byte, off int) (int, error) { - txtTmp := make([]byte, 256*4+1) // If the whole string consists out of \DDD we need this many. - off, err := packTxt(s, msg, off, txtTmp) - if err != nil { - return len(msg), err - } - return off, nil -} - -func unpackDataOpt(msg []byte, off int) ([]EDNS0, int, error) { - var edns []EDNS0 -Option: - var code uint16 - if off+4 > len(msg) { - return nil, len(msg), &Error{err: "overflow unpacking opt"} - } - code = binary.BigEndian.Uint16(msg[off:]) - off += 2 - optlen := binary.BigEndian.Uint16(msg[off:]) - off += 2 - if off+int(optlen) > len(msg) { - return nil, len(msg), &Error{err: "overflow unpacking opt"} - } - switch code { - case EDNS0NSID: - e := new(EDNS0_NSID) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0SUBNET: - e := new(EDNS0_SUBNET) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0COOKIE: - e := new(EDNS0_COOKIE) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0UL: - e := new(EDNS0_UL) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0LLQ: - e := new(EDNS0_LLQ) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0DAU: - e := new(EDNS0_DAU) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0DHU: - e := new(EDNS0_DHU) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0N3U: - e := new(EDNS0_N3U) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - case EDNS0PADDING: - e := new(EDNS0_PADDING) - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - default: - e := new(EDNS0_LOCAL) - e.Code = code - if err := e.unpack(msg[off : off+int(optlen)]); err != nil { - return nil, len(msg), err - } - edns = append(edns, e) - off += int(optlen) - } - - if off < len(msg) { - goto Option - } - - return edns, off, nil -} - -func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) { - for _, el := range options { - b, err := el.pack() - if err != nil || off+4 > len(msg) { - return len(msg), &Error{err: "overflow packing opt"} - } - binary.BigEndian.PutUint16(msg[off:], el.Option()) // Option code - binary.BigEndian.PutUint16(msg[off+2:], uint16(len(b))) // Length - off += 4 - if off+len(b) > len(msg) { - copy(msg[off:], b) - off = len(msg) - continue - } - // Actual data - copy(msg[off:off+len(b)], b) - off += len(b) - } - return off, nil -} - -func unpackStringOctet(msg []byte, off int) (string, int, error) { - s := string(msg[off:]) - return s, len(msg), nil -} - -func packStringOctet(s string, msg []byte, off int) (int, error) { - txtTmp := make([]byte, 256*4+1) - off, err := packOctetString(s, msg, off, txtTmp) - if err != nil { - return len(msg), err - } - return off, nil -} - -func unpackDataNsec(msg []byte, off int) ([]uint16, int, error) { - var nsec []uint16 - length, window, lastwindow := 0, 0, -1 - for off < len(msg) { - if off+2 > len(msg) { - return nsec, len(msg), &Error{err: "overflow unpacking nsecx"} - } - window = int(msg[off]) - length = int(msg[off+1]) - off += 2 - if window <= lastwindow { - // RFC 4034: Blocks are present in the NSEC RR RDATA in - // increasing numerical order. - return nsec, len(msg), &Error{err: "out of order NSEC block"} - } - if length == 0 { - // RFC 4034: Blocks with no types present MUST NOT be included. - return nsec, len(msg), &Error{err: "empty NSEC block"} - } - if length > 32 { - return nsec, len(msg), &Error{err: "NSEC block too long"} - } - if off+length > len(msg) { - return nsec, len(msg), &Error{err: "overflowing NSEC block"} - } - - // Walk the bytes in the window and extract the type bits - for j, b := range msg[off : off+length] { - // Check the bits one by one, and set the type - if b&0x80 == 0x80 { - nsec = append(nsec, uint16(window*256+j*8+0)) - } - if b&0x40 == 0x40 { - nsec = append(nsec, uint16(window*256+j*8+1)) - } - if b&0x20 == 0x20 { - nsec = append(nsec, uint16(window*256+j*8+2)) - } - if b&0x10 == 0x10 { - nsec = append(nsec, uint16(window*256+j*8+3)) - } - if b&0x8 == 0x8 { - nsec = append(nsec, uint16(window*256+j*8+4)) - } - if b&0x4 == 0x4 { - nsec = append(nsec, uint16(window*256+j*8+5)) - } - if b&0x2 == 0x2 { - nsec = append(nsec, uint16(window*256+j*8+6)) - } - if b&0x1 == 0x1 { - nsec = append(nsec, uint16(window*256+j*8+7)) - } - } - off += length - lastwindow = window - } - return nsec, off, nil -} - -// typeBitMapLen is a helper function which computes the "maximum" length of -// a the NSEC Type BitMap field. -func typeBitMapLen(bitmap []uint16) int { - var l int - var lastwindow, lastlength uint16 - for _, t := range bitmap { - window := t / 256 - length := (t-window*256)/8 + 1 - if window > lastwindow && lastlength != 0 { // New window, jump to the new offset - l += int(lastlength) + 2 - lastlength = 0 - } - if window < lastwindow || length < lastlength { - // packDataNsec would return Error{err: "nsec bits out of order"} here, but - // when computing the length, we want do be liberal. - continue - } - lastwindow, lastlength = window, length - } - l += int(lastlength) + 2 - return l -} - -func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) { - if len(bitmap) == 0 { - return off, nil - } - var lastwindow, lastlength uint16 - for _, t := range bitmap { - window := t / 256 - length := (t-window*256)/8 + 1 - if window > lastwindow && lastlength != 0 { // New window, jump to the new offset - off += int(lastlength) + 2 - lastlength = 0 - } - if window < lastwindow || length < lastlength { - return len(msg), &Error{err: "nsec bits out of order"} - } - if off+2+int(length) > len(msg) { - return len(msg), &Error{err: "overflow packing nsec"} - } - // Setting the window # - msg[off] = byte(window) - // Setting the octets length - msg[off+1] = byte(length) - // Setting the bit value for the type in the right octet - msg[off+1+int(length)] |= byte(1 << (7 - t%8)) - lastwindow, lastlength = window, length - } - off += int(lastlength) + 2 - return off, nil -} - -func unpackDataDomainNames(msg []byte, off, end int) ([]string, int, error) { - var ( - servers []string - s string - err error - ) - if end > len(msg) { - return nil, len(msg), &Error{err: "overflow unpacking domain names"} - } - for off < end { - s, off, err = UnpackDomainName(msg, off) - if err != nil { - return servers, len(msg), err - } - servers = append(servers, s) - } - return servers, off, nil -} - -func packDataDomainNames(names []string, msg []byte, off int, compression compressionMap, compress bool) (int, error) { - var err error - for _, name := range names { - off, err = packDomainName(name, msg, off, compression, compress) - if err != nil { - return len(msg), err - } - } - return off, nil -} diff --git a/vendor/github.com/miekg/dns/msg_truncate.go b/vendor/github.com/miekg/dns/msg_truncate.go deleted file mode 100644 index 83780af6..00000000 --- a/vendor/github.com/miekg/dns/msg_truncate.go +++ /dev/null @@ -1,106 +0,0 @@ -package dns - -// Truncate ensures the reply message will fit into the requested buffer -// size by removing records that exceed the requested size. -// -// It will first check if the reply fits without compression and then with -// compression. If it won't fit with compression, Truncate then walks the -// record adding as many records as possible without exceeding the -// requested buffer size. -// -// The TC bit will be set if any answer records were excluded from the -// message. This indicates to that the client should retry over TCP. -// -// The appropriate buffer size can be retrieved from the requests OPT -// record, if present, and is transport specific otherwise. dns.MinMsgSize -// should be used for UDP requests without an OPT record, and -// dns.MaxMsgSize for TCP requests without an OPT record. -func (dns *Msg) Truncate(size int) { - if dns.IsTsig() != nil { - // To simplify this implementation, we don't perform - // truncation on responses with a TSIG record. - return - } - - // RFC 6891 mandates that the payload size in an OPT record - // less than 512 bytes must be treated as equal to 512 bytes. - // - // For ease of use, we impose that restriction here. - if size < 512 { - size = 512 - } - - l := msgLenWithCompressionMap(dns, nil) // uncompressed length - if l <= size { - // Don't waste effort compressing this message. - dns.Compress = false - return - } - - dns.Compress = true - - edns0 := dns.popEdns0() - if edns0 != nil { - // Account for the OPT record that gets added at the end, - // by subtracting that length from our budget. - // - // The EDNS(0) OPT record must have the root domain and - // it's length is thus unaffected by compression. - size -= Len(edns0) - } - - compression := make(map[string]struct{}) - - l = headerSize - for _, r := range dns.Question { - l += r.len(l, compression) - } - - var numAnswer int - if l < size { - l, numAnswer = truncateLoop(dns.Answer, size, l, compression) - } - - var numNS int - if l < size { - l, numNS = truncateLoop(dns.Ns, size, l, compression) - } - - var numExtra int - if l < size { - l, numExtra = truncateLoop(dns.Extra, size, l, compression) - } - - // According to RFC 2181, the TC bit should only be set if not all - // of the answer RRs can be included in the response. - dns.Truncated = len(dns.Answer) > numAnswer - - dns.Answer = dns.Answer[:numAnswer] - dns.Ns = dns.Ns[:numNS] - dns.Extra = dns.Extra[:numExtra] - - if edns0 != nil { - // Add the OPT record back onto the additional section. - dns.Extra = append(dns.Extra, edns0) - } -} - -func truncateLoop(rrs []RR, size, l int, compression map[string]struct{}) (int, int) { - for i, r := range rrs { - if r == nil { - continue - } - - l += r.len(l, compression) - if l > size { - // Return size, rather than l prior to this record, - // to prevent any further records being added. - return size, i - } - if l == size { - return l, i + 1 - } - } - - return l, len(rrs) -} diff --git a/vendor/github.com/miekg/dns/nsecx.go b/vendor/github.com/miekg/dns/nsecx.go deleted file mode 100644 index 8f071a47..00000000 --- a/vendor/github.com/miekg/dns/nsecx.go +++ /dev/null @@ -1,95 +0,0 @@ -package dns - -import ( - "crypto/sha1" - "encoding/hex" - "strings" -) - -// HashName hashes a string (label) according to RFC 5155. It returns the hashed string in uppercase. -func HashName(label string, ha uint8, iter uint16, salt string) string { - if ha != SHA1 { - return "" - } - - wireSalt := make([]byte, hex.DecodedLen(len(salt))) - n, err := packStringHex(salt, wireSalt, 0) - if err != nil { - return "" - } - wireSalt = wireSalt[:n] - - name := make([]byte, 255) - off, err := PackDomainName(strings.ToLower(label), name, 0, nil, false) - if err != nil { - return "" - } - name = name[:off] - - s := sha1.New() - // k = 0 - s.Write(name) - s.Write(wireSalt) - nsec3 := s.Sum(nil) - - // k > 0 - for k := uint16(0); k < iter; k++ { - s.Reset() - s.Write(nsec3) - s.Write(wireSalt) - nsec3 = s.Sum(nsec3[:0]) - } - - return toBase32(nsec3) -} - -// Cover returns true if a name is covered by the NSEC3 record -func (rr *NSEC3) Cover(name string) bool { - nameHash := HashName(name, rr.Hash, rr.Iterations, rr.Salt) - owner := strings.ToUpper(rr.Hdr.Name) - labelIndices := Split(owner) - if len(labelIndices) < 2 { - return false - } - ownerHash := owner[:labelIndices[1]-1] - ownerZone := owner[labelIndices[1]:] - if !IsSubDomain(ownerZone, strings.ToUpper(name)) { // name is outside owner zone - return false - } - - nextHash := rr.NextDomain - - // if empty interval found, try cover wildcard hashes so nameHash shouldn't match with ownerHash - if ownerHash == nextHash && nameHash != ownerHash { // empty interval - return true - } - if ownerHash > nextHash { // end of zone - if nameHash > ownerHash { // covered since there is nothing after ownerHash - return true - } - return nameHash < nextHash // if nameHash is before beginning of zone it is covered - } - if nameHash < ownerHash { // nameHash is before ownerHash, not covered - return false - } - return nameHash < nextHash // if nameHash is before nextHash is it covered (between ownerHash and nextHash) -} - -// Match returns true if a name matches the NSEC3 record -func (rr *NSEC3) Match(name string) bool { - nameHash := HashName(name, rr.Hash, rr.Iterations, rr.Salt) - owner := strings.ToUpper(rr.Hdr.Name) - labelIndices := Split(owner) - if len(labelIndices) < 2 { - return false - } - ownerHash := owner[:labelIndices[1]-1] - ownerZone := owner[labelIndices[1]:] - if !IsSubDomain(ownerZone, strings.ToUpper(name)) { // name is outside owner zone - return false - } - if ownerHash == nameHash { - return true - } - return false -} diff --git a/vendor/github.com/miekg/dns/privaterr.go b/vendor/github.com/miekg/dns/privaterr.go deleted file mode 100644 index e28f0663..00000000 --- a/vendor/github.com/miekg/dns/privaterr.go +++ /dev/null @@ -1,114 +0,0 @@ -package dns - -import "strings" - -// PrivateRdata is an interface used for implementing "Private Use" RR types, see -// RFC 6895. This allows one to experiment with new RR types, without requesting an -// official type code. Also see dns.PrivateHandle and dns.PrivateHandleRemove. -type PrivateRdata interface { - // String returns the text presentaton of the Rdata of the Private RR. - String() string - // Parse parses the Rdata of the private RR. - Parse([]string) error - // Pack is used when packing a private RR into a buffer. - Pack([]byte) (int, error) - // Unpack is used when unpacking a private RR from a buffer. - // TODO(miek): diff. signature than Pack, see edns0.go for instance. - Unpack([]byte) (int, error) - // Copy copies the Rdata into the PrivateRdata argument. - Copy(PrivateRdata) error - // Len returns the length in octets of the Rdata. - Len() int -} - -// PrivateRR represents an RR that uses a PrivateRdata user-defined type. -// It mocks normal RRs and implements dns.RR interface. -type PrivateRR struct { - Hdr RR_Header - Data PrivateRdata - - generator func() PrivateRdata // for copy -} - -// Header return the RR header of r. -func (r *PrivateRR) Header() *RR_Header { return &r.Hdr } - -func (r *PrivateRR) String() string { return r.Hdr.String() + r.Data.String() } - -// Private len and copy parts to satisfy RR interface. -func (r *PrivateRR) len(off int, compression map[string]struct{}) int { - l := r.Hdr.len(off, compression) - l += r.Data.Len() - return l -} - -func (r *PrivateRR) copy() RR { - // make new RR like this: - rr := &PrivateRR{r.Hdr, r.generator(), r.generator} - - if err := r.Data.Copy(rr.Data); err != nil { - panic("dns: got value that could not be used to copy Private rdata: " + err.Error()) - } - - return rr -} - -func (r *PrivateRR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) { - n, err := r.Data.Pack(msg[off:]) - if err != nil { - return len(msg), err - } - off += n - return off, nil -} - -func (r *PrivateRR) unpack(msg []byte, off int) (int, error) { - off1, err := r.Data.Unpack(msg[off:]) - off += off1 - return off, err -} - -func (r *PrivateRR) parse(c *zlexer, origin string) *ParseError { - var l lex - text := make([]string, 0, 2) // could be 0..N elements, median is probably 1 -Fetch: - for { - // TODO(miek): we could also be returning _QUOTE, this might or might not - // be an issue (basically parsing TXT becomes hard) - switch l, _ = c.Next(); l.value { - case zNewline, zEOF: - break Fetch - case zString: - text = append(text, l.token) - } - } - - err := r.Data.Parse(text) - if err != nil { - return &ParseError{"", err.Error(), l} - } - - return nil -} - -func (r1 *PrivateRR) isDuplicate(r2 RR) bool { return false } - -// PrivateHandle registers a private resource record type. It requires -// string and numeric representation of private RR type and generator function as argument. -func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) { - rtypestr = strings.ToUpper(rtypestr) - - TypeToRR[rtype] = func() RR { return &PrivateRR{RR_Header{}, generator(), generator} } - TypeToString[rtype] = rtypestr - StringToType[rtypestr] = rtype -} - -// PrivateHandleRemove removes definitions required to support private RR type. -func PrivateHandleRemove(rtype uint16) { - rtypestr, ok := TypeToString[rtype] - if ok { - delete(TypeToRR, rtype) - delete(TypeToString, rtype) - delete(StringToType, rtypestr) - } -} diff --git a/vendor/github.com/miekg/dns/reverse.go b/vendor/github.com/miekg/dns/reverse.go deleted file mode 100644 index 28151af8..00000000 --- a/vendor/github.com/miekg/dns/reverse.go +++ /dev/null @@ -1,52 +0,0 @@ -package dns - -// StringToType is the reverse of TypeToString, needed for string parsing. -var StringToType = reverseInt16(TypeToString) - -// StringToClass is the reverse of ClassToString, needed for string parsing. -var StringToClass = reverseInt16(ClassToString) - -// StringToOpcode is a map of opcodes to strings. -var StringToOpcode = reverseInt(OpcodeToString) - -// StringToRcode is a map of rcodes to strings. -var StringToRcode = reverseInt(RcodeToString) - -func init() { - // Preserve previous NOTIMP typo, see github.com/miekg/dns/issues/733. - StringToRcode["NOTIMPL"] = RcodeNotImplemented -} - -// StringToAlgorithm is the reverse of AlgorithmToString. -var StringToAlgorithm = reverseInt8(AlgorithmToString) - -// StringToHash is a map of names to hash IDs. -var StringToHash = reverseInt8(HashToString) - -// StringToCertType is the reverseof CertTypeToString. -var StringToCertType = reverseInt16(CertTypeToString) - -// Reverse a map -func reverseInt8(m map[uint8]string) map[string]uint8 { - n := make(map[string]uint8, len(m)) - for u, s := range m { - n[s] = u - } - return n -} - -func reverseInt16(m map[uint16]string) map[string]uint16 { - n := make(map[string]uint16, len(m)) - for u, s := range m { - n[s] = u - } - return n -} - -func reverseInt(m map[int]string) map[string]int { - n := make(map[string]int, len(m)) - for u, s := range m { - n[s] = u - } - return n -} diff --git a/vendor/github.com/miekg/dns/sanitize.go b/vendor/github.com/miekg/dns/sanitize.go deleted file mode 100644 index a638e862..00000000 --- a/vendor/github.com/miekg/dns/sanitize.go +++ /dev/null @@ -1,86 +0,0 @@ -package dns - -// Dedup removes identical RRs from rrs. It preserves the original ordering. -// The lowest TTL of any duplicates is used in the remaining one. Dedup modifies -// rrs. -// 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 { - - if m == nil { - m = make(map[string]RR) - } - // Save the keys, so we don't have to call normalizedString twice. - keys := make([]*string, 0, len(rrs)) - - for _, r := range rrs { - key := normalizedString(r) - keys = append(keys, &key) - if mr, ok := m[key]; ok { - // Shortest TTL wins. - rh, mrh := r.Header(), mr.Header() - if mrh.Ttl > rh.Ttl { - mrh.Ttl = rh.Ttl - } - continue - } - - m[key] = r - } - // If the length of the result map equals the amount of RRs we got, - // it means they were all different. We can then just return the original rrset. - if len(m) == len(rrs) { - return rrs - } - - j := 0 - for i, r := range rrs { - // If keys[i] lives in the map, we should copy and remove it. - if _, ok := m[*keys[i]]; ok { - delete(m, *keys[i]) - rrs[j] = r - j++ - } - - if len(m) == 0 { - break - } - } - - return rrs[:j] -} - -// normalizedString returns a normalized string from r. The TTL -// is removed and the domain name is lowercased. We go from this: -// DomainNameTTLCLASSTYPERDATA to: -// lowercasenameCLASSTYPE... -func normalizedString(r RR) string { - // A string Go DNS makes has: domainnameTTL... - b := []byte(r.String()) - - // find the first non-escaped tab, then another, so we capture where the TTL lives. - esc := false - ttlStart, ttlEnd := 0, 0 - for i := 0; i < len(b) && ttlEnd == 0; i++ { - switch { - case b[i] == '\\': - esc = !esc - case b[i] == '\t' && !esc: - if ttlStart == 0 { - ttlStart = i - continue - } - if ttlEnd == 0 { - ttlEnd = i - } - case b[i] >= 'A' && b[i] <= 'Z' && !esc: - b[i] += 32 - default: - esc = false - } - } - - // remove TTL. - copy(b[ttlStart:], b[ttlEnd:]) - cut := ttlEnd - ttlStart - return string(b[:len(b)-cut]) -} diff --git a/vendor/github.com/miekg/dns/scan.go b/vendor/github.com/miekg/dns/scan.go deleted file mode 100644 index 7da14c88..00000000 --- a/vendor/github.com/miekg/dns/scan.go +++ /dev/null @@ -1,1397 +0,0 @@ -package dns - -import ( - "bufio" - "fmt" - "io" - "os" - "path/filepath" - "strconv" - "strings" -) - -const maxTok = 2048 // Largest token we can return. - -// The maximum depth of $INCLUDE directives supported by the -// ZoneParser API. -const maxIncludeDepth = 7 - -// Tokinize a RFC 1035 zone file. The tokenizer will normalize it: -// * Add ownernames if they are left blank; -// * Suppress sequences of spaces; -// * Make each RR fit on one line (_NEWLINE is send as last) -// * Handle comments: ; -// * Handle braces - anywhere. -const ( - // Zonefile - zEOF = iota - zString - zBlank - zQuote - zNewline - zRrtpe - zOwner - zClass - zDirOrigin // $ORIGIN - zDirTTL // $TTL - zDirInclude // $INCLUDE - zDirGenerate // $GENERATE - - // Privatekey file - zValue - zKey - - zExpectOwnerDir // Ownername - zExpectOwnerBl // Whitespace after the ownername - zExpectAny // Expect rrtype, ttl or class - zExpectAnyNoClass // Expect rrtype or ttl - zExpectAnyNoClassBl // The whitespace after _EXPECT_ANY_NOCLASS - zExpectAnyNoTTL // Expect rrtype or class - zExpectAnyNoTTLBl // Whitespace after _EXPECT_ANY_NOTTL - zExpectRrtype // Expect rrtype - zExpectRrtypeBl // Whitespace BEFORE rrtype - zExpectRdata // The first element of the rdata - zExpectDirTTLBl // Space after directive $TTL - zExpectDirTTL // Directive $TTL - zExpectDirOriginBl // Space after directive $ORIGIN - zExpectDirOrigin // Directive $ORIGIN - zExpectDirIncludeBl // Space after directive $INCLUDE - zExpectDirInclude // Directive $INCLUDE - zExpectDirGenerate // Directive $GENERATE - zExpectDirGenerateBl // Space after directive $GENERATE -) - -// ParseError is a parsing error. It contains the parse error and the location in the io.Reader -// where the error occurred. -type ParseError struct { - file string - err string - lex lex -} - -func (e *ParseError) Error() (s string) { - if e.file != "" { - s = e.file + ": " - } - s += "dns: " + e.err + ": " + strconv.QuoteToASCII(e.lex.token) + " at line: " + - strconv.Itoa(e.lex.line) + ":" + strconv.Itoa(e.lex.column) - return -} - -type lex struct { - token string // text of the token - err bool // when true, token text has lexer error - 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 - column int // column in the file -} - -// Token holds the token that are returned when a zone file is parsed. -type Token struct { - // The scanned resource record when error is not nil. - RR - // When an error occurred, this has the error specifics. - Error *ParseError - // A potential comment positioned after the RR and on the same line. - Comment string -} - -// ttlState describes the state necessary to fill in an omitted RR TTL -type ttlState struct { - ttl uint32 // ttl is the current default TTL - isByDirective bool // isByDirective indicates whether ttl was set by a $TTL directive -} - -// NewRR reads the RR contained in the string s. Only the first RR is -// returned. If s contains no records, NewRR will return nil with no -// error. -// -// The class defaults to IN and TTL defaults to 3600. The full zone -// file syntax like $TTL, $ORIGIN, etc. is supported. -// -// All fields of the returned RR are set, except RR.Header().Rdlength -// which is set to 0. -func NewRR(s string) (RR, error) { - if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline - return ReadRR(strings.NewReader(s+"\n"), "") - } - return ReadRR(strings.NewReader(s), "") -} - -// ReadRR reads the RR contained in r. -// -// The string file is used in error reporting and to resolve relative -// $INCLUDE directives. -// -// See NewRR for more documentation. -func ReadRR(r io.Reader, file string) (RR, error) { - zp := NewZoneParser(r, ".", file) - zp.SetDefaultTTL(defaultTtl) - zp.SetIncludeAllowed(true) - rr, _ := zp.Next() - return rr, zp.Err() -} - -// ParseZone reads a RFC 1035 style zonefile from r. It returns -// *Tokens on the returned channel, each consisting of either a -// parsed RR and optional comment or a nil RR and an error. The -// channel is closed by ParseZone when the end of r is reached. -// -// The string file is used in error reporting and to resolve relative -// $INCLUDE directives. The string origin is used as the initial -// origin, as if the file would start with an $ORIGIN directive. -// -// The directives $INCLUDE, $ORIGIN, $TTL and $GENERATE are all -// supported. -// -// Basic usage pattern when reading from a string (z) containing the -// zone data: -// -// for x := range dns.ParseZone(strings.NewReader(z), "", "") { -// if x.Error != nil { -// // log.Println(x.Error) -// } else { -// // Do something with x.RR -// } -// } -// -// Comments specified after an RR (and on the same line!) are -// returned too: -// -// foo. IN A 10.0.0.1 ; this is a comment -// -// The text "; this is comment" is returned in Token.Comment. -// Comments inside the RR are returned concatenated along with the -// RR. Comments on a line by themselves are discarded. -// -// To prevent memory leaks it is important to always fully drain the -// returned channel. If an error occurs, it will always be the last -// Token sent on the channel. -// -// Deprecated: New users should prefer the ZoneParser API. -func ParseZone(r io.Reader, origin, file string) chan *Token { - t := make(chan *Token, 10000) - go parseZone(r, origin, file, t) - return t -} - -func parseZone(r io.Reader, origin, file string, t chan *Token) { - defer close(t) - - zp := NewZoneParser(r, origin, file) - zp.SetIncludeAllowed(true) - - for rr, ok := zp.Next(); ok; rr, ok = zp.Next() { - t <- &Token{RR: rr, Comment: zp.Comment()} - } - - if err := zp.Err(); err != nil { - pe, ok := err.(*ParseError) - if !ok { - pe = &ParseError{file: file, err: err.Error()} - } - - t <- &Token{Error: pe} - } -} - -// ZoneParser is a parser for an RFC 1035 style zonefile. -// -// Each parsed RR in the zone is returned sequentially from Next. An -// optional comment can be retrieved with Comment. -// -// The directives $INCLUDE, $ORIGIN, $TTL and $GENERATE are all -// supported. Although $INCLUDE is disabled by default. -// -// Basic usage pattern when reading from a string (z) containing the -// zone data: -// -// zp := NewZoneParser(strings.NewReader(z), "", "") -// -// for rr, ok := zp.Next(); ok; rr, ok = zp.Next() { -// // Do something with rr -// } -// -// if err := zp.Err(); err != nil { -// // log.Println(err) -// } -// -// Comments specified after an RR (and on the same line!) are -// returned too: -// -// foo. IN A 10.0.0.1 ; this is a comment -// -// The text "; this is comment" is returned from Comment. Comments inside -// the RR are returned concatenated along with the RR. Comments on a line -// by themselves are discarded. -type ZoneParser struct { - c *zlexer - - parseErr *ParseError - - origin string - file string - - defttl *ttlState - - h RR_Header - - // sub is used to parse $INCLUDE files and $GENERATE directives. - // Next, by calling subNext, forwards the resulting RRs from this - // sub parser to the calling code. - sub *ZoneParser - osFile *os.File - - includeDepth uint8 - - includeAllowed bool -} - -// NewZoneParser returns an RFC 1035 style zonefile parser that reads -// from r. -// -// The string file is used in error reporting and to resolve relative -// $INCLUDE directives. The string origin is used as the initial -// origin, as if the file would start with an $ORIGIN directive. -func NewZoneParser(r io.Reader, origin, file string) *ZoneParser { - var pe *ParseError - if origin != "" { - origin = Fqdn(origin) - if _, ok := IsDomainName(origin); !ok { - pe = &ParseError{file, "bad initial origin name", lex{}} - } - } - - return &ZoneParser{ - c: newZLexer(r), - - parseErr: pe, - - origin: origin, - file: file, - } -} - -// SetDefaultTTL sets the parsers default TTL to ttl. -func (zp *ZoneParser) SetDefaultTTL(ttl uint32) { - zp.defttl = &ttlState{ttl, false} -} - -// SetIncludeAllowed controls whether $INCLUDE directives are -// allowed. $INCLUDE directives are not supported by default. -// -// The $INCLUDE directive will open and read from a user controlled -// file on the system. Even if the file is not a valid zonefile, the -// contents of the file may be revealed in error messages, such as: -// -// /etc/passwd: dns: not a TTL: "root:x:0:0:root:/root:/bin/bash" at line: 1:31 -// /etc/shadow: dns: not a TTL: "root:$6$::0:99999:7:::" at line: 1:125 -func (zp *ZoneParser) SetIncludeAllowed(v bool) { - zp.includeAllowed = v -} - -// Err returns the first non-EOF error that was encountered by the -// ZoneParser. -func (zp *ZoneParser) Err() error { - if zp.parseErr != nil { - return zp.parseErr - } - - if zp.sub != nil { - if err := zp.sub.Err(); err != nil { - return err - } - } - - return zp.c.Err() -} - -func (zp *ZoneParser) setParseError(err string, l lex) (RR, bool) { - zp.parseErr = &ParseError{zp.file, err, l} - return nil, false -} - -// Comment returns an optional text comment that occurred alongside -// the RR. -func (zp *ZoneParser) Comment() string { - if zp.parseErr != nil { - return "" - } - - if zp.sub != nil { - return zp.sub.Comment() - } - - return zp.c.Comment() -} - -func (zp *ZoneParser) subNext() (RR, bool) { - if rr, ok := zp.sub.Next(); ok { - return rr, true - } - - if zp.sub.osFile != nil { - zp.sub.osFile.Close() - zp.sub.osFile = nil - } - - if zp.sub.Err() != nil { - // We have errors to surface. - return nil, false - } - - zp.sub = nil - return zp.Next() -} - -// Next advances the parser to the next RR in the zonefile and -// returns the (RR, true). It will return (nil, false) when the -// parsing stops, either by reaching the end of the input or an -// error. After Next returns (nil, false), the Err method will return -// any error that occurred during parsing. -func (zp *ZoneParser) Next() (RR, bool) { - if zp.parseErr != nil { - return nil, false - } - if zp.sub != nil { - return zp.subNext() - } - - // 6 possible beginnings of a line (_ is a space): - // - // 0. zRRTYPE -> all omitted until the rrtype - // 1. zOwner _ zRrtype -> class/ttl omitted - // 2. zOwner _ zString _ zRrtype -> class omitted - // 3. zOwner _ zString _ zClass _ zRrtype -> ttl/class - // 4. zOwner _ zClass _ zRrtype -> ttl omitted - // 5. zOwner _ zClass _ zString _ zRrtype -> class/ttl (reversed) - // - // After detecting these, we know the zRrtype so we can jump to functions - // handling the rdata for each of these types. - - st := zExpectOwnerDir // initial state - h := &zp.h - - for l, ok := zp.c.Next(); ok; l, ok = zp.c.Next() { - // zlexer spotted an error already - if l.err { - return zp.setParseError(l.token, l) - } - - switch st { - case zExpectOwnerDir: - // We can also expect a directive, like $TTL or $ORIGIN - if zp.defttl != nil { - h.Ttl = zp.defttl.ttl - } - - h.Class = ClassINET - - switch l.value { - case zNewline: - st = zExpectOwnerDir - case zOwner: - name, ok := toAbsoluteName(l.token, zp.origin) - if !ok { - return zp.setParseError("bad owner name", l) - } - - h.Name = name - - st = zExpectOwnerBl - case zDirTTL: - st = zExpectDirTTLBl - case zDirOrigin: - st = zExpectDirOriginBl - case zDirInclude: - st = zExpectDirIncludeBl - case zDirGenerate: - st = zExpectDirGenerateBl - case zRrtpe: - h.Rrtype = l.torc - - st = zExpectRdata - case zClass: - h.Class = l.torc - - st = zExpectAnyNoClassBl - case zBlank: - // Discard, can happen when there is nothing on the - // line except the RR type - case zString: - ttl, ok := stringToTTL(l.token) - if !ok { - return zp.setParseError("not a TTL", l) - } - - h.Ttl = ttl - - if zp.defttl == nil || !zp.defttl.isByDirective { - zp.defttl = &ttlState{ttl, false} - } - - st = zExpectAnyNoTTLBl - default: - return zp.setParseError("syntax error at beginning", l) - } - case zExpectDirIncludeBl: - if l.value != zBlank { - return zp.setParseError("no blank after $INCLUDE-directive", l) - } - - st = zExpectDirInclude - case zExpectDirInclude: - if l.value != zString { - return zp.setParseError("expecting $INCLUDE value, not this...", l) - } - - neworigin := zp.origin // There may be optionally a new origin set after the filename, if not use current one - switch l, _ := zp.c.Next(); l.value { - case zBlank: - l, _ := zp.c.Next() - if l.value == zString { - name, ok := toAbsoluteName(l.token, zp.origin) - if !ok { - return zp.setParseError("bad origin name", l) - } - - neworigin = name - } - case zNewline, zEOF: - // Ok - default: - return zp.setParseError("garbage after $INCLUDE", l) - } - - if !zp.includeAllowed { - return zp.setParseError("$INCLUDE directive not allowed", l) - } - if zp.includeDepth >= maxIncludeDepth { - return zp.setParseError("too deeply nested $INCLUDE", l) - } - - // Start with the new file - includePath := l.token - if !filepath.IsAbs(includePath) { - includePath = filepath.Join(filepath.Dir(zp.file), includePath) - } - - r1, e1 := os.Open(includePath) - if e1 != nil { - var as string - if !filepath.IsAbs(l.token) { - as = fmt.Sprintf(" as `%s'", includePath) - } - - msg := fmt.Sprintf("failed to open `%s'%s: %v", l.token, as, e1) - return zp.setParseError(msg, l) - } - - zp.sub = NewZoneParser(r1, neworigin, includePath) - zp.sub.defttl, zp.sub.includeDepth, zp.sub.osFile = zp.defttl, zp.includeDepth+1, r1 - zp.sub.SetIncludeAllowed(true) - return zp.subNext() - case zExpectDirTTLBl: - if l.value != zBlank { - return zp.setParseError("no blank after $TTL-directive", l) - } - - st = zExpectDirTTL - case zExpectDirTTL: - if l.value != zString { - return zp.setParseError("expecting $TTL value, not this...", l) - } - - if err := slurpRemainder(zp.c); err != nil { - return zp.setParseError(err.err, err.lex) - } - - ttl, ok := stringToTTL(l.token) - if !ok { - return zp.setParseError("expecting $TTL value, not this...", l) - } - - zp.defttl = &ttlState{ttl, true} - - st = zExpectOwnerDir - case zExpectDirOriginBl: - if l.value != zBlank { - return zp.setParseError("no blank after $ORIGIN-directive", l) - } - - st = zExpectDirOrigin - case zExpectDirOrigin: - if l.value != zString { - return zp.setParseError("expecting $ORIGIN value, not this...", l) - } - - if err := slurpRemainder(zp.c); err != nil { - return zp.setParseError(err.err, err.lex) - } - - name, ok := toAbsoluteName(l.token, zp.origin) - if !ok { - return zp.setParseError("bad origin name", l) - } - - zp.origin = name - - st = zExpectOwnerDir - case zExpectDirGenerateBl: - if l.value != zBlank { - return zp.setParseError("no blank after $GENERATE-directive", l) - } - - st = zExpectDirGenerate - case zExpectDirGenerate: - if l.value != zString { - return zp.setParseError("expecting $GENERATE value, not this...", l) - } - - return zp.generate(l) - case zExpectOwnerBl: - if l.value != zBlank { - return zp.setParseError("no blank after owner", l) - } - - st = zExpectAny - case zExpectAny: - switch l.value { - case zRrtpe: - if zp.defttl == nil { - return zp.setParseError("missing TTL with no previous value", l) - } - - h.Rrtype = l.torc - - st = zExpectRdata - case zClass: - h.Class = l.torc - - st = zExpectAnyNoClassBl - case zString: - ttl, ok := stringToTTL(l.token) - if !ok { - return zp.setParseError("not a TTL", l) - } - - h.Ttl = ttl - - if zp.defttl == nil || !zp.defttl.isByDirective { - zp.defttl = &ttlState{ttl, false} - } - - st = zExpectAnyNoTTLBl - default: - return zp.setParseError("expecting RR type, TTL or class, not this...", l) - } - case zExpectAnyNoClassBl: - if l.value != zBlank { - return zp.setParseError("no blank before class", l) - } - - st = zExpectAnyNoClass - case zExpectAnyNoTTLBl: - if l.value != zBlank { - return zp.setParseError("no blank before TTL", l) - } - - st = zExpectAnyNoTTL - case zExpectAnyNoTTL: - switch l.value { - case zClass: - h.Class = l.torc - - st = zExpectRrtypeBl - case zRrtpe: - h.Rrtype = l.torc - - st = zExpectRdata - default: - return zp.setParseError("expecting RR type or class, not this...", l) - } - case zExpectAnyNoClass: - switch l.value { - case zString: - ttl, ok := stringToTTL(l.token) - if !ok { - return zp.setParseError("not a TTL", l) - } - - h.Ttl = ttl - - if zp.defttl == nil || !zp.defttl.isByDirective { - zp.defttl = &ttlState{ttl, false} - } - - st = zExpectRrtypeBl - case zRrtpe: - h.Rrtype = l.torc - - st = zExpectRdata - default: - return zp.setParseError("expecting RR type or TTL, not this...", l) - } - case zExpectRrtypeBl: - if l.value != zBlank { - return zp.setParseError("no blank before RR type", l) - } - - st = zExpectRrtype - case zExpectRrtype: - if l.value != zRrtpe { - return zp.setParseError("unknown RR type", l) - } - - h.Rrtype = l.torc - - st = zExpectRdata - case zExpectRdata: - var rr RR - if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) { - rr = newFn() - *rr.Header() = *h - } else { - rr = &RFC3597{Hdr: *h} - } - - _, isPrivate := rr.(*PrivateRR) - if !isPrivate && zp.c.Peek().token == "" { - // This is a dynamic update rr. - - // TODO(tmthrgd): Previously slurpRemainder was only called - // for certain RR types, which may have been important. - if err := slurpRemainder(zp.c); err != nil { - return zp.setParseError(err.err, err.lex) - } - - return rr, true - } else if l.value == zNewline { - return zp.setParseError("unexpected newline", l) - } - - if err := rr.parse(zp.c, zp.origin); err != nil { - // err is a concrete *ParseError without the file field set. - // The setParseError call below will construct a new - // *ParseError with file set to zp.file. - - // If err.lex is nil than we have encounter an unknown RR type - // in that case we substitute our current lex token. - if err.lex == (lex{}) { - return zp.setParseError(err.err, l) - } - - return zp.setParseError(err.err, err.lex) - } - - return rr, true - } - } - - // If we get here, we and the h.Rrtype is still zero, we haven't parsed anything, this - // is not an error, because an empty zone file is still a zone file. - return nil, false -} - -// canParseAsRR returns true if the record type can be parsed as a -// concrete RR. It blacklists certain record types that must be parsed -// according to RFC 3597 because they lack a presentation format. -func canParseAsRR(rrtype uint16) bool { - switch rrtype { - case TypeANY, TypeNULL, TypeOPT, TypeTSIG: - return false - default: - return true - } -} - -type zlexer struct { - br io.ByteReader - - readErr error - - line int - column int - - comBuf string - comment string - - l lex - cachedL *lex - - brace int - quote bool - space bool - commt bool - rrtype bool - owner bool - - nextL bool - - eol bool // end-of-line -} - -func newZLexer(r io.Reader) *zlexer { - br, ok := r.(io.ByteReader) - if !ok { - br = bufio.NewReaderSize(r, 1024) - } - - return &zlexer{ - br: br, - - line: 1, - - owner: true, - } -} - -func (zl *zlexer) Err() error { - if zl.readErr == io.EOF { - return nil - } - - return zl.readErr -} - -// readByte returns the next byte from the input -func (zl *zlexer) readByte() (byte, bool) { - if zl.readErr != nil { - return 0, false - } - - c, err := zl.br.ReadByte() - if err != nil { - zl.readErr = err - return 0, false - } - - // delay the newline handling until the next token is delivered, - // fixes off-by-one errors when reporting a parse error. - if zl.eol { - zl.line++ - zl.column = 0 - zl.eol = false - } - - if c == '\n' { - zl.eol = true - } else { - zl.column++ - } - - return c, true -} - -func (zl *zlexer) Peek() lex { - if zl.nextL { - return zl.l - } - - l, ok := zl.Next() - if !ok { - return l - } - - if zl.nextL { - // Cache l. Next returns zl.cachedL then zl.l. - zl.cachedL = &l - } else { - // In this case l == zl.l, so we just tell Next to return zl.l. - zl.nextL = true - } - - return l -} - -func (zl *zlexer) Next() (lex, bool) { - l := &zl.l - switch { - case zl.cachedL != nil: - l, zl.cachedL = zl.cachedL, nil - return *l, true - case zl.nextL: - zl.nextL = false - return *l, true - case l.err: - // Parsing errors should be sticky. - return lex{value: zEOF}, false - } - - var ( - str [maxTok]byte // Hold string text - com [maxTok]byte // Hold comment text - - stri int // Offset in str (0 means empty) - comi int // Offset in com (0 means empty) - - escape bool - ) - - if zl.comBuf != "" { - comi = copy(com[:], zl.comBuf) - zl.comBuf = "" - } - - zl.comment = "" - - for x, ok := zl.readByte(); ok; x, ok = zl.readByte() { - l.line, l.column = zl.line, zl.column - - if stri >= len(str) { - l.token = "token length insufficient for parsing" - l.err = true - return *l, true - } - if comi >= len(com) { - l.token = "comment length insufficient for parsing" - l.err = true - return *l, true - } - - switch x { - case ' ', '\t': - if escape || zl.quote { - // Inside quotes or escaped this is legal. - str[stri] = x - stri++ - - escape = false - break - } - - if zl.commt { - com[comi] = x - comi++ - break - } - - var retL lex - if stri == 0 { - // Space directly in the beginning, handled in the grammar - } else if zl.owner { - // If we have a string and its the first, make it an owner - l.value = zOwner - l.token = string(str[:stri]) - - // escape $... start with a \ not a $, so this will work - switch strings.ToUpper(l.token) { - case "$TTL": - l.value = zDirTTL - case "$ORIGIN": - l.value = zDirOrigin - case "$INCLUDE": - l.value = zDirInclude - case "$GENERATE": - l.value = zDirGenerate - } - - retL = *l - } else { - l.value = zString - l.token = string(str[:stri]) - - if !zl.rrtype { - tokenUpper := strings.ToUpper(l.token) - if t, ok := StringToType[tokenUpper]; ok { - l.value = zRrtpe - l.torc = t - - zl.rrtype = true - } else if strings.HasPrefix(tokenUpper, "TYPE") { - t, ok := typeToInt(l.token) - if !ok { - l.token = "unknown RR type" - l.err = true - return *l, true - } - - l.value = zRrtpe - l.torc = t - - zl.rrtype = true - } - - if t, ok := StringToClass[tokenUpper]; ok { - l.value = zClass - l.torc = t - } else if strings.HasPrefix(tokenUpper, "CLASS") { - t, ok := classToInt(l.token) - if !ok { - l.token = "unknown class" - l.err = true - return *l, true - } - - l.value = zClass - l.torc = t - } - } - - retL = *l - } - - zl.owner = false - - if !zl.space { - zl.space = true - - l.value = zBlank - l.token = " " - - if retL == (lex{}) { - return *l, true - } - - zl.nextL = true - } - - if retL != (lex{}) { - return retL, true - } - case ';': - if escape || zl.quote { - // Inside quotes or escaped this is legal. - str[stri] = x - stri++ - - escape = false - break - } - - zl.commt = true - zl.comBuf = "" - - if comi > 1 { - // A newline was previously seen inside a comment that - // was inside braces and we delayed adding it until now. - com[comi] = ' ' // convert newline to space - comi++ - } - - com[comi] = ';' - comi++ - - if stri > 0 { - zl.comBuf = string(com[:comi]) - - l.value = zString - l.token = string(str[:stri]) - return *l, true - } - case '\r': - escape = false - - if zl.quote { - str[stri] = x - stri++ - } - - // discard if outside of quotes - case '\n': - escape = false - - // Escaped newline - if zl.quote { - str[stri] = x - stri++ - break - } - - if zl.commt { - // Reset a comment - zl.commt = false - zl.rrtype = false - - // If not in a brace this ends the comment AND the RR - if zl.brace == 0 { - zl.owner = true - - l.value = zNewline - l.token = "\n" - zl.comment = string(com[:comi]) - return *l, true - } - - zl.comBuf = string(com[:comi]) - break - } - - if zl.brace == 0 { - // If there is previous text, we should output it here - var retL lex - if stri != 0 { - l.value = zString - l.token = string(str[:stri]) - - if !zl.rrtype { - tokenUpper := strings.ToUpper(l.token) - if t, ok := StringToType[tokenUpper]; ok { - zl.rrtype = true - - l.value = zRrtpe - l.torc = t - } - } - - retL = *l - } - - l.value = zNewline - l.token = "\n" - - zl.comment = zl.comBuf - zl.comBuf = "" - zl.rrtype = false - zl.owner = true - - if retL != (lex{}) { - zl.nextL = true - return retL, true - } - - return *l, true - } - case '\\': - // comments do not get escaped chars, everything is copied - if zl.commt { - com[comi] = x - comi++ - break - } - - // something already escaped must be in string - if escape { - str[stri] = x - stri++ - - escape = false - break - } - - // something escaped outside of string gets added to string - str[stri] = x - stri++ - - escape = true - case '"': - if zl.commt { - com[comi] = x - comi++ - break - } - - if escape { - str[stri] = x - stri++ - - escape = false - break - } - - zl.space = false - - // send previous gathered text and the quote - var retL lex - if stri != 0 { - l.value = zString - l.token = string(str[:stri]) - - retL = *l - } - - // send quote itself as separate token - l.value = zQuote - l.token = "\"" - - zl.quote = !zl.quote - - if retL != (lex{}) { - zl.nextL = true - return retL, true - } - - return *l, true - case '(', ')': - if zl.commt { - com[comi] = x - comi++ - break - } - - if escape || zl.quote { - // Inside quotes or escaped this is legal. - str[stri] = x - stri++ - - escape = false - break - } - - switch x { - case ')': - zl.brace-- - - if zl.brace < 0 { - l.token = "extra closing brace" - l.err = true - return *l, true - } - case '(': - zl.brace++ - } - default: - escape = false - - if zl.commt { - com[comi] = x - comi++ - break - } - - str[stri] = x - stri++ - - zl.space = false - } - } - - if zl.readErr != nil && zl.readErr != io.EOF { - // Don't return any tokens after a read error occurs. - return lex{value: zEOF}, false - } - - var retL lex - if stri > 0 { - // Send remainder of str - l.value = zString - l.token = string(str[:stri]) - retL = *l - - if comi <= 0 { - return retL, true - } - } - - if comi > 0 { - // Send remainder of com - l.value = zNewline - l.token = "\n" - zl.comment = string(com[:comi]) - - if retL != (lex{}) { - zl.nextL = true - return retL, true - } - - return *l, true - } - - if zl.brace != 0 { - l.token = "unbalanced brace" - l.err = true - return *l, true - } - - return lex{value: zEOF}, false -} - -func (zl *zlexer) Comment() string { - if zl.l.err { - return "" - } - - return zl.comment -} - -// Extract the class number from CLASSxx -func classToInt(token string) (uint16, bool) { - offset := 5 - if len(token) < offset+1 { - return 0, false - } - class, err := strconv.ParseUint(token[offset:], 10, 16) - if err != nil { - return 0, false - } - return uint16(class), true -} - -// Extract the rr number from TYPExxx -func typeToInt(token string) (uint16, bool) { - offset := 4 - if len(token) < offset+1 { - return 0, false - } - typ, err := strconv.ParseUint(token[offset:], 10, 16) - if err != nil { - return 0, false - } - return uint16(typ), true -} - -// stringToTTL parses things like 2w, 2m, etc, and returns the time in seconds. -func stringToTTL(token string) (uint32, bool) { - var s, i uint32 - for _, c := range token { - switch c { - case 's', 'S': - s += i - i = 0 - case 'm', 'M': - s += i * 60 - i = 0 - case 'h', 'H': - s += i * 60 * 60 - i = 0 - case 'd', 'D': - s += i * 60 * 60 * 24 - i = 0 - case 'w', 'W': - s += i * 60 * 60 * 24 * 7 - i = 0 - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - i *= 10 - i += uint32(c) - '0' - default: - return 0, false - } - } - return s + i, true -} - -// Parse LOC records' [.][mM] into a -// mantissa exponent format. Token should contain the entire -// string (i.e. no spaces allowed) -func stringToCm(token string) (e, m uint8, ok bool) { - if token[len(token)-1] == 'M' || token[len(token)-1] == 'm' { - token = token[0 : len(token)-1] - } - s := strings.SplitN(token, ".", 2) - var meters, cmeters, val int - var err error - switch len(s) { - case 2: - if cmeters, err = strconv.Atoi(s[1]); err != nil { - return - } - fallthrough - case 1: - if meters, err = strconv.Atoi(s[0]); err != nil { - return - } - case 0: - // huh? - return 0, 0, false - } - ok = true - if meters > 0 { - e = 2 - val = meters - } else { - e = 0 - val = cmeters - } - for val > 10 { - e++ - val /= 10 - } - if e > 9 { - ok = false - } - m = uint8(val) - return -} - -func toAbsoluteName(name, origin string) (absolute string, ok bool) { - // check for an explicit origin reference - if name == "@" { - // require a nonempty origin - if origin == "" { - return "", false - } - return origin, true - } - - // require a valid domain name - _, ok = IsDomainName(name) - if !ok || name == "" { - return "", false - } - - // check if name is already absolute - if IsFqdn(name) { - return name, true - } - - // require a nonempty origin - if origin == "" { - return "", false - } - return appendOrigin(name, origin), true -} - -func appendOrigin(name, origin string) string { - if origin == "." { - return name + origin - } - return name + "." + origin -} - -// LOC record helper function -func locCheckNorth(token string, latitude uint32) (uint32, bool) { - switch token { - case "n", "N": - return LOC_EQUATOR + latitude, true - case "s", "S": - return LOC_EQUATOR - latitude, true - } - return latitude, false -} - -// LOC record helper function -func locCheckEast(token string, longitude uint32) (uint32, bool) { - switch token { - case "e", "E": - return LOC_EQUATOR + longitude, true - case "w", "W": - return LOC_EQUATOR - longitude, true - } - return longitude, false -} - -// "Eat" the rest of the "line" -func slurpRemainder(c *zlexer) *ParseError { - l, _ := c.Next() - switch l.value { - case zBlank: - l, _ = c.Next() - if l.value != zNewline && l.value != zEOF { - return &ParseError{"", "garbage after rdata", l} - } - case zNewline: - case zEOF: - default: - return &ParseError{"", "garbage after rdata", l} - } - return nil -} - -// Parse a 64 bit-like ipv6 address: "0014:4fff:ff20:ee64" -// Used for NID and L64 record. -func stringToNodeID(l lex) (uint64, *ParseError) { - if len(l.token) < 19 { - return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} - } - // There must be three colons at fixes postitions, if not its a parse error - if l.token[4] != ':' && l.token[9] != ':' && l.token[14] != ':' { - return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} - } - s := l.token[0:4] + l.token[5:9] + l.token[10:14] + l.token[15:19] - u, err := strconv.ParseUint(s, 16, 64) - if err != nil { - return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} - } - return u, nil -} diff --git a/vendor/github.com/miekg/dns/scan_rr.go b/vendor/github.com/miekg/dns/scan_rr.go deleted file mode 100644 index 93b24a69..00000000 --- a/vendor/github.com/miekg/dns/scan_rr.go +++ /dev/null @@ -1,1698 +0,0 @@ -package dns - -import ( - "encoding/base64" - "net" - "strconv" - "strings" -) - -// A remainder of the rdata with embedded spaces, return the parsed string (sans the spaces) -// or an error -func endingToString(c *zlexer, errstr string) (string, *ParseError) { - var s string - l, _ := c.Next() // zString - for l.value != zNewline && l.value != zEOF { - if l.err { - return s, &ParseError{"", errstr, l} - } - switch l.value { - case zString: - s += l.token - case zBlank: // Ok - default: - return "", &ParseError{"", errstr, l} - } - l, _ = c.Next() - } - - return s, nil -} - -// A remainder of the rdata with embedded spaces, split on unquoted whitespace -// and return the parsed string slice or an error -func endingToTxtSlice(c *zlexer, errstr string) ([]string, *ParseError) { - // Get the remaining data until we see a zNewline - l, _ := c.Next() - if l.err { - return nil, &ParseError{"", errstr, l} - } - - // Build the slice - s := make([]string, 0) - quote := false - empty := false - for l.value != zNewline && l.value != zEOF { - if l.err { - return nil, &ParseError{"", errstr, l} - } - switch l.value { - case zString: - empty = false - if len(l.token) > 255 { - // split up tokens that are larger than 255 into 255-chunks - sx := []string{} - p, i := 0, 255 - for { - if i <= len(l.token) { - sx = append(sx, l.token[p:i]) - } else { - sx = append(sx, l.token[p:]) - break - - } - p, i = p+255, i+255 - } - s = append(s, sx...) - break - } - - s = append(s, l.token) - case zBlank: - if quote { - // zBlank can only be seen in between txt parts. - return nil, &ParseError{"", errstr, l} - } - case zQuote: - if empty && quote { - s = append(s, "") - } - quote = !quote - empty = true - default: - return nil, &ParseError{"", errstr, l} - } - l, _ = c.Next() - } - - if quote { - return nil, &ParseError{"", errstr, l} - } - - return s, nil -} - -func (rr *A) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - rr.A = net.ParseIP(l.token) - // IPv4 addresses cannot include ":". - // We do this rather than use net.IP's To4() because - // To4() treats IPv4-mapped IPv6 addresses as being - // IPv4. - isIPv4 := !strings.Contains(l.token, ":") - if rr.A == nil || !isIPv4 || l.err { - return &ParseError{"", "bad A A", l} - } - return slurpRemainder(c) -} - -func (rr *AAAA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - rr.AAAA = net.ParseIP(l.token) - // IPv6 addresses must include ":", and IPv4 - // addresses cannot include ":". - isIPv6 := strings.Contains(l.token, ":") - if rr.AAAA == nil || !isIPv6 || l.err { - return &ParseError{"", "bad AAAA AAAA", l} - } - return slurpRemainder(c) -} - -func (rr *NS) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad NS Ns", l} - } - rr.Ns = name - return slurpRemainder(c) -} - -func (rr *PTR) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad PTR Ptr", l} - } - rr.Ptr = name - return slurpRemainder(c) -} - -func (rr *NSAPPTR) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad NSAP-PTR Ptr", l} - } - rr.Ptr = name - return slurpRemainder(c) -} - -func (rr *RP) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - mbox, mboxOk := toAbsoluteName(l.token, o) - if l.err || !mboxOk { - return &ParseError{"", "bad RP Mbox", l} - } - rr.Mbox = mbox - - c.Next() // zBlank - l, _ = c.Next() - rr.Txt = l.token - - txt, txtOk := toAbsoluteName(l.token, o) - if l.err || !txtOk { - return &ParseError{"", "bad RP Txt", l} - } - rr.Txt = txt - - return slurpRemainder(c) -} - -func (rr *MR) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MR Mr", l} - } - rr.Mr = name - return slurpRemainder(c) -} - -func (rr *MB) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MB Mb", l} - } - rr.Mb = name - return slurpRemainder(c) -} - -func (rr *MG) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MG Mg", l} - } - rr.Mg = name - return slurpRemainder(c) -} - -func (rr *HINFO) parse(c *zlexer, o string) *ParseError { - chunks, e := endingToTxtSlice(c, "bad HINFO Fields") - if e != nil { - return e - } - - if ln := len(chunks); ln == 0 { - return nil - } else if ln == 1 { - // Can we split it? - if out := strings.Fields(chunks[0]); len(out) > 1 { - chunks = out - } else { - chunks = append(chunks, "") - } - } - - rr.Cpu = chunks[0] - rr.Os = strings.Join(chunks[1:], " ") - - return nil -} - -func (rr *MINFO) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - rmail, rmailOk := toAbsoluteName(l.token, o) - if l.err || !rmailOk { - return &ParseError{"", "bad MINFO Rmail", l} - } - rr.Rmail = rmail - - c.Next() // zBlank - l, _ = c.Next() - rr.Email = l.token - - email, emailOk := toAbsoluteName(l.token, o) - if l.err || !emailOk { - return &ParseError{"", "bad MINFO Email", l} - } - rr.Email = email - - return slurpRemainder(c) -} - -func (rr *MF) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MF Mf", l} - } - rr.Mf = name - return slurpRemainder(c) -} - -func (rr *MD) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MD Md", l} - } - rr.Md = name - return slurpRemainder(c) -} - -func (rr *MX) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad MX Pref", l} - } - rr.Preference = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Mx = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad MX Mx", l} - } - rr.Mx = name - - return slurpRemainder(c) -} - -func (rr *RT) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil { - return &ParseError{"", "bad RT Preference", l} - } - rr.Preference = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Host = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad RT Host", l} - } - rr.Host = name - - return slurpRemainder(c) -} - -func (rr *AFSDB) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad AFSDB Subtype", l} - } - rr.Subtype = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Hostname = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad AFSDB Hostname", l} - } - rr.Hostname = name - return slurpRemainder(c) -} - -func (rr *X25) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - if l.err { - return &ParseError{"", "bad X25 PSDNAddress", l} - } - rr.PSDNAddress = l.token - return slurpRemainder(c) -} - -func (rr *KX) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad KX Pref", l} - } - rr.Preference = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Exchanger = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad KX Exchanger", l} - } - rr.Exchanger = name - return slurpRemainder(c) -} - -func (rr *CNAME) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad CNAME Target", l} - } - rr.Target = name - return slurpRemainder(c) -} - -func (rr *DNAME) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad DNAME Target", l} - } - rr.Target = name - return slurpRemainder(c) -} - -func (rr *SOA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - ns, nsOk := toAbsoluteName(l.token, o) - if l.err || !nsOk { - return &ParseError{"", "bad SOA Ns", l} - } - rr.Ns = ns - - c.Next() // zBlank - l, _ = c.Next() - rr.Mbox = l.token - - mbox, mboxOk := toAbsoluteName(l.token, o) - if l.err || !mboxOk { - return &ParseError{"", "bad SOA Mbox", l} - } - rr.Mbox = mbox - - c.Next() // zBlank - - var ( - v uint32 - ok bool - ) - for i := 0; i < 5; i++ { - l, _ = c.Next() - if l.err { - return &ParseError{"", "bad SOA zone parameter", l} - } - if j, e := strconv.ParseUint(l.token, 10, 32); e != nil { - if i == 0 { - // Serial must be a number - return &ParseError{"", "bad SOA zone parameter", l} - } - // We allow other fields to be unitful duration strings - if v, ok = stringToTTL(l.token); !ok { - return &ParseError{"", "bad SOA zone parameter", l} - - } - } else { - v = uint32(j) - } - switch i { - case 0: - rr.Serial = v - c.Next() // zBlank - case 1: - rr.Refresh = v - c.Next() // zBlank - case 2: - rr.Retry = v - c.Next() // zBlank - case 3: - rr.Expire = v - c.Next() // zBlank - case 4: - rr.Minttl = v - } - } - return slurpRemainder(c) -} - -func (rr *SRV) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad SRV Priority", l} - } - rr.Priority = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad SRV Weight", l} - } - rr.Weight = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad SRV Port", l} - } - rr.Port = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Target = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad SRV Target", l} - } - rr.Target = name - return slurpRemainder(c) -} - -func (rr *NAPTR) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad NAPTR Order", l} - } - rr.Order = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad NAPTR Preference", l} - } - rr.Preference = uint16(i) - - // Flags - c.Next() // zBlank - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Flags", l} - } - l, _ = c.Next() // Either String or Quote - if l.value == zString { - rr.Flags = l.token - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Flags", l} - } - } else if l.value == zQuote { - rr.Flags = "" - } else { - return &ParseError{"", "bad NAPTR Flags", l} - } - - // Service - c.Next() // zBlank - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Service", l} - } - l, _ = c.Next() // Either String or Quote - if l.value == zString { - rr.Service = l.token - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Service", l} - } - } else if l.value == zQuote { - rr.Service = "" - } else { - return &ParseError{"", "bad NAPTR Service", l} - } - - // Regexp - c.Next() // zBlank - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Regexp", l} - } - l, _ = c.Next() // Either String or Quote - if l.value == zString { - rr.Regexp = l.token - l, _ = c.Next() // _QUOTE - if l.value != zQuote { - return &ParseError{"", "bad NAPTR Regexp", l} - } - } else if l.value == zQuote { - rr.Regexp = "" - } else { - return &ParseError{"", "bad NAPTR Regexp", l} - } - - // After quote no space?? - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Replacement = l.token - - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad NAPTR Replacement", l} - } - rr.Replacement = name - return slurpRemainder(c) -} - -func (rr *TALINK) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - previousName, previousNameOk := toAbsoluteName(l.token, o) - if l.err || !previousNameOk { - return &ParseError{"", "bad TALINK PreviousName", l} - } - rr.PreviousName = previousName - - c.Next() // zBlank - l, _ = c.Next() - rr.NextName = l.token - - nextName, nextNameOk := toAbsoluteName(l.token, o) - if l.err || !nextNameOk { - return &ParseError{"", "bad TALINK NextName", l} - } - rr.NextName = nextName - - return slurpRemainder(c) -} - -func (rr *LOC) parse(c *zlexer, o string) *ParseError { - // Non zero defaults for LOC record, see RFC 1876, Section 3. - rr.HorizPre = 165 // 10000 - rr.VertPre = 162 // 10 - rr.Size = 18 // 1 - ok := false - - // North - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 32) - if e != nil || l.err { - return &ParseError{"", "bad LOC Latitude", l} - } - rr.Latitude = 1000 * 60 * 60 * uint32(i) - - c.Next() // zBlank - // Either number, 'N' or 'S' - l, _ = c.Next() - if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok { - goto East - } - i, e = strconv.ParseUint(l.token, 10, 32) - if e != nil || l.err { - return &ParseError{"", "bad LOC Latitude minutes", l} - } - rr.Latitude += 1000 * 60 * uint32(i) - - c.Next() // zBlank - l, _ = c.Next() - if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { - return &ParseError{"", "bad LOC Latitude seconds", l} - } else { - rr.Latitude += uint32(1000 * i) - } - c.Next() // zBlank - // Either number, 'N' or 'S' - l, _ = c.Next() - if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok { - goto East - } - // If still alive, flag an error - return &ParseError{"", "bad LOC Latitude North/South", l} - -East: - // East - c.Next() // zBlank - l, _ = c.Next() - if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err { - return &ParseError{"", "bad LOC Longitude", l} - } else { - rr.Longitude = 1000 * 60 * 60 * uint32(i) - } - c.Next() // zBlank - // Either number, 'E' or 'W' - l, _ = c.Next() - if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok { - goto Altitude - } - if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err { - return &ParseError{"", "bad LOC Longitude minutes", l} - } else { - rr.Longitude += 1000 * 60 * uint32(i) - } - c.Next() // zBlank - l, _ = c.Next() - if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { - return &ParseError{"", "bad LOC Longitude seconds", l} - } else { - rr.Longitude += uint32(1000 * i) - } - c.Next() // zBlank - // Either number, 'E' or 'W' - l, _ = c.Next() - if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok { - goto Altitude - } - // If still alive, flag an error - return &ParseError{"", "bad LOC Longitude East/West", l} - -Altitude: - c.Next() // zBlank - l, _ = c.Next() - if len(l.token) == 0 || l.err { - return &ParseError{"", "bad LOC Altitude", l} - } - if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' { - l.token = l.token[0 : len(l.token)-1] - } - if i, e := strconv.ParseFloat(l.token, 32); e != nil { - return &ParseError{"", "bad LOC Altitude", l} - } else { - rr.Altitude = uint32(i*100.0 + 10000000.0 + 0.5) - } - - // And now optionally the other values - l, _ = c.Next() - count := 0 - for l.value != zNewline && l.value != zEOF { - switch l.value { - case zString: - switch count { - case 0: // Size - e, m, ok := stringToCm(l.token) - if !ok { - return &ParseError{"", "bad LOC Size", l} - } - rr.Size = e&0x0f | m<<4&0xf0 - case 1: // HorizPre - e, m, ok := stringToCm(l.token) - if !ok { - return &ParseError{"", "bad LOC HorizPre", l} - } - rr.HorizPre = e&0x0f | m<<4&0xf0 - case 2: // VertPre - e, m, ok := stringToCm(l.token) - if !ok { - return &ParseError{"", "bad LOC VertPre", l} - } - rr.VertPre = e&0x0f | m<<4&0xf0 - } - count++ - case zBlank: - // Ok - default: - return &ParseError{"", "bad LOC Size, HorizPre or VertPre", l} - } - l, _ = c.Next() - } - return nil -} - -func (rr *HIP) parse(c *zlexer, o string) *ParseError { - // HitLength is not represented - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad HIP PublicKeyAlgorithm", l} - } - rr.PublicKeyAlgorithm = uint8(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - if len(l.token) == 0 || l.err { - return &ParseError{"", "bad HIP Hit", l} - } - rr.Hit = l.token // This can not contain spaces, see RFC 5205 Section 6. - rr.HitLength = uint8(len(rr.Hit)) / 2 - - c.Next() // zBlank - l, _ = c.Next() // zString - if len(l.token) == 0 || l.err { - return &ParseError{"", "bad HIP PublicKey", l} - } - rr.PublicKey = l.token // This cannot contain spaces - rr.PublicKeyLength = uint16(base64.StdEncoding.DecodedLen(len(rr.PublicKey))) - - // RendezvousServers (if any) - l, _ = c.Next() - var xs []string - for l.value != zNewline && l.value != zEOF { - switch l.value { - case zString: - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad HIP RendezvousServers", l} - } - xs = append(xs, name) - case zBlank: - // Ok - default: - return &ParseError{"", "bad HIP RendezvousServers", l} - } - l, _ = c.Next() - } - - rr.RendezvousServers = xs - return nil -} - -func (rr *CERT) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - if v, ok := StringToCertType[l.token]; ok { - rr.Type = v - } else if i, e := strconv.ParseUint(l.token, 10, 16); e != nil { - return &ParseError{"", "bad CERT Type", l} - } else { - rr.Type = uint16(i) - } - c.Next() // zBlank - l, _ = c.Next() // zString - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad CERT KeyTag", l} - } - rr.KeyTag = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - if v, ok := StringToAlgorithm[l.token]; ok { - rr.Algorithm = v - } else if i, e := strconv.ParseUint(l.token, 10, 8); e != nil { - return &ParseError{"", "bad CERT Algorithm", l} - } else { - rr.Algorithm = uint8(i) - } - s, e1 := endingToString(c, "bad CERT Certificate") - if e1 != nil { - return e1 - } - rr.Certificate = s - return nil -} - -func (rr *OPENPGPKEY) parse(c *zlexer, o string) *ParseError { - s, e := endingToString(c, "bad OPENPGPKEY PublicKey") - if e != nil { - return e - } - rr.PublicKey = s - return nil -} - -func (rr *CSYNC) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - j, e := strconv.ParseUint(l.token, 10, 32) - if e != nil { - // Serial must be a number - return &ParseError{"", "bad CSYNC serial", l} - } - rr.Serial = uint32(j) - - c.Next() // zBlank - - l, _ = c.Next() - j, e = strconv.ParseUint(l.token, 10, 16) - if e != nil { - // Serial must be a number - return &ParseError{"", "bad CSYNC flags", l} - } - rr.Flags = uint16(j) - - rr.TypeBitMap = make([]uint16, 0) - var ( - k uint16 - ok bool - ) - l, _ = c.Next() - for l.value != zNewline && l.value != zEOF { - switch l.value { - case zBlank: - // Ok - case zString: - tokenUpper := strings.ToUpper(l.token) - if k, ok = StringToType[tokenUpper]; !ok { - if k, ok = typeToInt(l.token); !ok { - return &ParseError{"", "bad CSYNC TypeBitMap", l} - } - } - rr.TypeBitMap = append(rr.TypeBitMap, k) - default: - return &ParseError{"", "bad CSYNC TypeBitMap", l} - } - l, _ = c.Next() - } - return nil -} - -func (rr *SIG) parse(c *zlexer, o string) *ParseError { - return rr.RRSIG.parse(c, o) -} - -func (rr *RRSIG) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - tokenUpper := strings.ToUpper(l.token) - if t, ok := StringToType[tokenUpper]; !ok { - if strings.HasPrefix(tokenUpper, "TYPE") { - t, ok = typeToInt(l.token) - if !ok { - return &ParseError{"", "bad RRSIG Typecovered", l} - } - rr.TypeCovered = t - } else { - return &ParseError{"", "bad RRSIG Typecovered", l} - } - } else { - rr.TypeCovered = t - } - - c.Next() // zBlank - l, _ = c.Next() - i, err := strconv.ParseUint(l.token, 10, 8) - if err != nil || l.err { - return &ParseError{"", "bad RRSIG Algorithm", l} - } - rr.Algorithm = uint8(i) - - c.Next() // zBlank - l, _ = c.Next() - i, err = strconv.ParseUint(l.token, 10, 8) - if err != nil || l.err { - return &ParseError{"", "bad RRSIG Labels", l} - } - rr.Labels = uint8(i) - - c.Next() // zBlank - l, _ = c.Next() - i, err = strconv.ParseUint(l.token, 10, 32) - if err != nil || l.err { - return &ParseError{"", "bad RRSIG OrigTtl", l} - } - rr.OrigTtl = uint32(i) - - c.Next() // zBlank - l, _ = c.Next() - if i, err := StringToTime(l.token); err != nil { - // Try to see if all numeric and use it as epoch - if i, err := strconv.ParseInt(l.token, 10, 64); err == nil { - // TODO(miek): error out on > MAX_UINT32, same below - rr.Expiration = uint32(i) - } else { - return &ParseError{"", "bad RRSIG Expiration", l} - } - } else { - rr.Expiration = i - } - - c.Next() // zBlank - l, _ = c.Next() - if i, err := StringToTime(l.token); err != nil { - if i, err := strconv.ParseInt(l.token, 10, 64); err == nil { - rr.Inception = uint32(i) - } else { - return &ParseError{"", "bad RRSIG Inception", l} - } - } else { - rr.Inception = i - } - - c.Next() // zBlank - l, _ = c.Next() - i, err = strconv.ParseUint(l.token, 10, 16) - if err != nil || l.err { - return &ParseError{"", "bad RRSIG KeyTag", l} - } - rr.KeyTag = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() - rr.SignerName = l.token - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad RRSIG SignerName", l} - } - rr.SignerName = name - - s, e := endingToString(c, "bad RRSIG Signature") - if e != nil { - return e - } - rr.Signature = s - - return nil -} - -func (rr *NSEC) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad NSEC NextDomain", l} - } - rr.NextDomain = name - - rr.TypeBitMap = make([]uint16, 0) - var ( - k uint16 - ok bool - ) - l, _ = c.Next() - for l.value != zNewline && l.value != zEOF { - switch l.value { - case zBlank: - // Ok - case zString: - tokenUpper := strings.ToUpper(l.token) - if k, ok = StringToType[tokenUpper]; !ok { - if k, ok = typeToInt(l.token); !ok { - return &ParseError{"", "bad NSEC TypeBitMap", l} - } - } - rr.TypeBitMap = append(rr.TypeBitMap, k) - default: - return &ParseError{"", "bad NSEC TypeBitMap", l} - } - l, _ = c.Next() - } - return nil -} - -func (rr *NSEC3) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3 Hash", l} - } - rr.Hash = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3 Flags", l} - } - rr.Flags = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3 Iterations", l} - } - rr.Iterations = uint16(i) - c.Next() - l, _ = c.Next() - if len(l.token) == 0 || l.err { - return &ParseError{"", "bad NSEC3 Salt", l} - } - if l.token != "-" { - rr.SaltLength = uint8(len(l.token)) / 2 - rr.Salt = l.token - } - - c.Next() - l, _ = c.Next() - if len(l.token) == 0 || l.err { - return &ParseError{"", "bad NSEC3 NextDomain", l} - } - rr.HashLength = 20 // Fix for NSEC3 (sha1 160 bits) - rr.NextDomain = l.token - - rr.TypeBitMap = make([]uint16, 0) - var ( - k uint16 - ok bool - ) - l, _ = c.Next() - for l.value != zNewline && l.value != zEOF { - switch l.value { - case zBlank: - // Ok - case zString: - tokenUpper := strings.ToUpper(l.token) - if k, ok = StringToType[tokenUpper]; !ok { - if k, ok = typeToInt(l.token); !ok { - return &ParseError{"", "bad NSEC3 TypeBitMap", l} - } - } - rr.TypeBitMap = append(rr.TypeBitMap, k) - default: - return &ParseError{"", "bad NSEC3 TypeBitMap", l} - } - l, _ = c.Next() - } - return nil -} - -func (rr *NSEC3PARAM) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3PARAM Hash", l} - } - rr.Hash = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3PARAM Flags", l} - } - rr.Flags = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad NSEC3PARAM Iterations", l} - } - rr.Iterations = uint16(i) - c.Next() - l, _ = c.Next() - if l.token != "-" { - rr.SaltLength = uint8(len(l.token)) - rr.Salt = l.token - } - return slurpRemainder(c) -} - -func (rr *EUI48) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - if len(l.token) != 17 || l.err { - return &ParseError{"", "bad EUI48 Address", l} - } - addr := make([]byte, 12) - dash := 0 - for i := 0; i < 10; i += 2 { - addr[i] = l.token[i+dash] - addr[i+1] = l.token[i+1+dash] - dash++ - if l.token[i+1+dash] != '-' { - return &ParseError{"", "bad EUI48 Address", l} - } - } - addr[10] = l.token[15] - addr[11] = l.token[16] - - i, e := strconv.ParseUint(string(addr), 16, 48) - if e != nil { - return &ParseError{"", "bad EUI48 Address", l} - } - rr.Address = i - return slurpRemainder(c) -} - -func (rr *EUI64) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - if len(l.token) != 23 || l.err { - return &ParseError{"", "bad EUI64 Address", l} - } - addr := make([]byte, 16) - dash := 0 - for i := 0; i < 14; i += 2 { - addr[i] = l.token[i+dash] - addr[i+1] = l.token[i+1+dash] - dash++ - if l.token[i+1+dash] != '-' { - return &ParseError{"", "bad EUI64 Address", l} - } - } - addr[14] = l.token[21] - addr[15] = l.token[22] - - i, e := strconv.ParseUint(string(addr), 16, 64) - if e != nil { - return &ParseError{"", "bad EUI68 Address", l} - } - rr.Address = i - return slurpRemainder(c) -} - -func (rr *SSHFP) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad SSHFP Algorithm", l} - } - rr.Algorithm = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad SSHFP Type", l} - } - rr.Type = uint8(i) - c.Next() // zBlank - s, e1 := endingToString(c, "bad SSHFP Fingerprint") - if e1 != nil { - return e1 - } - rr.FingerPrint = s - return nil -} - -func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, typ string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad " + typ + " Flags", l} - } - rr.Flags = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad " + typ + " Protocol", l} - } - rr.Protocol = uint8(i) - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad " + typ + " Algorithm", l} - } - rr.Algorithm = uint8(i) - s, e1 := endingToString(c, "bad "+typ+" PublicKey") - if e1 != nil { - return e1 - } - rr.PublicKey = s - return nil -} - -func (rr *DNSKEY) parse(c *zlexer, o string) *ParseError { - return rr.parseDNSKEY(c, o, "DNSKEY") -} - -func (rr *KEY) parse(c *zlexer, o string) *ParseError { - return rr.parseDNSKEY(c, o, "KEY") -} - -func (rr *CDNSKEY) parse(c *zlexer, o string) *ParseError { - return rr.parseDNSKEY(c, o, "CDNSKEY") -} - -func (rr *RKEY) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad RKEY Flags", l} - } - rr.Flags = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad RKEY Protocol", l} - } - rr.Protocol = uint8(i) - c.Next() // zBlank - l, _ = c.Next() // zString - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad RKEY Algorithm", l} - } - rr.Algorithm = uint8(i) - s, e1 := endingToString(c, "bad RKEY PublicKey") - if e1 != nil { - return e1 - } - rr.PublicKey = s - return nil -} - -func (rr *EID) parse(c *zlexer, o string) *ParseError { - s, e := endingToString(c, "bad EID Endpoint") - if e != nil { - return e - } - rr.Endpoint = s - return nil -} - -func (rr *NIMLOC) parse(c *zlexer, o string) *ParseError { - s, e := endingToString(c, "bad NIMLOC Locator") - if e != nil { - return e - } - rr.Locator = s - return nil -} - -func (rr *GPOS) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - _, e := strconv.ParseFloat(l.token, 64) - if e != nil || l.err { - return &ParseError{"", "bad GPOS Longitude", l} - } - rr.Longitude = l.token - c.Next() // zBlank - l, _ = c.Next() - _, e = strconv.ParseFloat(l.token, 64) - if e != nil || l.err { - return &ParseError{"", "bad GPOS Latitude", l} - } - rr.Latitude = l.token - c.Next() // zBlank - l, _ = c.Next() - _, e = strconv.ParseFloat(l.token, 64) - if e != nil || l.err { - return &ParseError{"", "bad GPOS Altitude", l} - } - rr.Altitude = l.token - return slurpRemainder(c) -} - -func (rr *DS) parseDS(c *zlexer, o, typ string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad " + typ + " KeyTag", l} - } - rr.KeyTag = uint16(i) - c.Next() // zBlank - l, _ = c.Next() - if i, e = strconv.ParseUint(l.token, 10, 8); e != nil { - tokenUpper := strings.ToUpper(l.token) - i, ok := StringToAlgorithm[tokenUpper] - if !ok || l.err { - return &ParseError{"", "bad " + typ + " Algorithm", l} - } - rr.Algorithm = i - } else { - rr.Algorithm = uint8(i) - } - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad " + typ + " DigestType", l} - } - rr.DigestType = uint8(i) - s, e1 := endingToString(c, "bad "+typ+" Digest") - if e1 != nil { - return e1 - } - rr.Digest = s - return nil -} - -func (rr *DS) parse(c *zlexer, o string) *ParseError { - return rr.parseDS(c, o, "DS") -} - -func (rr *DLV) parse(c *zlexer, o string) *ParseError { - return rr.parseDS(c, o, "DLV") -} - -func (rr *CDS) parse(c *zlexer, o string) *ParseError { - return rr.parseDS(c, o, "CDS") -} - -func (rr *TA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad TA KeyTag", l} - } - rr.KeyTag = uint16(i) - c.Next() // zBlank - l, _ = c.Next() - if i, e := strconv.ParseUint(l.token, 10, 8); e != nil { - tokenUpper := strings.ToUpper(l.token) - i, ok := StringToAlgorithm[tokenUpper] - if !ok || l.err { - return &ParseError{"", "bad TA Algorithm", l} - } - rr.Algorithm = i - } else { - rr.Algorithm = uint8(i) - } - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad TA DigestType", l} - } - rr.DigestType = uint8(i) - s, err := endingToString(c, "bad TA Digest") - if err != nil { - return err - } - rr.Digest = s - return nil -} - -func (rr *TLSA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad TLSA Usage", l} - } - rr.Usage = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad TLSA Selector", l} - } - rr.Selector = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad TLSA MatchingType", l} - } - rr.MatchingType = uint8(i) - // So this needs be e2 (i.e. different than e), because...??t - s, e2 := endingToString(c, "bad TLSA Certificate") - if e2 != nil { - return e2 - } - rr.Certificate = s - return nil -} - -func (rr *SMIMEA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad SMIMEA Usage", l} - } - rr.Usage = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad SMIMEA Selector", l} - } - rr.Selector = uint8(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 8) - if e != nil || l.err { - return &ParseError{"", "bad SMIMEA MatchingType", l} - } - rr.MatchingType = uint8(i) - // So this needs be e2 (i.e. different than e), because...??t - s, e2 := endingToString(c, "bad SMIMEA Certificate") - if e2 != nil { - return e2 - } - rr.Certificate = s - return nil -} - -func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - if l.token != "\\#" { - return &ParseError{"", "bad RFC3597 Rdata", l} - } - - c.Next() // zBlank - l, _ = c.Next() - rdlength, e := strconv.Atoi(l.token) - if e != nil || l.err { - return &ParseError{"", "bad RFC3597 Rdata ", l} - } - - s, e1 := endingToString(c, "bad RFC3597 Rdata") - if e1 != nil { - return e1 - } - if rdlength*2 != len(s) { - return &ParseError{"", "bad RFC3597 Rdata", l} - } - rr.Rdata = s - return nil -} - -func (rr *SPF) parse(c *zlexer, o string) *ParseError { - s, e := endingToTxtSlice(c, "bad SPF Txt") - if e != nil { - return e - } - rr.Txt = s - return nil -} - -func (rr *AVC) parse(c *zlexer, o string) *ParseError { - s, e := endingToTxtSlice(c, "bad AVC Txt") - if e != nil { - return e - } - rr.Txt = s - return nil -} - -func (rr *TXT) parse(c *zlexer, o string) *ParseError { - // no zBlank reading here, because all this rdata is TXT - s, e := endingToTxtSlice(c, "bad TXT Txt") - if e != nil { - return e - } - rr.Txt = s - return nil -} - -// identical to setTXT -func (rr *NINFO) parse(c *zlexer, o string) *ParseError { - s, e := endingToTxtSlice(c, "bad NINFO ZSData") - if e != nil { - return e - } - rr.ZSData = s - return nil -} - -func (rr *URI) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad URI Priority", l} - } - rr.Priority = uint16(i) - c.Next() // zBlank - l, _ = c.Next() - i, e = strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad URI Weight", l} - } - rr.Weight = uint16(i) - - c.Next() // zBlank - s, err := endingToTxtSlice(c, "bad URI Target") - if err != nil { - return err - } - if len(s) != 1 { - return &ParseError{"", "bad URI Target", l} - } - rr.Target = s[0] - return nil -} - -func (rr *DHCID) parse(c *zlexer, o string) *ParseError { - // awesome record to parse! - s, e := endingToString(c, "bad DHCID Digest") - if e != nil { - return e - } - rr.Digest = s - return nil -} - -func (rr *NID) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad NID Preference", l} - } - rr.Preference = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - u, err := stringToNodeID(l) - if err != nil || l.err { - return err - } - rr.NodeID = u - return slurpRemainder(c) -} - -func (rr *L32) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad L32 Preference", l} - } - rr.Preference = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Locator32 = net.ParseIP(l.token) - if rr.Locator32 == nil || l.err { - return &ParseError{"", "bad L32 Locator", l} - } - return slurpRemainder(c) -} - -func (rr *LP) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad LP Preference", l} - } - rr.Preference = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Fqdn = l.token - name, nameOk := toAbsoluteName(l.token, o) - if l.err || !nameOk { - return &ParseError{"", "bad LP Fqdn", l} - } - rr.Fqdn = name - - return slurpRemainder(c) -} - -func (rr *L64) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad L64 Preference", l} - } - rr.Preference = uint16(i) - c.Next() // zBlank - l, _ = c.Next() // zString - u, err := stringToNodeID(l) - if err != nil || l.err { - return err - } - rr.Locator64 = u - return slurpRemainder(c) -} - -func (rr *UID) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 32) - if e != nil || l.err { - return &ParseError{"", "bad UID Uid", l} - } - rr.Uid = uint32(i) - return slurpRemainder(c) -} - -func (rr *GID) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 32) - if e != nil || l.err { - return &ParseError{"", "bad GID Gid", l} - } - rr.Gid = uint32(i) - return slurpRemainder(c) -} - -func (rr *UINFO) parse(c *zlexer, o string) *ParseError { - s, e := endingToTxtSlice(c, "bad UINFO Uinfo") - if e != nil { - return e - } - if ln := len(s); ln == 0 { - return nil - } - rr.Uinfo = s[0] // silently discard anything after the first character-string - return nil -} - -func (rr *PX) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, e := strconv.ParseUint(l.token, 10, 16) - if e != nil || l.err { - return &ParseError{"", "bad PX Preference", l} - } - rr.Preference = uint16(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Map822 = l.token - map822, map822Ok := toAbsoluteName(l.token, o) - if l.err || !map822Ok { - return &ParseError{"", "bad PX Map822", l} - } - rr.Map822 = map822 - - c.Next() // zBlank - l, _ = c.Next() // zString - rr.Mapx400 = l.token - mapx400, mapx400Ok := toAbsoluteName(l.token, o) - if l.err || !mapx400Ok { - return &ParseError{"", "bad PX Mapx400", l} - } - rr.Mapx400 = mapx400 - - return slurpRemainder(c) -} - -func (rr *CAA) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - i, err := strconv.ParseUint(l.token, 10, 8) - if err != nil || l.err { - return &ParseError{"", "bad CAA Flag", l} - } - rr.Flag = uint8(i) - - c.Next() // zBlank - l, _ = c.Next() // zString - if l.value != zString { - return &ParseError{"", "bad CAA Tag", l} - } - rr.Tag = l.token - - c.Next() // zBlank - s, e := endingToTxtSlice(c, "bad CAA Value") - if e != nil { - return e - } - if len(s) != 1 { - return &ParseError{"", "bad CAA Value", l} - } - rr.Value = s[0] - return nil -} - -func (rr *TKEY) parse(c *zlexer, o string) *ParseError { - l, _ := c.Next() - - // Algorithm - if l.value != zString { - return &ParseError{"", "bad TKEY algorithm", l} - } - rr.Algorithm = l.token - c.Next() // zBlank - - // Get the key length and key values - l, _ = c.Next() - i, err := strconv.ParseUint(l.token, 10, 8) - if err != nil || l.err { - return &ParseError{"", "bad TKEY key length", l} - } - rr.KeySize = uint16(i) - c.Next() // zBlank - l, _ = c.Next() - if l.value != zString { - return &ParseError{"", "bad TKEY key", l} - } - rr.Key = l.token - c.Next() // zBlank - - // Get the otherdata length and string data - l, _ = c.Next() - i, err = strconv.ParseUint(l.token, 10, 8) - if err != nil || l.err { - return &ParseError{"", "bad TKEY otherdata length", l} - } - rr.OtherLen = uint16(i) - c.Next() // zBlank - l, _ = c.Next() - if l.value != zString { - return &ParseError{"", "bad TKEY otherday", l} - } - rr.OtherData = l.token - - return nil -} diff --git a/vendor/github.com/miekg/dns/serve_mux.go b/vendor/github.com/miekg/dns/serve_mux.go deleted file mode 100644 index ae304db5..00000000 --- a/vendor/github.com/miekg/dns/serve_mux.go +++ /dev/null @@ -1,147 +0,0 @@ -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) -} diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go deleted file mode 100644 index 354f7712..00000000 --- a/vendor/github.com/miekg/dns/server.go +++ /dev/null @@ -1,758 +0,0 @@ -// DNS server implementation. - -package dns - -import ( - "context" - "crypto/tls" - "encoding/binary" - "errors" - "io" - "net" - "strings" - "sync" - "time" -) - -// Default maximum number of TCP queries before we close the socket. -const maxTCPQueries = 128 - -// aLongTimeAgo is a non-zero time, far in the past, used for -// immediate cancelation of network operations. -var aLongTimeAgo = time.Unix(1, 0) - -// Handler is implemented by any value that implements ServeDNS. -type Handler interface { - 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 -// construct an DNS response. -type ResponseWriter interface { - // LocalAddr returns the net.Addr of the server - LocalAddr() net.Addr - // RemoteAddr returns the net.Addr of the client that sent the current request. - RemoteAddr() net.Addr - // WriteMsg writes a reply back to the client. - WriteMsg(*Msg) error - // Write writes a raw buffer back to the client. - Write([]byte) (int, error) - // Close closes the connection. - Close() error - // TsigStatus returns the status of the Tsig. - TsigStatus() error - // TsigTimersOnly sets the tsig timers only boolean. - TsigTimersOnly(bool) - // Hijack lets the caller take over the connection. - // After a call to Hijack(), the DNS package will not do anything with the connection. - 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 { - closed bool // connection has been closed - hijacked bool // connection has been hijacked by handler - tsigTimersOnly bool - tsigStatus error - tsigRequestMAC string - tsigSecret map[string]string // the tsig secrets - udp *net.UDPConn // i/o connection if UDP was used - tcp net.Conn // i/o connection if TCP was used - udpSession *SessionUDP // oob data to get egress interface right - writer Writer // writer to output the raw DNS bits -} - -// HandleFailed returns a HandlerFunc that returns SERVFAIL for every request it gets. -func HandleFailed(w ResponseWriter, r *Msg) { - m := new(Msg) - m.SetRcode(r, RcodeServerFailure) - // does not matter if this write fails - w.WriteMsg(m) -} - -// ListenAndServe Starts a server on address and network specified Invoke handler -// for incoming queries. -func ListenAndServe(addr string, network string, handler Handler) error { - server := &Server{Addr: addr, Net: network, Handler: handler} - return server.ListenAndServe() -} - -// ListenAndServeTLS acts like http.ListenAndServeTLS, more information in -// http://golang.org/pkg/net/http/#ListenAndServeTLS -func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error { - cert, err := tls.LoadX509KeyPair(certFile, keyFile) - if err != nil { - return err - } - - config := tls.Config{ - Certificates: []tls.Certificate{cert}, - } - - server := &Server{ - Addr: addr, - Net: "tcp-tls", - TLSConfig: &config, - Handler: handler, - } - - return server.ListenAndServe() -} - -// ActivateAndServe activates a server with a listener from systemd, -// l and p should not both be non-nil. -// If both l and p are not nil only p will be used. -// Invoke handler for incoming queries. -func ActivateAndServe(l net.Listener, p net.PacketConn, handler Handler) error { - server := &Server{Listener: l, PacketConn: p, Handler: handler} - return server.ActivateAndServe() -} - -// Writer writes raw DNS messages; each call to Write should send an entire message. -type Writer interface { - io.Writer -} - -// Reader reads raw DNS messages; each call to ReadTCP or ReadUDP should return an entire message. -type Reader interface { - // ReadTCP reads a raw message from a TCP connection. Implementations may alter - // connection properties, for example the read-deadline. - ReadTCP(conn net.Conn, timeout time.Duration) ([]byte, error) - // ReadUDP reads a raw message from a UDP connection. Implementations may alter - // connection properties, for example the read-deadline. - ReadUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) -} - -// defaultReader is an adapter for the Server struct that implements the Reader interface -// using the readTCP and readUDP func of the embedded Server. -type defaultReader struct { - *Server -} - -func (dr defaultReader) ReadTCP(conn net.Conn, timeout time.Duration) ([]byte, error) { - return dr.readTCP(conn, timeout) -} - -func (dr defaultReader) ReadUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) { - return dr.readUDP(conn, timeout) -} - -// DecorateReader is a decorator hook for extending or supplanting the functionality of a Reader. -// Implementations should never return a nil Reader. -type DecorateReader func(Reader) Reader - -// DecorateWriter is a decorator hook for extending or supplanting the functionality of a Writer. -// Implementations should never return a nil Writer. -type DecorateWriter func(Writer) Writer - -// A Server defines parameters for running an DNS server. -type Server struct { - // Address to listen on, ":dns" if empty. - Addr string - // if "tcp" or "tcp-tls" (DNS over TLS) it will invoke a TCP listener, otherwise an UDP one - Net string - // TCP Listener to use, this is to aid in systemd's socket activation. - Listener net.Listener - // TLS connection configuration - TLSConfig *tls.Config - // UDP "Listener" to use, this is to aid in systemd's socket activation. - PacketConn net.PacketConn - // Handler to invoke, dns.DefaultServeMux if nil. - Handler Handler - // Default buffer size to use to read incoming UDP messages. If not set - // it defaults to MinMsgSize (512 B). - UDPSize int - // The net.Conn.SetReadTimeout value for new connections, defaults to 2 * time.Second. - ReadTimeout time.Duration - // The net.Conn.SetWriteTimeout value for new connections, defaults to 2 * time.Second. - WriteTimeout time.Duration - // TCP idle timeout for multiple queries, if nil, defaults to 8 * time.Second (RFC 5966). - IdleTimeout func() time.Duration - // Secret(s) for Tsig map[]. The zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2). - TsigSecret map[string]string - // If NotifyStartedFunc is set it is called once the server has started listening. - NotifyStartedFunc func() - // DecorateReader is optional, allows customization of the process that reads raw DNS messages. - DecorateReader DecorateReader - // DecorateWriter is optional, allows customization of the process that writes raw DNS messages. - DecorateWriter DecorateWriter - // Maximum number of TCP queries before we close the socket. Default is maxTCPQueries (unlimited if -1). - 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 - // AcceptMsgFunc will check the incoming message and will reject it early in the process. - // By default DefaultMsgAcceptFunc will be used. - MsgAcceptFunc MsgAcceptFunc - - // Shutdown handling - lock sync.RWMutex - 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 makeUDPBuffer(size int) func() interface{} { - return func() interface{} { - return make([]byte, size) - } -} - -func (srv *Server) init() { - srv.shutdown = make(chan struct{}) - srv.conns = make(map[net.Conn]struct{}) - - if srv.UDPSize == 0 { - srv.UDPSize = MinMsgSize - } - if srv.MsgAcceptFunc == nil { - srv.MsgAcceptFunc = DefaultMsgAcceptFunc - } - if srv.Handler == nil { - srv.Handler = DefaultServeMux - } - - 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. -func (srv *Server) ListenAndServe() error { - unlock := unlockOnce(&srv.lock) - srv.lock.Lock() - defer unlock() - - if srv.started { - return &Error{err: "server already started"} - } - - addr := srv.Addr - if addr == "" { - addr = ":domain" - } - - srv.init() - - switch srv.Net { - case "tcp", "tcp4", "tcp6": - l, err := listenTCP(srv.Net, addr, srv.ReusePort) - if err != nil { - return err - } - srv.Listener = l - srv.started = true - unlock() - return srv.serveTCP(l) - case "tcp-tls", "tcp4-tls", "tcp6-tls": - if srv.TLSConfig == nil || (len(srv.TLSConfig.Certificates) == 0 && srv.TLSConfig.GetCertificate == nil) { - return errors.New("dns: neither Certificates nor GetCertificate set in Config") - } - network := strings.TrimSuffix(srv.Net, "-tls") - l, err := listenTCP(network, addr, srv.ReusePort) - if err != nil { - return err - } - l = tls.NewListener(l, srv.TLSConfig) - srv.Listener = l - srv.started = true - unlock() - return srv.serveTCP(l) - case "udp", "udp4", "udp6": - l, err := listenUDP(srv.Net, addr, srv.ReusePort) - if err != nil { - return err - } - u := l.(*net.UDPConn) - if e := setUDPSocketOptions(u); e != nil { - return e - } - srv.PacketConn = l - srv.started = true - unlock() - return srv.serveUDP(u) - } - return &Error{err: "bad network"} -} - -// ActivateAndServe starts a nameserver with the PacketConn or Listener -// configured in *Server. Its main use is to start a server from systemd. -func (srv *Server) ActivateAndServe() error { - unlock := unlockOnce(&srv.lock) - srv.lock.Lock() - defer unlock() - - if srv.started { - return &Error{err: "server already started"} - } - - srv.init() - - pConn := srv.PacketConn - l := srv.Listener - if pConn != nil { - // Check PacketConn interface's type is valid and value - // is not nil - if t, ok := pConn.(*net.UDPConn); ok && t != nil { - if e := setUDPSocketOptions(t); e != nil { - return e - } - srv.started = true - unlock() - return srv.serveUDP(t) - } - } - if l != nil { - srv.started = true - unlock() - return srv.serveTCP(l) - } - return &Error{err: "bad listeners"} -} - -// Shutdown shuts down a server. After a call to Shutdown, ListenAndServe and -// ActivateAndServe will return. -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() - if !srv.started { - srv.lock.Unlock() - return &Error{err: "server not started"} - } - - srv.started = false - - if srv.PacketConn != nil { - srv.PacketConn.SetReadDeadline(aLongTimeAgo) // Unblock reads - } - - if srv.Listener != nil { - srv.Listener.Close() - } - - 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 { - srv.PacketConn.Close() - } - - return ctxErr -} - -var testShutdownNotify *sync.Cond - -// getReadTimeout is a helper func to use system timeout if server did not intend to change it. -func (srv *Server) getReadTimeout() time.Duration { - if srv.ReadTimeout != 0 { - return srv.ReadTimeout - } - return dnsTimeout -} - -// serveTCP starts a TCP listener for the server. -func (srv *Server) serveTCP(l net.Listener) error { - defer l.Close() - - if srv.NotifyStartedFunc != nil { - srv.NotifyStartedFunc() - } - - var wg sync.WaitGroup - defer func() { - wg.Wait() - close(srv.shutdown) - }() - - for srv.isStarted() { - rw, err := l.Accept() - if err != nil { - if !srv.isStarted() { - return nil - } - if neterr, ok := err.(net.Error); ok && neterr.Temporary() { - continue - } - return err - } - srv.lock.Lock() - // Track the connection to allow unblocking reads on shutdown. - srv.conns[rw] = struct{}{} - srv.lock.Unlock() - wg.Add(1) - go srv.serveTCPConn(&wg, rw) - } - - return nil -} - -// serveUDP starts a UDP listener for the server. -func (srv *Server) serveUDP(l *net.UDPConn) error { - defer l.Close() - - if srv.NotifyStartedFunc != nil { - srv.NotifyStartedFunc() - } - - reader := Reader(defaultReader{srv}) - if srv.DecorateReader != nil { - reader = srv.DecorateReader(reader) - } - - var wg sync.WaitGroup - defer func() { - wg.Wait() - close(srv.shutdown) - }() - - rtimeout := srv.getReadTimeout() - // deadline is not used here - for srv.isStarted() { - m, s, err := reader.ReadUDP(l, rtimeout) - if err != nil { - if !srv.isStarted() { - return nil - } - if netErr, ok := err.(net.Error); ok && netErr.Temporary() { - continue - } - return err - } - if len(m) < headerSize { - if cap(m) == srv.UDPSize { - srv.udpPool.Put(m[:srv.UDPSize]) - } - continue - } - wg.Add(1) - go srv.serveUDPPacket(&wg, m, l, s) - } - - return nil -} - -// Serve a new TCP connection. -func (srv *Server) serveTCPConn(wg *sync.WaitGroup, rw net.Conn) { - w := &response{tsigSecret: srv.TsigSecret, tcp: rw} - if srv.DecorateWriter != nil { - w.writer = srv.DecorateWriter(w) - } else { - w.writer = w - } - - reader := Reader(defaultReader{srv}) - if srv.DecorateReader != nil { - reader = srv.DecorateReader(reader) - } - - idleTimeout := tcpIdleTimeout - if srv.IdleTimeout != nil { - idleTimeout = srv.IdleTimeout() - } - - timeout := srv.getReadTimeout() - - limit := srv.MaxTCPQueries - if limit == 0 { - limit = maxTCPQueries - } - - for q := 0; (q < limit || limit == -1) && srv.isStarted(); q++ { - m, err := reader.ReadTCP(w.tcp, timeout) - if err != nil { - // TODO(tmthrgd): handle error - break - } - srv.serveDNS(m, w) - if w.closed { - break // Close() was called - } - if w.hijacked { - break // client will call Close() themselves - } - // The first read uses the read timeout, the rest use the - // idle timeout. - timeout = idleTimeout - } - - if !w.hijacked { - w.Close() - } - - srv.lock.Lock() - delete(srv.conns, w.tcp) - srv.lock.Unlock() - - wg.Done() -} - -// Serve a new UDP request. -func (srv *Server) serveUDPPacket(wg *sync.WaitGroup, m []byte, u *net.UDPConn, s *SessionUDP) { - w := &response{tsigSecret: srv.TsigSecret, udp: u, udpSession: s} - if srv.DecorateWriter != nil { - w.writer = srv.DecorateWriter(w) - } else { - w.writer = w - } - - srv.serveDNS(m, w) - wg.Done() -} - -func (srv *Server) serveDNS(m []byte, w *response) { - dh, off, err := unpackMsgHdr(m, 0) - if err != nil { - // Let client hang, they are sending crap; any reply can be used to amplify. - return - } - - req := new(Msg) - req.setHdr(dh) - - switch srv.MsgAcceptFunc(dh) { - case MsgAccept: - if req.unpack(dh, m, off) == nil { - break - } - - fallthrough - case MsgReject: - req.SetRcodeFormatError(req) - // Are we allowed to delete any OPT records here? - req.Ns, req.Answer, req.Extra = nil, nil, nil - req.Zero = false - - w.WriteMsg(req) - fallthrough - case MsgIgnore: - if w.udp != nil && cap(m) == srv.UDPSize { - srv.udpPool.Put(m[:srv.UDPSize]) - } - - return - } - - w.tsigStatus = nil - if w.tsigSecret != nil { - if t := req.IsTsig(); t != nil { - if secret, ok := w.tsigSecret[t.Hdr.Name]; ok { - w.tsigStatus = TsigVerify(m, secret, "", false) - } else { - w.tsigStatus = ErrSecret - } - w.tsigTimersOnly = false - w.tsigRequestMAC = req.Extra[len(req.Extra)-1].(*TSIG).MAC - } - } - - if w.udp != nil && cap(m) == srv.UDPSize { - srv.udpPool.Put(m[:srv.UDPSize]) - } - - srv.Handler.ServeDNS(w, req) // Writes back to the client -} - -func (srv *Server) readTCP(conn net.Conn, timeout time.Duration) ([]byte, error) { - // If we race with ShutdownContext, the read deadline may - // have been set in the distant past to unblock the read - // below. We must not override it, otherwise we may block - // ShutdownContext. - srv.lock.RLock() - if srv.started { - conn.SetReadDeadline(time.Now().Add(timeout)) - } - srv.lock.RUnlock() - - var length uint16 - if err := binary.Read(conn, binary.BigEndian, &length); err != nil { - return nil, err - } - - m := make([]byte, length) - if _, err := io.ReadFull(conn, m); err != nil { - return nil, err - } - - return m, nil -} - -func (srv *Server) readUDP(conn *net.UDPConn, timeout time.Duration) ([]byte, *SessionUDP, error) { - srv.lock.RLock() - if srv.started { - // See the comment in readTCP above. - conn.SetReadDeadline(time.Now().Add(timeout)) - } - srv.lock.RUnlock() - - m := srv.udpPool.Get().([]byte) - n, s, err := ReadFromSessionUDP(conn, m) - if err != nil { - srv.udpPool.Put(m) - return nil, nil, err - } - m = m[:n] - return m, s, nil -} - -// WriteMsg implements the ResponseWriter.WriteMsg method. -func (w *response) WriteMsg(m *Msg) (err error) { - if w.closed { - return &Error{err: "WriteMsg called after Close"} - } - - var data []byte - if w.tsigSecret != nil { // if no secrets, dont check for the tsig (which is a longer check) - if t := m.IsTsig(); t != nil { - data, w.tsigRequestMAC, err = TsigGenerate(m, w.tsigSecret[t.Hdr.Name], w.tsigRequestMAC, w.tsigTimersOnly) - if err != nil { - return err - } - _, err = w.writer.Write(data) - return err - } - } - data, err = m.Pack() - if err != nil { - return err - } - _, err = w.writer.Write(data) - return err -} - -// Write implements the ResponseWriter.Write method. -func (w *response) Write(m []byte) (int, error) { - if w.closed { - return 0, &Error{err: "Write called after Close"} - } - - switch { - case w.udp != nil: - return WriteToSessionUDP(w.udp, m, w.udpSession) - case w.tcp != nil: - if len(m) > MaxMsgSize { - return 0, &Error{err: "message too large"} - } - - l := make([]byte, 2) - binary.BigEndian.PutUint16(l, uint16(len(m))) - - n, err := (&net.Buffers{l, m}).WriteTo(w.tcp) - return int(n), err - default: - panic("dns: internal error: udp and tcp both nil") - } -} - -// LocalAddr implements the ResponseWriter.LocalAddr method. -func (w *response) LocalAddr() net.Addr { - switch { - case w.udp != nil: - return w.udp.LocalAddr() - case w.tcp != nil: - return w.tcp.LocalAddr() - default: - panic("dns: internal error: udp and tcp both nil") - } -} - -// RemoteAddr implements the ResponseWriter.RemoteAddr method. -func (w *response) RemoteAddr() net.Addr { - switch { - case w.udpSession != nil: - return w.udpSession.RemoteAddr() - case w.tcp != nil: - return w.tcp.RemoteAddr() - default: - panic("dns: internal error: udpSession and tcp both nil") - } -} - -// TsigStatus implements the ResponseWriter.TsigStatus method. -func (w *response) TsigStatus() error { return w.tsigStatus } - -// TsigTimersOnly implements the ResponseWriter.TsigTimersOnly method. -func (w *response) TsigTimersOnly(b bool) { w.tsigTimersOnly = b } - -// Hijack implements the ResponseWriter.Hijack method. -func (w *response) Hijack() { w.hijacked = true } - -// Close implements the ResponseWriter.Close method -func (w *response) Close() error { - if w.closed { - return &Error{err: "connection already closed"} - } - w.closed = true - - switch { - case w.udp != nil: - // Can't close the udp conn, as that is actually the listener. - return nil - case w.tcp != nil: - return w.tcp.Close() - default: - panic("dns: internal error: udp and tcp both 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 -} diff --git a/vendor/github.com/miekg/dns/sig0.go b/vendor/github.com/miekg/dns/sig0.go deleted file mode 100644 index 55cf1c38..00000000 --- a/vendor/github.com/miekg/dns/sig0.go +++ /dev/null @@ -1,209 +0,0 @@ -package dns - -import ( - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "crypto/rsa" - "encoding/binary" - "math/big" - "strings" - "time" -) - -// Sign signs a dns.Msg. It fills the signature with the appropriate data. -// The SIG record should have the SignerName, KeyTag, Algorithm, Inception -// and Expiration set. -func (rr *SIG) Sign(k crypto.Signer, m *Msg) ([]byte, error) { - if k == nil { - return nil, ErrPrivKey - } - if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 { - return nil, ErrKey - } - - rr.Hdr = RR_Header{Name: ".", Rrtype: TypeSIG, Class: ClassANY, Ttl: 0} - rr.OrigTtl, rr.TypeCovered, rr.Labels = 0, 0, 0 - - buf := make([]byte, m.Len()+Len(rr)) - mbuf, err := m.PackBuffer(buf) - if err != nil { - return nil, err - } - if &buf[0] != &mbuf[0] { - return nil, ErrBuf - } - off, err := PackRR(rr, buf, len(mbuf), nil, false) - if err != nil { - return nil, err - } - buf = buf[:off:cap(buf)] - - hash, ok := AlgorithmToHash[rr.Algorithm] - if !ok { - return nil, ErrAlg - } - - hasher := hash.New() - // Write SIG rdata - hasher.Write(buf[len(mbuf)+1+2+2+4+2:]) - // Write message - hasher.Write(buf[:len(mbuf)]) - - signature, err := sign(k, hasher.Sum(nil), hash, rr.Algorithm) - if err != nil { - return nil, err - } - - rr.Signature = toBase64(signature) - - buf = append(buf, signature...) - if len(buf) > int(^uint16(0)) { - return nil, ErrBuf - } - // Adjust sig data length - rdoff := len(mbuf) + 1 + 2 + 2 + 4 - rdlen := binary.BigEndian.Uint16(buf[rdoff:]) - rdlen += uint16(len(signature)) - binary.BigEndian.PutUint16(buf[rdoff:], rdlen) - // Adjust additional count - adc := binary.BigEndian.Uint16(buf[10:]) - adc++ - binary.BigEndian.PutUint16(buf[10:], adc) - return buf, nil -} - -// Verify validates the message buf using the key k. -// It's assumed that buf is a valid message from which rr was unpacked. -func (rr *SIG) Verify(k *KEY, buf []byte) error { - if k == nil { - return ErrKey - } - if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 { - return ErrKey - } - - var hash crypto.Hash - switch rr.Algorithm { - case DSA, RSASHA1: - hash = crypto.SHA1 - case RSASHA256, ECDSAP256SHA256: - hash = crypto.SHA256 - case ECDSAP384SHA384: - hash = crypto.SHA384 - case RSASHA512: - hash = crypto.SHA512 - default: - return ErrAlg - } - hasher := hash.New() - - buflen := len(buf) - qdc := binary.BigEndian.Uint16(buf[4:]) - anc := binary.BigEndian.Uint16(buf[6:]) - auc := binary.BigEndian.Uint16(buf[8:]) - adc := binary.BigEndian.Uint16(buf[10:]) - offset := headerSize - var err error - for i := uint16(0); i < qdc && offset < buflen; i++ { - _, offset, err = UnpackDomainName(buf, offset) - if err != nil { - return err - } - // Skip past Type and Class - offset += 2 + 2 - } - for i := uint16(1); i < anc+auc+adc && offset < buflen; i++ { - _, offset, err = UnpackDomainName(buf, offset) - if err != nil { - return err - } - // Skip past Type, Class and TTL - offset += 2 + 2 + 4 - if offset+1 >= buflen { - continue - } - rdlen := binary.BigEndian.Uint16(buf[offset:]) - offset += 2 - offset += int(rdlen) - } - if offset >= buflen { - return &Error{err: "overflowing unpacking signed message"} - } - - // offset should be just prior to SIG - bodyend := offset - // owner name SHOULD be root - _, offset, err = UnpackDomainName(buf, offset) - if err != nil { - return err - } - // Skip Type, Class, TTL, RDLen - offset += 2 + 2 + 4 + 2 - sigstart := offset - // Skip Type Covered, Algorithm, Labels, Original TTL - offset += 2 + 1 + 1 + 4 - if offset+4+4 >= buflen { - return &Error{err: "overflow unpacking signed message"} - } - expire := binary.BigEndian.Uint32(buf[offset:]) - offset += 4 - incept := binary.BigEndian.Uint32(buf[offset:]) - offset += 4 - now := uint32(time.Now().Unix()) - if now < incept || now > expire { - return ErrTime - } - // Skip key tag - offset += 2 - var signername string - signername, offset, err = UnpackDomainName(buf, offset) - if err != nil { - return err - } - // If key has come from the DNS name compression might - // have mangled the case of the name - if !strings.EqualFold(signername, k.Header().Name) { - return &Error{err: "signer name doesn't match key name"} - } - sigend := offset - hasher.Write(buf[sigstart:sigend]) - hasher.Write(buf[:10]) - hasher.Write([]byte{ - byte((adc - 1) << 8), - byte(adc - 1), - }) - hasher.Write(buf[12:bodyend]) - - hashed := hasher.Sum(nil) - sig := buf[sigend:] - switch k.Algorithm { - case DSA: - pk := k.publicKeyDSA() - sig = sig[1:] - r := new(big.Int).SetBytes(sig[:len(sig)/2]) - s := new(big.Int).SetBytes(sig[len(sig)/2:]) - if pk != nil { - if dsa.Verify(pk, hashed, r, s) { - return nil - } - return ErrSig - } - case RSASHA1, RSASHA256, RSASHA512: - pk := k.publicKeyRSA() - if pk != nil { - return rsa.VerifyPKCS1v15(pk, hash, hashed, sig) - } - case ECDSAP256SHA256, ECDSAP384SHA384: - pk := k.publicKeyECDSA() - r := new(big.Int).SetBytes(sig[:len(sig)/2]) - s := new(big.Int).SetBytes(sig[len(sig)/2:]) - if pk != nil { - if ecdsa.Verify(pk, hashed, r, s) { - return nil - } - return ErrSig - } - } - return ErrKeyAlg -} diff --git a/vendor/github.com/miekg/dns/singleinflight.go b/vendor/github.com/miekg/dns/singleinflight.go deleted file mode 100644 index febcc300..00000000 --- a/vendor/github.com/miekg/dns/singleinflight.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2013 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. - -// Adapted for dns package usage by Miek Gieben. - -package dns - -import "sync" -import "time" - -// call is an in-flight or completed singleflight.Do call -type call struct { - wg sync.WaitGroup - val *Msg - rtt time.Duration - err error - dups int -} - -// singleflight represents a class of work and forms a namespace in -// which units of work can be executed with duplicate suppression. -type singleflight struct { - sync.Mutex // protects m - m map[string]*call // lazily initialized - - dontDeleteForTesting bool // this is only to be used by TestConcurrentExchanges -} - -// Do executes and returns the results of the given function, making -// sure that only one execution is in-flight for a given key at a -// time. If a duplicate comes in, the duplicate caller waits for the -// original to complete and receives the same results. -// The return value shared indicates whether v was given to multiple callers. -func (g *singleflight) Do(key string, fn func() (*Msg, time.Duration, error)) (v *Msg, rtt time.Duration, err error, shared bool) { - g.Lock() - if g.m == nil { - g.m = make(map[string]*call) - } - if c, ok := g.m[key]; ok { - c.dups++ - g.Unlock() - c.wg.Wait() - return c.val, c.rtt, c.err, true - } - c := new(call) - c.wg.Add(1) - g.m[key] = c - g.Unlock() - - c.val, c.rtt, c.err = fn() - c.wg.Done() - - if !g.dontDeleteForTesting { - g.Lock() - delete(g.m, key) - g.Unlock() - } - - return c.val, c.rtt, c.err, c.dups > 0 -} diff --git a/vendor/github.com/miekg/dns/smimea.go b/vendor/github.com/miekg/dns/smimea.go deleted file mode 100644 index 89f09f0d..00000000 --- a/vendor/github.com/miekg/dns/smimea.go +++ /dev/null @@ -1,44 +0,0 @@ -package dns - -import ( - "crypto/sha256" - "crypto/x509" - "encoding/hex" -) - -// Sign creates a SMIMEA record from an SSL certificate. -func (r *SMIMEA) Sign(usage, selector, matchingType int, cert *x509.Certificate) (err error) { - r.Hdr.Rrtype = TypeSMIMEA - r.Usage = uint8(usage) - r.Selector = uint8(selector) - r.MatchingType = uint8(matchingType) - - r.Certificate, err = CertificateToDANE(r.Selector, r.MatchingType, cert) - return err -} - -// Verify verifies a SMIMEA record against an SSL certificate. If it is OK -// a nil error is returned. -func (r *SMIMEA) Verify(cert *x509.Certificate) error { - c, err := CertificateToDANE(r.Selector, r.MatchingType, cert) - if err != nil { - return err // Not also ErrSig? - } - if r.Certificate == c { - return nil - } - return ErrSig // ErrSig, really? -} - -// SMIMEAName returns the ownername of a SMIMEA resource record as per the -// format specified in RFC 'draft-ietf-dane-smime-12' Section 2 and 3 -func SMIMEAName(email, domain string) (string, error) { - hasher := sha256.New() - hasher.Write([]byte(email)) - - // RFC Section 3: "The local-part is hashed using the SHA2-256 - // algorithm with the hash truncated to 28 octets and - // represented in its hexadecimal representation to become the - // left-most label in the prepared domain name" - return hex.EncodeToString(hasher.Sum(nil)[:28]) + "." + "_smimecert." + domain, nil -} diff --git a/vendor/github.com/miekg/dns/tlsa.go b/vendor/github.com/miekg/dns/tlsa.go deleted file mode 100644 index 4e07983b..00000000 --- a/vendor/github.com/miekg/dns/tlsa.go +++ /dev/null @@ -1,44 +0,0 @@ -package dns - -import ( - "crypto/x509" - "net" - "strconv" -) - -// Sign creates a TLSA record from an SSL certificate. -func (r *TLSA) Sign(usage, selector, matchingType int, cert *x509.Certificate) (err error) { - r.Hdr.Rrtype = TypeTLSA - r.Usage = uint8(usage) - r.Selector = uint8(selector) - r.MatchingType = uint8(matchingType) - - r.Certificate, err = CertificateToDANE(r.Selector, r.MatchingType, cert) - return err -} - -// Verify verifies a TLSA record against an SSL certificate. If it is OK -// a nil error is returned. -func (r *TLSA) Verify(cert *x509.Certificate) error { - c, err := CertificateToDANE(r.Selector, r.MatchingType, cert) - if err != nil { - return err // Not also ErrSig? - } - if r.Certificate == c { - return nil - } - return ErrSig // ErrSig, really? -} - -// TLSAName returns the ownername of a TLSA resource record as per the -// rules specified in RFC 6698, Section 3. -func TLSAName(name, service, network string) (string, error) { - if !IsFqdn(name) { - return "", ErrFqdn - } - p, err := net.LookupPort(network, service) - if err != nil { - return "", err - } - return "_" + strconv.Itoa(p) + "._" + network + "." + name, nil -} diff --git a/vendor/github.com/miekg/dns/tsig.go b/vendor/github.com/miekg/dns/tsig.go deleted file mode 100644 index 2c4ef03b..00000000 --- a/vendor/github.com/miekg/dns/tsig.go +++ /dev/null @@ -1,389 +0,0 @@ -package dns - -import ( - "crypto/hmac" - "crypto/md5" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "encoding/binary" - "encoding/hex" - "hash" - "strconv" - "strings" - "time" -) - -// HMAC hashing codes. These are transmitted as domain names. -const ( - HmacMD5 = "hmac-md5.sig-alg.reg.int." - HmacSHA1 = "hmac-sha1." - HmacSHA256 = "hmac-sha256." - HmacSHA512 = "hmac-sha512." -) - -// TSIG is the RR the holds the transaction signature of a message. -// See RFC 2845 and RFC 4635. -type TSIG struct { - Hdr RR_Header - Algorithm string `dns:"domain-name"` - TimeSigned uint64 `dns:"uint48"` - Fudge uint16 - MACSize uint16 - MAC string `dns:"size-hex:MACSize"` - OrigId uint16 - Error uint16 - OtherLen uint16 - OtherData string `dns:"size-hex:OtherLen"` -} - -// TSIG has no official presentation format, but this will suffice. - -func (rr *TSIG) String() string { - s := "\n;; TSIG PSEUDOSECTION:\n" - s += rr.Hdr.String() + - " " + rr.Algorithm + - " " + tsigTimeToString(rr.TimeSigned) + - " " + strconv.Itoa(int(rr.Fudge)) + - " " + strconv.Itoa(int(rr.MACSize)) + - " " + strings.ToUpper(rr.MAC) + - " " + strconv.Itoa(int(rr.OrigId)) + - " " + strconv.Itoa(int(rr.Error)) + // BIND prints NOERROR - " " + strconv.Itoa(int(rr.OtherLen)) + - " " + rr.OtherData - return s -} - -func (rr *TSIG) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on TSIG") -} - -// The following values must be put in wireformat, so that the MAC can be calculated. -// RFC 2845, section 3.4.2. TSIG Variables. -type tsigWireFmt struct { - // From RR_Header - Name string `dns:"domain-name"` - Class uint16 - Ttl uint32 - // Rdata of the TSIG - Algorithm string `dns:"domain-name"` - TimeSigned uint64 `dns:"uint48"` - Fudge uint16 - // MACSize, MAC and OrigId excluded - Error uint16 - OtherLen uint16 - OtherData string `dns:"size-hex:OtherLen"` -} - -// If we have the MAC use this type to convert it to wiredata. Section 3.4.3. Request MAC -type macWireFmt struct { - MACSize uint16 - MAC string `dns:"size-hex:MACSize"` -} - -// 3.3. Time values used in TSIG calculations -type timerWireFmt struct { - TimeSigned uint64 `dns:"uint48"` - Fudge uint16 -} - -// TsigGenerate fills out the TSIG record attached to the message. -// The message should contain -// a "stub" TSIG RR with the algorithm, key name (owner name of the RR), -// time fudge (defaults to 300 seconds) and the current time -// The TSIG MAC is saved in that Tsig RR. -// When TsigGenerate is called for the first time requestMAC is set to the empty string and -// timersOnly is false. -// If something goes wrong an error is returned, otherwise it is nil. -func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, string, error) { - if m.IsTsig() == nil { - panic("dns: TSIG not last RR in additional") - } - // If we barf here, the caller is to blame - rawsecret, err := fromBase64([]byte(secret)) - if err != nil { - return nil, "", err - } - - rr := m.Extra[len(m.Extra)-1].(*TSIG) - m.Extra = m.Extra[0 : len(m.Extra)-1] // kill the TSIG from the msg - mbuf, err := m.Pack() - if err != nil { - return nil, "", err - } - buf := tsigBuffer(mbuf, rr, requestMAC, timersOnly) - - t := new(TSIG) - var h hash.Hash - switch strings.ToLower(rr.Algorithm) { - case HmacMD5: - h = hmac.New(md5.New, rawsecret) - case HmacSHA1: - h = hmac.New(sha1.New, rawsecret) - case HmacSHA256: - h = hmac.New(sha256.New, rawsecret) - case HmacSHA512: - h = hmac.New(sha512.New, rawsecret) - default: - return nil, "", ErrKeyAlg - } - h.Write(buf) - t.MAC = hex.EncodeToString(h.Sum(nil)) - t.MACSize = uint16(len(t.MAC) / 2) // Size is half! - - t.Hdr = RR_Header{Name: rr.Hdr.Name, Rrtype: TypeTSIG, Class: ClassANY, Ttl: 0} - t.Fudge = rr.Fudge - t.TimeSigned = rr.TimeSigned - t.Algorithm = rr.Algorithm - t.OrigId = m.Id - - tbuf := make([]byte, Len(t)) - off, err := PackRR(t, tbuf, 0, nil, false) - if err != nil { - return nil, "", err - } - mbuf = append(mbuf, tbuf[:off]...) - // Update the ArCount directly in the buffer. - binary.BigEndian.PutUint16(mbuf[10:], uint16(len(m.Extra)+1)) - - return mbuf, t.MAC, nil -} - -// TsigVerify verifies the TSIG on a message. -// If the signature does not validate err contains the -// error, otherwise it is nil. -func TsigVerify(msg []byte, secret, requestMAC string, timersOnly bool) error { - rawsecret, err := fromBase64([]byte(secret)) - if err != nil { - return err - } - // Strip the TSIG from the incoming msg - stripped, tsig, err := stripTsig(msg) - if err != nil { - return err - } - - msgMAC, err := hex.DecodeString(tsig.MAC) - if err != nil { - return err - } - - buf := tsigBuffer(stripped, tsig, requestMAC, timersOnly) - - // Fudge factor works both ways. A message can arrive before it was signed because - // of clock skew. - now := uint64(time.Now().Unix()) - ti := now - tsig.TimeSigned - if now < tsig.TimeSigned { - ti = tsig.TimeSigned - now - } - if uint64(tsig.Fudge) < ti { - return ErrTime - } - - var h hash.Hash - switch strings.ToLower(tsig.Algorithm) { - case HmacMD5: - h = hmac.New(md5.New, rawsecret) - case HmacSHA1: - h = hmac.New(sha1.New, rawsecret) - case HmacSHA256: - h = hmac.New(sha256.New, rawsecret) - case HmacSHA512: - h = hmac.New(sha512.New, rawsecret) - default: - return ErrKeyAlg - } - h.Write(buf) - if !hmac.Equal(h.Sum(nil), msgMAC) { - return ErrSig - } - return nil -} - -// Create a wiredata buffer for the MAC calculation. -func tsigBuffer(msgbuf []byte, rr *TSIG, requestMAC string, timersOnly bool) []byte { - var buf []byte - if rr.TimeSigned == 0 { - rr.TimeSigned = uint64(time.Now().Unix()) - } - if rr.Fudge == 0 { - rr.Fudge = 300 // Standard (RFC) default. - } - - // Replace message ID in header with original ID from TSIG - binary.BigEndian.PutUint16(msgbuf[0:2], rr.OrigId) - - if requestMAC != "" { - m := new(macWireFmt) - m.MACSize = uint16(len(requestMAC) / 2) - m.MAC = requestMAC - buf = make([]byte, len(requestMAC)) // long enough - n, _ := packMacWire(m, buf) - buf = buf[:n] - } - - tsigvar := make([]byte, DefaultMsgSize) - if timersOnly { - tsig := new(timerWireFmt) - tsig.TimeSigned = rr.TimeSigned - tsig.Fudge = rr.Fudge - n, _ := packTimerWire(tsig, tsigvar) - tsigvar = tsigvar[:n] - } else { - tsig := new(tsigWireFmt) - tsig.Name = strings.ToLower(rr.Hdr.Name) - tsig.Class = ClassANY - tsig.Ttl = rr.Hdr.Ttl - tsig.Algorithm = strings.ToLower(rr.Algorithm) - tsig.TimeSigned = rr.TimeSigned - tsig.Fudge = rr.Fudge - tsig.Error = rr.Error - tsig.OtherLen = rr.OtherLen - tsig.OtherData = rr.OtherData - n, _ := packTsigWire(tsig, tsigvar) - tsigvar = tsigvar[:n] - } - - if requestMAC != "" { - x := append(buf, msgbuf...) - buf = append(x, tsigvar...) - } else { - buf = append(msgbuf, tsigvar...) - } - return buf -} - -// Strip the TSIG from the raw message. -func stripTsig(msg []byte) ([]byte, *TSIG, error) { - // Copied from msg.go's Unpack() Header, but modified. - var ( - dh Header - err error - ) - off, tsigoff := 0, 0 - - if dh, off, err = unpackMsgHdr(msg, off); err != nil { - return nil, nil, err - } - if dh.Arcount == 0 { - return nil, nil, ErrNoSig - } - - // Rcode, see msg.go Unpack() - if int(dh.Bits&0xF) == RcodeNotAuth { - return nil, nil, ErrAuth - } - - for i := 0; i < int(dh.Qdcount); i++ { - _, off, err = unpackQuestion(msg, off) - if err != nil { - return nil, nil, err - } - } - - _, off, err = unpackRRslice(int(dh.Ancount), msg, off) - if err != nil { - return nil, nil, err - } - _, off, err = unpackRRslice(int(dh.Nscount), msg, off) - if err != nil { - return nil, nil, err - } - - rr := new(TSIG) - var extra RR - for i := 0; i < int(dh.Arcount); i++ { - tsigoff = off - extra, off, err = UnpackRR(msg, off) - if err != nil { - return nil, nil, err - } - if extra.Header().Rrtype == TypeTSIG { - rr = extra.(*TSIG) - // Adjust Arcount. - arcount := binary.BigEndian.Uint16(msg[10:]) - binary.BigEndian.PutUint16(msg[10:], arcount-1) - break - } - } - if rr == nil { - return nil, nil, ErrNoSig - } - return msg[:tsigoff], rr, nil -} - -// Translate the TSIG time signed into a date. There is no -// need for RFC1982 calculations as this date is 48 bits. -func tsigTimeToString(t uint64) string { - ti := time.Unix(int64(t), 0).UTC() - return ti.Format("20060102150405") -} - -func packTsigWire(tw *tsigWireFmt, msg []byte) (int, error) { - // copied from zmsg.go TSIG packing - // RR_Header - off, err := PackDomainName(tw.Name, msg, 0, nil, false) - if err != nil { - return off, err - } - off, err = packUint16(tw.Class, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(tw.Ttl, msg, off) - if err != nil { - return off, err - } - - off, err = PackDomainName(tw.Algorithm, msg, off, nil, false) - if err != nil { - return off, err - } - off, err = packUint48(tw.TimeSigned, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(tw.Fudge, msg, off) - if err != nil { - return off, err - } - - off, err = packUint16(tw.Error, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(tw.OtherLen, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(tw.OtherData, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func packMacWire(mw *macWireFmt, msg []byte) (int, error) { - off, err := packUint16(mw.MACSize, msg, 0) - if err != nil { - return off, err - } - off, err = packStringHex(mw.MAC, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func packTimerWire(tw *timerWireFmt, msg []byte) (int, error) { - off, err := packUint48(tw.TimeSigned, msg, 0) - if err != nil { - return off, err - } - off, err = packUint16(tw.Fudge, msg, off) - if err != nil { - return off, err - } - return off, nil -} diff --git a/vendor/github.com/miekg/dns/types.go b/vendor/github.com/miekg/dns/types.go deleted file mode 100644 index 6f79038b..00000000 --- a/vendor/github.com/miekg/dns/types.go +++ /dev/null @@ -1,1413 +0,0 @@ -package dns - -import ( - "fmt" - "net" - "strconv" - "strings" - "time" -) - -type ( - // Type is a DNS type. - Type uint16 - // Class is a DNS class. - Class uint16 - // Name is a DNS domain name. - Name string -) - -// Packet formats - -// Wire constants and supported types. -const ( - // valid RR_Header.Rrtype and Question.qtype - - TypeNone uint16 = 0 - TypeA uint16 = 1 - TypeNS uint16 = 2 - TypeMD uint16 = 3 - TypeMF uint16 = 4 - TypeCNAME uint16 = 5 - TypeSOA uint16 = 6 - TypeMB uint16 = 7 - TypeMG uint16 = 8 - TypeMR uint16 = 9 - TypeNULL uint16 = 10 - TypePTR uint16 = 12 - TypeHINFO uint16 = 13 - TypeMINFO uint16 = 14 - TypeMX uint16 = 15 - TypeTXT uint16 = 16 - TypeRP uint16 = 17 - TypeAFSDB uint16 = 18 - TypeX25 uint16 = 19 - TypeISDN uint16 = 20 - TypeRT uint16 = 21 - TypeNSAPPTR uint16 = 23 - TypeSIG uint16 = 24 - TypeKEY uint16 = 25 - TypePX uint16 = 26 - TypeGPOS uint16 = 27 - TypeAAAA uint16 = 28 - TypeLOC uint16 = 29 - TypeNXT uint16 = 30 - TypeEID uint16 = 31 - TypeNIMLOC uint16 = 32 - TypeSRV uint16 = 33 - TypeATMA uint16 = 34 - TypeNAPTR uint16 = 35 - TypeKX uint16 = 36 - TypeCERT uint16 = 37 - TypeDNAME uint16 = 39 - TypeOPT uint16 = 41 // EDNS - TypeDS uint16 = 43 - TypeSSHFP uint16 = 44 - TypeRRSIG uint16 = 46 - TypeNSEC uint16 = 47 - TypeDNSKEY uint16 = 48 - TypeDHCID uint16 = 49 - TypeNSEC3 uint16 = 50 - TypeNSEC3PARAM uint16 = 51 - TypeTLSA uint16 = 52 - TypeSMIMEA uint16 = 53 - TypeHIP uint16 = 55 - TypeNINFO uint16 = 56 - TypeRKEY uint16 = 57 - TypeTALINK uint16 = 58 - TypeCDS uint16 = 59 - TypeCDNSKEY uint16 = 60 - TypeOPENPGPKEY uint16 = 61 - TypeCSYNC uint16 = 62 - TypeSPF uint16 = 99 - TypeUINFO uint16 = 100 - TypeUID uint16 = 101 - TypeGID uint16 = 102 - TypeUNSPEC uint16 = 103 - TypeNID uint16 = 104 - TypeL32 uint16 = 105 - TypeL64 uint16 = 106 - TypeLP uint16 = 107 - TypeEUI48 uint16 = 108 - TypeEUI64 uint16 = 109 - TypeURI uint16 = 256 - TypeCAA uint16 = 257 - TypeAVC uint16 = 258 - - TypeTKEY uint16 = 249 - TypeTSIG uint16 = 250 - - // valid Question.Qtype only - TypeIXFR uint16 = 251 - TypeAXFR uint16 = 252 - TypeMAILB uint16 = 253 - TypeMAILA uint16 = 254 - TypeANY uint16 = 255 - - TypeTA uint16 = 32768 - TypeDLV uint16 = 32769 - TypeReserved uint16 = 65535 - - // valid Question.Qclass - ClassINET = 1 - ClassCSNET = 2 - ClassCHAOS = 3 - ClassHESIOD = 4 - ClassNONE = 254 - ClassANY = 255 - - // Message Response Codes, see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml - RcodeSuccess = 0 // NoError - No Error [DNS] - RcodeFormatError = 1 // FormErr - Format Error [DNS] - RcodeServerFailure = 2 // ServFail - Server Failure [DNS] - RcodeNameError = 3 // NXDomain - Non-Existent Domain [DNS] - RcodeNotImplemented = 4 // NotImp - Not Implemented [DNS] - RcodeRefused = 5 // Refused - Query Refused [DNS] - RcodeYXDomain = 6 // YXDomain - Name Exists when it should not [DNS Update] - RcodeYXRrset = 7 // YXRRSet - RR Set Exists when it should not [DNS Update] - RcodeNXRrset = 8 // NXRRSet - RR Set that should exist does not [DNS Update] - RcodeNotAuth = 9 // NotAuth - Server Not Authoritative for zone [DNS Update] - RcodeNotZone = 10 // NotZone - Name not contained in zone [DNS Update/TSIG] - RcodeBadSig = 16 // BADSIG - TSIG Signature Failure [TSIG] - RcodeBadVers = 16 // BADVERS - Bad OPT Version [EDNS0] - RcodeBadKey = 17 // BADKEY - Key not recognized [TSIG] - RcodeBadTime = 18 // BADTIME - Signature out of time window [TSIG] - RcodeBadMode = 19 // BADMODE - Bad TKEY Mode [TKEY] - RcodeBadName = 20 // BADNAME - Duplicate key name [TKEY] - RcodeBadAlg = 21 // BADALG - Algorithm not supported [TKEY] - RcodeBadTrunc = 22 // BADTRUNC - Bad Truncation [TSIG] - RcodeBadCookie = 23 // BADCOOKIE - Bad/missing Server Cookie [DNS Cookies] - - // Message Opcodes. There is no 3. - OpcodeQuery = 0 - OpcodeIQuery = 1 - OpcodeStatus = 2 - OpcodeNotify = 4 - OpcodeUpdate = 5 -) - -// Header is the wire format for the DNS packet header. -type Header struct { - Id uint16 - Bits uint16 - Qdcount, Ancount, Nscount, Arcount uint16 -} - -const ( - headerSize = 12 - - // Header.Bits - _QR = 1 << 15 // query/response (response=1) - _AA = 1 << 10 // authoritative - _TC = 1 << 9 // truncated - _RD = 1 << 8 // recursion desired - _RA = 1 << 7 // recursion available - _Z = 1 << 6 // Z - _AD = 1 << 5 // authticated data - _CD = 1 << 4 // checking disabled -) - -// Various constants used in the LOC RR, See RFC 1887. -const ( - LOC_EQUATOR = 1 << 31 // RFC 1876, Section 2. - LOC_PRIMEMERIDIAN = 1 << 31 // RFC 1876, Section 2. - LOC_HOURS = 60 * 1000 - LOC_DEGREES = 60 * LOC_HOURS - LOC_ALTITUDEBASE = 100000 -) - -// Different Certificate Types, see RFC 4398, Section 2.1 -const ( - CertPKIX = 1 + iota - CertSPKI - CertPGP - CertIPIX - CertISPKI - CertIPGP - CertACPKIX - CertIACPKIX - CertURI = 253 - CertOID = 254 -) - -// CertTypeToString converts the Cert Type to its string representation. -// See RFC 4398 and RFC 6944. -var CertTypeToString = map[uint16]string{ - CertPKIX: "PKIX", - CertSPKI: "SPKI", - CertPGP: "PGP", - CertIPIX: "IPIX", - CertISPKI: "ISPKI", - CertIPGP: "IPGP", - CertACPKIX: "ACPKIX", - CertIACPKIX: "IACPKIX", - CertURI: "URI", - CertOID: "OID", -} - -//go:generate go run types_generate.go - -// Question holds a DNS question. There can be multiple questions in the -// question section of a message. Usually there is just one. -type Question struct { - Name string `dns:"cdomain-name"` // "cdomain-name" specifies encoding (and may be compressed) - Qtype uint16 - Qclass uint16 -} - -func (q *Question) len(off int, compression map[string]struct{}) int { - l := domainNameLen(q.Name, off, compression, true) - l += 2 + 2 - return l -} - -func (q *Question) String() (s string) { - // prefix with ; (as in dig) - s = ";" + sprintName(q.Name) + "\t" - s += Class(q.Qclass).String() + "\t" - s += " " + Type(q.Qtype).String() - return s -} - -// ANY is a wildcard record. See RFC 1035, Section 3.2.3. ANY -// is named "*" there. -type ANY struct { - Hdr RR_Header - // Does not have any rdata -} - -func (rr *ANY) String() string { return rr.Hdr.String() } - -func (rr *ANY) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on ANY") -} - -// NULL RR. See RFC 1035. -type NULL struct { - Hdr RR_Header - Data string `dns:"any"` -} - -func (rr *NULL) String() string { - // There is no presentation format; prefix string with a comment. - return ";" + rr.Hdr.String() + rr.Data -} - -func (rr *NULL) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on NULL") -} - -// CNAME RR. See RFC 1034. -type CNAME struct { - Hdr RR_Header - Target string `dns:"cdomain-name"` -} - -func (rr *CNAME) String() string { return rr.Hdr.String() + sprintName(rr.Target) } - -// HINFO RR. See RFC 1034. -type HINFO struct { - Hdr RR_Header - Cpu string - Os string -} - -func (rr *HINFO) String() string { - return rr.Hdr.String() + sprintTxt([]string{rr.Cpu, rr.Os}) -} - -// MB RR. See RFC 1035. -type MB struct { - Hdr RR_Header - Mb string `dns:"cdomain-name"` -} - -func (rr *MB) String() string { return rr.Hdr.String() + sprintName(rr.Mb) } - -// MG RR. See RFC 1035. -type MG struct { - Hdr RR_Header - Mg string `dns:"cdomain-name"` -} - -func (rr *MG) String() string { return rr.Hdr.String() + sprintName(rr.Mg) } - -// MINFO RR. See RFC 1035. -type MINFO struct { - Hdr RR_Header - Rmail string `dns:"cdomain-name"` - Email string `dns:"cdomain-name"` -} - -func (rr *MINFO) String() string { - return rr.Hdr.String() + sprintName(rr.Rmail) + " " + sprintName(rr.Email) -} - -// MR RR. See RFC 1035. -type MR struct { - Hdr RR_Header - Mr string `dns:"cdomain-name"` -} - -func (rr *MR) String() string { - return rr.Hdr.String() + sprintName(rr.Mr) -} - -// MF RR. See RFC 1035. -type MF struct { - Hdr RR_Header - Mf string `dns:"cdomain-name"` -} - -func (rr *MF) String() string { - return rr.Hdr.String() + sprintName(rr.Mf) -} - -// MD RR. See RFC 1035. -type MD struct { - Hdr RR_Header - Md string `dns:"cdomain-name"` -} - -func (rr *MD) String() string { - return rr.Hdr.String() + sprintName(rr.Md) -} - -// MX RR. See RFC 1035. -type MX struct { - Hdr RR_Header - Preference uint16 - Mx string `dns:"cdomain-name"` -} - -func (rr *MX) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + " " + sprintName(rr.Mx) -} - -// AFSDB RR. See RFC 1183. -type AFSDB struct { - Hdr RR_Header - Subtype uint16 - Hostname string `dns:"domain-name"` -} - -func (rr *AFSDB) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Subtype)) + " " + sprintName(rr.Hostname) -} - -// X25 RR. See RFC 1183, Section 3.1. -type X25 struct { - Hdr RR_Header - PSDNAddress string -} - -func (rr *X25) String() string { - return rr.Hdr.String() + rr.PSDNAddress -} - -// RT RR. See RFC 1183, Section 3.3. -type RT struct { - Hdr RR_Header - Preference uint16 - Host string `dns:"domain-name"` // RFC 3597 prohibits compressing records not defined in RFC 1035. -} - -func (rr *RT) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + " " + sprintName(rr.Host) -} - -// NS RR. See RFC 1035. -type NS struct { - Hdr RR_Header - Ns string `dns:"cdomain-name"` -} - -func (rr *NS) String() string { - return rr.Hdr.String() + sprintName(rr.Ns) -} - -// PTR RR. See RFC 1035. -type PTR struct { - Hdr RR_Header - Ptr string `dns:"cdomain-name"` -} - -func (rr *PTR) String() string { - return rr.Hdr.String() + sprintName(rr.Ptr) -} - -// RP RR. See RFC 1138, Section 2.2. -type RP struct { - Hdr RR_Header - Mbox string `dns:"domain-name"` - Txt string `dns:"domain-name"` -} - -func (rr *RP) String() string { - return rr.Hdr.String() + sprintName(rr.Mbox) + " " + sprintName(rr.Txt) -} - -// SOA RR. See RFC 1035. -type SOA struct { - Hdr RR_Header - Ns string `dns:"cdomain-name"` - Mbox string `dns:"cdomain-name"` - Serial uint32 - Refresh uint32 - Retry uint32 - Expire uint32 - Minttl uint32 -} - -func (rr *SOA) String() string { - return rr.Hdr.String() + sprintName(rr.Ns) + " " + sprintName(rr.Mbox) + - " " + strconv.FormatInt(int64(rr.Serial), 10) + - " " + strconv.FormatInt(int64(rr.Refresh), 10) + - " " + strconv.FormatInt(int64(rr.Retry), 10) + - " " + strconv.FormatInt(int64(rr.Expire), 10) + - " " + strconv.FormatInt(int64(rr.Minttl), 10) -} - -// TXT RR. See RFC 1035. -type TXT struct { - Hdr RR_Header - Txt []string `dns:"txt"` -} - -func (rr *TXT) String() string { return rr.Hdr.String() + sprintTxt(rr.Txt) } - -func sprintName(s string) string { - var dst strings.Builder - dst.Grow(len(s)) - for i := 0; i < len(s); { - if i+1 < len(s) && s[i] == '\\' && s[i+1] == '.' { - dst.WriteString(s[i : i+2]) - i += 2 - continue - } - - b, n := nextByte(s, i) - switch { - case n == 0: - i++ // dangling back slash - case b == '.': - dst.WriteByte('.') - default: - writeDomainNameByte(&dst, b) - } - i += n - } - return dst.String() -} - -func sprintTxtOctet(s string) string { - var dst strings.Builder - dst.Grow(2 + len(s)) - dst.WriteByte('"') - for i := 0; i < len(s); { - if i+1 < len(s) && s[i] == '\\' && s[i+1] == '.' { - dst.WriteString(s[i : i+2]) - i += 2 - continue - } - - b, n := nextByte(s, i) - switch { - case n == 0: - i++ // dangling back slash - case b == '.': - dst.WriteByte('.') - case b < ' ' || b > '~': - dst.WriteString(escapeByte(b)) - default: - dst.WriteByte(b) - } - i += n - } - dst.WriteByte('"') - return dst.String() -} - -func sprintTxt(txt []string) string { - var out strings.Builder - for i, s := range txt { - out.Grow(3 + len(s)) - if i > 0 { - out.WriteString(` "`) - } else { - out.WriteByte('"') - } - for j := 0; j < len(s); { - b, n := nextByte(s, j) - if n == 0 { - break - } - writeTXTStringByte(&out, b) - j += n - } - out.WriteByte('"') - } - return out.String() -} - -func writeDomainNameByte(s *strings.Builder, b byte) { - switch b { - case '.', ' ', '\'', '@', ';', '(', ')': // additional chars to escape - s.WriteByte('\\') - s.WriteByte(b) - default: - writeTXTStringByte(s, b) - } -} - -func writeTXTStringByte(s *strings.Builder, b byte) { - switch { - case b == '"' || b == '\\': - s.WriteByte('\\') - s.WriteByte(b) - case b < ' ' || b > '~': - s.WriteString(escapeByte(b)) - default: - s.WriteByte(b) - } -} - -const ( - escapedByteSmall = "" + - `\000\001\002\003\004\005\006\007\008\009` + - `\010\011\012\013\014\015\016\017\018\019` + - `\020\021\022\023\024\025\026\027\028\029` + - `\030\031` - escapedByteLarge = `\127\128\129` + - `\130\131\132\133\134\135\136\137\138\139` + - `\140\141\142\143\144\145\146\147\148\149` + - `\150\151\152\153\154\155\156\157\158\159` + - `\160\161\162\163\164\165\166\167\168\169` + - `\170\171\172\173\174\175\176\177\178\179` + - `\180\181\182\183\184\185\186\187\188\189` + - `\190\191\192\193\194\195\196\197\198\199` + - `\200\201\202\203\204\205\206\207\208\209` + - `\210\211\212\213\214\215\216\217\218\219` + - `\220\221\222\223\224\225\226\227\228\229` + - `\230\231\232\233\234\235\236\237\238\239` + - `\240\241\242\243\244\245\246\247\248\249` + - `\250\251\252\253\254\255` -) - -// escapeByte returns the \DDD escaping of b which must -// satisfy b < ' ' || b > '~'. -func escapeByte(b byte) string { - if b < ' ' { - return escapedByteSmall[b*4 : b*4+4] - } - - b -= '~' + 1 - // The cast here is needed as b*4 may overflow byte. - return escapedByteLarge[int(b)*4 : int(b)*4+4] -} - -func nextByte(s string, offset int) (byte, int) { - if offset >= len(s) { - return 0, 0 - } - if s[offset] != '\\' { - // not an escape sequence - return s[offset], 1 - } - switch len(s) - offset { - case 1: // dangling escape - return 0, 0 - case 2, 3: // too short to be \ddd - default: // maybe \ddd - if isDigit(s[offset+1]) && isDigit(s[offset+2]) && isDigit(s[offset+3]) { - return dddStringToByte(s[offset+1:]), 4 - } - } - // not \ddd, just an RFC 1035 "quoted" character - return s[offset+1], 2 -} - -// SPF RR. See RFC 4408, Section 3.1.1. -type SPF struct { - Hdr RR_Header - Txt []string `dns:"txt"` -} - -func (rr *SPF) String() string { return rr.Hdr.String() + sprintTxt(rr.Txt) } - -// AVC RR. See https://www.iana.org/assignments/dns-parameters/AVC/avc-completed-template. -type AVC struct { - Hdr RR_Header - Txt []string `dns:"txt"` -} - -func (rr *AVC) String() string { return rr.Hdr.String() + sprintTxt(rr.Txt) } - -// SRV RR. See RFC 2782. -type SRV struct { - Hdr RR_Header - Priority uint16 - Weight uint16 - Port uint16 - Target string `dns:"domain-name"` -} - -func (rr *SRV) String() string { - return rr.Hdr.String() + - strconv.Itoa(int(rr.Priority)) + " " + - strconv.Itoa(int(rr.Weight)) + " " + - strconv.Itoa(int(rr.Port)) + " " + sprintName(rr.Target) -} - -// NAPTR RR. See RFC 2915. -type NAPTR struct { - Hdr RR_Header - Order uint16 - Preference uint16 - Flags string - Service string - Regexp string - Replacement string `dns:"domain-name"` -} - -func (rr *NAPTR) String() string { - return rr.Hdr.String() + - strconv.Itoa(int(rr.Order)) + " " + - strconv.Itoa(int(rr.Preference)) + " " + - "\"" + rr.Flags + "\" " + - "\"" + rr.Service + "\" " + - "\"" + rr.Regexp + "\" " + - rr.Replacement -} - -// CERT RR. See RFC 4398. -type CERT struct { - Hdr RR_Header - Type uint16 - KeyTag uint16 - Algorithm uint8 - Certificate string `dns:"base64"` -} - -func (rr *CERT) String() string { - var ( - ok bool - certtype, algorithm string - ) - if certtype, ok = CertTypeToString[rr.Type]; !ok { - certtype = strconv.Itoa(int(rr.Type)) - } - if algorithm, ok = AlgorithmToString[rr.Algorithm]; !ok { - algorithm = strconv.Itoa(int(rr.Algorithm)) - } - return rr.Hdr.String() + certtype + - " " + strconv.Itoa(int(rr.KeyTag)) + - " " + algorithm + - " " + rr.Certificate -} - -// DNAME RR. See RFC 2672. -type DNAME struct { - Hdr RR_Header - Target string `dns:"domain-name"` -} - -func (rr *DNAME) String() string { - return rr.Hdr.String() + sprintName(rr.Target) -} - -// A RR. See RFC 1035. -type A struct { - Hdr RR_Header - A net.IP `dns:"a"` -} - -func (rr *A) String() string { - if rr.A == nil { - return rr.Hdr.String() - } - return rr.Hdr.String() + rr.A.String() -} - -// AAAA RR. See RFC 3596. -type AAAA struct { - Hdr RR_Header - AAAA net.IP `dns:"aaaa"` -} - -func (rr *AAAA) String() string { - if rr.AAAA == nil { - return rr.Hdr.String() - } - return rr.Hdr.String() + rr.AAAA.String() -} - -// PX RR. See RFC 2163. -type PX struct { - Hdr RR_Header - Preference uint16 - Map822 string `dns:"domain-name"` - Mapx400 string `dns:"domain-name"` -} - -func (rr *PX) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + " " + sprintName(rr.Map822) + " " + sprintName(rr.Mapx400) -} - -// GPOS RR. See RFC 1712. -type GPOS struct { - Hdr RR_Header - Longitude string - Latitude string - Altitude string -} - -func (rr *GPOS) String() string { - return rr.Hdr.String() + rr.Longitude + " " + rr.Latitude + " " + rr.Altitude -} - -// LOC RR. See RFC RFC 1876. -type LOC struct { - Hdr RR_Header - Version uint8 - Size uint8 - HorizPre uint8 - VertPre uint8 - Latitude uint32 - Longitude uint32 - Altitude uint32 -} - -// cmToM takes a cm value expressed in RFC1876 SIZE mantissa/exponent -// format and returns a string in m (two decimals for the cm) -func cmToM(m, e uint8) string { - if e < 2 { - if e == 1 { - m *= 10 - } - - return fmt.Sprintf("0.%02d", m) - } - - s := fmt.Sprintf("%d", m) - for e > 2 { - s += "0" - e-- - } - return s -} - -func (rr *LOC) String() string { - s := rr.Hdr.String() - - lat := rr.Latitude - ns := "N" - if lat > LOC_EQUATOR { - lat = lat - LOC_EQUATOR - } else { - ns = "S" - lat = LOC_EQUATOR - lat - } - h := lat / LOC_DEGREES - lat = lat % LOC_DEGREES - m := lat / LOC_HOURS - lat = lat % LOC_HOURS - s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, float64(lat)/1000, ns) - - lon := rr.Longitude - ew := "E" - if lon > LOC_PRIMEMERIDIAN { - lon = lon - LOC_PRIMEMERIDIAN - } else { - ew = "W" - lon = LOC_PRIMEMERIDIAN - lon - } - h = lon / LOC_DEGREES - lon = lon % LOC_DEGREES - m = lon / LOC_HOURS - lon = lon % LOC_HOURS - s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, float64(lon)/1000, ew) - - var alt = float64(rr.Altitude) / 100 - alt -= LOC_ALTITUDEBASE - if rr.Altitude%100 != 0 { - s += fmt.Sprintf("%.2fm ", alt) - } else { - s += fmt.Sprintf("%.0fm ", alt) - } - - s += cmToM(rr.Size&0xf0>>4, rr.Size&0x0f) + "m " - s += cmToM(rr.HorizPre&0xf0>>4, rr.HorizPre&0x0f) + "m " - s += cmToM(rr.VertPre&0xf0>>4, rr.VertPre&0x0f) + "m" - - return s -} - -// SIG RR. See RFC 2535. The SIG RR is identical to RRSIG and nowadays only used for SIG(0), See RFC 2931. -type SIG struct { - RRSIG -} - -// RRSIG RR. See RFC 4034 and RFC 3755. -type RRSIG struct { - Hdr RR_Header - TypeCovered uint16 - Algorithm uint8 - Labels uint8 - OrigTtl uint32 - Expiration uint32 - Inception uint32 - KeyTag uint16 - SignerName string `dns:"domain-name"` - Signature string `dns:"base64"` -} - -func (rr *RRSIG) String() string { - s := rr.Hdr.String() - s += Type(rr.TypeCovered).String() - s += " " + strconv.Itoa(int(rr.Algorithm)) + - " " + strconv.Itoa(int(rr.Labels)) + - " " + strconv.FormatInt(int64(rr.OrigTtl), 10) + - " " + TimeToString(rr.Expiration) + - " " + TimeToString(rr.Inception) + - " " + strconv.Itoa(int(rr.KeyTag)) + - " " + sprintName(rr.SignerName) + - " " + rr.Signature - return s -} - -// NSEC RR. See RFC 4034 and RFC 3755. -type NSEC struct { - Hdr RR_Header - NextDomain string `dns:"domain-name"` - TypeBitMap []uint16 `dns:"nsec"` -} - -func (rr *NSEC) String() string { - s := rr.Hdr.String() + sprintName(rr.NextDomain) - for _, t := range rr.TypeBitMap { - s += " " + Type(t).String() - } - return s -} - -func (rr *NSEC) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.NextDomain, off+l, compression, false) - l += typeBitMapLen(rr.TypeBitMap) - return l -} - -// DLV RR. See RFC 4431. -type DLV struct{ DS } - -// CDS RR. See RFC 7344. -type CDS struct{ DS } - -// DS RR. See RFC 4034 and RFC 3658. -type DS struct { - Hdr RR_Header - KeyTag uint16 - Algorithm uint8 - DigestType uint8 - Digest string `dns:"hex"` -} - -func (rr *DS) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.KeyTag)) + - " " + strconv.Itoa(int(rr.Algorithm)) + - " " + strconv.Itoa(int(rr.DigestType)) + - " " + strings.ToUpper(rr.Digest) -} - -// KX RR. See RFC 2230. -type KX struct { - Hdr RR_Header - Preference uint16 - Exchanger string `dns:"domain-name"` -} - -func (rr *KX) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + - " " + sprintName(rr.Exchanger) -} - -// TA RR. See http://www.watson.org/~weiler/INI1999-19.pdf. -type TA struct { - Hdr RR_Header - KeyTag uint16 - Algorithm uint8 - DigestType uint8 - Digest string `dns:"hex"` -} - -func (rr *TA) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.KeyTag)) + - " " + strconv.Itoa(int(rr.Algorithm)) + - " " + strconv.Itoa(int(rr.DigestType)) + - " " + strings.ToUpper(rr.Digest) -} - -// TALINK RR. See https://www.iana.org/assignments/dns-parameters/TALINK/talink-completed-template. -type TALINK struct { - Hdr RR_Header - PreviousName string `dns:"domain-name"` - NextName string `dns:"domain-name"` -} - -func (rr *TALINK) String() string { - return rr.Hdr.String() + - sprintName(rr.PreviousName) + " " + sprintName(rr.NextName) -} - -// SSHFP RR. See RFC RFC 4255. -type SSHFP struct { - Hdr RR_Header - Algorithm uint8 - Type uint8 - FingerPrint string `dns:"hex"` -} - -func (rr *SSHFP) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Algorithm)) + - " " + strconv.Itoa(int(rr.Type)) + - " " + strings.ToUpper(rr.FingerPrint) -} - -// KEY RR. See RFC RFC 2535. -type KEY struct { - DNSKEY -} - -// CDNSKEY RR. See RFC 7344. -type CDNSKEY struct { - DNSKEY -} - -// DNSKEY RR. See RFC 4034 and RFC 3755. -type DNSKEY struct { - Hdr RR_Header - Flags uint16 - Protocol uint8 - Algorithm uint8 - PublicKey string `dns:"base64"` -} - -func (rr *DNSKEY) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Flags)) + - " " + strconv.Itoa(int(rr.Protocol)) + - " " + strconv.Itoa(int(rr.Algorithm)) + - " " + rr.PublicKey -} - -// RKEY RR. See https://www.iana.org/assignments/dns-parameters/RKEY/rkey-completed-template. -type RKEY struct { - Hdr RR_Header - Flags uint16 - Protocol uint8 - Algorithm uint8 - PublicKey string `dns:"base64"` -} - -func (rr *RKEY) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Flags)) + - " " + strconv.Itoa(int(rr.Protocol)) + - " " + strconv.Itoa(int(rr.Algorithm)) + - " " + rr.PublicKey -} - -// NSAPPTR RR. See RFC 1348. -type NSAPPTR struct { - Hdr RR_Header - Ptr string `dns:"domain-name"` -} - -func (rr *NSAPPTR) String() string { return rr.Hdr.String() + sprintName(rr.Ptr) } - -// NSEC3 RR. See RFC 5155. -type NSEC3 struct { - Hdr RR_Header - Hash uint8 - Flags uint8 - Iterations uint16 - SaltLength uint8 - Salt string `dns:"size-hex:SaltLength"` - HashLength uint8 - NextDomain string `dns:"size-base32:HashLength"` - TypeBitMap []uint16 `dns:"nsec"` -} - -func (rr *NSEC3) String() string { - s := rr.Hdr.String() - s += strconv.Itoa(int(rr.Hash)) + - " " + strconv.Itoa(int(rr.Flags)) + - " " + strconv.Itoa(int(rr.Iterations)) + - " " + saltToString(rr.Salt) + - " " + rr.NextDomain - for _, t := range rr.TypeBitMap { - s += " " + Type(t).String() - } - return s -} - -func (rr *NSEC3) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1 - l += typeBitMapLen(rr.TypeBitMap) - return l -} - -// NSEC3PARAM RR. See RFC 5155. -type NSEC3PARAM struct { - Hdr RR_Header - Hash uint8 - Flags uint8 - Iterations uint16 - SaltLength uint8 - Salt string `dns:"size-hex:SaltLength"` -} - -func (rr *NSEC3PARAM) String() string { - s := rr.Hdr.String() - s += strconv.Itoa(int(rr.Hash)) + - " " + strconv.Itoa(int(rr.Flags)) + - " " + strconv.Itoa(int(rr.Iterations)) + - " " + saltToString(rr.Salt) - return s -} - -// TKEY RR. See RFC 2930. -type TKEY struct { - Hdr RR_Header - Algorithm string `dns:"domain-name"` - Inception uint32 - Expiration uint32 - Mode uint16 - Error uint16 - KeySize uint16 - Key string `dns:"size-hex:KeySize"` - OtherLen uint16 - OtherData string `dns:"size-hex:OtherLen"` -} - -// TKEY has no official presentation format, but this will suffice. -func (rr *TKEY) String() string { - s := ";" + rr.Hdr.String() + - " " + rr.Algorithm + - " " + TimeToString(rr.Inception) + - " " + TimeToString(rr.Expiration) + - " " + strconv.Itoa(int(rr.Mode)) + - " " + strconv.Itoa(int(rr.Error)) + - " " + strconv.Itoa(int(rr.KeySize)) + - " " + rr.Key + - " " + strconv.Itoa(int(rr.OtherLen)) + - " " + rr.OtherData - return s -} - -// RFC3597 represents an unknown/generic RR. See RFC 3597. -type RFC3597 struct { - Hdr RR_Header - Rdata string `dns:"hex"` -} - -func (rr *RFC3597) String() string { - // Let's call it a hack - s := rfc3597Header(rr.Hdr) - - s += "\\# " + strconv.Itoa(len(rr.Rdata)/2) + " " + rr.Rdata - return s -} - -func rfc3597Header(h RR_Header) string { - var s string - - s += sprintName(h.Name) + "\t" - s += strconv.FormatInt(int64(h.Ttl), 10) + "\t" - s += "CLASS" + strconv.Itoa(int(h.Class)) + "\t" - s += "TYPE" + strconv.Itoa(int(h.Rrtype)) + "\t" - return s -} - -// URI RR. See RFC 7553. -type URI struct { - Hdr RR_Header - Priority uint16 - Weight uint16 - Target string `dns:"octet"` -} - -func (rr *URI) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Priority)) + - " " + strconv.Itoa(int(rr.Weight)) + " " + sprintTxtOctet(rr.Target) -} - -// DHCID RR. See RFC 4701. -type DHCID struct { - Hdr RR_Header - Digest string `dns:"base64"` -} - -func (rr *DHCID) String() string { return rr.Hdr.String() + rr.Digest } - -// TLSA RR. See RFC 6698. -type TLSA struct { - Hdr RR_Header - Usage uint8 - Selector uint8 - MatchingType uint8 - Certificate string `dns:"hex"` -} - -func (rr *TLSA) String() string { - return rr.Hdr.String() + - strconv.Itoa(int(rr.Usage)) + - " " + strconv.Itoa(int(rr.Selector)) + - " " + strconv.Itoa(int(rr.MatchingType)) + - " " + rr.Certificate -} - -// SMIMEA RR. See RFC 8162. -type SMIMEA struct { - Hdr RR_Header - Usage uint8 - Selector uint8 - MatchingType uint8 - Certificate string `dns:"hex"` -} - -func (rr *SMIMEA) String() string { - s := rr.Hdr.String() + - strconv.Itoa(int(rr.Usage)) + - " " + strconv.Itoa(int(rr.Selector)) + - " " + strconv.Itoa(int(rr.MatchingType)) - - // Every Nth char needs a space on this output. If we output - // this as one giant line, we can't read it can in because in some cases - // the cert length overflows scan.maxTok (2048). - sx := splitN(rr.Certificate, 1024) // conservative value here - s += " " + strings.Join(sx, " ") - return s -} - -// HIP RR. See RFC 8005. -type HIP struct { - Hdr RR_Header - HitLength uint8 - PublicKeyAlgorithm uint8 - PublicKeyLength uint16 - Hit string `dns:"size-hex:HitLength"` - PublicKey string `dns:"size-base64:PublicKeyLength"` - RendezvousServers []string `dns:"domain-name"` -} - -func (rr *HIP) String() string { - s := rr.Hdr.String() + - strconv.Itoa(int(rr.PublicKeyAlgorithm)) + - " " + rr.Hit + - " " + rr.PublicKey - for _, d := range rr.RendezvousServers { - s += " " + sprintName(d) - } - return s -} - -// NINFO RR. See https://www.iana.org/assignments/dns-parameters/NINFO/ninfo-completed-template. -type NINFO struct { - Hdr RR_Header - ZSData []string `dns:"txt"` -} - -func (rr *NINFO) String() string { return rr.Hdr.String() + sprintTxt(rr.ZSData) } - -// NID RR. See RFC RFC 6742. -type NID struct { - Hdr RR_Header - Preference uint16 - NodeID uint64 -} - -func (rr *NID) String() string { - s := rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) - node := fmt.Sprintf("%0.16x", rr.NodeID) - s += " " + node[0:4] + ":" + node[4:8] + ":" + node[8:12] + ":" + node[12:16] - return s -} - -// L32 RR, See RFC 6742. -type L32 struct { - Hdr RR_Header - Preference uint16 - Locator32 net.IP `dns:"a"` -} - -func (rr *L32) String() string { - if rr.Locator32 == nil { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) - } - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + - " " + rr.Locator32.String() -} - -// L64 RR, See RFC 6742. -type L64 struct { - Hdr RR_Header - Preference uint16 - Locator64 uint64 -} - -func (rr *L64) String() string { - s := rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) - node := fmt.Sprintf("%0.16X", rr.Locator64) - s += " " + node[0:4] + ":" + node[4:8] + ":" + node[8:12] + ":" + node[12:16] - return s -} - -// LP RR. See RFC 6742. -type LP struct { - Hdr RR_Header - Preference uint16 - Fqdn string `dns:"domain-name"` -} - -func (rr *LP) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Preference)) + " " + sprintName(rr.Fqdn) -} - -// EUI48 RR. See RFC 7043. -type EUI48 struct { - Hdr RR_Header - Address uint64 `dns:"uint48"` -} - -func (rr *EUI48) String() string { return rr.Hdr.String() + euiToString(rr.Address, 48) } - -// EUI64 RR. See RFC 7043. -type EUI64 struct { - Hdr RR_Header - Address uint64 -} - -func (rr *EUI64) String() string { return rr.Hdr.String() + euiToString(rr.Address, 64) } - -// CAA RR. See RFC 6844. -type CAA struct { - Hdr RR_Header - Flag uint8 - Tag string - Value string `dns:"octet"` -} - -func (rr *CAA) String() string { - return rr.Hdr.String() + strconv.Itoa(int(rr.Flag)) + " " + rr.Tag + " " + sprintTxtOctet(rr.Value) -} - -// UID RR. Deprecated, IANA-Reserved. -type UID struct { - Hdr RR_Header - Uid uint32 -} - -func (rr *UID) String() string { return rr.Hdr.String() + strconv.FormatInt(int64(rr.Uid), 10) } - -// GID RR. Deprecated, IANA-Reserved. -type GID struct { - Hdr RR_Header - Gid uint32 -} - -func (rr *GID) String() string { return rr.Hdr.String() + strconv.FormatInt(int64(rr.Gid), 10) } - -// UINFO RR. Deprecated, IANA-Reserved. -type UINFO struct { - Hdr RR_Header - Uinfo string -} - -func (rr *UINFO) String() string { return rr.Hdr.String() + sprintTxt([]string{rr.Uinfo}) } - -// EID RR. See http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt. -type EID struct { - Hdr RR_Header - Endpoint string `dns:"hex"` -} - -func (rr *EID) String() string { return rr.Hdr.String() + strings.ToUpper(rr.Endpoint) } - -// NIMLOC RR. See http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt. -type NIMLOC struct { - Hdr RR_Header - Locator string `dns:"hex"` -} - -func (rr *NIMLOC) String() string { return rr.Hdr.String() + strings.ToUpper(rr.Locator) } - -// OPENPGPKEY RR. See RFC 7929. -type OPENPGPKEY struct { - Hdr RR_Header - PublicKey string `dns:"base64"` -} - -func (rr *OPENPGPKEY) String() string { return rr.Hdr.String() + rr.PublicKey } - -// CSYNC RR. See RFC 7477. -type CSYNC struct { - Hdr RR_Header - Serial uint32 - Flags uint16 - TypeBitMap []uint16 `dns:"nsec"` -} - -func (rr *CSYNC) String() string { - s := rr.Hdr.String() + strconv.FormatInt(int64(rr.Serial), 10) + " " + strconv.Itoa(int(rr.Flags)) - - for _, t := range rr.TypeBitMap { - s += " " + Type(t).String() - } - return s -} - -func (rr *CSYNC) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 4 + 2 - l += typeBitMapLen(rr.TypeBitMap) - return l -} - -// TimeToString translates the RRSIG's incep. and expir. times to the -// string representation used when printing the record. -// It takes serial arithmetic (RFC 1982) into account. -func TimeToString(t uint32) string { - mod := (int64(t)-time.Now().Unix())/year68 - 1 - if mod < 0 { - mod = 0 - } - ti := time.Unix(int64(t)-mod*year68, 0).UTC() - return ti.Format("20060102150405") -} - -// StringToTime translates the RRSIG's incep. and expir. times from -// string values like "20110403154150" to an 32 bit integer. -// It takes serial arithmetic (RFC 1982) into account. -func StringToTime(s string) (uint32, error) { - t, err := time.Parse("20060102150405", s) - if err != nil { - return 0, err - } - mod := t.Unix()/year68 - 1 - if mod < 0 { - mod = 0 - } - return uint32(t.Unix() - mod*year68), nil -} - -// saltToString converts a NSECX salt to uppercase and returns "-" when it is empty. -func saltToString(s string) string { - if len(s) == 0 { - return "-" - } - return strings.ToUpper(s) -} - -func euiToString(eui uint64, bits int) (hex string) { - switch bits { - case 64: - hex = fmt.Sprintf("%16.16x", eui) - hex = hex[0:2] + "-" + hex[2:4] + "-" + hex[4:6] + "-" + hex[6:8] + - "-" + hex[8:10] + "-" + hex[10:12] + "-" + hex[12:14] + "-" + hex[14:16] - case 48: - hex = fmt.Sprintf("%12.12x", eui) - hex = hex[0:2] + "-" + hex[2:4] + "-" + hex[4:6] + "-" + hex[6:8] + - "-" + hex[8:10] + "-" + hex[10:12] - } - return -} - -// copyIP returns a copy of ip. -func copyIP(ip net.IP) net.IP { - p := make(net.IP, len(ip)) - copy(p, ip) - return p -} - -// SplitN splits a string into N sized string chunks. -// This might become an exported function once. -func splitN(s string, n int) []string { - if len(s) < n { - return []string{s} - } - sx := []string{} - p, i := 0, n - for { - if i <= len(s) { - sx = append(sx, s[p:i]) - } else { - sx = append(sx, s[p:]) - break - - } - p, i = p+n, i+n - } - - return sx -} diff --git a/vendor/github.com/miekg/dns/types_generate.go b/vendor/github.com/miekg/dns/types_generate.go deleted file mode 100644 index 8cda2a74..00000000 --- a/vendor/github.com/miekg/dns/types_generate.go +++ /dev/null @@ -1,285 +0,0 @@ -//+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" - "strings" - "text/template" -) - -var skipLen = map[string]struct{}{ - "NSEC": {}, - "NSEC3": {}, - "OPT": {}, - "CSYNC": {}, -} - -var packageHdr = ` -// Code generated by "go run types_generate.go"; DO NOT EDIT. - -package dns - -import ( - "encoding/base64" - "net" -) - -` - -var TypeToRR = template.Must(template.New("TypeToRR").Parse(` -// TypeToRR is a map of constructors for each RR type. -var TypeToRR = map[uint16]func() RR{ -{{range .}}{{if ne . "RFC3597"}} Type{{.}}: func() RR { return new({{.}}) }, -{{end}}{{end}} } - -`)) - -var typeToString = template.Must(template.New("typeToString").Parse(` -// TypeToString is a map of strings for each RR type. -var TypeToString = map[uint16]string{ -{{range .}}{{if ne . "NSAPPTR"}} Type{{.}}: "{{.}}", -{{end}}{{end}} TypeNSAPPTR: "NSAP-PTR", -} - -`)) - -var headerFunc = template.Must(template.New("headerFunc").Parse(` -{{range .}} func (rr *{{.}}) Header() *RR_Header { return &rr.Hdr } -{{end}} - -`)) - -// getTypeStruct will take a type and the package scope, and return the -// (innermost) struct if the type is considered a RR type (currently defined as -// those structs beginning with a RR_Header, could be redefined as implementing -// the RR interface). The bool return value indicates if embedded structs were -// resolved. -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 constants like TypeX - var numberedTypes []string - for _, name := range scope.Names() { - o := scope.Lookup(name) - if o == nil || !o.Exported() { - continue - } - b, ok := o.Type().(*types.Basic) - if !ok || b.Kind() != types.Uint16 { - continue - } - if !strings.HasPrefix(o.Name(), "Type") { - continue - } - name := strings.TrimPrefix(o.Name(), "Type") - if name == "PrivateRR" { - continue - } - numberedTypes = append(numberedTypes, name) - } - - // 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" { - continue - } - - // Check if corresponding TypeX exists - if scope.Lookup("Type"+o.Name()) == nil && o.Name() != "RFC3597" { - log.Fatalf("Constant Type%s does not exist.", o.Name()) - } - - namedTypes = append(namedTypes, o.Name()) - } - - b := &bytes.Buffer{} - b.WriteString(packageHdr) - - // Generate TypeToRR - fatalIfErr(TypeToRR.Execute(b, namedTypes)) - - // Generate typeToString - fatalIfErr(typeToString.Execute(b, numberedTypes)) - - // Generate headerFunc - fatalIfErr(headerFunc.Execute(b, namedTypes)) - - // Generate len() - fmt.Fprint(b, "// len() functions\n") - for _, name := range namedTypes { - if _, ok := skipLen[name]; ok { - continue - } - o := scope.Lookup(name) - st, isEmbedded := getTypeStruct(o.Type(), scope) - if isEmbedded { - continue - } - fmt.Fprintf(b, "func (rr *%s) len(off int, compression map[string]struct{}) int {\n", name) - fmt.Fprintf(b, "l := rr.Hdr.len(off, compression)\n") - for i := 1; i < st.NumFields(); i++ { - o := func(s string) { fmt.Fprintf(b, s, st.Field(i).Name()) } - - if _, ok := st.Field(i).Type().(*types.Slice); ok { - switch st.Tag(i) { - case `dns:"-"`: - // ignored - case `dns:"cdomain-name"`: - o("for _, x := range rr.%s { l += domainNameLen(x, off+l, compression, true) }\n") - case `dns:"domain-name"`: - o("for _, x := range rr.%s { l += domainNameLen(x, off+l, compression, false) }\n") - case `dns:"txt"`: - o("for _, x := range rr.%s { l += len(x) + 1 }\n") - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - continue - } - - switch { - case st.Tag(i) == `dns:"-"`: - // ignored - case st.Tag(i) == `dns:"cdomain-name"`: - o("l += domainNameLen(rr.%s, off+l, compression, true)\n") - case st.Tag(i) == `dns:"domain-name"`: - o("l += domainNameLen(rr.%s, off+l, compression, false)\n") - case st.Tag(i) == `dns:"octet"`: - o("l += len(rr.%s)\n") - case strings.HasPrefix(st.Tag(i), `dns:"size-base64`): - fallthrough - case st.Tag(i) == `dns:"base64"`: - o("l += base64.StdEncoding.DecodedLen(len(rr.%s))\n") - case strings.HasPrefix(st.Tag(i), `dns:"size-hex:`): // this has an extra field where the length is stored - o("l += len(rr.%s)/2\n") - case st.Tag(i) == `dns:"hex"`: - o("l += len(rr.%s)/2\n") - case st.Tag(i) == `dns:"any"`: - o("l += len(rr.%s)\n") - case st.Tag(i) == `dns:"a"`: - o("if len(rr.%s) != 0 { l += net.IPv4len }\n") - case st.Tag(i) == `dns:"aaaa"`: - o("if len(rr.%s) != 0 { l += net.IPv6len }\n") - case st.Tag(i) == `dns:"txt"`: - o("for _, t := range rr.%s { l += len(t) + 1 }\n") - case st.Tag(i) == `dns:"uint48"`: - o("l += 6 // %s\n") - case st.Tag(i) == "": - switch st.Field(i).Type().(*types.Basic).Kind() { - case types.Uint8: - o("l++ // %s\n") - case types.Uint16: - o("l += 2 // %s\n") - case types.Uint32: - o("l += 4 // %s\n") - case types.Uint64: - o("l += 8 // %s\n") - case types.String: - o("l += len(rr.%s) + 1\n") - default: - log.Fatalln(name, st.Field(i).Name()) - } - default: - log.Fatalln(name, st.Field(i).Name(), st.Tag(i)) - } - } - fmt.Fprintf(b, "return l }\n") - } - - // Generate copy() - fmt.Fprint(b, "// copy() functions\n") - for _, name := range namedTypes { - o := scope.Lookup(name) - st, isEmbedded := getTypeStruct(o.Type(), scope) - if isEmbedded { - continue - } - fmt.Fprintf(b, "func (rr *%s) copy() RR {\n", name) - fields := []string{"rr.Hdr"} - for i := 1; i < st.NumFields(); i++ { - f := st.Field(i).Name() - if sl, ok := st.Field(i).Type().(*types.Slice); ok { - t := sl.Underlying().String() - t = strings.TrimPrefix(t, "[]") - if strings.Contains(t, ".") { - splits := strings.Split(t, ".") - t = splits[len(splits)-1] - } - // For the EDNS0 interface (used in the OPT RR), we need to call the copy method on each element. - if t == "EDNS0" { - fmt.Fprintf(b, "%s := make([]%s, len(rr.%s));\nfor i,e := range rr.%s {\n %s[i] = e.copy()\n}\n", - f, t, f, f, f) - fields = append(fields, f) - continue - } - fmt.Fprintf(b, "%s := make([]%s, len(rr.%s)); copy(%s, rr.%s)\n", - f, t, f, f, f) - fields = append(fields, f) - continue - } - if st.Field(i).Type().String() == "net.IP" { - fields = append(fields, "copyIP(rr."+f+")") - continue - } - fields = append(fields, "rr."+f) - } - fmt.Fprintf(b, "return &%s{%s}\n", name, strings.Join(fields, ",")) - fmt.Fprintf(b, "}\n") - } - - // gofmt - res, err := format.Source(b.Bytes()) - if err != nil { - b.WriteTo(os.Stderr) - log.Fatal(err) - } - - // write result - f, err := os.Create("ztypes.go") - fatalIfErr(err) - defer f.Close() - f.Write(res) -} - -func fatalIfErr(err error) { - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/miekg/dns/udp.go b/vendor/github.com/miekg/dns/udp.go deleted file mode 100644 index a4826ee2..00000000 --- a/vendor/github.com/miekg/dns/udp.go +++ /dev/null @@ -1,102 +0,0 @@ -// +build !windows - -package dns - -import ( - "net" - - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" -) - -// This is the required size of the OOB buffer to pass to ReadMsgUDP. -var udpOOBSize = func() int { - // We can't know whether we'll get an IPv4 control message or an - // IPv6 control message ahead of time. To get around this, we size - // the buffer equal to the largest of the two. - - oob4 := ipv4.NewControlMessage(ipv4.FlagDst | ipv4.FlagInterface) - oob6 := ipv6.NewControlMessage(ipv6.FlagDst | ipv6.FlagInterface) - - if len(oob4) > len(oob6) { - return len(oob4) - } - - return len(oob6) -}() - -// SessionUDP holds the remote address and the associated -// out-of-band data. -type SessionUDP struct { - raddr *net.UDPAddr - context []byte -} - -// RemoteAddr returns the remote network address. -func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } - -// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a -// net.UDPAddr. -func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { - oob := make([]byte, udpOOBSize) - n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob) - if err != nil { - return n, nil, err - } - return n, &SessionUDP{raddr, oob[:oobn]}, err -} - -// WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr. -func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { - oob := correctSource(session.context) - n, _, err := conn.WriteMsgUDP(b, oob, session.raddr) - return n, err -} - -func setUDPSocketOptions(conn *net.UDPConn) error { - // Try setting the flags for both families and ignore the errors unless they - // both error. - err6 := ipv6.NewPacketConn(conn).SetControlMessage(ipv6.FlagDst|ipv6.FlagInterface, true) - err4 := ipv4.NewPacketConn(conn).SetControlMessage(ipv4.FlagDst|ipv4.FlagInterface, true) - if err6 != nil && err4 != nil { - return err4 - } - return nil -} - -// parseDstFromOOB takes oob data and returns the destination IP. -func parseDstFromOOB(oob []byte) net.IP { - // Start with IPv6 and then fallback to IPv4 - // TODO(fastest963): Figure out a way to prefer one or the other. Looking at - // the lvl of the header for a 0 or 41 isn't cross-platform. - cm6 := new(ipv6.ControlMessage) - if cm6.Parse(oob) == nil && cm6.Dst != nil { - return cm6.Dst - } - cm4 := new(ipv4.ControlMessage) - if cm4.Parse(oob) == nil && cm4.Dst != nil { - return cm4.Dst - } - return nil -} - -// correctSource takes oob data and returns new oob data with the Src equal to the Dst -func correctSource(oob []byte) []byte { - dst := parseDstFromOOB(oob) - if dst == nil { - return nil - } - // If the dst is definitely an IPv6, then use ipv6's ControlMessage to - // respond otherwise use ipv4's because ipv6's marshal ignores ipv4 - // addresses. - if dst.To4() == nil { - cm := new(ipv6.ControlMessage) - cm.Src = dst - oob = cm.Marshal() - } else { - cm := new(ipv4.ControlMessage) - cm.Src = dst - oob = cm.Marshal() - } - return oob -} diff --git a/vendor/github.com/miekg/dns/udp_windows.go b/vendor/github.com/miekg/dns/udp_windows.go deleted file mode 100644 index e7dd8ca3..00000000 --- a/vendor/github.com/miekg/dns/udp_windows.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build windows - -package dns - -import "net" - -// SessionUDP holds the remote address -type SessionUDP struct { - raddr *net.UDPAddr -} - -// RemoteAddr returns the remote network address. -func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } - -// ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a -// net.UDPAddr. -// TODO(fastest963): Once go1.10 is released, use ReadMsgUDP. -func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { - n, raddr, err := conn.ReadFrom(b) - if err != nil { - return n, nil, err - } - return n, &SessionUDP{raddr.(*net.UDPAddr)}, err -} - -// WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr. -// TODO(fastest963): Once go1.10 is released, use WriteMsgUDP. -func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { - return conn.WriteTo(b, session.raddr) -} - -// TODO(fastest963): Once go1.10 is released and we can use *MsgUDP methods -// use the standard method in udp.go for these. -func setUDPSocketOptions(*net.UDPConn) error { return nil } -func parseDstFromOOB([]byte, net.IP) net.IP { return nil } diff --git a/vendor/github.com/miekg/dns/update.go b/vendor/github.com/miekg/dns/update.go deleted file mode 100644 index 69dd3865..00000000 --- a/vendor/github.com/miekg/dns/update.go +++ /dev/null @@ -1,110 +0,0 @@ -package dns - -// NameUsed sets the RRs in the prereq section to -// "Name is in use" RRs. RFC 2136 section 2.4.4. -func (u *Msg) NameUsed(rr []RR) { - if u.Answer == nil { - u.Answer = make([]RR, 0, len(rr)) - } - for _, r := range rr { - u.Answer = append(u.Answer, &ANY{Hdr: RR_Header{Name: r.Header().Name, Ttl: 0, Rrtype: TypeANY, Class: ClassANY}}) - } -} - -// NameNotUsed sets the RRs in the prereq section to -// "Name is in not use" RRs. RFC 2136 section 2.4.5. -func (u *Msg) NameNotUsed(rr []RR) { - if u.Answer == nil { - u.Answer = make([]RR, 0, len(rr)) - } - for _, r := range rr { - u.Answer = append(u.Answer, &ANY{Hdr: RR_Header{Name: r.Header().Name, Ttl: 0, Rrtype: TypeANY, Class: ClassNONE}}) - } -} - -// Used sets the RRs in the prereq section to -// "RRset exists (value dependent -- with rdata)" RRs. RFC 2136 section 2.4.2. -func (u *Msg) Used(rr []RR) { - if len(u.Question) == 0 { - panic("dns: empty question section") - } - if u.Answer == nil { - u.Answer = make([]RR, 0, len(rr)) - } - for _, r := range rr { - r.Header().Class = u.Question[0].Qclass - u.Answer = append(u.Answer, r) - } -} - -// RRsetUsed sets the RRs in the prereq section to -// "RRset exists (value independent -- no rdata)" RRs. RFC 2136 section 2.4.1. -func (u *Msg) RRsetUsed(rr []RR) { - if u.Answer == nil { - u.Answer = make([]RR, 0, len(rr)) - } - for _, r := range rr { - h := r.Header() - u.Answer = append(u.Answer, &ANY{Hdr: RR_Header{Name: h.Name, Ttl: 0, Rrtype: h.Rrtype, Class: ClassANY}}) - } -} - -// RRsetNotUsed sets the RRs in the prereq section to -// "RRset does not exist" RRs. RFC 2136 section 2.4.3. -func (u *Msg) RRsetNotUsed(rr []RR) { - if u.Answer == nil { - u.Answer = make([]RR, 0, len(rr)) - } - for _, r := range rr { - h := r.Header() - u.Answer = append(u.Answer, &ANY{Hdr: RR_Header{Name: h.Name, Ttl: 0, Rrtype: h.Rrtype, Class: ClassNONE}}) - } -} - -// Insert creates a dynamic update packet that adds an complete RRset, see RFC 2136 section 2.5.1. -func (u *Msg) Insert(rr []RR) { - if len(u.Question) == 0 { - panic("dns: empty question section") - } - if u.Ns == nil { - u.Ns = make([]RR, 0, len(rr)) - } - for _, r := range rr { - r.Header().Class = u.Question[0].Qclass - u.Ns = append(u.Ns, r) - } -} - -// RemoveRRset creates a dynamic update packet that deletes an RRset, see RFC 2136 section 2.5.2. -func (u *Msg) RemoveRRset(rr []RR) { - if u.Ns == nil { - u.Ns = make([]RR, 0, len(rr)) - } - for _, r := range rr { - h := r.Header() - u.Ns = append(u.Ns, &ANY{Hdr: RR_Header{Name: h.Name, Ttl: 0, Rrtype: h.Rrtype, Class: ClassANY}}) - } -} - -// RemoveName creates a dynamic update packet that deletes all RRsets of a name, see RFC 2136 section 2.5.3 -func (u *Msg) RemoveName(rr []RR) { - if u.Ns == nil { - u.Ns = make([]RR, 0, len(rr)) - } - for _, r := range rr { - u.Ns = append(u.Ns, &ANY{Hdr: RR_Header{Name: r.Header().Name, Ttl: 0, Rrtype: TypeANY, Class: ClassANY}}) - } -} - -// Remove creates a dynamic update packet deletes RR from a RRSset, see RFC 2136 section 2.5.4 -func (u *Msg) Remove(rr []RR) { - if u.Ns == nil { - u.Ns = make([]RR, 0, len(rr)) - } - for _, r := range rr { - h := r.Header() - h.Class = ClassNONE - h.Ttl = 0 - u.Ns = append(u.Ns, r) - } -} diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go deleted file mode 100644 index 45f45e64..00000000 --- a/vendor/github.com/miekg/dns/version.go +++ /dev/null @@ -1,15 +0,0 @@ -package dns - -import "fmt" - -// Version is current version of this library. -var Version = V{1, 1, 14} - -// V holds the version of this library. -type V struct { - Major, Minor, Patch int -} - -func (v V) String() string { - return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) -} diff --git a/vendor/github.com/miekg/dns/xfr.go b/vendor/github.com/miekg/dns/xfr.go deleted file mode 100644 index bb4ca3d8..00000000 --- a/vendor/github.com/miekg/dns/xfr.go +++ /dev/null @@ -1,263 +0,0 @@ -package dns - -import ( - "fmt" - "time" -) - -// Envelope is used when doing a zone transfer with a remote server. -type Envelope struct { - RR []RR // The set of RRs in the answer section of the xfr reply message. - Error error // If something went wrong, this contains the error. -} - -// A Transfer defines parameters that are used during a zone transfer. -type Transfer struct { - *Conn - DialTimeout time.Duration // net.DialTimeout, defaults to 2 seconds - ReadTimeout time.Duration // net.Conn.SetReadTimeout value for connections, defaults to 2 seconds - WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - TsigSecret map[string]string // Secret(s) for Tsig map[], zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2) - tsigTimersOnly bool -} - -// Think we need to away to stop the transfer - -// In performs an incoming transfer with the server in a. -// If you would like to set the source IP, or some other attribute -// of a Dialer for a Transfer, you can do so by specifying the attributes -// in the Transfer.Conn: -// -// d := net.Dialer{LocalAddr: transfer_source} -// con, err := d.Dial("tcp", master) -// dnscon := &dns.Conn{Conn:con} -// transfer = &dns.Transfer{Conn: dnscon} -// channel, err := transfer.In(message, master) -// -func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) { - switch q.Question[0].Qtype { - case TypeAXFR, TypeIXFR: - default: - return nil, &Error{"unsupported question type"} - } - - timeout := dnsTimeout - if t.DialTimeout != 0 { - timeout = t.DialTimeout - } - - if t.Conn == nil { - t.Conn, err = DialTimeout("tcp", a, timeout) - if err != nil { - return nil, err - } - } - - if err := t.WriteMsg(q); err != nil { - return nil, err - } - - env = make(chan *Envelope) - switch q.Question[0].Qtype { - case TypeAXFR: - go t.inAxfr(q, env) - case TypeIXFR: - go t.inIxfr(q, env) - } - - return env, nil -} - -func (t *Transfer) inAxfr(q *Msg, c chan *Envelope) { - first := true - defer t.Close() - defer close(c) - timeout := dnsTimeout - if t.ReadTimeout != 0 { - timeout = t.ReadTimeout - } - for { - t.Conn.SetReadDeadline(time.Now().Add(timeout)) - in, err := t.ReadMsg() - if err != nil { - c <- &Envelope{nil, err} - return - } - if q.Id != in.Id { - c <- &Envelope{in.Answer, ErrId} - return - } - if first { - if in.Rcode != RcodeSuccess { - c <- &Envelope{in.Answer, &Error{err: fmt.Sprintf(errXFR, in.Rcode)}} - return - } - if !isSOAFirst(in) { - c <- &Envelope{in.Answer, ErrSoa} - return - } - first = !first - // only one answer that is SOA, receive more - if len(in.Answer) == 1 { - t.tsigTimersOnly = true - c <- &Envelope{in.Answer, nil} - continue - } - } - - if !first { - t.tsigTimersOnly = true // Subsequent envelopes use this. - if isSOALast(in) { - c <- &Envelope{in.Answer, nil} - return - } - c <- &Envelope{in.Answer, nil} - } - } -} - -func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) { - var serial uint32 // The first serial seen is the current server serial - axfr := true - n := 0 - qser := q.Ns[0].(*SOA).Serial - defer t.Close() - defer close(c) - timeout := dnsTimeout - if t.ReadTimeout != 0 { - timeout = t.ReadTimeout - } - for { - t.SetReadDeadline(time.Now().Add(timeout)) - in, err := t.ReadMsg() - if err != nil { - c <- &Envelope{nil, err} - return - } - if q.Id != in.Id { - c <- &Envelope{in.Answer, ErrId} - return - } - if in.Rcode != RcodeSuccess { - c <- &Envelope{in.Answer, &Error{err: fmt.Sprintf(errXFR, in.Rcode)}} - return - } - if n == 0 { - // Check if the returned answer is ok - if !isSOAFirst(in) { - c <- &Envelope{in.Answer, ErrSoa} - return - } - // This serial is important - serial = in.Answer[0].(*SOA).Serial - // Check if there are no changes in zone - if qser >= serial { - c <- &Envelope{in.Answer, nil} - return - } - } - // Now we need to check each message for SOA records, to see what we need to do - t.tsigTimersOnly = true - for _, rr := range in.Answer { - if v, ok := rr.(*SOA); ok { - if v.Serial == serial { - n++ - // quit if it's a full axfr or the the servers' SOA is repeated the third time - if axfr && n == 2 || n == 3 { - c <- &Envelope{in.Answer, nil} - return - } - } else if axfr { - // it's an ixfr - axfr = false - } - } - } - c <- &Envelope{in.Answer, nil} - } -} - -// Out performs an outgoing transfer with the client connecting in w. -// Basic use pattern: -// -// ch := make(chan *dns.Envelope) -// tr := new(dns.Transfer) -// go tr.Out(w, r, ch) -// ch <- &dns.Envelope{RR: []dns.RR{soa, rr1, rr2, rr3, soa}} -// close(ch) -// w.Hijack() -// // w.Close() // Client closes connection -// -// The server is responsible for sending the correct sequence of RRs through the -// channel ch. -func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error { - for x := range ch { - r := new(Msg) - // Compress? - r.SetReply(q) - r.Authoritative = true - // assume it fits TODO(miek): fix - r.Answer = append(r.Answer, x.RR...) - if tsig := q.IsTsig(); tsig != nil && w.TsigStatus() == nil { - r.SetTsig(tsig.Hdr.Name, tsig.Algorithm, tsig.Fudge, time.Now().Unix()) - } - if err := w.WriteMsg(r); err != nil { - return err - } - w.TsigTimersOnly(true) - } - return nil -} - -// ReadMsg reads a message from the transfer connection t. -func (t *Transfer) ReadMsg() (*Msg, error) { - m := new(Msg) - p := make([]byte, MaxMsgSize) - n, err := t.Read(p) - if err != nil && n == 0 { - return nil, err - } - p = p[:n] - if err := m.Unpack(p); err != nil { - return nil, err - } - if ts := m.IsTsig(); ts != nil && t.TsigSecret != nil { - if _, ok := t.TsigSecret[ts.Hdr.Name]; !ok { - return m, ErrSecret - } - // Need to work on the original message p, as that was used to calculate the tsig. - err = TsigVerify(p, t.TsigSecret[ts.Hdr.Name], t.tsigRequestMAC, t.tsigTimersOnly) - t.tsigRequestMAC = ts.MAC - } - return m, err -} - -// WriteMsg writes a message through the transfer connection t. -func (t *Transfer) WriteMsg(m *Msg) (err error) { - var out []byte - if ts := m.IsTsig(); ts != nil && t.TsigSecret != nil { - if _, ok := t.TsigSecret[ts.Hdr.Name]; !ok { - return ErrSecret - } - out, t.tsigRequestMAC, err = TsigGenerate(m, t.TsigSecret[ts.Hdr.Name], t.tsigRequestMAC, t.tsigTimersOnly) - } else { - out, err = m.Pack() - } - if err != nil { - return err - } - _, err = t.Write(out) - return err -} - -func isSOAFirst(in *Msg) bool { - return len(in.Answer) > 0 && - in.Answer[0].Header().Rrtype == TypeSOA -} - -func isSOALast(in *Msg) bool { - return len(in.Answer) > 0 && - in.Answer[len(in.Answer)-1].Header().Rrtype == TypeSOA -} - -const errXFR = "bad xfr rcode: %d" diff --git a/vendor/github.com/miekg/dns/zduplicate.go b/vendor/github.com/miekg/dns/zduplicate.go deleted file mode 100644 index 74389162..00000000 --- a/vendor/github.com/miekg/dns/zduplicate.go +++ /dev/null @@ -1,1140 +0,0 @@ -// Code generated by "go run duplicate_generate.go"; DO NOT EDIT. - -package dns - -// isDuplicate() functions - -func (r1 *A) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*A) - if !ok { - return false - } - _ = r2 - if !r1.A.Equal(r2.A) { - return false - } - return true -} - -func (r1 *AAAA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*AAAA) - if !ok { - return false - } - _ = r2 - if !r1.AAAA.Equal(r2.AAAA) { - return false - } - return true -} - -func (r1 *AFSDB) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*AFSDB) - if !ok { - return false - } - _ = r2 - if r1.Subtype != r2.Subtype { - return false - } - if !isDuplicateName(r1.Hostname, r2.Hostname) { - return false - } - return true -} - -func (r1 *ANY) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*ANY) - if !ok { - return false - } - _ = r2 - return true -} - -func (r1 *AVC) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*AVC) - if !ok { - return false - } - _ = r2 - 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 (r1 *CAA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*CAA) - if !ok { - return false - } - _ = r2 - if r1.Flag != r2.Flag { - return false - } - if r1.Tag != r2.Tag { - return false - } - if r1.Value != r2.Value { - return false - } - return true -} - -func (r1 *CERT) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*CERT) - if !ok { - return false - } - _ = r2 - 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 (r1 *CNAME) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*CNAME) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Target, r2.Target) { - return false - } - return true -} - -func (r1 *CSYNC) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*CSYNC) - if !ok { - return false - } - _ = r2 - 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 (r1 *DHCID) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*DHCID) - if !ok { - return false - } - _ = r2 - if r1.Digest != r2.Digest { - return false - } - return true -} - -func (r1 *DNAME) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*DNAME) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Target, r2.Target) { - return false - } - return true -} - -func (r1 *DNSKEY) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*DNSKEY) - if !ok { - return false - } - _ = r2 - 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 (r1 *DS) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*DS) - if !ok { - return false - } - _ = r2 - 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 (r1 *EID) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*EID) - if !ok { - return false - } - _ = r2 - if r1.Endpoint != r2.Endpoint { - return false - } - return true -} - -func (r1 *EUI48) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*EUI48) - if !ok { - return false - } - _ = r2 - if r1.Address != r2.Address { - return false - } - return true -} - -func (r1 *EUI64) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*EUI64) - if !ok { - return false - } - _ = r2 - if r1.Address != r2.Address { - return false - } - return true -} - -func (r1 *GID) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*GID) - if !ok { - return false - } - _ = r2 - if r1.Gid != r2.Gid { - return false - } - return true -} - -func (r1 *GPOS) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*GPOS) - if !ok { - return false - } - _ = r2 - if r1.Longitude != r2.Longitude { - return false - } - if r1.Latitude != r2.Latitude { - return false - } - if r1.Altitude != r2.Altitude { - return false - } - return true -} - -func (r1 *HINFO) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*HINFO) - if !ok { - return false - } - _ = r2 - if r1.Cpu != r2.Cpu { - return false - } - if r1.Os != r2.Os { - return false - } - return true -} - -func (r1 *HIP) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*HIP) - if !ok { - return false - } - _ = r2 - 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 !isDuplicateName(r1.RendezvousServers[i], r2.RendezvousServers[i]) { - return false - } - } - return true -} - -func (r1 *KX) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*KX) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !isDuplicateName(r1.Exchanger, r2.Exchanger) { - return false - } - return true -} - -func (r1 *L32) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*L32) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !r1.Locator32.Equal(r2.Locator32) { - return false - } - return true -} - -func (r1 *L64) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*L64) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if r1.Locator64 != r2.Locator64 { - return false - } - return true -} - -func (r1 *LOC) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*LOC) - if !ok { - return false - } - _ = r2 - 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 (r1 *LP) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*LP) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !isDuplicateName(r1.Fqdn, r2.Fqdn) { - return false - } - return true -} - -func (r1 *MB) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MB) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Mb, r2.Mb) { - return false - } - return true -} - -func (r1 *MD) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MD) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Md, r2.Md) { - return false - } - return true -} - -func (r1 *MF) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MF) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Mf, r2.Mf) { - return false - } - return true -} - -func (r1 *MG) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MG) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Mg, r2.Mg) { - return false - } - return true -} - -func (r1 *MINFO) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MINFO) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Rmail, r2.Rmail) { - return false - } - if !isDuplicateName(r1.Email, r2.Email) { - return false - } - return true -} - -func (r1 *MR) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MR) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Mr, r2.Mr) { - return false - } - return true -} - -func (r1 *MX) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*MX) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !isDuplicateName(r1.Mx, r2.Mx) { - return false - } - return true -} - -func (r1 *NAPTR) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NAPTR) - if !ok { - return false - } - _ = r2 - 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 !isDuplicateName(r1.Replacement, r2.Replacement) { - return false - } - return true -} - -func (r1 *NID) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NID) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if r1.NodeID != r2.NodeID { - return false - } - return true -} - -func (r1 *NIMLOC) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NIMLOC) - if !ok { - return false - } - _ = r2 - if r1.Locator != r2.Locator { - return false - } - return true -} - -func (r1 *NINFO) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NINFO) - if !ok { - return false - } - _ = r2 - 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 (r1 *NS) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NS) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Ns, r2.Ns) { - return false - } - return true -} - -func (r1 *NSAPPTR) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NSAPPTR) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Ptr, r2.Ptr) { - return false - } - return true -} - -func (r1 *NSEC) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NSEC) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(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 (r1 *NSEC3) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NSEC3) - if !ok { - return false - } - _ = r2 - 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 (r1 *NSEC3PARAM) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NSEC3PARAM) - if !ok { - return false - } - _ = r2 - 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 (r1 *NULL) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*NULL) - if !ok { - return false - } - _ = r2 - if r1.Data != r2.Data { - return false - } - return true -} - -func (r1 *OPENPGPKEY) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*OPENPGPKEY) - if !ok { - return false - } - _ = r2 - if r1.PublicKey != r2.PublicKey { - return false - } - return true -} - -func (r1 *PTR) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*PTR) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Ptr, r2.Ptr) { - return false - } - return true -} - -func (r1 *PX) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*PX) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !isDuplicateName(r1.Map822, r2.Map822) { - return false - } - if !isDuplicateName(r1.Mapx400, r2.Mapx400) { - return false - } - return true -} - -func (r1 *RFC3597) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RFC3597) - if !ok { - return false - } - _ = r2 - if r1.Rdata != r2.Rdata { - return false - } - return true -} - -func (r1 *RKEY) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RKEY) - if !ok { - return false - } - _ = r2 - 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 (r1 *RP) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RP) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Mbox, r2.Mbox) { - return false - } - if !isDuplicateName(r1.Txt, r2.Txt) { - return false - } - return true -} - -func (r1 *RRSIG) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RRSIG) - if !ok { - return false - } - _ = r2 - 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 !isDuplicateName(r1.SignerName, r2.SignerName) { - return false - } - if r1.Signature != r2.Signature { - return false - } - return true -} - -func (r1 *RT) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*RT) - if !ok { - return false - } - _ = r2 - if r1.Preference != r2.Preference { - return false - } - if !isDuplicateName(r1.Host, r2.Host) { - return false - } - return true -} - -func (r1 *SMIMEA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*SMIMEA) - if !ok { - return false - } - _ = r2 - 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 (r1 *SOA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*SOA) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.Ns, r2.Ns) { - return false - } - if !isDuplicateName(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 (r1 *SPF) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*SPF) - if !ok { - return false - } - _ = r2 - 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 (r1 *SRV) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*SRV) - if !ok { - return false - } - _ = r2 - if r1.Priority != r2.Priority { - return false - } - if r1.Weight != r2.Weight { - return false - } - if r1.Port != r2.Port { - return false - } - if !isDuplicateName(r1.Target, r2.Target) { - return false - } - return true -} - -func (r1 *SSHFP) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*SSHFP) - if !ok { - return false - } - _ = r2 - if r1.Algorithm != r2.Algorithm { - return false - } - if r1.Type != r2.Type { - return false - } - if r1.FingerPrint != r2.FingerPrint { - return false - } - return true -} - -func (r1 *TA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TA) - if !ok { - return false - } - _ = r2 - 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 (r1 *TALINK) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TALINK) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(r1.PreviousName, r2.PreviousName) { - return false - } - if !isDuplicateName(r1.NextName, r2.NextName) { - return false - } - return true -} - -func (r1 *TKEY) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TKEY) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(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 (r1 *TLSA) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TLSA) - if !ok { - return false - } - _ = r2 - 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 (r1 *TSIG) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TSIG) - if !ok { - return false - } - _ = r2 - if !isDuplicateName(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 (r1 *TXT) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*TXT) - if !ok { - return false - } - _ = r2 - 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 (r1 *UID) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*UID) - if !ok { - return false - } - _ = r2 - if r1.Uid != r2.Uid { - return false - } - return true -} - -func (r1 *UINFO) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*UINFO) - if !ok { - return false - } - _ = r2 - if r1.Uinfo != r2.Uinfo { - return false - } - return true -} - -func (r1 *URI) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*URI) - if !ok { - return false - } - _ = r2 - if r1.Priority != r2.Priority { - return false - } - if r1.Weight != r2.Weight { - return false - } - if r1.Target != r2.Target { - return false - } - return true -} - -func (r1 *X25) isDuplicate(_r2 RR) bool { - r2, ok := _r2.(*X25) - if !ok { - return false - } - _ = r2 - if r1.PSDNAddress != r2.PSDNAddress { - return false - } - return true -} diff --git a/vendor/github.com/miekg/dns/zmsg.go b/vendor/github.com/miekg/dns/zmsg.go deleted file mode 100644 index c4cf4757..00000000 --- a/vendor/github.com/miekg/dns/zmsg.go +++ /dev/null @@ -1,2722 +0,0 @@ -// Code generated by "go run msg_generate.go"; DO NOT EDIT. - -package dns - -// pack*() functions - -func (rr *A) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDataA(rr.A, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *AAAA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDataAAAA(rr.AAAA, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *AFSDB) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Subtype, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Hostname, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *ANY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - return off, nil -} - -func (rr *AVC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringTxt(rr.Txt, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CAA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Flag, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Tag, msg, off) - if err != nil { - return off, err - } - off, err = packStringOctet(rr.Value, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CDNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Protocol, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CDS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.DigestType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Digest, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CERT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Type, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.Certificate, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Target, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CSYNC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint32(rr.Serial, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packDataNsec(rr.TypeBitMap, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DHCID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringBase64(rr.Digest, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DLV) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.DigestType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Digest, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Target, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Protocol, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.DigestType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Digest, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringHex(rr.Endpoint, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EUI48) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint48(rr.Address, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EUI64) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint64(rr.Address, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *GID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint32(rr.Gid, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *GPOS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packString(rr.Longitude, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Latitude, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Altitude, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *HINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packString(rr.Cpu, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Os, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *HIP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.HitLength, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.PublicKeyAlgorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.PublicKeyLength, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Hit, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - off, err = packDataDomainNames(rr.RendezvousServers, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *KEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Protocol, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *KX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Exchanger, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *L32) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDataA(rr.Locator32, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *L64) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packUint64(rr.Locator64, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *LOC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Version, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Size, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.HorizPre, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.VertPre, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Latitude, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Longitude, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Altitude, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *LP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Fqdn, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MB) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Mb, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MD) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Md, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MF) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Mf, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Mg, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Rmail, msg, off, compression, compress) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Email, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Mr, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Mx, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NAPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Order, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Service, msg, off) - if err != nil { - return off, err - } - off, err = packString(rr.Regexp, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Replacement, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packUint64(rr.NodeID, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NIMLOC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringHex(rr.Locator, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringTxt(rr.ZSData, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Ns, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSAPPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Ptr, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.NextDomain, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packDataNsec(rr.TypeBitMap, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC3) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Hash, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Iterations, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.SaltLength, msg, off) - if err != nil { - return off, err - } - // Only pack salt if value is not "-", i.e. empty - if rr.Salt != "-" { - off, err = packStringHex(rr.Salt, msg, off) - if err != nil { - return off, err - } - } - off, err = packUint8(rr.HashLength, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase32(rr.NextDomain, msg, off) - if err != nil { - return off, err - } - off, err = packDataNsec(rr.TypeBitMap, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC3PARAM) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Hash, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Iterations, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.SaltLength, msg, off) - if err != nil { - return off, err - } - // Only pack salt if value is not "-", i.e. empty - if rr.Salt != "-" { - off, err = packStringHex(rr.Salt, msg, off) - if err != nil { - return off, err - } - } - return off, nil -} - -func (rr *NULL) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringAny(rr.Data, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *OPENPGPKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *OPT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDataOpt(rr.Option, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *PTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Ptr, msg, off, compression, compress) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *PX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Map822, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Mapx400, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RFC3597) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringHex(rr.Rdata, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Flags, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Protocol, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.PublicKey, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Mbox, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Txt, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RRSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.TypeCovered, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Labels, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.OrigTtl, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Expiration, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Inception, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.SignerName, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.Signature, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Preference, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Host, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.TypeCovered, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Labels, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.OrigTtl, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Expiration, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Inception, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.SignerName, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packStringBase64(rr.Signature, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SMIMEA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Usage, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Selector, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.MatchingType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Certificate, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SOA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Ns, msg, off, compression, compress) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Mbox, msg, off, compression, compress) - if err != nil { - return off, err - } - off, err = packUint32(rr.Serial, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Refresh, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Retry, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Expire, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Minttl, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SPF) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringTxt(rr.Txt, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SRV) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Priority, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Weight, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Port, msg, off) - if err != nil { - return off, err - } - off, err = packDomainName(rr.Target, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SSHFP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Type, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.FingerPrint, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.KeyTag, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Algorithm, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.DigestType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Digest, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TALINK) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.PreviousName, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packDomainName(rr.NextName, msg, off, compression, false) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Algorithm, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packUint32(rr.Inception, msg, off) - if err != nil { - return off, err - } - off, err = packUint32(rr.Expiration, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Mode, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Error, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.KeySize, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Key, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.OtherLen, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.OtherData, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TLSA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint8(rr.Usage, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.Selector, msg, off) - if err != nil { - return off, err - } - off, err = packUint8(rr.MatchingType, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.Certificate, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packDomainName(rr.Algorithm, msg, off, compression, false) - if err != nil { - return off, err - } - off, err = packUint48(rr.TimeSigned, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Fudge, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.MACSize, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.MAC, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.OrigId, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Error, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.OtherLen, msg, off) - if err != nil { - return off, err - } - off, err = packStringHex(rr.OtherData, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TXT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packStringTxt(rr.Txt, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *UID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint32(rr.Uid, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *UINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packString(rr.Uinfo, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *URI) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packUint16(rr.Priority, msg, off) - if err != nil { - return off, err - } - off, err = packUint16(rr.Weight, msg, off) - if err != nil { - return off, err - } - off, err = packStringOctet(rr.Target, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *X25) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { - off, err = packString(rr.PSDNAddress, msg, off) - if err != nil { - return off, err - } - return off, nil -} - -// unpack*() functions - -func (rr *A) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.A, off, err = unpackDataA(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *AAAA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.AAAA, off, err = unpackDataAAAA(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *AFSDB) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Subtype, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Hostname, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *ANY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - return off, nil -} - -func (rr *AVC) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Txt, off, err = unpackStringTxt(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CAA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Flag, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Tag, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Value, off, err = unpackStringOctet(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CDNSKEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Flags, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Protocol, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CDS) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.DigestType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CERT) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Type, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Certificate, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CNAME) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Target, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *CSYNC) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Serial, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Flags, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.TypeBitMap, off, err = unpackDataNsec(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DHCID) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Digest, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DLV) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.DigestType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DNAME) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Target, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DNSKEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Flags, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Protocol, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *DS) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.DigestType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EID) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Endpoint, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EUI48) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Address, off, err = unpackUint48(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *EUI64) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Address, off, err = unpackUint64(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *GID) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Gid, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *GPOS) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Longitude, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Latitude, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Altitude, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *HINFO) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Cpu, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Os, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *HIP) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.HitLength, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKeyAlgorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKeyLength, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Hit, off, err = unpackStringHex(msg, off, off+int(rr.HitLength)) - if err != nil { - return off, err - } - rr.PublicKey, off, err = unpackStringBase64(msg, off, off+int(rr.PublicKeyLength)) - if err != nil { - return off, err - } - rr.RendezvousServers, off, err = unpackDataDomainNames(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *KEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Flags, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Protocol, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *KX) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Exchanger, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *L32) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Locator32, off, err = unpackDataA(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *L64) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Locator64, off, err = unpackUint64(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *LOC) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Version, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Size, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.HorizPre, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.VertPre, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Latitude, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Longitude, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Altitude, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *LP) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Fqdn, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MB) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Mb, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MD) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Md, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MF) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Mf, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MG) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Mg, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MINFO) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Rmail, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Email, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MR) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Mr, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *MX) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Mx, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NAPTR) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Order, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Flags, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Service, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Regexp, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Replacement, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NID) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.NodeID, off, err = unpackUint64(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NIMLOC) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Locator, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NINFO) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.ZSData, off, err = unpackStringTxt(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NS) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Ns, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSAPPTR) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Ptr, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.NextDomain, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.TypeBitMap, off, err = unpackDataNsec(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC3) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Hash, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Flags, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Iterations, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.SaltLength, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Salt, off, err = unpackStringHex(msg, off, off+int(rr.SaltLength)) - if err != nil { - return off, err - } - rr.HashLength, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.NextDomain, off, err = unpackStringBase32(msg, off, off+int(rr.HashLength)) - if err != nil { - return off, err - } - rr.TypeBitMap, off, err = unpackDataNsec(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NSEC3PARAM) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Hash, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Flags, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Iterations, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.SaltLength, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Salt, off, err = unpackStringHex(msg, off, off+int(rr.SaltLength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *NULL) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Data, off, err = unpackStringAny(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *OPENPGPKEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *OPT) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Option, off, err = unpackDataOpt(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *PTR) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Ptr, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *PX) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Map822, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Mapx400, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RFC3597) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Rdata, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RKEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Flags, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Protocol, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RP) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Mbox, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Txt, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RRSIG) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.TypeCovered, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Labels, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.OrigTtl, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Expiration, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Inception, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.SignerName, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Signature, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *RT) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Preference, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Host, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SIG) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.TypeCovered, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Labels, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.OrigTtl, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Expiration, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Inception, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.SignerName, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Signature, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SMIMEA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Usage, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Selector, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.MatchingType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Certificate, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SOA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Ns, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Mbox, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Serial, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Refresh, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Retry, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Expire, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Minttl, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SPF) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Txt, off, err = unpackStringTxt(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SRV) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Priority, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Weight, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Port, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Target, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *SSHFP) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Type, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.FingerPrint, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.KeyTag, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Algorithm, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.DigestType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TALINK) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.PreviousName, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.NextName, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TKEY) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Algorithm, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Inception, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Expiration, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Mode, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Error, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.KeySize, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Key, off, err = unpackStringHex(msg, off, off+int(rr.KeySize)) - if err != nil { - return off, err - } - rr.OtherLen, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.OtherData, off, err = unpackStringHex(msg, off, off+int(rr.OtherLen)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TLSA) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Usage, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Selector, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.MatchingType, off, err = unpackUint8(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Certificate, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TSIG) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Algorithm, off, err = UnpackDomainName(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.TimeSigned, off, err = unpackUint48(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Fudge, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.MACSize, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.MAC, off, err = unpackStringHex(msg, off, off+int(rr.MACSize)) - if err != nil { - return off, err - } - rr.OrigId, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Error, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.OtherLen, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.OtherData, off, err = unpackStringHex(msg, off, off+int(rr.OtherLen)) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *TXT) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Txt, off, err = unpackStringTxt(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *UID) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Uid, off, err = unpackUint32(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *UINFO) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Uinfo, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *URI) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.Priority, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Weight, off, err = unpackUint16(msg, off) - if err != nil { - return off, err - } - if off == len(msg) { - return off, nil - } - rr.Target, off, err = unpackStringOctet(msg, off) - if err != nil { - return off, err - } - return off, nil -} - -func (rr *X25) unpack(msg []byte, off int) (off1 int, err error) { - rdStart := off - _ = rdStart - - rr.PSDNAddress, off, err = unpackString(msg, off) - if err != nil { - return off, err - } - return off, nil -} diff --git a/vendor/github.com/miekg/dns/ztypes.go b/vendor/github.com/miekg/dns/ztypes.go deleted file mode 100644 index f7ec8352..00000000 --- a/vendor/github.com/miekg/dns/ztypes.go +++ /dev/null @@ -1,881 +0,0 @@ -// Code generated by "go run types_generate.go"; DO NOT EDIT. - -package dns - -import ( - "encoding/base64" - "net" -) - -// TypeToRR is a map of constructors for each RR type. -var TypeToRR = map[uint16]func() RR{ - TypeA: func() RR { return new(A) }, - TypeAAAA: func() RR { return new(AAAA) }, - TypeAFSDB: func() RR { return new(AFSDB) }, - TypeANY: func() RR { return new(ANY) }, - TypeAVC: func() RR { return new(AVC) }, - TypeCAA: func() RR { return new(CAA) }, - TypeCDNSKEY: func() RR { return new(CDNSKEY) }, - TypeCDS: func() RR { return new(CDS) }, - TypeCERT: func() RR { return new(CERT) }, - TypeCNAME: func() RR { return new(CNAME) }, - TypeCSYNC: func() RR { return new(CSYNC) }, - TypeDHCID: func() RR { return new(DHCID) }, - TypeDLV: func() RR { return new(DLV) }, - TypeDNAME: func() RR { return new(DNAME) }, - TypeDNSKEY: func() RR { return new(DNSKEY) }, - TypeDS: func() RR { return new(DS) }, - TypeEID: func() RR { return new(EID) }, - TypeEUI48: func() RR { return new(EUI48) }, - TypeEUI64: func() RR { return new(EUI64) }, - TypeGID: func() RR { return new(GID) }, - TypeGPOS: func() RR { return new(GPOS) }, - TypeHINFO: func() RR { return new(HINFO) }, - TypeHIP: func() RR { return new(HIP) }, - TypeKEY: func() RR { return new(KEY) }, - TypeKX: func() RR { return new(KX) }, - TypeL32: func() RR { return new(L32) }, - TypeL64: func() RR { return new(L64) }, - TypeLOC: func() RR { return new(LOC) }, - TypeLP: func() RR { return new(LP) }, - TypeMB: func() RR { return new(MB) }, - TypeMD: func() RR { return new(MD) }, - TypeMF: func() RR { return new(MF) }, - TypeMG: func() RR { return new(MG) }, - TypeMINFO: func() RR { return new(MINFO) }, - TypeMR: func() RR { return new(MR) }, - TypeMX: func() RR { return new(MX) }, - TypeNAPTR: func() RR { return new(NAPTR) }, - TypeNID: func() RR { return new(NID) }, - TypeNIMLOC: func() RR { return new(NIMLOC) }, - TypeNINFO: func() RR { return new(NINFO) }, - TypeNS: func() RR { return new(NS) }, - TypeNSAPPTR: func() RR { return new(NSAPPTR) }, - TypeNSEC: func() RR { return new(NSEC) }, - TypeNSEC3: func() RR { return new(NSEC3) }, - TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) }, - TypeNULL: func() RR { return new(NULL) }, - TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) }, - TypeOPT: func() RR { return new(OPT) }, - TypePTR: func() RR { return new(PTR) }, - TypePX: func() RR { return new(PX) }, - TypeRKEY: func() RR { return new(RKEY) }, - TypeRP: func() RR { return new(RP) }, - TypeRRSIG: func() RR { return new(RRSIG) }, - TypeRT: func() RR { return new(RT) }, - TypeSIG: func() RR { return new(SIG) }, - TypeSMIMEA: func() RR { return new(SMIMEA) }, - TypeSOA: func() RR { return new(SOA) }, - TypeSPF: func() RR { return new(SPF) }, - TypeSRV: func() RR { return new(SRV) }, - TypeSSHFP: func() RR { return new(SSHFP) }, - TypeTA: func() RR { return new(TA) }, - TypeTALINK: func() RR { return new(TALINK) }, - TypeTKEY: func() RR { return new(TKEY) }, - TypeTLSA: func() RR { return new(TLSA) }, - TypeTSIG: func() RR { return new(TSIG) }, - TypeTXT: func() RR { return new(TXT) }, - TypeUID: func() RR { return new(UID) }, - TypeUINFO: func() RR { return new(UINFO) }, - TypeURI: func() RR { return new(URI) }, - TypeX25: func() RR { return new(X25) }, -} - -// TypeToString is a map of strings for each RR type. -var TypeToString = map[uint16]string{ - TypeA: "A", - TypeAAAA: "AAAA", - TypeAFSDB: "AFSDB", - TypeANY: "ANY", - TypeATMA: "ATMA", - TypeAVC: "AVC", - TypeAXFR: "AXFR", - TypeCAA: "CAA", - TypeCDNSKEY: "CDNSKEY", - TypeCDS: "CDS", - TypeCERT: "CERT", - TypeCNAME: "CNAME", - TypeCSYNC: "CSYNC", - TypeDHCID: "DHCID", - TypeDLV: "DLV", - TypeDNAME: "DNAME", - TypeDNSKEY: "DNSKEY", - TypeDS: "DS", - TypeEID: "EID", - TypeEUI48: "EUI48", - TypeEUI64: "EUI64", - TypeGID: "GID", - TypeGPOS: "GPOS", - TypeHINFO: "HINFO", - TypeHIP: "HIP", - TypeISDN: "ISDN", - TypeIXFR: "IXFR", - TypeKEY: "KEY", - TypeKX: "KX", - TypeL32: "L32", - TypeL64: "L64", - TypeLOC: "LOC", - TypeLP: "LP", - TypeMAILA: "MAILA", - TypeMAILB: "MAILB", - TypeMB: "MB", - TypeMD: "MD", - TypeMF: "MF", - TypeMG: "MG", - TypeMINFO: "MINFO", - TypeMR: "MR", - TypeMX: "MX", - TypeNAPTR: "NAPTR", - TypeNID: "NID", - TypeNIMLOC: "NIMLOC", - TypeNINFO: "NINFO", - TypeNS: "NS", - TypeNSEC: "NSEC", - TypeNSEC3: "NSEC3", - TypeNSEC3PARAM: "NSEC3PARAM", - TypeNULL: "NULL", - TypeNXT: "NXT", - TypeNone: "None", - TypeOPENPGPKEY: "OPENPGPKEY", - TypeOPT: "OPT", - TypePTR: "PTR", - TypePX: "PX", - TypeRKEY: "RKEY", - TypeRP: "RP", - TypeRRSIG: "RRSIG", - TypeRT: "RT", - TypeReserved: "Reserved", - TypeSIG: "SIG", - TypeSMIMEA: "SMIMEA", - TypeSOA: "SOA", - TypeSPF: "SPF", - TypeSRV: "SRV", - TypeSSHFP: "SSHFP", - TypeTA: "TA", - TypeTALINK: "TALINK", - TypeTKEY: "TKEY", - TypeTLSA: "TLSA", - TypeTSIG: "TSIG", - TypeTXT: "TXT", - TypeUID: "UID", - TypeUINFO: "UINFO", - TypeUNSPEC: "UNSPEC", - TypeURI: "URI", - TypeX25: "X25", - TypeNSAPPTR: "NSAP-PTR", -} - -func (rr *A) Header() *RR_Header { return &rr.Hdr } -func (rr *AAAA) Header() *RR_Header { return &rr.Hdr } -func (rr *AFSDB) Header() *RR_Header { return &rr.Hdr } -func (rr *ANY) Header() *RR_Header { return &rr.Hdr } -func (rr *AVC) Header() *RR_Header { return &rr.Hdr } -func (rr *CAA) Header() *RR_Header { return &rr.Hdr } -func (rr *CDNSKEY) Header() *RR_Header { return &rr.Hdr } -func (rr *CDS) Header() *RR_Header { return &rr.Hdr } -func (rr *CERT) Header() *RR_Header { return &rr.Hdr } -func (rr *CNAME) Header() *RR_Header { return &rr.Hdr } -func (rr *CSYNC) Header() *RR_Header { return &rr.Hdr } -func (rr *DHCID) Header() *RR_Header { return &rr.Hdr } -func (rr *DLV) Header() *RR_Header { return &rr.Hdr } -func (rr *DNAME) Header() *RR_Header { return &rr.Hdr } -func (rr *DNSKEY) Header() *RR_Header { return &rr.Hdr } -func (rr *DS) Header() *RR_Header { return &rr.Hdr } -func (rr *EID) Header() *RR_Header { return &rr.Hdr } -func (rr *EUI48) Header() *RR_Header { return &rr.Hdr } -func (rr *EUI64) Header() *RR_Header { return &rr.Hdr } -func (rr *GID) Header() *RR_Header { return &rr.Hdr } -func (rr *GPOS) Header() *RR_Header { return &rr.Hdr } -func (rr *HINFO) Header() *RR_Header { return &rr.Hdr } -func (rr *HIP) Header() *RR_Header { return &rr.Hdr } -func (rr *KEY) Header() *RR_Header { return &rr.Hdr } -func (rr *KX) Header() *RR_Header { return &rr.Hdr } -func (rr *L32) Header() *RR_Header { return &rr.Hdr } -func (rr *L64) Header() *RR_Header { return &rr.Hdr } -func (rr *LOC) Header() *RR_Header { return &rr.Hdr } -func (rr *LP) Header() *RR_Header { return &rr.Hdr } -func (rr *MB) Header() *RR_Header { return &rr.Hdr } -func (rr *MD) Header() *RR_Header { return &rr.Hdr } -func (rr *MF) Header() *RR_Header { return &rr.Hdr } -func (rr *MG) Header() *RR_Header { return &rr.Hdr } -func (rr *MINFO) Header() *RR_Header { return &rr.Hdr } -func (rr *MR) Header() *RR_Header { return &rr.Hdr } -func (rr *MX) Header() *RR_Header { return &rr.Hdr } -func (rr *NAPTR) Header() *RR_Header { return &rr.Hdr } -func (rr *NID) Header() *RR_Header { return &rr.Hdr } -func (rr *NIMLOC) Header() *RR_Header { return &rr.Hdr } -func (rr *NINFO) Header() *RR_Header { return &rr.Hdr } -func (rr *NS) Header() *RR_Header { return &rr.Hdr } -func (rr *NSAPPTR) Header() *RR_Header { return &rr.Hdr } -func (rr *NSEC) Header() *RR_Header { return &rr.Hdr } -func (rr *NSEC3) Header() *RR_Header { return &rr.Hdr } -func (rr *NSEC3PARAM) Header() *RR_Header { return &rr.Hdr } -func (rr *NULL) Header() *RR_Header { return &rr.Hdr } -func (rr *OPENPGPKEY) Header() *RR_Header { return &rr.Hdr } -func (rr *OPT) Header() *RR_Header { return &rr.Hdr } -func (rr *PTR) Header() *RR_Header { return &rr.Hdr } -func (rr *PX) Header() *RR_Header { return &rr.Hdr } -func (rr *RFC3597) Header() *RR_Header { return &rr.Hdr } -func (rr *RKEY) Header() *RR_Header { return &rr.Hdr } -func (rr *RP) Header() *RR_Header { return &rr.Hdr } -func (rr *RRSIG) Header() *RR_Header { return &rr.Hdr } -func (rr *RT) Header() *RR_Header { return &rr.Hdr } -func (rr *SIG) Header() *RR_Header { return &rr.Hdr } -func (rr *SMIMEA) Header() *RR_Header { return &rr.Hdr } -func (rr *SOA) Header() *RR_Header { return &rr.Hdr } -func (rr *SPF) Header() *RR_Header { return &rr.Hdr } -func (rr *SRV) Header() *RR_Header { return &rr.Hdr } -func (rr *SSHFP) Header() *RR_Header { return &rr.Hdr } -func (rr *TA) Header() *RR_Header { return &rr.Hdr } -func (rr *TALINK) Header() *RR_Header { return &rr.Hdr } -func (rr *TKEY) Header() *RR_Header { return &rr.Hdr } -func (rr *TLSA) Header() *RR_Header { return &rr.Hdr } -func (rr *TSIG) Header() *RR_Header { return &rr.Hdr } -func (rr *TXT) Header() *RR_Header { return &rr.Hdr } -func (rr *UID) Header() *RR_Header { return &rr.Hdr } -func (rr *UINFO) Header() *RR_Header { return &rr.Hdr } -func (rr *URI) Header() *RR_Header { return &rr.Hdr } -func (rr *X25) Header() *RR_Header { return &rr.Hdr } - -// len() functions -func (rr *A) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - if len(rr.A) != 0 { - l += net.IPv4len - } - return l -} -func (rr *AAAA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - if len(rr.AAAA) != 0 { - l += net.IPv6len - } - return l -} -func (rr *AFSDB) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Subtype - l += domainNameLen(rr.Hostname, off+l, compression, false) - return l -} -func (rr *ANY) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - return l -} -func (rr *AVC) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - for _, x := range rr.Txt { - l += len(x) + 1 - } - return l -} -func (rr *CAA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Flag - l += len(rr.Tag) + 1 - l += len(rr.Value) - return l -} -func (rr *CERT) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Type - l += 2 // KeyTag - l++ // Algorithm - l += base64.StdEncoding.DecodedLen(len(rr.Certificate)) - return l -} -func (rr *CNAME) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Target, off+l, compression, true) - return l -} -func (rr *DHCID) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += base64.StdEncoding.DecodedLen(len(rr.Digest)) - return l -} -func (rr *DNAME) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Target, off+l, compression, false) - return l -} -func (rr *DNSKEY) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Flags - l++ // Protocol - l++ // Algorithm - l += base64.StdEncoding.DecodedLen(len(rr.PublicKey)) - return l -} -func (rr *DS) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // KeyTag - l++ // Algorithm - l++ // DigestType - l += len(rr.Digest) / 2 - return l -} -func (rr *EID) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Endpoint) / 2 - return l -} -func (rr *EUI48) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 6 // Address - return l -} -func (rr *EUI64) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 8 // Address - return l -} -func (rr *GID) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 4 // Gid - return l -} -func (rr *GPOS) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Longitude) + 1 - l += len(rr.Latitude) + 1 - l += len(rr.Altitude) + 1 - return l -} -func (rr *HINFO) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Cpu) + 1 - l += len(rr.Os) + 1 - return l -} -func (rr *HIP) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // HitLength - l++ // PublicKeyAlgorithm - l += 2 // PublicKeyLength - l += len(rr.Hit) / 2 - l += base64.StdEncoding.DecodedLen(len(rr.PublicKey)) - for _, x := range rr.RendezvousServers { - l += domainNameLen(x, off+l, compression, false) - } - return l -} -func (rr *KX) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += domainNameLen(rr.Exchanger, off+l, compression, false) - return l -} -func (rr *L32) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - if len(rr.Locator32) != 0 { - l += net.IPv4len - } - return l -} -func (rr *L64) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += 8 // Locator64 - return l -} -func (rr *LOC) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Version - l++ // Size - l++ // HorizPre - l++ // VertPre - l += 4 // Latitude - l += 4 // Longitude - l += 4 // Altitude - return l -} -func (rr *LP) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += domainNameLen(rr.Fqdn, off+l, compression, false) - return l -} -func (rr *MB) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Mb, off+l, compression, true) - return l -} -func (rr *MD) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Md, off+l, compression, true) - return l -} -func (rr *MF) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Mf, off+l, compression, true) - return l -} -func (rr *MG) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Mg, off+l, compression, true) - return l -} -func (rr *MINFO) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Rmail, off+l, compression, true) - l += domainNameLen(rr.Email, off+l, compression, true) - return l -} -func (rr *MR) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Mr, off+l, compression, true) - return l -} -func (rr *MX) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += domainNameLen(rr.Mx, off+l, compression, true) - return l -} -func (rr *NAPTR) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Order - l += 2 // Preference - l += len(rr.Flags) + 1 - l += len(rr.Service) + 1 - l += len(rr.Regexp) + 1 - l += domainNameLen(rr.Replacement, off+l, compression, false) - return l -} -func (rr *NID) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += 8 // NodeID - return l -} -func (rr *NIMLOC) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Locator) / 2 - return l -} -func (rr *NINFO) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - for _, x := range rr.ZSData { - l += len(x) + 1 - } - return l -} -func (rr *NS) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Ns, off+l, compression, true) - return l -} -func (rr *NSAPPTR) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Ptr, off+l, compression, false) - return l -} -func (rr *NSEC3PARAM) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Hash - l++ // Flags - l += 2 // Iterations - l++ // SaltLength - l += len(rr.Salt) / 2 - return l -} -func (rr *NULL) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Data) - return l -} -func (rr *OPENPGPKEY) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += base64.StdEncoding.DecodedLen(len(rr.PublicKey)) - return l -} -func (rr *PTR) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Ptr, off+l, compression, true) - return l -} -func (rr *PX) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += domainNameLen(rr.Map822, off+l, compression, false) - l += domainNameLen(rr.Mapx400, off+l, compression, false) - return l -} -func (rr *RFC3597) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Rdata) / 2 - return l -} -func (rr *RKEY) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Flags - l++ // Protocol - l++ // Algorithm - l += base64.StdEncoding.DecodedLen(len(rr.PublicKey)) - return l -} -func (rr *RP) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Mbox, off+l, compression, false) - l += domainNameLen(rr.Txt, off+l, compression, false) - return l -} -func (rr *RRSIG) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // TypeCovered - l++ // Algorithm - l++ // Labels - l += 4 // OrigTtl - l += 4 // Expiration - l += 4 // Inception - l += 2 // KeyTag - l += domainNameLen(rr.SignerName, off+l, compression, false) - l += base64.StdEncoding.DecodedLen(len(rr.Signature)) - return l -} -func (rr *RT) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Preference - l += domainNameLen(rr.Host, off+l, compression, false) - return l -} -func (rr *SMIMEA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Usage - l++ // Selector - l++ // MatchingType - l += len(rr.Certificate) / 2 - return l -} -func (rr *SOA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Ns, off+l, compression, true) - l += domainNameLen(rr.Mbox, off+l, compression, true) - l += 4 // Serial - l += 4 // Refresh - l += 4 // Retry - l += 4 // Expire - l += 4 // Minttl - return l -} -func (rr *SPF) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - for _, x := range rr.Txt { - l += len(x) + 1 - } - return l -} -func (rr *SRV) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Priority - l += 2 // Weight - l += 2 // Port - l += domainNameLen(rr.Target, off+l, compression, false) - return l -} -func (rr *SSHFP) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Algorithm - l++ // Type - l += len(rr.FingerPrint) / 2 - return l -} -func (rr *TA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // KeyTag - l++ // Algorithm - l++ // DigestType - l += len(rr.Digest) / 2 - return l -} -func (rr *TALINK) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.PreviousName, off+l, compression, false) - l += domainNameLen(rr.NextName, off+l, compression, false) - return l -} -func (rr *TKEY) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Algorithm, off+l, compression, false) - l += 4 // Inception - l += 4 // Expiration - l += 2 // Mode - l += 2 // Error - l += 2 // KeySize - l += len(rr.Key) / 2 - l += 2 // OtherLen - l += len(rr.OtherData) / 2 - return l -} -func (rr *TLSA) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l++ // Usage - l++ // Selector - l++ // MatchingType - l += len(rr.Certificate) / 2 - return l -} -func (rr *TSIG) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += domainNameLen(rr.Algorithm, off+l, compression, false) - l += 6 // TimeSigned - l += 2 // Fudge - l += 2 // MACSize - l += len(rr.MAC) / 2 - l += 2 // OrigId - l += 2 // Error - l += 2 // OtherLen - l += len(rr.OtherData) / 2 - return l -} -func (rr *TXT) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - for _, x := range rr.Txt { - l += len(x) + 1 - } - return l -} -func (rr *UID) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 4 // Uid - return l -} -func (rr *UINFO) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.Uinfo) + 1 - return l -} -func (rr *URI) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += 2 // Priority - l += 2 // Weight - l += len(rr.Target) - return l -} -func (rr *X25) len(off int, compression map[string]struct{}) int { - l := rr.Hdr.len(off, compression) - l += len(rr.PSDNAddress) + 1 - return l -} - -// copy() functions -func (rr *A) copy() RR { - return &A{rr.Hdr, copyIP(rr.A)} -} -func (rr *AAAA) copy() RR { - return &AAAA{rr.Hdr, copyIP(rr.AAAA)} -} -func (rr *AFSDB) copy() RR { - return &AFSDB{rr.Hdr, rr.Subtype, rr.Hostname} -} -func (rr *ANY) copy() RR { - return &ANY{rr.Hdr} -} -func (rr *AVC) copy() RR { - Txt := make([]string, len(rr.Txt)) - copy(Txt, rr.Txt) - return &AVC{rr.Hdr, Txt} -} -func (rr *CAA) copy() RR { - return &CAA{rr.Hdr, rr.Flag, rr.Tag, rr.Value} -} -func (rr *CERT) copy() RR { - return &CERT{rr.Hdr, rr.Type, rr.KeyTag, rr.Algorithm, rr.Certificate} -} -func (rr *CNAME) copy() RR { - return &CNAME{rr.Hdr, rr.Target} -} -func (rr *CSYNC) copy() RR { - TypeBitMap := make([]uint16, len(rr.TypeBitMap)) - copy(TypeBitMap, rr.TypeBitMap) - return &CSYNC{rr.Hdr, rr.Serial, rr.Flags, TypeBitMap} -} -func (rr *DHCID) copy() RR { - return &DHCID{rr.Hdr, rr.Digest} -} -func (rr *DNAME) copy() RR { - return &DNAME{rr.Hdr, rr.Target} -} -func (rr *DNSKEY) copy() RR { - return &DNSKEY{rr.Hdr, rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey} -} -func (rr *DS) copy() RR { - return &DS{rr.Hdr, rr.KeyTag, rr.Algorithm, rr.DigestType, rr.Digest} -} -func (rr *EID) copy() RR { - return &EID{rr.Hdr, rr.Endpoint} -} -func (rr *EUI48) copy() RR { - return &EUI48{rr.Hdr, rr.Address} -} -func (rr *EUI64) copy() RR { - return &EUI64{rr.Hdr, rr.Address} -} -func (rr *GID) copy() RR { - return &GID{rr.Hdr, rr.Gid} -} -func (rr *GPOS) copy() RR { - return &GPOS{rr.Hdr, rr.Longitude, rr.Latitude, rr.Altitude} -} -func (rr *HINFO) copy() RR { - return &HINFO{rr.Hdr, rr.Cpu, rr.Os} -} -func (rr *HIP) copy() RR { - RendezvousServers := make([]string, len(rr.RendezvousServers)) - copy(RendezvousServers, rr.RendezvousServers) - return &HIP{rr.Hdr, rr.HitLength, rr.PublicKeyAlgorithm, rr.PublicKeyLength, rr.Hit, rr.PublicKey, RendezvousServers} -} -func (rr *KX) copy() RR { - return &KX{rr.Hdr, rr.Preference, rr.Exchanger} -} -func (rr *L32) copy() RR { - return &L32{rr.Hdr, rr.Preference, copyIP(rr.Locator32)} -} -func (rr *L64) copy() RR { - return &L64{rr.Hdr, rr.Preference, rr.Locator64} -} -func (rr *LOC) copy() RR { - return &LOC{rr.Hdr, rr.Version, rr.Size, rr.HorizPre, rr.VertPre, rr.Latitude, rr.Longitude, rr.Altitude} -} -func (rr *LP) copy() RR { - return &LP{rr.Hdr, rr.Preference, rr.Fqdn} -} -func (rr *MB) copy() RR { - return &MB{rr.Hdr, rr.Mb} -} -func (rr *MD) copy() RR { - return &MD{rr.Hdr, rr.Md} -} -func (rr *MF) copy() RR { - return &MF{rr.Hdr, rr.Mf} -} -func (rr *MG) copy() RR { - return &MG{rr.Hdr, rr.Mg} -} -func (rr *MINFO) copy() RR { - return &MINFO{rr.Hdr, rr.Rmail, rr.Email} -} -func (rr *MR) copy() RR { - return &MR{rr.Hdr, rr.Mr} -} -func (rr *MX) copy() RR { - return &MX{rr.Hdr, rr.Preference, rr.Mx} -} -func (rr *NAPTR) copy() RR { - return &NAPTR{rr.Hdr, rr.Order, rr.Preference, rr.Flags, rr.Service, rr.Regexp, rr.Replacement} -} -func (rr *NID) copy() RR { - return &NID{rr.Hdr, rr.Preference, rr.NodeID} -} -func (rr *NIMLOC) copy() RR { - return &NIMLOC{rr.Hdr, rr.Locator} -} -func (rr *NINFO) copy() RR { - ZSData := make([]string, len(rr.ZSData)) - copy(ZSData, rr.ZSData) - return &NINFO{rr.Hdr, ZSData} -} -func (rr *NS) copy() RR { - return &NS{rr.Hdr, rr.Ns} -} -func (rr *NSAPPTR) copy() RR { - return &NSAPPTR{rr.Hdr, rr.Ptr} -} -func (rr *NSEC) copy() RR { - TypeBitMap := make([]uint16, len(rr.TypeBitMap)) - copy(TypeBitMap, rr.TypeBitMap) - return &NSEC{rr.Hdr, rr.NextDomain, TypeBitMap} -} -func (rr *NSEC3) copy() RR { - TypeBitMap := make([]uint16, len(rr.TypeBitMap)) - copy(TypeBitMap, rr.TypeBitMap) - return &NSEC3{rr.Hdr, rr.Hash, rr.Flags, rr.Iterations, rr.SaltLength, rr.Salt, rr.HashLength, rr.NextDomain, TypeBitMap} -} -func (rr *NSEC3PARAM) copy() RR { - return &NSEC3PARAM{rr.Hdr, rr.Hash, rr.Flags, rr.Iterations, rr.SaltLength, rr.Salt} -} -func (rr *NULL) copy() RR { - return &NULL{rr.Hdr, rr.Data} -} -func (rr *OPENPGPKEY) copy() RR { - return &OPENPGPKEY{rr.Hdr, rr.PublicKey} -} -func (rr *OPT) copy() RR { - Option := make([]EDNS0, len(rr.Option)) - for i, e := range rr.Option { - Option[i] = e.copy() - } - return &OPT{rr.Hdr, Option} -} -func (rr *PTR) copy() RR { - return &PTR{rr.Hdr, rr.Ptr} -} -func (rr *PX) copy() RR { - return &PX{rr.Hdr, rr.Preference, rr.Map822, rr.Mapx400} -} -func (rr *RFC3597) copy() RR { - return &RFC3597{rr.Hdr, rr.Rdata} -} -func (rr *RKEY) copy() RR { - return &RKEY{rr.Hdr, rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey} -} -func (rr *RP) copy() RR { - return &RP{rr.Hdr, rr.Mbox, rr.Txt} -} -func (rr *RRSIG) copy() RR { - return &RRSIG{rr.Hdr, rr.TypeCovered, rr.Algorithm, rr.Labels, rr.OrigTtl, rr.Expiration, rr.Inception, rr.KeyTag, rr.SignerName, rr.Signature} -} -func (rr *RT) copy() RR { - return &RT{rr.Hdr, rr.Preference, rr.Host} -} -func (rr *SMIMEA) copy() RR { - return &SMIMEA{rr.Hdr, rr.Usage, rr.Selector, rr.MatchingType, rr.Certificate} -} -func (rr *SOA) copy() RR { - return &SOA{rr.Hdr, rr.Ns, rr.Mbox, rr.Serial, rr.Refresh, rr.Retry, rr.Expire, rr.Minttl} -} -func (rr *SPF) copy() RR { - Txt := make([]string, len(rr.Txt)) - copy(Txt, rr.Txt) - return &SPF{rr.Hdr, Txt} -} -func (rr *SRV) copy() RR { - return &SRV{rr.Hdr, rr.Priority, rr.Weight, rr.Port, rr.Target} -} -func (rr *SSHFP) copy() RR { - return &SSHFP{rr.Hdr, rr.Algorithm, rr.Type, rr.FingerPrint} -} -func (rr *TA) copy() RR { - return &TA{rr.Hdr, rr.KeyTag, rr.Algorithm, rr.DigestType, rr.Digest} -} -func (rr *TALINK) copy() RR { - return &TALINK{rr.Hdr, rr.PreviousName, rr.NextName} -} -func (rr *TKEY) copy() RR { - return &TKEY{rr.Hdr, rr.Algorithm, rr.Inception, rr.Expiration, rr.Mode, rr.Error, rr.KeySize, rr.Key, rr.OtherLen, rr.OtherData} -} -func (rr *TLSA) copy() RR { - return &TLSA{rr.Hdr, rr.Usage, rr.Selector, rr.MatchingType, rr.Certificate} -} -func (rr *TSIG) copy() RR { - return &TSIG{rr.Hdr, rr.Algorithm, rr.TimeSigned, rr.Fudge, rr.MACSize, rr.MAC, rr.OrigId, rr.Error, rr.OtherLen, rr.OtherData} -} -func (rr *TXT) copy() RR { - Txt := make([]string, len(rr.Txt)) - copy(Txt, rr.Txt) - return &TXT{rr.Hdr, Txt} -} -func (rr *UID) copy() RR { - return &UID{rr.Hdr, rr.Uid} -} -func (rr *UINFO) copy() RR { - return &UINFO{rr.Hdr, rr.Uinfo} -} -func (rr *URI) copy() RR { - return &URI{rr.Hdr, rr.Priority, rr.Weight, rr.Target} -} -func (rr *X25) copy() RR { - return &X25{rr.Hdr, rr.PSDNAddress} -} diff --git a/vendor/github.com/minio/blake2b-simd/.gitignore b/vendor/github.com/minio/blake2b-simd/.gitignore deleted file mode 100644 index c56069fe..00000000 --- a/vendor/github.com/minio/blake2b-simd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.test \ No newline at end of file diff --git a/vendor/github.com/minio/blake2b-simd/.travis.yml b/vendor/github.com/minio/blake2b-simd/.travis.yml deleted file mode 100644 index 545066eb..00000000 --- a/vendor/github.com/minio/blake2b-simd/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: required -dist: trusty -language: go - -os: -- linux -- osx - -osx_image: xcode7.2 - -go: -- 1.6 -- 1.5 - -env: -- ARCH=x86_64 -- ARCH=i686 - -script: -- diff -au <(gofmt -d .) <(printf "") -- go test -race -v ./... diff --git a/vendor/github.com/minio/blake2b-simd/LICENSE b/vendor/github.com/minio/blake2b-simd/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/minio/blake2b-simd/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/minio/blake2b-simd/README.md b/vendor/github.com/minio/blake2b-simd/README.md deleted file mode 100644 index 31fcbf74..00000000 --- a/vendor/github.com/minio/blake2b-simd/README.md +++ /dev/null @@ -1,144 +0,0 @@ -BLAKE2b-SIMD -============ - -Pure Go implementation of BLAKE2b using SIMD optimizations. - -Introduction ------------- - -This package was initially based on the pure go [BLAKE2b](https://github.com/dchest/blake2b) implementation of Dmitry Chestnykh and merged with the (`cgo` dependent) AVX optimized [BLAKE2](https://github.com/codahale/blake2) implementation (which in turn is based on the [official implementation](https://github.com/BLAKE2/BLAKE2). It does so by using [Go's Assembler](https://golang.org/doc/asm) for amd64 architectures with a golang only fallback for other architectures. - -In addition to AVX there is also support for AVX2 as well as SSE. Best performance is obtained with AVX2 which gives roughly a **4X** performance increase approaching hashing speeds of **1GB/sec** on a single core. - -Benchmarks ----------- - -This is a summary of the performance improvements. Full details are shown below. - -| Technology | 128K | -| ---------- |:-----:| -| AVX2 | 3.94x | -| AVX | 3.28x | -| SSE | 2.85x | - -asm2plan9s ----------- - -In order to be able to work more easily with AVX2/AVX instructions, a separate tool was developed to convert AVX2/AVX instructions into the corresponding BYTE sequence as accepted by Go assembly. See [asm2plan9s](https://github.com/minio/asm2plan9s) for more information. - -bt2sum ------- - -[bt2sum](https://github.com/s3git/bt2sum) is a utility that takes advantages of the BLAKE2b SIMD optimizations to compute check sums using the BLAKE2 Tree hashing mode in so called 'unlimited fanout' mode. - -Technical details ------------------ - -BLAKE2b is a hashing algorithm that operates on 64-bit integer values. The AVX2 version uses the 256-bit wide YMM registers in order to essentially process four operations in parallel. AVX and SSE operate on 128-bit values simultaneously (two operations in parallel). Below are excerpts from `compressAvx2_amd64.s`, `compressAvx_amd64.s`, and `compress_generic.go` respectively. - -``` - VPADDQ YMM0,YMM0,YMM1 /* v0 += v4, v1 += v5, v2 += v6, v3 += v7 */ -``` - -``` - VPADDQ XMM0,XMM0,XMM2 /* v0 += v4, v1 += v5 */ - VPADDQ XMM1,XMM1,XMM3 /* v2 += v6, v3 += v7 */ -``` - -``` - v0 += v4 - v1 += v5 - v2 += v6 - v3 += v7 -``` - -Detailed benchmarks -------------------- - -Example performance metrics were generated on Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz - 6 physical cores, 12 logical cores running Ubuntu GNU/Linux with kernel version 4.4.0-24-generic (vanilla with no optimizations). - -### AVX2 - -``` -$ benchcmp go.txt avx2.txt -benchmark old ns/op new ns/op delta -BenchmarkHash64-12 1481 849 -42.67% -BenchmarkHash128-12 1428 746 -47.76% -BenchmarkHash1K-12 6379 2227 -65.09% -BenchmarkHash8K-12 37219 11714 -68.53% -BenchmarkHash32K-12 140716 35935 -74.46% -BenchmarkHash128K-12 561656 142634 -74.60% - -benchmark old MB/s new MB/s speedup -BenchmarkHash64-12 43.20 75.37 1.74x -BenchmarkHash128-12 89.64 171.35 1.91x -BenchmarkHash1K-12 160.52 459.69 2.86x -BenchmarkHash8K-12 220.10 699.32 3.18x -BenchmarkHash32K-12 232.87 911.85 3.92x -BenchmarkHash128K-12 233.37 918.93 3.94x -``` - -### AVX2: Comparison to other hashing techniques - -``` -$ go test -bench=Comparison -BenchmarkComparisonMD5-12 1000 1726121 ns/op 607.48 MB/s -BenchmarkComparisonSHA1-12 500 2005164 ns/op 522.94 MB/s -BenchmarkComparisonSHA256-12 300 5531036 ns/op 189.58 MB/s -BenchmarkComparisonSHA512-12 500 3423030 ns/op 306.33 MB/s -BenchmarkComparisonBlake2B-12 1000 1232690 ns/op 850.64 MB/s -``` - -Benchmarks below were generated on a MacBook Pro with a 2.7 GHz Intel Core i7. - -### AVX - -``` -$ benchcmp go.txt avx.txt -benchmark old ns/op new ns/op delta -BenchmarkHash64-8 813 458 -43.67% -BenchmarkHash128-8 766 401 -47.65% -BenchmarkHash1K-8 4881 1763 -63.88% -BenchmarkHash8K-8 36127 12273 -66.03% -BenchmarkHash32K-8 140582 43155 -69.30% -BenchmarkHash128K-8 567850 173246 -69.49% - -benchmark old MB/s new MB/s speedup -BenchmarkHash64-8 78.63 139.57 1.78x -BenchmarkHash128-8 166.98 318.73 1.91x -BenchmarkHash1K-8 209.76 580.68 2.77x -BenchmarkHash8K-8 226.76 667.46 2.94x -BenchmarkHash32K-8 233.09 759.29 3.26x -BenchmarkHash128K-8 230.82 756.56 3.28x -``` - -### SSE - -``` -$ benchcmp go.txt sse.txt -benchmark old ns/op new ns/op delta -BenchmarkHash64-8 813 478 -41.21% -BenchmarkHash128-8 766 411 -46.34% -BenchmarkHash1K-8 4881 1870 -61.69% -BenchmarkHash8K-8 36127 12427 -65.60% -BenchmarkHash32K-8 140582 49512 -64.78% -BenchmarkHash128K-8 567850 199040 -64.95% - -benchmark old MB/s new MB/s speedup -BenchmarkHash64-8 78.63 133.78 1.70x -BenchmarkHash128-8 166.98 311.23 1.86x -BenchmarkHash1K-8 209.76 547.37 2.61x -BenchmarkHash8K-8 226.76 659.20 2.91x -BenchmarkHash32K-8 233.09 661.81 2.84x -BenchmarkHash128K-8 230.82 658.52 2.85x -``` - -License -------- - -Released under the Apache License v2.0. You can find the complete text in the file LICENSE. - -Contributing ------------- - -Contributions are welcome, please send PRs for any enhancements. diff --git a/vendor/github.com/minio/blake2b-simd/appveyor.yml b/vendor/github.com/minio/blake2b-simd/appveyor.yml deleted file mode 100644 index 77595feb..00000000 --- a/vendor/github.com/minio/blake2b-simd/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -# Platform. -platform: x64 - -clone_folder: c:\gopath\src\github.com\minio\blake2b-simd - -# environment variables -environment: - GOPATH: c:\gopath - GO15VENDOREXPERIMENT: 1 - -# scripts that run after cloning repository -install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - - go version - - go env - -# to run your custom scripts instead of automatic MSBuild -build_script: - - go test . - - go test -race . - -# to disable automatic tests -test: off - -# to disable deployment -deploy: off diff --git a/vendor/github.com/minio/blake2b-simd/blake2b.go b/vendor/github.com/minio/blake2b-simd/blake2b.go deleted file mode 100644 index 538466a1..00000000 --- a/vendor/github.com/minio/blake2b-simd/blake2b.go +++ /dev/null @@ -1,301 +0,0 @@ -// Written in 2012 by Dmitry Chestnykh. -// -// To the extent possible under law, the author have dedicated all copyright -// and related and neighboring rights to this software to the public domain -// worldwide. This software is distributed without any warranty. -// http://creativecommons.org/publicdomain/zero/1.0/ - -// Package blake2b implements BLAKE2b cryptographic hash function. -package blake2b - -import ( - "encoding/binary" - "errors" - "hash" -) - -const ( - BlockSize = 128 // block size of algorithm - Size = 64 // maximum digest size - SaltSize = 16 // maximum salt size - PersonSize = 16 // maximum personalization string size - KeySize = 64 // maximum size of key -) - -type digest struct { - h [8]uint64 // current chain value - t [2]uint64 // message bytes counter - f [2]uint64 // finalization flags - x [BlockSize]byte // buffer for data not yet compressed - nx int // number of bytes in buffer - - ih [8]uint64 // initial chain value (after config) - paddedKey [BlockSize]byte // copy of key, padded with zeros - isKeyed bool // indicates whether hash was keyed - size uint8 // digest size in bytes - isLastNode bool // indicates processing of the last node in tree hashing -} - -// Initialization values. -var iv = [8]uint64{ - 0x6a09e667f3bcc908, 0xbb67ae8584caa73b, - 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, - 0x510e527fade682d1, 0x9b05688c2b3e6c1f, - 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179, -} - -// Config is used to configure hash function parameters and keying. -// All parameters are optional. -type Config struct { - Size uint8 // digest size (if zero, default size of 64 bytes is used) - Key []byte // key for prefix-MAC - Salt []byte // salt (if < 16 bytes, padded with zeros) - Person []byte // personalization (if < 16 bytes, padded with zeros) - Tree *Tree // parameters for tree hashing -} - -// Tree represents parameters for tree hashing. -type Tree struct { - Fanout uint8 // fanout - MaxDepth uint8 // maximal depth - LeafSize uint32 // leaf maximal byte length (0 for unlimited) - NodeOffset uint64 // node offset (0 for first, leftmost or leaf) - NodeDepth uint8 // node depth (0 for leaves) - InnerHashSize uint8 // inner hash byte length - IsLastNode bool // indicates processing of the last node of layer -} - -var ( - defaultConfig = &Config{Size: Size} - config256 = &Config{Size: 32} -) - -func verifyConfig(c *Config) error { - if c.Size > Size { - return errors.New("digest size is too large") - } - if len(c.Key) > KeySize { - return errors.New("key is too large") - } - if len(c.Salt) > SaltSize { - // Smaller salt is okay: it will be padded with zeros. - return errors.New("salt is too large") - } - if len(c.Person) > PersonSize { - // Smaller personalization is okay: it will be padded with zeros. - return errors.New("personalization is too large") - } - if c.Tree != nil { - if c.Tree.Fanout == 1 { - return errors.New("fanout of 1 is not allowed in tree mode") - } - if c.Tree.MaxDepth < 2 { - return errors.New("incorrect tree depth") - } - if c.Tree.InnerHashSize < 1 || c.Tree.InnerHashSize > Size { - return errors.New("incorrect tree inner hash size") - } - } - return nil -} - -// New returns a new hash.Hash configured with the given Config. -// Config can be nil, in which case the default one is used, calculating 64-byte digest. -// Returns non-nil error if Config contains invalid parameters. -func New(c *Config) (hash.Hash, error) { - if c == nil { - c = defaultConfig - } else { - if c.Size == 0 { - // Set default size if it's zero. - c.Size = Size - } - if err := verifyConfig(c); err != nil { - return nil, err - } - } - d := new(digest) - d.initialize(c) - return d, nil -} - -// initialize initializes digest with the given -// config, which must be non-nil and verified. -func (d *digest) initialize(c *Config) { - // Create parameter block. - var p [BlockSize]byte - p[0] = c.Size - p[1] = uint8(len(c.Key)) - if c.Salt != nil { - copy(p[32:], c.Salt) - } - if c.Person != nil { - copy(p[48:], c.Person) - } - if c.Tree != nil { - p[2] = c.Tree.Fanout - p[3] = c.Tree.MaxDepth - binary.LittleEndian.PutUint32(p[4:], c.Tree.LeafSize) - binary.LittleEndian.PutUint64(p[8:], c.Tree.NodeOffset) - p[16] = c.Tree.NodeDepth - p[17] = c.Tree.InnerHashSize - } else { - p[2] = 1 - p[3] = 1 - } - - // Initialize. - d.size = c.Size - for i := 0; i < 8; i++ { - d.h[i] = iv[i] ^ binary.LittleEndian.Uint64(p[i*8:]) - } - if c.Tree != nil && c.Tree.IsLastNode { - d.isLastNode = true - } - - // Process key. - if c.Key != nil { - copy(d.paddedKey[:], c.Key) - d.Write(d.paddedKey[:]) - d.isKeyed = true - } - // Save a copy of initialized state. - copy(d.ih[:], d.h[:]) -} - -// New512 returns a new hash.Hash computing the BLAKE2b 64-byte checksum. -func New512() hash.Hash { - d := new(digest) - d.initialize(defaultConfig) - return d -} - -// New256 returns a new hash.Hash computing the BLAKE2b 32-byte checksum. -func New256() hash.Hash { - d := new(digest) - d.initialize(config256) - return d -} - -// NewMAC returns a new hash.Hash computing BLAKE2b prefix- -// Message Authentication Code of the given size in bytes -// (up to 64) with the given key (up to 64 bytes in length). -func NewMAC(outBytes uint8, key []byte) hash.Hash { - d, err := New(&Config{Size: outBytes, Key: key}) - if err != nil { - panic(err.Error()) - } - return d -} - -// Reset resets the state of digest to the initial state -// after configuration and keying. -func (d *digest) Reset() { - copy(d.h[:], d.ih[:]) - d.t[0] = 0 - d.t[1] = 0 - d.f[0] = 0 - d.f[1] = 0 - d.nx = 0 - if d.isKeyed { - d.Write(d.paddedKey[:]) - } -} - -// Size returns the digest size in bytes. -func (d *digest) Size() int { return int(d.size) } - -// BlockSize returns the algorithm block size in bytes. -func (d *digest) BlockSize() int { return BlockSize } - -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - left := BlockSize - d.nx - if len(p) > left { - // Process buffer. - copy(d.x[d.nx:], p[:left]) - p = p[left:] - compress(d, d.x[:]) - d.nx = 0 - } - // Process full blocks except for the last one. - if len(p) > BlockSize { - n := len(p) &^ (BlockSize - 1) - if n == len(p) { - n -= BlockSize - } - compress(d, p[:n]) - p = p[n:] - } - // Fill buffer. - d.nx += copy(d.x[d.nx:], p) - return -} - -// Sum returns the calculated checksum. -func (d *digest) Sum(in []byte) []byte { - // Make a copy of d so that caller can keep writing and summing. - d0 := *d - hash := d0.checkSum() - return append(in, hash[:d0.size]...) -} - -func (d *digest) checkSum() [Size]byte { - // Do not create unnecessary copies of the key. - if d.isKeyed { - for i := 0; i < len(d.paddedKey); i++ { - d.paddedKey[i] = 0 - } - } - - dec := BlockSize - uint64(d.nx) - if d.t[0] < dec { - d.t[1]-- - } - d.t[0] -= dec - - // Pad buffer with zeros. - for i := d.nx; i < len(d.x); i++ { - d.x[i] = 0 - } - // Set last block flag. - d.f[0] = 0xffffffffffffffff - if d.isLastNode { - d.f[1] = 0xffffffffffffffff - } - // Compress last block. - compress(d, d.x[:]) - - var out [Size]byte - j := 0 - for _, s := range d.h[:(d.size-1)/8+1] { - out[j+0] = byte(s >> 0) - out[j+1] = byte(s >> 8) - out[j+2] = byte(s >> 16) - out[j+3] = byte(s >> 24) - out[j+4] = byte(s >> 32) - out[j+5] = byte(s >> 40) - out[j+6] = byte(s >> 48) - out[j+7] = byte(s >> 56) - j += 8 - } - return out -} - -// Sum512 returns a 64-byte BLAKE2b hash of data. -func Sum512(data []byte) [64]byte { - var d digest - d.initialize(defaultConfig) - d.Write(data) - return d.checkSum() -} - -// Sum256 returns a 32-byte BLAKE2b hash of data. -func Sum256(data []byte) (out [32]byte) { - var d digest - d.initialize(config256) - d.Write(data) - sum := d.checkSum() - copy(out[:], sum[:32]) - return -} diff --git a/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.go b/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.go deleted file mode 100644 index ec53599f..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.go +++ /dev/null @@ -1,47 +0,0 @@ -//+build !noasm -//+build !appengine - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package blake2b - -//go:noescape -func compressAVX2Loop(p []uint8, in, iv, t, f, shffle, out []uint64) - -func compressAVX2(d *digest, p []uint8) { - var ( - in [8]uint64 - out [8]uint64 - shffle [8]uint64 - ) - - // vector for PSHUFB instruction - shffle[0] = 0x0201000706050403 - shffle[1] = 0x0a09080f0e0d0c0b - shffle[2] = 0x0201000706050403 - shffle[3] = 0x0a09080f0e0d0c0b - shffle[4] = 0x0100070605040302 - shffle[5] = 0x09080f0e0d0c0b0a - shffle[6] = 0x0100070605040302 - shffle[7] = 0x09080f0e0d0c0b0a - - in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7] = d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] - - compressAVX2Loop(p, in[:], iv[:], d.t[:], d.f[:], shffle[:], out[:]) - - d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] = out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7] -} diff --git a/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.s b/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.s deleted file mode 100644 index 24df234b..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressAvx2_amd64.s +++ /dev/null @@ -1,671 +0,0 @@ -//+build !noasm !appengine - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// Based on AVX2 implementation from https://github.com/sneves/blake2-avx2/blob/master/blake2b-common.h -// -// Use github.com/fwessels/asm2plan9s on this file to assemble instructions to their Plan9 equivalent -// -// Assembly code below essentially follows the ROUND macro (see blake2b-round.h) which is defined as: -// #define ROUND(r) \ -// LOAD_MSG_ ##r ##_1(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_2(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); \ -// LOAD_MSG_ ##r ##_3(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_4(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// UNDIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); -// -// as well as the go equivalent in https://github.com/dchest/blake2b/blob/master/block.go -// -// As in the macro, G1/G2 in the 1st and 2nd half are identical (so literal copy of assembly) -// -// Rounds are also the same, except for the loading of the message (and rounds 1 & 11 and -// rounds 2 & 12 are identical) -// - -#define G1 \ - \ // G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); - BYTE $0xc5; BYTE $0xfd; BYTE $0xd4; BYTE $0xc4 \ // VPADDQ YMM0,YMM0,YMM4 /* v0 += m[0], v1 += m[2], v2 += m[4], v3 += m[6] */ - BYTE $0xc5; BYTE $0xfd; BYTE $0xd4; BYTE $0xc1 \ // VPADDQ YMM0,YMM0,YMM1 /* v0 += v4, v1 += v5, v2 += v6, v3 += v7 */ - BYTE $0xc5; BYTE $0xe5; BYTE $0xef; BYTE $0xd8 \ // VPXOR YMM3,YMM3,YMM0 /* v12 ^= v0, v13 ^= v1, v14 ^= v2, v15 ^= v3 */ - BYTE $0xc5; BYTE $0xfd; BYTE $0x70; BYTE $0xdb; BYTE $0xb1 \ // VPSHUFD YMM3,YMM3,0xb1 /* v12 = v12<<(64-32) | v12>>32, v13 = */ - BYTE $0xc5; BYTE $0xed; BYTE $0xd4; BYTE $0xd3 \ // VPADDQ YMM2,YMM2,YMM3 /* v8 += v12, v9 += v13, v10 += v14, v11 += v15 */ - BYTE $0xc5; BYTE $0xf5; BYTE $0xef; BYTE $0xca \ // VPXOR YMM1,YMM1,YMM2 /* v4 ^= v8, v5 ^= v9, v6 ^= v10, v7 ^= v11 */ - BYTE $0xc4; BYTE $0xe2; BYTE $0x75; BYTE $0x00; BYTE $0xce // VPSHUFB YMM1,YMM1,YMM6 /* v4 = v4<<(64-24) | v4>>24, ..., ..., v7 = v7<<(64-24) | v7>>24 */ - -#define G2 \ - BYTE $0xc5; BYTE $0xfd; BYTE $0xd4; BYTE $0xc5 \ // VPADDQ YMM0,YMM0,YMM5 /* v0 += m[1], v1 += m[3], v2 += m[5], v3 += m[7] */ - BYTE $0xc5; BYTE $0xfd; BYTE $0xd4; BYTE $0xc1 \ // VPADDQ YMM0,YMM0,YMM1 /* v0 += v4, v1 += v5, v2 += v6, v3 += v7 */ - BYTE $0xc5; BYTE $0xe5; BYTE $0xef; BYTE $0xd8 \ // VPXOR YMM3,YMM3,YMM0 /* v12 ^= v0, v13 ^= v1, v14 ^= v2, v15 ^= v3 */ - BYTE $0xc4; BYTE $0xe2; BYTE $0x65; BYTE $0x00; BYTE $0xdf \ // VPSHUFB YMM3,YMM3,YMM7 /* v12 = v12<<(64-16) | v12>>16, ..., ..., v15 = v15<<(64-16) | v15>>16 */ - BYTE $0xc5; BYTE $0xed; BYTE $0xd4; BYTE $0xd3 \ // VPADDQ YMM2,YMM2,YMM3 /* v8 += v12, v9 += v13, v10 += v14, v11 += v15 */ - BYTE $0xc5; BYTE $0xf5; BYTE $0xef; BYTE $0xca \ // VPXOR YMM1,YMM1,YMM2 /* v4 ^= v8, v5 ^= v9, v6 ^= v10, v7 ^= v11 */ - BYTE $0xc5; BYTE $0x75; BYTE $0xd4; BYTE $0xf9 \ // VPADDQ YMM15,YMM1,YMM1 /* temp reg = reg*2 */ - BYTE $0xc5; BYTE $0xf5; BYTE $0x73; BYTE $0xd1; BYTE $0x3f \ // VPSRLQ YMM1,YMM1,0x3f /* reg = reg>>63 */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x75; BYTE $0xef; BYTE $0xcf // VPXOR YMM1,YMM1,YMM15 /* ORed together: v4 = v4<<(64-63) | v4>>63, v5 = v5<<(64-63) | v5>>63 */ - -#define DIAGONALIZE \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb \ // VPERMQ YMM3, YMM3, 0x93 - BYTE $0x93 \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2 \ // VPERMQ YMM2, YMM2, 0x4e - BYTE $0x4e \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 \ // VPERMQ YMM1, YMM1, 0x39 - BYTE $0x39 \ - // DO NOT DELETE -- macro delimiter (previous line extended) - -#define UNDIAGONALIZE \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xdb \ // VPERMQ YMM3, YMM3, 0x39 - BYTE $0x39 \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xd2 \ // VPERMQ YMM2, YMM2, 0x4e - BYTE $0x4e \ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 \ // VPERMQ YMM1, YMM1, 0x93 - BYTE $0x93 \ - // DO NOT DELETE -- macro delimiter (previous line extended) - -#define LOAD_SHUFFLE \ - MOVQ shffle+120(FP), SI \ // SI: &shuffle - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x36 \ // VMOVDQU YMM6, [rsi] - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x7e; BYTE $0x20 // VMOVDQU YMM7, 32[rsi] - -// func compressAVX2Loop(compressSSE(p []uint8, in, iv, t, f, shffle, out []uint64) -TEXT ·compressAVX2Loop(SB), 7, $0 - - // REGISTER USE - // Y0 - Y3: v0 - v15 - // Y4 - Y5: m[0] - m[7] - // Y6 - Y7: shuffle value - // Y8 - Y9: temp registers - // Y10 -Y13: copy of full message - // Y15: temp register - - // Load digest - MOVQ in+24(FP), SI // SI: &in - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x06 // VMOVDQU YMM0, [rsi] - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x4e; BYTE $0x20 // VMOVDQU YMM1, 32[rsi] - - // Already store digest into &out (so we can reload it later generically) - MOVQ out+144(FP), SI // SI: &out - BYTE $0xc5; BYTE $0xfe; BYTE $0x7f; BYTE $0x06 // VMOVDQU [rsi], YMM0 - BYTE $0xc5; BYTE $0xfe; BYTE $0x7f; BYTE $0x4e; BYTE $0x20 // VMOVDQU 32[rsi], YMM1 - - // Initialize message pointer and loop counter - MOVQ message+0(FP), DX // DX: &p (message) - MOVQ message_len+8(FP), R8 // R8: len(message) - SHRQ $7, R8 // len(message) / 128 - CMPQ R8, $0 - JEQ complete - -loop: - // Increment counter - MOVQ t+72(FP), SI // SI: &t - MOVQ 0(SI), R9 // - ADDQ $128, R9 // /* d.t[0] += BlockSize */ - MOVQ R9, 0(SI) // - CMPQ R9, $128 // /* if d.t[0] < BlockSize { */ - JGE noincr // - MOVQ 8(SI), R9 // - ADDQ $1, R9 // /* d.t[1]++ */ - MOVQ R9, 8(SI) // -noincr: // /* } */ - - // Load initialization vector - MOVQ iv+48(FP), SI // SI: &iv - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x16 // VMOVDQU YMM2, [rsi] - BYTE $0xc5; BYTE $0xfe; BYTE $0x6f; BYTE $0x5e; BYTE $0x20 // VMOVDQU YMM3, 32[rsi] - MOVQ t+72(FP), SI // SI: &t - BYTE $0xc4; BYTE $0x63; BYTE $0x3d; BYTE $0x38; BYTE $0x06 // VINSERTI128 YMM8, YMM8, [rsi], 0 /* Y8 = t[0]+t[1] */ - BYTE $0x00 - MOVQ t+96(FP), SI // SI: &f - BYTE $0xc4; BYTE $0x63; BYTE $0x3d; BYTE $0x38; BYTE $0x06 // VINSERTI128 YMM8, YMM8, [rsi], 1 /* Y8 = t[0]+t[1]+f[0]+f[1] */ - BYTE $0x01 - BYTE $0xc4; BYTE $0xc1; BYTE $0x65; BYTE $0xef; BYTE $0xd8 // VPXOR YMM3,YMM3,YMM8 /* Y3 = Y3 ^ Y8 */ - - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x12 // VMOVDQU YMM10, [rdx] /* Y10 = m[0]+ m[1]+ m[2]+ m[3] */ - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x5a; BYTE $0x20 // VMOVDQU YMM11, 32[rdx] /* Y11 = m[4]+ m[5]+ m[6]+ m[7] */ - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x62; BYTE $0x40 // VMOVDQU YMM12, 64[rdx] /* Y12 = m[8]+ m[9]+m[10]+m[11] */ - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x6a; BYTE $0x60 // VMOVDQU YMM13, 96[rdx] /* Y13 = m[12]+m[13]+m[14]+m[15] */ - - LOAD_SHUFFLE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0xc1; BYTE $0x2d; BYTE $0x6c; BYTE $0xe3 // VPUNPCKLQDQ YMM4, YMM10, YMM11 /* m[0], m[4], m[2], m[6] */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x2d; BYTE $0x6d; BYTE $0xeb // VPUNPCKHQDQ YMM5, YMM10, YMM11 /* m[1], m[5], m[3], m[7] */ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xe4 // VPERMQ YMM4, YMM4, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xed // VPERMQ YMM5, YMM5, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0xc1; BYTE $0x1d; BYTE $0x6c; BYTE $0xe5 // VPUNPCKLQDQ YMM4, YMM12, YMM13 /* m[8], m[12], m[10], m[14] */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x1d; BYTE $0x6d; BYTE $0xed // VPUNPCKHQDQ YMM5, YMM12, YMM13 /* m[9], m[13], m[11], m[15] */ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xe4 // VPERMQ YMM4, YMM4, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xed // VPERMQ YMM5, YMM5, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 2 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc5 // VPUNPCKLQDQ YMM8, YMM11, YMM13 /* m[4], ____, ____, m[14] */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x03 /* m[14], m[4], ____, ____ */ /* xxxx 0011 = 0x03 */ - BYTE $0x03 - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xcd // VPUNPCKHQDQ YMM9, YMM12, YMM13 /* m[9], m[13], ____, ____ */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 /* m[9], m[13], ____, ____ */ /* 0010 0000 = 0x20 */ - BYTE $0x20 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc4 // VPERMQ YMM8, YMM12, 0x02 /* m[10], m[8], ____, ____ */ /* xxxx 0010 = 0x02 */ - BYTE $0x02 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0x30 /* ____, ____, m[15], ____ */ /* xx11 xxxx = 0x30 */ - BYTE $0x30 - BYTE $0xc4; BYTE $0x41; BYTE $0x35; BYTE $0x6c; BYTE $0xcb // VPUNPCKLQDQ YMM9, YMM9, YMM11 /* ____, ____, m[15], m[6] */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 /* m[9], m[13], m[15], m[6] */ /* 0011 0000 = 0x30 */ - BYTE $0x30 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc2 // VPERMQ YMM8, YMM10, 0x01 /* m[1], m[0], ____, ____ */ /* xxxx 0001 = 0x01 */ - BYTE $0x01 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xcc // VPUNPCKHQDQ YMM9, YMM11, YMM12 /* m[5], ____, ____, m[11] */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x03 /* m[11], m[5], ____, ____ */ /* xxxx 0011 = 0x03 */ - BYTE $0x03 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 /* m[1], m[0], m[11], m[5] */ /* 0010 0000 = 0x20 */ - BYTE $0x20 - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc5 // VPUNPCKLQDQ YMM8, YMM10, YMM13 /* ___, m[12], m[2], ____ */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x09 /* m[12], m[2], ____, ____ */ /* xxxx 1001 = 0x09 */ - BYTE $0x09 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xca // VPUNPCKHQDQ YMM9, YMM11, YMM10 /* ____, ____, m[7], m[3] */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 /* m[9], m[13], m[15], m[6] */ /* 0011 0000 = 0x30 */ - BYTE $0x30 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 3 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc5 // VPERMQ YMM8, YMM13, 0x00 - BYTE $0x00 - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc0 // VPUNPCKHQDQ YMM8, YMM12, YMM8 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xcd // VPUNPCKHQDQ YMM9, YMM11, YMM13 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x21 - BYTE $0x21 - - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6c; BYTE $0xc2 // VPUNPCKLQDQ YMM8, YMM12, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0x55 - BYTE $0x55 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM10, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 - BYTE $0x30 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc2 // VPERMQ YMM8, YMM10, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM12, YMM8 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xcc // VPUNPCKHQDQ YMM9, YMM11, YMM12 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x31 - BYTE $0x31 - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc3 // VPUNPCKLQDQ YMM8, YMM13, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcb // VPERMQ YMM9, YMM11, 0x00 - BYTE $0x00 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xc9 // VPUNPCKHQDQ YMM9, YMM10, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x21 - BYTE $0x21 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 4 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xc2 // VPUNPCKHQDQ YMM8, YMM11, YMM10 - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xcc // VPUNPCKHQDQ YMM9, YMM13, YMM12 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x21 - BYTE $0x21 - - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc2 // VPUNPCKHQDQ YMM8, YMM12, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0x08 - BYTE $0x08 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x20 - BYTE $0x20 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc3 // VPERMQ YMM8, YMM11, 0x55 - BYTE $0x55 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM10, YMM8 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM11, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x21 - BYTE $0x21 - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc4 // VPUNPCKLQDQ YMM8, YMM11, YMM12 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xcc // VPUNPCKLQDQ YMM9, YMM10, YMM12 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x21 - BYTE $0x21 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 5 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc3 // VPUNPCKHQDQ YMM8, YMM12, YMM11 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xcc // VPUNPCKLQDQ YMM9, YMM10, YMM12 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x30 - BYTE $0x30 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc3 // VPERMQ YMM8, YMM11, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM10, YMM8 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM11, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x20 - BYTE $0x20 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc4 // VPERMQ YMM8, YMM12, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM13, YMM8 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xca // VPERMQ YMM9, YMM10, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM11, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x31 - BYTE $0x31 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc5 // VPERMQ YMM8, YMM13, 0x00 - BYTE $0x00 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xc0 // VPUNPCKHQDQ YMM8, YMM10, YMM8 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0x55 - BYTE $0x55 - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM12, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x20 - BYTE $0x20 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 6 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc3 // VPUNPCKLQDQ YMM8, YMM10, YMM11 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xcc // VPUNPCKLQDQ YMM9, YMM10, YMM12 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x21 - BYTE $0x21 - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc4 // VPUNPCKLQDQ YMM8, YMM13, YMM12 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xca // VPUNPCKHQDQ YMM9, YMM12, YMM10 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 - BYTE $0x30 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc3 // VPERMQ YMM8, YMM11, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xca // VPUNPCKHQDQ YMM9, YMM13, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x30 - BYTE $0x30 - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xc3 // VPUNPCKHQDQ YMM8, YMM13, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0x55 - BYTE $0x55 - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM13, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 - BYTE $0x30 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 7 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc2 // VPERMQ YMM8, YMM10, 0x55 - BYTE $0x55 - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM13, YMM8 - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xcb // VPUNPCKLQDQ YMM9, YMM13, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x30 - BYTE $0x30 - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xc5 // VPUNPCKHQDQ YMM8, YMM11, YMM13 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0xaa - BYTE $0xaa - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xc9 // VPUNPCKHQDQ YMM9, YMM13, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x20 - BYTE $0x20 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc3 // VPUNPCKLQDQ YMM8, YMM10, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0x01 - BYTE $0x01 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 - BYTE $0x20 - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xc2 // VPUNPCKHQDQ YMM8, YMM11, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM10, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x31 - BYTE $0x31 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 8 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xc3 // VPUNPCKHQDQ YMM8, YMM13, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xca // VPERMQ YMM9, YMM10, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xc9 // VPUNPCKLQDQ YMM9, YMM13, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 - BYTE $0x20 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc5 // VPERMQ YMM8, YMM13, 0xaa - BYTE $0xaa - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc0 // VPUNPCKHQDQ YMM8, YMM12, YMM8 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xcc // VPUNPCKHQDQ YMM9, YMM10, YMM12 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x21 - BYTE $0x21 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xc5 // VPUNPCKHQDQ YMM8, YMM11, YMM13 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6c; BYTE $0xca // VPUNPCKLQDQ YMM9, YMM12, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x0c - BYTE $0x0c - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 - BYTE $0x20 - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc3 // VPUNPCKLQDQ YMM8, YMM10, YMM11 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xcc // VPUNPCKLQDQ YMM9, YMM11, YMM12 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 - BYTE $0x30 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 9 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc5 // VPUNPCKLQDQ YMM8, YMM11, YMM13 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xca // VPERMQ YMM9, YMM10, 0x00 - BYTE $0x00 - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc9 // VPUNPCKHQDQ YMM9, YMM12, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x31 - BYTE $0x31 - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xc4 // VPUNPCKHQDQ YMM8, YMM13, YMM12 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0x00 - BYTE $0x00 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xc9 // VPUNPCKHQDQ YMM9, YMM10, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x31 - BYTE $0x31 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcc // VPERMQ YMM9, YMM12, 0xaa - BYTE $0xaa - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xc9 // VPUNPCKHQDQ YMM9, YMM10, YMM9 - BYTE $0xc4; BYTE $0xc3; BYTE $0x15; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM13, YMM9, 0x20 - BYTE $0x20 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc3 // VPERMQ YMM8, YMM11, 0xff - BYTE $0xff - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc0 // VPUNPCKLQDQ YMM8, YMM10, YMM8 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcb // VPERMQ YMM9, YMM11, 0x04 - BYTE $0x04 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x21 - BYTE $0x21 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 10 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc4 // VPERMQ YMM8, YMM12, 0x20 - BYTE $0x20 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xca // VPUNPCKHQDQ YMM9, YMM11, YMM10 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x31 - BYTE $0x31 - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc3 // VPUNPCKLQDQ YMM8, YMM10, YMM11 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcb // VPERMQ YMM9, YMM11, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x31 - BYTE $0x31 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6d; BYTE $0xc4 // VPUNPCKHQDQ YMM8, YMM13, YMM12 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6d; BYTE $0xcd // VPUNPCKHQDQ YMM9, YMM10, YMM13 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x60 - BYTE $0x60 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x31 - BYTE $0x31 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc5 // VPERMQ YMM8, YMM13, 0xaa - BYTE $0xaa - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xc0 // VPUNPCKHQDQ YMM8, YMM12, YMM8 - BYTE $0xc4; BYTE $0x41; BYTE $0x15; BYTE $0x6c; BYTE $0xca // VPUNPCKLQDQ YMM9, YMM13, YMM10 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x21 - BYTE $0x21 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 1 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0xc1; BYTE $0x2d; BYTE $0x6c; BYTE $0xe3 // VPUNPCKLQDQ YMM4, YMM10, YMM11 /* m[0], m[4], m[2], m[6] */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x2d; BYTE $0x6d; BYTE $0xeb // VPUNPCKHQDQ YMM5, YMM10, YMM11 /* m[1], m[5], m[3], m[7] */ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xe4 // VPERMQ YMM4, YMM4, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xed // VPERMQ YMM5, YMM5, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0xc1; BYTE $0x1d; BYTE $0x6c; BYTE $0xe5 // VPUNPCKLQDQ YMM4, YMM12, YMM13 /* m[8], m[12], m[10], m[14] */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x1d; BYTE $0x6d; BYTE $0xed // VPUNPCKHQDQ YMM5, YMM12, YMM13 /* m[9], m[13], m[11], m[15] */ - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xe4 // VPERMQ YMM4, YMM4, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - BYTE $0xc4; BYTE $0xe3; BYTE $0xfd; BYTE $0x00; BYTE $0xed // VPERMQ YMM5, YMM5, 0xd8 /* 0x1101 1000 = 0xd8 */ - BYTE $0xd8 - - G1 - G2 - - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 2 - /////////////////////////////////////////////////////////////////////////// - - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6c; BYTE $0xc5 // VPUNPCKLQDQ YMM8, YMM11, YMM13 /* m[4], ____, ____, m[14] */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x03 /* m[14], m[4], ____, ____ */ /* xxxx 0011 = 0x03 */ - BYTE $0x03 - BYTE $0xc4; BYTE $0x41; BYTE $0x1d; BYTE $0x6d; BYTE $0xcd // VPUNPCKHQDQ YMM9, YMM12, YMM13 /* m[9], m[13], ____, ____ */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 /* m[9], m[13], ____, ____ */ /* 0010 0000 = 0x20 */ - BYTE $0x20 - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc4 // VPERMQ YMM8, YMM12, 0x02 /* m[10], m[8], ____, ____ */ /* xxxx 0010 = 0x02 */ - BYTE $0x02 - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xcd // VPERMQ YMM9, YMM13, 0x30 /* ____, ____, m[15], ____ */ /* xx11 xxxx = 0x30 */ - BYTE $0x30 - BYTE $0xc4; BYTE $0x41; BYTE $0x35; BYTE $0x6c; BYTE $0xcb // VPUNPCKLQDQ YMM9, YMM9, YMM11 /* ____, ____, m[15], m[6] */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 /* m[9], m[13], m[15], m[6] */ /* 0011 0000 = 0x30 */ - BYTE $0x30 - - G1 - G2 - - DIAGONALIZE - - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc2 // VPERMQ YMM8, YMM10, 0x01 /* m[1], m[0], ____, ____ */ /* xxxx 0001 = 0x01 */ - BYTE $0x01 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xcc // VPUNPCKHQDQ YMM9, YMM11, YMM12 /* m[5], ____, ____, m[11] */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc9 // VPERMQ YMM9, YMM9, 0x03 /* m[11], m[5], ____, ____ */ /* xxxx 0011 = 0x03 */ - BYTE $0x03 - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe1 // VPERM2I128 YMM4, YMM8, YMM9, 0x20 /* m[1], m[0], m[11], m[5] */ /* 0010 0000 = 0x20 */ - BYTE $0x20 - - BYTE $0xc4; BYTE $0x41; BYTE $0x2d; BYTE $0x6c; BYTE $0xc5 // VPUNPCKLQDQ YMM8, YMM10, YMM13 /* ___, m[12], m[2], ____ */ - BYTE $0xc4; BYTE $0x43; BYTE $0xfd; BYTE $0x00; BYTE $0xc0 // VPERMQ YMM8, YMM8, 0x09 /* m[12], m[2], ____, ____ */ /* xxxx 1001 = 0x09 */ - BYTE $0x09 - BYTE $0xc4; BYTE $0x41; BYTE $0x25; BYTE $0x6d; BYTE $0xca // VPUNPCKHQDQ YMM9, YMM11, YMM10 /* ____, ____, m[7], m[3] */ - BYTE $0xc4; BYTE $0xc3; BYTE $0x3d; BYTE $0x46; BYTE $0xe9 // VPERM2I128 YMM5, YMM8, YMM9, 0x30 /* m[9], m[13], m[15], m[6] */ /* 0011 0000 = 0x30 */ - BYTE $0x30 - - G1 - G2 - - UNDIAGONALIZE - - // Reload digest (most current value store in &out) - MOVQ out+144(FP), SI // SI: &in - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x26 // VMOVDQU YMM12, [rsi] - BYTE $0xc5; BYTE $0x7e; BYTE $0x6f; BYTE $0x6e; BYTE $0x20 // VMOVDQU YMM13, 32[rsi] - - BYTE $0xc5; BYTE $0xfd; BYTE $0xef; BYTE $0xc2 // VPXOR YMM0,YMM0,YMM2 /* X0 = X0 ^ X4, X1 = X1 ^ X5 */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x7d; BYTE $0xef; BYTE $0xc4 // VPXOR YMM0,YMM0,YMM12 /* X0 = X0 ^ X12, X1 = X1 ^ X13 */ - BYTE $0xc5; BYTE $0xf5; BYTE $0xef; BYTE $0xcb // VPXOR YMM1,YMM1,YMM3 /* X2 = X2 ^ X6, X3 = X3 ^ X7 */ - BYTE $0xc4; BYTE $0xc1; BYTE $0x75; BYTE $0xef; BYTE $0xcd // VPXOR YMM1,YMM1,YMM13 /* X2 = X2 ^ X14, X3 = X3 ^ X15 */ - - // Store digest into &out - MOVQ out+144(FP), SI // SI: &out - BYTE $0xc5; BYTE $0xfe; BYTE $0x7f; BYTE $0x06 // VMOVDQU [rsi], YMM0 - BYTE $0xc5; BYTE $0xfe; BYTE $0x7f; BYTE $0x4e; BYTE $0x20 // VMOVDQU 32[rsi], YMM1 - - // Increment message pointer and check if there's more to do - ADDQ $128, DX // message += 128 - SUBQ $1, R8 - JNZ loop - -complete: - BYTE $0xc5; BYTE $0xf8; BYTE $0x77 // VZEROUPPER /* Prevent further context switches */ - RET - diff --git a/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.go b/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.go deleted file mode 100644 index cfa12c04..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.go +++ /dev/null @@ -1,41 +0,0 @@ -//+build !noasm -//+build !appengine - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package blake2b - -//go:noescape -func blockAVXLoop(p []uint8, in, iv, t, f, shffle, out []uint64) - -func compressAVX(d *digest, p []uint8) { - var ( - in [8]uint64 - out [8]uint64 - shffle [2]uint64 - ) - - // vector for PSHUFB instruction - shffle[0] = 0x0201000706050403 - shffle[1] = 0x0a09080f0e0d0c0b - - in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7] = d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] - - blockAVXLoop(p, in[:], iv[:], d.t[:], d.f[:], shffle[:], out[:]) - - d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] = out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7] -} diff --git a/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.s b/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.s deleted file mode 100644 index f68e1739..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressAvx_amd64.s +++ /dev/null @@ -1,682 +0,0 @@ -//+build !noasm !appengine - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// Based on SSE implementation from https://github.com/BLAKE2/BLAKE2/blob/master/sse/blake2b.c -// -// Use github.com/fwessels/asm2plan9s on this file to assemble instructions to their Plan9 equivalent -// -// Assembly code below essentially follows the ROUND macro (see blake2b-round.h) which is defined as: -// #define ROUND(r) \ -// LOAD_MSG_ ##r ##_1(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_2(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); \ -// LOAD_MSG_ ##r ##_3(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_4(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// UNDIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); -// -// as well as the go equivalent in https://github.com/dchest/blake2b/blob/master/block.go -// -// As in the macro, G1/G2 in the 1st and 2nd half are identical (so literal copy of assembly) -// -// Rounds are also the same, except for the loading of the message (and rounds 1 & 11 and -// rounds 2 & 12 are identical) -// - -#define G1 \ - \ // G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); - LONG $0xd479c1c4; BYTE $0xc0 \ // VPADDQ XMM0,XMM0,XMM8 /* v0 += m[0], v1 += m[2] */ - LONG $0xd471c1c4; BYTE $0xc9 \ // VPADDQ XMM1,XMM1,XMM9 /* v2 += m[4], v3 += m[6] */ - LONG $0xc2d4f9c5 \ // VPADDQ XMM0,XMM0,XMM2 /* v0 += v4, v1 += v5 */ - LONG $0xcbd4f1c5 \ // VPADDQ XMM1,XMM1,XMM3 /* v2 += v6, v3 += v7 */ - LONG $0xf0efc9c5 \ // VPXOR XMM6,XMM6,XMM0 /* v12 ^= v0, v13 ^= v1 */ - LONG $0xf9efc1c5 \ // VPXOR XMM7,XMM7,XMM1 /* v14 ^= v2, v15 ^= v3 */ - LONG $0xf670f9c5; BYTE $0xb1 \ // VPSHUFD XMM6,XMM6,0xb1 /* v12 = v12<<(64-32) | v12>>32, v13 = v13<<(64-32) | v13>>32 */ - LONG $0xff70f9c5; BYTE $0xb1 \ // VPSHUFD XMM7,XMM7,0xb1 /* v14 = v14<<(64-32) | v14>>32, v15 = v15<<(64-32) | v15>>32 */ - LONG $0xe6d4d9c5 \ // VPADDQ XMM4,XMM4,XMM6 /* v8 += v12, v9 += v13 */ - LONG $0xefd4d1c5 \ // VPADDQ XMM5,XMM5,XMM7 /* v10 += v14, v11 += v15 */ - LONG $0xd4efe9c5 \ // VPXOR XMM2,XMM2,XMM4 /* v4 ^= v8, v5 ^= v9 */ - LONG $0xddefe1c5 \ // VPXOR XMM3,XMM3,XMM5 /* v6 ^= v10, v7 ^= v11 */ - LONG $0x0069c2c4; BYTE $0xd4 \ // VPSHUFB XMM2,XMM2,XMM12 /* v4 = v4<<(64-24) | v4>>24, v5 = v5<<(64-24) | v5>>24 */ - LONG $0x0061c2c4; BYTE $0xdc // VPSHUFB XMM3,XMM3,XMM12 /* v6 = v6<<(64-24) | v6>>24, v7 = v7<<(64-24) | v7>>24 */ - -#define G2 \ - \ // G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); - LONG $0xd479c1c4; BYTE $0xc2 \ // VPADDQ XMM0,XMM0,XMM10 /* v0 += m[1], v1 += m[3] */ - LONG $0xd471c1c4; BYTE $0xcb \ // VPADDQ XMM1,XMM1,XMM11 /* v2 += m[5], v3 += m[7] */ - LONG $0xc2d4f9c5 \ // VPADDQ XMM0,XMM0,XMM2 /* v0 += v4, v1 += v5 */ - LONG $0xcbd4f1c5 \ // VPADDQ XMM1,XMM1,XMM3 /* v2 += v6, v3 += v7 */ - LONG $0xf0efc9c5 \ // VPXOR XMM6,XMM6,XMM0 /* v12 ^= v0, v13 ^= v1 */ - LONG $0xf9efc1c5 \ // VPXOR XMM7,XMM7,XMM1 /* v14 ^= v2, v15 ^= v3 */ - LONG $0xf670fbc5; BYTE $0x39 \ // VPSHUFLW XMM6,XMM6,0x39 /* combined with next ... */ - LONG $0xf670fac5; BYTE $0x39 \ // VPSHUFHW XMM6,XMM6,0x39 /* v12 = v12<<(64-16) | v12>>16, v13 = v13<<(64-16) | v13>>16 */ - LONG $0xff70fbc5; BYTE $0x39 \ // VPSHUFLW XMM7,XMM7,0x39 /* combined with next ... */ - LONG $0xff70fac5; BYTE $0x39 \ // VPSHUFHW XMM7,XMM7,0x39 /* v14 = v14<<(64-16) | v14>>16, v15 = v15<<(64-16) | v15>>16 */ - LONG $0xe6d4d9c5 \ // VPADDQ XMM4,XMM4,XMM6 /* v8 += v12, v9 += v13 */ - LONG $0xefd4d1c5 \ // VPADDQ XMM5,XMM5,XMM7 /* v10 += v14, v11 += v15 */ - LONG $0xd4efe9c5 \ // VPXOR XMM2,XMM2,XMM4 /* v4 ^= v8, v5 ^= v9 */ - LONG $0xddefe1c5 \ // VPXOR XMM3,XMM3,XMM5 /* v6 ^= v10, v7 ^= v11 */ - LONG $0xfad469c5 \ // VPADDQ XMM15,XMM2,XMM2 /* temp reg = reg*2 */ - LONG $0xd273e9c5; BYTE $0x3f \ // VPSRLQ XMM2,XMM2,0x3f /* reg = reg>>63 */ - LONG $0xef69c1c4; BYTE $0xd7 \ // VPXOR XMM2,XMM2,XMM15 /* ORed together: v4 = v4<<(64-63) | v4>>63, v5 = v5<<(64-63) | v5>>63 */ - LONG $0xfbd461c5 \ // VPADDQ XMM15,XMM3,XMM3 /* temp reg = reg*2 */ - LONG $0xd373e1c5; BYTE $0x3f \ // VPSRLQ XMM3,XMM3,0x3f /* reg = reg>>63 */ - LONG $0xef61c1c4; BYTE $0xdf // VPXOR XMM3,XMM3,XMM15 /* ORed together: v6 = v6<<(64-63) | v6>>63, v7 = v7<<(64-63) | v7>>63 */ - -#define DIAGONALIZE \ - \ // DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); - MOVOU X6, X13 \ /* t0 = row4l;\ */ - MOVOU X2, X14 \ /* t1 = row2l;\ */ - MOVOU X4, X6 \ /* row4l = row3l;\ */ - MOVOU X5, X4 \ /* row3l = row3h;\ */ - MOVOU X6, X5 \ /* row3h = row4l;\ */ - LONG $0x6c1141c4; BYTE $0xfd \ // VPUNPCKLQDQ XMM15, XMM13, XMM13 /* _mm_unpacklo_epi64(t0, t0) */ - LONG $0x6d41c1c4; BYTE $0xf7 \ // VPUNPCKHQDQ XMM6, XMM7, XMM15 /* row4l = _mm_unpackhi_epi64(row4h, ); \ */ - LONG $0xff6c41c5 \ // VPUNPCKLQDQ XMM15, XMM7, XMM7 /* _mm_unpacklo_epi64(row4h, row4h) */ - LONG $0x6d11c1c4; BYTE $0xff \ // VPUNPCKHQDQ XMM7, XMM13, XMM15 /* row4h = _mm_unpackhi_epi64(t0, ); \ */ - LONG $0xfb6c61c5 \ // VPUNPCKLQDQ XMM15, XMM3, XMM3 /* _mm_unpacklo_epi64(row2h, row2h) */ - LONG $0x6d69c1c4; BYTE $0xd7 \ // VPUNPCKHQDQ XMM2, XMM2, XMM15 /* row2l = _mm_unpackhi_epi64(row2l, ); \ */ - LONG $0x6c0941c4; BYTE $0xfe \ // VPUNPCKLQDQ XMM15, XMM14, XMM14 /* _mm_unpacklo_epi64(t1, t1) */ - LONG $0x6d61c1c4; BYTE $0xdf // VPUNPCKHQDQ XMM3, XMM3, XMM15 /* row2h = _mm_unpackhi_epi64(row2h, ) */ - -#define UNDIAGONALIZE \ - \ // UNDIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); - MOVOU X4, X13 \ /* t0 = row3l;\ */ - MOVOU X5, X4 \ /* row3l = row3h;\ */ - MOVOU X13, X5 \ /* row3h = t0;\ */ - MOVOU X2, X13 \ /* t0 = row2l;\ */ - MOVOU X6, X14 \ /* t1 = row4l;\ */ - LONG $0xfa6c69c5 \ // VPUNPCKLQDQ XMM15, XMM2, XMM2 /* _mm_unpacklo_epi64(row2l, row2l) */ - LONG $0x6d61c1c4; BYTE $0xd7 \ // VPUNPCKHQDQ XMM2, XMM3, XMM15 /* row2l = _mm_unpackhi_epi64(row2h, ); \ */ - LONG $0xfb6c61c5 \ // VPUNPCKLQDQ XMM15, XMM3, XMM3 /* _mm_unpacklo_epi64(row2h, row2h) */ - LONG $0x6d11c1c4; BYTE $0xdf \ // VPUNPCKHQDQ XMM3, XMM13, XMM15 /* row2h = _mm_unpackhi_epi64(t0, ); \ */ - LONG $0xff6c41c5 \ // VPUNPCKLQDQ XMM15, XMM7, XMM7 /* _mm_unpacklo_epi64(row4h, row4h) */ - LONG $0x6d49c1c4; BYTE $0xf7 \ // VPUNPCKHQDQ XMM6, XMM6, XMM15 /* row4l = _mm_unpackhi_epi64(row4l, ); \ */ - LONG $0x6c0941c4; BYTE $0xfe \ // VPUNPCKLQDQ XMM15, XMM14, XMM14 /* _mm_unpacklo_epi64(t1, t1) */ - LONG $0x6d41c1c4; BYTE $0xff // VPUNPCKHQDQ XMM7, XMM7, XMM15 /* row4h = _mm_unpackhi_epi64(row4h, ) */ - -#define LOAD_SHUFFLE \ - \ // Load shuffle value - MOVQ shffle+120(FP), SI \ // SI: &shuffle - MOVOU 0(SI), X12 // X12 = 03040506 07000102 0b0c0d0e 0f08090a - -// func blockAVXLoop(p []uint8, in, iv, t, f, shffle, out []uint64) -TEXT ·blockAVXLoop(SB), 7, $0 - // REGISTER USE - // R8: loop counter - // DX: message pointer - // SI: temp pointer for loading - // X0 - X7: v0 - v15 - // X8 - X11: m[0] - m[7] - // X12: shuffle value - // X13 - X15: temp registers - - // Load digest - MOVQ in+24(FP), SI // SI: &in - MOVOU 0(SI), X0 // X0 = in[0]+in[1] /* row1l = LOAD( &S->h[0] ); */ - MOVOU 16(SI), X1 // X1 = in[2]+in[3] /* row1h = LOAD( &S->h[2] ); */ - MOVOU 32(SI), X2 // X2 = in[4]+in[5] /* row2l = LOAD( &S->h[4] ); */ - MOVOU 48(SI), X3 // X3 = in[6]+in[7] /* row2h = LOAD( &S->h[6] ); */ - - // Already store digest into &out (so we can reload it later generically) - MOVQ out+144(FP), SI // SI: &out - MOVOU X0, 0(SI) // out[0]+out[1] = X0 - MOVOU X1, 16(SI) // out[2]+out[3] = X1 - MOVOU X2, 32(SI) // out[4]+out[5] = X2 - MOVOU X3, 48(SI) // out[6]+out[7] = X3 - - // Initialize message pointer and loop counter - MOVQ message+0(FP), DX // DX: &p (message) - MOVQ message_len+8(FP), R8 // R8: len(message) - SHRQ $7, R8 // len(message) / 128 - CMPQ R8, $0 - JEQ complete - -loop: - // Increment counter - MOVQ t+72(FP), SI // SI: &t - MOVQ 0(SI), R9 - ADDQ $128, R9 // /* d.t[0] += BlockSize */ - MOVQ R9, 0(SI) - CMPQ R9, $128 // /* if d.t[0] < BlockSize { */ - JGE noincr - MOVQ 8(SI), R9 - ADDQ $1, R9 // /* d.t[1]++ */ - MOVQ R9, 8(SI) -noincr: // /* } */ - - // Load initialization vector - MOVQ iv+48(FP), SI // SI: &iv - MOVOU 0(SI), X4 // X4 = iv[0]+iv[1] /* row3l = LOAD( &blake2b_IV[0] ); */ - MOVOU 16(SI), X5 // X5 = iv[2]+iv[3] /* row3h = LOAD( &blake2b_IV[2] ); */ - MOVOU 32(SI), X6 // X6 = iv[4]+iv[5] /* LOAD( &blake2b_IV[4] ) */ - MOVOU 48(SI), X7 // X7 = iv[6]+iv[7] /* LOAD( &blake2b_IV[6] ) */ - MOVQ t+72(FP), SI // SI: &t - MOVOU 0(SI), X8 // X8 = t[0]+t[1] /* LOAD( &S->t[0] ) */ - PXOR X8, X6 // X6 = X6 ^ X8 /* row4l = _mm_xor_si128( , ); */ - MOVQ t+96(FP), SI // SI: &f - MOVOU 0(SI), X8 // X8 = f[0]+f[1] /* LOAD( &S->f[0] ) */ - PXOR X8, X7 // X7 = X7 ^ X8 /* row4h = _mm_xor_si128( , ); */ - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+m[1] - MOVOU 16(DX), X13 // X13 = m[2]+m[3] - MOVOU 32(DX), X14 // X14 = m[4]+m[5] - MOVOU 48(DX), X15 // X15 = m[6]+m[7] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[0], m[2] */ - LONG $0x6c0941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM14, XMM15 /* m[4], m[6] */ - LONG $0x6d1941c4; BYTE $0xd5 // VPUNPCKHQDQ XMM10, XMM12, XMM13 /* m[1], m[3] */ - LONG $0x6d0941c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM14, XMM15 /* m[5], m[7] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[8],m[10] */ - LONG $0x6c0941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM14, XMM15 /* m[12],m[14] */ - LONG $0x6d1941c4; BYTE $0xd5 // VPUNPCKHQDQ XMM10, XMM12, XMM13 /* m[9],m[11] */ - LONG $0x6d0941c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM14, XMM15 /* m[13],m[15] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 2 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 112(DX), X12 // X12 = m[14]+m[15] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[14], m[4] */ - LONG $0x6d0941c4; BYTE $0xcf // VPUNPCKHQDQ XMM9, XMM14, XMM15 /* m[9], m[13] */ - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 48(DX), X15 // X15 = m[6]+ m[7] - LONG $0x6c1141c4; BYTE $0xd6 // VPUNPCKLQDQ XMM10, XMM13, XMM14 /* m[10], m[8] */ - LONG $0x0f0143c4; WORD $0x08dc // VPALIGNR XMM11, XMM15, XMM12, 0x8 /* m[15], m[6] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - LONG $0x0f1943c4; WORD $0x08c4 // VPALIGNR XMM8, XMM12, XMM12, 0x8 /* m[1], m[0] */ - LONG $0x6d0941c4; BYTE $0xcd // VPUNPCKHQDQ XMM9, XMM14, XMM13 /* m[11], m[5] */ - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - LONG $0x6c0941c4; BYTE $0xd4 // VPUNPCKLQDQ XMM10, XMM14, XMM12 /* m[12], m[2] */ - LONG $0x6d1141c4; BYTE $0xdc // VPUNPCKHQDQ XMM11, XMM13, XMM12 /* m[7], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 3 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 32(DX), X12 // X12 = m[4]+ m[5] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x0f0943c4; WORD $0x08c5 // VPALIGNR XMM8, XMM14, XMM13, 0x8 /* m[11], m[12] */ - LONG $0x6d1941c4; BYTE $0xcf // VPUNPCKHQDQ XMM9, XMM12, XMM15 /* m[5], m[15] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 64(DX), X15 // X15 = m[8]+ m[9] - LONG $0x6c0141c4; BYTE $0xd4 // VPUNPCKLQDQ XMM10, XMM15, XMM12 /* m[8], m[0] */ - LONG $0x6d0941c4; BYTE $0xde // VPUNPCKHQDQ XMM11, XMM14, XMM14 /* ___, m[13] */ - LONG $0x6c1141c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM13, XMM11 /* m[2], ___ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6d1941c4; BYTE $0xc4 // VPUNPCKHQDQ XMM8, XMM12, XMM12 /* ___, m[3] */ - LONG $0x6c0141c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM15, XMM8 /* m[10], ___ */ - LONG $0x6d1141c4; BYTE $0xce // VPUNPCKHQDQ XMM9, XMM13, XMM14 /* m[7], m[9] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X14 // X14 = m[4]+ m[5] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6c0141c4; BYTE $0xd5 // VPUNPCKLQDQ XMM10, XMM15, XMM13 /* m[14], m[6] */ - LONG $0x0f0943c4; WORD $0x08dc // VPALIGNR XMM11, XMM14, XMM12, 0x8 /* m[1], m[4] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 4 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - LONG $0x6d1141c4; BYTE $0xc4 // VPUNPCKHQDQ XMM8, XMM13, XMM12 /* m[7], m[3] */ - LONG $0x6d0141c4; BYTE $0xce // VPUNPCKHQDQ XMM9, XMM15, XMM14 /* m[13], m[11] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 112(DX), X14 // X14 = m[14]+m[15] - LONG $0x6d1141c4; BYTE $0xd4 // VPUNPCKHQDQ XMM10, XMM13, XMM12 /* m[9], m[1] */ - LONG $0x6c0141c4; BYTE $0xde // VPUNPCKLQDQ XMM11, XMM15, XMM14 /* m[12], m[14] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d1141c4; BYTE $0xc5 // VPUNPCKHQDQ XMM8, XMM13, XMM13 /* ___, m[5] */ - LONG $0x6c1941c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM12, XMM8 /* m[2], ____ */ - LONG $0x6d0141c4; BYTE $0xcf // VPUNPCKHQDQ XMM9, XMM15, XMM15 /* ___, m[15] */ - LONG $0x6c1141c4; BYTE $0xc9 // VPUNPCKLQDQ XMM9, XMM13, XMM9 /* m[4], ____ */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X15 // X15 = m[8]+ m[9] - LONG $0x6c1141c4; BYTE $0xd6 // VPUNPCKLQDQ XMM10, XMM13, XMM14 /* m[6], m[10] */ - LONG $0x6c1941c4; BYTE $0xdf // VPUNPCKLQDQ XMM11, XMM12, XMM15 /* m[0], m[8] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 5 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6d0941c4; BYTE $0xc5 // VPUNPCKHQDQ XMM8, XMM14, XMM13 /* m[9], m[5] */ - LONG $0x6c1941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM12, XMM15 /* m[2], m[10] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0941c4; BYTE $0xd6 // VPUNPCKHQDQ XMM10, XMM14, XMM14 /* ___, m[7] */ - LONG $0x6c1941c4; BYTE $0xd2 // VPUNPCKLQDQ XMM10, XMM12, XMM10 /* m[0], ____ */ - LONG $0x6d0141c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM15, XMM15 /* ___, m[15] */ - LONG $0x6c1141c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM13, XMM11 /* m[4], ____ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0941c4; BYTE $0xc6 // VPUNPCKHQDQ XMM8, XMM14, XMM14 /* ___, m[11] */ - LONG $0x6c0141c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM15, XMM8 /* m[14], ____ */ - LONG $0x6d1941c4; BYTE $0xcc // VPUNPCKHQDQ XMM9, XMM12, XMM12 /* ___, m[3] */ - LONG $0x6c1141c4; BYTE $0xc9 // VPUNPCKLQDQ XMM9, XMM13, XMM9 /* m[6], ____ */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - LONG $0x0f0943c4; WORD $0x08d4 // VPALIGNR XMM10, XMM14, XMM12, 0x8 /* m[1], m[12] */ - LONG $0x6d0941c4; BYTE $0xde // VPUNPCKHQDQ XMM11, XMM14, XMM14 /* ___, m[13] */ - LONG $0x6c1141c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM13, XMM11 /* m[8], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 6 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 64(DX), X15 // X15 = m[8]+ m[9] - LONG $0x6c1141c4; BYTE $0xc6 // VPUNPCKLQDQ XMM8, XMM13, XMM14 /* m[2], m[6] */ - LONG $0x6c1941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM12, XMM15 /* m[0], m[8] */ - MOVOU 80(DX), X12 // X12 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - LONG $0x6c0941c4; BYTE $0xd4 // VPUNPCKLQDQ XMM10, XMM14, XMM12 /* m[12], m[10] */ - LONG $0x6d1941c4; BYTE $0xdd // VPUNPCKHQDQ XMM11, XMM12, XMM13 /* m[11], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0941c4; BYTE $0xc6 // VPUNPCKHQDQ XMM8, XMM14, XMM14 /* ___, m[7] */ - LONG $0x6c1141c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM13, XMM8 /* m[4], ____ */ - LONG $0x6d0141c4; BYTE $0xcc // VPUNPCKHQDQ XMM9, XMM15, XMM12 /* m[15], m[1] */ - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - LONG $0x6d0941c4; BYTE $0xd5 // VPUNPCKHQDQ XMM10, XMM14, XMM13 /* m[13], m[5] */ - LONG $0x6d1941c4; BYTE $0xdc // VPUNPCKHQDQ XMM11, XMM12, XMM12 /* ___, m[9] */ - LONG $0x6c0141c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM15, XMM11 /* m[14], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 7 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d1941c4; BYTE $0xc4 // VPUNPCKHQDQ XMM8, XMM12, XMM12 /* ___, m[1] */ - LONG $0x6c0941c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM14, XMM8 /* m[12], ____ */ - LONG $0x6c0141c4; BYTE $0xcd // VPUNPCKLQDQ XMM9, XMM15, XMM13 /* m[14], m[4] */ - MOVOU 80(DX), X12 // X12 = m[10]+m[11] - LONG $0x6d1141c4; BYTE $0xd7 // VPUNPCKHQDQ XMM10, XMM13, XMM15 /* m[5], m[15] */ - LONG $0x0f1943c4; WORD $0x08de // VPALIGNR XMM11, XMM12, XMM14, 0x8 /* m[13], m[10] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[0], m[6] */ - LONG $0x0f0943c4; WORD $0x08ce // VPALIGNR XMM9, XMM14, XMM14, 0x8 /* m[9], m[8] */ - MOVOU 16(DX), X14 // X14 = m[2]+ m[3] - LONG $0x6d1141c4; BYTE $0xd6 // VPUNPCKHQDQ XMM10, XMM13, XMM14 /* m[7], m[3] */ - LONG $0x6d0141c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM15, XMM15 /* ___, m[11] */ - LONG $0x6c0941c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM14, XMM11 /* m[2], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 8 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0941c4; BYTE $0xc5 // VPUNPCKHQDQ XMM8, XMM14, XMM13 /* m[13], m[7] */ - LONG $0x6d1941c4; BYTE $0xcc // VPUNPCKHQDQ XMM9, XMM12, XMM12 /* ___, m[3] */ - LONG $0x6c0941c4; BYTE $0xc9 // VPUNPCKLQDQ XMM9, XMM14, XMM9 /* m[12], ____ */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - LONG $0x0f0143c4; WORD $0x08d6 // VPALIGNR XMM10, XMM15, XMM14, 0x8 /* m[11], m[14] */ - LONG $0x6d1941c4; BYTE $0xdd // VPUNPCKHQDQ XMM11, XMM12, XMM13 /* m[1], m[9] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d1141c4; BYTE $0xc7 // VPUNPCKHQDQ XMM8, XMM13, XMM15 /* m[5], m[15] */ - LONG $0x6c0941c4; BYTE $0xcc // VPUNPCKLQDQ XMM9, XMM14, XMM12 /* m[8], m[2] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6c1941c4; BYTE $0xd5 // VPUNPCKLQDQ XMM10, XMM12, XMM13 /* m[0], m[4] */ - LONG $0x6c0941c4; BYTE $0xdf // VPUNPCKLQDQ XMM11, XMM14, XMM15 /* m[6], m[10] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 9 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6c1141c4; BYTE $0xc7 // VPUNPCKLQDQ XMM8, XMM13, XMM15 /* m[6], m[14] */ - LONG $0x0f1943c4; WORD $0x08ce // VPALIGNR XMM9, XMM12, XMM14, 0x8 /* m[11], m[0] */ - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - LONG $0x6d0141c4; BYTE $0xd6 // VPUNPCKHQDQ XMM10, XMM15, XMM14 /* m[15], m[9] */ - LONG $0x0f0943c4; WORD $0x08dd // VPALIGNR XMM11, XMM14, XMM13, 0x8 /* m[3], m[8] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - LONG $0x6d0141c4; BYTE $0xc7 // VPUNPCKHQDQ XMM8, XMM15, XMM15 /* ___, m[13] */ - LONG $0x6c0141c4; BYTE $0xc0 // VPUNPCKLQDQ XMM8, XMM15, XMM8 /* m[12], ____ */ - LONG $0x0f0943c4; WORD $0x08cc // VPALIGNR XMM9, XMM14, XMM12, 0x8 /* m[1], m[10] */ - MOVOU 32(DX), X12 // X12 = m[4]+ m[5] - MOVOU 48(DX), X15 // X15 = m[6]+ m[7] - LONG $0x6d0141c4; BYTE $0xd7 // VPUNPCKHQDQ XMM10, XMM15, XMM15 /* ___, m[7] */ - LONG $0x6c1141c4; BYTE $0xd2 // VPUNPCKLQDQ XMM10, XMM13, XMM10 /* m[2], ____ */ - LONG $0x6d1941c4; BYTE $0xdc // VPUNPCKHQDQ XMM11, XMM12, XMM12 /* ___, m[5] */ - LONG $0x6c1941c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM12, XMM11 /* m[4], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 0 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6c0141c4; BYTE $0xc6 // VPUNPCKLQDQ XMM8, XMM15, XMM14 /* m[10], m[8] */ - LONG $0x6d1141c4; BYTE $0xcc // VPUNPCKHQDQ XMM9, XMM13, XMM12 /* m[7], m[1] */ - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X14 // X14 = m[4]+ m[5] - LONG $0x6c1941c4; BYTE $0xd6 // VPUNPCKLQDQ XMM10, XMM12, XMM14 /* m[2], m[4] */ - LONG $0x6d0941c4; BYTE $0xde // VPUNPCKHQDQ XMM11, XMM14, XMM14 /* ___, m[5] */ - LONG $0x6c1141c4; BYTE $0xdb // VPUNPCKLQDQ XMM11, XMM13, XMM11 /* m[6], ____ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0141c4; BYTE $0xc5 // VPUNPCKHQDQ XMM8, XMM15, XMM13 /* m[15], m[9] */ - LONG $0x6d1941c4; BYTE $0xce // VPUNPCKHQDQ XMM9, XMM12, XMM14 /* m[3], m[13] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - LONG $0x0f0143c4; WORD $0x08d5 // VPALIGNR XMM10, XMM15, XMM13, 0x8 /* m[11], m[14] */ - LONG $0x6c0941c4; BYTE $0xdc // VPUNPCKLQDQ XMM11, XMM14, XMM12 /* m[12], m[0] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 1 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+m[1] - MOVOU 16(DX), X13 // X13 = m[2]+m[3] - MOVOU 32(DX), X14 // X14 = m[4]+m[5] - MOVOU 48(DX), X15 // X15 = m[6]+m[7] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[0], m[2] */ - LONG $0x6c0941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM14, XMM15 /* m[4], m[6] */ - LONG $0x6d1941c4; BYTE $0xd5 // VPUNPCKHQDQ XMM10, XMM12, XMM13 /* m[1], m[3] */ - LONG $0x6d0941c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM14, XMM15 /* m[5], m[7] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[8],m[10] */ - LONG $0x6c0941c4; BYTE $0xcf // VPUNPCKLQDQ XMM9, XMM14, XMM15 /* m[12],m[14] */ - LONG $0x6d1941c4; BYTE $0xd5 // VPUNPCKHQDQ XMM10, XMM12, XMM13 /* m[9],m[11] */ - LONG $0x6d0941c4; BYTE $0xdf // VPUNPCKHQDQ XMM11, XMM14, XMM15 /* m[13],m[15] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 2 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 112(DX), X12 // X12 = m[14]+m[15] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - LONG $0x6c1941c4; BYTE $0xc5 // VPUNPCKLQDQ XMM8, XMM12, XMM13 /* m[14], m[4] */ - LONG $0x6d0941c4; BYTE $0xcf // VPUNPCKHQDQ XMM9, XMM14, XMM15 /* m[9], m[13] */ - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 48(DX), X15 // X15 = m[6]+ m[7] - LONG $0x6c1141c4; BYTE $0xd6 // VPUNPCKLQDQ XMM10, XMM13, XMM14 /* m[10], m[8] */ - LONG $0x0f0143c4; WORD $0x08dc // VPALIGNR XMM11, XMM15, XMM12, 0x8 /* m[15], m[6] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - LONG $0x0f1943c4; WORD $0x08c4 // VPALIGNR XMM8, XMM12, XMM12, 0x8 /* m[1], m[0] */ - LONG $0x6d0941c4; BYTE $0xcd // VPUNPCKHQDQ XMM9, XMM14, XMM13 /* m[11], m[5] */ - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - LONG $0x6c0941c4; BYTE $0xd4 // VPUNPCKLQDQ XMM10, XMM14, XMM12 /* m[12], m[2] */ - LONG $0x6d1141c4; BYTE $0xdc // VPUNPCKHQDQ XMM11, XMM13, XMM12 /* m[7], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - // Reload digest (most current value store in &out) - MOVQ out+144(FP), SI // SI: &in - MOVOU 0(SI), X12 // X12 = in[0]+in[1] /* row1l = LOAD( &S->h[0] ); */ - MOVOU 16(SI), X13 // X13 = in[2]+in[3] /* row1h = LOAD( &S->h[2] ); */ - MOVOU 32(SI), X14 // X14 = in[4]+in[5] /* row2l = LOAD( &S->h[4] ); */ - MOVOU 48(SI), X15 // X15 = in[6]+in[7] /* row2h = LOAD( &S->h[6] ); */ - - // Final computations and prepare for storing - PXOR X4, X0 // X0 = X0 ^ X4 /* row1l = _mm_xor_si128( row3l, row1l ); */ - PXOR X5, X1 // X1 = X1 ^ X5 /* row1h = _mm_xor_si128( row3h, row1h ); */ - PXOR X12, X0 // X0 = X0 ^ X12 /* STORE( &S->h[0], _mm_xor_si128( LOAD( &S->h[0] ), row1l ) ); */ - PXOR X13, X1 // X1 = X1 ^ X13 /* STORE( &S->h[2], _mm_xor_si128( LOAD( &S->h[2] ), row1h ) ); */ - PXOR X6, X2 // X2 = X2 ^ X6 /* row2l = _mm_xor_si128( row4l, row2l ); */ - PXOR X7, X3 // X3 = X3 ^ X7 /* row2h = _mm_xor_si128( row4h, row2h ); */ - PXOR X14, X2 // X2 = X2 ^ X14 /* STORE( &S->h[4], _mm_xor_si128( LOAD( &S->h[4] ), row2l ) ); */ - PXOR X15, X3 // X3 = X3 ^ X15 /* STORE( &S->h[6], _mm_xor_si128( LOAD( &S->h[6] ), row2h ) ); */ - - // Store digest into &out - MOVQ out+144(FP), SI // SI: &out - MOVOU X0, 0(SI) // out[0]+out[1] = X0 - MOVOU X1, 16(SI) // out[2]+out[3] = X1 - MOVOU X2, 32(SI) // out[4]+out[5] = X2 - MOVOU X3, 48(SI) // out[6]+out[7] = X3 - - // Increment message pointer and check if there's more to do - ADDQ $128, DX // message += 128 - SUBQ $1, R8 - JNZ loop - -complete: - RET diff --git a/vendor/github.com/minio/blake2b-simd/compressSse_amd64.go b/vendor/github.com/minio/blake2b-simd/compressSse_amd64.go deleted file mode 100644 index d539a7ad..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressSse_amd64.go +++ /dev/null @@ -1,41 +0,0 @@ -//+build !noasm -//+build !appengine - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package blake2b - -//go:noescape -func blockSSELoop(p []uint8, in, iv, t, f, shffle, out []uint64) - -func compressSSE(d *digest, p []uint8) { - var ( - in [8]uint64 - out [8]uint64 - shffle [2]uint64 - ) - - // vector for PSHUFB instruction - shffle[0] = 0x0201000706050403 - shffle[1] = 0x0a09080f0e0d0c0b - - in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7] = d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] - - blockSSELoop(p, in[:], iv[:], d.t[:], d.f[:], shffle[:], out[:]) - - d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] = out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7] -} diff --git a/vendor/github.com/minio/blake2b-simd/compressSse_amd64.s b/vendor/github.com/minio/blake2b-simd/compressSse_amd64.s deleted file mode 100644 index 6f31c949..00000000 --- a/vendor/github.com/minio/blake2b-simd/compressSse_amd64.s +++ /dev/null @@ -1,770 +0,0 @@ -//+build !noasm !appengine - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// Based on SSE implementation from https://github.com/BLAKE2/BLAKE2/blob/master/sse/blake2b.c -// -// Use github.com/fwessels/asm2plan9s on this file to assemble instructions to their Plan9 equivalent -// -// Assembly code below essentially follows the ROUND macro (see blake2b-round.h) which is defined as: -// #define ROUND(r) \ -// LOAD_MSG_ ##r ##_1(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_2(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); \ -// LOAD_MSG_ ##r ##_3(b0, b1); \ -// G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// LOAD_MSG_ ##r ##_4(b0, b1); \ -// G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); \ -// UNDIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); -// -// as well as the go equivalent in https://github.com/dchest/blake2b/blob/master/block.go -// -// As in the macro, G1/G2 in the 1st and 2nd half are identical (so literal copy of assembly) -// -// Rounds are also the same, except for the loading of the message (and rounds 1 & 11 and -// rounds 2 & 12 are identical) -// - -#define G1 \ - \ // G1(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); - LONG $0xd40f4166; BYTE $0xc0 \ // PADDQ XMM0,XMM8 /* v0 += m[0], v1 += m[2] */ - LONG $0xd40f4166; BYTE $0xc9 \ // PADDQ XMM1,XMM9 /* v2 += m[4], v3 += m[6] */ - LONG $0xc2d40f66 \ // PADDQ XMM0,XMM2 /* v0 += v4, v1 += v5 */ - LONG $0xcbd40f66 \ // PADDQ XMM1,XMM3 /* v2 += v6, v3 += v7 */ - LONG $0xf0ef0f66 \ // PXOR XMM6,XMM0 /* v12 ^= v0, v13 ^= v1 */ - LONG $0xf9ef0f66 \ // PXOR XMM7,XMM1 /* v14 ^= v2, v15 ^= v3 */ - LONG $0xf6700f66; BYTE $0xb1 \ // PSHUFD XMM6,XMM6,0xb1 /* v12 = v12<<(64-32) | v12>>32, v13 = v13<<(64-32) | v13>>32 */ - LONG $0xff700f66; BYTE $0xb1 \ // PSHUFD XMM7,XMM7,0xb1 /* v14 = v14<<(64-32) | v14>>32, v15 = v15<<(64-32) | v15>>32 */ - LONG $0xe6d40f66 \ // PADDQ XMM4,XMM6 /* v8 += v12, v9 += v13 */ - LONG $0xefd40f66 \ // PADDQ XMM5,XMM7 /* v10 += v14, v11 += v15 */ - LONG $0xd4ef0f66 \ // PXOR XMM2,XMM4 /* v4 ^= v8, v5 ^= v9 */ - LONG $0xddef0f66 \ // PXOR XMM3,XMM5 /* v6 ^= v10, v7 ^= v11 */ - LONG $0x380f4166; WORD $0xd400 \ // PSHUFB XMM2,XMM12 /* v4 = v4<<(64-24) | v4>>24, v5 = v5<<(64-24) | v5>>24 */ - LONG $0x380f4166; WORD $0xdc00 // PSHUFB XMM3,XMM12 /* v6 = v6<<(64-24) | v6>>24, v7 = v7<<(64-24) | v7>>24 */ - -#define G2 \ - \ // G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1); - LONG $0xd40f4166; BYTE $0xc2 \ // PADDQ XMM0,XMM10 /* v0 += m[1], v1 += m[3] */ - LONG $0xd40f4166; BYTE $0xcb \ // PADDQ XMM1,XMM11 /* v2 += m[5], v3 += m[7] */ - LONG $0xc2d40f66 \ // PADDQ XMM0,XMM2 /* v0 += v4, v1 += v5 */ - LONG $0xcbd40f66 \ // PADDQ XMM1,XMM3 /* v2 += v6, v3 += v7 */ - LONG $0xf0ef0f66 \ // PXOR XMM6,XMM0 /* v12 ^= v0, v13 ^= v1 */ - LONG $0xf9ef0f66 \ // PXOR XMM7,XMM1 /* v14 ^= v2, v15 ^= v3 */ - LONG $0xf6700ff2; BYTE $0x39 \ // PSHUFLW XMM6,XMM6,0x39 /* combined with next ... */ - LONG $0xf6700ff3; BYTE $0x39 \ // PSHUFHW XMM6,XMM6,0x39 /* v12 = v12<<(64-16) | v12>>16, v13 = v13<<(64-16) | v13>>16 */ - LONG $0xff700ff2; BYTE $0x39 \ // PSHUFLW XMM7,XMM7,0x39 /* combined with next ... */ - LONG $0xff700ff3; BYTE $0x39 \ // PSHUFHW XMM7,XMM7,0x39 /* v14 = v14<<(64-16) | v14>>16, v15 = v15<<(64-16) | v15>>16 */ - LONG $0xe6d40f66 \ // PADDQ XMM4,XMM6 /* v8 += v12, v9 += v13 */ - LONG $0xefd40f66 \ // PADDQ XMM5,XMM7 /* v10 += v14, v11 += v15 */ - LONG $0xd4ef0f66 \ // PXOR XMM2,XMM4 /* v4 ^= v8, v5 ^= v9 */ - LONG $0xddef0f66 \ // PXOR XMM3,XMM5 /* v6 ^= v10, v7 ^= v11 */ - MOVOU X2, X15 \ - LONG $0xd40f4466; BYTE $0xfa \ // PADDQ XMM15,XMM2 /* temp reg = reg*2 */ - LONG $0xd2730f66; BYTE $0x3f \ // PSRLQ XMM2,0x3f /* reg = reg>>63 */ - LONG $0xef0f4166; BYTE $0xd7 \ // PXOR XMM2,XMM15 /* ORed together: v4 = v4<<(64-63) | v4>>63, v5 = v5<<(64-63) | v5>>63 */ - MOVOU X3, X15 \ - LONG $0xd40f4466; BYTE $0xfb \ // PADDQ XMM15,XMM3 /* temp reg = reg*2 */ - LONG $0xd3730f66; BYTE $0x3f \ // PSRLQ XMM3,0x3f /* reg = reg>>63 */ - LONG $0xef0f4166; BYTE $0xdf // PXOR XMM3,XMM15 /* ORed together: v6 = v6<<(64-63) | v6>>63, v7 = v7<<(64-63) | v7>>63 */ - -#define DIAGONALIZE \ - \ // DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); - MOVOU X6, X13 \ /* t0 = row4l;\ */ - MOVOU X2, X14 \ /* t1 = row2l;\ */ - MOVOU X4, X6 \ /* row4l = row3l;\ */ - MOVOU X5, X4 \ /* row3l = row3h;\ */ - MOVOU X6, X5 \ /* row3h = row4l;\ */ - LONG $0x6c0f4566; BYTE $0xfd \ // PUNPCKLQDQ XMM15, XMM13 /* _mm_unpacklo_epi64(t0, t0) */ - MOVOU X7, X6 \ - LONG $0x6d0f4166; BYTE $0xf7 \ // PUNPCKHQDQ XMM6, XMM15 /* row4l = _mm_unpackhi_epi64(row4h, ); \ */ - LONG $0x6c0f4466; BYTE $0xff \ // PUNPCKLQDQ XMM15, XMM7 /* _mm_unpacklo_epi64(row4h, row4h) */ - MOVOU X13, X7 \ - LONG $0x6d0f4166; BYTE $0xff \ // PUNPCKHQDQ XMM7, XMM15 /* row4h = _mm_unpackhi_epi64(t0, ); \ */ - LONG $0x6c0f4466; BYTE $0xfb \ // PUNPCKLQDQ XMM15, XMM3 /* _mm_unpacklo_epi64(row2h, row2h) */ - LONG $0x6d0f4166; BYTE $0xd7 \ // PUNPCKHQDQ XMM2, XMM15 /* row2l = _mm_unpackhi_epi64(row2l, ); \ */ - LONG $0x6c0f4566; BYTE $0xfe \ // PUNPCKLQDQ XMM15, XMM14 /* _mm_unpacklo_epi64(t1, t1) */ - LONG $0x6d0f4166; BYTE $0xdf // PUNPCKHQDQ XMM3, XMM15 /* row2h = _mm_unpackhi_epi64(row2h, ) */ - -#define UNDIAGONALIZE \ - \ // UNDIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h); - MOVOU X4, X13 \ /* t0 = row3l;\ */ - MOVOU X5, X4 \ /* row3l = row3h;\ */ - MOVOU X13, X5 \ /* row3h = t0;\ */ - MOVOU X2, X13 \ /* t0 = row2l;\ */ - MOVOU X6, X14 \ /* t1 = row4l;\ */ - LONG $0x6c0f4466; BYTE $0xfa \ // PUNPCKLQDQ XMM15, XMM2 /* _mm_unpacklo_epi64(row2l, row2l) */ - MOVOU X3, X2 \ - LONG $0x6d0f4166; BYTE $0xd7 \ // PUNPCKHQDQ XMM2, XMM15 /* row2l = _mm_unpackhi_epi64(row2h, ); \ */ - LONG $0x6c0f4466; BYTE $0xfb \ // PUNPCKLQDQ XMM15, XMM3 /* _mm_unpacklo_epi64(row2h, row2h) */ - MOVOU X13, X3 \ - LONG $0x6d0f4166; BYTE $0xdf \ // PUNPCKHQDQ XMM3, XMM15 /* row2h = _mm_unpackhi_epi64(t0, ); \ */ - LONG $0x6c0f4466; BYTE $0xff \ // PUNPCKLQDQ XMM15, XMM7 /* _mm_unpacklo_epi64(row4h, row4h) */ - LONG $0x6d0f4166; BYTE $0xf7 \ // PUNPCKHQDQ XMM6, XMM15 /* row4l = _mm_unpackhi_epi64(row4l, ); \ */ - LONG $0x6c0f4566; BYTE $0xfe \ // PUNPCKLQDQ XMM15, XMM14 /* _mm_unpacklo_epi64(t1, t1) */ - LONG $0x6d0f4166; BYTE $0xff // PUNPCKHQDQ XMM7, XMM15 /* row4h = _mm_unpackhi_epi64(row4h, ) */ - -#define LOAD_SHUFFLE \ - \ // Load shuffle value - MOVQ shffle+120(FP), SI \ // SI: &shuffle - MOVOU 0(SI), X12 // X12 = 03040506 07000102 0b0c0d0e 0f08090a - -// func blockSSELoop(p []uint8, in, iv, t, f, shffle, out []uint64) -TEXT ·blockSSELoop(SB), 7, $0 - // REGISTER USE - // R8: loop counter - // DX: message pointer - // SI: temp pointer for loading - // X0 - X7: v0 - v15 - // X8 - X11: m[0] - m[7] - // X12: shuffle value - // X13 - X15: temp registers - - // Load digest - MOVQ in+24(FP), SI // SI: &in - MOVOU 0(SI), X0 // X0 = in[0]+in[1] /* row1l = LOAD( &S->h[0] ); */ - MOVOU 16(SI), X1 // X1 = in[2]+in[3] /* row1h = LOAD( &S->h[2] ); */ - MOVOU 32(SI), X2 // X2 = in[4]+in[5] /* row2l = LOAD( &S->h[4] ); */ - MOVOU 48(SI), X3 // X3 = in[6]+in[7] /* row2h = LOAD( &S->h[6] ); */ - - // Already store digest into &out (so we can reload it later generically) - MOVQ out+144(FP), SI // SI: &out - MOVOU X0, 0(SI) // out[0]+out[1] = X0 - MOVOU X1, 16(SI) // out[2]+out[3] = X1 - MOVOU X2, 32(SI) // out[4]+out[5] = X2 - MOVOU X3, 48(SI) // out[6]+out[7] = X3 - - // Initialize message pointer and loop counter - MOVQ message+0(FP), DX // DX: &p (message) - MOVQ message_len+8(FP), R8 // R8: len(message) - SHRQ $7, R8 // len(message) / 128 - CMPQ R8, $0 - JEQ complete - -loop: - // Increment counter - MOVQ t+72(FP), SI // SI: &t - MOVQ 0(SI), R9 - ADDQ $128, R9 // /* d.t[0] += BlockSize */ - MOVQ R9, 0(SI) - CMPQ R9, $128 // /* if d.t[0] < BlockSize { */ - JGE noincr - MOVQ 8(SI), R9 - ADDQ $1, R9 // /* d.t[1]++ */ - MOVQ R9, 8(SI) - -noincr: // /* } */ - - // Load initialization vector - MOVQ iv+48(FP), SI // SI: &iv - MOVOU 0(SI), X4 // X4 = iv[0]+iv[1] /* row3l = LOAD( &blake2b_IV[0] ); */ - MOVOU 16(SI), X5 // X5 = iv[2]+iv[3] /* row3h = LOAD( &blake2b_IV[2] ); */ - MOVOU 32(SI), X6 // X6 = iv[4]+iv[5] /* LOAD( &blake2b_IV[4] ) */ - MOVOU 48(SI), X7 // X7 = iv[6]+iv[7] /* LOAD( &blake2b_IV[6] ) */ - MOVQ t+72(FP), SI // SI: &t - MOVOU 0(SI), X8 // X8 = t[0]+t[1] /* LOAD( &S->t[0] ) */ - PXOR X8, X6 // X6 = X6 ^ X8 /* row4l = _mm_xor_si128( , ); */ - MOVQ t+96(FP), SI // SI: &f - MOVOU 0(SI), X8 // X8 = f[0]+f[1] /* LOAD( &S->f[0] ) */ - PXOR X8, X7 // X7 = X7 ^ X8 /* row4h = _mm_xor_si128( , ); */ - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+m[1] - MOVOU 16(DX), X13 // X13 = m[2]+m[3] - MOVOU 32(DX), X14 // X14 = m[4]+m[5] - MOVOU 48(DX), X15 // X15 = m[6]+m[7] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[0], m[2] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[4], m[6] */ - MOVOU X12, X10 - LONG $0x6d0f4566; BYTE $0xd5 // PUNPCKHQDQ XMM10, XMM13 /* m[1], m[3] */ - MOVOU X14, X11 - LONG $0x6d0f4566; BYTE $0xdf // PUNPCKHQDQ XMM11, XMM15 /* m[5], m[7] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[8],m[10] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[12],m[14] */ - MOVOU X12, X10 - LONG $0x6d0f4566; BYTE $0xd5 // PUNPCKHQDQ XMM10, XMM13 /* m[9],m[11] */ - MOVOU X14, X11 - LONG $0x6d0f4566; BYTE $0xdf // PUNPCKHQDQ XMM11, XMM15 /* m[13],m[15] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 2 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 112(DX), X12 // X12 = m[14]+m[15] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[14], m[4] */ - MOVOU X14, X9 - LONG $0x6d0f4566; BYTE $0xcf // PUNPCKHQDQ XMM9, XMM15 /* m[9], m[13] */ - MOVOU 80(DX), X10 // X10 = m[10]+m[11] - MOVOU 48(DX), X11 // X11 = m[6]+ m[7] - LONG $0x6c0f4566; BYTE $0xd6 // PUNPCKLQDQ XMM10, XMM14 /* m[10], m[8] */ - LONG $0x3a0f4566; WORD $0xdc0f; BYTE $0x08 // PALIGNR XMM11, XMM12, 0x8 /* m[15], m[6] */; ; ; ; ; - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU X12, X8 - LONG $0x3a0f4566; WORD $0xc40f; BYTE $0x08 // PALIGNR XMM8, XMM12, 0x8 /* m[1], m[0] */ - MOVOU X14, X9 - LONG $0x6d0f4566; BYTE $0xcd // PUNPCKHQDQ XMM9, XMM13 /* m[11], m[5] */ - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X11 // X11 = m[6]+ m[7] - MOVOU 96(DX), X10 // X10 = m[12]+m[13] - LONG $0x6c0f4566; BYTE $0xd4 // PUNPCKLQDQ XMM10, XMM12 /* m[12], m[2] */ - LONG $0x6d0f4566; BYTE $0xdc // PUNPCKHQDQ XMM11, XMM12 /* m[7], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 3 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 32(DX), X12 // X12 = m[4]+ m[5] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X14, X8 - LONG $0x3a0f4566; WORD $0xc50f; BYTE $0x08 // PALIGNR XMM8, XMM13, 0x8 /* m[11], m[12] */ - MOVOU X12, X9 - LONG $0x6d0f4566; BYTE $0xcf // PUNPCKHQDQ XMM9, XMM15 /* m[5], m[15] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 64(DX), X10 // X10 = m[8]+ m[9] - LONG $0x6c0f4566; BYTE $0xd4 // PUNPCKLQDQ XMM10, XMM12 /* m[8], m[0] */ - LONG $0x6d0f4566; BYTE $0xf6 // PUNPCKHQDQ XMM14, XMM14 /* ___, m[13] */ - MOVOU X13, X11 - LONG $0x6c0f4566; BYTE $0xde // PUNPCKLQDQ XMM11, XMM14 /* m[2], ___ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - MOVOU X12, X9 - LONG $0x6d0f4566; BYTE $0xcc // PUNPCKHQDQ XMM9, XMM12 /* ___, m[3] */ - MOVOU X15, X8 - LONG $0x6c0f4566; BYTE $0xc1 // PUNPCKLQDQ XMM8, XMM9 /* m[10], ___ */ - MOVOU X13, X9 - LONG $0x6d0f4566; BYTE $0xce // PUNPCKHQDQ XMM9, XMM14 /* m[7], m[9] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X11 // X11 = m[4]+ m[5] - MOVOU 112(DX), X10 // X10 = m[14]+m[15] - LONG $0x6c0f4566; BYTE $0xd5 // PUNPCKLQDQ XMM10, XMM13 /* m[14], m[6] */ - LONG $0x3a0f4566; WORD $0xdc0f; BYTE $0x08 // PALIGNR XMM11, XMM12, 0x8 /* m[1], m[4] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 4 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - MOVOU X13, X8 - LONG $0x6d0f4566; BYTE $0xc4 // PUNPCKHQDQ XMM8, XMM12 /* m[7], m[3] */ - MOVOU X15, X9 - LONG $0x6d0f4566; BYTE $0xce // PUNPCKHQDQ XMM9, XMM14 /* m[13], m[11] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 64(DX), X10 // X10 = m[8]+ m[9] - MOVOU 112(DX), X14 // X14 = m[14]+m[15] - LONG $0x6d0f4566; BYTE $0xd4 // PUNPCKHQDQ XMM10, XMM12 /* m[9], m[1] */ - MOVOU X15, X11 - LONG $0x6c0f4566; BYTE $0xde // PUNPCKLQDQ XMM11, XMM14 /* m[12], m[14] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X13, X9 - LONG $0x6d0f4566; BYTE $0xcd // PUNPCKHQDQ XMM9, XMM13 /* ___, m[5] */ - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc1 // PUNPCKLQDQ XMM8, XMM9 /* m[2], ____ */ - MOVOU X15, X10 - LONG $0x6d0f4566; BYTE $0xd7 // PUNPCKHQDQ XMM10, XMM15 /* ___, m[15] */ - MOVOU X13, X9 - LONG $0x6c0f4566; BYTE $0xca // PUNPCKLQDQ XMM9, XMM10 /* m[4], ____ */ - MOVOU 0(DX), X11 // X11 = m[0]+ m[1] - MOVOU 48(DX), X10 // X10 = m[6]+ m[7] - MOVOU 64(DX), X15 // X15 = m[8]+ m[9] - LONG $0x6c0f4566; BYTE $0xd6 // PUNPCKLQDQ XMM10, XMM14 /* m[6], m[10] */ - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[0], m[8] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 5 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - MOVOU X14, X8 - LONG $0x6d0f4566; BYTE $0xc5 // PUNPCKHQDQ XMM8, XMM13 /* m[9], m[5] */ - MOVOU X12, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[2], m[10] */ - MOVOU 0(DX), X10 // X10 = m[0]+ m[1] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0f4566; BYTE $0xf6 // PUNPCKHQDQ XMM14, XMM14 /* ___, m[7] */ - LONG $0x6c0f4566; BYTE $0xd6 // PUNPCKLQDQ XMM10, XMM14 /* m[0], ____ */ - LONG $0x6d0f4566; BYTE $0xff // PUNPCKHQDQ XMM15, XMM15 /* ___, m[15] */ - MOVOU X13, X11 - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[4], ____ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - LONG $0x6d0f4566; BYTE $0xf6 // PUNPCKHQDQ XMM14, XMM14 /* ___, m[11] */ - MOVOU X15, X8 - LONG $0x6c0f4566; BYTE $0xc6 // PUNPCKLQDQ XMM8, XMM14 /* m[14], ____ */ - LONG $0x6d0f4566; BYTE $0xe4 // PUNPCKHQDQ XMM12, XMM12 /* ___, m[3] */ - MOVOU X13, X9 - LONG $0x6c0f4566; BYTE $0xcc // PUNPCKLQDQ XMM9, XMM12 /* m[6], ____ */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 64(DX), X11 // X11 = m[8]+ m[9] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU X14, X10 - LONG $0x3a0f4566; WORD $0xd40f; BYTE $0x08 // PALIGNR XMM10, XMM12, 0x8 /* m[1], m[12] */ - LONG $0x6d0f4566; BYTE $0xf6 // PUNPCKHQDQ XMM14, XMM14 /* ___, m[13] */ - LONG $0x6c0f4566; BYTE $0xde // PUNPCKLQDQ XMM11, XMM14 /* m[8], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 6 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 64(DX), X15 // X15 = m[8]+ m[9] - MOVOU X13, X8 - LONG $0x6c0f4566; BYTE $0xc6 // PUNPCKLQDQ XMM8, XMM14 /* m[2], m[6] */ - MOVOU X12, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[0], m[8] */ - MOVOU 80(DX), X12 // X12 = m[10]+m[11] - MOVOU 96(DX), X10 // X10 = m[12]+m[13] - LONG $0x6c0f4566; BYTE $0xd4 // PUNPCKLQDQ XMM10, XMM12 /* m[12], m[10] */ - MOVOU X12, X11 - LONG $0x6d0f4566; BYTE $0xdd // PUNPCKHQDQ XMM11, XMM13 /* m[11], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 48(DX), X14 // X14 = m[6]+ m[7] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X14, X9 - LONG $0x6d0f4566; BYTE $0xce // PUNPCKHQDQ XMM9, XMM14 /* ___, m[7] */ - MOVOU X13, X8 - LONG $0x6c0f4566; BYTE $0xc1 // PUNPCKLQDQ XMM8, XMM9 /* m[4], ____ */ - MOVOU X15, X9 - LONG $0x6d0f4566; BYTE $0xcc // PUNPCKHQDQ XMM9, XMM12 /* m[15], m[1] */ - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 96(DX), X10 // X10 = m[12]+m[13] - LONG $0x6d0f4566; BYTE $0xd5 // PUNPCKHQDQ XMM10, XMM13 /* m[13], m[5] */ - LONG $0x6d0f4566; BYTE $0xe4 // PUNPCKHQDQ XMM12, XMM12 /* ___, m[9] */ - MOVOU X15, X11 - LONG $0x6c0f4566; BYTE $0xdc // PUNPCKLQDQ XMM11, XMM12 /* m[14], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 7 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X12, X9 - LONG $0x6d0f4566; BYTE $0xcc // PUNPCKHQDQ XMM9, XMM12 /* ___, m[1] */ - MOVOU X14, X8 - LONG $0x6c0f4566; BYTE $0xc1 // PUNPCKLQDQ XMM8, XMM9 /* m[12], ____ */ - MOVOU X15, X9 - LONG $0x6c0f4566; BYTE $0xcd // PUNPCKLQDQ XMM9, XMM13 /* m[14], m[4] */ - MOVOU 80(DX), X11 // X11 = m[10]+m[11] - MOVOU X13, X10 - LONG $0x6d0f4566; BYTE $0xd7 // PUNPCKHQDQ XMM10, XMM15 /* m[5], m[15] */ - LONG $0x3a0f4566; WORD $0xde0f; BYTE $0x08 // PALIGNR XMM11, XMM14, 0x8 /* m[13], m[10] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[0], m[6] */ - MOVOU X14, X9 - LONG $0x3a0f4566; WORD $0xce0f; BYTE $0x08 // PALIGNR XMM9, XMM14, 0x8 /* m[9], m[8] */ - MOVOU 16(DX), X11 // X14 = m[2]+ m[3] - MOVOU X13, X10 - LONG $0x6d0f4566; BYTE $0xd3 // PUNPCKHQDQ XMM10, XMM11 /* m[7], m[3] */ - LONG $0x6d0f4566; BYTE $0xff // PUNPCKHQDQ XMM15, XMM15 /* ___, m[11] */ - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[2], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 8 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X14, X8 - LONG $0x6d0f4566; BYTE $0xc5 // PUNPCKHQDQ XMM8, XMM13 /* m[13], m[7] */ - MOVOU X12, X10 - LONG $0x6d0f4566; BYTE $0xd4 // PUNPCKHQDQ XMM10, XMM12 /* ___, m[3] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xca // PUNPCKLQDQ XMM9, XMM10 /* m[12], ____ */ - MOVOU 0(DX), X11 // X11 = m[0]+ m[1] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU X15, X10 - LONG $0x3a0f4566; WORD $0xd60f; BYTE $0x08 // PALIGNR XMM10, XMM14, 0x8 /* m[11], m[14] */ - LONG $0x6d0f4566; BYTE $0xdd // PUNPCKHQDQ XMM11, XMM13 /* m[1], m[9] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X13, X8 - LONG $0x6d0f4566; BYTE $0xc7 // PUNPCKHQDQ XMM8, XMM15 /* m[5], m[15] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xcc // PUNPCKLQDQ XMM9, XMM12 /* m[8], m[2] */ - MOVOU 0(DX), X10 // X10 = m[0]+ m[1] - MOVOU 48(DX), X11 // X11 = m[6]+ m[7] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - LONG $0x6c0f4566; BYTE $0xd5 // PUNPCKLQDQ XMM10, XMM13 /* m[0], m[4] */ - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[6], m[10] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 9 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X13, X8 - LONG $0x6c0f4566; BYTE $0xc7 // PUNPCKLQDQ XMM8, XMM15 /* m[6], m[14] */ - MOVOU X12, X9 - LONG $0x3a0f4566; WORD $0xce0f; BYTE $0x08 // PALIGNR XMM9, XMM14, 0x8 /* m[11], m[0] */ - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 64(DX), X11 // X11 = m[8]+ m[9] - MOVOU X15, X10 - LONG $0x6d0f4566; BYTE $0xd3 // PUNPCKHQDQ XMM10, XMM11 /* m[15], m[9] */ - LONG $0x3a0f4566; WORD $0xdd0f; BYTE $0x08 // PALIGNR XMM11, XMM13, 0x8 /* m[3], m[8] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 16(DX), X13 // X13 = m[2]+ m[3] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - MOVOU X15, X9 - LONG $0x6d0f4566; BYTE $0xcf // PUNPCKHQDQ XMM9, XMM15 /* ___, m[13] */ - MOVOU X15, X8 - LONG $0x6c0f4566; BYTE $0xc1 // PUNPCKLQDQ XMM8, XMM9 /* m[12], ____ */ - MOVOU X14, X9 - LONG $0x3a0f4566; WORD $0xcc0f; BYTE $0x08 // PALIGNR XMM9, XMM12, 0x8 /* m[1], m[10] */ - MOVOU 32(DX), X12 // X12 = m[4]+ m[5] - MOVOU 48(DX), X15 // X15 = m[6]+ m[7] - MOVOU X15, X11 - LONG $0x6d0f4566; BYTE $0xdf // PUNPCKHQDQ XMM11, XMM15 /* ___, m[7] */ - MOVOU X13, X10 - LONG $0x6c0f4566; BYTE $0xd3 // PUNPCKLQDQ XMM10, XMM11 /* m[2], ____ */ - MOVOU X12, X15 - LONG $0x6d0f4566; BYTE $0xfc // PUNPCKHQDQ XMM15, XMM12 /* ___, m[5] */ - MOVOU X12, X11 - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[4], ____ */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 0 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 48(DX), X13 // X13 = m[6]+ m[7] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 80(DX), X15 // X15 = m[10]+m[11] - MOVOU X15, X8 - LONG $0x6c0f4566; BYTE $0xc6 // PUNPCKLQDQ XMM8, XMM14 /* m[10], m[8] */ - MOVOU X13, X9 - LONG $0x6d0f4566; BYTE $0xcc // PUNPCKHQDQ XMM9, XMM12 /* m[7], m[1] */ - MOVOU 16(DX), X10 // X10 = m[2]+ m[3] - MOVOU 32(DX), X14 // X14 = m[4]+ m[5] - LONG $0x6c0f4566; BYTE $0xd6 // PUNPCKLQDQ XMM10, XMM14 /* m[2], m[4] */ - MOVOU X14, X15 - LONG $0x6d0f4566; BYTE $0xfe // PUNPCKHQDQ XMM15, XMM14 /* ___, m[5] */ - MOVOU X13, X11 - LONG $0x6c0f4566; BYTE $0xdf // PUNPCKLQDQ XMM11, XMM15 /* m[6], ____ */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 64(DX), X13 // X13 = m[8]+ m[9] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X15, X8 - LONG $0x6d0f4566; BYTE $0xc5 // PUNPCKHQDQ XMM8, XMM13 /* m[15], m[9] */ - MOVOU X12, X9 - LONG $0x6d0f4566; BYTE $0xce // PUNPCKHQDQ XMM9, XMM14 /* m[3], m[13] */ - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU X15, X10 - LONG $0x3a0f4566; WORD $0xd50f; BYTE $0x08 // PALIGNR XMM10, XMM13, 0x8 /* m[11], m[14] */ - MOVOU X14, X11 - LONG $0x6c0f4566; BYTE $0xdc // PUNPCKLQDQ XMM11, XMM12 /* m[12], m[0] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 1 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+m[1] - MOVOU 16(DX), X13 // X13 = m[2]+m[3] - MOVOU 32(DX), X14 // X14 = m[4]+m[5] - MOVOU 48(DX), X15 // X15 = m[6]+m[7] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[0], m[2] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[4], m[6] */ - MOVOU X12, X10 - LONG $0x6d0f4566; BYTE $0xd5 // PUNPCKHQDQ XMM10, XMM13 /* m[1], m[3] */ - MOVOU X14, X11 - LONG $0x6d0f4566; BYTE $0xdf // PUNPCKHQDQ XMM11, XMM15 /* m[5], m[7] */ - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 64(DX), X12 // X12 = m[8]+ m[9] - MOVOU 80(DX), X13 // X13 = m[10]+m[11] - MOVOU 96(DX), X14 // X14 = m[12]+m[13] - MOVOU 112(DX), X15 // X15 = m[14]+m[15] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[8],m[10] */ - MOVOU X14, X9 - LONG $0x6c0f4566; BYTE $0xcf // PUNPCKLQDQ XMM9, XMM15 /* m[12],m[14] */ - MOVOU X12, X10 - LONG $0x6d0f4566; BYTE $0xd5 // PUNPCKHQDQ XMM10, XMM13 /* m[9],m[11] */ - MOVOU X14, X11 - LONG $0x6d0f4566; BYTE $0xdf // PUNPCKHQDQ XMM11, XMM15 /* m[13],m[15] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - /////////////////////////////////////////////////////////////////////////// - // R O U N D 1 2 - /////////////////////////////////////////////////////////////////////////// - - // LOAD_MSG_ ##r ##_1 / ##_2(b0, b1); (X12 is temp register) - MOVOU 112(DX), X12 // X12 = m[14]+m[15] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 64(DX), X14 // X14 = m[8]+ m[9] - MOVOU 96(DX), X15 // X15 = m[12]+m[13] - MOVOU X12, X8 - LONG $0x6c0f4566; BYTE $0xc5 // PUNPCKLQDQ XMM8, XMM13 /* m[14], m[4] */ - MOVOU X14, X9 - LONG $0x6d0f4566; BYTE $0xcf // PUNPCKHQDQ XMM9, XMM15 /* m[9], m[13] */ - MOVOU 80(DX), X10 // X10 = m[10]+m[11] - MOVOU 48(DX), X11 // X11 = m[6]+ m[7] - LONG $0x6c0f4566; BYTE $0xd6 // PUNPCKLQDQ XMM10, XMM14 /* m[10], m[8] */ - LONG $0x3a0f4566; WORD $0xdc0f; BYTE $0x08 // PALIGNR XMM11, XMM12, 0x8 /* m[15], m[6] */; ; ; ; ; - - LOAD_SHUFFLE - G1 - G2 - DIAGONALIZE - - // LOAD_MSG_ ##r ##_3 / ##_4(b0, b1); (X12 is temp register) - MOVOU 0(DX), X12 // X12 = m[0]+ m[1] - MOVOU 32(DX), X13 // X13 = m[4]+ m[5] - MOVOU 80(DX), X14 // X14 = m[10]+m[11] - MOVOU X12, X8 - LONG $0x3a0f4566; WORD $0xc40f; BYTE $0x08 // PALIGNR XMM8, XMM12, 0x8 /* m[1], m[0] */ - MOVOU X14, X9 - LONG $0x6d0f4566; BYTE $0xcd // PUNPCKHQDQ XMM9, XMM13 /* m[11], m[5] */ - MOVOU 16(DX), X12 // X12 = m[2]+ m[3] - MOVOU 48(DX), X11 // X11 = m[6]+ m[7] - MOVOU 96(DX), X10 // X10 = m[12]+m[13] - LONG $0x6c0f4566; BYTE $0xd4 // PUNPCKLQDQ XMM10, XMM12 /* m[12], m[2] */ - LONG $0x6d0f4566; BYTE $0xdc // PUNPCKHQDQ XMM11, XMM12 /* m[7], m[3] */ - - LOAD_SHUFFLE - G1 - G2 - UNDIAGONALIZE - - // Reload digest (most current value store in &out) - MOVQ out+144(FP), SI // SI: &in - MOVOU 0(SI), X12 // X12 = in[0]+in[1] /* row1l = LOAD( &S->h[0] ); */ - MOVOU 16(SI), X13 // X13 = in[2]+in[3] /* row1h = LOAD( &S->h[2] ); */ - MOVOU 32(SI), X14 // X14 = in[4]+in[5] /* row2l = LOAD( &S->h[4] ); */ - MOVOU 48(SI), X15 // X15 = in[6]+in[7] /* row2h = LOAD( &S->h[6] ); */ - - // Final computations and prepare for storing - PXOR X4, X0 // X0 = X0 ^ X4 /* row1l = _mm_xor_si128( row3l, row1l ); */ - PXOR X5, X1 // X1 = X1 ^ X5 /* row1h = _mm_xor_si128( row3h, row1h ); */ - PXOR X12, X0 // X0 = X0 ^ X12 /* STORE( &S->h[0], _mm_xor_si128( LOAD( &S->h[0] ), row1l ) ); */ - PXOR X13, X1 // X1 = X1 ^ X13 /* STORE( &S->h[2], _mm_xor_si128( LOAD( &S->h[2] ), row1h ) ); */ - PXOR X6, X2 // X2 = X2 ^ X6 /* row2l = _mm_xor_si128( row4l, row2l ); */ - PXOR X7, X3 // X3 = X3 ^ X7 /* row2h = _mm_xor_si128( row4h, row2h ); */ - PXOR X14, X2 // X2 = X2 ^ X14 /* STORE( &S->h[4], _mm_xor_si128( LOAD( &S->h[4] ), row2l ) ); */ - PXOR X15, X3 // X3 = X3 ^ X15 /* STORE( &S->h[6], _mm_xor_si128( LOAD( &S->h[6] ), row2h ) ); */ - - // Store digest into &out - MOVQ out+144(FP), SI // SI: &out - MOVOU X0, 0(SI) // out[0]+out[1] = X0 - MOVOU X1, 16(SI) // out[2]+out[3] = X1 - MOVOU X2, 32(SI) // out[4]+out[5] = X2 - MOVOU X3, 48(SI) // out[6]+out[7] = X3 - - // Increment message pointer and check if there's more to do - ADDQ $128, DX // message += 128 - SUBQ $1, R8 - JNZ loop - -complete: - RET diff --git a/vendor/github.com/minio/blake2b-simd/compress_amd64.go b/vendor/github.com/minio/blake2b-simd/compress_amd64.go deleted file mode 100644 index 4fc5e388..00000000 --- a/vendor/github.com/minio/blake2b-simd/compress_amd64.go +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package blake2b - -func compress(d *digest, p []uint8) { - // Verifies if AVX2 or AVX is available, use optimized code path. - if avx2 { - compressAVX2(d, p) - } else if avx { - compressAVX(d, p) - } else if ssse3 { - compressSSE(d, p) - } else { - compressGeneric(d, p) - } -} diff --git a/vendor/github.com/minio/blake2b-simd/compress_generic.go b/vendor/github.com/minio/blake2b-simd/compress_generic.go deleted file mode 100644 index e9e16e8b..00000000 --- a/vendor/github.com/minio/blake2b-simd/compress_generic.go +++ /dev/null @@ -1,1419 +0,0 @@ -// Written in 2012 by Dmitry Chestnykh. -// -// To the extent possible under law, the author have dedicated all copyright -// and related and neighboring rights to this software to the public domain -// worldwide. This software is distributed without any warranty. -// http://creativecommons.org/publicdomain/zero/1.0/ - -package blake2b - -func compressGeneric(d *digest, p []uint8) { - h0, h1, h2, h3, h4, h5, h6, h7 := d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] - - for len(p) >= BlockSize { - // Increment counter. - d.t[0] += BlockSize - if d.t[0] < BlockSize { - d.t[1]++ - } - // Initialize compression function. - v0, v1, v2, v3, v4, v5, v6, v7 := h0, h1, h2, h3, h4, h5, h6, h7 - v8 := iv[0] - v9 := iv[1] - v10 := iv[2] - v11 := iv[3] - v12 := iv[4] ^ d.t[0] - v13 := iv[5] ^ d.t[1] - v14 := iv[6] ^ d.f[0] - v15 := iv[7] ^ d.f[1] - - j := 0 - var m [16]uint64 - for i := range m { - m[i] = uint64(p[j]) | uint64(p[j+1])<<8 | uint64(p[j+2])<<16 | - uint64(p[j+3])<<24 | uint64(p[j+4])<<32 | uint64(p[j+5])<<40 | - uint64(p[j+6])<<48 | uint64(p[j+7])<<56 - j += 8 - } - - // Round 1. - v0 += m[0] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[2] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[4] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[6] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[5] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[7] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[3] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[1] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[8] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[10] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[12] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[14] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[13] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[15] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[11] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[9] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 2. - v0 += m[14] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[4] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[9] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[13] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[15] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[6] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[8] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[10] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[1] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[0] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[11] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[5] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[7] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[3] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[2] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[12] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 3. - v0 += m[11] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[12] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[5] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[15] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[2] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[13] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[0] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[8] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[10] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[3] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[7] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[9] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[1] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[4] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[6] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[14] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 4. - v0 += m[7] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[3] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[13] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[11] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[12] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[14] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[1] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[9] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[2] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[5] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[4] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[15] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[0] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[8] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[10] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[6] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 5. - v0 += m[9] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[5] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[2] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[10] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[4] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[15] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[7] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[0] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[14] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[11] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[6] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[3] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[8] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[13] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[12] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[1] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 6. - v0 += m[2] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[6] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[0] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[8] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[11] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[3] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[10] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[12] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[4] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[7] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[15] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[1] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[14] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[9] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[5] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[13] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 7. - v0 += m[12] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[1] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[14] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[4] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[13] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[10] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[15] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[5] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[0] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[6] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[9] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[8] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[2] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[11] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[3] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[7] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 8. - v0 += m[13] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[7] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[12] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[3] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[1] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[9] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[14] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[11] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[5] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[15] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[8] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[2] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[6] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[10] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[4] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[0] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 9. - v0 += m[6] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[14] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[11] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[0] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[3] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[8] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[9] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[15] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[12] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[13] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[1] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[10] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[4] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[5] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[7] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[2] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 10. - v0 += m[10] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[8] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[7] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[1] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[6] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[5] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[4] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[2] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[15] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[9] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[3] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[13] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[12] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[0] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[14] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[11] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 11. - v0 += m[0] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[2] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[4] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[6] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[5] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[7] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[3] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[1] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[8] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[10] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[12] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[14] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[13] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[15] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[11] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[9] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - // Round 12. - v0 += m[14] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-32) | v12>>32 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-24) | v4>>24 - v1 += m[4] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-32) | v13>>32 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-24) | v5>>24 - v2 += m[9] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-32) | v14>>32 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-24) | v6>>24 - v3 += m[13] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-32) | v15>>32 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-24) | v7>>24 - v2 += m[15] - v2 += v6 - v14 ^= v2 - v14 = v14<<(64-16) | v14>>16 - v10 += v14 - v6 ^= v10 - v6 = v6<<(64-63) | v6>>63 - v3 += m[6] - v3 += v7 - v15 ^= v3 - v15 = v15<<(64-16) | v15>>16 - v11 += v15 - v7 ^= v11 - v7 = v7<<(64-63) | v7>>63 - v1 += m[8] - v1 += v5 - v13 ^= v1 - v13 = v13<<(64-16) | v13>>16 - v9 += v13 - v5 ^= v9 - v5 = v5<<(64-63) | v5>>63 - v0 += m[10] - v0 += v4 - v12 ^= v0 - v12 = v12<<(64-16) | v12>>16 - v8 += v12 - v4 ^= v8 - v4 = v4<<(64-63) | v4>>63 - v0 += m[1] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-32) | v15>>32 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-24) | v5>>24 - v1 += m[0] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-32) | v12>>32 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-24) | v6>>24 - v2 += m[11] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-32) | v13>>32 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-24) | v7>>24 - v3 += m[5] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-32) | v14>>32 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-24) | v4>>24 - v2 += m[7] - v2 += v7 - v13 ^= v2 - v13 = v13<<(64-16) | v13>>16 - v8 += v13 - v7 ^= v8 - v7 = v7<<(64-63) | v7>>63 - v3 += m[3] - v3 += v4 - v14 ^= v3 - v14 = v14<<(64-16) | v14>>16 - v9 += v14 - v4 ^= v9 - v4 = v4<<(64-63) | v4>>63 - v1 += m[2] - v1 += v6 - v12 ^= v1 - v12 = v12<<(64-16) | v12>>16 - v11 += v12 - v6 ^= v11 - v6 = v6<<(64-63) | v6>>63 - v0 += m[12] - v0 += v5 - v15 ^= v0 - v15 = v15<<(64-16) | v15>>16 - v10 += v15 - v5 ^= v10 - v5 = v5<<(64-63) | v5>>63 - - h0 ^= v0 ^ v8 - h1 ^= v1 ^ v9 - h2 ^= v2 ^ v10 - h3 ^= v3 ^ v11 - h4 ^= v4 ^ v12 - h5 ^= v5 ^ v13 - h6 ^= v6 ^ v14 - h7 ^= v7 ^ v15 - - p = p[BlockSize:] - } - d.h[0], d.h[1], d.h[2], d.h[3], d.h[4], d.h[5], d.h[6], d.h[7] = h0, h1, h2, h3, h4, h5, h6, h7 -} diff --git a/vendor/github.com/minio/blake2b-simd/compress_noasm.go b/vendor/github.com/minio/blake2b-simd/compress_noasm.go deleted file mode 100644 index d3c67584..00000000 --- a/vendor/github.com/minio/blake2b-simd/compress_noasm.go +++ /dev/null @@ -1,23 +0,0 @@ -//+build !amd64 noasm appengine - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package blake2b - -func compress(d *digest, p []uint8) { - compressGeneric(d, p) -} diff --git a/vendor/github.com/minio/blake2b-simd/cpuid.go b/vendor/github.com/minio/blake2b-simd/cpuid.go deleted file mode 100644 index a9f95508..00000000 --- a/vendor/github.com/minio/blake2b-simd/cpuid.go +++ /dev/null @@ -1,60 +0,0 @@ -// +build 386,!gccgo amd64,!gccgo - -// Copyright 2016 Frank Wessels -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package blake2b - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -func xgetbv(index uint32) (eax, edx uint32) - -// True when SIMD instructions are available. -var avx2 = haveAVX2() -var avx = haveAVX() -var ssse3 = haveSSSE3() - -// haveAVX returns true when there is AVX support -func haveAVX() bool { - _, _, c, _ := cpuid(1) - - // Check XGETBV, OXSAVE and AVX bits - if c&(1<<26) != 0 && c&(1<<27) != 0 && c&(1<<28) != 0 { - // Check for OS support - eax, _ := xgetbv(0) - return (eax & 0x6) == 0x6 - } - return false -} - -// haveAVX2 returns true when there is AVX2 support -func haveAVX2() bool { - mfi, _, _, _ := cpuid(0) - - // Check AVX2, AVX2 requires OS support, but BMI1/2 don't. - if mfi >= 7 && haveAVX() { - _, ebx, _, _ := cpuidex(7, 0) - return (ebx & 0x00000020) != 0 - } - return false -} - -// haveSSSE3 returns true when there is SSSE3 support -func haveSSSE3() bool { - - _, _, c, _ := cpuid(1) - - return (c & 0x00000200) != 0 -} diff --git a/vendor/github.com/minio/blake2b-simd/cpuid_386.s b/vendor/github.com/minio/blake2b-simd/cpuid_386.s deleted file mode 100644 index fa38814e..00000000 --- a/vendor/github.com/minio/blake2b-simd/cpuid_386.s +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. - -// +build 386,!gccgo - -// func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuid(SB), 7, $0 - XORL CX, CX - MOVL op+0(FP), AX - CPUID - MOVL AX, eax+4(FP) - MOVL BX, ebx+8(FP) - MOVL CX, ecx+12(FP) - MOVL DX, edx+16(FP) - RET - -// func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuidex(SB), 7, $0 - MOVL op+0(FP), AX - MOVL op2+4(FP), CX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - -// func xgetbv(index uint32) (eax, edx uint32) -TEXT ·xgetbv(SB), 7, $0 - MOVL index+0(FP), CX - BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV - MOVL AX, eax+4(FP) - MOVL DX, edx+8(FP) - RET diff --git a/vendor/github.com/minio/blake2b-simd/cpuid_amd64.s b/vendor/github.com/minio/blake2b-simd/cpuid_amd64.s deleted file mode 100644 index fb45a656..00000000 --- a/vendor/github.com/minio/blake2b-simd/cpuid_amd64.s +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. - -// +build amd64,!gccgo - -// func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuid(SB), 7, $0 - XORQ CX, CX - MOVL op+0(FP), AX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - - -// func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuidex(SB), 7, $0 - MOVL op+0(FP), AX - MOVL op2+4(FP), CX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - -// func xgetbv(index uint32) (eax, edx uint32) -TEXT ·xgetbv(SB), 7, $0 - MOVL index+0(FP), CX - BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV - MOVL AX, eax+8(FP) - MOVL DX, edx+12(FP) - RET diff --git a/vendor/github.com/minio/sha256-simd/.gitignore b/vendor/github.com/minio/sha256-simd/.gitignore deleted file mode 100644 index c56069fe..00000000 --- a/vendor/github.com/minio/sha256-simd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.test \ No newline at end of file diff --git a/vendor/github.com/minio/sha256-simd/.travis.yml b/vendor/github.com/minio/sha256-simd/.travis.yml deleted file mode 100644 index 744e64cf..00000000 --- a/vendor/github.com/minio/sha256-simd/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -sudo: required -dist: trusty -language: go - -os: -- linux - -go: -- tip -- 1.11.x - -env: -- ARCH=x86_64 -- ARCH=i686 - -matrix: - fast_finish: true - allow_failures: - - go: tip - -script: -- diff -au <(gofmt -d .) <(printf "") -- go test -race -v ./... -- go tool vet -asmdecl . diff --git a/vendor/github.com/minio/sha256-simd/README.md b/vendor/github.com/minio/sha256-simd/README.md deleted file mode 100644 index 5282d83a..00000000 --- a/vendor/github.com/minio/sha256-simd/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# sha256-simd - -Accelerate SHA256 computations in pure Go using AVX512, SHA Extensions and AVX2 for Intel and ARM64 for ARM. On AVX512 it provides an up to 8x improvement (over 3 GB/s per core) in comparison to AVX2. SHA Extensions give a performance boost of close to 4x over AVX2. - -## Introduction - -This package is designed as a replacement for `crypto/sha256`. For Intel CPUs it has two flavors for AVX512 and AVX2 (AVX/SSE are also supported). For ARM CPUs with the Cryptography Extensions, advantage is taken of the SHA2 instructions resulting in a massive performance improvement. - -This package uses Golang assembly. The AVX512 version is based on the Intel's "multi-buffer crypto library for IPSec" whereas the other Intel implementations are described in "Fast SHA-256 Implementations on Intel Architecture Processors" by J. Guilford et al. - -## New: Support for Intel SHA Extensions - -Support for the Intel SHA Extensions has been added by Kristofer Peterson (@svenski123), originally developed for spacemeshos [here](https://github.com/spacemeshos/POET/issues/23). On CPUs that support it (known thus far Intel Celeron J3455 and AMD Ryzen) it gives a significant boost in performance (with thanks to @AudriusButkevicius for reporting the results; full results [here](https://github.com/minio/sha256-simd/pull/37#issuecomment-451607827)). - -``` -$ benchcmp avx2.txt sha-ext.txt -benchmark AVX2 MB/s SHA Ext MB/s speedup -BenchmarkHash5M 514.40 1975.17 3.84x -``` - -Thanks to Kristofer Peterson, we also added additional performance changes such as optimized padding, endian conversions which sped up all implementations i.e. Intel SHA alone while doubled performance for small sizes, the other changes increased everything roughly 50%. - -## Support for AVX512 - -We have added support for AVX512 which results in an up to 8x performance improvement over AVX2 (3.0 GHz Xeon Platinum 8124M CPU): - -``` -$ benchcmp avx2.txt avx512.txt -benchmark AVX2 MB/s AVX512 MB/s speedup -BenchmarkHash5M 448.62 3498.20 7.80x -``` - -The original code was developed by Intel as part of the [multi-buffer crypto library](https://github.com/intel/intel-ipsec-mb) for IPSec or more specifically this [AVX512](https://github.com/intel/intel-ipsec-mb/blob/master/avx512/sha256_x16_avx512.asm) implementation. The key idea behind it is to process a total of 16 checksums in parallel by “transposing” 16 (independent) messages of 64 bytes between a total of 16 ZMM registers (each 64 bytes wide). - -Transposing the input messages means that in order to take full advantage of the speedup you need to have a (server) workload where multiple threads are doing SHA256 calculations in parallel. Unfortunately for this algorithm it is not possible for two message blocks processed in parallel to be dependent on one another — because then the (interim) result of the first part of the message has to be an input into the processing of the second part of the message. - -Whereas the original Intel C implementation requires some sort of explicit scheduling of messages to be processed in parallel, for Golang it makes sense to take advantage of channels in order to group messages together and use channels as well for sending back the results (thereby effectively decoupling the calculations). We have implemented a fairly simple scheduling mechanism that seems to work well in practice. - -Due to this different way of scheduling, we decided to use an explicit method to instantiate the AVX512 version. Essentially one or more AVX512 processing servers ([`Avx512Server`](https://github.com/minio/sha256-simd/blob/master/sha256blockAvx512_amd64.go#L294)) have to be created whereby each server can hash over 3 GB/s on a single core. An `hash.Hash` object ([`Avx512Digest`](https://github.com/minio/sha256-simd/blob/master/sha256blockAvx512_amd64.go#L45)) is then instantiated using one of these servers and used in the regular fashion: - -```go -import "github.com/minio/sha256-simd" - -func main() { - server := sha256.NewAvx512Server() - h512 := sha256.NewAvx512(server) - h512.Write(fileBlock) - digest := h512.Sum([]byte{}) -} -``` - -Note that, because of the scheduling overhead, for small messages (< 1 MB) you will be better off using the regular SHA256 hashing (but those are typically not performance critical anyway). Some other tips to get the best performance: -* Have many go routines doing SHA256 calculations in parallel. -* Try to Write() messages in multiples of 64 bytes. -* Try to keep the overall length of messages to a roughly similar size ie. 5 MB (this way all 16 ‘lanes’ in the AVX512 computations are contributing as much as possible). - -More detailed information can be found in this [blog](https://blog.minio.io/accelerate-sha256-up-to-8x-over-3-gb-s-per-core-with-avx512-a0b1d64f78f) post including scaling across cores. - -## Drop-In Replacement - -The following code snippet shows how you can use `github.com/minio/sha256-simd`. This will automatically select the fastest method for the architecture on which it will be executed. - -```go -import "github.com/minio/sha256-simd" - -func main() { - ... - shaWriter := sha256.New() - io.Copy(shaWriter, file) - ... -} -``` - -## Performance - -Below is the speed in MB/s for a single core (ranked fast to slow) for blocks larger than 1 MB. - -| Processor | SIMD | Speed (MB/s) | -| --------------------------------- | ------- | ------------:| -| 3.0 GHz Intel Xeon Platinum 8124M | AVX512 | 3498 | -| 3.7 GHz AMD Ryzen 7 2700X | SHA Ext | 1979 | -| 1.2 GHz ARM Cortex-A53 | ARM64 | 638 | -| 3.0 GHz Intel Xeon Platinum 8124M | AVX2 | 449 | -| 3.1 GHz Intel Core i7 | AVX | 362 | -| 3.1 GHz Intel Core i7 | SSE | 299 | - -## asm2plan9s - -In order to be able to work more easily with AVX512/AVX2 instructions, a separate tool was developed to convert SIMD instructions into the corresponding BYTE sequence as accepted by Go assembly. See [asm2plan9s](https://github.com/minio/asm2plan9s) for more information. - -## Why and benefits - -One of the most performance sensitive parts of the [Minio](https://github.com/minio/minio) object storage server is related to SHA256 hash sums calculations. For instance during multi part uploads each part that is uploaded needs to be verified for data integrity by the server. - -Other applications that can benefit from enhanced SHA256 performance are deduplication in storage systems, intrusion detection, version control systems, integrity checking, etc. - -## ARM SHA Extensions - -The 64-bit ARMv8 core has introduced new instructions for SHA1 and SHA2 acceleration as part of the [Cryptography Extensions](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0501f/CHDFJBCJ.html). Below you can see a small excerpt highlighting one of the rounds as is done for the SHA256 calculation process (for full code see [sha256block_arm64.s](https://github.com/minio/sha256-simd/blob/master/sha256block_arm64.s)). - - ``` - sha256h q2, q3, v9.4s - sha256h2 q3, q4, v9.4s - sha256su0 v5.4s, v6.4s - rev32 v8.16b, v8.16b - add v9.4s, v7.4s, v18.4s - mov v4.16b, v2.16b - sha256h q2, q3, v10.4s - sha256h2 q3, q4, v10.4s - sha256su0 v6.4s, v7.4s - sha256su1 v5.4s, v7.4s, v8.4s - ``` - -### Detailed benchmarks - -Benchmarks generated on a 1.2 Ghz Quad-Core ARM Cortex A53 equipped [Pine64](https://www.pine64.com/). - -``` -minio@minio-arm:$ benchcmp golang.txt arm64.txt -benchmark golang arm64 speedup -BenchmarkHash8Bytes-4 0.68 MB/s 5.70 MB/s 8.38x -BenchmarkHash1K-4 5.65 MB/s 326.30 MB/s 57.75x -BenchmarkHash8K-4 6.00 MB/s 570.63 MB/s 95.11x -BenchmarkHash1M-4 6.05 MB/s 638.23 MB/s 105.49x -``` - -## License - -Released under the Apache License v2.0. You can find the complete text in the file LICENSE. - -## Contributing - -Contributions are welcome, please send PRs for any enhancements. diff --git a/vendor/github.com/minio/sha256-simd/appveyor.yml b/vendor/github.com/minio/sha256-simd/appveyor.yml deleted file mode 100644 index a66bfa9f..00000000 --- a/vendor/github.com/minio/sha256-simd/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# version format -version: "{build}" - -# Operating system (build VM template) -os: Windows Server 2012 R2 - -# Platform. -platform: x64 - -clone_folder: c:\gopath\src\github.com\minio\sha256-simd - -# environment variables -environment: - GOPATH: c:\gopath - GO15VENDOREXPERIMENT: 1 - -# scripts that run after cloning repository -install: - - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% - - go version - - go env - -# to run your custom scripts instead of automatic MSBuild -build_script: - - go test . - - go test -race . - -# to disable automatic tests -test: off - -# to disable deployment -deploy: off diff --git a/vendor/github.com/minio/sha256-simd/cpuid.go b/vendor/github.com/minio/sha256-simd/cpuid.go deleted file mode 100644 index 878ad463..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid.go +++ /dev/null @@ -1,119 +0,0 @@ -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -// True when SIMD instructions are available. -var avx512 bool -var avx2 bool -var avx bool -var sse bool -var sse2 bool -var sse3 bool -var ssse3 bool -var sse41 bool -var sse42 bool -var popcnt bool -var sha bool -var armSha = haveArmSha() - -func init() { - var _xsave bool - var _osxsave bool - var _avx bool - var _avx2 bool - var _avx512f bool - var _avx512dq bool - // var _avx512pf bool - // var _avx512er bool - // var _avx512cd bool - var _avx512bw bool - var _avx512vl bool - var _sseState bool - var _avxState bool - var _opmaskState bool - var _zmmHI256State bool - var _hi16ZmmState bool - - mfi, _, _, _ := cpuid(0) - - if mfi >= 1 { - _, _, c, d := cpuid(1) - - sse = (d & (1 << 25)) != 0 - sse2 = (d & (1 << 26)) != 0 - sse3 = (c & (1 << 0)) != 0 - ssse3 = (c & (1 << 9)) != 0 - sse41 = (c & (1 << 19)) != 0 - sse42 = (c & (1 << 20)) != 0 - popcnt = (c & (1 << 23)) != 0 - _xsave = (c & (1 << 26)) != 0 - _osxsave = (c & (1 << 27)) != 0 - _avx = (c & (1 << 28)) != 0 - } - - if mfi >= 7 { - _, b, _, _ := cpuid(7) - - _avx2 = (b & (1 << 5)) != 0 - _avx512f = (b & (1 << 16)) != 0 - _avx512dq = (b & (1 << 17)) != 0 - // _avx512pf = (b & (1 << 26)) != 0 - // _avx512er = (b & (1 << 27)) != 0 - // _avx512cd = (b & (1 << 28)) != 0 - _avx512bw = (b & (1 << 30)) != 0 - _avx512vl = (b & (1 << 31)) != 0 - sha = (b & (1 << 29)) != 0 - } - - // Stop here if XSAVE unsupported or not enabled - if !_xsave || !_osxsave { - return - } - - if _xsave && _osxsave { - a, _ := xgetbv(0) - - _sseState = (a & (1 << 1)) != 0 - _avxState = (a & (1 << 2)) != 0 - _opmaskState = (a & (1 << 5)) != 0 - _zmmHI256State = (a & (1 << 6)) != 0 - _hi16ZmmState = (a & (1 << 7)) != 0 - } else { - _sseState = true - } - - // Very unlikely that OS would enable XSAVE and then disable SSE - if !_sseState { - sse = false - sse2 = false - sse3 = false - ssse3 = false - sse41 = false - sse42 = false - } - - if _avxState { - avx = _avx - avx2 = _avx2 - } - - if _opmaskState && _zmmHI256State && _hi16ZmmState { - avx512 = (_avx512f && - _avx512dq && - _avx512bw && - _avx512vl) - } -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_386.go b/vendor/github.com/minio/sha256-simd/cpuid_386.go deleted file mode 100644 index c9890be4..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_386.go +++ /dev/null @@ -1,24 +0,0 @@ -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -func xgetbv(index uint32) (eax, edx uint32) - -func haveArmSha() bool { - return false -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_386.s b/vendor/github.com/minio/sha256-simd/cpuid_386.s deleted file mode 100644 index 1511cd6f..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_386.s +++ /dev/null @@ -1,53 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2015 Klaus Post -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// +build 386,!gccgo - -// func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuid(SB), 7, $0 - XORL CX, CX - MOVL op+0(FP), AX - CPUID - MOVL AX, eax+4(FP) - MOVL BX, ebx+8(FP) - MOVL CX, ecx+12(FP) - MOVL DX, edx+16(FP) - RET - -// func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuidex(SB), 7, $0 - MOVL op+0(FP), AX - MOVL op2+4(FP), CX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - -// func xgetbv(index uint32) (eax, edx uint32) -TEXT ·xgetbv(SB), 7, $0 - MOVL index+0(FP), CX - BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV - MOVL AX, eax+4(FP) - MOVL DX, edx+8(FP) - RET diff --git a/vendor/github.com/minio/sha256-simd/cpuid_amd64.go b/vendor/github.com/minio/sha256-simd/cpuid_amd64.go deleted file mode 100644 index c9890be4..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_amd64.go +++ /dev/null @@ -1,24 +0,0 @@ -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -func xgetbv(index uint32) (eax, edx uint32) - -func haveArmSha() bool { - return false -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_amd64.s b/vendor/github.com/minio/sha256-simd/cpuid_amd64.s deleted file mode 100644 index b0f41474..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_amd64.s +++ /dev/null @@ -1,53 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2015 Klaus Post -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// +build amd64,!gccgo - -// func cpuid(op uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuid(SB), 7, $0 - XORQ CX, CX - MOVL op+0(FP), AX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - -// func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) -TEXT ·cpuidex(SB), 7, $0 - MOVL op+0(FP), AX - MOVL op2+4(FP), CX - CPUID - MOVL AX, eax+8(FP) - MOVL BX, ebx+12(FP) - MOVL CX, ecx+16(FP) - MOVL DX, edx+20(FP) - RET - -// func xgetbv(index uint32) (eax, edx uint32) -TEXT ·xgetbv(SB), 7, $0 - MOVL index+0(FP), CX - BYTE $0x0f; BYTE $0x01; BYTE $0xd0 // XGETBV - MOVL AX, eax+8(FP) - MOVL DX, edx+12(FP) - RET diff --git a/vendor/github.com/minio/sha256-simd/cpuid_arm.go b/vendor/github.com/minio/sha256-simd/cpuid_arm.go deleted file mode 100644 index 351dff4b..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_arm.go +++ /dev/null @@ -1,32 +0,0 @@ -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func xgetbv(index uint32) (eax, edx uint32) { - return 0, 0 -} - -func haveArmSha() bool { - return false -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_linux_arm64.go b/vendor/github.com/minio/sha256-simd/cpuid_linux_arm64.go deleted file mode 100644 index e739996d..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_linux_arm64.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build arm64,linux - -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -import ( - "bytes" - "io/ioutil" -) - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func xgetbv(index uint32) (eax, edx uint32) { - return 0, 0 -} - -// File to check for cpu capabilities. -const procCPUInfo = "/proc/cpuinfo" - -// Feature to check for. -const sha256Feature = "sha2" - -func haveArmSha() bool { - cpuInfo, err := ioutil.ReadFile(procCPUInfo) - if err != nil { - return false - } - return bytes.Contains(cpuInfo, []byte(sha256Feature)) -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_other.go b/vendor/github.com/minio/sha256-simd/cpuid_other.go deleted file mode 100644 index 04f26ce8..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_other.go +++ /dev/null @@ -1,34 +0,0 @@ -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// +build ppc64 ppc64le mips mipsle mips64 mips64le s390x wasm - -package sha256 - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func xgetbv(index uint32) (eax, edx uint32) { - return 0, 0 -} - -func haveArmSha() bool { - return false -} diff --git a/vendor/github.com/minio/sha256-simd/cpuid_others_arm64.go b/vendor/github.com/minio/sha256-simd/cpuid_others_arm64.go deleted file mode 100644 index 0fb4022f..00000000 --- a/vendor/github.com/minio/sha256-simd/cpuid_others_arm64.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build arm64,!linux - -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package sha256 - -func cpuid(op uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) { - return 0, 0, 0, 0 -} - -func xgetbv(index uint32) (eax, edx uint32) { - return 0, 0 -} - -// Check for sha2 instruction flag. -func haveArmSha() bool { - return false -} diff --git a/vendor/github.com/minio/sha256-simd/go.mod b/vendor/github.com/minio/sha256-simd/go.mod deleted file mode 100644 index b68fb0a0..00000000 --- a/vendor/github.com/minio/sha256-simd/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/minio/sha256-simd diff --git a/vendor/github.com/minio/sha256-simd/sha256.go b/vendor/github.com/minio/sha256-simd/sha256.go deleted file mode 100644 index 4e1f6d2f..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256.go +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -import ( - "crypto/sha256" - "encoding/binary" - "hash" - "runtime" -) - -// Size - The size of a SHA256 checksum in bytes. -const Size = 32 - -// BlockSize - The blocksize of SHA256 in bytes. -const BlockSize = 64 - -const ( - chunk = BlockSize - init0 = 0x6A09E667 - init1 = 0xBB67AE85 - init2 = 0x3C6EF372 - init3 = 0xA54FF53A - init4 = 0x510E527F - init5 = 0x9B05688C - init6 = 0x1F83D9AB - init7 = 0x5BE0CD19 -) - -// digest represents the partial evaluation of a checksum. -type digest struct { - h [8]uint32 - x [chunk]byte - nx int - len uint64 -} - -// Reset digest back to default -func (d *digest) Reset() { - d.h[0] = init0 - d.h[1] = init1 - d.h[2] = init2 - d.h[3] = init3 - d.h[4] = init4 - d.h[5] = init5 - d.h[6] = init6 - d.h[7] = init7 - d.nx = 0 - d.len = 0 -} - -type blockfuncType int - -const ( - blockfuncGeneric blockfuncType = iota - blockfuncAvx512 blockfuncType = iota - blockfuncAvx2 blockfuncType = iota - blockfuncAvx blockfuncType = iota - blockfuncSsse blockfuncType = iota - blockfuncSha blockfuncType = iota - blockfuncArm blockfuncType = iota -) - -var blockfunc blockfuncType - -func init() { - is386bit := runtime.GOARCH == "386" - isARM := runtime.GOARCH == "arm" - switch { - case is386bit || isARM: - blockfunc = blockfuncGeneric - case sha && ssse3 && sse41: - blockfunc = blockfuncSha - case avx2: - blockfunc = blockfuncAvx2 - case avx: - blockfunc = blockfuncAvx - case ssse3: - blockfunc = blockfuncSsse - case armSha: - blockfunc = blockfuncArm - default: - blockfunc = blockfuncGeneric - } -} - -// New returns a new hash.Hash computing the SHA256 checksum. -func New() hash.Hash { - if blockfunc != blockfuncGeneric { - d := new(digest) - d.Reset() - return d - } - // Fallback to the standard golang implementation - // if no features were found. - return sha256.New() -} - -// Sum256 - single caller sha256 helper -func Sum256(data []byte) (result [Size]byte) { - var d digest - d.Reset() - d.Write(data) - result = d.checkSum() - return -} - -// Return size of checksum -func (d *digest) Size() int { return Size } - -// Return blocksize of checksum -func (d *digest) BlockSize() int { return BlockSize } - -// Write to digest -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := copy(d.x[d.nx:], p) - d.nx += n - if d.nx == chunk { - block(d, d.x[:]) - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - block(d, p[:n]) - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -// Return sha256 sum in bytes -func (d *digest) Sum(in []byte) []byte { - // Make a copy of d0 so that caller can keep writing and summing. - d0 := *d - hash := d0.checkSum() - return append(in, hash[:]...) -} - -// Intermediate checksum function -func (d *digest) checkSum() (digest [Size]byte) { - n := d.nx - - var k [64]byte - copy(k[:], d.x[:n]) - - k[n] = 0x80 - - if n >= 56 { - block(d, k[:]) - - // clear block buffer - go compiles this to optimal 1x xorps + 4x movups - // unfortunately expressing this more succinctly results in much worse code - k[0] = 0 - k[1] = 0 - k[2] = 0 - k[3] = 0 - k[4] = 0 - k[5] = 0 - k[6] = 0 - k[7] = 0 - k[8] = 0 - k[9] = 0 - k[10] = 0 - k[11] = 0 - k[12] = 0 - k[13] = 0 - k[14] = 0 - k[15] = 0 - k[16] = 0 - k[17] = 0 - k[18] = 0 - k[19] = 0 - k[20] = 0 - k[21] = 0 - k[22] = 0 - k[23] = 0 - k[24] = 0 - k[25] = 0 - k[26] = 0 - k[27] = 0 - k[28] = 0 - k[29] = 0 - k[30] = 0 - k[31] = 0 - k[32] = 0 - k[33] = 0 - k[34] = 0 - k[35] = 0 - k[36] = 0 - k[37] = 0 - k[38] = 0 - k[39] = 0 - k[40] = 0 - k[41] = 0 - k[42] = 0 - k[43] = 0 - k[44] = 0 - k[45] = 0 - k[46] = 0 - k[47] = 0 - k[48] = 0 - k[49] = 0 - k[50] = 0 - k[51] = 0 - k[52] = 0 - k[53] = 0 - k[54] = 0 - k[55] = 0 - k[56] = 0 - k[57] = 0 - k[58] = 0 - k[59] = 0 - k[60] = 0 - k[61] = 0 - k[62] = 0 - k[63] = 0 - } - binary.BigEndian.PutUint64(k[56:64], uint64(d.len)<<3) - block(d, k[:]) - - { - const i = 0 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 1 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 2 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 3 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 4 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 5 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 6 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - { - const i = 7 - binary.BigEndian.PutUint32(digest[i*4:i*4+4], d.h[i]) - } - - return -} - -func block(dig *digest, p []byte) { - if blockfunc == blockfuncSha { - blockShaGo(dig, p) - } else if blockfunc == blockfuncAvx2 { - blockAvx2Go(dig, p) - } else if blockfunc == blockfuncAvx { - blockAvxGo(dig, p) - } else if blockfunc == blockfuncSsse { - blockSsseGo(dig, p) - } else if blockfunc == blockfuncArm { - blockArmGo(dig, p) - } else if blockfunc == blockfuncGeneric { - blockGeneric(dig, p) - } -} - -func blockGeneric(dig *digest, p []byte) { - var w [64]uint32 - h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] - for len(p) >= chunk { - // Can interlace the computation of w with the - // rounds below if needed for speed. - for i := 0; i < 16; i++ { - j := i * 4 - w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3]) - } - for i := 16; i < 64; i++ { - v1 := w[i-2] - t1 := (v1>>17 | v1<<(32-17)) ^ (v1>>19 | v1<<(32-19)) ^ (v1 >> 10) - v2 := w[i-15] - t2 := (v2>>7 | v2<<(32-7)) ^ (v2>>18 | v2<<(32-18)) ^ (v2 >> 3) - w[i] = t1 + w[i-7] + t2 + w[i-16] - } - - a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7 - - for i := 0; i < 64; i++ { - t1 := h + ((e>>6 | e<<(32-6)) ^ (e>>11 | e<<(32-11)) ^ (e>>25 | e<<(32-25))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] - - t2 := ((a>>2 | a<<(32-2)) ^ (a>>13 | a<<(32-13)) ^ (a>>22 | a<<(32-22))) + ((a & b) ^ (a & c) ^ (b & c)) - - h = g - g = f - f = e - e = d + t1 - d = c - c = b - b = a - a = t1 + t2 - } - - h0 += a - h1 += b - h2 += c - h3 += d - h4 += e - h5 += f - h6 += g - h7 += h - - p = p[chunk:] - } - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h0, h1, h2, h3, h4, h5, h6, h7 -} - -var _K = []uint32{ - 0x428a2f98, - 0x71374491, - 0xb5c0fbcf, - 0xe9b5dba5, - 0x3956c25b, - 0x59f111f1, - 0x923f82a4, - 0xab1c5ed5, - 0xd807aa98, - 0x12835b01, - 0x243185be, - 0x550c7dc3, - 0x72be5d74, - 0x80deb1fe, - 0x9bdc06a7, - 0xc19bf174, - 0xe49b69c1, - 0xefbe4786, - 0x0fc19dc6, - 0x240ca1cc, - 0x2de92c6f, - 0x4a7484aa, - 0x5cb0a9dc, - 0x76f988da, - 0x983e5152, - 0xa831c66d, - 0xb00327c8, - 0xbf597fc7, - 0xc6e00bf3, - 0xd5a79147, - 0x06ca6351, - 0x14292967, - 0x27b70a85, - 0x2e1b2138, - 0x4d2c6dfc, - 0x53380d13, - 0x650a7354, - 0x766a0abb, - 0x81c2c92e, - 0x92722c85, - 0xa2bfe8a1, - 0xa81a664b, - 0xc24b8b70, - 0xc76c51a3, - 0xd192e819, - 0xd6990624, - 0xf40e3585, - 0x106aa070, - 0x19a4c116, - 0x1e376c08, - 0x2748774c, - 0x34b0bcb5, - 0x391c0cb3, - 0x4ed8aa4a, - 0x5b9cca4f, - 0x682e6ff3, - 0x748f82ee, - 0x78a5636f, - 0x84c87814, - 0x8cc70208, - 0x90befffa, - 0xa4506ceb, - 0xbef9a3f7, - 0xc67178f2, -} diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go deleted file mode 100644 index 43ee7a94..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go +++ /dev/null @@ -1,22 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -//go:noescape -func blockAvx2(h []uint32, message []uint8) diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.s b/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.s deleted file mode 100644 index 80b0b739..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.s +++ /dev/null @@ -1,1449 +0,0 @@ -//+build !noasm,!appengine - -// SHA256 implementation for AVX2 - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// This code is based on an Intel White-Paper: -// "Fast SHA-256 Implementations on Intel Architecture Processors" -// -// together with the reference implementation from the following authors: -// James Guilford -// Kirk Yap -// Tim Chen -// -// For Golang it has been converted to Plan 9 assembly with the help of -// github.com/minio/asm2plan9s to assemble Intel instructions to their Plan9 -// equivalents -// - -DATA K256<>+0x000(SB)/8, $0x71374491428a2f98 -DATA K256<>+0x008(SB)/8, $0xe9b5dba5b5c0fbcf -DATA K256<>+0x010(SB)/8, $0x71374491428a2f98 -DATA K256<>+0x018(SB)/8, $0xe9b5dba5b5c0fbcf -DATA K256<>+0x020(SB)/8, $0x59f111f13956c25b -DATA K256<>+0x028(SB)/8, $0xab1c5ed5923f82a4 -DATA K256<>+0x030(SB)/8, $0x59f111f13956c25b -DATA K256<>+0x038(SB)/8, $0xab1c5ed5923f82a4 -DATA K256<>+0x040(SB)/8, $0x12835b01d807aa98 -DATA K256<>+0x048(SB)/8, $0x550c7dc3243185be -DATA K256<>+0x050(SB)/8, $0x12835b01d807aa98 -DATA K256<>+0x058(SB)/8, $0x550c7dc3243185be -DATA K256<>+0x060(SB)/8, $0x80deb1fe72be5d74 -DATA K256<>+0x068(SB)/8, $0xc19bf1749bdc06a7 -DATA K256<>+0x070(SB)/8, $0x80deb1fe72be5d74 -DATA K256<>+0x078(SB)/8, $0xc19bf1749bdc06a7 -DATA K256<>+0x080(SB)/8, $0xefbe4786e49b69c1 -DATA K256<>+0x088(SB)/8, $0x240ca1cc0fc19dc6 -DATA K256<>+0x090(SB)/8, $0xefbe4786e49b69c1 -DATA K256<>+0x098(SB)/8, $0x240ca1cc0fc19dc6 -DATA K256<>+0x0a0(SB)/8, $0x4a7484aa2de92c6f -DATA K256<>+0x0a8(SB)/8, $0x76f988da5cb0a9dc -DATA K256<>+0x0b0(SB)/8, $0x4a7484aa2de92c6f -DATA K256<>+0x0b8(SB)/8, $0x76f988da5cb0a9dc -DATA K256<>+0x0c0(SB)/8, $0xa831c66d983e5152 -DATA K256<>+0x0c8(SB)/8, $0xbf597fc7b00327c8 -DATA K256<>+0x0d0(SB)/8, $0xa831c66d983e5152 -DATA K256<>+0x0d8(SB)/8, $0xbf597fc7b00327c8 -DATA K256<>+0x0e0(SB)/8, $0xd5a79147c6e00bf3 -DATA K256<>+0x0e8(SB)/8, $0x1429296706ca6351 -DATA K256<>+0x0f0(SB)/8, $0xd5a79147c6e00bf3 -DATA K256<>+0x0f8(SB)/8, $0x1429296706ca6351 -DATA K256<>+0x100(SB)/8, $0x2e1b213827b70a85 -DATA K256<>+0x108(SB)/8, $0x53380d134d2c6dfc -DATA K256<>+0x110(SB)/8, $0x2e1b213827b70a85 -DATA K256<>+0x118(SB)/8, $0x53380d134d2c6dfc -DATA K256<>+0x120(SB)/8, $0x766a0abb650a7354 -DATA K256<>+0x128(SB)/8, $0x92722c8581c2c92e -DATA K256<>+0x130(SB)/8, $0x766a0abb650a7354 -DATA K256<>+0x138(SB)/8, $0x92722c8581c2c92e -DATA K256<>+0x140(SB)/8, $0xa81a664ba2bfe8a1 -DATA K256<>+0x148(SB)/8, $0xc76c51a3c24b8b70 -DATA K256<>+0x150(SB)/8, $0xa81a664ba2bfe8a1 -DATA K256<>+0x158(SB)/8, $0xc76c51a3c24b8b70 -DATA K256<>+0x160(SB)/8, $0xd6990624d192e819 -DATA K256<>+0x168(SB)/8, $0x106aa070f40e3585 -DATA K256<>+0x170(SB)/8, $0xd6990624d192e819 -DATA K256<>+0x178(SB)/8, $0x106aa070f40e3585 -DATA K256<>+0x180(SB)/8, $0x1e376c0819a4c116 -DATA K256<>+0x188(SB)/8, $0x34b0bcb52748774c -DATA K256<>+0x190(SB)/8, $0x1e376c0819a4c116 -DATA K256<>+0x198(SB)/8, $0x34b0bcb52748774c -DATA K256<>+0x1a0(SB)/8, $0x4ed8aa4a391c0cb3 -DATA K256<>+0x1a8(SB)/8, $0x682e6ff35b9cca4f -DATA K256<>+0x1b0(SB)/8, $0x4ed8aa4a391c0cb3 -DATA K256<>+0x1b8(SB)/8, $0x682e6ff35b9cca4f -DATA K256<>+0x1c0(SB)/8, $0x78a5636f748f82ee -DATA K256<>+0x1c8(SB)/8, $0x8cc7020884c87814 -DATA K256<>+0x1d0(SB)/8, $0x78a5636f748f82ee -DATA K256<>+0x1d8(SB)/8, $0x8cc7020884c87814 -DATA K256<>+0x1e0(SB)/8, $0xa4506ceb90befffa -DATA K256<>+0x1e8(SB)/8, $0xc67178f2bef9a3f7 -DATA K256<>+0x1f0(SB)/8, $0xa4506ceb90befffa -DATA K256<>+0x1f8(SB)/8, $0xc67178f2bef9a3f7 - -DATA K256<>+0x200(SB)/8, $0x0405060700010203 -DATA K256<>+0x208(SB)/8, $0x0c0d0e0f08090a0b -DATA K256<>+0x210(SB)/8, $0x0405060700010203 -DATA K256<>+0x218(SB)/8, $0x0c0d0e0f08090a0b -DATA K256<>+0x220(SB)/8, $0x0b0a090803020100 -DATA K256<>+0x228(SB)/8, $0xffffffffffffffff -DATA K256<>+0x230(SB)/8, $0x0b0a090803020100 -DATA K256<>+0x238(SB)/8, $0xffffffffffffffff -DATA K256<>+0x240(SB)/8, $0xffffffffffffffff -DATA K256<>+0x248(SB)/8, $0x0b0a090803020100 -DATA K256<>+0x250(SB)/8, $0xffffffffffffffff -DATA K256<>+0x258(SB)/8, $0x0b0a090803020100 - -GLOBL K256<>(SB), 8, $608 - -// We need 0x220 stack space aligned on a 512 boundary, so for the -// worstcase-aligned SP we need twice this amount, being 1088 (=0x440) -// -// SP aligned end-aligned stacksize -// 100013d0 10001400 10001620 592 -// 100013d8 10001400 10001620 584 -// 100013e0 10001600 10001820 1088 -// 100013e8 10001600 10001820 1080 - -// func blockAvx2(h []uint32, message []uint8) -TEXT ·blockAvx2(SB),$1088-48 - - MOVQ h+0(FP), DI // DI: &h - MOVQ message_base+24(FP), SI // SI: &message - MOVQ message_len+32(FP), DX // len(message) - ADDQ SI, DX // end pointer of input - MOVQ SP, R11 // copy stack pointer - ADDQ $0x220, SP // sp += 0x220 - ANDQ $0xfffffffffffffe00, SP // align stack frame - ADDQ $0x1c0, SP - MOVQ DI, 0x40(SP) // save ctx - MOVQ SI, 0x48(SP) // save input - MOVQ DX, 0x50(SP) // save end pointer - MOVQ R11, 0x58(SP) // save copy of stack pointer - - WORD $0xf8c5; BYTE $0x77 // vzeroupper - ADDQ $0x40, SI // input++ - MOVL (DI), AX - MOVQ SI, R12 // borrow $T1 - MOVL 4(DI), BX - CMPQ SI, DX // $_end - MOVL 8(DI), CX - LONG $0xe4440f4c // cmove r12,rsp /* next block or random data */ - MOVL 12(DI), DX - MOVL 16(DI), R8 - MOVL 20(DI), R9 - MOVL 24(DI), R10 - MOVL 28(DI), R11 - - LEAQ K256<>(SB), BP - LONG $0x856f7dc5; LONG $0x00000220 // VMOVDQA YMM8, 0x220[rbp] /* vmovdqa ymm8,YMMWORD PTR [rip+0x220] */ - LONG $0x8d6f7dc5; LONG $0x00000240 // VMOVDQA YMM9, 0x240[rbp] /* vmovdqa ymm9,YMMWORD PTR [rip+0x240] */ - LONG $0x956f7dc5; LONG $0x00000200 // VMOVDQA YMM10, 0x200[rbp] /* vmovdqa ymm7,YMMWORD PTR [rip+0x200] */ - -loop0: - LONG $0x6f7dc1c4; BYTE $0xfa // VMOVDQA YMM7, YMM10 - - // Load first 16 dwords from two blocks - MOVOU -64(SI), X0 // vmovdqu xmm0,XMMWORD PTR [rsi-0x40] - MOVOU -48(SI), X1 // vmovdqu xmm1,XMMWORD PTR [rsi-0x30] - MOVOU -32(SI), X2 // vmovdqu xmm2,XMMWORD PTR [rsi-0x20] - MOVOU -16(SI), X3 // vmovdqu xmm3,XMMWORD PTR [rsi-0x10] - - // Byte swap data and transpose data into high/low - LONG $0x387dc3c4; WORD $0x2404; BYTE $0x01 // vinserti128 ymm0,ymm0,[r12],0x1 - LONG $0x3875c3c4; LONG $0x0110244c // vinserti128 ymm1,ymm1,0x10[r12],0x1 - LONG $0x007de2c4; BYTE $0xc7 // vpshufb ymm0,ymm0,ymm7 - LONG $0x386dc3c4; LONG $0x01202454 // vinserti128 ymm2,ymm2,0x20[r12],0x1 - LONG $0x0075e2c4; BYTE $0xcf // vpshufb ymm1,ymm1,ymm7 - LONG $0x3865c3c4; LONG $0x0130245c // vinserti128 ymm3,ymm3,0x30[r12],0x1 - - LEAQ K256<>(SB), BP - LONG $0x006de2c4; BYTE $0xd7 // vpshufb ymm2,ymm2,ymm7 - LONG $0x65fefdc5; BYTE $0x00 // vpaddd ymm4,ymm0,[rbp] - LONG $0x0065e2c4; BYTE $0xdf // vpshufb ymm3,ymm3,ymm7 - LONG $0x6dfef5c5; BYTE $0x20 // vpaddd ymm5,ymm1,0x20[rbp] - LONG $0x75feedc5; BYTE $0x40 // vpaddd ymm6,ymm2,0x40[rbp] - LONG $0x7dfee5c5; BYTE $0x60 // vpaddd ymm7,ymm3,0x60[rbp] - - LONG $0x247ffdc5; BYTE $0x24 // vmovdqa [rsp],ymm4 - XORQ R14, R14 - LONG $0x6c7ffdc5; WORD $0x2024 // vmovdqa [rsp+0x20],ymm5 - - ADDQ $-0x40, SP - MOVQ BX, DI - LONG $0x347ffdc5; BYTE $0x24 // vmovdqa [rsp],ymm6 - XORQ CX, DI // magic - LONG $0x7c7ffdc5; WORD $0x2024 // vmovdqa [rsp+0x20],ymm7 - MOVQ R9, R12 - ADDQ $0x80, BP - -loop1: - // Schedule 48 input dwords, by doing 3 rounds of 12 each - // Note: SIMD instructions are interleaved with the SHA calculations - ADDQ $-0x40, SP - LONG $0x0f75e3c4; WORD $0x04e0 // vpalignr ymm4,ymm1,ymm0,0x4 - - // ROUND(AX, BX, CX, DX, R8, R9, R10, R11, R12, R13, R14, R15, DI, SP, 0x80) - LONG $0x249c0344; LONG $0x00000080 // add r11d,[rsp+0x80] - WORD $0x2145; BYTE $0xc4 // and r12d,r8d - LONG $0xf07b43c4; WORD $0x19e8 // rorx r13d,r8d,0x19 - LONG $0x0f65e3c4; WORD $0x04fa // vpalignr ymm7,ymm3,ymm2,0x4 - LONG $0xf07b43c4; WORD $0x0bf8 // rorx r15d,r8d,0xb - LONG $0x30048d42 // lea eax,[rax+r14*1] - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - LONG $0xd472cdc5; BYTE $0x07 // vpsrld ymm6,ymm4,0x7 - LONG $0xf23842c4; BYTE $0xe2 // andn r12d,r8d,r10d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f0 // rorx r14d,r8d,0x6 - LONG $0xc7fefdc5 // vpaddd ymm0,ymm0,ymm7 - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xc7 // mov r15d,eax - LONG $0xd472c5c5; BYTE $0x03 // vpsrld ymm7,ymm4,0x3 - LONG $0xf07b63c4; WORD $0x16e0 // rorx r12d,eax,0x16 - LONG $0x2b1c8d47 // lea r11d,[r11+r13*1] - WORD $0x3141; BYTE $0xdf // xor r15d,ebx - LONG $0xf472d5c5; BYTE $0x0e // vpslld ymm5,ymm4,0xe - LONG $0xf07b63c4; WORD $0x0df0 // rorx r14d,eax,0xd - LONG $0xf07b63c4; WORD $0x02e8 // rorx r13d,eax,0x2 - LONG $0x1a148d42 // lea edx,[rdx+r11*1] - LONG $0xe6efc5c5 // vpxor ymm4,ymm7,ymm6 - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xdf31 // xor edi,ebx - LONG $0xfb70fdc5; BYTE $0xfa // vpshufd ymm7,ymm3,0xfa - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3b1c8d45 // lea r11d,[r11+rdi*1] - WORD $0x8945; BYTE $0xc4 // mov r12d,r8d - LONG $0xd672cdc5; BYTE $0x0b // vpsrld ymm6,ymm6,0xb - - // ROUND(R11, AX, BX, CX, DX, R8, R9, R10, R12, R13, R14, DI, R15, SP, 0x84) - LONG $0x24940344; LONG $0x00000084 // add r10d,[rsp+0x84] - WORD $0x2141; BYTE $0xd4 // and r12d,edx - LONG $0xf07b63c4; WORD $0x19ea // rorx r13d,edx,0x19 - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07be3c4; WORD $0x0bfa // rorx edi,edx,0xb - LONG $0x331c8d47 // lea r11d,[r11+r14*1] - LONG $0x22148d47 // lea r10d,[r10+r12*1] - LONG $0xf572d5c5; BYTE $0x0b // vpslld ymm5,ymm5,0xb - LONG $0xf26842c4; BYTE $0xe1 // andn r12d,edx,r9d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f2 // rorx r14d,edx,0x6 - LONG $0xe6efddc5 // vpxor ymm4,ymm4,ymm6 - LONG $0x22148d47 // lea r10d,[r10+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xdf // mov edi,r11d - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - LONG $0xf07b43c4; WORD $0x16e3 // rorx r12d,r11d,0x16 - LONG $0x2a148d47 // lea r10d,[r10+r13*1] - WORD $0xc731 // xor edi,eax - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07b43c4; WORD $0x0df3 // rorx r14d,r11d,0xd - LONG $0xf07b43c4; WORD $0x02eb // rorx r13d,r11d,0x2 - LONG $0x110c8d42 // lea ecx,[rcx+r10*1] - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xc7 // xor r15d,eax - LONG $0xc4fefdc5 // vpaddd ymm0,ymm0,ymm4 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3a148d47 // lea r10d,[r10+r15*1] - WORD $0x8941; BYTE $0xd4 // mov r12d,edx - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(R10, R11, AX, BX, CX, DX, R8, R9, R12, R13, R14, R15, DI, SP, 0x88) - LONG $0x248c0344; LONG $0x00000088 // add r9d,[rsp+0x88] - WORD $0x2141; BYTE $0xcc // and r12d,ecx - LONG $0xf07b63c4; WORD $0x19e9 // rorx r13d,ecx,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07b63c4; WORD $0x0bf9 // rorx r15d,ecx,0xb - LONG $0x32148d47 // lea r10d,[r10+r14*1] - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf27042c4; BYTE $0xe0 // andn r12d,ecx,r8d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f1 // rorx r14d,ecx,0x6 - LONG $0x004dc2c4; BYTE $0xf0 // vpshufb ymm6,ymm6,ymm8 - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xd7 // mov r15d,r10d - LONG $0xc6fefdc5 // vpaddd ymm0,ymm0,ymm6 - LONG $0xf07b43c4; WORD $0x16e2 // rorx r12d,r10d,0x16 - LONG $0x290c8d47 // lea r9d,[r9+r13*1] - WORD $0x3145; BYTE $0xdf // xor r15d,r11d - LONG $0xf870fdc5; BYTE $0x50 // vpshufd ymm7,ymm0,0x50 - LONG $0xf07b43c4; WORD $0x0df2 // rorx r14d,r10d,0xd - LONG $0xf07b43c4; WORD $0x02ea // rorx r13d,r10d,0x2 - LONG $0x0b1c8d42 // lea ebx,[rbx+r9*1] - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xdf // xor edi,r11d - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d45 // lea r9d,[r9+rdi*1] - WORD $0x8941; BYTE $0xcc // mov r12d,ecx - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(R9, R10, R11, AX, BX, CX, DX, R8, R12, R13, R14, DI, R15, SP, 0x8c) - LONG $0x24840344; LONG $0x0000008c // add r8d,[rsp+0x8c] - WORD $0x2141; BYTE $0xdc // and r12d,ebx - LONG $0xf07b63c4; WORD $0x19eb // rorx r13d,ebx,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07be3c4; WORD $0x0bfb // rorx edi,ebx,0xb - LONG $0x310c8d47 // lea r9d,[r9+r14*1] - LONG $0x20048d47 // lea r8d,[r8+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf26062c4; BYTE $0xe2 // andn r12d,ebx,edx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f3 // rorx r14d,ebx,0x6 - LONG $0x004dc2c4; BYTE $0xf1 // vpshufb ymm6,ymm6,ymm9 - LONG $0x20048d47 // lea r8d,[r8+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xcf // mov edi,r9d - LONG $0xc6fefdc5 // vpaddd ymm0,ymm0,ymm6 - LONG $0xf07b43c4; WORD $0x16e1 // rorx r12d,r9d,0x16 - LONG $0x28048d47 // lea r8d,[r8+r13*1] - WORD $0x3144; BYTE $0xd7 // xor edi,r10d - LONG $0x75fefdc5; BYTE $0x00 // vpaddd ymm6,ymm0,[rbp+0x0] - LONG $0xf07b43c4; WORD $0x0df1 // rorx r14d,r9d,0xd - LONG $0xf07b43c4; WORD $0x02e9 // rorx r13d,r9d,0x2 - LONG $0x00048d42 // lea eax,[rax+r8*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xd7 // xor r15d,r10d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d47 // lea r8d,[r8+r15*1] - WORD $0x8941; BYTE $0xdc // mov r12d,ebx - - LONG $0x347ffdc5; BYTE $0x24 // vmovdqa [rsp],ymm6 - LONG $0x0f6de3c4; WORD $0x04e1 // vpalignr ymm4,ymm2,ymm1,0x4 - - // ROUND(R8, R9, R10, R11, AX, BX, CX, DX, R12, R13, R14, R15, DI, SP, 0xa0) - LONG $0xa0249403; WORD $0x0000; BYTE $0x00 // add edx,[rsp+0xa0] - WORD $0x2141; BYTE $0xc4 // and r12d,eax - LONG $0xf07b63c4; WORD $0x19e8 // rorx r13d,eax,0x19 - LONG $0x0f7de3c4; WORD $0x04fb // vpalignr ymm7,ymm0,ymm3,0x4 - LONG $0xf07b63c4; WORD $0x0bf8 // rorx r15d,eax,0xb - LONG $0x30048d47 // lea r8d,[r8+r14*1] - LONG $0x22148d42 // lea edx,[rdx+r12*1] - LONG $0xd472cdc5; BYTE $0x07 // vpsrld ymm6,ymm4,0x7 - LONG $0xf27862c4; BYTE $0xe1 // andn r12d,eax,ecx - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f0 // rorx r14d,eax,0x6 - LONG $0xcffef5c5 // vpaddd ymm1,ymm1,ymm7 - LONG $0x22148d42 // lea edx,[rdx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xc7 // mov r15d,r8d - LONG $0xd472c5c5; BYTE $0x03 // vpsrld ymm7,ymm4,0x3 - LONG $0xf07b43c4; WORD $0x16e0 // rorx r12d,r8d,0x16 - LONG $0x2a148d42 // lea edx,[rdx+r13*1] - WORD $0x3145; BYTE $0xcf // xor r15d,r9d - LONG $0xf472d5c5; BYTE $0x0e // vpslld ymm5,ymm4,0xe - LONG $0xf07b43c4; WORD $0x0df0 // rorx r14d,r8d,0xd - LONG $0xf07b43c4; WORD $0x02e8 // rorx r13d,r8d,0x2 - LONG $0x131c8d45 // lea r11d,[r11+rdx*1] - LONG $0xe6efc5c5 // vpxor ymm4,ymm7,ymm6 - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xcf // xor edi,r9d - LONG $0xf870fdc5; BYTE $0xfa // vpshufd ymm7,ymm0,0xfa - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x148d; BYTE $0x3a // lea edx,[rdx+rdi*1] - WORD $0x8941; BYTE $0xc4 // mov r12d,eax - LONG $0xd672cdc5; BYTE $0x0b // vpsrld ymm6,ymm6,0xb - - // ROUND(DX, R8, R9, R10, R11, AX, BX, CX, R12, R13, R14, DI, R15, SP, 0xa4) - LONG $0xa4248c03; WORD $0x0000; BYTE $0x00 // add ecx,[rsp+0xa4] - WORD $0x2145; BYTE $0xdc // and r12d,r11d - LONG $0xf07b43c4; WORD $0x19eb // rorx r13d,r11d,0x19 - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07bc3c4; WORD $0x0bfb // rorx edi,r11d,0xb - LONG $0x32148d42 // lea edx,[rdx+r14*1] - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - LONG $0xf572d5c5; BYTE $0x0b // vpslld ymm5,ymm5,0xb - LONG $0xf22062c4; BYTE $0xe3 // andn r12d,r11d,ebx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f3 // rorx r14d,r11d,0x6 - LONG $0xe6efddc5 // vpxor ymm4,ymm4,ymm6 - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xd789 // mov edi,edx - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - LONG $0xf07b63c4; WORD $0x16e2 // rorx r12d,edx,0x16 - LONG $0x290c8d42 // lea ecx,[rcx+r13*1] - WORD $0x3144; BYTE $0xc7 // xor edi,r8d - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07b63c4; WORD $0x0df2 // rorx r14d,edx,0xd - LONG $0xf07b63c4; WORD $0x02ea // rorx r13d,edx,0x2 - LONG $0x0a148d45 // lea r10d,[r10+rcx*1] - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xc7 // xor r15d,r8d - LONG $0xccfef5c5 // vpaddd ymm1,ymm1,ymm4 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d42 // lea ecx,[rcx+r15*1] - WORD $0x8945; BYTE $0xdc // mov r12d,r11d - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(CX, DX, R8, R9, R10, R11, AX, BX, R12, R13, R14, R15, DI, SP, 0xa8) - LONG $0xa8249c03; WORD $0x0000; BYTE $0x00 // add ebx,[rsp+0xa8] - WORD $0x2145; BYTE $0xd4 // and r12d,r10d - LONG $0xf07b43c4; WORD $0x19ea // rorx r13d,r10d,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07b43c4; WORD $0x0bfa // rorx r15d,r10d,0xb - LONG $0x310c8d42 // lea ecx,[rcx+r14*1] - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf22862c4; BYTE $0xe0 // andn r12d,r10d,eax - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f2 // rorx r14d,r10d,0x6 - LONG $0x004dc2c4; BYTE $0xf0 // vpshufb ymm6,ymm6,ymm8 - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xcf // mov r15d,ecx - LONG $0xcefef5c5 // vpaddd ymm1,ymm1,ymm6 - LONG $0xf07b63c4; WORD $0x16e1 // rorx r12d,ecx,0x16 - LONG $0x2b1c8d42 // lea ebx,[rbx+r13*1] - WORD $0x3141; BYTE $0xd7 // xor r15d,edx - LONG $0xf970fdc5; BYTE $0x50 // vpshufd ymm7,ymm1,0x50 - LONG $0xf07b63c4; WORD $0x0df1 // rorx r14d,ecx,0xd - LONG $0xf07b63c4; WORD $0x02e9 // rorx r13d,ecx,0x2 - LONG $0x190c8d45 // lea r9d,[r9+rbx*1] - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xd731 // xor edi,edx - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x1c8d; BYTE $0x3b // lea ebx,[rbx+rdi*1] - WORD $0x8945; BYTE $0xd4 // mov r12d,r10d - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(BX, CX, DX, R8, R9, R10, R11, AX, R12, R13, R14, DI, R15, SP, 0xac) - LONG $0xac248403; WORD $0x0000; BYTE $0x00 // add eax,[rsp+0xac] - WORD $0x2145; BYTE $0xcc // and r12d,r9d - LONG $0xf07b43c4; WORD $0x19e9 // rorx r13d,r9d,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07bc3c4; WORD $0x0bf9 // rorx edi,r9d,0xb - LONG $0x331c8d42 // lea ebx,[rbx+r14*1] - LONG $0x20048d42 // lea eax,[rax+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf23042c4; BYTE $0xe3 // andn r12d,r9d,r11d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f1 // rorx r14d,r9d,0x6 - LONG $0x004dc2c4; BYTE $0xf1 // vpshufb ymm6,ymm6,ymm9 - LONG $0x20048d42 // lea eax,[rax+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xdf89 // mov edi,ebx - LONG $0xcefef5c5 // vpaddd ymm1,ymm1,ymm6 - LONG $0xf07b63c4; WORD $0x16e3 // rorx r12d,ebx,0x16 - LONG $0x28048d42 // lea eax,[rax+r13*1] - WORD $0xcf31 // xor edi,ecx - LONG $0x75fef5c5; BYTE $0x20 // vpaddd ymm6,ymm1,[rbp+0x20] - LONG $0xf07b63c4; WORD $0x0df3 // rorx r14d,ebx,0xd - LONG $0xf07b63c4; WORD $0x02eb // rorx r13d,ebx,0x2 - LONG $0x00048d45 // lea r8d,[r8+rax*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xcf // xor r15d,ecx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d42 // lea eax,[rax+r15*1] - WORD $0x8945; BYTE $0xcc // mov r12d,r9d - - LONG $0x747ffdc5; WORD $0x2024 // vmovdqa [rsp+0x20],ymm6 - - LONG $0x24648d48; BYTE $0xc0 // lea rsp,[rsp-0x40] - LONG $0x0f65e3c4; WORD $0x04e2 // vpalignr ymm4,ymm3,ymm2,0x4 - - // ROUND(AX, BX, CX, DX, R8, R9, R10, R11, R12, R13, R14, R15, DI, SP, 0x80) - LONG $0x249c0344; LONG $0x00000080 // add r11d,[rsp+0x80] - WORD $0x2145; BYTE $0xc4 // and r12d,r8d - LONG $0xf07b43c4; WORD $0x19e8 // rorx r13d,r8d,0x19 - LONG $0x0f75e3c4; WORD $0x04f8 // vpalignr ymm7,ymm1,ymm0,0x4 - LONG $0xf07b43c4; WORD $0x0bf8 // rorx r15d,r8d,0xb - LONG $0x30048d42 // lea eax,[rax+r14*1] - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - LONG $0xd472cdc5; BYTE $0x07 // vpsrld ymm6,ymm4,0x7 - LONG $0xf23842c4; BYTE $0xe2 // andn r12d,r8d,r10d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f0 // rorx r14d,r8d,0x6 - LONG $0xd7feedc5 // vpaddd ymm2,ymm2,ymm7 - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xc7 // mov r15d,eax - LONG $0xd472c5c5; BYTE $0x03 // vpsrld ymm7,ymm4,0x3 - LONG $0xf07b63c4; WORD $0x16e0 // rorx r12d,eax,0x16 - LONG $0x2b1c8d47 // lea r11d,[r11+r13*1] - WORD $0x3141; BYTE $0xdf // xor r15d,ebx - LONG $0xf472d5c5; BYTE $0x0e // vpslld ymm5,ymm4,0xe - LONG $0xf07b63c4; WORD $0x0df0 // rorx r14d,eax,0xd - LONG $0xf07b63c4; WORD $0x02e8 // rorx r13d,eax,0x2 - LONG $0x1a148d42 // lea edx,[rdx+r11*1] - LONG $0xe6efc5c5 // vpxor ymm4,ymm7,ymm6 - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xdf31 // xor edi,ebx - LONG $0xf970fdc5; BYTE $0xfa // vpshufd ymm7,ymm1,0xfa - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3b1c8d45 // lea r11d,[r11+rdi*1] - WORD $0x8945; BYTE $0xc4 // mov r12d,r8d - LONG $0xd672cdc5; BYTE $0x0b // vpsrld ymm6,ymm6,0xb - - // ROUND(R11, AX, BX, CX, DX, R8, R9, R10, R12, R13, R14, DI, R15, SP, 0x84) - LONG $0x24940344; LONG $0x00000084 // add r10d,[rsp+0x84] - WORD $0x2141; BYTE $0xd4 // and r12d,edx - LONG $0xf07b63c4; WORD $0x19ea // rorx r13d,edx,0x19 - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07be3c4; WORD $0x0bfa // rorx edi,edx,0xb - LONG $0x331c8d47 // lea r11d,[r11+r14*1] - LONG $0x22148d47 // lea r10d,[r10+r12*1] - LONG $0xf572d5c5; BYTE $0x0b // vpslld ymm5,ymm5,0xb - LONG $0xf26842c4; BYTE $0xe1 // andn r12d,edx,r9d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f2 // rorx r14d,edx,0x6 - LONG $0xe6efddc5 // vpxor ymm4,ymm4,ymm6 - LONG $0x22148d47 // lea r10d,[r10+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xdf // mov edi,r11d - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - LONG $0xf07b43c4; WORD $0x16e3 // rorx r12d,r11d,0x16 - LONG $0x2a148d47 // lea r10d,[r10+r13*1] - WORD $0xc731 // xor edi,eax - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07b43c4; WORD $0x0df3 // rorx r14d,r11d,0xd - LONG $0xf07b43c4; WORD $0x02eb // rorx r13d,r11d,0x2 - LONG $0x110c8d42 // lea ecx,[rcx+r10*1] - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xc7 // xor r15d,eax - LONG $0xd4feedc5 // vpaddd ymm2,ymm2,ymm4 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3a148d47 // lea r10d,[r10+r15*1] - WORD $0x8941; BYTE $0xd4 // mov r12d,edx - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(R10, R11, AX, BX, CX, DX, R8, R9, R12, R13, R14, R15, DI, SP, 0x88) - LONG $0x248c0344; LONG $0x00000088 // add r9d,[rsp+0x88] - WORD $0x2141; BYTE $0xcc // and r12d,ecx - LONG $0xf07b63c4; WORD $0x19e9 // rorx r13d,ecx,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07b63c4; WORD $0x0bf9 // rorx r15d,ecx,0xb - LONG $0x32148d47 // lea r10d,[r10+r14*1] - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf27042c4; BYTE $0xe0 // andn r12d,ecx,r8d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f1 // rorx r14d,ecx,0x6 - LONG $0x004dc2c4; BYTE $0xf0 // vpshufb ymm6,ymm6,ymm8 - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xd7 // mov r15d,r10d - LONG $0xd6feedc5 // vpaddd ymm2,ymm2,ymm6 - LONG $0xf07b43c4; WORD $0x16e2 // rorx r12d,r10d,0x16 - LONG $0x290c8d47 // lea r9d,[r9+r13*1] - WORD $0x3145; BYTE $0xdf // xor r15d,r11d - LONG $0xfa70fdc5; BYTE $0x50 // vpshufd ymm7,ymm2,0x50 - LONG $0xf07b43c4; WORD $0x0df2 // rorx r14d,r10d,0xd - LONG $0xf07b43c4; WORD $0x02ea // rorx r13d,r10d,0x2 - LONG $0x0b1c8d42 // lea ebx,[rbx+r9*1] - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xdf // xor edi,r11d - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d45 // lea r9d,[r9+rdi*1] - WORD $0x8941; BYTE $0xcc // mov r12d,ecx - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(R9, R10, R11, AX, BX, CX, DX, R8, R12, R13, R14, DI, R15, SP, 0x8c) - LONG $0x24840344; LONG $0x0000008c // add r8d,[rsp+0x8c] - WORD $0x2141; BYTE $0xdc // and r12d,ebx - LONG $0xf07b63c4; WORD $0x19eb // rorx r13d,ebx,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07be3c4; WORD $0x0bfb // rorx edi,ebx,0xb - LONG $0x310c8d47 // lea r9d,[r9+r14*1] - LONG $0x20048d47 // lea r8d,[r8+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf26062c4; BYTE $0xe2 // andn r12d,ebx,edx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f3 // rorx r14d,ebx,0x6 - LONG $0x004dc2c4; BYTE $0xf1 // vpshufb ymm6,ymm6,ymm9 - LONG $0x20048d47 // lea r8d,[r8+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xcf // mov edi,r9d - LONG $0xd6feedc5 // vpaddd ymm2,ymm2,ymm6 - LONG $0xf07b43c4; WORD $0x16e1 // rorx r12d,r9d,0x16 - LONG $0x28048d47 // lea r8d,[r8+r13*1] - WORD $0x3144; BYTE $0xd7 // xor edi,r10d - LONG $0x75feedc5; BYTE $0x40 // vpaddd ymm6,ymm2,[rbp+0x40] - LONG $0xf07b43c4; WORD $0x0df1 // rorx r14d,r9d,0xd - LONG $0xf07b43c4; WORD $0x02e9 // rorx r13d,r9d,0x2 - LONG $0x00048d42 // lea eax,[rax+r8*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xd7 // xor r15d,r10d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d47 // lea r8d,[r8+r15*1] - WORD $0x8941; BYTE $0xdc // mov r12d,ebx - - LONG $0x347ffdc5; BYTE $0x24 // vmovdqa [rsp],ymm6 - LONG $0x0f7de3c4; WORD $0x04e3 // vpalignr ymm4,ymm0,ymm3,0x4 - - // ROUND(R8, R9, R10, R11, AX, BX, CX, DX, R12, R13, R14, R15, DI, SP, 0xa0) - LONG $0xa0249403; WORD $0x0000; BYTE $0x00 // add edx,[rsp+0xa0] - WORD $0x2141; BYTE $0xc4 // and r12d,eax - LONG $0xf07b63c4; WORD $0x19e8 // rorx r13d,eax,0x19 - LONG $0x0f6de3c4; WORD $0x04f9 // vpalignr ymm7,ymm2,ymm1,0x4 - LONG $0xf07b63c4; WORD $0x0bf8 // rorx r15d,eax,0xb - LONG $0x30048d47 // lea r8d,[r8+r14*1] - LONG $0x22148d42 // lea edx,[rdx+r12*1] - LONG $0xd472cdc5; BYTE $0x07 // vpsrld ymm6,ymm4,0x7 - LONG $0xf27862c4; BYTE $0xe1 // andn r12d,eax,ecx - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f0 // rorx r14d,eax,0x6 - LONG $0xdffee5c5 // vpaddd ymm3,ymm3,ymm7 - LONG $0x22148d42 // lea edx,[rdx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xc7 // mov r15d,r8d - LONG $0xd472c5c5; BYTE $0x03 // vpsrld ymm7,ymm4,0x3 - LONG $0xf07b43c4; WORD $0x16e0 // rorx r12d,r8d,0x16 - LONG $0x2a148d42 // lea edx,[rdx+r13*1] - WORD $0x3145; BYTE $0xcf // xor r15d,r9d - LONG $0xf472d5c5; BYTE $0x0e // vpslld ymm5,ymm4,0xe - LONG $0xf07b43c4; WORD $0x0df0 // rorx r14d,r8d,0xd - LONG $0xf07b43c4; WORD $0x02e8 // rorx r13d,r8d,0x2 - LONG $0x131c8d45 // lea r11d,[r11+rdx*1] - LONG $0xe6efc5c5 // vpxor ymm4,ymm7,ymm6 - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xcf // xor edi,r9d - LONG $0xfa70fdc5; BYTE $0xfa // vpshufd ymm7,ymm2,0xfa - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x148d; BYTE $0x3a // lea edx,[rdx+rdi*1] - WORD $0x8941; BYTE $0xc4 // mov r12d,eax - LONG $0xd672cdc5; BYTE $0x0b // vpsrld ymm6,ymm6,0xb - - // ROUND(DX, R8, R9, R10, R11, AX, BX, CX, R12, R13, R14, DI, R15, SP, 0xa4) - LONG $0xa4248c03; WORD $0x0000; BYTE $0x00 // add ecx,[rsp+0xa4] - WORD $0x2145; BYTE $0xdc // and r12d,r11d - LONG $0xf07b43c4; WORD $0x19eb // rorx r13d,r11d,0x19 - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07bc3c4; WORD $0x0bfb // rorx edi,r11d,0xb - LONG $0x32148d42 // lea edx,[rdx+r14*1] - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - LONG $0xf572d5c5; BYTE $0x0b // vpslld ymm5,ymm5,0xb - LONG $0xf22062c4; BYTE $0xe3 // andn r12d,r11d,ebx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f3 // rorx r14d,r11d,0x6 - LONG $0xe6efddc5 // vpxor ymm4,ymm4,ymm6 - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xd789 // mov edi,edx - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - LONG $0xf07b63c4; WORD $0x16e2 // rorx r12d,edx,0x16 - LONG $0x290c8d42 // lea ecx,[rcx+r13*1] - WORD $0x3144; BYTE $0xc7 // xor edi,r8d - LONG $0xe5efddc5 // vpxor ymm4,ymm4,ymm5 - LONG $0xf07b63c4; WORD $0x0df2 // rorx r14d,edx,0xd - LONG $0xf07b63c4; WORD $0x02ea // rorx r13d,edx,0x2 - LONG $0x0a148d45 // lea r10d,[r10+rcx*1] - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xc7 // xor r15d,r8d - LONG $0xdcfee5c5 // vpaddd ymm3,ymm3,ymm4 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d42 // lea ecx,[rcx+r15*1] - WORD $0x8945; BYTE $0xdc // mov r12d,r11d - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(CX, DX, R8, R9, R10, R11, AX, BX, R12, R13, R14, R15, DI, SP, 0xa8) - LONG $0xa8249c03; WORD $0x0000; BYTE $0x00 // add ebx,[rsp+0xa8] - WORD $0x2145; BYTE $0xd4 // and r12d,r10d - LONG $0xf07b43c4; WORD $0x19ea // rorx r13d,r10d,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07b43c4; WORD $0x0bfa // rorx r15d,r10d,0xb - LONG $0x310c8d42 // lea ecx,[rcx+r14*1] - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf22862c4; BYTE $0xe0 // andn r12d,r10d,eax - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f2 // rorx r14d,r10d,0x6 - LONG $0x004dc2c4; BYTE $0xf0 // vpshufb ymm6,ymm6,ymm8 - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xcf // mov r15d,ecx - LONG $0xdefee5c5 // vpaddd ymm3,ymm3,ymm6 - LONG $0xf07b63c4; WORD $0x16e1 // rorx r12d,ecx,0x16 - LONG $0x2b1c8d42 // lea ebx,[rbx+r13*1] - WORD $0x3141; BYTE $0xd7 // xor r15d,edx - LONG $0xfb70fdc5; BYTE $0x50 // vpshufd ymm7,ymm3,0x50 - LONG $0xf07b63c4; WORD $0x0df1 // rorx r14d,ecx,0xd - LONG $0xf07b63c4; WORD $0x02e9 // rorx r13d,ecx,0x2 - LONG $0x190c8d45 // lea r9d,[r9+rbx*1] - LONG $0xd772cdc5; BYTE $0x0a // vpsrld ymm6,ymm7,0xa - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xd731 // xor edi,edx - LONG $0xd773c5c5; BYTE $0x11 // vpsrlq ymm7,ymm7,0x11 - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x1c8d; BYTE $0x3b // lea ebx,[rbx+rdi*1] - WORD $0x8945; BYTE $0xd4 // mov r12d,r10d - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - - // ROUND(BX, CX, DX, R8, R9, R10, R11, AX, R12, R13, R14, DI, R15, SP, 0xac) - LONG $0xac248403; WORD $0x0000; BYTE $0x00 // add eax,[rsp+0xac] - WORD $0x2145; BYTE $0xcc // and r12d,r9d - LONG $0xf07b43c4; WORD $0x19e9 // rorx r13d,r9d,0x19 - LONG $0xd773c5c5; BYTE $0x02 // vpsrlq ymm7,ymm7,0x2 - LONG $0xf07bc3c4; WORD $0x0bf9 // rorx edi,r9d,0xb - LONG $0x331c8d42 // lea ebx,[rbx+r14*1] - LONG $0x20048d42 // lea eax,[rax+r12*1] - LONG $0xf7efcdc5 // vpxor ymm6,ymm6,ymm7 - LONG $0xf23042c4; BYTE $0xe3 // andn r12d,r9d,r11d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f1 // rorx r14d,r9d,0x6 - LONG $0x004dc2c4; BYTE $0xf1 // vpshufb ymm6,ymm6,ymm9 - LONG $0x20048d42 // lea eax,[rax+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xdf89 // mov edi,ebx - LONG $0xdefee5c5 // vpaddd ymm3,ymm3,ymm6 - LONG $0xf07b63c4; WORD $0x16e3 // rorx r12d,ebx,0x16 - LONG $0x28048d42 // lea eax,[rax+r13*1] - WORD $0xcf31 // xor edi,ecx - LONG $0x75fee5c5; BYTE $0x60 // vpaddd ymm6,ymm3,[rbp+0x60] - LONG $0xf07b63c4; WORD $0x0df3 // rorx r14d,ebx,0xd - LONG $0xf07b63c4; WORD $0x02eb // rorx r13d,ebx,0x2 - LONG $0x00048d45 // lea r8d,[r8+rax*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xcf // xor r15d,ecx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d42 // lea eax,[rax+r15*1] - WORD $0x8945; BYTE $0xcc // mov r12d,r9d - - LONG $0x747ffdc5; WORD $0x2024 // vmovdqa [rsp+0x20],ymm6 - ADDQ $0x80, BP - - CMPB 0x3(BP), $0x0 - JNE loop1 - - // ROUND(AX, BX, CX, DX, R8, R9, R10, R11, R12, R13, R14, R15, DI, SP, 0x40) - LONG $0x245c0344; BYTE $0x40 // add r11d,[rsp+0x40] - WORD $0x2145; BYTE $0xc4 // and r12d,r8d - LONG $0xf07b43c4; WORD $0x19e8 // rorx r13d,r8d,0x19 - LONG $0xf07b43c4; WORD $0x0bf8 // rorx r15d,r8d,0xb - LONG $0x30048d42 // lea eax,[rax+r14*1] - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - LONG $0xf23842c4; BYTE $0xe2 // andn r12d,r8d,r10d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f0 // rorx r14d,r8d,0x6 - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xc7 // mov r15d,eax - LONG $0xf07b63c4; WORD $0x16e0 // rorx r12d,eax,0x16 - LONG $0x2b1c8d47 // lea r11d,[r11+r13*1] - WORD $0x3141; BYTE $0xdf // xor r15d,ebx - LONG $0xf07b63c4; WORD $0x0df0 // rorx r14d,eax,0xd - LONG $0xf07b63c4; WORD $0x02e8 // rorx r13d,eax,0x2 - LONG $0x1a148d42 // lea edx,[rdx+r11*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xdf31 // xor edi,ebx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3b1c8d45 // lea r11d,[r11+rdi*1] - WORD $0x8945; BYTE $0xc4 // mov r12d,r8d - - // ROUND(R11, AX, BX, CX, DX, R8, R9, R10, R12, R13, R14, DI, R15, SP, 0x44) - LONG $0x24540344; BYTE $0x44 // add r10d,[rsp+0x44] - WORD $0x2141; BYTE $0xd4 // and r12d,edx - LONG $0xf07b63c4; WORD $0x19ea // rorx r13d,edx,0x19 - LONG $0xf07be3c4; WORD $0x0bfa // rorx edi,edx,0xb - LONG $0x331c8d47 // lea r11d,[r11+r14*1] - LONG $0x22148d47 // lea r10d,[r10+r12*1] - LONG $0xf26842c4; BYTE $0xe1 // andn r12d,edx,r9d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f2 // rorx r14d,edx,0x6 - LONG $0x22148d47 // lea r10d,[r10+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xdf // mov edi,r11d - LONG $0xf07b43c4; WORD $0x16e3 // rorx r12d,r11d,0x16 - LONG $0x2a148d47 // lea r10d,[r10+r13*1] - WORD $0xc731 // xor edi,eax - LONG $0xf07b43c4; WORD $0x0df3 // rorx r14d,r11d,0xd - LONG $0xf07b43c4; WORD $0x02eb // rorx r13d,r11d,0x2 - LONG $0x110c8d42 // lea ecx,[rcx+r10*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xc7 // xor r15d,eax - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3a148d47 // lea r10d,[r10+r15*1] - WORD $0x8941; BYTE $0xd4 // mov r12d,edx - - // ROUND(R10, R11, AX, BX, CX, DX, R8, R9, R12, R13, R14, R15, DI, SP, 0x48) - LONG $0x244c0344; BYTE $0x48 // add r9d,[rsp+0x48] - WORD $0x2141; BYTE $0xcc // and r12d,ecx - LONG $0xf07b63c4; WORD $0x19e9 // rorx r13d,ecx,0x19 - LONG $0xf07b63c4; WORD $0x0bf9 // rorx r15d,ecx,0xb - LONG $0x32148d47 // lea r10d,[r10+r14*1] - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - LONG $0xf27042c4; BYTE $0xe0 // andn r12d,ecx,r8d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f1 // rorx r14d,ecx,0x6 - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xd7 // mov r15d,r10d - LONG $0xf07b43c4; WORD $0x16e2 // rorx r12d,r10d,0x16 - LONG $0x290c8d47 // lea r9d,[r9+r13*1] - WORD $0x3145; BYTE $0xdf // xor r15d,r11d - LONG $0xf07b43c4; WORD $0x0df2 // rorx r14d,r10d,0xd - LONG $0xf07b43c4; WORD $0x02ea // rorx r13d,r10d,0x2 - LONG $0x0b1c8d42 // lea ebx,[rbx+r9*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xdf // xor edi,r11d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d45 // lea r9d,[r9+rdi*1] - WORD $0x8941; BYTE $0xcc // mov r12d,ecx - - // ROUND(R9, R10, R11, AX, BX, CX, DX, R8, R12, R13, R14, DI, R15, SP, 0x4c) - LONG $0x24440344; BYTE $0x4c // add r8d,[rsp+0x4c] - WORD $0x2141; BYTE $0xdc // and r12d,ebx - LONG $0xf07b63c4; WORD $0x19eb // rorx r13d,ebx,0x19 - LONG $0xf07be3c4; WORD $0x0bfb // rorx edi,ebx,0xb - LONG $0x310c8d47 // lea r9d,[r9+r14*1] - LONG $0x20048d47 // lea r8d,[r8+r12*1] - LONG $0xf26062c4; BYTE $0xe2 // andn r12d,ebx,edx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f3 // rorx r14d,ebx,0x6 - LONG $0x20048d47 // lea r8d,[r8+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xcf // mov edi,r9d - LONG $0xf07b43c4; WORD $0x16e1 // rorx r12d,r9d,0x16 - LONG $0x28048d47 // lea r8d,[r8+r13*1] - WORD $0x3144; BYTE $0xd7 // xor edi,r10d - LONG $0xf07b43c4; WORD $0x0df1 // rorx r14d,r9d,0xd - LONG $0xf07b43c4; WORD $0x02e9 // rorx r13d,r9d,0x2 - LONG $0x00048d42 // lea eax,[rax+r8*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xd7 // xor r15d,r10d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d47 // lea r8d,[r8+r15*1] - WORD $0x8941; BYTE $0xdc // mov r12d,ebx - - // ROUND(R8, R9, R10, R11, AX, BX, CX, DX, R12, R13, R14, R15, DI, SP, 0x60) - LONG $0x60245403 // add edx,[rsp+0x60] - WORD $0x2141; BYTE $0xc4 // and r12d,eax - LONG $0xf07b63c4; WORD $0x19e8 // rorx r13d,eax,0x19 - LONG $0xf07b63c4; WORD $0x0bf8 // rorx r15d,eax,0xb - LONG $0x30048d47 // lea r8d,[r8+r14*1] - LONG $0x22148d42 // lea edx,[rdx+r12*1] - LONG $0xf27862c4; BYTE $0xe1 // andn r12d,eax,ecx - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f0 // rorx r14d,eax,0x6 - LONG $0x22148d42 // lea edx,[rdx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xc7 // mov r15d,r8d - LONG $0xf07b43c4; WORD $0x16e0 // rorx r12d,r8d,0x16 - LONG $0x2a148d42 // lea edx,[rdx+r13*1] - WORD $0x3145; BYTE $0xcf // xor r15d,r9d - LONG $0xf07b43c4; WORD $0x0df0 // rorx r14d,r8d,0xd - LONG $0xf07b43c4; WORD $0x02e8 // rorx r13d,r8d,0x2 - LONG $0x131c8d45 // lea r11d,[r11+rdx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xcf // xor edi,r9d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x148d; BYTE $0x3a // lea edx,[rdx+rdi*1] - WORD $0x8941; BYTE $0xc4 // mov r12d,eax - - // ROUND(DX, R8, R9, R10, R11, AX, BX, CX, R12, R13, R14, DI, R15, SP, 0x64) - LONG $0x64244c03 // add ecx,[rsp+0x64] - WORD $0x2145; BYTE $0xdc // and r12d,r11d - LONG $0xf07b43c4; WORD $0x19eb // rorx r13d,r11d,0x19 - LONG $0xf07bc3c4; WORD $0x0bfb // rorx edi,r11d,0xb - LONG $0x32148d42 // lea edx,[rdx+r14*1] - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - LONG $0xf22062c4; BYTE $0xe3 // andn r12d,r11d,ebx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f3 // rorx r14d,r11d,0x6 - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xd789 // mov edi,edx - LONG $0xf07b63c4; WORD $0x16e2 // rorx r12d,edx,0x16 - LONG $0x290c8d42 // lea ecx,[rcx+r13*1] - WORD $0x3144; BYTE $0xc7 // xor edi,r8d - LONG $0xf07b63c4; WORD $0x0df2 // rorx r14d,edx,0xd - LONG $0xf07b63c4; WORD $0x02ea // rorx r13d,edx,0x2 - LONG $0x0a148d45 // lea r10d,[r10+rcx*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xc7 // xor r15d,r8d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d42 // lea ecx,[rcx+r15*1] - WORD $0x8945; BYTE $0xdc // mov r12d,r11d - - // ROUND(CX, DX, R8, R9, R10, R11, AX, BX, R12, R13, R14, R15, DI, SP, 0x68) - LONG $0x68245c03 // add ebx,[rsp+0x68] - WORD $0x2145; BYTE $0xd4 // and r12d,r10d - LONG $0xf07b43c4; WORD $0x19ea // rorx r13d,r10d,0x19 - LONG $0xf07b43c4; WORD $0x0bfa // rorx r15d,r10d,0xb - LONG $0x310c8d42 // lea ecx,[rcx+r14*1] - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - LONG $0xf22862c4; BYTE $0xe0 // andn r12d,r10d,eax - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f2 // rorx r14d,r10d,0x6 - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xcf // mov r15d,ecx - LONG $0xf07b63c4; WORD $0x16e1 // rorx r12d,ecx,0x16 - LONG $0x2b1c8d42 // lea ebx,[rbx+r13*1] - WORD $0x3141; BYTE $0xd7 // xor r15d,edx - LONG $0xf07b63c4; WORD $0x0df1 // rorx r14d,ecx,0xd - LONG $0xf07b63c4; WORD $0x02e9 // rorx r13d,ecx,0x2 - LONG $0x190c8d45 // lea r9d,[r9+rbx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xd731 // xor edi,edx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x1c8d; BYTE $0x3b // lea ebx,[rbx+rdi*1] - WORD $0x8945; BYTE $0xd4 // mov r12d,r10d - - // ROUND(BX, CX, DX, R8, R9, R10, R11, AX, R12, R13, R14, DI, R15, SP, 0x6c) - LONG $0x6c244403 // add eax,[rsp+0x6c] - WORD $0x2145; BYTE $0xcc // and r12d,r9d - LONG $0xf07b43c4; WORD $0x19e9 // rorx r13d,r9d,0x19 - LONG $0xf07bc3c4; WORD $0x0bf9 // rorx edi,r9d,0xb - LONG $0x331c8d42 // lea ebx,[rbx+r14*1] - LONG $0x20048d42 // lea eax,[rax+r12*1] - LONG $0xf23042c4; BYTE $0xe3 // andn r12d,r9d,r11d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f1 // rorx r14d,r9d,0x6 - LONG $0x20048d42 // lea eax,[rax+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xdf89 // mov edi,ebx - LONG $0xf07b63c4; WORD $0x16e3 // rorx r12d,ebx,0x16 - LONG $0x28048d42 // lea eax,[rax+r13*1] - WORD $0xcf31 // xor edi,ecx - LONG $0xf07b63c4; WORD $0x0df3 // rorx r14d,ebx,0xd - LONG $0xf07b63c4; WORD $0x02eb // rorx r13d,ebx,0x2 - LONG $0x00048d45 // lea r8d,[r8+rax*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xcf // xor r15d,ecx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d42 // lea eax,[rax+r15*1] - WORD $0x8945; BYTE $0xcc // mov r12d,r9d - - // ROUND(AX, BX, CX, DX, R8, R9, R10, R11, R12, R13, R14, R15, DI, SP, 0x00) - LONG $0x241c0344 // add r11d,[rsp] - WORD $0x2145; BYTE $0xc4 // and r12d,r8d - LONG $0xf07b43c4; WORD $0x19e8 // rorx r13d,r8d,0x19 - LONG $0xf07b43c4; WORD $0x0bf8 // rorx r15d,r8d,0xb - LONG $0x30048d42 // lea eax,[rax+r14*1] - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - LONG $0xf23842c4; BYTE $0xe2 // andn r12d,r8d,r10d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f0 // rorx r14d,r8d,0x6 - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xc7 // mov r15d,eax - LONG $0xf07b63c4; WORD $0x16e0 // rorx r12d,eax,0x16 - LONG $0x2b1c8d47 // lea r11d,[r11+r13*1] - WORD $0x3141; BYTE $0xdf // xor r15d,ebx - LONG $0xf07b63c4; WORD $0x0df0 // rorx r14d,eax,0xd - LONG $0xf07b63c4; WORD $0x02e8 // rorx r13d,eax,0x2 - LONG $0x1a148d42 // lea edx,[rdx+r11*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xdf31 // xor edi,ebx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3b1c8d45 // lea r11d,[r11+rdi*1] - WORD $0x8945; BYTE $0xc4 // mov r12d,r8d - - // ROUND(R11, AX, BX, CX, DX, R8, R9, R10, R12, R13, R14, DI, R15, SP, 0x04) - LONG $0x24540344; BYTE $0x04 // add r10d,[rsp+0x4] - WORD $0x2141; BYTE $0xd4 // and r12d,edx - LONG $0xf07b63c4; WORD $0x19ea // rorx r13d,edx,0x19 - LONG $0xf07be3c4; WORD $0x0bfa // rorx edi,edx,0xb - LONG $0x331c8d47 // lea r11d,[r11+r14*1] - LONG $0x22148d47 // lea r10d,[r10+r12*1] - LONG $0xf26842c4; BYTE $0xe1 // andn r12d,edx,r9d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f2 // rorx r14d,edx,0x6 - LONG $0x22148d47 // lea r10d,[r10+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xdf // mov edi,r11d - LONG $0xf07b43c4; WORD $0x16e3 // rorx r12d,r11d,0x16 - LONG $0x2a148d47 // lea r10d,[r10+r13*1] - WORD $0xc731 // xor edi,eax - LONG $0xf07b43c4; WORD $0x0df3 // rorx r14d,r11d,0xd - LONG $0xf07b43c4; WORD $0x02eb // rorx r13d,r11d,0x2 - LONG $0x110c8d42 // lea ecx,[rcx+r10*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xc7 // xor r15d,eax - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3a148d47 // lea r10d,[r10+r15*1] - WORD $0x8941; BYTE $0xd4 // mov r12d,edx - - // ROUND(R10, R11, AX, BX, CX, DX, R8, R9, R12, R13, R14, R15, DI, SP, 0x08) - LONG $0x244c0344; BYTE $0x08 // add r9d,[rsp+0x8] - WORD $0x2141; BYTE $0xcc // and r12d,ecx - LONG $0xf07b63c4; WORD $0x19e9 // rorx r13d,ecx,0x19 - LONG $0xf07b63c4; WORD $0x0bf9 // rorx r15d,ecx,0xb - LONG $0x32148d47 // lea r10d,[r10+r14*1] - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - LONG $0xf27042c4; BYTE $0xe0 // andn r12d,ecx,r8d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f1 // rorx r14d,ecx,0x6 - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xd7 // mov r15d,r10d - LONG $0xf07b43c4; WORD $0x16e2 // rorx r12d,r10d,0x16 - LONG $0x290c8d47 // lea r9d,[r9+r13*1] - WORD $0x3145; BYTE $0xdf // xor r15d,r11d - LONG $0xf07b43c4; WORD $0x0df2 // rorx r14d,r10d,0xd - LONG $0xf07b43c4; WORD $0x02ea // rorx r13d,r10d,0x2 - LONG $0x0b1c8d42 // lea ebx,[rbx+r9*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xdf // xor edi,r11d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d45 // lea r9d,[r9+rdi*1] - WORD $0x8941; BYTE $0xcc // mov r12d,ecx - - // ROUND(R9, R10, R11, AX, BX, CX, DX, R8, R12, R13, R14, DI, R15, SP, 0x0c) - LONG $0x24440344; BYTE $0x0c // add r8d,[rsp+0xc] - WORD $0x2141; BYTE $0xdc // and r12d,ebx - LONG $0xf07b63c4; WORD $0x19eb // rorx r13d,ebx,0x19 - LONG $0xf07be3c4; WORD $0x0bfb // rorx edi,ebx,0xb - LONG $0x310c8d47 // lea r9d,[r9+r14*1] - LONG $0x20048d47 // lea r8d,[r8+r12*1] - LONG $0xf26062c4; BYTE $0xe2 // andn r12d,ebx,edx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f3 // rorx r14d,ebx,0x6 - LONG $0x20048d47 // lea r8d,[r8+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xcf // mov edi,r9d - LONG $0xf07b43c4; WORD $0x16e1 // rorx r12d,r9d,0x16 - LONG $0x28048d47 // lea r8d,[r8+r13*1] - WORD $0x3144; BYTE $0xd7 // xor edi,r10d - LONG $0xf07b43c4; WORD $0x0df1 // rorx r14d,r9d,0xd - LONG $0xf07b43c4; WORD $0x02e9 // rorx r13d,r9d,0x2 - LONG $0x00048d42 // lea eax,[rax+r8*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xd7 // xor r15d,r10d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d47 // lea r8d,[r8+r15*1] - WORD $0x8941; BYTE $0xdc // mov r12d,ebx - - // ROUND(R8, R9, R10, R11, AX, BX, CX, DX, R12, R13, R14, R15, DI, SP, 0x20) - LONG $0x20245403 // add edx,[rsp+0x20] - WORD $0x2141; BYTE $0xc4 // and r12d,eax - LONG $0xf07b63c4; WORD $0x19e8 // rorx r13d,eax,0x19 - LONG $0xf07b63c4; WORD $0x0bf8 // rorx r15d,eax,0xb - LONG $0x30048d47 // lea r8d,[r8+r14*1] - LONG $0x22148d42 // lea edx,[rdx+r12*1] - LONG $0xf27862c4; BYTE $0xe1 // andn r12d,eax,ecx - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f0 // rorx r14d,eax,0x6 - LONG $0x22148d42 // lea edx,[rdx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xc7 // mov r15d,r8d - LONG $0xf07b43c4; WORD $0x16e0 // rorx r12d,r8d,0x16 - LONG $0x2a148d42 // lea edx,[rdx+r13*1] - WORD $0x3145; BYTE $0xcf // xor r15d,r9d - LONG $0xf07b43c4; WORD $0x0df0 // rorx r14d,r8d,0xd - LONG $0xf07b43c4; WORD $0x02e8 // rorx r13d,r8d,0x2 - LONG $0x131c8d45 // lea r11d,[r11+rdx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xcf // xor edi,r9d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x148d; BYTE $0x3a // lea edx,[rdx+rdi*1] - WORD $0x8941; BYTE $0xc4 // mov r12d,eax - - // ROUND(DX, R8, R9, R10, R11, AX, BX, CX, R12, R13, R14, DI, R15, SP, 0x24) - LONG $0x24244c03 // add ecx,[rsp+0x24] - WORD $0x2145; BYTE $0xdc // and r12d,r11d - LONG $0xf07b43c4; WORD $0x19eb // rorx r13d,r11d,0x19 - LONG $0xf07bc3c4; WORD $0x0bfb // rorx edi,r11d,0xb - LONG $0x32148d42 // lea edx,[rdx+r14*1] - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - LONG $0xf22062c4; BYTE $0xe3 // andn r12d,r11d,ebx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f3 // rorx r14d,r11d,0x6 - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xd789 // mov edi,edx - LONG $0xf07b63c4; WORD $0x16e2 // rorx r12d,edx,0x16 - LONG $0x290c8d42 // lea ecx,[rcx+r13*1] - WORD $0x3144; BYTE $0xc7 // xor edi,r8d - LONG $0xf07b63c4; WORD $0x0df2 // rorx r14d,edx,0xd - LONG $0xf07b63c4; WORD $0x02ea // rorx r13d,edx,0x2 - LONG $0x0a148d45 // lea r10d,[r10+rcx*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xc7 // xor r15d,r8d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d42 // lea ecx,[rcx+r15*1] - WORD $0x8945; BYTE $0xdc // mov r12d,r11d - - // ROUND(CX, DX, R8, R9, R10, R11, AX, BX, R12, R13, R14, R15, DI, SP, 0x28) - LONG $0x28245c03 // add ebx,[rsp+0x28] - WORD $0x2145; BYTE $0xd4 // and r12d,r10d - LONG $0xf07b43c4; WORD $0x19ea // rorx r13d,r10d,0x19 - LONG $0xf07b43c4; WORD $0x0bfa // rorx r15d,r10d,0xb - LONG $0x310c8d42 // lea ecx,[rcx+r14*1] - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - LONG $0xf22862c4; BYTE $0xe0 // andn r12d,r10d,eax - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f2 // rorx r14d,r10d,0x6 - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xcf // mov r15d,ecx - LONG $0xf07b63c4; WORD $0x16e1 // rorx r12d,ecx,0x16 - LONG $0x2b1c8d42 // lea ebx,[rbx+r13*1] - WORD $0x3141; BYTE $0xd7 // xor r15d,edx - LONG $0xf07b63c4; WORD $0x0df1 // rorx r14d,ecx,0xd - LONG $0xf07b63c4; WORD $0x02e9 // rorx r13d,ecx,0x2 - LONG $0x190c8d45 // lea r9d,[r9+rbx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xd731 // xor edi,edx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x1c8d; BYTE $0x3b // lea ebx,[rbx+rdi*1] - WORD $0x8945; BYTE $0xd4 // mov r12d,r10d - - // ROUND(BX, CX, DX, R8, R9, R10, R11, AX, R12, R13, R14, DI, R15, SP, 0x2c) - LONG $0x2c244403 // add eax,[rsp+0x2c] - WORD $0x2145; BYTE $0xcc // and r12d,r9d - LONG $0xf07b43c4; WORD $0x19e9 // rorx r13d,r9d,0x19 - LONG $0xf07bc3c4; WORD $0x0bf9 // rorx edi,r9d,0xb - LONG $0x331c8d42 // lea ebx,[rbx+r14*1] - LONG $0x20048d42 // lea eax,[rax+r12*1] - LONG $0xf23042c4; BYTE $0xe3 // andn r12d,r9d,r11d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f1 // rorx r14d,r9d,0x6 - LONG $0x20048d42 // lea eax,[rax+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xdf89 // mov edi,ebx - LONG $0xf07b63c4; WORD $0x16e3 // rorx r12d,ebx,0x16 - LONG $0x28048d42 // lea eax,[rax+r13*1] - WORD $0xcf31 // xor edi,ecx - LONG $0xf07b63c4; WORD $0x0df3 // rorx r14d,ebx,0xd - LONG $0xf07b63c4; WORD $0x02eb // rorx r13d,ebx,0x2 - LONG $0x00048d45 // lea r8d,[r8+rax*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xcf // xor r15d,ecx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d42 // lea eax,[rax+r15*1] - WORD $0x8945; BYTE $0xcc // mov r12d,r9d - - MOVQ 0x200(SP), DI // $_ctx - ADDQ R14, AX - - LEAQ 0x1c0(SP), BP - - ADDL (DI), AX - ADDL 4(DI), BX - ADDL 8(DI), CX - ADDL 12(DI), DX - ADDL 16(DI), R8 - ADDL 20(DI), R9 - ADDL 24(DI), R10 - ADDL 28(DI), R11 - - MOVL AX, (DI) - MOVL BX, 4(DI) - MOVL CX, 8(DI) - MOVL DX, 12(DI) - MOVL R8, 16(DI) - MOVL R9, 20(DI) - MOVL R10, 24(DI) - MOVL R11, 28(DI) - - CMPQ SI, 0x50(BP) // $_end - JE done - - XORQ R14, R14 - MOVQ BX, DI - XORQ CX, DI // magic - MOVQ R9, R12 - -loop2: - // ROUND(AX, BX, CX, DX, R8, R9, R10, R11, R12, R13, R14, R15, DI, BP, 0x10) - LONG $0x105d0344 // add r11d,[rbp+0x10] - WORD $0x2145; BYTE $0xc4 // and r12d,r8d - LONG $0xf07b43c4; WORD $0x19e8 // rorx r13d,r8d,0x19 - LONG $0xf07b43c4; WORD $0x0bf8 // rorx r15d,r8d,0xb - LONG $0x30048d42 // lea eax,[rax+r14*1] - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - LONG $0xf23842c4; BYTE $0xe2 // andn r12d,r8d,r10d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f0 // rorx r14d,r8d,0x6 - LONG $0x231c8d47 // lea r11d,[r11+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xc7 // mov r15d,eax - LONG $0xf07b63c4; WORD $0x16e0 // rorx r12d,eax,0x16 - LONG $0x2b1c8d47 // lea r11d,[r11+r13*1] - WORD $0x3141; BYTE $0xdf // xor r15d,ebx - LONG $0xf07b63c4; WORD $0x0df0 // rorx r14d,eax,0xd - LONG $0xf07b63c4; WORD $0x02e8 // rorx r13d,eax,0x2 - LONG $0x1a148d42 // lea edx,[rdx+r11*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xdf31 // xor edi,ebx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3b1c8d45 // lea r11d,[r11+rdi*1] - WORD $0x8945; BYTE $0xc4 // mov r12d,r8d - - // ROUND(R11, AX, BX, CX, DX, R8, R9, R10, R12, R13, R14, DI, R15, BP, 0x14) - LONG $0x14550344 // add r10d,[rbp+0x14] - WORD $0x2141; BYTE $0xd4 // and r12d,edx - LONG $0xf07b63c4; WORD $0x19ea // rorx r13d,edx,0x19 - LONG $0xf07be3c4; WORD $0x0bfa // rorx edi,edx,0xb - LONG $0x331c8d47 // lea r11d,[r11+r14*1] - LONG $0x22148d47 // lea r10d,[r10+r12*1] - LONG $0xf26842c4; BYTE $0xe1 // andn r12d,edx,r9d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f2 // rorx r14d,edx,0x6 - LONG $0x22148d47 // lea r10d,[r10+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xdf // mov edi,r11d - LONG $0xf07b43c4; WORD $0x16e3 // rorx r12d,r11d,0x16 - LONG $0x2a148d47 // lea r10d,[r10+r13*1] - WORD $0xc731 // xor edi,eax - LONG $0xf07b43c4; WORD $0x0df3 // rorx r14d,r11d,0xd - LONG $0xf07b43c4; WORD $0x02eb // rorx r13d,r11d,0x2 - LONG $0x110c8d42 // lea ecx,[rcx+r10*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xc7 // xor r15d,eax - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x3a148d47 // lea r10d,[r10+r15*1] - WORD $0x8941; BYTE $0xd4 // mov r12d,edx - - // ROUND(R10, R11, AX, BX, CX, DX, R8, R9, R12, R13, R14, R15, DI, BP, 0x18) - LONG $0x184d0344 // add r9d,[rbp+0x18] - WORD $0x2141; BYTE $0xcc // and r12d,ecx - LONG $0xf07b63c4; WORD $0x19e9 // rorx r13d,ecx,0x19 - LONG $0xf07b63c4; WORD $0x0bf9 // rorx r15d,ecx,0xb - LONG $0x32148d47 // lea r10d,[r10+r14*1] - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - LONG $0xf27042c4; BYTE $0xe0 // andn r12d,ecx,r8d - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f1 // rorx r14d,ecx,0x6 - LONG $0x210c8d47 // lea r9d,[r9+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xd7 // mov r15d,r10d - LONG $0xf07b43c4; WORD $0x16e2 // rorx r12d,r10d,0x16 - LONG $0x290c8d47 // lea r9d,[r9+r13*1] - WORD $0x3145; BYTE $0xdf // xor r15d,r11d - LONG $0xf07b43c4; WORD $0x0df2 // rorx r14d,r10d,0xd - LONG $0xf07b43c4; WORD $0x02ea // rorx r13d,r10d,0x2 - LONG $0x0b1c8d42 // lea ebx,[rbx+r9*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xdf // xor edi,r11d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d45 // lea r9d,[r9+rdi*1] - WORD $0x8941; BYTE $0xcc // mov r12d,ecx - - // ROUND(R9, R10, R11, AX, BX, CX, DX, R8, R12, R13, R14, DI, R15, BP, 0x1c) - LONG $0x1c450344 // add r8d,[rbp+0x1c] - WORD $0x2141; BYTE $0xdc // and r12d,ebx - LONG $0xf07b63c4; WORD $0x19eb // rorx r13d,ebx,0x19 - LONG $0xf07be3c4; WORD $0x0bfb // rorx edi,ebx,0xb - LONG $0x310c8d47 // lea r9d,[r9+r14*1] - LONG $0x20048d47 // lea r8d,[r8+r12*1] - LONG $0xf26062c4; BYTE $0xe2 // andn r12d,ebx,edx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b63c4; WORD $0x06f3 // rorx r14d,ebx,0x6 - LONG $0x20048d47 // lea r8d,[r8+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8944; BYTE $0xcf // mov edi,r9d - LONG $0xf07b43c4; WORD $0x16e1 // rorx r12d,r9d,0x16 - LONG $0x28048d47 // lea r8d,[r8+r13*1] - WORD $0x3144; BYTE $0xd7 // xor edi,r10d - LONG $0xf07b43c4; WORD $0x0df1 // rorx r14d,r9d,0xd - LONG $0xf07b43c4; WORD $0x02e9 // rorx r13d,r9d,0x2 - LONG $0x00048d42 // lea eax,[rax+r8*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xd7 // xor r15d,r10d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d47 // lea r8d,[r8+r15*1] - WORD $0x8941; BYTE $0xdc // mov r12d,ebx - - // ROUND(R8, R9, R10, R11, AX, BX, CX, DX, R12, R13, R14, R15, DI, BP, 0x30) - WORD $0x5503; BYTE $0x30 // add edx,[rbp+0x30] - WORD $0x2141; BYTE $0xc4 // and r12d,eax - LONG $0xf07b63c4; WORD $0x19e8 // rorx r13d,eax,0x19 - LONG $0xf07b63c4; WORD $0x0bf8 // rorx r15d,eax,0xb - LONG $0x30048d47 // lea r8d,[r8+r14*1] - LONG $0x22148d42 // lea edx,[rdx+r12*1] - LONG $0xf27862c4; BYTE $0xe1 // andn r12d,eax,ecx - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b63c4; WORD $0x06f0 // rorx r14d,eax,0x6 - LONG $0x22148d42 // lea edx,[rdx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8945; BYTE $0xc7 // mov r15d,r8d - LONG $0xf07b43c4; WORD $0x16e0 // rorx r12d,r8d,0x16 - LONG $0x2a148d42 // lea edx,[rdx+r13*1] - WORD $0x3145; BYTE $0xcf // xor r15d,r9d - LONG $0xf07b43c4; WORD $0x0df0 // rorx r14d,r8d,0xd - LONG $0xf07b43c4; WORD $0x02e8 // rorx r13d,r8d,0x2 - LONG $0x131c8d45 // lea r11d,[r11+rdx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3144; BYTE $0xcf // xor edi,r9d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x148d; BYTE $0x3a // lea edx,[rdx+rdi*1] - WORD $0x8941; BYTE $0xc4 // mov r12d,eax - - // ROUND(DX, R8, R9, R10, R11, AX, BX, CX, R12, R13, R14, DI, R15, BP, 0x34) - WORD $0x4d03; BYTE $0x34 // add ecx,[rbp+0x34] - WORD $0x2145; BYTE $0xdc // and r12d,r11d - LONG $0xf07b43c4; WORD $0x19eb // rorx r13d,r11d,0x19 - LONG $0xf07bc3c4; WORD $0x0bfb // rorx edi,r11d,0xb - LONG $0x32148d42 // lea edx,[rdx+r14*1] - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - LONG $0xf22062c4; BYTE $0xe3 // andn r12d,r11d,ebx - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f3 // rorx r14d,r11d,0x6 - LONG $0x210c8d42 // lea ecx,[rcx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xd789 // mov edi,edx - LONG $0xf07b63c4; WORD $0x16e2 // rorx r12d,edx,0x16 - LONG $0x290c8d42 // lea ecx,[rcx+r13*1] - WORD $0x3144; BYTE $0xc7 // xor edi,r8d - LONG $0xf07b63c4; WORD $0x0df2 // rorx r14d,edx,0xd - LONG $0xf07b63c4; WORD $0x02ea // rorx r13d,edx,0x2 - LONG $0x0a148d45 // lea r10d,[r10+rcx*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3145; BYTE $0xc7 // xor r15d,r8d - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x390c8d42 // lea ecx,[rcx+r15*1] - WORD $0x8945; BYTE $0xdc // mov r12d,r11d - - // ROUND(CX, DX, R8, R9, R10, R11, AX, BX, R12, R13, R14, R15, DI, BP, 0x38) - WORD $0x5d03; BYTE $0x38 // add ebx,[rbp+0x38] - WORD $0x2145; BYTE $0xd4 // and r12d,r10d - LONG $0xf07b43c4; WORD $0x19ea // rorx r13d,r10d,0x19 - LONG $0xf07b43c4; WORD $0x0bfa // rorx r15d,r10d,0xb - LONG $0x310c8d42 // lea ecx,[rcx+r14*1] - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - LONG $0xf22862c4; BYTE $0xe0 // andn r12d,r10d,eax - WORD $0x3145; BYTE $0xfd // xor r13d,r15d - LONG $0xf07b43c4; WORD $0x06f2 // rorx r14d,r10d,0x6 - LONG $0x231c8d42 // lea ebx,[rbx+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0x8941; BYTE $0xcf // mov r15d,ecx - LONG $0xf07b63c4; WORD $0x16e1 // rorx r12d,ecx,0x16 - LONG $0x2b1c8d42 // lea ebx,[rbx+r13*1] - WORD $0x3141; BYTE $0xd7 // xor r15d,edx - LONG $0xf07b63c4; WORD $0x0df1 // rorx r14d,ecx,0xd - LONG $0xf07b63c4; WORD $0x02e9 // rorx r13d,ecx,0x2 - LONG $0x190c8d45 // lea r9d,[r9+rbx*1] - WORD $0x2144; BYTE $0xff // and edi,r15d - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0xd731 // xor edi,edx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - WORD $0x1c8d; BYTE $0x3b // lea ebx,[rbx+rdi*1] - WORD $0x8945; BYTE $0xd4 // mov r12d,r10d - - // ROUND(BX, CX, DX, R8, R9, R10, R11, AX, R12, R13, R14, DI, R15, BP, 0x3c) - WORD $0x4503; BYTE $0x3c // add eax,[rbp+0x3c] - WORD $0x2145; BYTE $0xcc // and r12d,r9d - LONG $0xf07b43c4; WORD $0x19e9 // rorx r13d,r9d,0x19 - LONG $0xf07bc3c4; WORD $0x0bf9 // rorx edi,r9d,0xb - LONG $0x331c8d42 // lea ebx,[rbx+r14*1] - LONG $0x20048d42 // lea eax,[rax+r12*1] - LONG $0xf23042c4; BYTE $0xe3 // andn r12d,r9d,r11d - WORD $0x3141; BYTE $0xfd // xor r13d,edi - LONG $0xf07b43c4; WORD $0x06f1 // rorx r14d,r9d,0x6 - LONG $0x20048d42 // lea eax,[rax+r12*1] - WORD $0x3145; BYTE $0xf5 // xor r13d,r14d - WORD $0xdf89 // mov edi,ebx - LONG $0xf07b63c4; WORD $0x16e3 // rorx r12d,ebx,0x16 - LONG $0x28048d42 // lea eax,[rax+r13*1] - WORD $0xcf31 // xor edi,ecx - LONG $0xf07b63c4; WORD $0x0df3 // rorx r14d,ebx,0xd - LONG $0xf07b63c4; WORD $0x02eb // rorx r13d,ebx,0x2 - LONG $0x00048d45 // lea r8d,[r8+rax*1] - WORD $0x2141; BYTE $0xff // and r15d,edi - WORD $0x3145; BYTE $0xe6 // xor r14d,r12d - WORD $0x3141; BYTE $0xcf // xor r15d,ecx - WORD $0x3145; BYTE $0xee // xor r14d,r13d - LONG $0x38048d42 // lea eax,[rax+r15*1] - WORD $0x8945; BYTE $0xcc // mov r12d,r9d - - ADDQ $-0x40, BP - CMPQ BP, SP - JAE loop2 - - MOVQ 0x200(SP), DI // $_ctx - ADDQ R14, AX - - ADDQ $0x1c0, SP - - ADDL (DI), AX - ADDL 4(DI), BX - ADDL 8(DI), CX - ADDL 12(DI), DX - ADDL 16(DI), R8 - ADDL 20(DI), R9 - - ADDQ $0x80, SI // input += 2 - ADDL 24(DI), R10 - MOVQ SI, R12 - ADDL 28(DI), R11 - CMPQ SI, 0x50(SP) // input == _end - - MOVL AX, (DI) - LONG $0xe4440f4c // cmove r12,rsp /* next block or stale data */ - MOVL AX, (DI) - MOVL BX, 4(DI) - MOVL CX, 8(DI) - MOVL DX, 12(DI) - MOVL R8, 16(DI) - MOVL R9, 20(DI) - MOVL R10, 24(DI) - MOVL R11, 28(DI) - - JBE loop0 - LEAQ (SP), BP - -done: - MOVQ BP, SP - MOVQ 0x58(SP), SP // restore saved stack pointer - WORD $0xf8c5; BYTE $0x77 // vzeroupper - - RET - diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm b/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm deleted file mode 100644 index c959b1aa..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm +++ /dev/null @@ -1,686 +0,0 @@ - -// 16x Parallel implementation of SHA256 for AVX512 - -// -// Minio Cloud Storage, (C) 2017 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// -// This code is based on the Intel Multi-Buffer Crypto for IPSec library -// and more specifically the following implementation: -// https://github.com/intel/intel-ipsec-mb/blob/master/avx512/sha256_x16_avx512.asm -// -// For Golang it has been converted into Plan 9 assembly with the help of -// github.com/minio/asm2plan9s to assemble the AVX512 instructions -// - -// Copyright (c) 2017, Intel Corporation -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#define SHA256_DIGEST_ROW_SIZE 64 - -// arg1 -#define STATE rdi -#define STATE_P9 DI -// arg2 -#define INP_SIZE rsi -#define INP_SIZE_P9 SI - -#define IDX rcx -#define TBL rdx -#define TBL_P9 DX - -#define INPUT rax -#define INPUT_P9 AX - -#define inp0 r9 -#define SCRATCH_P9 R12 -#define SCRATCH r12 -#define maskp r13 -#define MASKP_P9 R13 -#define mask r14 -#define MASK_P9 R14 - -#define A zmm0 -#define B zmm1 -#define C zmm2 -#define D zmm3 -#define E zmm4 -#define F zmm5 -#define G zmm6 -#define H zmm7 -#define T1 zmm8 -#define TMP0 zmm9 -#define TMP1 zmm10 -#define TMP2 zmm11 -#define TMP3 zmm12 -#define TMP4 zmm13 -#define TMP5 zmm14 -#define TMP6 zmm15 - -#define W0 zmm16 -#define W1 zmm17 -#define W2 zmm18 -#define W3 zmm19 -#define W4 zmm20 -#define W5 zmm21 -#define W6 zmm22 -#define W7 zmm23 -#define W8 zmm24 -#define W9 zmm25 -#define W10 zmm26 -#define W11 zmm27 -#define W12 zmm28 -#define W13 zmm29 -#define W14 zmm30 -#define W15 zmm31 - - -#define TRANSPOSE16(_r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7, _r8, _r9, _r10, _r11, _r12, _r13, _r14, _r15, _t0, _t1) \ - \ - \ // input r0 = {a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0} - \ // r1 = {b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0} - \ // r2 = {c15 c14 c13 c12 c11 c10 c9 c8 c7 c6 c5 c4 c3 c2 c1 c0} - \ // r3 = {d15 d14 d13 d12 d11 d10 d9 d8 d7 d6 d5 d4 d3 d2 d1 d0} - \ // r4 = {e15 e14 e13 e12 e11 e10 e9 e8 e7 e6 e5 e4 e3 e2 e1 e0} - \ // r5 = {f15 f14 f13 f12 f11 f10 f9 f8 f7 f6 f5 f4 f3 f2 f1 f0} - \ // r6 = {g15 g14 g13 g12 g11 g10 g9 g8 g7 g6 g5 g4 g3 g2 g1 g0} - \ // r7 = {h15 h14 h13 h12 h11 h10 h9 h8 h7 h6 h5 h4 h3 h2 h1 h0} - \ // r8 = {i15 i14 i13 i12 i11 i10 i9 i8 i7 i6 i5 i4 i3 i2 i1 i0} - \ // r9 = {j15 j14 j13 j12 j11 j10 j9 j8 j7 j6 j5 j4 j3 j2 j1 j0} - \ // r10 = {k15 k14 k13 k12 k11 k10 k9 k8 k7 k6 k5 k4 k3 k2 k1 k0} - \ // r11 = {l15 l14 l13 l12 l11 l10 l9 l8 l7 l6 l5 l4 l3 l2 l1 l0} - \ // r12 = {m15 m14 m13 m12 m11 m10 m9 m8 m7 m6 m5 m4 m3 m2 m1 m0} - \ // r13 = {n15 n14 n13 n12 n11 n10 n9 n8 n7 n6 n5 n4 n3 n2 n1 n0} - \ // r14 = {o15 o14 o13 o12 o11 o10 o9 o8 o7 o6 o5 o4 o3 o2 o1 o0} - \ // r15 = {p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0} - \ - \ // output r0 = { p0 o0 n0 m0 l0 k0 j0 i0 h0 g0 f0 e0 d0 c0 b0 a0} - \ // r1 = { p1 o1 n1 m1 l1 k1 j1 i1 h1 g1 f1 e1 d1 c1 b1 a1} - \ // r2 = { p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2} - \ // r3 = { p3 o3 n3 m3 l3 k3 j3 i3 h3 g3 f3 e3 d3 c3 b3 a3} - \ // r4 = { p4 o4 n4 m4 l4 k4 j4 i4 h4 g4 f4 e4 d4 c4 b4 a4} - \ // r5 = { p5 o5 n5 m5 l5 k5 j5 i5 h5 g5 f5 e5 d5 c5 b5 a5} - \ // r6 = { p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6} - \ // r7 = { p7 o7 n7 m7 l7 k7 j7 i7 h7 g7 f7 e7 d7 c7 b7 a7} - \ // r8 = { p8 o8 n8 m8 l8 k8 j8 i8 h8 g8 f8 e8 d8 c8 b8 a8} - \ // r9 = { p9 o9 n9 m9 l9 k9 j9 i9 h9 g9 f9 e9 d9 c9 b9 a9} - \ // r10 = {p10 o10 n10 m10 l10 k10 j10 i10 h10 g10 f10 e10 d10 c10 b10 a10} - \ // r11 = {p11 o11 n11 m11 l11 k11 j11 i11 h11 g11 f11 e11 d11 c11 b11 a11} - \ // r12 = {p12 o12 n12 m12 l12 k12 j12 i12 h12 g12 f12 e12 d12 c12 b12 a12} - \ // r13 = {p13 o13 n13 m13 l13 k13 j13 i13 h13 g13 f13 e13 d13 c13 b13 a13} - \ // r14 = {p14 o14 n14 m14 l14 k14 j14 i14 h14 g14 f14 e14 d14 c14 b14 a14} - \ // r15 = {p15 o15 n15 m15 l15 k15 j15 i15 h15 g15 f15 e15 d15 c15 b15 a15} - \ - \ // process top half - vshufps _t0, _r0, _r1, 0x44 \ // t0 = {b13 b12 a13 a12 b9 b8 a9 a8 b5 b4 a5 a4 b1 b0 a1 a0} - vshufps _r0, _r0, _r1, 0xEE \ // r0 = {b15 b14 a15 a14 b11 b10 a11 a10 b7 b6 a7 a6 b3 b2 a3 a2} - vshufps _t1, _r2, _r3, 0x44 \ // t1 = {d13 d12 c13 c12 d9 d8 c9 c8 d5 d4 c5 c4 d1 d0 c1 c0} - vshufps _r2, _r2, _r3, 0xEE \ // r2 = {d15 d14 c15 c14 d11 d10 c11 c10 d7 d6 c7 c6 d3 d2 c3 c2} - \ - vshufps _r3, _t0, _t1, 0xDD \ // r3 = {d13 c13 b13 a13 d9 c9 b9 a9 d5 c5 b5 a5 d1 c1 b1 a1} - vshufps _r1, _r0, _r2, 0x88 \ // r1 = {d14 c14 b14 a14 d10 c10 b10 a10 d6 c6 b6 a6 d2 c2 b2 a2} - vshufps _r0, _r0, _r2, 0xDD \ // r0 = {d15 c15 b15 a15 d11 c11 b11 a11 d7 c7 b7 a7 d3 c3 b3 a3} - vshufps _t0, _t0, _t1, 0x88 \ // t0 = {d12 c12 b12 a12 d8 c8 b8 a8 d4 c4 b4 a4 d0 c0 b0 a0} - \ - \ // use r2 in place of t0 - vshufps _r2, _r4, _r5, 0x44 \ // r2 = {f13 f12 e13 e12 f9 f8 e9 e8 f5 f4 e5 e4 f1 f0 e1 e0} - vshufps _r4, _r4, _r5, 0xEE \ // r4 = {f15 f14 e15 e14 f11 f10 e11 e10 f7 f6 e7 e6 f3 f2 e3 e2} - vshufps _t1, _r6, _r7, 0x44 \ // t1 = {h13 h12 g13 g12 h9 h8 g9 g8 h5 h4 g5 g4 h1 h0 g1 g0} - vshufps _r6, _r6, _r7, 0xEE \ // r6 = {h15 h14 g15 g14 h11 h10 g11 g10 h7 h6 g7 g6 h3 h2 g3 g2} - \ - vshufps _r7, _r2, _t1, 0xDD \ // r7 = {h13 g13 f13 e13 h9 g9 f9 e9 h5 g5 f5 e5 h1 g1 f1 e1} - vshufps _r5, _r4, _r6, 0x88 \ // r5 = {h14 g14 f14 e14 h10 g10 f10 e10 h6 g6 f6 e6 h2 g2 f2 e2} - vshufps _r4, _r4, _r6, 0xDD \ // r4 = {h15 g15 f15 e15 h11 g11 f11 e11 h7 g7 f7 e7 h3 g3 f3 e3} - vshufps _r2, _r2, _t1, 0x88 \ // r2 = {h12 g12 f12 e12 h8 g8 f8 e8 h4 g4 f4 e4 h0 g0 f0 e0} - \ - \ // use r6 in place of t0 - vshufps _r6, _r8, _r9, 0x44 \ // r6 = {j13 j12 i13 i12 j9 j8 i9 i8 j5 j4 i5 i4 j1 j0 i1 i0} - vshufps _r8, _r8, _r9, 0xEE \ // r8 = {j15 j14 i15 i14 j11 j10 i11 i10 j7 j6 i7 i6 j3 j2 i3 i2} - vshufps _t1, _r10, _r11, 0x44 \ // t1 = {l13 l12 k13 k12 l9 l8 k9 k8 l5 l4 k5 k4 l1 l0 k1 k0} - vshufps _r10, _r10, _r11, 0xEE \ // r10 = {l15 l14 k15 k14 l11 l10 k11 k10 l7 l6 k7 k6 l3 l2 k3 k2} - \ - vshufps _r11, _r6, _t1, 0xDD \ // r11 = {l13 k13 j13 113 l9 k9 j9 i9 l5 k5 j5 i5 l1 k1 j1 i1} - vshufps _r9, _r8, _r10, 0x88 \ // r9 = {l14 k14 j14 114 l10 k10 j10 i10 l6 k6 j6 i6 l2 k2 j2 i2} - vshufps _r8, _r8, _r10, 0xDD \ // r8 = {l15 k15 j15 115 l11 k11 j11 i11 l7 k7 j7 i7 l3 k3 j3 i3} - vshufps _r6, _r6, _t1, 0x88 \ // r6 = {l12 k12 j12 112 l8 k8 j8 i8 l4 k4 j4 i4 l0 k0 j0 i0} - \ - \ // use r10 in place of t0 - vshufps _r10, _r12, _r13, 0x44 \ // r10 = {n13 n12 m13 m12 n9 n8 m9 m8 n5 n4 m5 m4 n1 n0 a1 m0} - vshufps _r12, _r12, _r13, 0xEE \ // r12 = {n15 n14 m15 m14 n11 n10 m11 m10 n7 n6 m7 m6 n3 n2 a3 m2} - vshufps _t1, _r14, _r15, 0x44 \ // t1 = {p13 p12 013 012 p9 p8 09 08 p5 p4 05 04 p1 p0 01 00} - vshufps _r14, _r14, _r15, 0xEE \ // r14 = {p15 p14 015 014 p11 p10 011 010 p7 p6 07 06 p3 p2 03 02} - \ - vshufps _r15, _r10, _t1, 0xDD \ // r15 = {p13 013 n13 m13 p9 09 n9 m9 p5 05 n5 m5 p1 01 n1 m1} - vshufps _r13, _r12, _r14, 0x88 \ // r13 = {p14 014 n14 m14 p10 010 n10 m10 p6 06 n6 m6 p2 02 n2 m2} - vshufps _r12, _r12, _r14, 0xDD \ // r12 = {p15 015 n15 m15 p11 011 n11 m11 p7 07 n7 m7 p3 03 n3 m3} - vshufps _r10, _r10, _t1, 0x88 \ // r10 = {p12 012 n12 m12 p8 08 n8 m8 p4 04 n4 m4 p0 00 n0 m0} - \ - \ // At this point, the registers that contain interesting data are: - \ // t0, r3, r1, r0, r2, r7, r5, r4, r6, r11, r9, r8, r10, r15, r13, r12 - \ // Can use t1 and r14 as scratch registers - LEAQ PSHUFFLE_TRANSPOSE16_MASK1<>(SB), BX \ - LEAQ PSHUFFLE_TRANSPOSE16_MASK2<>(SB), R8 \ - \ - vmovdqu32 _r14, [rbx] \ - vpermi2q _r14, _t0, _r2 \ // r14 = {h8 g8 f8 e8 d8 c8 b8 a8 h0 g0 f0 e0 d0 c0 b0 a0} - vmovdqu32 _t1, [r8] \ - vpermi2q _t1, _t0, _r2 \ // t1 = {h12 g12 f12 e12 d12 c12 b12 a12 h4 g4 f4 e4 d4 c4 b4 a4} - \ - vmovdqu32 _r2, [rbx] \ - vpermi2q _r2, _r3, _r7 \ // r2 = {h9 g9 f9 e9 d9 c9 b9 a9 h1 g1 f1 e1 d1 c1 b1 a1} - vmovdqu32 _t0, [r8] \ - vpermi2q _t0, _r3, _r7 \ // t0 = {h13 g13 f13 e13 d13 c13 b13 a13 h5 g5 f5 e5 d5 c5 b5 a5} - \ - vmovdqu32 _r3, [rbx] \ - vpermi2q _r3, _r1, _r5 \ // r3 = {h10 g10 f10 e10 d10 c10 b10 a10 h2 g2 f2 e2 d2 c2 b2 a2} - vmovdqu32 _r7, [r8] \ - vpermi2q _r7, _r1, _r5 \ // r7 = {h14 g14 f14 e14 d14 c14 b14 a14 h6 g6 f6 e6 d6 c6 b6 a6} - \ - vmovdqu32 _r1, [rbx] \ - vpermi2q _r1, _r0, _r4 \ // r1 = {h11 g11 f11 e11 d11 c11 b11 a11 h3 g3 f3 e3 d3 c3 b3 a3} - vmovdqu32 _r5, [r8] \ - vpermi2q _r5, _r0, _r4 \ // r5 = {h15 g15 f15 e15 d15 c15 b15 a15 h7 g7 f7 e7 d7 c7 b7 a7} - \ - vmovdqu32 _r0, [rbx] \ - vpermi2q _r0, _r6, _r10 \ // r0 = {p8 o8 n8 m8 l8 k8 j8 i8 p0 o0 n0 m0 l0 k0 j0 i0} - vmovdqu32 _r4, [r8] \ - vpermi2q _r4, _r6, _r10 \ // r4 = {p12 o12 n12 m12 l12 k12 j12 i12 p4 o4 n4 m4 l4 k4 j4 i4} - \ - vmovdqu32 _r6, [rbx] \ - vpermi2q _r6, _r11, _r15 \ // r6 = {p9 o9 n9 m9 l9 k9 j9 i9 p1 o1 n1 m1 l1 k1 j1 i1} - vmovdqu32 _r10, [r8] \ - vpermi2q _r10, _r11, _r15 \ // r10 = {p13 o13 n13 m13 l13 k13 j13 i13 p5 o5 n5 m5 l5 k5 j5 i5} - \ - vmovdqu32 _r11, [rbx] \ - vpermi2q _r11, _r9, _r13 \ // r11 = {p10 o10 n10 m10 l10 k10 j10 i10 p2 o2 n2 m2 l2 k2 j2 i2} - vmovdqu32 _r15, [r8] \ - vpermi2q _r15, _r9, _r13 \ // r15 = {p14 o14 n14 m14 l14 k14 j14 i14 p6 o6 n6 m6 l6 k6 j6 i6} - \ - vmovdqu32 _r9, [rbx] \ - vpermi2q _r9, _r8, _r12 \ // r9 = {p11 o11 n11 m11 l11 k11 j11 i11 p3 o3 n3 m3 l3 k3 j3 i3} - vmovdqu32 _r13, [r8] \ - vpermi2q _r13, _r8, _r12 \ // r13 = {p15 o15 n15 m15 l15 k15 j15 i15 p7 o7 n7 m7 l7 k7 j7 i7} - \ - \ // At this point r8 and r12 can be used as scratch registers - vshuff64x2 _r8, _r14, _r0, 0xEE \ // r8 = {p8 o8 n8 m8 l8 k8 j8 i8 h8 g8 f8 e8 d8 c8 b8 a8} - vshuff64x2 _r0, _r14, _r0, 0x44 \ // r0 = {p0 o0 n0 m0 l0 k0 j0 i0 h0 g0 f0 e0 d0 c0 b0 a0} - \ - vshuff64x2 _r12, _t1, _r4, 0xEE \ // r12 = {p12 o12 n12 m12 l12 k12 j12 i12 h12 g12 f12 e12 d12 c12 b12 a12} - vshuff64x2 _r4, _t1, _r4, 0x44 \ // r4 = {p4 o4 n4 m4 l4 k4 j4 i4 h4 g4 f4 e4 d4 c4 b4 a4} - \ - vshuff64x2 _r14, _r7, _r15, 0xEE \ // r14 = {p14 o14 n14 m14 l14 k14 j14 i14 h14 g14 f14 e14 d14 c14 b14 a14} - vshuff64x2 _t1, _r7, _r15, 0x44 \ // t1 = {p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6} - \ - vshuff64x2 _r15, _r5, _r13, 0xEE \ // r15 = {p15 o15 n15 m15 l15 k15 j15 i15 h15 g15 f15 e15 d15 c15 b15 a15} - vshuff64x2 _r7, _r5, _r13, 0x44 \ // r7 = {p7 o7 n7 m7 l7 k7 j7 i7 h7 g7 f7 e7 d7 c7 b7 a7} - \ - vshuff64x2 _r13, _t0, _r10, 0xEE \ // r13 = {p13 o13 n13 m13 l13 k13 j13 i13 h13 g13 f13 e13 d13 c13 b13 a13} - vshuff64x2 _r5, _t0, _r10, 0x44 \ // r5 = {p5 o5 n5 m5 l5 k5 j5 i5 h5 g5 f5 e5 d5 c5 b5 a5} - \ - vshuff64x2 _r10, _r3, _r11, 0xEE \ // r10 = {p10 o10 n10 m10 l10 k10 j10 i10 h10 g10 f10 e10 d10 c10 b10 a10} - vshuff64x2 _t0, _r3, _r11, 0x44 \ // t0 = {p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2} - \ - vshuff64x2 _r11, _r1, _r9, 0xEE \ // r11 = {p11 o11 n11 m11 l11 k11 j11 i11 h11 g11 f11 e11 d11 c11 b11 a11} - vshuff64x2 _r3, _r1, _r9, 0x44 \ // r3 = {p3 o3 n3 m3 l3 k3 j3 i3 h3 g3 f3 e3 d3 c3 b3 a3} - \ - vshuff64x2 _r9, _r2, _r6, 0xEE \ // r9 = {p9 o9 n9 m9 l9 k9 j9 i9 h9 g9 f9 e9 d9 c9 b9 a9} - vshuff64x2 _r1, _r2, _r6, 0x44 \ // r1 = {p1 o1 n1 m1 l1 k1 j1 i1 h1 g1 f1 e1 d1 c1 b1 a1} - \ - vmovdqu32 _r2, _t0 \ // r2 = {p2 o2 n2 m2 l2 k2 j2 i2 h2 g2 f2 e2 d2 c2 b2 a2} - vmovdqu32 _r6, _t1 \ // r6 = {p6 o6 n6 m6 l6 k6 j6 i6 h6 g6 f6 e6 d6 c6 b6 a6} - - -// CH(A, B, C) = (A&B) ^ (~A&C) -// MAJ(E, F, G) = (E&F) ^ (E&G) ^ (F&G) -// SIGMA0 = ROR_2 ^ ROR_13 ^ ROR_22 -// SIGMA1 = ROR_6 ^ ROR_11 ^ ROR_25 -// sigma0 = ROR_7 ^ ROR_18 ^ SHR_3 -// sigma1 = ROR_17 ^ ROR_19 ^ SHR_10 - -// Main processing loop per round -#define PROCESS_LOOP(_WT, _ROUND, _A, _B, _C, _D, _E, _F, _G, _H) \ - \ // T1 = H + SIGMA1(E) + CH(E, F, G) + Kt + Wt - \ // T2 = SIGMA0(A) + MAJ(A, B, C) - \ // H=G, G=F, F=E, E=D+T1, D=C, C=B, B=A, A=T1+T2 - \ - \ // H becomes T2, then add T1 for A - \ // D becomes D + T1 for E - \ - vpaddd T1, _H, TMP3 \ // T1 = H + Kt - vmovdqu32 TMP0, _E \ - vprord TMP1, _E, 6 \ // ROR_6(E) - vprord TMP2, _E, 11 \ // ROR_11(E) - vprord TMP3, _E, 25 \ // ROR_25(E) - vpternlogd TMP0, _F, _G, 0xCA \ // TMP0 = CH(E,F,G) - vpaddd T1, T1, _WT \ // T1 = T1 + Wt - vpternlogd TMP1, TMP2, TMP3, 0x96 \ // TMP1 = SIGMA1(E) - vpaddd T1, T1, TMP0 \ // T1 = T1 + CH(E,F,G) - vpaddd T1, T1, TMP1 \ // T1 = T1 + SIGMA1(E) - vpaddd _D, _D, T1 \ // D = D + T1 - \ - vprord _H, _A, 2 \ // ROR_2(A) - vprord TMP2, _A, 13 \ // ROR_13(A) - vprord TMP3, _A, 22 \ // ROR_22(A) - vmovdqu32 TMP0, _A \ - vpternlogd TMP0, _B, _C, 0xE8 \ // TMP0 = MAJ(A,B,C) - vpternlogd _H, TMP2, TMP3, 0x96 \ // H(T2) = SIGMA0(A) - vpaddd _H, _H, TMP0 \ // H(T2) = SIGMA0(A) + MAJ(A,B,C) - vpaddd _H, _H, T1 \ // H(A) = H(T2) + T1 - \ - vmovdqu32 TMP3, [TBL + ((_ROUND+1)*64)] \ // Next Kt - - -#define MSG_SCHED_ROUND_16_63(_WT, _WTp1, _WTp9, _WTp14) \ - vprord TMP4, _WTp14, 17 \ // ROR_17(Wt-2) - vprord TMP5, _WTp14, 19 \ // ROR_19(Wt-2) - vpsrld TMP6, _WTp14, 10 \ // SHR_10(Wt-2) - vpternlogd TMP4, TMP5, TMP6, 0x96 \ // TMP4 = sigma1(Wt-2) - \ - vpaddd _WT, _WT, TMP4 \ // Wt = Wt-16 + sigma1(Wt-2) - vpaddd _WT, _WT, _WTp9 \ // Wt = Wt-16 + sigma1(Wt-2) + Wt-7 - \ - vprord TMP4, _WTp1, 7 \ // ROR_7(Wt-15) - vprord TMP5, _WTp1, 18 \ // ROR_18(Wt-15) - vpsrld TMP6, _WTp1, 3 \ // SHR_3(Wt-15) - vpternlogd TMP4, TMP5, TMP6, 0x96 \ // TMP4 = sigma0(Wt-15) - \ - vpaddd _WT, _WT, TMP4 \ // Wt = Wt-16 + sigma1(Wt-2) + - \ // Wt-7 + sigma0(Wt-15) + - - -// Note this is reading in a block of data for one lane -// When all 16 are read, the data must be transposed to build msg schedule -#define MSG_SCHED_ROUND_00_15(_WT, OFFSET, LABEL) \ - TESTQ $(1<(SB), TBL_P9 - vmovdqu32 TMP2, [TBL] - - // Get first K from table - MOVQ table+16(FP), TBL_P9 - vmovdqu32 TMP3, [TBL] - - // Save digests for later addition - vmovdqu32 [SCRATCH + 64*0], A - vmovdqu32 [SCRATCH + 64*1], B - vmovdqu32 [SCRATCH + 64*2], C - vmovdqu32 [SCRATCH + 64*3], D - vmovdqu32 [SCRATCH + 64*4], E - vmovdqu32 [SCRATCH + 64*5], F - vmovdqu32 [SCRATCH + 64*6], G - vmovdqu32 [SCRATCH + 64*7], H - - add IDX, 64 - - // Transpose input data - TRANSPOSE16(W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15, TMP0, TMP1) - - vpshufb W0, W0, TMP2 - vpshufb W1, W1, TMP2 - vpshufb W2, W2, TMP2 - vpshufb W3, W3, TMP2 - vpshufb W4, W4, TMP2 - vpshufb W5, W5, TMP2 - vpshufb W6, W6, TMP2 - vpshufb W7, W7, TMP2 - vpshufb W8, W8, TMP2 - vpshufb W9, W9, TMP2 - vpshufb W10, W10, TMP2 - vpshufb W11, W11, TMP2 - vpshufb W12, W12, TMP2 - vpshufb W13, W13, TMP2 - vpshufb W14, W14, TMP2 - vpshufb W15, W15, TMP2 - - // MSG Schedule for W0-W15 is now complete in registers - // Process first 48 rounds - // Calculate next Wt+16 after processing is complete and Wt is unneeded - - PROCESS_LOOP( W0, 0, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W0, W1, W9, W14) - PROCESS_LOOP( W1, 1, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W1, W2, W10, W15) - PROCESS_LOOP( W2, 2, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63( W2, W3, W11, W0) - PROCESS_LOOP( W3, 3, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63( W3, W4, W12, W1) - PROCESS_LOOP( W4, 4, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63( W4, W5, W13, W2) - PROCESS_LOOP( W5, 5, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63( W5, W6, W14, W3) - PROCESS_LOOP( W6, 6, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63( W6, W7, W15, W4) - PROCESS_LOOP( W7, 7, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63( W7, W8, W0, W5) - PROCESS_LOOP( W8, 8, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W8, W9, W1, W6) - PROCESS_LOOP( W9, 9, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W9, W10, W2, W7) - PROCESS_LOOP(W10, 10, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63(W10, W11, W3, W8) - PROCESS_LOOP(W11, 11, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63(W11, W12, W4, W9) - PROCESS_LOOP(W12, 12, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63(W12, W13, W5, W10) - PROCESS_LOOP(W13, 13, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63(W13, W14, W6, W11) - PROCESS_LOOP(W14, 14, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63(W14, W15, W7, W12) - PROCESS_LOOP(W15, 15, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63(W15, W0, W8, W13) - PROCESS_LOOP( W0, 16, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W0, W1, W9, W14) - PROCESS_LOOP( W1, 17, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W1, W2, W10, W15) - PROCESS_LOOP( W2, 18, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63( W2, W3, W11, W0) - PROCESS_LOOP( W3, 19, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63( W3, W4, W12, W1) - PROCESS_LOOP( W4, 20, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63( W4, W5, W13, W2) - PROCESS_LOOP( W5, 21, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63( W5, W6, W14, W3) - PROCESS_LOOP( W6, 22, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63( W6, W7, W15, W4) - PROCESS_LOOP( W7, 23, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63( W7, W8, W0, W5) - PROCESS_LOOP( W8, 24, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W8, W9, W1, W6) - PROCESS_LOOP( W9, 25, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W9, W10, W2, W7) - PROCESS_LOOP(W10, 26, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63(W10, W11, W3, W8) - PROCESS_LOOP(W11, 27, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63(W11, W12, W4, W9) - PROCESS_LOOP(W12, 28, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63(W12, W13, W5, W10) - PROCESS_LOOP(W13, 29, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63(W13, W14, W6, W11) - PROCESS_LOOP(W14, 30, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63(W14, W15, W7, W12) - PROCESS_LOOP(W15, 31, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63(W15, W0, W8, W13) - PROCESS_LOOP( W0, 32, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W0, W1, W9, W14) - PROCESS_LOOP( W1, 33, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W1, W2, W10, W15) - PROCESS_LOOP( W2, 34, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63( W2, W3, W11, W0) - PROCESS_LOOP( W3, 35, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63( W3, W4, W12, W1) - PROCESS_LOOP( W4, 36, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63( W4, W5, W13, W2) - PROCESS_LOOP( W5, 37, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63( W5, W6, W14, W3) - PROCESS_LOOP( W6, 38, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63( W6, W7, W15, W4) - PROCESS_LOOP( W7, 39, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63( W7, W8, W0, W5) - PROCESS_LOOP( W8, 40, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_16_63( W8, W9, W1, W6) - PROCESS_LOOP( W9, 41, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_16_63( W9, W10, W2, W7) - PROCESS_LOOP(W10, 42, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_16_63(W10, W11, W3, W8) - PROCESS_LOOP(W11, 43, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_16_63(W11, W12, W4, W9) - PROCESS_LOOP(W12, 44, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_16_63(W12, W13, W5, W10) - PROCESS_LOOP(W13, 45, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_16_63(W13, W14, W6, W11) - PROCESS_LOOP(W14, 46, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_16_63(W14, W15, W7, W12) - PROCESS_LOOP(W15, 47, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_16_63(W15, W0, W8, W13) - - // Check if this is the last block - sub INP_SIZE, 1 - JE lastLoop - - // Load next mask for inputs - ADDQ $8, MASKP_P9 - MOVQ (MASKP_P9), MASK_P9 - - // Process last 16 rounds - // Read in next block msg data for use in first 16 words of msg sched - - PROCESS_LOOP( W0, 48, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_00_15( W0, 0, skipNext0) - PROCESS_LOOP( W1, 49, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_00_15( W1, 1, skipNext1) - PROCESS_LOOP( W2, 50, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_00_15( W2, 2, skipNext2) - PROCESS_LOOP( W3, 51, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_00_15( W3, 3, skipNext3) - PROCESS_LOOP( W4, 52, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_00_15( W4, 4, skipNext4) - PROCESS_LOOP( W5, 53, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_00_15( W5, 5, skipNext5) - PROCESS_LOOP( W6, 54, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_00_15( W6, 6, skipNext6) - PROCESS_LOOP( W7, 55, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_00_15( W7, 7, skipNext7) - PROCESS_LOOP( W8, 56, A, B, C, D, E, F, G, H) - MSG_SCHED_ROUND_00_15( W8, 8, skipNext8) - PROCESS_LOOP( W9, 57, H, A, B, C, D, E, F, G) - MSG_SCHED_ROUND_00_15( W9, 9, skipNext9) - PROCESS_LOOP(W10, 58, G, H, A, B, C, D, E, F) - MSG_SCHED_ROUND_00_15(W10, 10, skipNext10) - PROCESS_LOOP(W11, 59, F, G, H, A, B, C, D, E) - MSG_SCHED_ROUND_00_15(W11, 11, skipNext11) - PROCESS_LOOP(W12, 60, E, F, G, H, A, B, C, D) - MSG_SCHED_ROUND_00_15(W12, 12, skipNext12) - PROCESS_LOOP(W13, 61, D, E, F, G, H, A, B, C) - MSG_SCHED_ROUND_00_15(W13, 13, skipNext13) - PROCESS_LOOP(W14, 62, C, D, E, F, G, H, A, B) - MSG_SCHED_ROUND_00_15(W14, 14, skipNext14) - PROCESS_LOOP(W15, 63, B, C, D, E, F, G, H, A) - MSG_SCHED_ROUND_00_15(W15, 15, skipNext15) - - // Add old digest - vmovdqu32 TMP2, A - vmovdqu32 A, [SCRATCH + 64*0] - vpaddd A{k1}, A, TMP2 - vmovdqu32 TMP2, B - vmovdqu32 B, [SCRATCH + 64*1] - vpaddd B{k1}, B, TMP2 - vmovdqu32 TMP2, C - vmovdqu32 C, [SCRATCH + 64*2] - vpaddd C{k1}, C, TMP2 - vmovdqu32 TMP2, D - vmovdqu32 D, [SCRATCH + 64*3] - vpaddd D{k1}, D, TMP2 - vmovdqu32 TMP2, E - vmovdqu32 E, [SCRATCH + 64*4] - vpaddd E{k1}, E, TMP2 - vmovdqu32 TMP2, F - vmovdqu32 F, [SCRATCH + 64*5] - vpaddd F{k1}, F, TMP2 - vmovdqu32 TMP2, G - vmovdqu32 G, [SCRATCH + 64*6] - vpaddd G{k1}, G, TMP2 - vmovdqu32 TMP2, H - vmovdqu32 H, [SCRATCH + 64*7] - vpaddd H{k1}, H, TMP2 - - kmovq k1, mask - JMP lloop - -lastLoop: - // Process last 16 rounds - PROCESS_LOOP( W0, 48, A, B, C, D, E, F, G, H) - PROCESS_LOOP( W1, 49, H, A, B, C, D, E, F, G) - PROCESS_LOOP( W2, 50, G, H, A, B, C, D, E, F) - PROCESS_LOOP( W3, 51, F, G, H, A, B, C, D, E) - PROCESS_LOOP( W4, 52, E, F, G, H, A, B, C, D) - PROCESS_LOOP( W5, 53, D, E, F, G, H, A, B, C) - PROCESS_LOOP( W6, 54, C, D, E, F, G, H, A, B) - PROCESS_LOOP( W7, 55, B, C, D, E, F, G, H, A) - PROCESS_LOOP( W8, 56, A, B, C, D, E, F, G, H) - PROCESS_LOOP( W9, 57, H, A, B, C, D, E, F, G) - PROCESS_LOOP(W10, 58, G, H, A, B, C, D, E, F) - PROCESS_LOOP(W11, 59, F, G, H, A, B, C, D, E) - PROCESS_LOOP(W12, 60, E, F, G, H, A, B, C, D) - PROCESS_LOOP(W13, 61, D, E, F, G, H, A, B, C) - PROCESS_LOOP(W14, 62, C, D, E, F, G, H, A, B) - PROCESS_LOOP(W15, 63, B, C, D, E, F, G, H, A) - - // Add old digest - vmovdqu32 TMP2, A - vmovdqu32 A, [SCRATCH + 64*0] - vpaddd A{k1}, A, TMP2 - vmovdqu32 TMP2, B - vmovdqu32 B, [SCRATCH + 64*1] - vpaddd B{k1}, B, TMP2 - vmovdqu32 TMP2, C - vmovdqu32 C, [SCRATCH + 64*2] - vpaddd C{k1}, C, TMP2 - vmovdqu32 TMP2, D - vmovdqu32 D, [SCRATCH + 64*3] - vpaddd D{k1}, D, TMP2 - vmovdqu32 TMP2, E - vmovdqu32 E, [SCRATCH + 64*4] - vpaddd E{k1}, E, TMP2 - vmovdqu32 TMP2, F - vmovdqu32 F, [SCRATCH + 64*5] - vpaddd F{k1}, F, TMP2 - vmovdqu32 TMP2, G - vmovdqu32 G, [SCRATCH + 64*6] - vpaddd G{k1}, G, TMP2 - vmovdqu32 TMP2, H - vmovdqu32 H, [SCRATCH + 64*7] - vpaddd H{k1}, H, TMP2 - - // Write out digest - vmovdqu32 [STATE + 0*SHA256_DIGEST_ROW_SIZE], A - vmovdqu32 [STATE + 1*SHA256_DIGEST_ROW_SIZE], B - vmovdqu32 [STATE + 2*SHA256_DIGEST_ROW_SIZE], C - vmovdqu32 [STATE + 3*SHA256_DIGEST_ROW_SIZE], D - vmovdqu32 [STATE + 4*SHA256_DIGEST_ROW_SIZE], E - vmovdqu32 [STATE + 5*SHA256_DIGEST_ROW_SIZE], F - vmovdqu32 [STATE + 6*SHA256_DIGEST_ROW_SIZE], G - vmovdqu32 [STATE + 7*SHA256_DIGEST_ROW_SIZE], H - - VZEROUPPER - RET - -// -// Tables -// - -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x000(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x008(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x010(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x018(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x020(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x028(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x030(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x038(SB)/8, $0x0c0d0e0f08090a0b -GLOBL PSHUFFLE_BYTE_FLIP_MASK<>(SB), 8, $64 - -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x000(SB)/8, $0x0000000000000000 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x008(SB)/8, $0x0000000000000001 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x010(SB)/8, $0x0000000000000008 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x018(SB)/8, $0x0000000000000009 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x020(SB)/8, $0x0000000000000004 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x028(SB)/8, $0x0000000000000005 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x030(SB)/8, $0x000000000000000C -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x038(SB)/8, $0x000000000000000D -GLOBL PSHUFFLE_TRANSPOSE16_MASK1<>(SB), 8, $64 - -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x000(SB)/8, $0x0000000000000002 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x008(SB)/8, $0x0000000000000003 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x010(SB)/8, $0x000000000000000A -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x018(SB)/8, $0x000000000000000B -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x020(SB)/8, $0x0000000000000006 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x028(SB)/8, $0x0000000000000007 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x030(SB)/8, $0x000000000000000E -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x038(SB)/8, $0x000000000000000F -GLOBL PSHUFFLE_TRANSPOSE16_MASK2<>(SB), 8, $64 diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go deleted file mode 100644 index e6bd455d..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go +++ /dev/null @@ -1,500 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2017 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -import ( - "encoding/binary" - "errors" - "hash" - "sort" - "sync/atomic" - "time" -) - -//go:noescape -func sha256X16Avx512(digests *[512]byte, scratch *[512]byte, table *[512]uint64, mask []uint64, inputs [16][]byte) - -// Avx512ServerUID - Do not start at 0 but next multiple of 16 so as to be able to -// differentiate with default initialiation value of 0 -const Avx512ServerUID = 16 - -var uidCounter uint64 - -// NewAvx512 - initialize sha256 Avx512 implementation. -func NewAvx512(a512srv *Avx512Server) hash.Hash { - uid := atomic.AddUint64(&uidCounter, 1) - return &Avx512Digest{uid: uid, a512srv: a512srv} -} - -// Avx512Digest - Type for computing SHA256 using Avx512 -type Avx512Digest struct { - uid uint64 - a512srv *Avx512Server - x [chunk]byte - nx int - len uint64 - final bool - result [Size]byte -} - -// Size - Return size of checksum -func (d *Avx512Digest) Size() int { return Size } - -// BlockSize - Return blocksize of checksum -func (d Avx512Digest) BlockSize() int { return BlockSize } - -// Reset - reset sha digest to its initial values -func (d *Avx512Digest) Reset() { - d.a512srv.blocksCh <- blockInput{uid: d.uid, reset: true} - d.nx = 0 - d.len = 0 - d.final = false -} - -// Write to digest -func (d *Avx512Digest) Write(p []byte) (nn int, err error) { - - if d.final { - return 0, errors.New("Avx512Digest already finalized. Reset first before writing again") - } - - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := copy(d.x[d.nx:], p) - d.nx += n - if d.nx == chunk { - d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: d.x[:]} - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: p[:n]} - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -// Sum - Return sha256 sum in bytes -func (d *Avx512Digest) Sum(in []byte) (result []byte) { - - if d.final { - return append(in, d.result[:]...) - } - - trail := make([]byte, 0, 128) - - len := d.len - // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. - var tmp [64]byte - tmp[0] = 0x80 - if len%64 < 56 { - trail = append(d.x[:d.nx], tmp[0:56-len%64]...) - } else { - trail = append(d.x[:d.nx], tmp[0:64+56-len%64]...) - } - d.nx = 0 - - // Length in bits. - len <<= 3 - for i := uint(0); i < 8; i++ { - tmp[i] = byte(len >> (56 - 8*i)) - } - trail = append(trail, tmp[0:8]...) - - sumCh := make(chan [Size]byte) - d.a512srv.blocksCh <- blockInput{uid: d.uid, msg: trail, final: true, sumCh: sumCh} - d.result = <-sumCh - d.final = true - return append(in, d.result[:]...) -} - -var table = [512]uint64{ - 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, - 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, 0x428a2f98428a2f98, - 0x7137449171374491, 0x7137449171374491, 0x7137449171374491, 0x7137449171374491, - 0x7137449171374491, 0x7137449171374491, 0x7137449171374491, 0x7137449171374491, - 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, - 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, 0xb5c0fbcfb5c0fbcf, - 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, - 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, 0xe9b5dba5e9b5dba5, - 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, - 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, 0x3956c25b3956c25b, - 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, - 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, 0x59f111f159f111f1, - 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, - 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, 0x923f82a4923f82a4, - 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, - 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, 0xab1c5ed5ab1c5ed5, - 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, - 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, 0xd807aa98d807aa98, - 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, - 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, 0x12835b0112835b01, - 0x243185be243185be, 0x243185be243185be, 0x243185be243185be, 0x243185be243185be, - 0x243185be243185be, 0x243185be243185be, 0x243185be243185be, 0x243185be243185be, - 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, - 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, 0x550c7dc3550c7dc3, - 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, - 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, 0x72be5d7472be5d74, - 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, - 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, 0x80deb1fe80deb1fe, - 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, - 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, 0x9bdc06a79bdc06a7, - 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, - 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, 0xc19bf174c19bf174, - 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, - 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, 0xe49b69c1e49b69c1, - 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, - 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, 0xefbe4786efbe4786, - 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, - 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, 0x0fc19dc60fc19dc6, - 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, - 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, 0x240ca1cc240ca1cc, - 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, - 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, 0x2de92c6f2de92c6f, - 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, - 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, 0x4a7484aa4a7484aa, - 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, - 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, 0x5cb0a9dc5cb0a9dc, - 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, - 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, 0x76f988da76f988da, - 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, - 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, 0x983e5152983e5152, - 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, - 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, 0xa831c66da831c66d, - 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, - 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, 0xb00327c8b00327c8, - 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, - 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, 0xbf597fc7bf597fc7, - 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, - 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, 0xc6e00bf3c6e00bf3, - 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, - 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, 0xd5a79147d5a79147, - 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, - 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, 0x06ca635106ca6351, - 0x1429296714292967, 0x1429296714292967, 0x1429296714292967, 0x1429296714292967, - 0x1429296714292967, 0x1429296714292967, 0x1429296714292967, 0x1429296714292967, - 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, - 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, 0x27b70a8527b70a85, - 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, - 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, 0x2e1b21382e1b2138, - 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, - 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, 0x4d2c6dfc4d2c6dfc, - 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, - 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, 0x53380d1353380d13, - 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, - 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, 0x650a7354650a7354, - 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, - 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, 0x766a0abb766a0abb, - 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, - 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, 0x81c2c92e81c2c92e, - 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, - 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, 0x92722c8592722c85, - 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, - 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, 0xa2bfe8a1a2bfe8a1, - 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, - 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, 0xa81a664ba81a664b, - 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, - 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, 0xc24b8b70c24b8b70, - 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, - 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, 0xc76c51a3c76c51a3, - 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, - 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, 0xd192e819d192e819, - 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, - 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, 0xd6990624d6990624, - 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, - 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, 0xf40e3585f40e3585, - 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, - 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, 0x106aa070106aa070, - 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, - 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, 0x19a4c11619a4c116, - 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, - 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, 0x1e376c081e376c08, - 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, - 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, 0x2748774c2748774c, - 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, - 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, 0x34b0bcb534b0bcb5, - 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, - 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, 0x391c0cb3391c0cb3, - 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, - 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, 0x4ed8aa4a4ed8aa4a, - 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, - 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, 0x5b9cca4f5b9cca4f, - 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, - 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, 0x682e6ff3682e6ff3, - 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, - 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, 0x748f82ee748f82ee, - 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, - 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, 0x78a5636f78a5636f, - 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, - 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, 0x84c8781484c87814, - 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, - 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, 0x8cc702088cc70208, - 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, - 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, 0x90befffa90befffa, - 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, - 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, 0xa4506ceba4506ceb, - 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, - 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, 0xbef9a3f7bef9a3f7, - 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2, - 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2, 0xc67178f2c67178f2} - -// Interface function to assembly ode -func blockAvx512(digests *[512]byte, input [16][]byte, mask []uint64) [16][Size]byte { - - scratch := [512]byte{} - sha256X16Avx512(digests, &scratch, &table, mask, input) - - output := [16][Size]byte{} - for i := 0; i < 16; i++ { - output[i] = getDigest(i, digests[:]) - } - - return output -} - -func getDigest(index int, state []byte) (sum [Size]byte) { - for j := 0; j < 16; j += 2 { - for i := index*4 + j*Size; i < index*4+(j+1)*Size; i += Size { - binary.BigEndian.PutUint32(sum[j*2:], binary.LittleEndian.Uint32(state[i:i+4])) - } - } - return -} - -// Message to send across input channel -type blockInput struct { - uid uint64 - msg []byte - reset bool - final bool - sumCh chan [Size]byte -} - -// Avx512Server - Type to implement 16x parallel handling of SHA256 invocations -type Avx512Server struct { - blocksCh chan blockInput // Input channel - totalIn int // Total number of inputs waiting to be processed - lanes [16]Avx512LaneInfo // Array with info per lane (out of 16) - digests map[uint64][Size]byte // Map of uids to (interim) digest results -} - -// Avx512LaneInfo - Info for each lane -type Avx512LaneInfo struct { - uid uint64 // unique identification for this SHA processing - block []byte // input block to be processed - outputCh chan [Size]byte // channel for output result -} - -// NewAvx512Server - Create new object for parallel processing handling -func NewAvx512Server() *Avx512Server { - a512srv := &Avx512Server{} - a512srv.digests = make(map[uint64][Size]byte) - a512srv.blocksCh = make(chan blockInput) - - // Start a single thread for reading from the input channel - go a512srv.Process() - return a512srv -} - -// Process - Sole handler for reading from the input channel -func (a512srv *Avx512Server) Process() { - for { - select { - case block := <-a512srv.blocksCh: - if block.reset { - a512srv.reset(block.uid) - continue - } - index := block.uid & 0xf - // fmt.Println("Adding message:", block.uid, index) - - if a512srv.lanes[index].block != nil { // If slot is already filled, process all inputs - //fmt.Println("Invoking Blocks()") - a512srv.blocks() - } - a512srv.totalIn++ - a512srv.lanes[index] = Avx512LaneInfo{uid: block.uid, block: block.msg} - if block.final { - a512srv.lanes[index].outputCh = block.sumCh - } - if a512srv.totalIn == len(a512srv.lanes) { - // fmt.Println("Invoking Blocks() while FULL: ") - a512srv.blocks() - } - - // TODO: test with larger timeout - case <-time.After(1 * time.Microsecond): - for _, lane := range a512srv.lanes { - if lane.block != nil { // check if there is any input to process - // fmt.Println("Invoking Blocks() on TIMEOUT: ") - a512srv.blocks() - break // we are done - } - } - } - } -} - -// Do a reset for this calculation -func (a512srv *Avx512Server) reset(uid uint64) { - - // Check if there is a message still waiting to be processed (and remove if so) - for i, lane := range a512srv.lanes { - if lane.uid == uid { - if lane.block != nil { - a512srv.lanes[i] = Avx512LaneInfo{} // clear message - a512srv.totalIn-- - } - } - } - - // Delete entry from hash map - delete(a512srv.digests, uid) -} - -// Invoke assembly and send results back -func (a512srv *Avx512Server) blocks() (err error) { - - inputs := [16][]byte{} - for i := range inputs { - inputs[i] = a512srv.lanes[i].block - } - - mask := expandMask(genMask(inputs)) - outputs := blockAvx512(a512srv.getDigests(), inputs, mask) - - a512srv.totalIn = 0 - for i := 0; i < len(outputs); i++ { - uid, outputCh := a512srv.lanes[i].uid, a512srv.lanes[i].outputCh - a512srv.digests[uid] = outputs[i] - a512srv.lanes[i] = Avx512LaneInfo{} - - if outputCh != nil { - // Send back result - outputCh <- outputs[i] - delete(a512srv.digests, uid) // Delete entry from hashmap - } - } - return -} - -func (a512srv *Avx512Server) Write(uid uint64, p []byte) (nn int, err error) { - a512srv.blocksCh <- blockInput{uid: uid, msg: p} - return len(p), nil -} - -// Sum - return sha256 sum in bytes for a given sum id. -func (a512srv *Avx512Server) Sum(uid uint64, p []byte) [32]byte { - sumCh := make(chan [32]byte) - a512srv.blocksCh <- blockInput{uid: uid, msg: p, final: true, sumCh: sumCh} - return <-sumCh -} - -func (a512srv *Avx512Server) getDigests() *[512]byte { - digests := [512]byte{} - for i, lane := range a512srv.lanes { - a, ok := a512srv.digests[lane.uid] - if ok { - binary.BigEndian.PutUint32(digests[(i+0*16)*4:], binary.LittleEndian.Uint32(a[0:4])) - binary.BigEndian.PutUint32(digests[(i+1*16)*4:], binary.LittleEndian.Uint32(a[4:8])) - binary.BigEndian.PutUint32(digests[(i+2*16)*4:], binary.LittleEndian.Uint32(a[8:12])) - binary.BigEndian.PutUint32(digests[(i+3*16)*4:], binary.LittleEndian.Uint32(a[12:16])) - binary.BigEndian.PutUint32(digests[(i+4*16)*4:], binary.LittleEndian.Uint32(a[16:20])) - binary.BigEndian.PutUint32(digests[(i+5*16)*4:], binary.LittleEndian.Uint32(a[20:24])) - binary.BigEndian.PutUint32(digests[(i+6*16)*4:], binary.LittleEndian.Uint32(a[24:28])) - binary.BigEndian.PutUint32(digests[(i+7*16)*4:], binary.LittleEndian.Uint32(a[28:32])) - } else { - binary.LittleEndian.PutUint32(digests[(i+0*16)*4:], init0) - binary.LittleEndian.PutUint32(digests[(i+1*16)*4:], init1) - binary.LittleEndian.PutUint32(digests[(i+2*16)*4:], init2) - binary.LittleEndian.PutUint32(digests[(i+3*16)*4:], init3) - binary.LittleEndian.PutUint32(digests[(i+4*16)*4:], init4) - binary.LittleEndian.PutUint32(digests[(i+5*16)*4:], init5) - binary.LittleEndian.PutUint32(digests[(i+6*16)*4:], init6) - binary.LittleEndian.PutUint32(digests[(i+7*16)*4:], init7) - } - } - return &digests -} - -// Helper struct for sorting blocks based on length -type lane struct { - len uint - pos uint -} - -type lanes []lane - -func (lns lanes) Len() int { return len(lns) } -func (lns lanes) Swap(i, j int) { lns[i], lns[j] = lns[j], lns[i] } -func (lns lanes) Less(i, j int) bool { return lns[i].len < lns[j].len } - -// Helper struct for -type maskRounds struct { - mask uint64 - rounds uint64 -} - -func genMask(input [16][]byte) [16]maskRounds { - - // Sort on blocks length small to large - var sorted [16]lane - for c, inpt := range input { - sorted[c] = lane{uint(len(inpt)), uint(c)} - } - sort.Sort(lanes(sorted[:])) - - // Create mask array including 'rounds' between masks - m, round, index := uint64(0xffff), uint64(0), 0 - var mr [16]maskRounds - for _, s := range sorted { - if s.len > 0 { - if uint64(s.len)>>6 > round { - mr[index] = maskRounds{m, (uint64(s.len) >> 6) - round} - index++ - } - round = uint64(s.len) >> 6 - } - m = m & ^(1 << uint(s.pos)) - } - - return mr -} - -// TODO: remove function -func expandMask(mr [16]maskRounds) []uint64 { - size := uint64(0) - for _, r := range mr { - size += r.rounds - } - result, index := make([]uint64, size), 0 - for _, r := range mr { - for j := uint64(0); j < r.rounds; j++ { - result[index] = r.mask - index++ - } - } - return result -} diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s b/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s deleted file mode 100644 index 275bcacb..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s +++ /dev/null @@ -1,267 +0,0 @@ -//+build !noasm,!appengine - -TEXT ·sha256X16Avx512(SB), 7, $0 - MOVQ digests+0(FP), DI - MOVQ scratch+8(FP), R12 - MOVQ mask_len+32(FP), SI - MOVQ mask_base+24(FP), R13 - MOVQ (R13), R14 - LONG $0x92fbc1c4; BYTE $0xce - LEAQ inputs+48(FP), AX - QUAD $0xf162076f487ef162; QUAD $0x7ef162014f6f487e; QUAD $0x487ef16202576f48; QUAD $0x6f487ef162035f6f; QUAD $0x6f6f487ef1620467; QUAD $0x06776f487ef16205; LONG $0x487ef162; WORD $0x7f6f; BYTE $0x07 - MOVQ table+16(FP), DX - WORD $0x3148; BYTE $0xc9 - TESTQ $(1<<0), R14 - JE skipInput0 - MOVQ 0*24(AX), R9 - LONG $0x487cc162; WORD $0x0410; BYTE $0x09 - -skipInput0: - TESTQ $(1<<1), R14 - JE skipInput1 - MOVQ 1*24(AX), R9 - LONG $0x487cc162; WORD $0x0c10; BYTE $0x09 - -skipInput1: - TESTQ $(1<<2), R14 - JE skipInput2 - MOVQ 2*24(AX), R9 - LONG $0x487cc162; WORD $0x1410; BYTE $0x09 - -skipInput2: - TESTQ $(1<<3), R14 - JE skipInput3 - MOVQ 3*24(AX), R9 - LONG $0x487cc162; WORD $0x1c10; BYTE $0x09 - -skipInput3: - TESTQ $(1<<4), R14 - JE skipInput4 - MOVQ 4*24(AX), R9 - LONG $0x487cc162; WORD $0x2410; BYTE $0x09 - -skipInput4: - TESTQ $(1<<5), R14 - JE skipInput5 - MOVQ 5*24(AX), R9 - LONG $0x487cc162; WORD $0x2c10; BYTE $0x09 - -skipInput5: - TESTQ $(1<<6), R14 - JE skipInput6 - MOVQ 6*24(AX), R9 - LONG $0x487cc162; WORD $0x3410; BYTE $0x09 - -skipInput6: - TESTQ $(1<<7), R14 - JE skipInput7 - MOVQ 7*24(AX), R9 - LONG $0x487cc162; WORD $0x3c10; BYTE $0x09 - -skipInput7: - TESTQ $(1<<8), R14 - JE skipInput8 - MOVQ 8*24(AX), R9 - LONG $0x487c4162; WORD $0x0410; BYTE $0x09 - -skipInput8: - TESTQ $(1<<9), R14 - JE skipInput9 - MOVQ 9*24(AX), R9 - LONG $0x487c4162; WORD $0x0c10; BYTE $0x09 - -skipInput9: - TESTQ $(1<<10), R14 - JE skipInput10 - MOVQ 10*24(AX), R9 - LONG $0x487c4162; WORD $0x1410; BYTE $0x09 - -skipInput10: - TESTQ $(1<<11), R14 - JE skipInput11 - MOVQ 11*24(AX), R9 - LONG $0x487c4162; WORD $0x1c10; BYTE $0x09 - -skipInput11: - TESTQ $(1<<12), R14 - JE skipInput12 - MOVQ 12*24(AX), R9 - LONG $0x487c4162; WORD $0x2410; BYTE $0x09 - -skipInput12: - TESTQ $(1<<13), R14 - JE skipInput13 - MOVQ 13*24(AX), R9 - LONG $0x487c4162; WORD $0x2c10; BYTE $0x09 - -skipInput13: - TESTQ $(1<<14), R14 - JE skipInput14 - MOVQ 14*24(AX), R9 - LONG $0x487c4162; WORD $0x3410; BYTE $0x09 - -skipInput14: - TESTQ $(1<<15), R14 - JE skipInput15 - MOVQ 15*24(AX), R9 - LONG $0x487c4162; WORD $0x3c10; BYTE $0x09 - -skipInput15: -lloop: - LEAQ PSHUFFLE_BYTE_FLIP_MASK<>(SB), DX - LONG $0x487e7162; WORD $0x1a6f - MOVQ table+16(FP), DX - QUAD $0xd162226f487e7162; QUAD $0x7ed16224047f487e; QUAD $0x7ed16201244c7f48; QUAD $0x7ed1620224547f48; QUAD $0x7ed16203245c7f48; QUAD $0x7ed1620424647f48; QUAD $0x7ed16205246c7f48; QUAD $0x7ed1620624747f48; QUAD $0xc1834807247c7f48; QUAD $0x44c9c6407c316240; QUAD $0x62eec1c6407ca162; QUAD $0xa16244d3c6406c31; QUAD $0x34c162eed3c6406c; QUAD $0x407ca162dddac648; QUAD $0xc6407ca16288cac6; QUAD $0xcac648345162ddc2; QUAD $0x44d5c6405ca16288; QUAD $0x62eee5c6405ca162; QUAD $0xa16244d7c6404c31; QUAD $0x6cc162eef7c6404c; QUAD $0x405ca162ddfac640; QUAD $0xc6405ca16288eec6; QUAD $0xd2c6406cc162dde6; QUAD $0x44f1c6403c816288; QUAD $0x62eec1c6403c0162; QUAD $0x016244d3c6402c11; QUAD $0x4c4162eed3c6402c; QUAD $0x403c0162dddac640; QUAD $0xc6403c016288cac6; QUAD $0xf2c6404cc162ddc2; QUAD $0x44d5c6401c016288; QUAD $0x62eee5c6401c0162; QUAD $0x016244d7c6400c11; QUAD $0x2c4162eef7c6400c; QUAD $0x401c0162ddfac640; QUAD $0xc6401c016288eec6; QUAD $0xd2c6402c4162dde6; BYTE $0x88 - LEAQ PSHUFFLE_TRANSPOSE16_MASK1<>(SB), BX - LEAQ PSHUFFLE_TRANSPOSE16_MASK2<>(SB), R8 - QUAD $0x2262336f487e6162; QUAD $0x487e5162f27648b5; QUAD $0xd27648b53262106f; QUAD $0xa262136f487ee162; QUAD $0x487e5162d77640e5; QUAD $0xcf7640e53262086f; QUAD $0xa2621b6f487ee162; QUAD $0x487ec162dd7640f5; QUAD $0xfd7640f5a262386f; QUAD $0xa2620b6f487ee162; QUAD $0x487ec162cc7640fd; QUAD $0xec7640fda262286f; QUAD $0x8262036f487ee162; QUAD $0x487ec162c27640cd; QUAD $0xe27640cd8262206f; QUAD $0x8262336f487ee162; QUAD $0x487e4162f77640a5; QUAD $0xd77640a50262106f; QUAD $0x02621b6f487e6162; QUAD $0x487e4162dd7640b5; QUAD $0xfd7640b50262386f; QUAD $0x02620b6f487e6162; QUAD $0x487e4162cc7640bd; QUAD $0xec7640bd0262286f; QUAD $0x62eec023408d2362; QUAD $0x236244c023408da3; QUAD $0xada362eee42348ad; QUAD $0x40c5036244e42348; QUAD $0x2340c51362eef723; QUAD $0xfd2340d5036244d7; QUAD $0x44fd2340d58362ee; QUAD $0x62eeea2348b50362; QUAD $0x036244ea2348b583; QUAD $0xe51362eed32340e5; QUAD $0x40f5036244cb2340; QUAD $0x2340f58362eed923; QUAD $0xce2340ed236244d9; QUAD $0x44ce2340eda362ee; QUAD $0xc162d16f487ec162; QUAD $0x407dc262f26f487e; QUAD $0xcb004075c262c300; QUAD $0xc262d300406dc262; QUAD $0x405dc262db004065; QUAD $0xeb004055c262e300; QUAD $0xc262f300404dc262; QUAD $0x403d4262fb004045; QUAD $0xcb0040354262c300; QUAD $0x4262d300402d4262; QUAD $0x401d4262db004025; QUAD $0xeb0040154262e300; QUAD $0x4262f300400d4262; QUAD $0x48455162fb004005; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d3162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6201626f487e7162; QUAD $0x916211c672481591; QUAD $0x05916213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe407dc16296ef25; QUAD $0x62c1fe407d8162c5; QUAD $0xb16207c1724815b1; QUAD $0x05b16212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe407dc16296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d3162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815916202626f48; QUAD $0x72480d916211c772; QUAD $0xd7724805916213c7; QUAD $0x96ef25480d53620a; QUAD $0x8162cdfe4075c162; QUAD $0x4815b162cafe4075; QUAD $0x72480db16207c272; QUAD $0xd2724805b16212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe4075c162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x3162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c0724815b16203; QUAD $0x6213c072480db162; QUAD $0x53620ad0724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe406d8162d5fe40; QUAD $0x07c3724815b162d3; QUAD $0x6212c372480db162; QUAD $0x536203d3724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d3162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0xb16204626f487e71; QUAD $0x0db16211c1724815; QUAD $0x4805b16213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4065c16296ef; QUAD $0xb162dcfe40658162; QUAD $0x0db16207c4724815; QUAD $0x4805b16212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4065c16296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x724815b16205626f; QUAD $0xc272480db16211c2; QUAD $0x0ad2724805b16213; QUAD $0x6296ef25480d5362; QUAD $0x5d8162e5fe405dc1; QUAD $0x724815b162e5fe40; QUAD $0xc572480db16207c5; QUAD $0x03d5724805b16212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe405dc1; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d3162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x06626f487e7162d0; QUAD $0x6211c3724815b162; QUAD $0xb16213c372480db1; QUAD $0x0d53620ad3724805; QUAD $0x4055c16296ef2548; QUAD $0xeefe40558162edfe; QUAD $0x6207c6724815b162; QUAD $0xb16212c672480db1; QUAD $0x0d536203d6724805; QUAD $0x4055c16296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d3162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x15b16207626f487e; QUAD $0x480db16211c47248; QUAD $0x724805b16213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe404dc16296; QUAD $0x15b162f7fe404d81; QUAD $0x480db16207c77248; QUAD $0x724805b16212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe404dc16296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d31; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc5724815b1620862; QUAD $0x13c572480db16211; QUAD $0x620ad5724805b162; QUAD $0xc16296ef25480d53; QUAD $0x4045a162fdfe4045; QUAD $0xc07248159162f8fe; QUAD $0x12c072480d916207; QUAD $0x6203d07248059162; QUAD $0xc16296ef25480d53; QUAD $0x48455162fdfe4045; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d1162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6209626f487e7162; QUAD $0xb16211c6724815b1; QUAD $0x05b16213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe403d416296ef25; QUAD $0x62c1fe403d2162c5; QUAD $0x916207c172481591; QUAD $0x05916212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe403d416296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d1162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815b1620a626f48; QUAD $0x72480db16211c772; QUAD $0xd7724805b16213c7; QUAD $0x96ef25480d53620a; QUAD $0x2162cdfe40354162; QUAD $0x48159162cafe4035; QUAD $0x72480d916207c272; QUAD $0xd2724805916212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe40354162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x1162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c072481591620b; QUAD $0x6213c072480d9162; QUAD $0x53620ad072480591; QUAD $0x2d416296ef25480d; QUAD $0xfe402d2162d5fe40; QUAD $0x07c37248159162d3; QUAD $0x6212c372480d9162; QUAD $0x536203d372480591; QUAD $0x2d416296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d1162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0x91620c626f487e71; QUAD $0x0d916211c1724815; QUAD $0x4805916213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4025416296ef; QUAD $0x9162dcfe40252162; QUAD $0x0d916207c4724815; QUAD $0x4805916212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4025416296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x72481591620d626f; QUAD $0xc272480d916211c2; QUAD $0x0ad2724805916213; QUAD $0x6296ef25480d5362; QUAD $0x1d2162e5fe401d41; QUAD $0x7248159162e5fe40; QUAD $0xc572480d916207c5; QUAD $0x03d5724805916212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe401d41; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d1162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x0e626f487e7162d0; QUAD $0x6211c37248159162; QUAD $0x916213c372480d91; QUAD $0x0d53620ad3724805; QUAD $0x4015416296ef2548; QUAD $0xeefe40152162edfe; QUAD $0x6207c67248159162; QUAD $0x916212c672480d91; QUAD $0x0d536203d6724805; QUAD $0x4015416296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d1162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x1591620f626f487e; QUAD $0x480d916211c47248; QUAD $0x724805916213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe400d416296; QUAD $0x159162f7fe400d21; QUAD $0x480d916207c77248; QUAD $0x724805916212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe400d416296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d11; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc572481591621062; QUAD $0x13c572480d916211; QUAD $0x620ad57248059162; QUAD $0x416296ef25480d53; QUAD $0x40050162fdfe4005; QUAD $0xc0724815b162f8fe; QUAD $0x12c072480db16207; QUAD $0x6203d0724805b162; QUAD $0x416296ef25480d53; QUAD $0x48455162fdfe4005; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d3162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6211626f487e7162; QUAD $0x916211c672481591; QUAD $0x05916213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe407dc16296ef25; QUAD $0x62c1fe407d8162c5; QUAD $0xb16207c1724815b1; QUAD $0x05b16212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe407dc16296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d3162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815916212626f48; QUAD $0x72480d916211c772; QUAD $0xd7724805916213c7; QUAD $0x96ef25480d53620a; QUAD $0x8162cdfe4075c162; QUAD $0x4815b162cafe4075; QUAD $0x72480db16207c272; QUAD $0xd2724805b16212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe4075c162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x3162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c0724815b16213; QUAD $0x6213c072480db162; QUAD $0x53620ad0724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe406d8162d5fe40; QUAD $0x07c3724815b162d3; QUAD $0x6212c372480db162; QUAD $0x536203d3724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d3162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0xb16214626f487e71; QUAD $0x0db16211c1724815; QUAD $0x4805b16213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4065c16296ef; QUAD $0xb162dcfe40658162; QUAD $0x0db16207c4724815; QUAD $0x4805b16212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4065c16296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x724815b16215626f; QUAD $0xc272480db16211c2; QUAD $0x0ad2724805b16213; QUAD $0x6296ef25480d5362; QUAD $0x5d8162e5fe405dc1; QUAD $0x724815b162e5fe40; QUAD $0xc572480db16207c5; QUAD $0x03d5724805b16212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe405dc1; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d3162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x16626f487e7162d0; QUAD $0x6211c3724815b162; QUAD $0xb16213c372480db1; QUAD $0x0d53620ad3724805; QUAD $0x4055c16296ef2548; QUAD $0xeefe40558162edfe; QUAD $0x6207c6724815b162; QUAD $0xb16212c672480db1; QUAD $0x0d536203d6724805; QUAD $0x4055c16296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d3162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x15b16217626f487e; QUAD $0x480db16211c47248; QUAD $0x724805b16213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe404dc16296; QUAD $0x15b162f7fe404d81; QUAD $0x480db16207c77248; QUAD $0x724805b16212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe404dc16296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d31; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc5724815b1621862; QUAD $0x13c572480db16211; QUAD $0x620ad5724805b162; QUAD $0xc16296ef25480d53; QUAD $0x4045a162fdfe4045; QUAD $0xc07248159162f8fe; QUAD $0x12c072480d916207; QUAD $0x6203d07248059162; QUAD $0xc16296ef25480d53; QUAD $0x48455162fdfe4045; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d1162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6219626f487e7162; QUAD $0xb16211c6724815b1; QUAD $0x05b16213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe403d416296ef25; QUAD $0x62c1fe403d2162c5; QUAD $0x916207c172481591; QUAD $0x05916212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe403d416296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d1162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815b1621a626f48; QUAD $0x72480db16211c772; QUAD $0xd7724805b16213c7; QUAD $0x96ef25480d53620a; QUAD $0x2162cdfe40354162; QUAD $0x48159162cafe4035; QUAD $0x72480d916207c272; QUAD $0xd2724805916212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe40354162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x1162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c072481591621b; QUAD $0x6213c072480d9162; QUAD $0x53620ad072480591; QUAD $0x2d416296ef25480d; QUAD $0xfe402d2162d5fe40; QUAD $0x07c37248159162d3; QUAD $0x6212c372480d9162; QUAD $0x536203d372480591; QUAD $0x2d416296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d1162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0x91621c626f487e71; QUAD $0x0d916211c1724815; QUAD $0x4805916213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4025416296ef; QUAD $0x9162dcfe40252162; QUAD $0x0d916207c4724815; QUAD $0x4805916212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4025416296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x72481591621d626f; QUAD $0xc272480d916211c2; QUAD $0x0ad2724805916213; QUAD $0x6296ef25480d5362; QUAD $0x1d2162e5fe401d41; QUAD $0x7248159162e5fe40; QUAD $0xc572480d916207c5; QUAD $0x03d5724805916212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe401d41; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d1162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x1e626f487e7162d0; QUAD $0x6211c37248159162; QUAD $0x916213c372480d91; QUAD $0x0d53620ad3724805; QUAD $0x4015416296ef2548; QUAD $0xeefe40152162edfe; QUAD $0x6207c67248159162; QUAD $0x916212c672480d91; QUAD $0x0d536203d6724805; QUAD $0x4015416296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d1162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x1591621f626f487e; QUAD $0x480d916211c47248; QUAD $0x724805916213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe400d416296; QUAD $0x159162f7fe400d21; QUAD $0x480d916207c77248; QUAD $0x724805916212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe400d416296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d11; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc572481591622062; QUAD $0x13c572480d916211; QUAD $0x620ad57248059162; QUAD $0x416296ef25480d53; QUAD $0x40050162fdfe4005; QUAD $0xc0724815b162f8fe; QUAD $0x12c072480db16207; QUAD $0x6203d0724805b162; QUAD $0x416296ef25480d53; QUAD $0x48455162fdfe4005; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d3162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6221626f487e7162; QUAD $0x916211c672481591; QUAD $0x05916213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe407dc16296ef25; QUAD $0x62c1fe407d8162c5; QUAD $0xb16207c1724815b1; QUAD $0x05b16212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe407dc16296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d3162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815916222626f48; QUAD $0x72480d916211c772; QUAD $0xd7724805916213c7; QUAD $0x96ef25480d53620a; QUAD $0x8162cdfe4075c162; QUAD $0x4815b162cafe4075; QUAD $0x72480db16207c272; QUAD $0xd2724805b16212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe4075c162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x3162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c0724815b16223; QUAD $0x6213c072480db162; QUAD $0x53620ad0724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe406d8162d5fe40; QUAD $0x07c3724815b162d3; QUAD $0x6212c372480db162; QUAD $0x536203d3724805b1; QUAD $0x6dc16296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d3162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0xb16224626f487e71; QUAD $0x0db16211c1724815; QUAD $0x4805b16213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4065c16296ef; QUAD $0xb162dcfe40658162; QUAD $0x0db16207c4724815; QUAD $0x4805b16212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4065c16296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x724815b16225626f; QUAD $0xc272480db16211c2; QUAD $0x0ad2724805b16213; QUAD $0x6296ef25480d5362; QUAD $0x5d8162e5fe405dc1; QUAD $0x724815b162e5fe40; QUAD $0xc572480db16207c5; QUAD $0x03d5724805b16212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe405dc1; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d3162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x26626f487e7162d0; QUAD $0x6211c3724815b162; QUAD $0xb16213c372480db1; QUAD $0x0d53620ad3724805; QUAD $0x4055c16296ef2548; QUAD $0xeefe40558162edfe; QUAD $0x6207c6724815b162; QUAD $0xb16212c672480db1; QUAD $0x0d536203d6724805; QUAD $0x4055c16296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d3162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x15b16227626f487e; QUAD $0x480db16211c47248; QUAD $0x724805b16213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe404dc16296; QUAD $0x15b162f7fe404d81; QUAD $0x480db16207c77248; QUAD $0x724805b16212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe404dc16296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d31; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc5724815b1622862; QUAD $0x13c572480db16211; QUAD $0x620ad5724805b162; QUAD $0xc16296ef25480d53; QUAD $0x4045a162fdfe4045; QUAD $0xc07248159162f8fe; QUAD $0x12c072480d916207; QUAD $0x6203d07248059162; QUAD $0xc16296ef25480d53; QUAD $0x48455162fdfe4045; QUAD $0xcc6f487e7162c4fe; QUAD $0x6206c472482df162; QUAD $0xf1620bc4724825f1; QUAD $0x55736219c472481d; QUAD $0x483d1162cace2548; QUAD $0xd42548255362c0fe; QUAD $0x62c1fe483d516296; QUAD $0x65d162c2fe483d51; QUAD $0x724845f162d8fe48; QUAD $0xc0724825f16202c0; QUAD $0x16c072481df1620d; QUAD $0x7362c86f487e7162; QUAD $0x25d362e8ca254875; QUAD $0x4845d16296fc2548; QUAD $0xf8fe4845d162f9fe; QUAD $0x6229626f487e7162; QUAD $0xb16211c6724815b1; QUAD $0x05b16213c672480d; QUAD $0x480d53620ad67248; QUAD $0xfe403d416296ef25; QUAD $0x62c1fe403d2162c5; QUAD $0x916207c172481591; QUAD $0x05916212c172480d; QUAD $0x480d536203d17248; QUAD $0xfe403d416296ef25; QUAD $0x62c4fe484d5162c5; QUAD $0x2df162cb6f487e71; QUAD $0x4825f16206c37248; QUAD $0x72481df1620bc372; QUAD $0xcd25485d736219c3; QUAD $0x62c1fe483d1162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xd0fe486dd162c2fe; QUAD $0x6202c772484df162; QUAD $0xf1620dc7724825f1; QUAD $0x7e716216c772481d; QUAD $0x25487d7362cf6f48; QUAD $0xf4254825d362e8c9; QUAD $0x62f1fe484dd16296; QUAD $0x7e7162f0fe484dd1; QUAD $0x4815b1622a626f48; QUAD $0x72480db16211c772; QUAD $0xd7724805b16213c7; QUAD $0x96ef25480d53620a; QUAD $0x2162cdfe40354162; QUAD $0x48159162cafe4035; QUAD $0x72480d916207c272; QUAD $0xd2724805916212c2; QUAD $0x96ef25480d536203; QUAD $0x5162cdfe40354162; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x1162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x11c072481591622b; QUAD $0x6213c072480d9162; QUAD $0x53620ad072480591; QUAD $0x2d416296ef25480d; QUAD $0xfe402d2162d5fe40; QUAD $0x07c37248159162d3; QUAD $0x6212c372480d9162; QUAD $0x536203d372480591; QUAD $0x2d416296ef25480d; QUAD $0xfe485d5162d5fe40; QUAD $0x62c96f487e7162c4; QUAD $0xf16206c172482df1; QUAD $0x1df1620bc1724825; QUAD $0x486d736219c17248; QUAD $0xfe483d1162cacb25; QUAD $0x96d42548255362c3; QUAD $0x5162c1fe483d5162; QUAD $0x487dd162c2fe483d; QUAD $0xc572485df162c0fe; QUAD $0x0dc5724825f16202; QUAD $0x6216c572481df162; QUAD $0x4d7362cd6f487e71; QUAD $0x4825d362e8cf2548; QUAD $0xfe485dd16296e425; QUAD $0x62e0fe485dd162e1; QUAD $0x91622c626f487e71; QUAD $0x0d916211c1724815; QUAD $0x4805916213c17248; QUAD $0x25480d53620ad172; QUAD $0xddfe4025416296ef; QUAD $0x9162dcfe40252162; QUAD $0x0d916207c4724815; QUAD $0x4805916212c47248; QUAD $0x25480d536203d472; QUAD $0xddfe4025416296ef; QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; QUAD $0x72481591622d626f; QUAD $0xc272480d916211c2; QUAD $0x0ad2724805916213; QUAD $0x6296ef25480d5362; QUAD $0x1d2162e5fe401d41; QUAD $0x7248159162e5fe40; QUAD $0xc572480d916207c5; QUAD $0x03d5724805916212; QUAD $0x6296ef25480d5362; QUAD $0x6d5162e5fe401d41; QUAD $0x6f487e7162c4fe48; QUAD $0x06c772482df162cf; QUAD $0x620bc7724825f162; QUAD $0x736219c772481df1; QUAD $0x3d1162cac925487d; QUAD $0x2548255362c5fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x486df162f0fe484d; QUAD $0x724825f16202c372; QUAD $0xc372481df1620dc3; QUAD $0x62cb6f487e716216; QUAD $0xd362e8cd25485d73; QUAD $0x6dd16296d4254825; QUAD $0xfe486dd162d1fe48; QUAD $0x2e626f487e7162d0; QUAD $0x6211c37248159162; QUAD $0x916213c372480d91; QUAD $0x0d53620ad3724805; QUAD $0x4015416296ef2548; QUAD $0xeefe40152162edfe; QUAD $0x6207c67248159162; QUAD $0x916212c672480d91; QUAD $0x0d536203d6724805; QUAD $0x4015416296ef2548; QUAD $0xc4fe48755162edfe; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d1162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x1591622f626f487e; QUAD $0x480d916211c47248; QUAD $0x724805916213c472; QUAD $0xef25480d53620ad4; QUAD $0x62f5fe400d416296; QUAD $0x159162f7fe400d21; QUAD $0x480d916207c77248; QUAD $0x724805916212c772; QUAD $0xef25480d536203d7; QUAD $0x62f5fe400d416296; QUAD $0x7e7162c4fe487d51; QUAD $0x72482df162cd6f48; QUAD $0xc5724825f16206c5; QUAD $0x19c572481df1620b; QUAD $0x62cacf25484d7362; QUAD $0x255362c7fe483d11; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162e0fe485dd162; QUAD $0x25f16202c172487d; QUAD $0x481df1620dc17248; QUAD $0x6f487e716216c172; QUAD $0xe8cb25486d7362c9; QUAD $0x6296c4254825d362; QUAD $0x7dd162c1fe487dd1; QUAD $0x6f487e7162c0fe48; QUAD $0xc572481591623062; QUAD $0x13c572480d916211; QUAD $0x620ad57248059162; QUAD $0x416296ef25480d53; QUAD $0x40050162fdfe4005; QUAD $0xc0724815b162f8fe; QUAD $0x12c072480db16207; QUAD $0x6203d0724805b162; QUAD $0x416296ef25480d53; QUAD $0x01ee8348fdfe4005 - JE lastLoop - ADDQ $8, R13 - MOVQ (R13), R14 - QUAD $0x7162c4fe48455162; QUAD $0x482df162cc6f487e; QUAD $0x724825f16206c472; QUAD $0xc472481df1620bc4; QUAD $0xcace254855736219; QUAD $0x5362c0fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d8fe4865d162c2; QUAD $0xf16202c0724845f1; QUAD $0x1df1620dc0724825; QUAD $0x487e716216c07248; QUAD $0xca2548757362c86f; QUAD $0x96fc254825d362e8; QUAD $0xd162f9fe4845d162; QUAD $0x487e7162f8fe4845; WORD $0x626f; BYTE $0x31 - TESTQ $(1<<0), R14 - JE skipNext0 - MOVQ 0*24(AX), R9 - LONG $0x487cc162; WORD $0x0410; BYTE $0x09 - -skipNext0: - QUAD $0x7162c4fe484d5162; QUAD $0x482df162cb6f487e; QUAD $0x724825f16206c372; QUAD $0xc372481df1620bc3; QUAD $0xcacd25485d736219; QUAD $0x5362c1fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d0fe486dd162c2; QUAD $0xf16202c772484df1; QUAD $0x1df1620dc7724825; QUAD $0x487e716216c77248; QUAD $0xc925487d7362cf6f; QUAD $0x96f4254825d362e8; QUAD $0xd162f1fe484dd162; QUAD $0x487e7162f0fe484d; WORD $0x626f; BYTE $0x32 - TESTQ $(1<<1), R14 - JE skipNext1 - MOVQ 1*24(AX), R9 - LONG $0x487cc162; WORD $0x0c10; BYTE $0x09 - -skipNext1: - QUAD $0x7162c4fe48555162; QUAD $0x482df162ca6f487e; QUAD $0x724825f16206c272; QUAD $0xc272481df1620bc2; QUAD $0xcacc254865736219; QUAD $0x5362c2fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62c8fe4875d162c2; QUAD $0xf16202c6724855f1; QUAD $0x1df1620dc6724825; QUAD $0x487e716216c67248; QUAD $0xc82548457362ce6f; QUAD $0x96ec254825d362e8; QUAD $0xd162e9fe4855d162; QUAD $0x487e7162e8fe4855; WORD $0x626f; BYTE $0x33 - TESTQ $(1<<2), R14 - JE skipNext2 - MOVQ 2*24(AX), R9 - LONG $0x487cc162; WORD $0x1410; BYTE $0x09 - -skipNext2: - QUAD $0x7162c4fe485d5162; QUAD $0x482df162c96f487e; QUAD $0x724825f16206c172; QUAD $0xc172481df1620bc1; QUAD $0xcacb25486d736219; QUAD $0x5362c3fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62c0fe487dd162c2; QUAD $0xf16202c572485df1; QUAD $0x1df1620dc5724825; QUAD $0x487e716216c57248; QUAD $0xcf25484d7362cd6f; QUAD $0x96e4254825d362e8; QUAD $0xd162e1fe485dd162; QUAD $0x487e7162e0fe485d; WORD $0x626f; BYTE $0x34 - TESTQ $(1<<3), R14 - JE skipNext3 - MOVQ 3*24(AX), R9 - LONG $0x487cc162; WORD $0x1c10; BYTE $0x09 - -skipNext3: - QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; WORD $0x626f; BYTE $0x35 - TESTQ $(1<<4), R14 - JE skipNext4 - MOVQ 4*24(AX), R9 - LONG $0x487cc162; WORD $0x2410; BYTE $0x09 - -skipNext4: - QUAD $0x7162c4fe486d5162; QUAD $0x482df162cf6f487e; QUAD $0x724825f16206c772; QUAD $0xc772481df1620bc7; QUAD $0xcac925487d736219; QUAD $0x5362c5fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f0fe484dd162c2; QUAD $0xf16202c372486df1; QUAD $0x1df1620dc3724825; QUAD $0x487e716216c37248; QUAD $0xcd25485d7362cb6f; QUAD $0x96d4254825d362e8; QUAD $0xd162d1fe486dd162; QUAD $0x487e7162d0fe486d; WORD $0x626f; BYTE $0x36 - TESTQ $(1<<5), R14 - JE skipNext5 - MOVQ 5*24(AX), R9 - LONG $0x487cc162; WORD $0x2c10; BYTE $0x09 - -skipNext5: - QUAD $0x7162c4fe48755162; QUAD $0x482df162ce6f487e; QUAD $0x724825f16206c672; QUAD $0xc672481df1620bc6; QUAD $0xcac8254845736219; QUAD $0x5362c6fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62e8fe4855d162c2; QUAD $0xf16202c2724875f1; QUAD $0x1df1620dc2724825; QUAD $0x487e716216c27248; QUAD $0xcc2548657362ca6f; QUAD $0x96cc254825d362e8; QUAD $0xd162c9fe4875d162; QUAD $0x487e7162c8fe4875; WORD $0x626f; BYTE $0x37 - TESTQ $(1<<6), R14 - JE skipNext6 - MOVQ 6*24(AX), R9 - LONG $0x487cc162; WORD $0x3410; BYTE $0x09 - -skipNext6: - QUAD $0x7162c4fe487d5162; QUAD $0x482df162cd6f487e; QUAD $0x724825f16206c572; QUAD $0xc572481df1620bc5; QUAD $0xcacf25484d736219; QUAD $0x5362c7fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62e0fe485dd162c2; QUAD $0xf16202c172487df1; QUAD $0x1df1620dc1724825; QUAD $0x487e716216c17248; QUAD $0xcb25486d7362c96f; QUAD $0x96c4254825d362e8; QUAD $0xd162c1fe487dd162; QUAD $0x487e7162c0fe487d; WORD $0x626f; BYTE $0x38 - TESTQ $(1<<7), R14 - JE skipNext7 - MOVQ 7*24(AX), R9 - LONG $0x487cc162; WORD $0x3c10; BYTE $0x09 - -skipNext7: - QUAD $0x7162c4fe48455162; QUAD $0x482df162cc6f487e; QUAD $0x724825f16206c472; QUAD $0xc472481df1620bc4; QUAD $0xcace254855736219; QUAD $0x5362c0fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d8fe4865d162c2; QUAD $0xf16202c0724845f1; QUAD $0x1df1620dc0724825; QUAD $0x487e716216c07248; QUAD $0xca2548757362c86f; QUAD $0x96fc254825d362e8; QUAD $0xd162f9fe4845d162; QUAD $0x487e7162f8fe4845; WORD $0x626f; BYTE $0x39 - TESTQ $(1<<8), R14 - JE skipNext8 - MOVQ 8*24(AX), R9 - LONG $0x487c4162; WORD $0x0410; BYTE $0x09 - -skipNext8: - QUAD $0x7162c4fe484d5162; QUAD $0x482df162cb6f487e; QUAD $0x724825f16206c372; QUAD $0xc372481df1620bc3; QUAD $0xcacd25485d736219; QUAD $0x5362c1fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d0fe486dd162c2; QUAD $0xf16202c772484df1; QUAD $0x1df1620dc7724825; QUAD $0x487e716216c77248; QUAD $0xc925487d7362cf6f; QUAD $0x96f4254825d362e8; QUAD $0xd162f1fe484dd162; QUAD $0x487e7162f0fe484d; WORD $0x626f; BYTE $0x3a - TESTQ $(1<<9), R14 - JE skipNext9 - MOVQ 9*24(AX), R9 - LONG $0x487c4162; WORD $0x0c10; BYTE $0x09 - -skipNext9: - QUAD $0x7162c4fe48555162; QUAD $0x482df162ca6f487e; QUAD $0x724825f16206c272; QUAD $0xc272481df1620bc2; QUAD $0xcacc254865736219; QUAD $0x5362c2fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62c8fe4875d162c2; QUAD $0xf16202c6724855f1; QUAD $0x1df1620dc6724825; QUAD $0x487e716216c67248; QUAD $0xc82548457362ce6f; QUAD $0x96ec254825d362e8; QUAD $0xd162e9fe4855d162; QUAD $0x487e7162e8fe4855; WORD $0x626f; BYTE $0x3b - TESTQ $(1<<10), R14 - JE skipNext10 - MOVQ 10*24(AX), R9 - LONG $0x487c4162; WORD $0x1410; BYTE $0x09 - -skipNext10: - QUAD $0x7162c4fe485d5162; QUAD $0x482df162c96f487e; QUAD $0x724825f16206c172; QUAD $0xc172481df1620bc1; QUAD $0xcacb25486d736219; QUAD $0x5362c3fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62c0fe487dd162c2; QUAD $0xf16202c572485df1; QUAD $0x1df1620dc5724825; QUAD $0x487e716216c57248; QUAD $0xcf25484d7362cd6f; QUAD $0x96e4254825d362e8; QUAD $0xd162e1fe485dd162; QUAD $0x487e7162e0fe485d; WORD $0x626f; BYTE $0x3c - TESTQ $(1<<11), R14 - JE skipNext11 - MOVQ 11*24(AX), R9 - LONG $0x487c4162; WORD $0x1c10; BYTE $0x09 - -skipNext11: - QUAD $0x7162c4fe48655162; QUAD $0x482df162c86f487e; QUAD $0x724825f16206c072; QUAD $0xc072481df1620bc0; QUAD $0xcaca254875736219; QUAD $0x5362c4fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f8fe4845d162c2; QUAD $0xf16202c4724865f1; QUAD $0x1df1620dc4724825; QUAD $0x487e716216c47248; QUAD $0xce2548557362cc6f; QUAD $0x96dc254825d362e8; QUAD $0xd162d9fe4865d162; QUAD $0x487e7162d8fe4865; WORD $0x626f; BYTE $0x3d - TESTQ $(1<<12), R14 - JE skipNext12 - MOVQ 12*24(AX), R9 - LONG $0x487c4162; WORD $0x2410; BYTE $0x09 - -skipNext12: - QUAD $0x7162c4fe486d5162; QUAD $0x482df162cf6f487e; QUAD $0x724825f16206c772; QUAD $0xc772481df1620bc7; QUAD $0xcac925487d736219; QUAD $0x5362c5fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62f0fe484dd162c2; QUAD $0xf16202c372486df1; QUAD $0x1df1620dc3724825; QUAD $0x487e716216c37248; QUAD $0xcd25485d7362cb6f; QUAD $0x96d4254825d362e8; QUAD $0xd162d1fe486dd162; QUAD $0x487e7162d0fe486d; WORD $0x626f; BYTE $0x3e - TESTQ $(1<<13), R14 - JE skipNext13 - MOVQ 13*24(AX), R9 - LONG $0x487c4162; WORD $0x2c10; BYTE $0x09 - -skipNext13: - QUAD $0x7162c4fe48755162; QUAD $0x482df162ce6f487e; QUAD $0x724825f16206c672; QUAD $0xc672481df1620bc6; QUAD $0xcac8254845736219; QUAD $0x5362c6fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62e8fe4855d162c2; QUAD $0xf16202c2724875f1; QUAD $0x1df1620dc2724825; QUAD $0x487e716216c27248; QUAD $0xcc2548657362ca6f; QUAD $0x96cc254825d362e8; QUAD $0xd162c9fe4875d162; QUAD $0x487e7162c8fe4875; WORD $0x626f; BYTE $0x3f - TESTQ $(1<<14), R14 - JE skipNext14 - MOVQ 14*24(AX), R9 - LONG $0x487c4162; WORD $0x3410; BYTE $0x09 - -skipNext14: - QUAD $0x7162c4fe487d5162; QUAD $0x482df162cd6f487e; QUAD $0x724825f16206c572; QUAD $0xc572481df1620bc5; QUAD $0xcacf25484d736219; QUAD $0x5362c7fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62e0fe485dd162c2; QUAD $0xf16202c172487df1; QUAD $0x1df1620dc1724825; QUAD $0x487e716216c17248; QUAD $0xcb25486d7362c96f; QUAD $0x96c4254825d362e8; QUAD $0xd162c1fe487dd162; QUAD $0x487e7162c0fe487d; WORD $0x626f; BYTE $0x40 - TESTQ $(1<<15), R14 - JE skipNext15 - MOVQ 15*24(AX), R9 - LONG $0x487c4162; WORD $0x3c10; BYTE $0x09 - -skipNext15: - QUAD $0xd162d86f487e7162; QUAD $0x7dd16224046f487e; QUAD $0x6f487e7162c3fe49; QUAD $0x244c6f487ed162d9; QUAD $0x62cbfe4975d16201; QUAD $0x7ed162da6f487e71; QUAD $0x6dd1620224546f48; QUAD $0x6f487e7162d3fe49; QUAD $0x245c6f487ed162db; QUAD $0x62dbfe4965d16203; QUAD $0x7ed162dc6f487e71; QUAD $0x5dd1620424646f48; QUAD $0x6f487e7162e3fe49; QUAD $0x246c6f487ed162dd; QUAD $0x62ebfe4955d16205; QUAD $0x7ed162de6f487e71; QUAD $0x4dd1620624746f48; QUAD $0x6f487e7162f3fe49; QUAD $0x247c6f487ed162df; QUAD $0xc4fbfe4945d16207; LONG $0xce92fbc1 - JMP lloop - -lastLoop: - QUAD $0x7162c4fe48455162; QUAD $0x482df162cc6f487e; QUAD $0x724825f16206c472; QUAD $0xc472481df1620bc4; QUAD $0xcace254855736219; QUAD $0x5362c0fe483d3162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d8fe4865d162c2; QUAD $0xf16202c0724845f1; QUAD $0x1df1620dc0724825; QUAD $0x487e716216c07248; QUAD $0xca2548757362c86f; QUAD $0x96fc254825d362e8; QUAD $0xd162f9fe4845d162; QUAD $0x487e7162f8fe4845; QUAD $0xfe484d516231626f; QUAD $0x62cb6f487e7162c4; QUAD $0xf16206c372482df1; QUAD $0x1df1620bc3724825; QUAD $0x485d736219c37248; QUAD $0xfe483d3162cacd25; QUAD $0x96d42548255362c1; QUAD $0x5162c1fe483d5162; QUAD $0x486dd162c2fe483d; QUAD $0xc772484df162d0fe; QUAD $0x0dc7724825f16202; QUAD $0x6216c772481df162; QUAD $0x7d7362cf6f487e71; QUAD $0x4825d362e8c92548; QUAD $0xfe484dd16296f425; QUAD $0x62f0fe484dd162f1; QUAD $0x516232626f487e71; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x3162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x62c4fe485d516233; QUAD $0x2df162c96f487e71; QUAD $0x4825f16206c17248; QUAD $0x72481df1620bc172; QUAD $0xcb25486d736219c1; QUAD $0x62c3fe483d3162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xc0fe487dd162c2fe; QUAD $0x6202c572485df162; QUAD $0xf1620dc5724825f1; QUAD $0x7e716216c572481d; QUAD $0x25484d7362cd6f48; QUAD $0xe4254825d362e8cf; QUAD $0x62e1fe485dd16296; QUAD $0x7e7162e0fe485dd1; QUAD $0x4865516234626f48; QUAD $0xc86f487e7162c4fe; QUAD $0x6206c072482df162; QUAD $0xf1620bc0724825f1; QUAD $0x75736219c072481d; QUAD $0x483d3162caca2548; QUAD $0xd42548255362c4fe; QUAD $0x62c1fe483d516296; QUAD $0x45d162c2fe483d51; QUAD $0x724865f162f8fe48; QUAD $0xc4724825f16202c4; QUAD $0x16c472481df1620d; QUAD $0x7362cc6f487e7162; QUAD $0x25d362e8ce254855; QUAD $0x4865d16296dc2548; QUAD $0xd8fe4865d162d9fe; QUAD $0x6235626f487e7162; QUAD $0x7e7162c4fe486d51; QUAD $0x72482df162cf6f48; QUAD $0xc7724825f16206c7; QUAD $0x19c772481df1620b; QUAD $0x62cac925487d7362; QUAD $0x255362c5fe483d31; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162f0fe484dd162; QUAD $0x25f16202c372486d; QUAD $0x481df1620dc37248; QUAD $0x6f487e716216c372; QUAD $0xe8cd25485d7362cb; QUAD $0x6296d4254825d362; QUAD $0x6dd162d1fe486dd1; QUAD $0x6f487e7162d0fe48; QUAD $0xc4fe487551623662; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d3162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x7d516237626f487e; QUAD $0x6f487e7162c4fe48; QUAD $0x06c572482df162cd; QUAD $0x620bc5724825f162; QUAD $0x736219c572481df1; QUAD $0x3d3162cacf25484d; QUAD $0x2548255362c7fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x487df162e0fe485d; QUAD $0x724825f16202c172; QUAD $0xc172481df1620dc1; QUAD $0x62c96f487e716216; QUAD $0xd362e8cb25486d73; QUAD $0x7dd16296c4254825; QUAD $0xfe487dd162c1fe48; QUAD $0x38626f487e7162c0; QUAD $0x7162c4fe48455162; QUAD $0x482df162cc6f487e; QUAD $0x724825f16206c472; QUAD $0xc472481df1620bc4; QUAD $0xcace254855736219; QUAD $0x5362c0fe483d1162; QUAD $0x3d516296d4254825; QUAD $0xfe483d5162c1fe48; QUAD $0x62d8fe4865d162c2; QUAD $0xf16202c0724845f1; QUAD $0x1df1620dc0724825; QUAD $0x487e716216c07248; QUAD $0xca2548757362c86f; QUAD $0x96fc254825d362e8; QUAD $0xd162f9fe4845d162; QUAD $0x487e7162f8fe4845; QUAD $0xfe484d516239626f; QUAD $0x62cb6f487e7162c4; QUAD $0xf16206c372482df1; QUAD $0x1df1620bc3724825; QUAD $0x485d736219c37248; QUAD $0xfe483d1162cacd25; QUAD $0x96d42548255362c1; QUAD $0x5162c1fe483d5162; QUAD $0x486dd162c2fe483d; QUAD $0xc772484df162d0fe; QUAD $0x0dc7724825f16202; QUAD $0x6216c772481df162; QUAD $0x7d7362cf6f487e71; QUAD $0x4825d362e8c92548; QUAD $0xfe484dd16296f425; QUAD $0x62f0fe484dd162f1; QUAD $0x51623a626f487e71; QUAD $0x487e7162c4fe4855; QUAD $0xc272482df162ca6f; QUAD $0x0bc2724825f16206; QUAD $0x6219c272481df162; QUAD $0x1162cacc25486573; QUAD $0x48255362c2fe483d; QUAD $0xfe483d516296d425; QUAD $0x62c2fe483d5162c1; QUAD $0x55f162c8fe4875d1; QUAD $0x4825f16202c67248; QUAD $0x72481df1620dc672; QUAD $0xce6f487e716216c6; QUAD $0x62e8c82548457362; QUAD $0xd16296ec254825d3; QUAD $0x4855d162e9fe4855; QUAD $0x626f487e7162e8fe; QUAD $0x62c4fe485d51623b; QUAD $0x2df162c96f487e71; QUAD $0x4825f16206c17248; QUAD $0x72481df1620bc172; QUAD $0xcb25486d736219c1; QUAD $0x62c3fe483d1162ca; QUAD $0x516296d425482553; QUAD $0x483d5162c1fe483d; QUAD $0xc0fe487dd162c2fe; QUAD $0x6202c572485df162; QUAD $0xf1620dc5724825f1; QUAD $0x7e716216c572481d; QUAD $0x25484d7362cd6f48; QUAD $0xe4254825d362e8cf; QUAD $0x62e1fe485dd16296; QUAD $0x7e7162e0fe485dd1; QUAD $0x486551623c626f48; QUAD $0xc86f487e7162c4fe; QUAD $0x6206c072482df162; QUAD $0xf1620bc0724825f1; QUAD $0x75736219c072481d; QUAD $0x483d1162caca2548; QUAD $0xd42548255362c4fe; QUAD $0x62c1fe483d516296; QUAD $0x45d162c2fe483d51; QUAD $0x724865f162f8fe48; QUAD $0xc4724825f16202c4; QUAD $0x16c472481df1620d; QUAD $0x7362cc6f487e7162; QUAD $0x25d362e8ce254855; QUAD $0x4865d16296dc2548; QUAD $0xd8fe4865d162d9fe; QUAD $0x623d626f487e7162; QUAD $0x7e7162c4fe486d51; QUAD $0x72482df162cf6f48; QUAD $0xc7724825f16206c7; QUAD $0x19c772481df1620b; QUAD $0x62cac925487d7362; QUAD $0x255362c5fe483d11; QUAD $0x483d516296d42548; QUAD $0xc2fe483d5162c1fe; QUAD $0xf162f0fe484dd162; QUAD $0x25f16202c372486d; QUAD $0x481df1620dc37248; QUAD $0x6f487e716216c372; QUAD $0xe8cd25485d7362cb; QUAD $0x6296d4254825d362; QUAD $0x6dd162d1fe486dd1; QUAD $0x6f487e7162d0fe48; QUAD $0xc4fe487551623e62; QUAD $0xf162ce6f487e7162; QUAD $0x25f16206c672482d; QUAD $0x481df1620bc67248; QUAD $0x254845736219c672; QUAD $0xc6fe483d1162cac8; QUAD $0x6296d42548255362; QUAD $0x3d5162c1fe483d51; QUAD $0xfe4855d162c2fe48; QUAD $0x02c2724875f162e8; QUAD $0x620dc2724825f162; QUAD $0x716216c272481df1; QUAD $0x48657362ca6f487e; QUAD $0x254825d362e8cc25; QUAD $0xc9fe4875d16296cc; QUAD $0x7162c8fe4875d162; QUAD $0x7d51623f626f487e; QUAD $0x6f487e7162c4fe48; QUAD $0x06c572482df162cd; QUAD $0x620bc5724825f162; QUAD $0x736219c572481df1; QUAD $0x3d1162cacf25484d; QUAD $0x2548255362c7fe48; QUAD $0xc1fe483d516296d4; QUAD $0xd162c2fe483d5162; QUAD $0x487df162e0fe485d; QUAD $0x724825f16202c172; QUAD $0xc172481df1620dc1; QUAD $0x62c96f487e716216; QUAD $0xd362e8cb25486d73; QUAD $0x7dd16296c4254825; QUAD $0xfe487dd162c1fe48; QUAD $0x40626f487e7162c0; QUAD $0xd162d86f487e7162; QUAD $0x7dd16224046f487e; QUAD $0x6f487e7162c3fe49; QUAD $0x244c6f487ed162d9; QUAD $0x62cbfe4975d16201; QUAD $0x7ed162da6f487e71; QUAD $0x6dd1620224546f48; QUAD $0x6f487e7162d3fe49; QUAD $0x245c6f487ed162db; QUAD $0x62dbfe4965d16203; QUAD $0x7ed162dc6f487e71; QUAD $0x5dd1620424646f48; QUAD $0x6f487e7162e3fe49; QUAD $0x246c6f487ed162dd; QUAD $0x62ebfe4955d16205; QUAD $0x7ed162de6f487e71; QUAD $0x4dd1620624746f48; QUAD $0x6f487e7162f3fe49; QUAD $0x247c6f487ed162df; QUAD $0x62fbfe4945d16207; QUAD $0x7ef162077f487ef1; QUAD $0x487ef162014f7f48; QUAD $0x7f487ef16202577f; QUAD $0x677f487ef162035f; QUAD $0x056f7f487ef16204; QUAD $0x6206777f487ef162; LONG $0x7f487ef1; WORD $0x077f - VZEROUPPER - RET - -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x000(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x008(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x010(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x018(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x020(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x028(SB)/8, $0x0c0d0e0f08090a0b -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x030(SB)/8, $0x0405060700010203 -DATA PSHUFFLE_BYTE_FLIP_MASK<>+0x038(SB)/8, $0x0c0d0e0f08090a0b -GLOBL PSHUFFLE_BYTE_FLIP_MASK<>(SB), 8, $64 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x000(SB)/8, $0x0000000000000000 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x008(SB)/8, $0x0000000000000001 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x010(SB)/8, $0x0000000000000008 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x018(SB)/8, $0x0000000000000009 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x020(SB)/8, $0x0000000000000004 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x028(SB)/8, $0x0000000000000005 -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x030(SB)/8, $0x000000000000000C -DATA PSHUFFLE_TRANSPOSE16_MASK1<>+0x038(SB)/8, $0x000000000000000D -GLOBL PSHUFFLE_TRANSPOSE16_MASK1<>(SB), 8, $64 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x000(SB)/8, $0x0000000000000002 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x008(SB)/8, $0x0000000000000003 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x010(SB)/8, $0x000000000000000A -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x018(SB)/8, $0x000000000000000B -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x020(SB)/8, $0x0000000000000006 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x028(SB)/8, $0x0000000000000007 -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x030(SB)/8, $0x000000000000000E -DATA PSHUFFLE_TRANSPOSE16_MASK2<>+0x038(SB)/8, $0x000000000000000F -GLOBL PSHUFFLE_TRANSPOSE16_MASK2<>(SB), 8, $64 diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go deleted file mode 100644 index eb8a0ff0..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go +++ /dev/null @@ -1,22 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -//go:noescape -func blockAvx(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) diff --git a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.s b/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.s deleted file mode 100644 index 9f444d49..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.s +++ /dev/null @@ -1,408 +0,0 @@ -//+build !noasm,!appengine - -// SHA256 implementation for AVX - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// This code is based on an Intel White-Paper: -// "Fast SHA-256 Implementations on Intel Architecture Processors" -// -// together with the reference implementation from the following authors: -// James Guilford -// Kirk Yap -// Tim Chen -// -// For Golang it has been converted to Plan 9 assembly with the help of -// github.com/minio/asm2plan9s to assemble Intel instructions to their Plan9 -// equivalents -// - -#include "textflag.h" - -#define ROTATE_XS \ - MOVOU X4, X15 \ - MOVOU X5, X4 \ - MOVOU X6, X5 \ - MOVOU X7, X6 \ - MOVOU X15, X7 - -// compute s0 four at a time and s1 two at a time -// compute W[-16] + W[-7] 4 at a time -#define FOUR_ROUNDS_AND_SCHED(a, b, c, d, e, f, g, h) \ - MOVL e, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL a, R14 \ // y1 = a - LONG $0x0f41e3c4; WORD $0x04c6 \ // VPALIGNR XMM0,XMM7,XMM6,0x4 /* XTMP0 = W[-7] */ - ROLL $23, R14 \ // y1 = a >> (22-13) - XORL e, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL f, R15 \ // y2 = f - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL a, R14 \ // y1 = a ^ (a >> (22-13) - XORL g, R15 \ // y2 = f^g - LONG $0xc4fef9c5 \ // VPADDD XMM0,XMM0,XMM4 /* XTMP0 = W[-7] + W[-16] */ - XORL e, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6) ) - ANDL e, R15 \ // y2 = (f^g)&e - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - \ - \ // compute s0 - \ - LONG $0x0f51e3c4; WORD $0x04cc \ // VPALIGNR XMM1,XMM5,XMM4,0x4 /* XTMP1 = W[-15] */ - XORL a, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL g, R15 \ // y2 = CH = ((f^g)&e)^g - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+48(FP), R15 \ // y2 = k + w + S1 + CH - MOVL a, R13 \ // y0 = a - ADDL R15, h \ // h = h + S1 + CH + k + w - \ // ROTATE_ARGS - MOVL a, R15 \ // y2 = a - LONG $0xd172e9c5; BYTE $0x07 \ // VPSRLD XMM2,XMM1,0x7 /* */ - ORL c, R13 \ // y0 = a|c - ADDL h, d \ // d = d + h + S1 + CH + k + w - ANDL c, R15 \ // y2 = a&c - LONG $0xf172e1c5; BYTE $0x19 \ // VPSLLD XMM3,XMM1,0x19 /* */ - ANDL b, R13 \ // y0 = (a|c)&b - ADDL R14, h \ // h = h + S1 + CH + k + w + S0 - LONG $0xdaebe1c5 \ // VPOR XMM3,XMM3,XMM2 /* XTMP1 = W[-15] MY_ROR 7 */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, h \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL d, R13 \ // y0 = e - MOVL h, R14 \ // y1 = a - ROLL $18, R13 \ // y0 = e >> (25-11) - XORL d, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL e, R15 \ // y2 = f - ROLL $23, R14 \ // y1 = a >> (22-13) - LONG $0xd172e9c5; BYTE $0x12 \ // VPSRLD XMM2,XMM1,0x12 /* */ - XORL h, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL f, R15 \ // y2 = f^g - LONG $0xd172b9c5; BYTE $0x03 \ // VPSRLD XMM8,XMM1,0x3 /* XTMP4 = W[-15] >> 3 */ - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - XORL d, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL d, R15 \ // y2 = (f^g)&e - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - LONG $0xf172f1c5; BYTE $0x0e \ // VPSLLD XMM1,XMM1,0xe /* */ - XORL h, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - XORL f, R15 \ // y2 = CH = ((f^g)&e)^g - LONG $0xd9efe1c5 \ // VPXOR XMM3,XMM3,XMM1 /* */ - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+52(FP), R15 \ // y2 = k + w + S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - LONG $0xdaefe1c5 \ // VPXOR XMM3,XMM3,XMM2 /* XTMP1 = W[-15] MY_ROR 7 ^ W[-15] MY_ROR */ - MOVL h, R13 \ // y0 = a - ADDL R15, g \ // h = h + S1 + CH + k + w - MOVL h, R15 \ // y2 = a - LONG $0xef61c1c4; BYTE $0xc8 \ // VPXOR XMM1,XMM3,XMM8 /* XTMP1 = s0 */ - ORL b, R13 \ // y0 = a|c - ADDL g, c \ // d = d + h + S1 + CH + k + w - ANDL b, R15 \ // y2 = a&c - \ - \ // compute low s1 - \ - LONG $0xd770f9c5; BYTE $0xfa \ // VPSHUFD XMM2,XMM7,0xfa /* XTMP2 = W[-2] {BBAA} */ - ANDL a, R13 \ // y0 = (a|c)&b - ADDL R14, g \ // h = h + S1 + CH + k + w + S0 - LONG $0xc1fef9c5 \ // VPADDD XMM0,XMM0,XMM1 /* XTMP0 = W[-16] + W[-7] + s0 */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, g \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL c, R13 \ // y0 = e - MOVL g, R14 \ // y1 = a - ROLL $18, R13 \ // y0 = e >> (25-11) - XORL c, R13 \ // y0 = e ^ (e >> (25-11)) - ROLL $23, R14 \ // y1 = a >> (22-13) - MOVL d, R15 \ // y2 = f - XORL g, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - LONG $0xd272b9c5; BYTE $0x0a \ // VPSRLD XMM8,XMM2,0xa /* XTMP4 = W[-2] >> 10 {BBAA} */ - XORL e, R15 \ // y2 = f^g - LONG $0xd273e1c5; BYTE $0x13 \ // VPSRLQ XMM3,XMM2,0x13 /* XTMP3 = W[-2] MY_ROR 19 {xBxA} */ - XORL c, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL c, R15 \ // y2 = (f^g)&e - LONG $0xd273e9c5; BYTE $0x11 \ // VPSRLQ XMM2,XMM2,0x11 /* XTMP2 = W[-2] MY_ROR 17 {xBxA} */ - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - XORL g, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - XORL e, R15 \ // y2 = CH = ((f^g)&e)^g - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - LONG $0xd3efe9c5 \ // VPXOR XMM2,XMM2,XMM3 /* */ - ADDL R13, R15 \ // y2 = S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL _xfer+56(FP), R15 \ // y2 = k + w + S1 + CH - LONG $0xc2ef39c5 \ // VPXOR XMM8,XMM8,XMM2 /* XTMP4 = s1 {xBxA} */ - MOVL g, R13 \ // y0 = a - ADDL R15, f \ // h = h + S1 + CH + k + w - MOVL g, R15 \ // y2 = a - LONG $0x003942c4; BYTE $0xc2 \ // VPSHUFB XMM8,XMM8,XMM10 /* XTMP4 = s1 {00BA} */ - ORL a, R13 \ // y0 = a|c - ADDL f, b \ // d = d + h + S1 + CH + k + w - ANDL a, R15 \ // y2 = a&c - LONG $0xfe79c1c4; BYTE $0xc0 \ // VPADDD XMM0,XMM0,XMM8 /* XTMP0 = {..., ..., W[1], W[0]} */ - ANDL h, R13 \ // y0 = (a|c)&b - ADDL R14, f \ // h = h + S1 + CH + k + w + S0 - \ - \ // compute high s1 - \ - LONG $0xd070f9c5; BYTE $0x50 \ // VPSHUFD XMM2,XMM0,0x50 /* XTMP2 = W[-2] {DDCC} */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, f \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL b, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL f, R14 \ // y1 = a - ROLL $23, R14 \ // y1 = a >> (22-13) - XORL b, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL c, R15 \ // y2 = f - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - LONG $0xd272a1c5; BYTE $0x0a \ // VPSRLD XMM11,XMM2,0xa /* XTMP5 = W[-2] >> 10 {DDCC} */ - XORL f, R14 \ // y1 = a ^ (a >> (22-13) - XORL d, R15 \ // y2 = f^g - LONG $0xd273e1c5; BYTE $0x13 \ // VPSRLQ XMM3,XMM2,0x13 /* XTMP3 = W[-2] MY_ROR 19 {xDxC} */ - XORL b, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL b, R15 \ // y2 = (f^g)&e - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - LONG $0xd273e9c5; BYTE $0x11 \ // VPSRLQ XMM2,XMM2,0x11 /* XTMP2 = W[-2] MY_ROR 17 {xDxC} */ - XORL f, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL d, R15 \ // y2 = CH = ((f^g)&e)^g - LONG $0xd3efe9c5 \ // VPXOR XMM2,XMM2,XMM3 /* */ - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+60(FP), R15 \ // y2 = k + w + S1 + CH - LONG $0xdaef21c5 \ // VPXOR XMM11,XMM11,XMM2 /* XTMP5 = s1 {xDxC} */ - MOVL f, R13 \ // y0 = a - ADDL R15, e \ // h = h + S1 + CH + k + w - MOVL f, R15 \ // y2 = a - LONG $0x002142c4; BYTE $0xdc \ // VPSHUFB XMM11,XMM11,XMM12 /* XTMP5 = s1 {DC00} */ - ORL h, R13 \ // y0 = a|c - ADDL e, a \ // d = d + h + S1 + CH + k + w - ANDL h, R15 \ // y2 = a&c - LONG $0xe0fea1c5 \ // VPADDD XMM4,XMM11,XMM0 /* X0 = {W[3], W[2], W[1], W[0]} */ - ANDL g, R13 \ // y0 = (a|c)&b - ADDL R14, e \ // h = h + S1 + CH + k + w + S0 - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, e \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - ROTATE_XS - -#define DO_ROUND(a, b, c, d, e, f, g, h, offset) \ - MOVL e, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL a, R14 \ // y1 = a - XORL e, R13 \ // y0 = e ^ (e >> (25-11)) - ROLL $23, R14 \ // y1 = a >> (22-13) - MOVL f, R15 \ // y2 = f - XORL a, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL g, R15 \ // y2 = f^g - XORL e, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - ANDL e, R15 \ // y2 = (f^g)&e - XORL a, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL g, R15 \ // y2 = CH = ((f^g)&e)^g - ADDL R13, R15 \ // y2 = S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL _xfer+offset(FP), R15 \ // y2 = k + w + S1 + CH - MOVL a, R13 \ // y0 = a - ADDL R15, h \ // h = h + S1 + CH + k + w - MOVL a, R15 \ // y2 = a - ORL c, R13 \ // y0 = a|c - ADDL h, d \ // d = d + h + S1 + CH + k + w - ANDL c, R15 \ // y2 = a&c - ANDL b, R13 \ // y0 = (a|c)&b - ADDL R14, h \ // h = h + S1 + CH + k + w + S0 - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, h // h = h + S1 + CH + k + w + S0 + MAJ - -// func blockAvx(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) -TEXT ·blockAvx(SB), 7, $0-80 - - MOVQ h+0(FP), SI // SI: &h - MOVQ message_base+24(FP), R8 // &message - MOVQ message_len+32(FP), R9 // length of message - CMPQ R9, $0 - JEQ done_hash - ADDQ R8, R9 - MOVQ R9, reserved2+64(FP) // store end of message - - // Register definition - // a --> eax - // b --> ebx - // c --> ecx - // d --> r8d - // e --> edx - // f --> r9d - // g --> r10d - // h --> r11d - // - // y0 --> r13d - // y1 --> r14d - // y2 --> r15d - - MOVL (0*4)(SI), AX // a = H0 - MOVL (1*4)(SI), BX // b = H1 - MOVL (2*4)(SI), CX // c = H2 - MOVL (3*4)(SI), R8 // d = H3 - MOVL (4*4)(SI), DX // e = H4 - MOVL (5*4)(SI), R9 // f = H5 - MOVL (6*4)(SI), R10 // g = H6 - MOVL (7*4)(SI), R11 // h = H7 - - MOVOU bflipMask<>(SB), X13 - MOVOU shuf00BA<>(SB), X10 // shuffle xBxA -> 00BA - MOVOU shufDC00<>(SB), X12 // shuffle xDxC -> DC00 - - MOVQ message_base+24(FP), SI // SI: &message - -loop0: - LEAQ constants<>(SB), BP - - // byte swap first 16 dwords - MOVOU 0*16(SI), X4 - LONG $0x0059c2c4; BYTE $0xe5 // VPSHUFB XMM4, XMM4, XMM13 - MOVOU 1*16(SI), X5 - LONG $0x0051c2c4; BYTE $0xed // VPSHUFB XMM5, XMM5, XMM13 - MOVOU 2*16(SI), X6 - LONG $0x0049c2c4; BYTE $0xf5 // VPSHUFB XMM6, XMM6, XMM13 - MOVOU 3*16(SI), X7 - LONG $0x0041c2c4; BYTE $0xfd // VPSHUFB XMM7, XMM7, XMM13 - - MOVQ SI, reserved3+72(FP) - MOVD $0x3, DI - - // schedule 48 input dwords, by doing 3 rounds of 16 each -loop1: - LONG $0x4dfe59c5; BYTE $0x00 // VPADDD XMM9, XMM4, 0[RBP] /* Add 1st constant to first part of message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(AX, BX, CX, R8, DX, R9, R10, R11) - - LONG $0x4dfe59c5; BYTE $0x10 // VPADDD XMM9, XMM4, 16[RBP] /* Add 2nd constant to message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(DX, R9, R10, R11, AX, BX, CX, R8) - - LONG $0x4dfe59c5; BYTE $0x20 // VPADDD XMM9, XMM4, 32[RBP] /* Add 3rd constant to message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(AX, BX, CX, R8, DX, R9, R10, R11) - - LONG $0x4dfe59c5; BYTE $0x30 // VPADDD XMM9, XMM4, 48[RBP] /* Add 4th constant to message */ - MOVOU X9, reserved0+48(FP) - ADDQ $64, BP - FOUR_ROUNDS_AND_SCHED(DX, R9, R10, R11, AX, BX, CX, R8) - - SUBQ $1, DI - JNE loop1 - - MOVD $0x2, DI - -loop2: - LONG $0x4dfe59c5; BYTE $0x00 // VPADDD XMM9, XMM4, 0[RBP] /* Add 1st constant to first part of message */ - MOVOU X9, reserved0+48(FP) - DO_ROUND( AX, BX, CX, R8, DX, R9, R10, R11, 48) - DO_ROUND(R11, AX, BX, CX, R8, DX, R9, R10, 52) - DO_ROUND(R10, R11, AX, BX, CX, R8, DX, R9, 56) - DO_ROUND( R9, R10, R11, AX, BX, CX, R8, DX, 60) - - LONG $0x4dfe51c5; BYTE $0x10 // VPADDD XMM9, XMM5, 16[RBP] /* Add 2nd constant to message */ - MOVOU X9, reserved0+48(FP) - ADDQ $32, BP - DO_ROUND( DX, R9, R10, R11, AX, BX, CX, R8, 48) - DO_ROUND( R8, DX, R9, R10, R11, AX, BX, CX, 52) - DO_ROUND( CX, R8, DX, R9, R10, R11, AX, BX, 56) - DO_ROUND( BX, CX, R8, DX, R9, R10, R11, AX, 60) - - MOVOU X6, X4 - MOVOU X7, X5 - - SUBQ $1, DI - JNE loop2 - - MOVQ h+0(FP), SI // SI: &h - ADDL (0*4)(SI), AX // H0 = a + H0 - MOVL AX, (0*4)(SI) - ADDL (1*4)(SI), BX // H1 = b + H1 - MOVL BX, (1*4)(SI) - ADDL (2*4)(SI), CX // H2 = c + H2 - MOVL CX, (2*4)(SI) - ADDL (3*4)(SI), R8 // H3 = d + H3 - MOVL R8, (3*4)(SI) - ADDL (4*4)(SI), DX // H4 = e + H4 - MOVL DX, (4*4)(SI) - ADDL (5*4)(SI), R9 // H5 = f + H5 - MOVL R9, (5*4)(SI) - ADDL (6*4)(SI), R10 // H6 = g + H6 - MOVL R10, (6*4)(SI) - ADDL (7*4)(SI), R11 // H7 = h + H7 - MOVL R11, (7*4)(SI) - - MOVQ reserved3+72(FP), SI - ADDQ $64, SI - CMPQ reserved2+64(FP), SI - JNE loop0 - -done_hash: - RET - -// Constants table -DATA constants<>+0x0(SB)/8, $0x71374491428a2f98 -DATA constants<>+0x8(SB)/8, $0xe9b5dba5b5c0fbcf -DATA constants<>+0x10(SB)/8, $0x59f111f13956c25b -DATA constants<>+0x18(SB)/8, $0xab1c5ed5923f82a4 -DATA constants<>+0x20(SB)/8, $0x12835b01d807aa98 -DATA constants<>+0x28(SB)/8, $0x550c7dc3243185be -DATA constants<>+0x30(SB)/8, $0x80deb1fe72be5d74 -DATA constants<>+0x38(SB)/8, $0xc19bf1749bdc06a7 -DATA constants<>+0x40(SB)/8, $0xefbe4786e49b69c1 -DATA constants<>+0x48(SB)/8, $0x240ca1cc0fc19dc6 -DATA constants<>+0x50(SB)/8, $0x4a7484aa2de92c6f -DATA constants<>+0x58(SB)/8, $0x76f988da5cb0a9dc -DATA constants<>+0x60(SB)/8, $0xa831c66d983e5152 -DATA constants<>+0x68(SB)/8, $0xbf597fc7b00327c8 -DATA constants<>+0x70(SB)/8, $0xd5a79147c6e00bf3 -DATA constants<>+0x78(SB)/8, $0x1429296706ca6351 -DATA constants<>+0x80(SB)/8, $0x2e1b213827b70a85 -DATA constants<>+0x88(SB)/8, $0x53380d134d2c6dfc -DATA constants<>+0x90(SB)/8, $0x766a0abb650a7354 -DATA constants<>+0x98(SB)/8, $0x92722c8581c2c92e -DATA constants<>+0xa0(SB)/8, $0xa81a664ba2bfe8a1 -DATA constants<>+0xa8(SB)/8, $0xc76c51a3c24b8b70 -DATA constants<>+0xb0(SB)/8, $0xd6990624d192e819 -DATA constants<>+0xb8(SB)/8, $0x106aa070f40e3585 -DATA constants<>+0xc0(SB)/8, $0x1e376c0819a4c116 -DATA constants<>+0xc8(SB)/8, $0x34b0bcb52748774c -DATA constants<>+0xd0(SB)/8, $0x4ed8aa4a391c0cb3 -DATA constants<>+0xd8(SB)/8, $0x682e6ff35b9cca4f -DATA constants<>+0xe0(SB)/8, $0x78a5636f748f82ee -DATA constants<>+0xe8(SB)/8, $0x8cc7020884c87814 -DATA constants<>+0xf0(SB)/8, $0xa4506ceb90befffa -DATA constants<>+0xf8(SB)/8, $0xc67178f2bef9a3f7 - -DATA bflipMask<>+0x00(SB)/8, $0x0405060700010203 -DATA bflipMask<>+0x08(SB)/8, $0x0c0d0e0f08090a0b - -DATA shuf00BA<>+0x00(SB)/8, $0x0b0a090803020100 -DATA shuf00BA<>+0x08(SB)/8, $0xFFFFFFFFFFFFFFFF - -DATA shufDC00<>+0x00(SB)/8, $0xFFFFFFFFFFFFFFFF -DATA shufDC00<>+0x08(SB)/8, $0x0b0a090803020100 - -GLOBL constants<>(SB), 8, $256 -GLOBL bflipMask<>(SB), (NOPTR+RODATA), $16 -GLOBL shuf00BA<>(SB), (NOPTR+RODATA), $16 -GLOBL shufDC00<>(SB), (NOPTR+RODATA), $16 diff --git a/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.go deleted file mode 100644 index 383189c8..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.go +++ /dev/null @@ -1,6 +0,0 @@ -//+build !noasm - -package sha256 - -//go:noescape -func blockSha(h *[8]uint32, message []uint8) diff --git a/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.s b/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.s deleted file mode 100644 index 909fc0ef..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.s +++ /dev/null @@ -1,266 +0,0 @@ -//+build !noasm,!appengine - -// SHA intrinsic version of SHA256 - -// Kristofer Peterson, (C) 2018. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include "textflag.h" - -DATA K<>+0x00(SB)/4, $0x428a2f98 -DATA K<>+0x04(SB)/4, $0x71374491 -DATA K<>+0x08(SB)/4, $0xb5c0fbcf -DATA K<>+0x0c(SB)/4, $0xe9b5dba5 -DATA K<>+0x10(SB)/4, $0x3956c25b -DATA K<>+0x14(SB)/4, $0x59f111f1 -DATA K<>+0x18(SB)/4, $0x923f82a4 -DATA K<>+0x1c(SB)/4, $0xab1c5ed5 -DATA K<>+0x20(SB)/4, $0xd807aa98 -DATA K<>+0x24(SB)/4, $0x12835b01 -DATA K<>+0x28(SB)/4, $0x243185be -DATA K<>+0x2c(SB)/4, $0x550c7dc3 -DATA K<>+0x30(SB)/4, $0x72be5d74 -DATA K<>+0x34(SB)/4, $0x80deb1fe -DATA K<>+0x38(SB)/4, $0x9bdc06a7 -DATA K<>+0x3c(SB)/4, $0xc19bf174 -DATA K<>+0x40(SB)/4, $0xe49b69c1 -DATA K<>+0x44(SB)/4, $0xefbe4786 -DATA K<>+0x48(SB)/4, $0x0fc19dc6 -DATA K<>+0x4c(SB)/4, $0x240ca1cc -DATA K<>+0x50(SB)/4, $0x2de92c6f -DATA K<>+0x54(SB)/4, $0x4a7484aa -DATA K<>+0x58(SB)/4, $0x5cb0a9dc -DATA K<>+0x5c(SB)/4, $0x76f988da -DATA K<>+0x60(SB)/4, $0x983e5152 -DATA K<>+0x64(SB)/4, $0xa831c66d -DATA K<>+0x68(SB)/4, $0xb00327c8 -DATA K<>+0x6c(SB)/4, $0xbf597fc7 -DATA K<>+0x70(SB)/4, $0xc6e00bf3 -DATA K<>+0x74(SB)/4, $0xd5a79147 -DATA K<>+0x78(SB)/4, $0x06ca6351 -DATA K<>+0x7c(SB)/4, $0x14292967 -DATA K<>+0x80(SB)/4, $0x27b70a85 -DATA K<>+0x84(SB)/4, $0x2e1b2138 -DATA K<>+0x88(SB)/4, $0x4d2c6dfc -DATA K<>+0x8c(SB)/4, $0x53380d13 -DATA K<>+0x90(SB)/4, $0x650a7354 -DATA K<>+0x94(SB)/4, $0x766a0abb -DATA K<>+0x98(SB)/4, $0x81c2c92e -DATA K<>+0x9c(SB)/4, $0x92722c85 -DATA K<>+0xa0(SB)/4, $0xa2bfe8a1 -DATA K<>+0xa4(SB)/4, $0xa81a664b -DATA K<>+0xa8(SB)/4, $0xc24b8b70 -DATA K<>+0xac(SB)/4, $0xc76c51a3 -DATA K<>+0xb0(SB)/4, $0xd192e819 -DATA K<>+0xb4(SB)/4, $0xd6990624 -DATA K<>+0xb8(SB)/4, $0xf40e3585 -DATA K<>+0xbc(SB)/4, $0x106aa070 -DATA K<>+0xc0(SB)/4, $0x19a4c116 -DATA K<>+0xc4(SB)/4, $0x1e376c08 -DATA K<>+0xc8(SB)/4, $0x2748774c -DATA K<>+0xcc(SB)/4, $0x34b0bcb5 -DATA K<>+0xd0(SB)/4, $0x391c0cb3 -DATA K<>+0xd4(SB)/4, $0x4ed8aa4a -DATA K<>+0xd8(SB)/4, $0x5b9cca4f -DATA K<>+0xdc(SB)/4, $0x682e6ff3 -DATA K<>+0xe0(SB)/4, $0x748f82ee -DATA K<>+0xe4(SB)/4, $0x78a5636f -DATA K<>+0xe8(SB)/4, $0x84c87814 -DATA K<>+0xec(SB)/4, $0x8cc70208 -DATA K<>+0xf0(SB)/4, $0x90befffa -DATA K<>+0xf4(SB)/4, $0xa4506ceb -DATA K<>+0xf8(SB)/4, $0xbef9a3f7 -DATA K<>+0xfc(SB)/4, $0xc67178f2 -GLOBL K<>(SB), RODATA|NOPTR, $256 - -DATA SHUF_MASK<>+0x00(SB)/8, $0x0405060700010203 -DATA SHUF_MASK<>+0x08(SB)/8, $0x0c0d0e0f08090a0b -GLOBL SHUF_MASK<>(SB), RODATA|NOPTR, $16 - -// Register Usage -// BX base address of constant table (constant) -// DX hash_state (constant) -// SI hash_data.data -// DI hash_data.data + hash_data.length - 64 (constant) -// X0 scratch -// X1 scratch -// X2 working hash state // ABEF -// X3 working hash state // CDGH -// X4 first 16 bytes of block -// X5 second 16 bytes of block -// X6 third 16 bytes of block -// X7 fourth 16 bytes of block -// X12 saved hash state // ABEF -// X13 saved hash state // CDGH -// X15 data shuffle mask (constant) - -TEXT ·blockSha(SB), NOSPLIT, $0-32 - MOVQ h+0(FP), DX - MOVQ message_base+8(FP), SI - MOVQ message_len+16(FP), DI - LEAQ -64(SI)(DI*1), DI - MOVOU (DX), X2 - MOVOU 16(DX), X1 - MOVO X2, X3 - PUNPCKLLQ X1, X2 - PUNPCKHLQ X1, X3 - PSHUFD $0x27, X2, X2 - PSHUFD $0x27, X3, X3 - MOVO SHUF_MASK<>(SB), X15 - LEAQ K<>(SB), BX - - JMP TEST - -LOOP: - MOVO X2, X12 - MOVO X3, X13 - - // load block and shuffle - MOVOU (SI), X4 - MOVOU 16(SI), X5 - MOVOU 32(SI), X6 - MOVOU 48(SI), X7 - PSHUFB X15, X4 - PSHUFB X15, X5 - PSHUFB X15, X6 - PSHUFB X15, X7 - -#define ROUND456 \ - PADDL X5, X0 \ - LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2 - MOVO X5, X1 \ - LONG $0x0f3a0f66; WORD $0x04cc \ // PALIGNR XMM1, XMM4, 4 - PADDL X1, X6 \ - LONG $0xf5cd380f \ // SHA256MSG2 XMM6, XMM5 - PSHUFD $0x4e, X0, X0 \ - LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3 - LONG $0xe5cc380f // SHA256MSG1 XMM4, XMM5 - -#define ROUND567 \ - PADDL X6, X0 \ - LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2 - MOVO X6, X1 \ - LONG $0x0f3a0f66; WORD $0x04cd \ // PALIGNR XMM1, XMM5, 4 - PADDL X1, X7 \ - LONG $0xfecd380f \ // SHA256MSG2 XMM7, XMM6 - PSHUFD $0x4e, X0, X0 \ - LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3 - LONG $0xeecc380f // SHA256MSG1 XMM5, XMM6 - -#define ROUND674 \ - PADDL X7, X0 \ - LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2 - MOVO X7, X1 \ - LONG $0x0f3a0f66; WORD $0x04ce \ // PALIGNR XMM1, XMM6, 4 - PADDL X1, X4 \ - LONG $0xe7cd380f \ // SHA256MSG2 XMM4, XMM7 - PSHUFD $0x4e, X0, X0 \ - LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3 - LONG $0xf7cc380f // SHA256MSG1 XMM6, XMM7 - -#define ROUND745 \ - PADDL X4, X0 \ - LONG $0xdacb380f \ // SHA256RNDS2 XMM3, XMM2 - MOVO X4, X1 \ - LONG $0x0f3a0f66; WORD $0x04cf \ // PALIGNR XMM1, XMM7, 4 - PADDL X1, X5 \ - LONG $0xeccd380f \ // SHA256MSG2 XMM5, XMM4 - PSHUFD $0x4e, X0, X0 \ - LONG $0xd3cb380f \ // SHA256RNDS2 XMM2, XMM3 - LONG $0xfccc380f // SHA256MSG1 XMM7, XMM4 - - // rounds 0-3 - MOVO (BX), X0 - PADDL X4, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - - // rounds 4-7 - MOVO 1*16(BX), X0 - PADDL X5, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - LONG $0xe5cc380f // SHA256MSG1 XMM4, XMM5 - - // rounds 8-11 - MOVO 2*16(BX), X0 - PADDL X6, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - LONG $0xeecc380f // SHA256MSG1 XMM5, XMM6 - - MOVO 3*16(BX), X0; ROUND674 // rounds 12-15 - MOVO 4*16(BX), X0; ROUND745 // rounds 16-19 - MOVO 5*16(BX), X0; ROUND456 // rounds 20-23 - MOVO 6*16(BX), X0; ROUND567 // rounds 24-27 - MOVO 7*16(BX), X0; ROUND674 // rounds 28-31 - MOVO 8*16(BX), X0; ROUND745 // rounds 32-35 - MOVO 9*16(BX), X0; ROUND456 // rounds 36-39 - MOVO 10*16(BX), X0; ROUND567 // rounds 40-43 - MOVO 11*16(BX), X0; ROUND674 // rounds 44-47 - MOVO 12*16(BX), X0; ROUND745 // rounds 48-51 - - // rounds 52-55 - MOVO 13*16(BX), X0 - PADDL X5, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - MOVO X5, X1 - LONG $0x0f3a0f66; WORD $0x04cc // PALIGNR XMM1, XMM4, 4 - PADDL X1, X6 - LONG $0xf5cd380f // SHA256MSG2 XMM6, XMM5 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - - // rounds 56-59 - MOVO 14*16(BX), X0 - PADDL X6, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - MOVO X6, X1 - LONG $0x0f3a0f66; WORD $0x04cd // PALIGNR XMM1, XMM5, 4 - PADDL X1, X7 - LONG $0xfecd380f // SHA256MSG2 XMM7, XMM6 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - - // rounds 60-63 - MOVO 15*16(BX), X0 - PADDL X7, X0 - LONG $0xdacb380f // SHA256RNDS2 XMM3, XMM2 - PSHUFD $0x4e, X0, X0 - LONG $0xd3cb380f // SHA256RNDS2 XMM2, XMM3 - - PADDL X12, X2 - PADDL X13, X3 - - ADDQ $64, SI - -TEST: - CMPQ SI, DI - JBE LOOP - - PSHUFD $0x4e, X3, X0 - LONG $0x0e3a0f66; WORD $0xf0c2 // PBLENDW XMM0, XMM2, 0xf0 - PSHUFD $0x4e, X2, X1 - LONG $0x0e3a0f66; WORD $0x0fcb // PBLENDW XMM1, XMM3, 0x0f - PSHUFD $0x1b, X0, X0 - PSHUFD $0x1b, X1, X1 - - MOVOU X0, (DX) - MOVOU X1, 16(DX) - - RET diff --git a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go b/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go deleted file mode 100644 index 54abbb0f..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go +++ /dev/null @@ -1,22 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -//go:noescape -func blockSsse(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) diff --git a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.s b/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.s deleted file mode 100644 index 7afb45c8..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.s +++ /dev/null @@ -1,429 +0,0 @@ -//+build !noasm,!appengine - -// SHA256 implementation for SSSE3 - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// This code is based on an Intel White-Paper: -// "Fast SHA-256 Implementations on Intel Architecture Processors" -// -// together with the reference implementation from the following authors: -// James Guilford -// Kirk Yap -// Tim Chen -// -// For Golang it has been converted to Plan 9 assembly with the help of -// github.com/minio/asm2plan9s to assemble Intel instructions to their Plan9 -// equivalents -// - -#include "textflag.h" - -#define ROTATE_XS \ - MOVOU X4, X15 \ - MOVOU X5, X4 \ - MOVOU X6, X5 \ - MOVOU X7, X6 \ - MOVOU X15, X7 - -// compute s0 four at a time and s1 two at a time -// compute W[-16] + W[-7] 4 at a time -#define FOUR_ROUNDS_AND_SCHED(a, b, c, d, e, f, g, h) \ - MOVL e, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL a, R14 \ // y1 = a - MOVOU X7, X0 \ - LONG $0x0f3a0f66; WORD $0x04c6 \ // PALIGNR XMM0,XMM6,0x4 /* XTMP0 = W[-7] */ - ROLL $23, R14 \ // y1 = a >> (22-13) - XORL e, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL f, R15 \ // y2 = f - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL a, R14 \ // y1 = a ^ (a >> (22-13) - XORL g, R15 \ // y2 = f^g - LONG $0xc4fe0f66 \ // PADDD XMM0,XMM4 /* XTMP0 = W[-7] + W[-16] */ - XORL e, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6) ) - ANDL e, R15 \ // y2 = (f^g)&e - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - \ - \ // compute s0 - \ - MOVOU X5, X1 \ - LONG $0x0f3a0f66; WORD $0x04cc \ // PALIGNR XMM1,XMM4,0x4 /* XTMP1 = W[-15] */ - XORL a, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL g, R15 \ // y2 = CH = ((f^g)&e)^g - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+48(FP), R15 \ // y2 = k + w + S1 + CH - MOVL a, R13 \ // y0 = a - ADDL R15, h \ // h = h + S1 + CH + k + w - \ // ROTATE_ARGS - MOVL a, R15 \ // y2 = a - MOVOU X1, X2 \ - LONG $0xd2720f66; BYTE $0x07 \ // PSRLD XMM2,0x7 /* */ - ORL c, R13 \ // y0 = a|c - ADDL h, d \ // d = d + h + S1 + CH + k + w - ANDL c, R15 \ // y2 = a&c - MOVOU X1, X3 \ - LONG $0xf3720f66; BYTE $0x19 \ // PSLLD XMM3,0x19 /* */ - ANDL b, R13 \ // y0 = (a|c)&b - ADDL R14, h \ // h = h + S1 + CH + k + w + S0 - LONG $0xdaeb0f66 \ // POR XMM3,XMM2 /* XTMP1 = W[-15] MY_ROR 7 */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, h \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL d, R13 \ // y0 = e - MOVL h, R14 \ // y1 = a - ROLL $18, R13 \ // y0 = e >> (25-11) - XORL d, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL e, R15 \ // y2 = f - ROLL $23, R14 \ // y1 = a >> (22-13) - MOVOU X1, X2 \ - LONG $0xd2720f66; BYTE $0x12 \ // PSRLD XMM2,0x12 /* */ - XORL h, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL f, R15 \ // y2 = f^g - MOVOU X1, X8 \ - LONG $0x720f4166; WORD $0x03d0 \ // PSRLD XMM8,0x3 /* XTMP4 = W[-15] >> 3 */ - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - XORL d, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL d, R15 \ // y2 = (f^g)&e - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - LONG $0xf1720f66; BYTE $0x0e \ // PSLLD XMM1,0xe /* */ - XORL h, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - XORL f, R15 \ // y2 = CH = ((f^g)&e)^g - LONG $0xd9ef0f66 \ // PXOR XMM3,XMM1 /* */ - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+52(FP), R15 \ // y2 = k + w + S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - LONG $0xdaef0f66 \ // PXOR XMM3,XMM2 /* XTMP1 = W[-15] MY_ROR 7 ^ W[-15] MY_ROR */ - MOVL h, R13 \ // y0 = a - ADDL R15, g \ // h = h + S1 + CH + k + w - MOVL h, R15 \ // y2 = a - MOVOU X3, X1 \ - LONG $0xef0f4166; BYTE $0xc8 \ // PXOR XMM1,XMM8 /* XTMP1 = s0 */ - ORL b, R13 \ // y0 = a|c - ADDL g, c \ // d = d + h + S1 + CH + k + w - ANDL b, R15 \ // y2 = a&c - \ - \ // compute low s1 - \ - LONG $0xd7700f66; BYTE $0xfa \ // PSHUFD XMM2,XMM7,0xfa /* XTMP2 = W[-2] {BBAA} */ - ANDL a, R13 \ // y0 = (a|c)&b - ADDL R14, g \ // h = h + S1 + CH + k + w + S0 - LONG $0xc1fe0f66 \ // PADDD XMM0,XMM1 /* XTMP0 = W[-16] + W[-7] + s0 */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, g \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL c, R13 \ // y0 = e - MOVL g, R14 \ // y1 = a - ROLL $18, R13 \ // y0 = e >> (25-11) - XORL c, R13 \ // y0 = e ^ (e >> (25-11)) - ROLL $23, R14 \ // y1 = a >> (22-13) - MOVL d, R15 \ // y2 = f - XORL g, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - MOVOU X2, X8 \ - LONG $0x720f4166; WORD $0x0ad0 \ // PSRLD XMM8,0xa /* XTMP4 = W[-2] >> 10 {BBAA} */ - XORL e, R15 \ // y2 = f^g - MOVOU X2, X3 \ - LONG $0xd3730f66; BYTE $0x13 \ // PSRLQ XMM3,0x13 /* XTMP3 = W[-2] MY_ROR 19 {xBxA} */ - XORL c, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL c, R15 \ // y2 = (f^g)&e - LONG $0xd2730f66; BYTE $0x11 \ // PSRLQ XMM2,0x11 /* XTMP2 = W[-2] MY_ROR 17 {xBxA} */ - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - XORL g, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - XORL e, R15 \ // y2 = CH = ((f^g)&e)^g - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - LONG $0xd3ef0f66 \ // PXOR XMM2,XMM3 /* */ - ADDL R13, R15 \ // y2 = S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL _xfer+56(FP), R15 \ // y2 = k + w + S1 + CH - LONG $0xef0f4466; BYTE $0xc2 \ // PXOR XMM8,XMM2 /* XTMP4 = s1 {xBxA} */ - MOVL g, R13 \ // y0 = a - ADDL R15, f \ // h = h + S1 + CH + k + w - MOVL g, R15 \ // y2 = a - LONG $0x380f4566; WORD $0xc200 \ // PSHUFB XMM8,XMM10 /* XTMP4 = s1 {00BA} */ - ORL a, R13 \ // y0 = a|c - ADDL f, b \ // d = d + h + S1 + CH + k + w - ANDL a, R15 \ // y2 = a&c - LONG $0xfe0f4166; BYTE $0xc0 \ // PADDD XMM0,XMM8 /* XTMP0 = {..., ..., W[1], W[0]} */ - ANDL h, R13 \ // y0 = (a|c)&b - ADDL R14, f \ // h = h + S1 + CH + k + w + S0 - \ - \ // compute high s1 - \ - LONG $0xd0700f66; BYTE $0x50 \ // PSHUFD XMM2,XMM0,0x50 /* XTMP2 = W[-2] {DDCC} */ - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, f \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - MOVL b, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL f, R14 \ // y1 = a - ROLL $23, R14 \ // y1 = a >> (22-13) - XORL b, R13 \ // y0 = e ^ (e >> (25-11)) - MOVL c, R15 \ // y2 = f - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - MOVOU X2, X11 \ - LONG $0x720f4166; WORD $0x0ad3 \ // PSRLD XMM11,0xa /* XTMP5 = W[-2] >> 10 {DDCC} */ - XORL f, R14 \ // y1 = a ^ (a >> (22-13) - XORL d, R15 \ // y2 = f^g - MOVOU X2, X3 \ - LONG $0xd3730f66; BYTE $0x13 \ // PSRLQ XMM3,0x13 /* XTMP3 = W[-2] MY_ROR 19 {xDxC} */ - XORL b, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ANDL b, R15 \ // y2 = (f^g)&e - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - LONG $0xd2730f66; BYTE $0x11 \ // PSRLQ XMM2,0x11 /* XTMP2 = W[-2] MY_ROR 17 {xDxC} */ - XORL f, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL d, R15 \ // y2 = CH = ((f^g)&e)^g - LONG $0xd3ef0f66 \ // PXOR XMM2,XMM3 /* */ - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL R13, R15 \ // y2 = S1 + CH - ADDL _xfer+60(FP), R15 \ // y2 = k + w + S1 + CH - LONG $0xef0f4466; BYTE $0xda \ // PXOR XMM11,XMM2 /* XTMP5 = s1 {xDxC} */ - MOVL f, R13 \ // y0 = a - ADDL R15, e \ // h = h + S1 + CH + k + w - MOVL f, R15 \ // y2 = a - LONG $0x380f4566; WORD $0xdc00 \ // PSHUFB XMM11,XMM12 /* XTMP5 = s1 {DC00} */ - ORL h, R13 \ // y0 = a|c - ADDL e, a \ // d = d + h + S1 + CH + k + w - ANDL h, R15 \ // y2 = a&c - MOVOU X11, X4 \ - LONG $0xe0fe0f66 \ // PADDD XMM4,XMM0 /* X0 = {W[3], W[2], W[1], W[0]} */ - ANDL g, R13 \ // y0 = (a|c)&b - ADDL R14, e \ // h = h + S1 + CH + k + w + S0 - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, e \ // h = h + S1 + CH + k + w + S0 + MAJ - \ // ROTATE_ARGS - ROTATE_XS - -#define DO_ROUND(a, b, c, d, e, f, g, h, offset) \ - MOVL e, R13 \ // y0 = e - ROLL $18, R13 \ // y0 = e >> (25-11) - MOVL a, R14 \ // y1 = a - XORL e, R13 \ // y0 = e ^ (e >> (25-11)) - ROLL $23, R14 \ // y1 = a >> (22-13) - MOVL f, R15 \ // y2 = f - XORL a, R14 \ // y1 = a ^ (a >> (22-13) - ROLL $27, R13 \ // y0 = (e >> (11-6)) ^ (e >> (25-6)) - XORL g, R15 \ // y2 = f^g - XORL e, R13 \ // y0 = e ^ (e >> (11-6)) ^ (e >> (25-6)) - ROLL $21, R14 \ // y1 = (a >> (13-2)) ^ (a >> (22-2)) - ANDL e, R15 \ // y2 = (f^g)&e - XORL a, R14 \ // y1 = a ^ (a >> (13-2)) ^ (a >> (22-2)) - ROLL $26, R13 \ // y0 = S1 = (e>>6) & (e>>11) ^ (e>>25) - XORL g, R15 \ // y2 = CH = ((f^g)&e)^g - ADDL R13, R15 \ // y2 = S1 + CH - ROLL $30, R14 \ // y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22) - ADDL _xfer+offset(FP), R15 \ // y2 = k + w + S1 + CH - MOVL a, R13 \ // y0 = a - ADDL R15, h \ // h = h + S1 + CH + k + w - MOVL a, R15 \ // y2 = a - ORL c, R13 \ // y0 = a|c - ADDL h, d \ // d = d + h + S1 + CH + k + w - ANDL c, R15 \ // y2 = a&c - ANDL b, R13 \ // y0 = (a|c)&b - ADDL R14, h \ // h = h + S1 + CH + k + w + S0 - ORL R15, R13 \ // y0 = MAJ = (a|c)&b)|(a&c) - ADDL R13, h // h = h + S1 + CH + k + w + S0 + MAJ - -// func blockSsse(h []uint32, message []uint8, reserved0, reserved1, reserved2, reserved3 uint64) -TEXT ·blockSsse(SB), 7, $0-80 - - MOVQ h+0(FP), SI // SI: &h - MOVQ message_base+24(FP), R8 // &message - MOVQ message_len+32(FP), R9 // length of message - CMPQ R9, $0 - JEQ done_hash - ADDQ R8, R9 - MOVQ R9, reserved2+64(FP) // store end of message - - // Register definition - // a --> eax - // b --> ebx - // c --> ecx - // d --> r8d - // e --> edx - // f --> r9d - // g --> r10d - // h --> r11d - // - // y0 --> r13d - // y1 --> r14d - // y2 --> r15d - - MOVL (0*4)(SI), AX // a = H0 - MOVL (1*4)(SI), BX // b = H1 - MOVL (2*4)(SI), CX // c = H2 - MOVL (3*4)(SI), R8 // d = H3 - MOVL (4*4)(SI), DX // e = H4 - MOVL (5*4)(SI), R9 // f = H5 - MOVL (6*4)(SI), R10 // g = H6 - MOVL (7*4)(SI), R11 // h = H7 - - MOVOU bflipMask<>(SB), X13 - MOVOU shuf00BA<>(SB), X10 // shuffle xBxA -> 00BA - MOVOU shufDC00<>(SB), X12 // shuffle xDxC -> DC00 - - MOVQ message_base+24(FP), SI // SI: &message - -loop0: - LEAQ constants<>(SB), BP - - // byte swap first 16 dwords - MOVOU 0*16(SI), X4 - LONG $0x380f4166; WORD $0xe500 // PSHUFB XMM4, XMM13 - MOVOU 1*16(SI), X5 - LONG $0x380f4166; WORD $0xed00 // PSHUFB XMM5, XMM13 - MOVOU 2*16(SI), X6 - LONG $0x380f4166; WORD $0xf500 // PSHUFB XMM6, XMM13 - MOVOU 3*16(SI), X7 - LONG $0x380f4166; WORD $0xfd00 // PSHUFB XMM7, XMM13 - - MOVQ SI, reserved3+72(FP) - MOVD $0x3, DI - - // Align - // nop WORD PTR [rax+rax*1+0x0] - - // schedule 48 input dwords, by doing 3 rounds of 16 each -loop1: - MOVOU X4, X9 - LONG $0xfe0f4466; WORD $0x004d // PADDD XMM9, 0[RBP] /* Add 1st constant to first part of message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(AX, BX, CX, R8, DX, R9, R10, R11) - - MOVOU X4, X9 - LONG $0xfe0f4466; WORD $0x104d // PADDD XMM9, 16[RBP] /* Add 2nd constant to message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(DX, R9, R10, R11, AX, BX, CX, R8) - - MOVOU X4, X9 - LONG $0xfe0f4466; WORD $0x204d // PADDD XMM9, 32[RBP] /* Add 3rd constant to message */ - MOVOU X9, reserved0+48(FP) - FOUR_ROUNDS_AND_SCHED(AX, BX, CX, R8, DX, R9, R10, R11) - - MOVOU X4, X9 - LONG $0xfe0f4466; WORD $0x304d // PADDD XMM9, 48[RBP] /* Add 4th constant to message */ - MOVOU X9, reserved0+48(FP) - ADDQ $64, BP - FOUR_ROUNDS_AND_SCHED(DX, R9, R10, R11, AX, BX, CX, R8) - - SUBQ $1, DI - JNE loop1 - - MOVD $0x2, DI - -loop2: - MOVOU X4, X9 - LONG $0xfe0f4466; WORD $0x004d // PADDD XMM9, 0[RBP] /* Add 1st constant to first part of message */ - MOVOU X9, reserved0+48(FP) - DO_ROUND( AX, BX, CX, R8, DX, R9, R10, R11, 48) - DO_ROUND(R11, AX, BX, CX, R8, DX, R9, R10, 52) - DO_ROUND(R10, R11, AX, BX, CX, R8, DX, R9, 56) - DO_ROUND( R9, R10, R11, AX, BX, CX, R8, DX, 60) - - MOVOU X5, X9 - LONG $0xfe0f4466; WORD $0x104d // PADDD XMM9, 16[RBP] /* Add 2nd constant to message */ - MOVOU X9, reserved0+48(FP) - ADDQ $32, BP - DO_ROUND( DX, R9, R10, R11, AX, BX, CX, R8, 48) - DO_ROUND( R8, DX, R9, R10, R11, AX, BX, CX, 52) - DO_ROUND( CX, R8, DX, R9, R10, R11, AX, BX, 56) - DO_ROUND( BX, CX, R8, DX, R9, R10, R11, AX, 60) - - MOVOU X6, X4 - MOVOU X7, X5 - - SUBQ $1, DI - JNE loop2 - - MOVQ h+0(FP), SI // SI: &h - ADDL (0*4)(SI), AX // H0 = a + H0 - MOVL AX, (0*4)(SI) - ADDL (1*4)(SI), BX // H1 = b + H1 - MOVL BX, (1*4)(SI) - ADDL (2*4)(SI), CX // H2 = c + H2 - MOVL CX, (2*4)(SI) - ADDL (3*4)(SI), R8 // H3 = d + H3 - MOVL R8, (3*4)(SI) - ADDL (4*4)(SI), DX // H4 = e + H4 - MOVL DX, (4*4)(SI) - ADDL (5*4)(SI), R9 // H5 = f + H5 - MOVL R9, (5*4)(SI) - ADDL (6*4)(SI), R10 // H6 = g + H6 - MOVL R10, (6*4)(SI) - ADDL (7*4)(SI), R11 // H7 = h + H7 - MOVL R11, (7*4)(SI) - - MOVQ reserved3+72(FP), SI - ADDQ $64, SI - CMPQ reserved2+64(FP), SI - JNE loop0 - -done_hash: - RET - -// Constants table -DATA constants<>+0x0(SB)/8, $0x71374491428a2f98 -DATA constants<>+0x8(SB)/8, $0xe9b5dba5b5c0fbcf -DATA constants<>+0x10(SB)/8, $0x59f111f13956c25b -DATA constants<>+0x18(SB)/8, $0xab1c5ed5923f82a4 -DATA constants<>+0x20(SB)/8, $0x12835b01d807aa98 -DATA constants<>+0x28(SB)/8, $0x550c7dc3243185be -DATA constants<>+0x30(SB)/8, $0x80deb1fe72be5d74 -DATA constants<>+0x38(SB)/8, $0xc19bf1749bdc06a7 -DATA constants<>+0x40(SB)/8, $0xefbe4786e49b69c1 -DATA constants<>+0x48(SB)/8, $0x240ca1cc0fc19dc6 -DATA constants<>+0x50(SB)/8, $0x4a7484aa2de92c6f -DATA constants<>+0x58(SB)/8, $0x76f988da5cb0a9dc -DATA constants<>+0x60(SB)/8, $0xa831c66d983e5152 -DATA constants<>+0x68(SB)/8, $0xbf597fc7b00327c8 -DATA constants<>+0x70(SB)/8, $0xd5a79147c6e00bf3 -DATA constants<>+0x78(SB)/8, $0x1429296706ca6351 -DATA constants<>+0x80(SB)/8, $0x2e1b213827b70a85 -DATA constants<>+0x88(SB)/8, $0x53380d134d2c6dfc -DATA constants<>+0x90(SB)/8, $0x766a0abb650a7354 -DATA constants<>+0x98(SB)/8, $0x92722c8581c2c92e -DATA constants<>+0xa0(SB)/8, $0xa81a664ba2bfe8a1 -DATA constants<>+0xa8(SB)/8, $0xc76c51a3c24b8b70 -DATA constants<>+0xb0(SB)/8, $0xd6990624d192e819 -DATA constants<>+0xb8(SB)/8, $0x106aa070f40e3585 -DATA constants<>+0xc0(SB)/8, $0x1e376c0819a4c116 -DATA constants<>+0xc8(SB)/8, $0x34b0bcb52748774c -DATA constants<>+0xd0(SB)/8, $0x4ed8aa4a391c0cb3 -DATA constants<>+0xd8(SB)/8, $0x682e6ff35b9cca4f -DATA constants<>+0xe0(SB)/8, $0x78a5636f748f82ee -DATA constants<>+0xe8(SB)/8, $0x8cc7020884c87814 -DATA constants<>+0xf0(SB)/8, $0xa4506ceb90befffa -DATA constants<>+0xf8(SB)/8, $0xc67178f2bef9a3f7 - -DATA bflipMask<>+0x00(SB)/8, $0x0405060700010203 -DATA bflipMask<>+0x08(SB)/8, $0x0c0d0e0f08090a0b - -DATA shuf00BA<>+0x00(SB)/8, $0x0b0a090803020100 -DATA shuf00BA<>+0x08(SB)/8, $0xFFFFFFFFFFFFFFFF - -DATA shufDC00<>+0x00(SB)/8, $0xFFFFFFFFFFFFFFFF -DATA shufDC00<>+0x08(SB)/8, $0x0b0a090803020100 - -GLOBL constants<>(SB), 8, $256 -GLOBL bflipMask<>(SB), (NOPTR+RODATA), $16 -GLOBL shuf00BA<>(SB), (NOPTR+RODATA), $16 -GLOBL shufDC00<>(SB), (NOPTR+RODATA), $16 diff --git a/vendor/github.com/minio/sha256-simd/sha256block_386.go b/vendor/github.com/minio/sha256-simd/sha256block_386.go deleted file mode 100644 index a4153b91..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_386.go +++ /dev/null @@ -1,25 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -func blockArmGo(dig *digest, p []byte) {} -func blockAvx2Go(dig *digest, p []byte) {} -func blockAvxGo(dig *digest, p []byte) {} -func blockSsseGo(dig *digest, p []byte) {} -func blockShaGo(dig *digest, p []byte) {} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_amd64.go b/vendor/github.com/minio/sha256-simd/sha256block_amd64.go deleted file mode 100644 index 8d341fcf..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -func blockArmGo(dig *digest, p []byte) {} - -func blockAvxGo(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockAvx(h[:], p[:], 0, 0, 0, 0) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} - -func blockAvx2Go(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockAvx2(h[:], p[:]) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} - -func blockSsseGo(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockSsse(h[:], p[:], 0, 0, 0, 0) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] -} - -func blockShaGo(dig *digest, p []byte) { - - blockSha(&dig.h, p) -} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_arm.go b/vendor/github.com/minio/sha256-simd/sha256block_arm.go deleted file mode 100644 index 1191c086..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_arm.go +++ /dev/null @@ -1,25 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -func blockAvx2Go(dig *digest, p []byte) {} -func blockAvxGo(dig *digest, p []byte) {} -func blockSsseGo(dig *digest, p []byte) {} -func blockShaGo(dig *digest, p []byte) {} -func blockArmGo(dig *digest, p []byte) {} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_arm64.go b/vendor/github.com/minio/sha256-simd/sha256block_arm64.go deleted file mode 100644 index 4441b0c2..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_arm64.go +++ /dev/null @@ -1,37 +0,0 @@ -//+build !noasm - -/* - * Minio Cloud Storage, (C) 2016 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -func blockAvx2Go(dig *digest, p []byte) {} -func blockAvxGo(dig *digest, p []byte) {} -func blockSsseGo(dig *digest, p []byte) {} -func blockShaGo(dig *digest, p []byte) {} - -//go:noescape -func blockArm(h []uint32, message []uint8) - -func blockArmGo(dig *digest, p []byte) { - - h := []uint32{dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]} - - blockArm(h[:], p[:]) - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h[0], h[1], h[2], h[3], h[4], - h[5], h[6], h[7] -} diff --git a/vendor/github.com/minio/sha256-simd/sha256block_arm64.s b/vendor/github.com/minio/sha256-simd/sha256block_arm64.s deleted file mode 100644 index db816ac6..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_arm64.s +++ /dev/null @@ -1,192 +0,0 @@ -//+build !noasm !appengine - -// ARM64 version of SHA256 - -// -// Minio Cloud Storage, (C) 2016 Minio, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// -// Based on implementation as found in https://github.com/jocover/sha256-armv8 -// -// Use github.com/minio/asm2plan9s on this file to assemble ARM instructions to -// their Plan9 equivalents -// - -TEXT ·blockArm(SB), 7, $0 - MOVD h+0(FP), R0 - MOVD message+24(FP), R1 - MOVD lenmessage+32(FP), R2 // length of message - SUBS $64, R2 - BMI complete - - // Load constants table pointer - MOVD $·constants(SB), R3 - - // Cache constants table in registers v16 - v31 - WORD $0x4cdf2870 // ld1 {v16.4s-v19.4s}, [x3], #64 - WORD $0x4cdf7800 // ld1 {v0.4s}, [x0], #16 - WORD $0x4cdf2874 // ld1 {v20.4s-v23.4s}, [x3], #64 - - WORD $0x4c407801 // ld1 {v1.4s}, [x0] - WORD $0x4cdf2878 // ld1 {v24.4s-v27.4s}, [x3], #64 - WORD $0xd1004000 // sub x0, x0, #0x10 - WORD $0x4cdf287c // ld1 {v28.4s-v31.4s}, [x3], #64 - -loop: - // Main loop - WORD $0x4cdf2025 // ld1 {v5.16b-v8.16b}, [x1], #64 - WORD $0x4ea01c02 // mov v2.16b, v0.16b - WORD $0x4ea11c23 // mov v3.16b, v1.16b - WORD $0x6e2008a5 // rev32 v5.16b, v5.16b - WORD $0x6e2008c6 // rev32 v6.16b, v6.16b - WORD $0x4eb084a9 // add v9.4s, v5.4s, v16.4s - WORD $0x6e2008e7 // rev32 v7.16b, v7.16b - WORD $0x4eb184ca // add v10.4s, v6.4s, v17.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s - WORD $0x6e200908 // rev32 v8.16b, v8.16b - WORD $0x4eb284e9 // add v9.4s, v7.4s, v18.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s - WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s - WORD $0x4eb3850a // add v10.4s, v8.4s, v19.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e282907 // sha256su0 v7.4s, v8.4s - WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s - WORD $0x4eb484a9 // add v9.4s, v5.4s, v20.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s - WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s - WORD $0x4eb584ca // add v10.4s, v6.4s, v21.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s - WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s - WORD $0x4eb684e9 // add v9.4s, v7.4s, v22.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s - WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s - WORD $0x4eb7850a // add v10.4s, v8.4s, v23.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e282907 // sha256su0 v7.4s, v8.4s - WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s - WORD $0x4eb884a9 // add v9.4s, v5.4s, v24.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s - WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s - WORD $0x4eb984ca // add v10.4s, v6.4s, v25.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e2828c5 // sha256su0 v5.4s, v6.4s - WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s - WORD $0x4eba84e9 // add v9.4s, v7.4s, v26.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828e6 // sha256su0 v6.4s, v7.4s - WORD $0x5e0860e5 // sha256su1 v5.4s, v7.4s, v8.4s - WORD $0x4ebb850a // add v10.4s, v8.4s, v27.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e282907 // sha256su0 v7.4s, v8.4s - WORD $0x5e056106 // sha256su1 v6.4s, v8.4s, v5.4s - WORD $0x4ebc84a9 // add v9.4s, v5.4s, v28.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x5e2828a8 // sha256su0 v8.4s, v5.4s - WORD $0x5e0660a7 // sha256su1 v7.4s, v5.4s, v6.4s - WORD $0x4ebd84ca // add v10.4s, v6.4s, v29.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x5e0760c8 // sha256su1 v8.4s, v6.4s, v7.4s - WORD $0x4ebe84e9 // add v9.4s, v7.4s, v30.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x4ebf850a // add v10.4s, v8.4s, v31.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e094062 // sha256h q2, q3, v9.4s - WORD $0x5e095083 // sha256h2 q3, q4, v9.4s - WORD $0x4ea21c44 // mov v4.16b, v2.16b - WORD $0x5e0a4062 // sha256h q2, q3, v10.4s - WORD $0x5e0a5083 // sha256h2 q3, q4, v10.4s - WORD $0x4ea38421 // add v1.4s, v1.4s, v3.4s - WORD $0x4ea28400 // add v0.4s, v0.4s, v2.4s - - SUBS $64, R2 - BPL loop - - // Store result - WORD $0x4c00a800 // st1 {v0.4s, v1.4s}, [x0] - -complete: - RET - -// Constants table -DATA ·constants+0x0(SB)/8, $0x71374491428a2f98 -DATA ·constants+0x8(SB)/8, $0xe9b5dba5b5c0fbcf -DATA ·constants+0x10(SB)/8, $0x59f111f13956c25b -DATA ·constants+0x18(SB)/8, $0xab1c5ed5923f82a4 -DATA ·constants+0x20(SB)/8, $0x12835b01d807aa98 -DATA ·constants+0x28(SB)/8, $0x550c7dc3243185be -DATA ·constants+0x30(SB)/8, $0x80deb1fe72be5d74 -DATA ·constants+0x38(SB)/8, $0xc19bf1749bdc06a7 -DATA ·constants+0x40(SB)/8, $0xefbe4786e49b69c1 -DATA ·constants+0x48(SB)/8, $0x240ca1cc0fc19dc6 -DATA ·constants+0x50(SB)/8, $0x4a7484aa2de92c6f -DATA ·constants+0x58(SB)/8, $0x76f988da5cb0a9dc -DATA ·constants+0x60(SB)/8, $0xa831c66d983e5152 -DATA ·constants+0x68(SB)/8, $0xbf597fc7b00327c8 -DATA ·constants+0x70(SB)/8, $0xd5a79147c6e00bf3 -DATA ·constants+0x78(SB)/8, $0x1429296706ca6351 -DATA ·constants+0x80(SB)/8, $0x2e1b213827b70a85 -DATA ·constants+0x88(SB)/8, $0x53380d134d2c6dfc -DATA ·constants+0x90(SB)/8, $0x766a0abb650a7354 -DATA ·constants+0x98(SB)/8, $0x92722c8581c2c92e -DATA ·constants+0xa0(SB)/8, $0xa81a664ba2bfe8a1 -DATA ·constants+0xa8(SB)/8, $0xc76c51a3c24b8b70 -DATA ·constants+0xb0(SB)/8, $0xd6990624d192e819 -DATA ·constants+0xb8(SB)/8, $0x106aa070f40e3585 -DATA ·constants+0xc0(SB)/8, $0x1e376c0819a4c116 -DATA ·constants+0xc8(SB)/8, $0x34b0bcb52748774c -DATA ·constants+0xd0(SB)/8, $0x4ed8aa4a391c0cb3 -DATA ·constants+0xd8(SB)/8, $0x682e6ff35b9cca4f -DATA ·constants+0xe0(SB)/8, $0x78a5636f748f82ee -DATA ·constants+0xe8(SB)/8, $0x8cc7020884c87814 -DATA ·constants+0xf0(SB)/8, $0xa4506ceb90befffa -DATA ·constants+0xf8(SB)/8, $0xc67178f2bef9a3f7 - -GLOBL ·constants(SB), 8, $256 - diff --git a/vendor/github.com/minio/sha256-simd/sha256block_other.go b/vendor/github.com/minio/sha256-simd/sha256block_other.go deleted file mode 100644 index 0930d2a2..00000000 --- a/vendor/github.com/minio/sha256-simd/sha256block_other.go +++ /dev/null @@ -1,25 +0,0 @@ -//+build noasm appengine ppc64 ppc64le mips mipsle mips64 mips64le s390x wasm - -/* - * Minio Cloud Storage, (C) 2019 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sha256 - -func blockAvx2Go(dig *digest, p []byte) {} -func blockAvxGo(dig *digest, p []byte) {} -func blockSsseGo(dig *digest, p []byte) {} -func blockShaGo(dig *digest, p []byte) {} -func blockArmGo(dig *digest, p []byte) {} diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go index 25378537..fb87bef9 100644 --- a/vendor/github.com/mitchellh/go-homedir/homedir.go +++ b/vendor/github.com/mitchellh/go-homedir/homedir.go @@ -76,16 +76,6 @@ func Expand(path string) (string, error) { return filepath.Join(dir, path[1:]), nil } -// Reset clears the cache, forcing the next call to Dir to re-detect -// the home directory. This generally never has to be called, but can be -// useful in tests if you're modifying the home directory via the HOME -// env var or something. -func Reset() { - cacheLock.Lock() - defer cacheLock.Unlock() - homedirCache = "" -} - func dirUnix() (string, error) { homeEnv := "HOME" if runtime.GOOS == "plan9" { diff --git a/vendor/github.com/mitchellh/mapstructure/.travis.yml b/vendor/github.com/mitchellh/mapstructure/.travis.yml index 1689c7d7..d9deadb8 100644 --- a/vendor/github.com/mitchellh/mapstructure/.travis.yml +++ b/vendor/github.com/mitchellh/mapstructure/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - "1.11.x" + - 1.9.x - tip script: diff --git a/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md b/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md deleted file mode 100644 index 3b3cb723..00000000 --- a/vendor/github.com/mitchellh/mapstructure/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -## 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. diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go index 1f0abc65..2a727575 100644 --- a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go +++ b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go @@ -2,8 +2,6 @@ package mapstructure import ( "errors" - "fmt" - "net" "reflect" "strconv" "strings" @@ -117,50 +115,6 @@ 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 // strings to time.Time. func StringToTimeHookFunc(layout string) DecodeHookFunc { diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go index 256ee63f..d3222b8f 100644 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure.go +++ b/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -224,17 +224,6 @@ func (d *Decoder) Decode(input interface{}) error { // Decodes an unknown data type into a specific reflection value. 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 the data is nil, then we don't set anything, unless ZeroFields is set // to true. @@ -248,6 +237,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e return nil } + inputVal := reflect.ValueOf(input) if !inputVal.IsValid() { // If the input value is invalid, then we just set the value // to be the zero value. @@ -270,8 +260,8 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e } var err error - outputKind := getKind(outVal) - switch outputKind { + inputKind := getKind(outVal) + switch inputKind { case reflect.Bool: err = d.decodeBool(name, input, outVal) case reflect.Interface: @@ -298,7 +288,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e err = d.decodeFunc(name, input, outVal) default: // If we reached this point then we weren't able to decode it - return fmt.Errorf("%s: unsupported type: %s", name, outputKind) + return fmt.Errorf("%s: unsupported type: %s", name, inputKind) } // If we reached here, then we successfully decoded SOMETHING, so @@ -316,16 +306,7 @@ func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) if val.IsValid() && val.Elem().IsValid() { return d.decode(name, data, val.Elem()) } - 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() { dataVal = reflect.Zero(val.Type()) } @@ -342,7 +323,7 @@ func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) } func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error { - dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataVal := reflect.ValueOf(data) dataKind := getKind(dataVal) converted := true @@ -394,7 +375,7 @@ func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) } func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error { - dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataVal := reflect.ValueOf(data) dataKind := getKind(dataVal) dataType := dataVal.Type() @@ -436,7 +417,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 { - dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataVal := reflect.ValueOf(data) dataKind := getKind(dataVal) switch { @@ -479,7 +460,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 { - dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataVal := reflect.ValueOf(data) dataKind := getKind(dataVal) switch { @@ -510,7 +491,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 { - dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataVal := reflect.ValueOf(data) dataKind := getKind(dataVal) dataType := dataVal.Type() @@ -614,20 +595,6 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle // Accumulate errors 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() { fieldName := fmt.Sprintf("%s[%s]", name, k) @@ -739,33 +706,11 @@ func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val re } 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 // into that. Then set the value of the pointer to this type. valType := val.Type() valElemType := valType.Elem() + if val.CanSet() { realVal := val if realVal.IsNil() || d.config.ZeroFields { @@ -807,44 +752,33 @@ func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) valSlice := val 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 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( "'%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. valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len()) } @@ -954,29 +888,10 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) } dataValKind := dataVal.Kind() - switch 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()) + if dataValKind != reflect.Map { + return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind) } -} -func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) error { dataValType := dataVal.Type() if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface { return fmt.Errorf( diff --git a/vendor/github.com/mmcloughlin/avo/LICENSE b/vendor/github.com/mmcloughlin/avo/LICENSE deleted file mode 100644 index c986d807..00000000 --- a/vendor/github.com/mmcloughlin/avo/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2018, Michael McLoughlin -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/mmcloughlin/avo/attr/attr.go b/vendor/github.com/mmcloughlin/avo/attr/attr.go deleted file mode 100644 index 9173773f..00000000 --- a/vendor/github.com/mmcloughlin/avo/attr/attr.go +++ /dev/null @@ -1,97 +0,0 @@ -// Package attr provides attributes for text and data sections. -package attr - -import ( - "fmt" - "math/bits" - "strings" -) - -// Attribute represents TEXT or DATA flags. -type Attribute uint16 - -// Reference: https://github.com/golang/go/blob/35f4ec152b44ae5fc83aaf68e2eb3aa1a778e5cd/src/runtime/textflag.h#L11-L34 -// -// // Don't profile the marked routine. This flag is deprecated. -// #define NOPROF 1 -// // It is ok for the linker to get multiple of these symbols. It will -// // pick one of the duplicates to use. -// #define DUPOK 2 -// // Don't insert stack check preamble. -// #define NOSPLIT 4 -// // Put this data in a read-only section. -// #define RODATA 8 -// // This data contains no pointers. -// #define NOPTR 16 -// // This is a wrapper function and should not count as disabling 'recover'. -// #define WRAPPER 32 -// // This function uses its incoming context register. -// #define NEEDCTXT 64 -// // Allocate a word of thread local storage and store the offset from the -// // thread local base to the thread local storage in this variable. -// #define TLSBSS 256 -// // Do not insert instructions to allocate a stack frame for this function. -// // Only valid on functions that declare a frame size of 0. -// // TODO(mwhudson): only implemented for ppc64x at present. -// #define NOFRAME 512 -// // Function can call reflect.Type.Method or reflect.Type.MethodByName. -// #define REFLECTMETHOD 1024 -// -const ( - NOPROF Attribute = 1 << iota - DUPOK - NOSPLIT - RODATA - NOPTR - WRAPPER - NEEDCTXT - _ - TLSBSS - NOFRAME - REFLECTMETHOD -) - -// Asm returns a representation of the attributes in assembly syntax. This may use macros from "textflags.h"; see ContainsTextFlags() to determine if this header is required. -func (a Attribute) Asm() string { - parts, rest := a.split() - if len(parts) == 0 || rest != 0 { - parts = append(parts, fmt.Sprintf("%d", rest)) - } - return strings.Join(parts, "|") -} - -// ContainsTextFlags returns whether the Asm() representation requires macros in "textflags.h". -func (a Attribute) ContainsTextFlags() bool { - flags, _ := a.split() - return len(flags) > 0 -} - -// split splits a into known flags and any remaining bits. -func (a Attribute) split() ([]string, Attribute) { - var flags []string - var rest Attribute - for a != 0 { - i := uint(bits.TrailingZeros16(uint16(a))) - bit := Attribute(1) << i - if flag := attrname[bit]; flag != "" { - flags = append(flags, flag) - } else { - rest |= bit - } - a ^= bit - } - return flags, rest -} - -var attrname = map[Attribute]string{ - NOPROF: "NOPROF", - DUPOK: "DUPOK", - NOSPLIT: "NOSPLIT", - RODATA: "RODATA", - NOPTR: "NOPTR", - WRAPPER: "WRAPPER", - NEEDCTXT: "NEEDCTXT", - TLSBSS: "TLSBSS", - NOFRAME: "NOFRAME", - // REFLECTMETHOD excluded due to https://golang.org/issue/29487 -} diff --git a/vendor/github.com/mmcloughlin/avo/build/attr.go b/vendor/github.com/mmcloughlin/avo/build/attr.go deleted file mode 100644 index d337537c..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/attr.go +++ /dev/null @@ -1,17 +0,0 @@ -package build - -import "github.com/mmcloughlin/avo/attr" - -// TEXT and DATA attribute values included for convenience. -const ( - NOPROF = attr.NOPROF - DUPOK = attr.DUPOK - NOSPLIT = attr.NOSPLIT - RODATA = attr.RODATA - NOPTR = attr.NOPTR - WRAPPER = attr.WRAPPER - NEEDCTXT = attr.NEEDCTXT - TLSBSS = attr.TLSBSS - NOFRAME = attr.NOFRAME - REFLECTMETHOD = attr.REFLECTMETHOD -) diff --git a/vendor/github.com/mmcloughlin/avo/build/cli.go b/vendor/github.com/mmcloughlin/avo/build/cli.go deleted file mode 100644 index 7474cbca..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/cli.go +++ /dev/null @@ -1,165 +0,0 @@ -package build - -import ( - "flag" - "io" - "log" - "os" - "runtime/pprof" - - "github.com/mmcloughlin/avo/pass" - "github.com/mmcloughlin/avo/printer" -) - -// Config contains options for an avo main function. -type Config struct { - ErrOut io.Writer - MaxErrors int // max errors to report; 0 means unlimited - CPUProfile io.WriteCloser - Passes []pass.Interface -} - -// Main is the standard main function for an avo program. This extracts the -// result from the build Context (logging and exiting on error), and performs -// configured passes. -func Main(cfg *Config, context *Context) int { - diag := log.New(cfg.ErrOut, "", 0) - - if cfg.CPUProfile != nil { - defer cfg.CPUProfile.Close() - if err := pprof.StartCPUProfile(cfg.CPUProfile); err != nil { - diag.Println("could not start CPU profile: ", err) - return 1 - } - defer pprof.StopCPUProfile() - } - - f, err := context.Result() - if err != nil { - LogError(diag, err, cfg.MaxErrors) - return 1 - } - - p := pass.Concat(cfg.Passes...) - if err := p.Execute(f); err != nil { - diag.Println(err) - return 1 - } - - return 0 -} - -// Flags represents CLI flags for an avo program. -type Flags struct { - errout *outputValue - allerrors bool - cpuprof *outputValue - printers []*printerValue -} - -// NewFlags initializes avo flags for the given FlagSet. -func NewFlags(fs *flag.FlagSet) *Flags { - f := &Flags{} - - f.errout = newOutputValue(os.Stderr) - fs.Var(f.errout, "log", "diagnostics output") - - fs.BoolVar(&f.allerrors, "e", false, "no limit on number of errors reported") - - f.cpuprof = newOutputValue(nil) - fs.Var(f.cpuprof, "cpuprofile", "write cpu profile to `file`") - - goasm := newPrinterValue(printer.NewGoAsm, os.Stdout) - fs.Var(goasm, "out", "assembly output") - f.printers = append(f.printers, goasm) - - stubs := newPrinterValue(printer.NewStubs, nil) - fs.Var(stubs, "stubs", "go stub file") - f.printers = append(f.printers, stubs) - - return f -} - -// Config builds a configuration object based on flag values. -func (f *Flags) Config() *Config { - pc := printer.NewGoRunConfig() - passes := []pass.Interface{pass.Compile} - for _, pv := range f.printers { - p := pv.Build(pc) - if p != nil { - passes = append(passes, p) - } - } - - cfg := &Config{ - ErrOut: f.errout.w, - MaxErrors: 10, - CPUProfile: f.cpuprof.w, - Passes: passes, - } - - if f.allerrors { - cfg.MaxErrors = 0 - } - - return cfg -} - -type outputValue struct { - w io.WriteCloser - filename string -} - -func newOutputValue(dflt io.WriteCloser) *outputValue { - return &outputValue{w: dflt} -} - -func (o *outputValue) String() string { - if o == nil { - return "" - } - return o.filename -} - -func (o *outputValue) Set(s string) error { - o.filename = s - if s == "-" { - o.w = nopwritecloser{os.Stdout} - return nil - } - f, err := os.Create(s) - if err != nil { - return err - } - o.w = f - return nil -} - -type printerValue struct { - *outputValue - Builder printer.Builder -} - -func newPrinterValue(b printer.Builder, dflt io.WriteCloser) *printerValue { - return &printerValue{ - outputValue: newOutputValue(dflt), - Builder: b, - } -} - -func (p *printerValue) Build(cfg printer.Config) pass.Interface { - if p.outputValue.w == nil { - return nil - } - return &pass.Output{ - Writer: p.outputValue.w, - Printer: p.Builder(cfg), - } -} - -// nopwritecloser wraps a Writer and provides a null implementation of Close(). -type nopwritecloser struct { - io.Writer -} - -func (nopwritecloser) Close() error { return nil } diff --git a/vendor/github.com/mmcloughlin/avo/build/context.go b/vendor/github.com/mmcloughlin/avo/build/context.go deleted file mode 100644 index d1a1ec51..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/context.go +++ /dev/null @@ -1,217 +0,0 @@ -package build - -import ( - "errors" - "fmt" - "go/types" - - "github.com/mmcloughlin/avo/attr" - "github.com/mmcloughlin/avo/buildtags" - "github.com/mmcloughlin/avo/gotypes" - "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/reg" - "golang.org/x/tools/go/packages" -) - -// Context maintains state for incrementally building an avo File. -type Context struct { - pkg *packages.Package - file *ir.File - function *ir.Function - global *ir.Global - errs ErrorList - reg.Collection -} - -// NewContext initializes an empty build Context. -func NewContext() *Context { - return &Context{ - file: ir.NewFile(), - Collection: *reg.NewCollection(), - } -} - -// Package sets the package the generated file will belong to. Required to be able to reference types in the package. -func (c *Context) Package(path string) { - cfg := &packages.Config{ - Mode: packages.NeedTypes | packages.NeedDeps, - } - pkgs, err := packages.Load(cfg, path) - if err != nil { - c.adderror(err) - return - } - pkg := pkgs[0] - if len(pkg.Errors) > 0 { - for _, err := range pkg.Errors { - c.adderror(err) - } - return - } - c.pkg = pkg -} - -// Constraints sets build constraints for the file. -func (c *Context) Constraints(t buildtags.ConstraintsConvertable) { - cs := t.ToConstraints() - if err := cs.Validate(); err != nil { - c.adderror(err) - return - } - c.file.Constraints = cs -} - -// Constraint appends a constraint to the file's build constraints. -func (c *Context) Constraint(t buildtags.ConstraintConvertable) { - c.Constraints(append(c.file.Constraints, t.ToConstraint())) -} - -// ConstraintExpr appends a constraint to the file's build constraints. The -// constraint to add is parsed from the given expression. The expression should -// look the same as the content following "// +build " in regular build -// constraint comments. -func (c *Context) ConstraintExpr(expr string) { - constraint, err := buildtags.ParseConstraint(expr) - if err != nil { - c.adderror(err) - return - } - c.Constraint(constraint) -} - -// Function starts building a new function with the given name. -func (c *Context) Function(name string) { - c.function = ir.NewFunction(name) - c.file.AddSection(c.function) -} - -// Doc sets documentation comment lines for the currently active function. -func (c *Context) Doc(lines ...string) { - c.activefunc().Doc = lines -} - -// Attributes sets function attributes for the currently active function. -func (c *Context) Attributes(a attr.Attribute) { - c.activefunc().Attributes = a -} - -// Signature sets the signature for the currently active function. -func (c *Context) Signature(s *gotypes.Signature) { - c.activefunc().SetSignature(s) -} - -// SignatureExpr parses the signature expression and sets it as the active function's signature. -func (c *Context) SignatureExpr(expr string) { - s, err := gotypes.ParseSignatureInPackage(c.types(), expr) - if err != nil { - c.adderror(err) - return - } - c.Signature(s) -} - -// Implement starts building a function of the given name, whose type is -// specified by a stub in the containing package. -func (c *Context) Implement(name string) { - pkg := c.types() - if pkg == nil { - c.adderrormessage("no package specified") - return - } - s, err := gotypes.LookupSignature(pkg, name) - if err != nil { - c.adderror(err) - return - } - c.Function(name) - c.Signature(s) -} - -func (c *Context) types() *types.Package { - if c.pkg == nil { - return nil - } - return c.pkg.Types -} - -// AllocLocal allocates size bytes in the stack of the currently active function. -// Returns a reference to the base pointer for the newly allocated region. -func (c *Context) AllocLocal(size int) operand.Mem { - return c.activefunc().AllocLocal(size) -} - -// Instruction adds an instruction to the active function. -func (c *Context) Instruction(i *ir.Instruction) { - c.activefunc().AddInstruction(i) -} - -// Label adds a label to the active function. -func (c *Context) Label(name string) { - c.activefunc().AddLabel(ir.Label(name)) -} - -// Comment adds comment lines to the active function. -func (c *Context) Comment(lines ...string) { - c.activefunc().AddComment(lines...) -} - -// Commentf adds a formtted comment line. -func (c *Context) Commentf(format string, a ...interface{}) { - c.Comment(fmt.Sprintf(format, a...)) -} - -func (c *Context) activefunc() *ir.Function { - if c.function == nil { - c.adderrormessage("no active function") - return ir.NewFunction("") - } - return c.function -} - -//go:generate avogen -output zinstructions.go build - -// StaticGlobal adds a new static data section to the file and returns a pointer to it. -func (c *Context) StaticGlobal(name string) operand.Mem { - c.global = ir.NewStaticGlobal(name) - c.file.AddSection(c.global) - return c.global.Base() -} - -// DataAttributes sets the attributes on the current active global data section. -func (c *Context) DataAttributes(a attr.Attribute) { - c.activeglobal().Attributes = a -} - -// AddDatum adds constant v at offset to the current active global data section. -func (c *Context) AddDatum(offset int, v operand.Constant) { - if err := c.activeglobal().AddDatum(ir.NewDatum(offset, v)); err != nil { - c.adderror(err) - } -} - -// AppendDatum appends a constant to the current active global data section. -func (c *Context) AppendDatum(v operand.Constant) { - c.activeglobal().Append(v) -} - -func (c *Context) activeglobal() *ir.Global { - if c.global == nil { - c.adderrormessage("no active global") - return ir.NewStaticGlobal("") - } - return c.global -} - -func (c *Context) adderror(err error) { - c.errs.addext(err) -} - -func (c *Context) adderrormessage(msg string) { - c.adderror(errors.New(msg)) -} - -// Result returns the built file and any accumulated errors. -func (c *Context) Result() (*ir.File, error) { - return c.file, c.errs.Err() -} diff --git a/vendor/github.com/mmcloughlin/avo/build/doc.go b/vendor/github.com/mmcloughlin/avo/build/doc.go deleted file mode 100644 index 8b9a6047..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package build provides an assembly-like interface for incremental building of avo Files. -package build diff --git a/vendor/github.com/mmcloughlin/avo/build/error.go b/vendor/github.com/mmcloughlin/avo/build/error.go deleted file mode 100644 index 1da00cbf..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/error.go +++ /dev/null @@ -1,88 +0,0 @@ -package build - -import ( - "fmt" - "log" - - "github.com/mmcloughlin/avo/internal/stack" - "github.com/mmcloughlin/avo/src" -) - -// Error represents an error during building, optionally tagged with the position at which it happened. -type Error struct { - Position src.Position - Err error -} - -// exterr constructs an Error with position derived from the first frame in the -// call stack outside this package. -func exterr(err error) Error { - e := Error{Err: err} - if f := stack.ExternalCaller(); f != nil { - e.Position = src.FramePosition(*f).Relwd() - } - return e -} - -func (e Error) Error() string { - msg := e.Err.Error() - if e.Position.IsValid() { - return e.Position.String() + ": " + msg - } - return msg -} - -// ErrorList is a collection of errors for a source file. -type ErrorList []Error - -// Add appends an error to the list. -func (e *ErrorList) Add(err Error) { - *e = append(*e, err) -} - -// AddAt appends an error at position p. -func (e *ErrorList) AddAt(p src.Position, err error) { - e.Add(Error{p, err}) -} - -// addext appends an error to the list, tagged with the -func (e *ErrorList) addext(err error) { - e.Add(exterr(err)) -} - -// Err returns an error equivalent to this error list. -// If the list is empty, Err returns nil. -func (e ErrorList) Err() error { - if len(e) == 0 { - return nil - } - return e -} - -// An ErrorList implements the error interface. -func (e ErrorList) Error() string { - switch len(e) { - case 0: - return "no errors" - case 1: - return e[0].Error() - } - return fmt.Sprintf("%s (and %d more errors)", e[0], len(e)-1) -} - -// LogError logs a list of errors, one error per line, if the err parameter is -// an ErrorList. Otherwise it just logs the err string. Reports at most max -// errors, or unlimited if max is 0. -func LogError(l *log.Logger, err error, max int) { - if list, ok := err.(ErrorList); ok { - for i, e := range list { - if max > 0 && i == max { - l.Print("too many errors") - return - } - l.Printf("%s\n", e) - } - } else if err != nil { - l.Printf("%s\n", err) - } -} diff --git a/vendor/github.com/mmcloughlin/avo/build/global.go b/vendor/github.com/mmcloughlin/avo/build/global.go deleted file mode 100644 index 148b90cf..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/global.go +++ /dev/null @@ -1,142 +0,0 @@ -package build - -import ( - "flag" - "os" - - "github.com/mmcloughlin/avo/attr" - "github.com/mmcloughlin/avo/buildtags" - "github.com/mmcloughlin/avo/gotypes" - "github.com/mmcloughlin/avo/operand" - - "github.com/mmcloughlin/avo/reg" -) - -// ctx provides a global build context. -var ctx = NewContext() - -// TEXT starts building a new function called name, with attributes a, and sets its signature (see SignatureExpr). -func TEXT(name string, a attr.Attribute, signature string) { - ctx.Function(name) - ctx.Attributes(a) - ctx.SignatureExpr(signature) -} - -// GLOBL declares a new static global data section with the given attributes. -func GLOBL(name string, a attr.Attribute) operand.Mem { - // TODO(mbm): should this be static? - g := ctx.StaticGlobal(name) - ctx.DataAttributes(a) - return g -} - -// DATA adds a data value to the active data section. -func DATA(offset int, v operand.Constant) { - ctx.AddDatum(offset, v) -} - -var flags = NewFlags(flag.CommandLine) - -// Generate builds and compiles the avo file built with the global context. This -// should be the final line of any avo program. Configuration is determined from command-line flags. -func Generate() { - if !flag.Parsed() { - flag.Parse() - } - cfg := flags.Config() - - status := Main(cfg, ctx) - - // To record coverage of integration tests we wrap main() functions in a test - // functions. In this case we need the main function to terminate, therefore we - // only exit for failure status codes. - if status != 0 { - os.Exit(status) - } -} - -// Package sets the package the generated file will belong to. Required to be able to reference types in the package. -func Package(path string) { ctx.Package(path) } - -// Constraints sets build constraints for the file. -func Constraints(t buildtags.ConstraintsConvertable) { ctx.Constraints(t) } - -// Constraint appends a constraint to the file's build constraints. -func Constraint(t buildtags.ConstraintConvertable) { ctx.Constraint(t) } - -// ConstraintExpr appends a constraint to the file's build constraints. The -// constraint to add is parsed from the given expression. The expression should -// look the same as the content following "// +build " in regular build -// constraint comments. -func ConstraintExpr(expr string) { ctx.ConstraintExpr(expr) } - -// GP8 allocates and returns a general-purpose 8-bit register. -func GP8() reg.GPVirtual { return ctx.GP8() } - -// GP16 allocates and returns a general-purpose 16-bit register. -func GP16() reg.GPVirtual { return ctx.GP16() } - -// GP32 allocates and returns a general-purpose 32-bit register. -func GP32() reg.GPVirtual { return ctx.GP32() } - -// GP64 allocates and returns a general-purpose 64-bit register. -func GP64() reg.GPVirtual { return ctx.GP64() } - -// XMM allocates and returns a 128-bit vector register. -func XMM() reg.VecVirtual { return ctx.XMM() } - -// YMM allocates and returns a 256-bit vector register. -func YMM() reg.VecVirtual { return ctx.YMM() } - -// ZMM allocates and returns a 512-bit vector register. -func ZMM() reg.VecVirtual { return ctx.ZMM() } - -// Param returns a the named argument of the active function. -func Param(name string) gotypes.Component { return ctx.Param(name) } - -// ParamIndex returns the ith argument of the active function. -func ParamIndex(i int) gotypes.Component { return ctx.ParamIndex(i) } - -// Return returns a the named return value of the active function. -func Return(name string) gotypes.Component { return ctx.Return(name) } - -// ReturnIndex returns the ith argument of the active function. -func ReturnIndex(i int) gotypes.Component { return ctx.ReturnIndex(i) } - -// Load the function argument src into register dst. Returns the destination -// register. This is syntactic sugar: it will attempt to select the right MOV -// instruction based on the types involved. -func Load(src gotypes.Component, dst reg.Register) reg.Register { return ctx.Load(src, dst) } - -// Store register src into return value dst. This is syntactic sugar: it will -// attempt to select the right MOV instruction based on the types involved. -func Store(src reg.Register, dst gotypes.Component) { ctx.Store(src, dst) } - -// Dereference loads a pointer and returns its element type. -func Dereference(ptr gotypes.Component) gotypes.Component { return ctx.Dereference(ptr) } - -// Doc sets documentation comment lines for the currently active function. -func Doc(lines ...string) { ctx.Doc(lines...) } - -// Attributes sets function attributes for the currently active function. -func Attributes(a attr.Attribute) { ctx.Attributes(a) } - -// Implement starts building a function of the given name, whose type is -// specified by a stub in the containing package. -func Implement(name string) { ctx.Implement(name) } - -// AllocLocal allocates size bytes in the stack of the currently active function. -// Returns a reference to the base pointer for the newly allocated region. -func AllocLocal(size int) operand.Mem { return ctx.AllocLocal(size) } - -// Label adds a label to the active function. -func Label(name string) { ctx.Label(name) } - -// Comment adds comment lines to the active function. -func Comment(lines ...string) { ctx.Comment(lines...) } - -// Commentf adds a formtted comment line. -func Commentf(format string, a ...interface{}) { ctx.Commentf(format, a...) } - -// ConstData builds a static data section containing just the given constant. -func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) } diff --git a/vendor/github.com/mmcloughlin/avo/build/pseudo.go b/vendor/github.com/mmcloughlin/avo/build/pseudo.go deleted file mode 100644 index 83a570e4..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/pseudo.go +++ /dev/null @@ -1,70 +0,0 @@ -package build - -import ( - "github.com/mmcloughlin/avo/attr" - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/reg" - - "github.com/mmcloughlin/avo/gotypes" -) - -//go:generate avogen -output zmov.go mov - -// Param returns a the named argument of the active function. -func (c *Context) Param(name string) gotypes.Component { - return c.activefunc().Signature.Params().Lookup(name) -} - -// ParamIndex returns the ith argument of the active function. -func (c *Context) ParamIndex(i int) gotypes.Component { - return c.activefunc().Signature.Params().At(i) -} - -// Return returns a the named return value of the active function. -func (c *Context) Return(name string) gotypes.Component { - return c.activefunc().Signature.Results().Lookup(name) -} - -// ReturnIndex returns the ith argument of the active function. -func (c *Context) ReturnIndex(i int) gotypes.Component { - return c.activefunc().Signature.Results().At(i) -} - -// Load the function argument src into register dst. Returns the destination -// register. This is syntactic sugar: it will attempt to select the right MOV -// instruction based on the types involved. -func (c *Context) Load(src gotypes.Component, dst reg.Register) reg.Register { - b, err := src.Resolve() - if err != nil { - c.adderror(err) - return dst - } - c.mov(b.Addr, dst, int(gotypes.Sizes.Sizeof(b.Type)), int(dst.Size()), b.Type) - return dst -} - -// Store register src into return value dst. This is syntactic sugar: it will -// attempt to select the right MOV instruction based on the types involved. -func (c *Context) Store(src reg.Register, dst gotypes.Component) { - b, err := dst.Resolve() - if err != nil { - c.adderror(err) - return - } - c.mov(src, b.Addr, int(src.Size()), int(gotypes.Sizes.Sizeof(b.Type)), b.Type) -} - -// Dereference loads a pointer and returns its element type. -func (c *Context) Dereference(ptr gotypes.Component) gotypes.Component { - r := c.GP64() - c.Load(ptr, r) - return ptr.Dereference(r) -} - -// ConstData builds a static data section containing just the given constant. -func (c *Context) ConstData(name string, v operand.Constant) operand.Mem { - g := c.StaticGlobal(name) - c.DataAttributes(attr.RODATA | attr.NOPTR) - c.AppendDatum(v) - return g -} diff --git a/vendor/github.com/mmcloughlin/avo/build/zinstructions.go b/vendor/github.com/mmcloughlin/avo/build/zinstructions.go deleted file mode 100644 index 33c2085e..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/zinstructions.go +++ /dev/null @@ -1,26315 +0,0 @@ -// Code generated by command: avogen -output zinstructions.go build. DO NOT EDIT. - -package build - -import ( - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/x86" -) - -// ADCB: Add with Carry. -// -// Forms: -// -// ADCB imm8 al -// ADCB imm8 r8 -// ADCB r8 r8 -// ADCB m8 r8 -// ADCB imm8 m8 -// ADCB r8 m8 -// Construct and append a ADCB instruction to the active function. -func (c *Context) ADCB(imr, amr operand.Op) { - if inst, err := x86.ADCB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCB: Add with Carry. -// -// Forms: -// -// ADCB imm8 al -// ADCB imm8 r8 -// ADCB r8 r8 -// ADCB m8 r8 -// ADCB imm8 m8 -// ADCB r8 m8 -// Construct and append a ADCB instruction to the active function. -// Operates on the global context. -func ADCB(imr, amr operand.Op) { ctx.ADCB(imr, amr) } - -// ADCL: Add with Carry. -// -// Forms: -// -// ADCL imm32 eax -// ADCL imm8 r32 -// ADCL imm32 r32 -// ADCL r32 r32 -// ADCL m32 r32 -// ADCL imm8 m32 -// ADCL imm32 m32 -// ADCL r32 m32 -// Construct and append a ADCL instruction to the active function. -func (c *Context) ADCL(imr, emr operand.Op) { - if inst, err := x86.ADCL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCL: Add with Carry. -// -// Forms: -// -// ADCL imm32 eax -// ADCL imm8 r32 -// ADCL imm32 r32 -// ADCL r32 r32 -// ADCL m32 r32 -// ADCL imm8 m32 -// ADCL imm32 m32 -// ADCL r32 m32 -// Construct and append a ADCL instruction to the active function. -// Operates on the global context. -func ADCL(imr, emr operand.Op) { ctx.ADCL(imr, emr) } - -// ADCQ: Add with Carry. -// -// Forms: -// -// ADCQ imm32 rax -// ADCQ imm8 r64 -// ADCQ imm32 r64 -// ADCQ r64 r64 -// ADCQ m64 r64 -// ADCQ imm8 m64 -// ADCQ imm32 m64 -// ADCQ r64 m64 -// Construct and append a ADCQ instruction to the active function. -func (c *Context) ADCQ(imr, mr operand.Op) { - if inst, err := x86.ADCQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCQ: Add with Carry. -// -// Forms: -// -// ADCQ imm32 rax -// ADCQ imm8 r64 -// ADCQ imm32 r64 -// ADCQ r64 r64 -// ADCQ m64 r64 -// ADCQ imm8 m64 -// ADCQ imm32 m64 -// ADCQ r64 m64 -// Construct and append a ADCQ instruction to the active function. -// Operates on the global context. -func ADCQ(imr, mr operand.Op) { ctx.ADCQ(imr, mr) } - -// ADCW: Add with Carry. -// -// Forms: -// -// ADCW imm16 ax -// ADCW imm8 r16 -// ADCW imm16 r16 -// ADCW r16 r16 -// ADCW m16 r16 -// ADCW imm8 m16 -// ADCW imm16 m16 -// ADCW r16 m16 -// Construct and append a ADCW instruction to the active function. -func (c *Context) ADCW(imr, amr operand.Op) { - if inst, err := x86.ADCW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCW: Add with Carry. -// -// Forms: -// -// ADCW imm16 ax -// ADCW imm8 r16 -// ADCW imm16 r16 -// ADCW r16 r16 -// ADCW m16 r16 -// ADCW imm8 m16 -// ADCW imm16 m16 -// ADCW r16 m16 -// Construct and append a ADCW instruction to the active function. -// Operates on the global context. -func ADCW(imr, amr operand.Op) { ctx.ADCW(imr, amr) } - -// ADCXL: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXL r32 r32 -// ADCXL m32 r32 -// Construct and append a ADCXL instruction to the active function. -func (c *Context) ADCXL(mr, r operand.Op) { - if inst, err := x86.ADCXL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCXL: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXL r32 r32 -// ADCXL m32 r32 -// Construct and append a ADCXL instruction to the active function. -// Operates on the global context. -func ADCXL(mr, r operand.Op) { ctx.ADCXL(mr, r) } - -// ADCXQ: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXQ r64 r64 -// ADCXQ m64 r64 -// Construct and append a ADCXQ instruction to the active function. -func (c *Context) ADCXQ(mr, r operand.Op) { - if inst, err := x86.ADCXQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADCXQ: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXQ r64 r64 -// ADCXQ m64 r64 -// Construct and append a ADCXQ instruction to the active function. -// Operates on the global context. -func ADCXQ(mr, r operand.Op) { ctx.ADCXQ(mr, r) } - -// ADDB: Add. -// -// Forms: -// -// ADDB imm8 al -// ADDB imm8 r8 -// ADDB r8 r8 -// ADDB m8 r8 -// ADDB imm8 m8 -// ADDB r8 m8 -// Construct and append a ADDB instruction to the active function. -func (c *Context) ADDB(imr, amr operand.Op) { - if inst, err := x86.ADDB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDB: Add. -// -// Forms: -// -// ADDB imm8 al -// ADDB imm8 r8 -// ADDB r8 r8 -// ADDB m8 r8 -// ADDB imm8 m8 -// ADDB r8 m8 -// Construct and append a ADDB instruction to the active function. -// Operates on the global context. -func ADDB(imr, amr operand.Op) { ctx.ADDB(imr, amr) } - -// ADDL: Add. -// -// Forms: -// -// ADDL imm32 eax -// ADDL imm8 r32 -// ADDL imm32 r32 -// ADDL r32 r32 -// ADDL m32 r32 -// ADDL imm8 m32 -// ADDL imm32 m32 -// ADDL r32 m32 -// Construct and append a ADDL instruction to the active function. -func (c *Context) ADDL(imr, emr operand.Op) { - if inst, err := x86.ADDL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDL: Add. -// -// Forms: -// -// ADDL imm32 eax -// ADDL imm8 r32 -// ADDL imm32 r32 -// ADDL r32 r32 -// ADDL m32 r32 -// ADDL imm8 m32 -// ADDL imm32 m32 -// ADDL r32 m32 -// Construct and append a ADDL instruction to the active function. -// Operates on the global context. -func ADDL(imr, emr operand.Op) { ctx.ADDL(imr, emr) } - -// ADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDPD xmm xmm -// ADDPD m128 xmm -// Construct and append a ADDPD instruction to the active function. -func (c *Context) ADDPD(mx, x operand.Op) { - if inst, err := x86.ADDPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDPD xmm xmm -// ADDPD m128 xmm -// Construct and append a ADDPD instruction to the active function. -// Operates on the global context. -func ADDPD(mx, x operand.Op) { ctx.ADDPD(mx, x) } - -// ADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDPS xmm xmm -// ADDPS m128 xmm -// Construct and append a ADDPS instruction to the active function. -func (c *Context) ADDPS(mx, x operand.Op) { - if inst, err := x86.ADDPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDPS xmm xmm -// ADDPS m128 xmm -// Construct and append a ADDPS instruction to the active function. -// Operates on the global context. -func ADDPS(mx, x operand.Op) { ctx.ADDPS(mx, x) } - -// ADDQ: Add. -// -// Forms: -// -// ADDQ imm32 rax -// ADDQ imm8 r64 -// ADDQ imm32 r64 -// ADDQ r64 r64 -// ADDQ m64 r64 -// ADDQ imm8 m64 -// ADDQ imm32 m64 -// ADDQ r64 m64 -// Construct and append a ADDQ instruction to the active function. -func (c *Context) ADDQ(imr, mr operand.Op) { - if inst, err := x86.ADDQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDQ: Add. -// -// Forms: -// -// ADDQ imm32 rax -// ADDQ imm8 r64 -// ADDQ imm32 r64 -// ADDQ r64 r64 -// ADDQ m64 r64 -// ADDQ imm8 m64 -// ADDQ imm32 m64 -// ADDQ r64 m64 -// Construct and append a ADDQ instruction to the active function. -// Operates on the global context. -func ADDQ(imr, mr operand.Op) { ctx.ADDQ(imr, mr) } - -// ADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDSD xmm xmm -// ADDSD m64 xmm -// Construct and append a ADDSD instruction to the active function. -func (c *Context) ADDSD(mx, x operand.Op) { - if inst, err := x86.ADDSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDSD xmm xmm -// ADDSD m64 xmm -// Construct and append a ADDSD instruction to the active function. -// Operates on the global context. -func ADDSD(mx, x operand.Op) { ctx.ADDSD(mx, x) } - -// ADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDSS xmm xmm -// ADDSS m32 xmm -// Construct and append a ADDSS instruction to the active function. -func (c *Context) ADDSS(mx, x operand.Op) { - if inst, err := x86.ADDSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDSS xmm xmm -// ADDSS m32 xmm -// Construct and append a ADDSS instruction to the active function. -// Operates on the global context. -func ADDSS(mx, x operand.Op) { ctx.ADDSS(mx, x) } - -// ADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPD xmm xmm -// ADDSUBPD m128 xmm -// Construct and append a ADDSUBPD instruction to the active function. -func (c *Context) ADDSUBPD(mx, x operand.Op) { - if inst, err := x86.ADDSUBPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPD xmm xmm -// ADDSUBPD m128 xmm -// Construct and append a ADDSUBPD instruction to the active function. -// Operates on the global context. -func ADDSUBPD(mx, x operand.Op) { ctx.ADDSUBPD(mx, x) } - -// ADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPS xmm xmm -// ADDSUBPS m128 xmm -// Construct and append a ADDSUBPS instruction to the active function. -func (c *Context) ADDSUBPS(mx, x operand.Op) { - if inst, err := x86.ADDSUBPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPS xmm xmm -// ADDSUBPS m128 xmm -// Construct and append a ADDSUBPS instruction to the active function. -// Operates on the global context. -func ADDSUBPS(mx, x operand.Op) { ctx.ADDSUBPS(mx, x) } - -// ADDW: Add. -// -// Forms: -// -// ADDW imm16 ax -// ADDW imm8 r16 -// ADDW imm16 r16 -// ADDW r16 r16 -// ADDW m16 r16 -// ADDW imm8 m16 -// ADDW imm16 m16 -// ADDW r16 m16 -// Construct and append a ADDW instruction to the active function. -func (c *Context) ADDW(imr, amr operand.Op) { - if inst, err := x86.ADDW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADDW: Add. -// -// Forms: -// -// ADDW imm16 ax -// ADDW imm8 r16 -// ADDW imm16 r16 -// ADDW r16 r16 -// ADDW m16 r16 -// ADDW imm8 m16 -// ADDW imm16 m16 -// ADDW r16 m16 -// Construct and append a ADDW instruction to the active function. -// Operates on the global context. -func ADDW(imr, amr operand.Op) { ctx.ADDW(imr, amr) } - -// ADOXL: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXL r32 r32 -// ADOXL m32 r32 -// Construct and append a ADOXL instruction to the active function. -func (c *Context) ADOXL(mr, r operand.Op) { - if inst, err := x86.ADOXL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADOXL: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXL r32 r32 -// ADOXL m32 r32 -// Construct and append a ADOXL instruction to the active function. -// Operates on the global context. -func ADOXL(mr, r operand.Op) { ctx.ADOXL(mr, r) } - -// ADOXQ: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXQ r64 r64 -// ADOXQ m64 r64 -// Construct and append a ADOXQ instruction to the active function. -func (c *Context) ADOXQ(mr, r operand.Op) { - if inst, err := x86.ADOXQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ADOXQ: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXQ r64 r64 -// ADOXQ m64 r64 -// Construct and append a ADOXQ instruction to the active function. -// Operates on the global context. -func ADOXQ(mr, r operand.Op) { ctx.ADOXQ(mr, r) } - -// AESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// AESDEC xmm xmm -// AESDEC m128 xmm -// Construct and append a AESDEC instruction to the active function. -func (c *Context) AESDEC(mx, x operand.Op) { - if inst, err := x86.AESDEC(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// AESDEC xmm xmm -// AESDEC m128 xmm -// Construct and append a AESDEC instruction to the active function. -// Operates on the global context. -func AESDEC(mx, x operand.Op) { ctx.AESDEC(mx, x) } - -// AESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// AESDECLAST xmm xmm -// AESDECLAST m128 xmm -// Construct and append a AESDECLAST instruction to the active function. -func (c *Context) AESDECLAST(mx, x operand.Op) { - if inst, err := x86.AESDECLAST(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// AESDECLAST xmm xmm -// AESDECLAST m128 xmm -// Construct and append a AESDECLAST instruction to the active function. -// Operates on the global context. -func AESDECLAST(mx, x operand.Op) { ctx.AESDECLAST(mx, x) } - -// AESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// AESENC xmm xmm -// AESENC m128 xmm -// Construct and append a AESENC instruction to the active function. -func (c *Context) AESENC(mx, x operand.Op) { - if inst, err := x86.AESENC(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// AESENC xmm xmm -// AESENC m128 xmm -// Construct and append a AESENC instruction to the active function. -// Operates on the global context. -func AESENC(mx, x operand.Op) { ctx.AESENC(mx, x) } - -// AESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// AESENCLAST xmm xmm -// AESENCLAST m128 xmm -// Construct and append a AESENCLAST instruction to the active function. -func (c *Context) AESENCLAST(mx, x operand.Op) { - if inst, err := x86.AESENCLAST(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// AESENCLAST xmm xmm -// AESENCLAST m128 xmm -// Construct and append a AESENCLAST instruction to the active function. -// Operates on the global context. -func AESENCLAST(mx, x operand.Op) { ctx.AESENCLAST(mx, x) } - -// AESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// AESIMC xmm xmm -// AESIMC m128 xmm -// Construct and append a AESIMC instruction to the active function. -func (c *Context) AESIMC(mx, x operand.Op) { - if inst, err := x86.AESIMC(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// AESIMC xmm xmm -// AESIMC m128 xmm -// Construct and append a AESIMC instruction to the active function. -// Operates on the global context. -func AESIMC(mx, x operand.Op) { ctx.AESIMC(mx, x) } - -// AESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// AESKEYGENASSIST imm8 xmm xmm -// AESKEYGENASSIST imm8 m128 xmm -// Construct and append a AESKEYGENASSIST instruction to the active function. -func (c *Context) AESKEYGENASSIST(i, mx, x operand.Op) { - if inst, err := x86.AESKEYGENASSIST(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// AESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// AESKEYGENASSIST imm8 xmm xmm -// AESKEYGENASSIST imm8 m128 xmm -// Construct and append a AESKEYGENASSIST instruction to the active function. -// Operates on the global context. -func AESKEYGENASSIST(i, mx, x operand.Op) { ctx.AESKEYGENASSIST(i, mx, x) } - -// ANDB: Logical AND. -// -// Forms: -// -// ANDB imm8 al -// ANDB imm8 r8 -// ANDB r8 r8 -// ANDB m8 r8 -// ANDB imm8 m8 -// ANDB r8 m8 -// Construct and append a ANDB instruction to the active function. -func (c *Context) ANDB(imr, amr operand.Op) { - if inst, err := x86.ANDB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDB: Logical AND. -// -// Forms: -// -// ANDB imm8 al -// ANDB imm8 r8 -// ANDB r8 r8 -// ANDB m8 r8 -// ANDB imm8 m8 -// ANDB r8 m8 -// Construct and append a ANDB instruction to the active function. -// Operates on the global context. -func ANDB(imr, amr operand.Op) { ctx.ANDB(imr, amr) } - -// ANDL: Logical AND. -// -// Forms: -// -// ANDL imm32 eax -// ANDL imm8 r32 -// ANDL imm32 r32 -// ANDL r32 r32 -// ANDL m32 r32 -// ANDL imm8 m32 -// ANDL imm32 m32 -// ANDL r32 m32 -// Construct and append a ANDL instruction to the active function. -func (c *Context) ANDL(imr, emr operand.Op) { - if inst, err := x86.ANDL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDL: Logical AND. -// -// Forms: -// -// ANDL imm32 eax -// ANDL imm8 r32 -// ANDL imm32 r32 -// ANDL r32 r32 -// ANDL m32 r32 -// ANDL imm8 m32 -// ANDL imm32 m32 -// ANDL r32 m32 -// Construct and append a ANDL instruction to the active function. -// Operates on the global context. -func ANDL(imr, emr operand.Op) { ctx.ANDL(imr, emr) } - -// ANDNL: Logical AND NOT. -// -// Forms: -// -// ANDNL r32 r32 r32 -// ANDNL m32 r32 r32 -// Construct and append a ANDNL instruction to the active function. -func (c *Context) ANDNL(mr, r, r1 operand.Op) { - if inst, err := x86.ANDNL(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDNL: Logical AND NOT. -// -// Forms: -// -// ANDNL r32 r32 r32 -// ANDNL m32 r32 r32 -// Construct and append a ANDNL instruction to the active function. -// Operates on the global context. -func ANDNL(mr, r, r1 operand.Op) { ctx.ANDNL(mr, r, r1) } - -// ANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPD xmm xmm -// ANDNPD m128 xmm -// Construct and append a ANDNPD instruction to the active function. -func (c *Context) ANDNPD(mx, x operand.Op) { - if inst, err := x86.ANDNPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPD xmm xmm -// ANDNPD m128 xmm -// Construct and append a ANDNPD instruction to the active function. -// Operates on the global context. -func ANDNPD(mx, x operand.Op) { ctx.ANDNPD(mx, x) } - -// ANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPS xmm xmm -// ANDNPS m128 xmm -// Construct and append a ANDNPS instruction to the active function. -func (c *Context) ANDNPS(mx, x operand.Op) { - if inst, err := x86.ANDNPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPS xmm xmm -// ANDNPS m128 xmm -// Construct and append a ANDNPS instruction to the active function. -// Operates on the global context. -func ANDNPS(mx, x operand.Op) { ctx.ANDNPS(mx, x) } - -// ANDNQ: Logical AND NOT. -// -// Forms: -// -// ANDNQ r64 r64 r64 -// ANDNQ m64 r64 r64 -// Construct and append a ANDNQ instruction to the active function. -func (c *Context) ANDNQ(mr, r, r1 operand.Op) { - if inst, err := x86.ANDNQ(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDNQ: Logical AND NOT. -// -// Forms: -// -// ANDNQ r64 r64 r64 -// ANDNQ m64 r64 r64 -// Construct and append a ANDNQ instruction to the active function. -// Operates on the global context. -func ANDNQ(mr, r, r1 operand.Op) { ctx.ANDNQ(mr, r, r1) } - -// ANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDPD xmm xmm -// ANDPD m128 xmm -// Construct and append a ANDPD instruction to the active function. -func (c *Context) ANDPD(mx, x operand.Op) { - if inst, err := x86.ANDPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDPD xmm xmm -// ANDPD m128 xmm -// Construct and append a ANDPD instruction to the active function. -// Operates on the global context. -func ANDPD(mx, x operand.Op) { ctx.ANDPD(mx, x) } - -// ANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDPS xmm xmm -// ANDPS m128 xmm -// Construct and append a ANDPS instruction to the active function. -func (c *Context) ANDPS(mx, x operand.Op) { - if inst, err := x86.ANDPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDPS xmm xmm -// ANDPS m128 xmm -// Construct and append a ANDPS instruction to the active function. -// Operates on the global context. -func ANDPS(mx, x operand.Op) { ctx.ANDPS(mx, x) } - -// ANDQ: Logical AND. -// -// Forms: -// -// ANDQ imm32 rax -// ANDQ imm8 r64 -// ANDQ imm32 r64 -// ANDQ r64 r64 -// ANDQ m64 r64 -// ANDQ imm8 m64 -// ANDQ imm32 m64 -// ANDQ r64 m64 -// Construct and append a ANDQ instruction to the active function. -func (c *Context) ANDQ(imr, mr operand.Op) { - if inst, err := x86.ANDQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDQ: Logical AND. -// -// Forms: -// -// ANDQ imm32 rax -// ANDQ imm8 r64 -// ANDQ imm32 r64 -// ANDQ r64 r64 -// ANDQ m64 r64 -// ANDQ imm8 m64 -// ANDQ imm32 m64 -// ANDQ r64 m64 -// Construct and append a ANDQ instruction to the active function. -// Operates on the global context. -func ANDQ(imr, mr operand.Op) { ctx.ANDQ(imr, mr) } - -// ANDW: Logical AND. -// -// Forms: -// -// ANDW imm16 ax -// ANDW imm8 r16 -// ANDW imm16 r16 -// ANDW r16 r16 -// ANDW m16 r16 -// ANDW imm8 m16 -// ANDW imm16 m16 -// ANDW r16 m16 -// Construct and append a ANDW instruction to the active function. -func (c *Context) ANDW(imr, amr operand.Op) { - if inst, err := x86.ANDW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ANDW: Logical AND. -// -// Forms: -// -// ANDW imm16 ax -// ANDW imm8 r16 -// ANDW imm16 r16 -// ANDW r16 r16 -// ANDW m16 r16 -// ANDW imm8 m16 -// ANDW imm16 m16 -// ANDW r16 m16 -// Construct and append a ANDW instruction to the active function. -// Operates on the global context. -func ANDW(imr, amr operand.Op) { ctx.ANDW(imr, amr) } - -// BEXTRL: Bit Field Extract. -// -// Forms: -// -// BEXTRL r32 r32 r32 -// BEXTRL r32 m32 r32 -// Construct and append a BEXTRL instruction to the active function. -func (c *Context) BEXTRL(r, mr, r1 operand.Op) { - if inst, err := x86.BEXTRL(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BEXTRL: Bit Field Extract. -// -// Forms: -// -// BEXTRL r32 r32 r32 -// BEXTRL r32 m32 r32 -// Construct and append a BEXTRL instruction to the active function. -// Operates on the global context. -func BEXTRL(r, mr, r1 operand.Op) { ctx.BEXTRL(r, mr, r1) } - -// BEXTRQ: Bit Field Extract. -// -// Forms: -// -// BEXTRQ r64 r64 r64 -// BEXTRQ r64 m64 r64 -// Construct and append a BEXTRQ instruction to the active function. -func (c *Context) BEXTRQ(r, mr, r1 operand.Op) { - if inst, err := x86.BEXTRQ(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BEXTRQ: Bit Field Extract. -// -// Forms: -// -// BEXTRQ r64 r64 r64 -// BEXTRQ r64 m64 r64 -// Construct and append a BEXTRQ instruction to the active function. -// Operates on the global context. -func BEXTRQ(r, mr, r1 operand.Op) { ctx.BEXTRQ(r, mr, r1) } - -// BLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDPD imm8 xmm xmm -// BLENDPD imm8 m128 xmm -// Construct and append a BLENDPD instruction to the active function. -func (c *Context) BLENDPD(i, mx, x operand.Op) { - if inst, err := x86.BLENDPD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDPD imm8 xmm xmm -// BLENDPD imm8 m128 xmm -// Construct and append a BLENDPD instruction to the active function. -// Operates on the global context. -func BLENDPD(i, mx, x operand.Op) { ctx.BLENDPD(i, mx, x) } - -// BLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDPS imm8 xmm xmm -// BLENDPS imm8 m128 xmm -// Construct and append a BLENDPS instruction to the active function. -func (c *Context) BLENDPS(i, mx, x operand.Op) { - if inst, err := x86.BLENDPS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDPS imm8 xmm xmm -// BLENDPS imm8 m128 xmm -// Construct and append a BLENDPS instruction to the active function. -// Operates on the global context. -func BLENDPS(i, mx, x operand.Op) { ctx.BLENDPS(i, mx, x) } - -// BLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPD xmm0 xmm xmm -// BLENDVPD xmm0 m128 xmm -// Construct and append a BLENDVPD instruction to the active function. -func (c *Context) BLENDVPD(x, mx, x1 operand.Op) { - if inst, err := x86.BLENDVPD(x, mx, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPD xmm0 xmm xmm -// BLENDVPD xmm0 m128 xmm -// Construct and append a BLENDVPD instruction to the active function. -// Operates on the global context. -func BLENDVPD(x, mx, x1 operand.Op) { ctx.BLENDVPD(x, mx, x1) } - -// BLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPS xmm0 xmm xmm -// BLENDVPS xmm0 m128 xmm -// Construct and append a BLENDVPS instruction to the active function. -func (c *Context) BLENDVPS(x, mx, x1 operand.Op) { - if inst, err := x86.BLENDVPS(x, mx, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPS xmm0 xmm xmm -// BLENDVPS xmm0 m128 xmm -// Construct and append a BLENDVPS instruction to the active function. -// Operates on the global context. -func BLENDVPS(x, mx, x1 operand.Op) { ctx.BLENDVPS(x, mx, x1) } - -// BLSIL: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIL r32 r32 -// BLSIL m32 r32 -// Construct and append a BLSIL instruction to the active function. -func (c *Context) BLSIL(mr, r operand.Op) { - if inst, err := x86.BLSIL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSIL: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIL r32 r32 -// BLSIL m32 r32 -// Construct and append a BLSIL instruction to the active function. -// Operates on the global context. -func BLSIL(mr, r operand.Op) { ctx.BLSIL(mr, r) } - -// BLSIQ: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIQ r64 r64 -// BLSIQ m64 r64 -// Construct and append a BLSIQ instruction to the active function. -func (c *Context) BLSIQ(mr, r operand.Op) { - if inst, err := x86.BLSIQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSIQ: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIQ r64 r64 -// BLSIQ m64 r64 -// Construct and append a BLSIQ instruction to the active function. -// Operates on the global context. -func BLSIQ(mr, r operand.Op) { ctx.BLSIQ(mr, r) } - -// BLSMSKL: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKL r32 r32 -// BLSMSKL m32 r32 -// Construct and append a BLSMSKL instruction to the active function. -func (c *Context) BLSMSKL(mr, r operand.Op) { - if inst, err := x86.BLSMSKL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSMSKL: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKL r32 r32 -// BLSMSKL m32 r32 -// Construct and append a BLSMSKL instruction to the active function. -// Operates on the global context. -func BLSMSKL(mr, r operand.Op) { ctx.BLSMSKL(mr, r) } - -// BLSMSKQ: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKQ r64 r64 -// BLSMSKQ m64 r64 -// Construct and append a BLSMSKQ instruction to the active function. -func (c *Context) BLSMSKQ(mr, r operand.Op) { - if inst, err := x86.BLSMSKQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSMSKQ: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKQ r64 r64 -// BLSMSKQ m64 r64 -// Construct and append a BLSMSKQ instruction to the active function. -// Operates on the global context. -func BLSMSKQ(mr, r operand.Op) { ctx.BLSMSKQ(mr, r) } - -// BLSRL: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRL r32 r32 -// BLSRL m32 r32 -// Construct and append a BLSRL instruction to the active function. -func (c *Context) BLSRL(mr, r operand.Op) { - if inst, err := x86.BLSRL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSRL: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRL r32 r32 -// BLSRL m32 r32 -// Construct and append a BLSRL instruction to the active function. -// Operates on the global context. -func BLSRL(mr, r operand.Op) { ctx.BLSRL(mr, r) } - -// BLSRQ: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRQ r64 r64 -// BLSRQ m64 r64 -// Construct and append a BLSRQ instruction to the active function. -func (c *Context) BLSRQ(mr, r operand.Op) { - if inst, err := x86.BLSRQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BLSRQ: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRQ r64 r64 -// BLSRQ m64 r64 -// Construct and append a BLSRQ instruction to the active function. -// Operates on the global context. -func BLSRQ(mr, r operand.Op) { ctx.BLSRQ(mr, r) } - -// BSFL: Bit Scan Forward. -// -// Forms: -// -// BSFL r32 r32 -// BSFL m32 r32 -// Construct and append a BSFL instruction to the active function. -func (c *Context) BSFL(mr, r operand.Op) { - if inst, err := x86.BSFL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSFL: Bit Scan Forward. -// -// Forms: -// -// BSFL r32 r32 -// BSFL m32 r32 -// Construct and append a BSFL instruction to the active function. -// Operates on the global context. -func BSFL(mr, r operand.Op) { ctx.BSFL(mr, r) } - -// BSFQ: Bit Scan Forward. -// -// Forms: -// -// BSFQ r64 r64 -// BSFQ m64 r64 -// Construct and append a BSFQ instruction to the active function. -func (c *Context) BSFQ(mr, r operand.Op) { - if inst, err := x86.BSFQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSFQ: Bit Scan Forward. -// -// Forms: -// -// BSFQ r64 r64 -// BSFQ m64 r64 -// Construct and append a BSFQ instruction to the active function. -// Operates on the global context. -func BSFQ(mr, r operand.Op) { ctx.BSFQ(mr, r) } - -// BSFW: Bit Scan Forward. -// -// Forms: -// -// BSFW r16 r16 -// BSFW m16 r16 -// Construct and append a BSFW instruction to the active function. -func (c *Context) BSFW(mr, r operand.Op) { - if inst, err := x86.BSFW(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSFW: Bit Scan Forward. -// -// Forms: -// -// BSFW r16 r16 -// BSFW m16 r16 -// Construct and append a BSFW instruction to the active function. -// Operates on the global context. -func BSFW(mr, r operand.Op) { ctx.BSFW(mr, r) } - -// BSRL: Bit Scan Reverse. -// -// Forms: -// -// BSRL r32 r32 -// BSRL m32 r32 -// Construct and append a BSRL instruction to the active function. -func (c *Context) BSRL(mr, r operand.Op) { - if inst, err := x86.BSRL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSRL: Bit Scan Reverse. -// -// Forms: -// -// BSRL r32 r32 -// BSRL m32 r32 -// Construct and append a BSRL instruction to the active function. -// Operates on the global context. -func BSRL(mr, r operand.Op) { ctx.BSRL(mr, r) } - -// BSRQ: Bit Scan Reverse. -// -// Forms: -// -// BSRQ r64 r64 -// BSRQ m64 r64 -// Construct and append a BSRQ instruction to the active function. -func (c *Context) BSRQ(mr, r operand.Op) { - if inst, err := x86.BSRQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSRQ: Bit Scan Reverse. -// -// Forms: -// -// BSRQ r64 r64 -// BSRQ m64 r64 -// Construct and append a BSRQ instruction to the active function. -// Operates on the global context. -func BSRQ(mr, r operand.Op) { ctx.BSRQ(mr, r) } - -// BSRW: Bit Scan Reverse. -// -// Forms: -// -// BSRW r16 r16 -// BSRW m16 r16 -// Construct and append a BSRW instruction to the active function. -func (c *Context) BSRW(mr, r operand.Op) { - if inst, err := x86.BSRW(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSRW: Bit Scan Reverse. -// -// Forms: -// -// BSRW r16 r16 -// BSRW m16 r16 -// Construct and append a BSRW instruction to the active function. -// Operates on the global context. -func BSRW(mr, r operand.Op) { ctx.BSRW(mr, r) } - -// BSWAPL: Byte Swap. -// -// Forms: -// -// BSWAPL r32 -// Construct and append a BSWAPL instruction to the active function. -func (c *Context) BSWAPL(r operand.Op) { - if inst, err := x86.BSWAPL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSWAPL: Byte Swap. -// -// Forms: -// -// BSWAPL r32 -// Construct and append a BSWAPL instruction to the active function. -// Operates on the global context. -func BSWAPL(r operand.Op) { ctx.BSWAPL(r) } - -// BSWAPQ: Byte Swap. -// -// Forms: -// -// BSWAPQ r64 -// Construct and append a BSWAPQ instruction to the active function. -func (c *Context) BSWAPQ(r operand.Op) { - if inst, err := x86.BSWAPQ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BSWAPQ: Byte Swap. -// -// Forms: -// -// BSWAPQ r64 -// Construct and append a BSWAPQ instruction to the active function. -// Operates on the global context. -func BSWAPQ(r operand.Op) { ctx.BSWAPQ(r) } - -// BTCL: Bit Test and Complement. -// -// Forms: -// -// BTCL imm8 r32 -// BTCL r32 r32 -// BTCL imm8 m32 -// BTCL r32 m32 -// Construct and append a BTCL instruction to the active function. -func (c *Context) BTCL(ir, mr operand.Op) { - if inst, err := x86.BTCL(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTCL: Bit Test and Complement. -// -// Forms: -// -// BTCL imm8 r32 -// BTCL r32 r32 -// BTCL imm8 m32 -// BTCL r32 m32 -// Construct and append a BTCL instruction to the active function. -// Operates on the global context. -func BTCL(ir, mr operand.Op) { ctx.BTCL(ir, mr) } - -// BTCQ: Bit Test and Complement. -// -// Forms: -// -// BTCQ imm8 r64 -// BTCQ r64 r64 -// BTCQ imm8 m64 -// BTCQ r64 m64 -// Construct and append a BTCQ instruction to the active function. -func (c *Context) BTCQ(ir, mr operand.Op) { - if inst, err := x86.BTCQ(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTCQ: Bit Test and Complement. -// -// Forms: -// -// BTCQ imm8 r64 -// BTCQ r64 r64 -// BTCQ imm8 m64 -// BTCQ r64 m64 -// Construct and append a BTCQ instruction to the active function. -// Operates on the global context. -func BTCQ(ir, mr operand.Op) { ctx.BTCQ(ir, mr) } - -// BTCW: Bit Test and Complement. -// -// Forms: -// -// BTCW imm8 r16 -// BTCW r16 r16 -// BTCW imm8 m16 -// BTCW r16 m16 -// Construct and append a BTCW instruction to the active function. -func (c *Context) BTCW(ir, mr operand.Op) { - if inst, err := x86.BTCW(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTCW: Bit Test and Complement. -// -// Forms: -// -// BTCW imm8 r16 -// BTCW r16 r16 -// BTCW imm8 m16 -// BTCW r16 m16 -// Construct and append a BTCW instruction to the active function. -// Operates on the global context. -func BTCW(ir, mr operand.Op) { ctx.BTCW(ir, mr) } - -// BTL: Bit Test. -// -// Forms: -// -// BTL imm8 r32 -// BTL r32 r32 -// BTL imm8 m32 -// BTL r32 m32 -// Construct and append a BTL instruction to the active function. -func (c *Context) BTL(ir, mr operand.Op) { - if inst, err := x86.BTL(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTL: Bit Test. -// -// Forms: -// -// BTL imm8 r32 -// BTL r32 r32 -// BTL imm8 m32 -// BTL r32 m32 -// Construct and append a BTL instruction to the active function. -// Operates on the global context. -func BTL(ir, mr operand.Op) { ctx.BTL(ir, mr) } - -// BTQ: Bit Test. -// -// Forms: -// -// BTQ imm8 r64 -// BTQ r64 r64 -// BTQ imm8 m64 -// BTQ r64 m64 -// Construct and append a BTQ instruction to the active function. -func (c *Context) BTQ(ir, mr operand.Op) { - if inst, err := x86.BTQ(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTQ: Bit Test. -// -// Forms: -// -// BTQ imm8 r64 -// BTQ r64 r64 -// BTQ imm8 m64 -// BTQ r64 m64 -// Construct and append a BTQ instruction to the active function. -// Operates on the global context. -func BTQ(ir, mr operand.Op) { ctx.BTQ(ir, mr) } - -// BTRL: Bit Test and Reset. -// -// Forms: -// -// BTRL imm8 r32 -// BTRL r32 r32 -// BTRL imm8 m32 -// BTRL r32 m32 -// Construct and append a BTRL instruction to the active function. -func (c *Context) BTRL(ir, mr operand.Op) { - if inst, err := x86.BTRL(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTRL: Bit Test and Reset. -// -// Forms: -// -// BTRL imm8 r32 -// BTRL r32 r32 -// BTRL imm8 m32 -// BTRL r32 m32 -// Construct and append a BTRL instruction to the active function. -// Operates on the global context. -func BTRL(ir, mr operand.Op) { ctx.BTRL(ir, mr) } - -// BTRQ: Bit Test and Reset. -// -// Forms: -// -// BTRQ imm8 r64 -// BTRQ r64 r64 -// BTRQ imm8 m64 -// BTRQ r64 m64 -// Construct and append a BTRQ instruction to the active function. -func (c *Context) BTRQ(ir, mr operand.Op) { - if inst, err := x86.BTRQ(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTRQ: Bit Test and Reset. -// -// Forms: -// -// BTRQ imm8 r64 -// BTRQ r64 r64 -// BTRQ imm8 m64 -// BTRQ r64 m64 -// Construct and append a BTRQ instruction to the active function. -// Operates on the global context. -func BTRQ(ir, mr operand.Op) { ctx.BTRQ(ir, mr) } - -// BTRW: Bit Test and Reset. -// -// Forms: -// -// BTRW imm8 r16 -// BTRW r16 r16 -// BTRW imm8 m16 -// BTRW r16 m16 -// Construct and append a BTRW instruction to the active function. -func (c *Context) BTRW(ir, mr operand.Op) { - if inst, err := x86.BTRW(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTRW: Bit Test and Reset. -// -// Forms: -// -// BTRW imm8 r16 -// BTRW r16 r16 -// BTRW imm8 m16 -// BTRW r16 m16 -// Construct and append a BTRW instruction to the active function. -// Operates on the global context. -func BTRW(ir, mr operand.Op) { ctx.BTRW(ir, mr) } - -// BTSL: Bit Test and Set. -// -// Forms: -// -// BTSL imm8 r32 -// BTSL r32 r32 -// BTSL imm8 m32 -// BTSL r32 m32 -// Construct and append a BTSL instruction to the active function. -func (c *Context) BTSL(ir, mr operand.Op) { - if inst, err := x86.BTSL(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTSL: Bit Test and Set. -// -// Forms: -// -// BTSL imm8 r32 -// BTSL r32 r32 -// BTSL imm8 m32 -// BTSL r32 m32 -// Construct and append a BTSL instruction to the active function. -// Operates on the global context. -func BTSL(ir, mr operand.Op) { ctx.BTSL(ir, mr) } - -// BTSQ: Bit Test and Set. -// -// Forms: -// -// BTSQ imm8 r64 -// BTSQ r64 r64 -// BTSQ imm8 m64 -// BTSQ r64 m64 -// Construct and append a BTSQ instruction to the active function. -func (c *Context) BTSQ(ir, mr operand.Op) { - if inst, err := x86.BTSQ(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTSQ: Bit Test and Set. -// -// Forms: -// -// BTSQ imm8 r64 -// BTSQ r64 r64 -// BTSQ imm8 m64 -// BTSQ r64 m64 -// Construct and append a BTSQ instruction to the active function. -// Operates on the global context. -func BTSQ(ir, mr operand.Op) { ctx.BTSQ(ir, mr) } - -// BTSW: Bit Test and Set. -// -// Forms: -// -// BTSW imm8 r16 -// BTSW r16 r16 -// BTSW imm8 m16 -// BTSW r16 m16 -// Construct and append a BTSW instruction to the active function. -func (c *Context) BTSW(ir, mr operand.Op) { - if inst, err := x86.BTSW(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTSW: Bit Test and Set. -// -// Forms: -// -// BTSW imm8 r16 -// BTSW r16 r16 -// BTSW imm8 m16 -// BTSW r16 m16 -// Construct and append a BTSW instruction to the active function. -// Operates on the global context. -func BTSW(ir, mr operand.Op) { ctx.BTSW(ir, mr) } - -// BTW: Bit Test. -// -// Forms: -// -// BTW imm8 r16 -// BTW r16 r16 -// BTW imm8 m16 -// BTW r16 m16 -// Construct and append a BTW instruction to the active function. -func (c *Context) BTW(ir, mr operand.Op) { - if inst, err := x86.BTW(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BTW: Bit Test. -// -// Forms: -// -// BTW imm8 r16 -// BTW r16 r16 -// BTW imm8 m16 -// BTW r16 m16 -// Construct and append a BTW instruction to the active function. -// Operates on the global context. -func BTW(ir, mr operand.Op) { ctx.BTW(ir, mr) } - -// BZHIL: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIL r32 r32 r32 -// BZHIL r32 m32 r32 -// Construct and append a BZHIL instruction to the active function. -func (c *Context) BZHIL(r, mr, r1 operand.Op) { - if inst, err := x86.BZHIL(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BZHIL: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIL r32 r32 r32 -// BZHIL r32 m32 r32 -// Construct and append a BZHIL instruction to the active function. -// Operates on the global context. -func BZHIL(r, mr, r1 operand.Op) { ctx.BZHIL(r, mr, r1) } - -// BZHIQ: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIQ r64 r64 r64 -// BZHIQ r64 m64 r64 -// Construct and append a BZHIQ instruction to the active function. -func (c *Context) BZHIQ(r, mr, r1 operand.Op) { - if inst, err := x86.BZHIQ(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// BZHIQ: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIQ r64 r64 r64 -// BZHIQ r64 m64 r64 -// Construct and append a BZHIQ instruction to the active function. -// Operates on the global context. -func BZHIQ(r, mr, r1 operand.Op) { ctx.BZHIQ(r, mr, r1) } - -// CALL: Call Procedure. -// -// Forms: -// -// CALL rel32 -// Construct and append a CALL instruction to the active function. -func (c *Context) CALL(r operand.Op) { - if inst, err := x86.CALL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CALL: Call Procedure. -// -// Forms: -// -// CALL rel32 -// Construct and append a CALL instruction to the active function. -// Operates on the global context. -func CALL(r operand.Op) { ctx.CALL(r) } - -// CBW: Convert Byte to Word. -// -// Forms: -// -// CBW -// Construct and append a CBW instruction to the active function. -func (c *Context) CBW() { - if inst, err := x86.CBW(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CBW: Convert Byte to Word. -// -// Forms: -// -// CBW -// Construct and append a CBW instruction to the active function. -// Operates on the global context. -func CBW() { ctx.CBW() } - -// CDQ: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQ -// Construct and append a CDQ instruction to the active function. -func (c *Context) CDQ() { - if inst, err := x86.CDQ(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CDQ: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQ -// Construct and append a CDQ instruction to the active function. -// Operates on the global context. -func CDQ() { ctx.CDQ() } - -// CDQE: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQE -// Construct and append a CDQE instruction to the active function. -func (c *Context) CDQE() { - if inst, err := x86.CDQE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CDQE: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQE -// Construct and append a CDQE instruction to the active function. -// Operates on the global context. -func CDQE() { ctx.CDQE() } - -// CLC: Clear Carry Flag. -// -// Forms: -// -// CLC -// Construct and append a CLC instruction to the active function. -func (c *Context) CLC() { - if inst, err := x86.CLC(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CLC: Clear Carry Flag. -// -// Forms: -// -// CLC -// Construct and append a CLC instruction to the active function. -// Operates on the global context. -func CLC() { ctx.CLC() } - -// CLD: Clear Direction Flag. -// -// Forms: -// -// CLD -// Construct and append a CLD instruction to the active function. -func (c *Context) CLD() { - if inst, err := x86.CLD(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CLD: Clear Direction Flag. -// -// Forms: -// -// CLD -// Construct and append a CLD instruction to the active function. -// Operates on the global context. -func CLD() { ctx.CLD() } - -// CLFLUSH: Flush Cache Line. -// -// Forms: -// -// CLFLUSH m8 -// Construct and append a CLFLUSH instruction to the active function. -func (c *Context) CLFLUSH(m operand.Op) { - if inst, err := x86.CLFLUSH(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CLFLUSH: Flush Cache Line. -// -// Forms: -// -// CLFLUSH m8 -// Construct and append a CLFLUSH instruction to the active function. -// Operates on the global context. -func CLFLUSH(m operand.Op) { ctx.CLFLUSH(m) } - -// CLFLUSHOPT: Flush Cache Line Optimized. -// -// Forms: -// -// CLFLUSHOPT m8 -// Construct and append a CLFLUSHOPT instruction to the active function. -func (c *Context) CLFLUSHOPT(m operand.Op) { - if inst, err := x86.CLFLUSHOPT(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CLFLUSHOPT: Flush Cache Line Optimized. -// -// Forms: -// -// CLFLUSHOPT m8 -// Construct and append a CLFLUSHOPT instruction to the active function. -// Operates on the global context. -func CLFLUSHOPT(m operand.Op) { ctx.CLFLUSHOPT(m) } - -// CMC: Complement Carry Flag. -// -// Forms: -// -// CMC -// Construct and append a CMC instruction to the active function. -func (c *Context) CMC() { - if inst, err := x86.CMC(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMC: Complement Carry Flag. -// -// Forms: -// -// CMC -// Construct and append a CMC instruction to the active function. -// Operates on the global context. -func CMC() { ctx.CMC() } - -// CMOVLCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVLCC r32 r32 -// CMOVLCC m32 r32 -// Construct and append a CMOVLCC instruction to the active function. -func (c *Context) CMOVLCC(mr, r operand.Op) { - if inst, err := x86.CMOVLCC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVLCC r32 r32 -// CMOVLCC m32 r32 -// Construct and append a CMOVLCC instruction to the active function. -// Operates on the global context. -func CMOVLCC(mr, r operand.Op) { ctx.CMOVLCC(mr, r) } - -// CMOVLCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVLCS r32 r32 -// CMOVLCS m32 r32 -// Construct and append a CMOVLCS instruction to the active function. -func (c *Context) CMOVLCS(mr, r operand.Op) { - if inst, err := x86.CMOVLCS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVLCS r32 r32 -// CMOVLCS m32 r32 -// Construct and append a CMOVLCS instruction to the active function. -// Operates on the global context. -func CMOVLCS(mr, r operand.Op) { ctx.CMOVLCS(mr, r) } - -// CMOVLEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVLEQ r32 r32 -// CMOVLEQ m32 r32 -// Construct and append a CMOVLEQ instruction to the active function. -func (c *Context) CMOVLEQ(mr, r operand.Op) { - if inst, err := x86.CMOVLEQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVLEQ r32 r32 -// CMOVLEQ m32 r32 -// Construct and append a CMOVLEQ instruction to the active function. -// Operates on the global context. -func CMOVLEQ(mr, r operand.Op) { ctx.CMOVLEQ(mr, r) } - -// CMOVLGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVLGE r32 r32 -// CMOVLGE m32 r32 -// Construct and append a CMOVLGE instruction to the active function. -func (c *Context) CMOVLGE(mr, r operand.Op) { - if inst, err := x86.CMOVLGE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVLGE r32 r32 -// CMOVLGE m32 r32 -// Construct and append a CMOVLGE instruction to the active function. -// Operates on the global context. -func CMOVLGE(mr, r operand.Op) { ctx.CMOVLGE(mr, r) } - -// CMOVLGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVLGT r32 r32 -// CMOVLGT m32 r32 -// Construct and append a CMOVLGT instruction to the active function. -func (c *Context) CMOVLGT(mr, r operand.Op) { - if inst, err := x86.CMOVLGT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVLGT r32 r32 -// CMOVLGT m32 r32 -// Construct and append a CMOVLGT instruction to the active function. -// Operates on the global context. -func CMOVLGT(mr, r operand.Op) { ctx.CMOVLGT(mr, r) } - -// CMOVLHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVLHI r32 r32 -// CMOVLHI m32 r32 -// Construct and append a CMOVLHI instruction to the active function. -func (c *Context) CMOVLHI(mr, r operand.Op) { - if inst, err := x86.CMOVLHI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVLHI r32 r32 -// CMOVLHI m32 r32 -// Construct and append a CMOVLHI instruction to the active function. -// Operates on the global context. -func CMOVLHI(mr, r operand.Op) { ctx.CMOVLHI(mr, r) } - -// CMOVLLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVLLE r32 r32 -// CMOVLLE m32 r32 -// Construct and append a CMOVLLE instruction to the active function. -func (c *Context) CMOVLLE(mr, r operand.Op) { - if inst, err := x86.CMOVLLE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVLLE r32 r32 -// CMOVLLE m32 r32 -// Construct and append a CMOVLLE instruction to the active function. -// Operates on the global context. -func CMOVLLE(mr, r operand.Op) { ctx.CMOVLLE(mr, r) } - -// CMOVLLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVLLS r32 r32 -// CMOVLLS m32 r32 -// Construct and append a CMOVLLS instruction to the active function. -func (c *Context) CMOVLLS(mr, r operand.Op) { - if inst, err := x86.CMOVLLS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVLLS r32 r32 -// CMOVLLS m32 r32 -// Construct and append a CMOVLLS instruction to the active function. -// Operates on the global context. -func CMOVLLS(mr, r operand.Op) { ctx.CMOVLLS(mr, r) } - -// CMOVLLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVLLT r32 r32 -// CMOVLLT m32 r32 -// Construct and append a CMOVLLT instruction to the active function. -func (c *Context) CMOVLLT(mr, r operand.Op) { - if inst, err := x86.CMOVLLT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVLLT r32 r32 -// CMOVLLT m32 r32 -// Construct and append a CMOVLLT instruction to the active function. -// Operates on the global context. -func CMOVLLT(mr, r operand.Op) { ctx.CMOVLLT(mr, r) } - -// CMOVLMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVLMI r32 r32 -// CMOVLMI m32 r32 -// Construct and append a CMOVLMI instruction to the active function. -func (c *Context) CMOVLMI(mr, r operand.Op) { - if inst, err := x86.CMOVLMI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVLMI r32 r32 -// CMOVLMI m32 r32 -// Construct and append a CMOVLMI instruction to the active function. -// Operates on the global context. -func CMOVLMI(mr, r operand.Op) { ctx.CMOVLMI(mr, r) } - -// CMOVLNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVLNE r32 r32 -// CMOVLNE m32 r32 -// Construct and append a CMOVLNE instruction to the active function. -func (c *Context) CMOVLNE(mr, r operand.Op) { - if inst, err := x86.CMOVLNE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVLNE r32 r32 -// CMOVLNE m32 r32 -// Construct and append a CMOVLNE instruction to the active function. -// Operates on the global context. -func CMOVLNE(mr, r operand.Op) { ctx.CMOVLNE(mr, r) } - -// CMOVLOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVLOC r32 r32 -// CMOVLOC m32 r32 -// Construct and append a CMOVLOC instruction to the active function. -func (c *Context) CMOVLOC(mr, r operand.Op) { - if inst, err := x86.CMOVLOC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVLOC r32 r32 -// CMOVLOC m32 r32 -// Construct and append a CMOVLOC instruction to the active function. -// Operates on the global context. -func CMOVLOC(mr, r operand.Op) { ctx.CMOVLOC(mr, r) } - -// CMOVLOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVLOS r32 r32 -// CMOVLOS m32 r32 -// Construct and append a CMOVLOS instruction to the active function. -func (c *Context) CMOVLOS(mr, r operand.Op) { - if inst, err := x86.CMOVLOS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVLOS r32 r32 -// CMOVLOS m32 r32 -// Construct and append a CMOVLOS instruction to the active function. -// Operates on the global context. -func CMOVLOS(mr, r operand.Op) { ctx.CMOVLOS(mr, r) } - -// CMOVLPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVLPC r32 r32 -// CMOVLPC m32 r32 -// Construct and append a CMOVLPC instruction to the active function. -func (c *Context) CMOVLPC(mr, r operand.Op) { - if inst, err := x86.CMOVLPC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVLPC r32 r32 -// CMOVLPC m32 r32 -// Construct and append a CMOVLPC instruction to the active function. -// Operates on the global context. -func CMOVLPC(mr, r operand.Op) { ctx.CMOVLPC(mr, r) } - -// CMOVLPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVLPL r32 r32 -// CMOVLPL m32 r32 -// Construct and append a CMOVLPL instruction to the active function. -func (c *Context) CMOVLPL(mr, r operand.Op) { - if inst, err := x86.CMOVLPL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVLPL r32 r32 -// CMOVLPL m32 r32 -// Construct and append a CMOVLPL instruction to the active function. -// Operates on the global context. -func CMOVLPL(mr, r operand.Op) { ctx.CMOVLPL(mr, r) } - -// CMOVLPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVLPS r32 r32 -// CMOVLPS m32 r32 -// Construct and append a CMOVLPS instruction to the active function. -func (c *Context) CMOVLPS(mr, r operand.Op) { - if inst, err := x86.CMOVLPS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVLPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVLPS r32 r32 -// CMOVLPS m32 r32 -// Construct and append a CMOVLPS instruction to the active function. -// Operates on the global context. -func CMOVLPS(mr, r operand.Op) { ctx.CMOVLPS(mr, r) } - -// CMOVQCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVQCC r64 r64 -// CMOVQCC m64 r64 -// Construct and append a CMOVQCC instruction to the active function. -func (c *Context) CMOVQCC(mr, r operand.Op) { - if inst, err := x86.CMOVQCC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVQCC r64 r64 -// CMOVQCC m64 r64 -// Construct and append a CMOVQCC instruction to the active function. -// Operates on the global context. -func CMOVQCC(mr, r operand.Op) { ctx.CMOVQCC(mr, r) } - -// CMOVQCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVQCS r64 r64 -// CMOVQCS m64 r64 -// Construct and append a CMOVQCS instruction to the active function. -func (c *Context) CMOVQCS(mr, r operand.Op) { - if inst, err := x86.CMOVQCS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVQCS r64 r64 -// CMOVQCS m64 r64 -// Construct and append a CMOVQCS instruction to the active function. -// Operates on the global context. -func CMOVQCS(mr, r operand.Op) { ctx.CMOVQCS(mr, r) } - -// CMOVQEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVQEQ r64 r64 -// CMOVQEQ m64 r64 -// Construct and append a CMOVQEQ instruction to the active function. -func (c *Context) CMOVQEQ(mr, r operand.Op) { - if inst, err := x86.CMOVQEQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVQEQ r64 r64 -// CMOVQEQ m64 r64 -// Construct and append a CMOVQEQ instruction to the active function. -// Operates on the global context. -func CMOVQEQ(mr, r operand.Op) { ctx.CMOVQEQ(mr, r) } - -// CMOVQGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVQGE r64 r64 -// CMOVQGE m64 r64 -// Construct and append a CMOVQGE instruction to the active function. -func (c *Context) CMOVQGE(mr, r operand.Op) { - if inst, err := x86.CMOVQGE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVQGE r64 r64 -// CMOVQGE m64 r64 -// Construct and append a CMOVQGE instruction to the active function. -// Operates on the global context. -func CMOVQGE(mr, r operand.Op) { ctx.CMOVQGE(mr, r) } - -// CMOVQGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVQGT r64 r64 -// CMOVQGT m64 r64 -// Construct and append a CMOVQGT instruction to the active function. -func (c *Context) CMOVQGT(mr, r operand.Op) { - if inst, err := x86.CMOVQGT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVQGT r64 r64 -// CMOVQGT m64 r64 -// Construct and append a CMOVQGT instruction to the active function. -// Operates on the global context. -func CMOVQGT(mr, r operand.Op) { ctx.CMOVQGT(mr, r) } - -// CMOVQHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVQHI r64 r64 -// CMOVQHI m64 r64 -// Construct and append a CMOVQHI instruction to the active function. -func (c *Context) CMOVQHI(mr, r operand.Op) { - if inst, err := x86.CMOVQHI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVQHI r64 r64 -// CMOVQHI m64 r64 -// Construct and append a CMOVQHI instruction to the active function. -// Operates on the global context. -func CMOVQHI(mr, r operand.Op) { ctx.CMOVQHI(mr, r) } - -// CMOVQLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVQLE r64 r64 -// CMOVQLE m64 r64 -// Construct and append a CMOVQLE instruction to the active function. -func (c *Context) CMOVQLE(mr, r operand.Op) { - if inst, err := x86.CMOVQLE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVQLE r64 r64 -// CMOVQLE m64 r64 -// Construct and append a CMOVQLE instruction to the active function. -// Operates on the global context. -func CMOVQLE(mr, r operand.Op) { ctx.CMOVQLE(mr, r) } - -// CMOVQLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVQLS r64 r64 -// CMOVQLS m64 r64 -// Construct and append a CMOVQLS instruction to the active function. -func (c *Context) CMOVQLS(mr, r operand.Op) { - if inst, err := x86.CMOVQLS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVQLS r64 r64 -// CMOVQLS m64 r64 -// Construct and append a CMOVQLS instruction to the active function. -// Operates on the global context. -func CMOVQLS(mr, r operand.Op) { ctx.CMOVQLS(mr, r) } - -// CMOVQLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVQLT r64 r64 -// CMOVQLT m64 r64 -// Construct and append a CMOVQLT instruction to the active function. -func (c *Context) CMOVQLT(mr, r operand.Op) { - if inst, err := x86.CMOVQLT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVQLT r64 r64 -// CMOVQLT m64 r64 -// Construct and append a CMOVQLT instruction to the active function. -// Operates on the global context. -func CMOVQLT(mr, r operand.Op) { ctx.CMOVQLT(mr, r) } - -// CMOVQMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVQMI r64 r64 -// CMOVQMI m64 r64 -// Construct and append a CMOVQMI instruction to the active function. -func (c *Context) CMOVQMI(mr, r operand.Op) { - if inst, err := x86.CMOVQMI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVQMI r64 r64 -// CMOVQMI m64 r64 -// Construct and append a CMOVQMI instruction to the active function. -// Operates on the global context. -func CMOVQMI(mr, r operand.Op) { ctx.CMOVQMI(mr, r) } - -// CMOVQNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVQNE r64 r64 -// CMOVQNE m64 r64 -// Construct and append a CMOVQNE instruction to the active function. -func (c *Context) CMOVQNE(mr, r operand.Op) { - if inst, err := x86.CMOVQNE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVQNE r64 r64 -// CMOVQNE m64 r64 -// Construct and append a CMOVQNE instruction to the active function. -// Operates on the global context. -func CMOVQNE(mr, r operand.Op) { ctx.CMOVQNE(mr, r) } - -// CMOVQOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVQOC r64 r64 -// CMOVQOC m64 r64 -// Construct and append a CMOVQOC instruction to the active function. -func (c *Context) CMOVQOC(mr, r operand.Op) { - if inst, err := x86.CMOVQOC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVQOC r64 r64 -// CMOVQOC m64 r64 -// Construct and append a CMOVQOC instruction to the active function. -// Operates on the global context. -func CMOVQOC(mr, r operand.Op) { ctx.CMOVQOC(mr, r) } - -// CMOVQOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVQOS r64 r64 -// CMOVQOS m64 r64 -// Construct and append a CMOVQOS instruction to the active function. -func (c *Context) CMOVQOS(mr, r operand.Op) { - if inst, err := x86.CMOVQOS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVQOS r64 r64 -// CMOVQOS m64 r64 -// Construct and append a CMOVQOS instruction to the active function. -// Operates on the global context. -func CMOVQOS(mr, r operand.Op) { ctx.CMOVQOS(mr, r) } - -// CMOVQPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVQPC r64 r64 -// CMOVQPC m64 r64 -// Construct and append a CMOVQPC instruction to the active function. -func (c *Context) CMOVQPC(mr, r operand.Op) { - if inst, err := x86.CMOVQPC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVQPC r64 r64 -// CMOVQPC m64 r64 -// Construct and append a CMOVQPC instruction to the active function. -// Operates on the global context. -func CMOVQPC(mr, r operand.Op) { ctx.CMOVQPC(mr, r) } - -// CMOVQPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVQPL r64 r64 -// CMOVQPL m64 r64 -// Construct and append a CMOVQPL instruction to the active function. -func (c *Context) CMOVQPL(mr, r operand.Op) { - if inst, err := x86.CMOVQPL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVQPL r64 r64 -// CMOVQPL m64 r64 -// Construct and append a CMOVQPL instruction to the active function. -// Operates on the global context. -func CMOVQPL(mr, r operand.Op) { ctx.CMOVQPL(mr, r) } - -// CMOVQPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVQPS r64 r64 -// CMOVQPS m64 r64 -// Construct and append a CMOVQPS instruction to the active function. -func (c *Context) CMOVQPS(mr, r operand.Op) { - if inst, err := x86.CMOVQPS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVQPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVQPS r64 r64 -// CMOVQPS m64 r64 -// Construct and append a CMOVQPS instruction to the active function. -// Operates on the global context. -func CMOVQPS(mr, r operand.Op) { ctx.CMOVQPS(mr, r) } - -// CMOVWCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVWCC r16 r16 -// CMOVWCC m16 r16 -// Construct and append a CMOVWCC instruction to the active function. -func (c *Context) CMOVWCC(mr, r operand.Op) { - if inst, err := x86.CMOVWCC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVWCC r16 r16 -// CMOVWCC m16 r16 -// Construct and append a CMOVWCC instruction to the active function. -// Operates on the global context. -func CMOVWCC(mr, r operand.Op) { ctx.CMOVWCC(mr, r) } - -// CMOVWCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVWCS r16 r16 -// CMOVWCS m16 r16 -// Construct and append a CMOVWCS instruction to the active function. -func (c *Context) CMOVWCS(mr, r operand.Op) { - if inst, err := x86.CMOVWCS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVWCS r16 r16 -// CMOVWCS m16 r16 -// Construct and append a CMOVWCS instruction to the active function. -// Operates on the global context. -func CMOVWCS(mr, r operand.Op) { ctx.CMOVWCS(mr, r) } - -// CMOVWEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVWEQ r16 r16 -// CMOVWEQ m16 r16 -// Construct and append a CMOVWEQ instruction to the active function. -func (c *Context) CMOVWEQ(mr, r operand.Op) { - if inst, err := x86.CMOVWEQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVWEQ r16 r16 -// CMOVWEQ m16 r16 -// Construct and append a CMOVWEQ instruction to the active function. -// Operates on the global context. -func CMOVWEQ(mr, r operand.Op) { ctx.CMOVWEQ(mr, r) } - -// CMOVWGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVWGE r16 r16 -// CMOVWGE m16 r16 -// Construct and append a CMOVWGE instruction to the active function. -func (c *Context) CMOVWGE(mr, r operand.Op) { - if inst, err := x86.CMOVWGE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVWGE r16 r16 -// CMOVWGE m16 r16 -// Construct and append a CMOVWGE instruction to the active function. -// Operates on the global context. -func CMOVWGE(mr, r operand.Op) { ctx.CMOVWGE(mr, r) } - -// CMOVWGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVWGT r16 r16 -// CMOVWGT m16 r16 -// Construct and append a CMOVWGT instruction to the active function. -func (c *Context) CMOVWGT(mr, r operand.Op) { - if inst, err := x86.CMOVWGT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVWGT r16 r16 -// CMOVWGT m16 r16 -// Construct and append a CMOVWGT instruction to the active function. -// Operates on the global context. -func CMOVWGT(mr, r operand.Op) { ctx.CMOVWGT(mr, r) } - -// CMOVWHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVWHI r16 r16 -// CMOVWHI m16 r16 -// Construct and append a CMOVWHI instruction to the active function. -func (c *Context) CMOVWHI(mr, r operand.Op) { - if inst, err := x86.CMOVWHI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVWHI r16 r16 -// CMOVWHI m16 r16 -// Construct and append a CMOVWHI instruction to the active function. -// Operates on the global context. -func CMOVWHI(mr, r operand.Op) { ctx.CMOVWHI(mr, r) } - -// CMOVWLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVWLE r16 r16 -// CMOVWLE m16 r16 -// Construct and append a CMOVWLE instruction to the active function. -func (c *Context) CMOVWLE(mr, r operand.Op) { - if inst, err := x86.CMOVWLE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVWLE r16 r16 -// CMOVWLE m16 r16 -// Construct and append a CMOVWLE instruction to the active function. -// Operates on the global context. -func CMOVWLE(mr, r operand.Op) { ctx.CMOVWLE(mr, r) } - -// CMOVWLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVWLS r16 r16 -// CMOVWLS m16 r16 -// Construct and append a CMOVWLS instruction to the active function. -func (c *Context) CMOVWLS(mr, r operand.Op) { - if inst, err := x86.CMOVWLS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVWLS r16 r16 -// CMOVWLS m16 r16 -// Construct and append a CMOVWLS instruction to the active function. -// Operates on the global context. -func CMOVWLS(mr, r operand.Op) { ctx.CMOVWLS(mr, r) } - -// CMOVWLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVWLT r16 r16 -// CMOVWLT m16 r16 -// Construct and append a CMOVWLT instruction to the active function. -func (c *Context) CMOVWLT(mr, r operand.Op) { - if inst, err := x86.CMOVWLT(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVWLT r16 r16 -// CMOVWLT m16 r16 -// Construct and append a CMOVWLT instruction to the active function. -// Operates on the global context. -func CMOVWLT(mr, r operand.Op) { ctx.CMOVWLT(mr, r) } - -// CMOVWMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVWMI r16 r16 -// CMOVWMI m16 r16 -// Construct and append a CMOVWMI instruction to the active function. -func (c *Context) CMOVWMI(mr, r operand.Op) { - if inst, err := x86.CMOVWMI(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVWMI r16 r16 -// CMOVWMI m16 r16 -// Construct and append a CMOVWMI instruction to the active function. -// Operates on the global context. -func CMOVWMI(mr, r operand.Op) { ctx.CMOVWMI(mr, r) } - -// CMOVWNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVWNE r16 r16 -// CMOVWNE m16 r16 -// Construct and append a CMOVWNE instruction to the active function. -func (c *Context) CMOVWNE(mr, r operand.Op) { - if inst, err := x86.CMOVWNE(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVWNE r16 r16 -// CMOVWNE m16 r16 -// Construct and append a CMOVWNE instruction to the active function. -// Operates on the global context. -func CMOVWNE(mr, r operand.Op) { ctx.CMOVWNE(mr, r) } - -// CMOVWOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVWOC r16 r16 -// CMOVWOC m16 r16 -// Construct and append a CMOVWOC instruction to the active function. -func (c *Context) CMOVWOC(mr, r operand.Op) { - if inst, err := x86.CMOVWOC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVWOC r16 r16 -// CMOVWOC m16 r16 -// Construct and append a CMOVWOC instruction to the active function. -// Operates on the global context. -func CMOVWOC(mr, r operand.Op) { ctx.CMOVWOC(mr, r) } - -// CMOVWOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVWOS r16 r16 -// CMOVWOS m16 r16 -// Construct and append a CMOVWOS instruction to the active function. -func (c *Context) CMOVWOS(mr, r operand.Op) { - if inst, err := x86.CMOVWOS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVWOS r16 r16 -// CMOVWOS m16 r16 -// Construct and append a CMOVWOS instruction to the active function. -// Operates on the global context. -func CMOVWOS(mr, r operand.Op) { ctx.CMOVWOS(mr, r) } - -// CMOVWPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVWPC r16 r16 -// CMOVWPC m16 r16 -// Construct and append a CMOVWPC instruction to the active function. -func (c *Context) CMOVWPC(mr, r operand.Op) { - if inst, err := x86.CMOVWPC(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVWPC r16 r16 -// CMOVWPC m16 r16 -// Construct and append a CMOVWPC instruction to the active function. -// Operates on the global context. -func CMOVWPC(mr, r operand.Op) { ctx.CMOVWPC(mr, r) } - -// CMOVWPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVWPL r16 r16 -// CMOVWPL m16 r16 -// Construct and append a CMOVWPL instruction to the active function. -func (c *Context) CMOVWPL(mr, r operand.Op) { - if inst, err := x86.CMOVWPL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVWPL r16 r16 -// CMOVWPL m16 r16 -// Construct and append a CMOVWPL instruction to the active function. -// Operates on the global context. -func CMOVWPL(mr, r operand.Op) { ctx.CMOVWPL(mr, r) } - -// CMOVWPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVWPS r16 r16 -// CMOVWPS m16 r16 -// Construct and append a CMOVWPS instruction to the active function. -func (c *Context) CMOVWPS(mr, r operand.Op) { - if inst, err := x86.CMOVWPS(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMOVWPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVWPS r16 r16 -// CMOVWPS m16 r16 -// Construct and append a CMOVWPS instruction to the active function. -// Operates on the global context. -func CMOVWPS(mr, r operand.Op) { ctx.CMOVWPS(mr, r) } - -// CMPB: Compare Two Operands. -// -// Forms: -// -// CMPB al imm8 -// CMPB r8 imm8 -// CMPB r8 r8 -// CMPB r8 m8 -// CMPB m8 imm8 -// CMPB m8 r8 -// Construct and append a CMPB instruction to the active function. -func (c *Context) CMPB(amr, imr operand.Op) { - if inst, err := x86.CMPB(amr, imr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPB: Compare Two Operands. -// -// Forms: -// -// CMPB al imm8 -// CMPB r8 imm8 -// CMPB r8 r8 -// CMPB r8 m8 -// CMPB m8 imm8 -// CMPB m8 r8 -// Construct and append a CMPB instruction to the active function. -// Operates on the global context. -func CMPB(amr, imr operand.Op) { ctx.CMPB(amr, imr) } - -// CMPL: Compare Two Operands. -// -// Forms: -// -// CMPL eax imm32 -// CMPL r32 imm8 -// CMPL r32 imm32 -// CMPL r32 r32 -// CMPL r32 m32 -// CMPL m32 imm8 -// CMPL m32 imm32 -// CMPL m32 r32 -// Construct and append a CMPL instruction to the active function. -func (c *Context) CMPL(emr, imr operand.Op) { - if inst, err := x86.CMPL(emr, imr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPL: Compare Two Operands. -// -// Forms: -// -// CMPL eax imm32 -// CMPL r32 imm8 -// CMPL r32 imm32 -// CMPL r32 r32 -// CMPL r32 m32 -// CMPL m32 imm8 -// CMPL m32 imm32 -// CMPL m32 r32 -// Construct and append a CMPL instruction to the active function. -// Operates on the global context. -func CMPL(emr, imr operand.Op) { ctx.CMPL(emr, imr) } - -// CMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPPD xmm xmm imm8 -// CMPPD m128 xmm imm8 -// Construct and append a CMPPD instruction to the active function. -func (c *Context) CMPPD(mx, x, i operand.Op) { - if inst, err := x86.CMPPD(mx, x, i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPPD xmm xmm imm8 -// CMPPD m128 xmm imm8 -// Construct and append a CMPPD instruction to the active function. -// Operates on the global context. -func CMPPD(mx, x, i operand.Op) { ctx.CMPPD(mx, x, i) } - -// CMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPPS xmm xmm imm8 -// CMPPS m128 xmm imm8 -// Construct and append a CMPPS instruction to the active function. -func (c *Context) CMPPS(mx, x, i operand.Op) { - if inst, err := x86.CMPPS(mx, x, i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPPS xmm xmm imm8 -// CMPPS m128 xmm imm8 -// Construct and append a CMPPS instruction to the active function. -// Operates on the global context. -func CMPPS(mx, x, i operand.Op) { ctx.CMPPS(mx, x, i) } - -// CMPQ: Compare Two Operands. -// -// Forms: -// -// CMPQ rax imm32 -// CMPQ r64 imm8 -// CMPQ r64 imm32 -// CMPQ r64 r64 -// CMPQ r64 m64 -// CMPQ m64 imm8 -// CMPQ m64 imm32 -// CMPQ m64 r64 -// Construct and append a CMPQ instruction to the active function. -func (c *Context) CMPQ(mr, imr operand.Op) { - if inst, err := x86.CMPQ(mr, imr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPQ: Compare Two Operands. -// -// Forms: -// -// CMPQ rax imm32 -// CMPQ r64 imm8 -// CMPQ r64 imm32 -// CMPQ r64 r64 -// CMPQ r64 m64 -// CMPQ m64 imm8 -// CMPQ m64 imm32 -// CMPQ m64 r64 -// Construct and append a CMPQ instruction to the active function. -// Operates on the global context. -func CMPQ(mr, imr operand.Op) { ctx.CMPQ(mr, imr) } - -// CMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPSD xmm xmm imm8 -// CMPSD m64 xmm imm8 -// Construct and append a CMPSD instruction to the active function. -func (c *Context) CMPSD(mx, x, i operand.Op) { - if inst, err := x86.CMPSD(mx, x, i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPSD xmm xmm imm8 -// CMPSD m64 xmm imm8 -// Construct and append a CMPSD instruction to the active function. -// Operates on the global context. -func CMPSD(mx, x, i operand.Op) { ctx.CMPSD(mx, x, i) } - -// CMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPSS xmm xmm imm8 -// CMPSS m32 xmm imm8 -// Construct and append a CMPSS instruction to the active function. -func (c *Context) CMPSS(mx, x, i operand.Op) { - if inst, err := x86.CMPSS(mx, x, i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPSS xmm xmm imm8 -// CMPSS m32 xmm imm8 -// Construct and append a CMPSS instruction to the active function. -// Operates on the global context. -func CMPSS(mx, x, i operand.Op) { ctx.CMPSS(mx, x, i) } - -// CMPW: Compare Two Operands. -// -// Forms: -// -// CMPW ax imm16 -// CMPW r16 imm8 -// CMPW r16 imm16 -// CMPW r16 r16 -// CMPW r16 m16 -// CMPW m16 imm8 -// CMPW m16 imm16 -// CMPW m16 r16 -// Construct and append a CMPW instruction to the active function. -func (c *Context) CMPW(amr, imr operand.Op) { - if inst, err := x86.CMPW(amr, imr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPW: Compare Two Operands. -// -// Forms: -// -// CMPW ax imm16 -// CMPW r16 imm8 -// CMPW r16 imm16 -// CMPW r16 r16 -// CMPW r16 m16 -// CMPW m16 imm8 -// CMPW m16 imm16 -// CMPW m16 r16 -// Construct and append a CMPW instruction to the active function. -// Operates on the global context. -func CMPW(amr, imr operand.Op) { ctx.CMPW(amr, imr) } - -// CMPXCHG16B: Compare and Exchange 16 Bytes. -// -// Forms: -// -// CMPXCHG16B m128 -// Construct and append a CMPXCHG16B instruction to the active function. -func (c *Context) CMPXCHG16B(m operand.Op) { - if inst, err := x86.CMPXCHG16B(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHG16B: Compare and Exchange 16 Bytes. -// -// Forms: -// -// CMPXCHG16B m128 -// Construct and append a CMPXCHG16B instruction to the active function. -// Operates on the global context. -func CMPXCHG16B(m operand.Op) { ctx.CMPXCHG16B(m) } - -// CMPXCHG8B: Compare and Exchange 8 Bytes. -// -// Forms: -// -// CMPXCHG8B m64 -// Construct and append a CMPXCHG8B instruction to the active function. -func (c *Context) CMPXCHG8B(m operand.Op) { - if inst, err := x86.CMPXCHG8B(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHG8B: Compare and Exchange 8 Bytes. -// -// Forms: -// -// CMPXCHG8B m64 -// Construct and append a CMPXCHG8B instruction to the active function. -// Operates on the global context. -func CMPXCHG8B(m operand.Op) { ctx.CMPXCHG8B(m) } - -// CMPXCHGB: Compare and Exchange. -// -// Forms: -// -// CMPXCHGB r8 r8 -// CMPXCHGB r8 m8 -// Construct and append a CMPXCHGB instruction to the active function. -func (c *Context) CMPXCHGB(r, mr operand.Op) { - if inst, err := x86.CMPXCHGB(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHGB: Compare and Exchange. -// -// Forms: -// -// CMPXCHGB r8 r8 -// CMPXCHGB r8 m8 -// Construct and append a CMPXCHGB instruction to the active function. -// Operates on the global context. -func CMPXCHGB(r, mr operand.Op) { ctx.CMPXCHGB(r, mr) } - -// CMPXCHGL: Compare and Exchange. -// -// Forms: -// -// CMPXCHGL r32 r32 -// CMPXCHGL r32 m32 -// Construct and append a CMPXCHGL instruction to the active function. -func (c *Context) CMPXCHGL(r, mr operand.Op) { - if inst, err := x86.CMPXCHGL(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHGL: Compare and Exchange. -// -// Forms: -// -// CMPXCHGL r32 r32 -// CMPXCHGL r32 m32 -// Construct and append a CMPXCHGL instruction to the active function. -// Operates on the global context. -func CMPXCHGL(r, mr operand.Op) { ctx.CMPXCHGL(r, mr) } - -// CMPXCHGQ: Compare and Exchange. -// -// Forms: -// -// CMPXCHGQ r64 r64 -// CMPXCHGQ r64 m64 -// Construct and append a CMPXCHGQ instruction to the active function. -func (c *Context) CMPXCHGQ(r, mr operand.Op) { - if inst, err := x86.CMPXCHGQ(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHGQ: Compare and Exchange. -// -// Forms: -// -// CMPXCHGQ r64 r64 -// CMPXCHGQ r64 m64 -// Construct and append a CMPXCHGQ instruction to the active function. -// Operates on the global context. -func CMPXCHGQ(r, mr operand.Op) { ctx.CMPXCHGQ(r, mr) } - -// CMPXCHGW: Compare and Exchange. -// -// Forms: -// -// CMPXCHGW r16 r16 -// CMPXCHGW r16 m16 -// Construct and append a CMPXCHGW instruction to the active function. -func (c *Context) CMPXCHGW(r, mr operand.Op) { - if inst, err := x86.CMPXCHGW(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CMPXCHGW: Compare and Exchange. -// -// Forms: -// -// CMPXCHGW r16 r16 -// CMPXCHGW r16 m16 -// Construct and append a CMPXCHGW instruction to the active function. -// Operates on the global context. -func CMPXCHGW(r, mr operand.Op) { ctx.CMPXCHGW(r, mr) } - -// COMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISD xmm xmm -// COMISD m64 xmm -// Construct and append a COMISD instruction to the active function. -func (c *Context) COMISD(mx, x operand.Op) { - if inst, err := x86.COMISD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// COMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISD xmm xmm -// COMISD m64 xmm -// Construct and append a COMISD instruction to the active function. -// Operates on the global context. -func COMISD(mx, x operand.Op) { ctx.COMISD(mx, x) } - -// COMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISS xmm xmm -// COMISS m32 xmm -// Construct and append a COMISS instruction to the active function. -func (c *Context) COMISS(mx, x operand.Op) { - if inst, err := x86.COMISS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// COMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISS xmm xmm -// COMISS m32 xmm -// Construct and append a COMISS instruction to the active function. -// Operates on the global context. -func COMISS(mx, x operand.Op) { ctx.COMISS(mx, x) } - -// CPUID: CPU Identification. -// -// Forms: -// -// CPUID -// Construct and append a CPUID instruction to the active function. -func (c *Context) CPUID() { - if inst, err := x86.CPUID(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CPUID: CPU Identification. -// -// Forms: -// -// CPUID -// Construct and append a CPUID instruction to the active function. -// Operates on the global context. -func CPUID() { ctx.CPUID() } - -// CQO: Convert Quadword to Octaword. -// -// Forms: -// -// CQO -// Construct and append a CQO instruction to the active function. -func (c *Context) CQO() { - if inst, err := x86.CQO(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CQO: Convert Quadword to Octaword. -// -// Forms: -// -// CQO -// Construct and append a CQO instruction to the active function. -// Operates on the global context. -func CQO() { ctx.CQO() } - -// CRC32B: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32B r8 r32 -// CRC32B m8 r32 -// CRC32B r8 r64 -// CRC32B m8 r64 -// Construct and append a CRC32B instruction to the active function. -func (c *Context) CRC32B(mr, r operand.Op) { - if inst, err := x86.CRC32B(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CRC32B: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32B r8 r32 -// CRC32B m8 r32 -// CRC32B r8 r64 -// CRC32B m8 r64 -// Construct and append a CRC32B instruction to the active function. -// Operates on the global context. -func CRC32B(mr, r operand.Op) { ctx.CRC32B(mr, r) } - -// CRC32L: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32L r32 r32 -// CRC32L m32 r32 -// Construct and append a CRC32L instruction to the active function. -func (c *Context) CRC32L(mr, r operand.Op) { - if inst, err := x86.CRC32L(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CRC32L: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32L r32 r32 -// CRC32L m32 r32 -// Construct and append a CRC32L instruction to the active function. -// Operates on the global context. -func CRC32L(mr, r operand.Op) { ctx.CRC32L(mr, r) } - -// CRC32Q: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32Q r64 r64 -// CRC32Q m64 r64 -// Construct and append a CRC32Q instruction to the active function. -func (c *Context) CRC32Q(mr, r operand.Op) { - if inst, err := x86.CRC32Q(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CRC32Q: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32Q r64 r64 -// CRC32Q m64 r64 -// Construct and append a CRC32Q instruction to the active function. -// Operates on the global context. -func CRC32Q(mr, r operand.Op) { ctx.CRC32Q(mr, r) } - -// CRC32W: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32W r16 r32 -// CRC32W m16 r32 -// Construct and append a CRC32W instruction to the active function. -func (c *Context) CRC32W(mr, r operand.Op) { - if inst, err := x86.CRC32W(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CRC32W: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32W r16 r32 -// CRC32W m16 r32 -// Construct and append a CRC32W instruction to the active function. -// Operates on the global context. -func CRC32W(mr, r operand.Op) { ctx.CRC32W(mr, r) } - -// CVTPD2PL: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPD2PL xmm xmm -// CVTPD2PL m128 xmm -// Construct and append a CVTPD2PL instruction to the active function. -func (c *Context) CVTPD2PL(mx, x operand.Op) { - if inst, err := x86.CVTPD2PL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPD2PL: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPD2PL xmm xmm -// CVTPD2PL m128 xmm -// Construct and append a CVTPD2PL instruction to the active function. -// Operates on the global context. -func CVTPD2PL(mx, x operand.Op) { ctx.CVTPD2PL(mx, x) } - -// CVTPD2PS: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPD2PS xmm xmm -// CVTPD2PS m128 xmm -// Construct and append a CVTPD2PS instruction to the active function. -func (c *Context) CVTPD2PS(mx, x operand.Op) { - if inst, err := x86.CVTPD2PS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPD2PS: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPD2PS xmm xmm -// CVTPD2PS m128 xmm -// Construct and append a CVTPD2PS instruction to the active function. -// Operates on the global context. -func CVTPD2PS(mx, x operand.Op) { ctx.CVTPD2PS(mx, x) } - -// CVTPL2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPL2PD xmm xmm -// CVTPL2PD m64 xmm -// Construct and append a CVTPL2PD instruction to the active function. -func (c *Context) CVTPL2PD(mx, x operand.Op) { - if inst, err := x86.CVTPL2PD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPL2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPL2PD xmm xmm -// CVTPL2PD m64 xmm -// Construct and append a CVTPL2PD instruction to the active function. -// Operates on the global context. -func CVTPL2PD(mx, x operand.Op) { ctx.CVTPL2PD(mx, x) } - -// CVTPL2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPL2PS xmm xmm -// CVTPL2PS m128 xmm -// Construct and append a CVTPL2PS instruction to the active function. -func (c *Context) CVTPL2PS(mx, x operand.Op) { - if inst, err := x86.CVTPL2PS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPL2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPL2PS xmm xmm -// CVTPL2PS m128 xmm -// Construct and append a CVTPL2PS instruction to the active function. -// Operates on the global context. -func CVTPL2PS(mx, x operand.Op) { ctx.CVTPL2PS(mx, x) } - -// CVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPS2PD xmm xmm -// CVTPS2PD m64 xmm -// Construct and append a CVTPS2PD instruction to the active function. -func (c *Context) CVTPS2PD(mx, x operand.Op) { - if inst, err := x86.CVTPS2PD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPS2PD xmm xmm -// CVTPS2PD m64 xmm -// Construct and append a CVTPS2PD instruction to the active function. -// Operates on the global context. -func CVTPS2PD(mx, x operand.Op) { ctx.CVTPS2PD(mx, x) } - -// CVTPS2PL: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPS2PL xmm xmm -// CVTPS2PL m128 xmm -// Construct and append a CVTPS2PL instruction to the active function. -func (c *Context) CVTPS2PL(mx, x operand.Op) { - if inst, err := x86.CVTPS2PL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTPS2PL: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPS2PL xmm xmm -// CVTPS2PL m128 xmm -// Construct and append a CVTPS2PL instruction to the active function. -// Operates on the global context. -func CVTPS2PL(mx, x operand.Op) { ctx.CVTPS2PL(mx, x) } - -// CVTSD2SL: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// CVTSD2SL xmm r32 -// CVTSD2SL m64 r32 -// CVTSD2SL xmm r64 -// CVTSD2SL m64 r64 -// Construct and append a CVTSD2SL instruction to the active function. -func (c *Context) CVTSD2SL(mx, r operand.Op) { - if inst, err := x86.CVTSD2SL(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSD2SL: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// CVTSD2SL xmm r32 -// CVTSD2SL m64 r32 -// CVTSD2SL xmm r64 -// CVTSD2SL m64 r64 -// Construct and append a CVTSD2SL instruction to the active function. -// Operates on the global context. -func CVTSD2SL(mx, r operand.Op) { ctx.CVTSD2SL(mx, r) } - -// CVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSD2SS xmm xmm -// CVTSD2SS m64 xmm -// Construct and append a CVTSD2SS instruction to the active function. -func (c *Context) CVTSD2SS(mx, x operand.Op) { - if inst, err := x86.CVTSD2SS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSD2SS xmm xmm -// CVTSD2SS m64 xmm -// Construct and append a CVTSD2SS instruction to the active function. -// Operates on the global context. -func CVTSD2SS(mx, x operand.Op) { ctx.CVTSD2SS(mx, x) } - -// CVTSL2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSL2SD r32 xmm -// CVTSL2SD m32 xmm -// Construct and append a CVTSL2SD instruction to the active function. -func (c *Context) CVTSL2SD(mr, x operand.Op) { - if inst, err := x86.CVTSL2SD(mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSL2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSL2SD r32 xmm -// CVTSL2SD m32 xmm -// Construct and append a CVTSL2SD instruction to the active function. -// Operates on the global context. -func CVTSL2SD(mr, x operand.Op) { ctx.CVTSL2SD(mr, x) } - -// CVTSL2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSL2SS r32 xmm -// CVTSL2SS m32 xmm -// Construct and append a CVTSL2SS instruction to the active function. -func (c *Context) CVTSL2SS(mr, x operand.Op) { - if inst, err := x86.CVTSL2SS(mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSL2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSL2SS r32 xmm -// CVTSL2SS m32 xmm -// Construct and append a CVTSL2SS instruction to the active function. -// Operates on the global context. -func CVTSL2SS(mr, x operand.Op) { ctx.CVTSL2SS(mr, x) } - -// CVTSQ2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSQ2SD r64 xmm -// CVTSQ2SD m64 xmm -// Construct and append a CVTSQ2SD instruction to the active function. -func (c *Context) CVTSQ2SD(mr, x operand.Op) { - if inst, err := x86.CVTSQ2SD(mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSQ2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSQ2SD r64 xmm -// CVTSQ2SD m64 xmm -// Construct and append a CVTSQ2SD instruction to the active function. -// Operates on the global context. -func CVTSQ2SD(mr, x operand.Op) { ctx.CVTSQ2SD(mr, x) } - -// CVTSQ2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSQ2SS r64 xmm -// CVTSQ2SS m64 xmm -// Construct and append a CVTSQ2SS instruction to the active function. -func (c *Context) CVTSQ2SS(mr, x operand.Op) { - if inst, err := x86.CVTSQ2SS(mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSQ2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSQ2SS r64 xmm -// CVTSQ2SS m64 xmm -// Construct and append a CVTSQ2SS instruction to the active function. -// Operates on the global context. -func CVTSQ2SS(mr, x operand.Op) { ctx.CVTSQ2SS(mr, x) } - -// CVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSS2SD xmm xmm -// CVTSS2SD m32 xmm -// Construct and append a CVTSS2SD instruction to the active function. -func (c *Context) CVTSS2SD(mx, x operand.Op) { - if inst, err := x86.CVTSS2SD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSS2SD xmm xmm -// CVTSS2SD m32 xmm -// Construct and append a CVTSS2SD instruction to the active function. -// Operates on the global context. -func CVTSS2SD(mx, x operand.Op) { ctx.CVTSS2SD(mx, x) } - -// CVTSS2SL: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTSS2SL xmm r32 -// CVTSS2SL m32 r32 -// CVTSS2SL xmm r64 -// CVTSS2SL m32 r64 -// Construct and append a CVTSS2SL instruction to the active function. -func (c *Context) CVTSS2SL(mx, r operand.Op) { - if inst, err := x86.CVTSS2SL(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTSS2SL: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTSS2SL xmm r32 -// CVTSS2SL m32 r32 -// CVTSS2SL xmm r64 -// CVTSS2SL m32 r64 -// Construct and append a CVTSS2SL instruction to the active function. -// Operates on the global context. -func CVTSS2SL(mx, r operand.Op) { ctx.CVTSS2SL(mx, r) } - -// CVTTPD2PL: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPD2PL xmm xmm -// CVTTPD2PL m128 xmm -// Construct and append a CVTTPD2PL instruction to the active function. -func (c *Context) CVTTPD2PL(mx, x operand.Op) { - if inst, err := x86.CVTTPD2PL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTTPD2PL: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPD2PL xmm xmm -// CVTTPD2PL m128 xmm -// Construct and append a CVTTPD2PL instruction to the active function. -// Operates on the global context. -func CVTTPD2PL(mx, x operand.Op) { ctx.CVTTPD2PL(mx, x) } - -// CVTTPS2PL: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPS2PL xmm xmm -// CVTTPS2PL m128 xmm -// Construct and append a CVTTPS2PL instruction to the active function. -func (c *Context) CVTTPS2PL(mx, x operand.Op) { - if inst, err := x86.CVTTPS2PL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTTPS2PL: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPS2PL xmm xmm -// CVTTPS2PL m128 xmm -// Construct and append a CVTTPS2PL instruction to the active function. -// Operates on the global context. -func CVTTPS2PL(mx, x operand.Op) { ctx.CVTTPS2PL(mx, x) } - -// CVTTSD2SL: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SL xmm r32 -// CVTTSD2SL m64 r32 -// Construct and append a CVTTSD2SL instruction to the active function. -func (c *Context) CVTTSD2SL(mx, r operand.Op) { - if inst, err := x86.CVTTSD2SL(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTTSD2SL: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SL xmm r32 -// CVTTSD2SL m64 r32 -// Construct and append a CVTTSD2SL instruction to the active function. -// Operates on the global context. -func CVTTSD2SL(mx, r operand.Op) { ctx.CVTTSD2SL(mx, r) } - -// CVTTSD2SQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SQ xmm r64 -// CVTTSD2SQ m64 r64 -// Construct and append a CVTTSD2SQ instruction to the active function. -func (c *Context) CVTTSD2SQ(mx, r operand.Op) { - if inst, err := x86.CVTTSD2SQ(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTTSD2SQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SQ xmm r64 -// CVTTSD2SQ m64 r64 -// Construct and append a CVTTSD2SQ instruction to the active function. -// Operates on the global context. -func CVTTSD2SQ(mx, r operand.Op) { ctx.CVTTSD2SQ(mx, r) } - -// CVTTSS2SL: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTTSS2SL xmm r32 -// CVTTSS2SL m32 r32 -// CVTTSS2SL xmm r64 -// CVTTSS2SL m32 r64 -// Construct and append a CVTTSS2SL instruction to the active function. -func (c *Context) CVTTSS2SL(mx, r operand.Op) { - if inst, err := x86.CVTTSS2SL(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CVTTSS2SL: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTTSS2SL xmm r32 -// CVTTSS2SL m32 r32 -// CVTTSS2SL xmm r64 -// CVTTSS2SL m32 r64 -// Construct and append a CVTTSS2SL instruction to the active function. -// Operates on the global context. -func CVTTSS2SL(mx, r operand.Op) { ctx.CVTTSS2SL(mx, r) } - -// CWD: Convert Word to Doubleword. -// -// Forms: -// -// CWD -// Construct and append a CWD instruction to the active function. -func (c *Context) CWD() { - if inst, err := x86.CWD(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CWD: Convert Word to Doubleword. -// -// Forms: -// -// CWD -// Construct and append a CWD instruction to the active function. -// Operates on the global context. -func CWD() { ctx.CWD() } - -// CWDE: Convert Word to Doubleword. -// -// Forms: -// -// CWDE -// Construct and append a CWDE instruction to the active function. -func (c *Context) CWDE() { - if inst, err := x86.CWDE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// CWDE: Convert Word to Doubleword. -// -// Forms: -// -// CWDE -// Construct and append a CWDE instruction to the active function. -// Operates on the global context. -func CWDE() { ctx.CWDE() } - -// DECB: Decrement by 1. -// -// Forms: -// -// DECB r8 -// DECB m8 -// Construct and append a DECB instruction to the active function. -func (c *Context) DECB(mr operand.Op) { - if inst, err := x86.DECB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DECB: Decrement by 1. -// -// Forms: -// -// DECB r8 -// DECB m8 -// Construct and append a DECB instruction to the active function. -// Operates on the global context. -func DECB(mr operand.Op) { ctx.DECB(mr) } - -// DECL: Decrement by 1. -// -// Forms: -// -// DECL r32 -// DECL m32 -// Construct and append a DECL instruction to the active function. -func (c *Context) DECL(mr operand.Op) { - if inst, err := x86.DECL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DECL: Decrement by 1. -// -// Forms: -// -// DECL r32 -// DECL m32 -// Construct and append a DECL instruction to the active function. -// Operates on the global context. -func DECL(mr operand.Op) { ctx.DECL(mr) } - -// DECQ: Decrement by 1. -// -// Forms: -// -// DECQ r64 -// DECQ m64 -// Construct and append a DECQ instruction to the active function. -func (c *Context) DECQ(mr operand.Op) { - if inst, err := x86.DECQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DECQ: Decrement by 1. -// -// Forms: -// -// DECQ r64 -// DECQ m64 -// Construct and append a DECQ instruction to the active function. -// Operates on the global context. -func DECQ(mr operand.Op) { ctx.DECQ(mr) } - -// DECW: Decrement by 1. -// -// Forms: -// -// DECW r16 -// DECW m16 -// Construct and append a DECW instruction to the active function. -func (c *Context) DECW(mr operand.Op) { - if inst, err := x86.DECW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DECW: Decrement by 1. -// -// Forms: -// -// DECW r16 -// DECW m16 -// Construct and append a DECW instruction to the active function. -// Operates on the global context. -func DECW(mr operand.Op) { ctx.DECW(mr) } - -// DIVB: Unsigned Divide. -// -// Forms: -// -// DIVB r8 -// DIVB m8 -// Construct and append a DIVB instruction to the active function. -func (c *Context) DIVB(mr operand.Op) { - if inst, err := x86.DIVB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVB: Unsigned Divide. -// -// Forms: -// -// DIVB r8 -// DIVB m8 -// Construct and append a DIVB instruction to the active function. -// Operates on the global context. -func DIVB(mr operand.Op) { ctx.DIVB(mr) } - -// DIVL: Unsigned Divide. -// -// Forms: -// -// DIVL r32 -// DIVL m32 -// Construct and append a DIVL instruction to the active function. -func (c *Context) DIVL(mr operand.Op) { - if inst, err := x86.DIVL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVL: Unsigned Divide. -// -// Forms: -// -// DIVL r32 -// DIVL m32 -// Construct and append a DIVL instruction to the active function. -// Operates on the global context. -func DIVL(mr operand.Op) { ctx.DIVL(mr) } - -// DIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVPD xmm xmm -// DIVPD m128 xmm -// Construct and append a DIVPD instruction to the active function. -func (c *Context) DIVPD(mx, x operand.Op) { - if inst, err := x86.DIVPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVPD xmm xmm -// DIVPD m128 xmm -// Construct and append a DIVPD instruction to the active function. -// Operates on the global context. -func DIVPD(mx, x operand.Op) { ctx.DIVPD(mx, x) } - -// DIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVPS xmm xmm -// DIVPS m128 xmm -// Construct and append a DIVPS instruction to the active function. -func (c *Context) DIVPS(mx, x operand.Op) { - if inst, err := x86.DIVPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVPS xmm xmm -// DIVPS m128 xmm -// Construct and append a DIVPS instruction to the active function. -// Operates on the global context. -func DIVPS(mx, x operand.Op) { ctx.DIVPS(mx, x) } - -// DIVQ: Unsigned Divide. -// -// Forms: -// -// DIVQ r64 -// DIVQ m64 -// Construct and append a DIVQ instruction to the active function. -func (c *Context) DIVQ(mr operand.Op) { - if inst, err := x86.DIVQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVQ: Unsigned Divide. -// -// Forms: -// -// DIVQ r64 -// DIVQ m64 -// Construct and append a DIVQ instruction to the active function. -// Operates on the global context. -func DIVQ(mr operand.Op) { ctx.DIVQ(mr) } - -// DIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVSD xmm xmm -// DIVSD m64 xmm -// Construct and append a DIVSD instruction to the active function. -func (c *Context) DIVSD(mx, x operand.Op) { - if inst, err := x86.DIVSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVSD xmm xmm -// DIVSD m64 xmm -// Construct and append a DIVSD instruction to the active function. -// Operates on the global context. -func DIVSD(mx, x operand.Op) { ctx.DIVSD(mx, x) } - -// DIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVSS xmm xmm -// DIVSS m32 xmm -// Construct and append a DIVSS instruction to the active function. -func (c *Context) DIVSS(mx, x operand.Op) { - if inst, err := x86.DIVSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVSS xmm xmm -// DIVSS m32 xmm -// Construct and append a DIVSS instruction to the active function. -// Operates on the global context. -func DIVSS(mx, x operand.Op) { ctx.DIVSS(mx, x) } - -// DIVW: Unsigned Divide. -// -// Forms: -// -// DIVW r16 -// DIVW m16 -// Construct and append a DIVW instruction to the active function. -func (c *Context) DIVW(mr operand.Op) { - if inst, err := x86.DIVW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DIVW: Unsigned Divide. -// -// Forms: -// -// DIVW r16 -// DIVW m16 -// Construct and append a DIVW instruction to the active function. -// Operates on the global context. -func DIVW(mr operand.Op) { ctx.DIVW(mr) } - -// DPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// DPPD imm8 xmm xmm -// DPPD imm8 m128 xmm -// Construct and append a DPPD instruction to the active function. -func (c *Context) DPPD(i, mx, x operand.Op) { - if inst, err := x86.DPPD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// DPPD imm8 xmm xmm -// DPPD imm8 m128 xmm -// Construct and append a DPPD instruction to the active function. -// Operates on the global context. -func DPPD(i, mx, x operand.Op) { ctx.DPPD(i, mx, x) } - -// DPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// DPPS imm8 xmm xmm -// DPPS imm8 m128 xmm -// Construct and append a DPPS instruction to the active function. -func (c *Context) DPPS(i, mx, x operand.Op) { - if inst, err := x86.DPPS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// DPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// DPPS imm8 xmm xmm -// DPPS imm8 m128 xmm -// Construct and append a DPPS instruction to the active function. -// Operates on the global context. -func DPPS(i, mx, x operand.Op) { ctx.DPPS(i, mx, x) } - -// EXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// EXTRACTPS imm2u xmm r32 -// EXTRACTPS imm2u xmm m32 -// Construct and append a EXTRACTPS instruction to the active function. -func (c *Context) EXTRACTPS(i, x, mr operand.Op) { - if inst, err := x86.EXTRACTPS(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// EXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// EXTRACTPS imm2u xmm r32 -// EXTRACTPS imm2u xmm m32 -// Construct and append a EXTRACTPS instruction to the active function. -// Operates on the global context. -func EXTRACTPS(i, x, mr operand.Op) { ctx.EXTRACTPS(i, x, mr) } - -// HADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// HADDPD xmm xmm -// HADDPD m128 xmm -// Construct and append a HADDPD instruction to the active function. -func (c *Context) HADDPD(mx, x operand.Op) { - if inst, err := x86.HADDPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// HADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// HADDPD xmm xmm -// HADDPD m128 xmm -// Construct and append a HADDPD instruction to the active function. -// Operates on the global context. -func HADDPD(mx, x operand.Op) { ctx.HADDPD(mx, x) } - -// HADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// HADDPS xmm xmm -// HADDPS m128 xmm -// Construct and append a HADDPS instruction to the active function. -func (c *Context) HADDPS(mx, x operand.Op) { - if inst, err := x86.HADDPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// HADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// HADDPS xmm xmm -// HADDPS m128 xmm -// Construct and append a HADDPS instruction to the active function. -// Operates on the global context. -func HADDPS(mx, x operand.Op) { ctx.HADDPS(mx, x) } - -// HSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPD xmm xmm -// HSUBPD m128 xmm -// Construct and append a HSUBPD instruction to the active function. -func (c *Context) HSUBPD(mx, x operand.Op) { - if inst, err := x86.HSUBPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// HSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPD xmm xmm -// HSUBPD m128 xmm -// Construct and append a HSUBPD instruction to the active function. -// Operates on the global context. -func HSUBPD(mx, x operand.Op) { ctx.HSUBPD(mx, x) } - -// HSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPS xmm xmm -// HSUBPS m128 xmm -// Construct and append a HSUBPS instruction to the active function. -func (c *Context) HSUBPS(mx, x operand.Op) { - if inst, err := x86.HSUBPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// HSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPS xmm xmm -// HSUBPS m128 xmm -// Construct and append a HSUBPS instruction to the active function. -// Operates on the global context. -func HSUBPS(mx, x operand.Op) { ctx.HSUBPS(mx, x) } - -// IDIVB: Signed Divide. -// -// Forms: -// -// IDIVB r8 -// IDIVB m8 -// Construct and append a IDIVB instruction to the active function. -func (c *Context) IDIVB(mr operand.Op) { - if inst, err := x86.IDIVB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IDIVB: Signed Divide. -// -// Forms: -// -// IDIVB r8 -// IDIVB m8 -// Construct and append a IDIVB instruction to the active function. -// Operates on the global context. -func IDIVB(mr operand.Op) { ctx.IDIVB(mr) } - -// IDIVL: Signed Divide. -// -// Forms: -// -// IDIVL r32 -// IDIVL m32 -// Construct and append a IDIVL instruction to the active function. -func (c *Context) IDIVL(mr operand.Op) { - if inst, err := x86.IDIVL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IDIVL: Signed Divide. -// -// Forms: -// -// IDIVL r32 -// IDIVL m32 -// Construct and append a IDIVL instruction to the active function. -// Operates on the global context. -func IDIVL(mr operand.Op) { ctx.IDIVL(mr) } - -// IDIVQ: Signed Divide. -// -// Forms: -// -// IDIVQ r64 -// IDIVQ m64 -// Construct and append a IDIVQ instruction to the active function. -func (c *Context) IDIVQ(mr operand.Op) { - if inst, err := x86.IDIVQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IDIVQ: Signed Divide. -// -// Forms: -// -// IDIVQ r64 -// IDIVQ m64 -// Construct and append a IDIVQ instruction to the active function. -// Operates on the global context. -func IDIVQ(mr operand.Op) { ctx.IDIVQ(mr) } - -// IDIVW: Signed Divide. -// -// Forms: -// -// IDIVW r16 -// IDIVW m16 -// Construct and append a IDIVW instruction to the active function. -func (c *Context) IDIVW(mr operand.Op) { - if inst, err := x86.IDIVW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IDIVW: Signed Divide. -// -// Forms: -// -// IDIVW r16 -// IDIVW m16 -// Construct and append a IDIVW instruction to the active function. -// Operates on the global context. -func IDIVW(mr operand.Op) { ctx.IDIVW(mr) } - -// IMUL3L: Signed Multiply. -// -// Forms: -// -// IMUL3L imm8 r32 r32 -// IMUL3L imm32 r32 r32 -// IMUL3L imm8 m32 r32 -// IMUL3L imm32 m32 r32 -// Construct and append a IMUL3L instruction to the active function. -func (c *Context) IMUL3L(i, mr, r operand.Op) { - if inst, err := x86.IMUL3L(i, mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMUL3L: Signed Multiply. -// -// Forms: -// -// IMUL3L imm8 r32 r32 -// IMUL3L imm32 r32 r32 -// IMUL3L imm8 m32 r32 -// IMUL3L imm32 m32 r32 -// Construct and append a IMUL3L instruction to the active function. -// Operates on the global context. -func IMUL3L(i, mr, r operand.Op) { ctx.IMUL3L(i, mr, r) } - -// IMUL3Q: Signed Multiply. -// -// Forms: -// -// IMUL3Q imm8 r64 r64 -// IMUL3Q imm32 r64 r64 -// IMUL3Q imm8 m64 r64 -// IMUL3Q imm32 m64 r64 -// Construct and append a IMUL3Q instruction to the active function. -func (c *Context) IMUL3Q(i, mr, r operand.Op) { - if inst, err := x86.IMUL3Q(i, mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMUL3Q: Signed Multiply. -// -// Forms: -// -// IMUL3Q imm8 r64 r64 -// IMUL3Q imm32 r64 r64 -// IMUL3Q imm8 m64 r64 -// IMUL3Q imm32 m64 r64 -// Construct and append a IMUL3Q instruction to the active function. -// Operates on the global context. -func IMUL3Q(i, mr, r operand.Op) { ctx.IMUL3Q(i, mr, r) } - -// IMUL3W: Signed Multiply. -// -// Forms: -// -// IMUL3W imm8 r16 r16 -// IMUL3W imm16 r16 r16 -// IMUL3W imm8 m16 r16 -// IMUL3W imm16 m16 r16 -// Construct and append a IMUL3W instruction to the active function. -func (c *Context) IMUL3W(i, mr, r operand.Op) { - if inst, err := x86.IMUL3W(i, mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMUL3W: Signed Multiply. -// -// Forms: -// -// IMUL3W imm8 r16 r16 -// IMUL3W imm16 r16 r16 -// IMUL3W imm8 m16 r16 -// IMUL3W imm16 m16 r16 -// Construct and append a IMUL3W instruction to the active function. -// Operates on the global context. -func IMUL3W(i, mr, r operand.Op) { ctx.IMUL3W(i, mr, r) } - -// IMULB: Signed Multiply. -// -// Forms: -// -// IMULB r8 -// IMULB m8 -// Construct and append a IMULB instruction to the active function. -func (c *Context) IMULB(mr operand.Op) { - if inst, err := x86.IMULB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMULB: Signed Multiply. -// -// Forms: -// -// IMULB r8 -// IMULB m8 -// Construct and append a IMULB instruction to the active function. -// Operates on the global context. -func IMULB(mr operand.Op) { ctx.IMULB(mr) } - -// IMULL: Signed Multiply. -// -// Forms: -// -// IMULL r32 -// IMULL m32 -// IMULL r32 r32 -// IMULL m32 r32 -// Construct and append a IMULL instruction to the active function. -func (c *Context) IMULL(ops ...operand.Op) { - if inst, err := x86.IMULL(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMULL: Signed Multiply. -// -// Forms: -// -// IMULL r32 -// IMULL m32 -// IMULL r32 r32 -// IMULL m32 r32 -// Construct and append a IMULL instruction to the active function. -// Operates on the global context. -func IMULL(ops ...operand.Op) { ctx.IMULL(ops...) } - -// IMULQ: Signed Multiply. -// -// Forms: -// -// IMULQ r64 -// IMULQ m64 -// IMULQ r64 r64 -// IMULQ m64 r64 -// Construct and append a IMULQ instruction to the active function. -func (c *Context) IMULQ(ops ...operand.Op) { - if inst, err := x86.IMULQ(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMULQ: Signed Multiply. -// -// Forms: -// -// IMULQ r64 -// IMULQ m64 -// IMULQ r64 r64 -// IMULQ m64 r64 -// Construct and append a IMULQ instruction to the active function. -// Operates on the global context. -func IMULQ(ops ...operand.Op) { ctx.IMULQ(ops...) } - -// IMULW: Signed Multiply. -// -// Forms: -// -// IMULW r16 -// IMULW m16 -// IMULW r16 r16 -// IMULW m16 r16 -// Construct and append a IMULW instruction to the active function. -func (c *Context) IMULW(ops ...operand.Op) { - if inst, err := x86.IMULW(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// IMULW: Signed Multiply. -// -// Forms: -// -// IMULW r16 -// IMULW m16 -// IMULW r16 r16 -// IMULW m16 r16 -// Construct and append a IMULW instruction to the active function. -// Operates on the global context. -func IMULW(ops ...operand.Op) { ctx.IMULW(ops...) } - -// INCB: Increment by 1. -// -// Forms: -// -// INCB r8 -// INCB m8 -// Construct and append a INCB instruction to the active function. -func (c *Context) INCB(mr operand.Op) { - if inst, err := x86.INCB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INCB: Increment by 1. -// -// Forms: -// -// INCB r8 -// INCB m8 -// Construct and append a INCB instruction to the active function. -// Operates on the global context. -func INCB(mr operand.Op) { ctx.INCB(mr) } - -// INCL: Increment by 1. -// -// Forms: -// -// INCL r32 -// INCL m32 -// Construct and append a INCL instruction to the active function. -func (c *Context) INCL(mr operand.Op) { - if inst, err := x86.INCL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INCL: Increment by 1. -// -// Forms: -// -// INCL r32 -// INCL m32 -// Construct and append a INCL instruction to the active function. -// Operates on the global context. -func INCL(mr operand.Op) { ctx.INCL(mr) } - -// INCQ: Increment by 1. -// -// Forms: -// -// INCQ r64 -// INCQ m64 -// Construct and append a INCQ instruction to the active function. -func (c *Context) INCQ(mr operand.Op) { - if inst, err := x86.INCQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INCQ: Increment by 1. -// -// Forms: -// -// INCQ r64 -// INCQ m64 -// Construct and append a INCQ instruction to the active function. -// Operates on the global context. -func INCQ(mr operand.Op) { ctx.INCQ(mr) } - -// INCW: Increment by 1. -// -// Forms: -// -// INCW r16 -// INCW m16 -// Construct and append a INCW instruction to the active function. -func (c *Context) INCW(mr operand.Op) { - if inst, err := x86.INCW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INCW: Increment by 1. -// -// Forms: -// -// INCW r16 -// INCW m16 -// Construct and append a INCW instruction to the active function. -// Operates on the global context. -func INCW(mr operand.Op) { ctx.INCW(mr) } - -// INSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// INSERTPS imm8 xmm xmm -// INSERTPS imm8 m32 xmm -// Construct and append a INSERTPS instruction to the active function. -func (c *Context) INSERTPS(i, mx, x operand.Op) { - if inst, err := x86.INSERTPS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// INSERTPS imm8 xmm xmm -// INSERTPS imm8 m32 xmm -// Construct and append a INSERTPS instruction to the active function. -// Operates on the global context. -func INSERTPS(i, mx, x operand.Op) { ctx.INSERTPS(i, mx, x) } - -// INT: Call to Interrupt Procedure. -// -// Forms: -// -// INT 3 -// INT imm8 -// Construct and append a INT instruction to the active function. -func (c *Context) INT(i operand.Op) { - if inst, err := x86.INT(i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// INT: Call to Interrupt Procedure. -// -// Forms: -// -// INT 3 -// INT imm8 -// Construct and append a INT instruction to the active function. -// Operates on the global context. -func INT(i operand.Op) { ctx.INT(i) } - -// JA: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JA rel8 -// JA rel32 -// Construct and append a JA instruction to the active function. -func (c *Context) JA(r operand.Op) { - if inst, err := x86.JA(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JA: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JA rel8 -// JA rel32 -// Construct and append a JA instruction to the active function. -// Operates on the global context. -func JA(r operand.Op) { ctx.JA(r) } - -// JAE: Jump if above or equal (CF == 0). -// -// Forms: -// -// JAE rel8 -// JAE rel32 -// Construct and append a JAE instruction to the active function. -func (c *Context) JAE(r operand.Op) { - if inst, err := x86.JAE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JAE: Jump if above or equal (CF == 0). -// -// Forms: -// -// JAE rel8 -// JAE rel32 -// Construct and append a JAE instruction to the active function. -// Operates on the global context. -func JAE(r operand.Op) { ctx.JAE(r) } - -// JB: Jump if below (CF == 1). -// -// Forms: -// -// JB rel8 -// JB rel32 -// Construct and append a JB instruction to the active function. -func (c *Context) JB(r operand.Op) { - if inst, err := x86.JB(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JB: Jump if below (CF == 1). -// -// Forms: -// -// JB rel8 -// JB rel32 -// Construct and append a JB instruction to the active function. -// Operates on the global context. -func JB(r operand.Op) { ctx.JB(r) } - -// JBE: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JBE rel8 -// JBE rel32 -// Construct and append a JBE instruction to the active function. -func (c *Context) JBE(r operand.Op) { - if inst, err := x86.JBE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JBE: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JBE rel8 -// JBE rel32 -// Construct and append a JBE instruction to the active function. -// Operates on the global context. -func JBE(r operand.Op) { ctx.JBE(r) } - -// JC: Jump if below (CF == 1). -// -// Forms: -// -// JC rel8 -// JC rel32 -// Construct and append a JC instruction to the active function. -func (c *Context) JC(r operand.Op) { - if inst, err := x86.JC(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JC: Jump if below (CF == 1). -// -// Forms: -// -// JC rel8 -// JC rel32 -// Construct and append a JC instruction to the active function. -// Operates on the global context. -func JC(r operand.Op) { ctx.JC(r) } - -// JCC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JCC rel8 -// JCC rel32 -// Construct and append a JCC instruction to the active function. -func (c *Context) JCC(r operand.Op) { - if inst, err := x86.JCC(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JCC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JCC rel8 -// JCC rel32 -// Construct and append a JCC instruction to the active function. -// Operates on the global context. -func JCC(r operand.Op) { ctx.JCC(r) } - -// JCS: Jump if below (CF == 1). -// -// Forms: -// -// JCS rel8 -// JCS rel32 -// Construct and append a JCS instruction to the active function. -func (c *Context) JCS(r operand.Op) { - if inst, err := x86.JCS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JCS: Jump if below (CF == 1). -// -// Forms: -// -// JCS rel8 -// JCS rel32 -// Construct and append a JCS instruction to the active function. -// Operates on the global context. -func JCS(r operand.Op) { ctx.JCS(r) } - -// JCXZL: Jump if ECX register is 0. -// -// Forms: -// -// JCXZL rel8 -// Construct and append a JCXZL instruction to the active function. -func (c *Context) JCXZL(r operand.Op) { - if inst, err := x86.JCXZL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JCXZL: Jump if ECX register is 0. -// -// Forms: -// -// JCXZL rel8 -// Construct and append a JCXZL instruction to the active function. -// Operates on the global context. -func JCXZL(r operand.Op) { ctx.JCXZL(r) } - -// JCXZQ: Jump if RCX register is 0. -// -// Forms: -// -// JCXZQ rel8 -// Construct and append a JCXZQ instruction to the active function. -func (c *Context) JCXZQ(r operand.Op) { - if inst, err := x86.JCXZQ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JCXZQ: Jump if RCX register is 0. -// -// Forms: -// -// JCXZQ rel8 -// Construct and append a JCXZQ instruction to the active function. -// Operates on the global context. -func JCXZQ(r operand.Op) { ctx.JCXZQ(r) } - -// JE: Jump if equal (ZF == 1). -// -// Forms: -// -// JE rel8 -// JE rel32 -// Construct and append a JE instruction to the active function. -func (c *Context) JE(r operand.Op) { - if inst, err := x86.JE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JE: Jump if equal (ZF == 1). -// -// Forms: -// -// JE rel8 -// JE rel32 -// Construct and append a JE instruction to the active function. -// Operates on the global context. -func JE(r operand.Op) { ctx.JE(r) } - -// JEQ: Jump if equal (ZF == 1). -// -// Forms: -// -// JEQ rel8 -// JEQ rel32 -// Construct and append a JEQ instruction to the active function. -func (c *Context) JEQ(r operand.Op) { - if inst, err := x86.JEQ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JEQ: Jump if equal (ZF == 1). -// -// Forms: -// -// JEQ rel8 -// JEQ rel32 -// Construct and append a JEQ instruction to the active function. -// Operates on the global context. -func JEQ(r operand.Op) { ctx.JEQ(r) } - -// JG: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JG rel8 -// JG rel32 -// Construct and append a JG instruction to the active function. -func (c *Context) JG(r operand.Op) { - if inst, err := x86.JG(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JG: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JG rel8 -// JG rel32 -// Construct and append a JG instruction to the active function. -// Operates on the global context. -func JG(r operand.Op) { ctx.JG(r) } - -// JGE: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JGE rel8 -// JGE rel32 -// Construct and append a JGE instruction to the active function. -func (c *Context) JGE(r operand.Op) { - if inst, err := x86.JGE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JGE: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JGE rel8 -// JGE rel32 -// Construct and append a JGE instruction to the active function. -// Operates on the global context. -func JGE(r operand.Op) { ctx.JGE(r) } - -// JGT: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JGT rel8 -// JGT rel32 -// Construct and append a JGT instruction to the active function. -func (c *Context) JGT(r operand.Op) { - if inst, err := x86.JGT(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JGT: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JGT rel8 -// JGT rel32 -// Construct and append a JGT instruction to the active function. -// Operates on the global context. -func JGT(r operand.Op) { ctx.JGT(r) } - -// JHI: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JHI rel8 -// JHI rel32 -// Construct and append a JHI instruction to the active function. -func (c *Context) JHI(r operand.Op) { - if inst, err := x86.JHI(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JHI: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JHI rel8 -// JHI rel32 -// Construct and append a JHI instruction to the active function. -// Operates on the global context. -func JHI(r operand.Op) { ctx.JHI(r) } - -// JHS: Jump if above or equal (CF == 0). -// -// Forms: -// -// JHS rel8 -// JHS rel32 -// Construct and append a JHS instruction to the active function. -func (c *Context) JHS(r operand.Op) { - if inst, err := x86.JHS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JHS: Jump if above or equal (CF == 0). -// -// Forms: -// -// JHS rel8 -// JHS rel32 -// Construct and append a JHS instruction to the active function. -// Operates on the global context. -func JHS(r operand.Op) { ctx.JHS(r) } - -// JL: Jump if less (SF != OF). -// -// Forms: -// -// JL rel8 -// JL rel32 -// Construct and append a JL instruction to the active function. -func (c *Context) JL(r operand.Op) { - if inst, err := x86.JL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JL: Jump if less (SF != OF). -// -// Forms: -// -// JL rel8 -// JL rel32 -// Construct and append a JL instruction to the active function. -// Operates on the global context. -func JL(r operand.Op) { ctx.JL(r) } - -// JLE: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JLE rel8 -// JLE rel32 -// Construct and append a JLE instruction to the active function. -func (c *Context) JLE(r operand.Op) { - if inst, err := x86.JLE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JLE: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JLE rel8 -// JLE rel32 -// Construct and append a JLE instruction to the active function. -// Operates on the global context. -func JLE(r operand.Op) { ctx.JLE(r) } - -// JLO: Jump if below (CF == 1). -// -// Forms: -// -// JLO rel8 -// JLO rel32 -// Construct and append a JLO instruction to the active function. -func (c *Context) JLO(r operand.Op) { - if inst, err := x86.JLO(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JLO: Jump if below (CF == 1). -// -// Forms: -// -// JLO rel8 -// JLO rel32 -// Construct and append a JLO instruction to the active function. -// Operates on the global context. -func JLO(r operand.Op) { ctx.JLO(r) } - -// JLS: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JLS rel8 -// JLS rel32 -// Construct and append a JLS instruction to the active function. -func (c *Context) JLS(r operand.Op) { - if inst, err := x86.JLS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JLS: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JLS rel8 -// JLS rel32 -// Construct and append a JLS instruction to the active function. -// Operates on the global context. -func JLS(r operand.Op) { ctx.JLS(r) } - -// JLT: Jump if less (SF != OF). -// -// Forms: -// -// JLT rel8 -// JLT rel32 -// Construct and append a JLT instruction to the active function. -func (c *Context) JLT(r operand.Op) { - if inst, err := x86.JLT(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JLT: Jump if less (SF != OF). -// -// Forms: -// -// JLT rel8 -// JLT rel32 -// Construct and append a JLT instruction to the active function. -// Operates on the global context. -func JLT(r operand.Op) { ctx.JLT(r) } - -// JMI: Jump if sign (SF == 1). -// -// Forms: -// -// JMI rel8 -// JMI rel32 -// Construct and append a JMI instruction to the active function. -func (c *Context) JMI(r operand.Op) { - if inst, err := x86.JMI(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JMI: Jump if sign (SF == 1). -// -// Forms: -// -// JMI rel8 -// JMI rel32 -// Construct and append a JMI instruction to the active function. -// Operates on the global context. -func JMI(r operand.Op) { ctx.JMI(r) } - -// JMP: Jump Unconditionally. -// -// Forms: -// -// JMP rel8 -// JMP rel32 -// JMP r64 -// JMP m64 -// Construct and append a JMP instruction to the active function. -func (c *Context) JMP(mr operand.Op) { - if inst, err := x86.JMP(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JMP: Jump Unconditionally. -// -// Forms: -// -// JMP rel8 -// JMP rel32 -// JMP r64 -// JMP m64 -// Construct and append a JMP instruction to the active function. -// Operates on the global context. -func JMP(mr operand.Op) { ctx.JMP(mr) } - -// JNA: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JNA rel8 -// JNA rel32 -// Construct and append a JNA instruction to the active function. -func (c *Context) JNA(r operand.Op) { - if inst, err := x86.JNA(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNA: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JNA rel8 -// JNA rel32 -// Construct and append a JNA instruction to the active function. -// Operates on the global context. -func JNA(r operand.Op) { ctx.JNA(r) } - -// JNAE: Jump if below (CF == 1). -// -// Forms: -// -// JNAE rel8 -// JNAE rel32 -// Construct and append a JNAE instruction to the active function. -func (c *Context) JNAE(r operand.Op) { - if inst, err := x86.JNAE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNAE: Jump if below (CF == 1). -// -// Forms: -// -// JNAE rel8 -// JNAE rel32 -// Construct and append a JNAE instruction to the active function. -// Operates on the global context. -func JNAE(r operand.Op) { ctx.JNAE(r) } - -// JNB: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNB rel8 -// JNB rel32 -// Construct and append a JNB instruction to the active function. -func (c *Context) JNB(r operand.Op) { - if inst, err := x86.JNB(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNB: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNB rel8 -// JNB rel32 -// Construct and append a JNB instruction to the active function. -// Operates on the global context. -func JNB(r operand.Op) { ctx.JNB(r) } - -// JNBE: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JNBE rel8 -// JNBE rel32 -// Construct and append a JNBE instruction to the active function. -func (c *Context) JNBE(r operand.Op) { - if inst, err := x86.JNBE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNBE: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JNBE rel8 -// JNBE rel32 -// Construct and append a JNBE instruction to the active function. -// Operates on the global context. -func JNBE(r operand.Op) { ctx.JNBE(r) } - -// JNC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNC rel8 -// JNC rel32 -// Construct and append a JNC instruction to the active function. -func (c *Context) JNC(r operand.Op) { - if inst, err := x86.JNC(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNC rel8 -// JNC rel32 -// Construct and append a JNC instruction to the active function. -// Operates on the global context. -func JNC(r operand.Op) { ctx.JNC(r) } - -// JNE: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNE rel8 -// JNE rel32 -// Construct and append a JNE instruction to the active function. -func (c *Context) JNE(r operand.Op) { - if inst, err := x86.JNE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNE: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNE rel8 -// JNE rel32 -// Construct and append a JNE instruction to the active function. -// Operates on the global context. -func JNE(r operand.Op) { ctx.JNE(r) } - -// JNG: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JNG rel8 -// JNG rel32 -// Construct and append a JNG instruction to the active function. -func (c *Context) JNG(r operand.Op) { - if inst, err := x86.JNG(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNG: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JNG rel8 -// JNG rel32 -// Construct and append a JNG instruction to the active function. -// Operates on the global context. -func JNG(r operand.Op) { ctx.JNG(r) } - -// JNGE: Jump if less (SF != OF). -// -// Forms: -// -// JNGE rel8 -// JNGE rel32 -// Construct and append a JNGE instruction to the active function. -func (c *Context) JNGE(r operand.Op) { - if inst, err := x86.JNGE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNGE: Jump if less (SF != OF). -// -// Forms: -// -// JNGE rel8 -// JNGE rel32 -// Construct and append a JNGE instruction to the active function. -// Operates on the global context. -func JNGE(r operand.Op) { ctx.JNGE(r) } - -// JNL: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JNL rel8 -// JNL rel32 -// Construct and append a JNL instruction to the active function. -func (c *Context) JNL(r operand.Op) { - if inst, err := x86.JNL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNL: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JNL rel8 -// JNL rel32 -// Construct and append a JNL instruction to the active function. -// Operates on the global context. -func JNL(r operand.Op) { ctx.JNL(r) } - -// JNLE: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JNLE rel8 -// JNLE rel32 -// Construct and append a JNLE instruction to the active function. -func (c *Context) JNLE(r operand.Op) { - if inst, err := x86.JNLE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNLE: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JNLE rel8 -// JNLE rel32 -// Construct and append a JNLE instruction to the active function. -// Operates on the global context. -func JNLE(r operand.Op) { ctx.JNLE(r) } - -// JNO: Jump if not overflow (OF == 0). -// -// Forms: -// -// JNO rel8 -// JNO rel32 -// Construct and append a JNO instruction to the active function. -func (c *Context) JNO(r operand.Op) { - if inst, err := x86.JNO(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNO: Jump if not overflow (OF == 0). -// -// Forms: -// -// JNO rel8 -// JNO rel32 -// Construct and append a JNO instruction to the active function. -// Operates on the global context. -func JNO(r operand.Op) { ctx.JNO(r) } - -// JNP: Jump if not parity (PF == 0). -// -// Forms: -// -// JNP rel8 -// JNP rel32 -// Construct and append a JNP instruction to the active function. -func (c *Context) JNP(r operand.Op) { - if inst, err := x86.JNP(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNP: Jump if not parity (PF == 0). -// -// Forms: -// -// JNP rel8 -// JNP rel32 -// Construct and append a JNP instruction to the active function. -// Operates on the global context. -func JNP(r operand.Op) { ctx.JNP(r) } - -// JNS: Jump if not sign (SF == 0). -// -// Forms: -// -// JNS rel8 -// JNS rel32 -// Construct and append a JNS instruction to the active function. -func (c *Context) JNS(r operand.Op) { - if inst, err := x86.JNS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNS: Jump if not sign (SF == 0). -// -// Forms: -// -// JNS rel8 -// JNS rel32 -// Construct and append a JNS instruction to the active function. -// Operates on the global context. -func JNS(r operand.Op) { ctx.JNS(r) } - -// JNZ: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNZ rel8 -// JNZ rel32 -// Construct and append a JNZ instruction to the active function. -func (c *Context) JNZ(r operand.Op) { - if inst, err := x86.JNZ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JNZ: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNZ rel8 -// JNZ rel32 -// Construct and append a JNZ instruction to the active function. -// Operates on the global context. -func JNZ(r operand.Op) { ctx.JNZ(r) } - -// JO: Jump if overflow (OF == 1). -// -// Forms: -// -// JO rel8 -// JO rel32 -// Construct and append a JO instruction to the active function. -func (c *Context) JO(r operand.Op) { - if inst, err := x86.JO(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JO: Jump if overflow (OF == 1). -// -// Forms: -// -// JO rel8 -// JO rel32 -// Construct and append a JO instruction to the active function. -// Operates on the global context. -func JO(r operand.Op) { ctx.JO(r) } - -// JOC: Jump if not overflow (OF == 0). -// -// Forms: -// -// JOC rel8 -// JOC rel32 -// Construct and append a JOC instruction to the active function. -func (c *Context) JOC(r operand.Op) { - if inst, err := x86.JOC(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JOC: Jump if not overflow (OF == 0). -// -// Forms: -// -// JOC rel8 -// JOC rel32 -// Construct and append a JOC instruction to the active function. -// Operates on the global context. -func JOC(r operand.Op) { ctx.JOC(r) } - -// JOS: Jump if overflow (OF == 1). -// -// Forms: -// -// JOS rel8 -// JOS rel32 -// Construct and append a JOS instruction to the active function. -func (c *Context) JOS(r operand.Op) { - if inst, err := x86.JOS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JOS: Jump if overflow (OF == 1). -// -// Forms: -// -// JOS rel8 -// JOS rel32 -// Construct and append a JOS instruction to the active function. -// Operates on the global context. -func JOS(r operand.Op) { ctx.JOS(r) } - -// JP: Jump if parity (PF == 1). -// -// Forms: -// -// JP rel8 -// JP rel32 -// Construct and append a JP instruction to the active function. -func (c *Context) JP(r operand.Op) { - if inst, err := x86.JP(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JP: Jump if parity (PF == 1). -// -// Forms: -// -// JP rel8 -// JP rel32 -// Construct and append a JP instruction to the active function. -// Operates on the global context. -func JP(r operand.Op) { ctx.JP(r) } - -// JPC: Jump if not parity (PF == 0). -// -// Forms: -// -// JPC rel8 -// JPC rel32 -// Construct and append a JPC instruction to the active function. -func (c *Context) JPC(r operand.Op) { - if inst, err := x86.JPC(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JPC: Jump if not parity (PF == 0). -// -// Forms: -// -// JPC rel8 -// JPC rel32 -// Construct and append a JPC instruction to the active function. -// Operates on the global context. -func JPC(r operand.Op) { ctx.JPC(r) } - -// JPE: Jump if parity (PF == 1). -// -// Forms: -// -// JPE rel8 -// JPE rel32 -// Construct and append a JPE instruction to the active function. -func (c *Context) JPE(r operand.Op) { - if inst, err := x86.JPE(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JPE: Jump if parity (PF == 1). -// -// Forms: -// -// JPE rel8 -// JPE rel32 -// Construct and append a JPE instruction to the active function. -// Operates on the global context. -func JPE(r operand.Op) { ctx.JPE(r) } - -// JPL: Jump if not sign (SF == 0). -// -// Forms: -// -// JPL rel8 -// JPL rel32 -// Construct and append a JPL instruction to the active function. -func (c *Context) JPL(r operand.Op) { - if inst, err := x86.JPL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JPL: Jump if not sign (SF == 0). -// -// Forms: -// -// JPL rel8 -// JPL rel32 -// Construct and append a JPL instruction to the active function. -// Operates on the global context. -func JPL(r operand.Op) { ctx.JPL(r) } - -// JPO: Jump if not parity (PF == 0). -// -// Forms: -// -// JPO rel8 -// JPO rel32 -// Construct and append a JPO instruction to the active function. -func (c *Context) JPO(r operand.Op) { - if inst, err := x86.JPO(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JPO: Jump if not parity (PF == 0). -// -// Forms: -// -// JPO rel8 -// JPO rel32 -// Construct and append a JPO instruction to the active function. -// Operates on the global context. -func JPO(r operand.Op) { ctx.JPO(r) } - -// JPS: Jump if parity (PF == 1). -// -// Forms: -// -// JPS rel8 -// JPS rel32 -// Construct and append a JPS instruction to the active function. -func (c *Context) JPS(r operand.Op) { - if inst, err := x86.JPS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JPS: Jump if parity (PF == 1). -// -// Forms: -// -// JPS rel8 -// JPS rel32 -// Construct and append a JPS instruction to the active function. -// Operates on the global context. -func JPS(r operand.Op) { ctx.JPS(r) } - -// JS: Jump if sign (SF == 1). -// -// Forms: -// -// JS rel8 -// JS rel32 -// Construct and append a JS instruction to the active function. -func (c *Context) JS(r operand.Op) { - if inst, err := x86.JS(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JS: Jump if sign (SF == 1). -// -// Forms: -// -// JS rel8 -// JS rel32 -// Construct and append a JS instruction to the active function. -// Operates on the global context. -func JS(r operand.Op) { ctx.JS(r) } - -// JZ: Jump if equal (ZF == 1). -// -// Forms: -// -// JZ rel8 -// JZ rel32 -// Construct and append a JZ instruction to the active function. -func (c *Context) JZ(r operand.Op) { - if inst, err := x86.JZ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// JZ: Jump if equal (ZF == 1). -// -// Forms: -// -// JZ rel8 -// JZ rel32 -// Construct and append a JZ instruction to the active function. -// Operates on the global context. -func JZ(r operand.Op) { ctx.JZ(r) } - -// LDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// LDDQU m128 xmm -// Construct and append a LDDQU instruction to the active function. -func (c *Context) LDDQU(m, x operand.Op) { - if inst, err := x86.LDDQU(m, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// LDDQU m128 xmm -// Construct and append a LDDQU instruction to the active function. -// Operates on the global context. -func LDDQU(m, x operand.Op) { ctx.LDDQU(m, x) } - -// LDMXCSR: Load MXCSR Register. -// -// Forms: -// -// LDMXCSR m32 -// Construct and append a LDMXCSR instruction to the active function. -func (c *Context) LDMXCSR(m operand.Op) { - if inst, err := x86.LDMXCSR(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LDMXCSR: Load MXCSR Register. -// -// Forms: -// -// LDMXCSR m32 -// Construct and append a LDMXCSR instruction to the active function. -// Operates on the global context. -func LDMXCSR(m operand.Op) { ctx.LDMXCSR(m) } - -// LEAL: Load Effective Address. -// -// Forms: -// -// LEAL m r32 -// Construct and append a LEAL instruction to the active function. -func (c *Context) LEAL(m, r operand.Op) { - if inst, err := x86.LEAL(m, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LEAL: Load Effective Address. -// -// Forms: -// -// LEAL m r32 -// Construct and append a LEAL instruction to the active function. -// Operates on the global context. -func LEAL(m, r operand.Op) { ctx.LEAL(m, r) } - -// LEAQ: Load Effective Address. -// -// Forms: -// -// LEAQ m r64 -// Construct and append a LEAQ instruction to the active function. -func (c *Context) LEAQ(m, r operand.Op) { - if inst, err := x86.LEAQ(m, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LEAQ: Load Effective Address. -// -// Forms: -// -// LEAQ m r64 -// Construct and append a LEAQ instruction to the active function. -// Operates on the global context. -func LEAQ(m, r operand.Op) { ctx.LEAQ(m, r) } - -// LEAW: Load Effective Address. -// -// Forms: -// -// LEAW m r16 -// Construct and append a LEAW instruction to the active function. -func (c *Context) LEAW(m, r operand.Op) { - if inst, err := x86.LEAW(m, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LEAW: Load Effective Address. -// -// Forms: -// -// LEAW m r16 -// Construct and append a LEAW instruction to the active function. -// Operates on the global context. -func LEAW(m, r operand.Op) { ctx.LEAW(m, r) } - -// LFENCE: Load Fence. -// -// Forms: -// -// LFENCE -// Construct and append a LFENCE instruction to the active function. -func (c *Context) LFENCE() { - if inst, err := x86.LFENCE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LFENCE: Load Fence. -// -// Forms: -// -// LFENCE -// Construct and append a LFENCE instruction to the active function. -// Operates on the global context. -func LFENCE() { ctx.LFENCE() } - -// LZCNTL: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTL r32 r32 -// LZCNTL m32 r32 -// Construct and append a LZCNTL instruction to the active function. -func (c *Context) LZCNTL(mr, r operand.Op) { - if inst, err := x86.LZCNTL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LZCNTL: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTL r32 r32 -// LZCNTL m32 r32 -// Construct and append a LZCNTL instruction to the active function. -// Operates on the global context. -func LZCNTL(mr, r operand.Op) { ctx.LZCNTL(mr, r) } - -// LZCNTQ: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTQ r64 r64 -// LZCNTQ m64 r64 -// Construct and append a LZCNTQ instruction to the active function. -func (c *Context) LZCNTQ(mr, r operand.Op) { - if inst, err := x86.LZCNTQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LZCNTQ: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTQ r64 r64 -// LZCNTQ m64 r64 -// Construct and append a LZCNTQ instruction to the active function. -// Operates on the global context. -func LZCNTQ(mr, r operand.Op) { ctx.LZCNTQ(mr, r) } - -// LZCNTW: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTW r16 r16 -// LZCNTW m16 r16 -// Construct and append a LZCNTW instruction to the active function. -func (c *Context) LZCNTW(mr, r operand.Op) { - if inst, err := x86.LZCNTW(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// LZCNTW: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTW r16 r16 -// LZCNTW m16 r16 -// Construct and append a LZCNTW instruction to the active function. -// Operates on the global context. -func LZCNTW(mr, r operand.Op) { ctx.LZCNTW(mr, r) } - -// MASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVDQU xmm xmm -// Construct and append a MASKMOVDQU instruction to the active function. -func (c *Context) MASKMOVDQU(x, x1 operand.Op) { - if inst, err := x86.MASKMOVDQU(x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVDQU xmm xmm -// Construct and append a MASKMOVDQU instruction to the active function. -// Operates on the global context. -func MASKMOVDQU(x, x1 operand.Op) { ctx.MASKMOVDQU(x, x1) } - -// MASKMOVOU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVOU xmm xmm -// Construct and append a MASKMOVOU instruction to the active function. -func (c *Context) MASKMOVOU(x, x1 operand.Op) { - if inst, err := x86.MASKMOVOU(x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MASKMOVOU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVOU xmm xmm -// Construct and append a MASKMOVOU instruction to the active function. -// Operates on the global context. -func MASKMOVOU(x, x1 operand.Op) { ctx.MASKMOVOU(x, x1) } - -// MAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MAXPD xmm xmm -// MAXPD m128 xmm -// Construct and append a MAXPD instruction to the active function. -func (c *Context) MAXPD(mx, x operand.Op) { - if inst, err := x86.MAXPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MAXPD xmm xmm -// MAXPD m128 xmm -// Construct and append a MAXPD instruction to the active function. -// Operates on the global context. -func MAXPD(mx, x operand.Op) { ctx.MAXPD(mx, x) } - -// MAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MAXPS xmm xmm -// MAXPS m128 xmm -// Construct and append a MAXPS instruction to the active function. -func (c *Context) MAXPS(mx, x operand.Op) { - if inst, err := x86.MAXPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MAXPS xmm xmm -// MAXPS m128 xmm -// Construct and append a MAXPS instruction to the active function. -// Operates on the global context. -func MAXPS(mx, x operand.Op) { ctx.MAXPS(mx, x) } - -// MAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MAXSD xmm xmm -// MAXSD m64 xmm -// Construct and append a MAXSD instruction to the active function. -func (c *Context) MAXSD(mx, x operand.Op) { - if inst, err := x86.MAXSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MAXSD xmm xmm -// MAXSD m64 xmm -// Construct and append a MAXSD instruction to the active function. -// Operates on the global context. -func MAXSD(mx, x operand.Op) { ctx.MAXSD(mx, x) } - -// MAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MAXSS xmm xmm -// MAXSS m32 xmm -// Construct and append a MAXSS instruction to the active function. -func (c *Context) MAXSS(mx, x operand.Op) { - if inst, err := x86.MAXSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MAXSS xmm xmm -// MAXSS m32 xmm -// Construct and append a MAXSS instruction to the active function. -// Operates on the global context. -func MAXSS(mx, x operand.Op) { ctx.MAXSS(mx, x) } - -// MFENCE: Memory Fence. -// -// Forms: -// -// MFENCE -// Construct and append a MFENCE instruction to the active function. -func (c *Context) MFENCE() { - if inst, err := x86.MFENCE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MFENCE: Memory Fence. -// -// Forms: -// -// MFENCE -// Construct and append a MFENCE instruction to the active function. -// Operates on the global context. -func MFENCE() { ctx.MFENCE() } - -// MINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MINPD xmm xmm -// MINPD m128 xmm -// Construct and append a MINPD instruction to the active function. -func (c *Context) MINPD(mx, x operand.Op) { - if inst, err := x86.MINPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MINPD xmm xmm -// MINPD m128 xmm -// Construct and append a MINPD instruction to the active function. -// Operates on the global context. -func MINPD(mx, x operand.Op) { ctx.MINPD(mx, x) } - -// MINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MINPS xmm xmm -// MINPS m128 xmm -// Construct and append a MINPS instruction to the active function. -func (c *Context) MINPS(mx, x operand.Op) { - if inst, err := x86.MINPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MINPS xmm xmm -// MINPS m128 xmm -// Construct and append a MINPS instruction to the active function. -// Operates on the global context. -func MINPS(mx, x operand.Op) { ctx.MINPS(mx, x) } - -// MINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MINSD xmm xmm -// MINSD m64 xmm -// Construct and append a MINSD instruction to the active function. -func (c *Context) MINSD(mx, x operand.Op) { - if inst, err := x86.MINSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MINSD xmm xmm -// MINSD m64 xmm -// Construct and append a MINSD instruction to the active function. -// Operates on the global context. -func MINSD(mx, x operand.Op) { ctx.MINSD(mx, x) } - -// MINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MINSS xmm xmm -// MINSS m32 xmm -// Construct and append a MINSS instruction to the active function. -func (c *Context) MINSS(mx, x operand.Op) { - if inst, err := x86.MINSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MINSS xmm xmm -// MINSS m32 xmm -// Construct and append a MINSS instruction to the active function. -// Operates on the global context. -func MINSS(mx, x operand.Op) { ctx.MINSS(mx, x) } - -// MONITOR: Monitor a Linear Address Range. -// -// Forms: -// -// MONITOR -// Construct and append a MONITOR instruction to the active function. -func (c *Context) MONITOR() { - if inst, err := x86.MONITOR(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MONITOR: Monitor a Linear Address Range. -// -// Forms: -// -// MONITOR -// Construct and append a MONITOR instruction to the active function. -// Operates on the global context. -func MONITOR() { ctx.MONITOR() } - -// MOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPD xmm xmm -// MOVAPD m128 xmm -// MOVAPD xmm m128 -// Construct and append a MOVAPD instruction to the active function. -func (c *Context) MOVAPD(mx, mx1 operand.Op) { - if inst, err := x86.MOVAPD(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPD xmm xmm -// MOVAPD m128 xmm -// MOVAPD xmm m128 -// Construct and append a MOVAPD instruction to the active function. -// Operates on the global context. -func MOVAPD(mx, mx1 operand.Op) { ctx.MOVAPD(mx, mx1) } - -// MOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPS xmm xmm -// MOVAPS m128 xmm -// MOVAPS xmm m128 -// Construct and append a MOVAPS instruction to the active function. -func (c *Context) MOVAPS(mx, mx1 operand.Op) { - if inst, err := x86.MOVAPS(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPS xmm xmm -// MOVAPS m128 xmm -// MOVAPS xmm m128 -// Construct and append a MOVAPS instruction to the active function. -// Operates on the global context. -func MOVAPS(mx, mx1 operand.Op) { ctx.MOVAPS(mx, mx1) } - -// MOVB: Move. -// -// Forms: -// -// MOVB imm8 r8 -// MOVB r8 r8 -// MOVB m8 r8 -// MOVB imm8 m8 -// MOVB r8 m8 -// Construct and append a MOVB instruction to the active function. -func (c *Context) MOVB(imr, mr operand.Op) { - if inst, err := x86.MOVB(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVB: Move. -// -// Forms: -// -// MOVB imm8 r8 -// MOVB r8 r8 -// MOVB m8 r8 -// MOVB imm8 m8 -// MOVB r8 m8 -// Construct and append a MOVB instruction to the active function. -// Operates on the global context. -func MOVB(imr, mr operand.Op) { ctx.MOVB(imr, mr) } - -// MOVBELL: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBELL m32 r32 -// MOVBELL r32 m32 -// Construct and append a MOVBELL instruction to the active function. -func (c *Context) MOVBELL(mr, mr1 operand.Op) { - if inst, err := x86.MOVBELL(mr, mr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBELL: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBELL m32 r32 -// MOVBELL r32 m32 -// Construct and append a MOVBELL instruction to the active function. -// Operates on the global context. -func MOVBELL(mr, mr1 operand.Op) { ctx.MOVBELL(mr, mr1) } - -// MOVBEQQ: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEQQ m64 r64 -// MOVBEQQ r64 m64 -// Construct and append a MOVBEQQ instruction to the active function. -func (c *Context) MOVBEQQ(mr, mr1 operand.Op) { - if inst, err := x86.MOVBEQQ(mr, mr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBEQQ: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEQQ m64 r64 -// MOVBEQQ r64 m64 -// Construct and append a MOVBEQQ instruction to the active function. -// Operates on the global context. -func MOVBEQQ(mr, mr1 operand.Op) { ctx.MOVBEQQ(mr, mr1) } - -// MOVBEWW: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEWW m16 r16 -// MOVBEWW r16 m16 -// Construct and append a MOVBEWW instruction to the active function. -func (c *Context) MOVBEWW(mr, mr1 operand.Op) { - if inst, err := x86.MOVBEWW(mr, mr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBEWW: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEWW m16 r16 -// MOVBEWW r16 m16 -// Construct and append a MOVBEWW instruction to the active function. -// Operates on the global context. -func MOVBEWW(mr, mr1 operand.Op) { ctx.MOVBEWW(mr, mr1) } - -// MOVBLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBLSX r8 r32 -// MOVBLSX m8 r32 -// Construct and append a MOVBLSX instruction to the active function. -func (c *Context) MOVBLSX(mr, r operand.Op) { - if inst, err := x86.MOVBLSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBLSX r8 r32 -// MOVBLSX m8 r32 -// Construct and append a MOVBLSX instruction to the active function. -// Operates on the global context. -func MOVBLSX(mr, r operand.Op) { ctx.MOVBLSX(mr, r) } - -// MOVBLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBLZX r8 r32 -// MOVBLZX m8 r32 -// Construct and append a MOVBLZX instruction to the active function. -func (c *Context) MOVBLZX(mr, r operand.Op) { - if inst, err := x86.MOVBLZX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBLZX r8 r32 -// MOVBLZX m8 r32 -// Construct and append a MOVBLZX instruction to the active function. -// Operates on the global context. -func MOVBLZX(mr, r operand.Op) { ctx.MOVBLZX(mr, r) } - -// MOVBQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBQSX r8 r64 -// MOVBQSX m8 r64 -// Construct and append a MOVBQSX instruction to the active function. -func (c *Context) MOVBQSX(mr, r operand.Op) { - if inst, err := x86.MOVBQSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBQSX r8 r64 -// MOVBQSX m8 r64 -// Construct and append a MOVBQSX instruction to the active function. -// Operates on the global context. -func MOVBQSX(mr, r operand.Op) { ctx.MOVBQSX(mr, r) } - -// MOVBQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBQZX r8 r64 -// MOVBQZX m8 r64 -// Construct and append a MOVBQZX instruction to the active function. -func (c *Context) MOVBQZX(mr, r operand.Op) { - if inst, err := x86.MOVBQZX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBQZX r8 r64 -// MOVBQZX m8 r64 -// Construct and append a MOVBQZX instruction to the active function. -// Operates on the global context. -func MOVBQZX(mr, r operand.Op) { ctx.MOVBQZX(mr, r) } - -// MOVBWSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBWSX r8 r16 -// MOVBWSX m8 r16 -// Construct and append a MOVBWSX instruction to the active function. -func (c *Context) MOVBWSX(mr, r operand.Op) { - if inst, err := x86.MOVBWSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBWSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBWSX r8 r16 -// MOVBWSX m8 r16 -// Construct and append a MOVBWSX instruction to the active function. -// Operates on the global context. -func MOVBWSX(mr, r operand.Op) { ctx.MOVBWSX(mr, r) } - -// MOVBWZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBWZX r8 r16 -// MOVBWZX m8 r16 -// Construct and append a MOVBWZX instruction to the active function. -func (c *Context) MOVBWZX(mr, r operand.Op) { - if inst, err := x86.MOVBWZX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVBWZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBWZX r8 r16 -// MOVBWZX m8 r16 -// Construct and append a MOVBWZX instruction to the active function. -// Operates on the global context. -func MOVBWZX(mr, r operand.Op) { ctx.MOVBWZX(mr, r) } - -// MOVD: Move. -// -// Forms: -// -// MOVD imm32 r64 -// MOVD imm64 r64 -// MOVD r64 r64 -// MOVD m64 r64 -// MOVD imm32 m64 -// MOVD r64 m64 -// MOVD xmm r64 -// MOVD r64 xmm -// MOVD xmm xmm -// MOVD m64 xmm -// MOVD xmm m64 -// MOVD xmm r32 -// MOVD r32 xmm -// MOVD m32 xmm -// MOVD xmm m32 -// Construct and append a MOVD instruction to the active function. -func (c *Context) MOVD(imrx, mrx operand.Op) { - if inst, err := x86.MOVD(imrx, mrx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVD: Move. -// -// Forms: -// -// MOVD imm32 r64 -// MOVD imm64 r64 -// MOVD r64 r64 -// MOVD m64 r64 -// MOVD imm32 m64 -// MOVD r64 m64 -// MOVD xmm r64 -// MOVD r64 xmm -// MOVD xmm xmm -// MOVD m64 xmm -// MOVD xmm m64 -// MOVD xmm r32 -// MOVD r32 xmm -// MOVD m32 xmm -// MOVD xmm m32 -// Construct and append a MOVD instruction to the active function. -// Operates on the global context. -func MOVD(imrx, mrx operand.Op) { ctx.MOVD(imrx, mrx) } - -// MOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// MOVDDUP xmm xmm -// MOVDDUP m64 xmm -// Construct and append a MOVDDUP instruction to the active function. -func (c *Context) MOVDDUP(mx, x operand.Op) { - if inst, err := x86.MOVDDUP(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// MOVDDUP xmm xmm -// MOVDDUP m64 xmm -// Construct and append a MOVDDUP instruction to the active function. -// Operates on the global context. -func MOVDDUP(mx, x operand.Op) { ctx.MOVDDUP(mx, x) } - -// MOVDQ2Q: Move. -// -// Forms: -// -// MOVDQ2Q imm32 r64 -// MOVDQ2Q imm64 r64 -// MOVDQ2Q r64 r64 -// MOVDQ2Q m64 r64 -// MOVDQ2Q imm32 m64 -// MOVDQ2Q r64 m64 -// MOVDQ2Q xmm r64 -// MOVDQ2Q r64 xmm -// MOVDQ2Q xmm xmm -// MOVDQ2Q m64 xmm -// MOVDQ2Q xmm m64 -// MOVDQ2Q xmm r32 -// MOVDQ2Q r32 xmm -// MOVDQ2Q m32 xmm -// MOVDQ2Q xmm m32 -// Construct and append a MOVDQ2Q instruction to the active function. -func (c *Context) MOVDQ2Q(imrx, mrx operand.Op) { - if inst, err := x86.MOVDQ2Q(imrx, mrx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVDQ2Q: Move. -// -// Forms: -// -// MOVDQ2Q imm32 r64 -// MOVDQ2Q imm64 r64 -// MOVDQ2Q r64 r64 -// MOVDQ2Q m64 r64 -// MOVDQ2Q imm32 m64 -// MOVDQ2Q r64 m64 -// MOVDQ2Q xmm r64 -// MOVDQ2Q r64 xmm -// MOVDQ2Q xmm xmm -// MOVDQ2Q m64 xmm -// MOVDQ2Q xmm m64 -// MOVDQ2Q xmm r32 -// MOVDQ2Q r32 xmm -// MOVDQ2Q m32 xmm -// MOVDQ2Q xmm m32 -// Construct and append a MOVDQ2Q instruction to the active function. -// Operates on the global context. -func MOVDQ2Q(imrx, mrx operand.Op) { ctx.MOVDQ2Q(imrx, mrx) } - -// MOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// MOVHLPS xmm xmm -// Construct and append a MOVHLPS instruction to the active function. -func (c *Context) MOVHLPS(x, x1 operand.Op) { - if inst, err := x86.MOVHLPS(x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// MOVHLPS xmm xmm -// Construct and append a MOVHLPS instruction to the active function. -// Operates on the global context. -func MOVHLPS(x, x1 operand.Op) { ctx.MOVHLPS(x, x1) } - -// MOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVHPD m64 xmm -// MOVHPD xmm m64 -// Construct and append a MOVHPD instruction to the active function. -func (c *Context) MOVHPD(mx, mx1 operand.Op) { - if inst, err := x86.MOVHPD(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVHPD m64 xmm -// MOVHPD xmm m64 -// Construct and append a MOVHPD instruction to the active function. -// Operates on the global context. -func MOVHPD(mx, mx1 operand.Op) { ctx.MOVHPD(mx, mx1) } - -// MOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVHPS m64 xmm -// MOVHPS xmm m64 -// Construct and append a MOVHPS instruction to the active function. -func (c *Context) MOVHPS(mx, mx1 operand.Op) { - if inst, err := x86.MOVHPS(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVHPS m64 xmm -// MOVHPS xmm m64 -// Construct and append a MOVHPS instruction to the active function. -// Operates on the global context. -func MOVHPS(mx, mx1 operand.Op) { ctx.MOVHPS(mx, mx1) } - -// MOVL: Move. -// -// Forms: -// -// MOVL imm32 r32 -// MOVL r32 r32 -// MOVL m32 r32 -// MOVL imm32 m32 -// MOVL r32 m32 -// Construct and append a MOVL instruction to the active function. -func (c *Context) MOVL(imr, mr operand.Op) { - if inst, err := x86.MOVL(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVL: Move. -// -// Forms: -// -// MOVL imm32 r32 -// MOVL r32 r32 -// MOVL m32 r32 -// MOVL imm32 m32 -// MOVL r32 m32 -// Construct and append a MOVL instruction to the active function. -// Operates on the global context. -func MOVL(imr, mr operand.Op) { ctx.MOVL(imr, mr) } - -// MOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// MOVLHPS xmm xmm -// Construct and append a MOVLHPS instruction to the active function. -func (c *Context) MOVLHPS(x, x1 operand.Op) { - if inst, err := x86.MOVLHPS(x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// MOVLHPS xmm xmm -// Construct and append a MOVLHPS instruction to the active function. -// Operates on the global context. -func MOVLHPS(x, x1 operand.Op) { ctx.MOVLHPS(x, x1) } - -// MOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVLPD m64 xmm -// MOVLPD xmm m64 -// Construct and append a MOVLPD instruction to the active function. -func (c *Context) MOVLPD(mx, mx1 operand.Op) { - if inst, err := x86.MOVLPD(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVLPD m64 xmm -// MOVLPD xmm m64 -// Construct and append a MOVLPD instruction to the active function. -// Operates on the global context. -func MOVLPD(mx, mx1 operand.Op) { ctx.MOVLPD(mx, mx1) } - -// MOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVLPS m64 xmm -// MOVLPS xmm m64 -// Construct and append a MOVLPS instruction to the active function. -func (c *Context) MOVLPS(mx, mx1 operand.Op) { - if inst, err := x86.MOVLPS(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVLPS m64 xmm -// MOVLPS xmm m64 -// Construct and append a MOVLPS instruction to the active function. -// Operates on the global context. -func MOVLPS(mx, mx1 operand.Op) { ctx.MOVLPS(mx, mx1) } - -// MOVLQSX: Move Doubleword to Quadword with Sign-Extension. -// -// Forms: -// -// MOVLQSX r32 r64 -// MOVLQSX m32 r64 -// Construct and append a MOVLQSX instruction to the active function. -func (c *Context) MOVLQSX(mr, r operand.Op) { - if inst, err := x86.MOVLQSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVLQSX: Move Doubleword to Quadword with Sign-Extension. -// -// Forms: -// -// MOVLQSX r32 r64 -// MOVLQSX m32 r64 -// Construct and append a MOVLQSX instruction to the active function. -// Operates on the global context. -func MOVLQSX(mr, r operand.Op) { ctx.MOVLQSX(mr, r) } - -// MOVLQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVLQZX m32 r64 -// Construct and append a MOVLQZX instruction to the active function. -func (c *Context) MOVLQZX(m, r operand.Op) { - if inst, err := x86.MOVLQZX(m, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVLQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVLQZX m32 r64 -// Construct and append a MOVLQZX instruction to the active function. -// Operates on the global context. -func MOVLQZX(m, r operand.Op) { ctx.MOVLQZX(m, r) } - -// MOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPD xmm r32 -// Construct and append a MOVMSKPD instruction to the active function. -func (c *Context) MOVMSKPD(x, r operand.Op) { - if inst, err := x86.MOVMSKPD(x, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPD xmm r32 -// Construct and append a MOVMSKPD instruction to the active function. -// Operates on the global context. -func MOVMSKPD(x, r operand.Op) { ctx.MOVMSKPD(x, r) } - -// MOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPS xmm r32 -// Construct and append a MOVMSKPS instruction to the active function. -func (c *Context) MOVMSKPS(x, r operand.Op) { - if inst, err := x86.MOVMSKPS(x, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPS xmm r32 -// Construct and append a MOVMSKPS instruction to the active function. -// Operates on the global context. -func MOVMSKPS(x, r operand.Op) { ctx.MOVMSKPS(x, r) } - -// MOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTDQ xmm m128 -// Construct and append a MOVNTDQ instruction to the active function. -func (c *Context) MOVNTDQ(x, m operand.Op) { - if inst, err := x86.MOVNTDQ(x, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTDQ xmm m128 -// Construct and append a MOVNTDQ instruction to the active function. -// Operates on the global context. -func MOVNTDQ(x, m operand.Op) { ctx.MOVNTDQ(x, m) } - -// MOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// MOVNTDQA m128 xmm -// Construct and append a MOVNTDQA instruction to the active function. -func (c *Context) MOVNTDQA(m, x operand.Op) { - if inst, err := x86.MOVNTDQA(m, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// MOVNTDQA m128 xmm -// Construct and append a MOVNTDQA instruction to the active function. -// Operates on the global context. -func MOVNTDQA(m, x operand.Op) { ctx.MOVNTDQA(m, x) } - -// MOVNTIL: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIL r32 m32 -// Construct and append a MOVNTIL instruction to the active function. -func (c *Context) MOVNTIL(r, m operand.Op) { - if inst, err := x86.MOVNTIL(r, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTIL: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIL r32 m32 -// Construct and append a MOVNTIL instruction to the active function. -// Operates on the global context. -func MOVNTIL(r, m operand.Op) { ctx.MOVNTIL(r, m) } - -// MOVNTIQ: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIQ r64 m64 -// Construct and append a MOVNTIQ instruction to the active function. -func (c *Context) MOVNTIQ(r, m operand.Op) { - if inst, err := x86.MOVNTIQ(r, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTIQ: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIQ r64 m64 -// Construct and append a MOVNTIQ instruction to the active function. -// Operates on the global context. -func MOVNTIQ(r, m operand.Op) { ctx.MOVNTIQ(r, m) } - -// MOVNTO: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTO xmm m128 -// Construct and append a MOVNTO instruction to the active function. -func (c *Context) MOVNTO(x, m operand.Op) { - if inst, err := x86.MOVNTO(x, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTO: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTO xmm m128 -// Construct and append a MOVNTO instruction to the active function. -// Operates on the global context. -func MOVNTO(x, m operand.Op) { ctx.MOVNTO(x, m) } - -// MOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPD xmm m128 -// Construct and append a MOVNTPD instruction to the active function. -func (c *Context) MOVNTPD(x, m operand.Op) { - if inst, err := x86.MOVNTPD(x, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPD xmm m128 -// Construct and append a MOVNTPD instruction to the active function. -// Operates on the global context. -func MOVNTPD(x, m operand.Op) { ctx.MOVNTPD(x, m) } - -// MOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPS xmm m128 -// Construct and append a MOVNTPS instruction to the active function. -func (c *Context) MOVNTPS(x, m operand.Op) { - if inst, err := x86.MOVNTPS(x, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPS xmm m128 -// Construct and append a MOVNTPS instruction to the active function. -// Operates on the global context. -func MOVNTPS(x, m operand.Op) { ctx.MOVNTPS(x, m) } - -// MOVO: Move Aligned Double Quadword. -// -// Forms: -// -// MOVO xmm xmm -// MOVO m128 xmm -// MOVO xmm m128 -// Construct and append a MOVO instruction to the active function. -func (c *Context) MOVO(mx, mx1 operand.Op) { - if inst, err := x86.MOVO(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVO: Move Aligned Double Quadword. -// -// Forms: -// -// MOVO xmm xmm -// MOVO m128 xmm -// MOVO xmm m128 -// Construct and append a MOVO instruction to the active function. -// Operates on the global context. -func MOVO(mx, mx1 operand.Op) { ctx.MOVO(mx, mx1) } - -// MOVOA: Move Aligned Double Quadword. -// -// Forms: -// -// MOVOA xmm xmm -// MOVOA m128 xmm -// MOVOA xmm m128 -// Construct and append a MOVOA instruction to the active function. -func (c *Context) MOVOA(mx, mx1 operand.Op) { - if inst, err := x86.MOVOA(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVOA: Move Aligned Double Quadword. -// -// Forms: -// -// MOVOA xmm xmm -// MOVOA m128 xmm -// MOVOA xmm m128 -// Construct and append a MOVOA instruction to the active function. -// Operates on the global context. -func MOVOA(mx, mx1 operand.Op) { ctx.MOVOA(mx, mx1) } - -// MOVOU: Move Unaligned Double Quadword. -// -// Forms: -// -// MOVOU xmm xmm -// MOVOU m128 xmm -// MOVOU xmm m128 -// Construct and append a MOVOU instruction to the active function. -func (c *Context) MOVOU(mx, mx1 operand.Op) { - if inst, err := x86.MOVOU(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVOU: Move Unaligned Double Quadword. -// -// Forms: -// -// MOVOU xmm xmm -// MOVOU m128 xmm -// MOVOU xmm m128 -// Construct and append a MOVOU instruction to the active function. -// Operates on the global context. -func MOVOU(mx, mx1 operand.Op) { ctx.MOVOU(mx, mx1) } - -// MOVQ: Move. -// -// Forms: -// -// MOVQ imm32 r64 -// MOVQ imm64 r64 -// MOVQ r64 r64 -// MOVQ m64 r64 -// MOVQ imm32 m64 -// MOVQ r64 m64 -// MOVQ xmm r64 -// MOVQ r64 xmm -// MOVQ xmm xmm -// MOVQ m64 xmm -// MOVQ xmm m64 -// MOVQ xmm r32 -// MOVQ r32 xmm -// MOVQ m32 xmm -// MOVQ xmm m32 -// Construct and append a MOVQ instruction to the active function. -func (c *Context) MOVQ(imrx, mrx operand.Op) { - if inst, err := x86.MOVQ(imrx, mrx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVQ: Move. -// -// Forms: -// -// MOVQ imm32 r64 -// MOVQ imm64 r64 -// MOVQ r64 r64 -// MOVQ m64 r64 -// MOVQ imm32 m64 -// MOVQ r64 m64 -// MOVQ xmm r64 -// MOVQ r64 xmm -// MOVQ xmm xmm -// MOVQ m64 xmm -// MOVQ xmm m64 -// MOVQ xmm r32 -// MOVQ r32 xmm -// MOVQ m32 xmm -// MOVQ xmm m32 -// Construct and append a MOVQ instruction to the active function. -// Operates on the global context. -func MOVQ(imrx, mrx operand.Op) { ctx.MOVQ(imrx, mrx) } - -// MOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVSD xmm xmm -// MOVSD m64 xmm -// MOVSD xmm m64 -// Construct and append a MOVSD instruction to the active function. -func (c *Context) MOVSD(mx, mx1 operand.Op) { - if inst, err := x86.MOVSD(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVSD xmm xmm -// MOVSD m64 xmm -// MOVSD xmm m64 -// Construct and append a MOVSD instruction to the active function. -// Operates on the global context. -func MOVSD(mx, mx1 operand.Op) { ctx.MOVSD(mx, mx1) } - -// MOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// MOVSHDUP xmm xmm -// MOVSHDUP m128 xmm -// Construct and append a MOVSHDUP instruction to the active function. -func (c *Context) MOVSHDUP(mx, x operand.Op) { - if inst, err := x86.MOVSHDUP(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// MOVSHDUP xmm xmm -// MOVSHDUP m128 xmm -// Construct and append a MOVSHDUP instruction to the active function. -// Operates on the global context. -func MOVSHDUP(mx, x operand.Op) { ctx.MOVSHDUP(mx, x) } - -// MOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// MOVSLDUP xmm xmm -// MOVSLDUP m128 xmm -// Construct and append a MOVSLDUP instruction to the active function. -func (c *Context) MOVSLDUP(mx, x operand.Op) { - if inst, err := x86.MOVSLDUP(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// MOVSLDUP xmm xmm -// MOVSLDUP m128 xmm -// Construct and append a MOVSLDUP instruction to the active function. -// Operates on the global context. -func MOVSLDUP(mx, x operand.Op) { ctx.MOVSLDUP(mx, x) } - -// MOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVSS xmm xmm -// MOVSS m32 xmm -// MOVSS xmm m32 -// Construct and append a MOVSS instruction to the active function. -func (c *Context) MOVSS(mx, mx1 operand.Op) { - if inst, err := x86.MOVSS(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVSS xmm xmm -// MOVSS m32 xmm -// MOVSS xmm m32 -// Construct and append a MOVSS instruction to the active function. -// Operates on the global context. -func MOVSS(mx, mx1 operand.Op) { ctx.MOVSS(mx, mx1) } - -// MOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPD xmm xmm -// MOVUPD m128 xmm -// MOVUPD xmm m128 -// Construct and append a MOVUPD instruction to the active function. -func (c *Context) MOVUPD(mx, mx1 operand.Op) { - if inst, err := x86.MOVUPD(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPD xmm xmm -// MOVUPD m128 xmm -// MOVUPD xmm m128 -// Construct and append a MOVUPD instruction to the active function. -// Operates on the global context. -func MOVUPD(mx, mx1 operand.Op) { ctx.MOVUPD(mx, mx1) } - -// MOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPS xmm xmm -// MOVUPS m128 xmm -// MOVUPS xmm m128 -// Construct and append a MOVUPS instruction to the active function. -func (c *Context) MOVUPS(mx, mx1 operand.Op) { - if inst, err := x86.MOVUPS(mx, mx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPS xmm xmm -// MOVUPS m128 xmm -// MOVUPS xmm m128 -// Construct and append a MOVUPS instruction to the active function. -// Operates on the global context. -func MOVUPS(mx, mx1 operand.Op) { ctx.MOVUPS(mx, mx1) } - -// MOVW: Move. -// -// Forms: -// -// MOVW imm16 r16 -// MOVW r16 r16 -// MOVW m16 r16 -// MOVW imm16 m16 -// MOVW r16 m16 -// Construct and append a MOVW instruction to the active function. -func (c *Context) MOVW(imr, mr operand.Op) { - if inst, err := x86.MOVW(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVW: Move. -// -// Forms: -// -// MOVW imm16 r16 -// MOVW r16 r16 -// MOVW m16 r16 -// MOVW imm16 m16 -// MOVW r16 m16 -// Construct and append a MOVW instruction to the active function. -// Operates on the global context. -func MOVW(imr, mr operand.Op) { ctx.MOVW(imr, mr) } - -// MOVWLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWLSX r16 r32 -// MOVWLSX m16 r32 -// Construct and append a MOVWLSX instruction to the active function. -func (c *Context) MOVWLSX(mr, r operand.Op) { - if inst, err := x86.MOVWLSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVWLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWLSX r16 r32 -// MOVWLSX m16 r32 -// Construct and append a MOVWLSX instruction to the active function. -// Operates on the global context. -func MOVWLSX(mr, r operand.Op) { ctx.MOVWLSX(mr, r) } - -// MOVWLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWLZX r16 r32 -// MOVWLZX m16 r32 -// Construct and append a MOVWLZX instruction to the active function. -func (c *Context) MOVWLZX(mr, r operand.Op) { - if inst, err := x86.MOVWLZX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVWLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWLZX r16 r32 -// MOVWLZX m16 r32 -// Construct and append a MOVWLZX instruction to the active function. -// Operates on the global context. -func MOVWLZX(mr, r operand.Op) { ctx.MOVWLZX(mr, r) } - -// MOVWQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWQSX r16 r64 -// MOVWQSX m16 r64 -// Construct and append a MOVWQSX instruction to the active function. -func (c *Context) MOVWQSX(mr, r operand.Op) { - if inst, err := x86.MOVWQSX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVWQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWQSX r16 r64 -// MOVWQSX m16 r64 -// Construct and append a MOVWQSX instruction to the active function. -// Operates on the global context. -func MOVWQSX(mr, r operand.Op) { ctx.MOVWQSX(mr, r) } - -// MOVWQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWQZX r16 r64 -// MOVWQZX m16 r64 -// Construct and append a MOVWQZX instruction to the active function. -func (c *Context) MOVWQZX(mr, r operand.Op) { - if inst, err := x86.MOVWQZX(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MOVWQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWQZX r16 r64 -// MOVWQZX m16 r64 -// Construct and append a MOVWQZX instruction to the active function. -// Operates on the global context. -func MOVWQZX(mr, r operand.Op) { ctx.MOVWQZX(mr, r) } - -// MPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// MPSADBW imm8 xmm xmm -// MPSADBW imm8 m128 xmm -// Construct and append a MPSADBW instruction to the active function. -func (c *Context) MPSADBW(i, mx, x operand.Op) { - if inst, err := x86.MPSADBW(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// MPSADBW imm8 xmm xmm -// MPSADBW imm8 m128 xmm -// Construct and append a MPSADBW instruction to the active function. -// Operates on the global context. -func MPSADBW(i, mx, x operand.Op) { ctx.MPSADBW(i, mx, x) } - -// MULB: Unsigned Multiply. -// -// Forms: -// -// MULB r8 -// MULB m8 -// Construct and append a MULB instruction to the active function. -func (c *Context) MULB(mr operand.Op) { - if inst, err := x86.MULB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULB: Unsigned Multiply. -// -// Forms: -// -// MULB r8 -// MULB m8 -// Construct and append a MULB instruction to the active function. -// Operates on the global context. -func MULB(mr operand.Op) { ctx.MULB(mr) } - -// MULL: Unsigned Multiply. -// -// Forms: -// -// MULL r32 -// MULL m32 -// Construct and append a MULL instruction to the active function. -func (c *Context) MULL(mr operand.Op) { - if inst, err := x86.MULL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULL: Unsigned Multiply. -// -// Forms: -// -// MULL r32 -// MULL m32 -// Construct and append a MULL instruction to the active function. -// Operates on the global context. -func MULL(mr operand.Op) { ctx.MULL(mr) } - -// MULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MULPD xmm xmm -// MULPD m128 xmm -// Construct and append a MULPD instruction to the active function. -func (c *Context) MULPD(mx, x operand.Op) { - if inst, err := x86.MULPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MULPD xmm xmm -// MULPD m128 xmm -// Construct and append a MULPD instruction to the active function. -// Operates on the global context. -func MULPD(mx, x operand.Op) { ctx.MULPD(mx, x) } - -// MULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MULPS xmm xmm -// MULPS m128 xmm -// Construct and append a MULPS instruction to the active function. -func (c *Context) MULPS(mx, x operand.Op) { - if inst, err := x86.MULPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MULPS xmm xmm -// MULPS m128 xmm -// Construct and append a MULPS instruction to the active function. -// Operates on the global context. -func MULPS(mx, x operand.Op) { ctx.MULPS(mx, x) } - -// MULQ: Unsigned Multiply. -// -// Forms: -// -// MULQ r64 -// MULQ m64 -// Construct and append a MULQ instruction to the active function. -func (c *Context) MULQ(mr operand.Op) { - if inst, err := x86.MULQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULQ: Unsigned Multiply. -// -// Forms: -// -// MULQ r64 -// MULQ m64 -// Construct and append a MULQ instruction to the active function. -// Operates on the global context. -func MULQ(mr operand.Op) { ctx.MULQ(mr) } - -// MULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// MULSD xmm xmm -// MULSD m64 xmm -// Construct and append a MULSD instruction to the active function. -func (c *Context) MULSD(mx, x operand.Op) { - if inst, err := x86.MULSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// MULSD xmm xmm -// MULSD m64 xmm -// Construct and append a MULSD instruction to the active function. -// Operates on the global context. -func MULSD(mx, x operand.Op) { ctx.MULSD(mx, x) } - -// MULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MULSS xmm xmm -// MULSS m32 xmm -// Construct and append a MULSS instruction to the active function. -func (c *Context) MULSS(mx, x operand.Op) { - if inst, err := x86.MULSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MULSS xmm xmm -// MULSS m32 xmm -// Construct and append a MULSS instruction to the active function. -// Operates on the global context. -func MULSS(mx, x operand.Op) { ctx.MULSS(mx, x) } - -// MULW: Unsigned Multiply. -// -// Forms: -// -// MULW r16 -// MULW m16 -// Construct and append a MULW instruction to the active function. -func (c *Context) MULW(mr operand.Op) { - if inst, err := x86.MULW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULW: Unsigned Multiply. -// -// Forms: -// -// MULW r16 -// MULW m16 -// Construct and append a MULW instruction to the active function. -// Operates on the global context. -func MULW(mr operand.Op) { ctx.MULW(mr) } - -// MULXL: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXL r32 r32 r32 -// MULXL m32 r32 r32 -// Construct and append a MULXL instruction to the active function. -func (c *Context) MULXL(mr, r, r1 operand.Op) { - if inst, err := x86.MULXL(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULXL: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXL r32 r32 r32 -// MULXL m32 r32 r32 -// Construct and append a MULXL instruction to the active function. -// Operates on the global context. -func MULXL(mr, r, r1 operand.Op) { ctx.MULXL(mr, r, r1) } - -// MULXQ: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXQ r64 r64 r64 -// MULXQ m64 r64 r64 -// Construct and append a MULXQ instruction to the active function. -func (c *Context) MULXQ(mr, r, r1 operand.Op) { - if inst, err := x86.MULXQ(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MULXQ: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXQ r64 r64 r64 -// MULXQ m64 r64 r64 -// Construct and append a MULXQ instruction to the active function. -// Operates on the global context. -func MULXQ(mr, r, r1 operand.Op) { ctx.MULXQ(mr, r, r1) } - -// MWAIT: Monitor Wait. -// -// Forms: -// -// MWAIT -// Construct and append a MWAIT instruction to the active function. -func (c *Context) MWAIT() { - if inst, err := x86.MWAIT(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// MWAIT: Monitor Wait. -// -// Forms: -// -// MWAIT -// Construct and append a MWAIT instruction to the active function. -// Operates on the global context. -func MWAIT() { ctx.MWAIT() } - -// NEGB: Two's Complement Negation. -// -// Forms: -// -// NEGB r8 -// NEGB m8 -// Construct and append a NEGB instruction to the active function. -func (c *Context) NEGB(mr operand.Op) { - if inst, err := x86.NEGB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NEGB: Two's Complement Negation. -// -// Forms: -// -// NEGB r8 -// NEGB m8 -// Construct and append a NEGB instruction to the active function. -// Operates on the global context. -func NEGB(mr operand.Op) { ctx.NEGB(mr) } - -// NEGL: Two's Complement Negation. -// -// Forms: -// -// NEGL r32 -// NEGL m32 -// Construct and append a NEGL instruction to the active function. -func (c *Context) NEGL(mr operand.Op) { - if inst, err := x86.NEGL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NEGL: Two's Complement Negation. -// -// Forms: -// -// NEGL r32 -// NEGL m32 -// Construct and append a NEGL instruction to the active function. -// Operates on the global context. -func NEGL(mr operand.Op) { ctx.NEGL(mr) } - -// NEGQ: Two's Complement Negation. -// -// Forms: -// -// NEGQ r64 -// NEGQ m64 -// Construct and append a NEGQ instruction to the active function. -func (c *Context) NEGQ(mr operand.Op) { - if inst, err := x86.NEGQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NEGQ: Two's Complement Negation. -// -// Forms: -// -// NEGQ r64 -// NEGQ m64 -// Construct and append a NEGQ instruction to the active function. -// Operates on the global context. -func NEGQ(mr operand.Op) { ctx.NEGQ(mr) } - -// NEGW: Two's Complement Negation. -// -// Forms: -// -// NEGW r16 -// NEGW m16 -// Construct and append a NEGW instruction to the active function. -func (c *Context) NEGW(mr operand.Op) { - if inst, err := x86.NEGW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NEGW: Two's Complement Negation. -// -// Forms: -// -// NEGW r16 -// NEGW m16 -// Construct and append a NEGW instruction to the active function. -// Operates on the global context. -func NEGW(mr operand.Op) { ctx.NEGW(mr) } - -// NOP: No Operation. -// -// Forms: -// -// NOP -// Construct and append a NOP instruction to the active function. -func (c *Context) NOP() { - if inst, err := x86.NOP(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NOP: No Operation. -// -// Forms: -// -// NOP -// Construct and append a NOP instruction to the active function. -// Operates on the global context. -func NOP() { ctx.NOP() } - -// NOTB: One's Complement Negation. -// -// Forms: -// -// NOTB r8 -// NOTB m8 -// Construct and append a NOTB instruction to the active function. -func (c *Context) NOTB(mr operand.Op) { - if inst, err := x86.NOTB(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NOTB: One's Complement Negation. -// -// Forms: -// -// NOTB r8 -// NOTB m8 -// Construct and append a NOTB instruction to the active function. -// Operates on the global context. -func NOTB(mr operand.Op) { ctx.NOTB(mr) } - -// NOTL: One's Complement Negation. -// -// Forms: -// -// NOTL r32 -// NOTL m32 -// Construct and append a NOTL instruction to the active function. -func (c *Context) NOTL(mr operand.Op) { - if inst, err := x86.NOTL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NOTL: One's Complement Negation. -// -// Forms: -// -// NOTL r32 -// NOTL m32 -// Construct and append a NOTL instruction to the active function. -// Operates on the global context. -func NOTL(mr operand.Op) { ctx.NOTL(mr) } - -// NOTQ: One's Complement Negation. -// -// Forms: -// -// NOTQ r64 -// NOTQ m64 -// Construct and append a NOTQ instruction to the active function. -func (c *Context) NOTQ(mr operand.Op) { - if inst, err := x86.NOTQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NOTQ: One's Complement Negation. -// -// Forms: -// -// NOTQ r64 -// NOTQ m64 -// Construct and append a NOTQ instruction to the active function. -// Operates on the global context. -func NOTQ(mr operand.Op) { ctx.NOTQ(mr) } - -// NOTW: One's Complement Negation. -// -// Forms: -// -// NOTW r16 -// NOTW m16 -// Construct and append a NOTW instruction to the active function. -func (c *Context) NOTW(mr operand.Op) { - if inst, err := x86.NOTW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// NOTW: One's Complement Negation. -// -// Forms: -// -// NOTW r16 -// NOTW m16 -// Construct and append a NOTW instruction to the active function. -// Operates on the global context. -func NOTW(mr operand.Op) { ctx.NOTW(mr) } - -// ORB: Logical Inclusive OR. -// -// Forms: -// -// ORB imm8 al -// ORB imm8 r8 -// ORB r8 r8 -// ORB m8 r8 -// ORB imm8 m8 -// ORB r8 m8 -// Construct and append a ORB instruction to the active function. -func (c *Context) ORB(imr, amr operand.Op) { - if inst, err := x86.ORB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORB: Logical Inclusive OR. -// -// Forms: -// -// ORB imm8 al -// ORB imm8 r8 -// ORB r8 r8 -// ORB m8 r8 -// ORB imm8 m8 -// ORB r8 m8 -// Construct and append a ORB instruction to the active function. -// Operates on the global context. -func ORB(imr, amr operand.Op) { ctx.ORB(imr, amr) } - -// ORL: Logical Inclusive OR. -// -// Forms: -// -// ORL imm32 eax -// ORL imm8 r32 -// ORL imm32 r32 -// ORL r32 r32 -// ORL m32 r32 -// ORL imm8 m32 -// ORL imm32 m32 -// ORL r32 m32 -// Construct and append a ORL instruction to the active function. -func (c *Context) ORL(imr, emr operand.Op) { - if inst, err := x86.ORL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORL: Logical Inclusive OR. -// -// Forms: -// -// ORL imm32 eax -// ORL imm8 r32 -// ORL imm32 r32 -// ORL r32 r32 -// ORL m32 r32 -// ORL imm8 m32 -// ORL imm32 m32 -// ORL r32 m32 -// Construct and append a ORL instruction to the active function. -// Operates on the global context. -func ORL(imr, emr operand.Op) { ctx.ORL(imr, emr) } - -// ORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// ORPD xmm xmm -// ORPD m128 xmm -// Construct and append a ORPD instruction to the active function. -func (c *Context) ORPD(mx, x operand.Op) { - if inst, err := x86.ORPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// ORPD xmm xmm -// ORPD m128 xmm -// Construct and append a ORPD instruction to the active function. -// Operates on the global context. -func ORPD(mx, x operand.Op) { ctx.ORPD(mx, x) } - -// ORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// ORPS xmm xmm -// ORPS m128 xmm -// Construct and append a ORPS instruction to the active function. -func (c *Context) ORPS(mx, x operand.Op) { - if inst, err := x86.ORPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// ORPS xmm xmm -// ORPS m128 xmm -// Construct and append a ORPS instruction to the active function. -// Operates on the global context. -func ORPS(mx, x operand.Op) { ctx.ORPS(mx, x) } - -// ORQ: Logical Inclusive OR. -// -// Forms: -// -// ORQ imm32 rax -// ORQ imm8 r64 -// ORQ imm32 r64 -// ORQ r64 r64 -// ORQ m64 r64 -// ORQ imm8 m64 -// ORQ imm32 m64 -// ORQ r64 m64 -// Construct and append a ORQ instruction to the active function. -func (c *Context) ORQ(imr, mr operand.Op) { - if inst, err := x86.ORQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORQ: Logical Inclusive OR. -// -// Forms: -// -// ORQ imm32 rax -// ORQ imm8 r64 -// ORQ imm32 r64 -// ORQ r64 r64 -// ORQ m64 r64 -// ORQ imm8 m64 -// ORQ imm32 m64 -// ORQ r64 m64 -// Construct and append a ORQ instruction to the active function. -// Operates on the global context. -func ORQ(imr, mr operand.Op) { ctx.ORQ(imr, mr) } - -// ORW: Logical Inclusive OR. -// -// Forms: -// -// ORW imm16 ax -// ORW imm8 r16 -// ORW imm16 r16 -// ORW r16 r16 -// ORW m16 r16 -// ORW imm8 m16 -// ORW imm16 m16 -// ORW r16 m16 -// Construct and append a ORW instruction to the active function. -func (c *Context) ORW(imr, amr operand.Op) { - if inst, err := x86.ORW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ORW: Logical Inclusive OR. -// -// Forms: -// -// ORW imm16 ax -// ORW imm8 r16 -// ORW imm16 r16 -// ORW r16 r16 -// ORW m16 r16 -// ORW imm8 m16 -// ORW imm16 m16 -// ORW r16 m16 -// Construct and append a ORW instruction to the active function. -// Operates on the global context. -func ORW(imr, amr operand.Op) { ctx.ORW(imr, amr) } - -// PABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// PABSB xmm xmm -// PABSB m128 xmm -// Construct and append a PABSB instruction to the active function. -func (c *Context) PABSB(mx, x operand.Op) { - if inst, err := x86.PABSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// PABSB xmm xmm -// PABSB m128 xmm -// Construct and append a PABSB instruction to the active function. -// Operates on the global context. -func PABSB(mx, x operand.Op) { ctx.PABSB(mx, x) } - -// PABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// PABSD xmm xmm -// PABSD m128 xmm -// Construct and append a PABSD instruction to the active function. -func (c *Context) PABSD(mx, x operand.Op) { - if inst, err := x86.PABSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// PABSD xmm xmm -// PABSD m128 xmm -// Construct and append a PABSD instruction to the active function. -// Operates on the global context. -func PABSD(mx, x operand.Op) { ctx.PABSD(mx, x) } - -// PABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// PABSW xmm xmm -// PABSW m128 xmm -// Construct and append a PABSW instruction to the active function. -func (c *Context) PABSW(mx, x operand.Op) { - if inst, err := x86.PABSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// PABSW xmm xmm -// PABSW m128 xmm -// Construct and append a PABSW instruction to the active function. -// Operates on the global context. -func PABSW(mx, x operand.Op) { ctx.PABSW(mx, x) } - -// PACKSSLW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// PACKSSLW xmm xmm -// PACKSSLW m128 xmm -// Construct and append a PACKSSLW instruction to the active function. -func (c *Context) PACKSSLW(mx, x operand.Op) { - if inst, err := x86.PACKSSLW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PACKSSLW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// PACKSSLW xmm xmm -// PACKSSLW m128 xmm -// Construct and append a PACKSSLW instruction to the active function. -// Operates on the global context. -func PACKSSLW(mx, x operand.Op) { ctx.PACKSSLW(mx, x) } - -// PACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// PACKSSWB xmm xmm -// PACKSSWB m128 xmm -// Construct and append a PACKSSWB instruction to the active function. -func (c *Context) PACKSSWB(mx, x operand.Op) { - if inst, err := x86.PACKSSWB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// PACKSSWB xmm xmm -// PACKSSWB m128 xmm -// Construct and append a PACKSSWB instruction to the active function. -// Operates on the global context. -func PACKSSWB(mx, x operand.Op) { ctx.PACKSSWB(mx, x) } - -// PACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// PACKUSDW xmm xmm -// PACKUSDW m128 xmm -// Construct and append a PACKUSDW instruction to the active function. -func (c *Context) PACKUSDW(mx, x operand.Op) { - if inst, err := x86.PACKUSDW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// PACKUSDW xmm xmm -// PACKUSDW m128 xmm -// Construct and append a PACKUSDW instruction to the active function. -// Operates on the global context. -func PACKUSDW(mx, x operand.Op) { ctx.PACKUSDW(mx, x) } - -// PACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// PACKUSWB xmm xmm -// PACKUSWB m128 xmm -// Construct and append a PACKUSWB instruction to the active function. -func (c *Context) PACKUSWB(mx, x operand.Op) { - if inst, err := x86.PACKUSWB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// PACKUSWB xmm xmm -// PACKUSWB m128 xmm -// Construct and append a PACKUSWB instruction to the active function. -// Operates on the global context. -func PACKUSWB(mx, x operand.Op) { ctx.PACKUSWB(mx, x) } - -// PADDB: Add Packed Byte Integers. -// -// Forms: -// -// PADDB xmm xmm -// PADDB m128 xmm -// Construct and append a PADDB instruction to the active function. -func (c *Context) PADDB(mx, x operand.Op) { - if inst, err := x86.PADDB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDB: Add Packed Byte Integers. -// -// Forms: -// -// PADDB xmm xmm -// PADDB m128 xmm -// Construct and append a PADDB instruction to the active function. -// Operates on the global context. -func PADDB(mx, x operand.Op) { ctx.PADDB(mx, x) } - -// PADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDD xmm xmm -// PADDD m128 xmm -// Construct and append a PADDD instruction to the active function. -func (c *Context) PADDD(mx, x operand.Op) { - if inst, err := x86.PADDD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDD xmm xmm -// PADDD m128 xmm -// Construct and append a PADDD instruction to the active function. -// Operates on the global context. -func PADDD(mx, x operand.Op) { ctx.PADDD(mx, x) } - -// PADDL: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDL xmm xmm -// PADDL m128 xmm -// Construct and append a PADDL instruction to the active function. -func (c *Context) PADDL(mx, x operand.Op) { - if inst, err := x86.PADDL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDL: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDL xmm xmm -// PADDL m128 xmm -// Construct and append a PADDL instruction to the active function. -// Operates on the global context. -func PADDL(mx, x operand.Op) { ctx.PADDL(mx, x) } - -// PADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// PADDQ xmm xmm -// PADDQ m128 xmm -// Construct and append a PADDQ instruction to the active function. -func (c *Context) PADDQ(mx, x operand.Op) { - if inst, err := x86.PADDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// PADDQ xmm xmm -// PADDQ m128 xmm -// Construct and append a PADDQ instruction to the active function. -// Operates on the global context. -func PADDQ(mx, x operand.Op) { ctx.PADDQ(mx, x) } - -// PADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PADDSB xmm xmm -// PADDSB m128 xmm -// Construct and append a PADDSB instruction to the active function. -func (c *Context) PADDSB(mx, x operand.Op) { - if inst, err := x86.PADDSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PADDSB xmm xmm -// PADDSB m128 xmm -// Construct and append a PADDSB instruction to the active function. -// Operates on the global context. -func PADDSB(mx, x operand.Op) { ctx.PADDSB(mx, x) } - -// PADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PADDSW xmm xmm -// PADDSW m128 xmm -// Construct and append a PADDSW instruction to the active function. -func (c *Context) PADDSW(mx, x operand.Op) { - if inst, err := x86.PADDSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PADDSW xmm xmm -// PADDSW m128 xmm -// Construct and append a PADDSW instruction to the active function. -// Operates on the global context. -func PADDSW(mx, x operand.Op) { ctx.PADDSW(mx, x) } - -// PADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSB xmm xmm -// PADDUSB m128 xmm -// Construct and append a PADDUSB instruction to the active function. -func (c *Context) PADDUSB(mx, x operand.Op) { - if inst, err := x86.PADDUSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSB xmm xmm -// PADDUSB m128 xmm -// Construct and append a PADDUSB instruction to the active function. -// Operates on the global context. -func PADDUSB(mx, x operand.Op) { ctx.PADDUSB(mx, x) } - -// PADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSW xmm xmm -// PADDUSW m128 xmm -// Construct and append a PADDUSW instruction to the active function. -func (c *Context) PADDUSW(mx, x operand.Op) { - if inst, err := x86.PADDUSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSW xmm xmm -// PADDUSW m128 xmm -// Construct and append a PADDUSW instruction to the active function. -// Operates on the global context. -func PADDUSW(mx, x operand.Op) { ctx.PADDUSW(mx, x) } - -// PADDW: Add Packed Word Integers. -// -// Forms: -// -// PADDW xmm xmm -// PADDW m128 xmm -// Construct and append a PADDW instruction to the active function. -func (c *Context) PADDW(mx, x operand.Op) { - if inst, err := x86.PADDW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PADDW: Add Packed Word Integers. -// -// Forms: -// -// PADDW xmm xmm -// PADDW m128 xmm -// Construct and append a PADDW instruction to the active function. -// Operates on the global context. -func PADDW(mx, x operand.Op) { ctx.PADDW(mx, x) } - -// PALIGNR: Packed Align Right. -// -// Forms: -// -// PALIGNR imm8 xmm xmm -// PALIGNR imm8 m128 xmm -// Construct and append a PALIGNR instruction to the active function. -func (c *Context) PALIGNR(i, mx, x operand.Op) { - if inst, err := x86.PALIGNR(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PALIGNR: Packed Align Right. -// -// Forms: -// -// PALIGNR imm8 xmm xmm -// PALIGNR imm8 m128 xmm -// Construct and append a PALIGNR instruction to the active function. -// Operates on the global context. -func PALIGNR(i, mx, x operand.Op) { ctx.PALIGNR(i, mx, x) } - -// PAND: Packed Bitwise Logical AND. -// -// Forms: -// -// PAND xmm xmm -// PAND m128 xmm -// Construct and append a PAND instruction to the active function. -func (c *Context) PAND(mx, x operand.Op) { - if inst, err := x86.PAND(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PAND: Packed Bitwise Logical AND. -// -// Forms: -// -// PAND xmm xmm -// PAND m128 xmm -// Construct and append a PAND instruction to the active function. -// Operates on the global context. -func PAND(mx, x operand.Op) { ctx.PAND(mx, x) } - -// PANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// PANDN xmm xmm -// PANDN m128 xmm -// Construct and append a PANDN instruction to the active function. -func (c *Context) PANDN(mx, x operand.Op) { - if inst, err := x86.PANDN(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// PANDN xmm xmm -// PANDN m128 xmm -// Construct and append a PANDN instruction to the active function. -// Operates on the global context. -func PANDN(mx, x operand.Op) { ctx.PANDN(mx, x) } - -// PAUSE: Spin Loop Hint. -// -// Forms: -// -// PAUSE -// Construct and append a PAUSE instruction to the active function. -func (c *Context) PAUSE() { - if inst, err := x86.PAUSE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PAUSE: Spin Loop Hint. -// -// Forms: -// -// PAUSE -// Construct and append a PAUSE instruction to the active function. -// Operates on the global context. -func PAUSE() { ctx.PAUSE() } - -// PAVGB: Average Packed Byte Integers. -// -// Forms: -// -// PAVGB xmm xmm -// PAVGB m128 xmm -// Construct and append a PAVGB instruction to the active function. -func (c *Context) PAVGB(mx, x operand.Op) { - if inst, err := x86.PAVGB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PAVGB: Average Packed Byte Integers. -// -// Forms: -// -// PAVGB xmm xmm -// PAVGB m128 xmm -// Construct and append a PAVGB instruction to the active function. -// Operates on the global context. -func PAVGB(mx, x operand.Op) { ctx.PAVGB(mx, x) } - -// PAVGW: Average Packed Word Integers. -// -// Forms: -// -// PAVGW xmm xmm -// PAVGW m128 xmm -// Construct and append a PAVGW instruction to the active function. -func (c *Context) PAVGW(mx, x operand.Op) { - if inst, err := x86.PAVGW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PAVGW: Average Packed Word Integers. -// -// Forms: -// -// PAVGW xmm xmm -// PAVGW m128 xmm -// Construct and append a PAVGW instruction to the active function. -// Operates on the global context. -func PAVGW(mx, x operand.Op) { ctx.PAVGW(mx, x) } - -// PBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// PBLENDVB xmm0 xmm xmm -// PBLENDVB xmm0 m128 xmm -// Construct and append a PBLENDVB instruction to the active function. -func (c *Context) PBLENDVB(x, mx, x1 operand.Op) { - if inst, err := x86.PBLENDVB(x, mx, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// PBLENDVB xmm0 xmm xmm -// PBLENDVB xmm0 m128 xmm -// Construct and append a PBLENDVB instruction to the active function. -// Operates on the global context. -func PBLENDVB(x, mx, x1 operand.Op) { ctx.PBLENDVB(x, mx, x1) } - -// PBLENDW: Blend Packed Words. -// -// Forms: -// -// PBLENDW imm8 xmm xmm -// PBLENDW imm8 m128 xmm -// Construct and append a PBLENDW instruction to the active function. -func (c *Context) PBLENDW(i, mx, x operand.Op) { - if inst, err := x86.PBLENDW(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PBLENDW: Blend Packed Words. -// -// Forms: -// -// PBLENDW imm8 xmm xmm -// PBLENDW imm8 m128 xmm -// Construct and append a PBLENDW instruction to the active function. -// Operates on the global context. -func PBLENDW(i, mx, x operand.Op) { ctx.PBLENDW(i, mx, x) } - -// PCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// PCLMULQDQ imm8 xmm xmm -// PCLMULQDQ imm8 m128 xmm -// Construct and append a PCLMULQDQ instruction to the active function. -func (c *Context) PCLMULQDQ(i, mx, x operand.Op) { - if inst, err := x86.PCLMULQDQ(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// PCLMULQDQ imm8 xmm xmm -// PCLMULQDQ imm8 m128 xmm -// Construct and append a PCLMULQDQ instruction to the active function. -// Operates on the global context. -func PCLMULQDQ(i, mx, x operand.Op) { ctx.PCLMULQDQ(i, mx, x) } - -// PCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// PCMPEQB xmm xmm -// PCMPEQB m128 xmm -// Construct and append a PCMPEQB instruction to the active function. -func (c *Context) PCMPEQB(mx, x operand.Op) { - if inst, err := x86.PCMPEQB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// PCMPEQB xmm xmm -// PCMPEQB m128 xmm -// Construct and append a PCMPEQB instruction to the active function. -// Operates on the global context. -func PCMPEQB(mx, x operand.Op) { ctx.PCMPEQB(mx, x) } - -// PCMPEQL: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// PCMPEQL xmm xmm -// PCMPEQL m128 xmm -// Construct and append a PCMPEQL instruction to the active function. -func (c *Context) PCMPEQL(mx, x operand.Op) { - if inst, err := x86.PCMPEQL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPEQL: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// PCMPEQL xmm xmm -// PCMPEQL m128 xmm -// Construct and append a PCMPEQL instruction to the active function. -// Operates on the global context. -func PCMPEQL(mx, x operand.Op) { ctx.PCMPEQL(mx, x) } - -// PCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// PCMPEQQ xmm xmm -// PCMPEQQ m128 xmm -// Construct and append a PCMPEQQ instruction to the active function. -func (c *Context) PCMPEQQ(mx, x operand.Op) { - if inst, err := x86.PCMPEQQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// PCMPEQQ xmm xmm -// PCMPEQQ m128 xmm -// Construct and append a PCMPEQQ instruction to the active function. -// Operates on the global context. -func PCMPEQQ(mx, x operand.Op) { ctx.PCMPEQQ(mx, x) } - -// PCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// PCMPEQW xmm xmm -// PCMPEQW m128 xmm -// Construct and append a PCMPEQW instruction to the active function. -func (c *Context) PCMPEQW(mx, x operand.Op) { - if inst, err := x86.PCMPEQW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// PCMPEQW xmm xmm -// PCMPEQW m128 xmm -// Construct and append a PCMPEQW instruction to the active function. -// Operates on the global context. -func PCMPEQW(mx, x operand.Op) { ctx.PCMPEQW(mx, x) } - -// PCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// PCMPESTRI imm8 xmm xmm -// PCMPESTRI imm8 m128 xmm -// Construct and append a PCMPESTRI instruction to the active function. -func (c *Context) PCMPESTRI(i, mx, x operand.Op) { - if inst, err := x86.PCMPESTRI(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// PCMPESTRI imm8 xmm xmm -// PCMPESTRI imm8 m128 xmm -// Construct and append a PCMPESTRI instruction to the active function. -// Operates on the global context. -func PCMPESTRI(i, mx, x operand.Op) { ctx.PCMPESTRI(i, mx, x) } - -// PCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPESTRM imm8 xmm xmm -// PCMPESTRM imm8 m128 xmm -// Construct and append a PCMPESTRM instruction to the active function. -func (c *Context) PCMPESTRM(i, mx, x operand.Op) { - if inst, err := x86.PCMPESTRM(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPESTRM imm8 xmm xmm -// PCMPESTRM imm8 m128 xmm -// Construct and append a PCMPESTRM instruction to the active function. -// Operates on the global context. -func PCMPESTRM(i, mx, x operand.Op) { ctx.PCMPESTRM(i, mx, x) } - -// PCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// PCMPGTB xmm xmm -// PCMPGTB m128 xmm -// Construct and append a PCMPGTB instruction to the active function. -func (c *Context) PCMPGTB(mx, x operand.Op) { - if inst, err := x86.PCMPGTB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// PCMPGTB xmm xmm -// PCMPGTB m128 xmm -// Construct and append a PCMPGTB instruction to the active function. -// Operates on the global context. -func PCMPGTB(mx, x operand.Op) { ctx.PCMPGTB(mx, x) } - -// PCMPGTL: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// PCMPGTL xmm xmm -// PCMPGTL m128 xmm -// Construct and append a PCMPGTL instruction to the active function. -func (c *Context) PCMPGTL(mx, x operand.Op) { - if inst, err := x86.PCMPGTL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPGTL: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// PCMPGTL xmm xmm -// PCMPGTL m128 xmm -// Construct and append a PCMPGTL instruction to the active function. -// Operates on the global context. -func PCMPGTL(mx, x operand.Op) { ctx.PCMPGTL(mx, x) } - -// PCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// PCMPGTQ xmm xmm -// PCMPGTQ m128 xmm -// Construct and append a PCMPGTQ instruction to the active function. -func (c *Context) PCMPGTQ(mx, x operand.Op) { - if inst, err := x86.PCMPGTQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// PCMPGTQ xmm xmm -// PCMPGTQ m128 xmm -// Construct and append a PCMPGTQ instruction to the active function. -// Operates on the global context. -func PCMPGTQ(mx, x operand.Op) { ctx.PCMPGTQ(mx, x) } - -// PCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// PCMPGTW xmm xmm -// PCMPGTW m128 xmm -// Construct and append a PCMPGTW instruction to the active function. -func (c *Context) PCMPGTW(mx, x operand.Op) { - if inst, err := x86.PCMPGTW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// PCMPGTW xmm xmm -// PCMPGTW m128 xmm -// Construct and append a PCMPGTW instruction to the active function. -// Operates on the global context. -func PCMPGTW(mx, x operand.Op) { ctx.PCMPGTW(mx, x) } - -// PCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// PCMPISTRI imm8 xmm xmm -// PCMPISTRI imm8 m128 xmm -// Construct and append a PCMPISTRI instruction to the active function. -func (c *Context) PCMPISTRI(i, mx, x operand.Op) { - if inst, err := x86.PCMPISTRI(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// PCMPISTRI imm8 xmm xmm -// PCMPISTRI imm8 m128 xmm -// Construct and append a PCMPISTRI instruction to the active function. -// Operates on the global context. -func PCMPISTRI(i, mx, x operand.Op) { ctx.PCMPISTRI(i, mx, x) } - -// PCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPISTRM imm8 xmm xmm -// PCMPISTRM imm8 m128 xmm -// Construct and append a PCMPISTRM instruction to the active function. -func (c *Context) PCMPISTRM(i, mx, x operand.Op) { - if inst, err := x86.PCMPISTRM(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPISTRM imm8 xmm xmm -// PCMPISTRM imm8 m128 xmm -// Construct and append a PCMPISTRM instruction to the active function. -// Operates on the global context. -func PCMPISTRM(i, mx, x operand.Op) { ctx.PCMPISTRM(i, mx, x) } - -// PDEPL: Parallel Bits Deposit. -// -// Forms: -// -// PDEPL r32 r32 r32 -// PDEPL m32 r32 r32 -// Construct and append a PDEPL instruction to the active function. -func (c *Context) PDEPL(mr, r, r1 operand.Op) { - if inst, err := x86.PDEPL(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PDEPL: Parallel Bits Deposit. -// -// Forms: -// -// PDEPL r32 r32 r32 -// PDEPL m32 r32 r32 -// Construct and append a PDEPL instruction to the active function. -// Operates on the global context. -func PDEPL(mr, r, r1 operand.Op) { ctx.PDEPL(mr, r, r1) } - -// PDEPQ: Parallel Bits Deposit. -// -// Forms: -// -// PDEPQ r64 r64 r64 -// PDEPQ m64 r64 r64 -// Construct and append a PDEPQ instruction to the active function. -func (c *Context) PDEPQ(mr, r, r1 operand.Op) { - if inst, err := x86.PDEPQ(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PDEPQ: Parallel Bits Deposit. -// -// Forms: -// -// PDEPQ r64 r64 r64 -// PDEPQ m64 r64 r64 -// Construct and append a PDEPQ instruction to the active function. -// Operates on the global context. -func PDEPQ(mr, r, r1 operand.Op) { ctx.PDEPQ(mr, r, r1) } - -// PEXTL: Parallel Bits Extract. -// -// Forms: -// -// PEXTL r32 r32 r32 -// PEXTL m32 r32 r32 -// Construct and append a PEXTL instruction to the active function. -func (c *Context) PEXTL(mr, r, r1 operand.Op) { - if inst, err := x86.PEXTL(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTL: Parallel Bits Extract. -// -// Forms: -// -// PEXTL r32 r32 r32 -// PEXTL m32 r32 r32 -// Construct and append a PEXTL instruction to the active function. -// Operates on the global context. -func PEXTL(mr, r, r1 operand.Op) { ctx.PEXTL(mr, r, r1) } - -// PEXTQ: Parallel Bits Extract. -// -// Forms: -// -// PEXTQ r64 r64 r64 -// PEXTQ m64 r64 r64 -// Construct and append a PEXTQ instruction to the active function. -func (c *Context) PEXTQ(mr, r, r1 operand.Op) { - if inst, err := x86.PEXTQ(mr, r, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTQ: Parallel Bits Extract. -// -// Forms: -// -// PEXTQ r64 r64 r64 -// PEXTQ m64 r64 r64 -// Construct and append a PEXTQ instruction to the active function. -// Operates on the global context. -func PEXTQ(mr, r, r1 operand.Op) { ctx.PEXTQ(mr, r, r1) } - -// PEXTRB: Extract Byte. -// -// Forms: -// -// PEXTRB imm8 xmm r32 -// PEXTRB imm8 xmm m8 -// Construct and append a PEXTRB instruction to the active function. -func (c *Context) PEXTRB(i, x, mr operand.Op) { - if inst, err := x86.PEXTRB(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTRB: Extract Byte. -// -// Forms: -// -// PEXTRB imm8 xmm r32 -// PEXTRB imm8 xmm m8 -// Construct and append a PEXTRB instruction to the active function. -// Operates on the global context. -func PEXTRB(i, x, mr operand.Op) { ctx.PEXTRB(i, x, mr) } - -// PEXTRD: Extract Doubleword. -// -// Forms: -// -// PEXTRD imm8 xmm r32 -// PEXTRD imm8 xmm m32 -// Construct and append a PEXTRD instruction to the active function. -func (c *Context) PEXTRD(i, x, mr operand.Op) { - if inst, err := x86.PEXTRD(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTRD: Extract Doubleword. -// -// Forms: -// -// PEXTRD imm8 xmm r32 -// PEXTRD imm8 xmm m32 -// Construct and append a PEXTRD instruction to the active function. -// Operates on the global context. -func PEXTRD(i, x, mr operand.Op) { ctx.PEXTRD(i, x, mr) } - -// PEXTRQ: Extract Quadword. -// -// Forms: -// -// PEXTRQ imm8 xmm r64 -// PEXTRQ imm8 xmm m64 -// Construct and append a PEXTRQ instruction to the active function. -func (c *Context) PEXTRQ(i, x, mr operand.Op) { - if inst, err := x86.PEXTRQ(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTRQ: Extract Quadword. -// -// Forms: -// -// PEXTRQ imm8 xmm r64 -// PEXTRQ imm8 xmm m64 -// Construct and append a PEXTRQ instruction to the active function. -// Operates on the global context. -func PEXTRQ(i, x, mr operand.Op) { ctx.PEXTRQ(i, x, mr) } - -// PEXTRW: Extract Word. -// -// Forms: -// -// PEXTRW imm8 xmm r32 -// PEXTRW imm8 xmm m16 -// Construct and append a PEXTRW instruction to the active function. -func (c *Context) PEXTRW(i, x, mr operand.Op) { - if inst, err := x86.PEXTRW(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PEXTRW: Extract Word. -// -// Forms: -// -// PEXTRW imm8 xmm r32 -// PEXTRW imm8 xmm m16 -// Construct and append a PEXTRW instruction to the active function. -// Operates on the global context. -func PEXTRW(i, x, mr operand.Op) { ctx.PEXTRW(i, x, mr) } - -// PHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// PHADDD xmm xmm -// PHADDD m128 xmm -// Construct and append a PHADDD instruction to the active function. -func (c *Context) PHADDD(mx, x operand.Op) { - if inst, err := x86.PHADDD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// PHADDD xmm xmm -// PHADDD m128 xmm -// Construct and append a PHADDD instruction to the active function. -// Operates on the global context. -func PHADDD(mx, x operand.Op) { ctx.PHADDD(mx, x) } - -// PHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHADDSW xmm xmm -// PHADDSW m128 xmm -// Construct and append a PHADDSW instruction to the active function. -func (c *Context) PHADDSW(mx, x operand.Op) { - if inst, err := x86.PHADDSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHADDSW xmm xmm -// PHADDSW m128 xmm -// Construct and append a PHADDSW instruction to the active function. -// Operates on the global context. -func PHADDSW(mx, x operand.Op) { ctx.PHADDSW(mx, x) } - -// PHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// PHADDW xmm xmm -// PHADDW m128 xmm -// Construct and append a PHADDW instruction to the active function. -func (c *Context) PHADDW(mx, x operand.Op) { - if inst, err := x86.PHADDW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// PHADDW xmm xmm -// PHADDW m128 xmm -// Construct and append a PHADDW instruction to the active function. -// Operates on the global context. -func PHADDW(mx, x operand.Op) { ctx.PHADDW(mx, x) } - -// PHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// PHMINPOSUW xmm xmm -// PHMINPOSUW m128 xmm -// Construct and append a PHMINPOSUW instruction to the active function. -func (c *Context) PHMINPOSUW(mx, x operand.Op) { - if inst, err := x86.PHMINPOSUW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// PHMINPOSUW xmm xmm -// PHMINPOSUW m128 xmm -// Construct and append a PHMINPOSUW instruction to the active function. -// Operates on the global context. -func PHMINPOSUW(mx, x operand.Op) { ctx.PHMINPOSUW(mx, x) } - -// PHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// PHSUBD xmm xmm -// PHSUBD m128 xmm -// Construct and append a PHSUBD instruction to the active function. -func (c *Context) PHSUBD(mx, x operand.Op) { - if inst, err := x86.PHSUBD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// PHSUBD xmm xmm -// PHSUBD m128 xmm -// Construct and append a PHSUBD instruction to the active function. -// Operates on the global context. -func PHSUBD(mx, x operand.Op) { ctx.PHSUBD(mx, x) } - -// PHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHSUBSW xmm xmm -// PHSUBSW m128 xmm -// Construct and append a PHSUBSW instruction to the active function. -func (c *Context) PHSUBSW(mx, x operand.Op) { - if inst, err := x86.PHSUBSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHSUBSW xmm xmm -// PHSUBSW m128 xmm -// Construct and append a PHSUBSW instruction to the active function. -// Operates on the global context. -func PHSUBSW(mx, x operand.Op) { ctx.PHSUBSW(mx, x) } - -// PHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// PHSUBW xmm xmm -// PHSUBW m128 xmm -// Construct and append a PHSUBW instruction to the active function. -func (c *Context) PHSUBW(mx, x operand.Op) { - if inst, err := x86.PHSUBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// PHSUBW xmm xmm -// PHSUBW m128 xmm -// Construct and append a PHSUBW instruction to the active function. -// Operates on the global context. -func PHSUBW(mx, x operand.Op) { ctx.PHSUBW(mx, x) } - -// PINSRB: Insert Byte. -// -// Forms: -// -// PINSRB imm8 r32 xmm -// PINSRB imm8 m8 xmm -// Construct and append a PINSRB instruction to the active function. -func (c *Context) PINSRB(i, mr, x operand.Op) { - if inst, err := x86.PINSRB(i, mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PINSRB: Insert Byte. -// -// Forms: -// -// PINSRB imm8 r32 xmm -// PINSRB imm8 m8 xmm -// Construct and append a PINSRB instruction to the active function. -// Operates on the global context. -func PINSRB(i, mr, x operand.Op) { ctx.PINSRB(i, mr, x) } - -// PINSRD: Insert Doubleword. -// -// Forms: -// -// PINSRD imm8 r32 xmm -// PINSRD imm8 m32 xmm -// Construct and append a PINSRD instruction to the active function. -func (c *Context) PINSRD(i, mr, x operand.Op) { - if inst, err := x86.PINSRD(i, mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PINSRD: Insert Doubleword. -// -// Forms: -// -// PINSRD imm8 r32 xmm -// PINSRD imm8 m32 xmm -// Construct and append a PINSRD instruction to the active function. -// Operates on the global context. -func PINSRD(i, mr, x operand.Op) { ctx.PINSRD(i, mr, x) } - -// PINSRQ: Insert Quadword. -// -// Forms: -// -// PINSRQ imm8 r64 xmm -// PINSRQ imm8 m64 xmm -// Construct and append a PINSRQ instruction to the active function. -func (c *Context) PINSRQ(i, mr, x operand.Op) { - if inst, err := x86.PINSRQ(i, mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PINSRQ: Insert Quadword. -// -// Forms: -// -// PINSRQ imm8 r64 xmm -// PINSRQ imm8 m64 xmm -// Construct and append a PINSRQ instruction to the active function. -// Operates on the global context. -func PINSRQ(i, mr, x operand.Op) { ctx.PINSRQ(i, mr, x) } - -// PINSRW: Insert Word. -// -// Forms: -// -// PINSRW imm8 r32 xmm -// PINSRW imm8 m16 xmm -// Construct and append a PINSRW instruction to the active function. -func (c *Context) PINSRW(i, mr, x operand.Op) { - if inst, err := x86.PINSRW(i, mr, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PINSRW: Insert Word. -// -// Forms: -// -// PINSRW imm8 r32 xmm -// PINSRW imm8 m16 xmm -// Construct and append a PINSRW instruction to the active function. -// Operates on the global context. -func PINSRW(i, mr, x operand.Op) { ctx.PINSRW(i, mr, x) } - -// PMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// PMADDUBSW xmm xmm -// PMADDUBSW m128 xmm -// Construct and append a PMADDUBSW instruction to the active function. -func (c *Context) PMADDUBSW(mx, x operand.Op) { - if inst, err := x86.PMADDUBSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// PMADDUBSW xmm xmm -// PMADDUBSW m128 xmm -// Construct and append a PMADDUBSW instruction to the active function. -// Operates on the global context. -func PMADDUBSW(mx, x operand.Op) { ctx.PMADDUBSW(mx, x) } - -// PMADDWL: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// PMADDWL xmm xmm -// PMADDWL m128 xmm -// Construct and append a PMADDWL instruction to the active function. -func (c *Context) PMADDWL(mx, x operand.Op) { - if inst, err := x86.PMADDWL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMADDWL: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// PMADDWL xmm xmm -// PMADDWL m128 xmm -// Construct and append a PMADDWL instruction to the active function. -// Operates on the global context. -func PMADDWL(mx, x operand.Op) { ctx.PMADDWL(mx, x) } - -// PMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// PMAXSB xmm xmm -// PMAXSB m128 xmm -// Construct and append a PMAXSB instruction to the active function. -func (c *Context) PMAXSB(mx, x operand.Op) { - if inst, err := x86.PMAXSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// PMAXSB xmm xmm -// PMAXSB m128 xmm -// Construct and append a PMAXSB instruction to the active function. -// Operates on the global context. -func PMAXSB(mx, x operand.Op) { ctx.PMAXSB(mx, x) } - -// PMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMAXSD xmm xmm -// PMAXSD m128 xmm -// Construct and append a PMAXSD instruction to the active function. -func (c *Context) PMAXSD(mx, x operand.Op) { - if inst, err := x86.PMAXSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMAXSD xmm xmm -// PMAXSD m128 xmm -// Construct and append a PMAXSD instruction to the active function. -// Operates on the global context. -func PMAXSD(mx, x operand.Op) { ctx.PMAXSD(mx, x) } - -// PMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// PMAXSW xmm xmm -// PMAXSW m128 xmm -// Construct and append a PMAXSW instruction to the active function. -func (c *Context) PMAXSW(mx, x operand.Op) { - if inst, err := x86.PMAXSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// PMAXSW xmm xmm -// PMAXSW m128 xmm -// Construct and append a PMAXSW instruction to the active function. -// Operates on the global context. -func PMAXSW(mx, x operand.Op) { ctx.PMAXSW(mx, x) } - -// PMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMAXUB xmm xmm -// PMAXUB m128 xmm -// Construct and append a PMAXUB instruction to the active function. -func (c *Context) PMAXUB(mx, x operand.Op) { - if inst, err := x86.PMAXUB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMAXUB xmm xmm -// PMAXUB m128 xmm -// Construct and append a PMAXUB instruction to the active function. -// Operates on the global context. -func PMAXUB(mx, x operand.Op) { ctx.PMAXUB(mx, x) } - -// PMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMAXUD xmm xmm -// PMAXUD m128 xmm -// Construct and append a PMAXUD instruction to the active function. -func (c *Context) PMAXUD(mx, x operand.Op) { - if inst, err := x86.PMAXUD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMAXUD xmm xmm -// PMAXUD m128 xmm -// Construct and append a PMAXUD instruction to the active function. -// Operates on the global context. -func PMAXUD(mx, x operand.Op) { ctx.PMAXUD(mx, x) } - -// PMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMAXUW xmm xmm -// PMAXUW m128 xmm -// Construct and append a PMAXUW instruction to the active function. -func (c *Context) PMAXUW(mx, x operand.Op) { - if inst, err := x86.PMAXUW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMAXUW xmm xmm -// PMAXUW m128 xmm -// Construct and append a PMAXUW instruction to the active function. -// Operates on the global context. -func PMAXUW(mx, x operand.Op) { ctx.PMAXUW(mx, x) } - -// PMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// PMINSB xmm xmm -// PMINSB m128 xmm -// Construct and append a PMINSB instruction to the active function. -func (c *Context) PMINSB(mx, x operand.Op) { - if inst, err := x86.PMINSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// PMINSB xmm xmm -// PMINSB m128 xmm -// Construct and append a PMINSB instruction to the active function. -// Operates on the global context. -func PMINSB(mx, x operand.Op) { ctx.PMINSB(mx, x) } - -// PMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMINSD xmm xmm -// PMINSD m128 xmm -// Construct and append a PMINSD instruction to the active function. -func (c *Context) PMINSD(mx, x operand.Op) { - if inst, err := x86.PMINSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMINSD xmm xmm -// PMINSD m128 xmm -// Construct and append a PMINSD instruction to the active function. -// Operates on the global context. -func PMINSD(mx, x operand.Op) { ctx.PMINSD(mx, x) } - -// PMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// PMINSW xmm xmm -// PMINSW m128 xmm -// Construct and append a PMINSW instruction to the active function. -func (c *Context) PMINSW(mx, x operand.Op) { - if inst, err := x86.PMINSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// PMINSW xmm xmm -// PMINSW m128 xmm -// Construct and append a PMINSW instruction to the active function. -// Operates on the global context. -func PMINSW(mx, x operand.Op) { ctx.PMINSW(mx, x) } - -// PMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMINUB xmm xmm -// PMINUB m128 xmm -// Construct and append a PMINUB instruction to the active function. -func (c *Context) PMINUB(mx, x operand.Op) { - if inst, err := x86.PMINUB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMINUB xmm xmm -// PMINUB m128 xmm -// Construct and append a PMINUB instruction to the active function. -// Operates on the global context. -func PMINUB(mx, x operand.Op) { ctx.PMINUB(mx, x) } - -// PMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMINUD xmm xmm -// PMINUD m128 xmm -// Construct and append a PMINUD instruction to the active function. -func (c *Context) PMINUD(mx, x operand.Op) { - if inst, err := x86.PMINUD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMINUD xmm xmm -// PMINUD m128 xmm -// Construct and append a PMINUD instruction to the active function. -// Operates on the global context. -func PMINUD(mx, x operand.Op) { ctx.PMINUD(mx, x) } - -// PMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMINUW xmm xmm -// PMINUW m128 xmm -// Construct and append a PMINUW instruction to the active function. -func (c *Context) PMINUW(mx, x operand.Op) { - if inst, err := x86.PMINUW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMINUW xmm xmm -// PMINUW m128 xmm -// Construct and append a PMINUW instruction to the active function. -// Operates on the global context. -func PMINUW(mx, x operand.Op) { ctx.PMINUW(mx, x) } - -// PMOVMSKB: Move Byte Mask. -// -// Forms: -// -// PMOVMSKB xmm r32 -// Construct and append a PMOVMSKB instruction to the active function. -func (c *Context) PMOVMSKB(x, r operand.Op) { - if inst, err := x86.PMOVMSKB(x, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVMSKB: Move Byte Mask. -// -// Forms: -// -// PMOVMSKB xmm r32 -// Construct and append a PMOVMSKB instruction to the active function. -// Operates on the global context. -func PMOVMSKB(x, r operand.Op) { ctx.PMOVMSKB(x, r) } - -// PMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBD xmm xmm -// PMOVSXBD m32 xmm -// Construct and append a PMOVSXBD instruction to the active function. -func (c *Context) PMOVSXBD(mx, x operand.Op) { - if inst, err := x86.PMOVSXBD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBD xmm xmm -// PMOVSXBD m32 xmm -// Construct and append a PMOVSXBD instruction to the active function. -// Operates on the global context. -func PMOVSXBD(mx, x operand.Op) { ctx.PMOVSXBD(mx, x) } - -// PMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBQ xmm xmm -// PMOVSXBQ m16 xmm -// Construct and append a PMOVSXBQ instruction to the active function. -func (c *Context) PMOVSXBQ(mx, x operand.Op) { - if inst, err := x86.PMOVSXBQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBQ xmm xmm -// PMOVSXBQ m16 xmm -// Construct and append a PMOVSXBQ instruction to the active function. -// Operates on the global context. -func PMOVSXBQ(mx, x operand.Op) { ctx.PMOVSXBQ(mx, x) } - -// PMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBW xmm xmm -// PMOVSXBW m64 xmm -// Construct and append a PMOVSXBW instruction to the active function. -func (c *Context) PMOVSXBW(mx, x operand.Op) { - if inst, err := x86.PMOVSXBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBW xmm xmm -// PMOVSXBW m64 xmm -// Construct and append a PMOVSXBW instruction to the active function. -// Operates on the global context. -func PMOVSXBW(mx, x operand.Op) { ctx.PMOVSXBW(mx, x) } - -// PMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXDQ xmm xmm -// PMOVSXDQ m64 xmm -// Construct and append a PMOVSXDQ instruction to the active function. -func (c *Context) PMOVSXDQ(mx, x operand.Op) { - if inst, err := x86.PMOVSXDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXDQ xmm xmm -// PMOVSXDQ m64 xmm -// Construct and append a PMOVSXDQ instruction to the active function. -// Operates on the global context. -func PMOVSXDQ(mx, x operand.Op) { ctx.PMOVSXDQ(mx, x) } - -// PMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWD xmm xmm -// PMOVSXWD m64 xmm -// Construct and append a PMOVSXWD instruction to the active function. -func (c *Context) PMOVSXWD(mx, x operand.Op) { - if inst, err := x86.PMOVSXWD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWD xmm xmm -// PMOVSXWD m64 xmm -// Construct and append a PMOVSXWD instruction to the active function. -// Operates on the global context. -func PMOVSXWD(mx, x operand.Op) { ctx.PMOVSXWD(mx, x) } - -// PMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWQ xmm xmm -// PMOVSXWQ m32 xmm -// Construct and append a PMOVSXWQ instruction to the active function. -func (c *Context) PMOVSXWQ(mx, x operand.Op) { - if inst, err := x86.PMOVSXWQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWQ xmm xmm -// PMOVSXWQ m32 xmm -// Construct and append a PMOVSXWQ instruction to the active function. -// Operates on the global context. -func PMOVSXWQ(mx, x operand.Op) { ctx.PMOVSXWQ(mx, x) } - -// PMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBD xmm xmm -// PMOVZXBD m32 xmm -// Construct and append a PMOVZXBD instruction to the active function. -func (c *Context) PMOVZXBD(mx, x operand.Op) { - if inst, err := x86.PMOVZXBD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBD xmm xmm -// PMOVZXBD m32 xmm -// Construct and append a PMOVZXBD instruction to the active function. -// Operates on the global context. -func PMOVZXBD(mx, x operand.Op) { ctx.PMOVZXBD(mx, x) } - -// PMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBQ xmm xmm -// PMOVZXBQ m16 xmm -// Construct and append a PMOVZXBQ instruction to the active function. -func (c *Context) PMOVZXBQ(mx, x operand.Op) { - if inst, err := x86.PMOVZXBQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBQ xmm xmm -// PMOVZXBQ m16 xmm -// Construct and append a PMOVZXBQ instruction to the active function. -// Operates on the global context. -func PMOVZXBQ(mx, x operand.Op) { ctx.PMOVZXBQ(mx, x) } - -// PMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBW xmm xmm -// PMOVZXBW m64 xmm -// Construct and append a PMOVZXBW instruction to the active function. -func (c *Context) PMOVZXBW(mx, x operand.Op) { - if inst, err := x86.PMOVZXBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBW xmm xmm -// PMOVZXBW m64 xmm -// Construct and append a PMOVZXBW instruction to the active function. -// Operates on the global context. -func PMOVZXBW(mx, x operand.Op) { ctx.PMOVZXBW(mx, x) } - -// PMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXDQ xmm xmm -// PMOVZXDQ m64 xmm -// Construct and append a PMOVZXDQ instruction to the active function. -func (c *Context) PMOVZXDQ(mx, x operand.Op) { - if inst, err := x86.PMOVZXDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXDQ xmm xmm -// PMOVZXDQ m64 xmm -// Construct and append a PMOVZXDQ instruction to the active function. -// Operates on the global context. -func PMOVZXDQ(mx, x operand.Op) { ctx.PMOVZXDQ(mx, x) } - -// PMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWD xmm xmm -// PMOVZXWD m64 xmm -// Construct and append a PMOVZXWD instruction to the active function. -func (c *Context) PMOVZXWD(mx, x operand.Op) { - if inst, err := x86.PMOVZXWD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWD xmm xmm -// PMOVZXWD m64 xmm -// Construct and append a PMOVZXWD instruction to the active function. -// Operates on the global context. -func PMOVZXWD(mx, x operand.Op) { ctx.PMOVZXWD(mx, x) } - -// PMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWQ xmm xmm -// PMOVZXWQ m32 xmm -// Construct and append a PMOVZXWQ instruction to the active function. -func (c *Context) PMOVZXWQ(mx, x operand.Op) { - if inst, err := x86.PMOVZXWQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWQ xmm xmm -// PMOVZXWQ m32 xmm -// Construct and append a PMOVZXWQ instruction to the active function. -// Operates on the global context. -func PMOVZXWQ(mx, x operand.Op) { ctx.PMOVZXWQ(mx, x) } - -// PMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// PMULDQ xmm xmm -// PMULDQ m128 xmm -// Construct and append a PMULDQ instruction to the active function. -func (c *Context) PMULDQ(mx, x operand.Op) { - if inst, err := x86.PMULDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// PMULDQ xmm xmm -// PMULDQ m128 xmm -// Construct and append a PMULDQ instruction to the active function. -// Operates on the global context. -func PMULDQ(mx, x operand.Op) { ctx.PMULDQ(mx, x) } - -// PMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// PMULHRSW xmm xmm -// PMULHRSW m128 xmm -// Construct and append a PMULHRSW instruction to the active function. -func (c *Context) PMULHRSW(mx, x operand.Op) { - if inst, err := x86.PMULHRSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// PMULHRSW xmm xmm -// PMULHRSW m128 xmm -// Construct and append a PMULHRSW instruction to the active function. -// Operates on the global context. -func PMULHRSW(mx, x operand.Op) { ctx.PMULHRSW(mx, x) } - -// PMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// PMULHUW xmm xmm -// PMULHUW m128 xmm -// Construct and append a PMULHUW instruction to the active function. -func (c *Context) PMULHUW(mx, x operand.Op) { - if inst, err := x86.PMULHUW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// PMULHUW xmm xmm -// PMULHUW m128 xmm -// Construct and append a PMULHUW instruction to the active function. -// Operates on the global context. -func PMULHUW(mx, x operand.Op) { ctx.PMULHUW(mx, x) } - -// PMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// PMULHW xmm xmm -// PMULHW m128 xmm -// Construct and append a PMULHW instruction to the active function. -func (c *Context) PMULHW(mx, x operand.Op) { - if inst, err := x86.PMULHW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// PMULHW xmm xmm -// PMULHW m128 xmm -// Construct and append a PMULHW instruction to the active function. -// Operates on the global context. -func PMULHW(mx, x operand.Op) { ctx.PMULHW(mx, x) } - -// PMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// PMULLD xmm xmm -// PMULLD m128 xmm -// Construct and append a PMULLD instruction to the active function. -func (c *Context) PMULLD(mx, x operand.Op) { - if inst, err := x86.PMULLD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// PMULLD xmm xmm -// PMULLD m128 xmm -// Construct and append a PMULLD instruction to the active function. -// Operates on the global context. -func PMULLD(mx, x operand.Op) { ctx.PMULLD(mx, x) } - -// PMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// PMULLW xmm xmm -// PMULLW m128 xmm -// Construct and append a PMULLW instruction to the active function. -func (c *Context) PMULLW(mx, x operand.Op) { - if inst, err := x86.PMULLW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// PMULLW xmm xmm -// PMULLW m128 xmm -// Construct and append a PMULLW instruction to the active function. -// Operates on the global context. -func PMULLW(mx, x operand.Op) { ctx.PMULLW(mx, x) } - -// PMULULQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMULULQ xmm xmm -// PMULULQ m128 xmm -// Construct and append a PMULULQ instruction to the active function. -func (c *Context) PMULULQ(mx, x operand.Op) { - if inst, err := x86.PMULULQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PMULULQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMULULQ xmm xmm -// PMULULQ m128 xmm -// Construct and append a PMULULQ instruction to the active function. -// Operates on the global context. -func PMULULQ(mx, x operand.Op) { ctx.PMULULQ(mx, x) } - -// POPCNTL: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTL r32 r32 -// POPCNTL m32 r32 -// Construct and append a POPCNTL instruction to the active function. -func (c *Context) POPCNTL(mr, r operand.Op) { - if inst, err := x86.POPCNTL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POPCNTL: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTL r32 r32 -// POPCNTL m32 r32 -// Construct and append a POPCNTL instruction to the active function. -// Operates on the global context. -func POPCNTL(mr, r operand.Op) { ctx.POPCNTL(mr, r) } - -// POPCNTQ: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTQ r64 r64 -// POPCNTQ m64 r64 -// Construct and append a POPCNTQ instruction to the active function. -func (c *Context) POPCNTQ(mr, r operand.Op) { - if inst, err := x86.POPCNTQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POPCNTQ: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTQ r64 r64 -// POPCNTQ m64 r64 -// Construct and append a POPCNTQ instruction to the active function. -// Operates on the global context. -func POPCNTQ(mr, r operand.Op) { ctx.POPCNTQ(mr, r) } - -// POPCNTW: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTW r16 r16 -// POPCNTW m16 r16 -// Construct and append a POPCNTW instruction to the active function. -func (c *Context) POPCNTW(mr, r operand.Op) { - if inst, err := x86.POPCNTW(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POPCNTW: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTW r16 r16 -// POPCNTW m16 r16 -// Construct and append a POPCNTW instruction to the active function. -// Operates on the global context. -func POPCNTW(mr, r operand.Op) { ctx.POPCNTW(mr, r) } - -// POPQ: Pop a Value from the Stack. -// -// Forms: -// -// POPQ r64 -// POPQ m64 -// Construct and append a POPQ instruction to the active function. -func (c *Context) POPQ(mr operand.Op) { - if inst, err := x86.POPQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POPQ: Pop a Value from the Stack. -// -// Forms: -// -// POPQ r64 -// POPQ m64 -// Construct and append a POPQ instruction to the active function. -// Operates on the global context. -func POPQ(mr operand.Op) { ctx.POPQ(mr) } - -// POPW: Pop a Value from the Stack. -// -// Forms: -// -// POPW r16 -// POPW m16 -// Construct and append a POPW instruction to the active function. -func (c *Context) POPW(mr operand.Op) { - if inst, err := x86.POPW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POPW: Pop a Value from the Stack. -// -// Forms: -// -// POPW r16 -// POPW m16 -// Construct and append a POPW instruction to the active function. -// Operates on the global context. -func POPW(mr operand.Op) { ctx.POPW(mr) } - -// POR: Packed Bitwise Logical OR. -// -// Forms: -// -// POR xmm xmm -// POR m128 xmm -// Construct and append a POR instruction to the active function. -func (c *Context) POR(mx, x operand.Op) { - if inst, err := x86.POR(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// POR: Packed Bitwise Logical OR. -// -// Forms: -// -// POR xmm xmm -// POR m128 xmm -// Construct and append a POR instruction to the active function. -// Operates on the global context. -func POR(mx, x operand.Op) { ctx.POR(mx, x) } - -// PREFETCHNTA: Prefetch Data Into Caches using NTA Hint. -// -// Forms: -// -// PREFETCHNTA m8 -// Construct and append a PREFETCHNTA instruction to the active function. -func (c *Context) PREFETCHNTA(m operand.Op) { - if inst, err := x86.PREFETCHNTA(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PREFETCHNTA: Prefetch Data Into Caches using NTA Hint. -// -// Forms: -// -// PREFETCHNTA m8 -// Construct and append a PREFETCHNTA instruction to the active function. -// Operates on the global context. -func PREFETCHNTA(m operand.Op) { ctx.PREFETCHNTA(m) } - -// PREFETCHT0: Prefetch Data Into Caches using T0 Hint. -// -// Forms: -// -// PREFETCHT0 m8 -// Construct and append a PREFETCHT0 instruction to the active function. -func (c *Context) PREFETCHT0(m operand.Op) { - if inst, err := x86.PREFETCHT0(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PREFETCHT0: Prefetch Data Into Caches using T0 Hint. -// -// Forms: -// -// PREFETCHT0 m8 -// Construct and append a PREFETCHT0 instruction to the active function. -// Operates on the global context. -func PREFETCHT0(m operand.Op) { ctx.PREFETCHT0(m) } - -// PREFETCHT1: Prefetch Data Into Caches using T1 Hint. -// -// Forms: -// -// PREFETCHT1 m8 -// Construct and append a PREFETCHT1 instruction to the active function. -func (c *Context) PREFETCHT1(m operand.Op) { - if inst, err := x86.PREFETCHT1(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PREFETCHT1: Prefetch Data Into Caches using T1 Hint. -// -// Forms: -// -// PREFETCHT1 m8 -// Construct and append a PREFETCHT1 instruction to the active function. -// Operates on the global context. -func PREFETCHT1(m operand.Op) { ctx.PREFETCHT1(m) } - -// PREFETCHT2: Prefetch Data Into Caches using T2 Hint. -// -// Forms: -// -// PREFETCHT2 m8 -// Construct and append a PREFETCHT2 instruction to the active function. -func (c *Context) PREFETCHT2(m operand.Op) { - if inst, err := x86.PREFETCHT2(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PREFETCHT2: Prefetch Data Into Caches using T2 Hint. -// -// Forms: -// -// PREFETCHT2 m8 -// Construct and append a PREFETCHT2 instruction to the active function. -// Operates on the global context. -func PREFETCHT2(m operand.Op) { ctx.PREFETCHT2(m) } - -// PSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// PSADBW xmm xmm -// PSADBW m128 xmm -// Construct and append a PSADBW instruction to the active function. -func (c *Context) PSADBW(mx, x operand.Op) { - if inst, err := x86.PSADBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// PSADBW xmm xmm -// PSADBW m128 xmm -// Construct and append a PSADBW instruction to the active function. -// Operates on the global context. -func PSADBW(mx, x operand.Op) { ctx.PSADBW(mx, x) } - -// PSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// PSHUFB xmm xmm -// PSHUFB m128 xmm -// Construct and append a PSHUFB instruction to the active function. -func (c *Context) PSHUFB(mx, x operand.Op) { - if inst, err := x86.PSHUFB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// PSHUFB xmm xmm -// PSHUFB m128 xmm -// Construct and append a PSHUFB instruction to the active function. -// Operates on the global context. -func PSHUFB(mx, x operand.Op) { ctx.PSHUFB(mx, x) } - -// PSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFD imm8 xmm xmm -// PSHUFD imm8 m128 xmm -// Construct and append a PSHUFD instruction to the active function. -func (c *Context) PSHUFD(i, mx, x operand.Op) { - if inst, err := x86.PSHUFD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFD imm8 xmm xmm -// PSHUFD imm8 m128 xmm -// Construct and append a PSHUFD instruction to the active function. -// Operates on the global context. -func PSHUFD(i, mx, x operand.Op) { ctx.PSHUFD(i, mx, x) } - -// PSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// PSHUFHW imm8 xmm xmm -// PSHUFHW imm8 m128 xmm -// Construct and append a PSHUFHW instruction to the active function. -func (c *Context) PSHUFHW(i, mx, x operand.Op) { - if inst, err := x86.PSHUFHW(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// PSHUFHW imm8 xmm xmm -// PSHUFHW imm8 m128 xmm -// Construct and append a PSHUFHW instruction to the active function. -// Operates on the global context. -func PSHUFHW(i, mx, x operand.Op) { ctx.PSHUFHW(i, mx, x) } - -// PSHUFL: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFL imm8 xmm xmm -// PSHUFL imm8 m128 xmm -// Construct and append a PSHUFL instruction to the active function. -func (c *Context) PSHUFL(i, mx, x operand.Op) { - if inst, err := x86.PSHUFL(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSHUFL: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFL imm8 xmm xmm -// PSHUFL imm8 m128 xmm -// Construct and append a PSHUFL instruction to the active function. -// Operates on the global context. -func PSHUFL(i, mx, x operand.Op) { ctx.PSHUFL(i, mx, x) } - -// PSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// PSHUFLW imm8 xmm xmm -// PSHUFLW imm8 m128 xmm -// Construct and append a PSHUFLW instruction to the active function. -func (c *Context) PSHUFLW(i, mx, x operand.Op) { - if inst, err := x86.PSHUFLW(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// PSHUFLW imm8 xmm xmm -// PSHUFLW imm8 m128 xmm -// Construct and append a PSHUFLW instruction to the active function. -// Operates on the global context. -func PSHUFLW(i, mx, x operand.Op) { ctx.PSHUFLW(i, mx, x) } - -// PSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// PSIGNB xmm xmm -// PSIGNB m128 xmm -// Construct and append a PSIGNB instruction to the active function. -func (c *Context) PSIGNB(mx, x operand.Op) { - if inst, err := x86.PSIGNB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// PSIGNB xmm xmm -// PSIGNB m128 xmm -// Construct and append a PSIGNB instruction to the active function. -// Operates on the global context. -func PSIGNB(mx, x operand.Op) { ctx.PSIGNB(mx, x) } - -// PSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// PSIGND xmm xmm -// PSIGND m128 xmm -// Construct and append a PSIGND instruction to the active function. -func (c *Context) PSIGND(mx, x operand.Op) { - if inst, err := x86.PSIGND(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// PSIGND xmm xmm -// PSIGND m128 xmm -// Construct and append a PSIGND instruction to the active function. -// Operates on the global context. -func PSIGND(mx, x operand.Op) { ctx.PSIGND(mx, x) } - -// PSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// PSIGNW xmm xmm -// PSIGNW m128 xmm -// Construct and append a PSIGNW instruction to the active function. -func (c *Context) PSIGNW(mx, x operand.Op) { - if inst, err := x86.PSIGNW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// PSIGNW xmm xmm -// PSIGNW m128 xmm -// Construct and append a PSIGNW instruction to the active function. -// Operates on the global context. -func PSIGNW(mx, x operand.Op) { ctx.PSIGNW(mx, x) } - -// PSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLDQ imm8 xmm -// Construct and append a PSLLDQ instruction to the active function. -func (c *Context) PSLLDQ(i, x operand.Op) { - if inst, err := x86.PSLLDQ(i, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLDQ imm8 xmm -// Construct and append a PSLLDQ instruction to the active function. -// Operates on the global context. -func PSLLDQ(i, x operand.Op) { ctx.PSLLDQ(i, x) } - -// PSLLL: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// PSLLL imm8 xmm -// PSLLL xmm xmm -// PSLLL m128 xmm -// Construct and append a PSLLL instruction to the active function. -func (c *Context) PSLLL(imx, x operand.Op) { - if inst, err := x86.PSLLL(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSLLL: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// PSLLL imm8 xmm -// PSLLL xmm xmm -// PSLLL m128 xmm -// Construct and append a PSLLL instruction to the active function. -// Operates on the global context. -func PSLLL(imx, x operand.Op) { ctx.PSLLL(imx, x) } - -// PSLLO: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLO imm8 xmm -// Construct and append a PSLLO instruction to the active function. -func (c *Context) PSLLO(i, x operand.Op) { - if inst, err := x86.PSLLO(i, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSLLO: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLO imm8 xmm -// Construct and append a PSLLO instruction to the active function. -// Operates on the global context. -func PSLLO(i, x operand.Op) { ctx.PSLLO(i, x) } - -// PSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// PSLLQ imm8 xmm -// PSLLQ xmm xmm -// PSLLQ m128 xmm -// Construct and append a PSLLQ instruction to the active function. -func (c *Context) PSLLQ(imx, x operand.Op) { - if inst, err := x86.PSLLQ(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// PSLLQ imm8 xmm -// PSLLQ xmm xmm -// PSLLQ m128 xmm -// Construct and append a PSLLQ instruction to the active function. -// Operates on the global context. -func PSLLQ(imx, x operand.Op) { ctx.PSLLQ(imx, x) } - -// PSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// PSLLW imm8 xmm -// PSLLW xmm xmm -// PSLLW m128 xmm -// Construct and append a PSLLW instruction to the active function. -func (c *Context) PSLLW(imx, x operand.Op) { - if inst, err := x86.PSLLW(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// PSLLW imm8 xmm -// PSLLW xmm xmm -// PSLLW m128 xmm -// Construct and append a PSLLW instruction to the active function. -// Operates on the global context. -func PSLLW(imx, x operand.Op) { ctx.PSLLW(imx, x) } - -// PSRAL: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// PSRAL imm8 xmm -// PSRAL xmm xmm -// PSRAL m128 xmm -// Construct and append a PSRAL instruction to the active function. -func (c *Context) PSRAL(imx, x operand.Op) { - if inst, err := x86.PSRAL(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRAL: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// PSRAL imm8 xmm -// PSRAL xmm xmm -// PSRAL m128 xmm -// Construct and append a PSRAL instruction to the active function. -// Operates on the global context. -func PSRAL(imx, x operand.Op) { ctx.PSRAL(imx, x) } - -// PSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// PSRAW imm8 xmm -// PSRAW xmm xmm -// PSRAW m128 xmm -// Construct and append a PSRAW instruction to the active function. -func (c *Context) PSRAW(imx, x operand.Op) { - if inst, err := x86.PSRAW(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// PSRAW imm8 xmm -// PSRAW xmm xmm -// PSRAW m128 xmm -// Construct and append a PSRAW instruction to the active function. -// Operates on the global context. -func PSRAW(imx, x operand.Op) { ctx.PSRAW(imx, x) } - -// PSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLDQ imm8 xmm -// Construct and append a PSRLDQ instruction to the active function. -func (c *Context) PSRLDQ(i, x operand.Op) { - if inst, err := x86.PSRLDQ(i, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLDQ imm8 xmm -// Construct and append a PSRLDQ instruction to the active function. -// Operates on the global context. -func PSRLDQ(i, x operand.Op) { ctx.PSRLDQ(i, x) } - -// PSRLL: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// PSRLL imm8 xmm -// PSRLL xmm xmm -// PSRLL m128 xmm -// Construct and append a PSRLL instruction to the active function. -func (c *Context) PSRLL(imx, x operand.Op) { - if inst, err := x86.PSRLL(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRLL: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// PSRLL imm8 xmm -// PSRLL xmm xmm -// PSRLL m128 xmm -// Construct and append a PSRLL instruction to the active function. -// Operates on the global context. -func PSRLL(imx, x operand.Op) { ctx.PSRLL(imx, x) } - -// PSRLO: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLO imm8 xmm -// Construct and append a PSRLO instruction to the active function. -func (c *Context) PSRLO(i, x operand.Op) { - if inst, err := x86.PSRLO(i, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRLO: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLO imm8 xmm -// Construct and append a PSRLO instruction to the active function. -// Operates on the global context. -func PSRLO(i, x operand.Op) { ctx.PSRLO(i, x) } - -// PSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// PSRLQ imm8 xmm -// PSRLQ xmm xmm -// PSRLQ m128 xmm -// Construct and append a PSRLQ instruction to the active function. -func (c *Context) PSRLQ(imx, x operand.Op) { - if inst, err := x86.PSRLQ(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// PSRLQ imm8 xmm -// PSRLQ xmm xmm -// PSRLQ m128 xmm -// Construct and append a PSRLQ instruction to the active function. -// Operates on the global context. -func PSRLQ(imx, x operand.Op) { ctx.PSRLQ(imx, x) } - -// PSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// PSRLW imm8 xmm -// PSRLW xmm xmm -// PSRLW m128 xmm -// Construct and append a PSRLW instruction to the active function. -func (c *Context) PSRLW(imx, x operand.Op) { - if inst, err := x86.PSRLW(imx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// PSRLW imm8 xmm -// PSRLW xmm xmm -// PSRLW m128 xmm -// Construct and append a PSRLW instruction to the active function. -// Operates on the global context. -func PSRLW(imx, x operand.Op) { ctx.PSRLW(imx, x) } - -// PSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// PSUBB xmm xmm -// PSUBB m128 xmm -// Construct and append a PSUBB instruction to the active function. -func (c *Context) PSUBB(mx, x operand.Op) { - if inst, err := x86.PSUBB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// PSUBB xmm xmm -// PSUBB m128 xmm -// Construct and append a PSUBB instruction to the active function. -// Operates on the global context. -func PSUBB(mx, x operand.Op) { ctx.PSUBB(mx, x) } - -// PSUBL: Subtract Packed Doubleword Integers. -// -// Forms: -// -// PSUBL xmm xmm -// PSUBL m128 xmm -// Construct and append a PSUBL instruction to the active function. -func (c *Context) PSUBL(mx, x operand.Op) { - if inst, err := x86.PSUBL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBL: Subtract Packed Doubleword Integers. -// -// Forms: -// -// PSUBL xmm xmm -// PSUBL m128 xmm -// Construct and append a PSUBL instruction to the active function. -// Operates on the global context. -func PSUBL(mx, x operand.Op) { ctx.PSUBL(mx, x) } - -// PSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// PSUBQ xmm xmm -// PSUBQ m128 xmm -// Construct and append a PSUBQ instruction to the active function. -func (c *Context) PSUBQ(mx, x operand.Op) { - if inst, err := x86.PSUBQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// PSUBQ xmm xmm -// PSUBQ m128 xmm -// Construct and append a PSUBQ instruction to the active function. -// Operates on the global context. -func PSUBQ(mx, x operand.Op) { ctx.PSUBQ(mx, x) } - -// PSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PSUBSB xmm xmm -// PSUBSB m128 xmm -// Construct and append a PSUBSB instruction to the active function. -func (c *Context) PSUBSB(mx, x operand.Op) { - if inst, err := x86.PSUBSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PSUBSB xmm xmm -// PSUBSB m128 xmm -// Construct and append a PSUBSB instruction to the active function. -// Operates on the global context. -func PSUBSB(mx, x operand.Op) { ctx.PSUBSB(mx, x) } - -// PSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PSUBSW xmm xmm -// PSUBSW m128 xmm -// Construct and append a PSUBSW instruction to the active function. -func (c *Context) PSUBSW(mx, x operand.Op) { - if inst, err := x86.PSUBSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PSUBSW xmm xmm -// PSUBSW m128 xmm -// Construct and append a PSUBSW instruction to the active function. -// Operates on the global context. -func PSUBSW(mx, x operand.Op) { ctx.PSUBSW(mx, x) } - -// PSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSB xmm xmm -// PSUBUSB m128 xmm -// Construct and append a PSUBUSB instruction to the active function. -func (c *Context) PSUBUSB(mx, x operand.Op) { - if inst, err := x86.PSUBUSB(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSB xmm xmm -// PSUBUSB m128 xmm -// Construct and append a PSUBUSB instruction to the active function. -// Operates on the global context. -func PSUBUSB(mx, x operand.Op) { ctx.PSUBUSB(mx, x) } - -// PSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSW xmm xmm -// PSUBUSW m128 xmm -// Construct and append a PSUBUSW instruction to the active function. -func (c *Context) PSUBUSW(mx, x operand.Op) { - if inst, err := x86.PSUBUSW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSW xmm xmm -// PSUBUSW m128 xmm -// Construct and append a PSUBUSW instruction to the active function. -// Operates on the global context. -func PSUBUSW(mx, x operand.Op) { ctx.PSUBUSW(mx, x) } - -// PSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// PSUBW xmm xmm -// PSUBW m128 xmm -// Construct and append a PSUBW instruction to the active function. -func (c *Context) PSUBW(mx, x operand.Op) { - if inst, err := x86.PSUBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// PSUBW xmm xmm -// PSUBW m128 xmm -// Construct and append a PSUBW instruction to the active function. -// Operates on the global context. -func PSUBW(mx, x operand.Op) { ctx.PSUBW(mx, x) } - -// PTEST: Packed Logical Compare. -// -// Forms: -// -// PTEST xmm xmm -// PTEST m128 xmm -// Construct and append a PTEST instruction to the active function. -func (c *Context) PTEST(mx, x operand.Op) { - if inst, err := x86.PTEST(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PTEST: Packed Logical Compare. -// -// Forms: -// -// PTEST xmm xmm -// PTEST m128 xmm -// Construct and append a PTEST instruction to the active function. -// Operates on the global context. -func PTEST(mx, x operand.Op) { ctx.PTEST(mx, x) } - -// PUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// PUNPCKHBW xmm xmm -// PUNPCKHBW m128 xmm -// Construct and append a PUNPCKHBW instruction to the active function. -func (c *Context) PUNPCKHBW(mx, x operand.Op) { - if inst, err := x86.PUNPCKHBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// PUNPCKHBW xmm xmm -// PUNPCKHBW m128 xmm -// Construct and append a PUNPCKHBW instruction to the active function. -// Operates on the global context. -func PUNPCKHBW(mx, x operand.Op) { ctx.PUNPCKHBW(mx, x) } - -// PUNPCKHLQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKHLQ xmm xmm -// PUNPCKHLQ m128 xmm -// Construct and append a PUNPCKHLQ instruction to the active function. -func (c *Context) PUNPCKHLQ(mx, x operand.Op) { - if inst, err := x86.PUNPCKHLQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKHLQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKHLQ xmm xmm -// PUNPCKHLQ m128 xmm -// Construct and append a PUNPCKHLQ instruction to the active function. -// Operates on the global context. -func PUNPCKHLQ(mx, x operand.Op) { ctx.PUNPCKHLQ(mx, x) } - -// PUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKHQDQ xmm xmm -// PUNPCKHQDQ m128 xmm -// Construct and append a PUNPCKHQDQ instruction to the active function. -func (c *Context) PUNPCKHQDQ(mx, x operand.Op) { - if inst, err := x86.PUNPCKHQDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKHQDQ xmm xmm -// PUNPCKHQDQ m128 xmm -// Construct and append a PUNPCKHQDQ instruction to the active function. -// Operates on the global context. -func PUNPCKHQDQ(mx, x operand.Op) { ctx.PUNPCKHQDQ(mx, x) } - -// PUNPCKHWL: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKHWL xmm xmm -// PUNPCKHWL m128 xmm -// Construct and append a PUNPCKHWL instruction to the active function. -func (c *Context) PUNPCKHWL(mx, x operand.Op) { - if inst, err := x86.PUNPCKHWL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKHWL: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKHWL xmm xmm -// PUNPCKHWL m128 xmm -// Construct and append a PUNPCKHWL instruction to the active function. -// Operates on the global context. -func PUNPCKHWL(mx, x operand.Op) { ctx.PUNPCKHWL(mx, x) } - -// PUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// PUNPCKLBW xmm xmm -// PUNPCKLBW m128 xmm -// Construct and append a PUNPCKLBW instruction to the active function. -func (c *Context) PUNPCKLBW(mx, x operand.Op) { - if inst, err := x86.PUNPCKLBW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// PUNPCKLBW xmm xmm -// PUNPCKLBW m128 xmm -// Construct and append a PUNPCKLBW instruction to the active function. -// Operates on the global context. -func PUNPCKLBW(mx, x operand.Op) { ctx.PUNPCKLBW(mx, x) } - -// PUNPCKLLQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKLLQ xmm xmm -// PUNPCKLLQ m128 xmm -// Construct and append a PUNPCKLLQ instruction to the active function. -func (c *Context) PUNPCKLLQ(mx, x operand.Op) { - if inst, err := x86.PUNPCKLLQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKLLQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKLLQ xmm xmm -// PUNPCKLLQ m128 xmm -// Construct and append a PUNPCKLLQ instruction to the active function. -// Operates on the global context. -func PUNPCKLLQ(mx, x operand.Op) { ctx.PUNPCKLLQ(mx, x) } - -// PUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKLQDQ xmm xmm -// PUNPCKLQDQ m128 xmm -// Construct and append a PUNPCKLQDQ instruction to the active function. -func (c *Context) PUNPCKLQDQ(mx, x operand.Op) { - if inst, err := x86.PUNPCKLQDQ(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKLQDQ xmm xmm -// PUNPCKLQDQ m128 xmm -// Construct and append a PUNPCKLQDQ instruction to the active function. -// Operates on the global context. -func PUNPCKLQDQ(mx, x operand.Op) { ctx.PUNPCKLQDQ(mx, x) } - -// PUNPCKLWL: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKLWL xmm xmm -// PUNPCKLWL m128 xmm -// Construct and append a PUNPCKLWL instruction to the active function. -func (c *Context) PUNPCKLWL(mx, x operand.Op) { - if inst, err := x86.PUNPCKLWL(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUNPCKLWL: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKLWL xmm xmm -// PUNPCKLWL m128 xmm -// Construct and append a PUNPCKLWL instruction to the active function. -// Operates on the global context. -func PUNPCKLWL(mx, x operand.Op) { ctx.PUNPCKLWL(mx, x) } - -// PUSHQ: Push Value Onto the Stack. -// -// Forms: -// -// PUSHQ imm8 -// PUSHQ imm32 -// PUSHQ r64 -// PUSHQ m64 -// Construct and append a PUSHQ instruction to the active function. -func (c *Context) PUSHQ(imr operand.Op) { - if inst, err := x86.PUSHQ(imr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUSHQ: Push Value Onto the Stack. -// -// Forms: -// -// PUSHQ imm8 -// PUSHQ imm32 -// PUSHQ r64 -// PUSHQ m64 -// Construct and append a PUSHQ instruction to the active function. -// Operates on the global context. -func PUSHQ(imr operand.Op) { ctx.PUSHQ(imr) } - -// PUSHW: Push Value Onto the Stack. -// -// Forms: -// -// PUSHW r16 -// PUSHW m16 -// Construct and append a PUSHW instruction to the active function. -func (c *Context) PUSHW(mr operand.Op) { - if inst, err := x86.PUSHW(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PUSHW: Push Value Onto the Stack. -// -// Forms: -// -// PUSHW r16 -// PUSHW m16 -// Construct and append a PUSHW instruction to the active function. -// Operates on the global context. -func PUSHW(mr operand.Op) { ctx.PUSHW(mr) } - -// PXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// PXOR xmm xmm -// PXOR m128 xmm -// Construct and append a PXOR instruction to the active function. -func (c *Context) PXOR(mx, x operand.Op) { - if inst, err := x86.PXOR(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// PXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// PXOR xmm xmm -// PXOR m128 xmm -// Construct and append a PXOR instruction to the active function. -// Operates on the global context. -func PXOR(mx, x operand.Op) { ctx.PXOR(mx, x) } - -// RCLB: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLB 1 r8 -// RCLB imm8 r8 -// RCLB cl r8 -// RCLB 1 m8 -// RCLB imm8 m8 -// RCLB cl m8 -// Construct and append a RCLB instruction to the active function. -func (c *Context) RCLB(ci, mr operand.Op) { - if inst, err := x86.RCLB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCLB: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLB 1 r8 -// RCLB imm8 r8 -// RCLB cl r8 -// RCLB 1 m8 -// RCLB imm8 m8 -// RCLB cl m8 -// Construct and append a RCLB instruction to the active function. -// Operates on the global context. -func RCLB(ci, mr operand.Op) { ctx.RCLB(ci, mr) } - -// RCLL: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLL 1 r32 -// RCLL imm8 r32 -// RCLL cl r32 -// RCLL 1 m32 -// RCLL imm8 m32 -// RCLL cl m32 -// Construct and append a RCLL instruction to the active function. -func (c *Context) RCLL(ci, mr operand.Op) { - if inst, err := x86.RCLL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCLL: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLL 1 r32 -// RCLL imm8 r32 -// RCLL cl r32 -// RCLL 1 m32 -// RCLL imm8 m32 -// RCLL cl m32 -// Construct and append a RCLL instruction to the active function. -// Operates on the global context. -func RCLL(ci, mr operand.Op) { ctx.RCLL(ci, mr) } - -// RCLQ: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLQ 1 r64 -// RCLQ imm8 r64 -// RCLQ cl r64 -// RCLQ 1 m64 -// RCLQ imm8 m64 -// RCLQ cl m64 -// Construct and append a RCLQ instruction to the active function. -func (c *Context) RCLQ(ci, mr operand.Op) { - if inst, err := x86.RCLQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCLQ: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLQ 1 r64 -// RCLQ imm8 r64 -// RCLQ cl r64 -// RCLQ 1 m64 -// RCLQ imm8 m64 -// RCLQ cl m64 -// Construct and append a RCLQ instruction to the active function. -// Operates on the global context. -func RCLQ(ci, mr operand.Op) { ctx.RCLQ(ci, mr) } - -// RCLW: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLW 1 r16 -// RCLW imm8 r16 -// RCLW cl r16 -// RCLW 1 m16 -// RCLW imm8 m16 -// RCLW cl m16 -// Construct and append a RCLW instruction to the active function. -func (c *Context) RCLW(ci, mr operand.Op) { - if inst, err := x86.RCLW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCLW: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLW 1 r16 -// RCLW imm8 r16 -// RCLW cl r16 -// RCLW 1 m16 -// RCLW imm8 m16 -// RCLW cl m16 -// Construct and append a RCLW instruction to the active function. -// Operates on the global context. -func RCLW(ci, mr operand.Op) { ctx.RCLW(ci, mr) } - -// RCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPPS xmm xmm -// RCPPS m128 xmm -// Construct and append a RCPPS instruction to the active function. -func (c *Context) RCPPS(mx, x operand.Op) { - if inst, err := x86.RCPPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPPS xmm xmm -// RCPPS m128 xmm -// Construct and append a RCPPS instruction to the active function. -// Operates on the global context. -func RCPPS(mx, x operand.Op) { ctx.RCPPS(mx, x) } - -// RCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPSS xmm xmm -// RCPSS m32 xmm -// Construct and append a RCPSS instruction to the active function. -func (c *Context) RCPSS(mx, x operand.Op) { - if inst, err := x86.RCPSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPSS xmm xmm -// RCPSS m32 xmm -// Construct and append a RCPSS instruction to the active function. -// Operates on the global context. -func RCPSS(mx, x operand.Op) { ctx.RCPSS(mx, x) } - -// RCRB: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRB 1 r8 -// RCRB imm8 r8 -// RCRB cl r8 -// RCRB 1 m8 -// RCRB imm8 m8 -// RCRB cl m8 -// Construct and append a RCRB instruction to the active function. -func (c *Context) RCRB(ci, mr operand.Op) { - if inst, err := x86.RCRB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCRB: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRB 1 r8 -// RCRB imm8 r8 -// RCRB cl r8 -// RCRB 1 m8 -// RCRB imm8 m8 -// RCRB cl m8 -// Construct and append a RCRB instruction to the active function. -// Operates on the global context. -func RCRB(ci, mr operand.Op) { ctx.RCRB(ci, mr) } - -// RCRL: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRL 1 r32 -// RCRL imm8 r32 -// RCRL cl r32 -// RCRL 1 m32 -// RCRL imm8 m32 -// RCRL cl m32 -// Construct and append a RCRL instruction to the active function. -func (c *Context) RCRL(ci, mr operand.Op) { - if inst, err := x86.RCRL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCRL: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRL 1 r32 -// RCRL imm8 r32 -// RCRL cl r32 -// RCRL 1 m32 -// RCRL imm8 m32 -// RCRL cl m32 -// Construct and append a RCRL instruction to the active function. -// Operates on the global context. -func RCRL(ci, mr operand.Op) { ctx.RCRL(ci, mr) } - -// RCRQ: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRQ 1 r64 -// RCRQ imm8 r64 -// RCRQ cl r64 -// RCRQ 1 m64 -// RCRQ imm8 m64 -// RCRQ cl m64 -// Construct and append a RCRQ instruction to the active function. -func (c *Context) RCRQ(ci, mr operand.Op) { - if inst, err := x86.RCRQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCRQ: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRQ 1 r64 -// RCRQ imm8 r64 -// RCRQ cl r64 -// RCRQ 1 m64 -// RCRQ imm8 m64 -// RCRQ cl m64 -// Construct and append a RCRQ instruction to the active function. -// Operates on the global context. -func RCRQ(ci, mr operand.Op) { ctx.RCRQ(ci, mr) } - -// RCRW: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRW 1 r16 -// RCRW imm8 r16 -// RCRW cl r16 -// RCRW 1 m16 -// RCRW imm8 m16 -// RCRW cl m16 -// Construct and append a RCRW instruction to the active function. -func (c *Context) RCRW(ci, mr operand.Op) { - if inst, err := x86.RCRW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RCRW: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRW 1 r16 -// RCRW imm8 r16 -// RCRW cl r16 -// RCRW 1 m16 -// RCRW imm8 m16 -// RCRW cl m16 -// Construct and append a RCRW instruction to the active function. -// Operates on the global context. -func RCRW(ci, mr operand.Op) { ctx.RCRW(ci, mr) } - -// RDRANDL: Read Random Number. -// -// Forms: -// -// RDRANDL r32 -// Construct and append a RDRANDL instruction to the active function. -func (c *Context) RDRANDL(r operand.Op) { - if inst, err := x86.RDRANDL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDRANDL: Read Random Number. -// -// Forms: -// -// RDRANDL r32 -// Construct and append a RDRANDL instruction to the active function. -// Operates on the global context. -func RDRANDL(r operand.Op) { ctx.RDRANDL(r) } - -// RDRANDQ: Read Random Number. -// -// Forms: -// -// RDRANDQ r64 -// Construct and append a RDRANDQ instruction to the active function. -func (c *Context) RDRANDQ(r operand.Op) { - if inst, err := x86.RDRANDQ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDRANDQ: Read Random Number. -// -// Forms: -// -// RDRANDQ r64 -// Construct and append a RDRANDQ instruction to the active function. -// Operates on the global context. -func RDRANDQ(r operand.Op) { ctx.RDRANDQ(r) } - -// RDRANDW: Read Random Number. -// -// Forms: -// -// RDRANDW r16 -// Construct and append a RDRANDW instruction to the active function. -func (c *Context) RDRANDW(r operand.Op) { - if inst, err := x86.RDRANDW(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDRANDW: Read Random Number. -// -// Forms: -// -// RDRANDW r16 -// Construct and append a RDRANDW instruction to the active function. -// Operates on the global context. -func RDRANDW(r operand.Op) { ctx.RDRANDW(r) } - -// RDSEEDL: Read Random SEED. -// -// Forms: -// -// RDSEEDL r32 -// Construct and append a RDSEEDL instruction to the active function. -func (c *Context) RDSEEDL(r operand.Op) { - if inst, err := x86.RDSEEDL(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDSEEDL: Read Random SEED. -// -// Forms: -// -// RDSEEDL r32 -// Construct and append a RDSEEDL instruction to the active function. -// Operates on the global context. -func RDSEEDL(r operand.Op) { ctx.RDSEEDL(r) } - -// RDSEEDQ: Read Random SEED. -// -// Forms: -// -// RDSEEDQ r64 -// Construct and append a RDSEEDQ instruction to the active function. -func (c *Context) RDSEEDQ(r operand.Op) { - if inst, err := x86.RDSEEDQ(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDSEEDQ: Read Random SEED. -// -// Forms: -// -// RDSEEDQ r64 -// Construct and append a RDSEEDQ instruction to the active function. -// Operates on the global context. -func RDSEEDQ(r operand.Op) { ctx.RDSEEDQ(r) } - -// RDSEEDW: Read Random SEED. -// -// Forms: -// -// RDSEEDW r16 -// Construct and append a RDSEEDW instruction to the active function. -func (c *Context) RDSEEDW(r operand.Op) { - if inst, err := x86.RDSEEDW(r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDSEEDW: Read Random SEED. -// -// Forms: -// -// RDSEEDW r16 -// Construct and append a RDSEEDW instruction to the active function. -// Operates on the global context. -func RDSEEDW(r operand.Op) { ctx.RDSEEDW(r) } - -// RDTSC: Read Time-Stamp Counter. -// -// Forms: -// -// RDTSC -// Construct and append a RDTSC instruction to the active function. -func (c *Context) RDTSC() { - if inst, err := x86.RDTSC(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDTSC: Read Time-Stamp Counter. -// -// Forms: -// -// RDTSC -// Construct and append a RDTSC instruction to the active function. -// Operates on the global context. -func RDTSC() { ctx.RDTSC() } - -// RDTSCP: Read Time-Stamp Counter and Processor ID. -// -// Forms: -// -// RDTSCP -// Construct and append a RDTSCP instruction to the active function. -func (c *Context) RDTSCP() { - if inst, err := x86.RDTSCP(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RDTSCP: Read Time-Stamp Counter and Processor ID. -// -// Forms: -// -// RDTSCP -// Construct and append a RDTSCP instruction to the active function. -// Operates on the global context. -func RDTSCP() { ctx.RDTSCP() } - -// RET: Return from Procedure. -// -// Forms: -// -// RET -// Construct and append a RET instruction to the active function. -func (c *Context) RET() { - if inst, err := x86.RET(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RET: Return from Procedure. -// -// Forms: -// -// RET -// Construct and append a RET instruction to the active function. -// Operates on the global context. -func RET() { ctx.RET() } - -// RETFL: Return from Procedure. -// -// Forms: -// -// RETFL imm16 -// Construct and append a RETFL instruction to the active function. -func (c *Context) RETFL(i operand.Op) { - if inst, err := x86.RETFL(i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RETFL: Return from Procedure. -// -// Forms: -// -// RETFL imm16 -// Construct and append a RETFL instruction to the active function. -// Operates on the global context. -func RETFL(i operand.Op) { ctx.RETFL(i) } - -// RETFQ: Return from Procedure. -// -// Forms: -// -// RETFQ imm16 -// Construct and append a RETFQ instruction to the active function. -func (c *Context) RETFQ(i operand.Op) { - if inst, err := x86.RETFQ(i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RETFQ: Return from Procedure. -// -// Forms: -// -// RETFQ imm16 -// Construct and append a RETFQ instruction to the active function. -// Operates on the global context. -func RETFQ(i operand.Op) { ctx.RETFQ(i) } - -// RETFW: Return from Procedure. -// -// Forms: -// -// RETFW imm16 -// Construct and append a RETFW instruction to the active function. -func (c *Context) RETFW(i operand.Op) { - if inst, err := x86.RETFW(i); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RETFW: Return from Procedure. -// -// Forms: -// -// RETFW imm16 -// Construct and append a RETFW instruction to the active function. -// Operates on the global context. -func RETFW(i operand.Op) { ctx.RETFW(i) } - -// ROLB: Rotate Left. -// -// Forms: -// -// ROLB 1 r8 -// ROLB imm8 r8 -// ROLB cl r8 -// ROLB 1 m8 -// ROLB imm8 m8 -// ROLB cl m8 -// Construct and append a ROLB instruction to the active function. -func (c *Context) ROLB(ci, mr operand.Op) { - if inst, err := x86.ROLB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROLB: Rotate Left. -// -// Forms: -// -// ROLB 1 r8 -// ROLB imm8 r8 -// ROLB cl r8 -// ROLB 1 m8 -// ROLB imm8 m8 -// ROLB cl m8 -// Construct and append a ROLB instruction to the active function. -// Operates on the global context. -func ROLB(ci, mr operand.Op) { ctx.ROLB(ci, mr) } - -// ROLL: Rotate Left. -// -// Forms: -// -// ROLL 1 r32 -// ROLL imm8 r32 -// ROLL cl r32 -// ROLL 1 m32 -// ROLL imm8 m32 -// ROLL cl m32 -// Construct and append a ROLL instruction to the active function. -func (c *Context) ROLL(ci, mr operand.Op) { - if inst, err := x86.ROLL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROLL: Rotate Left. -// -// Forms: -// -// ROLL 1 r32 -// ROLL imm8 r32 -// ROLL cl r32 -// ROLL 1 m32 -// ROLL imm8 m32 -// ROLL cl m32 -// Construct and append a ROLL instruction to the active function. -// Operates on the global context. -func ROLL(ci, mr operand.Op) { ctx.ROLL(ci, mr) } - -// ROLQ: Rotate Left. -// -// Forms: -// -// ROLQ 1 r64 -// ROLQ imm8 r64 -// ROLQ cl r64 -// ROLQ 1 m64 -// ROLQ imm8 m64 -// ROLQ cl m64 -// Construct and append a ROLQ instruction to the active function. -func (c *Context) ROLQ(ci, mr operand.Op) { - if inst, err := x86.ROLQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROLQ: Rotate Left. -// -// Forms: -// -// ROLQ 1 r64 -// ROLQ imm8 r64 -// ROLQ cl r64 -// ROLQ 1 m64 -// ROLQ imm8 m64 -// ROLQ cl m64 -// Construct and append a ROLQ instruction to the active function. -// Operates on the global context. -func ROLQ(ci, mr operand.Op) { ctx.ROLQ(ci, mr) } - -// ROLW: Rotate Left. -// -// Forms: -// -// ROLW 1 r16 -// ROLW imm8 r16 -// ROLW cl r16 -// ROLW 1 m16 -// ROLW imm8 m16 -// ROLW cl m16 -// Construct and append a ROLW instruction to the active function. -func (c *Context) ROLW(ci, mr operand.Op) { - if inst, err := x86.ROLW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROLW: Rotate Left. -// -// Forms: -// -// ROLW 1 r16 -// ROLW imm8 r16 -// ROLW cl r16 -// ROLW 1 m16 -// ROLW imm8 m16 -// ROLW cl m16 -// Construct and append a ROLW instruction to the active function. -// Operates on the global context. -func ROLW(ci, mr operand.Op) { ctx.ROLW(ci, mr) } - -// RORB: Rotate Right. -// -// Forms: -// -// RORB 1 r8 -// RORB imm8 r8 -// RORB cl r8 -// RORB 1 m8 -// RORB imm8 m8 -// RORB cl m8 -// Construct and append a RORB instruction to the active function. -func (c *Context) RORB(ci, mr operand.Op) { - if inst, err := x86.RORB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORB: Rotate Right. -// -// Forms: -// -// RORB 1 r8 -// RORB imm8 r8 -// RORB cl r8 -// RORB 1 m8 -// RORB imm8 m8 -// RORB cl m8 -// Construct and append a RORB instruction to the active function. -// Operates on the global context. -func RORB(ci, mr operand.Op) { ctx.RORB(ci, mr) } - -// RORL: Rotate Right. -// -// Forms: -// -// RORL 1 r32 -// RORL imm8 r32 -// RORL cl r32 -// RORL 1 m32 -// RORL imm8 m32 -// RORL cl m32 -// Construct and append a RORL instruction to the active function. -func (c *Context) RORL(ci, mr operand.Op) { - if inst, err := x86.RORL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORL: Rotate Right. -// -// Forms: -// -// RORL 1 r32 -// RORL imm8 r32 -// RORL cl r32 -// RORL 1 m32 -// RORL imm8 m32 -// RORL cl m32 -// Construct and append a RORL instruction to the active function. -// Operates on the global context. -func RORL(ci, mr operand.Op) { ctx.RORL(ci, mr) } - -// RORQ: Rotate Right. -// -// Forms: -// -// RORQ 1 r64 -// RORQ imm8 r64 -// RORQ cl r64 -// RORQ 1 m64 -// RORQ imm8 m64 -// RORQ cl m64 -// Construct and append a RORQ instruction to the active function. -func (c *Context) RORQ(ci, mr operand.Op) { - if inst, err := x86.RORQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORQ: Rotate Right. -// -// Forms: -// -// RORQ 1 r64 -// RORQ imm8 r64 -// RORQ cl r64 -// RORQ 1 m64 -// RORQ imm8 m64 -// RORQ cl m64 -// Construct and append a RORQ instruction to the active function. -// Operates on the global context. -func RORQ(ci, mr operand.Op) { ctx.RORQ(ci, mr) } - -// RORW: Rotate Right. -// -// Forms: -// -// RORW 1 r16 -// RORW imm8 r16 -// RORW cl r16 -// RORW 1 m16 -// RORW imm8 m16 -// RORW cl m16 -// Construct and append a RORW instruction to the active function. -func (c *Context) RORW(ci, mr operand.Op) { - if inst, err := x86.RORW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORW: Rotate Right. -// -// Forms: -// -// RORW 1 r16 -// RORW imm8 r16 -// RORW cl r16 -// RORW 1 m16 -// RORW imm8 m16 -// RORW cl m16 -// Construct and append a RORW instruction to the active function. -// Operates on the global context. -func RORW(ci, mr operand.Op) { ctx.RORW(ci, mr) } - -// RORXL: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXL imm8 r32 r32 -// RORXL imm8 m32 r32 -// Construct and append a RORXL instruction to the active function. -func (c *Context) RORXL(i, mr, r operand.Op) { - if inst, err := x86.RORXL(i, mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORXL: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXL imm8 r32 r32 -// RORXL imm8 m32 r32 -// Construct and append a RORXL instruction to the active function. -// Operates on the global context. -func RORXL(i, mr, r operand.Op) { ctx.RORXL(i, mr, r) } - -// RORXQ: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXQ imm8 r64 r64 -// RORXQ imm8 m64 r64 -// Construct and append a RORXQ instruction to the active function. -func (c *Context) RORXQ(i, mr, r operand.Op) { - if inst, err := x86.RORXQ(i, mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RORXQ: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXQ imm8 r64 r64 -// RORXQ imm8 m64 r64 -// Construct and append a RORXQ instruction to the active function. -// Operates on the global context. -func RORXQ(i, mr, r operand.Op) { ctx.RORXQ(i, mr, r) } - -// ROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPD imm8 xmm xmm -// ROUNDPD imm8 m128 xmm -// Construct and append a ROUNDPD instruction to the active function. -func (c *Context) ROUNDPD(i, mx, x operand.Op) { - if inst, err := x86.ROUNDPD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPD imm8 xmm xmm -// ROUNDPD imm8 m128 xmm -// Construct and append a ROUNDPD instruction to the active function. -// Operates on the global context. -func ROUNDPD(i, mx, x operand.Op) { ctx.ROUNDPD(i, mx, x) } - -// ROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPS imm8 xmm xmm -// ROUNDPS imm8 m128 xmm -// Construct and append a ROUNDPS instruction to the active function. -func (c *Context) ROUNDPS(i, mx, x operand.Op) { - if inst, err := x86.ROUNDPS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPS imm8 xmm xmm -// ROUNDPS imm8 m128 xmm -// Construct and append a ROUNDPS instruction to the active function. -// Operates on the global context. -func ROUNDPS(i, mx, x operand.Op) { ctx.ROUNDPS(i, mx, x) } - -// ROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSD imm8 xmm xmm -// ROUNDSD imm8 m64 xmm -// Construct and append a ROUNDSD instruction to the active function. -func (c *Context) ROUNDSD(i, mx, x operand.Op) { - if inst, err := x86.ROUNDSD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSD imm8 xmm xmm -// ROUNDSD imm8 m64 xmm -// Construct and append a ROUNDSD instruction to the active function. -// Operates on the global context. -func ROUNDSD(i, mx, x operand.Op) { ctx.ROUNDSD(i, mx, x) } - -// ROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSS imm8 xmm xmm -// ROUNDSS imm8 m32 xmm -// Construct and append a ROUNDSS instruction to the active function. -func (c *Context) ROUNDSS(i, mx, x operand.Op) { - if inst, err := x86.ROUNDSS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// ROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSS imm8 xmm xmm -// ROUNDSS imm8 m32 xmm -// Construct and append a ROUNDSS instruction to the active function. -// Operates on the global context. -func ROUNDSS(i, mx, x operand.Op) { ctx.ROUNDSS(i, mx, x) } - -// RSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RSQRTPS xmm xmm -// RSQRTPS m128 xmm -// Construct and append a RSQRTPS instruction to the active function. -func (c *Context) RSQRTPS(mx, x operand.Op) { - if inst, err := x86.RSQRTPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RSQRTPS xmm xmm -// RSQRTPS m128 xmm -// Construct and append a RSQRTPS instruction to the active function. -// Operates on the global context. -func RSQRTPS(mx, x operand.Op) { ctx.RSQRTPS(mx, x) } - -// RSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// RSQRTSS xmm xmm -// RSQRTSS m32 xmm -// Construct and append a RSQRTSS instruction to the active function. -func (c *Context) RSQRTSS(mx, x operand.Op) { - if inst, err := x86.RSQRTSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// RSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// RSQRTSS xmm xmm -// RSQRTSS m32 xmm -// Construct and append a RSQRTSS instruction to the active function. -// Operates on the global context. -func RSQRTSS(mx, x operand.Op) { ctx.RSQRTSS(mx, x) } - -// SALB: Arithmetic Shift Left. -// -// Forms: -// -// SALB 1 r8 -// SALB imm8 r8 -// SALB cl r8 -// SALB 1 m8 -// SALB imm8 m8 -// SALB cl m8 -// Construct and append a SALB instruction to the active function. -func (c *Context) SALB(ci, mr operand.Op) { - if inst, err := x86.SALB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SALB: Arithmetic Shift Left. -// -// Forms: -// -// SALB 1 r8 -// SALB imm8 r8 -// SALB cl r8 -// SALB 1 m8 -// SALB imm8 m8 -// SALB cl m8 -// Construct and append a SALB instruction to the active function. -// Operates on the global context. -func SALB(ci, mr operand.Op) { ctx.SALB(ci, mr) } - -// SALL: Arithmetic Shift Left. -// -// Forms: -// -// SALL 1 r32 -// SALL imm8 r32 -// SALL cl r32 -// SALL 1 m32 -// SALL imm8 m32 -// SALL cl m32 -// Construct and append a SALL instruction to the active function. -func (c *Context) SALL(ci, mr operand.Op) { - if inst, err := x86.SALL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SALL: Arithmetic Shift Left. -// -// Forms: -// -// SALL 1 r32 -// SALL imm8 r32 -// SALL cl r32 -// SALL 1 m32 -// SALL imm8 m32 -// SALL cl m32 -// Construct and append a SALL instruction to the active function. -// Operates on the global context. -func SALL(ci, mr operand.Op) { ctx.SALL(ci, mr) } - -// SALQ: Arithmetic Shift Left. -// -// Forms: -// -// SALQ 1 r64 -// SALQ imm8 r64 -// SALQ cl r64 -// SALQ 1 m64 -// SALQ imm8 m64 -// SALQ cl m64 -// Construct and append a SALQ instruction to the active function. -func (c *Context) SALQ(ci, mr operand.Op) { - if inst, err := x86.SALQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SALQ: Arithmetic Shift Left. -// -// Forms: -// -// SALQ 1 r64 -// SALQ imm8 r64 -// SALQ cl r64 -// SALQ 1 m64 -// SALQ imm8 m64 -// SALQ cl m64 -// Construct and append a SALQ instruction to the active function. -// Operates on the global context. -func SALQ(ci, mr operand.Op) { ctx.SALQ(ci, mr) } - -// SALW: Arithmetic Shift Left. -// -// Forms: -// -// SALW 1 r16 -// SALW imm8 r16 -// SALW cl r16 -// SALW 1 m16 -// SALW imm8 m16 -// SALW cl m16 -// Construct and append a SALW instruction to the active function. -func (c *Context) SALW(ci, mr operand.Op) { - if inst, err := x86.SALW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SALW: Arithmetic Shift Left. -// -// Forms: -// -// SALW 1 r16 -// SALW imm8 r16 -// SALW cl r16 -// SALW 1 m16 -// SALW imm8 m16 -// SALW cl m16 -// Construct and append a SALW instruction to the active function. -// Operates on the global context. -func SALW(ci, mr operand.Op) { ctx.SALW(ci, mr) } - -// SARB: Arithmetic Shift Right. -// -// Forms: -// -// SARB 1 r8 -// SARB imm8 r8 -// SARB cl r8 -// SARB 1 m8 -// SARB imm8 m8 -// SARB cl m8 -// Construct and append a SARB instruction to the active function. -func (c *Context) SARB(ci, mr operand.Op) { - if inst, err := x86.SARB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARB: Arithmetic Shift Right. -// -// Forms: -// -// SARB 1 r8 -// SARB imm8 r8 -// SARB cl r8 -// SARB 1 m8 -// SARB imm8 m8 -// SARB cl m8 -// Construct and append a SARB instruction to the active function. -// Operates on the global context. -func SARB(ci, mr operand.Op) { ctx.SARB(ci, mr) } - -// SARL: Arithmetic Shift Right. -// -// Forms: -// -// SARL 1 r32 -// SARL imm8 r32 -// SARL cl r32 -// SARL 1 m32 -// SARL imm8 m32 -// SARL cl m32 -// Construct and append a SARL instruction to the active function. -func (c *Context) SARL(ci, mr operand.Op) { - if inst, err := x86.SARL(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARL: Arithmetic Shift Right. -// -// Forms: -// -// SARL 1 r32 -// SARL imm8 r32 -// SARL cl r32 -// SARL 1 m32 -// SARL imm8 m32 -// SARL cl m32 -// Construct and append a SARL instruction to the active function. -// Operates on the global context. -func SARL(ci, mr operand.Op) { ctx.SARL(ci, mr) } - -// SARQ: Arithmetic Shift Right. -// -// Forms: -// -// SARQ 1 r64 -// SARQ imm8 r64 -// SARQ cl r64 -// SARQ 1 m64 -// SARQ imm8 m64 -// SARQ cl m64 -// Construct and append a SARQ instruction to the active function. -func (c *Context) SARQ(ci, mr operand.Op) { - if inst, err := x86.SARQ(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARQ: Arithmetic Shift Right. -// -// Forms: -// -// SARQ 1 r64 -// SARQ imm8 r64 -// SARQ cl r64 -// SARQ 1 m64 -// SARQ imm8 m64 -// SARQ cl m64 -// Construct and append a SARQ instruction to the active function. -// Operates on the global context. -func SARQ(ci, mr operand.Op) { ctx.SARQ(ci, mr) } - -// SARW: Arithmetic Shift Right. -// -// Forms: -// -// SARW 1 r16 -// SARW imm8 r16 -// SARW cl r16 -// SARW 1 m16 -// SARW imm8 m16 -// SARW cl m16 -// Construct and append a SARW instruction to the active function. -func (c *Context) SARW(ci, mr operand.Op) { - if inst, err := x86.SARW(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARW: Arithmetic Shift Right. -// -// Forms: -// -// SARW 1 r16 -// SARW imm8 r16 -// SARW cl r16 -// SARW 1 m16 -// SARW imm8 m16 -// SARW cl m16 -// Construct and append a SARW instruction to the active function. -// Operates on the global context. -func SARW(ci, mr operand.Op) { ctx.SARW(ci, mr) } - -// SARXL: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXL r32 r32 r32 -// SARXL r32 m32 r32 -// Construct and append a SARXL instruction to the active function. -func (c *Context) SARXL(r, mr, r1 operand.Op) { - if inst, err := x86.SARXL(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARXL: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXL r32 r32 r32 -// SARXL r32 m32 r32 -// Construct and append a SARXL instruction to the active function. -// Operates on the global context. -func SARXL(r, mr, r1 operand.Op) { ctx.SARXL(r, mr, r1) } - -// SARXQ: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXQ r64 r64 r64 -// SARXQ r64 m64 r64 -// Construct and append a SARXQ instruction to the active function. -func (c *Context) SARXQ(r, mr, r1 operand.Op) { - if inst, err := x86.SARXQ(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SARXQ: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXQ r64 r64 r64 -// SARXQ r64 m64 r64 -// Construct and append a SARXQ instruction to the active function. -// Operates on the global context. -func SARXQ(r, mr, r1 operand.Op) { ctx.SARXQ(r, mr, r1) } - -// SBBB: Subtract with Borrow. -// -// Forms: -// -// SBBB imm8 al -// SBBB imm8 r8 -// SBBB r8 r8 -// SBBB m8 r8 -// SBBB imm8 m8 -// SBBB r8 m8 -// Construct and append a SBBB instruction to the active function. -func (c *Context) SBBB(imr, amr operand.Op) { - if inst, err := x86.SBBB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SBBB: Subtract with Borrow. -// -// Forms: -// -// SBBB imm8 al -// SBBB imm8 r8 -// SBBB r8 r8 -// SBBB m8 r8 -// SBBB imm8 m8 -// SBBB r8 m8 -// Construct and append a SBBB instruction to the active function. -// Operates on the global context. -func SBBB(imr, amr operand.Op) { ctx.SBBB(imr, amr) } - -// SBBL: Subtract with Borrow. -// -// Forms: -// -// SBBL imm32 eax -// SBBL imm8 r32 -// SBBL imm32 r32 -// SBBL r32 r32 -// SBBL m32 r32 -// SBBL imm8 m32 -// SBBL imm32 m32 -// SBBL r32 m32 -// Construct and append a SBBL instruction to the active function. -func (c *Context) SBBL(imr, emr operand.Op) { - if inst, err := x86.SBBL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SBBL: Subtract with Borrow. -// -// Forms: -// -// SBBL imm32 eax -// SBBL imm8 r32 -// SBBL imm32 r32 -// SBBL r32 r32 -// SBBL m32 r32 -// SBBL imm8 m32 -// SBBL imm32 m32 -// SBBL r32 m32 -// Construct and append a SBBL instruction to the active function. -// Operates on the global context. -func SBBL(imr, emr operand.Op) { ctx.SBBL(imr, emr) } - -// SBBQ: Subtract with Borrow. -// -// Forms: -// -// SBBQ imm32 rax -// SBBQ imm8 r64 -// SBBQ imm32 r64 -// SBBQ r64 r64 -// SBBQ m64 r64 -// SBBQ imm8 m64 -// SBBQ imm32 m64 -// SBBQ r64 m64 -// Construct and append a SBBQ instruction to the active function. -func (c *Context) SBBQ(imr, mr operand.Op) { - if inst, err := x86.SBBQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SBBQ: Subtract with Borrow. -// -// Forms: -// -// SBBQ imm32 rax -// SBBQ imm8 r64 -// SBBQ imm32 r64 -// SBBQ r64 r64 -// SBBQ m64 r64 -// SBBQ imm8 m64 -// SBBQ imm32 m64 -// SBBQ r64 m64 -// Construct and append a SBBQ instruction to the active function. -// Operates on the global context. -func SBBQ(imr, mr operand.Op) { ctx.SBBQ(imr, mr) } - -// SBBW: Subtract with Borrow. -// -// Forms: -// -// SBBW imm16 ax -// SBBW imm8 r16 -// SBBW imm16 r16 -// SBBW r16 r16 -// SBBW m16 r16 -// SBBW imm8 m16 -// SBBW imm16 m16 -// SBBW r16 m16 -// Construct and append a SBBW instruction to the active function. -func (c *Context) SBBW(imr, amr operand.Op) { - if inst, err := x86.SBBW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SBBW: Subtract with Borrow. -// -// Forms: -// -// SBBW imm16 ax -// SBBW imm8 r16 -// SBBW imm16 r16 -// SBBW r16 r16 -// SBBW m16 r16 -// SBBW imm8 m16 -// SBBW imm16 m16 -// SBBW r16 m16 -// Construct and append a SBBW instruction to the active function. -// Operates on the global context. -func SBBW(imr, amr operand.Op) { ctx.SBBW(imr, amr) } - -// SETCC: Set byte if above or equal (CF == 0). -// -// Forms: -// -// SETCC r8 -// SETCC m8 -// Construct and append a SETCC instruction to the active function. -func (c *Context) SETCC(mr operand.Op) { - if inst, err := x86.SETCC(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETCC: Set byte if above or equal (CF == 0). -// -// Forms: -// -// SETCC r8 -// SETCC m8 -// Construct and append a SETCC instruction to the active function. -// Operates on the global context. -func SETCC(mr operand.Op) { ctx.SETCC(mr) } - -// SETCS: Set byte if below (CF == 1). -// -// Forms: -// -// SETCS r8 -// SETCS m8 -// Construct and append a SETCS instruction to the active function. -func (c *Context) SETCS(mr operand.Op) { - if inst, err := x86.SETCS(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETCS: Set byte if below (CF == 1). -// -// Forms: -// -// SETCS r8 -// SETCS m8 -// Construct and append a SETCS instruction to the active function. -// Operates on the global context. -func SETCS(mr operand.Op) { ctx.SETCS(mr) } - -// SETEQ: Set byte if equal (ZF == 1). -// -// Forms: -// -// SETEQ r8 -// SETEQ m8 -// Construct and append a SETEQ instruction to the active function. -func (c *Context) SETEQ(mr operand.Op) { - if inst, err := x86.SETEQ(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETEQ: Set byte if equal (ZF == 1). -// -// Forms: -// -// SETEQ r8 -// SETEQ m8 -// Construct and append a SETEQ instruction to the active function. -// Operates on the global context. -func SETEQ(mr operand.Op) { ctx.SETEQ(mr) } - -// SETGE: Set byte if greater or equal (SF == OF). -// -// Forms: -// -// SETGE r8 -// SETGE m8 -// Construct and append a SETGE instruction to the active function. -func (c *Context) SETGE(mr operand.Op) { - if inst, err := x86.SETGE(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETGE: Set byte if greater or equal (SF == OF). -// -// Forms: -// -// SETGE r8 -// SETGE m8 -// Construct and append a SETGE instruction to the active function. -// Operates on the global context. -func SETGE(mr operand.Op) { ctx.SETGE(mr) } - -// SETGT: Set byte if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// SETGT r8 -// SETGT m8 -// Construct and append a SETGT instruction to the active function. -func (c *Context) SETGT(mr operand.Op) { - if inst, err := x86.SETGT(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETGT: Set byte if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// SETGT r8 -// SETGT m8 -// Construct and append a SETGT instruction to the active function. -// Operates on the global context. -func SETGT(mr operand.Op) { ctx.SETGT(mr) } - -// SETHI: Set byte if above (CF == 0 and ZF == 0). -// -// Forms: -// -// SETHI r8 -// SETHI m8 -// Construct and append a SETHI instruction to the active function. -func (c *Context) SETHI(mr operand.Op) { - if inst, err := x86.SETHI(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETHI: Set byte if above (CF == 0 and ZF == 0). -// -// Forms: -// -// SETHI r8 -// SETHI m8 -// Construct and append a SETHI instruction to the active function. -// Operates on the global context. -func SETHI(mr operand.Op) { ctx.SETHI(mr) } - -// SETLE: Set byte if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// SETLE r8 -// SETLE m8 -// Construct and append a SETLE instruction to the active function. -func (c *Context) SETLE(mr operand.Op) { - if inst, err := x86.SETLE(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETLE: Set byte if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// SETLE r8 -// SETLE m8 -// Construct and append a SETLE instruction to the active function. -// Operates on the global context. -func SETLE(mr operand.Op) { ctx.SETLE(mr) } - -// SETLS: Set byte if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// SETLS r8 -// SETLS m8 -// Construct and append a SETLS instruction to the active function. -func (c *Context) SETLS(mr operand.Op) { - if inst, err := x86.SETLS(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETLS: Set byte if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// SETLS r8 -// SETLS m8 -// Construct and append a SETLS instruction to the active function. -// Operates on the global context. -func SETLS(mr operand.Op) { ctx.SETLS(mr) } - -// SETLT: Set byte if less (SF != OF). -// -// Forms: -// -// SETLT r8 -// SETLT m8 -// Construct and append a SETLT instruction to the active function. -func (c *Context) SETLT(mr operand.Op) { - if inst, err := x86.SETLT(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETLT: Set byte if less (SF != OF). -// -// Forms: -// -// SETLT r8 -// SETLT m8 -// Construct and append a SETLT instruction to the active function. -// Operates on the global context. -func SETLT(mr operand.Op) { ctx.SETLT(mr) } - -// SETMI: Set byte if sign (SF == 1). -// -// Forms: -// -// SETMI r8 -// SETMI m8 -// Construct and append a SETMI instruction to the active function. -func (c *Context) SETMI(mr operand.Op) { - if inst, err := x86.SETMI(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETMI: Set byte if sign (SF == 1). -// -// Forms: -// -// SETMI r8 -// SETMI m8 -// Construct and append a SETMI instruction to the active function. -// Operates on the global context. -func SETMI(mr operand.Op) { ctx.SETMI(mr) } - -// SETNE: Set byte if not equal (ZF == 0). -// -// Forms: -// -// SETNE r8 -// SETNE m8 -// Construct and append a SETNE instruction to the active function. -func (c *Context) SETNE(mr operand.Op) { - if inst, err := x86.SETNE(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETNE: Set byte if not equal (ZF == 0). -// -// Forms: -// -// SETNE r8 -// SETNE m8 -// Construct and append a SETNE instruction to the active function. -// Operates on the global context. -func SETNE(mr operand.Op) { ctx.SETNE(mr) } - -// SETOC: Set byte if not overflow (OF == 0). -// -// Forms: -// -// SETOC r8 -// SETOC m8 -// Construct and append a SETOC instruction to the active function. -func (c *Context) SETOC(mr operand.Op) { - if inst, err := x86.SETOC(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETOC: Set byte if not overflow (OF == 0). -// -// Forms: -// -// SETOC r8 -// SETOC m8 -// Construct and append a SETOC instruction to the active function. -// Operates on the global context. -func SETOC(mr operand.Op) { ctx.SETOC(mr) } - -// SETOS: Set byte if overflow (OF == 1). -// -// Forms: -// -// SETOS r8 -// SETOS m8 -// Construct and append a SETOS instruction to the active function. -func (c *Context) SETOS(mr operand.Op) { - if inst, err := x86.SETOS(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETOS: Set byte if overflow (OF == 1). -// -// Forms: -// -// SETOS r8 -// SETOS m8 -// Construct and append a SETOS instruction to the active function. -// Operates on the global context. -func SETOS(mr operand.Op) { ctx.SETOS(mr) } - -// SETPC: Set byte if not parity (PF == 0). -// -// Forms: -// -// SETPC r8 -// SETPC m8 -// Construct and append a SETPC instruction to the active function. -func (c *Context) SETPC(mr operand.Op) { - if inst, err := x86.SETPC(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETPC: Set byte if not parity (PF == 0). -// -// Forms: -// -// SETPC r8 -// SETPC m8 -// Construct and append a SETPC instruction to the active function. -// Operates on the global context. -func SETPC(mr operand.Op) { ctx.SETPC(mr) } - -// SETPL: Set byte if not sign (SF == 0). -// -// Forms: -// -// SETPL r8 -// SETPL m8 -// Construct and append a SETPL instruction to the active function. -func (c *Context) SETPL(mr operand.Op) { - if inst, err := x86.SETPL(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETPL: Set byte if not sign (SF == 0). -// -// Forms: -// -// SETPL r8 -// SETPL m8 -// Construct and append a SETPL instruction to the active function. -// Operates on the global context. -func SETPL(mr operand.Op) { ctx.SETPL(mr) } - -// SETPS: Set byte if parity (PF == 1). -// -// Forms: -// -// SETPS r8 -// SETPS m8 -// Construct and append a SETPS instruction to the active function. -func (c *Context) SETPS(mr operand.Op) { - if inst, err := x86.SETPS(mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SETPS: Set byte if parity (PF == 1). -// -// Forms: -// -// SETPS r8 -// SETPS m8 -// Construct and append a SETPS instruction to the active function. -// Operates on the global context. -func SETPS(mr operand.Op) { ctx.SETPS(mr) } - -// SFENCE: Store Fence. -// -// Forms: -// -// SFENCE -// Construct and append a SFENCE instruction to the active function. -func (c *Context) SFENCE() { - if inst, err := x86.SFENCE(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SFENCE: Store Fence. -// -// Forms: -// -// SFENCE -// Construct and append a SFENCE instruction to the active function. -// Operates on the global context. -func SFENCE() { ctx.SFENCE() } - -// SHA1MSG1: Perform an Intermediate Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG1 xmm xmm -// SHA1MSG1 m128 xmm -// Construct and append a SHA1MSG1 instruction to the active function. -func (c *Context) SHA1MSG1(mx, x operand.Op) { - if inst, err := x86.SHA1MSG1(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA1MSG1: Perform an Intermediate Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG1 xmm xmm -// SHA1MSG1 m128 xmm -// Construct and append a SHA1MSG1 instruction to the active function. -// Operates on the global context. -func SHA1MSG1(mx, x operand.Op) { ctx.SHA1MSG1(mx, x) } - -// SHA1MSG2: Perform a Final Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG2 xmm xmm -// SHA1MSG2 m128 xmm -// Construct and append a SHA1MSG2 instruction to the active function. -func (c *Context) SHA1MSG2(mx, x operand.Op) { - if inst, err := x86.SHA1MSG2(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA1MSG2: Perform a Final Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG2 xmm xmm -// SHA1MSG2 m128 xmm -// Construct and append a SHA1MSG2 instruction to the active function. -// Operates on the global context. -func SHA1MSG2(mx, x operand.Op) { ctx.SHA1MSG2(mx, x) } - -// SHA1NEXTE: Calculate SHA1 State Variable E after Four Rounds. -// -// Forms: -// -// SHA1NEXTE xmm xmm -// SHA1NEXTE m128 xmm -// Construct and append a SHA1NEXTE instruction to the active function. -func (c *Context) SHA1NEXTE(mx, x operand.Op) { - if inst, err := x86.SHA1NEXTE(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA1NEXTE: Calculate SHA1 State Variable E after Four Rounds. -// -// Forms: -// -// SHA1NEXTE xmm xmm -// SHA1NEXTE m128 xmm -// Construct and append a SHA1NEXTE instruction to the active function. -// Operates on the global context. -func SHA1NEXTE(mx, x operand.Op) { ctx.SHA1NEXTE(mx, x) } - -// SHA1RNDS4: Perform Four Rounds of SHA1 Operation. -// -// Forms: -// -// SHA1RNDS4 imm2u xmm xmm -// SHA1RNDS4 imm2u m128 xmm -// Construct and append a SHA1RNDS4 instruction to the active function. -func (c *Context) SHA1RNDS4(i, mx, x operand.Op) { - if inst, err := x86.SHA1RNDS4(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA1RNDS4: Perform Four Rounds of SHA1 Operation. -// -// Forms: -// -// SHA1RNDS4 imm2u xmm xmm -// SHA1RNDS4 imm2u m128 xmm -// Construct and append a SHA1RNDS4 instruction to the active function. -// Operates on the global context. -func SHA1RNDS4(i, mx, x operand.Op) { ctx.SHA1RNDS4(i, mx, x) } - -// SHA256MSG1: Perform an Intermediate Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG1 xmm xmm -// SHA256MSG1 m128 xmm -// Construct and append a SHA256MSG1 instruction to the active function. -func (c *Context) SHA256MSG1(mx, x operand.Op) { - if inst, err := x86.SHA256MSG1(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA256MSG1: Perform an Intermediate Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG1 xmm xmm -// SHA256MSG1 m128 xmm -// Construct and append a SHA256MSG1 instruction to the active function. -// Operates on the global context. -func SHA256MSG1(mx, x operand.Op) { ctx.SHA256MSG1(mx, x) } - -// SHA256MSG2: Perform a Final Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG2 xmm xmm -// SHA256MSG2 m128 xmm -// Construct and append a SHA256MSG2 instruction to the active function. -func (c *Context) SHA256MSG2(mx, x operand.Op) { - if inst, err := x86.SHA256MSG2(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA256MSG2: Perform a Final Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG2 xmm xmm -// SHA256MSG2 m128 xmm -// Construct and append a SHA256MSG2 instruction to the active function. -// Operates on the global context. -func SHA256MSG2(mx, x operand.Op) { ctx.SHA256MSG2(mx, x) } - -// SHA256RNDS2: Perform Two Rounds of SHA256 Operation. -// -// Forms: -// -// SHA256RNDS2 xmm0 xmm xmm -// SHA256RNDS2 xmm0 m128 xmm -// Construct and append a SHA256RNDS2 instruction to the active function. -func (c *Context) SHA256RNDS2(x, mx, x1 operand.Op) { - if inst, err := x86.SHA256RNDS2(x, mx, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHA256RNDS2: Perform Two Rounds of SHA256 Operation. -// -// Forms: -// -// SHA256RNDS2 xmm0 xmm xmm -// SHA256RNDS2 xmm0 m128 xmm -// Construct and append a SHA256RNDS2 instruction to the active function. -// Operates on the global context. -func SHA256RNDS2(x, mx, x1 operand.Op) { ctx.SHA256RNDS2(x, mx, x1) } - -// SHLB: Logical Shift Left. -// -// Forms: -// -// SHLB 1 r8 -// SHLB imm8 r8 -// SHLB cl r8 -// SHLB 1 m8 -// SHLB imm8 m8 -// SHLB cl m8 -// Construct and append a SHLB instruction to the active function. -func (c *Context) SHLB(ci, mr operand.Op) { - if inst, err := x86.SHLB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLB: Logical Shift Left. -// -// Forms: -// -// SHLB 1 r8 -// SHLB imm8 r8 -// SHLB cl r8 -// SHLB 1 m8 -// SHLB imm8 m8 -// SHLB cl m8 -// Construct and append a SHLB instruction to the active function. -// Operates on the global context. -func SHLB(ci, mr operand.Op) { ctx.SHLB(ci, mr) } - -// SHLL: Logical Shift Left. -// -// Forms: -// -// SHLL 1 r32 -// SHLL imm8 r32 -// SHLL cl r32 -// SHLL 1 m32 -// SHLL imm8 m32 -// SHLL cl m32 -// SHLL imm8 r32 r32 -// SHLL cl r32 r32 -// SHLL imm8 r32 m32 -// SHLL cl r32 m32 -// Construct and append a SHLL instruction to the active function. -func (c *Context) SHLL(ops ...operand.Op) { - if inst, err := x86.SHLL(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLL: Logical Shift Left. -// -// Forms: -// -// SHLL 1 r32 -// SHLL imm8 r32 -// SHLL cl r32 -// SHLL 1 m32 -// SHLL imm8 m32 -// SHLL cl m32 -// SHLL imm8 r32 r32 -// SHLL cl r32 r32 -// SHLL imm8 r32 m32 -// SHLL cl r32 m32 -// Construct and append a SHLL instruction to the active function. -// Operates on the global context. -func SHLL(ops ...operand.Op) { ctx.SHLL(ops...) } - -// SHLQ: Logical Shift Left. -// -// Forms: -// -// SHLQ 1 r64 -// SHLQ imm8 r64 -// SHLQ cl r64 -// SHLQ 1 m64 -// SHLQ imm8 m64 -// SHLQ cl m64 -// SHLQ imm8 r64 r64 -// SHLQ cl r64 r64 -// SHLQ imm8 r64 m64 -// SHLQ cl r64 m64 -// Construct and append a SHLQ instruction to the active function. -func (c *Context) SHLQ(ops ...operand.Op) { - if inst, err := x86.SHLQ(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLQ: Logical Shift Left. -// -// Forms: -// -// SHLQ 1 r64 -// SHLQ imm8 r64 -// SHLQ cl r64 -// SHLQ 1 m64 -// SHLQ imm8 m64 -// SHLQ cl m64 -// SHLQ imm8 r64 r64 -// SHLQ cl r64 r64 -// SHLQ imm8 r64 m64 -// SHLQ cl r64 m64 -// Construct and append a SHLQ instruction to the active function. -// Operates on the global context. -func SHLQ(ops ...operand.Op) { ctx.SHLQ(ops...) } - -// SHLW: Logical Shift Left. -// -// Forms: -// -// SHLW 1 r16 -// SHLW imm8 r16 -// SHLW cl r16 -// SHLW 1 m16 -// SHLW imm8 m16 -// SHLW cl m16 -// SHLW imm8 r16 r16 -// SHLW cl r16 r16 -// SHLW imm8 r16 m16 -// SHLW cl r16 m16 -// Construct and append a SHLW instruction to the active function. -func (c *Context) SHLW(ops ...operand.Op) { - if inst, err := x86.SHLW(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLW: Logical Shift Left. -// -// Forms: -// -// SHLW 1 r16 -// SHLW imm8 r16 -// SHLW cl r16 -// SHLW 1 m16 -// SHLW imm8 m16 -// SHLW cl m16 -// SHLW imm8 r16 r16 -// SHLW cl r16 r16 -// SHLW imm8 r16 m16 -// SHLW cl r16 m16 -// Construct and append a SHLW instruction to the active function. -// Operates on the global context. -func SHLW(ops ...operand.Op) { ctx.SHLW(ops...) } - -// SHLXL: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXL r32 r32 r32 -// SHLXL r32 m32 r32 -// Construct and append a SHLXL instruction to the active function. -func (c *Context) SHLXL(r, mr, r1 operand.Op) { - if inst, err := x86.SHLXL(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLXL: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXL r32 r32 r32 -// SHLXL r32 m32 r32 -// Construct and append a SHLXL instruction to the active function. -// Operates on the global context. -func SHLXL(r, mr, r1 operand.Op) { ctx.SHLXL(r, mr, r1) } - -// SHLXQ: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXQ r64 r64 r64 -// SHLXQ r64 m64 r64 -// Construct and append a SHLXQ instruction to the active function. -func (c *Context) SHLXQ(r, mr, r1 operand.Op) { - if inst, err := x86.SHLXQ(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHLXQ: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXQ r64 r64 r64 -// SHLXQ r64 m64 r64 -// Construct and append a SHLXQ instruction to the active function. -// Operates on the global context. -func SHLXQ(r, mr, r1 operand.Op) { ctx.SHLXQ(r, mr, r1) } - -// SHRB: Logical Shift Right. -// -// Forms: -// -// SHRB 1 r8 -// SHRB imm8 r8 -// SHRB cl r8 -// SHRB 1 m8 -// SHRB imm8 m8 -// SHRB cl m8 -// Construct and append a SHRB instruction to the active function. -func (c *Context) SHRB(ci, mr operand.Op) { - if inst, err := x86.SHRB(ci, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRB: Logical Shift Right. -// -// Forms: -// -// SHRB 1 r8 -// SHRB imm8 r8 -// SHRB cl r8 -// SHRB 1 m8 -// SHRB imm8 m8 -// SHRB cl m8 -// Construct and append a SHRB instruction to the active function. -// Operates on the global context. -func SHRB(ci, mr operand.Op) { ctx.SHRB(ci, mr) } - -// SHRL: Logical Shift Right. -// -// Forms: -// -// SHRL 1 r32 -// SHRL imm8 r32 -// SHRL cl r32 -// SHRL 1 m32 -// SHRL imm8 m32 -// SHRL cl m32 -// SHRL imm8 r32 r32 -// SHRL cl r32 r32 -// SHRL imm8 r32 m32 -// SHRL cl r32 m32 -// Construct and append a SHRL instruction to the active function. -func (c *Context) SHRL(ops ...operand.Op) { - if inst, err := x86.SHRL(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRL: Logical Shift Right. -// -// Forms: -// -// SHRL 1 r32 -// SHRL imm8 r32 -// SHRL cl r32 -// SHRL 1 m32 -// SHRL imm8 m32 -// SHRL cl m32 -// SHRL imm8 r32 r32 -// SHRL cl r32 r32 -// SHRL imm8 r32 m32 -// SHRL cl r32 m32 -// Construct and append a SHRL instruction to the active function. -// Operates on the global context. -func SHRL(ops ...operand.Op) { ctx.SHRL(ops...) } - -// SHRQ: Logical Shift Right. -// -// Forms: -// -// SHRQ 1 r64 -// SHRQ imm8 r64 -// SHRQ cl r64 -// SHRQ 1 m64 -// SHRQ imm8 m64 -// SHRQ cl m64 -// SHRQ imm8 r64 r64 -// SHRQ cl r64 r64 -// SHRQ imm8 r64 m64 -// SHRQ cl r64 m64 -// Construct and append a SHRQ instruction to the active function. -func (c *Context) SHRQ(ops ...operand.Op) { - if inst, err := x86.SHRQ(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRQ: Logical Shift Right. -// -// Forms: -// -// SHRQ 1 r64 -// SHRQ imm8 r64 -// SHRQ cl r64 -// SHRQ 1 m64 -// SHRQ imm8 m64 -// SHRQ cl m64 -// SHRQ imm8 r64 r64 -// SHRQ cl r64 r64 -// SHRQ imm8 r64 m64 -// SHRQ cl r64 m64 -// Construct and append a SHRQ instruction to the active function. -// Operates on the global context. -func SHRQ(ops ...operand.Op) { ctx.SHRQ(ops...) } - -// SHRW: Logical Shift Right. -// -// Forms: -// -// SHRW 1 r16 -// SHRW imm8 r16 -// SHRW cl r16 -// SHRW 1 m16 -// SHRW imm8 m16 -// SHRW cl m16 -// SHRW imm8 r16 r16 -// SHRW cl r16 r16 -// SHRW imm8 r16 m16 -// SHRW cl r16 m16 -// Construct and append a SHRW instruction to the active function. -func (c *Context) SHRW(ops ...operand.Op) { - if inst, err := x86.SHRW(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRW: Logical Shift Right. -// -// Forms: -// -// SHRW 1 r16 -// SHRW imm8 r16 -// SHRW cl r16 -// SHRW 1 m16 -// SHRW imm8 m16 -// SHRW cl m16 -// SHRW imm8 r16 r16 -// SHRW cl r16 r16 -// SHRW imm8 r16 m16 -// SHRW cl r16 m16 -// Construct and append a SHRW instruction to the active function. -// Operates on the global context. -func SHRW(ops ...operand.Op) { ctx.SHRW(ops...) } - -// SHRXL: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXL r32 r32 r32 -// SHRXL r32 m32 r32 -// Construct and append a SHRXL instruction to the active function. -func (c *Context) SHRXL(r, mr, r1 operand.Op) { - if inst, err := x86.SHRXL(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRXL: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXL r32 r32 r32 -// SHRXL r32 m32 r32 -// Construct and append a SHRXL instruction to the active function. -// Operates on the global context. -func SHRXL(r, mr, r1 operand.Op) { ctx.SHRXL(r, mr, r1) } - -// SHRXQ: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXQ r64 r64 r64 -// SHRXQ r64 m64 r64 -// Construct and append a SHRXQ instruction to the active function. -func (c *Context) SHRXQ(r, mr, r1 operand.Op) { - if inst, err := x86.SHRXQ(r, mr, r1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHRXQ: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXQ r64 r64 r64 -// SHRXQ r64 m64 r64 -// Construct and append a SHRXQ instruction to the active function. -// Operates on the global context. -func SHRXQ(r, mr, r1 operand.Op) { ctx.SHRXQ(r, mr, r1) } - -// SHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPD imm8 xmm xmm -// SHUFPD imm8 m128 xmm -// Construct and append a SHUFPD instruction to the active function. -func (c *Context) SHUFPD(i, mx, x operand.Op) { - if inst, err := x86.SHUFPD(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPD imm8 xmm xmm -// SHUFPD imm8 m128 xmm -// Construct and append a SHUFPD instruction to the active function. -// Operates on the global context. -func SHUFPD(i, mx, x operand.Op) { ctx.SHUFPD(i, mx, x) } - -// SHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPS imm8 xmm xmm -// SHUFPS imm8 m128 xmm -// Construct and append a SHUFPS instruction to the active function. -func (c *Context) SHUFPS(i, mx, x operand.Op) { - if inst, err := x86.SHUFPS(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPS imm8 xmm xmm -// SHUFPS imm8 m128 xmm -// Construct and append a SHUFPS instruction to the active function. -// Operates on the global context. -func SHUFPS(i, mx, x operand.Op) { ctx.SHUFPS(i, mx, x) } - -// SQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPD xmm xmm -// SQRTPD m128 xmm -// Construct and append a SQRTPD instruction to the active function. -func (c *Context) SQRTPD(mx, x operand.Op) { - if inst, err := x86.SQRTPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPD xmm xmm -// SQRTPD m128 xmm -// Construct and append a SQRTPD instruction to the active function. -// Operates on the global context. -func SQRTPD(mx, x operand.Op) { ctx.SQRTPD(mx, x) } - -// SQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPS xmm xmm -// SQRTPS m128 xmm -// Construct and append a SQRTPS instruction to the active function. -func (c *Context) SQRTPS(mx, x operand.Op) { - if inst, err := x86.SQRTPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPS xmm xmm -// SQRTPS m128 xmm -// Construct and append a SQRTPS instruction to the active function. -// Operates on the global context. -func SQRTPS(mx, x operand.Op) { ctx.SQRTPS(mx, x) } - -// SQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSD xmm xmm -// SQRTSD m64 xmm -// Construct and append a SQRTSD instruction to the active function. -func (c *Context) SQRTSD(mx, x operand.Op) { - if inst, err := x86.SQRTSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSD xmm xmm -// SQRTSD m64 xmm -// Construct and append a SQRTSD instruction to the active function. -// Operates on the global context. -func SQRTSD(mx, x operand.Op) { ctx.SQRTSD(mx, x) } - -// SQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSS xmm xmm -// SQRTSS m32 xmm -// Construct and append a SQRTSS instruction to the active function. -func (c *Context) SQRTSS(mx, x operand.Op) { - if inst, err := x86.SQRTSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSS xmm xmm -// SQRTSS m32 xmm -// Construct and append a SQRTSS instruction to the active function. -// Operates on the global context. -func SQRTSS(mx, x operand.Op) { ctx.SQRTSS(mx, x) } - -// STC: Set Carry Flag. -// -// Forms: -// -// STC -// Construct and append a STC instruction to the active function. -func (c *Context) STC() { - if inst, err := x86.STC(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// STC: Set Carry Flag. -// -// Forms: -// -// STC -// Construct and append a STC instruction to the active function. -// Operates on the global context. -func STC() { ctx.STC() } - -// STD: Set Direction Flag. -// -// Forms: -// -// STD -// Construct and append a STD instruction to the active function. -func (c *Context) STD() { - if inst, err := x86.STD(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// STD: Set Direction Flag. -// -// Forms: -// -// STD -// Construct and append a STD instruction to the active function. -// Operates on the global context. -func STD() { ctx.STD() } - -// STMXCSR: Store MXCSR Register State. -// -// Forms: -// -// STMXCSR m32 -// Construct and append a STMXCSR instruction to the active function. -func (c *Context) STMXCSR(m operand.Op) { - if inst, err := x86.STMXCSR(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// STMXCSR: Store MXCSR Register State. -// -// Forms: -// -// STMXCSR m32 -// Construct and append a STMXCSR instruction to the active function. -// Operates on the global context. -func STMXCSR(m operand.Op) { ctx.STMXCSR(m) } - -// SUBB: Subtract. -// -// Forms: -// -// SUBB imm8 al -// SUBB imm8 r8 -// SUBB r8 r8 -// SUBB m8 r8 -// SUBB imm8 m8 -// SUBB r8 m8 -// Construct and append a SUBB instruction to the active function. -func (c *Context) SUBB(imr, amr operand.Op) { - if inst, err := x86.SUBB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBB: Subtract. -// -// Forms: -// -// SUBB imm8 al -// SUBB imm8 r8 -// SUBB r8 r8 -// SUBB m8 r8 -// SUBB imm8 m8 -// SUBB r8 m8 -// Construct and append a SUBB instruction to the active function. -// Operates on the global context. -func SUBB(imr, amr operand.Op) { ctx.SUBB(imr, amr) } - -// SUBL: Subtract. -// -// Forms: -// -// SUBL imm32 eax -// SUBL imm8 r32 -// SUBL imm32 r32 -// SUBL r32 r32 -// SUBL m32 r32 -// SUBL imm8 m32 -// SUBL imm32 m32 -// SUBL r32 m32 -// Construct and append a SUBL instruction to the active function. -func (c *Context) SUBL(imr, emr operand.Op) { - if inst, err := x86.SUBL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBL: Subtract. -// -// Forms: -// -// SUBL imm32 eax -// SUBL imm8 r32 -// SUBL imm32 r32 -// SUBL r32 r32 -// SUBL m32 r32 -// SUBL imm8 m32 -// SUBL imm32 m32 -// SUBL r32 m32 -// Construct and append a SUBL instruction to the active function. -// Operates on the global context. -func SUBL(imr, emr operand.Op) { ctx.SUBL(imr, emr) } - -// SUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBPD xmm xmm -// SUBPD m128 xmm -// Construct and append a SUBPD instruction to the active function. -func (c *Context) SUBPD(mx, x operand.Op) { - if inst, err := x86.SUBPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBPD xmm xmm -// SUBPD m128 xmm -// Construct and append a SUBPD instruction to the active function. -// Operates on the global context. -func SUBPD(mx, x operand.Op) { ctx.SUBPD(mx, x) } - -// SUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBPS xmm xmm -// SUBPS m128 xmm -// Construct and append a SUBPS instruction to the active function. -func (c *Context) SUBPS(mx, x operand.Op) { - if inst, err := x86.SUBPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBPS xmm xmm -// SUBPS m128 xmm -// Construct and append a SUBPS instruction to the active function. -// Operates on the global context. -func SUBPS(mx, x operand.Op) { ctx.SUBPS(mx, x) } - -// SUBQ: Subtract. -// -// Forms: -// -// SUBQ imm32 rax -// SUBQ imm8 r64 -// SUBQ imm32 r64 -// SUBQ r64 r64 -// SUBQ m64 r64 -// SUBQ imm8 m64 -// SUBQ imm32 m64 -// SUBQ r64 m64 -// Construct and append a SUBQ instruction to the active function. -func (c *Context) SUBQ(imr, mr operand.Op) { - if inst, err := x86.SUBQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBQ: Subtract. -// -// Forms: -// -// SUBQ imm32 rax -// SUBQ imm8 r64 -// SUBQ imm32 r64 -// SUBQ r64 r64 -// SUBQ m64 r64 -// SUBQ imm8 m64 -// SUBQ imm32 m64 -// SUBQ r64 m64 -// Construct and append a SUBQ instruction to the active function. -// Operates on the global context. -func SUBQ(imr, mr operand.Op) { ctx.SUBQ(imr, mr) } - -// SUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBSD xmm xmm -// SUBSD m64 xmm -// Construct and append a SUBSD instruction to the active function. -func (c *Context) SUBSD(mx, x operand.Op) { - if inst, err := x86.SUBSD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBSD xmm xmm -// SUBSD m64 xmm -// Construct and append a SUBSD instruction to the active function. -// Operates on the global context. -func SUBSD(mx, x operand.Op) { ctx.SUBSD(mx, x) } - -// SUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBSS xmm xmm -// SUBSS m32 xmm -// Construct and append a SUBSS instruction to the active function. -func (c *Context) SUBSS(mx, x operand.Op) { - if inst, err := x86.SUBSS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBSS xmm xmm -// SUBSS m32 xmm -// Construct and append a SUBSS instruction to the active function. -// Operates on the global context. -func SUBSS(mx, x operand.Op) { ctx.SUBSS(mx, x) } - -// SUBW: Subtract. -// -// Forms: -// -// SUBW imm16 ax -// SUBW imm8 r16 -// SUBW imm16 r16 -// SUBW r16 r16 -// SUBW m16 r16 -// SUBW imm8 m16 -// SUBW imm16 m16 -// SUBW r16 m16 -// Construct and append a SUBW instruction to the active function. -func (c *Context) SUBW(imr, amr operand.Op) { - if inst, err := x86.SUBW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SUBW: Subtract. -// -// Forms: -// -// SUBW imm16 ax -// SUBW imm8 r16 -// SUBW imm16 r16 -// SUBW r16 r16 -// SUBW m16 r16 -// SUBW imm8 m16 -// SUBW imm16 m16 -// SUBW r16 m16 -// Construct and append a SUBW instruction to the active function. -// Operates on the global context. -func SUBW(imr, amr operand.Op) { ctx.SUBW(imr, amr) } - -// SYSCALL: Fast System Call. -// -// Forms: -// -// SYSCALL -// Construct and append a SYSCALL instruction to the active function. -func (c *Context) SYSCALL() { - if inst, err := x86.SYSCALL(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// SYSCALL: Fast System Call. -// -// Forms: -// -// SYSCALL -// Construct and append a SYSCALL instruction to the active function. -// Operates on the global context. -func SYSCALL() { ctx.SYSCALL() } - -// TESTB: Logical Compare. -// -// Forms: -// -// TESTB imm8 al -// TESTB imm8 r8 -// TESTB r8 r8 -// TESTB imm8 m8 -// TESTB r8 m8 -// Construct and append a TESTB instruction to the active function. -func (c *Context) TESTB(ir, amr operand.Op) { - if inst, err := x86.TESTB(ir, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TESTB: Logical Compare. -// -// Forms: -// -// TESTB imm8 al -// TESTB imm8 r8 -// TESTB r8 r8 -// TESTB imm8 m8 -// TESTB r8 m8 -// Construct and append a TESTB instruction to the active function. -// Operates on the global context. -func TESTB(ir, amr operand.Op) { ctx.TESTB(ir, amr) } - -// TESTL: Logical Compare. -// -// Forms: -// -// TESTL imm32 eax -// TESTL imm32 r32 -// TESTL r32 r32 -// TESTL imm32 m32 -// TESTL r32 m32 -// Construct and append a TESTL instruction to the active function. -func (c *Context) TESTL(ir, emr operand.Op) { - if inst, err := x86.TESTL(ir, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TESTL: Logical Compare. -// -// Forms: -// -// TESTL imm32 eax -// TESTL imm32 r32 -// TESTL r32 r32 -// TESTL imm32 m32 -// TESTL r32 m32 -// Construct and append a TESTL instruction to the active function. -// Operates on the global context. -func TESTL(ir, emr operand.Op) { ctx.TESTL(ir, emr) } - -// TESTQ: Logical Compare. -// -// Forms: -// -// TESTQ imm32 rax -// TESTQ imm32 r64 -// TESTQ r64 r64 -// TESTQ imm32 m64 -// TESTQ r64 m64 -// Construct and append a TESTQ instruction to the active function. -func (c *Context) TESTQ(ir, mr operand.Op) { - if inst, err := x86.TESTQ(ir, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TESTQ: Logical Compare. -// -// Forms: -// -// TESTQ imm32 rax -// TESTQ imm32 r64 -// TESTQ r64 r64 -// TESTQ imm32 m64 -// TESTQ r64 m64 -// Construct and append a TESTQ instruction to the active function. -// Operates on the global context. -func TESTQ(ir, mr operand.Op) { ctx.TESTQ(ir, mr) } - -// TESTW: Logical Compare. -// -// Forms: -// -// TESTW imm16 ax -// TESTW imm16 r16 -// TESTW r16 r16 -// TESTW imm16 m16 -// TESTW r16 m16 -// Construct and append a TESTW instruction to the active function. -func (c *Context) TESTW(ir, amr operand.Op) { - if inst, err := x86.TESTW(ir, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TESTW: Logical Compare. -// -// Forms: -// -// TESTW imm16 ax -// TESTW imm16 r16 -// TESTW r16 r16 -// TESTW imm16 m16 -// TESTW r16 m16 -// Construct and append a TESTW instruction to the active function. -// Operates on the global context. -func TESTW(ir, amr operand.Op) { ctx.TESTW(ir, amr) } - -// TZCNTL: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTL r32 r32 -// TZCNTL m32 r32 -// Construct and append a TZCNTL instruction to the active function. -func (c *Context) TZCNTL(mr, r operand.Op) { - if inst, err := x86.TZCNTL(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TZCNTL: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTL r32 r32 -// TZCNTL m32 r32 -// Construct and append a TZCNTL instruction to the active function. -// Operates on the global context. -func TZCNTL(mr, r operand.Op) { ctx.TZCNTL(mr, r) } - -// TZCNTQ: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTQ r64 r64 -// TZCNTQ m64 r64 -// Construct and append a TZCNTQ instruction to the active function. -func (c *Context) TZCNTQ(mr, r operand.Op) { - if inst, err := x86.TZCNTQ(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TZCNTQ: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTQ r64 r64 -// TZCNTQ m64 r64 -// Construct and append a TZCNTQ instruction to the active function. -// Operates on the global context. -func TZCNTQ(mr, r operand.Op) { ctx.TZCNTQ(mr, r) } - -// TZCNTW: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTW r16 r16 -// TZCNTW m16 r16 -// Construct and append a TZCNTW instruction to the active function. -func (c *Context) TZCNTW(mr, r operand.Op) { - if inst, err := x86.TZCNTW(mr, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// TZCNTW: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTW r16 r16 -// TZCNTW m16 r16 -// Construct and append a TZCNTW instruction to the active function. -// Operates on the global context. -func TZCNTW(mr, r operand.Op) { ctx.TZCNTW(mr, r) } - -// UCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISD xmm xmm -// UCOMISD m64 xmm -// Construct and append a UCOMISD instruction to the active function. -func (c *Context) UCOMISD(mx, x operand.Op) { - if inst, err := x86.UCOMISD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISD xmm xmm -// UCOMISD m64 xmm -// Construct and append a UCOMISD instruction to the active function. -// Operates on the global context. -func UCOMISD(mx, x operand.Op) { ctx.UCOMISD(mx, x) } - -// UCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISS xmm xmm -// UCOMISS m32 xmm -// Construct and append a UCOMISS instruction to the active function. -func (c *Context) UCOMISS(mx, x operand.Op) { - if inst, err := x86.UCOMISS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISS xmm xmm -// UCOMISS m32 xmm -// Construct and append a UCOMISS instruction to the active function. -// Operates on the global context. -func UCOMISS(mx, x operand.Op) { ctx.UCOMISS(mx, x) } - -// UD2: Undefined Instruction. -// -// Forms: -// -// UD2 -// Construct and append a UD2 instruction to the active function. -func (c *Context) UD2() { - if inst, err := x86.UD2(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UD2: Undefined Instruction. -// -// Forms: -// -// UD2 -// Construct and append a UD2 instruction to the active function. -// Operates on the global context. -func UD2() { ctx.UD2() } - -// UNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPD xmm xmm -// UNPCKHPD m128 xmm -// Construct and append a UNPCKHPD instruction to the active function. -func (c *Context) UNPCKHPD(mx, x operand.Op) { - if inst, err := x86.UNPCKHPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPD xmm xmm -// UNPCKHPD m128 xmm -// Construct and append a UNPCKHPD instruction to the active function. -// Operates on the global context. -func UNPCKHPD(mx, x operand.Op) { ctx.UNPCKHPD(mx, x) } - -// UNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPS xmm xmm -// UNPCKHPS m128 xmm -// Construct and append a UNPCKHPS instruction to the active function. -func (c *Context) UNPCKHPS(mx, x operand.Op) { - if inst, err := x86.UNPCKHPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPS xmm xmm -// UNPCKHPS m128 xmm -// Construct and append a UNPCKHPS instruction to the active function. -// Operates on the global context. -func UNPCKHPS(mx, x operand.Op) { ctx.UNPCKHPS(mx, x) } - -// UNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPD xmm xmm -// UNPCKLPD m128 xmm -// Construct and append a UNPCKLPD instruction to the active function. -func (c *Context) UNPCKLPD(mx, x operand.Op) { - if inst, err := x86.UNPCKLPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPD xmm xmm -// UNPCKLPD m128 xmm -// Construct and append a UNPCKLPD instruction to the active function. -// Operates on the global context. -func UNPCKLPD(mx, x operand.Op) { ctx.UNPCKLPD(mx, x) } - -// UNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPS xmm xmm -// UNPCKLPS m128 xmm -// Construct and append a UNPCKLPS instruction to the active function. -func (c *Context) UNPCKLPS(mx, x operand.Op) { - if inst, err := x86.UNPCKLPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// UNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPS xmm xmm -// UNPCKLPS m128 xmm -// Construct and append a UNPCKLPS instruction to the active function. -// Operates on the global context. -func UNPCKLPS(mx, x operand.Op) { ctx.UNPCKLPS(mx, x) } - -// VADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDPD xmm xmm xmm -// VADDPD m128 xmm xmm -// VADDPD ymm ymm ymm -// VADDPD m256 ymm ymm -// Construct and append a VADDPD instruction to the active function. -func (c *Context) VADDPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VADDPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDPD xmm xmm xmm -// VADDPD m128 xmm xmm -// VADDPD ymm ymm ymm -// VADDPD m256 ymm ymm -// Construct and append a VADDPD instruction to the active function. -// Operates on the global context. -func VADDPD(mxy, xy, xy1 operand.Op) { ctx.VADDPD(mxy, xy, xy1) } - -// VADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDPS xmm xmm xmm -// VADDPS m128 xmm xmm -// VADDPS ymm ymm ymm -// VADDPS m256 ymm ymm -// Construct and append a VADDPS instruction to the active function. -func (c *Context) VADDPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VADDPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDPS xmm xmm xmm -// VADDPS m128 xmm xmm -// VADDPS ymm ymm ymm -// VADDPS m256 ymm ymm -// Construct and append a VADDPS instruction to the active function. -// Operates on the global context. -func VADDPS(mxy, xy, xy1 operand.Op) { ctx.VADDPS(mxy, xy, xy1) } - -// VADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDSD xmm xmm xmm -// VADDSD m64 xmm xmm -// Construct and append a VADDSD instruction to the active function. -func (c *Context) VADDSD(mx, x, x1 operand.Op) { - if inst, err := x86.VADDSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDSD xmm xmm xmm -// VADDSD m64 xmm xmm -// Construct and append a VADDSD instruction to the active function. -// Operates on the global context. -func VADDSD(mx, x, x1 operand.Op) { ctx.VADDSD(mx, x, x1) } - -// VADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDSS xmm xmm xmm -// VADDSS m32 xmm xmm -// Construct and append a VADDSS instruction to the active function. -func (c *Context) VADDSS(mx, x, x1 operand.Op) { - if inst, err := x86.VADDSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDSS xmm xmm xmm -// VADDSS m32 xmm xmm -// Construct and append a VADDSS instruction to the active function. -// Operates on the global context. -func VADDSS(mx, x, x1 operand.Op) { ctx.VADDSS(mx, x, x1) } - -// VADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPD xmm xmm xmm -// VADDSUBPD m128 xmm xmm -// VADDSUBPD ymm ymm ymm -// VADDSUBPD m256 ymm ymm -// Construct and append a VADDSUBPD instruction to the active function. -func (c *Context) VADDSUBPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VADDSUBPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPD xmm xmm xmm -// VADDSUBPD m128 xmm xmm -// VADDSUBPD ymm ymm ymm -// VADDSUBPD m256 ymm ymm -// Construct and append a VADDSUBPD instruction to the active function. -// Operates on the global context. -func VADDSUBPD(mxy, xy, xy1 operand.Op) { ctx.VADDSUBPD(mxy, xy, xy1) } - -// VADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPS xmm xmm xmm -// VADDSUBPS m128 xmm xmm -// VADDSUBPS ymm ymm ymm -// VADDSUBPS m256 ymm ymm -// Construct and append a VADDSUBPS instruction to the active function. -func (c *Context) VADDSUBPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VADDSUBPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPS xmm xmm xmm -// VADDSUBPS m128 xmm xmm -// VADDSUBPS ymm ymm ymm -// VADDSUBPS m256 ymm ymm -// Construct and append a VADDSUBPS instruction to the active function. -// Operates on the global context. -func VADDSUBPS(mxy, xy, xy1 operand.Op) { ctx.VADDSUBPS(mxy, xy, xy1) } - -// VAESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDEC xmm xmm xmm -// VAESDEC m128 xmm xmm -// Construct and append a VAESDEC instruction to the active function. -func (c *Context) VAESDEC(mx, x, x1 operand.Op) { - if inst, err := x86.VAESDEC(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDEC xmm xmm xmm -// VAESDEC m128 xmm xmm -// Construct and append a VAESDEC instruction to the active function. -// Operates on the global context. -func VAESDEC(mx, x, x1 operand.Op) { ctx.VAESDEC(mx, x, x1) } - -// VAESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDECLAST xmm xmm xmm -// VAESDECLAST m128 xmm xmm -// Construct and append a VAESDECLAST instruction to the active function. -func (c *Context) VAESDECLAST(mx, x, x1 operand.Op) { - if inst, err := x86.VAESDECLAST(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDECLAST xmm xmm xmm -// VAESDECLAST m128 xmm xmm -// Construct and append a VAESDECLAST instruction to the active function. -// Operates on the global context. -func VAESDECLAST(mx, x, x1 operand.Op) { ctx.VAESDECLAST(mx, x, x1) } - -// VAESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENC xmm xmm xmm -// VAESENC m128 xmm xmm -// Construct and append a VAESENC instruction to the active function. -func (c *Context) VAESENC(mx, x, x1 operand.Op) { - if inst, err := x86.VAESENC(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENC xmm xmm xmm -// VAESENC m128 xmm xmm -// Construct and append a VAESENC instruction to the active function. -// Operates on the global context. -func VAESENC(mx, x, x1 operand.Op) { ctx.VAESENC(mx, x, x1) } - -// VAESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENCLAST xmm xmm xmm -// VAESENCLAST m128 xmm xmm -// Construct and append a VAESENCLAST instruction to the active function. -func (c *Context) VAESENCLAST(mx, x, x1 operand.Op) { - if inst, err := x86.VAESENCLAST(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENCLAST xmm xmm xmm -// VAESENCLAST m128 xmm xmm -// Construct and append a VAESENCLAST instruction to the active function. -// Operates on the global context. -func VAESENCLAST(mx, x, x1 operand.Op) { ctx.VAESENCLAST(mx, x, x1) } - -// VAESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// VAESIMC xmm xmm -// VAESIMC m128 xmm -// Construct and append a VAESIMC instruction to the active function. -func (c *Context) VAESIMC(mx, x operand.Op) { - if inst, err := x86.VAESIMC(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// VAESIMC xmm xmm -// VAESIMC m128 xmm -// Construct and append a VAESIMC instruction to the active function. -// Operates on the global context. -func VAESIMC(mx, x operand.Op) { ctx.VAESIMC(mx, x) } - -// VAESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// VAESKEYGENASSIST imm8 xmm xmm -// VAESKEYGENASSIST imm8 m128 xmm -// Construct and append a VAESKEYGENASSIST instruction to the active function. -func (c *Context) VAESKEYGENASSIST(i, mx, x operand.Op) { - if inst, err := x86.VAESKEYGENASSIST(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VAESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// VAESKEYGENASSIST imm8 xmm xmm -// VAESKEYGENASSIST imm8 m128 xmm -// Construct and append a VAESKEYGENASSIST instruction to the active function. -// Operates on the global context. -func VAESKEYGENASSIST(i, mx, x operand.Op) { ctx.VAESKEYGENASSIST(i, mx, x) } - -// VANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPD xmm xmm xmm -// VANDNPD m128 xmm xmm -// VANDNPD ymm ymm ymm -// VANDNPD m256 ymm ymm -// Construct and append a VANDNPD instruction to the active function. -func (c *Context) VANDNPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VANDNPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPD xmm xmm xmm -// VANDNPD m128 xmm xmm -// VANDNPD ymm ymm ymm -// VANDNPD m256 ymm ymm -// Construct and append a VANDNPD instruction to the active function. -// Operates on the global context. -func VANDNPD(mxy, xy, xy1 operand.Op) { ctx.VANDNPD(mxy, xy, xy1) } - -// VANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPS xmm xmm xmm -// VANDNPS m128 xmm xmm -// VANDNPS ymm ymm ymm -// VANDNPS m256 ymm ymm -// Construct and append a VANDNPS instruction to the active function. -func (c *Context) VANDNPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VANDNPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPS xmm xmm xmm -// VANDNPS m128 xmm xmm -// VANDNPS ymm ymm ymm -// VANDNPS m256 ymm ymm -// Construct and append a VANDNPS instruction to the active function. -// Operates on the global context. -func VANDNPS(mxy, xy, xy1 operand.Op) { ctx.VANDNPS(mxy, xy, xy1) } - -// VANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDPD xmm xmm xmm -// VANDPD m128 xmm xmm -// VANDPD ymm ymm ymm -// VANDPD m256 ymm ymm -// Construct and append a VANDPD instruction to the active function. -func (c *Context) VANDPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VANDPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDPD xmm xmm xmm -// VANDPD m128 xmm xmm -// VANDPD ymm ymm ymm -// VANDPD m256 ymm ymm -// Construct and append a VANDPD instruction to the active function. -// Operates on the global context. -func VANDPD(mxy, xy, xy1 operand.Op) { ctx.VANDPD(mxy, xy, xy1) } - -// VANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDPS xmm xmm xmm -// VANDPS m128 xmm xmm -// VANDPS ymm ymm ymm -// VANDPS m256 ymm ymm -// Construct and append a VANDPS instruction to the active function. -func (c *Context) VANDPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VANDPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDPS xmm xmm xmm -// VANDPS m128 xmm xmm -// VANDPS ymm ymm ymm -// VANDPS m256 ymm ymm -// Construct and append a VANDPS instruction to the active function. -// Operates on the global context. -func VANDPS(mxy, xy, xy1 operand.Op) { ctx.VANDPS(mxy, xy, xy1) } - -// VBLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPD imm8 xmm xmm xmm -// VBLENDPD imm8 m128 xmm xmm -// VBLENDPD imm8 ymm ymm ymm -// VBLENDPD imm8 m256 ymm ymm -// Construct and append a VBLENDPD instruction to the active function. -func (c *Context) VBLENDPD(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VBLENDPD(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPD imm8 xmm xmm xmm -// VBLENDPD imm8 m128 xmm xmm -// VBLENDPD imm8 ymm ymm ymm -// VBLENDPD imm8 m256 ymm ymm -// Construct and append a VBLENDPD instruction to the active function. -// Operates on the global context. -func VBLENDPD(i, mxy, xy, xy1 operand.Op) { ctx.VBLENDPD(i, mxy, xy, xy1) } - -// VBLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPS imm8 xmm xmm xmm -// VBLENDPS imm8 m128 xmm xmm -// VBLENDPS imm8 ymm ymm ymm -// VBLENDPS imm8 m256 ymm ymm -// Construct and append a VBLENDPS instruction to the active function. -func (c *Context) VBLENDPS(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VBLENDPS(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPS imm8 xmm xmm xmm -// VBLENDPS imm8 m128 xmm xmm -// VBLENDPS imm8 ymm ymm ymm -// VBLENDPS imm8 m256 ymm ymm -// Construct and append a VBLENDPS instruction to the active function. -// Operates on the global context. -func VBLENDPS(i, mxy, xy, xy1 operand.Op) { ctx.VBLENDPS(i, mxy, xy, xy1) } - -// VBLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPD xmm xmm xmm xmm -// VBLENDVPD xmm m128 xmm xmm -// VBLENDVPD ymm ymm ymm ymm -// VBLENDVPD ymm m256 ymm ymm -// Construct and append a VBLENDVPD instruction to the active function. -func (c *Context) VBLENDVPD(xy, mxy, xy1, xy2 operand.Op) { - if inst, err := x86.VBLENDVPD(xy, mxy, xy1, xy2); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPD xmm xmm xmm xmm -// VBLENDVPD xmm m128 xmm xmm -// VBLENDVPD ymm ymm ymm ymm -// VBLENDVPD ymm m256 ymm ymm -// Construct and append a VBLENDVPD instruction to the active function. -// Operates on the global context. -func VBLENDVPD(xy, mxy, xy1, xy2 operand.Op) { ctx.VBLENDVPD(xy, mxy, xy1, xy2) } - -// VBLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPS xmm xmm xmm xmm -// VBLENDVPS xmm m128 xmm xmm -// VBLENDVPS ymm ymm ymm ymm -// VBLENDVPS ymm m256 ymm ymm -// Construct and append a VBLENDVPS instruction to the active function. -func (c *Context) VBLENDVPS(xy, mxy, xy1, xy2 operand.Op) { - if inst, err := x86.VBLENDVPS(xy, mxy, xy1, xy2); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPS xmm xmm xmm xmm -// VBLENDVPS xmm m128 xmm xmm -// VBLENDVPS ymm ymm ymm ymm -// VBLENDVPS ymm m256 ymm ymm -// Construct and append a VBLENDVPS instruction to the active function. -// Operates on the global context. -func VBLENDVPS(xy, mxy, xy1, xy2 operand.Op) { ctx.VBLENDVPS(xy, mxy, xy1, xy2) } - -// VBROADCASTF128: Broadcast 128 Bit of Floating-Point Data. -// -// Forms: -// -// VBROADCASTF128 m128 ymm -// Construct and append a VBROADCASTF128 instruction to the active function. -func (c *Context) VBROADCASTF128(m, y operand.Op) { - if inst, err := x86.VBROADCASTF128(m, y); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBROADCASTF128: Broadcast 128 Bit of Floating-Point Data. -// -// Forms: -// -// VBROADCASTF128 m128 ymm -// Construct and append a VBROADCASTF128 instruction to the active function. -// Operates on the global context. -func VBROADCASTF128(m, y operand.Op) { ctx.VBROADCASTF128(m, y) } - -// VBROADCASTI128: Broadcast 128 Bits of Integer Data. -// -// Forms: -// -// VBROADCASTI128 m128 ymm -// Construct and append a VBROADCASTI128 instruction to the active function. -func (c *Context) VBROADCASTI128(m, y operand.Op) { - if inst, err := x86.VBROADCASTI128(m, y); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBROADCASTI128: Broadcast 128 Bits of Integer Data. -// -// Forms: -// -// VBROADCASTI128 m128 ymm -// Construct and append a VBROADCASTI128 instruction to the active function. -// Operates on the global context. -func VBROADCASTI128(m, y operand.Op) { ctx.VBROADCASTI128(m, y) } - -// VBROADCASTSD: Broadcast Double-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSD xmm ymm -// VBROADCASTSD m64 ymm -// Construct and append a VBROADCASTSD instruction to the active function. -func (c *Context) VBROADCASTSD(mx, y operand.Op) { - if inst, err := x86.VBROADCASTSD(mx, y); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBROADCASTSD: Broadcast Double-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSD xmm ymm -// VBROADCASTSD m64 ymm -// Construct and append a VBROADCASTSD instruction to the active function. -// Operates on the global context. -func VBROADCASTSD(mx, y operand.Op) { ctx.VBROADCASTSD(mx, y) } - -// VBROADCASTSS: Broadcast Single-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSS xmm xmm -// VBROADCASTSS m32 xmm -// VBROADCASTSS xmm ymm -// VBROADCASTSS m32 ymm -// Construct and append a VBROADCASTSS instruction to the active function. -func (c *Context) VBROADCASTSS(mx, xy operand.Op) { - if inst, err := x86.VBROADCASTSS(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VBROADCASTSS: Broadcast Single-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSS xmm xmm -// VBROADCASTSS m32 xmm -// VBROADCASTSS xmm ymm -// VBROADCASTSS m32 ymm -// Construct and append a VBROADCASTSS instruction to the active function. -// Operates on the global context. -func VBROADCASTSS(mx, xy operand.Op) { ctx.VBROADCASTSS(mx, xy) } - -// VCMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPD imm8 xmm xmm xmm -// VCMPPD imm8 m128 xmm xmm -// VCMPPD imm8 ymm ymm ymm -// VCMPPD imm8 m256 ymm ymm -// Construct and append a VCMPPD instruction to the active function. -func (c *Context) VCMPPD(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VCMPPD(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPD imm8 xmm xmm xmm -// VCMPPD imm8 m128 xmm xmm -// VCMPPD imm8 ymm ymm ymm -// VCMPPD imm8 m256 ymm ymm -// Construct and append a VCMPPD instruction to the active function. -// Operates on the global context. -func VCMPPD(i, mxy, xy, xy1 operand.Op) { ctx.VCMPPD(i, mxy, xy, xy1) } - -// VCMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPS imm8 xmm xmm xmm -// VCMPPS imm8 m128 xmm xmm -// VCMPPS imm8 ymm ymm ymm -// VCMPPS imm8 m256 ymm ymm -// Construct and append a VCMPPS instruction to the active function. -func (c *Context) VCMPPS(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VCMPPS(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPS imm8 xmm xmm xmm -// VCMPPS imm8 m128 xmm xmm -// VCMPPS imm8 ymm ymm ymm -// VCMPPS imm8 m256 ymm ymm -// Construct and append a VCMPPS instruction to the active function. -// Operates on the global context. -func VCMPPS(i, mxy, xy, xy1 operand.Op) { ctx.VCMPPS(i, mxy, xy, xy1) } - -// VCMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSD imm8 xmm xmm xmm -// VCMPSD imm8 m64 xmm xmm -// Construct and append a VCMPSD instruction to the active function. -func (c *Context) VCMPSD(i, mx, x, x1 operand.Op) { - if inst, err := x86.VCMPSD(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSD imm8 xmm xmm xmm -// VCMPSD imm8 m64 xmm xmm -// Construct and append a VCMPSD instruction to the active function. -// Operates on the global context. -func VCMPSD(i, mx, x, x1 operand.Op) { ctx.VCMPSD(i, mx, x, x1) } - -// VCMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSS imm8 xmm xmm xmm -// VCMPSS imm8 m32 xmm xmm -// Construct and append a VCMPSS instruction to the active function. -func (c *Context) VCMPSS(i, mx, x, x1 operand.Op) { - if inst, err := x86.VCMPSS(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSS imm8 xmm xmm xmm -// VCMPSS imm8 m32 xmm xmm -// Construct and append a VCMPSS instruction to the active function. -// Operates on the global context. -func VCMPSS(i, mx, x, x1 operand.Op) { ctx.VCMPSS(i, mx, x, x1) } - -// VCOMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISD xmm xmm -// VCOMISD m64 xmm -// Construct and append a VCOMISD instruction to the active function. -func (c *Context) VCOMISD(mx, x operand.Op) { - if inst, err := x86.VCOMISD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCOMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISD xmm xmm -// VCOMISD m64 xmm -// Construct and append a VCOMISD instruction to the active function. -// Operates on the global context. -func VCOMISD(mx, x operand.Op) { ctx.VCOMISD(mx, x) } - -// VCOMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISS xmm xmm -// VCOMISS m32 xmm -// Construct and append a VCOMISS instruction to the active function. -func (c *Context) VCOMISS(mx, x operand.Op) { - if inst, err := x86.VCOMISS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCOMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISS xmm xmm -// VCOMISS m32 xmm -// Construct and append a VCOMISS instruction to the active function. -// Operates on the global context. -func VCOMISS(mx, x operand.Op) { ctx.VCOMISS(mx, x) } - -// VCVTDQ2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PD xmm xmm -// VCVTDQ2PD m64 xmm -// VCVTDQ2PD xmm ymm -// VCVTDQ2PD m128 ymm -// Construct and append a VCVTDQ2PD instruction to the active function. -func (c *Context) VCVTDQ2PD(mx, xy operand.Op) { - if inst, err := x86.VCVTDQ2PD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTDQ2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PD xmm xmm -// VCVTDQ2PD m64 xmm -// VCVTDQ2PD xmm ymm -// VCVTDQ2PD m128 ymm -// Construct and append a VCVTDQ2PD instruction to the active function. -// Operates on the global context. -func VCVTDQ2PD(mx, xy operand.Op) { ctx.VCVTDQ2PD(mx, xy) } - -// VCVTDQ2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PS xmm xmm -// VCVTDQ2PS m128 xmm -// VCVTDQ2PS ymm ymm -// VCVTDQ2PS m256 ymm -// Construct and append a VCVTDQ2PS instruction to the active function. -func (c *Context) VCVTDQ2PS(mxy, xy operand.Op) { - if inst, err := x86.VCVTDQ2PS(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTDQ2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PS xmm xmm -// VCVTDQ2PS m128 xmm -// VCVTDQ2PS ymm ymm -// VCVTDQ2PS m256 ymm -// Construct and append a VCVTDQ2PS instruction to the active function. -// Operates on the global context. -func VCVTDQ2PS(mxy, xy operand.Op) { ctx.VCVTDQ2PS(mxy, xy) } - -// VCVTPD2DQX: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQX xmm xmm -// VCVTPD2DQX m128 xmm -// Construct and append a VCVTPD2DQX instruction to the active function. -func (c *Context) VCVTPD2DQX(mx, x operand.Op) { - if inst, err := x86.VCVTPD2DQX(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPD2DQX: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQX xmm xmm -// VCVTPD2DQX m128 xmm -// Construct and append a VCVTPD2DQX instruction to the active function. -// Operates on the global context. -func VCVTPD2DQX(mx, x operand.Op) { ctx.VCVTPD2DQX(mx, x) } - -// VCVTPD2DQY: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQY ymm xmm -// VCVTPD2DQY m256 xmm -// Construct and append a VCVTPD2DQY instruction to the active function. -func (c *Context) VCVTPD2DQY(my, x operand.Op) { - if inst, err := x86.VCVTPD2DQY(my, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPD2DQY: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQY ymm xmm -// VCVTPD2DQY m256 xmm -// Construct and append a VCVTPD2DQY instruction to the active function. -// Operates on the global context. -func VCVTPD2DQY(my, x operand.Op) { ctx.VCVTPD2DQY(my, x) } - -// VCVTPD2PSX: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSX xmm xmm -// VCVTPD2PSX m128 xmm -// Construct and append a VCVTPD2PSX instruction to the active function. -func (c *Context) VCVTPD2PSX(mx, x operand.Op) { - if inst, err := x86.VCVTPD2PSX(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPD2PSX: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSX xmm xmm -// VCVTPD2PSX m128 xmm -// Construct and append a VCVTPD2PSX instruction to the active function. -// Operates on the global context. -func VCVTPD2PSX(mx, x operand.Op) { ctx.VCVTPD2PSX(mx, x) } - -// VCVTPD2PSY: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSY ymm xmm -// VCVTPD2PSY m256 xmm -// Construct and append a VCVTPD2PSY instruction to the active function. -func (c *Context) VCVTPD2PSY(my, x operand.Op) { - if inst, err := x86.VCVTPD2PSY(my, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPD2PSY: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSY ymm xmm -// VCVTPD2PSY m256 xmm -// Construct and append a VCVTPD2PSY instruction to the active function. -// Operates on the global context. -func VCVTPD2PSY(my, x operand.Op) { ctx.VCVTPD2PSY(my, x) } - -// VCVTPH2PS: Convert Half-Precision FP Values to Single-Precision FP Values. -// -// Forms: -// -// VCVTPH2PS xmm xmm -// VCVTPH2PS m64 xmm -// VCVTPH2PS xmm ymm -// VCVTPH2PS m128 ymm -// Construct and append a VCVTPH2PS instruction to the active function. -func (c *Context) VCVTPH2PS(mx, xy operand.Op) { - if inst, err := x86.VCVTPH2PS(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPH2PS: Convert Half-Precision FP Values to Single-Precision FP Values. -// -// Forms: -// -// VCVTPH2PS xmm xmm -// VCVTPH2PS m64 xmm -// VCVTPH2PS xmm ymm -// VCVTPH2PS m128 ymm -// Construct and append a VCVTPH2PS instruction to the active function. -// Operates on the global context. -func VCVTPH2PS(mx, xy operand.Op) { ctx.VCVTPH2PS(mx, xy) } - -// VCVTPS2DQ: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPS2DQ xmm xmm -// VCVTPS2DQ m128 xmm -// VCVTPS2DQ ymm ymm -// VCVTPS2DQ m256 ymm -// Construct and append a VCVTPS2DQ instruction to the active function. -func (c *Context) VCVTPS2DQ(mxy, xy operand.Op) { - if inst, err := x86.VCVTPS2DQ(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPS2DQ: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPS2DQ xmm xmm -// VCVTPS2DQ m128 xmm -// VCVTPS2DQ ymm ymm -// VCVTPS2DQ m256 ymm -// Construct and append a VCVTPS2DQ instruction to the active function. -// Operates on the global context. -func VCVTPS2DQ(mxy, xy operand.Op) { ctx.VCVTPS2DQ(mxy, xy) } - -// VCVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTPS2PD xmm xmm -// VCVTPS2PD m64 xmm -// VCVTPS2PD xmm ymm -// VCVTPS2PD m128 ymm -// Construct and append a VCVTPS2PD instruction to the active function. -func (c *Context) VCVTPS2PD(mx, xy operand.Op) { - if inst, err := x86.VCVTPS2PD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTPS2PD xmm xmm -// VCVTPS2PD m64 xmm -// VCVTPS2PD xmm ymm -// VCVTPS2PD m128 ymm -// Construct and append a VCVTPS2PD instruction to the active function. -// Operates on the global context. -func VCVTPS2PD(mx, xy operand.Op) { ctx.VCVTPS2PD(mx, xy) } - -// VCVTPS2PH: Convert Single-Precision FP value to Half-Precision FP value. -// -// Forms: -// -// VCVTPS2PH imm8 xmm xmm -// VCVTPS2PH imm8 ymm xmm -// VCVTPS2PH imm8 xmm m64 -// VCVTPS2PH imm8 ymm m128 -// Construct and append a VCVTPS2PH instruction to the active function. -func (c *Context) VCVTPS2PH(i, xy, mx operand.Op) { - if inst, err := x86.VCVTPS2PH(i, xy, mx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTPS2PH: Convert Single-Precision FP value to Half-Precision FP value. -// -// Forms: -// -// VCVTPS2PH imm8 xmm xmm -// VCVTPS2PH imm8 ymm xmm -// VCVTPS2PH imm8 xmm m64 -// VCVTPS2PH imm8 ymm m128 -// Construct and append a VCVTPS2PH instruction to the active function. -// Operates on the global context. -func VCVTPS2PH(i, xy, mx operand.Op) { ctx.VCVTPS2PH(i, xy, mx) } - -// VCVTSD2SI: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SI xmm r32 -// VCVTSD2SI m64 r32 -// Construct and append a VCVTSD2SI instruction to the active function. -func (c *Context) VCVTSD2SI(mx, r operand.Op) { - if inst, err := x86.VCVTSD2SI(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSD2SI: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SI xmm r32 -// VCVTSD2SI m64 r32 -// Construct and append a VCVTSD2SI instruction to the active function. -// Operates on the global context. -func VCVTSD2SI(mx, r operand.Op) { ctx.VCVTSD2SI(mx, r) } - -// VCVTSD2SIQ: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SIQ xmm r64 -// VCVTSD2SIQ m64 r64 -// Construct and append a VCVTSD2SIQ instruction to the active function. -func (c *Context) VCVTSD2SIQ(mx, r operand.Op) { - if inst, err := x86.VCVTSD2SIQ(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSD2SIQ: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SIQ xmm r64 -// VCVTSD2SIQ m64 r64 -// Construct and append a VCVTSD2SIQ instruction to the active function. -// Operates on the global context. -func VCVTSD2SIQ(mx, r operand.Op) { ctx.VCVTSD2SIQ(mx, r) } - -// VCVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSD2SS xmm xmm xmm -// VCVTSD2SS m64 xmm xmm -// Construct and append a VCVTSD2SS instruction to the active function. -func (c *Context) VCVTSD2SS(mx, x, x1 operand.Op) { - if inst, err := x86.VCVTSD2SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSD2SS xmm xmm xmm -// VCVTSD2SS m64 xmm xmm -// Construct and append a VCVTSD2SS instruction to the active function. -// Operates on the global context. -func VCVTSD2SS(mx, x, x1 operand.Op) { ctx.VCVTSD2SS(mx, x, x1) } - -// VCVTSI2SDL: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDL r32 xmm xmm -// VCVTSI2SDL m32 xmm xmm -// Construct and append a VCVTSI2SDL instruction to the active function. -func (c *Context) VCVTSI2SDL(mr, x, x1 operand.Op) { - if inst, err := x86.VCVTSI2SDL(mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSI2SDL: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDL r32 xmm xmm -// VCVTSI2SDL m32 xmm xmm -// Construct and append a VCVTSI2SDL instruction to the active function. -// Operates on the global context. -func VCVTSI2SDL(mr, x, x1 operand.Op) { ctx.VCVTSI2SDL(mr, x, x1) } - -// VCVTSI2SDQ: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDQ r64 xmm xmm -// VCVTSI2SDQ m64 xmm xmm -// Construct and append a VCVTSI2SDQ instruction to the active function. -func (c *Context) VCVTSI2SDQ(mr, x, x1 operand.Op) { - if inst, err := x86.VCVTSI2SDQ(mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSI2SDQ: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDQ r64 xmm xmm -// VCVTSI2SDQ m64 xmm xmm -// Construct and append a VCVTSI2SDQ instruction to the active function. -// Operates on the global context. -func VCVTSI2SDQ(mr, x, x1 operand.Op) { ctx.VCVTSI2SDQ(mr, x, x1) } - -// VCVTSI2SSL: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSL r32 xmm xmm -// VCVTSI2SSL m32 xmm xmm -// Construct and append a VCVTSI2SSL instruction to the active function. -func (c *Context) VCVTSI2SSL(mr, x, x1 operand.Op) { - if inst, err := x86.VCVTSI2SSL(mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSI2SSL: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSL r32 xmm xmm -// VCVTSI2SSL m32 xmm xmm -// Construct and append a VCVTSI2SSL instruction to the active function. -// Operates on the global context. -func VCVTSI2SSL(mr, x, x1 operand.Op) { ctx.VCVTSI2SSL(mr, x, x1) } - -// VCVTSI2SSQ: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSQ r64 xmm xmm -// VCVTSI2SSQ m64 xmm xmm -// Construct and append a VCVTSI2SSQ instruction to the active function. -func (c *Context) VCVTSI2SSQ(mr, x, x1 operand.Op) { - if inst, err := x86.VCVTSI2SSQ(mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSI2SSQ: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSQ r64 xmm xmm -// VCVTSI2SSQ m64 xmm xmm -// Construct and append a VCVTSI2SSQ instruction to the active function. -// Operates on the global context. -func VCVTSI2SSQ(mr, x, x1 operand.Op) { ctx.VCVTSI2SSQ(mr, x, x1) } - -// VCVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSS2SD xmm xmm xmm -// VCVTSS2SD m32 xmm xmm -// Construct and append a VCVTSS2SD instruction to the active function. -func (c *Context) VCVTSS2SD(mx, x, x1 operand.Op) { - if inst, err := x86.VCVTSS2SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSS2SD xmm xmm xmm -// VCVTSS2SD m32 xmm xmm -// Construct and append a VCVTSS2SD instruction to the active function. -// Operates on the global context. -func VCVTSS2SD(mx, x, x1 operand.Op) { ctx.VCVTSS2SD(mx, x, x1) } - -// VCVTSS2SI: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SI xmm r32 -// VCVTSS2SI m32 r32 -// Construct and append a VCVTSS2SI instruction to the active function. -func (c *Context) VCVTSS2SI(mx, r operand.Op) { - if inst, err := x86.VCVTSS2SI(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSS2SI: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SI xmm r32 -// VCVTSS2SI m32 r32 -// Construct and append a VCVTSS2SI instruction to the active function. -// Operates on the global context. -func VCVTSS2SI(mx, r operand.Op) { ctx.VCVTSS2SI(mx, r) } - -// VCVTSS2SIQ: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SIQ xmm r64 -// VCVTSS2SIQ m32 r64 -// Construct and append a VCVTSS2SIQ instruction to the active function. -func (c *Context) VCVTSS2SIQ(mx, r operand.Op) { - if inst, err := x86.VCVTSS2SIQ(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTSS2SIQ: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SIQ xmm r64 -// VCVTSS2SIQ m32 r64 -// Construct and append a VCVTSS2SIQ instruction to the active function. -// Operates on the global context. -func VCVTSS2SIQ(mx, r operand.Op) { ctx.VCVTSS2SIQ(mx, r) } - -// VCVTTPD2DQX: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQX xmm xmm -// VCVTTPD2DQX m128 xmm -// Construct and append a VCVTTPD2DQX instruction to the active function. -func (c *Context) VCVTTPD2DQX(mx, x operand.Op) { - if inst, err := x86.VCVTTPD2DQX(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTPD2DQX: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQX xmm xmm -// VCVTTPD2DQX m128 xmm -// Construct and append a VCVTTPD2DQX instruction to the active function. -// Operates on the global context. -func VCVTTPD2DQX(mx, x operand.Op) { ctx.VCVTTPD2DQX(mx, x) } - -// VCVTTPD2DQY: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQY ymm xmm -// VCVTTPD2DQY m256 xmm -// Construct and append a VCVTTPD2DQY instruction to the active function. -func (c *Context) VCVTTPD2DQY(my, x operand.Op) { - if inst, err := x86.VCVTTPD2DQY(my, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTPD2DQY: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQY ymm xmm -// VCVTTPD2DQY m256 xmm -// Construct and append a VCVTTPD2DQY instruction to the active function. -// Operates on the global context. -func VCVTTPD2DQY(my, x operand.Op) { ctx.VCVTTPD2DQY(my, x) } - -// VCVTTPS2DQ: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPS2DQ xmm xmm -// VCVTTPS2DQ m128 xmm -// VCVTTPS2DQ ymm ymm -// VCVTTPS2DQ m256 ymm -// Construct and append a VCVTTPS2DQ instruction to the active function. -func (c *Context) VCVTTPS2DQ(mxy, xy operand.Op) { - if inst, err := x86.VCVTTPS2DQ(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTPS2DQ: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPS2DQ xmm xmm -// VCVTTPS2DQ m128 xmm -// VCVTTPS2DQ ymm ymm -// VCVTTPS2DQ m256 ymm -// Construct and append a VCVTTPS2DQ instruction to the active function. -// Operates on the global context. -func VCVTTPS2DQ(mxy, xy operand.Op) { ctx.VCVTTPS2DQ(mxy, xy) } - -// VCVTTSD2SI: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SI xmm r32 -// VCVTTSD2SI m64 r32 -// Construct and append a VCVTTSD2SI instruction to the active function. -func (c *Context) VCVTTSD2SI(mx, r operand.Op) { - if inst, err := x86.VCVTTSD2SI(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTSD2SI: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SI xmm r32 -// VCVTTSD2SI m64 r32 -// Construct and append a VCVTTSD2SI instruction to the active function. -// Operates on the global context. -func VCVTTSD2SI(mx, r operand.Op) { ctx.VCVTTSD2SI(mx, r) } - -// VCVTTSD2SIQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SIQ xmm r64 -// VCVTTSD2SIQ m64 r64 -// Construct and append a VCVTTSD2SIQ instruction to the active function. -func (c *Context) VCVTTSD2SIQ(mx, r operand.Op) { - if inst, err := x86.VCVTTSD2SIQ(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTSD2SIQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SIQ xmm r64 -// VCVTTSD2SIQ m64 r64 -// Construct and append a VCVTTSD2SIQ instruction to the active function. -// Operates on the global context. -func VCVTTSD2SIQ(mx, r operand.Op) { ctx.VCVTTSD2SIQ(mx, r) } - -// VCVTTSS2SI: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SI xmm r32 -// VCVTTSS2SI m32 r32 -// Construct and append a VCVTTSS2SI instruction to the active function. -func (c *Context) VCVTTSS2SI(mx, r operand.Op) { - if inst, err := x86.VCVTTSS2SI(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTSS2SI: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SI xmm r32 -// VCVTTSS2SI m32 r32 -// Construct and append a VCVTTSS2SI instruction to the active function. -// Operates on the global context. -func VCVTTSS2SI(mx, r operand.Op) { ctx.VCVTTSS2SI(mx, r) } - -// VCVTTSS2SIQ: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SIQ xmm r64 -// VCVTTSS2SIQ m32 r64 -// Construct and append a VCVTTSS2SIQ instruction to the active function. -func (c *Context) VCVTTSS2SIQ(mx, r operand.Op) { - if inst, err := x86.VCVTTSS2SIQ(mx, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VCVTTSS2SIQ: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SIQ xmm r64 -// VCVTTSS2SIQ m32 r64 -// Construct and append a VCVTTSS2SIQ instruction to the active function. -// Operates on the global context. -func VCVTTSS2SIQ(mx, r operand.Op) { ctx.VCVTTSS2SIQ(mx, r) } - -// VDIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPD xmm xmm xmm -// VDIVPD m128 xmm xmm -// VDIVPD ymm ymm ymm -// VDIVPD m256 ymm ymm -// Construct and append a VDIVPD instruction to the active function. -func (c *Context) VDIVPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VDIVPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPD xmm xmm xmm -// VDIVPD m128 xmm xmm -// VDIVPD ymm ymm ymm -// VDIVPD m256 ymm ymm -// Construct and append a VDIVPD instruction to the active function. -// Operates on the global context. -func VDIVPD(mxy, xy, xy1 operand.Op) { ctx.VDIVPD(mxy, xy, xy1) } - -// VDIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPS xmm xmm xmm -// VDIVPS m128 xmm xmm -// VDIVPS ymm ymm ymm -// VDIVPS m256 ymm ymm -// Construct and append a VDIVPS instruction to the active function. -func (c *Context) VDIVPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VDIVPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPS xmm xmm xmm -// VDIVPS m128 xmm xmm -// VDIVPS ymm ymm ymm -// VDIVPS m256 ymm ymm -// Construct and append a VDIVPS instruction to the active function. -// Operates on the global context. -func VDIVPS(mxy, xy, xy1 operand.Op) { ctx.VDIVPS(mxy, xy, xy1) } - -// VDIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSD xmm xmm xmm -// VDIVSD m64 xmm xmm -// Construct and append a VDIVSD instruction to the active function. -func (c *Context) VDIVSD(mx, x, x1 operand.Op) { - if inst, err := x86.VDIVSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSD xmm xmm xmm -// VDIVSD m64 xmm xmm -// Construct and append a VDIVSD instruction to the active function. -// Operates on the global context. -func VDIVSD(mx, x, x1 operand.Op) { ctx.VDIVSD(mx, x, x1) } - -// VDIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSS xmm xmm xmm -// VDIVSS m32 xmm xmm -// Construct and append a VDIVSS instruction to the active function. -func (c *Context) VDIVSS(mx, x, x1 operand.Op) { - if inst, err := x86.VDIVSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSS xmm xmm xmm -// VDIVSS m32 xmm xmm -// Construct and append a VDIVSS instruction to the active function. -// Operates on the global context. -func VDIVSS(mx, x, x1 operand.Op) { ctx.VDIVSS(mx, x, x1) } - -// VDPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VDPPD imm8 xmm xmm xmm -// VDPPD imm8 m128 xmm xmm -// Construct and append a VDPPD instruction to the active function. -func (c *Context) VDPPD(i, mx, x, x1 operand.Op) { - if inst, err := x86.VDPPD(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VDPPD imm8 xmm xmm xmm -// VDPPD imm8 m128 xmm xmm -// Construct and append a VDPPD instruction to the active function. -// Operates on the global context. -func VDPPD(i, mx, x, x1 operand.Op) { ctx.VDPPD(i, mx, x, x1) } - -// VDPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VDPPS imm8 xmm xmm xmm -// VDPPS imm8 m128 xmm xmm -// VDPPS imm8 ymm ymm ymm -// VDPPS imm8 m256 ymm ymm -// Construct and append a VDPPS instruction to the active function. -func (c *Context) VDPPS(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VDPPS(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VDPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VDPPS imm8 xmm xmm xmm -// VDPPS imm8 m128 xmm xmm -// VDPPS imm8 ymm ymm ymm -// VDPPS imm8 m256 ymm ymm -// Construct and append a VDPPS instruction to the active function. -// Operates on the global context. -func VDPPS(i, mxy, xy, xy1 operand.Op) { ctx.VDPPS(i, mxy, xy, xy1) } - -// VEXTRACTF128: Extract Packed Floating-Point Values. -// -// Forms: -// -// VEXTRACTF128 imm8 ymm xmm -// VEXTRACTF128 imm8 ymm m128 -// Construct and append a VEXTRACTF128 instruction to the active function. -func (c *Context) VEXTRACTF128(i, y, mx operand.Op) { - if inst, err := x86.VEXTRACTF128(i, y, mx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VEXTRACTF128: Extract Packed Floating-Point Values. -// -// Forms: -// -// VEXTRACTF128 imm8 ymm xmm -// VEXTRACTF128 imm8 ymm m128 -// Construct and append a VEXTRACTF128 instruction to the active function. -// Operates on the global context. -func VEXTRACTF128(i, y, mx operand.Op) { ctx.VEXTRACTF128(i, y, mx) } - -// VEXTRACTI128: Extract Packed Integer Values. -// -// Forms: -// -// VEXTRACTI128 imm8 ymm xmm -// VEXTRACTI128 imm8 ymm m128 -// Construct and append a VEXTRACTI128 instruction to the active function. -func (c *Context) VEXTRACTI128(i, y, mx operand.Op) { - if inst, err := x86.VEXTRACTI128(i, y, mx); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VEXTRACTI128: Extract Packed Integer Values. -// -// Forms: -// -// VEXTRACTI128 imm8 ymm xmm -// VEXTRACTI128 imm8 ymm m128 -// Construct and append a VEXTRACTI128 instruction to the active function. -// Operates on the global context. -func VEXTRACTI128(i, y, mx operand.Op) { ctx.VEXTRACTI128(i, y, mx) } - -// VEXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VEXTRACTPS imm8 xmm r32 -// VEXTRACTPS imm8 xmm m32 -// Construct and append a VEXTRACTPS instruction to the active function. -func (c *Context) VEXTRACTPS(i, x, mr operand.Op) { - if inst, err := x86.VEXTRACTPS(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VEXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VEXTRACTPS imm8 xmm r32 -// VEXTRACTPS imm8 xmm m32 -// Construct and append a VEXTRACTPS instruction to the active function. -// Operates on the global context. -func VEXTRACTPS(i, x, mr operand.Op) { ctx.VEXTRACTPS(i, x, mr) } - -// VFMADD132PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PD xmm xmm xmm -// VFMADD132PD m128 xmm xmm -// VFMADD132PD ymm ymm ymm -// VFMADD132PD m256 ymm ymm -// Construct and append a VFMADD132PD instruction to the active function. -func (c *Context) VFMADD132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD132PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PD xmm xmm xmm -// VFMADD132PD m128 xmm xmm -// VFMADD132PD ymm ymm ymm -// VFMADD132PD m256 ymm ymm -// Construct and append a VFMADD132PD instruction to the active function. -// Operates on the global context. -func VFMADD132PD(mxy, xy, xy1 operand.Op) { ctx.VFMADD132PD(mxy, xy, xy1) } - -// VFMADD132PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PS xmm xmm xmm -// VFMADD132PS m128 xmm xmm -// VFMADD132PS ymm ymm ymm -// VFMADD132PS m256 ymm ymm -// Construct and append a VFMADD132PS instruction to the active function. -func (c *Context) VFMADD132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD132PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PS xmm xmm xmm -// VFMADD132PS m128 xmm xmm -// VFMADD132PS ymm ymm ymm -// VFMADD132PS m256 ymm ymm -// Construct and append a VFMADD132PS instruction to the active function. -// Operates on the global context. -func VFMADD132PS(mxy, xy, xy1 operand.Op) { ctx.VFMADD132PS(mxy, xy, xy1) } - -// VFMADD132SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SD xmm xmm xmm -// VFMADD132SD m64 xmm xmm -// Construct and append a VFMADD132SD instruction to the active function. -func (c *Context) VFMADD132SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD132SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD132SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SD xmm xmm xmm -// VFMADD132SD m64 xmm xmm -// Construct and append a VFMADD132SD instruction to the active function. -// Operates on the global context. -func VFMADD132SD(mx, x, x1 operand.Op) { ctx.VFMADD132SD(mx, x, x1) } - -// VFMADD132SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SS xmm xmm xmm -// VFMADD132SS m32 xmm xmm -// Construct and append a VFMADD132SS instruction to the active function. -func (c *Context) VFMADD132SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD132SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD132SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SS xmm xmm xmm -// VFMADD132SS m32 xmm xmm -// Construct and append a VFMADD132SS instruction to the active function. -// Operates on the global context. -func VFMADD132SS(mx, x, x1 operand.Op) { ctx.VFMADD132SS(mx, x, x1) } - -// VFMADD213PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PD xmm xmm xmm -// VFMADD213PD m128 xmm xmm -// VFMADD213PD ymm ymm ymm -// VFMADD213PD m256 ymm ymm -// Construct and append a VFMADD213PD instruction to the active function. -func (c *Context) VFMADD213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD213PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PD xmm xmm xmm -// VFMADD213PD m128 xmm xmm -// VFMADD213PD ymm ymm ymm -// VFMADD213PD m256 ymm ymm -// Construct and append a VFMADD213PD instruction to the active function. -// Operates on the global context. -func VFMADD213PD(mxy, xy, xy1 operand.Op) { ctx.VFMADD213PD(mxy, xy, xy1) } - -// VFMADD213PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PS xmm xmm xmm -// VFMADD213PS m128 xmm xmm -// VFMADD213PS ymm ymm ymm -// VFMADD213PS m256 ymm ymm -// Construct and append a VFMADD213PS instruction to the active function. -func (c *Context) VFMADD213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD213PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PS xmm xmm xmm -// VFMADD213PS m128 xmm xmm -// VFMADD213PS ymm ymm ymm -// VFMADD213PS m256 ymm ymm -// Construct and append a VFMADD213PS instruction to the active function. -// Operates on the global context. -func VFMADD213PS(mxy, xy, xy1 operand.Op) { ctx.VFMADD213PS(mxy, xy, xy1) } - -// VFMADD213SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SD xmm xmm xmm -// VFMADD213SD m64 xmm xmm -// Construct and append a VFMADD213SD instruction to the active function. -func (c *Context) VFMADD213SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD213SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD213SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SD xmm xmm xmm -// VFMADD213SD m64 xmm xmm -// Construct and append a VFMADD213SD instruction to the active function. -// Operates on the global context. -func VFMADD213SD(mx, x, x1 operand.Op) { ctx.VFMADD213SD(mx, x, x1) } - -// VFMADD213SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SS xmm xmm xmm -// VFMADD213SS m32 xmm xmm -// Construct and append a VFMADD213SS instruction to the active function. -func (c *Context) VFMADD213SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD213SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD213SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SS xmm xmm xmm -// VFMADD213SS m32 xmm xmm -// Construct and append a VFMADD213SS instruction to the active function. -// Operates on the global context. -func VFMADD213SS(mx, x, x1 operand.Op) { ctx.VFMADD213SS(mx, x, x1) } - -// VFMADD231PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PD xmm xmm xmm -// VFMADD231PD m128 xmm xmm -// VFMADD231PD ymm ymm ymm -// VFMADD231PD m256 ymm ymm -// Construct and append a VFMADD231PD instruction to the active function. -func (c *Context) VFMADD231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD231PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PD xmm xmm xmm -// VFMADD231PD m128 xmm xmm -// VFMADD231PD ymm ymm ymm -// VFMADD231PD m256 ymm ymm -// Construct and append a VFMADD231PD instruction to the active function. -// Operates on the global context. -func VFMADD231PD(mxy, xy, xy1 operand.Op) { ctx.VFMADD231PD(mxy, xy, xy1) } - -// VFMADD231PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PS xmm xmm xmm -// VFMADD231PS m128 xmm xmm -// VFMADD231PS ymm ymm ymm -// VFMADD231PS m256 ymm ymm -// Construct and append a VFMADD231PS instruction to the active function. -func (c *Context) VFMADD231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADD231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD231PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PS xmm xmm xmm -// VFMADD231PS m128 xmm xmm -// VFMADD231PS ymm ymm ymm -// VFMADD231PS m256 ymm ymm -// Construct and append a VFMADD231PS instruction to the active function. -// Operates on the global context. -func VFMADD231PS(mxy, xy, xy1 operand.Op) { ctx.VFMADD231PS(mxy, xy, xy1) } - -// VFMADD231SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SD xmm xmm xmm -// VFMADD231SD m64 xmm xmm -// Construct and append a VFMADD231SD instruction to the active function. -func (c *Context) VFMADD231SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD231SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD231SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SD xmm xmm xmm -// VFMADD231SD m64 xmm xmm -// Construct and append a VFMADD231SD instruction to the active function. -// Operates on the global context. -func VFMADD231SD(mx, x, x1 operand.Op) { ctx.VFMADD231SD(mx, x, x1) } - -// VFMADD231SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SS xmm xmm xmm -// VFMADD231SS m32 xmm xmm -// Construct and append a VFMADD231SS instruction to the active function. -func (c *Context) VFMADD231SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMADD231SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADD231SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SS xmm xmm xmm -// VFMADD231SS m32 xmm xmm -// Construct and append a VFMADD231SS instruction to the active function. -// Operates on the global context. -func VFMADD231SS(mx, x, x1 operand.Op) { ctx.VFMADD231SS(mx, x, x1) } - -// VFMADDSUB132PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PD xmm xmm xmm -// VFMADDSUB132PD m128 xmm xmm -// VFMADDSUB132PD ymm ymm ymm -// VFMADDSUB132PD m256 ymm ymm -// Construct and append a VFMADDSUB132PD instruction to the active function. -func (c *Context) VFMADDSUB132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB132PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PD xmm xmm xmm -// VFMADDSUB132PD m128 xmm xmm -// VFMADDSUB132PD ymm ymm ymm -// VFMADDSUB132PD m256 ymm ymm -// Construct and append a VFMADDSUB132PD instruction to the active function. -// Operates on the global context. -func VFMADDSUB132PD(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB132PD(mxy, xy, xy1) } - -// VFMADDSUB132PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PS xmm xmm xmm -// VFMADDSUB132PS m128 xmm xmm -// VFMADDSUB132PS ymm ymm ymm -// VFMADDSUB132PS m256 ymm ymm -// Construct and append a VFMADDSUB132PS instruction to the active function. -func (c *Context) VFMADDSUB132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB132PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PS xmm xmm xmm -// VFMADDSUB132PS m128 xmm xmm -// VFMADDSUB132PS ymm ymm ymm -// VFMADDSUB132PS m256 ymm ymm -// Construct and append a VFMADDSUB132PS instruction to the active function. -// Operates on the global context. -func VFMADDSUB132PS(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB132PS(mxy, xy, xy1) } - -// VFMADDSUB213PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PD xmm xmm xmm -// VFMADDSUB213PD m128 xmm xmm -// VFMADDSUB213PD ymm ymm ymm -// VFMADDSUB213PD m256 ymm ymm -// Construct and append a VFMADDSUB213PD instruction to the active function. -func (c *Context) VFMADDSUB213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB213PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PD xmm xmm xmm -// VFMADDSUB213PD m128 xmm xmm -// VFMADDSUB213PD ymm ymm ymm -// VFMADDSUB213PD m256 ymm ymm -// Construct and append a VFMADDSUB213PD instruction to the active function. -// Operates on the global context. -func VFMADDSUB213PD(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB213PD(mxy, xy, xy1) } - -// VFMADDSUB213PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PS xmm xmm xmm -// VFMADDSUB213PS m128 xmm xmm -// VFMADDSUB213PS ymm ymm ymm -// VFMADDSUB213PS m256 ymm ymm -// Construct and append a VFMADDSUB213PS instruction to the active function. -func (c *Context) VFMADDSUB213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB213PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PS xmm xmm xmm -// VFMADDSUB213PS m128 xmm xmm -// VFMADDSUB213PS ymm ymm ymm -// VFMADDSUB213PS m256 ymm ymm -// Construct and append a VFMADDSUB213PS instruction to the active function. -// Operates on the global context. -func VFMADDSUB213PS(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB213PS(mxy, xy, xy1) } - -// VFMADDSUB231PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PD xmm xmm xmm -// VFMADDSUB231PD m128 xmm xmm -// VFMADDSUB231PD ymm ymm ymm -// VFMADDSUB231PD m256 ymm ymm -// Construct and append a VFMADDSUB231PD instruction to the active function. -func (c *Context) VFMADDSUB231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB231PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PD xmm xmm xmm -// VFMADDSUB231PD m128 xmm xmm -// VFMADDSUB231PD ymm ymm ymm -// VFMADDSUB231PD m256 ymm ymm -// Construct and append a VFMADDSUB231PD instruction to the active function. -// Operates on the global context. -func VFMADDSUB231PD(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB231PD(mxy, xy, xy1) } - -// VFMADDSUB231PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PS xmm xmm xmm -// VFMADDSUB231PS m128 xmm xmm -// VFMADDSUB231PS ymm ymm ymm -// VFMADDSUB231PS m256 ymm ymm -// Construct and append a VFMADDSUB231PS instruction to the active function. -func (c *Context) VFMADDSUB231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMADDSUB231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMADDSUB231PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PS xmm xmm xmm -// VFMADDSUB231PS m128 xmm xmm -// VFMADDSUB231PS ymm ymm ymm -// VFMADDSUB231PS m256 ymm ymm -// Construct and append a VFMADDSUB231PS instruction to the active function. -// Operates on the global context. -func VFMADDSUB231PS(mxy, xy, xy1 operand.Op) { ctx.VFMADDSUB231PS(mxy, xy, xy1) } - -// VFMSUB132PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PD xmm xmm xmm -// VFMSUB132PD m128 xmm xmm -// VFMSUB132PD ymm ymm ymm -// VFMSUB132PD m256 ymm ymm -// Construct and append a VFMSUB132PD instruction to the active function. -func (c *Context) VFMSUB132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB132PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PD xmm xmm xmm -// VFMSUB132PD m128 xmm xmm -// VFMSUB132PD ymm ymm ymm -// VFMSUB132PD m256 ymm ymm -// Construct and append a VFMSUB132PD instruction to the active function. -// Operates on the global context. -func VFMSUB132PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUB132PD(mxy, xy, xy1) } - -// VFMSUB132PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PS xmm xmm xmm -// VFMSUB132PS m128 xmm xmm -// VFMSUB132PS ymm ymm ymm -// VFMSUB132PS m256 ymm ymm -// Construct and append a VFMSUB132PS instruction to the active function. -func (c *Context) VFMSUB132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB132PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PS xmm xmm xmm -// VFMSUB132PS m128 xmm xmm -// VFMSUB132PS ymm ymm ymm -// VFMSUB132PS m256 ymm ymm -// Construct and append a VFMSUB132PS instruction to the active function. -// Operates on the global context. -func VFMSUB132PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUB132PS(mxy, xy, xy1) } - -// VFMSUB132SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SD xmm xmm xmm -// VFMSUB132SD m64 xmm xmm -// Construct and append a VFMSUB132SD instruction to the active function. -func (c *Context) VFMSUB132SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB132SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB132SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SD xmm xmm xmm -// VFMSUB132SD m64 xmm xmm -// Construct and append a VFMSUB132SD instruction to the active function. -// Operates on the global context. -func VFMSUB132SD(mx, x, x1 operand.Op) { ctx.VFMSUB132SD(mx, x, x1) } - -// VFMSUB132SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SS xmm xmm xmm -// VFMSUB132SS m32 xmm xmm -// Construct and append a VFMSUB132SS instruction to the active function. -func (c *Context) VFMSUB132SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB132SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB132SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SS xmm xmm xmm -// VFMSUB132SS m32 xmm xmm -// Construct and append a VFMSUB132SS instruction to the active function. -// Operates on the global context. -func VFMSUB132SS(mx, x, x1 operand.Op) { ctx.VFMSUB132SS(mx, x, x1) } - -// VFMSUB213PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PD xmm xmm xmm -// VFMSUB213PD m128 xmm xmm -// VFMSUB213PD ymm ymm ymm -// VFMSUB213PD m256 ymm ymm -// Construct and append a VFMSUB213PD instruction to the active function. -func (c *Context) VFMSUB213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB213PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PD xmm xmm xmm -// VFMSUB213PD m128 xmm xmm -// VFMSUB213PD ymm ymm ymm -// VFMSUB213PD m256 ymm ymm -// Construct and append a VFMSUB213PD instruction to the active function. -// Operates on the global context. -func VFMSUB213PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUB213PD(mxy, xy, xy1) } - -// VFMSUB213PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PS xmm xmm xmm -// VFMSUB213PS m128 xmm xmm -// VFMSUB213PS ymm ymm ymm -// VFMSUB213PS m256 ymm ymm -// Construct and append a VFMSUB213PS instruction to the active function. -func (c *Context) VFMSUB213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB213PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PS xmm xmm xmm -// VFMSUB213PS m128 xmm xmm -// VFMSUB213PS ymm ymm ymm -// VFMSUB213PS m256 ymm ymm -// Construct and append a VFMSUB213PS instruction to the active function. -// Operates on the global context. -func VFMSUB213PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUB213PS(mxy, xy, xy1) } - -// VFMSUB213SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SD xmm xmm xmm -// VFMSUB213SD m64 xmm xmm -// Construct and append a VFMSUB213SD instruction to the active function. -func (c *Context) VFMSUB213SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB213SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB213SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SD xmm xmm xmm -// VFMSUB213SD m64 xmm xmm -// Construct and append a VFMSUB213SD instruction to the active function. -// Operates on the global context. -func VFMSUB213SD(mx, x, x1 operand.Op) { ctx.VFMSUB213SD(mx, x, x1) } - -// VFMSUB213SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SS xmm xmm xmm -// VFMSUB213SS m32 xmm xmm -// Construct and append a VFMSUB213SS instruction to the active function. -func (c *Context) VFMSUB213SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB213SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB213SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SS xmm xmm xmm -// VFMSUB213SS m32 xmm xmm -// Construct and append a VFMSUB213SS instruction to the active function. -// Operates on the global context. -func VFMSUB213SS(mx, x, x1 operand.Op) { ctx.VFMSUB213SS(mx, x, x1) } - -// VFMSUB231PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PD xmm xmm xmm -// VFMSUB231PD m128 xmm xmm -// VFMSUB231PD ymm ymm ymm -// VFMSUB231PD m256 ymm ymm -// Construct and append a VFMSUB231PD instruction to the active function. -func (c *Context) VFMSUB231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB231PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PD xmm xmm xmm -// VFMSUB231PD m128 xmm xmm -// VFMSUB231PD ymm ymm ymm -// VFMSUB231PD m256 ymm ymm -// Construct and append a VFMSUB231PD instruction to the active function. -// Operates on the global context. -func VFMSUB231PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUB231PD(mxy, xy, xy1) } - -// VFMSUB231PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PS xmm xmm xmm -// VFMSUB231PS m128 xmm xmm -// VFMSUB231PS ymm ymm ymm -// VFMSUB231PS m256 ymm ymm -// Construct and append a VFMSUB231PS instruction to the active function. -func (c *Context) VFMSUB231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUB231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB231PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PS xmm xmm xmm -// VFMSUB231PS m128 xmm xmm -// VFMSUB231PS ymm ymm ymm -// VFMSUB231PS m256 ymm ymm -// Construct and append a VFMSUB231PS instruction to the active function. -// Operates on the global context. -func VFMSUB231PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUB231PS(mxy, xy, xy1) } - -// VFMSUB231SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SD xmm xmm xmm -// VFMSUB231SD m64 xmm xmm -// Construct and append a VFMSUB231SD instruction to the active function. -func (c *Context) VFMSUB231SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB231SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB231SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SD xmm xmm xmm -// VFMSUB231SD m64 xmm xmm -// Construct and append a VFMSUB231SD instruction to the active function. -// Operates on the global context. -func VFMSUB231SD(mx, x, x1 operand.Op) { ctx.VFMSUB231SD(mx, x, x1) } - -// VFMSUB231SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SS xmm xmm xmm -// VFMSUB231SS m32 xmm xmm -// Construct and append a VFMSUB231SS instruction to the active function. -func (c *Context) VFMSUB231SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFMSUB231SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUB231SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SS xmm xmm xmm -// VFMSUB231SS m32 xmm xmm -// Construct and append a VFMSUB231SS instruction to the active function. -// Operates on the global context. -func VFMSUB231SS(mx, x, x1 operand.Op) { ctx.VFMSUB231SS(mx, x, x1) } - -// VFMSUBADD132PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PD xmm xmm xmm -// VFMSUBADD132PD m128 xmm xmm -// VFMSUBADD132PD ymm ymm ymm -// VFMSUBADD132PD m256 ymm ymm -// Construct and append a VFMSUBADD132PD instruction to the active function. -func (c *Context) VFMSUBADD132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD132PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PD xmm xmm xmm -// VFMSUBADD132PD m128 xmm xmm -// VFMSUBADD132PD ymm ymm ymm -// VFMSUBADD132PD m256 ymm ymm -// Construct and append a VFMSUBADD132PD instruction to the active function. -// Operates on the global context. -func VFMSUBADD132PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD132PD(mxy, xy, xy1) } - -// VFMSUBADD132PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PS xmm xmm xmm -// VFMSUBADD132PS m128 xmm xmm -// VFMSUBADD132PS ymm ymm ymm -// VFMSUBADD132PS m256 ymm ymm -// Construct and append a VFMSUBADD132PS instruction to the active function. -func (c *Context) VFMSUBADD132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD132PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PS xmm xmm xmm -// VFMSUBADD132PS m128 xmm xmm -// VFMSUBADD132PS ymm ymm ymm -// VFMSUBADD132PS m256 ymm ymm -// Construct and append a VFMSUBADD132PS instruction to the active function. -// Operates on the global context. -func VFMSUBADD132PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD132PS(mxy, xy, xy1) } - -// VFMSUBADD213PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PD xmm xmm xmm -// VFMSUBADD213PD m128 xmm xmm -// VFMSUBADD213PD ymm ymm ymm -// VFMSUBADD213PD m256 ymm ymm -// Construct and append a VFMSUBADD213PD instruction to the active function. -func (c *Context) VFMSUBADD213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD213PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PD xmm xmm xmm -// VFMSUBADD213PD m128 xmm xmm -// VFMSUBADD213PD ymm ymm ymm -// VFMSUBADD213PD m256 ymm ymm -// Construct and append a VFMSUBADD213PD instruction to the active function. -// Operates on the global context. -func VFMSUBADD213PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD213PD(mxy, xy, xy1) } - -// VFMSUBADD213PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PS xmm xmm xmm -// VFMSUBADD213PS m128 xmm xmm -// VFMSUBADD213PS ymm ymm ymm -// VFMSUBADD213PS m256 ymm ymm -// Construct and append a VFMSUBADD213PS instruction to the active function. -func (c *Context) VFMSUBADD213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD213PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PS xmm xmm xmm -// VFMSUBADD213PS m128 xmm xmm -// VFMSUBADD213PS ymm ymm ymm -// VFMSUBADD213PS m256 ymm ymm -// Construct and append a VFMSUBADD213PS instruction to the active function. -// Operates on the global context. -func VFMSUBADD213PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD213PS(mxy, xy, xy1) } - -// VFMSUBADD231PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PD xmm xmm xmm -// VFMSUBADD231PD m128 xmm xmm -// VFMSUBADD231PD ymm ymm ymm -// VFMSUBADD231PD m256 ymm ymm -// Construct and append a VFMSUBADD231PD instruction to the active function. -func (c *Context) VFMSUBADD231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD231PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PD xmm xmm xmm -// VFMSUBADD231PD m128 xmm xmm -// VFMSUBADD231PD ymm ymm ymm -// VFMSUBADD231PD m256 ymm ymm -// Construct and append a VFMSUBADD231PD instruction to the active function. -// Operates on the global context. -func VFMSUBADD231PD(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD231PD(mxy, xy, xy1) } - -// VFMSUBADD231PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PS xmm xmm xmm -// VFMSUBADD231PS m128 xmm xmm -// VFMSUBADD231PS ymm ymm ymm -// VFMSUBADD231PS m256 ymm ymm -// Construct and append a VFMSUBADD231PS instruction to the active function. -func (c *Context) VFMSUBADD231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFMSUBADD231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFMSUBADD231PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PS xmm xmm xmm -// VFMSUBADD231PS m128 xmm xmm -// VFMSUBADD231PS ymm ymm ymm -// VFMSUBADD231PS m256 ymm ymm -// Construct and append a VFMSUBADD231PS instruction to the active function. -// Operates on the global context. -func VFMSUBADD231PS(mxy, xy, xy1 operand.Op) { ctx.VFMSUBADD231PS(mxy, xy, xy1) } - -// VFNMADD132PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PD xmm xmm xmm -// VFNMADD132PD m128 xmm xmm -// VFNMADD132PD ymm ymm ymm -// VFNMADD132PD m256 ymm ymm -// Construct and append a VFNMADD132PD instruction to the active function. -func (c *Context) VFNMADD132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD132PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PD xmm xmm xmm -// VFNMADD132PD m128 xmm xmm -// VFNMADD132PD ymm ymm ymm -// VFNMADD132PD m256 ymm ymm -// Construct and append a VFNMADD132PD instruction to the active function. -// Operates on the global context. -func VFNMADD132PD(mxy, xy, xy1 operand.Op) { ctx.VFNMADD132PD(mxy, xy, xy1) } - -// VFNMADD132PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PS xmm xmm xmm -// VFNMADD132PS m128 xmm xmm -// VFNMADD132PS ymm ymm ymm -// VFNMADD132PS m256 ymm ymm -// Construct and append a VFNMADD132PS instruction to the active function. -func (c *Context) VFNMADD132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD132PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PS xmm xmm xmm -// VFNMADD132PS m128 xmm xmm -// VFNMADD132PS ymm ymm ymm -// VFNMADD132PS m256 ymm ymm -// Construct and append a VFNMADD132PS instruction to the active function. -// Operates on the global context. -func VFNMADD132PS(mxy, xy, xy1 operand.Op) { ctx.VFNMADD132PS(mxy, xy, xy1) } - -// VFNMADD132SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SD xmm xmm xmm -// VFNMADD132SD m64 xmm xmm -// Construct and append a VFNMADD132SD instruction to the active function. -func (c *Context) VFNMADD132SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD132SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD132SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SD xmm xmm xmm -// VFNMADD132SD m64 xmm xmm -// Construct and append a VFNMADD132SD instruction to the active function. -// Operates on the global context. -func VFNMADD132SD(mx, x, x1 operand.Op) { ctx.VFNMADD132SD(mx, x, x1) } - -// VFNMADD132SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SS xmm xmm xmm -// VFNMADD132SS m32 xmm xmm -// Construct and append a VFNMADD132SS instruction to the active function. -func (c *Context) VFNMADD132SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD132SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD132SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SS xmm xmm xmm -// VFNMADD132SS m32 xmm xmm -// Construct and append a VFNMADD132SS instruction to the active function. -// Operates on the global context. -func VFNMADD132SS(mx, x, x1 operand.Op) { ctx.VFNMADD132SS(mx, x, x1) } - -// VFNMADD213PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PD xmm xmm xmm -// VFNMADD213PD m128 xmm xmm -// VFNMADD213PD ymm ymm ymm -// VFNMADD213PD m256 ymm ymm -// Construct and append a VFNMADD213PD instruction to the active function. -func (c *Context) VFNMADD213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD213PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PD xmm xmm xmm -// VFNMADD213PD m128 xmm xmm -// VFNMADD213PD ymm ymm ymm -// VFNMADD213PD m256 ymm ymm -// Construct and append a VFNMADD213PD instruction to the active function. -// Operates on the global context. -func VFNMADD213PD(mxy, xy, xy1 operand.Op) { ctx.VFNMADD213PD(mxy, xy, xy1) } - -// VFNMADD213PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PS xmm xmm xmm -// VFNMADD213PS m128 xmm xmm -// VFNMADD213PS ymm ymm ymm -// VFNMADD213PS m256 ymm ymm -// Construct and append a VFNMADD213PS instruction to the active function. -func (c *Context) VFNMADD213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD213PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PS xmm xmm xmm -// VFNMADD213PS m128 xmm xmm -// VFNMADD213PS ymm ymm ymm -// VFNMADD213PS m256 ymm ymm -// Construct and append a VFNMADD213PS instruction to the active function. -// Operates on the global context. -func VFNMADD213PS(mxy, xy, xy1 operand.Op) { ctx.VFNMADD213PS(mxy, xy, xy1) } - -// VFNMADD213SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SD xmm xmm xmm -// VFNMADD213SD m64 xmm xmm -// Construct and append a VFNMADD213SD instruction to the active function. -func (c *Context) VFNMADD213SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD213SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD213SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SD xmm xmm xmm -// VFNMADD213SD m64 xmm xmm -// Construct and append a VFNMADD213SD instruction to the active function. -// Operates on the global context. -func VFNMADD213SD(mx, x, x1 operand.Op) { ctx.VFNMADD213SD(mx, x, x1) } - -// VFNMADD213SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SS xmm xmm xmm -// VFNMADD213SS m32 xmm xmm -// Construct and append a VFNMADD213SS instruction to the active function. -func (c *Context) VFNMADD213SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD213SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD213SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SS xmm xmm xmm -// VFNMADD213SS m32 xmm xmm -// Construct and append a VFNMADD213SS instruction to the active function. -// Operates on the global context. -func VFNMADD213SS(mx, x, x1 operand.Op) { ctx.VFNMADD213SS(mx, x, x1) } - -// VFNMADD231PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PD xmm xmm xmm -// VFNMADD231PD m128 xmm xmm -// VFNMADD231PD ymm ymm ymm -// VFNMADD231PD m256 ymm ymm -// Construct and append a VFNMADD231PD instruction to the active function. -func (c *Context) VFNMADD231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD231PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PD xmm xmm xmm -// VFNMADD231PD m128 xmm xmm -// VFNMADD231PD ymm ymm ymm -// VFNMADD231PD m256 ymm ymm -// Construct and append a VFNMADD231PD instruction to the active function. -// Operates on the global context. -func VFNMADD231PD(mxy, xy, xy1 operand.Op) { ctx.VFNMADD231PD(mxy, xy, xy1) } - -// VFNMADD231PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PS xmm xmm xmm -// VFNMADD231PS m128 xmm xmm -// VFNMADD231PS ymm ymm ymm -// VFNMADD231PS m256 ymm ymm -// Construct and append a VFNMADD231PS instruction to the active function. -func (c *Context) VFNMADD231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMADD231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD231PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PS xmm xmm xmm -// VFNMADD231PS m128 xmm xmm -// VFNMADD231PS ymm ymm ymm -// VFNMADD231PS m256 ymm ymm -// Construct and append a VFNMADD231PS instruction to the active function. -// Operates on the global context. -func VFNMADD231PS(mxy, xy, xy1 operand.Op) { ctx.VFNMADD231PS(mxy, xy, xy1) } - -// VFNMADD231SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SD xmm xmm xmm -// VFNMADD231SD m64 xmm xmm -// Construct and append a VFNMADD231SD instruction to the active function. -func (c *Context) VFNMADD231SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD231SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD231SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SD xmm xmm xmm -// VFNMADD231SD m64 xmm xmm -// Construct and append a VFNMADD231SD instruction to the active function. -// Operates on the global context. -func VFNMADD231SD(mx, x, x1 operand.Op) { ctx.VFNMADD231SD(mx, x, x1) } - -// VFNMADD231SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SS xmm xmm xmm -// VFNMADD231SS m32 xmm xmm -// Construct and append a VFNMADD231SS instruction to the active function. -func (c *Context) VFNMADD231SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMADD231SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMADD231SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SS xmm xmm xmm -// VFNMADD231SS m32 xmm xmm -// Construct and append a VFNMADD231SS instruction to the active function. -// Operates on the global context. -func VFNMADD231SS(mx, x, x1 operand.Op) { ctx.VFNMADD231SS(mx, x, x1) } - -// VFNMSUB132PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PD xmm xmm xmm -// VFNMSUB132PD m128 xmm xmm -// VFNMSUB132PD ymm ymm ymm -// VFNMSUB132PD m256 ymm ymm -// Construct and append a VFNMSUB132PD instruction to the active function. -func (c *Context) VFNMSUB132PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB132PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB132PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PD xmm xmm xmm -// VFNMSUB132PD m128 xmm xmm -// VFNMSUB132PD ymm ymm ymm -// VFNMSUB132PD m256 ymm ymm -// Construct and append a VFNMSUB132PD instruction to the active function. -// Operates on the global context. -func VFNMSUB132PD(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB132PD(mxy, xy, xy1) } - -// VFNMSUB132PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PS xmm xmm xmm -// VFNMSUB132PS m128 xmm xmm -// VFNMSUB132PS ymm ymm ymm -// VFNMSUB132PS m256 ymm ymm -// Construct and append a VFNMSUB132PS instruction to the active function. -func (c *Context) VFNMSUB132PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB132PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB132PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PS xmm xmm xmm -// VFNMSUB132PS m128 xmm xmm -// VFNMSUB132PS ymm ymm ymm -// VFNMSUB132PS m256 ymm ymm -// Construct and append a VFNMSUB132PS instruction to the active function. -// Operates on the global context. -func VFNMSUB132PS(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB132PS(mxy, xy, xy1) } - -// VFNMSUB132SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SD xmm xmm xmm -// VFNMSUB132SD m64 xmm xmm -// Construct and append a VFNMSUB132SD instruction to the active function. -func (c *Context) VFNMSUB132SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB132SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB132SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SD xmm xmm xmm -// VFNMSUB132SD m64 xmm xmm -// Construct and append a VFNMSUB132SD instruction to the active function. -// Operates on the global context. -func VFNMSUB132SD(mx, x, x1 operand.Op) { ctx.VFNMSUB132SD(mx, x, x1) } - -// VFNMSUB132SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SS xmm xmm xmm -// VFNMSUB132SS m32 xmm xmm -// Construct and append a VFNMSUB132SS instruction to the active function. -func (c *Context) VFNMSUB132SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB132SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB132SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SS xmm xmm xmm -// VFNMSUB132SS m32 xmm xmm -// Construct and append a VFNMSUB132SS instruction to the active function. -// Operates on the global context. -func VFNMSUB132SS(mx, x, x1 operand.Op) { ctx.VFNMSUB132SS(mx, x, x1) } - -// VFNMSUB213PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PD xmm xmm xmm -// VFNMSUB213PD m128 xmm xmm -// VFNMSUB213PD ymm ymm ymm -// VFNMSUB213PD m256 ymm ymm -// Construct and append a VFNMSUB213PD instruction to the active function. -func (c *Context) VFNMSUB213PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB213PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB213PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PD xmm xmm xmm -// VFNMSUB213PD m128 xmm xmm -// VFNMSUB213PD ymm ymm ymm -// VFNMSUB213PD m256 ymm ymm -// Construct and append a VFNMSUB213PD instruction to the active function. -// Operates on the global context. -func VFNMSUB213PD(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB213PD(mxy, xy, xy1) } - -// VFNMSUB213PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PS xmm xmm xmm -// VFNMSUB213PS m128 xmm xmm -// VFNMSUB213PS ymm ymm ymm -// VFNMSUB213PS m256 ymm ymm -// Construct and append a VFNMSUB213PS instruction to the active function. -func (c *Context) VFNMSUB213PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB213PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB213PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PS xmm xmm xmm -// VFNMSUB213PS m128 xmm xmm -// VFNMSUB213PS ymm ymm ymm -// VFNMSUB213PS m256 ymm ymm -// Construct and append a VFNMSUB213PS instruction to the active function. -// Operates on the global context. -func VFNMSUB213PS(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB213PS(mxy, xy, xy1) } - -// VFNMSUB213SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SD xmm xmm xmm -// VFNMSUB213SD m64 xmm xmm -// Construct and append a VFNMSUB213SD instruction to the active function. -func (c *Context) VFNMSUB213SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB213SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB213SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SD xmm xmm xmm -// VFNMSUB213SD m64 xmm xmm -// Construct and append a VFNMSUB213SD instruction to the active function. -// Operates on the global context. -func VFNMSUB213SD(mx, x, x1 operand.Op) { ctx.VFNMSUB213SD(mx, x, x1) } - -// VFNMSUB213SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SS xmm xmm xmm -// VFNMSUB213SS m32 xmm xmm -// Construct and append a VFNMSUB213SS instruction to the active function. -func (c *Context) VFNMSUB213SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB213SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB213SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SS xmm xmm xmm -// VFNMSUB213SS m32 xmm xmm -// Construct and append a VFNMSUB213SS instruction to the active function. -// Operates on the global context. -func VFNMSUB213SS(mx, x, x1 operand.Op) { ctx.VFNMSUB213SS(mx, x, x1) } - -// VFNMSUB231PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PD xmm xmm xmm -// VFNMSUB231PD m128 xmm xmm -// VFNMSUB231PD ymm ymm ymm -// VFNMSUB231PD m256 ymm ymm -// Construct and append a VFNMSUB231PD instruction to the active function. -func (c *Context) VFNMSUB231PD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB231PD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB231PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PD xmm xmm xmm -// VFNMSUB231PD m128 xmm xmm -// VFNMSUB231PD ymm ymm ymm -// VFNMSUB231PD m256 ymm ymm -// Construct and append a VFNMSUB231PD instruction to the active function. -// Operates on the global context. -func VFNMSUB231PD(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB231PD(mxy, xy, xy1) } - -// VFNMSUB231PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PS xmm xmm xmm -// VFNMSUB231PS m128 xmm xmm -// VFNMSUB231PS ymm ymm ymm -// VFNMSUB231PS m256 ymm ymm -// Construct and append a VFNMSUB231PS instruction to the active function. -func (c *Context) VFNMSUB231PS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VFNMSUB231PS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB231PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PS xmm xmm xmm -// VFNMSUB231PS m128 xmm xmm -// VFNMSUB231PS ymm ymm ymm -// VFNMSUB231PS m256 ymm ymm -// Construct and append a VFNMSUB231PS instruction to the active function. -// Operates on the global context. -func VFNMSUB231PS(mxy, xy, xy1 operand.Op) { ctx.VFNMSUB231PS(mxy, xy, xy1) } - -// VFNMSUB231SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SD xmm xmm xmm -// VFNMSUB231SD m64 xmm xmm -// Construct and append a VFNMSUB231SD instruction to the active function. -func (c *Context) VFNMSUB231SD(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB231SD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB231SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SD xmm xmm xmm -// VFNMSUB231SD m64 xmm xmm -// Construct and append a VFNMSUB231SD instruction to the active function. -// Operates on the global context. -func VFNMSUB231SD(mx, x, x1 operand.Op) { ctx.VFNMSUB231SD(mx, x, x1) } - -// VFNMSUB231SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SS xmm xmm xmm -// VFNMSUB231SS m32 xmm xmm -// Construct and append a VFNMSUB231SS instruction to the active function. -func (c *Context) VFNMSUB231SS(mx, x, x1 operand.Op) { - if inst, err := x86.VFNMSUB231SS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VFNMSUB231SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SS xmm xmm xmm -// VFNMSUB231SS m32 xmm xmm -// Construct and append a VFNMSUB231SS instruction to the active function. -// Operates on the global context. -func VFNMSUB231SS(mx, x, x1 operand.Op) { ctx.VFNMSUB231SS(mx, x, x1) } - -// VGATHERDPD: Gather Packed Double-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPD xmm vm32x xmm -// VGATHERDPD ymm vm32x ymm -// Construct and append a VGATHERDPD instruction to the active function. -func (c *Context) VGATHERDPD(xy, v, xy1 operand.Op) { - if inst, err := x86.VGATHERDPD(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VGATHERDPD: Gather Packed Double-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPD xmm vm32x xmm -// VGATHERDPD ymm vm32x ymm -// Construct and append a VGATHERDPD instruction to the active function. -// Operates on the global context. -func VGATHERDPD(xy, v, xy1 operand.Op) { ctx.VGATHERDPD(xy, v, xy1) } - -// VGATHERDPS: Gather Packed Single-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPS xmm vm32x xmm -// VGATHERDPS ymm vm32y ymm -// Construct and append a VGATHERDPS instruction to the active function. -func (c *Context) VGATHERDPS(xy, v, xy1 operand.Op) { - if inst, err := x86.VGATHERDPS(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VGATHERDPS: Gather Packed Single-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPS xmm vm32x xmm -// VGATHERDPS ymm vm32y ymm -// Construct and append a VGATHERDPS instruction to the active function. -// Operates on the global context. -func VGATHERDPS(xy, v, xy1 operand.Op) { ctx.VGATHERDPS(xy, v, xy1) } - -// VGATHERQPD: Gather Packed Double-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPD xmm vm64x xmm -// VGATHERQPD ymm vm64y ymm -// Construct and append a VGATHERQPD instruction to the active function. -func (c *Context) VGATHERQPD(xy, v, xy1 operand.Op) { - if inst, err := x86.VGATHERQPD(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VGATHERQPD: Gather Packed Double-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPD xmm vm64x xmm -// VGATHERQPD ymm vm64y ymm -// Construct and append a VGATHERQPD instruction to the active function. -// Operates on the global context. -func VGATHERQPD(xy, v, xy1 operand.Op) { ctx.VGATHERQPD(xy, v, xy1) } - -// VGATHERQPS: Gather Packed Single-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPS xmm vm64x xmm -// VGATHERQPS xmm vm64y xmm -// Construct and append a VGATHERQPS instruction to the active function. -func (c *Context) VGATHERQPS(x, v, x1 operand.Op) { - if inst, err := x86.VGATHERQPS(x, v, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VGATHERQPS: Gather Packed Single-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPS xmm vm64x xmm -// VGATHERQPS xmm vm64y xmm -// Construct and append a VGATHERQPS instruction to the active function. -// Operates on the global context. -func VGATHERQPS(x, v, x1 operand.Op) { ctx.VGATHERQPS(x, v, x1) } - -// VHADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// VHADDPD xmm xmm xmm -// VHADDPD m128 xmm xmm -// VHADDPD ymm ymm ymm -// VHADDPD m256 ymm ymm -// Construct and append a VHADDPD instruction to the active function. -func (c *Context) VHADDPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VHADDPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VHADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// VHADDPD xmm xmm xmm -// VHADDPD m128 xmm xmm -// VHADDPD ymm ymm ymm -// VHADDPD m256 ymm ymm -// Construct and append a VHADDPD instruction to the active function. -// Operates on the global context. -func VHADDPD(mxy, xy, xy1 operand.Op) { ctx.VHADDPD(mxy, xy, xy1) } - -// VHADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// VHADDPS xmm xmm xmm -// VHADDPS m128 xmm xmm -// VHADDPS ymm ymm ymm -// VHADDPS m256 ymm ymm -// Construct and append a VHADDPS instruction to the active function. -func (c *Context) VHADDPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VHADDPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VHADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// VHADDPS xmm xmm xmm -// VHADDPS m128 xmm xmm -// VHADDPS ymm ymm ymm -// VHADDPS m256 ymm ymm -// Construct and append a VHADDPS instruction to the active function. -// Operates on the global context. -func VHADDPS(mxy, xy, xy1 operand.Op) { ctx.VHADDPS(mxy, xy, xy1) } - -// VHSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPD xmm xmm xmm -// VHSUBPD m128 xmm xmm -// VHSUBPD ymm ymm ymm -// VHSUBPD m256 ymm ymm -// Construct and append a VHSUBPD instruction to the active function. -func (c *Context) VHSUBPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VHSUBPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VHSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPD xmm xmm xmm -// VHSUBPD m128 xmm xmm -// VHSUBPD ymm ymm ymm -// VHSUBPD m256 ymm ymm -// Construct and append a VHSUBPD instruction to the active function. -// Operates on the global context. -func VHSUBPD(mxy, xy, xy1 operand.Op) { ctx.VHSUBPD(mxy, xy, xy1) } - -// VHSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPS xmm xmm xmm -// VHSUBPS m128 xmm xmm -// VHSUBPS ymm ymm ymm -// VHSUBPS m256 ymm ymm -// Construct and append a VHSUBPS instruction to the active function. -func (c *Context) VHSUBPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VHSUBPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VHSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPS xmm xmm xmm -// VHSUBPS m128 xmm xmm -// VHSUBPS ymm ymm ymm -// VHSUBPS m256 ymm ymm -// Construct and append a VHSUBPS instruction to the active function. -// Operates on the global context. -func VHSUBPS(mxy, xy, xy1 operand.Op) { ctx.VHSUBPS(mxy, xy, xy1) } - -// VINSERTF128: Insert Packed Floating-Point Values. -// -// Forms: -// -// VINSERTF128 imm8 xmm ymm ymm -// VINSERTF128 imm8 m128 ymm ymm -// Construct and append a VINSERTF128 instruction to the active function. -func (c *Context) VINSERTF128(i, mx, y, y1 operand.Op) { - if inst, err := x86.VINSERTF128(i, mx, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VINSERTF128: Insert Packed Floating-Point Values. -// -// Forms: -// -// VINSERTF128 imm8 xmm ymm ymm -// VINSERTF128 imm8 m128 ymm ymm -// Construct and append a VINSERTF128 instruction to the active function. -// Operates on the global context. -func VINSERTF128(i, mx, y, y1 operand.Op) { ctx.VINSERTF128(i, mx, y, y1) } - -// VINSERTI128: Insert Packed Integer Values. -// -// Forms: -// -// VINSERTI128 imm8 xmm ymm ymm -// VINSERTI128 imm8 m128 ymm ymm -// Construct and append a VINSERTI128 instruction to the active function. -func (c *Context) VINSERTI128(i, mx, y, y1 operand.Op) { - if inst, err := x86.VINSERTI128(i, mx, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VINSERTI128: Insert Packed Integer Values. -// -// Forms: -// -// VINSERTI128 imm8 xmm ymm ymm -// VINSERTI128 imm8 m128 ymm ymm -// Construct and append a VINSERTI128 instruction to the active function. -// Operates on the global context. -func VINSERTI128(i, mx, y, y1 operand.Op) { ctx.VINSERTI128(i, mx, y, y1) } - -// VINSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VINSERTPS imm8 xmm xmm xmm -// VINSERTPS imm8 m32 xmm xmm -// Construct and append a VINSERTPS instruction to the active function. -func (c *Context) VINSERTPS(i, mx, x, x1 operand.Op) { - if inst, err := x86.VINSERTPS(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VINSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VINSERTPS imm8 xmm xmm xmm -// VINSERTPS imm8 m32 xmm xmm -// Construct and append a VINSERTPS instruction to the active function. -// Operates on the global context. -func VINSERTPS(i, mx, x, x1 operand.Op) { ctx.VINSERTPS(i, mx, x, x1) } - -// VLDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// VLDDQU m128 xmm -// VLDDQU m256 ymm -// Construct and append a VLDDQU instruction to the active function. -func (c *Context) VLDDQU(m, xy operand.Op) { - if inst, err := x86.VLDDQU(m, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VLDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// VLDDQU m128 xmm -// VLDDQU m256 ymm -// Construct and append a VLDDQU instruction to the active function. -// Operates on the global context. -func VLDDQU(m, xy operand.Op) { ctx.VLDDQU(m, xy) } - -// VLDMXCSR: Load MXCSR Register. -// -// Forms: -// -// VLDMXCSR m32 -// Construct and append a VLDMXCSR instruction to the active function. -func (c *Context) VLDMXCSR(m operand.Op) { - if inst, err := x86.VLDMXCSR(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VLDMXCSR: Load MXCSR Register. -// -// Forms: -// -// VLDMXCSR m32 -// Construct and append a VLDMXCSR instruction to the active function. -// Operates on the global context. -func VLDMXCSR(m operand.Op) { ctx.VLDMXCSR(m) } - -// VMASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// VMASKMOVDQU xmm xmm -// Construct and append a VMASKMOVDQU instruction to the active function. -func (c *Context) VMASKMOVDQU(x, x1 operand.Op) { - if inst, err := x86.VMASKMOVDQU(x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// VMASKMOVDQU xmm xmm -// Construct and append a VMASKMOVDQU instruction to the active function. -// Operates on the global context. -func VMASKMOVDQU(x, x1 operand.Op) { ctx.VMASKMOVDQU(x, x1) } - -// VMASKMOVPD: Conditional Move Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPD m128 xmm xmm -// VMASKMOVPD m256 ymm ymm -// VMASKMOVPD xmm xmm m128 -// VMASKMOVPD ymm ymm m256 -// Construct and append a VMASKMOVPD instruction to the active function. -func (c *Context) VMASKMOVPD(mxy, xy, mxy1 operand.Op) { - if inst, err := x86.VMASKMOVPD(mxy, xy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMASKMOVPD: Conditional Move Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPD m128 xmm xmm -// VMASKMOVPD m256 ymm ymm -// VMASKMOVPD xmm xmm m128 -// VMASKMOVPD ymm ymm m256 -// Construct and append a VMASKMOVPD instruction to the active function. -// Operates on the global context. -func VMASKMOVPD(mxy, xy, mxy1 operand.Op) { ctx.VMASKMOVPD(mxy, xy, mxy1) } - -// VMASKMOVPS: Conditional Move Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPS m128 xmm xmm -// VMASKMOVPS m256 ymm ymm -// VMASKMOVPS xmm xmm m128 -// VMASKMOVPS ymm ymm m256 -// Construct and append a VMASKMOVPS instruction to the active function. -func (c *Context) VMASKMOVPS(mxy, xy, mxy1 operand.Op) { - if inst, err := x86.VMASKMOVPS(mxy, xy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMASKMOVPS: Conditional Move Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPS m128 xmm xmm -// VMASKMOVPS m256 ymm ymm -// VMASKMOVPS xmm xmm m128 -// VMASKMOVPS ymm ymm m256 -// Construct and append a VMASKMOVPS instruction to the active function. -// Operates on the global context. -func VMASKMOVPS(mxy, xy, mxy1 operand.Op) { ctx.VMASKMOVPS(mxy, xy, mxy1) } - -// VMAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPD xmm xmm xmm -// VMAXPD m128 xmm xmm -// VMAXPD ymm ymm ymm -// VMAXPD m256 ymm ymm -// Construct and append a VMAXPD instruction to the active function. -func (c *Context) VMAXPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMAXPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPD xmm xmm xmm -// VMAXPD m128 xmm xmm -// VMAXPD ymm ymm ymm -// VMAXPD m256 ymm ymm -// Construct and append a VMAXPD instruction to the active function. -// Operates on the global context. -func VMAXPD(mxy, xy, xy1 operand.Op) { ctx.VMAXPD(mxy, xy, xy1) } - -// VMAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPS xmm xmm xmm -// VMAXPS m128 xmm xmm -// VMAXPS ymm ymm ymm -// VMAXPS m256 ymm ymm -// Construct and append a VMAXPS instruction to the active function. -func (c *Context) VMAXPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMAXPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPS xmm xmm xmm -// VMAXPS m128 xmm xmm -// VMAXPS ymm ymm ymm -// VMAXPS m256 ymm ymm -// Construct and append a VMAXPS instruction to the active function. -// Operates on the global context. -func VMAXPS(mxy, xy, xy1 operand.Op) { ctx.VMAXPS(mxy, xy, xy1) } - -// VMAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSD xmm xmm xmm -// VMAXSD m64 xmm xmm -// Construct and append a VMAXSD instruction to the active function. -func (c *Context) VMAXSD(mx, x, x1 operand.Op) { - if inst, err := x86.VMAXSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSD xmm xmm xmm -// VMAXSD m64 xmm xmm -// Construct and append a VMAXSD instruction to the active function. -// Operates on the global context. -func VMAXSD(mx, x, x1 operand.Op) { ctx.VMAXSD(mx, x, x1) } - -// VMAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSS xmm xmm xmm -// VMAXSS m32 xmm xmm -// Construct and append a VMAXSS instruction to the active function. -func (c *Context) VMAXSS(mx, x, x1 operand.Op) { - if inst, err := x86.VMAXSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSS xmm xmm xmm -// VMAXSS m32 xmm xmm -// Construct and append a VMAXSS instruction to the active function. -// Operates on the global context. -func VMAXSS(mx, x, x1 operand.Op) { ctx.VMAXSS(mx, x, x1) } - -// VMINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMINPD xmm xmm xmm -// VMINPD m128 xmm xmm -// VMINPD ymm ymm ymm -// VMINPD m256 ymm ymm -// Construct and append a VMINPD instruction to the active function. -func (c *Context) VMINPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMINPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMINPD xmm xmm xmm -// VMINPD m128 xmm xmm -// VMINPD ymm ymm ymm -// VMINPD m256 ymm ymm -// Construct and append a VMINPD instruction to the active function. -// Operates on the global context. -func VMINPD(mxy, xy, xy1 operand.Op) { ctx.VMINPD(mxy, xy, xy1) } - -// VMINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMINPS xmm xmm xmm -// VMINPS m128 xmm xmm -// VMINPS ymm ymm ymm -// VMINPS m256 ymm ymm -// Construct and append a VMINPS instruction to the active function. -func (c *Context) VMINPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMINPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMINPS xmm xmm xmm -// VMINPS m128 xmm xmm -// VMINPS ymm ymm ymm -// VMINPS m256 ymm ymm -// Construct and append a VMINPS instruction to the active function. -// Operates on the global context. -func VMINPS(mxy, xy, xy1 operand.Op) { ctx.VMINPS(mxy, xy, xy1) } - -// VMINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMINSD xmm xmm xmm -// VMINSD m64 xmm xmm -// Construct and append a VMINSD instruction to the active function. -func (c *Context) VMINSD(mx, x, x1 operand.Op) { - if inst, err := x86.VMINSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMINSD xmm xmm xmm -// VMINSD m64 xmm xmm -// Construct and append a VMINSD instruction to the active function. -// Operates on the global context. -func VMINSD(mx, x, x1 operand.Op) { ctx.VMINSD(mx, x, x1) } - -// VMINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMINSS xmm xmm xmm -// VMINSS m32 xmm xmm -// Construct and append a VMINSS instruction to the active function. -func (c *Context) VMINSS(mx, x, x1 operand.Op) { - if inst, err := x86.VMINSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMINSS xmm xmm xmm -// VMINSS m32 xmm xmm -// Construct and append a VMINSS instruction to the active function. -// Operates on the global context. -func VMINSS(mx, x, x1 operand.Op) { ctx.VMINSS(mx, x, x1) } - -// VMOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPD xmm xmm -// VMOVAPD m128 xmm -// VMOVAPD ymm ymm -// VMOVAPD m256 ymm -// VMOVAPD xmm m128 -// VMOVAPD ymm m256 -// Construct and append a VMOVAPD instruction to the active function. -func (c *Context) VMOVAPD(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVAPD(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPD xmm xmm -// VMOVAPD m128 xmm -// VMOVAPD ymm ymm -// VMOVAPD m256 ymm -// VMOVAPD xmm m128 -// VMOVAPD ymm m256 -// Construct and append a VMOVAPD instruction to the active function. -// Operates on the global context. -func VMOVAPD(mxy, mxy1 operand.Op) { ctx.VMOVAPD(mxy, mxy1) } - -// VMOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPS xmm xmm -// VMOVAPS m128 xmm -// VMOVAPS ymm ymm -// VMOVAPS m256 ymm -// VMOVAPS xmm m128 -// VMOVAPS ymm m256 -// Construct and append a VMOVAPS instruction to the active function. -func (c *Context) VMOVAPS(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVAPS(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPS xmm xmm -// VMOVAPS m128 xmm -// VMOVAPS ymm ymm -// VMOVAPS m256 ymm -// VMOVAPS xmm m128 -// VMOVAPS ymm m256 -// Construct and append a VMOVAPS instruction to the active function. -// Operates on the global context. -func VMOVAPS(mxy, mxy1 operand.Op) { ctx.VMOVAPS(mxy, mxy1) } - -// VMOVD: Move Doubleword. -// -// Forms: -// -// VMOVD xmm r32 -// VMOVD r32 xmm -// VMOVD m32 xmm -// VMOVD xmm m32 -// Construct and append a VMOVD instruction to the active function. -func (c *Context) VMOVD(mrx, mrx1 operand.Op) { - if inst, err := x86.VMOVD(mrx, mrx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVD: Move Doubleword. -// -// Forms: -// -// VMOVD xmm r32 -// VMOVD r32 xmm -// VMOVD m32 xmm -// VMOVD xmm m32 -// Construct and append a VMOVD instruction to the active function. -// Operates on the global context. -func VMOVD(mrx, mrx1 operand.Op) { ctx.VMOVD(mrx, mrx1) } - -// VMOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// VMOVDDUP xmm xmm -// VMOVDDUP m64 xmm -// VMOVDDUP ymm ymm -// VMOVDDUP m256 ymm -// Construct and append a VMOVDDUP instruction to the active function. -func (c *Context) VMOVDDUP(mxy, xy operand.Op) { - if inst, err := x86.VMOVDDUP(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// VMOVDDUP xmm xmm -// VMOVDDUP m64 xmm -// VMOVDDUP ymm ymm -// VMOVDDUP m256 ymm -// Construct and append a VMOVDDUP instruction to the active function. -// Operates on the global context. -func VMOVDDUP(mxy, xy operand.Op) { ctx.VMOVDDUP(mxy, xy) } - -// VMOVDQA: Move Aligned Double Quadword. -// -// Forms: -// -// VMOVDQA xmm xmm -// VMOVDQA m128 xmm -// VMOVDQA ymm ymm -// VMOVDQA m256 ymm -// VMOVDQA xmm m128 -// VMOVDQA ymm m256 -// Construct and append a VMOVDQA instruction to the active function. -func (c *Context) VMOVDQA(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVDQA(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVDQA: Move Aligned Double Quadword. -// -// Forms: -// -// VMOVDQA xmm xmm -// VMOVDQA m128 xmm -// VMOVDQA ymm ymm -// VMOVDQA m256 ymm -// VMOVDQA xmm m128 -// VMOVDQA ymm m256 -// Construct and append a VMOVDQA instruction to the active function. -// Operates on the global context. -func VMOVDQA(mxy, mxy1 operand.Op) { ctx.VMOVDQA(mxy, mxy1) } - -// VMOVDQU: Move Unaligned Double Quadword. -// -// Forms: -// -// VMOVDQU xmm xmm -// VMOVDQU m128 xmm -// VMOVDQU ymm ymm -// VMOVDQU m256 ymm -// VMOVDQU xmm m128 -// VMOVDQU ymm m256 -// Construct and append a VMOVDQU instruction to the active function. -func (c *Context) VMOVDQU(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVDQU(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVDQU: Move Unaligned Double Quadword. -// -// Forms: -// -// VMOVDQU xmm xmm -// VMOVDQU m128 xmm -// VMOVDQU ymm ymm -// VMOVDQU m256 ymm -// VMOVDQU xmm m128 -// VMOVDQU ymm m256 -// Construct and append a VMOVDQU instruction to the active function. -// Operates on the global context. -func VMOVDQU(mxy, mxy1 operand.Op) { ctx.VMOVDQU(mxy, mxy1) } - -// VMOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// VMOVHLPS xmm xmm xmm -// Construct and append a VMOVHLPS instruction to the active function. -func (c *Context) VMOVHLPS(x, x1, x2 operand.Op) { - if inst, err := x86.VMOVHLPS(x, x1, x2); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// VMOVHLPS xmm xmm xmm -// Construct and append a VMOVHLPS instruction to the active function. -// Operates on the global context. -func VMOVHLPS(x, x1, x2 operand.Op) { ctx.VMOVHLPS(x, x1, x2) } - -// VMOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVHPD xmm m64 -// VMOVHPD m64 xmm xmm -// Construct and append a VMOVHPD instruction to the active function. -func (c *Context) VMOVHPD(ops ...operand.Op) { - if inst, err := x86.VMOVHPD(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVHPD xmm m64 -// VMOVHPD m64 xmm xmm -// Construct and append a VMOVHPD instruction to the active function. -// Operates on the global context. -func VMOVHPD(ops ...operand.Op) { ctx.VMOVHPD(ops...) } - -// VMOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVHPS xmm m64 -// VMOVHPS m64 xmm xmm -// Construct and append a VMOVHPS instruction to the active function. -func (c *Context) VMOVHPS(ops ...operand.Op) { - if inst, err := x86.VMOVHPS(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVHPS xmm m64 -// VMOVHPS m64 xmm xmm -// Construct and append a VMOVHPS instruction to the active function. -// Operates on the global context. -func VMOVHPS(ops ...operand.Op) { ctx.VMOVHPS(ops...) } - -// VMOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// VMOVLHPS xmm xmm xmm -// Construct and append a VMOVLHPS instruction to the active function. -func (c *Context) VMOVLHPS(x, x1, x2 operand.Op) { - if inst, err := x86.VMOVLHPS(x, x1, x2); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// VMOVLHPS xmm xmm xmm -// Construct and append a VMOVLHPS instruction to the active function. -// Operates on the global context. -func VMOVLHPS(x, x1, x2 operand.Op) { ctx.VMOVLHPS(x, x1, x2) } - -// VMOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVLPD xmm m64 -// VMOVLPD m64 xmm xmm -// Construct and append a VMOVLPD instruction to the active function. -func (c *Context) VMOVLPD(ops ...operand.Op) { - if inst, err := x86.VMOVLPD(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVLPD xmm m64 -// VMOVLPD m64 xmm xmm -// Construct and append a VMOVLPD instruction to the active function. -// Operates on the global context. -func VMOVLPD(ops ...operand.Op) { ctx.VMOVLPD(ops...) } - -// VMOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVLPS xmm m64 -// VMOVLPS m64 xmm xmm -// Construct and append a VMOVLPS instruction to the active function. -func (c *Context) VMOVLPS(ops ...operand.Op) { - if inst, err := x86.VMOVLPS(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVLPS xmm m64 -// VMOVLPS m64 xmm xmm -// Construct and append a VMOVLPS instruction to the active function. -// Operates on the global context. -func VMOVLPS(ops ...operand.Op) { ctx.VMOVLPS(ops...) } - -// VMOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPD xmm r32 -// VMOVMSKPD ymm r32 -// Construct and append a VMOVMSKPD instruction to the active function. -func (c *Context) VMOVMSKPD(xy, r operand.Op) { - if inst, err := x86.VMOVMSKPD(xy, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPD xmm r32 -// VMOVMSKPD ymm r32 -// Construct and append a VMOVMSKPD instruction to the active function. -// Operates on the global context. -func VMOVMSKPD(xy, r operand.Op) { ctx.VMOVMSKPD(xy, r) } - -// VMOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPS xmm r32 -// VMOVMSKPS ymm r32 -// Construct and append a VMOVMSKPS instruction to the active function. -func (c *Context) VMOVMSKPS(xy, r operand.Op) { - if inst, err := x86.VMOVMSKPS(xy, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPS xmm r32 -// VMOVMSKPS ymm r32 -// Construct and append a VMOVMSKPS instruction to the active function. -// Operates on the global context. -func VMOVMSKPS(xy, r operand.Op) { ctx.VMOVMSKPS(xy, r) } - -// VMOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTDQ xmm m128 -// VMOVNTDQ ymm m256 -// Construct and append a VMOVNTDQ instruction to the active function. -func (c *Context) VMOVNTDQ(xy, m operand.Op) { - if inst, err := x86.VMOVNTDQ(xy, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTDQ xmm m128 -// VMOVNTDQ ymm m256 -// Construct and append a VMOVNTDQ instruction to the active function. -// Operates on the global context. -func VMOVNTDQ(xy, m operand.Op) { ctx.VMOVNTDQ(xy, m) } - -// VMOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// VMOVNTDQA m128 xmm -// VMOVNTDQA m256 ymm -// Construct and append a VMOVNTDQA instruction to the active function. -func (c *Context) VMOVNTDQA(m, xy operand.Op) { - if inst, err := x86.VMOVNTDQA(m, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// VMOVNTDQA m128 xmm -// VMOVNTDQA m256 ymm -// Construct and append a VMOVNTDQA instruction to the active function. -// Operates on the global context. -func VMOVNTDQA(m, xy operand.Op) { ctx.VMOVNTDQA(m, xy) } - -// VMOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPD xmm m128 -// VMOVNTPD ymm m256 -// Construct and append a VMOVNTPD instruction to the active function. -func (c *Context) VMOVNTPD(xy, m operand.Op) { - if inst, err := x86.VMOVNTPD(xy, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPD xmm m128 -// VMOVNTPD ymm m256 -// Construct and append a VMOVNTPD instruction to the active function. -// Operates on the global context. -func VMOVNTPD(xy, m operand.Op) { ctx.VMOVNTPD(xy, m) } - -// VMOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPS xmm m128 -// VMOVNTPS ymm m256 -// Construct and append a VMOVNTPS instruction to the active function. -func (c *Context) VMOVNTPS(xy, m operand.Op) { - if inst, err := x86.VMOVNTPS(xy, m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPS xmm m128 -// VMOVNTPS ymm m256 -// Construct and append a VMOVNTPS instruction to the active function. -// Operates on the global context. -func VMOVNTPS(xy, m operand.Op) { ctx.VMOVNTPS(xy, m) } - -// VMOVQ: Move Quadword. -// -// Forms: -// -// VMOVQ xmm r64 -// VMOVQ r64 xmm -// VMOVQ xmm xmm -// VMOVQ m64 xmm -// VMOVQ xmm m64 -// Construct and append a VMOVQ instruction to the active function. -func (c *Context) VMOVQ(mrx, mrx1 operand.Op) { - if inst, err := x86.VMOVQ(mrx, mrx1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVQ: Move Quadword. -// -// Forms: -// -// VMOVQ xmm r64 -// VMOVQ r64 xmm -// VMOVQ xmm xmm -// VMOVQ m64 xmm -// VMOVQ xmm m64 -// Construct and append a VMOVQ instruction to the active function. -// Operates on the global context. -func VMOVQ(mrx, mrx1 operand.Op) { ctx.VMOVQ(mrx, mrx1) } - -// VMOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVSD m64 xmm -// VMOVSD xmm m64 -// VMOVSD xmm xmm xmm -// Construct and append a VMOVSD instruction to the active function. -func (c *Context) VMOVSD(ops ...operand.Op) { - if inst, err := x86.VMOVSD(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVSD m64 xmm -// VMOVSD xmm m64 -// VMOVSD xmm xmm xmm -// Construct and append a VMOVSD instruction to the active function. -// Operates on the global context. -func VMOVSD(ops ...operand.Op) { ctx.VMOVSD(ops...) } - -// VMOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// VMOVSHDUP xmm xmm -// VMOVSHDUP m128 xmm -// VMOVSHDUP ymm ymm -// VMOVSHDUP m256 ymm -// Construct and append a VMOVSHDUP instruction to the active function. -func (c *Context) VMOVSHDUP(mxy, xy operand.Op) { - if inst, err := x86.VMOVSHDUP(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// VMOVSHDUP xmm xmm -// VMOVSHDUP m128 xmm -// VMOVSHDUP ymm ymm -// VMOVSHDUP m256 ymm -// Construct and append a VMOVSHDUP instruction to the active function. -// Operates on the global context. -func VMOVSHDUP(mxy, xy operand.Op) { ctx.VMOVSHDUP(mxy, xy) } - -// VMOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// VMOVSLDUP xmm xmm -// VMOVSLDUP m128 xmm -// VMOVSLDUP ymm ymm -// VMOVSLDUP m256 ymm -// Construct and append a VMOVSLDUP instruction to the active function. -func (c *Context) VMOVSLDUP(mxy, xy operand.Op) { - if inst, err := x86.VMOVSLDUP(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// VMOVSLDUP xmm xmm -// VMOVSLDUP m128 xmm -// VMOVSLDUP ymm ymm -// VMOVSLDUP m256 ymm -// Construct and append a VMOVSLDUP instruction to the active function. -// Operates on the global context. -func VMOVSLDUP(mxy, xy operand.Op) { ctx.VMOVSLDUP(mxy, xy) } - -// VMOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVSS m32 xmm -// VMOVSS xmm m32 -// VMOVSS xmm xmm xmm -// Construct and append a VMOVSS instruction to the active function. -func (c *Context) VMOVSS(ops ...operand.Op) { - if inst, err := x86.VMOVSS(ops...); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVSS m32 xmm -// VMOVSS xmm m32 -// VMOVSS xmm xmm xmm -// Construct and append a VMOVSS instruction to the active function. -// Operates on the global context. -func VMOVSS(ops ...operand.Op) { ctx.VMOVSS(ops...) } - -// VMOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPD xmm xmm -// VMOVUPD m128 xmm -// VMOVUPD ymm ymm -// VMOVUPD m256 ymm -// VMOVUPD xmm m128 -// VMOVUPD ymm m256 -// Construct and append a VMOVUPD instruction to the active function. -func (c *Context) VMOVUPD(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVUPD(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPD xmm xmm -// VMOVUPD m128 xmm -// VMOVUPD ymm ymm -// VMOVUPD m256 ymm -// VMOVUPD xmm m128 -// VMOVUPD ymm m256 -// Construct and append a VMOVUPD instruction to the active function. -// Operates on the global context. -func VMOVUPD(mxy, mxy1 operand.Op) { ctx.VMOVUPD(mxy, mxy1) } - -// VMOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPS xmm xmm -// VMOVUPS m128 xmm -// VMOVUPS ymm ymm -// VMOVUPS m256 ymm -// VMOVUPS xmm m128 -// VMOVUPS ymm m256 -// Construct and append a VMOVUPS instruction to the active function. -func (c *Context) VMOVUPS(mxy, mxy1 operand.Op) { - if inst, err := x86.VMOVUPS(mxy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPS xmm xmm -// VMOVUPS m128 xmm -// VMOVUPS ymm ymm -// VMOVUPS m256 ymm -// VMOVUPS xmm m128 -// VMOVUPS ymm m256 -// Construct and append a VMOVUPS instruction to the active function. -// Operates on the global context. -func VMOVUPS(mxy, mxy1 operand.Op) { ctx.VMOVUPS(mxy, mxy1) } - -// VMPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// VMPSADBW imm8 xmm xmm xmm -// VMPSADBW imm8 m128 xmm xmm -// VMPSADBW imm8 ymm ymm ymm -// VMPSADBW imm8 m256 ymm ymm -// Construct and append a VMPSADBW instruction to the active function. -func (c *Context) VMPSADBW(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMPSADBW(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// VMPSADBW imm8 xmm xmm xmm -// VMPSADBW imm8 m128 xmm xmm -// VMPSADBW imm8 ymm ymm ymm -// VMPSADBW imm8 m256 ymm ymm -// Construct and append a VMPSADBW instruction to the active function. -// Operates on the global context. -func VMPSADBW(i, mxy, xy, xy1 operand.Op) { ctx.VMPSADBW(i, mxy, xy, xy1) } - -// VMULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULPD xmm xmm xmm -// VMULPD m128 xmm xmm -// VMULPD ymm ymm ymm -// VMULPD m256 ymm ymm -// Construct and append a VMULPD instruction to the active function. -func (c *Context) VMULPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMULPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULPD xmm xmm xmm -// VMULPD m128 xmm xmm -// VMULPD ymm ymm ymm -// VMULPD m256 ymm ymm -// Construct and append a VMULPD instruction to the active function. -// Operates on the global context. -func VMULPD(mxy, xy, xy1 operand.Op) { ctx.VMULPD(mxy, xy, xy1) } - -// VMULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULPS xmm xmm xmm -// VMULPS m128 xmm xmm -// VMULPS ymm ymm ymm -// VMULPS m256 ymm ymm -// Construct and append a VMULPS instruction to the active function. -func (c *Context) VMULPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VMULPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULPS xmm xmm xmm -// VMULPS m128 xmm xmm -// VMULPS ymm ymm ymm -// VMULPS m256 ymm ymm -// Construct and append a VMULPS instruction to the active function. -// Operates on the global context. -func VMULPS(mxy, xy, xy1 operand.Op) { ctx.VMULPS(mxy, xy, xy1) } - -// VMULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULSD xmm xmm xmm -// VMULSD m64 xmm xmm -// Construct and append a VMULSD instruction to the active function. -func (c *Context) VMULSD(mx, x, x1 operand.Op) { - if inst, err := x86.VMULSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULSD xmm xmm xmm -// VMULSD m64 xmm xmm -// Construct and append a VMULSD instruction to the active function. -// Operates on the global context. -func VMULSD(mx, x, x1 operand.Op) { ctx.VMULSD(mx, x, x1) } - -// VMULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULSS xmm xmm xmm -// VMULSS m32 xmm xmm -// Construct and append a VMULSS instruction to the active function. -func (c *Context) VMULSS(mx, x, x1 operand.Op) { - if inst, err := x86.VMULSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VMULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULSS xmm xmm xmm -// VMULSS m32 xmm xmm -// Construct and append a VMULSS instruction to the active function. -// Operates on the global context. -func VMULSS(mx, x, x1 operand.Op) { ctx.VMULSS(mx, x, x1) } - -// VORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// VORPD xmm xmm xmm -// VORPD m128 xmm xmm -// VORPD ymm ymm ymm -// VORPD m256 ymm ymm -// Construct and append a VORPD instruction to the active function. -func (c *Context) VORPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VORPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// VORPD xmm xmm xmm -// VORPD m128 xmm xmm -// VORPD ymm ymm ymm -// VORPD m256 ymm ymm -// Construct and append a VORPD instruction to the active function. -// Operates on the global context. -func VORPD(mxy, xy, xy1 operand.Op) { ctx.VORPD(mxy, xy, xy1) } - -// VORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// VORPS xmm xmm xmm -// VORPS m128 xmm xmm -// VORPS ymm ymm ymm -// VORPS m256 ymm ymm -// Construct and append a VORPS instruction to the active function. -func (c *Context) VORPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VORPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// VORPS xmm xmm xmm -// VORPS m128 xmm xmm -// VORPS ymm ymm ymm -// VORPS m256 ymm ymm -// Construct and append a VORPS instruction to the active function. -// Operates on the global context. -func VORPS(mxy, xy, xy1 operand.Op) { ctx.VORPS(mxy, xy, xy1) } - -// VPABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// VPABSB xmm xmm -// VPABSB m128 xmm -// VPABSB ymm ymm -// VPABSB m256 ymm -// Construct and append a VPABSB instruction to the active function. -func (c *Context) VPABSB(mxy, xy operand.Op) { - if inst, err := x86.VPABSB(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// VPABSB xmm xmm -// VPABSB m128 xmm -// VPABSB ymm ymm -// VPABSB m256 ymm -// Construct and append a VPABSB instruction to the active function. -// Operates on the global context. -func VPABSB(mxy, xy operand.Op) { ctx.VPABSB(mxy, xy) } - -// VPABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// VPABSD xmm xmm -// VPABSD m128 xmm -// VPABSD ymm ymm -// VPABSD m256 ymm -// Construct and append a VPABSD instruction to the active function. -func (c *Context) VPABSD(mxy, xy operand.Op) { - if inst, err := x86.VPABSD(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// VPABSD xmm xmm -// VPABSD m128 xmm -// VPABSD ymm ymm -// VPABSD m256 ymm -// Construct and append a VPABSD instruction to the active function. -// Operates on the global context. -func VPABSD(mxy, xy operand.Op) { ctx.VPABSD(mxy, xy) } - -// VPABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// VPABSW xmm xmm -// VPABSW m128 xmm -// VPABSW ymm ymm -// VPABSW m256 ymm -// Construct and append a VPABSW instruction to the active function. -func (c *Context) VPABSW(mxy, xy operand.Op) { - if inst, err := x86.VPABSW(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// VPABSW xmm xmm -// VPABSW m128 xmm -// VPABSW ymm ymm -// VPABSW m256 ymm -// Construct and append a VPABSW instruction to the active function. -// Operates on the global context. -func VPABSW(mxy, xy operand.Op) { ctx.VPABSW(mxy, xy) } - -// VPACKSSDW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// VPACKSSDW xmm xmm xmm -// VPACKSSDW m128 xmm xmm -// VPACKSSDW ymm ymm ymm -// VPACKSSDW m256 ymm ymm -// Construct and append a VPACKSSDW instruction to the active function. -func (c *Context) VPACKSSDW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPACKSSDW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPACKSSDW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// VPACKSSDW xmm xmm xmm -// VPACKSSDW m128 xmm xmm -// VPACKSSDW ymm ymm ymm -// VPACKSSDW m256 ymm ymm -// Construct and append a VPACKSSDW instruction to the active function. -// Operates on the global context. -func VPACKSSDW(mxy, xy, xy1 operand.Op) { ctx.VPACKSSDW(mxy, xy, xy1) } - -// VPACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// VPACKSSWB xmm xmm xmm -// VPACKSSWB m128 xmm xmm -// VPACKSSWB ymm ymm ymm -// VPACKSSWB m256 ymm ymm -// Construct and append a VPACKSSWB instruction to the active function. -func (c *Context) VPACKSSWB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPACKSSWB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// VPACKSSWB xmm xmm xmm -// VPACKSSWB m128 xmm xmm -// VPACKSSWB ymm ymm ymm -// VPACKSSWB m256 ymm ymm -// Construct and append a VPACKSSWB instruction to the active function. -// Operates on the global context. -func VPACKSSWB(mxy, xy, xy1 operand.Op) { ctx.VPACKSSWB(mxy, xy, xy1) } - -// VPACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// VPACKUSDW xmm xmm xmm -// VPACKUSDW m128 xmm xmm -// VPACKUSDW ymm ymm ymm -// VPACKUSDW m256 ymm ymm -// Construct and append a VPACKUSDW instruction to the active function. -func (c *Context) VPACKUSDW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPACKUSDW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// VPACKUSDW xmm xmm xmm -// VPACKUSDW m128 xmm xmm -// VPACKUSDW ymm ymm ymm -// VPACKUSDW m256 ymm ymm -// Construct and append a VPACKUSDW instruction to the active function. -// Operates on the global context. -func VPACKUSDW(mxy, xy, xy1 operand.Op) { ctx.VPACKUSDW(mxy, xy, xy1) } - -// VPACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// VPACKUSWB xmm xmm xmm -// VPACKUSWB m128 xmm xmm -// VPACKUSWB ymm ymm ymm -// VPACKUSWB m256 ymm ymm -// Construct and append a VPACKUSWB instruction to the active function. -func (c *Context) VPACKUSWB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPACKUSWB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// VPACKUSWB xmm xmm xmm -// VPACKUSWB m128 xmm xmm -// VPACKUSWB ymm ymm ymm -// VPACKUSWB m256 ymm ymm -// Construct and append a VPACKUSWB instruction to the active function. -// Operates on the global context. -func VPACKUSWB(mxy, xy, xy1 operand.Op) { ctx.VPACKUSWB(mxy, xy, xy1) } - -// VPADDB: Add Packed Byte Integers. -// -// Forms: -// -// VPADDB xmm xmm xmm -// VPADDB m128 xmm xmm -// VPADDB ymm ymm ymm -// VPADDB m256 ymm ymm -// Construct and append a VPADDB instruction to the active function. -func (c *Context) VPADDB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDB: Add Packed Byte Integers. -// -// Forms: -// -// VPADDB xmm xmm xmm -// VPADDB m128 xmm xmm -// VPADDB ymm ymm ymm -// VPADDB m256 ymm ymm -// Construct and append a VPADDB instruction to the active function. -// Operates on the global context. -func VPADDB(mxy, xy, xy1 operand.Op) { ctx.VPADDB(mxy, xy, xy1) } - -// VPADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// VPADDD xmm xmm xmm -// VPADDD m128 xmm xmm -// VPADDD ymm ymm ymm -// VPADDD m256 ymm ymm -// Construct and append a VPADDD instruction to the active function. -func (c *Context) VPADDD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// VPADDD xmm xmm xmm -// VPADDD m128 xmm xmm -// VPADDD ymm ymm ymm -// VPADDD m256 ymm ymm -// Construct and append a VPADDD instruction to the active function. -// Operates on the global context. -func VPADDD(mxy, xy, xy1 operand.Op) { ctx.VPADDD(mxy, xy, xy1) } - -// VPADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// VPADDQ xmm xmm xmm -// VPADDQ m128 xmm xmm -// VPADDQ ymm ymm ymm -// VPADDQ m256 ymm ymm -// Construct and append a VPADDQ instruction to the active function. -func (c *Context) VPADDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// VPADDQ xmm xmm xmm -// VPADDQ m128 xmm xmm -// VPADDQ ymm ymm ymm -// VPADDQ m256 ymm ymm -// Construct and append a VPADDQ instruction to the active function. -// Operates on the global context. -func VPADDQ(mxy, xy, xy1 operand.Op) { ctx.VPADDQ(mxy, xy, xy1) } - -// VPADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPADDSB xmm xmm xmm -// VPADDSB m128 xmm xmm -// VPADDSB ymm ymm ymm -// VPADDSB m256 ymm ymm -// Construct and append a VPADDSB instruction to the active function. -func (c *Context) VPADDSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPADDSB xmm xmm xmm -// VPADDSB m128 xmm xmm -// VPADDSB ymm ymm ymm -// VPADDSB m256 ymm ymm -// Construct and append a VPADDSB instruction to the active function. -// Operates on the global context. -func VPADDSB(mxy, xy, xy1 operand.Op) { ctx.VPADDSB(mxy, xy, xy1) } - -// VPADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPADDSW xmm xmm xmm -// VPADDSW m128 xmm xmm -// VPADDSW ymm ymm ymm -// VPADDSW m256 ymm ymm -// Construct and append a VPADDSW instruction to the active function. -func (c *Context) VPADDSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPADDSW xmm xmm xmm -// VPADDSW m128 xmm xmm -// VPADDSW ymm ymm ymm -// VPADDSW m256 ymm ymm -// Construct and append a VPADDSW instruction to the active function. -// Operates on the global context. -func VPADDSW(mxy, xy, xy1 operand.Op) { ctx.VPADDSW(mxy, xy, xy1) } - -// VPADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSB xmm xmm xmm -// VPADDUSB m128 xmm xmm -// VPADDUSB ymm ymm ymm -// VPADDUSB m256 ymm ymm -// Construct and append a VPADDUSB instruction to the active function. -func (c *Context) VPADDUSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDUSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSB xmm xmm xmm -// VPADDUSB m128 xmm xmm -// VPADDUSB ymm ymm ymm -// VPADDUSB m256 ymm ymm -// Construct and append a VPADDUSB instruction to the active function. -// Operates on the global context. -func VPADDUSB(mxy, xy, xy1 operand.Op) { ctx.VPADDUSB(mxy, xy, xy1) } - -// VPADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSW xmm xmm xmm -// VPADDUSW m128 xmm xmm -// VPADDUSW ymm ymm ymm -// VPADDUSW m256 ymm ymm -// Construct and append a VPADDUSW instruction to the active function. -func (c *Context) VPADDUSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDUSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSW xmm xmm xmm -// VPADDUSW m128 xmm xmm -// VPADDUSW ymm ymm ymm -// VPADDUSW m256 ymm ymm -// Construct and append a VPADDUSW instruction to the active function. -// Operates on the global context. -func VPADDUSW(mxy, xy, xy1 operand.Op) { ctx.VPADDUSW(mxy, xy, xy1) } - -// VPADDW: Add Packed Word Integers. -// -// Forms: -// -// VPADDW xmm xmm xmm -// VPADDW m128 xmm xmm -// VPADDW ymm ymm ymm -// VPADDW m256 ymm ymm -// Construct and append a VPADDW instruction to the active function. -func (c *Context) VPADDW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPADDW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPADDW: Add Packed Word Integers. -// -// Forms: -// -// VPADDW xmm xmm xmm -// VPADDW m128 xmm xmm -// VPADDW ymm ymm ymm -// VPADDW m256 ymm ymm -// Construct and append a VPADDW instruction to the active function. -// Operates on the global context. -func VPADDW(mxy, xy, xy1 operand.Op) { ctx.VPADDW(mxy, xy, xy1) } - -// VPALIGNR: Packed Align Right. -// -// Forms: -// -// VPALIGNR imm8 xmm xmm xmm -// VPALIGNR imm8 m128 xmm xmm -// VPALIGNR imm8 ymm ymm ymm -// VPALIGNR imm8 m256 ymm ymm -// Construct and append a VPALIGNR instruction to the active function. -func (c *Context) VPALIGNR(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPALIGNR(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPALIGNR: Packed Align Right. -// -// Forms: -// -// VPALIGNR imm8 xmm xmm xmm -// VPALIGNR imm8 m128 xmm xmm -// VPALIGNR imm8 ymm ymm ymm -// VPALIGNR imm8 m256 ymm ymm -// Construct and append a VPALIGNR instruction to the active function. -// Operates on the global context. -func VPALIGNR(i, mxy, xy, xy1 operand.Op) { ctx.VPALIGNR(i, mxy, xy, xy1) } - -// VPAND: Packed Bitwise Logical AND. -// -// Forms: -// -// VPAND xmm xmm xmm -// VPAND m128 xmm xmm -// VPAND ymm ymm ymm -// VPAND m256 ymm ymm -// Construct and append a VPAND instruction to the active function. -func (c *Context) VPAND(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPAND(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPAND: Packed Bitwise Logical AND. -// -// Forms: -// -// VPAND xmm xmm xmm -// VPAND m128 xmm xmm -// VPAND ymm ymm ymm -// VPAND m256 ymm ymm -// Construct and append a VPAND instruction to the active function. -// Operates on the global context. -func VPAND(mxy, xy, xy1 operand.Op) { ctx.VPAND(mxy, xy, xy1) } - -// VPANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// VPANDN xmm xmm xmm -// VPANDN m128 xmm xmm -// VPANDN ymm ymm ymm -// VPANDN m256 ymm ymm -// Construct and append a VPANDN instruction to the active function. -func (c *Context) VPANDN(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPANDN(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// VPANDN xmm xmm xmm -// VPANDN m128 xmm xmm -// VPANDN ymm ymm ymm -// VPANDN m256 ymm ymm -// Construct and append a VPANDN instruction to the active function. -// Operates on the global context. -func VPANDN(mxy, xy, xy1 operand.Op) { ctx.VPANDN(mxy, xy, xy1) } - -// VPAVGB: Average Packed Byte Integers. -// -// Forms: -// -// VPAVGB xmm xmm xmm -// VPAVGB m128 xmm xmm -// VPAVGB ymm ymm ymm -// VPAVGB m256 ymm ymm -// Construct and append a VPAVGB instruction to the active function. -func (c *Context) VPAVGB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPAVGB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPAVGB: Average Packed Byte Integers. -// -// Forms: -// -// VPAVGB xmm xmm xmm -// VPAVGB m128 xmm xmm -// VPAVGB ymm ymm ymm -// VPAVGB m256 ymm ymm -// Construct and append a VPAVGB instruction to the active function. -// Operates on the global context. -func VPAVGB(mxy, xy, xy1 operand.Op) { ctx.VPAVGB(mxy, xy, xy1) } - -// VPAVGW: Average Packed Word Integers. -// -// Forms: -// -// VPAVGW xmm xmm xmm -// VPAVGW m128 xmm xmm -// VPAVGW ymm ymm ymm -// VPAVGW m256 ymm ymm -// Construct and append a VPAVGW instruction to the active function. -func (c *Context) VPAVGW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPAVGW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPAVGW: Average Packed Word Integers. -// -// Forms: -// -// VPAVGW xmm xmm xmm -// VPAVGW m128 xmm xmm -// VPAVGW ymm ymm ymm -// VPAVGW m256 ymm ymm -// Construct and append a VPAVGW instruction to the active function. -// Operates on the global context. -func VPAVGW(mxy, xy, xy1 operand.Op) { ctx.VPAVGW(mxy, xy, xy1) } - -// VPBLENDD: Blend Packed Doublewords. -// -// Forms: -// -// VPBLENDD imm8 xmm xmm xmm -// VPBLENDD imm8 m128 xmm xmm -// VPBLENDD imm8 ymm ymm ymm -// VPBLENDD imm8 m256 ymm ymm -// Construct and append a VPBLENDD instruction to the active function. -func (c *Context) VPBLENDD(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPBLENDD(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBLENDD: Blend Packed Doublewords. -// -// Forms: -// -// VPBLENDD imm8 xmm xmm xmm -// VPBLENDD imm8 m128 xmm xmm -// VPBLENDD imm8 ymm ymm ymm -// VPBLENDD imm8 m256 ymm ymm -// Construct and append a VPBLENDD instruction to the active function. -// Operates on the global context. -func VPBLENDD(i, mxy, xy, xy1 operand.Op) { ctx.VPBLENDD(i, mxy, xy, xy1) } - -// VPBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// VPBLENDVB xmm xmm xmm xmm -// VPBLENDVB xmm m128 xmm xmm -// VPBLENDVB ymm ymm ymm ymm -// VPBLENDVB ymm m256 ymm ymm -// Construct and append a VPBLENDVB instruction to the active function. -func (c *Context) VPBLENDVB(xy, mxy, xy1, xy2 operand.Op) { - if inst, err := x86.VPBLENDVB(xy, mxy, xy1, xy2); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// VPBLENDVB xmm xmm xmm xmm -// VPBLENDVB xmm m128 xmm xmm -// VPBLENDVB ymm ymm ymm ymm -// VPBLENDVB ymm m256 ymm ymm -// Construct and append a VPBLENDVB instruction to the active function. -// Operates on the global context. -func VPBLENDVB(xy, mxy, xy1, xy2 operand.Op) { ctx.VPBLENDVB(xy, mxy, xy1, xy2) } - -// VPBLENDW: Blend Packed Words. -// -// Forms: -// -// VPBLENDW imm8 xmm xmm xmm -// VPBLENDW imm8 m128 xmm xmm -// VPBLENDW imm8 ymm ymm ymm -// VPBLENDW imm8 m256 ymm ymm -// Construct and append a VPBLENDW instruction to the active function. -func (c *Context) VPBLENDW(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPBLENDW(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBLENDW: Blend Packed Words. -// -// Forms: -// -// VPBLENDW imm8 xmm xmm xmm -// VPBLENDW imm8 m128 xmm xmm -// VPBLENDW imm8 ymm ymm ymm -// VPBLENDW imm8 m256 ymm ymm -// Construct and append a VPBLENDW instruction to the active function. -// Operates on the global context. -func VPBLENDW(i, mxy, xy, xy1 operand.Op) { ctx.VPBLENDW(i, mxy, xy, xy1) } - -// VPBROADCASTB: Broadcast Byte Integer. -// -// Forms: -// -// VPBROADCASTB xmm xmm -// VPBROADCASTB m8 xmm -// VPBROADCASTB xmm ymm -// VPBROADCASTB m8 ymm -// Construct and append a VPBROADCASTB instruction to the active function. -func (c *Context) VPBROADCASTB(mx, xy operand.Op) { - if inst, err := x86.VPBROADCASTB(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBROADCASTB: Broadcast Byte Integer. -// -// Forms: -// -// VPBROADCASTB xmm xmm -// VPBROADCASTB m8 xmm -// VPBROADCASTB xmm ymm -// VPBROADCASTB m8 ymm -// Construct and append a VPBROADCASTB instruction to the active function. -// Operates on the global context. -func VPBROADCASTB(mx, xy operand.Op) { ctx.VPBROADCASTB(mx, xy) } - -// VPBROADCASTD: Broadcast Doubleword Integer. -// -// Forms: -// -// VPBROADCASTD xmm xmm -// VPBROADCASTD m32 xmm -// VPBROADCASTD xmm ymm -// VPBROADCASTD m32 ymm -// Construct and append a VPBROADCASTD instruction to the active function. -func (c *Context) VPBROADCASTD(mx, xy operand.Op) { - if inst, err := x86.VPBROADCASTD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBROADCASTD: Broadcast Doubleword Integer. -// -// Forms: -// -// VPBROADCASTD xmm xmm -// VPBROADCASTD m32 xmm -// VPBROADCASTD xmm ymm -// VPBROADCASTD m32 ymm -// Construct and append a VPBROADCASTD instruction to the active function. -// Operates on the global context. -func VPBROADCASTD(mx, xy operand.Op) { ctx.VPBROADCASTD(mx, xy) } - -// VPBROADCASTQ: Broadcast Quadword Integer. -// -// Forms: -// -// VPBROADCASTQ xmm xmm -// VPBROADCASTQ m64 xmm -// VPBROADCASTQ xmm ymm -// VPBROADCASTQ m64 ymm -// Construct and append a VPBROADCASTQ instruction to the active function. -func (c *Context) VPBROADCASTQ(mx, xy operand.Op) { - if inst, err := x86.VPBROADCASTQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBROADCASTQ: Broadcast Quadword Integer. -// -// Forms: -// -// VPBROADCASTQ xmm xmm -// VPBROADCASTQ m64 xmm -// VPBROADCASTQ xmm ymm -// VPBROADCASTQ m64 ymm -// Construct and append a VPBROADCASTQ instruction to the active function. -// Operates on the global context. -func VPBROADCASTQ(mx, xy operand.Op) { ctx.VPBROADCASTQ(mx, xy) } - -// VPBROADCASTW: Broadcast Word Integer. -// -// Forms: -// -// VPBROADCASTW xmm xmm -// VPBROADCASTW m16 xmm -// VPBROADCASTW xmm ymm -// VPBROADCASTW m16 ymm -// Construct and append a VPBROADCASTW instruction to the active function. -func (c *Context) VPBROADCASTW(mx, xy operand.Op) { - if inst, err := x86.VPBROADCASTW(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPBROADCASTW: Broadcast Word Integer. -// -// Forms: -// -// VPBROADCASTW xmm xmm -// VPBROADCASTW m16 xmm -// VPBROADCASTW xmm ymm -// VPBROADCASTW m16 ymm -// Construct and append a VPBROADCASTW instruction to the active function. -// Operates on the global context. -func VPBROADCASTW(mx, xy operand.Op) { ctx.VPBROADCASTW(mx, xy) } - -// VPCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// VPCLMULQDQ imm8 xmm xmm xmm -// VPCLMULQDQ imm8 m128 xmm xmm -// Construct and append a VPCLMULQDQ instruction to the active function. -func (c *Context) VPCLMULQDQ(i, mx, x, x1 operand.Op) { - if inst, err := x86.VPCLMULQDQ(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// VPCLMULQDQ imm8 xmm xmm xmm -// VPCLMULQDQ imm8 m128 xmm xmm -// Construct and append a VPCLMULQDQ instruction to the active function. -// Operates on the global context. -func VPCLMULQDQ(i, mx, x, x1 operand.Op) { ctx.VPCLMULQDQ(i, mx, x, x1) } - -// VPCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// VPCMPEQB xmm xmm xmm -// VPCMPEQB m128 xmm xmm -// VPCMPEQB ymm ymm ymm -// VPCMPEQB m256 ymm ymm -// Construct and append a VPCMPEQB instruction to the active function. -func (c *Context) VPCMPEQB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPEQB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// VPCMPEQB xmm xmm xmm -// VPCMPEQB m128 xmm xmm -// VPCMPEQB ymm ymm ymm -// VPCMPEQB m256 ymm ymm -// Construct and append a VPCMPEQB instruction to the active function. -// Operates on the global context. -func VPCMPEQB(mxy, xy, xy1 operand.Op) { ctx.VPCMPEQB(mxy, xy, xy1) } - -// VPCMPEQD: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// VPCMPEQD xmm xmm xmm -// VPCMPEQD m128 xmm xmm -// VPCMPEQD ymm ymm ymm -// VPCMPEQD m256 ymm ymm -// Construct and append a VPCMPEQD instruction to the active function. -func (c *Context) VPCMPEQD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPEQD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPEQD: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// VPCMPEQD xmm xmm xmm -// VPCMPEQD m128 xmm xmm -// VPCMPEQD ymm ymm ymm -// VPCMPEQD m256 ymm ymm -// Construct and append a VPCMPEQD instruction to the active function. -// Operates on the global context. -func VPCMPEQD(mxy, xy, xy1 operand.Op) { ctx.VPCMPEQD(mxy, xy, xy1) } - -// VPCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// VPCMPEQQ xmm xmm xmm -// VPCMPEQQ m128 xmm xmm -// VPCMPEQQ ymm ymm ymm -// VPCMPEQQ m256 ymm ymm -// Construct and append a VPCMPEQQ instruction to the active function. -func (c *Context) VPCMPEQQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPEQQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// VPCMPEQQ xmm xmm xmm -// VPCMPEQQ m128 xmm xmm -// VPCMPEQQ ymm ymm ymm -// VPCMPEQQ m256 ymm ymm -// Construct and append a VPCMPEQQ instruction to the active function. -// Operates on the global context. -func VPCMPEQQ(mxy, xy, xy1 operand.Op) { ctx.VPCMPEQQ(mxy, xy, xy1) } - -// VPCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// VPCMPEQW xmm xmm xmm -// VPCMPEQW m128 xmm xmm -// VPCMPEQW ymm ymm ymm -// VPCMPEQW m256 ymm ymm -// Construct and append a VPCMPEQW instruction to the active function. -func (c *Context) VPCMPEQW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPEQW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// VPCMPEQW xmm xmm xmm -// VPCMPEQW m128 xmm xmm -// VPCMPEQW ymm ymm ymm -// VPCMPEQW m256 ymm ymm -// Construct and append a VPCMPEQW instruction to the active function. -// Operates on the global context. -func VPCMPEQW(mxy, xy, xy1 operand.Op) { ctx.VPCMPEQW(mxy, xy, xy1) } - -// VPCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPESTRI imm8 xmm xmm -// VPCMPESTRI imm8 m128 xmm -// Construct and append a VPCMPESTRI instruction to the active function. -func (c *Context) VPCMPESTRI(i, mx, x operand.Op) { - if inst, err := x86.VPCMPESTRI(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPESTRI imm8 xmm xmm -// VPCMPESTRI imm8 m128 xmm -// Construct and append a VPCMPESTRI instruction to the active function. -// Operates on the global context. -func VPCMPESTRI(i, mx, x operand.Op) { ctx.VPCMPESTRI(i, mx, x) } - -// VPCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPESTRM imm8 xmm xmm -// VPCMPESTRM imm8 m128 xmm -// Construct and append a VPCMPESTRM instruction to the active function. -func (c *Context) VPCMPESTRM(i, mx, x operand.Op) { - if inst, err := x86.VPCMPESTRM(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPESTRM imm8 xmm xmm -// VPCMPESTRM imm8 m128 xmm -// Construct and append a VPCMPESTRM instruction to the active function. -// Operates on the global context. -func VPCMPESTRM(i, mx, x operand.Op) { ctx.VPCMPESTRM(i, mx, x) } - -// VPCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// VPCMPGTB xmm xmm xmm -// VPCMPGTB m128 xmm xmm -// VPCMPGTB ymm ymm ymm -// VPCMPGTB m256 ymm ymm -// Construct and append a VPCMPGTB instruction to the active function. -func (c *Context) VPCMPGTB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPGTB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// VPCMPGTB xmm xmm xmm -// VPCMPGTB m128 xmm xmm -// VPCMPGTB ymm ymm ymm -// VPCMPGTB m256 ymm ymm -// Construct and append a VPCMPGTB instruction to the active function. -// Operates on the global context. -func VPCMPGTB(mxy, xy, xy1 operand.Op) { ctx.VPCMPGTB(mxy, xy, xy1) } - -// VPCMPGTD: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// VPCMPGTD xmm xmm xmm -// VPCMPGTD m128 xmm xmm -// VPCMPGTD ymm ymm ymm -// VPCMPGTD m256 ymm ymm -// Construct and append a VPCMPGTD instruction to the active function. -func (c *Context) VPCMPGTD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPGTD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPGTD: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// VPCMPGTD xmm xmm xmm -// VPCMPGTD m128 xmm xmm -// VPCMPGTD ymm ymm ymm -// VPCMPGTD m256 ymm ymm -// Construct and append a VPCMPGTD instruction to the active function. -// Operates on the global context. -func VPCMPGTD(mxy, xy, xy1 operand.Op) { ctx.VPCMPGTD(mxy, xy, xy1) } - -// VPCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// VPCMPGTQ xmm xmm xmm -// VPCMPGTQ m128 xmm xmm -// VPCMPGTQ ymm ymm ymm -// VPCMPGTQ m256 ymm ymm -// Construct and append a VPCMPGTQ instruction to the active function. -func (c *Context) VPCMPGTQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPGTQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// VPCMPGTQ xmm xmm xmm -// VPCMPGTQ m128 xmm xmm -// VPCMPGTQ ymm ymm ymm -// VPCMPGTQ m256 ymm ymm -// Construct and append a VPCMPGTQ instruction to the active function. -// Operates on the global context. -func VPCMPGTQ(mxy, xy, xy1 operand.Op) { ctx.VPCMPGTQ(mxy, xy, xy1) } - -// VPCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// VPCMPGTW xmm xmm xmm -// VPCMPGTW m128 xmm xmm -// VPCMPGTW ymm ymm ymm -// VPCMPGTW m256 ymm ymm -// Construct and append a VPCMPGTW instruction to the active function. -func (c *Context) VPCMPGTW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPCMPGTW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// VPCMPGTW xmm xmm xmm -// VPCMPGTW m128 xmm xmm -// VPCMPGTW ymm ymm ymm -// VPCMPGTW m256 ymm ymm -// Construct and append a VPCMPGTW instruction to the active function. -// Operates on the global context. -func VPCMPGTW(mxy, xy, xy1 operand.Op) { ctx.VPCMPGTW(mxy, xy, xy1) } - -// VPCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPISTRI imm8 xmm xmm -// VPCMPISTRI imm8 m128 xmm -// Construct and append a VPCMPISTRI instruction to the active function. -func (c *Context) VPCMPISTRI(i, mx, x operand.Op) { - if inst, err := x86.VPCMPISTRI(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPISTRI imm8 xmm xmm -// VPCMPISTRI imm8 m128 xmm -// Construct and append a VPCMPISTRI instruction to the active function. -// Operates on the global context. -func VPCMPISTRI(i, mx, x operand.Op) { ctx.VPCMPISTRI(i, mx, x) } - -// VPCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPISTRM imm8 xmm xmm -// VPCMPISTRM imm8 m128 xmm -// Construct and append a VPCMPISTRM instruction to the active function. -func (c *Context) VPCMPISTRM(i, mx, x operand.Op) { - if inst, err := x86.VPCMPISTRM(i, mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPISTRM imm8 xmm xmm -// VPCMPISTRM imm8 m128 xmm -// Construct and append a VPCMPISTRM instruction to the active function. -// Operates on the global context. -func VPCMPISTRM(i, mx, x operand.Op) { ctx.VPCMPISTRM(i, mx, x) } - -// VPERM2F128: Permute Floating-Point Values. -// -// Forms: -// -// VPERM2F128 imm8 ymm ymm ymm -// VPERM2F128 imm8 m256 ymm ymm -// Construct and append a VPERM2F128 instruction to the active function. -func (c *Context) VPERM2F128(i, my, y, y1 operand.Op) { - if inst, err := x86.VPERM2F128(i, my, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERM2F128: Permute Floating-Point Values. -// -// Forms: -// -// VPERM2F128 imm8 ymm ymm ymm -// VPERM2F128 imm8 m256 ymm ymm -// Construct and append a VPERM2F128 instruction to the active function. -// Operates on the global context. -func VPERM2F128(i, my, y, y1 operand.Op) { ctx.VPERM2F128(i, my, y, y1) } - -// VPERM2I128: Permute 128-Bit Integer Values. -// -// Forms: -// -// VPERM2I128 imm8 ymm ymm ymm -// VPERM2I128 imm8 m256 ymm ymm -// Construct and append a VPERM2I128 instruction to the active function. -func (c *Context) VPERM2I128(i, my, y, y1 operand.Op) { - if inst, err := x86.VPERM2I128(i, my, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERM2I128: Permute 128-Bit Integer Values. -// -// Forms: -// -// VPERM2I128 imm8 ymm ymm ymm -// VPERM2I128 imm8 m256 ymm ymm -// Construct and append a VPERM2I128 instruction to the active function. -// Operates on the global context. -func VPERM2I128(i, my, y, y1 operand.Op) { ctx.VPERM2I128(i, my, y, y1) } - -// VPERMD: Permute Doubleword Integers. -// -// Forms: -// -// VPERMD ymm ymm ymm -// VPERMD m256 ymm ymm -// Construct and append a VPERMD instruction to the active function. -func (c *Context) VPERMD(my, y, y1 operand.Op) { - if inst, err := x86.VPERMD(my, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMD: Permute Doubleword Integers. -// -// Forms: -// -// VPERMD ymm ymm ymm -// VPERMD m256 ymm ymm -// Construct and append a VPERMD instruction to the active function. -// Operates on the global context. -func VPERMD(my, y, y1 operand.Op) { ctx.VPERMD(my, y, y1) } - -// VPERMILPD: Permute Double-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPD imm8 xmm xmm -// VPERMILPD xmm xmm xmm -// VPERMILPD m128 xmm xmm -// VPERMILPD imm8 m128 xmm -// VPERMILPD imm8 ymm ymm -// VPERMILPD ymm ymm ymm -// VPERMILPD m256 ymm ymm -// VPERMILPD imm8 m256 ymm -// Construct and append a VPERMILPD instruction to the active function. -func (c *Context) VPERMILPD(imxy, mxy, xy operand.Op) { - if inst, err := x86.VPERMILPD(imxy, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMILPD: Permute Double-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPD imm8 xmm xmm -// VPERMILPD xmm xmm xmm -// VPERMILPD m128 xmm xmm -// VPERMILPD imm8 m128 xmm -// VPERMILPD imm8 ymm ymm -// VPERMILPD ymm ymm ymm -// VPERMILPD m256 ymm ymm -// VPERMILPD imm8 m256 ymm -// Construct and append a VPERMILPD instruction to the active function. -// Operates on the global context. -func VPERMILPD(imxy, mxy, xy operand.Op) { ctx.VPERMILPD(imxy, mxy, xy) } - -// VPERMILPS: Permute Single-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPS imm8 xmm xmm -// VPERMILPS xmm xmm xmm -// VPERMILPS m128 xmm xmm -// VPERMILPS imm8 m128 xmm -// VPERMILPS imm8 ymm ymm -// VPERMILPS ymm ymm ymm -// VPERMILPS m256 ymm ymm -// VPERMILPS imm8 m256 ymm -// Construct and append a VPERMILPS instruction to the active function. -func (c *Context) VPERMILPS(imxy, mxy, xy operand.Op) { - if inst, err := x86.VPERMILPS(imxy, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMILPS: Permute Single-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPS imm8 xmm xmm -// VPERMILPS xmm xmm xmm -// VPERMILPS m128 xmm xmm -// VPERMILPS imm8 m128 xmm -// VPERMILPS imm8 ymm ymm -// VPERMILPS ymm ymm ymm -// VPERMILPS m256 ymm ymm -// VPERMILPS imm8 m256 ymm -// Construct and append a VPERMILPS instruction to the active function. -// Operates on the global context. -func VPERMILPS(imxy, mxy, xy operand.Op) { ctx.VPERMILPS(imxy, mxy, xy) } - -// VPERMPD: Permute Double-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPD imm8 ymm ymm -// VPERMPD imm8 m256 ymm -// Construct and append a VPERMPD instruction to the active function. -func (c *Context) VPERMPD(i, my, y operand.Op) { - if inst, err := x86.VPERMPD(i, my, y); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMPD: Permute Double-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPD imm8 ymm ymm -// VPERMPD imm8 m256 ymm -// Construct and append a VPERMPD instruction to the active function. -// Operates on the global context. -func VPERMPD(i, my, y operand.Op) { ctx.VPERMPD(i, my, y) } - -// VPERMPS: Permute Single-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPS ymm ymm ymm -// VPERMPS m256 ymm ymm -// Construct and append a VPERMPS instruction to the active function. -func (c *Context) VPERMPS(my, y, y1 operand.Op) { - if inst, err := x86.VPERMPS(my, y, y1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMPS: Permute Single-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPS ymm ymm ymm -// VPERMPS m256 ymm ymm -// Construct and append a VPERMPS instruction to the active function. -// Operates on the global context. -func VPERMPS(my, y, y1 operand.Op) { ctx.VPERMPS(my, y, y1) } - -// VPERMQ: Permute Quadword Integers. -// -// Forms: -// -// VPERMQ imm8 ymm ymm -// VPERMQ imm8 m256 ymm -// Construct and append a VPERMQ instruction to the active function. -func (c *Context) VPERMQ(i, my, y operand.Op) { - if inst, err := x86.VPERMQ(i, my, y); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPERMQ: Permute Quadword Integers. -// -// Forms: -// -// VPERMQ imm8 ymm ymm -// VPERMQ imm8 m256 ymm -// Construct and append a VPERMQ instruction to the active function. -// Operates on the global context. -func VPERMQ(i, my, y operand.Op) { ctx.VPERMQ(i, my, y) } - -// VPEXTRB: Extract Byte. -// -// Forms: -// -// VPEXTRB imm8 xmm r32 -// VPEXTRB imm8 xmm m8 -// Construct and append a VPEXTRB instruction to the active function. -func (c *Context) VPEXTRB(i, x, mr operand.Op) { - if inst, err := x86.VPEXTRB(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPEXTRB: Extract Byte. -// -// Forms: -// -// VPEXTRB imm8 xmm r32 -// VPEXTRB imm8 xmm m8 -// Construct and append a VPEXTRB instruction to the active function. -// Operates on the global context. -func VPEXTRB(i, x, mr operand.Op) { ctx.VPEXTRB(i, x, mr) } - -// VPEXTRD: Extract Doubleword. -// -// Forms: -// -// VPEXTRD imm8 xmm r32 -// VPEXTRD imm8 xmm m32 -// Construct and append a VPEXTRD instruction to the active function. -func (c *Context) VPEXTRD(i, x, mr operand.Op) { - if inst, err := x86.VPEXTRD(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPEXTRD: Extract Doubleword. -// -// Forms: -// -// VPEXTRD imm8 xmm r32 -// VPEXTRD imm8 xmm m32 -// Construct and append a VPEXTRD instruction to the active function. -// Operates on the global context. -func VPEXTRD(i, x, mr operand.Op) { ctx.VPEXTRD(i, x, mr) } - -// VPEXTRQ: Extract Quadword. -// -// Forms: -// -// VPEXTRQ imm8 xmm r64 -// VPEXTRQ imm8 xmm m64 -// Construct and append a VPEXTRQ instruction to the active function. -func (c *Context) VPEXTRQ(i, x, mr operand.Op) { - if inst, err := x86.VPEXTRQ(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPEXTRQ: Extract Quadword. -// -// Forms: -// -// VPEXTRQ imm8 xmm r64 -// VPEXTRQ imm8 xmm m64 -// Construct and append a VPEXTRQ instruction to the active function. -// Operates on the global context. -func VPEXTRQ(i, x, mr operand.Op) { ctx.VPEXTRQ(i, x, mr) } - -// VPEXTRW: Extract Word. -// -// Forms: -// -// VPEXTRW imm8 xmm r32 -// VPEXTRW imm8 xmm m16 -// Construct and append a VPEXTRW instruction to the active function. -func (c *Context) VPEXTRW(i, x, mr operand.Op) { - if inst, err := x86.VPEXTRW(i, x, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPEXTRW: Extract Word. -// -// Forms: -// -// VPEXTRW imm8 xmm r32 -// VPEXTRW imm8 xmm m16 -// Construct and append a VPEXTRW instruction to the active function. -// Operates on the global context. -func VPEXTRW(i, x, mr operand.Op) { ctx.VPEXTRW(i, x, mr) } - -// VPGATHERDD: Gather Packed Doubleword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDD xmm vm32x xmm -// VPGATHERDD ymm vm32y ymm -// Construct and append a VPGATHERDD instruction to the active function. -func (c *Context) VPGATHERDD(xy, v, xy1 operand.Op) { - if inst, err := x86.VPGATHERDD(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPGATHERDD: Gather Packed Doubleword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDD xmm vm32x xmm -// VPGATHERDD ymm vm32y ymm -// Construct and append a VPGATHERDD instruction to the active function. -// Operates on the global context. -func VPGATHERDD(xy, v, xy1 operand.Op) { ctx.VPGATHERDD(xy, v, xy1) } - -// VPGATHERDQ: Gather Packed Quadword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDQ xmm vm32x xmm -// VPGATHERDQ ymm vm32x ymm -// Construct and append a VPGATHERDQ instruction to the active function. -func (c *Context) VPGATHERDQ(xy, v, xy1 operand.Op) { - if inst, err := x86.VPGATHERDQ(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPGATHERDQ: Gather Packed Quadword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDQ xmm vm32x xmm -// VPGATHERDQ ymm vm32x ymm -// Construct and append a VPGATHERDQ instruction to the active function. -// Operates on the global context. -func VPGATHERDQ(xy, v, xy1 operand.Op) { ctx.VPGATHERDQ(xy, v, xy1) } - -// VPGATHERQD: Gather Packed Doubleword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQD xmm vm64x xmm -// VPGATHERQD xmm vm64y xmm -// Construct and append a VPGATHERQD instruction to the active function. -func (c *Context) VPGATHERQD(x, v, x1 operand.Op) { - if inst, err := x86.VPGATHERQD(x, v, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPGATHERQD: Gather Packed Doubleword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQD xmm vm64x xmm -// VPGATHERQD xmm vm64y xmm -// Construct and append a VPGATHERQD instruction to the active function. -// Operates on the global context. -func VPGATHERQD(x, v, x1 operand.Op) { ctx.VPGATHERQD(x, v, x1) } - -// VPGATHERQQ: Gather Packed Quadword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQQ xmm vm64x xmm -// VPGATHERQQ ymm vm64y ymm -// Construct and append a VPGATHERQQ instruction to the active function. -func (c *Context) VPGATHERQQ(xy, v, xy1 operand.Op) { - if inst, err := x86.VPGATHERQQ(xy, v, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPGATHERQQ: Gather Packed Quadword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQQ xmm vm64x xmm -// VPGATHERQQ ymm vm64y ymm -// Construct and append a VPGATHERQQ instruction to the active function. -// Operates on the global context. -func VPGATHERQQ(xy, v, xy1 operand.Op) { ctx.VPGATHERQQ(xy, v, xy1) } - -// VPHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// VPHADDD xmm xmm xmm -// VPHADDD m128 xmm xmm -// VPHADDD ymm ymm ymm -// VPHADDD m256 ymm ymm -// Construct and append a VPHADDD instruction to the active function. -func (c *Context) VPHADDD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHADDD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// VPHADDD xmm xmm xmm -// VPHADDD m128 xmm xmm -// VPHADDD ymm ymm ymm -// VPHADDD m256 ymm ymm -// Construct and append a VPHADDD instruction to the active function. -// Operates on the global context. -func VPHADDD(mxy, xy, xy1 operand.Op) { ctx.VPHADDD(mxy, xy, xy1) } - -// VPHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHADDSW xmm xmm xmm -// VPHADDSW m128 xmm xmm -// VPHADDSW ymm ymm ymm -// VPHADDSW m256 ymm ymm -// Construct and append a VPHADDSW instruction to the active function. -func (c *Context) VPHADDSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHADDSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHADDSW xmm xmm xmm -// VPHADDSW m128 xmm xmm -// VPHADDSW ymm ymm ymm -// VPHADDSW m256 ymm ymm -// Construct and append a VPHADDSW instruction to the active function. -// Operates on the global context. -func VPHADDSW(mxy, xy, xy1 operand.Op) { ctx.VPHADDSW(mxy, xy, xy1) } - -// VPHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// VPHADDW xmm xmm xmm -// VPHADDW m128 xmm xmm -// VPHADDW ymm ymm ymm -// VPHADDW m256 ymm ymm -// Construct and append a VPHADDW instruction to the active function. -func (c *Context) VPHADDW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHADDW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// VPHADDW xmm xmm xmm -// VPHADDW m128 xmm xmm -// VPHADDW ymm ymm ymm -// VPHADDW m256 ymm ymm -// Construct and append a VPHADDW instruction to the active function. -// Operates on the global context. -func VPHADDW(mxy, xy, xy1 operand.Op) { ctx.VPHADDW(mxy, xy, xy1) } - -// VPHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// VPHMINPOSUW xmm xmm -// VPHMINPOSUW m128 xmm -// Construct and append a VPHMINPOSUW instruction to the active function. -func (c *Context) VPHMINPOSUW(mx, x operand.Op) { - if inst, err := x86.VPHMINPOSUW(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// VPHMINPOSUW xmm xmm -// VPHMINPOSUW m128 xmm -// Construct and append a VPHMINPOSUW instruction to the active function. -// Operates on the global context. -func VPHMINPOSUW(mx, x operand.Op) { ctx.VPHMINPOSUW(mx, x) } - -// VPHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// VPHSUBD xmm xmm xmm -// VPHSUBD m128 xmm xmm -// VPHSUBD ymm ymm ymm -// VPHSUBD m256 ymm ymm -// Construct and append a VPHSUBD instruction to the active function. -func (c *Context) VPHSUBD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHSUBD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// VPHSUBD xmm xmm xmm -// VPHSUBD m128 xmm xmm -// VPHSUBD ymm ymm ymm -// VPHSUBD m256 ymm ymm -// Construct and append a VPHSUBD instruction to the active function. -// Operates on the global context. -func VPHSUBD(mxy, xy, xy1 operand.Op) { ctx.VPHSUBD(mxy, xy, xy1) } - -// VPHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHSUBSW xmm xmm xmm -// VPHSUBSW m128 xmm xmm -// VPHSUBSW ymm ymm ymm -// VPHSUBSW m256 ymm ymm -// Construct and append a VPHSUBSW instruction to the active function. -func (c *Context) VPHSUBSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHSUBSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHSUBSW xmm xmm xmm -// VPHSUBSW m128 xmm xmm -// VPHSUBSW ymm ymm ymm -// VPHSUBSW m256 ymm ymm -// Construct and append a VPHSUBSW instruction to the active function. -// Operates on the global context. -func VPHSUBSW(mxy, xy, xy1 operand.Op) { ctx.VPHSUBSW(mxy, xy, xy1) } - -// VPHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// VPHSUBW xmm xmm xmm -// VPHSUBW m128 xmm xmm -// VPHSUBW ymm ymm ymm -// VPHSUBW m256 ymm ymm -// Construct and append a VPHSUBW instruction to the active function. -func (c *Context) VPHSUBW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPHSUBW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// VPHSUBW xmm xmm xmm -// VPHSUBW m128 xmm xmm -// VPHSUBW ymm ymm ymm -// VPHSUBW m256 ymm ymm -// Construct and append a VPHSUBW instruction to the active function. -// Operates on the global context. -func VPHSUBW(mxy, xy, xy1 operand.Op) { ctx.VPHSUBW(mxy, xy, xy1) } - -// VPINSRB: Insert Byte. -// -// Forms: -// -// VPINSRB imm8 r32 xmm xmm -// VPINSRB imm8 m8 xmm xmm -// Construct and append a VPINSRB instruction to the active function. -func (c *Context) VPINSRB(i, mr, x, x1 operand.Op) { - if inst, err := x86.VPINSRB(i, mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPINSRB: Insert Byte. -// -// Forms: -// -// VPINSRB imm8 r32 xmm xmm -// VPINSRB imm8 m8 xmm xmm -// Construct and append a VPINSRB instruction to the active function. -// Operates on the global context. -func VPINSRB(i, mr, x, x1 operand.Op) { ctx.VPINSRB(i, mr, x, x1) } - -// VPINSRD: Insert Doubleword. -// -// Forms: -// -// VPINSRD imm8 r32 xmm xmm -// VPINSRD imm8 m32 xmm xmm -// Construct and append a VPINSRD instruction to the active function. -func (c *Context) VPINSRD(i, mr, x, x1 operand.Op) { - if inst, err := x86.VPINSRD(i, mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPINSRD: Insert Doubleword. -// -// Forms: -// -// VPINSRD imm8 r32 xmm xmm -// VPINSRD imm8 m32 xmm xmm -// Construct and append a VPINSRD instruction to the active function. -// Operates on the global context. -func VPINSRD(i, mr, x, x1 operand.Op) { ctx.VPINSRD(i, mr, x, x1) } - -// VPINSRQ: Insert Quadword. -// -// Forms: -// -// VPINSRQ imm8 r64 xmm xmm -// VPINSRQ imm8 m64 xmm xmm -// Construct and append a VPINSRQ instruction to the active function. -func (c *Context) VPINSRQ(i, mr, x, x1 operand.Op) { - if inst, err := x86.VPINSRQ(i, mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPINSRQ: Insert Quadword. -// -// Forms: -// -// VPINSRQ imm8 r64 xmm xmm -// VPINSRQ imm8 m64 xmm xmm -// Construct and append a VPINSRQ instruction to the active function. -// Operates on the global context. -func VPINSRQ(i, mr, x, x1 operand.Op) { ctx.VPINSRQ(i, mr, x, x1) } - -// VPINSRW: Insert Word. -// -// Forms: -// -// VPINSRW imm8 r32 xmm xmm -// VPINSRW imm8 m16 xmm xmm -// Construct and append a VPINSRW instruction to the active function. -func (c *Context) VPINSRW(i, mr, x, x1 operand.Op) { - if inst, err := x86.VPINSRW(i, mr, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPINSRW: Insert Word. -// -// Forms: -// -// VPINSRW imm8 r32 xmm xmm -// VPINSRW imm8 m16 xmm xmm -// Construct and append a VPINSRW instruction to the active function. -// Operates on the global context. -func VPINSRW(i, mr, x, x1 operand.Op) { ctx.VPINSRW(i, mr, x, x1) } - -// VPMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// VPMADDUBSW xmm xmm xmm -// VPMADDUBSW m128 xmm xmm -// VPMADDUBSW ymm ymm ymm -// VPMADDUBSW m256 ymm ymm -// Construct and append a VPMADDUBSW instruction to the active function. -func (c *Context) VPMADDUBSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMADDUBSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// VPMADDUBSW xmm xmm xmm -// VPMADDUBSW m128 xmm xmm -// VPMADDUBSW ymm ymm ymm -// VPMADDUBSW m256 ymm ymm -// Construct and append a VPMADDUBSW instruction to the active function. -// Operates on the global context. -func VPMADDUBSW(mxy, xy, xy1 operand.Op) { ctx.VPMADDUBSW(mxy, xy, xy1) } - -// VPMADDWD: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// VPMADDWD xmm xmm xmm -// VPMADDWD m128 xmm xmm -// VPMADDWD ymm ymm ymm -// VPMADDWD m256 ymm ymm -// Construct and append a VPMADDWD instruction to the active function. -func (c *Context) VPMADDWD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMADDWD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMADDWD: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// VPMADDWD xmm xmm xmm -// VPMADDWD m128 xmm xmm -// VPMADDWD ymm ymm ymm -// VPMADDWD m256 ymm ymm -// Construct and append a VPMADDWD instruction to the active function. -// Operates on the global context. -func VPMADDWD(mxy, xy, xy1 operand.Op) { ctx.VPMADDWD(mxy, xy, xy1) } - -// VPMASKMOVD: Conditional Move Packed Doubleword Integers. -// -// Forms: -// -// VPMASKMOVD m128 xmm xmm -// VPMASKMOVD m256 ymm ymm -// VPMASKMOVD xmm xmm m128 -// VPMASKMOVD ymm ymm m256 -// Construct and append a VPMASKMOVD instruction to the active function. -func (c *Context) VPMASKMOVD(mxy, xy, mxy1 operand.Op) { - if inst, err := x86.VPMASKMOVD(mxy, xy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMASKMOVD: Conditional Move Packed Doubleword Integers. -// -// Forms: -// -// VPMASKMOVD m128 xmm xmm -// VPMASKMOVD m256 ymm ymm -// VPMASKMOVD xmm xmm m128 -// VPMASKMOVD ymm ymm m256 -// Construct and append a VPMASKMOVD instruction to the active function. -// Operates on the global context. -func VPMASKMOVD(mxy, xy, mxy1 operand.Op) { ctx.VPMASKMOVD(mxy, xy, mxy1) } - -// VPMASKMOVQ: Conditional Move Packed Quadword Integers. -// -// Forms: -// -// VPMASKMOVQ m128 xmm xmm -// VPMASKMOVQ m256 ymm ymm -// VPMASKMOVQ xmm xmm m128 -// VPMASKMOVQ ymm ymm m256 -// Construct and append a VPMASKMOVQ instruction to the active function. -func (c *Context) VPMASKMOVQ(mxy, xy, mxy1 operand.Op) { - if inst, err := x86.VPMASKMOVQ(mxy, xy, mxy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMASKMOVQ: Conditional Move Packed Quadword Integers. -// -// Forms: -// -// VPMASKMOVQ m128 xmm xmm -// VPMASKMOVQ m256 ymm ymm -// VPMASKMOVQ xmm xmm m128 -// VPMASKMOVQ ymm ymm m256 -// Construct and append a VPMASKMOVQ instruction to the active function. -// Operates on the global context. -func VPMASKMOVQ(mxy, xy, mxy1 operand.Op) { ctx.VPMASKMOVQ(mxy, xy, mxy1) } - -// VPMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMAXSB xmm xmm xmm -// VPMAXSB m128 xmm xmm -// VPMAXSB ymm ymm ymm -// VPMAXSB m256 ymm ymm -// Construct and append a VPMAXSB instruction to the active function. -func (c *Context) VPMAXSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMAXSB xmm xmm xmm -// VPMAXSB m128 xmm xmm -// VPMAXSB ymm ymm ymm -// VPMAXSB m256 ymm ymm -// Construct and append a VPMAXSB instruction to the active function. -// Operates on the global context. -func VPMAXSB(mxy, xy, xy1 operand.Op) { ctx.VPMAXSB(mxy, xy, xy1) } - -// VPMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMAXSD xmm xmm xmm -// VPMAXSD m128 xmm xmm -// VPMAXSD ymm ymm ymm -// VPMAXSD m256 ymm ymm -// Construct and append a VPMAXSD instruction to the active function. -func (c *Context) VPMAXSD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXSD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMAXSD xmm xmm xmm -// VPMAXSD m128 xmm xmm -// VPMAXSD ymm ymm ymm -// VPMAXSD m256 ymm ymm -// Construct and append a VPMAXSD instruction to the active function. -// Operates on the global context. -func VPMAXSD(mxy, xy, xy1 operand.Op) { ctx.VPMAXSD(mxy, xy, xy1) } - -// VPMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// VPMAXSW xmm xmm xmm -// VPMAXSW m128 xmm xmm -// VPMAXSW ymm ymm ymm -// VPMAXSW m256 ymm ymm -// Construct and append a VPMAXSW instruction to the active function. -func (c *Context) VPMAXSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// VPMAXSW xmm xmm xmm -// VPMAXSW m128 xmm xmm -// VPMAXSW ymm ymm ymm -// VPMAXSW m256 ymm ymm -// Construct and append a VPMAXSW instruction to the active function. -// Operates on the global context. -func VPMAXSW(mxy, xy, xy1 operand.Op) { ctx.VPMAXSW(mxy, xy, xy1) } - -// VPMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMAXUB xmm xmm xmm -// VPMAXUB m128 xmm xmm -// VPMAXUB ymm ymm ymm -// VPMAXUB m256 ymm ymm -// Construct and append a VPMAXUB instruction to the active function. -func (c *Context) VPMAXUB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXUB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMAXUB xmm xmm xmm -// VPMAXUB m128 xmm xmm -// VPMAXUB ymm ymm ymm -// VPMAXUB m256 ymm ymm -// Construct and append a VPMAXUB instruction to the active function. -// Operates on the global context. -func VPMAXUB(mxy, xy, xy1 operand.Op) { ctx.VPMAXUB(mxy, xy, xy1) } - -// VPMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMAXUD xmm xmm xmm -// VPMAXUD m128 xmm xmm -// VPMAXUD ymm ymm ymm -// VPMAXUD m256 ymm ymm -// Construct and append a VPMAXUD instruction to the active function. -func (c *Context) VPMAXUD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXUD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMAXUD xmm xmm xmm -// VPMAXUD m128 xmm xmm -// VPMAXUD ymm ymm ymm -// VPMAXUD m256 ymm ymm -// Construct and append a VPMAXUD instruction to the active function. -// Operates on the global context. -func VPMAXUD(mxy, xy, xy1 operand.Op) { ctx.VPMAXUD(mxy, xy, xy1) } - -// VPMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMAXUW xmm xmm xmm -// VPMAXUW m128 xmm xmm -// VPMAXUW ymm ymm ymm -// VPMAXUW m256 ymm ymm -// Construct and append a VPMAXUW instruction to the active function. -func (c *Context) VPMAXUW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMAXUW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMAXUW xmm xmm xmm -// VPMAXUW m128 xmm xmm -// VPMAXUW ymm ymm ymm -// VPMAXUW m256 ymm ymm -// Construct and append a VPMAXUW instruction to the active function. -// Operates on the global context. -func VPMAXUW(mxy, xy, xy1 operand.Op) { ctx.VPMAXUW(mxy, xy, xy1) } - -// VPMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMINSB xmm xmm xmm -// VPMINSB m128 xmm xmm -// VPMINSB ymm ymm ymm -// VPMINSB m256 ymm ymm -// Construct and append a VPMINSB instruction to the active function. -func (c *Context) VPMINSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMINSB xmm xmm xmm -// VPMINSB m128 xmm xmm -// VPMINSB ymm ymm ymm -// VPMINSB m256 ymm ymm -// Construct and append a VPMINSB instruction to the active function. -// Operates on the global context. -func VPMINSB(mxy, xy, xy1 operand.Op) { ctx.VPMINSB(mxy, xy, xy1) } - -// VPMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMINSD xmm xmm xmm -// VPMINSD m128 xmm xmm -// VPMINSD ymm ymm ymm -// VPMINSD m256 ymm ymm -// Construct and append a VPMINSD instruction to the active function. -func (c *Context) VPMINSD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINSD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMINSD xmm xmm xmm -// VPMINSD m128 xmm xmm -// VPMINSD ymm ymm ymm -// VPMINSD m256 ymm ymm -// Construct and append a VPMINSD instruction to the active function. -// Operates on the global context. -func VPMINSD(mxy, xy, xy1 operand.Op) { ctx.VPMINSD(mxy, xy, xy1) } - -// VPMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// VPMINSW xmm xmm xmm -// VPMINSW m128 xmm xmm -// VPMINSW ymm ymm ymm -// VPMINSW m256 ymm ymm -// Construct and append a VPMINSW instruction to the active function. -func (c *Context) VPMINSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// VPMINSW xmm xmm xmm -// VPMINSW m128 xmm xmm -// VPMINSW ymm ymm ymm -// VPMINSW m256 ymm ymm -// Construct and append a VPMINSW instruction to the active function. -// Operates on the global context. -func VPMINSW(mxy, xy, xy1 operand.Op) { ctx.VPMINSW(mxy, xy, xy1) } - -// VPMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMINUB xmm xmm xmm -// VPMINUB m128 xmm xmm -// VPMINUB ymm ymm ymm -// VPMINUB m256 ymm ymm -// Construct and append a VPMINUB instruction to the active function. -func (c *Context) VPMINUB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINUB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMINUB xmm xmm xmm -// VPMINUB m128 xmm xmm -// VPMINUB ymm ymm ymm -// VPMINUB m256 ymm ymm -// Construct and append a VPMINUB instruction to the active function. -// Operates on the global context. -func VPMINUB(mxy, xy, xy1 operand.Op) { ctx.VPMINUB(mxy, xy, xy1) } - -// VPMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMINUD xmm xmm xmm -// VPMINUD m128 xmm xmm -// VPMINUD ymm ymm ymm -// VPMINUD m256 ymm ymm -// Construct and append a VPMINUD instruction to the active function. -func (c *Context) VPMINUD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINUD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMINUD xmm xmm xmm -// VPMINUD m128 xmm xmm -// VPMINUD ymm ymm ymm -// VPMINUD m256 ymm ymm -// Construct and append a VPMINUD instruction to the active function. -// Operates on the global context. -func VPMINUD(mxy, xy, xy1 operand.Op) { ctx.VPMINUD(mxy, xy, xy1) } - -// VPMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMINUW xmm xmm xmm -// VPMINUW m128 xmm xmm -// VPMINUW ymm ymm ymm -// VPMINUW m256 ymm ymm -// Construct and append a VPMINUW instruction to the active function. -func (c *Context) VPMINUW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMINUW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMINUW xmm xmm xmm -// VPMINUW m128 xmm xmm -// VPMINUW ymm ymm ymm -// VPMINUW m256 ymm ymm -// Construct and append a VPMINUW instruction to the active function. -// Operates on the global context. -func VPMINUW(mxy, xy, xy1 operand.Op) { ctx.VPMINUW(mxy, xy, xy1) } - -// VPMOVMSKB: Move Byte Mask. -// -// Forms: -// -// VPMOVMSKB xmm r32 -// VPMOVMSKB ymm r32 -// Construct and append a VPMOVMSKB instruction to the active function. -func (c *Context) VPMOVMSKB(xy, r operand.Op) { - if inst, err := x86.VPMOVMSKB(xy, r); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVMSKB: Move Byte Mask. -// -// Forms: -// -// VPMOVMSKB xmm r32 -// VPMOVMSKB ymm r32 -// Construct and append a VPMOVMSKB instruction to the active function. -// Operates on the global context. -func VPMOVMSKB(xy, r operand.Op) { ctx.VPMOVMSKB(xy, r) } - -// VPMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBD xmm xmm -// VPMOVSXBD m32 xmm -// VPMOVSXBD xmm ymm -// VPMOVSXBD m64 ymm -// Construct and append a VPMOVSXBD instruction to the active function. -func (c *Context) VPMOVSXBD(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXBD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBD xmm xmm -// VPMOVSXBD m32 xmm -// VPMOVSXBD xmm ymm -// VPMOVSXBD m64 ymm -// Construct and append a VPMOVSXBD instruction to the active function. -// Operates on the global context. -func VPMOVSXBD(mx, xy operand.Op) { ctx.VPMOVSXBD(mx, xy) } - -// VPMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBQ xmm xmm -// VPMOVSXBQ m16 xmm -// VPMOVSXBQ xmm ymm -// VPMOVSXBQ m32 ymm -// Construct and append a VPMOVSXBQ instruction to the active function. -func (c *Context) VPMOVSXBQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXBQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBQ xmm xmm -// VPMOVSXBQ m16 xmm -// VPMOVSXBQ xmm ymm -// VPMOVSXBQ m32 ymm -// Construct and append a VPMOVSXBQ instruction to the active function. -// Operates on the global context. -func VPMOVSXBQ(mx, xy operand.Op) { ctx.VPMOVSXBQ(mx, xy) } - -// VPMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBW xmm xmm -// VPMOVSXBW m64 xmm -// VPMOVSXBW xmm ymm -// VPMOVSXBW m128 ymm -// Construct and append a VPMOVSXBW instruction to the active function. -func (c *Context) VPMOVSXBW(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXBW(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBW xmm xmm -// VPMOVSXBW m64 xmm -// VPMOVSXBW xmm ymm -// VPMOVSXBW m128 ymm -// Construct and append a VPMOVSXBW instruction to the active function. -// Operates on the global context. -func VPMOVSXBW(mx, xy operand.Op) { ctx.VPMOVSXBW(mx, xy) } - -// VPMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXDQ xmm xmm -// VPMOVSXDQ m64 xmm -// VPMOVSXDQ xmm ymm -// VPMOVSXDQ m128 ymm -// Construct and append a VPMOVSXDQ instruction to the active function. -func (c *Context) VPMOVSXDQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXDQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXDQ xmm xmm -// VPMOVSXDQ m64 xmm -// VPMOVSXDQ xmm ymm -// VPMOVSXDQ m128 ymm -// Construct and append a VPMOVSXDQ instruction to the active function. -// Operates on the global context. -func VPMOVSXDQ(mx, xy operand.Op) { ctx.VPMOVSXDQ(mx, xy) } - -// VPMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWD xmm xmm -// VPMOVSXWD m64 xmm -// VPMOVSXWD xmm ymm -// VPMOVSXWD m128 ymm -// Construct and append a VPMOVSXWD instruction to the active function. -func (c *Context) VPMOVSXWD(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXWD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWD xmm xmm -// VPMOVSXWD m64 xmm -// VPMOVSXWD xmm ymm -// VPMOVSXWD m128 ymm -// Construct and append a VPMOVSXWD instruction to the active function. -// Operates on the global context. -func VPMOVSXWD(mx, xy operand.Op) { ctx.VPMOVSXWD(mx, xy) } - -// VPMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWQ xmm xmm -// VPMOVSXWQ m32 xmm -// VPMOVSXWQ xmm ymm -// VPMOVSXWQ m64 ymm -// Construct and append a VPMOVSXWQ instruction to the active function. -func (c *Context) VPMOVSXWQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVSXWQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWQ xmm xmm -// VPMOVSXWQ m32 xmm -// VPMOVSXWQ xmm ymm -// VPMOVSXWQ m64 ymm -// Construct and append a VPMOVSXWQ instruction to the active function. -// Operates on the global context. -func VPMOVSXWQ(mx, xy operand.Op) { ctx.VPMOVSXWQ(mx, xy) } - -// VPMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBD xmm xmm -// VPMOVZXBD m32 xmm -// VPMOVZXBD xmm ymm -// VPMOVZXBD m64 ymm -// Construct and append a VPMOVZXBD instruction to the active function. -func (c *Context) VPMOVZXBD(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXBD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBD xmm xmm -// VPMOVZXBD m32 xmm -// VPMOVZXBD xmm ymm -// VPMOVZXBD m64 ymm -// Construct and append a VPMOVZXBD instruction to the active function. -// Operates on the global context. -func VPMOVZXBD(mx, xy operand.Op) { ctx.VPMOVZXBD(mx, xy) } - -// VPMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBQ xmm xmm -// VPMOVZXBQ m16 xmm -// VPMOVZXBQ xmm ymm -// VPMOVZXBQ m32 ymm -// Construct and append a VPMOVZXBQ instruction to the active function. -func (c *Context) VPMOVZXBQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXBQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBQ xmm xmm -// VPMOVZXBQ m16 xmm -// VPMOVZXBQ xmm ymm -// VPMOVZXBQ m32 ymm -// Construct and append a VPMOVZXBQ instruction to the active function. -// Operates on the global context. -func VPMOVZXBQ(mx, xy operand.Op) { ctx.VPMOVZXBQ(mx, xy) } - -// VPMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBW xmm xmm -// VPMOVZXBW m64 xmm -// VPMOVZXBW xmm ymm -// VPMOVZXBW m128 ymm -// Construct and append a VPMOVZXBW instruction to the active function. -func (c *Context) VPMOVZXBW(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXBW(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBW xmm xmm -// VPMOVZXBW m64 xmm -// VPMOVZXBW xmm ymm -// VPMOVZXBW m128 ymm -// Construct and append a VPMOVZXBW instruction to the active function. -// Operates on the global context. -func VPMOVZXBW(mx, xy operand.Op) { ctx.VPMOVZXBW(mx, xy) } - -// VPMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXDQ xmm xmm -// VPMOVZXDQ m64 xmm -// VPMOVZXDQ xmm ymm -// VPMOVZXDQ m128 ymm -// Construct and append a VPMOVZXDQ instruction to the active function. -func (c *Context) VPMOVZXDQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXDQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXDQ xmm xmm -// VPMOVZXDQ m64 xmm -// VPMOVZXDQ xmm ymm -// VPMOVZXDQ m128 ymm -// Construct and append a VPMOVZXDQ instruction to the active function. -// Operates on the global context. -func VPMOVZXDQ(mx, xy operand.Op) { ctx.VPMOVZXDQ(mx, xy) } - -// VPMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWD xmm xmm -// VPMOVZXWD m64 xmm -// VPMOVZXWD xmm ymm -// VPMOVZXWD m128 ymm -// Construct and append a VPMOVZXWD instruction to the active function. -func (c *Context) VPMOVZXWD(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXWD(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWD xmm xmm -// VPMOVZXWD m64 xmm -// VPMOVZXWD xmm ymm -// VPMOVZXWD m128 ymm -// Construct and append a VPMOVZXWD instruction to the active function. -// Operates on the global context. -func VPMOVZXWD(mx, xy operand.Op) { ctx.VPMOVZXWD(mx, xy) } - -// VPMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWQ xmm xmm -// VPMOVZXWQ m32 xmm -// VPMOVZXWQ xmm ymm -// VPMOVZXWQ m64 ymm -// Construct and append a VPMOVZXWQ instruction to the active function. -func (c *Context) VPMOVZXWQ(mx, xy operand.Op) { - if inst, err := x86.VPMOVZXWQ(mx, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWQ xmm xmm -// VPMOVZXWQ m32 xmm -// VPMOVZXWQ xmm ymm -// VPMOVZXWQ m64 ymm -// Construct and append a VPMOVZXWQ instruction to the active function. -// Operates on the global context. -func VPMOVZXWQ(mx, xy operand.Op) { ctx.VPMOVZXWQ(mx, xy) } - -// VPMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// VPMULDQ xmm xmm xmm -// VPMULDQ m128 xmm xmm -// VPMULDQ ymm ymm ymm -// VPMULDQ m256 ymm ymm -// Construct and append a VPMULDQ instruction to the active function. -func (c *Context) VPMULDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// VPMULDQ xmm xmm xmm -// VPMULDQ m128 xmm xmm -// VPMULDQ ymm ymm ymm -// VPMULDQ m256 ymm ymm -// Construct and append a VPMULDQ instruction to the active function. -// Operates on the global context. -func VPMULDQ(mxy, xy, xy1 operand.Op) { ctx.VPMULDQ(mxy, xy, xy1) } - -// VPMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// VPMULHRSW xmm xmm xmm -// VPMULHRSW m128 xmm xmm -// VPMULHRSW ymm ymm ymm -// VPMULHRSW m256 ymm ymm -// Construct and append a VPMULHRSW instruction to the active function. -func (c *Context) VPMULHRSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULHRSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// VPMULHRSW xmm xmm xmm -// VPMULHRSW m128 xmm xmm -// VPMULHRSW ymm ymm ymm -// VPMULHRSW m256 ymm ymm -// Construct and append a VPMULHRSW instruction to the active function. -// Operates on the global context. -func VPMULHRSW(mxy, xy, xy1 operand.Op) { ctx.VPMULHRSW(mxy, xy, xy1) } - -// VPMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// VPMULHUW xmm xmm xmm -// VPMULHUW m128 xmm xmm -// VPMULHUW ymm ymm ymm -// VPMULHUW m256 ymm ymm -// Construct and append a VPMULHUW instruction to the active function. -func (c *Context) VPMULHUW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULHUW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// VPMULHUW xmm xmm xmm -// VPMULHUW m128 xmm xmm -// VPMULHUW ymm ymm ymm -// VPMULHUW m256 ymm ymm -// Construct and append a VPMULHUW instruction to the active function. -// Operates on the global context. -func VPMULHUW(mxy, xy, xy1 operand.Op) { ctx.VPMULHUW(mxy, xy, xy1) } - -// VPMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// VPMULHW xmm xmm xmm -// VPMULHW m128 xmm xmm -// VPMULHW ymm ymm ymm -// VPMULHW m256 ymm ymm -// Construct and append a VPMULHW instruction to the active function. -func (c *Context) VPMULHW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULHW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// VPMULHW xmm xmm xmm -// VPMULHW m128 xmm xmm -// VPMULHW ymm ymm ymm -// VPMULHW m256 ymm ymm -// Construct and append a VPMULHW instruction to the active function. -// Operates on the global context. -func VPMULHW(mxy, xy, xy1 operand.Op) { ctx.VPMULHW(mxy, xy, xy1) } - -// VPMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// VPMULLD xmm xmm xmm -// VPMULLD m128 xmm xmm -// VPMULLD ymm ymm ymm -// VPMULLD m256 ymm ymm -// Construct and append a VPMULLD instruction to the active function. -func (c *Context) VPMULLD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULLD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// VPMULLD xmm xmm xmm -// VPMULLD m128 xmm xmm -// VPMULLD ymm ymm ymm -// VPMULLD m256 ymm ymm -// Construct and append a VPMULLD instruction to the active function. -// Operates on the global context. -func VPMULLD(mxy, xy, xy1 operand.Op) { ctx.VPMULLD(mxy, xy, xy1) } - -// VPMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// VPMULLW xmm xmm xmm -// VPMULLW m128 xmm xmm -// VPMULLW ymm ymm ymm -// VPMULLW m256 ymm ymm -// Construct and append a VPMULLW instruction to the active function. -func (c *Context) VPMULLW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULLW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// VPMULLW xmm xmm xmm -// VPMULLW m128 xmm xmm -// VPMULLW ymm ymm ymm -// VPMULLW m256 ymm ymm -// Construct and append a VPMULLW instruction to the active function. -// Operates on the global context. -func VPMULLW(mxy, xy, xy1 operand.Op) { ctx.VPMULLW(mxy, xy, xy1) } - -// VPMULUDQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMULUDQ xmm xmm xmm -// VPMULUDQ m128 xmm xmm -// VPMULUDQ ymm ymm ymm -// VPMULUDQ m256 ymm ymm -// Construct and append a VPMULUDQ instruction to the active function. -func (c *Context) VPMULUDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPMULUDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPMULUDQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMULUDQ xmm xmm xmm -// VPMULUDQ m128 xmm xmm -// VPMULUDQ ymm ymm ymm -// VPMULUDQ m256 ymm ymm -// Construct and append a VPMULUDQ instruction to the active function. -// Operates on the global context. -func VPMULUDQ(mxy, xy, xy1 operand.Op) { ctx.VPMULUDQ(mxy, xy, xy1) } - -// VPOR: Packed Bitwise Logical OR. -// -// Forms: -// -// VPOR xmm xmm xmm -// VPOR m128 xmm xmm -// VPOR ymm ymm ymm -// VPOR m256 ymm ymm -// Construct and append a VPOR instruction to the active function. -func (c *Context) VPOR(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPOR(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPOR: Packed Bitwise Logical OR. -// -// Forms: -// -// VPOR xmm xmm xmm -// VPOR m128 xmm xmm -// VPOR ymm ymm ymm -// VPOR m256 ymm ymm -// Construct and append a VPOR instruction to the active function. -// Operates on the global context. -func VPOR(mxy, xy, xy1 operand.Op) { ctx.VPOR(mxy, xy, xy1) } - -// VPSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// VPSADBW xmm xmm xmm -// VPSADBW m128 xmm xmm -// VPSADBW ymm ymm ymm -// VPSADBW m256 ymm ymm -// Construct and append a VPSADBW instruction to the active function. -func (c *Context) VPSADBW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSADBW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// VPSADBW xmm xmm xmm -// VPSADBW m128 xmm xmm -// VPSADBW ymm ymm ymm -// VPSADBW m256 ymm ymm -// Construct and append a VPSADBW instruction to the active function. -// Operates on the global context. -func VPSADBW(mxy, xy, xy1 operand.Op) { ctx.VPSADBW(mxy, xy, xy1) } - -// VPSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// VPSHUFB xmm xmm xmm -// VPSHUFB m128 xmm xmm -// VPSHUFB ymm ymm ymm -// VPSHUFB m256 ymm ymm -// Construct and append a VPSHUFB instruction to the active function. -func (c *Context) VPSHUFB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSHUFB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// VPSHUFB xmm xmm xmm -// VPSHUFB m128 xmm xmm -// VPSHUFB ymm ymm ymm -// VPSHUFB m256 ymm ymm -// Construct and append a VPSHUFB instruction to the active function. -// Operates on the global context. -func VPSHUFB(mxy, xy, xy1 operand.Op) { ctx.VPSHUFB(mxy, xy, xy1) } - -// VPSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// VPSHUFD imm8 xmm xmm -// VPSHUFD imm8 m128 xmm -// VPSHUFD imm8 ymm ymm -// VPSHUFD imm8 m256 ymm -// Construct and append a VPSHUFD instruction to the active function. -func (c *Context) VPSHUFD(i, mxy, xy operand.Op) { - if inst, err := x86.VPSHUFD(i, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// VPSHUFD imm8 xmm xmm -// VPSHUFD imm8 m128 xmm -// VPSHUFD imm8 ymm ymm -// VPSHUFD imm8 m256 ymm -// Construct and append a VPSHUFD instruction to the active function. -// Operates on the global context. -func VPSHUFD(i, mxy, xy operand.Op) { ctx.VPSHUFD(i, mxy, xy) } - -// VPSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// VPSHUFHW imm8 xmm xmm -// VPSHUFHW imm8 m128 xmm -// VPSHUFHW imm8 ymm ymm -// VPSHUFHW imm8 m256 ymm -// Construct and append a VPSHUFHW instruction to the active function. -func (c *Context) VPSHUFHW(i, mxy, xy operand.Op) { - if inst, err := x86.VPSHUFHW(i, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// VPSHUFHW imm8 xmm xmm -// VPSHUFHW imm8 m128 xmm -// VPSHUFHW imm8 ymm ymm -// VPSHUFHW imm8 m256 ymm -// Construct and append a VPSHUFHW instruction to the active function. -// Operates on the global context. -func VPSHUFHW(i, mxy, xy operand.Op) { ctx.VPSHUFHW(i, mxy, xy) } - -// VPSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// VPSHUFLW imm8 xmm xmm -// VPSHUFLW imm8 m128 xmm -// VPSHUFLW imm8 ymm ymm -// VPSHUFLW imm8 m256 ymm -// Construct and append a VPSHUFLW instruction to the active function. -func (c *Context) VPSHUFLW(i, mxy, xy operand.Op) { - if inst, err := x86.VPSHUFLW(i, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// VPSHUFLW imm8 xmm xmm -// VPSHUFLW imm8 m128 xmm -// VPSHUFLW imm8 ymm ymm -// VPSHUFLW imm8 m256 ymm -// Construct and append a VPSHUFLW instruction to the active function. -// Operates on the global context. -func VPSHUFLW(i, mxy, xy operand.Op) { ctx.VPSHUFLW(i, mxy, xy) } - -// VPSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// VPSIGNB xmm xmm xmm -// VPSIGNB m128 xmm xmm -// VPSIGNB ymm ymm ymm -// VPSIGNB m256 ymm ymm -// Construct and append a VPSIGNB instruction to the active function. -func (c *Context) VPSIGNB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSIGNB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// VPSIGNB xmm xmm xmm -// VPSIGNB m128 xmm xmm -// VPSIGNB ymm ymm ymm -// VPSIGNB m256 ymm ymm -// Construct and append a VPSIGNB instruction to the active function. -// Operates on the global context. -func VPSIGNB(mxy, xy, xy1 operand.Op) { ctx.VPSIGNB(mxy, xy, xy1) } - -// VPSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// VPSIGND xmm xmm xmm -// VPSIGND m128 xmm xmm -// VPSIGND ymm ymm ymm -// VPSIGND m256 ymm ymm -// Construct and append a VPSIGND instruction to the active function. -func (c *Context) VPSIGND(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSIGND(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// VPSIGND xmm xmm xmm -// VPSIGND m128 xmm xmm -// VPSIGND ymm ymm ymm -// VPSIGND m256 ymm ymm -// Construct and append a VPSIGND instruction to the active function. -// Operates on the global context. -func VPSIGND(mxy, xy, xy1 operand.Op) { ctx.VPSIGND(mxy, xy, xy1) } - -// VPSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// VPSIGNW xmm xmm xmm -// VPSIGNW m128 xmm xmm -// VPSIGNW ymm ymm ymm -// VPSIGNW m256 ymm ymm -// Construct and append a VPSIGNW instruction to the active function. -func (c *Context) VPSIGNW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSIGNW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// VPSIGNW xmm xmm xmm -// VPSIGNW m128 xmm xmm -// VPSIGNW ymm ymm ymm -// VPSIGNW m256 ymm ymm -// Construct and append a VPSIGNW instruction to the active function. -// Operates on the global context. -func VPSIGNW(mxy, xy, xy1 operand.Op) { ctx.VPSIGNW(mxy, xy, xy1) } - -// VPSLLD: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLD imm8 xmm xmm -// VPSLLD xmm xmm xmm -// VPSLLD m128 xmm xmm -// VPSLLD imm8 ymm ymm -// VPSLLD xmm ymm ymm -// VPSLLD m128 ymm ymm -// Construct and append a VPSLLD instruction to the active function. -func (c *Context) VPSLLD(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLD(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLD: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLD imm8 xmm xmm -// VPSLLD xmm xmm xmm -// VPSLLD m128 xmm xmm -// VPSLLD imm8 ymm ymm -// VPSLLD xmm ymm ymm -// VPSLLD m128 ymm ymm -// Construct and append a VPSLLD instruction to the active function. -// Operates on the global context. -func VPSLLD(imx, xy, xy1 operand.Op) { ctx.VPSLLD(imx, xy, xy1) } - -// VPSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// VPSLLDQ imm8 xmm xmm -// VPSLLDQ imm8 ymm ymm -// Construct and append a VPSLLDQ instruction to the active function. -func (c *Context) VPSLLDQ(i, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLDQ(i, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// VPSLLDQ imm8 xmm xmm -// VPSLLDQ imm8 ymm ymm -// Construct and append a VPSLLDQ instruction to the active function. -// Operates on the global context. -func VPSLLDQ(i, xy, xy1 operand.Op) { ctx.VPSLLDQ(i, xy, xy1) } - -// VPSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLQ imm8 xmm xmm -// VPSLLQ xmm xmm xmm -// VPSLLQ m128 xmm xmm -// VPSLLQ imm8 ymm ymm -// VPSLLQ xmm ymm ymm -// VPSLLQ m128 ymm ymm -// Construct and append a VPSLLQ instruction to the active function. -func (c *Context) VPSLLQ(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLQ(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLQ imm8 xmm xmm -// VPSLLQ xmm xmm xmm -// VPSLLQ m128 xmm xmm -// VPSLLQ imm8 ymm ymm -// VPSLLQ xmm ymm ymm -// VPSLLQ m128 ymm ymm -// Construct and append a VPSLLQ instruction to the active function. -// Operates on the global context. -func VPSLLQ(imx, xy, xy1 operand.Op) { ctx.VPSLLQ(imx, xy, xy1) } - -// VPSLLVD: Variable Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLVD xmm xmm xmm -// VPSLLVD m128 xmm xmm -// VPSLLVD ymm ymm ymm -// VPSLLVD m256 ymm ymm -// Construct and append a VPSLLVD instruction to the active function. -func (c *Context) VPSLLVD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLVD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLVD: Variable Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLVD xmm xmm xmm -// VPSLLVD m128 xmm xmm -// VPSLLVD ymm ymm ymm -// VPSLLVD m256 ymm ymm -// Construct and append a VPSLLVD instruction to the active function. -// Operates on the global context. -func VPSLLVD(mxy, xy, xy1 operand.Op) { ctx.VPSLLVD(mxy, xy, xy1) } - -// VPSLLVQ: Variable Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLVQ xmm xmm xmm -// VPSLLVQ m128 xmm xmm -// VPSLLVQ ymm ymm ymm -// VPSLLVQ m256 ymm ymm -// Construct and append a VPSLLVQ instruction to the active function. -func (c *Context) VPSLLVQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLVQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLVQ: Variable Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLVQ xmm xmm xmm -// VPSLLVQ m128 xmm xmm -// VPSLLVQ ymm ymm ymm -// VPSLLVQ m256 ymm ymm -// Construct and append a VPSLLVQ instruction to the active function. -// Operates on the global context. -func VPSLLVQ(mxy, xy, xy1 operand.Op) { ctx.VPSLLVQ(mxy, xy, xy1) } - -// VPSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// VPSLLW imm8 xmm xmm -// VPSLLW xmm xmm xmm -// VPSLLW m128 xmm xmm -// VPSLLW imm8 ymm ymm -// VPSLLW xmm ymm ymm -// VPSLLW m128 ymm ymm -// Construct and append a VPSLLW instruction to the active function. -func (c *Context) VPSLLW(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSLLW(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// VPSLLW imm8 xmm xmm -// VPSLLW xmm xmm xmm -// VPSLLW m128 xmm xmm -// VPSLLW imm8 ymm ymm -// VPSLLW xmm ymm ymm -// VPSLLW m128 ymm ymm -// Construct and append a VPSLLW instruction to the active function. -// Operates on the global context. -func VPSLLW(imx, xy, xy1 operand.Op) { ctx.VPSLLW(imx, xy, xy1) } - -// VPSRAD: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAD imm8 xmm xmm -// VPSRAD xmm xmm xmm -// VPSRAD m128 xmm xmm -// VPSRAD imm8 ymm ymm -// VPSRAD xmm ymm ymm -// VPSRAD m128 ymm ymm -// Construct and append a VPSRAD instruction to the active function. -func (c *Context) VPSRAD(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSRAD(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRAD: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAD imm8 xmm xmm -// VPSRAD xmm xmm xmm -// VPSRAD m128 xmm xmm -// VPSRAD imm8 ymm ymm -// VPSRAD xmm ymm ymm -// VPSRAD m128 ymm ymm -// Construct and append a VPSRAD instruction to the active function. -// Operates on the global context. -func VPSRAD(imx, xy, xy1 operand.Op) { ctx.VPSRAD(imx, xy, xy1) } - -// VPSRAVD: Variable Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAVD xmm xmm xmm -// VPSRAVD m128 xmm xmm -// VPSRAVD ymm ymm ymm -// VPSRAVD m256 ymm ymm -// Construct and append a VPSRAVD instruction to the active function. -func (c *Context) VPSRAVD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSRAVD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRAVD: Variable Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAVD xmm xmm xmm -// VPSRAVD m128 xmm xmm -// VPSRAVD ymm ymm ymm -// VPSRAVD m256 ymm ymm -// Construct and append a VPSRAVD instruction to the active function. -// Operates on the global context. -func VPSRAVD(mxy, xy, xy1 operand.Op) { ctx.VPSRAVD(mxy, xy, xy1) } - -// VPSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// VPSRAW imm8 xmm xmm -// VPSRAW xmm xmm xmm -// VPSRAW m128 xmm xmm -// VPSRAW imm8 ymm ymm -// VPSRAW xmm ymm ymm -// VPSRAW m128 ymm ymm -// Construct and append a VPSRAW instruction to the active function. -func (c *Context) VPSRAW(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSRAW(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// VPSRAW imm8 xmm xmm -// VPSRAW xmm xmm xmm -// VPSRAW m128 xmm xmm -// VPSRAW imm8 ymm ymm -// VPSRAW xmm ymm ymm -// VPSRAW m128 ymm ymm -// Construct and append a VPSRAW instruction to the active function. -// Operates on the global context. -func VPSRAW(imx, xy, xy1 operand.Op) { ctx.VPSRAW(imx, xy, xy1) } - -// VPSRLD: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLD imm8 xmm xmm -// VPSRLD xmm xmm xmm -// VPSRLD m128 xmm xmm -// VPSRLD imm8 ymm ymm -// VPSRLD xmm ymm ymm -// VPSRLD m128 ymm ymm -// Construct and append a VPSRLD instruction to the active function. -func (c *Context) VPSRLD(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLD(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLD: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLD imm8 xmm xmm -// VPSRLD xmm xmm xmm -// VPSRLD m128 xmm xmm -// VPSRLD imm8 ymm ymm -// VPSRLD xmm ymm ymm -// VPSRLD m128 ymm ymm -// Construct and append a VPSRLD instruction to the active function. -// Operates on the global context. -func VPSRLD(imx, xy, xy1 operand.Op) { ctx.VPSRLD(imx, xy, xy1) } - -// VPSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// VPSRLDQ imm8 xmm xmm -// VPSRLDQ imm8 ymm ymm -// Construct and append a VPSRLDQ instruction to the active function. -func (c *Context) VPSRLDQ(i, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLDQ(i, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// VPSRLDQ imm8 xmm xmm -// VPSRLDQ imm8 ymm ymm -// Construct and append a VPSRLDQ instruction to the active function. -// Operates on the global context. -func VPSRLDQ(i, xy, xy1 operand.Op) { ctx.VPSRLDQ(i, xy, xy1) } - -// VPSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLQ imm8 xmm xmm -// VPSRLQ xmm xmm xmm -// VPSRLQ m128 xmm xmm -// VPSRLQ imm8 ymm ymm -// VPSRLQ xmm ymm ymm -// VPSRLQ m128 ymm ymm -// Construct and append a VPSRLQ instruction to the active function. -func (c *Context) VPSRLQ(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLQ(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLQ imm8 xmm xmm -// VPSRLQ xmm xmm xmm -// VPSRLQ m128 xmm xmm -// VPSRLQ imm8 ymm ymm -// VPSRLQ xmm ymm ymm -// VPSRLQ m128 ymm ymm -// Construct and append a VPSRLQ instruction to the active function. -// Operates on the global context. -func VPSRLQ(imx, xy, xy1 operand.Op) { ctx.VPSRLQ(imx, xy, xy1) } - -// VPSRLVD: Variable Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLVD xmm xmm xmm -// VPSRLVD m128 xmm xmm -// VPSRLVD ymm ymm ymm -// VPSRLVD m256 ymm ymm -// Construct and append a VPSRLVD instruction to the active function. -func (c *Context) VPSRLVD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLVD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLVD: Variable Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLVD xmm xmm xmm -// VPSRLVD m128 xmm xmm -// VPSRLVD ymm ymm ymm -// VPSRLVD m256 ymm ymm -// Construct and append a VPSRLVD instruction to the active function. -// Operates on the global context. -func VPSRLVD(mxy, xy, xy1 operand.Op) { ctx.VPSRLVD(mxy, xy, xy1) } - -// VPSRLVQ: Variable Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLVQ xmm xmm xmm -// VPSRLVQ m128 xmm xmm -// VPSRLVQ ymm ymm ymm -// VPSRLVQ m256 ymm ymm -// Construct and append a VPSRLVQ instruction to the active function. -func (c *Context) VPSRLVQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLVQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLVQ: Variable Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLVQ xmm xmm xmm -// VPSRLVQ m128 xmm xmm -// VPSRLVQ ymm ymm ymm -// VPSRLVQ m256 ymm ymm -// Construct and append a VPSRLVQ instruction to the active function. -// Operates on the global context. -func VPSRLVQ(mxy, xy, xy1 operand.Op) { ctx.VPSRLVQ(mxy, xy, xy1) } - -// VPSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// VPSRLW imm8 xmm xmm -// VPSRLW xmm xmm xmm -// VPSRLW m128 xmm xmm -// VPSRLW imm8 ymm ymm -// VPSRLW xmm ymm ymm -// VPSRLW m128 ymm ymm -// Construct and append a VPSRLW instruction to the active function. -func (c *Context) VPSRLW(imx, xy, xy1 operand.Op) { - if inst, err := x86.VPSRLW(imx, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// VPSRLW imm8 xmm xmm -// VPSRLW xmm xmm xmm -// VPSRLW m128 xmm xmm -// VPSRLW imm8 ymm ymm -// VPSRLW xmm ymm ymm -// VPSRLW m128 ymm ymm -// Construct and append a VPSRLW instruction to the active function. -// Operates on the global context. -func VPSRLW(imx, xy, xy1 operand.Op) { ctx.VPSRLW(imx, xy, xy1) } - -// VPSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// VPSUBB xmm xmm xmm -// VPSUBB m128 xmm xmm -// VPSUBB ymm ymm ymm -// VPSUBB m256 ymm ymm -// Construct and append a VPSUBB instruction to the active function. -func (c *Context) VPSUBB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// VPSUBB xmm xmm xmm -// VPSUBB m128 xmm xmm -// VPSUBB ymm ymm ymm -// VPSUBB m256 ymm ymm -// Construct and append a VPSUBB instruction to the active function. -// Operates on the global context. -func VPSUBB(mxy, xy, xy1 operand.Op) { ctx.VPSUBB(mxy, xy, xy1) } - -// VPSUBD: Subtract Packed Doubleword Integers. -// -// Forms: -// -// VPSUBD xmm xmm xmm -// VPSUBD m128 xmm xmm -// VPSUBD ymm ymm ymm -// VPSUBD m256 ymm ymm -// Construct and append a VPSUBD instruction to the active function. -func (c *Context) VPSUBD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBD: Subtract Packed Doubleword Integers. -// -// Forms: -// -// VPSUBD xmm xmm xmm -// VPSUBD m128 xmm xmm -// VPSUBD ymm ymm ymm -// VPSUBD m256 ymm ymm -// Construct and append a VPSUBD instruction to the active function. -// Operates on the global context. -func VPSUBD(mxy, xy, xy1 operand.Op) { ctx.VPSUBD(mxy, xy, xy1) } - -// VPSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// VPSUBQ xmm xmm xmm -// VPSUBQ m128 xmm xmm -// VPSUBQ ymm ymm ymm -// VPSUBQ m256 ymm ymm -// Construct and append a VPSUBQ instruction to the active function. -func (c *Context) VPSUBQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// VPSUBQ xmm xmm xmm -// VPSUBQ m128 xmm xmm -// VPSUBQ ymm ymm ymm -// VPSUBQ m256 ymm ymm -// Construct and append a VPSUBQ instruction to the active function. -// Operates on the global context. -func VPSUBQ(mxy, xy, xy1 operand.Op) { ctx.VPSUBQ(mxy, xy, xy1) } - -// VPSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSB xmm xmm xmm -// VPSUBSB m128 xmm xmm -// VPSUBSB ymm ymm ymm -// VPSUBSB m256 ymm ymm -// Construct and append a VPSUBSB instruction to the active function. -func (c *Context) VPSUBSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSB xmm xmm xmm -// VPSUBSB m128 xmm xmm -// VPSUBSB ymm ymm ymm -// VPSUBSB m256 ymm ymm -// Construct and append a VPSUBSB instruction to the active function. -// Operates on the global context. -func VPSUBSB(mxy, xy, xy1 operand.Op) { ctx.VPSUBSB(mxy, xy, xy1) } - -// VPSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSW xmm xmm xmm -// VPSUBSW m128 xmm xmm -// VPSUBSW ymm ymm ymm -// VPSUBSW m256 ymm ymm -// Construct and append a VPSUBSW instruction to the active function. -func (c *Context) VPSUBSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSW xmm xmm xmm -// VPSUBSW m128 xmm xmm -// VPSUBSW ymm ymm ymm -// VPSUBSW m256 ymm ymm -// Construct and append a VPSUBSW instruction to the active function. -// Operates on the global context. -func VPSUBSW(mxy, xy, xy1 operand.Op) { ctx.VPSUBSW(mxy, xy, xy1) } - -// VPSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSB xmm xmm xmm -// VPSUBUSB m128 xmm xmm -// VPSUBUSB ymm ymm ymm -// VPSUBUSB m256 ymm ymm -// Construct and append a VPSUBUSB instruction to the active function. -func (c *Context) VPSUBUSB(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBUSB(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSB xmm xmm xmm -// VPSUBUSB m128 xmm xmm -// VPSUBUSB ymm ymm ymm -// VPSUBUSB m256 ymm ymm -// Construct and append a VPSUBUSB instruction to the active function. -// Operates on the global context. -func VPSUBUSB(mxy, xy, xy1 operand.Op) { ctx.VPSUBUSB(mxy, xy, xy1) } - -// VPSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSW xmm xmm xmm -// VPSUBUSW m128 xmm xmm -// VPSUBUSW ymm ymm ymm -// VPSUBUSW m256 ymm ymm -// Construct and append a VPSUBUSW instruction to the active function. -func (c *Context) VPSUBUSW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBUSW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSW xmm xmm xmm -// VPSUBUSW m128 xmm xmm -// VPSUBUSW ymm ymm ymm -// VPSUBUSW m256 ymm ymm -// Construct and append a VPSUBUSW instruction to the active function. -// Operates on the global context. -func VPSUBUSW(mxy, xy, xy1 operand.Op) { ctx.VPSUBUSW(mxy, xy, xy1) } - -// VPSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// VPSUBW xmm xmm xmm -// VPSUBW m128 xmm xmm -// VPSUBW ymm ymm ymm -// VPSUBW m256 ymm ymm -// Construct and append a VPSUBW instruction to the active function. -func (c *Context) VPSUBW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPSUBW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// VPSUBW xmm xmm xmm -// VPSUBW m128 xmm xmm -// VPSUBW ymm ymm ymm -// VPSUBW m256 ymm ymm -// Construct and append a VPSUBW instruction to the active function. -// Operates on the global context. -func VPSUBW(mxy, xy, xy1 operand.Op) { ctx.VPSUBW(mxy, xy, xy1) } - -// VPTEST: Packed Logical Compare. -// -// Forms: -// -// VPTEST xmm xmm -// VPTEST m128 xmm -// VPTEST ymm ymm -// VPTEST m256 ymm -// Construct and append a VPTEST instruction to the active function. -func (c *Context) VPTEST(mxy, xy operand.Op) { - if inst, err := x86.VPTEST(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPTEST: Packed Logical Compare. -// -// Forms: -// -// VPTEST xmm xmm -// VPTEST m128 xmm -// VPTEST ymm ymm -// VPTEST m256 ymm -// Construct and append a VPTEST instruction to the active function. -// Operates on the global context. -func VPTEST(mxy, xy operand.Op) { ctx.VPTEST(mxy, xy) } - -// VPUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKHBW xmm xmm xmm -// VPUNPCKHBW m128 xmm xmm -// VPUNPCKHBW ymm ymm ymm -// VPUNPCKHBW m256 ymm ymm -// Construct and append a VPUNPCKHBW instruction to the active function. -func (c *Context) VPUNPCKHBW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKHBW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKHBW xmm xmm xmm -// VPUNPCKHBW m128 xmm xmm -// VPUNPCKHBW ymm ymm ymm -// VPUNPCKHBW m256 ymm ymm -// Construct and append a VPUNPCKHBW instruction to the active function. -// Operates on the global context. -func VPUNPCKHBW(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKHBW(mxy, xy, xy1) } - -// VPUNPCKHDQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKHDQ xmm xmm xmm -// VPUNPCKHDQ m128 xmm xmm -// VPUNPCKHDQ ymm ymm ymm -// VPUNPCKHDQ m256 ymm ymm -// Construct and append a VPUNPCKHDQ instruction to the active function. -func (c *Context) VPUNPCKHDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKHDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKHDQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKHDQ xmm xmm xmm -// VPUNPCKHDQ m128 xmm xmm -// VPUNPCKHDQ ymm ymm ymm -// VPUNPCKHDQ m256 ymm ymm -// Construct and append a VPUNPCKHDQ instruction to the active function. -// Operates on the global context. -func VPUNPCKHDQ(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKHDQ(mxy, xy, xy1) } - -// VPUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKHQDQ xmm xmm xmm -// VPUNPCKHQDQ m128 xmm xmm -// VPUNPCKHQDQ ymm ymm ymm -// VPUNPCKHQDQ m256 ymm ymm -// Construct and append a VPUNPCKHQDQ instruction to the active function. -func (c *Context) VPUNPCKHQDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKHQDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKHQDQ xmm xmm xmm -// VPUNPCKHQDQ m128 xmm xmm -// VPUNPCKHQDQ ymm ymm ymm -// VPUNPCKHQDQ m256 ymm ymm -// Construct and append a VPUNPCKHQDQ instruction to the active function. -// Operates on the global context. -func VPUNPCKHQDQ(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKHQDQ(mxy, xy, xy1) } - -// VPUNPCKHWD: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKHWD xmm xmm xmm -// VPUNPCKHWD m128 xmm xmm -// VPUNPCKHWD ymm ymm ymm -// VPUNPCKHWD m256 ymm ymm -// Construct and append a VPUNPCKHWD instruction to the active function. -func (c *Context) VPUNPCKHWD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKHWD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKHWD: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKHWD xmm xmm xmm -// VPUNPCKHWD m128 xmm xmm -// VPUNPCKHWD ymm ymm ymm -// VPUNPCKHWD m256 ymm ymm -// Construct and append a VPUNPCKHWD instruction to the active function. -// Operates on the global context. -func VPUNPCKHWD(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKHWD(mxy, xy, xy1) } - -// VPUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKLBW xmm xmm xmm -// VPUNPCKLBW m128 xmm xmm -// VPUNPCKLBW ymm ymm ymm -// VPUNPCKLBW m256 ymm ymm -// Construct and append a VPUNPCKLBW instruction to the active function. -func (c *Context) VPUNPCKLBW(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKLBW(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKLBW xmm xmm xmm -// VPUNPCKLBW m128 xmm xmm -// VPUNPCKLBW ymm ymm ymm -// VPUNPCKLBW m256 ymm ymm -// Construct and append a VPUNPCKLBW instruction to the active function. -// Operates on the global context. -func VPUNPCKLBW(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKLBW(mxy, xy, xy1) } - -// VPUNPCKLDQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKLDQ xmm xmm xmm -// VPUNPCKLDQ m128 xmm xmm -// VPUNPCKLDQ ymm ymm ymm -// VPUNPCKLDQ m256 ymm ymm -// Construct and append a VPUNPCKLDQ instruction to the active function. -func (c *Context) VPUNPCKLDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKLDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKLDQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKLDQ xmm xmm xmm -// VPUNPCKLDQ m128 xmm xmm -// VPUNPCKLDQ ymm ymm ymm -// VPUNPCKLDQ m256 ymm ymm -// Construct and append a VPUNPCKLDQ instruction to the active function. -// Operates on the global context. -func VPUNPCKLDQ(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKLDQ(mxy, xy, xy1) } - -// VPUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKLQDQ xmm xmm xmm -// VPUNPCKLQDQ m128 xmm xmm -// VPUNPCKLQDQ ymm ymm ymm -// VPUNPCKLQDQ m256 ymm ymm -// Construct and append a VPUNPCKLQDQ instruction to the active function. -func (c *Context) VPUNPCKLQDQ(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKLQDQ(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKLQDQ xmm xmm xmm -// VPUNPCKLQDQ m128 xmm xmm -// VPUNPCKLQDQ ymm ymm ymm -// VPUNPCKLQDQ m256 ymm ymm -// Construct and append a VPUNPCKLQDQ instruction to the active function. -// Operates on the global context. -func VPUNPCKLQDQ(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKLQDQ(mxy, xy, xy1) } - -// VPUNPCKLWD: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKLWD xmm xmm xmm -// VPUNPCKLWD m128 xmm xmm -// VPUNPCKLWD ymm ymm ymm -// VPUNPCKLWD m256 ymm ymm -// Construct and append a VPUNPCKLWD instruction to the active function. -func (c *Context) VPUNPCKLWD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPUNPCKLWD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPUNPCKLWD: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKLWD xmm xmm xmm -// VPUNPCKLWD m128 xmm xmm -// VPUNPCKLWD ymm ymm ymm -// VPUNPCKLWD m256 ymm ymm -// Construct and append a VPUNPCKLWD instruction to the active function. -// Operates on the global context. -func VPUNPCKLWD(mxy, xy, xy1 operand.Op) { ctx.VPUNPCKLWD(mxy, xy, xy1) } - -// VPXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// VPXOR xmm xmm xmm -// VPXOR m128 xmm xmm -// VPXOR ymm ymm ymm -// VPXOR m256 ymm ymm -// Construct and append a VPXOR instruction to the active function. -func (c *Context) VPXOR(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VPXOR(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VPXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// VPXOR xmm xmm xmm -// VPXOR m128 xmm xmm -// VPXOR ymm ymm ymm -// VPXOR m256 ymm ymm -// Construct and append a VPXOR instruction to the active function. -// Operates on the global context. -func VPXOR(mxy, xy, xy1 operand.Op) { ctx.VPXOR(mxy, xy, xy1) } - -// VRCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPPS xmm xmm -// VRCPPS m128 xmm -// VRCPPS ymm ymm -// VRCPPS m256 ymm -// Construct and append a VRCPPS instruction to the active function. -func (c *Context) VRCPPS(mxy, xy operand.Op) { - if inst, err := x86.VRCPPS(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VRCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPPS xmm xmm -// VRCPPS m128 xmm -// VRCPPS ymm ymm -// VRCPPS m256 ymm -// Construct and append a VRCPPS instruction to the active function. -// Operates on the global context. -func VRCPPS(mxy, xy operand.Op) { ctx.VRCPPS(mxy, xy) } - -// VRCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPSS xmm xmm xmm -// VRCPSS m32 xmm xmm -// Construct and append a VRCPSS instruction to the active function. -func (c *Context) VRCPSS(mx, x, x1 operand.Op) { - if inst, err := x86.VRCPSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VRCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPSS xmm xmm xmm -// VRCPSS m32 xmm xmm -// Construct and append a VRCPSS instruction to the active function. -// Operates on the global context. -func VRCPSS(mx, x, x1 operand.Op) { ctx.VRCPSS(mx, x, x1) } - -// VROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPD imm8 xmm xmm -// VROUNDPD imm8 m128 xmm -// VROUNDPD imm8 ymm ymm -// VROUNDPD imm8 m256 ymm -// Construct and append a VROUNDPD instruction to the active function. -func (c *Context) VROUNDPD(i, mxy, xy operand.Op) { - if inst, err := x86.VROUNDPD(i, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPD imm8 xmm xmm -// VROUNDPD imm8 m128 xmm -// VROUNDPD imm8 ymm ymm -// VROUNDPD imm8 m256 ymm -// Construct and append a VROUNDPD instruction to the active function. -// Operates on the global context. -func VROUNDPD(i, mxy, xy operand.Op) { ctx.VROUNDPD(i, mxy, xy) } - -// VROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPS imm8 xmm xmm -// VROUNDPS imm8 m128 xmm -// VROUNDPS imm8 ymm ymm -// VROUNDPS imm8 m256 ymm -// Construct and append a VROUNDPS instruction to the active function. -func (c *Context) VROUNDPS(i, mxy, xy operand.Op) { - if inst, err := x86.VROUNDPS(i, mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPS imm8 xmm xmm -// VROUNDPS imm8 m128 xmm -// VROUNDPS imm8 ymm ymm -// VROUNDPS imm8 m256 ymm -// Construct and append a VROUNDPS instruction to the active function. -// Operates on the global context. -func VROUNDPS(i, mxy, xy operand.Op) { ctx.VROUNDPS(i, mxy, xy) } - -// VROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSD imm8 xmm xmm xmm -// VROUNDSD imm8 m64 xmm xmm -// Construct and append a VROUNDSD instruction to the active function. -func (c *Context) VROUNDSD(i, mx, x, x1 operand.Op) { - if inst, err := x86.VROUNDSD(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSD imm8 xmm xmm xmm -// VROUNDSD imm8 m64 xmm xmm -// Construct and append a VROUNDSD instruction to the active function. -// Operates on the global context. -func VROUNDSD(i, mx, x, x1 operand.Op) { ctx.VROUNDSD(i, mx, x, x1) } - -// VROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSS imm8 xmm xmm xmm -// VROUNDSS imm8 m32 xmm xmm -// Construct and append a VROUNDSS instruction to the active function. -func (c *Context) VROUNDSS(i, mx, x, x1 operand.Op) { - if inst, err := x86.VROUNDSS(i, mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSS imm8 xmm xmm xmm -// VROUNDSS imm8 m32 xmm xmm -// Construct and append a VROUNDSS instruction to the active function. -// Operates on the global context. -func VROUNDSS(i, mx, x, x1 operand.Op) { ctx.VROUNDSS(i, mx, x, x1) } - -// VRSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRSQRTPS xmm xmm -// VRSQRTPS m128 xmm -// VRSQRTPS ymm ymm -// VRSQRTPS m256 ymm -// Construct and append a VRSQRTPS instruction to the active function. -func (c *Context) VRSQRTPS(mxy, xy operand.Op) { - if inst, err := x86.VRSQRTPS(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VRSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRSQRTPS xmm xmm -// VRSQRTPS m128 xmm -// VRSQRTPS ymm ymm -// VRSQRTPS m256 ymm -// Construct and append a VRSQRTPS instruction to the active function. -// Operates on the global context. -func VRSQRTPS(mxy, xy operand.Op) { ctx.VRSQRTPS(mxy, xy) } - -// VRSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VRSQRTSS xmm xmm xmm -// VRSQRTSS m32 xmm xmm -// Construct and append a VRSQRTSS instruction to the active function. -func (c *Context) VRSQRTSS(mx, x, x1 operand.Op) { - if inst, err := x86.VRSQRTSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VRSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VRSQRTSS xmm xmm xmm -// VRSQRTSS m32 xmm xmm -// Construct and append a VRSQRTSS instruction to the active function. -// Operates on the global context. -func VRSQRTSS(mx, x, x1 operand.Op) { ctx.VRSQRTSS(mx, x, x1) } - -// VSHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPD imm8 xmm xmm xmm -// VSHUFPD imm8 m128 xmm xmm -// VSHUFPD imm8 ymm ymm ymm -// VSHUFPD imm8 m256 ymm ymm -// Construct and append a VSHUFPD instruction to the active function. -func (c *Context) VSHUFPD(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VSHUFPD(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPD imm8 xmm xmm xmm -// VSHUFPD imm8 m128 xmm xmm -// VSHUFPD imm8 ymm ymm ymm -// VSHUFPD imm8 m256 ymm ymm -// Construct and append a VSHUFPD instruction to the active function. -// Operates on the global context. -func VSHUFPD(i, mxy, xy, xy1 operand.Op) { ctx.VSHUFPD(i, mxy, xy, xy1) } - -// VSHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPS imm8 xmm xmm xmm -// VSHUFPS imm8 m128 xmm xmm -// VSHUFPS imm8 ymm ymm ymm -// VSHUFPS imm8 m256 ymm ymm -// Construct and append a VSHUFPS instruction to the active function. -func (c *Context) VSHUFPS(i, mxy, xy, xy1 operand.Op) { - if inst, err := x86.VSHUFPS(i, mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPS imm8 xmm xmm xmm -// VSHUFPS imm8 m128 xmm xmm -// VSHUFPS imm8 ymm ymm ymm -// VSHUFPS imm8 m256 ymm ymm -// Construct and append a VSHUFPS instruction to the active function. -// Operates on the global context. -func VSHUFPS(i, mxy, xy, xy1 operand.Op) { ctx.VSHUFPS(i, mxy, xy, xy1) } - -// VSQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPD xmm xmm -// VSQRTPD m128 xmm -// VSQRTPD ymm ymm -// VSQRTPD m256 ymm -// Construct and append a VSQRTPD instruction to the active function. -func (c *Context) VSQRTPD(mxy, xy operand.Op) { - if inst, err := x86.VSQRTPD(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPD xmm xmm -// VSQRTPD m128 xmm -// VSQRTPD ymm ymm -// VSQRTPD m256 ymm -// Construct and append a VSQRTPD instruction to the active function. -// Operates on the global context. -func VSQRTPD(mxy, xy operand.Op) { ctx.VSQRTPD(mxy, xy) } - -// VSQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPS xmm xmm -// VSQRTPS m128 xmm -// VSQRTPS ymm ymm -// VSQRTPS m256 ymm -// Construct and append a VSQRTPS instruction to the active function. -func (c *Context) VSQRTPS(mxy, xy operand.Op) { - if inst, err := x86.VSQRTPS(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPS xmm xmm -// VSQRTPS m128 xmm -// VSQRTPS ymm ymm -// VSQRTPS m256 ymm -// Construct and append a VSQRTPS instruction to the active function. -// Operates on the global context. -func VSQRTPS(mxy, xy operand.Op) { ctx.VSQRTPS(mxy, xy) } - -// VSQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSD xmm xmm xmm -// VSQRTSD m64 xmm xmm -// Construct and append a VSQRTSD instruction to the active function. -func (c *Context) VSQRTSD(mx, x, x1 operand.Op) { - if inst, err := x86.VSQRTSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSD xmm xmm xmm -// VSQRTSD m64 xmm xmm -// Construct and append a VSQRTSD instruction to the active function. -// Operates on the global context. -func VSQRTSD(mx, x, x1 operand.Op) { ctx.VSQRTSD(mx, x, x1) } - -// VSQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSS xmm xmm xmm -// VSQRTSS m32 xmm xmm -// Construct and append a VSQRTSS instruction to the active function. -func (c *Context) VSQRTSS(mx, x, x1 operand.Op) { - if inst, err := x86.VSQRTSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSS xmm xmm xmm -// VSQRTSS m32 xmm xmm -// Construct and append a VSQRTSS instruction to the active function. -// Operates on the global context. -func VSQRTSS(mx, x, x1 operand.Op) { ctx.VSQRTSS(mx, x, x1) } - -// VSTMXCSR: Store MXCSR Register State. -// -// Forms: -// -// VSTMXCSR m32 -// Construct and append a VSTMXCSR instruction to the active function. -func (c *Context) VSTMXCSR(m operand.Op) { - if inst, err := x86.VSTMXCSR(m); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSTMXCSR: Store MXCSR Register State. -// -// Forms: -// -// VSTMXCSR m32 -// Construct and append a VSTMXCSR instruction to the active function. -// Operates on the global context. -func VSTMXCSR(m operand.Op) { ctx.VSTMXCSR(m) } - -// VSUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPD xmm xmm xmm -// VSUBPD m128 xmm xmm -// VSUBPD ymm ymm ymm -// VSUBPD m256 ymm ymm -// Construct and append a VSUBPD instruction to the active function. -func (c *Context) VSUBPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VSUBPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPD xmm xmm xmm -// VSUBPD m128 xmm xmm -// VSUBPD ymm ymm ymm -// VSUBPD m256 ymm ymm -// Construct and append a VSUBPD instruction to the active function. -// Operates on the global context. -func VSUBPD(mxy, xy, xy1 operand.Op) { ctx.VSUBPD(mxy, xy, xy1) } - -// VSUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPS xmm xmm xmm -// VSUBPS m128 xmm xmm -// VSUBPS ymm ymm ymm -// VSUBPS m256 ymm ymm -// Construct and append a VSUBPS instruction to the active function. -func (c *Context) VSUBPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VSUBPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPS xmm xmm xmm -// VSUBPS m128 xmm xmm -// VSUBPS ymm ymm ymm -// VSUBPS m256 ymm ymm -// Construct and append a VSUBPS instruction to the active function. -// Operates on the global context. -func VSUBPS(mxy, xy, xy1 operand.Op) { ctx.VSUBPS(mxy, xy, xy1) } - -// VSUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSD xmm xmm xmm -// VSUBSD m64 xmm xmm -// Construct and append a VSUBSD instruction to the active function. -func (c *Context) VSUBSD(mx, x, x1 operand.Op) { - if inst, err := x86.VSUBSD(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSD xmm xmm xmm -// VSUBSD m64 xmm xmm -// Construct and append a VSUBSD instruction to the active function. -// Operates on the global context. -func VSUBSD(mx, x, x1 operand.Op) { ctx.VSUBSD(mx, x, x1) } - -// VSUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSS xmm xmm xmm -// VSUBSS m32 xmm xmm -// Construct and append a VSUBSS instruction to the active function. -func (c *Context) VSUBSS(mx, x, x1 operand.Op) { - if inst, err := x86.VSUBSS(mx, x, x1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VSUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSS xmm xmm xmm -// VSUBSS m32 xmm xmm -// Construct and append a VSUBSS instruction to the active function. -// Operates on the global context. -func VSUBSS(mx, x, x1 operand.Op) { ctx.VSUBSS(mx, x, x1) } - -// VTESTPD: Packed Double-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPD xmm xmm -// VTESTPD m128 xmm -// VTESTPD ymm ymm -// VTESTPD m256 ymm -// Construct and append a VTESTPD instruction to the active function. -func (c *Context) VTESTPD(mxy, xy operand.Op) { - if inst, err := x86.VTESTPD(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VTESTPD: Packed Double-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPD xmm xmm -// VTESTPD m128 xmm -// VTESTPD ymm ymm -// VTESTPD m256 ymm -// Construct and append a VTESTPD instruction to the active function. -// Operates on the global context. -func VTESTPD(mxy, xy operand.Op) { ctx.VTESTPD(mxy, xy) } - -// VTESTPS: Packed Single-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPS xmm xmm -// VTESTPS m128 xmm -// VTESTPS ymm ymm -// VTESTPS m256 ymm -// Construct and append a VTESTPS instruction to the active function. -func (c *Context) VTESTPS(mxy, xy operand.Op) { - if inst, err := x86.VTESTPS(mxy, xy); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VTESTPS: Packed Single-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPS xmm xmm -// VTESTPS m128 xmm -// VTESTPS ymm ymm -// VTESTPS m256 ymm -// Construct and append a VTESTPS instruction to the active function. -// Operates on the global context. -func VTESTPS(mxy, xy operand.Op) { ctx.VTESTPS(mxy, xy) } - -// VUCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISD xmm xmm -// VUCOMISD m64 xmm -// Construct and append a VUCOMISD instruction to the active function. -func (c *Context) VUCOMISD(mx, x operand.Op) { - if inst, err := x86.VUCOMISD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISD xmm xmm -// VUCOMISD m64 xmm -// Construct and append a VUCOMISD instruction to the active function. -// Operates on the global context. -func VUCOMISD(mx, x operand.Op) { ctx.VUCOMISD(mx, x) } - -// VUCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISS xmm xmm -// VUCOMISS m32 xmm -// Construct and append a VUCOMISS instruction to the active function. -func (c *Context) VUCOMISS(mx, x operand.Op) { - if inst, err := x86.VUCOMISS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISS xmm xmm -// VUCOMISS m32 xmm -// Construct and append a VUCOMISS instruction to the active function. -// Operates on the global context. -func VUCOMISS(mx, x operand.Op) { ctx.VUCOMISS(mx, x) } - -// VUNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPD xmm xmm xmm -// VUNPCKHPD m128 xmm xmm -// VUNPCKHPD ymm ymm ymm -// VUNPCKHPD m256 ymm ymm -// Construct and append a VUNPCKHPD instruction to the active function. -func (c *Context) VUNPCKHPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VUNPCKHPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPD xmm xmm xmm -// VUNPCKHPD m128 xmm xmm -// VUNPCKHPD ymm ymm ymm -// VUNPCKHPD m256 ymm ymm -// Construct and append a VUNPCKHPD instruction to the active function. -// Operates on the global context. -func VUNPCKHPD(mxy, xy, xy1 operand.Op) { ctx.VUNPCKHPD(mxy, xy, xy1) } - -// VUNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPS xmm xmm xmm -// VUNPCKHPS m128 xmm xmm -// VUNPCKHPS ymm ymm ymm -// VUNPCKHPS m256 ymm ymm -// Construct and append a VUNPCKHPS instruction to the active function. -func (c *Context) VUNPCKHPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VUNPCKHPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPS xmm xmm xmm -// VUNPCKHPS m128 xmm xmm -// VUNPCKHPS ymm ymm ymm -// VUNPCKHPS m256 ymm ymm -// Construct and append a VUNPCKHPS instruction to the active function. -// Operates on the global context. -func VUNPCKHPS(mxy, xy, xy1 operand.Op) { ctx.VUNPCKHPS(mxy, xy, xy1) } - -// VUNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPD xmm xmm xmm -// VUNPCKLPD m128 xmm xmm -// VUNPCKLPD ymm ymm ymm -// VUNPCKLPD m256 ymm ymm -// Construct and append a VUNPCKLPD instruction to the active function. -func (c *Context) VUNPCKLPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VUNPCKLPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPD xmm xmm xmm -// VUNPCKLPD m128 xmm xmm -// VUNPCKLPD ymm ymm ymm -// VUNPCKLPD m256 ymm ymm -// Construct and append a VUNPCKLPD instruction to the active function. -// Operates on the global context. -func VUNPCKLPD(mxy, xy, xy1 operand.Op) { ctx.VUNPCKLPD(mxy, xy, xy1) } - -// VUNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPS xmm xmm xmm -// VUNPCKLPS m128 xmm xmm -// VUNPCKLPS ymm ymm ymm -// VUNPCKLPS m256 ymm ymm -// Construct and append a VUNPCKLPS instruction to the active function. -func (c *Context) VUNPCKLPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VUNPCKLPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VUNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPS xmm xmm xmm -// VUNPCKLPS m128 xmm xmm -// VUNPCKLPS ymm ymm ymm -// VUNPCKLPS m256 ymm ymm -// Construct and append a VUNPCKLPS instruction to the active function. -// Operates on the global context. -func VUNPCKLPS(mxy, xy, xy1 operand.Op) { ctx.VUNPCKLPS(mxy, xy, xy1) } - -// VXORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// VXORPD xmm xmm xmm -// VXORPD m128 xmm xmm -// VXORPD ymm ymm ymm -// VXORPD m256 ymm ymm -// Construct and append a VXORPD instruction to the active function. -func (c *Context) VXORPD(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VXORPD(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VXORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// VXORPD xmm xmm xmm -// VXORPD m128 xmm xmm -// VXORPD ymm ymm ymm -// VXORPD m256 ymm ymm -// Construct and append a VXORPD instruction to the active function. -// Operates on the global context. -func VXORPD(mxy, xy, xy1 operand.Op) { ctx.VXORPD(mxy, xy, xy1) } - -// VXORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// VXORPS xmm xmm xmm -// VXORPS m128 xmm xmm -// VXORPS ymm ymm ymm -// VXORPS m256 ymm ymm -// Construct and append a VXORPS instruction to the active function. -func (c *Context) VXORPS(mxy, xy, xy1 operand.Op) { - if inst, err := x86.VXORPS(mxy, xy, xy1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VXORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// VXORPS xmm xmm xmm -// VXORPS m128 xmm xmm -// VXORPS ymm ymm ymm -// VXORPS m256 ymm ymm -// Construct and append a VXORPS instruction to the active function. -// Operates on the global context. -func VXORPS(mxy, xy, xy1 operand.Op) { ctx.VXORPS(mxy, xy, xy1) } - -// VZEROALL: Zero All YMM Registers. -// -// Forms: -// -// VZEROALL -// Construct and append a VZEROALL instruction to the active function. -func (c *Context) VZEROALL() { - if inst, err := x86.VZEROALL(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VZEROALL: Zero All YMM Registers. -// -// Forms: -// -// VZEROALL -// Construct and append a VZEROALL instruction to the active function. -// Operates on the global context. -func VZEROALL() { ctx.VZEROALL() } - -// VZEROUPPER: Zero Upper Bits of YMM Registers. -// -// Forms: -// -// VZEROUPPER -// Construct and append a VZEROUPPER instruction to the active function. -func (c *Context) VZEROUPPER() { - if inst, err := x86.VZEROUPPER(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// VZEROUPPER: Zero Upper Bits of YMM Registers. -// -// Forms: -// -// VZEROUPPER -// Construct and append a VZEROUPPER instruction to the active function. -// Operates on the global context. -func VZEROUPPER() { ctx.VZEROUPPER() } - -// XADDB: Exchange and Add. -// -// Forms: -// -// XADDB r8 r8 -// XADDB r8 m8 -// Construct and append a XADDB instruction to the active function. -func (c *Context) XADDB(r, mr operand.Op) { - if inst, err := x86.XADDB(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XADDB: Exchange and Add. -// -// Forms: -// -// XADDB r8 r8 -// XADDB r8 m8 -// Construct and append a XADDB instruction to the active function. -// Operates on the global context. -func XADDB(r, mr operand.Op) { ctx.XADDB(r, mr) } - -// XADDL: Exchange and Add. -// -// Forms: -// -// XADDL r32 r32 -// XADDL r32 m32 -// Construct and append a XADDL instruction to the active function. -func (c *Context) XADDL(r, mr operand.Op) { - if inst, err := x86.XADDL(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XADDL: Exchange and Add. -// -// Forms: -// -// XADDL r32 r32 -// XADDL r32 m32 -// Construct and append a XADDL instruction to the active function. -// Operates on the global context. -func XADDL(r, mr operand.Op) { ctx.XADDL(r, mr) } - -// XADDQ: Exchange and Add. -// -// Forms: -// -// XADDQ r64 r64 -// XADDQ r64 m64 -// Construct and append a XADDQ instruction to the active function. -func (c *Context) XADDQ(r, mr operand.Op) { - if inst, err := x86.XADDQ(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XADDQ: Exchange and Add. -// -// Forms: -// -// XADDQ r64 r64 -// XADDQ r64 m64 -// Construct and append a XADDQ instruction to the active function. -// Operates on the global context. -func XADDQ(r, mr operand.Op) { ctx.XADDQ(r, mr) } - -// XADDW: Exchange and Add. -// -// Forms: -// -// XADDW r16 r16 -// XADDW r16 m16 -// Construct and append a XADDW instruction to the active function. -func (c *Context) XADDW(r, mr operand.Op) { - if inst, err := x86.XADDW(r, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XADDW: Exchange and Add. -// -// Forms: -// -// XADDW r16 r16 -// XADDW r16 m16 -// Construct and append a XADDW instruction to the active function. -// Operates on the global context. -func XADDW(r, mr operand.Op) { ctx.XADDW(r, mr) } - -// XCHGB: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGB r8 r8 -// XCHGB m8 r8 -// XCHGB r8 m8 -// Construct and append a XCHGB instruction to the active function. -func (c *Context) XCHGB(mr, mr1 operand.Op) { - if inst, err := x86.XCHGB(mr, mr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XCHGB: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGB r8 r8 -// XCHGB m8 r8 -// XCHGB r8 m8 -// Construct and append a XCHGB instruction to the active function. -// Operates on the global context. -func XCHGB(mr, mr1 operand.Op) { ctx.XCHGB(mr, mr1) } - -// XCHGL: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGL r32 eax -// XCHGL eax r32 -// XCHGL r32 r32 -// XCHGL m32 r32 -// XCHGL r32 m32 -// Construct and append a XCHGL instruction to the active function. -func (c *Context) XCHGL(emr, emr1 operand.Op) { - if inst, err := x86.XCHGL(emr, emr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XCHGL: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGL r32 eax -// XCHGL eax r32 -// XCHGL r32 r32 -// XCHGL m32 r32 -// XCHGL r32 m32 -// Construct and append a XCHGL instruction to the active function. -// Operates on the global context. -func XCHGL(emr, emr1 operand.Op) { ctx.XCHGL(emr, emr1) } - -// XCHGQ: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGQ r64 rax -// XCHGQ rax r64 -// XCHGQ r64 r64 -// XCHGQ m64 r64 -// XCHGQ r64 m64 -// Construct and append a XCHGQ instruction to the active function. -func (c *Context) XCHGQ(mr, mr1 operand.Op) { - if inst, err := x86.XCHGQ(mr, mr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XCHGQ: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGQ r64 rax -// XCHGQ rax r64 -// XCHGQ r64 r64 -// XCHGQ m64 r64 -// XCHGQ r64 m64 -// Construct and append a XCHGQ instruction to the active function. -// Operates on the global context. -func XCHGQ(mr, mr1 operand.Op) { ctx.XCHGQ(mr, mr1) } - -// XCHGW: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGW r16 ax -// XCHGW ax r16 -// XCHGW r16 r16 -// XCHGW m16 r16 -// XCHGW r16 m16 -// Construct and append a XCHGW instruction to the active function. -func (c *Context) XCHGW(amr, amr1 operand.Op) { - if inst, err := x86.XCHGW(amr, amr1); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XCHGW: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGW r16 ax -// XCHGW ax r16 -// XCHGW r16 r16 -// XCHGW m16 r16 -// XCHGW r16 m16 -// Construct and append a XCHGW instruction to the active function. -// Operates on the global context. -func XCHGW(amr, amr1 operand.Op) { ctx.XCHGW(amr, amr1) } - -// XGETBV: Get Value of Extended Control Register. -// -// Forms: -// -// XGETBV -// Construct and append a XGETBV instruction to the active function. -func (c *Context) XGETBV() { - if inst, err := x86.XGETBV(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XGETBV: Get Value of Extended Control Register. -// -// Forms: -// -// XGETBV -// Construct and append a XGETBV instruction to the active function. -// Operates on the global context. -func XGETBV() { ctx.XGETBV() } - -// XLAT: Table Look-up Translation. -// -// Forms: -// -// XLAT -// Construct and append a XLAT instruction to the active function. -func (c *Context) XLAT() { - if inst, err := x86.XLAT(); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XLAT: Table Look-up Translation. -// -// Forms: -// -// XLAT -// Construct and append a XLAT instruction to the active function. -// Operates on the global context. -func XLAT() { ctx.XLAT() } - -// XORB: Logical Exclusive OR. -// -// Forms: -// -// XORB imm8 al -// XORB imm8 r8 -// XORB r8 r8 -// XORB m8 r8 -// XORB imm8 m8 -// XORB r8 m8 -// Construct and append a XORB instruction to the active function. -func (c *Context) XORB(imr, amr operand.Op) { - if inst, err := x86.XORB(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORB: Logical Exclusive OR. -// -// Forms: -// -// XORB imm8 al -// XORB imm8 r8 -// XORB r8 r8 -// XORB m8 r8 -// XORB imm8 m8 -// XORB r8 m8 -// Construct and append a XORB instruction to the active function. -// Operates on the global context. -func XORB(imr, amr operand.Op) { ctx.XORB(imr, amr) } - -// XORL: Logical Exclusive OR. -// -// Forms: -// -// XORL imm32 eax -// XORL imm8 r32 -// XORL imm32 r32 -// XORL r32 r32 -// XORL m32 r32 -// XORL imm8 m32 -// XORL imm32 m32 -// XORL r32 m32 -// Construct and append a XORL instruction to the active function. -func (c *Context) XORL(imr, emr operand.Op) { - if inst, err := x86.XORL(imr, emr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORL: Logical Exclusive OR. -// -// Forms: -// -// XORL imm32 eax -// XORL imm8 r32 -// XORL imm32 r32 -// XORL r32 r32 -// XORL m32 r32 -// XORL imm8 m32 -// XORL imm32 m32 -// XORL r32 m32 -// Construct and append a XORL instruction to the active function. -// Operates on the global context. -func XORL(imr, emr operand.Op) { ctx.XORL(imr, emr) } - -// XORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// XORPD xmm xmm -// XORPD m128 xmm -// Construct and append a XORPD instruction to the active function. -func (c *Context) XORPD(mx, x operand.Op) { - if inst, err := x86.XORPD(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// XORPD xmm xmm -// XORPD m128 xmm -// Construct and append a XORPD instruction to the active function. -// Operates on the global context. -func XORPD(mx, x operand.Op) { ctx.XORPD(mx, x) } - -// XORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// XORPS xmm xmm -// XORPS m128 xmm -// Construct and append a XORPS instruction to the active function. -func (c *Context) XORPS(mx, x operand.Op) { - if inst, err := x86.XORPS(mx, x); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// XORPS xmm xmm -// XORPS m128 xmm -// Construct and append a XORPS instruction to the active function. -// Operates on the global context. -func XORPS(mx, x operand.Op) { ctx.XORPS(mx, x) } - -// XORQ: Logical Exclusive OR. -// -// Forms: -// -// XORQ imm32 rax -// XORQ imm8 r64 -// XORQ imm32 r64 -// XORQ r64 r64 -// XORQ m64 r64 -// XORQ imm8 m64 -// XORQ imm32 m64 -// XORQ r64 m64 -// Construct and append a XORQ instruction to the active function. -func (c *Context) XORQ(imr, mr operand.Op) { - if inst, err := x86.XORQ(imr, mr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORQ: Logical Exclusive OR. -// -// Forms: -// -// XORQ imm32 rax -// XORQ imm8 r64 -// XORQ imm32 r64 -// XORQ r64 r64 -// XORQ m64 r64 -// XORQ imm8 m64 -// XORQ imm32 m64 -// XORQ r64 m64 -// Construct and append a XORQ instruction to the active function. -// Operates on the global context. -func XORQ(imr, mr operand.Op) { ctx.XORQ(imr, mr) } - -// XORW: Logical Exclusive OR. -// -// Forms: -// -// XORW imm16 ax -// XORW imm8 r16 -// XORW imm16 r16 -// XORW r16 r16 -// XORW m16 r16 -// XORW imm8 m16 -// XORW imm16 m16 -// XORW r16 m16 -// Construct and append a XORW instruction to the active function. -func (c *Context) XORW(imr, amr operand.Op) { - if inst, err := x86.XORW(imr, amr); err == nil { - c.Instruction(inst) - } else { - c.adderror(err) - } -} - -// XORW: Logical Exclusive OR. -// -// Forms: -// -// XORW imm16 ax -// XORW imm8 r16 -// XORW imm16 r16 -// XORW r16 r16 -// XORW m16 r16 -// XORW imm8 m16 -// XORW imm16 m16 -// XORW r16 m16 -// Construct and append a XORW instruction to the active function. -// Operates on the global context. -func XORW(imr, amr operand.Op) { ctx.XORW(imr, amr) } diff --git a/vendor/github.com/mmcloughlin/avo/build/zmov.go b/vendor/github.com/mmcloughlin/avo/build/zmov.go deleted file mode 100644 index bfd9b081..00000000 --- a/vendor/github.com/mmcloughlin/avo/build/zmov.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by command: avogen -output zmov.go mov. DO NOT EDIT. - -package build - -import ( - "github.com/mmcloughlin/avo/operand" - "go/types" -) - -func (c *Context) mov(a, b operand.Op, an, bn int, t *types.Basic) { - switch { - case (t.Info()&types.IsInteger) != 0 && an == 1 && bn == 1: - c.MOVB(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 1 && bn == 4: - c.MOVBLSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 1 && bn == 4: - c.MOVBLZX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 1 && bn == 8: - c.MOVBQSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 1 && bn == 8: - c.MOVBQZX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 1 && bn == 2: - c.MOVBWSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 1 && bn == 2: - c.MOVBWZX(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 4 && bn == 4: - c.MOVL(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 4 && bn == 8: - c.MOVLQSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 4 && bn == 8: - c.MOVLQZX(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 16 && bn == 16: - c.MOVOU(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 4 && bn == 16: - c.MOVQ(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 8 && bn == 8: - c.MOVQ(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 8 && bn == 16: - c.MOVQ(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 16 && bn == 4: - c.MOVQ(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 16 && bn == 8: - c.MOVQ(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 16 && bn == 16: - c.MOVQ(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 8 && bn == 16: - c.MOVSD(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 16 && bn == 8: - c.MOVSD(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 16 && bn == 16: - c.MOVSD(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 4 && bn == 16: - c.MOVSS(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 16 && bn == 4: - c.MOVSS(a, b) - case (t.Info()&types.IsFloat) != 0 && an == 16 && bn == 16: - c.MOVSS(a, b) - case (t.Info()&types.IsInteger) != 0 && an == 2 && bn == 2: - c.MOVW(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 2 && bn == 4: - c.MOVWLSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 2 && bn == 4: - c.MOVWLZX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) == 0 && an == 2 && bn == 8: - c.MOVWQSX(a, b) - case (t.Info()&types.IsInteger) != 0 && (t.Info()&types.IsUnsigned) != 0 && an == 2 && bn == 8: - c.MOVWQZX(a, b) - default: - c.adderrormessage("could not deduce mov instruction") - } -} diff --git a/vendor/github.com/mmcloughlin/avo/buildtags/buildtags.go b/vendor/github.com/mmcloughlin/avo/buildtags/buildtags.go deleted file mode 100644 index 8fd61e10..00000000 --- a/vendor/github.com/mmcloughlin/avo/buildtags/buildtags.go +++ /dev/null @@ -1,312 +0,0 @@ -// Package buildtags provides types for representing and manipulating build constraints. -// -// In Go, build constraints are represented as comments in source code together with file naming conventions. For example -// -// // +build linux,386 darwin,!cgo -// // +build !purego -// -// Any terms provided in the filename can be thought of as an implicit extra -// constraint comment line. Collectively, these are referred to as -// ``constraints''. Each line is a ``constraint''. Within each constraint the -// space-separated terms are ``options'', and within that the comma-separated -// items are ``terms'' which may be negated with at most one exclaimation mark. -// -// These represent a boolean formulae. The constraints are evaluated as the AND -// of constraint lines; a constraint is evaluated as the OR of its options and -// an option is evaluated as the AND of its terms. Overall build constraints are -// a boolean formula that is an AND of ORs of ANDs. -// -// This level of complexity is rarely used in Go programs. Therefore this -// package aims to provide access to all these layers of nesting if required, -// but make it easy to forget about for basic use cases too. -package buildtags - -import ( - "errors" - "fmt" - "strings" - "unicode" -) - -// Reference: https://github.com/golang/go/blob/204a8f55dc2e0ac8d27a781dab0da609b98560da/src/go/build/doc.go#L73-L92 -// -// // A build constraint is evaluated as the OR of space-separated options; -// // each option evaluates as the AND of its comma-separated terms; -// // and each term is an alphanumeric word or, preceded by !, its negation. -// // That is, the build constraint: -// // -// // // +build linux,386 darwin,!cgo -// // -// // corresponds to the boolean formula: -// // -// // (linux AND 386) OR (darwin AND (NOT cgo)) -// // -// // A file may have multiple build constraints. The overall constraint is the AND -// // of the individual constraints. That is, the build constraints: -// // -// // // +build linux darwin -// // // +build 386 -// // -// // corresponds to the boolean formula: -// // -// // (linux OR darwin) AND 386 -// - -// Interface represents a build constraint. -type Interface interface { - ConstraintsConvertable - fmt.GoStringer - Evaluate(v map[string]bool) bool - Validate() error -} - -// ConstraintsConvertable can be converted to a Constraints object. -type ConstraintsConvertable interface { - ToConstraints() Constraints -} - -// ConstraintConvertable can be converted to a Constraint. -type ConstraintConvertable interface { - ToConstraint() Constraint -} - -// OptionConvertable can be converted to an Option. -type OptionConvertable interface { - ToOption() Option -} - -// Constraints represents the AND of a list of Constraint lines. -type Constraints []Constraint - -// And builds Constraints that will be true if all of its constraints are true. -func And(cs ...ConstraintConvertable) Constraints { - constraints := Constraints{} - for _, c := range cs { - constraints = append(constraints, c.ToConstraint()) - } - return constraints -} - -// ToConstraints returns cs. -func (cs Constraints) ToConstraints() Constraints { return cs } - -// Validate validates the constraints set. -func (cs Constraints) Validate() error { - for _, c := range cs { - if err := c.Validate(); err != nil { - return err - } - } - return nil -} - -// Evaluate the boolean formula represented by cs under the given assignment of -// tag values. This is the AND of the values of the constituent Constraints. -func (cs Constraints) Evaluate(v map[string]bool) bool { - r := true - for _, c := range cs { - r = r && c.Evaluate(v) - } - return r -} - -// GoString represents Constraints as +build comment lines. -func (cs Constraints) GoString() string { - s := "" - for _, c := range cs { - s += c.GoString() - } - return s -} - -// Constraint represents the OR of a list of Options. -type Constraint []Option - -// Any builds a Constraint that will be true if any of its options are true. -func Any(opts ...OptionConvertable) Constraint { - c := Constraint{} - for _, opt := range opts { - c = append(c, opt.ToOption()) - } - return c -} - -// ParseConstraint parses a space-separated list of options. -func ParseConstraint(expr string) (Constraint, error) { - c := Constraint{} - for _, field := range strings.Fields(expr) { - opt, err := ParseOption(field) - if err != nil { - return c, err - } - c = append(c, opt) - } - return c, nil -} - -// ToConstraints returns the list of constraints containing just c. -func (c Constraint) ToConstraints() Constraints { return Constraints{c} } - -// ToConstraint returns c. -func (c Constraint) ToConstraint() Constraint { return c } - -// Validate validates the constraint. -func (c Constraint) Validate() error { - for _, o := range c { - if err := o.Validate(); err != nil { - return err - } - } - return nil -} - -// Evaluate the boolean formula represented by c under the given assignment of -// tag values. This is the OR of the values of the constituent Options. -func (c Constraint) Evaluate(v map[string]bool) bool { - r := false - for _, o := range c { - r = r || o.Evaluate(v) - } - return r -} - -// GoString represents the Constraint as one +build comment line. -func (c Constraint) GoString() string { - s := "// +build" - for _, o := range c { - s += " " + o.GoString() - } - return s + "\n" -} - -// Option represents the AND of a list of Terms. -type Option []Term - -// Opt builds an Option from the list of Terms. -func Opt(terms ...Term) Option { - return Option(terms) -} - -// ParseOption parses a comma-separated list of terms. -func ParseOption(expr string) (Option, error) { - opt := Option{} - for _, t := range strings.Split(expr, ",") { - opt = append(opt, Term(t)) - } - return opt, opt.Validate() -} - -// ToConstraints returns Constraints containing just this option. -func (o Option) ToConstraints() Constraints { return o.ToConstraint().ToConstraints() } - -// ToConstraint returns a Constraint containing just this option. -func (o Option) ToConstraint() Constraint { return Constraint{o} } - -// ToOption returns o. -func (o Option) ToOption() Option { return o } - -// Validate validates o. -func (o Option) Validate() error { - for _, t := range o { - if err := t.Validate(); err != nil { - return fmt.Errorf("invalid term \"%s\": %s", t, err) - } - } - return nil -} - -// Evaluate the boolean formula represented by o under the given assignment of -// tag values. This is the AND of the values of the constituent Terms. -func (o Option) Evaluate(v map[string]bool) bool { - r := true - for _, t := range o { - r = r && t.Evaluate(v) - } - return r -} - -// GoString represents the Option as a comma-separated list of terms. -func (o Option) GoString() string { - var ts []string - for _, t := range o { - ts = append(ts, t.GoString()) - } - return strings.Join(ts, ",") -} - -// Term is an atomic term in a build constraint: an identifier or its negation. -type Term string - -// Not returns a term for the negation of ident. -func Not(ident string) Term { - return Term("!" + ident) -} - -// ToConstraints returns Constraints containing just this term. -func (t Term) ToConstraints() Constraints { return t.ToOption().ToConstraints() } - -// ToConstraint returns a Constraint containing just this term. -func (t Term) ToConstraint() Constraint { return t.ToOption().ToConstraint() } - -// ToOption returns an Option containing just this term. -func (t Term) ToOption() Option { return Option{t} } - -// IsNegated reports whether t is the negation of an identifier. -func (t Term) IsNegated() bool { return strings.HasPrefix(string(t), "!") } - -// Name returns the identifier for this term. -func (t Term) Name() string { - return strings.TrimPrefix(string(t), "!") -} - -// Validate the term. -func (t Term) Validate() error { - // Reference: https://github.com/golang/go/blob/204a8f55dc2e0ac8d27a781dab0da609b98560da/src/cmd/go/internal/imports/build.go#L110-L112 - // - // if strings.HasPrefix(name, "!!") { // bad syntax, reject always - // return false - // } - // - if strings.HasPrefix(string(t), "!!") { - return errors.New("at most one '!' allowed") - } - - if len(t.Name()) == 0 { - return errors.New("empty tag name") - } - - // Reference: https://github.com/golang/go/blob/204a8f55dc2e0ac8d27a781dab0da609b98560da/src/cmd/go/internal/imports/build.go#L121-L127 - // - // // Tags must be letters, digits, underscores or dots. - // // Unlike in Go identifiers, all digits are fine (e.g., "386"). - // for _, c := range name { - // if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' { - // return false - // } - // } - // - for _, c := range t.Name() { - if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' { - return fmt.Errorf("character '%c' disallowed in tags", c) - } - } - - return nil -} - -// Evaluate the term under the given set of identifier values. -func (t Term) Evaluate(v map[string]bool) bool { - return (t.Validate() == nil) && (v[t.Name()] == !t.IsNegated()) -} - -// GoString returns t. -func (t Term) GoString() string { return string(t) } - -// SetTags builds a set where the given list of identifiers are true. -func SetTags(idents ...string) map[string]bool { - v := map[string]bool{} - for _, ident := range idents { - v[ident] = true - } - return v -} diff --git a/vendor/github.com/mmcloughlin/avo/gotypes/components.go b/vendor/github.com/mmcloughlin/avo/gotypes/components.go deleted file mode 100644 index 2206afa6..00000000 --- a/vendor/github.com/mmcloughlin/avo/gotypes/components.go +++ /dev/null @@ -1,253 +0,0 @@ -package gotypes - -import ( - "errors" - "fmt" - "go/token" - "go/types" - "strconv" - - "github.com/mmcloughlin/avo/reg" - - "github.com/mmcloughlin/avo/operand" -) - -// Sizes provides type sizes used by the standard Go compiler on amd64. -var Sizes = types.SizesFor("gc", "amd64") - -// Basic represents a primitive/basic type at a given memory address. -type Basic struct { - Addr operand.Mem - Type *types.Basic -} - -// Component provides access to sub-components of a Go type. -type Component interface { - // When the component has no further sub-components, Resolve will return a - // reference to the components type and memory address. If there was an error - // during any previous calls to Component methods, they will be returned at - // resolution time. - Resolve() (*Basic, error) - - Dereference(r reg.Register) Component // dereference a pointer - Base() Component // base pointer of a string or slice - Len() Component // length of a string or slice - Cap() Component // capacity of a slice - Real() Component // real part of a complex value - Imag() Component // imaginary part of a complex value - Index(int) Component // index into an array - Field(string) Component // access a struct field -} - -// componenterr is an error that also provides a null implementation of the -// Component interface. This enables us to return an error from Component -// methods whilst also allowing method chaining to continue. -type componenterr string - -func errorf(format string, args ...interface{}) Component { - return componenterr(fmt.Sprintf(format, args...)) -} - -func (c componenterr) Error() string { return string(c) } -func (c componenterr) Resolve() (*Basic, error) { return nil, c } -func (c componenterr) Dereference(r reg.Register) Component { return c } -func (c componenterr) Base() Component { return c } -func (c componenterr) Len() Component { return c } -func (c componenterr) Cap() Component { return c } -func (c componenterr) Real() Component { return c } -func (c componenterr) Imag() Component { return c } -func (c componenterr) Index(int) Component { return c } -func (c componenterr) Field(string) Component { return c } - -type component struct { - typ types.Type - addr operand.Mem -} - -// NewComponent builds a component for the named type at the given address. -func NewComponent(t types.Type, addr operand.Mem) Component { - return &component{ - typ: t, - addr: addr, - } -} - -func (c *component) Resolve() (*Basic, error) { - b := toprimitive(c.typ) - if b == nil { - return nil, errors.New("component is not primitive") - } - return &Basic{ - Addr: c.addr, - Type: b, - }, nil -} - -func (c *component) Dereference(r reg.Register) Component { - p, ok := c.typ.Underlying().(*types.Pointer) - if !ok { - return errorf("not pointer type") - } - return NewComponent(p.Elem(), operand.Mem{Base: r}) -} - -// Reference: https://github.com/golang/go/blob/50bd1c4d4eb4fac8ddeb5f063c099daccfb71b26/src/reflect/value.go#L1800-L1804 -// -// type SliceHeader struct { -// Data uintptr -// Len int -// Cap int -// } -// -var slicehdroffsets = Sizes.Offsetsof([]*types.Var{ - types.NewField(token.NoPos, nil, "Data", types.Typ[types.Uintptr], false), - types.NewField(token.NoPos, nil, "Len", types.Typ[types.Int], false), - types.NewField(token.NoPos, nil, "Cap", types.Typ[types.Int], false), -}) - -func (c *component) Base() Component { - if !isslice(c.typ) && !isstring(c.typ) { - return errorf("only slices and strings have base pointers") - } - return c.sub("_base", int(slicehdroffsets[0]), types.Typ[types.Uintptr]) -} - -func (c *component) Len() Component { - if !isslice(c.typ) && !isstring(c.typ) { - return errorf("only slices and strings have length fields") - } - return c.sub("_len", int(slicehdroffsets[1]), types.Typ[types.Int]) -} - -func (c *component) Cap() Component { - if !isslice(c.typ) { - return errorf("only slices have capacity fields") - } - return c.sub("_cap", int(slicehdroffsets[2]), types.Typ[types.Int]) -} - -func (c *component) Real() Component { - if !iscomplex(c.typ) { - return errorf("only complex types have real values") - } - f := complextofloat(c.typ) - return c.sub("_real", 0, f) -} - -func (c *component) Imag() Component { - if !iscomplex(c.typ) { - return errorf("only complex types have imaginary values") - } - f := complextofloat(c.typ) - return c.sub("_imag", int(Sizes.Sizeof(f)), f) -} - -func (c *component) Index(i int) Component { - a, ok := c.typ.Underlying().(*types.Array) - if !ok { - return errorf("not array type") - } - if int64(i) >= a.Len() { - return errorf("array index out of bounds") - } - // Reference: https://github.com/golang/tools/blob/bcd4e47d02889ebbc25c9f4bf3d27e4124b0bf9d/go/analysis/passes/asmdecl/asmdecl.go#L482-L494 - // - // case asmArray: - // tu := t.Underlying().(*types.Array) - // elem := tu.Elem() - // // Calculate offset of each element array. - // fields := []*types.Var{ - // types.NewVar(token.NoPos, nil, "fake0", elem), - // types.NewVar(token.NoPos, nil, "fake1", elem), - // } - // offsets := arch.sizes.Offsetsof(fields) - // elemoff := int(offsets[1]) - // for i := 0; i < int(tu.Len()); i++ { - // cc = appendComponentsRecursive(arch, elem, cc, suffix+"_"+strconv.Itoa(i), i*elemoff) - // } - // - elem := a.Elem() - elemsize := int(Sizes.Sizeof(types.NewArray(elem, 2)) - Sizes.Sizeof(types.NewArray(elem, 1))) - return c.sub("_"+strconv.Itoa(i), i*elemsize, elem) -} - -func (c *component) Field(n string) Component { - s, ok := c.typ.Underlying().(*types.Struct) - if !ok { - return errorf("not struct type") - } - // Reference: https://github.com/golang/tools/blob/13ba8ad772dfbf0f451b5dd0679e9c5605afc05d/go/analysis/passes/asmdecl/asmdecl.go#L471-L480 - // - // case asmStruct: - // tu := t.Underlying().(*types.Struct) - // fields := make([]*types.Var, tu.NumFields()) - // for i := 0; i < tu.NumFields(); i++ { - // fields[i] = tu.Field(i) - // } - // offsets := arch.sizes.Offsetsof(fields) - // for i, f := range fields { - // cc = appendComponentsRecursive(arch, f.Type(), cc, suffix+"_"+f.Name(), off+int(offsets[i])) - // } - // - fields := make([]*types.Var, s.NumFields()) - for i := 0; i < s.NumFields(); i++ { - fields[i] = s.Field(i) - } - offsets := Sizes.Offsetsof(fields) - for i, f := range fields { - if f.Name() == n { - return c.sub("_"+n, int(offsets[i]), f.Type()) - } - } - return errorf("struct does not have field '%s'", n) -} - -func (c *component) sub(suffix string, offset int, t types.Type) *component { - s := *c - if s.addr.Symbol.Name != "" { - s.addr.Symbol.Name += suffix - } - s.addr = s.addr.Offset(offset) - s.typ = t - return &s -} - -func isslice(t types.Type) bool { - _, ok := t.Underlying().(*types.Slice) - return ok -} - -func isstring(t types.Type) bool { - b, ok := t.Underlying().(*types.Basic) - return ok && b.Kind() == types.String -} - -func iscomplex(t types.Type) bool { - b, ok := t.Underlying().(*types.Basic) - return ok && (b.Info()&types.IsComplex) != 0 -} - -func complextofloat(t types.Type) types.Type { - switch Sizes.Sizeof(t) { - case 16: - return types.Typ[types.Float64] - case 8: - return types.Typ[types.Float32] - } - panic("bad") -} - -// toprimitive determines whether t is primitive (cannot be reduced into -// components). If it is, it returns the basic type for t, otherwise returns -// nil. -func toprimitive(t types.Type) *types.Basic { - switch b := t.(type) { - case *types.Basic: - if (b.Info() & (types.IsString | types.IsComplex)) == 0 { - return b - } - case *types.Pointer: - return types.Typ[types.Uintptr] - } - return nil -} diff --git a/vendor/github.com/mmcloughlin/avo/gotypes/doc.go b/vendor/github.com/mmcloughlin/avo/gotypes/doc.go deleted file mode 100644 index fa8f0783..00000000 --- a/vendor/github.com/mmcloughlin/avo/gotypes/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package gotypes provides helpers for interacting with Go types within avo functions. -package gotypes diff --git a/vendor/github.com/mmcloughlin/avo/gotypes/signature.go b/vendor/github.com/mmcloughlin/avo/gotypes/signature.go deleted file mode 100644 index e0000203..00000000 --- a/vendor/github.com/mmcloughlin/avo/gotypes/signature.go +++ /dev/null @@ -1,177 +0,0 @@ -package gotypes - -import ( - "bytes" - "errors" - "fmt" - "go/token" - "go/types" - "strconv" - - "github.com/mmcloughlin/avo/operand" -) - -// Signature represents a Go function signature. -type Signature struct { - pkg *types.Package - sig *types.Signature - params *Tuple - results *Tuple -} - -// NewSignature constructs a Signature. -func NewSignature(pkg *types.Package, sig *types.Signature) *Signature { - s := &Signature{ - pkg: pkg, - sig: sig, - } - s.init() - return s -} - -// NewSignatureVoid builds the void signature "func()". -func NewSignatureVoid() *Signature { - return NewSignature(nil, types.NewSignature(nil, nil, nil, false)) -} - -// LookupSignature returns the signature of the named function in the provided package. -func LookupSignature(pkg *types.Package, name string) (*Signature, error) { - scope := pkg.Scope() - obj := scope.Lookup(name) - if obj == nil { - return nil, fmt.Errorf("could not find function \"%s\"", name) - } - s, ok := obj.Type().(*types.Signature) - if !ok { - return nil, fmt.Errorf("object \"%s\" does not have signature type", name) - } - return NewSignature(pkg, s), nil -} - -// ParseSignature builds a Signature by parsing a Go function type expression. -// The function type must reference builtin types only; see -// ParseSignatureInPackage if custom types are required. -func ParseSignature(expr string) (*Signature, error) { - return ParseSignatureInPackage(nil, expr) -} - -// ParseSignatureInPackage builds a Signature by parsing a Go function type -// expression. The expression may reference types in the provided package. -func ParseSignatureInPackage(pkg *types.Package, expr string) (*Signature, error) { - tv, err := types.Eval(token.NewFileSet(), pkg, token.NoPos, expr) - if err != nil { - return nil, err - } - if tv.Value != nil { - return nil, errors.New("signature expression should have nil value") - } - s, ok := tv.Type.(*types.Signature) - if !ok { - return nil, errors.New("provided type is not a function signature") - } - return NewSignature(pkg, s), nil -} - -// Params returns the function signature argument types. -func (s *Signature) Params() *Tuple { return s.params } - -// Results returns the function return types. -func (s *Signature) Results() *Tuple { return s.results } - -// Bytes returns the total size of the function arguments and return values. -func (s *Signature) Bytes() int { return s.Params().Bytes() + s.Results().Bytes() } - -// String writes Signature as a string. This does not include the "func" keyword. -func (s *Signature) String() string { - var buf bytes.Buffer - types.WriteSignature(&buf, s.sig, func(pkg *types.Package) string { - if pkg == s.pkg { - return "" - } - return pkg.Name() - }) - return buf.String() -} - -func (s *Signature) init() { - p := s.sig.Params() - r := s.sig.Results() - - // Compute parameter offsets. - vs := tuplevars(p) - vs = append(vs, types.NewParam(token.NoPos, nil, "sentinel", types.Typ[types.Uint64])) - paramsoffsets := Sizes.Offsetsof(vs) - paramssize := paramsoffsets[p.Len()] - s.params = newTuple(p, paramsoffsets, paramssize, "arg") - - // Result offsets. - vs = tuplevars(r) - resultsoffsets := Sizes.Offsetsof(vs) - var resultssize int64 - if n := len(vs); n > 0 { - resultssize = resultsoffsets[n-1] + Sizes.Sizeof(vs[n-1].Type()) - } - for i := range resultsoffsets { - resultsoffsets[i] += paramssize - } - s.results = newTuple(r, resultsoffsets, resultssize, "ret") -} - -// Tuple represents a tuple of variables, such as function arguments or results. -type Tuple struct { - components []Component - byname map[string]Component - size int -} - -func newTuple(t *types.Tuple, offsets []int64, size int64, defaultprefix string) *Tuple { - tuple := &Tuple{ - byname: map[string]Component{}, - size: int(size), - } - for i := 0; i < t.Len(); i++ { - v := t.At(i) - name := v.Name() - if name == "" { - name = defaultprefix - if i > 0 { - name += strconv.Itoa(i) - } - } - addr := operand.NewParamAddr(name, int(offsets[i])) - c := NewComponent(v.Type(), addr) - tuple.components = append(tuple.components, c) - if v.Name() != "" { - tuple.byname[v.Name()] = c - } - } - return tuple -} - -// Lookup returns the variable with the given name. -func (t *Tuple) Lookup(name string) Component { - e := t.byname[name] - if e == nil { - return errorf("unknown variable \"%s\"", name) - } - return e -} - -// At returns the variable at index i. -func (t *Tuple) At(i int) Component { - if i >= len(t.components) { - return errorf("index out of range") - } - return t.components[i] -} - -// Bytes returns the size of the Tuple. This may include additional padding. -func (t *Tuple) Bytes() int { return t.size } - -func tuplevars(t *types.Tuple) []*types.Var { - vs := make([]*types.Var, t.Len()) - for i := 0; i < t.Len(); i++ { - vs[i] = t.At(i) - } - return vs -} diff --git a/vendor/github.com/mmcloughlin/avo/internal/data/LICENSE b/vendor/github.com/mmcloughlin/avo/internal/data/LICENSE deleted file mode 100644 index baf24bb5..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/data/LICENSE +++ /dev/null @@ -1,52 +0,0 @@ ------------------------------------------------------------------------------ -golang/arch license ------------------------------------------------------------------------------ - -Copyright (c) 2015 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------ -Maratyszcza/Opcodes license ------------------------------------------------------------------------------ - -======================================= -Opcodes Database license (2-clause BSD) -======================================= - -Copyright (c) 2017 Facebook Inc. -Copyright (c) 2014-2017, Georgia Institute of Technology -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/mmcloughlin/avo/internal/load/testdata b/vendor/github.com/mmcloughlin/avo/internal/load/testdata deleted file mode 120000 index 4909e06e..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/load/testdata +++ /dev/null @@ -1 +0,0 @@ -../data \ No newline at end of file diff --git a/vendor/github.com/mmcloughlin/avo/internal/opcodescsv/testdata b/vendor/github.com/mmcloughlin/avo/internal/opcodescsv/testdata deleted file mode 120000 index 4909e06e..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/opcodescsv/testdata +++ /dev/null @@ -1 +0,0 @@ -../data \ No newline at end of file diff --git a/vendor/github.com/mmcloughlin/avo/internal/opcodesxml/testdata/x86_64.xml b/vendor/github.com/mmcloughlin/avo/internal/opcodesxml/testdata/x86_64.xml deleted file mode 120000 index eb6040a0..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/opcodesxml/testdata/x86_64.xml +++ /dev/null @@ -1 +0,0 @@ -../../data/x86_64.xml \ No newline at end of file diff --git a/vendor/github.com/mmcloughlin/avo/internal/prnt/printer.go b/vendor/github.com/mmcloughlin/avo/internal/prnt/printer.go deleted file mode 100644 index 2239946f..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/prnt/printer.go +++ /dev/null @@ -1,58 +0,0 @@ -// Package prnt provides common functionality for code generators. -package prnt - -import ( - "bytes" - "fmt" - "io" -) - -// Generator provides convenience methods for code generators. In particular it -// provides fmt-like methods which print to an internal buffer. It also allows -// any errors to be stored so they can be checked at the end, rather than having -// error checks obscuring the code generation. -type Generator struct { - buf bytes.Buffer - err error -} - -// Raw provides direct access to the underlying output stream. -func (g *Generator) Raw() io.Writer { - return &g.buf -} - -// Printf prints to the internal buffer. -func (g *Generator) Printf(format string, args ...interface{}) { - if g.err != nil { - return - } - _, err := fmt.Fprintf(&g.buf, format, args...) - g.AddError(err) -} - -// NL prints a new line. -func (g *Generator) NL() { - g.Printf("\n") -} - -// Comment writes comment lines prefixed with "// ". -func (g *Generator) Comment(lines ...string) { - for _, line := range lines { - g.Printf("// %s\n", line) - } -} - -// AddError records an error in code generation. The first non-nil error will -// prevent printing operations from writing anything else, and the error will be -// returned from Result(). -func (g *Generator) AddError(err error) { - if err != nil && g.err == nil { - g.err = err - } -} - -// Result returns the printed bytes. If any error was recorded with AddError -// during code generation, the first such error will be returned here. -func (g *Generator) Result() ([]byte, error) { - return g.buf.Bytes(), g.err -} diff --git a/vendor/github.com/mmcloughlin/avo/internal/stack/stack.go b/vendor/github.com/mmcloughlin/avo/internal/stack/stack.go deleted file mode 100644 index 1d327d9d..00000000 --- a/vendor/github.com/mmcloughlin/avo/internal/stack/stack.go +++ /dev/null @@ -1,73 +0,0 @@ -// Package stack provides helpers for querying the callstack. -package stack - -import ( - "path" - "runtime" - "strings" -) - -// Frames returns at most max callstack Frames, starting with its caller and -// skipping skip Frames. -func Frames(skip, max int) []runtime.Frame { - pc := make([]uintptr, max) - n := runtime.Callers(skip+2, pc) - if n == 0 { - return nil - } - pc = pc[:n] - frames := runtime.CallersFrames(pc) - var fs []runtime.Frame - for { - f, more := frames.Next() - fs = append(fs, f) - if !more { - break - } - } - return fs -} - -// Match returns the first stack frame for which the predicate function returns -// true. Returns nil if no match is found. Starts matching after skip frames, -// starting with its caller. -func Match(skip int, predicate func(runtime.Frame) bool) *runtime.Frame { - i, n := skip+1, 16 - for { - fs := Frames(i, n) - for j, f := range fs { - if predicate(f) { - return &fs[j] - } - } - if len(fs) < n { - break - } - i += n - } - return nil -} - -// Main returns the main() function Frame. -func Main() *runtime.Frame { - return Match(1, func(f runtime.Frame) bool { - return f.Function == "main.main" - }) -} - -// ExternalCaller returns the first frame outside the callers package. -func ExternalCaller() *runtime.Frame { - var first *runtime.Frame - return Match(1, func(f runtime.Frame) bool { - if first == nil { - first = &f - } - return pkg(first.Function) != pkg(f.Function) - }) -} - -func pkg(ident string) string { - dir, name := path.Split(ident) - parts := strings.Split(name, ".") - return dir + parts[0] -} diff --git a/vendor/github.com/mmcloughlin/avo/ir/doc.go b/vendor/github.com/mmcloughlin/avo/ir/doc.go deleted file mode 100644 index de02f464..00000000 --- a/vendor/github.com/mmcloughlin/avo/ir/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package ir provides the intermediate representation of avo programs. -package ir diff --git a/vendor/github.com/mmcloughlin/avo/ir/ir.go b/vendor/github.com/mmcloughlin/avo/ir/ir.go deleted file mode 100644 index 8cf8e8e4..00000000 --- a/vendor/github.com/mmcloughlin/avo/ir/ir.go +++ /dev/null @@ -1,325 +0,0 @@ -package ir - -import ( - "errors" - - "github.com/mmcloughlin/avo/attr" - "github.com/mmcloughlin/avo/buildtags" - "github.com/mmcloughlin/avo/gotypes" - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/reg" -) - -// Node is a part of a Function. -type Node interface { - node() -} - -// Label within a function. -type Label string - -func (l Label) node() {} - -// Comment represents a multi-line comment. -type Comment struct { - Lines []string -} - -func (c *Comment) node() {} - -// NewComment builds a Comment consisting of the provided lines. -func NewComment(lines ...string) *Comment { - return &Comment{ - Lines: lines, - } -} - -// Instruction is a single instruction in a function. -type Instruction struct { - Opcode string - Operands []operand.Op - - Inputs []operand.Op - Outputs []operand.Op - - IsTerminal bool - IsBranch bool - IsConditional bool - - // CFG. - Pred []*Instruction - Succ []*Instruction - - // LiveIn/LiveOut are sets of live register IDs pre/post execution. - LiveIn reg.Set - LiveOut reg.Set -} - -func (i *Instruction) node() {} - -// TargetLabel returns the label referenced by this instruction. Returns nil if -// no label is referenced. -func (i Instruction) TargetLabel() *Label { - if !i.IsBranch { - return nil - } - if len(i.Operands) == 0 { - return nil - } - if ref, ok := i.Operands[0].(operand.LabelRef); ok { - lbl := Label(ref) - return &lbl - } - return nil -} - -// Registers returns all registers involved in the instruction. -func (i Instruction) Registers() []reg.Register { - var rs []reg.Register - for _, op := range i.Operands { - rs = append(rs, operand.Registers(op)...) - } - return rs -} - -// InputRegisters returns all registers read by this instruction. -func (i Instruction) InputRegisters() []reg.Register { - var rs []reg.Register - for _, op := range i.Inputs { - rs = append(rs, operand.Registers(op)...) - } - for _, op := range i.Outputs { - if operand.IsMem(op) { - rs = append(rs, operand.Registers(op)...) - } - } - return rs -} - -// OutputRegisters returns all registers written by this instruction. -func (i Instruction) OutputRegisters() []reg.Register { - var rs []reg.Register - for _, op := range i.Outputs { - if r, ok := op.(reg.Register); ok { - rs = append(rs, r) - } - } - return rs -} - -// Section is a part of a file. -type Section interface { - section() -} - -// File represents an assembly file. -type File struct { - Constraints buildtags.Constraints - Includes []string - Sections []Section -} - -// NewFile initializes an empty file. -func NewFile() *File { - return &File{} -} - -// AddSection appends a Section to the file. -func (f *File) AddSection(s Section) { - f.Sections = append(f.Sections, s) -} - -// Functions returns all functions in the file. -func (f *File) Functions() []*Function { - var fns []*Function - for _, s := range f.Sections { - if fn, ok := s.(*Function); ok { - fns = append(fns, fn) - } - } - return fns -} - -// Function represents an assembly function. -type Function struct { - Name string - Attributes attr.Attribute - Doc []string - Signature *gotypes.Signature - LocalSize int - - Nodes []Node - - // LabelTarget maps from label name to the following instruction. - LabelTarget map[Label]*Instruction - - // Register allocation. - Allocation reg.Allocation -} - -func (f *Function) section() {} - -// NewFunction builds an empty function of the given name. -func NewFunction(name string) *Function { - return &Function{ - Name: name, - Signature: gotypes.NewSignatureVoid(), - } -} - -// SetSignature sets the function signature. -func (f *Function) SetSignature(s *gotypes.Signature) { - f.Signature = s -} - -// AllocLocal allocates size bytes in this function's stack. -// Returns a reference to the base pointer for the newly allocated region. -func (f *Function) AllocLocal(size int) operand.Mem { - ptr := operand.NewStackAddr(f.LocalSize) - f.LocalSize += size - return ptr -} - -// AddInstruction appends an instruction to f. -func (f *Function) AddInstruction(i *Instruction) { - f.AddNode(i) -} - -// AddLabel appends a label to f. -func (f *Function) AddLabel(l Label) { - f.AddNode(l) -} - -// AddComment adds comment lines to f. -func (f *Function) AddComment(lines ...string) { - f.AddNode(NewComment(lines...)) -} - -// AddNode appends a Node to f. -func (f *Function) AddNode(n Node) { - f.Nodes = append(f.Nodes, n) -} - -// Instructions returns just the list of instruction nodes. -func (f *Function) Instructions() []*Instruction { - var is []*Instruction - for _, n := range f.Nodes { - i, ok := n.(*Instruction) - if ok { - is = append(is, i) - } - } - return is -} - -// Labels returns just the list of label nodes. -func (f *Function) Labels() []Label { - var lbls []Label - for _, n := range f.Nodes { - lbl, ok := n.(Label) - if ok { - lbls = append(lbls, lbl) - } - } - return lbls -} - -// Stub returns the Go function declaration. -func (f *Function) Stub() string { - return "func " + f.Name + f.Signature.String() -} - -// FrameBytes returns the size of the stack frame in bytes. -func (f *Function) FrameBytes() int { - return f.LocalSize -} - -// ArgumentBytes returns the size of the arguments in bytes. -func (f *Function) ArgumentBytes() int { - return f.Signature.Bytes() -} - -// Datum represents a data element at a particular offset of a data section. -type Datum struct { - Offset int - Value operand.Constant -} - -// NewDatum builds a Datum from the given constant. -func NewDatum(offset int, v operand.Constant) Datum { - return Datum{ - Offset: offset, - Value: v, - } -} - -// Interval returns the range of bytes this datum will occupy within its section. -func (d Datum) Interval() (int, int) { - return d.Offset, d.Offset + d.Value.Bytes() -} - -// Overlaps returns true -func (d Datum) Overlaps(other Datum) bool { - s, e := d.Interval() - so, eo := other.Interval() - return !(eo <= s || e <= so) -} - -// Global represents a DATA section. -type Global struct { - Symbol operand.Symbol - Attributes attr.Attribute - Data []Datum - Size int -} - -// NewGlobal constructs an empty DATA section. -func NewGlobal(sym operand.Symbol) *Global { - return &Global{ - Symbol: sym, - } -} - -// NewStaticGlobal is a convenience for building a static DATA section. -func NewStaticGlobal(name string) *Global { - return NewGlobal(operand.NewStaticSymbol(name)) -} - -func (g *Global) section() {} - -// Base returns a pointer to the start of the data section. -func (g *Global) Base() operand.Mem { - return operand.NewDataAddr(g.Symbol, 0) -} - -// Grow ensures that the data section has at least the given size. -func (g *Global) Grow(size int) { - if g.Size < size { - g.Size = size - } -} - -// AddDatum adds d to this data section, growing it if necessary. Errors if the datum overlaps with existing data. -func (g *Global) AddDatum(d Datum) error { - for _, other := range g.Data { - if d.Overlaps(other) { - return errors.New("overlaps existing datum") - } - } - g.add(d) - return nil -} - -// Append the constant to the end of the data section. -func (g *Global) Append(v operand.Constant) { - g.add(Datum{ - Offset: g.Size, - Value: v, - }) -} - -func (g *Global) add(d Datum) { - _, end := d.Interval() - g.Grow(end) - g.Data = append(g.Data, d) -} diff --git a/vendor/github.com/mmcloughlin/avo/operand/checks.go b/vendor/github.com/mmcloughlin/avo/operand/checks.go deleted file mode 100644 index 2585479d..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/checks.go +++ /dev/null @@ -1,247 +0,0 @@ -package operand - -import "github.com/mmcloughlin/avo/reg" - -// Pure type assertion checks: - -// IsRegister returns whether op has type reg.Register. -func IsRegister(op Op) bool { _, ok := op.(reg.Register); return ok } - -// IsMem returns whether op has type Mem. -func IsMem(op Op) bool { _, ok := op.(Mem); return ok } - -// IsRel returns whether op has type Rel. -func IsRel(op Op) bool { _, ok := op.(Rel); return ok } - -// Checks corresponding to specific operand types in the Intel Manual: - -// Is1 returns true if op is the immediate constant 1. -func Is1(op Op) bool { - i, ok := op.(U8) - return ok && i == 1 -} - -// Is3 returns true if op is the immediate constant 3. -func Is3(op Op) bool { - i, ok := op.(U8) - return ok && i == 3 -} - -// IsIMM2U returns true if op is a 2-bit unsigned immediate (less than 4). -func IsIMM2U(op Op) bool { - i, ok := op.(U8) - return ok && i < 4 -} - -// IsIMM8 returns true is op is an 8-bit immediate. -func IsIMM8(op Op) bool { - _, ok := op.(U8) - return ok -} - -// IsIMM16 returns true is op is a 16-bit immediate. -func IsIMM16(op Op) bool { - _, ok := op.(U16) - return ok -} - -// IsIMM32 returns true is op is a 32-bit immediate. -func IsIMM32(op Op) bool { - _, ok := op.(U32) - return ok -} - -// IsIMM64 returns true is op is a 64-bit immediate. -func IsIMM64(op Op) bool { - _, ok := op.(U64) - return ok -} - -// IsAL returns true if op is the AL register. -func IsAL(op Op) bool { - return op == reg.AL -} - -// IsCL returns true if op is the CL register. -func IsCL(op Op) bool { - return op == reg.CL -} - -// IsAX returns true if op is the 16-bit AX register. -func IsAX(op Op) bool { - return op == reg.AX -} - -// IsEAX returns true if op is the 32-bit EAX register. -func IsEAX(op Op) bool { - return op == reg.EAX -} - -// IsRAX returns true if op is the 64-bit RAX register. -func IsRAX(op Op) bool { - return op == reg.RAX -} - -// IsR8 returns true if op is an 8-bit general-purpose register. -func IsR8(op Op) bool { - return IsGP(op, 1) -} - -// IsR16 returns true if op is a 16-bit general-purpose register. -func IsR16(op Op) bool { - return IsGP(op, 2) -} - -// IsR32 returns true if op is a 32-bit general-purpose register. -func IsR32(op Op) bool { - return IsGP(op, 4) -} - -// IsR64 returns true if op is a 64-bit general-purpose register. -func IsR64(op Op) bool { - return IsGP(op, 8) -} - -// IsPseudo returns true if op is a pseudo register. -func IsPseudo(op Op) bool { - return IsRegisterKind(op, reg.KindPseudo) -} - -// IsGP returns true if op is a general-purpose register of size n bytes. -func IsGP(op Op, n uint) bool { - return IsRegisterKindSize(op, reg.KindGP, n) -} - -// IsXMM0 returns true if op is the X0 register. -func IsXMM0(op Op) bool { - return op == reg.X0 -} - -// IsXMM returns true if op is a 128-bit XMM register. -func IsXMM(op Op) bool { - return IsRegisterKindSize(op, reg.KindVector, 16) -} - -// IsYMM returns true if op is a 256-bit YMM register. -func IsYMM(op Op) bool { - return IsRegisterKindSize(op, reg.KindVector, 32) -} - -// IsRegisterKindSize returns true if op is a register of the given kind and size in bytes. -func IsRegisterKindSize(op Op, k reg.Kind, n uint) bool { - r, ok := op.(reg.Register) - return ok && r.Kind() == k && r.Size() == n -} - -// IsRegisterKind returns true if op is a register of the given kind. -func IsRegisterKind(op Op, k reg.Kind) bool { - r, ok := op.(reg.Register) - return ok && r.Kind() == k -} - -// IsM returns true if op is a 16-, 32- or 64-bit memory operand. -func IsM(op Op) bool { - // TODO(mbm): confirm "m" check is defined correctly - // Intel manual: "A 16-, 32- or 64-bit operand in memory." - return IsM16(op) || IsM32(op) || IsM64(op) -} - -// IsM8 returns true if op is an 8-bit memory operand. -func IsM8(op Op) bool { - // TODO(mbm): confirm "m8" check is defined correctly - // Intel manual: "A byte operand in memory, usually expressed as a variable or - // array name, but pointed to by the DS:(E)SI or ES:(E)DI registers. In 64-bit - // mode, it is pointed to by the RSI or RDI registers." - return IsMSize(op, 1) -} - -// IsM16 returns true if op is a 16-bit memory operand. -func IsM16(op Op) bool { - return IsMSize(op, 2) -} - -// IsM32 returns true if op is a 16-bit memory operand. -func IsM32(op Op) bool { - return IsMSize(op, 4) -} - -// IsM64 returns true if op is a 64-bit memory operand. -func IsM64(op Op) bool { - return IsMSize(op, 8) -} - -// IsMSize returns true if op is a memory operand using general-purpose address -// registers of the given size in bytes. -func IsMSize(op Op, n uint) bool { - // TODO(mbm): should memory operands have a size attribute as well? - // TODO(mbm): m8,m16,m32,m64 checks do not actually check size - m, ok := op.(Mem) - return ok && IsMReg(m.Base) && (m.Index == nil || IsMReg(m.Index)) -} - -// IsMReg returns true if op is a register that can be used in a memory operand. -func IsMReg(op Op) bool { - return IsPseudo(op) || IsRegisterKind(op, reg.KindGP) -} - -// IsM128 returns true if op is a 128-bit memory operand. -func IsM128(op Op) bool { - // TODO(mbm): should "m128" be the same as "m64"? - return IsM64(op) -} - -// IsM256 returns true if op is a 256-bit memory operand. -func IsM256(op Op) bool { - // TODO(mbm): should "m256" be the same as "m64"? - return IsM64(op) -} - -// IsVM32X returns true if op is a vector memory operand with 32-bit XMM index. -func IsVM32X(op Op) bool { - return IsVmx(op) -} - -// IsVM64X returns true if op is a vector memory operand with 64-bit XMM index. -func IsVM64X(op Op) bool { - return IsVmx(op) -} - -// IsVmx returns true if op is a vector memory operand with XMM index. -func IsVmx(op Op) bool { - return isvm(op, IsXMM) -} - -// IsVM32Y returns true if op is a vector memory operand with 32-bit YMM index. -func IsVM32Y(op Op) bool { - return IsVmy(op) -} - -// IsVM64Y returns true if op is a vector memory operand with 64-bit YMM index. -func IsVM64Y(op Op) bool { - return IsVmy(op) -} - -// IsVmy returns true if op is a vector memory operand with YMM index. -func IsVmy(op Op) bool { - return isvm(op, IsYMM) -} - -func isvm(op Op, idx func(Op) bool) bool { - m, ok := op.(Mem) - return ok && IsR64(m.Base) && idx(m.Index) -} - -// IsREL8 returns true if op is an 8-bit offset relative to instruction pointer. -func IsREL8(op Op) bool { - r, ok := op.(Rel) - return ok && r == Rel(int8(r)) -} - -// IsREL32 returns true if op is an offset relative to instruction pointer, or a -// label reference. -func IsREL32(op Op) bool { - // TODO(mbm): should labels be considered separately? - _, rel := op.(Rel) - _, label := op.(LabelRef) - return rel || label -} diff --git a/vendor/github.com/mmcloughlin/avo/operand/const.go b/vendor/github.com/mmcloughlin/avo/operand/const.go deleted file mode 100644 index b2c6a6f7..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/const.go +++ /dev/null @@ -1,36 +0,0 @@ -package operand - -import "fmt" - -// Constant represents a constant literal. -type Constant interface { - Op - Bytes() int - constant() -} - -//go:generate go run make_const.go -output zconst.go - -// String is a string constant. -type String string - -// Asm returns an assembly syntax representation of the string s. -func (s String) Asm() string { return fmt.Sprintf("$%q", s) } - -// Bytes returns the length of s. -func (s String) Bytes() int { return len(s) } - -func (s String) constant() {} - -// Imm returns an unsigned integer constant with size guessed from x. -func Imm(x uint64) Constant { - switch { - case uint64(uint8(x)) == x: - return U8(x) - case uint64(uint16(x)) == x: - return U16(x) - case uint64(uint32(x)) == x: - return U32(x) - } - return U64(x) -} diff --git a/vendor/github.com/mmcloughlin/avo/operand/doc.go b/vendor/github.com/mmcloughlin/avo/operand/doc.go deleted file mode 100644 index 51c44dfb..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package operand provides types for instruction operands. -package operand diff --git a/vendor/github.com/mmcloughlin/avo/operand/make_const.go b/vendor/github.com/mmcloughlin/avo/operand/make_const.go deleted file mode 100644 index 42262c73..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/make_const.go +++ /dev/null @@ -1,73 +0,0 @@ -// +build ignore - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/format" - "io" - "log" - "os" - "path/filepath" - "runtime" - "strconv" -) - -var output = flag.String("output", "", "path to output file (default stdout)") - -func PrintConstType(w io.Writer, name, typ, format string, size int, doc string) { - r := typ[0] - fmt.Fprintf(w, "// %s\n", doc) - fmt.Fprintf(w, "type %s %s\n", name, typ) - fmt.Fprintf(w, "\n") - fmt.Fprintf(w, "func (%c %s) Asm() string { return fmt.Sprintf(\"$%s\", %c) }\n", r, name, format, r) - fmt.Fprintf(w, "func (%c %s) Bytes() int { return %d }\n", r, name, size) - fmt.Fprintf(w, "func (%c %s) constant() {}\n", r, name) - fmt.Fprintf(w, "\n") -} - -func PrintConstTypes(w io.Writer) { - _, self, _, _ := runtime.Caller(0) - fmt.Fprintf(w, "// Code generated by %s. DO NOT EDIT.\n\n", filepath.Base(self)) - fmt.Fprintf(w, "package operand\n\n") - fmt.Fprintf(w, "import \"fmt\"\n\n") - for n := 1; n <= 8; n *= 2 { - bits := n * 8 - bs := strconv.Itoa(bits) - - if n >= 4 { - PrintConstType(w, "F"+bs, "float"+bs, "(%#v)", n, fmt.Sprintf("F%d is a %d-bit floating point constant.", bits, bits)) - } - PrintConstType(w, "I"+bs, "int"+bs, "%+d", n, fmt.Sprintf("I%d is a %d-bit signed integer constant.", bits, bits)) - PrintConstType(w, "U"+bs, "uint"+bs, "%#0"+strconv.Itoa(2*n)+"x", n, fmt.Sprintf("U%d is a %d-bit unsigned integer constant.", bits, bits)) - } -} - -func main() { - flag.Parse() - - w := os.Stdout - if *output != "" { - f, err := os.Create(*output) - if err != nil { - log.Fatal(err) - } - defer f.Close() - w = f - } - - buf := bytes.NewBuffer(nil) - PrintConstTypes(buf) - - src, err := format.Source(buf.Bytes()) - if err != nil { - log.Fatal(err) - } - - _, err = w.Write(src) - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/mmcloughlin/avo/operand/types.go b/vendor/github.com/mmcloughlin/avo/operand/types.go deleted file mode 100644 index 3ca07e4b..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/types.go +++ /dev/null @@ -1,151 +0,0 @@ -package operand - -import ( - "fmt" - - "github.com/mmcloughlin/avo/reg" -) - -// Op is an operand. -type Op interface { - Asm() string -} - -// Symbol represents a symbol name. -type Symbol struct { - Name string - Static bool // only visible in current source file -} - -// NewStaticSymbol builds a static Symbol. Static symbols are only visible in the current source file. -func NewStaticSymbol(name string) Symbol { - return Symbol{Name: name, Static: true} -} - -func (s Symbol) String() string { - n := s.Name - if s.Static { - n += "<>" - } - return n -} - -// Mem represents a memory reference. -type Mem struct { - Symbol Symbol - Disp int - Base reg.Register - Index reg.Register - Scale uint8 -} - -// NewParamAddr is a convenience to build a Mem operand pointing to a function -// parameter, which is a named offset from the frame pointer pseudo register. -func NewParamAddr(name string, offset int) Mem { - return Mem{ - Symbol: Symbol{ - Name: name, - Static: false, - }, - Disp: offset, - Base: reg.FramePointer, - } -} - -// NewStackAddr returns a memory reference relative to the stack pointer. -func NewStackAddr(offset int) Mem { - return Mem{ - Disp: offset, - Base: reg.StackPointer, - } -} - -// NewDataAddr returns a memory reference relative to the named data symbol. -func NewDataAddr(sym Symbol, offset int) Mem { - return Mem{ - Symbol: sym, - Disp: offset, - Base: reg.StaticBase, - } -} - -// Offset returns a reference to m plus idx bytes. -func (m Mem) Offset(idx int) Mem { - a := m - a.Disp += idx - return a -} - -// Idx returns a new memory reference with (Index, Scale) set to (r, s). -func (m Mem) Idx(r reg.Register, s uint8) Mem { - a := m - a.Index = r - a.Scale = s - return a -} - -// Asm returns an assembly syntax representation of m. -func (m Mem) Asm() string { - a := m.Symbol.String() - if a != "" { - a += fmt.Sprintf("%+d", m.Disp) - } else if m.Disp != 0 { - a += fmt.Sprintf("%d", m.Disp) - } - if m.Base != nil { - a += fmt.Sprintf("(%s)", m.Base.Asm()) - } - if m.Index != nil && m.Scale != 0 { - a += fmt.Sprintf("(%s*%d)", m.Index.Asm(), m.Scale) - } - return a -} - -// Rel is an offset relative to the instruction pointer. -type Rel int32 - -// Asm returns an assembly syntax representation of r. -func (r Rel) Asm() string { - return fmt.Sprintf(".%+d", r) -} - -// LabelRef is a reference to a label. -type LabelRef string - -// Asm returns an assembly syntax representation of l. -func (l LabelRef) Asm() string { - return string(l) -} - -// Registers returns the list of all operands involved in the given operand. -func Registers(op Op) []reg.Register { - switch op := op.(type) { - case reg.Register: - return []reg.Register{op} - case Mem: - var r []reg.Register - if op.Base != nil { - r = append(r, op.Base) - } - if op.Index != nil { - r = append(r, op.Index) - } - return r - case Constant, Rel, LabelRef: - return nil - } - panic("unknown operand type") -} - -// ApplyAllocation returns an operand with allocated registers replaced. Registers missing from the allocation are left alone. -func ApplyAllocation(op Op, a reg.Allocation) Op { - switch op := op.(type) { - case reg.Register: - return a.LookupDefault(op) - case Mem: - op.Base = a.LookupDefault(op.Base) - op.Index = a.LookupDefault(op.Index) - return op - } - return op -} diff --git a/vendor/github.com/mmcloughlin/avo/operand/zconst.go b/vendor/github.com/mmcloughlin/avo/operand/zconst.go deleted file mode 100644 index 324b4a96..00000000 --- a/vendor/github.com/mmcloughlin/avo/operand/zconst.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by make_const.go. DO NOT EDIT. - -package operand - -import "fmt" - -// I8 is a 8-bit signed integer constant. -type I8 int8 - -func (i I8) Asm() string { return fmt.Sprintf("$%+d", i) } -func (i I8) Bytes() int { return 1 } -func (i I8) constant() {} - -// U8 is a 8-bit unsigned integer constant. -type U8 uint8 - -func (u U8) Asm() string { return fmt.Sprintf("$%#02x", u) } -func (u U8) Bytes() int { return 1 } -func (u U8) constant() {} - -// I16 is a 16-bit signed integer constant. -type I16 int16 - -func (i I16) Asm() string { return fmt.Sprintf("$%+d", i) } -func (i I16) Bytes() int { return 2 } -func (i I16) constant() {} - -// U16 is a 16-bit unsigned integer constant. -type U16 uint16 - -func (u U16) Asm() string { return fmt.Sprintf("$%#04x", u) } -func (u U16) Bytes() int { return 2 } -func (u U16) constant() {} - -// F32 is a 32-bit floating point constant. -type F32 float32 - -func (f F32) Asm() string { return fmt.Sprintf("$(%#v)", f) } -func (f F32) Bytes() int { return 4 } -func (f F32) constant() {} - -// I32 is a 32-bit signed integer constant. -type I32 int32 - -func (i I32) Asm() string { return fmt.Sprintf("$%+d", i) } -func (i I32) Bytes() int { return 4 } -func (i I32) constant() {} - -// U32 is a 32-bit unsigned integer constant. -type U32 uint32 - -func (u U32) Asm() string { return fmt.Sprintf("$%#08x", u) } -func (u U32) Bytes() int { return 4 } -func (u U32) constant() {} - -// F64 is a 64-bit floating point constant. -type F64 float64 - -func (f F64) Asm() string { return fmt.Sprintf("$(%#v)", f) } -func (f F64) Bytes() int { return 8 } -func (f F64) constant() {} - -// I64 is a 64-bit signed integer constant. -type I64 int64 - -func (i I64) Asm() string { return fmt.Sprintf("$%+d", i) } -func (i I64) Bytes() int { return 8 } -func (i I64) constant() {} - -// U64 is a 64-bit unsigned integer constant. -type U64 uint64 - -func (u U64) Asm() string { return fmt.Sprintf("$%#016x", u) } -func (u U64) Bytes() int { return 8 } -func (u U64) constant() {} diff --git a/vendor/github.com/mmcloughlin/avo/pass/alloc.go b/vendor/github.com/mmcloughlin/avo/pass/alloc.go deleted file mode 100644 index c67a211c..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/alloc.go +++ /dev/null @@ -1,188 +0,0 @@ -package pass - -import ( - "errors" - "math" - - "github.com/mmcloughlin/avo/reg" -) - -// edge is an edge of the interference graph, indicating that registers X and Y -// must be in non-conflicting registers. -type edge struct { - X, Y reg.Register -} - -// Allocator is a graph-coloring register allocator. -type Allocator struct { - registers []reg.Physical - allocation reg.Allocation - edges []*edge - possible map[reg.Virtual][]reg.Physical - vidtopid map[reg.VID]reg.PID -} - -// NewAllocator builds an allocator for the given physical registers. -func NewAllocator(rs []reg.Physical) (*Allocator, error) { - if len(rs) == 0 { - return nil, errors.New("no registers") - } - return &Allocator{ - registers: rs, - allocation: reg.NewEmptyAllocation(), - possible: map[reg.Virtual][]reg.Physical{}, - vidtopid: map[reg.VID]reg.PID{}, - }, nil -} - -// NewAllocatorForKind builds an allocator for the given kind of registers. -func NewAllocatorForKind(k reg.Kind) (*Allocator, error) { - f := reg.FamilyOfKind(k) - if f == nil { - return nil, errors.New("unknown register family") - } - return NewAllocator(f.Registers()) -} - -// AddInterferenceSet records that r interferes with every register in s. Convenience wrapper around AddInterference. -func (a *Allocator) AddInterferenceSet(r reg.Register, s reg.Set) { - for y := range s { - a.AddInterference(r, y) - } -} - -// AddInterference records that x and y must be assigned to non-conflicting physical registers. -func (a *Allocator) AddInterference(x, y reg.Register) { - a.Add(x) - a.Add(y) - a.edges = append(a.edges, &edge{X: x, Y: y}) -} - -// Add adds a register to be allocated. Does nothing if the register has already been added. -func (a *Allocator) Add(r reg.Register) { - v, ok := r.(reg.Virtual) - if !ok { - return - } - if _, found := a.possible[v]; found { - return - } - a.possible[v] = a.possibleregisters(v) -} - -// Allocate allocates physical registers. -func (a *Allocator) Allocate() (reg.Allocation, error) { - for { - if err := a.update(); err != nil { - return nil, err - } - - if a.remaining() == 0 { - break - } - - v := a.mostrestricted() - if err := a.alloc(v); err != nil { - return nil, err - } - } - return a.allocation, nil -} - -// update possible allocations based on edges. -func (a *Allocator) update() error { - for v := range a.possible { - pid, found := a.vidtopid[v.VirtualID()] - if !found { - continue - } - a.possible[v] = filterregisters(a.possible[v], func(r reg.Physical) bool { - return r.PhysicalID() == pid - }) - } - - var rem []*edge - for _, e := range a.edges { - e.X, e.Y = a.allocation.LookupDefault(e.X), a.allocation.LookupDefault(e.Y) - - px, py := reg.ToPhysical(e.X), reg.ToPhysical(e.Y) - vx, vy := reg.ToVirtual(e.X), reg.ToVirtual(e.Y) - - switch { - case vx != nil && vy != nil: - rem = append(rem, e) - continue - case px != nil && py != nil: - if reg.AreConflicting(px, py) { - return errors.New("impossible register allocation") - } - case px != nil && vy != nil: - a.discardconflicting(vy, px) - case vx != nil && py != nil: - a.discardconflicting(vx, py) - default: - panic("unreachable") - } - } - a.edges = rem - - return nil -} - -// mostrestricted returns the virtual register with the least possibilities. -func (a *Allocator) mostrestricted() reg.Virtual { - n := int(math.MaxInt32) - var v reg.Virtual - for r, p := range a.possible { - if len(p) < n || (len(p) == n && v != nil && r.VirtualID() < v.VirtualID()) { - n = len(p) - v = r - } - } - return v -} - -// discardconflicting removes registers from vs possible list that conflict with p. -func (a *Allocator) discardconflicting(v reg.Virtual, p reg.Physical) { - a.possible[v] = filterregisters(a.possible[v], func(r reg.Physical) bool { - if pid, found := a.vidtopid[v.VirtualID()]; found && pid == p.PhysicalID() { - return true - } - return !reg.AreConflicting(r, p) - }) -} - -// alloc attempts to allocate a register to v. -func (a *Allocator) alloc(v reg.Virtual) error { - ps := a.possible[v] - if len(ps) == 0 { - return errors.New("failed to allocate registers") - } - p := ps[0] - a.allocation[v] = p - delete(a.possible, v) - a.vidtopid[v.VirtualID()] = p.PhysicalID() - return nil -} - -// remaining returns the number of unallocated registers. -func (a *Allocator) remaining() int { - return len(a.possible) -} - -// possibleregisters returns all allocate-able registers for the given virtual. -func (a *Allocator) possibleregisters(v reg.Virtual) []reg.Physical { - return filterregisters(a.registers, func(r reg.Physical) bool { - return v.SatisfiedBy(r) && (r.Info()®.Restricted) == 0 - }) -} - -func filterregisters(in []reg.Physical, predicate func(reg.Physical) bool) []reg.Physical { - var rs []reg.Physical - for _, r := range in { - if predicate(r) { - rs = append(rs, r) - } - } - return rs -} diff --git a/vendor/github.com/mmcloughlin/avo/pass/cfg.go b/vendor/github.com/mmcloughlin/avo/pass/cfg.go deleted file mode 100644 index 198208de..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/cfg.go +++ /dev/null @@ -1,85 +0,0 @@ -package pass - -import ( - "errors" - "fmt" - - "github.com/mmcloughlin/avo/ir" -) - -// LabelTarget populates the LabelTarget of the given function. This maps from -// label name to the following instruction. -func LabelTarget(fn *ir.Function) error { - target := map[ir.Label]*ir.Instruction{} - var empty ir.Label - pending := empty - for _, node := range fn.Nodes { - switch n := node.(type) { - case ir.Label: - if pending != empty { - return errors.New("instruction should follow a label") - } - pending = n - if _, found := target[pending]; found { - return fmt.Errorf("duplicate label \"%s\"", pending) - } - case *ir.Instruction: - if pending != empty { - target[pending] = n - pending = empty - } - } - } - if pending != empty { - return errors.New("function ends with label") - } - fn.LabelTarget = target - return nil -} - -// CFG constructs the call-flow-graph for the function. -func CFG(fn *ir.Function) error { - is := fn.Instructions() - n := len(is) - - // Populate successors. - for i := 0; i < n; i++ { - cur := is[i] - var nxt *ir.Instruction - if i+1 < n { - nxt = is[i+1] - } - - // If it's a branch, locate the target. - if cur.IsBranch { - lbl := cur.TargetLabel() - if lbl == nil { - return errors.New("no label for branch instruction") - } - target, found := fn.LabelTarget[*lbl] - if !found { - return fmt.Errorf("unknown label %q", *lbl) - } - cur.Succ = append(cur.Succ, target) - } - - // Otherwise, could continue to the following instruction. - switch { - case cur.IsTerminal: - case cur.IsBranch && !cur.IsConditional: - default: - cur.Succ = append(cur.Succ, nxt) - } - } - - // Populate predecessors. - for _, i := range is { - for _, s := range i.Succ { - if s != nil { - s.Pred = append(s.Pred, i) - } - } - } - - return nil -} diff --git a/vendor/github.com/mmcloughlin/avo/pass/cleanup.go b/vendor/github.com/mmcloughlin/avo/pass/cleanup.go deleted file mode 100644 index d91250f3..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/cleanup.go +++ /dev/null @@ -1,123 +0,0 @@ -package pass - -import ( - "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/operand" -) - -// PruneJumpToFollowingLabel removes jump instructions that target an -// immediately following label. -func PruneJumpToFollowingLabel(fn *ir.Function) error { - for i := 0; i+1 < len(fn.Nodes); i++ { - node := fn.Nodes[i] - next := fn.Nodes[i+1] - - // This node is an unconditional jump. - inst, ok := node.(*ir.Instruction) - if !ok || !inst.IsBranch || inst.IsConditional { - continue - } - - target := inst.TargetLabel() - if target == nil { - continue - } - - // And the jump target is the immediately following node. - lbl, ok := next.(ir.Label) - if !ok || lbl != *target { - continue - } - - // Then the jump is unnecessary and can be removed. - fn.Nodes = deletenode(fn.Nodes, i) - i-- - } - - return nil -} - -// PruneDanglingLabels removes labels that are not referenced by any branches. -func PruneDanglingLabels(fn *ir.Function) error { - // Count label references. - count := map[ir.Label]int{} - for _, n := range fn.Nodes { - i, ok := n.(*ir.Instruction) - if !ok || !i.IsBranch { - continue - } - - target := i.TargetLabel() - if target == nil { - continue - } - - count[*target]++ - } - - // Look for labels with no references. - for i := 0; i < len(fn.Nodes); i++ { - node := fn.Nodes[i] - lbl, ok := node.(ir.Label) - if !ok { - continue - } - - if count[lbl] == 0 { - fn.Nodes = deletenode(fn.Nodes, i) - i-- - } - } - - return nil -} - -// PruneSelfMoves removes move instructions from one register to itself. -func PruneSelfMoves(fn *ir.Function) error { - return removeinstructions(fn, func(i *ir.Instruction) bool { - switch i.Opcode { - case "MOVB", "MOVW", "MOVL", "MOVQ": - default: - return false - } - - return operand.IsRegister(i.Operands[0]) && operand.IsRegister(i.Operands[1]) && i.Operands[0] == i.Operands[1] - }) -} - -// removeinstructions deletes instructions from the given function which match predicate. -func removeinstructions(fn *ir.Function, predicate func(*ir.Instruction) bool) error { - // Removal of instructions has the potential to invalidate CFG structures. - // Clear them to prevent accidental use of stale structures after this pass. - invalidatecfg(fn) - - for i := 0; i < len(fn.Nodes); i++ { - n := fn.Nodes[i] - - inst, ok := n.(*ir.Instruction) - if !ok || !predicate(inst) { - continue - } - - fn.Nodes = deletenode(fn.Nodes, i) - } - - return nil -} - -// deletenode deletes node i from nodes and returns the resulting slice. -func deletenode(nodes []ir.Node, i int) []ir.Node { - n := len(nodes) - copy(nodes[i:], nodes[i+1:]) - nodes[n-1] = nil - return nodes[:n-1] -} - -// invalidatecfg clears CFG structures. -func invalidatecfg(fn *ir.Function) { - fn.LabelTarget = nil - for _, i := range fn.Instructions() { - i.Pred = nil - i.Succ = nil - } -} diff --git a/vendor/github.com/mmcloughlin/avo/pass/pass.go b/vendor/github.com/mmcloughlin/avo/pass/pass.go deleted file mode 100644 index 6b99e717..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/pass.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package pass implements processing passes on avo Files. -package pass - -import ( - "io" - - "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/printer" -) - -// Compile pass compiles an avo file. Upon successful completion the avo file -// may be printed to Go assembly. -var Compile = Concat( - FunctionPass(PruneJumpToFollowingLabel), - FunctionPass(PruneDanglingLabels), - FunctionPass(LabelTarget), - FunctionPass(CFG), - FunctionPass(Liveness), - FunctionPass(AllocateRegisters), - FunctionPass(BindRegisters), - FunctionPass(VerifyAllocation), - Func(IncludeTextFlagHeader), - FunctionPass(PruneSelfMoves), -) - -// Interface for a processing pass. -type Interface interface { - Execute(*ir.File) error -} - -// Func adapts a function to the pass Interface. -type Func func(*ir.File) error - -// Execute calls p. -func (p Func) Execute(f *ir.File) error { - return p(f) -} - -// FunctionPass is a convenience for implementing a full file pass with a -// function that operates on each avo Function independently. -type FunctionPass func(*ir.Function) error - -// Execute calls p on every function in the file. Exits on the first error. -func (p FunctionPass) Execute(f *ir.File) error { - for _, fn := range f.Functions() { - if err := p(fn); err != nil { - return err - } - } - return nil -} - -// Concat returns a pass that executes the given passes in order, stopping on the first error. -func Concat(passes ...Interface) Interface { - return Func(func(f *ir.File) error { - for _, p := range passes { - if err := p.Execute(f); err != nil { - return err - } - } - return nil - }) -} - -// Output pass prints a file. -type Output struct { - Writer io.WriteCloser - Printer printer.Printer -} - -// Execute prints f with the configured Printer and writes output to Writer. -func (o *Output) Execute(f *ir.File) error { - b, err := o.Printer.Print(f) - if err != nil { - return err - } - if _, err = o.Writer.Write(b); err != nil { - return err - } - return o.Writer.Close() -} diff --git a/vendor/github.com/mmcloughlin/avo/pass/reg.go b/vendor/github.com/mmcloughlin/avo/pass/reg.go deleted file mode 100644 index 6d6e2153..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/reg.go +++ /dev/null @@ -1,134 +0,0 @@ -package pass - -import ( - "errors" - - "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/reg" -) - -// Liveness computes register liveness. -func Liveness(fn *ir.Function) error { - // Note this implementation is initially naive so as to be "obviously correct". - // There are a well-known optimizations we can apply if necessary. - - is := fn.Instructions() - - // Process instructions in reverse: poor approximation to topological sort. - // TODO(mbm): process instructions in topological sort order - for l, r := 0, len(is)-1; l < r; l, r = l+1, r-1 { - is[l], is[r] = is[r], is[l] - } - - // Initialize. - for _, i := range is { - i.LiveIn = reg.NewSetFromSlice(i.InputRegisters()) - i.LiveOut = reg.NewEmptySet() - } - - // Iterative dataflow analysis. - for { - changes := false - - for _, i := range is { - // out[n] = UNION[s IN succ[n]] in[s] - nout := len(i.LiveOut) - for _, s := range i.Succ { - if s == nil { - continue - } - i.LiveOut.Update(s.LiveIn) - } - if len(i.LiveOut) != nout { - changes = true - } - - // in[n] = use[n] UNION (out[n] - def[n]) - nin := len(i.LiveIn) - def := reg.NewSetFromSlice(i.OutputRegisters()) - i.LiveIn.Update(i.LiveOut.Difference(def)) - for r := range i.LiveOut { - if _, found := def[r]; !found { - i.LiveIn.Add(r) - } - } - if len(i.LiveIn) != nin { - changes = true - } - } - - if !changes { - break - } - } - - return nil -} - -// AllocateRegisters performs register allocation. -func AllocateRegisters(fn *ir.Function) error { - // Populate allocators (one per kind). - as := map[reg.Kind]*Allocator{} - for _, i := range fn.Instructions() { - for _, r := range i.Registers() { - k := r.Kind() - if _, found := as[k]; !found { - a, err := NewAllocatorForKind(k) - if err != nil { - return err - } - as[k] = a - } - as[k].Add(r) - } - } - - // Record register interferences. - for _, i := range fn.Instructions() { - for _, d := range i.OutputRegisters() { - k := d.Kind() - out := i.LiveOut.OfKind(k) - out.Discard(d) - as[k].AddInterferenceSet(d, out) - } - } - - // Execute register allocation. - fn.Allocation = reg.NewEmptyAllocation() - for _, a := range as { - al, err := a.Allocate() - if err != nil { - return err - } - if err := fn.Allocation.Merge(al); err != nil { - return err - } - } - - return nil -} - -// BindRegisters applies the result of register allocation, replacing all virtual registers with their assigned physical registers. -func BindRegisters(fn *ir.Function) error { - for _, i := range fn.Instructions() { - for idx := range i.Operands { - i.Operands[idx] = operand.ApplyAllocation(i.Operands[idx], fn.Allocation) - } - } - return nil -} - -// VerifyAllocation performs sanity checks following register allocation. -func VerifyAllocation(fn *ir.Function) error { - // All registers should be physical. - for _, i := range fn.Instructions() { - for _, r := range i.Registers() { - if reg.ToPhysical(r) == nil { - return errors.New("non physical register found") - } - } - } - - return nil -} diff --git a/vendor/github.com/mmcloughlin/avo/pass/textflag.go b/vendor/github.com/mmcloughlin/avo/pass/textflag.go deleted file mode 100644 index 35a848b8..00000000 --- a/vendor/github.com/mmcloughlin/avo/pass/textflag.go +++ /dev/null @@ -1,42 +0,0 @@ -package pass - -import ( - "github.com/mmcloughlin/avo/attr" - "github.com/mmcloughlin/avo/ir" -) - -// IncludeTextFlagHeader includes textflag.h if necessary. -func IncludeTextFlagHeader(f *ir.File) error { - const textflagheader = "textflag.h" - - // Check if we already have it. - for _, path := range f.Includes { - if path == textflagheader { - return nil - } - } - - // Add it if necessary. - if requirestextflags(f) { - f.Includes = append(f.Includes, textflagheader) - } - - return nil -} - -// requirestextflags returns whether the file uses flags in the textflags.h header. -func requirestextflags(f *ir.File) bool { - for _, s := range f.Sections { - var a attr.Attribute - switch s := s.(type) { - case *ir.Function: - a = s.Attributes - case *ir.Global: - a = s.Attributes - } - if a.ContainsTextFlags() { - return true - } - } - return false -} diff --git a/vendor/github.com/mmcloughlin/avo/printer/goasm.go b/vendor/github.com/mmcloughlin/avo/printer/goasm.go deleted file mode 100644 index 66522a55..00000000 --- a/vendor/github.com/mmcloughlin/avo/printer/goasm.go +++ /dev/null @@ -1,157 +0,0 @@ -package printer - -import ( - "fmt" - "strconv" - "strings" - "text/tabwriter" - - "github.com/mmcloughlin/avo/internal/prnt" - "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/operand" -) - -// dot is the pesky unicode dot used in Go assembly. -const dot = "\u00b7" - -type goasm struct { - cfg Config - prnt.Generator -} - -// NewGoAsm constructs a printer for writing Go assembly files. -func NewGoAsm(cfg Config) Printer { - return &goasm{cfg: cfg} -} - -func (p *goasm) Print(f *ir.File) ([]byte, error) { - p.header(f) - for _, s := range f.Sections { - switch s := s.(type) { - case *ir.Function: - p.function(s) - case *ir.Global: - p.global(s) - default: - panic("unknown section type") - } - } - return p.Result() -} - -func (p *goasm) header(f *ir.File) { - p.Comment(p.cfg.GeneratedWarning()) - - if len(f.Constraints) > 0 { - p.NL() - p.Printf(f.Constraints.GoString()) - } - - if len(f.Includes) > 0 { - p.NL() - p.includes(f.Includes) - } -} - -func (p *goasm) includes(paths []string) { - for _, path := range paths { - p.Printf("#include \"%s\"\n", path) - } -} - -func (p *goasm) function(f *ir.Function) { - p.NL() - p.Comment(f.Stub()) - - // Reference: https://github.com/golang/go/blob/b115207baf6c2decc3820ada4574ef4e5ad940ec/src/cmd/internal/obj/util.go#L166-L176 - // - // if p.As == ATEXT { - // // If there are attributes, print them. Otherwise, skip the comma. - // // In short, print one of these two: - // // TEXT foo(SB), DUPOK|NOSPLIT, $0 - // // TEXT foo(SB), $0 - // s := p.From.Sym.Attribute.TextAttrString() - // if s != "" { - // fmt.Fprintf(&buf, "%s%s", sep, s) - // sep = ", " - // } - // } - // - p.Printf("TEXT %s%s(SB)", dot, f.Name) - if f.Attributes != 0 { - p.Printf(", %s", f.Attributes.Asm()) - } - p.Printf(", %s\n", textsize(f)) - - w := p.tabwriter() - clear := true - flush := func() { - w.Flush() - w = p.tabwriter() - if !clear { - p.NL() - clear = true - } - } - for _, node := range f.Nodes { - switch n := node.(type) { - case *ir.Instruction: - leader := []byte{tabwriter.Escape, '\t', tabwriter.Escape} - fmt.Fprint(w, string(leader)+n.Opcode) - if len(n.Operands) > 0 { - fmt.Fprintf(w, "\t%s", joinOperands(n.Operands)) - } - fmt.Fprint(w, "\n") - clear = false - case ir.Label: - flush() - p.Printf("%s:\n", n) - case *ir.Comment: - flush() - for _, line := range n.Lines { - p.Printf("\t// %s\n", line) - } - default: - panic("unexpected node type") - } - } - w.Flush() -} - -func (p *goasm) tabwriter() *tabwriter.Writer { - return tabwriter.NewWriter(p.Raw(), 4, 4, 1, ' ', tabwriter.StripEscape) -} - -func (p *goasm) global(g *ir.Global) { - p.NL() - for _, d := range g.Data { - a := operand.NewDataAddr(g.Symbol, d.Offset) - p.Printf("DATA %s/%d, %s\n", a.Asm(), d.Value.Bytes(), d.Value.Asm()) - } - p.Printf("GLOBL %s(SB), %s, $%d\n", g.Symbol, g.Attributes.Asm(), g.Size) -} - -func textsize(f *ir.Function) string { - // Reference: https://github.com/golang/go/blob/b115207baf6c2decc3820ada4574ef4e5ad940ec/src/cmd/internal/obj/util.go#L260-L265 - // - // case TYPE_TEXTSIZE: - // if a.Val.(int32) == objabi.ArgsSizeUnknown { - // str = fmt.Sprintf("$%d", a.Offset) - // } else { - // str = fmt.Sprintf("$%d-%d", a.Offset, a.Val.(int32)) - // } - // - s := "$" + strconv.Itoa(f.FrameBytes()) - if argsize := f.ArgumentBytes(); argsize > 0 { - return s + "-" + strconv.Itoa(argsize) - } - return s -} - -func joinOperands(operands []operand.Op) string { - asm := make([]string, len(operands)) - for i, op := range operands { - asm[i] = op.Asm() - } - return strings.Join(asm, ", ") -} diff --git a/vendor/github.com/mmcloughlin/avo/printer/printer.go b/vendor/github.com/mmcloughlin/avo/printer/printer.go deleted file mode 100644 index b562c74e..00000000 --- a/vendor/github.com/mmcloughlin/avo/printer/printer.go +++ /dev/null @@ -1,98 +0,0 @@ -// Package printer implements printing of avo files in various formats. -package printer - -import ( - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/mmcloughlin/avo/internal/stack" - "github.com/mmcloughlin/avo/ir" -) - -// Printer can produce output for an avo File. -type Printer interface { - Print(*ir.File) ([]byte, error) -} - -// Builder can construct a printer. -type Builder func(Config) Printer - -// Config represents general printing configuration. -type Config struct { - // Command-line arguments passed to the generator. If provided, this will be - // included in a code generation warning. - Argv []string - - // Name of the code generator. - Name string - - // Name of Go package the generated code will belong to. - Pkg string -} - -// NewDefaultConfig produces a config with Name "avo". -// The package name is guessed from the current directory. -func NewDefaultConfig() Config { - return Config{ - Name: "avo", - Pkg: pkg(), - } -} - -// NewArgvConfig constructs a Config from os.Args. -// The package name is guessed from the current directory. -func NewArgvConfig() Config { - return Config{ - Argv: os.Args, - Pkg: pkg(), - } -} - -// NewGoRunConfig produces a Config for a generator that's expected to be -// executed via "go run ...". -func NewGoRunConfig() Config { - path := mainfile() - if path == "" { - return NewDefaultConfig() - } - argv := []string{"go", "run", filepath.Base(path)} - if len(os.Args) > 1 { - argv = append(argv, os.Args[1:]...) - } - return Config{ - Argv: argv, - Pkg: pkg(), - } -} - -// GeneratedBy returns a description of the code generator. -func (c Config) GeneratedBy() string { - if c.Argv == nil { - return c.Name - } - return fmt.Sprintf("command: %s", strings.Join(c.Argv, " ")) -} - -// GeneratedWarning returns text for a code generation warning. Conforms to https://golang.org/s/generatedcode. -func (c Config) GeneratedWarning() string { - return fmt.Sprintf("Code generated by %s. DO NOT EDIT.", c.GeneratedBy()) -} - -// mainfile attempts to determine the file path of the main function by -// inspecting the stack. Returns empty string on failure. -func mainfile() string { - if m := stack.Main(); m != nil { - return m.File - } - return "" -} - -// pkg guesses the name of the package from the working directory. -func pkg() string { - if cwd, err := os.Getwd(); err == nil { - return filepath.Base(cwd) - } - return "" -} diff --git a/vendor/github.com/mmcloughlin/avo/printer/stubs.go b/vendor/github.com/mmcloughlin/avo/printer/stubs.go deleted file mode 100644 index 1aedcf07..00000000 --- a/vendor/github.com/mmcloughlin/avo/printer/stubs.go +++ /dev/null @@ -1,34 +0,0 @@ -package printer - -import ( - "github.com/mmcloughlin/avo/internal/prnt" - "github.com/mmcloughlin/avo/ir" -) - -type stubs struct { - cfg Config - prnt.Generator -} - -// NewStubs constructs a printer for writing stub function declarations. -func NewStubs(cfg Config) Printer { - return &stubs{cfg: cfg} -} - -func (s *stubs) Print(f *ir.File) ([]byte, error) { - s.Comment(s.cfg.GeneratedWarning()) - - if len(f.Constraints) > 0 { - s.NL() - s.Printf(f.Constraints.GoString()) - } - - s.NL() - s.Printf("package %s\n", s.cfg.Pkg) - for _, fn := range f.Functions() { - s.NL() - s.Comment(fn.Doc...) - s.Printf("%s\n", fn.Stub()) - } - return s.Result() -} diff --git a/vendor/github.com/mmcloughlin/avo/reg/collection.go b/vendor/github.com/mmcloughlin/avo/reg/collection.go deleted file mode 100644 index 5c85104e..00000000 --- a/vendor/github.com/mmcloughlin/avo/reg/collection.go +++ /dev/null @@ -1,48 +0,0 @@ -package reg - -// Collection represents a collection of virtual registers. This is primarily -// useful for allocating virtual registers with distinct IDs. -type Collection struct { - vid map[Kind]VID -} - -// NewCollection builds an empty register collection. -func NewCollection() *Collection { - return &Collection{ - vid: map[Kind]VID{}, - } -} - -// VirtualRegister allocates and returns a new virtual register of the given kind and width. -func (c *Collection) VirtualRegister(k Kind, w Width) Virtual { - vid := c.vid[k] - c.vid[k]++ - return NewVirtual(vid, k, w) -} - -// GP8 allocates and returns a general-purpose 8-bit register. -func (c *Collection) GP8() GPVirtual { return c.GP(B8) } - -// GP16 allocates and returns a general-purpose 16-bit register. -func (c *Collection) GP16() GPVirtual { return c.GP(B16) } - -// GP32 allocates and returns a general-purpose 32-bit register. -func (c *Collection) GP32() GPVirtual { return c.GP(B32) } - -// GP64 allocates and returns a general-purpose 64-bit register. -func (c *Collection) GP64() GPVirtual { return c.GP(B64) } - -// GP allocates and returns a general-purpose register of the given width. -func (c *Collection) GP(w Width) GPVirtual { return newgpv(c.VirtualRegister(KindGP, w)) } - -// XMM allocates and returns a 128-bit vector register. -func (c *Collection) XMM() VecVirtual { return c.Vec(B128) } - -// YMM allocates and returns a 256-bit vector register. -func (c *Collection) YMM() VecVirtual { return c.Vec(B256) } - -// ZMM allocates and returns a 512-bit vector register. -func (c *Collection) ZMM() VecVirtual { return c.Vec(B512) } - -// Vec allocates and returns a vector register of the given width. -func (c *Collection) Vec(w Width) VecVirtual { return newvecv(c.VirtualRegister(KindVector, w)) } diff --git a/vendor/github.com/mmcloughlin/avo/reg/doc.go b/vendor/github.com/mmcloughlin/avo/reg/doc.go deleted file mode 100644 index 1c0aee37..00000000 --- a/vendor/github.com/mmcloughlin/avo/reg/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package reg provides types for physical and virtual registers, and definitions of x86-64 register families. -package reg diff --git a/vendor/github.com/mmcloughlin/avo/reg/set.go b/vendor/github.com/mmcloughlin/avo/reg/set.go deleted file mode 100644 index fd1ddf3a..00000000 --- a/vendor/github.com/mmcloughlin/avo/reg/set.go +++ /dev/null @@ -1,82 +0,0 @@ -package reg - -// Set is a set of registers. -type Set map[Register]bool - -// NewEmptySet builds an empty register set. -func NewEmptySet() Set { - return Set{} -} - -// NewSetFromSlice forms a set from the given register list. -func NewSetFromSlice(rs []Register) Set { - s := NewEmptySet() - for _, r := range rs { - s.Add(r) - } - return s -} - -// Clone returns a copy of s. -func (s Set) Clone() Set { - c := NewEmptySet() - for r := range s { - c.Add(r) - } - return c -} - -// Add r to s. -func (s Set) Add(r Register) { - s[r] = true -} - -// Discard removes r from s, if present. -func (s Set) Discard(r Register) { - delete(s, r) -} - -// Update adds every register in t to s. -func (s Set) Update(t Set) { - for r := range t { - s.Add(r) - } -} - -// Difference returns the set of registers in s but not t. -func (s Set) Difference(t Set) Set { - d := s.Clone() - d.DifferenceUpdate(t) - return d -} - -// DifferenceUpdate removes every element of t from s. -func (s Set) DifferenceUpdate(t Set) { - for r := range t { - s.Discard(r) - } -} - -// Equals returns true if s and t contain the same registers. -func (s Set) Equals(t Set) bool { - if len(s) != len(t) { - return false - } - for r := range s { - if _, found := t[r]; !found { - return false - } - } - return true -} - -// OfKind returns the set of elements of s with kind k. -func (s Set) OfKind(k Kind) Set { - t := NewEmptySet() - for r := range s { - if r.Kind() == k { - t.Add(r) - } - } - return t -} diff --git a/vendor/github.com/mmcloughlin/avo/reg/types.go b/vendor/github.com/mmcloughlin/avo/reg/types.go deleted file mode 100644 index cd9f32ac..00000000 --- a/vendor/github.com/mmcloughlin/avo/reg/types.go +++ /dev/null @@ -1,269 +0,0 @@ -package reg - -import ( - "errors" - "fmt" -) - -// Width is a register width. -type Width uint - -// Typical register width values. -const ( - B8 Width = 1 << iota - B16 - B32 - B64 - B128 - B256 - B512 -) - -// Size returns the register width in bytes. -func (w Width) Size() uint { return uint(w) } - -// Kind is a class of registers. -type Kind uint8 - -// Family is a collection of Physical registers of a common kind. -type Family struct { - Kind Kind - registers []Physical -} - -// define builds a register and adds it to the Family. -func (f *Family) define(s Spec, id PID, name string, flags ...Info) Physical { - r := newregister(f, s, id, name, flags...) - f.add(r) - return r -} - -// add r to the family. -func (f *Family) add(r Physical) { - if r.Kind() != f.Kind { - panic("bad kind") - } - f.registers = append(f.registers, r) -} - -// Virtual returns a virtual register from this family's kind. -func (f *Family) Virtual(id VID, w Width) Virtual { - return NewVirtual(id, f.Kind, w) -} - -// Registers returns the registers in this family. -func (f *Family) Registers() []Physical { - return append([]Physical(nil), f.registers...) -} - -// Set returns the set of registers in the family. -func (f *Family) Set() Set { - s := NewEmptySet() - for _, r := range f.registers { - s.Add(r) - } - return s -} - -// Lookup returns the register with given physical ID and spec. Returns nil if no such register exists. -func (f *Family) Lookup(id PID, s Spec) Physical { - for _, r := range f.registers { - if r.PhysicalID() == id && r.Mask() == s.Mask() { - return r - } - } - return nil -} - -// Register represents a virtual or physical register. -type Register interface { - Kind() Kind - Size() uint - Asm() string - as(Spec) Register - register() -} - -// VID is a virtual register ID. -type VID uint16 - -// Virtual is a register of a given type and size, not yet allocated to a physical register. -type Virtual interface { - VirtualID() VID - SatisfiedBy(Physical) bool - Register -} - -// ToVirtual converts r to Virtual if possible, otherwise returns nil. -func ToVirtual(r Register) Virtual { - if v, ok := r.(Virtual); ok { - return v - } - return nil -} - -type virtual struct { - id VID - kind Kind - Width - mask uint16 -} - -// NewVirtual builds a Virtual register. -func NewVirtual(id VID, k Kind, w Width) Virtual { - return virtual{ - id: id, - kind: k, - Width: w, - } -} - -func (v virtual) VirtualID() VID { return v.id } -func (v virtual) Kind() Kind { return v.kind } - -func (v virtual) Asm() string { - // TODO(mbm): decide on virtual register syntax - return fmt.Sprintf("", v.id, v.Kind(), v.Size()) -} - -func (v virtual) SatisfiedBy(p Physical) bool { - return v.Kind() == p.Kind() && v.Size() == p.Size() && (v.mask == 0 || v.mask == p.Mask()) -} - -func (v virtual) as(s Spec) Register { - return virtual{ - id: v.id, - kind: v.kind, - Width: Width(s.Size()), - mask: s.Mask(), - } -} - -func (v virtual) register() {} - -// Info is a bitmask of register properties. -type Info uint8 - -// Defined register Info flags. -const ( - None Info = 0 - Restricted Info = 1 << iota -) - -// PID is a physical register ID. -type PID uint16 - -// Physical is a concrete register. -type Physical interface { - PhysicalID() PID - Mask() uint16 - Info() Info - Register -} - -// ToPhysical converts r to Physical if possible, otherwise returns nil. -func ToPhysical(r Register) Physical { - if p, ok := r.(Physical); ok { - return p - } - return nil -} - -// register implements Physical. -type register struct { - family *Family - id PID - name string - info Info - Spec -} - -func newregister(f *Family, s Spec, id PID, name string, flags ...Info) register { - r := register{ - family: f, - id: id, - name: name, - info: None, - Spec: s, - } - for _, flag := range flags { - r.info |= flag - } - return r -} - -func (r register) PhysicalID() PID { return r.id } -func (r register) Kind() Kind { return r.family.Kind } -func (r register) Asm() string { return r.name } -func (r register) Info() Info { return r.info } - -func (r register) as(s Spec) Register { - return r.family.Lookup(r.PhysicalID(), s) -} - -func (r register) register() {} - -// Spec defines the size of a register as well as the bit ranges it occupies in -// an underlying physical register. -type Spec uint16 - -// Spec values required for x86-64. -const ( - S0 Spec = 0x0 // zero value reserved for pseudo registers - S8L Spec = 0x1 - S8H Spec = 0x2 - S8 = S8L - S16 Spec = 0x3 - S32 Spec = 0x7 - S64 Spec = 0xf - S128 Spec = 0x1f - S256 Spec = 0x3f - S512 Spec = 0x7f -) - -// Mask returns a mask representing which bytes of an underlying register are -// used by this register. This is almost always the low bytes, except for the -// case of the high-byte registers. If bit n of the mask is set, this means -// bytes 2^(n-1) to 2^n-1 are used. -func (s Spec) Mask() uint16 { - return uint16(s) -} - -// Size returns the register width in bytes. -func (s Spec) Size() uint { - x := uint(s) - return (x >> 1) + (x & 1) -} - -// AreConflicting returns whether registers conflict with each other. -func AreConflicting(x, y Physical) bool { - return x.Kind() == y.Kind() && x.PhysicalID() == y.PhysicalID() && (x.Mask()&y.Mask()) != 0 -} - -// Allocation records a register allocation. -type Allocation map[Register]Physical - -// NewEmptyAllocation builds an empty register allocation. -func NewEmptyAllocation() Allocation { - return Allocation{} -} - -// Merge allocations from b into a. Errors if there is disagreement on a common -// register. -func (a Allocation) Merge(b Allocation) error { - for r, p := range b { - if alt, found := a[r]; found && alt != p { - return errors.New("disagreement on overlapping register") - } - a[r] = p - } - return nil -} - -// LookupDefault returns the register assigned to r, or r itself if there is none. -func (a Allocation) LookupDefault(r Register) Register { - if p, found := a[r]; found { - return p - } - return r -} diff --git a/vendor/github.com/mmcloughlin/avo/reg/x86.go b/vendor/github.com/mmcloughlin/avo/reg/x86.go deleted file mode 100644 index 96316bd5..00000000 --- a/vendor/github.com/mmcloughlin/avo/reg/x86.go +++ /dev/null @@ -1,330 +0,0 @@ -package reg - -// Register kinds. -const ( - KindPseudo Kind = iota - KindGP - KindVector -) - -// Declare register families. -var ( - Pseudo = &Family{Kind: KindPseudo} - GeneralPurpose = &Family{Kind: KindGP} - Vector = &Family{Kind: KindVector} - - Families = []*Family{ - Pseudo, - GeneralPurpose, - Vector, - } -) - -var familiesByKind = map[Kind]*Family{} - -func init() { - for _, f := range Families { - familiesByKind[f.Kind] = f - } -} - -// FamilyOfKind returns the Family of registers of the given kind. -func FamilyOfKind(k Kind) *Family { - return familiesByKind[k] -} - -// Pseudo registers. -var ( - FramePointer = Pseudo.define(S0, 0, "FP") - ProgramCounter = Pseudo.define(S0, 0, "PC") - StaticBase = Pseudo.define(S0, 0, "SB") - StackPointer = Pseudo.define(S0, 0, "SP") -) - -// GP provides additional methods for general purpose registers. -type GP interface { - As8() Register - As8L() Register - As8H() Register - As16() Register - As32() Register - As64() Register -} - -type gpcasts struct { - Register -} - -func (c gpcasts) As8() Register { return c.as(S8) } -func (c gpcasts) As8L() Register { return c.as(S8L) } -func (c gpcasts) As8H() Register { return c.as(S8H) } -func (c gpcasts) As16() Register { return c.as(S16) } -func (c gpcasts) As32() Register { return c.as(S32) } -func (c gpcasts) As64() Register { return c.as(S64) } - -// GPPhysical is a general-purpose physical register. -type GPPhysical interface { - Physical - GP -} - -type gpp struct { - Physical - GP -} - -func newgpp(r Physical) GPPhysical { return gpp{Physical: r, GP: gpcasts{r}} } - -// GPVirtual is a general-purpose virtual register. -type GPVirtual interface { - Virtual - GP -} - -type gpv struct { - Virtual - GP -} - -func newgpv(v Virtual) GPVirtual { return gpv{Virtual: v, GP: gpcasts{v}} } - -func gp(s Spec, id PID, name string, flags ...Info) GPPhysical { - r := newgpp(newregister(GeneralPurpose, s, id, name, flags...)) - GeneralPurpose.add(r) - return r -} - -// General purpose registers. -var ( - // Low byte - AL = gp(S8L, 0, "AL") - CL = gp(S8L, 1, "CL") - DL = gp(S8L, 2, "DL") - BL = gp(S8L, 3, "BL") - - // High byte - AH = gp(S8H, 0, "AH") - CH = gp(S8H, 1, "CH") - DH = gp(S8H, 2, "DH") - BH = gp(S8H, 3, "BH") - - // 8-bit - SPB = gp(S8, 4, "SP", Restricted) - BPB = gp(S8, 5, "BP") - SIB = gp(S8, 6, "SI") - DIB = gp(S8, 7, "DI") - R8B = gp(S8, 8, "R8") - R9B = gp(S8, 9, "R9") - R10B = gp(S8, 10, "R10") - R11B = gp(S8, 11, "R11") - R12B = gp(S8, 12, "R12") - R13B = gp(S8, 13, "R13") - R14B = gp(S8, 14, "R14") - R15B = gp(S8, 15, "R15") - - // 16-bit - AX = gp(S16, 0, "AX") - CX = gp(S16, 1, "CX") - DX = gp(S16, 2, "DX") - BX = gp(S16, 3, "BX") - SP = gp(S16, 4, "SP", Restricted) - BP = gp(S16, 5, "BP") - SI = gp(S16, 6, "SI") - DI = gp(S16, 7, "DI") - R8W = gp(S16, 8, "R8") - R9W = gp(S16, 9, "R9") - R10W = gp(S16, 10, "R10") - R11W = gp(S16, 11, "R11") - R12W = gp(S16, 12, "R12") - R13W = gp(S16, 13, "R13") - R14W = gp(S16, 14, "R14") - R15W = gp(S16, 15, "R15") - - // 32-bit - EAX = gp(S32, 0, "AX") - ECX = gp(S32, 1, "CX") - EDX = gp(S32, 2, "DX") - EBX = gp(S32, 3, "BX") - ESP = gp(S32, 4, "SP", Restricted) - EBP = gp(S32, 5, "BP") - ESI = gp(S32, 6, "SI") - EDI = gp(S32, 7, "DI") - R8L = gp(S32, 8, "R8") - R9L = gp(S32, 9, "R9") - R10L = gp(S32, 10, "R10") - R11L = gp(S32, 11, "R11") - R12L = gp(S32, 12, "R12") - R13L = gp(S32, 13, "R13") - R14L = gp(S32, 14, "R14") - R15L = gp(S32, 15, "R15") - - // 64-bit - RAX = gp(S64, 0, "AX") - RCX = gp(S64, 1, "CX") - RDX = gp(S64, 2, "DX") - RBX = gp(S64, 3, "BX") - RSP = gp(S64, 4, "SP", Restricted) - RBP = gp(S64, 5, "BP") - RSI = gp(S64, 6, "SI") - RDI = gp(S64, 7, "DI") - R8 = gp(S64, 8, "R8") - R9 = gp(S64, 9, "R9") - R10 = gp(S64, 10, "R10") - R11 = gp(S64, 11, "R11") - R12 = gp(S64, 12, "R12") - R13 = gp(S64, 13, "R13") - R14 = gp(S64, 14, "R14") - R15 = gp(S64, 15, "R15") -) - -// Vec provides methods for vector registers. -type Vec interface { - AsX() Register - AsY() Register - AsZ() Register -} - -type veccasts struct { - Register -} - -func (c veccasts) AsX() Register { return c.as(S128) } -func (c veccasts) AsY() Register { return c.as(S256) } -func (c veccasts) AsZ() Register { return c.as(S512) } - -// VecPhysical is a physical vector register. -type VecPhysical interface { - Physical - Vec -} - -type vecp struct { - Physical - Vec -} - -func newvecp(r Physical) VecPhysical { return vecp{Physical: r, Vec: veccasts{r}} } - -// VecVirtual is a virtual vector register. -type VecVirtual interface { - Virtual - Vec -} - -type vecv struct { - Virtual - Vec -} - -func newvecv(v Virtual) VecVirtual { return vecv{Virtual: v, Vec: veccasts{v}} } - -func vec(s Spec, id PID, name string, flags ...Info) VecPhysical { - r := newvecp(newregister(Vector, s, id, name, flags...)) - Vector.add(r) - return r -} - -// Vector registers. -var ( - // 128-bit - X0 = vec(S128, 0, "X0") - X1 = vec(S128, 1, "X1") - X2 = vec(S128, 2, "X2") - X3 = vec(S128, 3, "X3") - X4 = vec(S128, 4, "X4") - X5 = vec(S128, 5, "X5") - X6 = vec(S128, 6, "X6") - X7 = vec(S128, 7, "X7") - X8 = vec(S128, 8, "X8") - X9 = vec(S128, 9, "X9") - X10 = vec(S128, 10, "X10") - X11 = vec(S128, 11, "X11") - X12 = vec(S128, 12, "X12") - X13 = vec(S128, 13, "X13") - X14 = vec(S128, 14, "X14") - X15 = vec(S128, 15, "X15") - X16 = vec(S128, 16, "X16") - X17 = vec(S128, 17, "X17") - X18 = vec(S128, 18, "X18") - X19 = vec(S128, 19, "X19") - X20 = vec(S128, 20, "X20") - X21 = vec(S128, 21, "X21") - X22 = vec(S128, 22, "X22") - X23 = vec(S128, 23, "X23") - X24 = vec(S128, 24, "X24") - X25 = vec(S128, 25, "X25") - X26 = vec(S128, 26, "X26") - X27 = vec(S128, 27, "X27") - X28 = vec(S128, 28, "X28") - X29 = vec(S128, 29, "X29") - X30 = vec(S128, 30, "X30") - X31 = vec(S128, 31, "X31") - - // 256-bit - Y0 = vec(S256, 0, "Y0") - Y1 = vec(S256, 1, "Y1") - Y2 = vec(S256, 2, "Y2") - Y3 = vec(S256, 3, "Y3") - Y4 = vec(S256, 4, "Y4") - Y5 = vec(S256, 5, "Y5") - Y6 = vec(S256, 6, "Y6") - Y7 = vec(S256, 7, "Y7") - Y8 = vec(S256, 8, "Y8") - Y9 = vec(S256, 9, "Y9") - Y10 = vec(S256, 10, "Y10") - Y11 = vec(S256, 11, "Y11") - Y12 = vec(S256, 12, "Y12") - Y13 = vec(S256, 13, "Y13") - Y14 = vec(S256, 14, "Y14") - Y15 = vec(S256, 15, "Y15") - Y16 = vec(S256, 16, "Y16") - Y17 = vec(S256, 17, "Y17") - Y18 = vec(S256, 18, "Y18") - Y19 = vec(S256, 19, "Y19") - Y20 = vec(S256, 20, "Y20") - Y21 = vec(S256, 21, "Y21") - Y22 = vec(S256, 22, "Y22") - Y23 = vec(S256, 23, "Y23") - Y24 = vec(S256, 24, "Y24") - Y25 = vec(S256, 25, "Y25") - Y26 = vec(S256, 26, "Y26") - Y27 = vec(S256, 27, "Y27") - Y28 = vec(S256, 28, "Y28") - Y29 = vec(S256, 29, "Y29") - Y30 = vec(S256, 30, "Y30") - Y31 = vec(S256, 31, "Y31") - - // 512-bit - Z0 = vec(S512, 0, "Z0") - Z1 = vec(S512, 1, "Z1") - Z2 = vec(S512, 2, "Z2") - Z3 = vec(S512, 3, "Z3") - Z4 = vec(S512, 4, "Z4") - Z5 = vec(S512, 5, "Z5") - Z6 = vec(S512, 6, "Z6") - Z7 = vec(S512, 7, "Z7") - Z8 = vec(S512, 8, "Z8") - Z9 = vec(S512, 9, "Z9") - Z10 = vec(S512, 10, "Z10") - Z11 = vec(S512, 11, "Z11") - Z12 = vec(S512, 12, "Z12") - Z13 = vec(S512, 13, "Z13") - Z14 = vec(S512, 14, "Z14") - Z15 = vec(S512, 15, "Z15") - Z16 = vec(S512, 16, "Z16") - Z17 = vec(S512, 17, "Z17") - Z18 = vec(S512, 18, "Z18") - Z19 = vec(S512, 19, "Z19") - Z20 = vec(S512, 20, "Z20") - Z21 = vec(S512, 21, "Z21") - Z22 = vec(S512, 22, "Z22") - Z23 = vec(S512, 23, "Z23") - Z24 = vec(S512, 24, "Z24") - Z25 = vec(S512, 25, "Z25") - Z26 = vec(S512, 26, "Z26") - Z27 = vec(S512, 27, "Z27") - Z28 = vec(S512, 28, "Z28") - Z29 = vec(S512, 29, "Z29") - Z30 = vec(S512, 30, "Z30") - Z31 = vec(S512, 31, "Z31") -) diff --git a/vendor/github.com/mmcloughlin/avo/src/src.go b/vendor/github.com/mmcloughlin/avo/src/src.go deleted file mode 100644 index 3a47886e..00000000 --- a/vendor/github.com/mmcloughlin/avo/src/src.go +++ /dev/null @@ -1,62 +0,0 @@ -// Package src provides types for working with source files. -package src - -import ( - "os" - "path/filepath" - "runtime" - "strconv" -) - -// Position represents a position in a source file. -type Position struct { - Filename string - Line int // 1-up -} - -// FramePosition returns the Position of the given stack frame. -func FramePosition(f runtime.Frame) Position { - return Position{ - Filename: f.File, - Line: f.Line, - } -} - -// IsValid reports whether the position is valid: Line must be positive, but -// Filename may be empty. -func (p Position) IsValid() bool { - return p.Line > 0 -} - -// String represents Position as a string. -func (p Position) String() string { - if !p.IsValid() { - return "-" - } - var s string - if p.Filename != "" { - s += p.Filename + ":" - } - s += strconv.Itoa(p.Line) - return s -} - -// Rel returns Position relative to basepath. If the given filename cannot be -// expressed relative to basepath the position will be returned unchanged. -func (p Position) Rel(basepath string) Position { - q := p - if rel, err := filepath.Rel(basepath, q.Filename); err == nil { - q.Filename = rel - } - return q -} - -// Relwd returns Position relative to the current working directory. Returns p -// unchanged if the working directory cannot be determined, or the filename -// cannot be expressed relative to the working directory. -func (p Position) Relwd() Position { - if wd, err := os.Getwd(); err == nil { - return p.Rel(wd) - } - return p -} diff --git a/vendor/github.com/mmcloughlin/avo/x86/doc.go b/vendor/github.com/mmcloughlin/avo/x86/doc.go deleted file mode 100644 index 6e4c8ee8..00000000 --- a/vendor/github.com/mmcloughlin/avo/x86/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package x86 provides constructors for all x86-64 instructions. -package x86 diff --git a/vendor/github.com/mmcloughlin/avo/x86/gen.go b/vendor/github.com/mmcloughlin/avo/x86/gen.go deleted file mode 100644 index 25d15fa6..00000000 --- a/vendor/github.com/mmcloughlin/avo/x86/gen.go +++ /dev/null @@ -1,4 +0,0 @@ -package x86 - -//go:generate avogen -output zctors.go ctors -//go:generate avogen -output zctors_test.go ctorstest diff --git a/vendor/github.com/mmcloughlin/avo/x86/zctors.go b/vendor/github.com/mmcloughlin/avo/x86/zctors.go deleted file mode 100644 index 3ef1d2fd..00000000 --- a/vendor/github.com/mmcloughlin/avo/x86/zctors.go +++ /dev/null @@ -1,32576 +0,0 @@ -// Code generated by command: avogen -output zctors.go ctors. DO NOT EDIT. - -package x86 - -import ( - "errors" - intrep "github.com/mmcloughlin/avo/ir" - "github.com/mmcloughlin/avo/operand" - "github.com/mmcloughlin/avo/reg" -) - -// ADCB: Add with Carry. -// -// Forms: -// -// ADCB imm8 al -// ADCB imm8 r8 -// ADCB r8 r8 -// ADCB m8 r8 -// ADCB imm8 m8 -// ADCB r8 m8 -func ADCB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ADCB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ADCB: bad operands") -} - -// ADCL: Add with Carry. -// -// Forms: -// -// ADCL imm32 eax -// ADCL imm8 r32 -// ADCL imm32 r32 -// ADCL r32 r32 -// ADCL m32 r32 -// ADCL imm8 m32 -// ADCL imm32 m32 -// ADCL r32 m32 -func ADCL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADCL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("ADCL: bad operands") -} - -// ADCQ: Add with Carry. -// -// Forms: -// -// ADCQ imm32 rax -// ADCQ imm8 r64 -// ADCQ imm32 r64 -// ADCQ r64 r64 -// ADCQ m64 r64 -// ADCQ imm8 m64 -// ADCQ imm32 m64 -// ADCQ r64 m64 -func ADCQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADCQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ADCQ: bad operands") -} - -// ADCW: Add with Carry. -// -// Forms: -// -// ADCW imm16 ax -// ADCW imm8 r16 -// ADCW imm16 r16 -// ADCW r16 r16 -// ADCW m16 r16 -// ADCW imm8 m16 -// ADCW imm16 m16 -// ADCW r16 m16 -func ADCW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADCW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ADCW: bad operands") -} - -// ADCXL: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXL r32 r32 -// ADCXL m32 r32 -func ADCXL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "ADCXL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "ADCXL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("ADCXL: bad operands") -} - -// ADCXQ: Unsigned Integer Addition of Two Operands with Carry Flag. -// -// Forms: -// -// ADCXQ r64 r64 -// ADCXQ m64 r64 -func ADCXQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "ADCXQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "ADCXQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("ADCXQ: bad operands") -} - -// ADDB: Add. -// -// Forms: -// -// ADDB imm8 al -// ADDB imm8 r8 -// ADDB r8 r8 -// ADDB m8 r8 -// ADDB imm8 m8 -// ADDB r8 m8 -func ADDB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ADDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ADDB: bad operands") -} - -// ADDL: Add. -// -// Forms: -// -// ADDL imm32 eax -// ADDL imm8 r32 -// ADDL imm32 r32 -// ADDL r32 r32 -// ADDL m32 r32 -// ADDL imm8 m32 -// ADDL imm32 m32 -// ADDL r32 m32 -func ADDL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ADDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("ADDL: bad operands") -} - -// ADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDPD xmm xmm -// ADDPD m128 xmm -func ADDPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDPD: bad operands") -} - -// ADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDPS xmm xmm -// ADDPS m128 xmm -func ADDPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDPS: bad operands") -} - -// ADDQ: Add. -// -// Forms: -// -// ADDQ imm32 rax -// ADDQ imm8 r64 -// ADDQ imm32 r64 -// ADDQ r64 r64 -// ADDQ m64 r64 -// ADDQ imm8 m64 -// ADDQ imm32 m64 -// ADDQ r64 m64 -func ADDQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ADDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ADDQ: bad operands") -} - -// ADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// ADDSD xmm xmm -// ADDSD m64 xmm -func ADDSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDSD: bad operands") -} - -// ADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// ADDSS xmm xmm -// ADDSS m32 xmm -func ADDSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDSS: bad operands") -} - -// ADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPD xmm xmm -// ADDSUBPD m128 xmm -func ADDSUBPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDSUBPD: bad operands") -} - -// ADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// ADDSUBPS xmm xmm -// ADDSUBPS m128 xmm -func ADDSUBPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ADDSUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ADDSUBPS: bad operands") -} - -// ADDW: Add. -// -// Forms: -// -// ADDW imm16 ax -// ADDW imm8 r16 -// ADDW imm16 r16 -// ADDW r16 r16 -// ADDW m16 r16 -// ADDW imm8 m16 -// ADDW imm16 m16 -// ADDW r16 m16 -func ADDW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ADDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ADDW: bad operands") -} - -// ADOXL: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXL r32 r32 -// ADOXL m32 r32 -func ADOXL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "ADOXL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "ADOXL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("ADOXL: bad operands") -} - -// ADOXQ: Unsigned Integer Addition of Two Operands with Overflow Flag. -// -// Forms: -// -// ADOXQ r64 r64 -// ADOXQ m64 r64 -func ADOXQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "ADOXQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "ADOXQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("ADOXQ: bad operands") -} - -// AESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// AESDEC xmm xmm -// AESDEC m128 xmm -func AESDEC(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESDEC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESDEC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESDEC: bad operands") -} - -// AESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// AESDECLAST xmm xmm -// AESDECLAST m128 xmm -func AESDECLAST(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESDECLAST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESDECLAST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESDECLAST: bad operands") -} - -// AESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// AESENC xmm xmm -// AESENC m128 xmm -func AESENC(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESENC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESENC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESENC: bad operands") -} - -// AESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// AESENCLAST xmm xmm -// AESENCLAST m128 xmm -func AESENCLAST(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESENCLAST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESENCLAST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESENCLAST: bad operands") -} - -// AESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// AESIMC xmm xmm -// AESIMC m128 xmm -func AESIMC(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESIMC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESIMC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESIMC: bad operands") -} - -// AESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// AESKEYGENASSIST imm8 xmm xmm -// AESKEYGENASSIST imm8 m128 xmm -func AESKEYGENASSIST(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESKEYGENASSIST", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "AESKEYGENASSIST", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("AESKEYGENASSIST: bad operands") -} - -// ANDB: Logical AND. -// -// Forms: -// -// ANDB imm8 al -// ANDB imm8 r8 -// ANDB r8 r8 -// ANDB m8 r8 -// ANDB imm8 m8 -// ANDB r8 m8 -func ANDB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ANDB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ANDB: bad operands") -} - -// ANDL: Logical AND. -// -// Forms: -// -// ANDL imm32 eax -// ANDL imm8 r32 -// ANDL imm32 r32 -// ANDL r32 r32 -// ANDL m32 r32 -// ANDL imm8 m32 -// ANDL imm32 m32 -// ANDL r32 m32 -func ANDL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ANDL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("ANDL: bad operands") -} - -// ANDNL: Logical AND NOT. -// -// Forms: -// -// ANDNL r32 r32 r32 -// ANDNL m32 r32 r32 -func ANDNL(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "ANDNL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "ANDNL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("ANDNL: bad operands") -} - -// ANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPD xmm xmm -// ANDNPD m128 xmm -func ANDNPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDNPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDNPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ANDNPD: bad operands") -} - -// ANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDNPS xmm xmm -// ANDNPS m128 xmm -func ANDNPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDNPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDNPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ANDNPS: bad operands") -} - -// ANDNQ: Logical AND NOT. -// -// Forms: -// -// ANDNQ r64 r64 r64 -// ANDNQ m64 r64 r64 -func ANDNQ(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "ANDNQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "ANDNQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("ANDNQ: bad operands") -} - -// ANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// ANDPD xmm xmm -// ANDPD m128 xmm -func ANDPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ANDPD: bad operands") -} - -// ANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// ANDPS xmm xmm -// ANDPS m128 xmm -func ANDPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ANDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ANDPS: bad operands") -} - -// ANDQ: Logical AND. -// -// Forms: -// -// ANDQ imm32 rax -// ANDQ imm8 r64 -// ANDQ imm32 r64 -// ANDQ r64 r64 -// ANDQ m64 r64 -// ANDQ imm8 m64 -// ANDQ imm32 m64 -// ANDQ r64 m64 -func ANDQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ANDQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ANDQ: bad operands") -} - -// ANDW: Logical AND. -// -// Forms: -// -// ANDW imm16 ax -// ANDW imm8 r16 -// ANDW imm16 r16 -// ANDW r16 r16 -// ANDW m16 r16 -// ANDW imm8 m16 -// ANDW imm16 m16 -// ANDW r16 m16 -func ANDW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ANDW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ANDW: bad operands") -} - -// BEXTRL: Bit Field Extract. -// -// Forms: -// -// BEXTRL r32 r32 r32 -// BEXTRL r32 m32 r32 -func BEXTRL(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "BEXTRL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "BEXTRL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("BEXTRL: bad operands") -} - -// BEXTRQ: Bit Field Extract. -// -// Forms: -// -// BEXTRQ r64 r64 r64 -// BEXTRQ r64 m64 r64 -func BEXTRQ(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "BEXTRQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "BEXTRQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("BEXTRQ: bad operands") -} - -// BLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDPD imm8 xmm xmm -// BLENDPD imm8 m128 xmm -func BLENDPD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "BLENDPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "BLENDPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("BLENDPD: bad operands") -} - -// BLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDPS imm8 xmm xmm -// BLENDPS imm8 m128 xmm -func BLENDPS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "BLENDPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "BLENDPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("BLENDPS: bad operands") -} - -// BLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPD xmm0 xmm xmm -// BLENDVPD xmm0 m128 xmm -func BLENDVPD(x, mx, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM0(x) && operand.IsXMM(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "BLENDVPD", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsXMM0(x) && operand.IsM128(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "BLENDVPD", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("BLENDVPD: bad operands") -} - -// BLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// BLENDVPS xmm0 xmm xmm -// BLENDVPS xmm0 m128 xmm -func BLENDVPS(x, mx, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM0(x) && operand.IsXMM(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "BLENDVPS", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsXMM0(x) && operand.IsM128(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "BLENDVPS", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("BLENDVPS: bad operands") -} - -// BLSIL: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIL r32 r32 -// BLSIL m32 r32 -func BLSIL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSIL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSIL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSIL: bad operands") -} - -// BLSIQ: Isolate Lowest Set Bit. -// -// Forms: -// -// BLSIQ r64 r64 -// BLSIQ m64 r64 -func BLSIQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSIQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSIQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSIQ: bad operands") -} - -// BLSMSKL: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKL r32 r32 -// BLSMSKL m32 r32 -func BLSMSKL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSMSKL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSMSKL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSMSKL: bad operands") -} - -// BLSMSKQ: Mask From Lowest Set Bit. -// -// Forms: -// -// BLSMSKQ r64 r64 -// BLSMSKQ m64 r64 -func BLSMSKQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSMSKQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSMSKQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSMSKQ: bad operands") -} - -// BLSRL: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRL r32 r32 -// BLSRL m32 r32 -func BLSRL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSRL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BLSRL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSRL: bad operands") -} - -// BLSRQ: Reset Lowest Set Bit. -// -// Forms: -// -// BLSRQ r64 r64 -// BLSRQ m64 r64 -func BLSRQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSRQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BLSRQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BLSRQ: bad operands") -} - -// BSFL: Bit Scan Forward. -// -// Forms: -// -// BSFL r32 r32 -// BSFL m32 r32 -func BSFL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BSFL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BSFL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSFL: bad operands") -} - -// BSFQ: Bit Scan Forward. -// -// Forms: -// -// BSFQ r64 r64 -// BSFQ m64 r64 -func BSFQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BSFQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BSFQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSFQ: bad operands") -} - -// BSFW: Bit Scan Forward. -// -// Forms: -// -// BSFW r16 r16 -// BSFW m16 r16 -func BSFW(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "BSFW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "BSFW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSFW: bad operands") -} - -// BSRL: Bit Scan Reverse. -// -// Forms: -// -// BSRL r32 r32 -// BSRL m32 r32 -func BSRL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BSRL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BSRL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSRL: bad operands") -} - -// BSRQ: Bit Scan Reverse. -// -// Forms: -// -// BSRQ r64 r64 -// BSRQ m64 r64 -func BSRQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BSRQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BSRQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSRQ: bad operands") -} - -// BSRW: Bit Scan Reverse. -// -// Forms: -// -// BSRW r16 r16 -// BSRW m16 r16 -func BSRW(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "BSRW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "BSRW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSRW: bad operands") -} - -// BSWAPL: Byte Swap. -// -// Forms: -// -// BSWAPL r32 -func BSWAPL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "BSWAPL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSWAPL: bad operands") -} - -// BSWAPQ: Byte Swap. -// -// Forms: -// -// BSWAPQ r64 -func BSWAPQ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "BSWAPQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("BSWAPQ: bad operands") -} - -// BTCL: Bit Test and Complement. -// -// Forms: -// -// BTCL imm8 r32 -// BTCL r32 r32 -// BTCL imm8 m32 -// BTCL r32 m32 -func BTCL(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTCL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTCL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTCL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTCL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTCL: bad operands") -} - -// BTCQ: Bit Test and Complement. -// -// Forms: -// -// BTCQ imm8 r64 -// BTCQ r64 r64 -// BTCQ imm8 m64 -// BTCQ r64 m64 -func BTCQ(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTCQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTCQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTCQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTCQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTCQ: bad operands") -} - -// BTCW: Bit Test and Complement. -// -// Forms: -// -// BTCW imm8 r16 -// BTCW r16 r16 -// BTCW imm8 m16 -// BTCW r16 m16 -func BTCW(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTCW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTCW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTCW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTCW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTCW: bad operands") -} - -// BTL: Bit Test. -// -// Forms: -// -// BTL imm8 r32 -// BTL r32 r32 -// BTL imm8 m32 -// BTL r32 m32 -func BTL(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("BTL: bad operands") -} - -// BTQ: Bit Test. -// -// Forms: -// -// BTQ imm8 r64 -// BTQ r64 r64 -// BTQ imm8 m64 -// BTQ r64 m64 -func BTQ(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("BTQ: bad operands") -} - -// BTRL: Bit Test and Reset. -// -// Forms: -// -// BTRL imm8 r32 -// BTRL r32 r32 -// BTRL imm8 m32 -// BTRL r32 m32 -func BTRL(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTRL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTRL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTRL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTRL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTRL: bad operands") -} - -// BTRQ: Bit Test and Reset. -// -// Forms: -// -// BTRQ imm8 r64 -// BTRQ r64 r64 -// BTRQ imm8 m64 -// BTRQ r64 m64 -func BTRQ(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTRQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTRQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTRQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTRQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTRQ: bad operands") -} - -// BTRW: Bit Test and Reset. -// -// Forms: -// -// BTRW imm8 r16 -// BTRW r16 r16 -// BTRW imm8 m16 -// BTRW r16 m16 -func BTRW(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTRW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTRW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTRW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTRW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTRW: bad operands") -} - -// BTSL: Bit Test and Set. -// -// Forms: -// -// BTSL imm8 r32 -// BTSL r32 r32 -// BTSL imm8 m32 -// BTSL r32 m32 -func BTSL(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTSL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "BTSL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTSL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(ir) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "BTSL", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTSL: bad operands") -} - -// BTSQ: Bit Test and Set. -// -// Forms: -// -// BTSQ imm8 r64 -// BTSQ r64 r64 -// BTSQ imm8 m64 -// BTSQ r64 m64 -func BTSQ(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTSQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "BTSQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTSQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "BTSQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTSQ: bad operands") -} - -// BTSW: Bit Test and Set. -// -// Forms: -// -// BTSW imm8 r16 -// BTSW r16 r16 -// BTSW imm8 m16 -// BTSW r16 m16 -func BTSW(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTSW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTSW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTSW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTSW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("BTSW: bad operands") -} - -// BTW: Bit Test. -// -// Forms: -// -// BTW imm8 r16 -// BTW r16 r16 -// BTW imm8 m16 -// BTW r16 m16 -func BTW(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(ir) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "BTW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(ir) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "BTW", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("BTW: bad operands") -} - -// BZHIL: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIL r32 r32 r32 -// BZHIL r32 m32 r32 -func BZHIL(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "BZHIL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "BZHIL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("BZHIL: bad operands") -} - -// BZHIQ: Zero High Bits Starting with Specified Bit Position. -// -// Forms: -// -// BZHIQ r64 r64 r64 -// BZHIQ r64 m64 r64 -func BZHIQ(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "BZHIQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "BZHIQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("BZHIQ: bad operands") -} - -// CALL: Call Procedure. -// -// Forms: -// -// CALL rel32 -func CALL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "CALL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CALL: bad operands") -} - -// CBW: Convert Byte to Word. -// -// Forms: -// -// CBW -func CBW() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CBW", - Operands: nil, - Inputs: []operand.Op{reg.AL}, - Outputs: []operand.Op{reg.AX}, - }, nil -} - -// CDQ: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQ -func CDQ() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CDQ", - Operands: nil, - Inputs: []operand.Op{reg.EAX}, - Outputs: []operand.Op{reg.EDX}, - }, nil -} - -// CDQE: Convert Doubleword to Quadword. -// -// Forms: -// -// CDQE -func CDQE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CDQE", - Operands: nil, - Inputs: []operand.Op{reg.EAX}, - Outputs: []operand.Op{reg.RAX}, - }, nil -} - -// CLC: Clear Carry Flag. -// -// Forms: -// -// CLC -func CLC() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CLC", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// CLD: Clear Direction Flag. -// -// Forms: -// -// CLD -func CLD() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CLD", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// CLFLUSH: Flush Cache Line. -// -// Forms: -// -// CLFLUSH m8 -func CLFLUSH(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "CLFLUSH", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CLFLUSH: bad operands") -} - -// CLFLUSHOPT: Flush Cache Line Optimized. -// -// Forms: -// -// CLFLUSHOPT m8 -func CLFLUSHOPT(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "CLFLUSHOPT", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CLFLUSHOPT: bad operands") -} - -// CMC: Complement Carry Flag. -// -// Forms: -// -// CMC -func CMC() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CMC", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// CMOVLCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVLCC r32 r32 -// CMOVLCC m32 r32 -func CMOVLCC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLCC: bad operands") -} - -// CMOVLCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVLCS r32 r32 -// CMOVLCS m32 r32 -func CMOVLCS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLCS: bad operands") -} - -// CMOVLEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVLEQ r32 r32 -// CMOVLEQ m32 r32 -func CMOVLEQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLEQ: bad operands") -} - -// CMOVLGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVLGE r32 r32 -// CMOVLGE m32 r32 -func CMOVLGE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLGE: bad operands") -} - -// CMOVLGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVLGT r32 r32 -// CMOVLGT m32 r32 -func CMOVLGT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLGT: bad operands") -} - -// CMOVLHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVLHI r32 r32 -// CMOVLHI m32 r32 -func CMOVLHI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLHI: bad operands") -} - -// CMOVLLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVLLE r32 r32 -// CMOVLLE m32 r32 -func CMOVLLE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLLE: bad operands") -} - -// CMOVLLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVLLS r32 r32 -// CMOVLLS m32 r32 -func CMOVLLS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLLS: bad operands") -} - -// CMOVLLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVLLT r32 r32 -// CMOVLLT m32 r32 -func CMOVLLT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLLT: bad operands") -} - -// CMOVLMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVLMI r32 r32 -// CMOVLMI m32 r32 -func CMOVLMI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLMI: bad operands") -} - -// CMOVLNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVLNE r32 r32 -// CMOVLNE m32 r32 -func CMOVLNE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLNE: bad operands") -} - -// CMOVLOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVLOC r32 r32 -// CMOVLOC m32 r32 -func CMOVLOC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLOC: bad operands") -} - -// CMOVLOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVLOS r32 r32 -// CMOVLOS m32 r32 -func CMOVLOS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLOS: bad operands") -} - -// CMOVLPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVLPC r32 r32 -// CMOVLPC m32 r32 -func CMOVLPC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLPC: bad operands") -} - -// CMOVLPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVLPL r32 r32 -// CMOVLPL m32 r32 -func CMOVLPL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLPL: bad operands") -} - -// CMOVLPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVLPS r32 r32 -// CMOVLPS m32 r32 -func CMOVLPS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CMOVLPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVLPS: bad operands") -} - -// CMOVQCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVQCC r64 r64 -// CMOVQCC m64 r64 -func CMOVQCC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQCC: bad operands") -} - -// CMOVQCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVQCS r64 r64 -// CMOVQCS m64 r64 -func CMOVQCS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQCS: bad operands") -} - -// CMOVQEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVQEQ r64 r64 -// CMOVQEQ m64 r64 -func CMOVQEQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQEQ: bad operands") -} - -// CMOVQGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVQGE r64 r64 -// CMOVQGE m64 r64 -func CMOVQGE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQGE: bad operands") -} - -// CMOVQGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVQGT r64 r64 -// CMOVQGT m64 r64 -func CMOVQGT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQGT: bad operands") -} - -// CMOVQHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVQHI r64 r64 -// CMOVQHI m64 r64 -func CMOVQHI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQHI: bad operands") -} - -// CMOVQLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVQLE r64 r64 -// CMOVQLE m64 r64 -func CMOVQLE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQLE: bad operands") -} - -// CMOVQLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVQLS r64 r64 -// CMOVQLS m64 r64 -func CMOVQLS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQLS: bad operands") -} - -// CMOVQLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVQLT r64 r64 -// CMOVQLT m64 r64 -func CMOVQLT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQLT: bad operands") -} - -// CMOVQMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVQMI r64 r64 -// CMOVQMI m64 r64 -func CMOVQMI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQMI: bad operands") -} - -// CMOVQNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVQNE r64 r64 -// CMOVQNE m64 r64 -func CMOVQNE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQNE: bad operands") -} - -// CMOVQOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVQOC r64 r64 -// CMOVQOC m64 r64 -func CMOVQOC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQOC: bad operands") -} - -// CMOVQOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVQOS r64 r64 -// CMOVQOS m64 r64 -func CMOVQOS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQOS: bad operands") -} - -// CMOVQPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVQPC r64 r64 -// CMOVQPC m64 r64 -func CMOVQPC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQPC: bad operands") -} - -// CMOVQPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVQPL r64 r64 -// CMOVQPL m64 r64 -func CMOVQPL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQPL: bad operands") -} - -// CMOVQPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVQPS r64 r64 -// CMOVQPS m64 r64 -func CMOVQPS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CMOVQPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVQPS: bad operands") -} - -// CMOVWCC: Move if above or equal (CF == 0). -// -// Forms: -// -// CMOVWCC r16 r16 -// CMOVWCC m16 r16 -func CMOVWCC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWCC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWCC: bad operands") -} - -// CMOVWCS: Move if below (CF == 1). -// -// Forms: -// -// CMOVWCS r16 r16 -// CMOVWCS m16 r16 -func CMOVWCS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWCS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWCS: bad operands") -} - -// CMOVWEQ: Move if equal (ZF == 1). -// -// Forms: -// -// CMOVWEQ r16 r16 -// CMOVWEQ m16 r16 -func CMOVWEQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWEQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWEQ: bad operands") -} - -// CMOVWGE: Move if greater or equal (SF == OF). -// -// Forms: -// -// CMOVWGE r16 r16 -// CMOVWGE m16 r16 -func CMOVWGE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWGE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWGE: bad operands") -} - -// CMOVWGT: Move if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// CMOVWGT r16 r16 -// CMOVWGT m16 r16 -func CMOVWGT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWGT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWGT: bad operands") -} - -// CMOVWHI: Move if above (CF == 0 and ZF == 0). -// -// Forms: -// -// CMOVWHI r16 r16 -// CMOVWHI m16 r16 -func CMOVWHI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWHI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWHI: bad operands") -} - -// CMOVWLE: Move if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// CMOVWLE r16 r16 -// CMOVWLE m16 r16 -func CMOVWLE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWLE: bad operands") -} - -// CMOVWLS: Move if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// CMOVWLS r16 r16 -// CMOVWLS m16 r16 -func CMOVWLS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWLS: bad operands") -} - -// CMOVWLT: Move if less (SF != OF). -// -// Forms: -// -// CMOVWLT r16 r16 -// CMOVWLT m16 r16 -func CMOVWLT(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWLT", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWLT: bad operands") -} - -// CMOVWMI: Move if sign (SF == 1). -// -// Forms: -// -// CMOVWMI r16 r16 -// CMOVWMI m16 r16 -func CMOVWMI(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWMI", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWMI: bad operands") -} - -// CMOVWNE: Move if not equal (ZF == 0). -// -// Forms: -// -// CMOVWNE r16 r16 -// CMOVWNE m16 r16 -func CMOVWNE(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWNE", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWNE: bad operands") -} - -// CMOVWOC: Move if not overflow (OF == 0). -// -// Forms: -// -// CMOVWOC r16 r16 -// CMOVWOC m16 r16 -func CMOVWOC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWOC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWOC: bad operands") -} - -// CMOVWOS: Move if overflow (OF == 1). -// -// Forms: -// -// CMOVWOS r16 r16 -// CMOVWOS m16 r16 -func CMOVWOS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWOS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWOS: bad operands") -} - -// CMOVWPC: Move if not parity (PF == 0). -// -// Forms: -// -// CMOVWPC r16 r16 -// CMOVWPC m16 r16 -func CMOVWPC(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPC", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWPC: bad operands") -} - -// CMOVWPL: Move if not sign (SF == 0). -// -// Forms: -// -// CMOVWPL r16 r16 -// CMOVWPL m16 r16 -func CMOVWPL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWPL: bad operands") -} - -// CMOVWPS: Move if parity (PF == 1). -// -// Forms: -// -// CMOVWPS r16 r16 -// CMOVWPS m16 r16 -func CMOVWPS(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "CMOVWPS", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CMOVWPS: bad operands") -} - -// CMPB: Compare Two Operands. -// -// Forms: -// -// CMPB al imm8 -// CMPB r8 imm8 -// CMPB r8 r8 -// CMPB r8 m8 -// CMPB m8 imm8 -// CMPB m8 r8 -func CMPB(amr, imr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsAL(amr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR8(amr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR8(amr) && operand.IsR8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR8(amr) && operand.IsM8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM8(amr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM8(amr) && operand.IsR8(imr): - return &intrep.Instruction{ - Opcode: "CMPB", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CMPB: bad operands") -} - -// CMPL: Compare Two Operands. -// -// Forms: -// -// CMPL eax imm32 -// CMPL r32 imm8 -// CMPL r32 imm32 -// CMPL r32 r32 -// CMPL r32 m32 -// CMPL m32 imm8 -// CMPL m32 imm32 -// CMPL m32 r32 -func CMPL(emr, imr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsEAX(emr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(emr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(emr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(emr) && operand.IsR32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(emr) && operand.IsM32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(emr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(emr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(emr) && operand.IsR32(imr): - return &intrep.Instruction{ - Opcode: "CMPL", - Operands: []operand.Op{emr, imr}, - Inputs: []operand.Op{emr, imr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CMPL: bad operands") -} - -// CMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPPD xmm xmm imm8 -// CMPPD m128 xmm imm8 -func CMPPD(mx, x, i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPPD", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPPD", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CMPPD: bad operands") -} - -// CMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPPS xmm xmm imm8 -// CMPPS m128 xmm imm8 -func CMPPS(mx, x, i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPPS", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPPS", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CMPPS: bad operands") -} - -// CMPQ: Compare Two Operands. -// -// Forms: -// -// CMPQ rax imm32 -// CMPQ r64 imm8 -// CMPQ r64 imm32 -// CMPQ r64 r64 -// CMPQ r64 m64 -// CMPQ m64 imm8 -// CMPQ m64 imm32 -// CMPQ m64 r64 -func CMPQ(mr, imr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsRAX(mr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(mr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(mr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(mr) && operand.IsR64(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(mr) && operand.IsM64(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mr) && operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mr) && operand.IsR64(imr): - return &intrep.Instruction{ - Opcode: "CMPQ", - Operands: []operand.Op{mr, imr}, - Inputs: []operand.Op{mr, imr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CMPQ: bad operands") -} - -// CMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// CMPSD xmm xmm imm8 -// CMPSD m64 xmm imm8 -func CMPSD(mx, x, i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPSD", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPSD", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CMPSD: bad operands") -} - -// CMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// CMPSS xmm xmm imm8 -// CMPSS m32 xmm imm8 -func CMPSS(mx, x, i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPSS", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "CMPSS", - Operands: []operand.Op{mx, x, i}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CMPSS: bad operands") -} - -// CMPW: Compare Two Operands. -// -// Forms: -// -// CMPW ax imm16 -// CMPW r16 imm8 -// CMPW r16 imm16 -// CMPW r16 r16 -// CMPW r16 m16 -// CMPW m16 imm8 -// CMPW m16 imm16 -// CMPW m16 r16 -func CMPW(amr, imr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsAX(amr) && operand.IsIMM16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(amr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(amr) && operand.IsIMM16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(amr) && operand.IsR16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(amr) && operand.IsM16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM16(amr) && operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM16(amr) && operand.IsIMM16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM16(amr) && operand.IsR16(imr): - return &intrep.Instruction{ - Opcode: "CMPW", - Operands: []operand.Op{amr, imr}, - Inputs: []operand.Op{amr, imr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("CMPW: bad operands") -} - -// CMPXCHG16B: Compare and Exchange 16 Bytes. -// -// Forms: -// -// CMPXCHG16B m128 -func CMPXCHG16B(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "CMPXCHG16B", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m, reg.RAX, reg.RBX, reg.RCX, reg.RDX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - } - return nil, errors.New("CMPXCHG16B: bad operands") -} - -// CMPXCHG8B: Compare and Exchange 8 Bytes. -// -// Forms: -// -// CMPXCHG8B m64 -func CMPXCHG8B(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(m): - return &intrep.Instruction{ - Opcode: "CMPXCHG8B", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m, reg.EAX, reg.EBX, reg.ECX, reg.EDX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - } - return nil, errors.New("CMPXCHG8B: bad operands") -} - -// CMPXCHGB: Compare and Exchange. -// -// Forms: -// -// CMPXCHGB r8 r8 -// CMPXCHGB r8 m8 -func CMPXCHGB(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(r) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGB", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR8(r) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGB", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("CMPXCHGB: bad operands") -} - -// CMPXCHGL: Compare and Exchange. -// -// Forms: -// -// CMPXCHGL r32 r32 -// CMPXCHGL r32 m32 -func CMPXCHGL(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGL", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGL", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("CMPXCHGL: bad operands") -} - -// CMPXCHGQ: Compare and Exchange. -// -// Forms: -// -// CMPXCHGQ r64 r64 -// CMPXCHGQ r64 m64 -func CMPXCHGQ(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGQ", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGQ", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("CMPXCHGQ: bad operands") -} - -// CMPXCHGW: Compare and Exchange. -// -// Forms: -// -// CMPXCHGW r16 r16 -// CMPXCHGW r16 m16 -func CMPXCHGW(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(r) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGW", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(r) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "CMPXCHGW", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("CMPXCHGW: bad operands") -} - -// COMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISD xmm xmm -// COMISD m64 xmm -func COMISD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "COMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "COMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("COMISD: bad operands") -} - -// COMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// COMISS xmm xmm -// COMISS m32 xmm -func COMISS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "COMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "COMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("COMISS: bad operands") -} - -// CPUID: CPU Identification. -// -// Forms: -// -// CPUID -func CPUID() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CPUID", - Operands: nil, - Inputs: []operand.Op{reg.EAX, reg.ECX}, - Outputs: []operand.Op{reg.EAX, reg.EBX, reg.ECX, reg.EDX}, - }, nil -} - -// CQO: Convert Quadword to Octaword. -// -// Forms: -// -// CQO -func CQO() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CQO", - Operands: nil, - Inputs: []operand.Op{reg.RAX}, - Outputs: []operand.Op{reg.RDX}, - }, nil -} - -// CRC32B: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32B r8 r32 -// CRC32B m8 r32 -// CRC32B r8 r64 -// CRC32B m8 r64 -func CRC32B(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32B", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32B", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsR8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CRC32B", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CRC32B", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CRC32B: bad operands") -} - -// CRC32L: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32L r32 r32 -// CRC32L m32 r32 -func CRC32L(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32L", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32L", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CRC32L: bad operands") -} - -// CRC32Q: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32Q r64 r64 -// CRC32Q m64 r64 -func CRC32Q(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CRC32Q", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CRC32Q", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CRC32Q: bad operands") -} - -// CRC32W: Accumulate CRC32 Value. -// -// Forms: -// -// CRC32W r16 r32 -// CRC32W m16 r32 -func CRC32W(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32W", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CRC32W", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CRC32W: bad operands") -} - -// CVTPD2PL: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPD2PL xmm xmm -// CVTPD2PL m128 xmm -func CVTPD2PL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPD2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPD2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPD2PL: bad operands") -} - -// CVTPD2PS: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPD2PS xmm xmm -// CVTPD2PS m128 xmm -func CVTPD2PS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPD2PS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPD2PS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPD2PS: bad operands") -} - -// CVTPL2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPL2PD xmm xmm -// CVTPL2PD m64 xmm -func CVTPL2PD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPL2PD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPL2PD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPL2PD: bad operands") -} - -// CVTPL2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// CVTPL2PS xmm xmm -// CVTPL2PS m128 xmm -func CVTPL2PS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPL2PS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPL2PS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPL2PS: bad operands") -} - -// CVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// CVTPS2PD xmm xmm -// CVTPS2PD m64 xmm -func CVTPS2PD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPS2PD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPS2PD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPS2PD: bad operands") -} - -// CVTPS2PL: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTPS2PL xmm xmm -// CVTPS2PL m128 xmm -func CVTPS2PL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPS2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTPS2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTPS2PL: bad operands") -} - -// CVTSD2SL: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// CVTSD2SL xmm r32 -// CVTSD2SL m64 r32 -// CVTSD2SL xmm r64 -// CVTSD2SL m64 r64 -func CVTSD2SL(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CVTSD2SL: bad operands") -} - -// CVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSD2SS xmm xmm -// CVTSD2SS m64 xmm -func CVTSD2SS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSD2SS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSD2SS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSD2SS: bad operands") -} - -// CVTSL2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSL2SD r32 xmm -// CVTSL2SD m32 xmm -func CVTSL2SD(mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSL2SD", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSL2SD", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSL2SD: bad operands") -} - -// CVTSL2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSL2SS r32 xmm -// CVTSL2SS m32 xmm -func CVTSL2SS(mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSL2SS", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSL2SS", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSL2SS: bad operands") -} - -// CVTSQ2SD: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSQ2SD r64 xmm -// CVTSQ2SD m64 xmm -func CVTSQ2SD(mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSQ2SD", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSQ2SD", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSQ2SD: bad operands") -} - -// CVTSQ2SS: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// CVTSQ2SS r64 xmm -// CVTSQ2SS m64 xmm -func CVTSQ2SS(mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSQ2SS", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSQ2SS", - Operands: []operand.Op{mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSQ2SS: bad operands") -} - -// CVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// CVTSS2SD xmm xmm -// CVTSS2SD m32 xmm -func CVTSS2SD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSS2SD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTSS2SD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTSS2SD: bad operands") -} - -// CVTSS2SL: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTSS2SL xmm r32 -// CVTSS2SL m32 r32 -// CVTSS2SL xmm r64 -// CVTSS2SL m32 r64 -func CVTSS2SL(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CVTSS2SL: bad operands") -} - -// CVTTPD2PL: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPD2PL xmm xmm -// CVTTPD2PL m128 xmm -func CVTTPD2PL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTTPD2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTTPD2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTTPD2PL: bad operands") -} - -// CVTTPS2PL: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// CVTTPS2PL xmm xmm -// CVTTPS2PL m128 xmm -func CVTTPS2PL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTTPS2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "CVTTPS2PL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("CVTTPS2PL: bad operands") -} - -// CVTTSD2SL: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SL xmm r32 -// CVTTSD2SL m64 r32 -func CVTTSD2SL(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTTSD2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CVTTSD2SL: bad operands") -} - -// CVTTSD2SQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// CVTTSD2SQ xmm r64 -// CVTTSD2SQ m64 r64 -func CVTTSD2SQ(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTTSD2SQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTTSD2SQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CVTTSD2SQ: bad operands") -} - -// CVTTSS2SL: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// CVTTSS2SL xmm r32 -// CVTTSS2SL m32 r32 -// CVTTSS2SL xmm r64 -// CVTTSS2SL m32 r64 -func CVTTSS2SL(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "CVTTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "CVTTSS2SL", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("CVTTSS2SL: bad operands") -} - -// CWD: Convert Word to Doubleword. -// -// Forms: -// -// CWD -func CWD() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CWD", - Operands: nil, - Inputs: []operand.Op{reg.AX}, - Outputs: []operand.Op{reg.DX}, - }, nil -} - -// CWDE: Convert Word to Doubleword. -// -// Forms: -// -// CWDE -func CWDE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "CWDE", - Operands: nil, - Inputs: []operand.Op{reg.AX}, - Outputs: []operand.Op{reg.EAX}, - }, nil -} - -// DECB: Decrement by 1. -// -// Forms: -// -// DECB r8 -// DECB m8 -func DECB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "DECB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "DECB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("DECB: bad operands") -} - -// DECL: Decrement by 1. -// -// Forms: -// -// DECL r32 -// DECL m32 -func DECL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "DECL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "DECL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("DECL: bad operands") -} - -// DECQ: Decrement by 1. -// -// Forms: -// -// DECQ r64 -// DECQ m64 -func DECQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "DECQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "DECQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("DECQ: bad operands") -} - -// DECW: Decrement by 1. -// -// Forms: -// -// DECW r16 -// DECW m16 -func DECW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "DECW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "DECW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("DECW: bad operands") -} - -// DIVB: Unsigned Divide. -// -// Forms: -// -// DIVB r8 -// DIVB m8 -func DIVB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "DIVB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "DIVB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX}, - }, nil - } - return nil, errors.New("DIVB: bad operands") -} - -// DIVL: Unsigned Divide. -// -// Forms: -// -// DIVL r32 -// DIVL m32 -func DIVL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "DIVL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "DIVL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - } - return nil, errors.New("DIVL: bad operands") -} - -// DIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVPD xmm xmm -// DIVPD m128 xmm -func DIVPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DIVPD: bad operands") -} - -// DIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVPS xmm xmm -// DIVPS m128 xmm -func DIVPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DIVPS: bad operands") -} - -// DIVQ: Unsigned Divide. -// -// Forms: -// -// DIVQ r64 -// DIVQ m64 -func DIVQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "DIVQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX, reg.RDX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "DIVQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX, reg.RDX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - } - return nil, errors.New("DIVQ: bad operands") -} - -// DIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// DIVSD xmm xmm -// DIVSD m64 xmm -func DIVSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DIVSD: bad operands") -} - -// DIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// DIVSS xmm xmm -// DIVSS m32 xmm -func DIVSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DIVSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DIVSS: bad operands") -} - -// DIVW: Unsigned Divide. -// -// Forms: -// -// DIVW r16 -// DIVW m16 -func DIVW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "DIVW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX, reg.DX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "DIVW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX, reg.DX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - } - return nil, errors.New("DIVW: bad operands") -} - -// DPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// DPPD imm8 xmm xmm -// DPPD imm8 m128 xmm -func DPPD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DPPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DPPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DPPD: bad operands") -} - -// DPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// DPPS imm8 xmm xmm -// DPPS imm8 m128 xmm -func DPPS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DPPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "DPPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("DPPS: bad operands") -} - -// EXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// EXTRACTPS imm2u xmm r32 -// EXTRACTPS imm2u xmm m32 -func EXTRACTPS(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM2U(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "EXTRACTPS", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM2U(i) && operand.IsXMM(x) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "EXTRACTPS", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("EXTRACTPS: bad operands") -} - -// HADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// HADDPD xmm xmm -// HADDPD m128 xmm -func HADDPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HADDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HADDPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("HADDPD: bad operands") -} - -// HADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// HADDPS xmm xmm -// HADDPS m128 xmm -func HADDPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HADDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HADDPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("HADDPS: bad operands") -} - -// HSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPD xmm xmm -// HSUBPD m128 xmm -func HSUBPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HSUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HSUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("HSUBPD: bad operands") -} - -// HSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// HSUBPS xmm xmm -// HSUBPS m128 xmm -func HSUBPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HSUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "HSUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("HSUBPS: bad operands") -} - -// IDIVB: Signed Divide. -// -// Forms: -// -// IDIVB r8 -// IDIVB m8 -func IDIVB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "IDIVB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "IDIVB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX}, - }, nil - } - return nil, errors.New("IDIVB: bad operands") -} - -// IDIVL: Signed Divide. -// -// Forms: -// -// IDIVL r32 -// IDIVL m32 -func IDIVL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "IDIVL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "IDIVL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - } - return nil, errors.New("IDIVL: bad operands") -} - -// IDIVQ: Signed Divide. -// -// Forms: -// -// IDIVQ r64 -// IDIVQ m64 -func IDIVQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "IDIVQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX, reg.RDX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "IDIVQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX, reg.RDX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - } - return nil, errors.New("IDIVQ: bad operands") -} - -// IDIVW: Signed Divide. -// -// Forms: -// -// IDIVW r16 -// IDIVW m16 -func IDIVW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "IDIVW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX, reg.DX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "IDIVW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX, reg.DX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - } - return nil, errors.New("IDIVW: bad operands") -} - -// IMUL3L: Signed Multiply. -// -// Forms: -// -// IMUL3L imm8 r32 r32 -// IMUL3L imm32 r32 r32 -// IMUL3L imm8 m32 r32 -// IMUL3L imm32 m32 r32 -func IMUL3L(i, mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "IMUL3L", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM32(i) && operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "IMUL3L", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "IMUL3L", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM32(i) && operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "IMUL3L", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("IMUL3L: bad operands") -} - -// IMUL3Q: Signed Multiply. -// -// Forms: -// -// IMUL3Q imm8 r64 r64 -// IMUL3Q imm32 r64 r64 -// IMUL3Q imm8 m64 r64 -// IMUL3Q imm32 m64 r64 -func IMUL3Q(i, mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "IMUL3Q", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM32(i) && operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "IMUL3Q", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "IMUL3Q", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM32(i) && operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "IMUL3Q", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("IMUL3Q: bad operands") -} - -// IMUL3W: Signed Multiply. -// -// Forms: -// -// IMUL3W imm8 r16 r16 -// IMUL3W imm16 r16 r16 -// IMUL3W imm8 m16 r16 -// IMUL3W imm16 m16 r16 -func IMUL3W(i, mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "IMUL3W", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM16(i) && operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "IMUL3W", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM8(i) && operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "IMUL3W", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM16(i) && operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "IMUL3W", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("IMUL3W: bad operands") -} - -// IMULB: Signed Multiply. -// -// Forms: -// -// IMULB r8 -// IMULB m8 -func IMULB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "IMULB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AL}, - Outputs: []operand.Op{reg.AX}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "IMULB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AL}, - Outputs: []operand.Op{reg.AX}, - }, nil - } - return nil, errors.New("IMULB: bad operands") -} - -// IMULL: Signed Multiply. -// -// Forms: -// -// IMULL r32 -// IMULL m32 -// IMULL r32 r32 -// IMULL m32 r32 -func IMULL(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 1 && operand.IsR32(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULL", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.EAX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - case len(ops) == 1 && operand.IsM32(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULL", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.EAX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - case len(ops) == 2 && operand.IsR32(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsM32(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - } - return nil, errors.New("IMULL: bad operands") -} - -// IMULQ: Signed Multiply. -// -// Forms: -// -// IMULQ r64 -// IMULQ m64 -// IMULQ r64 r64 -// IMULQ m64 r64 -func IMULQ(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 1 && operand.IsR64(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULQ", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.RAX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - case len(ops) == 1 && operand.IsM64(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULQ", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.RAX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - case len(ops) == 2 && operand.IsR64(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsM64(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - } - return nil, errors.New("IMULQ: bad operands") -} - -// IMULW: Signed Multiply. -// -// Forms: -// -// IMULW r16 -// IMULW m16 -// IMULW r16 r16 -// IMULW m16 r16 -func IMULW(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 1 && operand.IsR16(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULW", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.AX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - case len(ops) == 1 && operand.IsM16(ops[0]): - return &intrep.Instruction{ - Opcode: "IMULW", - Operands: ops, - Inputs: []operand.Op{ops[0], reg.AX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - case len(ops) == 2 && operand.IsR16(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsM16(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "IMULW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - } - return nil, errors.New("IMULW: bad operands") -} - -// INCB: Increment by 1. -// -// Forms: -// -// INCB r8 -// INCB m8 -func INCB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "INCB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "INCB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("INCB: bad operands") -} - -// INCL: Increment by 1. -// -// Forms: -// -// INCL r32 -// INCL m32 -func INCL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "INCL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "INCL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("INCL: bad operands") -} - -// INCQ: Increment by 1. -// -// Forms: -// -// INCQ r64 -// INCQ m64 -func INCQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "INCQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "INCQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("INCQ: bad operands") -} - -// INCW: Increment by 1. -// -// Forms: -// -// INCW r16 -// INCW m16 -func INCW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "INCW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "INCW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("INCW: bad operands") -} - -// INSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// INSERTPS imm8 xmm xmm -// INSERTPS imm8 m32 xmm -func INSERTPS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "INSERTPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "INSERTPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("INSERTPS: bad operands") -} - -// INT: Call to Interrupt Procedure. -// -// Forms: -// -// INT 3 -// INT imm8 -func INT(i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is3(i): - return &intrep.Instruction{ - Opcode: "INT", - Operands: []operand.Op{i}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(i): - return &intrep.Instruction{ - Opcode: "INT", - Operands: []operand.Op{i}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("INT: bad operands") -} - -// JA: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JA rel8 -// JA rel32 -func JA(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JA", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JA", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JA: bad operands") -} - -// JAE: Jump if above or equal (CF == 0). -// -// Forms: -// -// JAE rel8 -// JAE rel32 -func JAE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JAE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JAE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JAE: bad operands") -} - -// JB: Jump if below (CF == 1). -// -// Forms: -// -// JB rel8 -// JB rel32 -func JB(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JB", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JB", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JB: bad operands") -} - -// JBE: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JBE rel8 -// JBE rel32 -func JBE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JBE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JBE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JBE: bad operands") -} - -// JC: Jump if below (CF == 1). -// -// Forms: -// -// JC rel8 -// JC rel32 -func JC(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JC: bad operands") -} - -// JCC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JCC rel8 -// JCC rel32 -func JCC(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JCC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JCC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JCC: bad operands") -} - -// JCS: Jump if below (CF == 1). -// -// Forms: -// -// JCS rel8 -// JCS rel32 -func JCS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JCS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JCS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JCS: bad operands") -} - -// JCXZL: Jump if ECX register is 0. -// -// Forms: -// -// JCXZL rel8 -func JCXZL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JCXZL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{reg.ECX}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JCXZL: bad operands") -} - -// JCXZQ: Jump if RCX register is 0. -// -// Forms: -// -// JCXZQ rel8 -func JCXZQ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JCXZQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{reg.RCX}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JCXZQ: bad operands") -} - -// JE: Jump if equal (ZF == 1). -// -// Forms: -// -// JE rel8 -// JE rel32 -func JE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JE: bad operands") -} - -// JEQ: Jump if equal (ZF == 1). -// -// Forms: -// -// JEQ rel8 -// JEQ rel32 -func JEQ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JEQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JEQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JEQ: bad operands") -} - -// JG: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JG rel8 -// JG rel32 -func JG(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JG", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JG", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JG: bad operands") -} - -// JGE: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JGE rel8 -// JGE rel32 -func JGE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JGE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JGE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JGE: bad operands") -} - -// JGT: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JGT rel8 -// JGT rel32 -func JGT(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JGT", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JGT", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JGT: bad operands") -} - -// JHI: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JHI rel8 -// JHI rel32 -func JHI(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JHI", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JHI", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JHI: bad operands") -} - -// JHS: Jump if above or equal (CF == 0). -// -// Forms: -// -// JHS rel8 -// JHS rel32 -func JHS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JHS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JHS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JHS: bad operands") -} - -// JL: Jump if less (SF != OF). -// -// Forms: -// -// JL rel8 -// JL rel32 -func JL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JL: bad operands") -} - -// JLE: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JLE rel8 -// JLE rel32 -func JLE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JLE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JLE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JLE: bad operands") -} - -// JLO: Jump if below (CF == 1). -// -// Forms: -// -// JLO rel8 -// JLO rel32 -func JLO(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JLO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JLO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JLO: bad operands") -} - -// JLS: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JLS rel8 -// JLS rel32 -func JLS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JLS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JLS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JLS: bad operands") -} - -// JLT: Jump if less (SF != OF). -// -// Forms: -// -// JLT rel8 -// JLT rel32 -func JLT(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JLT", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JLT", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JLT: bad operands") -} - -// JMI: Jump if sign (SF == 1). -// -// Forms: -// -// JMI rel8 -// JMI rel32 -func JMI(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JMI", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JMI", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JMI: bad operands") -} - -// JMP: Jump Unconditionally. -// -// Forms: -// -// JMP rel8 -// JMP rel32 -// JMP r64 -// JMP m64 -func JMP(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(mr): - return &intrep.Instruction{ - Opcode: "JMP", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: false, - }, nil - case operand.IsREL32(mr): - return &intrep.Instruction{ - Opcode: "JMP", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: false, - }, nil - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "JMP", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: false, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "JMP", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: false, - }, nil - } - return nil, errors.New("JMP: bad operands") -} - -// JNA: Jump if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// JNA rel8 -// JNA rel32 -func JNA(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNA", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNA", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNA: bad operands") -} - -// JNAE: Jump if below (CF == 1). -// -// Forms: -// -// JNAE rel8 -// JNAE rel32 -func JNAE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNAE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNAE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNAE: bad operands") -} - -// JNB: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNB rel8 -// JNB rel32 -func JNB(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNB", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNB", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNB: bad operands") -} - -// JNBE: Jump if above (CF == 0 and ZF == 0). -// -// Forms: -// -// JNBE rel8 -// JNBE rel32 -func JNBE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNBE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNBE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNBE: bad operands") -} - -// JNC: Jump if above or equal (CF == 0). -// -// Forms: -// -// JNC rel8 -// JNC rel32 -func JNC(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNC: bad operands") -} - -// JNE: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNE rel8 -// JNE rel32 -func JNE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNE: bad operands") -} - -// JNG: Jump if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// JNG rel8 -// JNG rel32 -func JNG(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNG", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNG", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNG: bad operands") -} - -// JNGE: Jump if less (SF != OF). -// -// Forms: -// -// JNGE rel8 -// JNGE rel32 -func JNGE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNGE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNGE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNGE: bad operands") -} - -// JNL: Jump if greater or equal (SF == OF). -// -// Forms: -// -// JNL rel8 -// JNL rel32 -func JNL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNL: bad operands") -} - -// JNLE: Jump if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// JNLE rel8 -// JNLE rel32 -func JNLE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNLE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNLE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNLE: bad operands") -} - -// JNO: Jump if not overflow (OF == 0). -// -// Forms: -// -// JNO rel8 -// JNO rel32 -func JNO(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNO: bad operands") -} - -// JNP: Jump if not parity (PF == 0). -// -// Forms: -// -// JNP rel8 -// JNP rel32 -func JNP(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNP", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNP", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNP: bad operands") -} - -// JNS: Jump if not sign (SF == 0). -// -// Forms: -// -// JNS rel8 -// JNS rel32 -func JNS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNS: bad operands") -} - -// JNZ: Jump if not equal (ZF == 0). -// -// Forms: -// -// JNZ rel8 -// JNZ rel32 -func JNZ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JNZ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JNZ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JNZ: bad operands") -} - -// JO: Jump if overflow (OF == 1). -// -// Forms: -// -// JO rel8 -// JO rel32 -func JO(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JO: bad operands") -} - -// JOC: Jump if not overflow (OF == 0). -// -// Forms: -// -// JOC rel8 -// JOC rel32 -func JOC(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JOC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JOC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JOC: bad operands") -} - -// JOS: Jump if overflow (OF == 1). -// -// Forms: -// -// JOS rel8 -// JOS rel32 -func JOS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JOS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JOS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JOS: bad operands") -} - -// JP: Jump if parity (PF == 1). -// -// Forms: -// -// JP rel8 -// JP rel32 -func JP(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JP", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JP", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JP: bad operands") -} - -// JPC: Jump if not parity (PF == 0). -// -// Forms: -// -// JPC rel8 -// JPC rel32 -func JPC(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JPC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JPC", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JPC: bad operands") -} - -// JPE: Jump if parity (PF == 1). -// -// Forms: -// -// JPE rel8 -// JPE rel32 -func JPE(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JPE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JPE", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JPE: bad operands") -} - -// JPL: Jump if not sign (SF == 0). -// -// Forms: -// -// JPL rel8 -// JPL rel32 -func JPL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JPL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JPL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JPL: bad operands") -} - -// JPO: Jump if not parity (PF == 0). -// -// Forms: -// -// JPO rel8 -// JPO rel32 -func JPO(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JPO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JPO", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JPO: bad operands") -} - -// JPS: Jump if parity (PF == 1). -// -// Forms: -// -// JPS rel8 -// JPS rel32 -func JPS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JPS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JPS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JPS: bad operands") -} - -// JS: Jump if sign (SF == 1). -// -// Forms: -// -// JS rel8 -// JS rel32 -func JS(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JS", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JS: bad operands") -} - -// JZ: Jump if equal (ZF == 1). -// -// Forms: -// -// JZ rel8 -// JZ rel32 -func JZ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsREL8(r): - return &intrep.Instruction{ - Opcode: "JZ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - case operand.IsREL32(r): - return &intrep.Instruction{ - Opcode: "JZ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - IsBranch: true, - IsConditional: true, - }, nil - } - return nil, errors.New("JZ: bad operands") -} - -// LDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// LDDQU m128 xmm -func LDDQU(m, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "LDDQU", - Operands: []operand.Op{m, x}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("LDDQU: bad operands") -} - -// LDMXCSR: Load MXCSR Register. -// -// Forms: -// -// LDMXCSR m32 -func LDMXCSR(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(m): - return &intrep.Instruction{ - Opcode: "LDMXCSR", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("LDMXCSR: bad operands") -} - -// LEAL: Load Effective Address. -// -// Forms: -// -// LEAL m r32 -func LEAL(m, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM(m) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "LEAL", - Operands: []operand.Op{m, r}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LEAL: bad operands") -} - -// LEAQ: Load Effective Address. -// -// Forms: -// -// LEAQ m r64 -func LEAQ(m, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM(m) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "LEAQ", - Operands: []operand.Op{m, r}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LEAQ: bad operands") -} - -// LEAW: Load Effective Address. -// -// Forms: -// -// LEAW m r16 -func LEAW(m, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM(m) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "LEAW", - Operands: []operand.Op{m, r}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LEAW: bad operands") -} - -// LFENCE: Load Fence. -// -// Forms: -// -// LFENCE -func LFENCE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "LFENCE", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// LZCNTL: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTL r32 r32 -// LZCNTL m32 r32 -func LZCNTL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "LZCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "LZCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LZCNTL: bad operands") -} - -// LZCNTQ: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTQ r64 r64 -// LZCNTQ m64 r64 -func LZCNTQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "LZCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "LZCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LZCNTQ: bad operands") -} - -// LZCNTW: Count the Number of Leading Zero Bits. -// -// Forms: -// -// LZCNTW r16 r16 -// LZCNTW m16 r16 -func LZCNTW(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "LZCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "LZCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("LZCNTW: bad operands") -} - -// MASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVDQU xmm xmm -func MASKMOVDQU(x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "MASKMOVDQU", - Operands: []operand.Op{x, x1}, - Inputs: []operand.Op{x, x1, reg.RDI}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("MASKMOVDQU: bad operands") -} - -// MASKMOVOU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// MASKMOVOU xmm xmm -func MASKMOVOU(x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "MASKMOVOU", - Operands: []operand.Op{x, x1}, - Inputs: []operand.Op{x, x1, reg.RDI}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("MASKMOVOU: bad operands") -} - -// MAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MAXPD xmm xmm -// MAXPD m128 xmm -func MAXPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MAXPD: bad operands") -} - -// MAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MAXPS xmm xmm -// MAXPS m128 xmm -func MAXPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MAXPS: bad operands") -} - -// MAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MAXSD xmm xmm -// MAXSD m64 xmm -func MAXSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MAXSD: bad operands") -} - -// MAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MAXSS xmm xmm -// MAXSS m32 xmm -func MAXSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MAXSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MAXSS: bad operands") -} - -// MFENCE: Memory Fence. -// -// Forms: -// -// MFENCE -func MFENCE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "MFENCE", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// MINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MINPD xmm xmm -// MINPD m128 xmm -func MINPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MINPD: bad operands") -} - -// MINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MINPS xmm xmm -// MINPS m128 xmm -func MINPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MINPS: bad operands") -} - -// MINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MINSD xmm xmm -// MINSD m64 xmm -func MINSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MINSD: bad operands") -} - -// MINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// MINSS xmm xmm -// MINSS m32 xmm -func MINSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MINSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MINSS: bad operands") -} - -// MONITOR: Monitor a Linear Address Range. -// -// Forms: -// -// MONITOR -func MONITOR() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "MONITOR", - Operands: nil, - Inputs: []operand.Op{reg.RAX, reg.ECX, reg.EDX}, - Outputs: []operand.Op{}, - }, nil -} - -// MOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPD xmm xmm -// MOVAPD m128 xmm -// MOVAPD xmm m128 -func MOVAPD(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVAPD: bad operands") -} - -// MOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVAPS xmm xmm -// MOVAPS m128 xmm -// MOVAPS xmm m128 -func MOVAPS(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVAPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVAPS: bad operands") -} - -// MOVB: Move. -// -// Forms: -// -// MOVB imm8 r8 -// MOVB r8 r8 -// MOVB m8 r8 -// MOVB imm8 m8 -// MOVB r8 m8 -func MOVB(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "MOVB", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "MOVB", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "MOVB", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "MOVB", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "MOVB", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("MOVB: bad operands") -} - -// MOVBELL: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBELL m32 r32 -// MOVBELL r32 m32 -func MOVBELL(mr, mr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(mr) && operand.IsR32(mr1): - return &intrep.Instruction{ - Opcode: "MOVBELL", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - case operand.IsR32(mr) && operand.IsM32(mr1): - return &intrep.Instruction{ - Opcode: "MOVBELL", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - } - return nil, errors.New("MOVBELL: bad operands") -} - -// MOVBEQQ: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEQQ m64 r64 -// MOVBEQQ r64 m64 -func MOVBEQQ(mr, mr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(mr) && operand.IsR64(mr1): - return &intrep.Instruction{ - Opcode: "MOVBEQQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - case operand.IsR64(mr) && operand.IsM64(mr1): - return &intrep.Instruction{ - Opcode: "MOVBEQQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - } - return nil, errors.New("MOVBEQQ: bad operands") -} - -// MOVBEWW: Move Data After Swapping Bytes. -// -// Forms: -// -// MOVBEWW m16 r16 -// MOVBEWW r16 m16 -func MOVBEWW(mr, mr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM16(mr) && operand.IsR16(mr1): - return &intrep.Instruction{ - Opcode: "MOVBEWW", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - case operand.IsR16(mr) && operand.IsM16(mr1): - return &intrep.Instruction{ - Opcode: "MOVBEWW", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr1}, - }, nil - } - return nil, errors.New("MOVBEWW: bad operands") -} - -// MOVBLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBLSX r8 r32 -// MOVBLSX m8 r32 -func MOVBLSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVBLSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVBLSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBLSX: bad operands") -} - -// MOVBLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBLZX r8 r32 -// MOVBLZX m8 r32 -func MOVBLZX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVBLZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVBLZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBLZX: bad operands") -} - -// MOVBQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBQSX r8 r64 -// MOVBQSX m8 r64 -func MOVBQSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVBQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVBQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBQSX: bad operands") -} - -// MOVBQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBQZX r8 r64 -// MOVBQZX m8 r64 -func MOVBQZX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVBQZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVBQZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBQZX: bad operands") -} - -// MOVBWSX: Move with Sign-Extension. -// -// Forms: -// -// MOVBWSX r8 r16 -// MOVBWSX m8 r16 -func MOVBWSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "MOVBWSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "MOVBWSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBWSX: bad operands") -} - -// MOVBWZX: Move with Zero-Extend. -// -// Forms: -// -// MOVBWZX r8 r16 -// MOVBWZX m8 r16 -func MOVBWZX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "MOVBWZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM8(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "MOVBWZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVBWZX: bad operands") -} - -// MOVD: Move. -// -// Forms: -// -// MOVD imm32 r64 -// MOVD imm64 r64 -// MOVD r64 r64 -// MOVD m64 r64 -// MOVD imm32 m64 -// MOVD r64 m64 -// MOVD xmm r64 -// MOVD r64 xmm -// MOVD xmm xmm -// MOVD m64 xmm -// MOVD xmm m64 -// MOVD xmm r32 -// MOVD r32 xmm -// MOVD m32 xmm -// MOVD xmm m32 -func MOVD(imrx, mrx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM32(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR32(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM32(mrx): - return &intrep.Instruction{ - Opcode: "MOVD", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - } - return nil, errors.New("MOVD: bad operands") -} - -// MOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// MOVDDUP xmm xmm -// MOVDDUP m64 xmm -func MOVDDUP(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVDDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVDDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MOVDDUP: bad operands") -} - -// MOVDQ2Q: Move. -// -// Forms: -// -// MOVDQ2Q imm32 r64 -// MOVDQ2Q imm64 r64 -// MOVDQ2Q r64 r64 -// MOVDQ2Q m64 r64 -// MOVDQ2Q imm32 m64 -// MOVDQ2Q r64 m64 -// MOVDQ2Q xmm r64 -// MOVDQ2Q r64 xmm -// MOVDQ2Q xmm xmm -// MOVDQ2Q m64 xmm -// MOVDQ2Q xmm m64 -// MOVDQ2Q xmm r32 -// MOVDQ2Q r32 xmm -// MOVDQ2Q m32 xmm -// MOVDQ2Q xmm m32 -func MOVDQ2Q(imrx, mrx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM32(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR32(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM32(mrx): - return &intrep.Instruction{ - Opcode: "MOVDQ2Q", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - } - return nil, errors.New("MOVDQ2Q: bad operands") -} - -// MOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// MOVHLPS xmm xmm -func MOVHLPS(x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "MOVHLPS", - Operands: []operand.Op{x, x1}, - Inputs: []operand.Op{x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("MOVHLPS: bad operands") -} - -// MOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVHPD m64 xmm -// MOVHPD xmm m64 -func MOVHPD(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVHPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM64(mx1): - return &intrep.Instruction{ - Opcode: "MOVHPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVHPD: bad operands") -} - -// MOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVHPS m64 xmm -// MOVHPS xmm m64 -func MOVHPS(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVHPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM64(mx1): - return &intrep.Instruction{ - Opcode: "MOVHPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVHPS: bad operands") -} - -// MOVL: Move. -// -// Forms: -// -// MOVL imm32 r32 -// MOVL r32 r32 -// MOVL m32 r32 -// MOVL imm32 m32 -// MOVL r32 m32 -func MOVL(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "MOVL", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "MOVL", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "MOVL", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "MOVL", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "MOVL", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("MOVL: bad operands") -} - -// MOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// MOVLHPS xmm xmm -func MOVLHPS(x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "MOVLHPS", - Operands: []operand.Op{x, x1}, - Inputs: []operand.Op{x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("MOVLHPS: bad operands") -} - -// MOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVLPD m64 xmm -// MOVLPD xmm m64 -func MOVLPD(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVLPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM64(mx1): - return &intrep.Instruction{ - Opcode: "MOVLPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVLPD: bad operands") -} - -// MOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVLPS m64 xmm -// MOVLPS xmm m64 -func MOVLPS(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM64(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVLPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM64(mx1): - return &intrep.Instruction{ - Opcode: "MOVLPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVLPS: bad operands") -} - -// MOVLQSX: Move Doubleword to Quadword with Sign-Extension. -// -// Forms: -// -// MOVLQSX r32 r64 -// MOVLQSX m32 r64 -func MOVLQSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVLQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVLQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVLQSX: bad operands") -} - -// MOVLQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVLQZX m32 r64 -func MOVLQZX(m, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(m) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVLQZX", - Operands: []operand.Op{m, r}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVLQZX: bad operands") -} - -// MOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPD xmm r32 -func MOVMSKPD(x, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVMSKPD", - Operands: []operand.Op{x, r}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVMSKPD: bad operands") -} - -// MOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// MOVMSKPS xmm r32 -func MOVMSKPS(x, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVMSKPS", - Operands: []operand.Op{x, r}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVMSKPS: bad operands") -} - -// MOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTDQ xmm m128 -func MOVNTDQ(x, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "MOVNTDQ", - Operands: []operand.Op{x, m}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTDQ: bad operands") -} - -// MOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// MOVNTDQA m128 xmm -func MOVNTDQA(m, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVNTDQA", - Operands: []operand.Op{m, x}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MOVNTDQA: bad operands") -} - -// MOVNTIL: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIL r32 m32 -func MOVNTIL(r, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsM32(m): - return &intrep.Instruction{ - Opcode: "MOVNTIL", - Operands: []operand.Op{r, m}, - Inputs: []operand.Op{r}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTIL: bad operands") -} - -// MOVNTIQ: Store Doubleword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTIQ r64 m64 -func MOVNTIQ(r, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsM64(m): - return &intrep.Instruction{ - Opcode: "MOVNTIQ", - Operands: []operand.Op{r, m}, - Inputs: []operand.Op{r}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTIQ: bad operands") -} - -// MOVNTO: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTO xmm m128 -func MOVNTO(x, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "MOVNTO", - Operands: []operand.Op{x, m}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTO: bad operands") -} - -// MOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPD xmm m128 -func MOVNTPD(x, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "MOVNTPD", - Operands: []operand.Op{x, m}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTPD: bad operands") -} - -// MOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// MOVNTPS xmm m128 -func MOVNTPS(x, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "MOVNTPS", - Operands: []operand.Op{x, m}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("MOVNTPS: bad operands") -} - -// MOVO: Move Aligned Double Quadword. -// -// Forms: -// -// MOVO xmm xmm -// MOVO m128 xmm -// MOVO xmm m128 -func MOVO(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVO", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVO", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVO", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVO: bad operands") -} - -// MOVOA: Move Aligned Double Quadword. -// -// Forms: -// -// MOVOA xmm xmm -// MOVOA m128 xmm -// MOVOA xmm m128 -func MOVOA(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVOA", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVOA", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVOA", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVOA: bad operands") -} - -// MOVOU: Move Unaligned Double Quadword. -// -// Forms: -// -// MOVOU xmm xmm -// MOVOU m128 xmm -// MOVOU xmm m128 -func MOVOU(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVOU", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVOU", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVOU", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVOU: bad operands") -} - -// MOVQ: Move. -// -// Forms: -// -// MOVQ imm32 r64 -// MOVQ imm64 r64 -// MOVQ r64 r64 -// MOVQ m64 r64 -// MOVQ imm32 m64 -// MOVQ r64 m64 -// MOVQ xmm r64 -// MOVQ r64 xmm -// MOVQ xmm xmm -// MOVQ m64 xmm -// MOVQ xmm m64 -// MOVQ xmm r32 -// MOVQ r32 xmm -// MOVQ m32 xmm -// MOVQ xmm m32 -func MOVQ(imrx, mrx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsIMM32(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM64(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM64(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsR32(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsR32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsM32(imrx) && operand.IsXMM(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - case operand.IsXMM(imrx) && operand.IsM32(mrx): - return &intrep.Instruction{ - Opcode: "MOVQ", - Operands: []operand.Op{imrx, mrx}, - Inputs: []operand.Op{imrx}, - Outputs: []operand.Op{mrx}, - }, nil - } - return nil, errors.New("MOVQ: bad operands") -} - -// MOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// MOVSD xmm xmm -// MOVSD m64 xmm -// MOVSD xmm m64 -func MOVSD(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVSD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVSD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM64(mx1): - return &intrep.Instruction{ - Opcode: "MOVSD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVSD: bad operands") -} - -// MOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// MOVSHDUP xmm xmm -// MOVSHDUP m128 xmm -func MOVSHDUP(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVSHDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVSHDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MOVSHDUP: bad operands") -} - -// MOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// MOVSLDUP xmm xmm -// MOVSLDUP m128 xmm -func MOVSLDUP(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVSLDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MOVSLDUP", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MOVSLDUP: bad operands") -} - -// MOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVSS xmm xmm -// MOVSS m32 xmm -// MOVSS xmm m32 -func MOVSS(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVSS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx, mx1}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVSS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM32(mx1): - return &intrep.Instruction{ - Opcode: "MOVSS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVSS: bad operands") -} - -// MOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPD xmm xmm -// MOVUPD m128 xmm -// MOVUPD xmm m128 -func MOVUPD(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPD", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVUPD: bad operands") -} - -// MOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MOVUPS xmm xmm -// MOVUPS m128 xmm -// MOVUPS xmm m128 -func MOVUPS(mx, mx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - case operand.IsXMM(mx) && operand.IsM128(mx1): - return &intrep.Instruction{ - Opcode: "MOVUPS", - Operands: []operand.Op{mx, mx1}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{mx1}, - }, nil - } - return nil, errors.New("MOVUPS: bad operands") -} - -// MOVW: Move. -// -// Forms: -// -// MOVW imm16 r16 -// MOVW r16 r16 -// MOVW m16 r16 -// MOVW imm16 m16 -// MOVW r16 m16 -func MOVW(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "MOVW", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "MOVW", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "MOVW", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "MOVW", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "MOVW", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("MOVW: bad operands") -} - -// MOVWLSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWLSX r16 r32 -// MOVWLSX m16 r32 -func MOVWLSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVWLSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVWLSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVWLSX: bad operands") -} - -// MOVWLZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWLZX r16 r32 -// MOVWLZX m16 r32 -func MOVWLZX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVWLZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "MOVWLZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVWLZX: bad operands") -} - -// MOVWQSX: Move with Sign-Extension. -// -// Forms: -// -// MOVWQSX r16 r64 -// MOVWQSX m16 r64 -func MOVWQSX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVWQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVWQSX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVWQSX: bad operands") -} - -// MOVWQZX: Move with Zero-Extend. -// -// Forms: -// -// MOVWQZX r16 r64 -// MOVWQZX m16 r64 -func MOVWQZX(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVWQZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "MOVWQZX", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("MOVWQZX: bad operands") -} - -// MPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// MPSADBW imm8 xmm xmm -// MPSADBW imm8 m128 xmm -func MPSADBW(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MPSADBW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MPSADBW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MPSADBW: bad operands") -} - -// MULB: Unsigned Multiply. -// -// Forms: -// -// MULB r8 -// MULB m8 -func MULB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "MULB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AL}, - Outputs: []operand.Op{reg.AX}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "MULB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AL}, - Outputs: []operand.Op{reg.AX}, - }, nil - } - return nil, errors.New("MULB: bad operands") -} - -// MULL: Unsigned Multiply. -// -// Forms: -// -// MULL r32 -// MULL m32 -func MULL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "MULL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "MULL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.EAX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil - } - return nil, errors.New("MULL: bad operands") -} - -// MULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// MULPD xmm xmm -// MULPD m128 xmm -func MULPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MULPD: bad operands") -} - -// MULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// MULPS xmm xmm -// MULPS m128 xmm -func MULPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MULPS: bad operands") -} - -// MULQ: Unsigned Multiply. -// -// Forms: -// -// MULQ r64 -// MULQ m64 -func MULQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "MULQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "MULQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.RAX}, - Outputs: []operand.Op{reg.RAX, reg.RDX}, - }, nil - } - return nil, errors.New("MULQ: bad operands") -} - -// MULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// MULSD xmm xmm -// MULSD m64 xmm -func MULSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MULSD: bad operands") -} - -// MULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// MULSS xmm xmm -// MULSS m32 xmm -func MULSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "MULSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("MULSS: bad operands") -} - -// MULW: Unsigned Multiply. -// -// Forms: -// -// MULW r16 -// MULW m16 -func MULW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "MULW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "MULW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr, reg.AX}, - Outputs: []operand.Op{reg.AX, reg.DX}, - }, nil - } - return nil, errors.New("MULW: bad operands") -} - -// MULXL: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXL r32 r32 r32 -// MULXL m32 r32 r32 -func MULXL(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "MULXL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, reg.EDX}, - Outputs: []operand.Op{r, r1}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "MULXL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, reg.EDX}, - Outputs: []operand.Op{r, r1}, - }, nil - } - return nil, errors.New("MULXL: bad operands") -} - -// MULXQ: Unsigned Multiply Without Affecting Flags. -// -// Forms: -// -// MULXQ r64 r64 r64 -// MULXQ m64 r64 r64 -func MULXQ(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "MULXQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, reg.RDX}, - Outputs: []operand.Op{r, r1}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "MULXQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, reg.RDX}, - Outputs: []operand.Op{r, r1}, - }, nil - } - return nil, errors.New("MULXQ: bad operands") -} - -// MWAIT: Monitor Wait. -// -// Forms: -// -// MWAIT -func MWAIT() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "MWAIT", - Operands: nil, - Inputs: []operand.Op{reg.EAX, reg.ECX}, - Outputs: []operand.Op{}, - }, nil -} - -// NEGB: Two's Complement Negation. -// -// Forms: -// -// NEGB r8 -// NEGB m8 -func NEGB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "NEGB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "NEGB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NEGB: bad operands") -} - -// NEGL: Two's Complement Negation. -// -// Forms: -// -// NEGL r32 -// NEGL m32 -func NEGL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "NEGL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "NEGL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NEGL: bad operands") -} - -// NEGQ: Two's Complement Negation. -// -// Forms: -// -// NEGQ r64 -// NEGQ m64 -func NEGQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "NEGQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "NEGQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NEGQ: bad operands") -} - -// NEGW: Two's Complement Negation. -// -// Forms: -// -// NEGW r16 -// NEGW m16 -func NEGW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "NEGW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "NEGW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NEGW: bad operands") -} - -// NOP: No Operation. -// -// Forms: -// -// NOP -func NOP() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "NOP", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// NOTB: One's Complement Negation. -// -// Forms: -// -// NOTB r8 -// NOTB m8 -func NOTB(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "NOTB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "NOTB", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NOTB: bad operands") -} - -// NOTL: One's Complement Negation. -// -// Forms: -// -// NOTL r32 -// NOTL m32 -func NOTL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "NOTL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "NOTL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NOTL: bad operands") -} - -// NOTQ: One's Complement Negation. -// -// Forms: -// -// NOTQ r64 -// NOTQ m64 -func NOTQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "NOTQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "NOTQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NOTQ: bad operands") -} - -// NOTW: One's Complement Negation. -// -// Forms: -// -// NOTW r16 -// NOTW m16 -func NOTW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "NOTW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "NOTW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("NOTW: bad operands") -} - -// ORB: Logical Inclusive OR. -// -// Forms: -// -// ORB imm8 al -// ORB imm8 r8 -// ORB r8 r8 -// ORB m8 r8 -// ORB imm8 m8 -// ORB r8 m8 -func ORB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "ORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ORB: bad operands") -} - -// ORL: Logical Inclusive OR. -// -// Forms: -// -// ORL imm32 eax -// ORL imm8 r32 -// ORL imm32 r32 -// ORL r32 r32 -// ORL m32 r32 -// ORL imm8 m32 -// ORL imm32 m32 -// ORL r32 m32 -func ORL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "ORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("ORL: bad operands") -} - -// ORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// ORPD xmm xmm -// ORPD m128 xmm -func ORPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ORPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ORPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ORPD: bad operands") -} - -// ORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// ORPS xmm xmm -// ORPS m128 xmm -func ORPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ORPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ORPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ORPS: bad operands") -} - -// ORQ: Logical Inclusive OR. -// -// Forms: -// -// ORQ imm32 rax -// ORQ imm8 r64 -// ORQ imm32 r64 -// ORQ r64 r64 -// ORQ m64 r64 -// ORQ imm8 m64 -// ORQ imm32 m64 -// ORQ r64 m64 -func ORQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ORQ: bad operands") -} - -// ORW: Logical Inclusive OR. -// -// Forms: -// -// ORW imm16 ax -// ORW imm8 r16 -// ORW imm16 r16 -// ORW r16 r16 -// ORW m16 r16 -// ORW imm8 m16 -// ORW imm16 m16 -// ORW r16 m16 -func ORW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "ORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("ORW: bad operands") -} - -// PABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// PABSB xmm xmm -// PABSB m128 xmm -func PABSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PABSB: bad operands") -} - -// PABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// PABSD xmm xmm -// PABSD m128 xmm -func PABSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PABSD: bad operands") -} - -// PABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// PABSW xmm xmm -// PABSW m128 xmm -func PABSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PABSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PABSW: bad operands") -} - -// PACKSSLW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// PACKSSLW xmm xmm -// PACKSSLW m128 xmm -func PACKSSLW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKSSLW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKSSLW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PACKSSLW: bad operands") -} - -// PACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// PACKSSWB xmm xmm -// PACKSSWB m128 xmm -func PACKSSWB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKSSWB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKSSWB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PACKSSWB: bad operands") -} - -// PACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// PACKUSDW xmm xmm -// PACKUSDW m128 xmm -func PACKUSDW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKUSDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKUSDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PACKUSDW: bad operands") -} - -// PACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// PACKUSWB xmm xmm -// PACKUSWB m128 xmm -func PACKUSWB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKUSWB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PACKUSWB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PACKUSWB: bad operands") -} - -// PADDB: Add Packed Byte Integers. -// -// Forms: -// -// PADDB xmm xmm -// PADDB m128 xmm -func PADDB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDB: bad operands") -} - -// PADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDD xmm xmm -// PADDD m128 xmm -func PADDD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDD: bad operands") -} - -// PADDL: Add Packed Doubleword Integers. -// -// Forms: -// -// PADDL xmm xmm -// PADDL m128 xmm -func PADDL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDL: bad operands") -} - -// PADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// PADDQ xmm xmm -// PADDQ m128 xmm -func PADDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDQ: bad operands") -} - -// PADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PADDSB xmm xmm -// PADDSB m128 xmm -func PADDSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDSB: bad operands") -} - -// PADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PADDSW xmm xmm -// PADDSW m128 xmm -func PADDSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDSW: bad operands") -} - -// PADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSB xmm xmm -// PADDUSB m128 xmm -func PADDUSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDUSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDUSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDUSB: bad operands") -} - -// PADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PADDUSW xmm xmm -// PADDUSW m128 xmm -func PADDUSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDUSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDUSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDUSW: bad operands") -} - -// PADDW: Add Packed Word Integers. -// -// Forms: -// -// PADDW xmm xmm -// PADDW m128 xmm -func PADDW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PADDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PADDW: bad operands") -} - -// PALIGNR: Packed Align Right. -// -// Forms: -// -// PALIGNR imm8 xmm xmm -// PALIGNR imm8 m128 xmm -func PALIGNR(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PALIGNR", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PALIGNR", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PALIGNR: bad operands") -} - -// PAND: Packed Bitwise Logical AND. -// -// Forms: -// -// PAND xmm xmm -// PAND m128 xmm -func PAND(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAND", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAND", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PAND: bad operands") -} - -// PANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// PANDN xmm xmm -// PANDN m128 xmm -func PANDN(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PANDN", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PANDN", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PANDN: bad operands") -} - -// PAUSE: Spin Loop Hint. -// -// Forms: -// -// PAUSE -func PAUSE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "PAUSE", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// PAVGB: Average Packed Byte Integers. -// -// Forms: -// -// PAVGB xmm xmm -// PAVGB m128 xmm -func PAVGB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAVGB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAVGB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PAVGB: bad operands") -} - -// PAVGW: Average Packed Word Integers. -// -// Forms: -// -// PAVGW xmm xmm -// PAVGW m128 xmm -func PAVGW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAVGW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PAVGW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PAVGW: bad operands") -} - -// PBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// PBLENDVB xmm0 xmm xmm -// PBLENDVB xmm0 m128 xmm -func PBLENDVB(x, mx, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM0(x) && operand.IsXMM(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "PBLENDVB", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsXMM0(x) && operand.IsM128(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "PBLENDVB", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("PBLENDVB: bad operands") -} - -// PBLENDW: Blend Packed Words. -// -// Forms: -// -// PBLENDW imm8 xmm xmm -// PBLENDW imm8 m128 xmm -func PBLENDW(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PBLENDW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PBLENDW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PBLENDW: bad operands") -} - -// PCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// PCLMULQDQ imm8 xmm xmm -// PCLMULQDQ imm8 m128 xmm -func PCLMULQDQ(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCLMULQDQ", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCLMULQDQ", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCLMULQDQ: bad operands") -} - -// PCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// PCMPEQB xmm xmm -// PCMPEQB m128 xmm -func PCMPEQB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPEQB: bad operands") -} - -// PCMPEQL: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// PCMPEQL xmm xmm -// PCMPEQL m128 xmm -func PCMPEQL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPEQL: bad operands") -} - -// PCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// PCMPEQQ xmm xmm -// PCMPEQQ m128 xmm -func PCMPEQQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPEQQ: bad operands") -} - -// PCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// PCMPEQW xmm xmm -// PCMPEQW m128 xmm -func PCMPEQW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPEQW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPEQW: bad operands") -} - -// PCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// PCMPESTRI imm8 xmm xmm -// PCMPESTRI imm8 m128 xmm -func PCMPESTRI(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPESTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.ECX}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPESTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.ECX}, - }, nil - } - return nil, errors.New("PCMPESTRI: bad operands") -} - -// PCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPESTRM imm8 xmm xmm -// PCMPESTRM imm8 m128 xmm -func PCMPESTRM(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPESTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.X0}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPESTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.X0}, - }, nil - } - return nil, errors.New("PCMPESTRM: bad operands") -} - -// PCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// PCMPGTB xmm xmm -// PCMPGTB m128 xmm -func PCMPGTB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPGTB: bad operands") -} - -// PCMPGTL: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// PCMPGTL xmm xmm -// PCMPGTL m128 xmm -func PCMPGTL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPGTL: bad operands") -} - -// PCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// PCMPGTQ xmm xmm -// PCMPGTQ m128 xmm -func PCMPGTQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPGTQ: bad operands") -} - -// PCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// PCMPGTW xmm xmm -// PCMPGTW m128 xmm -func PCMPGTW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPGTW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PCMPGTW: bad operands") -} - -// PCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// PCMPISTRI imm8 xmm xmm -// PCMPISTRI imm8 m128 xmm -func PCMPISTRI(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPISTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.ECX}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPISTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.ECX}, - }, nil - } - return nil, errors.New("PCMPISTRI: bad operands") -} - -// PCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// PCMPISTRM imm8 xmm xmm -// PCMPISTRM imm8 m128 xmm -func PCMPISTRM(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPISTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.X0}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PCMPISTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.X0}, - }, nil - } - return nil, errors.New("PCMPISTRM: bad operands") -} - -// PDEPL: Parallel Bits Deposit. -// -// Forms: -// -// PDEPL r32 r32 r32 -// PDEPL m32 r32 r32 -func PDEPL(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "PDEPL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "PDEPL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("PDEPL: bad operands") -} - -// PDEPQ: Parallel Bits Deposit. -// -// Forms: -// -// PDEPQ r64 r64 r64 -// PDEPQ m64 r64 r64 -func PDEPQ(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "PDEPQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "PDEPQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("PDEPQ: bad operands") -} - -// PEXTL: Parallel Bits Extract. -// -// Forms: -// -// PEXTL r32 r32 r32 -// PEXTL m32 r32 r32 -func PEXTL(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "PEXTL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "PEXTL", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("PEXTL: bad operands") -} - -// PEXTQ: Parallel Bits Extract. -// -// Forms: -// -// PEXTQ r64 r64 r64 -// PEXTQ m64 r64 r64 -func PEXTQ(mr, r, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "PEXTQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "PEXTQ", - Operands: []operand.Op{mr, r, r1}, - Inputs: []operand.Op{mr, r}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("PEXTQ: bad operands") -} - -// PEXTRB: Extract Byte. -// -// Forms: -// -// PEXTRB imm8 xmm r32 -// PEXTRB imm8 xmm m8 -func PEXTRB(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "PEXTRB", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "PEXTRB", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("PEXTRB: bad operands") -} - -// PEXTRD: Extract Doubleword. -// -// Forms: -// -// PEXTRD imm8 xmm r32 -// PEXTRD imm8 xmm m32 -func PEXTRD(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "PEXTRD", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "PEXTRD", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("PEXTRD: bad operands") -} - -// PEXTRQ: Extract Quadword. -// -// Forms: -// -// PEXTRQ imm8 xmm r64 -// PEXTRQ imm8 xmm m64 -func PEXTRQ(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "PEXTRQ", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "PEXTRQ", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("PEXTRQ: bad operands") -} - -// PEXTRW: Extract Word. -// -// Forms: -// -// PEXTRW imm8 xmm r32 -// PEXTRW imm8 xmm m16 -func PEXTRW(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "PEXTRW", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "PEXTRW", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("PEXTRW: bad operands") -} - -// PHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// PHADDD xmm xmm -// PHADDD m128 xmm -func PHADDD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHADDD: bad operands") -} - -// PHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHADDSW xmm xmm -// PHADDSW m128 xmm -func PHADDSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHADDSW: bad operands") -} - -// PHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// PHADDW xmm xmm -// PHADDW m128 xmm -func PHADDW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHADDW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHADDW: bad operands") -} - -// PHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// PHMINPOSUW xmm xmm -// PHMINPOSUW m128 xmm -func PHMINPOSUW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHMINPOSUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHMINPOSUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHMINPOSUW: bad operands") -} - -// PHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// PHSUBD xmm xmm -// PHSUBD m128 xmm -func PHSUBD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHSUBD: bad operands") -} - -// PHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PHSUBSW xmm xmm -// PHSUBSW m128 xmm -func PHSUBSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHSUBSW: bad operands") -} - -// PHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// PHSUBW xmm xmm -// PHSUBW m128 xmm -func PHSUBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PHSUBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PHSUBW: bad operands") -} - -// PINSRB: Insert Byte. -// -// Forms: -// -// PINSRB imm8 r32 xmm -// PINSRB imm8 m8 xmm -func PINSRB(i, mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRB", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM8(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRB", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PINSRB: bad operands") -} - -// PINSRD: Insert Doubleword. -// -// Forms: -// -// PINSRD imm8 r32 xmm -// PINSRD imm8 m32 xmm -func PINSRD(i, mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRD", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRD", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PINSRD: bad operands") -} - -// PINSRQ: Insert Quadword. -// -// Forms: -// -// PINSRQ imm8 r64 xmm -// PINSRQ imm8 m64 xmm -func PINSRQ(i, mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRQ", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRQ", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PINSRQ: bad operands") -} - -// PINSRW: Insert Word. -// -// Forms: -// -// PINSRW imm8 r32 xmm -// PINSRW imm8 m16 xmm -func PINSRW(i, mr, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRW", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM16(mr) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PINSRW", - Operands: []operand.Op{i, mr, x}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PINSRW: bad operands") -} - -// PMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// PMADDUBSW xmm xmm -// PMADDUBSW m128 xmm -func PMADDUBSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMADDUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMADDUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMADDUBSW: bad operands") -} - -// PMADDWL: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// PMADDWL xmm xmm -// PMADDWL m128 xmm -func PMADDWL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMADDWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMADDWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMADDWL: bad operands") -} - -// PMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// PMAXSB xmm xmm -// PMAXSB m128 xmm -func PMAXSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXSB: bad operands") -} - -// PMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMAXSD xmm xmm -// PMAXSD m128 xmm -func PMAXSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXSD: bad operands") -} - -// PMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// PMAXSW xmm xmm -// PMAXSW m128 xmm -func PMAXSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXSW: bad operands") -} - -// PMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMAXUB xmm xmm -// PMAXUB m128 xmm -func PMAXUB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXUB: bad operands") -} - -// PMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMAXUD xmm xmm -// PMAXUD m128 xmm -func PMAXUD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXUD: bad operands") -} - -// PMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMAXUW xmm xmm -// PMAXUW m128 xmm -func PMAXUW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMAXUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMAXUW: bad operands") -} - -// PMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// PMINSB xmm xmm -// PMINSB m128 xmm -func PMINSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINSB: bad operands") -} - -// PMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// PMINSD xmm xmm -// PMINSD m128 xmm -func PMINSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINSD: bad operands") -} - -// PMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// PMINSW xmm xmm -// PMINSW m128 xmm -func PMINSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINSW: bad operands") -} - -// PMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// PMINUB xmm xmm -// PMINUB m128 xmm -func PMINUB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINUB: bad operands") -} - -// PMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMINUD xmm xmm -// PMINUD m128 xmm -func PMINUD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINUD: bad operands") -} - -// PMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// PMINUW xmm xmm -// PMINUW m128 xmm -func PMINUW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMINUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMINUW: bad operands") -} - -// PMOVMSKB: Move Byte Mask. -// -// Forms: -// -// PMOVMSKB xmm r32 -func PMOVMSKB(x, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "PMOVMSKB", - Operands: []operand.Op{x, r}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("PMOVMSKB: bad operands") -} - -// PMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBD xmm xmm -// PMOVSXBD m32 xmm -func PMOVSXBD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXBD: bad operands") -} - -// PMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBQ xmm xmm -// PMOVSXBQ m16 xmm -func PMOVSXBQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM16(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXBQ: bad operands") -} - -// PMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// PMOVSXBW xmm xmm -// PMOVSXBW m64 xmm -func PMOVSXBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXBW: bad operands") -} - -// PMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXDQ xmm xmm -// PMOVSXDQ m64 xmm -func PMOVSXDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXDQ: bad operands") -} - -// PMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWD xmm xmm -// PMOVSXWD m64 xmm -func PMOVSXWD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXWD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXWD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXWD: bad operands") -} - -// PMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// PMOVSXWQ xmm xmm -// PMOVSXWQ m32 xmm -func PMOVSXWQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXWQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVSXWQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVSXWQ: bad operands") -} - -// PMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBD xmm xmm -// PMOVZXBD m32 xmm -func PMOVZXBD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXBD: bad operands") -} - -// PMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBQ xmm xmm -// PMOVZXBQ m16 xmm -func PMOVZXBQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM16(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXBQ: bad operands") -} - -// PMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// PMOVZXBW xmm xmm -// PMOVZXBW m64 xmm -func PMOVZXBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXBW: bad operands") -} - -// PMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXDQ xmm xmm -// PMOVZXDQ m64 xmm -func PMOVZXDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXDQ: bad operands") -} - -// PMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWD xmm xmm -// PMOVZXWD m64 xmm -func PMOVZXWD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXWD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXWD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXWD: bad operands") -} - -// PMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// PMOVZXWQ xmm xmm -// PMOVZXWQ m32 xmm -func PMOVZXWQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXWQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMOVZXWQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMOVZXWQ: bad operands") -} - -// PMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// PMULDQ xmm xmm -// PMULDQ m128 xmm -func PMULDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULDQ: bad operands") -} - -// PMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// PMULHRSW xmm xmm -// PMULHRSW m128 xmm -func PMULHRSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHRSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHRSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULHRSW: bad operands") -} - -// PMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// PMULHUW xmm xmm -// PMULHUW m128 xmm -func PMULHUW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULHUW: bad operands") -} - -// PMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// PMULHW xmm xmm -// PMULHW m128 xmm -func PMULHW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULHW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULHW: bad operands") -} - -// PMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// PMULLD xmm xmm -// PMULLD m128 xmm -func PMULLD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULLD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULLD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULLD: bad operands") -} - -// PMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// PMULLW xmm xmm -// PMULLW m128 xmm -func PMULLW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULLW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULLW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULLW: bad operands") -} - -// PMULULQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// PMULULQ xmm xmm -// PMULULQ m128 xmm -func PMULULQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULULQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PMULULQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PMULULQ: bad operands") -} - -// POPCNTL: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTL r32 r32 -// POPCNTL m32 r32 -func POPCNTL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "POPCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "POPCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("POPCNTL: bad operands") -} - -// POPCNTQ: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTQ r64 r64 -// POPCNTQ m64 r64 -func POPCNTQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "POPCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "POPCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("POPCNTQ: bad operands") -} - -// POPCNTW: Count of Number of Bits Set to 1. -// -// Forms: -// -// POPCNTW r16 r16 -// POPCNTW m16 r16 -func POPCNTW(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "POPCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "POPCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("POPCNTW: bad operands") -} - -// POPQ: Pop a Value from the Stack. -// -// Forms: -// -// POPQ r64 -// POPQ m64 -func POPQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "POPQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "POPQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("POPQ: bad operands") -} - -// POPW: Pop a Value from the Stack. -// -// Forms: -// -// POPW r16 -// POPW m16 -func POPW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "POPW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "POPW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("POPW: bad operands") -} - -// POR: Packed Bitwise Logical OR. -// -// Forms: -// -// POR xmm xmm -// POR m128 xmm -func POR(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "POR", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "POR", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("POR: bad operands") -} - -// PREFETCHNTA: Prefetch Data Into Caches using NTA Hint. -// -// Forms: -// -// PREFETCHNTA m8 -func PREFETCHNTA(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "PREFETCHNTA", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PREFETCHNTA: bad operands") -} - -// PREFETCHT0: Prefetch Data Into Caches using T0 Hint. -// -// Forms: -// -// PREFETCHT0 m8 -func PREFETCHT0(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "PREFETCHT0", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PREFETCHT0: bad operands") -} - -// PREFETCHT1: Prefetch Data Into Caches using T1 Hint. -// -// Forms: -// -// PREFETCHT1 m8 -func PREFETCHT1(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "PREFETCHT1", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PREFETCHT1: bad operands") -} - -// PREFETCHT2: Prefetch Data Into Caches using T2 Hint. -// -// Forms: -// -// PREFETCHT2 m8 -func PREFETCHT2(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM8(m): - return &intrep.Instruction{ - Opcode: "PREFETCHT2", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PREFETCHT2: bad operands") -} - -// PSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// PSADBW xmm xmm -// PSADBW m128 xmm -func PSADBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSADBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSADBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSADBW: bad operands") -} - -// PSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// PSHUFB xmm xmm -// PSHUFB m128 xmm -func PSHUFB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSHUFB: bad operands") -} - -// PSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFD imm8 xmm xmm -// PSHUFD imm8 m128 xmm -func PSHUFD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSHUFD: bad operands") -} - -// PSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// PSHUFHW imm8 xmm xmm -// PSHUFHW imm8 m128 xmm -func PSHUFHW(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFHW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFHW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSHUFHW: bad operands") -} - -// PSHUFL: Shuffle Packed Doublewords. -// -// Forms: -// -// PSHUFL imm8 xmm xmm -// PSHUFL imm8 m128 xmm -func PSHUFL(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFL", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFL", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSHUFL: bad operands") -} - -// PSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// PSHUFLW imm8 xmm xmm -// PSHUFLW imm8 m128 xmm -func PSHUFLW(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFLW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSHUFLW", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSHUFLW: bad operands") -} - -// PSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// PSIGNB xmm xmm -// PSIGNB m128 xmm -func PSIGNB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGNB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGNB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSIGNB: bad operands") -} - -// PSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// PSIGND xmm xmm -// PSIGND m128 xmm -func PSIGND(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGND", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGND", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSIGND: bad operands") -} - -// PSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// PSIGNW xmm xmm -// PSIGNW m128 xmm -func PSIGNW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGNW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSIGNW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSIGNW: bad operands") -} - -// PSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLDQ imm8 xmm -func PSLLDQ(i, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLDQ", - Operands: []operand.Op{i, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSLLDQ: bad operands") -} - -// PSLLL: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// PSLLL imm8 xmm -// PSLLL xmm xmm -// PSLLL m128 xmm -func PSLLL(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSLLL: bad operands") -} - -// PSLLO: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// PSLLO imm8 xmm -func PSLLO(i, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLO", - Operands: []operand.Op{i, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSLLO: bad operands") -} - -// PSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// PSLLQ imm8 xmm -// PSLLQ xmm xmm -// PSLLQ m128 xmm -func PSLLQ(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSLLQ: bad operands") -} - -// PSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// PSLLW imm8 xmm -// PSLLW xmm xmm -// PSLLW m128 xmm -func PSLLW(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSLLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSLLW: bad operands") -} - -// PSRAL: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// PSRAL imm8 xmm -// PSRAL xmm xmm -// PSRAL m128 xmm -func PSRAL(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRAL: bad operands") -} - -// PSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// PSRAW imm8 xmm -// PSRAW xmm xmm -// PSRAW m128 xmm -func PSRAW(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRAW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRAW: bad operands") -} - -// PSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLDQ imm8 xmm -func PSRLDQ(i, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLDQ", - Operands: []operand.Op{i, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRLDQ: bad operands") -} - -// PSRLL: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// PSRLL imm8 xmm -// PSRLL xmm xmm -// PSRLL m128 xmm -func PSRLL(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLL", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRLL: bad operands") -} - -// PSRLO: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// PSRLO imm8 xmm -func PSRLO(i, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLO", - Operands: []operand.Op{i, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRLO: bad operands") -} - -// PSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// PSRLQ imm8 xmm -// PSRLQ xmm xmm -// PSRLQ m128 xmm -func PSRLQ(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLQ", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRLQ: bad operands") -} - -// PSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// PSRLW imm8 xmm -// PSRLW xmm xmm -// PSRLW m128 xmm -func PSRLW(imx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSRLW", - Operands: []operand.Op{imx, x}, - Inputs: []operand.Op{imx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSRLW: bad operands") -} - -// PSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// PSUBB xmm xmm -// PSUBB m128 xmm -func PSUBB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBB: bad operands") -} - -// PSUBL: Subtract Packed Doubleword Integers. -// -// Forms: -// -// PSUBL xmm xmm -// PSUBL m128 xmm -func PSUBL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBL: bad operands") -} - -// PSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// PSUBQ xmm xmm -// PSUBQ m128 xmm -func PSUBQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBQ: bad operands") -} - -// PSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// PSUBSB xmm xmm -// PSUBSB m128 xmm -func PSUBSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBSB: bad operands") -} - -// PSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// PSUBSW xmm xmm -// PSUBSW m128 xmm -func PSUBSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBSW: bad operands") -} - -// PSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSB xmm xmm -// PSUBUSB m128 xmm -func PSUBUSB(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBUSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBUSB", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBUSB: bad operands") -} - -// PSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// PSUBUSW xmm xmm -// PSUBUSW m128 xmm -func PSUBUSW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBUSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBUSW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBUSW: bad operands") -} - -// PSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// PSUBW xmm xmm -// PSUBW m128 xmm -func PSUBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PSUBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PSUBW: bad operands") -} - -// PTEST: Packed Logical Compare. -// -// Forms: -// -// PTEST xmm xmm -// PTEST m128 xmm -func PTEST(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PTEST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PTEST", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PTEST: bad operands") -} - -// PUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// PUNPCKHBW xmm xmm -// PUNPCKHBW m128 xmm -func PUNPCKHBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKHBW: bad operands") -} - -// PUNPCKHLQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKHLQ xmm xmm -// PUNPCKHLQ m128 xmm -func PUNPCKHLQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHLQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHLQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKHLQ: bad operands") -} - -// PUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKHQDQ xmm xmm -// PUNPCKHQDQ m128 xmm -func PUNPCKHQDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHQDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHQDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKHQDQ: bad operands") -} - -// PUNPCKHWL: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKHWL xmm xmm -// PUNPCKHWL m128 xmm -func PUNPCKHWL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKHWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKHWL: bad operands") -} - -// PUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// PUNPCKLBW xmm xmm -// PUNPCKLBW m128 xmm -func PUNPCKLBW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLBW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKLBW: bad operands") -} - -// PUNPCKLLQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// PUNPCKLLQ xmm xmm -// PUNPCKLLQ m128 xmm -func PUNPCKLLQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLLQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLLQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKLLQ: bad operands") -} - -// PUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// PUNPCKLQDQ xmm xmm -// PUNPCKLQDQ m128 xmm -func PUNPCKLQDQ(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLQDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLQDQ", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKLQDQ: bad operands") -} - -// PUNPCKLWL: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// PUNPCKLWL xmm xmm -// PUNPCKLWL m128 xmm -func PUNPCKLWL(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PUNPCKLWL", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PUNPCKLWL: bad operands") -} - -// PUSHQ: Push Value Onto the Stack. -// -// Forms: -// -// PUSHQ imm8 -// PUSHQ imm32 -// PUSHQ r64 -// PUSHQ m64 -func PUSHQ(imr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr): - return &intrep.Instruction{ - Opcode: "PUSHQ", - Operands: []operand.Op{imr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM32(imr): - return &intrep.Instruction{ - Opcode: "PUSHQ", - Operands: []operand.Op{imr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(imr): - return &intrep.Instruction{ - Opcode: "PUSHQ", - Operands: []operand.Op{imr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(imr): - return &intrep.Instruction{ - Opcode: "PUSHQ", - Operands: []operand.Op{imr}, - Inputs: []operand.Op{imr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PUSHQ: bad operands") -} - -// PUSHW: Push Value Onto the Stack. -// -// Forms: -// -// PUSHW r16 -// PUSHW m16 -func PUSHW(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "PUSHW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "PUSHW", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("PUSHW: bad operands") -} - -// PXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// PXOR xmm xmm -// PXOR m128 xmm -func PXOR(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PXOR", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "PXOR", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("PXOR: bad operands") -} - -// RCLB: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLB 1 r8 -// RCLB imm8 r8 -// RCLB cl r8 -// RCLB 1 m8 -// RCLB imm8 m8 -// RCLB cl m8 -func RCLB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCLB: bad operands") -} - -// RCLL: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLL 1 r32 -// RCLL imm8 r32 -// RCLL cl r32 -// RCLL 1 m32 -// RCLL imm8 m32 -// RCLL cl m32 -func RCLL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCLL: bad operands") -} - -// RCLQ: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLQ 1 r64 -// RCLQ imm8 r64 -// RCLQ cl r64 -// RCLQ 1 m64 -// RCLQ imm8 m64 -// RCLQ cl m64 -func RCLQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCLQ: bad operands") -} - -// RCLW: Rotate Left through Carry Flag. -// -// Forms: -// -// RCLW 1 r16 -// RCLW imm8 r16 -// RCLW cl r16 -// RCLW 1 m16 -// RCLW imm8 m16 -// RCLW cl m16 -func RCLW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCLW: bad operands") -} - -// RCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPPS xmm xmm -// RCPPS m128 xmm -func RCPPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RCPPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RCPPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("RCPPS: bad operands") -} - -// RCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// RCPSS xmm xmm -// RCPSS m32 xmm -func RCPSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RCPSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RCPSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("RCPSS: bad operands") -} - -// RCRB: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRB 1 r8 -// RCRB imm8 r8 -// RCRB cl r8 -// RCRB 1 m8 -// RCRB imm8 m8 -// RCRB cl m8 -func RCRB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RCRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCRB: bad operands") -} - -// RCRL: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRL 1 r32 -// RCRL imm8 r32 -// RCRL cl r32 -// RCRL 1 m32 -// RCRL imm8 m32 -// RCRL cl m32 -func RCRL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RCRL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCRL: bad operands") -} - -// RCRQ: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRQ 1 r64 -// RCRQ imm8 r64 -// RCRQ cl r64 -// RCRQ 1 m64 -// RCRQ imm8 m64 -// RCRQ cl m64 -func RCRQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RCRQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCRQ: bad operands") -} - -// RCRW: Rotate Right through Carry Flag. -// -// Forms: -// -// RCRW 1 r16 -// RCRW imm8 r16 -// RCRW cl r16 -// RCRW 1 m16 -// RCRW imm8 m16 -// RCRW cl m16 -func RCRW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RCRW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RCRW: bad operands") -} - -// RDRANDL: Read Random Number. -// -// Forms: -// -// RDRANDL r32 -func RDRANDL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "RDRANDL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDRANDL: bad operands") -} - -// RDRANDQ: Read Random Number. -// -// Forms: -// -// RDRANDQ r64 -func RDRANDQ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "RDRANDQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDRANDQ: bad operands") -} - -// RDRANDW: Read Random Number. -// -// Forms: -// -// RDRANDW r16 -func RDRANDW(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "RDRANDW", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDRANDW: bad operands") -} - -// RDSEEDL: Read Random SEED. -// -// Forms: -// -// RDSEEDL r32 -func RDSEEDL(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "RDSEEDL", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDSEEDL: bad operands") -} - -// RDSEEDQ: Read Random SEED. -// -// Forms: -// -// RDSEEDQ r64 -func RDSEEDQ(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "RDSEEDQ", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDSEEDQ: bad operands") -} - -// RDSEEDW: Read Random SEED. -// -// Forms: -// -// RDSEEDW r16 -func RDSEEDW(r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "RDSEEDW", - Operands: []operand.Op{r}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RDSEEDW: bad operands") -} - -// RDTSC: Read Time-Stamp Counter. -// -// Forms: -// -// RDTSC -func RDTSC() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "RDTSC", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil -} - -// RDTSCP: Read Time-Stamp Counter and Processor ID. -// -// Forms: -// -// RDTSCP -func RDTSCP() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "RDTSCP", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{reg.EAX, reg.ECX, reg.EDX}, - }, nil -} - -// RET: Return from Procedure. -// -// Forms: -// -// RET -func RET() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "RET", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// RETFL: Return from Procedure. -// -// Forms: -// -// RETFL imm16 -func RETFL(i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(i): - return &intrep.Instruction{ - Opcode: "RETFL", - Operands: []operand.Op{i}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("RETFL: bad operands") -} - -// RETFQ: Return from Procedure. -// -// Forms: -// -// RETFQ imm16 -func RETFQ(i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(i): - return &intrep.Instruction{ - Opcode: "RETFQ", - Operands: []operand.Op{i}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("RETFQ: bad operands") -} - -// RETFW: Return from Procedure. -// -// Forms: -// -// RETFW imm16 -func RETFW(i operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(i): - return &intrep.Instruction{ - Opcode: "RETFW", - Operands: []operand.Op{i}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("RETFW: bad operands") -} - -// ROLB: Rotate Left. -// -// Forms: -// -// ROLB 1 r8 -// ROLB imm8 r8 -// ROLB cl r8 -// ROLB 1 m8 -// ROLB imm8 m8 -// ROLB cl m8 -func ROLB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "ROLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ROLB: bad operands") -} - -// ROLL: Rotate Left. -// -// Forms: -// -// ROLL 1 r32 -// ROLL imm8 r32 -// ROLL cl r32 -// ROLL 1 m32 -// ROLL imm8 m32 -// ROLL cl m32 -func ROLL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "ROLL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ROLL: bad operands") -} - -// ROLQ: Rotate Left. -// -// Forms: -// -// ROLQ 1 r64 -// ROLQ imm8 r64 -// ROLQ cl r64 -// ROLQ 1 m64 -// ROLQ imm8 m64 -// ROLQ cl m64 -func ROLQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "ROLQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ROLQ: bad operands") -} - -// ROLW: Rotate Left. -// -// Forms: -// -// ROLW 1 r16 -// ROLW imm8 r16 -// ROLW cl r16 -// ROLW 1 m16 -// ROLW imm8 m16 -// ROLW cl m16 -func ROLW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "ROLW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("ROLW: bad operands") -} - -// RORB: Rotate Right. -// -// Forms: -// -// RORB 1 r8 -// RORB imm8 r8 -// RORB cl r8 -// RORB 1 m8 -// RORB imm8 m8 -// RORB cl m8 -func RORB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "RORB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RORB: bad operands") -} - -// RORL: Rotate Right. -// -// Forms: -// -// RORL 1 r32 -// RORL imm8 r32 -// RORL cl r32 -// RORL 1 m32 -// RORL imm8 m32 -// RORL cl m32 -func RORL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "RORL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RORL: bad operands") -} - -// RORQ: Rotate Right. -// -// Forms: -// -// RORQ 1 r64 -// RORQ imm8 r64 -// RORQ cl r64 -// RORQ 1 m64 -// RORQ imm8 m64 -// RORQ cl m64 -func RORQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "RORQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RORQ: bad operands") -} - -// RORW: Rotate Right. -// -// Forms: -// -// RORW 1 r16 -// RORW imm8 r16 -// RORW cl r16 -// RORW 1 m16 -// RORW imm8 m16 -// RORW cl m16 -func RORW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "RORW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("RORW: bad operands") -} - -// RORXL: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXL imm8 r32 r32 -// RORXL imm8 m32 r32 -func RORXL(i, mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "RORXL", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "RORXL", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RORXL: bad operands") -} - -// RORXQ: Rotate Right Logical Without Affecting Flags. -// -// Forms: -// -// RORXQ imm8 r64 r64 -// RORXQ imm8 m64 r64 -func RORXQ(i, mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "RORXQ", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "RORXQ", - Operands: []operand.Op{i, mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("RORXQ: bad operands") -} - -// ROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPD imm8 xmm xmm -// ROUNDPD imm8 m128 xmm -func ROUNDPD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ROUNDPD: bad operands") -} - -// ROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDPS imm8 xmm xmm -// ROUNDPS imm8 m128 xmm -func ROUNDPS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ROUNDPS: bad operands") -} - -// ROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSD imm8 xmm xmm -// ROUNDSD imm8 m64 xmm -func ROUNDSD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDSD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDSD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ROUNDSD: bad operands") -} - -// ROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// ROUNDSS imm8 xmm xmm -// ROUNDSS imm8 m32 xmm -func ROUNDSS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDSS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "ROUNDSS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("ROUNDSS: bad operands") -} - -// RSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// RSQRTPS xmm xmm -// RSQRTPS m128 xmm -func RSQRTPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RSQRTPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RSQRTPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("RSQRTPS: bad operands") -} - -// RSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// RSQRTSS xmm xmm -// RSQRTSS m32 xmm -func RSQRTSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RSQRTSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "RSQRTSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("RSQRTSS: bad operands") -} - -// SALB: Arithmetic Shift Left. -// -// Forms: -// -// SALB 1 r8 -// SALB imm8 r8 -// SALB cl r8 -// SALB 1 m8 -// SALB imm8 m8 -// SALB cl m8 -func SALB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SALB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SALB: bad operands") -} - -// SALL: Arithmetic Shift Left. -// -// Forms: -// -// SALL 1 r32 -// SALL imm8 r32 -// SALL cl r32 -// SALL 1 m32 -// SALL imm8 m32 -// SALL cl m32 -func SALL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SALL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SALL: bad operands") -} - -// SALQ: Arithmetic Shift Left. -// -// Forms: -// -// SALQ 1 r64 -// SALQ imm8 r64 -// SALQ cl r64 -// SALQ 1 m64 -// SALQ imm8 m64 -// SALQ cl m64 -func SALQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SALQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SALQ: bad operands") -} - -// SALW: Arithmetic Shift Left. -// -// Forms: -// -// SALW 1 r16 -// SALW imm8 r16 -// SALW cl r16 -// SALW 1 m16 -// SALW imm8 m16 -// SALW cl m16 -func SALW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SALW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SALW: bad operands") -} - -// SARB: Arithmetic Shift Right. -// -// Forms: -// -// SARB 1 r8 -// SARB imm8 r8 -// SARB cl r8 -// SARB 1 m8 -// SARB imm8 m8 -// SARB cl m8 -func SARB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SARB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SARB: bad operands") -} - -// SARL: Arithmetic Shift Right. -// -// Forms: -// -// SARL 1 r32 -// SARL imm8 r32 -// SARL cl r32 -// SARL 1 m32 -// SARL imm8 m32 -// SARL cl m32 -func SARL(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "SARL", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SARL: bad operands") -} - -// SARQ: Arithmetic Shift Right. -// -// Forms: -// -// SARQ 1 r64 -// SARQ imm8 r64 -// SARQ cl r64 -// SARQ 1 m64 -// SARQ imm8 m64 -// SARQ cl m64 -func SARQ(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SARQ", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SARQ: bad operands") -} - -// SARW: Arithmetic Shift Right. -// -// Forms: -// -// SARW 1 r16 -// SARW imm8 r16 -// SARW cl r16 -// SARW 1 m16 -// SARW imm8 m16 -// SARW cl m16 -func SARW(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "SARW", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SARW: bad operands") -} - -// SARXL: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXL r32 r32 r32 -// SARXL r32 m32 r32 -func SARXL(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SARXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SARXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SARXL: bad operands") -} - -// SARXQ: Arithmetic Shift Right Without Affecting Flags. -// -// Forms: -// -// SARXQ r64 r64 r64 -// SARXQ r64 m64 r64 -func SARXQ(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SARXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SARXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SARXQ: bad operands") -} - -// SBBB: Subtract with Borrow. -// -// Forms: -// -// SBBB imm8 al -// SBBB imm8 r8 -// SBBB r8 r8 -// SBBB m8 r8 -// SBBB imm8 m8 -// SBBB r8 m8 -func SBBB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "SBBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("SBBB: bad operands") -} - -// SBBL: Subtract with Borrow. -// -// Forms: -// -// SBBL imm32 eax -// SBBL imm8 r32 -// SBBL imm32 r32 -// SBBL r32 r32 -// SBBL m32 r32 -// SBBL imm8 m32 -// SBBL imm32 m32 -// SBBL r32 m32 -func SBBL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SBBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("SBBL: bad operands") -} - -// SBBQ: Subtract with Borrow. -// -// Forms: -// -// SBBQ imm32 rax -// SBBQ imm8 r64 -// SBBQ imm32 r64 -// SBBQ r64 r64 -// SBBQ m64 r64 -// SBBQ imm8 m64 -// SBBQ imm32 m64 -// SBBQ r64 m64 -func SBBQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SBBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SBBQ: bad operands") -} - -// SBBW: Subtract with Borrow. -// -// Forms: -// -// SBBW imm16 ax -// SBBW imm8 r16 -// SBBW imm16 r16 -// SBBW r16 r16 -// SBBW m16 r16 -// SBBW imm8 m16 -// SBBW imm16 m16 -// SBBW r16 m16 -func SBBW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SBBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("SBBW: bad operands") -} - -// SETCC: Set byte if above or equal (CF == 0). -// -// Forms: -// -// SETCC r8 -// SETCC m8 -func SETCC(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETCC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETCC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETCC: bad operands") -} - -// SETCS: Set byte if below (CF == 1). -// -// Forms: -// -// SETCS r8 -// SETCS m8 -func SETCS(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETCS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETCS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETCS: bad operands") -} - -// SETEQ: Set byte if equal (ZF == 1). -// -// Forms: -// -// SETEQ r8 -// SETEQ m8 -func SETEQ(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETEQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETEQ", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETEQ: bad operands") -} - -// SETGE: Set byte if greater or equal (SF == OF). -// -// Forms: -// -// SETGE r8 -// SETGE m8 -func SETGE(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETGE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETGE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETGE: bad operands") -} - -// SETGT: Set byte if greater (ZF == 0 and SF == OF). -// -// Forms: -// -// SETGT r8 -// SETGT m8 -func SETGT(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETGT", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETGT", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETGT: bad operands") -} - -// SETHI: Set byte if above (CF == 0 and ZF == 0). -// -// Forms: -// -// SETHI r8 -// SETHI m8 -func SETHI(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETHI", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETHI", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETHI: bad operands") -} - -// SETLE: Set byte if less or equal (ZF == 1 or SF != OF). -// -// Forms: -// -// SETLE r8 -// SETLE m8 -func SETLE(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETLE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETLE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETLE: bad operands") -} - -// SETLS: Set byte if below or equal (CF == 1 or ZF == 1). -// -// Forms: -// -// SETLS r8 -// SETLS m8 -func SETLS(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETLS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETLS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETLS: bad operands") -} - -// SETLT: Set byte if less (SF != OF). -// -// Forms: -// -// SETLT r8 -// SETLT m8 -func SETLT(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETLT", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETLT", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETLT: bad operands") -} - -// SETMI: Set byte if sign (SF == 1). -// -// Forms: -// -// SETMI r8 -// SETMI m8 -func SETMI(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETMI", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETMI", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETMI: bad operands") -} - -// SETNE: Set byte if not equal (ZF == 0). -// -// Forms: -// -// SETNE r8 -// SETNE m8 -func SETNE(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETNE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETNE", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETNE: bad operands") -} - -// SETOC: Set byte if not overflow (OF == 0). -// -// Forms: -// -// SETOC r8 -// SETOC m8 -func SETOC(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETOC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETOC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETOC: bad operands") -} - -// SETOS: Set byte if overflow (OF == 1). -// -// Forms: -// -// SETOS r8 -// SETOS m8 -func SETOS(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETOS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETOS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETOS: bad operands") -} - -// SETPC: Set byte if not parity (PF == 0). -// -// Forms: -// -// SETPC r8 -// SETPC m8 -func SETPC(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETPC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETPC", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETPC: bad operands") -} - -// SETPL: Set byte if not sign (SF == 0). -// -// Forms: -// -// SETPL r8 -// SETPL m8 -func SETPL(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETPL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETPL", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETPL: bad operands") -} - -// SETPS: Set byte if parity (PF == 1). -// -// Forms: -// -// SETPS r8 -// SETPS m8 -func SETPS(mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SETPS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SETPS", - Operands: []operand.Op{mr}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SETPS: bad operands") -} - -// SFENCE: Store Fence. -// -// Forms: -// -// SFENCE -func SFENCE() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "SFENCE", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// SHA1MSG1: Perform an Intermediate Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG1 xmm xmm -// SHA1MSG1 m128 xmm -func SHA1MSG1(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1MSG1", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1MSG1", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA1MSG1: bad operands") -} - -// SHA1MSG2: Perform a Final Calculation for the Next Four SHA1 Message Doublewords. -// -// Forms: -// -// SHA1MSG2 xmm xmm -// SHA1MSG2 m128 xmm -func SHA1MSG2(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1MSG2", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1MSG2", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA1MSG2: bad operands") -} - -// SHA1NEXTE: Calculate SHA1 State Variable E after Four Rounds. -// -// Forms: -// -// SHA1NEXTE xmm xmm -// SHA1NEXTE m128 xmm -func SHA1NEXTE(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1NEXTE", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1NEXTE", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA1NEXTE: bad operands") -} - -// SHA1RNDS4: Perform Four Rounds of SHA1 Operation. -// -// Forms: -// -// SHA1RNDS4 imm2u xmm xmm -// SHA1RNDS4 imm2u m128 xmm -func SHA1RNDS4(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM2U(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1RNDS4", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM2U(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA1RNDS4", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA1RNDS4: bad operands") -} - -// SHA256MSG1: Perform an Intermediate Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG1 xmm xmm -// SHA256MSG1 m128 xmm -func SHA256MSG1(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA256MSG1", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA256MSG1", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA256MSG1: bad operands") -} - -// SHA256MSG2: Perform a Final Calculation for the Next Four SHA256 Message Doublewords. -// -// Forms: -// -// SHA256MSG2 xmm xmm -// SHA256MSG2 m128 xmm -func SHA256MSG2(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA256MSG2", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHA256MSG2", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHA256MSG2: bad operands") -} - -// SHA256RNDS2: Perform Two Rounds of SHA256 Operation. -// -// Forms: -// -// SHA256RNDS2 xmm0 xmm xmm -// SHA256RNDS2 xmm0 m128 xmm -func SHA256RNDS2(x, mx, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM0(x) && operand.IsXMM(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "SHA256RNDS2", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsXMM0(x) && operand.IsM128(mx) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "SHA256RNDS2", - Operands: []operand.Op{x, mx, x1}, - Inputs: []operand.Op{x, mx, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("SHA256RNDS2: bad operands") -} - -// SHLB: Logical Shift Left. -// -// Forms: -// -// SHLB 1 r8 -// SHLB imm8 r8 -// SHLB cl r8 -// SHLB 1 m8 -// SHLB imm8 m8 -// SHLB cl m8 -func SHLB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHLB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SHLB: bad operands") -} - -// SHLL: Logical Shift Left. -// -// Forms: -// -// SHLL 1 r32 -// SHLL imm8 r32 -// SHLL cl r32 -// SHLL 1 m32 -// SHLL imm8 m32 -// SHLL cl m32 -// SHLL imm8 r32 r32 -// SHLL cl r32 r32 -// SHLL imm8 r32 m32 -// SHLL cl r32 m32 -func SHLL(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]) && operand.IsR32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]) && operand.IsR32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]) && operand.IsM32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]) && operand.IsM32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHLL: bad operands") -} - -// SHLQ: Logical Shift Left. -// -// Forms: -// -// SHLQ 1 r64 -// SHLQ imm8 r64 -// SHLQ cl r64 -// SHLQ 1 m64 -// SHLQ imm8 m64 -// SHLQ cl m64 -// SHLQ imm8 r64 r64 -// SHLQ cl r64 r64 -// SHLQ imm8 r64 m64 -// SHLQ cl r64 m64 -func SHLQ(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]) && operand.IsR64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]) && operand.IsR64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]) && operand.IsM64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]) && operand.IsM64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHLQ: bad operands") -} - -// SHLW: Logical Shift Left. -// -// Forms: -// -// SHLW 1 r16 -// SHLW imm8 r16 -// SHLW cl r16 -// SHLW 1 m16 -// SHLW imm8 m16 -// SHLW cl m16 -// SHLW imm8 r16 r16 -// SHLW cl r16 r16 -// SHLW imm8 r16 m16 -// SHLW cl r16 m16 -func SHLW(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]) && operand.IsR16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]) && operand.IsR16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]) && operand.IsM16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]) && operand.IsM16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHLW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHLW: bad operands") -} - -// SHLXL: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXL r32 r32 r32 -// SHLXL r32 m32 r32 -func SHLXL(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SHLXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SHLXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SHLXL: bad operands") -} - -// SHLXQ: Logical Shift Left Without Affecting Flags. -// -// Forms: -// -// SHLXQ r64 r64 r64 -// SHLXQ r64 m64 r64 -func SHLXQ(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SHLXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SHLXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SHLXQ: bad operands") -} - -// SHRB: Logical Shift Right. -// -// Forms: -// -// SHRB 1 r8 -// SHRB imm8 r8 -// SHRB cl r8 -// SHRB 1 m8 -// SHRB imm8 m8 -// SHRB cl m8 -func SHRB(ci, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.Is1(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.Is1(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsCL(ci) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "SHRB", - Operands: []operand.Op{ci, mr}, - Inputs: []operand.Op{ci, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SHRB: bad operands") -} - -// SHRL: Logical Shift Right. -// -// Forms: -// -// SHRL 1 r32 -// SHRL imm8 r32 -// SHRL cl r32 -// SHRL 1 m32 -// SHRL imm8 m32 -// SHRL cl m32 -// SHRL imm8 r32 r32 -// SHRL cl r32 r32 -// SHRL imm8 r32 m32 -// SHRL cl r32 m32 -func SHRL(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]) && operand.IsR32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]) && operand.IsR32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR32(ops[1]) && operand.IsM32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR32(ops[1]) && operand.IsM32(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRL", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHRL: bad operands") -} - -// SHRQ: Logical Shift Right. -// -// Forms: -// -// SHRQ 1 r64 -// SHRQ imm8 r64 -// SHRQ cl r64 -// SHRQ 1 m64 -// SHRQ imm8 m64 -// SHRQ cl m64 -// SHRQ imm8 r64 r64 -// SHRQ cl r64 r64 -// SHRQ imm8 r64 m64 -// SHRQ cl r64 m64 -func SHRQ(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]) && operand.IsR64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]) && operand.IsR64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR64(ops[1]) && operand.IsM64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR64(ops[1]) && operand.IsM64(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRQ", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHRQ: bad operands") -} - -// SHRW: Logical Shift Right. -// -// Forms: -// -// SHRW 1 r16 -// SHRW imm8 r16 -// SHRW cl r16 -// SHRW 1 m16 -// SHRW imm8 m16 -// SHRW cl m16 -// SHRW imm8 r16 r16 -// SHRW cl r16 r16 -// SHRW imm8 r16 m16 -// SHRW cl r16 m16 -func SHRW(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.Is1(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsIMM8(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsCL(ops[0]) && operand.IsM16(ops[1]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]) && operand.IsR16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]) && operand.IsR16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsIMM8(ops[0]) && operand.IsR16(ops[1]) && operand.IsM16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - case len(ops) == 3 && operand.IsCL(ops[0]) && operand.IsR16(ops[1]) && operand.IsM16(ops[2]): - return &intrep.Instruction{ - Opcode: "SHRW", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1], ops[2]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("SHRW: bad operands") -} - -// SHRXL: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXL r32 r32 r32 -// SHRXL r32 m32 r32 -func SHRXL(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SHRXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr) && operand.IsR32(r1): - return &intrep.Instruction{ - Opcode: "SHRXL", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SHRXL: bad operands") -} - -// SHRXQ: Logical Shift Right Without Affecting Flags. -// -// Forms: -// -// SHRXQ r64 r64 r64 -// SHRXQ r64 m64 r64 -func SHRXQ(r, mr, r1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SHRXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr) && operand.IsR64(r1): - return &intrep.Instruction{ - Opcode: "SHRXQ", - Operands: []operand.Op{r, mr, r1}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r1}, - }, nil - } - return nil, errors.New("SHRXQ: bad operands") -} - -// SHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPD imm8 xmm xmm -// SHUFPD imm8 m128 xmm -func SHUFPD(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHUFPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHUFPD", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHUFPD: bad operands") -} - -// SHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SHUFPS imm8 xmm xmm -// SHUFPS imm8 m128 xmm -func SHUFPS(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHUFPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SHUFPS", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SHUFPS: bad operands") -} - -// SQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPD xmm xmm -// SQRTPD m128 xmm -func SQRTPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SQRTPD: bad operands") -} - -// SQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SQRTPS xmm xmm -// SQRTPS m128 xmm -func SQRTPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SQRTPS: bad operands") -} - -// SQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSD xmm xmm -// SQRTSD m64 xmm -func SQRTSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SQRTSD: bad operands") -} - -// SQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// SQRTSS xmm xmm -// SQRTSS m32 xmm -func SQRTSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SQRTSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SQRTSS: bad operands") -} - -// STC: Set Carry Flag. -// -// Forms: -// -// STC -func STC() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "STC", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// STD: Set Direction Flag. -// -// Forms: -// -// STD -func STD() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "STD", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// STMXCSR: Store MXCSR Register State. -// -// Forms: -// -// STMXCSR m32 -func STMXCSR(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(m): - return &intrep.Instruction{ - Opcode: "STMXCSR", - Operands: []operand.Op{m}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("STMXCSR: bad operands") -} - -// SUBB: Subtract. -// -// Forms: -// -// SUBB imm8 al -// SUBB imm8 r8 -// SUBB r8 r8 -// SUBB m8 r8 -// SUBB imm8 m8 -// SUBB r8 m8 -func SUBB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "SUBB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("SUBB: bad operands") -} - -// SUBL: Subtract. -// -// Forms: -// -// SUBL imm32 eax -// SUBL imm8 r32 -// SUBL imm32 r32 -// SUBL r32 r32 -// SUBL m32 r32 -// SUBL imm8 m32 -// SUBL imm32 m32 -// SUBL r32 m32 -func SUBL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "SUBL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("SUBL: bad operands") -} - -// SUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBPD xmm xmm -// SUBPD m128 xmm -func SUBPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SUBPD: bad operands") -} - -// SUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBPS xmm xmm -// SUBPS m128 xmm -func SUBPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SUBPS: bad operands") -} - -// SUBQ: Subtract. -// -// Forms: -// -// SUBQ imm32 rax -// SUBQ imm8 r64 -// SUBQ imm32 r64 -// SUBQ r64 r64 -// SUBQ m64 r64 -// SUBQ imm8 m64 -// SUBQ imm32 m64 -// SUBQ r64 m64 -func SUBQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "SUBQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("SUBQ: bad operands") -} - -// SUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// SUBSD xmm xmm -// SUBSD m64 xmm -func SUBSD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBSD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SUBSD: bad operands") -} - -// SUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// SUBSS xmm xmm -// SUBSS m32 xmm -func SUBSS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "SUBSS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("SUBSS: bad operands") -} - -// SUBW: Subtract. -// -// Forms: -// -// SUBW imm16 ax -// SUBW imm8 r16 -// SUBW imm16 r16 -// SUBW r16 r16 -// SUBW m16 r16 -// SUBW imm8 m16 -// SUBW imm16 m16 -// SUBW r16 m16 -func SUBW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "SUBW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("SUBW: bad operands") -} - -// SYSCALL: Fast System Call. -// -// Forms: -// -// SYSCALL -func SYSCALL() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "SYSCALL", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{reg.R11, reg.RCX}, - }, nil -} - -// TESTB: Logical Compare. -// -// Forms: -// -// TESTB imm8 al -// TESTB imm8 r8 -// TESTB r8 r8 -// TESTB imm8 m8 -// TESTB r8 m8 -func TESTB(ir, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(ir) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "TESTB", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(ir) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "TESTB", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR8(ir) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "TESTB", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{ir, amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM8(ir) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "TESTB", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR8(ir) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "TESTB", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{ir, amr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("TESTB: bad operands") -} - -// TESTL: Logical Compare. -// -// Forms: -// -// TESTL imm32 eax -// TESTL imm32 r32 -// TESTL r32 r32 -// TESTL imm32 m32 -// TESTL r32 m32 -func TESTL(ir, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(ir) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "TESTL", - Operands: []operand.Op{ir, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM32(ir) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "TESTL", - Operands: []operand.Op{ir, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(ir) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "TESTL", - Operands: []operand.Op{ir, emr}, - Inputs: []operand.Op{ir, emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM32(ir) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "TESTL", - Operands: []operand.Op{ir, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR32(ir) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "TESTL", - Operands: []operand.Op{ir, emr}, - Inputs: []operand.Op{ir, emr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("TESTL: bad operands") -} - -// TESTQ: Logical Compare. -// -// Forms: -// -// TESTQ imm32 rax -// TESTQ imm32 r64 -// TESTQ r64 r64 -// TESTQ imm32 m64 -// TESTQ r64 m64 -func TESTQ(ir, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(ir) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "TESTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM32(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "TESTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(ir) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "TESTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM32(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "TESTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR64(ir) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "TESTQ", - Operands: []operand.Op{ir, mr}, - Inputs: []operand.Op{ir, mr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("TESTQ: bad operands") -} - -// TESTW: Logical Compare. -// -// Forms: -// -// TESTW imm16 ax -// TESTW imm16 r16 -// TESTW r16 r16 -// TESTW imm16 m16 -// TESTW r16 m16 -func TESTW(ir, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(ir) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "TESTW", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM16(ir) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "TESTW", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(ir) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "TESTW", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{ir, amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsIMM16(ir) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "TESTW", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{}, - }, nil - case operand.IsR16(ir) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "TESTW", - Operands: []operand.Op{ir, amr}, - Inputs: []operand.Op{ir, amr}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("TESTW: bad operands") -} - -// TZCNTL: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTL r32 r32 -// TZCNTL m32 r32 -func TZCNTL(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "TZCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mr) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "TZCNTL", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("TZCNTL: bad operands") -} - -// TZCNTQ: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTQ r64 r64 -// TZCNTQ m64 r64 -func TZCNTQ(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "TZCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mr) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "TZCNTQ", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("TZCNTQ: bad operands") -} - -// TZCNTW: Count the Number of Trailing Zero Bits. -// -// Forms: -// -// TZCNTW r16 r16 -// TZCNTW m16 r16 -func TZCNTW(mr, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "TZCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM16(mr) && operand.IsR16(r): - return &intrep.Instruction{ - Opcode: "TZCNTW", - Operands: []operand.Op{mr, r}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("TZCNTW: bad operands") -} - -// UCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISD xmm xmm -// UCOMISD m64 xmm -func UCOMISD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("UCOMISD: bad operands") -} - -// UCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// UCOMISS xmm xmm -// UCOMISS m32 xmm -func UCOMISS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("UCOMISS: bad operands") -} - -// UD2: Undefined Instruction. -// -// Forms: -// -// UD2 -func UD2() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "UD2", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// UNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPD xmm xmm -// UNPCKHPD m128 xmm -func UNPCKHPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKHPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKHPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("UNPCKHPD: bad operands") -} - -// UNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKHPS xmm xmm -// UNPCKHPS m128 xmm -func UNPCKHPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKHPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKHPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("UNPCKHPS: bad operands") -} - -// UNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPD xmm xmm -// UNPCKLPD m128 xmm -func UNPCKLPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKLPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKLPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("UNPCKLPD: bad operands") -} - -// UNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// UNPCKLPS xmm xmm -// UNPCKLPS m128 xmm -func UNPCKLPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKLPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "UNPCKLPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("UNPCKLPS: bad operands") -} - -// VADDPD: Add Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDPD xmm xmm xmm -// VADDPD m128 xmm xmm -// VADDPD ymm ymm ymm -// VADDPD m256 ymm ymm -func VADDPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VADDPD: bad operands") -} - -// VADDPS: Add Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDPS xmm xmm xmm -// VADDPS m128 xmm xmm -// VADDPS ymm ymm ymm -// VADDPS m256 ymm ymm -func VADDPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VADDPS: bad operands") -} - -// VADDSD: Add Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VADDSD xmm xmm xmm -// VADDSD m64 xmm xmm -func VADDSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VADDSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VADDSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VADDSD: bad operands") -} - -// VADDSS: Add Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VADDSS xmm xmm xmm -// VADDSS m32 xmm xmm -func VADDSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VADDSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VADDSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VADDSS: bad operands") -} - -// VADDSUBPD: Packed Double-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPD xmm xmm xmm -// VADDSUBPD m128 xmm xmm -// VADDSUBPD ymm ymm ymm -// VADDSUBPD m256 ymm ymm -func VADDSUBPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VADDSUBPD: bad operands") -} - -// VADDSUBPS: Packed Single-FP Add/Subtract. -// -// Forms: -// -// VADDSUBPS xmm xmm xmm -// VADDSUBPS m128 xmm xmm -// VADDSUBPS ymm ymm ymm -// VADDSUBPS m256 ymm ymm -func VADDSUBPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VADDSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VADDSUBPS: bad operands") -} - -// VAESDEC: Perform One Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDEC xmm xmm xmm -// VAESDEC m128 xmm xmm -func VAESDEC(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESDEC", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESDEC", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VAESDEC: bad operands") -} - -// VAESDECLAST: Perform Last Round of an AES Decryption Flow. -// -// Forms: -// -// VAESDECLAST xmm xmm xmm -// VAESDECLAST m128 xmm xmm -func VAESDECLAST(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESDECLAST", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESDECLAST", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VAESDECLAST: bad operands") -} - -// VAESENC: Perform One Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENC xmm xmm xmm -// VAESENC m128 xmm xmm -func VAESENC(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESENC", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESENC", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VAESENC: bad operands") -} - -// VAESENCLAST: Perform Last Round of an AES Encryption Flow. -// -// Forms: -// -// VAESENCLAST xmm xmm xmm -// VAESENCLAST m128 xmm xmm -func VAESENCLAST(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESENCLAST", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VAESENCLAST", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VAESENCLAST: bad operands") -} - -// VAESIMC: Perform the AES InvMixColumn Transformation. -// -// Forms: -// -// VAESIMC xmm xmm -// VAESIMC m128 xmm -func VAESIMC(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VAESIMC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VAESIMC", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VAESIMC: bad operands") -} - -// VAESKEYGENASSIST: AES Round Key Generation Assist. -// -// Forms: -// -// VAESKEYGENASSIST imm8 xmm xmm -// VAESKEYGENASSIST imm8 m128 xmm -func VAESKEYGENASSIST(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VAESKEYGENASSIST", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VAESKEYGENASSIST", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VAESKEYGENASSIST: bad operands") -} - -// VANDNPD: Bitwise Logical AND NOT of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPD xmm xmm xmm -// VANDNPD m128 xmm xmm -// VANDNPD ymm ymm ymm -// VANDNPD m256 ymm ymm -func VANDNPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VANDNPD: bad operands") -} - -// VANDNPS: Bitwise Logical AND NOT of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDNPS xmm xmm xmm -// VANDNPS m128 xmm xmm -// VANDNPS ymm ymm ymm -// VANDNPS m256 ymm ymm -func VANDNPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDNPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VANDNPS: bad operands") -} - -// VANDPD: Bitwise Logical AND of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VANDPD xmm xmm xmm -// VANDPD m128 xmm xmm -// VANDPD ymm ymm ymm -// VANDPD m256 ymm ymm -func VANDPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VANDPD: bad operands") -} - -// VANDPS: Bitwise Logical AND of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VANDPS xmm xmm xmm -// VANDPS m128 xmm xmm -// VANDPS ymm ymm ymm -// VANDPS m256 ymm ymm -func VANDPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VANDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VANDPS: bad operands") -} - -// VBLENDPD: Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPD imm8 xmm xmm xmm -// VBLENDPD imm8 m128 xmm xmm -// VBLENDPD imm8 ymm ymm ymm -// VBLENDPD imm8 m256 ymm ymm -func VBLENDPD(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VBLENDPD: bad operands") -} - -// VBLENDPS: Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDPS imm8 xmm xmm xmm -// VBLENDPS imm8 m128 xmm xmm -// VBLENDPS imm8 ymm ymm ymm -// VBLENDPS imm8 m256 ymm ymm -func VBLENDPS(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VBLENDPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VBLENDPS: bad operands") -} - -// VBLENDVPD: Variable Blend Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPD xmm xmm xmm xmm -// VBLENDVPD xmm m128 xmm xmm -// VBLENDVPD ymm ymm ymm ymm -// VBLENDVPD ymm m256 ymm ymm -func VBLENDVPD(xy, mxy, xy1, xy2 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsXMM(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPD", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsXMM(xy) && operand.IsM128(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPD", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsYMM(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPD", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPD", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - } - return nil, errors.New("VBLENDVPD: bad operands") -} - -// VBLENDVPS: Variable Blend Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VBLENDVPS xmm xmm xmm xmm -// VBLENDVPS xmm m128 xmm xmm -// VBLENDVPS ymm ymm ymm ymm -// VBLENDVPS ymm m256 ymm ymm -func VBLENDVPS(xy, mxy, xy1, xy2 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsXMM(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPS", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsXMM(xy) && operand.IsM128(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPS", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsYMM(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPS", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VBLENDVPS", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - } - return nil, errors.New("VBLENDVPS: bad operands") -} - -// VBROADCASTF128: Broadcast 128 Bit of Floating-Point Data. -// -// Forms: -// -// VBROADCASTF128 m128 ymm -func VBROADCASTF128(m, y operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VBROADCASTF128", - Operands: []operand.Op{m, y}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{y}, - }, nil - } - return nil, errors.New("VBROADCASTF128: bad operands") -} - -// VBROADCASTI128: Broadcast 128 Bits of Integer Data. -// -// Forms: -// -// VBROADCASTI128 m128 ymm -func VBROADCASTI128(m, y operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VBROADCASTI128", - Operands: []operand.Op{m, y}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{y}, - }, nil - } - return nil, errors.New("VBROADCASTI128: bad operands") -} - -// VBROADCASTSD: Broadcast Double-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSD xmm ymm -// VBROADCASTSD m64 ymm -func VBROADCASTSD(mx, y operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VBROADCASTSD", - Operands: []operand.Op{mx, y}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{y}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VBROADCASTSD", - Operands: []operand.Op{mx, y}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{y}, - }, nil - } - return nil, errors.New("VBROADCASTSD: bad operands") -} - -// VBROADCASTSS: Broadcast Single-Precision Floating-Point Element. -// -// Forms: -// -// VBROADCASTSS xmm xmm -// VBROADCASTSS m32 xmm -// VBROADCASTSS xmm ymm -// VBROADCASTSS m32 ymm -func VBROADCASTSS(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VBROADCASTSS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VBROADCASTSS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VBROADCASTSS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VBROADCASTSS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VBROADCASTSS: bad operands") -} - -// VCMPPD: Compare Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPD imm8 xmm xmm xmm -// VCMPPD imm8 m128 xmm xmm -// VCMPPD imm8 ymm ymm ymm -// VCMPPD imm8 m256 ymm ymm -func VCMPPD(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VCMPPD: bad operands") -} - -// VCMPPS: Compare Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPPS imm8 xmm xmm xmm -// VCMPPS imm8 m128 xmm xmm -// VCMPPS imm8 ymm ymm ymm -// VCMPPS imm8 m256 ymm ymm -func VCMPPS(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VCMPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VCMPPS: bad operands") -} - -// VCMPSD: Compare Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSD imm8 xmm xmm xmm -// VCMPSD imm8 m64 xmm xmm -func VCMPSD(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCMPSD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCMPSD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCMPSD: bad operands") -} - -// VCMPSS: Compare Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VCMPSS imm8 xmm xmm xmm -// VCMPSS imm8 m32 xmm xmm -func VCMPSS(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCMPSS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCMPSS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCMPSS: bad operands") -} - -// VCOMISD: Compare Scalar Ordered Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISD xmm xmm -// VCOMISD m64 xmm -func VCOMISD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VCOMISD: bad operands") -} - -// VCOMISS: Compare Scalar Ordered Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VCOMISS xmm xmm -// VCOMISS m32 xmm -func VCOMISS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VCOMISS: bad operands") -} - -// VCVTDQ2PD: Convert Packed Dword Integers to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PD xmm xmm -// VCVTDQ2PD m64 xmm -// VCVTDQ2PD xmm ymm -// VCVTDQ2PD m128 ymm -func VCVTDQ2PD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTDQ2PD: bad operands") -} - -// VCVTDQ2PS: Convert Packed Dword Integers to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTDQ2PS xmm xmm -// VCVTDQ2PS m128 xmm -// VCVTDQ2PS ymm ymm -// VCVTDQ2PS m256 ymm -func VCVTDQ2PS(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTDQ2PS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTDQ2PS: bad operands") -} - -// VCVTPD2DQX: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQX xmm xmm -// VCVTPD2DQX m128 xmm -func VCVTPD2DQX(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2DQX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2DQX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTPD2DQX: bad operands") -} - -// VCVTPD2DQY: Convert Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPD2DQY ymm xmm -// VCVTPD2DQY m256 xmm -func VCVTPD2DQY(my, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsYMM(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2DQY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM256(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2DQY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTPD2DQY: bad operands") -} - -// VCVTPD2PSX: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSX xmm xmm -// VCVTPD2PSX m128 xmm -func VCVTPD2PSX(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2PSX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2PSX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTPD2PSX: bad operands") -} - -// VCVTPD2PSY: Convert Packed Double-Precision FP Values to Packed Single-Precision FP Values. -// -// Forms: -// -// VCVTPD2PSY ymm xmm -// VCVTPD2PSY m256 xmm -func VCVTPD2PSY(my, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsYMM(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2PSY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM256(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTPD2PSY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTPD2PSY: bad operands") -} - -// VCVTPH2PS: Convert Half-Precision FP Values to Single-Precision FP Values. -// -// Forms: -// -// VCVTPH2PS xmm xmm -// VCVTPH2PS m64 xmm -// VCVTPH2PS xmm ymm -// VCVTPH2PS m128 ymm -func VCVTPH2PS(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPH2PS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPH2PS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPH2PS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPH2PS", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTPH2PS: bad operands") -} - -// VCVTPS2DQ: Convert Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTPS2DQ xmm xmm -// VCVTPS2DQ m128 xmm -// VCVTPS2DQ ymm ymm -// VCVTPS2DQ m256 ymm -func VCVTPS2DQ(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTPS2DQ: bad operands") -} - -// VCVTPS2PD: Convert Packed Single-Precision FP Values to Packed Double-Precision FP Values. -// -// Forms: -// -// VCVTPS2PD xmm xmm -// VCVTPS2PD m64 xmm -// VCVTPS2PD xmm ymm -// VCVTPS2PD m128 ymm -func VCVTPS2PD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTPS2PD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTPS2PD: bad operands") -} - -// VCVTPS2PH: Convert Single-Precision FP value to Half-Precision FP value. -// -// Forms: -// -// VCVTPS2PH imm8 xmm xmm -// VCVTPS2PH imm8 ymm xmm -// VCVTPS2PH imm8 xmm m64 -// VCVTPS2PH imm8 ymm m128 -func VCVTPS2PH(i, xy, mx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(xy) && operand.IsXMM(mx): - return &intrep.Instruction{ - Opcode: "VCVTPS2PH", - Operands: []operand.Op{i, xy, mx}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{mx}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(xy) && operand.IsXMM(mx): - return &intrep.Instruction{ - Opcode: "VCVTPS2PH", - Operands: []operand.Op{i, xy, mx}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{mx}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(xy) && operand.IsM64(mx): - return &intrep.Instruction{ - Opcode: "VCVTPS2PH", - Operands: []operand.Op{i, xy, mx}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{mx}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(xy) && operand.IsM128(mx): - return &intrep.Instruction{ - Opcode: "VCVTPS2PH", - Operands: []operand.Op{i, xy, mx}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{mx}, - }, nil - } - return nil, errors.New("VCVTPS2PH: bad operands") -} - -// VCVTSD2SI: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SI xmm r32 -// VCVTSD2SI m64 r32 -func VCVTSD2SI(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTSD2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTSD2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTSD2SI: bad operands") -} - -// VCVTSD2SIQ: Convert Scalar Double-Precision FP Value to Integer. -// -// Forms: -// -// VCVTSD2SIQ xmm r64 -// VCVTSD2SIQ m64 r64 -func VCVTSD2SIQ(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTSD2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTSD2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTSD2SIQ: bad operands") -} - -// VCVTSD2SS: Convert Scalar Double-Precision FP Value to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSD2SS xmm xmm xmm -// VCVTSD2SS m64 xmm xmm -func VCVTSD2SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSD2SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSD2SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSD2SS: bad operands") -} - -// VCVTSI2SDL: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDL r32 xmm xmm -// VCVTSI2SDL m32 xmm xmm -func VCVTSI2SDL(mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SDL", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SDL", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSI2SDL: bad operands") -} - -// VCVTSI2SDQ: Convert Dword Integer to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSI2SDQ r64 xmm xmm -// VCVTSI2SDQ m64 xmm xmm -func VCVTSI2SDQ(mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SDQ", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SDQ", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSI2SDQ: bad operands") -} - -// VCVTSI2SSL: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSL r32 xmm xmm -// VCVTSI2SSL m32 xmm xmm -func VCVTSI2SSL(mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SSL", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SSL", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSI2SSL: bad operands") -} - -// VCVTSI2SSQ: Convert Dword Integer to Scalar Single-Precision FP Value. -// -// Forms: -// -// VCVTSI2SSQ r64 xmm xmm -// VCVTSI2SSQ m64 xmm xmm -func VCVTSI2SSQ(mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SSQ", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSI2SSQ", - Operands: []operand.Op{mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSI2SSQ: bad operands") -} - -// VCVTSS2SD: Convert Scalar Single-Precision FP Value to Scalar Double-Precision FP Value. -// -// Forms: -// -// VCVTSS2SD xmm xmm xmm -// VCVTSS2SD m32 xmm xmm -func VCVTSS2SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSS2SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VCVTSS2SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VCVTSS2SD: bad operands") -} - -// VCVTSS2SI: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SI xmm r32 -// VCVTSS2SI m32 r32 -func VCVTSS2SI(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTSS2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTSS2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTSS2SI: bad operands") -} - -// VCVTSS2SIQ: Convert Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTSS2SIQ xmm r64 -// VCVTSS2SIQ m32 r64 -func VCVTSS2SIQ(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTSS2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTSS2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTSS2SIQ: bad operands") -} - -// VCVTTPD2DQX: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQX xmm xmm -// VCVTTPD2DQX m128 xmm -func VCVTTPD2DQX(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTTPD2DQX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTTPD2DQX", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTTPD2DQX: bad operands") -} - -// VCVTTPD2DQY: Convert with Truncation Packed Double-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPD2DQY ymm xmm -// VCVTTPD2DQY m256 xmm -func VCVTTPD2DQY(my, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsYMM(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTTPD2DQY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM256(my) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VCVTTPD2DQY", - Operands: []operand.Op{my, x}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VCVTTPD2DQY: bad operands") -} - -// VCVTTPS2DQ: Convert with Truncation Packed Single-Precision FP Values to Packed Dword Integers. -// -// Forms: -// -// VCVTTPS2DQ xmm xmm -// VCVTTPS2DQ m128 xmm -// VCVTTPS2DQ ymm ymm -// VCVTTPS2DQ m256 ymm -func VCVTTPS2DQ(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VCVTTPS2DQ", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VCVTTPS2DQ: bad operands") -} - -// VCVTTSD2SI: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SI xmm r32 -// VCVTTSD2SI m64 r32 -func VCVTTSD2SI(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTTSD2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTTSD2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTTSD2SI: bad operands") -} - -// VCVTTSD2SIQ: Convert with Truncation Scalar Double-Precision FP Value to Signed Integer. -// -// Forms: -// -// VCVTTSD2SIQ xmm r64 -// VCVTTSD2SIQ m64 r64 -func VCVTTSD2SIQ(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTTSD2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM64(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTTSD2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTTSD2SIQ: bad operands") -} - -// VCVTTSS2SI: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SI xmm r32 -// VCVTTSS2SI m32 r32 -func VCVTTSS2SI(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTTSS2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VCVTTSS2SI", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTTSS2SI: bad operands") -} - -// VCVTTSS2SIQ: Convert with Truncation Scalar Single-Precision FP Value to Dword Integer. -// -// Forms: -// -// VCVTTSS2SIQ xmm r64 -// VCVTTSS2SIQ m32 r64 -func VCVTTSS2SIQ(mx, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTTSS2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsM32(mx) && operand.IsR64(r): - return &intrep.Instruction{ - Opcode: "VCVTTSS2SIQ", - Operands: []operand.Op{mx, r}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VCVTTSS2SIQ: bad operands") -} - -// VDIVPD: Divide Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPD xmm xmm xmm -// VDIVPD m128 xmm xmm -// VDIVPD ymm ymm ymm -// VDIVPD m256 ymm ymm -func VDIVPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VDIVPD: bad operands") -} - -// VDIVPS: Divide Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVPS xmm xmm xmm -// VDIVPS m128 xmm xmm -// VDIVPS ymm ymm ymm -// VDIVPS m256 ymm ymm -func VDIVPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDIVPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VDIVPS: bad operands") -} - -// VDIVSD: Divide Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSD xmm xmm xmm -// VDIVSD m64 xmm xmm -func VDIVSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDIVSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDIVSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VDIVSD: bad operands") -} - -// VDIVSS: Divide Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VDIVSS xmm xmm xmm -// VDIVSS m32 xmm xmm -func VDIVSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDIVSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDIVSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VDIVSS: bad operands") -} - -// VDPPD: Dot Product of Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VDPPD imm8 xmm xmm xmm -// VDPPD imm8 m128 xmm xmm -func VDPPD(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDPPD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VDPPD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VDPPD: bad operands") -} - -// VDPPS: Dot Product of Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VDPPS imm8 xmm xmm xmm -// VDPPS imm8 m128 xmm xmm -// VDPPS imm8 ymm ymm ymm -// VDPPS imm8 m256 ymm ymm -func VDPPS(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VDPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VDPPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VDPPS: bad operands") -} - -// VEXTRACTF128: Extract Packed Floating-Point Values. -// -// Forms: -// -// VEXTRACTF128 imm8 ymm xmm -// VEXTRACTF128 imm8 ymm m128 -func VEXTRACTF128(i, y, mx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(y) && operand.IsXMM(mx): - return &intrep.Instruction{ - Opcode: "VEXTRACTF128", - Operands: []operand.Op{i, y, mx}, - Inputs: []operand.Op{y}, - Outputs: []operand.Op{mx}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(y) && operand.IsM128(mx): - return &intrep.Instruction{ - Opcode: "VEXTRACTF128", - Operands: []operand.Op{i, y, mx}, - Inputs: []operand.Op{y}, - Outputs: []operand.Op{mx}, - }, nil - } - return nil, errors.New("VEXTRACTF128: bad operands") -} - -// VEXTRACTI128: Extract Packed Integer Values. -// -// Forms: -// -// VEXTRACTI128 imm8 ymm xmm -// VEXTRACTI128 imm8 ymm m128 -func VEXTRACTI128(i, y, mx operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(y) && operand.IsXMM(mx): - return &intrep.Instruction{ - Opcode: "VEXTRACTI128", - Operands: []operand.Op{i, y, mx}, - Inputs: []operand.Op{y}, - Outputs: []operand.Op{mx}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(y) && operand.IsM128(mx): - return &intrep.Instruction{ - Opcode: "VEXTRACTI128", - Operands: []operand.Op{i, y, mx}, - Inputs: []operand.Op{y}, - Outputs: []operand.Op{mx}, - }, nil - } - return nil, errors.New("VEXTRACTI128: bad operands") -} - -// VEXTRACTPS: Extract Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VEXTRACTPS imm8 xmm r32 -// VEXTRACTPS imm8 xmm m32 -func VEXTRACTPS(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "VEXTRACTPS", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "VEXTRACTPS", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("VEXTRACTPS: bad operands") -} - -// VFMADD132PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PD xmm xmm xmm -// VFMADD132PD m128 xmm xmm -// VFMADD132PD ymm ymm ymm -// VFMADD132PD m256 ymm ymm -func VFMADD132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD132PD: bad operands") -} - -// VFMADD132PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132PS xmm xmm xmm -// VFMADD132PS m128 xmm xmm -// VFMADD132PS ymm ymm ymm -// VFMADD132PS m256 ymm ymm -func VFMADD132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD132PS: bad operands") -} - -// VFMADD132SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SD xmm xmm xmm -// VFMADD132SD m64 xmm xmm -func VFMADD132SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD132SD: bad operands") -} - -// VFMADD132SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD132SS xmm xmm xmm -// VFMADD132SS m32 xmm xmm -func VFMADD132SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD132SS: bad operands") -} - -// VFMADD213PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PD xmm xmm xmm -// VFMADD213PD m128 xmm xmm -// VFMADD213PD ymm ymm ymm -// VFMADD213PD m256 ymm ymm -func VFMADD213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD213PD: bad operands") -} - -// VFMADD213PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213PS xmm xmm xmm -// VFMADD213PS m128 xmm xmm -// VFMADD213PS ymm ymm ymm -// VFMADD213PS m256 ymm ymm -func VFMADD213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD213PS: bad operands") -} - -// VFMADD213SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SD xmm xmm xmm -// VFMADD213SD m64 xmm xmm -func VFMADD213SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD213SD: bad operands") -} - -// VFMADD213SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD213SS xmm xmm xmm -// VFMADD213SS m32 xmm xmm -func VFMADD213SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD213SS: bad operands") -} - -// VFMADD231PD: Fused Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PD xmm xmm xmm -// VFMADD231PD m128 xmm xmm -// VFMADD231PD ymm ymm ymm -// VFMADD231PD m256 ymm ymm -func VFMADD231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD231PD: bad operands") -} - -// VFMADD231PS: Fused Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231PS xmm xmm xmm -// VFMADD231PS m128 xmm xmm -// VFMADD231PS ymm ymm ymm -// VFMADD231PS m256 ymm ymm -func VFMADD231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADD231PS: bad operands") -} - -// VFMADD231SD: Fused Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SD xmm xmm xmm -// VFMADD231SD m64 xmm xmm -func VFMADD231SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD231SD: bad operands") -} - -// VFMADD231SS: Fused Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADD231SS xmm xmm xmm -// VFMADD231SS m32 xmm xmm -func VFMADD231SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMADD231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMADD231SS: bad operands") -} - -// VFMADDSUB132PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PD xmm xmm xmm -// VFMADDSUB132PD m128 xmm xmm -// VFMADDSUB132PD ymm ymm ymm -// VFMADDSUB132PD m256 ymm ymm -func VFMADDSUB132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB132PD: bad operands") -} - -// VFMADDSUB132PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB132PS xmm xmm xmm -// VFMADDSUB132PS m128 xmm xmm -// VFMADDSUB132PS ymm ymm ymm -// VFMADDSUB132PS m256 ymm ymm -func VFMADDSUB132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB132PS: bad operands") -} - -// VFMADDSUB213PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PD xmm xmm xmm -// VFMADDSUB213PD m128 xmm xmm -// VFMADDSUB213PD ymm ymm ymm -// VFMADDSUB213PD m256 ymm ymm -func VFMADDSUB213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB213PD: bad operands") -} - -// VFMADDSUB213PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB213PS xmm xmm xmm -// VFMADDSUB213PS m128 xmm xmm -// VFMADDSUB213PS ymm ymm ymm -// VFMADDSUB213PS m256 ymm ymm -func VFMADDSUB213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB213PS: bad operands") -} - -// VFMADDSUB231PD: Fused Multiply-Alternating Add/Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PD xmm xmm xmm -// VFMADDSUB231PD m128 xmm xmm -// VFMADDSUB231PD ymm ymm ymm -// VFMADDSUB231PD m256 ymm ymm -func VFMADDSUB231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB231PD: bad operands") -} - -// VFMADDSUB231PS: Fused Multiply-Alternating Add/Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMADDSUB231PS xmm xmm xmm -// VFMADDSUB231PS m128 xmm xmm -// VFMADDSUB231PS ymm ymm ymm -// VFMADDSUB231PS m256 ymm ymm -func VFMADDSUB231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMADDSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMADDSUB231PS: bad operands") -} - -// VFMSUB132PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PD xmm xmm xmm -// VFMSUB132PD m128 xmm xmm -// VFMSUB132PD ymm ymm ymm -// VFMSUB132PD m256 ymm ymm -func VFMSUB132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB132PD: bad operands") -} - -// VFMSUB132PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132PS xmm xmm xmm -// VFMSUB132PS m128 xmm xmm -// VFMSUB132PS ymm ymm ymm -// VFMSUB132PS m256 ymm ymm -func VFMSUB132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB132PS: bad operands") -} - -// VFMSUB132SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SD xmm xmm xmm -// VFMSUB132SD m64 xmm xmm -func VFMSUB132SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB132SD: bad operands") -} - -// VFMSUB132SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB132SS xmm xmm xmm -// VFMSUB132SS m32 xmm xmm -func VFMSUB132SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB132SS: bad operands") -} - -// VFMSUB213PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PD xmm xmm xmm -// VFMSUB213PD m128 xmm xmm -// VFMSUB213PD ymm ymm ymm -// VFMSUB213PD m256 ymm ymm -func VFMSUB213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB213PD: bad operands") -} - -// VFMSUB213PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213PS xmm xmm xmm -// VFMSUB213PS m128 xmm xmm -// VFMSUB213PS ymm ymm ymm -// VFMSUB213PS m256 ymm ymm -func VFMSUB213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB213PS: bad operands") -} - -// VFMSUB213SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SD xmm xmm xmm -// VFMSUB213SD m64 xmm xmm -func VFMSUB213SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB213SD: bad operands") -} - -// VFMSUB213SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB213SS xmm xmm xmm -// VFMSUB213SS m32 xmm xmm -func VFMSUB213SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB213SS: bad operands") -} - -// VFMSUB231PD: Fused Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PD xmm xmm xmm -// VFMSUB231PD m128 xmm xmm -// VFMSUB231PD ymm ymm ymm -// VFMSUB231PD m256 ymm ymm -func VFMSUB231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB231PD: bad operands") -} - -// VFMSUB231PS: Fused Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231PS xmm xmm xmm -// VFMSUB231PS m128 xmm xmm -// VFMSUB231PS ymm ymm ymm -// VFMSUB231PS m256 ymm ymm -func VFMSUB231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUB231PS: bad operands") -} - -// VFMSUB231SD: Fused Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SD xmm xmm xmm -// VFMSUB231SD m64 xmm xmm -func VFMSUB231SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB231SD: bad operands") -} - -// VFMSUB231SS: Fused Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUB231SS xmm xmm xmm -// VFMSUB231SS m32 xmm xmm -func VFMSUB231SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFMSUB231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFMSUB231SS: bad operands") -} - -// VFMSUBADD132PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PD xmm xmm xmm -// VFMSUBADD132PD m128 xmm xmm -// VFMSUBADD132PD ymm ymm ymm -// VFMSUBADD132PD m256 ymm ymm -func VFMSUBADD132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD132PD: bad operands") -} - -// VFMSUBADD132PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD132PS xmm xmm xmm -// VFMSUBADD132PS m128 xmm xmm -// VFMSUBADD132PS ymm ymm ymm -// VFMSUBADD132PS m256 ymm ymm -func VFMSUBADD132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD132PS: bad operands") -} - -// VFMSUBADD213PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PD xmm xmm xmm -// VFMSUBADD213PD m128 xmm xmm -// VFMSUBADD213PD ymm ymm ymm -// VFMSUBADD213PD m256 ymm ymm -func VFMSUBADD213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD213PD: bad operands") -} - -// VFMSUBADD213PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD213PS xmm xmm xmm -// VFMSUBADD213PS m128 xmm xmm -// VFMSUBADD213PS ymm ymm ymm -// VFMSUBADD213PS m256 ymm ymm -func VFMSUBADD213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD213PS: bad operands") -} - -// VFMSUBADD231PD: Fused Multiply-Alternating Subtract/Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PD xmm xmm xmm -// VFMSUBADD231PD m128 xmm xmm -// VFMSUBADD231PD ymm ymm ymm -// VFMSUBADD231PD m256 ymm ymm -func VFMSUBADD231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD231PD: bad operands") -} - -// VFMSUBADD231PS: Fused Multiply-Alternating Subtract/Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFMSUBADD231PS xmm xmm xmm -// VFMSUBADD231PS m128 xmm xmm -// VFMSUBADD231PS ymm ymm ymm -// VFMSUBADD231PS m256 ymm ymm -func VFMSUBADD231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFMSUBADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFMSUBADD231PS: bad operands") -} - -// VFNMADD132PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PD xmm xmm xmm -// VFNMADD132PD m128 xmm xmm -// VFNMADD132PD ymm ymm ymm -// VFNMADD132PD m256 ymm ymm -func VFNMADD132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD132PD: bad operands") -} - -// VFNMADD132PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132PS xmm xmm xmm -// VFNMADD132PS m128 xmm xmm -// VFNMADD132PS ymm ymm ymm -// VFNMADD132PS m256 ymm ymm -func VFNMADD132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD132PS: bad operands") -} - -// VFNMADD132SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SD xmm xmm xmm -// VFNMADD132SD m64 xmm xmm -func VFNMADD132SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD132SD: bad operands") -} - -// VFNMADD132SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD132SS xmm xmm xmm -// VFNMADD132SS m32 xmm xmm -func VFNMADD132SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD132SS: bad operands") -} - -// VFNMADD213PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PD xmm xmm xmm -// VFNMADD213PD m128 xmm xmm -// VFNMADD213PD ymm ymm ymm -// VFNMADD213PD m256 ymm ymm -func VFNMADD213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD213PD: bad operands") -} - -// VFNMADD213PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213PS xmm xmm xmm -// VFNMADD213PS m128 xmm xmm -// VFNMADD213PS ymm ymm ymm -// VFNMADD213PS m256 ymm ymm -func VFNMADD213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD213PS: bad operands") -} - -// VFNMADD213SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SD xmm xmm xmm -// VFNMADD213SD m64 xmm xmm -func VFNMADD213SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD213SD: bad operands") -} - -// VFNMADD213SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD213SS xmm xmm xmm -// VFNMADD213SS m32 xmm xmm -func VFNMADD213SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD213SS: bad operands") -} - -// VFNMADD231PD: Fused Negative Multiply-Add of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PD xmm xmm xmm -// VFNMADD231PD m128 xmm xmm -// VFNMADD231PD ymm ymm ymm -// VFNMADD231PD m256 ymm ymm -func VFNMADD231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD231PD: bad operands") -} - -// VFNMADD231PS: Fused Negative Multiply-Add of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231PS xmm xmm xmm -// VFNMADD231PS m128 xmm xmm -// VFNMADD231PS ymm ymm ymm -// VFNMADD231PS m256 ymm ymm -func VFNMADD231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMADD231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMADD231PS: bad operands") -} - -// VFNMADD231SD: Fused Negative Multiply-Add of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SD xmm xmm xmm -// VFNMADD231SD m64 xmm xmm -func VFNMADD231SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD231SD: bad operands") -} - -// VFNMADD231SS: Fused Negative Multiply-Add of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMADD231SS xmm xmm xmm -// VFNMADD231SS m32 xmm xmm -func VFNMADD231SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMADD231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMADD231SS: bad operands") -} - -// VFNMSUB132PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PD xmm xmm xmm -// VFNMSUB132PD m128 xmm xmm -// VFNMSUB132PD ymm ymm ymm -// VFNMSUB132PD m256 ymm ymm -func VFNMSUB132PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB132PD: bad operands") -} - -// VFNMSUB132PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132PS xmm xmm xmm -// VFNMSUB132PS m128 xmm xmm -// VFNMSUB132PS ymm ymm ymm -// VFNMSUB132PS m256 ymm ymm -func VFNMSUB132PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB132PS: bad operands") -} - -// VFNMSUB132SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SD xmm xmm xmm -// VFNMSUB132SD m64 xmm xmm -func VFNMSUB132SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB132SD: bad operands") -} - -// VFNMSUB132SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB132SS xmm xmm xmm -// VFNMSUB132SS m32 xmm xmm -func VFNMSUB132SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB132SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB132SS: bad operands") -} - -// VFNMSUB213PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PD xmm xmm xmm -// VFNMSUB213PD m128 xmm xmm -// VFNMSUB213PD ymm ymm ymm -// VFNMSUB213PD m256 ymm ymm -func VFNMSUB213PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB213PD: bad operands") -} - -// VFNMSUB213PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213PS xmm xmm xmm -// VFNMSUB213PS m128 xmm xmm -// VFNMSUB213PS ymm ymm ymm -// VFNMSUB213PS m256 ymm ymm -func VFNMSUB213PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB213PS: bad operands") -} - -// VFNMSUB213SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SD xmm xmm xmm -// VFNMSUB213SD m64 xmm xmm -func VFNMSUB213SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB213SD: bad operands") -} - -// VFNMSUB213SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB213SS xmm xmm xmm -// VFNMSUB213SS m32 xmm xmm -func VFNMSUB213SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB213SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB213SS: bad operands") -} - -// VFNMSUB231PD: Fused Negative Multiply-Subtract of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PD xmm xmm xmm -// VFNMSUB231PD m128 xmm xmm -// VFNMSUB231PD ymm ymm ymm -// VFNMSUB231PD m256 ymm ymm -func VFNMSUB231PD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB231PD: bad operands") -} - -// VFNMSUB231PS: Fused Negative Multiply-Subtract of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231PS xmm xmm xmm -// VFNMSUB231PS m128 xmm xmm -// VFNMSUB231PS ymm ymm ymm -// VFNMSUB231PS m256 ymm ymm -func VFNMSUB231PS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231PS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy, xy1}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VFNMSUB231PS: bad operands") -} - -// VFNMSUB231SD: Fused Negative Multiply-Subtract of Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SD xmm xmm xmm -// VFNMSUB231SD m64 xmm xmm -func VFNMSUB231SD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231SD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB231SD: bad operands") -} - -// VFNMSUB231SS: Fused Negative Multiply-Subtract of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VFNMSUB231SS xmm xmm xmm -// VFNMSUB231SS m32 xmm xmm -func VFNMSUB231SS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VFNMSUB231SS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x, x1}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VFNMSUB231SS: bad operands") -} - -// VGATHERDPD: Gather Packed Double-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPD xmm vm32x xmm -// VGATHERDPD ymm vm32x ymm -func VGATHERDPD(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM32X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERDPD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM32X(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERDPD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VGATHERDPD: bad operands") -} - -// VGATHERDPS: Gather Packed Single-Precision Floating-Point Values Using Signed Doubleword Indices. -// -// Forms: -// -// VGATHERDPS xmm vm32x xmm -// VGATHERDPS ymm vm32y ymm -func VGATHERDPS(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM32X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERDPS", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM32Y(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERDPS", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VGATHERDPS: bad operands") -} - -// VGATHERQPD: Gather Packed Double-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPD xmm vm64x xmm -// VGATHERQPD ymm vm64y ymm -func VGATHERQPD(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM64X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERQPD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM64Y(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VGATHERQPD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VGATHERQPD: bad operands") -} - -// VGATHERQPS: Gather Packed Single-Precision Floating-Point Values Using Signed Quadword Indices. -// -// Forms: -// -// VGATHERQPS xmm vm64x xmm -// VGATHERQPS xmm vm64y xmm -func VGATHERQPS(x, v, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsVM64X(v) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VGATHERQPS", - Operands: []operand.Op{x, v, x1}, - Inputs: []operand.Op{x, v, x1}, - Outputs: []operand.Op{x, x1}, - }, nil - case operand.IsXMM(x) && operand.IsVM64Y(v) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VGATHERQPS", - Operands: []operand.Op{x, v, x1}, - Inputs: []operand.Op{x, v, x1}, - Outputs: []operand.Op{x, x1}, - }, nil - } - return nil, errors.New("VGATHERQPS: bad operands") -} - -// VHADDPD: Packed Double-FP Horizontal Add. -// -// Forms: -// -// VHADDPD xmm xmm xmm -// VHADDPD m128 xmm xmm -// VHADDPD ymm ymm ymm -// VHADDPD m256 ymm ymm -func VHADDPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VHADDPD: bad operands") -} - -// VHADDPS: Packed Single-FP Horizontal Add. -// -// Forms: -// -// VHADDPS xmm xmm xmm -// VHADDPS m128 xmm xmm -// VHADDPS ymm ymm ymm -// VHADDPS m256 ymm ymm -func VHADDPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHADDPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VHADDPS: bad operands") -} - -// VHSUBPD: Packed Double-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPD xmm xmm xmm -// VHSUBPD m128 xmm xmm -// VHSUBPD ymm ymm ymm -// VHSUBPD m256 ymm ymm -func VHSUBPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VHSUBPD: bad operands") -} - -// VHSUBPS: Packed Single-FP Horizontal Subtract. -// -// Forms: -// -// VHSUBPS xmm xmm xmm -// VHSUBPS m128 xmm xmm -// VHSUBPS ymm ymm ymm -// VHSUBPS m256 ymm ymm -func VHSUBPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VHSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VHSUBPS: bad operands") -} - -// VINSERTF128: Insert Packed Floating-Point Values. -// -// Forms: -// -// VINSERTF128 imm8 xmm ymm ymm -// VINSERTF128 imm8 m128 ymm ymm -func VINSERTF128(i, mx, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VINSERTF128", - Operands: []operand.Op{i, mx, y, y1}, - Inputs: []operand.Op{mx, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VINSERTF128", - Operands: []operand.Op{i, mx, y, y1}, - Inputs: []operand.Op{mx, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VINSERTF128: bad operands") -} - -// VINSERTI128: Insert Packed Integer Values. -// -// Forms: -// -// VINSERTI128 imm8 xmm ymm ymm -// VINSERTI128 imm8 m128 ymm ymm -func VINSERTI128(i, mx, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VINSERTI128", - Operands: []operand.Op{i, mx, y, y1}, - Inputs: []operand.Op{mx, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VINSERTI128", - Operands: []operand.Op{i, mx, y, y1}, - Inputs: []operand.Op{mx, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VINSERTI128: bad operands") -} - -// VINSERTPS: Insert Packed Single Precision Floating-Point Value. -// -// Forms: -// -// VINSERTPS imm8 xmm xmm xmm -// VINSERTPS imm8 m32 xmm xmm -func VINSERTPS(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VINSERTPS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VINSERTPS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VINSERTPS: bad operands") -} - -// VLDDQU: Load Unaligned Integer 128 Bits. -// -// Forms: -// -// VLDDQU m128 xmm -// VLDDQU m256 ymm -func VLDDQU(m, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VLDDQU", - Operands: []operand.Op{m, xy}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(m) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VLDDQU", - Operands: []operand.Op{m, xy}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VLDDQU: bad operands") -} - -// VLDMXCSR: Load MXCSR Register. -// -// Forms: -// -// VLDMXCSR m32 -func VLDMXCSR(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(m): - return &intrep.Instruction{ - Opcode: "VLDMXCSR", - Operands: []operand.Op{m}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VLDMXCSR: bad operands") -} - -// VMASKMOVDQU: Store Selected Bytes of Double Quadword. -// -// Forms: -// -// VMASKMOVDQU xmm xmm -func VMASKMOVDQU(x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMASKMOVDQU", - Operands: []operand.Op{x, x1}, - Inputs: []operand.Op{x, x1, reg.RDI}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VMASKMOVDQU: bad operands") -} - -// VMASKMOVPD: Conditional Move Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPD m128 xmm xmm -// VMASKMOVPD m256 ymm ymm -// VMASKMOVPD xmm xmm m128 -// VMASKMOVPD ymm ymm m256 -func VMASKMOVPD(mxy, xy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMASKMOVPD: bad operands") -} - -// VMASKMOVPS: Conditional Move Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMASKMOVPS m128 xmm xmm -// VMASKMOVPS m256 ymm ymm -// VMASKMOVPS xmm xmm m128 -// VMASKMOVPS ymm ymm m256 -func VMASKMOVPS(mxy, xy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPS", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPS", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPS", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMASKMOVPS", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMASKMOVPS: bad operands") -} - -// VMAXPD: Return Maximum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPD xmm xmm xmm -// VMAXPD m128 xmm xmm -// VMAXPD ymm ymm ymm -// VMAXPD m256 ymm ymm -func VMAXPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMAXPD: bad operands") -} - -// VMAXPS: Return Maximum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMAXPS xmm xmm xmm -// VMAXPS m128 xmm xmm -// VMAXPS ymm ymm ymm -// VMAXPS m256 ymm ymm -func VMAXPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMAXPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMAXPS: bad operands") -} - -// VMAXSD: Return Maximum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSD xmm xmm xmm -// VMAXSD m64 xmm xmm -func VMAXSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMAXSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMAXSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMAXSD: bad operands") -} - -// VMAXSS: Return Maximum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMAXSS xmm xmm xmm -// VMAXSS m32 xmm xmm -func VMAXSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMAXSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMAXSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMAXSS: bad operands") -} - -// VMINPD: Return Minimum Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMINPD xmm xmm xmm -// VMINPD m128 xmm xmm -// VMINPD ymm ymm ymm -// VMINPD m256 ymm ymm -func VMINPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMINPD: bad operands") -} - -// VMINPS: Return Minimum Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMINPS xmm xmm xmm -// VMINPS m128 xmm xmm -// VMINPS ymm ymm ymm -// VMINPS m256 ymm ymm -func VMINPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMINPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMINPS: bad operands") -} - -// VMINSD: Return Minimum Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMINSD xmm xmm xmm -// VMINSD m64 xmm xmm -func VMINSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMINSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMINSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMINSD: bad operands") -} - -// VMINSS: Return Minimum Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VMINSS xmm xmm xmm -// VMINSS m32 xmm xmm -func VMINSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMINSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMINSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMINSS: bad operands") -} - -// VMOVAPD: Move Aligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPD xmm xmm -// VMOVAPD m128 xmm -// VMOVAPD ymm ymm -// VMOVAPD m256 ymm -// VMOVAPD xmm m128 -// VMOVAPD ymm m256 -func VMOVAPD(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVAPD: bad operands") -} - -// VMOVAPS: Move Aligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVAPS xmm xmm -// VMOVAPS m128 xmm -// VMOVAPS ymm ymm -// VMOVAPS m256 ymm -// VMOVAPS xmm m128 -// VMOVAPS ymm m256 -func VMOVAPS(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVAPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVAPS: bad operands") -} - -// VMOVD: Move Doubleword. -// -// Forms: -// -// VMOVD xmm r32 -// VMOVD r32 xmm -// VMOVD m32 xmm -// VMOVD xmm m32 -func VMOVD(mrx, mrx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mrx) && operand.IsR32(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVD", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsR32(mrx) && operand.IsXMM(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVD", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsM32(mrx) && operand.IsXMM(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVD", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsXMM(mrx) && operand.IsM32(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVD", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - } - return nil, errors.New("VMOVD: bad operands") -} - -// VMOVDDUP: Move One Double-FP and Duplicate. -// -// Forms: -// -// VMOVDDUP xmm xmm -// VMOVDDUP m64 xmm -// VMOVDDUP ymm ymm -// VMOVDDUP m256 ymm -func VMOVDDUP(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVDDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVDDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVDDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVDDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VMOVDDUP: bad operands") -} - -// VMOVDQA: Move Aligned Double Quadword. -// -// Forms: -// -// VMOVDQA xmm xmm -// VMOVDQA m128 xmm -// VMOVDQA ymm ymm -// VMOVDQA m256 ymm -// VMOVDQA xmm m128 -// VMOVDQA ymm m256 -func VMOVDQA(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQA", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVDQA: bad operands") -} - -// VMOVDQU: Move Unaligned Double Quadword. -// -// Forms: -// -// VMOVDQU xmm xmm -// VMOVDQU m128 xmm -// VMOVDQU ymm ymm -// VMOVDQU m256 ymm -// VMOVDQU xmm m128 -// VMOVDQU ymm m256 -func VMOVDQU(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVDQU", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVDQU: bad operands") -} - -// VMOVHLPS: Move Packed Single-Precision Floating-Point Values High to Low. -// -// Forms: -// -// VMOVHLPS xmm xmm xmm -func VMOVHLPS(x, x1, x2 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1) && operand.IsXMM(x2): - return &intrep.Instruction{ - Opcode: "VMOVHLPS", - Operands: []operand.Op{x, x1, x2}, - Inputs: []operand.Op{x, x1}, - Outputs: []operand.Op{x2}, - }, nil - } - return nil, errors.New("VMOVHLPS: bad operands") -} - -// VMOVHPD: Move High Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVHPD xmm m64 -// VMOVHPD m64 xmm xmm -func VMOVHPD(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVHPD", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsM64(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVHPD", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVHPD: bad operands") -} - -// VMOVHPS: Move High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVHPS xmm m64 -// VMOVHPS m64 xmm xmm -func VMOVHPS(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVHPS", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsM64(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVHPS", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVHPS: bad operands") -} - -// VMOVLHPS: Move Packed Single-Precision Floating-Point Values Low to High. -// -// Forms: -// -// VMOVLHPS xmm xmm xmm -func VMOVLHPS(x, x1, x2 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsXMM(x1) && operand.IsXMM(x2): - return &intrep.Instruction{ - Opcode: "VMOVLHPS", - Operands: []operand.Op{x, x1, x2}, - Inputs: []operand.Op{x, x1}, - Outputs: []operand.Op{x2}, - }, nil - } - return nil, errors.New("VMOVLHPS: bad operands") -} - -// VMOVLPD: Move Low Packed Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVLPD xmm m64 -// VMOVLPD m64 xmm xmm -func VMOVLPD(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVLPD", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsM64(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVLPD", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVLPD: bad operands") -} - -// VMOVLPS: Move Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVLPS xmm m64 -// VMOVLPS m64 xmm xmm -func VMOVLPS(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVLPS", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsM64(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVLPS", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVLPS: bad operands") -} - -// VMOVMSKPD: Extract Packed Double-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPD xmm r32 -// VMOVMSKPD ymm r32 -func VMOVMSKPD(xy, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VMOVMSKPD", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsYMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VMOVMSKPD", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VMOVMSKPD: bad operands") -} - -// VMOVMSKPS: Extract Packed Single-Precision Floating-Point Sign Mask. -// -// Forms: -// -// VMOVMSKPS xmm r32 -// VMOVMSKPS ymm r32 -func VMOVMSKPS(xy, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VMOVMSKPS", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsYMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VMOVMSKPS", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VMOVMSKPS: bad operands") -} - -// VMOVNTDQ: Store Double Quadword Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTDQ xmm m128 -// VMOVNTDQ ymm m256 -func VMOVNTDQ(xy, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "VMOVNTDQ", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(m): - return &intrep.Instruction{ - Opcode: "VMOVNTDQ", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("VMOVNTDQ: bad operands") -} - -// VMOVNTDQA: Load Double Quadword Non-Temporal Aligned Hint. -// -// Forms: -// -// VMOVNTDQA m128 xmm -// VMOVNTDQA m256 ymm -func VMOVNTDQA(m, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(m) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVNTDQA", - Operands: []operand.Op{m, xy}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(m) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVNTDQA", - Operands: []operand.Op{m, xy}, - Inputs: []operand.Op{m}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VMOVNTDQA: bad operands") -} - -// VMOVNTPD: Store Packed Double-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPD xmm m128 -// VMOVNTPD ymm m256 -func VMOVNTPD(xy, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "VMOVNTPD", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(m): - return &intrep.Instruction{ - Opcode: "VMOVNTPD", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("VMOVNTPD: bad operands") -} - -// VMOVNTPS: Store Packed Single-Precision Floating-Point Values Using Non-Temporal Hint. -// -// Forms: -// -// VMOVNTPS xmm m128 -// VMOVNTPS ymm m256 -func VMOVNTPS(xy, m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsM128(m): - return &intrep.Instruction{ - Opcode: "VMOVNTPS", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(m): - return &intrep.Instruction{ - Opcode: "VMOVNTPS", - Operands: []operand.Op{xy, m}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("VMOVNTPS: bad operands") -} - -// VMOVQ: Move Quadword. -// -// Forms: -// -// VMOVQ xmm r64 -// VMOVQ r64 xmm -// VMOVQ xmm xmm -// VMOVQ m64 xmm -// VMOVQ xmm m64 -func VMOVQ(mrx, mrx1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mrx) && operand.IsR64(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVQ", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsR64(mrx) && operand.IsXMM(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVQ", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsXMM(mrx) && operand.IsXMM(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVQ", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsM64(mrx) && operand.IsXMM(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVQ", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - case operand.IsXMM(mrx) && operand.IsM64(mrx1): - return &intrep.Instruction{ - Opcode: "VMOVQ", - Operands: []operand.Op{mrx, mrx1}, - Inputs: []operand.Op{mrx}, - Outputs: []operand.Op{mrx1}, - }, nil - } - return nil, errors.New("VMOVQ: bad operands") -} - -// VMOVSD: Move Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VMOVSD m64 xmm -// VMOVSD xmm m64 -// VMOVSD xmm xmm xmm -func VMOVSD(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsM64(ops[0]) && operand.IsXMM(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVSD", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM64(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVSD", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsXMM(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVSD", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVSD: bad operands") -} - -// VMOVSHDUP: Move Packed Single-FP High and Duplicate. -// -// Forms: -// -// VMOVSHDUP xmm xmm -// VMOVSHDUP m128 xmm -// VMOVSHDUP ymm ymm -// VMOVSHDUP m256 ymm -func VMOVSHDUP(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSHDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSHDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSHDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSHDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VMOVSHDUP: bad operands") -} - -// VMOVSLDUP: Move Packed Single-FP Low and Duplicate. -// -// Forms: -// -// VMOVSLDUP xmm xmm -// VMOVSLDUP m128 xmm -// VMOVSLDUP ymm ymm -// VMOVSLDUP m256 ymm -func VMOVSLDUP(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSLDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSLDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSLDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VMOVSLDUP", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VMOVSLDUP: bad operands") -} - -// VMOVSS: Move Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVSS m32 xmm -// VMOVSS xmm m32 -// VMOVSS xmm xmm xmm -func VMOVSS(ops ...operand.Op) (*intrep.Instruction, error) { - switch { - case len(ops) == 2 && operand.IsM32(ops[0]) && operand.IsXMM(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVSS", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 2 && operand.IsXMM(ops[0]) && operand.IsM32(ops[1]): - return &intrep.Instruction{ - Opcode: "VMOVSS", - Operands: ops, - Inputs: []operand.Op{ops[0]}, - Outputs: []operand.Op{ops[1]}, - }, nil - case len(ops) == 3 && operand.IsXMM(ops[0]) && operand.IsXMM(ops[1]) && operand.IsXMM(ops[2]): - return &intrep.Instruction{ - Opcode: "VMOVSS", - Operands: ops, - Inputs: []operand.Op{ops[0], ops[1]}, - Outputs: []operand.Op{ops[2]}, - }, nil - } - return nil, errors.New("VMOVSS: bad operands") -} - -// VMOVUPD: Move Unaligned Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPD xmm xmm -// VMOVUPD m128 xmm -// VMOVUPD ymm ymm -// VMOVUPD m256 ymm -// VMOVUPD xmm m128 -// VMOVUPD ymm m256 -func VMOVUPD(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPD", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVUPD: bad operands") -} - -// VMOVUPS: Move Unaligned Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMOVUPS xmm xmm -// VMOVUPS m128 xmm -// VMOVUPS ymm ymm -// VMOVUPS m256 ymm -// VMOVUPS xmm m128 -// VMOVUPS ymm m256 -func VMOVUPS(mxy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VMOVUPS", - Operands: []operand.Op{mxy, mxy1}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VMOVUPS: bad operands") -} - -// VMPSADBW: Compute Multiple Packed Sums of Absolute Difference. -// -// Forms: -// -// VMPSADBW imm8 xmm xmm xmm -// VMPSADBW imm8 m128 xmm xmm -// VMPSADBW imm8 ymm ymm ymm -// VMPSADBW imm8 m256 ymm ymm -func VMPSADBW(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMPSADBW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMPSADBW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMPSADBW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMPSADBW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMPSADBW: bad operands") -} - -// VMULPD: Multiply Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULPD xmm xmm xmm -// VMULPD m128 xmm xmm -// VMULPD ymm ymm ymm -// VMULPD m256 ymm ymm -func VMULPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMULPD: bad operands") -} - -// VMULPS: Multiply Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULPS xmm xmm xmm -// VMULPS m128 xmm xmm -// VMULPS ymm ymm ymm -// VMULPS m256 ymm ymm -func VMULPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VMULPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VMULPS: bad operands") -} - -// VMULSD: Multiply Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VMULSD xmm xmm xmm -// VMULSD m64 xmm xmm -func VMULSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMULSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMULSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMULSD: bad operands") -} - -// VMULSS: Multiply Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VMULSS xmm xmm xmm -// VMULSS m32 xmm xmm -func VMULSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMULSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VMULSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VMULSS: bad operands") -} - -// VORPD: Bitwise Logical OR of Double-Precision Floating-Point Values. -// -// Forms: -// -// VORPD xmm xmm xmm -// VORPD m128 xmm xmm -// VORPD ymm ymm ymm -// VORPD m256 ymm ymm -func VORPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VORPD: bad operands") -} - -// VORPS: Bitwise Logical OR of Single-Precision Floating-Point Values. -// -// Forms: -// -// VORPS xmm xmm xmm -// VORPS m128 xmm xmm -// VORPS ymm ymm ymm -// VORPS m256 ymm ymm -func VORPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VORPS: bad operands") -} - -// VPABSB: Packed Absolute Value of Byte Integers. -// -// Forms: -// -// VPABSB xmm xmm -// VPABSB m128 xmm -// VPABSB ymm ymm -// VPABSB m256 ymm -func VPABSB(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSB", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSB", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSB", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSB", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPABSB: bad operands") -} - -// VPABSD: Packed Absolute Value of Doubleword Integers. -// -// Forms: -// -// VPABSD xmm xmm -// VPABSD m128 xmm -// VPABSD ymm ymm -// VPABSD m256 ymm -func VPABSD(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPABSD: bad operands") -} - -// VPABSW: Packed Absolute Value of Word Integers. -// -// Forms: -// -// VPABSW xmm xmm -// VPABSW m128 xmm -// VPABSW ymm ymm -// VPABSW m256 ymm -func VPABSW(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSW", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSW", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSW", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPABSW", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPABSW: bad operands") -} - -// VPACKSSDW: Pack Doublewords into Words with Signed Saturation. -// -// Forms: -// -// VPACKSSDW xmm xmm xmm -// VPACKSSDW m128 xmm xmm -// VPACKSSDW ymm ymm ymm -// VPACKSSDW m256 ymm ymm -func VPACKSSDW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPACKSSDW: bad operands") -} - -// VPACKSSWB: Pack Words into Bytes with Signed Saturation. -// -// Forms: -// -// VPACKSSWB xmm xmm xmm -// VPACKSSWB m128 xmm xmm -// VPACKSSWB ymm ymm ymm -// VPACKSSWB m256 ymm ymm -func VPACKSSWB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKSSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPACKSSWB: bad operands") -} - -// VPACKUSDW: Pack Doublewords into Words with Unsigned Saturation. -// -// Forms: -// -// VPACKUSDW xmm xmm xmm -// VPACKUSDW m128 xmm xmm -// VPACKUSDW ymm ymm ymm -// VPACKUSDW m256 ymm ymm -func VPACKUSDW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPACKUSDW: bad operands") -} - -// VPACKUSWB: Pack Words into Bytes with Unsigned Saturation. -// -// Forms: -// -// VPACKUSWB xmm xmm xmm -// VPACKUSWB m128 xmm xmm -// VPACKUSWB ymm ymm ymm -// VPACKUSWB m256 ymm ymm -func VPACKUSWB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPACKUSWB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPACKUSWB: bad operands") -} - -// VPADDB: Add Packed Byte Integers. -// -// Forms: -// -// VPADDB xmm xmm xmm -// VPADDB m128 xmm xmm -// VPADDB ymm ymm ymm -// VPADDB m256 ymm ymm -func VPADDB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDB: bad operands") -} - -// VPADDD: Add Packed Doubleword Integers. -// -// Forms: -// -// VPADDD xmm xmm xmm -// VPADDD m128 xmm xmm -// VPADDD ymm ymm ymm -// VPADDD m256 ymm ymm -func VPADDD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDD: bad operands") -} - -// VPADDQ: Add Packed Quadword Integers. -// -// Forms: -// -// VPADDQ xmm xmm xmm -// VPADDQ m128 xmm xmm -// VPADDQ ymm ymm ymm -// VPADDQ m256 ymm ymm -func VPADDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDQ: bad operands") -} - -// VPADDSB: Add Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPADDSB xmm xmm xmm -// VPADDSB m128 xmm xmm -// VPADDSB ymm ymm ymm -// VPADDSB m256 ymm ymm -func VPADDSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDSB: bad operands") -} - -// VPADDSW: Add Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPADDSW xmm xmm xmm -// VPADDSW m128 xmm xmm -// VPADDSW ymm ymm ymm -// VPADDSW m256 ymm ymm -func VPADDSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDSW: bad operands") -} - -// VPADDUSB: Add Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSB xmm xmm xmm -// VPADDUSB m128 xmm xmm -// VPADDUSB ymm ymm ymm -// VPADDUSB m256 ymm ymm -func VPADDUSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDUSB: bad operands") -} - -// VPADDUSW: Add Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPADDUSW xmm xmm xmm -// VPADDUSW m128 xmm xmm -// VPADDUSW ymm ymm ymm -// VPADDUSW m256 ymm ymm -func VPADDUSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDUSW: bad operands") -} - -// VPADDW: Add Packed Word Integers. -// -// Forms: -// -// VPADDW xmm xmm xmm -// VPADDW m128 xmm xmm -// VPADDW ymm ymm ymm -// VPADDW m256 ymm ymm -func VPADDW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPADDW: bad operands") -} - -// VPALIGNR: Packed Align Right. -// -// Forms: -// -// VPALIGNR imm8 xmm xmm xmm -// VPALIGNR imm8 m128 xmm xmm -// VPALIGNR imm8 ymm ymm ymm -// VPALIGNR imm8 m256 ymm ymm -func VPALIGNR(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPALIGNR", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPALIGNR", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPALIGNR", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPALIGNR", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPALIGNR: bad operands") -} - -// VPAND: Packed Bitwise Logical AND. -// -// Forms: -// -// VPAND xmm xmm xmm -// VPAND m128 xmm xmm -// VPAND ymm ymm ymm -// VPAND m256 ymm ymm -func VPAND(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPAND: bad operands") -} - -// VPANDN: Packed Bitwise Logical AND NOT. -// -// Forms: -// -// VPANDN xmm xmm xmm -// VPANDN m128 xmm xmm -// VPANDN ymm ymm ymm -// VPANDN m256 ymm ymm -func VPANDN(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPANDN", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPANDN", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPANDN", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPANDN", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPANDN: bad operands") -} - -// VPAVGB: Average Packed Byte Integers. -// -// Forms: -// -// VPAVGB xmm xmm xmm -// VPAVGB m128 xmm xmm -// VPAVGB ymm ymm ymm -// VPAVGB m256 ymm ymm -func VPAVGB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPAVGB: bad operands") -} - -// VPAVGW: Average Packed Word Integers. -// -// Forms: -// -// VPAVGW xmm xmm xmm -// VPAVGW m128 xmm xmm -// VPAVGW ymm ymm ymm -// VPAVGW m256 ymm ymm -func VPAVGW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPAVGW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPAVGW: bad operands") -} - -// VPBLENDD: Blend Packed Doublewords. -// -// Forms: -// -// VPBLENDD imm8 xmm xmm xmm -// VPBLENDD imm8 m128 xmm xmm -// VPBLENDD imm8 ymm ymm ymm -// VPBLENDD imm8 m256 ymm ymm -func VPBLENDD(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPBLENDD: bad operands") -} - -// VPBLENDVB: Variable Blend Packed Bytes. -// -// Forms: -// -// VPBLENDVB xmm xmm xmm xmm -// VPBLENDVB xmm m128 xmm xmm -// VPBLENDVB ymm ymm ymm ymm -// VPBLENDVB ymm m256 ymm ymm -func VPBLENDVB(xy, mxy, xy1, xy2 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsXMM(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VPBLENDVB", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsXMM(xy) && operand.IsM128(mxy) && operand.IsXMM(xy1) && operand.IsXMM(xy2): - return &intrep.Instruction{ - Opcode: "VPBLENDVB", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsYMM(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VPBLENDVB", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - case operand.IsYMM(xy) && operand.IsM256(mxy) && operand.IsYMM(xy1) && operand.IsYMM(xy2): - return &intrep.Instruction{ - Opcode: "VPBLENDVB", - Operands: []operand.Op{xy, mxy, xy1, xy2}, - Inputs: []operand.Op{xy, mxy, xy1}, - Outputs: []operand.Op{xy2}, - }, nil - } - return nil, errors.New("VPBLENDVB: bad operands") -} - -// VPBLENDW: Blend Packed Words. -// -// Forms: -// -// VPBLENDW imm8 xmm xmm xmm -// VPBLENDW imm8 m128 xmm xmm -// VPBLENDW imm8 ymm ymm ymm -// VPBLENDW imm8 m256 ymm ymm -func VPBLENDW(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPBLENDW", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPBLENDW: bad operands") -} - -// VPBROADCASTB: Broadcast Byte Integer. -// -// Forms: -// -// VPBROADCASTB xmm xmm -// VPBROADCASTB m8 xmm -// VPBROADCASTB xmm ymm -// VPBROADCASTB m8 ymm -func VPBROADCASTB(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTB", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM8(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTB", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTB", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM8(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTB", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPBROADCASTB: bad operands") -} - -// VPBROADCASTD: Broadcast Doubleword Integer. -// -// Forms: -// -// VPBROADCASTD xmm xmm -// VPBROADCASTD m32 xmm -// VPBROADCASTD xmm ymm -// VPBROADCASTD m32 ymm -func VPBROADCASTD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPBROADCASTD: bad operands") -} - -// VPBROADCASTQ: Broadcast Quadword Integer. -// -// Forms: -// -// VPBROADCASTQ xmm xmm -// VPBROADCASTQ m64 xmm -// VPBROADCASTQ xmm ymm -// VPBROADCASTQ m64 ymm -func VPBROADCASTQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPBROADCASTQ: bad operands") -} - -// VPBROADCASTW: Broadcast Word Integer. -// -// Forms: -// -// VPBROADCASTW xmm xmm -// VPBROADCASTW m16 xmm -// VPBROADCASTW xmm ymm -// VPBROADCASTW m16 ymm -func VPBROADCASTW(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM16(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM16(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPBROADCASTW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPBROADCASTW: bad operands") -} - -// VPCLMULQDQ: Carry-Less Quadword Multiplication. -// -// Forms: -// -// VPCLMULQDQ imm8 xmm xmm xmm -// VPCLMULQDQ imm8 m128 xmm xmm -func VPCLMULQDQ(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPCLMULQDQ", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPCLMULQDQ", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VPCLMULQDQ: bad operands") -} - -// VPCMPEQB: Compare Packed Byte Data for Equality. -// -// Forms: -// -// VPCMPEQB xmm xmm xmm -// VPCMPEQB m128 xmm xmm -// VPCMPEQB ymm ymm ymm -// VPCMPEQB m256 ymm ymm -func VPCMPEQB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPEQB: bad operands") -} - -// VPCMPEQD: Compare Packed Doubleword Data for Equality. -// -// Forms: -// -// VPCMPEQD xmm xmm xmm -// VPCMPEQD m128 xmm xmm -// VPCMPEQD ymm ymm ymm -// VPCMPEQD m256 ymm ymm -func VPCMPEQD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPEQD: bad operands") -} - -// VPCMPEQQ: Compare Packed Quadword Data for Equality. -// -// Forms: -// -// VPCMPEQQ xmm xmm xmm -// VPCMPEQQ m128 xmm xmm -// VPCMPEQQ ymm ymm ymm -// VPCMPEQQ m256 ymm ymm -func VPCMPEQQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPEQQ: bad operands") -} - -// VPCMPEQW: Compare Packed Word Data for Equality. -// -// Forms: -// -// VPCMPEQW xmm xmm xmm -// VPCMPEQW m128 xmm xmm -// VPCMPEQW ymm ymm ymm -// VPCMPEQW m256 ymm ymm -func VPCMPEQW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPEQW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPEQW: bad operands") -} - -// VPCMPESTRI: Packed Compare Explicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPESTRI imm8 xmm xmm -// VPCMPESTRI imm8 m128 xmm -func VPCMPESTRI(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPESTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.ECX}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPESTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.ECX}, - }, nil - } - return nil, errors.New("VPCMPESTRI: bad operands") -} - -// VPCMPESTRM: Packed Compare Explicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPESTRM imm8 xmm xmm -// VPCMPESTRM imm8 m128 xmm -func VPCMPESTRM(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPESTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.X0}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPESTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x, reg.EAX, reg.EDX}, - Outputs: []operand.Op{reg.X0}, - }, nil - } - return nil, errors.New("VPCMPESTRM: bad operands") -} - -// VPCMPGTB: Compare Packed Signed Byte Integers for Greater Than. -// -// Forms: -// -// VPCMPGTB xmm xmm xmm -// VPCMPGTB m128 xmm xmm -// VPCMPGTB ymm ymm ymm -// VPCMPGTB m256 ymm ymm -func VPCMPGTB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPGTB: bad operands") -} - -// VPCMPGTD: Compare Packed Signed Doubleword Integers for Greater Than. -// -// Forms: -// -// VPCMPGTD xmm xmm xmm -// VPCMPGTD m128 xmm xmm -// VPCMPGTD ymm ymm ymm -// VPCMPGTD m256 ymm ymm -func VPCMPGTD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPGTD: bad operands") -} - -// VPCMPGTQ: Compare Packed Data for Greater Than. -// -// Forms: -// -// VPCMPGTQ xmm xmm xmm -// VPCMPGTQ m128 xmm xmm -// VPCMPGTQ ymm ymm ymm -// VPCMPGTQ m256 ymm ymm -func VPCMPGTQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPGTQ: bad operands") -} - -// VPCMPGTW: Compare Packed Signed Word Integers for Greater Than. -// -// Forms: -// -// VPCMPGTW xmm xmm xmm -// VPCMPGTW m128 xmm xmm -// VPCMPGTW ymm ymm ymm -// VPCMPGTW m256 ymm ymm -func VPCMPGTW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPCMPGTW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPCMPGTW: bad operands") -} - -// VPCMPISTRI: Packed Compare Implicit Length Strings, Return Index. -// -// Forms: -// -// VPCMPISTRI imm8 xmm xmm -// VPCMPISTRI imm8 m128 xmm -func VPCMPISTRI(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPISTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.ECX}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPISTRI", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.ECX}, - }, nil - } - return nil, errors.New("VPCMPISTRI: bad operands") -} - -// VPCMPISTRM: Packed Compare Implicit Length Strings, Return Mask. -// -// Forms: -// -// VPCMPISTRM imm8 xmm xmm -// VPCMPISTRM imm8 m128 xmm -func VPCMPISTRM(i, mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPISTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.X0}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPCMPISTRM", - Operands: []operand.Op{i, mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{reg.X0}, - }, nil - } - return nil, errors.New("VPCMPISTRM: bad operands") -} - -// VPERM2F128: Permute Floating-Point Values. -// -// Forms: -// -// VPERM2F128 imm8 ymm ymm ymm -// VPERM2F128 imm8 m256 ymm ymm -func VPERM2F128(i, my, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERM2F128", - Operands: []operand.Op{i, my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERM2F128", - Operands: []operand.Op{i, my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VPERM2F128: bad operands") -} - -// VPERM2I128: Permute 128-Bit Integer Values. -// -// Forms: -// -// VPERM2I128 imm8 ymm ymm ymm -// VPERM2I128 imm8 m256 ymm ymm -func VPERM2I128(i, my, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERM2I128", - Operands: []operand.Op{i, my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERM2I128", - Operands: []operand.Op{i, my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VPERM2I128: bad operands") -} - -// VPERMD: Permute Doubleword Integers. -// -// Forms: -// -// VPERMD ymm ymm ymm -// VPERMD m256 ymm ymm -func VPERMD(my, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsYMM(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERMD", - Operands: []operand.Op{my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsM256(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERMD", - Operands: []operand.Op{my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VPERMD: bad operands") -} - -// VPERMILPD: Permute Double-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPD imm8 xmm xmm -// VPERMILPD xmm xmm xmm -// VPERMILPD m128 xmm xmm -// VPERMILPD imm8 m128 xmm -// VPERMILPD imm8 ymm ymm -// VPERMILPD ymm ymm ymm -// VPERMILPD m256 ymm ymm -// VPERMILPD imm8 m256 ymm -func VPERMILPD(imxy, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPD", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPERMILPD: bad operands") -} - -// VPERMILPS: Permute Single-Precision Floating-Point Values. -// -// Forms: -// -// VPERMILPS imm8 xmm xmm -// VPERMILPS xmm xmm xmm -// VPERMILPS m128 xmm xmm -// VPERMILPS imm8 m128 xmm -// VPERMILPS imm8 ymm ymm -// VPERMILPS ymm ymm ymm -// VPERMILPS m256 ymm ymm -// VPERMILPS imm8 m256 ymm -func VPERMILPS(imxy, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(imxy) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(imxy) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{imxy, mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(imxy) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPERMILPS", - Operands: []operand.Op{imxy, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPERMILPS: bad operands") -} - -// VPERMPD: Permute Double-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPD imm8 ymm ymm -// VPERMPD imm8 m256 ymm -func VPERMPD(i, my, y operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(my) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VPERMPD", - Operands: []operand.Op{i, my, y}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{y}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(my) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VPERMPD", - Operands: []operand.Op{i, my, y}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{y}, - }, nil - } - return nil, errors.New("VPERMPD: bad operands") -} - -// VPERMPS: Permute Single-Precision Floating-Point Elements. -// -// Forms: -// -// VPERMPS ymm ymm ymm -// VPERMPS m256 ymm ymm -func VPERMPS(my, y, y1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsYMM(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERMPS", - Operands: []operand.Op{my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - case operand.IsM256(my) && operand.IsYMM(y) && operand.IsYMM(y1): - return &intrep.Instruction{ - Opcode: "VPERMPS", - Operands: []operand.Op{my, y, y1}, - Inputs: []operand.Op{my, y}, - Outputs: []operand.Op{y1}, - }, nil - } - return nil, errors.New("VPERMPS: bad operands") -} - -// VPERMQ: Permute Quadword Integers. -// -// Forms: -// -// VPERMQ imm8 ymm ymm -// VPERMQ imm8 m256 ymm -func VPERMQ(i, my, y operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsYMM(my) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VPERMQ", - Operands: []operand.Op{i, my, y}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{y}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(my) && operand.IsYMM(y): - return &intrep.Instruction{ - Opcode: "VPERMQ", - Operands: []operand.Op{i, my, y}, - Inputs: []operand.Op{my}, - Outputs: []operand.Op{y}, - }, nil - } - return nil, errors.New("VPERMQ: bad operands") -} - -// VPEXTRB: Extract Byte. -// -// Forms: -// -// VPEXTRB imm8 xmm r32 -// VPEXTRB imm8 xmm m8 -func VPEXTRB(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRB", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRB", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("VPEXTRB: bad operands") -} - -// VPEXTRD: Extract Doubleword. -// -// Forms: -// -// VPEXTRD imm8 xmm r32 -// VPEXTRD imm8 xmm m32 -func VPEXTRD(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRD", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRD", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("VPEXTRD: bad operands") -} - -// VPEXTRQ: Extract Quadword. -// -// Forms: -// -// VPEXTRQ imm8 xmm r64 -// VPEXTRQ imm8 xmm m64 -func VPEXTRQ(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRQ", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRQ", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("VPEXTRQ: bad operands") -} - -// VPEXTRW: Extract Word. -// -// Forms: -// -// VPEXTRW imm8 xmm r32 -// VPEXTRW imm8 xmm m16 -func VPEXTRW(i, x, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRW", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(i) && operand.IsXMM(x) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "VPEXTRW", - Operands: []operand.Op{i, x, mr}, - Inputs: []operand.Op{x}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("VPEXTRW: bad operands") -} - -// VPGATHERDD: Gather Packed Doubleword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDD xmm vm32x xmm -// VPGATHERDD ymm vm32y ymm -func VPGATHERDD(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM32X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERDD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM32Y(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERDD", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VPGATHERDD: bad operands") -} - -// VPGATHERDQ: Gather Packed Quadword Values Using Signed Doubleword Indices. -// -// Forms: -// -// VPGATHERDQ xmm vm32x xmm -// VPGATHERDQ ymm vm32x ymm -func VPGATHERDQ(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM32X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERDQ", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM32X(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERDQ", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VPGATHERDQ: bad operands") -} - -// VPGATHERQD: Gather Packed Doubleword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQD xmm vm64x xmm -// VPGATHERQD xmm vm64y xmm -func VPGATHERQD(x, v, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(x) && operand.IsVM64X(v) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPGATHERQD", - Operands: []operand.Op{x, v, x1}, - Inputs: []operand.Op{x, v, x1}, - Outputs: []operand.Op{x, x1}, - }, nil - case operand.IsXMM(x) && operand.IsVM64Y(v) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPGATHERQD", - Operands: []operand.Op{x, v, x1}, - Inputs: []operand.Op{x, v, x1}, - Outputs: []operand.Op{x, x1}, - }, nil - } - return nil, errors.New("VPGATHERQD: bad operands") -} - -// VPGATHERQQ: Gather Packed Quadword Values Using Signed Quadword Indices. -// -// Forms: -// -// VPGATHERQQ xmm vm64x xmm -// VPGATHERQQ ymm vm64y ymm -func VPGATHERQQ(xy, v, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsVM64X(v) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERQQ", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - case operand.IsYMM(xy) && operand.IsVM64Y(v) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPGATHERQQ", - Operands: []operand.Op{xy, v, xy1}, - Inputs: []operand.Op{xy, v, xy1}, - Outputs: []operand.Op{xy, xy1}, - }, nil - } - return nil, errors.New("VPGATHERQQ: bad operands") -} - -// VPHADDD: Packed Horizontal Add Doubleword Integer. -// -// Forms: -// -// VPHADDD xmm xmm xmm -// VPHADDD m128 xmm xmm -// VPHADDD ymm ymm ymm -// VPHADDD m256 ymm ymm -func VPHADDD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHADDD: bad operands") -} - -// VPHADDSW: Packed Horizontal Add Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHADDSW xmm xmm xmm -// VPHADDSW m128 xmm xmm -// VPHADDSW ymm ymm ymm -// VPHADDSW m256 ymm ymm -func VPHADDSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHADDSW: bad operands") -} - -// VPHADDW: Packed Horizontal Add Word Integers. -// -// Forms: -// -// VPHADDW xmm xmm xmm -// VPHADDW m128 xmm xmm -// VPHADDW ymm ymm ymm -// VPHADDW m256 ymm ymm -func VPHADDW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHADDW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHADDW: bad operands") -} - -// VPHMINPOSUW: Packed Horizontal Minimum of Unsigned Word Integers. -// -// Forms: -// -// VPHMINPOSUW xmm xmm -// VPHMINPOSUW m128 xmm -func VPHMINPOSUW(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPHMINPOSUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VPHMINPOSUW", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("VPHMINPOSUW: bad operands") -} - -// VPHSUBD: Packed Horizontal Subtract Doubleword Integers. -// -// Forms: -// -// VPHSUBD xmm xmm xmm -// VPHSUBD m128 xmm xmm -// VPHSUBD ymm ymm ymm -// VPHSUBD m256 ymm ymm -func VPHSUBD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHSUBD: bad operands") -} - -// VPHSUBSW: Packed Horizontal Subtract Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPHSUBSW xmm xmm xmm -// VPHSUBSW m128 xmm xmm -// VPHSUBSW ymm ymm ymm -// VPHSUBSW m256 ymm ymm -func VPHSUBSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHSUBSW: bad operands") -} - -// VPHSUBW: Packed Horizontal Subtract Word Integers. -// -// Forms: -// -// VPHSUBW xmm xmm xmm -// VPHSUBW m128 xmm xmm -// VPHSUBW ymm ymm ymm -// VPHSUBW m256 ymm ymm -func VPHSUBW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPHSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPHSUBW: bad operands") -} - -// VPINSRB: Insert Byte. -// -// Forms: -// -// VPINSRB imm8 r32 xmm xmm -// VPINSRB imm8 m8 xmm xmm -func VPINSRB(i, mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRB", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM8(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRB", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VPINSRB: bad operands") -} - -// VPINSRD: Insert Doubleword. -// -// Forms: -// -// VPINSRD imm8 r32 xmm xmm -// VPINSRD imm8 m32 xmm xmm -func VPINSRD(i, mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRD", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRD", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VPINSRD: bad operands") -} - -// VPINSRQ: Insert Quadword. -// -// Forms: -// -// VPINSRQ imm8 r64 xmm xmm -// VPINSRQ imm8 m64 xmm xmm -func VPINSRQ(i, mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRQ", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRQ", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VPINSRQ: bad operands") -} - -// VPINSRW: Insert Word. -// -// Forms: -// -// VPINSRW imm8 r32 xmm xmm -// VPINSRW imm8 m16 xmm xmm -func VPINSRW(i, mr, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsR32(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRW", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM16(mr) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VPINSRW", - Operands: []operand.Op{i, mr, x, x1}, - Inputs: []operand.Op{mr, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VPINSRW: bad operands") -} - -// VPMADDUBSW: Multiply and Add Packed Signed and Unsigned Byte Integers. -// -// Forms: -// -// VPMADDUBSW xmm xmm xmm -// VPMADDUBSW m128 xmm xmm -// VPMADDUBSW ymm ymm ymm -// VPMADDUBSW m256 ymm ymm -func VPMADDUBSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMADDUBSW: bad operands") -} - -// VPMADDWD: Multiply and Add Packed Signed Word Integers. -// -// Forms: -// -// VPMADDWD xmm xmm xmm -// VPMADDWD m128 xmm xmm -// VPMADDWD ymm ymm ymm -// VPMADDWD m256 ymm ymm -func VPMADDWD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMADDWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMADDWD: bad operands") -} - -// VPMASKMOVD: Conditional Move Packed Doubleword Integers. -// -// Forms: -// -// VPMASKMOVD m128 xmm xmm -// VPMASKMOVD m256 ymm ymm -// VPMASKMOVD xmm xmm m128 -// VPMASKMOVD ymm ymm m256 -func VPMASKMOVD(mxy, xy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVD", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VPMASKMOVD: bad operands") -} - -// VPMASKMOVQ: Conditional Move Packed Quadword Integers. -// -// Forms: -// -// VPMASKMOVQ m128 xmm xmm -// VPMASKMOVQ m256 ymm ymm -// VPMASKMOVQ xmm xmm m128 -// VPMASKMOVQ ymm ymm m256 -func VPMASKMOVQ(mxy, xy, mxy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVQ", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVQ", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsM128(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVQ", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsM256(mxy1): - return &intrep.Instruction{ - Opcode: "VPMASKMOVQ", - Operands: []operand.Op{mxy, xy, mxy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{mxy1}, - }, nil - } - return nil, errors.New("VPMASKMOVQ: bad operands") -} - -// VPMAXSB: Maximum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMAXSB xmm xmm xmm -// VPMAXSB m128 xmm xmm -// VPMAXSB ymm ymm ymm -// VPMAXSB m256 ymm ymm -func VPMAXSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXSB: bad operands") -} - -// VPMAXSD: Maximum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMAXSD xmm xmm xmm -// VPMAXSD m128 xmm xmm -// VPMAXSD ymm ymm ymm -// VPMAXSD m256 ymm ymm -func VPMAXSD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXSD: bad operands") -} - -// VPMAXSW: Maximum of Packed Signed Word Integers. -// -// Forms: -// -// VPMAXSW xmm xmm xmm -// VPMAXSW m128 xmm xmm -// VPMAXSW ymm ymm ymm -// VPMAXSW m256 ymm ymm -func VPMAXSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXSW: bad operands") -} - -// VPMAXUB: Maximum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMAXUB xmm xmm xmm -// VPMAXUB m128 xmm xmm -// VPMAXUB ymm ymm ymm -// VPMAXUB m256 ymm ymm -func VPMAXUB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXUB: bad operands") -} - -// VPMAXUD: Maximum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMAXUD xmm xmm xmm -// VPMAXUD m128 xmm xmm -// VPMAXUD ymm ymm ymm -// VPMAXUD m256 ymm ymm -func VPMAXUD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXUD: bad operands") -} - -// VPMAXUW: Maximum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMAXUW xmm xmm xmm -// VPMAXUW m128 xmm xmm -// VPMAXUW ymm ymm ymm -// VPMAXUW m256 ymm ymm -func VPMAXUW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMAXUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMAXUW: bad operands") -} - -// VPMINSB: Minimum of Packed Signed Byte Integers. -// -// Forms: -// -// VPMINSB xmm xmm xmm -// VPMINSB m128 xmm xmm -// VPMINSB ymm ymm ymm -// VPMINSB m256 ymm ymm -func VPMINSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINSB: bad operands") -} - -// VPMINSD: Minimum of Packed Signed Doubleword Integers. -// -// Forms: -// -// VPMINSD xmm xmm xmm -// VPMINSD m128 xmm xmm -// VPMINSD ymm ymm ymm -// VPMINSD m256 ymm ymm -func VPMINSD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINSD: bad operands") -} - -// VPMINSW: Minimum of Packed Signed Word Integers. -// -// Forms: -// -// VPMINSW xmm xmm xmm -// VPMINSW m128 xmm xmm -// VPMINSW ymm ymm ymm -// VPMINSW m256 ymm ymm -func VPMINSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINSW: bad operands") -} - -// VPMINUB: Minimum of Packed Unsigned Byte Integers. -// -// Forms: -// -// VPMINUB xmm xmm xmm -// VPMINUB m128 xmm xmm -// VPMINUB ymm ymm ymm -// VPMINUB m256 ymm ymm -func VPMINUB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINUB: bad operands") -} - -// VPMINUD: Minimum of Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMINUD xmm xmm xmm -// VPMINUD m128 xmm xmm -// VPMINUD ymm ymm ymm -// VPMINUD m256 ymm ymm -func VPMINUD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINUD: bad operands") -} - -// VPMINUW: Minimum of Packed Unsigned Word Integers. -// -// Forms: -// -// VPMINUW xmm xmm xmm -// VPMINUW m128 xmm xmm -// VPMINUW ymm ymm ymm -// VPMINUW m256 ymm ymm -func VPMINUW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMINUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMINUW: bad operands") -} - -// VPMOVMSKB: Move Byte Mask. -// -// Forms: -// -// VPMOVMSKB xmm r32 -// VPMOVMSKB ymm r32 -func VPMOVMSKB(xy, r operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VPMOVMSKB", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - case operand.IsYMM(xy) && operand.IsR32(r): - return &intrep.Instruction{ - Opcode: "VPMOVMSKB", - Operands: []operand.Op{xy, r}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{r}, - }, nil - } - return nil, errors.New("VPMOVMSKB: bad operands") -} - -// VPMOVSXBD: Move Packed Byte Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBD xmm xmm -// VPMOVSXBD m32 xmm -// VPMOVSXBD xmm ymm -// VPMOVSXBD m64 ymm -func VPMOVSXBD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXBD: bad operands") -} - -// VPMOVSXBQ: Move Packed Byte Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBQ xmm xmm -// VPMOVSXBQ m16 xmm -// VPMOVSXBQ xmm ymm -// VPMOVSXBQ m32 ymm -func VPMOVSXBQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM16(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXBQ: bad operands") -} - -// VPMOVSXBW: Move Packed Byte Integers to Word Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXBW xmm xmm -// VPMOVSXBW m64 xmm -// VPMOVSXBW xmm ymm -// VPMOVSXBW m128 ymm -func VPMOVSXBW(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXBW: bad operands") -} - -// VPMOVSXDQ: Move Packed Doubleword Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXDQ xmm xmm -// VPMOVSXDQ m64 xmm -// VPMOVSXDQ xmm ymm -// VPMOVSXDQ m128 ymm -func VPMOVSXDQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXDQ: bad operands") -} - -// VPMOVSXWD: Move Packed Word Integers to Doubleword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWD xmm xmm -// VPMOVSXWD m64 xmm -// VPMOVSXWD xmm ymm -// VPMOVSXWD m128 ymm -func VPMOVSXWD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXWD: bad operands") -} - -// VPMOVSXWQ: Move Packed Word Integers to Quadword Integers with Sign Extension. -// -// Forms: -// -// VPMOVSXWQ xmm xmm -// VPMOVSXWQ m32 xmm -// VPMOVSXWQ xmm ymm -// VPMOVSXWQ m64 ymm -func VPMOVSXWQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVSXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVSXWQ: bad operands") -} - -// VPMOVZXBD: Move Packed Byte Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBD xmm xmm -// VPMOVZXBD m32 xmm -// VPMOVZXBD xmm ymm -// VPMOVZXBD m64 ymm -func VPMOVZXBD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXBD: bad operands") -} - -// VPMOVZXBQ: Move Packed Byte Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBQ xmm xmm -// VPMOVZXBQ m16 xmm -// VPMOVZXBQ xmm ymm -// VPMOVZXBQ m32 ymm -func VPMOVZXBQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM16(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXBQ: bad operands") -} - -// VPMOVZXBW: Move Packed Byte Integers to Word Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXBW xmm xmm -// VPMOVZXBW m64 xmm -// VPMOVZXBW xmm ymm -// VPMOVZXBW m128 ymm -func VPMOVZXBW(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXBW", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXBW: bad operands") -} - -// VPMOVZXDQ: Move Packed Doubleword Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXDQ xmm xmm -// VPMOVZXDQ m64 xmm -// VPMOVZXDQ xmm ymm -// VPMOVZXDQ m128 ymm -func VPMOVZXDQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXDQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXDQ: bad operands") -} - -// VPMOVZXWD: Move Packed Word Integers to Doubleword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWD xmm xmm -// VPMOVZXWD m64 xmm -// VPMOVZXWD xmm ymm -// VPMOVZXWD m128 ymm -func VPMOVZXWD(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWD", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXWD: bad operands") -} - -// VPMOVZXWQ: Move Packed Word Integers to Quadword Integers with Zero Extension. -// -// Forms: -// -// VPMOVZXWQ xmm xmm -// VPMOVZXWQ m32 xmm -// VPMOVZXWQ xmm ymm -// VPMOVZXWQ m64 ymm -func VPMOVZXWQ(mx, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsXMM(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM64(mx) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPMOVZXWQ", - Operands: []operand.Op{mx, xy}, - Inputs: []operand.Op{mx}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPMOVZXWQ: bad operands") -} - -// VPMULDQ: Multiply Packed Signed Doubleword Integers and Store Quadword Result. -// -// Forms: -// -// VPMULDQ xmm xmm xmm -// VPMULDQ m128 xmm xmm -// VPMULDQ ymm ymm ymm -// VPMULDQ m256 ymm ymm -func VPMULDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULDQ: bad operands") -} - -// VPMULHRSW: Packed Multiply Signed Word Integers and Store High Result with Round and Scale. -// -// Forms: -// -// VPMULHRSW xmm xmm xmm -// VPMULHRSW m128 xmm xmm -// VPMULHRSW ymm ymm ymm -// VPMULHRSW m256 ymm ymm -func VPMULHRSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHRSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHRSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHRSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHRSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULHRSW: bad operands") -} - -// VPMULHUW: Multiply Packed Unsigned Word Integers and Store High Result. -// -// Forms: -// -// VPMULHUW xmm xmm xmm -// VPMULHUW m128 xmm xmm -// VPMULHUW ymm ymm ymm -// VPMULHUW m256 ymm ymm -func VPMULHUW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHUW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULHUW: bad operands") -} - -// VPMULHW: Multiply Packed Signed Word Integers and Store High Result. -// -// Forms: -// -// VPMULHW xmm xmm xmm -// VPMULHW m128 xmm xmm -// VPMULHW ymm ymm ymm -// VPMULHW m256 ymm ymm -func VPMULHW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULHW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULHW: bad operands") -} - -// VPMULLD: Multiply Packed Signed Doubleword Integers and Store Low Result. -// -// Forms: -// -// VPMULLD xmm xmm xmm -// VPMULLD m128 xmm xmm -// VPMULLD ymm ymm ymm -// VPMULLD m256 ymm ymm -func VPMULLD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULLD: bad operands") -} - -// VPMULLW: Multiply Packed Signed Word Integers and Store Low Result. -// -// Forms: -// -// VPMULLW xmm xmm xmm -// VPMULLW m128 xmm xmm -// VPMULLW ymm ymm ymm -// VPMULLW m256 ymm ymm -func VPMULLW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULLW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULLW: bad operands") -} - -// VPMULUDQ: Multiply Packed Unsigned Doubleword Integers. -// -// Forms: -// -// VPMULUDQ xmm xmm xmm -// VPMULUDQ m128 xmm xmm -// VPMULUDQ ymm ymm ymm -// VPMULUDQ m256 ymm ymm -func VPMULUDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULUDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULUDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULUDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPMULUDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPMULUDQ: bad operands") -} - -// VPOR: Packed Bitwise Logical OR. -// -// Forms: -// -// VPOR xmm xmm xmm -// VPOR m128 xmm xmm -// VPOR ymm ymm ymm -// VPOR m256 ymm ymm -func VPOR(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPOR: bad operands") -} - -// VPSADBW: Compute Sum of Absolute Differences. -// -// Forms: -// -// VPSADBW xmm xmm xmm -// VPSADBW m128 xmm xmm -// VPSADBW ymm ymm ymm -// VPSADBW m256 ymm ymm -func VPSADBW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSADBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSADBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSADBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSADBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSADBW: bad operands") -} - -// VPSHUFB: Packed Shuffle Bytes. -// -// Forms: -// -// VPSHUFB xmm xmm xmm -// VPSHUFB m128 xmm xmm -// VPSHUFB ymm ymm ymm -// VPSHUFB m256 ymm ymm -func VPSHUFB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSHUFB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSHUFB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSHUFB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSHUFB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSHUFB: bad operands") -} - -// VPSHUFD: Shuffle Packed Doublewords. -// -// Forms: -// -// VPSHUFD imm8 xmm xmm -// VPSHUFD imm8 m128 xmm -// VPSHUFD imm8 ymm ymm -// VPSHUFD imm8 m256 ymm -func VPSHUFD(i, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPSHUFD: bad operands") -} - -// VPSHUFHW: Shuffle Packed High Words. -// -// Forms: -// -// VPSHUFHW imm8 xmm xmm -// VPSHUFHW imm8 m128 xmm -// VPSHUFHW imm8 ymm ymm -// VPSHUFHW imm8 m256 ymm -func VPSHUFHW(i, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFHW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFHW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFHW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFHW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPSHUFHW: bad operands") -} - -// VPSHUFLW: Shuffle Packed Low Words. -// -// Forms: -// -// VPSHUFLW imm8 xmm xmm -// VPSHUFLW imm8 m128 xmm -// VPSHUFLW imm8 ymm ymm -// VPSHUFLW imm8 m256 ymm -func VPSHUFLW(i, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFLW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFLW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFLW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPSHUFLW", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VPSHUFLW: bad operands") -} - -// VPSIGNB: Packed Sign of Byte Integers. -// -// Forms: -// -// VPSIGNB xmm xmm xmm -// VPSIGNB m128 xmm xmm -// VPSIGNB ymm ymm ymm -// VPSIGNB m256 ymm ymm -func VPSIGNB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSIGNB: bad operands") -} - -// VPSIGND: Packed Sign of Doubleword Integers. -// -// Forms: -// -// VPSIGND xmm xmm xmm -// VPSIGND m128 xmm xmm -// VPSIGND ymm ymm ymm -// VPSIGND m256 ymm ymm -func VPSIGND(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGND", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSIGND: bad operands") -} - -// VPSIGNW: Packed Sign of Word Integers. -// -// Forms: -// -// VPSIGNW xmm xmm xmm -// VPSIGNW m128 xmm xmm -// VPSIGNW ymm ymm ymm -// VPSIGNW m256 ymm ymm -func VPSIGNW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSIGNW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSIGNW: bad operands") -} - -// VPSLLD: Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLD imm8 xmm xmm -// VPSLLD xmm xmm xmm -// VPSLLD m128 xmm xmm -// VPSLLD imm8 ymm ymm -// VPSLLD xmm ymm ymm -// VPSLLD m128 ymm ymm -func VPSLLD(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLD: bad operands") -} - -// VPSLLDQ: Shift Packed Double Quadword Left Logical. -// -// Forms: -// -// VPSLLDQ imm8 xmm xmm -// VPSLLDQ imm8 ymm ymm -func VPSLLDQ(i, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLDQ", - Operands: []operand.Op{i, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLDQ", - Operands: []operand.Op{i, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLDQ: bad operands") -} - -// VPSLLQ: Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLQ imm8 xmm xmm -// VPSLLQ xmm xmm xmm -// VPSLLQ m128 xmm xmm -// VPSLLQ imm8 ymm ymm -// VPSLLQ xmm ymm ymm -// VPSLLQ m128 ymm ymm -func VPSLLQ(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLQ: bad operands") -} - -// VPSLLVD: Variable Shift Packed Doubleword Data Left Logical. -// -// Forms: -// -// VPSLLVD xmm xmm xmm -// VPSLLVD m128 xmm xmm -// VPSLLVD ymm ymm ymm -// VPSLLVD m256 ymm ymm -func VPSLLVD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLVD: bad operands") -} - -// VPSLLVQ: Variable Shift Packed Quadword Data Left Logical. -// -// Forms: -// -// VPSLLVQ xmm xmm xmm -// VPSLLVQ m128 xmm xmm -// VPSLLVQ ymm ymm ymm -// VPSLLVQ m256 ymm ymm -func VPSLLVQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLVQ: bad operands") -} - -// VPSLLW: Shift Packed Word Data Left Logical. -// -// Forms: -// -// VPSLLW imm8 xmm xmm -// VPSLLW xmm xmm xmm -// VPSLLW m128 xmm xmm -// VPSLLW imm8 ymm ymm -// VPSLLW xmm ymm ymm -// VPSLLW m128 ymm ymm -func VPSLLW(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSLLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSLLW: bad operands") -} - -// VPSRAD: Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAD imm8 xmm xmm -// VPSRAD xmm xmm xmm -// VPSRAD m128 xmm xmm -// VPSRAD imm8 ymm ymm -// VPSRAD xmm ymm ymm -// VPSRAD m128 ymm ymm -func VPSRAD(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRAD: bad operands") -} - -// VPSRAVD: Variable Shift Packed Doubleword Data Right Arithmetic. -// -// Forms: -// -// VPSRAVD xmm xmm xmm -// VPSRAVD m128 xmm xmm -// VPSRAVD ymm ymm ymm -// VPSRAVD m256 ymm ymm -func VPSRAVD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRAVD: bad operands") -} - -// VPSRAW: Shift Packed Word Data Right Arithmetic. -// -// Forms: -// -// VPSRAW imm8 xmm xmm -// VPSRAW xmm xmm xmm -// VPSRAW m128 xmm xmm -// VPSRAW imm8 ymm ymm -// VPSRAW xmm ymm ymm -// VPSRAW m128 ymm ymm -func VPSRAW(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRAW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRAW: bad operands") -} - -// VPSRLD: Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLD imm8 xmm xmm -// VPSRLD xmm xmm xmm -// VPSRLD m128 xmm xmm -// VPSRLD imm8 ymm ymm -// VPSRLD xmm ymm ymm -// VPSRLD m128 ymm ymm -func VPSRLD(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLD", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLD: bad operands") -} - -// VPSRLDQ: Shift Packed Double Quadword Right Logical. -// -// Forms: -// -// VPSRLDQ imm8 xmm xmm -// VPSRLDQ imm8 ymm ymm -func VPSRLDQ(i, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLDQ", - Operands: []operand.Op{i, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLDQ", - Operands: []operand.Op{i, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLDQ: bad operands") -} - -// VPSRLQ: Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLQ imm8 xmm xmm -// VPSRLQ xmm xmm xmm -// VPSRLQ m128 xmm xmm -// VPSRLQ imm8 ymm ymm -// VPSRLQ xmm ymm ymm -// VPSRLQ m128 ymm ymm -func VPSRLQ(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLQ", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLQ: bad operands") -} - -// VPSRLVD: Variable Shift Packed Doubleword Data Right Logical. -// -// Forms: -// -// VPSRLVD xmm xmm xmm -// VPSRLVD m128 xmm xmm -// VPSRLVD ymm ymm ymm -// VPSRLVD m256 ymm ymm -func VPSRLVD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLVD: bad operands") -} - -// VPSRLVQ: Variable Shift Packed Quadword Data Right Logical. -// -// Forms: -// -// VPSRLVQ xmm xmm xmm -// VPSRLVQ m128 xmm xmm -// VPSRLVQ ymm ymm ymm -// VPSRLVQ m256 ymm ymm -func VPSRLVQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLVQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLVQ: bad operands") -} - -// VPSRLW: Shift Packed Word Data Right Logical. -// -// Forms: -// -// VPSRLW imm8 xmm xmm -// VPSRLW xmm xmm xmm -// VPSRLW m128 xmm xmm -// VPSRLW imm8 ymm ymm -// VPSRLW xmm ymm ymm -// VPSRLW m128 ymm ymm -func VPSRLW(imx, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsXMM(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(imx) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSRLW", - Operands: []operand.Op{imx, xy, xy1}, - Inputs: []operand.Op{imx, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSRLW: bad operands") -} - -// VPSUBB: Subtract Packed Byte Integers. -// -// Forms: -// -// VPSUBB xmm xmm xmm -// VPSUBB m128 xmm xmm -// VPSUBB ymm ymm ymm -// VPSUBB m256 ymm ymm -func VPSUBB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBB: bad operands") -} - -// VPSUBD: Subtract Packed Doubleword Integers. -// -// Forms: -// -// VPSUBD xmm xmm xmm -// VPSUBD m128 xmm xmm -// VPSUBD ymm ymm ymm -// VPSUBD m256 ymm ymm -func VPSUBD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBD: bad operands") -} - -// VPSUBQ: Subtract Packed Quadword Integers. -// -// Forms: -// -// VPSUBQ xmm xmm xmm -// VPSUBQ m128 xmm xmm -// VPSUBQ ymm ymm ymm -// VPSUBQ m256 ymm ymm -func VPSUBQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBQ: bad operands") -} - -// VPSUBSB: Subtract Packed Signed Byte Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSB xmm xmm xmm -// VPSUBSB m128 xmm xmm -// VPSUBSB ymm ymm ymm -// VPSUBSB m256 ymm ymm -func VPSUBSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBSB: bad operands") -} - -// VPSUBSW: Subtract Packed Signed Word Integers with Signed Saturation. -// -// Forms: -// -// VPSUBSW xmm xmm xmm -// VPSUBSW m128 xmm xmm -// VPSUBSW ymm ymm ymm -// VPSUBSW m256 ymm ymm -func VPSUBSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBSW: bad operands") -} - -// VPSUBUSB: Subtract Packed Unsigned Byte Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSB xmm xmm xmm -// VPSUBUSB m128 xmm xmm -// VPSUBUSB ymm ymm ymm -// VPSUBUSB m256 ymm ymm -func VPSUBUSB(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSB", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBUSB: bad operands") -} - -// VPSUBUSW: Subtract Packed Unsigned Word Integers with Unsigned Saturation. -// -// Forms: -// -// VPSUBUSW xmm xmm xmm -// VPSUBUSW m128 xmm xmm -// VPSUBUSW ymm ymm ymm -// VPSUBUSW m256 ymm ymm -func VPSUBUSW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBUSW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBUSW: bad operands") -} - -// VPSUBW: Subtract Packed Word Integers. -// -// Forms: -// -// VPSUBW xmm xmm xmm -// VPSUBW m128 xmm xmm -// VPSUBW ymm ymm ymm -// VPSUBW m256 ymm ymm -func VPSUBW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPSUBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPSUBW: bad operands") -} - -// VPTEST: Packed Logical Compare. -// -// Forms: -// -// VPTEST xmm xmm -// VPTEST m128 xmm -// VPTEST ymm ymm -// VPTEST m256 ymm -func VPTEST(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPTEST", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VPTEST", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPTEST", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VPTEST", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VPTEST: bad operands") -} - -// VPUNPCKHBW: Unpack and Interleave High-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKHBW xmm xmm xmm -// VPUNPCKHBW m128 xmm xmm -// VPUNPCKHBW ymm ymm ymm -// VPUNPCKHBW m256 ymm ymm -func VPUNPCKHBW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKHBW: bad operands") -} - -// VPUNPCKHDQ: Unpack and Interleave High-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKHDQ xmm xmm xmm -// VPUNPCKHDQ m128 xmm xmm -// VPUNPCKHDQ ymm ymm ymm -// VPUNPCKHDQ m256 ymm ymm -func VPUNPCKHDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKHDQ: bad operands") -} - -// VPUNPCKHQDQ: Unpack and Interleave High-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKHQDQ xmm xmm xmm -// VPUNPCKHQDQ m128 xmm xmm -// VPUNPCKHQDQ ymm ymm ymm -// VPUNPCKHQDQ m256 ymm ymm -func VPUNPCKHQDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKHQDQ: bad operands") -} - -// VPUNPCKHWD: Unpack and Interleave High-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKHWD xmm xmm xmm -// VPUNPCKHWD m128 xmm xmm -// VPUNPCKHWD ymm ymm ymm -// VPUNPCKHWD m256 ymm ymm -func VPUNPCKHWD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKHWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKHWD: bad operands") -} - -// VPUNPCKLBW: Unpack and Interleave Low-Order Bytes into Words. -// -// Forms: -// -// VPUNPCKLBW xmm xmm xmm -// VPUNPCKLBW m128 xmm xmm -// VPUNPCKLBW ymm ymm ymm -// VPUNPCKLBW m256 ymm ymm -func VPUNPCKLBW(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLBW", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKLBW: bad operands") -} - -// VPUNPCKLDQ: Unpack and Interleave Low-Order Doublewords into Quadwords. -// -// Forms: -// -// VPUNPCKLDQ xmm xmm xmm -// VPUNPCKLDQ m128 xmm xmm -// VPUNPCKLDQ ymm ymm ymm -// VPUNPCKLDQ m256 ymm ymm -func VPUNPCKLDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKLDQ: bad operands") -} - -// VPUNPCKLQDQ: Unpack and Interleave Low-Order Quadwords into Double Quadwords. -// -// Forms: -// -// VPUNPCKLQDQ xmm xmm xmm -// VPUNPCKLQDQ m128 xmm xmm -// VPUNPCKLQDQ ymm ymm ymm -// VPUNPCKLQDQ m256 ymm ymm -func VPUNPCKLQDQ(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLQDQ", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKLQDQ: bad operands") -} - -// VPUNPCKLWD: Unpack and Interleave Low-Order Words into Doublewords. -// -// Forms: -// -// VPUNPCKLWD xmm xmm xmm -// VPUNPCKLWD m128 xmm xmm -// VPUNPCKLWD ymm ymm ymm -// VPUNPCKLWD m256 ymm ymm -func VPUNPCKLWD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPUNPCKLWD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPUNPCKLWD: bad operands") -} - -// VPXOR: Packed Bitwise Logical Exclusive OR. -// -// Forms: -// -// VPXOR xmm xmm xmm -// VPXOR m128 xmm xmm -// VPXOR ymm ymm ymm -// VPXOR m256 ymm ymm -func VPXOR(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPXOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VPXOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPXOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VPXOR", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VPXOR: bad operands") -} - -// VRCPPS: Compute Approximate Reciprocals of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPPS xmm xmm -// VRCPPS m128 xmm -// VRCPPS ymm ymm -// VRCPPS m256 ymm -func VRCPPS(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VRCPPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VRCPPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VRCPPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VRCPPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VRCPPS: bad operands") -} - -// VRCPSS: Compute Approximate Reciprocal of Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VRCPSS xmm xmm xmm -// VRCPSS m32 xmm xmm -func VRCPSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VRCPSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VRCPSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VRCPSS: bad operands") -} - -// VROUNDPD: Round Packed Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPD imm8 xmm xmm -// VROUNDPD imm8 m128 xmm -// VROUNDPD imm8 ymm ymm -// VROUNDPD imm8 m256 ymm -func VROUNDPD(i, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPD", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VROUNDPD: bad operands") -} - -// VROUNDPS: Round Packed Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDPS imm8 xmm xmm -// VROUNDPS imm8 m128 xmm -// VROUNDPS imm8 ymm ymm -// VROUNDPS imm8 m256 ymm -func VROUNDPS(i, mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPS", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPS", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPS", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VROUNDPS", - Operands: []operand.Op{i, mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VROUNDPS: bad operands") -} - -// VROUNDSD: Round Scalar Double Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSD imm8 xmm xmm xmm -// VROUNDSD imm8 m64 xmm xmm -func VROUNDSD(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VROUNDSD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VROUNDSD", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VROUNDSD: bad operands") -} - -// VROUNDSS: Round Scalar Single Precision Floating-Point Values. -// -// Forms: -// -// VROUNDSS imm8 xmm xmm xmm -// VROUNDSS imm8 m32 xmm xmm -func VROUNDSS(i, mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VROUNDSS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsIMM8(i) && operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VROUNDSS", - Operands: []operand.Op{i, mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VROUNDSS: bad operands") -} - -// VRSQRTPS: Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VRSQRTPS xmm xmm -// VRSQRTPS m128 xmm -// VRSQRTPS ymm ymm -// VRSQRTPS m256 ymm -func VRSQRTPS(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VRSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VRSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VRSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VRSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VRSQRTPS: bad operands") -} - -// VRSQRTSS: Compute Reciprocal of Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VRSQRTSS xmm xmm xmm -// VRSQRTSS m32 xmm xmm -func VRSQRTSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VRSQRTSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VRSQRTSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VRSQRTSS: bad operands") -} - -// VSHUFPD: Shuffle Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPD imm8 xmm xmm xmm -// VSHUFPD imm8 m128 xmm xmm -// VSHUFPD imm8 ymm ymm ymm -// VSHUFPD imm8 m256 ymm ymm -func VSHUFPD(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPD", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VSHUFPD: bad operands") -} - -// VSHUFPS: Shuffle Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSHUFPS imm8 xmm xmm xmm -// VSHUFPS imm8 m128 xmm xmm -// VSHUFPS imm8 ymm ymm ymm -// VSHUFPS imm8 m256 ymm ymm -func VSHUFPS(i, mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(i) && operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsIMM8(i) && operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSHUFPS", - Operands: []operand.Op{i, mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VSHUFPS: bad operands") -} - -// VSQRTPD: Compute Square Roots of Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPD xmm xmm -// VSQRTPD m128 xmm -// VSQRTPD ymm ymm -// VSQRTPD m256 ymm -func VSQRTPD(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VSQRTPD: bad operands") -} - -// VSQRTPS: Compute Square Roots of Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSQRTPS xmm xmm -// VSQRTPS m128 xmm -// VSQRTPS ymm ymm -// VSQRTPS m256 ymm -func VSQRTPS(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VSQRTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy}, - Outputs: []operand.Op{xy}, - }, nil - } - return nil, errors.New("VSQRTPS: bad operands") -} - -// VSQRTSD: Compute Square Root of Scalar Double-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSD xmm xmm xmm -// VSQRTSD m64 xmm xmm -func VSQRTSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSQRTSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSQRTSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VSQRTSD: bad operands") -} - -// VSQRTSS: Compute Square Root of Scalar Single-Precision Floating-Point Value. -// -// Forms: -// -// VSQRTSS xmm xmm xmm -// VSQRTSS m32 xmm xmm -func VSQRTSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSQRTSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSQRTSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VSQRTSS: bad operands") -} - -// VSTMXCSR: Store MXCSR Register State. -// -// Forms: -// -// VSTMXCSR m32 -func VSTMXCSR(m operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsM32(m): - return &intrep.Instruction{ - Opcode: "VSTMXCSR", - Operands: []operand.Op{m}, - Inputs: []operand.Op{}, - Outputs: []operand.Op{m}, - }, nil - } - return nil, errors.New("VSTMXCSR: bad operands") -} - -// VSUBPD: Subtract Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPD xmm xmm xmm -// VSUBPD m128 xmm xmm -// VSUBPD ymm ymm ymm -// VSUBPD m256 ymm ymm -func VSUBPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VSUBPD: bad operands") -} - -// VSUBPS: Subtract Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBPS xmm xmm xmm -// VSUBPS m128 xmm xmm -// VSUBPS ymm ymm ymm -// VSUBPS m256 ymm ymm -func VSUBPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VSUBPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VSUBPS: bad operands") -} - -// VSUBSD: Subtract Scalar Double-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSD xmm xmm xmm -// VSUBSD m64 xmm xmm -func VSUBSD(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSUBSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSUBSD", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VSUBSD: bad operands") -} - -// VSUBSS: Subtract Scalar Single-Precision Floating-Point Values. -// -// Forms: -// -// VSUBSS xmm xmm xmm -// VSUBSS m32 xmm xmm -func VSUBSS(mx, x, x1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSUBSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x) && operand.IsXMM(x1): - return &intrep.Instruction{ - Opcode: "VSUBSS", - Operands: []operand.Op{mx, x, x1}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x1}, - }, nil - } - return nil, errors.New("VSUBSS: bad operands") -} - -// VTESTPD: Packed Double-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPD xmm xmm -// VTESTPD m128 xmm -// VTESTPD ymm ymm -// VTESTPD m256 ymm -func VTESTPD(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPD", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VTESTPD: bad operands") -} - -// VTESTPS: Packed Single-Precision Floating-Point Bit Test. -// -// Forms: -// -// VTESTPS xmm xmm -// VTESTPS m128 xmm -// VTESTPS ymm ymm -// VTESTPS m256 ymm -func VTESTPS(mxy, xy operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy): - return &intrep.Instruction{ - Opcode: "VTESTPS", - Operands: []operand.Op{mxy, xy}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VTESTPS: bad operands") -} - -// VUCOMISD: Unordered Compare Scalar Double-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISD xmm xmm -// VUCOMISD m64 xmm -func VUCOMISD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VUCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM64(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VUCOMISD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VUCOMISD: bad operands") -} - -// VUCOMISS: Unordered Compare Scalar Single-Precision Floating-Point Values and Set EFLAGS. -// -// Forms: -// -// VUCOMISS xmm xmm -// VUCOMISS m32 xmm -func VUCOMISS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VUCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - case operand.IsM32(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "VUCOMISS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{}, - }, nil - } - return nil, errors.New("VUCOMISS: bad operands") -} - -// VUNPCKHPD: Unpack and Interleave High Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPD xmm xmm xmm -// VUNPCKHPD m128 xmm xmm -// VUNPCKHPD ymm ymm ymm -// VUNPCKHPD m256 ymm ymm -func VUNPCKHPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VUNPCKHPD: bad operands") -} - -// VUNPCKHPS: Unpack and Interleave High Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKHPS xmm xmm xmm -// VUNPCKHPS m128 xmm xmm -// VUNPCKHPS ymm ymm ymm -// VUNPCKHPS m256 ymm ymm -func VUNPCKHPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKHPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VUNPCKHPS: bad operands") -} - -// VUNPCKLPD: Unpack and Interleave Low Packed Double-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPD xmm xmm xmm -// VUNPCKLPD m128 xmm xmm -// VUNPCKLPD ymm ymm ymm -// VUNPCKLPD m256 ymm ymm -func VUNPCKLPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VUNPCKLPD: bad operands") -} - -// VUNPCKLPS: Unpack and Interleave Low Packed Single-Precision Floating-Point Values. -// -// Forms: -// -// VUNPCKLPS xmm xmm xmm -// VUNPCKLPS m128 xmm xmm -// VUNPCKLPS ymm ymm ymm -// VUNPCKLPS m256 ymm ymm -func VUNPCKLPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VUNPCKLPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VUNPCKLPS: bad operands") -} - -// VXORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// VXORPD xmm xmm xmm -// VXORPD m128 xmm xmm -// VXORPD ymm ymm ymm -// VXORPD m256 ymm ymm -func VXORPD(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPD", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VXORPD: bad operands") -} - -// VXORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// VXORPS xmm xmm xmm -// VXORPS m128 xmm xmm -// VXORPS ymm ymm ymm -// VXORPS m256 ymm ymm -func VXORPS(mxy, xy, xy1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM128(mxy) && operand.IsXMM(xy) && operand.IsXMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsYMM(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - case operand.IsM256(mxy) && operand.IsYMM(xy) && operand.IsYMM(xy1): - return &intrep.Instruction{ - Opcode: "VXORPS", - Operands: []operand.Op{mxy, xy, xy1}, - Inputs: []operand.Op{mxy, xy}, - Outputs: []operand.Op{xy1}, - }, nil - } - return nil, errors.New("VXORPS: bad operands") -} - -// VZEROALL: Zero All YMM Registers. -// -// Forms: -// -// VZEROALL -func VZEROALL() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "VZEROALL", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// VZEROUPPER: Zero Upper Bits of YMM Registers. -// -// Forms: -// -// VZEROUPPER -func VZEROUPPER() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "VZEROUPPER", - Operands: nil, - Inputs: []operand.Op{}, - Outputs: []operand.Op{}, - }, nil -} - -// XADDB: Exchange and Add. -// -// Forms: -// -// XADDB r8 r8 -// XADDB r8 m8 -func XADDB(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(r) && operand.IsR8(mr): - return &intrep.Instruction{ - Opcode: "XADDB", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - case operand.IsR8(r) && operand.IsM8(mr): - return &intrep.Instruction{ - Opcode: "XADDB", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - } - return nil, errors.New("XADDB: bad operands") -} - -// XADDL: Exchange and Add. -// -// Forms: -// -// XADDL r32 r32 -// XADDL r32 m32 -func XADDL(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(r) && operand.IsR32(mr): - return &intrep.Instruction{ - Opcode: "XADDL", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - case operand.IsR32(r) && operand.IsM32(mr): - return &intrep.Instruction{ - Opcode: "XADDL", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - } - return nil, errors.New("XADDL: bad operands") -} - -// XADDQ: Exchange and Add. -// -// Forms: -// -// XADDQ r64 r64 -// XADDQ r64 m64 -func XADDQ(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(r) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "XADDQ", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - case operand.IsR64(r) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "XADDQ", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - } - return nil, errors.New("XADDQ: bad operands") -} - -// XADDW: Exchange and Add. -// -// Forms: -// -// XADDW r16 r16 -// XADDW r16 m16 -func XADDW(r, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(r) && operand.IsR16(mr): - return &intrep.Instruction{ - Opcode: "XADDW", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - case operand.IsR16(r) && operand.IsM16(mr): - return &intrep.Instruction{ - Opcode: "XADDW", - Operands: []operand.Op{r, mr}, - Inputs: []operand.Op{r, mr}, - Outputs: []operand.Op{r, mr}, - }, nil - } - return nil, errors.New("XADDW: bad operands") -} - -// XCHGB: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGB r8 r8 -// XCHGB m8 r8 -// XCHGB r8 m8 -func XCHGB(mr, mr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR8(mr) && operand.IsR8(mr1): - return &intrep.Instruction{ - Opcode: "XCHGB", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsM8(mr) && operand.IsR8(mr1): - return &intrep.Instruction{ - Opcode: "XCHGB", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsR8(mr) && operand.IsM8(mr1): - return &intrep.Instruction{ - Opcode: "XCHGB", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - } - return nil, errors.New("XCHGB: bad operands") -} - -// XCHGL: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGL r32 eax -// XCHGL eax r32 -// XCHGL r32 r32 -// XCHGL m32 r32 -// XCHGL r32 m32 -func XCHGL(emr, emr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR32(emr) && operand.IsEAX(emr1): - return &intrep.Instruction{ - Opcode: "XCHGL", - Operands: []operand.Op{emr, emr1}, - Inputs: []operand.Op{emr, emr1}, - Outputs: []operand.Op{emr, emr1}, - }, nil - case operand.IsEAX(emr) && operand.IsR32(emr1): - return &intrep.Instruction{ - Opcode: "XCHGL", - Operands: []operand.Op{emr, emr1}, - Inputs: []operand.Op{emr, emr1}, - Outputs: []operand.Op{emr, emr1}, - }, nil - case operand.IsR32(emr) && operand.IsR32(emr1): - return &intrep.Instruction{ - Opcode: "XCHGL", - Operands: []operand.Op{emr, emr1}, - Inputs: []operand.Op{emr, emr1}, - Outputs: []operand.Op{emr, emr1}, - }, nil - case operand.IsM32(emr) && operand.IsR32(emr1): - return &intrep.Instruction{ - Opcode: "XCHGL", - Operands: []operand.Op{emr, emr1}, - Inputs: []operand.Op{emr, emr1}, - Outputs: []operand.Op{emr, emr1}, - }, nil - case operand.IsR32(emr) && operand.IsM32(emr1): - return &intrep.Instruction{ - Opcode: "XCHGL", - Operands: []operand.Op{emr, emr1}, - Inputs: []operand.Op{emr, emr1}, - Outputs: []operand.Op{emr, emr1}, - }, nil - } - return nil, errors.New("XCHGL: bad operands") -} - -// XCHGQ: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGQ r64 rax -// XCHGQ rax r64 -// XCHGQ r64 r64 -// XCHGQ m64 r64 -// XCHGQ r64 m64 -func XCHGQ(mr, mr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR64(mr) && operand.IsRAX(mr1): - return &intrep.Instruction{ - Opcode: "XCHGQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsRAX(mr) && operand.IsR64(mr1): - return &intrep.Instruction{ - Opcode: "XCHGQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsR64(mr) && operand.IsR64(mr1): - return &intrep.Instruction{ - Opcode: "XCHGQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsM64(mr) && operand.IsR64(mr1): - return &intrep.Instruction{ - Opcode: "XCHGQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - case operand.IsR64(mr) && operand.IsM64(mr1): - return &intrep.Instruction{ - Opcode: "XCHGQ", - Operands: []operand.Op{mr, mr1}, - Inputs: []operand.Op{mr, mr1}, - Outputs: []operand.Op{mr, mr1}, - }, nil - } - return nil, errors.New("XCHGQ: bad operands") -} - -// XCHGW: Exchange Register/Memory with Register. -// -// Forms: -// -// XCHGW r16 ax -// XCHGW ax r16 -// XCHGW r16 r16 -// XCHGW m16 r16 -// XCHGW r16 m16 -func XCHGW(amr, amr1 operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsR16(amr) && operand.IsAX(amr1): - return &intrep.Instruction{ - Opcode: "XCHGW", - Operands: []operand.Op{amr, amr1}, - Inputs: []operand.Op{amr, amr1}, - Outputs: []operand.Op{amr, amr1}, - }, nil - case operand.IsAX(amr) && operand.IsR16(amr1): - return &intrep.Instruction{ - Opcode: "XCHGW", - Operands: []operand.Op{amr, amr1}, - Inputs: []operand.Op{amr, amr1}, - Outputs: []operand.Op{amr, amr1}, - }, nil - case operand.IsR16(amr) && operand.IsR16(amr1): - return &intrep.Instruction{ - Opcode: "XCHGW", - Operands: []operand.Op{amr, amr1}, - Inputs: []operand.Op{amr, amr1}, - Outputs: []operand.Op{amr, amr1}, - }, nil - case operand.IsM16(amr) && operand.IsR16(amr1): - return &intrep.Instruction{ - Opcode: "XCHGW", - Operands: []operand.Op{amr, amr1}, - Inputs: []operand.Op{amr, amr1}, - Outputs: []operand.Op{amr, amr1}, - }, nil - case operand.IsR16(amr) && operand.IsM16(amr1): - return &intrep.Instruction{ - Opcode: "XCHGW", - Operands: []operand.Op{amr, amr1}, - Inputs: []operand.Op{amr, amr1}, - Outputs: []operand.Op{amr, amr1}, - }, nil - } - return nil, errors.New("XCHGW: bad operands") -} - -// XGETBV: Get Value of Extended Control Register. -// -// Forms: -// -// XGETBV -func XGETBV() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "XGETBV", - Operands: nil, - Inputs: []operand.Op{reg.ECX}, - Outputs: []operand.Op{reg.EAX, reg.EDX}, - }, nil -} - -// XLAT: Table Look-up Translation. -// -// Forms: -// -// XLAT -func XLAT() (*intrep.Instruction, error) { - return &intrep.Instruction{ - Opcode: "XLAT", - Operands: nil, - Inputs: []operand.Op{reg.AL, reg.EBX}, - Outputs: []operand.Op{reg.AL}, - }, nil -} - -// XORB: Logical Exclusive OR. -// -// Forms: -// -// XORB imm8 al -// XORB imm8 r8 -// XORB r8 r8 -// XORB m8 r8 -// XORB imm8 m8 -// XORB r8 m8 -func XORB(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM8(imr) && operand.IsAL(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM8(imr) && operand.IsR8(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR8(imr) && operand.IsM8(amr): - return &intrep.Instruction{ - Opcode: "XORB", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("XORB: bad operands") -} - -// XORL: Logical Exclusive OR. -// -// Forms: -// -// XORL imm32 eax -// XORL imm8 r32 -// XORL imm32 r32 -// XORL r32 r32 -// XORL m32 r32 -// XORL imm8 m32 -// XORL imm32 m32 -// XORL r32 m32 -func XORL(imr, emr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsEAX(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsM32(imr) && operand.IsR32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{emr}, - Outputs: []operand.Op{emr}, - }, nil - case operand.IsR32(imr) && operand.IsM32(emr): - return &intrep.Instruction{ - Opcode: "XORL", - Operands: []operand.Op{imr, emr}, - Inputs: []operand.Op{imr, emr}, - Outputs: []operand.Op{emr}, - }, nil - } - return nil, errors.New("XORL: bad operands") -} - -// XORPD: Bitwise Logical XOR for Double-Precision Floating-Point Values. -// -// Forms: -// -// XORPD xmm xmm -// XORPD m128 xmm -func XORPD(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "XORPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "XORPD", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("XORPD: bad operands") -} - -// XORPS: Bitwise Logical XOR for Single-Precision Floating-Point Values. -// -// Forms: -// -// XORPS xmm xmm -// XORPS m128 xmm -func XORPS(mx, x operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsXMM(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "XORPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - case operand.IsM128(mx) && operand.IsXMM(x): - return &intrep.Instruction{ - Opcode: "XORPS", - Operands: []operand.Op{mx, x}, - Inputs: []operand.Op{mx, x}, - Outputs: []operand.Op{x}, - }, nil - } - return nil, errors.New("XORPS: bad operands") -} - -// XORQ: Logical Exclusive OR. -// -// Forms: -// -// XORQ imm32 rax -// XORQ imm8 r64 -// XORQ imm32 r64 -// XORQ r64 r64 -// XORQ m64 r64 -// XORQ imm8 m64 -// XORQ imm32 m64 -// XORQ r64 m64 -func XORQ(imr, mr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM32(imr) && operand.IsRAX(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsM64(imr) && operand.IsR64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsIMM32(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{mr}, - Outputs: []operand.Op{mr}, - }, nil - case operand.IsR64(imr) && operand.IsM64(mr): - return &intrep.Instruction{ - Opcode: "XORQ", - Operands: []operand.Op{imr, mr}, - Inputs: []operand.Op{imr, mr}, - Outputs: []operand.Op{mr}, - }, nil - } - return nil, errors.New("XORQ: bad operands") -} - -// XORW: Logical Exclusive OR. -// -// Forms: -// -// XORW imm16 ax -// XORW imm8 r16 -// XORW imm16 r16 -// XORW r16 r16 -// XORW m16 r16 -// XORW imm8 m16 -// XORW imm16 m16 -// XORW r16 m16 -func XORW(imr, amr operand.Op) (*intrep.Instruction, error) { - switch { - case operand.IsIMM16(imr) && operand.IsAX(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsM16(imr) && operand.IsR16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM8(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsIMM16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{amr}, - Outputs: []operand.Op{amr}, - }, nil - case operand.IsR16(imr) && operand.IsM16(amr): - return &intrep.Instruction{ - Opcode: "XORW", - Operands: []operand.Op{imr, amr}, - Inputs: []operand.Op{imr, amr}, - Outputs: []operand.Op{amr}, - }, nil - } - return nil, errors.New("XORW: bad operands") -} diff --git a/vendor/github.com/mr-tron/base58/LICENSE b/vendor/github.com/mr-tron/base58/LICENSE deleted file mode 100644 index cb7829a2..00000000 --- a/vendor/github.com/mr-tron/base58/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -MIT License - -Copyright (c) 2017 Denis Subbotin -Copyright (c) 2017 Nika Jones -Copyright (c) 2017 Philip Schlump - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/mr-tron/base58/base58/DEPRECATED.md b/vendor/github.com/mr-tron/base58/base58/DEPRECATED.md deleted file mode 100644 index 0cc7ec72..00000000 --- a/vendor/github.com/mr-tron/base58/base58/DEPRECATED.md +++ /dev/null @@ -1,4 +0,0 @@ -Files from this directory was copied to level up directory -========================================================== - -Now all development will be on top level \ No newline at end of file diff --git a/vendor/github.com/mr-tron/base58/base58/alphabet.go b/vendor/github.com/mr-tron/base58/base58/alphabet.go deleted file mode 100644 index a0f88783..00000000 --- a/vendor/github.com/mr-tron/base58/base58/alphabet.go +++ /dev/null @@ -1,31 +0,0 @@ -package base58 - -// Alphabet is a a b58 alphabet. -type Alphabet struct { - decode [128]int8 - encode [58]byte -} - -// NewAlphabet creates a new alphabet from the passed string. -// -// It panics if the passed string is not 58 bytes long or isn't valid ASCII. -func NewAlphabet(s string) *Alphabet { - if len(s) != 58 { - panic("base58 alphabets must be 58 bytes long") - } - ret := new(Alphabet) - copy(ret.encode[:], s) - for i := range ret.decode { - ret.decode[i] = -1 - } - for i, b := range ret.encode { - ret.decode[b] = int8(i) - } - return ret -} - -// BTCAlphabet is the bitcoin base58 alphabet. -var BTCAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") - -// FlickrAlphabet is the flickr base58 alphabet. -var FlickrAlphabet = NewAlphabet("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ") diff --git a/vendor/github.com/mr-tron/base58/base58/base58.go b/vendor/github.com/mr-tron/base58/base58/base58.go deleted file mode 100644 index 0bbdfc0b..00000000 --- a/vendor/github.com/mr-tron/base58/base58/base58.go +++ /dev/null @@ -1,261 +0,0 @@ -package base58 - -import ( - "fmt" - "math/big" -) - -var ( - bn0 = big.NewInt(0) - bn58 = big.NewInt(58) -) - -// Encode encodes the passed bytes into a base58 encoded string. -func Encode(bin []byte) string { - return FastBase58Encoding(bin) -} - -// EncodeAlphabet encodes the passed bytes into a base58 encoded string with the -// passed alphabet. -func EncodeAlphabet(bin []byte, alphabet *Alphabet) string { - return FastBase58EncodingAlphabet(bin, alphabet) -} - -// FastBase58Encoding encodes the passed bytes into a base58 encoded string. -func FastBase58Encoding(bin []byte) string { - return FastBase58EncodingAlphabet(bin, BTCAlphabet) -} - -// FastBase58EncodingAlphabet encodes the passed bytes into a base58 encoded -// string with the passed alphabet. -func FastBase58EncodingAlphabet(bin []byte, alphabet *Alphabet) string { - zero := alphabet.encode[0] - - binsz := len(bin) - var i, j, zcount, high int - var carry uint32 - - for zcount < binsz && bin[zcount] == 0 { - zcount++ - } - - size := ((binsz-zcount)*138/100 + 1) - - // allocate one big buffer up front - buf := make([]byte, size*2+zcount) - - // use the second half for the temporary buffer - tmp := buf[size+zcount:] - - high = size - 1 - for i = zcount; i < binsz; i++ { - j = size - 1 - for carry = uint32(bin[i]); j > high || carry != 0; j-- { - carry = carry + 256*uint32(tmp[j]) - tmp[j] = byte(carry % 58) - carry /= 58 - } - high = j - } - - for j = 0; j < size && tmp[j] == 0; j++ { - } - - // Use the first half for the result - b58 := buf[:size-j+zcount] - - if zcount != 0 { - for i = 0; i < zcount; i++ { - b58[i] = zero - } - } - - for i = zcount; j < size; i++ { - b58[i] = alphabet.encode[tmp[j]] - j++ - } - - return string(b58) -} - -// TrivialBase58Encoding encodes the passed bytes into a base58 encoded string -// (inefficiently). -func TrivialBase58Encoding(a []byte) string { - return TrivialBase58EncodingAlphabet(a, BTCAlphabet) -} - -// TrivialBase58EncodingAlphabet encodes the passed bytes into a base58 encoded -// string (inefficiently) with the passed alphabet. -func TrivialBase58EncodingAlphabet(a []byte, alphabet *Alphabet) string { - zero := alphabet.encode[0] - idx := len(a)*138/100 + 1 - buf := make([]byte, idx) - bn := new(big.Int).SetBytes(a) - var mo *big.Int - for bn.Cmp(bn0) != 0 { - bn, mo = bn.DivMod(bn, bn58, new(big.Int)) - idx-- - buf[idx] = alphabet.encode[mo.Int64()] - } - for i := range a { - if a[i] != 0 { - break - } - idx-- - buf[idx] = zero - } - return string(buf[idx:]) -} - -// Decode decodes the base58 encoded bytes. -func Decode(str string) ([]byte, error) { - return FastBase58Decoding(str) -} - -// DecodeAlphabet decodes the base58 encoded bytes using the given b58 alphabet. -func DecodeAlphabet(str string, alphabet *Alphabet) ([]byte, error) { - return FastBase58DecodingAlphabet(str, alphabet) -} - -// FastBase58Decoding decodes the base58 encoded bytes. -func FastBase58Decoding(str string) ([]byte, error) { - return FastBase58DecodingAlphabet(str, BTCAlphabet) -} - -// FastBase58DecodingAlphabet decodes the base58 encoded bytes using the given -// b58 alphabet. -func FastBase58DecodingAlphabet(str string, alphabet *Alphabet) ([]byte, error) { - if len(str) == 0 { - return nil, fmt.Errorf("zero length string") - } - - var ( - t uint64 - zmask, c uint32 - zcount int - - b58u = []rune(str) - b58sz = len(b58u) - - outisz = (b58sz + 3) / 4 // check to see if we need to change this buffer size to optimize - binu = make([]byte, (b58sz+3)*3) - bytesleft = b58sz % 4 - - zero = rune(alphabet.encode[0]) - ) - - if bytesleft > 0 { - zmask = (0xffffffff << uint32(bytesleft*8)) - } else { - bytesleft = 4 - } - - var outi = make([]uint32, outisz) - - for i := 0; i < b58sz && b58u[i] == zero; i++ { - zcount++ - } - - for _, r := range b58u { - if r > 127 { - return nil, fmt.Errorf("High-bit set on invalid digit") - } - if alphabet.decode[r] == -1 { - return nil, fmt.Errorf("Invalid base58 digit (%q)", r) - } - - c = uint32(alphabet.decode[r]) - - for j := (outisz - 1); j >= 0; j-- { - t = uint64(outi[j])*58 + uint64(c) - c = uint32(t>>32) & 0x3f - outi[j] = uint32(t & 0xffffffff) - } - - if c > 0 { - return nil, fmt.Errorf("Output number too big (carry to the next int32)") - } - - if outi[0]&zmask != 0 { - return nil, fmt.Errorf("Output number too big (last int32 filled too far)") - } - } - - // the nested for-loop below is the same as the original code: - // switch (bytesleft) { - // case 3: - // *(binu++) = (outi[0] & 0xff0000) >> 16; - // //-fallthrough - // case 2: - // *(binu++) = (outi[0] & 0xff00) >> 8; - // //-fallthrough - // case 1: - // *(binu++) = (outi[0] & 0xff); - // ++j; - // //-fallthrough - // default: - // break; - // } - // - // for (; j < outisz; ++j) - // { - // *(binu++) = (outi[j] >> 0x18) & 0xff; - // *(binu++) = (outi[j] >> 0x10) & 0xff; - // *(binu++) = (outi[j] >> 8) & 0xff; - // *(binu++) = (outi[j] >> 0) & 0xff; - // } - var j, cnt int - for j, cnt = 0, 0; j < outisz; j++ { - for mask := byte(bytesleft-1) * 8; mask <= 0x18; mask, cnt = mask-8, cnt+1 { - binu[cnt] = byte(outi[j] >> mask) - } - if j == 0 { - bytesleft = 4 // because it could be less than 4 the first time through - } - } - - for n, v := range binu { - if v > 0 { - start := n - zcount - if start < 0 { - start = 0 - } - return binu[start:cnt], nil - } - } - return binu[:cnt], nil -} - -// TrivialBase58Decoding decodes the base58 encoded bytes (inefficiently). -func TrivialBase58Decoding(str string) ([]byte, error) { - return TrivialBase58DecodingAlphabet(str, BTCAlphabet) -} - -// TrivialBase58DecodingAlphabet decodes the base58 encoded bytes -// (inefficiently) using the given b58 alphabet. -func TrivialBase58DecodingAlphabet(str string, alphabet *Alphabet) ([]byte, error) { - zero := alphabet.encode[0] - - var zcount int - for i := 0; i < len(str) && str[i] == zero; i++ { - zcount++ - } - leading := make([]byte, zcount) - - var padChar rune = -1 - src := []byte(str) - j := 0 - for ; j < len(src) && src[j] == byte(padChar); j++ { - } - - n := new(big.Int) - for i := range src[j:] { - c := alphabet.decode[src[i]] - if c == -1 { - return nil, fmt.Errorf("illegal base58 data at input index: %d", i) - } - n.Mul(n, bn58) - n.Add(n, big.NewInt(int64(c))) - } - return append(leading, n.Bytes()...), nil -} diff --git a/vendor/github.com/multiformats/go-base32/LICENSE b/vendor/github.com/multiformats/go-base32/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/github.com/multiformats/go-base32/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/multiformats/go-base32/base32.go b/vendor/github.com/multiformats/go-base32/base32.go deleted file mode 100644 index 768a2350..00000000 --- a/vendor/github.com/multiformats/go-base32/base32.go +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package base32 implements base32 encoding as specified by RFC 4648. -package base32 - -import ( - "io" - "strconv" -) - -/* - * Encodings - */ - -// An Encoding is a radix 32 encoding/decoding scheme, defined by a -// 32-character alphabet. The most common is the "base32" encoding -// introduced for SASL GSSAPI and standardized in RFC 4648. -// The alternate "base32hex" encoding is used in DNSSEC. -type Encoding struct { - encode string - decodeMap [256]byte - padChar rune -} - -// Alphabet returns the Base32 alphabet used -func (enc *Encoding) Alphabet() string { - return enc.encode -} - -const ( - StdPadding rune = '=' - NoPadding rune = -1 -) - -const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" -const encodeHex = "0123456789ABCDEFGHIJKLMNOPQRSTUV" - -// NewEncoding returns a new Encoding defined by the given alphabet, -// which must be a 32-byte string. -func NewEncoding(encoder string) *Encoding { - e := new(Encoding) - e.padChar = StdPadding - e.encode = encoder - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[encoder[i]] = byte(i) - } - return e -} - -// NewEncoding returns a new case insensitive Encoding defined by the -// given alphabet, which must be a 32-byte string. -func NewEncodingCI(encoder string) *Encoding { - e := new(Encoding) - e.padChar = StdPadding - e.encode = encoder - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[asciiToLower(encoder[i])] = byte(i) - e.decodeMap[asciiToUpper(encoder[i])] = byte(i) - } - return e -} - -func asciiToLower(c byte) byte { - if c >= 'A' && c <= 'Z' { - return c + 32 - } - return c -} - -func asciiToUpper(c byte) byte { - if c >= 'a' && c <= 'z' { - return c - 32 - } - return c -} - -// WithPadding creates a new encoding identical to enc except -// with a specified padding character, or NoPadding to disable padding. -func (enc Encoding) WithPadding(padding rune) *Encoding { - enc.padChar = padding - return &enc -} - -// StdEncoding is the standard base32 encoding, as defined in -// RFC 4648. -var StdEncoding = NewEncodingCI(encodeStd) - -// HexEncoding is the ``Extended Hex Alphabet'' defined in RFC 4648. -// It is typically used in DNS. -var HexEncoding = NewEncodingCI(encodeHex) - -var RawStdEncoding = NewEncodingCI(encodeStd).WithPadding(NoPadding) -var RawHexEncoding = NewEncodingCI(encodeHex).WithPadding(NoPadding) - -/* - * Encoder - */ - -// Encode encodes src using the encoding enc, writing -// EncodedLen(len(src)) bytes to dst. -// -// The encoding pads the output to a multiple of 8 bytes, -// so Encode is not appropriate for use on individual blocks -// of a large data stream. Use NewEncoder() instead. -func (enc *Encoding) Encode(dst, src []byte) { - if len(src) == 0 { - return - } - - for len(src) > 0 { - var carry byte - - // Unpack 8x 5-bit source blocks into a 5 byte - // destination quantum - switch len(src) { - default: - dst[7] = enc.encode[src[4]&0x1F] - carry = src[4] >> 5 - fallthrough - case 4: - dst[6] = enc.encode[carry|(src[3]<<3)&0x1F] - dst[5] = enc.encode[(src[3]>>2)&0x1F] - carry = src[3] >> 7 - fallthrough - case 3: - dst[4] = enc.encode[carry|(src[2]<<1)&0x1F] - carry = (src[2] >> 4) & 0x1F - fallthrough - case 2: - dst[3] = enc.encode[carry|(src[1]<<4)&0x1F] - dst[2] = enc.encode[(src[1]>>1)&0x1F] - carry = (src[1] >> 6) & 0x1F - fallthrough - case 1: - dst[1] = enc.encode[carry|(src[0]<<2)&0x1F] - dst[0] = enc.encode[src[0]>>3] - } - - // Pad the final quantum - if len(src) < 5 { - if enc.padChar != NoPadding { - dst[7] = byte(enc.padChar) - if len(src) < 4 { - dst[6] = byte(enc.padChar) - dst[5] = byte(enc.padChar) - if len(src) < 3 { - dst[4] = byte(enc.padChar) - if len(src) < 2 { - dst[3] = byte(enc.padChar) - dst[2] = byte(enc.padChar) - } - } - } - } - break - } - src = src[5:] - dst = dst[8:] - } -} - -// EncodeToString returns the base32 encoding of src. -func (enc *Encoding) EncodeToString(src []byte) string { - buf := make([]byte, enc.EncodedLen(len(src))) - enc.Encode(buf, src) - return string(buf) -} - -type encoder struct { - err error - enc *Encoding - w io.Writer - buf [5]byte // buffered data waiting to be encoded - nbuf int // number of bytes in buf - out [1024]byte // output buffer -} - -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - - // Leading fringe. - if e.nbuf > 0 { - var i int - for i = 0; i < len(p) && e.nbuf < 5; i++ { - e.buf[e.nbuf] = p[i] - e.nbuf++ - } - n += i - p = p[i:] - if e.nbuf < 5 { - return - } - e.enc.Encode(e.out[0:], e.buf[0:]) - if _, e.err = e.w.Write(e.out[0:8]); e.err != nil { - return n, e.err - } - e.nbuf = 0 - } - - // Large interior chunks. - for len(p) >= 5 { - nn := len(e.out) / 8 * 5 - if nn > len(p) { - nn = len(p) - nn -= nn % 5 - } - e.enc.Encode(e.out[0:], p[0:nn]) - if _, e.err = e.w.Write(e.out[0 : nn/5*8]); e.err != nil { - return n, e.err - } - n += nn - p = p[nn:] - } - - // Trailing fringe. - for i := 0; i < len(p); i++ { - e.buf[i] = p[i] - } - e.nbuf = len(p) - n += len(p) - return -} - -// Close flushes any pending output from the encoder. -// It is an error to call Write after calling Close. -func (e *encoder) Close() error { - // If there's anything left in the buffer, flush it out - if e.err == nil && e.nbuf > 0 { - e.enc.Encode(e.out[0:], e.buf[0:e.nbuf]) - e.nbuf = 0 - _, e.err = e.w.Write(e.out[0:8]) - } - return e.err -} - -// NewEncoder returns a new base32 stream encoder. Data written to -// the returned writer will be encoded using enc and then written to w. -// Base32 encodings operate in 5-byte blocks; when finished -// writing, the caller must Close the returned encoder to flush any -// partially written blocks. -func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser { - return &encoder{enc: enc, w: w} -} - -// EncodedLen returns the length in bytes of the base32 encoding -// of an input buffer of length n. -func (enc *Encoding) EncodedLen(n int) int { - if enc.padChar == NoPadding { - return (n*8 + 4) / 5 // minimum # chars at 5 bits per char - } - return (n + 4) / 5 * 8 -} - -/* - * Decoder - */ - -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "illegal base32 data at input byte " + strconv.FormatInt(int64(e), 10) -} - -// decode is like Decode but returns an additional 'end' value, which -// indicates if end-of-message padding was encountered and thus any -// additional data is an error. This method assumes that src has been -// stripped of all supported whitespace ('\r' and '\n'). -func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { - olen := len(src) - for len(src) > 0 && !end { - // Decode quantum using the base32 alphabet - var dbuf [8]byte - dlen := 8 - - for j := 0; j < 8; { - if len(src) == 0 { - if enc.padChar != NoPadding { - return n, false, CorruptInputError(olen - len(src) - j) - } - dlen = j - break - } - in := src[0] - src = src[1:] - if in == byte(enc.padChar) && j >= 2 && len(src) < 8 { - if enc.padChar == NoPadding { - return n, false, CorruptInputError(olen) - } - - // We've reached the end and there's padding - if len(src)+j < 8-1 { - // not enough padding - return n, false, CorruptInputError(olen) - } - for k := 0; k < 8-1-j; k++ { - if len(src) > k && src[k] != byte(enc.padChar) { - // incorrect padding - return n, false, CorruptInputError(olen - len(src) + k - 1) - } - } - dlen, end = j, true - // 7, 5 and 2 are not valid padding lengths, and so 1, 3 and 6 are not - // valid dlen values. See RFC 4648 Section 6 "Base 32 Encoding" listing - // the five valid padding lengths, and Section 9 "Illustrations and - // Examples" for an illustration for how the 1st, 3rd and 6th base32 - // src bytes do not yield enough information to decode a dst byte. - if dlen == 1 || dlen == 3 || dlen == 6 { - return n, false, CorruptInputError(olen - len(src) - 1) - } - break - } - dbuf[j] = enc.decodeMap[in] - if dbuf[j] == 0xFF { - return n, false, CorruptInputError(olen - len(src) - 1) - } - j++ - } - - // Pack 8x 5-bit source blocks into 5 byte destination - // quantum - switch dlen { - case 8: - dst[4] = dbuf[6]<<5 | dbuf[7] - fallthrough - case 7: - dst[3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 - fallthrough - case 5: - dst[2] = dbuf[3]<<4 | dbuf[4]>>1 - fallthrough - case 4: - dst[1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 - fallthrough - case 2: - dst[0] = dbuf[0]<<3 | dbuf[1]>>2 - } - - if len(dst) > 5 { - dst = dst[5:] - } - - switch dlen { - case 2: - n += 1 - case 4: - n += 2 - case 5: - n += 3 - case 7: - n += 4 - case 8: - n += 5 - } - } - return n, end, nil -} - -// Decode decodes src using the encoding enc. It writes at most -// DecodedLen(len(src)) bytes to dst and returns the number of bytes -// written. If src contains invalid base32 data, it will return the -// number of bytes successfully written and CorruptInputError. -// New line characters (\r and \n) are ignored. -func (enc *Encoding) Decode(dst, s []byte) (n int, err error) { - // FIXME: if dst is the same as s use decodeInPlace - stripped := make([]byte, 0, len(s)) - for _, c := range s { - if c != '\r' && c != '\n' { - stripped = append(stripped, c) - } - } - n, _, err = enc.decode(dst, stripped) - return -} - -func (enc *Encoding) decodeInPlace(strb []byte) (n int, err error) { - off := 0 - for _, b := range strb { - if b == '\n' || b == '\r' { - continue - } - strb[off] = b - off++ - } - n, _, err = enc.decode(strb, strb[:off]) - return -} - -// DecodeString returns the bytes represented by the base32 string s. -func (enc *Encoding) DecodeString(s string) ([]byte, error) { - strb := []byte(s) - n, err := enc.decodeInPlace(strb) - if err != nil { - return nil, err - } - return strb[:n], nil -} - -type decoder struct { - err error - enc *Encoding - r io.Reader - end bool // saw end of message - buf [1024]byte // leftover input - nbuf int - out []byte // leftover decoded output - outbuf [1024 / 8 * 5]byte -} - -func (d *decoder) Read(p []byte) (n int, err error) { - if d.err != nil { - return 0, d.err - } - - // Use leftover decoded output from last read. - if len(d.out) > 0 { - n = copy(p, d.out) - d.out = d.out[n:] - return n, nil - } - - // Read a chunk. - nn := len(p) / 5 * 8 - if nn < 8 { - nn = 8 - } - if nn > len(d.buf) { - nn = len(d.buf) - } - nn, d.err = io.ReadAtLeast(d.r, d.buf[d.nbuf:nn], 8-d.nbuf) - d.nbuf += nn - if d.nbuf < 8 { - return 0, d.err - } - - // Decode chunk into p, or d.out and then p if p is too small. - nr := d.nbuf / 8 * 8 - nw := d.nbuf / 8 * 5 - if nw > len(p) { - nw, d.end, d.err = d.enc.decode(d.outbuf[0:], d.buf[0:nr]) - d.out = d.outbuf[0:nw] - n = copy(p, d.out) - d.out = d.out[n:] - } else { - n, d.end, d.err = d.enc.decode(p, d.buf[0:nr]) - } - d.nbuf -= nr - for i := 0; i < d.nbuf; i++ { - d.buf[i] = d.buf[i+nr] - } - - if d.err == nil { - d.err = err - } - return n, d.err -} - -type newlineFilteringReader struct { - wrapped io.Reader -} - -func (r *newlineFilteringReader) Read(p []byte) (int, error) { - n, err := r.wrapped.Read(p) - for n > 0 { - offset := 0 - for i, b := range p[0:n] { - if b != '\r' && b != '\n' { - if i != offset { - p[offset] = b - } - offset++ - } - } - if offset > 0 { - return offset, err - } - // Previous buffer entirely whitespace, read again - n, err = r.wrapped.Read(p) - } - return n, err -} - -// NewDecoder constructs a new base32 stream decoder. -func NewDecoder(enc *Encoding, r io.Reader) io.Reader { - return &decoder{enc: enc, r: &newlineFilteringReader{r}} -} - -// DecodedLen returns the maximum length in bytes of the decoded data -// corresponding to n bytes of base32-encoded data. -func (enc *Encoding) DecodedLen(n int) int { - if enc.padChar == NoPadding { - return (n*5 + 7) / 8 - } - - return n / 8 * 5 -} diff --git a/vendor/github.com/multiformats/go-base32/go.mod b/vendor/github.com/multiformats/go-base32/go.mod deleted file mode 100644 index fcc446fe..00000000 --- a/vendor/github.com/multiformats/go-base32/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/multiformats/go-base32 diff --git a/vendor/github.com/multiformats/go-base32/package.json b/vendor/github.com/multiformats/go-base32/package.json deleted file mode 100644 index 04a9970d..00000000 --- a/vendor/github.com/multiformats/go-base32/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "author": "Golang", - "bugs": { - "url": "https://github.com/multiformats/go-base32" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-base32" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "BSD-3", - "name": "base32", - "version": "0.0.3" -} - diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/.gitignore b/vendor/github.com/multiformats/go-multiaddr-dns/.gitignore deleted file mode 100644 index 4621ab73..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/madns/madns diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/.travis.yml b/vendor/github.com/multiformats/go-multiaddr-dns/.travis.yml deleted file mode 100644 index 18f4287d..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/LICENSE b/vendor/github.com/multiformats/go-multiaddr-dns/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/README.md b/vendor/github.com/multiformats/go-multiaddr-dns/README.md deleted file mode 100644 index a1ac5447..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# go-multiaddr-dns - -> Resolve /dns4, /dns6, and /dnsaddr multiaddrs. - -```sh -> madns /dnsaddr/ipfs.io/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -/ip6/fc3d:9a4e:3c96:2fd2:1afa:18fe:8dd2:b602/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -/dns4/jupiter.i.ipfs.io/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -/dns6/jupiter.i.ipfs.io/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx -``` - - -In more detail: - -```sh -> madns /dns6/example.net -/ip6/2001:db8::a3 -/ip6/2001:db8::a4 -... - -> madns /dns4/example.net/tcp/443/wss -/ip4/192.0.2.1/tcp/443/wss -/ip4/192.0.2.2/tcp/443/wss - -# No-op if it's not a dns-ish address. - -> madns /ip4/127.0.0.1/tcp/8080 -/ip4/127.0.0.1/tcp/8080 - -# /dnsaddr resolves by looking up TXT records. - -> dig +short TXT _dnsaddr.example.net -"dnsaddr=/ip6/2001:db8::a3/tcp/443/wss/ipfs/Qmfoo" -"dnsaddr=/ip6/2001:db8::a4/tcp/443/wss/ipfs/Qmbar" -"dnsaddr=/ip4/192.0.2.1/tcp/443/wss/ipfs/Qmfoo" -"dnsaddr=/ip4/192.0.2.2/tcp/443/wss/ipfs/Qmbar" -... - -# /dnsaddr returns addrs which encapsulate whatever /dnsaddr encapsulates too. - -> madns example.net/ipfs/Qmfoo -info: changing query to /dnsaddr/example.net/ipfs/Qmfoo -/ip6/2001:db8::a3/tcp/443/wss/ipfs/Qmfoo -/ip4/192.0.2.1/tcp/443/wss/ipfs/Qmfoo - -# TODO -p filters by protocol stacks. - -> madns -p /ip6/tcp/wss /dnsaddr/example.net -/ip6/2001:db8::a3/tcp/443/wss/ipfs/Qmfoo -/ip6/2001:db8::a4/tcp/443/wss/ipfs/Qmbar - -# TOOD -c filters by CIDR -> madns -c /ip4/104.236.76.0/ipcidr/24 /dnsaddr/example.net -/ip4/192.0.2.2/tcp/443/wss/ipfs/Qmbar -``` diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/dns.go b/vendor/github.com/multiformats/go-multiaddr-dns/dns.go deleted file mode 100644 index 53c82dfd..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/dns.go +++ /dev/null @@ -1,69 +0,0 @@ -package madns - -import ( - "bytes" - "fmt" - - ma "github.com/multiformats/go-multiaddr" -) - -// Extracted from source of truth for multicodec codes: https://github.com/multiformats/multicodec -const ( - P_DNS4 = 0x0036 - P_DNS6 = 0x0037 - P_DNSADDR = 0x0038 -) - -var Dns4Protocol = ma.Protocol{ - Code: P_DNS4, - Size: ma.LengthPrefixedVarSize, - Name: "dns4", - VCode: ma.CodeToVarint(P_DNS4), - Transcoder: DnsTranscoder, -} -var Dns6Protocol = ma.Protocol{ - Code: P_DNS6, - Size: ma.LengthPrefixedVarSize, - Name: "dns6", - VCode: ma.CodeToVarint(P_DNS6), - Transcoder: DnsTranscoder, -} -var DnsaddrProtocol = ma.Protocol{ - Code: P_DNSADDR, - Size: ma.LengthPrefixedVarSize, - Name: "dnsaddr", - VCode: ma.CodeToVarint(P_DNSADDR), - Transcoder: DnsTranscoder, -} - -func init() { - err := ma.AddProtocol(Dns4Protocol) - if err != nil { - panic(fmt.Errorf("error registering dns4 protocol: %s", err)) - } - err = ma.AddProtocol(Dns6Protocol) - if err != nil { - panic(fmt.Errorf("error registering dns6 protocol: %s", err)) - } - err = ma.AddProtocol(DnsaddrProtocol) - if err != nil { - panic(fmt.Errorf("error registering dnsaddr protocol: %s", err)) - } -} - -var DnsTranscoder = ma.NewTranscoderFromFunctions(dnsStB, dnsBtS, dnsVal) - -func dnsVal(b []byte) error { - if bytes.IndexByte(b, '/') >= 0 { - return fmt.Errorf("domain name %q contains a slash", string(b)) - } - return nil -} - -func dnsStB(s string) ([]byte, error) { - return []byte(s), nil -} - -func dnsBtS(b []byte) (string, error) { - return string(b), nil -} diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/go.mod b/vendor/github.com/multiformats/go-multiaddr-dns/go.mod deleted file mode 100644 index fb228c60..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/multiformats/go-multiaddr-dns - -require github.com/multiformats/go-multiaddr v0.0.1 diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/go.sum b/vendor/github.com/multiformats/go-multiaddr-dns/go.sum deleted file mode 100644 index cbf49eb4..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/package.json b/vendor/github.com/multiformats/go-multiaddr-dns/package.json deleted file mode 100644 index 81fb932c..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "author": "lgierth", - "bugs": { - "url": "https://github.com/multiformats/go-multiaddr-dns/issues" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multiaddr-dns" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - } - ], - "gxVersion": "0.10.0", - "language": "go", - "license": "MIT", - "name": "go-multiaddr-dns", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.3.2" -} - diff --git a/vendor/github.com/multiformats/go-multiaddr-dns/resolve.go b/vendor/github.com/multiformats/go-multiaddr-dns/resolve.go deleted file mode 100644 index 9c81c2f5..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-dns/resolve.go +++ /dev/null @@ -1,181 +0,0 @@ -package madns - -import ( - "context" - "fmt" - "net" - "strings" - - ma "github.com/multiformats/go-multiaddr" -) - -var ResolvableProtocols = []ma.Protocol{DnsaddrProtocol, Dns4Protocol, Dns6Protocol} -var DefaultResolver = &Resolver{Backend: net.DefaultResolver} - -type backend interface { - LookupIPAddr(context.Context, string) ([]net.IPAddr, error) - LookupTXT(context.Context, string) ([]string, error) -} - -type Resolver struct { - Backend backend -} - -type MockBackend struct { - IP map[string][]net.IPAddr - TXT map[string][]string -} - -func (r *MockBackend) LookupIPAddr(ctx context.Context, name string) ([]net.IPAddr, error) { - results, ok := r.IP[name] - if ok { - return results, nil - } else { - return []net.IPAddr{}, nil - } -} - -func (r *MockBackend) LookupTXT(ctx context.Context, name string) ([]string, error) { - results, ok := r.TXT[name] - if ok { - return results, nil - } else { - return []string{}, nil - } -} - -func Matches(maddr ma.Multiaddr) bool { - protos := maddr.Protocols() - if len(protos) == 0 { - return false - } - - for _, p := range ResolvableProtocols { - if protos[0].Code == p.Code { - return true - } - } - - return false -} - -func Resolve(ctx context.Context, maddr ma.Multiaddr) ([]ma.Multiaddr, error) { - return DefaultResolver.Resolve(ctx, maddr) -} - -func (r *Resolver) Resolve(ctx context.Context, maddr ma.Multiaddr) ([]ma.Multiaddr, error) { - if !Matches(maddr) { - return []ma.Multiaddr{maddr}, nil - } - - protos := maddr.Protocols() - if protos[0].Code == Dns4Protocol.Code { - return r.resolveDns4(ctx, maddr) - } - if protos[0].Code == Dns6Protocol.Code { - return r.resolveDns6(ctx, maddr) - } - if protos[0].Code == DnsaddrProtocol.Code { - return r.resolveDnsaddr(ctx, maddr) - } - - panic("unreachable") -} - -func (r *Resolver) resolveDns4(ctx context.Context, maddr ma.Multiaddr) ([]ma.Multiaddr, error) { - value, err := maddr.ValueForProtocol(Dns4Protocol.Code) - if err != nil { - return nil, fmt.Errorf("error resolving %s: %s", maddr.String(), err) - } - - encap := ma.Split(maddr)[1:] - - result := []ma.Multiaddr{} - records, err := r.Backend.LookupIPAddr(ctx, value) - if err != nil { - return result, err - } - - for _, r := range records { - ip4 := r.IP.To4() - if ip4 == nil { - continue - } - ip4maddr, err := ma.NewMultiaddr("/ip4/" + ip4.String()) - if err != nil { - return result, err - } - parts := append([]ma.Multiaddr{ip4maddr}, encap...) - result = append(result, ma.Join(parts...)) - } - return result, nil -} - -func (r *Resolver) resolveDns6(ctx context.Context, maddr ma.Multiaddr) ([]ma.Multiaddr, error) { - value, err := maddr.ValueForProtocol(Dns6Protocol.Code) - if err != nil { - return nil, fmt.Errorf("error resolving %s: %s", maddr.String(), err) - } - - encap := ma.Split(maddr)[1:] - - result := []ma.Multiaddr{} - records, err := r.Backend.LookupIPAddr(ctx, value) - if err != nil { - return result, err - } - - for _, r := range records { - if r.IP.To4() != nil { - continue - } - ip6maddr, err := ma.NewMultiaddr("/ip6/" + r.IP.To16().String()) - if err != nil { - return result, err - } - parts := append([]ma.Multiaddr{ip6maddr}, encap...) - result = append(result, ma.Join(parts...)) - } - return result, nil -} - -func (r *Resolver) resolveDnsaddr(ctx context.Context, maddr ma.Multiaddr) ([]ma.Multiaddr, error) { - value, err := maddr.ValueForProtocol(DnsaddrProtocol.Code) - if err != nil { - return nil, fmt.Errorf("error resolving %s: %s", maddr.String(), err) - } - - trailer := ma.Split(maddr)[1:] - - result := []ma.Multiaddr{} - records, err := r.Backend.LookupTXT(ctx, "_dnsaddr."+value) - if err != nil { - return result, err - } - - for _, r := range records { - rv := strings.Split(r, "dnsaddr=") - if len(rv) != 2 { - continue - } - - rmaddr, err := ma.NewMultiaddr(rv[1]) - if err != nil { - return result, err - } - - if matchDnsaddr(rmaddr, trailer) { - result = append(result, rmaddr) - } - } - return result, nil -} - -// XXX probably insecure -func matchDnsaddr(maddr ma.Multiaddr, trailer []ma.Multiaddr) bool { - parts := ma.Split(maddr) - if ma.Join(parts[len(parts)-len(trailer):]...).Equal(ma.Join(trailer...)) { - return true - } - return false -} diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/.travis.yml b/vendor/github.com/multiformats/go-multiaddr-fmt/.travis.yml deleted file mode 100644 index e4b63473..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - - IPFS_REUSEPORT=false - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/LICENSE b/vendor/github.com/multiformats/go-multiaddr-fmt/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/README.md b/vendor/github.com/multiformats/go-multiaddr-fmt/README.md deleted file mode 100644 index 9fdc5389..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# multiaddr format -A validation checker for multiaddrs. Some basic validators for common address -types are provided, but creating your own combinations is easy. - -Usage: -```go -a, _ := ma.NewMultiaddr("/ip4/5.2.67.3/tcp/1708") -TCP.Matches(a) // returns true -``` - -Making your own validators is easy, for example, the `Reliable` multiaddr is -defined as follows: - -```go -// Define IP as either ipv4 or ipv6 -var IP = Or(Base(ma.P_IP4), Base(ma.P_IP6)) - -// Define TCP as 'tcp' on top of either ipv4 or ipv6 -var TCP = And(IP, Base(ma.P_TCP)) - -// Define UDP as 'udp' on top of either ipv4 or ipv6 -var UDP = And(IP, Base(ma.P_UDP)) - -// Define UTP as 'utp' on top of udp (on top of ipv4 or ipv6) -var UTP = And(UDP, Base(ma.P_UTP)) - -// Now define a Reliable transport as either tcp or utp -var Reliable = Or(TCP, UTP) - -// From here, we can easily define multiaddrs for protocols that can run on top -// of any 'reliable' transport (such as ipfs) -``` - -NOTE: the above patterns are already implemented in package diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/go.mod b/vendor/github.com/multiformats/go-multiaddr-fmt/go.mod deleted file mode 100644 index db40536c..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/multiformats/go-multiaddr-fmt - -require ( - github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-dns v0.0.2 -) diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/go.sum b/vendor/github.com/multiformats/go-multiaddr-fmt/go.sum deleted file mode 100644 index e6220da6..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/go.sum +++ /dev/null @@ -1,20 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/package.json b/vendor/github.com/multiformats/go-multiaddr-fmt/package.json deleted file mode 100644 index 8303f9c8..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/multiformats/go-multiaddr-fmt" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - }, - { - "author": "lgierth", - "hash": "QmR1T4gAM6XCHQugKnPZgZVPzo8WkuvSpL57EKQFgFbwfd", - "name": "go-multiaddr-dns", - "version": "0.3.2" - } - ], - "gxVersion": "0.6.0", - "gx_version": "0.4.0", - "issues_url": "https://github.com/multiformats/go-multiaddr-fmt", - "language": "go", - "license": "", - "name": "go-multiaddr-fmt", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.2.11" -} - diff --git a/vendor/github.com/multiformats/go-multiaddr-fmt/patterns.go b/vendor/github.com/multiformats/go-multiaddr-fmt/patterns.go deleted file mode 100644 index 62c45414..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-fmt/patterns.go +++ /dev/null @@ -1,172 +0,0 @@ -package mafmt - -import ( - "strings" - - ma "github.com/multiformats/go-multiaddr" - madns "github.com/multiformats/go-multiaddr-dns" -) - -// Define a dns4 format multiaddr -var DNS4 = Base(madns.P_DNS4) - -// Define a dns6 format multiaddr -var DNS6 = Base(madns.P_DNS6) - -// Define a dnsaddr, dns4 or dns6 format multiaddr -var DNS = Or( - Base(madns.P_DNSADDR), - DNS4, - DNS6, -) - -// Define IP as either ipv4 or ipv6 -var IP = Or(Base(ma.P_IP4), Base(ma.P_IP6)) - -// Define TCP as 'tcp' on top of either ipv4 or ipv6, or dns equivalents. -var TCP = Or( - And(DNS, Base(ma.P_TCP)), - And(IP, Base(ma.P_TCP)), -) - -// Define UDP as 'udp' on top of either ipv4 or ipv6, or dns equivalents. -var UDP = Or( - And(DNS, Base(ma.P_UDP)), - And(IP, Base(ma.P_UDP)), -) - -// Define UTP as 'utp' on top of udp (on top of ipv4 or ipv6). -var UTP = And(UDP, Base(ma.P_UTP)) - -// Define QUIC as 'quic' on top of udp (on top of ipv4 or ipv6) -var QUIC = And(UDP, Base(ma.P_QUIC)) - -// Define unreliable transport as udp -var Unreliable = Or(UDP) - -// Now define a Reliable transport as either tcp or utp or quic -var Reliable = Or(TCP, UTP, QUIC) - -// IPFS can run over any reliable underlying transport protocol -var IPFS = And(Reliable, Base(ma.P_IPFS)) - -// Define http over TCP or DNS or http over DNS format multiaddr -var HTTP = Or( - And(TCP, Base(ma.P_HTTP)), - And(IP, Base(ma.P_HTTP)), - And(DNS, Base(ma.P_HTTP)), -) - -// Define https over TCP or DNS or https over DNS format multiaddr -var HTTPS = Or( - And(TCP, Base(ma.P_HTTPS)), - And(IP, Base(ma.P_HTTPS)), - And(DNS, Base(ma.P_HTTPS)), -) - -// Define p2p-webrtc-direct over HTTP or p2p-webrtc-direct over HTTPS format multiaddr -var WebRTCDirect = Or( - And(HTTP, Base(ma.P_P2P_WEBRTC_DIRECT)), - And(HTTPS, Base(ma.P_P2P_WEBRTC_DIRECT))) - -const ( - or = iota - and = iota -) - -func And(ps ...Pattern) Pattern { - return &pattern{ - Op: and, - Args: ps, - } -} - -func Or(ps ...Pattern) Pattern { - return &pattern{ - Op: or, - Args: ps, - } -} - -type Pattern interface { - Matches(ma.Multiaddr) bool - partialMatch([]ma.Protocol) (bool, []ma.Protocol) - String() string -} - -type pattern struct { - Args []Pattern - Op int -} - -func (ptrn *pattern) Matches(a ma.Multiaddr) bool { - ok, rem := ptrn.partialMatch(a.Protocols()) - return ok && len(rem) == 0 -} - -func (ptrn *pattern) partialMatch(pcs []ma.Protocol) (bool, []ma.Protocol) { - switch ptrn.Op { - case or: - for _, a := range ptrn.Args { - ok, rem := a.partialMatch(pcs) - if ok { - return true, rem - } - } - return false, nil - case and: - if len(pcs) < len(ptrn.Args) { - return false, nil - } - - for i := 0; i < len(ptrn.Args); i++ { - ok, rem := ptrn.Args[i].partialMatch(pcs) - if !ok { - return false, nil - } - - pcs = rem - } - - return true, pcs - default: - panic("unrecognized pattern operand") - } -} - -func (ptrn *pattern) String() string { - var sub []string - for _, a := range ptrn.Args { - sub = append(sub, a.String()) - } - - switch ptrn.Op { - case and: - return strings.Join(sub, "/") - case or: - return "{" + strings.Join(sub, "|") + "}" - default: - panic("unrecognized pattern op!") - } -} - -type Base int - -func (p Base) Matches(a ma.Multiaddr) bool { - pcs := a.Protocols() - return pcs[0].Code == int(p) && len(pcs) == 1 -} - -func (p Base) partialMatch(pcs []ma.Protocol) (bool, []ma.Protocol) { - if len(pcs) == 0 { - return false, nil - } - if pcs[0].Code == int(p) { - return true, pcs[1:] - } - return false, nil -} - -func (p Base) String() string { - return ma.ProtocolWithCode(int(p)).Name -} diff --git a/vendor/github.com/multiformats/go-multiaddr-net/.gitignore b/vendor/github.com/multiformats/go-multiaddr-net/.gitignore deleted file mode 100644 index a186a0e4..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/gx* -*.swp diff --git a/vendor/github.com/multiformats/go-multiaddr-net/.travis.yml b/vendor/github.com/multiformats/go-multiaddr-net/.travis.yml deleted file mode 100644 index 18f4287d..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multiaddr-net/LICENSE b/vendor/github.com/multiformats/go-multiaddr-net/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multiaddr-net/Makefile b/vendor/github.com/multiformats/go-multiaddr-net/Makefile deleted file mode 100644 index 54152565..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite diff --git a/vendor/github.com/multiformats/go-multiaddr-net/README.md b/vendor/github.com/multiformats/go-multiaddr-net/README.md deleted file mode 100644 index c13d248f..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# go-multiaddr-net - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/multiformats/go-multiaddr-net?status.svg)](https://godoc.org/github.com/multiformats/go-multiaddr-net) -[![Travis CI](https://img.shields.io/travis/multiformats/go-multiaddr-net.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multiaddr-net) - - - -> Multiaddress net tools - -This package provides [Multiaddr](https://github.com/multiformats/go-multiaddr) specific versions of common functions in [stdlib](https://github.com/golang/go/tree/master/src)'s `net` package. This means wrappers of standard net symbols like `net.Dial` and `net.Listen`, as well -as conversion to and from `net.Addr`. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Maintainers](#maintainers) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-multiaddr-net` is a standard Go module which can be installed with: - -```sh -go get github.com/multiformats/go-multiaddr-net -``` - -Note that `go-multiaddr-net` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section). - - -## Usage - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project do: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/multiformats/go-multiaddr-net -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -For further usage, see the docs: - -- `multiaddr/net`: https://godoc.org/github.com/multiformats/go-multiaddr-net -- `multiaddr`: https://godoc.org/github.com/multiformats/go-multiaddr - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multiaddr-net/issues). - -Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2014 Juan Batiz-Benet diff --git a/vendor/github.com/multiformats/go-multiaddr-net/convert.go b/vendor/github.com/multiformats/go-multiaddr-net/convert.go deleted file mode 100644 index 061f1c48..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/convert.go +++ /dev/null @@ -1,269 +0,0 @@ -package manet - -import ( - "fmt" - "net" - "path/filepath" - - ma "github.com/multiformats/go-multiaddr" - madns "github.com/multiformats/go-multiaddr-dns" -) - -var errIncorrectNetAddr = fmt.Errorf("incorrect network addr conversion") - -// FromNetAddr converts a net.Addr type to a Multiaddr. -func FromNetAddr(a net.Addr) (ma.Multiaddr, error) { - return defaultCodecs.FromNetAddr(a) -} - -// FromNetAddr converts a net.Addr to Multiaddress. -func (cm *CodecMap) FromNetAddr(a net.Addr) (ma.Multiaddr, error) { - if a == nil { - return nil, fmt.Errorf("nil multiaddr") - } - p, err := cm.getAddrParser(a.Network()) - if err != nil { - return nil, err - } - - return p(a) -} - -// ToNetAddr converts a Multiaddr to a net.Addr -// Must be ThinWaist. acceptable protocol stacks are: -// /ip{4,6}/{tcp, udp} -func ToNetAddr(maddr ma.Multiaddr) (net.Addr, error) { - return defaultCodecs.ToNetAddr(maddr) -} - -// ToNetAddr converts a Multiaddress to a standard net.Addr. -func (cm *CodecMap) ToNetAddr(maddr ma.Multiaddr) (net.Addr, error) { - protos := maddr.Protocols() - final := protos[len(protos)-1] - - p, err := cm.getMaddrParser(final.Name) - if err != nil { - return nil, err - } - - return p(maddr) -} - -func parseBasicNetMaddr(maddr ma.Multiaddr) (net.Addr, error) { - network, host, err := DialArgs(maddr) - if err != nil { - return nil, err - } - - switch network { - case "tcp", "tcp4", "tcp6": - return net.ResolveTCPAddr(network, host) - case "udp", "udp4", "udp6": - return net.ResolveUDPAddr(network, host) - case "ip", "ip4", "ip6": - return net.ResolveIPAddr(network, host) - case "unix": - return net.ResolveUnixAddr(network, host) - } - - return nil, fmt.Errorf("network not supported: %s", network) -} - -func FromIPAndZone(ip net.IP, zone string) (ma.Multiaddr, error) { - switch { - case ip.To4() != nil: - return ma.NewComponent("ip4", ip.String()) - case ip.To16() != nil: - ip6, err := ma.NewComponent("ip6", ip.String()) - if err != nil { - return nil, err - } - if zone == "" { - return ip6, nil - } else { - zone, err := ma.NewComponent("ip6zone", zone) - if err != nil { - return nil, err - } - return zone.Encapsulate(ip6), nil - } - default: - return nil, errIncorrectNetAddr - } -} - -// FromIP converts a net.IP type to a Multiaddr. -func FromIP(ip net.IP) (ma.Multiaddr, error) { - return FromIPAndZone(ip, "") -} - -// DialArgs is a convenience function that returns network and address as -// expected by net.Dial. See https://godoc.org/net#Dial for an overview of -// possible return values (we do not support the unixpacket ones yet). Unix -// addresses do not, at present, compose. -func DialArgs(m ma.Multiaddr) (string, string, error) { - var ( - zone, network, ip, port string - err error - hostname bool - ) - - ma.ForEach(m, func(c ma.Component) bool { - switch network { - case "": - switch c.Protocol().Code { - case ma.P_IP6ZONE: - if zone != "" { - err = fmt.Errorf("%s has multiple zones", m) - return false - } - zone = c.Value() - return true - case ma.P_IP6: - network = "ip6" - ip = c.Value() - return true - case ma.P_IP4: - if zone != "" { - err = fmt.Errorf("%s has ip4 with zone", m) - return false - } - network = "ip4" - ip = c.Value() - return true - case madns.Dns4Protocol.Code: - network = "ip4" - hostname = true - ip = c.Value() - return true - case madns.Dns6Protocol.Code: - network = "ip6" - hostname = true - ip = c.Value() - return true - case ma.P_UNIX: - network = "unix" - ip = c.Value() - return false - } - case "ip4": - switch c.Protocol().Code { - case ma.P_UDP: - network = "udp4" - case ma.P_TCP: - network = "tcp4" - default: - return false - } - port = c.Value() - case "ip6": - switch c.Protocol().Code { - case ma.P_UDP: - network = "udp6" - case ma.P_TCP: - network = "tcp6" - default: - return false - } - port = c.Value() - } - // Done. - return false - }) - if err != nil { - return "", "", err - } - - switch network { - case "ip6": - if zone != "" { - ip += "%" + zone - } - fallthrough - case "ip4": - return network, ip, nil - case "tcp4", "udp4": - return network, ip + ":" + port, nil - case "tcp6", "udp6": - if zone != "" { - ip += "%" + zone - } - if hostname { - return network, ip + ":" + port, nil - } - return network, "[" + ip + "]" + ":" + port, nil - case "unix": - return network, ip, nil - default: - return "", "", fmt.Errorf("%s is not a 'thin waist' address", m) - } -} - -func parseTCPNetAddr(a net.Addr) (ma.Multiaddr, error) { - ac, ok := a.(*net.TCPAddr) - if !ok { - return nil, errIncorrectNetAddr - } - - // Get IP Addr - ipm, err := FromIPAndZone(ac.IP, ac.Zone) - if err != nil { - return nil, errIncorrectNetAddr - } - - // Get TCP Addr - tcpm, err := ma.NewMultiaddr(fmt.Sprintf("/tcp/%d", ac.Port)) - if err != nil { - return nil, errIncorrectNetAddr - } - - // Encapsulate - return ipm.Encapsulate(tcpm), nil -} - -func parseUDPNetAddr(a net.Addr) (ma.Multiaddr, error) { - ac, ok := a.(*net.UDPAddr) - if !ok { - return nil, errIncorrectNetAddr - } - - // Get IP Addr - ipm, err := FromIPAndZone(ac.IP, ac.Zone) - if err != nil { - return nil, errIncorrectNetAddr - } - - // Get UDP Addr - udpm, err := ma.NewMultiaddr(fmt.Sprintf("/udp/%d", ac.Port)) - if err != nil { - return nil, errIncorrectNetAddr - } - - // Encapsulate - return ipm.Encapsulate(udpm), nil -} - -func parseIPNetAddr(a net.Addr) (ma.Multiaddr, error) { - ac, ok := a.(*net.IPAddr) - if !ok { - return nil, errIncorrectNetAddr - } - return FromIPAndZone(ac.IP, ac.Zone) -} - -func parseIPPlusNetAddr(a net.Addr) (ma.Multiaddr, error) { - ac, ok := a.(*net.IPNet) - if !ok { - return nil, errIncorrectNetAddr - } - return FromIP(ac.IP) -} - -func parseUnixNetAddr(a net.Addr) (ma.Multiaddr, error) { - ac, ok := a.(*net.UnixAddr) - if !ok { - return nil, errIncorrectNetAddr - } - cleaned := filepath.Clean(ac.Name) - return ma.NewComponent("unix", cleaned) -} diff --git a/vendor/github.com/multiformats/go-multiaddr-net/doc.go b/vendor/github.com/multiformats/go-multiaddr-net/doc.go deleted file mode 100644 index 040ad3f0..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package manet provides Multiaddr specific versions of common -// functions in stdlib's net package. This means wrappers of -// standard net symbols like net.Dial and net.Listen, as well -// as conversion to/from net.Addr. -package manet diff --git a/vendor/github.com/multiformats/go-multiaddr-net/go.mod b/vendor/github.com/multiformats/go-multiaddr-net/go.mod deleted file mode 100644 index 57c28274..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/multiformats/go-multiaddr-net - -require ( - github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-dns v0.0.1 -) diff --git a/vendor/github.com/multiformats/go-multiaddr-net/go.sum b/vendor/github.com/multiformats/go-multiaddr-net/go.sum deleted file mode 100644 index fc801cab..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/go.sum +++ /dev/null @@ -1,20 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/multiformats/go-multiaddr-net/ip.go b/vendor/github.com/multiformats/go-multiaddr-net/ip.go deleted file mode 100644 index 1cf9a775..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/ip.go +++ /dev/null @@ -1,118 +0,0 @@ -package manet - -import ( - "net" - - ma "github.com/multiformats/go-multiaddr" -) - -// Loopback Addresses -var ( - // IP4Loopback is the ip4 loopback multiaddr - IP4Loopback = ma.StringCast("/ip4/127.0.0.1") - - // IP6Loopback is the ip6 loopback multiaddr - IP6Loopback = ma.StringCast("/ip6/::1") - - // IP4MappedIP6Loopback is the IPv4 Mapped IPv6 loopback address. - IP4MappedIP6Loopback = ma.StringCast("/ip6/::ffff:127.0.0.1") -) - -// Unspecified Addresses (used for ) -var ( - IP4Unspecified = ma.StringCast("/ip4/0.0.0.0") - IP6Unspecified = ma.StringCast("/ip6/::") -) - -// IsThinWaist returns whether a Multiaddr starts with "Thin Waist" Protocols. -// This means: /{IP4, IP6}[/{TCP, UDP}] -func IsThinWaist(m ma.Multiaddr) bool { - m = zoneless(m) - if m == nil { - return false - } - p := m.Protocols() - - // nothing? not even a waist. - if len(p) == 0 { - return false - } - - if p[0].Code != ma.P_IP4 && p[0].Code != ma.P_IP6 { - return false - } - - // only IP? still counts. - if len(p) == 1 { - return true - } - - switch p[1].Code { - case ma.P_TCP, ma.P_UDP, ma.P_IP4, ma.P_IP6: - return true - default: - return false - } -} - -// IsIPLoopback returns whether a Multiaddr starts with a "Loopback" IP address -// This means either /ip4/127.*.*.*/*, /ip6/::1/*, or /ip6/::ffff:127.*.*.*.*/*, -// or /ip6zone//ip6//* -func IsIPLoopback(m ma.Multiaddr) bool { - m = zoneless(m) - c, _ := ma.SplitFirst(m) - if c == nil { - return false - } - switch c.Protocol().Code { - case ma.P_IP4, ma.P_IP6: - return net.IP(c.RawValue()).IsLoopback() - } - return false -} - -// IsIP6LinkLocal returns whether a Multiaddr starts with an IPv6 link-local -// multiaddress (with zero or one leading zone). These addresses are non -// routable. -func IsIP6LinkLocal(m ma.Multiaddr) bool { - m = zoneless(m) - c, _ := ma.SplitFirst(m) - if c == nil || c.Protocol().Code != ma.P_IP6 { - return false - } - ip := net.IP(c.RawValue()) - return ip.IsLinkLocalMulticast() || ip.IsLinkLocalUnicast() -} - -// IsIPUnspecified returns whether a Multiaddr starts with an Unspecified IP address -// This means either /ip4/0.0.0.0/* or /ip6/::/* -func IsIPUnspecified(m ma.Multiaddr) bool { - m = zoneless(m) - if m == nil { - return false - } - c, _ := ma.SplitFirst(m) - return net.IP(c.RawValue()).IsUnspecified() -} - -// If m matches [zone,ip6,...], return [ip6,...] -// else if m matches [], [zone], or [zone,...], return nil -// else return m -func zoneless(m ma.Multiaddr) ma.Multiaddr { - head, tail := ma.SplitFirst(m) - if head == nil { - return nil - } - if head.Protocol().Code == ma.P_IP6ZONE { - if tail == nil { - return nil - } - tailhead, _ := ma.SplitFirst(tail) - if tailhead.Protocol().Code != ma.P_IP6 { - return nil - } - return tail - } else { - return m - } -} diff --git a/vendor/github.com/multiformats/go-multiaddr-net/net.go b/vendor/github.com/multiformats/go-multiaddr-net/net.go deleted file mode 100644 index ac35530d..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/net.go +++ /dev/null @@ -1,427 +0,0 @@ -// Package manet provides Multiaddr -// (https://github.com/multiformats/go-multiaddr) specific versions of common -// functions in Go's standard `net` package. This means wrappers of standard -// net symbols like `net.Dial` and `net.Listen`, as well as conversion to -// and from `net.Addr`. -package manet - -import ( - "context" - "fmt" - "net" - - ma "github.com/multiformats/go-multiaddr" -) - -// Conn is the equivalent of a net.Conn object. It is the -// result of calling the Dial or Listen functions in this -// package, with associated local and remote Multiaddrs. -type Conn interface { - net.Conn - - // LocalMultiaddr returns the local Multiaddr associated - // with this connection - LocalMultiaddr() ma.Multiaddr - - // RemoteMultiaddr returns the remote Multiaddr associated - // with this connection - RemoteMultiaddr() ma.Multiaddr -} - -type halfOpen interface { - net.Conn - CloseRead() error - CloseWrite() error -} - -func wrap(nconn net.Conn, laddr, raddr ma.Multiaddr) Conn { - endpts := maEndpoints{ - laddr: laddr, - raddr: raddr, - } - // This sucks. However, it's the only way to reliably expose the - // underlying methods. This way, users that need access to, e.g., - // CloseRead and CloseWrite, can do so via type assertions. - switch nconn := nconn.(type) { - case *net.TCPConn: - return &struct { - *net.TCPConn - maEndpoints - }{nconn, endpts} - case *net.UDPConn: - return &struct { - *net.UDPConn - maEndpoints - }{nconn, endpts} - case *net.IPConn: - return &struct { - *net.IPConn - maEndpoints - }{nconn, endpts} - case *net.UnixConn: - return &struct { - *net.UnixConn - maEndpoints - }{nconn, endpts} - case halfOpen: - return &struct { - halfOpen - maEndpoints - }{nconn, endpts} - default: - return &struct { - net.Conn - maEndpoints - }{nconn, endpts} - } -} - -// WrapNetConn wraps a net.Conn object with a Multiaddr friendly Conn. -// -// This function does it's best to avoid "hiding" methods exposed by the wrapped -// type. Guarantees: -// -// * If the wrapped connection exposes the "half-open" closer methods -// (CloseWrite, CloseRead), these will be available on the wrapped connection -// via type assertions. -// * If the wrapped connection is a UnixConn, IPConn, TCPConn, or UDPConn, all -// methods on these wrapped connections will be available via type assertions. -func WrapNetConn(nconn net.Conn) (Conn, error) { - if nconn == nil { - return nil, fmt.Errorf("failed to convert nconn.LocalAddr: nil") - } - - laddr, err := FromNetAddr(nconn.LocalAddr()) - if err != nil { - return nil, fmt.Errorf("failed to convert nconn.LocalAddr: %s", err) - } - - raddr, err := FromNetAddr(nconn.RemoteAddr()) - if err != nil { - return nil, fmt.Errorf("failed to convert nconn.RemoteAddr: %s", err) - } - - return wrap(nconn, laddr, raddr), nil -} - -type maEndpoints struct { - laddr ma.Multiaddr - raddr ma.Multiaddr -} - -// LocalMultiaddr returns the local address associated with -// this connection -func (c *maEndpoints) LocalMultiaddr() ma.Multiaddr { - return c.laddr -} - -// RemoteMultiaddr returns the remote address associated with -// this connection -func (c *maEndpoints) RemoteMultiaddr() ma.Multiaddr { - return c.raddr -} - -// Dialer contains options for connecting to an address. It -// is effectively the same as net.Dialer, but its LocalAddr -// and RemoteAddr options are Multiaddrs, instead of net.Addrs. -type Dialer struct { - - // Dialer is just an embedded net.Dialer, with all its options. - net.Dialer - - // LocalAddr is the local address to use when dialing an - // address. The address must be of a compatible type for the - // network being dialed. - // If nil, a local address is automatically chosen. - LocalAddr ma.Multiaddr -} - -// Dial connects to a remote address, using the options of the -// Dialer. Dialer uses an underlying net.Dialer to Dial a -// net.Conn, then wraps that in a Conn object (with local and -// remote Multiaddrs). -func (d *Dialer) Dial(remote ma.Multiaddr) (Conn, error) { - return d.DialContext(context.Background(), remote) -} - -// DialContext allows to provide a custom context to Dial(). -func (d *Dialer) DialContext(ctx context.Context, remote ma.Multiaddr) (Conn, error) { - // if a LocalAddr is specified, use it on the embedded dialer. - if d.LocalAddr != nil { - // convert our multiaddr to net.Addr friendly - naddr, err := ToNetAddr(d.LocalAddr) - if err != nil { - return nil, err - } - - // set the dialer's LocalAddr as naddr - d.Dialer.LocalAddr = naddr - } - - // get the net.Dial friendly arguments from the remote addr - rnet, rnaddr, err := DialArgs(remote) - if err != nil { - return nil, err - } - - // ok, Dial! - var nconn net.Conn - switch rnet { - case "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6", "unix": - nconn, err = d.Dialer.DialContext(ctx, rnet, rnaddr) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("unrecognized network: %s", rnet) - } - - // get local address (pre-specified or assigned within net.Conn) - local := d.LocalAddr - // This block helps us avoid parsing addresses in transports (such as unix - // sockets) that don't have local addresses when dialing out. - if local == nil && nconn.LocalAddr().String() != "" { - local, err = FromNetAddr(nconn.LocalAddr()) - if err != nil { - return nil, err - } - } - return wrap(nconn, local, remote), nil -} - -// Dial connects to a remote address. It uses an underlying net.Conn, -// then wraps it in a Conn object (with local and remote Multiaddrs). -func Dial(remote ma.Multiaddr) (Conn, error) { - return (&Dialer{}).Dial(remote) -} - -// A Listener is a generic network listener for stream-oriented protocols. -// it uses an embedded net.Listener, overriding net.Listener.Accept to -// return a Conn and providing Multiaddr. -type Listener interface { - // Accept waits for and returns the next connection to the listener. - // Returns a Multiaddr friendly Conn - Accept() (Conn, error) - - // Close closes the listener. - // Any blocked Accept operations will be unblocked and return errors. - Close() error - - // Multiaddr returns the listener's (local) Multiaddr. - Multiaddr() ma.Multiaddr - - // Addr returns the net.Listener's network address. - Addr() net.Addr -} - -type netListenerAdapter struct { - Listener -} - -func (nla *netListenerAdapter) Accept() (net.Conn, error) { - return nla.Listener.Accept() -} - -// NetListener turns this Listener into a net.Listener. -// -// * Connections returned from Accept implement multiaddr-net Conn. -// * Calling WrapNetListener on the net.Listener returned by this function will -// return the original (underlying) multiaddr-net Listener. -func NetListener(l Listener) net.Listener { - return &netListenerAdapter{l} -} - -// maListener implements Listener -type maListener struct { - net.Listener - laddr ma.Multiaddr -} - -// Accept waits for and returns the next connection to the listener. -// Returns a Multiaddr friendly Conn -func (l *maListener) Accept() (Conn, error) { - nconn, err := l.Listener.Accept() - if err != nil { - return nil, err - } - - var raddr ma.Multiaddr - // This block protects us in transports (i.e. unix sockets) that don't have - // remote addresses for inbound connections. - if nconn.RemoteAddr().String() != "" { - raddr, err = FromNetAddr(nconn.RemoteAddr()) - if err != nil { - return nil, fmt.Errorf("failed to convert conn.RemoteAddr: %s", err) - } - } - - return wrap(nconn, l.laddr, raddr), nil -} - -// Multiaddr returns the listener's (local) Multiaddr. -func (l *maListener) Multiaddr() ma.Multiaddr { - return l.laddr -} - -// Addr returns the listener's network address. -func (l *maListener) Addr() net.Addr { - return l.Listener.Addr() -} - -// Listen announces on the local network address laddr. -// The Multiaddr must be a "ThinWaist" stream-oriented network: -// ip4/tcp, ip6/tcp, (TODO: unix, unixpacket) -// See Dial for the syntax of laddr. -func Listen(laddr ma.Multiaddr) (Listener, error) { - - // get the net.Listen friendly arguments from the remote addr - lnet, lnaddr, err := DialArgs(laddr) - if err != nil { - return nil, err - } - - nl, err := net.Listen(lnet, lnaddr) - if err != nil { - return nil, err - } - - // we want to fetch the new multiaddr from the listener, as it may - // have resolved to some other value. WrapNetListener does it for us. - return WrapNetListener(nl) -} - -// WrapNetListener wraps a net.Listener with a manet.Listener. -func WrapNetListener(nl net.Listener) (Listener, error) { - if nla, ok := nl.(*netListenerAdapter); ok { - return nla.Listener, nil - } - - laddr, err := FromNetAddr(nl.Addr()) - if err != nil { - return nil, err - } - - return &maListener{ - Listener: nl, - laddr: laddr, - }, nil -} - -// A PacketConn is a generic packet oriented network connection which uses an -// underlying net.PacketConn, wrapped with the locally bound Multiaddr. -type PacketConn interface { - Connection() net.PacketConn - - Multiaddr() ma.Multiaddr - - ReadFrom(b []byte) (int, ma.Multiaddr, error) - WriteTo(b []byte, maddr ma.Multiaddr) (int, error) - - Close() error -} - -// maPacketConn implements PacketConn -type maPacketConn struct { - net.PacketConn - laddr ma.Multiaddr -} - -// Connection returns the embedded net.PacketConn. -func (l *maPacketConn) Connection() net.PacketConn { - return l.PacketConn -} - -// Multiaddr returns the bound local Multiaddr. -func (l *maPacketConn) Multiaddr() ma.Multiaddr { - return l.laddr -} - -func (l *maPacketConn) ReadFrom(b []byte) (int, ma.Multiaddr, error) { - n, addr, err := l.PacketConn.ReadFrom(b) - maddr, _ := FromNetAddr(addr) - return n, maddr, err -} - -func (l *maPacketConn) WriteTo(b []byte, maddr ma.Multiaddr) (int, error) { - addr, err := ToNetAddr(maddr) - if err != nil { - return 0, err - } - return l.PacketConn.WriteTo(b, addr) -} - -// ListenPacket announces on the local network address laddr. -// The Multiaddr must be a packet driven network, like udp4 or udp6. -// See Dial for the syntax of laddr. -func ListenPacket(laddr ma.Multiaddr) (PacketConn, error) { - lnet, lnaddr, err := DialArgs(laddr) - if err != nil { - return nil, err - } - - pc, err := net.ListenPacket(lnet, lnaddr) - if err != nil { - return nil, err - } - - // We want to fetch the new multiaddr from the listener, as it may - // have resolved to some other value. WrapPacketConn does this. - return WrapPacketConn(pc) -} - -// WrapPacketConn wraps a net.PacketConn with a manet.PacketConn. -func WrapPacketConn(pc net.PacketConn) (PacketConn, error) { - laddr, err := FromNetAddr(pc.LocalAddr()) - if err != nil { - return nil, err - } - - return &maPacketConn{ - PacketConn: pc, - laddr: laddr, - }, nil -} - -// InterfaceMultiaddrs will return the addresses matching net.InterfaceAddrs -func InterfaceMultiaddrs() ([]ma.Multiaddr, error) { - addrs, err := net.InterfaceAddrs() - if err != nil { - return nil, err - } - - maddrs := make([]ma.Multiaddr, len(addrs)) - for i, a := range addrs { - maddrs[i], err = FromNetAddr(a) - if err != nil { - return nil, err - } - } - return maddrs, nil -} - -// AddrMatch returns the Multiaddrs that match the protocol stack on addr -func AddrMatch(match ma.Multiaddr, addrs []ma.Multiaddr) []ma.Multiaddr { - - // we should match transports entirely. - p1s := match.Protocols() - - out := make([]ma.Multiaddr, 0, len(addrs)) - for _, a := range addrs { - p2s := a.Protocols() - if len(p1s) != len(p2s) { - continue - } - - match := true - for i, p2 := range p2s { - if p1s[i].Code != p2.Code { - match = false - break - } - } - if match { - out = append(out, a) - } - } - return out -} diff --git a/vendor/github.com/multiformats/go-multiaddr-net/package.json b/vendor/github.com/multiformats/go-multiaddr-net/package.json deleted file mode 100644 index cdad09ea..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "multiformats", - "bugs": { - "url": "https://github.com/multiformats/go-multiaddr-net" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multiaddr-net" - }, - "gxDependencies": [ - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - }, - { - "author": "lgierth", - "hash": "QmU98UaAEh4WJAcir2qjfztU77JQ14kAwHNFkjUXHZA3Vy", - "name": "go-multiaddr-dns", - "version": "0.3.1" - } - ], - "gxVersion": "0.6.0", - "language": "go", - "license": "", - "name": "go-multiaddr-net", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.7.2" -} - diff --git a/vendor/github.com/multiformats/go-multiaddr-net/private.go b/vendor/github.com/multiformats/go-multiaddr-net/private.go deleted file mode 100644 index 26e547ce..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/private.go +++ /dev/null @@ -1,116 +0,0 @@ -package manet - -import ( - "net" - - ma "github.com/multiformats/go-multiaddr" -) - -// Private4 and Private6 are well-known private networks -var Private4, Private6 []*net.IPNet -var privateCIDR4 = []string{ - // localhost - "127.0.0.0/8", - // private networks - "10.0.0.0/8", - "100.64.0.0/10", - "172.16.0.0/12", - "192.168.0.0/16", - // link local - "169.254.0.0/16", -} -var privateCIDR6 = []string{ - // localhost - "::1/128", - // ULA reserved - "fc00::/7", - // link local - "fe80::/10", -} - -// Unroutable4 and Unroutable6 are well known unroutable address ranges -var Unroutable4, Unroutable6 []*net.IPNet -var unroutableCIDR4 = []string{ - "0.0.0.0/8", - "192.0.0.0/26", - "192.0.2.0/24", - "192.88.99.0/24", - "198.18.0.0/15", - "198.51.100.0/24", - "203.0.113.0/24", - "224.0.0.0/4", - "240.0.0.0/4", - "255.255.255.255/32", -} -var unroutableCIDR6 = []string{ - "ff00::/8", -} - -func init() { - Private4 = parseCIDR(privateCIDR4) - Private6 = parseCIDR(privateCIDR6) - Unroutable4 = parseCIDR(unroutableCIDR4) - Unroutable6 = parseCIDR(unroutableCIDR6) -} - -func parseCIDR(cidrs []string) []*net.IPNet { - ipnets := make([]*net.IPNet, len(cidrs)) - for i, cidr := range cidrs { - _, ipnet, err := net.ParseCIDR(cidr) - if err != nil { - panic(err) - } - ipnets[i] = ipnet - } - return ipnets -} - -// IsPublicAddr retruns true if the IP part of the multiaddr is a publicly routable address -func IsPublicAddr(a ma.Multiaddr) bool { - isPublic := false - ma.ForEach(a, func(c ma.Component) bool { - switch c.Protocol().Code { - case ma.P_IP6ZONE: - return true - default: - return false - case ma.P_IP4: - ip := net.IP(c.RawValue()) - isPublic = !inAddrRange(ip, Private4) && !inAddrRange(ip, Unroutable4) - case ma.P_IP6: - ip := net.IP(c.RawValue()) - isPublic = !inAddrRange(ip, Private6) && !inAddrRange(ip, Unroutable6) - } - return false - }) - return isPublic -} - -// IsPrivateAddr returns true if the IP part of the mutiaddr is in a private network -func IsPrivateAddr(a ma.Multiaddr) bool { - isPrivate := false - ma.ForEach(a, func(c ma.Component) bool { - switch c.Protocol().Code { - case ma.P_IP6ZONE: - return true - default: - return false - case ma.P_IP4: - isPrivate = inAddrRange(net.IP(c.RawValue()), Private4) - case ma.P_IP6: - isPrivate = inAddrRange(net.IP(c.RawValue()), Private6) - } - return false - }) - return isPrivate -} - -func inAddrRange(ip net.IP, ipnets []*net.IPNet) bool { - for _, ipnet := range ipnets { - if ipnet.Contains(ip) { - return true - } - } - - return false -} diff --git a/vendor/github.com/multiformats/go-multiaddr-net/registry.go b/vendor/github.com/multiformats/go-multiaddr-net/registry.go deleted file mode 100644 index fc6561cb..00000000 --- a/vendor/github.com/multiformats/go-multiaddr-net/registry.go +++ /dev/null @@ -1,133 +0,0 @@ -package manet - -import ( - "fmt" - "net" - "sync" - - ma "github.com/multiformats/go-multiaddr" -) - -// FromNetAddrFunc is a generic function which converts a net.Addr to Multiaddress -type FromNetAddrFunc func(a net.Addr) (ma.Multiaddr, error) - -// ToNetAddrFunc is a generic function which converts a Multiaddress to net.Addr -type ToNetAddrFunc func(ma ma.Multiaddr) (net.Addr, error) - -var defaultCodecs = NewCodecMap() - -func init() { - defaultCodecs.RegisterFromNetAddr(parseTCPNetAddr, "tcp", "tcp4", "tcp6") - defaultCodecs.RegisterFromNetAddr(parseUDPNetAddr, "udp", "udp4", "udp6") - defaultCodecs.RegisterFromNetAddr(parseIPNetAddr, "ip", "ip4", "ip6") - defaultCodecs.RegisterFromNetAddr(parseIPPlusNetAddr, "ip+net") - defaultCodecs.RegisterFromNetAddr(parseUnixNetAddr, "unix") - - defaultCodecs.RegisterToNetAddr(parseBasicNetMaddr, "tcp", "udp", "ip6", "ip4", "unix") -} - -// CodecMap holds a map of NetCodecs indexed by their Protocol ID -// along with parsers for the addresses they use. -// It is used to keep a list of supported network address codecs (protocols -// which addresses can be converted to and from multiaddresses). -type CodecMap struct { - codecs map[string]*NetCodec - addrParsers map[string]FromNetAddrFunc - maddrParsers map[string]ToNetAddrFunc - lk sync.Mutex -} - -// NewCodecMap initializes and returns a CodecMap object. -func NewCodecMap() *CodecMap { - return &CodecMap{ - addrParsers: make(map[string]FromNetAddrFunc), - maddrParsers: make(map[string]ToNetAddrFunc), - } -} - -// NetCodec is used to identify a network codec, that is, a network type for -// which we are able to translate multiaddresses into standard Go net.Addr -// and back. -// -// Deprecated: Unfortunately, these mappings aren't one to one. This abstraction -// assumes that multiple "networks" can map to a single multiaddr protocol but -// not the reverse. For example, this abstraction supports `tcp6, tcp4, tcp -> -// /tcp/` really well but doesn't support `ip -> {/ip4/, /ip6/}`. -// -// Please use `RegisterFromNetAddr` and `RegisterToNetAddr` directly. -type NetCodec struct { - // NetAddrNetworks is an array of strings that may be returned - // by net.Addr.Network() calls on addresses belonging to this type - NetAddrNetworks []string - - // ProtocolName is the string value for Multiaddr address keys - ProtocolName string - - // ParseNetAddr parses a net.Addr belonging to this type into a multiaddr - ParseNetAddr FromNetAddrFunc - - // ConvertMultiaddr converts a multiaddr of this type back into a net.Addr - ConvertMultiaddr ToNetAddrFunc - - // Protocol returns the multiaddr protocol struct for this type - Protocol ma.Protocol -} - -// RegisterNetCodec adds a new NetCodec to the default codecs. -func RegisterNetCodec(a *NetCodec) { - defaultCodecs.RegisterNetCodec(a) -} - -// RegisterNetCodec adds a new NetCodec to the CodecMap. This function is -// thread safe. -func (cm *CodecMap) RegisterNetCodec(a *NetCodec) { - cm.lk.Lock() - defer cm.lk.Unlock() - for _, n := range a.NetAddrNetworks { - cm.addrParsers[n] = a.ParseNetAddr - } - - cm.maddrParsers[a.ProtocolName] = a.ConvertMultiaddr -} - -// RegisterFromNetAddr registers a conversion from net.Addr instances to multiaddrs -func (cm *CodecMap) RegisterFromNetAddr(from FromNetAddrFunc, networks ...string) { - cm.lk.Lock() - defer cm.lk.Unlock() - - for _, n := range networks { - cm.addrParsers[n] = from - } -} - -// RegisterToNetAddr registers a conversion from multiaddrs to net.Addr instances -func (cm *CodecMap) RegisterToNetAddr(to ToNetAddrFunc, protocols ...string) { - cm.lk.Lock() - defer cm.lk.Unlock() - - for _, p := range protocols { - cm.maddrParsers[p] = to - } -} - -func (cm *CodecMap) getAddrParser(net string) (FromNetAddrFunc, error) { - cm.lk.Lock() - defer cm.lk.Unlock() - - parser, ok := cm.addrParsers[net] - if !ok { - return nil, fmt.Errorf("unknown network %v", net) - } - return parser, nil -} - -func (cm *CodecMap) getMaddrParser(name string) (ToNetAddrFunc, error) { - cm.lk.Lock() - defer cm.lk.Unlock() - p, ok := cm.maddrParsers[name] - if !ok { - return nil, fmt.Errorf("network not supported: %s", name) - } - - return p, nil -} diff --git a/vendor/github.com/multiformats/go-multiaddr/.gitignore b/vendor/github.com/multiformats/go-multiaddr/.gitignore deleted file mode 100644 index 699d271b..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.vscode/ -multiaddr/multiaddr -tmp/ diff --git a/vendor/github.com/multiformats/go-multiaddr/.travis.yml b/vendor/github.com/multiformats/go-multiaddr/.travis.yml deleted file mode 100644 index 95e4daaa..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - - GO111MODULE=on - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - make conformance - -cache: - directories: - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multiaddr/LICENSE b/vendor/github.com/multiformats/go-multiaddr/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multiaddr/Makefile b/vendor/github.com/multiformats/go-multiaddr/Makefile deleted file mode 100644 index 4de9c30e..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -covertools: - go get golang.org/x/tools/cmd/cover - -deps: gx covertools - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - -conformance: tmp/multiaddr - go build -o tmp/multiaddr/test/go-multiaddr ./multiaddr - cd tmp/multiaddr/test && MULTIADDR_BIN="./go-multiaddr" go test -v - -tmp/multiaddr: - mkdir -p tmp/ - git clone https://github.com/multiformats/multiaddr tmp/multiaddr/ - -clean: - rm -rf tmp/ - -.PHONY: gx covertools deps publish conformance clean diff --git a/vendor/github.com/multiformats/go-multiaddr/README.md b/vendor/github.com/multiformats/go-multiaddr/README.md deleted file mode 100644 index df2766aa..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# go-multiaddr - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/multiformats/go-multiaddr?status.svg)](https://godoc.org/github.com/multiformats/go-multiaddr) -[![Travis CI](https://img.shields.io/travis/multiformats/go-multiaddr.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multiaddr) -[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multiaddr.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/go-multiaddr?branch=master) - -> [multiaddr](https://github.com/multiformats/multiaddr) implementation in go - -Multiaddr is a standard way to represent addresses that: - -- Support any standard network protocols. -- Self-describe (include protocols). -- Have a binary packed format. -- Have a nice string representation. -- Encapsulate well. - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) - - [Example](#example) - - [Simple](#simple) - - [Protocols](#protocols) - - [En/decapsulate](#endecapsulate) - - [Tunneling](#tunneling) -- [Maintainers](#maintainers) -- [Contribute](#contribute) -- [License](#license) - -## Install - -```sh -go get github.com/multiformats/go-multiaddr -``` - -## Usage - -### Example - -#### Simple - -```go -import ma "github.com/multiformats/go-multiaddr" - -// construct from a string (err signals parse failure) -m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234") - -// construct from bytes (err signals parse failure) -m2, err := ma.NewMultiaddrBytes(m1.Bytes()) - -// true -strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234") -strings.Equal(m1.String(), m2.String()) -bytes.Equal(m1.Bytes(), m2.Bytes()) -m1.Equal(m2) -m2.Equal(m1) -``` - -#### Protocols - -```go -// get the multiaddr protocol description objects -m1.Protocols() -// []Protocol{ -// Protocol{ Code: 4, Name: 'ip4', Size: 32}, -// Protocol{ Code: 17, Name: 'udp', Size: 16}, -// } -``` - -#### En/decapsulate - -```go -import ma "github.com/multiformats/go-multiaddr" - -m, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234") -// - -sctpMA, err := ma.NewMultiaddr("/sctp/5678") - -m.Encapsulate(sctpMA) -// - -udpMA, err := ma.NewMultiaddr("/udp/1234") - -m.Decapsulate(udpMA) // up to + inc last occurrence of subaddr -// -``` - -#### Tunneling - -Multiaddr allows expressing tunnels very nicely. - -```js -printer, _ := ma.NewMultiaddr("/ip4/192.168.0.13/tcp/80") -proxy, _ := ma.NewMultiaddr("/ip4/10.20.30.40/tcp/443") -printerOverProxy := proxy.Encapsulate(printer) -// /ip4/10.20.30.40/tcp/443/ip4/192.168.0.13/tcp/80 - -proxyAgain := printerOverProxy.Decapsulate(printer) -// /ip4/10.20.30.40/tcp/443 -``` - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multiaddr/issues). - -Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2014 Juan Batiz-Benet diff --git a/vendor/github.com/multiformats/go-multiaddr/codec.go b/vendor/github.com/multiformats/go-multiaddr/codec.go deleted file mode 100644 index 35b50c14..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/codec.go +++ /dev/null @@ -1,202 +0,0 @@ -package multiaddr - -import ( - "bytes" - "fmt" - "strings" -) - -func stringToBytes(s string) ([]byte, error) { - // consume trailing slashes - s = strings.TrimRight(s, "/") - - var b bytes.Buffer - sp := strings.Split(s, "/") - - if sp[0] != "" { - return nil, fmt.Errorf("failed to parse multiaddr %q: must begin with /", s) - } - - // consume first empty elem - sp = sp[1:] - - if len(sp) == 0 { - return nil, fmt.Errorf("failed to parse multiaddr %q: empty multiaddr", s) - } - - for len(sp) > 0 { - name := sp[0] - p := ProtocolWithName(name) - if p.Code == 0 { - return nil, fmt.Errorf("failed to parse multiaddr %q: unknown protocol %s", s, sp[0]) - } - _, _ = b.Write(CodeToVarint(p.Code)) - sp = sp[1:] - - if p.Size == 0 { // no length. - continue - } - - if len(sp) < 1 { - return nil, fmt.Errorf("failed to parse multiaddr %q: unexpected end of multiaddr", s) - } - - if p.Path { - // it's a path protocol (terminal). - // consume the rest of the address as the next component. - sp = []string{"/" + strings.Join(sp, "/")} - } - - a, err := p.Transcoder.StringToBytes(sp[0]) - if err != nil { - return nil, fmt.Errorf("failed to parse multiaddr %q: invalid value %q for protocol %s: %s", s, sp[0], p.Name, err) - } - if p.Size < 0 { // varint size. - _, _ = b.Write(CodeToVarint(len(a))) - } - b.Write(a) - sp = sp[1:] - } - - return b.Bytes(), nil -} - -func validateBytes(b []byte) (err error) { - if len(b) == 0 { - return fmt.Errorf("empty multiaddr") - } - for len(b) > 0 { - code, n, err := ReadVarintCode(b) - if err != nil { - return err - } - - b = b[n:] - p := ProtocolWithCode(code) - if p.Code == 0 { - return fmt.Errorf("no protocol with code %d", code) - } - - if p.Size == 0 { - continue - } - - n, size, err := sizeForAddr(p, b) - if err != nil { - return err - } - - b = b[n:] - - if len(b) < size || size < 0 { - return fmt.Errorf("invalid value for size %d", len(b)) - } - - err = p.Transcoder.ValidateBytes(b[:size]) - if err != nil { - return err - } - - b = b[size:] - } - - return nil -} - -func readComponent(b []byte) (int, Component, error) { - var offset int - code, n, err := ReadVarintCode(b) - if err != nil { - return 0, Component{}, err - } - offset += n - - p := ProtocolWithCode(code) - if p.Code == 0 { - return 0, Component{}, fmt.Errorf("no protocol with code %d", code) - } - - if p.Size == 0 { - return offset, Component{ - bytes: b[:offset], - offset: offset, - protocol: p, - }, nil - } - - n, size, err := sizeForAddr(p, b[offset:]) - if err != nil { - return 0, Component{}, err - } - - offset += n - - if len(b[offset:]) < size || size < 0 { - return 0, Component{}, fmt.Errorf("invalid value for size %d", len(b[offset:])) - } - - return offset + size, Component{ - bytes: b[:offset+size], - protocol: p, - offset: offset, - }, nil -} - -func bytesToString(b []byte) (ret string, err error) { - if len(b) == 0 { - return "", fmt.Errorf("empty multiaddr") - } - var buf strings.Builder - - for len(b) > 0 { - n, c, err := readComponent(b) - if err != nil { - return "", err - } - b = b[n:] - c.writeTo(&buf) - } - - return buf.String(), nil -} - -func sizeForAddr(p Protocol, b []byte) (skip, size int, err error) { - switch { - case p.Size > 0: - return 0, (p.Size / 8), nil - case p.Size == 0: - return 0, 0, nil - default: - size, n, err := ReadVarintCode(b) - if err != nil { - return 0, 0, err - } - return n, size, nil - } -} - -func bytesSplit(b []byte) ([][]byte, error) { - var ret [][]byte - for len(b) > 0 { - code, n, err := ReadVarintCode(b) - if err != nil { - return nil, err - } - - p := ProtocolWithCode(code) - if p.Code == 0 { - return nil, fmt.Errorf("no protocol with code %d", b[0]) - } - - n2, size, err := sizeForAddr(p, b[n:]) - if err != nil { - return nil, err - } - - length := n + n2 + size - ret = append(ret, b[:length]) - b = b[length:] - } - - return ret, nil -} diff --git a/vendor/github.com/multiformats/go-multiaddr/codecov.yml b/vendor/github.com/multiformats/go-multiaddr/codecov.yml deleted file mode 100644 index ca8100ab..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -ignore: - - "multiaddr" diff --git a/vendor/github.com/multiformats/go-multiaddr/component.go b/vendor/github.com/multiformats/go-multiaddr/component.go deleted file mode 100644 index 69baf7a1..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/component.go +++ /dev/null @@ -1,181 +0,0 @@ -package multiaddr - -import ( - "bytes" - "encoding/binary" - "encoding/json" - "fmt" - "strings" -) - -// Component is a single multiaddr Component. -type Component struct { - bytes []byte - protocol Protocol - offset int -} - -func (c *Component) Bytes() []byte { - return c.bytes -} - -func (c *Component) MarshalBinary() ([]byte, error) { - return c.Bytes(), nil -} - -func (c *Component) UnmarshalBinary(data []byte) error { - _, comp, err := readComponent(data) - if err != nil { - return err - } - *c = comp - return nil -} - -func (c *Component) MarshalText() ([]byte, error) { - return []byte(c.String()), nil -} - -func (c *Component) UnmarshalText(data []byte) error { - bytes, err := stringToBytes(string(data)) - if err != nil { - return err - } - _, comp, err := readComponent(bytes) - if err != nil { - return err - } - *c = comp - return nil -} - -func (c *Component) MarshalJSON() ([]byte, error) { - txt, err := c.MarshalText() - if err != nil { - return nil, err - } - - return json.Marshal(string(txt)) -} - -func (m *Component) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - - return m.UnmarshalText([]byte(v)) -} - -func (c *Component) Equal(o Multiaddr) bool { - return bytes.Equal(c.bytes, o.Bytes()) -} - -func (c *Component) Protocols() []Protocol { - return []Protocol{c.protocol} -} - -func (c *Component) Decapsulate(o Multiaddr) Multiaddr { - if c.Equal(o) { - return nil - } - return c -} - -func (c *Component) Encapsulate(o Multiaddr) Multiaddr { - m := &multiaddr{bytes: c.bytes} - return m.Encapsulate(o) -} - -func (c *Component) ValueForProtocol(code int) (string, error) { - if c.protocol.Code != code { - return "", ErrProtocolNotFound - } - return c.Value(), nil -} - -func (c *Component) Protocol() Protocol { - return c.protocol -} - -func (c *Component) RawValue() []byte { - return c.bytes[c.offset:] -} - -func (c *Component) Value() string { - if c.protocol.Transcoder == nil { - return "" - } - value, err := c.protocol.Transcoder.BytesToString(c.bytes[c.offset:]) - if err != nil { - // This Component must have been checked. - panic(err) - } - return value -} - -func (c *Component) String() string { - var b strings.Builder - c.writeTo(&b) - return b.String() -} - -// writeTo is an efficient, private function for string-formatting a multiaddr. -// Trust me, we tend to allocate a lot when doing this. -func (c *Component) writeTo(b *strings.Builder) { - b.WriteByte('/') - b.WriteString(c.protocol.Name) - value := c.Value() - if len(value) == 0 { - return - } - if !(c.protocol.Path && value[0] == '/') { - b.WriteByte('/') - } - b.WriteString(value) -} - -// NewComponent constructs a new multiaddr component -func NewComponent(protocol, value string) (*Component, error) { - p := ProtocolWithName(protocol) - if p.Code == 0 { - return nil, fmt.Errorf("unsupported protocol: %s", protocol) - } - if p.Transcoder != nil { - bts, err := p.Transcoder.StringToBytes(value) - if err != nil { - return nil, err - } - return newComponent(p, bts), nil - } else if value != "" { - return nil, fmt.Errorf("protocol %s doesn't take a value", p.Name) - } - return newComponent(p, nil), nil - // TODO: handle path /? -} - -func newComponent(protocol Protocol, bvalue []byte) *Component { - size := len(bvalue) - size += len(protocol.VCode) - if protocol.Size < 0 { - size += VarintSize(len(bvalue)) - } - maddr := make([]byte, size) - var offset int - offset += copy(maddr[offset:], protocol.VCode) - if protocol.Size < 0 { - offset += binary.PutUvarint(maddr[offset:], uint64(len(bvalue))) - } - copy(maddr[offset:], bvalue) - - // For debugging - if len(maddr) != offset+len(bvalue) { - panic("incorrect length") - } - - return &Component{ - bytes: maddr, - protocol: protocol, - offset: offset, - } -} diff --git a/vendor/github.com/multiformats/go-multiaddr/doc.go b/vendor/github.com/multiformats/go-multiaddr/doc.go deleted file mode 100644 index d8c37b26..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/doc.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Package multiaddr provides an implementation of the Multiaddr network -address format. Multiaddr emphasizes explicitness, self-description, and -portability. It allows applications to treat addresses as opaque tokens, -and to avoid making assumptions about the address representation (e.g. length). -Learn more at https://github.com/multiformats/multiaddr - -Basic Use: - - import ( - "bytes" - "strings" - ma "github.com/multiformats/go-multiaddr" - ) - - // construct from a string (err signals parse failure) - m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234") - - // construct from bytes (err signals parse failure) - m2, err := ma.NewMultiaddrBytes(m1.Bytes()) - - // true - strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234") - strings.Equal(m1.String(), m2.String()) - bytes.Equal(m1.Bytes(), m2.Bytes()) - m1.Equal(m2) - m2.Equal(m1) - - // tunneling (en/decap) - printer, _ := ma.NewMultiaddr("/ip4/192.168.0.13/tcp/80") - proxy, _ := ma.NewMultiaddr("/ip4/10.20.30.40/tcp/443") - printerOverProxy := proxy.Encapsulate(printer) - proxyAgain := printerOverProxy.Decapsulate(printer) - -*/ -package multiaddr diff --git a/vendor/github.com/multiformats/go-multiaddr/go.mod b/vendor/github.com/multiformats/go-multiaddr/go.mod deleted file mode 100644 index debcf3c5..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/multiformats/go-multiaddr - -require github.com/multiformats/go-multihash v0.0.1 diff --git a/vendor/github.com/multiformats/go-multiaddr/go.sum b/vendor/github.com/multiformats/go-multiaddr/go.sum deleted file mode 100644 index faa395ab..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v1.0.10 h1:KUnC6rT8Vyw0gx4qXUS6VN1QHKrgmvdDCaURVQ7+miM= -github.com/multiformats/go-multihash v1.0.10/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d h1:Z0Ahzd7HltpJtjAHHxX8QFP3j1yYgiuvjbjRzDj/KH0= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/multiformats/go-multiaddr/interface.go b/vendor/github.com/multiformats/go-multiaddr/interface.go deleted file mode 100644 index 82cc7640..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/interface.go +++ /dev/null @@ -1,62 +0,0 @@ -package multiaddr - -import ( - "encoding" - "encoding/json" -) - -/* -Multiaddr is a cross-protocol, cross-platform format for representing -internet addresses. It emphasizes explicitness and self-description. -Learn more here: https://github.com/multiformats/multiaddr - -Multiaddrs have both a binary and string representation. - - import ma "github.com/multiformats/go-multiaddr" - - addr, err := ma.NewMultiaddr("/ip4/1.2.3.4/tcp/80") - // err non-nil when parsing failed. - -*/ -type Multiaddr interface { - json.Marshaler - json.Unmarshaler - encoding.TextMarshaler - encoding.TextUnmarshaler - encoding.BinaryMarshaler - encoding.BinaryUnmarshaler - - // Equal returns whether two Multiaddrs are exactly equal - Equal(Multiaddr) bool - - // Bytes returns the []byte representation of this Multiaddr - // - // This function may expose immutable, internal state. Do not modify. - Bytes() []byte - - // String returns the string representation of this Multiaddr - // (may panic if internal state is corrupted) - String() string - - // Protocols returns the list of Protocols this Multiaddr includes - // will panic if protocol code incorrect (and bytes accessed incorrectly) - Protocols() []Protocol - - // Encapsulate wraps this Multiaddr around another. For example: - // - // /ip4/1.2.3.4 encapsulate /tcp/80 = /ip4/1.2.3.4/tcp/80 - // - Encapsulate(Multiaddr) Multiaddr - - // Decapsultate removes a Multiaddr wrapping. For example: - // - // /ip4/1.2.3.4/tcp/80 decapsulate /ip4/1.2.3.4 = /tcp/80 - // - Decapsulate(Multiaddr) Multiaddr - - // ValueForProtocol returns the value (if any) following the specified protocol - // - // Note: protocols can appear multiple times in a single multiaddr. - // Consider using `ForEach` to walk over the addr manually. - ValueForProtocol(code int) (string, error) -} diff --git a/vendor/github.com/multiformats/go-multiaddr/multiaddr.go b/vendor/github.com/multiformats/go-multiaddr/multiaddr.go deleted file mode 100644 index 58fe8cec..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/multiaddr.go +++ /dev/null @@ -1,186 +0,0 @@ -package multiaddr - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "strings" -) - -// multiaddr is the data structure representing a Multiaddr -type multiaddr struct { - bytes []byte -} - -// NewMultiaddr parses and validates an input string, returning a *Multiaddr -func NewMultiaddr(s string) (a Multiaddr, err error) { - defer func() { - if e := recover(); e != nil { - log.Printf("Panic in NewMultiaddr on input %q: %s", s, e) - err = fmt.Errorf("%v", e) - } - }() - b, err := stringToBytes(s) - if err != nil { - return nil, err - } - return &multiaddr{bytes: b}, nil -} - -// NewMultiaddrBytes initializes a Multiaddr from a byte representation. -// It validates it as an input string. -func NewMultiaddrBytes(b []byte) (a Multiaddr, err error) { - defer func() { - if e := recover(); e != nil { - log.Printf("Panic in NewMultiaddrBytes on input %q: %s", b, e) - err = fmt.Errorf("%v", e) - } - }() - - if err := validateBytes(b); err != nil { - return nil, err - } - - return &multiaddr{bytes: b}, nil -} - -// Equal tests whether two multiaddrs are equal -func (m *multiaddr) Equal(m2 Multiaddr) bool { - return bytes.Equal(m.bytes, m2.Bytes()) -} - -// Bytes returns the []byte representation of this Multiaddr -// -// Do not modify the returned buffer, it may be shared. -func (m *multiaddr) Bytes() []byte { - return m.bytes -} - -// String returns the string representation of a Multiaddr -func (m *multiaddr) String() string { - s, err := bytesToString(m.bytes) - if err != nil { - panic(fmt.Errorf("multiaddr failed to convert back to string. corrupted? %s", err)) - } - return s -} - -func (m *multiaddr) MarshalBinary() ([]byte, error) { - return m.Bytes(), nil -} - -func (m *multiaddr) UnmarshalBinary(data []byte) error { - new, err := NewMultiaddrBytes(data) - if err != nil { - return err - } - *m = *(new.(*multiaddr)) - return nil -} - -func (m *multiaddr) MarshalText() ([]byte, error) { - return []byte(m.String()), nil -} - -func (m *multiaddr) UnmarshalText(data []byte) error { - new, err := NewMultiaddr(string(data)) - if err != nil { - return err - } - *m = *(new.(*multiaddr)) - return nil -} - -func (m *multiaddr) MarshalJSON() ([]byte, error) { - return json.Marshal(m.String()) -} - -func (m *multiaddr) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - new, err := NewMultiaddr(v) - *m = *(new.(*multiaddr)) - return err -} - -// Protocols returns the list of protocols this Multiaddr has. -// will panic in case we access bytes incorrectly. -func (m *multiaddr) Protocols() []Protocol { - ps := make([]Protocol, 0, 8) - b := m.bytes - for len(b) > 0 { - code, n, err := ReadVarintCode(b) - if err != nil { - panic(err) - } - - p := ProtocolWithCode(code) - if p.Code == 0 { - // this is a panic (and not returning err) because this should've been - // caught on constructing the Multiaddr - panic(fmt.Errorf("no protocol with code %d", b[0])) - } - ps = append(ps, p) - b = b[n:] - - n, size, err := sizeForAddr(p, b) - if err != nil { - panic(err) - } - - b = b[n+size:] - } - return ps -} - -// Encapsulate wraps a given Multiaddr, returning the resulting joined Multiaddr -func (m *multiaddr) Encapsulate(o Multiaddr) Multiaddr { - mb := m.bytes - ob := o.Bytes() - - b := make([]byte, len(mb)+len(ob)) - copy(b, mb) - copy(b[len(mb):], ob) - return &multiaddr{bytes: b} -} - -// Decapsulate unwraps Multiaddr up until the given Multiaddr is found. -func (m *multiaddr) Decapsulate(o Multiaddr) Multiaddr { - s1 := m.String() - s2 := o.String() - i := strings.LastIndex(s1, s2) - if i < 0 { - // if multiaddr not contained, returns a copy. - cpy := make([]byte, len(m.bytes)) - copy(cpy, m.bytes) - return &multiaddr{bytes: cpy} - } - - if i == 0 { - return nil - } - - ma, err := NewMultiaddr(s1[:i]) - if err != nil { - panic("Multiaddr.Decapsulate incorrect byte boundaries.") - } - return ma -} - -var ErrProtocolNotFound = fmt.Errorf("protocol not found in multiaddr") - -func (m *multiaddr) ValueForProtocol(code int) (value string, err error) { - err = ErrProtocolNotFound - ForEach(m, func(c Component) bool { - if c.Protocol().Code == code { - value = c.Value() - err = nil - return false - } - return true - }) - return -} diff --git a/vendor/github.com/multiformats/go-multiaddr/package.json b/vendor/github.com/multiformats/go-multiaddr/package.json deleted file mode 100644 index c493b27e..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "author": "multiformats", - "bugs": { - "url": "https://github.com/multiformats/go-multiaddr/issues" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multiaddr" - }, - "gxDependencies": [ - { - "hash": "QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW", - "name": "go-multihash", - "version": "1.0.9" - } - ], - "gxVersion": "0.9.0", - "language": "go", - "license": "MIT", - "name": "go-multiaddr", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.4.1" -} - diff --git a/vendor/github.com/multiformats/go-multiaddr/protocol.go b/vendor/github.com/multiformats/go-multiaddr/protocol.go deleted file mode 100644 index f9d70363..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/protocol.go +++ /dev/null @@ -1,129 +0,0 @@ -package multiaddr - -import ( - "fmt" - "strings" -) - -// These are special sizes -const ( - LengthPrefixedVarSize = -1 -) - -// Protocol is a Multiaddr protocol description structure. -type Protocol struct { - // Name is the string representation of the protocol code. E.g., ip4, - // ip6, tcp, udp, etc. - Name string - - // Code is the protocol's multicodec (a normal, non-varint number). - Code int - - // VCode is a precomputed varint encoded version of Code. - VCode []byte - - // Size is the size of the argument to this protocol. - // - // * Size == 0 means this protocol takes no argument. - // * Size > 0 means this protocol takes a constant sized argument. - // * Size < 0 means this protocol takes a variable length, varint - // prefixed argument. - Size int // a size of -1 indicates a length-prefixed variable size - - // Path indicates a path protocol (e.g., unix). When parsing multiaddr - // strings, path protocols consume the remainder of the address instead - // of stopping at the next forward slash. - // - // Size must be LengthPrefixedVarSize. - Path bool - - // Transcoder converts between the byte representation and the string - // representation of this protocol's argument (if any). - // - // This should only be non-nil if Size != 0 - Transcoder Transcoder -} - -var protocolsByName = map[string]Protocol{} -var protocolsByCode = map[int]Protocol{} - -// Protocols is the list of multiaddr protocols supported by this module. -var Protocols = []Protocol{} - -// SwapToP2pMultiaddrs is a function to make the transition from /ipfs/... -// multiaddrs to /p2p/... multiaddrs easier -// The first stage of the rollout is to ship this package to all users so -// that all users of multiaddr can parse both /ipfs/ and /p2p/ multiaddrs -// as the same code (P_P2P). During this stage of the rollout, all addresses -// with P_P2P will continue printing as /ipfs/, so that older clients without -// the new parsing code won't break. -// Once the network has adopted the new parsing code broadly enough, users of -// multiaddr can add a call to this method to an init function in their codebase. -// This will cause any P_P2P multiaddr to print out as /p2p/ instead of /ipfs/. -// Note that the binary serialization of this multiaddr does not change at any -// point. This means that this code is not a breaking network change at any point -func SwapToP2pMultiaddrs() { - for i := range Protocols { - if Protocols[i].Code == P_P2P { - Protocols[i].Name = "p2p" - break - } - } - - protoP2P.Name = "p2p" - - protocolsByName["ipfs"] = protoP2P - protocolsByName["p2p"] = protoP2P - protocolsByCode[protoP2P.Code] = protoP2P -} - -func AddProtocol(p Protocol) error { - if _, ok := protocolsByName[p.Name]; ok { - return fmt.Errorf("protocol by the name %q already exists", p.Name) - } - - if _, ok := protocolsByCode[p.Code]; ok { - return fmt.Errorf("protocol code %d already taken by %q", p.Code, p.Code) - } - - if p.Size != 0 && p.Transcoder == nil { - return fmt.Errorf("protocols with arguments must define transcoders") - } - if p.Path && p.Size >= 0 { - return fmt.Errorf("path protocols must have variable-length sizes") - } - - Protocols = append(Protocols, p) - protocolsByName[p.Name] = p - protocolsByCode[p.Code] = p - return nil -} - -// ProtocolWithName returns the Protocol description with given string name. -func ProtocolWithName(s string) Protocol { - return protocolsByName[s] -} - -// ProtocolWithCode returns the Protocol description with given protocol code. -func ProtocolWithCode(c int) Protocol { - return protocolsByCode[c] -} - -// ProtocolsWithString returns a slice of protocols matching given string. -func ProtocolsWithString(s string) ([]Protocol, error) { - s = strings.Trim(s, "/") - sp := strings.Split(s, "/") - if len(sp) == 0 { - return nil, nil - } - - t := make([]Protocol, len(sp)) - for i, name := range sp { - p := ProtocolWithName(name) - if p.Code == 0 { - return nil, fmt.Errorf("no protocol with name: %s", name) - } - t[i] = p - } - return t, nil -} diff --git a/vendor/github.com/multiformats/go-multiaddr/protocols.go b/vendor/github.com/multiformats/go-multiaddr/protocols.go deleted file mode 100644 index cb38a70e..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/protocols.go +++ /dev/null @@ -1,189 +0,0 @@ -package multiaddr - -// You **MUST** register your multicodecs with -// https://github.com/multiformats/multicodec before adding them here. -const ( - P_IP4 = 0x0004 - P_TCP = 0x0006 - P_UDP = 0x0111 - P_DCCP = 0x0021 - P_IP6 = 0x0029 - P_IP6ZONE = 0x002A - P_QUIC = 0x01CC - P_SCTP = 0x0084 - P_UDT = 0x012D - P_UTP = 0x012E - P_UNIX = 0x0190 - P_P2P = 0x01A5 - P_IPFS = 0x01A5 // alias for backwards compatability - P_HTTP = 0x01E0 - P_HTTPS = 0x01BB - P_ONION = 0x01BC // also for backwards compatibility - P_ONION3 = 0x01BD - P_GARLIC64 = 0x01BE - P_GARLIC32 = 0x01BF - P_P2P_WEBRTC_DIRECT = 0x0114 -) - -var ( - protoIP4 = Protocol{ - Name: "ip4", - Code: P_IP4, - VCode: CodeToVarint(P_IP4), - Size: 32, - Path: false, - Transcoder: TranscoderIP4, - } - protoTCP = Protocol{ - Name: "tcp", - Code: P_TCP, - VCode: CodeToVarint(P_TCP), - Size: 16, - Path: false, - Transcoder: TranscoderPort, - } - protoUDP = Protocol{ - Name: "udp", - Code: P_UDP, - VCode: CodeToVarint(P_UDP), - Size: 16, - Path: false, - Transcoder: TranscoderPort, - } - protoDCCP = Protocol{ - Name: "dccp", - Code: P_DCCP, - VCode: CodeToVarint(P_DCCP), - Size: 16, - Path: false, - Transcoder: TranscoderPort, - } - protoIP6 = Protocol{ - Name: "ip6", - Code: P_IP6, - VCode: CodeToVarint(P_IP6), - Size: 128, - Transcoder: TranscoderIP6, - } - // these require varint - protoIP6ZONE = Protocol{ - Name: "ip6zone", - Code: P_IP6ZONE, - VCode: CodeToVarint(P_IP6ZONE), - Size: LengthPrefixedVarSize, - Path: false, - Transcoder: TranscoderIP6Zone, - } - protoSCTP = Protocol{ - Name: "sctp", - Code: P_SCTP, - VCode: CodeToVarint(P_SCTP), - Size: 16, - Transcoder: TranscoderPort, - } - protoONION2 = Protocol{ - Name: "onion", - Code: P_ONION, - VCode: CodeToVarint(P_ONION), - Size: 96, - Transcoder: TranscoderOnion, - } - protoONION3 = Protocol{ - Name: "onion3", - Code: P_ONION3, - VCode: CodeToVarint(P_ONION3), - Size: 296, - Transcoder: TranscoderOnion3, - } - protoGARLIC64 = Protocol{ - Name: "garlic64", - Code: P_GARLIC64, - VCode: CodeToVarint(P_GARLIC64), - Size: LengthPrefixedVarSize, - Transcoder: TranscoderGarlic64, - } - protoGARLIC32 = Protocol{ - Name: "garlic32", - Code: P_GARLIC32, - VCode: CodeToVarint(P_GARLIC32), - Size: LengthPrefixedVarSize, - Transcoder: TranscoderGarlic32, - } - protoUTP = Protocol{ - Name: "utp", - Code: P_UTP, - VCode: CodeToVarint(P_UTP), - } - protoUDT = Protocol{ - Name: "udt", - Code: P_UDT, - VCode: CodeToVarint(P_UDT), - } - protoQUIC = Protocol{ - Name: "quic", - Code: P_QUIC, - VCode: CodeToVarint(P_QUIC), - } - protoHTTP = Protocol{ - Name: "http", - Code: P_HTTP, - VCode: CodeToVarint(P_HTTP), - } - protoHTTPS = Protocol{ - Name: "https", - Code: P_HTTPS, - VCode: CodeToVarint(P_HTTPS), - } - protoP2P = Protocol{ - Name: "ipfs", - Code: P_P2P, - VCode: CodeToVarint(P_P2P), - Size: LengthPrefixedVarSize, - Transcoder: TranscoderP2P, - } - protoUNIX = Protocol{ - Name: "unix", - Code: P_UNIX, - VCode: CodeToVarint(P_UNIX), - Size: LengthPrefixedVarSize, - Path: true, - Transcoder: TranscoderUnix, - } - protoP2P_WEBRTC_DIRECT = Protocol{ - Name: "p2p-webrtc-direct", - Code: P_P2P_WEBRTC_DIRECT, - VCode: CodeToVarint(P_P2P_WEBRTC_DIRECT), - } -) - -func init() { - for _, p := range []Protocol{ - protoIP4, - protoTCP, - protoUDP, - protoDCCP, - protoIP6, - protoIP6ZONE, - protoSCTP, - protoONION2, - protoONION3, - protoGARLIC64, - protoGARLIC32, - protoUTP, - protoUDT, - protoQUIC, - protoHTTP, - protoHTTPS, - protoP2P, - protoUNIX, - protoP2P_WEBRTC_DIRECT, - } { - if err := AddProtocol(p); err != nil { - panic(err) - } - } - - // explicitly set both of these - protocolsByName["p2p"] = protoP2P - protocolsByName["ipfs"] = protoP2P -} diff --git a/vendor/github.com/multiformats/go-multiaddr/transcoders.go b/vendor/github.com/multiformats/go-multiaddr/transcoders.go deleted file mode 100644 index 77908b70..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/transcoders.go +++ /dev/null @@ -1,319 +0,0 @@ -package multiaddr - -import ( - "bytes" - "encoding/base32" - "encoding/base64" - "encoding/binary" - "fmt" - "net" - "strconv" - "strings" - - mh "github.com/multiformats/go-multihash" -) - -type Transcoder interface { - StringToBytes(string) ([]byte, error) - BytesToString([]byte) (string, error) - ValidateBytes([]byte) error -} - -func NewTranscoderFromFunctions( - s2b func(string) ([]byte, error), - b2s func([]byte) (string, error), - val func([]byte) error, -) Transcoder { - return twrp{s2b, b2s, val} -} - -type twrp struct { - strtobyte func(string) ([]byte, error) - bytetostr func([]byte) (string, error) - validbyte func([]byte) error -} - -func (t twrp) StringToBytes(s string) ([]byte, error) { - return t.strtobyte(s) -} -func (t twrp) BytesToString(b []byte) (string, error) { - return t.bytetostr(b) -} - -func (t twrp) ValidateBytes(b []byte) error { - if t.validbyte == nil { - return nil - } - return t.validbyte(b) -} - -var TranscoderIP4 = NewTranscoderFromFunctions(ip4StB, ip4BtS, nil) -var TranscoderIP6 = NewTranscoderFromFunctions(ip6StB, ip6BtS, nil) -var TranscoderIP6Zone = NewTranscoderFromFunctions(ip6zoneStB, ip6zoneBtS, ip6zoneVal) - -func ip4StB(s string) ([]byte, error) { - i := net.ParseIP(s).To4() - if i == nil { - return nil, fmt.Errorf("failed to parse ip4 addr: %s", s) - } - return i, nil -} - -func ip6zoneStB(s string) ([]byte, error) { - if len(s) == 0 { - return nil, fmt.Errorf("empty ip6zone") - } - return []byte(s), nil -} - -func ip6zoneBtS(b []byte) (string, error) { - if len(b) == 0 { - return "", fmt.Errorf("invalid length (should be > 0)") - } - return string(b), nil -} - -func ip6zoneVal(b []byte) error { - if len(b) == 0 { - return fmt.Errorf("invalid length (should be > 0)") - } - // Not supported as this would break multiaddrs. - if bytes.IndexByte(b, '/') >= 0 { - return fmt.Errorf("IPv6 zone ID contains '/': %s", string(b)) - } - return nil -} - -func ip6StB(s string) ([]byte, error) { - i := net.ParseIP(s).To16() - if i == nil { - return nil, fmt.Errorf("failed to parse ip6 addr: %s", s) - } - return i, nil -} - -func ip6BtS(b []byte) (string, error) { - ip := net.IP(b) - if ip4 := ip.To4(); ip4 != nil { - // Go fails to prepend the `::ffff:` part. - return "::ffff:" + ip4.String(), nil - } - return ip.String(), nil -} - -func ip4BtS(b []byte) (string, error) { - return net.IP(b).String(), nil -} - -var TranscoderPort = NewTranscoderFromFunctions(portStB, portBtS, nil) - -func portStB(s string) ([]byte, error) { - i, err := strconv.Atoi(s) - if err != nil { - return nil, fmt.Errorf("failed to parse port addr: %s", err) - } - if i >= 65536 { - return nil, fmt.Errorf("failed to parse port addr: %s", "greater than 65536") - } - b := make([]byte, 2) - binary.BigEndian.PutUint16(b, uint16(i)) - return b, nil -} - -func portBtS(b []byte) (string, error) { - i := binary.BigEndian.Uint16(b) - return strconv.Itoa(int(i)), nil -} - -var TranscoderOnion = NewTranscoderFromFunctions(onionStB, onionBtS, nil) - -func onionStB(s string) ([]byte, error) { - addr := strings.Split(s, ":") - if len(addr) != 2 { - return nil, fmt.Errorf("failed to parse onion addr: %s does not contain a port number.", s) - } - - // onion address without the ".onion" substring - if len(addr[0]) != 16 { - return nil, fmt.Errorf("failed to parse onion addr: %s not a Tor onion address.", s) - } - onionHostBytes, err := base32.StdEncoding.DecodeString(strings.ToUpper(addr[0])) - if err != nil { - return nil, fmt.Errorf("failed to decode base32 onion addr: %s %s", s, err) - } - - // onion port number - i, err := strconv.Atoi(addr[1]) - if err != nil { - return nil, fmt.Errorf("failed to parse onion addr: %s", err) - } - if i >= 65536 { - return nil, fmt.Errorf("failed to parse onion addr: %s", "port greater than 65536") - } - if i < 1 { - return nil, fmt.Errorf("failed to parse onion addr: %s", "port less than 1") - } - - onionPortBytes := make([]byte, 2) - binary.BigEndian.PutUint16(onionPortBytes, uint16(i)) - bytes := []byte{} - bytes = append(bytes, onionHostBytes...) - bytes = append(bytes, onionPortBytes...) - return bytes, nil -} - -func onionBtS(b []byte) (string, error) { - addr := strings.ToLower(base32.StdEncoding.EncodeToString(b[0:10])) - port := binary.BigEndian.Uint16(b[10:12]) - return addr + ":" + strconv.Itoa(int(port)), nil -} - -var TranscoderOnion3 = NewTranscoderFromFunctions(onion3StB, onion3BtS, nil) - -func onion3StB(s string) ([]byte, error) { - addr := strings.Split(s, ":") - if len(addr) != 2 { - return nil, fmt.Errorf("failed to parse onion addr: %s does not contain a port number.", s) - } - - // onion address without the ".onion" substring - if len(addr[0]) != 56 { - return nil, fmt.Errorf("failed to parse onion addr: %s not a Tor onionv3 address. len == %d", s, len(addr[0])) - } - onionHostBytes, err := base32.StdEncoding.DecodeString(strings.ToUpper(addr[0])) - if err != nil { - return nil, fmt.Errorf("failed to decode base32 onion addr: %s %s", s, err) - } - - // onion port number - i, err := strconv.Atoi(addr[1]) - if err != nil { - return nil, fmt.Errorf("failed to parse onion addr: %s", err) - } - if i >= 65536 { - return nil, fmt.Errorf("failed to parse onion addr: %s", "port greater than 65536") - } - if i < 1 { - return nil, fmt.Errorf("failed to parse onion addr: %s", "port less than 1") - } - - onionPortBytes := make([]byte, 2) - binary.BigEndian.PutUint16(onionPortBytes, uint16(i)) - bytes := []byte{} - bytes = append(bytes, onionHostBytes[0:35]...) - bytes = append(bytes, onionPortBytes...) - return bytes, nil -} - -func onion3BtS(b []byte) (string, error) { - addr := strings.ToLower(base32.StdEncoding.EncodeToString(b[0:35])) - port := binary.BigEndian.Uint16(b[35:37]) - str := addr + ":" + strconv.Itoa(int(port)) - return str, nil -} - -var TranscoderGarlic64 = NewTranscoderFromFunctions(garlic64StB, garlic64BtS, garlic64Validate) - -// i2p uses an alternate character set for base64 addresses. This returns an appropriate encoder. -var garlicBase64Encoding = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~") - -func garlic64StB(s string) ([]byte, error) { - // i2p base64 address will be between 516 and 616 characters long, depending on - // certificate type - if len(s) < 516 || len(s) > 616 { - return nil, fmt.Errorf("failed to parse garlic addr: %s not an i2p base64 address. len: %d\n", s, len(s)) - } - garlicHostBytes, err := garlicBase64Encoding.DecodeString(s) - if err != nil { - return nil, fmt.Errorf("failed to decode base64 i2p addr: %s %s", s, err) - } - - return garlicHostBytes, nil -} - -func garlic64BtS(b []byte) (string, error) { - if err := garlic64Validate(b); err != nil { - return "", err - } - addr := garlicBase64Encoding.EncodeToString(b) - return addr, nil -} - -func garlic64Validate(b []byte) error { - // A garlic64 address will always be greater than 386 bytes long when encoded. - if len(b) < 386 { - return fmt.Errorf("failed to validate garlic addr: %s not an i2p base64 address. len: %d\n", b, len(b)) - } - return nil -} - -var TranscoderGarlic32 = NewTranscoderFromFunctions(garlic32StB, garlic32BtS, garlic32Validate) - -var garlicBase32Encoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567") - -func garlic32StB(s string) ([]byte, error) { - // an i2p base32 address with a length of greater than 55 characters is - // using an Encrypted Leaseset v2. all other base32 addresses will always be - // exactly 52 characters - if len(s) < 55 && len(s) != 52 { - return nil, fmt.Errorf("failed to parse garlic addr: %s not a i2p base32 address. len: %d", s, len(s)) - } - for len(s)%8 != 0 { - s += "=" - } - garlicHostBytes, err := garlicBase32Encoding.DecodeString(s) - if err != nil { - return nil, fmt.Errorf("failed to decode base32 garlic addr: %s, err: %v len: %v", s, err, len(s)) - } - return garlicHostBytes, nil -} - -func garlic32BtS(b []byte) (string, error) { - if err := garlic32Validate(b); err != nil { - return "", err - } - return strings.TrimRight(garlicBase32Encoding.EncodeToString(b), "="), nil -} - -func garlic32Validate(b []byte) error { - // an i2p base64 for an Encrypted Leaseset v2 will be at least 35 bytes - // long other than that, they will be exactly 32 bytes - if len(b) < 35 && len(b) != 32 { - return fmt.Errorf("failed to validate garlic addr: %s not an i2p base32 address. len: %d\n", b, len(b)) - } - return nil -} - -var TranscoderP2P = NewTranscoderFromFunctions(p2pStB, p2pBtS, p2pVal) - -func p2pStB(s string) ([]byte, error) { - // the address is a varint prefixed multihash string representation - m, err := mh.FromB58String(s) - if err != nil { - return nil, fmt.Errorf("failed to parse p2p addr: %s %s", s, err) - } - return m, nil -} - -func p2pVal(b []byte) error { - _, err := mh.Cast(b) - return err -} - -func p2pBtS(b []byte) (string, error) { - m, err := mh.Cast(b) - if err != nil { - return "", err - } - return m.B58String(), nil -} - -var TranscoderUnix = NewTranscoderFromFunctions(unixStB, unixBtS, nil) - -func unixStB(s string) ([]byte, error) { - return []byte(s), nil -} - -func unixBtS(b []byte) (string, error) { - return string(b), nil -} diff --git a/vendor/github.com/multiformats/go-multiaddr/util.go b/vendor/github.com/multiformats/go-multiaddr/util.go deleted file mode 100644 index cf4469af..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/util.go +++ /dev/null @@ -1,180 +0,0 @@ -package multiaddr - -import "fmt" - -// Split returns the sub-address portions of a multiaddr. -func Split(m Multiaddr) []Multiaddr { - if _, ok := m.(*Component); ok { - return []Multiaddr{m} - } - var addrs []Multiaddr - ForEach(m, func(c Component) bool { - addrs = append(addrs, &c) - return true - }) - return addrs -} - -// Join returns a combination of addresses. -func Join(ms ...Multiaddr) Multiaddr { - switch len(ms) { - case 0: - // empty multiaddr, unfortunately, we have callers that rely on - // this contract. - return &multiaddr{} - case 1: - return ms[0] - } - - length := 0 - bs := make([][]byte, len(ms)) - for i, m := range ms { - bs[i] = m.Bytes() - length += len(bs[i]) - } - - bidx := 0 - b := make([]byte, length) - for _, mb := range bs { - bidx += copy(b[bidx:], mb) - } - return &multiaddr{bytes: b} -} - -// Cast re-casts a byte slice as a multiaddr. will panic if it fails to parse. -func Cast(b []byte) Multiaddr { - m, err := NewMultiaddrBytes(b) - if err != nil { - panic(fmt.Errorf("multiaddr failed to parse: %s", err)) - } - return m -} - -// StringCast like Cast, but parses a string. Will also panic if it fails to parse. -func StringCast(s string) Multiaddr { - m, err := NewMultiaddr(s) - if err != nil { - panic(fmt.Errorf("multiaddr failed to parse: %s", err)) - } - return m -} - -// SplitFirst returns the first component and the rest of the multiaddr. -func SplitFirst(m Multiaddr) (*Component, Multiaddr) { - // Shortcut if we already have a component - if c, ok := m.(*Component); ok { - return c, nil - } - - b := m.Bytes() - if len(b) == 0 { - return nil, nil - } - n, c, err := readComponent(b) - if err != nil { - panic(err) - } - if len(b) == n { - return &c, nil - } - return &c, &multiaddr{b[n:]} -} - -// SplitLast returns the rest of the multiaddr and the last component. -func SplitLast(m Multiaddr) (Multiaddr, *Component) { - // Shortcut if we already have a component - if c, ok := m.(*Component); ok { - return nil, c - } - - b := m.Bytes() - if len(b) == 0 { - return nil, nil - } - - var ( - c Component - err error - offset int - ) - for { - var n int - n, c, err = readComponent(b[offset:]) - if err != nil { - panic(err) - } - if len(b) == n+offset { - // Reached end - if offset == 0 { - // Only one component - return nil, &c - } - return &multiaddr{b[:offset]}, &c - } - offset += n - } -} - -// SplitFunc splits the multiaddr when the callback first returns true. The -// component on which the callback first returns will be included in the -// *second* multiaddr. -func SplitFunc(m Multiaddr, cb func(Component) bool) (Multiaddr, Multiaddr) { - // Shortcut if we already have a component - if c, ok := m.(*Component); ok { - if cb(*c) { - return nil, m - } - return m, nil - } - b := m.Bytes() - if len(b) == 0 { - return nil, nil - } - var ( - c Component - err error - offset int - ) - for offset < len(b) { - var n int - n, c, err = readComponent(b[offset:]) - if err != nil { - panic(err) - } - if cb(c) { - break - } - offset += n - } - switch offset { - case 0: - return nil, m - case len(b): - return m, nil - default: - return &multiaddr{b[:offset]}, &multiaddr{b[offset:]} - } -} - -// ForEach walks over the multiaddr, component by component. -// -// This function iterates over components *by value* to avoid allocating. -func ForEach(m Multiaddr, cb func(c Component) bool) { - // Shortcut if we already have a component - if c, ok := m.(*Component); ok { - cb(*c) - return - } - - b := m.Bytes() - for len(b) > 0 { - n, c, err := readComponent(b) - if err != nil { - panic(err) - } - if !cb(c) { - return - } - b = b[n:] - } -} diff --git a/vendor/github.com/multiformats/go-multiaddr/varint.go b/vendor/github.com/multiformats/go-multiaddr/varint.go deleted file mode 100644 index b8b1507b..00000000 --- a/vendor/github.com/multiformats/go-multiaddr/varint.go +++ /dev/null @@ -1,44 +0,0 @@ -package multiaddr - -import ( - "encoding/binary" - "fmt" - "math/bits" -) - -// VarintSize returns the size (in bytes) of `num` encoded as a varint. -func VarintSize(num int) int { - bits := bits.Len(uint(num)) - q, r := bits/7, bits%7 - size := q - if r > 0 || size == 0 { - size++ - } - return size -} - -// CodeToVarint converts an integer to a varint-encoded []byte -func CodeToVarint(num int) []byte { - buf := make([]byte, VarintSize(num)) - n := binary.PutUvarint(buf, uint64(num)) - return buf[:n] -} - -// VarintToCode converts a varint-encoded []byte to an integer protocol code -func VarintToCode(buf []byte) int { - num, _, err := ReadVarintCode(buf) - if err != nil { - panic(err) - } - return num -} - -// ReadVarintCode reads a varint code from the beginning of buf. -// returns the code, and the number of bytes read. -func ReadVarintCode(buf []byte) (int, int, error) { - num, n := binary.Uvarint(buf) - if n < 0 { - return 0, 0, fmt.Errorf("varints larger than uint64 not yet supported") - } - return int(num), n, nil -} diff --git a/vendor/github.com/multiformats/go-multibase/.codecov.yml b/vendor/github.com/multiformats/go-multibase/.codecov.yml deleted file mode 100644 index db247200..00000000 --- a/vendor/github.com/multiformats/go-multibase/.codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: off diff --git a/vendor/github.com/multiformats/go-multibase/.gitignore b/vendor/github.com/multiformats/go-multibase/.gitignore deleted file mode 100644 index 175b2916..00000000 --- a/vendor/github.com/multiformats/go-multibase/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.swp - -multibase-conv/multibase-conv diff --git a/vendor/github.com/multiformats/go-multibase/.gitmodules b/vendor/github.com/multiformats/go-multibase/.gitmodules deleted file mode 100644 index 74c037fa..00000000 --- a/vendor/github.com/multiformats/go-multibase/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "spec"] - path = spec - url = https://github.com/multiformats/multibase.git diff --git a/vendor/github.com/multiformats/go-multibase/.gxignore b/vendor/github.com/multiformats/go-multibase/.gxignore deleted file mode 100644 index c1d28ba5..00000000 --- a/vendor/github.com/multiformats/go-multibase/.gxignore +++ /dev/null @@ -1,2 +0,0 @@ -/spec/ -*_test.go diff --git a/vendor/github.com/multiformats/go-multibase/.travis.yml b/vendor/github.com/multiformats/go-multibase/.travis.yml deleted file mode 100644 index 18f4287d..00000000 --- a/vendor/github.com/multiformats/go-multibase/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multibase/LICENSE b/vendor/github.com/multiformats/go-multibase/LICENSE deleted file mode 100644 index f64ffb04..00000000 --- a/vendor/github.com/multiformats/go-multibase/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Protocol Labs Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multibase/Makefile b/vendor/github.com/multiformats/go-multibase/Makefile deleted file mode 100644 index 411b4a88..00000000 --- a/vendor/github.com/multiformats/go-multibase/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -test: deps - go test -race -v ./... - -export IPFS_API ?= v04x.ipfs.io - -gx: - go get -u github.com/whyrusleeping/gx - go get -u github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - go get -t ./... diff --git a/vendor/github.com/multiformats/go-multibase/README.md b/vendor/github.com/multiformats/go-multibase/README.md deleted file mode 100644 index 3c745445..00000000 --- a/vendor/github.com/multiformats/go-multibase/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# go-multibase - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![Travis CI](https://img.shields.io/travis/multiformats/go-multibase.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multibase) -[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multibase.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/go-multibase?branch=master) - -> Implementation of [multibase](https://github.com/multiformats/multibase) -self identifying base encodings- in Go. - - -## Install - -`go-multibase` is a standard Go module which can be installed with: - -```sh -go get github.com/multiformats/go-multibase -``` - -Note that `go-multibase` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section). - -## Usage - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project it is recommended that you: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/multiformats/go-multibase -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multibase/issues). - -Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2016 Protocol Labs Inc. diff --git a/vendor/github.com/multiformats/go-multibase/base16.go b/vendor/github.com/multiformats/go-multibase/base16.go deleted file mode 100644 index 6b879419..00000000 --- a/vendor/github.com/multiformats/go-multibase/base16.go +++ /dev/null @@ -1,21 +0,0 @@ -package multibase - -func hexEncodeToStringUpper(src []byte) string { - dst := make([]byte, len(src)*2) - hexEncodeUpper(dst, src) - return string(dst) -} - -var hexTableUppers = [16]byte{ - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F', -} - -func hexEncodeUpper(dst, src []byte) int { - for i, v := range src { - dst[i*2] = hexTableUppers[v>>4] - dst[i*2+1] = hexTableUppers[v&0x0f] - } - - return len(src) * 2 -} diff --git a/vendor/github.com/multiformats/go-multibase/base2.go b/vendor/github.com/multiformats/go-multibase/base2.go deleted file mode 100644 index 6e3f0cff..00000000 --- a/vendor/github.com/multiformats/go-multibase/base2.go +++ /dev/null @@ -1,52 +0,0 @@ -package multibase - -import ( - "fmt" - "strconv" - "strings" -) - -// binaryEncodeToString takes an array of bytes and returns -// multibase binary representation -func binaryEncodeToString(src []byte) string { - dst := make([]byte, len(src)*8) - encodeBinary(dst, src) - return string(dst) -} - -// encodeBinary takes the src and dst bytes and converts each -// byte to their binary rep using power reduction method -func encodeBinary(dst []byte, src []byte) { - for i, b := range src { - for j := 0; j < 8; j++ { - if b&(1<>3) - - for i, dstIndex := 0, 0; i < len(s); i = i + 8 { - value, err := strconv.ParseInt(s[i:i+8], 2, 0) - if err != nil { - return nil, fmt.Errorf("error while conversion: %s", err) - } - - data[dstIndex] = byte(value) - dstIndex++ - } - - return data, nil -} diff --git a/vendor/github.com/multiformats/go-multibase/base32.go b/vendor/github.com/multiformats/go-multibase/base32.go deleted file mode 100644 index a6fe8eb0..00000000 --- a/vendor/github.com/multiformats/go-multibase/base32.go +++ /dev/null @@ -1,17 +0,0 @@ -package multibase - -import ( - b32 "github.com/multiformats/go-base32" -) - -var base32StdLowerPad = b32.NewEncodingCI("abcdefghijklmnopqrstuvwxyz234567") -var base32StdLowerNoPad = base32StdLowerPad.WithPadding(b32.NoPadding) - -var base32StdUpperPad = b32.NewEncodingCI("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567") -var base32StdUpperNoPad = base32StdUpperPad.WithPadding(b32.NoPadding) - -var base32HexLowerPad = b32.NewEncodingCI("0123456789abcdefghijklmnopqrstuv") -var base32HexLowerNoPad = base32HexLowerPad.WithPadding(b32.NoPadding) - -var base32HexUpperPad = b32.NewEncodingCI("0123456789ABCDEFGHIJKLMNOPQRSTUV") -var base32HexUpperNoPad = base32HexUpperPad.WithPadding(b32.NoPadding) diff --git a/vendor/github.com/multiformats/go-multibase/encoder.go b/vendor/github.com/multiformats/go-multibase/encoder.go deleted file mode 100644 index 42e753f5..00000000 --- a/vendor/github.com/multiformats/go-multibase/encoder.go +++ /dev/null @@ -1,63 +0,0 @@ -package multibase - -import ( - "fmt" -) - -// Encoder is a multibase encoding that is verified to be supported and -// supports an Encode method that does not return an error -type Encoder struct { - enc Encoding -} - -// NewEncoder create a new Encoder from an Encoding -func NewEncoder(base Encoding) (Encoder, error) { - _, ok := EncodingToStr[base] - if !ok { - return Encoder{-1}, fmt.Errorf("Unsupported multibase encoding: %d", base) - } - return Encoder{base}, nil -} - -// MustNewEncoder is like NewEncoder but will panic if the encoding is -// invalid. -func MustNewEncoder(base Encoding) Encoder { - _, ok := EncodingToStr[base] - if !ok { - panic("Unsupported multibase encoding") - } - return Encoder{base} -} - -// EncoderByName creates an encoder from a string, the string can -// either be the multibase name or single character multibase prefix -func EncoderByName(str string) (Encoder, error) { - var base Encoding - ok := true - if len(str) == 0 { - return Encoder{-1}, fmt.Errorf("Empty multibase encoding") - } else if len(str) == 1 { - base = Encoding(str[0]) - _, ok = EncodingToStr[base] - } else { - base, ok = Encodings[str] - } - if !ok { - return Encoder{-1}, fmt.Errorf("Unsupported multibase encoding: %s", str) - } - return Encoder{base}, nil -} - -func (p Encoder) Encoding() Encoding { - return p.enc -} - -// Encode encodes the multibase using the given Encoder. -func (p Encoder) Encode(data []byte) string { - str, err := Encode(p.enc, data) - if err != nil { - // should not happen - panic(err) - } - return str -} diff --git a/vendor/github.com/multiformats/go-multibase/go.mod b/vendor/github.com/multiformats/go-multibase/go.mod deleted file mode 100644 index 28d6eb12..00000000 --- a/vendor/github.com/multiformats/go-multibase/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/multiformats/go-multibase - -require ( - github.com/mr-tron/base58 v1.1.0 - github.com/multiformats/go-base32 v0.0.3 -) diff --git a/vendor/github.com/multiformats/go-multibase/go.sum b/vendor/github.com/multiformats/go-multibase/go.sum deleted file mode 100644 index 510e3dcd..00000000 --- a/vendor/github.com/multiformats/go-multibase/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= diff --git a/vendor/github.com/multiformats/go-multibase/multibase.go b/vendor/github.com/multiformats/go-multibase/multibase.go deleted file mode 100644 index 0f9b3961..00000000 --- a/vendor/github.com/multiformats/go-multibase/multibase.go +++ /dev/null @@ -1,187 +0,0 @@ -package multibase - -import ( - "encoding/base64" - "encoding/hex" - "fmt" - - b58 "github.com/mr-tron/base58/base58" - b32 "github.com/multiformats/go-base32" -) - -// Encoding identifies the type of base-encoding that a multibase is carrying. -type Encoding int - -// These are the encodings specified in the standard, not are all -// supported yet -const ( - Identity = 0x00 - Base1 = '1' - Base2 = '0' - Base8 = '7' - Base10 = '9' - Base16 = 'f' - Base16Upper = 'F' - Base32 = 'b' - Base32Upper = 'B' - Base32pad = 'c' - Base32padUpper = 'C' - Base32hex = 'v' - Base32hexUpper = 'V' - Base32hexPad = 't' - Base32hexPadUpper = 'T' - Base58Flickr = 'Z' - Base58BTC = 'z' - Base64 = 'm' - Base64url = 'u' - Base64pad = 'M' - Base64urlPad = 'U' -) - -// Encodings is a map of the supported encoding, unsupported encoding -// specified in standard are left out -var Encodings = map[string]Encoding{ - "identity": 0x00, - "base2": '0', - "base16": 'f', - "base16upper": 'F', - "base32": 'b', - "base32upper": 'B', - "base32pad": 'c', - "base32padupper": 'C', - "base32hex": 'v', - "base32hexupper": 'V', - "base32hexpad": 't', - "base32hexpadupper": 'T', - "base58flickr": 'Z', - "base58btc": 'z', - "base64": 'm', - "base64url": 'u', - "base64pad": 'M', - "base64urlpad": 'U', -} - -var EncodingToStr = map[Encoding]string{ - 0x00: "identity", - '0': "base2", - 'f': "base16", - 'F': "base16upper", - 'b': "base32", - 'B': "base32upper", - 'c': "base32pad", - 'C': "base32padupper", - 'v': "base32hex", - 'V': "base32hexupper", - 't': "base32hexpad", - 'T': "base32hexpadupper", - 'Z': "base58flickr", - 'z': "base58btc", - 'm': "base64", - 'u': "base64url", - 'M': "base64pad", - 'U': "base64urlpad", -} - -// ErrUnsupportedEncoding is returned when the selected encoding is not known or -// implemented. -var ErrUnsupportedEncoding = fmt.Errorf("selected encoding not supported") - -// Encode encodes a given byte slice with the selected encoding and returns a -// multibase string (). It will return -// an error if the selected base is not known. -func Encode(base Encoding, data []byte) (string, error) { - switch base { - case Identity: - // 0x00 inside a string is OK in golang and causes no problems with the length calculation. - return string(Identity) + string(data), nil - case Base2: - return string(Base2) + binaryEncodeToString(data), nil - case Base16: - return string(Base16) + hex.EncodeToString(data), nil - case Base16Upper: - return string(Base16Upper) + hexEncodeToStringUpper(data), nil - case Base32: - return string(Base32) + base32StdLowerNoPad.EncodeToString(data), nil - case Base32Upper: - return string(Base32Upper) + base32StdUpperNoPad.EncodeToString(data), nil - case Base32hex: - return string(Base32hex) + base32HexLowerNoPad.EncodeToString(data), nil - case Base32hexUpper: - return string(Base32hexUpper) + base32HexUpperNoPad.EncodeToString(data), nil - case Base32pad: - return string(Base32pad) + base32StdLowerPad.EncodeToString(data), nil - case Base32padUpper: - return string(Base32padUpper) + base32StdUpperPad.EncodeToString(data), nil - case Base32hexPad: - return string(Base32hexPad) + base32HexLowerPad.EncodeToString(data), nil - case Base32hexPadUpper: - return string(Base32hexPadUpper) + base32HexUpperPad.EncodeToString(data), nil - case Base58BTC: - return string(Base58BTC) + b58.EncodeAlphabet(data, b58.BTCAlphabet), nil - case Base58Flickr: - return string(Base58Flickr) + b58.EncodeAlphabet(data, b58.FlickrAlphabet), nil - case Base64pad: - return string(Base64pad) + base64.StdEncoding.EncodeToString(data), nil - case Base64urlPad: - return string(Base64urlPad) + base64.URLEncoding.EncodeToString(data), nil - case Base64url: - return string(Base64url) + base64.RawURLEncoding.EncodeToString(data), nil - case Base64: - return string(Base64) + base64.RawStdEncoding.EncodeToString(data), nil - default: - return "", ErrUnsupportedEncoding - } -} - -// Decode takes a multibase string and decodes into a bytes buffer. -// It will return an error if the selected base is not known. -func Decode(data string) (Encoding, []byte, error) { - if len(data) == 0 { - return 0, nil, fmt.Errorf("cannot decode multibase for zero length string") - } - - enc := Encoding(data[0]) - - switch enc { - case Identity: - return Identity, []byte(data[1:]), nil - case Base2: - bytes, err := decodeBinaryString(data[1:]) - return enc, bytes, err - case Base16, Base16Upper: - bytes, err := hex.DecodeString(data[1:]) - return enc, bytes, err - case Base32, Base32Upper: - bytes, err := b32.RawStdEncoding.DecodeString(data[1:]) - return enc, bytes, err - case Base32hex, Base32hexUpper: - bytes, err := b32.RawHexEncoding.DecodeString(data[1:]) - return enc, bytes, err - case Base32pad, Base32padUpper: - bytes, err := b32.StdEncoding.DecodeString(data[1:]) - return enc, bytes, err - case Base32hexPad, Base32hexPadUpper: - bytes, err := b32.HexEncoding.DecodeString(data[1:]) - return enc, bytes, err - case Base58BTC: - bytes, err := b58.DecodeAlphabet(data[1:], b58.BTCAlphabet) - return Base58BTC, bytes, err - case Base58Flickr: - bytes, err := b58.DecodeAlphabet(data[1:], b58.FlickrAlphabet) - return Base58Flickr, bytes, err - case Base64pad: - bytes, err := base64.StdEncoding.DecodeString(data[1:]) - return Base64pad, bytes, err - case Base64urlPad: - bytes, err := base64.URLEncoding.DecodeString(data[1:]) - return Base64urlPad, bytes, err - case Base64: - bytes, err := base64.RawStdEncoding.DecodeString(data[1:]) - return Base64, bytes, err - case Base64url: - bytes, err := base64.RawURLEncoding.DecodeString(data[1:]) - return Base64url, bytes, err - default: - return -1, nil, ErrUnsupportedEncoding - } -} diff --git a/vendor/github.com/multiformats/go-multibase/package.json b/vendor/github.com/multiformats/go-multibase/package.json deleted file mode 100644 index 75f742e6..00000000 --- a/vendor/github.com/multiformats/go-multibase/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/multiformats/go-multibase" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multibase" - }, - "gxDependencies": [ - { - "author": "mr-tron", - "hash": "QmWFAMPqsEyUX7gDUsRVmMWz59FxSpJ1b2v6bJ1yYzo7jY", - "name": "go-base58-fast", - "version": "0.1.1" - }, - { - "author": "Golang", - "hash": "QmPbbYin7KBd1Y1BfUe15vHzwJiioyi3wtKQTtXWWf8SC5", - "name": "base32", - "version": "0.0.3" - } - ], - "gxVersion": "0.8.0", - "language": "go", - "license": "", - "name": "go-multibase", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.3.0" -} - diff --git a/vendor/github.com/multiformats/go-multihash/.gitignore b/vendor/github.com/multiformats/go-multihash/.gitignore deleted file mode 100644 index 1d74e219..00000000 --- a/vendor/github.com/multiformats/go-multihash/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.vscode/ diff --git a/vendor/github.com/multiformats/go-multihash/.travis.yml b/vendor/github.com/multiformats/go-multihash/.travis.yml deleted file mode 100644 index 09f9a4cc..00000000 --- a/vendor/github.com/multiformats/go-multihash/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multihash/LICENSE b/vendor/github.com/multiformats/go-multihash/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/multiformats/go-multihash/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multihash/Makefile b/vendor/github.com/multiformats/go-multihash/Makefile deleted file mode 100644 index 20619413..00000000 --- a/vendor/github.com/multiformats/go-multihash/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/multiformats/go-multihash/README.md b/vendor/github.com/multiformats/go-multihash/README.md deleted file mode 100644 index dd7f2386..00000000 --- a/vendor/github.com/multiformats/go-multihash/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# go-multihash - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/multiformats/go-multihash?status.svg)](https://godoc.org/github.com/multiformats/go-multihash) -[![Travis CI](https://img.shields.io/travis/multiformats/go-multihash.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multihash) -[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multihash.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/go-multihash?branch=master) - -> [multihash](https://github.com/multiformats/multihash) implementation in Go - -## Table of Contents - -- [Install](#install) -- [Usage](#usage) -- [Maintainers](#maintainers) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-multihash` is a standard Go module which can be installed with: - -```sh -go get github.com/multiformats/go-multihash -``` - -## Usage - - -### Example - -This example takes a standard hex-encoded data and uses `EncodeName` to calculate the SHA1 multihash value for the buffer. - -The resulting hex-encoded data corresponds to: ``, which could be re-parsed -with `Multihash.FromHexString()`. - - -```go -package main - -import ( - "encoding/hex" - "fmt" - - "github.com/multiformats/go-multihash" -) - -func main() { - // ignores errors for simplicity. - // don't do that at home. - // Decode a SHA1 hash to a binary buffer - buf, _ := hex.DecodeString("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33") - - // Create a new multihash with it. - mHashBuf, _ := multihash.EncodeName(buf, "sha1") - // Print the multihash as hex string - fmt.Printf("hex: %s\n", hex.EncodeToString(mHashBuf)) - - // Parse the binary multihash to a DecodedMultihash - mHash, _ := multihash.Decode(mHashBuf) - // Convert the sha1 value to hex string - sha1hex := hex.EncodeToString(mHash.Digest) - // Print all the information in the multihash - fmt.Printf("obj: %v 0x%x %d %s\n", mHash.Name, mHash.Code, mHash.Length, sha1hex) -} -``` - -To run, copy to [example/foo.go](example/foo.go) and: - -``` -> cd example/ -> go build -> ./example -hex: 11140beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 -obj: sha1 0x11 20 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 -``` - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multihash/issues). - -Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2014 Juan Batiz-Benet diff --git a/vendor/github.com/multiformats/go-multihash/codecov.yml b/vendor/github.com/multiformats/go-multihash/codecov.yml deleted file mode 100644 index 5f88a9ea..00000000 --- a/vendor/github.com/multiformats/go-multihash/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage: - range: "50...100" -comment: off diff --git a/vendor/github.com/multiformats/go-multihash/go.mod b/vendor/github.com/multiformats/go-multihash/go.mod deleted file mode 100644 index 27de256a..00000000 --- a/vendor/github.com/multiformats/go-multihash/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/multiformats/go-multihash - -require ( - github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 - github.com/minio/sha256-simd v0.1.0 - github.com/mr-tron/base58 v1.1.2 - github.com/spaolacci/murmur3 v1.1.0 - golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 -) diff --git a/vendor/github.com/multiformats/go-multihash/go.sum b/vendor/github.com/multiformats/go-multihash/go.sum deleted file mode 100644 index c599c83a..00000000 --- a/vendor/github.com/multiformats/go-multihash/go.sum +++ /dev/null @@ -1,16 +0,0 @@ -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/multiformats/go-multihash/io.go b/vendor/github.com/multiformats/go-multihash/io.go deleted file mode 100644 index 46290168..00000000 --- a/vendor/github.com/multiformats/go-multihash/io.go +++ /dev/null @@ -1,103 +0,0 @@ -package multihash - -import ( - "encoding/binary" - "errors" - "io" - "math" -) - -// Reader is an io.Reader wrapper that exposes a function -// to read a whole multihash, parse it, and return it. -type Reader interface { - io.Reader - - ReadMultihash() (Multihash, error) -} - -// Writer is an io.Writer wrapper that exposes a function -// to write a whole multihash. -type Writer interface { - io.Writer - - WriteMultihash(Multihash) error -} - -// NewReader wraps an io.Reader with a multihash.Reader -func NewReader(r io.Reader) Reader { - return &mhReader{r} -} - -// NewWriter wraps an io.Writer with a multihash.Writer -func NewWriter(w io.Writer) Writer { - return &mhWriter{w} -} - -type mhReader struct { - r io.Reader -} - -func (r *mhReader) Read(buf []byte) (n int, err error) { - return r.r.Read(buf) -} - -func (r *mhReader) ReadByte() (byte, error) { - if br, ok := r.r.(io.ByteReader); ok { - return br.ReadByte() - } - var b [1]byte - n, err := r.r.Read(b[:]) - if n == 1 { - return b[0], nil - } - if err == nil { - if n != 0 { - panic("reader returned an invalid length") - } - err = io.ErrNoProgress - } - return 0, err -} - -func (r *mhReader) ReadMultihash() (Multihash, error) { - code, err := binary.ReadUvarint(r) - if err != nil { - return nil, err - } - - length, err := binary.ReadUvarint(r) - if err != nil { - return nil, err - } - if length > math.MaxInt32 { - return nil, errors.New("digest too long, supporting only <= 2^31-1") - } - - pre := make([]byte, 2*binary.MaxVarintLen64) - spot := pre - n := binary.PutUvarint(spot, code) - spot = pre[n:] - n += binary.PutUvarint(spot, length) - - buf := make([]byte, int(length)+n) - copy(buf, pre[:n]) - - if _, err := io.ReadFull(r.r, buf[n:]); err != nil { - return nil, err - } - - return Cast(buf) -} - -type mhWriter struct { - w io.Writer -} - -func (w *mhWriter) Write(buf []byte) (n int, err error) { - return w.w.Write(buf) -} - -func (w *mhWriter) WriteMultihash(m Multihash) error { - _, err := w.w.Write([]byte(m)) - return err -} diff --git a/vendor/github.com/multiformats/go-multihash/multihash.go b/vendor/github.com/multiformats/go-multihash/multihash.go deleted file mode 100644 index ccfea831..00000000 --- a/vendor/github.com/multiformats/go-multihash/multihash.go +++ /dev/null @@ -1,298 +0,0 @@ -// Package multihash is the Go implementation of -// https://github.com/multiformats/multihash, or self-describing -// hashes. -package multihash - -import ( - "encoding/binary" - "encoding/hex" - "errors" - "fmt" - "math" - - b58 "github.com/mr-tron/base58/base58" -) - -// errors -var ( - ErrUnknownCode = errors.New("unknown multihash code") - ErrTooShort = errors.New("multihash too short. must be >= 2 bytes") - ErrTooLong = errors.New("multihash too long. must be < 129 bytes") - ErrLenNotSupported = errors.New("multihash does not yet support digests longer than 127 bytes") - ErrInvalidMultihash = errors.New("input isn't valid multihash") - - ErrVarintBufferShort = errors.New("uvarint: buffer too small") - ErrVarintTooLong = errors.New("uvarint: varint too big (max 64bit)") -) - -// ErrInconsistentLen is returned when a decoded multihash has an inconsistent length -type ErrInconsistentLen struct { - dm *DecodedMultihash -} - -func (e ErrInconsistentLen) Error() string { - return fmt.Sprintf("multihash length inconsistent: expected %d, got %d", e.dm.Length, len(e.dm.Digest)) -} - -// constants -const ( - ID = 0x00 - SHA1 = 0x11 - SHA2_256 = 0x12 - SHA2_512 = 0x13 - SHA3_224 = 0x17 - SHA3_256 = 0x16 - SHA3_384 = 0x15 - SHA3_512 = 0x14 - SHA3 = SHA3_512 - KECCAK_224 = 0x1A - KECCAK_256 = 0x1B - KECCAK_384 = 0x1C - KECCAK_512 = 0x1D - - SHAKE_128 = 0x18 - SHAKE_256 = 0x19 - - BLAKE2B_MIN = 0xb201 - BLAKE2B_MAX = 0xb240 - BLAKE2S_MIN = 0xb241 - BLAKE2S_MAX = 0xb260 - - MD5 = 0xd5 - - DBL_SHA2_256 = 0x56 - - MURMUR3 = 0x22 - - X11 = 0x1100 -) - -func init() { - // Add blake2b (64 codes) - for c := uint64(BLAKE2B_MIN); c <= BLAKE2B_MAX; c++ { - n := c - BLAKE2B_MIN + 1 - name := fmt.Sprintf("blake2b-%d", n*8) - Names[name] = c - Codes[c] = name - DefaultLengths[c] = int(n) - } - - // Add blake2s (32 codes) - for c := uint64(BLAKE2S_MIN); c <= BLAKE2S_MAX; c++ { - n := c - BLAKE2S_MIN + 1 - name := fmt.Sprintf("blake2s-%d", n*8) - Names[name] = c - Codes[c] = name - DefaultLengths[c] = int(n) - } -} - -// Names maps the name of a hash to the code -var Names = map[string]uint64{ - "id": ID, - "sha1": SHA1, - "sha2-256": SHA2_256, - "sha2-512": SHA2_512, - "sha3": SHA3_512, - "sha3-224": SHA3_224, - "sha3-256": SHA3_256, - "sha3-384": SHA3_384, - "sha3-512": SHA3_512, - "dbl-sha2-256": DBL_SHA2_256, - "murmur3": MURMUR3, - "keccak-224": KECCAK_224, - "keccak-256": KECCAK_256, - "keccak-384": KECCAK_384, - "keccak-512": KECCAK_512, - "shake-128": SHAKE_128, - "shake-256": SHAKE_256, - "x11": X11, - "md5": MD5, -} - -// Codes maps a hash code to it's name -var Codes = map[uint64]string{ - ID: "id", - SHA1: "sha1", - SHA2_256: "sha2-256", - SHA2_512: "sha2-512", - SHA3_224: "sha3-224", - SHA3_256: "sha3-256", - SHA3_384: "sha3-384", - SHA3_512: "sha3-512", - DBL_SHA2_256: "dbl-sha2-256", - MURMUR3: "murmur3", - KECCAK_224: "keccak-224", - KECCAK_256: "keccak-256", - KECCAK_384: "keccak-384", - KECCAK_512: "keccak-512", - SHAKE_128: "shake-128", - SHAKE_256: "shake-256", - X11: "x11", - MD5: "md5", -} - -// DefaultLengths maps a hash code to it's default length -var DefaultLengths = map[uint64]int{ - ID: -1, - SHA1: 20, - SHA2_256: 32, - SHA2_512: 64, - SHA3_224: 28, - SHA3_256: 32, - SHA3_384: 48, - SHA3_512: 64, - DBL_SHA2_256: 32, - KECCAK_224: 28, - KECCAK_256: 32, - MURMUR3: 4, - KECCAK_384: 48, - KECCAK_512: 64, - SHAKE_128: 32, - SHAKE_256: 64, - X11: 64, - MD5: 16, -} - -func uvarint(buf []byte) (uint64, []byte, error) { - n, c := binary.Uvarint(buf) - - if c == 0 { - return n, buf, ErrVarintBufferShort - } else if c < 0 { - return n, buf[-c:], ErrVarintTooLong - } else { - return n, buf[c:], nil - } -} - -// DecodedMultihash represents a parsed multihash and allows -// easy access to the different parts of a multihash. -type DecodedMultihash struct { - Code uint64 - Name string - Length int // Length is just int as it is type of len() opearator - Digest []byte // Digest holds the raw multihash bytes -} - -// Multihash is byte slice with the following form: -// . -// See the spec for more information. -type Multihash []byte - -// HexString returns the hex-encoded representation of a multihash. -func (m *Multihash) HexString() string { - return hex.EncodeToString([]byte(*m)) -} - -// String is an alias to HexString(). -func (m *Multihash) String() string { - return m.HexString() -} - -// FromHexString parses a hex-encoded multihash. -func FromHexString(s string) (Multihash, error) { - b, err := hex.DecodeString(s) - if err != nil { - return Multihash{}, err - } - - return Cast(b) -} - -// B58String returns the B58-encoded representation of a multihash. -func (m Multihash) B58String() string { - return b58.Encode([]byte(m)) -} - -// FromB58String parses a B58-encoded multihash. -func FromB58String(s string) (m Multihash, err error) { - b, err := b58.Decode(s) - if err != nil { - return Multihash{}, ErrInvalidMultihash - } - - return Cast(b) -} - -// Cast casts a buffer onto a multihash, and returns an error -// if it does not work. -func Cast(buf []byte) (Multihash, error) { - dm, err := Decode(buf) - if err != nil { - return Multihash{}, err - } - - if !ValidCode(dm.Code) { - return Multihash{}, ErrUnknownCode - } - - return Multihash(buf), nil -} - -// Decode parses multihash bytes into a DecodedMultihash. -func Decode(buf []byte) (*DecodedMultihash, error) { - - if len(buf) < 2 { - return nil, ErrTooShort - } - - var err error - var code, length uint64 - - code, buf, err = uvarint(buf) - if err != nil { - return nil, err - } - - length, buf, err = uvarint(buf) - if err != nil { - return nil, err - } - - if length > math.MaxInt32 { - return nil, errors.New("digest too long, supporting only <= 2^31-1") - } - - dm := &DecodedMultihash{ - Code: code, - Name: Codes[code], - Length: int(length), - Digest: buf, - } - - if len(dm.Digest) != dm.Length { - return nil, ErrInconsistentLen{dm} - } - - return dm, nil -} - -// Encode a hash digest along with the specified function code. -// Note: the length is derived from the length of the digest itself. -func Encode(buf []byte, code uint64) ([]byte, error) { - - if !ValidCode(code) { - return nil, ErrUnknownCode - } - - start := make([]byte, 2*binary.MaxVarintLen64, 2*binary.MaxVarintLen64+len(buf)) - spot := start - n := binary.PutUvarint(spot, code) - spot = start[n:] - n += binary.PutUvarint(spot, uint64(len(buf))) - - return append(start[:n], buf...), nil -} - -// EncodeName is like Encode() but providing a string name -// instead of a numeric code. See Names for allowed values. -func EncodeName(buf []byte, name string) ([]byte, error) { - return Encode(buf, Names[name]) -} - -// ValidCode checks whether a multihash code is valid. -func ValidCode(code uint64) bool { - _, ok := Codes[code] - return ok -} diff --git a/vendor/github.com/multiformats/go-multihash/multihash/LICENSE b/vendor/github.com/multiformats/go-multihash/multihash/LICENSE deleted file mode 100644 index c7386b3c..00000000 --- a/vendor/github.com/multiformats/go-multihash/multihash/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Juan Batiz-Benet - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multihash/sum.go b/vendor/github.com/multiformats/go-multihash/sum.go deleted file mode 100644 index 249cb757..00000000 --- a/vendor/github.com/multiformats/go-multihash/sum.go +++ /dev/null @@ -1,230 +0,0 @@ -package multihash - -import ( - "crypto/md5" - "crypto/sha1" - "crypto/sha512" - "errors" - "fmt" - - blake2b "github.com/minio/blake2b-simd" - sha256 "github.com/minio/sha256-simd" - murmur3 "github.com/spaolacci/murmur3" - blake2s "golang.org/x/crypto/blake2s" - sha3 "golang.org/x/crypto/sha3" -) - -// ErrSumNotSupported is returned when the Sum function code is not implemented -var ErrSumNotSupported = errors.New("Function not implemented. Complain to lib maintainer.") - -// HashFunc is a hash function that hashes data into digest. -// -// The length is the size the digest will be truncated to. While the hash -// function isn't responsible for truncating the digest, it may want to error if -// the length is invalid for the hash function (e.g., truncation would make the -// hash useless). -type HashFunc func(data []byte, length int) (digest []byte, err error) - -// funcTable maps multicodec values to hash functions. -var funcTable = make(map[uint64]HashFunc) - -// Sum obtains the cryptographic sum of a given buffer. The length parameter -// indicates the length of the resulting digest and passing a negative value -// use default length values for the selected hash function. -func Sum(data []byte, code uint64, length int) (Multihash, error) { - if !ValidCode(code) { - return nil, fmt.Errorf("invalid multihash code %d", code) - } - - if length < 0 { - var ok bool - length, ok = DefaultLengths[code] - if !ok { - return nil, fmt.Errorf("no default length for code %d", code) - } - } - - hashFunc, ok := funcTable[code] - if !ok { - return nil, ErrSumNotSupported - } - - d, err := hashFunc(data, length) - if err != nil { - return nil, err - } - if length >= 0 { - d = d[:length] - } - return Encode(d, code) -} - -func sumBlake2s(data []byte, size int) ([]byte, error) { - if size != 32 { - return nil, fmt.Errorf("unsupported length for blake2s: %d", size) - } - d := blake2s.Sum256(data) - return d[:], nil -} -func sumBlake2b(data []byte, size int) ([]byte, error) { - hasher, err := blake2b.New(&blake2b.Config{Size: uint8(size)}) - if err != nil { - return nil, err - } - - if _, err := hasher.Write(data); err != nil { - return nil, err - } - - return hasher.Sum(nil)[:], nil -} - -func sumID(data []byte, length int) ([]byte, error) { - if length >= 0 && length != len(data) { - return nil, fmt.Errorf("the length of the identity hash (%d) must be equal to the length of the data (%d)", - length, len(data)) - - } - return data, nil -} - -func sumSHA1(data []byte, length int) ([]byte, error) { - a := sha1.Sum(data) - return a[0:20], nil -} - -func sumSHA256(data []byte, length int) ([]byte, error) { - a := sha256.Sum256(data) - return a[0:32], nil -} - -func sumMD5(data []byte, length int) ([]byte, error) { - a := md5.Sum(data) - return a[0:md5.Size], nil -} - -func sumDoubleSHA256(data []byte, length int) ([]byte, error) { - val, _ := sumSHA256(data, len(data)) - return sumSHA256(val, len(val)) -} - -func sumSHA512(data []byte, length int) ([]byte, error) { - a := sha512.Sum512(data) - return a[0:64], nil -} -func sumKeccak256(data []byte, length int) ([]byte, error) { - h := sha3.NewLegacyKeccak256() - h.Write(data) - return h.Sum(nil), nil -} - -func sumKeccak512(data []byte, length int) ([]byte, error) { - h := sha3.NewLegacyKeccak512() - h.Write(data) - return h.Sum(nil), nil -} - -func sumSHA3_512(data []byte, length int) ([]byte, error) { - a := sha3.Sum512(data) - return a[:], nil -} - -func sumMURMUR3(data []byte, length int) ([]byte, error) { - number := murmur3.Sum32(data) - bytes := make([]byte, 4) - for i := range bytes { - bytes[i] = byte(number & 0xff) - number >>= 8 - } - return bytes, nil -} - -func sumSHAKE128(data []byte, length int) ([]byte, error) { - bytes := make([]byte, 32) - sha3.ShakeSum128(bytes, data) - return bytes, nil -} - -func sumSHAKE256(data []byte, length int) ([]byte, error) { - bytes := make([]byte, 64) - sha3.ShakeSum256(bytes, data) - return bytes, nil -} - -func sumSHA3_384(data []byte, length int) ([]byte, error) { - a := sha3.Sum384(data) - return a[:], nil -} - -func sumSHA3_256(data []byte, length int) ([]byte, error) { - a := sha3.Sum256(data) - return a[:], nil -} - -func sumSHA3_224(data []byte, length int) ([]byte, error) { - a := sha3.Sum224(data) - return a[:], nil -} - -func registerStdlibHashFuncs() { - RegisterHashFunc(ID, sumID) - RegisterHashFunc(SHA1, sumSHA1) - RegisterHashFunc(SHA2_512, sumSHA512) - RegisterHashFunc(MD5, sumMD5) -} - -func registerNonStdlibHashFuncs() { - RegisterHashFunc(SHA2_256, sumSHA256) - RegisterHashFunc(DBL_SHA2_256, sumDoubleSHA256) - - RegisterHashFunc(KECCAK_256, sumKeccak256) - RegisterHashFunc(KECCAK_512, sumKeccak512) - - RegisterHashFunc(SHA3_224, sumSHA3_224) - RegisterHashFunc(SHA3_256, sumSHA3_256) - RegisterHashFunc(SHA3_384, sumSHA3_384) - RegisterHashFunc(SHA3_512, sumSHA3_512) - - RegisterHashFunc(MURMUR3, sumMURMUR3) - - RegisterHashFunc(SHAKE_128, sumSHAKE128) - RegisterHashFunc(SHAKE_256, sumSHAKE256) - - // Blake family of hash functions - // BLAKE2S - for c := uint64(BLAKE2S_MIN); c <= BLAKE2S_MAX; c++ { - size := int(c - BLAKE2S_MIN + 1) - RegisterHashFunc(c, func(buf []byte, _ int) ([]byte, error) { - return sumBlake2s(buf, size) - }) - } - // BLAKE2B - for c := uint64(BLAKE2B_MIN); c <= BLAKE2B_MAX; c++ { - size := int(c - BLAKE2B_MIN + 1) - RegisterHashFunc(c, func(buf []byte, _ int) ([]byte, error) { - return sumBlake2b(buf, size) - }) - } -} - -func init() { - registerStdlibHashFuncs() - registerNonStdlibHashFuncs() -} - -// RegisterHashFunc adds an entry to the package-level code -> hash func map. -// The hash function must return at least the requested number of bytes. If it -// returns more, the hash will be truncated. -func RegisterHashFunc(code uint64, hashFunc HashFunc) error { - if !ValidCode(code) { - return fmt.Errorf("code %v not valid", code) - } - - _, ok := funcTable[code] - if ok { - return fmt.Errorf("hash func for code %v already registered", code) - } - - funcTable[code] = hashFunc - return nil -} diff --git a/vendor/github.com/multiformats/go-multistream/.travis.yml b/vendor/github.com/multiformats/go-multistream/.travis.yml deleted file mode 100644 index 18f4287d..00000000 --- a/vendor/github.com/multiformats/go-multistream/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -os: - - linux - -language: go - -go: - - 1.11.x - -env: - global: - - GOTFLAGS="-race" - matrix: - - BUILD_DEPTYPE=gx - - BUILD_DEPTYPE=gomod - - -# disable travis install -install: - - true - -script: - - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) - - -cache: - directories: - - $GOPATH/src/gx - - $GOPATH/pkg/mod - - /home/travis/.cache/go-build - -notifications: - email: false diff --git a/vendor/github.com/multiformats/go-multistream/LICENSE b/vendor/github.com/multiformats/go-multistream/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/multiformats/go-multistream/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/multiformats/go-multistream/Makefile b/vendor/github.com/multiformats/go-multistream/Makefile deleted file mode 100644 index 4f5206e4..00000000 --- a/vendor/github.com/multiformats/go-multistream/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -export IPFS_API ?= v04x.ipfs.io - -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go - -deps: gx - gx --verbose install --global - gx-go rewrite - -publish: - gx-go rewrite --undo - diff --git a/vendor/github.com/multiformats/go-multistream/README.md b/vendor/github.com/multiformats/go-multistream/README.md deleted file mode 100644 index 0111fe61..00000000 --- a/vendor/github.com/multiformats/go-multistream/README.md +++ /dev/null @@ -1,148 +0,0 @@ -# go-multistream - -[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) -[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) -[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) -[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) -[![GoDoc](https://godoc.org/github.com/multiformats/go-multistream?status.svg)](https://godoc.org/github.com/multiformats/go-multistream) -[![Travis CI](https://img.shields.io/travis/multiformats/go-multistream.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multistream) -[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multistream.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/go-multistream?branch=master) - -> an implementation of the multistream protocol in go - -This package implements a simple stream router for the multistream-select protocol. -The protocol is defined [here](https://github.com/multiformats/multistream-select). - -## Table of Contents - - -- [Install](#install) -- [Usage](#usage) -- [Maintainers](#maintainers) -- [Contribute](#contribute) -- [License](#license) - -## Install - -`go-multistream` is a standard Go module which can be installed with: - -```sh -go get github.com/multiformats/go-multistream -``` - -Note that `go-multistream` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section). - - -## Usage - -### Using Gx and Gx-go - -This module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project do: - -```sh -go get -u github.com/whyrusleeping/gx -go get -u github.com/whyrusleeping/gx-go -cd -gx init -gx import github.com/multiformats/go-multistream -gx install --global -gx-go --rewrite -``` - -Please check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information. - -### Example - - -This example shows how to use a multistream muxer. A muxer uses user-added handlers to handle different "protocols". The first step when interacting with a connection handler by the muxer is to select the protocol (the example uses `SelectProtoOrFail`). This will then let the muxer use the right handler. - - -```go -package main - -import ( - "fmt" - "io" - "io/ioutil" - "net" - - ms "github.com/multiformats/go-multistream" -) - -// This example creates a multistream muxer, adds handlers for the protocols -// "/cats" and "/dogs" and exposes it on a localhost:8765. It then opens connections -// to that port, selects the protocols and tests that the handlers are working. -func main() { - mux := ms.NewMultistreamMuxer() - mux.AddHandler("/cats", func(proto string, rwc io.ReadWriteCloser) error { - fmt.Fprintln(rwc, proto, ": HELLO I LIKE CATS") - return rwc.Close() - }) - mux.AddHandler("/dogs", func(proto string, rwc io.ReadWriteCloser) error { - fmt.Fprintln(rwc, proto, ": HELLO I LIKE DOGS") - return rwc.Close() - }) - - list, err := net.Listen("tcp", ":8765") - if err != nil { - panic(err) - } - - go func() { - for { - con, err := list.Accept() - if err != nil { - panic(err) - } - - go mux.Handle(con) - } - }() - - // The Muxer is ready, let's test it - conn, err := net.Dial("tcp", ":8765") - if err != nil { - panic(err) - } - - // Create a new multistream to talk to the muxer - // which will negotiate that we want to talk with /cats - mstream := ms.NewMSSelect(conn, "/cats") - cats, err := ioutil.ReadAll(mstream) - if err != nil { - panic(err) - } - fmt.Printf("%s", cats) - mstream.Close() - - // A different way of talking to the muxer - // is to manually selecting the protocol ourselves - conn, err = net.Dial("tcp", ":8765") - if err != nil { - panic(err) - } - defer conn.Close() - err = ms.SelectProtoOrFail("/dogs", conn) - if err != nil { - panic(err) - } - dogs, err := ioutil.ReadAll(conn) - if err != nil { - panic(err) - } - fmt.Printf("%s", dogs) - conn.Close() -} -``` - -## Contribute - -Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multistream/issues). - -Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). - -Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. - -## License - -[MIT](LICENSE) © 2016 Jeromy Johnson diff --git a/vendor/github.com/multiformats/go-multistream/client.go b/vendor/github.com/multiformats/go-multistream/client.go deleted file mode 100644 index 9a8f15e8..00000000 --- a/vendor/github.com/multiformats/go-multistream/client.go +++ /dev/null @@ -1,123 +0,0 @@ -package multistream - -import ( - "bytes" - "errors" - "io" -) - -// ErrNotSupported is the error returned when the muxer does not support -// the protocol specified for the handshake. -var ErrNotSupported = errors.New("protocol not supported") - -// ErrNoProtocols is the error returned when the no protocols have been -// specified. -var ErrNoProtocols = errors.New("no protocols specified") - -// SelectProtoOrFail performs the initial multistream handshake -// to inform the muxer of the protocol that will be used to communicate -// on this ReadWriteCloser. It returns an error if, for example, -// the muxer does not know how to handle this protocol. -func SelectProtoOrFail(proto string, rwc io.ReadWriteCloser) error { - errCh := make(chan error, 1) - go func() { - var buf bytes.Buffer - delimWrite(&buf, []byte(ProtocolID)) - delimWrite(&buf, []byte(proto)) - _, err := io.Copy(rwc, &buf) - errCh <- err - }() - // We have to read *both* errors. - err1 := readMultistreamHeader(rwc) - err2 := readProto(proto, rwc) - if werr := <-errCh; werr != nil { - return werr - } - if err1 != nil { - return err1 - } - if err2 != nil { - return err2 - } - return nil -} - -// SelectOneOf will perform handshakes with the protocols on the given slice -// until it finds one which is supported by the muxer. -func SelectOneOf(protos []string, rwc io.ReadWriteCloser) (string, error) { - if len(protos) == 0 { - return "", ErrNoProtocols - } - - // Use SelectProtoOrFail to pipeline the /multistream/1.0.0 handshake - // with an attempt to negotiate the first protocol. If that fails, we - // can continue negotiating the rest of the protocols normally. - // - // This saves us a round trip. - switch err := SelectProtoOrFail(protos[0], rwc); err { - case nil: - return protos[0], nil - case ErrNotSupported: // try others - default: - return "", err - } - for _, p := range protos[1:] { - err := trySelect(p, rwc) - switch err { - case nil: - return p, nil - case ErrNotSupported: - default: - return "", err - } - } - return "", ErrNotSupported -} - -func handshake(rwc io.ReadWriteCloser) error { - errCh := make(chan error, 1) - go func() { - errCh <- delimWriteBuffered(rwc, []byte(ProtocolID)) - }() - - if err := readMultistreamHeader(rwc); err != nil { - return err - } - return <-errCh -} - -func readMultistreamHeader(r io.ReadWriter) error { - tok, err := ReadNextToken(r) - if err != nil { - return err - } - - if tok != ProtocolID { - return errors.New("received mismatch in protocol id") - } - return nil -} - -func trySelect(proto string, rwc io.ReadWriteCloser) error { - err := delimWriteBuffered(rwc, []byte(proto)) - if err != nil { - return err - } - return readProto(proto, rwc) -} - -func readProto(proto string, rw io.ReadWriter) error { - tok, err := ReadNextToken(rw) - if err != nil { - return err - } - - switch tok { - case proto: - return nil - case "na": - return ErrNotSupported - default: - return errors.New("unrecognized response: " + tok) - } -} diff --git a/vendor/github.com/multiformats/go-multistream/go.mod b/vendor/github.com/multiformats/go-multistream/go.mod deleted file mode 100644 index 560ed671..00000000 --- a/vendor/github.com/multiformats/go-multistream/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/multiformats/go-multistream diff --git a/vendor/github.com/multiformats/go-multistream/lazyClient.go b/vendor/github.com/multiformats/go-multistream/lazyClient.go deleted file mode 100644 index f8d90018..00000000 --- a/vendor/github.com/multiformats/go-multistream/lazyClient.go +++ /dev/null @@ -1,143 +0,0 @@ -package multistream - -import ( - "fmt" - "io" - "sync" -) - -// Multistream represents in essense a ReadWriteCloser, or a single -// communication wire which supports multiple streams on it. Each -// stream is identified by a protocol tag. -type Multistream interface { - io.ReadWriteCloser -} - -// NewMSSelect returns a new Multistream which is able to perform -// protocol selection with a MultistreamMuxer. -func NewMSSelect(c io.ReadWriteCloser, proto string) Multistream { - return &lazyClientConn{ - protos: []string{ProtocolID, proto}, - con: c, - } -} - -// NewMultistream returns a multistream for the given protocol. This will not -// perform any protocol selection. If you are using a MultistreamMuxer, use -// NewMSSelect. -func NewMultistream(c io.ReadWriteCloser, proto string) Multistream { - return &lazyClientConn{ - protos: []string{proto}, - con: c, - } -} - -// lazyClientConn is a ReadWriteCloser adapter that lazily negotiates a protocol -// using multistream-select on first use. -// -// It *does not* block writes waiting for the other end to respond. Instead, it -// simply assumes the negotiation went successfully and starts writing data. -// See: https://github.com/multiformats/go-multistream/issues/20 -type lazyClientConn struct { - // Used to ensure we only trigger the write half of the handshake once. - rhandshakeOnce sync.Once - rerr error - - // Used to ensure we only trigger the read half of the handshake once. - whandshakeOnce sync.Once - werr error - - // The sequence of protocols to negotiate. - protos []string - - // The inner connection. - con io.ReadWriteCloser -} - -// Read reads data from the io.ReadWriteCloser. -// -// If the protocol hasn't yet been negotiated, this method triggers the write -// half of the handshake and then waits for the read half to complete. -// -// It returns an error if the read half of the handshake fails. -func (l *lazyClientConn) Read(b []byte) (int, error) { - l.rhandshakeOnce.Do(func() { - go l.whandshakeOnce.Do(l.doWriteHandshake) - l.doReadHandshake() - }) - if l.rerr != nil { - return 0, l.rerr - } - if len(b) == 0 { - return 0, nil - } - - return l.con.Read(b) -} - -func (l *lazyClientConn) doReadHandshake() { - for _, proto := range l.protos { - // read protocol - tok, err := ReadNextToken(l.con) - if err != nil { - l.rerr = err - return - } - - if tok != proto { - l.rerr = fmt.Errorf("protocol mismatch in lazy handshake ( %s != %s )", tok, proto) - return - } - } -} - -func (l *lazyClientConn) doWriteHandshake() { - l.doWriteHandshakeWithData(nil) -} - -// Perform the write handshake but *also* write some extra data. -func (l *lazyClientConn) doWriteHandshakeWithData(extra []byte) int { - buf := getWriter(l.con) - defer putWriter(buf) - - for _, proto := range l.protos { - l.werr = delimWrite(buf, []byte(proto)) - if l.werr != nil { - return 0 - } - } - - n := 0 - if len(extra) > 0 { - n, l.werr = buf.Write(extra) - if l.werr != nil { - return n - } - } - l.werr = buf.Flush() - return n -} - -// Write writes the given buffer to the underlying connection. -// -// If the protocol has not yet been negotiated, write waits for the write half -// of the handshake to complete triggers (but does not wait for) the read half. -// -// Write *also* ignores errors from the read half of the handshake (in case the -// stream is actually write only). -func (l *lazyClientConn) Write(b []byte) (int, error) { - n := 0 - l.whandshakeOnce.Do(func() { - go l.rhandshakeOnce.Do(l.doReadHandshake) - n = l.doWriteHandshakeWithData(b) - }) - if l.werr != nil || n > 0 { - return n, l.werr - } - return l.con.Write(b) -} - -// Close closes the underlying io.ReadWriteCloser -func (l *lazyClientConn) Close() error { - return l.con.Close() -} diff --git a/vendor/github.com/multiformats/go-multistream/lazyServer.go b/vendor/github.com/multiformats/go-multistream/lazyServer.go deleted file mode 100644 index d7501fac..00000000 --- a/vendor/github.com/multiformats/go-multistream/lazyServer.go +++ /dev/null @@ -1,37 +0,0 @@ -package multistream - -import ( - "io" - "sync" -) - -// lazyServerConn is an io.ReadWriteCloser adapter used for negotiating inbound -// streams (see NegotiateLazy). -// -// This is "lazy" because it doesn't wait for the write half to succeed before -// allowing us to read from the stream. -type lazyServerConn struct { - waitForHandshake sync.Once - werr error - - con io.ReadWriteCloser -} - -func (l *lazyServerConn) Write(b []byte) (int, error) { - l.waitForHandshake.Do(func() { panic("didn't initiate handshake") }) - if l.werr != nil { - return 0, l.werr - } - return l.con.Write(b) -} - -func (l *lazyServerConn) Read(b []byte) (int, error) { - if len(b) == 0 { - return 0, nil - } - return l.con.Read(b) -} - -func (l *lazyServerConn) Close() error { - return l.con.Close() -} diff --git a/vendor/github.com/multiformats/go-multistream/multistream-fuzz.zip b/vendor/github.com/multiformats/go-multistream/multistream-fuzz.zip deleted file mode 100644 index c4158f48..00000000 Binary files a/vendor/github.com/multiformats/go-multistream/multistream-fuzz.zip and /dev/null differ diff --git a/vendor/github.com/multiformats/go-multistream/multistream.go b/vendor/github.com/multiformats/go-multistream/multistream.go deleted file mode 100644 index 86d6bc2f..00000000 --- a/vendor/github.com/multiformats/go-multistream/multistream.go +++ /dev/null @@ -1,464 +0,0 @@ -// Package multistream implements a simple stream router for the -// multistream-select protocoli. The protocol is defined at -// https://github.com/multiformats/multistream-select -package multistream - -import ( - "bufio" - "bytes" - "encoding/binary" - "errors" - "io" - "sync" -) - -// ErrTooLarge is an error to signal that an incoming message was too large -var ErrTooLarge = errors.New("incoming message was too large") - -// ProtocolID identifies the multistream protocol itself and makes sure -// the multistream muxers on both sides of a channel can work with each other. -const ProtocolID = "/multistream/1.0.0" - -var writerPool = sync.Pool{ - New: func() interface{} { - return bufio.NewWriter(nil) - }, -} - -// HandlerFunc is a user-provided function used by the MultistreamMuxer to -// handle a protocol/stream. -type HandlerFunc = func(protocol string, rwc io.ReadWriteCloser) error - -// Handler is a wrapper to HandlerFunc which attaches a name (protocol) and a -// match function which can optionally be used to select a handler by other -// means than the name. -type Handler struct { - MatchFunc func(string) bool - Handle HandlerFunc - AddName string -} - -// MultistreamMuxer is a muxer for multistream. Depending on the stream -// protocol tag it will select the right handler and hand the stream off to it. -type MultistreamMuxer struct { - handlerlock sync.RWMutex - handlers []Handler -} - -// NewMultistreamMuxer creates a muxer. -func NewMultistreamMuxer() *MultistreamMuxer { - return new(MultistreamMuxer) -} - -func writeUvarint(w io.Writer, i uint64) error { - varintbuf := make([]byte, 16) - n := binary.PutUvarint(varintbuf, i) - _, err := w.Write(varintbuf[:n]) - if err != nil { - return err - } - return nil -} - -func delimWriteBuffered(w io.Writer, mes []byte) error { - bw := getWriter(w) - defer putWriter(bw) - - err := delimWrite(bw, mes) - if err != nil { - return err - } - - return bw.Flush() -} - -func delimWrite(w io.Writer, mes []byte) error { - err := writeUvarint(w, uint64(len(mes)+1)) - if err != nil { - return err - } - - _, err = w.Write(mes) - if err != nil { - return err - } - - _, err = w.Write([]byte{'\n'}) - if err != nil { - return err - } - return nil -} - -// Ls is a Multistream muxer command which returns the list of handler names -// available on a muxer. -func Ls(rw io.ReadWriter) ([]string, error) { - err := delimWriteBuffered(rw, []byte("ls")) - if err != nil { - return nil, err - } - - n, err := binary.ReadUvarint(&byteReader{rw}) - if err != nil { - return nil, err - } - - var out []string - for i := uint64(0); i < n; i++ { - val, err := lpReadBuf(rw) - if err != nil { - return nil, err - } - out = append(out, string(val)) - } - - return out, nil -} - -func fulltextMatch(s string) func(string) bool { - return func(a string) bool { - return a == s - } -} - -// AddHandler attaches a new protocol handler to the muxer. -func (msm *MultistreamMuxer) AddHandler(protocol string, handler HandlerFunc) { - msm.AddHandlerWithFunc(protocol, fulltextMatch(protocol), handler) -} - -// AddHandlerWithFunc attaches a new protocol handler to the muxer with a match. -// If the match function returns true for a given protocol tag, the protocol -// will be selected even if the handler name and protocol tags are different. -func (msm *MultistreamMuxer) AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc) { - msm.handlerlock.Lock() - defer msm.handlerlock.Unlock() - - msm.removeHandler(protocol) - msm.handlers = append(msm.handlers, Handler{ - MatchFunc: match, - Handle: handler, - AddName: protocol, - }) -} - -// RemoveHandler removes the handler with the given name from the muxer. -func (msm *MultistreamMuxer) RemoveHandler(protocol string) { - msm.handlerlock.Lock() - defer msm.handlerlock.Unlock() - - msm.removeHandler(protocol) -} - -func (msm *MultistreamMuxer) removeHandler(protocol string) { - for i, h := range msm.handlers { - if h.AddName == protocol { - msm.handlers = append(msm.handlers[:i], msm.handlers[i+1:]...) - return - } - } -} - -// Protocols returns the list of handler-names added to this this muxer. -func (msm *MultistreamMuxer) Protocols() []string { - msm.handlerlock.RLock() - defer msm.handlerlock.RUnlock() - - var out []string - for _, h := range msm.handlers { - out = append(out, h.AddName) - } - - return out -} - -// ErrIncorrectVersion is an error reported when the muxer protocol negotiation -// fails because of a ProtocolID mismatch. -var ErrIncorrectVersion = errors.New("client connected with incorrect version") - -func (msm *MultistreamMuxer) findHandler(proto string) *Handler { - msm.handlerlock.RLock() - defer msm.handlerlock.RUnlock() - - for _, h := range msm.handlers { - if h.MatchFunc(proto) { - return &h - } - } - - return nil -} - -// NegotiateLazy performs protocol selection and returns -// a multistream, the protocol used, the handler and an error. It is lazy -// because the write-handshake is performed on a subroutine, allowing this -// to return before that handshake is completed. -func (msm *MultistreamMuxer) NegotiateLazy(rwc io.ReadWriteCloser) (io.ReadWriteCloser, string, HandlerFunc, error) { - pval := make(chan string, 1) - writeErr := make(chan error, 1) - defer close(pval) - - lzc := &lazyServerConn{ - con: rwc, - } - - started := make(chan struct{}) - go lzc.waitForHandshake.Do(func() { - close(started) - - defer close(writeErr) - - if err := delimWriteBuffered(rwc, []byte(ProtocolID)); err != nil { - lzc.werr = err - writeErr <- err - return - } - - for proto := range pval { - if err := delimWriteBuffered(rwc, []byte(proto)); err != nil { - lzc.werr = err - writeErr <- err - return - } - } - }) - <-started - - line, err := ReadNextToken(rwc) - if err != nil { - return nil, "", nil, err - } - - if line != ProtocolID { - rwc.Close() - return nil, "", nil, ErrIncorrectVersion - } - -loop: - for { - // Now read and respond to commands until they send a valid protocol id - tok, err := ReadNextToken(rwc) - if err != nil { - rwc.Close() - return nil, "", nil, err - } - - switch tok { - case "ls": - select { - case pval <- "ls": - case err := <-writeErr: - rwc.Close() - return nil, "", nil, err - } - default: - h := msm.findHandler(tok) - if h == nil { - select { - case pval <- "na": - case err := <-writeErr: - rwc.Close() - return nil, "", nil, err - } - continue loop - } - - select { - case pval <- tok: - case <-writeErr: - // explicitly ignore this error. It will be returned to any - // writers and if we don't plan on writing anything, we still - // want to complete the handshake - } - - // hand off processing to the sub-protocol handler - return lzc, tok, h.Handle, nil - } - } -} - -// Negotiate performs protocol selection and returns the protocol name and -// the matching handler function for it (or an error). -func (msm *MultistreamMuxer) Negotiate(rwc io.ReadWriteCloser) (string, HandlerFunc, error) { - // Send our protocol ID - err := delimWriteBuffered(rwc, []byte(ProtocolID)) - if err != nil { - return "", nil, err - } - - line, err := ReadNextToken(rwc) - if err != nil { - return "", nil, err - } - - if line != ProtocolID { - rwc.Close() - return "", nil, ErrIncorrectVersion - } - -loop: - for { - // Now read and respond to commands until they send a valid protocol id - tok, err := ReadNextToken(rwc) - if err != nil { - return "", nil, err - } - - switch tok { - case "ls": - err := msm.Ls(rwc) - if err != nil { - return "", nil, err - } - default: - h := msm.findHandler(tok) - if h == nil { - err := delimWriteBuffered(rwc, []byte("na")) - if err != nil { - return "", nil, err - } - continue loop - } - - err := delimWriteBuffered(rwc, []byte(tok)) - if err != nil { - return "", nil, err - } - - // hand off processing to the sub-protocol handler - return tok, h.Handle, nil - } - } - -} - -// Ls implements the "ls" command which writes the list of -// supported protocols to the given Writer. -func (msm *MultistreamMuxer) Ls(w io.Writer) error { - buf := new(bytes.Buffer) - - msm.handlerlock.RLock() - err := writeUvarint(buf, uint64(len(msm.handlers))) - if err != nil { - return err - } - - for _, h := range msm.handlers { - err := delimWrite(buf, []byte(h.AddName)) - if err != nil { - msm.handlerlock.RUnlock() - return err - } - } - msm.handlerlock.RUnlock() - - ll := make([]byte, 16) - nw := binary.PutUvarint(ll, uint64(buf.Len())) - - r := io.MultiReader(bytes.NewReader(ll[:nw]), buf) - - _, err = io.Copy(w, r) - return err -} - -// Handle performs protocol negotiation on a ReadWriteCloser -// (i.e. a connection). It will find a matching handler for the -// incoming protocol and pass the ReadWriteCloser to it. -func (msm *MultistreamMuxer) Handle(rwc io.ReadWriteCloser) error { - p, h, err := msm.Negotiate(rwc) - if err != nil { - return err - } - return h(p, rwc) -} - -// ReadNextToken extracts a token from a ReadWriter. It is used during -// protocol negotiation and returns a string. -func ReadNextToken(rw io.ReadWriter) (string, error) { - tok, err := ReadNextTokenBytes(rw) - if err != nil { - return "", err - } - - return string(tok), nil -} - -// ReadNextTokenBytes extracts a token from a ReadWriter. It is used -// during protocol negotiation and returns a byte slice. -func ReadNextTokenBytes(rw io.ReadWriter) ([]byte, error) { - data, err := lpReadBuf(rw) - switch err { - case nil: - return data, nil - case ErrTooLarge: - err := delimWriteBuffered(rw, []byte("messages over 64k are not allowed")) - if err != nil { - return nil, err - } - return nil, ErrTooLarge - default: - return nil, err - } -} - -func lpReadBuf(r io.Reader) ([]byte, error) { - br, ok := r.(io.ByteReader) - if !ok { - br = &byteReader{r} - } - - length, err := binary.ReadUvarint(br) - if err != nil { - return nil, err - } - - if length > 64*1024 { - return nil, ErrTooLarge - } - - buf := make([]byte, length) - _, err = io.ReadFull(r, buf) - if err != nil { - return nil, err - } - - if len(buf) == 0 || buf[length-1] != '\n' { - return nil, errors.New("message did not have trailing newline") - } - - // slice off the trailing newline - buf = buf[:length-1] - - return buf, nil - -} - -// byteReader implements the ByteReader interface that ReadUVarint requires -type byteReader struct { - io.Reader -} - -func (br *byteReader) ReadByte() (byte, error) { - var b [1]byte - n, err := br.Read(b[:]) - if n == 1 { - return b[0], nil - } - if err == nil { - if n != 0 { - panic("read more bytes than buffer size") - } - err = io.ErrNoProgress - } - return 0, err -} - -func getWriter(w io.Writer) *bufio.Writer { - bw := writerPool.Get().(*bufio.Writer) - bw.Reset(w) - return bw -} - -func putWriter(bw *bufio.Writer) { - bw.Reset(nil) - writerPool.Put(bw) -} diff --git a/vendor/github.com/multiformats/go-multistream/multistream_fuzz.go b/vendor/github.com/multiformats/go-multistream/multistream_fuzz.go deleted file mode 100644 index 602bbb58..00000000 --- a/vendor/github.com/multiformats/go-multistream/multistream_fuzz.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build gofuzz - -package multistream - -import "bytes" - -type rwc struct { - *bytes.Reader -} - -func (*rwc) Write(b []byte) (int, error) { - return len(b), nil -} - -func (*rwc) Close() error { - return nil -} - -func Fuzz(b []byte) int { - readStream := bytes.NewReader(b) - input := &rwc{readStream} - - mux := NewMultistreamMuxer() - mux.AddHandler("/a", nil) - mux.AddHandler("/b", nil) - _ = mux.Handle(input) - return 1 -} diff --git a/vendor/github.com/multiformats/go-multistream/package.json b/vendor/github.com/multiformats/go-multistream/package.json deleted file mode 100644 index c5001ef4..00000000 --- a/vendor/github.com/multiformats/go-multistream/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/multiformats/go-multistream" - }, - "gx": { - "dvcsimport": "github.com/multiformats/go-multistream" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "", - "name": "go-multistream", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.3.9" -} - diff --git a/vendor/github.com/onsi/ginkgo/.gitignore b/vendor/github.com/onsi/ginkgo/.gitignore index b9f9659d..18793c24 100644 --- a/vendor/github.com/onsi/ginkgo/.gitignore +++ b/vendor/github.com/onsi/ginkgo/.gitignore @@ -4,4 +4,4 @@ tmp/**/* *.coverprofile .vscode .idea/ -*.log +*.log \ No newline at end of file diff --git a/vendor/github.com/onsi/ginkgo/.travis.yml b/vendor/github.com/onsi/ginkgo/.travis.yml index 72e8ccf0..7ad39b78 100644 --- a/vendor/github.com/onsi/ginkgo/.travis.yml +++ b/vendor/github.com/onsi/ginkgo/.travis.yml @@ -1,9 +1,10 @@ language: go go: + - 1.6.x + - 1.7.x + - 1.8.x + - 1.9.x - 1.10.x - - 1.11.x - - 1.12.x - - tip install: - go get -v -t ./... @@ -12,4 +13,4 @@ install: - go install github.com/onsi/ginkgo/ginkgo - export PATH=$PATH:$HOME/gopath/bin -script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet +script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --race --trace && go vet diff --git a/vendor/github.com/onsi/ginkgo/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/CHANGELOG.md index 4920406a..32370206 100644 --- a/vendor/github.com/onsi/ginkgo/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/CHANGELOG.md @@ -1,23 +1,3 @@ -## 1.8.0 - -### New Features -- allow config of the vet flag for `go test` (#562) [3cd45fa] -- Support projects using go modules [d56ee76] - -### Fixes and Minor Improvements -- chore(godoc): fixes typos in Measurement funcs [dbaca8e] -- Optimize focus to avoid allocations [f493786] -- Ensure generated test file names are underscored [505cc35] - -## 1.7.0 - -### New Features -- Add JustAfterEach (#484) [0d4f080] - -### Fixes -- Correctly round suite time in junit reporter [2445fc1] -- Avoid using -i argument to go test for Golang 1.10+ [46bbc26] - ## 1.6.0 ### New Features diff --git a/vendor/github.com/onsi/ginkgo/config/config.go b/vendor/github.com/onsi/ginkgo/config/config.go index dab2a247..d4ed1fa5 100644 --- a/vendor/github.com/onsi/ginkgo/config/config.go +++ b/vendor/github.com/onsi/ginkgo/config/config.go @@ -20,7 +20,7 @@ import ( "fmt" ) -const VERSION = "1.8.0" +const VERSION = "1.6.0" type GinkgoConfigType struct { RandomSeed int64 diff --git a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index a6b96d88..158acdd5 100644 --- a/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -457,13 +457,13 @@ func FMeasure(text string, body interface{}, samples int) bool { return true } -//You can mark Measurements as pending using PMeasure +//You can mark Maeasurements as pending using PMeasure func PMeasure(text string, _ ...interface{}) bool { globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//You can mark Measurements as pending using XMeasure +//You can mark Maeasurements as pending using XMeasure func XMeasure(text string, _ ...interface{}) bool { globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true @@ -590,16 +590,6 @@ func JustBeforeEach(body interface{}, timeout ...float64) bool { return true } -//JustAfterEach blocks are run after It blocks but *before* all AfterEach blocks. For more details, -//read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) -// -//Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts -//a Done channel -func JustAfterEach(body interface{}, timeout ...float64) bool { - globalSuite.PushJustAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) - return true -} - //AfterEach blocks are run after It blocks. When multiple AfterEach blocks are defined in nested //Describe and Context blocks the innermost AfterEach blocks are run first. // diff --git a/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go b/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go index e3e9cb7c..b4654cd2 100644 --- a/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go +++ b/vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go @@ -40,9 +40,3 @@ func NewJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, ti runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustBeforeEach, componentIndex), } } - -func NewJustAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { - return &SetupNode{ - runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustAfterEach, componentIndex), - } -} diff --git a/vendor/github.com/onsi/ginkgo/internal/spec/spec.go b/vendor/github.com/onsi/ginkgo/internal/spec/spec.go index 7fd68ee8..77b23a4c 100644 --- a/vendor/github.com/onsi/ginkgo/internal/spec/spec.go +++ b/vendor/github.com/onsi/ginkgo/internal/spec/spec.go @@ -161,18 +161,6 @@ func (spec *Spec) runSample(sample int, writer io.Writer) { innerMostContainerIndexToUnwind := -1 defer func() { - for i := innerMostContainerIndexToUnwind; i >= 0; i-- { - container := spec.containers[i] - for _, justAfterEach := range container.SetupNodesOfType(types.SpecComponentTypeJustAfterEach) { - spec.announceSetupNode(writer, "JustAfterEach", container, justAfterEach) - justAfterEachState, justAfterEachFailure := justAfterEach.Run() - if justAfterEachState != types.SpecStatePassed && spec.state == types.SpecStatePassed { - spec.state = justAfterEachState - spec.failure = justAfterEachFailure - } - } - } - for i := innerMostContainerIndexToUnwind; i >= 0; i-- { container := spec.containers[i] for _, afterEach := range container.SetupNodesOfType(types.SpecComponentTypeAfterEach) { diff --git a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go index 27c0d1d6..006185ab 100644 --- a/vendor/github.com/onsi/ginkgo/internal/spec/specs.go +++ b/vendor/github.com/onsi/ginkgo/internal/spec/specs.go @@ -7,21 +7,14 @@ import ( ) type Specs struct { - specs []*Spec - names []string - + specs []*Spec hasProgrammaticFocus bool RegexScansFilePath bool } func NewSpecs(specs []*Spec) *Specs { - names := make([]string, len(specs)) - for i, spec := range specs { - names[i] = spec.ConcatenatedString() - } return &Specs{ specs: specs, - names: names, } } @@ -37,13 +30,10 @@ func (e *Specs) Shuffle(r *rand.Rand) { sort.Sort(e) permutation := r.Perm(len(e.specs)) shuffledSpecs := make([]*Spec, len(e.specs)) - names := make([]string, len(e.specs)) for i, j := range permutation { shuffledSpecs[i] = e.specs[j] - names[i] = e.names[j] } e.specs = shuffledSpecs - e.names = names } func (e *Specs) ApplyFocus(description string, focusString string, skipString string) { @@ -74,43 +64,33 @@ func (e *Specs) applyProgrammaticFocus() { // toMatch returns a byte[] to be used by regex matchers. When adding new behaviours to the matching function, // this is the place which we append to. -func (e *Specs) toMatch(description string, i int) []byte { - if i > len(e.names) { - return nil - } +func (e *Specs) toMatch(description string, spec *Spec) []byte { if e.RegexScansFilePath { return []byte( description + " " + - e.names[i] + " " + - e.specs[i].subject.CodeLocation().FileName) + spec.ConcatenatedString() + " " + + spec.subject.CodeLocation().FileName) } else { return []byte( description + " " + - e.names[i]) + spec.ConcatenatedString()) } } func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string, skipString string) { - var focusFilter *regexp.Regexp - if focusString != "" { - focusFilter = regexp.MustCompile(focusString) - } - var skipFilter *regexp.Regexp - if skipString != "" { - skipFilter = regexp.MustCompile(skipString) - } - - for i, spec := range e.specs { + for _, spec := range e.specs { matchesFocus := true matchesSkip := false - toMatch := e.toMatch(description, i) + toMatch := e.toMatch(description, spec) - if focusFilter != nil { + if focusString != "" { + focusFilter := regexp.MustCompile(focusString) matchesFocus = focusFilter.Match([]byte(toMatch)) } - if skipFilter != nil { + if skipString != "" { + skipFilter := regexp.MustCompile(skipString) matchesSkip = skipFilter.Match([]byte(toMatch)) } @@ -135,10 +115,9 @@ func (e *Specs) Len() int { } func (e *Specs) Less(i, j int) bool { - return e.names[i] < e.names[j] + return e.specs[i].ConcatenatedString() < e.specs[j].ConcatenatedString() } func (e *Specs) Swap(i, j int) { - e.names[i], e.names[j] = e.names[j], e.names[i] e.specs[i], e.specs[j] = e.specs[j], e.specs[i] } diff --git a/vendor/github.com/onsi/ginkgo/internal/suite/suite.go b/vendor/github.com/onsi/ginkgo/internal/suite/suite.go index 3104bbc8..f311e9a0 100644 --- a/vendor/github.com/onsi/ginkgo/internal/suite/suite.go +++ b/vendor/github.com/onsi/ginkgo/internal/suite/suite.go @@ -175,13 +175,6 @@ func (suite *Suite) PushJustBeforeEachNode(body interface{}, codeLocation types. suite.currentContainer.PushSetupNode(leafnodes.NewJustBeforeEachNode(body, codeLocation, timeout, suite.failer, suite.containerIndex)) } -func (suite *Suite) PushJustAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { - if suite.running { - suite.failer.Fail("You may only call JustAfterEach from within a Describe or Context", codeLocation) - } - suite.currentContainer.PushSetupNode(leafnodes.NewJustAfterEachNode(body, codeLocation, timeout, suite.failer, suite.containerIndex)) -} - func (suite *Suite) PushAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration) { if suite.running { suite.failer.Fail("You may only call AfterEach from within a Describe, Context or When", codeLocation) diff --git a/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go b/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go index 2c9f3c79..65b8964e 100644 --- a/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go +++ b/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go @@ -121,7 +121,7 @@ func (reporter *JUnitReporter) SpecDidComplete(specSummary *types.SpecSummary) { func (reporter *JUnitReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { reporter.suite.Tests = summary.NumberOfSpecsThatWillBeRun - reporter.suite.Time = math.Trunc(summary.RunTime.Seconds()*1000) / 1000 + reporter.suite.Time = math.Trunc(summary.RunTime.Seconds() * 1000 / 1000) reporter.suite.Failures = summary.NumberOfFailedSpecs reporter.suite.Errors = 0 file, err := os.Create(reporter.filename) diff --git a/vendor/github.com/onsi/ginkgo/types/types.go b/vendor/github.com/onsi/ginkgo/types/types.go index 0e89521b..baf1bd1c 100644 --- a/vendor/github.com/onsi/ginkgo/types/types.go +++ b/vendor/github.com/onsi/ginkgo/types/types.go @@ -159,7 +159,6 @@ const ( SpecComponentTypeAfterSuite SpecComponentTypeBeforeEach SpecComponentTypeJustBeforeEach - SpecComponentTypeJustAfterEach SpecComponentTypeAfterEach SpecComponentTypeIt SpecComponentTypeMeasure diff --git a/vendor/github.com/onsi/gomega/.travis.yml b/vendor/github.com/onsi/gomega/.travis.yml index 2420a5d0..783fb3b4 100644 --- a/vendor/github.com/onsi/gomega/.travis.yml +++ b/vendor/github.com/onsi/gomega/.travis.yml @@ -1,17 +1,16 @@ language: go - go: + - 1.6.x + - 1.7.x + - 1.8.x + - 1.9.x - 1.10.x - 1.11.x - - 1.12.x - -env: - - GO111MODULE=on install: - - go get -v ./... - - go build ./... + - env GO111MODULE=on go get -v ./... + - env GO111MODULE=on go build ./... - go get github.com/onsi/ginkgo - go install github.com/onsi/ginkgo/ginkgo -script: make test +script: env GO111MODULE=on $HOME/gopath/bin/ginkgo -p -r --randomizeAllSpecs --failOnPending --randomizeSuites --race && env GO111MODULE=on go vet diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 5d1eda83..f2aaea4e 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,21 +1,3 @@ -## 1.5.0 - -### Features - -- Added MatchKeys matchers [8b909fc] - -### Fixes and Minor Improvements - -- Add type aliases to remove stuttering [03b0461] -- Don't run session_test.go on windows (#324) [5533ce8] - -## 1.4.3 - -### Fixes: - -- ensure file name and line numbers are correctly reported for XUnit [6fff58f] -- Fixed matcher for content-type (#305) [69d9b43] - ## 1.4.2 ### Fixes: diff --git a/vendor/github.com/onsi/gomega/Makefile b/vendor/github.com/onsi/gomega/Makefile deleted file mode 100644 index c92cd56e..00000000 --- a/vendor/github.com/onsi/gomega/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -test: - [ -z "`gofmt -s -w -l -e .`" ] - go vet - ginkgo -p -r --randomizeAllSpecs --failOnPending --randomizeSuites --race - -.PHONY: test diff --git a/vendor/github.com/onsi/gomega/ghttp/handlers.go b/vendor/github.com/onsi/gomega/ghttp/handlers.go index 894eae6d..82bc1412 100644 --- a/vendor/github.com/onsi/gomega/ghttp/handlers.go +++ b/vendor/github.com/onsi/gomega/ghttp/handlers.go @@ -8,7 +8,6 @@ import ( "net/http" "net/url" "reflect" - "strings" "github.com/golang/protobuf/proto" . "github.com/onsi/gomega" @@ -56,14 +55,6 @@ func VerifyContentType(contentType string) http.HandlerFunc { } } -//VerifyMimeType returns a handler that verifies that a request has a specified mime type set -//in Content-Type header -func VerifyMimeType(mimeType string) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - Expect(strings.Split(req.Header.Get("Content-Type"), ";")[0]).Should(Equal(mimeType)) - } -} - //VerifyBasicAuth returns a handler that verifies the request contains a BasicAuth Authorization header //matching the passed in username and password func VerifyBasicAuth(username string, password string) http.HandlerFunc { @@ -118,7 +109,7 @@ func VerifyBody(expectedBody []byte) http.HandlerFunc { //VerifyJSON also verifies that the request's content type is application/json func VerifyJSON(expectedJSON string) http.HandlerFunc { return CombineHandlers( - VerifyMimeType("application/json"), + VerifyContentType("application/json"), func(w http.ResponseWriter, req *http.Request) { body, err := ioutil.ReadAll(req.Body) req.Body.Close() diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 448d595d..51d7872f 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -24,7 +24,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.5.0" +const GOMEGA_VERSION = "1.4.2" const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil. If you're using Ginkgo then you probably forgot to put your assertion in an It(). @@ -39,32 +39,25 @@ var defaultEventuallyPollingInterval = 10 * time.Millisecond var defaultConsistentlyDuration = 100 * time.Millisecond var defaultConsistentlyPollingInterval = 10 * time.Millisecond -// RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails -// the fail handler passed into RegisterFailHandler is called. +//RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails +//the fail handler passed into RegisterFailHandler is called. func RegisterFailHandler(handler types.GomegaFailHandler) { - RegisterFailHandlerWithT(testingtsupport.EmptyTWithHelper{}, handler) -} - -// RegisterFailHandlerWithT ensures that the given types.TWithHelper and fail handler -// are used globally. -func RegisterFailHandlerWithT(t types.TWithHelper, handler types.GomegaFailHandler) { if handler == nil { globalFailWrapper = nil return } - globalFailWrapper = &types.GomegaFailWrapper{ Fail: handler, - TWithHelper: t, + TWithHelper: testingtsupport.EmptyTWithHelper{}, } } -// RegisterTestingT connects Gomega to Golang's XUnit style -// Testing.T tests. It is now deprecated and you should use NewWithT() instead. +//RegisterTestingT connects Gomega to Golang's XUnit style +//Testing.T tests. It is now deprecated and you should use NewGomegaWithT() instead. // -// Legacy Documentation: +//Legacy Documentation: // -// You'll need to call this at the top of each XUnit style test: +//You'll need to call this at the top of each XUnit style test: // // func TestFarmHasCow(t *testing.T) { // RegisterTestingT(t) @@ -77,27 +70,22 @@ func RegisterFailHandlerWithT(t types.TWithHelper, handler types.GomegaFailHandl // pass `t` down to the matcher itself). This means that you cannot run the XUnit style tests // in parallel as the global fail handler cannot point to more than one testing.T at a time. // -// NewWithT() does not have this limitation +// NewGomegaWithT() does not have this limitation // // (As an aside: Ginkgo gets around this limitation by running parallel tests in different *processes*). func RegisterTestingT(t types.GomegaTestingT) { - tWithHelper, hasHelper := t.(types.TWithHelper) - if !hasHelper { - RegisterFailHandler(testingtsupport.BuildTestingTGomegaFailWrapper(t).Fail) - return - } - RegisterFailHandlerWithT(tWithHelper, testingtsupport.BuildTestingTGomegaFailWrapper(t).Fail) + RegisterFailHandler(testingtsupport.BuildTestingTGomegaFailWrapper(t).Fail) } -// InterceptGomegaFailures runs a given callback and returns an array of -// failure messages generated by any Gomega assertions within the callback. +//InterceptGomegaHandlers runs a given callback and returns an array of +//failure messages generated by any Gomega assertions within the callback. // -// This is accomplished by temporarily replacing the *global* fail handler -// with a fail handler that simply annotates failures. The original fail handler -// is reset when InterceptGomegaFailures returns. +//This is accomplished by temporarily replacing the *global* fail handler +//with a fail handler that simply annotates failures. The original fail handler +//is reset when InterceptGomegaFailures returns. // -// This is most useful when testing custom matchers, but can also be used to check -// on a value using a Gomega assertion without causing a test failure. +//This is most useful when testing custom matchers, but can also be used to check +//on a value using a Gomega assertion without causing a test failure. func InterceptGomegaFailures(f func()) []string { originalHandler := globalFailWrapper.Fail failures := []string{} @@ -109,108 +97,108 @@ func InterceptGomegaFailures(f func()) []string { return failures } -// Ω wraps an actual value allowing assertions to be made on it: +//Ω wraps an actual value allowing assertions to be made on it: // Ω("foo").Should(Equal("foo")) // -// If Ω is passed more than one argument it will pass the *first* argument to the matcher. -// All subsequent arguments will be required to be nil/zero. +//If Ω is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. // -// This is convenient if you want to make an assertion on a method/function that returns -// a value and an error - a common patter in Go. +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. // -// For example, given a function with signature: -// func MyAmazingThing() (int, error) +//For example, given a function with signature: +// func MyAmazingThing() (int, error) // -// Then: +//Then: // Ω(MyAmazingThing()).Should(Equal(3)) -// Will succeed only if `MyAmazingThing()` returns `(3, nil)` +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` // -// Ω and Expect are identical -func Ω(actual interface{}, extra ...interface{}) Assertion { +//Ω and Expect are identical +func Ω(actual interface{}, extra ...interface{}) GomegaAssertion { return ExpectWithOffset(0, actual, extra...) } -// Expect wraps an actual value allowing assertions to be made on it: +//Expect wraps an actual value allowing assertions to be made on it: // Expect("foo").To(Equal("foo")) // -// If Expect is passed more than one argument it will pass the *first* argument to the matcher. -// All subsequent arguments will be required to be nil/zero. +//If Expect is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. // -// This is convenient if you want to make an assertion on a method/function that returns -// a value and an error - a common patter in Go. +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. // -// For example, given a function with signature: -// func MyAmazingThing() (int, error) +//For example, given a function with signature: +// func MyAmazingThing() (int, error) // -// Then: +//Then: // Expect(MyAmazingThing()).Should(Equal(3)) -// Will succeed only if `MyAmazingThing()` returns `(3, nil)` +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` // -// Expect and Ω are identical -func Expect(actual interface{}, extra ...interface{}) Assertion { +//Expect and Ω are identical +func Expect(actual interface{}, extra ...interface{}) GomegaAssertion { return ExpectWithOffset(0, actual, extra...) } -// ExpectWithOffset wraps an actual value allowing assertions to be made on it: +//ExpectWithOffset wraps an actual value allowing assertions to be made on it: // ExpectWithOffset(1, "foo").To(Equal("foo")) // -// Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument -// this is used to modify the call-stack offset when computing line numbers. +//Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument +//this is used to modify the call-stack offset when computing line numbers. // -// This is most useful in helper functions that make assertions. If you want Gomega's -// error message to refer to the calling line in the test (as opposed to the line in the helper function) -// set the first argument of `ExpectWithOffset` appropriately. -func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) Assertion { +//This is most useful in helper functions that make assertions. If you want Gomega's +//error message to refer to the calling line in the test (as opposed to the line in the helper function) +//set the first argument of `ExpectWithOffset` appropriately. +func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) GomegaAssertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } return assertion.New(actual, globalFailWrapper, offset, extra...) } -// Eventually wraps an actual value allowing assertions to be made on it. -// The assertion is tried periodically until it passes or a timeout occurs. +//Eventually wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically until it passes or a timeout occurs. // -// Both the timeout and polling interval are configurable as optional arguments: -// The first optional argument is the timeout -// The second optional argument is the polling interval +//Both the timeout and polling interval are configurable as optional arguments: +//The first optional argument is the timeout +//The second optional argument is the polling interval // -// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -// last case they are interpreted as seconds. +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. // -// If Eventually is passed an actual that is a function taking no arguments and returning at least one value, -// then Eventually will call the function periodically and try the matcher against the function's first return value. +//If Eventually is passed an actual that is a function taking no arguments and returning at least one value, +//then Eventually will call the function periodically and try the matcher against the function's first return value. // -// Example: +//Example: // // Eventually(func() int { // return thingImPolling.Count() // }).Should(BeNumerically(">=", 17)) // -// Note that this example could be rewritten: +//Note that this example could be rewritten: // // Eventually(thingImPolling.Count).Should(BeNumerically(">=", 17)) // -// If the function returns more than one value, then Eventually will pass the first value to the matcher and -// assert that all other values are nil/zero. -// This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. +//If the function returns more than one value, then Eventually will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. // -// For example, consider a method that returns a value and an error: +//For example, consider a method that returns a value and an error: // func FetchFromDB() (string, error) // -// Then +//Then // Eventually(FetchFromDB).Should(Equal("hasselhoff")) // -// Will pass only if the the returned error is nil and the returned string passes the matcher. +//Will pass only if the the returned error is nil and the returned string passes the matcher. // -// Eventually's default timeout is 1 second, and its default polling interval is 10ms -func Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { +//Eventually's default timeout is 1 second, and its default polling interval is 10ms +func Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { return EventuallyWithOffset(0, actual, intervals...) } -// EventuallyWithOffset operates like Eventually but takes an additional -// initial argument to indicate an offset in the call stack. This is useful when building helper -// functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { +//EventuallyWithOffset operates like Eventually but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } @@ -225,37 +213,37 @@ func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, globalFailWrapper, timeoutInterval, pollingInterval, offset) } -// Consistently wraps an actual value allowing assertions to be made on it. -// The assertion is tried periodically and is required to pass for a period of time. +//Consistently wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically and is required to pass for a period of time. // -// Both the total time and polling interval are configurable as optional arguments: -// The first optional argument is the duration that Consistently will run for -// The second optional argument is the polling interval +//Both the total time and polling interval are configurable as optional arguments: +//The first optional argument is the duration that Consistently will run for +//The second optional argument is the polling interval // -// Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -// last case they are interpreted as seconds. +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. // -// If Consistently is passed an actual that is a function taking no arguments and returning at least one value, -// then Consistently will call the function periodically and try the matcher against the function's first return value. +//If Consistently is passed an actual that is a function taking no arguments and returning at least one value, +//then Consistently will call the function periodically and try the matcher against the function's first return value. // -// If the function returns more than one value, then Consistently will pass the first value to the matcher and -// assert that all other values are nil/zero. -// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. +//If the function returns more than one value, then Consistently will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. // -// Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. -// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: +//Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. +//For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: // -// Consistently(channel).ShouldNot(Receive()) +// Consistently(channel).ShouldNot(Receive()) // -// Consistently's default duration is 100ms, and its default polling interval is 10ms -func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { +//Consistently's default duration is 100ms, and its default polling interval is 10ms +func Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { return ConsistentlyWithOffset(0, actual, intervals...) } -// ConsistentlyWithOffset operates like Consistnetly but takes an additional -// initial argument to indicate an offset in the call stack. This is useful when building helper -// functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion { +//ConsistentlyWithOffset operates like Consistnetly but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { if globalFailWrapper == nil { panic(nilFailHandlerPanic) } @@ -270,62 +258,59 @@ func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interfa return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, globalFailWrapper, timeoutInterval, pollingInterval, offset) } -// SetDefaultEventuallyTimeout sets the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. +//Set the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. func SetDefaultEventuallyTimeout(t time.Duration) { defaultEventuallyTimeout = t } -// SetDefaultEventuallyPollingInterval sets the default polling interval for Eventually. +//Set the default polling interval for Eventually. func SetDefaultEventuallyPollingInterval(t time.Duration) { defaultEventuallyPollingInterval = t } -// SetDefaultConsistentlyDuration sets the default duration for Consistently. Consistently will verify that your condition is satsified for this long. +//Set the default duration for Consistently. Consistently will verify that your condition is satsified for this long. func SetDefaultConsistentlyDuration(t time.Duration) { defaultConsistentlyDuration = t } -// SetDefaultConsistentlyPollingInterval sets the default polling interval for Consistently. +//Set the default polling interval for Consistently. func SetDefaultConsistentlyPollingInterval(t time.Duration) { defaultConsistentlyPollingInterval = t } -// AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against -// the matcher passed to the Should and ShouldNot methods. +//GomegaAsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against +//the matcher passed to the Should and ShouldNot methods. // -// Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to -// fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more -// descriptive. +//Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to +//fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more +//descriptive // -// Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. +//Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. // -// Example: +//Example: // -// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") -// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") -type AsyncAssertion interface { +// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") +// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") +type GomegaAsyncAssertion interface { Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool } -// GomegaAsyncAssertion is deprecated in favor of AsyncAssertion, which does not stutter. -type GomegaAsyncAssertion = AsyncAssertion - -// Assertion is returned by Ω and Expect and compares the actual value to the matcher -// passed to the Should/ShouldNot and To/ToNot/NotTo methods. +//GomegaAssertion is returned by Ω and Expect and compares the actual value to the matcher +//passed to the Should/ShouldNot and To/ToNot/NotTo methods. // -// Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect -// though this is not enforced. +//Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect +//though this is not enforced. // -// All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() -// and is used to annotate failure messages. +//All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() +//and is used to annotate failure messages. // -// All methods return a bool that is true if hte assertion passed and false if it failed. +//All methods return a bool that is true if hte assertion passed and false if it failed. // -// Example: +//Example: // -// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) -type Assertion interface { +// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) +type GomegaAssertion interface { Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool @@ -334,50 +319,39 @@ type Assertion interface { NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool } -// GomegaAssertion is deprecated in favor of Assertion, which does not stutter. -type GomegaAssertion = Assertion - -// OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it +//OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it type OmegaMatcher types.GomegaMatcher -// WithT wraps a *testing.T and provides `Expect`, `Eventually`, and `Consistently` methods. This allows you to leverage -// Gomega's rich ecosystem of matchers in standard `testing` test suites. +//GomegaWithT wraps a *testing.T and provides `Expect`, `Eventually`, and `Consistently` methods. This allows you to leverage +//Gomega's rich ecosystem of matchers in standard `testing` test suites. // -// Use `NewWithT` to instantiate a `WithT` -type WithT struct { +//Use `NewGomegaWithT` to instantiate a `GomegaWithT` +type GomegaWithT struct { t types.GomegaTestingT } -// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter. -type GomegaWithT = WithT - -// NewWithT takes a *testing.T and returngs a `gomega.WithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with -// Gomega's rich ecosystem of matchers in standard `testing` test suits. +//NewGomegaWithT takes a *testing.T and returngs a `GomegaWithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with +//Gomega's rich ecosystem of matchers in standard `testing` test suits. // // func TestFarmHasCow(t *testing.T) { -// g := gomega.NewWithT(t) +// g := GomegaWithT(t) // // f := farm.New([]string{"Cow", "Horse"}) // g.Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") // } -func NewWithT(t types.GomegaTestingT) *WithT { - return &WithT{ +func NewGomegaWithT(t types.GomegaTestingT) *GomegaWithT { + return &GomegaWithT{ t: t, } } -// NewGomegaWithT is deprecated in favor of gomega.NewWithT, which does not stutter. -func NewGomegaWithT(t types.GomegaTestingT) *GomegaWithT { - return NewWithT(t) -} - -// Expect is used to make assertions. See documentation for Expect. -func (g *WithT) Expect(actual interface{}, extra ...interface{}) Assertion { +//See documentation for Expect +func (g *GomegaWithT) Expect(actual interface{}, extra ...interface{}) GomegaAssertion { return assertion.New(actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), 0, extra...) } -// Eventually is used to make asynchronous assertions. See documentation for Eventually. -func (g *WithT) Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion { +//See documentation for Eventually +func (g *GomegaWithT) Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { timeoutInterval := defaultEventuallyTimeout pollingInterval := defaultEventuallyPollingInterval if len(intervals) > 0 { @@ -389,8 +363,8 @@ func (g *WithT) Eventually(actual interface{}, intervals ...interface{}) AsyncAs return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, testingtsupport.BuildTestingTGomegaFailWrapper(g.t), timeoutInterval, pollingInterval, 0) } -// Consistently is used to make asynchronous assertions. See documentation for Consistently. -func (g *WithT) Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion { +//See documentation for Consistently +func (g *GomegaWithT) Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { timeoutInterval := defaultConsistentlyDuration pollingInterval := defaultConsistentlyPollingInterval if len(intervals) > 0 { diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go index 80c9c8bb..ed6f6928 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go @@ -23,8 +23,8 @@ func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err err } winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ - {Dir: reflect.SelectRecv, Chan: channelValue}, - {Dir: reflect.SelectDefault}, + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, }) var closed bool diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go index 302dd1a0..d7c32233 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go @@ -42,8 +42,8 @@ func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error }() winnerIndex, _, _ := reflect.Select([]reflect.SelectCase{ - {Dir: reflect.SelectSend, Chan: channelValue, Send: argValue}, - {Dir: reflect.SelectDefault}, + reflect.SelectCase{Dir: reflect.SelectSend, Chan: channelValue, Send: argValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, }) var didSend bool diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go index bef00ae2..ebdd7178 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -29,5 +29,5 @@ func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message } func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred") + return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") } diff --git a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go index 5c815f5a..3b412ce8 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher.go @@ -70,7 +70,7 @@ func parseXmlContent(content string) (*xmlNode, error) { if err == io.EOF { break } - return nil, fmt.Errorf("failed to decode next token: %v", err) // untested section + return nil, fmt.Errorf("failed to decode next token: %v", err) } lastNodeIndex := len(allNodes) - 1 @@ -94,7 +94,7 @@ func parseXmlContent(content string) (*xmlNode, error) { case xml.CharData: lastNode.Content = append(lastNode.Content, tok.Copy()...) case xml.Comment: - lastNode.Comments = append(lastNode.Comments, tok.Copy()) // untested section + lastNode.Comments = append(lastNode.Comments, tok.Copy()) case xml.ProcInst: lastNode.ProcInsts = append(lastNode.ProcInsts, tok.Copy()) } diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go index 0c83c2b6..070d6026 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go @@ -53,11 +53,11 @@ func normalise(input string) string { var val interface{} err := yaml.Unmarshal([]byte(input), &val) if err != nil { - panic(err) // unreachable since Match already calls Unmarshal + panic(err) // guarded by Match } output, err := yaml.Marshal(val) if err != nil { - panic(err) // untested section, unreachable since we Unmarshal above + panic(err) // guarded by Unmarshal } return strings.TrimSpace(string(output)) } diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go index 2018a612..fc179916 100644 --- a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go @@ -39,8 +39,8 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro } winnerIndex, value, open := reflect.Select([]reflect.SelectCase{ - {Dir: reflect.SelectRecv, Chan: channelValue}, - {Dir: reflect.SelectDefault}, + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, }) var closed bool diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go index 8aaf8759..81b37711 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go @@ -14,12 +14,12 @@ type BipartiteGraph struct { func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { left := NodeOrderedSet{} - for i := range leftValues { + for i, _ := range leftValues { left = append(left, Node{Id: i}) } right := NodeOrderedSet{} - for j := range rightValues { + for j, _ := range rightValues { right = append(right, Node{Id: j + len(left)}) } diff --git a/vendor/github.com/opentracing/opentracing-go/.gitignore b/vendor/github.com/opentracing/opentracing-go/.gitignore deleted file mode 100644 index c57100a5..00000000 --- a/vendor/github.com/opentracing/opentracing-go/.gitignore +++ /dev/null @@ -1 +0,0 @@ -coverage.txt diff --git a/vendor/github.com/opentracing/opentracing-go/.travis.yml b/vendor/github.com/opentracing/opentracing-go/.travis.yml deleted file mode 100644 index 8d5b75e4..00000000 --- a/vendor/github.com/opentracing/opentracing-go/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go - -matrix: - include: - - go: "1.11.x" - - go: "1.12.x" - - go: "tip" - env: - - LINT=true - - COVERAGE=true - -install: - - if [ "$LINT" == true ]; then go get -u golang.org/x/lint/golint/... ; else echo 'skipping lint'; fi - - go get -u github.com/stretchr/testify/... - -script: - - make test - - go build ./... - - if [ "$LINT" == true ]; then make lint ; else echo 'skipping lint'; fi - - if [ "$COVERAGE" == true ]; then make cover && bash <(curl -s https://codecov.io/bash) ; else echo 'skipping coverage'; fi diff --git a/vendor/github.com/opentracing/opentracing-go/CHANGELOG.md b/vendor/github.com/opentracing/opentracing-go/CHANGELOG.md deleted file mode 100644 index 7c14febe..00000000 --- a/vendor/github.com/opentracing/opentracing-go/CHANGELOG.md +++ /dev/null @@ -1,46 +0,0 @@ -Changes by Version -================== - -1.1.0 (2019-03-23) -------------------- - -Notable changes: -- The library is now released under Apache 2.0 license -- Use Set() instead of Add() in HTTPHeadersCarrier is functionally a breaking change (fixes issue [#159](https://github.com/opentracing/opentracing-go/issues/159)) -- 'golang.org/x/net/context' is replaced with 'context' from the standard library - -List of all changes: - -- Export StartSpanFromContextWithTracer (#214) -- Add IsGlobalTracerRegistered() to indicate if a tracer has been registered (#201) -- Use Set() instead of Add() in HTTPHeadersCarrier (#191) -- Update license to Apache 2.0 (#181) -- Replace 'golang.org/x/net/context' with 'context' (#176) -- Port of Python opentracing/harness/api_check.py to Go (#146) -- Fix race condition in MockSpan.Context() (#170) -- Add PeerHostIPv4.SetString() (#155) -- Add a Noop log field type to log to allow for optional fields (#150) - - -1.0.2 (2017-04-26) -------------------- - -- Add more semantic tags (#139) - - -1.0.1 (2017-02-06) -------------------- - -- Correct spelling in comments -- Address race in nextMockID() (#123) -- log: avoid panic marshaling nil error (#131) -- Deprecate InitGlobalTracer in favor of SetGlobalTracer (#128) -- Drop Go 1.5 that fails in Travis (#129) -- Add convenience methods Key() and Value() to log.Field -- Add convenience methods to log.Field (2 years, 6 months ago) - -1.0.0 (2016-09-26) -------------------- - -- This release implements OpenTracing Specification 1.0 (https://opentracing.io/spec) - diff --git a/vendor/github.com/opentracing/opentracing-go/LICENSE b/vendor/github.com/opentracing/opentracing-go/LICENSE deleted file mode 100644 index f0027349..00000000 --- a/vendor/github.com/opentracing/opentracing-go/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016 The OpenTracing Authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/opentracing/opentracing-go/Makefile b/vendor/github.com/opentracing/opentracing-go/Makefile deleted file mode 100644 index 62abb63f..00000000 --- a/vendor/github.com/opentracing/opentracing-go/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -.DEFAULT_GOAL := test-and-lint - -.PHONY: test-and-lint -test-and-lint: test lint - -.PHONY: test -test: - go test -v -cover -race ./... - -.PHONY: cover -cover: - go test -v -coverprofile=coverage.txt -covermode=atomic -race ./... - -.PHONY: lint -lint: - go fmt ./... - golint ./... - @# Run again with magic to exit non-zero if golint outputs anything. - @! (golint ./... | read dummy) - go vet ./... diff --git a/vendor/github.com/opentracing/opentracing-go/README.md b/vendor/github.com/opentracing/opentracing-go/README.md deleted file mode 100644 index 6ef1d7c9..00000000 --- a/vendor/github.com/opentracing/opentracing-go/README.md +++ /dev/null @@ -1,171 +0,0 @@ -[![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/opentracing/public) [![Build Status](https://travis-ci.org/opentracing/opentracing-go.svg?branch=master)](https://travis-ci.org/opentracing/opentracing-go) [![GoDoc](https://godoc.org/github.com/opentracing/opentracing-go?status.svg)](http://godoc.org/github.com/opentracing/opentracing-go) -[![Sourcegraph Badge](https://sourcegraph.com/github.com/opentracing/opentracing-go/-/badge.svg)](https://sourcegraph.com/github.com/opentracing/opentracing-go?badge) - -# OpenTracing API for Go - -This package is a Go platform API for OpenTracing. - -## Required Reading - -In order to understand the Go platform API, one must first be familiar with the -[OpenTracing project](https://opentracing.io) and -[terminology](https://opentracing.io/specification/) more specifically. - -## API overview for those adding instrumentation - -Everyday consumers of this `opentracing` package really only need to worry -about a couple of key abstractions: the `StartSpan` function, the `Span` -interface, and binding a `Tracer` at `main()`-time. Here are code snippets -demonstrating some important use cases. - -#### Singleton initialization - -The simplest starting point is `./default_tracer.go`. As early as possible, call - -```go - import "github.com/opentracing/opentracing-go" - import ".../some_tracing_impl" - - func main() { - opentracing.SetGlobalTracer( - // tracing impl specific: - some_tracing_impl.New(...), - ) - ... - } -``` - -#### Non-Singleton initialization - -If you prefer direct control to singletons, manage ownership of the -`opentracing.Tracer` implementation explicitly. - -#### Creating a Span given an existing Go `context.Context` - -If you use `context.Context` in your application, OpenTracing's Go library will -happily rely on it for `Span` propagation. To start a new (blocking child) -`Span`, you can use `StartSpanFromContext`. - -```go - func xyz(ctx context.Context, ...) { - ... - span, ctx := opentracing.StartSpanFromContext(ctx, "operation_name") - defer span.Finish() - span.LogFields( - log.String("event", "soft error"), - log.String("type", "cache timeout"), - log.Int("waited.millis", 1500)) - ... - } -``` - -#### Starting an empty trace by creating a "root span" - -It's always possible to create a "root" `Span` with no parent or other causal -reference. - -```go - func xyz() { - ... - sp := opentracing.StartSpan("operation_name") - defer sp.Finish() - ... - } -``` - -#### Creating a (child) Span given an existing (parent) Span - -```go - func xyz(parentSpan opentracing.Span, ...) { - ... - sp := opentracing.StartSpan( - "operation_name", - opentracing.ChildOf(parentSpan.Context())) - defer sp.Finish() - ... - } -``` - -#### Serializing to the wire - -```go - func makeSomeRequest(ctx context.Context) ... { - if span := opentracing.SpanFromContext(ctx); span != nil { - httpClient := &http.Client{} - httpReq, _ := http.NewRequest("GET", "http://myservice/", nil) - - // Transmit the span's TraceContext as HTTP headers on our - // outbound request. - opentracing.GlobalTracer().Inject( - span.Context(), - opentracing.HTTPHeaders, - opentracing.HTTPHeadersCarrier(httpReq.Header)) - - resp, err := httpClient.Do(httpReq) - ... - } - ... - } -``` - -#### Deserializing from the wire - -```go - http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { - var serverSpan opentracing.Span - appSpecificOperationName := ... - wireContext, err := opentracing.GlobalTracer().Extract( - opentracing.HTTPHeaders, - opentracing.HTTPHeadersCarrier(req.Header)) - if err != nil { - // Optionally record something about err here - } - - // Create the span referring to the RPC client if available. - // If wireContext == nil, a root span will be created. - serverSpan = opentracing.StartSpan( - appSpecificOperationName, - ext.RPCServerOption(wireContext)) - - defer serverSpan.Finish() - - ctx := opentracing.ContextWithSpan(context.Background(), serverSpan) - ... - } -``` - -#### Conditionally capture a field using `log.Noop` - -In some situations, you may want to dynamically decide whether or not -to log a field. For example, you may want to capture additional data, -such as a customer ID, in non-production environments: - -```go - func Customer(order *Order) log.Field { - if os.Getenv("ENVIRONMENT") == "dev" { - return log.String("customer", order.Customer.ID) - } - return log.Noop() - } -``` - -#### Goroutine-safety - -The entire public API is goroutine-safe and does not require external -synchronization. - -## API pointers for those implementing a tracing system - -Tracing system implementors may be able to reuse or copy-paste-modify the `basictracer` package, found [here](https://github.com/opentracing/basictracer-go). In particular, see `basictracer.New(...)`. - -## API compatibility - -For the time being, "mild" backwards-incompatible changes may be made without changing the major version number. As OpenTracing and `opentracing-go` mature, backwards compatibility will become more of a priority. - -## Tracer test suite - -A test suite is available in the [harness](https://godoc.org/github.com/opentracing/opentracing-go/harness) package that can assist Tracer implementors to assert that their Tracer is working correctly. - -## Licensing - -[Apache 2.0 License](./LICENSE). diff --git a/vendor/github.com/opentracing/opentracing-go/ext/tags.go b/vendor/github.com/opentracing/opentracing-go/ext/tags.go deleted file mode 100644 index 52e88958..00000000 --- a/vendor/github.com/opentracing/opentracing-go/ext/tags.go +++ /dev/null @@ -1,210 +0,0 @@ -package ext - -import "github.com/opentracing/opentracing-go" - -// These constants define common tag names recommended for better portability across -// tracing systems and languages/platforms. -// -// The tag names are defined as typed strings, so that in addition to the usual use -// -// span.setTag(TagName, value) -// -// they also support value type validation via this additional syntax: -// -// TagName.Set(span, value) -// -var ( - ////////////////////////////////////////////////////////////////////// - // SpanKind (client/server or producer/consumer) - ////////////////////////////////////////////////////////////////////// - - // SpanKind hints at relationship between spans, e.g. client/server - SpanKind = spanKindTagName("span.kind") - - // SpanKindRPCClient marks a span representing the client-side of an RPC - // or other remote call - SpanKindRPCClientEnum = SpanKindEnum("client") - SpanKindRPCClient = opentracing.Tag{Key: string(SpanKind), Value: SpanKindRPCClientEnum} - - // SpanKindRPCServer marks a span representing the server-side of an RPC - // or other remote call - SpanKindRPCServerEnum = SpanKindEnum("server") - SpanKindRPCServer = opentracing.Tag{Key: string(SpanKind), Value: SpanKindRPCServerEnum} - - // SpanKindProducer marks a span representing the producer-side of a - // message bus - SpanKindProducerEnum = SpanKindEnum("producer") - SpanKindProducer = opentracing.Tag{Key: string(SpanKind), Value: SpanKindProducerEnum} - - // SpanKindConsumer marks a span representing the consumer-side of a - // message bus - SpanKindConsumerEnum = SpanKindEnum("consumer") - SpanKindConsumer = opentracing.Tag{Key: string(SpanKind), Value: SpanKindConsumerEnum} - - ////////////////////////////////////////////////////////////////////// - // Component name - ////////////////////////////////////////////////////////////////////// - - // Component is a low-cardinality identifier of the module, library, - // or package that is generating a span. - Component = stringTagName("component") - - ////////////////////////////////////////////////////////////////////// - // Sampling hint - ////////////////////////////////////////////////////////////////////// - - // SamplingPriority determines the priority of sampling this Span. - SamplingPriority = uint16TagName("sampling.priority") - - ////////////////////////////////////////////////////////////////////// - // Peer tags. These tags can be emitted by either client-side of - // server-side to describe the other side/service in a peer-to-peer - // communications, like an RPC call. - ////////////////////////////////////////////////////////////////////// - - // PeerService records the service name of the peer. - PeerService = stringTagName("peer.service") - - // PeerAddress records the address name of the peer. This may be a "ip:port", - // a bare "hostname", a FQDN or even a database DSN substring - // like "mysql://username@127.0.0.1:3306/dbname" - PeerAddress = stringTagName("peer.address") - - // PeerHostname records the host name of the peer - PeerHostname = stringTagName("peer.hostname") - - // PeerHostIPv4 records IP v4 host address of the peer - PeerHostIPv4 = ipv4Tag("peer.ipv4") - - // PeerHostIPv6 records IP v6 host address of the peer - PeerHostIPv6 = stringTagName("peer.ipv6") - - // PeerPort records port number of the peer - PeerPort = uint16TagName("peer.port") - - ////////////////////////////////////////////////////////////////////// - // HTTP Tags - ////////////////////////////////////////////////////////////////////// - - // HTTPUrl should be the URL of the request being handled in this segment - // of the trace, in standard URI format. The protocol is optional. - HTTPUrl = stringTagName("http.url") - - // HTTPMethod is the HTTP method of the request, and is case-insensitive. - HTTPMethod = stringTagName("http.method") - - // HTTPStatusCode is the numeric HTTP status code (200, 404, etc) of the - // HTTP response. - HTTPStatusCode = uint16TagName("http.status_code") - - ////////////////////////////////////////////////////////////////////// - // DB Tags - ////////////////////////////////////////////////////////////////////// - - // DBInstance is database instance name. - DBInstance = stringTagName("db.instance") - - // DBStatement is a database statement for the given database type. - // It can be a query or a prepared statement (i.e., before substitution). - DBStatement = stringTagName("db.statement") - - // DBType is a database type. For any SQL database, "sql". - // For others, the lower-case database category, e.g. "redis" - DBType = stringTagName("db.type") - - // DBUser is a username for accessing database. - DBUser = stringTagName("db.user") - - ////////////////////////////////////////////////////////////////////// - // Message Bus Tag - ////////////////////////////////////////////////////////////////////// - - // MessageBusDestination is an address at which messages can be exchanged - MessageBusDestination = stringTagName("message_bus.destination") - - ////////////////////////////////////////////////////////////////////// - // Error Tag - ////////////////////////////////////////////////////////////////////// - - // Error indicates that operation represented by the span resulted in an error. - Error = boolTagName("error") -) - -// --- - -// SpanKindEnum represents common span types -type SpanKindEnum string - -type spanKindTagName string - -// Set adds a string tag to the `span` -func (tag spanKindTagName) Set(span opentracing.Span, value SpanKindEnum) { - span.SetTag(string(tag), value) -} - -type rpcServerOption struct { - clientContext opentracing.SpanContext -} - -func (r rpcServerOption) Apply(o *opentracing.StartSpanOptions) { - if r.clientContext != nil { - opentracing.ChildOf(r.clientContext).Apply(o) - } - SpanKindRPCServer.Apply(o) -} - -// RPCServerOption returns a StartSpanOption appropriate for an RPC server span -// with `client` representing the metadata for the remote peer Span if available. -// In case client == nil, due to the client not being instrumented, this RPC -// server span will be a root span. -func RPCServerOption(client opentracing.SpanContext) opentracing.StartSpanOption { - return rpcServerOption{client} -} - -// --- - -type stringTagName string - -// Set adds a string tag to the `span` -func (tag stringTagName) Set(span opentracing.Span, value string) { - span.SetTag(string(tag), value) -} - -// --- - -type uint32TagName string - -// Set adds a uint32 tag to the `span` -func (tag uint32TagName) Set(span opentracing.Span, value uint32) { - span.SetTag(string(tag), value) -} - -// --- - -type uint16TagName string - -// Set adds a uint16 tag to the `span` -func (tag uint16TagName) Set(span opentracing.Span, value uint16) { - span.SetTag(string(tag), value) -} - -// --- - -type boolTagName string - -// Add adds a bool tag to the `span` -func (tag boolTagName) Set(span opentracing.Span, value bool) { - span.SetTag(string(tag), value) -} - -type ipv4Tag string - -// Set adds IP v4 host address of the peer as an uint32 value to the `span`, keep this for backward and zipkin compatibility -func (tag ipv4Tag) Set(span opentracing.Span, value uint32) { - span.SetTag(string(tag), value) -} - -// SetString records IP v4 host address of the peer as a .-separated tuple to the `span`. E.g., "127.0.0.1" -func (tag ipv4Tag) SetString(span opentracing.Span, value string) { - span.SetTag(string(tag), value) -} diff --git a/vendor/github.com/opentracing/opentracing-go/globaltracer.go b/vendor/github.com/opentracing/opentracing-go/globaltracer.go deleted file mode 100644 index 4f7066a9..00000000 --- a/vendor/github.com/opentracing/opentracing-go/globaltracer.go +++ /dev/null @@ -1,42 +0,0 @@ -package opentracing - -type registeredTracer struct { - tracer Tracer - isRegistered bool -} - -var ( - globalTracer = registeredTracer{NoopTracer{}, false} -) - -// SetGlobalTracer sets the [singleton] opentracing.Tracer returned by -// GlobalTracer(). Those who use GlobalTracer (rather than directly manage an -// opentracing.Tracer instance) should call SetGlobalTracer as early as -// possible in main(), prior to calling the `StartSpan` global func below. -// Prior to calling `SetGlobalTracer`, any Spans started via the `StartSpan` -// (etc) globals are noops. -func SetGlobalTracer(tracer Tracer) { - globalTracer = registeredTracer{tracer, true} -} - -// GlobalTracer returns the global singleton `Tracer` implementation. -// Before `SetGlobalTracer()` is called, the `GlobalTracer()` is a noop -// implementation that drops all data handed to it. -func GlobalTracer() Tracer { - return globalTracer.tracer -} - -// StartSpan defers to `Tracer.StartSpan`. See `GlobalTracer()`. -func StartSpan(operationName string, opts ...StartSpanOption) Span { - return globalTracer.tracer.StartSpan(operationName, opts...) -} - -// InitGlobalTracer is deprecated. Please use SetGlobalTracer. -func InitGlobalTracer(tracer Tracer) { - SetGlobalTracer(tracer) -} - -// IsGlobalTracerRegistered returns a `bool` to indicate if a tracer has been globally registered -func IsGlobalTracerRegistered() bool { - return globalTracer.isRegistered -} diff --git a/vendor/github.com/opentracing/opentracing-go/gocontext.go b/vendor/github.com/opentracing/opentracing-go/gocontext.go deleted file mode 100644 index 08c00c04..00000000 --- a/vendor/github.com/opentracing/opentracing-go/gocontext.go +++ /dev/null @@ -1,60 +0,0 @@ -package opentracing - -import "context" - -type contextKey struct{} - -var activeSpanKey = contextKey{} - -// ContextWithSpan returns a new `context.Context` that holds a reference to -// `span`'s SpanContext. -func ContextWithSpan(ctx context.Context, span Span) context.Context { - return context.WithValue(ctx, activeSpanKey, span) -} - -// SpanFromContext returns the `Span` previously associated with `ctx`, or -// `nil` if no such `Span` could be found. -// -// NOTE: context.Context != SpanContext: the former is Go's intra-process -// context propagation mechanism, and the latter houses OpenTracing's per-Span -// identity and baggage information. -func SpanFromContext(ctx context.Context) Span { - val := ctx.Value(activeSpanKey) - if sp, ok := val.(Span); ok { - return sp - } - return nil -} - -// StartSpanFromContext starts and returns a Span with `operationName`, using -// any Span found within `ctx` as a ChildOfRef. If no such parent could be -// found, StartSpanFromContext creates a root (parentless) Span. -// -// The second return value is a context.Context object built around the -// returned Span. -// -// Example usage: -// -// SomeFunction(ctx context.Context, ...) { -// sp, ctx := opentracing.StartSpanFromContext(ctx, "SomeFunction") -// defer sp.Finish() -// ... -// } -func StartSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context) { - return StartSpanFromContextWithTracer(ctx, GlobalTracer(), operationName, opts...) -} - -// StartSpanFromContextWithTracer starts and returns a span with `operationName` -// using a span found within the context as a ChildOfRef. If that doesn't exist -// it creates a root span. It also returns a context.Context object built -// around the returned span. -// -// It's behavior is identical to StartSpanFromContext except that it takes an explicit -// tracer as opposed to using the global tracer. -func StartSpanFromContextWithTracer(ctx context.Context, tracer Tracer, operationName string, opts ...StartSpanOption) (Span, context.Context) { - if parentSpan := SpanFromContext(ctx); parentSpan != nil { - opts = append(opts, ChildOf(parentSpan.Context())) - } - span := tracer.StartSpan(operationName, opts...) - return span, ContextWithSpan(ctx, span) -} diff --git a/vendor/github.com/opentracing/opentracing-go/log/field.go b/vendor/github.com/opentracing/opentracing-go/log/field.go deleted file mode 100644 index 50feea34..00000000 --- a/vendor/github.com/opentracing/opentracing-go/log/field.go +++ /dev/null @@ -1,269 +0,0 @@ -package log - -import ( - "fmt" - "math" -) - -type fieldType int - -const ( - stringType fieldType = iota - boolType - intType - int32Type - uint32Type - int64Type - uint64Type - float32Type - float64Type - errorType - objectType - lazyLoggerType - noopType -) - -// Field instances are constructed via LogBool, LogString, and so on. -// Tracing implementations may then handle them via the Field.Marshal -// method. -// -// "heavily influenced by" (i.e., partially stolen from) -// https://github.com/uber-go/zap -type Field struct { - key string - fieldType fieldType - numericVal int64 - stringVal string - interfaceVal interface{} -} - -// String adds a string-valued key:value pair to a Span.LogFields() record -func String(key, val string) Field { - return Field{ - key: key, - fieldType: stringType, - stringVal: val, - } -} - -// Bool adds a bool-valued key:value pair to a Span.LogFields() record -func Bool(key string, val bool) Field { - var numericVal int64 - if val { - numericVal = 1 - } - return Field{ - key: key, - fieldType: boolType, - numericVal: numericVal, - } -} - -// Int adds an int-valued key:value pair to a Span.LogFields() record -func Int(key string, val int) Field { - return Field{ - key: key, - fieldType: intType, - numericVal: int64(val), - } -} - -// Int32 adds an int32-valued key:value pair to a Span.LogFields() record -func Int32(key string, val int32) Field { - return Field{ - key: key, - fieldType: int32Type, - numericVal: int64(val), - } -} - -// Int64 adds an int64-valued key:value pair to a Span.LogFields() record -func Int64(key string, val int64) Field { - return Field{ - key: key, - fieldType: int64Type, - numericVal: val, - } -} - -// Uint32 adds a uint32-valued key:value pair to a Span.LogFields() record -func Uint32(key string, val uint32) Field { - return Field{ - key: key, - fieldType: uint32Type, - numericVal: int64(val), - } -} - -// Uint64 adds a uint64-valued key:value pair to a Span.LogFields() record -func Uint64(key string, val uint64) Field { - return Field{ - key: key, - fieldType: uint64Type, - numericVal: int64(val), - } -} - -// Float32 adds a float32-valued key:value pair to a Span.LogFields() record -func Float32(key string, val float32) Field { - return Field{ - key: key, - fieldType: float32Type, - numericVal: int64(math.Float32bits(val)), - } -} - -// Float64 adds a float64-valued key:value pair to a Span.LogFields() record -func Float64(key string, val float64) Field { - return Field{ - key: key, - fieldType: float64Type, - numericVal: int64(math.Float64bits(val)), - } -} - -// Error adds an error with the key "error" to a Span.LogFields() record -func Error(err error) Field { - return Field{ - key: "error", - fieldType: errorType, - interfaceVal: err, - } -} - -// Object adds an object-valued key:value pair to a Span.LogFields() record -func Object(key string, obj interface{}) Field { - return Field{ - key: key, - fieldType: objectType, - interfaceVal: obj, - } -} - -// LazyLogger allows for user-defined, late-bound logging of arbitrary data -type LazyLogger func(fv Encoder) - -// Lazy adds a LazyLogger to a Span.LogFields() record; the tracing -// implementation will call the LazyLogger function at an indefinite time in -// the future (after Lazy() returns). -func Lazy(ll LazyLogger) Field { - return Field{ - fieldType: lazyLoggerType, - interfaceVal: ll, - } -} - -// Noop creates a no-op log field that should be ignored by the tracer. -// It can be used to capture optional fields, for example those that should -// only be logged in non-production environment: -// -// func customerField(order *Order) log.Field { -// if os.Getenv("ENVIRONMENT") == "dev" { -// return log.String("customer", order.Customer.ID) -// } -// return log.Noop() -// } -// -// span.LogFields(log.String("event", "purchase"), customerField(order)) -// -func Noop() Field { - return Field{ - fieldType: noopType, - } -} - -// Encoder allows access to the contents of a Field (via a call to -// Field.Marshal). -// -// Tracer implementations typically provide an implementation of Encoder; -// OpenTracing callers typically do not need to concern themselves with it. -type Encoder interface { - EmitString(key, value string) - EmitBool(key string, value bool) - EmitInt(key string, value int) - EmitInt32(key string, value int32) - EmitInt64(key string, value int64) - EmitUint32(key string, value uint32) - EmitUint64(key string, value uint64) - EmitFloat32(key string, value float32) - EmitFloat64(key string, value float64) - EmitObject(key string, value interface{}) - EmitLazyLogger(value LazyLogger) -} - -// Marshal passes a Field instance through to the appropriate -// field-type-specific method of an Encoder. -func (lf Field) Marshal(visitor Encoder) { - switch lf.fieldType { - case stringType: - visitor.EmitString(lf.key, lf.stringVal) - case boolType: - visitor.EmitBool(lf.key, lf.numericVal != 0) - case intType: - visitor.EmitInt(lf.key, int(lf.numericVal)) - case int32Type: - visitor.EmitInt32(lf.key, int32(lf.numericVal)) - case int64Type: - visitor.EmitInt64(lf.key, int64(lf.numericVal)) - case uint32Type: - visitor.EmitUint32(lf.key, uint32(lf.numericVal)) - case uint64Type: - visitor.EmitUint64(lf.key, uint64(lf.numericVal)) - case float32Type: - visitor.EmitFloat32(lf.key, math.Float32frombits(uint32(lf.numericVal))) - case float64Type: - visitor.EmitFloat64(lf.key, math.Float64frombits(uint64(lf.numericVal))) - case errorType: - if err, ok := lf.interfaceVal.(error); ok { - visitor.EmitString(lf.key, err.Error()) - } else { - visitor.EmitString(lf.key, "") - } - case objectType: - visitor.EmitObject(lf.key, lf.interfaceVal) - case lazyLoggerType: - visitor.EmitLazyLogger(lf.interfaceVal.(LazyLogger)) - case noopType: - // intentionally left blank - } -} - -// Key returns the field's key. -func (lf Field) Key() string { - return lf.key -} - -// Value returns the field's value as interface{}. -func (lf Field) Value() interface{} { - switch lf.fieldType { - case stringType: - return lf.stringVal - case boolType: - return lf.numericVal != 0 - case intType: - return int(lf.numericVal) - case int32Type: - return int32(lf.numericVal) - case int64Type: - return int64(lf.numericVal) - case uint32Type: - return uint32(lf.numericVal) - case uint64Type: - return uint64(lf.numericVal) - case float32Type: - return math.Float32frombits(uint32(lf.numericVal)) - case float64Type: - return math.Float64frombits(uint64(lf.numericVal)) - case errorType, objectType, lazyLoggerType: - return lf.interfaceVal - case noopType: - return nil - default: - return nil - } -} - -// String returns a string representation of the key and value. -func (lf Field) String() string { - return fmt.Sprint(lf.key, ":", lf.Value()) -} diff --git a/vendor/github.com/opentracing/opentracing-go/log/util.go b/vendor/github.com/opentracing/opentracing-go/log/util.go deleted file mode 100644 index 3832feb5..00000000 --- a/vendor/github.com/opentracing/opentracing-go/log/util.go +++ /dev/null @@ -1,54 +0,0 @@ -package log - -import "fmt" - -// InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice -// a la Span.LogFields(). -func InterleavedKVToFields(keyValues ...interface{}) ([]Field, error) { - if len(keyValues)%2 != 0 { - return nil, fmt.Errorf("non-even keyValues len: %d", len(keyValues)) - } - fields := make([]Field, len(keyValues)/2) - for i := 0; i*2 < len(keyValues); i++ { - key, ok := keyValues[i*2].(string) - if !ok { - return nil, fmt.Errorf( - "non-string key (pair #%d): %T", - i, keyValues[i*2]) - } - switch typedVal := keyValues[i*2+1].(type) { - case bool: - fields[i] = Bool(key, typedVal) - case string: - fields[i] = String(key, typedVal) - case int: - fields[i] = Int(key, typedVal) - case int8: - fields[i] = Int32(key, int32(typedVal)) - case int16: - fields[i] = Int32(key, int32(typedVal)) - case int32: - fields[i] = Int32(key, typedVal) - case int64: - fields[i] = Int64(key, typedVal) - case uint: - fields[i] = Uint64(key, uint64(typedVal)) - case uint64: - fields[i] = Uint64(key, typedVal) - case uint8: - fields[i] = Uint32(key, uint32(typedVal)) - case uint16: - fields[i] = Uint32(key, uint32(typedVal)) - case uint32: - fields[i] = Uint32(key, typedVal) - case float32: - fields[i] = Float32(key, typedVal) - case float64: - fields[i] = Float64(key, typedVal) - default: - // When in doubt, coerce to a string - fields[i] = String(key, fmt.Sprint(typedVal)) - } - } - return fields, nil -} diff --git a/vendor/github.com/opentracing/opentracing-go/noop.go b/vendor/github.com/opentracing/opentracing-go/noop.go deleted file mode 100644 index 0d32f692..00000000 --- a/vendor/github.com/opentracing/opentracing-go/noop.go +++ /dev/null @@ -1,64 +0,0 @@ -package opentracing - -import "github.com/opentracing/opentracing-go/log" - -// A NoopTracer is a trivial, minimum overhead implementation of Tracer -// for which all operations are no-ops. -// -// The primary use of this implementation is in libraries, such as RPC -// frameworks, that make tracing an optional feature controlled by the -// end user. A no-op implementation allows said libraries to use it -// as the default Tracer and to write instrumentation that does -// not need to keep checking if the tracer instance is nil. -// -// For the same reason, the NoopTracer is the default "global" tracer -// (see GlobalTracer and SetGlobalTracer functions). -// -// WARNING: NoopTracer does not support baggage propagation. -type NoopTracer struct{} - -type noopSpan struct{} -type noopSpanContext struct{} - -var ( - defaultNoopSpanContext = noopSpanContext{} - defaultNoopSpan = noopSpan{} - defaultNoopTracer = NoopTracer{} -) - -const ( - emptyString = "" -) - -// noopSpanContext: -func (n noopSpanContext) ForeachBaggageItem(handler func(k, v string) bool) {} - -// noopSpan: -func (n noopSpan) Context() SpanContext { return defaultNoopSpanContext } -func (n noopSpan) SetBaggageItem(key, val string) Span { return defaultNoopSpan } -func (n noopSpan) BaggageItem(key string) string { return emptyString } -func (n noopSpan) SetTag(key string, value interface{}) Span { return n } -func (n noopSpan) LogFields(fields ...log.Field) {} -func (n noopSpan) LogKV(keyVals ...interface{}) {} -func (n noopSpan) Finish() {} -func (n noopSpan) FinishWithOptions(opts FinishOptions) {} -func (n noopSpan) SetOperationName(operationName string) Span { return n } -func (n noopSpan) Tracer() Tracer { return defaultNoopTracer } -func (n noopSpan) LogEvent(event string) {} -func (n noopSpan) LogEventWithPayload(event string, payload interface{}) {} -func (n noopSpan) Log(data LogData) {} - -// StartSpan belongs to the Tracer interface. -func (n NoopTracer) StartSpan(operationName string, opts ...StartSpanOption) Span { - return defaultNoopSpan -} - -// Inject belongs to the Tracer interface. -func (n NoopTracer) Inject(sp SpanContext, format interface{}, carrier interface{}) error { - return nil -} - -// Extract belongs to the Tracer interface. -func (n NoopTracer) Extract(format interface{}, carrier interface{}) (SpanContext, error) { - return nil, ErrSpanContextNotFound -} diff --git a/vendor/github.com/opentracing/opentracing-go/propagation.go b/vendor/github.com/opentracing/opentracing-go/propagation.go deleted file mode 100644 index b0c275eb..00000000 --- a/vendor/github.com/opentracing/opentracing-go/propagation.go +++ /dev/null @@ -1,176 +0,0 @@ -package opentracing - -import ( - "errors" - "net/http" -) - -/////////////////////////////////////////////////////////////////////////////// -// CORE PROPAGATION INTERFACES: -/////////////////////////////////////////////////////////////////////////////// - -var ( - // ErrUnsupportedFormat occurs when the `format` passed to Tracer.Inject() or - // Tracer.Extract() is not recognized by the Tracer implementation. - ErrUnsupportedFormat = errors.New("opentracing: Unknown or unsupported Inject/Extract format") - - // ErrSpanContextNotFound occurs when the `carrier` passed to - // Tracer.Extract() is valid and uncorrupted but has insufficient - // information to extract a SpanContext. - ErrSpanContextNotFound = errors.New("opentracing: SpanContext not found in Extract carrier") - - // ErrInvalidSpanContext errors occur when Tracer.Inject() is asked to - // operate on a SpanContext which it is not prepared to handle (for - // example, since it was created by a different tracer implementation). - ErrInvalidSpanContext = errors.New("opentracing: SpanContext type incompatible with tracer") - - // ErrInvalidCarrier errors occur when Tracer.Inject() or Tracer.Extract() - // implementations expect a different type of `carrier` than they are - // given. - ErrInvalidCarrier = errors.New("opentracing: Invalid Inject/Extract carrier") - - // ErrSpanContextCorrupted occurs when the `carrier` passed to - // Tracer.Extract() is of the expected type but is corrupted. - ErrSpanContextCorrupted = errors.New("opentracing: SpanContext data corrupted in Extract carrier") -) - -/////////////////////////////////////////////////////////////////////////////// -// BUILTIN PROPAGATION FORMATS: -/////////////////////////////////////////////////////////////////////////////// - -// BuiltinFormat is used to demarcate the values within package `opentracing` -// that are intended for use with the Tracer.Inject() and Tracer.Extract() -// methods. -type BuiltinFormat byte - -const ( - // Binary represents SpanContexts as opaque binary data. - // - // For Tracer.Inject(): the carrier must be an `io.Writer`. - // - // For Tracer.Extract(): the carrier must be an `io.Reader`. - Binary BuiltinFormat = iota - - // TextMap represents SpanContexts as key:value string pairs. - // - // Unlike HTTPHeaders, the TextMap format does not restrict the key or - // value character sets in any way. - // - // For Tracer.Inject(): the carrier must be a `TextMapWriter`. - // - // For Tracer.Extract(): the carrier must be a `TextMapReader`. - TextMap - - // HTTPHeaders represents SpanContexts as HTTP header string pairs. - // - // Unlike TextMap, the HTTPHeaders format requires that the keys and values - // be valid as HTTP headers as-is (i.e., character casing may be unstable - // and special characters are disallowed in keys, values should be - // URL-escaped, etc). - // - // For Tracer.Inject(): the carrier must be a `TextMapWriter`. - // - // For Tracer.Extract(): the carrier must be a `TextMapReader`. - // - // See HTTPHeadersCarrier for an implementation of both TextMapWriter - // and TextMapReader that defers to an http.Header instance for storage. - // For example, Inject(): - // - // carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) - // err := span.Tracer().Inject( - // span.Context(), opentracing.HTTPHeaders, carrier) - // - // Or Extract(): - // - // carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) - // clientContext, err := tracer.Extract( - // opentracing.HTTPHeaders, carrier) - // - HTTPHeaders -) - -// TextMapWriter is the Inject() carrier for the TextMap builtin format. With -// it, the caller can encode a SpanContext for propagation as entries in a map -// of unicode strings. -type TextMapWriter interface { - // Set a key:value pair to the carrier. Multiple calls to Set() for the - // same key leads to undefined behavior. - // - // NOTE: The backing store for the TextMapWriter may contain data unrelated - // to SpanContext. As such, Inject() and Extract() implementations that - // call the TextMapWriter and TextMapReader interfaces must agree on a - // prefix or other convention to distinguish their own key:value pairs. - Set(key, val string) -} - -// TextMapReader is the Extract() carrier for the TextMap builtin format. With it, -// the caller can decode a propagated SpanContext as entries in a map of -// unicode strings. -type TextMapReader interface { - // ForeachKey returns TextMap contents via repeated calls to the `handler` - // function. If any call to `handler` returns a non-nil error, ForeachKey - // terminates and returns that error. - // - // NOTE: The backing store for the TextMapReader may contain data unrelated - // to SpanContext. As such, Inject() and Extract() implementations that - // call the TextMapWriter and TextMapReader interfaces must agree on a - // prefix or other convention to distinguish their own key:value pairs. - // - // The "foreach" callback pattern reduces unnecessary copying in some cases - // and also allows implementations to hold locks while the map is read. - ForeachKey(handler func(key, val string) error) error -} - -// TextMapCarrier allows the use of regular map[string]string -// as both TextMapWriter and TextMapReader. -type TextMapCarrier map[string]string - -// ForeachKey conforms to the TextMapReader interface. -func (c TextMapCarrier) ForeachKey(handler func(key, val string) error) error { - for k, v := range c { - if err := handler(k, v); err != nil { - return err - } - } - return nil -} - -// Set implements Set() of opentracing.TextMapWriter -func (c TextMapCarrier) Set(key, val string) { - c[key] = val -} - -// HTTPHeadersCarrier satisfies both TextMapWriter and TextMapReader. -// -// Example usage for server side: -// -// carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) -// clientContext, err := tracer.Extract(opentracing.HTTPHeaders, carrier) -// -// Example usage for client side: -// -// carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) -// err := tracer.Inject( -// span.Context(), -// opentracing.HTTPHeaders, -// carrier) -// -type HTTPHeadersCarrier http.Header - -// Set conforms to the TextMapWriter interface. -func (c HTTPHeadersCarrier) Set(key, val string) { - h := http.Header(c) - h.Set(key, val) -} - -// ForeachKey conforms to the TextMapReader interface. -func (c HTTPHeadersCarrier) ForeachKey(handler func(key, val string) error) error { - for k, vals := range c { - for _, v := range vals { - if err := handler(k, v); err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/github.com/opentracing/opentracing-go/span.go b/vendor/github.com/opentracing/opentracing-go/span.go deleted file mode 100644 index 0d3fb534..00000000 --- a/vendor/github.com/opentracing/opentracing-go/span.go +++ /dev/null @@ -1,189 +0,0 @@ -package opentracing - -import ( - "time" - - "github.com/opentracing/opentracing-go/log" -) - -// SpanContext represents Span state that must propagate to descendant Spans and across process -// boundaries (e.g., a tuple). -type SpanContext interface { - // ForeachBaggageItem grants access to all baggage items stored in the - // SpanContext. - // The handler function will be called for each baggage key/value pair. - // The ordering of items is not guaranteed. - // - // The bool return value indicates if the handler wants to continue iterating - // through the rest of the baggage items; for example if the handler is trying to - // find some baggage item by pattern matching the name, it can return false - // as soon as the item is found to stop further iterations. - ForeachBaggageItem(handler func(k, v string) bool) -} - -// Span represents an active, un-finished span in the OpenTracing system. -// -// Spans are created by the Tracer interface. -type Span interface { - // Sets the end timestamp and finalizes Span state. - // - // With the exception of calls to Context() (which are always allowed), - // Finish() must be the last call made to any span instance, and to do - // otherwise leads to undefined behavior. - Finish() - // FinishWithOptions is like Finish() but with explicit control over - // timestamps and log data. - FinishWithOptions(opts FinishOptions) - - // Context() yields the SpanContext for this Span. Note that the return - // value of Context() is still valid after a call to Span.Finish(), as is - // a call to Span.Context() after a call to Span.Finish(). - Context() SpanContext - - // Sets or changes the operation name. - // - // Returns a reference to this Span for chaining. - SetOperationName(operationName string) Span - - // Adds a tag to the span. - // - // If there is a pre-existing tag set for `key`, it is overwritten. - // - // Tag values can be numeric types, strings, or bools. The behavior of - // other tag value types is undefined at the OpenTracing level. If a - // tracing system does not know how to handle a particular value type, it - // may ignore the tag, but shall not panic. - // - // Returns a reference to this Span for chaining. - SetTag(key string, value interface{}) Span - - // LogFields is an efficient and type-checked way to record key:value - // logging data about a Span, though the programming interface is a little - // more verbose than LogKV(). Here's an example: - // - // span.LogFields( - // log.String("event", "soft error"), - // log.String("type", "cache timeout"), - // log.Int("waited.millis", 1500)) - // - // Also see Span.FinishWithOptions() and FinishOptions.BulkLogData. - LogFields(fields ...log.Field) - - // LogKV is a concise, readable way to record key:value logging data about - // a Span, though unfortunately this also makes it less efficient and less - // type-safe than LogFields(). Here's an example: - // - // span.LogKV( - // "event", "soft error", - // "type", "cache timeout", - // "waited.millis", 1500) - // - // For LogKV (as opposed to LogFields()), the parameters must appear as - // key-value pairs, like - // - // span.LogKV(key1, val1, key2, val2, key3, val3, ...) - // - // The keys must all be strings. The values may be strings, numeric types, - // bools, Go error instances, or arbitrary structs. - // - // (Note to implementors: consider the log.InterleavedKVToFields() helper) - LogKV(alternatingKeyValues ...interface{}) - - // SetBaggageItem sets a key:value pair on this Span and its SpanContext - // that also propagates to descendants of this Span. - // - // SetBaggageItem() enables powerful functionality given a full-stack - // opentracing integration (e.g., arbitrary application data from a mobile - // app can make it, transparently, all the way into the depths of a storage - // system), and with it some powerful costs: use this feature with care. - // - // IMPORTANT NOTE #1: SetBaggageItem() will only propagate baggage items to - // *future* causal descendants of the associated Span. - // - // IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and - // value is copied into every local *and remote* child of the associated - // Span, and that can add up to a lot of network and cpu overhead. - // - // Returns a reference to this Span for chaining. - SetBaggageItem(restrictedKey, value string) Span - - // Gets the value for a baggage item given its key. Returns the empty string - // if the value isn't found in this Span. - BaggageItem(restrictedKey string) string - - // Provides access to the Tracer that created this Span. - Tracer() Tracer - - // Deprecated: use LogFields or LogKV - LogEvent(event string) - // Deprecated: use LogFields or LogKV - LogEventWithPayload(event string, payload interface{}) - // Deprecated: use LogFields or LogKV - Log(data LogData) -} - -// LogRecord is data associated with a single Span log. Every LogRecord -// instance must specify at least one Field. -type LogRecord struct { - Timestamp time.Time - Fields []log.Field -} - -// FinishOptions allows Span.FinishWithOptions callers to override the finish -// timestamp and provide log data via a bulk interface. -type FinishOptions struct { - // FinishTime overrides the Span's finish time, or implicitly becomes - // time.Now() if FinishTime.IsZero(). - // - // FinishTime must resolve to a timestamp that's >= the Span's StartTime - // (per StartSpanOptions). - FinishTime time.Time - - // LogRecords allows the caller to specify the contents of many LogFields() - // calls with a single slice. May be nil. - // - // None of the LogRecord.Timestamp values may be .IsZero() (i.e., they must - // be set explicitly). Also, they must be >= the Span's start timestamp and - // <= the FinishTime (or time.Now() if FinishTime.IsZero()). Otherwise the - // behavior of FinishWithOptions() is undefined. - // - // If specified, the caller hands off ownership of LogRecords at - // FinishWithOptions() invocation time. - // - // If specified, the (deprecated) BulkLogData must be nil or empty. - LogRecords []LogRecord - - // BulkLogData is DEPRECATED. - BulkLogData []LogData -} - -// LogData is DEPRECATED -type LogData struct { - Timestamp time.Time - Event string - Payload interface{} -} - -// ToLogRecord converts a deprecated LogData to a non-deprecated LogRecord -func (ld *LogData) ToLogRecord() LogRecord { - var literalTimestamp time.Time - if ld.Timestamp.IsZero() { - literalTimestamp = time.Now() - } else { - literalTimestamp = ld.Timestamp - } - rval := LogRecord{ - Timestamp: literalTimestamp, - } - if ld.Payload == nil { - rval.Fields = []log.Field{ - log.String("event", ld.Event), - } - } else { - rval.Fields = []log.Field{ - log.String("event", ld.Event), - log.Object("payload", ld.Payload), - } - } - return rval -} diff --git a/vendor/github.com/opentracing/opentracing-go/tracer.go b/vendor/github.com/opentracing/opentracing-go/tracer.go deleted file mode 100644 index 715f0ced..00000000 --- a/vendor/github.com/opentracing/opentracing-go/tracer.go +++ /dev/null @@ -1,304 +0,0 @@ -package opentracing - -import "time" - -// Tracer is a simple, thin interface for Span creation and SpanContext -// propagation. -type Tracer interface { - - // Create, start, and return a new Span with the given `operationName` and - // incorporate the given StartSpanOption `opts`. (Note that `opts` borrows - // from the "functional options" pattern, per - // http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis) - // - // A Span with no SpanReference options (e.g., opentracing.ChildOf() or - // opentracing.FollowsFrom()) becomes the root of its own trace. - // - // Examples: - // - // var tracer opentracing.Tracer = ... - // - // // The root-span case: - // sp := tracer.StartSpan("GetFeed") - // - // // The vanilla child span case: - // sp := tracer.StartSpan( - // "GetFeed", - // opentracing.ChildOf(parentSpan.Context())) - // - // // All the bells and whistles: - // sp := tracer.StartSpan( - // "GetFeed", - // opentracing.ChildOf(parentSpan.Context()), - // opentracing.Tag{"user_agent", loggedReq.UserAgent}, - // opentracing.StartTime(loggedReq.Timestamp), - // ) - // - StartSpan(operationName string, opts ...StartSpanOption) Span - - // Inject() takes the `sm` SpanContext instance and injects it for - // propagation within `carrier`. The actual type of `carrier` depends on - // the value of `format`. - // - // OpenTracing defines a common set of `format` values (see BuiltinFormat), - // and each has an expected carrier type. - // - // Other packages may declare their own `format` values, much like the keys - // used by `context.Context` (see https://godoc.org/context#WithValue). - // - // Example usage (sans error handling): - // - // carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) - // err := tracer.Inject( - // span.Context(), - // opentracing.HTTPHeaders, - // carrier) - // - // NOTE: All opentracing.Tracer implementations MUST support all - // BuiltinFormats. - // - // Implementations may return opentracing.ErrUnsupportedFormat if `format` - // is not supported by (or not known by) the implementation. - // - // Implementations may return opentracing.ErrInvalidCarrier or any other - // implementation-specific error if the format is supported but injection - // fails anyway. - // - // See Tracer.Extract(). - Inject(sm SpanContext, format interface{}, carrier interface{}) error - - // Extract() returns a SpanContext instance given `format` and `carrier`. - // - // OpenTracing defines a common set of `format` values (see BuiltinFormat), - // and each has an expected carrier type. - // - // Other packages may declare their own `format` values, much like the keys - // used by `context.Context` (see - // https://godoc.org/golang.org/x/net/context#WithValue). - // - // Example usage (with StartSpan): - // - // - // carrier := opentracing.HTTPHeadersCarrier(httpReq.Header) - // clientContext, err := tracer.Extract(opentracing.HTTPHeaders, carrier) - // - // // ... assuming the ultimate goal here is to resume the trace with a - // // server-side Span: - // var serverSpan opentracing.Span - // if err == nil { - // span = tracer.StartSpan( - // rpcMethodName, ext.RPCServerOption(clientContext)) - // } else { - // span = tracer.StartSpan(rpcMethodName) - // } - // - // - // NOTE: All opentracing.Tracer implementations MUST support all - // BuiltinFormats. - // - // Return values: - // - A successful Extract returns a SpanContext instance and a nil error - // - If there was simply no SpanContext to extract in `carrier`, Extract() - // returns (nil, opentracing.ErrSpanContextNotFound) - // - If `format` is unsupported or unrecognized, Extract() returns (nil, - // opentracing.ErrUnsupportedFormat) - // - If there are more fundamental problems with the `carrier` object, - // Extract() may return opentracing.ErrInvalidCarrier, - // opentracing.ErrSpanContextCorrupted, or implementation-specific - // errors. - // - // See Tracer.Inject(). - Extract(format interface{}, carrier interface{}) (SpanContext, error) -} - -// StartSpanOptions allows Tracer.StartSpan() callers and implementors a -// mechanism to override the start timestamp, specify Span References, and make -// a single Tag or multiple Tags available at Span start time. -// -// StartSpan() callers should look at the StartSpanOption interface and -// implementations available in this package. -// -// Tracer implementations can convert a slice of `StartSpanOption` instances -// into a `StartSpanOptions` struct like so: -// -// func StartSpan(opName string, opts ...opentracing.StartSpanOption) { -// sso := opentracing.StartSpanOptions{} -// for _, o := range opts { -// o.Apply(&sso) -// } -// ... -// } -// -type StartSpanOptions struct { - // Zero or more causal references to other Spans (via their SpanContext). - // If empty, start a "root" Span (i.e., start a new trace). - References []SpanReference - - // StartTime overrides the Span's start time, or implicitly becomes - // time.Now() if StartTime.IsZero(). - StartTime time.Time - - // Tags may have zero or more entries; the restrictions on map values are - // identical to those for Span.SetTag(). May be nil. - // - // If specified, the caller hands off ownership of Tags at - // StartSpan() invocation time. - Tags map[string]interface{} -} - -// StartSpanOption instances (zero or more) may be passed to Tracer.StartSpan. -// -// StartSpanOption borrows from the "functional options" pattern, per -// http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis -type StartSpanOption interface { - Apply(*StartSpanOptions) -} - -// SpanReferenceType is an enum type describing different categories of -// relationships between two Spans. If Span-2 refers to Span-1, the -// SpanReferenceType describes Span-1 from Span-2's perspective. For example, -// ChildOfRef means that Span-1 created Span-2. -// -// NOTE: Span-1 and Span-2 do *not* necessarily depend on each other for -// completion; e.g., Span-2 may be part of a background job enqueued by Span-1, -// or Span-2 may be sitting in a distributed queue behind Span-1. -type SpanReferenceType int - -const ( - // ChildOfRef refers to a parent Span that caused *and* somehow depends - // upon the new child Span. Often (but not always), the parent Span cannot - // finish until the child Span does. - // - // An timing diagram for a ChildOfRef that's blocked on the new Span: - // - // [-Parent Span---------] - // [-Child Span----] - // - // See http://opentracing.io/spec/ - // - // See opentracing.ChildOf() - ChildOfRef SpanReferenceType = iota - - // FollowsFromRef refers to a parent Span that does not depend in any way - // on the result of the new child Span. For instance, one might use - // FollowsFromRefs to describe pipeline stages separated by queues, - // or a fire-and-forget cache insert at the tail end of a web request. - // - // A FollowsFromRef Span is part of the same logical trace as the new Span: - // i.e., the new Span is somehow caused by the work of its FollowsFromRef. - // - // All of the following could be valid timing diagrams for children that - // "FollowFrom" a parent. - // - // [-Parent Span-] [-Child Span-] - // - // - // [-Parent Span--] - // [-Child Span-] - // - // - // [-Parent Span-] - // [-Child Span-] - // - // See http://opentracing.io/spec/ - // - // See opentracing.FollowsFrom() - FollowsFromRef -) - -// SpanReference is a StartSpanOption that pairs a SpanReferenceType and a -// referenced SpanContext. See the SpanReferenceType documentation for -// supported relationships. If SpanReference is created with -// ReferencedContext==nil, it has no effect. Thus it allows for a more concise -// syntax for starting spans: -// -// sc, _ := tracer.Extract(someFormat, someCarrier) -// span := tracer.StartSpan("operation", opentracing.ChildOf(sc)) -// -// The `ChildOf(sc)` option above will not panic if sc == nil, it will just -// not add the parent span reference to the options. -type SpanReference struct { - Type SpanReferenceType - ReferencedContext SpanContext -} - -// Apply satisfies the StartSpanOption interface. -func (r SpanReference) Apply(o *StartSpanOptions) { - if r.ReferencedContext != nil { - o.References = append(o.References, r) - } -} - -// ChildOf returns a StartSpanOption pointing to a dependent parent span. -// If sc == nil, the option has no effect. -// -// See ChildOfRef, SpanReference -func ChildOf(sc SpanContext) SpanReference { - return SpanReference{ - Type: ChildOfRef, - ReferencedContext: sc, - } -} - -// FollowsFrom returns a StartSpanOption pointing to a parent Span that caused -// the child Span but does not directly depend on its result in any way. -// If sc == nil, the option has no effect. -// -// See FollowsFromRef, SpanReference -func FollowsFrom(sc SpanContext) SpanReference { - return SpanReference{ - Type: FollowsFromRef, - ReferencedContext: sc, - } -} - -// StartTime is a StartSpanOption that sets an explicit start timestamp for the -// new Span. -type StartTime time.Time - -// Apply satisfies the StartSpanOption interface. -func (t StartTime) Apply(o *StartSpanOptions) { - o.StartTime = time.Time(t) -} - -// Tags are a generic map from an arbitrary string key to an opaque value type. -// The underlying tracing system is responsible for interpreting and -// serializing the values. -type Tags map[string]interface{} - -// Apply satisfies the StartSpanOption interface. -func (t Tags) Apply(o *StartSpanOptions) { - if o.Tags == nil { - o.Tags = make(map[string]interface{}) - } - for k, v := range t { - o.Tags[k] = v - } -} - -// Tag may be passed as a StartSpanOption to add a tag to new spans, -// or its Set method may be used to apply the tag to an existing Span, -// for example: -// -// tracer.StartSpan("opName", Tag{"Key", value}) -// -// or -// -// Tag{"key", value}.Set(span) -type Tag struct { - Key string - Value interface{} -} - -// Apply satisfies the StartSpanOption interface. -func (t Tag) Apply(o *StartSpanOptions) { - if o.Tags == nil { - o.Tags = make(map[string]interface{}) - } - o.Tags[t.Key] = t.Value -} - -// Set applies the tag to an existing Span. -func (t Tag) Set(s Span) { - s.SetTag(t.Key, t.Value) -} diff --git a/vendor/github.com/pelletier/go-toml/.dockerignore b/vendor/github.com/pelletier/go-toml/.dockerignore deleted file mode 100644 index 7b588347..00000000 --- a/vendor/github.com/pelletier/go-toml/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -cmd/tomll/tomll -cmd/tomljson/tomljson diff --git a/vendor/github.com/pelletier/go-toml/.gitignore b/vendor/github.com/pelletier/go-toml/.gitignore index e6ba63a5..99e38bbc 100644 --- a/vendor/github.com/pelletier/go-toml/.gitignore +++ b/vendor/github.com/pelletier/go-toml/.gitignore @@ -1,5 +1,2 @@ test_program/test_program_bin fuzz/ -cmd/tomll/tomll -cmd/tomljson/tomljson -cmd/tomltestgen/tomltestgen diff --git a/vendor/github.com/pelletier/go-toml/.travis.yml b/vendor/github.com/pelletier/go-toml/.travis.yml index abb03e99..c9fbf304 100644 --- a/vendor/github.com/pelletier/go-toml/.travis.yml +++ b/vendor/github.com/pelletier/go-toml/.travis.yml @@ -1,22 +1,23 @@ sudo: false language: go go: - - 1.11.x - - 1.12.x + - 1.8.x + - 1.9.x + - 1.10.x - tip matrix: allow_failures: - go: tip fast_finish: true -env: - - GO111MODULE=on script: - if [ -n "$(go fmt ./...)" ]; then exit 1; fi - - go test github.com/pelletier/go-toml -race -coverprofile=coverage.txt -covermode=atomic - - go test github.com/pelletier/go-toml/cmd/tomljson - - go test github.com/pelletier/go-toml/cmd/tomll - - go test github.com/pelletier/go-toml/query + - ./test.sh - ./benchmark.sh $TRAVIS_BRANCH https://github.com/$TRAVIS_REPO_SLUG.git - +before_install: + - go get github.com/axw/gocov/gocov + - go get github.com/mattn/goveralls + - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi +branches: + only: [master] after_success: - - bash <(curl -s https://codecov.io/bash) + - $HOME/gopath/bin/goveralls -service=travis-ci -coverprofile=coverage.out -repotoken $COVERALLS_TOKEN diff --git a/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md b/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md deleted file mode 100644 index 405c911c..00000000 --- a/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md +++ /dev/null @@ -1,132 +0,0 @@ -## Contributing - -Thank you for your interest in go-toml! We appreciate you considering -contributing to go-toml! - -The main goal is the project is to provide an easy-to-use TOML -implementation for Go that gets the job done and gets out of your way – -dealing with TOML is probably not the central piece of your project. - -As the single maintainer of go-toml, time is scarce. All help, big or -small, is more than welcomed! - -### Ask questions - -Any question you may have, somebody else might have it too. Always feel -free to ask them on the [issues tracker][issues-tracker]. We will try to -answer them as clearly and quickly as possible, time permitting. - -Asking questions also helps us identify areas where the documentation needs -improvement, or new features that weren't envisioned before. Sometimes, a -seemingly innocent question leads to the fix of a bug. Don't hesitate and -ask away! - -### Improve the documentation - -The best way to share your knowledge and experience with go-toml is to -improve the documentation. Fix a typo, clarify an interface, add an -example, anything goes! - -The documentation is present in the [README][readme] and thorough the -source code. On release, it gets updated on [GoDoc][godoc]. To make a -change to the documentation, create a pull request with your proposed -changes. For simple changes like that, the easiest way to go is probably -the "Fork this project and edit the file" button on Github, displayed at -the top right of the file. Unless it's a trivial change (for example a -typo), provide a little bit of context in your pull request description or -commit message. - -### Report a bug - -Found a bug! Sorry to hear that :(. Help us and other track them down and -fix by reporting it. [File a new bug report][bug-report] on the [issues -tracker][issues-tracker]. The template should provide enough guidance on -what to include. When in doubt: add more details! By reducing ambiguity and -providing more information, it decreases back and forth and saves everyone -time. - -### Code changes - -Want to contribute a patch? Very happy to hear that! - -First, some high-level rules: - -* A short proposal with some POC code is better than a lengthy piece of - text with no code. Code speaks louder than words. -* No backward-incompatible patch will be accepted unless discussed. - Sometimes it's hard, and Go's lack of versioning by default does not - help, but we try not to break people's programs unless we absolutely have - to. -* If you are writing a new feature or extending an existing one, make sure - to write some documentation. -* Bug fixes need to be accompanied with regression tests. -* New code needs to be tested. -* Your commit messages need to explain why the change is needed, even if - already included in the PR description. - -It does sound like a lot, but those best practices are here to save time -overall and continuously improve the quality of the project, which is -something everyone benefits from. - -#### Get started - -The fairly standard code contribution process looks like that: - -1. [Fork the project][fork]. -2. Make your changes, commit on any branch you like. -3. [Open up a pull request][pull-request] -4. Review, potential ask for changes. -5. Merge. You're in! - -Feel free to ask for help! You can create draft pull requests to gather -some early feedback! - -#### Run the tests - -You can run tests for go-toml using Go's test tool: `go test ./...`. -When creating a pull requests, all tests will be ran on Linux on a few Go -versions (Travis CI), and on Windows using the latest Go version -(AppVeyor). - -#### Style - -Try to look around and follow the same format and structure as the rest of -the code. We enforce using `go fmt` on the whole code base. - ---- - -### Maintainers-only - -#### Merge pull request - -Checklist: - -* Passing CI. -* Does not introduce backward-incompatible changes (unless discussed). -* Has relevant doc changes. -* Has relevant unit tests. - -1. Merge using "squash and merge". -2. Make sure to edit the commit message to keep all the useful information - nice and clean. -3. Make sure the commit title is clear and contains the PR number (#123). - -#### New release - -1. Go to [releases][releases]. Click on "X commits to master since this - release". -2. Make note of all the changes. Look for backward incompatible changes, - new features, and bug fixes. -3. Pick the new version using the above and semver. -4. Create a [new release][new-release]. -5. Follow the same format as [1.1.0][release-110]. - -[issues-tracker]: https://github.com/pelletier/go-toml/issues -[bug-report]: https://github.com/pelletier/go-toml/issues/new?template=bug_report.md -[godoc]: https://godoc.org/github.com/pelletier/go-toml -[readme]: ./README.md -[fork]: https://help.github.com/articles/fork-a-repo -[pull-request]: https://help.github.com/en/articles/creating-a-pull-request -[releases]: https://github.com/pelletier/go-toml/releases -[new-release]: https://github.com/pelletier/go-toml/releases/new -[release-110]: https://github.com/pelletier/go-toml/releases/tag/v1.1.0 diff --git a/vendor/github.com/pelletier/go-toml/Dockerfile b/vendor/github.com/pelletier/go-toml/Dockerfile deleted file mode 100644 index 8f439d47..00000000 --- a/vendor/github.com/pelletier/go-toml/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM golang:1.12-alpine3.9 as builder -WORKDIR /go/src/github.com/pelletier/go-toml -COPY . . -ENV CGO_ENABLED=0 -ENV GOOS=linux -RUN go install ./... - -FROM scratch -COPY --from=builder /go/bin/tomll /usr/bin/tomll -COPY --from=builder /go/bin/tomljson /usr/bin/tomljson diff --git a/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 041cdc4a..00000000 --- a/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,5 +0,0 @@ -**Issue:** add link to pelletier/go-toml issue here - -Explanation of what this pull request does. - -More detailed description of the decisions being made and the reasons why (if the patch is non-trivial). diff --git a/vendor/github.com/pelletier/go-toml/README.md b/vendor/github.com/pelletier/go-toml/README.md index f0311b99..0d357acf 100644 --- a/vendor/github.com/pelletier/go-toml/README.md +++ b/vendor/github.com/pelletier/go-toml/README.md @@ -8,10 +8,8 @@ This library supports TOML version [![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml) [![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE) [![Build Status](https://travis-ci.org/pelletier/go-toml.svg?branch=master)](https://travis-ci.org/pelletier/go-toml) -[![Windows Build status](https://ci.appveyor.com/api/projects/status/4aepwwjori266hkt/branch/master?svg=true)](https://ci.appveyor.com/project/pelletier/go-toml/branch/master) -[![codecov](https://codecov.io/gh/pelletier/go-toml/branch/master/graph/badge.svg)](https://codecov.io/gh/pelletier/go-toml) +[![Coverage Status](https://coveralls.io/repos/github/pelletier/go-toml/badge.svg?branch=master)](https://coveralls.io/github/pelletier/go-toml?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/pelletier/go-toml)](https://goreportcard.com/report/github.com/pelletier/go-toml) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml?ref=badge_shield) ## Features @@ -101,23 +99,6 @@ Go-toml provides two handy command line tools: tomljson --help ``` -### Docker image - -Those tools are also availble as a Docker image from -[dockerhub](https://hub.docker.com/r/pelletier/go-toml). For example, to -use `tomljson`: - -``` -docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml -``` - -Only master (`latest`) and tagged versions are published to dockerhub. You -can build your own image as usual: - -``` -docker build -t go-toml . -``` - ## Contribute Feel free to report bugs and patches using GitHub's pull requests system on @@ -126,7 +107,12 @@ much appreciated! ### Run tests -`go test ./...` +You have to make sure two kind of tests run: + +1. The Go unit tests +2. The TOML examples base + +You can run both of them using `./test.sh`. ### Fuzzing diff --git a/vendor/github.com/pelletier/go-toml/appveyor.yml b/vendor/github.com/pelletier/go-toml/appveyor.yml deleted file mode 100644 index 40e8a415..00000000 --- a/vendor/github.com/pelletier/go-toml/appveyor.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: "{build}" - -# Source Config -clone_folder: c:\gopath\src\github.com\pelletier\go-toml - -# Build host -environment: - GOPATH: c:\gopath - DEPTESTBYPASS501: 1 - GOVERSION: 1.12 - GO111MODULE: on - -init: - - git config --global core.autocrlf input - -# Build -install: - # Install the specific Go version. - - rmdir c:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi - - msiexec /i go%GOVERSION%.windows-amd64.msi /q - - choco install bzr - - set Path=c:\go\bin;c:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path% - - go version - - go env - -build: false -deploy: false - -test_script: - - go test github.com/pelletier/go-toml - - go test github.com/pelletier/go-toml/cmd/tomljson - - go test github.com/pelletier/go-toml/cmd/tomll - - go test github.com/pelletier/go-toml/query diff --git a/vendor/github.com/pelletier/go-toml/go.mod b/vendor/github.com/pelletier/go-toml/go.mod deleted file mode 100644 index f4690e19..00000000 --- a/vendor/github.com/pelletier/go-toml/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/pelletier/go-toml - -go 1.12 - -require ( - github.com/BurntSushi/toml v0.3.1 - github.com/davecgh/go-spew v1.1.1 - gopkg.in/yaml.v2 v2.2.2 -) diff --git a/vendor/github.com/pelletier/go-toml/go.sum b/vendor/github.com/pelletier/go-toml/go.sum deleted file mode 100644 index 8d91a478..00000000 --- a/vendor/github.com/pelletier/go-toml/go.sum +++ /dev/null @@ -1,7 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/pelletier/go-toml/keysparsing.go b/vendor/github.com/pelletier/go-toml/keysparsing.go index e923bc4f..284db646 100644 --- a/vendor/github.com/pelletier/go-toml/keysparsing.go +++ b/vendor/github.com/pelletier/go-toml/keysparsing.go @@ -3,107 +3,79 @@ package toml import ( + "bytes" "errors" "fmt" "unicode" ) // Convert the bare key group string to an array. -// The input supports double quotation and single quotation, +// The input supports double quotation to allow "." inside the key name, // but escape sequences are not supported. Lexers must unescape them beforehand. func parseKey(key string) ([]string, error) { - runes := []rune(key) - var groups []string + groups := []string{} + var buffer bytes.Buffer + inQuotes := false + wasInQuotes := false + ignoreSpace := true + expectDot := false - if len(key) == 0 { - return nil, errors.New("empty key") + for _, char := range key { + if ignoreSpace { + if char == ' ' { + continue + } + ignoreSpace = false + } + switch char { + case '"': + if inQuotes { + groups = append(groups, buffer.String()) + buffer.Reset() + wasInQuotes = true + } + inQuotes = !inQuotes + expectDot = false + case '.': + if inQuotes { + buffer.WriteRune(char) + } else { + if !wasInQuotes { + if buffer.Len() == 0 { + return nil, errors.New("empty table key") + } + groups = append(groups, buffer.String()) + buffer.Reset() + } + ignoreSpace = true + expectDot = false + wasInQuotes = false + } + case ' ': + if inQuotes { + buffer.WriteRune(char) + } else { + expectDot = true + } + default: + if !inQuotes && !isValidBareChar(char) { + return nil, fmt.Errorf("invalid bare character: %c", char) + } + if !inQuotes && expectDot { + return nil, errors.New("what?") + } + buffer.WriteRune(char) + expectDot = false + } } - - idx := 0 - for idx < len(runes) { - for ; idx < len(runes) && isSpace(runes[idx]); idx++ { - // skip leading whitespace - } - if idx >= len(runes) { - break - } - r := runes[idx] - if isValidBareChar(r) { - // parse bare key - startIdx := idx - endIdx := -1 - idx++ - for idx < len(runes) { - r = runes[idx] - if isValidBareChar(r) { - idx++ - } else if r == '.' { - endIdx = idx - break - } else if isSpace(r) { - endIdx = idx - for ; idx < len(runes) && isSpace(runes[idx]); idx++ { - // skip trailing whitespace - } - if idx < len(runes) && runes[idx] != '.' { - return nil, fmt.Errorf("invalid key character after whitespace: %c", runes[idx]) - } - break - } else { - return nil, fmt.Errorf("invalid bare key character: %c", r) - } - } - if endIdx == -1 { - endIdx = idx - } - groups = append(groups, string(runes[startIdx:endIdx])) - } else if r == '\'' { - // parse single quoted key - idx++ - startIdx := idx - for { - if idx >= len(runes) { - return nil, fmt.Errorf("unclosed single-quoted key") - } - r = runes[idx] - if r == '\'' { - groups = append(groups, string(runes[startIdx:idx])) - idx++ - break - } - idx++ - } - } else if r == '"' { - // parse double quoted key - idx++ - startIdx := idx - for { - if idx >= len(runes) { - return nil, fmt.Errorf("unclosed double-quoted key") - } - r = runes[idx] - if r == '"' { - groups = append(groups, string(runes[startIdx:idx])) - idx++ - break - } - idx++ - } - } else if r == '.' { - idx++ - if idx >= len(runes) { - return nil, fmt.Errorf("unexpected end of key") - } - r = runes[idx] - if !isValidBareChar(r) && r != '\'' && r != '"' && r != ' ' { - return nil, fmt.Errorf("expecting key part after dot") - } - } else { - return nil, fmt.Errorf("invalid key character: %c", r) - } + if inQuotes { + return nil, errors.New("mismatched quotes") + } + if buffer.Len() > 0 { + groups = append(groups, buffer.String()) } if len(groups) == 0 { - return nil, fmt.Errorf("empty key") + return nil, errors.New("empty key") } return groups, nil } diff --git a/vendor/github.com/pelletier/go-toml/lexer.go b/vendor/github.com/pelletier/go-toml/lexer.go index 6254d390..d11de428 100644 --- a/vendor/github.com/pelletier/go-toml/lexer.go +++ b/vendor/github.com/pelletier/go-toml/lexer.go @@ -309,7 +309,7 @@ func (l *tomlLexer) lexKey() tomlLexStateFn { if err != nil { return l.errorf(err.Error()) } - growingString += "\"" + str + "\"" + growingString += str l.next() continue } else if r == '\'' { @@ -318,15 +318,13 @@ func (l *tomlLexer) lexKey() tomlLexStateFn { if err != nil { return l.errorf(err.Error()) } - growingString += "'" + str + "'" + growingString += str l.next() continue } else if r == '\n' { return l.errorf("keys cannot contain new lines") } else if isSpace(r) { break - } else if r == '.' { - // skip } else if !isValidBareChar(r) { return l.errorf("keys cannot contain %c character", r) } diff --git a/vendor/github.com/pelletier/go-toml/marshal.go b/vendor/github.com/pelletier/go-toml/marshal.go index 0e1c57e8..671da556 100644 --- a/vendor/github.com/pelletier/go-toml/marshal.go +++ b/vendor/github.com/pelletier/go-toml/marshal.go @@ -6,28 +6,20 @@ import ( "fmt" "io" "reflect" - "sort" "strconv" "strings" "time" ) -const ( - tagFieldName = "toml" - tagFieldComment = "comment" - tagCommented = "commented" - tagMultiline = "multiline" - tagDefault = "default" -) +const tagKeyMultiline = "multiline" type tomlOpts struct { - name string - comment string - commented bool - multiline bool - include bool - omitempty bool - defaultValue string + name string + comment string + commented bool + multiline bool + include bool + omitempty bool } type encOpts struct { @@ -39,37 +31,10 @@ var encOptsDefaults = encOpts{ quoteMapKeys: false, } -type annotation struct { - tag string - comment string - commented string - multiline string - defaultValue string -} - -var annotationDefault = annotation{ - tag: tagFieldName, - comment: tagFieldComment, - commented: tagCommented, - multiline: tagMultiline, - defaultValue: tagDefault, -} - -type marshalOrder int - -// Orders the Encoder can write the fields to the output stream. -const ( - // Sort fields alphabetically. - OrderAlphabetical marshalOrder = iota + 1 - // Preserve the order the fields are encountered. For example, the order of fields in - // a struct. - OrderPreserve -) - var timeType = reflect.TypeOf(time.Time{}) var marshalerType = reflect.TypeOf(new(Marshaler)).Elem() -// Check if the given marshal type maps to a Tree primitive +// Check if the given marshall type maps to a Tree primitive func isPrimitive(mtype reflect.Type) bool { switch mtype.Kind() { case reflect.Ptr: @@ -91,7 +56,7 @@ func isPrimitive(mtype reflect.Type) bool { } } -// Check if the given marshal type maps to a Tree slice +// Check if the given marshall type maps to a Tree slice func isTreeSlice(mtype reflect.Type) bool { switch mtype.Kind() { case reflect.Slice: @@ -101,7 +66,7 @@ func isTreeSlice(mtype reflect.Type) bool { } } -// Check if the given marshal type maps to a non-Tree slice +// Check if the given marshall type maps to a non-Tree slice func isOtherSlice(mtype reflect.Type) bool { switch mtype.Kind() { case reflect.Ptr: @@ -113,7 +78,7 @@ func isOtherSlice(mtype reflect.Type) bool { } } -// Check if the given marshal type maps to a Tree +// Check if the given marshall type maps to a Tree func isTree(mtype reflect.Type) bool { switch mtype.Kind() { case reflect.Map: @@ -171,8 +136,6 @@ Tree primitive types and corresponding marshal types: string string, pointers to same bool bool, pointers to same time.Time time.Time{}, pointers to same - -For additional flexibility, use the Encoder API. */ func Marshal(v interface{}) ([]byte, error) { return NewEncoder(nil).marshal(v) @@ -182,21 +145,13 @@ func Marshal(v interface{}) ([]byte, error) { type Encoder struct { w io.Writer encOpts - annotation - line int - col int - order marshalOrder } // NewEncoder returns a new encoder that writes to w. func NewEncoder(w io.Writer) *Encoder { return &Encoder{ - w: w, - encOpts: encOptsDefaults, - annotation: annotationDefault, - line: 0, - col: 1, - order: OrderAlphabetical, + w: w, + encOpts: encOptsDefaults, } } @@ -242,49 +197,11 @@ func (e *Encoder) ArraysWithOneElementPerLine(v bool) *Encoder { return e } -// Order allows to change in which order fields will be written to the output stream. -func (e *Encoder) Order(ord marshalOrder) *Encoder { - e.order = ord - return e -} - -// SetTagName allows changing default tag "toml" -func (e *Encoder) SetTagName(v string) *Encoder { - e.tag = v - return e -} - -// SetTagComment allows changing default tag "comment" -func (e *Encoder) SetTagComment(v string) *Encoder { - e.comment = v - return e -} - -// SetTagCommented allows changing default tag "commented" -func (e *Encoder) SetTagCommented(v string) *Encoder { - e.commented = v - return e -} - -// SetTagMultiline allows changing default tag "multiline" -func (e *Encoder) SetTagMultiline(v string) *Encoder { - e.multiline = v - return e -} - func (e *Encoder) marshal(v interface{}) ([]byte, error) { mtype := reflect.TypeOf(v) - - switch mtype.Kind() { - case reflect.Struct, reflect.Map: - case reflect.Ptr: - if mtype.Elem().Kind() != reflect.Struct { - return []byte{}, errors.New("Only pointer to struct can be marshaled to TOML") - } - default: - return []byte{}, errors.New("Only a struct or map can be marshaled to TOML") + if mtype.Kind() != reflect.Struct { + return []byte{}, errors.New("Only a struct can be marshaled to TOML") } - sval := reflect.ValueOf(v) if isCustomMarshaler(mtype) { return callCustomMarshaler(sval) @@ -295,27 +212,22 @@ func (e *Encoder) marshal(v interface{}) ([]byte, error) { } var buf bytes.Buffer - _, err = t.writeToOrdered(&buf, "", "", 0, e.arraysOneElementPerLine, e.order) + _, err = t.writeTo(&buf, "", "", 0, e.arraysOneElementPerLine) return buf.Bytes(), err } -// Create next tree with a position based on Encoder.line -func (e *Encoder) nextTree() *Tree { - return newTreeWithPosition(Position{Line: e.line, Col: 1}) -} - // Convert given marshal struct or map value to toml tree func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, error) { if mtype.Kind() == reflect.Ptr { return e.valueToTree(mtype.Elem(), mval.Elem()) } - tval := e.nextTree() + tval := newTree() switch mtype.Kind() { case reflect.Struct: for i := 0; i < mtype.NumField(); i++ { mtypef, mvalf := mtype.Field(i), mval.Field(i) - opts := tomlOptions(mtypef, e.annotation) + opts := tomlOptions(mtypef) if opts.include && (!opts.omitempty || !isZero(mvalf)) { val, err := e.valueToToml(mtypef.Type, mvalf) if err != nil { @@ -330,26 +242,7 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er } } case reflect.Map: - keys := mval.MapKeys() - if e.order == OrderPreserve && len(keys) > 0 { - // Sorting []reflect.Value is not straight forward. - // - // OrderPreserve will support deterministic results when string is used - // as the key to maps. - typ := keys[0].Type() - kind := keys[0].Kind() - if kind == reflect.String { - ikeys := make([]string, len(keys)) - for i := range keys { - ikeys[i] = keys[i].Interface().(string) - } - sort.Strings(ikeys) - for i := range ikeys { - keys[i] = reflect.ValueOf(ikeys[i]).Convert(typ) - } - } - } - for _, key := range keys { + for _, key := range mval.MapKeys() { mvalf := mval.MapIndex(key) val, err := e.valueToToml(mtype.Elem(), mvalf) if err != nil { @@ -397,7 +290,6 @@ func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (int // Convert given marshal value to toml value func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface{}, error) { - e.line++ if mtype.Kind() == reflect.Ptr { return e.valueToToml(mtype.Elem(), mval.Elem()) } @@ -415,9 +307,6 @@ func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface case reflect.Bool: return mval.Bool(), nil case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if mtype.Kind() == reflect.Int64 && mtype == reflect.TypeOf(time.Duration(1)) { - return fmt.Sprint(mval), nil - } return mval.Int(), nil case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return mval.Uint(), nil @@ -437,7 +326,7 @@ func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface // Neither Unmarshaler interfaces nor UnmarshalTOML functions are supported for // sub-structs, and only definite types can be unmarshaled. func (t *Tree) Unmarshal(v interface{}) error { - d := Decoder{tval: t, tagName: tagFieldName} + d := Decoder{tval: t} return d.unmarshal(v) } @@ -458,14 +347,6 @@ func (t *Tree) Marshal() ([]byte, error) { // The following struct annotations are supported: // // toml:"Field" Overrides the field's name to map to. -// default:"foo" Provides a default value. -// -// For default values, only fields of the following types are supported: -// * string -// * bool -// * int -// * int64 -// * float64 // // See Marshal() documentation for types mapping table. func Unmarshal(data []byte, v interface{}) error { @@ -481,7 +362,6 @@ type Decoder struct { r io.Reader tval *Tree encOpts - tagName string } // NewDecoder returns a new decoder that reads from r. @@ -489,7 +369,6 @@ func NewDecoder(r io.Reader) *Decoder { return &Decoder{ r: r, encOpts: encOptsDefaults, - tagName: tagFieldName, } } @@ -506,27 +385,13 @@ func (d *Decoder) Decode(v interface{}) error { return d.unmarshal(v) } -// SetTagName allows changing default tag "toml" -func (d *Decoder) SetTagName(v string) *Decoder { - d.tagName = v - return d -} - func (d *Decoder) unmarshal(v interface{}) error { mtype := reflect.TypeOf(v) - if mtype.Kind() != reflect.Ptr { - return errors.New("only a pointer to struct or map can be unmarshaled from TOML") + if mtype.Kind() != reflect.Ptr || mtype.Elem().Kind() != reflect.Struct { + return errors.New("Only a pointer to struct can be unmarshaled from TOML") } - elem := mtype.Elem() - - switch elem.Kind() { - case reflect.Struct, reflect.Map: - default: - return errors.New("only a pointer to struct or map can be unmarshaled from TOML") - } - - sval, err := d.valueFromTree(elem, d.tval) + sval, err := d.valueFromTree(mtype.Elem(), d.tval) if err != nil { return err } @@ -545,18 +410,10 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree) (reflect.Value, mval = reflect.New(mtype).Elem() for i := 0; i < mtype.NumField(); i++ { mtypef := mtype.Field(i) - an := annotation{tag: d.tagName} - opts := tomlOptions(mtypef, an) + opts := tomlOptions(mtypef) if opts.include { baseKey := opts.name - keysToTry := []string{ - baseKey, - strings.ToLower(baseKey), - strings.ToTitle(baseKey), - strings.ToLower(string(baseKey[0])) + baseKey[1:], - } - - found := false + keysToTry := []string{baseKey, strings.ToLower(baseKey), strings.ToTitle(baseKey)} for _, key := range keysToTry { exists := tval.Has(key) if !exists { @@ -568,42 +425,8 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree) (reflect.Value, return mval, formatError(err, tval.GetPosition(key)) } mval.Field(i).Set(mvalf) - found = true break } - - if !found && opts.defaultValue != "" { - mvalf := mval.Field(i) - var val interface{} - var err error - switch mvalf.Kind() { - case reflect.Bool: - val, err = strconv.ParseBool(opts.defaultValue) - if err != nil { - return mval.Field(i), err - } - case reflect.Int: - val, err = strconv.Atoi(opts.defaultValue) - if err != nil { - return mval.Field(i), err - } - case reflect.String: - val = opts.defaultValue - case reflect.Int64: - val, err = strconv.ParseInt(opts.defaultValue, 10, 64) - if err != nil { - return mval.Field(i), err - } - case reflect.Float64: - val, err = strconv.ParseFloat(opts.defaultValue, 64) - if err != nil { - return mval.Field(i), err - } - default: - return mval.Field(i), fmt.Errorf("unsuported field type for default option") - } - mval.Field(i).Set(reflect.ValueOf(val)) - } } } case reflect.Map: @@ -615,7 +438,7 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree) (reflect.Value, if err != nil { return mval, formatError(err, tval.GetPosition(key)) } - mval.SetMapIndex(reflect.ValueOf(key).Convert(mtype.Key()), mvalf) + mval.SetMapIndex(reflect.ValueOf(key), mvalf) } } return mval, nil @@ -653,20 +476,20 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}) (reflect.V return d.unwrapPointer(mtype, tval) } - switch t := tval.(type) { + switch tval.(type) { case *Tree: if isTree(mtype) { - return d.valueFromTree(mtype, t) + return d.valueFromTree(mtype, tval.(*Tree)) } return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a tree", tval, tval) case []*Tree: if isTreeSlice(mtype) { - return d.valueFromTreeSlice(mtype, t) + return d.valueFromTreeSlice(mtype, tval.([]*Tree)) } return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to trees", tval, tval) case []interface{}: if isOtherSlice(mtype) { - return d.valueFromOtherSlice(mtype, t) + return d.valueFromOtherSlice(mtype, tval.([]interface{})) } return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval) default: @@ -689,17 +512,10 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}) (reflect.V return val.Convert(mtype), nil case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: val := reflect.ValueOf(tval) - if mtype.Kind() == reflect.Int64 && mtype == reflect.TypeOf(time.Duration(1)) && val.Kind() == reflect.String { - d, err := time.ParseDuration(val.String()) - if err != nil { - return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v. %s", tval, tval, mtype.String(), err) - } - return reflect.ValueOf(d), nil - } if !val.Type().ConvertibleTo(mtype) { return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) } - if reflect.Indirect(reflect.New(mtype)).OverflowInt(val.Convert(mtype).Int()) { + if reflect.Indirect(reflect.New(mtype)).OverflowInt(val.Int()) { return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) } @@ -709,11 +525,10 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}) (reflect.V if !val.Type().ConvertibleTo(mtype) { return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) } - - if val.Convert(reflect.TypeOf(int(1))).Int() < 0 { + if val.Int() < 0 { return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String()) } - if reflect.Indirect(reflect.New(mtype)).OverflowUint(uint64(val.Convert(mtype).Uint())) { + if reflect.Indirect(reflect.New(mtype)).OverflowUint(uint64(val.Int())) { return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) } @@ -723,7 +538,7 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}) (reflect.V if !val.Type().ConvertibleTo(mtype) { return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) } - if reflect.Indirect(reflect.New(mtype)).OverflowFloat(val.Convert(mtype).Float()) { + if reflect.Indirect(reflect.New(mtype)).OverflowFloat(val.Float()) { return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) } @@ -744,25 +559,16 @@ func (d *Decoder) unwrapPointer(mtype reflect.Type, tval interface{}) (reflect.V return mval, nil } -func tomlOptions(vf reflect.StructField, an annotation) tomlOpts { - tag := vf.Tag.Get(an.tag) +func tomlOptions(vf reflect.StructField) tomlOpts { + tag := vf.Tag.Get("toml") parse := strings.Split(tag, ",") var comment string - if c := vf.Tag.Get(an.comment); c != "" { + if c := vf.Tag.Get("comment"); c != "" { comment = c } - commented, _ := strconv.ParseBool(vf.Tag.Get(an.commented)) - multiline, _ := strconv.ParseBool(vf.Tag.Get(an.multiline)) - defaultValue := vf.Tag.Get(tagDefault) - result := tomlOpts{ - name: vf.Name, - comment: comment, - commented: commented, - multiline: multiline, - include: true, - omitempty: false, - defaultValue: defaultValue, - } + commented, _ := strconv.ParseBool(vf.Tag.Get("commented")) + multiline, _ := strconv.ParseBool(vf.Tag.Get(tagKeyMultiline)) + result := tomlOpts{name: vf.Name, comment: comment, commented: commented, multiline: multiline, include: true, omitempty: false} if parse[0] != "" { if parse[0] == "-" && len(parse) == 1 { result.include = false diff --git a/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_Map_test.toml b/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_Map_test.toml deleted file mode 100644 index a3bd5130..00000000 --- a/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_Map_test.toml +++ /dev/null @@ -1,17 +0,0 @@ -title = "TOML Marshal Testing" - -[basic_map] - one = "one" - two = "two" - -[long_map] - a7 = "1" - b3 = "2" - c8 = "3" - d4 = "4" - e6 = "5" - f5 = "6" - g10 = "7" - h1 = "8" - i2 = "9" - j9 = "10" diff --git a/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_test.toml b/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_test.toml deleted file mode 100644 index 9d68b599..00000000 --- a/vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_test.toml +++ /dev/null @@ -1,38 +0,0 @@ -title = "TOML Marshal Testing" - -[basic_lists] - floats = [12.3,45.6,78.9] - bools = [true,false,true] - dates = [1979-05-27T07:32:00Z,1980-05-27T07:32:00Z] - ints = [8001,8001,8002] - uints = [5002,5003] - strings = ["One","Two","Three"] - -[[subdocptrs]] - name = "Second" - -[basic_map] - one = "one" - two = "two" - -[subdoc] - - [subdoc.second] - name = "Second" - - [subdoc.first] - name = "First" - -[basic] - uint = 5001 - bool = true - float = 123.4 - int = 5000 - string = "Bite me" - date = 1979-05-27T07:32:00Z - -[[subdoclist]] - name = "List.First" - -[[subdoclist]] - name = "List.Second" diff --git a/vendor/github.com/pelletier/go-toml/parser.go b/vendor/github.com/pelletier/go-toml/parser.go index a7498e49..2d27599a 100644 --- a/vendor/github.com/pelletier/go-toml/parser.go +++ b/vendor/github.com/pelletier/go-toml/parser.go @@ -77,10 +77,8 @@ func (p *tomlParser) parseStart() tomlParserStateFn { return p.parseAssign case tokenEOF: return nil - case tokenError: - p.raiseError(tok, "parsing error: %s", tok.String()) default: - p.raiseError(tok, "unexpected token %s", tok.typ) + p.raiseError(tok, "unexpected token") } return nil } @@ -167,11 +165,6 @@ func (p *tomlParser) parseAssign() tomlParserStateFn { key := p.getToken() p.assume(tokenEqual) - parsedKey, err := parseKey(key.val) - if err != nil { - p.raiseError(key, "invalid key: %s", err.Error()) - } - value := p.parseRvalue() var tableKey []string if len(p.currentTable) > 0 { @@ -180,9 +173,6 @@ func (p *tomlParser) parseAssign() tomlParserStateFn { tableKey = []string{} } - prefixKey := parsedKey[0 : len(parsedKey)-1] - tableKey = append(tableKey, prefixKey...) - // find the table to assign, looking out for arrays of tables var targetNode *Tree switch node := p.tree.GetPath(tableKey).(type) { @@ -190,19 +180,17 @@ func (p *tomlParser) parseAssign() tomlParserStateFn { targetNode = node[len(node)-1] case *Tree: targetNode = node - case nil: - // create intermediate - if err := p.tree.createSubTree(tableKey, key.Position); err != nil { - p.raiseError(key, "could not create intermediate group: %s", err) - } - targetNode = p.tree.GetPath(tableKey).(*Tree) default: p.raiseError(key, "Unknown table type for path: %s", strings.Join(tableKey, ".")) } // assign value to the found table - keyVal := parsedKey[len(parsedKey)-1] + keyVals := []string{key.val} + if len(keyVals) != 1 { + p.raiseError(key, "Invalid key") + } + keyVal := keyVals[0] localKey := []string{keyVal} finalKey := append(tableKey, keyVal) if targetNode.GetPath(localKey) != nil { @@ -350,7 +338,7 @@ Loop: case tokenRightCurlyBrace: p.getToken() break Loop - case tokenKey, tokenInteger, tokenString: + case tokenKey: if !tokenIsComma(previous) && previous != nil { p.raiseError(follow, "comma expected between fields in inline table") } diff --git a/vendor/github.com/pelletier/go-toml/test.sh b/vendor/github.com/pelletier/go-toml/test.sh new file mode 100755 index 00000000..ba6adf3f --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/test.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# fail out of the script if anything here fails +set -e +set -o pipefail + +# set the path to the present working directory +export GOPATH=`pwd` + +function git_clone() { + path=$1 + branch=$2 + version=$3 + if [ ! -d "src/$path" ]; then + mkdir -p src/$path + git clone https://$path.git src/$path + fi + pushd src/$path + git checkout "$branch" + git reset --hard "$version" + popd +} + +# Remove potential previous runs +rm -rf src test_program_bin toml-test + +go get github.com/pelletier/go-buffruneio +go get github.com/davecgh/go-spew/spew +go get gopkg.in/yaml.v2 +go get github.com/BurntSushi/toml + +# get code for BurntSushi TOML validation +# pinning all to 'HEAD' for version 0.3.x work (TODO: pin to commit hash when tests stabilize) +git_clone github.com/BurntSushi/toml master HEAD +git_clone github.com/BurntSushi/toml-test master HEAD #was: 0.2.0 HEAD + +# build the BurntSushi test application +go build -o toml-test github.com/BurntSushi/toml-test + +# vendorize the current lib for testing +# NOTE: this basically mocks an install without having to go back out to github for code +mkdir -p src/github.com/pelletier/go-toml/cmd +mkdir -p src/github.com/pelletier/go-toml/query +cp *.go *.toml src/github.com/pelletier/go-toml +cp -R cmd/* src/github.com/pelletier/go-toml/cmd +cp -R query/* src/github.com/pelletier/go-toml/query +go build -o test_program_bin src/github.com/pelletier/go-toml/cmd/test_program.go + +# Run basic unit tests +go test github.com/pelletier/go-toml -covermode=count -coverprofile=coverage.out +go test github.com/pelletier/go-toml/cmd/tomljson +go test github.com/pelletier/go-toml/query + +# run the entire BurntSushi test suite +if [[ $# -eq 0 ]] ; then + echo "Running all BurntSushi tests" + ./toml-test ./test_program_bin | tee test_out +else + # run a specific test + test=$1 + test_path='src/github.com/BurntSushi/toml-test/tests' + valid_test="$test_path/valid/$test" + invalid_test="$test_path/invalid/$test" + + if [ -e "$valid_test.toml" ]; then + echo "Valid Test TOML for $test:" + echo "====" + cat "$valid_test.toml" + + echo "Valid Test JSON for $test:" + echo "====" + cat "$valid_test.json" + + echo "Go-TOML Output for $test:" + echo "====" + cat "$valid_test.toml" | ./test_program_bin + fi + + if [ -e "$invalid_test.toml" ]; then + echo "Invalid Test TOML for $test:" + echo "====" + cat "$invalid_test.toml" + + echo "Go-TOML Output for $test:" + echo "====" + echo "go-toml Output:" + cat "$invalid_test.toml" | ./test_program_bin + fi +fi diff --git a/vendor/github.com/pelletier/go-toml/toml.go b/vendor/github.com/pelletier/go-toml/toml.go index 358a9be5..98c185ad 100644 --- a/vendor/github.com/pelletier/go-toml/toml.go +++ b/vendor/github.com/pelletier/go-toml/toml.go @@ -27,13 +27,9 @@ type Tree struct { } func newTree() *Tree { - return newTreeWithPosition(Position{}) -} - -func newTreeWithPosition(pos Position) *Tree { return &Tree{ values: make(map[string]interface{}), - position: pos, + position: Position{}, } } @@ -198,10 +194,10 @@ func (t *Tree) SetWithOptions(key string, opts SetOptions, value interface{}) { // formatting instructions to the key, that will be reused by Marshal(). func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interface{}) { subtree := t - for i, intermediateKey := range keys[:len(keys)-1] { + for _, intermediateKey := range keys[:len(keys)-1] { nextTree, exists := subtree.values[intermediateKey] if !exists { - nextTree = newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}) + nextTree = newTree() subtree.values[intermediateKey] = nextTree // add new element here } switch node := nextTree.(type) { @@ -211,7 +207,7 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac // go to most recent element if len(node) == 0 { // create element if it does not exist - subtree.values[intermediateKey] = append(node, newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col})) + subtree.values[intermediateKey] = append(node, newTree()) } subtree = node[len(node)-1] } @@ -219,21 +215,19 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac var toInsert interface{} - switch v := value.(type) { + switch value.(type) { case *Tree: - v.comment = opts.Comment + tt := value.(*Tree) + tt.comment = opts.Comment toInsert = value case []*Tree: toInsert = value case *tomlValue: - v.comment = opts.Comment - toInsert = v + tt := value.(*tomlValue) + tt.comment = opts.Comment + toInsert = tt default: - toInsert = &tomlValue{value: value, - comment: opts.Comment, - commented: opts.Commented, - multiline: opts.Multiline, - position: Position{Line: subtree.position.Line + len(subtree.values) + 1, Col: subtree.position.Col}} + toInsert = &tomlValue{value: value, comment: opts.Comment, commented: opts.Commented, multiline: opts.Multiline} } subtree.values[keys[len(keys)-1]] = toInsert @@ -262,35 +256,44 @@ func (t *Tree) SetPath(keys []string, value interface{}) { // SetPathWithComment is the same as SetPath, but allows you to provide comment // information to the key, that will be reused by Marshal(). func (t *Tree) SetPathWithComment(keys []string, comment string, commented bool, value interface{}) { - t.SetPathWithOptions(keys, SetOptions{Comment: comment, Commented: commented}, value) -} - -// Delete removes a key from the tree. -// Key is a dot-separated path (e.g. a.b.c). -func (t *Tree) Delete(key string) error { - keys, err := parseKey(key) - if err != nil { - return err + subtree := t + for _, intermediateKey := range keys[:len(keys)-1] { + nextTree, exists := subtree.values[intermediateKey] + if !exists { + nextTree = newTree() + subtree.values[intermediateKey] = nextTree // add new element here + } + switch node := nextTree.(type) { + case *Tree: + subtree = node + case []*Tree: + // go to most recent element + if len(node) == 0 { + // create element if it does not exist + subtree.values[intermediateKey] = append(node, newTree()) + } + subtree = node[len(node)-1] + } } - return t.DeletePath(keys) -} -// DeletePath removes a key from the tree. -// Keys is an array of path elements (e.g. {"a","b","c"}). -func (t *Tree) DeletePath(keys []string) error { - keyLen := len(keys) - if keyLen == 1 { - delete(t.values, keys[0]) - return nil - } - tree := t.GetPath(keys[:keyLen-1]) - item := keys[keyLen-1] - switch node := tree.(type) { + var toInsert interface{} + + switch value.(type) { case *Tree: - delete(node.values, item) - return nil + tt := value.(*Tree) + tt.comment = comment + toInsert = value + case []*Tree: + toInsert = value + case *tomlValue: + tt := value.(*tomlValue) + tt.comment = comment + toInsert = tt + default: + toInsert = &tomlValue{value: value, comment: comment, commented: commented} } - return errors.New("no such key to delete") + + subtree.values[keys[len(keys)-1]] = toInsert } // createSubTree takes a tree and a key and create the necessary intermediate @@ -302,10 +305,10 @@ func (t *Tree) DeletePath(keys []string) error { // Returns nil on success, error object on failure func (t *Tree) createSubTree(keys []string, pos Position) error { subtree := t - for i, intermediateKey := range keys { + for _, intermediateKey := range keys { nextTree, exists := subtree.values[intermediateKey] if !exists { - tree := newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}) + tree := newTree() tree.position = pos subtree.values[intermediateKey] = tree nextTree = tree @@ -334,39 +337,10 @@ func LoadBytes(b []byte) (tree *Tree, err error) { err = errors.New(r.(string)) } }() - - if len(b) >= 4 && (hasUTF32BigEndianBOM4(b) || hasUTF32LittleEndianBOM4(b)) { - b = b[4:] - } else if len(b) >= 3 && hasUTF8BOM3(b) { - b = b[3:] - } else if len(b) >= 2 && (hasUTF16BigEndianBOM2(b) || hasUTF16LittleEndianBOM2(b)) { - b = b[2:] - } - tree = parseToml(lexToml(b)) return } -func hasUTF16BigEndianBOM2(b []byte) bool { - return b[0] == 0xFE && b[1] == 0xFF -} - -func hasUTF16LittleEndianBOM2(b []byte) bool { - return b[0] == 0xFF && b[1] == 0xFE -} - -func hasUTF8BOM3(b []byte) bool { - return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF -} - -func hasUTF32BigEndianBOM4(b []byte) bool { - return b[0] == 0x00 && b[1] == 0x00 && b[2] == 0xFE && b[3] == 0xFF -} - -func hasUTF32LittleEndianBOM4(b []byte) bool { - return b[0] == 0xFF && b[1] == 0xFE && b[2] == 0x00 && b[3] == 0x00 -} - // LoadReader creates a Tree from any io.Reader. func LoadReader(reader io.Reader) (tree *Tree, err error) { inputBytes, err := ioutil.ReadAll(reader) diff --git a/vendor/github.com/pelletier/go-toml/tomltree_write.go b/vendor/github.com/pelletier/go-toml/tomltree_write.go index 198d5ac1..e4049e29 100644 --- a/vendor/github.com/pelletier/go-toml/tomltree_write.go +++ b/vendor/github.com/pelletier/go-toml/tomltree_write.go @@ -12,18 +12,6 @@ import ( "time" ) -type valueComplexity int - -const ( - valueSimple valueComplexity = iota + 1 - valueComplex -) - -type sortNode struct { - key string - complexity valueComplexity -} - // Encodes a string to a TOML-compliant multi-line string value // This function is a clone of the existing encodeTomlString function, except that whitespace characters // are preserved. Quotation marks and backslashes are also not escaped. @@ -165,200 +153,111 @@ func tomlValueStringRepresentation(v interface{}, indent string, arraysOneElemen return "", fmt.Errorf("unsupported value type %T: %v", v, v) } -func getTreeArrayLine(trees []*Tree) (line int) { - // get lowest line number that is not 0 - for _, tv := range trees { - if tv.position.Line < line || line == 0 { - line = tv.position.Line - } - } - return -} - -func sortByLines(t *Tree) (vals []sortNode) { - var ( - line int - lines []int - tv *Tree - tom *tomlValue - node sortNode - ) - vals = make([]sortNode, 0) - m := make(map[int]sortNode) - - for k := range t.values { - v := t.values[k] - switch v.(type) { - case *Tree: - tv = v.(*Tree) - line = tv.position.Line - node = sortNode{key: k, complexity: valueComplex} - case []*Tree: - line = getTreeArrayLine(v.([]*Tree)) - node = sortNode{key: k, complexity: valueComplex} - default: - tom = v.(*tomlValue) - line = tom.position.Line - node = sortNode{key: k, complexity: valueSimple} - } - lines = append(lines, line) - vals = append(vals, node) - m[line] = node - } - sort.Ints(lines) - - for i, line := range lines { - vals[i] = m[line] - } - - return vals -} - -func sortAlphabetical(t *Tree) (vals []sortNode) { - var ( - node sortNode - simpVals []string - compVals []string - ) - vals = make([]sortNode, 0) - m := make(map[string]sortNode) +func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) { + simpleValuesKeys := make([]string, 0) + complexValuesKeys := make([]string, 0) for k := range t.values { v := t.values[k] switch v.(type) { case *Tree, []*Tree: - node = sortNode{key: k, complexity: valueComplex} - compVals = append(compVals, node.key) + complexValuesKeys = append(complexValuesKeys, k) default: - node = sortNode{key: k, complexity: valueSimple} - simpVals = append(simpVals, node.key) + simpleValuesKeys = append(simpleValuesKeys, k) } - vals = append(vals, node) - m[node.key] = node } - // Simples first to match previous implementation - sort.Strings(simpVals) - i := 0 - for _, key := range simpVals { - vals[i] = m[key] - i++ - } + sort.Strings(simpleValuesKeys) + sort.Strings(complexValuesKeys) - sort.Strings(compVals) - for _, key := range compVals { - vals[i] = m[key] - i++ - } + for _, k := range simpleValuesKeys { + v, ok := t.values[k].(*tomlValue) + if !ok { + return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k]) + } - return vals -} + repr, err := tomlValueStringRepresentation(v, indent, arraysOneElementPerLine) + if err != nil { + return bytesCount, err + } -func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) { - return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical) -} - -func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool, ord marshalOrder) (int64, error) { - var orderedVals []sortNode - - switch ord { - case OrderPreserve: - orderedVals = sortByLines(t) - default: - orderedVals = sortAlphabetical(t) - } - - for _, node := range orderedVals { - switch node.complexity { - case valueComplex: - k := node.key - v := t.values[k] - - combinedKey := k - if keyspace != "" { - combinedKey = keyspace + "." + combinedKey + if v.comment != "" { + comment := strings.Replace(v.comment, "\n", "\n"+indent+"#", -1) + start := "# " + if strings.HasPrefix(comment, "#") { + start = "" } - var commented string - if t.commented { - commented = "# " + writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment, "\n") + bytesCount += int64(writtenBytesCountComment) + if errc != nil { + return bytesCount, errc } + } - switch node := v.(type) { - // node has to be of those two types given how keys are sorted above - case *Tree: - tv, ok := t.values[k].(*Tree) - if !ok { - return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k]) - } - if tv.comment != "" { - comment := strings.Replace(tv.comment, "\n", "\n"+indent+"#", -1) - start := "# " - if strings.HasPrefix(comment, "#") { - start = "" - } - writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment) - bytesCount += int64(writtenBytesCountComment) - if errc != nil { - return bytesCount, errc - } - } - writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[", combinedKey, "]\n") - bytesCount += int64(writtenBytesCount) - if err != nil { - return bytesCount, err - } - bytesCount, err = node.writeToOrdered(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine, ord) - if err != nil { - return bytesCount, err - } - case []*Tree: - for _, subTree := range node { - writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[[", combinedKey, "]]\n") - bytesCount += int64(writtenBytesCount) - if err != nil { - return bytesCount, err - } + var commented string + if v.commented { + commented = "# " + } + writtenBytesCount, err := writeStrings(w, indent, commented, k, " = ", repr, "\n") + bytesCount += int64(writtenBytesCount) + if err != nil { + return bytesCount, err + } + } - bytesCount, err = subTree.writeToOrdered(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine, ord) - if err != nil { - return bytesCount, err - } - } - } - default: // Simple - k := node.key - v, ok := t.values[k].(*tomlValue) + for _, k := range complexValuesKeys { + v := t.values[k] + + combinedKey := k + if keyspace != "" { + combinedKey = keyspace + "." + combinedKey + } + var commented string + if t.commented { + commented = "# " + } + + switch node := v.(type) { + // node has to be of those two types given how keys are sorted above + case *Tree: + tv, ok := t.values[k].(*Tree) if !ok { return bytesCount, fmt.Errorf("invalid value type at %s: %T", k, t.values[k]) } - - repr, err := tomlValueStringRepresentation(v, indent, arraysOneElementPerLine) - if err != nil { - return bytesCount, err - } - - if v.comment != "" { - comment := strings.Replace(v.comment, "\n", "\n"+indent+"#", -1) + if tv.comment != "" { + comment := strings.Replace(tv.comment, "\n", "\n"+indent+"#", -1) start := "# " if strings.HasPrefix(comment, "#") { start = "" } - writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment, "\n") + writtenBytesCountComment, errc := writeStrings(w, "\n", indent, start, comment) bytesCount += int64(writtenBytesCountComment) if errc != nil { return bytesCount, errc } } - - var commented string - if v.commented { - commented = "# " - } - writtenBytesCount, err := writeStrings(w, indent, commented, k, " = ", repr, "\n") + writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[", combinedKey, "]\n") bytesCount += int64(writtenBytesCount) if err != nil { return bytesCount, err } + bytesCount, err = node.writeTo(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine) + if err != nil { + return bytesCount, err + } + case []*Tree: + for _, subTree := range node { + writtenBytesCount, err := writeStrings(w, "\n", indent, commented, "[[", combinedKey, "]]\n") + bytesCount += int64(writtenBytesCount) + if err != nil { + return bytesCount, err + } + + bytesCount, err = subTree.writeTo(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine) + if err != nil { + return bytesCount, err + } + } } } diff --git a/vendor/github.com/polydawn/refmt/.gitignore b/vendor/github.com/polydawn/refmt/.gitignore deleted file mode 100644 index 9010fa35..00000000 --- a/vendor/github.com/polydawn/refmt/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.gopath/pkg -.gopath/tmp diff --git a/vendor/github.com/polydawn/refmt/.gitmodules b/vendor/github.com/polydawn/refmt/.gitmodules deleted file mode 100644 index 1106688a..00000000 --- a/vendor/github.com/polydawn/refmt/.gitmodules +++ /dev/null @@ -1,18 +0,0 @@ -[submodule ".gopath/src/github.com/smartystreets/goconvey"] - path = .gopath/src/github.com/smartystreets/goconvey - url = https://github.com/smartystreets/goconvey -[submodule ".gopath/src/github.com/smartystreets/assertions"] - path = .gopath/src/github.com/smartystreets/assertions - url = https://github.com/smartystreets/assertions -[submodule ".gopath/src/github.com/jtolds/gls"] - path = .gopath/src/github.com/jtolds/gls - url = https://github.com/jtolds/gls -[submodule ".gopath/src/github.com/urfave/cli"] - path = .gopath/src/github.com/urfave/cli - url = https://github.com/urfave/cli/ -[submodule ".gopath/src/github.com/go-yaml/yaml"] - path = .gopath/src/github.com/go-yaml/yaml - url = https://github.com/go-yaml/yaml/ -[submodule ".gopath/src/github.com/warpfork/go-wish"] - path = .gopath/src/github.com/warpfork/go-wish - url = https://github.com/warpfork/go-wish diff --git a/vendor/github.com/polydawn/refmt/.gopath/self b/vendor/github.com/polydawn/refmt/.gopath/self deleted file mode 120000 index 1ecb86ef..00000000 --- a/vendor/github.com/polydawn/refmt/.gopath/self +++ /dev/null @@ -1 +0,0 @@ -src/github.com/polydawn/refmt \ No newline at end of file diff --git a/vendor/github.com/polydawn/refmt/.gopath/src/github.com/polydawn/refmt b/vendor/github.com/polydawn/refmt/.gopath/src/github.com/polydawn/refmt deleted file mode 120000 index 11a54ed3..00000000 --- a/vendor/github.com/polydawn/refmt/.gopath/src/github.com/polydawn/refmt +++ /dev/null @@ -1 +0,0 @@ -../../../../ \ No newline at end of file diff --git a/vendor/github.com/polydawn/refmt/.travis.yml b/vendor/github.com/polydawn/refmt/.travis.yml deleted file mode 100644 index 2dcf3f2f..00000000 --- a/vendor/github.com/polydawn/refmt/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - "1.10" - - 1.9 - -# I know I like my dependencies specified by custom meta tags in HTML! -# Oh wait, no. No I don't. -install: true - -script: - - ./goad - -notifications: - email: false diff --git a/vendor/github.com/polydawn/refmt/LICENSE b/vendor/github.com/polydawn/refmt/LICENSE deleted file mode 100644 index 9f30daa0..00000000 --- a/vendor/github.com/polydawn/refmt/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Eric Myhre - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/polydawn/refmt/README.md b/vendor/github.com/polydawn/refmt/README.md deleted file mode 100644 index 6441722f..00000000 --- a/vendor/github.com/polydawn/refmt/README.md +++ /dev/null @@ -1,78 +0,0 @@ -refmt [![GoDoc](https://godoc.org/github.com/polydawn/refmt?status.svg)](https://godoc.org/github.com/polydawn/refmt) [![Build status](https://img.shields.io/travis/polydawn/refmt/master.svg?style=flat-square)](https://travis-ci.org/polydawn/refmt) -===== - - -`refmt` is a serialization and object-mapping library. - - - -Why? ----- - -Mostly because I have some types which I need to encode in two different ways, and that needs to not suck, -and that totally sucks with most serialization libraries I've used. -Also, I need to serialize things in different formats, e.g. sometimes JSON and other times CBOR, -and that needs to work without me wrestling two different object-serial libraries and configs. - -More broadly, I want a single library that can handle my serialization -- with the possibility of different setups on the same types -- and if it can do general object traversals, e.g. a deepcopy, that also seems like... just something that should be natural. - -So it seems like there should be some way to define token streams... and a way to define converting objects to and from token streams... and a way to covert token streams to and from serialized bytes... and all of these should be pretty separate! - -Thusly was this library thrust into the world: -`refmt/tok` to define the token stream, -and `refmt/obj` to define how to map objects to tokens and back, -and `refmt/json` and `refmt/cbor` as ways to exchange tokens with serialized formats. - -All of these formats can mix-n-match freely, because they communicate values as the standard token stream. Voilà: - -- pair `obj.Marshaller` with `json.Encoder` to get a json serializer. -- pair `cbor.Decoder` with `obj.Unmarshaller` to get a cbor deserializer. -- pair `cbor.Decoder` with `json.Encoder` to get a cbor->json streaming transcoder! -- pair `obj.Marshaller` with `obj.Unmarshaller` to get a deep-copy system! (Try it with two different types: marshalling a struct and unmarshalling into a freeform map!) - -Along the way, we've added a powerful system for defining **how** exactly the `refmt/obj` tools should treat your structures: -the Atlas system (defined in the `refmt/obj/atlas` package). -Atlases can be used to customize how struct fields are handled, how map keys are sorted, and even -define conversions between completely different *kinds* of objects: serialize arrays as strings, or turn stringy enums into bitfields, no problem. -By default, `refmt` will generate atlases automatically for your structs and types, just like the standard library json marshallers do; -if you want more control, atlases give you the power. - -An Atlas can be given to each `obj.Marshaller` and `obj.Unmarshaller` when it is constructed. -This allows great variation in how you wish to handle types -- more than one mapping can be defined for the same concrete type! -(This is a killer feature if you need to support multiple versions of an API, for example: -you can define 'v1' and 'v2' types, each with their own structs to unmarshal user requests into; -then in the backend implement another Marshal/Unmarshal with different atlases which translates the 'v1' requests to 'v2' types, -and you only have to implement business logic against the latest types!) - -Atlases are significantly more convenient to use than defining custom `JSONMarshal()` methods. -Atlases attach to the type they concern. -This means you can use atlases to define custom serialization even for types in packages you can't modify! -Atlases also behave better in complex situations: for example, -if you have a `TypeFoo` struct and you wish to serialize it as a string, -*you don't have to write a custom marshaller for every type that **contains** a `TypeFoo` field*. -Leaking details of custom serialization into the types that contain the interesting objects is -a common pitfall when getting into advanced usage of other marshalling libraries; `refmt` has no such issue. - -## tl;dr: - -- you can swap out atlases for custom serialization on any type; -- and that works for serialization modes even deep in other structures; -- and even on types you don't own!! -- at the same time, you can swap out a cbor encoder for a json encoder, or anything else you want; -- and the mapper part *doesn't care* -- no complex interactions between the layers. - -Come to `refmt`. It's nicer here. - - -Where do I start? ------------------ - -**If you're already using `json.Marshal`:** switch to `json.Marshal` (yes, I'm not kidding; just switch your imports!). - -**If you're already using `json.NewEncoder().Encode()`:** switch to `json.NewMarshaller().Marshal()`. - -**If you want to get more serial-flexible:** try using `refmt.Marshal(json.EncodeOptions{}, obj)`... then switch to `cbor.EncodeOptions{}` and see what happens! - -**If you want to use Atlas to get fancy:** go take a peek at the `example*.go` files in this repo! :) - -Happy hacking! diff --git a/vendor/github.com/polydawn/refmt/allochound b/vendor/github.com/polydawn/refmt/allochound deleted file mode 100755 index 304b6bd2..00000000 --- a/vendor/github.com/polydawn/refmt/allochound +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -set -euo pipefail - -### Normalize path -- all work should be relative to this script's location. -## Set up gopath -- also relative to this dir, so we work in isolation. -cd "$( dirname "${BASH_SOURCE[0]}" )" -export GOPATH="$PWD/.gopath/" - -funcs=() -funcs+=("Benchmark_ArrayFlatIntToJson_Refmt") -funcs+=("Benchmark_ArrayFlatIntToJson_Stdlib") -funcs+=("Benchmark_ArrayFlatStrToJson_Refmt") -funcs+=("Benchmark_ArrayFlatStrToJson_Stdlib") - -funcs+=("Benchmark_StructToJson_Refmt") -funcs+=("Benchmark_StructToJson_Stdlib") - -profPath=".gopath/tmp/prof/" ; mkdir -p "$profPath" -go test -i . -export GODEBUG=allocfreetrace=1 -while read -r -u3 -d' ' func; do - (go test \ - -run=XXX -bench=$func \ - -count=1 - ) 2> "$profPath/$func.allocfreetrace" | grep "^Benchmark_" -done 3< <(echo "${funcs[@]} ") -ls -lah "$profPath"/*.allocfreetrace - -## -## Recommendations for extracting knowledge: -## - grep for 'refmt' lines with context ~8 -## - you really want to get the 'tracealloc' lines in sight, because they list the object type being allocated in plain english -## - to find the beginning of a run, it's currently correct to grep for 'api.go', then find the start of pump.Run, -## then feed that line number back into a grep (where your first grep for refmt lines emits line numbers). -## - you'll see ~3 different line numbers from api.go; the least frequent is the start of Run. -## - grepping ", tok.Token)" is also valid, since we have succeeded at only allocating that once per Run -## (though actually it's a bit of a wonder to me that it doesn't stay on the stack). -## - -## -## More generally: want: -## - foreach tracealloc line: that line -## - accept the following '^goroutine' line -## - skip lines matching '^runtime.' and '^t' -## - maybe keep the '^runtime.' lines, because they tell you if 'newObject' vs 'makeSlice' -## - accept two lines -- this is the proximate cause, call and source file. -## - you can probably discard the rest -## - -## -## ALTERNATIVELY to all of this: -## just try '-gcflags -m' for things. Result is much shorter, much faster, much more to the point. -## diff --git a/vendor/github.com/polydawn/refmt/cbor/cborCommon.go b/vendor/github.com/polydawn/refmt/cbor/cborCommon.go deleted file mode 100644 index ffc36b20..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborCommon.go +++ /dev/null @@ -1,44 +0,0 @@ -package cbor - -// "Major types" enum, as per https://tools.ietf.org/html/rfc7049#section-2.1 . -// -// These numbers are the bottom of the range for that major type when encoded; -// that is, ints can be between `cborMajorUint` (inclusive) and `cborMajorNegInt` (exclusive). -// Zero out the 0x1f bitrange of a byte to see which major type it is (those bits are -// used for packing either length info or other specific enumerated meanings). -const ( - cborMajorUint byte = 0x00 - cborMajorNegInt = 0x20 - cborMajorBytes = 0x40 - cborMajorString = 0x60 - cborMajorArray = 0x80 - cborMajorMap = 0xa0 - cborMajorTag = 0xc0 - cborMajorSimple = 0xe0 // Floating point, "simple" types like bool, etc, are above. -) - -// Enumeration of some values with single fixed-byte representations. -// All of these are in the "simple" space. -// See https://tools.ietf.org/html/rfc7049#section-2.3 for tables. -// The prefix indicating a float is also packed into the simple space. -const ( - cborSigilFalse byte = 0xf4 - cborSigilTrue = 0xf5 - cborSigilNil = 0xf6 - cborSigilUndefined = 0xf7 - cborSigilFloat16 = 0xf9 - cborSigilFloat32 = 0xfA - cborSigilFloat64 = 0xfB -) - -// The highest value in the range for bytes, text, arrays, and maps all indicate -// an "indefinite length" / "streaming" entry coming up. These have a different parse path. -// The special 'break' value from the "simple" space (all bits on) -// indicates termination of stream for all four kinds major types in this mode. -const ( - cborSigilIndefiniteBytes byte = 0x5f - cborSigilIndefiniteString = 0x7f - cborSigilIndefiniteArray = 0x9f - cborSigilIndefiniteMap = 0xbf - cborSigilBreak = 0xff -) diff --git a/vendor/github.com/polydawn/refmt/cbor/cborDecoder.go b/vendor/github.com/polydawn/refmt/cbor/cborDecoder.go deleted file mode 100644 index e70b1a8d..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborDecoder.go +++ /dev/null @@ -1,282 +0,0 @@ -package cbor - -import ( - "fmt" - "io" - - "github.com/polydawn/refmt/shared" - . "github.com/polydawn/refmt/tok" -) - -type Decoder struct { - cfg DecodeOptions - r shared.SlickReader - - stack []decoderStep // When empty, and step returns done, all done. - step decoderStep // Shortcut to end of stack. - left []int // Statekeeping space for definite-len map and array. -} - -func NewDecoder(cfg DecodeOptions, r io.Reader) (d *Decoder) { - d = &Decoder{ - cfg: cfg, - r: shared.NewReader(r), - stack: make([]decoderStep, 0, 10), - left: make([]int, 0, 10), - } - d.step = d.step_acceptValue - return -} - -func (d *Decoder) Reset() { - d.stack = d.stack[0:0] - d.step = d.step_acceptValue - d.left = d.left[0:0] -} - -type decoderStep func(tokenSlot *Token) (done bool, err error) - -func (d *Decoder) Step(tokenSlot *Token) (done bool, err error) { - done, err = d.step(tokenSlot) - // If the step errored: out, entirely. - if err != nil { - return true, err - } - // If the step wasn't done, return same status. - if !done { - return false, nil - } - // If it WAS done, pop next, or if stack empty, we're entirely done. - nSteps := len(d.stack) - 1 - if nSteps <= 0 { - return true, nil // that's all folks - } - d.step = d.stack[nSteps] - d.stack = d.stack[0:nSteps] - return false, nil -} - -func (d *Decoder) pushPhase(newPhase decoderStep) { - d.stack = append(d.stack, d.step) - d.step = newPhase -} - -// The original step, where any value is accepted, and no terminators for composites are valid. -// ONLY used in the original step; all other steps handle leaf nodes internally. -func (d *Decoder) step_acceptValue(tokenSlot *Token) (done bool, err error) { - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - tokenSlot.Tagged = false - return d.stepHelper_acceptValue(majorByte, tokenSlot) -} - -// Step in midst of decoding an indefinite-length array. -func (d *Decoder) step_acceptArrValueOrBreak(tokenSlot *Token) (done bool, err error) { - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - tokenSlot.Tagged = false - switch majorByte { - case cborSigilBreak: - tokenSlot.Type = TArrClose - return true, nil - default: - _, err := d.stepHelper_acceptValue(majorByte, tokenSlot) - return false, err - } -} - -// Step in midst of decoding an indefinite-length map, key expected up next, or end. -func (d *Decoder) step_acceptMapIndefKey(tokenSlot *Token) (done bool, err error) { - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - tokenSlot.Tagged = false - switch majorByte { - case cborSigilBreak: - tokenSlot.Type = TMapClose - return true, nil - default: - d.step = d.step_acceptMapIndefValueOrBreak - _, err := d.stepHelper_acceptValue(majorByte, tokenSlot) // FIXME surely not *any* value? not composites, at least? - return false, err - } -} - -// Step in midst of decoding an indefinite-length map, value expected up next. -func (d *Decoder) step_acceptMapIndefValueOrBreak(tokenSlot *Token) (done bool, err error) { - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - tokenSlot.Tagged = false - switch majorByte { - case cborSigilBreak: - return true, fmt.Errorf("unexpected break; expected value in indefinite-length map") - default: - d.step = d.step_acceptMapIndefKey - _, err = d.stepHelper_acceptValue(majorByte, tokenSlot) - return false, err - } -} - -// Step in midst of decoding a definite-length array. -func (d *Decoder) step_acceptArrValue(tokenSlot *Token) (done bool, err error) { - // Yield close token, pop state, and return done flag if expecting no more entries. - ll := len(d.left) - 1 - if d.left[ll] == 0 { - d.left = d.left[0:ll] - tokenSlot.Type = TArrClose - return true, nil - } - d.left[ll]-- - // Read next value. - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - tokenSlot.Tagged = false - _, err = d.stepHelper_acceptValue(majorByte, tokenSlot) - return false, err -} - -// Step in midst of decoding an definite-length map, key expected up next. -func (d *Decoder) step_acceptMapKey(tokenSlot *Token) (done bool, err error) { - // Yield close token, pop state, and return done flag if expecting no more entries. - ll := len(d.left) - 1 - if d.left[ll] == 0 { - d.left = d.left[0:ll] - tokenSlot.Type = TMapClose - return true, nil - } - d.left[ll]-- - // Read next key. - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - d.step = d.step_acceptMapValue - tokenSlot.Tagged = false - _, err = d.stepHelper_acceptValue(majorByte, tokenSlot) // FIXME surely not *any* value? not composites, at least? - return false, err -} - -// Step in midst of decoding an definite-length map, value expected up next. -func (d *Decoder) step_acceptMapValue(tokenSlot *Token) (done bool, err error) { - // Read next value. - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - d.step = d.step_acceptMapKey - tokenSlot.Tagged = false - _, err = d.stepHelper_acceptValue(majorByte, tokenSlot) - return false, err -} - -func (d *Decoder) stepHelper_acceptValue(majorByte byte, tokenSlot *Token) (done bool, err error) { - switch majorByte { - case cborSigilNil: - tokenSlot.Type = TNull - return true, nil - case cborSigilUndefined: - if d.cfg.CoerceUndefToNull { - tokenSlot.Type = TNull - return true, nil - } - return true, fmt.Errorf("encountered cbor 'undefined' byte (%x) during decoding", cborSigilUndefined) - case cborSigilFalse: - tokenSlot.Type = TBool - tokenSlot.Bool = false - return true, nil - case cborSigilTrue: - tokenSlot.Type = TBool - tokenSlot.Bool = true - return true, nil - case cborSigilFloat16, cborSigilFloat32, cborSigilFloat64: - tokenSlot.Type = TFloat64 - tokenSlot.Float64, err = d.decodeFloat(majorByte) - return true, err - case cborSigilIndefiniteBytes: - tokenSlot.Type = TBytes - tokenSlot.Bytes, err = d.decodeBytesIndefinite(nil) - return true, err - case cborSigilIndefiniteString: - tokenSlot.Type = TString - tokenSlot.Str, err = d.decodeStringIndefinite() - return true, err - case cborSigilIndefiniteArray: - tokenSlot.Type = TArrOpen - tokenSlot.Length = -1 - d.pushPhase(d.step_acceptArrValueOrBreak) - return false, nil - case cborSigilIndefiniteMap: - tokenSlot.Type = TMapOpen - tokenSlot.Length = -1 - d.pushPhase(d.step_acceptMapIndefKey) - return false, nil - default: - switch { - case majorByte >= cborMajorUint && majorByte < cborMajorNegInt: - tokenSlot.Type = TUint - tokenSlot.Uint, err = d.decodeUint(majorByte) - return true, err - case majorByte >= cborMajorNegInt && majorByte < cborMajorBytes: - tokenSlot.Type = TInt - tokenSlot.Int, err = d.decodeNegInt(majorByte) - return true, err - case majorByte >= cborMajorBytes && majorByte < cborMajorString: - tokenSlot.Type = TBytes - tokenSlot.Bytes, err = d.decodeBytes(majorByte) - return true, err - case majorByte >= cborMajorString && majorByte < cborMajorArray: - tokenSlot.Type = TString - tokenSlot.Str, err = d.decodeString(majorByte) - return true, err - case majorByte >= cborMajorArray && majorByte < cborMajorMap: - var n int - n, err = d.decodeLen(majorByte) - tokenSlot.Type = TArrOpen - tokenSlot.Length = n - d.left = append(d.left, n) - d.pushPhase(d.step_acceptArrValue) - return false, err - case majorByte >= cborMajorMap && majorByte < cborMajorTag: - var n int - n, err = d.decodeLen(majorByte) - tokenSlot.Type = TMapOpen - tokenSlot.Length = n - d.left = append(d.left, n) - d.pushPhase(d.step_acceptMapKey) - return false, err - case majorByte >= cborMajorTag && majorByte < cborMajorSimple: - // CBOR tags are, frankly, bonkers, and should not be used. - // They break isomorphism to basic standards like JSON. - // We'll parse basic integer tag values -- SINGLE layer only. - // We will NOT parse the full gamut of recursive tags: doing so - // would mean allowing an unbounded number of allocs *during - // *processing of a single token*, which is _not reasonable_. - if tokenSlot.Tagged { - return true, fmt.Errorf("unsupported multiple tags on a single data item") - } - tokenSlot.Tagged = true - tokenSlot.Tag, err = d.decodeLen(majorByte) - if err != nil { - return true, err - } - // Okay, we slurped a tag. - // Read next value. - majorByte, err := d.r.Readn1() - if err != nil { - return true, err - } - return d.stepHelper_acceptValue(majorByte, tokenSlot) - default: - return true, fmt.Errorf("Invalid majorByte: 0x%x", majorByte) - } - } -} diff --git a/vendor/github.com/polydawn/refmt/cbor/cborDecoderTerminals.go b/vendor/github.com/polydawn/refmt/cbor/cborDecoderTerminals.go deleted file mode 100644 index b9583d75..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborDecoderTerminals.go +++ /dev/null @@ -1,235 +0,0 @@ -package cbor - -import ( - "encoding/binary" - "errors" - "fmt" - "math" -) - -const ( - maxUint = ^uint(0) - maxInt = int(maxUint >> 1) -) - -func (d *Decoder) decodeFloat(majorByte byte) (f float64, err error) { - var bs []byte - switch majorByte { - case cborSigilFloat16: - bs, err = d.r.Readnzc(2) - f = float64(math.Float32frombits(halfFloatToFloatBits(binary.BigEndian.Uint16(bs)))) - case cborSigilFloat32: - bs, err = d.r.Readnzc(4) - f = float64(math.Float32frombits(binary.BigEndian.Uint32(bs))) - case cborSigilFloat64: - bs, err = d.r.Readnzc(8) - f = math.Float64frombits(binary.BigEndian.Uint64(bs)) - } - return -} - -// Decode an unsigned int. -// Must continue to hand down the majorByte because some of its bits are either -// packed with the value outright, or tell us how many more bytes the value fills. -func (d *Decoder) decodeUint(majorByte byte) (ui uint64, err error) { - v := majorByte & 0x1f - if v <= 0x17 { - ui = uint64(v) - } else { - if v == 0x18 { - var b byte - b, err = d.r.Readn1() - ui = uint64(b) - } else if v == 0x19 { - var bs []byte - bs, err = d.r.Readnzc(2) - ui = uint64(binary.BigEndian.Uint16(bs)) - } else if v == 0x1a { - var bs []byte - bs, err = d.r.Readnzc(4) - ui = uint64(binary.BigEndian.Uint32(bs)) - } else if v == 0x1b { - var bs []byte - bs, err = d.r.Readnzc(8) - ui = uint64(binary.BigEndian.Uint64(bs)) - } else { - err = fmt.Errorf("decodeUint: Invalid descriptor: %v", majorByte) - return - } - } - return -} - -// Decode a *negative* integer. -// Note that CBOR has a very funny-shaped hole here: there is unsigned positive int, -// and there is explicitly negative signed int... and there is no signed, positive int. -// *We have no 'decodeInt' function because that **doesn't exist** in CBOR.* -// So! Hopefully our consumer doesn't mind having to cast uints to ints fairly frequently. -func (d *Decoder) decodeNegInt(majorByte byte) (i int64, err error) { - // The packed bits in the majorByte and the following bytes if any are layed out - // the exact same as a uint; only the major type bits are different. - ui, err := d.decodeUint(majorByte) - if err != nil { - return 0, err - } - pos := ui + 1 - if pos > uint64(-math.MinInt64) { - return -1, errors.New("cbor: negative integer out of rage of int64 type") - } - - return -int64(pos), nil -} - -// Decode expecting a positive integer. -// None of our token-yielding functions call this directly; -// it's used inside the library when we expect to read e.g. a length header. -// Does not check that your majorByte indicates an integer type at all; -// in context, it often doesn't, e.g. when decoding the length of a string. -func (d *Decoder) decodeLen(majorByte byte) (i int, err error) { - ui, err := d.decodeUint(majorByte) - if err != nil { - return 0, err - } - if ui > uint64(maxInt) { - return 0, errors.New("cbor: positive integer is out of length") - } - return int(ui), nil -} - -// Decoding indefinite-length byte strings in cbor is actually decoding a sequence of -// definite-length byte strings until you encounter a break. -// Caller: use `bs[:0]` if you have something to reuse, or nil -func (d *Decoder) decodeBytesIndefinite(bs []byte) (bsOut []byte, err error) { - return d.decodeBytesOrStringIndefinite(bs, cborMajorBytes) -} - -func (d *Decoder) decodeStringIndefinite() (s string, err error) { - bs, err := d.decodeBytesOrStringIndefinite(nil, cborMajorString) - if err != nil { - return "", err - } - return string(bs), nil -} - -func (d *Decoder) decodeBytesOrStringIndefinite(bs []byte, majorWanted byte) (bsOut []byte, err error) { - if bs == nil { - bs = make([]byte, 0, 16) - } - var n int - for { - // Read first byte; check for break, or hunk, or invalid. - // (It's not necessary to have the first majorByte as a param to this function, because - // indefinite length sequences have a separate sigil which doesn't pack any len info.) - majorByte, err := d.r.Readn1() - if err != nil { - return bs, err - } - if majorByte == cborSigilBreak { - return bs, nil - } else if major := majorByte | 0x1f - 0x1f; major != majorWanted { - return bs, fmt.Errorf("cbor: expect bytes or string major type in indefinite string/bytes; got: %v, byte: %v", major, majorByte) - } - // Read length header for this hunk, and ensure we have at least that much cap. - n, err = d.decodeLen(majorByte) - if err != nil { - return bs, err - } - oldLen := len(bs) - newLen := oldLen + n - if n > 33554432 { - return nil, fmt.Errorf("cbor: decoding rejected oversized indefinite string/bytes field: %d is too large", n) - } - if newLen > cap(bs) { - bs2 := make([]byte, newLen, 2*cap(bs)+n) - copy(bs2, bs) - bs = bs2 - } else { - bs = bs[:newLen] - } - // Read that hunk. - d.r.Readb(bs[oldLen:newLen]) - } -} - -// Decode a single length-prefixed hunk of bytes. -// -// There are a number of ways this may try to conserve allocations: -// -// - If you say zerocopy=true, and the underlying reader system already has an -// appropriate byte slice available, then a slice from that will be returned. -// -// - If you provide a byte slice, we will attempt to use it. -// The byte slice is truncated and used for its capacity only -- not appended. -// The final returned slice may be a different one if the provided slice did not -// have sufficient capacity. -// -// - If you say zerocopy=true, and the underlying read system doesn't have an -// efficient way to yield a slice of its internal buffer, and you provided no -// destination slice, then we will use a recycleable piece of memory in the Decoder -// state and return a slice viewing into it. For small values this will -// likely save an alloc. -// -// The above rules are resolved in this order; e.g. your byte slice is disregarded -// if zerocopy=true and the underlying reader can do something even more efficient, -// though there is also no harm to providing the slice argument. -// Generally, set zerocopy if you know you're not going to publicly yield the results, -// and the implementation will do its best to be as efficient as possible. -// -// Zerocopy is appropriate when planning to turn the bytes into a string, for example, -// since in that path we know the slice will be treated immutably, not publicly -// exposed, and also any other copy to another intermediate is definitely useless. -func (d *Decoder) decodeBytes(majorByte byte) (bs []byte, err error) { - n, err := d.decodeLen(majorByte) - if err != nil { - return nil, err - } - if n > 33554432 { - return nil, fmt.Errorf("cbor: decoding rejected oversized byte field: %d is too large", n) - } - return d.r.Readn(n) -} - -// Decode a single length-prefixed string. -func (d *Decoder) decodeString(majorByte byte) (s string, err error) { - n, err := d.decodeLen(majorByte) - if err != nil { - return "", err - } - if n > 33554432 { - return "", fmt.Errorf("cbor: decoding rejected oversized string field: %d is too large", n) - } - bs, err := d.r.Readnzc(n) - return string(bs), err -} - -// culled from OGRE (Object-Oriented Graphics Rendering Engine) -// function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html) -func halfFloatToFloatBits(yy uint16) (d uint32) { - y := uint32(yy) - s := (y >> 15) & 0x01 - e := (y >> 10) & 0x1f - m := y & 0x03ff - - if e == 0 { - if m == 0 { // plu or minus 0 - return s << 31 - } else { // Denormalized number -- renormalize it - for (m & 0x00000400) == 0 { - m <<= 1 - e -= 1 - } - e += 1 - const zz uint32 = 0x0400 - m &= ^zz - } - } else if e == 31 { - if m == 0 { // Inf - return (s << 31) | 0x7f800000 - } else { // NaN - return (s << 31) | 0x7f800000 | (m << 13) - } - } - e = e + (127 - 15) - m = m << 13 - return (s << 31) | (e << 23) | m -} diff --git a/vendor/github.com/polydawn/refmt/cbor/cborEncoder.go b/vendor/github.com/polydawn/refmt/cbor/cborEncoder.go deleted file mode 100644 index 9b431d59..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborEncoder.go +++ /dev/null @@ -1,276 +0,0 @@ -package cbor - -import ( - "io" - - . "github.com/polydawn/refmt/tok" -) - -type Encoder struct { - w quickWriter - - stack []encoderPhase // When empty, and step returns done, all done. - current encoderPhase // Shortcut to end of stack. - // Note unlike decoder, we need no statekeeping space for definite-len map and array. - - spareBytes []byte -} - -func NewEncoder(w io.Writer) (d *Encoder) { - d = &Encoder{ - w: newQuickWriterStream(w), - stack: make([]encoderPhase, 0, 10), - current: phase_anyExpectValue, - spareBytes: make([]byte, 8), - } - return -} - -func (d *Encoder) Reset() { - d.stack = d.stack[0:0] - d.current = phase_anyExpectValue -} - -type encoderPhase byte - -// There's about twice as many phases that the cbor encoder can be in compared to the json encoder -// because the presense of indefinite vs definite length maps and arrays effectively adds a dimension to those. -const ( - phase_anyExpectValue encoderPhase = iota - phase_mapDefExpectKeyOrEnd // must not yield break at end - phase_mapDefExpectValue // only necessary to flip back to DefExpectKey - phase_mapIndefExpectKeyOrEnd // must yield break at end - phase_mapIndefExpectValue // only necessary to flip back to IndefExpectKey - phase_arrDefExpectValueOrEnd // must not yield break at end - phase_arrIndefExpectValueOrEnd // must yield break at end -) - -func (d *Encoder) pushPhase(p encoderPhase) { - d.current = p - d.stack = append(d.stack, d.current) -} - -// Pop a phase from the stack; return 'true' if stack now empty. -func (d *Encoder) popPhase() bool { - n := len(d.stack) - 1 - if n == 0 { - return true - } - if n < 0 { // the state machines are supposed to have already errored better - panic("cborEncoder stack overpopped") - } - d.current = d.stack[n-1] - d.stack = d.stack[0:n] - return false -} - -func (d *Encoder) Step(tokenSlot *Token) (done bool, err error) { - /* - Though it reads somewhat backwards from how a human would probably intuit - cause and effect, switching on the token type we got first, - *then* switching for whether it is acceptable for our current phase... is by - far the shorter volume of code to write. - */ - phase := d.current - switch tokenSlot.Type { - case TMapOpen: - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - if tokenSlot.Length >= 0 { - d.pushPhase(phase_mapDefExpectKeyOrEnd) - d.emitMajorPlusLen(cborMajorMap, uint64(tokenSlot.Length)) - } else { - d.pushPhase(phase_mapIndefExpectKeyOrEnd) - d.w.writen1(cborSigilIndefiniteMap) - } - return false, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TMapClose: - switch phase { - case phase_mapDefExpectKeyOrEnd: - return d.popPhase(), nil - case phase_mapIndefExpectKeyOrEnd: - d.w.writen1(cborSigilBreak) - return d.popPhase(), d.w.checkErr() - case phase_anyExpectValue, phase_mapDefExpectValue, phase_mapIndefExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForValue} - default: - panic("unreachable phase") - } - case TArrOpen: - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - if tokenSlot.Length >= 0 { - d.pushPhase(phase_arrDefExpectValueOrEnd) - d.emitMajorPlusLen(cborMajorArray, uint64(tokenSlot.Length)) - } else { - d.pushPhase(phase_arrIndefExpectValueOrEnd) - d.w.writen1(cborSigilIndefiniteArray) - } - return false, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TArrClose: - switch phase { - case phase_arrDefExpectValueOrEnd: - return d.popPhase(), nil - case phase_arrIndefExpectValueOrEnd: - d.w.writen1(cborSigilBreak) - return d.popPhase(), d.w.checkErr() - case phase_anyExpectValue, phase_mapDefExpectValue, phase_mapIndefExpectValue: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForValue} - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TNull: // terminal value; not accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.w.writen1(cborSigilNil) - return phase == phase_anyExpectValue, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TString: // terminal value; YES, accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - goto emitStr - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - d.current += 1 - goto emitStr - default: - panic("unreachable phase") - } - emitStr: - { - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeString(tokenSlot.Str) - return phase == phase_anyExpectValue, d.w.checkErr() - } - case TBytes: // terminal value; not accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeBytes(tokenSlot.Bytes) - return phase == phase_anyExpectValue, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TBool: // terminal value; not accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeBool(tokenSlot.Bool) - return phase == phase_anyExpectValue, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - case TInt: // terminal value; YES, accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - goto emitInt - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - d.current += 1 - goto emitInt - default: - panic("unreachable phase") - } - emitInt: - { - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeInt64(tokenSlot.Int) - return phase == phase_anyExpectValue, d.w.checkErr() - } - case TUint: // terminal value; YES, accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - goto emitUint - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - d.current += 1 - goto emitUint - default: - panic("unreachable phase") - } - emitUint: - { - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeUint64(tokenSlot.Uint) - return phase == phase_anyExpectValue, d.w.checkErr() - } - case TFloat64: // terminal value; not accepted as map key. - switch phase { - case phase_mapDefExpectValue, phase_mapIndefExpectValue: - d.current -= 1 - fallthrough - case phase_anyExpectValue, phase_arrDefExpectValueOrEnd, phase_arrIndefExpectValueOrEnd: - if tokenSlot.Tagged { - d.emitMajorPlusLen(cborMajorTag, uint64(tokenSlot.Tag)) - } - d.encodeFloat64(tokenSlot.Float64) - return phase == phase_anyExpectValue, d.w.checkErr() - case phase_mapDefExpectKeyOrEnd, phase_mapIndefExpectKeyOrEnd: - return true, &ErrInvalidTokenStream{Got: *tokenSlot, Acceptable: tokenTypesForKey} - default: - panic("unreachable phase") - } - default: - panic("unhandled token type") - } -} diff --git a/vendor/github.com/polydawn/refmt/cbor/cborEncoderTerminals.go b/vendor/github.com/polydawn/refmt/cbor/cborEncoderTerminals.go deleted file mode 100644 index 7f5ede8d..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborEncoderTerminals.go +++ /dev/null @@ -1,77 +0,0 @@ -package cbor - -import ( - "encoding/binary" - "math" -) - -func (d *Encoder) emitLen(majorByte byte, length int) { - d.emitMajorPlusLen(majorByte, uint64(length)) -} - -func (d *Encoder) emitMajorPlusLen(majorByte byte, v uint64) { - if v <= 0x17 { - d.w.writen1(majorByte + byte(v)) - } else if v <= math.MaxUint8 { - d.w.writen2(majorByte+0x18, uint8(v)) - } else if v <= math.MaxUint16 { - d.w.writen1(majorByte + 0x19) - d.spareBytes = d.spareBytes[:2] - binary.BigEndian.PutUint16(d.spareBytes, uint16(v)) - d.w.writeb(d.spareBytes) - } else if v <= math.MaxUint32 { - d.w.writen1(majorByte + 0x1a) - d.spareBytes = d.spareBytes[:4] - binary.BigEndian.PutUint32(d.spareBytes, uint32(v)) - d.w.writeb(d.spareBytes) - } else { // if v <= math.MaxUint64 { - d.w.writen1(majorByte + 0x1b) - d.spareBytes = d.spareBytes[:8] - binary.BigEndian.PutUint64(d.spareBytes, v) - d.w.writeb(d.spareBytes) - } -} - -func (d *Encoder) encodeNull() { - d.w.writen1(cborSigilNil) -} - -func (d *Encoder) encodeString(s string) { - d.emitMajorPlusLen(cborMajorString, uint64(len(s))) - d.w.writestr(s) -} - -func (d *Encoder) encodeBytes(bs []byte) { - d.emitMajorPlusLen(cborMajorBytes, uint64(len(bs))) - d.w.writeb(bs) -} - -func (d *Encoder) encodeBool(b bool) { - if b { - d.w.writen1(cborSigilTrue) - } else { - d.w.writen1(cborSigilFalse) - } -} - -func (d *Encoder) encodeInt64(v int64) { - if v >= 0 { - d.emitMajorPlusLen(cborMajorUint, uint64(v)) - } else { - d.emitMajorPlusLen(cborMajorNegInt, uint64(-1-v)) - } -} - -func (d *Encoder) encodeUint64(v uint64) { - d.emitMajorPlusLen(cborMajorUint, v) -} - -func (d *Encoder) encodeFloat64(v float64) { - // Can we pack it into 32? No idea: float precision is fraught with peril. - // See https://play.golang.org/p/u9sN6x0kk6 - // So we *only* emit the full 64-bit style. The CBOR spec permits this. - d.w.writen1(cborSigilFloat64) - d.spareBytes = d.spareBytes[:8] - binary.BigEndian.PutUint64(d.spareBytes, math.Float64bits(v)) - d.w.writeb(d.spareBytes) -} diff --git a/vendor/github.com/polydawn/refmt/cbor/cborHelpers.go b/vendor/github.com/polydawn/refmt/cbor/cborHelpers.go deleted file mode 100644 index f7c4b778..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborHelpers.go +++ /dev/null @@ -1,106 +0,0 @@ -package cbor - -import ( - "bytes" - "io" - - "github.com/polydawn/refmt/obj" - "github.com/polydawn/refmt/obj/atlas" - "github.com/polydawn/refmt/shared" -) - -// All of the methods in this file are exported, -// and their names and type declarations are intended to be -// identical to the naming and types of the golang stdlib -// 'encoding/json' packages, with ONE EXCEPTION: -// what stdlib calls "NewEncoder", we call "NewMarshaller"; -// what stdlib calls "NewDecoder", we call "NewUnmarshaller"; -// and similarly the types and methods are "Marshaller.Marshal" -// and "Unmarshaller.Unmarshal". -// You should be able to migrate with a sed script! -// -// (In refmt, the encoder/decoder systems are for token streams; -// if you're talking about object mapping, we consistently -// refer to that as marshalling/unmarshalling.) -// -// Most methods also have an "Atlased" variant, -// which lets you specify advanced type mapping instructions. - -func Marshal(v interface{}) ([]byte, error) { - var buf bytes.Buffer - if err := NewMarshaller(&buf).Marshal(v); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -func MarshalAtlased(v interface{}, atl atlas.Atlas) ([]byte, error) { - var buf bytes.Buffer - if err := NewMarshallerAtlased(&buf, atl).Marshal(v); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -type Marshaller struct { - marshaller *obj.Marshaller - encoder *Encoder - pump shared.TokenPump -} - -func (x *Marshaller) Marshal(v interface{}) error { - x.marshaller.Bind(v) - x.encoder.Reset() - return x.pump.Run() -} - -func NewMarshaller(wr io.Writer) *Marshaller { - return NewMarshallerAtlased(wr, atlas.MustBuild()) -} - -func NewMarshallerAtlased(wr io.Writer, atl atlas.Atlas) *Marshaller { - x := &Marshaller{ - marshaller: obj.NewMarshaller(atl), - encoder: NewEncoder(wr), - } - x.pump = shared.TokenPump{ - x.marshaller, - x.encoder, - } - return x -} - -func Unmarshal(cfg DecodeOptions, data []byte, v interface{}) error { - return NewUnmarshaller(cfg, bytes.NewBuffer(data)).Unmarshal(v) -} - -func UnmarshalAtlased(cfg DecodeOptions, data []byte, v interface{}, atl atlas.Atlas) error { - return NewUnmarshallerAtlased(cfg, bytes.NewBuffer(data), atl).Unmarshal(v) -} - -type Unmarshaller struct { - unmarshaller *obj.Unmarshaller - decoder *Decoder - pump shared.TokenPump -} - -func (x *Unmarshaller) Unmarshal(v interface{}) error { - x.unmarshaller.Bind(v) - x.decoder.Reset() - return x.pump.Run() -} - -func NewUnmarshaller(cfg DecodeOptions, r io.Reader) *Unmarshaller { - return NewUnmarshallerAtlased(cfg, r, atlas.MustBuild()) -} -func NewUnmarshallerAtlased(cfg DecodeOptions, r io.Reader, atl atlas.Atlas) *Unmarshaller { - x := &Unmarshaller{ - unmarshaller: obj.NewUnmarshaller(atl), - decoder: NewDecoder(cfg, r), - } - x.pump = shared.TokenPump{ - x.decoder, - x.unmarshaller, - } - return x -} diff --git a/vendor/github.com/polydawn/refmt/cbor/cborOptions.go b/vendor/github.com/polydawn/refmt/cbor/cborOptions.go deleted file mode 100644 index 69ccd685..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/cborOptions.go +++ /dev/null @@ -1,20 +0,0 @@ -package cbor - -type EncodeOptions struct { - // there aren't a ton of options for cbor, but we still need this - // for use as a sigil for the top-level refmt methods to demux on. -} - -// marker method -- you may use this type to instruct `refmt.Marshal` -// what kind of encoder to use. -func (EncodeOptions) IsEncodeOptions() {} - -type DecodeOptions struct { - CoerceUndefToNull bool - - // future: options to validate canonical serial order -} - -// marker method -- you may use this type to instruct `refmt.Marshal` -// what kind of encoder to use. -func (DecodeOptions) IsDecodeOptions() {} diff --git a/vendor/github.com/polydawn/refmt/cbor/doc.go b/vendor/github.com/polydawn/refmt/cbor/doc.go deleted file mode 100644 index 4972b592..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/doc.go +++ /dev/null @@ -1,27 +0,0 @@ -/* - Package implementing the CBOR -- Concise Binary Object Notation - -- http://cbor.io/ -- spec. - - CBOR is more or less freely interchangable with json: it's schemaless, - and composed of similar map and array types. - However, CBOR is binary, length delimited -- and thus very fast to parse, - and can store binary data without expansion problems -- and also distinguishes - types like integer, string, float, and bytes all clearly from each other. - - The `cbor.Marshal` and `cbor.Unmarshal` functions are the quickest way - to convert your Go objects to and from serial CBOR. - - The `cbor.NewMarshaller` and `cbor.NewUmarshaller` functions give a little - more control. If performance is important, prefer these; recycling - the marshaller instances will significantly cut down on memory allocations - and improve performance. - - The `*Atlased` variants of constructors allow you set up marshalling with - an `refmt/obj/atlas.Atlas`, unlocking all of refmt's advanced features - and custom object mapping powertools. - - The `cbor.Encoder` and `cbor.Decoder` types implement the low-level functionality - of converting serial CBOR byte streams into refmt Token streams. - Users don't usually need to use these directly. -*/ -package cbor diff --git a/vendor/github.com/polydawn/refmt/cbor/encodeWriter.go b/vendor/github.com/polydawn/refmt/cbor/encodeWriter.go deleted file mode 100644 index 1ee4839e..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/encodeWriter.go +++ /dev/null @@ -1,107 +0,0 @@ -package cbor - -import ( - "fmt" - "io" -) - -var ( - _ quickWriter = &quickWriterStream{} -) - -// quickWriter is implements several methods that are specificly useful to the performance -// needs of our encoders, and abstracts writing to a byte array or to an io.Writer. -type quickWriter interface { - writeb([]byte) - writestr(string) - writen1(byte) - writen2(byte, byte) - checkErr() error - clearErr() -} - -// Interface used to detect if efficient string writing is supported. -// Same as in stdlib 'io' pkg; also not exported there, so we declare it again ourselves. -type stringWriter interface { - WriteString(s string) (n int, err error) -} - -// quickWriterStream is a quickWriter that routes bytes to an io.Writer. -// While this implementation does use some internal buffers, it's still advisable -// to use a buffered writer to avoid small operations for any external IO like disk or network. -type quickWriterStream struct { - w io.Writer - ws stringWriter // nil if not available - - scratch [2]byte - scratch1 []byte - scratch2 []byte - err error -} - -func newQuickWriterStream(w io.Writer) *quickWriterStream { - z := &quickWriterStream{w: w} - if ws, ok := w.(stringWriter); ok { - z.ws = ws - } - z.scratch1 = z.scratch[:1] - z.scratch2 = z.scratch[:2] - return z -} - -func (z *quickWriterStream) writeb(bs []byte) { - n, err := z.w.Write(bs) - if err != nil && z.err == nil { - z.err = err - } - if n < len(bs) && z.err == nil { - z.err = fmt.Errorf("underwrite") - } -} - -func (z *quickWriterStream) writestr(s string) { - var n int - var err error - if z.ws != nil { - n, err = z.ws.WriteString(s) - } else { - n, err = z.w.Write([]byte(s)) // Notice: alloc! - } - if err != nil && z.err == nil { - z.err = err - } - if n < len(s) && z.err == nil { - z.err = fmt.Errorf("underwrite") - } -} - -func (z *quickWriterStream) writen1(b byte) { - z.scratch1[0] = b - n, err := z.w.Write(z.scratch1) - if err != nil && z.err == nil { - z.err = err - } - if n < 1 && z.err == nil { - z.err = fmt.Errorf("underwrite") - } -} - -func (z *quickWriterStream) writen2(b1 byte, b2 byte) { - z.scratch2[0] = b1 - z.scratch2[1] = b2 - n, err := z.w.Write(z.scratch2) - if err != nil && z.err == nil { - z.err = err - } - if n < 2 && z.err == nil { - z.err = fmt.Errorf("underwrite") - } -} - -func (z *quickWriterStream) checkErr() error { - return z.err -} - -func (z *quickWriterStream) clearErr() { - z.err = nil -} diff --git a/vendor/github.com/polydawn/refmt/cbor/errors.go b/vendor/github.com/polydawn/refmt/cbor/errors.go deleted file mode 100644 index 25020d0d..00000000 --- a/vendor/github.com/polydawn/refmt/cbor/errors.go +++ /dev/null @@ -1,22 +0,0 @@ -package cbor - -import ( - "fmt" - - . "github.com/polydawn/refmt/tok" -) - -// Error raised by Encoder when invalid tokens or invalid ordering, e.g. a MapClose with no matching open. -// Should never be seen by the user in practice unless generating their own token streams. -type ErrInvalidTokenStream struct { - Got Token - Acceptable []TokenType -} - -func (e *ErrInvalidTokenStream) Error() string { - return fmt.Sprintf("ErrInvalidTokenStream: unexpected %v, expected %v", e.Got, e.Acceptable) - // More comprehensible strings might include "start of value", "start of key or end of map", "start of value or end of array". -} - -var tokenTypesForKey = []TokenType{TString, TInt, TUint} -var tokenTypesForValue = []TokenType{TMapOpen, TArrOpen, TNull, TString, TBytes, TInt, TUint, TFloat64} diff --git a/vendor/github.com/polydawn/refmt/cloneHelpers.go b/vendor/github.com/polydawn/refmt/cloneHelpers.go deleted file mode 100644 index 7dcf4059..00000000 --- a/vendor/github.com/polydawn/refmt/cloneHelpers.go +++ /dev/null @@ -1,50 +0,0 @@ -package refmt - -import ( - "github.com/polydawn/refmt/obj" - "github.com/polydawn/refmt/obj/atlas" - "github.com/polydawn/refmt/shared" -) - -func Clone(src, dst interface{}) error { - return CloneAtlased(src, dst, atlas.MustBuild()) -} -func MustClone(src, dst interface{}) { - if err := Clone(src, dst); err != nil { - panic(err) - } -} - -func CloneAtlased(src, dst interface{}, atl atlas.Atlas) error { - return NewCloner(atl).Clone(src, dst) -} -func MustCloneAtlased(src, dst interface{}, atl atlas.Atlas) { - if err := CloneAtlased(src, dst, atl); err != nil { - panic(err) - } -} - -type Cloner interface { - Clone(src, dst interface{}) error -} - -func NewCloner(atl atlas.Atlas) Cloner { - x := &cloner{ - marshaller: obj.NewMarshaller(atl), - unmarshaller: obj.NewUnmarshaller(atl), - } - x.pump = shared.TokenPump{x.marshaller, x.unmarshaller} - return x -} - -type cloner struct { - marshaller *obj.Marshaller - unmarshaller *obj.Unmarshaller - pump shared.TokenPump -} - -func (c cloner) Clone(src, dst interface{}) error { - c.marshaller.Bind(src) - c.unmarshaller.Bind(dst) - return c.pump.Run() -} diff --git a/vendor/github.com/polydawn/refmt/cover b/vendor/github.com/polydawn/refmt/cover deleted file mode 100755 index e3587f90..00000000 --- a/vendor/github.com/polydawn/refmt/cover +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -euo pipefail - -PROJECT="github.com/polydawn/refmt" -SUBSECTION=${1:-./...} - -export GOPATH="$PWD/.gopath" - -CoverPkg() { - pkg="$1" - - coverFile="$GOPATH/tmp/$pkg.cover" - mkdir -p "$(dirname "$coverFile")" - rm -f "$coverFile" - go test -coverprofile="$coverFile" "$pkg" \ - | tee /dev/stderr | grep "\[no test files\]$" > /dev/null || \ - go tool cover -html="$coverFile" -} - -for pkg in $(go list "$SUBSECTION" | sed "s#^_${PWD}#${PROJECT}#"); do - CoverPkg "$pkg" || true # continue even if errors from packages that lack tests. -done diff --git a/vendor/github.com/polydawn/refmt/doc.go b/vendor/github.com/polydawn/refmt/doc.go deleted file mode 100644 index fe9113d6..00000000 --- a/vendor/github.com/polydawn/refmt/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -/* - Refmt is a serialization and object-mapping library. - - Look to the README on github for more high-level information. - - This top-level package exposes simple helper methods for most common operations. - You can also compose custom marshallers/unmarshallers and serializer/deserializers - by constructing a `refmt.TokenPump` with components from the packages beneath this one. - For example, the `refmt.JsonEncode` helper method can be replicated by combining - an `obj.Marshaller` with a `json.Encoder`. -*/ -package refmt diff --git a/vendor/github.com/polydawn/refmt/goad b/vendor/github.com/polydawn/refmt/goad deleted file mode 100755 index 0b8b8f69..00000000 --- a/vendor/github.com/polydawn/refmt/goad +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -set -euo pipefail - -### Project details -name="refmt" -pkg="github.com/polydawn/$name" # everything under here will be tested -cmd="$pkg/cmd/$name" # if you have a main.main not at the repo root, set this - - - -### Normalize path -- all work should be relative to this script's location. -## Set up gopath -- also relative to this dir, so we work in isolation. -cd "$( dirname "${BASH_SOURCE[0]}" )" -export GOPATH="$PWD/.gopath/" -export GOBIN="$PWD/bin/" - - - -### other config scripts? invoke here. -## pass pointer to project root dir down, for tests (tests run in varying CWDs, so need this hint) -export PROJ="$PWD" -## use LDFLAGS to inject vars at compile time. -LDFLAGS="" - - - -### Last bits of our flag parsery. -# subcommand arg? -SUBCOMMAND=${1:-} -# subsection arg? -SUBSECTION=${2:-"..."} -SUBSECTION="./$SUBSECTION" -# default test timeouts are far too high. override this if you like. -TEST_TIMEOUT="${TEST_TIMEOUT:-"5s"}" - - - -### action begins! -if [ -z "$SUBCOMMAND" ] ; then - ( - go fmt "$SUBSECTION" - go install -ldflags "$LDFLAGS" "$cmd" && { - echo -e "\E[1;32minstall successful.\E[0;m\n" - } || { - echo -e "\E[1;41minstall failed!\E[0;m" - exit 8 - } - go test "$SUBSECTION" -timeout="$TEST_TIMEOUT" && { - echo -e "\n\E[1;32mall tests green.\E[0;m" - } || { - echo -e "\n\E[1;41msome tests failed!\E[0;m" - exit 4 - } - ) -else - shift # munch $subcommand from passing on in "$@" - case "$SUBCOMMAND" in - -) - # passthrough for other commands - go "$@" - ;; - env) - echo "GOROOT=`go env GOROOT`" - echo "GOPATH=`go env GOPATH`" - ;; - path) - echo "$GOPATH" - ;; - init) - # it's your responsibility to do this the first time - # (we don't do it at the front of every build because it will move submodules if you already have them, and that might not be what you want as you're plowing along) - git submodule update --init - # also make sure the self-symlink exists. should be committed anyway (but then, this is also useful for project-first-steps.) - mkdir -p "$(dirname ".gopath/src/$pkg")" - ln -snf "$(echo "${pkg//[^\/]}/" | sed s#/#../#g)"../ ".gopath/src/$pkg" - ;; - test) - set +e ; shift ; set -e # munch $subsection from passing on in "$@" - go test -i "$SUBSECTION" "$@" && - go test -v "$SUBSECTION" -timeout="$TEST_TIMEOUT" "$@" && { - echo -e "\n\E[1;32mall tests green.\E[0;m" - } || { - echo -e "\n\E[1;41msome tests failed!\E[0;m" - exit 4 - } - ;; - install) - go install -ldflags "$LDFLAGS" "$cmd" - ;; - bench) - profPath="$GOPATH/tmp/prof/" - mkdir -p "$profPath" - set +e ; shift ; set -e # munch $subsection from passing on in "$@" - go test -i "$SUBSECTION" "$@" && - GOCONVEY_REPORTER=silent \ - go test \ - -run=XXX -bench=. \ - -o "$profPath/bench.bin" \ - -cpuprofile="$profPath/cpu.pprof" \ - "$SUBSECTION" "$@" || { - echo -e "\E[1;41msome benchmarks failed!\E[0;m" - exit 4 - } - # use e.g.: go tool pprof --text .gopath/tmp/prof/bench.bin .gopath/tmp/prof/cpu.pprof - ;; - fmt) - go fmt "$SUBSECTION" - ;; - doc) - set +e ; shift ; set -e # munch $subsection from passing on in "$@" - for package in $(go list "$SUBSECTION" | sed "s#^_${PWD}#${pkg}#"); do - echo -e "==== $package ====\n" - godoc "$@" "$package" - echo -e "\n\n\n" - done - ;; - cover) - coverFile="$GOPATH/tmp/cover/cover.out" - mkdir -p "$(dirname "$coverFile")" - for package in $(go list "$SUBSECTION" | sed "s#^_${PWD}#${pkg}#"); do - rm -f "$coverFile" - echo "==== $package ====" - go test -coverprofile="$coverFile" "$package" && \ - [ -f "$coverFile" ] && \ - echo ---- && \ - go tool cover -func="$coverFile" && \ - echo ---- && \ - go tool cover -html="$coverFile" - echo ==== - echo - done - rm -f "$coverFile" - ;; - clean) - rm -rf "$GOBIN" "$GOPATH/pkg" "$GOPATH/tmp" - ;; - *) - echo "Usage: $0 {init|test|install|bench|fmt|doc|cover|clean}" 1>&2; - exit 1 - ;; - esac -fi diff --git a/vendor/github.com/polydawn/refmt/json/doc.go b/vendor/github.com/polydawn/refmt/json/doc.go deleted file mode 100644 index f4e8c961..00000000 --- a/vendor/github.com/polydawn/refmt/json/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* - Package implementing the JSON -- http://json.org/ -- spec. - - The `json.Marshal` and `json.Unmarshal` functions are the quickest way - to convert your Go objects to and from serial JSON. - - The `json.NewMarshaller` and `json.NewUmarshaller` functions give a little - more control. If performance is important, prefer these; recycling - the marshaller instances will significantly cut down on memory allocations - and improve performance. - - The `*Atlased` variants of constructors allow you set up marshalling with - an `refmt/obj/atlas.Atlas`, unlocking all of refmt's advanced features - and custom object mapping powertools. - - The `json.Encoder` and `json.Decoder` types implement the low-level functionality - of converting serial JSON byte streams into refmt Token streams. - Users don't usually need to use these directly. -*/ -package json diff --git a/vendor/github.com/polydawn/refmt/json/jsonCommon.go b/vendor/github.com/polydawn/refmt/json/jsonCommon.go deleted file mode 100644 index 21e271ba..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonCommon.go +++ /dev/null @@ -1,19 +0,0 @@ -package json - -//const ( -// jsonMajor -//) - -// The most heavily used words, cached as byte slices. -var ( - wordTrue = []byte("true") - wordFalse = []byte("false") - wordNull = []byte("null") - wordArrOpen = []byte("[") - wordArrClose = []byte("]") - wordMapOpen = []byte("{") - wordMapClose = []byte("}") - wordColon = []byte(":") - wordComma = []byte(",") - wordSpace = []byte(" ") -) diff --git a/vendor/github.com/polydawn/refmt/json/jsonDecoder.go b/vendor/github.com/polydawn/refmt/json/jsonDecoder.go deleted file mode 100644 index bc025e6a..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonDecoder.go +++ /dev/null @@ -1,207 +0,0 @@ -package json - -import ( - "fmt" - "io" - - "github.com/polydawn/refmt/shared" - . "github.com/polydawn/refmt/tok" -) - -type Decoder struct { - r shared.SlickReader - - stack []decoderStep // When empty, and step returns done, all done. - step decoderStep // Shortcut to end of stack. - some bool // Set to true after first value in any context; use to decide if a comma must precede the next value. -} - -func NewDecoder(r io.Reader) (d *Decoder) { - d = &Decoder{ - r: shared.NewReader(r), - stack: make([]decoderStep, 0, 10), - } - d.step = d.step_acceptValue - return -} - -func (d *Decoder) Reset() { - d.stack = d.stack[0:0] - d.step = d.step_acceptValue - d.some = false -} - -type decoderStep func(tokenSlot *Token) (done bool, err error) - -func (d *Decoder) Step(tokenSlot *Token) (done bool, err error) { - done, err = d.step(tokenSlot) - // If the step errored: out, entirely. - if err != nil { - return true, err - } - // If the step wasn't done, return same status. - if !done { - return false, nil - } - // If it WAS done, and stack empty, we're entirely done. - nSteps := len(d.stack) - 1 - if nSteps <= 0 { - return true, nil // that's all folks - } - // Pop the stack. Reset "some" to true. - d.step = d.stack[nSteps] - d.stack = d.stack[0:nSteps] - d.some = true - return false, nil -} - -func (d *Decoder) pushPhase(newPhase decoderStep) { - d.stack = append(d.stack, d.step) - d.step = newPhase - d.some = false -} - -func readn1skippingWhitespace(r shared.SlickReader) (majorByte byte, err error) { - for { - majorByte, err = r.Readn1() - switch majorByte { - case ' ', '\t', '\r', '\n': // continue - default: - return - } - } -} - -// The original step, where any value is accepted, and no terminators for composites are valid. -// ONLY used in the original step; all other steps handle leaf nodes internally. -func (d *Decoder) step_acceptValue(tokenSlot *Token) (done bool, err error) { - majorByte, err := readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - return d.stepHelper_acceptValue(majorByte, tokenSlot) -} - -// Step in midst of decoding an array. -func (d *Decoder) step_acceptArrValueOrBreak(tokenSlot *Token) (done bool, err error) { - majorByte, err := readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - if d.some { - switch majorByte { - case ']': - tokenSlot.Type = TArrClose - return true, nil - case ',': - majorByte, err = readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - // and now fall through to the next switch - } - } - switch majorByte { - case ']': - tokenSlot.Type = TArrClose - return true, nil - default: - _, err := d.stepHelper_acceptValue(majorByte, tokenSlot) - d.some = true - return false, err - } -} - -// Step in midst of decoding a map, key expected up next, or end. -func (d *Decoder) step_acceptMapKeyOrBreak(tokenSlot *Token) (done bool, err error) { - majorByte, err := readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - if d.some { - switch majorByte { - case '}': - tokenSlot.Type = TMapClose - return true, nil - case ',': - majorByte, err = readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - // and now fall through to the next switch - } - } - switch majorByte { - case '}': - tokenSlot.Type = TMapClose - return true, nil - default: - // Consume a string for key. - _, err := d.stepHelper_acceptValue(majorByte, tokenSlot) // FIXME surely not *any* value? not composites, at least? - // Now scan up to consume the colon as well, which is required next. - majorByte, err = readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - if majorByte != ':' { - return true, fmt.Errorf("expected colon after map key; got 0x%x", majorByte) - } - // Next up: expect a value. - d.step = d.step_acceptMapValue - d.some = true - return false, err - } -} - -// Step in midst of decoding a map, value expected up next. -func (d *Decoder) step_acceptMapValue(tokenSlot *Token) (done bool, err error) { - majorByte, err := readn1skippingWhitespace(d.r) - if err != nil { - return true, err - } - d.step = d.step_acceptMapKeyOrBreak - _, err = d.stepHelper_acceptValue(majorByte, tokenSlot) - return false, err -} - -func (d *Decoder) stepHelper_acceptValue(majorByte byte, tokenSlot *Token) (done bool, err error) { - switch majorByte { - case '{': - tokenSlot.Type = TMapOpen - tokenSlot.Length = -1 - d.pushPhase(d.step_acceptMapKeyOrBreak) - return false, nil - case '[': - tokenSlot.Type = TArrOpen - tokenSlot.Length = -1 - d.pushPhase(d.step_acceptArrValueOrBreak) - return false, nil - case 'n': - d.r.Readnzc(3) // FIXME must check these equal "ull"! - tokenSlot.Type = TNull - return true, nil - case '"': - tokenSlot.Type = TString - tokenSlot.Str, err = d.decodeString() - return true, err - case 'f': - d.r.Readnzc(4) // FIXME must check these equal "alse"! - tokenSlot.Type = TBool - tokenSlot.Bool = false - return true, nil - case 't': - d.r.Readnzc(3) // FIXME must check these equal "rue"! - tokenSlot.Type = TBool - tokenSlot.Bool = true - return true, nil - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - // Some kind of numeric... but in json, we *can't tell* if it's float or int. - // JSON in general doesn't differentiate. But we usually try to anyway. - // (If this results in us yielding an int, and an obj.Unmarshaller is filling a float, - // it's the Unmarshaller responsibility to decide to cast that.) - tokenSlot.Type, tokenSlot.Int, tokenSlot.Float64, err = d.decodeNumber(majorByte) - return true, err - default: - return true, fmt.Errorf("Invalid byte while expecting start of value: 0x%x", majorByte) - } -} diff --git a/vendor/github.com/polydawn/refmt/json/jsonDecoderTerminals.go b/vendor/github.com/polydawn/refmt/json/jsonDecoderTerminals.go deleted file mode 100644 index b2054535..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonDecoderTerminals.go +++ /dev/null @@ -1,368 +0,0 @@ -package json - -// License note: the string and numeric parsers here borrow -// heavily from the golang stdlib json parser scanner. -// That code is originally Copyright 2010 The Go Authors, -// and is governed by a BSD-style license. - -import ( - "fmt" - "io" - "strconv" - "unicode" - "unicode/utf16" - "unicode/utf8" - - "github.com/polydawn/refmt/tok" -) - -func (d *Decoder) decodeString() (string, error) { - // First quote has already been eaten. - // Start tracking the byte slice; real string starts here. - d.r.Track() - // Scan until scanner tells us end of string. - for step := strscan_normal; step != nil; { - majorByte, err := d.r.Readn1() - if err != nil { - return "", err - } - step, err = step(majorByte) - if err != nil { - return "", err - } - } - // Unread one. The scan loop consumed the trailing quote already, - // which we don't want to pass onto the parser. - d.r.Unreadn1() - // Parse! - s, ok := parseString(d.r.StopTrack()) - if !ok { - //return string(s), fmt.Errorf("string parse misc fail") - } - // Swallow the trailing quote again. - d.r.Readn1() - return string(s), nil -} - -// Scan steps are looped over the stream to find how long the string is. -// A nil step func is returned to indicate the string is done. -// Actually parsing the string is done by 'parseString()'. -type strscanStep func(c byte) (strscanStep, error) - -// The default string scanning step state. Starts here. -func strscan_normal(c byte) (strscanStep, error) { - if c == '"' { // done! - return nil, nil - } - if c == '\\' { - return strscan_esc, nil - } - if c < 0x20 { // Unprintable bytes are invalid in a json string. - return nil, fmt.Errorf("invalid unprintable byte in string literal: 0x%x", c) - } - return strscan_normal, nil -} - -// "esc" is the state after reading `"\` during a quoted string. -func strscan_esc(c byte) (strscanStep, error) { - switch c { - case 'b', 'f', 'n', 'r', 't', '\\', '/', '"': - return strscan_normal, nil - case 'u': - return strscan_escU, nil - } - return nil, fmt.Errorf("invalid byte in string escape sequence: 0x%x", c) -} - -// "escU" is the state after reading `"\u` during a quoted string. -func strscan_escU(c byte) (strscanStep, error) { - if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' { - return strscan_escU1, nil - } - return nil, fmt.Errorf("invalid byte in \\u hexadecimal character escape: 0x%x", c) -} - -// "escU1" is the state after reading `"\u1` during a quoted string. -func strscan_escU1(c byte) (strscanStep, error) { - if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' { - return strscan_escU12, nil - } - return nil, fmt.Errorf("invalid byte in \\u hexadecimal character escape: 0x%x", c) -} - -// "escU12" is the state after reading `"\u12` during a quoted string. -func strscan_escU12(c byte) (strscanStep, error) { - if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' { - return strscan_escU123, nil - } - return nil, fmt.Errorf("invalid byte in \\u hexadecimal character escape: 0x%x", c) -} - -// "escU123" is the state after reading `"\u123` during a quoted string. -func strscan_escU123(c byte) (strscanStep, error) { - if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' { - return strscan_normal, nil - } - return nil, fmt.Errorf("invalid byte in \\u hexadecimal character escape: 0x%x", c) -} - -// Convert a json string byte sequence that is a complete string (quotes from -// the outside dropped) bytes ready to be flipped into a go string. -func parseString(s []byte) (t []byte, ok bool) { - // Check for unusual characters. If there are none, - // then no unquoting is needed, so return a slice of the - // original bytes. - r := 0 - for r < len(s) { - c := s[r] - if c == '\\' || c == '"' || c < ' ' { - break - } - if c < utf8.RuneSelf { - r++ - continue - } - rr, size := utf8.DecodeRune(s[r:]) - if rr == utf8.RuneError && size == 1 { - break - } - r += size - } - if r == len(s) { - return s, true - } - - b := make([]byte, len(s)+2*utf8.UTFMax) - w := copy(b, s[0:r]) - for r < len(s) { - // Out of room? Can only happen if s is full of - // malformed UTF-8 and we're replacing each - // byte with RuneError. - if w >= len(b)-2*utf8.UTFMax { - nb := make([]byte, (len(b)+utf8.UTFMax)*2) - copy(nb, b[0:w]) - b = nb - } - switch c := s[r]; { - case c == '\\': - r++ - if r >= len(s) { - return - } - switch s[r] { - default: - return - case '"', '\\', '/', '\'': - b[w] = s[r] - r++ - w++ - case 'b': - b[w] = '\b' - r++ - w++ - case 'f': - b[w] = '\f' - r++ - w++ - case 'n': - b[w] = '\n' - r++ - w++ - case 'r': - b[w] = '\r' - r++ - w++ - case 't': - b[w] = '\t' - r++ - w++ - case 'u': - r-- - rr := getu4(s[r:]) - if rr < 0 { - return - } - r += 6 - if utf16.IsSurrogate(rr) { - rr1 := getu4(s[r:]) - if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar { - // A valid pair; consume. - r += 6 - w += utf8.EncodeRune(b[w:], dec) - break - } - // Invalid surrogate; fall back to replacement rune. - rr = unicode.ReplacementChar - } - w += utf8.EncodeRune(b[w:], rr) - } - - // Quote, control characters are invalid. - case c == '"', c < ' ': - return - - // ASCII - case c < utf8.RuneSelf: - b[w] = c - r++ - w++ - - // Coerce to well-formed UTF-8. - default: - rr, size := utf8.DecodeRune(s[r:]) - r += size - w += utf8.EncodeRune(b[w:], rr) - } - } - return b[0:w], true -} - -// getu4 decodes \uXXXX from the beginning of s, returning the hex value, -// or it returns -1. -func getu4(s []byte) rune { - if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { - return -1 - } - r, err := strconv.ParseUint(string(s[2:6]), 16, 64) - if err != nil { - return -1 - } - return rune(r) -} - -// Returns *either* an int or a float -- json is ambigous. -// An int is preferred if possible. -func (d *Decoder) decodeNumber(majorByte byte) (tok.TokenType, int64, float64, error) { - // First byte has already been eaten. - // Easiest to unread1, so we can use track, then swallow it again. - d.r.Unreadn1() - d.r.Track() - d.r.Readn1() - // Scan until scanner tells us end of numeric. - // Pick the first scanner stepfunc based on the leading byte. - var step numscanStep - switch majorByte { - case '-': - step = numscan_neg - case '0': - step = numscan_0 - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - step = numscan_1 - default: - panic("unreachable") - } - for { - b, err := d.r.Readn1() - if err == io.EOF { - break - } - if err != nil { - return 0, 0, 0, err - } - step, err = step(b) - if step == nil { - // Unread one. The scan loop consumed one char beyond the end - // (this is necessary in json!), - // which the next part of the decoder will need elsewhere. - d.r.Unreadn1() - break - } - if err != nil { - return 0, 0, 0, err - } - } - // Parse! - // *This is not a fast parse*. - // Try int first; if it fails try float; if that fails return the float error. - s := string(d.r.StopTrack()) - if i, err := strconv.ParseInt(s, 10, 64); err == nil { - return tok.TInt, i, 0, nil - } - f, err := strconv.ParseFloat(s, 64) - return tok.TFloat64, 0, f, err -} - -// Scan steps are looped over the stream to find how long the number is. -// A nil step func is returned to indicate the string is done. -// Actually parsing the string is done by 'parseString()'. -type numscanStep func(c byte) (numscanStep, error) - -// numscan_neg is the state after reading `-` during a number. -func numscan_neg(c byte) (numscanStep, error) { - if c == '0' { - return numscan_0, nil - } - if '1' <= c && c <= '9' { - return numscan_1, nil - } - return nil, fmt.Errorf("invalid byte in numeric literal: 0x%x", c) -} - -// numscan_1 is the state after reading a non-zero integer during a number, -// such as after reading `1` or `100` but not `0`. -func numscan_1(c byte) (numscanStep, error) { - if '0' <= c && c <= '9' { - return numscan_1, nil - } - return numscan_0(c) -} - -// numscan_0 is the state after reading `0` during a number. -func numscan_0(c byte) (numscanStep, error) { - if c == '.' { - return numscan_dot, nil - } - if c == 'e' || c == 'E' { - return numscan_e, nil - } - return nil, nil -} - -// numscan_dot is the state after reading the integer and decimal point in a number, -// such as after reading `1.`. -func numscan_dot(c byte) (numscanStep, error) { - if '0' <= c && c <= '9' { - return numscan_dot0, nil - } - return nil, fmt.Errorf("invalid byte after decimal in numeric literal: 0x%x", c) -} - -// numscan_dot0 is the state after reading the integer, decimal point, and subsequent -// digits of a number, such as after reading `3.14`. -func numscan_dot0(c byte) (numscanStep, error) { - if '0' <= c && c <= '9' { - return numscan_dot0, nil - } - if c == 'e' || c == 'E' { - return numscan_e, nil - } - return nil, nil -} - -// numscan_e is the state after reading the mantissa and e in a number, -// such as after reading `314e` or `0.314e`. -func numscan_e(c byte) (numscanStep, error) { - if c == '+' || c == '-' { - return numscan_eSign, nil - } - return numscan_eSign(c) -} - -// numscan_eSign is the state after reading the mantissa, e, and sign in a number, -// such as after reading `314e-` or `0.314e+`. -func numscan_eSign(c byte) (numscanStep, error) { - if '0' <= c && c <= '9' { - return numscan_e0, nil - } - return nil, fmt.Errorf("invalid byte in exponent of numeric literal: 0x%x", c) -} - -// numscan_e0 is the state after reading the mantissa, e, optional sign, -// and at least one digit of the exponent in a number, -// such as after reading `314e-2` or `0.314e+1` or `3.14e0`. -func numscan_e0(c byte) (numscanStep, error) { - if '0' <= c && c <= '9' { - return numscan_e0, nil - } - return nil, nil -} diff --git a/vendor/github.com/polydawn/refmt/json/jsonEncoder.go b/vendor/github.com/polydawn/refmt/json/jsonEncoder.go deleted file mode 100644 index 8783b381..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonEncoder.go +++ /dev/null @@ -1,218 +0,0 @@ -package json - -import ( - "fmt" - "io" - "strconv" - - . "github.com/polydawn/refmt/tok" -) - -func NewEncoder(wr io.Writer, cfg EncodeOptions) *Encoder { - return &Encoder{ - wr: wr, - cfg: cfg, - stack: make([]phase, 0, 10), - } -} - -func (d *Encoder) Reset() { - d.stack = d.stack[0:0] - d.current = phase_anyExpectValue - d.some = false -} - -/* - A json.Encoder is a TokenSink implementation that emits json bytes. -*/ -type Encoder struct { - wr io.Writer - cfg EncodeOptions - - // Stack, tracking how many array and map opens are outstanding. - // (Values are only 'phase_mapExpectKeyOrEnd' and 'phase_arrExpectValueOrEnd'.) - stack []phase - current phase // shortcut to value at end of stack - some bool // set to true after first value in any context; use to append commas. - - // Spare memory, for use in operations on leaf nodes (e.g. temp space for an int serialization). - scratch [64]byte -} - -type phase int - -const ( - phase_anyExpectValue phase = iota - phase_mapExpectKeyOrEnd - phase_mapExpectValue - phase_arrExpectValueOrEnd -) - -func (d *Encoder) Step(tok *Token) (done bool, err error) { - switch d.current { - case phase_anyExpectValue: - switch tok.Type { - case TMapOpen: - d.pushPhase(phase_mapExpectKeyOrEnd) - d.wr.Write(wordMapOpen) - return false, nil - case TArrOpen: - d.pushPhase(phase_arrExpectValueOrEnd) - d.wr.Write(wordArrOpen) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value") - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of value") - default: - // It's a value; handle it. - d.flushValue(tok) - return true, nil - } - case phase_mapExpectKeyOrEnd: - switch tok.Type { - case TMapOpen: - return true, fmt.Errorf("unexpected mapOpen; expected start of key or end of map") - case TArrOpen: - return true, fmt.Errorf("unexpected arrOpen; expected start of key or end of map") - case TMapClose: - if d.some { - d.wr.Write(d.cfg.Line) - for i := 1; i < len(d.stack); i++ { - d.wr.Write(d.cfg.Indent) - } - } - d.wr.Write(wordMapClose) - return d.popPhase() - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of key or end of map") - default: - // It's a key. It'd better be a string. - switch tok.Type { - case TString: - d.entrySep() - d.emitString(tok.Str) - d.wr.Write(wordColon) - if d.cfg.Line != nil { - d.wr.Write(wordSpace) - } - d.current = phase_mapExpectValue - return false, nil - default: - return true, fmt.Errorf("unexpected token of type %T; expected map key", *tok) - } - } - case phase_mapExpectValue: - switch tok.Type { - case TMapOpen: - d.pushPhase(phase_mapExpectKeyOrEnd) - d.wr.Write(wordMapOpen) - return false, nil - case TArrOpen: - d.pushPhase(phase_arrExpectValueOrEnd) - d.wr.Write(wordArrOpen) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value") - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of value") - default: - // It's a value; handle it. - d.flushValue(tok) - d.current = phase_mapExpectKeyOrEnd - return false, nil - } - case phase_arrExpectValueOrEnd: - switch tok.Type { - case TMapOpen: - d.entrySep() - d.pushPhase(phase_mapExpectKeyOrEnd) - d.wr.Write(wordMapOpen) - return false, nil - case TArrOpen: - d.entrySep() - d.pushPhase(phase_arrExpectValueOrEnd) - d.wr.Write(wordArrOpen) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value or end of array") - case TArrClose: - if d.some { - d.wr.Write(d.cfg.Line) - for i := 1; i < len(d.stack); i++ { - d.wr.Write(d.cfg.Indent) - } - } - d.wr.Write(wordArrClose) - return d.popPhase() - default: - // It's a value; handle it. - d.entrySep() - d.flushValue(tok) - return false, nil - } - default: - panic("Unreachable") - } -} - -func (d *Encoder) pushPhase(p phase) { - d.current = p - d.stack = append(d.stack, d.current) - d.some = false -} - -// Pop a phase from the stack; return 'true' if stack now empty. -func (d *Encoder) popPhase() (bool, error) { - n := len(d.stack) - 1 - if n == 0 { - d.wr.Write(d.cfg.Line) - return true, nil - } - if n < 0 { // the state machines are supposed to have already errored better - panic("jsonEncoder stack overpopped") - } - d.current = d.stack[n-1] - d.stack = d.stack[0:n] - d.some = true - return false, nil -} - -// Emit an entry separater (comma), unless we're at the start of an object. -// Mark that we *do* have some content, regardless, so next time will need a sep. -func (d *Encoder) entrySep() { - if d.some { - d.wr.Write(wordComma) - } - d.some = true - d.wr.Write(d.cfg.Line) - for i := 0; i < len(d.stack); i++ { - d.wr.Write(d.cfg.Indent) - } -} - -func (d *Encoder) flushValue(tok *Token) { - switch tok.Type { - case TString: - d.emitString(tok.Str) - case TBool: - switch tok.Bool { - case true: - d.wr.Write(wordTrue) - case false: - d.wr.Write(wordFalse) - } - case TInt: - b := strconv.AppendInt(d.scratch[:0], tok.Int, 10) - d.wr.Write(b) - case TNull: - d.wr.Write(wordNull) - default: - panic(fmt.Errorf("TODO finish more jsonEncoder primitives support: unhandled token %s", tok)) - } -} - -func (d *Encoder) writeByte(b byte) { - d.scratch[0] = b - d.wr.Write(d.scratch[0:1]) -} diff --git a/vendor/github.com/polydawn/refmt/json/jsonEncoderTerminals.go b/vendor/github.com/polydawn/refmt/json/jsonEncoderTerminals.go deleted file mode 100644 index 2892875f..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonEncoderTerminals.go +++ /dev/null @@ -1,78 +0,0 @@ -package json - -import ( - "io" - "unicode/utf8" -) - -var hex = "0123456789abcdef" - -func (d *Encoder) emitString(s string) { - d.writeByte('"') - start := 0 - for i := 0; i < len(s); { - if b := s[i]; b < utf8.RuneSelf { - if 0x20 <= b && b != '\\' && b != '"' { - i++ - continue - } - if start < i { - d.wr.Write([]byte(s[start:i])) - } - switch b { - case '\\', '"': - d.writeByte('\\') - d.writeByte(b) - case '\n': - d.writeByte('\\') - d.writeByte('n') - case '\r': - d.writeByte('\\') - d.writeByte('r') - case '\t': - d.writeByte('\\') - d.writeByte('t') - default: - // This encodes bytes < 0x20 except for \t, \n and \r. - d.wr.Write([]byte(`\u00`)) - d.writeByte(hex[b>>4]) - d.writeByte(hex[b&0xF]) - } - i++ - start = i - continue - } - c, size := utf8.DecodeRuneInString(s[i:]) - if c == utf8.RuneError && size == 1 { - if start < i { - d.wr.Write([]byte(s[start:i])) - } - d.wr.Write([]byte(`\ufffd`)) - i += size - start = i - continue - } - // U+2028 is LINE SEPARATOR. - // U+2029 is PARAGRAPH SEPARATOR. - // They are both technically valid characters in JSON strings, - // but don't work in JSONP, which has to be evaluated as JavaScript, - // and can lead to security holes there. It is valid JSON to - // escape them, so we do so unconditionally. - // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion. - if c == '\u2028' || c == '\u2029' { - if start < i { - d.wr.Write([]byte(s[start:i])) - } - d.wr.Write([]byte(`\u202`)) - d.writeByte(hex[c&0xF]) - i += size - start = i - continue - } - i += size - } - if start < len(s) { - io.WriteString(d.wr, s[start:]) - } - d.writeByte('"') -} diff --git a/vendor/github.com/polydawn/refmt/json/jsonHelpers.go b/vendor/github.com/polydawn/refmt/json/jsonHelpers.go deleted file mode 100644 index 205dbe24..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonHelpers.go +++ /dev/null @@ -1,106 +0,0 @@ -package json - -import ( - "bytes" - "io" - - "github.com/polydawn/refmt/obj" - "github.com/polydawn/refmt/obj/atlas" - "github.com/polydawn/refmt/shared" -) - -// All of the methods in this file are exported, -// and their names and type declarations are intended to be -// identical to the naming and types of the golang stdlib -// 'encoding/json' packages, with ONE EXCEPTION: -// what stdlib calls "NewEncoder", we call "NewMarshaller"; -// what stdlib calls "NewDecoder", we call "NewUnmarshaller"; -// and similarly the types and methods are "Marshaller.Marshal" -// and "Unmarshaller.Unmarshal". -// You should be able to migrate with a sed script! -// -// (In refmt, the encoder/decoder systems are for token streams; -// if you're talking about object mapping, we consistently -// refer to that as marshalling/unmarshalling.) -// -// Most methods also have an "Atlased" variant, -// which lets you specify advanced type mapping instructions. - -func Marshal(v interface{}) ([]byte, error) { - var buf bytes.Buffer - if err := NewMarshaller(&buf).Marshal(v); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -func MarshalAtlased(cfg EncodeOptions, v interface{}, atl atlas.Atlas) ([]byte, error) { - var buf bytes.Buffer - if err := NewMarshallerAtlased(&buf, cfg, atl).Marshal(v); err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -type Marshaller struct { - marshaller *obj.Marshaller - encoder *Encoder - pump shared.TokenPump -} - -func (x *Marshaller) Marshal(v interface{}) error { - x.marshaller.Bind(v) - x.encoder.Reset() - return x.pump.Run() -} - -func NewMarshaller(wr io.Writer) *Marshaller { - return NewMarshallerAtlased(wr, EncodeOptions{}, atlas.MustBuild()) -} - -func NewMarshallerAtlased(wr io.Writer, cfg EncodeOptions, atl atlas.Atlas) *Marshaller { - x := &Marshaller{ - marshaller: obj.NewMarshaller(atl), - encoder: NewEncoder(wr, cfg), - } - x.pump = shared.TokenPump{ - x.marshaller, - x.encoder, - } - return x -} - -func Unmarshal(data []byte, v interface{}) error { - return NewUnmarshaller(bytes.NewBuffer(data)).Unmarshal(v) -} - -func UnmarshalAtlased(data []byte, v interface{}, atl atlas.Atlas) error { - return NewUnmarshallerAtlased(bytes.NewBuffer(data), atl).Unmarshal(v) -} - -type Unmarshaller struct { - unmarshaller *obj.Unmarshaller - decoder *Decoder - pump shared.TokenPump -} - -func (x *Unmarshaller) Unmarshal(v interface{}) error { - x.unmarshaller.Bind(v) - x.decoder.Reset() - return x.pump.Run() -} - -func NewUnmarshaller(r io.Reader) *Unmarshaller { - return NewUnmarshallerAtlased(r, atlas.MustBuild()) -} -func NewUnmarshallerAtlased(r io.Reader, atl atlas.Atlas) *Unmarshaller { - x := &Unmarshaller{ - unmarshaller: obj.NewUnmarshaller(atl), - decoder: NewDecoder(r), - } - x.pump = shared.TokenPump{ - x.decoder, - x.unmarshaller, - } - return x -} diff --git a/vendor/github.com/polydawn/refmt/json/jsonOptions.go b/vendor/github.com/polydawn/refmt/json/jsonOptions.go deleted file mode 100644 index 6a9b69c3..00000000 --- a/vendor/github.com/polydawn/refmt/json/jsonOptions.go +++ /dev/null @@ -1,23 +0,0 @@ -package json - -type EncodeOptions struct { - // If set, this will be prefixed to every "line" to pretty-print. - // (Typically you want to just set this to `[]byte{'\n'}`!) - Line []byte - - // If set, this will be prefixed $N$ times before each line's content to pretty-print. - // (Likely values are a tab, or a few spaces.) - Indent []byte -} - -// marker method -- you may use this type to instruct `refmt.Marshal` -// what kind of encoder to use. -func (EncodeOptions) IsEncodeOptions() {} - -type DecodeOptions struct { - // future: options to validate canonical serial order -} - -// marker method -- you may use this type to instruct `refmt.Marshal` -// what kind of encoder to use. -func (DecodeOptions) IsDecodeOptions() {} diff --git a/vendor/github.com/polydawn/refmt/marshalHelpers.go b/vendor/github.com/polydawn/refmt/marshalHelpers.go deleted file mode 100644 index dcd4df06..00000000 --- a/vendor/github.com/polydawn/refmt/marshalHelpers.go +++ /dev/null @@ -1,61 +0,0 @@ -package refmt - -import ( - "io" - - "github.com/polydawn/refmt/cbor" - "github.com/polydawn/refmt/json" - "github.com/polydawn/refmt/obj/atlas" -) - -type EncodeOptions interface { - IsEncodeOptions() // marker method. -} - -func Marshal(opts EncodeOptions, v interface{}) ([]byte, error) { - switch o2 := opts.(type) { - case json.EncodeOptions: - return json.MarshalAtlased(o2, v, atlas.MustBuild()) - case cbor.EncodeOptions: - return cbor.MarshalAtlased(v, atlas.MustBuild()) - default: - panic("incorrect usage: unknown EncodeOptions type") - } -} - -func MarshalAtlased(opts EncodeOptions, v interface{}, atl atlas.Atlas) ([]byte, error) { - switch o2 := opts.(type) { - case json.EncodeOptions: - return json.MarshalAtlased(o2, v, atl) - case cbor.EncodeOptions: - return cbor.MarshalAtlased(v, atl) - default: - panic("incorrect usage: unknown EncodeOptions type") - } -} - -type Marshaller interface { - Marshal(v interface{}) error -} - -func NewMarshaller(opts EncodeOptions, wr io.Writer) Marshaller { - switch o2 := opts.(type) { - case json.EncodeOptions: - return json.NewMarshallerAtlased(wr, o2, atlas.MustBuild()) - case cbor.EncodeOptions: - return cbor.NewMarshaller(wr) - default: - panic("incorrect usage: unknown EncodeOptions type") - } -} - -func NewMarshallerAtlased(opts EncodeOptions, wr io.Writer, atl atlas.Atlas) Marshaller { - switch o2 := opts.(type) { - case json.EncodeOptions: - return json.NewMarshallerAtlased(wr, o2, atl) - case cbor.EncodeOptions: - return cbor.NewMarshallerAtlased(wr, atl) - default: - panic("incorrect usage: unknown EncodeOptions type") - } -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/atlas.go b/vendor/github.com/polydawn/refmt/obj/atlas/atlas.go deleted file mode 100644 index f96b4cb1..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/atlas.go +++ /dev/null @@ -1,79 +0,0 @@ -package atlas - -import ( - "fmt" - "reflect" -) - -type Atlas struct { - // Map typeinfo to a static description of how that type should be handled. - // (The internal machinery that will wield this information, and has memory of - // progress as it does so, is configured using the AtlasEntry, but allocated separately. - // The machinery is stateful and mutable; the AtlasEntry is not.) - // - // We use 'var rtid uintptr = reflect.ValueOf(rt).Pointer()' -- pointer of the - // value of the reflect.Type info -- as an index. - // This is both unique and correctly converges when recomputed, and much - // faster to compare against than reflect.Type (which is an interface that - // tends to contain fairly large structures). - mappings map[uintptr]*AtlasEntry - - // Mapping of tag ints to atlasEntry for quick lookups when the - // unmarshaller hits a tag. Values are a subset of `mappings`. - tagMappings map[int]*AtlasEntry - - // MapMorphism specifies the default map sorting scheme - defaultMapMorphism *MapMorphism -} - -func Build(entries ...*AtlasEntry) (Atlas, error) { - atl := Atlas{ - mappings: make(map[uintptr]*AtlasEntry), - tagMappings: make(map[int]*AtlasEntry), - defaultMapMorphism: &MapMorphism{KeySortMode_Default}, - } - for _, entry := range entries { - rtid := reflect.ValueOf(entry.Type).Pointer() - if _, exists := atl.mappings[rtid]; exists { - return Atlas{}, fmt.Errorf("repeated entry for type %v", entry.Type) - } - atl.mappings[rtid] = entry - - if entry.Tagged == true { - if prev, exists := atl.tagMappings[entry.Tag]; exists { - return Atlas{}, fmt.Errorf("repeated tag %v on type %v (already mapped to type %v)", entry.Tag, entry.Type, prev.Type) - } - atl.tagMappings[entry.Tag] = entry - } - } - return atl, nil -} -func MustBuild(entries ...*AtlasEntry) Atlas { - atl, err := Build(entries...) - if err != nil { - panic(err) - } - return atl -} - -func (atl Atlas) WithMapMorphism(m MapMorphism) Atlas { - atl.defaultMapMorphism = &m - return atl -} - -// Gets the AtlasEntry for a typeID. Used by obj package, not meant for user facing. -func (atl Atlas) Get(rtid uintptr) (*AtlasEntry, bool) { - ent, ok := atl.mappings[rtid] - return ent, ok -} - -// Gets the AtlasEntry for a tag int. Used by obj package, not meant for user facing. -func (atl Atlas) GetEntryByTag(tag int) (*AtlasEntry, bool) { - ent, ok := atl.tagMappings[tag] - return ent, ok -} - -// Gets the default map morphism config. Used by obj package, not meant for user facing. -func (atl Atlas) GetDefaultMapMorphism() *MapMorphism { - return atl.defaultMapMorphism -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/atlasCommon.go b/vendor/github.com/polydawn/refmt/obj/atlas/atlasCommon.go deleted file mode 100644 index 611481b2..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/atlasCommon.go +++ /dev/null @@ -1,10 +0,0 @@ -package atlas - -// A type to enumerate key sorting modes. -type KeySortMode string - -const ( - KeySortMode_Default = KeySortMode("default") // the default mode -- for structs, this is the source-order of the fields; for maps, it's identify to "strings" sort mode. - KeySortMode_Strings = KeySortMode("strings") // lexical sort by strings. this *is* the default for maps; it overrides source-order sorting for structs. - KeySortMode_RFC7049 = KeySortMode("rfc7049") // "Canonical" as proposed by rfc7049 § 3.9 (shorter byte sequences sort to top). -) diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/atlasEntry.go b/vendor/github.com/polydawn/refmt/obj/atlas/atlasEntry.go deleted file mode 100644 index 4c3ee457..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/atlasEntry.go +++ /dev/null @@ -1,150 +0,0 @@ -package atlas - -import ( - "reflect" -) - -/* - The AtlasEntry is a declarative roadmap of what we should do for - marshal and unmarshal of a single object, keyed by type. - - There are a lot of paths your mappings might want to take: - - - For a struct type, you may simply want to specify some alternate keys, or some to leave out, etc. - - For an interface type, you probably want to specify one of our interface muxing strategies - with a mapping between enumstr:typeinfo (and, what to do if we get a struct we don't recognize). - - For a string, int, or other primitive, you don't need to say anything: defaults will DTRT. - - For a typedef'd string, int, or other primitive, you *still* don't need to say anything: but, - if you want custom behavior (say, transform the string to an int at the last second, and back again), - you can specify transformer functions for that. - - For a struct type that you want to turn into a whole different kind (like a string): use - those same transform functions. (You'll no longer need a FieldMap.) - - For the most esoteric needs, you can fall all the way back to providing a custom MarshalMachine - (but avoid that; it's a lot of work, and one of these other transform methods should suffice). -*/ -type AtlasEntry struct { - // The reflect info of the type this morphism is regarding. - Type reflect.Type - - // -------------------------------------------------------- - // The big escape valves: wanna map to some other kind completely? - // -------------------------------------------------------- - - // Transforms the value we reached by walking (the 'live' value -- which - // must be of `this.Type`) into another value (the 'serialable' value -- - // which will be of `this.MarshalTransformTargetType`). - // - // The target type may be anything, even of a completely different Kind! - // - // This transform func runs first, then the resulting value is - // serialized (by running through the path through Atlas again, so - // chaining of transform funcs is supported, though not recommended). - MarshalTransformFunc MarshalTransformFunc - // The type of value we expect after using the MarshalTransformFunc. - // - // The match between transform func and target type should be checked - // during construction of this AtlasEntry. - MarshalTransformTargetType reflect.Type - - // Expects a different type (the 'serialable' value -- which will be of - // 'this.UnmarshalTransformTargetType') than the value we reached by - // walking (the 'live' value -- which must be of `this.Type`). - // - // The target type may be anything, even of a completely different Kind! - // - // The unmarshal of that target type will be run first, then the - // resulting value is fed through this function to produce the real value, - // which is then placed correctly into bigger mid-unmarshal object tree. - // - // For non-primitives, unmarshal of the target type will always target - // an empty pointer or empty slice, roughly as per if it was - // operating on a value produced by `TargetType.New()`. - UnmarshalTransformFunc UnmarshalTransformFunc - // The type of value we will manufacture an instance of and unmarshal - // into, then when done provide to the UnmarshalTransformFunc. - // - // The match between transform func and target type should be checked - // during construction of this AtlasEntry. - UnmarshalTransformTargetType reflect.Type - - // -------------------------------------------------------- - // Standard options for how to map (varies by Kind) - // -------------------------------------------------------- - - // A "tag" to emit when marshalling this type of value; - // and when unmarshalling, this tag will cause unmarshal to pick - // this atlas (and if there's conflicting type info, error). - Tag int - // Flag for whether the Tag feature should be used (zero is a valid tag). - Tagged bool - - // A mapping of fields in a struct to serial keys. - // Only valid if `this.Type.Kind() == Struct`. - StructMap *StructMap - - // Configuration for how to traverse a map kind. - // Only valid if `this.Type.Kind() == Map`. - MapMorphism *MapMorphism - - // Configuration for how to pick concrete types to fill a union interface. - // Only valid if `this.Type.Kind() == Interface`. - UnionKeyedMorphism *UnionKeyedMorphism - - // FUTURE: enum-ish primitives, multiplexers for interfaces, - // lots of such things will belong here. - - // -------------------------------------------------------- - // Hooks, validate helpers - // -------------------------------------------------------- - - // A validation function which will be called for the whole value - // after unmarshalling reached the end of the object. - // If it returns an error, the entire unmarshal will error. - // - // Not used in marshalling. - // Not reachable if an UnmarshalTransform is set. - ValidateFn func(v interface{}) error -} - -func BuildEntry(typeHintObj interface{}) *BuilderCore { - rt := reflect.TypeOf(typeHintObj) - if rt.Kind() == reflect.Ptr { - if rt.Elem().Kind() == reflect.Interface { - rt = rt.Elem() - } else { - panic("invalid atlas build: use the bare object, not a pointer (refmt will handle pointers automatically)") - } - } - return &BuilderCore{ - &AtlasEntry{Type: rt}, - } -} - -/* - Intermediate step in building an AtlasEntry: use `BuildEntry` to - get one of these to start with, then call one of the methods - on this type to get a specialized builder which has the methods - relevant for setting up that specific kind of mapping. - - One full example of using this builder may look like the following: - - atlas.BuildEntry(Formula{}).StructMap().Autogenerate().Complete() - - Some intermediate manipulations may be performed on this object, - for example setting the "tag" (if you want to use cbor tagging), - before calling the specializer method. - In this case, just keep chaining the configuration calls like so: - - atlas.BuildEntry(Formula{}).UseTag(4000) - .StructMap().Autogenerate().Complete() - -*/ -type BuilderCore struct { - entry *AtlasEntry -} - -func (x *BuilderCore) UseTag(tag int) *BuilderCore { - x.entry.Tagged = true - x.entry.Tag = tag - return x -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/doc.go b/vendor/github.com/polydawn/refmt/obj/atlas/doc.go deleted file mode 100644 index 52e6ddb2..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/doc.go +++ /dev/null @@ -1,45 +0,0 @@ -/* - Atlas types are used to define how to map Go values into refmt token streams. - - Atlas information may be autogenerated based on struct tags automatically, - but you can also specify custom AtlasEntry info to use advanced features - and define custom transformations. - - An Atlas is a collection of AtlasEntry (plus some internal indexing). - Typical usage is to declare an AtlasEntry for your structs (often near by the - struct definition), then - - Building an AtlasEntry for some type called `Formula` looks like this: - - atlas.BuildEntry(Formula{}).StructMap().Autogenerate().Complete() - - Building an AtlasEntry always starts with `atlas.BuildEntry(x)` where `x` is - a dummy object used to convey type information. - The next function in the chain declares what kind of behavior we're going - to use to turn that type of object into its serial form. - (In the above example, we're declaring that we want refmt to see the `Formula` - type as a struct and traverse its fields. There are many other options!) - Subsequent functions are specific to what kind of walking and mapping we've - chosen. For struct walking, this may involve declaring fields and custom serial - names to map them to; for a "Transform" we'd instead have to provide callbacks - to do the transformation from the `Formula` type to some other type; etcetera. - The final function in the chain is always called `Complete`, and returns - a ready-to-use AtlasEntry. - - Building a complete Atlas for a whole suite of serializable types is as - easy as putting a bunch of them together: - - atlas.Build( - atlas.BuildEntry(Foo{}).StructMap().Autogenerate().Complete(), - atlas.BuildEntry(Bar{}).StructMap().Autogenerate().Complete(), - atlas.BuildEntry(Baz{}).StructMap().Autogenerate().Complete(), - ) - - You can put your entire protocol into one Atlas. - It's also possible to build several different Atlases each with different - sets of AtlasEntry. This may be useful if you have a protocol where some - messages are not valid during some phases of communication, and you would - like to use the Atlas as a form of whitelisting for what can be - marshalled/unmarshalled. -*/ -package atlas diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/errors.go b/vendor/github.com/polydawn/refmt/obj/atlas/errors.go deleted file mode 100644 index 48fe37f7..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/errors.go +++ /dev/null @@ -1,14 +0,0 @@ -package atlas - -// Error type raised when initializing an Atlas, and field entries do -// not resolve against the type. -// (If you recently refactored names of fields in your types, check -// to make sure you updated any references to those fields by name to match!) -type ErrStructureMismatch struct { - TypeName string - Reason string -} - -func (e ErrStructureMismatch) Error() string { - return "structure mismatch: " + e.TypeName + " " + e.Reason -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/mapMorphism.go b/vendor/github.com/polydawn/refmt/obj/atlas/mapMorphism.go deleted file mode 100644 index b5602cdc..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/mapMorphism.go +++ /dev/null @@ -1,38 +0,0 @@ -package atlas - -import ( - "fmt" - "reflect" -) - -type MapMorphism struct { - KeySortMode KeySortMode -} - -func (x *BuilderCore) MapMorphism() *BuilderMapMorphism { - if x.entry.Type.Kind() != reflect.Map { - panic(fmt.Errorf("cannot use mapMorphism for type %q, which is kind %s", x.entry.Type, x.entry.Type.Kind())) - } - x.entry.MapMorphism = &MapMorphism{ - KeySortMode_Default, - } - return &BuilderMapMorphism{x.entry} -} - -type BuilderMapMorphism struct { - entry *AtlasEntry -} - -func (x *BuilderMapMorphism) Complete() *AtlasEntry { - return x.entry -} - -func (x *BuilderMapMorphism) SetKeySortMode(km KeySortMode) *BuilderMapMorphism { - switch km { - case KeySortMode_Default, KeySortMode_Strings, KeySortMode_RFC7049: - x.entry.MapMorphism.KeySortMode = km - default: - panic(fmt.Errorf("invalid key sort mode %q", km)) - } - return x -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/structMap.go b/vendor/github.com/polydawn/refmt/obj/atlas/structMap.go deleted file mode 100644 index 0ede93c9..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/structMap.go +++ /dev/null @@ -1,46 +0,0 @@ -package atlas - -import "reflect" - -type StructMap struct { - // A slice of descriptions of each field in the type. - // Each entry specifies the name by which each field should be referenced - // when serialized, and defines a way to get an address to the field. - Fields []StructMapEntry -} - -type StructMapEntry struct { - // The field name; will be emitted as token during marshal, and used for - // lookup during unmarshal. Required. - SerialName string - - // If true, a key token with this SerialName will be ignored during unmarshal. - // (By default, if there's no StructMapEntry for a key token, it's an error.) - // If true, the ReflectRoute, Type, etc fields are irrelevant and may be nil. - Ignore bool - - ReflectRoute ReflectRoute // reflection generates these. - Type reflect.Type // type to expect on the far side of the ReflectRoute. - tagged bool // used during autogen. - - // Theoretical feature which would be alternative to ReflectRoute. Support dropped for the moment. - //addrFunc func(interface{}) interface{} // custom user function. - - // If true, marshalling will skip this field if it's the zero value. - OmitEmpty bool -} - -type ReflectRoute []int - -func (rr ReflectRoute) TraverseToValue(v reflect.Value) reflect.Value { - for _, i := range rr { - if v.Kind() == reflect.Ptr { - if v.IsNil() { - return reflect.Value{} - } - v = v.Elem() - } - v = v.Field(i) - } - return v -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/structMapAutogen.go b/vendor/github.com/polydawn/refmt/obj/atlas/structMapAutogen.go deleted file mode 100644 index 32fb57cc..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/structMapAutogen.go +++ /dev/null @@ -1,320 +0,0 @@ -package atlas - -import ( - "fmt" - "reflect" - "sort" - "strings" - "unicode" -) - -func AutogenerateStructMapEntry(rt reflect.Type) *AtlasEntry { - return AutogenerateStructMapEntryUsingTags(rt, "refmt", KeySortMode_Default) -} - -func AutogenerateStructMapEntryUsingTags(rt reflect.Type, tagName string, sorter KeySortMode) *AtlasEntry { - if rt.Kind() != reflect.Struct { - panic(fmt.Errorf("cannot use structMap for type %q, which is kind %s", rt, rt.Kind())) - } - entry := &AtlasEntry{ - Type: rt, - StructMap: &StructMap{Fields: exploreFields(rt, tagName, sorter)}, - } - return entry -} - -// exploreFields returns a list of fields that StructAtlas should recognize for the given type. -// The algorithm is breadth-first search over the set of structs to include - the top struct -// and then any reachable anonymous structs. -func exploreFields(rt reflect.Type, tagName string, sorter KeySortMode) []StructMapEntry { - // Anonymous fields to explore at the current level and the next. - current := []StructMapEntry{} - next := []StructMapEntry{{Type: rt}} - - // Count of queued names for current level and the next. - count := map[reflect.Type]int{} - nextCount := map[reflect.Type]int{} - - // Types already visited at an earlier level. - visited := map[reflect.Type]bool{} - - // Fields found. - var fields []StructMapEntry - - for len(next) > 0 { - current, next = next, current[:0] - count, nextCount = nextCount, map[reflect.Type]int{} - - for _, f := range current { - if visited[f.Type] { - continue - } - visited[f.Type] = true - - // Scan f.Type for fields to include. - for i := 0; i < f.Type.NumField(); i++ { - sf := f.Type.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported - continue - } - tag := sf.Tag.Get(tagName) - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if !isValidTag(name) { - name = "" - } - route := make([]int, len(f.ReflectRoute)+1) - copy(route, f.ReflectRoute) - route[len(f.ReflectRoute)] = i - - ft := sf.Type - if ft.Name() == "" && ft.Kind() == reflect.Ptr { - // Follow pointer. - ft = ft.Elem() - } - - // Record found field and index sequence. - if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { - tagged := name != "" - if name == "" { - name = downcaseFirstLetter(sf.Name) - } - fields = append(fields, StructMapEntry{ - SerialName: name, - ReflectRoute: route, - Type: sf.Type, - tagged: tagged, - OmitEmpty: opts.Contains("omitempty"), - }) - if count[f.Type] > 1 { - // If there were multiple instances, add a second, - // so that the annihilation code will see a duplicate. - // It only cares about the distinction between 1 or 2, - // so don't bother generating any more copies. - fields = append(fields, fields[len(fields)-1]) - } - continue - } - - // Record new anonymous struct to explore in next round. - nextCount[ft]++ - if nextCount[ft] == 1 { - next = append(next, StructMapEntry{ - ReflectRoute: route, - Type: ft, - }) - } - } - } - } - - sort.Sort(StructMapEntry_byName(fields)) - - // Delete all fields that are hidden by the Go rules for embedded fields, - // except that fields with JSON tags are promoted. - - // The fields are sorted in primary order of name, secondary order - // of field index length. Loop over names; for each name, delete - // hidden fields by choosing the one dominant field that survives. - out := fields[:0] - for advance, i := 0, 0; i < len(fields); i += advance { - // One iteration per name. - // Find the sequence of fields with the name of this first field. - fi := fields[i] - name := fi.SerialName - for advance = 1; i+advance < len(fields); advance++ { - fj := fields[i+advance] - if fj.SerialName != name { - break - } - } - if advance == 1 { // Only one field with this name - out = append(out, fi) - continue - } - dominant, ok := dominantField(fields[i : i+advance]) - if ok { - out = append(out, dominant) - } - } - - fields = out - switch sorter { - case KeySortMode_Default: - sort.Sort(StructMapEntry_byFieldRoute(fields)) - case KeySortMode_Strings: - //sort.Sort(StructMapEntry_byName(fields)) - // it's already in this order, though, so, pass - case KeySortMode_RFC7049: - sort.Sort(StructMapEntry_RFC7049(fields)) - default: - panic("invalid struct sorter option") - } - - return fields -} - -// If the first character of the string is uppercase, return a string -// where it is switched to lowercase. -// We use this to make go field names look more like what everyone else -// in the universe expects their json to look like by default: snakeCase. -func downcaseFirstLetter(s string) string { - if s == "" { - return "" - } - r := rune(s[0]) // if multibyte chars: you're left alone. - if !unicode.IsUpper(r) { - return s - } - return string(unicode.ToLower(r)) + s[1:] -} - -// dominantField looks through the fields, all of which are known to -// have the same name, to find the single field that dominates the -// others using Go's embedding rules, modified by the presence of -// JSON tags. If there are multiple top-level fields, the boolean -// will be false: This condition is an error in Go and we skip all -// the fields. -func dominantField(fields []StructMapEntry) (StructMapEntry, bool) { - // The fields are sorted in increasing index-length order. The winner - // must therefore be one with the shortest index length. Drop all - // longer entries, which is easy: just truncate the slice. - length := len(fields[0].ReflectRoute) - tagged := -1 // Index of first tagged field. - for i, f := range fields { - if len(f.ReflectRoute) > length { - fields = fields[:i] - break - } - if f.tagged { - if tagged >= 0 { - // Multiple tagged fields at the same level: conflict. - // Return no field. - return StructMapEntry{}, false - } - tagged = i - } - } - if tagged >= 0 { - return fields[tagged], true - } - // All remaining fields have the same length. If there's more than one, - // we have a conflict (two fields named "X" at the same level) and we - // return no field. - if len(fields) > 1 { - return StructMapEntry{}, false - } - return fields[0], true -} - -// StructMapEntry_byName sorts field by name, -// breaking ties with depth, -// then breaking ties with "name came from tag", -// then breaking ties with FieldRoute sequence. -type StructMapEntry_byName []StructMapEntry - -func (x StructMapEntry_byName) Len() int { return len(x) } -func (x StructMapEntry_byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x StructMapEntry_byName) Less(i, j int) bool { - if x[i].SerialName != x[j].SerialName { - return x[i].SerialName < x[j].SerialName - } - if len(x[i].ReflectRoute) != len(x[j].ReflectRoute) { - return len(x[i].ReflectRoute) < len(x[j].ReflectRoute) - } - if x[i].tagged != x[j].tagged { - return x[i].tagged - } - return StructMapEntry_byFieldRoute(x).Less(i, j) -} - -// StructMapEntry_RFC7049 sorts fields as specified in RFC7049, -type StructMapEntry_RFC7049 []StructMapEntry - -func (x StructMapEntry_RFC7049) Len() int { return len(x) } -func (x StructMapEntry_RFC7049) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x StructMapEntry_RFC7049) Less(i, j int) bool { - il, jl := len(x[i].SerialName), len(x[j].SerialName) - switch { - case il < jl: - return true - case il > jl: - return false - default: - return x[i].SerialName < x[j].SerialName - } -} - -// StructMapEntry_byFieldRoute sorts field by FieldRoute sequence -// (e.g., roughly source declaration order within each type). -type StructMapEntry_byFieldRoute []StructMapEntry - -func (x StructMapEntry_byFieldRoute) Len() int { return len(x) } -func (x StructMapEntry_byFieldRoute) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x StructMapEntry_byFieldRoute) Less(i, j int) bool { - for k, xik := range x[i].ReflectRoute { - if k >= len(x[j].ReflectRoute) { - return false - } - if xik != x[j].ReflectRoute[k] { - return xik < x[j].ReflectRoute[k] - } - } - return len(x[i].ReflectRoute) < len(x[j].ReflectRoute) -} - -// tagOptions is the string following a comma in a struct field's -// tag, or the empty string. It does not include the leading comma. -type tagOptions string - -// parseTag splits a struct field's tag into its name and -// comma-separated options. -func parseTag(tag string) (string, tagOptions) { - if idx := strings.Index(tag, ","); idx != -1 { - return tag[:idx], tagOptions(tag[idx+1:]) - } - return tag, tagOptions("") -} - -// Contains reports whether a comma-separated list of options -// contains a particular substr flag. substr must be surrounded by a -// string boundary or commas. -func (o tagOptions) Contains(optionName string) bool { - if len(o) == 0 { - return false - } - s := string(o) - for s != "" { - var next string - i := strings.Index(s, ",") - if i >= 0 { - s, next = s[:i], s[i+1:] - } - if s == optionName { - return true - } - s = next - } - return false -} - -func isValidTag(s string) bool { - if s == "" { - return false - } - for _, c := range s { - switch { - case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): - // Backslash and quote chars are reserved, but - // otherwise any punctuation chars are allowed - // in a tag name. - default: - if !unicode.IsLetter(c) && !unicode.IsDigit(c) { - return false - } - } - } - return true -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/structMapBuilding.go b/vendor/github.com/polydawn/refmt/obj/atlas/structMapBuilding.go deleted file mode 100644 index 1c9fd32e..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/structMapBuilding.go +++ /dev/null @@ -1,96 +0,0 @@ -package atlas - -import ( - "fmt" - "reflect" - "strings" -) - -func (x *BuilderCore) StructMap() *BuilderStructMap { - if x.entry.Type.Kind() != reflect.Struct { - panic(fmt.Errorf("cannot use structMap for type %q, which is kind %s", x.entry.Type, x.entry.Type.Kind())) - } - x.entry.StructMap = &StructMap{} - return &BuilderStructMap{x.entry} -} - -type BuilderStructMap struct { - entry *AtlasEntry -} - -func (x *BuilderStructMap) Complete() *AtlasEntry { - return x.entry -} - -/* - Add a field to the mapping based on its name. - - Given a struct: - - struct{ - X int - Y struct{ Z int } - } - - `AddField("X", {"x", ...}) will cause that field to be serialized as key "x"; - `AddField("Y.Z", {"z", ...})` will cause that *nested* field to be serialized - as key "z" in the same object (e.g. "x" and "z" will be siblings). - - Returns the mutated builder for convenient call chaining. - - If the fieldName string doesn't map onto the structure type info, - a panic will be raised. -*/ -func (x *BuilderStructMap) AddField(fieldName string, mapping StructMapEntry) *BuilderStructMap { - fieldNameSplit := strings.Split(fieldName, ".") - rr, rt, err := fieldNameToReflectRoute(x.entry.Type, fieldNameSplit) - if err != nil { - panic(err) // REVIEW: now that we have the builder obj, we could just curry these into it until 'Complete' is called (or, thus, 'MustComplete'!). - } - mapping.ReflectRoute = rr - mapping.Type = rt - x.entry.StructMap.Fields = append(x.entry.StructMap.Fields, mapping) - return x -} - -func (x *BuilderStructMap) IgnoreKey(serialKeyName string) *BuilderStructMap { - x.entry.StructMap.Fields = append(x.entry.StructMap.Fields, StructMapEntry{ - SerialName: serialKeyName, - Ignore: true, - }) - return x -} - -func fieldNameToReflectRoute(rt reflect.Type, fieldNameSplit []string) (rr ReflectRoute, _ reflect.Type, _ error) { - for _, fn := range fieldNameSplit { - rf, ok := rt.FieldByName(fn) - if !ok { - return nil, nil, ErrStructureMismatch{rt.Name(), "does not have field named " + fn} - } - rr = append(rr, rf.Index...) - rt = rf.Type - } - return rr, rt, nil -} - -/* - Automatically generate mappings by looking at the struct type info, - taking any hints from tags, and appending that to the builder. - - You may use autogeneration in concert with manually adding field mappings, - though if doing so be mindful not to map the same fields twice. -*/ -func (x *BuilderStructMap) Autogenerate() *BuilderStructMap { - autoEntry := AutogenerateStructMapEntry(x.entry.Type) - x.entry.StructMap.Fields = append(x.entry.StructMap.Fields, autoEntry.StructMap.Fields...) - return x -} - -/* - Automatically generate mappings using a given struct field sorting scheme -*/ -func (x *BuilderStructMap) AutogenerateWithSortingScheme(sorting KeySortMode) *BuilderStructMap { - autoEntry := AutogenerateStructMapEntryUsingTags(x.entry.Type, "refmt", sorting) - x.entry.StructMap.Fields = append(x.entry.StructMap.Fields, autoEntry.StructMap.Fields...) - return x -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/transformBuilding.go b/vendor/github.com/polydawn/refmt/obj/atlas/transformBuilding.go deleted file mode 100644 index 6892fdcd..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/transformBuilding.go +++ /dev/null @@ -1,30 +0,0 @@ -package atlas - -import ( - "reflect" -) - -func (x *BuilderCore) Transform() *BuilderTransform { - // no checks on x.entry.Type.Kind() here -- transforms can be pretty much any<->any - return &BuilderTransform{x.entry} -} - -type BuilderTransform struct { - entry *AtlasEntry -} - -func (x *BuilderTransform) Complete() *AtlasEntry { - return x.entry -} - -func (x *BuilderTransform) TransformMarshal(trFunc MarshalTransformFunc, toType reflect.Type) *BuilderTransform { - x.entry.MarshalTransformFunc = trFunc - x.entry.MarshalTransformTargetType = toType - return x -} - -func (x *BuilderTransform) TransformUnmarshal(trFunc UnmarshalTransformFunc, toType reflect.Type) *BuilderTransform { - x.entry.UnmarshalTransformFunc = trFunc - x.entry.UnmarshalTransformTargetType = toType - return x -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/transformFuncs.go b/vendor/github.com/polydawn/refmt/obj/atlas/transformFuncs.go deleted file mode 100644 index 5cfe98fc..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/transformFuncs.go +++ /dev/null @@ -1,68 +0,0 @@ -package atlas - -import "reflect" - -type MarshalTransformFunc func(liveForm reflect.Value) (serialForm reflect.Value, err error) -type UnmarshalTransformFunc func(serialForm reflect.Value) (liveForm reflect.Value, err error) - -var err_rt = reflect.TypeOf((*error)(nil)).Elem() - -/* - Takes a wildcard object which must be `func (live T1) (serialable T2, error)` - and returns a MarshalTransformFunc and the typeinfo of T2. -*/ -func MakeMarshalTransformFunc(fn interface{}) (MarshalTransformFunc, reflect.Type) { - fn_rv := reflect.ValueOf(fn) - if fn_rv.Kind() != reflect.Func { - panic("no") - } - fn_rt := fn_rv.Type() - if fn_rt.NumIn() != 1 { - panic("no") - } - if fn_rt.NumOut() != 2 { - panic("no") - } - if !fn_rt.Out(1).AssignableTo(err_rt) { - panic("no") - } - // nothing to do for `fn_rt.In(0)` -- whatever type it is... TODO redesign to make less sketchy; we should most certainly be able to check this in the builder - out_rt := fn_rt.Out(0) - return func(liveForm reflect.Value) (serialForm reflect.Value, err error) { - results := fn_rv.Call([]reflect.Value{liveForm}) - if results[1].IsNil() { - return results[0], nil - } - return results[0], results[1].Interface().(error) - }, out_rt -} - -/* - Takes a wildcard object which must be `func (serialable T1) (live T2, error)` - and returns a UnmarshalTransformFunc and the typeinfo of T1. -*/ -func MakeUnmarshalTransformFunc(fn interface{}) (UnmarshalTransformFunc, reflect.Type) { - fn_rv := reflect.ValueOf(fn) - if fn_rv.Kind() != reflect.Func { - panic("no") - } - fn_rt := fn_rv.Type() - if fn_rt.NumIn() != 1 { - panic("no") - } - if fn_rt.NumOut() != 2 { - panic("no") - } - if !fn_rt.Out(1).AssignableTo(err_rt) { - panic("no") - } - // nothing to do for checking `fn_rf.Out(0)` -- because we don't know what entry we're about to be used for. TODO redesign to make less sketchy. - in_rt := fn_rt.In(0) - return func(serialForm reflect.Value) (liveForm reflect.Value, err error) { - results := fn_rv.Call([]reflect.Value{serialForm}) - if results[1].IsNil() { - return results[0], nil - } - return results[0], results[1].Interface().(error) - }, in_rt -} diff --git a/vendor/github.com/polydawn/refmt/obj/atlas/unionMorphism.go b/vendor/github.com/polydawn/refmt/obj/atlas/unionMorphism.go deleted file mode 100644 index 80831856..00000000 --- a/vendor/github.com/polydawn/refmt/obj/atlas/unionMorphism.go +++ /dev/null @@ -1,45 +0,0 @@ -package atlas - -import ( - "fmt" - "reflect" - "sort" -) - -type UnionKeyedMorphism struct { - // Mapping of typehint key strings to atlasEntry that should be delegated to. - Elements map[string]*AtlasEntry - // Mapping of rtid to string (roughly the dual of the Elements map). - Mappings map[uintptr]string - // Purely to have in readiness for error messaging. - KnownMembers []string -} - -func (x *BuilderCore) KeyedUnion() *BuilderUnionKeyedMorphism { - if x.entry.Type.Kind() != reflect.Interface { - panic(fmt.Errorf("cannot use union morphisms for type %q, which is kind %s", x.entry.Type, x.entry.Type.Kind())) - } - x.entry.UnionKeyedMorphism = &UnionKeyedMorphism{ - Elements: make(map[string]*AtlasEntry), - Mappings: make(map[uintptr]string), - } - return &BuilderUnionKeyedMorphism{x.entry} -} - -type BuilderUnionKeyedMorphism struct { - entry *AtlasEntry -} - -func (x *BuilderUnionKeyedMorphism) Of(elements map[string]*AtlasEntry) *AtlasEntry { - cfg := x.entry.UnionKeyedMorphism - for hint, ent := range elements { - // FIXME: check that all the delegates are... well struct or map machines really, but definitely blacklisting other delegating machinery. - // FIXME: and sanity check that they can all be assigned to the interface ffs. - - cfg.Elements[hint] = ent - cfg.Mappings[reflect.ValueOf(ent.Type).Pointer()] = hint - cfg.KnownMembers = append(cfg.KnownMembers, hint) - } - sort.Strings(cfg.KnownMembers) - return x.entry -} diff --git a/vendor/github.com/polydawn/refmt/obj/builtins.go b/vendor/github.com/polydawn/refmt/obj/builtins.go deleted file mode 100644 index 75c1327d..00000000 --- a/vendor/github.com/polydawn/refmt/obj/builtins.go +++ /dev/null @@ -1,24 +0,0 @@ -package obj - -import ( - . "reflect" -) - -var ( - rtid_bool = ValueOf(TypeOf(false)).Pointer() - rtid_string = ValueOf(TypeOf("")).Pointer() - rtid_bytes = ValueOf(TypeOf([]byte{})).Pointer() - rtid_int = ValueOf(TypeOf(int(0))).Pointer() - rtid_int8 = ValueOf(TypeOf(int8(0))).Pointer() - rtid_int16 = ValueOf(TypeOf(int16(0))).Pointer() - rtid_int32 = ValueOf(TypeOf(int32(0))).Pointer() - rtid_int64 = ValueOf(TypeOf(int64(0))).Pointer() - rtid_uint = ValueOf(TypeOf(uint(0))).Pointer() - rtid_uint8 = ValueOf(TypeOf(uint8(0))).Pointer() - rtid_uint16 = ValueOf(TypeOf(uint16(0))).Pointer() - rtid_uint32 = ValueOf(TypeOf(uint32(0))).Pointer() - rtid_uint64 = ValueOf(TypeOf(uint64(0))).Pointer() - rtid_uintptr = ValueOf(TypeOf(uintptr(0))).Pointer() - rtid_float32 = ValueOf(TypeOf(float32(0))).Pointer() - rtid_float64 = ValueOf(TypeOf(float64(0))).Pointer() -) diff --git a/vendor/github.com/polydawn/refmt/obj/doc.go b/vendor/github.com/polydawn/refmt/obj/doc.go deleted file mode 100644 index d3cae216..00000000 --- a/vendor/github.com/polydawn/refmt/obj/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -/* - The `obj` package defines Marshaller and Unmarshaller types, - which can be used to convert in-memory values to token streams, - and token streams to unpack in-memory values. -*/ -package obj diff --git a/vendor/github.com/polydawn/refmt/obj/empty.go b/vendor/github.com/polydawn/refmt/obj/empty.go deleted file mode 100644 index b9f1e5b1..00000000 --- a/vendor/github.com/polydawn/refmt/obj/empty.go +++ /dev/null @@ -1,31 +0,0 @@ -package obj - -import "reflect" - -// The missing definition of 'reflect.IsZero' you've always wanted. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflect.Struct: - // Note: we can't rely on a *literal* "is zero" check because - // non-zero pointers may still point to *empty* things. - for i := 0; i < v.NumField(); i++ { - if !isEmptyValue(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/github.com/polydawn/refmt/obj/errors.go b/vendor/github.com/polydawn/refmt/obj/errors.go deleted file mode 100644 index b6c5b0ce..00000000 --- a/vendor/github.com/polydawn/refmt/obj/errors.go +++ /dev/null @@ -1,82 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -// General note: avoid using reflect.Type here. It doesn't do well with `go-cmp`, -// which in turn makes our tests for error paths a lot jankier. - -// ErrInvalidUnmarshalTarget describes an invalid argument passed to Unmarshaller.Bind. -// (Unmarshalling must target a non-nil pointer so that it can address the value.) -type ErrInvalidUnmarshalTarget struct { - Type reflect.Type -} - -func (e ErrInvalidUnmarshalTarget) Error() string { - if e.Type == nil { - return "unmarshal error: invalid target (nil)" - } - if e.Type.Kind() != reflect.Ptr { - return "unmarshal error: invalid target (non-pointer " + e.Type.String() + ")" - } - return "unmarshal error: invalid target (nil " + e.Type.String() + ")" -} - -// ErrUnmarshalTypeCantFit is the error returned when unmarshalling cannot -// coerce the tokens in the stream into the kind of variables the unmarshal is targetting, -// for example if a map open token comes when an int is expected, -// or an int token comes when a string is expected. -type ErrUnmarshalTypeCantFit struct { - Token Token - Value reflect.Value - LenLim int // Set only if Value.Kind == Array and Token is bytes of a mismatch length. -} - -func (e ErrUnmarshalTypeCantFit) Error() string { - switch e.LenLim { - case 0: - return fmt.Sprintf("unmarshal error: cannot assign %s to %s field", e.Token, e.Value.Kind()) - default: - return fmt.Sprintf("unmarshal error: cannot assign %s to fixed length=%d byte array", e.Token, e.Value.Len()) - } -} - -// ErrMalformedTokenStream is the error returned when unmarshalling recieves ae -// completely invalid transition, such as when a map value is expected, but the -// map suddenly closes, or an array close is recieved with no matching array open. -type ErrMalformedTokenStream struct { - Got TokenType // Token in the stream that triggered the error. - Expected string // Freeform string describing valid token types. Often a summary like "array close or start of value", or "map close or key". -} - -func (e ErrMalformedTokenStream) Error() string { - return fmt.Sprintf("malformed stream: invalid appearance of %s token; expected %s", e.Got, e.Expected) -} - -// ErrNoSuchField is the error returned when unmarshalling into a struct and -// the token stream for the map contains a key which is not defined for the struct. -type ErrNoSuchField struct { - Name string // Field name from the token. - Type string // Type name of the struct we're operating on. -} - -func (e ErrNoSuchField) Error() string { - return fmt.Sprintf("unmarshal error: stream contains key %q, but there's no such field in structs of type %s", e.Name, e.Type) -} - -// ErrNoSuchUnionMember is the error returned when unmarshalling into a union -// interface and the token stream contains a key which does not name any of the -// known members of the union. -type ErrNoSuchUnionMember struct { - Name string // Key name from the token. - Type reflect.Type // The interface type we're trying to fill. - KnownMembers []string // Members we expected isntead. -} - -func (e ErrNoSuchUnionMember) Error() string { - return fmt.Sprintf("unmarshal error: cannot unmarshal into union %s: %q is not one of the known members (expected one of %s)", e.Type, e.Name, e.KnownMembers) -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshal.go b/vendor/github.com/polydawn/refmt/obj/marshal.go deleted file mode 100644 index 754fe69f..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshal.go +++ /dev/null @@ -1,110 +0,0 @@ -package obj - -import ( - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -/* - Allocates the machinery for treating an object like a `TokenSource`. - This machinery will walk over structures in memory, - emitting tokens representing values and fields as it visits them. - - Initialization must be finished by calling `Bind` to set the value to visit; - after this, the `Step` function is ready to be pumped. - Subsequent calls to `Bind` do a full reset, leaving `Step` ready to call - again and making all of the machinery reusable without re-allocating. -*/ -func NewMarshaller(atl atlas.Atlas) *Marshaller { - d := &Marshaller{ - marshalSlab: marshalSlab{ - atlas: atl, - rows: make([]marshalSlabRow, 0, 10), - }, - stack: make([]MarshalMachine, 0, 10), - } - return d -} - -func (d *Marshaller) Bind(v interface{}) error { - d.stack = d.stack[0:0] - d.marshalSlab.rows = d.marshalSlab.rows[0:0] - rv := reflect.ValueOf(v) - if !rv.IsValid() { - // if given an untyped nil, swap in a less spikey nil thunk instead. - rv = nil_rv - } - rt := rv.Type() - d.step = d.marshalSlab.requisitionMachine(rt) - return d.step.Reset(&d.marshalSlab, rv, rt) -} - -type Marshaller struct { - marshalSlab marshalSlab - stack []MarshalMachine - step MarshalMachine -} - -type MarshalMachine interface { - Reset(*marshalSlab, reflect.Value, reflect.Type) error - Step(*Marshaller, *marshalSlab, *Token) (done bool, err error) -} - -type marshalMachineStep func(*Marshaller, *marshalSlab, *Token) (done bool, err error) - -func (d *Marshaller) Step(tok *Token) (bool, error) { - tok.Tagged = false - // fmt.Printf("> next step is %#v\n", d.step) - done, err := d.step.Step(d, &d.marshalSlab, tok) - // fmt.Printf(">> yield is %#v\n", TokenToString(*tok)) - // If the step errored: out, entirely. - if err != nil { - return true, err - } - // If the step wasn't done, return same status. - if !done { - return false, nil - } - // If it WAS done, pop next, or if stack empty, we're entirely done. - nSteps := len(d.stack) - 1 - if nSteps == -1 { - return true, nil // that's all folks - } - // fmt.Printf(">> popping up from %#v\n", d.stack) - d.step = d.stack[nSteps] - d.stack = d.stack[0:nSteps] - return false, nil -} - -/* - Starts the process of recursing marshalling over value `rv`. - - Caller provides the machine to use (this is an optimization for maps and slices, - which already know the machine and keep reusing it for all their entries). - This method pushes the first step with `tok` (the upstream tends to have peeked at - it in order to decide what to do, but if recursing, it belongs to the next obj), - then saves this new machine onto the driver's stack: future calls to step - the driver will then continuing stepping the new machine it returns a done status, - at which point we'll finally "return" by popping back to the last machine on the stack - (which is presumably the same one that just called this Recurse method). - - In other words, your MarshalMachine calls this when it wants to deal - with an object, and by the time we call back to your machine again, - that object will be traversed and the stream ready for you to continue. -*/ -func (d *Marshaller) Recurse(tok *Token, rv reflect.Value, rt reflect.Type, nextMach MarshalMachine) (err error) { - // fmt.Printf(">>> pushing into recursion with %#v\n", nextMach) - // Push the current machine onto the stack (we'll resume it when the new one is done), - d.stack = append(d.stack, d.step) - // Initialize the machine for this new target value. - err = nextMach.Reset(&d.marshalSlab, rv, rt) - if err != nil { - return - } - d.step = nextMach - // Immediately make a step (we're still the delegate in charge of someone else's step). - _, err = d.Step(tok) - return -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalBuiltins.go b/vendor/github.com/polydawn/refmt/obj/marshalBuiltins.go deleted file mode 100644 index be81a68e..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalBuiltins.go +++ /dev/null @@ -1,92 +0,0 @@ -package obj - -import ( - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -type ptrDerefDelegateMarshalMachine struct { - MarshalMachine - peelCount int - - isNil bool -} - -func (mach *ptrDerefDelegateMarshalMachine) Reset(slab *marshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.isNil = false - for i := 0; i < mach.peelCount; i++ { - if rv.IsNil() { - mach.isNil = true - return nil - } - rv = rv.Elem() - } - return mach.MarshalMachine.Reset(slab, rv, rv.Type()) // REVIEW: we could have cached the peeled rt at mach conf time; worth it? -} -func (mach *ptrDerefDelegateMarshalMachine) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - if mach.isNil { - tok.Type = TNull - return true, nil - } - return mach.MarshalMachine.Step(driver, slab, tok) -} - -type marshalMachinePrimitive struct { - kind reflect.Kind - - rv reflect.Value -} - -func (mach *marshalMachinePrimitive) Reset(_ *marshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.rv = rv - return nil -} -func (mach *marshalMachinePrimitive) Step(_ *Marshaller, _ *marshalSlab, tok *Token) (done bool, err error) { - switch mach.kind { - case reflect.Bool: - tok.Type = TBool - tok.Bool = mach.rv.Bool() - return true, nil - case reflect.String: - tok.Type = TString - tok.Str = mach.rv.String() - return true, nil - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - tok.Type = TInt - tok.Int = mach.rv.Int() - return true, nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - tok.Type = TUint - tok.Uint = mach.rv.Uint() - return true, nil - case reflect.Float32, reflect.Float64: - tok.Type = TFloat64 - tok.Float64 = mach.rv.Float() - return true, nil - case reflect.Slice: // implicitly bytes; no other slices are "primitive" - if mach.rv.IsNil() { - tok.Type = TNull - return true, nil - } - tok.Type = TBytes - tok.Bytes = mach.rv.Bytes() - return true, nil - case reflect.Array: // implicitly bytes; no other arrays are "primitive" - tok.Type = TBytes - // Unfortunately, there does not seem to be any efficient way to extract the contents of a byte array into a slice via reflect. - // Since the lengths are part of the type, it is almost understandable that the stdlib reflect package has a hard time expressing this; - // however, it drives me somewhat up the wall that they do not provide a case for arrays inside the `Value.Bytes` method, and panic. - // Attempting to `Value.Convert(Type)` from a fixed-length array to a slice of the same type is also rejected. - // Nor does `reflect.AppendSlice` accept an array kind as the second parameter; no, only slices there too. - // So... we iterate. If anyone knows a better way to do this, PRs extremely welcome. - n := mach.rv.Len() - tok.Bytes = make([]byte, n) - for i := 0; i < n; i++ { - tok.Bytes[i] = byte(mach.rv.Index(i).Uint()) - } - return true, nil - default: - panic("unhandled") - } -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalMapWildcard.go b/vendor/github.com/polydawn/refmt/obj/marshalMapWildcard.go deleted file mode 100644 index d8231b39..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalMapWildcard.go +++ /dev/null @@ -1,148 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - "sort" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type marshalMachineMapWildcard struct { - morphism *atlas.MapMorphism // set on initialization - - target_rv reflect.Value - value_rt reflect.Type - keyStringer atlas.MarshalTransformFunc - valueMach MarshalMachine - keys []wildcardMapStringyKey - index int - value bool -} - -func (mach *marshalMachineMapWildcard) Reset(slab *marshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - - // Pick machinery for handling the value types. - mach.value_rt = rt.Elem() - mach.valueMach = slab.requisitionMachine(mach.value_rt) - - // Enumerate all the keys (must do this up front, one way or another), - // flip them into strings, - // and sort them (optional, arguably, but right now you're getting it). - key_rt := rt.Key() - switch key_rt.Kind() { - case reflect.String: - // continue. - // note: stdlib json.marshal supports all the int types here as well, and will - // tostring them. but this is not supported symmetrically; so we simply... don't. - // we could also consider supporting anything that uses a MarshalTransformFunc - // to become a string kind; that's a fair bit of code, perhaps later. - mach.keyStringer = nil - case reflect.Struct: - // composite keys requires some fancy footwork, but we can do it. - // Interestingly enough, we don't need full-on machinery here; because the - // tokenized form is restricted to being a string, the transform func is enough. - rtid := reflect.ValueOf(key_rt).Pointer() - atlEnt, ok := slab.atlas.Get(rtid) - if !ok || atlEnt.MarshalTransformTargetType == nil || atlEnt.MarshalTransformTargetType.Kind() != reflect.String { - return fmt.Errorf("unsupported map key type %q (if you want to use struct keys, your atlas needs a transform to string)", key_rt.Name()) - } - mach.keyStringer = atlEnt.MarshalTransformFunc - default: - return fmt.Errorf("unsupported map key type %q", key_rt.Name()) - } - keys_rv := mach.target_rv.MapKeys() - mach.keys = make([]wildcardMapStringyKey, len(keys_rv)) - for i, v := range keys_rv { - mach.keys[i].rv = v - if mach.keyStringer == nil { - mach.keys[i].s = v.String() - } else { - trans_rv, err := mach.keyStringer(v) - if err != nil { - return fmt.Errorf("unsupported map key type %q: errors in stringifying: %s", key_rt.Name(), err) - } - mach.keys[i].s = trans_rv.String() - } - } - - ksm := atlas.KeySortMode_Default - if mach.morphism != nil { - ksm = mach.morphism.KeySortMode - } - - switch ksm { - case atlas.KeySortMode_Default: - sort.Sort(wildcardMapStringyKey_byString(mach.keys)) - case atlas.KeySortMode_Strings: - sort.Sort(wildcardMapStringyKey_byString(mach.keys)) - case atlas.KeySortMode_RFC7049: - sort.Sort(wildcardMapStringyKey_RFC7049(mach.keys)) - default: - panic(fmt.Errorf("unknown map key sort mode %q", ksm)) - } - - mach.index = -1 - return nil -} - -func (mach *marshalMachineMapWildcard) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - if mach.index < 0 { - if mach.target_rv.IsNil() { - tok.Type = TNull - mach.index++ - return true, nil - } - tok.Type = TMapOpen - tok.Length = mach.target_rv.Len() - mach.index++ - return false, nil - } - if mach.index == len(mach.keys) { - tok.Type = TMapClose - mach.index++ - slab.release() - return true, nil - } - if mach.index > len(mach.keys) { - return true, fmt.Errorf("invalid state: value already consumed") - } - if mach.value { - val_rv := mach.target_rv.MapIndex(mach.keys[mach.index].rv) - mach.value = false - mach.index++ - return false, driver.Recurse(tok, val_rv, mach.value_rt, mach.valueMach) - } - tok.Type = TString - tok.Str = mach.keys[mach.index].s - mach.value = true - return false, nil -} - -// Holder for the reflect.Value and string form of a key. -// We need the reflect.Value for looking up the map value; -// and we need the string for sorting. -type wildcardMapStringyKey struct { - rv reflect.Value - s string -} - -type wildcardMapStringyKey_byString []wildcardMapStringyKey - -func (x wildcardMapStringyKey_byString) Len() int { return len(x) } -func (x wildcardMapStringyKey_byString) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x wildcardMapStringyKey_byString) Less(i, j int) bool { return x[i].s < x[j].s } - -type wildcardMapStringyKey_RFC7049 []wildcardMapStringyKey - -func (x wildcardMapStringyKey_RFC7049) Len() int { return len(x) } -func (x wildcardMapStringyKey_RFC7049) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x wildcardMapStringyKey_RFC7049) Less(i, j int) bool { - li, lj := len(x[i].s), len(x[j].s) - if li == lj { - return x[i].s < x[j].s - } - return li < lj -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalSlab.go b/vendor/github.com/polydawn/refmt/obj/marshalSlab.go deleted file mode 100644 index 88c8e6f0..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalSlab.go +++ /dev/null @@ -1,219 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -/* - A lovely mechanism to stash marshalMachine objects pre-allocated and avoid mallocs. - Works together with the Atlas: the Atlas says what kind of machinery is needed; - the marshalSlab "allocates" it and returns it upon your request. -*/ -type marshalSlab struct { - atlas atlas.Atlas - rows []marshalSlabRow -} - -type marshalSlabRow struct { - ptrDerefDelegateMarshalMachine - marshalMachinePrimitive - marshalMachineWildcard - marshalMachineMapWildcard - marshalMachineSliceWildcard - marshalMachineStructAtlas - marshalMachineTransform - marshalMachineUnionKeyed - - errThunkMarshalMachine -} - -// A thunk value that can be used to trigger `isNil` paths. -// (Substituting an 'invalid' kind reflect.Value with this is an easy way -// to emit a null without needing any additional special cases or error handling.) -var nil_rv reflect.Value = reflect.Zero(reflect.PtrTo(reflect.TypeOf(0))) - -/* - Return a reference to a machine from the slab. - *You must release() when done.* - - Errors -- including "no info in Atlas for this type" -- are expressed by - returning a machine that is a constantly-erroring thunk. -*/ -func (slab *marshalSlab) requisitionMachine(rt reflect.Type) MarshalMachine { - // Acquire a row. - off := len(slab.rows) - slab.grow() - row := &slab.rows[off] - - // Yield machinery. - return _yieldMarshalMachinePtr(row, slab.atlas, rt) -} - -/* - Like requisitionMachine, but does *not* grow the slab; assumes the current - tip row is usable. - Thus, you must grow() before using, and release correspondingly. -*/ -func (slab *marshalSlab) yieldMachine(rt reflect.Type) MarshalMachine { - // Grab the last row. - row := &slab.rows[len(slab.rows)-1] - - // Yield machinery. - return _yieldMarshalMachinePtr(row, slab.atlas, rt) -} - -func _yieldMarshalMachinePtr(row *marshalSlabRow, atl atlas.Atlas, rt reflect.Type) MarshalMachine { - // Indirect pointers as necessary. - // Keep count of how many times we do this; we'll use this again at the end. - peelCount := 0 - for rt.Kind() == reflect.Ptr { - rt = rt.Elem() - peelCount++ - } - - // Figure out what machinery to use at heart. - mach := _yieldBareMarshalMachinePtr(row, atl, rt) - // If nil answer, we had no match: yield an error thunk. - if mach == nil { - mach := &row.errThunkMarshalMachine - mach.err = fmt.Errorf("no machine found") - return mach - } - - // If no indirection steps, return; - // otherwise wrap it in the ptrDeref machine and return that. - if peelCount == 0 { - return mach - } - row.ptrDerefDelegateMarshalMachine.MarshalMachine = mach - row.ptrDerefDelegateMarshalMachine.peelCount = peelCount - row.ptrDerefDelegateMarshalMachine.isNil = false - return &row.ptrDerefDelegateMarshalMachine -} - -// Like _yieldMarshalMachinePtr, but assumes the ptr unwrapping has already been done. -func _yieldBareMarshalMachinePtr(row *marshalSlabRow, atl atlas.Atlas, rt reflect.Type) MarshalMachine { - rtid := reflect.ValueOf(rt).Pointer() - - // Check primitives first; cheapest (and unoverridable). - switch rtid { - case rtid_bool, - rtid_string, - rtid_int, rtid_int8, rtid_int16, rtid_int32, rtid_int64, - rtid_uint, rtid_uint8, rtid_uint16, rtid_uint32, rtid_uint64, rtid_uintptr, - rtid_float32, rtid_float64, - rtid_bytes: - row.marshalMachinePrimitive.kind = rt.Kind() - return &row.marshalMachinePrimitive - } - - // Consult atlas second. - if entry, ok := atl.Get(rtid); ok { - return _yieldMarshalMachinePtrForAtlasEntry(row, entry, atl) - } - - // If no specific behavior found, use default behavior based on kind. - switch rt.Kind() { - case reflect.Bool, - reflect.String, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Float32, reflect.Float64: - row.marshalMachinePrimitive.kind = rt.Kind() - return &row.marshalMachinePrimitive - case reflect.Slice: - // un-typedef'd byte slices were handled already, but a typedef'd one still gets gets treated like a special kind: - if rt.Elem().Kind() == reflect.Uint8 { - row.marshalMachinePrimitive.kind = rt.Kind() - return &row.marshalMachinePrimitive - } - return &row.marshalMachineSliceWildcard - case reflect.Array: - // arrays of bytes have a similar special case to slices for when they're typedefed. - if rt.Elem().Kind() == reflect.Uint8 { - row.marshalMachinePrimitive.kind = rt.Kind() - return &row.marshalMachinePrimitive - } - return &row.marshalMachineSliceWildcard.marshalMachineArrayWildcard - case reflect.Map: - row.marshalMachineMapWildcard.morphism = atl.GetDefaultMapMorphism() - return &row.marshalMachineMapWildcard - case reflect.Struct: - // TODO here we could also invoke automatic atlas autogen, if configured to be permitted - mach := &row.errThunkMarshalMachine - mach.err = fmt.Errorf("missing an atlas entry describing how to marshal type %v (and auto-atlasing for structs is not enabled)", rt) - return mach - case reflect.Interface: - return &row.marshalMachineWildcard - case reflect.Func: - panic(fmt.Errorf("functions cannot be marshalled!")) - case reflect.Ptr: - panic(fmt.Errorf("unreachable: ptrs must already be resolved")) - default: - panic(fmt.Errorf("excursion %s", rt.Kind())) - } -} - -// given that we already have an atlasEntry in mind, yield a configured machine for it. -// it seems odd that this might still require a whole atlas, but tis so; -// some things (e.g. transform funcs) need to get additional machinery for delegation. -func _yieldMarshalMachinePtrForAtlasEntry(row *marshalSlabRow, entry *atlas.AtlasEntry, atl atlas.Atlas) MarshalMachine { - // Switch across which of the union of configurations is applicable. - switch { - case entry.MarshalTransformFunc != nil: - // Return a machine that calls the func(s), then later a real machine. - // The entry.MarshalTransformTargetType is used to do a recursive lookup. - // We can't just call the func here because we're still working off typeinfo - // and don't have a real value to transform until later. - row.marshalMachineTransform.trFunc = entry.MarshalTransformFunc - // Pick delegate without growing stack. (This currently means recursive transform won't fly.) - row.marshalMachineTransform.delegate = _yieldMarshalMachinePtr(row, atl, entry.MarshalTransformTargetType) - // If tags are in play: have the transformer machine glue that on. - - row.marshalMachineTransform.tagged = entry.Tagged - row.marshalMachineTransform.tag = entry.Tag - return &row.marshalMachineTransform - case entry.StructMap != nil: - row.marshalMachineStructAtlas.cfg = entry - return &row.marshalMachineStructAtlas - case entry.UnionKeyedMorphism != nil: - row.marshalMachineUnionKeyed.cfg = entry - return &row.marshalMachineUnionKeyed - case entry.MapMorphism != nil: - row.marshalMachineMapWildcard.morphism = entry.MapMorphism - return &row.marshalMachineMapWildcard - default: - panic("invalid atlas entry") - } -} - -// Returns the top row of the slab. Useful for machines that need to delegate -// to another type that's definitely not their own. Be careful with that -// caveat; if the delegation can be to another system that uses in-row delegation, -// this is not trivially safe to compose and you should grow the slab instead. -func (s *marshalSlab) tip() *marshalSlabRow { - return &s.rows[len(s.rows)-1] -} - -func (s *marshalSlab) grow() { - s.rows = append(s.rows, marshalSlabRow{}) -} - -func (s *marshalSlab) release() { - s.rows = s.rows[0 : len(s.rows)-1] -} - -type errThunkMarshalMachine struct { - err error -} - -func (m *errThunkMarshalMachine) Reset(_ *marshalSlab, _ reflect.Value, _ reflect.Type) error { - return m.err -} -func (m *errThunkMarshalMachine) Step(d *Marshaller, s *marshalSlab, tok *Token) (done bool, err error) { - return true, m.err -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalSliceWildcard.go b/vendor/github.com/polydawn/refmt/obj/marshalSliceWildcard.go deleted file mode 100644 index 3cf527d5..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalSliceWildcard.go +++ /dev/null @@ -1,63 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -// Encodes a slice. -// This machine just wraps the array machine, checking to make sure the value isn't nil. -type marshalMachineSliceWildcard struct { - marshalMachineArrayWildcard -} - -func (mach *marshalMachineSliceWildcard) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - if mach.index < 0 { - if mach.target_rv.IsNil() { - tok.Type = TNull - return true, nil - } - } - return mach.marshalMachineArrayWildcard.Step(driver, slab, tok) -} - -type marshalMachineArrayWildcard struct { - target_rv reflect.Value - value_rt reflect.Type - valueMach MarshalMachine - index int - length int -} - -func (mach *marshalMachineArrayWildcard) Reset(slab *marshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.value_rt = rt.Elem() - mach.valueMach = slab.requisitionMachine(mach.value_rt) - mach.index = -1 - mach.length = mach.target_rv.Len() - return nil -} - -func (mach *marshalMachineArrayWildcard) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - if mach.index < 0 { - tok.Type = TArrOpen - tok.Length = mach.target_rv.Len() - mach.index++ - return false, nil - } - if mach.index == mach.length { - tok.Type = TArrClose - mach.index++ - slab.release() - return true, nil - } - if mach.index > mach.length { - return true, fmt.Errorf("invalid state: value already consumed") - } - rv := mach.target_rv.Index(mach.index) - driver.Recurse(tok, rv, mach.value_rt, mach.valueMach) - mach.index++ - return false, nil -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalStruct.go b/vendor/github.com/polydawn/refmt/obj/marshalStruct.go deleted file mode 100644 index 7ea4fd24..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalStruct.go +++ /dev/null @@ -1,108 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type marshalMachineStructAtlas struct { - cfg *atlas.AtlasEntry // set on initialization - - target_rv reflect.Value - index int // Progress marker - value_rv reflect.Value // Next value (or nil if next step is key). -} - -func (mach *marshalMachineStructAtlas) Reset(slab *marshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.target_rv = rv - mach.index = -1 - mach.value_rv = reflect.Value{} - slab.grow() // we'll reuse the same row for all fields - return nil -} - -func (mach *marshalMachineStructAtlas) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - //fmt.Printf("--step on %#v: i=%d/%d v=%v\n", mach.target_rv, mach.index, len(mach.cfg.Fields), mach.value) - - // Check boundaries and do the special steps or either start or end. - nEntries := len(mach.cfg.StructMap.Fields) - if mach.index < 0 { - tok.Type = TMapOpen - tok.Length = countEmittableStructFields(mach.cfg, mach.target_rv) - tok.Tagged = mach.cfg.Tagged - tok.Tag = mach.cfg.Tag - mach.index++ - return false, nil - } - if mach.index == nEntries { - tok.Type = TMapClose - mach.index++ - slab.release() - return true, nil - } - if mach.index > nEntries { - return true, fmt.Errorf("invalid state: entire struct (%d fields) already consumed", nEntries) - } - - // If value loaded from last step, recurse into handling that. - fieldEntry := mach.cfg.StructMap.Fields[mach.index] - if mach.value_rv != (reflect.Value{}) { - child_rv := mach.value_rv - mach.index++ - mach.value_rv = reflect.Value{} - return false, driver.Recurse( - tok, - child_rv, - fieldEntry.Type, - slab.yieldMachine(fieldEntry.Type), - ) - } - - // If value was nil, that indicates we're supposed to pick the value and yield a key. - // We have to look ahead to the value because if it's zero and tagged as - // omitEmpty, then we have to skip emitting the key as well. - for fieldEntry.Ignore { - mach.index++ - if mach.index == nEntries { - tok.Type = TMapClose - mach.index++ - slab.release() - return true, nil - } - fieldEntry = mach.cfg.StructMap.Fields[mach.index] - } - mach.value_rv = fieldEntry.ReflectRoute.TraverseToValue(mach.target_rv) - if fieldEntry.OmitEmpty && isEmptyValue(mach.value_rv) { - mach.value_rv = reflect.Value{} - mach.index++ - return mach.Step(driver, slab, tok) - } - tok.Type = TString - tok.Str = fieldEntry.SerialName - return false, nil -} - -// Count how many fields in a struct should actually be marshalled. -// Fields that are tagged omitEmpty and are isEmptyValue are not counted, and -// StructMapEntry used to flag ignored fields unmarshalling never count, so -// this number may be less than the number of fields in the AtlasEntry.StructMap. -func countEmittableStructFields(cfg *atlas.AtlasEntry, target_rv reflect.Value) int { - total := 0 - for _, fieldEntry := range cfg.StructMap.Fields { - if fieldEntry.Ignore { - continue - } - if !fieldEntry.OmitEmpty { - total++ - continue - } - if !isEmptyValue(fieldEntry.ReflectRoute.TraverseToValue(target_rv)) { - total++ - continue - } - } - return total -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalTransform.go b/vendor/github.com/polydawn/refmt/obj/marshalTransform.go deleted file mode 100644 index 7e1c1514..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalTransform.go +++ /dev/null @@ -1,35 +0,0 @@ -package obj - -import ( - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type marshalMachineTransform struct { - trFunc atlas.MarshalTransformFunc - delegate MarshalMachine - tagged bool // Used to apply tag to first step (without forcing delegate to know). - tag int - first bool // This resets; 'tagged' persists (because it's type info). -} - -func (mach *marshalMachineTransform) Reset(slab *marshalSlab, rv reflect.Value, _ reflect.Type) error { - tr_rv, err := mach.trFunc(rv) - if err != nil { - return err - } - mach.first = true - return mach.delegate.Reset(slab, tr_rv, tr_rv.Type()) -} - -func (mach *marshalMachineTransform) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - done, err = mach.delegate.Step(driver, slab, tok) - if mach.first && mach.tagged { - tok.Tagged = true - tok.Tag = mach.tag - mach.first = false - } - return -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalUnionKeyed.go b/vendor/github.com/polydawn/refmt/obj/marshalUnionKeyed.go deleted file mode 100644 index efd10da0..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalUnionKeyed.go +++ /dev/null @@ -1,71 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type marshalMachineUnionKeyed struct { - cfg *atlas.AtlasEntry // set on initialization - - target_rv reflect.Value // the element (interface already unwrapped). - elementName string // the serial name for this union member type. - - step marshalMachineStep - delegate MarshalMachine // actual machine, picked based on content of the interface. -} - -func (mach *marshalMachineUnionKeyed) Reset(slab *marshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv.Elem() - if mach.target_rv.Kind() == reflect.Invalid { - return fmt.Errorf("nil is not a valid member for the union for interface %q", mach.cfg.Type.Name()) - } - element_rt := mach.target_rv.Type() - mach.elementName = mach.cfg.UnionKeyedMorphism.Mappings[reflect.ValueOf(element_rt).Pointer()] - if mach.elementName == "" { - return fmt.Errorf("type %q is not one of the known members of the union for interface %q", element_rt.Name(), mach.cfg.Type.Name()) - } - delegateAtlasEnt := mach.cfg.UnionKeyedMorphism.Elements[mach.elementName] - mach.delegate = _yieldMarshalMachinePtrForAtlasEntry(slab.tip(), delegateAtlasEnt, slab.atlas) - if err := mach.delegate.Reset(slab, mach.target_rv, delegateAtlasEnt.Type); err != nil { - return err - } - mach.step = mach.step_emitMapOpen - return nil -} - -func (mach *marshalMachineUnionKeyed) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - return mach.step(driver, slab, tok) -} - -func (mach *marshalMachineUnionKeyed) step_emitMapOpen(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - tok.Type = TMapOpen - tok.Length = 1 - mach.step = mach.step_emitKey - return false, nil -} - -func (mach *marshalMachineUnionKeyed) step_emitKey(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - tok.Type = TString - tok.Str = mach.elementName - mach.step = mach.step_delegate - return false, nil -} - -func (mach *marshalMachineUnionKeyed) step_delegate(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - done, err = mach.delegate.Step(driver, slab, tok) - if done && err == nil { - mach.step = mach.step_emitMapClose - return false, nil - } - return -} - -func (mach *marshalMachineUnionKeyed) step_emitMapClose(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - tok.Type = TMapClose - mach.step = nil - return true, nil -} diff --git a/vendor/github.com/polydawn/refmt/obj/marshalWildcard.go b/vendor/github.com/polydawn/refmt/obj/marshalWildcard.go deleted file mode 100644 index 67153e20..00000000 --- a/vendor/github.com/polydawn/refmt/obj/marshalWildcard.go +++ /dev/null @@ -1,37 +0,0 @@ -package obj - -import ( - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -/* - A MarshalMachine that unwraps an `interface{}` value, - selects the correct machinery for handling its content, - and delegates immediately to that machine. -*/ -type marshalMachineWildcard struct { - delegate MarshalMachine -} - -func (mach *marshalMachineWildcard) Reset(slab *marshalSlab, rv reflect.Value, rt reflect.Type) error { - // If the interface contains nil, go no further; we'll simply yield that single token. - if rv.IsNil() { - mach.delegate = nil - return nil - } - // Pick, reset, and retain a delegate machine for the interior type. - unwrap_rv := rv.Elem() // unwrap iface - unwrap_rt := unwrap_rv.Type() - mach.delegate = slab.requisitionMachine(unwrap_rt) - return mach.delegate.Reset(slab, unwrap_rv, unwrap_rt) -} - -func (mach marshalMachineWildcard) Step(driver *Marshaller, slab *marshalSlab, tok *Token) (done bool, err error) { - if mach.delegate == nil { - tok.Type = TNull - return true, nil - } - return mach.delegate.Step(driver, slab, tok) -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshal.go b/vendor/github.com/polydawn/refmt/obj/unmarshal.go deleted file mode 100644 index 6e500719..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshal.go +++ /dev/null @@ -1,108 +0,0 @@ -package obj - -import ( - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -/* - Allocates the machinery for treating an in-memory object like a `TokenSink`. - This machinery will walk over values, using received tokens to fill in - fields as it visits them. - - Initialization must be finished by calling `Bind` to set the value to visit; - after this, the `Step` function is ready to be pumped. - Subsequent calls to `Bind` do a full reset, leaving `Step` ready to call - again and making all of the machinery reusable without re-allocating. -*/ -func NewUnmarshaller(atl atlas.Atlas) *Unmarshaller { - d := &Unmarshaller{ - unmarshalSlab: unmarshalSlab{ - atlas: atl, - rows: make([]unmarshalSlabRow, 0, 10), - }, - stack: make([]UnmarshalMachine, 0, 10), - } - return d -} - -func (d *Unmarshaller) Bind(v interface{}) error { - d.stack = d.stack[0:0] - d.unmarshalSlab.rows = d.unmarshalSlab.rows[0:0] - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - err := ErrInvalidUnmarshalTarget{reflect.TypeOf(v)} - d.step = &errThunkUnmarshalMachine{err} - return err - } - rv = rv.Elem() // Let's just always be addressible, shall we? - rt := rv.Type() - d.step = d.unmarshalSlab.requisitionMachine(rt) - return d.step.Reset(&d.unmarshalSlab, rv, rt) -} - -type Unmarshaller struct { - unmarshalSlab unmarshalSlab - stack []UnmarshalMachine - step UnmarshalMachine -} - -type UnmarshalMachine interface { - Reset(*unmarshalSlab, reflect.Value, reflect.Type) error - Step(*Unmarshaller, *unmarshalSlab, *Token) (done bool, err error) -} - -type unmarshalMachineStep func(*Unmarshaller, *unmarshalSlab, *Token) (done bool, err error) - -func (d *Unmarshaller) Step(tok *Token) (bool, error) { - done, err := d.step.Step(d, &d.unmarshalSlab, tok) - // If the step errored: out, entirely. - if err != nil { - return true, err - } - // If the step wasn't done, return same status. - if !done { - return false, nil - } - // If it WAS done, pop next, or if stack empty, we're entirely done. - nSteps := len(d.stack) - 1 - if nSteps == -1 { - return true, nil // that's all folks - } - d.step = d.stack[nSteps] - d.stack = d.stack[0:nSteps] - return false, nil -} - -/* - Starts the process of recursing unmarshalling over value `rv`. - - Caller provides the machine to use (this is an optimization for maps and slices, - which already know the machine and keep reusing it for all their entries). - This method pushes the first step with `tok` (the upstream tends to have peeked at - it in order to decide what to do, but if recursing, it belongs to the next obj), - then saves this new machine onto the driver's stack: future calls to step - the driver will then continuing stepping the new machine it returns a done status, - at which point we'll finally "return" by popping back to the last machine on the stack - (which is presumably the same one that just called this Recurse method). - - In other words, your UnmarshalMachine calls this when it wants to deal - with an object, and by the time we call back to your machine again, - that object will be traversed and the stream ready for you to continue. -*/ -func (d *Unmarshaller) Recurse(tok *Token, rv reflect.Value, rt reflect.Type, nextMach UnmarshalMachine) (err error) { - // fmt.Printf(">>> pushing into recursion with %#v\n", nextMach) - // Push the current machine onto the stack (we'll resume it when the new one is done), - d.stack = append(d.stack, d.step) - // Initialize the machine for this new target value. - err = nextMach.Reset(&d.unmarshalSlab, rv, rt) - if err != nil { - return - } - d.step = nextMach - // Immediately make a step (we're still the delegate in charge of someone else's step). - _, err = d.Step(tok) - return -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalArrayWildcard.go b/vendor/github.com/polydawn/refmt/obj/unmarshalArrayWildcard.go deleted file mode 100644 index 5904a4c0..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalArrayWildcard.go +++ /dev/null @@ -1,80 +0,0 @@ -package obj - -import ( - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineArrayWildcard struct { - target_rv reflect.Value - value_rt reflect.Type - valueMach UnmarshalMachine - step unmarshalMachineStep - index int - maxLen int -} - -func (mach *unmarshalMachineArrayWildcard) Reset(slab *unmarshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.value_rt = rt.Elem() - mach.valueMach = slab.requisitionMachine(mach.value_rt) - mach.step = mach.step_Initial - mach.index = 0 - mach.maxLen = rt.Len() - return nil -} - -func (mach *unmarshalMachineArrayWildcard) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - return mach.step(driver, slab, tok) -} - -func (mach *unmarshalMachineArrayWildcard) step_Initial(_ *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // If it's a special state, start an object. - // (Or, blow up if its a special state that's silly). - switch tok.Type { - case TMapOpen: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TArrOpen: - // Great. Consumed. - mach.step = mach.step_AcceptValue - // Initialize the array. Its length is encoded in its type. - mach.target_rv.Set(reflect.Zero(mach.target_rv.Type())) - return false, nil - case TMapClose: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TArrClose: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TNull: - mach.target_rv.Set(reflect.Zero(mach.target_rv.Type())) - return true, nil - default: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - } -} - -func (mach *unmarshalMachineArrayWildcard) step_AcceptValue(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // Either form of open token are valid, but - // - an arrClose is ours - // - and a mapClose is clearly invalid. - switch tok.Type { - case TMapClose: - // no special checks for ends of wildcard slice; no such thing as incomplete. - return true, ErrMalformedTokenStream{tok.Type, "start of value or end of array"} - case TArrClose: - // release the slab row we requisitioned for our value machine. - slab.release() - return true, nil - } - - // Return an error if we're about to exceed our length limit. - if mach.index >= mach.maxLen { - return true, ErrMalformedTokenStream{tok.Type, "end of array (out of space)"} - } - - // Recurse on a handle to the next index. - rv := mach.target_rv.Index(mach.index) - mach.index++ - return false, driver.Recurse(tok, rv, mach.value_rt, mach.valueMach) - // Step simply remains `step_AcceptValue` -- arrays don't have much state machine. -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalBuiltins.go b/vendor/github.com/polydawn/refmt/obj/unmarshalBuiltins.go deleted file mode 100644 index 8dc96cbb..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalBuiltins.go +++ /dev/null @@ -1,176 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -type ptrDerefDelegateUnmarshalMachine struct { - UnmarshalMachine // a delegate machine, already set for us by the slab - peelCount int // how deep the pointers go, already discoverd by the slab - - ptr_rv reflect.Value // the top ptr, which we will use if setting to nil, or if we have to recursively make ptrs for `**X` types. - firstStep bool -} - -func (mach *ptrDerefDelegateUnmarshalMachine) Reset(slab *unmarshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.ptr_rv = rv - mach.firstStep = true - // we defer reseting the delegate machine until later, in case we get a nil, which can save a lot of time. - return nil -} -func (mach *ptrDerefDelegateUnmarshalMachine) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // If first step: we have to do initializations. - if mach.firstStep { - mach.firstStep = false - // If nil: easy road. Nil the ptr. - if tok.Type == TNull { - mach.ptr_rv.Set(reflect.Zero(mach.ptr_rv.Type())) - return true, nil - } - // Walk the pointers: if some already exist, we accept them unmodified; - // if any are nil, make a new one, and recursively. - rv := mach.ptr_rv - for i := 0; i < mach.peelCount; i++ { - if rv.IsNil() { - rv.Set(reflect.New(rv.Type().Elem())) - rv = rv.Elem() - } else { - rv = rv.Elem() - } - } - if err := mach.UnmarshalMachine.Reset(slab, rv, rv.Type()); err != nil { - return true, err - } - } - // The remainder of the time: it's just delegation. - return mach.UnmarshalMachine.Step(driver, slab, tok) -} - -type unmarshalMachinePrimitive struct { - kind reflect.Kind - - rv reflect.Value -} - -func (mach *unmarshalMachinePrimitive) Reset(_ *unmarshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.rv = rv - return nil -} -func (mach *unmarshalMachinePrimitive) Step(_ *Unmarshaller, _ *unmarshalSlab, tok *Token) (done bool, err error) { - switch mach.kind { - case reflect.Bool: - switch tok.Type { - case TBool: - mach.rv.SetBool(tok.Bool) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.String: - switch tok.Type { - case TString: - mach.rv.SetString(tok.Str) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - switch tok.Type { - case TInt: - mach.rv.SetInt(tok.Int) - return true, nil - case TUint: - mach.rv.SetInt(int64(tok.Uint)) // todo: overflow check - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - switch tok.Type { - case TInt: - if tok.Int >= 0 { - mach.rv.SetUint(uint64(tok.Int)) - return true, nil - } - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - case TUint: - mach.rv.SetUint(tok.Uint) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Float32, reflect.Float64: - switch tok.Type { - case TFloat64: - mach.rv.SetFloat(tok.Float64) - return true, nil - case TInt: - mach.rv.SetFloat(float64(tok.Int)) - return true, nil - case TUint: - mach.rv.SetFloat(float64(tok.Uint)) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Slice: // implicitly bytes; no other slices are "primitive" - switch tok.Type { - case TBytes: - mach.rv.SetBytes(tok.Bytes) - return true, nil - case TNull: - mach.rv.SetBytes(nil) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Array: // implicitly bytes; no other arrays are "primitive" - switch tok.Type { - case TBytes: - // Unfortunately, there does not seem to be any efficient way to bulk set the contents of a byte array via reflect. - // There are similar complaints regarding slices on the marshalling side: apparently, we have no choice but to loop. - n := mach.rv.Len() - // We match aggressively on length. If the provided input is too short, we reject that too: we assume you asked for a fixed-length array for a reason. - if len(tok.Bytes) != n { - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, n} - } - for i := 0; i < n; i++ { - mach.rv.Index(i).SetUint(uint64(tok.Bytes[i])) - } - return true, nil - case TNull: - if mach.rv.Len() != 0 { - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - mach.rv.SetBytes(nil) - return true, nil - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.rv, 0} - } - case reflect.Interface: - switch tok.Type { - case TString: - mach.rv.Set(reflect.ValueOf(tok.Str)) - case TBytes: - mach.rv.Set(reflect.ValueOf(tok.Bytes)) - case TBool: - mach.rv.Set(reflect.ValueOf(tok.Bool)) - case TInt: - mach.rv.Set(reflect.ValueOf(tok.Int)) - case TUint: - mach.rv.Set(reflect.ValueOf(tok.Uint)) - case TFloat64: - mach.rv.Set(reflect.ValueOf(tok.Float64)) - case TNull: - mach.rv.Set(reflect.ValueOf(nil)) - default: // any of the other token types should not have been routed here to begin with. - panic(fmt.Errorf("unhandled: %v", mach.kind)) - } - return true, nil - default: - panic(fmt.Errorf("unhandled: %v", mach.kind)) - } -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalMapWildcard.go b/vendor/github.com/polydawn/refmt/obj/unmarshalMapWildcard.go deleted file mode 100644 index 7f068af5..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalMapWildcard.go +++ /dev/null @@ -1,129 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineMapStringWildcard struct { - target_rv reflect.Value // Handle to the map. Can set to zero, or set k=v pairs into, etc. - value_rt reflect.Type // Type info for map values (cached for convenience in recurse calls). - valueMach UnmarshalMachine // Machine for map values. - key_rv reflect.Value // Addressable handle to a slot for keys to unmarshal into. - keyDestringer atlas.UnmarshalTransformFunc // Transform str->foo, to be used if keys are not plain strings. - tmp_rv reflect.Value // Addressable handle to a slot for values to unmarshal into. - step unmarshalMachineStep - haveValue bool // Piece of attendant state to help know we've been through at least one k=v pair so we can post-v store it. -} - -func (mach *unmarshalMachineMapStringWildcard) Reset(slab *unmarshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.value_rt = rt.Elem() - mach.valueMach = slab.requisitionMachine(mach.value_rt) - key_rt := rt.Key() - mach.key_rv = reflect.New(key_rt).Elem() - if mach.key_rv.Kind() != reflect.String { - rtid := reflect.ValueOf(key_rt).Pointer() - atlEnt, ok := slab.atlas.Get(rtid) - if !ok || atlEnt.UnmarshalTransformTargetType == nil || atlEnt.UnmarshalTransformTargetType.Kind() != reflect.String { - return fmt.Errorf("unsupported map key type %q (if you want to use struct keys, your atlas needs a transform from string)", key_rt.Name()) - } - mach.keyDestringer = atlEnt.UnmarshalTransformFunc - } - mach.tmp_rv = reflect.New(mach.value_rt).Elem() - mach.step = mach.step_Initial - mach.haveValue = false - return nil -} - -func (mach *unmarshalMachineMapStringWildcard) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - return mach.step(driver, slab, tok) -} - -func (mach *unmarshalMachineMapStringWildcard) step_Initial(_ *Unmarshaller, _ *unmarshalSlab, tok *Token) (done bool, err error) { - // If it's a special state, start an object. - // (Or, blow up if its a special state that's silly). - switch tok.Type { - case TNull: - mach.target_rv.Set(reflect.Zero(mach.target_rv.Type())) - return true, nil - case TMapOpen: - // Great. Consumed. - mach.step = mach.step_AcceptKey - // Initialize the map if it's nil. - if mach.target_rv.IsNil() { - mach.target_rv.Set(reflect.MakeMap(mach.target_rv.Type())) - } - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of map") - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of map") - case TArrOpen: - fallthrough - default: - return true, ErrUnmarshalTypeCantFit{*tok, mach.target_rv, 0} - } -} - -func (mach *unmarshalMachineMapStringWildcard) step_AcceptKey(_ *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // First, save any refs from the last value. - // (This is fiddly: the delay comes mostly from the handling of slices, which may end up re-allocating - // themselves during their decoding.) - if mach.haveValue { - mach.target_rv.SetMapIndex(mach.key_rv, mach.tmp_rv) - } - // Now switch on tokens. - switch tok.Type { - case TMapOpen: - return true, fmt.Errorf("unexpected mapOpen; expected map key") - case TArrOpen: - return true, fmt.Errorf("unexpected arrOpen; expected map key") - case TMapClose: - // no special checks for ends of wildcard map; no such thing as incomplete. - // release the slab row we requisitioned for our value machine. - slab.release() - return true, nil - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected map key") - case TString: - if mach.keyDestringer != nil { - key_rv, err := mach.keyDestringer(reflect.ValueOf(tok.Str)) - if err != nil { - return true, fmt.Errorf("unsupported map key type %q: errors in stringifying: %s", mach.key_rv.Type().Name(), err) - } - mach.key_rv.Set(key_rv) - } else { - mach.key_rv.SetString(tok.Str) - } - if err = mach.mustAcceptKey(mach.key_rv); err != nil { - return true, err - } - mach.step = mach.step_AcceptValue - return false, nil - default: - return true, fmt.Errorf("unexpected token %s; expected key string or end of map", tok) - } -} - -func (mach *unmarshalMachineMapStringWildcard) mustAcceptKey(key_rv reflect.Value) error { - if exists := mach.target_rv.MapIndex(key_rv).IsValid(); exists { - return fmt.Errorf("repeated key %q", key_rv) - } - return nil -} - -func (mach *unmarshalMachineMapStringWildcard) step_AcceptValue(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - mach.step = mach.step_AcceptKey - mach.tmp_rv.Set(reflect.Zero(mach.value_rt)) - mach.haveValue = true - return false, driver.Recurse( - tok, - mach.tmp_rv, - mach.value_rt, - mach.valueMach, - ) -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalSlab.go b/vendor/github.com/polydawn/refmt/obj/unmarshalSlab.go deleted file mode 100644 index ac09c16c..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalSlab.go +++ /dev/null @@ -1,187 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -/* - A lovely mechanism to stash unmarshalMachine objects pre-allocated and avoid mallocs. - Works together with the Atlas: the Atlas says what kind of machinery is needed; - the unmarshalSlab "allocates" it and returns it upon your request. -*/ -type unmarshalSlab struct { - atlas atlas.Atlas - rows []unmarshalSlabRow -} - -type unmarshalSlabRow struct { - ptrDerefDelegateUnmarshalMachine - unmarshalMachinePrimitive - unmarshalMachineWildcard - unmarshalMachineMapStringWildcard - unmarshalMachineSliceWildcard - unmarshalMachineArrayWildcard - unmarshalMachineStructAtlas - unmarshalMachineTransform - unmarshalMachineUnionKeyed - - errThunkUnmarshalMachine -} - -/* - Return a reference to a machine from the slab. - *You must release() when done.* - - Errors -- including "no info in Atlas for this type" -- are expressed by - returning a machine that is a constantly-erroring thunk. -*/ -func (slab *unmarshalSlab) requisitionMachine(rt reflect.Type) UnmarshalMachine { - // Acquire a row. - off := len(slab.rows) - slab.grow() - row := &slab.rows[off] - - // Indirect pointers as necessary. - // Keep count of how many times we do this; we'll use this again at the end. - peelCount := 0 - for rt.Kind() == reflect.Ptr { - rt = rt.Elem() - peelCount++ - } - - // Figure out what machinery to use at heart. - mach := _yieldUnmarshalMachinePtr(row, slab.atlas, rt) - // If nil answer, we had no match: yield an error thunk. - if mach == nil { - mach := &row.errThunkUnmarshalMachine - mach.err = fmt.Errorf("no machine found") - return mach - } - - // If no indirection steps, return; - // otherwise wrap it in the ptrDeref machine and return that. - if peelCount == 0 { - return mach - } - row.ptrDerefDelegateUnmarshalMachine.UnmarshalMachine = mach - row.ptrDerefDelegateUnmarshalMachine.peelCount = peelCount - return &row.ptrDerefDelegateUnmarshalMachine -} - -func _yieldUnmarshalMachinePtr(row *unmarshalSlabRow, atl atlas.Atlas, rt reflect.Type) UnmarshalMachine { - rtid := reflect.ValueOf(rt).Pointer() - - // Check primitives first; cheapest (and unoverridable). - switch rtid { - case rtid_bool, - rtid_string, - rtid_int, rtid_int8, rtid_int16, rtid_int32, rtid_int64, - rtid_uint, rtid_uint8, rtid_uint16, rtid_uint32, rtid_uint64, rtid_uintptr, - rtid_float32, rtid_float64, - rtid_bytes: - row.unmarshalMachinePrimitive.kind = rt.Kind() - return &row.unmarshalMachinePrimitive - } - - // Consult atlas second. - if entry, ok := atl.Get(rtid); ok { - return _yieldUnmarshalMachinePtrForAtlasEntry(row, entry, atl) - } - - // If no specific behavior found, use default behavior based on kind. - switch rt.Kind() { - - case reflect.Bool, - reflect.String, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Float32, reflect.Float64: - row.unmarshalMachinePrimitive.kind = rt.Kind() - return &row.unmarshalMachinePrimitive - case reflect.Slice: - // un-typedef'd byte slices were handled already, but a typedef'd one still gets gets treated like a special kind: - if rt.Elem().Kind() == reflect.Uint8 { - row.unmarshalMachinePrimitive.kind = rt.Kind() - return &row.unmarshalMachinePrimitive - } - return &row.unmarshalMachineSliceWildcard - case reflect.Array: - // arrays of bytes have a similar special case to slices for when they're typedefed. - if rt.Elem().Kind() == reflect.Uint8 { - row.unmarshalMachinePrimitive.kind = rt.Kind() - return &row.unmarshalMachinePrimitive - } - return &row.unmarshalMachineArrayWildcard - case reflect.Map: - return &row.unmarshalMachineMapStringWildcard - case reflect.Struct: - // TODO here we could also invoke automatic atlas autogen, if configured to be permitted - mach := &row.errThunkUnmarshalMachine - mach.err = fmt.Errorf("missing an atlas entry describing how to unmarshal type %v (and auto-atlasing for structs is not enabled)", rt) - return mach - case reflect.Interface: - return &row.unmarshalMachineWildcard - case reflect.Func: - panic(fmt.Errorf("functions cannot be unmarshalled!")) - case reflect.Ptr: - panic(fmt.Errorf("unreachable: ptrs must already be resolved")) - default: - panic(fmt.Errorf("excursion %s", rt.Kind())) - } -} - -// given that we already have an atlasEntry in mind, yield a configured machine for it. -// it seems odd that this might still require a whole atlas, but tis so; -// some things (e.g. transform funcs) need to get additional machinery for delegation. -func _yieldUnmarshalMachinePtrForAtlasEntry(row *unmarshalSlabRow, entry *atlas.AtlasEntry, atl atlas.Atlas) UnmarshalMachine { - // Switch across which of the union of configurations is applicable. - switch { - case entry.UnmarshalTransformFunc != nil: - // Return a machine that calls the func(s), then later a real machine. - // The entry.UnmarshalTransformTargetType is used to do a recursive lookup. - // We can't just call the func here because we're still working off typeinfo - // and don't have a real value to transform until later. - row.unmarshalMachineTransform.trFunc = entry.UnmarshalTransformFunc - row.unmarshalMachineTransform.recv_rt = entry.UnmarshalTransformTargetType - // Pick delegate without growing stack. (This currently means recursive transform won't fly.) - row.unmarshalMachineTransform.delegate = _yieldUnmarshalMachinePtr(row, atl, entry.UnmarshalTransformTargetType) - return &row.unmarshalMachineTransform - case entry.StructMap != nil: - row.unmarshalMachineStructAtlas.cfg = entry - return &row.unmarshalMachineStructAtlas - case entry.UnionKeyedMorphism != nil: - row.unmarshalMachineUnionKeyed.cfg = entry.UnionKeyedMorphism - return &row.unmarshalMachineUnionKeyed - default: - panic("invalid atlas entry") - } -} - -// Returns the top row of the slab. Useful for machines that need to delegate -// to another type that's definitely not their own (comes up for the wildcard delegators). -func (s *unmarshalSlab) tip() *unmarshalSlabRow { - return &s.rows[len(s.rows)-1] -} - -func (s *unmarshalSlab) grow() { - s.rows = append(s.rows, unmarshalSlabRow{}) -} - -func (s *unmarshalSlab) release() { - s.rows = s.rows[0 : len(s.rows)-1] -} - -type errThunkUnmarshalMachine struct { - err error -} - -func (m *errThunkUnmarshalMachine) Reset(_ *unmarshalSlab, _ reflect.Value, _ reflect.Type) error { - return m.err -} -func (m *errThunkUnmarshalMachine) Step(d *Unmarshaller, s *unmarshalSlab, tok *Token) (done bool, err error) { - return true, m.err -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalSliceWildcard.go b/vendor/github.com/polydawn/refmt/obj/unmarshalSliceWildcard.go deleted file mode 100644 index 513441d7..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalSliceWildcard.go +++ /dev/null @@ -1,81 +0,0 @@ -package obj - -import ( - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineSliceWildcard struct { - target_rv reflect.Value // target slice handle - working_rv reflect.Value // working slice (target is set to this at end) - value_rt reflect.Type - valueZero_rv reflect.Value // a zero of the slice's value type (for kicking append) - valueMach UnmarshalMachine - step unmarshalMachineStep - index int -} - -func (mach *unmarshalMachineSliceWildcard) Reset(slab *unmarshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.working_rv = rv - mach.value_rt = rt.Elem() - mach.valueZero_rv = reflect.Zero(mach.value_rt) - mach.valueMach = slab.requisitionMachine(mach.value_rt) - mach.step = mach.step_Initial - mach.index = 0 - return nil -} - -func (mach *unmarshalMachineSliceWildcard) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - return mach.step(driver, slab, tok) -} - -func (mach *unmarshalMachineSliceWildcard) step_Initial(_ *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // If it's a special state, start an object. - // (Or, blow up if its a special state that's silly). - switch tok.Type { - case TMapOpen: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TArrOpen: - // Great. Consumed. - mach.step = mach.step_AcceptValue - // Initialize the slice. - mach.target_rv.Set(reflect.MakeSlice(mach.target_rv.Type(), 0, 0)) - return false, nil - case TMapClose: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TArrClose: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - case TNull: - mach.target_rv.Set(reflect.Zero(mach.target_rv.Type())) - return true, nil - default: - return true, ErrMalformedTokenStream{tok.Type, "start of array"} - } -} - -func (mach *unmarshalMachineSliceWildcard) step_AcceptValue(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // Either form of open token are valid, but - // - an arrClose is ours - // - and a mapClose is clearly invalid. - switch tok.Type { - case TMapClose: - // no special checks for ends of wildcard slice; no such thing as incomplete. - return true, ErrMalformedTokenStream{tok.Type, "start of value or end of array"} - case TArrClose: - mach.target_rv.Set(mach.working_rv) - // release the slab row we requisitioned for our value machine. - slab.release() - return true, nil - } - - // Grow the slice if necessary. - mach.working_rv = reflect.Append(mach.working_rv, mach.valueZero_rv) - - // Recurse on a handle to the next index. - rv := mach.working_rv.Index(mach.index) - mach.index++ - return false, driver.Recurse(tok, rv, mach.value_rt, mach.valueMach) - // Step simply remains `step_AcceptValue` -- arrays don't have much state machine. -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalStruct.go b/vendor/github.com/polydawn/refmt/obj/unmarshalStruct.go deleted file mode 100644 index f05da75d..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalStruct.go +++ /dev/null @@ -1,109 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineStructAtlas struct { - cfg *atlas.AtlasEntry // set on initialization - - rv reflect.Value - expectLen int // Length header from mapOpen token. If it was set, we validate it. - index int // Progress marker: our distance into the stream of pairs. - value bool // Progress marker: whether the next token is a value. - fieldEntry atlas.StructMapEntry // Which field we expect next: set when consuming a key. -} - -func (mach *unmarshalMachineStructAtlas) Reset(_ *unmarshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.rv = rv - // not necessary to reset expectLen because MapOpen tokens also consistently use the -1 convention. - mach.index = -1 - mach.value = false - return nil -} - -func (mach *unmarshalMachineStructAtlas) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // Starter state. - if mach.index < 0 { - switch tok.Type { - case TMapOpen: - // Great. Consumed. - mach.expectLen = tok.Length - mach.index++ - return false, nil - case TMapClose: - return true, ErrMalformedTokenStream{tok.Type, "start of map"} - case TArrOpen: - return true, ErrMalformedTokenStream{tok.Type, "start of map"} - case TArrClose: - return true, ErrMalformedTokenStream{tok.Type, "start of map"} - case TNull: - mach.rv.Set(reflect.Zero(mach.rv.Type())) - return true, nil - default: - return true, ErrMalformedTokenStream{tok.Type, "start of map"} - } - } - - // Accept value: - if mach.value { - var child_rv reflect.Value - var child_rt reflect.Type - if mach.fieldEntry.Ignore { - // Use a dummy slot to slurp up the value. This could be more efficient. - child_rt = reflect.TypeOf((*interface{})(nil)).Elem() - child_rv = reflect.New(child_rt).Elem() - } else { - child_rt = mach.fieldEntry.Type - child_rv = mach.fieldEntry.ReflectRoute.TraverseToValue(mach.rv) - } - mach.index++ - mach.value = false - return false, driver.Recurse( - tok, - child_rv, - child_rt, - slab.requisitionMachine(child_rt), - ) - } - - // Accept key or end: - if mach.index > 0 { - slab.release() - } - switch tok.Type { - case TMapClose: - // If we got length header, validate that; error if mismatch. - if mach.expectLen >= 0 { - if mach.expectLen != mach.index { - return true, fmt.Errorf("malformed map token stream: declared length %d, actually got %d entries", mach.expectLen, mach.index) - } - } - - // Future: this would be a reasonable place to check that all required fields have been filled in, if we add such a feature. - - return true, nil - case TString: - for n := 0; n < len(mach.cfg.StructMap.Fields); n++ { - fieldEntry := mach.cfg.StructMap.Fields[n] - if fieldEntry.SerialName != tok.Str { - continue - } - mach.fieldEntry = fieldEntry - mach.value = true - break - } - if mach.value == false { - // FUTURE: it should be configurable per atlas.StructMap whether this is considered an error or to be tolerated. - // Currently we're being extremely strict about it, which is a divergence from the stdlib json behavior. - return true, ErrNoSuchField{tok.Str, mach.cfg.Type.String()} - } - default: - return true, ErrMalformedTokenStream{tok.Type, "map key"} - } - return false, nil -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalTransform.go b/vendor/github.com/polydawn/refmt/obj/unmarshalTransform.go deleted file mode 100644 index 961e3424..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalTransform.go +++ /dev/null @@ -1,38 +0,0 @@ -package obj - -import ( - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineTransform struct { - trFunc atlas.UnmarshalTransformFunc - recv_rt reflect.Type - delegate UnmarshalMachine // machine for handling the recv type, stepped to completion before transform applied. - - target_rv reflect.Value // given on Reset, retained until last step, and set into after using trFunc - recv_rv reflect.Value // if set, handle to slot where slice is stored; content must be placed into target at end. -} - -func (mach *unmarshalMachineTransform) Reset(slab *unmarshalSlab, rv reflect.Value, _ reflect.Type) error { - mach.target_rv = rv - mach.recv_rv = reflect.New(mach.recv_rt).Elem() // REVIEW: this behavior with ptr vs not for in_rt. the star-star case is prob not what want. - return mach.delegate.Reset(slab, mach.recv_rv, mach.recv_rt) -} - -func (mach *unmarshalMachineTransform) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - done, err = mach.delegate.Step(driver, slab, tok) - if err != nil { - return - } - if !done { - return - } - // on the last step, use transform, and finally set in real target. - tr_rv, err := mach.trFunc(mach.recv_rv) - // do attempt the set even if error. user may appreciate partial progress. - mach.target_rv.Set(tr_rv) - return true, err -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalUnionKeyed.go b/vendor/github.com/polydawn/refmt/obj/unmarshalUnionKeyed.go deleted file mode 100644 index 06269cfa..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalUnionKeyed.go +++ /dev/null @@ -1,90 +0,0 @@ -package obj - -import ( - "reflect" - - "github.com/polydawn/refmt/obj/atlas" - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineUnionKeyed struct { - cfg *atlas.UnionKeyedMorphism // set on initialization - - target_rv reflect.Value - target_rt reflect.Type - - step unmarshalMachineStep - tmp_rv reflect.Value - delegate UnmarshalMachine // actual machine, once we've demuxed with the second token (the key). -} - -func (mach *unmarshalMachineUnionKeyed) Reset(_ *unmarshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.target_rt = rt - mach.step = mach.acceptMapOpen - return nil -} - -func (mach *unmarshalMachineUnionKeyed) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - return mach.step(driver, slab, tok) -} - -func (mach *unmarshalMachineUnionKeyed) acceptMapOpen(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - switch tok.Type { - case TMapOpen: - switch tok.Length { - case -1: // pass - case 1: // correct - default: - return true, ErrMalformedTokenStream{tok.Type, "unions in keyed format must be maps with exactly one entry"} // FIXME not malformed per se - } - mach.step = mach.acceptKey - return false, nil - // REVIEW: is case TNull perhaps conditionally acceptable? - default: - return true, ErrMalformedTokenStream{tok.Type, "start of union value"} // FIXME not malformed per se - } -} - -func (mach *unmarshalMachineUnionKeyed) acceptKey(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - switch tok.Type { - case TString: - // Look up the configuration for this key. - delegateAtlasEnt, ok := mach.cfg.Elements[tok.Str] - if !ok { - return true, ErrNoSuchUnionMember{tok.Str, mach.target_rt, mach.cfg.KnownMembers} - } - // Allocate a new concrete value, and hang on to that rv handle. - // Assigning into the interface must be done at the end if it's a non-pointer. - mach.tmp_rv = reflect.New(delegateAtlasEnt.Type).Elem() - // Get and configure a machine for the delegation. - delegate := _yieldUnmarshalMachinePtrForAtlasEntry(slab.tip(), delegateAtlasEnt, slab.atlas) - if err := delegate.Reset(slab, mach.tmp_rv, delegateAtlasEnt.Type); err != nil { - return true, err - } - mach.delegate = delegate - mach.step = mach.doDelegate - return false, nil - default: - return true, ErrMalformedTokenStream{tok.Type, "map key"} - } -} - -func (mach *unmarshalMachineUnionKeyed) doDelegate(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - done, err = mach.delegate.Step(driver, slab, tok) - if done && err == nil { - mach.step = mach.acceptMapClose - return false, nil - } - return -} - -func (mach *unmarshalMachineUnionKeyed) acceptMapClose(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - switch tok.Type { - case TMapClose: - mach.target_rv.Set(mach.tmp_rv) - return true, nil - default: - return true, ErrMalformedTokenStream{tok.Type, "map close at end of union value"} - } -} diff --git a/vendor/github.com/polydawn/refmt/obj/unmarshalWildcard.go b/vendor/github.com/polydawn/refmt/obj/unmarshalWildcard.go deleted file mode 100644 index 4d99c0af..00000000 --- a/vendor/github.com/polydawn/refmt/obj/unmarshalWildcard.go +++ /dev/null @@ -1,112 +0,0 @@ -package obj - -import ( - "fmt" - "reflect" - - . "github.com/polydawn/refmt/tok" -) - -type unmarshalMachineWildcard struct { - target_rv reflect.Value - target_rt reflect.Type - delegate UnmarshalMachine // actual machine, once we've demuxed with the first token. - holder_rv reflect.Value // if set, handle to slot where slice is stored; content must be placed into target at end. -} - -func (mach *unmarshalMachineWildcard) Reset(_ *unmarshalSlab, rv reflect.Value, rt reflect.Type) error { - mach.target_rv = rv - mach.target_rt = rt - mach.delegate = nil - mach.holder_rv = reflect.Value{} - return nil -} - -func (mach *unmarshalMachineWildcard) Step(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - if mach.delegate == nil { - done, err = mach.prepareDemux(driver, slab, tok) - if done { - return - } - } - done, err = mach.delegate.Step(driver, slab, tok) - if !done { - return - } - if mach.holder_rv.IsValid() { - mach.target_rv.Set(mach.holder_rv) - } - return -} - -func (mach *unmarshalMachineWildcard) prepareDemux(driver *Unmarshaller, slab *unmarshalSlab, tok *Token) (done bool, err error) { - // If a "tag" is set in the token, we try to follow that as a hint for - // any specifically customized behaviors for how this should be unmarshalled. - if tok.Tagged == true { - atlasEntry, exists := slab.atlas.GetEntryByTag(tok.Tag) - if !exists { - return true, fmt.Errorf("missing an unmarshaller for tag %v", tok.Tag) - } - value_rt := atlasEntry.Type - mach.holder_rv = reflect.New(value_rt).Elem() - mach.delegate = _yieldUnmarshalMachinePtr(slab.tip(), slab.atlas, value_rt) - if err := mach.delegate.Reset(slab, mach.holder_rv, value_rt); err != nil { - return true, err - } - return false, nil - } - - // Switch on token type: we may be able to delegate to a primitive machine, - // but we may also need to initialize a container type and then hand off. - switch tok.Type { - case TMapOpen: - child := make(map[string]interface{}) - child_rv := reflect.ValueOf(child) - mach.target_rv.Set(child_rv) - mach.delegate = &slab.tip().unmarshalMachineMapStringWildcard - if err := mach.delegate.Reset(slab, child_rv, child_rv.Type()); err != nil { - return true, err - } - return false, nil - - case TArrOpen: - // Stdlib has very interesting branch here: 'case reflect.Interface: if v.NumMethod() == 0 {' - // If that matches, it goes on a *totally different* branch that leaves the reflective path entirely forever. - // (Which is kind of interesting, because it also means it will never reuse memory there. If you wanted that.) - - // This definitely went through a few discovery steps... - // - https://play.golang.org/p/Qbtpxwh68e - // - https://play.golang.org/p/l5RQujLnDN - // - https://play.golang.org/p/Z2ilpPk0vk - // - https://play.golang.org/p/jV9VFDht6F -- finally getting somewhere good - - holder := make([]interface{}, 0) - mach.holder_rv = reflect.ValueOf(&holder).Elem() - mach.delegate = &slab.tip().unmarshalMachineSliceWildcard - if err := mach.delegate.Reset(slab, mach.holder_rv, mach.holder_rv.Type()); err != nil { - return true, err - } - return false, nil - - case TMapClose: - return true, ErrMalformedTokenStream{tok.Type, "start of value"} - - case TArrClose: - return true, ErrMalformedTokenStream{tok.Type, "start of value"} - - case TNull: - mach.target_rv.Set(reflect.Zero(mach.target_rt)) - return true, nil - - default: - // If it wasn't the start of composite, shell out to the machine for literals. - // Don't bother to replace our internal step func because literal machines are never multi-call, - // and this lets us avoid grabbing a pointer and it shuffling around. - delegateMach := slab.tip().unmarshalMachinePrimitive - delegateMach.kind = reflect.Interface - if err := delegateMach.Reset(slab, mach.target_rv, nil); err != nil { - return true, err - } - return delegateMach.Step(driver, slab, tok) - } -} diff --git a/vendor/github.com/polydawn/refmt/pretty/prettyCommon.go b/vendor/github.com/polydawn/refmt/pretty/prettyCommon.go deleted file mode 100644 index 4ff6d248..00000000 --- a/vendor/github.com/polydawn/refmt/pretty/prettyCommon.go +++ /dev/null @@ -1,49 +0,0 @@ -package pretty - -var ( - decoOff = []byte("\x1B[0m") - decoType = []byte("\x1B[1;34m") - decoBrack = []byte("\x1B[0;36m") - decoTypeParam = []byte("\x1B[1;36m") - decoTag = []byte("\x1B[0;33m") - decoTagParam = []byte("\x1B[1;33m") - decoValSigil = []byte("\x1B[1;32m") - decoValString = []byte("\x1B[0;32m") -) - -var ( - wordTrue = []byte("true") - wordFalse = []byte("false") - wordNull = []byte("null") - wordArrOpenPt1 = bcat(decoType, []byte("Array"), decoBrack, []byte(" ["), decoOff) - wordArrClose = bcat(decoBrack, []byte("]"), decoOff) - wordMapOpenPt1 = bcat(decoType, []byte("Map"), decoBrack, []byte(" {"), decoOff) - wordMapClose = bcat(decoBrack, []byte("}"), decoOff) - wordColon = bcat(decoBrack, []byte(": "), decoOff) - wordTag = bcat(decoTag, []byte("_tag:"), decoTagParam) - wordTagClose = bcat(decoTag, []byte("_ "), decoOff) - wordUnknownLen = []byte("?") - wordBreak = []byte("\n\r") -) - -func indentWord(depth int) (a []byte) { - a = []byte{} - for i := 0; i < depth; i++ { - a = append(a, '\t') - } - return -} - -func bcat(bss ...[]byte) []byte { - l := 0 - for _, bs := range bss { - l += len(bs) - } - rbs := make([]byte, 0, l) - for _, bs := range bss { - rbs = append(rbs, bs...) - } - return rbs -} diff --git a/vendor/github.com/polydawn/refmt/pretty/prettyEncoder.go b/vendor/github.com/polydawn/refmt/pretty/prettyEncoder.go deleted file mode 100644 index f0cb5338..00000000 --- a/vendor/github.com/polydawn/refmt/pretty/prettyEncoder.go +++ /dev/null @@ -1,243 +0,0 @@ -package pretty - -import ( - "encoding/hex" - "fmt" - "io" - "strconv" - - . "github.com/polydawn/refmt/tok" -) - -func NewEncoder(wr io.Writer) *Encoder { - return &Encoder{ - wr: wr, - stack: make([]phase, 0, 10), - } -} - -func (d *Encoder) Reset() { - d.stack = d.stack[0:0] - d.current = phase_anyExpectValue -} - -/* - A pretty.Encoder is a TokenSink that emits pretty-printed stuff. - - The default behavior is color coded with ANSI escape sequences, so it's - snazzy looking on your terminal. -*/ -type Encoder struct { - wr io.Writer - - // Stack, tracking how many array and map opens are outstanding. - // (Values are only 'phase_mapExpectKeyOrEnd' and 'phase_arrExpectValueOrEnd'.) - stack []phase - current phase // shortcut to value at end of stack - - // Spare memory, for use in operations on leaf nodes (e.g. temp space for an int serialization). - scratch [64]byte -} - -type phase int - -const ( - phase_anyExpectValue phase = iota - phase_mapExpectKeyOrEnd - phase_mapExpectValue - phase_arrExpectValueOrEnd -) - -func (d *Encoder) Step(tok *Token) (done bool, err error) { - switch d.current { - case phase_anyExpectValue: - switch tok.Type { - case TMapOpen: - d.pushPhase(phase_mapExpectKeyOrEnd) - d.emitMapOpen(tok) - return false, nil - case TArrOpen: - d.pushPhase(phase_arrExpectValueOrEnd) - d.emitArrOpen(tok) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value") - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of value") - default: - d.emitValue(tok) - d.wr.Write(wordBreak) - return true, nil - } - case phase_mapExpectKeyOrEnd: - switch tok.Type { - case TMapOpen: - return true, fmt.Errorf("unexpected mapOpen; expected start of key or end of map") - case TArrOpen: - return true, fmt.Errorf("unexpected arrOpen; expected start of key or end of map") - case TMapClose: - d.emitMapClose(tok) - return d.popPhase() - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of key or end of map") - default: - switch tok.Type { - case TString, TInt, TUint: - d.wr.Write(indentWord(len(d.stack))) - d.emitValue(tok) - d.wr.Write(wordColon) - d.current = phase_mapExpectValue - return false, nil - default: - return true, fmt.Errorf("unexpected token of type %T; expected map key", *tok) - } - } - case phase_mapExpectValue: - switch tok.Type { - case TMapOpen: - d.pushPhase(phase_mapExpectKeyOrEnd) - d.emitMapOpen(tok) - return false, nil - case TArrOpen: - d.pushPhase(phase_arrExpectValueOrEnd) - d.emitArrOpen(tok) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value") - case TArrClose: - return true, fmt.Errorf("unexpected arrClose; expected start of value") - default: - d.current = phase_mapExpectKeyOrEnd - d.emitValue(tok) - d.wr.Write(wordBreak) - return false, nil - } - case phase_arrExpectValueOrEnd: - switch tok.Type { - case TMapOpen: - d.pushPhase(phase_mapExpectKeyOrEnd) - d.emitMapOpen(tok) - return false, nil - case TArrOpen: - d.pushPhase(phase_arrExpectValueOrEnd) - d.emitArrOpen(tok) - return false, nil - case TMapClose: - return true, fmt.Errorf("unexpected mapClose; expected start of value or end of array") - case TArrClose: - d.emitArrClose(tok) - return d.popPhase() - default: - d.wr.Write(indentWord(len(d.stack))) - d.emitValue(tok) - d.wr.Write(wordBreak) - return false, nil - } - default: - panic("Unreachable") - } -} - -func (d *Encoder) pushPhase(p phase) { - d.current = p - d.stack = append(d.stack, d.current) -} - -// Pop a phase from the stack; return 'true' if stack now empty. -func (d *Encoder) popPhase() (bool, error) { - n := len(d.stack) - 1 - if n == 0 { - return true, nil - } - if n < 0 { // the state machines are supposed to have already errored better - panic("prettyEncoder stack overpopped") - } - d.current = d.stack[n-1] - d.stack = d.stack[0:n] - return false, nil -} - -func (d *Encoder) emitMapOpen(tok *Token) { - if tok.Tagged { - d.wr.Write(wordTag) - d.wr.Write([]byte(strconv.Itoa(tok.Tag))) - d.wr.Write(wordTagClose) - } - d.wr.Write(wordMapOpenPt1) - if tok.Length < 0 { - d.wr.Write(wordUnknownLen) - } else { - d.wr.Write([]byte(strconv.Itoa(tok.Length))) - } - d.wr.Write(wordMapOpenPt2) - d.wr.Write(wordBreak) -} - -func (d *Encoder) emitMapClose(tok *Token) { - d.wr.Write(indentWord(len(d.stack) - 1)) - d.wr.Write(wordMapClose) - d.wr.Write(wordBreak) -} - -func (d *Encoder) emitArrOpen(tok *Token) { - if tok.Tagged { - d.wr.Write(wordTag) - d.wr.Write([]byte(strconv.Itoa(tok.Tag))) - d.wr.Write(wordTagClose) - } - d.wr.Write(wordArrOpenPt1) - if tok.Length < 0 { - d.wr.Write(wordUnknownLen) - } else { - d.wr.Write([]byte(strconv.Itoa(tok.Length))) - } - d.wr.Write(wordArrOpenPt2) - d.wr.Write(wordBreak) -} - -func (d *Encoder) emitArrClose(tok *Token) { - d.wr.Write(indentWord(len(d.stack) - 1)) - d.wr.Write(wordArrClose) - d.wr.Write(wordBreak) -} - -func (d *Encoder) emitValue(tok *Token) { - if tok.Tagged { - d.wr.Write(wordTag) - d.wr.Write([]byte(strconv.Itoa(tok.Tag))) - d.wr.Write(wordTagClose) - } - switch tok.Type { - case TNull: - d.wr.Write(wordNull) - case TString: - d.emitString(tok.Str) - case TBytes: - dst := make([]byte, hex.EncodedLen(len(tok.Bytes))) - hex.Encode(dst, tok.Bytes) - d.wr.Write(dst) - case TBool: - switch tok.Bool { - case true: - d.wr.Write(wordTrue) - case false: - d.wr.Write(wordFalse) - } - case TInt: - b := strconv.AppendInt(d.scratch[:0], tok.Int, 10) - d.wr.Write(b) - case TUint: - b := strconv.AppendUint(d.scratch[:0], tok.Uint, 10) - d.wr.Write(b) - case TFloat64: - b := strconv.AppendFloat(d.scratch[:0], tok.Float64, 'f', 6, 64) - d.wr.Write(b) - default: - panic(fmt.Errorf("TODO finish more pretty.Encoder primitives support: unhandled token %s", tok)) - } -} - -func (d *Encoder) writeByte(b byte) { - d.scratch[0] = b - d.wr.Write(d.scratch[0:1]) -} diff --git a/vendor/github.com/polydawn/refmt/pretty/prettyEncoderTerminals.go b/vendor/github.com/polydawn/refmt/pretty/prettyEncoderTerminals.go deleted file mode 100644 index 96f58688..00000000 --- a/vendor/github.com/polydawn/refmt/pretty/prettyEncoderTerminals.go +++ /dev/null @@ -1,82 +0,0 @@ -package pretty - -import ( - "io" - "unicode/utf8" -) - -var hexStr = "0123456789abcdef" - -func (d *Encoder) emitString(s string) { - d.wr.Write(decoValSigil) - d.writeByte('"') - d.wr.Write(decoValString) - start := 0 - for i := 0; i < len(s); { - if b := s[i]; b < utf8.RuneSelf { - if 0x20 <= b && b != '\\' && b != '"' { - i++ - continue - } - if start < i { - d.wr.Write([]byte(s[start:i])) - } - switch b { - case '\\', '"': - d.writeByte('\\') - d.writeByte(b) - case '\n': - d.writeByte('\\') - d.writeByte('n') - case '\r': - d.writeByte('\\') - d.writeByte('r') - case '\t': - d.writeByte('\\') - d.writeByte('t') - default: - // This encodes bytes < 0x20 except for \t, \n and \r. - d.wr.Write([]byte(`\u00`)) - d.writeByte(hexStr[b>>4]) - d.writeByte(hexStr[b&0xF]) - } - i++ - start = i - continue - } - c, size := utf8.DecodeRuneInString(s[i:]) - if c == utf8.RuneError && size == 1 { - if start < i { - d.wr.Write([]byte(s[start:i])) - } - d.wr.Write([]byte(`\ufffd`)) - i += size - start = i - continue - } - // U+2028 is LINE SEPARATOR. - // U+2029 is PARAGRAPH SEPARATOR. - // They are both technically valid characters in JSON strings, - // but don't work in JSONP, which has to be evaluated as JavaScript, - // and can lead to security holes there. It is valid JSON to - // escape them, so we do so unconditionally. - // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion. - if c == '\u2028' || c == '\u2029' { - if start < i { - d.wr.Write([]byte(s[start:i])) - } - d.wr.Write([]byte(`\u202`)) - d.writeByte(hexStr[c&0xF]) - i += size - start = i - continue - } - i += size - } - if start < len(s) { - io.WriteString(d.wr, s[start:]) - } - d.wr.Write(decoValSigil) - d.writeByte('"') - d.wr.Write(decoOff) -} diff --git a/vendor/github.com/polydawn/refmt/raceway.formula b/vendor/github.com/polydawn/refmt/raceway.formula deleted file mode 100644 index a9c71c16..00000000 --- a/vendor/github.com/polydawn/refmt/raceway.formula +++ /dev/null @@ -1,20 +0,0 @@ -inputs: - "/": - type: "tar" - hash: "aLMH4qK1EdlPDavdhErOs0BPxqO0i6lUaeRE4DuUmnNMxhHtF56gkoeSulvwWNqT" - silo: "http+ca://repeatr.s3.amazonaws.com/assets/" - "/app/go": - type: "tar" - hash: "vg5TMw0aRSIQGPybkhMvZmwwI6rzAz6CoAOC0ecUUY02Cn2_7x9GM2DclHXutEPH" - silo: "https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz" -action: - command: - - "/bin/bash" - - "-c" - - | - set -euo pipefail - export GOROOT=/app/go/go - export PATH=$PATH:/app/go/go/bin - - ./goad fmt - ./goad test diff --git a/vendor/github.com/polydawn/refmt/shared/pump.go b/vendor/github.com/polydawn/refmt/shared/pump.go deleted file mode 100644 index 106de658..00000000 --- a/vendor/github.com/polydawn/refmt/shared/pump.go +++ /dev/null @@ -1,46 +0,0 @@ -/* - The `shared` package defines helper types and functions used - internally by all the other refmt packages; it is not user-facing. -*/ -package shared - -import ( - "fmt" - - . "github.com/polydawn/refmt/tok" -) - -type TokenSource interface { - Step(fillme *Token) (done bool, err error) -} - -type TokenSink interface { - Step(consume *Token) (done bool, err error) -} - -type TokenPump struct { - TokenSource - TokenSink -} - -func (p TokenPump) Run() error { - var tok Token - var srcDone, sinkDone bool - var err error - for { - srcDone, err = p.TokenSource.Step(&tok) - if err != nil { - return err - } - sinkDone, err = p.TokenSink.Step(&tok) - if err != nil { - return err - } - if srcDone { - if sinkDone { - return nil - } - return fmt.Errorf("src at end of item but sink expects more") - } - } -} diff --git a/vendor/github.com/polydawn/refmt/shared/reader.go b/vendor/github.com/polydawn/refmt/shared/reader.go deleted file mode 100644 index 5059c971..00000000 --- a/vendor/github.com/polydawn/refmt/shared/reader.go +++ /dev/null @@ -1,301 +0,0 @@ -package shared - -import ( - "bytes" - "errors" - "io" -) - -const ( - scratchByteArrayLen = 32 -) - -var ( - zeroByteSlice = []byte{}[:0:0] -) - -var ( - _ SlickReader = &SlickReaderStream{} - _ SlickReader = &SlickReaderSlice{} -) - -func NewReader(r io.Reader) SlickReader { - return &SlickReaderStream{br: &readerToScanner{r: r}} -} - -func NewBytesReader(buf *bytes.Buffer) SlickReader { - return &SlickReaderStream{br: buf} -} - -func NewSliceReader(b []byte) SlickReader { - return &SlickReaderSlice{b: b} -} - -// SlickReader is a hybrid of reader and buffer interfaces with methods giving -// specific attention to the performance needs found in a decoder. -// Implementations cover io.Reader as well as []byte directly. -// -// In particular, it allows: -// -// - returning byte-slices with zero-copying (you were warned!) when possible -// - returning byte-slices for short reads which will be reused (you were warned!) -// - putting a 'track' point in the buffer, and later yielding all those bytes at once -// - counting the number of bytes read (for use in parser error messages, mainly) -// -// All of these shortcuts mean correct usage is essential to avoid unexpected behaviors, -// but in return allow avoiding many, many common sources of memory allocations in a parser. -type SlickReader interface { - - // Read n bytes into a byte slice which may be shared and must not be reused - // After any additional calls to this reader. - // Readnzc will use the implementation scratch buffer if possible, - // i.e. n < len(scratchbuf), or may return a view of the []byte being decoded from. - // Requesting a zero length read will return `zeroByteSlice`, a len-zero cap-zero slice. - Readnzc(n int) ([]byte, error) - - // Read n bytes into a new byte slice. - // If zero-copy views into existing buffers are acceptable (e.g. you know you - // won't later mutate, reference or expose this memory again), prefer `Readnzc`. - // If you already have an existing slice of sufficient size to reuse, prefer `Readb`. - // Requesting a zero length read will return `zeroByteSlice`, a len-zero cap-zero slice. - Readn(n int) ([]byte, error) - - // Read `len(b)` bytes into the given slice, starting at its beginning, - // overwriting all values, and disregarding any extra capacity. - Readb(b []byte) error - - Readn1() (uint8, error) - Unreadn1() - NumRead() int // number of bytes read - Track() - StopTrack() []byte -} - -// SlickReaderStream is a SlickReader that reads off an io.Reader. -// Initialize it by wrapping an ioDecByteScanner around your io.Reader and dumping it in. -// While this implementation does use some internal buffers, it's still advisable -// to use a buffered reader to avoid small reads for any external IO like disk or network. -type SlickReaderStream struct { - br readerScanner - scratch [scratchByteArrayLen]byte // temp byte array re-used internally for efficiency during read. - n int // num read - tracking []byte // tracking bytes read - isTracking bool -} - -func (z *SlickReaderStream) NumRead() int { - return z.n -} - -func (z *SlickReaderStream) Readnzc(n int) (bs []byte, err error) { - if n == 0 { - return zeroByteSlice, nil - } - if n < len(z.scratch) { - bs = z.scratch[:n] - } else { - bs = make([]byte, n) - } - err = z.Readb(bs) - return -} - -func (z *SlickReaderStream) Readn(n int) (bs []byte, err error) { - if n == 0 { - return zeroByteSlice, nil - } - bs = make([]byte, n) - err = z.Readb(bs) - return -} - -func (z *SlickReaderStream) Readb(bs []byte) error { - if len(bs) == 0 { - return nil - } - n, err := io.ReadAtLeast(z.br, bs, len(bs)) - z.n += n - if z.isTracking { - z.tracking = append(z.tracking, bs...) - } - return err -} - -func (z *SlickReaderStream) Readn1() (b uint8, err error) { - b, err = z.br.ReadByte() - if err != nil { - return - } - z.n++ - if z.isTracking { - z.tracking = append(z.tracking, b) - } - return -} - -func (z *SlickReaderStream) Unreadn1() { - err := z.br.UnreadByte() - if err != nil { - panic(err) - } - z.n-- - if z.isTracking { - if l := len(z.tracking) - 1; l >= 0 { - z.tracking = z.tracking[:l] - } - } -} - -func (z *SlickReaderStream) Track() { - if z.tracking != nil { - z.tracking = z.tracking[:0] - } - z.isTracking = true -} - -func (z *SlickReaderStream) StopTrack() (bs []byte) { - z.isTracking = false - return z.tracking -} - -// SlickReaderSlice implements SlickReader by reading a byte slice directly. -// Often this means the zero-copy methods can simply return subslices. -type SlickReaderSlice struct { - b []byte // data - c int // cursor - a int // available - t int // track start -} - -func (z *SlickReaderSlice) reset(in []byte) { - z.b = in - z.a = len(in) - z.c = 0 - z.t = 0 -} - -func (z *SlickReaderSlice) NumRead() int { - return z.c -} - -func (z *SlickReaderSlice) Unreadn1() { - if z.c == 0 || len(z.b) == 0 { - panic(errors.New("cannot unread last byte read")) - } - z.c-- - z.a++ - return -} - -func (z *SlickReaderSlice) Readnzc(n int) (bs []byte, err error) { - if n == 0 { - return zeroByteSlice, nil - } else if z.a == 0 { - return zeroByteSlice, io.EOF - } else if n > z.a { - return zeroByteSlice, io.ErrUnexpectedEOF - } else { - c0 := z.c - z.c = c0 + n - z.a = z.a - n - bs = z.b[c0:z.c] - } - return -} - -func (z *SlickReaderSlice) Readn(n int) (bs []byte, err error) { - if n == 0 { - return zeroByteSlice, nil - } - bs = make([]byte, n) - err = z.Readb(bs) - return -} - -func (z *SlickReaderSlice) Readn1() (v uint8, err error) { - if z.a == 0 { - panic(io.EOF) - } - v = z.b[z.c] - z.c++ - z.a-- - return -} - -func (z *SlickReaderSlice) Readb(bs []byte) error { - bs2, err := z.Readnzc(len(bs)) - copy(bs, bs2) - return err -} - -func (z *SlickReaderSlice) Track() { - z.t = z.c -} - -func (z *SlickReaderSlice) StopTrack() (bs []byte) { - return z.b[z.t:z.c] -} - -// conjoin the io.Reader and io.ByteScanner interfaces. -type readerScanner interface { - io.Reader - io.ByteScanner -} - -// readerToScanner decorates an `io.Reader` with all the methods to also -// fulfill the `io.ByteScanner` interface. -type readerToScanner struct { - r io.Reader - l byte // last byte - ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread - b [1]byte // tiny buffer for reading single bytes -} - -func (z *readerToScanner) Read(p []byte) (n int, err error) { - var firstByte bool - if z.ls == 1 { - z.ls = 2 - p[0] = z.l - if len(p) == 1 { - n = 1 - return - } - firstByte = true - p = p[1:] - } - n, err = z.r.Read(p) - if n > 0 { - if err == io.EOF && n == len(p) { - err = nil // read was successful, so postpone EOF (till next time) - } - z.l = p[n-1] - z.ls = 2 - } - if firstByte { - n++ - } - return -} - -func (z *readerToScanner) ReadByte() (c byte, err error) { - n, err := z.Read(z.b[:]) - if n == 1 { - c = z.b[0] - if err == io.EOF { - err = nil // read was successful, so postpone EOF (till next time) - } - } - return -} - -func (z *readerToScanner) UnreadByte() (err error) { - x := z.ls - if x == 0 { - err = errors.New("cannot unread - nothing has been read") - } else if x == 1 { - err = errors.New("cannot unread - last byte has not been read") - } else if x == 2 { - z.ls = 1 - } - return -} diff --git a/vendor/github.com/polydawn/refmt/tok/token.go b/vendor/github.com/polydawn/refmt/tok/token.go deleted file mode 100644 index 07aae136..00000000 --- a/vendor/github.com/polydawn/refmt/tok/token.go +++ /dev/null @@ -1,192 +0,0 @@ -/* - Package containing Token struct and TokenType info. - Tokens are the lingua-franca used between all the refmt packages. - Users typically do not refer to these types. -*/ -package tok - -import ( - "bytes" - "fmt" -) - -type Token struct { - // The type of token. Indicates which of the value fields has meaning, - // or has a special value to indicate beginnings and endings of maps and arrays. - Type TokenType - Length int // If this is a TMapOpen or TArrOpen, a length may be specified. Use -1 for unknown. - - Str string // Value union. Only one of these has meaning, depending on the value of 'Type'. - Bytes []byte // Value union. Only one of these has meaning, depending on the value of 'Type'. - Bool bool // Value union. Only one of these has meaning, depending on the value of 'Type'. - Int int64 // Value union. Only one of these has meaning, depending on the value of 'Type'. - Uint uint64 // Value union. Only one of these has meaning, depending on the value of 'Type'. - Float64 float64 // Value union. Only one of these has meaning, depending on the value of 'Type'. - - Tagged bool // Extension slot for cbor. - Tag int // Extension slot for cbor. Only applicable if tagged=true. -} - -type TokenType byte - -const ( - TMapOpen TokenType = '{' - TMapClose TokenType = '}' - TArrOpen TokenType = '[' - TArrClose TokenType = ']' - TNull TokenType = '0' - - TString TokenType = 's' - TBytes TokenType = 'x' - TBool TokenType = 'b' - TInt TokenType = 'i' - TUint TokenType = 'u' - TFloat64 TokenType = 'f' -) - -func (tt TokenType) String() string { - switch tt { - case TMapOpen: - return "map open" - case TMapClose: - return "map close" - case TArrOpen: - return "array open" - case TArrClose: - return "array close" - case TNull: - return "null" - case TString: - return "string" - case TBytes: - return "bytes" - case TBool: - return "bool" - case TInt: - return "int" - case TUint: - return "uint" - case TFloat64: - return "float" - } - return "invalid" -} - -func (tt TokenType) IsValid() bool { - switch tt { - case TString, TBytes, TBool, TInt, TUint, TFloat64, TNull: - return true - case TMapOpen, TMapClose, TArrOpen, TArrClose: - return true - default: - return false - } -} - -func (tt TokenType) IsValue() bool { - switch tt { - case TString, TBytes, TBool, TInt, TUint, TFloat64: - return true - default: - return false - } -} - -func (tt TokenType) IsSpecial() bool { - switch tt { - case TMapOpen, TMapClose, TArrOpen, TArrClose, TNull: - return true - default: - return false - } -} - -/* - Checks if the content of two tokens is the same. - Tokens are considered the same if their type one of the special - consts (map/array open/close) and that type and the optional length field are equal; - or, if type indicates a value, then they are the same if those values are equal. - In either path, values that are *not* specified as relevant by the Token's Type - are disregarded in the comparison. - - If the Token.Type is not valid, the result will be false. - - This method is primarily useful for testing. -*/ -func IsTokenEqual(t1, t2 Token) bool { - if t1.Type != t2.Type { - return false - } - switch t1.Type { - case TMapOpen, TArrOpen: - return t1.Length == t2.Length - case TMapClose, TArrClose, TNull: - return true - case TString, TBool, TInt, TUint, TFloat64: - return t1.Value() == t2.Value() - case TBytes: - return bytes.Equal(t1.Bytes, t2.Bytes) - default: - return false - } -} - -// Returns the value attached to this token, or nil. -// This boxes the value into an `interface{}`, which almost certainly -// incurs a memory allocation via `runtime.convT2E` in the process, -// so this this method should not be used when performance is a concern. -func (t Token) Value() interface{} { - switch t.Type { - case TString: - return t.Str - case TBytes: - return t.Bytes - case TBool: - return t.Bool - case TInt: - return t.Int - case TUint: - return t.Uint - case TFloat64: - return t.Float64 - default: - return nil - } -} - -func (t Token) String() string { - if !t.Tagged { - return t.StringSansTag() - } - return fmt.Sprintf("_%d:%s", t.Tag, t.StringSansTag()) -} - -func (t Token) StringSansTag() string { - switch t.Type { - case TMapOpen: - if t.Length == -1 { - return "<{>" - } - return fmt.Sprintf("<{:%d>", t.Length) - case TMapClose: - return "<}>" - case TArrOpen: - if t.Length == -1 { - return "<[>" - } - return fmt.Sprintf("<[:%d>", t.Length) - case TArrClose: - return "<]>" - case TNull: - return "<0>" - case TString: - return fmt.Sprintf("<%c:%q>", t.Type, t.Value()) - } - if t.Type.IsValue() { - return fmt.Sprintf("<%c:%v>", t.Type, t.Value()) - } - return "" -} - -func TokStr(x string) Token { return Token{Type: TString, Str: x} } // Util for testing. -func TokInt(x int64) Token { return Token{Type: TInt, Int: x} } // Util for testing. diff --git a/vendor/github.com/polydawn/refmt/unmarshalHelpers.go b/vendor/github.com/polydawn/refmt/unmarshalHelpers.go deleted file mode 100644 index 3ebf9ef6..00000000 --- a/vendor/github.com/polydawn/refmt/unmarshalHelpers.go +++ /dev/null @@ -1,61 +0,0 @@ -package refmt - -import ( - "io" - - "github.com/polydawn/refmt/cbor" - "github.com/polydawn/refmt/json" - "github.com/polydawn/refmt/obj/atlas" -) - -type DecodeOptions interface { - IsDecodeOptions() // marker method. -} - -func Unmarshal(opts DecodeOptions, data []byte, v interface{}) error { - switch o2 := opts.(type) { - case json.DecodeOptions: - return json.Unmarshal(data, v) - case cbor.DecodeOptions: - return cbor.Unmarshal(o2, data, v) - default: - panic("incorrect usage: unknown DecodeOptions type") - } -} - -func UnmarshalAtlased(opts DecodeOptions, data []byte, v interface{}, atl atlas.Atlas) error { - switch o2 := opts.(type) { - case json.DecodeOptions: - return json.UnmarshalAtlased(data, v, atl) - case cbor.DecodeOptions: - return cbor.UnmarshalAtlased(o2, data, v, atl) - default: - panic("incorrect usage: unknown DecodeOptions type") - } -} - -type Unmarshaller interface { - Unmarshal(v interface{}) error -} - -func NewUnmarshaller(opts DecodeOptions, r io.Reader) Unmarshaller { - switch o2 := opts.(type) { - case json.DecodeOptions: - return json.NewUnmarshaller(r) - case cbor.DecodeOptions: - return cbor.NewUnmarshaller(o2, r) - default: - panic("incorrect usage: unknown DecodeOptions type") - } -} - -func NewUnmarshallerAtlased(opts DecodeOptions, r io.Reader, atl atlas.Atlas) Unmarshaller { - switch o2 := opts.(type) { - case json.DecodeOptions: - return json.NewUnmarshallerAtlased(r, atl) - case cbor.DecodeOptions: - return cbor.NewUnmarshallerAtlased(o2, r, atl) - default: - panic("incorrect usage: unknown DecodeOptions type") - } -} diff --git a/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go b/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go index c55a2b81..4088f522 100644 --- a/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go +++ b/vendor/github.com/prometheus/tsdb/fileutil/fileutil.go @@ -128,9 +128,19 @@ func Rename(from, to string) error { // Replace moves a file or directory to a new location and deletes any previous data. // It is not atomic. func Replace(from, to string) error { - if err := os.RemoveAll(to); err != nil { - return err + // Remove destination only if it is a dir otherwise leave it to os.Rename + // as it replaces the destination file and is atomic. + { + f, err := os.Stat(to) + if !os.IsNotExist(err) { + if err == nil && f.IsDir() { + if err := os.RemoveAll(to); err != nil { + return err + } + } + } } + if err := os.Rename(from, to); err != nil { return err } diff --git a/vendor/github.com/rjeczalik/notify/go.mod b/vendor/github.com/rjeczalik/notify/go.mod deleted file mode 100644 index 2bbfbf3b..00000000 --- a/vendor/github.com/rjeczalik/notify/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/rjeczalik/notify - -require golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7 diff --git a/vendor/github.com/rs/cors/README.md b/vendor/github.com/rs/cors/README.md index ecc83b29..87413cca 100644 --- a/vendor/github.com/rs/cors/README.md +++ b/vendor/github.com/rs/cors/README.md @@ -68,7 +68,6 @@ Please refer to [#55](https://github.com/rs/cors/issues/55) for more information * [Gorilla](http://www.gorillatoolkit.org/pkg/mux): [examples/gorilla/server.go](https://github.com/rs/cors/blob/master/examples/gorilla/server.go) * [Buffalo](https://gobuffalo.io): [examples/buffalo/server.go](https://github.com/rs/cors/blob/master/examples/buffalo/server.go) * [Gin](https://gin-gonic.github.io/gin): [examples/gin/server.go](https://github.com/rs/cors/blob/master/examples/gin/server.go) -* [Chi](https://github.com/go-chi/chi): [examples/chi/server.go](https://github.com/rs/cors/blob/master/examples/chi/server.go) ## Parameters @@ -87,8 +86,7 @@ handler = c.Handler(handler) ``` * **AllowedOrigins** `[]string`: A list of origins a cross-domain request can be executed from. If the special `*` value is present in the list, all origins will be allowed. An origin may contain a wildcard (`*`) to replace 0 or more characters (i.e.: `http://*.domain.com`). Usage of wildcards implies a small performance penality. Only one wildcard can be used per origin. The default value is `*`. -* **AllowOriginFunc** `func (origin string) bool`: A custom function to validate the origin. It takes the origin as an argument and returns true if allowed, or false otherwise. If this option is set, the content of `AllowedOrigins` is ignored. -* **AllowOriginRequestFunc** `func (r *http.Request origin string) bool`: A custom function to validate the origin. It takes the HTTP Request object and the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` and `AllowOriginFunc` is ignored +* **AllowOriginFunc** `func (origin string) bool`: A custom function to validate the origin. It take the origin as argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` is ignored * **AllowedMethods** `[]string`: A list of methods the client is allowed to use with cross-domain requests. Default value is simple methods (`GET` and `POST`). * **AllowedHeaders** `[]string`: A list of non simple headers the client is allowed to use with cross-domain requests. * **ExposedHeaders** `[]string`: Indicates which headers are safe to expose to the API of a CORS API specification diff --git a/vendor/github.com/rs/cors/cors.go b/vendor/github.com/rs/cors/cors.go index d301ca72..15181089 100644 --- a/vendor/github.com/rs/cors/cors.go +++ b/vendor/github.com/rs/cors/cors.go @@ -41,10 +41,6 @@ type Options struct { // as argument and returns true if allowed or false otherwise. If this option is // set, the content of AllowedOrigins is ignored. AllowOriginFunc func(origin string) bool - // AllowOriginFunc is a custom function to validate the origin. It takes the HTTP Request object and the origin as - // argument and returns true if allowed or false otherwise. If this option is set, the content of `AllowedOrigins` - // and `AllowOriginFunc` is ignored. - AllowOriginRequestFunc func(r *http.Request, origin string) bool // AllowedMethods is a list of methods the client is allowed to use with // cross-domain requests. Default value is simple methods (HEAD, GET and POST). AllowedMethods []string @@ -79,8 +75,6 @@ type Cors struct { allowedWOrigins []wildcard // Optional origin validator function allowOriginFunc func(origin string) bool - // Optional origin validator (with request) function - allowOriginRequestFunc func(r *http.Request, origin string) bool // Normalized list of allowed headers allowedHeaders []string // Normalized list of allowed methods @@ -99,12 +93,11 @@ type Cors struct { // New creates a new Cors handler with the provided options. func New(options Options) *Cors { c := &Cors{ - exposedHeaders: convert(options.ExposedHeaders, http.CanonicalHeaderKey), - allowOriginFunc: options.AllowOriginFunc, - allowOriginRequestFunc: options.AllowOriginRequestFunc, - allowCredentials: options.AllowCredentials, - maxAge: options.MaxAge, - optionPassthrough: options.OptionsPassthrough, + exposedHeaders: convert(options.ExposedHeaders, http.CanonicalHeaderKey), + allowOriginFunc: options.AllowOriginFunc, + allowCredentials: options.AllowCredentials, + maxAge: options.MaxAge, + optionPassthrough: options.OptionsPassthrough, } if options.Debug { c.Log = log.New(os.Stdout, "[cors] ", log.LstdFlags) @@ -116,7 +109,7 @@ func New(options Options) *Cors { // Allowed Origins if len(options.AllowedOrigins) == 0 { - if options.AllowOriginFunc == nil && options.AllowOriginRequestFunc == nil { + if options.AllowOriginFunc == nil { // Default is all origins c.allowedOriginsAll = true } @@ -261,7 +254,7 @@ func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) { c.logf(" Preflight aborted: empty origin") return } - if !c.isOriginAllowed(r, origin) { + if !c.isOriginAllowed(origin) { c.logf(" Preflight aborted: origin '%s' not allowed", origin) return } @@ -314,7 +307,7 @@ func (c *Cors) handleActualRequest(w http.ResponseWriter, r *http.Request) { c.logf(" Actual request no headers added: missing origin") return } - if !c.isOriginAllowed(r, origin) { + if !c.isOriginAllowed(origin) { c.logf(" Actual request no headers added: origin '%s' not allowed", origin) return } @@ -351,10 +344,7 @@ func (c *Cors) logf(format string, a ...interface{}) { // isOriginAllowed checks if a given origin is allowed to perform cross-domain requests // on the endpoint -func (c *Cors) isOriginAllowed(r *http.Request, origin string) bool { - if c.allowOriginRequestFunc != nil { - return c.allowOriginRequestFunc(r, origin) - } +func (c *Cors) isOriginAllowed(origin string) bool { if c.allowOriginFunc != nil { return c.allowOriginFunc(origin) } diff --git a/vendor/github.com/rs/cors/utils.go b/vendor/github.com/rs/cors/utils.go index 53ad9e9d..c7a0aa06 100644 --- a/vendor/github.com/rs/cors/utils.go +++ b/vendor/github.com/rs/cors/utils.go @@ -39,20 +39,19 @@ func parseHeaderList(headerList string) []string { headers := make([]string, 0, t) for i := 0; i < l; i++ { b := headerList[i] - switch { - case b >= 'a' && b <= 'z': + if b >= 'a' && b <= 'z' { if upper { h = append(h, b-toLower) } else { h = append(h, b) } - case b >= 'A' && b <= 'Z': + } else if b >= 'A' && b <= 'Z' { if !upper { h = append(h, b+toLower) } else { h = append(h, b) } - case b == '-' || b == '_' || (b >= '0' && b <= '9'): + } else if b == '-' || b == '_' || (b >= '0' && b <= '9') { h = append(h, b) } diff --git a/vendor/github.com/sirupsen/logrus/.travis.yml b/vendor/github.com/sirupsen/logrus/.travis.yml index 848938a6..1f953beb 100644 --- a/vendor/github.com/sirupsen/logrus/.travis.yml +++ b/vendor/github.com/sirupsen/logrus/.travis.yml @@ -1,25 +1,51 @@ language: go -go_import_path: github.com/sirupsen/logrus -git: - depth: 1 env: - - GO111MODULE=on - - GO111MODULE=off -go: [ 1.11.x, 1.12.x ] -os: [ linux, osx ] + - GOMAXPROCS=4 GORACE=halt_on_error=1 matrix: - exclude: - - go: 1.12.x - env: GO111MODULE=off + include: + - go: 1.10.x + install: + - go get github.com/stretchr/testify/assert + - go get golang.org/x/crypto/ssh/terminal + - go get golang.org/x/sys/unix + - go get golang.org/x/sys/windows + script: + - go test -race -v ./... - go: 1.11.x - os: osx -install: - - ./travis/install.sh - - if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi - - if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi -script: - - ./travis/cross_build.sh - - export GOMAXPROCS=4 - - export GORACE=halt_on_error=1 - - go test -race -v ./... - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi + env: GO111MODULE=on + install: + - go mod download + script: + - go test -race -v ./... + - go: 1.11.x + env: GO111MODULE=off + install: + - go get github.com/stretchr/testify/assert + - go get golang.org/x/crypto/ssh/terminal + - go get golang.org/x/sys/unix + - go get golang.org/x/sys/windows + script: + - go test -race -v ./... + - go: 1.10.x + install: + - go get github.com/stretchr/testify/assert + - go get golang.org/x/crypto/ssh/terminal + - go get golang.org/x/sys/unix + - go get golang.org/x/sys/windows + script: + - go test -race -v -tags appengine ./... + - go: 1.11.x + env: GO111MODULE=on + install: + - go mod download + script: + - go test -race -v -tags appengine ./... + - go: 1.11.x + env: GO111MODULE=off + install: + - go get github.com/stretchr/testify/assert + - go get golang.org/x/crypto/ssh/terminal + - go get golang.org/x/sys/unix + - go get golang.org/x/sys/windows + script: + - go test -race -v -tags appengine ./... diff --git a/vendor/github.com/sirupsen/logrus/CHANGELOG.md b/vendor/github.com/sirupsen/logrus/CHANGELOG.md index 51a7ab0c..cb85d9f9 100644 --- a/vendor/github.com/sirupsen/logrus/CHANGELOG.md +++ b/vendor/github.com/sirupsen/logrus/CHANGELOG.md @@ -1,38 +1,3 @@ -# 1.4.2 - * Fixes build break for plan9, nacl, solaris -# 1.4.1 -This new release introduces: - * Enhance TextFormatter to not print caller information when they are empty (#944) - * Remove dependency on golang.org/x/crypto (#932, #943) - -Fixes: - * Fix Entry.WithContext method to return a copy of the initial entry (#941) - -# 1.4.0 -This new release introduces: - * Add `DeferExitHandler`, similar to `RegisterExitHandler` but prepending the handler to the list of handlers (semantically like `defer`) (#848). - * Add `CallerPrettyfier` to `JSONFormatter` and `TextFormatter (#909, #911) - * Add `Entry.WithContext()` and `Entry.Context`, to set a context on entries to be used e.g. in hooks (#919). - -Fixes: - * Fix wrong method calls `Logger.Print` and `Logger.Warningln` (#893). - * Update `Entry.Logf` to not do string formatting unless the log level is enabled (#903) - * Fix infinite recursion on unknown `Level.String()` (#907) - * Fix race condition in `getCaller` (#916). - - -# 1.3.0 -This new release introduces: - * Log, Logf, Logln functions for Logger and Entry that take a Level - -Fixes: - * Building prometheus node_exporter on AIX (#840) - * Race condition in TextFormatter (#468) - * Travis CI import path (#868) - * Remove coloured output on Windows (#862) - * Pointer to func as field in JSONFormatter (#870) - * Properly marshal Levels (#873) - # 1.2.0 This new release introduces: * A new method `SetReportCaller` in the `Logger` to enable the file, line and calling function from which the trace has been issued diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md index a4796eb0..093bb13f 100644 --- a/vendor/github.com/sirupsen/logrus/README.md +++ b/vendor/github.com/sirupsen/logrus/README.md @@ -361,11 +361,9 @@ The built-in logging formatters are: Third party logging formatters: * [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine. -* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html). * [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events. * [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout. * [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦. -* [`nested-logrus-formatter`](https://github.com/antonfisher/nested-logrus-formatter). Converts logrus fields to a nested structure. You can define your formatter by implementing the `Formatter` interface, requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a diff --git a/vendor/github.com/sirupsen/logrus/alt_exit.go b/vendor/github.com/sirupsen/logrus/alt_exit.go index 8fd189e1..8af90637 100644 --- a/vendor/github.com/sirupsen/logrus/alt_exit.go +++ b/vendor/github.com/sirupsen/logrus/alt_exit.go @@ -51,9 +51,9 @@ func Exit(code int) { os.Exit(code) } -// RegisterExitHandler appends a Logrus Exit handler to the list of handlers, -// call logrus.Exit to invoke all handlers. The handlers will also be invoked when -// any Fatal log entry is made. +// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke +// all handlers. The handlers will also be invoked when any Fatal log entry is +// made. // // This method is useful when a caller wishes to use logrus to log a fatal // message but also needs to gracefully shutdown. An example usecase could be @@ -62,15 +62,3 @@ func Exit(code int) { func RegisterExitHandler(handler func()) { handlers = append(handlers, handler) } - -// DeferExitHandler prepends a Logrus Exit handler to the list of handlers, -// call logrus.Exit to invoke all handlers. The handlers will also be invoked when -// any Fatal log entry is made. -// -// This method is useful when a caller wishes to use logrus to log a fatal -// message but also needs to gracefully shutdown. An example usecase could be -// closing database connections, or sending a alert that the application is -// closing. -func DeferExitHandler(handler func()) { - handlers = append([]func(){handler}, handlers...) -} diff --git a/vendor/github.com/sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go index 63e25583..cc85d3aa 100644 --- a/vendor/github.com/sirupsen/logrus/entry.go +++ b/vendor/github.com/sirupsen/logrus/entry.go @@ -2,7 +2,6 @@ package logrus import ( "bytes" - "context" "fmt" "os" "reflect" @@ -70,9 +69,6 @@ type Entry struct { // When formatter is called in entry.log(), a Buffer may be set to entry Buffer *bytes.Buffer - // Contains the context set by the user. Useful for hook processing etc. - Context context.Context - // err may contain a field formatting error err string } @@ -101,11 +97,6 @@ func (entry *Entry) WithError(err error) *Entry { return entry.WithField(ErrorKey, err) } -// Add a context to the Entry. -func (entry *Entry) WithContext(ctx context.Context) *Entry { - return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx} -} - // Add a single field to the Entry. func (entry *Entry) WithField(key string, value interface{}) *Entry { return entry.WithFields(Fields{key: value}) @@ -117,34 +108,23 @@ func (entry *Entry) WithFields(fields Fields) *Entry { for k, v := range entry.Data { data[k] = v } - fieldErr := entry.err + var field_err string for k, v := range fields { - isErrField := false - if t := reflect.TypeOf(v); t != nil { - switch t.Kind() { - case reflect.Func: - isErrField = true - case reflect.Ptr: - isErrField = t.Elem().Kind() == reflect.Func - } - } - if isErrField { - tmp := fmt.Sprintf("can not add field %q", k) - if fieldErr != "" { - fieldErr = entry.err + ", " + tmp - } else { - fieldErr = tmp + if t := reflect.TypeOf(v); t != nil && t.Kind() == reflect.Func { + field_err = fmt.Sprintf("can not add field %q", k) + if entry.err != "" { + field_err = entry.err + ", " + field_err } } else { data[k] = v } } - return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr, Context: entry.Context} + return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: field_err} } // Overrides the time of the Entry. func (entry *Entry) WithTime(t time.Time) *Entry { - return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err, Context: entry.Context} + return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t} } // getPackageName reduces a fully qualified function name to the package name @@ -165,23 +145,20 @@ func getPackageName(f string) string { // getCaller retrieves the name of the first non-logrus calling function func getCaller() *runtime.Frame { - - // cache this package's fully-qualified name - callerInitOnce.Do(func() { - pcs := make([]uintptr, 2) - _ = runtime.Callers(0, pcs) - logrusPackage = getPackageName(runtime.FuncForPC(pcs[1]).Name()) - - // now that we have the cache, we can skip a minimum count of known-logrus functions - // XXX this is dubious, the number of frames may vary - minimumCallerDepth = knownLogrusFrames - }) - // Restrict the lookback frames to avoid runaway lookups pcs := make([]uintptr, maximumCallerDepth) depth := runtime.Callers(minimumCallerDepth, pcs) frames := runtime.CallersFrames(pcs[:depth]) + // cache this package's fully-qualified name + callerInitOnce.Do(func() { + logrusPackage = getPackageName(runtime.FuncForPC(pcs[0]).Name()) + + // now that we have the cache, we can skip a minimum count of known-logrus functions + // XXX this is dubious, the number of frames may vary store an entry in a logger interface + minimumCallerDepth = knownLogrusFrames + }) + for f, again := frames.Next(); again; f, again = frames.Next() { pkg := getPackageName(f.Function) @@ -263,18 +240,16 @@ func (entry *Entry) write() { } } -func (entry *Entry) Log(level Level, args ...interface{}) { - if entry.Logger.IsLevelEnabled(level) { - entry.log(level, fmt.Sprint(args...)) +func (entry *Entry) Trace(args ...interface{}) { + if entry.Logger.IsLevelEnabled(TraceLevel) { + entry.log(TraceLevel, fmt.Sprint(args...)) } } -func (entry *Entry) Trace(args ...interface{}) { - entry.Log(TraceLevel, args...) -} - func (entry *Entry) Debug(args ...interface{}) { - entry.Log(DebugLevel, args...) + if entry.Logger.IsLevelEnabled(DebugLevel) { + entry.log(DebugLevel, fmt.Sprint(args...)) + } } func (entry *Entry) Print(args ...interface{}) { @@ -282,11 +257,15 @@ func (entry *Entry) Print(args ...interface{}) { } func (entry *Entry) Info(args ...interface{}) { - entry.Log(InfoLevel, args...) + if entry.Logger.IsLevelEnabled(InfoLevel) { + entry.log(InfoLevel, fmt.Sprint(args...)) + } } func (entry *Entry) Warn(args ...interface{}) { - entry.Log(WarnLevel, args...) + if entry.Logger.IsLevelEnabled(WarnLevel) { + entry.log(WarnLevel, fmt.Sprint(args...)) + } } func (entry *Entry) Warning(args ...interface{}) { @@ -294,37 +273,43 @@ func (entry *Entry) Warning(args ...interface{}) { } func (entry *Entry) Error(args ...interface{}) { - entry.Log(ErrorLevel, args...) + if entry.Logger.IsLevelEnabled(ErrorLevel) { + entry.log(ErrorLevel, fmt.Sprint(args...)) + } } func (entry *Entry) Fatal(args ...interface{}) { - entry.Log(FatalLevel, args...) + if entry.Logger.IsLevelEnabled(FatalLevel) { + entry.log(FatalLevel, fmt.Sprint(args...)) + } entry.Logger.Exit(1) } func (entry *Entry) Panic(args ...interface{}) { - entry.Log(PanicLevel, args...) + if entry.Logger.IsLevelEnabled(PanicLevel) { + entry.log(PanicLevel, fmt.Sprint(args...)) + } panic(fmt.Sprint(args...)) } // Entry Printf family functions -func (entry *Entry) Logf(level Level, format string, args ...interface{}) { - if entry.Logger.IsLevelEnabled(level) { - entry.Log(level, fmt.Sprintf(format, args...)) +func (entry *Entry) Tracef(format string, args ...interface{}) { + if entry.Logger.IsLevelEnabled(TraceLevel) { + entry.Trace(fmt.Sprintf(format, args...)) } } -func (entry *Entry) Tracef(format string, args ...interface{}) { - entry.Logf(TraceLevel, format, args...) -} - func (entry *Entry) Debugf(format string, args ...interface{}) { - entry.Logf(DebugLevel, format, args...) + if entry.Logger.IsLevelEnabled(DebugLevel) { + entry.Debug(fmt.Sprintf(format, args...)) + } } func (entry *Entry) Infof(format string, args ...interface{}) { - entry.Logf(InfoLevel, format, args...) + if entry.Logger.IsLevelEnabled(InfoLevel) { + entry.Info(fmt.Sprintf(format, args...)) + } } func (entry *Entry) Printf(format string, args ...interface{}) { @@ -332,7 +317,9 @@ func (entry *Entry) Printf(format string, args ...interface{}) { } func (entry *Entry) Warnf(format string, args ...interface{}) { - entry.Logf(WarnLevel, format, args...) + if entry.Logger.IsLevelEnabled(WarnLevel) { + entry.Warn(fmt.Sprintf(format, args...)) + } } func (entry *Entry) Warningf(format string, args ...interface{}) { @@ -340,36 +327,42 @@ func (entry *Entry) Warningf(format string, args ...interface{}) { } func (entry *Entry) Errorf(format string, args ...interface{}) { - entry.Logf(ErrorLevel, format, args...) + if entry.Logger.IsLevelEnabled(ErrorLevel) { + entry.Error(fmt.Sprintf(format, args...)) + } } func (entry *Entry) Fatalf(format string, args ...interface{}) { - entry.Logf(FatalLevel, format, args...) + if entry.Logger.IsLevelEnabled(FatalLevel) { + entry.Fatal(fmt.Sprintf(format, args...)) + } entry.Logger.Exit(1) } func (entry *Entry) Panicf(format string, args ...interface{}) { - entry.Logf(PanicLevel, format, args...) + if entry.Logger.IsLevelEnabled(PanicLevel) { + entry.Panic(fmt.Sprintf(format, args...)) + } } // Entry Println family functions -func (entry *Entry) Logln(level Level, args ...interface{}) { - if entry.Logger.IsLevelEnabled(level) { - entry.Log(level, entry.sprintlnn(args...)) +func (entry *Entry) Traceln(args ...interface{}) { + if entry.Logger.IsLevelEnabled(TraceLevel) { + entry.Trace(entry.sprintlnn(args...)) } } -func (entry *Entry) Traceln(args ...interface{}) { - entry.Logln(TraceLevel, args...) -} - func (entry *Entry) Debugln(args ...interface{}) { - entry.Logln(DebugLevel, args...) + if entry.Logger.IsLevelEnabled(DebugLevel) { + entry.Debug(entry.sprintlnn(args...)) + } } func (entry *Entry) Infoln(args ...interface{}) { - entry.Logln(InfoLevel, args...) + if entry.Logger.IsLevelEnabled(InfoLevel) { + entry.Info(entry.sprintlnn(args...)) + } } func (entry *Entry) Println(args ...interface{}) { @@ -377,7 +370,9 @@ func (entry *Entry) Println(args ...interface{}) { } func (entry *Entry) Warnln(args ...interface{}) { - entry.Logln(WarnLevel, args...) + if entry.Logger.IsLevelEnabled(WarnLevel) { + entry.Warn(entry.sprintlnn(args...)) + } } func (entry *Entry) Warningln(args ...interface{}) { @@ -385,16 +380,22 @@ func (entry *Entry) Warningln(args ...interface{}) { } func (entry *Entry) Errorln(args ...interface{}) { - entry.Logln(ErrorLevel, args...) + if entry.Logger.IsLevelEnabled(ErrorLevel) { + entry.Error(entry.sprintlnn(args...)) + } } func (entry *Entry) Fatalln(args ...interface{}) { - entry.Logln(FatalLevel, args...) + if entry.Logger.IsLevelEnabled(FatalLevel) { + entry.Fatal(entry.sprintlnn(args...)) + } entry.Logger.Exit(1) } func (entry *Entry) Panicln(args ...interface{}) { - entry.Logln(PanicLevel, args...) + if entry.Logger.IsLevelEnabled(PanicLevel) { + entry.Panic(entry.sprintlnn(args...)) + } } // Sprintlnn => Sprint no newline. This is to get the behavior of how diff --git a/vendor/github.com/sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go index 62fc2f21..7342613c 100644 --- a/vendor/github.com/sirupsen/logrus/exported.go +++ b/vendor/github.com/sirupsen/logrus/exported.go @@ -1,7 +1,6 @@ package logrus import ( - "context" "io" "time" ) @@ -56,11 +55,6 @@ func WithError(err error) *Entry { return std.WithField(ErrorKey, err) } -// WithContext creates an entry from the standard logger and adds a context to it. -func WithContext(ctx context.Context) *Entry { - return std.WithContext(ctx) -} - // WithField creates an entry from the standard logger and adds a field to // it. If you want multiple fields, use `WithFields`. // diff --git a/vendor/github.com/sirupsen/logrus/go.mod b/vendor/github.com/sirupsen/logrus/go.mod index 12fdf989..94574cc6 100644 --- a/vendor/github.com/sirupsen/logrus/go.mod +++ b/vendor/github.com/sirupsen/logrus/go.mod @@ -6,5 +6,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/stretchr/testify v1.2.2 - golang.org/x/sys v0.0.0-20190422165155-953cdadca894 + golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 + golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 ) diff --git a/vendor/github.com/sirupsen/logrus/go.sum b/vendor/github.com/sirupsen/logrus/go.sum index 596c318b..133d34ae 100644 --- a/vendor/github.com/sirupsen/logrus/go.sum +++ b/vendor/github.com/sirupsen/logrus/go.sum @@ -2,7 +2,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs= github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -10,7 +9,7 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/sirupsen/logrus/json_formatter.go b/vendor/github.com/sirupsen/logrus/json_formatter.go index 098a21a0..26057535 100644 --- a/vendor/github.com/sirupsen/logrus/json_formatter.go +++ b/vendor/github.com/sirupsen/logrus/json_formatter.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "runtime" ) type fieldKey string @@ -43,12 +42,6 @@ type JSONFormatter struct { // } FieldMap FieldMap - // CallerPrettyfier can be set by the user to modify the content - // of the function and file keys in the json data when ReportCaller is - // activated. If any of the returned value is the empty string the - // corresponding key will be removed from json fields. - CallerPrettyfier func(*runtime.Frame) (function string, file string) - // PrettyPrint will indent all json logs PrettyPrint bool } @@ -89,17 +82,8 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() if entry.HasCaller() { - funcVal := entry.Caller.Function - fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) - if f.CallerPrettyfier != nil { - funcVal, fileVal = f.CallerPrettyfier(entry.Caller) - } - if funcVal != "" { - data[f.FieldMap.resolve(FieldKeyFunc)] = funcVal - } - if fileVal != "" { - data[f.FieldMap.resolve(FieldKeyFile)] = fileVal - } + data[f.FieldMap.resolve(FieldKeyFunc)] = entry.Caller.Function + data[f.FieldMap.resolve(FieldKeyFile)] = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) } var b *bytes.Buffer @@ -114,7 +98,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { encoder.SetIndent("", " ") } if err := encoder.Encode(data); err != nil { - return nil, fmt.Errorf("failed to marshal fields to JSON, %v", err) + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) } return b.Bytes(), nil diff --git a/vendor/github.com/sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go index c0c0b1e5..5ceca0ea 100644 --- a/vendor/github.com/sirupsen/logrus/logger.go +++ b/vendor/github.com/sirupsen/logrus/logger.go @@ -1,7 +1,6 @@ package logrus import ( - "context" "io" "os" "sync" @@ -125,13 +124,6 @@ func (logger *Logger) WithError(err error) *Entry { return entry.WithError(err) } -// Add a context to the log entry. -func (logger *Logger) WithContext(ctx context.Context) *Entry { - entry := logger.newEntry() - defer logger.releaseEntry(entry) - return entry.WithContext(ctx) -} - // Overrides the time of the log entry. func (logger *Logger) WithTime(t time.Time) *Entry { entry := logger.newEntry() @@ -139,24 +131,28 @@ func (logger *Logger) WithTime(t time.Time) *Entry { return entry.WithTime(t) } -func (logger *Logger) Logf(level Level, format string, args ...interface{}) { - if logger.IsLevelEnabled(level) { +func (logger *Logger) Tracef(format string, args ...interface{}) { + if logger.IsLevelEnabled(TraceLevel) { entry := logger.newEntry() - entry.Logf(level, format, args...) + entry.Tracef(format, args...) logger.releaseEntry(entry) } } -func (logger *Logger) Tracef(format string, args ...interface{}) { - logger.Logf(TraceLevel, format, args...) -} - func (logger *Logger) Debugf(format string, args ...interface{}) { - logger.Logf(DebugLevel, format, args...) + if logger.IsLevelEnabled(DebugLevel) { + entry := logger.newEntry() + entry.Debugf(format, args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Infof(format string, args ...interface{}) { - logger.Logf(InfoLevel, format, args...) + if logger.IsLevelEnabled(InfoLevel) { + entry := logger.newEntry() + entry.Infof(format, args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Printf(format string, args ...interface{}) { @@ -166,91 +162,139 @@ func (logger *Logger) Printf(format string, args ...interface{}) { } func (logger *Logger) Warnf(format string, args ...interface{}) { - logger.Logf(WarnLevel, format, args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Warningf(format string, args ...interface{}) { - logger.Warnf(format, args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Errorf(format string, args ...interface{}) { - logger.Logf(ErrorLevel, format, args...) + if logger.IsLevelEnabled(ErrorLevel) { + entry := logger.newEntry() + entry.Errorf(format, args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Fatalf(format string, args ...interface{}) { - logger.Logf(FatalLevel, format, args...) + if logger.IsLevelEnabled(FatalLevel) { + entry := logger.newEntry() + entry.Fatalf(format, args...) + logger.releaseEntry(entry) + } logger.Exit(1) } func (logger *Logger) Panicf(format string, args ...interface{}) { - logger.Logf(PanicLevel, format, args...) -} - -func (logger *Logger) Log(level Level, args ...interface{}) { - if logger.IsLevelEnabled(level) { + if logger.IsLevelEnabled(PanicLevel) { entry := logger.newEntry() - entry.Log(level, args...) + entry.Panicf(format, args...) logger.releaseEntry(entry) } } func (logger *Logger) Trace(args ...interface{}) { - logger.Log(TraceLevel, args...) + if logger.IsLevelEnabled(TraceLevel) { + entry := logger.newEntry() + entry.Trace(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Debug(args ...interface{}) { - logger.Log(DebugLevel, args...) + if logger.IsLevelEnabled(DebugLevel) { + entry := logger.newEntry() + entry.Debug(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Info(args ...interface{}) { - logger.Log(InfoLevel, args...) + if logger.IsLevelEnabled(InfoLevel) { + entry := logger.newEntry() + entry.Info(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Print(args ...interface{}) { entry := logger.newEntry() - entry.Print(args...) + entry.Info(args...) logger.releaseEntry(entry) } func (logger *Logger) Warn(args ...interface{}) { - logger.Log(WarnLevel, args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Warning(args ...interface{}) { - logger.Warn(args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Error(args ...interface{}) { - logger.Log(ErrorLevel, args...) + if logger.IsLevelEnabled(ErrorLevel) { + entry := logger.newEntry() + entry.Error(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Fatal(args ...interface{}) { - logger.Log(FatalLevel, args...) + if logger.IsLevelEnabled(FatalLevel) { + entry := logger.newEntry() + entry.Fatal(args...) + logger.releaseEntry(entry) + } logger.Exit(1) } func (logger *Logger) Panic(args ...interface{}) { - logger.Log(PanicLevel, args...) -} - -func (logger *Logger) Logln(level Level, args ...interface{}) { - if logger.IsLevelEnabled(level) { + if logger.IsLevelEnabled(PanicLevel) { entry := logger.newEntry() - entry.Logln(level, args...) + entry.Panic(args...) logger.releaseEntry(entry) } } func (logger *Logger) Traceln(args ...interface{}) { - logger.Logln(TraceLevel, args...) + if logger.IsLevelEnabled(TraceLevel) { + entry := logger.newEntry() + entry.Traceln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Debugln(args ...interface{}) { - logger.Logln(DebugLevel, args...) + if logger.IsLevelEnabled(DebugLevel) { + entry := logger.newEntry() + entry.Debugln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Infoln(args ...interface{}) { - logger.Logln(InfoLevel, args...) + if logger.IsLevelEnabled(InfoLevel) { + entry := logger.newEntry() + entry.Infoln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Println(args ...interface{}) { @@ -260,24 +304,44 @@ func (logger *Logger) Println(args ...interface{}) { } func (logger *Logger) Warnln(args ...interface{}) { - logger.Logln(WarnLevel, args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Warningln(args ...interface{}) { - logger.Warnln(args...) + if logger.IsLevelEnabled(WarnLevel) { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Errorln(args ...interface{}) { - logger.Logln(ErrorLevel, args...) + if logger.IsLevelEnabled(ErrorLevel) { + entry := logger.newEntry() + entry.Errorln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Fatalln(args ...interface{}) { - logger.Logln(FatalLevel, args...) + if logger.IsLevelEnabled(FatalLevel) { + entry := logger.newEntry() + entry.Fatalln(args...) + logger.releaseEntry(entry) + } logger.Exit(1) } func (logger *Logger) Panicln(args ...interface{}) { - logger.Logln(PanicLevel, args...) + if logger.IsLevelEnabled(PanicLevel) { + entry := logger.newEntry() + entry.Panicln(args...) + logger.releaseEntry(entry) + } } func (logger *Logger) Exit(code int) { diff --git a/vendor/github.com/sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go index 8644761f..4ef45186 100644 --- a/vendor/github.com/sirupsen/logrus/logrus.go +++ b/vendor/github.com/sirupsen/logrus/logrus.go @@ -14,11 +14,24 @@ type Level uint32 // Convert the Level to a string. E.g. PanicLevel becomes "panic". func (level Level) String() string { - if b, err := level.MarshalText(); err == nil { - return string(b) - } else { - return "unknown" + switch level { + case TraceLevel: + return "trace" + case DebugLevel: + return "debug" + case InfoLevel: + return "info" + case WarnLevel: + return "warning" + case ErrorLevel: + return "error" + case FatalLevel: + return "fatal" + case PanicLevel: + return "panic" } + + return "unknown" } // ParseLevel takes a string level and returns the Logrus log level constant. @@ -56,27 +69,6 @@ func (level *Level) UnmarshalText(text []byte) error { return nil } -func (level Level) MarshalText() ([]byte, error) { - switch level { - case TraceLevel: - return []byte("trace"), nil - case DebugLevel: - return []byte("debug"), nil - case InfoLevel: - return []byte("info"), nil - case WarnLevel: - return []byte("warning"), nil - case ErrorLevel: - return []byte("error"), nil - case FatalLevel: - return []byte("fatal"), nil - case PanicLevel: - return []byte("panic"), nil - } - - return nil, fmt.Errorf("not a valid logrus level %d", level) -} - // A constant exposing all logging levels var AllLevels = []Level{ PanicLevel, diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go b/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go deleted file mode 100644 index 3c4f43f9..00000000 --- a/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build darwin dragonfly freebsd netbsd openbsd - -package logrus - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TIOCGETA - -func isTerminal(fd int) bool { - _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) - return err == nil -} - diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go b/vendor/github.com/sirupsen/logrus/terminal_check_js.go similarity index 79% rename from vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go rename to vendor/github.com/sirupsen/logrus/terminal_check_js.go index 97af92c6..0c209750 100644 --- a/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_js.go @@ -1,4 +1,4 @@ -// +build js nacl plan9 +// +build js package logrus diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go index 3293fb3c..cf309d6f 100644 --- a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go @@ -1,16 +1,18 @@ -// +build !appengine,!js,!windows,!nacl,!plan9 +// +build !appengine,!js,!windows package logrus import ( "io" "os" + + "golang.org/x/crypto/ssh/terminal" ) func checkIfTerminal(w io.Writer) bool { switch v := w.(type) { case *os.File: - return isTerminal(int(v.Fd())) + return terminal.IsTerminal(int(v.Fd())) default: return false } diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go b/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go deleted file mode 100644 index f6710b3b..00000000 --- a/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go +++ /dev/null @@ -1,11 +0,0 @@ -package logrus - -import ( - "golang.org/x/sys/unix" -) - -// IsTerminal returns true if the given file descriptor is a terminal. -func isTerminal(fd int) bool { - _, err := unix.IoctlGetTermio(fd, unix.TCGETA) - return err == nil -} diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_unix.go b/vendor/github.com/sirupsen/logrus/terminal_check_unix.go deleted file mode 100644 index 355dc966..00000000 --- a/vendor/github.com/sirupsen/logrus/terminal_check_unix.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build linux aix - -package logrus - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TCGETS - -func isTerminal(fd int) bool { - _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) - return err == nil -} - diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_windows.go b/vendor/github.com/sirupsen/logrus/terminal_check_windows.go index 572889db..3b9d2864 100644 --- a/vendor/github.com/sirupsen/logrus/terminal_check_windows.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_windows.go @@ -6,29 +6,15 @@ import ( "io" "os" "syscall" - - sequences "github.com/konsorten/go-windows-terminal-sequences" ) -func initTerminal(w io.Writer) { - switch v := w.(type) { - case *os.File: - sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true) - } -} - func checkIfTerminal(w io.Writer) bool { - var ret bool switch v := w.(type) { case *os.File: var mode uint32 err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode) - ret = (err == nil) + return err == nil default: - ret = false + return false } - if ret { - initTerminal(w) - } - return ret } diff --git a/vendor/github.com/sirupsen/logrus/terminal_notwindows.go b/vendor/github.com/sirupsen/logrus/terminal_notwindows.go new file mode 100644 index 00000000..3dbd2372 --- /dev/null +++ b/vendor/github.com/sirupsen/logrus/terminal_notwindows.go @@ -0,0 +1,8 @@ +// +build !windows + +package logrus + +import "io" + +func initTerminal(w io.Writer) { +} diff --git a/vendor/github.com/sirupsen/logrus/terminal_windows.go b/vendor/github.com/sirupsen/logrus/terminal_windows.go new file mode 100644 index 00000000..b4ef5286 --- /dev/null +++ b/vendor/github.com/sirupsen/logrus/terminal_windows.go @@ -0,0 +1,18 @@ +// +build !appengine,!js,windows + +package logrus + +import ( + "io" + "os" + "syscall" + + sequences "github.com/konsorten/go-windows-terminal-sequences" +) + +func initTerminal(w io.Writer) { + switch v := w.(type) { + case *os.File: + sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true) + } +} diff --git a/vendor/github.com/sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go index e01587c4..49ec92f1 100644 --- a/vendor/github.com/sirupsen/logrus/text_formatter.go +++ b/vendor/github.com/sirupsen/logrus/text_formatter.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "os" - "runtime" "sort" "strings" "sync" @@ -12,13 +11,18 @@ import ( ) const ( - red = 31 - yellow = 33 - blue = 36 - gray = 37 + nocolor = 0 + red = 31 + green = 32 + yellow = 33 + blue = 36 + gray = 37 ) -var baseTimestamp time.Time +var ( + baseTimestamp time.Time + emptyFieldMap FieldMap +) func init() { baseTimestamp = time.Now() @@ -72,23 +76,21 @@ type TextFormatter struct { // FieldKeyMsg: "@message"}} FieldMap FieldMap - // CallerPrettyfier can be set by the user to modify the content - // of the function and file keys in the data when ReportCaller is - // activated. If any of the returned value is the empty string the - // corresponding key will be removed from fields. - CallerPrettyfier func(*runtime.Frame) (function string, file string) - terminalInitOnce sync.Once } func (f *TextFormatter) init(entry *Entry) { if entry.Logger != nil { f.isTerminal = checkIfTerminal(entry.Logger.Out) + + if f.isTerminal { + initTerminal(entry.Logger.Out) + } } } func (f *TextFormatter) isColored() bool { - isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows")) + isColored := f.ForceColors || f.isTerminal if f.EnvironmentOverrideColors { if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" { @@ -105,19 +107,14 @@ func (f *TextFormatter) isColored() bool { // Format renders a single log entry func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { - data := make(Fields) - for k, v := range entry.Data { - data[k] = v - } - prefixFieldClashes(data, f.FieldMap, entry.HasCaller()) - keys := make([]string, 0, len(data)) - for k := range data { + prefixFieldClashes(entry.Data, f.FieldMap, entry.HasCaller()) + + keys := make([]string, 0, len(entry.Data)) + for k := range entry.Data { keys = append(keys, k) } - var funcVal, fileVal string - - fixedKeys := make([]string, 0, 4+len(data)) + fixedKeys := make([]string, 0, 4+len(entry.Data)) if !f.DisableTimestamp { fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyTime)) } @@ -129,19 +126,8 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyLogrusError)) } if entry.HasCaller() { - if f.CallerPrettyfier != nil { - funcVal, fileVal = f.CallerPrettyfier(entry.Caller) - } else { - funcVal = entry.Caller.Function - fileVal = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) - } - - if funcVal != "" { - fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFunc)) - } - if fileVal != "" { - fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFile)) - } + fixedKeys = append(fixedKeys, + f.FieldMap.resolve(FieldKeyFunc), f.FieldMap.resolve(FieldKeyFile)) } if !f.DisableSorting { @@ -174,9 +160,8 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { timestampFormat = defaultTimestampFormat } if f.isColored() { - f.printColored(b, entry, keys, data, timestampFormat) + f.printColored(b, entry, keys, timestampFormat) } else { - for _, key := range fixedKeys { var value interface{} switch { @@ -189,11 +174,11 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { case key == f.FieldMap.resolve(FieldKeyLogrusError): value = entry.err case key == f.FieldMap.resolve(FieldKeyFunc) && entry.HasCaller(): - value = funcVal + value = entry.Caller.Function case key == f.FieldMap.resolve(FieldKeyFile) && entry.HasCaller(): - value = fileVal + value = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) default: - value = data[key] + value = entry.Data[key] } f.appendKeyValue(b, key, value) } @@ -203,7 +188,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { return b.Bytes(), nil } -func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, data Fields, timestampFormat string) { +func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { var levelColor int switch entry.Level { case DebugLevel, TraceLevel: @@ -226,21 +211,10 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin entry.Message = strings.TrimSuffix(entry.Message, "\n") caller := "" + if entry.HasCaller() { - funcVal := fmt.Sprintf("%s()", entry.Caller.Function) - fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line) - - if f.CallerPrettyfier != nil { - funcVal, fileVal = f.CallerPrettyfier(entry.Caller) - } - - if fileVal == "" { - caller = funcVal - } else if funcVal == "" { - caller = fileVal - } else { - caller = fileVal + " " + funcVal - } + caller = fmt.Sprintf("%s:%d %s()", + entry.Caller.File, entry.Caller.Line, entry.Caller.Function) } if f.DisableTimestamp { @@ -251,7 +225,7 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message) } for _, k := range keys { - v := data[k] + v := entry.Data[k] fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) f.appendValue(b, v) } diff --git a/vendor/github.com/spacemonkeygo/openssl/.gitignore b/vendor/github.com/spacemonkeygo/openssl/.gitignore deleted file mode 100644 index 805d350b..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -openssl.test diff --git a/vendor/github.com/spacemonkeygo/openssl/AUTHORS b/vendor/github.com/spacemonkeygo/openssl/AUTHORS deleted file mode 100644 index a048c1ea..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/AUTHORS +++ /dev/null @@ -1,24 +0,0 @@ -Andrew Brampton -Anton Baklanov -Carlos Martín Nieto -Charles Strahan -Christopher Dudley -Christopher Fredericks -Colin Misare -dequis -Gabriel Russell -Giulio -Jakob Unterwurzacher -Juuso Haavisto -kujenga -Phus Lu -Russ Egan -Ryan Hileman -Scott J. Goldman -Scott Kidder -Space Monkey, Inc -Stephen Gallagher -Viacheslav Biriukov -Zack Owens -Ramesh Rayaprolu -Paras Shah diff --git a/vendor/github.com/spacemonkeygo/openssl/LICENSE b/vendor/github.com/spacemonkeygo/openssl/LICENSE deleted file mode 100644 index 37ec93a1..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/spacemonkeygo/openssl/README.md b/vendor/github.com/spacemonkeygo/openssl/README.md deleted file mode 100644 index 854df05a..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# OpenSSL bindings for Go - -Please see http://godoc.org/github.com/spacemonkeygo/openssl for more info - -### License - -Copyright (C) 2017. See AUTHORS. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -### Using on macOS -1. Install [homebrew](http://brew.sh/) -2. `$ brew install openssl` or `$ brew install openssl@1.1` - -### Using on Windows -1. Install [mingw-w64](http://mingw-w64.sourceforge.net/) -2. Install [pkg-config-lite](http://sourceforge.net/projects/pkgconfiglite) -3. Build (or install precompiled) openssl for mingw32-w64 -4. Set __PKG\_CONFIG\_PATH__ to the directory containing openssl.pc - (i.e. c:\mingw64\mingw64\lib\pkgconfig) diff --git a/vendor/github.com/spacemonkeygo/openssl/bio.go b/vendor/github.com/spacemonkeygo/openssl/bio.go deleted file mode 100644 index 9fe32aa8..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/bio.go +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "io" - "reflect" - "sync" - "unsafe" -) - -const ( - SSLRecordSize = 16 * 1024 -) - -func nonCopyGoBytes(ptr uintptr, length int) []byte { - var slice []byte - header := (*reflect.SliceHeader)(unsafe.Pointer(&slice)) - header.Cap = length - header.Len = length - header.Data = ptr - return slice -} - -func nonCopyCString(data *C.char, size C.int) []byte { - return nonCopyGoBytes(uintptr(unsafe.Pointer(data)), int(size)) -} - -var writeBioMapping = newMapping() - -type writeBio struct { - data_mtx sync.Mutex - op_mtx sync.Mutex - buf []byte - release_buffers bool -} - -func loadWritePtr(b *C.BIO) *writeBio { - t := token(C.X_BIO_get_data(b)) - return (*writeBio)(writeBioMapping.Get(t)) -} - -func bioClearRetryFlags(b *C.BIO) { - C.X_BIO_clear_flags(b, C.BIO_FLAGS_RWS|C.BIO_FLAGS_SHOULD_RETRY) -} - -func bioSetRetryRead(b *C.BIO) { - C.X_BIO_set_flags(b, C.BIO_FLAGS_READ|C.BIO_FLAGS_SHOULD_RETRY) -} - -//export go_write_bio_write -func go_write_bio_write(b *C.BIO, data *C.char, size C.int) (rc C.int) { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: writeBioWrite panic'd: %v", err) - rc = -1 - } - }() - ptr := loadWritePtr(b) - if ptr == nil || data == nil || size < 0 { - return -1 - } - ptr.data_mtx.Lock() - defer ptr.data_mtx.Unlock() - bioClearRetryFlags(b) - ptr.buf = append(ptr.buf, nonCopyCString(data, size)...) - return size -} - -//export go_write_bio_ctrl -func go_write_bio_ctrl(b *C.BIO, cmd C.int, arg1 C.long, arg2 unsafe.Pointer) ( - rc C.long) { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: writeBioCtrl panic'd: %v", err) - rc = -1 - } - }() - switch cmd { - case C.BIO_CTRL_WPENDING: - return writeBioPending(b) - case C.BIO_CTRL_DUP, C.BIO_CTRL_FLUSH: - return 1 - default: - return 0 - } -} - -func writeBioPending(b *C.BIO) C.long { - ptr := loadWritePtr(b) - if ptr == nil { - return 0 - } - ptr.data_mtx.Lock() - defer ptr.data_mtx.Unlock() - return C.long(len(ptr.buf)) -} - -func (b *writeBio) WriteTo(w io.Writer) (rv int64, err error) { - b.op_mtx.Lock() - defer b.op_mtx.Unlock() - - // write whatever data we currently have - b.data_mtx.Lock() - data := b.buf - b.data_mtx.Unlock() - - if len(data) == 0 { - return 0, nil - } - n, err := w.Write(data) - - // subtract however much data we wrote from the buffer - b.data_mtx.Lock() - b.buf = b.buf[:copy(b.buf, b.buf[n:])] - if b.release_buffers && len(b.buf) == 0 { - b.buf = nil - } - b.data_mtx.Unlock() - - return int64(n), err -} - -func (self *writeBio) Disconnect(b *C.BIO) { - if loadWritePtr(b) == self { - writeBioMapping.Del(token(C.X_BIO_get_data(b))) - C.X_BIO_set_data(b, nil) - } -} - -func (b *writeBio) MakeCBIO() *C.BIO { - rv := C.X_BIO_new_write_bio() - token := writeBioMapping.Add(unsafe.Pointer(b)) - C.X_BIO_set_data(rv, unsafe.Pointer(token)) - return rv -} - -var readBioMapping = newMapping() - -type readBio struct { - data_mtx sync.Mutex - op_mtx sync.Mutex - buf []byte - eof bool - release_buffers bool -} - -func loadReadPtr(b *C.BIO) *readBio { - return (*readBio)(readBioMapping.Get(token(C.X_BIO_get_data(b)))) -} - -//export go_read_bio_read -func go_read_bio_read(b *C.BIO, data *C.char, size C.int) (rc C.int) { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: go_read_bio_read panic'd: %v", err) - rc = -1 - } - }() - ptr := loadReadPtr(b) - if ptr == nil || size < 0 { - return -1 - } - ptr.data_mtx.Lock() - defer ptr.data_mtx.Unlock() - bioClearRetryFlags(b) - if len(ptr.buf) == 0 { - if ptr.eof { - return 0 - } - bioSetRetryRead(b) - return -1 - } - if size == 0 || data == nil { - return C.int(len(ptr.buf)) - } - n := copy(nonCopyCString(data, size), ptr.buf) - ptr.buf = ptr.buf[:copy(ptr.buf, ptr.buf[n:])] - if ptr.release_buffers && len(ptr.buf) == 0 { - ptr.buf = nil - } - return C.int(n) -} - -//export go_read_bio_ctrl -func go_read_bio_ctrl(b *C.BIO, cmd C.int, arg1 C.long, arg2 unsafe.Pointer) ( - rc C.long) { - - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: readBioCtrl panic'd: %v", err) - rc = -1 - } - }() - switch cmd { - case C.BIO_CTRL_PENDING: - return readBioPending(b) - case C.BIO_CTRL_DUP, C.BIO_CTRL_FLUSH: - return 1 - default: - return 0 - } -} - -func readBioPending(b *C.BIO) C.long { - ptr := loadReadPtr(b) - if ptr == nil { - return 0 - } - ptr.data_mtx.Lock() - defer ptr.data_mtx.Unlock() - return C.long(len(ptr.buf)) -} - -func (b *readBio) ReadFromOnce(r io.Reader) (n int, err error) { - b.op_mtx.Lock() - defer b.op_mtx.Unlock() - - // make sure we have a destination that fits at least one SSL record - b.data_mtx.Lock() - if cap(b.buf) < len(b.buf)+SSLRecordSize { - new_buf := make([]byte, len(b.buf), len(b.buf)+SSLRecordSize) - copy(new_buf, b.buf) - b.buf = new_buf - } - dst := b.buf[len(b.buf):cap(b.buf)] - dst_slice := b.buf - b.data_mtx.Unlock() - - n, err = r.Read(dst) - b.data_mtx.Lock() - defer b.data_mtx.Unlock() - if n > 0 { - if len(dst_slice) != len(b.buf) { - // someone shrunk the buffer, so we read in too far ahead and we - // need to slide backwards - copy(b.buf[len(b.buf):len(b.buf)+n], dst) - } - b.buf = b.buf[:len(b.buf)+n] - } - return n, err -} - -func (b *readBio) MakeCBIO() *C.BIO { - rv := C.X_BIO_new_read_bio() - token := readBioMapping.Add(unsafe.Pointer(b)) - C.X_BIO_set_data(rv, unsafe.Pointer(token)) - return rv -} - -func (self *readBio) Disconnect(b *C.BIO) { - if loadReadPtr(b) == self { - readBioMapping.Del(token(C.X_BIO_get_data(b))) - C.X_BIO_set_data(b, nil) - } -} - -func (b *readBio) MarkEOF() { - b.data_mtx.Lock() - defer b.data_mtx.Unlock() - b.eof = true -} - -type anyBio C.BIO - -func asAnyBio(b *C.BIO) *anyBio { return (*anyBio)(b) } - -func (b *anyBio) Read(buf []byte) (n int, err error) { - if len(buf) == 0 { - return 0, nil - } - n = int(C.X_BIO_read((*C.BIO)(b), unsafe.Pointer(&buf[0]), C.int(len(buf)))) - if n <= 0 { - return 0, io.EOF - } - return n, nil -} - -func (b *anyBio) Write(buf []byte) (written int, err error) { - if len(buf) == 0 { - return 0, nil - } - n := int(C.X_BIO_write((*C.BIO)(b), unsafe.Pointer(&buf[0]), - C.int(len(buf)))) - if n != len(buf) { - return n, errors.New("BIO write failed") - } - return n, nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/build.go b/vendor/github.com/spacemonkeygo/openssl/build.go deleted file mode 100644 index 5fccc021..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/build.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !openssl_static - -package openssl - -// #cgo linux windows pkg-config: libssl libcrypto -// #cgo linux CFLAGS: -Wno-deprecated-declarations -// #cgo darwin CFLAGS: -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl/include -Wno-deprecated-declarations -// #cgo darwin LDFLAGS: -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto -// #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN -import "C" diff --git a/vendor/github.com/spacemonkeygo/openssl/build_static.go b/vendor/github.com/spacemonkeygo/openssl/build_static.go deleted file mode 100644 index c84427bc..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/build_static.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build openssl_static - -package openssl - -// #cgo linux windows pkg-config: --static libssl libcrypto -// #cgo linux CFLAGS: -Wno-deprecated-declarations -// #cgo darwin CFLAGS: -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl/include -Wno-deprecated-declarations -// #cgo darwin LDFLAGS: -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto -// #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN -import "C" diff --git a/vendor/github.com/spacemonkeygo/openssl/cert.go b/vendor/github.com/spacemonkeygo/openssl/cert.go deleted file mode 100644 index e841e22c..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/cert.go +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "io/ioutil" - "math/big" - "runtime" - "time" - "unsafe" -) - -type EVP_MD int - -const ( - EVP_NULL EVP_MD = iota - EVP_MD5 EVP_MD = iota - EVP_MD4 EVP_MD = iota - EVP_SHA EVP_MD = iota - EVP_SHA1 EVP_MD = iota - EVP_DSS EVP_MD = iota - EVP_DSS1 EVP_MD = iota - EVP_MDC2 EVP_MD = iota - EVP_RIPEMD160 EVP_MD = iota - EVP_SHA224 EVP_MD = iota - EVP_SHA256 EVP_MD = iota - EVP_SHA384 EVP_MD = iota - EVP_SHA512 EVP_MD = iota -) - -// X509_Version represents a version on an x509 certificate. -type X509_Version int - -// Specify constants for x509 versions because the standard states that they -// are represented internally as one lower than the common version name. -const ( - X509_V1 X509_Version = 0 - X509_V3 X509_Version = 2 -) - -type Certificate struct { - x *C.X509 - Issuer *Certificate - ref interface{} - pubKey PublicKey -} - -type CertificateInfo struct { - Serial *big.Int - Issued time.Duration - Expires time.Duration - Country string - Organization string - CommonName string -} - -type Name struct { - name *C.X509_NAME -} - -// Allocate and return a new Name object. -func NewName() (*Name, error) { - n := C.X509_NAME_new() - if n == nil { - return nil, errors.New("could not create x509 name") - } - name := &Name{name: n} - runtime.SetFinalizer(name, func(n *Name) { - C.X509_NAME_free(n.name) - }) - return name, nil -} - -// AddTextEntry appends a text entry to an X509 NAME. -func (n *Name) AddTextEntry(field, value string) error { - cfield := C.CString(field) - defer C.free(unsafe.Pointer(cfield)) - cvalue := (*C.uchar)(unsafe.Pointer(C.CString(value))) - defer C.free(unsafe.Pointer(cvalue)) - ret := C.X509_NAME_add_entry_by_txt( - n.name, cfield, C.MBSTRING_ASC, cvalue, -1, -1, 0) - if ret != 1 { - return errors.New("failed to add x509 name text entry") - } - return nil -} - -// AddTextEntries allows adding multiple entries to a name in one call. -func (n *Name) AddTextEntries(entries map[string]string) error { - for f, v := range entries { - if err := n.AddTextEntry(f, v); err != nil { - return err - } - } - return nil -} - -// GetEntry returns a name entry based on NID. If no entry, then ("", false) is -// returned. -func (n *Name) GetEntry(nid NID) (entry string, ok bool) { - entrylen := C.X509_NAME_get_text_by_NID(n.name, C.int(nid), nil, 0) - if entrylen == -1 { - return "", false - } - buf := (*C.char)(C.malloc(C.size_t(entrylen + 1))) - defer C.free(unsafe.Pointer(buf)) - C.X509_NAME_get_text_by_NID(n.name, C.int(nid), buf, entrylen+1) - return C.GoStringN(buf, entrylen), true -} - -// NewCertificate generates a basic certificate based -// on the provided CertificateInfo struct -func NewCertificate(info *CertificateInfo, key PublicKey) (*Certificate, error) { - c := &Certificate{x: C.X509_new()} - runtime.SetFinalizer(c, func(c *Certificate) { - C.X509_free(c.x) - }) - - name, err := c.GetSubjectName() - if err != nil { - return nil, err - } - err = name.AddTextEntries(map[string]string{ - "C": info.Country, - "O": info.Organization, - "CN": info.CommonName, - }) - if err != nil { - return nil, err - } - // self-issue for now - if err := c.SetIssuerName(name); err != nil { - return nil, err - } - if err := c.SetSerial(info.Serial); err != nil { - return nil, err - } - if err := c.SetIssueDate(info.Issued); err != nil { - return nil, err - } - if err := c.SetExpireDate(info.Expires); err != nil { - return nil, err - } - if err := c.SetPubKey(key); err != nil { - return nil, err - } - return c, nil -} - -func (c *Certificate) GetSubjectName() (*Name, error) { - n := C.X509_get_subject_name(c.x) - if n == nil { - return nil, errors.New("failed to get subject name") - } - return &Name{name: n}, nil -} - -func (c *Certificate) GetIssuerName() (*Name, error) { - n := C.X509_get_issuer_name(c.x) - if n == nil { - return nil, errors.New("failed to get issuer name") - } - return &Name{name: n}, nil -} - -func (c *Certificate) SetSubjectName(name *Name) error { - if C.X509_set_subject_name(c.x, name.name) != 1 { - return errors.New("failed to set subject name") - } - return nil -} - -// SetIssuer updates the stored Issuer cert -// and the internal x509 Issuer Name of a certificate. -// The stored Issuer reference is used when adding extensions. -func (c *Certificate) SetIssuer(issuer *Certificate) error { - name, err := issuer.GetSubjectName() - if err != nil { - return err - } - if err = c.SetIssuerName(name); err != nil { - return err - } - c.Issuer = issuer - return nil -} - -// SetIssuerName populates the issuer name of a certificate. -// Use SetIssuer instead, if possible. -func (c *Certificate) SetIssuerName(name *Name) error { - if C.X509_set_issuer_name(c.x, name.name) != 1 { - return errors.New("failed to set subject name") - } - return nil -} - -// SetSerial sets the serial of a certificate. -func (c *Certificate) SetSerial(serial *big.Int) error { - sno := C.ASN1_INTEGER_new() - defer C.ASN1_INTEGER_free(sno) - bn := C.BN_new() - defer C.BN_free(bn) - - serialBytes := serial.Bytes() - if bn = C.BN_bin2bn((*C.uchar)(unsafe.Pointer(&serialBytes[0])), C.int(len(serialBytes)), bn); bn == nil { - return errors.New("failed to set serial") - } - if sno = C.BN_to_ASN1_INTEGER(bn, sno); sno == nil { - return errors.New("failed to set serial") - } - if C.X509_set_serialNumber(c.x, sno) != 1 { - return errors.New("failed to set serial") - } - return nil -} - -// SetIssueDate sets the certificate issue date relative to the current time. -func (c *Certificate) SetIssueDate(when time.Duration) error { - offset := C.long(when / time.Second) - result := C.X509_gmtime_adj(C.X_X509_get0_notBefore(c.x), offset) - if result == nil { - return errors.New("failed to set issue date") - } - return nil -} - -// SetExpireDate sets the certificate issue date relative to the current time. -func (c *Certificate) SetExpireDate(when time.Duration) error { - offset := C.long(when / time.Second) - result := C.X509_gmtime_adj(C.X_X509_get0_notAfter(c.x), offset) - if result == nil { - return errors.New("failed to set expire date") - } - return nil -} - -// SetPubKey assigns a new public key to a certificate. -func (c *Certificate) SetPubKey(pubKey PublicKey) error { - c.pubKey = pubKey - if C.X509_set_pubkey(c.x, pubKey.evpPKey()) != 1 { - return errors.New("failed to set public key") - } - return nil -} - -// Sign a certificate using a private key and a digest name. -// Accepted digest names are 'sha256', 'sha384', and 'sha512'. -func (c *Certificate) Sign(privKey PrivateKey, digest EVP_MD) error { - switch digest { - case EVP_SHA256: - case EVP_SHA384: - case EVP_SHA512: - default: - return errors.New("Unsupported digest" + - "You're probably looking for 'EVP_SHA256' or 'EVP_SHA512'.") - } - return c.insecureSign(privKey, digest) -} - -func (c *Certificate) insecureSign(privKey PrivateKey, digest EVP_MD) error { - var md *C.EVP_MD = getDigestFunction(digest) - if C.X509_sign(c.x, privKey.evpPKey(), md) <= 0 { - return errors.New("failed to sign certificate") - } - return nil -} - -func getDigestFunction(digest EVP_MD) (md *C.EVP_MD) { - switch digest { - // please don't use these digest functions - case EVP_NULL: - md = C.X_EVP_md_null() - case EVP_MD5: - md = C.X_EVP_md5() - case EVP_SHA: - md = C.X_EVP_sha() - case EVP_SHA1: - md = C.X_EVP_sha1() - case EVP_DSS: - md = C.X_EVP_dss() - case EVP_DSS1: - md = C.X_EVP_dss1() - case EVP_RIPEMD160: - md = C.X_EVP_ripemd160() - case EVP_SHA224: - md = C.X_EVP_sha224() - // you actually want one of these - case EVP_SHA256: - md = C.X_EVP_sha256() - case EVP_SHA384: - md = C.X_EVP_sha384() - case EVP_SHA512: - md = C.X_EVP_sha512() - } - return md -} - -// Add an extension to a certificate. -// Extension constants are NID_* as found in openssl. -func (c *Certificate) AddExtension(nid NID, value string) error { - issuer := c - if c.Issuer != nil { - issuer = c.Issuer - } - var ctx C.X509V3_CTX - C.X509V3_set_ctx(&ctx, c.x, issuer.x, nil, nil, 0) - ex := C.X509V3_EXT_conf_nid(nil, &ctx, C.int(nid), C.CString(value)) - if ex == nil { - return errors.New("failed to create x509v3 extension") - } - defer C.X509_EXTENSION_free(ex) - if C.X509_add_ext(c.x, ex, -1) <= 0 { - return errors.New("failed to add x509v3 extension") - } - return nil -} - -// Wraps AddExtension using a map of NID to text extension. -// Will return without finishing if it encounters an error. -func (c *Certificate) AddExtensions(extensions map[NID]string) error { - for nid, value := range extensions { - if err := c.AddExtension(nid, value); err != nil { - return err - } - } - return nil -} - -// LoadCertificateFromPEM loads an X509 certificate from a PEM-encoded block. -func LoadCertificateFromPEM(pem_block []byte) (*Certificate, error) { - if len(pem_block) == 0 { - return nil, errors.New("empty pem block") - } - runtime.LockOSThread() - defer runtime.UnlockOSThread() - bio := C.BIO_new_mem_buf(unsafe.Pointer(&pem_block[0]), - C.int(len(pem_block))) - cert := C.PEM_read_bio_X509(bio, nil, nil, nil) - C.BIO_free(bio) - if cert == nil { - return nil, errorFromErrorQueue() - } - x := &Certificate{x: cert} - runtime.SetFinalizer(x, func(x *Certificate) { - C.X509_free(x.x) - }) - return x, nil -} - -// MarshalPEM converts the X509 certificate to PEM-encoded format -func (c *Certificate) MarshalPEM() (pem_block []byte, err error) { - bio := C.BIO_new(C.BIO_s_mem()) - if bio == nil { - return nil, errors.New("failed to allocate memory BIO") - } - defer C.BIO_free(bio) - if int(C.PEM_write_bio_X509(bio, c.x)) != 1 { - return nil, errors.New("failed dumping certificate") - } - return ioutil.ReadAll(asAnyBio(bio)) -} - -// PublicKey returns the public key embedded in the X509 certificate. -func (c *Certificate) PublicKey() (PublicKey, error) { - pkey := C.X509_get_pubkey(c.x) - if pkey == nil { - return nil, errors.New("no public key found") - } - key := &pKey{key: pkey} - runtime.SetFinalizer(key, func(key *pKey) { - C.EVP_PKEY_free(key.key) - }) - return key, nil -} - -// GetSerialNumberHex returns the certificate's serial number in hex format -func (c *Certificate) GetSerialNumberHex() (serial string) { - asn1_i := C.X509_get_serialNumber(c.x) - bignum := C.ASN1_INTEGER_to_BN(asn1_i, nil) - hex := C.BN_bn2hex(bignum) - serial = C.GoString(hex) - C.BN_free(bignum) - C.X_OPENSSL_free(unsafe.Pointer(hex)) - return -} - -// GetVersion returns the X509 version of the certificate. -func (c *Certificate) GetVersion() X509_Version { - return X509_Version(C.X_X509_get_version(c.x)) -} - -// SetVersion sets the X509 version of the certificate. -func (c *Certificate) SetVersion(version X509_Version) error { - cvers := C.long(version) - if C.X_X509_set_version(c.x, cvers) != 1 { - return errors.New("failed to set certificate version") - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/ciphers.go b/vendor/github.com/spacemonkeygo/openssl/ciphers.go deleted file mode 100644 index 509bf641..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/ciphers.go +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "fmt" - "runtime" - "unsafe" -) - -const ( - GCM_TAG_MAXLEN = 16 -) - -type CipherCtx interface { - Cipher() *Cipher - BlockSize() int - KeySize() int - IVSize() int -} - -type Cipher struct { - ptr *C.EVP_CIPHER -} - -func (c *Cipher) Nid() NID { - return NID(C.X_EVP_CIPHER_nid(c.ptr)) -} - -func (c *Cipher) ShortName() (string, error) { - return Nid2ShortName(c.Nid()) -} - -func (c *Cipher) BlockSize() int { - return int(C.X_EVP_CIPHER_block_size(c.ptr)) -} - -func (c *Cipher) KeySize() int { - return int(C.X_EVP_CIPHER_key_length(c.ptr)) -} - -func (c *Cipher) IVSize() int { - return int(C.X_EVP_CIPHER_iv_length(c.ptr)) -} - -func Nid2ShortName(nid NID) (string, error) { - sn := C.OBJ_nid2sn(C.int(nid)) - if sn == nil { - return "", fmt.Errorf("NID %d not found", nid) - } - return C.GoString(sn), nil -} - -func GetCipherByName(name string) (*Cipher, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - p := C.EVP_get_cipherbyname(cname) - if p == nil { - return nil, fmt.Errorf("Cipher %v not found", name) - } - // we can consider ciphers to use static mem; don't need to free - return &Cipher{ptr: p}, nil -} - -func GetCipherByNid(nid NID) (*Cipher, error) { - sn, err := Nid2ShortName(nid) - if err != nil { - return nil, err - } - return GetCipherByName(sn) -} - -type cipherCtx struct { - ctx *C.EVP_CIPHER_CTX -} - -func newCipherCtx() (*cipherCtx, error) { - cctx := C.EVP_CIPHER_CTX_new() - if cctx == nil { - return nil, errors.New("failed to allocate cipher context") - } - ctx := &cipherCtx{cctx} - runtime.SetFinalizer(ctx, func(ctx *cipherCtx) { - C.EVP_CIPHER_CTX_free(ctx.ctx) - }) - return ctx, nil -} - -func (ctx *cipherCtx) applyKeyAndIV(key, iv []byte) error { - var kptr, iptr *C.uchar - if key != nil { - if len(key) != ctx.KeySize() { - return fmt.Errorf("bad key size (%d bytes instead of %d)", - len(key), ctx.KeySize()) - } - kptr = (*C.uchar)(&key[0]) - } - if iv != nil { - if len(iv) != ctx.IVSize() { - return fmt.Errorf("bad IV size (%d bytes instead of %d)", - len(iv), ctx.IVSize()) - } - iptr = (*C.uchar)(&iv[0]) - } - if kptr != nil || iptr != nil { - var res C.int - if C.X_EVP_CIPHER_CTX_encrypting(ctx.ctx) != 0 { - res = C.EVP_EncryptInit_ex(ctx.ctx, nil, nil, kptr, iptr) - } else { - res = C.EVP_DecryptInit_ex(ctx.ctx, nil, nil, kptr, iptr) - } - if 1 != res { - return errors.New("failed to apply key/IV") - } - } - return nil -} - -func (ctx *cipherCtx) Cipher() *Cipher { - return &Cipher{ptr: C.X_EVP_CIPHER_CTX_cipher(ctx.ctx)} -} - -func (ctx *cipherCtx) BlockSize() int { - return int(C.X_EVP_CIPHER_CTX_block_size(ctx.ctx)) -} - -func (ctx *cipherCtx) KeySize() int { - return int(C.X_EVP_CIPHER_CTX_key_length(ctx.ctx)) -} - -func (ctx *cipherCtx) IVSize() int { - return int(C.X_EVP_CIPHER_CTX_iv_length(ctx.ctx)) -} - -func (ctx *cipherCtx) SetPadding(pad bool) { - if pad { - C.X_EVP_CIPHER_CTX_set_padding(ctx.ctx, 1) - } else { - C.X_EVP_CIPHER_CTX_set_padding(ctx.ctx, 0) - } -} - -func (ctx *cipherCtx) setCtrl(code, arg int) error { - res := C.EVP_CIPHER_CTX_ctrl(ctx.ctx, C.int(code), C.int(arg), nil) - if res != 1 { - return fmt.Errorf("failed to set code %d to %d [result %d]", - code, arg, res) - } - return nil -} - -func (ctx *cipherCtx) setCtrlBytes(code, arg int, value []byte) error { - res := C.EVP_CIPHER_CTX_ctrl(ctx.ctx, C.int(code), C.int(arg), - unsafe.Pointer(&value[0])) - if res != 1 { - return fmt.Errorf("failed to set code %d with arg %d to %x [result %d]", - code, arg, value, res) - } - return nil -} - -func (ctx *cipherCtx) getCtrlInt(code, arg int) (int, error) { - var returnVal C.int - res := C.EVP_CIPHER_CTX_ctrl(ctx.ctx, C.int(code), C.int(arg), - unsafe.Pointer(&returnVal)) - if res != 1 { - return 0, fmt.Errorf("failed to get code %d with arg %d [result %d]", - code, arg, res) - } - return int(returnVal), nil -} - -func (ctx *cipherCtx) getCtrlBytes(code, arg, expectsize int) ([]byte, error) { - returnVal := make([]byte, expectsize) - res := C.EVP_CIPHER_CTX_ctrl(ctx.ctx, C.int(code), C.int(arg), - unsafe.Pointer(&returnVal[0])) - if res != 1 { - return nil, fmt.Errorf("failed to get code %d with arg %d [result %d]", - code, arg, res) - } - return returnVal, nil -} - -type EncryptionCipherCtx interface { - CipherCtx - - // pass in plaintext, get back ciphertext. can be called - // multiple times as needed - EncryptUpdate(input []byte) ([]byte, error) - - // call after all plaintext has been passed in; may return - // additional ciphertext if needed to finish off a block - // or extra padding information - EncryptFinal() ([]byte, error) -} - -type DecryptionCipherCtx interface { - CipherCtx - - // pass in ciphertext, get back plaintext. can be called - // multiple times as needed - DecryptUpdate(input []byte) ([]byte, error) - - // call after all ciphertext has been passed in; may return - // additional plaintext if needed to finish off a block - DecryptFinal() ([]byte, error) -} - -type encryptionCipherCtx struct { - *cipherCtx -} - -type decryptionCipherCtx struct { - *cipherCtx -} - -func newEncryptionCipherCtx(c *Cipher, e *Engine, key, iv []byte) ( - *encryptionCipherCtx, error) { - if c == nil { - return nil, errors.New("null cipher not allowed") - } - ctx, err := newCipherCtx() - if err != nil { - return nil, err - } - var eptr *C.ENGINE - if e != nil { - eptr = e.e - } - if 1 != C.EVP_EncryptInit_ex(ctx.ctx, c.ptr, eptr, nil, nil) { - return nil, errors.New("failed to initialize cipher context") - } - err = ctx.applyKeyAndIV(key, iv) - if err != nil { - return nil, err - } - return &encryptionCipherCtx{cipherCtx: ctx}, nil -} - -func newDecryptionCipherCtx(c *Cipher, e *Engine, key, iv []byte) ( - *decryptionCipherCtx, error) { - if c == nil { - return nil, errors.New("null cipher not allowed") - } - ctx, err := newCipherCtx() - if err != nil { - return nil, err - } - var eptr *C.ENGINE - if e != nil { - eptr = e.e - } - if 1 != C.EVP_DecryptInit_ex(ctx.ctx, c.ptr, eptr, nil, nil) { - return nil, errors.New("failed to initialize cipher context") - } - err = ctx.applyKeyAndIV(key, iv) - if err != nil { - return nil, err - } - return &decryptionCipherCtx{cipherCtx: ctx}, nil -} - -func NewEncryptionCipherCtx(c *Cipher, e *Engine, key, iv []byte) ( - EncryptionCipherCtx, error) { - return newEncryptionCipherCtx(c, e, key, iv) -} - -func NewDecryptionCipherCtx(c *Cipher, e *Engine, key, iv []byte) ( - DecryptionCipherCtx, error) { - return newDecryptionCipherCtx(c, e, key, iv) -} - -func (ctx *encryptionCipherCtx) EncryptUpdate(input []byte) ([]byte, error) { - if len(input) == 0 { - return nil, nil - } - outbuf := make([]byte, len(input)+ctx.BlockSize()) - outlen := C.int(len(outbuf)) - res := C.EVP_EncryptUpdate(ctx.ctx, (*C.uchar)(&outbuf[0]), &outlen, - (*C.uchar)(&input[0]), C.int(len(input))) - if res != 1 { - return nil, fmt.Errorf("failed to encrypt [result %d]", res) - } - return outbuf[:outlen], nil -} - -func (ctx *decryptionCipherCtx) DecryptUpdate(input []byte) ([]byte, error) { - if len(input) == 0 { - return nil, nil - } - outbuf := make([]byte, len(input)+ctx.BlockSize()) - outlen := C.int(len(outbuf)) - res := C.EVP_DecryptUpdate(ctx.ctx, (*C.uchar)(&outbuf[0]), &outlen, - (*C.uchar)(&input[0]), C.int(len(input))) - if res != 1 { - return nil, fmt.Errorf("failed to decrypt [result %d]", res) - } - return outbuf[:outlen], nil -} - -func (ctx *encryptionCipherCtx) EncryptFinal() ([]byte, error) { - outbuf := make([]byte, ctx.BlockSize()) - var outlen C.int - if 1 != C.EVP_EncryptFinal_ex(ctx.ctx, (*C.uchar)(&outbuf[0]), &outlen) { - return nil, errors.New("encryption failed") - } - return outbuf[:outlen], nil -} - -func (ctx *decryptionCipherCtx) DecryptFinal() ([]byte, error) { - outbuf := make([]byte, ctx.BlockSize()) - var outlen C.int - if 1 != C.EVP_DecryptFinal_ex(ctx.ctx, (*C.uchar)(&outbuf[0]), &outlen) { - // this may mean the tag failed to verify- all previous plaintext - // returned must be considered faked and invalid - return nil, errors.New("decryption failed") - } - return outbuf[:outlen], nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/ciphers_gcm.go b/vendor/github.com/spacemonkeygo/openssl/ciphers_gcm.go deleted file mode 100644 index 7b08e0fd..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/ciphers_gcm.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include -import "C" - -import ( - "errors" - "fmt" -) - -type AuthenticatedEncryptionCipherCtx interface { - EncryptionCipherCtx - - // data passed in to ExtraData() is part of the final output; it is - // not encrypted itself, but is part of the authenticated data. when - // decrypting or authenticating, pass back with the decryption - // context's ExtraData() - ExtraData([]byte) error - - // use after finalizing encryption to get the authenticating tag - GetTag() ([]byte, error) -} - -type AuthenticatedDecryptionCipherCtx interface { - DecryptionCipherCtx - - // pass in any extra data that was added during encryption with the - // encryption context's ExtraData() - ExtraData([]byte) error - - // use before finalizing decryption to tell the library what the - // tag is expected to be - SetTag([]byte) error -} - -type authEncryptionCipherCtx struct { - *encryptionCipherCtx -} - -type authDecryptionCipherCtx struct { - *decryptionCipherCtx -} - -func getGCMCipher(blocksize int) (*Cipher, error) { - var cipherptr *C.EVP_CIPHER - switch blocksize { - case 256: - cipherptr = C.EVP_aes_256_gcm() - case 192: - cipherptr = C.EVP_aes_192_gcm() - case 128: - cipherptr = C.EVP_aes_128_gcm() - default: - return nil, fmt.Errorf("unknown block size %d", blocksize) - } - return &Cipher{ptr: cipherptr}, nil -} - -func NewGCMEncryptionCipherCtx(blocksize int, e *Engine, key, iv []byte) ( - AuthenticatedEncryptionCipherCtx, error) { - cipher, err := getGCMCipher(blocksize) - if err != nil { - return nil, err - } - ctx, err := newEncryptionCipherCtx(cipher, e, key, nil) - if err != nil { - return nil, err - } - if len(iv) > 0 { - err := ctx.setCtrl(C.EVP_CTRL_GCM_SET_IVLEN, len(iv)) - if err != nil { - return nil, fmt.Errorf("could not set IV len to %d: %s", - len(iv), err) - } - if 1 != C.EVP_EncryptInit_ex(ctx.ctx, nil, nil, nil, - (*C.uchar)(&iv[0])) { - return nil, errors.New("failed to apply IV") - } - } - return &authEncryptionCipherCtx{encryptionCipherCtx: ctx}, nil -} - -func NewGCMDecryptionCipherCtx(blocksize int, e *Engine, key, iv []byte) ( - AuthenticatedDecryptionCipherCtx, error) { - cipher, err := getGCMCipher(blocksize) - if err != nil { - return nil, err - } - ctx, err := newDecryptionCipherCtx(cipher, e, key, nil) - if err != nil { - return nil, err - } - if len(iv) > 0 { - err := ctx.setCtrl(C.EVP_CTRL_GCM_SET_IVLEN, len(iv)) - if err != nil { - return nil, fmt.Errorf("could not set IV len to %d: %s", - len(iv), err) - } - if 1 != C.EVP_DecryptInit_ex(ctx.ctx, nil, nil, nil, - (*C.uchar)(&iv[0])) { - return nil, errors.New("failed to apply IV") - } - } - return &authDecryptionCipherCtx{decryptionCipherCtx: ctx}, nil -} - -func (ctx *authEncryptionCipherCtx) ExtraData(aad []byte) error { - if aad == nil { - return nil - } - var outlen C.int - if 1 != C.EVP_EncryptUpdate(ctx.ctx, nil, &outlen, (*C.uchar)(&aad[0]), - C.int(len(aad))) { - return errors.New("failed to add additional authenticated data") - } - return nil -} - -func (ctx *authDecryptionCipherCtx) ExtraData(aad []byte) error { - if aad == nil { - return nil - } - var outlen C.int - if 1 != C.EVP_DecryptUpdate(ctx.ctx, nil, &outlen, (*C.uchar)(&aad[0]), - C.int(len(aad))) { - return errors.New("failed to add additional authenticated data") - } - return nil -} - -func (ctx *authEncryptionCipherCtx) GetTag() ([]byte, error) { - return ctx.getCtrlBytes(C.EVP_CTRL_GCM_GET_TAG, GCM_TAG_MAXLEN, - GCM_TAG_MAXLEN) -} - -func (ctx *authDecryptionCipherCtx) SetTag(tag []byte) error { - return ctx.setCtrlBytes(C.EVP_CTRL_GCM_SET_TAG, len(tag), tag) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/conn.go b/vendor/github.com/spacemonkeygo/openssl/conn.go deleted file mode 100644 index 964551cd..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/conn.go +++ /dev/null @@ -1,620 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "fmt" - "io" - "net" - "runtime" - "sync" - "time" - "unsafe" - - "github.com/spacemonkeygo/openssl/utils" -) - -var ( - zeroReturn = errors.New("zero return") - wantRead = errors.New("want read") - wantWrite = errors.New("want write") - tryAgain = errors.New("try again") -) - -type Conn struct { - *SSL - - conn net.Conn - ctx *Ctx // for gc - into_ssl *readBio - from_ssl *writeBio - is_shutdown bool - mtx sync.Mutex - want_read_future *utils.Future -} - -type VerifyResult int - -const ( - Ok VerifyResult = C.X509_V_OK - UnableToGetIssuerCert VerifyResult = C.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT - UnableToGetCrl VerifyResult = C.X509_V_ERR_UNABLE_TO_GET_CRL - UnableToDecryptCertSignature VerifyResult = C.X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE - UnableToDecryptCrlSignature VerifyResult = C.X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE - UnableToDecodeIssuerPublicKey VerifyResult = C.X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY - CertSignatureFailure VerifyResult = C.X509_V_ERR_CERT_SIGNATURE_FAILURE - CrlSignatureFailure VerifyResult = C.X509_V_ERR_CRL_SIGNATURE_FAILURE - CertNotYetValid VerifyResult = C.X509_V_ERR_CERT_NOT_YET_VALID - CertHasExpired VerifyResult = C.X509_V_ERR_CERT_HAS_EXPIRED - CrlNotYetValid VerifyResult = C.X509_V_ERR_CRL_NOT_YET_VALID - CrlHasExpired VerifyResult = C.X509_V_ERR_CRL_HAS_EXPIRED - ErrorInCertNotBeforeField VerifyResult = C.X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD - ErrorInCertNotAfterField VerifyResult = C.X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD - ErrorInCrlLastUpdateField VerifyResult = C.X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD - ErrorInCrlNextUpdateField VerifyResult = C.X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD - OutOfMem VerifyResult = C.X509_V_ERR_OUT_OF_MEM - DepthZeroSelfSignedCert VerifyResult = C.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT - SelfSignedCertInChain VerifyResult = C.X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN - UnableToGetIssuerCertLocally VerifyResult = C.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY - UnableToVerifyLeafSignature VerifyResult = C.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE - CertChainTooLong VerifyResult = C.X509_V_ERR_CERT_CHAIN_TOO_LONG - CertRevoked VerifyResult = C.X509_V_ERR_CERT_REVOKED - InvalidCa VerifyResult = C.X509_V_ERR_INVALID_CA - PathLengthExceeded VerifyResult = C.X509_V_ERR_PATH_LENGTH_EXCEEDED - InvalidPurpose VerifyResult = C.X509_V_ERR_INVALID_PURPOSE - CertUntrusted VerifyResult = C.X509_V_ERR_CERT_UNTRUSTED - CertRejected VerifyResult = C.X509_V_ERR_CERT_REJECTED - SubjectIssuerMismatch VerifyResult = C.X509_V_ERR_SUBJECT_ISSUER_MISMATCH - AkidSkidMismatch VerifyResult = C.X509_V_ERR_AKID_SKID_MISMATCH - AkidIssuerSerialMismatch VerifyResult = C.X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH - KeyusageNoCertsign VerifyResult = C.X509_V_ERR_KEYUSAGE_NO_CERTSIGN - UnableToGetCrlIssuer VerifyResult = C.X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER - UnhandledCriticalExtension VerifyResult = C.X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION - KeyusageNoCrlSign VerifyResult = C.X509_V_ERR_KEYUSAGE_NO_CRL_SIGN - UnhandledCriticalCrlExtension VerifyResult = C.X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION - InvalidNonCa VerifyResult = C.X509_V_ERR_INVALID_NON_CA - ProxyPathLengthExceeded VerifyResult = C.X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED - KeyusageNoDigitalSignature VerifyResult = C.X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE - ProxyCertificatesNotAllowed VerifyResult = C.X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED - InvalidExtension VerifyResult = C.X509_V_ERR_INVALID_EXTENSION - InvalidPolicyExtension VerifyResult = C.X509_V_ERR_INVALID_POLICY_EXTENSION - NoExplicitPolicy VerifyResult = C.X509_V_ERR_NO_EXPLICIT_POLICY - UnnestedResource VerifyResult = C.X509_V_ERR_UNNESTED_RESOURCE - ApplicationVerification VerifyResult = C.X509_V_ERR_APPLICATION_VERIFICATION -) - -func newSSL(ctx *C.SSL_CTX) (*C.SSL, error) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - ssl := C.SSL_new(ctx) - if ssl == nil { - return nil, errorFromErrorQueue() - } - return ssl, nil -} - -func newConn(conn net.Conn, ctx *Ctx) (*Conn, error) { - ssl, err := newSSL(ctx.ctx) - if err != nil { - return nil, err - } - - into_ssl := &readBio{} - from_ssl := &writeBio{} - - if ctx.GetMode()&ReleaseBuffers > 0 { - into_ssl.release_buffers = true - from_ssl.release_buffers = true - } - - into_ssl_cbio := into_ssl.MakeCBIO() - from_ssl_cbio := from_ssl.MakeCBIO() - if into_ssl_cbio == nil || from_ssl_cbio == nil { - // these frees are null safe - C.BIO_free(into_ssl_cbio) - C.BIO_free(from_ssl_cbio) - C.SSL_free(ssl) - return nil, errors.New("failed to allocate memory BIO") - } - - // the ssl object takes ownership of these objects now - C.SSL_set_bio(ssl, into_ssl_cbio, from_ssl_cbio) - - s := &SSL{ssl: ssl} - C.SSL_set_ex_data(s.ssl, get_ssl_idx(), unsafe.Pointer(s)) - - c := &Conn{ - SSL: s, - - conn: conn, - ctx: ctx, - into_ssl: into_ssl, - from_ssl: from_ssl} - runtime.SetFinalizer(c, func(c *Conn) { - c.into_ssl.Disconnect(into_ssl_cbio) - c.from_ssl.Disconnect(from_ssl_cbio) - C.SSL_free(c.ssl) - }) - return c, nil -} - -// Client wraps an existing stream connection and puts it in the connect state -// for any subsequent handshakes. -// -// IMPORTANT NOTE: if you use this method instead of Dial to construct an SSL -// connection, you are responsible for verifying the peer's hostname. -// Otherwise, you are vulnerable to MITM attacks. -// -// Client also does not set up SNI for you like Dial does. -// -// Client connections probably won't work for you unless you set a verify -// location or add some certs to the certificate store of the client context -// you're using. This library is not nice enough to use the system certificate -// store by default for you yet. -func Client(conn net.Conn, ctx *Ctx) (*Conn, error) { - c, err := newConn(conn, ctx) - if err != nil { - return nil, err - } - C.SSL_set_connect_state(c.ssl) - return c, nil -} - -// Server wraps an existing stream connection and puts it in the accept state -// for any subsequent handshakes. -func Server(conn net.Conn, ctx *Ctx) (*Conn, error) { - c, err := newConn(conn, ctx) - if err != nil { - return nil, err - } - C.SSL_set_accept_state(c.ssl) - return c, nil -} - -func (c *Conn) GetCtx() *Ctx { return c.ctx } - -func (c *Conn) CurrentCipher() (string, error) { - p := C.X_SSL_get_cipher_name(c.ssl) - if p == nil { - return "", errors.New("Session not established") - } - - return C.GoString(p), nil -} - -func (c *Conn) fillInputBuffer() error { - for { - n, err := c.into_ssl.ReadFromOnce(c.conn) - if n == 0 && err == nil { - continue - } - if err == io.EOF { - c.into_ssl.MarkEOF() - return c.Close() - } - return err - } -} - -func (c *Conn) flushOutputBuffer() error { - _, err := c.from_ssl.WriteTo(c.conn) - return err -} - -func (c *Conn) getErrorHandler(rv C.int, errno error) func() error { - errcode := C.SSL_get_error(c.ssl, rv) - switch errcode { - case C.SSL_ERROR_ZERO_RETURN: - return func() error { - c.Close() - return io.ErrUnexpectedEOF - } - case C.SSL_ERROR_WANT_READ: - go c.flushOutputBuffer() - if c.want_read_future != nil { - want_read_future := c.want_read_future - return func() error { - _, err := want_read_future.Get() - return err - } - } - c.want_read_future = utils.NewFuture() - want_read_future := c.want_read_future - return func() (err error) { - defer func() { - c.mtx.Lock() - c.want_read_future = nil - c.mtx.Unlock() - want_read_future.Set(nil, err) - }() - err = c.fillInputBuffer() - if err != nil { - return err - } - return tryAgain - } - case C.SSL_ERROR_WANT_WRITE: - return func() error { - err := c.flushOutputBuffer() - if err != nil { - return err - } - return tryAgain - } - case C.SSL_ERROR_SYSCALL: - var err error - if C.ERR_peek_error() == 0 { - switch rv { - case 0: - err = errors.New("protocol-violating EOF") - case -1: - err = errno - default: - err = errorFromErrorQueue() - } - } else { - err = errorFromErrorQueue() - } - return func() error { return err } - default: - err := errorFromErrorQueue() - return func() error { return err } - } -} - -func (c *Conn) handleError(errcb func() error) error { - if errcb != nil { - return errcb() - } - return nil -} - -func (c *Conn) handshake() func() error { - c.mtx.Lock() - defer c.mtx.Unlock() - if c.is_shutdown { - return func() error { return io.ErrUnexpectedEOF } - } - runtime.LockOSThread() - defer runtime.UnlockOSThread() - rv, errno := C.SSL_do_handshake(c.ssl) - if rv > 0 { - return nil - } - return c.getErrorHandler(rv, errno) -} - -// Handshake performs an SSL handshake. If a handshake is not manually -// triggered, it will run before the first I/O on the encrypted stream. -func (c *Conn) Handshake() error { - err := tryAgain - for err == tryAgain { - err = c.handleError(c.handshake()) - } - go c.flushOutputBuffer() - return err -} - -// PeerCertificate returns the Certificate of the peer with which you're -// communicating. Only valid after a handshake. -func (c *Conn) PeerCertificate() (*Certificate, error) { - c.mtx.Lock() - defer c.mtx.Unlock() - if c.is_shutdown { - return nil, errors.New("connection closed") - } - x := C.SSL_get_peer_certificate(c.ssl) - if x == nil { - return nil, errors.New("no peer certificate found") - } - cert := &Certificate{x: x} - runtime.SetFinalizer(cert, func(cert *Certificate) { - C.X509_free(cert.x) - }) - return cert, nil -} - -// loadCertificateStack loads up a stack of x509 certificates and returns them, -// handling memory ownership. -func (c *Conn) loadCertificateStack(sk *C.struct_stack_st_X509) ( - rv []*Certificate) { - - sk_num := int(C.X_sk_X509_num(sk)) - rv = make([]*Certificate, 0, sk_num) - for i := 0; i < sk_num; i++ { - x := C.X_sk_X509_value(sk, C.int(i)) - // ref holds on to the underlying connection memory so we don't need to - // worry about incrementing refcounts manually or freeing the X509 - rv = append(rv, &Certificate{x: x, ref: c}) - } - return rv -} - -// PeerCertificateChain returns the certificate chain of the peer. If called on -// the client side, the stack also contains the peer's certificate; if called -// on the server side, the peer's certificate must be obtained separately using -// PeerCertificate. -func (c *Conn) PeerCertificateChain() (rv []*Certificate, err error) { - c.mtx.Lock() - defer c.mtx.Unlock() - if c.is_shutdown { - return nil, errors.New("connection closed") - } - sk := C.SSL_get_peer_cert_chain(c.ssl) - if sk == nil { - return nil, errors.New("no peer certificates found") - } - return c.loadCertificateStack(sk), nil -} - -type ConnectionState struct { - Certificate *Certificate - CertificateError error - CertificateChain []*Certificate - CertificateChainError error - SessionReused bool -} - -func (c *Conn) ConnectionState() (rv ConnectionState) { - rv.Certificate, rv.CertificateError = c.PeerCertificate() - rv.CertificateChain, rv.CertificateChainError = c.PeerCertificateChain() - rv.SessionReused = c.SessionReused() - return -} - -func (c *Conn) shutdown() func() error { - c.mtx.Lock() - defer c.mtx.Unlock() - runtime.LockOSThread() - defer runtime.UnlockOSThread() - rv, errno := C.SSL_shutdown(c.ssl) - if rv > 0 { - return nil - } - if rv == 0 { - // The OpenSSL docs say that in this case, the shutdown is not - // finished, and we should call SSL_shutdown() a second time, if a - // bidirectional shutdown is going to be performed. Further, the - // output of SSL_get_error may be misleading, as an erroneous - // SSL_ERROR_SYSCALL may be flagged even though no error occurred. - // So, TODO: revisit bidrectional shutdown, possibly trying again. - // Note: some broken clients won't engage in bidirectional shutdown - // without tickling them to close by sending a TCP_FIN packet, or - // shutting down the write-side of the connection. - return nil - } else { - return c.getErrorHandler(rv, errno) - } -} - -func (c *Conn) shutdownLoop() error { - err := tryAgain - shutdown_tries := 0 - for err == tryAgain { - shutdown_tries = shutdown_tries + 1 - err = c.handleError(c.shutdown()) - if err == nil { - return c.flushOutputBuffer() - } - if err == tryAgain && shutdown_tries >= 2 { - return errors.New("shutdown requested a third time?") - } - } - if err == io.ErrUnexpectedEOF { - err = nil - } - return err -} - -// Close shuts down the SSL connection and closes the underlying wrapped -// connection. -func (c *Conn) Close() error { - c.mtx.Lock() - if c.is_shutdown { - c.mtx.Unlock() - return nil - } - c.is_shutdown = true - c.mtx.Unlock() - var errs utils.ErrorGroup - errs.Add(c.shutdownLoop()) - errs.Add(c.conn.Close()) - return errs.Finalize() -} - -func (c *Conn) read(b []byte) (int, func() error) { - if len(b) == 0 { - return 0, nil - } - c.mtx.Lock() - defer c.mtx.Unlock() - if c.is_shutdown { - return 0, func() error { return io.EOF } - } - runtime.LockOSThread() - defer runtime.UnlockOSThread() - rv, errno := C.SSL_read(c.ssl, unsafe.Pointer(&b[0]), C.int(len(b))) - if rv > 0 { - return int(rv), nil - } - return 0, c.getErrorHandler(rv, errno) -} - -// Read reads up to len(b) bytes into b. It returns the number of bytes read -// and an error if applicable. io.EOF is returned when the caller can expect -// to see no more data. -func (c *Conn) Read(b []byte) (n int, err error) { - if len(b) == 0 { - return 0, nil - } - err = tryAgain - for err == tryAgain { - n, errcb := c.read(b) - err = c.handleError(errcb) - if err == nil { - go c.flushOutputBuffer() - return n, nil - } - if err == io.ErrUnexpectedEOF { - err = io.EOF - } - } - return 0, err -} - -func (c *Conn) write(b []byte) (int, func() error) { - if len(b) == 0 { - return 0, nil - } - c.mtx.Lock() - defer c.mtx.Unlock() - if c.is_shutdown { - err := errors.New("connection closed") - return 0, func() error { return err } - } - runtime.LockOSThread() - defer runtime.UnlockOSThread() - rv, errno := C.SSL_write(c.ssl, unsafe.Pointer(&b[0]), C.int(len(b))) - if rv > 0 { - return int(rv), nil - } - return 0, c.getErrorHandler(rv, errno) -} - -// Write will encrypt the contents of b and write it to the underlying stream. -// Performance will be vastly improved if the size of b is a multiple of -// SSLRecordSize. -func (c *Conn) Write(b []byte) (written int, err error) { - if len(b) == 0 { - return 0, nil - } - err = tryAgain - for err == tryAgain { - n, errcb := c.write(b) - err = c.handleError(errcb) - if err == nil { - return n, c.flushOutputBuffer() - } - } - return 0, err -} - -// VerifyHostname pulls the PeerCertificate and calls VerifyHostname on the -// certificate. -func (c *Conn) VerifyHostname(host string) error { - cert, err := c.PeerCertificate() - if err != nil { - return err - } - return cert.VerifyHostname(host) -} - -// LocalAddr returns the underlying connection's local address -func (c *Conn) LocalAddr() net.Addr { - return c.conn.LocalAddr() -} - -// RemoteAddr returns the underlying connection's remote address -func (c *Conn) RemoteAddr() net.Addr { - return c.conn.RemoteAddr() -} - -// SetDeadline calls SetDeadline on the underlying connection. -func (c *Conn) SetDeadline(t time.Time) error { - return c.conn.SetDeadline(t) -} - -// SetReadDeadline calls SetReadDeadline on the underlying connection. -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.conn.SetReadDeadline(t) -} - -// SetWriteDeadline calls SetWriteDeadline on the underlying connection. -func (c *Conn) SetWriteDeadline(t time.Time) error { - return c.conn.SetWriteDeadline(t) -} - -func (c *Conn) UnderlyingConn() net.Conn { - return c.conn -} - -func (c *Conn) SetTlsExtHostName(name string) error { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - runtime.LockOSThread() - defer runtime.UnlockOSThread() - if C.X_SSL_set_tlsext_host_name(c.ssl, cname) == 0 { - return errorFromErrorQueue() - } - return nil -} - -func (c *Conn) VerifyResult() VerifyResult { - return VerifyResult(C.SSL_get_verify_result(c.ssl)) -} - -func (c *Conn) SessionReused() bool { - return C.X_SSL_session_reused(c.ssl) == 1 -} - -func (c *Conn) GetSession() ([]byte, error) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - // get1 increases the refcount of the session, so we have to free it. - session := (*C.SSL_SESSION)(C.SSL_get1_session(c.ssl)) - if session == nil { - return nil, errors.New("failed to get session") - } - defer C.SSL_SESSION_free(session) - - // get the size of the encoding - slen := C.i2d_SSL_SESSION(session, nil) - - buf := (*C.uchar)(C.malloc(C.size_t(slen))) - defer C.free(unsafe.Pointer(buf)) - - // this modifies the value of buf (seriously), so we have to pass in a temp - // var so that we can actually read the bytes from buf. - tmp := buf - slen2 := C.i2d_SSL_SESSION(session, &tmp) - if slen != slen2 { - return nil, errors.New("session had different lengths") - } - - return C.GoBytes(unsafe.Pointer(buf), slen), nil -} - -func (c *Conn) setSession(session []byte) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - ptr := (*C.uchar)(&session[0]) - s := C.d2i_SSL_SESSION(nil, &ptr, C.long(len(session))) - if s == nil { - return fmt.Errorf("unable to load session: %s", errorFromErrorQueue()) - } - defer C.SSL_SESSION_free(s) - - ret := C.SSL_set_session(c.ssl, s) - if ret != 1 { - return fmt.Errorf("unable to set session: %s", errorFromErrorQueue()) - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/ctx.go b/vendor/github.com/spacemonkeygo/openssl/ctx.go deleted file mode 100644 index 33befc40..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/ctx.go +++ /dev/null @@ -1,568 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "runtime" - "sync" - "time" - "unsafe" - - "github.com/spacemonkeygo/spacelog" -) - -var ( - ssl_ctx_idx = C.X_SSL_CTX_new_index() - - logger = spacelog.GetLogger() -) - -type Ctx struct { - ctx *C.SSL_CTX - cert *Certificate - chain []*Certificate - key PrivateKey - verify_cb VerifyCallback - sni_cb TLSExtServernameCallback - - ticket_store_mu sync.Mutex - ticket_store *TicketStore -} - -//export get_ssl_ctx_idx -func get_ssl_ctx_idx() C.int { - return ssl_ctx_idx -} - -func newCtx(method *C.SSL_METHOD) (*Ctx, error) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - ctx := C.SSL_CTX_new(method) - if ctx == nil { - return nil, errorFromErrorQueue() - } - c := &Ctx{ctx: ctx} - C.SSL_CTX_set_ex_data(ctx, get_ssl_ctx_idx(), unsafe.Pointer(c)) - runtime.SetFinalizer(c, func(c *Ctx) { - C.SSL_CTX_free(c.ctx) - }) - return c, nil -} - -type SSLVersion int - -const ( - SSLv3 SSLVersion = 0x02 // Vulnerable to "POODLE" attack. - TLSv1 SSLVersion = 0x03 - TLSv1_1 SSLVersion = 0x04 - TLSv1_2 SSLVersion = 0x05 - - // Make sure to disable SSLv2 and SSLv3 if you use this. SSLv3 is vulnerable - // to the "POODLE" attack, and SSLv2 is what, just don't even. - AnyVersion SSLVersion = 0x06 -) - -// NewCtxWithVersion creates an SSL context that is specific to the provided -// SSL version. See http://www.openssl.org/docs/ssl/SSL_CTX_new.html for more. -func NewCtxWithVersion(version SSLVersion) (*Ctx, error) { - var method *C.SSL_METHOD - switch version { - case SSLv3: - method = C.X_SSLv3_method() - case TLSv1: - method = C.X_TLSv1_method() - case TLSv1_1: - method = C.X_TLSv1_1_method() - case TLSv1_2: - method = C.X_TLSv1_2_method() - case AnyVersion: - method = C.X_SSLv23_method() - } - if method == nil { - return nil, errors.New("unknown ssl/tls version") - } - return newCtx(method) -} - -// NewCtx creates a context that supports any TLS version 1.0 and newer. -func NewCtx() (*Ctx, error) { - c, err := NewCtxWithVersion(AnyVersion) - if err == nil { - c.SetOptions(NoSSLv2 | NoSSLv3) - } - return c, err -} - -// NewCtxFromFiles calls NewCtx, loads the provided files, and configures the -// context to use them. -func NewCtxFromFiles(cert_file string, key_file string) (*Ctx, error) { - ctx, err := NewCtx() - if err != nil { - return nil, err - } - - cert_bytes, err := ioutil.ReadFile(cert_file) - if err != nil { - return nil, err - } - - certs := SplitPEM(cert_bytes) - if len(certs) == 0 { - return nil, fmt.Errorf("No PEM certificate found in '%s'", cert_file) - } - first, certs := certs[0], certs[1:] - cert, err := LoadCertificateFromPEM(first) - if err != nil { - return nil, err - } - - err = ctx.UseCertificate(cert) - if err != nil { - return nil, err - } - - for _, pem := range certs { - cert, err := LoadCertificateFromPEM(pem) - if err != nil { - return nil, err - } - err = ctx.AddChainCertificate(cert) - if err != nil { - return nil, err - } - } - - key_bytes, err := ioutil.ReadFile(key_file) - if err != nil { - return nil, err - } - - key, err := LoadPrivateKeyFromPEM(key_bytes) - if err != nil { - return nil, err - } - - err = ctx.UsePrivateKey(key) - if err != nil { - return nil, err - } - - return ctx, nil -} - -// EllipticCurve repesents the ASN.1 OID of an elliptic curve. -// see https://www.openssl.org/docs/apps/ecparam.html for a list of implemented curves. -type EllipticCurve int - -const ( - // P-256: X9.62/SECG curve over a 256 bit prime field - Prime256v1 EllipticCurve = C.NID_X9_62_prime256v1 - // P-384: NIST/SECG curve over a 384 bit prime field - Secp384r1 EllipticCurve = C.NID_secp384r1 - // P-521: NIST/SECG curve over a 521 bit prime field - Secp521r1 EllipticCurve = C.NID_secp521r1 -) - -// SetEllipticCurve sets the elliptic curve used by the SSL context to -// enable an ECDH cipher suite to be selected during the handshake. -func (c *Ctx) SetEllipticCurve(curve EllipticCurve) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - k := C.EC_KEY_new_by_curve_name(C.int(curve)) - if k == nil { - return errors.New("Unknown curve") - } - defer C.EC_KEY_free(k) - - if int(C.X_SSL_CTX_set_tmp_ecdh(c.ctx, k)) != 1 { - return errorFromErrorQueue() - } - - return nil -} - -// UseCertificate configures the context to present the given certificate to -// peers. -func (c *Ctx) UseCertificate(cert *Certificate) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - c.cert = cert - if int(C.SSL_CTX_use_certificate(c.ctx, cert.x)) != 1 { - return errorFromErrorQueue() - } - return nil -} - -// AddChainCertificate adds a certificate to the chain presented in the -// handshake. -func (c *Ctx) AddChainCertificate(cert *Certificate) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - c.chain = append(c.chain, cert) - if int(C.X_SSL_CTX_add_extra_chain_cert(c.ctx, cert.x)) != 1 { - return errorFromErrorQueue() - } - // OpenSSL takes ownership via SSL_CTX_add_extra_chain_cert - runtime.SetFinalizer(cert, nil) - return nil -} - -// UsePrivateKey configures the context to use the given private key for SSL -// handshakes. -func (c *Ctx) UsePrivateKey(key PrivateKey) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - c.key = key - if int(C.SSL_CTX_use_PrivateKey(c.ctx, key.evpPKey())) != 1 { - return errorFromErrorQueue() - } - return nil -} - -type CertificateStore struct { - store *C.X509_STORE - // for GC - ctx *Ctx - certs []*Certificate -} - -// Allocate a new, empty CertificateStore -func NewCertificateStore() (*CertificateStore, error) { - s := C.X509_STORE_new() - if s == nil { - return nil, errors.New("failed to allocate X509_STORE") - } - store := &CertificateStore{store: s} - runtime.SetFinalizer(store, func(s *CertificateStore) { - C.X509_STORE_free(s.store) - }) - return store, nil -} - -// Parse a chained PEM file, loading all certificates into the Store. -func (s *CertificateStore) LoadCertificatesFromPEM(data []byte) error { - pems := SplitPEM(data) - for _, pem := range pems { - cert, err := LoadCertificateFromPEM(pem) - if err != nil { - return err - } - err = s.AddCertificate(cert) - if err != nil { - return err - } - } - return nil -} - -// GetCertificateStore returns the context's certificate store that will be -// used for peer validation. -func (c *Ctx) GetCertificateStore() *CertificateStore { - // we don't need to dealloc the cert store pointer here, because it points - // to a ctx internal. so we do need to keep the ctx around - return &CertificateStore{ - store: C.SSL_CTX_get_cert_store(c.ctx), - ctx: c} -} - -// AddCertificate marks the provided Certificate as a trusted certificate in -// the given CertificateStore. -func (s *CertificateStore) AddCertificate(cert *Certificate) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - s.certs = append(s.certs, cert) - if int(C.X509_STORE_add_cert(s.store, cert.x)) != 1 { - return errorFromErrorQueue() - } - return nil -} - -type CertificateStoreCtx struct { - ctx *C.X509_STORE_CTX - ssl_ctx *Ctx -} - -func (self *CertificateStoreCtx) VerifyResult() VerifyResult { - return VerifyResult(C.X509_STORE_CTX_get_error(self.ctx)) -} - -func (self *CertificateStoreCtx) Err() error { - code := C.X509_STORE_CTX_get_error(self.ctx) - if code == C.X509_V_OK { - return nil - } - return fmt.Errorf("openssl: %s", - C.GoString(C.X509_verify_cert_error_string(C.long(code)))) -} - -func (self *CertificateStoreCtx) Depth() int { - return int(C.X509_STORE_CTX_get_error_depth(self.ctx)) -} - -// the certicate returned is only valid for the lifetime of the underlying -// X509_STORE_CTX -func (self *CertificateStoreCtx) GetCurrentCert() *Certificate { - x509 := C.X509_STORE_CTX_get_current_cert(self.ctx) - if x509 == nil { - return nil - } - // add a ref - if 1 != C.X_X509_add_ref(x509) { - return nil - } - cert := &Certificate{ - x: x509, - } - runtime.SetFinalizer(cert, func(cert *Certificate) { - C.X509_free(cert.x) - }) - return cert -} - -// LoadVerifyLocations tells the context to trust all certificate authorities -// provided in either the ca_file or the ca_path. -// See http://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html for -// more. -func (c *Ctx) LoadVerifyLocations(ca_file string, ca_path string) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - var c_ca_file, c_ca_path *C.char - if ca_file != "" { - c_ca_file = C.CString(ca_file) - defer C.free(unsafe.Pointer(c_ca_file)) - } - if ca_path != "" { - c_ca_path = C.CString(ca_path) - defer C.free(unsafe.Pointer(c_ca_path)) - } - if C.SSL_CTX_load_verify_locations(c.ctx, c_ca_file, c_ca_path) != 1 { - return errorFromErrorQueue() - } - return nil -} - -type Options int - -const ( - // NoCompression is only valid if you are using OpenSSL 1.0.1 or newer - NoCompression Options = C.SSL_OP_NO_COMPRESSION - NoSSLv2 Options = C.SSL_OP_NO_SSLv2 - NoSSLv3 Options = C.SSL_OP_NO_SSLv3 - NoTLSv1 Options = C.SSL_OP_NO_TLSv1 - CipherServerPreference Options = C.SSL_OP_CIPHER_SERVER_PREFERENCE - NoSessionResumptionOrRenegotiation Options = C.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION - NoTicket Options = C.SSL_OP_NO_TICKET -) - -// SetOptions sets context options. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_options.html -func (c *Ctx) SetOptions(options Options) Options { - return Options(C.X_SSL_CTX_set_options( - c.ctx, C.long(options))) -} - -func (c *Ctx) ClearOptions(options Options) Options { - return Options(C.X_SSL_CTX_clear_options( - c.ctx, C.long(options))) -} - -// GetOptions returns context options. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html -func (c *Ctx) GetOptions() Options { - return Options(C.X_SSL_CTX_get_options(c.ctx)) -} - -type Modes int - -const ( - // ReleaseBuffers is only valid if you are using OpenSSL 1.0.1 or newer - ReleaseBuffers Modes = C.SSL_MODE_RELEASE_BUFFERS -) - -// SetMode sets context modes. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html -func (c *Ctx) SetMode(modes Modes) Modes { - return Modes(C.X_SSL_CTX_set_mode(c.ctx, C.long(modes))) -} - -// GetMode returns context modes. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html -func (c *Ctx) GetMode() Modes { - return Modes(C.X_SSL_CTX_get_mode(c.ctx)) -} - -type VerifyOptions int - -const ( - VerifyNone VerifyOptions = C.SSL_VERIFY_NONE - VerifyPeer VerifyOptions = C.SSL_VERIFY_PEER - VerifyFailIfNoPeerCert VerifyOptions = C.SSL_VERIFY_FAIL_IF_NO_PEER_CERT - VerifyClientOnce VerifyOptions = C.SSL_VERIFY_CLIENT_ONCE -) - -type VerifyCallback func(ok bool, store *CertificateStoreCtx) bool - -//export go_ssl_ctx_verify_cb_thunk -func go_ssl_ctx_verify_cb_thunk(p unsafe.Pointer, ok C.int, ctx *C.X509_STORE_CTX) C.int { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: verify callback panic'd: %v", err) - os.Exit(1) - } - }() - verify_cb := (*Ctx)(p).verify_cb - // set up defaults just in case verify_cb is nil - if verify_cb != nil { - store := &CertificateStoreCtx{ctx: ctx} - if verify_cb(ok == 1, store) { - ok = 1 - } else { - ok = 0 - } - } - return ok -} - -// SetVerify controls peer verification settings. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (c *Ctx) SetVerify(options VerifyOptions, verify_cb VerifyCallback) { - c.verify_cb = verify_cb - if verify_cb != nil { - C.SSL_CTX_set_verify(c.ctx, C.int(options), (*[0]byte)(C.X_SSL_CTX_verify_cb)) - } else { - C.SSL_CTX_set_verify(c.ctx, C.int(options), nil) - } -} - -func (c *Ctx) SetVerifyMode(options VerifyOptions) { - c.SetVerify(options, c.verify_cb) -} - -func (c *Ctx) SetVerifyCallback(verify_cb VerifyCallback) { - c.SetVerify(c.VerifyMode(), verify_cb) -} - -func (c *Ctx) GetVerifyCallback() VerifyCallback { - return c.verify_cb -} - -func (c *Ctx) VerifyMode() VerifyOptions { - return VerifyOptions(C.SSL_CTX_get_verify_mode(c.ctx)) -} - -// SetVerifyDepth controls how many certificates deep the certificate -// verification logic is willing to follow a certificate chain. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (c *Ctx) SetVerifyDepth(depth int) { - C.SSL_CTX_set_verify_depth(c.ctx, C.int(depth)) -} - -// GetVerifyDepth controls how many certificates deep the certificate -// verification logic is willing to follow a certificate chain. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (c *Ctx) GetVerifyDepth() int { - return int(C.SSL_CTX_get_verify_depth(c.ctx)) -} - -type TLSExtServernameCallback func(ssl *SSL) SSLTLSExtErr - -// SetTLSExtServernameCallback sets callback function for Server Name Indication -// (SNI) rfc6066 (http://tools.ietf.org/html/rfc6066). See -// http://stackoverflow.com/questions/22373332/serving-multiple-domains-in-one-box-with-sni -func (c *Ctx) SetTLSExtServernameCallback(sni_cb TLSExtServernameCallback) { - c.sni_cb = sni_cb - C.X_SSL_CTX_set_tlsext_servername_callback(c.ctx, (*[0]byte)(C.sni_cb)) -} - -func (c *Ctx) SetSessionId(session_id []byte) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - var ptr *C.uchar - if len(session_id) > 0 { - ptr = (*C.uchar)(unsafe.Pointer(&session_id[0])) - } - if int(C.SSL_CTX_set_session_id_context(c.ctx, ptr, - C.uint(len(session_id)))) == 0 { - return errorFromErrorQueue() - } - return nil -} - -// SetCipherList sets the list of available ciphers. The format of the list is -// described at http://www.openssl.org/docs/apps/ciphers.html, but see -// http://www.openssl.org/docs/ssl/SSL_CTX_set_cipher_list.html for more. -func (c *Ctx) SetCipherList(list string) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - clist := C.CString(list) - defer C.free(unsafe.Pointer(clist)) - if int(C.SSL_CTX_set_cipher_list(c.ctx, clist)) == 0 { - return errorFromErrorQueue() - } - return nil -} - -type SessionCacheModes int - -const ( - SessionCacheOff SessionCacheModes = C.SSL_SESS_CACHE_OFF - SessionCacheClient SessionCacheModes = C.SSL_SESS_CACHE_CLIENT - SessionCacheServer SessionCacheModes = C.SSL_SESS_CACHE_SERVER - SessionCacheBoth SessionCacheModes = C.SSL_SESS_CACHE_BOTH - NoAutoClear SessionCacheModes = C.SSL_SESS_CACHE_NO_AUTO_CLEAR - NoInternalLookup SessionCacheModes = C.SSL_SESS_CACHE_NO_INTERNAL_LOOKUP - NoInternalStore SessionCacheModes = C.SSL_SESS_CACHE_NO_INTERNAL_STORE - NoInternal SessionCacheModes = C.SSL_SESS_CACHE_NO_INTERNAL -) - -// SetSessionCacheMode enables or disables session caching. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_session_cache_mode.html -func (c *Ctx) SetSessionCacheMode(modes SessionCacheModes) SessionCacheModes { - return SessionCacheModes( - C.X_SSL_CTX_set_session_cache_mode(c.ctx, C.long(modes))) -} - -// Set session cache timeout. Returns previously set value. -// See https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html -func (c *Ctx) SetTimeout(t time.Duration) time.Duration { - prev := C.X_SSL_CTX_set_timeout(c.ctx, C.long(t/time.Second)) - return time.Duration(prev) * time.Second -} - -// Get session cache timeout. -// See https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html -func (c *Ctx) GetTimeout() time.Duration { - return time.Duration(C.X_SSL_CTX_get_timeout(c.ctx)) * time.Second -} - -// Set session cache size. Returns previously set value. -// https://www.openssl.org/docs/ssl/SSL_CTX_sess_set_cache_size.html -func (c *Ctx) SessSetCacheSize(t int) int { - return int(C.X_SSL_CTX_sess_set_cache_size(c.ctx, C.long(t))) -} - -// Get session cache size. -// https://www.openssl.org/docs/ssl/SSL_CTX_sess_set_cache_size.html -func (c *Ctx) SessGetCacheSize() int { - return int(C.X_SSL_CTX_sess_get_cache_size(c.ctx)) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/dh.go b/vendor/github.com/spacemonkeygo/openssl/dh.go deleted file mode 100644 index 75ac5ad4..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/dh.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" -import ( - "errors" - "unsafe" -) - -// DeriveSharedSecret derives a shared secret using a private key and a peer's -// public key. -// The specific algorithm that is used depends on the types of the -// keys, but it is most commonly a variant of Diffie-Hellman. -func DeriveSharedSecret(private PrivateKey, public PublicKey) ([]byte, error) { - // Create context for the shared secret derivation - dhCtx := C.EVP_PKEY_CTX_new(private.evpPKey(), nil) - if dhCtx == nil { - return nil, errors.New("failed creating shared secret derivation context") - } - defer C.EVP_PKEY_CTX_free(dhCtx) - - // Initialize the context - if int(C.EVP_PKEY_derive_init(dhCtx)) != 1 { - return nil, errors.New("failed initializing shared secret derivation context") - } - - // Provide the peer's public key - if int(C.EVP_PKEY_derive_set_peer(dhCtx, public.evpPKey())) != 1 { - return nil, errors.New("failed adding peer public key to context") - } - - // Determine how large of a buffer we need for the shared secret - var buffLen C.size_t - if int(C.EVP_PKEY_derive(dhCtx, nil, &buffLen)) != 1 { - return nil, errors.New("failed determining shared secret length") - } - - // Allocate a buffer - buffer := C.X_OPENSSL_malloc(buffLen) - if buffer == nil { - return nil, errors.New("failed allocating buffer for shared secret") - } - defer C.X_OPENSSL_free(buffer) - - // Derive the shared secret - if int(C.EVP_PKEY_derive(dhCtx, (*C.uchar)(buffer), &buffLen)) != 1 { - return nil, errors.New("failed deriving the shared secret") - } - - secret := C.GoBytes(unsafe.Pointer(buffer), C.int(buffLen)) - return secret, nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/dhparam.go b/vendor/github.com/spacemonkeygo/openssl/dhparam.go deleted file mode 100644 index 294d0645..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/dhparam.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type DH struct { - dh *C.struct_dh_st -} - -// LoadDHParametersFromPEM loads the Diffie-Hellman parameters from -// a PEM-encoded block. -func LoadDHParametersFromPEM(pem_block []byte) (*DH, error) { - if len(pem_block) == 0 { - return nil, errors.New("empty pem block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&pem_block[0]), - C.int(len(pem_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - - params := C.PEM_read_bio_DHparams(bio, nil, nil, nil) - if params == nil { - return nil, errors.New("failed reading dh parameters") - } - dhparams := &DH{dh: params} - runtime.SetFinalizer(dhparams, func(dhparams *DH) { - C.DH_free(dhparams.dh) - }) - return dhparams, nil -} - -// SetDHParameters sets the DH group (DH parameters) used to -// negotiate an emphemeral DH key during handshaking. -func (c *Ctx) SetDHParameters(dh *DH) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - if int(C.X_SSL_CTX_set_tmp_dh(c.ctx, dh.dh)) != 1 { - return errorFromErrorQueue() - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/digest.go b/vendor/github.com/spacemonkeygo/openssl/digest.go deleted file mode 100644 index 6d8d2635..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/digest.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "fmt" - "unsafe" -) - -// Digest represents and openssl message digest. -type Digest struct { - ptr *C.EVP_MD -} - -// GetDigestByName returns the Digest with the name or nil and an error if the -// digest was not found. -func GetDigestByName(name string) (*Digest, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - p := C.X_EVP_get_digestbyname(cname) - if p == nil { - return nil, fmt.Errorf("Digest %v not found", name) - } - // we can consider digests to use static mem; don't need to free - return &Digest{ptr: p}, nil -} - -// GetDigestByName returns the Digest with the NID or nil and an error if the -// digest was not found. -func GetDigestByNid(nid NID) (*Digest, error) { - sn, err := Nid2ShortName(nid) - if err != nil { - return nil, err - } - return GetDigestByName(sn) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/engine.go b/vendor/github.com/spacemonkeygo/openssl/engine.go deleted file mode 100644 index 78aef956..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/engine.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -/* -#include "openssl/engine.h" -*/ -import "C" - -import ( - "fmt" - "runtime" - "unsafe" -) - -type Engine struct { - e *C.ENGINE -} - -func EngineById(name string) (*Engine, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - e := &Engine{ - e: C.ENGINE_by_id(cname), - } - if e.e == nil { - return nil, fmt.Errorf("engine %s missing", name) - } - if C.ENGINE_init(e.e) == 0 { - C.ENGINE_free(e.e) - return nil, fmt.Errorf("engine %s not initialized", name) - } - runtime.SetFinalizer(e, func(e *Engine) { - C.ENGINE_finish(e.e) - C.ENGINE_free(e.e) - }) - return e, nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/fips.go b/vendor/github.com/spacemonkeygo/openssl/fips.go deleted file mode 100644 index f65e14d3..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/fips.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -/* -#include -*/ -import "C" -import "runtime" - -// FIPSModeSet enables a FIPS 140-2 validated mode of operation. -// https://wiki.openssl.org/index.php/FIPS_mode_set() -func FIPSModeSet(mode bool) error { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - var r C.int - if mode { - r = C.FIPS_mode_set(1) - } else { - r = C.FIPS_mode_set(0) - } - if r != 1 { - return errorFromErrorQueue() - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/go.mod b/vendor/github.com/spacemonkeygo/openssl/go.mod deleted file mode 100644 index 73f3bbfe..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/spacemonkeygo/openssl - -require github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 diff --git a/vendor/github.com/spacemonkeygo/openssl/go.sum b/vendor/github.com/spacemonkeygo/openssl/go.sum deleted file mode 100644 index 1b0ecc56..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= diff --git a/vendor/github.com/spacemonkeygo/openssl/hmac.go b/vendor/github.com/spacemonkeygo/openssl/hmac.go deleted file mode 100644 index a8640cfa..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/hmac.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type HMAC struct { - ctx *C.HMAC_CTX - engine *Engine - md *C.EVP_MD -} - -func NewHMAC(key []byte, digestAlgorithm EVP_MD) (*HMAC, error) { - return NewHMACWithEngine(key, digestAlgorithm, nil) -} - -func NewHMACWithEngine(key []byte, digestAlgorithm EVP_MD, e *Engine) (*HMAC, error) { - var md *C.EVP_MD = getDigestFunction(digestAlgorithm) - h := &HMAC{engine: e, md: md} - h.ctx = C.X_HMAC_CTX_new() - if h.ctx == nil { - return nil, errors.New("unable to allocate HMAC_CTX") - } - - var c_e *C.ENGINE - if e != nil { - c_e = e.e - } - if rc := C.X_HMAC_Init_ex(h.ctx, - unsafe.Pointer(&key[0]), - C.int(len(key)), - md, - c_e); rc != 1 { - C.X_HMAC_CTX_free(h.ctx) - return nil, errors.New("failed to initialize HMAC_CTX") - } - - runtime.SetFinalizer(h, func(h *HMAC) { h.Close() }) - return h, nil -} - -func (h *HMAC) Close() { - C.X_HMAC_CTX_free(h.ctx) -} - -func (h *HMAC) Write(data []byte) (n int, err error) { - if len(data) == 0 { - return 0, nil - } - if rc := C.X_HMAC_Update(h.ctx, (*C.uchar)(unsafe.Pointer(&data[0])), - C.size_t(len(data))); rc != 1 { - return 0, errors.New("failed to update HMAC") - } - return len(data), nil -} - -func (h *HMAC) Reset() error { - if 1 != C.X_HMAC_Init_ex(h.ctx, nil, 0, nil, nil) { - return errors.New("failed to reset HMAC_CTX") - } - return nil -} - -func (h *HMAC) Final() (result []byte, err error) { - mdLength := C.X_EVP_MD_size(h.md) - result = make([]byte, mdLength) - if rc := C.X_HMAC_Final(h.ctx, (*C.uchar)(unsafe.Pointer(&result[0])), - (*C.uint)(unsafe.Pointer(&mdLength))); rc != 1 { - return nil, errors.New("failed to finalized HMAC") - } - return result, h.Reset() -} diff --git a/vendor/github.com/spacemonkeygo/openssl/hostname.c b/vendor/github.com/spacemonkeygo/openssl/hostname.c deleted file mode 100644 index 0bffecad..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/hostname.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Go-OpenSSL notice: - * This file is required for all OpenSSL versions prior to 1.1.0. This simply - * provides the new 1.1.0 X509_check_* methods for hostname validation if they - * don't already exist. - */ - -#include - -#ifndef X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT - -/* portions from x509v3.h and v3_utl.c */ -/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL - * project. - */ -/* ==================================================================== - * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ -/* X509 v3 extension utilities */ - -#include -#include -#include -#include -#include - -#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -#define X509_CHECK_FLAG_NO_WILDCARDS 0x2 - -typedef int (*equal_fn)(const unsigned char *pattern, size_t pattern_len, - const unsigned char *subject, size_t subject_len); - -/* Compare while ASCII ignoring case. */ -static int equal_nocase(const unsigned char *pattern, size_t pattern_len, - const unsigned char *subject, size_t subject_len) - { - if (pattern_len != subject_len) - return 0; - while (pattern_len) - { - unsigned char l = *pattern; - unsigned char r = *subject; - /* The pattern must not contain NUL characters. */ - if (l == 0) - return 0; - if (l != r) - { - if ('A' <= l && l <= 'Z') - l = (l - 'A') + 'a'; - if ('A' <= r && r <= 'Z') - r = (r - 'A') + 'a'; - if (l != r) - return 0; - } - ++pattern; - ++subject; - --pattern_len; - } - return 1; - } - -/* Compare using memcmp. */ -static int equal_case(const unsigned char *pattern, size_t pattern_len, - const unsigned char *subject, size_t subject_len) -{ - /* The pattern must not contain NUL characters. */ - if (memchr(pattern, '\0', pattern_len) != NULL) - return 0; - if (pattern_len != subject_len) - return 0; - return !memcmp(pattern, subject, pattern_len); -} - -/* RFC 5280, section 7.5, requires that only the domain is compared in - a case-insensitive manner. */ -static int equal_email(const unsigned char *a, size_t a_len, - const unsigned char *b, size_t b_len) - { - size_t i = a_len; - if (a_len != b_len) - return 0; - /* We search backwards for the '@' character, so that we do - not have to deal with quoted local-parts. The domain part - is compared in a case-insensitive manner. */ - while (i > 0) - { - --i; - if (a[i] == '@' || b[i] == '@') - { - if (!equal_nocase(a + i, a_len - i, - b + i, a_len - i)) - return 0; - break; - } - } - if (i == 0) - i = a_len; - return equal_case(a, i, b, i); - } - -/* Compare the prefix and suffix with the subject, and check that the - characters in-between are valid. */ -static int wildcard_match(const unsigned char *prefix, size_t prefix_len, - const unsigned char *suffix, size_t suffix_len, - const unsigned char *subject, size_t subject_len) - { - const unsigned char *wildcard_start; - const unsigned char *wildcard_end; - const unsigned char *p; - if (subject_len < prefix_len + suffix_len) - return 0; - if (!equal_nocase(prefix, prefix_len, subject, prefix_len)) - return 0; - wildcard_start = subject + prefix_len; - wildcard_end = subject + (subject_len - suffix_len); - if (!equal_nocase(wildcard_end, suffix_len, suffix, suffix_len)) - return 0; - /* The wildcard must match at least one character. */ - if (wildcard_start == wildcard_end) - return 0; - /* Check that the part matched by the wildcard contains only - permitted characters and only matches a single label. */ - for (p = wildcard_start; p != wildcard_end; ++p) - if (!(('0' <= *p && *p <= '9') || - ('A' <= *p && *p <= 'Z') || - ('a' <= *p && *p <= 'z') || - *p == '-')) - return 0; - return 1; - } - -/* Checks if the memory region consistens of [0-9A-Za-z.-]. */ -static int valid_domain_characters(const unsigned char *p, size_t len) - { - while (len) - { - if (!(('0' <= *p && *p <= '9') || - ('A' <= *p && *p <= 'Z') || - ('a' <= *p && *p <= 'z') || - *p == '-' || *p == '.')) - return 0; - ++p; - --len; - } - return 1; - } - -/* Find the '*' in a wildcard pattern. If no such character is found - or the pattern is otherwise invalid, returns NULL. */ -static const unsigned char *wildcard_find_star(const unsigned char *pattern, - size_t pattern_len) - { - const unsigned char *star = memchr(pattern, '*', pattern_len); - size_t dot_count = 0; - const unsigned char *suffix_start; - size_t suffix_length; - if (star == NULL) - return NULL; - suffix_start = star + 1; - suffix_length = (pattern + pattern_len) - (star + 1); - if (!(valid_domain_characters(pattern, star - pattern) && - valid_domain_characters(suffix_start, suffix_length))) - return NULL; - /* Check that the suffix matches at least two labels. */ - while (suffix_length) - { - if (*suffix_start == '.') - ++dot_count; - ++suffix_start; - --suffix_length; - } - if (dot_count < 2) - return NULL; - return star; - } - -/* Compare using wildcards. */ -static int equal_wildcard(const unsigned char *pattern, size_t pattern_len, - const unsigned char *subject, size_t subject_len) - { - const unsigned char *star = wildcard_find_star(pattern, pattern_len); - if (star == NULL) - return equal_nocase(pattern, pattern_len, - subject, subject_len); - return wildcard_match(pattern, star - pattern, - star + 1, (pattern + pattern_len) - star - 1, - subject, subject_len); - } - -/* Compare an ASN1_STRING to a supplied string. If they match - * return 1. If cmp_type > 0 only compare if string matches the - * type, otherwise convert it to UTF8. - */ - -static int do_check_string(ASN1_STRING *a, int cmp_type, equal_fn equal, - const unsigned char *b, size_t blen) - { - if (!a->data || !a->length) - return 0; - if (cmp_type > 0) - { - if (cmp_type != a->type) - return 0; - if (cmp_type == V_ASN1_IA5STRING) - return equal(a->data, a->length, b, blen); - if (a->length == (int)blen && !memcmp(a->data, b, blen)) - return 1; - else - return 0; - } - else - { - int astrlen, rv; - unsigned char *astr; - astrlen = ASN1_STRING_to_UTF8(&astr, a); - if (astrlen < 0) - return -1; - rv = equal(astr, astrlen, b, blen); - OPENSSL_free(astr); - return rv; - } - } - -static int do_x509_check(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags, int check_type) - { - STACK_OF(GENERAL_NAME) *gens = NULL; - X509_NAME *name = NULL; - int i; - int cnid; - int alt_type; - equal_fn equal; - if (check_type == GEN_EMAIL) - { - cnid = NID_pkcs9_emailAddress; - alt_type = V_ASN1_IA5STRING; - equal = equal_email; - } - else if (check_type == GEN_DNS) - { - cnid = NID_commonName; - alt_type = V_ASN1_IA5STRING; - if (flags & X509_CHECK_FLAG_NO_WILDCARDS) - equal = equal_nocase; - else - equal = equal_wildcard; - } - else - { - cnid = 0; - alt_type = V_ASN1_OCTET_STRING; - equal = equal_case; - } - - if (chklen == 0) - chklen = strlen((const char *)chk); - - gens = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL); - if (gens) - { - int rv = 0; - for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) - { - GENERAL_NAME *gen; - ASN1_STRING *cstr; - gen = sk_GENERAL_NAME_value(gens, i); - if(gen->type != check_type) - continue; - if (check_type == GEN_EMAIL) - cstr = gen->d.rfc822Name; - else if (check_type == GEN_DNS) - cstr = gen->d.dNSName; - else - cstr = gen->d.iPAddress; - if (do_check_string(cstr, alt_type, equal, chk, chklen)) - { - rv = 1; - break; - } - } - GENERAL_NAMES_free(gens); - if (rv) - return 1; - if (!(flags & X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT) || !cnid) - return 0; - } - i = -1; - name = X509_get_subject_name(x); - while((i = X509_NAME_get_index_by_NID(name, cnid, i)) >= 0) - { - X509_NAME_ENTRY *ne; - ASN1_STRING *str; - ne = X509_NAME_get_entry(name, i); - str = X509_NAME_ENTRY_get_data(ne); - if (do_check_string(str, -1, equal, chk, chklen)) - return 1; - } - return 0; - } - -#if OPENSSL_VERSION_NUMBER < 0x1000200fL - -int X509_check_host(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags, char **peername) - { - return do_x509_check(x, chk, chklen, flags, GEN_DNS); - } - -int X509_check_email(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags) - { - return do_x509_check(x, chk, chklen, flags, GEN_EMAIL); - } - -int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags) - { - return do_x509_check(x, chk, chklen, flags, GEN_IPADD); - } - -#endif /* OPENSSL_VERSION_NUMBER < 0x1000200fL */ - -#endif diff --git a/vendor/github.com/spacemonkeygo/openssl/hostname.go b/vendor/github.com/spacemonkeygo/openssl/hostname.go deleted file mode 100644 index c92d959e..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/hostname.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -/* -#include -#include -#include - -#ifndef X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT -#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -#define X509_CHECK_FLAG_NO_WILDCARDS 0x2 - -extern int X509_check_host(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags, char **peername); -extern int X509_check_email(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -extern int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -#endif -*/ -import "C" - -import ( - "errors" - "net" - "unsafe" -) - -var ( - ValidationError = errors.New("Host validation error") -) - -type CheckFlags int - -const ( - AlwaysCheckSubject CheckFlags = C.X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT - NoWildcards CheckFlags = C.X509_CHECK_FLAG_NO_WILDCARDS -) - -// CheckHost checks that the X509 certificate is signed for the provided -// host name. See http://www.openssl.org/docs/crypto/X509_check_host.html for -// more. Note that CheckHost does not check the IP field. See VerifyHostname. -// Specifically returns ValidationError if the Certificate didn't match but -// there was no internal error. -func (c *Certificate) CheckHost(host string, flags CheckFlags) error { - chost := unsafe.Pointer(C.CString(host)) - defer C.free(chost) - - rv := C.X509_check_host(c.x, (*C.uchar)(chost), C.size_t(len(host)), - C.uint(flags), nil) - if rv > 0 { - return nil - } - if rv == 0 { - return ValidationError - } - return errors.New("hostname validation had an internal failure") -} - -// CheckEmail checks that the X509 certificate is signed for the provided -// email address. See http://www.openssl.org/docs/crypto/X509_check_host.html -// for more. -// Specifically returns ValidationError if the Certificate didn't match but -// there was no internal error. -func (c *Certificate) CheckEmail(email string, flags CheckFlags) error { - cemail := unsafe.Pointer(C.CString(email)) - defer C.free(cemail) - rv := C.X509_check_email(c.x, (*C.uchar)(cemail), C.size_t(len(email)), - C.uint(flags)) - if rv > 0 { - return nil - } - if rv == 0 { - return ValidationError - } - return errors.New("email validation had an internal failure") -} - -// CheckIP checks that the X509 certificate is signed for the provided -// IP address. See http://www.openssl.org/docs/crypto/X509_check_host.html -// for more. -// Specifically returns ValidationError if the Certificate didn't match but -// there was no internal error. -func (c *Certificate) CheckIP(ip net.IP, flags CheckFlags) error { - // X509_check_ip will fail to validate the 16-byte representation of an IPv4 - // address, so convert to the 4-byte representation. - if ip4 := ip.To4(); ip4 != nil { - ip = ip4 - } - - cip := unsafe.Pointer(&ip[0]) - rv := C.X509_check_ip(c.x, (*C.uchar)(cip), C.size_t(len(ip)), - C.uint(flags)) - if rv > 0 { - return nil - } - if rv == 0 { - return ValidationError - } - return errors.New("ip validation had an internal failure") -} - -// VerifyHostname is a combination of CheckHost and CheckIP. If the provided -// hostname looks like an IP address, it will be checked as an IP address, -// otherwise it will be checked as a hostname. -// Specifically returns ValidationError if the Certificate didn't match but -// there was no internal error. -func (c *Certificate) VerifyHostname(host string) error { - var ip net.IP - if len(host) >= 3 && host[0] == '[' && host[len(host)-1] == ']' { - ip = net.ParseIP(host[1 : len(host)-1]) - } else { - ip = net.ParseIP(host) - } - if ip != nil { - return c.CheckIP(ip, 0) - } - return c.CheckHost(host, 0) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/http.go b/vendor/github.com/spacemonkeygo/openssl/http.go deleted file mode 100644 index 39bd5a28..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/http.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -import ( - "net/http" -) - -// ListenAndServeTLS will take an http.Handler and serve it using OpenSSL over -// the given tcp address, configured to use the provided cert and key files. -func ListenAndServeTLS(addr string, cert_file string, key_file string, - handler http.Handler) error { - return ServerListenAndServeTLS( - &http.Server{Addr: addr, Handler: handler}, cert_file, key_file) -} - -// ServerListenAndServeTLS will take an http.Server and serve it using OpenSSL -// configured to use the provided cert and key files. -func ServerListenAndServeTLS(srv *http.Server, - cert_file, key_file string) error { - addr := srv.Addr - if addr == "" { - addr = ":https" - } - - ctx, err := NewCtxFromFiles(cert_file, key_file) - if err != nil { - return err - } - - l, err := Listen("tcp", addr, ctx) - if err != nil { - return err - } - - return srv.Serve(l) -} - -// TODO: http client integration -// holy crap, getting this integrated nicely with the Go stdlib HTTP client -// stack so that it does proxying, connection pooling, and most importantly -// hostname verification is really hard. So much stuff is hardcoded to just use -// the built-in TLS lib. I think to get this to work either some crazy -// hacktackery beyond me, an almost straight up fork of the HTTP client, or -// serious stdlib internal refactoring is necessary. -// even more so, good luck getting openssl to use the operating system default -// root certificates if the user doesn't provide any. sadlol -// NOTE: if you're going to try and write your own round tripper, at least use -// openssl.Dial, or equivalent logic diff --git a/vendor/github.com/spacemonkeygo/openssl/init.go b/vendor/github.com/spacemonkeygo/openssl/init.go deleted file mode 100644 index 17dc6f38..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/init.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package openssl is a light wrapper around OpenSSL for Go. - -It strives to provide a near-drop-in replacement for the Go standard library -tls package, while allowing for: - -Performance - -OpenSSL is battle-tested and optimized C. While Go's built-in library shows -great promise, it is still young and in some places, inefficient. This simple -OpenSSL wrapper can often do at least 2x with the same cipher and protocol. - -On my lappytop, I get the following benchmarking speeds: - BenchmarkSHA1Large_openssl 1000 2611282 ns/op 401.56 MB/s - BenchmarkSHA1Large_stdlib 500 3963983 ns/op 264.53 MB/s - BenchmarkSHA1Small_openssl 1000000 3476 ns/op 0.29 MB/s - BenchmarkSHA1Small_stdlib 5000000 550 ns/op 1.82 MB/s - BenchmarkSHA256Large_openssl 200 8085314 ns/op 129.69 MB/s - BenchmarkSHA256Large_stdlib 100 18948189 ns/op 55.34 MB/s - BenchmarkSHA256Small_openssl 1000000 4262 ns/op 0.23 MB/s - BenchmarkSHA256Small_stdlib 1000000 1444 ns/op 0.69 MB/s - BenchmarkOpenSSLThroughput 100000 21634 ns/op 47.33 MB/s - BenchmarkStdlibThroughput 50000 58974 ns/op 17.36 MB/s - -Interoperability - -Many systems support OpenSSL with a variety of plugins and modules for things, -such as hardware acceleration in embedded devices. - -Greater flexibility and configuration - -OpenSSL allows for far greater configuration of corner cases and backwards -compatibility (such as support of SSLv2). You shouldn't be using SSLv2 if you -can help but, but sometimes you can't help it. - -Security - -Yeah yeah, Heartbleed. But according to the author of the standard library's -TLS implementation, Go's TLS library is vulnerable to timing attacks. And -whether or not OpenSSL received the appropriate amount of scrutiny -pre-Heartbleed, it sure is receiving it now. - -Usage - -Starting an HTTP server that uses OpenSSL is very easy. It's as simple as: - log.Fatal(openssl.ListenAndServeTLS( - ":8443", "my_server.crt", "my_server.key", myHandler)) - -Getting a net.Listener that uses OpenSSL is also easy: - ctx, err := openssl.NewCtxFromFiles("my_server.crt", "my_server.key") - if err != nil { - log.Fatal(err) - } - l, err := openssl.Listen("tcp", ":7777", ctx) - -Making a client connection is straightforward too: - ctx, err := NewCtx() - if err != nil { - log.Fatal(err) - } - err = ctx.LoadVerifyLocations("/etc/ssl/certs/ca-certificates.crt", "") - if err != nil { - log.Fatal(err) - } - conn, err := openssl.Dial("tcp", "localhost:7777", ctx, 0) - -Help wanted: To get this library to work with net/http's client, we -had to fork net/http. It would be nice if an alternate http client library -supported the generality needed to use OpenSSL instead of crypto/tls. -*/ -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "fmt" - "strings" -) - -func init() { - if rc := C.X_shim_init(); rc != 0 { - panic(fmt.Errorf("X_shim_init failed with %d", rc)) - } -} - -// errorFromErrorQueue needs to run in the same OS thread as the operation -// that caused the possible error -func errorFromErrorQueue() error { - var errs []string - for { - err := C.ERR_get_error() - if err == 0 { - break - } - errs = append(errs, fmt.Sprintf("%s:%s:%s", - C.GoString(C.ERR_lib_error_string(err)), - C.GoString(C.ERR_func_error_string(err)), - C.GoString(C.ERR_reason_error_string(err)))) - } - return errors.New(fmt.Sprintf("SSL errors: %s", strings.Join(errs, "\n"))) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/init_posix.go b/vendor/github.com/spacemonkeygo/openssl/init_posix.go deleted file mode 100644 index 2da7f957..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/init_posix.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build linux darwin solaris -// +build !windows - -package openssl - -/* -#include -#include -#include - -pthread_mutex_t* goopenssl_locks; - -int go_init_locks() { - int rc = 0; - int nlock; - int i; - int locks_needed = CRYPTO_num_locks(); - - goopenssl_locks = (pthread_mutex_t*)malloc( - sizeof(pthread_mutex_t) * locks_needed); - if (!goopenssl_locks) { - return ENOMEM; - } - for (nlock = 0; nlock < locks_needed; ++nlock) { - rc = pthread_mutex_init(&goopenssl_locks[nlock], NULL); - if (rc != 0) { - break; - } - } - - if (rc != 0) { - for (i = nlock - 1; i >= 0; --i) { - pthread_mutex_destroy(&goopenssl_locks[i]); - } - free(goopenssl_locks); - goopenssl_locks = NULL; - } - return rc; -} - -void go_thread_locking_callback(int mode, int n, const char *file, - int line) { - if (mode & CRYPTO_LOCK) { - pthread_mutex_lock(&goopenssl_locks[n]); - } else { - pthread_mutex_unlock(&goopenssl_locks[n]); - } -} - -unsigned long go_thread_id_callback(void) { - return (unsigned long)pthread_self(); -} -*/ -import "C" diff --git a/vendor/github.com/spacemonkeygo/openssl/init_windows.go b/vendor/github.com/spacemonkeygo/openssl/init_windows.go deleted file mode 100644 index 051133c3..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/init_windows.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build windows - -package openssl - -/* -#include -#include -#include - -CRITICAL_SECTION* goopenssl_locks; - -int go_init_locks() { - int rc = 0; - int nlock; - int i; - int locks_needed = CRYPTO_num_locks(); - - goopenssl_locks = (CRITICAL_SECTION*)malloc( - sizeof(*goopenssl_locks) * locks_needed); - if (!goopenssl_locks) { - return ENOMEM; - } - for (nlock = 0; nlock < locks_needed; ++nlock) { - InitializeCriticalSection(&goopenssl_locks[nlock]); - } - - return 0; -} - -void go_thread_locking_callback(int mode, int n, const char *file, - int line) { - if (mode & CRYPTO_LOCK) { - EnterCriticalSection(&goopenssl_locks[n]); - } else { - LeaveCriticalSection(&goopenssl_locks[n]); - } -} - -unsigned long go_thread_id_callback(void) { - return (unsigned long)GetCurrentThreadId(); -} -*/ -import "C" diff --git a/vendor/github.com/spacemonkeygo/openssl/key.go b/vendor/github.com/spacemonkeygo/openssl/key.go deleted file mode 100644 index 91ea98a7..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/key.go +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "io/ioutil" - "runtime" - "unsafe" -) - -var ( // some (effectively) constants for tests to refer to - ed25519_support = C.X_ED25519_SUPPORT != 0 -) - -type Method *C.EVP_MD - -var ( - SHA1_Method Method = C.X_EVP_sha1() - SHA256_Method Method = C.X_EVP_sha256() - SHA512_Method Method = C.X_EVP_sha512() -) - -// Constants for the various key types. -// Mapping of name -> NID taken from openssl/evp.h -const ( - KeyTypeNone = NID_undef - KeyTypeRSA = NID_rsaEncryption - KeyTypeRSA2 = NID_rsa - KeyTypeDSA = NID_dsa - KeyTypeDSA1 = NID_dsa_2 - KeyTypeDSA2 = NID_dsaWithSHA - KeyTypeDSA3 = NID_dsaWithSHA1 - KeyTypeDSA4 = NID_dsaWithSHA1_2 - KeyTypeDH = NID_dhKeyAgreement - KeyTypeDHX = NID_dhpublicnumber - KeyTypeEC = NID_X9_62_id_ecPublicKey - KeyTypeHMAC = NID_hmac - KeyTypeCMAC = NID_cmac - KeyTypeTLS1PRF = NID_tls1_prf - KeyTypeHKDF = NID_hkdf - KeyTypeX25519 = NID_X25519 - KeyTypeX448 = NID_X448 - KeyTypeED25519 = NID_ED25519 - KeyTypeED448 = NID_ED448 -) - -type PublicKey interface { - // Verifies the data signature using PKCS1.15 - VerifyPKCS1v15(method Method, data, sig []byte) error - - // MarshalPKIXPublicKeyPEM converts the public key to PEM-encoded PKIX - // format - MarshalPKIXPublicKeyPEM() (pem_block []byte, err error) - - // MarshalPKIXPublicKeyDER converts the public key to DER-encoded PKIX - // format - MarshalPKIXPublicKeyDER() (der_block []byte, err error) - - // KeyType returns an identifier for what kind of key is represented by this - // object. - KeyType() NID - - // BaseType returns an identifier for what kind of key is represented - // by this object. - // Keys that share same algorithm but use different legacy formats - // will have the same BaseType. - // - // For example, a key with a `KeyType() == KeyTypeRSA` and a key with a - // `KeyType() == KeyTypeRSA2` would both have `BaseType() == KeyTypeRSA`. - BaseType() NID - - evpPKey() *C.EVP_PKEY -} - -type PrivateKey interface { - PublicKey - - // Signs the data using PKCS1.15 - SignPKCS1v15(Method, []byte) ([]byte, error) - - // MarshalPKCS1PrivateKeyPEM converts the private key to PEM-encoded PKCS1 - // format - MarshalPKCS1PrivateKeyPEM() (pem_block []byte, err error) - - // MarshalPKCS1PrivateKeyDER converts the private key to DER-encoded PKCS1 - // format - MarshalPKCS1PrivateKeyDER() (der_block []byte, err error) -} - -type pKey struct { - key *C.EVP_PKEY -} - -func (key *pKey) evpPKey() *C.EVP_PKEY { return key.key } - -func (key *pKey) KeyType() NID { - return NID(C.EVP_PKEY_id(key.key)) -} - -func (key *pKey) BaseType() NID { - return NID(C.EVP_PKEY_base_id(key.key)) -} - -func (key *pKey) SignPKCS1v15(method Method, data []byte) ([]byte, error) { - - ctx := C.X_EVP_MD_CTX_new() - defer C.X_EVP_MD_CTX_free(ctx) - - if key.KeyType() == KeyTypeED25519 { - // do ED specific one-shot sign - - if method != nil || len(data) == 0 { - return nil, errors.New("signpkcs1v15: 0-length data or non-null digest") - } - - if 1 != C.X_EVP_DigestSignInit(ctx, nil, nil, nil, key.key) { - return nil, errors.New("signpkcs1v15: failed to init signature") - } - - // evp signatures are 64 bytes - sig := make([]byte, 64, 64) - var sigblen C.size_t = 64 - if 1 != C.X_EVP_DigestSign(ctx, - ((*C.uchar)(unsafe.Pointer(&sig[0]))), - &sigblen, - (*C.uchar)(unsafe.Pointer(&data[0])), - C.size_t(len(data))) { - return nil, errors.New("signpkcs1v15: failed to do one-shot signature") - } - - return sig[:sigblen], nil - } else { - if 1 != C.X_EVP_SignInit(ctx, method) { - return nil, errors.New("signpkcs1v15: failed to init signature") - } - if len(data) > 0 { - if 1 != C.X_EVP_SignUpdate( - ctx, unsafe.Pointer(&data[0]), C.uint(len(data))) { - return nil, errors.New("signpkcs1v15: failed to update signature") - } - } - sig := make([]byte, C.X_EVP_PKEY_size(key.key)) - var sigblen C.uint - if 1 != C.X_EVP_SignFinal(ctx, - ((*C.uchar)(unsafe.Pointer(&sig[0]))), &sigblen, key.key) { - return nil, errors.New("signpkcs1v15: failed to finalize signature") - } - return sig[:sigblen], nil - } -} - -func (key *pKey) VerifyPKCS1v15(method Method, data, sig []byte) error { - ctx := C.X_EVP_MD_CTX_new() - defer C.X_EVP_MD_CTX_free(ctx) - - if key.KeyType() == KeyTypeED25519 { - // do ED specific one-shot sign - - if method != nil || len(data) == 0 || len(sig) == 0 { - return errors.New("verifypkcs1v15: 0-length data or sig or non-null digest") - } - - if 1 != C.X_EVP_DigestVerifyInit(ctx, nil, nil, nil, key.key) { - return errors.New("verifypkcs1v15: failed to init verify") - } - - if 1 != C.X_EVP_DigestVerify(ctx, - ((*C.uchar)(unsafe.Pointer(&sig[0]))), - C.size_t(len(sig)), - (*C.uchar)(unsafe.Pointer(&data[0])), - C.size_t(len(data))) { - return errors.New("verifypkcs1v15: failed to do one-shot verify") - } - - return nil - - } else { - if 1 != C.X_EVP_VerifyInit(ctx, method) { - return errors.New("verifypkcs1v15: failed to init verify") - } - if len(data) > 0 { - if 1 != C.X_EVP_VerifyUpdate( - ctx, unsafe.Pointer(&data[0]), C.uint(len(data))) { - return errors.New("verifypkcs1v15: failed to update verify") - } - } - if 1 != C.X_EVP_VerifyFinal(ctx, - ((*C.uchar)(unsafe.Pointer(&sig[0]))), C.uint(len(sig)), key.key) { - return errors.New("verifypkcs1v15: failed to finalize verify") - } - return nil - } -} - -func (key *pKey) MarshalPKCS1PrivateKeyPEM() (pem_block []byte, - err error) { - bio := C.BIO_new(C.BIO_s_mem()) - if bio == nil { - return nil, errors.New("failed to allocate memory BIO") - } - defer C.BIO_free(bio) - - // PEM_write_bio_PrivateKey_traditional will use the key-specific PKCS1 - // format if one is available for that key type, otherwise it will encode - // to a PKCS8 key. - if int(C.X_PEM_write_bio_PrivateKey_traditional(bio, key.key, nil, nil, - C.int(0), nil, nil)) != 1 { - return nil, errors.New("failed dumping private key") - } - - return ioutil.ReadAll(asAnyBio(bio)) -} - -func (key *pKey) MarshalPKCS1PrivateKeyDER() (der_block []byte, - err error) { - bio := C.BIO_new(C.BIO_s_mem()) - if bio == nil { - return nil, errors.New("failed to allocate memory BIO") - } - defer C.BIO_free(bio) - - if int(C.i2d_PrivateKey_bio(bio, key.key)) != 1 { - return nil, errors.New("failed dumping private key der") - } - - return ioutil.ReadAll(asAnyBio(bio)) -} - -func (key *pKey) MarshalPKIXPublicKeyPEM() (pem_block []byte, - err error) { - bio := C.BIO_new(C.BIO_s_mem()) - if bio == nil { - return nil, errors.New("failed to allocate memory BIO") - } - defer C.BIO_free(bio) - - if int(C.PEM_write_bio_PUBKEY(bio, key.key)) != 1 { - return nil, errors.New("failed dumping public key pem") - } - - return ioutil.ReadAll(asAnyBio(bio)) -} - -func (key *pKey) MarshalPKIXPublicKeyDER() (der_block []byte, - err error) { - bio := C.BIO_new(C.BIO_s_mem()) - if bio == nil { - return nil, errors.New("failed to allocate memory BIO") - } - defer C.BIO_free(bio) - - if int(C.i2d_PUBKEY_bio(bio, key.key)) != 1 { - return nil, errors.New("failed dumping public key der") - } - - return ioutil.ReadAll(asAnyBio(bio)) -} - -// LoadPrivateKeyFromPEM loads a private key from a PEM-encoded block. -func LoadPrivateKeyFromPEM(pem_block []byte) (PrivateKey, error) { - if len(pem_block) == 0 { - return nil, errors.New("empty pem block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&pem_block[0]), - C.int(len(pem_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - - key := C.PEM_read_bio_PrivateKey(bio, nil, nil, nil) - if key == nil { - return nil, errors.New("failed reading private key") - } - - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// LoadPrivateKeyFromPEMWithPassword loads a private key from a PEM-encoded block. -func LoadPrivateKeyFromPEMWithPassword(pem_block []byte, password string) ( - PrivateKey, error) { - if len(pem_block) == 0 { - return nil, errors.New("empty pem block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&pem_block[0]), - C.int(len(pem_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - cs := C.CString(password) - defer C.free(unsafe.Pointer(cs)) - key := C.PEM_read_bio_PrivateKey(bio, nil, nil, unsafe.Pointer(cs)) - if key == nil { - return nil, errors.New("failed reading private key") - } - - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// LoadPrivateKeyFromDER loads a private key from a DER-encoded block. -func LoadPrivateKeyFromDER(der_block []byte) (PrivateKey, error) { - if len(der_block) == 0 { - return nil, errors.New("empty der block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&der_block[0]), - C.int(len(der_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - - key := C.d2i_PrivateKey_bio(bio, nil) - if key == nil { - return nil, errors.New("failed reading private key der") - } - - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// LoadPrivateKeyFromPEMWidthPassword loads a private key from a PEM-encoded block. -// Backwards-compatible with typo -func LoadPrivateKeyFromPEMWidthPassword(pem_block []byte, password string) ( - PrivateKey, error) { - return LoadPrivateKeyFromPEMWithPassword(pem_block, password) -} - -// LoadPublicKeyFromPEM loads a public key from a PEM-encoded block. -func LoadPublicKeyFromPEM(pem_block []byte) (PublicKey, error) { - if len(pem_block) == 0 { - return nil, errors.New("empty pem block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&pem_block[0]), - C.int(len(pem_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - - key := C.PEM_read_bio_PUBKEY(bio, nil, nil, nil) - if key == nil { - return nil, errors.New("failed reading public key der") - } - - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// LoadPublicKeyFromDER loads a public key from a DER-encoded block. -func LoadPublicKeyFromDER(der_block []byte) (PublicKey, error) { - if len(der_block) == 0 { - return nil, errors.New("empty der block") - } - bio := C.BIO_new_mem_buf(unsafe.Pointer(&der_block[0]), - C.int(len(der_block))) - if bio == nil { - return nil, errors.New("failed creating bio") - } - defer C.BIO_free(bio) - - key := C.d2i_PUBKEY_bio(bio, nil) - if key == nil { - return nil, errors.New("failed reading public key der") - } - - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// GenerateRSAKey generates a new RSA private key with an exponent of 3. -func GenerateRSAKey(bits int) (PrivateKey, error) { - return GenerateRSAKeyWithExponent(bits, 3) -} - -// GenerateRSAKeyWithExponent generates a new RSA private key. -func GenerateRSAKeyWithExponent(bits int, exponent int) (PrivateKey, error) { - rsa := C.RSA_generate_key(C.int(bits), C.ulong(exponent), nil, nil) - if rsa == nil { - return nil, errors.New("failed to generate RSA key") - } - key := C.X_EVP_PKEY_new() - if key == nil { - return nil, errors.New("failed to allocate EVP_PKEY") - } - if C.X_EVP_PKEY_assign_charp(key, C.EVP_PKEY_RSA, (*C.char)(unsafe.Pointer(rsa))) != 1 { - C.X_EVP_PKEY_free(key) - return nil, errors.New("failed to assign RSA key") - } - p := &pKey{key: key} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// GenerateECKey generates a new elliptic curve private key on the speicified -// curve. -func GenerateECKey(curve EllipticCurve) (PrivateKey, error) { - - // Create context for parameter generation - paramCtx := C.EVP_PKEY_CTX_new_id(C.EVP_PKEY_EC, nil) - if paramCtx == nil { - return nil, errors.New("failed creating EC parameter generation context") - } - defer C.EVP_PKEY_CTX_free(paramCtx) - - // Intialize the parameter generation - if int(C.EVP_PKEY_paramgen_init(paramCtx)) != 1 { - return nil, errors.New("failed initializing EC parameter generation context") - } - - // Set curve in EC parameter generation context - if int(C.X_EVP_PKEY_CTX_set_ec_paramgen_curve_nid(paramCtx, C.int(curve))) != 1 { - return nil, errors.New("failed setting curve in EC parameter generation context") - } - - // Create parameter object - var params *C.EVP_PKEY - if int(C.EVP_PKEY_paramgen(paramCtx, ¶ms)) != 1 { - return nil, errors.New("failed creating EC key generation parameters") - } - defer C.EVP_PKEY_free(params) - - // Create context for the key generation - keyCtx := C.EVP_PKEY_CTX_new(params, nil) - if keyCtx == nil { - return nil, errors.New("failed creating EC key generation context") - } - defer C.EVP_PKEY_CTX_free(keyCtx) - - // Generate the key - var privKey *C.EVP_PKEY - if int(C.EVP_PKEY_keygen_init(keyCtx)) != 1 { - return nil, errors.New("failed initializing EC key generation context") - } - if int(C.EVP_PKEY_keygen(keyCtx, &privKey)) != 1 { - return nil, errors.New("failed generating EC private key") - } - - p := &pKey{key: privKey} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} - -// GenerateED25519Key generates a Ed25519 key -func GenerateED25519Key() (PrivateKey, error) { - // Key context - keyCtx := C.EVP_PKEY_CTX_new_id(C.X_EVP_PKEY_ED25519, nil) - if keyCtx == nil { - return nil, errors.New("failed creating EC parameter generation context") - } - defer C.EVP_PKEY_CTX_free(keyCtx) - - // Generate the key - var privKey *C.EVP_PKEY - if int(C.EVP_PKEY_keygen_init(keyCtx)) != 1 { - return nil, errors.New("failed initializing ED25519 key generation context") - } - if int(C.EVP_PKEY_keygen(keyCtx, &privKey)) != 1 { - return nil, errors.New("failed generating ED25519 private key") - } - - p := &pKey{key: privKey} - runtime.SetFinalizer(p, func(p *pKey) { - C.X_EVP_PKEY_free(p.key) - }) - return p, nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/mapping.go b/vendor/github.com/spacemonkeygo/openssl/mapping.go deleted file mode 100644 index d78cc703..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/mapping.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -import ( - "sync" - "unsafe" -) - -// #include -import "C" - -type mapping struct { - lock sync.Mutex - values map[token]unsafe.Pointer -} - -func newMapping() *mapping { - return &mapping{ - values: make(map[token]unsafe.Pointer), - } -} - -type token unsafe.Pointer - -func (m *mapping) Add(x unsafe.Pointer) token { - res := token(C.malloc(1)) - - m.lock.Lock() - m.values[res] = x - m.lock.Unlock() - - return res -} - -func (m *mapping) Get(x token) unsafe.Pointer { - m.lock.Lock() - res := m.values[x] - m.lock.Unlock() - - return res -} - -func (m *mapping) Del(x token) { - m.lock.Lock() - delete(m.values, x) - m.lock.Unlock() - - C.free(unsafe.Pointer(x)) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/md4.go b/vendor/github.com/spacemonkeygo/openssl/md4.go deleted file mode 100644 index e5cc7d86..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/md4.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type MD4Hash struct { - ctx *C.EVP_MD_CTX - engine *Engine -} - -func NewMD4Hash() (*MD4Hash, error) { return NewMD4HashWithEngine(nil) } - -func NewMD4HashWithEngine(e *Engine) (*MD4Hash, error) { - hash := &MD4Hash{engine: e} - hash.ctx = C.X_EVP_MD_CTX_new() - if hash.ctx == nil { - return nil, errors.New("openssl: md4: unable to allocate ctx") - } - runtime.SetFinalizer(hash, func(hash *MD4Hash) { hash.Close() }) - if err := hash.Reset(); err != nil { - return nil, err - } - return hash, nil -} - -func (s *MD4Hash) Close() { - if s.ctx != nil { - C.X_EVP_MD_CTX_free(s.ctx) - s.ctx = nil - } -} - -func (s *MD4Hash) Reset() error { - if 1 != C.X_EVP_DigestInit_ex(s.ctx, C.X_EVP_md4(), engineRef(s.engine)) { - return errors.New("openssl: md4: cannot init digest ctx") - } - return nil -} - -func (s *MD4Hash) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, nil - } - if 1 != C.X_EVP_DigestUpdate(s.ctx, unsafe.Pointer(&p[0]), - C.size_t(len(p))) { - return 0, errors.New("openssl: md4: cannot update digest") - } - return len(p), nil -} - -func (s *MD4Hash) Sum() (result [16]byte, err error) { - if 1 != C.X_EVP_DigestFinal_ex(s.ctx, - (*C.uchar)(unsafe.Pointer(&result[0])), nil) { - return result, errors.New("openssl: md4: cannot finalize ctx") - } - return result, s.Reset() -} - -func MD4(data []byte) (result [16]byte, err error) { - hash, err := NewMD4Hash() - if err != nil { - return result, err - } - defer hash.Close() - if _, err := hash.Write(data); err != nil { - return result, err - } - return hash.Sum() -} diff --git a/vendor/github.com/spacemonkeygo/openssl/md5.go b/vendor/github.com/spacemonkeygo/openssl/md5.go deleted file mode 100644 index 82f2eb2f..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/md5.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type MD5Hash struct { - ctx *C.EVP_MD_CTX - engine *Engine -} - -func NewMD5Hash() (*MD5Hash, error) { return NewMD5HashWithEngine(nil) } - -func NewMD5HashWithEngine(e *Engine) (*MD5Hash, error) { - hash := &MD5Hash{engine: e} - hash.ctx = C.X_EVP_MD_CTX_new() - if hash.ctx == nil { - return nil, errors.New("openssl: md5: unable to allocate ctx") - } - runtime.SetFinalizer(hash, func(hash *MD5Hash) { hash.Close() }) - if err := hash.Reset(); err != nil { - return nil, err - } - return hash, nil -} - -func (s *MD5Hash) Close() { - if s.ctx != nil { - C.X_EVP_MD_CTX_free(s.ctx) - s.ctx = nil - } -} - -func (s *MD5Hash) Reset() error { - if 1 != C.X_EVP_DigestInit_ex(s.ctx, C.X_EVP_md5(), engineRef(s.engine)) { - return errors.New("openssl: md5: cannot init digest ctx") - } - return nil -} - -func (s *MD5Hash) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, nil - } - if 1 != C.X_EVP_DigestUpdate(s.ctx, unsafe.Pointer(&p[0]), - C.size_t(len(p))) { - return 0, errors.New("openssl: md5: cannot update digest") - } - return len(p), nil -} - -func (s *MD5Hash) Sum() (result [16]byte, err error) { - if 1 != C.X_EVP_DigestFinal_ex(s.ctx, - (*C.uchar)(unsafe.Pointer(&result[0])), nil) { - return result, errors.New("openssl: md5: cannot finalize ctx") - } - return result, s.Reset() -} - -func MD5(data []byte) (result [16]byte, err error) { - hash, err := NewMD5Hash() - if err != nil { - return result, err - } - defer hash.Close() - if _, err := hash.Write(data); err != nil { - return result, err - } - return hash.Sum() -} diff --git a/vendor/github.com/spacemonkeygo/openssl/net.go b/vendor/github.com/spacemonkeygo/openssl/net.go deleted file mode 100644 index 54beb8ee..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/net.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -import ( - "errors" - "net" -) - -type listener struct { - net.Listener - ctx *Ctx -} - -func (l *listener) Accept() (c net.Conn, err error) { - c, err = l.Listener.Accept() - if err != nil { - return nil, err - } - ssl_c, err := Server(c, l.ctx) - if err != nil { - c.Close() - return nil, err - } - return ssl_c, nil -} - -// NewListener wraps an existing net.Listener such that all accepted -// connections are wrapped as OpenSSL server connections using the provided -// context ctx. -func NewListener(inner net.Listener, ctx *Ctx) net.Listener { - return &listener{ - Listener: inner, - ctx: ctx} -} - -// Listen is a wrapper around net.Listen that wraps incoming connections with -// an OpenSSL server connection using the provided context ctx. -func Listen(network, laddr string, ctx *Ctx) (net.Listener, error) { - if ctx == nil { - return nil, errors.New("no ssl context provided") - } - l, err := net.Listen(network, laddr) - if err != nil { - return nil, err - } - return NewListener(l, ctx), nil -} - -type DialFlags int - -const ( - InsecureSkipHostVerification DialFlags = 1 << iota - DisableSNI -) - -// Dial will connect to network/address and then wrap the corresponding -// underlying connection with an OpenSSL client connection using context ctx. -// If flags includes InsecureSkipHostVerification, the server certificate's -// hostname will not be checked to match the hostname in addr. Otherwise, flags -// should be 0. -// -// Dial probably won't work for you unless you set a verify location or add -// some certs to the certificate store of the client context you're using. -// This library is not nice enough to use the system certificate store by -// default for you yet. -func Dial(network, addr string, ctx *Ctx, flags DialFlags) (*Conn, error) { - return DialSession(network, addr, ctx, flags, nil) -} - -// DialSession will connect to network/address and then wrap the corresponding -// underlying connection with an OpenSSL client connection using context ctx. -// If flags includes InsecureSkipHostVerification, the server certificate's -// hostname will not be checked to match the hostname in addr. Otherwise, flags -// should be 0. -// -// Dial probably won't work for you unless you set a verify location or add -// some certs to the certificate store of the client context you're using. -// This library is not nice enough to use the system certificate store by -// default for you yet. -// -// If session is not nil it will be used to resume the tls state. The session -// can be retrieved from the GetSession method on the Conn. -func DialSession(network, addr string, ctx *Ctx, flags DialFlags, - session []byte) (*Conn, error) { - - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - if ctx == nil { - var err error - ctx, err = NewCtx() - if err != nil { - return nil, err - } - // TODO: use operating system default certificate chain? - } - c, err := net.Dial(network, addr) - if err != nil { - return nil, err - } - conn, err := Client(c, ctx) - if err != nil { - c.Close() - return nil, err - } - if session != nil { - err := conn.setSession(session) - if err != nil { - c.Close() - return nil, err - } - } - if flags&DisableSNI == 0 { - err = conn.SetTlsExtHostName(host) - if err != nil { - conn.Close() - return nil, err - } - } - err = conn.Handshake() - if err != nil { - conn.Close() - return nil, err - } - if flags&InsecureSkipHostVerification == 0 { - err = conn.VerifyHostname(host) - if err != nil { - conn.Close() - return nil, err - } - } - return conn, nil -} diff --git a/vendor/github.com/spacemonkeygo/openssl/nid.go b/vendor/github.com/spacemonkeygo/openssl/nid.go deleted file mode 100644 index 936a52e7..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/nid.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -type NID int - -const ( - NID_undef NID = 0 - NID_rsadsi NID = 1 - NID_pkcs NID = 2 - NID_md2 NID = 3 - NID_md5 NID = 4 - NID_rc4 NID = 5 - NID_rsaEncryption NID = 6 - NID_md2WithRSAEncryption NID = 7 - NID_md5WithRSAEncryption NID = 8 - NID_pbeWithMD2AndDES_CBC NID = 9 - NID_pbeWithMD5AndDES_CBC NID = 10 - NID_X500 NID = 11 - NID_X509 NID = 12 - NID_commonName NID = 13 - NID_countryName NID = 14 - NID_localityName NID = 15 - NID_stateOrProvinceName NID = 16 - NID_organizationName NID = 17 - NID_organizationalUnitName NID = 18 - NID_rsa NID = 19 - NID_pkcs7 NID = 20 - NID_pkcs7_data NID = 21 - NID_pkcs7_signed NID = 22 - NID_pkcs7_enveloped NID = 23 - NID_pkcs7_signedAndEnveloped NID = 24 - NID_pkcs7_digest NID = 25 - NID_pkcs7_encrypted NID = 26 - NID_pkcs3 NID = 27 - NID_dhKeyAgreement NID = 28 - NID_des_ecb NID = 29 - NID_des_cfb64 NID = 30 - NID_des_cbc NID = 31 - NID_des_ede NID = 32 - NID_des_ede3 NID = 33 - NID_idea_cbc NID = 34 - NID_idea_cfb64 NID = 35 - NID_idea_ecb NID = 36 - NID_rc2_cbc NID = 37 - NID_rc2_ecb NID = 38 - NID_rc2_cfb64 NID = 39 - NID_rc2_ofb64 NID = 40 - NID_sha NID = 41 - NID_shaWithRSAEncryption NID = 42 - NID_des_ede_cbc NID = 43 - NID_des_ede3_cbc NID = 44 - NID_des_ofb64 NID = 45 - NID_idea_ofb64 NID = 46 - NID_pkcs9 NID = 47 - NID_pkcs9_emailAddress NID = 48 - NID_pkcs9_unstructuredName NID = 49 - NID_pkcs9_contentType NID = 50 - NID_pkcs9_messageDigest NID = 51 - NID_pkcs9_signingTime NID = 52 - NID_pkcs9_countersignature NID = 53 - NID_pkcs9_challengePassword NID = 54 - NID_pkcs9_unstructuredAddress NID = 55 - NID_pkcs9_extCertAttributes NID = 56 - NID_netscape NID = 57 - NID_netscape_cert_extension NID = 58 - NID_netscape_data_type NID = 59 - NID_des_ede_cfb64 NID = 60 - NID_des_ede3_cfb64 NID = 61 - NID_des_ede_ofb64 NID = 62 - NID_des_ede3_ofb64 NID = 63 - NID_sha1 NID = 64 - NID_sha1WithRSAEncryption NID = 65 - NID_dsaWithSHA NID = 66 - NID_dsa_2 NID = 67 - NID_pbeWithSHA1AndRC2_CBC NID = 68 - NID_id_pbkdf2 NID = 69 - NID_dsaWithSHA1_2 NID = 70 - NID_netscape_cert_type NID = 71 - NID_netscape_base_url NID = 72 - NID_netscape_revocation_url NID = 73 - NID_netscape_ca_revocation_url NID = 74 - NID_netscape_renewal_url NID = 75 - NID_netscape_ca_policy_url NID = 76 - NID_netscape_ssl_server_name NID = 77 - NID_netscape_comment NID = 78 - NID_netscape_cert_sequence NID = 79 - NID_desx_cbc NID = 80 - NID_id_ce NID = 81 - NID_subject_key_identifier NID = 82 - NID_key_usage NID = 83 - NID_private_key_usage_period NID = 84 - NID_subject_alt_name NID = 85 - NID_issuer_alt_name NID = 86 - NID_basic_constraints NID = 87 - NID_crl_number NID = 88 - NID_certificate_policies NID = 89 - NID_authority_key_identifier NID = 90 - NID_bf_cbc NID = 91 - NID_bf_ecb NID = 92 - NID_bf_cfb64 NID = 93 - NID_bf_ofb64 NID = 94 - NID_mdc2 NID = 95 - NID_mdc2WithRSA NID = 96 - NID_rc4_40 NID = 97 - NID_rc2_40_cbc NID = 98 - NID_givenName NID = 99 - NID_surname NID = 100 - NID_initials NID = 101 - NID_uniqueIdentifier NID = 102 - NID_crl_distribution_points NID = 103 - NID_md5WithRSA NID = 104 - NID_serialNumber NID = 105 - NID_title NID = 106 - NID_description NID = 107 - NID_cast5_cbc NID = 108 - NID_cast5_ecb NID = 109 - NID_cast5_cfb64 NID = 110 - NID_cast5_ofb64 NID = 111 - NID_pbeWithMD5AndCast5_CBC NID = 112 - NID_dsaWithSHA1 NID = 113 - NID_md5_sha1 NID = 114 - NID_sha1WithRSA NID = 115 - NID_dsa NID = 116 - NID_ripemd160 NID = 117 - NID_ripemd160WithRSA NID = 119 - NID_rc5_cbc NID = 120 - NID_rc5_ecb NID = 121 - NID_rc5_cfb64 NID = 122 - NID_rc5_ofb64 NID = 123 - NID_rle_compression NID = 124 - NID_zlib_compression NID = 125 - NID_ext_key_usage NID = 126 - NID_id_pkix NID = 127 - NID_id_kp NID = 128 - NID_server_auth NID = 129 - NID_client_auth NID = 130 - NID_code_sign NID = 131 - NID_email_protect NID = 132 - NID_time_stamp NID = 133 - NID_ms_code_ind NID = 134 - NID_ms_code_com NID = 135 - NID_ms_ctl_sign NID = 136 - NID_ms_sgc NID = 137 - NID_ms_efs NID = 138 - NID_ns_sgc NID = 139 - NID_delta_crl NID = 140 - NID_crl_reason NID = 141 - NID_invalidity_date NID = 142 - NID_sxnet NID = 143 - NID_pbe_WithSHA1And128BitRC4 NID = 144 - NID_pbe_WithSHA1And40BitRC4 NID = 145 - NID_pbe_WithSHA1And3_Key_TripleDES_CBC NID = 146 - NID_pbe_WithSHA1And2_Key_TripleDES_CBC NID = 147 - NID_pbe_WithSHA1And128BitRC2_CBC NID = 148 - NID_pbe_WithSHA1And40BitRC2_CBC NID = 149 - NID_keyBag NID = 150 - NID_pkcs8ShroudedKeyBag NID = 151 - NID_certBag NID = 152 - NID_crlBag NID = 153 - NID_secretBag NID = 154 - NID_safeContentsBag NID = 155 - NID_friendlyName NID = 156 - NID_localKeyID NID = 157 - NID_x509Certificate NID = 158 - NID_sdsiCertificate NID = 159 - NID_x509Crl NID = 160 - NID_pbes2 NID = 161 - NID_pbmac1 NID = 162 - NID_hmacWithSHA1 NID = 163 - NID_id_qt_cps NID = 164 - NID_id_qt_unotice NID = 165 - NID_rc2_64_cbc NID = 166 - NID_SMIMECapabilities NID = 167 - NID_pbeWithMD2AndRC2_CBC NID = 168 - NID_pbeWithMD5AndRC2_CBC NID = 169 - NID_pbeWithSHA1AndDES_CBC NID = 170 - NID_ms_ext_req NID = 171 - NID_ext_req NID = 172 - NID_name NID = 173 - NID_dnQualifier NID = 174 - NID_id_pe NID = 175 - NID_id_ad NID = 176 - NID_info_access NID = 177 - NID_ad_OCSP NID = 178 - NID_ad_ca_issuers NID = 179 - NID_OCSP_sign NID = 180 - NID_X9_62_id_ecPublicKey NID = 408 - NID_hmac NID = 855 - NID_cmac NID = 894 - NID_dhpublicnumber NID = 920 - NID_tls1_prf NID = 1021 - NID_hkdf NID = 1036 - NID_X25519 NID = 1034 - NID_X448 NID = 1035 - NID_ED25519 NID = 1087 - NID_ED448 NID = 1088 -) diff --git a/vendor/github.com/spacemonkeygo/openssl/pem.go b/vendor/github.com/spacemonkeygo/openssl/pem.go deleted file mode 100644 index c8b0c1cf..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/pem.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -import ( - "regexp" -) - -var pemSplit *regexp.Regexp = regexp.MustCompile(`(?sm)` + - `(^-----[\s-]*?BEGIN.*?-----$` + - `.*?` + - `^-----[\s-]*?END.*?-----$)`) - -func SplitPEM(data []byte) [][]byte { - var results [][]byte - for _, block := range pemSplit.FindAll(data, -1) { - results = append(results, block) - } - return results -} diff --git a/vendor/github.com/spacemonkeygo/openssl/sha1.go b/vendor/github.com/spacemonkeygo/openssl/sha1.go deleted file mode 100644 index c227bee8..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/sha1.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type SHA1Hash struct { - ctx *C.EVP_MD_CTX - engine *Engine -} - -func NewSHA1Hash() (*SHA1Hash, error) { return NewSHA1HashWithEngine(nil) } - -func NewSHA1HashWithEngine(e *Engine) (*SHA1Hash, error) { - hash := &SHA1Hash{engine: e} - hash.ctx = C.X_EVP_MD_CTX_new() - if hash.ctx == nil { - return nil, errors.New("openssl: sha1: unable to allocate ctx") - } - runtime.SetFinalizer(hash, func(hash *SHA1Hash) { hash.Close() }) - if err := hash.Reset(); err != nil { - return nil, err - } - return hash, nil -} - -func (s *SHA1Hash) Close() { - if s.ctx != nil { - C.X_EVP_MD_CTX_free(s.ctx) - s.ctx = nil - } -} - -func engineRef(e *Engine) *C.ENGINE { - if e == nil { - return nil - } - return e.e -} - -func (s *SHA1Hash) Reset() error { - if 1 != C.X_EVP_DigestInit_ex(s.ctx, C.X_EVP_sha1(), engineRef(s.engine)) { - return errors.New("openssl: sha1: cannot init digest ctx") - } - return nil -} - -func (s *SHA1Hash) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, nil - } - if 1 != C.X_EVP_DigestUpdate(s.ctx, unsafe.Pointer(&p[0]), - C.size_t(len(p))) { - return 0, errors.New("openssl: sha1: cannot update digest") - } - return len(p), nil -} - -func (s *SHA1Hash) Sum() (result [20]byte, err error) { - if 1 != C.X_EVP_DigestFinal_ex(s.ctx, - (*C.uchar)(unsafe.Pointer(&result[0])), nil) { - return result, errors.New("openssl: sha1: cannot finalize ctx") - } - return result, s.Reset() -} - -func SHA1(data []byte) (result [20]byte, err error) { - hash, err := NewSHA1Hash() - if err != nil { - return result, err - } - defer hash.Close() - if _, err := hash.Write(data); err != nil { - return result, err - } - return hash.Sum() -} diff --git a/vendor/github.com/spacemonkeygo/openssl/sha256.go b/vendor/github.com/spacemonkeygo/openssl/sha256.go deleted file mode 100644 index d25c7a95..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/sha256.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "errors" - "runtime" - "unsafe" -) - -type SHA256Hash struct { - ctx *C.EVP_MD_CTX - engine *Engine -} - -func NewSHA256Hash() (*SHA256Hash, error) { return NewSHA256HashWithEngine(nil) } - -func NewSHA256HashWithEngine(e *Engine) (*SHA256Hash, error) { - hash := &SHA256Hash{engine: e} - hash.ctx = C.X_EVP_MD_CTX_new() - if hash.ctx == nil { - return nil, errors.New("openssl: sha256: unable to allocate ctx") - } - runtime.SetFinalizer(hash, func(hash *SHA256Hash) { hash.Close() }) - if err := hash.Reset(); err != nil { - return nil, err - } - return hash, nil -} - -func (s *SHA256Hash) Close() { - if s.ctx != nil { - C.X_EVP_MD_CTX_free(s.ctx) - s.ctx = nil - } -} - -func (s *SHA256Hash) Reset() error { - if 1 != C.X_EVP_DigestInit_ex(s.ctx, C.X_EVP_sha256(), engineRef(s.engine)) { - return errors.New("openssl: sha256: cannot init digest ctx") - } - return nil -} - -func (s *SHA256Hash) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, nil - } - if 1 != C.X_EVP_DigestUpdate(s.ctx, unsafe.Pointer(&p[0]), - C.size_t(len(p))) { - return 0, errors.New("openssl: sha256: cannot update digest") - } - return len(p), nil -} - -func (s *SHA256Hash) Sum() (result [32]byte, err error) { - if 1 != C.X_EVP_DigestFinal_ex(s.ctx, - (*C.uchar)(unsafe.Pointer(&result[0])), nil) { - return result, errors.New("openssl: sha256: cannot finalize ctx") - } - return result, s.Reset() -} - -func SHA256(data []byte) (result [32]byte, err error) { - hash, err := NewSHA256Hash() - if err != nil { - return result, err - } - defer hash.Close() - if _, err := hash.Write(data); err != nil { - return result, err - } - return hash.Sum() -} diff --git a/vendor/github.com/spacemonkeygo/openssl/shim.c b/vendor/github.com/spacemonkeygo/openssl/shim.c deleted file mode 100644 index 6e680841..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/shim.c +++ /dev/null @@ -1,770 +0,0 @@ -/* - * Copyright (C) 2014 Space Monkey, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include "_cgo_export.h" - -/* - * Functions defined in other .c files - */ -extern int go_init_locks(); -extern void go_thread_locking_callback(int, int, const char*, int); -extern unsigned long go_thread_id_callback(); -static int go_write_bio_puts(BIO *b, const char *str) { - return go_write_bio_write(b, (char*)str, (int)strlen(str)); -} - -/* - ************************************************ - * v1.1.1 and later implementation - ************************************************ - */ -#if OPENSSL_VERSION_NUMBER >= 0x1010100fL - -const int X_ED25519_SUPPORT = 1; -int X_EVP_PKEY_ED25519 = EVP_PKEY_ED25519; - -int X_EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey){ - return EVP_DigestSignInit(ctx, pctx, type, e, pkey); -} - -int X_EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, size_t tbslen) { - return EVP_DigestSign(ctx, sigret, siglen, tbs, tbslen); -} - - -int X_EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey){ - return EVP_DigestVerifyInit(ctx, pctx, type, e, pkey); -} - -int X_EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, size_t tbslen){ - return EVP_DigestVerify(ctx, sigret, siglen, tbs, tbslen); -} - -#else - -const int X_ED25519_SUPPORT = 0; -int X_EVP_PKEY_ED25519 = EVP_PKEY_NONE; - -int X_EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey){ - return 0; -} - -int X_EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, size_t tbslen) { - return 0; -} - - -int X_EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey){ - return 0; -} - -int X_EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, size_t tbslen){ - return 0; -} - -#endif - -/* - ************************************************ - * v1.1.X and later implementation - ************************************************ - */ -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL - -void X_BIO_set_data(BIO* bio, void* data) { - BIO_set_data(bio, data); -} - -void* X_BIO_get_data(BIO* bio) { - return BIO_get_data(bio); -} - -EVP_MD_CTX* X_EVP_MD_CTX_new() { - return EVP_MD_CTX_new(); -} - -void X_EVP_MD_CTX_free(EVP_MD_CTX* ctx) { - EVP_MD_CTX_free(ctx); -} - -static int x_bio_create(BIO *b) { - BIO_set_shutdown(b, 1); - BIO_set_init(b, 1); - BIO_set_data(b, NULL); - BIO_clear_flags(b, ~0); - return 1; -} - -static int x_bio_free(BIO *b) { - return 1; -} - -static BIO_METHOD *writeBioMethod; -static BIO_METHOD *readBioMethod; - -BIO_METHOD* BIO_s_readBio() { return readBioMethod; } -BIO_METHOD* BIO_s_writeBio() { return writeBioMethod; } - -int x_bio_init_methods() { - writeBioMethod = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "Go Write BIO"); - if (!writeBioMethod) { - return 1; - } - if (1 != BIO_meth_set_write(writeBioMethod, - (int (*)(BIO *, const char *, int))go_write_bio_write)) { - return 2; - } - if (1 != BIO_meth_set_puts(writeBioMethod, go_write_bio_puts)) { - return 3; - } - if (1 != BIO_meth_set_ctrl(writeBioMethod, go_write_bio_ctrl)) { - return 4; - } - if (1 != BIO_meth_set_create(writeBioMethod, x_bio_create)) { - return 5; - } - if (1 != BIO_meth_set_destroy(writeBioMethod, x_bio_free)) { - return 6; - } - - readBioMethod = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "Go Read BIO"); - if (!readBioMethod) { - return 7; - } - if (1 != BIO_meth_set_read(readBioMethod, go_read_bio_read)) { - return 8; - } - if (1 != BIO_meth_set_ctrl(readBioMethod, go_read_bio_ctrl)) { - return 9; - } - if (1 != BIO_meth_set_create(readBioMethod, x_bio_create)) { - return 10; - } - if (1 != BIO_meth_set_destroy(readBioMethod, x_bio_free)) { - return 11; - } - - return 0; -} - -const EVP_MD *X_EVP_dss() { - return NULL; -} - -const EVP_MD *X_EVP_dss1() { - return NULL; -} - -const EVP_MD *X_EVP_sha() { - return NULL; -} - -int X_EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_encrypting(ctx); -} - -int X_X509_add_ref(X509* x509) { - return X509_up_ref(x509); -} - -const ASN1_TIME *X_X509_get0_notBefore(const X509 *x) { - return X509_get0_notBefore(x); -} - -const ASN1_TIME *X_X509_get0_notAfter(const X509 *x) { - return X509_get0_notAfter(x); -} - -HMAC_CTX *X_HMAC_CTX_new(void) { - return HMAC_CTX_new(); -} - -void X_HMAC_CTX_free(HMAC_CTX *ctx) { - HMAC_CTX_free(ctx); -} - -int X_PEM_write_bio_PrivateKey_traditional(BIO *bio, EVP_PKEY *key, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u) { - return PEM_write_bio_PrivateKey_traditional(bio, key, enc, kstr, klen, cb, u); -} - -#endif - -/* - ************************************************ - * v1.0.X implementation - ************************************************ - */ -#if OPENSSL_VERSION_NUMBER < 0x1010000fL - -static int x_bio_create(BIO *b) { - b->shutdown = 1; - b->init = 1; - b->num = -1; - b->ptr = NULL; - b->flags = 0; - return 1; -} - -static int x_bio_free(BIO *b) { - return 1; -} - -static BIO_METHOD writeBioMethod = { - BIO_TYPE_SOURCE_SINK, - "Go Write BIO", - (int (*)(BIO *, const char *, int))go_write_bio_write, - NULL, - go_write_bio_puts, - NULL, - go_write_bio_ctrl, - x_bio_create, - x_bio_free, - NULL}; - -static BIO_METHOD* BIO_s_writeBio() { return &writeBioMethod; } - -static BIO_METHOD readBioMethod = { - BIO_TYPE_SOURCE_SINK, - "Go Read BIO", - NULL, - go_read_bio_read, - NULL, - NULL, - go_read_bio_ctrl, - x_bio_create, - x_bio_free, - NULL}; - -static BIO_METHOD* BIO_s_readBio() { return &readBioMethod; } - -int x_bio_init_methods() { - /* statically initialized above */ - return 0; -} - -void X_BIO_set_data(BIO* bio, void* data) { - bio->ptr = data; -} - -void* X_BIO_get_data(BIO* bio) { - return bio->ptr; -} - -EVP_MD_CTX* X_EVP_MD_CTX_new() { - return EVP_MD_CTX_create(); -} - -void X_EVP_MD_CTX_free(EVP_MD_CTX* ctx) { - EVP_MD_CTX_destroy(ctx); -} - -int X_X509_add_ref(X509* x509) { - CRYPTO_add(&x509->references, 1, CRYPTO_LOCK_X509); - return 1; -} - -const ASN1_TIME *X_X509_get0_notBefore(const X509 *x) { - return x->cert_info->validity->notBefore; -} - -const ASN1_TIME *X_X509_get0_notAfter(const X509 *x) { - return x->cert_info->validity->notAfter; -} - -const EVP_MD *X_EVP_dss() { - return EVP_dss(); -} - -const EVP_MD *X_EVP_dss1() { - return EVP_dss1(); -} - -const EVP_MD *X_EVP_sha() { - return EVP_sha(); -} - -int X_EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) { - return ctx->encrypt; -} - -HMAC_CTX *X_HMAC_CTX_new(void) { - /* v1.1.0 uses a OPENSSL_zalloc to allocate the memory which does not exist - * in previous versions. malloc+memset to get the same behavior */ - HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_malloc(sizeof(HMAC_CTX)); - if (ctx) { - memset(ctx, 0, sizeof(HMAC_CTX)); - HMAC_CTX_init(ctx); - } - return ctx; -} - -void X_HMAC_CTX_free(HMAC_CTX *ctx) { - if (ctx) { - HMAC_CTX_cleanup(ctx); - OPENSSL_free(ctx); - } -} - -int X_PEM_write_bio_PrivateKey_traditional(BIO *bio, EVP_PKEY *key, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u) { - /* PEM_write_bio_PrivateKey always tries to use the PKCS8 format if it - * is available, instead of using the "traditional" format as stated in the - * OpenSSL man page. - * i2d_PrivateKey should give us the correct DER encoding, so we'll just - * use PEM_ASN1_write_bio directly to write the DER encoding with the correct - * type header. */ - - int ppkey_id, pkey_base_id, ppkey_flags; - const char *pinfo, *ppem_str; - char pem_type_str[80]; - - // Lookup the ASN1 method information to get the pem type - if (EVP_PKEY_asn1_get0_info(&ppkey_id, &pkey_base_id, &ppkey_flags, &pinfo, &ppem_str, key->ameth) != 1) { - return 0; - } - // Set up the PEM type string - if (BIO_snprintf(pem_type_str, 80, "%s PRIVATE KEY", ppem_str) <= 0) { - // Failed to write out the pem type string, something is really wrong. - return 0; - } - // Write out everything to the BIO - return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, - pem_type_str, bio, key, enc, kstr, klen, cb, u); -} - -#endif - -/* - ************************************************ - * common implementation - ************************************************ - */ - -int X_shim_init() { - int rc = 0; - - OPENSSL_config(NULL); - ENGINE_load_builtin_engines(); - SSL_load_error_strings(); - SSL_library_init(); - OpenSSL_add_all_algorithms(); - // - // Set up OPENSSL thread safety callbacks. - rc = go_init_locks(); - if (rc != 0) { - return rc; - } - CRYPTO_set_locking_callback(go_thread_locking_callback); - CRYPTO_set_id_callback(go_thread_id_callback); - - rc = x_bio_init_methods(); - if (rc != 0) { - return rc; - } - - return 0; -} - -void * X_OPENSSL_malloc(size_t size) { - return OPENSSL_malloc(size); -} - -void X_OPENSSL_free(void *ref) { - OPENSSL_free(ref); -} - -long X_SSL_set_options(SSL* ssl, long options) { - return SSL_set_options(ssl, options); -} - -long X_SSL_get_options(SSL* ssl) { - return SSL_get_options(ssl); -} - -long X_SSL_clear_options(SSL* ssl, long options) { - return SSL_clear_options(ssl, options); -} - -long X_SSL_set_tlsext_host_name(SSL *ssl, const char *name) { - return SSL_set_tlsext_host_name(ssl, name); -} -const char * X_SSL_get_cipher_name(const SSL *ssl) { - return SSL_get_cipher_name(ssl); -} -int X_SSL_session_reused(SSL *ssl) { - return SSL_session_reused(ssl); -} - -int X_SSL_new_index() { - return SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL); -} - -int X_SSL_verify_cb(int ok, X509_STORE_CTX* store) { - SSL* ssl = (SSL *)X509_STORE_CTX_get_ex_data(store, - SSL_get_ex_data_X509_STORE_CTX_idx()); - void* p = SSL_get_ex_data(ssl, get_ssl_idx()); - // get the pointer to the go Ctx object and pass it back into the thunk - return go_ssl_verify_cb_thunk(p, ok, store); -} - -const SSL_METHOD *X_SSLv23_method() { - return SSLv23_method(); -} - -const SSL_METHOD *X_SSLv3_method() { -#ifndef OPENSSL_NO_SSL3_METHOD - return SSLv3_method(); -#else - return NULL; -#endif -} - -const SSL_METHOD *X_TLSv1_method() { - return TLSv1_method(); -} - -const SSL_METHOD *X_TLSv1_1_method() { -#if defined(TLS1_1_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX) - return TLSv1_1_method(); -#else - return NULL; -#endif -} - -const SSL_METHOD *X_TLSv1_2_method() { -#if defined(TLS1_2_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX) - return TLSv1_2_method(); -#else - return NULL; -#endif -} - -int X_SSL_CTX_new_index() { - return SSL_CTX_get_ex_new_index(0, NULL, NULL, NULL, NULL); -} - -long X_SSL_CTX_set_options(SSL_CTX* ctx, long options) { - return SSL_CTX_set_options(ctx, options); -} - -long X_SSL_CTX_clear_options(SSL_CTX* ctx, long options) { - return SSL_CTX_clear_options(ctx, options); -} - -long X_SSL_CTX_get_options(SSL_CTX* ctx) { - return SSL_CTX_get_options(ctx); -} - -long X_SSL_CTX_set_mode(SSL_CTX* ctx, long modes) { - return SSL_CTX_set_mode(ctx, modes); -} - -long X_SSL_CTX_get_mode(SSL_CTX* ctx) { - return SSL_CTX_get_mode(ctx); -} - -long X_SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long modes) { - return SSL_CTX_set_session_cache_mode(ctx, modes); -} - -long X_SSL_CTX_sess_set_cache_size(SSL_CTX* ctx, long t) { - return SSL_CTX_sess_set_cache_size(ctx, t); -} - -long X_SSL_CTX_sess_get_cache_size(SSL_CTX* ctx) { - return SSL_CTX_sess_get_cache_size(ctx); -} - -long X_SSL_CTX_set_timeout(SSL_CTX* ctx, long t) { - return SSL_CTX_set_timeout(ctx, t); -} - -long X_SSL_CTX_get_timeout(SSL_CTX* ctx) { - return SSL_CTX_get_timeout(ctx); -} - -long X_SSL_CTX_add_extra_chain_cert(SSL_CTX* ctx, X509 *cert) { - return SSL_CTX_add_extra_chain_cert(ctx, cert); -} - -long X_SSL_CTX_set_tmp_ecdh(SSL_CTX* ctx, EC_KEY *key) { - return SSL_CTX_set_tmp_ecdh(ctx, key); -} - -long X_SSL_CTX_set_tlsext_servername_callback( - SSL_CTX* ctx, int (*cb)(SSL *con, int *ad, void *args)) { - return SSL_CTX_set_tlsext_servername_callback(ctx, cb); -} - -int X_SSL_CTX_verify_cb(int ok, X509_STORE_CTX* store) { - SSL* ssl = (SSL *)X509_STORE_CTX_get_ex_data(store, - SSL_get_ex_data_X509_STORE_CTX_idx()); - SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl); - void* p = SSL_CTX_get_ex_data(ssl_ctx, get_ssl_ctx_idx()); - // get the pointer to the go Ctx object and pass it back into the thunk - return go_ssl_ctx_verify_cb_thunk(p, ok, store); -} - -long X_SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh) { - return SSL_CTX_set_tmp_dh(ctx, dh); -} - -long X_PEM_read_DHparams(SSL_CTX* ctx, DH *dh) { - return SSL_CTX_set_tmp_dh(ctx, dh); -} - -int X_SSL_CTX_set_tlsext_ticket_key_cb(SSL_CTX *sslctx, - int (*cb)(SSL *s, unsigned char key_name[16], - unsigned char iv[EVP_MAX_IV_LENGTH], - EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc)) { - return SSL_CTX_set_tlsext_ticket_key_cb(sslctx, cb); -} - -int X_SSL_CTX_ticket_key_cb(SSL *s, unsigned char key_name[16], - unsigned char iv[EVP_MAX_IV_LENGTH], - EVP_CIPHER_CTX *cctx, HMAC_CTX *hctx, int enc) { - - SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(s); - void* p = SSL_CTX_get_ex_data(ssl_ctx, get_ssl_ctx_idx()); - // get the pointer to the go Ctx object and pass it back into the thunk - return go_ticket_key_cb_thunk(p, s, key_name, iv, cctx, hctx, enc); -} - -int X_BIO_get_flags(BIO *b) { - return BIO_get_flags(b); -} - -void X_BIO_set_flags(BIO *b, int flags) { - return BIO_set_flags(b, flags); -} - -void X_BIO_clear_flags(BIO *b, int flags) { - BIO_clear_flags(b, flags); -} - -int X_BIO_read(BIO *b, void *buf, int len) { - return BIO_read(b, buf, len); -} - -int X_BIO_write(BIO *b, const void *buf, int len) { - return BIO_write(b, buf, len); -} - -BIO *X_BIO_new_write_bio() { - return BIO_new(BIO_s_writeBio()); -} - -BIO *X_BIO_new_read_bio() { - return BIO_new(BIO_s_readBio()); -} - -const EVP_MD *X_EVP_get_digestbyname(const char *name) { - return EVP_get_digestbyname(name); -} - -const EVP_MD *X_EVP_md_null() { - return EVP_md_null(); -} - -const EVP_MD *X_EVP_md5() { - return EVP_md5(); -} - -const EVP_MD *X_EVP_md4() { - return EVP_md4(); -} - -const EVP_MD *X_EVP_ripemd160() { - return EVP_ripemd160(); -} - -const EVP_MD *X_EVP_sha224() { - return EVP_sha224(); -} - -const EVP_MD *X_EVP_sha1() { - return EVP_sha1(); -} - -const EVP_MD *X_EVP_sha256() { - return EVP_sha256(); -} - -const EVP_MD *X_EVP_sha384() { - return EVP_sha384(); -} - -const EVP_MD *X_EVP_sha512() { - return EVP_sha512(); -} - -int X_EVP_MD_size(const EVP_MD *md) { - return EVP_MD_size(md); -} - -int X_EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) { - return EVP_DigestInit_ex(ctx, type, impl); -} - -int X_EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt) { - return EVP_DigestUpdate(ctx, d, cnt); -} - -int X_EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s) { - return EVP_DigestFinal_ex(ctx, md, s); -} - -int X_EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type) { - return EVP_SignInit(ctx, type); -} - -int X_EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt) { - return EVP_SignUpdate(ctx, d, cnt); -} - -EVP_PKEY *X_EVP_PKEY_new(void) { - return EVP_PKEY_new(); -} - -void X_EVP_PKEY_free(EVP_PKEY *pkey) { - EVP_PKEY_free(pkey); -} - -int X_EVP_PKEY_size(EVP_PKEY *pkey) { - return EVP_PKEY_size(pkey); -} - -struct rsa_st *X_EVP_PKEY_get1_RSA(EVP_PKEY *pkey) { - return EVP_PKEY_get1_RSA(pkey); -} - -int X_EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key) { - return EVP_PKEY_set1_RSA(pkey, key); -} - -int X_EVP_PKEY_assign_charp(EVP_PKEY *pkey, int type, char *key) { - return EVP_PKEY_assign(pkey, type, key); -} - -int X_EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, EVP_PKEY *pkey) { - return EVP_SignFinal(ctx, md, s, pkey); -} - -int X_EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type) { - return EVP_VerifyInit(ctx, type); -} - -int X_EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, - unsigned int cnt) { - return EVP_VerifyUpdate(ctx, d, cnt); -} - -int X_EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey) { - return EVP_VerifyFinal(ctx, sigbuf, siglen, pkey); -} - -int X_EVP_CIPHER_block_size(EVP_CIPHER *c) { - return EVP_CIPHER_block_size(c); -} - -int X_EVP_CIPHER_key_length(EVP_CIPHER *c) { - return EVP_CIPHER_key_length(c); -} - -int X_EVP_CIPHER_iv_length(EVP_CIPHER *c) { - return EVP_CIPHER_iv_length(c); -} - -int X_EVP_CIPHER_nid(EVP_CIPHER *c) { - return EVP_CIPHER_nid(c); -} - -int X_EVP_CIPHER_CTX_block_size(EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_block_size(ctx); -} - -int X_EVP_CIPHER_CTX_key_length(EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_key_length(ctx); -} - -int X_EVP_CIPHER_CTX_iv_length(EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_iv_length(ctx); -} - -void X_EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int padding) { - //openssl always returns 1 for set_padding - //hence return value is not checked - EVP_CIPHER_CTX_set_padding(ctx, padding); -} - -const EVP_CIPHER *X_EVP_CIPHER_CTX_cipher(EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_cipher(ctx); -} - -int X_EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid) { - return EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid); -} - -size_t X_HMAC_size(const HMAC_CTX *e) { - return HMAC_size(e); -} - -int X_HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, ENGINE *impl) { - return HMAC_Init_ex(ctx, key, len, md, impl); -} - -int X_HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) { - return HMAC_Update(ctx, data, len); -} - -int X_HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) { - return HMAC_Final(ctx, md, len); -} - -int X_sk_X509_num(STACK_OF(X509) *sk) { - return sk_X509_num(sk); -} - -X509 *X_sk_X509_value(STACK_OF(X509)* sk, int i) { - return sk_X509_value(sk, i); -} - -long X_X509_get_version(const X509 *x) { - return X509_get_version(x); -} - -int X_X509_set_version(X509 *x, long version) { - return X509_set_version(x, version); -} diff --git a/vendor/github.com/spacemonkeygo/openssl/shim.h b/vendor/github.com/spacemonkeygo/openssl/shim.h deleted file mode 100644 index b792822b..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/shim.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2014 Space Monkey, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef SSL_MODE_RELEASE_BUFFERS -#define SSL_MODE_RELEASE_BUFFERS 0 -#endif - -#ifndef SSL_OP_NO_COMPRESSION -#define SSL_OP_NO_COMPRESSION 0 -#endif - -/* shim methods */ -extern int X_shim_init(); - -/* Library methods */ -extern void X_OPENSSL_free(void *ref); -extern void *X_OPENSSL_malloc(size_t size); - -/* SSL methods */ -extern long X_SSL_set_options(SSL* ssl, long options); -extern long X_SSL_get_options(SSL* ssl); -extern long X_SSL_clear_options(SSL* ssl, long options); -extern long X_SSL_set_tlsext_host_name(SSL *ssl, const char *name); -extern const char * X_SSL_get_cipher_name(const SSL *ssl); -extern int X_SSL_session_reused(SSL *ssl); -extern int X_SSL_new_index(); - -extern const SSL_METHOD *X_SSLv23_method(); -extern const SSL_METHOD *X_SSLv3_method(); -extern const SSL_METHOD *X_TLSv1_method(); -extern const SSL_METHOD *X_TLSv1_1_method(); -extern const SSL_METHOD *X_TLSv1_2_method(); - -#if defined SSL_CTRL_SET_TLSEXT_HOSTNAME -extern int sni_cb(SSL *ssl_conn, int *ad, void *arg); -#endif -extern int X_SSL_verify_cb(int ok, X509_STORE_CTX* store); - -/* SSL_CTX methods */ -extern int X_SSL_CTX_new_index(); -extern long X_SSL_CTX_set_options(SSL_CTX* ctx, long options); -extern long X_SSL_CTX_clear_options(SSL_CTX* ctx, long options); -extern long X_SSL_CTX_get_options(SSL_CTX* ctx); -extern long X_SSL_CTX_set_mode(SSL_CTX* ctx, long modes); -extern long X_SSL_CTX_get_mode(SSL_CTX* ctx); -extern long X_SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long modes); -extern long X_SSL_CTX_sess_set_cache_size(SSL_CTX* ctx, long t); -extern long X_SSL_CTX_sess_get_cache_size(SSL_CTX* ctx); -extern long X_SSL_CTX_set_timeout(SSL_CTX* ctx, long t); -extern long X_SSL_CTX_get_timeout(SSL_CTX* ctx); -extern long X_SSL_CTX_add_extra_chain_cert(SSL_CTX* ctx, X509 *cert); -extern long X_SSL_CTX_set_tmp_ecdh(SSL_CTX* ctx, EC_KEY *key); -extern long X_SSL_CTX_set_tlsext_servername_callback(SSL_CTX* ctx, int (*cb)(SSL *con, int *ad, void *args)); -extern int X_SSL_CTX_verify_cb(int ok, X509_STORE_CTX* store); -extern long X_SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh); -extern long X_PEM_read_DHparams(SSL_CTX* ctx, DH *dh); -extern int X_SSL_CTX_set_tlsext_ticket_key_cb(SSL_CTX *sslctx, - int (*cb)(SSL *s, unsigned char key_name[16], - unsigned char iv[EVP_MAX_IV_LENGTH], - EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc)); -extern int X_SSL_CTX_ticket_key_cb(SSL *s, unsigned char key_name[16], - unsigned char iv[EVP_MAX_IV_LENGTH], - EVP_CIPHER_CTX *cctx, HMAC_CTX *hctx, int enc); - -/* BIO methods */ -extern int X_BIO_get_flags(BIO *b); -extern void X_BIO_set_flags(BIO *bio, int flags); -extern void X_BIO_clear_flags(BIO *bio, int flags); -extern void X_BIO_set_data(BIO *bio, void* data); -extern void *X_BIO_get_data(BIO *bio); -extern int X_BIO_read(BIO *b, void *buf, int len); -extern int X_BIO_write(BIO *b, const void *buf, int len); -extern BIO *X_BIO_new_write_bio(); -extern BIO *X_BIO_new_read_bio(); - -/* EVP methods */ -extern const int X_ED25519_SUPPORT; -extern int X_EVP_PKEY_ED25519; -extern const EVP_MD *X_EVP_get_digestbyname(const char *name); -extern EVP_MD_CTX *X_EVP_MD_CTX_new(); -extern void X_EVP_MD_CTX_free(EVP_MD_CTX *ctx); -extern const EVP_MD *X_EVP_md_null(); -extern const EVP_MD *X_EVP_md5(); -extern const EVP_MD *X_EVP_md4(); -extern const EVP_MD *X_EVP_sha(); -extern const EVP_MD *X_EVP_sha1(); -extern const EVP_MD *X_EVP_dss(); -extern const EVP_MD *X_EVP_dss1(); -extern const EVP_MD *X_EVP_ripemd160(); -extern const EVP_MD *X_EVP_sha224(); -extern const EVP_MD *X_EVP_sha256(); -extern const EVP_MD *X_EVP_sha384(); -extern const EVP_MD *X_EVP_sha512(); -extern int X_EVP_MD_size(const EVP_MD *md); -extern int X_EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); -extern int X_EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); -extern int X_EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); -extern int X_EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); -extern int X_EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); -extern int X_EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); -extern int X_EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen, const unsigned char *tbs, size_t tbslen); -extern EVP_PKEY *X_EVP_PKEY_new(void); -extern void X_EVP_PKEY_free(EVP_PKEY *pkey); -extern int X_EVP_PKEY_size(EVP_PKEY *pkey); -extern struct rsa_st *X_EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -extern int X_EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); -extern int X_EVP_PKEY_assign_charp(EVP_PKEY *pkey, int type, char *key); -extern int X_EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, EVP_PKEY *pkey); -extern int X_EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); -extern int X_EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); -extern int X_EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey); -extern int X_EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); -extern int X_EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, size_t siglen, const unsigned char *tbs, size_t tbslen); -extern int X_EVP_CIPHER_block_size(EVP_CIPHER *c); -extern int X_EVP_CIPHER_key_length(EVP_CIPHER *c); -extern int X_EVP_CIPHER_iv_length(EVP_CIPHER *c); -extern int X_EVP_CIPHER_nid(EVP_CIPHER *c); -extern int X_EVP_CIPHER_CTX_block_size(EVP_CIPHER_CTX *ctx); -extern int X_EVP_CIPHER_CTX_key_length(EVP_CIPHER_CTX *ctx); -extern int X_EVP_CIPHER_CTX_iv_length(EVP_CIPHER_CTX *ctx); -extern void X_EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int padding); -extern const EVP_CIPHER *X_EVP_CIPHER_CTX_cipher(EVP_CIPHER_CTX *ctx); -extern int X_EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -extern int X_EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid); - -/* HMAC methods */ -extern size_t X_HMAC_size(const HMAC_CTX *e); -extern HMAC_CTX *X_HMAC_CTX_new(void); -extern void X_HMAC_CTX_free(HMAC_CTX *ctx); -extern int X_HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md, ENGINE *impl); -extern int X_HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); -extern int X_HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); - -/* X509 methods */ -extern int X_X509_add_ref(X509* x509); -extern const ASN1_TIME *X_X509_get0_notBefore(const X509 *x); -extern const ASN1_TIME *X_X509_get0_notAfter(const X509 *x); -extern int X_sk_X509_num(STACK_OF(X509) *sk); -extern X509 *X_sk_X509_value(STACK_OF(X509)* sk, int i); -extern long X_X509_get_version(const X509 *x); -extern int X_X509_set_version(X509 *x, long version); - -/* PEM methods */ -extern int X_PEM_write_bio_PrivateKey_traditional(BIO *bio, EVP_PKEY *key, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); diff --git a/vendor/github.com/spacemonkeygo/openssl/sni.c b/vendor/github.com/spacemonkeygo/openssl/sni.c deleted file mode 100644 index f9e8d16b..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/sni.c +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "_cgo_export.h" -#include - -int sni_cb(SSL *con, int *ad, void *arg) { - SSL_CTX* ssl_ctx = ssl_ctx = SSL_get_SSL_CTX(con); - void* p = SSL_CTX_get_ex_data(ssl_ctx, get_ssl_ctx_idx()); - return sni_cb_thunk(p, con, ad, arg); -} diff --git a/vendor/github.com/spacemonkeygo/openssl/ssl.go b/vendor/github.com/spacemonkeygo/openssl/ssl.go deleted file mode 100644 index 117c30c0..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/ssl.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "os" - "unsafe" -) - -type SSLTLSExtErr int - -const ( - SSLTLSExtErrOK SSLTLSExtErr = C.SSL_TLSEXT_ERR_OK - SSLTLSExtErrAlertWarning SSLTLSExtErr = C.SSL_TLSEXT_ERR_ALERT_WARNING - SSLTLSEXTErrAlertFatal SSLTLSExtErr = C.SSL_TLSEXT_ERR_ALERT_FATAL - SSLTLSEXTErrNoAck SSLTLSExtErr = C.SSL_TLSEXT_ERR_NOACK -) - -var ( - ssl_idx = C.X_SSL_new_index() -) - -//export get_ssl_idx -func get_ssl_idx() C.int { - return ssl_idx -} - -type SSL struct { - ssl *C.SSL - verify_cb VerifyCallback -} - -//export go_ssl_verify_cb_thunk -func go_ssl_verify_cb_thunk(p unsafe.Pointer, ok C.int, ctx *C.X509_STORE_CTX) C.int { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: verify callback panic'd: %v", err) - os.Exit(1) - } - }() - verify_cb := (*SSL)(p).verify_cb - // set up defaults just in case verify_cb is nil - if verify_cb != nil { - store := &CertificateStoreCtx{ctx: ctx} - if verify_cb(ok == 1, store) { - ok = 1 - } else { - ok = 0 - } - } - return ok -} - -// Wrapper around SSL_get_servername. Returns server name according to rfc6066 -// http://tools.ietf.org/html/rfc6066. -func (s *SSL) GetServername() string { - return C.GoString(C.SSL_get_servername(s.ssl, C.TLSEXT_NAMETYPE_host_name)) -} - -// GetOptions returns SSL options. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html -func (s *SSL) GetOptions() Options { - return Options(C.X_SSL_get_options(s.ssl)) -} - -// SetOptions sets SSL options. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html -func (s *SSL) SetOptions(options Options) Options { - return Options(C.X_SSL_set_options(s.ssl, C.long(options))) -} - -// ClearOptions clear SSL options. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html -func (s *SSL) ClearOptions(options Options) Options { - return Options(C.X_SSL_clear_options(s.ssl, C.long(options))) -} - -// SetVerify controls peer verification settings. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) SetVerify(options VerifyOptions, verify_cb VerifyCallback) { - s.verify_cb = verify_cb - if verify_cb != nil { - C.SSL_set_verify(s.ssl, C.int(options), (*[0]byte)(C.X_SSL_verify_cb)) - } else { - C.SSL_set_verify(s.ssl, C.int(options), nil) - } -} - -// SetVerifyMode controls peer verification setting. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) SetVerifyMode(options VerifyOptions) { - s.SetVerify(options, s.verify_cb) -} - -// SetVerifyCallback controls peer verification setting. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) SetVerifyCallback(verify_cb VerifyCallback) { - s.SetVerify(s.VerifyMode(), verify_cb) -} - -// GetVerifyCallback returns callback function. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) GetVerifyCallback() VerifyCallback { - return s.verify_cb -} - -// VerifyMode returns peer verification setting. See -// http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) VerifyMode() VerifyOptions { - return VerifyOptions(C.SSL_get_verify_mode(s.ssl)) -} - -// SetVerifyDepth controls how many certificates deep the certificate -// verification logic is willing to follow a certificate chain. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) SetVerifyDepth(depth int) { - C.SSL_set_verify_depth(s.ssl, C.int(depth)) -} - -// GetVerifyDepth controls how many certificates deep the certificate -// verification logic is willing to follow a certificate chain. See -// https://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html -func (s *SSL) GetVerifyDepth() int { - return int(C.SSL_get_verify_depth(s.ssl)) -} - -// SetSSLCtx changes context to new one. Useful for Server Name Indication (SNI) -// rfc6066 http://tools.ietf.org/html/rfc6066. See -// http://stackoverflow.com/questions/22373332/serving-multiple-domains-in-one-box-with-sni -func (s *SSL) SetSSLCtx(ctx *Ctx) { - /* - * SSL_set_SSL_CTX() only changes certs as of 1.0.0d - * adjust other things we care about - */ - C.SSL_set_SSL_CTX(s.ssl, ctx.ctx) -} - -//export sni_cb_thunk -func sni_cb_thunk(p unsafe.Pointer, con *C.SSL, ad unsafe.Pointer, arg unsafe.Pointer) C.int { - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: verify callback sni panic'd: %v", err) - os.Exit(1) - } - }() - - sni_cb := (*Ctx)(p).sni_cb - - s := &SSL{ssl: con} - // This attaches a pointer to our SSL struct into the SNI callback. - C.SSL_set_ex_data(s.ssl, get_ssl_idx(), unsafe.Pointer(s)) - - // Note: this is ctx.sni_cb, not C.sni_cb - return C.int(sni_cb(s)) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/tickets.go b/vendor/github.com/spacemonkeygo/openssl/tickets.go deleted file mode 100644 index a064d385..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/tickets.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (C) 2017. See AUTHORS. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openssl - -// #include "shim.h" -import "C" - -import ( - "os" - "unsafe" -) - -const ( - KeyNameSize = 16 -) - -// TicketCipherCtx describes the cipher that will be used by the ticket store -// for encrypting the tickets. Engine may be nil if no engine is desired. -type TicketCipherCtx struct { - Cipher *Cipher - Engine *Engine -} - -// TicketDigestCtx describes the digest that will be used by the ticket store -// to authenticate the data. Engine may be nil if no engine is desired. -type TicketDigestCtx struct { - Digest *Digest - Engine *Engine -} - -// TicketName is an identifier for the key material for a ticket. -type TicketName [KeyNameSize]byte - -// TicketKey is the key material for a ticket. If this is lost, forward secrecy -// is lost as it allows decrypting TLS sessions retroactively. -type TicketKey struct { - Name TicketName - CipherKey []byte - HMACKey []byte - IV []byte -} - -// TicketKeyManager is a manager for TicketKeys. It allows one to control the -// lifetime of tickets, causing renewals and expirations for keys that are -// created. Calls to the manager are serialized. -type TicketKeyManager interface { - // New should create a brand new TicketKey with a new name. - New() *TicketKey - - // Current should return a key that is still valid. - Current() *TicketKey - - // Lookup should return a key with the given name, or nil if no name - // exists. - Lookup(name TicketName) *TicketKey - - // Expired should return if the key with the given name is expired and - // should not be used any more. - Expired(name TicketName) bool - - // ShouldRenew should return if the key is still ok to use for the current - // session, but we should send a new key for the client. - ShouldRenew(name TicketName) bool -} - -// TicketStore descibes the encryption and authentication methods the tickets -// will use along with a key manager for generating and keeping track of the -// secrets. -type TicketStore struct { - CipherCtx TicketCipherCtx - DigestCtx TicketDigestCtx - Keys TicketKeyManager -} - -func (t *TicketStore) cipherEngine() *C.ENGINE { - if t.CipherCtx.Engine == nil { - return nil - } - return t.CipherCtx.Engine.e -} - -func (t *TicketStore) digestEngine() *C.ENGINE { - if t.DigestCtx.Engine == nil { - return nil - } - return t.DigestCtx.Engine.e -} - -const ( - // instruct to do a handshake - ticket_resp_requireHandshake = 0 - // crypto context is set up correctly - ticket_resp_sessionOk = 1 - // crypto context is ok, but the ticket should be reissued - ticket_resp_renewSession = 2 - // we had a problem that shouldn't fall back to doing a handshake - ticket_resp_error = -1 - - // asked to create session crypto context - ticket_req_newSession = 1 - // asked to load crypto context for a previous session - ticket_req_lookupSession = 0 -) - -//export go_ticket_key_cb_thunk -func go_ticket_key_cb_thunk(p unsafe.Pointer, s *C.SSL, key_name *C.uchar, - iv *C.uchar, cctx *C.EVP_CIPHER_CTX, hctx *C.HMAC_CTX, enc C.int) C.int { - - // no panic's allowed. it's super hard to guarantee any state at this point - // so just abort everything. - defer func() { - if err := recover(); err != nil { - logger.Critf("openssl: ticket key callback panic'd: %v", err) - os.Exit(1) - } - }() - - ctx := (*Ctx)(p) - store := ctx.ticket_store - if store == nil { - // TODO(jeff): should this be an error condition? it doesn't make sense - // to be called if we don't have a store I believe, but that's probably - // not worth aborting the handshake which is what I believe returning - // an error would do. - return ticket_resp_requireHandshake - } - - ctx.ticket_store_mu.Lock() - defer ctx.ticket_store_mu.Unlock() - - switch enc { - case ticket_req_newSession: - key := store.Keys.Current() - if key == nil { - key = store.Keys.New() - if key == nil { - return ticket_resp_requireHandshake - } - } - - C.memcpy( - unsafe.Pointer(key_name), - unsafe.Pointer(&key.Name[0]), - KeyNameSize) - C.EVP_EncryptInit_ex( - cctx, - store.CipherCtx.Cipher.ptr, - store.cipherEngine(), - (*C.uchar)(&key.CipherKey[0]), - (*C.uchar)(&key.IV[0])) - C.HMAC_Init_ex( - hctx, - unsafe.Pointer(&key.HMACKey[0]), - C.int(len(key.HMACKey)), - store.DigestCtx.Digest.ptr, - store.digestEngine()) - - return ticket_resp_sessionOk - - case ticket_req_lookupSession: - var name TicketName - C.memcpy( - unsafe.Pointer(&name[0]), - unsafe.Pointer(key_name), - KeyNameSize) - - key := store.Keys.Lookup(name) - if key == nil { - return ticket_resp_requireHandshake - } - if store.Keys.Expired(name) { - return ticket_resp_requireHandshake - } - - C.EVP_DecryptInit_ex( - cctx, - store.CipherCtx.Cipher.ptr, - store.cipherEngine(), - (*C.uchar)(&key.CipherKey[0]), - (*C.uchar)(&key.IV[0])) - C.HMAC_Init_ex( - hctx, - unsafe.Pointer(&key.HMACKey[0]), - C.int(len(key.HMACKey)), - store.DigestCtx.Digest.ptr, - store.digestEngine()) - - if store.Keys.ShouldRenew(name) { - return ticket_resp_renewSession - } - - return ticket_resp_sessionOk - - default: - return ticket_resp_error - } -} - -// SetTicketStore sets the ticket store for the context so that clients can do -// ticket based session resumption. If the store is nil, the -func (c *Ctx) SetTicketStore(store *TicketStore) { - c.ticket_store = store - - if store == nil { - C.X_SSL_CTX_set_tlsext_ticket_key_cb(c.ctx, nil) - } else { - C.X_SSL_CTX_set_tlsext_ticket_key_cb(c.ctx, - (*[0]byte)(C.X_SSL_CTX_ticket_key_cb)) - } -} diff --git a/vendor/github.com/spacemonkeygo/openssl/utils/errors.go b/vendor/github.com/spacemonkeygo/openssl/utils/errors.go deleted file mode 100644 index bab314c9..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/utils/errors.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package utils - -import ( - "errors" - "strings" -) - -// ErrorGroup collates errors -type ErrorGroup struct { - Errors []error -} - -// Add adds an error to an existing error group -func (e *ErrorGroup) Add(err error) { - if err != nil { - e.Errors = append(e.Errors, err) - } -} - -// Finalize returns an error corresponding to the ErrorGroup state. If there's -// no errors in the group, finalize returns nil. If there's only one error, -// Finalize returns that error. Otherwise, Finalize will make a new error -// consisting of the messages from the constituent errors. -func (e *ErrorGroup) Finalize() error { - if len(e.Errors) == 0 { - return nil - } - if len(e.Errors) == 1 { - return e.Errors[0] - } - msgs := make([]string, 0, len(e.Errors)) - for _, err := range e.Errors { - msgs = append(msgs, err.Error()) - } - return errors.New(strings.Join(msgs, "\n")) -} diff --git a/vendor/github.com/spacemonkeygo/openssl/utils/future.go b/vendor/github.com/spacemonkeygo/openssl/utils/future.go deleted file mode 100644 index fa1bbbfb..00000000 --- a/vendor/github.com/spacemonkeygo/openssl/utils/future.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package utils - -import ( - "sync" -) - -// Future is a type that is essentially the inverse of a channel. With a -// channel, you have multiple senders and one receiver. With a future, you can -// have multiple receivers and one sender. Additionally, a future protects -// against double-sends. Since this is usually used for returning function -// results, we also capture and return error values as well. Use NewFuture -// to initialize. -type Future struct { - mutex *sync.Mutex - cond *sync.Cond - received bool - val interface{} - err error -} - -// NewFuture returns an initialized and ready Future. -func NewFuture() *Future { - mutex := &sync.Mutex{} - return &Future{ - mutex: mutex, - cond: sync.NewCond(mutex), - received: false, - val: nil, - err: nil, - } -} - -// Get blocks until the Future has a value set. -func (self *Future) Get() (interface{}, error) { - self.mutex.Lock() - defer self.mutex.Unlock() - for { - if self.received { - return self.val, self.err - } - self.cond.Wait() - } -} - -// Fired returns whether or not a value has been set. If Fired is true, Get -// won't block. -func (self *Future) Fired() bool { - self.mutex.Lock() - defer self.mutex.Unlock() - return self.received -} - -// Set provides the value to present and future Get calls. If Set has already -// been called, this is a no-op. -func (self *Future) Set(val interface{}, err error) { - self.mutex.Lock() - defer self.mutex.Unlock() - if self.received { - return - } - self.received = true - self.val = val - self.err = err - self.cond.Broadcast() -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/.travis.yml b/vendor/github.com/spacemonkeygo/spacelog/.travis.yml deleted file mode 100644 index d2b67f69..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: go - -go: - - 1.7 - - 1.8 - - tip diff --git a/vendor/github.com/spacemonkeygo/spacelog/LICENSE b/vendor/github.com/spacemonkeygo/spacelog/LICENSE deleted file mode 100644 index 37ec93a1..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/spacemonkeygo/spacelog/README.md b/vendor/github.com/spacemonkeygo/spacelog/README.md deleted file mode 100644 index 28033f68..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# spacelog [![Build Status](https://api.travis-ci.org/spacemonkeygo/spacelog.svg?branch=master)](https://travis-ci.org/spacemonkeygo/spacelog) - -Please see http://godoc.org/github.com/spacemonkeygo/spacelog for info - -### License - -Copyright (C) 2014 Space Monkey, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture.go b/vendor/github.com/spacemonkeygo/spacelog/capture.go deleted file mode 100644 index d7ea1ca3..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "fmt" - "os" - "os/exec" -) - -// CaptureOutputToFile opens a filehandle using the given path, then calls -// CaptureOutputToFd on the associated filehandle. -func CaptureOutputToFile(path string) error { - fh, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644) - if err != nil { - return err - } - defer fh.Close() - return CaptureOutputToFd(int(fh.Fd())) -} - -// CaptureOutputToProcess starts a process and using CaptureOutputToFd, -// redirects stdout and stderr to the subprocess' stdin. -// CaptureOutputToProcess expects the subcommand to last the lifetime of the -// process, and if the subprocess dies, will panic. -func CaptureOutputToProcess(command string, args ...string) error { - cmd := exec.Command(command, args...) - out, err := cmd.StdinPipe() - if err != nil { - return err - } - defer out.Close() - type fder interface { - Fd() uintptr - } - out_fder, ok := out.(fder) - if !ok { - return fmt.Errorf("unable to get underlying pipe") - } - err = CaptureOutputToFd(int(out_fder.Fd())) - if err != nil { - return err - } - err = cmd.Start() - if err != nil { - return err - } - go func() { - err := cmd.Wait() - if err != nil { - panic(fmt.Errorf("captured output process died! %s", err)) - } - }() - return nil -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture_ae.go b/vendor/github.com/spacemonkeygo/spacelog/capture_ae.go deleted file mode 100644 index f759b6f1..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture_ae.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2016 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build appengine - -package spacelog - -import ( - "fmt" -) - -func CaptureOutputToFd(fd int) error { - return fmt.Errorf("CaptureOutputToFd not supported on App Engine") -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture_linux.go b/vendor/github.com/spacemonkeygo/spacelog/capture_linux.go deleted file mode 100644 index 34a9c089..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture_linux.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !appengine - -package spacelog - -import ( - "syscall" -) - -// CaptureOutputToFd redirects the current process' stdout and stderr file -// descriptors to the given file descriptor, using the dup3 syscall. -func CaptureOutputToFd(fd int) error { - err := syscall.Dup3(fd, syscall.Stdout, 0) - if err != nil { - return err - } - err = syscall.Dup3(fd, syscall.Stderr, 0) - if err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture_other.go b/vendor/github.com/spacemonkeygo/spacelog/capture_other.go deleted file mode 100644 index 6c65051a..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture_other.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !windows -// +build !linux -// +build !appengine -// +build !solaris - -package spacelog - -import ( - "syscall" -) - -// CaptureOutputToFd redirects the current process' stdout and stderr file -// descriptors to the given file descriptor, using the dup2 syscall. -func CaptureOutputToFd(fd int) error { - err := syscall.Dup2(fd, syscall.Stdout) - if err != nil { - return err - } - err = syscall.Dup2(fd, syscall.Stderr) - if err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture_solaris.go b/vendor/github.com/spacemonkeygo/spacelog/capture_solaris.go deleted file mode 100644 index d77e4f2d..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture_solaris.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "golang.org/x/sys/unix" -) - -// CaptureOutputToFd redirects the current process' stdout and stderr file -// descriptors to the given file descriptor, using the dup2 syscall. -func CaptureOutputToFd(fd int) error { - err := unix.Dup2(fd, unix.Stdout) - if err != nil { - return err - } - err = unix.Dup2(fd, unix.Stderr) - if err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/capture_windows.go b/vendor/github.com/spacemonkeygo/spacelog/capture_windows.go deleted file mode 100644 index e9f061dc..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/capture_windows.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "fmt" -) - -func CaptureOutputToFd(fd int) error { - return fmt.Errorf("CaptureOutputToFd not supported on Windows") -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/collection.go b/vendor/github.com/spacemonkeygo/spacelog/collection.go deleted file mode 100644 index 8231b4a5..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/collection.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "regexp" - "runtime" - "strings" - "sync" - "text/template" -) - -var ( - // If set, these prefixes will be stripped out of automatic logger names. - IgnoredPrefixes []string - - badChars = regexp.MustCompile("[^a-zA-Z0-9_.-]") - slashes = regexp.MustCompile("[/]") -) - -func callerName() string { - pc, _, _, ok := runtime.Caller(2) - if !ok { - return "unknown.unknown" - } - f := runtime.FuncForPC(pc) - if f == nil { - return "unknown.unknown" - } - name := f.Name() - for _, prefix := range IgnoredPrefixes { - name = strings.TrimPrefix(name, prefix) - } - return badChars.ReplaceAllLiteralString( - slashes.ReplaceAllLiteralString(name, "."), "_") -} - -// LoggerCollections contain all of the loggers a program might use. Typically -// a codebase will just use the default logger collection. -type LoggerCollection struct { - mtx sync.Mutex - loggers map[string]*Logger - level LogLevel - handler Handler -} - -// NewLoggerCollection creates a new logger collection. It's unlikely you will -// ever practically need this method. Use the DefaultLoggerCollection instead. -func NewLoggerCollection() *LoggerCollection { - return &LoggerCollection{ - loggers: make(map[string]*Logger), - level: DefaultLevel, - handler: defaultHandler} -} - -// GetLogger returns a new Logger with a name automatically generated using -// the callstack. If you want to avoid automatic name generation check out -// GetLoggerNamed -func (c *LoggerCollection) GetLogger() *Logger { - return c.GetLoggerNamed(callerName()) -} - -func (c *LoggerCollection) getLogger(name string, level LogLevel, - handler Handler) *Logger { - c.mtx.Lock() - defer c.mtx.Unlock() - - logger, exists := c.loggers[name] - if !exists { - logger = &Logger{level: level, - collection: c, - name: name, - handler: handler} - c.loggers[name] = logger - } - return logger -} - -// ConfigureLoggers configures loggers according to the given string -// specification, which specifies a set of loggers and their associated -// logging levels. Loggers are semicolon-separated; each -// configuration is specified as =. White space outside of -// logger names and levels is ignored. The default level is specified -// with the name "DEFAULT". -// -// An example specification: -// `DEFAULT=ERROR; foo.bar=WARNING` -func (c *LoggerCollection) ConfigureLoggers(specification string) error { - confs := strings.Split(strings.TrimSpace(specification), ";") - for i := range confs { - conf := strings.SplitN(confs[i], "=", 2) - levelstr := strings.TrimSpace(conf[1]) - name := strings.TrimSpace(conf[0]) - level, err := LevelFromString(levelstr) - if err != nil { - return err - } - if name == "DEFAULT" { - c.SetLevel(nil, level) - continue - } - logger := c.GetLoggerNamed(name) - logger.setLevel(level) - } - return nil -} - -// GetLoggerNamed returns a new Logger with the provided name. GetLogger is -// more frequently used. -func (c *LoggerCollection) GetLoggerNamed(name string) *Logger { - c.mtx.Lock() - defer c.mtx.Unlock() - - logger, exists := c.loggers[name] - if !exists { - logger = &Logger{level: c.level, - collection: c, - name: name, - handler: c.handler} - c.loggers[name] = logger - } - return logger -} - -// SetLevel will set the current log level for all loggers with names that -// match a provided regular expression. If the regular expression is nil, then -// all loggers match. -func (c *LoggerCollection) SetLevel(re *regexp.Regexp, level LogLevel) { - c.mtx.Lock() - defer c.mtx.Unlock() - - if re == nil { - c.level = level - } - for name, logger := range c.loggers { - if re == nil || re.MatchString(name) { - logger.setLevel(level) - } - } -} - -// SetHandler will set the current log handler for all loggers with names that -// match a provided regular expression. If the regular expression is nil, then -// all loggers match. -func (c *LoggerCollection) SetHandler(re *regexp.Regexp, handler Handler) { - c.mtx.Lock() - defer c.mtx.Unlock() - - if re == nil { - c.handler = handler - } - for name, logger := range c.loggers { - if re == nil || re.MatchString(name) { - logger.setHandler(handler) - } - } -} - -// SetTextTemplate will set the current text template for all loggers with -// names that match a provided regular expression. If the regular expression -// is nil, then all loggers match. Note that not every handler is guaranteed -// to support text templates and a text template will only apply to -// text-oriented and unstructured handlers. -func (c *LoggerCollection) SetTextTemplate(re *regexp.Regexp, - t *template.Template) { - c.mtx.Lock() - defer c.mtx.Unlock() - - if re == nil { - c.handler.SetTextTemplate(t) - } - for name, logger := range c.loggers { - if re == nil || re.MatchString(name) { - logger.getHandler().SetTextTemplate(t) - } - } -} - -// SetTextOutput will set the current output interface for all loggers with -// names that match a provided regular expression. If the regular expression -// is nil, then all loggers match. Note that not every handler is guaranteed -// to support text output and a text output interface will only apply to -// text-oriented and unstructured handlers. -func (c *LoggerCollection) SetTextOutput(re *regexp.Regexp, - output TextOutput) { - c.mtx.Lock() - defer c.mtx.Unlock() - - if re == nil { - c.handler.SetTextOutput(output) - } - for name, logger := range c.loggers { - if re == nil || re.MatchString(name) { - logger.getHandler().SetTextOutput(output) - } - } -} - -var ( - // It's unlikely you'll need to use this directly - DefaultLoggerCollection = NewLoggerCollection() -) - -// GetLogger returns an automatically-named logger on the default logger -// collection. -func GetLogger() *Logger { - return DefaultLoggerCollection.GetLoggerNamed(callerName()) -} - -// GetLoggerNamed returns a new Logger with the provided name on the default -// logger collection. GetLogger is more frequently used. -func GetLoggerNamed(name string) *Logger { - return DefaultLoggerCollection.GetLoggerNamed(name) -} - -// ConfigureLoggers configures loggers according to the given string -// specification, which specifies a set of loggers and their associated -// logging levels. Loggers are colon- or semicolon-separated; each -// configuration is specified as =. White space outside of -// logger names and levels is ignored. The DEFAULT module is specified -// with the name "DEFAULT". -// -// An example specification: -// `DEFAULT=ERROR; foo.bar=WARNING` -func ConfigureLoggers(specification string) error { - return DefaultLoggerCollection.ConfigureLoggers(specification) -} - -// SetLevel will set the current log level for all loggers on the default -// collection with names that match a provided regular expression. If the -// regular expression is nil, then all loggers match. -func SetLevel(re *regexp.Regexp, level LogLevel) { - DefaultLoggerCollection.SetLevel(re, level) -} - -// SetHandler will set the current log handler for all loggers on the default -// collection with names that match a provided regular expression. If the -// regular expression is nil, then all loggers match. -func SetHandler(re *regexp.Regexp, handler Handler) { - DefaultLoggerCollection.SetHandler(re, handler) -} - -// SetTextTemplate will set the current text template for all loggers on the -// default collection with names that match a provided regular expression. If -// the regular expression is nil, then all loggers match. Note that not every -// handler is guaranteed to support text templates and a text template will -// only apply to text-oriented and unstructured handlers. -func SetTextTemplate(re *regexp.Regexp, t *template.Template) { - DefaultLoggerCollection.SetTextTemplate(re, t) -} - -// SetTextOutput will set the current output interface for all loggers on the -// default collection with names that match a provided regular expression. If -// the regular expression is nil, then all loggers match. Note that not every -// handler is guaranteed to support text output and a text output interface -// will only apply to text-oriented and unstructured handlers. -func SetTextOutput(re *regexp.Regexp, output TextOutput) { - DefaultLoggerCollection.SetTextOutput(re, output) -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/convenience.go b/vendor/github.com/spacemonkeygo/spacelog/convenience.go deleted file mode 100644 index b3056329..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/convenience.go +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "fmt" - "io" -) - -// Trace logs a collection of values if the logger's level is trace or even -// more permissive. -func (l *Logger) Trace(v ...interface{}) { - if l.getLevel() <= Trace { - l.getHandler().Log(l.name, Trace, fmt.Sprint(v...), 1) - } -} - -// Tracef logs a format string with values if the logger's level is trace or -// even more permissive. -func (l *Logger) Tracef(format string, v ...interface{}) { - if l.getLevel() <= Trace { - l.getHandler().Log(l.name, Trace, fmt.Sprintf(format, v...), 1) - } -} - -// Tracee logs an error value if the error is not nil and the logger's level -// is trace or even more permissive. -func (l *Logger) Tracee(err error) { - if l.getLevel() <= Trace && err != nil { - l.getHandler().Log(l.name, Trace, err.Error(), 1) - } -} - -// TraceEnabled returns true if the logger's level is trace or even more -// permissive. -func (l *Logger) TraceEnabled() bool { - return l.getLevel() <= Trace -} - -// Debug logs a collection of values if the logger's level is debug or even -// more permissive. -func (l *Logger) Debug(v ...interface{}) { - if l.getLevel() <= Debug { - l.getHandler().Log(l.name, Debug, fmt.Sprint(v...), 1) - } -} - -// Debugf logs a format string with values if the logger's level is debug or -// even more permissive. -func (l *Logger) Debugf(format string, v ...interface{}) { - if l.getLevel() <= Debug { - l.getHandler().Log(l.name, Debug, fmt.Sprintf(format, v...), 1) - } -} - -// Debuge logs an error value if the error is not nil and the logger's level -// is debug or even more permissive. -func (l *Logger) Debuge(err error) { - if l.getLevel() <= Debug && err != nil { - l.getHandler().Log(l.name, Debug, err.Error(), 1) - } -} - -// DebugEnabled returns true if the logger's level is debug or even more -// permissive. -func (l *Logger) DebugEnabled() bool { - return l.getLevel() <= Debug -} - -// Info logs a collection of values if the logger's level is info or even -// more permissive. -func (l *Logger) Info(v ...interface{}) { - if l.getLevel() <= Info { - l.getHandler().Log(l.name, Info, fmt.Sprint(v...), 1) - } -} - -// Infof logs a format string with values if the logger's level is info or -// even more permissive. -func (l *Logger) Infof(format string, v ...interface{}) { - if l.getLevel() <= Info { - l.getHandler().Log(l.name, Info, fmt.Sprintf(format, v...), 1) - } -} - -// Infoe logs an error value if the error is not nil and the logger's level -// is info or even more permissive. -func (l *Logger) Infoe(err error) { - if l.getLevel() <= Info && err != nil { - l.getHandler().Log(l.name, Info, err.Error(), 1) - } -} - -// InfoEnabled returns true if the logger's level is info or even more -// permissive. -func (l *Logger) InfoEnabled() bool { - return l.getLevel() <= Info -} - -// Notice logs a collection of values if the logger's level is notice or even -// more permissive. -func (l *Logger) Notice(v ...interface{}) { - if l.getLevel() <= Notice { - l.getHandler().Log(l.name, Notice, fmt.Sprint(v...), 1) - } -} - -// Noticef logs a format string with values if the logger's level is notice or -// even more permissive. -func (l *Logger) Noticef(format string, v ...interface{}) { - if l.getLevel() <= Notice { - l.getHandler().Log(l.name, Notice, fmt.Sprintf(format, v...), 1) - } -} - -// Noticee logs an error value if the error is not nil and the logger's level -// is notice or even more permissive. -func (l *Logger) Noticee(err error) { - if l.getLevel() <= Notice && err != nil { - l.getHandler().Log(l.name, Notice, err.Error(), 1) - } -} - -// NoticeEnabled returns true if the logger's level is notice or even more -// permissive. -func (l *Logger) NoticeEnabled() bool { - return l.getLevel() <= Notice -} - -// Warn logs a collection of values if the logger's level is warning or even -// more permissive. -func (l *Logger) Warn(v ...interface{}) { - if l.getLevel() <= Warning { - l.getHandler().Log(l.name, Warning, fmt.Sprint(v...), 1) - } -} - -// Warnf logs a format string with values if the logger's level is warning or -// even more permissive. -func (l *Logger) Warnf(format string, v ...interface{}) { - if l.getLevel() <= Warning { - l.getHandler().Log(l.name, Warning, fmt.Sprintf(format, v...), 1) - } -} - -// Warne logs an error value if the error is not nil and the logger's level -// is warning or even more permissive. -func (l *Logger) Warne(err error) { - if l.getLevel() <= Warning && err != nil { - l.getHandler().Log(l.name, Warning, err.Error(), 1) - } -} - -// WarnEnabled returns true if the logger's level is warning or even more -// permissive. -func (l *Logger) WarnEnabled() bool { - return l.getLevel() <= Warning -} - -// Error logs a collection of values if the logger's level is error or even -// more permissive. -func (l *Logger) Error(v ...interface{}) { - if l.getLevel() <= Error { - l.getHandler().Log(l.name, Error, fmt.Sprint(v...), 1) - } -} - -// Errorf logs a format string with values if the logger's level is error or -// even more permissive. -func (l *Logger) Errorf(format string, v ...interface{}) { - if l.getLevel() <= Error { - l.getHandler().Log(l.name, Error, fmt.Sprintf(format, v...), 1) - } -} - -// Errore logs an error value if the error is not nil and the logger's level -// is error or even more permissive. -func (l *Logger) Errore(err error) { - if l.getLevel() <= Error && err != nil { - l.getHandler().Log(l.name, Error, err.Error(), 1) - } -} - -// ErrorEnabled returns true if the logger's level is error or even more -// permissive. -func (l *Logger) ErrorEnabled() bool { - return l.getLevel() <= Error -} - -// Crit logs a collection of values if the logger's level is critical or even -// more permissive. -func (l *Logger) Crit(v ...interface{}) { - if l.getLevel() <= Critical { - l.getHandler().Log(l.name, Critical, fmt.Sprint(v...), 1) - } -} - -// Critf logs a format string with values if the logger's level is critical or -// even more permissive. -func (l *Logger) Critf(format string, v ...interface{}) { - if l.getLevel() <= Critical { - l.getHandler().Log(l.name, Critical, fmt.Sprintf(format, v...), 1) - } -} - -// Crite logs an error value if the error is not nil and the logger's level -// is critical or even more permissive. -func (l *Logger) Crite(err error) { - if l.getLevel() <= Critical && err != nil { - l.getHandler().Log(l.name, Critical, err.Error(), 1) - } -} - -// CritEnabled returns true if the logger's level is critical or even more -// permissive. -func (l *Logger) CritEnabled() bool { - return l.getLevel() <= Critical -} - -// Log logs a collection of values if the logger's level is the provided level -// or even more permissive. -func (l *Logger) Log(level LogLevel, v ...interface{}) { - if l.getLevel() <= level { - l.getHandler().Log(l.name, level, fmt.Sprint(v...), 1) - } -} - -// Logf logs a format string with values if the logger's level is the provided -// level or even more permissive. -func (l *Logger) Logf(level LogLevel, format string, v ...interface{}) { - if l.getLevel() <= level { - l.getHandler().Log(l.name, level, fmt.Sprintf(format, v...), 1) - } -} - -// Loge logs an error value if the error is not nil and the logger's level -// is the provided level or even more permissive. -func (l *Logger) Loge(level LogLevel, err error) { - if l.getLevel() <= level && err != nil { - l.getHandler().Log(l.name, level, err.Error(), 1) - } -} - -// LevelEnabled returns true if the logger's level is the provided level or -// even more permissive. -func (l *Logger) LevelEnabled(level LogLevel) bool { - return l.getLevel() <= level -} - -type writer struct { - l *Logger - level LogLevel -} - -func (w *writer) Write(data []byte) (int, error) { - if w.l.getLevel() <= w.level { - w.l.getHandler().Log(w.l.name, w.level, string(data), 1) - } - return len(data), nil -} - -// Writer returns an io.Writer that writes messages at the given log level. -func (l *Logger) Writer(level LogLevel) io.Writer { - return &writer{l: l, level: level} -} - -type writerNoCaller struct { - l *Logger - level LogLevel -} - -func (w *writerNoCaller) Write(data []byte) (int, error) { - if w.l.getLevel() <= w.level { - w.l.getHandler().Log(w.l.name, w.level, string(data), -1) - } - return len(data), nil -} - -// WriterWithoutCaller returns an io.Writer that writes messages at the given -// log level, but does not attempt to collect the Write caller, and provides -// no caller information to the log event. -func (l *Logger) WriterWithoutCaller(level LogLevel) io.Writer { - return &writerNoCaller{l: l, level: level} -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/doc.go b/vendor/github.com/spacemonkeygo/spacelog/doc.go deleted file mode 100644 index 28c25b4d..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/doc.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package spacelog is a collection of interface lego bricks designed to help you -build a flexible logging system. - -spacelog is loosely inspired by the Python logging library. - -The basic interaction is between a Logger and a Handler. A Logger is -what the programmer typically interacts with for creating log messages. A -Logger will be at a given log level, and if log messages can clear that -specific logger's log level filter, they will be passed off to the Handler. - -Loggers are instantiated from GetLogger and GetLoggerNamed. - -A Handler is a very generic interface for handling log events. You can provide -your own Handler for doing structured JSON output or colorized output or -countless other things. - -Provided are a simple TextHandler with a variety of log event templates and -TextOutput sinks, such as io.Writer, Syslog, and so forth. - -Make sure to see the source of the setup subpackage for an example of easy and -configurable logging setup at process start: - http://godoc.org/github.com/spacemonkeygo/spacelog/setup -*/ -package spacelog diff --git a/vendor/github.com/spacemonkeygo/spacelog/event.go b/vendor/github.com/spacemonkeygo/spacelog/event.go deleted file mode 100644 index da863cbf..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/event.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "path/filepath" - "strings" - "time" -) - -// TermColors is a type that knows how to output terminal colors and formatting -type TermColors struct{} - -// LogEvent is a type made by the default text handler for feeding to log -// templates. It has as much contextual data about the log event as possible. -type LogEvent struct { - LoggerName string - Level LogLevel - Message string - Filepath string - Line int - Timestamp time.Time - - TermColors -} - -// Reset resets the color palette for terminals that support color -func (TermColors) Reset() string { return "\x1b[0m" } -func (TermColors) Bold() string { return "\x1b[1m" } -func (TermColors) Underline() string { return "\x1b[4m" } -func (TermColors) Black() string { return "\x1b[30m" } -func (TermColors) Red() string { return "\x1b[31m" } -func (TermColors) Green() string { return "\x1b[32m" } -func (TermColors) Yellow() string { return "\x1b[33m" } -func (TermColors) Blue() string { return "\x1b[34m" } -func (TermColors) Magenta() string { return "\x1b[35m" } -func (TermColors) Cyan() string { return "\x1b[36m" } -func (TermColors) White() string { return "\x1b[37m" } - -func (l *LogEvent) Filename() string { - if l.Filepath == "" { - return "" - } - return filepath.Base(l.Filepath) -} - -func (l *LogEvent) Time() string { - return l.Timestamp.Format("15:04:05") -} - -func (l *LogEvent) Date() string { - return l.Timestamp.Format("2006/01/02") -} - -// LevelJustified returns the log level in string form justified so that all -// log levels take the same text width. -func (l *LogEvent) LevelJustified() (rv string) { - rv = l.Level.String() - if len(rv) < 5 { - rv += strings.Repeat(" ", 5-len(rv)) - } - return rv -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/handler.go b/vendor/github.com/spacemonkeygo/spacelog/handler.go deleted file mode 100644 index e3db0865..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/handler.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "text/template" -) - -// Handler is an interface that knows how to process log events. This is the -// basic interface type for building a logging system. If you want to route -// structured log data somewhere, you would implement this interface. -type Handler interface { - // Log is called for every message. if calldepth is negative, caller - // information is missing - Log(logger_name string, level LogLevel, msg string, calldepth int) - - // These two calls are expected to be no-ops on non-text-output handlers - SetTextTemplate(t *template.Template) - SetTextOutput(output TextOutput) -} - -// HandlerFunc is a type to make implementation of the Handler interface easier -type HandlerFunc func(logger_name string, level LogLevel, msg string, - calldepth int) - -// Log simply calls f(logger_name, level, msg, calldepth) -func (f HandlerFunc) Log(logger_name string, level LogLevel, msg string, - calldepth int) { - f(logger_name, level, msg, calldepth) -} - -// SetTextTemplate is a no-op -func (HandlerFunc) SetTextTemplate(t *template.Template) {} - -// SetTextOutput is a no-op -func (HandlerFunc) SetTextOutput(output TextOutput) {} - -var ( - defaultHandler = NewTextHandler(StdlibTemplate, - &StdlibOutput{}) -) diff --git a/vendor/github.com/spacemonkeygo/spacelog/level.go b/vendor/github.com/spacemonkeygo/spacelog/level.go deleted file mode 100644 index bf507075..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/level.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "fmt" - "strconv" - "strings" -) - -type LogLevel int32 - -const ( - Trace LogLevel = 5 - Debug LogLevel = 10 - Info LogLevel = 20 - Notice LogLevel = 30 - Warning LogLevel = 40 - Error LogLevel = 50 - Critical LogLevel = 60 - // syslog has Alert - // syslog has Emerg - - DefaultLevel = Notice -) - -// String returns the log level name in short form -func (l LogLevel) String() string { - switch l.Match() { - case Critical: - return "CRIT" - case Error: - return "ERR" - case Warning: - return "WARN" - case Notice: - return "NOTE" - case Info: - return "INFO" - case Debug: - return "DEBUG" - case Trace: - return "TRACE" - default: - return "UNSET" - } -} - -// String returns the log level name in long human readable form -func (l LogLevel) Name() string { - switch l.Match() { - case Critical: - return "critical" - case Error: - return "error" - case Warning: - return "warning" - case Notice: - return "notice" - case Info: - return "info" - case Debug: - return "debug" - case Trace: - return "trace" - default: - return "unset" - } -} - -// Match returns the greatest named log level that is less than or equal to -// the receiver log level. For example, if the log level is 43, Match() will -// return 40 (Warning) -func (l LogLevel) Match() LogLevel { - if l >= Critical { - return Critical - } - if l >= Error { - return Error - } - if l >= Warning { - return Warning - } - if l >= Notice { - return Notice - } - if l >= Info { - return Info - } - if l >= Debug { - return Debug - } - if l >= Trace { - return Trace - } - return 0 -} - -// LevelFromString will convert a named log level to its corresponding value -// type, or error if both the name was unknown and an integer value was unable -// to be parsed. -func LevelFromString(str string) (LogLevel, error) { - switch strings.ToLower(str) { - case "crit", "critical": - return Critical, nil - case "err", "error": - return Error, nil - case "warn", "warning": - return Warning, nil - case "note", "notice": - return Notice, nil - case "info": - return Info, nil - case "debug": - return Debug, nil - case "trace": - return Trace, nil - } - val, err := strconv.ParseInt(str, 10, 32) - if err == nil { - return LogLevel(val), nil - } - return 0, fmt.Errorf("Invalid log level: %s", str) -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/logger.go b/vendor/github.com/spacemonkeygo/spacelog/logger.go deleted file mode 100644 index ae1734b2..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/logger.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "sync" - "sync/atomic" -) - -// Logger is the basic type that allows for logging. A logger has an associated -// name, given to it during construction, either through a logger collection, -// GetLogger, GetLoggerNamed, or another Logger's Scope method. A logger also -// has an associated level and handler, typically configured through the logger -// collection to which it belongs. -type Logger struct { - level LogLevel - name string - collection *LoggerCollection - - handler_mtx sync.RWMutex - handler Handler -} - -// Scope returns a new Logger with the same level and handler, using the -// receiver Logger's name as a prefix. -func (l *Logger) Scope(name string) *Logger { - return l.collection.getLogger(l.name+"."+name, l.getLevel(), - l.getHandler()) -} - -func (l *Logger) setLevel(level LogLevel) { - atomic.StoreInt32((*int32)(&l.level), int32(level)) -} - -func (l *Logger) getLevel() LogLevel { - return LogLevel(atomic.LoadInt32((*int32)(&l.level))) -} - -func (l *Logger) setHandler(handler Handler) { - l.handler_mtx.Lock() - defer l.handler_mtx.Unlock() - l.handler = handler -} - -func (l *Logger) getHandler() Handler { - l.handler_mtx.RLock() - defer l.handler_mtx.RUnlock() - return l.handler -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/output.go b/vendor/github.com/spacemonkeygo/spacelog/output.go deleted file mode 100644 index 8751268f..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/output.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "bytes" - "fmt" - "io" - "log" - "os" - "sync" -) - -type TextOutput interface { - Output(LogLevel, []byte) -} - -// WriterOutput is an io.Writer wrapper that matches the TextOutput interface -type WriterOutput struct { - w io.Writer -} - -// NewWriterOutput returns a TextOutput that writes messages to an io.Writer -func NewWriterOutput(w io.Writer) *WriterOutput { - return &WriterOutput{w: w} -} - -func (o *WriterOutput) Output(_ LogLevel, message []byte) { - o.w.Write(append(bytes.TrimRight(message, "\r\n"), platformNewline...)) -} - -// StdlibOutput is a TextOutput that simply writes to the default Go stdlib -// logging system. It is the default. If you configure the Go stdlib to write -// to spacelog, make sure to provide a new TextOutput to your logging -// collection -type StdlibOutput struct{} - -func (*StdlibOutput) Output(_ LogLevel, message []byte) { - log.Print(string(message)) -} - -type bufferMsg struct { - level LogLevel - message []byte -} - -// BufferedOutput uses a channel to synchronize writes to a wrapped TextOutput -// and allows for buffering a limited amount of log events. -type BufferedOutput struct { - o TextOutput - c chan bufferMsg - running sync.Mutex - close_once sync.Once -} - -// NewBufferedOutput returns a BufferedOutput wrapping output with a buffer -// size of buffer. -func NewBufferedOutput(output TextOutput, buffer int) *BufferedOutput { - if buffer < 0 { - buffer = 0 - } - b := &BufferedOutput{ - o: output, - c: make(chan bufferMsg, buffer)} - go b.process() - return b -} - -// Close shuts down the BufferedOutput's processing -func (b *BufferedOutput) Close() { - b.close_once.Do(func() { - close(b.c) - }) - b.running.Lock() - b.running.Unlock() -} - -func (b *BufferedOutput) Output(level LogLevel, message []byte) { - b.c <- bufferMsg{level: level, message: message} -} - -func (b *BufferedOutput) process() { - b.running.Lock() - defer b.running.Unlock() - for { - msg, open := <-b.c - if !open { - break - } - b.o.Output(msg.level, msg.message) - } -} - -// A TextOutput object that also implements HupHandlingTextOutput may have its -// OnHup() method called when an administrative signal is sent to this process. -type HupHandlingTextOutput interface { - TextOutput - OnHup() -} - -// FileWriterOutput is like WriterOutput with a plain file handle, but it -// knows how to reopen the file (or try to reopen it) if it hasn't been able -// to open the file previously, or if an appropriate signal has been received. -type FileWriterOutput struct { - *WriterOutput - path string -} - -// Creates a new FileWriterOutput object. This is the only case where an -// error opening the file will be reported to the caller; if we try to -// reopen it later and the reopen fails, we'll just keep trying until it -// works. -func NewFileWriterOutput(path string) (*FileWriterOutput, error) { - fo := &FileWriterOutput{path: path} - fh, err := fo.openFile() - if err != nil { - return nil, err - } - fo.WriterOutput = NewWriterOutput(fh) - return fo, nil -} - -// Try to open the file with the path associated with this object. -func (fo *FileWriterOutput) openFile() (*os.File, error) { - return os.OpenFile(fo.path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) -} - -// Try to communicate a message without using our log file. In all likelihood, -// stderr is closed or redirected to /dev/null, but at least we can try -// writing there. In the very worst case, if an admin attaches a ptrace to -// this process, it will be more clear what the problem is. -func (fo *FileWriterOutput) fallbackLog(tmpl string, args ...interface{}) { - fmt.Fprintf(os.Stderr, tmpl, args...) -} - -// Output a log line by writing it to the file. If the file has been -// released, try to open it again. If that fails, cry for a little -// while, then throw away the message and carry on. -func (fo *FileWriterOutput) Output(ll LogLevel, message []byte) { - if fo.WriterOutput == nil { - fh, err := fo.openFile() - if err != nil { - fo.fallbackLog("Could not open %#v: %s", fo.path, err) - return - } - fo.WriterOutput = NewWriterOutput(fh) - } - fo.WriterOutput.Output(ll, message) -} - -// Throw away any references/handles to the output file. This probably -// means the admin wants to rotate the file out and have this process -// open a new one. Close the underlying io.Writer if that is a thing -// that it knows how to do. -func (fo *FileWriterOutput) OnHup() { - if fo.WriterOutput != nil { - wc, ok := fo.WriterOutput.w.(io.Closer) - if ok { - err := wc.Close() - if err != nil { - fo.fallbackLog("Closing %#v failed: %s", fo.path, err) - } - } - fo.WriterOutput = nil - } -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/output_other.go b/vendor/github.com/spacemonkeygo/spacelog/output_other.go deleted file mode 100644 index 2be240a1..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/output_other.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !windows - -package spacelog - -var platformNewline = []byte("\n") diff --git a/vendor/github.com/spacemonkeygo/spacelog/output_windows.go b/vendor/github.com/spacemonkeygo/spacelog/output_windows.go deleted file mode 100644 index 58b71dab..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/output_windows.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -var platformNewline = []byte("\r\n") diff --git a/vendor/github.com/spacemonkeygo/spacelog/setup.go b/vendor/github.com/spacemonkeygo/spacelog/setup.go deleted file mode 100644 index 2c1cbcee..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/setup.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "bytes" - "fmt" - "log" - "math" - "os" - "os/signal" - "regexp" - "strings" - "text/template" -) - -// SetupConfig is a configuration struct meant to be used with -// github.com/spacemonkeygo/flagfile/utils.Setup -// but can be used independently. -type SetupConfig struct { - Output string `default:"stderr" usage:"log output. can be stdout, stderr, syslog, or a path"` - Level string `default:"" usage:"base logger level"` - Filter string `default:"" usage:"sets loggers matching this regular expression to the lowest level"` - Format string `default:"" usage:"format string to use"` - Stdlevel string `default:"warn" usage:"logger level for stdlib log integration"` - Subproc string `default:"" usage:"process to run for stdout/stderr-captured logging. The command is first processed as a Go template that supports {{.Facility}}, {{.Level}}, and {{.Name}} fields, and then passed to sh. If set, will redirect stdout and stderr to the given process. A good default is 'setsid logger --priority {{.Facility}}.{{.Level}} --tag {{.Name}}'"` - Buffer int `default:"0" usage:"the number of messages to buffer. 0 for no buffer"` - // Facility defaults to syslog.LOG_USER (which is 8) - Facility int `default:"8" usage:"the syslog facility to use if syslog output is configured"` - HupRotate bool `default:"false" usage:"if true, sending a HUP signal will reopen log files"` - Config string `default:"" usage:"a semicolon separated list of logger=level; sets each log to the corresponding level"` -} - -var ( - stdlog = GetLoggerNamed("stdlog") - funcmap = template.FuncMap{"ColorizeLevel": ColorizeLevel} -) - -// SetFormatMethod adds functions to the template function map, such that -// command-line and Setup provided templates can call methods added to the map -// via this method. The map comes prepopulated with ColorizeLevel, but can be -// overridden. SetFormatMethod should be called (if at all) before one of -// this package's Setup methods. -func SetFormatMethod(name string, fn interface{}) { - funcmap[name] = fn -} - -// MustSetup is the same as Setup, but panics instead of returning an error -func MustSetup(procname string, config SetupConfig) { - err := Setup(procname, config) - if err != nil { - panic(err) - } -} - -type subprocInfo struct { - Facility string - Level string - Name string -} - -// Setup takes a given procname and sets spacelog up with the given -// configuration. Setup supports: -// * capturing stdout and stderr to a subprocess -// * configuring the default level -// * configuring log filters (enabling only some loggers) -// * configuring the logging template -// * configuring the output (a file, syslog, stdout, stderr) -// * configuring log event buffering -// * capturing all standard library logging with configurable log level -// It is expected that this method will be called once at process start. -func Setup(procname string, config SetupConfig) error { - if config.Subproc != "" { - t, err := template.New("subproc").Parse(config.Subproc) - if err != nil { - return err - } - var buf bytes.Buffer - err = t.Execute(&buf, &subprocInfo{ - Facility: fmt.Sprintf("%d", config.Facility), - Level: fmt.Sprintf("%d", 2), // syslog.LOG_CRIT - Name: procname}) - if err != nil { - return err - } - err = CaptureOutputToProcess("sh", "-c", string(buf.Bytes())) - if err != nil { - return err - } - } - if config.Config != "" { - err := ConfigureLoggers(config.Config) - if err != nil { - return err - } - } - if config.Level != "" { - level_val, err := LevelFromString(config.Level) - if err != nil { - return err - } - if level_val != DefaultLevel { - SetLevel(nil, level_val) - } - } - if config.Filter != "" { - re, err := regexp.Compile(config.Filter) - if err != nil { - return err - } - SetLevel(re, LogLevel(math.MinInt32)) - } - var t *template.Template - if config.Format != "" { - var err error - t, err = template.New("user").Funcs(funcmap).Parse(config.Format) - if err != nil { - return err - } - } - var textout TextOutput - switch strings.ToLower(config.Output) { - case "syslog": - w, err := NewSyslogOutput(SyslogPriority(config.Facility), procname) - if err != nil { - return err - } - if t == nil { - t = SyslogTemplate - } - textout = w - case "stdout": - if t == nil { - t = DefaultTemplate - } - textout = NewWriterOutput(os.Stdout) - case "stderr", "": - if t == nil { - t = DefaultTemplate - } - textout = NewWriterOutput(os.Stderr) - default: - if t == nil { - t = StandardTemplate - } - var err error - textout, err = NewFileWriterOutput(config.Output) - if err != nil { - return err - } - } - if config.HupRotate { - if hh, ok := textout.(HupHandlingTextOutput); ok { - sigchan := make(chan os.Signal) - signal.Notify(sigchan, sigHUP) - go func() { - for _ = range sigchan { - hh.OnHup() - } - }() - } - } - if config.Buffer > 0 { - textout = NewBufferedOutput(textout, config.Buffer) - } - SetHandler(nil, NewTextHandler(t, textout)) - log.SetFlags(log.Lshortfile) - if config.Stdlevel == "" { - config.Stdlevel = "warn" - } - stdlog_level_val, err := LevelFromString(config.Stdlevel) - if err != nil { - return err - } - log.SetOutput(stdlog.WriterWithoutCaller(stdlog_level_val)) - return nil -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/sighup_appengine.go b/vendor/github.com/spacemonkeygo/spacelog/sighup_appengine.go deleted file mode 100644 index c12ed961..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/sighup_appengine.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2017 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build appengine - -package spacelog - -import ( - "strconv" -) - -const ( - sigHUP = syscallSignal(0x1) -) - -type syscallSignal int - -func (s syscallSignal) Signal() {} - -func (s syscallSignal) String() string { - switch s { - case sigHUP: - return "hangup" - } - return "signal " + strconv.Itoa(int(s)) -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/sighup_other.go b/vendor/github.com/spacemonkeygo/spacelog/sighup_other.go deleted file mode 100644 index 0e033a8d..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/sighup_other.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !appengine - -package spacelog - -import "syscall" - -const ( - sigHUP = syscall.SIGHUP -) diff --git a/vendor/github.com/spacemonkeygo/spacelog/syslog.go b/vendor/github.com/spacemonkeygo/spacelog/syslog.go deleted file mode 100644 index c2317b6c..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/syslog.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !windows - -package spacelog - -import ( - "bytes" - "log/syslog" -) - -type SyslogPriority syslog.Priority - -// SyslogOutput is a syslog client that matches the TextOutput interface -type SyslogOutput struct { - w *syslog.Writer -} - -// NewSyslogOutput returns a TextOutput object that writes to syslog using -// the given facility and tag. The log level will be determined by the log -// event. -func NewSyslogOutput(facility SyslogPriority, tag string) ( - TextOutput, error) { - w, err := syslog.New(syslog.Priority(facility), tag) - if err != nil { - return nil, err - } - return &SyslogOutput{w: w}, nil -} - -func (o *SyslogOutput) Output(level LogLevel, message []byte) { - level = level.Match() - for _, msg := range bytes.Split(message, []byte{'\n'}) { - switch level { - case Critical: - o.w.Crit(string(msg)) - case Error: - o.w.Err(string(msg)) - case Warning: - o.w.Warning(string(msg)) - case Notice: - o.w.Notice(string(msg)) - case Info: - o.w.Info(string(msg)) - case Debug: - fallthrough - case Trace: - fallthrough - default: - o.w.Debug(string(msg)) - } - } -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/syslog_windows.go b/vendor/github.com/spacemonkeygo/spacelog/syslog_windows.go deleted file mode 100644 index edba3c2a..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/syslog_windows.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "fmt" -) - -type SyslogPriority int - -func NewSyslogOutput(facility SyslogPriority, tag string) ( - TextOutput, error) { - return nil, fmt.Errorf("SyslogOutput not supported on Windows") -} diff --git a/vendor/github.com/spacemonkeygo/spacelog/templates.go b/vendor/github.com/spacemonkeygo/spacelog/templates.go deleted file mode 100644 index 959033da..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/templates.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "text/template" -) - -// ColorizeLevel returns a TermColor byte sequence for the appropriate color -// for the level. If you'd like to configure your own color choices, you can -// make your own template with its own function map to your own colorize -// function. -func ColorizeLevel(level LogLevel) string { - switch level.Match() { - case Critical, Error: - return TermColors{}.Red() - case Warning: - return TermColors{}.Magenta() - case Notice: - return TermColors{}.Yellow() - case Info, Debug, Trace: - return TermColors{}.Green() - } - return "" -} - -var ( - // ColorTemplate uses the default ColorizeLevel method for color choices. - ColorTemplate = template.Must(template.New("color").Funcs(template.FuncMap{ - "ColorizeLevel": ColorizeLevel}).Parse( - `{{.Blue}}{{.Date}} {{.Time}}{{.Reset}} ` + - `{{.Bold}}{{ColorizeLevel .Level}}{{.LevelJustified}}{{.Reset}} ` + - `{{.Underline}}{{.LoggerName}}{{.Reset}} ` + - `{{if .Filename}}{{.Filename}}:{{.Line}} {{end}}- ` + - `{{ColorizeLevel .Level}}{{.Message}}{{.Reset}}`)) - - // StandardTemplate is like ColorTemplate with no color. - StandardTemplate = template.Must(template.New("standard").Parse( - `{{.Date}} {{.Time}} ` + - `{{.Level}} {{.LoggerName}} ` + - `{{if .Filename}}{{.Filename}}:{{.Line}} {{end}}` + - `- {{.Message}}`)) - - // SyslogTemplate is missing the date and time as syslog adds those - // things. - SyslogTemplate = template.Must(template.New("syslog").Parse( - `{{.Level}} {{.LoggerName}} ` + - `{{if .Filename}}{{.Filename}}:{{.Line}} {{end}}` + - `- {{.Message}}`)) - - // StdlibTemplate is missing the date and time as the stdlib logger often - // adds those things. - StdlibTemplate = template.Must(template.New("stdlib").Parse( - `{{.Level}} {{.LoggerName}} ` + - `{{if .Filename}}{{.Filename}}:{{.Line}} {{end}}` + - `- {{.Message}}`)) -) diff --git a/vendor/github.com/spacemonkeygo/spacelog/templates_others.go b/vendor/github.com/spacemonkeygo/spacelog/templates_others.go deleted file mode 100644 index 114e2e14..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/templates_others.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !windows - -package spacelog - -var ( - // DefaultTemplate is default template for stdout/stderr for the platform - DefaultTemplate = ColorTemplate -) diff --git a/vendor/github.com/spacemonkeygo/spacelog/templates_windows.go b/vendor/github.com/spacemonkeygo/spacelog/templates_windows.go deleted file mode 100644 index 512b6004..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/templates_windows.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -var ( - // DefaultTemplate is default template for stdout/stderr for the platform - DefaultTemplate = StandardTemplate -) diff --git a/vendor/github.com/spacemonkeygo/spacelog/text.go b/vendor/github.com/spacemonkeygo/spacelog/text.go deleted file mode 100644 index 8b36ce99..00000000 --- a/vendor/github.com/spacemonkeygo/spacelog/text.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (C) 2014 Space Monkey, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package spacelog - -import ( - "bytes" - "fmt" - "runtime" - "strings" - "sync" - "text/template" - "time" -) - -// TextHandler is the default implementation of the Handler interface. A -// TextHandler, on log events, makes LogEvent structures, passes them to the -// configured template, and then passes that output to a configured TextOutput -// interface. -type TextHandler struct { - mtx sync.RWMutex - template *template.Template - output TextOutput -} - -// NewTextHandler creates a Handler that creates LogEvents, passes them to -// the given template, and passes the result to output -func NewTextHandler(t *template.Template, output TextOutput) *TextHandler { - return &TextHandler{template: t, output: output} -} - -// Log makes a LogEvent, formats it with the configured template, then passes -// the output to configured output sink -func (h *TextHandler) Log(logger_name string, level LogLevel, msg string, - calldepth int) { - h.mtx.RLock() - output, template := h.output, h.template - h.mtx.RUnlock() - event := LogEvent{ - LoggerName: logger_name, - Level: level, - Message: strings.TrimRight(msg, "\n\r"), - Timestamp: time.Now()} - if calldepth >= 0 { - _, event.Filepath, event.Line, _ = runtime.Caller(calldepth + 1) - } - var buf bytes.Buffer - err := template.Execute(&buf, &event) - if err != nil { - output.Output(level, []byte( - fmt.Sprintf("log format template failed: %s", err))) - return - } - output.Output(level, buf.Bytes()) -} - -// SetTextTemplate changes the TextHandler's text formatting template -func (h *TextHandler) SetTextTemplate(t *template.Template) { - h.mtx.Lock() - defer h.mtx.Unlock() - h.template = t -} - -// SetTextOutput changes the TextHandler's TextOutput sink -func (h *TextHandler) SetTextOutput(output TextOutput) { - h.mtx.Lock() - defer h.mtx.Unlock() - h.output = output -} diff --git a/vendor/github.com/spaolacci/murmur3/.gitignore b/vendor/github.com/spaolacci/murmur3/.gitignore deleted file mode 100644 index 00268614..00000000 --- a/vendor/github.com/spaolacci/murmur3/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/vendor/github.com/spaolacci/murmur3/.travis.yml b/vendor/github.com/spaolacci/murmur3/.travis.yml deleted file mode 100644 index 9bfca9c8..00000000 --- a/vendor/github.com/spaolacci/murmur3/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go - -go: - - 1.x - - master - -script: go test diff --git a/vendor/github.com/spaolacci/murmur3/LICENSE b/vendor/github.com/spaolacci/murmur3/LICENSE deleted file mode 100644 index 2a46fd75..00000000 --- a/vendor/github.com/spaolacci/murmur3/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright 2013, Sébastien Paolacci. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the library nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/spaolacci/murmur3/README.md b/vendor/github.com/spaolacci/murmur3/README.md deleted file mode 100644 index e463678a..00000000 --- a/vendor/github.com/spaolacci/murmur3/README.md +++ /dev/null @@ -1,86 +0,0 @@ -murmur3 -======= - -[![Build Status](https://travis-ci.org/spaolacci/murmur3.svg?branch=master)](https://travis-ci.org/spaolacci/murmur3) - -Native Go implementation of Austin Appleby's third MurmurHash revision (aka -MurmurHash3). - -Reference algorithm has been slightly hacked as to support the streaming mode -required by Go's standard [Hash interface](http://golang.org/pkg/hash/#Hash). - - -Benchmarks ----------- - -Go tip as of 2014-06-12 (i.e almost go1.3), core i7 @ 3.4 Ghz. All runs -include hasher instantiation and sequence finalization. - -
-
-Benchmark32_1        500000000     7.69 ns/op      130.00 MB/s
-Benchmark32_2        200000000     8.83 ns/op      226.42 MB/s
-Benchmark32_4        500000000     7.99 ns/op      500.39 MB/s
-Benchmark32_8        200000000     9.47 ns/op      844.69 MB/s
-Benchmark32_16       100000000     12.1 ns/op     1321.61 MB/s
-Benchmark32_32       100000000     18.3 ns/op     1743.93 MB/s
-Benchmark32_64        50000000     30.9 ns/op     2071.64 MB/s
-Benchmark32_128       50000000     57.6 ns/op     2222.96 MB/s
-Benchmark32_256       20000000      116 ns/op     2188.60 MB/s
-Benchmark32_512       10000000      226 ns/op     2260.59 MB/s
-Benchmark32_1024       5000000      452 ns/op     2263.73 MB/s
-Benchmark32_2048       2000000      891 ns/op     2296.02 MB/s
-Benchmark32_4096       1000000     1787 ns/op     2290.92 MB/s
-Benchmark32_8192        500000     3593 ns/op     2279.68 MB/s
-Benchmark128_1       100000000     26.1 ns/op       38.33 MB/s
-Benchmark128_2       100000000     29.0 ns/op       69.07 MB/s
-Benchmark128_4        50000000     29.8 ns/op      134.17 MB/s
-Benchmark128_8        50000000     31.6 ns/op      252.86 MB/s
-Benchmark128_16      100000000     26.5 ns/op      603.42 MB/s
-Benchmark128_32      100000000     28.6 ns/op     1117.15 MB/s
-Benchmark128_64       50000000     35.5 ns/op     1800.97 MB/s
-Benchmark128_128      50000000     50.9 ns/op     2515.50 MB/s
-Benchmark128_256      20000000     76.9 ns/op     3330.11 MB/s
-Benchmark128_512      20000000      135 ns/op     3769.09 MB/s
-Benchmark128_1024     10000000      250 ns/op     4094.38 MB/s
-Benchmark128_2048      5000000      477 ns/op     4290.75 MB/s
-Benchmark128_4096      2000000      940 ns/op     4353.29 MB/s
-Benchmark128_8192      1000000     1838 ns/op     4455.47 MB/s
-
-
- - -
-
-benchmark              Go1.0 MB/s    Go1.1 MB/s  speedup    Go1.2 MB/s  speedup    Go1.3 MB/s  speedup
-Benchmark32_1               98.90        118.59    1.20x        114.79    0.97x        130.00    1.13x
-Benchmark32_2              168.04        213.31    1.27x        210.65    0.99x        226.42    1.07x
-Benchmark32_4              414.01        494.19    1.19x        490.29    0.99x        500.39    1.02x
-Benchmark32_8              662.19        836.09    1.26x        836.46    1.00x        844.69    1.01x
-Benchmark32_16             917.46       1304.62    1.42x       1297.63    0.99x       1321.61    1.02x
-Benchmark32_32            1141.93       1737.54    1.52x       1728.24    0.99x       1743.93    1.01x
-Benchmark32_64            1289.47       2039.51    1.58x       2038.20    1.00x       2071.64    1.02x
-Benchmark32_128           1299.23       2097.63    1.61x       2177.13    1.04x       2222.96    1.02x
-Benchmark32_256           1369.90       2202.34    1.61x       2213.15    1.00x       2188.60    0.99x
-Benchmark32_512           1399.56       2255.72    1.61x       2264.49    1.00x       2260.59    1.00x
-Benchmark32_1024          1410.90       2285.82    1.62x       2270.99    0.99x       2263.73    1.00x
-Benchmark32_2048          1422.14       2297.62    1.62x       2269.59    0.99x       2296.02    1.01x
-Benchmark32_4096          1420.53       2307.81    1.62x       2273.43    0.99x       2290.92    1.01x
-Benchmark32_8192          1424.79       2312.87    1.62x       2286.07    0.99x       2279.68    1.00x
-Benchmark128_1               8.32         30.15    3.62x         30.84    1.02x         38.33    1.24x
-Benchmark128_2              16.38         59.72    3.65x         59.37    0.99x         69.07    1.16x
-Benchmark128_4              32.26        112.96    3.50x        114.24    1.01x        134.17    1.17x
-Benchmark128_8              62.68        217.88    3.48x        218.18    1.00x        252.86    1.16x
-Benchmark128_16            128.47        451.57    3.51x        474.65    1.05x        603.42    1.27x
-Benchmark128_32            246.18        910.42    3.70x        871.06    0.96x       1117.15    1.28x
-Benchmark128_64            449.05       1477.64    3.29x       1449.24    0.98x       1800.97    1.24x
-Benchmark128_128           762.61       2222.42    2.91x       2217.30    1.00x       2515.50    1.13x
-Benchmark128_256          1179.92       3005.46    2.55x       2931.55    0.98x       3330.11    1.14x
-Benchmark128_512          1616.51       3590.75    2.22x       3592.08    1.00x       3769.09    1.05x
-Benchmark128_1024         1964.36       3979.67    2.03x       4034.01    1.01x       4094.38    1.01x
-Benchmark128_2048         2225.07       4156.93    1.87x       4244.17    1.02x       4290.75    1.01x
-Benchmark128_4096         2360.15       4299.09    1.82x       4392.35    1.02x       4353.29    0.99x
-Benchmark128_8192         2411.50       4356.84    1.81x       4480.68    1.03x       4455.47    0.99x
-
-
- diff --git a/vendor/github.com/spaolacci/murmur3/murmur.go b/vendor/github.com/spaolacci/murmur3/murmur.go deleted file mode 100644 index 1252cf73..00000000 --- a/vendor/github.com/spaolacci/murmur3/murmur.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2013, Sébastien Paolacci. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package murmur3 implements Austin Appleby's non-cryptographic MurmurHash3. - - Reference implementation: - http://code.google.com/p/smhasher/wiki/MurmurHash3 - - History, characteristics and (legacy) perfs: - https://sites.google.com/site/murmurhash/ - https://sites.google.com/site/murmurhash/statistics -*/ -package murmur3 - -type bmixer interface { - bmix(p []byte) (tail []byte) - Size() (n int) - reset() -} - -type digest struct { - clen int // Digested input cumulative length. - tail []byte // 0 to Size()-1 bytes view of `buf'. - buf [16]byte // Expected (but not required) to be Size() large. - seed uint32 // Seed for initializing the hash. - bmixer -} - -func (d *digest) BlockSize() int { return 1 } - -func (d *digest) Write(p []byte) (n int, err error) { - n = len(p) - d.clen += n - - if len(d.tail) > 0 { - // Stick back pending bytes. - nfree := d.Size() - len(d.tail) // nfree ∈ [1, d.Size()-1]. - if nfree < len(p) { - // One full block can be formed. - block := append(d.tail, p[:nfree]...) - p = p[nfree:] - _ = d.bmix(block) // No tail. - } else { - // Tail's buf is large enough to prevent reallocs. - p = append(d.tail, p...) - } - } - - d.tail = d.bmix(p) - - // Keep own copy of the 0 to Size()-1 pending bytes. - nn := copy(d.buf[:], d.tail) - d.tail = d.buf[:nn] - - return n, nil -} - -func (d *digest) Reset() { - d.clen = 0 - d.tail = nil - d.bmixer.reset() -} diff --git a/vendor/github.com/spaolacci/murmur3/murmur128.go b/vendor/github.com/spaolacci/murmur3/murmur128.go deleted file mode 100644 index a4b618b5..00000000 --- a/vendor/github.com/spaolacci/murmur3/murmur128.go +++ /dev/null @@ -1,203 +0,0 @@ -package murmur3 - -import ( - //"encoding/binary" - "hash" - "unsafe" -) - -const ( - c1_128 = 0x87c37b91114253d5 - c2_128 = 0x4cf5ad432745937f -) - -// Make sure interfaces are correctly implemented. -var ( - _ hash.Hash = new(digest128) - _ Hash128 = new(digest128) - _ bmixer = new(digest128) -) - -// Hash128 represents a 128-bit hasher -// Hack: the standard api doesn't define any Hash128 interface. -type Hash128 interface { - hash.Hash - Sum128() (uint64, uint64) -} - -// digest128 represents a partial evaluation of a 128 bites hash. -type digest128 struct { - digest - h1 uint64 // Unfinalized running hash part 1. - h2 uint64 // Unfinalized running hash part 2. -} - -// New128 returns a 128-bit hasher -func New128() Hash128 { return New128WithSeed(0) } - -// New128WithSeed returns a 128-bit hasher set with explicit seed value -func New128WithSeed(seed uint32) Hash128 { - d := new(digest128) - d.seed = seed - d.bmixer = d - d.Reset() - return d -} - -func (d *digest128) Size() int { return 16 } - -func (d *digest128) reset() { d.h1, d.h2 = uint64(d.seed), uint64(d.seed) } - -func (d *digest128) Sum(b []byte) []byte { - h1, h2 := d.Sum128() - return append(b, - byte(h1>>56), byte(h1>>48), byte(h1>>40), byte(h1>>32), - byte(h1>>24), byte(h1>>16), byte(h1>>8), byte(h1), - - byte(h2>>56), byte(h2>>48), byte(h2>>40), byte(h2>>32), - byte(h2>>24), byte(h2>>16), byte(h2>>8), byte(h2), - ) -} - -func (d *digest128) bmix(p []byte) (tail []byte) { - h1, h2 := d.h1, d.h2 - - nblocks := len(p) / 16 - for i := 0; i < nblocks; i++ { - t := (*[2]uint64)(unsafe.Pointer(&p[i*16])) - k1, k2 := t[0], t[1] - - k1 *= c1_128 - k1 = (k1 << 31) | (k1 >> 33) // rotl64(k1, 31) - k1 *= c2_128 - h1 ^= k1 - - h1 = (h1 << 27) | (h1 >> 37) // rotl64(h1, 27) - h1 += h2 - h1 = h1*5 + 0x52dce729 - - k2 *= c2_128 - k2 = (k2 << 33) | (k2 >> 31) // rotl64(k2, 33) - k2 *= c1_128 - h2 ^= k2 - - h2 = (h2 << 31) | (h2 >> 33) // rotl64(h2, 31) - h2 += h1 - h2 = h2*5 + 0x38495ab5 - } - d.h1, d.h2 = h1, h2 - return p[nblocks*d.Size():] -} - -func (d *digest128) Sum128() (h1, h2 uint64) { - - h1, h2 = d.h1, d.h2 - - var k1, k2 uint64 - switch len(d.tail) & 15 { - case 15: - k2 ^= uint64(d.tail[14]) << 48 - fallthrough - case 14: - k2 ^= uint64(d.tail[13]) << 40 - fallthrough - case 13: - k2 ^= uint64(d.tail[12]) << 32 - fallthrough - case 12: - k2 ^= uint64(d.tail[11]) << 24 - fallthrough - case 11: - k2 ^= uint64(d.tail[10]) << 16 - fallthrough - case 10: - k2 ^= uint64(d.tail[9]) << 8 - fallthrough - case 9: - k2 ^= uint64(d.tail[8]) << 0 - - k2 *= c2_128 - k2 = (k2 << 33) | (k2 >> 31) // rotl64(k2, 33) - k2 *= c1_128 - h2 ^= k2 - - fallthrough - - case 8: - k1 ^= uint64(d.tail[7]) << 56 - fallthrough - case 7: - k1 ^= uint64(d.tail[6]) << 48 - fallthrough - case 6: - k1 ^= uint64(d.tail[5]) << 40 - fallthrough - case 5: - k1 ^= uint64(d.tail[4]) << 32 - fallthrough - case 4: - k1 ^= uint64(d.tail[3]) << 24 - fallthrough - case 3: - k1 ^= uint64(d.tail[2]) << 16 - fallthrough - case 2: - k1 ^= uint64(d.tail[1]) << 8 - fallthrough - case 1: - k1 ^= uint64(d.tail[0]) << 0 - k1 *= c1_128 - k1 = (k1 << 31) | (k1 >> 33) // rotl64(k1, 31) - k1 *= c2_128 - h1 ^= k1 - } - - h1 ^= uint64(d.clen) - h2 ^= uint64(d.clen) - - h1 += h2 - h2 += h1 - - h1 = fmix64(h1) - h2 = fmix64(h2) - - h1 += h2 - h2 += h1 - - return h1, h2 -} - -func fmix64(k uint64) uint64 { - k ^= k >> 33 - k *= 0xff51afd7ed558ccd - k ^= k >> 33 - k *= 0xc4ceb9fe1a85ec53 - k ^= k >> 33 - return k -} - -/* -func rotl64(x uint64, r byte) uint64 { - return (x << r) | (x >> (64 - r)) -} -*/ - -// Sum128 returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New128() -// hasher.Write(data) -// return hasher.Sum128() -func Sum128(data []byte) (h1 uint64, h2 uint64) { return Sum128WithSeed(data, 0) } - -// Sum128WithSeed returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New128WithSeed(seed) -// hasher.Write(data) -// return hasher.Sum128() -func Sum128WithSeed(data []byte, seed uint32) (h1 uint64, h2 uint64) { - d := &digest128{h1: uint64(seed), h2: uint64(seed)} - d.seed = seed - d.tail = d.bmix(data) - d.clen = len(data) - return d.Sum128() -} diff --git a/vendor/github.com/spaolacci/murmur3/murmur32.go b/vendor/github.com/spaolacci/murmur3/murmur32.go deleted file mode 100644 index e32c9951..00000000 --- a/vendor/github.com/spaolacci/murmur3/murmur32.go +++ /dev/null @@ -1,167 +0,0 @@ -package murmur3 - -// http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/hash/Murmur3_32HashFunction.java - -import ( - "hash" - "unsafe" -) - -// Make sure interfaces are correctly implemented. -var ( - _ hash.Hash = new(digest32) - _ hash.Hash32 = new(digest32) - _ bmixer = new(digest32) -) - -const ( - c1_32 uint32 = 0xcc9e2d51 - c2_32 uint32 = 0x1b873593 -) - -// digest32 represents a partial evaluation of a 32 bites hash. -type digest32 struct { - digest - h1 uint32 // Unfinalized running hash. -} - -// New32 returns new 32-bit hasher -func New32() hash.Hash32 { return New32WithSeed(0) } - -// New32WithSeed returns new 32-bit hasher set with explicit seed value -func New32WithSeed(seed uint32) hash.Hash32 { - d := new(digest32) - d.seed = seed - d.bmixer = d - d.Reset() - return d -} - -func (d *digest32) Size() int { return 4 } - -func (d *digest32) reset() { d.h1 = d.seed } - -func (d *digest32) Sum(b []byte) []byte { - h := d.Sum32() - return append(b, byte(h>>24), byte(h>>16), byte(h>>8), byte(h)) -} - -// Digest as many blocks as possible. -func (d *digest32) bmix(p []byte) (tail []byte) { - h1 := d.h1 - - nblocks := len(p) / 4 - for i := 0; i < nblocks; i++ { - k1 := *(*uint32)(unsafe.Pointer(&p[i*4])) - - k1 *= c1_32 - k1 = (k1 << 15) | (k1 >> 17) // rotl32(k1, 15) - k1 *= c2_32 - - h1 ^= k1 - h1 = (h1 << 13) | (h1 >> 19) // rotl32(h1, 13) - h1 = h1*4 + h1 + 0xe6546b64 - } - d.h1 = h1 - return p[nblocks*d.Size():] -} - -func (d *digest32) Sum32() (h1 uint32) { - - h1 = d.h1 - - var k1 uint32 - switch len(d.tail) & 3 { - case 3: - k1 ^= uint32(d.tail[2]) << 16 - fallthrough - case 2: - k1 ^= uint32(d.tail[1]) << 8 - fallthrough - case 1: - k1 ^= uint32(d.tail[0]) - k1 *= c1_32 - k1 = (k1 << 15) | (k1 >> 17) // rotl32(k1, 15) - k1 *= c2_32 - h1 ^= k1 - } - - h1 ^= uint32(d.clen) - - h1 ^= h1 >> 16 - h1 *= 0x85ebca6b - h1 ^= h1 >> 13 - h1 *= 0xc2b2ae35 - h1 ^= h1 >> 16 - - return h1 -} - -/* -func rotl32(x uint32, r byte) uint32 { - return (x << r) | (x >> (32 - r)) -} -*/ - -// Sum32 returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New32() -// hasher.Write(data) -// return hasher.Sum32() -func Sum32(data []byte) uint32 { return Sum32WithSeed(data, 0) } - -// Sum32WithSeed returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New32WithSeed(seed) -// hasher.Write(data) -// return hasher.Sum32() -func Sum32WithSeed(data []byte, seed uint32) uint32 { - - h1 := seed - - nblocks := len(data) / 4 - var p uintptr - if len(data) > 0 { - p = uintptr(unsafe.Pointer(&data[0])) - } - p1 := p + uintptr(4*nblocks) - for ; p < p1; p += 4 { - k1 := *(*uint32)(unsafe.Pointer(p)) - - k1 *= c1_32 - k1 = (k1 << 15) | (k1 >> 17) // rotl32(k1, 15) - k1 *= c2_32 - - h1 ^= k1 - h1 = (h1 << 13) | (h1 >> 19) // rotl32(h1, 13) - h1 = h1*4 + h1 + 0xe6546b64 - } - - tail := data[nblocks*4:] - - var k1 uint32 - switch len(tail) & 3 { - case 3: - k1 ^= uint32(tail[2]) << 16 - fallthrough - case 2: - k1 ^= uint32(tail[1]) << 8 - fallthrough - case 1: - k1 ^= uint32(tail[0]) - k1 *= c1_32 - k1 = (k1 << 15) | (k1 >> 17) // rotl32(k1, 15) - k1 *= c2_32 - h1 ^= k1 - } - - h1 ^= uint32(len(data)) - - h1 ^= h1 >> 16 - h1 *= 0x85ebca6b - h1 ^= h1 >> 13 - h1 *= 0xc2b2ae35 - h1 ^= h1 >> 16 - - return h1 -} diff --git a/vendor/github.com/spaolacci/murmur3/murmur64.go b/vendor/github.com/spaolacci/murmur3/murmur64.go deleted file mode 100644 index 65a410ae..00000000 --- a/vendor/github.com/spaolacci/murmur3/murmur64.go +++ /dev/null @@ -1,57 +0,0 @@ -package murmur3 - -import ( - "hash" -) - -// Make sure interfaces are correctly implemented. -var ( - _ hash.Hash = new(digest64) - _ hash.Hash64 = new(digest64) - _ bmixer = new(digest64) -) - -// digest64 is half a digest128. -type digest64 digest128 - -// New64 returns a 64-bit hasher -func New64() hash.Hash64 { return New64WithSeed(0) } - -// New64WithSeed returns a 64-bit hasher set with explicit seed value -func New64WithSeed(seed uint32) hash.Hash64 { - d := (*digest64)(New128WithSeed(seed).(*digest128)) - return d -} - -func (d *digest64) Sum(b []byte) []byte { - h1 := d.Sum64() - return append(b, - byte(h1>>56), byte(h1>>48), byte(h1>>40), byte(h1>>32), - byte(h1>>24), byte(h1>>16), byte(h1>>8), byte(h1)) -} - -func (d *digest64) Sum64() uint64 { - h1, _ := (*digest128)(d).Sum128() - return h1 -} - -// Sum64 returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New64() -// hasher.Write(data) -// return hasher.Sum64() -func Sum64(data []byte) uint64 { return Sum64WithSeed(data, 0) } - -// Sum64WithSeed returns the MurmurHash3 sum of data. It is equivalent to the -// following sequence (without the extra burden and the extra allocation): -// hasher := New64WithSeed(seed) -// hasher.Write(data) -// return hasher.Sum64() -func Sum64WithSeed(data []byte, seed uint32) uint64 { - d := &digest128{h1: uint64(seed), h2: uint64(seed)} - d.seed = seed - d.tail = d.bmix(data) - d.clen = len(data) - h1, _ := d.Sum128() - return h1 -} diff --git a/vendor/github.com/spf13/afero/copyOnWriteFs.go b/vendor/github.com/spf13/afero/copyOnWriteFs.go index e8108a85..9aef3979 100644 --- a/vendor/github.com/spf13/afero/copyOnWriteFs.go +++ b/vendor/github.com/spf13/afero/copyOnWriteFs.go @@ -267,7 +267,7 @@ func (u *CopyOnWriteFs) Mkdir(name string, perm os.FileMode) error { return u.layer.MkdirAll(name, perm) } if dir { - return ErrFileExists + return syscall.EEXIST } return u.layer.MkdirAll(name, perm) } @@ -282,8 +282,7 @@ func (u *CopyOnWriteFs) MkdirAll(name string, perm os.FileMode) error { return u.layer.MkdirAll(name, perm) } if dir { - // This is in line with how os.MkdirAll behaves. - return nil + return syscall.EEXIST } return u.layer.MkdirAll(name, perm) } diff --git a/vendor/github.com/spf13/afero/go.mod b/vendor/github.com/spf13/afero/go.mod index 08685509..9eff4fed 100644 --- a/vendor/github.com/spf13/afero/go.mod +++ b/vendor/github.com/spf13/afero/go.mod @@ -1,3 +1 @@ module github.com/spf13/afero - -require golang.org/x/text v0.3.0 diff --git a/vendor/github.com/spf13/afero/go.sum b/vendor/github.com/spf13/afero/go.sum deleted file mode 100644 index 6bad37b2..00000000 --- a/vendor/github.com/spf13/afero/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/spf13/afero/unionFile.go b/vendor/github.com/spf13/afero/unionFile.go index eda96312..1e78f7d1 100644 --- a/vendor/github.com/spf13/afero/unionFile.go +++ b/vendor/github.com/spf13/afero/unionFile.go @@ -155,8 +155,7 @@ var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, err } // Readdir will weave the two directories together and -// return a single view of the overlayed directories. -// At the end of the directory view, the error is io.EOF if c > 0. +// return a single view of the overlayed directories func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) { var merge DirsMerger = f.Merger if merge == nil { @@ -186,23 +185,9 @@ func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) { } f.files = append(f.files, merged...) } - - if c <= 0 && len(f.files) == 0 { - return f.files, nil - } - - if f.off >= len(f.files) { - return nil, io.EOF - } - - if c <= 0 { + if c == -1 { return f.files[f.off:], nil } - - if c > len(f.files) { - c = len(f.files) - } - defer func() { f.off += c }() return f.files[f.off:c], nil } diff --git a/vendor/github.com/spf13/cast/.travis.yml b/vendor/github.com/spf13/cast/.travis.yml index 6420d1c2..4da97668 100644 --- a/vendor/github.com/spf13/cast/.travis.yml +++ b/vendor/github.com/spf13/cast/.travis.yml @@ -1,9 +1,8 @@ language: go -env: - - GO111MODULE=on sudo: required go: - - "1.11.x" + - 1.7.5 + - 1.8 - tip os: - linux diff --git a/vendor/github.com/spf13/cast/cast.go b/vendor/github.com/spf13/cast/cast.go index 9fba638d..8b8c208b 100644 --- a/vendor/github.com/spf13/cast/cast.go +++ b/vendor/github.com/spf13/cast/cast.go @@ -122,18 +122,6 @@ func ToStringMapBool(i interface{}) map[string]bool { return v } -// ToStringMapInt casts an interface to a map[string]int type. -func ToStringMapInt(i interface{}) map[string]int { - v, _ := ToStringMapIntE(i) - return v -} - -// ToStringMapInt64 casts an interface to a map[string]int64 type. -func ToStringMapInt64(i interface{}) map[string]int64 { - v, _ := ToStringMapInt64E(i) - return v -} - // ToStringMap casts an interface to a map[string]interface{} type. func ToStringMap(i interface{}) map[string]interface{} { v, _ := ToStringMapE(i) diff --git a/vendor/github.com/spf13/cast/caste.go b/vendor/github.com/spf13/cast/caste.go index a4859fb0..4fe19289 100644 --- a/vendor/github.com/spf13/cast/caste.go +++ b/vendor/github.com/spf13/cast/caste.go @@ -990,87 +990,6 @@ func ToStringMapE(i interface{}) (map[string]interface{}, error) { } } -// ToStringMapIntE casts an interface to a map[string]int{} type. -func ToStringMapIntE(i interface{}) (map[string]int, error) { - var m = map[string]int{} - if i == nil { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i) - } - - switch v := i.(type) { - case map[interface{}]interface{}: - for k, val := range v { - m[ToString(k)] = ToInt(val) - } - return m, nil - case map[string]interface{}: - for k, val := range v { - m[k] = ToInt(val) - } - return m, nil - case map[string]int: - return v, nil - case string: - err := jsonStringToObject(v, &m) - return m, err - } - - if reflect.TypeOf(i).Kind() != reflect.Map { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i) - } - - mVal := reflect.ValueOf(m) - v := reflect.ValueOf(i) - for _, keyVal := range v.MapKeys() { - val, err := ToIntE(v.MapIndex(keyVal).Interface()) - if err != nil { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i) - } - mVal.SetMapIndex(keyVal, reflect.ValueOf(val)) - } - return m, nil -} - -// ToStringMapInt64E casts an interface to a map[string]int64{} type. -func ToStringMapInt64E(i interface{}) (map[string]int64, error) { - var m = map[string]int64{} - if i == nil { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i) - } - - switch v := i.(type) { - case map[interface{}]interface{}: - for k, val := range v { - m[ToString(k)] = ToInt64(val) - } - return m, nil - case map[string]interface{}: - for k, val := range v { - m[k] = ToInt64(val) - } - return m, nil - case map[string]int64: - return v, nil - case string: - err := jsonStringToObject(v, &m) - return m, err - } - - if reflect.TypeOf(i).Kind() != reflect.Map { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i) - } - mVal := reflect.ValueOf(m) - v := reflect.ValueOf(i) - for _, keyVal := range v.MapKeys() { - val, err := ToInt64E(v.MapIndex(keyVal).Interface()) - if err != nil { - return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i) - } - mVal.SetMapIndex(keyVal, reflect.ValueOf(val)) - } - return m, nil -} - // ToSliceE casts an interface to a []interface{} type. func ToSliceE(i interface{}) ([]interface{}, error) { var s []interface{} @@ -1218,11 +1137,9 @@ func StringToDate(s string) (time.Time, error) { "2006-01-02 15:04:05.999999999 -0700 MST", // Time.String() "2006-01-02", "02 Jan 2006", - "2006-01-02T15:04:05-0700", // RFC3339 without timezone hh:mm colon "2006-01-02 15:04:05 -07:00", "2006-01-02 15:04:05 -0700", "2006-01-02 15:04:05Z07:00", // RFC3339 without T - "2006-01-02 15:04:05Z0700", // RFC3339 without T or timezone hh:mm colon "2006-01-02 15:04:05", time.Kitchen, time.Stamp, diff --git a/vendor/github.com/spf13/cast/go.mod b/vendor/github.com/spf13/cast/go.mod deleted file mode 100644 index c1c0232d..00000000 --- a/vendor/github.com/spf13/cast/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module github.com/spf13/cast - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 -) diff --git a/vendor/github.com/spf13/cast/go.sum b/vendor/github.com/spf13/cast/go.sum deleted file mode 100644 index e03ee77d..00000000 --- a/vendor/github.com/spf13/cast/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/vendor/github.com/spf13/cobra/.gitignore b/vendor/github.com/spf13/cobra/.gitignore index 3b053c59..1b8c7c26 100644 --- a/vendor/github.com/spf13/cobra/.gitignore +++ b/vendor/github.com/spf13/cobra/.gitignore @@ -34,5 +34,3 @@ tags *.exe cobra.test - -.idea/* diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml index 38b85f49..5afcb209 100644 --- a/vendor/github.com/spf13/cobra/.travis.yml +++ b/vendor/github.com/spf13/cobra/.travis.yml @@ -1,31 +1,21 @@ language: go -stages: - - diff - - test - -go: - - 1.10.x - - 1.11.x - - 1.12.x - - tip - matrix: + include: + - go: 1.9.4 + - go: 1.10.0 + - go: tip allow_failures: - go: tip - include: - - stage: diff - go: 1.12.x - script: diff -u <(echo -n) <(gofmt -d -s .) before_install: - mkdir -p bin - - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.6.0/shellcheck + - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck - chmod +x bin/shellcheck - - go get -u github.com/kyoh86/richgo script: - - PATH=$PATH:$PWD/bin richgo test -v ./... + - PATH=$PATH:$PWD/bin go test -v ./... - go build + - diff -u <(echo -n) <(gofmt -d -s .) - if [ -z $NOVET ]; then - diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); + diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); fi diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 60c5a425..851fcc08 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -2,29 +2,25 @@ Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files. -Many of the most widely used Go projects are built using Cobra, such as: -[Kubernetes](http://kubernetes.io/), -[Hugo](http://gohugo.io), -[rkt](https://github.com/coreos/rkt), -[etcd](https://github.com/coreos/etcd), -[Moby (former Docker)](https://github.com/moby/moby), -[Docker (distribution)](https://github.com/docker/distribution), -[OpenShift](https://www.openshift.com/), -[Delve](https://github.com/derekparker/delve), -[GopherJS](http://www.gopherjs.org/), -[CockroachDB](http://www.cockroachlabs.com/), -[Bleve](http://www.blevesearch.com/), -[ProjectAtomic (enterprise)](http://www.projectatomic.io/), -[Giant Swarm's gsctl](https://github.com/giantswarm/gsctl), -[Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack), -[rclone](http://rclone.org/), -[nehm](https://github.com/bogem/nehm), -[Pouch](https://github.com/alibaba/pouch), -[Istio](https://istio.io), -[Prototool](https://github.com/uber/prototool), -[mattermost-server](https://github.com/mattermost/mattermost-server), -[Gardener](https://github.com/gardener/gardenctl), -etc. +Many of the most widely used Go projects are built using Cobra including: + +* [Kubernetes](http://kubernetes.io/) +* [Hugo](http://gohugo.io) +* [rkt](https://github.com/coreos/rkt) +* [etcd](https://github.com/coreos/etcd) +* [Moby (former Docker)](https://github.com/moby/moby) +* [Docker (distribution)](https://github.com/docker/distribution) +* [OpenShift](https://www.openshift.com/) +* [Delve](https://github.com/derekparker/delve) +* [GopherJS](http://www.gopherjs.org/) +* [CockroachDB](http://www.cockroachlabs.com/) +* [Bleve](http://www.blevesearch.com/) +* [ProjectAtomic (enterprise)](http://www.projectatomic.io/) +* [GiantSwarm's swarm](https://github.com/giantswarm/cli) +* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) +* [rclone](http://rclone.org/) +* [nehm](https://github.com/bogem/nehm) +* [Pouch](https://github.com/alibaba/pouch) [![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) [![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) @@ -49,7 +45,6 @@ etc. * [Suggestions when "unknown command" happens](#suggestions-when-unknown-command-happens) * [Generating documentation for your command](#generating-documentation-for-your-command) * [Generating bash completions](#generating-bash-completions) - * [Generating zsh completions](#generating-zsh-completions) - [Contributing](#contributing) - [License](#license) @@ -157,6 +152,9 @@ In a Cobra app, typically the main.go file is very bare. It serves one purpose: package main import ( + "fmt" + "os" + "{pathToYourApp}/cmd" ) @@ -267,6 +265,9 @@ In a Cobra app, typically the main.go file is very bare. It serves, one purpose, package main import ( + "fmt" + "os" + "{pathToYourApp}/cmd" ) @@ -338,7 +339,7 @@ rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose out A flag can also be assigned locally which will only apply to that specific command. ```go -localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") +rootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") ``` ### Local Flag on Parent Commands @@ -394,7 +395,6 @@ The following validators are built in: - `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args. - `MaximumNArgs(int)` - the command will report an error if there are more than N positional args. - `ExactArgs(int)` - the command will report an error if there are not exactly N positional args. -- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command` - `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args. An example of setting the custom validator: @@ -404,7 +404,7 @@ var cmd = &cobra.Command{ Short: "hello", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { - return errors.New("requires a color argument") + return errors.New("requires at least one arg") } if myapp.IsValidColor(args[0]) { return nil @@ -464,7 +464,7 @@ Echo works a lot like print, except it has a child command.`, } var cmdTimes = &cobra.Command{ - Use: "times [string to echo]", + Use: "times [# times] [string to echo]", Short: "Echo anything to the screen more times", Long: `echo things multiple times back to the user by providing a count and a string.`, @@ -721,11 +721,6 @@ Cobra can generate documentation based on subcommands, flags, etc. in the follow Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md). -## Generating zsh completions - -Cobra can generate zsh-completion file. Read more about it in -[Zsh Completions](zsh_completions.md). - # Contributing 1. Fork it diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go index c4d820b8..a5d8a927 100644 --- a/vendor/github.com/spf13/cobra/args.go +++ b/vendor/github.com/spf13/cobra/args.go @@ -78,18 +78,6 @@ func ExactArgs(n int) PositionalArgs { } } -// ExactValidArgs returns an error if -// there are not exactly N positional args OR -// there are any positional args that are not in the `ValidArgs` field of `Command` -func ExactValidArgs(n int) PositionalArgs { - return func(cmd *Command, args []string) error { - if err := ExactArgs(n)(cmd, args); err != nil { - return err - } - return OnlyValidArgs(cmd, args) - } -} - // RangeArgs returns an error if the number of args is not within the expected range. func RangeArgs(min int, max int) PositionalArgs { return func(cmd *Command, args []string) error { diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index 57bb8e1b..8fa8f486 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -129,13 +129,7 @@ __%[1]s_handle_reply() fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then - if declare -F __%[1]s_custom_func >/dev/null; then - # try command name qualified custom func - __%[1]s_custom_func - else - # otherwise fall back to unqualified for compatibility - declare -F __custom_func >/dev/null && __custom_func - fi + declare -F __custom_func >/dev/null && __custom_func fi # available in bash-completion >= 2, not always present on macOS @@ -199,8 +193,7 @@ __%[1]s_handle_flag() fi # skip the argument to a two word flag - if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then - __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" + if __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then c=$((c+1)) # if we are looking for a flags value, don't show commands if [[ $c -eq $cword ]]; then @@ -380,10 +373,6 @@ func writeFlag(buf *bytes.Buffer, flag *pflag.Flag, cmd *Command) { } format += "\")\n" buf.WriteString(fmt.Sprintf(format, name)) - if len(flag.NoOptDefVal) == 0 { - format = " two_word_flags+=(\"--%s\")\n" - buf.WriteString(fmt.Sprintf(format, name)) - } writeFlagHandler(buf, "--"+name, flag.Annotations, cmd) } @@ -545,3 +534,51 @@ func (c *Command) GenBashCompletionFile(filename string) error { return c.GenBashCompletion(outFile) } + +// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists, +// and causes your command to report an error if invoked without the flag. +func (c *Command) MarkFlagRequired(name string) error { + return MarkFlagRequired(c.Flags(), name) +} + +// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag if it exists, +// and causes your command to report an error if invoked without the flag. +func (c *Command) MarkPersistentFlagRequired(name string) error { + return MarkFlagRequired(c.PersistentFlags(), name) +} + +// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists, +// and causes your command to report an error if invoked without the flag. +func MarkFlagRequired(flags *pflag.FlagSet, name string) error { + return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) +} + +// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func (c *Command) MarkFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(c.Flags(), name, extensions...) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. +// Generated bash autocompletion will call the bash function f for the flag. +func (c *Command) MarkFlagCustom(name string, f string) error { + return MarkFlagCustom(c.Flags(), name, f) +} + +// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(c.PersistentFlags(), name, extensions...) +} + +// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { + return flags.SetAnnotation(name, BashCompFilenameExt, extensions) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists. +// Generated bash autocompletion will call the bash function f for the flag. +func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { + return flags.SetAnnotation(name, BashCompCustom, []string{f}) +} diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md index 4ac61ee1..e79d4769 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ b/vendor/github.com/spf13/cobra/bash_completions.md @@ -1,40 +1,5 @@ # Generating Bash Completions For Your Own cobra.Command -If you are using the generator you can create a completion command by running - -```bash -cobra add completion -``` - -Update the help text show how to install the bash_completion Linux show here [Kubectl docs show mac options](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion) - -Writing the shell script to stdout allows the most flexible use. - -```go -// completionCmd represents the completion command -var completionCmd = &cobra.Command{ - Use: "completion", - Short: "Generates bash completion scripts", - Long: `To load completion run - -. <(bitbucket completion) - -To configure your bash shell to load completions for each session add to your bashrc - -# ~/.bashrc or ~/.profile -. <(bitbucket completion) -`, - Run: func(cmd *cobra.Command, args []string) { - rootCmd.GenBashCompletion(os.Stdout); - }, -} -``` - -**Note:** The cobra generator may include messages printed to stdout for example if the config file is loaded, this will break the auto complete script - - -## Example from kubectl - Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows: ```go @@ -82,7 +47,7 @@ __kubectl_get_resource() fi } -__kubectl_custom_func() { +__custom_func() { case ${last_command} in kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) __kubectl_get_resource @@ -109,7 +74,7 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, } ``` -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`___custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! +The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! ## Have the completions code complete your 'nouns' diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index 6505c070..7010fd15 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -23,7 +23,6 @@ import ( "strconv" "strings" "text/template" - "time" "unicode" ) @@ -57,12 +56,6 @@ var MousetrapHelpText string = `This is a command line tool. You need to open cmd.exe and run it from there. ` -// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows -// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed. -// To disable the mousetrap, just set MousetrapHelpText to blank string (""). -// Works only on Microsoft Windows. -var MousetrapDisplayDuration time.Duration = 5 * time.Second - // AddTemplateFunc adds a template function that's available to Usage and Help // template generation. func AddTemplateFunc(name string, tmplFunc interface{}) { diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go new file mode 100644 index 00000000..bc22e973 --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go @@ -0,0 +1,683 @@ +package cmd + +func initAgpl() { + Licenses["agpl"] = License{ + Name: "GNU Affero General Public License", + PossibleMatches: []string{"agpl", "affero gpl", "gnu agpl"}, + Header: ` +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .`, + Text: ` GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +`, + } +} diff --git a/vendor/github.com/minio/sha256-simd/LICENSE b/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go similarity index 88% rename from vendor/github.com/minio/sha256-simd/LICENSE rename to vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go index d6456956..38393d54 100644 --- a/vendor/github.com/minio/sha256-simd/LICENSE +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go @@ -1,4 +1,37 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initApache2() { + Licenses["apache"] = License{ + Name: "Apache 2.0", + PossibleMatches: []string{"apache", "apache20", "apache 2.0", "apache2.0", "apache-2.0"}, + Header: ` +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.`, + Text: ` Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -200,3 +233,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go new file mode 100644 index 00000000..4a847e04 --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go @@ -0,0 +1,71 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initBsdClause2() { + Licenses["freebsd"] = License{ + Name: "Simplified BSD License", + PossibleMatches: []string{"freebsd", "simpbsd", "simple bsd", "2-clause bsd", + "2 clause bsd", "simplified bsd license"}, + Header: `All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go new file mode 100644 index 00000000..c7476b31 --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go @@ -0,0 +1,78 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initBsdClause3() { + Licenses["bsd"] = License{ + Name: "NewBSD", + PossibleMatches: []string{"bsd", "newbsd", "3 clause bsd", "3-clause bsd"}, + Header: `All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go new file mode 100644 index 00000000..03e05b3a --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go @@ -0,0 +1,376 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initGpl2() { + Licenses["gpl2"] = License{ + Name: "GNU General Public License 2.0", + PossibleMatches: []string{"gpl2", "gnu gpl2", "gplv2"}, + Header: ` +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see .`, + Text: ` GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go new file mode 100644 index 00000000..ce07679c --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go @@ -0,0 +1,711 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initGpl3() { + Licenses["gpl3"] = License{ + Name: "GNU General Public License 3.0", + PossibleMatches: []string{"gpl3", "gplv3", "gpl", "gnu gpl3", "gnu gpl"}, + Header: ` +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see .`, + Text: ` GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +`, + } +} diff --git a/vendor/github.com/mmcloughlin/avo/examples/stadtx/LICENSE b/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go similarity index 89% rename from vendor/github.com/mmcloughlin/avo/examples/stadtx/LICENSE rename to vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go index bd92ca27..0f8b96ca 100644 --- a/vendor/github.com/mmcloughlin/avo/examples/stadtx/LICENSE +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go @@ -1,6 +1,23 @@ -// Code generated by downloading from https://raw.githubusercontent.com/demerphq/BeagleHash/5f8620b953230e5b16171b745155fc3b0ef8f75e/LICENSE. DO NOT EDIT. +package cmd - GNU LESSER GENERAL PUBLIC LICENSE +func initLgpl() { + Licenses["lgpl"] = License{ + Name: "GNU Lesser General Public License", + PossibleMatches: []string{"lgpl", "lesser gpl", "gnu lgpl"}, + Header: ` +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see .`, + Text: ` GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. @@ -164,4 +181,6 @@ General Public License ever published by the Free Software Foundation. whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the -Library. +Library.`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go new file mode 100644 index 00000000..bd2d0c4f --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go @@ -0,0 +1,63 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initMit() { + Licenses["mit"] = License{ + Name: "MIT License", + PossibleMatches: []string{"mit"}, + Header: ` +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.`, + Text: `The MIT License (MIT) + +{{ .copyright }} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go b/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go new file mode 100644 index 00000000..a070134d --- /dev/null +++ b/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go @@ -0,0 +1,118 @@ +// Copyright © 2015 Steve Francia . +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +import ( + "strings" + "time" + + "github.com/spf13/viper" +) + +// Licenses contains all possible licenses a user can choose from. +var Licenses = make(map[string]License) + +// License represents a software license agreement, containing the Name of +// the license, its possible matches (on the command line as given to cobra), +// the header to be used with each file on the file's creating, and the text +// of the license +type License struct { + Name string // The type of license in use + PossibleMatches []string // Similar names to guess + Text string // License text data + Header string // License header for source files +} + +func init() { + // Allows a user to not use a license. + Licenses["none"] = License{"None", []string{"none", "false"}, "", ""} + + initApache2() + initMit() + initBsdClause3() + initBsdClause2() + initGpl2() + initGpl3() + initLgpl() + initAgpl() +} + +// getLicense returns license specified by user in flag or in config. +// If user didn't specify the license, it returns Apache License 2.0. +// +// TODO: Inspect project for existing license +func getLicense() License { + // If explicitly flagged, use that. + if userLicense != "" { + return findLicense(userLicense) + } + + // If user wants to have custom license, use that. + if viper.IsSet("license.header") || viper.IsSet("license.text") { + return License{Header: viper.GetString("license.header"), + Text: viper.GetString("license.text")} + } + + // If user wants to have built-in license, use that. + if viper.IsSet("license") { + return findLicense(viper.GetString("license")) + } + + // If user didn't set any license, use Apache 2.0 by default. + return Licenses["apache"] +} + +func copyrightLine() string { + author := viper.GetString("author") + + year := viper.GetString("year") // For tests. + if year == "" { + year = time.Now().Format("2006") + } + + return "Copyright © " + year + " " + author +} + +// findLicense looks for License object of built-in licenses. +// If it didn't find license, then the app will be terminated and +// error will be printed. +func findLicense(name string) License { + found := matchLicense(name) + if found == "" { + er("unknown license: " + name) + } + return Licenses[found] +} + +// matchLicense compares the given a license name +// to PossibleMatches of all built-in licenses. +// It returns blank string, if name is blank string or it didn't find +// then appropriate match to name. +func matchLicense(name string) string { + if name == "" { + return "" + } + + for key, lic := range Licenses { + for _, match := range lic.PossibleMatches { + if strings.EqualFold(name, match) { + return key + } + } + } + + return "" +} diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index c7e89830..34d1bf36 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -177,6 +177,8 @@ type Command struct { // that we can use on every pflag set and children commands globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName + // output is an output writer defined by user. + output io.Writer // usageFunc is usage func defined by user. usageFunc func(*Command) error // usageTemplate is usage template defined by user. @@ -193,13 +195,6 @@ type Command struct { helpCommand *Command // versionTemplate is the version template defined by user. versionTemplate string - - // inReader is a reader defined by the user that replaces stdin - inReader io.Reader - // outWriter is a writer defined by the user that replaces stdout - outWriter io.Writer - // errWriter is a writer defined by the user that replaces stderr - errWriter io.Writer } // SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden @@ -210,28 +205,8 @@ func (c *Command) SetArgs(a []string) { // SetOutput sets the destination for usage and error messages. // If output is nil, os.Stderr is used. -// Deprecated: Use SetOut and/or SetErr instead func (c *Command) SetOutput(output io.Writer) { - c.outWriter = output - c.errWriter = output -} - -// SetOut sets the destination for usage messages. -// If newOut is nil, os.Stdout is used. -func (c *Command) SetOut(newOut io.Writer) { - c.outWriter = newOut -} - -// SetErr sets the destination for error messages. -// If newErr is nil, os.Stderr is used. -func (c *Command) SetErr(newErr io.Writer) { - c.errWriter = newErr -} - -// SetOut sets the source for input data -// If newIn is nil, os.Stdin is used. -func (c *Command) SetIn(newIn io.Reader) { - c.inReader = newIn + c.output = output } // SetUsageFunc sets usage function. Usage can be defined by application. @@ -292,19 +267,9 @@ func (c *Command) OutOrStderr() io.Writer { return c.getOut(os.Stderr) } -// ErrOrStderr returns output to stderr -func (c *Command) ErrOrStderr() io.Writer { - return c.getErr(os.Stderr) -} - -// ErrOrStderr returns output to stderr -func (c *Command) InOrStdin() io.Reader { - return c.getIn(os.Stdin) -} - func (c *Command) getOut(def io.Writer) io.Writer { - if c.outWriter != nil { - return c.outWriter + if c.output != nil { + return c.output } if c.HasParent() { return c.parent.getOut(def) @@ -312,26 +277,6 @@ func (c *Command) getOut(def io.Writer) io.Writer { return def } -func (c *Command) getErr(def io.Writer) io.Writer { - if c.errWriter != nil { - return c.errWriter - } - if c.HasParent() { - return c.parent.getErr(def) - } - return def -} - -func (c *Command) getIn(def io.Reader) io.Reader { - if c.inReader != nil { - return c.inReader - } - if c.HasParent() { - return c.parent.getIn(def) - } - return def -} - // UsageFunc returns either the function set by SetUsageFunc for this command // or a parent, or it returns a default usage function. func (c *Command) UsageFunc() (f func(*Command) error) { @@ -384,22 +329,13 @@ func (c *Command) Help() error { return nil } -// UsageString returns usage string. +// UsageString return usage string. func (c *Command) UsageString() string { - // Storing normal writers - tmpOutput := c.outWriter - tmpErr := c.errWriter - + tmpOutput := c.output bb := new(bytes.Buffer) - c.outWriter = bb - c.errWriter = bb - + c.SetOutput(bb) c.Usage() - - // Setting things back to normal - c.outWriter = tmpOutput - c.errWriter = tmpErr - + c.output = tmpOutput return bb.String() } @@ -881,11 +817,13 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // overriding c.InitDefaultHelpCmd() - args := c.args + var args []string // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155 if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" { args = os.Args[1:] + } else { + args = c.args } var flags []string @@ -1132,21 +1070,6 @@ func (c *Command) Printf(format string, i ...interface{}) { c.Print(fmt.Sprintf(format, i...)) } -// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set. -func (c *Command) PrintErr(i ...interface{}) { - fmt.Fprint(c.ErrOrStderr(), i...) -} - -// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set. -func (c *Command) PrintErrln(i ...interface{}) { - c.Print(fmt.Sprintln(i...)) -} - -// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set. -func (c *Command) PrintErrf(format string, i ...interface{}) { - c.Print(fmt.Sprintf(format, i...)) -} - // CommandPath returns the full path to this command. func (c *Command) CommandPath() string { if c.HasParent() { @@ -1412,7 +1335,7 @@ func (c *Command) LocalFlags() *flag.FlagSet { return c.lflags } -// InheritedFlags returns all flags which were inherited from parent commands. +// InheritedFlags returns all flags which were inherited from parents commands. func (c *Command) InheritedFlags() *flag.FlagSet { c.mergePersistentFlags() diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go index 8768b173..edec728e 100644 --- a/vendor/github.com/spf13/cobra/command_win.go +++ b/vendor/github.com/spf13/cobra/command_win.go @@ -3,7 +3,6 @@ package cobra import ( - "fmt" "os" "time" @@ -15,12 +14,7 @@ var preExecHookFn = preExecHook func preExecHook(c *Command) { if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { c.Print(MousetrapHelpText) - if MousetrapDisplayDuration > 0 { - time.Sleep(MousetrapDisplayDuration) - } else { - c.Println("Press return to continue...") - fmt.Scanln() - } + time.Sleep(5 * time.Second) os.Exit(1) } } diff --git a/vendor/github.com/spf13/cobra/go.mod b/vendor/github.com/spf13/cobra/go.mod deleted file mode 100644 index 9a9eb65a..00000000 --- a/vendor/github.com/spf13/cobra/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/spf13/cobra - -go 1.12 - -require ( - github.com/BurntSushi/toml v0.3.1 // indirect - github.com/cpuguy83/go-md2man v1.0.10 - github.com/inconshreveable/mousetrap v1.0.0 - github.com/mitchellh/go-homedir v1.1.0 - github.com/spf13/pflag v1.0.3 - github.com/spf13/viper v1.3.2 - gopkg.in/yaml.v2 v2.2.2 -) diff --git a/vendor/github.com/spf13/cobra/go.sum b/vendor/github.com/spf13/cobra/go.sum deleted file mode 100644 index 9761f4d0..00000000 --- a/vendor/github.com/spf13/cobra/go.sum +++ /dev/null @@ -1,51 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/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/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -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/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -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.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -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.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go deleted file mode 100644 index 756c61b9..00000000 --- a/vendor/github.com/spf13/cobra/powershell_completions.go +++ /dev/null @@ -1,100 +0,0 @@ -// PowerShell completions are based on the amazing work from clap: -// https://github.com/clap-rs/clap/blob/3294d18efe5f264d12c9035f404c7d189d4824e1/src/completions/powershell.rs -// -// The generated scripts require PowerShell v5.0+ (which comes Windows 10, but -// can be downloaded separately for windows 7 or 8.1). - -package cobra - -import ( - "bytes" - "fmt" - "io" - "os" - "strings" - - "github.com/spf13/pflag" -) - -var powerShellCompletionTemplate = `using namespace System.Management.Automation -using namespace System.Management.Automation.Language -Register-ArgumentCompleter -Native -CommandName '%s' -ScriptBlock { - param($wordToComplete, $commandAst, $cursorPosition) - $commandElements = $commandAst.CommandElements - $command = @( - '%s' - for ($i = 1; $i -lt $commandElements.Count; $i++) { - $element = $commandElements[$i] - if ($element -isnot [StringConstantExpressionAst] -or - $element.StringConstantType -ne [StringConstantType]::BareWord -or - $element.Value.StartsWith('-')) { - break - } - $element.Value - } - ) -join ';' - $completions = @(switch ($command) {%s - }) - $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | - Sort-Object -Property ListItemText -}` - -func generatePowerShellSubcommandCases(out io.Writer, cmd *Command, previousCommandName string) { - var cmdName string - if previousCommandName == "" { - cmdName = cmd.Name() - } else { - cmdName = fmt.Sprintf("%s;%s", previousCommandName, cmd.Name()) - } - - fmt.Fprintf(out, "\n '%s' {", cmdName) - - cmd.Flags().VisitAll(func(flag *pflag.Flag) { - if nonCompletableFlag(flag) { - return - } - usage := escapeStringForPowerShell(flag.Usage) - if len(flag.Shorthand) > 0 { - fmt.Fprintf(out, "\n [CompletionResult]::new('-%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Shorthand, flag.Shorthand, usage) - } - fmt.Fprintf(out, "\n [CompletionResult]::new('--%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Name, flag.Name, usage) - }) - - for _, subCmd := range cmd.Commands() { - usage := escapeStringForPowerShell(subCmd.Short) - fmt.Fprintf(out, "\n [CompletionResult]::new('%s', '%s', [CompletionResultType]::ParameterValue, '%s')", subCmd.Name(), subCmd.Name(), usage) - } - - fmt.Fprint(out, "\n break\n }") - - for _, subCmd := range cmd.Commands() { - generatePowerShellSubcommandCases(out, subCmd, cmdName) - } -} - -func escapeStringForPowerShell(s string) string { - return strings.Replace(s, "'", "''", -1) -} - -// GenPowerShellCompletion generates PowerShell completion file and writes to the passed writer. -func (c *Command) GenPowerShellCompletion(w io.Writer) error { - buf := new(bytes.Buffer) - - var subCommandCases bytes.Buffer - generatePowerShellSubcommandCases(&subCommandCases, c, "") - fmt.Fprintf(buf, powerShellCompletionTemplate, c.Name(), c.Name(), subCommandCases.String()) - - _, err := buf.WriteTo(w) - return err -} - -// GenPowerShellCompletionFile generates PowerShell completion file. -func (c *Command) GenPowerShellCompletionFile(filename string) error { - outFile, err := os.Create(filename) - if err != nil { - return err - } - defer outFile.Close() - - return c.GenPowerShellCompletion(outFile) -} diff --git a/vendor/github.com/spf13/cobra/powershell_completions.md b/vendor/github.com/spf13/cobra/powershell_completions.md deleted file mode 100644 index afed8024..00000000 --- a/vendor/github.com/spf13/cobra/powershell_completions.md +++ /dev/null @@ -1,14 +0,0 @@ -# Generating PowerShell Completions For Your Own cobra.Command - -Cobra can generate PowerShell completion scripts. Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. - -# What's supported - -- Completion for subcommands using their `.Short` description -- Completion for non-hidden flags using their `.Name` and `.Shorthand` - -# What's not yet supported - -- Command aliases -- Required, filename or custom flags (they will work like normal flags) -- Custom completion scripts diff --git a/vendor/github.com/spf13/cobra/shell_completions.go b/vendor/github.com/spf13/cobra/shell_completions.go deleted file mode 100644 index ba0af9cb..00000000 --- a/vendor/github.com/spf13/cobra/shell_completions.go +++ /dev/null @@ -1,85 +0,0 @@ -package cobra - -import ( - "github.com/spf13/pflag" -) - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists, -// and causes your command to report an error if invoked without the flag. -func (c *Command) MarkFlagRequired(name string) error { - return MarkFlagRequired(c.Flags(), name) -} - -// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag if it exists, -// and causes your command to report an error if invoked without the flag. -func (c *Command) MarkPersistentFlagRequired(name string) error { - return MarkFlagRequired(c.PersistentFlags(), name) -} - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists, -// and causes your command to report an error if invoked without the flag. -func MarkFlagRequired(flags *pflag.FlagSet, name string) error { - return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) -} - -// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func (c *Command) MarkFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(c.Flags(), name, extensions...) -} - -// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. -// Generated bash autocompletion will call the bash function f for the flag. -func (c *Command) MarkFlagCustom(name string, f string) error { - return MarkFlagCustom(c.Flags(), name, f) -} - -// MarkPersistentFlagFilename instructs the various shell completion -// implementations to limit completions for this persistent flag to the -// specified extensions (patterns). -// -// Shell Completion compatibility matrix: bash, zsh -func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(c.PersistentFlags(), name, extensions...) -} - -// MarkFlagFilename instructs the various shell completion implementations to -// limit completions for this flag to the specified extensions (patterns). -// -// Shell Completion compatibility matrix: bash, zsh -func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { - return flags.SetAnnotation(name, BashCompFilenameExt, extensions) -} - -// MarkFlagCustom instructs the various shell completion implementations to -// limit completions for this flag to the specified extensions (patterns). -// -// Shell Completion compatibility matrix: bash, zsh -func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { - return flags.SetAnnotation(name, BashCompCustom, []string{f}) -} - -// MarkFlagDirname instructs the various shell completion implementations to -// complete only directories with this named flag. -// -// Shell Completion compatibility matrix: zsh -func (c *Command) MarkFlagDirname(name string) error { - return MarkFlagDirname(c.Flags(), name) -} - -// MarkPersistentFlagDirname instructs the various shell completion -// implementations to complete only directories with this persistent named flag. -// -// Shell Completion compatibility matrix: zsh -func (c *Command) MarkPersistentFlagDirname(name string) error { - return MarkFlagDirname(c.PersistentFlags(), name) -} - -// MarkFlagDirname instructs the various shell completion implementations to -// complete only directories with this specified flag. -// -// Shell Completion compatibility matrix: zsh -func MarkFlagDirname(flags *pflag.FlagSet, name string) error { - zshPattern := "-(/)" - return flags.SetAnnotation(name, zshCompDirname, []string{zshPattern}) -} diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go index 12755482..889c22e2 100644 --- a/vendor/github.com/spf13/cobra/zsh_completions.go +++ b/vendor/github.com/spf13/cobra/zsh_completions.go @@ -1,102 +1,13 @@ package cobra import ( - "encoding/json" + "bytes" "fmt" "io" "os" - "sort" "strings" - "text/template" - - "github.com/spf13/pflag" ) -const ( - zshCompArgumentAnnotation = "cobra_annotations_zsh_completion_argument_annotation" - zshCompArgumentFilenameComp = "cobra_annotations_zsh_completion_argument_file_completion" - zshCompArgumentWordComp = "cobra_annotations_zsh_completion_argument_word_completion" - zshCompDirname = "cobra_annotations_zsh_dirname" -) - -var ( - zshCompFuncMap = template.FuncMap{ - "genZshFuncName": zshCompGenFuncName, - "extractFlags": zshCompExtractFlag, - "genFlagEntryForZshArguments": zshCompGenFlagEntryForArguments, - "extractArgsCompletions": zshCompExtractArgumentCompletionHintsForRendering, - } - zshCompletionText = ` -{{/* should accept Command (that contains subcommands) as parameter */}} -{{define "argumentsC" -}} -{{ $cmdPath := genZshFuncName .}} -function {{$cmdPath}} { - local -a commands - - _arguments -C \{{- range extractFlags .}} - {{genFlagEntryForZshArguments .}} \{{- end}} - "1: :->cmnds" \ - "*::arg:->args" - - case $state in - cmnds) - commands=({{range .Commands}}{{if not .Hidden}} - "{{.Name}}:{{.Short}}"{{end}}{{end}} - ) - _describe "command" commands - ;; - esac - - case "$words[1]" in {{- range .Commands}}{{if not .Hidden}} - {{.Name}}) - {{$cmdPath}}_{{.Name}} - ;;{{end}}{{end}} - esac -} -{{range .Commands}}{{if not .Hidden}} -{{template "selectCmdTemplate" .}} -{{- end}}{{end}} -{{- end}} - -{{/* should accept Command without subcommands as parameter */}} -{{define "arguments" -}} -function {{genZshFuncName .}} { -{{" _arguments"}}{{range extractFlags .}} \ - {{genFlagEntryForZshArguments . -}} -{{end}}{{range extractArgsCompletions .}} \ - {{.}}{{end}} -} -{{end}} - -{{/* dispatcher for commands with or without subcommands */}} -{{define "selectCmdTemplate" -}} -{{if .Hidden}}{{/* ignore hidden*/}}{{else -}} -{{if .Commands}}{{template "argumentsC" .}}{{else}}{{template "arguments" .}}{{end}} -{{- end}} -{{- end}} - -{{/* template entry point */}} -{{define "Main" -}} -#compdef _{{.Name}} {{.Name}} - -{{template "selectCmdTemplate" .}} -{{end}} -` -) - -// zshCompArgsAnnotation is used to encode/decode zsh completion for -// arguments to/from Command.Annotations. -type zshCompArgsAnnotation map[int]zshCompArgHint - -type zshCompArgHint struct { - // Indicates the type of the completion to use. One of: - // zshCompArgumentFilenameComp or zshCompArgumentWordComp - Tipe string `json:"type"` - - // A value for the type above (globs for file completion or words) - Options []string `json:"options"` -} - // GenZshCompletionFile generates zsh completion file. func (c *Command) GenZshCompletionFile(filename string) error { outFile, err := os.Create(filename) @@ -108,229 +19,108 @@ func (c *Command) GenZshCompletionFile(filename string) error { return c.GenZshCompletion(outFile) } -// GenZshCompletion generates a zsh completion file and writes to the passed -// writer. The completion always run on the root command regardless of the -// command it was called from. +// GenZshCompletion generates a zsh completion file and writes to the passed writer. func (c *Command) GenZshCompletion(w io.Writer) error { - tmpl, err := template.New("Main").Funcs(zshCompFuncMap).Parse(zshCompletionText) - if err != nil { - return fmt.Errorf("error creating zsh completion template: %v", err) - } - return tmpl.Execute(w, c.Root()) + buf := new(bytes.Buffer) + + writeHeader(buf, c) + maxDepth := maxDepth(c) + writeLevelMapping(buf, maxDepth) + writeLevelCases(buf, maxDepth, c) + + _, err := buf.WriteTo(w) + return err } -// MarkZshCompPositionalArgumentFile marks the specified argument (first -// argument is 1) as completed by file selection. patterns (e.g. "*.txt") are -// optional - if not provided the completion will search for all files. -func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error { - if argPosition < 1 { - return fmt.Errorf("Invalid argument position (%d)", argPosition) - } - annotation, err := c.zshCompGetArgsAnnotations() - if err != nil { - return err - } - if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) { - return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition) - } - annotation[argPosition] = zshCompArgHint{ - Tipe: zshCompArgumentFilenameComp, - Options: patterns, - } - return c.zshCompSetArgsAnnotations(annotation) +func writeHeader(w io.Writer, cmd *Command) { + fmt.Fprintf(w, "#compdef %s\n\n", cmd.Name()) } -// MarkZshCompPositionalArgumentWords marks the specified positional argument -// (first argument is 1) as completed by the provided words. At east one word -// must be provided, spaces within words will be offered completion with -// "word\ word". -func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error { - if argPosition < 1 { - return fmt.Errorf("Invalid argument position (%d)", argPosition) +func maxDepth(c *Command) int { + if len(c.Commands()) == 0 { + return 0 } - if len(words) == 0 { - return fmt.Errorf("Trying to set empty word list for positional argument %d", argPosition) - } - annotation, err := c.zshCompGetArgsAnnotations() - if err != nil { - return err - } - if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) { - return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition) - } - annotation[argPosition] = zshCompArgHint{ - Tipe: zshCompArgumentWordComp, - Options: words, - } - return c.zshCompSetArgsAnnotations(annotation) -} - -func zshCompExtractArgumentCompletionHintsForRendering(c *Command) ([]string, error) { - var result []string - annotation, err := c.zshCompGetArgsAnnotations() - if err != nil { - return nil, err - } - for k, v := range annotation { - s, err := zshCompRenderZshCompArgHint(k, v) - if err != nil { - return nil, err - } - result = append(result, s) - } - if len(c.ValidArgs) > 0 { - if _, positionOneExists := annotation[1]; !positionOneExists { - s, err := zshCompRenderZshCompArgHint(1, zshCompArgHint{ - Tipe: zshCompArgumentWordComp, - Options: c.ValidArgs, - }) - if err != nil { - return nil, err - } - result = append(result, s) + maxDepthSub := 0 + for _, s := range c.Commands() { + subDepth := maxDepth(s) + if subDepth > maxDepthSub { + maxDepthSub = subDepth } } - sort.Strings(result) - return result, nil + return 1 + maxDepthSub } -func zshCompRenderZshCompArgHint(i int, z zshCompArgHint) (string, error) { - switch t := z.Tipe; t { - case zshCompArgumentFilenameComp: - var globs []string - for _, g := range z.Options { - globs = append(globs, fmt.Sprintf(`-g "%s"`, g)) +func writeLevelMapping(w io.Writer, numLevels int) { + fmt.Fprintln(w, `_arguments \`) + for i := 1; i <= numLevels; i++ { + fmt.Fprintf(w, ` '%d: :->level%d' \`, i, i) + fmt.Fprintln(w) + } + fmt.Fprintf(w, ` '%d: :%s'`, numLevels+1, "_files") + fmt.Fprintln(w) +} + +func writeLevelCases(w io.Writer, maxDepth int, root *Command) { + fmt.Fprintln(w, "case $state in") + defer fmt.Fprintln(w, "esac") + + for i := 1; i <= maxDepth; i++ { + fmt.Fprintf(w, " level%d)\n", i) + writeLevel(w, root, i) + fmt.Fprintln(w, " ;;") + } + fmt.Fprintln(w, " *)") + fmt.Fprintln(w, " _arguments '*: :_files'") + fmt.Fprintln(w, " ;;") +} + +func writeLevel(w io.Writer, root *Command, i int) { + fmt.Fprintf(w, " case $words[%d] in\n", i) + defer fmt.Fprintln(w, " esac") + + commands := filterByLevel(root, i) + byParent := groupByParent(commands) + + for p, c := range byParent { + names := names(c) + fmt.Fprintf(w, " %s)\n", p) + fmt.Fprintf(w, " _arguments '%d: :(%s)'\n", i, strings.Join(names, " ")) + fmt.Fprintln(w, " ;;") + } + fmt.Fprintln(w, " *)") + fmt.Fprintln(w, " _arguments '*: :_files'") + fmt.Fprintln(w, " ;;") + +} + +func filterByLevel(c *Command, l int) []*Command { + cs := make([]*Command, 0) + if l == 0 { + cs = append(cs, c) + return cs + } + for _, s := range c.Commands() { + cs = append(cs, filterByLevel(s, l-1)...) + } + return cs +} + +func groupByParent(commands []*Command) map[string][]*Command { + m := make(map[string][]*Command) + for _, c := range commands { + parent := c.Parent() + if parent == nil { + continue } - return fmt.Sprintf(`'%d: :_files %s'`, i, strings.Join(globs, " ")), nil - case zshCompArgumentWordComp: - var words []string - for _, w := range z.Options { - words = append(words, fmt.Sprintf("%q", w)) - } - return fmt.Sprintf(`'%d: :(%s)'`, i, strings.Join(words, " ")), nil - default: - return "", fmt.Errorf("Invalid zsh argument completion annotation: %s", t) + m[parent.Name()] = append(m[parent.Name()], c) } + return m } -func (c *Command) zshcompArgsAnnotationnIsDuplicatePosition(annotation zshCompArgsAnnotation, position int) bool { - _, dup := annotation[position] - return dup -} - -func (c *Command) zshCompGetArgsAnnotations() (zshCompArgsAnnotation, error) { - annotation := make(zshCompArgsAnnotation) - annotationString, ok := c.Annotations[zshCompArgumentAnnotation] - if !ok { - return annotation, nil +func names(commands []*Command) []string { + ns := make([]string, len(commands)) + for i, c := range commands { + ns[i] = c.Name() } - err := json.Unmarshal([]byte(annotationString), &annotation) - if err != nil { - return annotation, fmt.Errorf("Error unmarshaling zsh argument annotation: %v", err) - } - return annotation, nil -} - -func (c *Command) zshCompSetArgsAnnotations(annotation zshCompArgsAnnotation) error { - jsn, err := json.Marshal(annotation) - if err != nil { - return fmt.Errorf("Error marshaling zsh argument annotation: %v", err) - } - if c.Annotations == nil { - c.Annotations = make(map[string]string) - } - c.Annotations[zshCompArgumentAnnotation] = string(jsn) - return nil -} - -func zshCompGenFuncName(c *Command) string { - if c.HasParent() { - return zshCompGenFuncName(c.Parent()) + "_" + c.Name() - } - return "_" + c.Name() -} - -func zshCompExtractFlag(c *Command) []*pflag.Flag { - var flags []*pflag.Flag - c.LocalFlags().VisitAll(func(f *pflag.Flag) { - if !f.Hidden { - flags = append(flags, f) - } - }) - c.InheritedFlags().VisitAll(func(f *pflag.Flag) { - if !f.Hidden { - flags = append(flags, f) - } - }) - return flags -} - -// zshCompGenFlagEntryForArguments returns an entry that matches _arguments -// zsh-completion parameters. It's too complicated to generate in a template. -func zshCompGenFlagEntryForArguments(f *pflag.Flag) string { - if f.Name == "" || f.Shorthand == "" { - return zshCompGenFlagEntryForSingleOptionFlag(f) - } - return zshCompGenFlagEntryForMultiOptionFlag(f) -} - -func zshCompGenFlagEntryForSingleOptionFlag(f *pflag.Flag) string { - var option, multiMark, extras string - - if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) { - multiMark = "*" - } - - option = "--" + f.Name - if option == "--" { - option = "-" + f.Shorthand - } - extras = zshCompGenFlagEntryExtras(f) - - return fmt.Sprintf(`'%s%s[%s]%s'`, multiMark, option, zshCompQuoteFlagDescription(f.Usage), extras) -} - -func zshCompGenFlagEntryForMultiOptionFlag(f *pflag.Flag) string { - var options, parenMultiMark, curlyMultiMark, extras string - - if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) { - parenMultiMark = "*" - curlyMultiMark = "\\*" - } - - options = fmt.Sprintf(`'(%s-%s %s--%s)'{%s-%s,%s--%s}`, - parenMultiMark, f.Shorthand, parenMultiMark, f.Name, curlyMultiMark, f.Shorthand, curlyMultiMark, f.Name) - extras = zshCompGenFlagEntryExtras(f) - - return fmt.Sprintf(`%s'[%s]%s'`, options, zshCompQuoteFlagDescription(f.Usage), extras) -} - -func zshCompGenFlagEntryExtras(f *pflag.Flag) string { - if f.NoOptDefVal != "" { - return "" - } - - extras := ":" // allow options for flag (even without assistance) - for key, values := range f.Annotations { - switch key { - case zshCompDirname: - extras = fmt.Sprintf(":filename:_files -g %q", values[0]) - case BashCompFilenameExt: - extras = ":filename:_files" - for _, pattern := range values { - extras = extras + fmt.Sprintf(` -g "%s"`, pattern) - } - } - } - - return extras -} - -func zshCompFlagCouldBeSpecifiedMoreThenOnce(f *pflag.Flag) bool { - return strings.Contains(f.Value.Type(), "Slice") || - strings.Contains(f.Value.Type(), "Array") -} - -func zshCompQuoteFlagDescription(s string) string { - return strings.Replace(s, "'", `'\''`, -1) + return ns } diff --git a/vendor/github.com/spf13/cobra/zsh_completions.md b/vendor/github.com/spf13/cobra/zsh_completions.md deleted file mode 100644 index df9c2eac..00000000 --- a/vendor/github.com/spf13/cobra/zsh_completions.md +++ /dev/null @@ -1,39 +0,0 @@ -## Generating Zsh Completion for your cobra.Command - -Cobra supports native Zsh completion generated from the root `cobra.Command`. -The generated completion script should be put somewhere in your `$fpath` named -`_`. - -### What's Supported - -* Completion for all non-hidden subcommands using their `.Short` description. -* Completion for all non-hidden flags using the following rules: - * Filename completion works by marking the flag with `cmd.MarkFlagFilename...` - family of commands. - * The requirement for argument to the flag is decided by the `.NoOptDefVal` - flag value - if it's empty then completion will expect an argument. - * Flags of one of the various `*Array` and `*Slice` types supports multiple - specifications (with or without argument depending on the specific type). -* Completion of positional arguments using the following rules: - * Argument position for all options below starts at `1`. If argument position - `0` is requested it will raise an error. - * Use `command.MarkZshCompPositionalArgumentFile` to complete filenames. Glob - patterns (e.g. `"*.log"`) are optional - if not specified it will offer to - complete all file types. - * Use `command.MarkZshCompPositionalArgumentWords` to offer specific words for - completion. At least one word is required. - * It's possible to specify completion for some arguments and leave some - unspecified (e.g. offer words for second argument but nothing for first - argument). This will cause no completion for first argument but words - completion for second argument. - * If no argument completion was specified for 1st argument (but optionally was - specified for 2nd) and the command has `ValidArgs` it will be used as - completion options for 1st argument. - * Argument completions only offered for commands with no subcommands. - -### What's not yet Supported - -* Custom completion scripts are not supported yet (We should probably create zsh - specific one, doesn't make sense to re-use the bash one as the functions will - be different). -* Whatever other feature you're looking for and doesn't exist :) diff --git a/vendor/github.com/spf13/jwalterweatherman/.gitignore b/vendor/github.com/spf13/jwalterweatherman/.gitignore index a71f88af..00268614 100644 --- a/vendor/github.com/spf13/jwalterweatherman/.gitignore +++ b/vendor/github.com/spf13/jwalterweatherman/.gitignore @@ -20,5 +20,3 @@ _cgo_export.* _testmain.go *.exe -*.bench -go.sum \ No newline at end of file diff --git a/vendor/github.com/spf13/jwalterweatherman/default_notepad.go b/vendor/github.com/spf13/jwalterweatherman/default_notepad.go index a018c15c..bcb76340 100644 --- a/vendor/github.com/spf13/jwalterweatherman/default_notepad.go +++ b/vendor/github.com/spf13/jwalterweatherman/default_notepad.go @@ -64,13 +64,6 @@ func SetStdoutThreshold(threshold Threshold) { reloadDefaultNotepad() } -// SetStdoutOutput set the stdout output for the default notepad. Default is stdout. -func SetStdoutOutput(handle io.Writer) { - defaultNotepad.outHandle = handle - defaultNotepad.init() - reloadDefaultNotepad() -} - // SetPrefix set the prefix for the default logger. Empty by default. func SetPrefix(prefix string) { defaultNotepad.SetPrefix(prefix) @@ -83,13 +76,6 @@ func SetFlags(flags int) { reloadDefaultNotepad() } -// SetLogListeners configures the default logger with one or more log listeners. -func SetLogListeners(l ...LogListener) { - defaultNotepad.logListeners = l - defaultNotepad.init() - reloadDefaultNotepad() -} - // Level returns the current global log threshold. func LogThreshold() Threshold { return defaultNotepad.logThreshold @@ -109,3 +95,19 @@ func GetLogThreshold() Threshold { func GetStdoutThreshold() Threshold { return defaultNotepad.GetStdoutThreshold() } + +// LogCountForLevel returns the number of log invocations for a given threshold. +func LogCountForLevel(l Threshold) uint64 { + return defaultNotepad.LogCountForLevel(l) +} + +// LogCountForLevelsGreaterThanorEqualTo returns the number of log invocations +// greater than or equal to a given threshold. +func LogCountForLevelsGreaterThanorEqualTo(threshold Threshold) uint64 { + return defaultNotepad.LogCountForLevelsGreaterThanorEqualTo(threshold) +} + +// ResetLogCounters resets the invocation counters for all levels. +func ResetLogCounters() { + defaultNotepad.ResetLogCounters() +} diff --git a/vendor/github.com/spf13/jwalterweatherman/go.mod b/vendor/github.com/spf13/jwalterweatherman/go.mod index 1dbcfd3e..bce549c0 100644 --- a/vendor/github.com/spf13/jwalterweatherman/go.mod +++ b/vendor/github.com/spf13/jwalterweatherman/go.mod @@ -1,7 +1 @@ module github.com/spf13/jwalterweatherman - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 -) diff --git a/vendor/github.com/spf13/jwalterweatherman/log_counter.go b/vendor/github.com/spf13/jwalterweatherman/log_counter.go index 41285f3d..11423ac4 100644 --- a/vendor/github.com/spf13/jwalterweatherman/log_counter.go +++ b/vendor/github.com/spf13/jwalterweatherman/log_counter.go @@ -6,41 +6,50 @@ package jwalterweatherman import ( - "io" "sync/atomic" ) -// Counter is an io.Writer that increments a counter on Write. -type Counter struct { - count uint64 +type logCounter struct { + counter uint64 } -func (c *Counter) incr() { - atomic.AddUint64(&c.count, 1) +func (c *logCounter) incr() { + atomic.AddUint64(&c.counter, 1) } -// Reset resets the counter. -func (c *Counter) Reset() { - atomic.StoreUint64(&c.count, 0) +func (c *logCounter) resetCounter() { + atomic.StoreUint64(&c.counter, 0) } -// Count returns the current count. -func (c *Counter) Count() uint64 { - return atomic.LoadUint64(&c.count) +func (c *logCounter) getCount() uint64 { + return atomic.LoadUint64(&c.counter) } -func (c *Counter) Write(p []byte) (n int, err error) { +func (c *logCounter) Write(p []byte) (n int, err error) { c.incr() return len(p), nil } -// LogCounter creates a LogListener that counts log statements >= the given threshold. -func LogCounter(counter *Counter, t1 Threshold) LogListener { - return func(t2 Threshold) io.Writer { - if t2 < t1 { - // Not interested in this threshold. - return nil - } - return counter +// LogCountForLevel returns the number of log invocations for a given threshold. +func (n *Notepad) LogCountForLevel(l Threshold) uint64 { + return n.logCounters[l].getCount() +} + +// LogCountForLevelsGreaterThanorEqualTo returns the number of log invocations +// greater than or equal to a given threshold. +func (n *Notepad) LogCountForLevelsGreaterThanorEqualTo(threshold Threshold) uint64 { + var cnt uint64 + + for i := int(threshold); i < len(n.logCounters); i++ { + cnt += n.LogCountForLevel(Threshold(i)) + } + + return cnt +} + +// ResetLogCounters resets the invocation counters for all levels. +func (n *Notepad) ResetLogCounters() { + for _, np := range n.logCounters { + np.resetCounter() } } diff --git a/vendor/github.com/spf13/jwalterweatherman/notepad.go b/vendor/github.com/spf13/jwalterweatherman/notepad.go index cc7957bf..ae5aaf71 100644 --- a/vendor/github.com/spf13/jwalterweatherman/notepad.go +++ b/vendor/github.com/spf13/jwalterweatherman/notepad.go @@ -8,7 +8,6 @@ package jwalterweatherman import ( "fmt" "io" - "io/ioutil" "log" ) @@ -59,28 +58,13 @@ type Notepad struct { prefix string flags int - logListeners []LogListener + // One per Threshold + logCounters [7]*logCounter } -// A LogListener can ble supplied to a Notepad to listen on log writes for a given -// threshold. This can be used to capture log events in unit tests and similar. -// Note that this function will be invoked once for each log threshold. If -// the given threshold is not of interest to you, return nil. -// Note that these listeners will receive log events for a given threshold, even -// if the current configuration says not to log it. That way you can count ERRORs even -// if you don't print them to the console. -type LogListener func(t Threshold) io.Writer - -// NewNotepad creates a new Notepad. -func NewNotepad( - outThreshold Threshold, - logThreshold Threshold, - outHandle, logHandle io.Writer, - prefix string, flags int, - logListeners ...LogListener, -) *Notepad { - - n := &Notepad{logListeners: logListeners} +// NewNotepad create a new notepad. +func NewNotepad(outThreshold Threshold, logThreshold Threshold, outHandle, logHandle io.Writer, prefix string, flags int) *Notepad { + n := &Notepad{} n.loggers = [7]**log.Logger{&n.TRACE, &n.DEBUG, &n.INFO, &n.WARN, &n.ERROR, &n.CRITICAL, &n.FATAL} n.outHandle = outHandle @@ -111,43 +95,28 @@ func (n *Notepad) init() { for t, logger := range n.loggers { threshold := Threshold(t) + counter := &logCounter{} + n.logCounters[t] = counter prefix := n.prefix + threshold.String() + " " switch { case threshold >= n.logThreshold && threshold >= n.stdoutThreshold: - *logger = log.New(n.createLogWriters(threshold, logAndOut), prefix, n.flags) + *logger = log.New(io.MultiWriter(counter, logAndOut), prefix, n.flags) case threshold >= n.logThreshold: - *logger = log.New(n.createLogWriters(threshold, n.logHandle), prefix, n.flags) + *logger = log.New(io.MultiWriter(counter, n.logHandle), prefix, n.flags) case threshold >= n.stdoutThreshold: - *logger = log.New(n.createLogWriters(threshold, n.outHandle), prefix, n.flags) + *logger = log.New(io.MultiWriter(counter, n.outHandle), prefix, n.flags) default: - *logger = log.New(n.createLogWriters(threshold, ioutil.Discard), prefix, n.flags) + // counter doesn't care about prefix and flags, so don't use them + // for performance. + *logger = log.New(counter, "", 0) } } } -func (n *Notepad) createLogWriters(t Threshold, handle io.Writer) io.Writer { - if len(n.logListeners) == 0 { - return handle - } - writers := []io.Writer{handle} - for _, l := range n.logListeners { - w := l(t) - if w != nil { - writers = append(writers, w) - } - } - - if len(writers) == 1 { - return handle - } - - return io.MultiWriter(writers...) -} - // SetLogThreshold changes the threshold above which messages are written to the // log file. func (n *Notepad) SetLogThreshold(threshold Threshold) { diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index 9beeda8e..5cc710cc 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -925,16 +925,13 @@ func stripUnknownFlagValue(args []string) []string { } first := args[0] - if len(first) > 0 && first[0] == '-' { + if first[0] == '-' { //--unknown --next-flag ... return args } //--unknown arg ... (args will be arg ...) - if len(args) > 1 { - return args[1:] - } - return nil + return args[1:] } func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { diff --git a/vendor/github.com/spf13/pflag/string_to_int.go b/vendor/github.com/spf13/pflag/string_to_int.go deleted file mode 100644 index 5ceda396..00000000 --- a/vendor/github.com/spf13/pflag/string_to_int.go +++ /dev/null @@ -1,149 +0,0 @@ -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) -} diff --git a/vendor/github.com/spf13/pflag/string_to_string.go b/vendor/github.com/spf13/pflag/string_to_string.go deleted file mode 100644 index 890a01af..00000000 --- a/vendor/github.com/spf13/pflag/string_to_string.go +++ /dev/null @@ -1,160 +0,0 @@ -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) -} diff --git a/vendor/github.com/spf13/viper/.gitignore b/vendor/github.com/spf13/viper/.gitignore index 01b5c44b..352a34a5 100644 --- a/vendor/github.com/spf13/viper/.gitignore +++ b/vendor/github.com/spf13/viper/.gitignore @@ -21,9 +21,4 @@ _testmain.go *.exe *.test -*.bench - -.vscode - -# exclude dependencies in the `/vendor` folder -vendor +*.bench \ No newline at end of file diff --git a/vendor/github.com/spf13/viper/.travis.yml b/vendor/github.com/spf13/viper/.travis.yml index bb83057b..22a8a00e 100644 --- a/vendor/github.com/spf13/viper/.travis.yml +++ b/vendor/github.com/spf13/viper/.travis.yml @@ -1,12 +1,8 @@ go_import_path: github.com/spf13/viper language: go - -env: - global: - - GO111MODULE="on" - go: + - 1.10.x - 1.11.x - tip diff --git a/vendor/github.com/spf13/viper/README.md b/vendor/github.com/spf13/viper/README.md index 0208eac8..87bbc8b4 100644 --- a/vendor/github.com/spf13/viper/README.md +++ b/vendor/github.com/spf13/viper/README.md @@ -179,14 +179,13 @@ viper.GetBool("verbose") // true ### Working with Environment Variables Viper has full support for environment variables. This enables 12 factor -applications out of the box. There are five methods that exist to aid working +applications out of the box. There are four methods that exist to aid working with ENV: * `AutomaticEnv()` * `BindEnv(string...) : error` * `SetEnvPrefix(string)` * `SetEnvKeyReplacer(string...) *strings.Replacer` - * `AllowEmptyEnvVar(bool)` _When working with ENV variables, it’s important to recognize that Viper treats ENV variables as case sensitive._ @@ -218,10 +217,6 @@ keys to an extent. This is useful if you want to use `-` or something in your `Get()` calls, but want your environmental variables to use `_` delimiters. An example of using it can be found in `viper_test.go`. -By default empty environment variables are considered unset and will fall back to -the next configuration source. To treat empty environment variables as set, use -the `AllowEmptyEnv` method. - #### Env example ```go diff --git a/vendor/github.com/spf13/viper/go.mod b/vendor/github.com/spf13/viper/go.mod index 27943005..3f4e1c22 100644 --- a/vendor/github.com/spf13/viper/go.mod +++ b/vendor/github.com/spf13/viper/go.mod @@ -1,43 +1,16 @@ module github.com/spf13/viper require ( - github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect - github.com/coreos/bbolt v1.3.2 // indirect - github.com/coreos/etcd v3.3.10+incompatible // indirect - github.com/coreos/go-semver v0.2.0 // indirect - github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect - github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect - github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/fsnotify/fsnotify v1.4.7 - github.com/gogo/protobuf v1.2.1 // indirect - github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect - github.com/google/btree v1.0.0 // indirect - github.com/gorilla/websocket v1.4.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 // indirect - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.9.0 // indirect github.com/hashicorp/hcl v1.0.0 - github.com/jonboulle/clockwork v0.1.0 // indirect github.com/magiconair/properties v1.8.0 - github.com/mitchellh/mapstructure v1.1.2 + github.com/mitchellh/mapstructure v1.0.0 github.com/pelletier/go-toml v1.2.0 - github.com/prometheus/client_golang v0.9.3 // indirect - github.com/soheilhy/cmux v0.1.4 // indirect github.com/spf13/afero v1.1.2 - github.com/spf13/cast v1.3.0 + github.com/spf13/cast v1.2.0 github.com/spf13/jwalterweatherman v1.0.0 - github.com/spf13/pflag v1.0.3 - github.com/stretchr/testify v1.2.2 - github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect - github.com/ugorji/go v1.1.4 // indirect - github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect - github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 - go.etcd.io/bbolt v1.3.2 // indirect - go.uber.org/atomic v1.4.0 // indirect - go.uber.org/multierr v1.1.0 // indirect - go.uber.org/zap v1.10.0 // indirect - golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect - golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect - google.golang.org/grpc v1.21.0 // indirect - gopkg.in/yaml.v2 v2.2.2 + 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 ) diff --git a/vendor/github.com/spf13/viper/go.sum b/vendor/github.com/spf13/viper/go.sum index 97afaffe..3e3b874b 100644 --- a/vendor/github.com/spf13/viper/go.sum +++ b/vendor/github.com/spf13/viper/go.sum @@ -1,178 +1,26 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= 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/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= 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/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +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/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 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.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +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.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +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= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -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 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/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/spf13/viper/viper.go b/vendor/github.com/spf13/viper/viper.go index a3d37f8c..051a3eff 100644 --- a/vendor/github.com/spf13/viper/viper.go +++ b/vendor/github.com/spf13/viper/viper.go @@ -30,7 +30,6 @@ import ( "path/filepath" "reflect" "strings" - "sync" "time" yaml "gopkg.in/yaml.v2" @@ -180,15 +179,13 @@ type Viper struct { remoteProviders []*defaultRemoteProvider // Name of file to look for inside the path - configName string - configFile string - configType string - configPermissions os.FileMode - envPrefix string + configName string + configFile string + configType string + envPrefix string automaticEnvApplied bool envKeyReplacer *strings.Replacer - allowEmptyEnv bool config map[string]interface{} override map[string]interface{} @@ -211,7 +208,6 @@ func New() *Viper { v := new(Viper) v.keyDelim = "." v.configName = "config" - v.configPermissions = os.FileMode(0644) v.fs = afero.NewOsFs() v.config = make(map[string]interface{}) v.override = make(map[string]interface{}) @@ -280,73 +276,48 @@ func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) { } func WatchConfig() { v.WatchConfig() } - func (v *Viper) WatchConfig() { - initWG := sync.WaitGroup{} - initWG.Add(1) go func() { watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() + // we have to watch the entire directory to pick up renames/atomic saves in a cross-platform way filename, err := v.getConfigFile() if err != nil { - log.Printf("error: %v\n", err) + log.Println("error:", err) return } configFile := filepath.Clean(filename) configDir, _ := filepath.Split(configFile) - realConfigFile, _ := filepath.EvalSymlinks(filename) - eventsWG := sync.WaitGroup{} - eventsWG.Add(1) + done := make(chan bool) go func() { for { select { - case event, ok := <-watcher.Events: - if !ok { // 'Events' channel is closed - eventsWG.Done() - return - } - currentConfigFile, _ := filepath.EvalSymlinks(filename) - // we only care about the config file with the following cases: - // 1 - if the config file was modified or created - // 2 - if the real path to the config file changed (eg: k8s ConfigMap replacement) - const writeOrCreateMask = fsnotify.Write | fsnotify.Create - if (filepath.Clean(event.Name) == configFile && - event.Op&writeOrCreateMask != 0) || - (currentConfigFile != "" && currentConfigFile != realConfigFile) { - realConfigFile = currentConfigFile - err := v.ReadInConfig() - if err != nil { - log.Printf("error reading config file: %v\n", err) - } - if v.onConfigChange != nil { + case event := <-watcher.Events: + // we only care about the config file + if filepath.Clean(event.Name) == configFile { + if event.Op&fsnotify.Write == fsnotify.Write || event.Op&fsnotify.Create == fsnotify.Create { + err := v.ReadInConfig() + if err != nil { + log.Println("error:", err) + } v.onConfigChange(event) } - } else if filepath.Clean(event.Name) == configFile && - event.Op&fsnotify.Remove&fsnotify.Remove != 0 { - eventsWG.Done() - return } - - case err, ok := <-watcher.Errors: - if ok { // 'Errors' channel is not closed - log.Printf("watcher error: %v\n", err) - } - eventsWG.Done() - return + case err := <-watcher.Errors: + log.Println("error:", err) } } }() + watcher.Add(configDir) - initWG.Done() // done initalizing the watch in this go routine, so the parent routine can move on... - eventsWG.Wait() // now, wait for event loop to end in this go-routine... + <-done }() - initWG.Wait() // make sure that the go routine above fully ended before returning } // SetConfigFile explicitly defines the path, name and extension of the config file. @@ -376,14 +347,6 @@ func (v *Viper) mergeWithEnvPrefix(in string) string { return strings.ToUpper(in) } -// AllowEmptyEnv tells Viper to consider set, -// but empty environment variables as valid values instead of falling back. -// For backward compatibility reasons this is false by default. -func AllowEmptyEnv(allowEmptyEnv bool) { v.AllowEmptyEnv(allowEmptyEnv) } -func (v *Viper) AllowEmptyEnv(allowEmptyEnv bool) { - v.allowEmptyEnv = allowEmptyEnv -} - // TODO: should getEnv logic be moved into find(). Can generalize the use of // rewriting keys many things, Ex: Get('someKey') -> some_key // (camel case to snake case for JSON keys perhaps) @@ -391,14 +354,11 @@ func (v *Viper) AllowEmptyEnv(allowEmptyEnv bool) { // getEnv is a wrapper around os.Getenv which replaces characters in the original // key. This allows env vars which have different keys than the config object // keys. -func (v *Viper) getEnv(key string) (string, bool) { +func (v *Viper) getEnv(key string) string { if v.envKeyReplacer != nil { key = v.envKeyReplacer.Replace(key) } - - val, ok := os.LookupEnv(key) - - return val, ok && (v.allowEmptyEnv || val != "") + return os.Getenv(key) } // ConfigFileUsed returns the file used to populate the config registry. @@ -625,9 +585,10 @@ func (v *Viper) isPathShadowedInFlatMap(path []string, mi interface{}) string { // "foo.bar.baz" in a lower-priority map func (v *Viper) isPathShadowedInAutoEnv(path []string) string { var parentKey string + var val string for i := 1; i < len(path); i++ { parentKey = strings.Join(path[0:i], v.keyDelim) - if _, ok := v.getEnv(v.mergeWithEnvPrefix(parentKey)); ok { + if val = v.getEnv(v.mergeWithEnvPrefix(parentKey)); val != "" { return parentKey } } @@ -689,12 +650,6 @@ func (v *Viper) Get(key string) interface{} { return cast.ToString(val) case int32, int16, int8, int: return cast.ToInt(val) - case uint: - return cast.ToUint(val) - case uint32: - return cast.ToUint32(val) - case uint64: - return cast.ToUint64(val) case int64: return cast.ToInt64(val) case float64, float32: @@ -758,24 +713,6 @@ func (v *Viper) GetInt64(key string) int64 { return cast.ToInt64(v.Get(key)) } -// GetUint returns the value associated with the key as an unsigned integer. -func GetUint(key string) uint { return v.GetUint(key) } -func (v *Viper) GetUint(key string) uint { - return cast.ToUint(v.Get(key)) -} - -// GetUint32 returns the value associated with the key as an unsigned integer. -func GetUint32(key string) uint32 { return v.GetUint32(key) } -func (v *Viper) GetUint32(key string) uint32 { - return cast.ToUint32(v.Get(key)) -} - -// GetUint64 returns the value associated with the key as an unsigned integer. -func GetUint64(key string) uint64 { return v.GetUint64(key) } -func (v *Viper) GetUint64(key string) uint64 { - return cast.ToUint64(v.Get(key)) -} - // GetFloat64 returns the value associated with the key as a float64. func GetFloat64(key string) float64 { return v.GetFloat64(key) } func (v *Viper) GetFloat64(key string) float64 { @@ -837,6 +774,8 @@ func (v *Viper) UnmarshalKey(key string, rawVal interface{}, opts ...DecoderConf return err } + v.insensitiviseMaps() + return nil } @@ -852,6 +791,8 @@ func (v *Viper) Unmarshal(rawVal interface{}, opts ...DecoderConfigOption) error return err } + v.insensitiviseMaps() + return nil } @@ -894,6 +835,8 @@ func (v *Viper) UnmarshalExact(rawVal interface{}) error { return err } + v.insensitiviseMaps() + return nil } @@ -1024,7 +967,7 @@ func (v *Viper) find(lcaseKey string) interface{} { if v.automaticEnvApplied { // even if it hasn't been registered, if automaticEnv is used, // check any Get request - if val, ok := v.getEnv(v.mergeWithEnvPrefix(lcaseKey)); ok { + if val = v.getEnv(v.mergeWithEnvPrefix(lcaseKey)); val != "" { return val } if nested && v.isPathShadowedInAutoEnv(path) != "" { @@ -1033,7 +976,7 @@ func (v *Viper) find(lcaseKey string) interface{} { } envkey, exists := v.env[lcaseKey] if exists { - if val, ok := v.getEnv(envkey); ok { + if val = v.getEnv(envkey); val != "" { return val } } @@ -1279,21 +1222,13 @@ func (v *Viper) ReadConfig(in io.Reader) error { // MergeConfig merges a new configuration with an existing config. func MergeConfig(in io.Reader) error { return v.MergeConfig(in) } func (v *Viper) MergeConfig(in io.Reader) error { + if v.config == nil { + v.config = make(map[string]interface{}) + } cfg := make(map[string]interface{}) if err := v.unmarshalReader(in, cfg); err != nil { return err } - return v.MergeConfigMap(cfg) -} - -// MergeConfigMap merges the configuration from the map given with an existing config. -// Note that the map given may be modified. -func MergeConfigMap(cfg map[string]interface{}) error { return v.MergeConfigMap(cfg) } -func (v *Viper) MergeConfigMap(cfg map[string]interface{}) error { - if v.config == nil { - v.config = make(map[string]interface{}) - } - insensitiviseMap(cfg) mergeMaps(cfg, v.config, nil) return nil } @@ -1354,7 +1289,7 @@ func (v *Viper) writeConfig(filename string, force bool) error { return fmt.Errorf("File: %s exists. Use WriteConfig to overwrite.", filename) } } - f, err := v.fs.OpenFile(filename, flags, v.configPermissions) + f, err := v.fs.OpenFile(filename, flags, os.FileMode(0644)) if err != nil { return err } @@ -1599,6 +1534,13 @@ func (v *Viper) WatchRemoteConfigOnChannel() error { return v.watchKeyValueConfigOnChannel() } +func (v *Viper) insensitiviseMaps() { + insensitiviseMap(v.config) + insensitiviseMap(v.defaults) + insensitiviseMap(v.override) + insensitiviseMap(v.kvstore) +} + // Retrieve the first found remote configuration. func (v *Viper) getKeyValueConfig() error { if RemoteConfig == nil { @@ -1791,12 +1733,6 @@ func (v *Viper) SetConfigType(in string) { } } -// SetConfigPermissions sets the permissions for the config file. -func SetConfigPermissions(perm os.FileMode) { v.SetConfigPermissions(perm) } -func (v *Viper) SetConfigPermissions(perm os.FileMode) { - v.configPermissions = perm.Perm() -} - func (v *Viper) getConfigType() string { if v.configType != "" { return v.configType diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go b/vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go index c36ad323..c5940b23 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go @@ -331,6 +331,7 @@ func (r *Cache) delete(n *Node) bool { return deleted } } + return false } // Nodes returns number of 'cache node' in the map. diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go index abf9fb65..14dddf88 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go @@ -29,7 +29,7 @@ func (bytesComparer) Separator(dst, a, b []byte) []byte { // Do not shorten if one string is a prefix of the other } else if c := a[i]; c < 0xff && c+1 < b[i] { dst = append(dst, a[:i+1]...) - dst[len(dst)-1]++ + dst[i]++ return dst } return nil @@ -39,7 +39,7 @@ func (bytesComparer) Successor(dst, b []byte) []byte { for i, c := range b { if c != 0xff { dst = append(dst, b[:i+1]...) - dst[len(dst)-1]++ + dst[i]++ return dst } } diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go index 2c522db2..14a28f16 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go @@ -36,7 +36,7 @@ type Comparer interface { // by any users of this package. Name() string - // Bellow are advanced functions used to reduce the space requirements + // Bellow are advanced functions used used to reduce the space requirements // for internal data structures such as index blocks. // Separator appends a sequence of bytes x to dst such that a <= x && x < b, diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db.go b/vendor/github.com/syndtr/goleveldb/leveldb/db.go index 90fedf7b..e7ac0654 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db.go @@ -182,7 +182,7 @@ func Open(stor storage.Storage, o *opt.Options) (db *DB, err error) { err = s.recover() if err != nil { - if !os.IsNotExist(err) || s.o.GetErrorIfMissing() || s.o.GetReadOnly() { + if !os.IsNotExist(err) || s.o.GetErrorIfMissing() { return } err = s.create() @@ -872,10 +872,6 @@ func (db *DB) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) { // DB. And a nil Range.Limit is treated as a key after all keys in // the DB. // -// WARNING: Any slice returned by interator (e.g. slice returned by calling -// Iterator.Key() or Iterator.Key() methods), its content should not be modified -// unless noted otherwise. -// // The iterator must be released after use, by calling Release method. // // Also read Iterator documentation of the leveldb/iterator package. diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go index 0c1b9a53..28e50906 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go @@ -663,7 +663,7 @@ type cCmd interface { } type cAuto struct { - // Note for table compaction, an non-empty ackC represents it's a compaction waiting command. + // Note for table compaction, an empty ackC represents it's a compaction waiting command. ackC chan<- error } @@ -777,8 +777,8 @@ func (db *DB) mCompaction() { func (db *DB) tCompaction() { var ( - x cCmd - waitQ []cCmd + x cCmd + ackQ, waitQ []cCmd ) defer func() { @@ -787,6 +787,10 @@ func (db *DB) tCompaction() { panic(x) } } + for i := range ackQ { + ackQ[i].ack(ErrClosed) + ackQ[i] = nil + } for i := range waitQ { waitQ[i].ack(ErrClosed) waitQ[i] = nil @@ -817,6 +821,11 @@ func (db *DB) tCompaction() { waitQ = waitQ[:0] } } else { + for i := range ackQ { + ackQ[i].ack(nil) + ackQ[i] = nil + } + ackQ = ackQ[:0] for i := range waitQ { waitQ[i].ack(nil) waitQ[i] = nil @@ -835,12 +844,9 @@ func (db *DB) tCompaction() { switch cmd := x.(type) { case cAuto: if cmd.ackC != nil { - // Check the write pause state before caching it. - if db.resumeWrite() { - x.ack(nil) - } else { - waitQ = append(waitQ, x) - } + waitQ = append(waitQ, x) + } else { + ackQ = append(ackQ, x) } case cRange: x.ack(db.tableRangeCompaction(cmd.level, cmd.min, cmd.max)) diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go index c2ad70c8..2c69d2e5 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go @@ -142,10 +142,6 @@ func (snap *Snapshot) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) // DB. And a nil Range.Limit is treated as a key after all keys in // the DB. // -// WARNING: Any slice returned by interator (e.g. slice returned by calling -// Iterator.Key() or Iterator.Value() methods), its content should not be -// modified unless noted otherwise. -// // The iterator must be released after use, by calling Release method. // Releasing the snapshot doesn't mean releasing the iterator too, the // iterator would be still valid until released. diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go index 1a000018..b8f7e7d2 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go @@ -69,10 +69,6 @@ func (tr *Transaction) Has(key []byte, ro *opt.ReadOptions) (bool, error) { // DB. And a nil Range.Limit is treated as a key after all keys in // the DB. // -// WARNING: Any slice returned by interator (e.g. slice returned by calling -// Iterator.Key() or Iterator.Key() methods), its content should not be modified -// unless noted otherwise. -// // The iterator must be released after use, by calling Release method. // // Also read Iterator documentation of the leveldb/iterator package. diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_util.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_util.go index 3f065489..7ecd960d 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db_util.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_util.go @@ -84,7 +84,7 @@ func (db *DB) checkAndCleanFiles() error { var mfds []storage.FileDesc for num, present := range tmap { if !present { - mfds = append(mfds, storage.FileDesc{Type: storage.TypeTable, Num: num}) + mfds = append(mfds, storage.FileDesc{storage.TypeTable, num}) db.logf("db@janitor table missing @%d", num) } } diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go index 96fb0f68..b16e3a70 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go @@ -40,11 +40,11 @@ type IteratorSeeker interface { Seek(key []byte) bool // Next moves the iterator to the next key/value pair. - // It returns false if the iterator is exhausted. + // It returns whether the iterator is exhausted. Next() bool // Prev moves the iterator to the previous key/value pair. - // It returns false if the iterator is exhausted. + // It returns whether the iterator is exhausted. Prev() bool } diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go b/vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go index 824e47f5..b661c08a 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go @@ -397,10 +397,6 @@ func (p *DB) Find(key []byte) (rkey, value []byte, err error) { // DB. And a nil Range.Limit is treated as a key after all keys in // the DB. // -// WARNING: Any slice returned by interator (e.g. slice returned by calling -// Iterator.Key() or Iterator.Key() methods), its content should not be modified -// unless noted otherwise. -// // The iterator must be released after use, by calling Release method. // // Also read Iterator documentation of the leveldb/iterator package. diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go b/vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go index 528b1642..44e7d9ad 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go @@ -158,12 +158,6 @@ type Options struct { // The default value is 8MiB. BlockCacheCapacity int - // BlockCacheEvictRemoved allows enable forced-eviction on cached block belonging - // to removed 'sorted table'. - // - // The default if false. - BlockCacheEvictRemoved bool - // BlockRestartInterval is the number of keys between restart points for // delta encoding of keys. // @@ -390,13 +384,6 @@ func (o *Options) GetBlockCacheCapacity() int { return o.BlockCacheCapacity } -func (o *Options) GetBlockCacheEvictRemoved() bool { - if o == nil { - return false - } - return o.BlockCacheEvictRemoved -} - func (o *Options) GetBlockRestartInterval() int { if o == nil || o.BlockRestartInterval <= 0 { return DefaultBlockRestartInterval diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/session_util.go b/vendor/github.com/syndtr/goleveldb/leveldb/session_util.go index 40cb2cf9..92328933 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/session_util.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/session_util.go @@ -36,7 +36,7 @@ func (s *session) logf(format string, v ...interface{}) { s.stor.Log(fmt.Sprintf func (s *session) newTemp() storage.FileDesc { num := atomic.AddInt64(&s.stTempFileNum, 1) - 1 - return storage.FileDesc{Type: storage.TypeTemp, Num: num} + return storage.FileDesc{storage.TypeTemp, num} } func (s *session) addFileRef(fd storage.FileDesc, ref int) int { @@ -190,7 +190,7 @@ func (s *session) recordCommited(rec *sessionRecord) { // Create a new manifest file; need external synchronization. func (s *session) newManifest(rec *sessionRecord, v *version) (err error) { - fd := storage.FileDesc{Type: storage.TypeManifest, Num: s.allocFileNum()} + fd := storage.FileDesc{storage.TypeManifest, s.allocFileNum()} writer, err := s.stor.Create(fd) if err != nil { return diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/table.go b/vendor/github.com/syndtr/goleveldb/leveldb/table.go index 1fac60d0..adf773f1 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/table.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/table.go @@ -78,7 +78,7 @@ func newTableFile(fd storage.FileDesc, size int64, imin, imax internalKey) *tFil } func tableFileFromRecord(r atRecord) *tFile { - return newTableFile(storage.FileDesc{Type: storage.TypeTable, Num: r.num}, r.size, r.imin, r.imax) + return newTableFile(storage.FileDesc{storage.TypeTable, r.num}, r.size, r.imin, r.imax) } // tFiles hold multiple tFile. @@ -290,17 +290,16 @@ func (x *tFilesSortByNum) Less(i, j int) bool { // Table operations. type tOps struct { - s *session - noSync bool - evictRemoved bool - cache *cache.Cache - bcache *cache.Cache - bpool *util.BufferPool + s *session + noSync bool + cache *cache.Cache + bcache *cache.Cache + bpool *util.BufferPool } // Creates an empty table and returns table writer. func (t *tOps) create() (*tWriter, error) { - fd := storage.FileDesc{Type: storage.TypeTable, Num: t.s.allocFileNum()} + fd := storage.FileDesc{storage.TypeTable, t.s.allocFileNum()} fw, err := t.s.stor.Create(fd) if err != nil { return nil, err @@ -423,7 +422,7 @@ func (t *tOps) remove(f *tFile) { } else { t.s.logf("table@remove removed @%d", f.fd.Num) } - if t.evictRemoved && t.bcache != nil { + if t.bcache != nil { t.bcache.EvictNS(uint64(f.fd.Num)) } }) @@ -460,12 +459,11 @@ func newTableOps(s *session) *tOps { bpool = util.NewBufferPool(s.o.GetBlockSize() + 5) } return &tOps{ - s: s, - noSync: s.o.GetNoSync(), - evictRemoved: s.o.GetBlockCacheEvictRemoved(), - cache: cache.NewCache(cacher), - bcache: bcache, - bpool: bpool, + s: s, + noSync: s.o.GetNoSync(), + cache: cache.NewCache(cacher), + bcache: bcache, + bpool: bpool, } } diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go b/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go index 496feb6f..16cfbaa0 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go @@ -787,10 +787,6 @@ func (r *Reader) getDataIterErr(dataBH blockHandle, slice *util.Range, verifyChe // table. And a nil Range.Limit is treated as a key after all keys in // the table. // -// WARNING: Any slice returned by interator (e.g. slice returned by calling -// Iterator.Key() or Iterator.Key() methods), its content should not be modified -// unless noted otherwise. -// // The returned iterator is not safe for concurrent use and should be released // after use. // diff --git a/vendor/github.com/vulcanize/eth-block-extractor/LICENSE b/vendor/github.com/vulcanize/eth-block-extractor/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/adder.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/adder.go deleted file mode 100644 index bd4ac99b..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/adder.go +++ /dev/null @@ -1,7 +0,0 @@ -package ipfs - -import ipld "github.com/ipfs/go-ipld-format" - -type Adder interface { - Add(node ipld.Node) error -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/dag_putter.go deleted file mode 100644 index 96c8ecc5..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/dag_putter.go +++ /dev/null @@ -1,5 +0,0 @@ -package ipfs - -type DagPutter interface { - DagPut(raw interface{}) ([]string, error) -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/dag_putter.go deleted file mode 100644 index 1b214c06..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/dag_putter.go +++ /dev/null @@ -1,53 +0,0 @@ -package eth_block_header - -import ( - "github.com/ethereum/go-ethereum/core/types" - ipld "github.com/ipfs/go-ipld-format" - - "github.com/vulcanize/eth-block-extractor/pkg/ipfs" - "github.com/vulcanize/eth-block-extractor/pkg/ipfs/util" - "github.com/vulcanize/eth-block-extractor/pkg/wrappers/rlp" -) - -const ( - EthBlockHeaderCode = 0x90 -) - -type BlockHeaderDagPutter struct { - adder ipfs.Adder - decoder rlp.Decoder -} - -func NewBlockHeaderDagPutter(adder ipfs.Adder, decoder rlp.Decoder) *BlockHeaderDagPutter { - return &BlockHeaderDagPutter{adder: adder, decoder: decoder} -} - -func (bhdp *BlockHeaderDagPutter) DagPut(raw interface{}) ([]string, error) { - input := raw.([]byte) - nd, err := bhdp.getNodeForBlockHeader(input) - if err != nil { - return nil, err - } - err = bhdp.adder.Add(nd) - if err != nil { - return nil, err - } - return []string{nd.Cid().String()}, nil -} - -func (bhdp *BlockHeaderDagPutter) getNodeForBlockHeader(raw []byte) (ipld.Node, error) { - var blockHeader types.Header - err := bhdp.decoder.Decode(raw, &blockHeader) - if err != nil { - return nil, err - } - blockHeaderCid, err := util.RawToCid(EthBlockHeaderCode, raw) - if err != nil { - return nil, err - } - return &EthBlockHeaderNode{ - Header: &blockHeader, - cid: blockHeaderCid, - rawdata: raw, - }, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/node.go deleted file mode 100644 index 6ea3c129..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_header/node.go +++ /dev/null @@ -1,59 +0,0 @@ -package eth_block_header - -import ( - "github.com/ethereum/go-ethereum/core/types" - - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" -) - -type EthBlockHeaderNode struct { - *types.Header - - cid cid.Cid - rawdata []byte -} - -func (ebh *EthBlockHeaderNode) RawData() []byte { - return ebh.rawdata -} - -func (ebh *EthBlockHeaderNode) Cid() cid.Cid { - return ebh.cid -} - -func (EthBlockHeaderNode) String() string { - return "" -} - -func (EthBlockHeaderNode) Loggable() map[string]interface{} { - panic("implement me") -} - -func (EthBlockHeaderNode) Resolve(path []string) (interface{}, []string, error) { - panic("implement me") -} - -func (EthBlockHeaderNode) Tree(path string, depth int) []string { - panic("implement me") -} - -func (EthBlockHeaderNode) ResolveLink(path []string) (*format.Link, []string, error) { - panic("implement me") -} - -func (EthBlockHeaderNode) Copy() format.Node { - panic("implement me") -} - -func (EthBlockHeaderNode) Links() []*format.Link { - panic("implement me") -} - -func (EthBlockHeaderNode) Stat() (*format.NodeStat, error) { - panic("implement me") -} - -func (EthBlockHeaderNode) Size() (uint64, error) { - panic("implement me") -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/dag_putter.go deleted file mode 100644 index 2af3566e..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/dag_putter.go +++ /dev/null @@ -1,54 +0,0 @@ -package eth_block_receipts - -import ( - "bytes" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ipfs/go-cid" - - "github.com/vulcanize/eth-block-extractor/pkg/ipfs" - "github.com/vulcanize/eth-block-extractor/pkg/ipfs/util" -) - -type EthBlockReceiptDagPutter struct { - adder ipfs.Adder -} - -func NewEthBlockReceiptDagPutter(adder ipfs.Adder) *EthBlockReceiptDagPutter { - return &EthBlockReceiptDagPutter{adder: adder} -} - -func (dagPutter *EthBlockReceiptDagPutter) DagPut(raw interface{}) ([]string, error) { - input := raw.(types.Receipts) - var output []string - for _, r := range input { - receiptForStorage := (*types.ReceiptForStorage)(r) - node, err := getReceiptNode(receiptForStorage) - if err != nil { - return nil, err - } - err = dagPutter.adder.Add(node) - if err != nil { - return nil, err - } - output = append(output, node.cid.String()) - } - return output, nil -} - -func getReceiptNode(receipt *types.ReceiptForStorage) (*EthReceiptNode, error) { - buffer := new(bytes.Buffer) - err := receipt.EncodeRLP(buffer) - if err != nil { - return nil, err - } - receiptCid, err := util.RawToCid(cid.EthTxReceipt, buffer.Bytes()) - if err != nil { - return nil, err - } - node := &EthReceiptNode{ - raw: buffer.Bytes(), - cid: receiptCid, - } - return node, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/node.go deleted file mode 100644 index 0c871706..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_receipts/node.go +++ /dev/null @@ -1,55 +0,0 @@ -package eth_block_receipts - -import ( - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" -) - -type EthReceiptNode struct { - raw []byte - cid cid.Cid -} - -func (node *EthReceiptNode) RawData() []byte { - return node.raw -} - -func (node *EthReceiptNode) Cid() cid.Cid { - return node.cid -} - -func (*EthReceiptNode) String() string { - panic("implement me") -} - -func (*EthReceiptNode) Loggable() map[string]interface{} { - panic("implement me") -} - -func (*EthReceiptNode) Resolve(path []string) (interface{}, []string, error) { - panic("implement me") -} - -func (*EthReceiptNode) Tree(path string, depth int) []string { - panic("implement me") -} - -func (*EthReceiptNode) ResolveLink(path []string) (*format.Link, []string, error) { - panic("implement me") -} - -func (*EthReceiptNode) Copy() format.Node { - panic("implement me") -} - -func (*EthReceiptNode) Links() []*format.Link { - panic("implement me") -} - -func (*EthReceiptNode) Stat() (*format.NodeStat, error) { - panic("implement me") -} - -func (*EthReceiptNode) Size() (uint64, error) { - panic("implement me") -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/dag_putter.go deleted file mode 100644 index 46fdd0c8..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/dag_putter.go +++ /dev/null @@ -1,50 +0,0 @@ -package eth_block_transactions - -import ( - "bytes" - - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/eth-block-extractor/pkg/ipfs" - "github.com/vulcanize/eth-block-extractor/pkg/ipfs/util" -) - -const ( - EthBlockTransactionCode = 0x93 -) - -type BlockTransactionsDagPutter struct { - adder ipfs.Adder -} - -func NewBlockTransactionsDagPutter(adder ipfs.Adder) *BlockTransactionsDagPutter { - return &BlockTransactionsDagPutter{adder: adder} -} - -func (bbdp *BlockTransactionsDagPutter) DagPut(body interface{}) ([]string, error) { - blockBody := body.(*types.Body) - transactions := blockBody.Transactions - var cids []string - for _, transaction := range transactions { - buffer := new(bytes.Buffer) - err := transaction.EncodeRLP(buffer) - if err != nil { - return nil, err - } - transactionCid, err := util.RawToCid(EthBlockTransactionCode, buffer.Bytes()) - if err != nil { - return nil, err - } - transactionNode := &EthTransactionNode{ - Transaction: transaction, - cid: transactionCid, - rawdata: buffer.Bytes(), - } - err = bbdp.adder.Add(transactionNode) - if err != nil { - return nil, err - } - cids = append(cids, transactionCid.String()) - } - return cids, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/node.go deleted file mode 100644 index 93d9bb45..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_block_transactions/node.go +++ /dev/null @@ -1,58 +0,0 @@ -package eth_block_transactions - -import ( - "github.com/ethereum/go-ethereum/core/types" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" -) - -type EthTransactionNode struct { - *types.Transaction - - cid cid.Cid - rawdata []byte -} - -func (etn *EthTransactionNode) RawData() []byte { - return etn.rawdata -} - -func (etn *EthTransactionNode) Cid() cid.Cid { - return etn.cid -} - -func (EthTransactionNode) String() string { - return "" -} - -func (EthTransactionNode) Loggable() map[string]interface{} { - panic("implement me") -} - -func (EthTransactionNode) Resolve(path []string) (interface{}, []string, error) { - panic("implement me") -} - -func (EthTransactionNode) Tree(path string, depth int) []string { - panic("implement me") -} - -func (EthTransactionNode) ResolveLink(path []string) (*format.Link, []string, error) { - panic("implement me") -} - -func (EthTransactionNode) Copy() format.Node { - panic("implement me") -} - -func (EthTransactionNode) Links() []*format.Link { - panic("implement me") -} - -func (EthTransactionNode) Stat() (*format.NodeStat, error) { - panic("implement me") -} - -func (EthTransactionNode) Size() (uint64, error) { - panic("implement me") -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/dag_putter.go deleted file mode 100644 index a8e298fb..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/dag_putter.go +++ /dev/null @@ -1,43 +0,0 @@ -package eth_state_trie - -import ( - "github.com/vulcanize/eth-block-extractor/pkg/ipfs" - "github.com/vulcanize/eth-block-extractor/pkg/ipfs/util" -) - -const ( - EthStateTrieNodeCode = 0x96 -) - -type StateTrieDagPutter struct { - adder ipfs.Adder -} - -func NewStateTrieDagPutter(adder ipfs.Adder) *StateTrieDagPutter { - return &StateTrieDagPutter{adder: adder} -} - -func (stdp StateTrieDagPutter) DagPut(raw interface{}) ([]string, error) { - input := raw.([]byte) - stateTrieNode, err := stdp.getStateTrieNode(input) - if err != nil { - return nil, err - } - err = stdp.adder.Add(stateTrieNode) - if err != nil { - return nil, err - } - return []string{stateTrieNode.Cid().String()}, nil -} - -func (stdp StateTrieDagPutter) getStateTrieNode(raw []byte) (*EthStateTrieNode, error) { - stateTrieNodeCid, err := util.RawToCid(EthStateTrieNodeCode, raw) - if err != nil { - return nil, err - } - stateTrieNode := &EthStateTrieNode{ - cid: stateTrieNodeCid, - rawdata: raw, - } - return stateTrieNode, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/node.go deleted file mode 100644 index 4c592068..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_state_trie/node.go +++ /dev/null @@ -1,55 +0,0 @@ -package eth_state_trie - -import ( - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" -) - -type EthStateTrieNode struct { - cid cid.Cid - rawdata []byte -} - -func (estn EthStateTrieNode) RawData() []byte { - return estn.rawdata -} - -func (estn EthStateTrieNode) Cid() cid.Cid { - return estn.cid -} - -func (EthStateTrieNode) String() string { - panic("implement me") -} - -func (EthStateTrieNode) Loggable() map[string]interface{} { - panic("implement me") -} - -func (EthStateTrieNode) Resolve(path []string) (interface{}, []string, error) { - panic("implement me") -} - -func (EthStateTrieNode) Tree(path string, depth int) []string { - panic("implement me") -} - -func (EthStateTrieNode) ResolveLink(path []string) (*format.Link, []string, error) { - panic("implement me") -} - -func (EthStateTrieNode) Copy() format.Node { - panic("implement me") -} - -func (EthStateTrieNode) Links() []*format.Link { - panic("implement me") -} - -func (EthStateTrieNode) Stat() (*format.NodeStat, error) { - panic("implement me") -} - -func (EthStateTrieNode) Size() (uint64, error) { - panic("implement me") -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/dag_putter.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/dag_putter.go deleted file mode 100644 index e70d0df1..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/dag_putter.go +++ /dev/null @@ -1,35 +0,0 @@ -package eth_storage_trie - -import ( - "github.com/vulcanize/eth-block-extractor/pkg/ipfs" - "github.com/vulcanize/eth-block-extractor/pkg/ipfs/util" -) - -const ( - EthStorageTrieNodeCode = 0x98 -) - -type StorageTrieDagPutter struct { - adder ipfs.Adder -} - -func NewStorageTrieDagPutter(adder ipfs.Adder) *StorageTrieDagPutter { - return &StorageTrieDagPutter{adder: adder} -} - -func (stdp StorageTrieDagPutter) DagPut(raw interface{}) ([]string, error) { - input := raw.([]byte) - cid, err := util.RawToCid(EthStorageTrieNodeCode, input) - if err != nil { - return nil, err - } - node := &EthStorageTrieNode{ - cid: cid, - rawdata: input, - } - err = stdp.adder.Add(node) - if err != nil { - return nil, err - } - return []string{node.Cid().String()}, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/node.go deleted file mode 100644 index 075b3d4a..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/eth_storage_trie/node.go +++ /dev/null @@ -1,55 +0,0 @@ -package eth_storage_trie - -import ( - "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" -) - -type EthStorageTrieNode struct { - cid cid.Cid - rawdata []byte -} - -func (estn *EthStorageTrieNode) RawData() []byte { - return estn.rawdata -} - -func (estn *EthStorageTrieNode) Cid() cid.Cid { - return estn.cid -} - -func (*EthStorageTrieNode) String() string { - panic("implement me") -} - -func (*EthStorageTrieNode) Loggable() map[string]interface{} { - panic("implement me") -} - -func (*EthStorageTrieNode) Resolve(path []string) (interface{}, []string, error) { - panic("implement me") -} - -func (*EthStorageTrieNode) Tree(path string, depth int) []string { - panic("implement me") -} - -func (*EthStorageTrieNode) ResolveLink(path []string) (*format.Link, []string, error) { - panic("implement me") -} - -func (*EthStorageTrieNode) Copy() format.Node { - panic("implement me") -} - -func (*EthStorageTrieNode) Links() []*format.Link { - panic("implement me") -} - -func (*EthStorageTrieNode) Stat() (*format.NodeStat, error) { - panic("implement me") -} - -func (*EthStorageTrieNode) Size() (uint64, error) { - panic("implement me") -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/node.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/node.go deleted file mode 100644 index ac0a2d41..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/node.go +++ /dev/null @@ -1,36 +0,0 @@ -package ipfs - -import ( - "context" - - "github.com/ipfs/go-ipfs/core" - "github.com/ipfs/go-ipfs/repo/fsrepo" - - ipld "github.com/ipfs/go-ipld-format" -) - -type IPFS struct { - n *core.IpfsNode - ctx context.Context -} - -func (ipfs IPFS) Add(node ipld.Node) error { - return ipfs.n.DAG.Add(ipfs.n.Context(), node) -} - -func InitIPFSNode(repoPath string) (*IPFS, error) { - r, err := fsrepo.Open(repoPath) - if err != nil { - return nil, err - } - ctx := context.Background() - cfg := &core.BuildCfg{ - Online: false, - Repo: r, - } - ipfsNode, err := core.NewNode(ctx, cfg) - if err != nil { - return nil, err - } - return &IPFS{n: ipfsNode, ctx: ctx}, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/publisher.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/publisher.go deleted file mode 100644 index 3d1065dc..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/publisher.go +++ /dev/null @@ -1,32 +0,0 @@ -package ipfs - -import "fmt" - -type Error struct { - msg string - err error -} - -func (ie Error) Error() string { - return fmt.Sprintf("%s: %s", ie.msg, ie.err.Error()) -} - -type Publisher interface { - Write(input interface{}) ([]string, error) -} - -type BlockDataPublisher struct { - DagPutter -} - -func NewIpfsPublisher(dagPutter DagPutter) *BlockDataPublisher { - return &BlockDataPublisher{DagPutter: dagPutter} -} - -func (ip *BlockDataPublisher) Write(input interface{}) ([]string, error) { - cids, err := ip.DagPutter.DagPut(input) - if err != nil { - return nil, err - } - return cids, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/util/cid.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/util/cid.go deleted file mode 100644 index e8066b86..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/util/cid.go +++ /dev/null @@ -1,19 +0,0 @@ -package util - -import ( - "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" -) - -func RawToCid(codec uint64, raw []byte) (cid.Cid, error) { - c, err := cid.Prefix{ - Codec: codec, - Version: 1, - MhType: mh.KECCAK_256, - MhLength: -1, - }.Sum(raw) - if err != nil { - return cid.Cid{}, err - } - return c, nil -} diff --git a/vendor/github.com/vulcanize/eth-block-extractor/pkg/wrappers/rlp/decode.go b/vendor/github.com/vulcanize/eth-block-extractor/pkg/wrappers/rlp/decode.go deleted file mode 100644 index 61853944..00000000 --- a/vendor/github.com/vulcanize/eth-block-extractor/pkg/wrappers/rlp/decode.go +++ /dev/null @@ -1,16 +0,0 @@ -package rlp - -import ( - "bytes" - "github.com/ethereum/go-ethereum/rlp" -) - -type Decoder interface { - Decode(raw []byte, out interface{}) error -} - -type RlpDecoder struct{} - -func (RlpDecoder) Decode(raw []byte, out interface{}) error { - return rlp.Decode(bytes.NewBuffer(raw), out) -} diff --git a/vendor/github.com/whyrusleeping/base32/base32.go b/vendor/github.com/whyrusleeping/base32/base32.go deleted file mode 100644 index 768a2350..00000000 --- a/vendor/github.com/whyrusleeping/base32/base32.go +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package base32 implements base32 encoding as specified by RFC 4648. -package base32 - -import ( - "io" - "strconv" -) - -/* - * Encodings - */ - -// An Encoding is a radix 32 encoding/decoding scheme, defined by a -// 32-character alphabet. The most common is the "base32" encoding -// introduced for SASL GSSAPI and standardized in RFC 4648. -// The alternate "base32hex" encoding is used in DNSSEC. -type Encoding struct { - encode string - decodeMap [256]byte - padChar rune -} - -// Alphabet returns the Base32 alphabet used -func (enc *Encoding) Alphabet() string { - return enc.encode -} - -const ( - StdPadding rune = '=' - NoPadding rune = -1 -) - -const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" -const encodeHex = "0123456789ABCDEFGHIJKLMNOPQRSTUV" - -// NewEncoding returns a new Encoding defined by the given alphabet, -// which must be a 32-byte string. -func NewEncoding(encoder string) *Encoding { - e := new(Encoding) - e.padChar = StdPadding - e.encode = encoder - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[encoder[i]] = byte(i) - } - return e -} - -// NewEncoding returns a new case insensitive Encoding defined by the -// given alphabet, which must be a 32-byte string. -func NewEncodingCI(encoder string) *Encoding { - e := new(Encoding) - e.padChar = StdPadding - e.encode = encoder - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[asciiToLower(encoder[i])] = byte(i) - e.decodeMap[asciiToUpper(encoder[i])] = byte(i) - } - return e -} - -func asciiToLower(c byte) byte { - if c >= 'A' && c <= 'Z' { - return c + 32 - } - return c -} - -func asciiToUpper(c byte) byte { - if c >= 'a' && c <= 'z' { - return c - 32 - } - return c -} - -// WithPadding creates a new encoding identical to enc except -// with a specified padding character, or NoPadding to disable padding. -func (enc Encoding) WithPadding(padding rune) *Encoding { - enc.padChar = padding - return &enc -} - -// StdEncoding is the standard base32 encoding, as defined in -// RFC 4648. -var StdEncoding = NewEncodingCI(encodeStd) - -// HexEncoding is the ``Extended Hex Alphabet'' defined in RFC 4648. -// It is typically used in DNS. -var HexEncoding = NewEncodingCI(encodeHex) - -var RawStdEncoding = NewEncodingCI(encodeStd).WithPadding(NoPadding) -var RawHexEncoding = NewEncodingCI(encodeHex).WithPadding(NoPadding) - -/* - * Encoder - */ - -// Encode encodes src using the encoding enc, writing -// EncodedLen(len(src)) bytes to dst. -// -// The encoding pads the output to a multiple of 8 bytes, -// so Encode is not appropriate for use on individual blocks -// of a large data stream. Use NewEncoder() instead. -func (enc *Encoding) Encode(dst, src []byte) { - if len(src) == 0 { - return - } - - for len(src) > 0 { - var carry byte - - // Unpack 8x 5-bit source blocks into a 5 byte - // destination quantum - switch len(src) { - default: - dst[7] = enc.encode[src[4]&0x1F] - carry = src[4] >> 5 - fallthrough - case 4: - dst[6] = enc.encode[carry|(src[3]<<3)&0x1F] - dst[5] = enc.encode[(src[3]>>2)&0x1F] - carry = src[3] >> 7 - fallthrough - case 3: - dst[4] = enc.encode[carry|(src[2]<<1)&0x1F] - carry = (src[2] >> 4) & 0x1F - fallthrough - case 2: - dst[3] = enc.encode[carry|(src[1]<<4)&0x1F] - dst[2] = enc.encode[(src[1]>>1)&0x1F] - carry = (src[1] >> 6) & 0x1F - fallthrough - case 1: - dst[1] = enc.encode[carry|(src[0]<<2)&0x1F] - dst[0] = enc.encode[src[0]>>3] - } - - // Pad the final quantum - if len(src) < 5 { - if enc.padChar != NoPadding { - dst[7] = byte(enc.padChar) - if len(src) < 4 { - dst[6] = byte(enc.padChar) - dst[5] = byte(enc.padChar) - if len(src) < 3 { - dst[4] = byte(enc.padChar) - if len(src) < 2 { - dst[3] = byte(enc.padChar) - dst[2] = byte(enc.padChar) - } - } - } - } - break - } - src = src[5:] - dst = dst[8:] - } -} - -// EncodeToString returns the base32 encoding of src. -func (enc *Encoding) EncodeToString(src []byte) string { - buf := make([]byte, enc.EncodedLen(len(src))) - enc.Encode(buf, src) - return string(buf) -} - -type encoder struct { - err error - enc *Encoding - w io.Writer - buf [5]byte // buffered data waiting to be encoded - nbuf int // number of bytes in buf - out [1024]byte // output buffer -} - -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - - // Leading fringe. - if e.nbuf > 0 { - var i int - for i = 0; i < len(p) && e.nbuf < 5; i++ { - e.buf[e.nbuf] = p[i] - e.nbuf++ - } - n += i - p = p[i:] - if e.nbuf < 5 { - return - } - e.enc.Encode(e.out[0:], e.buf[0:]) - if _, e.err = e.w.Write(e.out[0:8]); e.err != nil { - return n, e.err - } - e.nbuf = 0 - } - - // Large interior chunks. - for len(p) >= 5 { - nn := len(e.out) / 8 * 5 - if nn > len(p) { - nn = len(p) - nn -= nn % 5 - } - e.enc.Encode(e.out[0:], p[0:nn]) - if _, e.err = e.w.Write(e.out[0 : nn/5*8]); e.err != nil { - return n, e.err - } - n += nn - p = p[nn:] - } - - // Trailing fringe. - for i := 0; i < len(p); i++ { - e.buf[i] = p[i] - } - e.nbuf = len(p) - n += len(p) - return -} - -// Close flushes any pending output from the encoder. -// It is an error to call Write after calling Close. -func (e *encoder) Close() error { - // If there's anything left in the buffer, flush it out - if e.err == nil && e.nbuf > 0 { - e.enc.Encode(e.out[0:], e.buf[0:e.nbuf]) - e.nbuf = 0 - _, e.err = e.w.Write(e.out[0:8]) - } - return e.err -} - -// NewEncoder returns a new base32 stream encoder. Data written to -// the returned writer will be encoded using enc and then written to w. -// Base32 encodings operate in 5-byte blocks; when finished -// writing, the caller must Close the returned encoder to flush any -// partially written blocks. -func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser { - return &encoder{enc: enc, w: w} -} - -// EncodedLen returns the length in bytes of the base32 encoding -// of an input buffer of length n. -func (enc *Encoding) EncodedLen(n int) int { - if enc.padChar == NoPadding { - return (n*8 + 4) / 5 // minimum # chars at 5 bits per char - } - return (n + 4) / 5 * 8 -} - -/* - * Decoder - */ - -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "illegal base32 data at input byte " + strconv.FormatInt(int64(e), 10) -} - -// decode is like Decode but returns an additional 'end' value, which -// indicates if end-of-message padding was encountered and thus any -// additional data is an error. This method assumes that src has been -// stripped of all supported whitespace ('\r' and '\n'). -func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { - olen := len(src) - for len(src) > 0 && !end { - // Decode quantum using the base32 alphabet - var dbuf [8]byte - dlen := 8 - - for j := 0; j < 8; { - if len(src) == 0 { - if enc.padChar != NoPadding { - return n, false, CorruptInputError(olen - len(src) - j) - } - dlen = j - break - } - in := src[0] - src = src[1:] - if in == byte(enc.padChar) && j >= 2 && len(src) < 8 { - if enc.padChar == NoPadding { - return n, false, CorruptInputError(olen) - } - - // We've reached the end and there's padding - if len(src)+j < 8-1 { - // not enough padding - return n, false, CorruptInputError(olen) - } - for k := 0; k < 8-1-j; k++ { - if len(src) > k && src[k] != byte(enc.padChar) { - // incorrect padding - return n, false, CorruptInputError(olen - len(src) + k - 1) - } - } - dlen, end = j, true - // 7, 5 and 2 are not valid padding lengths, and so 1, 3 and 6 are not - // valid dlen values. See RFC 4648 Section 6 "Base 32 Encoding" listing - // the five valid padding lengths, and Section 9 "Illustrations and - // Examples" for an illustration for how the 1st, 3rd and 6th base32 - // src bytes do not yield enough information to decode a dst byte. - if dlen == 1 || dlen == 3 || dlen == 6 { - return n, false, CorruptInputError(olen - len(src) - 1) - } - break - } - dbuf[j] = enc.decodeMap[in] - if dbuf[j] == 0xFF { - return n, false, CorruptInputError(olen - len(src) - 1) - } - j++ - } - - // Pack 8x 5-bit source blocks into 5 byte destination - // quantum - switch dlen { - case 8: - dst[4] = dbuf[6]<<5 | dbuf[7] - fallthrough - case 7: - dst[3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 - fallthrough - case 5: - dst[2] = dbuf[3]<<4 | dbuf[4]>>1 - fallthrough - case 4: - dst[1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 - fallthrough - case 2: - dst[0] = dbuf[0]<<3 | dbuf[1]>>2 - } - - if len(dst) > 5 { - dst = dst[5:] - } - - switch dlen { - case 2: - n += 1 - case 4: - n += 2 - case 5: - n += 3 - case 7: - n += 4 - case 8: - n += 5 - } - } - return n, end, nil -} - -// Decode decodes src using the encoding enc. It writes at most -// DecodedLen(len(src)) bytes to dst and returns the number of bytes -// written. If src contains invalid base32 data, it will return the -// number of bytes successfully written and CorruptInputError. -// New line characters (\r and \n) are ignored. -func (enc *Encoding) Decode(dst, s []byte) (n int, err error) { - // FIXME: if dst is the same as s use decodeInPlace - stripped := make([]byte, 0, len(s)) - for _, c := range s { - if c != '\r' && c != '\n' { - stripped = append(stripped, c) - } - } - n, _, err = enc.decode(dst, stripped) - return -} - -func (enc *Encoding) decodeInPlace(strb []byte) (n int, err error) { - off := 0 - for _, b := range strb { - if b == '\n' || b == '\r' { - continue - } - strb[off] = b - off++ - } - n, _, err = enc.decode(strb, strb[:off]) - return -} - -// DecodeString returns the bytes represented by the base32 string s. -func (enc *Encoding) DecodeString(s string) ([]byte, error) { - strb := []byte(s) - n, err := enc.decodeInPlace(strb) - if err != nil { - return nil, err - } - return strb[:n], nil -} - -type decoder struct { - err error - enc *Encoding - r io.Reader - end bool // saw end of message - buf [1024]byte // leftover input - nbuf int - out []byte // leftover decoded output - outbuf [1024 / 8 * 5]byte -} - -func (d *decoder) Read(p []byte) (n int, err error) { - if d.err != nil { - return 0, d.err - } - - // Use leftover decoded output from last read. - if len(d.out) > 0 { - n = copy(p, d.out) - d.out = d.out[n:] - return n, nil - } - - // Read a chunk. - nn := len(p) / 5 * 8 - if nn < 8 { - nn = 8 - } - if nn > len(d.buf) { - nn = len(d.buf) - } - nn, d.err = io.ReadAtLeast(d.r, d.buf[d.nbuf:nn], 8-d.nbuf) - d.nbuf += nn - if d.nbuf < 8 { - return 0, d.err - } - - // Decode chunk into p, or d.out and then p if p is too small. - nr := d.nbuf / 8 * 8 - nw := d.nbuf / 8 * 5 - if nw > len(p) { - nw, d.end, d.err = d.enc.decode(d.outbuf[0:], d.buf[0:nr]) - d.out = d.outbuf[0:nw] - n = copy(p, d.out) - d.out = d.out[n:] - } else { - n, d.end, d.err = d.enc.decode(p, d.buf[0:nr]) - } - d.nbuf -= nr - for i := 0; i < d.nbuf; i++ { - d.buf[i] = d.buf[i+nr] - } - - if d.err == nil { - d.err = err - } - return n, d.err -} - -type newlineFilteringReader struct { - wrapped io.Reader -} - -func (r *newlineFilteringReader) Read(p []byte) (int, error) { - n, err := r.wrapped.Read(p) - for n > 0 { - offset := 0 - for i, b := range p[0:n] { - if b != '\r' && b != '\n' { - if i != offset { - p[offset] = b - } - offset++ - } - } - if offset > 0 { - return offset, err - } - // Previous buffer entirely whitespace, read again - n, err = r.wrapped.Read(p) - } - return n, err -} - -// NewDecoder constructs a new base32 stream decoder. -func NewDecoder(enc *Encoding, r io.Reader) io.Reader { - return &decoder{enc: enc, r: &newlineFilteringReader{r}} -} - -// DecodedLen returns the maximum length in bytes of the decoded data -// corresponding to n bytes of base32-encoded data. -func (enc *Encoding) DecodedLen(n int) int { - if enc.padChar == NoPadding { - return (n*5 + 7) / 8 - } - - return n / 8 * 5 -} diff --git a/vendor/github.com/whyrusleeping/base32/package.json b/vendor/github.com/whyrusleeping/base32/package.json deleted file mode 100644 index f78c51b6..00000000 --- a/vendor/github.com/whyrusleeping/base32/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/base32" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/base32" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "", - "name": "base32", - "version": "0.0.2" -} - diff --git a/vendor/github.com/whyrusleeping/chunker/.travis.yml b/vendor/github.com/whyrusleeping/chunker/.travis.yml deleted file mode 100644 index 901e788d..00000000 --- a/vendor/github.com/whyrusleeping/chunker/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go -sudo: false - -go: - - tip - -os: - - linux - - osx diff --git a/vendor/github.com/whyrusleeping/chunker/LICENSE b/vendor/github.com/whyrusleeping/chunker/LICENSE deleted file mode 100644 index 04f85435..00000000 --- a/vendor/github.com/whyrusleeping/chunker/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2014, Alexander Neumann -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/whyrusleeping/chunker/README.md b/vendor/github.com/whyrusleeping/chunker/README.md deleted file mode 100644 index 0d1b33f8..00000000 --- a/vendor/github.com/whyrusleeping/chunker/README.md +++ /dev/null @@ -1,7 +0,0 @@ -[![Build Status](https://travis-ci.org/whyrusleeping/chunker.svg?branch=master)](https://travis-ci.org/whyrusleeping/chunker) - -Content Defined Chunking (CDC) based on a rolling Rabin Checksum. - -Part of https://github.com/restic/restic. - -Better README will follow soon. diff --git a/vendor/github.com/whyrusleeping/chunker/chunker.go b/vendor/github.com/whyrusleeping/chunker/chunker.go deleted file mode 100644 index d2032c38..00000000 --- a/vendor/github.com/whyrusleeping/chunker/chunker.go +++ /dev/null @@ -1,384 +0,0 @@ -package chunker - -import ( - "errors" - "hash" - "io" - "math" - "sync" -) - -const ( - KiB = 1024 - MiB = 1024 * KiB - - // WindowSize is the size of the sliding window. - windowSize = 16 - - chunkerBufSize = 512 * KiB - - // MinSize is the default minimal size of a chunk. - MinSize = 512 * KiB - // MaxSize is the default maximal size of a chunk. - MaxSize = 8 * MiB - - // AvgSize is the default average size of a chunk. - AvgSize = 1048576 -) - -var bufPool = sync.Pool{ - New: func() interface{} { return new([chunkerBufSize]byte) }, -} - -type tables struct { - out [256]Pol - mod [256]Pol -} - -// cache precomputed tables, these are read-only anyway -var cache struct { - entries map[Pol]*tables - sync.Mutex -} - -func init() { - cache.entries = make(map[Pol]*tables) -} - -// Chunk is one content-dependent chunk of bytes whose end was cut when the -// Rabin Fingerprint had the value stored in Cut. -type Chunk struct { - Start uint64 - Length uint64 - Cut uint64 - Digest []byte - Data []byte -} - -func (c Chunk) Reader(r io.ReaderAt) io.Reader { - return io.NewSectionReader(r, int64(c.Start), int64(c.Length)) -} - -// Chunker splits content with Rabin Fingerprints. -type Chunker struct { - pol Pol - polShift uint64 - tables *tables - - rd io.Reader - closed bool - - chunkbuf []byte - - window [windowSize]byte - wpos int - - buf *[chunkerBufSize]byte - bpos uint64 - bmax uint64 - - start uint64 - count uint64 - pos uint64 - - pre uint64 // wait for this many bytes before start calculating an new chunk - - digest uint64 - h hash.Hash - - sizeMask uint64 - - // minimal and maximal size of the outputted blocks - MinSize uint64 - MaxSize uint64 -} - -// New returns a new Chunker based on polynomial p that reads from rd -// with bufsize and pass all data to hash along the way. -func New(rd io.Reader, pol Pol, h hash.Hash, avSize, min, max uint64) *Chunker { - - sizepow := uint(math.Log2(float64(avSize))) - - c := &Chunker{ - buf: bufPool.Get().(*[chunkerBufSize]byte), - h: h, - pol: pol, - rd: rd, - chunkbuf: make([]byte, 0, max), - sizeMask: (1 << sizepow) - 1, - - MinSize: min, - MaxSize: max, - } - - c.reset() - - return c -} - -func (c *Chunker) reset() { - c.polShift = uint64(c.pol.Deg() - 8) - c.fillTables() - - for i := 0; i < windowSize; i++ { - c.window[i] = 0 - } - - c.closed = false - c.digest = 0 - c.wpos = 0 - c.count = 0 - c.slide(1) - c.start = c.pos - - if c.h != nil { - c.h.Reset() - } - - // do not start a new chunk unless at least MinSize bytes have been read - c.pre = c.MinSize - windowSize -} - -// Calculate out_table and mod_table for optimization. Must be called only -// once. This implementation uses a cache in the global variable cache. -func (c *Chunker) fillTables() { - // if polynomial hasn't been specified, do not compute anything for now - if c.pol == 0 { - return - } - - // test if the tables are cached for this polynomial - cache.Lock() - defer cache.Unlock() - if t, ok := cache.entries[c.pol]; ok { - c.tables = t - return - } - - // else create a new entry - c.tables = &tables{} - cache.entries[c.pol] = c.tables - - // calculate table for sliding out bytes. The byte to slide out is used as - // the index for the table, the value contains the following: - // out_table[b] = Hash(b || 0 || ... || 0) - // \ windowsize-1 zero bytes / - // To slide out byte b_0 for window size w with known hash - // H := H(b_0 || ... || b_w), it is sufficient to add out_table[b_0]: - // H(b_0 || ... || b_w) + H(b_0 || 0 || ... || 0) - // = H(b_0 + b_0 || b_1 + 0 || ... || b_w + 0) - // = H( 0 || b_1 || ... || b_w) - // - // Afterwards a new byte can be shifted in. - for b := 0; b < 256; b++ { - var h Pol - - h = appendByte(h, byte(b), c.pol) - for i := 0; i < windowSize-1; i++ { - h = appendByte(h, 0, c.pol) - } - c.tables.out[b] = h - } - - // calculate table for reduction mod Polynomial - k := c.pol.Deg() - for b := 0; b < 256; b++ { - // mod_table[b] = A | B, where A = (b(x) * x^k mod pol) and B = b(x) * x^k - // - // The 8 bits above deg(Polynomial) determine what happens next and so - // these bits are used as a lookup to this table. The value is split in - // two parts: Part A contains the result of the modulus operation, part - // B is used to cancel out the 8 top bits so that one XOR operation is - // enough to reduce modulo Polynomial - c.tables.mod[b] = Pol(uint64(b)<= c.bmax { - n, err := io.ReadFull(c.rd, c.buf[:]) - c.chunkbuf = append(c.chunkbuf, c.buf[:n]...) - - if err == io.ErrUnexpectedEOF { - err = nil - } - - // io.ReadFull only returns io.EOF when no bytes could be read. If - // this is the case and we're in this branch, there are no more - // bytes to buffer, so this was the last chunk. If a different - // error has occurred, return that error and abandon the current - // chunk. - if err == io.EOF && !c.closed { - c.closed = true - - // return the buffer to the pool - buf := c.buf - c.buf = nil - bufPool.Put(buf) - - data := c.nextBytes() - - // return current chunk, if any bytes have been processed - if c.count > 0 { - return &Chunk{ - Start: c.start, - Length: c.count, - Cut: c.digest, - Digest: c.hashDigest(), - Data: data, - }, nil - } - } - - if err != nil { - return nil, err - } - - c.bpos = 0 - c.bmax = uint64(n) - } - - // check if bytes have to be dismissed before starting a new chunk - if c.pre > 0 { - n := c.bmax - c.bpos - if c.pre > uint64(n) { - c.pre -= uint64(n) - c.updateHash(c.buf[c.bpos:c.bmax]) - - c.count += uint64(n) - c.pos += uint64(n) - c.bpos = c.bmax - - continue - } - - c.updateHash(c.buf[c.bpos : c.bpos+c.pre]) - - c.bpos += c.pre - c.count += c.pre - c.pos += c.pre - c.pre = 0 - } - - add := c.count - for _, b := range c.buf[c.bpos:c.bmax] { - // inline c.slide(b) and append(b) to increase performance - out := c.window[c.wpos] - c.window[c.wpos] = b - c.digest ^= uint64(c.tables.out[out]) - c.wpos = (c.wpos + 1) % windowSize - - // c.append(b) - index := c.digest >> c.polShift - c.digest <<= 8 - c.digest |= uint64(b) - - c.digest ^= uint64(c.tables.mod[index]) - // end inline - - add++ - if add < c.MinSize { - continue - } - - if (c.digest&c.sizeMask) == 0 || add >= c.MaxSize { - i := add - c.count - 1 - c.updateHash(c.buf[c.bpos : c.bpos+uint64(i)+1]) - c.count = add - c.pos += uint64(i) + 1 - c.bpos += uint64(i) + 1 - - data := c.nextBytes() - - chunk := &Chunk{ - Start: c.start, - Length: c.count, - Cut: c.digest, - Digest: c.hashDigest(), - Data: data, - } - - c.reset() - - return chunk, nil - } - } - - steps := c.bmax - c.bpos - if steps > 0 { - c.updateHash(c.buf[c.bpos : c.bpos+steps]) - } - c.count += steps - c.pos += steps - c.bpos = c.bmax - } -} - -func dupBytes(b []byte) []byte { - out := make([]byte, len(b)) - copy(out, b) - return out -} - -func (c *Chunker) updateHash(data []byte) { - if c.h != nil { - // the hashes from crypto/sha* do not return an error - _, err := c.h.Write(data) - if err != nil { - panic(err) - } - } -} - -func (c *Chunker) hashDigest() []byte { - if c.h == nil { - return nil - } - - return c.h.Sum(nil) -} - -func (c *Chunker) append(b byte) { - index := c.digest >> c.polShift - c.digest <<= 8 - c.digest |= uint64(b) - - c.digest ^= uint64(c.tables.mod[index]) -} - -func (c *Chunker) slide(b byte) { - out := c.window[c.wpos] - c.window[c.wpos] = b - c.digest ^= uint64(c.tables.out[out]) - c.wpos = (c.wpos + 1) % windowSize - - c.append(b) -} - -func appendByte(hash Pol, b byte, pol Pol) Pol { - hash <<= 8 - hash |= Pol(b) - - return hash.Mod(pol) -} diff --git a/vendor/github.com/whyrusleeping/chunker/doc.go b/vendor/github.com/whyrusleeping/chunker/doc.go deleted file mode 100644 index 5537c172..00000000 --- a/vendor/github.com/whyrusleeping/chunker/doc.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2014 Alexander Neumann. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package chunker implements Content Defined Chunking (CDC) based on a rolling -Rabin Checksum. - -Choosing a Random Irreducible Polynomial - -The function RandomPolynomial() returns a new random polynomial of degree 53 -for use with the chunker. The degree 53 is chosen because it is the largest -prime below 64-8 = 56, so that the top 8 bits of an uint64 can be used for -optimising calculations in the chunker. - -A random polynomial is chosen selecting 64 random bits, masking away bits -64..54 and setting bit 53 to one (otherwise the polynomial is not of the -desired degree) and bit 0 to one (otherwise the polynomial is trivially -reducible), so that 51 bits are chosen at random. - -This process is repeated until Irreducible() returns true, then this -polynomials is returned. If this doesn't happen after 1 million tries, the -function returns an error. The probability for selecting an irreducible -polynomial at random is about 7.5% ( (2^53-2)/53 / 2^51), so the probability -that no irreducible polynomial has been found after 100 tries is lower than -0.04%. - -Verifying Irreducible Polynomials - -During development the results have been verified using the computational -discrete algebra system GAP, which can be obtained from the website at -http://www.gap-system.org/. - -For filtering a given list of polynomials in hexadecimal coefficient notation, -the following script can be used: - - # create x over F_2 = GF(2) - x := Indeterminate(GF(2), "x"); - - # test if polynomial is irreducible, i.e. the number of factors is one - IrredPoly := function (poly) - return (Length(Factors(poly)) = 1); - end;; - - # create a polynomial in x from the hexadecimal representation of the - # coefficients - Hex2Poly := function (s) - return ValuePol(CoefficientsQadic(IntHexString(s), 2), x); - end;; - - # list of candidates, in hex - candidates := [ "3DA3358B4DC173" ]; - - # create real polynomials - L := List(candidates, Hex2Poly); - - # filter and display the list of irreducible polynomials contained in L - Display(Filtered(L, x -> (IrredPoly(x)))); - -All irreducible polynomials from the list are written to the output. - -Background Literature - -An introduction to Rabin Fingerprints/Checksums can be found in the following articles: - -Michael O. Rabin (1981): "Fingerprinting by Random Polynomials" -http://www.xmailserver.org/rabin.pdf - -Ross N. Williams (1993): "A Painless Guide to CRC Error Detection Algorithms" -http://www.zlib.net/crc_v3.txt - -Andrei Z. Broder (1993): "Some Applications of Rabin's Fingerprinting Method" -http://www.xmailserver.org/rabin_apps.pdf - -Shuhong Gao and Daniel Panario (1997): "Tests and Constructions of Irreducible Polynomials over Finite Fields" -http://www.math.clemson.edu/~sgao/papers/GP97a.pdf - -Andrew Kadatch, Bob Jenkins (2007): "Everything we know about CRC but afraid to forget" -http://crcutil.googlecode.com/files/crc-doc.1.0.pdf - -*/ -package chunker diff --git a/vendor/github.com/whyrusleeping/chunker/package.json b/vendor/github.com/whyrusleeping/chunker/package.json deleted file mode 100644 index b609d65a..00000000 --- a/vendor/github.com/whyrusleeping/chunker/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/chunker" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/chunker" - }, - "gxVersion": "0.12.1", - "language": "go", - "license": "", - "name": "chunker", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "0.0.1" -} - diff --git a/vendor/github.com/whyrusleeping/chunker/polynomials.go b/vendor/github.com/whyrusleeping/chunker/polynomials.go deleted file mode 100644 index 355da109..00000000 --- a/vendor/github.com/whyrusleeping/chunker/polynomials.go +++ /dev/null @@ -1,278 +0,0 @@ -package chunker - -import ( - "crypto/rand" - "encoding/binary" - "errors" - "fmt" - "strconv" -) - -// Pol is a polynomial from F_2[X]. -type Pol uint64 - -// Add returns x+y. -func (x Pol) Add(y Pol) Pol { - r := Pol(uint64(x) ^ uint64(y)) - return r -} - -// mulOverflows returns true if the multiplication would overflow uint64. -// Code by Rob Pike, see -// https://groups.google.com/d/msg/golang-nuts/h5oSN5t3Au4/KaNQREhZh0QJ -func mulOverflows(a, b Pol) bool { - if a <= 1 || b <= 1 { - return false - } - c := a.mul(b) - d := c.Div(b) - if d != a { - return true - } - - return false -} - -func (x Pol) mul(y Pol) Pol { - if x == 0 || y == 0 { - return 0 - } - - var res Pol - for i := 0; i <= y.Deg(); i++ { - if (y & (1 << uint(i))) > 0 { - res = res.Add(x << uint(i)) - } - } - - return res -} - -// Mul returns x*y. When an overflow occurs, Mul panics. -func (x Pol) Mul(y Pol) Pol { - if mulOverflows(x, y) { - panic("multiplication would overflow uint64") - } - - return x.mul(y) -} - -// Deg returns the degree of the polynomial x. If x is zero, -1 is returned. -func (x Pol) Deg() int { - // the degree of 0 is -1 - if x == 0 { - return -1 - } - - var mask Pol = (1 << 63) - for i := 63; i >= 0; i-- { - // test if bit i is set - if x&mask > 0 { - // this is the degree of x - return i - } - mask >>= 1 - } - - // fall-through, return -1 - return -1 -} - -// String returns the coefficients in hex. -func (x Pol) String() string { - return "0x" + strconv.FormatUint(uint64(x), 16) -} - -// Expand returns the string representation of the polynomial x. -func (x Pol) Expand() string { - if x == 0 { - return "0" - } - - s := "" - for i := x.Deg(); i > 1; i-- { - if x&(1< 0 { - s += fmt.Sprintf("+x^%d", i) - } - } - - if x&2 > 0 { - s += "+x" - } - - if x&1 > 0 { - s += "+1" - } - - return s[1:] -} - -// DivMod returns x / d = q, and remainder r, -// see https://en.wikipedia.org/wiki/Division_algorithm -func (x Pol) DivMod(d Pol) (Pol, Pol) { - if x == 0 { - return 0, 0 - } - - if d == 0 { - panic("division by zero") - } - - D := d.Deg() - diff := x.Deg() - D - if diff < 0 { - return 0, x - } - - var q Pol - for diff >= 0 { - m := d << uint(diff) - q |= (1 << uint(diff)) - x = x.Add(m) - - diff = x.Deg() - D - } - - return q, x -} - -// Div returns the integer division result x / d. -func (x Pol) Div(d Pol) Pol { - q, _ := x.DivMod(d) - return q -} - -// Mod returns the remainder of x / d -func (x Pol) Mod(d Pol) Pol { - _, r := x.DivMod(d) - return r -} - -// I really dislike having a function that does not terminate, so specify a -// really large upper bound for finding a new irreducible polynomial, and -// return an error when no irreducible polynomial has been found within -// randPolMaxTries. -const randPolMaxTries = 1e6 - -// RandomPolynomial returns a new random irreducible polynomial of degree 53 -// (largest prime number below 64-8). There are (2^53-2/53) irreducible -// polynomials of degree 53 in F_2[X], c.f. Michael O. Rabin (1981): -// "Fingerprinting by Random Polynomials", page 4. If no polynomial could be -// found in one million tries, an error is returned. -func RandomPolynomial() (Pol, error) { - for i := 0; i < randPolMaxTries; i++ { - var f Pol - - // choose polynomial at random - err := binary.Read(rand.Reader, binary.LittleEndian, &f) - if err != nil { - return 0, err - } - - // mask away bits above bit 53 - f &= Pol((1 << 54) - 1) - - // set highest and lowest bit so that the degree is 53 and the - // polynomial is not trivially reducible - f |= (1 << 53) | 1 - - // test if f is irreducible - if f.Irreducible() { - return f, nil - } - } - - // If this is reached, we haven't found an irreducible polynomial in - // randPolMaxTries. This error is very unlikely to occur. - return 0, errors.New("unable to find new random irreducible polynomial") -} - -// GCD computes the Greatest Common Divisor x and f. -func (x Pol) GCD(f Pol) Pol { - if f == 0 { - return x - } - - if x == 0 { - return f - } - - if x.Deg() < f.Deg() { - x, f = f, x - } - - return f.GCD(x.Mod(f)) -} - -// Irreducible returns true iff x is irreducible over F_2. This function -// uses Ben Or's reducibility test. -// -// For details see "Tests and Constructions of Irreducible Polynomials over -// Finite Fields". -func (x Pol) Irreducible() bool { - for i := 1; i <= x.Deg()/2; i++ { - if x.GCD(qp(uint(i), x)) != 1 { - return false - } - } - - return true -} - -// MulMod computes x*f mod g -func (x Pol) MulMod(f, g Pol) Pol { - if x == 0 || f == 0 { - return 0 - } - - var res Pol - for i := 0; i <= f.Deg(); i++ { - if (f & (1 << uint(i))) > 0 { - a := x - for j := 0; j < i; j++ { - a = a.Mul(2).Mod(g) - } - res = res.Add(a).Mod(g) - } - } - - return res -} - -// qp computes the polynomial (x^(2^p)-x) mod g. This is needed for the -// reducibility test. -func qp(p uint, g Pol) Pol { - num := (1 << p) - i := 1 - - // start with x - res := Pol(2) - - for i < num { - // repeatedly square res - res = res.MulMod(res, g) - i *= 2 - } - - // add x - return res.Add(2).Mod(g) -} - -func (p Pol) MarshalJSON() ([]byte, error) { - buf := strconv.AppendUint([]byte{'"'}, uint64(p), 16) - buf = append(buf, '"') - return buf, nil -} - -func (p *Pol) UnmarshalJSON(data []byte) error { - if len(data) < 2 { - return errors.New("invalid string for polynomial") - } - n, err := strconv.ParseUint(string(data[1:len(data)-1]), 16, 64) - if err != nil { - return err - } - *p = Pol(n) - - return nil -} diff --git a/vendor/github.com/whyrusleeping/go-keyspace/.gxlastpubver b/vendor/github.com/whyrusleeping/go-keyspace/.gxlastpubver deleted file mode 100644 index c343a53e..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/.gxlastpubver +++ /dev/null @@ -1 +0,0 @@ -0.0.0: QmaoGHsjT3vbZQWmfy6Lo4H4PoBTdQKRvCGda7G41eb6zd diff --git a/vendor/github.com/whyrusleeping/go-keyspace/LICENSE b/vendor/github.com/whyrusleeping/go-keyspace/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/go-keyspace/README.md b/vendor/github.com/whyrusleeping/go-keyspace/README.md deleted file mode 100644 index d223061f..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# go-keyspace -This is a package extracted from go-ipfs. - -Its purpose it to be used to compare a set of keys based on a given -metric. The primary metric used is XOR, as in kademlia. - diff --git a/vendor/github.com/whyrusleeping/go-keyspace/keyspace.go b/vendor/github.com/whyrusleeping/go-keyspace/keyspace.go deleted file mode 100644 index e26a0e6d..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/keyspace.go +++ /dev/null @@ -1,97 +0,0 @@ -package keyspace - -import ( - "sort" - - "math/big" -) - -// Key represents an identifier in a KeySpace. It holds a reference to the -// associated KeySpace, as well references to both the Original identifier, -// as well as the new, KeySpace Bytes one. -type Key struct { - - // Space is the KeySpace this Key is related to. - Space KeySpace - - // Original is the original value of the identifier - Original []byte - - // Bytes is the new value of the identifier, in the KeySpace. - Bytes []byte -} - -// Equal returns whether this key is equal to another. -func (k1 Key) Equal(k2 Key) bool { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Equal(k1, k2) -} - -// Less returns whether this key comes before another. -func (k1 Key) Less(k2 Key) bool { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Less(k1, k2) -} - -// Distance returns this key's distance to another -func (k1 Key) Distance(k2 Key) *big.Int { - if k1.Space != k2.Space { - panic("k1 and k2 not in same key space.") - } - return k1.Space.Distance(k1, k2) -} - -// KeySpace is an object used to do math on identifiers. Each keyspace has its -// own properties and rules. See XorKeySpace. -type KeySpace interface { - - // Key converts an identifier into a Key in this space. - Key([]byte) Key - - // Equal returns whether keys are equal in this key space - Equal(Key, Key) bool - - // Distance returns the distance metric in this key space - Distance(Key, Key) *big.Int - - // Less returns whether the first key is smaller than the second. - Less(Key, Key) bool -} - -// byDistanceToCenter is a type used to sort Keys by proximity to a center. -type byDistanceToCenter struct { - Center Key - Keys []Key -} - -func (s byDistanceToCenter) Len() int { - return len(s.Keys) -} - -func (s byDistanceToCenter) Swap(i, j int) { - s.Keys[i], s.Keys[j] = s.Keys[j], s.Keys[i] -} - -func (s byDistanceToCenter) Less(i, j int) bool { - a := s.Center.Distance(s.Keys[i]) - b := s.Center.Distance(s.Keys[j]) - return a.Cmp(b) == -1 -} - -// SortByDistance takes a KeySpace, a center Key, and a list of Keys toSort. -// It returns a new list, where the Keys toSort have been sorted by their -// distance to the center Key. -func SortByDistance(sp KeySpace, center Key, toSort []Key) []Key { - toSortCopy := make([]Key, len(toSort)) - copy(toSortCopy, toSort) - bdtc := &byDistanceToCenter{ - Center: center, - Keys: toSortCopy, // copy - } - sort.Sort(bdtc) - return bdtc.Keys -} diff --git a/vendor/github.com/whyrusleeping/go-keyspace/package.json b/vendor/github.com/whyrusleeping/go-keyspace/package.json deleted file mode 100644 index 5ca4f544..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "go-keyspace", - "author": "whyrusleeping", - "version": "1.0.0", - "language": "go", - "gx": { - "dvcsimport": "github.com/whyrusleeping/go-keyspace" - } -} diff --git a/vendor/github.com/whyrusleeping/go-keyspace/xor.go b/vendor/github.com/whyrusleeping/go-keyspace/xor.go deleted file mode 100644 index 24a542f7..00000000 --- a/vendor/github.com/whyrusleeping/go-keyspace/xor.go +++ /dev/null @@ -1,74 +0,0 @@ -package keyspace - -import ( - "bytes" - "crypto/sha256" - "math/big" -) - -// XORKeySpace is a KeySpace which: -// - normalizes identifiers using a cryptographic hash (sha256) -// - measures distance by XORing keys together -var XORKeySpace = &xorKeySpace{} -var _ KeySpace = XORKeySpace // ensure it conforms - -type xorKeySpace struct{} - -// Key converts an identifier into a Key in this space. -func (s *xorKeySpace) Key(id []byte) Key { - hash := sha256.Sum256(id) - key := hash[:] - return Key{ - Space: s, - Original: id, - Bytes: key, - } -} - -// Equal returns whether keys are equal in this key space -func (s *xorKeySpace) Equal(k1, k2 Key) bool { - return bytes.Equal(k1.Bytes, k2.Bytes) -} - -// Distance returns the distance metric in this key space -func (s *xorKeySpace) Distance(k1, k2 Key) *big.Int { - // XOR the keys - k3 := XOR(k1.Bytes, k2.Bytes) - - // interpret it as an integer - dist := big.NewInt(0).SetBytes(k3) - return dist -} - -// Less returns whether the first key is smaller than the second. -func (s *xorKeySpace) Less(k1, k2 Key) bool { - a := k1.Bytes - b := k2.Bytes - for i := 0; i < len(a); i++ { - if a[i] != b[i] { - return a[i] < b[i] - } - } - return true -} - -// ZeroPrefixLen returns the number of consecutive zeroes in a byte slice. -func ZeroPrefixLen(id []byte) int { - for i := 0; i < len(id); i++ { - for j := 0; j < 8; j++ { - if (id[i]>>uint8(7-j))&0x1 != 0 { - return i*8 + j - } - } - } - return len(id) * 8 -} - -// XOR takes two byte slices, XORs them together, returns the resulting slice. -func XOR(a, b []byte) []byte { - c := make([]byte, len(a)) - for i := 0; i < len(a); i++ { - c[i] = a[i] ^ b[i] - } - return c -} diff --git a/vendor/github.com/whyrusleeping/go-logging/.travis.yml b/vendor/github.com/whyrusleeping/go-logging/.travis.yml deleted file mode 100644 index 70e012b8..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: go - -go: - - 1.0 - - 1.1 - - tip diff --git a/vendor/github.com/whyrusleeping/go-logging/CONTRIBUTORS b/vendor/github.com/whyrusleeping/go-logging/CONTRIBUTORS deleted file mode 100644 index 958416ef..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/CONTRIBUTORS +++ /dev/null @@ -1,5 +0,0 @@ -Alec Thomas -Guilhem Lettron -Ivan Daniluk -Nimi Wariboko Jr -Róbert Selvek diff --git a/vendor/github.com/whyrusleeping/go-logging/LICENSE b/vendor/github.com/whyrusleeping/go-logging/LICENSE deleted file mode 100644 index f1f6cfce..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Örjan Persson. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/whyrusleeping/go-logging/README.md b/vendor/github.com/whyrusleeping/go-logging/README.md deleted file mode 100644 index 56695508..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/README.md +++ /dev/null @@ -1,89 +0,0 @@ -## Golang logging library - -[![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/op/go-logging) [![build](https://img.shields.io/travis/op/go-logging.svg?style=flat)](https://travis-ci.org/op/go-logging) - -Package logging implements a logging infrastructure for Go. Its output format -is customizable and supports different logging backends like syslog, file and -memory. Multiple backends can be utilized with different log levels per backend -and logger. - -## Example - -Let's have a look at an [example](examples/example.go) which demonstrates most -of the features found in this library. - -[![Example Output](examples/example.png)](examples/example.go) - -```go -package main - -import ( - "os" - - "github.com/op/go-logging" -) - -var log = logging.MustGetLogger("example") - -// Example format string. Everything except the message has a custom color -// which is dependent on the log level. Many fields have a custom output -// formatting too, eg. the time returns the hour down to the milli second. -var format = logging.MustStringFormatter( - "%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}", -) - -// Password is just an example type implementing the Redactor interface. Any -// time this is logged, the Redacted() function will be called. -type Password string - -func (p Password) Redacted() interface{} { - return logging.Redact(string(p)) -} - -func main() { - // For demo purposes, create two backend for os.Stderr. - backend1 := logging.NewLogBackend(os.Stderr, "", 0) - backend2 := logging.NewLogBackend(os.Stderr, "", 0) - - // For messages written to backend2 we want to add some additional - // information to the output, including the used log level and the name of - // the function. - backend2Formatter := logging.NewBackendFormatter(backend2, format) - - // Only errors and more severe messages should be sent to backend1 - backend1Leveled := logging.AddModuleLevel(backend1) - backend1Leveled.SetLevel(logging.ERROR, "") - - // Set the backends to be used. - logging.SetBackend(backend1Leveled, backend2Formatter) - - log.Debug("debug %s", Password("secret")) - log.Info("info") - log.Notice("notice") - log.Warning("warning") - log.Error("err") - log.Critical("crit") -} -``` - -## Installing - -### Using *go get* - - $ go get github.com/op/go-logging - -After this command *go-logging* is ready to use. Its source will be in: - - $GOROOT/src/pkg/github.com/op/go-logging - -You can use `go get -u` to update the package. - -## Documentation - -For docs, see http://godoc.org/github.com/op/go-logging or run: - - $ godoc github.com/op/go-logging - -## Additional resources - -* [wslog](https://godoc.org/github.com/cryptix/go/logging/wslog) -- exposes log messages through a WebSocket. diff --git a/vendor/github.com/whyrusleeping/go-logging/backend.go b/vendor/github.com/whyrusleeping/go-logging/backend.go deleted file mode 100644 index 6cd589ca..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/backend.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -// defaultBackend is the backend used for all logging calls. -var defaultBackend LeveledBackend - -// Backend is the interface which a log backend need to implement to be able to -// be used as a logging backend. -type Backend interface { - Log(Level, int, *Record) error -} - -// Set backend replaces the backend currently set with the given new logging -// backend. -func SetBackend(backends ...Backend) LeveledBackend { - var backend Backend - if len(backends) == 1 { - backend = backends[0] - } else { - backend = MultiLogger(backends...) - } - - defaultBackend = AddModuleLevel(backend) - return defaultBackend -} - -// SetLevel sets the logging level for the specified module. The module -// corresponds to the string specified in GetLogger. -func SetLevel(level Level, module string) { - defaultBackend.SetLevel(level, module) -} - -// GetLevel returns the logging level for the specified module. -func GetLevel(module string) Level { - return defaultBackend.GetLevel(module) -} diff --git a/vendor/github.com/whyrusleeping/go-logging/format.go b/vendor/github.com/whyrusleeping/go-logging/format.go deleted file mode 100644 index 99b1ddb7..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/format.go +++ /dev/null @@ -1,368 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "path" - "path/filepath" - "regexp" - "runtime" - "strings" - "sync" - "time" -) - -// TODO see Formatter interface in fmt/print.go -// TODO try text/template, maybe it have enough performance -// TODO other template systems? -// TODO make it possible to specify formats per backend? -type fmtVerb int - -const ( - fmtVerbTime fmtVerb = iota - fmtVerbLevel - fmtVerbId - fmtVerbPid - fmtVerbProgram - fmtVerbModule - fmtVerbMessage - fmtVerbLongfile - fmtVerbShortfile - fmtVerbLongpkg - fmtVerbShortpkg - fmtVerbLongfunc - fmtVerbShortfunc - fmtVerbLevelColor - - // Keep last, there are no match for these below. - fmtVerbUnknown - fmtVerbStatic -) - -var fmtVerbs = []string{ - "time", - "level", - "id", - "pid", - "program", - "module", - "message", - "longfile", - "shortfile", - "longpkg", - "shortpkg", - "longfunc", - "shortfunc", - "color", -} - -const rfc3339Milli = "2006-01-02T15:04:05.999Z07:00" - -var defaultVerbsLayout = []string{ - rfc3339Milli, - "s", - "d", - "d", - "s", - "s", - "s", - "s", - "s", - "s", - "s", - "s", - "s", - "", -} - -var ( - pid = os.Getpid() - program = filepath.Base(os.Args[0]) -) - -func getFmtVerbByName(name string) fmtVerb { - for i, verb := range fmtVerbs { - if name == verb { - return fmtVerb(i) - } - } - return fmtVerbUnknown -} - -// Formatter is the required interface for a custom log record formatter. -type Formatter interface { - Format(calldepth int, r *Record, w io.Writer) error -} - -// formatter is used by all backends unless otherwise overriden. -var formatter struct { - sync.RWMutex - def Formatter -} - -func getFormatter() Formatter { - formatter.RLock() - defer formatter.RUnlock() - return formatter.def -} - -var ( - // DefaultFormatter is the default formatter used and is only the message. - DefaultFormatter Formatter = MustStringFormatter("%{message}") - - // Glog format - GlogFormatter Formatter = MustStringFormatter("%{level:.1s}%{time:0102 15:04:05.999999} %{pid} %{shortfile}] %{message}") -) - -// SetFormatter sets the default formatter for all new backends. A backend will -// fetch this value once it is needed to format a record. Note that backends -// will cache the formatter after the first point. For now, make sure to set -// the formatter before logging. -func SetFormatter(f Formatter) { - formatter.Lock() - defer formatter.Unlock() - formatter.def = f -} - -var formatRe *regexp.Regexp = regexp.MustCompile(`%{([a-z]+)(?::(.*?[^\\]))?}`) - -type part struct { - verb fmtVerb - layout string -} - -// stringFormatter contains a list of parts which explains how to build the -// formatted string passed on to the logging backend. -type stringFormatter struct { - parts []part -} - -// NewStringFormatter returns a new Formatter which outputs the log record as a -// string based on the 'verbs' specified in the format string. -// -// The verbs: -// -// General: -// %{id} Sequence number for log message (uint64). -// %{pid} Process id (int) -// %{time} Time when log occurred (time.Time) -// %{level} Log level (Level) -// %{module} Module (string) -// %{program} Basename of os.Args[0] (string) -// %{message} Message (string) -// %{longfile} Full file name and line number: /a/b/c/d.go:23 -// %{shortfile} Final file name element and line number: d.go:23 -// %{color} ANSI color based on log level -// -// For normal types, the output can be customized by using the 'verbs' defined -// in the fmt package, eg. '%{id:04d}' to make the id output be '%04d' as the -// format string. -// -// For time.Time, use the same layout as time.Format to change the time format -// when output, eg "2006-01-02T15:04:05.999Z-07:00". -// -// For the 'color' verb, the output can be adjusted to either use bold colors, -// i.e., '%{color:bold}' or to reset the ANSI attributes, i.e., -// '%{color:reset}' Note that if you use the color verb explicitly, be sure to -// reset it or else the color state will persist past your log message. e.g., -// "%{color:bold}%{time:15:04:05} %{level:-8s}%{color:reset} %{message}" will -// just colorize the time and level, leaving the message uncolored. -// -// There's also a couple of experimental 'verbs'. These are exposed to get -// feedback and needs a bit of tinkering. Hence, they might change in the -// future. -// -// Experimental: -// %{longpkg} Full package path, eg. github.com/go-logging -// %{shortpkg} Base package path, eg. go-logging -// %{longfunc} Full function name, eg. littleEndian.PutUint32 -// %{shortfunc} Base function name, eg. PutUint32 -func NewStringFormatter(format string) (*stringFormatter, error) { - var fmter = &stringFormatter{} - - // Find the boundaries of all %{vars} - matches := formatRe.FindAllStringSubmatchIndex(format, -1) - if matches == nil { - return nil, errors.New("logger: invalid log format: " + format) - } - - // Collect all variables and static text for the format - prev := 0 - for _, m := range matches { - start, end := m[0], m[1] - if start > prev { - fmter.add(fmtVerbStatic, format[prev:start]) - } - - name := format[m[2]:m[3]] - verb := getFmtVerbByName(name) - if verb == fmtVerbUnknown { - return nil, errors.New("logger: unknown variable: " + name) - } - - // Handle layout customizations or use the default. If this is not for the - // time or color formatting, we need to prefix with %. - layout := defaultVerbsLayout[verb] - if m[4] != -1 { - layout = format[m[4]:m[5]] - } - if verb != fmtVerbTime && verb != fmtVerbLevelColor { - layout = "%" + layout - } - - fmter.add(verb, layout) - prev = end - } - end := format[prev:] - if end != "" { - fmter.add(fmtVerbStatic, end) - } - - // Make a test run to make sure we can format it correctly. - t, err := time.Parse(time.RFC3339, "2010-02-04T21:00:57-08:00") - if err != nil { - panic(err) - } - r := &Record{ - Id: 12345, - Time: t, - Module: "logger", - fmt: "hello %s", - args: []interface{}{"go"}, - } - if err := fmter.Format(0, r, &bytes.Buffer{}); err != nil { - return nil, err - } - - return fmter, nil -} - -// MustStringFormatter is equivalent to NewStringFormatter with a call to panic -// on error. -func MustStringFormatter(format string) *stringFormatter { - f, err := NewStringFormatter(format) - if err != nil { - panic("Failed to initialized string formatter: " + err.Error()) - } - return f -} - -func (f *stringFormatter) add(verb fmtVerb, layout string) { - f.parts = append(f.parts, part{verb, layout}) -} - -func (f *stringFormatter) Format(calldepth int, r *Record, output io.Writer) error { - for _, part := range f.parts { - if part.verb == fmtVerbStatic { - output.Write([]byte(part.layout)) - } else if part.verb == fmtVerbTime { - output.Write([]byte(r.Time.Format(part.layout))) - } else if part.verb == fmtVerbLevelColor { - if part.layout == "bold" { - output.Write([]byte(boldcolors[r.Level])) - } else if part.layout == "reset" { - output.Write([]byte("\033[0m")) - } else { - output.Write([]byte(colors[r.Level])) - } - } else { - var v interface{} - switch part.verb { - case fmtVerbLevel: - v = r.Level - break - case fmtVerbId: - v = r.Id - break - case fmtVerbPid: - v = pid - break - case fmtVerbProgram: - v = program - break - case fmtVerbModule: - v = r.Module - break - case fmtVerbMessage: - v = r.Message() - break - case fmtVerbLongfile, fmtVerbShortfile: - _, file, line, ok := runtime.Caller(calldepth + 1) - if !ok { - file = "???" - line = 0 - } else if part.verb == fmtVerbShortfile { - file = filepath.Base(file) - } - v = fmt.Sprintf("%s:%d", file, line) - case fmtVerbLongfunc, fmtVerbShortfunc, - fmtVerbLongpkg, fmtVerbShortpkg: - // TODO cache pc - v = "???" - if pc, _, _, ok := runtime.Caller(calldepth + 1); ok { - if f := runtime.FuncForPC(pc); f != nil { - v = formatFuncName(part.verb, f.Name()) - } - } - default: - panic("unhandled format part") - } - fmt.Fprintf(output, part.layout, v) - } - } - return nil -} - -// formatFuncName tries to extract certain part of the runtime formatted -// function name to some pre-defined variation. -// -// This function is known to not work properly if the package path or name -// contains a dot. -func formatFuncName(v fmtVerb, f string) string { - i := strings.LastIndex(f, "/") - j := strings.Index(f[i+1:], ".") - if j < 1 { - return "???" - } - pkg, fun := f[:i+j+1], f[i+j+2:] - switch v { - case fmtVerbLongpkg: - return pkg - case fmtVerbShortpkg: - return path.Base(pkg) - case fmtVerbLongfunc: - return fun - case fmtVerbShortfunc: - i = strings.LastIndex(fun, ".") - return fun[i+1:] - } - panic("unexpected func formatter") -} - -// backendFormatter combines a backend with a specific formatter making it -// possible to have different log formats for different backends. -type backendFormatter struct { - b Backend - f Formatter -} - -// NewBackendFormatter creates a new backend which makes all records that -// passes through it beeing formatted by the specific formatter. -func NewBackendFormatter(b Backend, f Formatter) *backendFormatter { - return &backendFormatter{b, f} -} - -// Log implements the Log function required by the Backend interface. -func (bf *backendFormatter) Log(level Level, calldepth int, r *Record) error { - // Make a shallow copy of the record and replace any formatter - r2 := *r - r2.formatter = bf.f - return bf.b.Log(level, calldepth+1, &r2) -} diff --git a/vendor/github.com/whyrusleeping/go-logging/level.go b/vendor/github.com/whyrusleeping/go-logging/level.go deleted file mode 100644 index 92934643..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/level.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -import ( - "errors" - "strings" - "sync" -) - -var ErrInvalidLogLevel = errors.New("logger: invalid log level") - -// Level defines all available log levels for log messages. -type Level int - -const ( - CRITICAL Level = iota - ERROR - WARNING - NOTICE - INFO - DEBUG -) - -var levelNames = []string{ - "CRITICAL", - "ERROR", - "WARNING", - "NOTICE", - "INFO", - "DEBUG", -} - -// String returns the string representation of a logging level. -func (p Level) String() string { - return levelNames[p] -} - -// LogLevel returns the log level from a string representation. -func LogLevel(level string) (Level, error) { - for i, name := range levelNames { - if strings.EqualFold(name, level) { - return Level(i), nil - } - } - return ERROR, ErrInvalidLogLevel -} - -type Leveled interface { - GetLevel(string) Level - SetLevel(Level, string) - IsEnabledFor(Level, string) bool -} - -// LeveledBackend is a log backend with additional knobs for setting levels on -// individual modules to different levels. -type LeveledBackend interface { - Backend - Leveled -} - -type moduleLeveled struct { - sync.RWMutex - levels map[string]Level - backend Backend - formatter Formatter - once sync.Once -} - -// AddModuleLevel wraps a log backend with knobs to have different log levels -// for different modules. -func AddModuleLevel(backend Backend) LeveledBackend { - var leveled LeveledBackend - var ok bool - if leveled, ok = backend.(LeveledBackend); !ok { - leveled = &moduleLeveled{ - levels: make(map[string]Level), - backend: backend, - } - } - return leveled -} - -// GetLevel returns the log level for the given module. -func (l *moduleLeveled) GetLevel(module string) Level { - l.RLock() - defer l.RUnlock() - level, exists := l.levels[module] - if exists == false { - level, exists = l.levels[""] - // no configuration exists, default to debug - if exists == false { - level = DEBUG - } - } - return level -} - -// SetLevel sets the log level for the given module. -func (l *moduleLeveled) SetLevel(level Level, module string) { - l.Lock() - defer l.Unlock() - l.levels[module] = level -} - -// IsEnabledFor will return true if logging is enabled for the given module. -func (l *moduleLeveled) IsEnabledFor(level Level, module string) bool { - return level <= l.GetLevel(module) -} - -func (l *moduleLeveled) Log(level Level, calldepth int, rec *Record) (err error) { - if l.IsEnabledFor(level, rec.Module) { - // TODO get rid of traces of formatter here. BackendFormatter should be used. - rec.formatter = l.getFormatterAndCacheCurrent() - err = l.backend.Log(level, calldepth+1, rec) - } - return -} - -func (l *moduleLeveled) getFormatterAndCacheCurrent() Formatter { - l.once.Do(func() { - if l.formatter == nil { - l.formatter = getFormatter() - } - }) - return l.formatter -} diff --git a/vendor/github.com/whyrusleeping/go-logging/log.go b/vendor/github.com/whyrusleeping/go-logging/log.go deleted file mode 100644 index f009f8af..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/log.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -import ( - "bytes" - "fmt" - "io" - "log" -) - -// TODO initialize here -var colors []string -var boldcolors []string - -type color int - -const ( - colorBlack = (iota + 30) - colorRed - colorGreen - colorYellow - colorBlue - colorMagenta - colorCyan - colorWhite -) - -// LogBackend utilizes the standard log module. -type LogBackend struct { - Logger *log.Logger - Color bool -} - -// NewLogBackend creates a new LogBackend. -func NewLogBackend(out io.Writer, prefix string, flag int) *LogBackend { - return &LogBackend{Logger: log.New(out, prefix, flag)} -} - -func (b *LogBackend) Log(level Level, calldepth int, rec *Record) error { - if b.Color { - buf := &bytes.Buffer{} - buf.Write([]byte(colors[level])) - buf.Write([]byte(rec.Formatted(calldepth + 1))) - buf.Write([]byte("\033[0m")) - // For some reason, the Go logger arbitrarily decided "2" was the correct - // call depth... - return b.Logger.Output(calldepth+2, buf.String()) - } else { - return b.Logger.Output(calldepth+2, rec.Formatted(calldepth+1)) - } - panic("should not be reached") -} - -func colorSeq(color color) string { - return fmt.Sprintf("\033[%dm", int(color)) -} - -func colorSeqBold(color color) string { - return fmt.Sprintf("\033[%d;1m", int(color)) -} - -func init() { - colors = []string{ - CRITICAL: colorSeq(colorMagenta), - ERROR: colorSeq(colorRed), - WARNING: colorSeq(colorYellow), - NOTICE: colorSeq(colorGreen), - DEBUG: colorSeq(colorCyan), - } - boldcolors = []string{ - CRITICAL: colorSeqBold(colorMagenta), - ERROR: colorSeqBold(colorRed), - WARNING: colorSeqBold(colorYellow), - NOTICE: colorSeqBold(colorGreen), - DEBUG: colorSeqBold(colorCyan), - } -} diff --git a/vendor/github.com/whyrusleeping/go-logging/logger.go b/vendor/github.com/whyrusleeping/go-logging/logger.go deleted file mode 100644 index 42b49495..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/logger.go +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package logging implements a logging infrastructure for Go. It supports -// different logging backends like syslog, file and memory. Multiple backends -// can be utilized with different log levels per backend and logger. -package logging - -import ( - "bytes" - "fmt" - "log" - "os" - "strings" - "sync/atomic" - "time" -) - -// Redactor is an interface for types that may contain sensitive information -// (like passwords), which shouldn't be printed to the log. The idea was found -// in relog as part of the vitness project. -type Redactor interface { - Redacted() interface{} -} - -// Redact returns a string of * having the same length as s. -func Redact(s string) string { - return strings.Repeat("*", len(s)) -} - -var ( - // Sequence number is incremented and utilized for all log records created. - sequenceNo uint64 - - // timeNow is a customizable for testing purposes. - timeNow = time.Now -) - -// Record represents a log record and contains the timestamp when the record -// was created, an increasing id, filename and line and finally the actual -// formatted log line. -type Record struct { - Id uint64 - Time time.Time - Module string - Level Level - - // message is kept as a pointer to have shallow copies update this once - // needed. - message *string - args []interface{} - fmt string - formatter Formatter - formatted string -} - -// Formatted returns the string-formatted version of a record. -func (r *Record) Formatted(calldepth int) string { - if r.formatted == "" { - var buf bytes.Buffer - r.formatter.Format(calldepth+1, r, &buf) - r.formatted = buf.String() - } - return r.formatted -} - -// Message returns a string message for outputting. Redacts any record args -// that implement the Redactor interface -func (r *Record) Message() string { - if r.message == nil { - // Redact the arguments that implements the Redactor interface - for i, arg := range r.args { - if redactor, ok := arg.(Redactor); ok == true { - r.args[i] = redactor.Redacted() - } - } - msg := fmt.Sprintf(r.fmt, r.args...) - r.message = &msg - } - return *r.message -} - -// Logger is a logging unit. It controls the flow of messages to a given -// (swappable) backend. -type Logger struct { - Module string - backend LeveledBackend - haveBackend bool - - // ExtraCallDepth can be used to add additional call depth when getting the - // calling function. This is normally used when wrapping a logger. - ExtraCalldepth int -} - -// SetBackend changes the backend of the logger. -func (l *Logger) SetBackend(backend LeveledBackend) { - l.backend = backend - l.haveBackend = true -} - -// GetLogger creates and returns a Logger object based on the module name. -// TODO call NewLogger and remove MustGetLogger? -func GetLogger(module string) (*Logger, error) { - return &Logger{Module: module}, nil -} - -// MustGetLogger is like GetLogger but panics if the logger can't be created. -// It simplifies safe initialization of a global logger for eg. a package. -func MustGetLogger(module string) *Logger { - logger, err := GetLogger(module) - if err != nil { - panic("logger: " + module + ": " + err.Error()) - } - return logger -} - -// Reset restores the internal state of the logging library. -func Reset() { - // TODO make a global Init() method to be less magic? or make it such that - // if there's no backends at all configured, we could use some tricks to - // automatically setup backends based if we have a TTY or not. - sequenceNo = 0 - b := SetBackend(NewLogBackend(os.Stderr, "", log.LstdFlags)) - b.SetLevel(DEBUG, "") - SetFormatter(DefaultFormatter) - timeNow = time.Now -} - -// InitForTesting is a convenient method when using logging in a test. Once -// called, the time will be frozen to January 1, 1970 UTC. -func InitForTesting(level Level) *MemoryBackend { - Reset() - - memoryBackend := NewMemoryBackend(10240) - - leveledBackend := AddModuleLevel(memoryBackend) - leveledBackend.SetLevel(level, "") - SetBackend(leveledBackend) - - timeNow = func() time.Time { - return time.Unix(0, 0).UTC() - } - return memoryBackend -} - -// IsEnabledFor returns true if the logger is enabled for the given level. -func (l *Logger) IsEnabledFor(level Level) bool { - return defaultBackend.IsEnabledFor(level, l.Module) -} - -func (l *Logger) log(lvl Level, format string, args ...interface{}) { - if !l.IsEnabledFor(lvl) { - return - } - - // Create the logging record and pass it in to the backend - record := &Record{ - Id: atomic.AddUint64(&sequenceNo, 1), - Time: timeNow(), - Module: l.Module, - Level: lvl, - fmt: format, - args: args, - } - - // TODO use channels to fan out the records to all backends? - // TODO in case of errors, do something (tricky) - - // calldepth=2 brings the stack up to the caller of the level - // methods, Info(), Fatal(), etc. - // ExtraCallDepth allows this to be extended further up the stack in case we - // are wrapping these methods, eg. to expose them package level - if l.haveBackend { - l.backend.Log(lvl, 2+l.ExtraCalldepth, record) - return - } - - defaultBackend.Log(lvl, 2+l.ExtraCalldepth, record) -} - -// Fatal is equivalent to l.Critical(fmt.Sprint()) followed by a call to os.Exit(1). -func (l *Logger) Fatal(args ...interface{}) { - s := fmt.Sprint(args...) - l.log(CRITICAL, "%s", s) - os.Exit(1) -} - -// Fatalf is equivalent to l.Critical followed by a call to os.Exit(1). -func (l *Logger) Fatalf(format string, args ...interface{}) { - l.log(CRITICAL, format, args...) - os.Exit(1) -} - -// Panic is equivalent to l.Critical(fmt.Sprint()) followed by a call to panic(). -func (l *Logger) Panic(args ...interface{}) { - s := fmt.Sprint(args...) - l.log(CRITICAL, "%s", s) - panic(s) -} - -// Panicf is equivalent to l.Critical followed by a call to panic(). -func (l *Logger) Panicf(format string, args ...interface{}) { - s := fmt.Sprintf(format, args...) - l.log(CRITICAL, "%s", s) - panic(s) -} - -// Critical logs a message using CRITICAL as log level. (fmt.Sprint()) -func (l *Logger) Critical(args ...interface{}) { - l.log(CRITICAL, defaultArgsFormat(len(args)), args...) -} - -// Criticalf logs a message using CRITICAL as log level. -func (l *Logger) Criticalf(format string, args ...interface{}) { - l.log(CRITICAL, format, args...) -} - -// Error logs a message using ERROR as log level. (fmt.Sprint()) -func (l *Logger) Error(args ...interface{}) { - l.log(ERROR, defaultArgsFormat(len(args)), args...) -} - -// Errorf logs a message using ERROR as log level. -func (l *Logger) Errorf(format string, args ...interface{}) { - l.log(ERROR, format, args...) -} - -// Warning logs a message using WARNING as log level. -func (l *Logger) Warning(args ...interface{}) { - l.log(WARNING, defaultArgsFormat(len(args)), args...) -} - -// Warningf logs a message using WARNING as log level. -func (l *Logger) Warningf(format string, args ...interface{}) { - l.log(WARNING, format, args...) -} - -// Notice logs a message using NOTICE as log level. -func (l *Logger) Notice(args ...interface{}) { - l.log(NOTICE, defaultArgsFormat(len(args)), args...) -} - -// Noticef logs a message using NOTICE as log level. -func (l *Logger) Noticef(format string, args ...interface{}) { - l.log(NOTICE, format, args...) -} - -// Info logs a message using INFO as log level. -func (l *Logger) Info(args ...interface{}) { - l.log(INFO, defaultArgsFormat(len(args)), args...) -} - -// Infof logs a message using INFO as log level. -func (l *Logger) Infof(format string, args ...interface{}) { - l.log(INFO, format, args...) -} - -// Debug logs a message using DEBUG as log level. -func (l *Logger) Debug(args ...interface{}) { - l.log(DEBUG, defaultArgsFormat(len(args)), args...) -} - -// Debugf logs a message using DEBUG as log level. -func (l *Logger) Debugf(format string, args ...interface{}) { - l.log(DEBUG, format, args...) -} - -func defaultArgsFormat(argc int) string { - f := strings.Repeat("%s ", argc) - if argc > 0 { - f = f[:len(f) - 1] - } - return f -} - -func init() { - Reset() -} diff --git a/vendor/github.com/whyrusleeping/go-logging/memory.go b/vendor/github.com/whyrusleeping/go-logging/memory.go deleted file mode 100644 index c59b92dd..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/memory.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -import ( - "sync" - "sync/atomic" - "unsafe" -) - -// TODO pick one of the memory backends and stick with it or share interface. - -// Node is a record node pointing to an optional next node. -type node struct { - next *node - Record *Record -} - -// Next returns the next record node. If there's no node available, it will -// return nil. -func (n *node) Next() *node { - return n.next -} - -// MemoryBackend is a simple memory based logging backend that will not produce -// any output but merly keep records, up to the given size, in memory. -type MemoryBackend struct { - size int32 - maxSize int32 - head, tail unsafe.Pointer -} - -// NewMemoryBackend creates a simple in-memory logging backend. -func NewMemoryBackend(size int) *MemoryBackend { - return &MemoryBackend{maxSize: int32(size)} -} - -// Log implements the Log method required by Backend. -func (b *MemoryBackend) Log(level Level, calldepth int, rec *Record) error { - var size int32 - - n := &node{Record: rec} - np := unsafe.Pointer(n) - - // Add the record to the tail. If there's no records available, tail and - // head will both be nil. When we successfully set the tail and the previous - // value was nil, it's safe to set the head to the current value too. - for { - tailp := b.tail - swapped := atomic.CompareAndSwapPointer( - &b.tail, - tailp, - np, - ) - if swapped == true { - if tailp == nil { - b.head = np - } else { - (*node)(tailp).next = n - } - size = atomic.AddInt32(&b.size, 1) - break - } - } - - // Since one record was added, we might have overflowed the list. Remove - // a record if that is the case. The size will fluctate a bit, but - // eventual consistent. - if b.maxSize > 0 && size > b.maxSize { - for { - headp := b.head - head := (*node)(b.head) - if head.next == nil { - break - } - swapped := atomic.CompareAndSwapPointer( - &b.head, - headp, - unsafe.Pointer(head.next), - ) - if swapped == true { - atomic.AddInt32(&b.size, -1) - break - } - } - } - return nil -} - -// Head returns the oldest record node kept in memory. It can be used to -// iterate over records, one by one, up to the last record. -// -// Note: new records can get added while iterating. Hence the number of records -// iterated over might be larger than the maximum size. -func (b *MemoryBackend) Head() *node { - return (*node)(b.head) -} - -type event int - -const ( - eventFlush event = iota - eventStop -) - -// ChannelMemoryBackend is very similar to the MemoryBackend, except that it -// internally utilizes a channel. -type ChannelMemoryBackend struct { - maxSize int - size int - incoming chan *Record - events chan event - mu sync.Mutex - running bool - flushWg sync.WaitGroup - stopWg sync.WaitGroup - head, tail *node -} - -// NewChannelMemoryBackend creates a simple in-memory logging backend which -// utilizes a go channel for communication. -// -// Start will automatically be called by this function. -func NewChannelMemoryBackend(size int) *ChannelMemoryBackend { - backend := &ChannelMemoryBackend{ - maxSize: size, - incoming: make(chan *Record, 1024), - events: make(chan event), - } - backend.Start() - return backend -} - -// Start launches the internal goroutine which starts processing data from the -// input channel. -func (b *ChannelMemoryBackend) Start() { - b.mu.Lock() - defer b.mu.Unlock() - - // Launch the goroutine unless it's already running. - if b.running != true { - b.running = true - b.stopWg.Add(1) - go b.process() - } -} - -func (b *ChannelMemoryBackend) process() { - defer b.stopWg.Done() - for { - select { - case rec := <-b.incoming: - b.insertRecord(rec) - case e := <-b.events: - switch e { - case eventStop: - return - case eventFlush: - for len(b.incoming) > 0 { - b.insertRecord(<-b.incoming) - } - b.flushWg.Done() - } - } - } -} - -func (b *ChannelMemoryBackend) insertRecord(rec *Record) { - prev := b.tail - b.tail = &node{Record: rec} - if prev == nil { - b.head = b.tail - } else { - prev.next = b.tail - } - - if b.maxSize > 0 && b.size >= b.maxSize { - b.head = b.head.next - } else { - b.size += 1 - } -} - -// Flush waits until all records in the buffered channel have been processed. -func (b *ChannelMemoryBackend) Flush() { - b.flushWg.Add(1) - b.events <- eventFlush - b.flushWg.Wait() -} - -// Stop signals the internal goroutine to exit and waits until it have. -func (b *ChannelMemoryBackend) Stop() { - b.mu.Lock() - if b.running == true { - b.running = false - b.events <- eventStop - } - b.mu.Unlock() - b.stopWg.Wait() -} - -// Log implements the Log method required by Backend. -func (b *ChannelMemoryBackend) Log(level Level, calldepth int, rec *Record) error { - b.incoming <- rec - return nil -} - -// Head returns the oldest record node kept in memory. It can be used to -// iterate over records, one by one, up to the last record. -// -// Note: new records can get added while iterating. Hence the number of records -// iterated over might be larger than the maximum size. -func (b *ChannelMemoryBackend) Head() *node { - return b.head -} diff --git a/vendor/github.com/whyrusleeping/go-logging/multi.go b/vendor/github.com/whyrusleeping/go-logging/multi.go deleted file mode 100644 index 3731653e..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/multi.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package logging - -// TODO remove Level stuff from the multi logger. Do one thing. - -// multiLogger is a log multiplexer which can be used to utilize multiple log -// backends at once. -type multiLogger struct { - backends []LeveledBackend -} - -// MultiLogger creates a logger which contain multiple loggers. -func MultiLogger(backends ...Backend) LeveledBackend { - var leveledBackends []LeveledBackend - for _, backend := range backends { - leveledBackends = append(leveledBackends, AddModuleLevel(backend)) - } - return &multiLogger{leveledBackends} -} - -// Log passes the log record to all backends. -func (b *multiLogger) Log(level Level, calldepth int, rec *Record) (err error) { - for _, backend := range b.backends { - if backend.IsEnabledFor(level, rec.Module) { - // Shallow copy of the record for the formatted cache on Record and get the - // record formatter from the backend. - r2 := *rec - if e := backend.Log(level, calldepth+1, &r2); e != nil { - err = e - } - } - } - return -} - -// GetLevel returns the highest level enabled by all backends. -func (b *multiLogger) GetLevel(module string) Level { - var level Level - for _, backend := range b.backends { - if backendLevel := backend.GetLevel(module); backendLevel > level { - level = backendLevel - } - } - return level -} - -// SetLevel propagates the same level to all backends. -func (b *multiLogger) SetLevel(level Level, module string) { - for _, backend := range b.backends { - backend.SetLevel(level, module) - } -} - -// IsEnabledFor returns true if any of the backends are enabled for it. -func (b *multiLogger) IsEnabledFor(level Level, module string) bool { - for _, backend := range b.backends { - if backend.IsEnabledFor(level, module) { - return true - } - } - return false -} diff --git a/vendor/github.com/whyrusleeping/go-logging/syslog.go b/vendor/github.com/whyrusleeping/go-logging/syslog.go deleted file mode 100644 index 9a5c8f5d..00000000 --- a/vendor/github.com/whyrusleeping/go-logging/syslog.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2013, Örjan Persson. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//+build !windows,!plan9 - -package logging - -import "log/syslog" - -// SyslogBackend is a simple logger to syslog backend. It automatically maps -// the internal log levels to appropriate syslog log levels. -type SyslogBackend struct { - Writer *syslog.Writer -} - -// NewSyslogBackend connects to the syslog daemon using UNIX sockets with the -// given prefix. If prefix is not given, the prefix will be derived from the -// launched command. -func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { - var w *syslog.Writer - w, err = syslog.New(syslog.LOG_CRIT, prefix) - return &SyslogBackend{w}, err -} - -// NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom -// syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc. -func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) { - var w *syslog.Writer - w, err = syslog.New(priority, prefix) - return &SyslogBackend{w}, err -} - -func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { - line := rec.Formatted(calldepth + 1) - switch level { - case CRITICAL: - return b.Writer.Crit(line) - case ERROR: - return b.Writer.Err(line) - case WARNING: - return b.Writer.Warning(line) - case NOTICE: - return b.Writer.Notice(line) - case INFO: - return b.Writer.Info(line) - case DEBUG: - return b.Writer.Debug(line) - default: - } - panic("unhandled log level") -} diff --git a/vendor/github.com/whyrusleeping/go-notifier/LICENSE b/vendor/github.com/whyrusleeping/go-notifier/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/whyrusleeping/go-notifier/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/go-notifier/notifier.go b/vendor/github.com/whyrusleeping/go-notifier/notifier.go deleted file mode 100644 index 33302cfd..00000000 --- a/vendor/github.com/whyrusleeping/go-notifier/notifier.go +++ /dev/null @@ -1,146 +0,0 @@ -// Package notifier provides a simple notification dispatcher -// meant to be embedded in larger structres who wish to allow -// clients to sign up for event notifications. -package notifier - -import ( - "sync" - - process "github.com/jbenet/goprocess" - ratelimit "github.com/jbenet/goprocess/ratelimit" -) - -// Notifiee is a generic interface. Clients implement -// their own Notifiee interfaces to ensure type-safety -// of notifications: -// -// type RocketNotifiee interface{ -// Countdown(r Rocket, countdown time.Duration) -// LiftedOff(Rocket) -// ReachedOrbit(Rocket) -// Detached(Rocket, Capsule) -// Landed(Rocket) -// } -// -type Notifiee interface{} - -// Notifier is a notification dispatcher. It's meant -// to be composed, and its zero-value is ready to be used. -// -// type Rocket struct { -// notifier notifier.Notifier -// } -// -type Notifier struct { - mu sync.RWMutex // guards notifiees - nots map[Notifiee]struct{} - lim *ratelimit.RateLimiter -} - -// RateLimited returns a rate limited Notifier. only limit goroutines -// will be spawned. If limit is zero, no rate limiting happens. This -// is the same as `Notifier{}`. -func RateLimited(limit int) Notifier { - n := Notifier{} - if limit > 0 { - n.lim = ratelimit.NewRateLimiter(process.Background(), limit) - } - return n -} - -// Notify signs up Notifiee e for notifications. This function -// is meant to be called behind your own type-safe function(s): -// -// // generic function for pattern-following -// func (r *Rocket) Notify(n Notifiee) { -// r.notifier.Notify(n) -// } -// -// // or as part of other functions -// func (r *Rocket) Onboard(a Astronaut) { -// r.astronauts = append(r.austronauts, a) -// r.notifier.Notify(a) -// } -// -func (n *Notifier) Notify(e Notifiee) { - n.mu.Lock() - if n.nots == nil { // so that zero-value is ready to be used. - n.nots = make(map[Notifiee]struct{}) - } - n.nots[e] = struct{}{} - n.mu.Unlock() -} - -// StopNotify stops notifying Notifiee e. This function -// is meant to be called behind your own type-safe function(s): -// -// // generic function for pattern-following -// func (r *Rocket) StopNotify(n Notifiee) { -// r.notifier.StopNotify(n) -// } -// -// // or as part of other functions -// func (r *Rocket) Detach(c Capsule) { -// r.notifier.StopNotify(c) -// r.capsule = nil -// } -// -func (n *Notifier) StopNotify(e Notifiee) { - n.mu.Lock() - if n.nots != nil { // so that zero-value is ready to be used. - delete(n.nots, e) - } - n.mu.Unlock() -} - -// NotifyAll messages the notifier's notifiees with a given notification. -// This is done by calling the given function with each notifiee. It is -// meant to be called with your own type-safe notification functions: -// -// func (r *Rocket) Launch() { -// r.notifyAll(func(n Notifiee) { -// n.Launched(r) -// }) -// } -// -// // make it private so only you can use it. This function is necessary -// // to make sure you only up-cast in one place. You control who you added -// // to be a notifiee. If Go adds generics, maybe we can get rid of this -// // method but for now it is like wrapping a type-less container with -// // a type safe interface. -// func (r *Rocket) notifyAll(notify func(Notifiee)) { -// r.notifier.NotifyAll(func(n notifier.Notifiee) { -// notify(n.(Notifiee)) -// }) -// } -// -// Note well: each notification is launched in its own goroutine, so they -// can be processed concurrently, and so that whatever the notification does -// it _never_ blocks out the client. This is so that consumers _cannot_ add -// hooks into your object that block you accidentally. -func (n *Notifier) NotifyAll(notify func(Notifiee)) { - n.mu.Lock() - defer n.mu.Unlock() - - if n.nots == nil { // so that zero-value is ready to be used. - return - } - - // no rate limiting. - if n.lim == nil { - for notifiee := range n.nots { - go notify(notifiee) - } - return - } - - // with rate limiting. - n.lim.Go(func(worker process.Process) { - for notifiee := range n.nots { - notifiee := notifiee // rebind for loop data races - n.lim.LimitedGo(func(worker process.Process) { - notify(notifiee) - }) - } - }) -} diff --git a/vendor/github.com/whyrusleeping/go-notifier/package.json b/vendor/github.com/whyrusleeping/go-notifier/package.json deleted file mode 100644 index 8eba8f55..00000000 --- a/vendor/github.com/whyrusleeping/go-notifier/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/go-notifier" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/go-notifier" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP", - "name": "goprocess", - "version": "1.0.0" - } - ], - "gxVersion": "0.9.1", - "language": "go", - "license": "", - "name": "go-notifier", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.0.0" -} - diff --git a/vendor/github.com/whyrusleeping/mafmt/LICENSE b/vendor/github.com/whyrusleeping/mafmt/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/whyrusleeping/mafmt/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/mafmt/README.md b/vendor/github.com/whyrusleeping/mafmt/README.md deleted file mode 100644 index 9fdc5389..00000000 --- a/vendor/github.com/whyrusleeping/mafmt/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# multiaddr format -A validation checker for multiaddrs. Some basic validators for common address -types are provided, but creating your own combinations is easy. - -Usage: -```go -a, _ := ma.NewMultiaddr("/ip4/5.2.67.3/tcp/1708") -TCP.Matches(a) // returns true -``` - -Making your own validators is easy, for example, the `Reliable` multiaddr is -defined as follows: - -```go -// Define IP as either ipv4 or ipv6 -var IP = Or(Base(ma.P_IP4), Base(ma.P_IP6)) - -// Define TCP as 'tcp' on top of either ipv4 or ipv6 -var TCP = And(IP, Base(ma.P_TCP)) - -// Define UDP as 'udp' on top of either ipv4 or ipv6 -var UDP = And(IP, Base(ma.P_UDP)) - -// Define UTP as 'utp' on top of udp (on top of ipv4 or ipv6) -var UTP = And(UDP, Base(ma.P_UTP)) - -// Now define a Reliable transport as either tcp or utp -var Reliable = Or(TCP, UTP) - -// From here, we can easily define multiaddrs for protocols that can run on top -// of any 'reliable' transport (such as ipfs) -``` - -NOTE: the above patterns are already implemented in package diff --git a/vendor/github.com/whyrusleeping/mafmt/package.json b/vendor/github.com/whyrusleeping/mafmt/package.json deleted file mode 100644 index d5a7375b..00000000 --- a/vendor/github.com/whyrusleeping/mafmt/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/whyrusleeping/mafmt" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmT4U94DnD8FRfqr21obWY32HLM5VExccPKMjQHofeYqr9", - "name": "go-multiaddr", - "version": "1.3.5" - } - ], - "gxVersion": "0.6.0", - "gx_version": "0.4.0", - "issues_url": "https://github.com/whyrusleeping/mafmt", - "language": "go", - "license": "", - "name": "mafmt", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.2.8" -} - diff --git a/vendor/github.com/whyrusleeping/mafmt/patterns.go b/vendor/github.com/whyrusleeping/mafmt/patterns.go deleted file mode 100644 index c3d19120..00000000 --- a/vendor/github.com/whyrusleeping/mafmt/patterns.go +++ /dev/null @@ -1,133 +0,0 @@ -package mafmt - -import ( - "strings" - - ma "github.com/multiformats/go-multiaddr" -) - -// Define IP as either ipv4 or ipv6 -var IP = Or(Base(ma.P_IP4), Base(ma.P_IP6)) - -// Define TCP as 'tcp' on top of either ipv4 or ipv6 -var TCP = And(IP, Base(ma.P_TCP)) - -// Define UDP as 'udp' on top of either ipv4 or ipv6 -var UDP = And(IP, Base(ma.P_UDP)) - -// Define UTP as 'utp' on top of udp (on top of ipv4 or ipv6) -var UTP = And(UDP, Base(ma.P_UTP)) - -// Define QUIC as 'quic' on top of udp (on top of ipv4 or ipv6) -var QUIC = And(UDP, Base(ma.P_QUIC)) - -// Define unreliable transport as udp -var Unreliable = Or(UDP) - -// Now define a Reliable transport as either tcp or utp or quic -var Reliable = Or(TCP, UTP, QUIC) - -// IPFS can run over any reliable underlying transport protocol -var IPFS = And(Reliable, Base(ma.P_IPFS)) - -const ( - or = iota - and = iota -) - -func And(ps ...Pattern) Pattern { - return &pattern{ - Op: and, - Args: ps, - } -} - -func Or(ps ...Pattern) Pattern { - return &pattern{ - Op: or, - Args: ps, - } -} - -type Pattern interface { - Matches(ma.Multiaddr) bool - partialMatch([]ma.Protocol) (bool, []ma.Protocol) - String() string -} - -type pattern struct { - Args []Pattern - Op int -} - -func (ptrn *pattern) Matches(a ma.Multiaddr) bool { - ok, rem := ptrn.partialMatch(a.Protocols()) - return ok && len(rem) == 0 -} - -func (ptrn *pattern) partialMatch(pcs []ma.Protocol) (bool, []ma.Protocol) { - switch ptrn.Op { - case or: - for _, a := range ptrn.Args { - ok, rem := a.partialMatch(pcs) - if ok { - return true, rem - } - } - return false, nil - case and: - if len(pcs) < len(ptrn.Args) { - return false, nil - } - - for i := 0; i < len(ptrn.Args); i++ { - ok, rem := ptrn.Args[i].partialMatch(pcs) - if !ok { - return false, nil - } - - pcs = rem - } - - return true, pcs - default: - panic("unrecognized pattern operand") - } -} - -func (ptrn *pattern) String() string { - var sub []string - for _, a := range ptrn.Args { - sub = append(sub, a.String()) - } - - switch ptrn.Op { - case and: - return strings.Join(sub, "/") - case or: - return "{" + strings.Join(sub, "|") + "}" - default: - panic("unrecognized pattern op!") - } -} - -type Base int - -func (p Base) Matches(a ma.Multiaddr) bool { - pcs := a.Protocols() - return pcs[0].Code == int(p) && len(pcs) == 1 -} - -func (p Base) partialMatch(pcs []ma.Protocol) (bool, []ma.Protocol) { - if len(pcs) == 0 { - return false, nil - } - if pcs[0].Code == int(p) { - return true, pcs[1:] - } - return false, nil -} - -func (p Base) String() string { - return ma.ProtocolWithCode(int(p)).Name -} diff --git a/vendor/github.com/whyrusleeping/mdns/.gitignore b/vendor/github.com/whyrusleeping/mdns/.gitignore deleted file mode 100644 index 83656241..00000000 --- a/vendor/github.com/whyrusleeping/mdns/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test diff --git a/vendor/github.com/whyrusleeping/mdns/LICENSE b/vendor/github.com/whyrusleeping/mdns/LICENSE deleted file mode 100644 index a5df10e6..00000000 --- a/vendor/github.com/whyrusleeping/mdns/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Armon Dadgar - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/mdns/README.md b/vendor/github.com/whyrusleeping/mdns/README.md deleted file mode 100644 index 80f3d90a..00000000 --- a/vendor/github.com/whyrusleeping/mdns/README.md +++ /dev/null @@ -1,37 +0,0 @@ -mdns -==== - -Simple mDNS client/server library in Golang. mDNS or Multicast DNS can be -used to discover services on the local network without the use of an authoritative -DNS server. This enables peer-to-peer discovery. It is important to note that many -networks restrict the use of multicasting, which prevents mDNS from functioning. -Notably, multicast cannot be used in any sort of cloud, or shared infrastructure -environment. However it works well in most office, home, or private infrastructure -environments. - -Using the library is very simple, here is an example of publishing a service entry: - - // Setup our service export - host, _ := os.Hostname() - info := []string{"My awesome service"}, - service, _ := NewMDNSService(host, "_foobar._tcp", "", "", 8000, nil, info) - - // Create the mDNS server, defer shutdown - server, _ := mdns.NewServer(&mdns.Config{Zone: service}) - defer server.Shutdown() - - -Doing a lookup for service providers is also very simple: - - // Make a channel for results and start listening - entriesCh := make(chan *mdns.ServiceEntry, 4) - go func() { - for entry := range entriesCh { - fmt.Printf("Got new entry: %v\n", entry) - } - }() - - // Start the lookup - mdns.Lookup("_foobar._tcp", entriesCh) - close(entriesCh) - diff --git a/vendor/github.com/whyrusleeping/mdns/client.go b/vendor/github.com/whyrusleeping/mdns/client.go deleted file mode 100644 index 3fad4f2d..00000000 --- a/vendor/github.com/whyrusleeping/mdns/client.go +++ /dev/null @@ -1,369 +0,0 @@ -package mdns - -import ( - "fmt" - "net" - "strings" - "sync" - "time" - - "github.com/miekg/dns" - "golang.org/x/net/ipv4" - "golang.org/x/net/ipv6" -) - -// ServiceEntry is returned after we query for a service -type ServiceEntry struct { - Name string - Host string - AddrV4 net.IP - AddrV6 net.IP - Port int - Info string - InfoFields []string - - Addr net.IP // @Deprecated - - hasTXT bool - sent bool -} - -// complete is used to check if we have all the info we need -func (s *ServiceEntry) complete() bool { - return (s.AddrV4 != nil || s.AddrV6 != nil || s.Addr != nil) && s.Port != 0 && s.hasTXT -} - -// QueryParam is used to customize how a Lookup is performed -type QueryParam struct { - Service string // Service to lookup - Domain string // Lookup domain, default "local" - Timeout time.Duration // Lookup timeout, default 1 second - Interface *net.Interface // Multicast interface to use - Entries chan<- *ServiceEntry // Entries Channel - WantUnicastResponse bool // Unicast response desired, as per 5.4 in RFC -} - -// DefaultParams is used to return a default set of QueryParam's -func DefaultParams(service string) *QueryParam { - return &QueryParam{ - Service: service, - Domain: "local", - Timeout: time.Second, - Entries: make(chan *ServiceEntry), - WantUnicastResponse: false, // TODO(reddaly): Change this default. - } -} - -// Query looks up a given service, in a domain, waiting at most -// for a timeout before finishing the query. The results are streamed -// to a channel. Sends will not block, so clients should make sure to -// either read or buffer. -func Query(params *QueryParam) error { - // Create a new client - client, err := newClient() - if err != nil { - return err - } - defer client.Close() - - // Set the multicast interface - if params.Interface != nil { - if err := client.setInterface(params.Interface); err != nil { - return err - } - } - - // Ensure defaults are set - if params.Domain == "" { - params.Domain = "local" - } - if params.Timeout == 0 { - params.Timeout = time.Second - } - - // Run the query - return client.query(params) -} - -// Lookup is the same as Query, however it uses all the default parameters -func Lookup(service string, entries chan<- *ServiceEntry) error { - params := DefaultParams(service) - params.Entries = entries - return Query(params) -} - -// Client provides a query interface that can be used to -// search for service providers using mDNS -type client struct { - ipv4UnicastConn *net.UDPConn - ipv6UnicastConn *net.UDPConn - - ipv4MulticastConn *net.UDPConn - ipv6MulticastConn *net.UDPConn - - closed bool - closedCh chan struct{} // TODO(reddaly): This doesn't appear to be used. - closeLock sync.Mutex -} - -// NewClient creates a new mdns Client that can be used to query -// for records -func newClient() (*client, error) { - // TODO(reddaly): At least attempt to bind to the port required in the spec. - // Create a IPv4 listener - uconn4, err := net.ListenUDP("udp4", &net.UDPAddr{IP: net.IPv4zero, Port: 0}) - if err != nil { - logf("[ERR] mdns: Failed to bind to udp4 port: %v", err) - } - uconn6, err := net.ListenUDP("udp6", &net.UDPAddr{IP: net.IPv6zero, Port: 0}) - if err != nil { - logf("[ERR] mdns: Failed to bind to udp6 port: %v", err) - } - - if uconn4 == nil && uconn6 == nil { - return nil, fmt.Errorf("failed to bind to any unicast udp port") - } - - mconn4, err := net.ListenMulticastUDP("udp4", nil, ipv4Addr) - if err != nil { - logf("[ERR] mdns: Failed to bind to udp4 port: %v", err) - } - mconn6, err := net.ListenMulticastUDP("udp6", nil, ipv6Addr) - if err != nil { - logf("[ERR] mdns: Failed to bind to udp6 port: %v", err) - } - - if mconn4 == nil && mconn6 == nil { - return nil, fmt.Errorf("failed to bind to any multicast udp port") - } - - c := &client{ - ipv4MulticastConn: mconn4, - ipv6MulticastConn: mconn6, - ipv4UnicastConn: uconn4, - ipv6UnicastConn: uconn6, - closedCh: make(chan struct{}), - } - return c, nil -} - -func (c *client) getIsClosed() bool { - c.closeLock.Lock() - defer c.closeLock.Unlock() - return c.closed -} - -// Close is used to cleanup the client -func (c *client) Close() error { - c.closeLock.Lock() - defer c.closeLock.Unlock() - - if c.closed { - return nil - } - c.closed = true - - logf("[INFO] mdns: Closing client %v", *c) - close(c.closedCh) - - if c.ipv4UnicastConn != nil { - c.ipv4UnicastConn.Close() - } - if c.ipv6UnicastConn != nil { - c.ipv6UnicastConn.Close() - } - if c.ipv4MulticastConn != nil { - c.ipv4MulticastConn.Close() - } - if c.ipv6MulticastConn != nil { - c.ipv6MulticastConn.Close() - } - - return nil -} - -// setInterface is used to set the query interface, uses sytem -// default if not provided -func (c *client) setInterface(iface *net.Interface) error { - p := ipv4.NewPacketConn(c.ipv4UnicastConn) - if err := p.SetMulticastInterface(iface); err != nil { - return err - } - p2 := ipv6.NewPacketConn(c.ipv6UnicastConn) - if err := p2.SetMulticastInterface(iface); err != nil { - return err - } - p = ipv4.NewPacketConn(c.ipv4MulticastConn) - if err := p.SetMulticastInterface(iface); err != nil { - return err - } - p2 = ipv6.NewPacketConn(c.ipv6MulticastConn) - if err := p2.SetMulticastInterface(iface); err != nil { - return err - } - return nil -} - -// query is used to perform a lookup and stream results -func (c *client) query(params *QueryParam) error { - // Create the service name - serviceAddr := fmt.Sprintf("%s.%s.", trimDot(params.Service), trimDot(params.Domain)) - - // Start listening for response packets - msgCh := make(chan *dns.Msg, 32) - go c.recv(c.ipv4UnicastConn, msgCh) - go c.recv(c.ipv6UnicastConn, msgCh) - go c.recv(c.ipv4MulticastConn, msgCh) - go c.recv(c.ipv6MulticastConn, msgCh) - - // Send the query - m := new(dns.Msg) - m.SetQuestion(serviceAddr, dns.TypePTR) - // RFC 6762, section 18.12. Repurposing of Top Bit of qclass in Question - // Section - // - // In the Question Section of a Multicast DNS query, the top bit of the qclass - // field is used to indicate that unicast responses are preferred for this - // particular question. (See Section 5.4.) - if params.WantUnicastResponse { - m.Question[0].Qclass |= 1 << 15 - } - m.RecursionDesired = false - if err := c.sendQuery(m); err != nil { - return err - } - - // Map the in-progress responses - inprogress := make(map[string]*ServiceEntry) - - // Listen until we reach the timeout - finish := time.After(params.Timeout) - for { - select { - case resp := <-msgCh: - var inp *ServiceEntry - for _, answer := range append(resp.Answer, resp.Extra...) { - // TODO(reddaly): Check that response corresponds to serviceAddr? - switch rr := answer.(type) { - case *dns.PTR: - // Create new entry for this - inp = ensureName(inprogress, rr.Ptr) - - case *dns.SRV: - // Check for a target mismatch - if rr.Target != rr.Hdr.Name { - alias(inprogress, rr.Hdr.Name, rr.Target) - } - - // Get the port - inp = ensureName(inprogress, rr.Hdr.Name) - inp.Host = rr.Target - inp.Port = int(rr.Port) - - case *dns.TXT: - // Pull out the txt - inp = ensureName(inprogress, rr.Hdr.Name) - inp.Info = strings.Join(rr.Txt, "|") - inp.InfoFields = rr.Txt - inp.hasTXT = true - - case *dns.A: - // Pull out the IP - inp = ensureName(inprogress, rr.Hdr.Name) - inp.Addr = rr.A // @Deprecated - inp.AddrV4 = rr.A - - case *dns.AAAA: - // Pull out the IP - inp = ensureName(inprogress, rr.Hdr.Name) - inp.Addr = rr.AAAA // @Deprecated - inp.AddrV6 = rr.AAAA - } - } - - if inp == nil { - continue - } - - // Check if this entry is complete - if inp.complete() { - if inp.sent { - continue - } - inp.sent = true - select { - case params.Entries <- inp: - default: - } - } else { - // Fire off a node specific query - m := new(dns.Msg) - m.SetQuestion(inp.Name, dns.TypePTR) - m.RecursionDesired = false - if err := c.sendQuery(m); err != nil { - logf("[ERR] mdns: Failed to query instance %s: %v", inp.Name, err) - } - } - case <-finish: - return nil - } - } -} - -// sendQuery is used to multicast a query out -func (c *client) sendQuery(q *dns.Msg) error { - buf, err := q.Pack() - if err != nil { - return err - } - if c.ipv4UnicastConn != nil { - c.ipv4UnicastConn.WriteToUDP(buf, ipv4Addr) - } - if c.ipv6UnicastConn != nil { - c.ipv6UnicastConn.WriteToUDP(buf, ipv6Addr) - } - return nil -} - -// recv is used to receive until we get a shutdown -func (c *client) recv(l *net.UDPConn, msgCh chan *dns.Msg) { - if l == nil { - return - } - buf := make([]byte, 65536) - for !c.getIsClosed() { - n, err := l.Read(buf) - if err != nil { - logf("[ERR] mdns: Failed to read packet: %v", err) - continue - } - msg := new(dns.Msg) - if err := msg.Unpack(buf[:n]); err != nil { - logf("[ERR] mdns: Failed to unpack packet: %v", err) - continue - } - select { - case msgCh <- msg: - case <-c.closedCh: - return - } - } -} - -// ensureName is used to ensure the named node is in progress -func ensureName(inprogress map[string]*ServiceEntry, name string) *ServiceEntry { - if inp, ok := inprogress[name]; ok { - return inp - } - inp := &ServiceEntry{ - Name: name, - } - inprogress[name] = inp - return inp -} - -// alias is used to setup an alias between two entries -func alias(inprogress map[string]*ServiceEntry, src, dst string) { - srcEntry := ensureName(inprogress, src) - inprogress[dst] = srcEntry -} diff --git a/vendor/github.com/whyrusleeping/mdns/log.go b/vendor/github.com/whyrusleeping/mdns/log.go deleted file mode 100644 index 79eeb81a..00000000 --- a/vendor/github.com/whyrusleeping/mdns/log.go +++ /dev/null @@ -1,13 +0,0 @@ -package mdns - -import "log" - -// DisableLogging disables all log messages -var DisableLogging bool - -func logf(format string, args ...interface{}) { - if DisableLogging { - return - } - log.Printf(format, args...) -} diff --git a/vendor/github.com/whyrusleeping/mdns/package.json b/vendor/github.com/whyrusleeping/mdns/package.json deleted file mode 100644 index 5d2a702b..00000000 --- a/vendor/github.com/whyrusleeping/mdns/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/whyrusleeping/mdns" - }, - "gxDependencies": [ - { - "hash": "QmV3bVtkAhSZqWncYGonUmsVcJcV6cpzWztsFwc3A9so5m", - "name": "dns", - "version": "0.2.1" - }, - { - "hash": "QmRvYNctevGUW52urgmoFZscT6buMKqhHezLUS64WepGWn", - "name": "go-net", - "version": "0.2.0" - } - ], - "gxVersion": "0.8.0", - "issues_url": "", - "language": "go", - "license": "", - "name": "mdns", - "version": "0.2.0" -} - diff --git a/vendor/github.com/whyrusleeping/mdns/server.go b/vendor/github.com/whyrusleeping/mdns/server.go deleted file mode 100644 index 42aba8fd..00000000 --- a/vendor/github.com/whyrusleeping/mdns/server.go +++ /dev/null @@ -1,291 +0,0 @@ -package mdns - -import ( - "fmt" - "net" - "strings" - "sync" - - "github.com/miekg/dns" -) - -const ( - ipv4mdns = "224.0.0.251" - ipv6mdns = "ff02::fb" - mdnsPort = 5353 - forceUnicastResponses = false -) - -var ( - ipv4Addr = &net.UDPAddr{ - IP: net.ParseIP(ipv4mdns), - Port: mdnsPort, - } - ipv6Addr = &net.UDPAddr{ - IP: net.ParseIP(ipv6mdns), - Port: mdnsPort, - } -) - -// Config is used to configure the mDNS server -type Config struct { - // Zone must be provided to support responding to queries - Zone Zone - - // Iface if provided binds the multicast listener to the given - // interface. If not provided, the system default multicase interface - // is used. - Iface *net.Interface -} - -// mDNS server is used to listen for mDNS queries and respond if we -// have a matching local record -type Server struct { - config *Config - - ipv4List *net.UDPConn - ipv6List *net.UDPConn - - shutdown bool - shutdownCh chan struct{} - shutdownLock sync.Mutex -} - -// NewServer is used to create a new mDNS server from a config -func NewServer(config *Config) (*Server, error) { - // Create the listeners - ipv4List, _ := net.ListenMulticastUDP("udp4", config.Iface, ipv4Addr) - ipv6List, _ := net.ListenMulticastUDP("udp6", config.Iface, ipv6Addr) - - // Check if we have any listener - if ipv4List == nil && ipv6List == nil { - return nil, fmt.Errorf("No multicast listeners could be started") - } - - s := &Server{ - config: config, - ipv4List: ipv4List, - ipv6List: ipv6List, - shutdownCh: make(chan struct{}), - } - - if ipv4List != nil { - go s.recv(s.ipv4List) - } - - if ipv6List != nil { - go s.recv(s.ipv6List) - } - - return s, nil -} - -func (s *Server) getIsShutdown() bool { - s.shutdownLock.Lock() - defer s.shutdownLock.Unlock() - return s.shutdown -} - -// Shutdown is used to shutdown the listener -func (s *Server) Shutdown() error { - s.shutdownLock.Lock() - defer s.shutdownLock.Unlock() - - if s.shutdown { - return nil - } - s.shutdown = true - close(s.shutdownCh) - - if s.ipv4List != nil { - s.ipv4List.Close() - } - if s.ipv6List != nil { - s.ipv6List.Close() - } - return nil -} - -// recv is a long running routine to receive packets from an interface -func (s *Server) recv(c *net.UDPConn) { - if c == nil { - return - } - buf := make([]byte, 65536) - for !s.getIsShutdown() { - n, from, err := c.ReadFrom(buf) - if err != nil { - continue - } - if err := s.parsePacket(buf[:n], from); err != nil { - logf("[ERR] mdns: Failed to handle query: %v", err) - } - } -} - -// parsePacket is used to parse an incoming packet -func (s *Server) parsePacket(packet []byte, from net.Addr) error { - var msg dns.Msg - if err := msg.Unpack(packet); err != nil { - logf("[ERR] mdns: Failed to unpack packet: %v", err) - return err - } - return s.handleQuery(&msg, from) -} - -// handleQuery is used to handle an incoming query -func (s *Server) handleQuery(query *dns.Msg, from net.Addr) error { - if query.Opcode != dns.OpcodeQuery { - // "In both multicast query and multicast response messages, the OPCODE MUST - // be zero on transmission (only standard queries are currently supported - // over multicast). Multicast DNS messages received with an OPCODE other - // than zero MUST be silently ignored." Note: OpcodeQuery == 0 - return fmt.Errorf("mdns: received query with non-zero Opcode %v: %v", query.Opcode, *query) - } - if query.Rcode != 0 { - // "In both multicast query and multicast response messages, the Response - // Code MUST be zero on transmission. Multicast DNS messages received with - // non-zero Response Codes MUST be silently ignored." - return fmt.Errorf("mdns: received query with non-zero Rcode %v: %v", query.Rcode, *query) - } - - // TODO(reddaly): Handle "TC (Truncated) Bit": - // In query messages, if the TC bit is set, it means that additional - // Known-Answer records may be following shortly. A responder SHOULD - // record this fact, and wait for those additional Known-Answer records, - // before deciding whether to respond. If the TC bit is clear, it means - // that the querying host has no additional Known Answers. - if query.Truncated { - return fmt.Errorf("[ERR] mdns: support for DNS requests with high truncated bit not implemented: %v", *query) - } - - var unicastAnswer, multicastAnswer []dns.RR - - // Handle each question - for _, q := range query.Question { - mrecs, urecs := s.handleQuestion(q) - multicastAnswer = append(multicastAnswer, mrecs...) - unicastAnswer = append(unicastAnswer, urecs...) - } - - // See section 18 of RFC 6762 for rules about DNS headers. - resp := func(unicast bool) *dns.Msg { - // 18.1: ID (Query Identifier) - // 0 for multicast response, query.Id for unicast response - id := uint16(0) - if unicast { - id = query.Id - } - - var answer []dns.RR - if unicast { - answer = unicastAnswer - } else { - answer = multicastAnswer - } - if len(answer) == 0 { - return nil - } - - return &dns.Msg{ - MsgHdr: dns.MsgHdr{ - Id: id, - - // 18.2: QR (Query/Response) Bit - must be set to 1 in response. - Response: true, - - // 18.3: OPCODE - must be zero in response (OpcodeQuery == 0) - Opcode: dns.OpcodeQuery, - - // 18.4: AA (Authoritative Answer) Bit - must be set to 1 - Authoritative: true, - - // The following fields must all be set to 0: - // 18.5: TC (TRUNCATED) Bit - // 18.6: RD (Recursion Desired) Bit - // 18.7: RA (Recursion Available) Bit - // 18.8: Z (Zero) Bit - // 18.9: AD (Authentic Data) Bit - // 18.10: CD (Checking Disabled) Bit - // 18.11: RCODE (Response Code) - }, - // 18.12 pertains to questions (handled by handleQuestion) - // 18.13 pertains to resource records (handled by handleQuestion) - - // 18.14: Name Compression - responses should be compressed (though see - // caveats in the RFC), so set the Compress bit (part of the dns library - // API, not part of the DNS packet) to true. - Compress: true, - - Answer: answer, - } - } - - if len(multicastAnswer) == 0 && len(unicastAnswer) == 0 { - questions := make([]string, len(query.Question)) - for i, q := range query.Question { - questions[i] = q.Name - } - logf("no responses for query with questions: %s", strings.Join(questions, ", ")) - } - - if mresp := resp(false); mresp != nil { - if err := s.sendResponse(mresp, from, false); err != nil { - return fmt.Errorf("mdns: error sending multicast response: %v", err) - } - } - if uresp := resp(true); uresp != nil { - if err := s.sendResponse(uresp, from, true); err != nil { - return fmt.Errorf("mdns: error sending unicast response: %v", err) - } - } - return nil -} - -// handleQuestion is used to handle an incoming question -// -// The response to a question may be transmitted over multicast, unicast, or -// both. The return values are DNS records for each transmission type. -func (s *Server) handleQuestion(q dns.Question) (multicastRecs, unicastRecs []dns.RR) { - records := s.config.Zone.Records(q) - - if len(records) == 0 { - return nil, nil - } - - // Handle unicast and multicast responses. - // TODO(reddaly): The decision about sending over unicast vs. multicast is not - // yet fully compliant with RFC 6762. For example, the unicast bit should be - // ignored if the records in question are close to TTL expiration. For now, - // we just use the unicast bit to make the decision, as per the spec: - // RFC 6762, section 18.12. Repurposing of Top Bit of qclass in Question - // Section - // - // In the Question Section of a Multicast DNS query, the top bit of the - // qclass field is used to indicate that unicast responses are preferred - // for this particular question. (See Section 5.4.) - if q.Qclass&(1<<15) != 0 || forceUnicastResponses { - return nil, records - } - return records, nil -} - -// sendResponse is used to send a response packet -func (s *Server) sendResponse(resp *dns.Msg, from net.Addr, unicast bool) error { - // TODO(reddaly): Respect the unicast argument, and allow sending responses - // over multicast. - buf, err := resp.Pack() - if err != nil { - return err - } - - // Determine the socket to send from - addr := from.(*net.UDPAddr) - if addr.IP.To4() != nil { - _, err = s.ipv4List.WriteToUDP(buf, addr) - return err - } else { - _, err = s.ipv6List.WriteToUDP(buf, addr) - return err - } -} diff --git a/vendor/github.com/whyrusleeping/mdns/zone.go b/vendor/github.com/whyrusleeping/mdns/zone.go deleted file mode 100644 index 6f442c7b..00000000 --- a/vendor/github.com/whyrusleeping/mdns/zone.go +++ /dev/null @@ -1,307 +0,0 @@ -package mdns - -import ( - "fmt" - "net" - "os" - "strings" - - "github.com/miekg/dns" -) - -const ( - // defaultTTL is the default TTL value in returned DNS records in seconds. - defaultTTL = 120 -) - -// Zone is the interface used to integrate with the server and -// to serve records dynamically -type Zone interface { - // Records returns DNS records in response to a DNS question. - Records(q dns.Question) []dns.RR -} - -// MDNSService is used to export a named service by implementing a Zone -type MDNSService struct { - Instance string // Instance name (e.g. "hostService name") - Service string // Service name (e.g. "_http._tcp.") - Domain string // If blank, assumes "local" - HostName string // Host machine DNS name (e.g. "mymachine.net.") - Port int // Service Port - IPs []net.IP // IP addresses for the service's host - TXT []string // Service TXT records - - serviceAddr string // Fully qualified service address - instanceAddr string // Fully qualified instance address - enumAddr string // _services._dns-sd._udp. -} - -// validateFQDN returns an error if the passed string is not a fully qualified -// hdomain name (more specifically, a hostname). -func validateFQDN(s string) error { - if len(s) == 0 { - return fmt.Errorf("FQDN must not be blank") - } - if s[len(s)-1] != '.' { - return fmt.Errorf("FQDN must end in period: %s", s) - } - // TODO(reddaly): Perform full validation. - - return nil -} - -// NewMDNSService returns a new instance of MDNSService. -// -// If domain, hostName, or ips is set to the zero value, then a default value -// will be inferred from the operating system. -// -// TODO(reddaly): This interface may need to change to account for "unique -// record" conflict rules of the mDNS protocol. Upon startup, the server should -// check to ensure that the instance name does not conflict with other instance -// names, and, if required, select a new name. There may also be conflicting -// hostName A/AAAA records. -func NewMDNSService(instance, service, domain, hostName string, port int, ips []net.IP, txt []string) (*MDNSService, error) { - // Sanity check inputs - if instance == "" { - return nil, fmt.Errorf("missing service instance name") - } - if service == "" { - return nil, fmt.Errorf("missing service name") - } - if port == 0 { - return nil, fmt.Errorf("missing service port") - } - - // Set default domain - if domain == "" { - domain = "local." - } - if err := validateFQDN(domain); err != nil { - return nil, fmt.Errorf("domain %q is not a fully-qualified domain name: %v", domain, err) - } - - // Get host information if no host is specified. - if hostName == "" { - var err error - hostName, err = os.Hostname() - if err != nil { - return nil, fmt.Errorf("could not determine host: %v", err) - } - hostName = fmt.Sprintf("%s.", hostName) - } - if err := validateFQDN(hostName); err != nil { - return nil, fmt.Errorf("hostName %q is not a fully-qualified domain name: %v", hostName, err) - } - - if len(ips) == 0 { - var err error - ips, err = net.LookupIP(hostName) - if err != nil { - // Try appending the host domain suffix and lookup again - // (required for Linux-based hosts) - tmpHostName := fmt.Sprintf("%s%s", hostName, domain) - - ips, err = net.LookupIP(tmpHostName) - - if err != nil { - return nil, fmt.Errorf("could not determine host IP addresses for %s", hostName) - } - } - } - for _, ip := range ips { - if ip.To4() == nil && ip.To16() == nil { - return nil, fmt.Errorf("invalid IP address in IPs list: %v", ip) - } - } - - return &MDNSService{ - Instance: instance, - Service: service, - Domain: domain, - HostName: hostName, - Port: port, - IPs: ips, - TXT: txt, - serviceAddr: fmt.Sprintf("%s.%s.", trimDot(service), trimDot(domain)), - instanceAddr: fmt.Sprintf("%s.%s.%s.", instance, trimDot(service), trimDot(domain)), - enumAddr: fmt.Sprintf("_services._dns-sd._udp.%s.", trimDot(domain)), - }, nil -} - -// trimDot is used to trim the dots from the start or end of a string -func trimDot(s string) string { - return strings.Trim(s, ".") -} - -// Records returns DNS records in response to a DNS question. -func (m *MDNSService) Records(q dns.Question) []dns.RR { - switch q.Name { - case m.enumAddr: - return m.serviceEnum(q) - case m.serviceAddr: - return m.serviceRecords(q) - case m.instanceAddr: - return m.instanceRecords(q) - case m.HostName: - if q.Qtype == dns.TypeA || q.Qtype == dns.TypeAAAA { - return m.instanceRecords(q) - } - fallthrough - default: - return nil - } -} - -func (m *MDNSService) serviceEnum(q dns.Question) []dns.RR { - switch q.Qtype { - case dns.TypeANY: - fallthrough - case dns.TypePTR: - rr := &dns.PTR{ - Hdr: dns.RR_Header{ - Name: q.Name, - Rrtype: dns.TypePTR, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - Ptr: m.serviceAddr, - } - return []dns.RR{rr} - default: - return nil - } -} - -// serviceRecords is called when the query matches the service name -func (m *MDNSService) serviceRecords(q dns.Question) []dns.RR { - switch q.Qtype { - case dns.TypeANY: - fallthrough - case dns.TypePTR: - // Build a PTR response for the service - rr := &dns.PTR{ - Hdr: dns.RR_Header{ - Name: q.Name, - Rrtype: dns.TypePTR, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - Ptr: m.instanceAddr, - } - servRec := []dns.RR{rr} - - // Get the instance records - instRecs := m.instanceRecords(dns.Question{ - Name: m.instanceAddr, - Qtype: dns.TypeANY, - }) - - // Return the service record with the instance records - return append(servRec, instRecs...) - default: - return nil - } -} - -// serviceRecords is called when the query matches the instance name -func (m *MDNSService) instanceRecords(q dns.Question) []dns.RR { - switch q.Qtype { - case dns.TypeANY: - // Get the SRV, which includes A and AAAA - recs := m.instanceRecords(dns.Question{ - Name: m.instanceAddr, - Qtype: dns.TypeSRV, - }) - - // Add the TXT record - recs = append(recs, m.instanceRecords(dns.Question{ - Name: m.instanceAddr, - Qtype: dns.TypeTXT, - })...) - return recs - - case dns.TypeA: - var rr []dns.RR - for _, ip := range m.IPs { - if ip4 := ip.To4(); ip4 != nil { - rr = append(rr, &dns.A{ - Hdr: dns.RR_Header{ - Name: m.HostName, - Rrtype: dns.TypeA, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - A: ip4, - }) - } - } - return rr - - case dns.TypeAAAA: - var rr []dns.RR - for _, ip := range m.IPs { - if ip.To4() != nil { - // TODO(reddaly): IPv4 addresses could be encoded in IPv6 format and - // putinto AAAA records, but the current logic puts ipv4-encodable - // addresses into the A records exclusively. Perhaps this should be - // configurable? - continue - } - - if ip16 := ip.To16(); ip16 != nil { - rr = append(rr, &dns.AAAA{ - Hdr: dns.RR_Header{ - Name: m.HostName, - Rrtype: dns.TypeAAAA, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - AAAA: ip16, - }) - } - } - return rr - - case dns.TypeSRV: - // Create the SRV Record - srv := &dns.SRV{ - Hdr: dns.RR_Header{ - Name: q.Name, - Rrtype: dns.TypeSRV, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - Priority: 10, - Weight: 1, - Port: uint16(m.Port), - Target: m.HostName, - } - recs := []dns.RR{srv} - - // Add the A record - recs = append(recs, m.instanceRecords(dns.Question{ - Name: m.instanceAddr, - Qtype: dns.TypeA, - })...) - - // Add the AAAA record - recs = append(recs, m.instanceRecords(dns.Question{ - Name: m.instanceAddr, - Qtype: dns.TypeAAAA, - })...) - return recs - - case dns.TypeTXT: - txt := &dns.TXT{ - Hdr: dns.RR_Header{ - Name: q.Name, - Rrtype: dns.TypeTXT, - Class: dns.ClassINET, - Ttl: defaultTTL, - }, - Txt: m.TXT, - } - return []dns.RR{txt} - } - return nil -} diff --git a/vendor/github.com/whyrusleeping/multiaddr-filter/.gxlastpubver b/vendor/github.com/whyrusleeping/multiaddr-filter/.gxlastpubver deleted file mode 100644 index 2b077ca5..00000000 --- a/vendor/github.com/whyrusleeping/multiaddr-filter/.gxlastpubver +++ /dev/null @@ -1 +0,0 @@ -1.0.0: QmXE4GFk66B5Ts362YWZosjiZLpP4QDmBTBadRZFffZ58U diff --git a/vendor/github.com/whyrusleeping/multiaddr-filter/LICENSE b/vendor/github.com/whyrusleeping/multiaddr-filter/LICENSE deleted file mode 100644 index 1a976e72..00000000 --- a/vendor/github.com/whyrusleeping/multiaddr-filter/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/multiaddr-filter/README.md b/vendor/github.com/whyrusleeping/multiaddr-filter/README.md deleted file mode 100644 index 6a3ca8f8..00000000 --- a/vendor/github.com/whyrusleeping/multiaddr-filter/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# go-multiaddr-filter -- CIDR netmasks with multiaddr - -This module creates very simple [multiaddr](https://github.com/jbenet/go-multiaddr) formatted cidr netmasks. - -It doesn't do full multiaddr parsing to save on vendoring things and perf. The `net` package will take care of verifying the validity of the network part anyway. - -## Usage - -```go - -import filter "github.com/whyrusleeping/multiaddr-filter" - -filter.NewMask("/ip4/192.168.0.0/24") // ipv4 -filter.NewMask("/ip6/fe80::/64") // ipv6 -``` diff --git a/vendor/github.com/whyrusleeping/multiaddr-filter/mask.go b/vendor/github.com/whyrusleeping/multiaddr-filter/mask.go deleted file mode 100644 index 7f012258..00000000 --- a/vendor/github.com/whyrusleeping/multiaddr-filter/mask.go +++ /dev/null @@ -1,47 +0,0 @@ -package mask - -import ( - "errors" - "fmt" - "net" - "strings" -) - -var ErrInvalidFormat = errors.New("invalid multiaddr-filter format") - -func NewMask(a string) (*net.IPNet, error) { - parts := strings.Split(a, "/") - - if parts[0] != "" { - return nil, ErrInvalidFormat - } - - if len(parts) != 5 { - return nil, ErrInvalidFormat - } - - // check it's a valid filter address. ip + cidr - isip := parts[1] == "ip4" || parts[1] == "ip6" - iscidr := parts[3] == "ipcidr" - if !isip || !iscidr { - return nil, ErrInvalidFormat - } - - _, ipn, err := net.ParseCIDR(parts[2] + "/" + parts[4]) - if err != nil { - return nil, err - } - return ipn, nil -} - -func ConvertIPNet(n *net.IPNet) (string, error) { - b, _ := n.Mask.Size() - switch { - case n.IP.To4() != nil: - return fmt.Sprintf("/ip4/%s/ipcidr/%d", n.IP, b), nil - case n.IP.To16() != nil: - return fmt.Sprintf("/ip6/%s/ipcidr/%d", n.IP, b), nil - default: - return "", fmt.Errorf("was not given valid ip addr") - } -} diff --git a/vendor/github.com/whyrusleeping/multiaddr-filter/package.json b/vendor/github.com/whyrusleeping/multiaddr-filter/package.json deleted file mode 100644 index 70c9cf56..00000000 --- a/vendor/github.com/whyrusleeping/multiaddr-filter/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": {}, - "gx": { - "dvcsimport": "github.com/whyrusleeping/multiaddr-filter" - }, - "gxVersion": "0.7.0", - "language": "go", - "license": "", - "name": "multiaddr-filter", - "version": "1.0.2" -} diff --git a/vendor/github.com/whyrusleeping/sql-datastore/LICENSE b/vendor/github.com/whyrusleeping/sql-datastore/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/whyrusleeping/sql-datastore/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/sql-datastore/README.md b/vendor/github.com/whyrusleeping/sql-datastore/README.md deleted file mode 100644 index d7afebb0..00000000 --- a/vendor/github.com/whyrusleeping/sql-datastore/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# SQL Datastore - -An implementation of [the datastore interface](https://github.com/ipfs/go-datastore) -that can be backed by any sql database. - -## Usage -``` -import ( - "database/sql" - "github.com/whyrusleeping/sql-datastore" -) - -mydb, _ := sql.Open("yourdb", "yourdbparameters") - -ds := sqlds.NewSqlDatastore(mydb) -``` - -## License -MIT diff --git a/vendor/github.com/whyrusleeping/sql-datastore/dstore.go b/vendor/github.com/whyrusleeping/sql-datastore/dstore.go deleted file mode 100644 index 179efa02..00000000 --- a/vendor/github.com/whyrusleeping/sql-datastore/dstore.go +++ /dev/null @@ -1,266 +0,0 @@ -package sqlds - -import ( - "database/sql" - "errors" - "fmt" - "log" - - ds "github.com/ipfs/go-datastore" - dsq "github.com/ipfs/go-datastore/query" -) - -type Queries interface { - Delete() string - Exists() string - Get() string - Put() string - Query() string - Prefix() string - Limit() string - Offset() string - GetSize() string -} - -type Datastore struct { - db *sql.DB - queries Queries -} - -// NewDatastore returns a new datastore -func NewDatastore(db *sql.DB, queries Queries) *Datastore { - return &Datastore{db: db, queries: queries} -} - -type batch struct { - db *sql.DB - queries Queries - txn *sql.Tx -} - -func (b *batch) GetTransaction() (*sql.Tx, error) { - if b.txn != nil { - return b.txn, nil - } - - newTransaction, err := b.db.Begin() - if err != nil { - if newTransaction != nil { - newTransaction.Rollback() - } - - return nil, err - } - - b.txn = newTransaction - return newTransaction, nil -} - -func (b *batch) Put(key ds.Key, val []byte) error { - if val == nil { - return ds.ErrInvalidType - } - - txn, err := b.GetTransaction() - if err != nil { - b.txn.Rollback() - return err - } - - _, err = txn.Exec(b.queries.Put(), key.String(), val) - if err != nil { - b.txn.Rollback() - return err - } - - return nil -} - -func (b *batch) Delete(key ds.Key) error { - txn, err := b.GetTransaction() - if err != nil { - b.txn.Rollback() - } - - _, err = txn.Exec(b.queries.Delete(), key.String()) - if err != nil { - b.txn.Rollback() - return err - } - - return err -} - -func (b *batch) Commit() error { - if b.txn == nil { - return errors.New("no transaction started, cannot commit") - } - var err = b.txn.Commit() - if err != nil { - b.txn.Rollback() - return err - } - - return nil -} - -func (d *Datastore) Batch() (ds.Batch, error) { - batch := &batch{ - db: d.db, - queries: d.queries, - txn: nil, - } - - return batch, nil -} - -func (d *Datastore) Close() error { - return d.db.Close() -} - -func (d *Datastore) Delete(key ds.Key) error { - result, err := d.db.Exec(d.queries.Delete(), key.String()) - if err != nil { - return err - } - - rows, err := result.RowsAffected() - if err != nil { - return err - } - - if rows == 0 { - return ds.ErrNotFound - } - - return nil -} - -func (d *Datastore) Get(key ds.Key) (value []byte, err error) { - row := d.db.QueryRow(d.queries.Get(), key.String()) - var out []byte - - switch err := row.Scan(&out); err { - case sql.ErrNoRows: - return nil, ds.ErrNotFound - case nil: - return out, nil - default: - return nil, err - } -} - -func (d *Datastore) Has(key ds.Key) (exists bool, err error) { - row := d.db.QueryRow(d.queries.Exists(), key.String()) - - switch err := row.Scan(&exists); err { - case sql.ErrNoRows: - return exists, nil - case nil: - return exists, nil - default: - return exists, err - } -} - -func (d *Datastore) Put(key ds.Key, value []byte) error { - if value == nil { - return ds.ErrInvalidType - } - - _, err := d.db.Exec(d.queries.Put(), key.String(), value) - if err != nil { - return err - } - - return nil -} - -func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) { - raw, err := d.RawQuery(q) - if err != nil { - return nil, err - } - - for _, f := range q.Filters { - raw = dsq.NaiveFilter(raw, f) - } - - raw = dsq.NaiveOrder(raw, q.Orders...) - - return raw, nil -} - -func (d *Datastore) RawQuery(q dsq.Query) (dsq.Results, error) { - var rows *sql.Rows - var err error - - if q.Prefix != "" { - rows, err = QueryWithParams(d, q) - } else { - rows, err = d.db.Query(d.queries.Query()) - } - - if err != nil { - return nil, err - } - - var entries []dsq.Entry - defer rows.Close() - - for rows.Next() { - var key string - var out []byte - err := rows.Scan(&key, &out) - - if err != nil { - log.Fatal("Error reading rows from query") - } - - entry := dsq.Entry{ - Key: key, - Value: out, - } - - entries = append(entries, entry) - } - - results := dsq.ResultsWithEntries(q, entries) - return results, nil -} - -func (d *Datastore) GetSize(key ds.Key) (int, error) { - row := d.db.QueryRow(d.queries.GetSize(), key.String()) - var size int - - switch err := row.Scan(&size); err { - case sql.ErrNoRows: - return -1, ds.ErrNotFound - case nil: - return size, nil - default: - return 0, err - } -} - -// QueryWithParams applies prefix, limit, and offset params in pg query -func QueryWithParams(d *Datastore, q dsq.Query) (*sql.Rows, error) { - var qNew = d.queries.Query() - - if q.Prefix != "" { - qNew += fmt.Sprintf(d.queries.Prefix(), q.Prefix) - } - - if q.Limit != 0 { - qNew += fmt.Sprintf(d.queries.Limit(), q.Limit) - } - - if q.Offset != 0 { - qNew += fmt.Sprintf(d.queries.Offset(), q.Offset) - } - - return d.db.Query(qNew) - -} - -var _ ds.Datastore = (*Datastore)(nil) diff --git a/vendor/github.com/whyrusleeping/sql-datastore/package.json b/vendor/github.com/whyrusleeping/sql-datastore/package.json deleted file mode 100644 index f5cccc1b..00000000 --- a/vendor/github.com/whyrusleeping/sql-datastore/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/sql-datastore" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/sql-datastore" - }, - "gxDependencies": [ - { - "author": "magik6k", - "hash": "QmfJhaxwzBCorUmZNRmY87z4mD6roRrHFMqddhiS4D4XWr", - "name": "pq", - "version": "1.0.0" - }, - { - "author": "jbenet", - "hash": "QmPGYyi1DtuWyUkG3PtvLz1xb4ScjnUvwJMCoX3cxeyxNr", - "name": "go-datastore", - "version": "3.5.0" - } - ], - "gxVersion": "0.14.0", - "language": "go", - "license": "", - "name": "sql-datastore", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.0.2" -} - diff --git a/vendor/github.com/whyrusleeping/sql-datastore/postgres/postgres.go b/vendor/github.com/whyrusleeping/sql-datastore/postgres/postgres.go deleted file mode 100644 index be418941..00000000 --- a/vendor/github.com/whyrusleeping/sql-datastore/postgres/postgres.go +++ /dev/null @@ -1,89 +0,0 @@ -package postgres - -import ( - "database/sql" - "fmt" - - "github.com/whyrusleeping/sql-datastore" - - _ "github.com/lib/pq" //postgres driver -) - -// Options are the postgres datastore options, reexported here for convenience. -type Options struct { - Host string - Port string - User string - Password string - Database string -} - -type Queries struct { -} - -func (Queries) Delete() string { - return `DELETE FROM blocks WHERE key = $1` -} - -func (Queries) Exists() string { - return `SELECT exists(SELECT 1 FROM blocks WHERE key=$1)` -} - -func (Queries) Get() string { - return `SELECT data FROM blocks WHERE key = $1` -} - -func (Queries) Put() string { - return `INSERT INTO blocks (key, data) SELECT $1, $2 WHERE NOT EXISTS ( SELECT key FROM blocks WHERE key = $1)` -} - -func (Queries) Query() string { - return `SELECT key, data FROM blocks` -} - -func (Queries) Prefix() string { - return ` WHERE key LIKE '%s%%' ORDER BY key` -} - -func (Queries) Limit() string { - return ` LIMIT %d` -} - -func (Queries) Offset() string { - return ` OFFSET %d` -} - -func (Queries) GetSize() string { - return `SELECT octet_length(data) FROM blocks WHERE key = $1` -} - -// Create returns a datastore connected to postgres -func (opts *Options) Create() (*sqlds.Datastore, error) { - opts.setDefaults() - fmtstr := "postgresql:///%s?host=%s&port=%s&user=%s&password=%s&sslmode=disable" - constr := fmt.Sprintf(fmtstr, opts.Database, opts.Host, opts.Port, opts.User, opts.Password) - db, err := sql.Open("postgres", constr) - if err != nil { - return nil, err - } - - return sqlds.NewDatastore(db, Queries{}), nil -} - -func (opts *Options) setDefaults() { - if opts.Host == "" { - opts.Host = "127.0.0.1" - } - - if opts.Port == "" { - opts.Port = "5432" - } - - if opts.User == "" { - opts.User = "postgres" - } - - if opts.Database == "" { - opts.Database = "datastore" - } -} diff --git a/vendor/github.com/whyrusleeping/timecache/LICENSE b/vendor/github.com/whyrusleeping/timecache/LICENSE deleted file mode 100644 index 26100332..00000000 --- a/vendor/github.com/whyrusleeping/timecache/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Jeromy Johnson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/whyrusleeping/timecache/README.md b/vendor/github.com/whyrusleeping/timecache/README.md deleted file mode 100644 index edbadd2f..00000000 --- a/vendor/github.com/whyrusleeping/timecache/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# timecache - -Timecache is an lru cache that keeps entries for up to a specified time -duration. After a specified period of time has elapsed, 'old' entries will be -purged from the set. - -## License -MIT diff --git a/vendor/github.com/whyrusleeping/timecache/package.json b/vendor/github.com/whyrusleeping/timecache/package.json deleted file mode 100644 index 80d642f6..00000000 --- a/vendor/github.com/whyrusleeping/timecache/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "author": "whyrusleeping", - "bugs": { - "url": "https://github.com/whyrusleeping/timecache" - }, - "gx": { - "dvcsimport": "github.com/whyrusleeping/timecache" - }, - "gxVersion": "0.9.0", - "language": "go", - "license": "", - "name": "timecache", - "version": "1.0.0" -} diff --git a/vendor/github.com/whyrusleeping/timecache/timecache.go b/vendor/github.com/whyrusleeping/timecache/timecache.go deleted file mode 100644 index 94975585..00000000 --- a/vendor/github.com/whyrusleeping/timecache/timecache.go +++ /dev/null @@ -1,60 +0,0 @@ -package timecache - -import ( - "container/list" - "time" -) - -type TimeCache struct { - Q *list.List - M map[string]time.Time - - span time.Duration -} - -func NewTimeCache(span time.Duration) *TimeCache { - return &TimeCache{ - Q: list.New(), - M: make(map[string]time.Time), - span: span, - } -} - -func (tc *TimeCache) Add(s string) { - _, ok := tc.M[s] - if ok { - panic("putting the same entry twice not supported") - } - - tc.sweep() - - tc.M[s] = time.Now() - tc.Q.PushFront(s) -} - -func (tc *TimeCache) sweep() { - for { - back := tc.Q.Back() - if back == nil { - return - } - - v := back.Value.(string) - t, ok := tc.M[v] - if !ok { - panic("inconsistent cache state") - } - - if time.Since(t) > tc.span { - tc.Q.Remove(back) - delete(tc.M, v) - } else { - return - } - } -} - -func (tc *TimeCache) Has(s string) bool { - _, ok := tc.M[s] - return ok -} diff --git a/vendor/go.opencensus.io/AUTHORS b/vendor/go.opencensus.io/AUTHORS deleted file mode 100644 index e491a9e7..00000000 --- a/vendor/go.opencensus.io/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Google Inc. diff --git a/vendor/go.opencensus.io/LICENSE b/vendor/go.opencensus.io/LICENSE deleted file mode 100644 index 7a4a3ea2..00000000 --- a/vendor/go.opencensus.io/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/vendor/go.opencensus.io/internal/tagencoding/tagencoding.go b/vendor/go.opencensus.io/internal/tagencoding/tagencoding.go deleted file mode 100644 index 41b2c3fc..00000000 --- a/vendor/go.opencensus.io/internal/tagencoding/tagencoding.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Package tagencoding contains the tag encoding -// used interally by the stats collector. -package tagencoding // import "go.opencensus.io/internal/tagencoding" - -// Values represent the encoded buffer for the values. -type Values struct { - Buffer []byte - WriteIndex int - ReadIndex int -} - -func (vb *Values) growIfRequired(expected int) { - if len(vb.Buffer)-vb.WriteIndex < expected { - tmp := make([]byte, 2*(len(vb.Buffer)+1)+expected) - copy(tmp, vb.Buffer) - vb.Buffer = tmp - } -} - -// WriteValue is the helper method to encode Values from map[Key][]byte. -func (vb *Values) WriteValue(v []byte) { - length := len(v) & 0xff - vb.growIfRequired(1 + length) - - // writing length of v - vb.Buffer[vb.WriteIndex] = byte(length) - vb.WriteIndex++ - - if length == 0 { - // No value was encoded for this key - return - } - - // writing v - copy(vb.Buffer[vb.WriteIndex:], v[:length]) - vb.WriteIndex += length -} - -// ReadValue is the helper method to decode Values to a map[Key][]byte. -func (vb *Values) ReadValue() []byte { - // read length of v - length := int(vb.Buffer[vb.ReadIndex]) - vb.ReadIndex++ - if length == 0 { - // No value was encoded for this key - return nil - } - - // read value of v - v := make([]byte, length) - endIdx := vb.ReadIndex + length - copy(v, vb.Buffer[vb.ReadIndex:endIdx]) - vb.ReadIndex = endIdx - return v -} - -// Bytes returns a reference to already written bytes in the Buffer. -func (vb *Values) Bytes() []byte { - return vb.Buffer[:vb.WriteIndex] -} diff --git a/vendor/go.opencensus.io/metric/metricdata/doc.go b/vendor/go.opencensus.io/metric/metricdata/doc.go deleted file mode 100644 index 52a7b3bf..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package metricdata contains the metrics data model. -// -// This is an EXPERIMENTAL package, and may change in arbitrary ways without -// notice. -package metricdata // import "go.opencensus.io/metric/metricdata" diff --git a/vendor/go.opencensus.io/metric/metricdata/exemplar.go b/vendor/go.opencensus.io/metric/metricdata/exemplar.go deleted file mode 100644 index 12695ce2..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/exemplar.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricdata - -import ( - "time" -) - -// Exemplars keys. -const ( - AttachmentKeySpanContext = "SpanContext" -) - -// Exemplar is an example data point associated with each bucket of a -// distribution type aggregation. -// -// Their purpose is to provide an example of the kind of thing -// (request, RPC, trace span, etc.) that resulted in that measurement. -type Exemplar struct { - Value float64 // the value that was recorded - Timestamp time.Time // the time the value was recorded - Attachments Attachments // attachments (if any) -} - -// Attachments is a map of extra values associated with a recorded data point. -type Attachments map[string]interface{} diff --git a/vendor/go.opencensus.io/metric/metricdata/label.go b/vendor/go.opencensus.io/metric/metricdata/label.go deleted file mode 100644 index aadae41e..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/label.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricdata - -// LabelKey represents key of a label. It has optional -// description attribute. -type LabelKey struct { - Key string - Description string -} - -// LabelValue represents the value of a label. -// The zero value represents a missing label value, which may be treated -// differently to an empty string value by some back ends. -type LabelValue struct { - Value string // string value of the label - Present bool // flag that indicated whether a value is present or not -} - -// NewLabelValue creates a new non-nil LabelValue that represents the given string. -func NewLabelValue(val string) LabelValue { - return LabelValue{Value: val, Present: true} -} diff --git a/vendor/go.opencensus.io/metric/metricdata/metric.go b/vendor/go.opencensus.io/metric/metricdata/metric.go deleted file mode 100644 index 8293712c..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/metric.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricdata - -import ( - "time" - - "go.opencensus.io/resource" -) - -// Descriptor holds metadata about a metric. -type Descriptor struct { - Name string // full name of the metric - Description string // human-readable description - Unit Unit // units for the measure - Type Type // type of measure - LabelKeys []LabelKey // label keys -} - -// Metric represents a quantity measured against a resource with different -// label value combinations. -type Metric struct { - Descriptor Descriptor // metric descriptor - Resource *resource.Resource // resource against which this was measured - TimeSeries []*TimeSeries // one time series for each combination of label values -} - -// TimeSeries is a sequence of points associated with a combination of label -// values. -type TimeSeries struct { - LabelValues []LabelValue // label values, same order as keys in the metric descriptor - Points []Point // points sequence - StartTime time.Time // time we started recording this time series -} diff --git a/vendor/go.opencensus.io/metric/metricdata/point.go b/vendor/go.opencensus.io/metric/metricdata/point.go deleted file mode 100644 index 7fe057b1..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/point.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricdata - -import ( - "time" -) - -// Point is a single data point of a time series. -type Point struct { - // Time is the point in time that this point represents in a time series. - Time time.Time - // Value is the value of this point. Prefer using ReadValue to switching on - // the value type, since new value types might be added. - Value interface{} -} - -//go:generate stringer -type ValueType - -// NewFloat64Point creates a new Point holding a float64 value. -func NewFloat64Point(t time.Time, val float64) Point { - return Point{ - Value: val, - Time: t, - } -} - -// NewInt64Point creates a new Point holding an int64 value. -func NewInt64Point(t time.Time, val int64) Point { - return Point{ - Value: val, - Time: t, - } -} - -// NewDistributionPoint creates a new Point holding a Distribution value. -func NewDistributionPoint(t time.Time, val *Distribution) Point { - return Point{ - Value: val, - Time: t, - } -} - -// NewSummaryPoint creates a new Point holding a Summary value. -func NewSummaryPoint(t time.Time, val *Summary) Point { - return Point{ - Value: val, - Time: t, - } -} - -// ValueVisitor allows reading the value of a point. -type ValueVisitor interface { - VisitFloat64Value(float64) - VisitInt64Value(int64) - VisitDistributionValue(*Distribution) - VisitSummaryValue(*Summary) -} - -// ReadValue accepts a ValueVisitor and calls the appropriate method with the -// value of this point. -// Consumers of Point should use this in preference to switching on the type -// of the value directly, since new value types may be added. -func (p Point) ReadValue(vv ValueVisitor) { - switch v := p.Value.(type) { - case int64: - vv.VisitInt64Value(v) - case float64: - vv.VisitFloat64Value(v) - case *Distribution: - vv.VisitDistributionValue(v) - case *Summary: - vv.VisitSummaryValue(v) - default: - panic("unexpected value type") - } -} - -// Distribution contains summary statistics for a population of values. It -// optionally contains a histogram representing the distribution of those -// values across a set of buckets. -type Distribution struct { - // Count is the number of values in the population. Must be non-negative. This value - // must equal the sum of the values in bucket_counts if a histogram is - // provided. - Count int64 - // Sum is the sum of the values in the population. If count is zero then this field - // must be zero. - Sum float64 - // SumOfSquaredDeviation is the sum of squared deviations from the mean of the values in the - // population. For values x_i this is: - // - // Sum[i=1..n]((x_i - mean)^2) - // - // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition - // describes Welford's method for accumulating this sum in one pass. - // - // If count is zero then this field must be zero. - SumOfSquaredDeviation float64 - // BucketOptions describes the bounds of the histogram buckets in this - // distribution. - // - // A Distribution may optionally contain a histogram of the values in the - // population. - // - // If nil, there is no associated histogram. - BucketOptions *BucketOptions - // Bucket If the distribution does not have a histogram, then omit this field. - // If there is a histogram, then the sum of the values in the Bucket counts - // must equal the value in the count field of the distribution. - Buckets []Bucket -} - -// BucketOptions describes the bounds of the histogram buckets in this -// distribution. -type BucketOptions struct { - // Bounds specifies a set of bucket upper bounds. - // This defines len(bounds) + 1 (= N) buckets. The boundaries for bucket - // index i are: - // - // [0, Bounds[i]) for i == 0 - // [Bounds[i-1], Bounds[i]) for 0 < i < N-1 - // [Bounds[i-1], +infinity) for i == N-1 - Bounds []float64 -} - -// Bucket represents a single bucket (value range) in a distribution. -type Bucket struct { - // Count is the number of values in each bucket of the histogram, as described in - // bucket_bounds. - Count int64 - // Exemplar associated with this bucket (if any). - Exemplar *Exemplar -} - -// Summary is a representation of percentiles. -type Summary struct { - // Count is the cumulative count (if available). - Count int64 - // Sum is the cumulative sum of values (if available). - Sum float64 - // HasCountAndSum is true if Count and Sum are available. - HasCountAndSum bool - // Snapshot represents percentiles calculated over an arbitrary time window. - // The values in this struct can be reset at arbitrary unknown times, with - // the requirement that all of them are reset at the same time. - Snapshot Snapshot -} - -// Snapshot represents percentiles over an arbitrary time. -// The values in this struct can be reset at arbitrary unknown times, with -// the requirement that all of them are reset at the same time. -type Snapshot struct { - // Count is the number of values in the snapshot. Optional since some systems don't - // expose this. Set to 0 if not available. - Count int64 - // Sum is the sum of values in the snapshot. Optional since some systems don't - // expose this. If count is 0 then this field must be zero. - Sum float64 - // Percentiles is a map from percentile (range (0-100.0]) to the value of - // the percentile. - Percentiles map[float64]float64 -} - -//go:generate stringer -type Type - -// Type is the overall type of metric, including its value type and whether it -// represents a cumulative total (since the start time) or if it represents a -// gauge value. -type Type int - -// Metric types. -const ( - TypeGaugeInt64 Type = iota - TypeGaugeFloat64 - TypeGaugeDistribution - TypeCumulativeInt64 - TypeCumulativeFloat64 - TypeCumulativeDistribution - TypeSummary -) diff --git a/vendor/go.opencensus.io/metric/metricdata/type_string.go b/vendor/go.opencensus.io/metric/metricdata/type_string.go deleted file mode 100644 index c3f8ec27..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/type_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by "stringer -type Type"; DO NOT EDIT. - -package metricdata - -import "strconv" - -const _Type_name = "TypeGaugeInt64TypeGaugeFloat64TypeGaugeDistributionTypeCumulativeInt64TypeCumulativeFloat64TypeCumulativeDistributionTypeSummary" - -var _Type_index = [...]uint8{0, 14, 30, 51, 70, 91, 117, 128} - -func (i Type) String() string { - if i < 0 || i >= Type(len(_Type_index)-1) { - return "Type(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Type_name[_Type_index[i]:_Type_index[i+1]] -} diff --git a/vendor/go.opencensus.io/metric/metricdata/unit.go b/vendor/go.opencensus.io/metric/metricdata/unit.go deleted file mode 100644 index b483a137..00000000 --- a/vendor/go.opencensus.io/metric/metricdata/unit.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricdata - -// Unit is a string encoded according to the case-sensitive abbreviations from the -// Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html -type Unit string - -// Predefined units. To record against a unit not represented here, create your -// own Unit type constant from a string. -const ( - UnitDimensionless Unit = "1" - UnitBytes Unit = "By" - UnitMilliseconds Unit = "ms" -) diff --git a/vendor/go.opencensus.io/metric/metricproducer/manager.go b/vendor/go.opencensus.io/metric/metricproducer/manager.go deleted file mode 100644 index ca1f3904..00000000 --- a/vendor/go.opencensus.io/metric/metricproducer/manager.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricproducer - -import ( - "sync" -) - -// Manager maintains a list of active producers. Producers can register -// with the manager to allow readers to read all metrics provided by them. -// Readers can retrieve all producers registered with the manager, -// read metrics from the producers and export them. -type Manager struct { - mu sync.RWMutex - producers map[Producer]struct{} -} - -var prodMgr *Manager -var once sync.Once - -// GlobalManager is a single instance of producer manager -// that is used by all producers and all readers. -func GlobalManager() *Manager { - once.Do(func() { - prodMgr = &Manager{} - prodMgr.producers = make(map[Producer]struct{}) - }) - return prodMgr -} - -// AddProducer adds the producer to the Manager if it is not already present. -func (pm *Manager) AddProducer(producer Producer) { - if producer == nil { - return - } - pm.mu.Lock() - defer pm.mu.Unlock() - pm.producers[producer] = struct{}{} -} - -// DeleteProducer deletes the producer from the Manager if it is present. -func (pm *Manager) DeleteProducer(producer Producer) { - if producer == nil { - return - } - pm.mu.Lock() - defer pm.mu.Unlock() - delete(pm.producers, producer) -} - -// GetAll returns a slice of all producer currently registered with -// the Manager. For each call it generates a new slice. The slice -// should not be cached as registration may change at any time. It is -// typically called periodically by exporter to read metrics from -// the producers. -func (pm *Manager) GetAll() []Producer { - pm.mu.Lock() - defer pm.mu.Unlock() - producers := make([]Producer, len(pm.producers)) - i := 0 - for producer := range pm.producers { - producers[i] = producer - i++ - } - return producers -} diff --git a/vendor/go.opencensus.io/metric/metricproducer/producer.go b/vendor/go.opencensus.io/metric/metricproducer/producer.go deleted file mode 100644 index 6cee9ed1..00000000 --- a/vendor/go.opencensus.io/metric/metricproducer/producer.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2019, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metricproducer - -import ( - "go.opencensus.io/metric/metricdata" -) - -// Producer is a source of metrics. -type Producer interface { - // Read should return the current values of all metrics supported by this - // metric provider. - // The returned metrics should be unique for each combination of name and - // resource. - Read() []*metricdata.Metric -} diff --git a/vendor/go.opencensus.io/resource/resource.go b/vendor/go.opencensus.io/resource/resource.go deleted file mode 100644 index b1764e1d..00000000 --- a/vendor/go.opencensus.io/resource/resource.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package resource provides functionality for resource, which capture -// identifying information about the entities for which signals are exported. -package resource - -import ( - "context" - "fmt" - "os" - "regexp" - "sort" - "strconv" - "strings" -) - -// Environment variables used by FromEnv to decode a resource. -const ( - EnvVarType = "OC_RESOURCE_TYPE" - EnvVarLabels = "OC_RESOURCE_LABELS" -) - -// Resource describes an entity about which identifying information and metadata is exposed. -// For example, a type "k8s.io/container" may hold labels describing the pod name and namespace. -type Resource struct { - Type string - Labels map[string]string -} - -// EncodeLabels encodes a labels map to a string as provided via the OC_RESOURCE_LABELS environment variable. -func EncodeLabels(labels map[string]string) string { - sortedKeys := make([]string, 0, len(labels)) - for k := range labels { - sortedKeys = append(sortedKeys, k) - } - sort.Strings(sortedKeys) - - s := "" - for i, k := range sortedKeys { - if i > 0 { - s += "," - } - s += k + "=" + strconv.Quote(labels[k]) - } - return s -} - -var labelRegex = regexp.MustCompile(`^\s*([[:ascii:]]{1,256}?)=("[[:ascii:]]{0,256}?")\s*,`) - -// DecodeLabels decodes a serialized label map as used in the OC_RESOURCE_LABELS variable. -// A list of labels of the form `="",="",...` is accepted. -// Domain names and paths are accepted as label keys. -// Most users will want to use FromEnv instead. -func DecodeLabels(s string) (map[string]string, error) { - m := map[string]string{} - // Ensure a trailing comma, which allows us to keep the regex simpler - s = strings.TrimRight(strings.TrimSpace(s), ",") + "," - - for len(s) > 0 { - match := labelRegex.FindStringSubmatch(s) - if len(match) == 0 { - return nil, fmt.Errorf("invalid label formatting, remainder: %s", s) - } - v := match[2] - if v == "" { - v = match[3] - } else { - var err error - if v, err = strconv.Unquote(v); err != nil { - return nil, fmt.Errorf("invalid label formatting, remainder: %s, err: %s", s, err) - } - } - m[match[1]] = v - - s = s[len(match[0]):] - } - return m, nil -} - -// FromEnv is a detector that loads resource information from the OC_RESOURCE_TYPE -// and OC_RESOURCE_labelS environment variables. -func FromEnv(context.Context) (*Resource, error) { - res := &Resource{ - Type: strings.TrimSpace(os.Getenv(EnvVarType)), - } - labels := strings.TrimSpace(os.Getenv(EnvVarLabels)) - if labels == "" { - return res, nil - } - var err error - if res.Labels, err = DecodeLabels(labels); err != nil { - return nil, err - } - return res, nil -} - -var _ Detector = FromEnv - -// merge resource information from b into a. In case of a collision, a takes precedence. -func merge(a, b *Resource) *Resource { - if a == nil { - return b - } - if b == nil { - return a - } - res := &Resource{ - Type: a.Type, - Labels: map[string]string{}, - } - if res.Type == "" { - res.Type = b.Type - } - for k, v := range b.Labels { - res.Labels[k] = v - } - // Labels from resource a overwrite labels from resource b. - for k, v := range a.Labels { - res.Labels[k] = v - } - return res -} - -// Detector attempts to detect resource information. -// If the detector cannot find resource information, the returned resource is nil but no -// error is returned. -// An error is only returned on unexpected failures. -type Detector func(context.Context) (*Resource, error) - -// MultiDetector returns a Detector that calls all input detectors in order and -// merges each result with the previous one. In case a type of label key is already set, -// the first set value is takes precedence. -// It returns on the first error that a sub-detector encounters. -func MultiDetector(detectors ...Detector) Detector { - return func(ctx context.Context) (*Resource, error) { - return detectAll(ctx, detectors...) - } -} - -// detectall calls all input detectors sequentially an merges each result with the previous one. -// It returns on the first error that a sub-detector encounters. -func detectAll(ctx context.Context, detectors ...Detector) (*Resource, error) { - var res *Resource - for _, d := range detectors { - r, err := d(ctx) - if err != nil { - return nil, err - } - res = merge(res, r) - } - return res, nil -} diff --git a/vendor/go.opencensus.io/stats/doc.go b/vendor/go.opencensus.io/stats/doc.go deleted file mode 100644 index 00d473ee..00000000 --- a/vendor/go.opencensus.io/stats/doc.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/* -Package stats contains support for OpenCensus stats recording. - -OpenCensus allows users to create typed measures, record measurements, -aggregate the collected data, and export the aggregated data. - -Measures - -A measure represents a type of data point to be tracked and recorded. -For example, latency, request Mb/s, and response Mb/s are measures -to collect from a server. - -Measure constructors such as Int64 and Float64 automatically -register the measure by the given name. Each registered measure needs -to be unique by name. Measures also have a description and a unit. - -Libraries can define and export measures. Application authors can then -create views and collect and break down measures by the tags they are -interested in. - -Recording measurements - -Measurement is a data point to be collected for a measure. For example, -for a latency (ms) measure, 100 is a measurement that represents a 100ms -latency event. Measurements are created from measures with -the current context. Tags from the current context are recorded with the -measurements if they are any. - -Recorded measurements are dropped immediately if no views are registered for them. -There is usually no need to conditionally enable and disable -recording to reduce cost. Recording of measurements is cheap. - -Libraries can always record measurements, and applications can later decide -on which measurements they want to collect by registering views. This allows -libraries to turn on the instrumentation by default. - -Exemplars - -For a given recorded measurement, the associated exemplar is a diagnostic map -that gives more information about the measurement. - -When aggregated using a Distribution aggregation, an exemplar is kept for each -bucket in the Distribution. This allows you to easily find an example of a -measurement that fell into each bucket. - -For example, if you also use the OpenCensus trace package and you -record a measurement with a context that contains a sampled trace span, -then the trace span will be added to the exemplar associated with the measurement. - -When exported to a supporting back end, you should be able to easily navigate -to example traces that fell into each bucket in the Distribution. - -*/ -package stats // import "go.opencensus.io/stats" diff --git a/vendor/go.opencensus.io/stats/internal/record.go b/vendor/go.opencensus.io/stats/internal/record.go deleted file mode 100644 index 36935e62..00000000 --- a/vendor/go.opencensus.io/stats/internal/record.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "go.opencensus.io/tag" -) - -// DefaultRecorder will be called for each Record call. -var DefaultRecorder func(tags *tag.Map, measurement interface{}, attachments map[string]interface{}) - -// SubscriptionReporter reports when a view subscribed with a measure. -var SubscriptionReporter func(measure string) diff --git a/vendor/go.opencensus.io/stats/measure.go b/vendor/go.opencensus.io/stats/measure.go deleted file mode 100644 index 1ffd3cef..00000000 --- a/vendor/go.opencensus.io/stats/measure.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -import ( - "sync" - "sync/atomic" -) - -// Measure represents a single numeric value to be tracked and recorded. -// For example, latency, request bytes, and response bytes could be measures -// to collect from a server. -// -// Measures by themselves have no outside effects. In order to be exported, -// the measure needs to be used in a View. If no Views are defined over a -// measure, there is very little cost in recording it. -type Measure interface { - // Name returns the name of this measure. - // - // Measure names are globally unique (among all libraries linked into your program). - // We recommend prefixing the measure name with a domain name relevant to your - // project or application. - // - // Measure names are never sent over the wire or exported to backends. - // They are only used to create Views. - Name() string - - // Description returns the human-readable description of this measure. - Description() string - - // Unit returns the units for the values this measure takes on. - // - // Units are encoded according to the case-sensitive abbreviations from the - // Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html - Unit() string -} - -// measureDescriptor is the untyped descriptor associated with each measure. -// Int64Measure and Float64Measure wrap measureDescriptor to provide typed -// recording APIs. -// Two Measures with the same name will have the same measureDescriptor. -type measureDescriptor struct { - subs int32 // access atomically - - name string - description string - unit string -} - -func (m *measureDescriptor) subscribe() { - atomic.StoreInt32(&m.subs, 1) -} - -func (m *measureDescriptor) subscribed() bool { - return atomic.LoadInt32(&m.subs) == 1 -} - -var ( - mu sync.RWMutex - measures = make(map[string]*measureDescriptor) -) - -func registerMeasureHandle(name, desc, unit string) *measureDescriptor { - mu.Lock() - defer mu.Unlock() - - if stored, ok := measures[name]; ok { - return stored - } - m := &measureDescriptor{ - name: name, - description: desc, - unit: unit, - } - measures[name] = m - return m -} - -// Measurement is the numeric value measured when recording stats. Each measure -// provides methods to create measurements of their kind. For example, Int64Measure -// provides M to convert an int64 into a measurement. -type Measurement struct { - v float64 - m Measure - desc *measureDescriptor -} - -// Value returns the value of the Measurement as a float64. -func (m Measurement) Value() float64 { - return m.v -} - -// Measure returns the Measure from which this Measurement was created. -func (m Measurement) Measure() Measure { - return m.m -} diff --git a/vendor/go.opencensus.io/stats/measure_float64.go b/vendor/go.opencensus.io/stats/measure_float64.go deleted file mode 100644 index f02c1eda..00000000 --- a/vendor/go.opencensus.io/stats/measure_float64.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// Float64Measure is a measure for float64 values. -type Float64Measure struct { - desc *measureDescriptor -} - -// M creates a new float64 measurement. -// Use Record to record measurements. -func (m *Float64Measure) M(v float64) Measurement { - return Measurement{ - m: m, - desc: m.desc, - v: v, - } -} - -// Float64 creates a new measure for float64 values. -// -// See the documentation for interface Measure for more guidance on the -// parameters of this function. -func Float64(name, description, unit string) *Float64Measure { - mi := registerMeasureHandle(name, description, unit) - return &Float64Measure{mi} -} - -// Name returns the name of the measure. -func (m *Float64Measure) Name() string { - return m.desc.name -} - -// Description returns the description of the measure. -func (m *Float64Measure) Description() string { - return m.desc.description -} - -// Unit returns the unit of the measure. -func (m *Float64Measure) Unit() string { - return m.desc.unit -} diff --git a/vendor/go.opencensus.io/stats/measure_int64.go b/vendor/go.opencensus.io/stats/measure_int64.go deleted file mode 100644 index d101d797..00000000 --- a/vendor/go.opencensus.io/stats/measure_int64.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// Int64Measure is a measure for int64 values. -type Int64Measure struct { - desc *measureDescriptor -} - -// M creates a new int64 measurement. -// Use Record to record measurements. -func (m *Int64Measure) M(v int64) Measurement { - return Measurement{ - m: m, - desc: m.desc, - v: float64(v), - } -} - -// Int64 creates a new measure for int64 values. -// -// See the documentation for interface Measure for more guidance on the -// parameters of this function. -func Int64(name, description, unit string) *Int64Measure { - mi := registerMeasureHandle(name, description, unit) - return &Int64Measure{mi} -} - -// Name returns the name of the measure. -func (m *Int64Measure) Name() string { - return m.desc.name -} - -// Description returns the description of the measure. -func (m *Int64Measure) Description() string { - return m.desc.description -} - -// Unit returns the unit of the measure. -func (m *Int64Measure) Unit() string { - return m.desc.unit -} diff --git a/vendor/go.opencensus.io/stats/record.go b/vendor/go.opencensus.io/stats/record.go deleted file mode 100644 index ad469118..00000000 --- a/vendor/go.opencensus.io/stats/record.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -import ( - "context" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/stats/internal" - "go.opencensus.io/tag" -) - -func init() { - internal.SubscriptionReporter = func(measure string) { - mu.Lock() - measures[measure].subscribe() - mu.Unlock() - } -} - -type recordOptions struct { - attachments metricdata.Attachments - mutators []tag.Mutator - measurements []Measurement -} - -// WithAttachments applies provided exemplar attachments. -func WithAttachments(attachments metricdata.Attachments) Options { - return func(ro *recordOptions) { - ro.attachments = attachments - } -} - -// WithTags applies provided tag mutators. -func WithTags(mutators ...tag.Mutator) Options { - return func(ro *recordOptions) { - ro.mutators = mutators - } -} - -// WithMeasurements applies provided measurements. -func WithMeasurements(measurements ...Measurement) Options { - return func(ro *recordOptions) { - ro.measurements = measurements - } -} - -// Options apply changes to recordOptions. -type Options func(*recordOptions) - -func createRecordOption(ros ...Options) *recordOptions { - o := &recordOptions{} - for _, ro := range ros { - ro(o) - } - return o -} - -// Record records one or multiple measurements with the same context at once. -// If there are any tags in the context, measurements will be tagged with them. -func Record(ctx context.Context, ms ...Measurement) { - RecordWithOptions(ctx, WithMeasurements(ms...)) -} - -// RecordWithTags records one or multiple measurements at once. -// -// Measurements will be tagged with the tags in the context mutated by the mutators. -// RecordWithTags is useful if you want to record with tag mutations but don't want -// to propagate the mutations in the context. -func RecordWithTags(ctx context.Context, mutators []tag.Mutator, ms ...Measurement) error { - return RecordWithOptions(ctx, WithTags(mutators...), WithMeasurements(ms...)) -} - -// RecordWithOptions records measurements from the given options (if any) against context -// and tags and attachments in the options (if any). -// If there are any tags in the context, measurements will be tagged with them. -func RecordWithOptions(ctx context.Context, ros ...Options) error { - o := createRecordOption(ros...) - if len(o.measurements) == 0 { - return nil - } - recorder := internal.DefaultRecorder - if recorder == nil { - return nil - } - record := false - for _, m := range o.measurements { - if m.desc.subscribed() { - record = true - break - } - } - if !record { - return nil - } - if len(o.mutators) > 0 { - var err error - if ctx, err = tag.New(ctx, o.mutators...); err != nil { - return err - } - } - recorder(tag.FromContext(ctx), o.measurements, o.attachments) - return nil -} diff --git a/vendor/go.opencensus.io/stats/units.go b/vendor/go.opencensus.io/stats/units.go deleted file mode 100644 index 6931a5f2..00000000 --- a/vendor/go.opencensus.io/stats/units.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package stats - -// Units are encoded according to the case-sensitive abbreviations from the -// Unified Code for Units of Measure: http://unitsofmeasure.org/ucum.html -const ( - UnitNone = "1" // Deprecated: Use UnitDimensionless. - UnitDimensionless = "1" - UnitBytes = "By" - UnitMilliseconds = "ms" -) diff --git a/vendor/go.opencensus.io/stats/view/aggregation.go b/vendor/go.opencensus.io/stats/view/aggregation.go deleted file mode 100644 index b7f169b4..00000000 --- a/vendor/go.opencensus.io/stats/view/aggregation.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -// AggType represents the type of aggregation function used on a View. -type AggType int - -// All available aggregation types. -const ( - AggTypeNone AggType = iota // no aggregation; reserved for future use. - AggTypeCount // the count aggregation, see Count. - AggTypeSum // the sum aggregation, see Sum. - AggTypeDistribution // the distribution aggregation, see Distribution. - AggTypeLastValue // the last value aggregation, see LastValue. -) - -func (t AggType) String() string { - return aggTypeName[t] -} - -var aggTypeName = map[AggType]string{ - AggTypeNone: "None", - AggTypeCount: "Count", - AggTypeSum: "Sum", - AggTypeDistribution: "Distribution", - AggTypeLastValue: "LastValue", -} - -// Aggregation represents a data aggregation method. Use one of the functions: -// Count, Sum, or Distribution to construct an Aggregation. -type Aggregation struct { - Type AggType // Type is the AggType of this Aggregation. - Buckets []float64 // Buckets are the bucket endpoints if this Aggregation represents a distribution, see Distribution. - - newData func() AggregationData -} - -var ( - aggCount = &Aggregation{ - Type: AggTypeCount, - newData: func() AggregationData { - return &CountData{} - }, - } - aggSum = &Aggregation{ - Type: AggTypeSum, - newData: func() AggregationData { - return &SumData{} - }, - } -) - -// Count indicates that data collected and aggregated -// with this method will be turned into a count value. -// For example, total number of accepted requests can be -// aggregated by using Count. -func Count() *Aggregation { - return aggCount -} - -// Sum indicates that data collected and aggregated -// with this method will be summed up. -// For example, accumulated request bytes can be aggregated by using -// Sum. -func Sum() *Aggregation { - return aggSum -} - -// Distribution indicates that the desired aggregation is -// a histogram distribution. -// -// An distribution aggregation may contain a histogram of the values in the -// population. The bucket boundaries for that histogram are described -// by the bounds. This defines len(bounds)+1 buckets. -// -// If len(bounds) >= 2 then the boundaries for bucket index i are: -// -// [-infinity, bounds[i]) for i = 0 -// [bounds[i-1], bounds[i]) for 0 < i < length -// [bounds[i-1], +infinity) for i = length -// -// If len(bounds) is 0 then there is no histogram associated with the -// distribution. There will be a single bucket with boundaries -// (-infinity, +infinity). -// -// If len(bounds) is 1 then there is no finite buckets, and that single -// element is the common boundary of the overflow and underflow buckets. -func Distribution(bounds ...float64) *Aggregation { - return &Aggregation{ - Type: AggTypeDistribution, - Buckets: bounds, - newData: func() AggregationData { - return newDistributionData(bounds) - }, - } -} - -// LastValue only reports the last value recorded using this -// aggregation. All other measurements will be dropped. -func LastValue() *Aggregation { - return &Aggregation{ - Type: AggTypeLastValue, - newData: func() AggregationData { - return &LastValueData{} - }, - } -} diff --git a/vendor/go.opencensus.io/stats/view/aggregation_data.go b/vendor/go.opencensus.io/stats/view/aggregation_data.go deleted file mode 100644 index d500e67f..00000000 --- a/vendor/go.opencensus.io/stats/view/aggregation_data.go +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "math" - "time" - - "go.opencensus.io/metric/metricdata" -) - -// AggregationData represents an aggregated value from a collection. -// They are reported on the view data during exporting. -// Mosts users won't directly access aggregration data. -type AggregationData interface { - isAggregationData() bool - addSample(v float64, attachments map[string]interface{}, t time.Time) - clone() AggregationData - equal(other AggregationData) bool - toPoint(t metricdata.Type, time time.Time) metricdata.Point -} - -const epsilon = 1e-9 - -// CountData is the aggregated data for the Count aggregation. -// A count aggregation processes data and counts the recordings. -// -// Most users won't directly access count data. -type CountData struct { - Value int64 -} - -func (a *CountData) isAggregationData() bool { return true } - -func (a *CountData) addSample(_ float64, _ map[string]interface{}, _ time.Time) { - a.Value = a.Value + 1 -} - -func (a *CountData) clone() AggregationData { - return &CountData{Value: a.Value} -} - -func (a *CountData) equal(other AggregationData) bool { - a2, ok := other.(*CountData) - if !ok { - return false - } - - return a.Value == a2.Value -} - -func (a *CountData) toPoint(metricType metricdata.Type, t time.Time) metricdata.Point { - switch metricType { - case metricdata.TypeCumulativeInt64: - return metricdata.NewInt64Point(t, a.Value) - default: - panic("unsupported metricdata.Type") - } -} - -// SumData is the aggregated data for the Sum aggregation. -// A sum aggregation processes data and sums up the recordings. -// -// Most users won't directly access sum data. -type SumData struct { - Value float64 -} - -func (a *SumData) isAggregationData() bool { return true } - -func (a *SumData) addSample(v float64, _ map[string]interface{}, _ time.Time) { - a.Value += v -} - -func (a *SumData) clone() AggregationData { - return &SumData{Value: a.Value} -} - -func (a *SumData) equal(other AggregationData) bool { - a2, ok := other.(*SumData) - if !ok { - return false - } - return math.Pow(a.Value-a2.Value, 2) < epsilon -} - -func (a *SumData) toPoint(metricType metricdata.Type, t time.Time) metricdata.Point { - switch metricType { - case metricdata.TypeCumulativeInt64: - return metricdata.NewInt64Point(t, int64(a.Value)) - case metricdata.TypeCumulativeFloat64: - return metricdata.NewFloat64Point(t, a.Value) - default: - panic("unsupported metricdata.Type") - } -} - -// DistributionData is the aggregated data for the -// Distribution aggregation. -// -// Most users won't directly access distribution data. -// -// For a distribution with N bounds, the associated DistributionData will have -// N+1 buckets. -type DistributionData struct { - Count int64 // number of data points aggregated - Min float64 // minimum value in the distribution - Max float64 // max value in the distribution - Mean float64 // mean of the distribution - SumOfSquaredDev float64 // sum of the squared deviation from the mean - CountPerBucket []int64 // number of occurrences per bucket - // ExemplarsPerBucket is slice the same length as CountPerBucket containing - // an exemplar for the associated bucket, or nil. - ExemplarsPerBucket []*metricdata.Exemplar - bounds []float64 // histogram distribution of the values -} - -func newDistributionData(bounds []float64) *DistributionData { - bucketCount := len(bounds) + 1 - return &DistributionData{ - CountPerBucket: make([]int64, bucketCount), - ExemplarsPerBucket: make([]*metricdata.Exemplar, bucketCount), - bounds: bounds, - Min: math.MaxFloat64, - Max: math.SmallestNonzeroFloat64, - } -} - -// Sum returns the sum of all samples collected. -func (a *DistributionData) Sum() float64 { return a.Mean * float64(a.Count) } - -func (a *DistributionData) variance() float64 { - if a.Count <= 1 { - return 0 - } - return a.SumOfSquaredDev / float64(a.Count-1) -} - -func (a *DistributionData) isAggregationData() bool { return true } - -// TODO(songy23): support exemplar attachments. -func (a *DistributionData) addSample(v float64, attachments map[string]interface{}, t time.Time) { - if v < a.Min { - a.Min = v - } - if v > a.Max { - a.Max = v - } - a.Count++ - a.addToBucket(v, attachments, t) - - if a.Count == 1 { - a.Mean = v - return - } - - oldMean := a.Mean - a.Mean = a.Mean + (v-a.Mean)/float64(a.Count) - a.SumOfSquaredDev = a.SumOfSquaredDev + (v-oldMean)*(v-a.Mean) -} - -func (a *DistributionData) addToBucket(v float64, attachments map[string]interface{}, t time.Time) { - var count *int64 - var i int - var b float64 - for i, b = range a.bounds { - if v < b { - count = &a.CountPerBucket[i] - break - } - } - if count == nil { // Last bucket. - i = len(a.bounds) - count = &a.CountPerBucket[i] - } - *count++ - if exemplar := getExemplar(v, attachments, t); exemplar != nil { - a.ExemplarsPerBucket[i] = exemplar - } -} - -func getExemplar(v float64, attachments map[string]interface{}, t time.Time) *metricdata.Exemplar { - if len(attachments) == 0 { - return nil - } - return &metricdata.Exemplar{ - Value: v, - Timestamp: t, - Attachments: attachments, - } -} - -func (a *DistributionData) clone() AggregationData { - c := *a - c.CountPerBucket = append([]int64(nil), a.CountPerBucket...) - c.ExemplarsPerBucket = append([]*metricdata.Exemplar(nil), a.ExemplarsPerBucket...) - return &c -} - -func (a *DistributionData) equal(other AggregationData) bool { - a2, ok := other.(*DistributionData) - if !ok { - return false - } - if a2 == nil { - return false - } - if len(a.CountPerBucket) != len(a2.CountPerBucket) { - return false - } - for i := range a.CountPerBucket { - if a.CountPerBucket[i] != a2.CountPerBucket[i] { - return false - } - } - return a.Count == a2.Count && a.Min == a2.Min && a.Max == a2.Max && math.Pow(a.Mean-a2.Mean, 2) < epsilon && math.Pow(a.variance()-a2.variance(), 2) < epsilon -} - -func (a *DistributionData) toPoint(metricType metricdata.Type, t time.Time) metricdata.Point { - switch metricType { - case metricdata.TypeCumulativeDistribution: - buckets := []metricdata.Bucket{} - for i := 0; i < len(a.CountPerBucket); i++ { - buckets = append(buckets, metricdata.Bucket{ - Count: a.CountPerBucket[i], - Exemplar: a.ExemplarsPerBucket[i], - }) - } - bucketOptions := &metricdata.BucketOptions{Bounds: a.bounds} - - val := &metricdata.Distribution{ - Count: a.Count, - Sum: a.Sum(), - SumOfSquaredDeviation: a.SumOfSquaredDev, - BucketOptions: bucketOptions, - Buckets: buckets, - } - return metricdata.NewDistributionPoint(t, val) - - default: - // TODO: [rghetia] when we have a use case for TypeGaugeDistribution. - panic("unsupported metricdata.Type") - } -} - -// LastValueData returns the last value recorded for LastValue aggregation. -type LastValueData struct { - Value float64 -} - -func (l *LastValueData) isAggregationData() bool { - return true -} - -func (l *LastValueData) addSample(v float64, _ map[string]interface{}, _ time.Time) { - l.Value = v -} - -func (l *LastValueData) clone() AggregationData { - return &LastValueData{l.Value} -} - -func (l *LastValueData) equal(other AggregationData) bool { - a2, ok := other.(*LastValueData) - if !ok { - return false - } - return l.Value == a2.Value -} - -func (l *LastValueData) toPoint(metricType metricdata.Type, t time.Time) metricdata.Point { - switch metricType { - case metricdata.TypeGaugeInt64: - return metricdata.NewInt64Point(t, int64(l.Value)) - case metricdata.TypeGaugeFloat64: - return metricdata.NewFloat64Point(t, l.Value) - default: - panic("unsupported metricdata.Type") - } -} diff --git a/vendor/go.opencensus.io/stats/view/collector.go b/vendor/go.opencensus.io/stats/view/collector.go deleted file mode 100644 index 8a6a2c0f..00000000 --- a/vendor/go.opencensus.io/stats/view/collector.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "sort" - "time" - - "go.opencensus.io/internal/tagencoding" - "go.opencensus.io/tag" -) - -type collector struct { - // signatures holds the aggregations values for each unique tag signature - // (values for all keys) to its aggregator. - signatures map[string]AggregationData - // Aggregation is the description of the aggregation to perform for this - // view. - a *Aggregation -} - -func (c *collector) addSample(s string, v float64, attachments map[string]interface{}, t time.Time) { - aggregator, ok := c.signatures[s] - if !ok { - aggregator = c.a.newData() - c.signatures[s] = aggregator - } - aggregator.addSample(v, attachments, t) -} - -// collectRows returns a snapshot of the collected Row values. -func (c *collector) collectedRows(keys []tag.Key) []*Row { - rows := make([]*Row, 0, len(c.signatures)) - for sig, aggregator := range c.signatures { - tags := decodeTags([]byte(sig), keys) - row := &Row{Tags: tags, Data: aggregator.clone()} - rows = append(rows, row) - } - return rows -} - -func (c *collector) clearRows() { - c.signatures = make(map[string]AggregationData) -} - -// encodeWithKeys encodes the map by using values -// only associated with the keys provided. -func encodeWithKeys(m *tag.Map, keys []tag.Key) []byte { - vb := &tagencoding.Values{ - Buffer: make([]byte, len(keys)), - } - for _, k := range keys { - v, _ := m.Value(k) - vb.WriteValue([]byte(v)) - } - return vb.Bytes() -} - -// decodeTags decodes tags from the buffer and -// orders them by the keys. -func decodeTags(buf []byte, keys []tag.Key) []tag.Tag { - vb := &tagencoding.Values{Buffer: buf} - var tags []tag.Tag - for _, k := range keys { - v := vb.ReadValue() - if v != nil { - tags = append(tags, tag.Tag{Key: k, Value: string(v)}) - } - } - vb.ReadIndex = 0 - sort.Slice(tags, func(i, j int) bool { return tags[i].Key.Name() < tags[j].Key.Name() }) - return tags -} diff --git a/vendor/go.opencensus.io/stats/view/doc.go b/vendor/go.opencensus.io/stats/view/doc.go deleted file mode 100644 index dced225c..00000000 --- a/vendor/go.opencensus.io/stats/view/doc.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Package view contains support for collecting and exposing aggregates over stats. -// -// In order to collect measurements, views need to be defined and registered. -// A view allows recorded measurements to be filtered and aggregated. -// -// All recorded measurements can be grouped by a list of tags. -// -// OpenCensus provides several aggregation methods: Count, Distribution and Sum. -// -// Count only counts the number of measurement points recorded. -// Distribution provides statistical summary of the aggregated data by counting -// how many recorded measurements fall into each bucket. -// Sum adds up the measurement values. -// LastValue just keeps track of the most recently recorded measurement value. -// All aggregations are cumulative. -// -// Views can be registerd and unregistered at any time during program execution. -// -// Libraries can define views but it is recommended that in most cases registering -// views be left up to applications. -// -// Exporting -// -// Collected and aggregated data can be exported to a metric collection -// backend by registering its exporter. -// -// Multiple exporters can be registered to upload the data to various -// different back ends. -package view // import "go.opencensus.io/stats/view" - -// TODO(acetechnologist): Add a link to the language independent OpenCensus -// spec when it is available. diff --git a/vendor/go.opencensus.io/stats/view/export.go b/vendor/go.opencensus.io/stats/view/export.go deleted file mode 100644 index 7cb59718..00000000 --- a/vendor/go.opencensus.io/stats/view/export.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view - -import "sync" - -var ( - exportersMu sync.RWMutex // guards exporters - exporters = make(map[Exporter]struct{}) -) - -// Exporter exports the collected records as view data. -// -// The ExportView method should return quickly; if an -// Exporter takes a significant amount of time to -// process a Data, that work should be done on another goroutine. -// -// It is safe to assume that ExportView will not be called concurrently from -// multiple goroutines. -// -// The Data should not be modified. -type Exporter interface { - ExportView(viewData *Data) -} - -// RegisterExporter registers an exporter. -// Collected data will be reported via all the -// registered exporters. Once you no longer -// want data to be exported, invoke UnregisterExporter -// with the previously registered exporter. -// -// Binaries can register exporters, libraries shouldn't register exporters. -func RegisterExporter(e Exporter) { - exportersMu.Lock() - defer exportersMu.Unlock() - - exporters[e] = struct{}{} -} - -// UnregisterExporter unregisters an exporter. -func UnregisterExporter(e Exporter) { - exportersMu.Lock() - defer exportersMu.Unlock() - - delete(exporters, e) -} diff --git a/vendor/go.opencensus.io/stats/view/view.go b/vendor/go.opencensus.io/stats/view/view.go deleted file mode 100644 index 37f88e1d..00000000 --- a/vendor/go.opencensus.io/stats/view/view.go +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "bytes" - "errors" - "fmt" - "reflect" - "sort" - "sync/atomic" - "time" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/stats" - "go.opencensus.io/tag" -) - -// View allows users to aggregate the recorded stats.Measurements. -// Views need to be passed to the Register function to be before data will be -// collected and sent to Exporters. -type View struct { - Name string // Name of View. Must be unique. If unset, will default to the name of the Measure. - Description string // Description is a human-readable description for this view. - - // TagKeys are the tag keys describing the grouping of this view. - // A single Row will be produced for each combination of associated tag values. - TagKeys []tag.Key - - // Measure is a stats.Measure to aggregate in this view. - Measure stats.Measure - - // Aggregation is the aggregation function tp apply to the set of Measurements. - Aggregation *Aggregation -} - -// WithName returns a copy of the View with a new name. This is useful for -// renaming views to cope with limitations placed on metric names by various -// backends. -func (v *View) WithName(name string) *View { - vNew := *v - vNew.Name = name - return &vNew -} - -// same compares two views and returns true if they represent the same aggregation. -func (v *View) same(other *View) bool { - if v == other { - return true - } - if v == nil { - return false - } - return reflect.DeepEqual(v.Aggregation, other.Aggregation) && - v.Measure.Name() == other.Measure.Name() -} - -// ErrNegativeBucketBounds error returned if histogram contains negative bounds. -// -// Deprecated: this should not be public. -var ErrNegativeBucketBounds = errors.New("negative bucket bounds not supported") - -// canonicalize canonicalizes v by setting explicit -// defaults for Name and Description and sorting the TagKeys -func (v *View) canonicalize() error { - if v.Measure == nil { - return fmt.Errorf("cannot register view %q: measure not set", v.Name) - } - if v.Aggregation == nil { - return fmt.Errorf("cannot register view %q: aggregation not set", v.Name) - } - if v.Name == "" { - v.Name = v.Measure.Name() - } - if v.Description == "" { - v.Description = v.Measure.Description() - } - if err := checkViewName(v.Name); err != nil { - return err - } - sort.Slice(v.TagKeys, func(i, j int) bool { - return v.TagKeys[i].Name() < v.TagKeys[j].Name() - }) - sort.Float64s(v.Aggregation.Buckets) - for _, b := range v.Aggregation.Buckets { - if b < 0 { - return ErrNegativeBucketBounds - } - } - // drop 0 bucket silently. - v.Aggregation.Buckets = dropZeroBounds(v.Aggregation.Buckets...) - - return nil -} - -func dropZeroBounds(bounds ...float64) []float64 { - for i, bound := range bounds { - if bound > 0 { - return bounds[i:] - } - } - return []float64{} -} - -// viewInternal is the internal representation of a View. -type viewInternal struct { - view *View // view is the canonicalized View definition associated with this view. - subscribed uint32 // 1 if someone is subscribed and data need to be exported, use atomic to access - collector *collector - metricDescriptor *metricdata.Descriptor -} - -func newViewInternal(v *View) (*viewInternal, error) { - return &viewInternal{ - view: v, - collector: &collector{make(map[string]AggregationData), v.Aggregation}, - metricDescriptor: viewToMetricDescriptor(v), - }, nil -} - -func (v *viewInternal) subscribe() { - atomic.StoreUint32(&v.subscribed, 1) -} - -func (v *viewInternal) unsubscribe() { - atomic.StoreUint32(&v.subscribed, 0) -} - -// isSubscribed returns true if the view is exporting -// data by subscription. -func (v *viewInternal) isSubscribed() bool { - return atomic.LoadUint32(&v.subscribed) == 1 -} - -func (v *viewInternal) clearRows() { - v.collector.clearRows() -} - -func (v *viewInternal) collectedRows() []*Row { - return v.collector.collectedRows(v.view.TagKeys) -} - -func (v *viewInternal) addSample(m *tag.Map, val float64, attachments map[string]interface{}, t time.Time) { - if !v.isSubscribed() { - return - } - sig := string(encodeWithKeys(m, v.view.TagKeys)) - v.collector.addSample(sig, val, attachments, t) -} - -// A Data is a set of rows about usage of the single measure associated -// with the given view. Each row is specific to a unique set of tags. -type Data struct { - View *View - Start, End time.Time - Rows []*Row -} - -// Row is the collected value for a specific set of key value pairs a.k.a tags. -type Row struct { - Tags []tag.Tag - Data AggregationData -} - -func (r *Row) String() string { - var buffer bytes.Buffer - buffer.WriteString("{ ") - buffer.WriteString("{ ") - for _, t := range r.Tags { - buffer.WriteString(fmt.Sprintf("{%v %v}", t.Key.Name(), t.Value)) - } - buffer.WriteString(" }") - buffer.WriteString(fmt.Sprintf("%v", r.Data)) - buffer.WriteString(" }") - return buffer.String() -} - -// Equal returns true if both rows are equal. Tags are expected to be ordered -// by the key name. Even both rows have the same tags but the tags appear in -// different orders it will return false. -func (r *Row) Equal(other *Row) bool { - if r == other { - return true - } - return reflect.DeepEqual(r.Tags, other.Tags) && r.Data.equal(other.Data) -} - -const maxNameLength = 255 - -// Returns true if the given string contains only printable characters. -func isPrintable(str string) bool { - for _, r := range str { - if !(r >= ' ' && r <= '~') { - return false - } - } - return true -} - -func checkViewName(name string) error { - if len(name) > maxNameLength { - return fmt.Errorf("view name cannot be larger than %v", maxNameLength) - } - if !isPrintable(name) { - return fmt.Errorf("view name needs to be an ASCII string") - } - return nil -} diff --git a/vendor/go.opencensus.io/stats/view/view_to_metric.go b/vendor/go.opencensus.io/stats/view/view_to_metric.go deleted file mode 100644 index f67b5c46..00000000 --- a/vendor/go.opencensus.io/stats/view/view_to_metric.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2019, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "time" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/stats" -) - -func getUnit(unit string) metricdata.Unit { - switch unit { - case "1": - return metricdata.UnitDimensionless - case "ms": - return metricdata.UnitMilliseconds - case "By": - return metricdata.UnitBytes - } - return metricdata.UnitDimensionless -} - -func getType(v *View) metricdata.Type { - m := v.Measure - agg := v.Aggregation - - switch agg.Type { - case AggTypeSum: - switch m.(type) { - case *stats.Int64Measure: - return metricdata.TypeCumulativeInt64 - case *stats.Float64Measure: - return metricdata.TypeCumulativeFloat64 - default: - panic("unexpected measure type") - } - case AggTypeDistribution: - return metricdata.TypeCumulativeDistribution - case AggTypeLastValue: - switch m.(type) { - case *stats.Int64Measure: - return metricdata.TypeGaugeInt64 - case *stats.Float64Measure: - return metricdata.TypeGaugeFloat64 - default: - panic("unexpected measure type") - } - case AggTypeCount: - switch m.(type) { - case *stats.Int64Measure: - return metricdata.TypeCumulativeInt64 - case *stats.Float64Measure: - return metricdata.TypeCumulativeInt64 - default: - panic("unexpected measure type") - } - default: - panic("unexpected aggregation type") - } -} - -func getLabelKeys(v *View) []metricdata.LabelKey { - labelKeys := []metricdata.LabelKey{} - for _, k := range v.TagKeys { - labelKeys = append(labelKeys, metricdata.LabelKey{Key: k.Name()}) - } - return labelKeys -} - -func viewToMetricDescriptor(v *View) *metricdata.Descriptor { - return &metricdata.Descriptor{ - Name: v.Name, - Description: v.Description, - Unit: getUnit(v.Measure.Unit()), - Type: getType(v), - LabelKeys: getLabelKeys(v), - } -} - -func toLabelValues(row *Row, expectedKeys []metricdata.LabelKey) []metricdata.LabelValue { - labelValues := []metricdata.LabelValue{} - tagMap := make(map[string]string) - for _, tag := range row.Tags { - tagMap[tag.Key.Name()] = tag.Value - } - - for _, key := range expectedKeys { - if val, ok := tagMap[key.Key]; ok { - labelValues = append(labelValues, metricdata.NewLabelValue(val)) - } else { - labelValues = append(labelValues, metricdata.LabelValue{}) - } - } - return labelValues -} - -func rowToTimeseries(v *viewInternal, row *Row, now time.Time, startTime time.Time) *metricdata.TimeSeries { - return &metricdata.TimeSeries{ - Points: []metricdata.Point{row.Data.toPoint(v.metricDescriptor.Type, now)}, - LabelValues: toLabelValues(row, v.metricDescriptor.LabelKeys), - StartTime: startTime, - } -} - -func viewToMetric(v *viewInternal, now time.Time, startTime time.Time) *metricdata.Metric { - if v.metricDescriptor.Type == metricdata.TypeGaugeInt64 || - v.metricDescriptor.Type == metricdata.TypeGaugeFloat64 { - startTime = time.Time{} - } - - rows := v.collectedRows() - if len(rows) == 0 { - return nil - } - - ts := []*metricdata.TimeSeries{} - for _, row := range rows { - ts = append(ts, rowToTimeseries(v, row, now, startTime)) - } - - m := &metricdata.Metric{ - Descriptor: *v.metricDescriptor, - TimeSeries: ts, - } - return m -} diff --git a/vendor/go.opencensus.io/stats/view/worker.go b/vendor/go.opencensus.io/stats/view/worker.go deleted file mode 100644 index 2f3c018a..00000000 --- a/vendor/go.opencensus.io/stats/view/worker.go +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "fmt" - "sync" - "time" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricproducer" - "go.opencensus.io/stats" - "go.opencensus.io/stats/internal" - "go.opencensus.io/tag" -) - -func init() { - defaultWorker = newWorker() - go defaultWorker.start() - internal.DefaultRecorder = record -} - -type measureRef struct { - measure string - views map[*viewInternal]struct{} -} - -type worker struct { - measures map[string]*measureRef - views map[string]*viewInternal - startTimes map[*viewInternal]time.Time - - timer *time.Ticker - c chan command - quit, done chan bool - mu sync.RWMutex -} - -var defaultWorker *worker - -var defaultReportingDuration = 10 * time.Second - -// Find returns a registered view associated with this name. -// If no registered view is found, nil is returned. -func Find(name string) (v *View) { - req := &getViewByNameReq{ - name: name, - c: make(chan *getViewByNameResp), - } - defaultWorker.c <- req - resp := <-req.c - return resp.v -} - -// Register begins collecting data for the given views. -// Once a view is registered, it reports data to the registered exporters. -func Register(views ...*View) error { - req := ®isterViewReq{ - views: views, - err: make(chan error), - } - defaultWorker.c <- req - return <-req.err -} - -// Unregister the given views. Data will not longer be exported for these views -// after Unregister returns. -// It is not necessary to unregister from views you expect to collect for the -// duration of your program execution. -func Unregister(views ...*View) { - names := make([]string, len(views)) - for i := range views { - names[i] = views[i].Name - } - req := &unregisterFromViewReq{ - views: names, - done: make(chan struct{}), - } - defaultWorker.c <- req - <-req.done -} - -// RetrieveData gets a snapshot of the data collected for the the view registered -// with the given name. It is intended for testing only. -func RetrieveData(viewName string) ([]*Row, error) { - req := &retrieveDataReq{ - now: time.Now(), - v: viewName, - c: make(chan *retrieveDataResp), - } - defaultWorker.c <- req - resp := <-req.c - return resp.rows, resp.err -} - -func record(tags *tag.Map, ms interface{}, attachments map[string]interface{}) { - req := &recordReq{ - tm: tags, - ms: ms.([]stats.Measurement), - attachments: attachments, - t: time.Now(), - } - defaultWorker.c <- req -} - -// SetReportingPeriod sets the interval between reporting aggregated views in -// the program. If duration is less than or equal to zero, it enables the -// default behavior. -// -// Note: each exporter makes different promises about what the lowest supported -// duration is. For example, the Stackdriver exporter recommends a value no -// lower than 1 minute. Consult each exporter per your needs. -func SetReportingPeriod(d time.Duration) { - // TODO(acetechnologist): ensure that the duration d is more than a certain - // value. e.g. 1s - req := &setReportingPeriodReq{ - d: d, - c: make(chan bool), - } - defaultWorker.c <- req - <-req.c // don't return until the timer is set to the new duration. -} - -func newWorker() *worker { - return &worker{ - measures: make(map[string]*measureRef), - views: make(map[string]*viewInternal), - startTimes: make(map[*viewInternal]time.Time), - timer: time.NewTicker(defaultReportingDuration), - c: make(chan command, 1024), - quit: make(chan bool), - done: make(chan bool), - } -} - -func (w *worker) start() { - prodMgr := metricproducer.GlobalManager() - prodMgr.AddProducer(w) - - for { - select { - case cmd := <-w.c: - cmd.handleCommand(w) - case <-w.timer.C: - w.reportUsage(time.Now()) - case <-w.quit: - w.timer.Stop() - close(w.c) - w.done <- true - return - } - } -} - -func (w *worker) stop() { - prodMgr := metricproducer.GlobalManager() - prodMgr.DeleteProducer(w) - - w.quit <- true - <-w.done -} - -func (w *worker) getMeasureRef(name string) *measureRef { - if mr, ok := w.measures[name]; ok { - return mr - } - mr := &measureRef{ - measure: name, - views: make(map[*viewInternal]struct{}), - } - w.measures[name] = mr - return mr -} - -func (w *worker) tryRegisterView(v *View) (*viewInternal, error) { - w.mu.Lock() - defer w.mu.Unlock() - vi, err := newViewInternal(v) - if err != nil { - return nil, err - } - if x, ok := w.views[vi.view.Name]; ok { - if !x.view.same(vi.view) { - return nil, fmt.Errorf("cannot register view %q; a different view with the same name is already registered", v.Name) - } - - // the view is already registered so there is nothing to do and the - // command is considered successful. - return x, nil - } - w.views[vi.view.Name] = vi - ref := w.getMeasureRef(vi.view.Measure.Name()) - ref.views[vi] = struct{}{} - return vi, nil -} - -func (w *worker) unregisterView(viewName string) { - w.mu.Lock() - defer w.mu.Unlock() - delete(w.views, viewName) -} - -func (w *worker) reportView(v *viewInternal, now time.Time) { - if !v.isSubscribed() { - return - } - rows := v.collectedRows() - _, ok := w.startTimes[v] - if !ok { - w.startTimes[v] = now - } - viewData := &Data{ - View: v.view, - Start: w.startTimes[v], - End: time.Now(), - Rows: rows, - } - exportersMu.Lock() - for e := range exporters { - e.ExportView(viewData) - } - exportersMu.Unlock() -} - -func (w *worker) reportUsage(now time.Time) { - w.mu.Lock() - defer w.mu.Unlock() - for _, v := range w.views { - w.reportView(v, now) - } -} - -func (w *worker) toMetric(v *viewInternal, now time.Time) *metricdata.Metric { - if !v.isSubscribed() { - return nil - } - - _, ok := w.startTimes[v] - if !ok { - w.startTimes[v] = now - } - - var startTime time.Time - if v.metricDescriptor.Type == metricdata.TypeGaugeInt64 || - v.metricDescriptor.Type == metricdata.TypeGaugeFloat64 { - startTime = time.Time{} - } else { - startTime = w.startTimes[v] - } - - return viewToMetric(v, now, startTime) -} - -// Read reads all view data and returns them as metrics. -// It is typically invoked by metric reader to export stats in metric format. -func (w *worker) Read() []*metricdata.Metric { - w.mu.Lock() - defer w.mu.Unlock() - now := time.Now() - metrics := make([]*metricdata.Metric, 0, len(w.views)) - for _, v := range w.views { - metric := w.toMetric(v, now) - if metric != nil { - metrics = append(metrics, metric) - } - } - return metrics -} diff --git a/vendor/go.opencensus.io/stats/view/worker_commands.go b/vendor/go.opencensus.io/stats/view/worker_commands.go deleted file mode 100644 index 0267e179..00000000 --- a/vendor/go.opencensus.io/stats/view/worker_commands.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package view - -import ( - "errors" - "fmt" - "strings" - "time" - - "go.opencensus.io/stats" - "go.opencensus.io/stats/internal" - "go.opencensus.io/tag" -) - -type command interface { - handleCommand(w *worker) -} - -// getViewByNameReq is the command to get a view given its name. -type getViewByNameReq struct { - name string - c chan *getViewByNameResp -} - -type getViewByNameResp struct { - v *View -} - -func (cmd *getViewByNameReq) handleCommand(w *worker) { - v := w.views[cmd.name] - if v == nil { - cmd.c <- &getViewByNameResp{nil} - return - } - cmd.c <- &getViewByNameResp{v.view} -} - -// registerViewReq is the command to register a view. -type registerViewReq struct { - views []*View - err chan error -} - -func (cmd *registerViewReq) handleCommand(w *worker) { - for _, v := range cmd.views { - if err := v.canonicalize(); err != nil { - cmd.err <- err - return - } - } - var errstr []string - for _, view := range cmd.views { - vi, err := w.tryRegisterView(view) - if err != nil { - errstr = append(errstr, fmt.Sprintf("%s: %v", view.Name, err)) - continue - } - internal.SubscriptionReporter(view.Measure.Name()) - vi.subscribe() - } - if len(errstr) > 0 { - cmd.err <- errors.New(strings.Join(errstr, "\n")) - } else { - cmd.err <- nil - } -} - -// unregisterFromViewReq is the command to unregister to a view. Has no -// impact on the data collection for client that are pulling data from the -// library. -type unregisterFromViewReq struct { - views []string - done chan struct{} -} - -func (cmd *unregisterFromViewReq) handleCommand(w *worker) { - for _, name := range cmd.views { - vi, ok := w.views[name] - if !ok { - continue - } - - // Report pending data for this view before removing it. - w.reportView(vi, time.Now()) - - vi.unsubscribe() - if !vi.isSubscribed() { - // this was the last subscription and view is not collecting anymore. - // The collected data can be cleared. - vi.clearRows() - } - w.unregisterView(name) - } - cmd.done <- struct{}{} -} - -// retrieveDataReq is the command to retrieve data for a view. -type retrieveDataReq struct { - now time.Time - v string - c chan *retrieveDataResp -} - -type retrieveDataResp struct { - rows []*Row - err error -} - -func (cmd *retrieveDataReq) handleCommand(w *worker) { - w.mu.Lock() - defer w.mu.Unlock() - vi, ok := w.views[cmd.v] - if !ok { - cmd.c <- &retrieveDataResp{ - nil, - fmt.Errorf("cannot retrieve data; view %q is not registered", cmd.v), - } - return - } - - if !vi.isSubscribed() { - cmd.c <- &retrieveDataResp{ - nil, - fmt.Errorf("cannot retrieve data; view %q has no subscriptions or collection is not forcibly started", cmd.v), - } - return - } - cmd.c <- &retrieveDataResp{ - vi.collectedRows(), - nil, - } -} - -// recordReq is the command to record data related to multiple measures -// at once. -type recordReq struct { - tm *tag.Map - ms []stats.Measurement - attachments map[string]interface{} - t time.Time -} - -func (cmd *recordReq) handleCommand(w *worker) { - w.mu.Lock() - defer w.mu.Unlock() - for _, m := range cmd.ms { - if (m == stats.Measurement{}) { // not registered - continue - } - ref := w.getMeasureRef(m.Measure().Name()) - for v := range ref.views { - v.addSample(cmd.tm, m.Value(), cmd.attachments, time.Now()) - } - } -} - -// setReportingPeriodReq is the command to modify the duration between -// reporting the collected data to the registered clients. -type setReportingPeriodReq struct { - d time.Duration - c chan bool -} - -func (cmd *setReportingPeriodReq) handleCommand(w *worker) { - w.timer.Stop() - if cmd.d <= 0 { - w.timer = time.NewTicker(defaultReportingDuration) - } else { - w.timer = time.NewTicker(cmd.d) - } - cmd.c <- true -} diff --git a/vendor/go.opencensus.io/tag/context.go b/vendor/go.opencensus.io/tag/context.go deleted file mode 100644 index b27d1b26..00000000 --- a/vendor/go.opencensus.io/tag/context.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tag - -import ( - "context" -) - -// FromContext returns the tag map stored in the context. -func FromContext(ctx context.Context) *Map { - // The returned tag map shouldn't be mutated. - ts := ctx.Value(mapCtxKey) - if ts == nil { - return nil - } - return ts.(*Map) -} - -// NewContext creates a new context with the given tag map. -// To propagate a tag map to downstream methods and downstream RPCs, add a tag map -// to the current context. NewContext will return a copy of the current context, -// and put the tag map into the returned one. -// If there is already a tag map in the current context, it will be replaced with m. -func NewContext(ctx context.Context, m *Map) context.Context { - return context.WithValue(ctx, mapCtxKey, m) -} - -type ctxKey struct{} - -var mapCtxKey = ctxKey{} diff --git a/vendor/go.opencensus.io/tag/doc.go b/vendor/go.opencensus.io/tag/doc.go deleted file mode 100644 index da16b74e..00000000 --- a/vendor/go.opencensus.io/tag/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/* -Package tag contains OpenCensus tags. - -Tags are key-value pairs. Tags provide additional cardinality to -the OpenCensus instrumentation data. - -Tags can be propagated on the wire and in the same -process via context.Context. Encode and Decode should be -used to represent tags into their binary propagation form. -*/ -package tag // import "go.opencensus.io/tag" diff --git a/vendor/go.opencensus.io/tag/key.go b/vendor/go.opencensus.io/tag/key.go deleted file mode 100644 index 4e63d08c..00000000 --- a/vendor/go.opencensus.io/tag/key.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tag - -// Key represents a tag key. -type Key struct { - name string -} - -// NewKey creates or retrieves a string key identified by name. -// Calling NewKey consequently with the same name returns the same key. -func NewKey(name string) (Key, error) { - if !checkKeyName(name) { - return Key{}, errInvalidKeyName - } - return Key{name: name}, nil -} - -// MustNewKey creates or retrieves a string key identified by name. -// An invalid key name raises a panic. -func MustNewKey(name string) Key { - k, err := NewKey(name) - if err != nil { - panic(err) - } - return k -} - -// Name returns the name of the key. -func (k Key) Name() string { - return k.name -} diff --git a/vendor/go.opencensus.io/tag/map.go b/vendor/go.opencensus.io/tag/map.go deleted file mode 100644 index 0272ef85..00000000 --- a/vendor/go.opencensus.io/tag/map.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tag - -import ( - "bytes" - "context" - "fmt" - "sort" -) - -// Tag is a key value pair that can be propagated on wire. -type Tag struct { - Key Key - Value string -} - -type tagContent struct { - value string - m metadatas -} - -// Map is a map of tags. Use New to create a context containing -// a new Map. -type Map struct { - m map[Key]tagContent -} - -// Value returns the value for the key if a value for the key exists. -func (m *Map) Value(k Key) (string, bool) { - if m == nil { - return "", false - } - v, ok := m.m[k] - return v.value, ok -} - -func (m *Map) String() string { - if m == nil { - return "nil" - } - keys := make([]Key, 0, len(m.m)) - for k := range m.m { - keys = append(keys, k) - } - sort.Slice(keys, func(i, j int) bool { return keys[i].Name() < keys[j].Name() }) - - var buffer bytes.Buffer - buffer.WriteString("{ ") - for _, k := range keys { - buffer.WriteString(fmt.Sprintf("{%v %v}", k.name, m.m[k])) - } - buffer.WriteString(" }") - return buffer.String() -} - -func (m *Map) insert(k Key, v string, md metadatas) { - if _, ok := m.m[k]; ok { - return - } - m.m[k] = tagContent{value: v, m: md} -} - -func (m *Map) update(k Key, v string, md metadatas) { - if _, ok := m.m[k]; ok { - m.m[k] = tagContent{value: v, m: md} - } -} - -func (m *Map) upsert(k Key, v string, md metadatas) { - m.m[k] = tagContent{value: v, m: md} -} - -func (m *Map) delete(k Key) { - delete(m.m, k) -} - -func newMap() *Map { - return &Map{m: make(map[Key]tagContent)} -} - -// Mutator modifies a tag map. -type Mutator interface { - Mutate(t *Map) (*Map, error) -} - -// Insert returns a mutator that inserts a -// value associated with k. If k already exists in the tag map, -// mutator doesn't update the value. -// Metadata applies metadata to the tag. It is optional. -// Metadatas are applied in the order in which it is provided. -// If more than one metadata updates the same attribute then -// the update from the last metadata prevails. -func Insert(k Key, v string, mds ...Metadata) Mutator { - return &mutator{ - fn: func(m *Map) (*Map, error) { - if !checkValue(v) { - return nil, errInvalidValue - } - m.insert(k, v, createMetadatas(mds...)) - return m, nil - }, - } -} - -// Update returns a mutator that updates the -// value of the tag associated with k with v. If k doesn't -// exists in the tag map, the mutator doesn't insert the value. -// Metadata applies metadata to the tag. It is optional. -// Metadatas are applied in the order in which it is provided. -// If more than one metadata updates the same attribute then -// the update from the last metadata prevails. -func Update(k Key, v string, mds ...Metadata) Mutator { - return &mutator{ - fn: func(m *Map) (*Map, error) { - if !checkValue(v) { - return nil, errInvalidValue - } - m.update(k, v, createMetadatas(mds...)) - return m, nil - }, - } -} - -// Upsert returns a mutator that upserts the -// value of the tag associated with k with v. It inserts the -// value if k doesn't exist already. It mutates the value -// if k already exists. -// Metadata applies metadata to the tag. It is optional. -// Metadatas are applied in the order in which it is provided. -// If more than one metadata updates the same attribute then -// the update from the last metadata prevails. -func Upsert(k Key, v string, mds ...Metadata) Mutator { - return &mutator{ - fn: func(m *Map) (*Map, error) { - if !checkValue(v) { - return nil, errInvalidValue - } - m.upsert(k, v, createMetadatas(mds...)) - return m, nil - }, - } -} - -func createMetadatas(mds ...Metadata) metadatas { - var metas metadatas - if len(mds) > 0 { - for _, md := range mds { - if md != nil { - md(&metas) - } - } - } else { - WithTTL(TTLUnlimitedPropagation)(&metas) - } - return metas - -} - -// Delete returns a mutator that deletes -// the value associated with k. -func Delete(k Key) Mutator { - return &mutator{ - fn: func(m *Map) (*Map, error) { - m.delete(k) - return m, nil - }, - } -} - -// New returns a new context that contains a tag map -// originated from the incoming context and modified -// with the provided mutators. -func New(ctx context.Context, mutator ...Mutator) (context.Context, error) { - m := newMap() - orig := FromContext(ctx) - if orig != nil { - for k, v := range orig.m { - if !checkKeyName(k.Name()) { - return ctx, fmt.Errorf("key:%q: %v", k, errInvalidKeyName) - } - if !checkValue(v.value) { - return ctx, fmt.Errorf("key:%q value:%q: %v", k.Name(), v, errInvalidValue) - } - m.insert(k, v.value, v.m) - } - } - var err error - for _, mod := range mutator { - m, err = mod.Mutate(m) - if err != nil { - return ctx, err - } - } - return NewContext(ctx, m), nil -} - -// Do is similar to pprof.Do: a convenience for installing the tags -// from the context as Go profiler labels. This allows you to -// correlated runtime profiling with stats. -// -// It converts the key/values from the given map to Go profiler labels -// and calls pprof.Do. -// -// Do is going to do nothing if your Go version is below 1.9. -func Do(ctx context.Context, f func(ctx context.Context)) { - do(ctx, f) -} - -type mutator struct { - fn func(t *Map) (*Map, error) -} - -func (m *mutator) Mutate(t *Map) (*Map, error) { - return m.fn(t) -} diff --git a/vendor/go.opencensus.io/tag/map_codec.go b/vendor/go.opencensus.io/tag/map_codec.go deleted file mode 100644 index f8b58276..00000000 --- a/vendor/go.opencensus.io/tag/map_codec.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tag - -import ( - "encoding/binary" - "fmt" -) - -// KeyType defines the types of keys allowed. Currently only keyTypeString is -// supported. -type keyType byte - -const ( - keyTypeString keyType = iota - keyTypeInt64 - keyTypeTrue - keyTypeFalse - - tagsVersionID = byte(0) -) - -type encoderGRPC struct { - buf []byte - writeIdx, readIdx int -} - -// writeKeyString writes the fieldID '0' followed by the key string and value -// string. -func (eg *encoderGRPC) writeTagString(k, v string) { - eg.writeByte(byte(keyTypeString)) - eg.writeStringWithVarintLen(k) - eg.writeStringWithVarintLen(v) -} - -func (eg *encoderGRPC) writeTagUint64(k string, i uint64) { - eg.writeByte(byte(keyTypeInt64)) - eg.writeStringWithVarintLen(k) - eg.writeUint64(i) -} - -func (eg *encoderGRPC) writeTagTrue(k string) { - eg.writeByte(byte(keyTypeTrue)) - eg.writeStringWithVarintLen(k) -} - -func (eg *encoderGRPC) writeTagFalse(k string) { - eg.writeByte(byte(keyTypeFalse)) - eg.writeStringWithVarintLen(k) -} - -func (eg *encoderGRPC) writeBytesWithVarintLen(bytes []byte) { - length := len(bytes) - - eg.growIfRequired(binary.MaxVarintLen64 + length) - eg.writeIdx += binary.PutUvarint(eg.buf[eg.writeIdx:], uint64(length)) - copy(eg.buf[eg.writeIdx:], bytes) - eg.writeIdx += length -} - -func (eg *encoderGRPC) writeStringWithVarintLen(s string) { - length := len(s) - - eg.growIfRequired(binary.MaxVarintLen64 + length) - eg.writeIdx += binary.PutUvarint(eg.buf[eg.writeIdx:], uint64(length)) - copy(eg.buf[eg.writeIdx:], s) - eg.writeIdx += length -} - -func (eg *encoderGRPC) writeByte(v byte) { - eg.growIfRequired(1) - eg.buf[eg.writeIdx] = v - eg.writeIdx++ -} - -func (eg *encoderGRPC) writeUint32(i uint32) { - eg.growIfRequired(4) - binary.LittleEndian.PutUint32(eg.buf[eg.writeIdx:], i) - eg.writeIdx += 4 -} - -func (eg *encoderGRPC) writeUint64(i uint64) { - eg.growIfRequired(8) - binary.LittleEndian.PutUint64(eg.buf[eg.writeIdx:], i) - eg.writeIdx += 8 -} - -func (eg *encoderGRPC) readByte() byte { - b := eg.buf[eg.readIdx] - eg.readIdx++ - return b -} - -func (eg *encoderGRPC) readUint32() uint32 { - i := binary.LittleEndian.Uint32(eg.buf[eg.readIdx:]) - eg.readIdx += 4 - return i -} - -func (eg *encoderGRPC) readUint64() uint64 { - i := binary.LittleEndian.Uint64(eg.buf[eg.readIdx:]) - eg.readIdx += 8 - return i -} - -func (eg *encoderGRPC) readBytesWithVarintLen() ([]byte, error) { - if eg.readEnded() { - return nil, fmt.Errorf("unexpected end while readBytesWithVarintLen '%x' starting at idx '%v'", eg.buf, eg.readIdx) - } - length, valueStart := binary.Uvarint(eg.buf[eg.readIdx:]) - if valueStart <= 0 { - return nil, fmt.Errorf("unexpected end while readBytesWithVarintLen '%x' starting at idx '%v'", eg.buf, eg.readIdx) - } - - valueStart += eg.readIdx - valueEnd := valueStart + int(length) - if valueEnd > len(eg.buf) { - return nil, fmt.Errorf("malformed encoding: length:%v, upper:%v, maxLength:%v", length, valueEnd, len(eg.buf)) - } - - eg.readIdx = valueEnd - return eg.buf[valueStart:valueEnd], nil -} - -func (eg *encoderGRPC) readStringWithVarintLen() (string, error) { - bytes, err := eg.readBytesWithVarintLen() - if err != nil { - return "", err - } - return string(bytes), nil -} - -func (eg *encoderGRPC) growIfRequired(expected int) { - if len(eg.buf)-eg.writeIdx < expected { - tmp := make([]byte, 2*(len(eg.buf)+1)+expected) - copy(tmp, eg.buf) - eg.buf = tmp - } -} - -func (eg *encoderGRPC) readEnded() bool { - return eg.readIdx >= len(eg.buf) -} - -func (eg *encoderGRPC) bytes() []byte { - return eg.buf[:eg.writeIdx] -} - -// Encode encodes the tag map into a []byte. It is useful to propagate -// the tag maps on wire in binary format. -func Encode(m *Map) []byte { - if m == nil { - return nil - } - eg := &encoderGRPC{ - buf: make([]byte, len(m.m)), - } - eg.writeByte(byte(tagsVersionID)) - for k, v := range m.m { - if v.m.ttl.ttl == valueTTLUnlimitedPropagation { - eg.writeByte(byte(keyTypeString)) - eg.writeStringWithVarintLen(k.name) - eg.writeBytesWithVarintLen([]byte(v.value)) - } - } - return eg.bytes() -} - -// Decode decodes the given []byte into a tag map. -func Decode(bytes []byte) (*Map, error) { - ts := newMap() - err := DecodeEach(bytes, ts.upsert) - if err != nil { - // no partial failures - return nil, err - } - return ts, nil -} - -// DecodeEach decodes the given serialized tag map, calling handler for each -// tag key and value decoded. -func DecodeEach(bytes []byte, fn func(key Key, val string, md metadatas)) error { - eg := &encoderGRPC{ - buf: bytes, - } - if len(eg.buf) == 0 { - return nil - } - - version := eg.readByte() - if version > tagsVersionID { - return fmt.Errorf("cannot decode: unsupported version: %q; supports only up to: %q", version, tagsVersionID) - } - - for !eg.readEnded() { - typ := keyType(eg.readByte()) - - if typ != keyTypeString { - return fmt.Errorf("cannot decode: invalid key type: %q", typ) - } - - k, err := eg.readBytesWithVarintLen() - if err != nil { - return err - } - - v, err := eg.readBytesWithVarintLen() - if err != nil { - return err - } - - key, err := NewKey(string(k)) - if err != nil { - return err - } - val := string(v) - if !checkValue(val) { - return errInvalidValue - } - fn(key, val, createMetadatas(WithTTL(TTLUnlimitedPropagation))) - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/go.opencensus.io/tag/metadata.go b/vendor/go.opencensus.io/tag/metadata.go deleted file mode 100644 index 6571a583..00000000 --- a/vendor/go.opencensus.io/tag/metadata.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2019, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package tag - -const ( - // valueTTLNoPropagation prevents tag from propagating. - valueTTLNoPropagation = 0 - - // valueTTLUnlimitedPropagation allows tag to propagate without any limits on number of hops. - valueTTLUnlimitedPropagation = -1 -) - -// TTL is metadata that specifies number of hops a tag can propagate. -// Details about TTL metadata is specified at https://github.com/census-instrumentation/opencensus-specs/blob/master/tags/TagMap.md#tagmetadata -type TTL struct { - ttl int -} - -var ( - // TTLUnlimitedPropagation is TTL metadata that allows tag to propagate without any limits on number of hops. - TTLUnlimitedPropagation = TTL{ttl: valueTTLUnlimitedPropagation} - - // TTLNoPropagation is TTL metadata that prevents tag from propagating. - TTLNoPropagation = TTL{ttl: valueTTLNoPropagation} -) - -type metadatas struct { - ttl TTL -} - -// Metadata applies metadatas specified by the function. -type Metadata func(*metadatas) - -// WithTTL applies metadata with provided ttl. -func WithTTL(ttl TTL) Metadata { - return func(m *metadatas) { - m.ttl = ttl - } -} diff --git a/vendor/go.opencensus.io/tag/profile_19.go b/vendor/go.opencensus.io/tag/profile_19.go deleted file mode 100644 index b34d95e3..00000000 --- a/vendor/go.opencensus.io/tag/profile_19.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build go1.9 - -package tag - -import ( - "context" - "runtime/pprof" -) - -func do(ctx context.Context, f func(ctx context.Context)) { - m := FromContext(ctx) - keyvals := make([]string, 0, 2*len(m.m)) - for k, v := range m.m { - keyvals = append(keyvals, k.Name(), v.value) - } - pprof.Do(ctx, pprof.Labels(keyvals...), f) -} diff --git a/vendor/go.opencensus.io/tag/profile_not19.go b/vendor/go.opencensus.io/tag/profile_not19.go deleted file mode 100644 index 83adbce5..00000000 --- a/vendor/go.opencensus.io/tag/profile_not19.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build !go1.9 - -package tag - -import "context" - -func do(ctx context.Context, f func(ctx context.Context)) { - f(ctx) -} diff --git a/vendor/go.opencensus.io/tag/validate.go b/vendor/go.opencensus.io/tag/validate.go deleted file mode 100644 index 0939fc67..00000000 --- a/vendor/go.opencensus.io/tag/validate.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tag - -import "errors" - -const ( - maxKeyLength = 255 - - // valid are restricted to US-ASCII subset (range 0x20 (' ') to 0x7e ('~')). - validKeyValueMin = 32 - validKeyValueMax = 126 -) - -var ( - errInvalidKeyName = errors.New("invalid key name: only ASCII characters accepted; max length must be 255 characters") - errInvalidValue = errors.New("invalid value: only ASCII characters accepted; max length must be 255 characters") -) - -func checkKeyName(name string) bool { - if len(name) == 0 { - return false - } - if len(name) > maxKeyLength { - return false - } - return isASCII(name) -} - -func isASCII(s string) bool { - for _, c := range s { - if (c < validKeyValueMin) || (c > validKeyValueMax) { - return false - } - } - return true -} - -func checkValue(v string) bool { - if len(v) > maxKeyLength { - return false - } - return isASCII(v) -} diff --git a/vendor/go.uber.org/atomic/.codecov.yml b/vendor/go.uber.org/atomic/.codecov.yml deleted file mode 100644 index 6d4d1be7..00000000 --- a/vendor/go.uber.org/atomic/.codecov.yml +++ /dev/null @@ -1,15 +0,0 @@ -coverage: - range: 80..100 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 100 # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure - diff --git a/vendor/go.uber.org/atomic/.gitignore b/vendor/go.uber.org/atomic/.gitignore deleted file mode 100644 index 0a4504f1..00000000 --- a/vendor/go.uber.org/atomic/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.DS_Store -/vendor -/cover -cover.out -lint.log - -# Binaries -*.test - -# Profiling output -*.prof diff --git a/vendor/go.uber.org/atomic/.travis.yml b/vendor/go.uber.org/atomic/.travis.yml deleted file mode 100644 index 0f3769e5..00000000 --- a/vendor/go.uber.org/atomic/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -sudo: false -language: go -go_import_path: go.uber.org/atomic - -go: - - 1.11.x - - 1.12.x - -matrix: - include: - - go: 1.12.x - env: NO_TEST=yes LINT=yes - -cache: - directories: - - vendor - -install: - - make install_ci - -script: - - test -n "$NO_TEST" || make test_ci - - test -n "$NO_TEST" || scripts/test-ubergo.sh - - test -z "$LINT" || make install_lint lint - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/atomic/LICENSE.txt b/vendor/go.uber.org/atomic/LICENSE.txt deleted file mode 100644 index 8765c9fb..00000000 --- a/vendor/go.uber.org/atomic/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/go.uber.org/atomic/Makefile b/vendor/go.uber.org/atomic/Makefile deleted file mode 100644 index 1ef26307..00000000 --- a/vendor/go.uber.org/atomic/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# Many Go tools take file globs or directories as arguments instead of packages. -PACKAGE_FILES ?= *.go - -# For pre go1.6 -export GO15VENDOREXPERIMENT=1 - - -.PHONY: build -build: - go build -i ./... - - -.PHONY: install -install: - glide --version || go get github.com/Masterminds/glide - glide install - - -.PHONY: test -test: - go test -cover -race ./... - - -.PHONY: install_ci -install_ci: install - go get github.com/wadey/gocovmerge - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -.PHONY: install_lint -install_lint: - go get golang.org/x/lint/golint - - -.PHONY: lint -lint: - @rm -rf lint.log - @echo "Checking formatting..." - @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log - @echo "Checking vet..." - @go vet ./... 2>&1 | tee -a lint.log;) - @echo "Checking lint..." - @golint $$(go list ./...) 2>&1 | tee -a lint.log - @echo "Checking for unresolved FIXMEs..." - @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log - @[ ! -s lint.log ] - - -.PHONY: test_ci -test_ci: install_ci build - ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/vendor/go.uber.org/atomic/README.md b/vendor/go.uber.org/atomic/README.md deleted file mode 100644 index 62eb8e57..00000000 --- a/vendor/go.uber.org/atomic/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard] - -Simple wrappers for primitive types to enforce atomic access. - -## Installation -`go get -u go.uber.org/atomic` - -## Usage -The standard library's `sync/atomic` is powerful, but it's easy to forget which -variables must be accessed atomically. `go.uber.org/atomic` preserves all the -functionality of the standard library, but wraps the primitive types to -provide a safer, more convenient API. - -```go -var atom atomic.Uint32 -atom.Store(42) -atom.Sub(2) -atom.CAS(40, 11) -``` - -See the [documentation][doc] for a complete API specification. - -## Development Status -Stable. - -___ -Released under the [MIT License](LICENSE.txt). - -[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg -[doc]: https://godoc.org/go.uber.org/atomic -[ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master -[ci]: https://travis-ci.com/uber-go/atomic -[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg -[cov]: https://codecov.io/gh/uber-go/atomic -[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic -[reportcard]: https://goreportcard.com/report/go.uber.org/atomic diff --git a/vendor/go.uber.org/atomic/atomic.go b/vendor/go.uber.org/atomic/atomic.go deleted file mode 100644 index 1db6849f..00000000 --- a/vendor/go.uber.org/atomic/atomic.go +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package atomic provides simple wrappers around numerics to enforce atomic -// access. -package atomic - -import ( - "math" - "sync/atomic" - "time" -) - -// Int32 is an atomic wrapper around an int32. -type Int32 struct{ v int32 } - -// NewInt32 creates an Int32. -func NewInt32(i int32) *Int32 { - return &Int32{i} -} - -// Load atomically loads the wrapped value. -func (i *Int32) Load() int32 { - return atomic.LoadInt32(&i.v) -} - -// Add atomically adds to the wrapped int32 and returns the new value. -func (i *Int32) Add(n int32) int32 { - return atomic.AddInt32(&i.v, n) -} - -// Sub atomically subtracts from the wrapped int32 and returns the new value. -func (i *Int32) Sub(n int32) int32 { - return atomic.AddInt32(&i.v, -n) -} - -// Inc atomically increments the wrapped int32 and returns the new value. -func (i *Int32) Inc() int32 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int32 and returns the new value. -func (i *Int32) Dec() int32 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Int32) CAS(old, new int32) bool { - return atomic.CompareAndSwapInt32(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Int32) Store(n int32) { - atomic.StoreInt32(&i.v, n) -} - -// Swap atomically swaps the wrapped int32 and returns the old value. -func (i *Int32) Swap(n int32) int32 { - return atomic.SwapInt32(&i.v, n) -} - -// Int64 is an atomic wrapper around an int64. -type Int64 struct{ v int64 } - -// NewInt64 creates an Int64. -func NewInt64(i int64) *Int64 { - return &Int64{i} -} - -// Load atomically loads the wrapped value. -func (i *Int64) Load() int64 { - return atomic.LoadInt64(&i.v) -} - -// Add atomically adds to the wrapped int64 and returns the new value. -func (i *Int64) Add(n int64) int64 { - return atomic.AddInt64(&i.v, n) -} - -// Sub atomically subtracts from the wrapped int64 and returns the new value. -func (i *Int64) Sub(n int64) int64 { - return atomic.AddInt64(&i.v, -n) -} - -// Inc atomically increments the wrapped int64 and returns the new value. -func (i *Int64) Inc() int64 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int64 and returns the new value. -func (i *Int64) Dec() int64 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Int64) CAS(old, new int64) bool { - return atomic.CompareAndSwapInt64(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Int64) Store(n int64) { - atomic.StoreInt64(&i.v, n) -} - -// Swap atomically swaps the wrapped int64 and returns the old value. -func (i *Int64) Swap(n int64) int64 { - return atomic.SwapInt64(&i.v, n) -} - -// Uint32 is an atomic wrapper around an uint32. -type Uint32 struct{ v uint32 } - -// NewUint32 creates a Uint32. -func NewUint32(i uint32) *Uint32 { - return &Uint32{i} -} - -// Load atomically loads the wrapped value. -func (i *Uint32) Load() uint32 { - return atomic.LoadUint32(&i.v) -} - -// Add atomically adds to the wrapped uint32 and returns the new value. -func (i *Uint32) Add(n uint32) uint32 { - return atomic.AddUint32(&i.v, n) -} - -// Sub atomically subtracts from the wrapped uint32 and returns the new value. -func (i *Uint32) Sub(n uint32) uint32 { - return atomic.AddUint32(&i.v, ^(n - 1)) -} - -// Inc atomically increments the wrapped uint32 and returns the new value. -func (i *Uint32) Inc() uint32 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped int32 and returns the new value. -func (i *Uint32) Dec() uint32 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Uint32) CAS(old, new uint32) bool { - return atomic.CompareAndSwapUint32(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Uint32) Store(n uint32) { - atomic.StoreUint32(&i.v, n) -} - -// Swap atomically swaps the wrapped uint32 and returns the old value. -func (i *Uint32) Swap(n uint32) uint32 { - return atomic.SwapUint32(&i.v, n) -} - -// Uint64 is an atomic wrapper around a uint64. -type Uint64 struct{ v uint64 } - -// NewUint64 creates a Uint64. -func NewUint64(i uint64) *Uint64 { - return &Uint64{i} -} - -// Load atomically loads the wrapped value. -func (i *Uint64) Load() uint64 { - return atomic.LoadUint64(&i.v) -} - -// Add atomically adds to the wrapped uint64 and returns the new value. -func (i *Uint64) Add(n uint64) uint64 { - return atomic.AddUint64(&i.v, n) -} - -// Sub atomically subtracts from the wrapped uint64 and returns the new value. -func (i *Uint64) Sub(n uint64) uint64 { - return atomic.AddUint64(&i.v, ^(n - 1)) -} - -// Inc atomically increments the wrapped uint64 and returns the new value. -func (i *Uint64) Inc() uint64 { - return i.Add(1) -} - -// Dec atomically decrements the wrapped uint64 and returns the new value. -func (i *Uint64) Dec() uint64 { - return i.Sub(1) -} - -// CAS is an atomic compare-and-swap. -func (i *Uint64) CAS(old, new uint64) bool { - return atomic.CompareAndSwapUint64(&i.v, old, new) -} - -// Store atomically stores the passed value. -func (i *Uint64) Store(n uint64) { - atomic.StoreUint64(&i.v, n) -} - -// Swap atomically swaps the wrapped uint64 and returns the old value. -func (i *Uint64) Swap(n uint64) uint64 { - return atomic.SwapUint64(&i.v, n) -} - -// Bool is an atomic Boolean. -type Bool struct{ v uint32 } - -// NewBool creates a Bool. -func NewBool(initial bool) *Bool { - return &Bool{boolToInt(initial)} -} - -// Load atomically loads the Boolean. -func (b *Bool) Load() bool { - return truthy(atomic.LoadUint32(&b.v)) -} - -// CAS is an atomic compare-and-swap. -func (b *Bool) CAS(old, new bool) bool { - return atomic.CompareAndSwapUint32(&b.v, boolToInt(old), boolToInt(new)) -} - -// Store atomically stores the passed value. -func (b *Bool) Store(new bool) { - atomic.StoreUint32(&b.v, boolToInt(new)) -} - -// Swap sets the given value and returns the previous value. -func (b *Bool) Swap(new bool) bool { - return truthy(atomic.SwapUint32(&b.v, boolToInt(new))) -} - -// Toggle atomically negates the Boolean and returns the previous value. -func (b *Bool) Toggle() bool { - return truthy(atomic.AddUint32(&b.v, 1) - 1) -} - -func truthy(n uint32) bool { - return n&1 == 1 -} - -func boolToInt(b bool) uint32 { - if b { - return 1 - } - return 0 -} - -// Float64 is an atomic wrapper around float64. -type Float64 struct { - v uint64 -} - -// NewFloat64 creates a Float64. -func NewFloat64(f float64) *Float64 { - return &Float64{math.Float64bits(f)} -} - -// Load atomically loads the wrapped value. -func (f *Float64) Load() float64 { - return math.Float64frombits(atomic.LoadUint64(&f.v)) -} - -// Store atomically stores the passed value. -func (f *Float64) Store(s float64) { - atomic.StoreUint64(&f.v, math.Float64bits(s)) -} - -// Add atomically adds to the wrapped float64 and returns the new value. -func (f *Float64) Add(s float64) float64 { - for { - old := f.Load() - new := old + s - if f.CAS(old, new) { - return new - } - } -} - -// Sub atomically subtracts from the wrapped float64 and returns the new value. -func (f *Float64) Sub(s float64) float64 { - return f.Add(-s) -} - -// CAS is an atomic compare-and-swap. -func (f *Float64) CAS(old, new float64) bool { - return atomic.CompareAndSwapUint64(&f.v, math.Float64bits(old), math.Float64bits(new)) -} - -// Duration is an atomic wrapper around time.Duration -// https://godoc.org/time#Duration -type Duration struct { - v Int64 -} - -// NewDuration creates a Duration. -func NewDuration(d time.Duration) *Duration { - return &Duration{v: *NewInt64(int64(d))} -} - -// Load atomically loads the wrapped value. -func (d *Duration) Load() time.Duration { - return time.Duration(d.v.Load()) -} - -// Store atomically stores the passed value. -func (d *Duration) Store(n time.Duration) { - d.v.Store(int64(n)) -} - -// Add atomically adds to the wrapped time.Duration and returns the new value. -func (d *Duration) Add(n time.Duration) time.Duration { - return time.Duration(d.v.Add(int64(n))) -} - -// Sub atomically subtracts from the wrapped time.Duration and returns the new value. -func (d *Duration) Sub(n time.Duration) time.Duration { - return time.Duration(d.v.Sub(int64(n))) -} - -// Swap atomically swaps the wrapped time.Duration and returns the old value. -func (d *Duration) Swap(n time.Duration) time.Duration { - return time.Duration(d.v.Swap(int64(n))) -} - -// CAS is an atomic compare-and-swap. -func (d *Duration) CAS(old, new time.Duration) bool { - return d.v.CAS(int64(old), int64(new)) -} - -// Value shadows the type of the same name from sync/atomic -// https://godoc.org/sync/atomic#Value -type Value struct{ atomic.Value } diff --git a/vendor/go.uber.org/atomic/error.go b/vendor/go.uber.org/atomic/error.go deleted file mode 100644 index 0489d19b..00000000 --- a/vendor/go.uber.org/atomic/error.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package atomic - -// Error is an atomic type-safe wrapper around Value for errors -type Error struct{ v Value } - -// errorHolder is non-nil holder for error object. -// atomic.Value panics on saving nil object, so err object needs to be -// wrapped with valid object first. -type errorHolder struct{ err error } - -// NewError creates new atomic error object -func NewError(err error) *Error { - e := &Error{} - if err != nil { - e.Store(err) - } - return e -} - -// Load atomically loads the wrapped error -func (e *Error) Load() error { - v := e.v.Load() - if v == nil { - return nil - } - - eh := v.(errorHolder) - return eh.err -} - -// Store atomically stores error. -// NOTE: a holder object is allocated on each Store call. -func (e *Error) Store(err error) { - e.v.Store(errorHolder{err: err}) -} diff --git a/vendor/go.uber.org/atomic/glide.lock b/vendor/go.uber.org/atomic/glide.lock deleted file mode 100644 index 3c72c599..00000000 --- a/vendor/go.uber.org/atomic/glide.lock +++ /dev/null @@ -1,17 +0,0 @@ -hash: f14d51408e3e0e4f73b34e4039484c78059cd7fc5f4996fdd73db20dc8d24f53 -updated: 2016-10-27T00:10:51.16960137-07:00 -imports: [] -testImports: -- name: github.com/davecgh/go-spew - version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: d77da356e56a7428ad25149ca77381849a6a5232 - subpackages: - - assert - - require diff --git a/vendor/go.uber.org/atomic/glide.yaml b/vendor/go.uber.org/atomic/glide.yaml deleted file mode 100644 index 4cf608ec..00000000 --- a/vendor/go.uber.org/atomic/glide.yaml +++ /dev/null @@ -1,6 +0,0 @@ -package: go.uber.org/atomic -testImport: -- package: github.com/stretchr/testify - subpackages: - - assert - - require diff --git a/vendor/go.uber.org/atomic/string.go b/vendor/go.uber.org/atomic/string.go deleted file mode 100644 index ede8136f..00000000 --- a/vendor/go.uber.org/atomic/string.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package atomic - -// String is an atomic type-safe wrapper around Value for strings. -type String struct{ v Value } - -// NewString creates a String. -func NewString(str string) *String { - s := &String{} - if str != "" { - s.Store(str) - } - return s -} - -// Load atomically loads the wrapped string. -func (s *String) Load() string { - v := s.v.Load() - if v == nil { - return "" - } - return v.(string) -} - -// Store atomically stores the passed string. -// Note: Converting the string to an interface{} to store in the Value -// requires an allocation. -func (s *String) Store(str string) { - s.v.Store(str) -} diff --git a/vendor/go.uber.org/dig/.codecov.yml b/vendor/go.uber.org/dig/.codecov.yml deleted file mode 100644 index c474df1c..00000000 --- a/vendor/go.uber.org/dig/.codecov.yml +++ /dev/null @@ -1,19 +0,0 @@ -coverage: - range: 70..98 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 98 # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure - - patch: - default: - enabled: yes - target: 70 diff --git a/vendor/go.uber.org/dig/.gitignore b/vendor/go.uber.org/dig/.gitignore deleted file mode 100644 index 23249243..00000000 --- a/vendor/go.uber.org/dig/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/vendor -/.bench -*.mem -*.cpu -*.test -*.log -*.out -*.html -*.coverprofile -coverage.txt -*.pprof diff --git a/vendor/go.uber.org/dig/.travis.yml b/vendor/go.uber.org/dig/.travis.yml deleted file mode 100644 index c0b94633..00000000 --- a/vendor/go.uber.org/dig/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -sudo: false -go_import_path: go.uber.org/dig - -matrix: - include: - - go: "1.10" - - go: "1.11" - env: LINT=1 - -cache: - directories: - - vendor -install: - - make dependencies -script: - - test -z "$LINT" && echo "Skipping lint" || make lint - - make ci diff --git a/vendor/go.uber.org/dig/CHANGELOG.md b/vendor/go.uber.org/dig/CHANGELOG.md deleted file mode 100644 index 6251d203..00000000 --- a/vendor/go.uber.org/dig/CHANGELOG.md +++ /dev/null @@ -1,160 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [1.7.0] - 2019-01-04 -### Added -- Added `Group` option for `Provide` to add value groups to the container without -rewriting constructors. See package doucmentation for more information. - -## [1.6.0] - 2018-11-06 -### Changed -- When an error graph is visualized, the graph is pruned so that the graph only - contains failure nodes. -- Container visualization is now oriented from right to left. - -## [1.5.1] - 2018-11-01 -### Fixed -- Fixed a test that was causing Dig to be unusable with Go Modules. - -## [1.5.0] - 2018-09-19 -### Added -- Added a `DeferAcyclicVerification` container option that defers graph cycle - detection until the next Invoke. - -### Changed -- Improved cycle-detection performance by 50x in certain degenerative cases. - -## [1.4.0] - 2018-08-16 -### Added -- Added `Visualize` function to visualize the state of the container in the - GraphViz DOT format. This allows visualization of error types and the - dependency relationships of types in the container. -- Added `CanVisualizeError` function to determine if an error can be visualized - in the graph. -- Added `Name` option for `Provide` to add named values to the container - without rewriting constructors. See package documentation for more - information. - -### Changed -- `name:"..."` tags on nested Result Objects will now cause errors instead of - being ignored. - -## [1.3.0] - 2017-12-04 -### Changed -- Improved messages for errors thrown by Dig under a many scenarios to be more - informative. - -## [1.2.0] - 2017-11-07 -### Added -- `dig.In` and `dig.Out` now support value groups, making it possible to - produce many values of the same type from different constructors. See package - documentation for more information. - -## [1.1.0] - 2017-09-15 -### Added -- Added the `dig.RootCause` function which allows retrieving the original - constructor error that caused an `Invoke` failure. - -### Changed -- Errors from `Invoke` now attempt to hint to the user a presence of a similar - type, for example a pointer to the requested type and vice versa. - -## [1.0.0] - 2017-07-31 - -First stable release: no breaking changes will be made in the 1.x series. - -### Changed -- `Provide` and `Invoke` will now fail if `dig.In` or `dig.Out` structs - contain unexported fields. Previously these fields were ignored which often - led to confusion. - -## [1.0.0-rc2] - 2017-07-21 -### Added -- Exported `dig.IsIn` and `dig.IsOut` so that consuming libraries can check if - a params or return struct embeds the `dig.In` and `dig.Out` types, respectively. - -### Changed -- Added variadic options to all public APIS so that new functionality can be - introduced post v1.0.0 without introducing breaking changes. -- Functions with variadic arguments can now be passed to `dig.Provide` and - `dig.Invoke`. Previously this caused an error, whereas now the args will be ignored. - -## [1.0.0-rc1] - 2017-06-21 - -First release candidate. - -## [0.5.0] - 2017-06-19 -### Added -- `dig.In` and `dig.Out` now support named instances, i.e.: - - ```go - type param struct { - dig.In - - DB1 DB.Connection `name:"primary"` - DB2 DB.Connection `name:"secondary"` - } - ``` - -### Fixed -- Structs compatible with `dig.In` and `dig.Out` may now be generated using - `reflect.StructOf`. - -## [0.4.0] - 2017-06-12 -### Added -- Add `dig.In` embeddable type for advanced use-cases of specifying dependencies. -- Add `dig.Out` embeddable type for advanced use-cases of constructors - inserting types in the container. -- Add support for optional parameters through `optional:"true"` tag on `dig.In` objects. -- Add support for value types and many built-ins (maps, slices, channels). - -### Changed -- **[Breaking]** Restrict the API surface to only `Provide` and `Invoke`. -- **[Breaking]** Update `Provide` method to accept variadic arguments. - -### Removed -- **[Breaking]** Remove `Must*` funcs to greatly reduce API surface area. -- Providing constructors with common returned types results in an error. - -## [0.3] - 2017-05-02 -### Added -- Add functionality to `Provide` to support constructor with `n` return - objects to be resolved into the `dig.Graph` -- Add `Invoke` function to invoke provided function and insert return - objects into the `dig.Graph` - -### Changed -- Rename `RegisterAll` and `MustRegisterAll` to `ProvideAll` and - `MustProvideAll`. - -## [0.2] - 2017-03-27 -### Changed -- Rename `Register` to `Provide` for clarity and to recude clash with other - Register functions. -- Rename `dig.Graph` to `dig.Container`. - -### Removed -- Remove the package-level functions and the `DefaultGraph`. - -## 0.1 - 2017-03-23 - -Initial release. - -[1.7.0]: https://github.com/uber-go/dig/compare/v1.6.0...v1.7.0 -[1.6.0]: https://github.com/uber-go/dig/compare/v1.5.1...v1.6.0 -[1.5.1]: https://github.com/uber-go/dig/compare/v1.5.0...v1.5.1 -[1.5.0]: https://github.com/uber-go/dig/compare/v1.4.0...v1.5.0 -[1.4.0]: https://github.com/uber-go/dig/compare/v1.3.0...v1.4.0 -[1.3.0]: https://github.com/uber-go/dig/compare/v1.2.0...v1.3.0 -[1.2.0]: https://github.com/uber-go/dig/compare/v1.1.0...v1.2.0 -[1.1.0]: https://github.com/uber-go/dig/compare/v1.0.0...v1.1.0 -[1.0.0]: https://github.com/uber-go/dig/compare/v1.0.0-rc2...v1.0.0 -[1.0.0-rc2]: https://github.com/uber-go/dig/compare/v1.0.0-rc1...v1.0.0-rc2 -[1.0.0-rc1]: https://github.com/uber-go/dig/compare/v0.5.0...v1.0.0-rc1 -[0.5.0]: https://github.com/uber-go/dig/compare/v0.4.0...v0.5.0 -[0.4.0]: https://github.com/uber-go/dig/compare/v0.3...v0.4.0 -[0.3]: https://github.com/uber-go/dig/compare/v0.2...v0.3 -[0.2]: https://github.com/uber-go/dig/compare/v0.1...v0.2 diff --git a/vendor/go.uber.org/dig/LICENSE b/vendor/go.uber.org/dig/LICENSE deleted file mode 100644 index 00a8d056..00000000 --- a/vendor/go.uber.org/dig/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017-2018 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/go.uber.org/dig/Makefile b/vendor/go.uber.org/dig/Makefile deleted file mode 100644 index 10cb24fa..00000000 --- a/vendor/go.uber.org/dig/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem -PKGS ?= $(shell glide novendor | grep -v examples) -PKG_FILES ?= *.go -GO_VERSION := $(shell go version | cut -d " " -f 3) - -.PHONY: all -all: lint test - -.PHONY: dependencies -dependencies: - @echo "Installing Glide and locked dependencies..." - glide --version || go get -u -f github.com/Masterminds/glide - glide install - @echo "Installing uber-license tool..." - command -v update-license >/dev/null || go get -u -f go.uber.org/tools/update-license - @echo "Installing golint..." - command -v golint >/dev/null || go get -u -f github.com/golang/lint/golint - -.PHONY: license -license: dependencies - ./check_license.sh | tee -a lint.log - -.PHONY: lint -lint: - @rm -rf lint.log - @echo "Checking formatting..." - @gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log - @echo "Installing test dependencies for vet..." - @go test -i $(PKGS) - @echo "Checking vet..." - @$(foreach dir,$(PKG_FILES),go tool vet $(VET_RULES) $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking lint..." - @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking for unresolved FIXMEs..." - @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log - @echo "Checking for license headers..." - @DRY_RUN=1 ./check_license.sh | tee -a lint.log - @[ ! -s lint.log ] - -.PHONY: test -test: - @.build/test.sh - -.PHONY: ci -ci: SHELL := /bin/bash -ci: test - bash <(curl -s https://codecov.io/bash) - -.PHONY: bench -BENCH ?= . -bench: - @$(foreach pkg,$(PKGS),go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) $(pkg);) diff --git a/vendor/go.uber.org/dig/README.md b/vendor/go.uber.org/dig/README.md deleted file mode 100644 index f23fa1ac..00000000 --- a/vendor/go.uber.org/dig/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# :hammer: dig [![GoDoc][doc-img]][doc] [![GitHub release][release-img]][release] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][report-card-img]][report-card] - -A reflection based dependency injection toolkit for Go. - -### Good for: - -* Powering an application framework, e.g. [Fx](https://github.com/uber-go/fx). -* Resolving the object graph during process startup. - -### Bad for: - -* Using in place of an application framework, e.g. [Fx](https://github.com/uber-go/fx). -* Resolving dependencies after the process has already started. -* Exposing to user-land code as a [Service Locator](https://martinfowler.com/articles/injection.html#UsingAServiceLocator). - -## Installation - -We recommend locking to [SemVer](http://semver.org/) range `^1` using [Glide](https://github.com/Masterminds/glide): - -``` -glide get 'go.uber.org/dig#^1' -``` - -## Stability - -This library is `v1` and follows [SemVer](http://semver.org/) strictly. - -No breaking changes will be made to exported APIs before `v2.0.0`. - -[doc-img]: http://img.shields.io/badge/GoDoc-Reference-blue.svg -[doc]: https://godoc.org/go.uber.org/dig - -[release-img]: https://img.shields.io/github/release/uber-go/dig.svg -[release]: https://github.com/uber-go/dig/releases - -[ci-img]: https://img.shields.io/travis/uber-go/dig/master.svg -[ci]: https://travis-ci.org/uber-go/dig/branches - -[cov-img]: https://codecov.io/gh/uber-go/dig/branch/master/graph/badge.svg -[cov]: https://codecov.io/gh/uber-go/dig/branch/master - -[report-card-img]: https://goreportcard.com/badge/github.com/uber-go/dig -[report-card]: https://goreportcard.com/report/github.com/uber-go/dig diff --git a/vendor/go.uber.org/dig/check_license.sh b/vendor/go.uber.org/dig/check_license.sh deleted file mode 100755 index e8162850..00000000 --- a/vendor/go.uber.org/dig/check_license.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -run_update_license() { - # doing this because of SC2046 warning - for file in $(git ls-files | grep '\.go$'); do - update-license $@ "${file}" - done -} - -if [ -z "${DRY_RUN}" ]; then - run_update_license -else - DRY_OUTPUT="$(run_update_license --dry)" - if [ -n "${DRY_OUTPUT}" ]; then - echo "The following files do not have correct license headers." - echo "Please run make license and amend your commit." - echo - echo "${DRY_OUTPUT}" - exit 1 - fi -fi diff --git a/vendor/go.uber.org/dig/cycle.go b/vendor/go.uber.org/dig/cycle.go deleted file mode 100644 index 03f9f6bc..00000000 --- a/vendor/go.uber.org/dig/cycle.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "bytes" - "fmt" - - "go.uber.org/dig/internal/digreflect" -) - -type cycleEntry struct { - Key key - Func *digreflect.Func -} - -type errCycleDetected struct { - Path []cycleEntry -} - -func (e errCycleDetected) Error() string { - // We get something like, - // - // foo provided by "path/to/package".NewFoo (path/to/file.go:42) - // depends on bar provided by "another/package".NewBar (somefile.go:1) - // depends on baz provided by "somepackage".NewBar (anotherfile.go:2) - // depends on foo provided by "path/to/package".NewFoo (path/to/file.go:42) - // - b := new(bytes.Buffer) - - for i, entry := range e.Path { - if i > 0 { - b.WriteString("\n\tdepends on ") - } - fmt.Fprintf(b, "%v provided by %v", entry.Key, entry.Func) - } - return b.String() -} - -// IsCycleDetected returns a boolean as to whether the provided error indicates -// a cycle was detected in the container graph. -func IsCycleDetected(err error) bool { - _, ok := RootCause(err).(errCycleDetected) - return ok -} - -func verifyAcyclic(c containerStore, n provider, k key) error { - visited := make(map[key]struct{}) - err := detectCycles(n, c, []cycleEntry{ - {Key: k, Func: n.Location()}, - }, visited) - if err != nil { - err = errWrapf(err, "this function introduces a cycle") - } - return err -} - -func detectCycles(n provider, c containerStore, path []cycleEntry, visited map[key]struct{}) error { - var err error - walkParam(n.ParamList(), paramVisitorFunc(func(param param) bool { - if err != nil { - return false - } - - var ( - k key - providers []provider - ) - switch p := param.(type) { - case paramSingle: - k = key{name: p.Name, t: p.Type} - if _, ok := visited[k]; ok { - // We've already checked the dependencies for this type. - return false - } - providers = c.getValueProviders(p.Name, p.Type) - case paramGroupedSlice: - // NOTE: The key uses the element type, not the slice type. - k = key{group: p.Group, t: p.Type.Elem()} - if _, ok := visited[k]; ok { - // We've already checked the dependencies for this type. - return false - } - providers = c.getGroupProviders(p.Group, p.Type.Elem()) - default: - // Recurse for non-edge params. - return true - } - - entry := cycleEntry{Func: n.Location(), Key: k} - - if len(path) > 0 { - // Only mark a key as visited if path exists, i.e. this is not the - // first iteration through the c.verifyAcyclic() check. Otherwise the - // early exit from checking visited above will short circuit the - // cycle check below. - visited[k] = struct{}{} - - // If it exists, the first element of path is the new addition to the - // graph, therefore it must be in any cycle that exists, assuming - // verifyAcyclic has been run for every previous Provide. - // - // Alternatively, if deferAcyclicVerification was set and detectCycles - // is only being called before the first Invoke, each node in the - // graph will be tested as the first element of the path, so any - // cycle that exists is guaranteed to trip the following condition. - if path[0].Key == k { - err = errCycleDetected{Path: append(path, entry)} - return false - } - } - - for _, n := range providers { - if e := detectCycles(n, c, append(path, entry), visited); e != nil { - err = e - return false - } - } - - return true - })) - - return err -} diff --git a/vendor/go.uber.org/dig/dig.go b/vendor/go.uber.org/dig/dig.go deleted file mode 100644 index 36df0873..00000000 --- a/vendor/go.uber.org/dig/dig.go +++ /dev/null @@ -1,774 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "errors" - "fmt" - "math/rand" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "go.uber.org/dig/internal/digreflect" - "go.uber.org/dig/internal/dot" -) - -const ( - _optionalTag = "optional" - _nameTag = "name" - _groupTag = "group" -) - -// Unique identification of an object in the graph. -type key struct { - t reflect.Type - - // Only one of name or group will be set. - name string - group string -} - -// Option configures a Container. It's included for future functionality; -// currently, there are no concrete implementations. -type Option interface { - applyOption(*Container) -} - -type optionFunc func(*Container) - -func (f optionFunc) applyOption(c *Container) { f(c) } - -type provideOptions struct { - Name string - Group string -} - -func (o *provideOptions) Validate() error { - if len(o.Group) > 0 && len(o.Name) > 0 { - return fmt.Errorf( - "cannot use named values with value groups: name:%q provided with group:%q", o.Name, o.Group) - } - - // Names must be representable inside a backquoted string. The only - // limitation for raw string literals as per - // https://golang.org/ref/spec#raw_string_lit is that they cannot contain - // backquotes. - if strings.ContainsRune(o.Name, '`') { - return fmt.Errorf("invalid dig.Name(%q): names cannot contain backquotes", o.Name) - } - if strings.ContainsRune(o.Group, '`') { - return fmt.Errorf("invalid dig.Group(%q): group names cannot contain backquotes", o.Group) - } - return nil -} - -// A ProvideOption modifies the default behavior of Provide. -type ProvideOption interface { - applyProvideOption(*provideOptions) -} - -type provideOptionFunc func(*provideOptions) - -func (f provideOptionFunc) applyProvideOption(opts *provideOptions) { f(opts) } - -// Name is a ProvideOption that specifies that all values produced by a -// constructor should have the given name. See also the package documentation -// about Named Values. -// -// Given, -// -// func NewReadOnlyConnection(...) (*Connection, error) -// func NewReadWriteConnection(...) (*Connection, error) -// -// The following will provide two connections to the container: one under the -// name "ro" and the other under the name "rw". -// -// c.Provide(NewReadOnlyConnection, dig.Name("ro")) -// c.Provide(NewReadWriteConnection, dig.Name("rw")) -// -// This option cannot be provided for constructors which produce result -// objects. -func Name(name string) ProvideOption { - return provideOptionFunc(func(opts *provideOptions) { - opts.Name = name - }) -} - -// Group is a ProvideOption that specifies that all values produced by a -// constructor should be added to the specified group. See also the package -// documentation about Value Groups. -// -// This option cannot be provided for constructors which produce result -// objects. -func Group(group string) ProvideOption { - return provideOptionFunc(func(opts *provideOptions) { - opts.Group = group - }) -} - -// An InvokeOption modifies the default behavior of Invoke. It's included for -// future functionality; currently, there are no concrete implementations. -type InvokeOption interface { - unimplemented() -} - -// Container is a directed acyclic graph of types and their dependencies. -type Container struct { - // Mapping from key to all the nodes that can provide a value for that - // key. - providers map[key][]*node - - // All nodes in the container. - nodes []*node - - // Values that have already been generated in the container. - values map[key]reflect.Value - - // Values groups that have already been generated in the container. - groups map[key][]reflect.Value - - // Source of randomness. - rand *rand.Rand - - // Flag indicating whether the graph has been checked for cycles. - isVerifiedAcyclic bool - - // Defer acyclic check on provide until Invoke. - deferAcyclicVerification bool -} - -// containerWriter provides write access to the Container's underlying data -// store. -type containerWriter interface { - // setValue sets the value with the given name and type in the container. - // If a value with the same name and type already exists, it will be - // overwritten. - setValue(name string, t reflect.Type, v reflect.Value) - - // submitGroupedValue submits a value to the value group with the provided - // name. - submitGroupedValue(name string, t reflect.Type, v reflect.Value) -} - -// containerStore provides access to the Container's underlying data store. -type containerStore interface { - containerWriter - - // Returns a slice containing all known types. - knownTypes() []reflect.Type - - // Retrieves the value with the provided name and type, if any. - getValue(name string, t reflect.Type) (v reflect.Value, ok bool) - - // Retrieves all values for the provided group and type. - // - // The order in which the values are returned is undefined. - getValueGroup(name string, t reflect.Type) []reflect.Value - - // Returns the providers that can produce a value with the given name and - // type. - getValueProviders(name string, t reflect.Type) []provider - - // Returns the providers that can produce values for the given group and - // type. - getGroupProviders(name string, t reflect.Type) []provider - - createGraph() *dot.Graph -} - -// provider encapsulates a user-provided constructor. -type provider interface { - // ID is a unique numerical identifier for this provider. - ID() dot.CtorID - - // Location returns where this constructor was defined. - Location() *digreflect.Func - - // ParamList returns information about the direct dependencies of this - // constructor. - ParamList() paramList - - // ResultList returns information about the values produced by this - // constructor. - ResultList() resultList - - // Calls the underlying constructor, reading values from the - // containerStore as needed. - // - // The values produced by this provider should be submitted into the - // containerStore. - Call(containerStore) error -} - -// New constructs a Container. -func New(opts ...Option) *Container { - c := &Container{ - providers: make(map[key][]*node), - values: make(map[key]reflect.Value), - groups: make(map[key][]reflect.Value), - rand: rand.New(rand.NewSource(time.Now().UnixNano())), - } - - for _, opt := range opts { - opt.applyOption(c) - } - return c -} - -// DeferAcyclicVerification is an Option to override the default behavior -// of container.Provide, deferring the dependency graph validation to no longer -// run after each call to container.Provide. The container will instead verify -// the graph on first `Invoke`. -// -// Applications adding providers to a container in a tight loop may experience -// performance improvements by initializing the container with this option. -func DeferAcyclicVerification() Option { - return optionFunc(func(c *Container) { - c.deferAcyclicVerification = true - }) -} - -// Changes the source of randomness for the container. -// -// This will help provide determinism during tests. -func setRand(r *rand.Rand) Option { - return optionFunc(func(c *Container) { - c.rand = r - }) -} - -func (c *Container) knownTypes() []reflect.Type { - typeSet := make(map[reflect.Type]struct{}, len(c.providers)) - for k := range c.providers { - typeSet[k.t] = struct{}{} - } - - types := make([]reflect.Type, 0, len(typeSet)) - for t := range typeSet { - types = append(types, t) - } - sort.Sort(byTypeName(types)) - return types -} - -func (c *Container) getValue(name string, t reflect.Type) (v reflect.Value, ok bool) { - v, ok = c.values[key{name: name, t: t}] - return -} - -func (c *Container) setValue(name string, t reflect.Type, v reflect.Value) { - c.values[key{name: name, t: t}] = v -} - -func (c *Container) getValueGroup(name string, t reflect.Type) []reflect.Value { - items := c.groups[key{group: name, t: t}] - // shuffle the list so users don't rely on the ordering of grouped values - return shuffledCopy(c.rand, items) -} - -func (c *Container) submitGroupedValue(name string, t reflect.Type, v reflect.Value) { - k := key{group: name, t: t} - c.groups[k] = append(c.groups[k], v) -} - -func (c *Container) getValueProviders(name string, t reflect.Type) []provider { - return c.getProviders(key{name: name, t: t}) -} - -func (c *Container) getGroupProviders(name string, t reflect.Type) []provider { - return c.getProviders(key{group: name, t: t}) -} - -func (c *Container) getProviders(k key) []provider { - nodes := c.providers[k] - providers := make([]provider, len(nodes)) - for i, n := range nodes { - providers[i] = n - } - return providers -} - -// Provide teaches the container how to build values of one or more types and -// expresses their dependencies. -// -// The first argument of Provide is a function that accepts zero or more -// parameters and returns one or more results. The function may optionally -// return an error to indicate that it failed to build the value. This -// function will be treated as the constructor for all the types it returns. -// This function will be called AT MOST ONCE when a type produced by it, or a -// type that consumes this function's output, is requested via Invoke. If the -// same types are requested multiple times, the previously produced value will -// be reused. -// -// In addition to accepting constructors that accept dependencies as separate -// arguments and produce results as separate return values, Provide also -// accepts constructors that specify dependencies as dig.In structs and/or -// specify results as dig.Out structs. -func (c *Container) Provide(constructor interface{}, opts ...ProvideOption) error { - ctype := reflect.TypeOf(constructor) - if ctype == nil { - return errors.New("can't provide an untyped nil") - } - if ctype.Kind() != reflect.Func { - return fmt.Errorf("must provide constructor function, got %v (type %v)", constructor, ctype) - } - - var options provideOptions - for _, o := range opts { - o.applyProvideOption(&options) - } - if err := options.Validate(); err != nil { - return err - } - - if err := c.provide(constructor, options); err != nil { - return errProvide{ - Func: digreflect.InspectFunc(constructor), - Reason: err, - } - } - return nil -} - -// Invoke runs the given function after instantiating its dependencies. -// -// Any arguments that the function has are treated as its dependencies. The -// dependencies are instantiated in an unspecified order along with any -// dependencies that they might have. -// -// The function may return an error to indicate failure. The error will be -// returned to the caller as-is. -func (c *Container) Invoke(function interface{}, opts ...InvokeOption) error { - ftype := reflect.TypeOf(function) - if ftype == nil { - return errors.New("can't invoke an untyped nil") - } - if ftype.Kind() != reflect.Func { - return fmt.Errorf("can't invoke non-function %v (type %v)", function, ftype) - } - - pl, err := newParamList(ftype) - if err != nil { - return err - } - - if err := shallowCheckDependencies(c, pl); err != nil { - return errMissingDependencies{ - Func: digreflect.InspectFunc(function), - Reason: err, - } - } - - if !c.isVerifiedAcyclic { - if err := c.verifyAcyclic(); err != nil { - return err - } - } - - args, err := pl.BuildList(c) - if err != nil { - return errArgumentsFailed{ - Func: digreflect.InspectFunc(function), - Reason: err, - } - } - - returned := reflect.ValueOf(function).Call(args) - if len(returned) == 0 { - return nil - } - if last := returned[len(returned)-1]; isError(last.Type()) { - if err, _ := last.Interface().(error); err != nil { - return err - } - } - return nil -} - -func (c *Container) verifyAcyclic() error { - visited := make(map[key]struct{}) - for _, n := range c.nodes { - if err := detectCycles(n, c, nil /* path */, visited); err != nil { - return errWrapf(err, "cycle detected in dependency graph") - } - } - - c.isVerifiedAcyclic = true - return nil -} - -func (c *Container) provide(ctor interface{}, opts provideOptions) error { - n, err := newNode( - ctor, - nodeOptions{ - ResultName: opts.Name, - ResultGroup: opts.Group, - }, - ) - if err != nil { - return err - } - - keys, err := c.findAndValidateResults(n) - if err != nil { - return err - } - - ctype := reflect.TypeOf(ctor) - if len(keys) == 0 { - return fmt.Errorf("%v must provide at least one non-error type", ctype) - } - - for k := range keys { - c.isVerifiedAcyclic = false - oldProviders := c.providers[k] - c.providers[k] = append(c.providers[k], n) - - if c.deferAcyclicVerification { - continue - } - if err := verifyAcyclic(c, n, k); err != nil { - c.providers[k] = oldProviders - return err - } - c.isVerifiedAcyclic = true - } - - c.nodes = append(c.nodes, n) - - return nil -} - -// Builds a collection of all result types produced by this node. -func (c *Container) findAndValidateResults(n *node) (map[key]struct{}, error) { - var err error - keyPaths := make(map[key]string) - walkResult(n.ResultList(), connectionVisitor{ - c: c, - n: n, - err: &err, - keyPaths: keyPaths, - }) - - if err != nil { - return nil, err - } - - keys := make(map[key]struct{}, len(keyPaths)) - for k := range keyPaths { - keys[k] = struct{}{} - } - return keys, nil -} - -// Visits the results of a node and compiles a collection of all the keys -// produced by that node. -type connectionVisitor struct { - c *Container - n *node - - // If this points to a non-nil value, we've already encountered an error - // and should stop traversing. - err *error - - // Map of keys provided to path that provided this. The path is a string - // documenting which positional return value or dig.Out attribute is - // providing this particular key. - // - // For example, "[0].Foo" indicates that the value was provided by the Foo - // attribute of the dig.Out returned as the first result of the - // constructor. - keyPaths map[key]string - - // We track the path to the current result here. For example, this will - // be, ["[1]", "Foo", "Bar"] when we're visiting Bar in, - // - // func() (io.Writer, struct { - // dig.Out - // - // Foo struct { - // dig.Out - // - // Bar io.Reader - // } - // }) - currentResultPath []string -} - -func (cv connectionVisitor) AnnotateWithField(f resultObjectField) resultVisitor { - cv.currentResultPath = append(cv.currentResultPath, f.FieldName) - return cv -} - -func (cv connectionVisitor) AnnotateWithPosition(i int) resultVisitor { - cv.currentResultPath = append(cv.currentResultPath, fmt.Sprintf("[%d]", i)) - return cv -} - -func (cv connectionVisitor) Visit(res result) resultVisitor { - // Already failed. Stop looking. - if *cv.err != nil { - return nil - } - - path := strings.Join(cv.currentResultPath, ".") - - switch r := res.(type) { - case resultSingle: - k := key{name: r.Name, t: r.Type} - - if conflict, ok := cv.keyPaths[k]; ok { - *cv.err = fmt.Errorf( - "cannot provide %v from %v: already provided by %v", - k, path, conflict) - return nil - } - - if ps := cv.c.providers[k]; len(ps) > 0 { - cons := make([]string, len(ps)) - for i, p := range ps { - cons[i] = fmt.Sprint(p.Location()) - } - - *cv.err = fmt.Errorf( - "cannot provide %v from %v: already provided by %v", - k, path, strings.Join(cons, "; ")) - return nil - } - - cv.keyPaths[k] = path - - case resultGrouped: - // we don't really care about the path for this since conflicts are - // okay for group results. We'll track it for the sake of having a - // value there. - k := key{group: r.Group, t: r.Type} - cv.keyPaths[k] = path - } - - return cv -} - -// node is a node in the dependency graph. Each node maps to a single -// constructor provided by the user. -// -// Nodes can produce zero or more values that they store into the container. -// For the Provide path, we verify that nodes produce at least one value, -// otherwise the function will never be called. -type node struct { - ctor interface{} - ctype reflect.Type - - // Location where this function was defined. - location *digreflect.Func - - // id uniquely identifies the constructor that produces a node. - id dot.CtorID - - // Whether the constructor owned by this node was already called. - called bool - - // Type information about constructor parameters. - paramList paramList - - // Type information about constructor results. - resultList resultList -} - -type nodeOptions struct { - // If specified, all values produced by this node have the provided name - // or belong to the specified value group - ResultName string - ResultGroup string -} - -func newNode(ctor interface{}, opts nodeOptions) (*node, error) { - cval := reflect.ValueOf(ctor) - ctype := cval.Type() - cptr := cval.Pointer() - - params, err := newParamList(ctype) - if err != nil { - return nil, err - } - - results, err := newResultList( - ctype, - resultOptions{ - Name: opts.ResultName, - Group: opts.ResultGroup, - }, - ) - if err != nil { - return nil, err - } - - return &node{ - ctor: ctor, - ctype: ctype, - location: digreflect.InspectFunc(ctor), - id: dot.CtorID(cptr), - paramList: params, - resultList: results, - }, err -} - -func (n *node) Location() *digreflect.Func { return n.location } -func (n *node) ParamList() paramList { return n.paramList } -func (n *node) ResultList() resultList { return n.resultList } -func (n *node) ID() dot.CtorID { return n.id } - -// Call calls this node's constructor if it hasn't already been called and -// injects any values produced by it into the provided container. -func (n *node) Call(c containerStore) error { - if n.called { - return nil - } - - if err := shallowCheckDependencies(c, n.paramList); err != nil { - return errMissingDependencies{ - Func: n.location, - Reason: err, - } - } - - args, err := n.paramList.BuildList(c) - if err != nil { - return errArgumentsFailed{ - Func: n.location, - Reason: err, - } - } - - receiver := newStagingContainerWriter() - results := reflect.ValueOf(n.ctor).Call(args) - if err := n.resultList.ExtractList(receiver, results); err != nil { - return errConstructorFailed{Func: n.location, Reason: err} - } - receiver.Commit(c) - n.called = true - return nil -} - -// Checks if a field of an In struct is optional. -func isFieldOptional(f reflect.StructField) (bool, error) { - tag := f.Tag.Get(_optionalTag) - if tag == "" { - return false, nil - } - - optional, err := strconv.ParseBool(tag) - if err != nil { - err = errWrapf(err, - "invalid value %q for %q tag on field %v", - tag, _optionalTag, f.Name) - } - - return optional, err -} - -// Checks that all direct dependencies of the provided param are present in -// the container. Returns an error if not. -func shallowCheckDependencies(c containerStore, p param) error { - var missing errMissingManyTypes - var addMissingNodes []*dot.Param - walkParam(p, paramVisitorFunc(func(p param) bool { - ps, ok := p.(paramSingle) - if !ok { - return true - } - - if ns := c.getValueProviders(ps.Name, ps.Type); len(ns) == 0 && !ps.Optional { - missing = append(missing, newErrMissingType(c, key{name: ps.Name, t: ps.Type})) - addMissingNodes = append(addMissingNodes, ps.DotParam()...) - } - - return true - })) - - if len(missing) > 0 { - return missing - } - return nil -} - -// stagingContainerWriter is a containerWriter that records the changes that -// would be made to a containerWriter and defers them until Commit is called. -type stagingContainerWriter struct { - values map[key]reflect.Value - groups map[key][]reflect.Value -} - -var _ containerWriter = (*stagingContainerWriter)(nil) - -func newStagingContainerWriter() *stagingContainerWriter { - return &stagingContainerWriter{ - values: make(map[key]reflect.Value), - groups: make(map[key][]reflect.Value), - } -} - -func (sr *stagingContainerWriter) setValue(name string, t reflect.Type, v reflect.Value) { - sr.values[key{t: t, name: name}] = v -} - -func (sr *stagingContainerWriter) submitGroupedValue(group string, t reflect.Type, v reflect.Value) { - k := key{t: t, group: group} - sr.groups[k] = append(sr.groups[k], v) -} - -// Commit commits the received results to the provided containerWriter. -func (sr *stagingContainerWriter) Commit(cw containerWriter) { - for k, v := range sr.values { - cw.setValue(k.name, k.t, v) - } - - for k, vs := range sr.groups { - for _, v := range vs { - cw.submitGroupedValue(k.group, k.t, v) - } - } -} - -type byTypeName []reflect.Type - -func (bs byTypeName) Len() int { - return len(bs) -} - -func (bs byTypeName) Less(i int, j int) bool { - return fmt.Sprint(bs[i]) < fmt.Sprint(bs[j]) -} - -func (bs byTypeName) Swap(i int, j int) { - bs[i], bs[j] = bs[j], bs[i] -} - -func shuffledCopy(rand *rand.Rand, items []reflect.Value) []reflect.Value { - newItems := make([]reflect.Value, len(items)) - for i, j := range rand.Perm(len(items)) { - newItems[i] = items[j] - } - return newItems -} diff --git a/vendor/go.uber.org/dig/doc.go b/vendor/go.uber.org/dig/doc.go deleted file mode 100644 index f1172b5c..00000000 --- a/vendor/go.uber.org/dig/doc.go +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package dig provides an opinionated way of resolving object dependencies. -// -// Status -// -// STABLE. No breaking changes will be made in this major version. -// -// Container -// -// Dig exposes type Container as an object capable of resolving a directed -// acyclic dependency graph. Use the New function to create one. -// -// c := dig.New() -// -// Provide -// -// Constructors for different types are added to the container by using the -// Provide method. A constructor can declare a dependency on another type by -// simply adding it as a function parameter. Dependencies for a type can be -// added to the graph both, before and after the type was added. -// -// err := c.Provide(func(conn *sql.DB) (*UserGateway, error) { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// if err := c.Provide(newDBConnection); err != nil { -// // ... -// } -// -// Multiple constructors can rely on the same type. The container creates a -// singleton for each retained type, instantiating it at most once when -// requested directly or as a dependency of another type. -// -// err := c.Provide(func(conn *sql.DB) *CommentGateway { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// Constructors can declare any number of dependencies as parameters and -// optionally, return errors. -// -// err := c.Provide(func(u *UserGateway, c *CommentGateway) (*RequestHandler, error) { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// if err := c.Provide(newHTTPServer); err != nil { -// // ... -// } -// -// Constructors can also return multiple results to add multiple types to the -// container. -// -// err := c.Provide(func(conn *sql.DB) (*UserGateway, *CommentGateway, error) { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// Constructors that accept a variadic number of arguments are treated as if -// they don't have those arguments. That is, -// -// func NewVoteGateway(db *sql.DB, options ...Option) *VoteGateway -// -// Is treated the same as, -// -// func NewVoteGateway(db *sql.DB) *VoteGateway -// -// The constructor will be called with all other dependencies and no variadic -// arguments. -// -// Invoke -// -// Types added to to the container may be consumed by using the Invoke method. -// Invoke accepts any function that accepts one or more parameters and -// optionally, returns an error. Dig calls the function with the requested -// type, instantiating only those types that were requested by the function. -// The call fails if any type or its dependencies (both direct and transitive) -// were not available in the container. -// -// err := c.Invoke(func(l *log.Logger) { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// err := c.Invoke(func(server *http.Server) error { -// // ... -// }) -// if err != nil { -// // ... -// } -// -// Any error returned by the invoked function is propagated back to the -// caller. -// -// Parameter Objects -// -// Constructors declare their dependencies as function parameters. This can -// very quickly become unreadable if the constructor has a lot of -// dependencies. -// -// func NewHandler(users *UserGateway, comments *CommentGateway, posts *PostGateway, votes *VoteGateway, authz *AuthZGateway) *Handler { -// // ... -// } -// -// A pattern employed to improve readability in a situation like this is to -// create a struct that lists all the parameters of the function as fields and -// changing the function to accept that struct instead. This is referred to as -// a parameter object. -// -// Dig has first class support for parameter objects: any struct embedding -// dig.In gets treated as a parameter object. The following is equivalent to -// the constructor above. -// -// type HandlerParams struct { -// dig.In -// -// Users *UserGateway -// Comments *CommentGateway -// Posts *PostGateway -// Votes *VoteGateway -// AuthZ *AuthZGateway -// } -// -// func NewHandler(p HandlerParams) *Handler { -// // ... -// } -// -// Handlers can receive any combination of parameter objects and parameters. -// -// func NewHandler(p HandlerParams, l *log.Logger) *Handler { -// // ... -// } -// -// Result Objects -// -// Result objects are the flip side of parameter objects. These are structs -// that represent multiple outputs from a single function as fields in the -// struct. Structs embedding dig.Out get treated as result objects. -// -// func SetupGateways(conn *sql.DB) (*UserGateway, *CommentGateway, *PostGateway, error) { -// // ... -// } -// -// The above is equivalent to, -// -// type Gateways struct { -// dig.Out -// -// Users *UserGateway -// Comments *CommentGateway -// Posts *PostGateway -// } -// -// func SetupGateways(conn *sql.DB) (Gateways, error) { -// // ... -// } -// -// Optional Dependencies -// -// Constructors often don't have a hard dependency on some types and -// are able to operate in a degraded state when that dependency is missing. -// Dig supports declaring dependencies as optional by adding an -// `optional:"true"` tag to fields of a dig.In struct. -// -// Fields in a dig.In structs that have the `optional:"true"` tag are treated -// as optional by Dig. -// -// type UserGatewayParams struct { -// dig.In -// -// Conn *sql.DB -// Cache *redis.Client `optional:"true"` -// } -// -// If an optional field is not available in the container, the constructor -// will receive a zero value for the field. -// -// func NewUserGateway(p UserGatewayParams, log *log.Logger) (*UserGateway, error) { -// if p.Cache != nil { -// log.Print("Logging disabled") -// } -// // ... -// } -// -// Constructors that declare dependencies as optional MUST handle the case of -// those dependencies being absent. -// -// The optional tag also allows adding new dependencies without breaking -// existing consumers of the constructor. -// -// Named Values -// -// Some use cases call for multiple values of the same type. Dig allows adding -// multiple values of the same type to the container with the use of Named -// Values. -// -// Named Values can be produced by passing the dig.Name option when a -// constructor is provided. All values produced by that constructor will have -// the given name. -// -// Given the following constructors, -// -// func NewReadOnlyConnection(...) (*sql.DB, error) -// func NewReadWriteConnection(...) (*sql.DB, error) -// -// You can provide *sql.DB into a Container under different names by passing -// the dig.Name option. -// -// c.Provide(NewReadOnlyConnection, dig.Name("ro")) -// c.Provide(NewReadWriteConnection, dig.Name("rw")) -// -// Alternatively, you can produce a dig.Out struct and tag its fields with -// `name:".."` to have the corresponding value added to the graph under the -// specified name. -// -// type ConnectionResult struct { -// dig.Out -// -// ReadWrite *sql.DB `name:"rw"` -// ReadOnly *sql.DB `name:"ro"` -// } -// -// func ConnectToDatabase(...) (ConnectionResult, error) { -// // ... -// return ConnectionResult{ReadWrite: rw, ReadOnly: ro}, nil -// } -// -// Regardless of how a Named Value was produced, it can be consumed by another -// constructor by accepting a dig.In struct which has exported fields with the -// same name AND type that you provided. -// -// type GatewayParams struct { -// dig.In -// -// WriteToConn *sql.DB `name:"rw"` -// ReadFromConn *sql.DB `name:"ro"` -// } -// -// The name tag may be combined with the optional tag to declare the -// dependency optional. -// -// type GatewayParams struct { -// dig.In -// -// WriteToConn *sql.DB `name:"rw"` -// ReadFromConn *sql.DB `name:"ro" optional:"true"` -// } -// -// func NewCommentGateway(p GatewayParams, log *log.Logger) (*CommentGateway, error) { -// if p.ReadFromConn == nil { -// log.Print("Warning: Using RW connection for reads") -// p.ReadFromConn = p.WriteToConn -// } -// // ... -// } -// -// Value Groups -// -// Added in Dig 1.2. -// -// Dig provides value groups to allow producing and consuming many values of -// the same type. Value groups allow constructors to send values to a named, -// unordered collection in the container. Other constructors can request all -// values in this collection as a slice. -// -// Constructors can send values into value groups by returning a dig.Out -// struct tagged with `group:".."`. -// -// type HandlerResult struct { -// dig.Out -// -// Handler Handler `group:"server"` -// } -// -// func NewHelloHandler() HandlerResult { -// .. -// } -// -// func NewEchoHandler() HandlerResult { -// .. -// } -// -// Any number of constructors may provide values to this named collection. -// Other constructors can request all values for this collection by requesting -// a slice tagged with `group:".."`. This will execute all constructors that -// provide a value to that group in an unspecified order. -// -// type ServerParams struct { -// dig.In -// -// Handlers []Handler `group:"server"` -// } -// -// func NewServer(p ServerParams) *Server { -// server := newServer() -// for _, h := range p.Handlers { -// server.Register(h) -// } -// return server -// } -// -// Note that values in a value group are unordered. Dig makes no guarantees -// about the order in which these values will be produced. -package dig // import "go.uber.org/dig" diff --git a/vendor/go.uber.org/dig/error.go b/vendor/go.uber.org/dig/error.go deleted file mode 100644 index 6bf3d012..00000000 --- a/vendor/go.uber.org/dig/error.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "bytes" - "fmt" - "reflect" - "sort" - - "go.uber.org/dig/internal/digreflect" - "go.uber.org/dig/internal/dot" -) - -// Errors which know their underlying cause should implement this interface to -// be compatible with RootCause. -// -// We use an unexported "cause" method instead of "Cause" because we don't -// want dig-internal causes to be confused with the cause of the user-provided -// errors. (For example, if the users are using github.com/pkg/errors.) -type causer interface { - cause() error -} - -// RootCause returns the original error that caused the provided dig failure. -// -// RootCause may be used on errors returned by Invoke to get the original -// error returned by a constructor or invoked function. -func RootCause(err error) error { - for { - if e, ok := err.(causer); ok { - err = e.cause() - } else { - return err - } - } -} - -// errWrapf wraps an existing error with more contextual information. -// -// The given error is treated as the cause of the returned error (see causer). -// -// RootCause(errWrapf(errWrapf(err, ...), ...)) == err -// -// Use errWrapf instead of fmt.Errorf if the message ends with ": ". -func errWrapf(err error, msg string, args ...interface{}) error { - if err == nil { - return nil - } - - if len(args) > 0 { - msg = fmt.Sprintf(msg, args...) - } - - return wrappedError{err: err, msg: msg} -} - -type wrappedError struct { - err error - msg string -} - -func (e wrappedError) cause() error { return e.err } - -func (e wrappedError) Error() string { - return fmt.Sprintf("%v: %v", e.msg, e.err) -} - -// errProvide is returned when a constructor could not be Provided into the -// container. -type errProvide struct { - Func *digreflect.Func - Reason error -} - -func (e errProvide) cause() error { return e.Reason } - -func (e errProvide) Error() string { - return fmt.Sprintf("function %v cannot be provided: %v", e.Func, e.Reason) -} - -// errConstructorFailed is returned when a user-provided constructor failed -// with a non-nil error. -type errConstructorFailed struct { - Func *digreflect.Func - Reason error -} - -func (e errConstructorFailed) cause() error { return e.Reason } - -func (e errConstructorFailed) Error() string { - return fmt.Sprintf("function %v returned a non-nil error: %v", e.Func, e.Reason) -} - -// errArgumentsFailed is returned when a function could not be run because one -// of its dependencies failed to build for any reason. -type errArgumentsFailed struct { - Func *digreflect.Func - Reason error -} - -func (e errArgumentsFailed) cause() error { return e.Reason } - -func (e errArgumentsFailed) Error() string { - return fmt.Sprintf("could not build arguments for function %v: %v", e.Func, e.Reason) -} - -// errMissingDependencies is returned when the dependencies of a function are -// not available in the container. -type errMissingDependencies struct { - Func *digreflect.Func - Reason error -} - -func (e errMissingDependencies) cause() error { return e.Reason } - -func (e errMissingDependencies) Error() string { - return fmt.Sprintf("missing dependencies for function %v: %v", e.Func, e.Reason) -} - -// errParamSingleFailed is returned when a paramSingle could not be built. -type errParamSingleFailed struct { - Key key - Reason error - CtorID dot.CtorID -} - -func (e errParamSingleFailed) cause() error { return e.Reason } - -func (e errParamSingleFailed) Error() string { - return fmt.Sprintf("failed to build %v: %v", e.Key, e.Reason) -} - -func (e errParamSingleFailed) updateGraph(g *dot.Graph) { - failed := &dot.Result{ - Node: &dot.Node{ - Name: e.Key.name, - Group: e.Key.group, - Type: e.Key.t, - }, - } - g.FailNodes([]*dot.Result{failed}, e.CtorID) -} - -// errParamGroupFailed is returned when a value group cannot be built because -// any of the values in the group failed to build. -type errParamGroupFailed struct { - Key key - Reason error - CtorID dot.CtorID -} - -func (e errParamGroupFailed) cause() error { return e.Reason } - -func (e errParamGroupFailed) Error() string { - return fmt.Sprintf("could not build value group %v: %v", e.Key, e.Reason) -} - -func (e errParamGroupFailed) updateGraph(g *dot.Graph) { - g.FailGroupNodes(e.Key.group, e.Key.t, e.CtorID) -} - -// errMissingType is returned when a single value that was expected in the -// container was not available. -type errMissingType struct { - Key key - - // If non-empty, we will include suggestions for what the user may have - // meant. - suggestions []key -} - -func newErrMissingType(c containerStore, k key) errMissingType { - // Possible types we will look for in the container. We will always look - // for pointers to the requested type and some extras on a per-Kind basis. - - suggestions := []reflect.Type{reflect.PtrTo(k.t)} - if k.t.Kind() == reflect.Ptr { - // The user requested a pointer but maybe we have a value. - suggestions = append(suggestions, k.t.Elem()) - } - - knownTypes := c.knownTypes() - if k.t.Kind() == reflect.Interface { - // Maybe we have an implementation of the interface. - for _, t := range knownTypes { - if t.Implements(k.t) { - suggestions = append(suggestions, t) - } - } - } else { - // Maybe we have an interface that this type implements. - for _, t := range knownTypes { - if t.Kind() == reflect.Interface { - if k.t.Implements(t) { - suggestions = append(suggestions, t) - } - } - } - } - - // range through c.providers is non-deterministic. Let's sort the list of - // suggestions. - sort.Sort(byTypeName(suggestions)) - - err := errMissingType{Key: k} - for _, t := range suggestions { - if len(c.getValueProviders(k.name, t)) > 0 { - k.t = t - err.suggestions = append(err.suggestions, k) - } - } - - return err -} - -func (e errMissingType) Error() string { - // Sample messages: - // - // type io.Reader is not in the container, did you mean to Provide it? - // type io.Reader is not in the container, did you mean to use one of *bytes.Buffer, *MyBuffer - // type bytes.Buffer is not in the container, did you mean to use *bytes.Buffer? - // type *foo[name="bar"] is not in the container, did you mean to use foo[name="bar"]? - - b := new(bytes.Buffer) - - fmt.Fprintf(b, "type %v is not in the container", e.Key) - switch len(e.suggestions) { - case 0: - b.WriteString(", did you mean to Provide it?") - case 1: - fmt.Fprintf(b, ", did you mean to use %v?", e.suggestions[0]) - default: - b.WriteString(", did you mean to use one of ") - for i, k := range e.suggestions { - if i > 0 { - b.WriteString(", ") - if i == len(e.suggestions)-1 { - b.WriteString("or ") - } - } - fmt.Fprint(b, k) - } - b.WriteString("?") - } - - return b.String() -} - -// errMissingManyTypes combines multiple errMissingType errors. -type errMissingManyTypes []errMissingType // length must be non-zero - -func (e errMissingManyTypes) Error() string { - if len(e) == 1 { - return e[0].Error() - } - - b := new(bytes.Buffer) - - b.WriteString("the following types are not in the container: ") - for i, err := range e { - if i > 0 { - b.WriteString("; ") - } - fmt.Fprintf(b, "%v", err.Key) - switch len(err.suggestions) { - case 0: - // do nothing - case 1: - fmt.Fprintf(b, " (did you mean %v?)", err.suggestions[0]) - default: - b.WriteString(" (did you mean ") - for i, k := range err.suggestions { - if i > 0 { - b.WriteString(", ") - if i == len(err.suggestions)-1 { - b.WriteString("or ") - } - } - fmt.Fprint(b, k) - } - b.WriteString("?)") - } - } - - return b.String() -} - -func (e errMissingManyTypes) updateGraph(g *dot.Graph) { - missing := make([]*dot.Result, len(e)) - - for i, err := range e { - missing[i] = &dot.Result{ - Node: &dot.Node{ - Name: err.Key.name, - Group: err.Key.group, - Type: err.Key.t, - }, - } - } - g.AddMissingNodes(missing) -} - -type errVisualizer interface { - updateGraph(*dot.Graph) -} diff --git a/vendor/go.uber.org/dig/glide.lock b/vendor/go.uber.org/dig/glide.lock deleted file mode 100644 index f9d27846..00000000 --- a/vendor/go.uber.org/dig/glide.lock +++ /dev/null @@ -1,17 +0,0 @@ -hash: b6270b9f130f8c89f82156ca8d44cb16a3311c7a04746f2805f02c2f72bb58ec -updated: 2017-10-25T09:30:43.315666535-07:00 -imports: [] -testImports: -- name: github.com/davecgh/go-spew - version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: d77da356e56a7428ad25149ca77381849a6a5232 - subpackages: - - assert - - require diff --git a/vendor/go.uber.org/dig/glide.yaml b/vendor/go.uber.org/dig/glide.yaml deleted file mode 100644 index 972b804c..00000000 --- a/vendor/go.uber.org/dig/glide.yaml +++ /dev/null @@ -1,7 +0,0 @@ -package: go.uber.org/dig -license: MIT -testImport: -- package: github.com/stretchr/testify - subpackages: - - assert - - require diff --git a/vendor/go.uber.org/dig/graph.go b/vendor/go.uber.org/dig/graph.go deleted file mode 100644 index dd8e8229..00000000 --- a/vendor/go.uber.org/dig/graph.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "io" - "strconv" - "text/template" - - "go.uber.org/dig/internal/dot" -) - -// A VisualizeOption modifies the default behavior of Visualize. -type VisualizeOption interface { - applyVisualizeOption(*visualizeOptions) -} - -type visualizeOptions struct { - VisualizeError error -} - -type visualizeOptionFunc func(*visualizeOptions) - -func (f visualizeOptionFunc) applyVisualizeOption(opts *visualizeOptions) { f(opts) } - -// VisualizeError includes a visualization of the given error in the output of -// Visualize if an error was returned by Invoke or Provide. -// -// if err := c.Provide(...); err != nil { -// dig.Visualize(c, w, dig.VisualizeError(err)) -// } -// -// This option has no effect if the error was nil or if it didn't contain any -// information to visualize. -func VisualizeError(err error) VisualizeOption { - return visualizeOptionFunc(func(opts *visualizeOptions) { - opts.VisualizeError = err - }) -} - -func updateGraph(dg *dot.Graph, err error) error { - var errors []errVisualizer - // Unwrap error to find the root cause. - for { - if ev, ok := err.(errVisualizer); ok { - errors = append(errors, ev) - } - e, ok := err.(causer) - if !ok { - break - } - err = e.cause() - } - - // If there are no errVisualizers included, we do not modify the graph. - if len(errors) == 0 { - return nil - } - - // We iterate in reverse because the last element is the root cause. - for i := len(errors) - 1; i >= 0; i-- { - errors[i].updateGraph(dg) - } - - // Remove non-error entries from the graph for readability. - dg.PruneSuccess() - - return nil -} - -var _graphTmpl = template.Must( - template.New("DotGraph"). - Funcs(template.FuncMap{ - "quote": strconv.Quote, - }). - Parse(`digraph { - rankdir=RL; - graph [compound=true]; - {{range $g := .Groups}} - {{- quote .String}} [{{.Attributes}}]; - {{range .Results}} - {{- quote $g.String}} -> {{quote .String}}; - {{end}} - {{end -}} - {{range $index, $ctor := .Ctors}} - subgraph cluster_{{$index}} { - constructor_{{$index}} [shape=plaintext label={{quote .Name}}]; - {{with .ErrorType}}color={{.Color}};{{end}} - {{range .Results}} - {{- quote .String}} [{{.Attributes}}]; - {{end}} - } - {{range .Params}} - constructor_{{$index}} -> {{quote .String}} [ltail=cluster_{{$index}}{{if .Optional}} style=dashed{{end}}]; - {{end}} - {{range .GroupParams}} - constructor_{{$index}} -> {{quote .String}} [ltail=cluster_{{$index}}]; - {{end -}} - {{end}} - {{range .Failed.TransitiveFailures}} - {{- quote .String}} [color=orange]; - {{end -}} - {{range .Failed.RootCauses}} - {{- quote .String}} [color=red]; - {{end}} -}`)) - -// Visualize parses the graph in Container c into DOT format and writes it to -// io.Writer w. -func Visualize(c *Container, w io.Writer, opts ...VisualizeOption) error { - dg := c.createGraph() - - var options visualizeOptions - for _, o := range opts { - o.applyVisualizeOption(&options) - } - - if options.VisualizeError != nil { - if err := updateGraph(dg, options.VisualizeError); err != nil { - return err - } - } - - return _graphTmpl.Execute(w, dg) -} - -// CanVisualizeError returns true if the error is an errVisualizer. -func CanVisualizeError(err error) bool { - for { - if _, ok := err.(errVisualizer); ok { - return true - } - e, ok := err.(causer) - if !ok { - break - } - err = e.cause() - } - - return false -} - -func (c *Container) createGraph() *dot.Graph { - dg := dot.NewGraph() - - for _, n := range c.nodes { - dg.AddCtor(newDotCtor(n), n.paramList.DotParam(), n.resultList.DotResult()) - } - - return dg -} - -func newDotCtor(n *node) *dot.Ctor { - return &dot.Ctor{ - ID: n.id, - Name: n.location.Name, - Package: n.location.Package, - File: n.location.File, - Line: n.location.Line, - } -} diff --git a/vendor/go.uber.org/dig/internal/digreflect/func.go b/vendor/go.uber.org/dig/internal/digreflect/func.go deleted file mode 100644 index 05758ce5..00000000 --- a/vendor/go.uber.org/dig/internal/digreflect/func.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package digreflect - -import ( - "fmt" - "net/url" - "reflect" - "runtime" - "strings" -) - -// Func contains runtime information about a function. -type Func struct { - // Name of the function. - Name string - - // Name of the package in which this function is defined. - Package string - - // Path to the file in which this function is defined. - File string - - // Line number in the file at which this function is defined. - Line int -} - -// String returns a string representation of the function. -func (f *Func) String() string { - // "path/to/package".MyFunction (path/to/file.go:42) - return fmt.Sprintf("%q.%v (%v:%v)", f.Package, f.Name, f.File, f.Line) -} - -// InspectFunc inspects and returns runtime information about the given -// function. -func InspectFunc(function interface{}) *Func { - fptr := reflect.ValueOf(function).Pointer() - f := runtime.FuncForPC(fptr) - pkgName, funcName := splitFuncName(f.Name()) - fileName, lineNum := f.FileLine(fptr) - return &Func{ - Name: funcName, - Package: pkgName, - File: fileName, - Line: lineNum, - } -} - -const _vendor = "/vendor/" - -func splitFuncName(function string) (pname string, fname string) { - if len(function) == 0 { - return - } - - // We have something like "path.to/my/pkg.MyFunction". If the function is - // a closure, it is something like, "path.to/my/pkg.MyFunction.func1". - - idx := 0 - - // Everything up to the first "." after the last "/" is the package name. - // Everything after the "." is the full function name. - if i := strings.LastIndex(function, "/"); i >= 0 { - idx = i - } - if i := strings.Index(function[idx:], "."); i >= 0 { - idx += i - } - pname, fname = function[:idx], function[idx+1:] - - // The package may be vendored. - if i := strings.Index(pname, _vendor); i > 0 { - pname = pname[i+len(_vendor):] - } - - // Package names are URL-encoded to avoid ambiguity in the case where the - // package name contains ".git". Otherwise, "foo/bar.git.MyFunction" would - // mean that "git" is the top-level function and "MyFunction" is embedded - // inside it. - if unescaped, err := url.QueryUnescape(pname); err == nil { - pname = unescaped - } - - return -} diff --git a/vendor/go.uber.org/dig/internal/dot/README.md b/vendor/go.uber.org/dig/internal/dot/README.md deleted file mode 100644 index 1198ade5..00000000 --- a/vendor/go.uber.org/dig/internal/dot/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# Dot - -The dot module generates a DOT file representation of a dependency graph. - -## Interpreting the graph - -The graph should be read from left to right. The leftmost node in the graph (the root node) depends -on its dependency tree to the right. An arrow from node_a to node_b in the graph means that node_b -is consumed by node_a and that node_b is a parameter of node_a. The rendered graph holds the -following kinds of nodes, - -**Nodes:** - -- *Constructors* [Rectangles]: Takes parameters and produces results. -- *Results* [Ovals]: Results inside a constructor are produced by that constructor. Results are consumed -directly by other constructors and/or part of a group of results. -- *Groups* [Diamonds]: Represent value groups in [fx](https://godoc.org/go.uber.org/fx). Multiple results can form a group. Any -result linked to a group by an edge are members of that group. A group is a collection of results. -Groups can also be parameters of constructors. - -**Edges:** - -- *Solid Arrows*: An arrow from node_a to node_b means that node_b is a parameter of node_a and that -node_a depends on node_b. -- *Dashed Arrows*: A dashed arrow from node_a to node_b represents an optional dependency that node_a -has on node_b. - -**Graph Colors:** - -- *Red*: Graph nodes are the root cause failures. -- *Orange*: Graph nodes are the transitive failures. - -## Testing and verifying changes - -Unit tests and visualize golden tests are run with - -```shell -$ make test -``` - -You can visualize the effect of your code changes by visualizing generated test graphs as pngs. - -In the dig root directory, generate the graph DOT files with respect to your latest code changes. - -```shell -$ go test -generate -``` - -Assuming that you have [graphviz](https://www.graphviz.org/) installed and are in the testdata directory, -generate a png image representation of a graph for viewing. - -```shell -$ dot -Tpng ${name_of_dot_file_in_testdata}.dot -o ${name_of_dot_file_in_testdata}.png -$ open ${name_of_dot_file_in_testdata}.png -``` - -## Graph Pruning - -If dot.Visualize is used to visualize an error graph, non-failing nodes are pruned out of the graph -to make the error graph more readable to the user. Pruning increases readability since successful -nodes clutter the graph and do not help the user debug errors. diff --git a/vendor/go.uber.org/dig/internal/dot/graph.go b/vendor/go.uber.org/dig/internal/dot/graph.go deleted file mode 100644 index 3706fa11..00000000 --- a/vendor/go.uber.org/dig/internal/dot/graph.go +++ /dev/null @@ -1,466 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dot - -import ( - "fmt" - "reflect" -) - -// ErrorType of a constructor or group is updated when they fail to build. -type ErrorType int - -const ( - noError ErrorType = iota - rootCause - transitiveFailure -) - -// CtorID is a unique numeric identifier for constructors. -type CtorID uintptr - -// Ctor encodes a constructor provided to the container for the DOT graph. -type Ctor struct { - Name string - Package string - File string - Line int - ID CtorID - Params []*Param - GroupParams []*Group - Results []*Result - ErrorType ErrorType -} - -// removeParam deletes the dependency on the provided result's nodeKey. -// This is used to prune links to results of deleted constructors. -func (c *Ctor) removeParam(k nodeKey) { - var pruned []*Param - for _, p := range c.Params { - if k != p.nodeKey() { - pruned = append(pruned, p) - } - } - c.Params = pruned -} - -type nodeKey struct { - t reflect.Type - name string - group string -} - -// Node is a single node in a graph and is embedded into Params and Results. -type Node struct { - Type reflect.Type - Name string - Group string -} - -func (n *Node) nodeKey() nodeKey { - return nodeKey{t: n.Type, name: n.Name, group: n.Group} -} - -// Param is a parameter node in the graph. Parameters are the input to constructors. -type Param struct { - *Node - - Optional bool -} - -// Result is a result node in the graph. Results are the output of constructors. -type Result struct { - *Node - - // GroupIndex is added to differentiate grouped values from one another. - // Since grouped values have the same type and group, their Node / string - // representations are the same so we need indices to uniquely identify - // the values. - GroupIndex int -} - -// Group is a group node in the graph. Group represents an fx value group. -type Group struct { - // Type is the type of values in the group. - Type reflect.Type - Name string - Results []*Result - ErrorType ErrorType -} - -func (g *Group) nodeKey() nodeKey { - return nodeKey{t: g.Type, group: g.Name} -} - -// TODO(rhang): Avoid linear search to discover group results that should be pruned. -func (g *Group) removeResult(r *Result) { - var pruned []*Result - for _, rg := range g.Results { - if r.GroupIndex != rg.GroupIndex { - pruned = append(pruned, rg) - } - } - g.Results = pruned -} - -// Graph is the DOT-format graph in a Container. -type Graph struct { - Ctors []*Ctor - ctorMap map[CtorID]*Ctor - - Groups []*Group - groupMap map[nodeKey]*Group - - consumers map[nodeKey][]*Ctor - - Failed *FailedNodes -} - -// FailedNodes is the nodes that failed in the graph. -type FailedNodes struct { - // RootCauses is a list of the point of failures. They are the root causes - // of failed invokes and can be either missing types (not provided) or - // error types (error providing). - RootCauses []*Result - - // TransitiveFailures is the list of nodes that failed to build due to - // missing/failed dependencies. - TransitiveFailures []*Result - - // ctors is a collection of failed constructors IDs that are populated as the graph is - // traversed for errors. - ctors map[CtorID]struct{} - - // Groups is a collection of failed groupKeys that is populated as the graph is traversed - // for errors. - groups map[nodeKey]struct{} -} - -// NewGraph creates an empty graph. -func NewGraph() *Graph { - return &Graph{ - ctorMap: make(map[CtorID]*Ctor), - groupMap: make(map[nodeKey]*Group), - consumers: make(map[nodeKey][]*Ctor), - Failed: &FailedNodes{ - ctors: make(map[CtorID]struct{}), - groups: make(map[nodeKey]struct{}), - }, - } -} - -// NewGroup creates a new group with information in the groupKey. -func NewGroup(k nodeKey) *Group { - return &Group{ - Type: k.t, - Name: k.group, - } -} - -// AddCtor adds the constructor with paramList and resultList into the graph. -func (dg *Graph) AddCtor(c *Ctor, paramList []*Param, resultList []*Result) { - var ( - params []*Param - groupParams []*Group - ) - - // Loop through the paramList to separate them into regular params and - // grouped params. For grouped params, we use getGroup to find the actual - // group. - for _, param := range paramList { - if param.Group == "" { - // Not a value group. - params = append(params, param) - continue - } - - k := nodeKey{t: param.Type.Elem(), group: param.Group} - group := dg.getGroup(k) - groupParams = append(groupParams, group) - } - - for _, result := range resultList { - // If the result is a grouped value, we want to update its GroupIndex - // and add it to the Group. - if result.Group != "" { - dg.addToGroup(result, c.ID) - } - } - - c.Params = params - c.GroupParams = groupParams - c.Results = resultList - - // Track which constructors consume a parameter. - for _, p := range paramList { - k := p.nodeKey() - dg.consumers[k] = append(dg.consumers[k], c) - } - - dg.Ctors = append(dg.Ctors, c) - dg.ctorMap[c.ID] = c -} - -func (dg *Graph) failNode(r *Result, isRootCause bool) { - if isRootCause { - dg.addRootCause(r) - } else { - dg.addTransitiveFailure(r) - } -} - -// AddMissingNodes adds missing nodes to the list of failed Results in the graph. -func (dg *Graph) AddMissingNodes(results []*Result) { - // The failure(s) are root causes if there are no other failures. - isRootCause := len(dg.Failed.RootCauses) == 0 - - for _, r := range results { - dg.failNode(r, isRootCause) - } -} - -// FailNodes adds results to the list of failed Results in the graph, and -// updates the state of the constructor with the given id accordingly. -func (dg *Graph) FailNodes(results []*Result, id CtorID) { - // This failure is the root cause if there are no other failures. - isRootCause := len(dg.Failed.RootCauses) == 0 - dg.Failed.ctors[id] = struct{}{} - - for _, r := range results { - dg.failNode(r, isRootCause) - } - - if c, ok := dg.ctorMap[id]; ok { - if isRootCause { - c.ErrorType = rootCause - } else { - c.ErrorType = transitiveFailure - } - } -} - -// FailGroupNodes finds and adds the failed grouped nodes to the list of failed -// Results in the graph, and updates the state of the group and constructor -// with the given id accordingly. -func (dg *Graph) FailGroupNodes(name string, t reflect.Type, id CtorID) { - // This failure is the root cause if there are no other failures. - isRootCause := len(dg.Failed.RootCauses) == 0 - - k := nodeKey{t: t, group: name} - group := dg.getGroup(k) - - // If the ctor does not exist it cannot be failed. - if _, ok := dg.ctorMap[id]; !ok { - return - } - - // Track which constructors and groups have failed. - dg.Failed.ctors[id] = struct{}{} - dg.Failed.groups[k] = struct{}{} - - for _, r := range dg.ctorMap[id].Results { - if r.Type == t && r.Group == name { - dg.failNode(r, isRootCause) - } - } - - if c, ok := dg.ctorMap[id]; ok { - if isRootCause { - group.ErrorType = rootCause - c.ErrorType = rootCause - } else { - group.ErrorType = transitiveFailure - c.ErrorType = transitiveFailure - } - } -} - -// getGroup finds the group by nodeKey from the graph. If it is not available, -// a new group is created and returned. -func (dg *Graph) getGroup(k nodeKey) *Group { - g, ok := dg.groupMap[k] - if !ok { - g = NewGroup(k) - dg.groupMap[k] = g - dg.Groups = append(dg.Groups, g) - } - return g -} - -// addToGroup adds a newly provided grouped result to the appropriate group. -func (dg *Graph) addToGroup(r *Result, id CtorID) { - k := nodeKey{t: r.Type, group: r.Group} - group := dg.getGroup(k) - - r.GroupIndex = len(group.Results) - group.Results = append(group.Results, r) -} - -// PruneSuccess removes elements from the graph that do not have failed results. -// Removing elements that do not have failing results makes the graph easier to debug, -// since non-failing nodes and edges can clutter the graph and don't help the user debug. -func (dg *Graph) PruneSuccess() { - dg.pruneCtors(dg.Failed.ctors) - dg.pruneGroups(dg.Failed.groups) -} - -// pruneCtors removes constructors from the graph that do not have failing Results. -func (dg *Graph) pruneCtors(failed map[CtorID]struct{}) { - var pruned []*Ctor - for _, c := range dg.Ctors { - if _, ok := failed[c.ID]; ok { - pruned = append(pruned, c) - continue - } - // If a constructor is deleted, the constructor's stale result references need to - // be removed from that result's Group and/or consuming constructor. - dg.pruneCtorParams(c, dg.consumers) - dg.pruneGroupResults(c, dg.groupMap) - delete(dg.ctorMap, c.ID) - } - - dg.Ctors = pruned -} - -// pruneGroups removes groups from the graph that do not have failing results. -func (dg *Graph) pruneGroups(failed map[nodeKey]struct{}) { - var pruned []*Group - for _, g := range dg.Groups { - k := g.nodeKey() - if _, ok := failed[k]; ok { - pruned = append(pruned, g) - continue - } - delete(dg.groupMap, k) - } - dg.Groups = pruned - - dg.pruneCtorGroupParams(dg.groupMap) -} - -// pruneCtorParams removes results of the constructor argument that are still referenced in the -// Params of constructors that consume those results. If the results in the constructor are found -// in the params of a consuming constructor that result should be removed. -func (dg *Graph) pruneCtorParams(c *Ctor, consumers map[nodeKey][]*Ctor) { - for _, r := range c.Results { - for _, ctor := range consumers[r.nodeKey()] { - ctor.removeParam(r.nodeKey()) - } - } -} - -// pruneCtorGroupParams removes constructor results that are still referenced in the GroupParams of -// constructors that consume those results. -func (dg *Graph) pruneCtorGroupParams(groups map[nodeKey]*Group) { - for _, c := range dg.Ctors { - var pruned []*Group - for _, gp := range c.GroupParams { - k := gp.nodeKey() - if _, ok := groups[k]; ok { - pruned = append(pruned, gp) - } - } - c.GroupParams = pruned - } -} - -// pruneGroupResults removes results of the constructor argument that are still referenced in -// the Group object that contains that result. If a group no longer exists references to that -// should should be removed. -func (dg *Graph) pruneGroupResults(c *Ctor, groups map[nodeKey]*Group) { - for _, r := range c.Results { - k := r.nodeKey() - if k.group == "" { - continue - } - - g, ok := groups[k] - if ok { - g.removeResult(r) - } - } -} - -// String implements fmt.Stringer for Param. -func (p *Param) String() string { - if p.Name != "" { - return fmt.Sprintf("%v[name=%v]", p.Type.String(), p.Name) - } - return p.Type.String() -} - -// String implements fmt.Stringer for Result. -func (r *Result) String() string { - switch { - case r.Name != "": - return fmt.Sprintf("%v[name=%v]", r.Type.String(), r.Name) - case r.Group != "": - return fmt.Sprintf("%v[group=%v]%v", r.Type.String(), r.Group, r.GroupIndex) - default: - return r.Type.String() - } -} - -// String implements fmt.Stringer for Group. -func (g *Group) String() string { - return fmt.Sprintf("[type=%v group=%v]", g.Type.String(), g.Name) -} - -// Attributes composes and returns a string of the Result node's attributes. -func (r *Result) Attributes() string { - switch { - case r.Name != "": - return fmt.Sprintf(`label=<%v
Name: %v>`, r.Type, r.Name) - case r.Group != "": - return fmt.Sprintf(`label=<%v
Group: %v>`, r.Type, r.Group) - default: - return fmt.Sprintf(`label=<%v>`, r.Type) - } -} - -// Attributes composes and returns a string of the Group node's attributes. -func (g *Group) Attributes() string { - attr := fmt.Sprintf(`shape=diamond label=<%v
Group: %v>`, g.Type, g.Name) - if g.ErrorType != noError { - attr += " color=" + g.ErrorType.Color() - } - return attr -} - -// Color returns the color representation of each ErrorType. -func (s ErrorType) Color() string { - switch s { - case rootCause: - return "red" - case transitiveFailure: - return "orange" - default: - return "black" - } -} - -func (dg *Graph) addRootCause(r *Result) { - dg.Failed.RootCauses = append(dg.Failed.RootCauses, r) -} - -func (dg *Graph) addTransitiveFailure(r *Result) { - dg.Failed.TransitiveFailures = append(dg.Failed.TransitiveFailures, r) -} diff --git a/vendor/go.uber.org/dig/param.go b/vendor/go.uber.org/dig/param.go deleted file mode 100644 index 4daa4135..00000000 --- a/vendor/go.uber.org/dig/param.go +++ /dev/null @@ -1,454 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "errors" - "fmt" - "reflect" - - "go.uber.org/dig/internal/dot" -) - -// The param interface represents a dependency for a constructor. -// -// The following implementations exist: -// paramList All arguments of the constructor. -// paramSingle An explicitly requested type. -// paramObject dig.In struct where each field in the struct can be another -// param. -// paramGroupedSlice -// A slice consuming a value group. This will receive all -// values produced with a `group:".."` tag with the same name -// as a slice. -type param interface { - fmt.Stringer - - // Builds this dependency and any of its dependencies from the provided - // Container. - // - // This MAY panic if the param does not produce a single value. - Build(containerStore) (reflect.Value, error) - - // DotParam returns a slice of dot.Param(s). - DotParam() []*dot.Param -} - -var ( - _ param = paramSingle{} - _ param = paramObject{} - _ param = paramList{} - _ param = paramGroupedSlice{} -) - -// newParam builds a param from the given type. If the provided type is a -// dig.In struct, an paramObject will be returned. -func newParam(t reflect.Type) (param, error) { - switch { - case IsOut(t) || (t.Kind() == reflect.Ptr && IsOut(t.Elem())) || embedsType(t, _outPtrType): - return nil, fmt.Errorf("cannot depend on result objects: %v embeds a dig.Out", t) - case IsIn(t): - return newParamObject(t) - case embedsType(t, _inPtrType): - return nil, fmt.Errorf( - "cannot build a parameter object by embedding *dig.In, embed dig.In instead: "+ - "%v embeds *dig.In", t) - case t.Kind() == reflect.Ptr && IsIn(t.Elem()): - return nil, fmt.Errorf( - "cannot depend on a pointer to a parameter object, use a value instead: "+ - "%v is a pointer to a struct that embeds dig.In", t) - default: - return paramSingle{Type: t}, nil - } -} - -// paramVisitor visits every param in a param tree, allowing tracking state at -// each level. -type paramVisitor interface { - // Visit is called on the param being visited. - // - // If Visit returns a non-nil paramVisitor, that paramVisitor visits all - // the child params of this param. - Visit(param) paramVisitor - - // We can implement AnnotateWithField and AnnotateWithPosition like - // resultVisitor if we need to track that information in the future. -} - -// paramVisitorFunc is a paramVisitor that visits param in a tree with the -// return value deciding whether the descendants of this param should be -// recursed into. -type paramVisitorFunc func(param) (recurse bool) - -func (f paramVisitorFunc) Visit(p param) paramVisitor { - if f(p) { - return f - } - return nil -} - -// walkParam walks the param tree for the given param with the provided -// visitor. -// -// paramVisitor.Visit will be called on the provided param and if a non-nil -// paramVisitor is received, this param's descendants will be walked with that -// visitor. -// -// This is very similar to how go/ast.Walk works. -func walkParam(p param, v paramVisitor) { - v = v.Visit(p) - if v == nil { - return - } - - switch par := p.(type) { - case paramSingle, paramGroupedSlice: - // No sub-results - case paramObject: - for _, f := range par.Fields { - walkParam(f.Param, v) - } - case paramList: - for _, p := range par.Params { - walkParam(p, v) - } - default: - panic(fmt.Sprintf( - "It looks like you have found a bug in dig. "+ - "Please file an issue at https://github.com/uber-go/dig/issues/ "+ - "and provide the following message: "+ - "received unknown param type %T", p)) - } -} - -// paramList holds all arguments of the constructor as params. -// -// NOTE: Build() MUST NOT be called on paramList. Instead, BuildList -// must be called. -type paramList struct { - ctype reflect.Type // type of the constructor - - Params []param -} - -func (pl paramList) DotParam() []*dot.Param { - var types []*dot.Param - for _, param := range pl.Params { - types = append(types, param.DotParam()...) - } - return types -} - -// newParamList builds a paramList from the provided constructor type. -// -// Variadic arguments of a constructor are ignored and not included as -// dependencies. -func newParamList(ctype reflect.Type) (paramList, error) { - numArgs := ctype.NumIn() - if ctype.IsVariadic() { - // NOTE: If the function is variadic, we skip the last argument - // because we're not filling variadic arguments yet. See #120. - numArgs-- - } - - pl := paramList{ - ctype: ctype, - Params: make([]param, 0, numArgs), - } - - for i := 0; i < numArgs; i++ { - p, err := newParam(ctype.In(i)) - if err != nil { - return pl, errWrapf(err, "bad argument %d", i+1) - } - pl.Params = append(pl.Params, p) - } - - return pl, nil -} - -func (pl paramList) Build(containerStore) (reflect.Value, error) { - panic("It looks like you have found a bug in dig. " + - "Please file an issue at https://github.com/uber-go/dig/issues/ " + - "and provide the following message: " + - "paramList.Build() must never be called") -} - -// BuildList returns an ordered list of values which may be passed directly -// to the underlying constructor. -func (pl paramList) BuildList(c containerStore) ([]reflect.Value, error) { - args := make([]reflect.Value, len(pl.Params)) - for i, p := range pl.Params { - var err error - args[i], err = p.Build(c) - if err != nil { - return nil, err - } - } - return args, nil -} - -// paramSingle is an explicitly requested type, optionally with a name. -// -// This object must be present in the graph as-is unless it's specified as -// optional. -type paramSingle struct { - Name string - Optional bool - Type reflect.Type -} - -func (ps paramSingle) DotParam() []*dot.Param { - return []*dot.Param{ - { - Node: &dot.Node{ - Type: ps.Type, - Name: ps.Name, - }, - Optional: ps.Optional, - }, - } -} - -func (ps paramSingle) Build(c containerStore) (reflect.Value, error) { - if v, ok := c.getValue(ps.Name, ps.Type); ok { - return v, nil - } - - providers := c.getValueProviders(ps.Name, ps.Type) - if len(providers) == 0 { - if ps.Optional { - return reflect.Zero(ps.Type), nil - } - return _noValue, newErrMissingType(c, key{name: ps.Name, t: ps.Type}) - } - - for _, n := range providers { - err := n.Call(c) - if err == nil { - continue - } - - // If we're missing dependencies but the parameter itself is optional, - // we can just move on. - if _, ok := err.(errMissingDependencies); ok && ps.Optional { - return reflect.Zero(ps.Type), nil - } - - return _noValue, errParamSingleFailed{ - CtorID: n.ID(), - Key: key{t: ps.Type, name: ps.Name}, - Reason: err, - } - } - - // If we get here, it's impossible for the value to be absent from the - // container. - v, _ := c.getValue(ps.Name, ps.Type) - return v, nil -} - -// paramObject is a dig.In struct where each field is another param. -// -// This object is not expected in the graph as-is. -type paramObject struct { - Type reflect.Type - Fields []paramObjectField -} - -func (po paramObject) DotParam() []*dot.Param { - var types []*dot.Param - for _, field := range po.Fields { - types = append(types, field.DotParam()...) - } - return types -} - -// newParamObject builds an paramObject from the provided type. The type MUST -// be a dig.In struct. -func newParamObject(t reflect.Type) (paramObject, error) { - po := paramObject{Type: t} - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type == _inType { - // Skip over the dig.In embed. - continue - } - - pof, err := newParamObjectField(i, f) - if err != nil { - return po, errWrapf(err, "bad field %q of %v", f.Name, t) - } - - po.Fields = append(po.Fields, pof) - } - - return po, nil -} - -func (po paramObject) Build(c containerStore) (reflect.Value, error) { - dest := reflect.New(po.Type).Elem() - for _, f := range po.Fields { - v, err := f.Build(c) - if err != nil { - return dest, err - } - dest.Field(f.FieldIndex).Set(v) - } - return dest, nil -} - -// paramObjectField is a single field of a dig.In struct. -type paramObjectField struct { - // Name of the field in the struct. - FieldName string - - // Index of this field in the target struct. - // - // We need to track this separately because not all fields of the - // struct map to params. - FieldIndex int - - // The dependency requested by this field. - Param param -} - -func (pof paramObjectField) DotParam() []*dot.Param { - return pof.Param.DotParam() -} - -func newParamObjectField(idx int, f reflect.StructField) (paramObjectField, error) { - pof := paramObjectField{ - FieldName: f.Name, - FieldIndex: idx, - } - - var p param - switch { - case f.PkgPath != "": - return pof, fmt.Errorf( - "unexported fields not allowed in dig.In, did you mean to export %q (%v)?", - f.Name, f.Type) - - case f.Tag.Get(_groupTag) != "": - var err error - p, err = newParamGroupedSlice(f) - if err != nil { - return pof, err - } - - default: - var err error - p, err = newParam(f.Type) - if err != nil { - return pof, err - } - } - - if ps, ok := p.(paramSingle); ok { - ps.Name = f.Tag.Get(_nameTag) - - var err error - ps.Optional, err = isFieldOptional(f) - if err != nil { - return pof, err - } - - p = ps - } - - pof.Param = p - return pof, nil -} - -func (pof paramObjectField) Build(c containerStore) (reflect.Value, error) { - v, err := pof.Param.Build(c) - if err != nil { - return v, err - } - return v, nil -} - -// paramGroupedSlice is a param which produces a slice of values with the same -// group name. -type paramGroupedSlice struct { - // Name of the group as specified in the `group:".."` tag. - Group string - - // Type of the slice. - Type reflect.Type -} - -func (pt paramGroupedSlice) DotParam() []*dot.Param { - return []*dot.Param{ - { - Node: &dot.Node{ - Type: pt.Type, - Group: pt.Group, - }, - }, - } -} - -// newParamGroupedSlice builds a paramGroupedSlice from the provided type with -// the given name. -// -// The type MUST be a slice type. -func newParamGroupedSlice(f reflect.StructField) (paramGroupedSlice, error) { - pg := paramGroupedSlice{Group: f.Tag.Get(_groupTag), Type: f.Type} - - name := f.Tag.Get(_nameTag) - optional, _ := isFieldOptional(f) - switch { - case f.Type.Kind() != reflect.Slice: - return pg, fmt.Errorf("value groups may be consumed as slices only: "+ - "field %q (%v) is not a slice", f.Name, f.Type) - case name != "": - return pg, fmt.Errorf( - "cannot use named values with value groups: name:%q requested with group:%q", name, pg.Group) - - case optional: - return pg, errors.New("value groups cannot be optional") - } - - return pg, nil -} - -func (pt paramGroupedSlice) Build(c containerStore) (reflect.Value, error) { - for _, n := range c.getGroupProviders(pt.Group, pt.Type.Elem()) { - if err := n.Call(c); err != nil { - return _noValue, errParamGroupFailed{ - CtorID: n.ID(), - Key: key{group: pt.Group, t: pt.Type.Elem()}, - Reason: err, - } - } - } - - items := c.getValueGroup(pt.Group, pt.Type.Elem()) - - result := reflect.MakeSlice(pt.Type, len(items), len(items)) - for i, v := range items { - result.Index(i).Set(v) - } - return result, nil -} diff --git a/vendor/go.uber.org/dig/result.go b/vendor/go.uber.org/dig/result.go deleted file mode 100644 index d113e260..00000000 --- a/vendor/go.uber.org/dig/result.go +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "errors" - "fmt" - "reflect" - - "go.uber.org/dig/internal/dot" -) - -// The result interface represents a result produced by a constructor. -// -// The following implementations exist: -// resultList All values returned by the constructor. -// resultSingle A single value produced by a constructor. -// resultObject dig.Out struct where each field in the struct can be -// another result. -// resultGrouped A value produced by a constructor that is part of a value -// group. -type result interface { - // Extracts the values for this result from the provided value and - // stores them into the provided containerWriter. - // - // This MAY panic if the result does not consume a single value. - Extract(containerWriter, reflect.Value) - - // DotResult returns a slice of dot.Result(s). - DotResult() []*dot.Result -} - -var ( - _ result = resultSingle{} - _ result = resultObject{} - _ result = resultList{} - _ result = resultGrouped{} -) - -type resultOptions struct { - // If set, this is the name of the associated result value. - // - // For Result Objects, name:".." tags on fields override this. - Name string - Group string -} - -// newResult builds a result from the given type. -func newResult(t reflect.Type, opts resultOptions) (result, error) { - switch { - case IsIn(t) || (t.Kind() == reflect.Ptr && IsIn(t.Elem())) || embedsType(t, _inPtrType): - return nil, fmt.Errorf("cannot provide parameter objects: %v embeds a dig.In", t) - case isError(t): - return nil, fmt.Errorf("cannot return an error here, return it from the constructor instead") - case IsOut(t): - return newResultObject(t, opts) - case embedsType(t, _outPtrType): - return nil, fmt.Errorf( - "cannot build a result object by embedding *dig.Out, embed dig.Out instead: "+ - "%v embeds *dig.Out", t) - case t.Kind() == reflect.Ptr && IsOut(t.Elem()): - return nil, fmt.Errorf( - "cannot return a pointer to a result object, use a value instead: "+ - "%v is a pointer to a struct that embeds dig.Out", t) - case len(opts.Group) > 0: - return resultGrouped{Type: t, Group: opts.Group}, nil - default: - return resultSingle{Type: t, Name: opts.Name}, nil - } -} - -// resultVisitor visits every result in a result tree, allowing tracking state -// at each level. -type resultVisitor interface { - // Visit is called on the result being visited. - // - // If Visit returns a non-nil resultVisitor, that resultVisitor visits all - // the child results of this result. - Visit(result) resultVisitor - - // AnnotateWithField is called on each field of a resultObject after - // visiting it but before walking its descendants. - // - // The same resultVisitor is used for all fields: the one returned upon - // visiting the resultObject. - // - // For each visited field, if AnnotateWithField returns a non-nil - // resultVisitor, it will be used to walk the result of that field. - AnnotateWithField(resultObjectField) resultVisitor - - // AnnotateWithPosition is called with the index of each result of a - // resultList after vising it but before walking its descendants. - // - // The same resultVisitor is used for all results: the one returned upon - // visiting the resultList. - // - // For each position, if AnnotateWithPosition returns a non-nil - // resultVisitor, it will be used to walk the result at that index. - AnnotateWithPosition(idx int) resultVisitor -} - -// walkResult walks the result tree for the given result with the provided -// visitor. -// -// resultVisitor.Visit will be called on the provided result and if a non-nil -// resultVisitor is received, it will be used to walk its descendants. If a -// resultObject or resultList was visited, AnnotateWithField and -// AnnotateWithPosition respectively will be called before visiting the -// descendants of that resultObject/resultList. -// -// This is very similar to how go/ast.Walk works. -func walkResult(r result, v resultVisitor) { - v = v.Visit(r) - if v == nil { - return - } - - switch res := r.(type) { - case resultSingle, resultGrouped: - // No sub-results - case resultObject: - w := v - for _, f := range res.Fields { - if v := w.AnnotateWithField(f); v != nil { - walkResult(f.Result, v) - } - } - case resultList: - w := v - for i, r := range res.Results { - if v := w.AnnotateWithPosition(i); v != nil { - walkResult(r, v) - } - } - default: - panic(fmt.Sprintf( - "It looks like you have found a bug in dig. "+ - "Please file an issue at https://github.com/uber-go/dig/issues/ "+ - "and provide the following message: "+ - "received unknown result type %T", res)) - } -} - -// resultList holds all values returned by the constructor as results. -type resultList struct { - ctype reflect.Type - - Results []result - - // For each item at index i returned by the constructor, resultIndexes[i] - // is the index in .Results for the corresponding result object. - // resultIndexes[i] is -1 for errors returned by constructors. - resultIndexes []int -} - -func (rl resultList) DotResult() []*dot.Result { - var types []*dot.Result - for _, result := range rl.Results { - types = append(types, result.DotResult()...) - } - return types -} - -func newResultList(ctype reflect.Type, opts resultOptions) (resultList, error) { - rl := resultList{ - ctype: ctype, - Results: make([]result, 0, ctype.NumOut()), - resultIndexes: make([]int, ctype.NumOut()), - } - - resultIdx := 0 - for i := 0; i < ctype.NumOut(); i++ { - t := ctype.Out(i) - if isError(t) { - rl.resultIndexes[i] = -1 - continue - } - - r, err := newResult(t, opts) - if err != nil { - return rl, errWrapf(err, "bad result %d", i+1) - } - - rl.Results = append(rl.Results, r) - rl.resultIndexes[i] = resultIdx - resultIdx++ - } - - return rl, nil -} - -func (resultList) Extract(containerWriter, reflect.Value) { - panic("It looks like you have found a bug in dig. " + - "Please file an issue at https://github.com/uber-go/dig/issues/ " + - "and provide the following message: " + - "resultList.Extract() must never be called") -} - -func (rl resultList) ExtractList(cw containerWriter, values []reflect.Value) error { - for i, v := range values { - if resultIdx := rl.resultIndexes[i]; resultIdx >= 0 { - rl.Results[resultIdx].Extract(cw, v) - continue - } - - if err, _ := v.Interface().(error); err != nil { - return err - } - } - - return nil -} - -// resultSingle is an explicit value produced by a constructor, optionally -// with a name. -// -// This object will be added to the graph as-is. -type resultSingle struct { - Name string - Type reflect.Type -} - -func (rs resultSingle) DotResult() []*dot.Result { - return []*dot.Result{ - { - Node: &dot.Node{ - Type: rs.Type, - Name: rs.Name, - }, - }, - } -} - -func (rs resultSingle) Extract(cw containerWriter, v reflect.Value) { - cw.setValue(rs.Name, rs.Type, v) -} - -// resultObject is a dig.Out struct where each field is another result. -// -// This object is not added to the graph. Its fields are interpreted as -// results and added to the graph if needed. -type resultObject struct { - Type reflect.Type - Fields []resultObjectField -} - -func (ro resultObject) DotResult() []*dot.Result { - var types []*dot.Result - for _, field := range ro.Fields { - types = append(types, field.DotResult()...) - } - return types -} - -func newResultObject(t reflect.Type, opts resultOptions) (resultObject, error) { - ro := resultObject{Type: t} - if len(opts.Name) > 0 { - return ro, fmt.Errorf( - "cannot specify a name for result objects: %v embeds dig.Out", t) - } - - if len(opts.Group) > 0 { - return ro, fmt.Errorf( - "cannot specify a group for result objects: %v embeds dig.Out", t) - } - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type == _outType { - // Skip over the dig.Out embed. - continue - } - - rof, err := newResultObjectField(i, f, opts) - if err != nil { - return ro, errWrapf(err, "bad field %q of %v", f.Name, t) - } - - ro.Fields = append(ro.Fields, rof) - } - return ro, nil -} - -func (ro resultObject) Extract(cw containerWriter, v reflect.Value) { - for _, f := range ro.Fields { - f.Result.Extract(cw, v.Field(f.FieldIndex)) - } -} - -// resultObjectField is a single field inside a dig.Out struct. -type resultObjectField struct { - // Name of the field in the struct. - FieldName string - - // Index of the field in the struct. - // - // We need to track this separately because not all fields of the struct - // map to results. - FieldIndex int - - // Result produced by this field. - Result result -} - -func (rof resultObjectField) DotResult() []*dot.Result { - return rof.Result.DotResult() -} - -// newResultObjectField(i, f, opts) builds a resultObjectField from the field -// f at index i. -func newResultObjectField(idx int, f reflect.StructField, opts resultOptions) (resultObjectField, error) { - rof := resultObjectField{ - FieldName: f.Name, - FieldIndex: idx, - } - - var r result - switch { - case f.PkgPath != "": - return rof, fmt.Errorf( - "unexported fields not allowed in dig.Out, did you mean to export %q (%v)?", f.Name, f.Type) - - case f.Tag.Get(_groupTag) != "": - var err error - r, err = newResultGrouped(f) - if err != nil { - return rof, err - } - - default: - var err error - if name := f.Tag.Get(_nameTag); len(name) > 0 { - // can modify in-place because options are passed-by-value. - opts.Name = name - } - r, err = newResult(f.Type, opts) - if err != nil { - return rof, err - } - } - - rof.Result = r - return rof, nil -} - -// resultGrouped is a value produced by a constructor that is part of a result -// group. -// -// These will be produced as fields of a dig.Out struct. -type resultGrouped struct { - // Name of the group as specified in the `group:".."` tag. - Group string - - // Type of value produced. - Type reflect.Type -} - -func (rt resultGrouped) DotResult() []*dot.Result { - return []*dot.Result{ - { - Node: &dot.Node{ - Type: rt.Type, - Group: rt.Group, - }, - }, - } -} - -// newResultGrouped(f) builds a new resultGrouped from the provided field. -func newResultGrouped(f reflect.StructField) (resultGrouped, error) { - rg := resultGrouped{Group: f.Tag.Get(_groupTag), Type: f.Type} - - name := f.Tag.Get(_nameTag) - optional, _ := isFieldOptional(f) - switch { - case name != "": - return rg, fmt.Errorf( - "cannot use named values with value groups: name:%q provided with group:%q", name, rg.Group) - case optional: - return rg, errors.New("value groups cannot be optional") - } - - return rg, nil -} - -func (rt resultGrouped) Extract(cw containerWriter, v reflect.Value) { - cw.submitGroupedValue(rt.Group, rt.Type, v) -} diff --git a/vendor/go.uber.org/dig/stringer.go b/vendor/go.uber.org/dig/stringer.go deleted file mode 100644 index d10fa0fb..00000000 --- a/vendor/go.uber.org/dig/stringer.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "bytes" - "fmt" - "strings" -) - -// String representation of the entire Container -func (c *Container) String() string { - b := &bytes.Buffer{} - fmt.Fprintln(b, "nodes: {") - for k, vs := range c.providers { - for _, v := range vs { - fmt.Fprintln(b, "\t", k, "->", v) - } - } - fmt.Fprintln(b, "}") - - fmt.Fprintln(b, "values: {") - for k, v := range c.values { - fmt.Fprintln(b, "\t", k, "=>", v) - } - for k, vs := range c.groups { - for _, v := range vs { - fmt.Fprintln(b, "\t", k, "=>", v) - } - } - fmt.Fprintln(b, "}") - - return b.String() -} - -func (n *node) String() string { - return fmt.Sprintf("deps: %v, ctor: %v", n.paramList, n.ctype) -} - -func (k key) String() string { - if k.name != "" { - return fmt.Sprintf("%v[name=%q]", k.t, k.name) - } - if k.group != "" { - return fmt.Sprintf("%v[group=%q]", k.t, k.group) - } - return k.t.String() -} - -func (pl paramList) String() string { - args := make([]string, len(pl.Params)) - for i, p := range pl.Params { - args[i] = p.String() - } - return fmt.Sprint(args) -} - -func (sp paramSingle) String() string { - // tally.Scope[optional] means optional - // tally.Scope[optional, name="foo"] means named optional - - var opts []string - if sp.Optional { - opts = append(opts, "optional") - } - if sp.Name != "" { - opts = append(opts, fmt.Sprintf("name=%q", sp.Name)) - } - - if len(opts) == 0 { - return fmt.Sprint(sp.Type) - } - - return fmt.Sprintf("%v[%v]", sp.Type, strings.Join(opts, ", ")) -} - -func (op paramObject) String() string { - fields := make([]string, len(op.Fields)) - for i, f := range op.Fields { - fields[i] = f.Param.String() - } - return strings.Join(fields, " ") -} - -func (pt paramGroupedSlice) String() string { - // io.Reader[group="foo"] refers to a group of io.Readers called 'foo' - return fmt.Sprintf("%v[group=%q]", pt.Type.Elem(), pt.Group) -} diff --git a/vendor/go.uber.org/dig/types.go b/vendor/go.uber.org/dig/types.go deleted file mode 100644 index 8ab87ea5..00000000 --- a/vendor/go.uber.org/dig/types.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -import ( - "container/list" - "reflect" -) - -var ( - _noValue reflect.Value - _errType = reflect.TypeOf((*error)(nil)).Elem() - _inPtrType = reflect.TypeOf((*In)(nil)) - _inType = reflect.TypeOf(In{}) - _outPtrType = reflect.TypeOf((*Out)(nil)) - _outType = reflect.TypeOf(Out{}) -) - -// Special interface embedded inside dig sentinel values (dig.In, dig.Out) to -// make their special nature obvious in the godocs. Otherwise they will appear -// as plain empty structs. -type digSentinel interface { - digSentinel() -} - -// In may be embedded into structs to request dig to treat them as special -// parameter structs. When a constructor accepts such a struct, instead of the -// struct becoming a dependency for that constructor, all its fields become -// dependencies instead. See the section on Parameter Objects in the -// package-level documentation for more information. -// -// Fields of the struct may optionally be tagged to customize the behavior of -// dig. The following tags are supported, -// -// name Requests a value with the same name and type from the -// container. See Named Values for more information. -// optional If set to true, indicates that the dependency is optional and -// the constructor gracefully handles its absence. -// group Name of the Value Group from which this field will be filled. -// The field must be a slice type. See Value Groups in the -// package documentation for more information. -type In struct{ digSentinel } - -// Out is an embeddable type that signals to dig that the returned -// struct should be treated differently. Instead of the struct itself -// becoming part of the container, all members of the struct will. - -// Out may be embedded into structs to request dig to treat them as special -// result structs. When a constructor returns such a struct, instead of the -// struct becoming a result of the constructor, all its fields become results -// of the constructor. See the section on Result Objects in the package-level -// documentation for more information. -// -// Fields of the struct may optionally be tagged to customize the behavior of -// dig. The following tags are supported, -// -// name Specifies the name of the value. Only a field on a dig.In -// struct with the same 'name' annotation can receive this -// value. See Named Values for more information. -// group Name of the Value Group to which this field's value is being -// sent. See Value Groups in the package documentation for more -// information. -type Out struct{ digSentinel } - -func isError(t reflect.Type) bool { - return t.Implements(_errType) -} - -// IsIn checks whether the given struct is a dig.In struct. A struct qualifies -// as a dig.In struct if it embeds the dig.In type or if any struct that it -// embeds is a dig.In struct. The parameter may be the reflect.Type of the -// struct rather than the struct itself. -// -// A struct MUST qualify as a dig.In struct for its fields to be treated -// specially by dig. -// -// See the documentation for dig.In for a comprehensive list of supported -// tags. -func IsIn(o interface{}) bool { - return embedsType(o, _inType) -} - -// IsOut checks whether the given struct is a dig.Out struct. A struct -// qualifies as a dig.Out struct if it embeds the dig.Out type or if any -// struct that it embeds is a dig.Out struct. The parameter may be the -// reflect.Type of the struct rather than the struct itself. -// -// A struct MUST qualify as a dig.Out struct for its fields to be treated -// specially by dig. -// -// See the documentation for dig.Out for a comprehensive list of supported -// tags. -func IsOut(o interface{}) bool { - return embedsType(o, _outType) -} - -// Returns true if t embeds e or if any of the types embedded by t embed e. -func embedsType(i interface{}, e reflect.Type) bool { - // TODO: this function doesn't consider e being a pointer. - // given `type A foo { *In }`, this function would return false for - // embedding dig.In, which makes for some extra error checking in places - // that call this funciton. Might be worthwhile to consider reflect.Indirect - // usage to clean up the callers. - - if i == nil { - return false - } - - // maybe it's already a reflect.Type - t, ok := i.(reflect.Type) - if !ok { - // take the type if it's not - t = reflect.TypeOf(i) - } - - // We are going to do a breadth-first search of all embedded fields. - types := list.New() - types.PushBack(t) - for types.Len() > 0 { - t := types.Remove(types.Front()).(reflect.Type) - - if t == e { - return true - } - - if t.Kind() != reflect.Struct { - continue - } - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Anonymous { - types.PushBack(f.Type) - } - } - } - - // If perf is an issue, we can cache known In objects and Out objects in a - // map[reflect.Type]struct{}. - return false -} diff --git a/vendor/go.uber.org/dig/version.go b/vendor/go.uber.org/dig/version.go deleted file mode 100644 index 9bc5dd46..00000000 --- a/vendor/go.uber.org/dig/version.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dig - -// Version of the library. -const Version = "1.7.0" diff --git a/vendor/go.uber.org/fx/.codecov.yml b/vendor/go.uber.org/fx/.codecov.yml deleted file mode 100644 index 2e90589d..00000000 --- a/vendor/go.uber.org/fx/.codecov.yml +++ /dev/null @@ -1,15 +0,0 @@ - -coverage: - range: 80..100 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 90% # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure diff --git a/vendor/go.uber.org/fx/.gitignore b/vendor/go.uber.org/fx/.gitignore deleted file mode 100644 index c6dced35..00000000 --- a/vendor/go.uber.org/fx/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -/vendor -/.bench -*.mem -*.cpu -*.test -*.log -*.out -*.html -*.coverprofile -coverage.txt -*.pprof -/.bin -/.cache diff --git a/vendor/go.uber.org/fx/.travis.yml b/vendor/go.uber.org/fx/.travis.yml deleted file mode 100644 index c99e6332..00000000 --- a/vendor/go.uber.org/fx/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -sudo: false - -go_import_path: go.uber.org/fx -go: - - "1.10.4" - - "1.11" - - tip - -cache: - directories: - - vendor - -install: - - make dependencies - -script: - - make ci diff --git a/vendor/go.uber.org/fx/CHANGELOG.md b/vendor/go.uber.org/fx/CHANGELOG.md deleted file mode 100644 index af7647ca..00000000 --- a/vendor/go.uber.org/fx/CHANGELOG.md +++ /dev/null @@ -1,193 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [1.9.0] - 2019-01-22 -### Added -- Add the ability to shutdown Fx applications from inside the container. See - the Shutdowner documentation for details. -- Add `fx.Annotated` to allow users to provide named values without creating a - new constructor. - -## [1.8.0] - 2018-11-06 -### Added -- Provide DOT graph of dependencies in the container. - -## [1.7.1] - 2018-09-26 -### Fixed -- Make `fxtest.New` ensure that the app was created successfully. Previously, - it would return the app (similar to `fx.New`, which expects the user to verify - the error). -- Update dig container to defer acyclic validation until after Invoke. Application - startup time should improve proportional to the size of the dependency graph. -- Fix a goroutine leak in `fxtest.Lifecycle`. - -## [1.7.0] - 2018-08-16 -### Added -- Add `fx.ErrorHook` option to allow users to provide `ErrorHandler`s on invoke - failures. -- `VisualizeError` returns the visualization wrapped in the error if available. - -## [1.6.0] - 2018-06-12 -### Added -- Add `fx.Error` option to short-circuit application startup. - -## [1.5.0] - 2018-04-11 -### Added -- Add `fx.StartTimeout` and `fx.StopTimeout` to make configuring application - start and stop timeouts easier. -- Export the default start and stop timeout as `fx.DefaultTimeout`. - -### Fixed -- Make `fxtest` respect the application's start and stop timeouts. - -## [1.4.0] - 2017-12-07 -### Added -- Add `fx.Populate` to populate variables with values from the dependency - injection container without requiring intermediate structs. - -## [1.3.0] - 2017-11-28 -### Changed -- Improve readability of hook logging in addition to provide and invoke. - -### Fixed -- Fix bug which caused the OnStop for a lifecycle hook to be called even if it - failed to start. - -## [1.2.0] - 2017-09-06 -### Added -- Add `fx.NopLogger` which disables the Fx application's log output. - -## [1.1.0] - 2017-08-22 -### Changed -- Improve readability of start up logging. - -## [1.0.0] - 2017-07-31 -First stable release: no breaking changes will be made in the 1.x series. - -### Added -- `fx.Extract` now supports `fx.In` tags on target structs. - -### Changed -- **[Breaking]** Rename `fx.Inject` to `fx.Extract`. -- **[Breaking]** Rename `fxtest.Must*` to `fxtest.Require*`. - -### Removed -- **[Breaking]** Remove `fx.Timeout` and `fx.DefaultTimeout`. - -## [1.0.0-rc2] - 2017-07-21 - -- **[Breaking]** Lifecycle hooks now take a context. -- Add `fx.In` and `fx.Out` which exposes optional and named types. - Modules should embed these types instead of relying on `dig.In` and `dig.Out`. -- Add an `Err` method to retrieve the underlying errors during the dependency - graph construction. The same error is also returned from `Start`. -- Graph resolution now happens as part of `fx.New`, rather than at the beginning - of `app.Start`. This allows inspection of the graph errors through `app.Err()` - before the decision to start the app. -- Add a `Logger` option, which allows users to send Fx's logs to different - sink. -- Add `fxtest.App`, which redirects log output to the user's `testing.TB` and - provides some lifecycle helpers. - -## [1.0.0-rc1] - 2017-06-20 - -- **[Breaking]** Providing types into `fx.App` and invoking functions are now - options passed during application construction. This makes users' - interactions with modules and collections of modules identical. -- **[Breaking]** `TestLifecycle` is now in a separate `fxtest` subpackage. -- Add `fx.Inject()` to pull values from the container into a struct. - -## [1.0.0-beta4] - 2017-06-12 - -- **[Breaking]** Monolithic framework, as released in initial betas, has been - broken into smaller pieces as a result of recent advances in `dig` library. - This is a radical departure from the previous direction, but it needed to - be done for the long-term good of the project. -- **[Breaking]** `Module interface` has been scoped all the way down to being - *a single dig constructor*. This allows for very sophisticated module - compositions. See `go.uber.org/dig` for more information on the constructors. -- **[Breaking]** `package config` has been moved to its own repository. - see `go.uber.org/config` for more information. -- `fx.Lifecycle` has been added for modules to hook into the framework - lifecycle events. -- `service.Host` interface which composed a number of primitives together - (configuration, metrics, tracing) has been deprecated in favor of - `fx.App`. - -## [1.0.0-beta3] - 2017-03-28 - -- **[Breaking]** Environment config provider was removed. If you were using - environment variables to override YAML values, see - [config documentation](config/README.md) for more information. -- **[Breaking]** Simplify Provider interface: remove `Scope` method from the - `config.Provider` interface, one can use either ScopedProvider and Value.Get() - to access sub fields. -- Add `task.MustRegister` convenience function which fails fast by panicking - Note that this should only be used during app initialization, and is provided - to avoid repetetive error checking for services which register many tasks. -- Expose options on task module to disable execution. This will allow users to - enqueue and consume tasks on different clusters. -- **[Breaking]** Rename Backend interface `Publish` to `Enqueue`. Created a new - `ExecuteAsync` method that will kick off workers to consume tasks and this is - subsumed by module Start. -- **[Breaking]** Rename package `uhttp/client` to `uhttp/uhttpclient` for clarity. -- **[Breaking]** Rename `PopulateStruct` method in value to `Populate`. - The method can now populate not only structs, but anything: slices, - maps, builtin types and maps. -- **[Breaking]** `package dig` has moved from `go.uber.org/fx/dig` to a new home - at `go.uber.org/dig`. -- **[Breaking]** Pass a tracer the `uhttp/uhttpclient` constructor explicitly, instead - of using a global tracer. This will allow to use http client in parallel tests. - -## [1.0.0-beta2] - 2017-03-09 - -- **[Breaking]** Remove `ulog.Logger` interface and expose `*zap.Logger` directly. -- **[Breaking]** Rename config and module from `modules.rpc` to `modules.yarpc` -- **[Breaking]** Rename config key from `modules.http` to `modules.uhttp` to match - the module name -- **[Breaking]** Upgrade `zap` to `v1.0.0-rc.3` (now go.uber.org/zap, was - github.com/uber-go/zap) -- Remove now-unused `config.IsDevelopmentEnv()` helper to encourage better - testing practices. Not a breaking change as nobody is using this func - themselves according to our code search tool. -- Log `traceID` and `spanID` in hex format to match Jaeger UI. Upgrade Jaeger to - min version 2.1.0 - and use jaeger's adapters for jaeger and tally initialization. -- Tally now supports reporting histogram samples for a bucket. Upgrade Tally to 2.1.0 -- **[Breaking]** Make new module naming consistent `yarpc.ThriftModule` to - `yarpc.New`, `task.NewModule` - to `task.New` -- **[Breaking]** Rename `yarpc.CreateThriftServiceFunc` to `yarpc.ServiceCreateFunc` - as it is not thrift-specific. -- Report version metrics for company-wide version usage information. -- Allow configurable service name and module name via service options. -- DIG constructors now support returning a tuple with the second argument being - an error. - -## 1.0.0-beta1 - 2017-02-20 - -This is the first beta release of the framework, where we invite users to start -building services on it and provide us feedback. **Warning** we are not -promising API compatibility between beta releases and the final 1.0.0 release. -In fact, we expect our beta user feedback to require some changes to the way -things work. Once we reach 1.0, we will provider proper version compatibility. - -[1.9.0]: https://github.com/uber-go/fx/compare/v1.8.0...v1.9.0 -[1.8.0]: https://github.com/uber-go/fx/compare/v1.7.1...v1.8.0 -[1.7.1]: https://github.com/uber-go/fx/compare/v1.7.0...v1.7.1 -[1.7.0]: https://github.com/uber-go/fx/compare/v1.6.0...v1.7.0 -[1.6.0]: https://github.com/uber-go/fx/compare/v1.5.0...v1.6.0 -[1.5.0]: https://github.com/uber-go/fx/compare/v1.4.0...v1.5.0 -[1.4.0]: https://github.com/uber-go/fx/compare/v1.3.0...v1.4.0 -[1.3.0]: https://github.com/uber-go/fx/compare/v1.2.0...v1.3.0 -[1.2.0]: https://github.com/uber-go/fx/compare/v1.1.0...v1.2.0 -[1.1.0]: https://github.com/uber-go/fx/compare/v1.0.0...v1.1.0 -[1.0.0]: https://github.com/uber-go/fx/compare/v1.0.0-rc2...v1.0.0 -[1.0.0-rc2]: https://github.com/uber-go/fx/compare/v1.0.0-rc1...v1.0.0-rc2 -[1.0.0-rc1]: https://github.com/uber-go/fx/compare/v1.0.0-beta4...v1.0.0-rc1 -[1.0.0-beta4]: https://github.com/uber-go/fx/compare/v1.0.0-beta3...v1.0.0-beta4 -[1.0.0-beta3]: https://github.com/uber-go/fx/compare/v1.0.0-beta2...v1.0.0-beta3 -[1.0.0-beta2]: https://github.com/uber-go/fx/compare/v1.0.0-beta1...v1.0.0-beta2 diff --git a/vendor/go.uber.org/fx/CONTRIBUTING.md b/vendor/go.uber.org/fx/CONTRIBUTING.md deleted file mode 100644 index 8458a900..00000000 --- a/vendor/go.uber.org/fx/CONTRIBUTING.md +++ /dev/null @@ -1,79 +0,0 @@ -# Contributing - -Thanks for helping to make Fx better for everyone! - -If you'd like to add new exported APIs, please [open an issue][open-issue] -describing your proposal — discussing API changes ahead of time makes -pull request review much smoother. - -Note that you'll need to sign [Uber's Contributor License Agreement][cla] -before we can accept any of your contributions. If necessary, a bot will remind -you to accept the CLA when you open your pull request. - -## Setup - -[Fork][fork], then clone the repository: - -``` -mkdir -p $GOPATH/src/go.uber.org -cd $GOPATH/src/go.uber.org -git clone git@github.com:your_github_username/fx.git -cd fx -git remote add upstream https://github.com/uber-go/fx.git -git fetch upstream -``` - -Install Fx's dependencies: - -``` -make dependencies -``` - -Make sure that the tests and the style checkers pass: - -``` -make test -make lint -``` - -For `make lint` to work, you must be using the minor version of Go specified in -the Makefile's `LINTABLE_MINOR_VERSIONS` variable. This is fine, but it means -that you'll only discover style violations after you open your pull request. - -## Making changes - -Start by creating a new branch for your changes: - -``` -cd $GOPATH/src/go.uber.org/fx -git checkout master -git fetch upstream -git rebase upstream/master -git checkout -b cool_new_feature -``` - -Make your changes, and then check that `make lint` and `make test` still pass. -If you're satisfied with your changes, push them to your fork. - -``` -git push origin cool_new_feature -``` - -Then use the GitHub UI to [open a pull request][pr]. - -At this point, you're waiting on us to review your changes. We *try* to respond -to issues and pull requests within a few business days, and we may suggest some -improvements or alternatives. Once your changes are approved, one of the -project maintainers will merge them. - -We're much more likely to approve your changes if you: - -* Add tests for new functionality. -* Write a [good commit message][commit-message]. -* Maintain backward compatibility. - -[fork]: https://github.com/uber-go/fx/fork -[open-issue]: https://github.com/uber-go/fx/issues/new -[cla]: https://cla-assistant.io/uber-go/fx -[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[pr]: https://github.com/uber-go/fx/compare diff --git a/vendor/go.uber.org/fx/LICENSE b/vendor/go.uber.org/fx/LICENSE deleted file mode 100644 index 20e81eaf..00000000 --- a/vendor/go.uber.org/fx/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016-2018 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/go.uber.org/fx/Makefile b/vendor/go.uber.org/fx/Makefile deleted file mode 100644 index c5c26d54..00000000 --- a/vendor/go.uber.org/fx/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -PKGS ?= $(shell glide novendor) -PKG_FILES ?= *.go - -# The linting tools evolve with each Go version, so run them only on the latest -# stable release. -GO_VERSION := $(shell go version | cut -d " " -f 3) -GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) -LINTABLE_MINOR_VERSIONS := 11 -ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) -SHOULD_LINT := true -endif - -.PHONY: dependencies -dependencies: - @echo "Installing Glide and locked dependencies..." - glide --version || go get -u -f github.com/Masterminds/glide - glide install - @echo "Installing uber-license tool..." - update-license || go get -u -f go.uber.org/tools/update-license -ifdef SHOULD_LINT - @echo "Installing golint..." - go install ./vendor/golang.org/x/lint/golint -else - @echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION) -endif - -.PHONY: test -test: - @.build/test.sh - -.PHONY: license -license: - $(ECHO_V).build/check_license.sh - -.PHONY: ci -ci: SHELL := /bin/bash -ci: test lint - bash <(curl -s https://codecov.io/bash) - -.PHONY: lint -lint: -ifdef SHOULD_LINT - @rm -rf lint.log - @echo "Checking formatting..." - @gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log - @echo "Installing test dependencies for vet..." - @go test -i $(PKGS) - @echo "Checking vet..." - @$(foreach dir,$(PKG_FILES),go tool vet $(VET_RULES) $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking lint..." - @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) - @echo "Checking for unresolved FIXMEs..." - @git grep -i fixme | grep -v -e vendor -e Makefile -e .md | tee -a lint.log - @echo "Checking for license headers..." - @DRY_RUN=1 .build/check_license.sh | tee -a lint.log - @[ ! -s lint.log ] -else - @echo "Skipping linters on" $(GO_VERSION) -endif diff --git a/vendor/go.uber.org/fx/README.md b/vendor/go.uber.org/fx/README.md deleted file mode 100644 index 42eaf51d..00000000 --- a/vendor/go.uber.org/fx/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# :unicorn: Fx [![GoDoc][doc-img]][doc] [![Github release][release-img]][release] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][report-card-img]][report-card] - -An application framework for Go that: - -* Makes dependency injection easy. -* Eliminates the need for global state and `func init()`. - -## Installation - -We recommend locking to [SemVer](http://semver.org/) range `^1` using [Glide](https://github.com/Masterminds/glide): - -``` -glide get 'go.uber.org/fx#^1' -``` - -## Stability - -This library is `v1` and follows [SemVer](http://semver.org/) strictly. - -No breaking changes will be made to exported APIs before `v2.0.0`. - -This project follows the [Go Release Policy][release-policy]. Each major -version of Go is supported until there are two newer major releases. - -[doc-img]: http://img.shields.io/badge/GoDoc-Reference-blue.svg -[doc]: https://godoc.org/go.uber.org/fx - -[release-img]: https://img.shields.io/github/release/uber-go/fx.svg -[release]: https://github.com/uber-go/fx/releases - -[ci-img]: https://img.shields.io/travis/uber-go/fx/master.svg -[ci]: https://travis-ci.org/uber-go/fx/branches - -[cov-img]: https://codecov.io/gh/uber-go/fx/branch/dev/graph/badge.svg -[cov]: https://codecov.io/gh/uber-go/fx/branch/dev - -[report-card-img]: https://goreportcard.com/badge/github.com/uber-go/fx -[report-card]: https://goreportcard.com/report/github.com/uber-go/fx - -[release-policy]: https://golang.org/doc/devel/release.html#policy diff --git a/vendor/go.uber.org/fx/annotated.go b/vendor/go.uber.org/fx/annotated.go deleted file mode 100644 index 69e04cde..00000000 --- a/vendor/go.uber.org/fx/annotated.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -// Annotated annotates a constructor provided to Fx with additional options. -// -// For example, -// -// func NewReadOnlyConnection(...) (*Connection, error) -// -// fx.Provide(fx.Annotated{ -// Name: "ro", -// Target: NewReadOnlyConnection, -// }) -// -// Is equivalent to, -// -// type result struct { -// fx.Out -// -// Connection *Connection `name:"ro"` -// } -// -// fx.Provide(func(...) (Result, error) { -// conn, err := NewReadOnlyConnection(...) -// return Result{Connection: conn}, err -// }) -// -// Annotated cannot be used with constructors which produce fx.Out objects. -type Annotated struct { - // If specified, this will be used as the name for all non-error values returned - // by the constructor. For more information on named values, see the documentation - // for the fx.Out type. - // - // A name option may not be provided if a group option is provided. - Name string - - // If specified, this will be used as the group name for all non-error values returned - // by the constructor. For more information on value groups, see the package documentation. - // - // A group option may not be provided if a name option is provided. - Group string - - // Target is the constructor being annotated with fx.Annotated. - Target interface{} -} diff --git a/vendor/go.uber.org/fx/app.go b/vendor/go.uber.org/fx/app.go deleted file mode 100644 index f71f92f5..00000000 --- a/vendor/go.uber.org/fx/app.go +++ /dev/null @@ -1,608 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import ( - "bytes" - "context" - "errors" - "fmt" - "os" - "os/signal" - "reflect" - "strings" - "sync" - "syscall" - "time" - - "go.uber.org/dig" - "go.uber.org/fx/internal/fxlog" - "go.uber.org/fx/internal/fxreflect" - "go.uber.org/fx/internal/lifecycle" - "go.uber.org/multierr" -) - -// DefaultTimeout is the default timeout for starting or stopping an -// application. It can be configured with the StartTimeout and StopTimeout -// options. -const DefaultTimeout = 15 * time.Second - -// An Option configures an App using the functional options paradigm -// popularized by Rob Pike. If you're unfamiliar with this style, see -// https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html. -type Option interface { - apply(*App) -} - -type optionFunc func(*App) - -func (f optionFunc) apply(app *App) { f(app) } - -// Provide registers any number of constructor functions, teaching the -// application how to instantiate various types. The supplied constructor -// function(s) may depend on other types available in the application, must -// return one or more objects, and may return an error. For example: -// -// // Constructs type *C, depends on *A and *B. -// func(*A, *B) *C -// -// // Constructs type *C, depends on *A and *B, and indicates failure by -// // returning an error. -// func(*A, *B) (*C, error) -// -// // Constructs types *B and *C, depends on *A, and can fail. -// func(*A) (*B, *C, error) -// -// The order in which constructors are provided doesn't matter, and passing -// multiple Provide options appends to the application's collection of -// constructors. Constructors are called only if one or more of their returned -// types are needed, and their results are cached for reuse (so instances of a -// type are effectively singletons within an application). Taken together, -// these properties make it perfectly reasonable to Provide a large number of -// constructors even if only a fraction of them are used. -// -// See the documentation of the In and Out types for advanced features, -// including optional parameters and named instances. -func Provide(constructors ...interface{}) Option { - return provideOption(constructors) -} - -type provideOption []interface{} - -func (po provideOption) apply(app *App) { - app.provides = append(app.provides, po...) -} - -func (po provideOption) String() string { - items := make([]string, len(po)) - for i, c := range po { - items[i] = fxreflect.FuncName(c) - } - return fmt.Sprintf("fx.Provide(%s)", strings.Join(items, ", ")) -} - -// Invoke registers functions that are executed eagerly on application start. -// Arguments for these invocations are built using the constructors registered -// by Provide. Passing multiple Invoke options appends the new invocations to -// the application's existing list. -// -// Unlike constructors, invocations are always executed, and they're always -// run in order. Invocations may have any number of returned values. If the -// final returned object is an error, it's assumed to be a success indicator. -// All other returned values are discarded. -// -// Typically, invoked functions take a handful of high-level objects (whose -// constructors depend on lower-level objects) and introduce them to each -// other. This kick-starts the application by forcing it to instantiate a -// variety of types. -// -// To see an invocation in use, read through the package-level example. For -// advanced features, including optional parameters and named instances, see -// the documentation of the In and Out types. -func Invoke(funcs ...interface{}) Option { - return invokeOption(funcs) -} - -type invokeOption []interface{} - -func (io invokeOption) apply(app *App) { - app.invokes = append(app.invokes, io...) -} - -func (io invokeOption) String() string { - items := make([]string, len(io)) - for i, f := range io { - items[i] = fxreflect.FuncName(f) - } - return fmt.Sprintf("fx.Invoke(%s)", strings.Join(items, ", ")) -} - -// Error registers any number of errors with the application to short-circuit -// startup. If more than one error is given, the errors are combined into a -// single error. -// -// Similar to invocations, errors are applied in order. All Provide and Invoke -// options registered before or after an Error option will not be applied. -func Error(errs ...error) Option { - return optionFunc(func(app *App) { - app.err = multierr.Append(app.err, multierr.Combine(errs...)) - }) -} - -// Options converts a collection of Options into a single Option. This allows -// packages to bundle sophisticated functionality into easy-to-use Fx modules. -// For example, a logging package might export a simple option like this: -// -// package logging -// -// var Module = fx.Provide(func() *log.Logger { -// return log.New(os.Stdout, "", 0) -// }) -// -// A shared all-in-one microservice package could then use Options to bundle -// logging with similar metrics, tracing, and gRPC modules: -// -// package server -// -// var Module = fx.Options( -// logging.Module, -// metrics.Module, -// tracing.Module, -// grpc.Module, -// ) -// -// Since this all-in-one module has a minimal API surface, it's easy to add -// new functionality to it without breaking existing users. Individual -// applications can take advantage of all this functionality with only one -// line of code: -// -// app := fx.New(server.Module) -// -// Use this pattern sparingly, since it limits the user's ability to customize -// their application. -func Options(opts ...Option) Option { - return optionGroup(opts) -} - -type optionGroup []Option - -func (og optionGroup) apply(app *App) { - for _, opt := range og { - opt.apply(app) - } -} - -func (og optionGroup) String() string { - items := make([]string, len(og)) - for i, opt := range og { - items[i] = fmt.Sprint(opt) - } - return fmt.Sprintf("fx.Options(%s)", strings.Join(items, ", ")) -} - -// StartTimeout changes the application's start timeout. -func StartTimeout(v time.Duration) Option { - return optionFunc(func(app *App) { - app.startTimeout = v - }) -} - -// StopTimeout changes the application's stop timeout. -func StopTimeout(v time.Duration) Option { - return optionFunc(func(app *App) { - app.stopTimeout = v - }) -} - -// Printer is the interface required by Fx's logging backend. It's implemented -// by most loggers, including the one bundled with the standard library. -type Printer interface { - Printf(string, ...interface{}) -} - -// Logger redirects the application's log output to the provided printer. -func Logger(p Printer) Option { - return optionFunc(func(app *App) { - app.logger = &fxlog.Logger{Printer: p} - app.lifecycle = &lifecycleWrapper{lifecycle.New(app.logger)} - }) -} - -// NopLogger disables the application's log output. Note that this makes some -// failures difficult to debug, since no errors are printed to console. -var NopLogger = Logger(nopLogger{}) - -type nopLogger struct{} - -func (l nopLogger) Printf(string, ...interface{}) { - return -} - -// An App is a modular application built around dependency injection. Most -// users will only need to use the New constructor and the all-in-one Run -// convenience method. In more unusual cases, users may need to use the Err, -// Start, Done, and Stop methods by hand instead of relying on Run. -// -// New creates and initializes an App. All applications begin with a -// constructor for the Lifecycle type already registered. -// -// In addition to that built-in functionality, users typically pass a handful -// of Provide options and one or more Invoke options. The Provide options -// teach the application how to instantiate a variety of types, and the Invoke -// options describe how to initialize the application. -// -// When created, the application immediately executes all the functions passed -// via Invoke options. To supply these functions with the parameters they -// need, the application looks for constructors that return the appropriate -// types; if constructors for any required types are missing or any -// invocations return an error, the application will fail to start (and Err -// will return a descriptive error message). -// -// Once all the invocations (and any required constructors) have been called, -// New returns and the application is ready to be started using Run or Start. -// On startup, it executes any OnStart hooks registered with its Lifecycle. -// OnStart hooks are executed one at a time, in order, and must all complete -// within a configurable deadline (by default, 15 seconds). For details on the -// order in which OnStart hooks are executed, see the documentation for the -// Start method. -// -// At this point, the application has successfully started up. If started via -// Run, it will continue operating until it receives a shutdown signal from -// Done (see the Done documentation for details); if started explicitly via -// Start, it will operate until the user calls Stop. On shutdown, OnStop hooks -// execute one at a time, in reverse order, and must all complete within a -// configurable deadline (again, 15 seconds by default). -type App struct { - err error - container *dig.Container - lifecycle *lifecycleWrapper - provides []interface{} - invokes []interface{} - logger *fxlog.Logger - startTimeout time.Duration - stopTimeout time.Duration - errorHooks []ErrorHandler - - donesMu sync.RWMutex - dones []chan os.Signal -} - -// ErrorHook registers error handlers that implement error handling functions. -// They are executed on invoke failures. Passing multiple ErrorHandlers appends -// the new handlers to the application's existing list. -func ErrorHook(funcs ...ErrorHandler) Option { - return errorHookOption(funcs) -} - -// ErrorHandler handles Fx application startup errors. -type ErrorHandler interface { - HandleError(error) -} - -type errorHookOption []ErrorHandler - -func (eho errorHookOption) apply(app *App) { - app.errorHooks = append(app.errorHooks, eho...) -} - -type errorHandlerList []ErrorHandler - -func (ehl errorHandlerList) HandleError(err error) { - for _, eh := range ehl { - eh.HandleError(err) - } -} - -// New creates and initializes an App, immediately executing any functions -// registered via Invoke options. See the documentation of the App struct for -// details on the application's initialization, startup, and shutdown logic. -func New(opts ...Option) *App { - logger := fxlog.New() - lc := &lifecycleWrapper{lifecycle.New(logger)} - - app := &App{ - container: dig.New(dig.DeferAcyclicVerification()), - lifecycle: lc, - logger: logger, - startTimeout: DefaultTimeout, - stopTimeout: DefaultTimeout, - } - - for _, opt := range opts { - opt.apply(app) - } - - for _, p := range app.provides { - app.provide(p) - } - app.provide(func() Lifecycle { return app.lifecycle }) - app.provide(app.shutdowner) - app.provide(app.dotGraph) - - if app.err != nil { - app.logger.Printf("Error after options were applied: %v", app.err) - return app - } - - if err := app.executeInvokes(); err != nil { - app.err = err - - if dig.CanVisualizeError(err) { - var b bytes.Buffer - dig.Visualize(app.container, &b, dig.VisualizeError(err)) - err = errorWithGraph{ - graph: b.String(), - err: err, - } - } - errorHandlerList(app.errorHooks).HandleError(err) - } - return app -} - -// DotGraph contains a DOT language visualization of the dependency graph in -// an Fx application. It is provided in the container by default at -// initialization. On failure to build the dependency graph, it is attached -// to the error and if possible, colorized to highlight the root cause of the -// failure. -type DotGraph string - -type errWithGraph interface { - Graph() DotGraph -} - -type errorWithGraph struct { - graph string - err error -} - -func (err errorWithGraph) Graph() DotGraph { - return DotGraph(err.graph) -} - -func (err errorWithGraph) Error() string { - return err.err.Error() -} - -// VisualizeError returns the visualization of the error if available. -func VisualizeError(err error) (string, error) { - if e, ok := err.(errWithGraph); ok && e.Graph() != "" { - return string(e.Graph()), nil - } - return "", errors.New("unable to visualize error") -} - -// Run starts the application, blocks on the signals channel, and then -// gracefully shuts the application down. It uses DefaultTimeout to set a -// deadline for application startup and shutdown, unless the user has -// configured different timeouts with the StartTimeout or StopTimeout options. -// It's designed to make typical applications simple to run. -// -// However, all of Run's functionality is implemented in terms of the exported -// Start, Done, and Stop methods. Applications with more specialized needs -// can use those methods directly instead of relying on Run. -func (app *App) Run() { - app.run(app.Done()) -} - -// Err returns any error encountered during New's initialization. See the -// documentation of the New method for details, but typical errors include -// missing constructors, circular dependencies, constructor errors, and -// invocation errors. -// -// Most users won't need to use this method, since both Run and Start -// short-circuit if initialization failed. -func (app *App) Err() error { - return app.err -} - -// Start kicks off all long-running goroutines, like network servers or -// message queue consumers. It does this by interacting with the application's -// Lifecycle. -// -// By taking a dependency on the Lifecycle type, some of the user-supplied -// functions called during initialization may have registered start and stop -// hooks. Because initialization calls constructors serially and in dependency -// order, hooks are naturally registered in dependency order too. -// -// Start executes all OnStart hooks registered with the application's -// Lifecycle, one at a time and in order. This ensures that each constructor's -// start hooks aren't executed until all its dependencies' start hooks -// complete. If any of the start hooks return an error, Start short-circuits, -// calls Stop, and returns the inciting error. -// -// Note that Start short-circuits immediately if the New constructor -// encountered any errors in application initialization. -func (app *App) Start(ctx context.Context) error { - return withTimeout(ctx, app.start) -} - -// Stop gracefully stops the application. It executes any registered OnStop -// hooks in reverse order, so that each constructor's stop hooks are called -// before its dependencies' stop hooks. -// -// If the application didn't start cleanly, only hooks whose OnStart phase was -// called are executed. However, all those hooks are executed, even if some -// fail. -func (app *App) Stop(ctx context.Context) error { - return withTimeout(ctx, app.lifecycle.Stop) -} - -// Done returns a channel of signals to block on after starting the -// application. Applications listen for the SIGINT and SIGTERM signals; during -// development, users can send the application SIGTERM by pressing Ctrl-C in -// the same terminal as the running process. -// -// Alternatively, a signal can be broadcast to all done channels manually by -// using the Shutdown functionality (see the Shutdowner documentation for details). -func (app *App) Done() <-chan os.Signal { - c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) - - app.donesMu.Lock() - app.dones = append(app.dones, c) - app.donesMu.Unlock() - return c -} - -// StartTimeout returns the configured startup timeout. Apps default to using -// DefaultTimeout, but users can configure this behavior using the -// StartTimeout option. -func (app *App) StartTimeout() time.Duration { - return app.startTimeout -} - -// StopTimeout returns the configured shutdown timeout. Apps default to using -// DefaultTimeout, but users can configure this behavior using the StopTimeout -// option. -func (app *App) StopTimeout() time.Duration { - return app.stopTimeout -} - -func (app *App) dotGraph() (DotGraph, error) { - var b bytes.Buffer - err := dig.Visualize(app.container, &b) - return DotGraph(b.String()), err -} - -func (app *App) provide(constructor interface{}) { - if app.err != nil { - return - } - app.logger.PrintProvide(constructor) - - if _, ok := constructor.(Option); ok { - app.err = fmt.Errorf("fx.Option should be passed to fx.New directly, not to fx.Provide: fx.Provide received %v", constructor) - return - } - - if a, ok := constructor.(Annotated); ok { - var opts []dig.ProvideOption - switch { - case len(a.Group) > 0 && len(a.Name) > 0: - app.err = fmt.Errorf("fx.Annotate may not specify both name and group for %v", constructor) - return - case len(a.Name) > 0: - opts = append(opts, dig.Name(a.Name)) - case len(a.Group) > 0: - opts = append(opts, dig.Group(a.Group)) - - } - - if err := app.container.Provide(a.Target, opts...); err != nil { - app.err = err - } - return - } - - if reflect.TypeOf(constructor).Kind() == reflect.Func { - ft := reflect.ValueOf(constructor).Type() - - for i := 0; i < ft.NumOut(); i++ { - t := ft.Out(i) - - if t == reflect.TypeOf(Annotated{}) { - app.err = fmt.Errorf("fx.Annotated should be passed to fx.Provide directly, it should not be returned by the constructor: fx.Provide received %v", constructor) - return - } - } - } - - if err := app.container.Provide(constructor); err != nil { - app.err = err - } -} - -// Execute invokes in order supplied to New, returning the first error -// encountered. -func (app *App) executeInvokes() error { - // TODO: consider taking a context to limit the time spent running invocations. - var err error - - for _, fn := range app.invokes { - fname := fxreflect.FuncName(fn) - app.logger.Printf("INVOKE\t\t%s", fname) - - if _, ok := fn.(Option); ok { - err = fmt.Errorf("fx.Option should be passed to fx.New directly, not to fx.Invoke: fx.Invoke received %v", fn) - } else { - err = app.container.Invoke(fn) - } - - if err != nil { - app.logger.Printf("Error during %q invoke: %v", fname, err) - break - } - } - - return err -} - -func (app *App) run(done <-chan os.Signal) { - startCtx, cancel := context.WithTimeout(context.Background(), app.StartTimeout()) - defer cancel() - - if err := app.Start(startCtx); err != nil { - app.logger.Fatalf("ERROR\t\tFailed to start: %v", err) - } - - app.logger.PrintSignal(<-done) - - stopCtx, cancel := context.WithTimeout(context.Background(), app.StopTimeout()) - defer cancel() - - if err := app.Stop(stopCtx); err != nil { - app.logger.Fatalf("ERROR\t\tFailed to stop cleanly: %v", err) - } -} - -func (app *App) start(ctx context.Context) error { - if app.err != nil { - // Some provides failed, short-circuit immediately. - return app.err - } - - // Attempt to start cleanly. - if err := app.lifecycle.Start(ctx); err != nil { - // Start failed, roll back. - app.logger.Printf("ERROR\t\tStart failed, rolling back: %v", err) - if stopErr := app.lifecycle.Stop(ctx); stopErr != nil { - app.logger.Printf("ERROR\t\tCouldn't rollback cleanly: %v", stopErr) - return multierr.Append(err, stopErr) - } - return err - } - - app.logger.Printf("RUNNING") - return nil -} - -func withTimeout(ctx context.Context, f func(context.Context) error) error { - c := make(chan error, 1) - go func() { c <- f(ctx) }() - - select { - case <-ctx.Done(): - return ctx.Err() - case err := <-c: - return err - } -} diff --git a/vendor/go.uber.org/fx/doc.go b/vendor/go.uber.org/fx/doc.go deleted file mode 100644 index c86996c5..00000000 --- a/vendor/go.uber.org/fx/doc.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package fx is a framework that makes it easy to build applications out of -// reusable, composable modules. -// -// Fx applications use dependency injection to eliminate globals without the -// tedium of manually wiring together function calls. Unlike other approaches -// to dependency injection, Fx works with plain Go functions: you don't need -// to use struct tags or embed special types, so Fx automatically works well -// with most Go packages. -// -// Basic usage is explained in the package-level example below. If you're new -// to Fx, start there! Advanced features, including named instances, optional -// parameters, and value groups, are explained under the In and Out types. -// -// Testing Fx Applications -// -// To test functions that use the Lifecycle type or to write end-to-end tests -// of your Fx application, use the helper functions and types provided by the -// go.uber.org/fx/fxtest package. -package fx diff --git a/vendor/go.uber.org/fx/extract.go b/vendor/go.uber.org/fx/extract.go deleted file mode 100644 index 8fb34a0b..00000000 --- a/vendor/go.uber.org/fx/extract.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import ( - "fmt" - "reflect" - "unicode" - "unicode/utf8" -) - -var _typeOfIn = reflect.TypeOf(In{}) - -// Extract fills the given struct with values from the dependency injection -// container on application initialization. The target MUST be a pointer to a -// struct. Only exported fields will be filled. -// -// Extract will be deprecated soon: use Populate instead, which doesn't -// require defining a container struct. -func Extract(target interface{}) Option { - v := reflect.ValueOf(target) - - if t := v.Type(); t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct { - return invokeErr(fmt.Errorf("Extract expected a pointer to a struct, got a %v", t)) - } - - v = v.Elem() - t := v.Type() - - // We generate a function which accepts a single fx.In struct as an - // argument. This struct contains all exported fields of the target - // struct. - - // Fields of the generated fx.In struct. - fields := make([]reflect.StructField, 0, t.NumField()+1) - - // Anonymous dig.In field. - fields = append(fields, reflect.StructField{ - Name: _typeOfIn.Name(), - Anonymous: true, - Type: _typeOfIn, - }) - - // List of values in the target struct aligned with the fields of the - // generated struct. - // - // So for example, if the target is, - // - // var target struct { - // Foo io.Reader - // bar []byte - // Baz io.Writer - // } - // - // The generated struct has the shape, - // - // struct { - // fx.In - // - // F0 io.Reader - // F2 io.Writer - // } - // - // And `targets` is, - // - // [ - // target.Field(0), // Foo io.Reader - // target.Field(2), // Baz io.Writer - // ] - // - // As we iterate through the fields of the generated struct, we can copy - // the value into the corresponding value in the targets list. - targets := make([]reflect.Value, 0, t.NumField()) - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - - // Skip unexported fields. - if f.Anonymous { - // If embedded, StructField.PkgPath is not a reliable indicator of - // whether the field is exported. See - // https://github.com/golang/go/issues/21122 - - t := f.Type - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - - if !isExported(t.Name()) { - continue - } - } else if f.PkgPath != "" { - continue - } - - // We don't copy over names or embedded semantics. - fields = append(fields, reflect.StructField{ - Name: fmt.Sprintf("F%d", i), - Type: f.Type, - Tag: f.Tag, - }) - targets = append(targets, v.Field(i)) - } - - // Equivalent to, - // - // func(r struct { - // fx.In - // - // F1 Foo - // F2 Bar - // }) { - // target.Foo = r.F1 - // target.Bar = r.F2 - // } - - fn := reflect.MakeFunc( - reflect.FuncOf( - []reflect.Type{reflect.StructOf(fields)}, - nil, /* results */ - false, /* variadic */ - ), - func(args []reflect.Value) []reflect.Value { - result := args[0] - for i := 1; i < result.NumField(); i++ { - targets[i-1].Set(result.Field(i)) - } - return nil - }, - ) - - return Invoke(fn.Interface()) -} - -// isExported reports whether the identifier is exported. -func isExported(id string) bool { - r, _ := utf8.DecodeRuneInString(id) - return unicode.IsUpper(r) -} diff --git a/vendor/go.uber.org/fx/glide.lock b/vendor/go.uber.org/fx/glide.lock deleted file mode 100644 index 4fb92261..00000000 --- a/vendor/go.uber.org/fx/glide.lock +++ /dev/null @@ -1,44 +0,0 @@ -hash: 71b848dcf5bde6b02fd7ca7cf3ac1e7628dd27e7248f3823900bce9a78005038 -updated: 2018-09-20T11:31:48.18331584-07:00 -imports: -- name: go.uber.org/atomic - version: 1ea20fb1cbb1cc08cbd0d913a96dead89aa18289 -- name: go.uber.org/dig - version: 7ff117f761a3f1b3eb521945c17a1091438eb6de - subpackages: - - internal/digreflect - - internal/dot -- name: go.uber.org/multierr - version: 3c4937480c32f4c13a875a1829af76c98ca3d40a -testImports: -- name: github.com/davecgh/go-spew - version: 8991bc29aa16c548c550c7ff78260e27b9ab7c73 - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: 792786c7400a136282c1664665ae0a8db921c6c2 - subpackages: - - difflib -- name: github.com/stretchr/testify - version: f35b8ab0b5a2cef36673838d662e249dd9c94686 - subpackages: - - assert - - require -- name: go.uber.org/goleak - version: 1ac8aeca0a53163331564467638f6ffb639636bf - subpackages: - - internal/stack -- name: go.uber.org/tools - version: ce2550dad7144b81ae2f67dc5e55597643f6902b - subpackages: - - update-license -- name: golang.org/x/lint - version: 06c8688daad7faa9da5a0c2f163a3d14aac986ca - repo: https://github.com/golang/lint - vcs: git - subpackages: - - golint -- name: golang.org/x/tools - version: 4e70a1b26a7875f00ca1916637a876b5ffaeec59 - subpackages: - - cover diff --git a/vendor/go.uber.org/fx/glide.yaml b/vendor/go.uber.org/fx/glide.yaml deleted file mode 100644 index f4422bc6..00000000 --- a/vendor/go.uber.org/fx/glide.yaml +++ /dev/null @@ -1,25 +0,0 @@ -package: go.uber.org/fx -import: -- package: go.uber.org/multierr - version: ^1 -- package: go.uber.org/dig - version: ^1.7 # At least version 1.7 is required for fx/dig `Group` support. -testImport: -- package: github.com/stretchr/testify - version: ^1 - subpackages: - - assert - - require -- package: go.uber.org/tools - subpackages: - - update-license -- package: golang.org/x/tools - subpackages: - - cover -- package: golang.org/x/lint - repo: https://github.com/golang/lint - vcs: git - subpackages: - - golint -- package: go.uber.org/goleak - version: ~0.10 diff --git a/vendor/go.uber.org/fx/inout.go b/vendor/go.uber.org/fx/inout.go deleted file mode 100644 index 6c37c567..00000000 --- a/vendor/go.uber.org/fx/inout.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import "go.uber.org/dig" - -// In can be embedded in a constructor's parameter struct to take advantage of -// advanced dependency injection features. -// -// Modules should take a single parameter struct that embeds an In in order to -// provide a forward-compatible API: since adding fields to a struct is -// backward-compatible, modules can then add optional dependencies in minor -// releases. -// -// Parameter Structs -// -// Fx constructors declare their dependencies as function parameters. This can -// quickly become unreadable if the constructor has a lot of dependencies. -// -// func NewHandler(users *UserGateway, comments *CommentGateway, posts *PostGateway, votes *VoteGateway, authz *AuthZGateway) *Handler { -// // ... -// } -// -// To improve the readability of constructors like this, create a struct that -// lists all the dependencies as fields and change the function to accept that -// struct instead. The new struct is called a parameter struct. -// -// Fx has first class support for parameter structs: any struct embedding -// fx.In gets treated as a parameter struct, so the individual fields in the -// struct are supplied via dependency injection. Using a parameter struct, we -// can make the constructor above much more readable: -// -// type HandlerParams struct { -// fx.In -// -// Users *UserGateway -// Comments *CommentGateway -// Posts *PostGateway -// Votes *VoteGateway -// AuthZ *AuthZGateway -// } -// -// func NewHandler(p HandlerParams) *Handler { -// // ... -// } -// -// Though it's rarely a good idea, constructors can receive any combination of -// parameter structs and parameters. -// -// func NewHandler(p HandlerParams, l *log.Logger) *Handler { -// // ... -// } -// -// Optional Dependencies -// -// Constructors often have soft dependencies on some types: if those types are -// missing, they can operate in a degraded state. Fx supports optional -// dependencies via the `optional:"true"` tag to fields on parameter structs. -// -// type UserGatewayParams struct { -// fx.In -// -// Conn *sql.DB -// Cache *redis.Client `optional:"true"` -// } -// -// If an optional field isn't available in the container, the constructor -// receives the field's zero value. -// -// func NewUserGateway(p UserGatewayParams, log *log.Logger) (*UserGateway, error) { -// if p.Cache != nil { -// log.Print("Caching disabled") -// } -// // ... -// } -// -// Constructors that declare optional dependencies MUST gracefully handle -// situations in which those dependencies are absent. -// -// The optional tag also allows adding new dependencies without breaking -// existing consumers of the constructor. -// -// Named Values -// -// Some use cases require the application container to hold multiple values of -// the same type. For details on producing named values, see the documentation -// for the Out type. -// -// Fx allows functions to consume named values via the `name:".."` tag on -// parameter structs. Note that both the name AND type of the fields on the -// parameter struct must match the corresponding result struct. -// -// type GatewayParams struct { -// fx.In -// -// WriteToConn *sql.DB `name:"rw"` -// ReadFromConn *sql.DB `name:"ro"` -// } -// -// The name tag may be combined with the optional tag to declare the -// dependency optional. -// -// type GatewayParams struct { -// fx.In -// -// WriteToConn *sql.DB `name:"rw"` -// ReadFromConn *sql.DB `name:"ro" optional:"true"` -// } -// -// func NewCommentGateway(p GatewayParams, log *log.Logger) (*CommentGateway, error) { -// if p.ReadFromConn == nil { -// log.Print("Warning: Using RW connection for reads") -// p.ReadFromConn = p.WriteToConn -// } -// // ... -// } -// -// Value Groups -// -// To make it easier to produce and consume many values of the same type, Fx -// supports named, unordered collections called value groups. For details on -// producing value groups, see the documentation for the Out type. -// -// Functions can depend on a value group by requesting a slice tagged with -// `group:".."`. This will execute all constructors that provide a value to -// that group in an unspecified order, then collect all the results into a -// single slice. Keep in mind that this makes the types of the parameter and -// result struct fields different: if a group of constructors each returns -// type T, parameter structs consuming the group must use a field of type []T. -// -// type ServerParams struct { -// fx.In -// -// Handlers []Handler `group:"server"` -// } -// -// func NewServer(p ServerParams) *Server { -// server := newServer() -// for _, h := range p.Handlers { -// server.Register(h) -// } -// return server -// } -// -// Note that values in a value group are unordered. Fx makes no guarantees -// about the order in which these values will be produced. -type In struct{ dig.In } - -// Out is the inverse of In: it can be embedded in result structs to take -// advantage of advanced features. -// -// Modules should return a single result struct that embeds an Out in order to -// provide a forward-compatible API: since adding fields to a struct is -// backward-compatible, minor releases can provide additional types. -// -// Result Structs -// -// Result structs are the inverse of parameter structs (discussed in the In -// documentation). These structs represent multiple outputs from a -// single function as fields. Fx treats all structs embedding fx.Out as result -// structs, so other constructors can rely on the result struct's fields -// directly. -// -// Without result structs, we sometimes have function definitions like this: -// -// func SetupGateways(conn *sql.DB) (*UserGateway, *CommentGateway, *PostGateway, error) { -// // ... -// } -// -// With result structs, we can make this both more readable and easier to -// modify in the future: -// -// type Gateways struct { -// fx.Out -// -// Users *UserGateway -// Comments *CommentGateway -// Posts *PostGateway -// } -// -// func SetupGateways(conn *sql.DB) (Gateways, error) { -// // ... -// } -// -// Named Values -// -// Some use cases require the application container to hold multiple values of -// the same type. For details on consuming named values, see the documentation -// for the In type. -// -// A constructor that produces a result struct can tag any field with -// `name:".."` to have the corresponding value added to the graph under the -// specified name. An application may contain at most one unnamed value of a -// given type, but may contain any number of named values of the same type. -// -// type ConnectionResult struct { -// fx.Out -// -// ReadWrite *sql.DB `name:"rw"` -// ReadOnly *sql.DB `name:"ro"` -// } -// -// func ConnectToDatabase(...) (ConnectionResult, error) { -// // ... -// return ConnectionResult{ReadWrite: rw, ReadOnly: ro}, nil -// } -// -// Value Groups -// -// To make it easier to produce and consume many values of the same type, Fx -// supports named, unordered collections called value groups. For details on -// consuming value groups, see the documentation for the In type. -// -// Constructors can send values into value groups by returning a result struct -// tagged with `group:".."`. -// -// type HandlerResult struct { -// fx.Out -// -// Handler Handler `group:"server"` -// } -// -// func NewHelloHandler() HandlerResult { -// // ... -// } -// -// func NewEchoHandler() HandlerResult { -// // ... -// } -// -// Any number of constructors may provide values to this named collection, but -// the ordering of the final collection is unspecified. Keep in mind that -// value groups require parameter and result structs to use fields with -// different types: if a group of constructors each returns type T, parameter -// structs consuming the group must use a field of type []T. -type Out struct{ dig.Out } diff --git a/vendor/go.uber.org/fx/internal/fxlog/fxlog.go b/vendor/go.uber.org/fx/internal/fxlog/fxlog.go deleted file mode 100644 index 18c3e366..00000000 --- a/vendor/go.uber.org/fx/internal/fxlog/fxlog.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fxlog - -import ( - "fmt" - "log" - "os" - "strings" - - "go.uber.org/fx/internal/fxreflect" -) - -var _exit = func() { os.Exit(1) } - -// Printer is a formatting printer. -type Printer interface { - Printf(string, ...interface{}) -} - -// New returns a new Logger backed by the standard library's log package. -func New() *Logger { - return &Logger{log.New(os.Stderr, "", log.LstdFlags)} -} - -// A Logger writes output to standard error. -type Logger struct { - Printer -} - -// Printf logs a formatted Fx line. -func (l *Logger) Printf(format string, v ...interface{}) { - l.Printer.Printf(prepend(format), v...) -} - -// PrintProvide logs a type provided into the dig.Container. -func (l *Logger) PrintProvide(t interface{}) { - for _, rtype := range fxreflect.ReturnTypes(t) { - l.Printf("PROVIDE\t%s <= %s", rtype, fxreflect.FuncName(t)) - } -} - -// PrintSignal logs an os.Signal. -func (l *Logger) PrintSignal(signal os.Signal) { - l.Printf(strings.ToUpper(signal.String())) -} - -// Panic logs an Fx line then panics. -func (l *Logger) Panic(err error) { - l.Printer.Printf(prepend(err.Error())) - panic(err) -} - -// Fatalf logs an Fx line then fatals. -func (l *Logger) Fatalf(format string, v ...interface{}) { - l.Printer.Printf(prepend(format), v...) - _exit() -} - -func prepend(str string) string { - return fmt.Sprintf("[Fx] %s", str) -} diff --git a/vendor/go.uber.org/fx/internal/fxreflect/fxreflect.go b/vendor/go.uber.org/fx/internal/fxreflect/fxreflect.go deleted file mode 100644 index 8e2692dc..00000000 --- a/vendor/go.uber.org/fx/internal/fxreflect/fxreflect.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fxreflect - -import ( - "fmt" - "net/url" - "reflect" - "regexp" - "runtime" - "strings" - - "go.uber.org/dig" -) - -// Match from beginning of the line until the first `vendor/` (non-greedy) -var vendorRe = regexp.MustCompile("^.*?/vendor/") - -// ReturnTypes takes a func and returns a slice of string'd types. -func ReturnTypes(t interface{}) []string { - if reflect.TypeOf(t).Kind() != reflect.Func { - // Invalid provide, will be logged as an error. - return []string{} - } - - rtypes := []string{} - ft := reflect.ValueOf(t).Type() - - for i := 0; i < ft.NumOut(); i++ { - t := ft.Out(i) - - traverseOuts(key{t: t}, func(s string) { - rtypes = append(rtypes, s) - }) - } - - return rtypes -} - -type key struct { - t reflect.Type - name string -} - -func (k *key) String() string { - if k.name != "" { - return fmt.Sprintf("%v:%s", k.t, k.name) - } - return k.t.String() -} - -func traverseOuts(k key, f func(s string)) { - // skip errors - if isErr(k.t) { - return - } - - // call funtion on non-Out types - if dig.IsOut(k.t) { - // keep recursing down on field members in case they are ins - for i := 0; i < k.t.NumField(); i++ { - field := k.t.Field(i) - ft := field.Type - - if field.PkgPath != "" { - continue // skip private fields - } - - // keep recursing to traverse all the embedded objects - k := key{ - t: ft, - name: field.Tag.Get("name"), - } - traverseOuts(k, f) - } - - return - } - - f(k.String()) -} - -// sanitize makes the function name suitable for logging display. It removes -// url-encoded elements from the `dot.git` package names and shortens the -// vendored paths. -func sanitize(function string) string { - // Use the stdlib to un-escape any package import paths which can happen - // in the case of the "dot-git" postfix. Seems like a bug in stdlib =/ - if unescaped, err := url.QueryUnescape(function); err == nil { - function = unescaped - } - - // strip everything prior to the vendor - return vendorRe.ReplaceAllString(function, "vendor/") -} - -// Caller returns the formatted calling func name -func Caller() string { - // Ascend at most 8 frames looking for a caller outside fx. - pcs := make([]uintptr, 8) - - // Don't include this frame. - n := runtime.Callers(2, pcs) - if n == 0 { - return "n/a" - } - - frames := runtime.CallersFrames(pcs) - for f, more := frames.Next(); more; f, more = frames.Next() { - if shouldIgnoreFrame(f) { - continue - } - return sanitize(f.Function) - } - return "n/a" -} - -// FuncName returns a funcs formatted name -func FuncName(fn interface{}) string { - fnV := reflect.ValueOf(fn) - if fnV.Kind() != reflect.Func { - return "n/a" - } - - function := runtime.FuncForPC(fnV.Pointer()).Name() - return fmt.Sprintf("%s()", sanitize(function)) -} - -func isErr(t reflect.Type) bool { - errInterface := reflect.TypeOf((*error)(nil)).Elem() - return t.Implements(errInterface) -} - -// Ascend the call stack until we leave the Fx production code. This allows us -// to avoid hard-coding a frame skip, which makes this code work well even -// when it's wrapped. -func shouldIgnoreFrame(f runtime.Frame) bool { - if strings.Contains(f.File, "_test.go") { - return false - } - if strings.Contains(f.File, "go.uber.org/fx") { - return true - } - return false -} diff --git a/vendor/go.uber.org/fx/internal/lifecycle/lifecycle.go b/vendor/go.uber.org/fx/internal/lifecycle/lifecycle.go deleted file mode 100644 index ded22ed4..00000000 --- a/vendor/go.uber.org/fx/internal/lifecycle/lifecycle.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package lifecycle - -import ( - "context" - - "go.uber.org/fx/internal/fxlog" - "go.uber.org/fx/internal/fxreflect" - "go.uber.org/multierr" -) - -// A Hook is a pair of start and stop callbacks, either of which can be nil, -// plus a string identifying the supplier of the hook. -type Hook struct { - OnStart func(context.Context) error - OnStop func(context.Context) error - caller string -} - -// Lifecycle coordinates application lifecycle hooks. -type Lifecycle struct { - logger *fxlog.Logger - hooks []Hook - numStarted int -} - -// New constructs a new Lifecycle. -func New(logger *fxlog.Logger) *Lifecycle { - if logger == nil { - logger = fxlog.New() - } - return &Lifecycle{logger: logger} -} - -// Append adds a Hook to the lifecycle. -func (l *Lifecycle) Append(hook Hook) { - hook.caller = fxreflect.Caller() - l.hooks = append(l.hooks, hook) -} - -// Start runs all OnStart hooks, returning immediately if it encounters an -// error. -func (l *Lifecycle) Start(ctx context.Context) error { - for _, hook := range l.hooks { - if hook.OnStart != nil { - l.logger.Printf("START\t\t%s()", hook.caller) - if err := hook.OnStart(ctx); err != nil { - return err - } - } - l.numStarted++ - } - return nil -} - -// Stop runs any OnStop hooks whose OnStart counterpart succeeded. OnStop -// hooks run in reverse order. -func (l *Lifecycle) Stop(ctx context.Context) error { - var errs []error - // Run backward from last successful OnStart. - for ; l.numStarted > 0; l.numStarted-- { - hook := l.hooks[l.numStarted-1] - if hook.OnStop == nil { - continue - } - l.logger.Printf("STOP\t\t%s()", hook.caller) - if err := hook.OnStop(ctx); err != nil { - // For best-effort cleanup, keep going after errors. - errs = append(errs, err) - } - } - return multierr.Combine(errs...) -} diff --git a/vendor/go.uber.org/fx/lifecycle.go b/vendor/go.uber.org/fx/lifecycle.go deleted file mode 100644 index f187e223..00000000 --- a/vendor/go.uber.org/fx/lifecycle.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import ( - "context" - - "go.uber.org/fx/internal/lifecycle" -) - -// Lifecycle allows constructors to register callbacks that are executed on -// application start and stop. See the documentation for App for details on Fx -// applications' initialization, startup, and shutdown logic. -type Lifecycle interface { - Append(Hook) -} - -// A Hook is a pair of start and stop callbacks, either of which can be nil. -// If a Hook's OnStart callback isn't executed (because a previous OnStart -// failure short-circuited application startup), its OnStop callback won't be -// executed. -type Hook struct { - OnStart func(context.Context) error - OnStop func(context.Context) error -} - -type lifecycleWrapper struct{ *lifecycle.Lifecycle } - -func (l *lifecycleWrapper) Append(h Hook) { - l.Lifecycle.Append(lifecycle.Hook{ - OnStart: h.OnStart, - OnStop: h.OnStop, - }) -} diff --git a/vendor/go.uber.org/fx/populate.go b/vendor/go.uber.org/fx/populate.go deleted file mode 100644 index 1c503c5b..00000000 --- a/vendor/go.uber.org/fx/populate.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import ( - "fmt" - "reflect" -) - -// Populate sets targets with values from the dependency injection container -// during application initialization. All targets must be pointers to the -// values that must be populated. Pointers to structs that embed In are -// supported, which can be used to populate multiple values in a struct. -// -// This is most helpful in unit tests: it lets tests leverage Fx's automatic -// constructor wiring to build a few structs, but then extract those structs -// for further testing. -func Populate(targets ...interface{}) Option { - // Validate all targets are non-nil pointers. - targetTypes := make([]reflect.Type, len(targets)) - for i, t := range targets { - if t == nil { - return invokeErr(fmt.Errorf("failed to Populate: target %v is nil", i+1)) - } - rt := reflect.TypeOf(t) - if rt.Kind() != reflect.Ptr { - return invokeErr(fmt.Errorf("failed to Populate: target %v is not a pointer type, got %T", i+1, t)) - } - - targetTypes[i] = reflect.TypeOf(t).Elem() - } - - // Build a function that looks like: - // - // func(t1 T1, t2 T2, ...) { - // *targets[0] = t1 - // *targets[1] = t2 - // [...] - // } - // - fnType := reflect.FuncOf(targetTypes, nil, false /* variadic */) - fn := reflect.MakeFunc(fnType, func(args []reflect.Value) []reflect.Value { - for i, arg := range args { - reflect.ValueOf(targets[i]).Elem().Set(arg) - } - return nil - }) - return Invoke(fn.Interface()) -} - -func invokeErr(err error) Option { - return Invoke(func() error { - return err - }) -} diff --git a/vendor/go.uber.org/fx/shutdown.go b/vendor/go.uber.org/fx/shutdown.go deleted file mode 100644 index 928e45d8..00000000 --- a/vendor/go.uber.org/fx/shutdown.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -import ( - "fmt" - "os" - "syscall" -) - -// Shutdowner provides a method that can manually trigger the shutdown of the -// application by sending a signal to all open Done channels. Shutdowner works -// on applications using Run as well as Start, Done, and Stop. The Shutdowner is -// provided to all Fx applications. -type Shutdowner interface { - Shutdown(...ShutdownOption) error -} - -// ShutdownOption provides a way to configure properties of the shutdown -// process. Currently, no options have been implemented. -type ShutdownOption interface { - apply(*shutdowner) -} - -type shutdowner struct { - app *App -} - -// Shutdown broadcasts a signal to all of the application's Done channels -// and begins the Stop process. -func (s *shutdowner) Shutdown(opts ...ShutdownOption) error { - return s.app.broadcastSignal(syscall.SIGTERM) -} - -func (app *App) shutdowner() Shutdowner { - return &shutdowner{app: app} -} - -func (app *App) broadcastSignal(signal os.Signal) error { - app.donesMu.RLock() - defer app.donesMu.RUnlock() - - var unsent int - for _, done := range app.dones { - select { - case done <- signal: - default: - // shutdown called when done channel has already received a - // termination signal that has not been cleared - unsent++ - } - } - - if unsent != 0 { - return fmt.Errorf("failed to send %v signal to %v out of %v channels", - signal, unsent, len(app.dones), - ) - } - - return nil -} diff --git a/vendor/go.uber.org/fx/version.go b/vendor/go.uber.org/fx/version.go deleted file mode 100644 index 1fe32c35..00000000 --- a/vendor/go.uber.org/fx/version.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2019 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package fx - -// Version is exported for runtime compatibility checks. -const Version = "1.9.0" diff --git a/vendor/go.uber.org/multierr/.codecov.yml b/vendor/go.uber.org/multierr/.codecov.yml deleted file mode 100644 index 6d4d1be7..00000000 --- a/vendor/go.uber.org/multierr/.codecov.yml +++ /dev/null @@ -1,15 +0,0 @@ -coverage: - range: 80..100 - round: down - precision: 2 - - status: - project: # measuring the overall project coverage - default: # context, you can create multiple ones with custom titles - enabled: yes # must be yes|true to enable this status - target: 100 # specify the target coverage for each commit status - # option: "auto" (must increase from parent commit or pull request base) - # option: "X%" a static target percentage to hit - if_not_found: success # if parent is not found report status as success, error, or failure - if_ci_failed: error # if ci fails report status as success, error, or failure - diff --git a/vendor/go.uber.org/multierr/.gitignore b/vendor/go.uber.org/multierr/.gitignore deleted file mode 100644 index 61ead866..00000000 --- a/vendor/go.uber.org/multierr/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/vendor diff --git a/vendor/go.uber.org/multierr/.travis.yml b/vendor/go.uber.org/multierr/.travis.yml deleted file mode 100644 index 5ffa8fed..00000000 --- a/vendor/go.uber.org/multierr/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -sudo: false -language: go -go_import_path: go.uber.org/multierr - -env: - global: - - GO15VENDOREXPERIMENT=1 - -go: - - 1.7 - - 1.8 - - tip - -cache: - directories: - - vendor - -before_install: -- go version - -install: -- | - set -e - make install_ci - -script: -- | - set -e - make lint - make test_ci - -after_success: -- bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/multierr/CHANGELOG.md b/vendor/go.uber.org/multierr/CHANGELOG.md deleted file mode 100644 index 898445d0..00000000 --- a/vendor/go.uber.org/multierr/CHANGELOG.md +++ /dev/null @@ -1,28 +0,0 @@ -Releases -======== - -v1.1.0 (2017-06-30) -=================== - -- Added an `Errors(error) []error` function to extract the underlying list of - errors for a multierr error. - - -v1.0.0 (2017-05-31) -=================== - -No changes since v0.2.0. This release is committing to making no breaking -changes to the current API in the 1.X series. - - -v0.2.0 (2017-04-11) -=================== - -- Repeatedly appending to the same error is now faster due to fewer - allocations. - - -v0.1.0 (2017-31-03) -=================== - -- Initial release diff --git a/vendor/go.uber.org/multierr/LICENSE.txt b/vendor/go.uber.org/multierr/LICENSE.txt deleted file mode 100644 index 858e0247..00000000 --- a/vendor/go.uber.org/multierr/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017 Uber Technologies, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/go.uber.org/multierr/Makefile b/vendor/go.uber.org/multierr/Makefile deleted file mode 100644 index a7437d06..00000000 --- a/vendor/go.uber.org/multierr/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -export GO15VENDOREXPERIMENT=1 - -PACKAGES := $(shell glide nv) - -GO_FILES := $(shell \ - find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ - -o -name '*.go' -print | cut -b3-) - -.PHONY: install -install: - glide --version || go get github.com/Masterminds/glide - glide install - -.PHONY: build -build: - go build -i $(PACKAGES) - -.PHONY: test -test: - go test -cover -race $(PACKAGES) - -.PHONY: gofmt -gofmt: - $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) - @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true - @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false) - -.PHONY: govet -govet: - $(eval VET_LOG := $(shell mktemp -t govet.XXXXX)) - @go vet $(PACKAGES) 2>&1 \ - | grep -v '^exit status' > $(VET_LOG) || true - @[ ! -s "$(VET_LOG)" ] || (echo "govet failed:" | cat - $(VET_LOG) && false) - -.PHONY: golint -golint: - @go get github.com/golang/lint/golint - $(eval LINT_LOG := $(shell mktemp -t golint.XXXXX)) - @cat /dev/null > $(LINT_LOG) - @$(foreach pkg, $(PACKAGES), golint $(pkg) >> $(LINT_LOG) || true;) - @[ ! -s "$(LINT_LOG)" ] || (echo "golint failed:" | cat - $(LINT_LOG) && false) - -.PHONY: staticcheck -staticcheck: - @go get honnef.co/go/tools/cmd/staticcheck - $(eval STATICCHECK_LOG := $(shell mktemp -t staticcheck.XXXXX)) - @staticcheck $(PACKAGES) 2>&1 > $(STATICCHECK_LOG) || true - @[ ! -s "$(STATICCHECK_LOG)" ] || (echo "staticcheck failed:" | cat - $(STATICCHECK_LOG) && false) - -.PHONY: lint -lint: gofmt govet golint staticcheck - -.PHONY: cover -cover: - ./scripts/cover.sh $(shell go list $(PACKAGES)) - go tool cover -html=cover.out -o cover.html - -update-license: - @go get go.uber.org/tools/update-license - @update-license \ - $(shell go list -json $(PACKAGES) | \ - jq -r '.Dir + "/" + (.GoFiles | .[])') - -############################################################################## - -.PHONY: install_ci -install_ci: install - go get github.com/wadey/gocovmerge - go get github.com/mattn/goveralls - go get golang.org/x/tools/cmd/cover - -.PHONY: test_ci -test_ci: install_ci - ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/vendor/go.uber.org/multierr/README.md b/vendor/go.uber.org/multierr/README.md deleted file mode 100644 index 065088f6..00000000 --- a/vendor/go.uber.org/multierr/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] - -`multierr` allows combining one or more Go `error`s together. - -## Installation - - go get -u go.uber.org/multierr - -## Status - -Stable: No breaking changes will be made before 2.0. - -------------------------------------------------------------------------------- - -Released under the [MIT License]. - -[MIT License]: LICENSE.txt -[doc-img]: https://godoc.org/go.uber.org/multierr?status.svg -[doc]: https://godoc.org/go.uber.org/multierr -[ci-img]: https://travis-ci.org/uber-go/multierr.svg?branch=master -[cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg -[ci]: https://travis-ci.org/uber-go/multierr -[cov]: https://codecov.io/gh/uber-go/multierr diff --git a/vendor/go.uber.org/multierr/error.go b/vendor/go.uber.org/multierr/error.go deleted file mode 100644 index de6ce473..00000000 --- a/vendor/go.uber.org/multierr/error.go +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package multierr allows combining one or more errors together. -// -// Overview -// -// Errors can be combined with the use of the Combine function. -// -// multierr.Combine( -// reader.Close(), -// writer.Close(), -// conn.Close(), -// ) -// -// If only two errors are being combined, the Append function may be used -// instead. -// -// err = multierr.Combine(reader.Close(), writer.Close()) -// -// This makes it possible to record resource cleanup failures from deferred -// blocks with the help of named return values. -// -// func sendRequest(req Request) (err error) { -// conn, err := openConnection() -// if err != nil { -// return err -// } -// defer func() { -// err = multierr.Append(err, conn.Close()) -// }() -// // ... -// } -// -// The underlying list of errors for a returned error object may be retrieved -// with the Errors function. -// -// errors := multierr.Errors(err) -// if len(errors) > 0 { -// fmt.Println("The following errors occurred:") -// } -// -// Advanced Usage -// -// Errors returned by Combine and Append MAY implement the following -// interface. -// -// type errorGroup interface { -// // Returns a slice containing the underlying list of errors. -// // -// // This slice MUST NOT be modified by the caller. -// Errors() []error -// } -// -// Note that if you need access to list of errors behind a multierr error, you -// should prefer using the Errors function. That said, if you need cheap -// read-only access to the underlying errors slice, you can attempt to cast -// the error to this interface. You MUST handle the failure case gracefully -// because errors returned by Combine and Append are not guaranteed to -// implement this interface. -// -// var errors []error -// group, ok := err.(errorGroup) -// if ok { -// errors = group.Errors() -// } else { -// errors = []error{err} -// } -package multierr // import "go.uber.org/multierr" - -import ( - "bytes" - "fmt" - "io" - "strings" - "sync" - - "go.uber.org/atomic" -) - -var ( - // Separator for single-line error messages. - _singlelineSeparator = []byte("; ") - - _newline = []byte("\n") - - // Prefix for multi-line messages - _multilinePrefix = []byte("the following errors occurred:") - - // Prefix for the first and following lines of an item in a list of - // multi-line error messages. - // - // For example, if a single item is: - // - // foo - // bar - // - // It will become, - // - // - foo - // bar - _multilineSeparator = []byte("\n - ") - _multilineIndent = []byte(" ") -) - -// _bufferPool is a pool of bytes.Buffers. -var _bufferPool = sync.Pool{ - New: func() interface{} { - return &bytes.Buffer{} - }, -} - -type errorGroup interface { - Errors() []error -} - -// Errors returns a slice containing zero or more errors that the supplied -// error is composed of. If the error is nil, the returned slice is empty. -// -// err := multierr.Append(r.Close(), w.Close()) -// errors := multierr.Errors(err) -// -// If the error is not composed of other errors, the returned slice contains -// just the error that was passed in. -// -// Callers of this function are free to modify the returned slice. -func Errors(err error) []error { - if err == nil { - return nil - } - - // Note that we're casting to multiError, not errorGroup. Our contract is - // that returned errors MAY implement errorGroup. Errors, however, only - // has special behavior for multierr-specific error objects. - // - // This behavior can be expanded in the future but I think it's prudent to - // start with as little as possible in terms of contract and possibility - // of misuse. - eg, ok := err.(*multiError) - if !ok { - return []error{err} - } - - errors := eg.Errors() - result := make([]error, len(errors)) - copy(result, errors) - return result -} - -// multiError is an error that holds one or more errors. -// -// An instance of this is guaranteed to be non-empty and flattened. That is, -// none of the errors inside multiError are other multiErrors. -// -// multiError formats to a semi-colon delimited list of error messages with -// %v and with a more readable multi-line format with %+v. -type multiError struct { - copyNeeded atomic.Bool - errors []error -} - -var _ errorGroup = (*multiError)(nil) - -// Errors returns the list of underlying errors. -// -// This slice MUST NOT be modified. -func (merr *multiError) Errors() []error { - if merr == nil { - return nil - } - return merr.errors -} - -func (merr *multiError) Error() string { - if merr == nil { - return "" - } - - buff := _bufferPool.Get().(*bytes.Buffer) - buff.Reset() - - merr.writeSingleline(buff) - - result := buff.String() - _bufferPool.Put(buff) - return result -} - -func (merr *multiError) Format(f fmt.State, c rune) { - if c == 'v' && f.Flag('+') { - merr.writeMultiline(f) - } else { - merr.writeSingleline(f) - } -} - -func (merr *multiError) writeSingleline(w io.Writer) { - first := true - for _, item := range merr.errors { - if first { - first = false - } else { - w.Write(_singlelineSeparator) - } - io.WriteString(w, item.Error()) - } -} - -func (merr *multiError) writeMultiline(w io.Writer) { - w.Write(_multilinePrefix) - for _, item := range merr.errors { - w.Write(_multilineSeparator) - writePrefixLine(w, _multilineIndent, fmt.Sprintf("%+v", item)) - } -} - -// Writes s to the writer with the given prefix added before each line after -// the first. -func writePrefixLine(w io.Writer, prefix []byte, s string) { - first := true - for len(s) > 0 { - if first { - first = false - } else { - w.Write(prefix) - } - - idx := strings.IndexByte(s, '\n') - if idx < 0 { - idx = len(s) - 1 - } - - io.WriteString(w, s[:idx+1]) - s = s[idx+1:] - } -} - -type inspectResult struct { - // Number of top-level non-nil errors - Count int - - // Total number of errors including multiErrors - Capacity int - - // Index of the first non-nil error in the list. Value is meaningless if - // Count is zero. - FirstErrorIdx int - - // Whether the list contains at least one multiError - ContainsMultiError bool -} - -// Inspects the given slice of errors so that we can efficiently allocate -// space for it. -func inspect(errors []error) (res inspectResult) { - first := true - for i, err := range errors { - if err == nil { - continue - } - - res.Count++ - if first { - first = false - res.FirstErrorIdx = i - } - - if merr, ok := err.(*multiError); ok { - res.Capacity += len(merr.errors) - res.ContainsMultiError = true - } else { - res.Capacity++ - } - } - return -} - -// fromSlice converts the given list of errors into a single error. -func fromSlice(errors []error) error { - res := inspect(errors) - switch res.Count { - case 0: - return nil - case 1: - // only one non-nil entry - return errors[res.FirstErrorIdx] - case len(errors): - if !res.ContainsMultiError { - // already flat - return &multiError{errors: errors} - } - } - - nonNilErrs := make([]error, 0, res.Capacity) - for _, err := range errors[res.FirstErrorIdx:] { - if err == nil { - continue - } - - if nested, ok := err.(*multiError); ok { - nonNilErrs = append(nonNilErrs, nested.errors...) - } else { - nonNilErrs = append(nonNilErrs, err) - } - } - - return &multiError{errors: nonNilErrs} -} - -// Combine combines the passed errors into a single error. -// -// If zero arguments were passed or if all items are nil, a nil error is -// returned. -// -// Combine(nil, nil) // == nil -// -// If only a single error was passed, it is returned as-is. -// -// Combine(err) // == err -// -// Combine skips over nil arguments so this function may be used to combine -// together errors from operations that fail independently of each other. -// -// multierr.Combine( -// reader.Close(), -// writer.Close(), -// pipe.Close(), -// ) -// -// If any of the passed errors is a multierr error, it will be flattened along -// with the other errors. -// -// multierr.Combine(multierr.Combine(err1, err2), err3) -// // is the same as -// multierr.Combine(err1, err2, err3) -// -// The returned error formats into a readable multi-line error message if -// formatted with %+v. -// -// fmt.Sprintf("%+v", multierr.Combine(err1, err2)) -func Combine(errors ...error) error { - return fromSlice(errors) -} - -// Append appends the given errors together. Either value may be nil. -// -// This function is a specialization of Combine for the common case where -// there are only two errors. -// -// err = multierr.Append(reader.Close(), writer.Close()) -// -// The following pattern may also be used to record failure of deferred -// operations without losing information about the original error. -// -// func doSomething(..) (err error) { -// f := acquireResource() -// defer func() { -// err = multierr.Append(err, f.Close()) -// }() -func Append(left error, right error) error { - switch { - case left == nil: - return right - case right == nil: - return left - } - - if _, ok := right.(*multiError); !ok { - if l, ok := left.(*multiError); ok && !l.copyNeeded.Swap(true) { - // Common case where the error on the left is constantly being - // appended to. - errs := append(l.errors, right) - return &multiError{errors: errs} - } else if !ok { - // Both errors are single errors. - return &multiError{errors: []error{left, right}} - } - } - - // Either right or both, left and right, are multiErrors. Rely on usual - // expensive logic. - errors := [2]error{left, right} - return fromSlice(errors[0:]) -} diff --git a/vendor/go.uber.org/multierr/glide.lock b/vendor/go.uber.org/multierr/glide.lock deleted file mode 100644 index f9ea94c3..00000000 --- a/vendor/go.uber.org/multierr/glide.lock +++ /dev/null @@ -1,19 +0,0 @@ -hash: b53b5e9a84b9cb3cc4b2d0499e23da2feca1eec318ce9bb717ecf35bf24bf221 -updated: 2017-04-10T13:34:45.671678062-07:00 -imports: -- name: go.uber.org/atomic - version: 3b8db5e93c4c02efbc313e17b2e796b0914a01fb -testImports: -- name: github.com/davecgh/go-spew - version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib -- name: github.com/stretchr/testify - version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 - subpackages: - - assert - - require diff --git a/vendor/go.uber.org/multierr/glide.yaml b/vendor/go.uber.org/multierr/glide.yaml deleted file mode 100644 index 6ef084ec..00000000 --- a/vendor/go.uber.org/multierr/glide.yaml +++ /dev/null @@ -1,8 +0,0 @@ -package: go.uber.org/multierr -import: -- package: go.uber.org/atomic - version: ^1 -testImport: -- package: github.com/stretchr/testify - subpackages: - - assert diff --git a/vendor/go4.org/AUTHORS b/vendor/go4.org/AUTHORS deleted file mode 100644 index d1ad485f..00000000 --- a/vendor/go4.org/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -# This is the official list of go4 authors for copyright purposes. -# This is distinct from the CONTRIBUTORS file, which is the list of -# people who have contributed, even if they don't own the copyright on -# their work. - -Mathieu Lonjaret -Daniel Theophanes -Google diff --git a/vendor/go4.org/LICENSE b/vendor/go4.org/LICENSE deleted file mode 100644 index 8f71f43f..00000000 --- a/vendor/go4.org/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/go4.org/lock/.gitignore b/vendor/go4.org/lock/.gitignore deleted file mode 100644 index b25c15b8..00000000 --- a/vendor/go4.org/lock/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/vendor/go4.org/lock/lock.go b/vendor/go4.org/lock/lock.go deleted file mode 100644 index 3e253628..00000000 --- a/vendor/go4.org/lock/lock.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package lock is a file locking library. -package lock // import "go4.org/lock" - -import ( - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - "sync" -) - -// Lock locks the given file, creating the file if necessary. If the -// file already exists, it must have zero size or an error is returned. -// The lock is an exclusive lock (a write lock), but locked files -// should neither be read from nor written to. Such files should have -// zero size and only exist to co-ordinate ownership across processes. -// -// A nil Closer is returned if an error occurred. Otherwise, close that -// Closer to release the lock. -// -// On Linux, FreeBSD and OSX, a lock has the same semantics as fcntl(2)'s -// advisory locks. In particular, closing any other file descriptor for the -// same file will release the lock prematurely. -// -// Attempting to lock a file that is already locked by the current process -// has undefined behavior. -// -// On other operating systems, lock will fallback to using the presence and -// content of a file named name + '.lock' to implement locking behavior. -func Lock(name string) (io.Closer, error) { - abs, err := filepath.Abs(name) - if err != nil { - return nil, err - } - lockmu.Lock() - defer lockmu.Unlock() - if locked[abs] { - return nil, fmt.Errorf("file %q already locked", abs) - } - - c, err := lockFn(abs) - if err != nil { - return nil, fmt.Errorf("cannot acquire lock: %v", err) - } - locked[abs] = true - return c, nil -} - -var lockFn = lockPortable - -// lockPortable is a portable version not using fcntl. Doesn't handle crashes as gracefully, -// since it can leave stale lock files. -func lockPortable(name string) (io.Closer, error) { - fi, err := os.Stat(name) - if err == nil && fi.Size() > 0 { - st := portableLockStatus(name) - switch st { - case statusLocked: - return nil, fmt.Errorf("file %q already locked", name) - case statusStale: - os.Remove(name) - case statusInvalid: - return nil, fmt.Errorf("can't Lock file %q: has invalid contents", name) - } - } - f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_EXCL, 0666) - if err != nil { - return nil, fmt.Errorf("failed to create lock file %s %v", name, err) - } - if err := json.NewEncoder(f).Encode(&pidLockMeta{OwnerPID: os.Getpid()}); err != nil { - return nil, fmt.Errorf("cannot write owner pid: %v", err) - } - return &unlocker{ - f: f, - abs: name, - portable: true, - }, nil -} - -type lockStatus int - -const ( - statusInvalid lockStatus = iota - statusLocked - statusUnlocked - statusStale -) - -type pidLockMeta struct { - OwnerPID int -} - -func portableLockStatus(path string) lockStatus { - f, err := os.Open(path) - if err != nil { - return statusUnlocked - } - defer f.Close() - var meta pidLockMeta - if json.NewDecoder(f).Decode(&meta) != nil { - return statusInvalid - } - if meta.OwnerPID == 0 { - return statusInvalid - } - p, err := os.FindProcess(meta.OwnerPID) - if err != nil { - // e.g. on Windows - return statusStale - } - // On unix, os.FindProcess always is true, so we have to send - // it a signal to see if it's alive. - if signalZero != nil { - if p.Signal(signalZero) != nil { - return statusStale - } - } - return statusLocked -} - -var signalZero os.Signal // nil or set by lock_sigzero.go - -var ( - lockmu sync.Mutex - locked = map[string]bool{} // abs path -> true -) - -type unlocker struct { - portable bool - f *os.File - abs string - // once guards the close method call. - once sync.Once - // err holds the error returned by Close. - err error -} - -func (u *unlocker) Close() error { - u.once.Do(u.close) - return u.err -} - -func (u *unlocker) close() { - lockmu.Lock() - defer lockmu.Unlock() - delete(locked, u.abs) - - if u.portable { - // In the portable lock implementation, it's - // important to close before removing because - // Windows won't allow us to remove an open - // file. - if err := u.f.Close(); err != nil { - u.err = err - } - if err := os.Remove(u.abs); err != nil { - // Note that if both Close and Remove fail, - // we care more about the latter than the former - // so we'll return that error. - u.err = err - } - return - } - // In other implementatioons, it's nice for us to clean up. - // If we do do this, though, it needs to be before the - // u.f.Close below. - os.Remove(u.abs) - u.err = u.f.Close() -} diff --git a/vendor/go4.org/lock/lock_appengine.go b/vendor/go4.org/lock/lock_appengine.go deleted file mode 100644 index ab4cad6a..00000000 --- a/vendor/go4.org/lock/lock_appengine.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build appengine - -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package lock - -import ( - "errors" - "io" -) - -func init() { - lockFn = lockAppEngine -} - -func lockAppEngine(name string) (io.Closer, error) { - return nil, errors.New("Lock not available on App Engine") -} diff --git a/vendor/go4.org/lock/lock_plan9.go b/vendor/go4.org/lock/lock_plan9.go deleted file mode 100644 index d841c27d..00000000 --- a/vendor/go4.org/lock/lock_plan9.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package lock - -import ( - "fmt" - "io" - "os" -) - -func init() { - lockFn = lockPlan9 -} - -func lockPlan9(name string) (io.Closer, error) { - fi, err := os.Stat(name) - if err == nil && fi.Size() > 0 { - return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name) - } - - f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE, os.ModeExclusive|0644) - if err != nil { - return nil, fmt.Errorf("Lock Create of %s failed: %v", name, err) - } - - return &unlocker{f: f, abs: name}, nil -} diff --git a/vendor/go4.org/lock/lock_sigzero.go b/vendor/go4.org/lock/lock_sigzero.go deleted file mode 100644 index fd3ba2db..00000000 --- a/vendor/go4.org/lock/lock_sigzero.go +++ /dev/null @@ -1,26 +0,0 @@ -// +build !appengine -// +build linux darwin freebsd openbsd netbsd dragonfly - -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package lock - -import "syscall" - -func init() { - signalZero = syscall.Signal(0) -} diff --git a/vendor/go4.org/lock/lock_unix.go b/vendor/go4.org/lock/lock_unix.go deleted file mode 100644 index d26056b5..00000000 --- a/vendor/go4.org/lock/lock_unix.go +++ /dev/null @@ -1,58 +0,0 @@ -// +build linux darwin freebsd openbsd netbsd dragonfly solaris -// +build !appengine - -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package lock - -import ( - "fmt" - "io" - "os" - - "golang.org/x/sys/unix" -) - -func init() { - lockFn = lockFcntl -} - -func lockFcntl(name string) (io.Closer, error) { - fi, err := os.Stat(name) - if err == nil && fi.Size() > 0 { - return nil, fmt.Errorf("can't Lock file %q: has non-zero size", name) - } - - f, err := os.Create(name) - if err != nil { - return nil, fmt.Errorf("Lock Create of %s failed: %v", name, err) - } - - err = unix.FcntlFlock(f.Fd(), unix.F_SETLK, &unix.Flock_t{ - Type: unix.F_WRLCK, - Whence: int16(os.SEEK_SET), - Start: 0, - Len: 0, // 0 means to lock the entire file. - Pid: 0, // only used by F_GETLK - }) - - if err != nil { - f.Close() - return nil, fmt.Errorf("Lock FcntlFlock of %s failed: %v", name, err) - } - return &unlocker{f: f, abs: name}, nil -} diff --git a/vendor/go4.org/lock/lock_windows.go b/vendor/go4.org/lock/lock_windows.go deleted file mode 100644 index 42574879..00000000 --- a/vendor/go4.org/lock/lock_windows.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2013 The Go Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package lock - -import ( - "fmt" - "io" - "os" - "sync" - - "golang.org/x/sys/windows" -) - -func init() { - lockFn = lockWindows -} - -type winUnlocker struct { - h windows.Handle - abs string - // err holds the error returned by Close. - err error - // once guards the close method call. - once sync.Once -} - -func (u *winUnlocker) Close() error { - u.once.Do(u.close) - return u.err -} - -func (u *winUnlocker) close() { - lockmu.Lock() - defer lockmu.Unlock() - delete(locked, u.abs) - - u.err = windows.CloseHandle(u.h) -} - -func lockWindows(name string) (io.Closer, error) { - fi, err := os.Stat(name) - if err == nil && fi.Size() > 0 { - return nil, fmt.Errorf("can't lock file %q: %s", name, "has non-zero size") - } - - handle, err := winCreateEphemeral(name) - if err != nil { - return nil, fmt.Errorf("creation of lock %s failed: %v", name, err) - } - - return &winUnlocker{h: handle, abs: name}, nil -} - -func winCreateEphemeral(name string) (windows.Handle, error) { - const ( - FILE_ATTRIBUTE_TEMPORARY = 0x100 - FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 - ) - handle, err := windows.CreateFile(windows.StringToUTF16Ptr(name), 0, 0, nil, windows.OPEN_ALWAYS, FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, 0) - if err != nil { - return 0, err - } - return handle, nil -} diff --git a/vendor/golang.org/x/crypto/blake2s/blake2s_generic.go b/vendor/golang.org/x/crypto/blake2s/blake2s_generic.go deleted file mode 100644 index 24a1ff22..00000000 --- a/vendor/golang.org/x/crypto/blake2s/blake2s_generic.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package blake2s - -import ( - "math/bits" -) - -// the precomputed values for BLAKE2s -// there are 10 16-byte arrays - one for each round -// the entries are calculated from the sigma constants. -var precomputed = [10][16]byte{ - {0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15}, - {14, 4, 9, 13, 10, 8, 15, 6, 1, 0, 11, 5, 12, 2, 7, 3}, - {11, 12, 5, 15, 8, 0, 2, 13, 10, 3, 7, 9, 14, 6, 1, 4}, - {7, 3, 13, 11, 9, 1, 12, 14, 2, 5, 4, 15, 6, 10, 0, 8}, - {9, 5, 2, 10, 0, 7, 4, 15, 14, 11, 6, 3, 1, 12, 8, 13}, - {2, 6, 0, 8, 12, 10, 11, 3, 4, 7, 15, 1, 13, 5, 14, 9}, - {12, 1, 14, 4, 5, 15, 13, 10, 0, 6, 9, 8, 7, 3, 2, 11}, - {13, 7, 12, 3, 11, 14, 1, 9, 5, 15, 8, 2, 0, 4, 6, 10}, - {6, 14, 11, 0, 15, 9, 3, 8, 12, 13, 1, 10, 2, 7, 4, 5}, - {10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0}, -} - -func hashBlocksGeneric(h *[8]uint32, c *[2]uint32, flag uint32, blocks []byte) { - var m [16]uint32 - c0, c1 := c[0], c[1] - - for i := 0; i < len(blocks); { - c0 += BlockSize - if c0 < BlockSize { - c1++ - } - - v0, v1, v2, v3, v4, v5, v6, v7 := h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] - v8, v9, v10, v11, v12, v13, v14, v15 := iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7] - v12 ^= c0 - v13 ^= c1 - v14 ^= flag - - for j := range m { - m[j] = uint32(blocks[i]) | uint32(blocks[i+1])<<8 | uint32(blocks[i+2])<<16 | uint32(blocks[i+3])<<24 - i += 4 - } - - for k := range precomputed { - s := &(precomputed[k]) - - v0 += m[s[0]] - v0 += v4 - v12 ^= v0 - v12 = bits.RotateLeft32(v12, -16) - v8 += v12 - v4 ^= v8 - v4 = bits.RotateLeft32(v4, -12) - v1 += m[s[1]] - v1 += v5 - v13 ^= v1 - v13 = bits.RotateLeft32(v13, -16) - v9 += v13 - v5 ^= v9 - v5 = bits.RotateLeft32(v5, -12) - v2 += m[s[2]] - v2 += v6 - v14 ^= v2 - v14 = bits.RotateLeft32(v14, -16) - v10 += v14 - v6 ^= v10 - v6 = bits.RotateLeft32(v6, -12) - v3 += m[s[3]] - v3 += v7 - v15 ^= v3 - v15 = bits.RotateLeft32(v15, -16) - v11 += v15 - v7 ^= v11 - v7 = bits.RotateLeft32(v7, -12) - - v0 += m[s[4]] - v0 += v4 - v12 ^= v0 - v12 = bits.RotateLeft32(v12, -8) - v8 += v12 - v4 ^= v8 - v4 = bits.RotateLeft32(v4, -7) - v1 += m[s[5]] - v1 += v5 - v13 ^= v1 - v13 = bits.RotateLeft32(v13, -8) - v9 += v13 - v5 ^= v9 - v5 = bits.RotateLeft32(v5, -7) - v2 += m[s[6]] - v2 += v6 - v14 ^= v2 - v14 = bits.RotateLeft32(v14, -8) - v10 += v14 - v6 ^= v10 - v6 = bits.RotateLeft32(v6, -7) - v3 += m[s[7]] - v3 += v7 - v15 ^= v3 - v15 = bits.RotateLeft32(v15, -8) - v11 += v15 - v7 ^= v11 - v7 = bits.RotateLeft32(v7, -7) - - v0 += m[s[8]] - v0 += v5 - v15 ^= v0 - v15 = bits.RotateLeft32(v15, -16) - v10 += v15 - v5 ^= v10 - v5 = bits.RotateLeft32(v5, -12) - v1 += m[s[9]] - v1 += v6 - v12 ^= v1 - v12 = bits.RotateLeft32(v12, -16) - v11 += v12 - v6 ^= v11 - v6 = bits.RotateLeft32(v6, -12) - v2 += m[s[10]] - v2 += v7 - v13 ^= v2 - v13 = bits.RotateLeft32(v13, -16) - v8 += v13 - v7 ^= v8 - v7 = bits.RotateLeft32(v7, -12) - v3 += m[s[11]] - v3 += v4 - v14 ^= v3 - v14 = bits.RotateLeft32(v14, -16) - v9 += v14 - v4 ^= v9 - v4 = bits.RotateLeft32(v4, -12) - - v0 += m[s[12]] - v0 += v5 - v15 ^= v0 - v15 = bits.RotateLeft32(v15, -8) - v10 += v15 - v5 ^= v10 - v5 = bits.RotateLeft32(v5, -7) - v1 += m[s[13]] - v1 += v6 - v12 ^= v1 - v12 = bits.RotateLeft32(v12, -8) - v11 += v12 - v6 ^= v11 - v6 = bits.RotateLeft32(v6, -7) - v2 += m[s[14]] - v2 += v7 - v13 ^= v2 - v13 = bits.RotateLeft32(v13, -8) - v8 += v13 - v7 ^= v8 - v7 = bits.RotateLeft32(v7, -7) - v3 += m[s[15]] - v3 += v4 - v14 ^= v3 - v14 = bits.RotateLeft32(v14, -8) - v9 += v14 - v4 ^= v9 - v4 = bits.RotateLeft32(v4, -7) - } - - h[0] ^= v0 ^ v8 - h[1] ^= v1 ^ v9 - h[2] ^= v2 ^ v10 - h[3] ^= v3 ^ v11 - h[4] ^= v4 ^ v12 - h[5] ^= v5 ^ v13 - h[6] ^= v6 ^ v14 - h[7] ^= v7 ^ v15 - } - c[0], c[1] = c0, c1 -} diff --git a/vendor/golang.org/x/crypto/blowfish/cipher.go b/vendor/golang.org/x/crypto/blowfish/cipher.go deleted file mode 100644 index 213bf204..00000000 --- a/vendor/golang.org/x/crypto/blowfish/cipher.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package blowfish implements Bruce Schneier's Blowfish encryption algorithm. -// -// Blowfish is a legacy cipher and its short block size makes it vulnerable to -// birthday bound attacks (see https://sweet32.info). It should only be used -// where compatibility with legacy systems, not security, is the goal. -// -// Deprecated: any new system should use AES (from crypto/aes, if necessary in -// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from -// golang.org/x/crypto/chacha20poly1305). -package blowfish // import "golang.org/x/crypto/blowfish" - -// The code is a port of Bruce Schneier's C implementation. -// See https://www.schneier.com/blowfish.html. - -import "strconv" - -// The Blowfish block size in bytes. -const BlockSize = 8 - -// A Cipher is an instance of Blowfish encryption using a particular key. -type Cipher struct { - p [18]uint32 - s0, s1, s2, s3 [256]uint32 -} - -type KeySizeError int - -func (k KeySizeError) Error() string { - return "crypto/blowfish: invalid key size " + strconv.Itoa(int(k)) -} - -// NewCipher creates and returns a Cipher. -// The key argument should be the Blowfish key, from 1 to 56 bytes. -func NewCipher(key []byte) (*Cipher, error) { - var result Cipher - if k := len(key); k < 1 || k > 56 { - return nil, KeySizeError(k) - } - initCipher(&result) - ExpandKey(key, &result) - return &result, nil -} - -// NewSaltedCipher creates a returns a Cipher that folds a salt into its key -// schedule. For most purposes, NewCipher, instead of NewSaltedCipher, is -// sufficient and desirable. For bcrypt compatibility, the key can be over 56 -// bytes. -func NewSaltedCipher(key, salt []byte) (*Cipher, error) { - if len(salt) == 0 { - return NewCipher(key) - } - var result Cipher - if k := len(key); k < 1 { - return nil, KeySizeError(k) - } - initCipher(&result) - expandKeyWithSalt(key, salt, &result) - return &result, nil -} - -// BlockSize returns the Blowfish block size, 8 bytes. -// It is necessary to satisfy the Block interface in the -// package "crypto/cipher". -func (c *Cipher) BlockSize() int { return BlockSize } - -// Encrypt encrypts the 8-byte buffer src using the key k -// and stores the result in dst. -// Note that for amounts of data larger than a block, -// it is not safe to just call Encrypt on successive blocks; -// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go). -func (c *Cipher) Encrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - l, r = encryptBlock(l, r, c) - dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) - dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) -} - -// Decrypt decrypts the 8-byte buffer src using the key k -// and stores the result in dst. -func (c *Cipher) Decrypt(dst, src []byte) { - l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - l, r = decryptBlock(l, r, c) - dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l) - dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r) -} - -func initCipher(c *Cipher) { - copy(c.p[0:], p[0:]) - copy(c.s0[0:], s0[0:]) - copy(c.s1[0:], s1[0:]) - copy(c.s2[0:], s2[0:]) - copy(c.s3[0:], s3[0:]) -} diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s deleted file mode 100644 index 9dd5d7a9..00000000 --- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s +++ /dev/null @@ -1,2695 +0,0 @@ -// Copyright 2016 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. - -// This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare. - -// +build go1.7,amd64,!gccgo,!appengine - -#include "textflag.h" -// General register allocation -#define oup DI -#define inp SI -#define inl BX -#define adp CX // free to reuse, after we hash the additional data -#define keyp R8 // free to reuse, when we copy the key to stack -#define itr2 R9 // general iterator -#define itr1 CX // general iterator -#define acc0 R10 -#define acc1 R11 -#define acc2 R12 -#define t0 R13 -#define t1 R14 -#define t2 R15 -#define t3 R8 -// Register and stack allocation for the SSE code -#define rStore (0*16)(BP) -#define sStore (1*16)(BP) -#define state1Store (2*16)(BP) -#define state2Store (3*16)(BP) -#define tmpStore (4*16)(BP) -#define ctr0Store (5*16)(BP) -#define ctr1Store (6*16)(BP) -#define ctr2Store (7*16)(BP) -#define ctr3Store (8*16)(BP) -#define A0 X0 -#define A1 X1 -#define A2 X2 -#define B0 X3 -#define B1 X4 -#define B2 X5 -#define C0 X6 -#define C1 X7 -#define C2 X8 -#define D0 X9 -#define D1 X10 -#define D2 X11 -#define T0 X12 -#define T1 X13 -#define T2 X14 -#define T3 X15 -#define A3 T0 -#define B3 T1 -#define C3 T2 -#define D3 T3 -// Register and stack allocation for the AVX2 code -#define rsStoreAVX2 (0*32)(BP) -#define state1StoreAVX2 (1*32)(BP) -#define state2StoreAVX2 (2*32)(BP) -#define ctr0StoreAVX2 (3*32)(BP) -#define ctr1StoreAVX2 (4*32)(BP) -#define ctr2StoreAVX2 (5*32)(BP) -#define ctr3StoreAVX2 (6*32)(BP) -#define tmpStoreAVX2 (7*32)(BP) // 256 bytes on stack -#define AA0 Y0 -#define AA1 Y5 -#define AA2 Y6 -#define AA3 Y7 -#define BB0 Y14 -#define BB1 Y9 -#define BB2 Y10 -#define BB3 Y11 -#define CC0 Y12 -#define CC1 Y13 -#define CC2 Y8 -#define CC3 Y15 -#define DD0 Y4 -#define DD1 Y1 -#define DD2 Y2 -#define DD3 Y3 -#define TT0 DD3 -#define TT1 AA3 -#define TT2 BB3 -#define TT3 CC3 -// ChaCha20 constants -DATA ·chacha20Constants<>+0x00(SB)/4, $0x61707865 -DATA ·chacha20Constants<>+0x04(SB)/4, $0x3320646e -DATA ·chacha20Constants<>+0x08(SB)/4, $0x79622d32 -DATA ·chacha20Constants<>+0x0c(SB)/4, $0x6b206574 -DATA ·chacha20Constants<>+0x10(SB)/4, $0x61707865 -DATA ·chacha20Constants<>+0x14(SB)/4, $0x3320646e -DATA ·chacha20Constants<>+0x18(SB)/4, $0x79622d32 -DATA ·chacha20Constants<>+0x1c(SB)/4, $0x6b206574 -// <<< 16 with PSHUFB -DATA ·rol16<>+0x00(SB)/8, $0x0504070601000302 -DATA ·rol16<>+0x08(SB)/8, $0x0D0C0F0E09080B0A -DATA ·rol16<>+0x10(SB)/8, $0x0504070601000302 -DATA ·rol16<>+0x18(SB)/8, $0x0D0C0F0E09080B0A -// <<< 8 with PSHUFB -DATA ·rol8<>+0x00(SB)/8, $0x0605040702010003 -DATA ·rol8<>+0x08(SB)/8, $0x0E0D0C0F0A09080B -DATA ·rol8<>+0x10(SB)/8, $0x0605040702010003 -DATA ·rol8<>+0x18(SB)/8, $0x0E0D0C0F0A09080B - -DATA ·avx2InitMask<>+0x00(SB)/8, $0x0 -DATA ·avx2InitMask<>+0x08(SB)/8, $0x0 -DATA ·avx2InitMask<>+0x10(SB)/8, $0x1 -DATA ·avx2InitMask<>+0x18(SB)/8, $0x0 - -DATA ·avx2IncMask<>+0x00(SB)/8, $0x2 -DATA ·avx2IncMask<>+0x08(SB)/8, $0x0 -DATA ·avx2IncMask<>+0x10(SB)/8, $0x2 -DATA ·avx2IncMask<>+0x18(SB)/8, $0x0 -// Poly1305 key clamp -DATA ·polyClampMask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF -DATA ·polyClampMask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC -DATA ·polyClampMask<>+0x10(SB)/8, $0xFFFFFFFFFFFFFFFF -DATA ·polyClampMask<>+0x18(SB)/8, $0xFFFFFFFFFFFFFFFF - -DATA ·sseIncMask<>+0x00(SB)/8, $0x1 -DATA ·sseIncMask<>+0x08(SB)/8, $0x0 -// To load/store the last < 16 bytes in a buffer -DATA ·andMask<>+0x00(SB)/8, $0x00000000000000ff -DATA ·andMask<>+0x08(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x10(SB)/8, $0x000000000000ffff -DATA ·andMask<>+0x18(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x20(SB)/8, $0x0000000000ffffff -DATA ·andMask<>+0x28(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x30(SB)/8, $0x00000000ffffffff -DATA ·andMask<>+0x38(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x40(SB)/8, $0x000000ffffffffff -DATA ·andMask<>+0x48(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x50(SB)/8, $0x0000ffffffffffff -DATA ·andMask<>+0x58(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x60(SB)/8, $0x00ffffffffffffff -DATA ·andMask<>+0x68(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x70(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0x78(SB)/8, $0x0000000000000000 -DATA ·andMask<>+0x80(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0x88(SB)/8, $0x00000000000000ff -DATA ·andMask<>+0x90(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0x98(SB)/8, $0x000000000000ffff -DATA ·andMask<>+0xa0(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0xa8(SB)/8, $0x0000000000ffffff -DATA ·andMask<>+0xb0(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0xb8(SB)/8, $0x00000000ffffffff -DATA ·andMask<>+0xc0(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0xc8(SB)/8, $0x000000ffffffffff -DATA ·andMask<>+0xd0(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0xd8(SB)/8, $0x0000ffffffffffff -DATA ·andMask<>+0xe0(SB)/8, $0xffffffffffffffff -DATA ·andMask<>+0xe8(SB)/8, $0x00ffffffffffffff - -GLOBL ·chacha20Constants<>(SB), (NOPTR+RODATA), $32 -GLOBL ·rol16<>(SB), (NOPTR+RODATA), $32 -GLOBL ·rol8<>(SB), (NOPTR+RODATA), $32 -GLOBL ·sseIncMask<>(SB), (NOPTR+RODATA), $16 -GLOBL ·avx2IncMask<>(SB), (NOPTR+RODATA), $32 -GLOBL ·avx2InitMask<>(SB), (NOPTR+RODATA), $32 -GLOBL ·polyClampMask<>(SB), (NOPTR+RODATA), $32 -GLOBL ·andMask<>(SB), (NOPTR+RODATA), $240 -// No PALIGNR in Go ASM yet (but VPALIGNR is present). -#define shiftB0Left BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xdb; BYTE $0x04 // PALIGNR $4, X3, X3 -#define shiftB1Left BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xe4; BYTE $0x04 // PALIGNR $4, X4, X4 -#define shiftB2Left BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xed; BYTE $0x04 // PALIGNR $4, X5, X5 -#define shiftB3Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xed; BYTE $0x04 // PALIGNR $4, X13, X13 -#define shiftC0Left BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xf6; BYTE $0x08 // PALIGNR $8, X6, X6 -#define shiftC1Left BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xff; BYTE $0x08 // PALIGNR $8, X7, X7 -#define shiftC2Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xc0; BYTE $0x08 // PALIGNR $8, X8, X8 -#define shiftC3Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xf6; BYTE $0x08 // PALIGNR $8, X14, X14 -#define shiftD0Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xc9; BYTE $0x0c // PALIGNR $12, X9, X9 -#define shiftD1Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xd2; BYTE $0x0c // PALIGNR $12, X10, X10 -#define shiftD2Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xdb; BYTE $0x0c // PALIGNR $12, X11, X11 -#define shiftD3Left BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xff; BYTE $0x0c // PALIGNR $12, X15, X15 -#define shiftB0Right BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xdb; BYTE $0x0c // PALIGNR $12, X3, X3 -#define shiftB1Right BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xe4; BYTE $0x0c // PALIGNR $12, X4, X4 -#define shiftB2Right BYTE $0x66; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xed; BYTE $0x0c // PALIGNR $12, X5, X5 -#define shiftB3Right BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xed; BYTE $0x0c // PALIGNR $12, X13, X13 -#define shiftC0Right shiftC0Left -#define shiftC1Right shiftC1Left -#define shiftC2Right shiftC2Left -#define shiftC3Right shiftC3Left -#define shiftD0Right BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xc9; BYTE $0x04 // PALIGNR $4, X9, X9 -#define shiftD1Right BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xd2; BYTE $0x04 // PALIGNR $4, X10, X10 -#define shiftD2Right BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xdb; BYTE $0x04 // PALIGNR $4, X11, X11 -#define shiftD3Right BYTE $0x66; BYTE $0x45; BYTE $0x0f; BYTE $0x3a; BYTE $0x0f; BYTE $0xff; BYTE $0x04 // PALIGNR $4, X15, X15 -// Some macros -#define chachaQR(A, B, C, D, T) \ - PADDD B, A; PXOR A, D; PSHUFB ·rol16<>(SB), D \ - PADDD D, C; PXOR C, B; MOVO B, T; PSLLL $12, T; PSRLL $20, B; PXOR T, B \ - PADDD B, A; PXOR A, D; PSHUFB ·rol8<>(SB), D \ - PADDD D, C; PXOR C, B; MOVO B, T; PSLLL $7, T; PSRLL $25, B; PXOR T, B - -#define chachaQR_AVX2(A, B, C, D, T) \ - VPADDD B, A, A; VPXOR A, D, D; VPSHUFB ·rol16<>(SB), D, D \ - VPADDD D, C, C; VPXOR C, B, B; VPSLLD $12, B, T; VPSRLD $20, B, B; VPXOR T, B, B \ - VPADDD B, A, A; VPXOR A, D, D; VPSHUFB ·rol8<>(SB), D, D \ - VPADDD D, C, C; VPXOR C, B, B; VPSLLD $7, B, T; VPSRLD $25, B, B; VPXOR T, B, B - -#define polyAdd(S) ADDQ S, acc0; ADCQ 8+S, acc1; ADCQ $1, acc2 -#define polyMulStage1 MOVQ (0*8)(BP), AX; MOVQ AX, t2; MULQ acc0; MOVQ AX, t0; MOVQ DX, t1; MOVQ (0*8)(BP), AX; MULQ acc1; IMULQ acc2, t2; ADDQ AX, t1; ADCQ DX, t2 -#define polyMulStage2 MOVQ (1*8)(BP), AX; MOVQ AX, t3; MULQ acc0; ADDQ AX, t1; ADCQ $0, DX; MOVQ DX, acc0; MOVQ (1*8)(BP), AX; MULQ acc1; ADDQ AX, t2; ADCQ $0, DX -#define polyMulStage3 IMULQ acc2, t3; ADDQ acc0, t2; ADCQ DX, t3 -#define polyMulReduceStage MOVQ t0, acc0; MOVQ t1, acc1; MOVQ t2, acc2; ANDQ $3, acc2; MOVQ t2, t0; ANDQ $-4, t0; MOVQ t3, t1; SHRQ $2, t3, t2; SHRQ $2, t3; ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $0, acc2; ADDQ t2, acc0; ADCQ t3, acc1; ADCQ $0, acc2 - -#define polyMulStage1_AVX2 MOVQ (0*8)(BP), DX; MOVQ DX, t2; MULXQ acc0, t0, t1; IMULQ acc2, t2; MULXQ acc1, AX, DX; ADDQ AX, t1; ADCQ DX, t2 -#define polyMulStage2_AVX2 MOVQ (1*8)(BP), DX; MULXQ acc0, acc0, AX; ADDQ acc0, t1; MULXQ acc1, acc1, t3; ADCQ acc1, t2; ADCQ $0, t3 -#define polyMulStage3_AVX2 IMULQ acc2, DX; ADDQ AX, t2; ADCQ DX, t3 - -#define polyMul polyMulStage1; polyMulStage2; polyMulStage3; polyMulReduceStage -#define polyMulAVX2 polyMulStage1_AVX2; polyMulStage2_AVX2; polyMulStage3_AVX2; polyMulReduceStage -// ---------------------------------------------------------------------------- -TEXT polyHashADInternal<>(SB), NOSPLIT, $0 - // adp points to beginning of additional data - // itr2 holds ad length - XORQ acc0, acc0 - XORQ acc1, acc1 - XORQ acc2, acc2 - CMPQ itr2, $13 - JNE hashADLoop - -openFastTLSAD: - // Special treatment for the TLS case of 13 bytes - MOVQ (adp), acc0 - MOVQ 5(adp), acc1 - SHRQ $24, acc1 - MOVQ $1, acc2 - polyMul - RET - -hashADLoop: - // Hash in 16 byte chunks - CMPQ itr2, $16 - JB hashADTail - polyAdd(0(adp)) - LEAQ (1*16)(adp), adp - SUBQ $16, itr2 - polyMul - JMP hashADLoop - -hashADTail: - CMPQ itr2, $0 - JE hashADDone - - // Hash last < 16 byte tail - XORQ t0, t0 - XORQ t1, t1 - XORQ t2, t2 - ADDQ itr2, adp - -hashADTailLoop: - SHLQ $8, t0, t1 - SHLQ $8, t0 - MOVB -1(adp), t2 - XORQ t2, t0 - DECQ adp - DECQ itr2 - JNE hashADTailLoop - -hashADTailFinish: - ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $1, acc2 - polyMul - - // Finished AD -hashADDone: - RET - -// ---------------------------------------------------------------------------- -// func chacha20Poly1305Open(dst, key, src, ad []byte) bool -TEXT ·chacha20Poly1305Open(SB), 0, $288-97 - // For aligned stack access - MOVQ SP, BP - ADDQ $32, BP - ANDQ $-32, BP - MOVQ dst+0(FP), oup - MOVQ key+24(FP), keyp - MOVQ src+48(FP), inp - MOVQ src_len+56(FP), inl - MOVQ ad+72(FP), adp - - // Check for AVX2 support - CMPB ·useAVX2(SB), $1 - JE chacha20Poly1305Open_AVX2 - - // Special optimization, for very short buffers - CMPQ inl, $128 - JBE openSSE128 // About 16% faster - - // For long buffers, prepare the poly key first - MOVOU ·chacha20Constants<>(SB), A0 - MOVOU (1*16)(keyp), B0 - MOVOU (2*16)(keyp), C0 - MOVOU (3*16)(keyp), D0 - MOVO D0, T1 - - // Store state on stack for future use - MOVO B0, state1Store - MOVO C0, state2Store - MOVO D0, ctr3Store - MOVQ $10, itr2 - -openSSEPreparePolyKey: - chachaQR(A0, B0, C0, D0, T0) - shiftB0Left; shiftC0Left; shiftD0Left - chachaQR(A0, B0, C0, D0, T0) - shiftB0Right; shiftC0Right; shiftD0Right - DECQ itr2 - JNE openSSEPreparePolyKey - - // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded - PADDL ·chacha20Constants<>(SB), A0; PADDL state1Store, B0 - - // Clamp and store the key - PAND ·polyClampMask<>(SB), A0 - MOVO A0, rStore; MOVO B0, sStore - - // Hash AAD - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - -openSSEMainLoop: - CMPQ inl, $256 - JB openSSEMainLoopDone - - // Load state, increment counter blocks - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0 - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO A2, A3; MOVO B2, B3; MOVO C2, C3; MOVO D2, D3; PADDL ·sseIncMask<>(SB), D3 - - // Store counters - MOVO D0, ctr0Store; MOVO D1, ctr1Store; MOVO D2, ctr2Store; MOVO D3, ctr3Store - - // There are 10 ChaCha20 iterations of 2QR each, so for 6 iterations we hash 2 blocks, and for the remaining 4 only 1 block - for a total of 16 - MOVQ $4, itr1 - MOVQ inp, itr2 - -openSSEInternalLoop: - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - polyAdd(0(itr2)) - shiftB0Left; shiftB1Left; shiftB2Left; shiftB3Left - shiftC0Left; shiftC1Left; shiftC2Left; shiftC3Left - shiftD0Left; shiftD1Left; shiftD2Left; shiftD3Left - polyMulStage1 - polyMulStage2 - LEAQ (2*8)(itr2), itr2 - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - polyMulStage3 - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - polyMulReduceStage - shiftB0Right; shiftB1Right; shiftB2Right; shiftB3Right - shiftC0Right; shiftC1Right; shiftC2Right; shiftC3Right - shiftD0Right; shiftD1Right; shiftD2Right; shiftD3Right - DECQ itr1 - JGE openSSEInternalLoop - - polyAdd(0(itr2)) - polyMul - LEAQ (2*8)(itr2), itr2 - - CMPQ itr1, $-6 - JG openSSEInternalLoop - - // Add in the state - PADDD ·chacha20Constants<>(SB), A0; PADDD ·chacha20Constants<>(SB), A1; PADDD ·chacha20Constants<>(SB), A2; PADDD ·chacha20Constants<>(SB), A3 - PADDD state1Store, B0; PADDD state1Store, B1; PADDD state1Store, B2; PADDD state1Store, B3 - PADDD state2Store, C0; PADDD state2Store, C1; PADDD state2Store, C2; PADDD state2Store, C3 - PADDD ctr0Store, D0; PADDD ctr1Store, D1; PADDD ctr2Store, D2; PADDD ctr3Store, D3 - - // Load - xor - store - MOVO D3, tmpStore - MOVOU (0*16)(inp), D3; PXOR D3, A0; MOVOU A0, (0*16)(oup) - MOVOU (1*16)(inp), D3; PXOR D3, B0; MOVOU B0, (1*16)(oup) - MOVOU (2*16)(inp), D3; PXOR D3, C0; MOVOU C0, (2*16)(oup) - MOVOU (3*16)(inp), D3; PXOR D3, D0; MOVOU D0, (3*16)(oup) - MOVOU (4*16)(inp), D0; PXOR D0, A1; MOVOU A1, (4*16)(oup) - MOVOU (5*16)(inp), D0; PXOR D0, B1; MOVOU B1, (5*16)(oup) - MOVOU (6*16)(inp), D0; PXOR D0, C1; MOVOU C1, (6*16)(oup) - MOVOU (7*16)(inp), D0; PXOR D0, D1; MOVOU D1, (7*16)(oup) - MOVOU (8*16)(inp), D0; PXOR D0, A2; MOVOU A2, (8*16)(oup) - MOVOU (9*16)(inp), D0; PXOR D0, B2; MOVOU B2, (9*16)(oup) - MOVOU (10*16)(inp), D0; PXOR D0, C2; MOVOU C2, (10*16)(oup) - MOVOU (11*16)(inp), D0; PXOR D0, D2; MOVOU D2, (11*16)(oup) - MOVOU (12*16)(inp), D0; PXOR D0, A3; MOVOU A3, (12*16)(oup) - MOVOU (13*16)(inp), D0; PXOR D0, B3; MOVOU B3, (13*16)(oup) - MOVOU (14*16)(inp), D0; PXOR D0, C3; MOVOU C3, (14*16)(oup) - MOVOU (15*16)(inp), D0; PXOR tmpStore, D0; MOVOU D0, (15*16)(oup) - LEAQ 256(inp), inp - LEAQ 256(oup), oup - SUBQ $256, inl - JMP openSSEMainLoop - -openSSEMainLoopDone: - // Handle the various tail sizes efficiently - TESTQ inl, inl - JE openSSEFinalize - CMPQ inl, $64 - JBE openSSETail64 - CMPQ inl, $128 - JBE openSSETail128 - CMPQ inl, $192 - JBE openSSETail192 - JMP openSSETail256 - -openSSEFinalize: - // Hash in the PT, AAD lengths - ADDQ ad_len+80(FP), acc0; ADCQ src_len+56(FP), acc1; ADCQ $1, acc2 - polyMul - - // Final reduce - MOVQ acc0, t0 - MOVQ acc1, t1 - MOVQ acc2, t2 - SUBQ $-5, acc0 - SBBQ $-1, acc1 - SBBQ $3, acc2 - CMOVQCS t0, acc0 - CMOVQCS t1, acc1 - CMOVQCS t2, acc2 - - // Add in the "s" part of the key - ADDQ 0+sStore, acc0 - ADCQ 8+sStore, acc1 - - // Finally, constant time compare to the tag at the end of the message - XORQ AX, AX - MOVQ $1, DX - XORQ (0*8)(inp), acc0 - XORQ (1*8)(inp), acc1 - ORQ acc1, acc0 - CMOVQEQ DX, AX - - // Return true iff tags are equal - MOVB AX, ret+96(FP) - RET - -// ---------------------------------------------------------------------------- -// Special optimization for buffers smaller than 129 bytes -openSSE128: - // For up to 128 bytes of ciphertext and 64 bytes for the poly key, we require to process three blocks - MOVOU ·chacha20Constants<>(SB), A0; MOVOU (1*16)(keyp), B0; MOVOU (2*16)(keyp), C0; MOVOU (3*16)(keyp), D0 - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO B0, T1; MOVO C0, T2; MOVO D1, T3 - MOVQ $10, itr2 - -openSSE128InnerCipherLoop: - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Left; shiftB1Left; shiftB2Left - shiftC0Left; shiftC1Left; shiftC2Left - shiftD0Left; shiftD1Left; shiftD2Left - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Right; shiftB1Right; shiftB2Right - shiftC0Right; shiftC1Right; shiftC2Right - shiftD0Right; shiftD1Right; shiftD2Right - DECQ itr2 - JNE openSSE128InnerCipherLoop - - // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1; PADDL ·chacha20Constants<>(SB), A2 - PADDL T1, B0; PADDL T1, B1; PADDL T1, B2 - PADDL T2, C1; PADDL T2, C2 - PADDL T3, D1; PADDL ·sseIncMask<>(SB), T3; PADDL T3, D2 - - // Clamp and store the key - PAND ·polyClampMask<>(SB), A0 - MOVOU A0, rStore; MOVOU B0, sStore - - // Hash - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - -openSSE128Open: - CMPQ inl, $16 - JB openSSETail16 - SUBQ $16, inl - - // Load for hashing - polyAdd(0(inp)) - - // Load for decryption - MOVOU (inp), T0; PXOR T0, A1; MOVOU A1, (oup) - LEAQ (1*16)(inp), inp - LEAQ (1*16)(oup), oup - polyMul - - // Shift the stream "left" - MOVO B1, A1 - MOVO C1, B1 - MOVO D1, C1 - MOVO A2, D1 - MOVO B2, A2 - MOVO C2, B2 - MOVO D2, C2 - JMP openSSE128Open - -openSSETail16: - TESTQ inl, inl - JE openSSEFinalize - - // We can safely load the CT from the end, because it is padded with the MAC - MOVQ inl, itr2 - SHLQ $4, itr2 - LEAQ ·andMask<>(SB), t0 - MOVOU (inp), T0 - ADDQ inl, inp - PAND -16(t0)(itr2*1), T0 - MOVO T0, 0+tmpStore - MOVQ T0, t0 - MOVQ 8+tmpStore, t1 - PXOR A1, T0 - - // We can only store one byte at a time, since plaintext can be shorter than 16 bytes -openSSETail16Store: - MOVQ T0, t3 - MOVB t3, (oup) - PSRLDQ $1, T0 - INCQ oup - DECQ inl - JNE openSSETail16Store - ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $1, acc2 - polyMul - JMP openSSEFinalize - -// ---------------------------------------------------------------------------- -// Special optimization for the last 64 bytes of ciphertext -openSSETail64: - // Need to decrypt up to 64 bytes - prepare single block - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0; MOVO D0, ctr0Store - XORQ itr2, itr2 - MOVQ inl, itr1 - CMPQ itr1, $16 - JB openSSETail64LoopB - -openSSETail64LoopA: - // Perform ChaCha rounds, while hashing the remaining input - polyAdd(0(inp)(itr2*1)) - polyMul - SUBQ $16, itr1 - -openSSETail64LoopB: - ADDQ $16, itr2 - chachaQR(A0, B0, C0, D0, T0) - shiftB0Left; shiftC0Left; shiftD0Left - chachaQR(A0, B0, C0, D0, T0) - shiftB0Right; shiftC0Right; shiftD0Right - - CMPQ itr1, $16 - JAE openSSETail64LoopA - - CMPQ itr2, $160 - JNE openSSETail64LoopB - - PADDL ·chacha20Constants<>(SB), A0; PADDL state1Store, B0; PADDL state2Store, C0; PADDL ctr0Store, D0 - -openSSETail64DecLoop: - CMPQ inl, $16 - JB openSSETail64DecLoopDone - SUBQ $16, inl - MOVOU (inp), T0 - PXOR T0, A0 - MOVOU A0, (oup) - LEAQ 16(inp), inp - LEAQ 16(oup), oup - MOVO B0, A0 - MOVO C0, B0 - MOVO D0, C0 - JMP openSSETail64DecLoop - -openSSETail64DecLoopDone: - MOVO A0, A1 - JMP openSSETail16 - -// ---------------------------------------------------------------------------- -// Special optimization for the last 128 bytes of ciphertext -openSSETail128: - // Need to decrypt up to 128 bytes - prepare two blocks - MOVO ·chacha20Constants<>(SB), A1; MOVO state1Store, B1; MOVO state2Store, C1; MOVO ctr3Store, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr0Store - MOVO A1, A0; MOVO B1, B0; MOVO C1, C0; MOVO D1, D0; PADDL ·sseIncMask<>(SB), D0; MOVO D0, ctr1Store - XORQ itr2, itr2 - MOVQ inl, itr1 - ANDQ $-16, itr1 - -openSSETail128LoopA: - // Perform ChaCha rounds, while hashing the remaining input - polyAdd(0(inp)(itr2*1)) - polyMul - -openSSETail128LoopB: - ADDQ $16, itr2 - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0) - shiftB0Left; shiftC0Left; shiftD0Left - shiftB1Left; shiftC1Left; shiftD1Left - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0) - shiftB0Right; shiftC0Right; shiftD0Right - shiftB1Right; shiftC1Right; shiftD1Right - - CMPQ itr2, itr1 - JB openSSETail128LoopA - - CMPQ itr2, $160 - JNE openSSETail128LoopB - - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1 - PADDL state1Store, B0; PADDL state1Store, B1 - PADDL state2Store, C0; PADDL state2Store, C1 - PADDL ctr1Store, D0; PADDL ctr0Store, D1 - - MOVOU (0*16)(inp), T0; MOVOU (1*16)(inp), T1; MOVOU (2*16)(inp), T2; MOVOU (3*16)(inp), T3 - PXOR T0, A1; PXOR T1, B1; PXOR T2, C1; PXOR T3, D1 - MOVOU A1, (0*16)(oup); MOVOU B1, (1*16)(oup); MOVOU C1, (2*16)(oup); MOVOU D1, (3*16)(oup) - - SUBQ $64, inl - LEAQ 64(inp), inp - LEAQ 64(oup), oup - JMP openSSETail64DecLoop - -// ---------------------------------------------------------------------------- -// Special optimization for the last 192 bytes of ciphertext -openSSETail192: - // Need to decrypt up to 192 bytes - prepare three blocks - MOVO ·chacha20Constants<>(SB), A2; MOVO state1Store, B2; MOVO state2Store, C2; MOVO ctr3Store, D2; PADDL ·sseIncMask<>(SB), D2; MOVO D2, ctr0Store - MOVO A2, A1; MOVO B2, B1; MOVO C2, C1; MOVO D2, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr1Store - MOVO A1, A0; MOVO B1, B0; MOVO C1, C0; MOVO D1, D0; PADDL ·sseIncMask<>(SB), D0; MOVO D0, ctr2Store - - MOVQ inl, itr1 - MOVQ $160, itr2 - CMPQ itr1, $160 - CMOVQGT itr2, itr1 - ANDQ $-16, itr1 - XORQ itr2, itr2 - -openSSLTail192LoopA: - // Perform ChaCha rounds, while hashing the remaining input - polyAdd(0(inp)(itr2*1)) - polyMul - -openSSLTail192LoopB: - ADDQ $16, itr2 - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Left; shiftC0Left; shiftD0Left - shiftB1Left; shiftC1Left; shiftD1Left - shiftB2Left; shiftC2Left; shiftD2Left - - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Right; shiftC0Right; shiftD0Right - shiftB1Right; shiftC1Right; shiftD1Right - shiftB2Right; shiftC2Right; shiftD2Right - - CMPQ itr2, itr1 - JB openSSLTail192LoopA - - CMPQ itr2, $160 - JNE openSSLTail192LoopB - - CMPQ inl, $176 - JB openSSLTail192Store - - polyAdd(160(inp)) - polyMul - - CMPQ inl, $192 - JB openSSLTail192Store - - polyAdd(176(inp)) - polyMul - -openSSLTail192Store: - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1; PADDL ·chacha20Constants<>(SB), A2 - PADDL state1Store, B0; PADDL state1Store, B1; PADDL state1Store, B2 - PADDL state2Store, C0; PADDL state2Store, C1; PADDL state2Store, C2 - PADDL ctr2Store, D0; PADDL ctr1Store, D1; PADDL ctr0Store, D2 - - MOVOU (0*16)(inp), T0; MOVOU (1*16)(inp), T1; MOVOU (2*16)(inp), T2; MOVOU (3*16)(inp), T3 - PXOR T0, A2; PXOR T1, B2; PXOR T2, C2; PXOR T3, D2 - MOVOU A2, (0*16)(oup); MOVOU B2, (1*16)(oup); MOVOU C2, (2*16)(oup); MOVOU D2, (3*16)(oup) - - MOVOU (4*16)(inp), T0; MOVOU (5*16)(inp), T1; MOVOU (6*16)(inp), T2; MOVOU (7*16)(inp), T3 - PXOR T0, A1; PXOR T1, B1; PXOR T2, C1; PXOR T3, D1 - MOVOU A1, (4*16)(oup); MOVOU B1, (5*16)(oup); MOVOU C1, (6*16)(oup); MOVOU D1, (7*16)(oup) - - SUBQ $128, inl - LEAQ 128(inp), inp - LEAQ 128(oup), oup - JMP openSSETail64DecLoop - -// ---------------------------------------------------------------------------- -// Special optimization for the last 256 bytes of ciphertext -openSSETail256: - // Need to decrypt up to 256 bytes - prepare four blocks - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0 - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO A2, A3; MOVO B2, B3; MOVO C2, C3; MOVO D2, D3; PADDL ·sseIncMask<>(SB), D3 - - // Store counters - MOVO D0, ctr0Store; MOVO D1, ctr1Store; MOVO D2, ctr2Store; MOVO D3, ctr3Store - XORQ itr2, itr2 - -openSSETail256Loop: - // This loop inteleaves 8 ChaCha quarter rounds with 1 poly multiplication - polyAdd(0(inp)(itr2*1)) - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - shiftB0Left; shiftB1Left; shiftB2Left; shiftB3Left - shiftC0Left; shiftC1Left; shiftC2Left; shiftC3Left - shiftD0Left; shiftD1Left; shiftD2Left; shiftD3Left - polyMulStage1 - polyMulStage2 - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - polyMulStage3 - polyMulReduceStage - shiftB0Right; shiftB1Right; shiftB2Right; shiftB3Right - shiftC0Right; shiftC1Right; shiftC2Right; shiftC3Right - shiftD0Right; shiftD1Right; shiftD2Right; shiftD3Right - ADDQ $2*8, itr2 - CMPQ itr2, $160 - JB openSSETail256Loop - MOVQ inl, itr1 - ANDQ $-16, itr1 - -openSSETail256HashLoop: - polyAdd(0(inp)(itr2*1)) - polyMul - ADDQ $2*8, itr2 - CMPQ itr2, itr1 - JB openSSETail256HashLoop - - // Add in the state - PADDD ·chacha20Constants<>(SB), A0; PADDD ·chacha20Constants<>(SB), A1; PADDD ·chacha20Constants<>(SB), A2; PADDD ·chacha20Constants<>(SB), A3 - PADDD state1Store, B0; PADDD state1Store, B1; PADDD state1Store, B2; PADDD state1Store, B3 - PADDD state2Store, C0; PADDD state2Store, C1; PADDD state2Store, C2; PADDD state2Store, C3 - PADDD ctr0Store, D0; PADDD ctr1Store, D1; PADDD ctr2Store, D2; PADDD ctr3Store, D3 - MOVO D3, tmpStore - - // Load - xor - store - MOVOU (0*16)(inp), D3; PXOR D3, A0 - MOVOU (1*16)(inp), D3; PXOR D3, B0 - MOVOU (2*16)(inp), D3; PXOR D3, C0 - MOVOU (3*16)(inp), D3; PXOR D3, D0 - MOVOU A0, (0*16)(oup) - MOVOU B0, (1*16)(oup) - MOVOU C0, (2*16)(oup) - MOVOU D0, (3*16)(oup) - MOVOU (4*16)(inp), A0; MOVOU (5*16)(inp), B0; MOVOU (6*16)(inp), C0; MOVOU (7*16)(inp), D0 - PXOR A0, A1; PXOR B0, B1; PXOR C0, C1; PXOR D0, D1 - MOVOU A1, (4*16)(oup); MOVOU B1, (5*16)(oup); MOVOU C1, (6*16)(oup); MOVOU D1, (7*16)(oup) - MOVOU (8*16)(inp), A0; MOVOU (9*16)(inp), B0; MOVOU (10*16)(inp), C0; MOVOU (11*16)(inp), D0 - PXOR A0, A2; PXOR B0, B2; PXOR C0, C2; PXOR D0, D2 - MOVOU A2, (8*16)(oup); MOVOU B2, (9*16)(oup); MOVOU C2, (10*16)(oup); MOVOU D2, (11*16)(oup) - LEAQ 192(inp), inp - LEAQ 192(oup), oup - SUBQ $192, inl - MOVO A3, A0 - MOVO B3, B0 - MOVO C3, C0 - MOVO tmpStore, D0 - - JMP openSSETail64DecLoop - -// ---------------------------------------------------------------------------- -// ------------------------- AVX2 Code ---------------------------------------- -chacha20Poly1305Open_AVX2: - VZEROUPPER - VMOVDQU ·chacha20Constants<>(SB), AA0 - BYTE $0xc4; BYTE $0x42; BYTE $0x7d; BYTE $0x5a; BYTE $0x70; BYTE $0x10 // broadcasti128 16(r8), ymm14 - BYTE $0xc4; BYTE $0x42; BYTE $0x7d; BYTE $0x5a; BYTE $0x60; BYTE $0x20 // broadcasti128 32(r8), ymm12 - BYTE $0xc4; BYTE $0xc2; BYTE $0x7d; BYTE $0x5a; BYTE $0x60; BYTE $0x30 // broadcasti128 48(r8), ymm4 - VPADDD ·avx2InitMask<>(SB), DD0, DD0 - - // Special optimization, for very short buffers - CMPQ inl, $192 - JBE openAVX2192 - CMPQ inl, $320 - JBE openAVX2320 - - // For the general key prepare the key first - as a byproduct we have 64 bytes of cipher stream - VMOVDQA BB0, state1StoreAVX2 - VMOVDQA CC0, state2StoreAVX2 - VMOVDQA DD0, ctr3StoreAVX2 - MOVQ $10, itr2 - -openAVX2PreparePolyKey: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $12, DD0, DD0, DD0 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $4, DD0, DD0, DD0 - DECQ itr2 - JNE openAVX2PreparePolyKey - - VPADDD ·chacha20Constants<>(SB), AA0, AA0 - VPADDD state1StoreAVX2, BB0, BB0 - VPADDD state2StoreAVX2, CC0, CC0 - VPADDD ctr3StoreAVX2, DD0, DD0 - - VPERM2I128 $0x02, AA0, BB0, TT0 - - // Clamp and store poly key - VPAND ·polyClampMask<>(SB), TT0, TT0 - VMOVDQA TT0, rsStoreAVX2 - - // Stream for the first 64 bytes - VPERM2I128 $0x13, AA0, BB0, AA0 - VPERM2I128 $0x13, CC0, DD0, BB0 - - // Hash AD + first 64 bytes - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - XORQ itr1, itr1 - -openAVX2InitialHash64: - polyAdd(0(inp)(itr1*1)) - polyMulAVX2 - ADDQ $16, itr1 - CMPQ itr1, $64 - JNE openAVX2InitialHash64 - - // Decrypt the first 64 bytes - VPXOR (0*32)(inp), AA0, AA0 - VPXOR (1*32)(inp), BB0, BB0 - VMOVDQU AA0, (0*32)(oup) - VMOVDQU BB0, (1*32)(oup) - LEAQ (2*32)(inp), inp - LEAQ (2*32)(oup), oup - SUBQ $64, inl - -openAVX2MainLoop: - CMPQ inl, $512 - JB openAVX2MainLoopDone - - // Load state, increment counter blocks, store the incremented counters - VMOVDQU ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3 - VMOVDQA ctr3StoreAVX2, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2; VPADDD ·avx2IncMask<>(SB), DD2, DD3 - VMOVDQA DD0, ctr0StoreAVX2; VMOVDQA DD1, ctr1StoreAVX2; VMOVDQA DD2, ctr2StoreAVX2; VMOVDQA DD3, ctr3StoreAVX2 - XORQ itr1, itr1 - -openAVX2InternalLoop: - // Lets just say this spaghetti loop interleaves 2 quarter rounds with 3 poly multiplications - // Effectively per 512 bytes of stream we hash 480 bytes of ciphertext - polyAdd(0*8(inp)(itr1*1)) - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - polyMulStage1_AVX2 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - polyMulStage2_AVX2 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyMulStage3_AVX2 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulReduceStage - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - polyAdd(2*8(inp)(itr1*1)) - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - polyMulStage1_AVX2 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulStage2_AVX2 - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $4, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2; VPALIGNR $12, DD3, DD3, DD3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - polyMulStage3_AVX2 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - polyMulReduceStage - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyAdd(4*8(inp)(itr1*1)) - LEAQ (6*8)(itr1), itr1 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulStage1_AVX2 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - polyMulStage2_AVX2 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - polyMulStage3_AVX2 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulReduceStage - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $12, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2; VPALIGNR $4, DD3, DD3, DD3 - CMPQ itr1, $480 - JNE openAVX2InternalLoop - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2; VPADDD ·chacha20Constants<>(SB), AA3, AA3 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2; VPADDD state1StoreAVX2, BB3, BB3 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2; VPADDD state2StoreAVX2, CC3, CC3 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2; VPADDD ctr3StoreAVX2, DD3, DD3 - VMOVDQA CC3, tmpStoreAVX2 - - // We only hashed 480 of the 512 bytes available - hash the remaining 32 here - polyAdd(480(inp)) - polyMulAVX2 - VPERM2I128 $0x02, AA0, BB0, CC3; VPERM2I128 $0x13, AA0, BB0, BB0; VPERM2I128 $0x02, CC0, DD0, AA0; VPERM2I128 $0x13, CC0, DD0, CC0 - VPXOR (0*32)(inp), CC3, CC3; VPXOR (1*32)(inp), AA0, AA0; VPXOR (2*32)(inp), BB0, BB0; VPXOR (3*32)(inp), CC0, CC0 - VMOVDQU CC3, (0*32)(oup); VMOVDQU AA0, (1*32)(oup); VMOVDQU BB0, (2*32)(oup); VMOVDQU CC0, (3*32)(oup) - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - VPXOR (4*32)(inp), AA0, AA0; VPXOR (5*32)(inp), BB0, BB0; VPXOR (6*32)(inp), CC0, CC0; VPXOR (7*32)(inp), DD0, DD0 - VMOVDQU AA0, (4*32)(oup); VMOVDQU BB0, (5*32)(oup); VMOVDQU CC0, (6*32)(oup); VMOVDQU DD0, (7*32)(oup) - - // and here - polyAdd(496(inp)) - polyMulAVX2 - VPERM2I128 $0x02, AA2, BB2, AA0; VPERM2I128 $0x02, CC2, DD2, BB0; VPERM2I128 $0x13, AA2, BB2, CC0; VPERM2I128 $0x13, CC2, DD2, DD0 - VPXOR (8*32)(inp), AA0, AA0; VPXOR (9*32)(inp), BB0, BB0; VPXOR (10*32)(inp), CC0, CC0; VPXOR (11*32)(inp), DD0, DD0 - VMOVDQU AA0, (8*32)(oup); VMOVDQU BB0, (9*32)(oup); VMOVDQU CC0, (10*32)(oup); VMOVDQU DD0, (11*32)(oup) - VPERM2I128 $0x02, AA3, BB3, AA0; VPERM2I128 $0x02, tmpStoreAVX2, DD3, BB0; VPERM2I128 $0x13, AA3, BB3, CC0; VPERM2I128 $0x13, tmpStoreAVX2, DD3, DD0 - VPXOR (12*32)(inp), AA0, AA0; VPXOR (13*32)(inp), BB0, BB0; VPXOR (14*32)(inp), CC0, CC0; VPXOR (15*32)(inp), DD0, DD0 - VMOVDQU AA0, (12*32)(oup); VMOVDQU BB0, (13*32)(oup); VMOVDQU CC0, (14*32)(oup); VMOVDQU DD0, (15*32)(oup) - LEAQ (32*16)(inp), inp - LEAQ (32*16)(oup), oup - SUBQ $(32*16), inl - JMP openAVX2MainLoop - -openAVX2MainLoopDone: - // Handle the various tail sizes efficiently - TESTQ inl, inl - JE openSSEFinalize - CMPQ inl, $128 - JBE openAVX2Tail128 - CMPQ inl, $256 - JBE openAVX2Tail256 - CMPQ inl, $384 - JBE openAVX2Tail384 - JMP openAVX2Tail512 - -// ---------------------------------------------------------------------------- -// Special optimization for buffers smaller than 193 bytes -openAVX2192: - // For up to 192 bytes of ciphertext and 64 bytes for the poly key, we process four blocks - VMOVDQA AA0, AA1 - VMOVDQA BB0, BB1 - VMOVDQA CC0, CC1 - VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA AA0, AA2 - VMOVDQA BB0, BB2 - VMOVDQA CC0, CC2 - VMOVDQA DD0, DD2 - VMOVDQA DD1, TT3 - MOVQ $10, itr2 - -openAVX2192InnerCipherLoop: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1 - DECQ itr2 - JNE openAVX2192InnerCipherLoop - VPADDD AA2, AA0, AA0; VPADDD AA2, AA1, AA1 - VPADDD BB2, BB0, BB0; VPADDD BB2, BB1, BB1 - VPADDD CC2, CC0, CC0; VPADDD CC2, CC1, CC1 - VPADDD DD2, DD0, DD0; VPADDD TT3, DD1, DD1 - VPERM2I128 $0x02, AA0, BB0, TT0 - - // Clamp and store poly key - VPAND ·polyClampMask<>(SB), TT0, TT0 - VMOVDQA TT0, rsStoreAVX2 - - // Stream for up to 192 bytes - VPERM2I128 $0x13, AA0, BB0, AA0 - VPERM2I128 $0x13, CC0, DD0, BB0 - VPERM2I128 $0x02, AA1, BB1, CC0 - VPERM2I128 $0x02, CC1, DD1, DD0 - VPERM2I128 $0x13, AA1, BB1, AA1 - VPERM2I128 $0x13, CC1, DD1, BB1 - -openAVX2ShortOpen: - // Hash - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - -openAVX2ShortOpenLoop: - CMPQ inl, $32 - JB openAVX2ShortTail32 - SUBQ $32, inl - - // Load for hashing - polyAdd(0*8(inp)) - polyMulAVX2 - polyAdd(2*8(inp)) - polyMulAVX2 - - // Load for decryption - VPXOR (inp), AA0, AA0 - VMOVDQU AA0, (oup) - LEAQ (1*32)(inp), inp - LEAQ (1*32)(oup), oup - - // Shift stream left - VMOVDQA BB0, AA0 - VMOVDQA CC0, BB0 - VMOVDQA DD0, CC0 - VMOVDQA AA1, DD0 - VMOVDQA BB1, AA1 - VMOVDQA CC1, BB1 - VMOVDQA DD1, CC1 - VMOVDQA AA2, DD1 - VMOVDQA BB2, AA2 - JMP openAVX2ShortOpenLoop - -openAVX2ShortTail32: - CMPQ inl, $16 - VMOVDQA A0, A1 - JB openAVX2ShortDone - - SUBQ $16, inl - - // Load for hashing - polyAdd(0*8(inp)) - polyMulAVX2 - - // Load for decryption - VPXOR (inp), A0, T0 - VMOVDQU T0, (oup) - LEAQ (1*16)(inp), inp - LEAQ (1*16)(oup), oup - VPERM2I128 $0x11, AA0, AA0, AA0 - VMOVDQA A0, A1 - -openAVX2ShortDone: - VZEROUPPER - JMP openSSETail16 - -// ---------------------------------------------------------------------------- -// Special optimization for buffers smaller than 321 bytes -openAVX2320: - // For up to 320 bytes of ciphertext and 64 bytes for the poly key, we process six blocks - VMOVDQA AA0, AA1; VMOVDQA BB0, BB1; VMOVDQA CC0, CC1; VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA AA0, AA2; VMOVDQA BB0, BB2; VMOVDQA CC0, CC2; VPADDD ·avx2IncMask<>(SB), DD1, DD2 - VMOVDQA BB0, TT1; VMOVDQA CC0, TT2; VMOVDQA DD0, TT3 - MOVQ $10, itr2 - -openAVX2320InnerCipherLoop: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2 - DECQ itr2 - JNE openAVX2320InnerCipherLoop - - VMOVDQA ·chacha20Constants<>(SB), TT0 - VPADDD TT0, AA0, AA0; VPADDD TT0, AA1, AA1; VPADDD TT0, AA2, AA2 - VPADDD TT1, BB0, BB0; VPADDD TT1, BB1, BB1; VPADDD TT1, BB2, BB2 - VPADDD TT2, CC0, CC0; VPADDD TT2, CC1, CC1; VPADDD TT2, CC2, CC2 - VMOVDQA ·avx2IncMask<>(SB), TT0 - VPADDD TT3, DD0, DD0; VPADDD TT0, TT3, TT3 - VPADDD TT3, DD1, DD1; VPADDD TT0, TT3, TT3 - VPADDD TT3, DD2, DD2 - - // Clamp and store poly key - VPERM2I128 $0x02, AA0, BB0, TT0 - VPAND ·polyClampMask<>(SB), TT0, TT0 - VMOVDQA TT0, rsStoreAVX2 - - // Stream for up to 320 bytes - VPERM2I128 $0x13, AA0, BB0, AA0 - VPERM2I128 $0x13, CC0, DD0, BB0 - VPERM2I128 $0x02, AA1, BB1, CC0 - VPERM2I128 $0x02, CC1, DD1, DD0 - VPERM2I128 $0x13, AA1, BB1, AA1 - VPERM2I128 $0x13, CC1, DD1, BB1 - VPERM2I128 $0x02, AA2, BB2, CC1 - VPERM2I128 $0x02, CC2, DD2, DD1 - VPERM2I128 $0x13, AA2, BB2, AA2 - VPERM2I128 $0x13, CC2, DD2, BB2 - JMP openAVX2ShortOpen - -// ---------------------------------------------------------------------------- -// Special optimization for the last 128 bytes of ciphertext -openAVX2Tail128: - // Need to decrypt up to 128 bytes - prepare two blocks - VMOVDQA ·chacha20Constants<>(SB), AA1 - VMOVDQA state1StoreAVX2, BB1 - VMOVDQA state2StoreAVX2, CC1 - VMOVDQA ctr3StoreAVX2, DD1 - VPADDD ·avx2IncMask<>(SB), DD1, DD1 - VMOVDQA DD1, DD0 - - XORQ itr2, itr2 - MOVQ inl, itr1 - ANDQ $-16, itr1 - TESTQ itr1, itr1 - JE openAVX2Tail128LoopB - -openAVX2Tail128LoopA: - // Perform ChaCha rounds, while hashing the remaining input - polyAdd(0(inp)(itr2*1)) - polyMulAVX2 - -openAVX2Tail128LoopB: - ADDQ $16, itr2 - chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $4, BB1, BB1, BB1 - VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $12, DD1, DD1, DD1 - chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $12, BB1, BB1, BB1 - VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $4, DD1, DD1, DD1 - CMPQ itr2, itr1 - JB openAVX2Tail128LoopA - CMPQ itr2, $160 - JNE openAVX2Tail128LoopB - - VPADDD ·chacha20Constants<>(SB), AA1, AA1 - VPADDD state1StoreAVX2, BB1, BB1 - VPADDD state2StoreAVX2, CC1, CC1 - VPADDD DD0, DD1, DD1 - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - -openAVX2TailLoop: - CMPQ inl, $32 - JB openAVX2Tail - SUBQ $32, inl - - // Load for decryption - VPXOR (inp), AA0, AA0 - VMOVDQU AA0, (oup) - LEAQ (1*32)(inp), inp - LEAQ (1*32)(oup), oup - VMOVDQA BB0, AA0 - VMOVDQA CC0, BB0 - VMOVDQA DD0, CC0 - JMP openAVX2TailLoop - -openAVX2Tail: - CMPQ inl, $16 - VMOVDQA A0, A1 - JB openAVX2TailDone - SUBQ $16, inl - - // Load for decryption - VPXOR (inp), A0, T0 - VMOVDQU T0, (oup) - LEAQ (1*16)(inp), inp - LEAQ (1*16)(oup), oup - VPERM2I128 $0x11, AA0, AA0, AA0 - VMOVDQA A0, A1 - -openAVX2TailDone: - VZEROUPPER - JMP openSSETail16 - -// ---------------------------------------------------------------------------- -// Special optimization for the last 256 bytes of ciphertext -openAVX2Tail256: - // Need to decrypt up to 256 bytes - prepare four blocks - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA DD0, TT1 - VMOVDQA DD1, TT2 - - // Compute the number of iterations that will hash data - MOVQ inl, tmpStoreAVX2 - MOVQ inl, itr1 - SUBQ $128, itr1 - SHRQ $4, itr1 - MOVQ $10, itr2 - CMPQ itr1, $10 - CMOVQGT itr2, itr1 - MOVQ inp, inl - XORQ itr2, itr2 - -openAVX2Tail256LoopA: - polyAdd(0(inl)) - polyMulAVX2 - LEAQ 16(inl), inl - - // Perform ChaCha rounds, while hashing the remaining input -openAVX2Tail256LoopB: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1 - INCQ itr2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1 - CMPQ itr2, itr1 - JB openAVX2Tail256LoopA - - CMPQ itr2, $10 - JNE openAVX2Tail256LoopB - - MOVQ inl, itr2 - SUBQ inp, inl - MOVQ inl, itr1 - MOVQ tmpStoreAVX2, inl - - // Hash the remainder of data (if any) -openAVX2Tail256Hash: - ADDQ $16, itr1 - CMPQ itr1, inl - JGT openAVX2Tail256HashEnd - polyAdd (0(itr2)) - polyMulAVX2 - LEAQ 16(itr2), itr2 - JMP openAVX2Tail256Hash - -// Store 128 bytes safely, then go to store loop -openAVX2Tail256HashEnd: - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1 - VPADDD TT1, DD0, DD0; VPADDD TT2, DD1, DD1 - VPERM2I128 $0x02, AA0, BB0, AA2; VPERM2I128 $0x02, CC0, DD0, BB2; VPERM2I128 $0x13, AA0, BB0, CC2; VPERM2I128 $0x13, CC0, DD0, DD2 - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - - VPXOR (0*32)(inp), AA2, AA2; VPXOR (1*32)(inp), BB2, BB2; VPXOR (2*32)(inp), CC2, CC2; VPXOR (3*32)(inp), DD2, DD2 - VMOVDQU AA2, (0*32)(oup); VMOVDQU BB2, (1*32)(oup); VMOVDQU CC2, (2*32)(oup); VMOVDQU DD2, (3*32)(oup) - LEAQ (4*32)(inp), inp - LEAQ (4*32)(oup), oup - SUBQ $4*32, inl - - JMP openAVX2TailLoop - -// ---------------------------------------------------------------------------- -// Special optimization for the last 384 bytes of ciphertext -openAVX2Tail384: - // Need to decrypt up to 384 bytes - prepare six blocks - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VPADDD ·avx2IncMask<>(SB), DD1, DD2 - VMOVDQA DD0, ctr0StoreAVX2 - VMOVDQA DD1, ctr1StoreAVX2 - VMOVDQA DD2, ctr2StoreAVX2 - - // Compute the number of iterations that will hash two blocks of data - MOVQ inl, tmpStoreAVX2 - MOVQ inl, itr1 - SUBQ $256, itr1 - SHRQ $4, itr1 - ADDQ $6, itr1 - MOVQ $10, itr2 - CMPQ itr1, $10 - CMOVQGT itr2, itr1 - MOVQ inp, inl - XORQ itr2, itr2 - - // Perform ChaCha rounds, while hashing the remaining input -openAVX2Tail384LoopB: - polyAdd(0(inl)) - polyMulAVX2 - LEAQ 16(inl), inl - -openAVX2Tail384LoopA: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2 - polyAdd(0(inl)) - polyMulAVX2 - LEAQ 16(inl), inl - INCQ itr2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2 - - CMPQ itr2, itr1 - JB openAVX2Tail384LoopB - - CMPQ itr2, $10 - JNE openAVX2Tail384LoopA - - MOVQ inl, itr2 - SUBQ inp, inl - MOVQ inl, itr1 - MOVQ tmpStoreAVX2, inl - -openAVX2Tail384Hash: - ADDQ $16, itr1 - CMPQ itr1, inl - JGT openAVX2Tail384HashEnd - polyAdd(0(itr2)) - polyMulAVX2 - LEAQ 16(itr2), itr2 - JMP openAVX2Tail384Hash - -// Store 256 bytes safely, then go to store loop -openAVX2Tail384HashEnd: - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2 - VPERM2I128 $0x02, AA0, BB0, TT0; VPERM2I128 $0x02, CC0, DD0, TT1; VPERM2I128 $0x13, AA0, BB0, TT2; VPERM2I128 $0x13, CC0, DD0, TT3 - VPXOR (0*32)(inp), TT0, TT0; VPXOR (1*32)(inp), TT1, TT1; VPXOR (2*32)(inp), TT2, TT2; VPXOR (3*32)(inp), TT3, TT3 - VMOVDQU TT0, (0*32)(oup); VMOVDQU TT1, (1*32)(oup); VMOVDQU TT2, (2*32)(oup); VMOVDQU TT3, (3*32)(oup) - VPERM2I128 $0x02, AA1, BB1, TT0; VPERM2I128 $0x02, CC1, DD1, TT1; VPERM2I128 $0x13, AA1, BB1, TT2; VPERM2I128 $0x13, CC1, DD1, TT3 - VPXOR (4*32)(inp), TT0, TT0; VPXOR (5*32)(inp), TT1, TT1; VPXOR (6*32)(inp), TT2, TT2; VPXOR (7*32)(inp), TT3, TT3 - VMOVDQU TT0, (4*32)(oup); VMOVDQU TT1, (5*32)(oup); VMOVDQU TT2, (6*32)(oup); VMOVDQU TT3, (7*32)(oup) - VPERM2I128 $0x02, AA2, BB2, AA0; VPERM2I128 $0x02, CC2, DD2, BB0; VPERM2I128 $0x13, AA2, BB2, CC0; VPERM2I128 $0x13, CC2, DD2, DD0 - LEAQ (8*32)(inp), inp - LEAQ (8*32)(oup), oup - SUBQ $8*32, inl - JMP openAVX2TailLoop - -// ---------------------------------------------------------------------------- -// Special optimization for the last 512 bytes of ciphertext -openAVX2Tail512: - VMOVDQU ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3 - VMOVDQA ctr3StoreAVX2, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2; VPADDD ·avx2IncMask<>(SB), DD2, DD3 - VMOVDQA DD0, ctr0StoreAVX2; VMOVDQA DD1, ctr1StoreAVX2; VMOVDQA DD2, ctr2StoreAVX2; VMOVDQA DD3, ctr3StoreAVX2 - XORQ itr1, itr1 - MOVQ inp, itr2 - -openAVX2Tail512LoopB: - polyAdd(0(itr2)) - polyMulAVX2 - LEAQ (2*8)(itr2), itr2 - -openAVX2Tail512LoopA: - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyAdd(0*8(itr2)) - polyMulAVX2 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $4, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2; VPALIGNR $12, DD3, DD3, DD3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyAdd(2*8(itr2)) - polyMulAVX2 - LEAQ (4*8)(itr2), itr2 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $12, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2; VPALIGNR $4, DD3, DD3, DD3 - INCQ itr1 - CMPQ itr1, $4 - JLT openAVX2Tail512LoopB - - CMPQ itr1, $10 - JNE openAVX2Tail512LoopA - - MOVQ inl, itr1 - SUBQ $384, itr1 - ANDQ $-16, itr1 - -openAVX2Tail512HashLoop: - TESTQ itr1, itr1 - JE openAVX2Tail512HashEnd - polyAdd(0(itr2)) - polyMulAVX2 - LEAQ 16(itr2), itr2 - SUBQ $16, itr1 - JMP openAVX2Tail512HashLoop - -openAVX2Tail512HashEnd: - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2; VPADDD ·chacha20Constants<>(SB), AA3, AA3 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2; VPADDD state1StoreAVX2, BB3, BB3 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2; VPADDD state2StoreAVX2, CC3, CC3 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2; VPADDD ctr3StoreAVX2, DD3, DD3 - VMOVDQA CC3, tmpStoreAVX2 - VPERM2I128 $0x02, AA0, BB0, CC3; VPERM2I128 $0x13, AA0, BB0, BB0; VPERM2I128 $0x02, CC0, DD0, AA0; VPERM2I128 $0x13, CC0, DD0, CC0 - VPXOR (0*32)(inp), CC3, CC3; VPXOR (1*32)(inp), AA0, AA0; VPXOR (2*32)(inp), BB0, BB0; VPXOR (3*32)(inp), CC0, CC0 - VMOVDQU CC3, (0*32)(oup); VMOVDQU AA0, (1*32)(oup); VMOVDQU BB0, (2*32)(oup); VMOVDQU CC0, (3*32)(oup) - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - VPXOR (4*32)(inp), AA0, AA0; VPXOR (5*32)(inp), BB0, BB0; VPXOR (6*32)(inp), CC0, CC0; VPXOR (7*32)(inp), DD0, DD0 - VMOVDQU AA0, (4*32)(oup); VMOVDQU BB0, (5*32)(oup); VMOVDQU CC0, (6*32)(oup); VMOVDQU DD0, (7*32)(oup) - VPERM2I128 $0x02, AA2, BB2, AA0; VPERM2I128 $0x02, CC2, DD2, BB0; VPERM2I128 $0x13, AA2, BB2, CC0; VPERM2I128 $0x13, CC2, DD2, DD0 - VPXOR (8*32)(inp), AA0, AA0; VPXOR (9*32)(inp), BB0, BB0; VPXOR (10*32)(inp), CC0, CC0; VPXOR (11*32)(inp), DD0, DD0 - VMOVDQU AA0, (8*32)(oup); VMOVDQU BB0, (9*32)(oup); VMOVDQU CC0, (10*32)(oup); VMOVDQU DD0, (11*32)(oup) - VPERM2I128 $0x02, AA3, BB3, AA0; VPERM2I128 $0x02, tmpStoreAVX2, DD3, BB0; VPERM2I128 $0x13, AA3, BB3, CC0; VPERM2I128 $0x13, tmpStoreAVX2, DD3, DD0 - - LEAQ (12*32)(inp), inp - LEAQ (12*32)(oup), oup - SUBQ $12*32, inl - - JMP openAVX2TailLoop - -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// func chacha20Poly1305Seal(dst, key, src, ad []byte) -TEXT ·chacha20Poly1305Seal(SB), 0, $288-96 - // For aligned stack access - MOVQ SP, BP - ADDQ $32, BP - ANDQ $-32, BP - MOVQ dst+0(FP), oup - MOVQ key+24(FP), keyp - MOVQ src+48(FP), inp - MOVQ src_len+56(FP), inl - MOVQ ad+72(FP), adp - - CMPB ·useAVX2(SB), $1 - JE chacha20Poly1305Seal_AVX2 - - // Special optimization, for very short buffers - CMPQ inl, $128 - JBE sealSSE128 // About 15% faster - - // In the seal case - prepare the poly key + 3 blocks of stream in the first iteration - MOVOU ·chacha20Constants<>(SB), A0 - MOVOU (1*16)(keyp), B0 - MOVOU (2*16)(keyp), C0 - MOVOU (3*16)(keyp), D0 - - // Store state on stack for future use - MOVO B0, state1Store - MOVO C0, state2Store - - // Load state, increment counter blocks - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO A2, A3; MOVO B2, B3; MOVO C2, C3; MOVO D2, D3; PADDL ·sseIncMask<>(SB), D3 - - // Store counters - MOVO D0, ctr0Store; MOVO D1, ctr1Store; MOVO D2, ctr2Store; MOVO D3, ctr3Store - MOVQ $10, itr2 - -sealSSEIntroLoop: - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - shiftB0Left; shiftB1Left; shiftB2Left; shiftB3Left - shiftC0Left; shiftC1Left; shiftC2Left; shiftC3Left - shiftD0Left; shiftD1Left; shiftD2Left; shiftD3Left - - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - shiftB0Right; shiftB1Right; shiftB2Right; shiftB3Right - shiftC0Right; shiftC1Right; shiftC2Right; shiftC3Right - shiftD0Right; shiftD1Right; shiftD2Right; shiftD3Right - DECQ itr2 - JNE sealSSEIntroLoop - - // Add in the state - PADDD ·chacha20Constants<>(SB), A0; PADDD ·chacha20Constants<>(SB), A1; PADDD ·chacha20Constants<>(SB), A2; PADDD ·chacha20Constants<>(SB), A3 - PADDD state1Store, B0; PADDD state1Store, B1; PADDD state1Store, B2; PADDD state1Store, B3 - PADDD state2Store, C1; PADDD state2Store, C2; PADDD state2Store, C3 - PADDD ctr1Store, D1; PADDD ctr2Store, D2; PADDD ctr3Store, D3 - - // Clamp and store the key - PAND ·polyClampMask<>(SB), A0 - MOVO A0, rStore - MOVO B0, sStore - - // Hash AAD - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - - MOVOU (0*16)(inp), A0; MOVOU (1*16)(inp), B0; MOVOU (2*16)(inp), C0; MOVOU (3*16)(inp), D0 - PXOR A0, A1; PXOR B0, B1; PXOR C0, C1; PXOR D0, D1 - MOVOU A1, (0*16)(oup); MOVOU B1, (1*16)(oup); MOVOU C1, (2*16)(oup); MOVOU D1, (3*16)(oup) - MOVOU (4*16)(inp), A0; MOVOU (5*16)(inp), B0; MOVOU (6*16)(inp), C0; MOVOU (7*16)(inp), D0 - PXOR A0, A2; PXOR B0, B2; PXOR C0, C2; PXOR D0, D2 - MOVOU A2, (4*16)(oup); MOVOU B2, (5*16)(oup); MOVOU C2, (6*16)(oup); MOVOU D2, (7*16)(oup) - - MOVQ $128, itr1 - SUBQ $128, inl - LEAQ 128(inp), inp - - MOVO A3, A1; MOVO B3, B1; MOVO C3, C1; MOVO D3, D1 - - CMPQ inl, $64 - JBE sealSSE128SealHash - - MOVOU (0*16)(inp), A0; MOVOU (1*16)(inp), B0; MOVOU (2*16)(inp), C0; MOVOU (3*16)(inp), D0 - PXOR A0, A3; PXOR B0, B3; PXOR C0, C3; PXOR D0, D3 - MOVOU A3, (8*16)(oup); MOVOU B3, (9*16)(oup); MOVOU C3, (10*16)(oup); MOVOU D3, (11*16)(oup) - - ADDQ $64, itr1 - SUBQ $64, inl - LEAQ 64(inp), inp - - MOVQ $2, itr1 - MOVQ $8, itr2 - - CMPQ inl, $64 - JBE sealSSETail64 - CMPQ inl, $128 - JBE sealSSETail128 - CMPQ inl, $192 - JBE sealSSETail192 - -sealSSEMainLoop: - // Load state, increment counter blocks - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0 - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO A2, A3; MOVO B2, B3; MOVO C2, C3; MOVO D2, D3; PADDL ·sseIncMask<>(SB), D3 - - // Store counters - MOVO D0, ctr0Store; MOVO D1, ctr1Store; MOVO D2, ctr2Store; MOVO D3, ctr3Store - -sealSSEInnerLoop: - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - polyAdd(0(oup)) - shiftB0Left; shiftB1Left; shiftB2Left; shiftB3Left - shiftC0Left; shiftC1Left; shiftC2Left; shiftC3Left - shiftD0Left; shiftD1Left; shiftD2Left; shiftD3Left - polyMulStage1 - polyMulStage2 - LEAQ (2*8)(oup), oup - MOVO C3, tmpStore - chachaQR(A0, B0, C0, D0, C3); chachaQR(A1, B1, C1, D1, C3); chachaQR(A2, B2, C2, D2, C3) - MOVO tmpStore, C3 - MOVO C1, tmpStore - polyMulStage3 - chachaQR(A3, B3, C3, D3, C1) - MOVO tmpStore, C1 - polyMulReduceStage - shiftB0Right; shiftB1Right; shiftB2Right; shiftB3Right - shiftC0Right; shiftC1Right; shiftC2Right; shiftC3Right - shiftD0Right; shiftD1Right; shiftD2Right; shiftD3Right - DECQ itr2 - JGE sealSSEInnerLoop - polyAdd(0(oup)) - polyMul - LEAQ (2*8)(oup), oup - DECQ itr1 - JG sealSSEInnerLoop - - // Add in the state - PADDD ·chacha20Constants<>(SB), A0; PADDD ·chacha20Constants<>(SB), A1; PADDD ·chacha20Constants<>(SB), A2; PADDD ·chacha20Constants<>(SB), A3 - PADDD state1Store, B0; PADDD state1Store, B1; PADDD state1Store, B2; PADDD state1Store, B3 - PADDD state2Store, C0; PADDD state2Store, C1; PADDD state2Store, C2; PADDD state2Store, C3 - PADDD ctr0Store, D0; PADDD ctr1Store, D1; PADDD ctr2Store, D2; PADDD ctr3Store, D3 - MOVO D3, tmpStore - - // Load - xor - store - MOVOU (0*16)(inp), D3; PXOR D3, A0 - MOVOU (1*16)(inp), D3; PXOR D3, B0 - MOVOU (2*16)(inp), D3; PXOR D3, C0 - MOVOU (3*16)(inp), D3; PXOR D3, D0 - MOVOU A0, (0*16)(oup) - MOVOU B0, (1*16)(oup) - MOVOU C0, (2*16)(oup) - MOVOU D0, (3*16)(oup) - MOVO tmpStore, D3 - - MOVOU (4*16)(inp), A0; MOVOU (5*16)(inp), B0; MOVOU (6*16)(inp), C0; MOVOU (7*16)(inp), D0 - PXOR A0, A1; PXOR B0, B1; PXOR C0, C1; PXOR D0, D1 - MOVOU A1, (4*16)(oup); MOVOU B1, (5*16)(oup); MOVOU C1, (6*16)(oup); MOVOU D1, (7*16)(oup) - MOVOU (8*16)(inp), A0; MOVOU (9*16)(inp), B0; MOVOU (10*16)(inp), C0; MOVOU (11*16)(inp), D0 - PXOR A0, A2; PXOR B0, B2; PXOR C0, C2; PXOR D0, D2 - MOVOU A2, (8*16)(oup); MOVOU B2, (9*16)(oup); MOVOU C2, (10*16)(oup); MOVOU D2, (11*16)(oup) - ADDQ $192, inp - MOVQ $192, itr1 - SUBQ $192, inl - MOVO A3, A1 - MOVO B3, B1 - MOVO C3, C1 - MOVO D3, D1 - CMPQ inl, $64 - JBE sealSSE128SealHash - MOVOU (0*16)(inp), A0; MOVOU (1*16)(inp), B0; MOVOU (2*16)(inp), C0; MOVOU (3*16)(inp), D0 - PXOR A0, A3; PXOR B0, B3; PXOR C0, C3; PXOR D0, D3 - MOVOU A3, (12*16)(oup); MOVOU B3, (13*16)(oup); MOVOU C3, (14*16)(oup); MOVOU D3, (15*16)(oup) - LEAQ 64(inp), inp - SUBQ $64, inl - MOVQ $6, itr1 - MOVQ $4, itr2 - CMPQ inl, $192 - JG sealSSEMainLoop - - MOVQ inl, itr1 - TESTQ inl, inl - JE sealSSE128SealHash - MOVQ $6, itr1 - CMPQ inl, $64 - JBE sealSSETail64 - CMPQ inl, $128 - JBE sealSSETail128 - JMP sealSSETail192 - -// ---------------------------------------------------------------------------- -// Special optimization for the last 64 bytes of plaintext -sealSSETail64: - // Need to encrypt up to 64 bytes - prepare single block, hash 192 or 256 bytes - MOVO ·chacha20Constants<>(SB), A1 - MOVO state1Store, B1 - MOVO state2Store, C1 - MOVO ctr3Store, D1 - PADDL ·sseIncMask<>(SB), D1 - MOVO D1, ctr0Store - -sealSSETail64LoopA: - // Perform ChaCha rounds, while hashing the previously encrypted ciphertext - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealSSETail64LoopB: - chachaQR(A1, B1, C1, D1, T1) - shiftB1Left; shiftC1Left; shiftD1Left - chachaQR(A1, B1, C1, D1, T1) - shiftB1Right; shiftC1Right; shiftD1Right - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - - DECQ itr1 - JG sealSSETail64LoopA - - DECQ itr2 - JGE sealSSETail64LoopB - PADDL ·chacha20Constants<>(SB), A1 - PADDL state1Store, B1 - PADDL state2Store, C1 - PADDL ctr0Store, D1 - - JMP sealSSE128Seal - -// ---------------------------------------------------------------------------- -// Special optimization for the last 128 bytes of plaintext -sealSSETail128: - // Need to encrypt up to 128 bytes - prepare two blocks, hash 192 or 256 bytes - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0; MOVO D0, ctr0Store - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr1Store - -sealSSETail128LoopA: - // Perform ChaCha rounds, while hashing the previously encrypted ciphertext - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealSSETail128LoopB: - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0) - shiftB0Left; shiftC0Left; shiftD0Left - shiftB1Left; shiftC1Left; shiftD1Left - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0) - shiftB0Right; shiftC0Right; shiftD0Right - shiftB1Right; shiftC1Right; shiftD1Right - - DECQ itr1 - JG sealSSETail128LoopA - - DECQ itr2 - JGE sealSSETail128LoopB - - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1 - PADDL state1Store, B0; PADDL state1Store, B1 - PADDL state2Store, C0; PADDL state2Store, C1 - PADDL ctr0Store, D0; PADDL ctr1Store, D1 - - MOVOU (0*16)(inp), T0; MOVOU (1*16)(inp), T1; MOVOU (2*16)(inp), T2; MOVOU (3*16)(inp), T3 - PXOR T0, A0; PXOR T1, B0; PXOR T2, C0; PXOR T3, D0 - MOVOU A0, (0*16)(oup); MOVOU B0, (1*16)(oup); MOVOU C0, (2*16)(oup); MOVOU D0, (3*16)(oup) - - MOVQ $64, itr1 - LEAQ 64(inp), inp - SUBQ $64, inl - - JMP sealSSE128SealHash - -// ---------------------------------------------------------------------------- -// Special optimization for the last 192 bytes of plaintext -sealSSETail192: - // Need to encrypt up to 192 bytes - prepare three blocks, hash 192 or 256 bytes - MOVO ·chacha20Constants<>(SB), A0; MOVO state1Store, B0; MOVO state2Store, C0; MOVO ctr3Store, D0; PADDL ·sseIncMask<>(SB), D0; MOVO D0, ctr0Store - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr1Store - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2; MOVO D2, ctr2Store - -sealSSETail192LoopA: - // Perform ChaCha rounds, while hashing the previously encrypted ciphertext - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealSSETail192LoopB: - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Left; shiftC0Left; shiftD0Left - shiftB1Left; shiftC1Left; shiftD1Left - shiftB2Left; shiftC2Left; shiftD2Left - - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Right; shiftC0Right; shiftD0Right - shiftB1Right; shiftC1Right; shiftD1Right - shiftB2Right; shiftC2Right; shiftD2Right - - DECQ itr1 - JG sealSSETail192LoopA - - DECQ itr2 - JGE sealSSETail192LoopB - - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1; PADDL ·chacha20Constants<>(SB), A2 - PADDL state1Store, B0; PADDL state1Store, B1; PADDL state1Store, B2 - PADDL state2Store, C0; PADDL state2Store, C1; PADDL state2Store, C2 - PADDL ctr0Store, D0; PADDL ctr1Store, D1; PADDL ctr2Store, D2 - - MOVOU (0*16)(inp), T0; MOVOU (1*16)(inp), T1; MOVOU (2*16)(inp), T2; MOVOU (3*16)(inp), T3 - PXOR T0, A0; PXOR T1, B0; PXOR T2, C0; PXOR T3, D0 - MOVOU A0, (0*16)(oup); MOVOU B0, (1*16)(oup); MOVOU C0, (2*16)(oup); MOVOU D0, (3*16)(oup) - MOVOU (4*16)(inp), T0; MOVOU (5*16)(inp), T1; MOVOU (6*16)(inp), T2; MOVOU (7*16)(inp), T3 - PXOR T0, A1; PXOR T1, B1; PXOR T2, C1; PXOR T3, D1 - MOVOU A1, (4*16)(oup); MOVOU B1, (5*16)(oup); MOVOU C1, (6*16)(oup); MOVOU D1, (7*16)(oup) - - MOVO A2, A1 - MOVO B2, B1 - MOVO C2, C1 - MOVO D2, D1 - MOVQ $128, itr1 - LEAQ 128(inp), inp - SUBQ $128, inl - - JMP sealSSE128SealHash - -// ---------------------------------------------------------------------------- -// Special seal optimization for buffers smaller than 129 bytes -sealSSE128: - // For up to 128 bytes of ciphertext and 64 bytes for the poly key, we require to process three blocks - MOVOU ·chacha20Constants<>(SB), A0; MOVOU (1*16)(keyp), B0; MOVOU (2*16)(keyp), C0; MOVOU (3*16)(keyp), D0 - MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1 - MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2 - MOVO B0, T1; MOVO C0, T2; MOVO D1, T3 - MOVQ $10, itr2 - -sealSSE128InnerCipherLoop: - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Left; shiftB1Left; shiftB2Left - shiftC0Left; shiftC1Left; shiftC2Left - shiftD0Left; shiftD1Left; shiftD2Left - chachaQR(A0, B0, C0, D0, T0); chachaQR(A1, B1, C1, D1, T0); chachaQR(A2, B2, C2, D2, T0) - shiftB0Right; shiftB1Right; shiftB2Right - shiftC0Right; shiftC1Right; shiftC2Right - shiftD0Right; shiftD1Right; shiftD2Right - DECQ itr2 - JNE sealSSE128InnerCipherLoop - - // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded - PADDL ·chacha20Constants<>(SB), A0; PADDL ·chacha20Constants<>(SB), A1; PADDL ·chacha20Constants<>(SB), A2 - PADDL T1, B0; PADDL T1, B1; PADDL T1, B2 - PADDL T2, C1; PADDL T2, C2 - PADDL T3, D1; PADDL ·sseIncMask<>(SB), T3; PADDL T3, D2 - PAND ·polyClampMask<>(SB), A0 - MOVOU A0, rStore - MOVOU B0, sStore - - // Hash - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - XORQ itr1, itr1 - -sealSSE128SealHash: - // itr1 holds the number of bytes encrypted but not yet hashed - CMPQ itr1, $16 - JB sealSSE128Seal - polyAdd(0(oup)) - polyMul - - SUBQ $16, itr1 - ADDQ $16, oup - - JMP sealSSE128SealHash - -sealSSE128Seal: - CMPQ inl, $16 - JB sealSSETail - SUBQ $16, inl - - // Load for decryption - MOVOU (inp), T0 - PXOR T0, A1 - MOVOU A1, (oup) - LEAQ (1*16)(inp), inp - LEAQ (1*16)(oup), oup - - // Extract for hashing - MOVQ A1, t0 - PSRLDQ $8, A1 - MOVQ A1, t1 - ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $1, acc2 - polyMul - - // Shift the stream "left" - MOVO B1, A1 - MOVO C1, B1 - MOVO D1, C1 - MOVO A2, D1 - MOVO B2, A2 - MOVO C2, B2 - MOVO D2, C2 - JMP sealSSE128Seal - -sealSSETail: - TESTQ inl, inl - JE sealSSEFinalize - - // We can only load the PT one byte at a time to avoid read after end of buffer - MOVQ inl, itr2 - SHLQ $4, itr2 - LEAQ ·andMask<>(SB), t0 - MOVQ inl, itr1 - LEAQ -1(inp)(inl*1), inp - XORQ t2, t2 - XORQ t3, t3 - XORQ AX, AX - -sealSSETailLoadLoop: - SHLQ $8, t2, t3 - SHLQ $8, t2 - MOVB (inp), AX - XORQ AX, t2 - LEAQ -1(inp), inp - DECQ itr1 - JNE sealSSETailLoadLoop - MOVQ t2, 0+tmpStore - MOVQ t3, 8+tmpStore - PXOR 0+tmpStore, A1 - MOVOU A1, (oup) - MOVOU -16(t0)(itr2*1), T0 - PAND T0, A1 - MOVQ A1, t0 - PSRLDQ $8, A1 - MOVQ A1, t1 - ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $1, acc2 - polyMul - - ADDQ inl, oup - -sealSSEFinalize: - // Hash in the buffer lengths - ADDQ ad_len+80(FP), acc0 - ADCQ src_len+56(FP), acc1 - ADCQ $1, acc2 - polyMul - - // Final reduce - MOVQ acc0, t0 - MOVQ acc1, t1 - MOVQ acc2, t2 - SUBQ $-5, acc0 - SBBQ $-1, acc1 - SBBQ $3, acc2 - CMOVQCS t0, acc0 - CMOVQCS t1, acc1 - CMOVQCS t2, acc2 - - // Add in the "s" part of the key - ADDQ 0+sStore, acc0 - ADCQ 8+sStore, acc1 - - // Finally store the tag at the end of the message - MOVQ acc0, (0*8)(oup) - MOVQ acc1, (1*8)(oup) - RET - -// ---------------------------------------------------------------------------- -// ------------------------- AVX2 Code ---------------------------------------- -chacha20Poly1305Seal_AVX2: - VZEROUPPER - VMOVDQU ·chacha20Constants<>(SB), AA0 - BYTE $0xc4; BYTE $0x42; BYTE $0x7d; BYTE $0x5a; BYTE $0x70; BYTE $0x10 // broadcasti128 16(r8), ymm14 - BYTE $0xc4; BYTE $0x42; BYTE $0x7d; BYTE $0x5a; BYTE $0x60; BYTE $0x20 // broadcasti128 32(r8), ymm12 - BYTE $0xc4; BYTE $0xc2; BYTE $0x7d; BYTE $0x5a; BYTE $0x60; BYTE $0x30 // broadcasti128 48(r8), ymm4 - VPADDD ·avx2InitMask<>(SB), DD0, DD0 - - // Special optimizations, for very short buffers - CMPQ inl, $192 - JBE seal192AVX2 // 33% faster - CMPQ inl, $320 - JBE seal320AVX2 // 17% faster - - // For the general key prepare the key first - as a byproduct we have 64 bytes of cipher stream - VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3; VMOVDQA BB0, state1StoreAVX2 - VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3; VMOVDQA CC0, state2StoreAVX2 - VPADDD ·avx2IncMask<>(SB), DD0, DD1; VMOVDQA DD0, ctr0StoreAVX2 - VPADDD ·avx2IncMask<>(SB), DD1, DD2; VMOVDQA DD1, ctr1StoreAVX2 - VPADDD ·avx2IncMask<>(SB), DD2, DD3; VMOVDQA DD2, ctr2StoreAVX2 - VMOVDQA DD3, ctr3StoreAVX2 - MOVQ $10, itr2 - -sealAVX2IntroLoop: - VMOVDQA CC3, tmpStoreAVX2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, CC3); chachaQR_AVX2(AA1, BB1, CC1, DD1, CC3); chachaQR_AVX2(AA2, BB2, CC2, DD2, CC3) - VMOVDQA tmpStoreAVX2, CC3 - VMOVDQA CC1, tmpStoreAVX2 - chachaQR_AVX2(AA3, BB3, CC3, DD3, CC1) - VMOVDQA tmpStoreAVX2, CC1 - - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $12, DD0, DD0, DD0 - VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $12, DD1, DD1, DD1 - VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $12, DD2, DD2, DD2 - VPALIGNR $4, BB3, BB3, BB3; VPALIGNR $8, CC3, CC3, CC3; VPALIGNR $12, DD3, DD3, DD3 - - VMOVDQA CC3, tmpStoreAVX2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, CC3); chachaQR_AVX2(AA1, BB1, CC1, DD1, CC3); chachaQR_AVX2(AA2, BB2, CC2, DD2, CC3) - VMOVDQA tmpStoreAVX2, CC3 - VMOVDQA CC1, tmpStoreAVX2 - chachaQR_AVX2(AA3, BB3, CC3, DD3, CC1) - VMOVDQA tmpStoreAVX2, CC1 - - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $4, DD0, DD0, DD0 - VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $4, DD1, DD1, DD1 - VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $4, DD2, DD2, DD2 - VPALIGNR $12, BB3, BB3, BB3; VPALIGNR $8, CC3, CC3, CC3; VPALIGNR $4, DD3, DD3, DD3 - DECQ itr2 - JNE sealAVX2IntroLoop - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2; VPADDD ·chacha20Constants<>(SB), AA3, AA3 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2; VPADDD state1StoreAVX2, BB3, BB3 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2; VPADDD state2StoreAVX2, CC3, CC3 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2; VPADDD ctr3StoreAVX2, DD3, DD3 - - VPERM2I128 $0x13, CC0, DD0, CC0 // Stream bytes 96 - 127 - VPERM2I128 $0x02, AA0, BB0, DD0 // The Poly1305 key - VPERM2I128 $0x13, AA0, BB0, AA0 // Stream bytes 64 - 95 - - // Clamp and store poly key - VPAND ·polyClampMask<>(SB), DD0, DD0 - VMOVDQA DD0, rsStoreAVX2 - - // Hash AD - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - - // Can store at least 320 bytes - VPXOR (0*32)(inp), AA0, AA0 - VPXOR (1*32)(inp), CC0, CC0 - VMOVDQU AA0, (0*32)(oup) - VMOVDQU CC0, (1*32)(oup) - - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - VPXOR (2*32)(inp), AA0, AA0; VPXOR (3*32)(inp), BB0, BB0; VPXOR (4*32)(inp), CC0, CC0; VPXOR (5*32)(inp), DD0, DD0 - VMOVDQU AA0, (2*32)(oup); VMOVDQU BB0, (3*32)(oup); VMOVDQU CC0, (4*32)(oup); VMOVDQU DD0, (5*32)(oup) - VPERM2I128 $0x02, AA2, BB2, AA0; VPERM2I128 $0x02, CC2, DD2, BB0; VPERM2I128 $0x13, AA2, BB2, CC0; VPERM2I128 $0x13, CC2, DD2, DD0 - VPXOR (6*32)(inp), AA0, AA0; VPXOR (7*32)(inp), BB0, BB0; VPXOR (8*32)(inp), CC0, CC0; VPXOR (9*32)(inp), DD0, DD0 - VMOVDQU AA0, (6*32)(oup); VMOVDQU BB0, (7*32)(oup); VMOVDQU CC0, (8*32)(oup); VMOVDQU DD0, (9*32)(oup) - - MOVQ $320, itr1 - SUBQ $320, inl - LEAQ 320(inp), inp - - VPERM2I128 $0x02, AA3, BB3, AA0; VPERM2I128 $0x02, CC3, DD3, BB0; VPERM2I128 $0x13, AA3, BB3, CC0; VPERM2I128 $0x13, CC3, DD3, DD0 - CMPQ inl, $128 - JBE sealAVX2SealHash - - VPXOR (0*32)(inp), AA0, AA0; VPXOR (1*32)(inp), BB0, BB0; VPXOR (2*32)(inp), CC0, CC0; VPXOR (3*32)(inp), DD0, DD0 - VMOVDQU AA0, (10*32)(oup); VMOVDQU BB0, (11*32)(oup); VMOVDQU CC0, (12*32)(oup); VMOVDQU DD0, (13*32)(oup) - SUBQ $128, inl - LEAQ 128(inp), inp - - MOVQ $8, itr1 - MOVQ $2, itr2 - - CMPQ inl, $128 - JBE sealAVX2Tail128 - CMPQ inl, $256 - JBE sealAVX2Tail256 - CMPQ inl, $384 - JBE sealAVX2Tail384 - CMPQ inl, $512 - JBE sealAVX2Tail512 - - // We have 448 bytes to hash, but main loop hashes 512 bytes at a time - perform some rounds, before the main loop - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2; VPADDD ·avx2IncMask<>(SB), DD2, DD3 - VMOVDQA DD0, ctr0StoreAVX2; VMOVDQA DD1, ctr1StoreAVX2; VMOVDQA DD2, ctr2StoreAVX2; VMOVDQA DD3, ctr3StoreAVX2 - - VMOVDQA CC3, tmpStoreAVX2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, CC3); chachaQR_AVX2(AA1, BB1, CC1, DD1, CC3); chachaQR_AVX2(AA2, BB2, CC2, DD2, CC3) - VMOVDQA tmpStoreAVX2, CC3 - VMOVDQA CC1, tmpStoreAVX2 - chachaQR_AVX2(AA3, BB3, CC3, DD3, CC1) - VMOVDQA tmpStoreAVX2, CC1 - - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $12, DD0, DD0, DD0 - VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $12, DD1, DD1, DD1 - VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $12, DD2, DD2, DD2 - VPALIGNR $4, BB3, BB3, BB3; VPALIGNR $8, CC3, CC3, CC3; VPALIGNR $12, DD3, DD3, DD3 - - VMOVDQA CC3, tmpStoreAVX2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, CC3); chachaQR_AVX2(AA1, BB1, CC1, DD1, CC3); chachaQR_AVX2(AA2, BB2, CC2, DD2, CC3) - VMOVDQA tmpStoreAVX2, CC3 - VMOVDQA CC1, tmpStoreAVX2 - chachaQR_AVX2(AA3, BB3, CC3, DD3, CC1) - VMOVDQA tmpStoreAVX2, CC1 - - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $4, DD0, DD0, DD0 - VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $4, DD1, DD1, DD1 - VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $4, DD2, DD2, DD2 - VPALIGNR $12, BB3, BB3, BB3; VPALIGNR $8, CC3, CC3, CC3; VPALIGNR $4, DD3, DD3, DD3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - - SUBQ $16, oup // Adjust the pointer - MOVQ $9, itr1 - JMP sealAVX2InternalLoopStart - -sealAVX2MainLoop: - // Load state, increment counter blocks, store the incremented counters - VMOVDQU ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3 - VMOVDQA ctr3StoreAVX2, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2; VPADDD ·avx2IncMask<>(SB), DD2, DD3 - VMOVDQA DD0, ctr0StoreAVX2; VMOVDQA DD1, ctr1StoreAVX2; VMOVDQA DD2, ctr2StoreAVX2; VMOVDQA DD3, ctr3StoreAVX2 - MOVQ $10, itr1 - -sealAVX2InternalLoop: - polyAdd(0*8(oup)) - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - polyMulStage1_AVX2 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - polyMulStage2_AVX2 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyMulStage3_AVX2 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulReduceStage - -sealAVX2InternalLoopStart: - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - polyAdd(2*8(oup)) - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - polyMulStage1_AVX2 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulStage2_AVX2 - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $4, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2; VPALIGNR $12, DD3, DD3, DD3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - polyMulStage3_AVX2 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - polyMulReduceStage - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyAdd(4*8(oup)) - LEAQ (6*8)(oup), oup - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulStage1_AVX2 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - polyMulStage2_AVX2 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - polyMulStage3_AVX2 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyMulReduceStage - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $12, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2; VPALIGNR $4, DD3, DD3, DD3 - DECQ itr1 - JNE sealAVX2InternalLoop - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2; VPADDD ·chacha20Constants<>(SB), AA3, AA3 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2; VPADDD state1StoreAVX2, BB3, BB3 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2; VPADDD state2StoreAVX2, CC3, CC3 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2; VPADDD ctr3StoreAVX2, DD3, DD3 - VMOVDQA CC3, tmpStoreAVX2 - - // We only hashed 480 of the 512 bytes available - hash the remaining 32 here - polyAdd(0*8(oup)) - polyMulAVX2 - LEAQ (4*8)(oup), oup - VPERM2I128 $0x02, AA0, BB0, CC3; VPERM2I128 $0x13, AA0, BB0, BB0; VPERM2I128 $0x02, CC0, DD0, AA0; VPERM2I128 $0x13, CC0, DD0, CC0 - VPXOR (0*32)(inp), CC3, CC3; VPXOR (1*32)(inp), AA0, AA0; VPXOR (2*32)(inp), BB0, BB0; VPXOR (3*32)(inp), CC0, CC0 - VMOVDQU CC3, (0*32)(oup); VMOVDQU AA0, (1*32)(oup); VMOVDQU BB0, (2*32)(oup); VMOVDQU CC0, (3*32)(oup) - VPERM2I128 $0x02, AA1, BB1, AA0; VPERM2I128 $0x02, CC1, DD1, BB0; VPERM2I128 $0x13, AA1, BB1, CC0; VPERM2I128 $0x13, CC1, DD1, DD0 - VPXOR (4*32)(inp), AA0, AA0; VPXOR (5*32)(inp), BB0, BB0; VPXOR (6*32)(inp), CC0, CC0; VPXOR (7*32)(inp), DD0, DD0 - VMOVDQU AA0, (4*32)(oup); VMOVDQU BB0, (5*32)(oup); VMOVDQU CC0, (6*32)(oup); VMOVDQU DD0, (7*32)(oup) - - // and here - polyAdd(-2*8(oup)) - polyMulAVX2 - VPERM2I128 $0x02, AA2, BB2, AA0; VPERM2I128 $0x02, CC2, DD2, BB0; VPERM2I128 $0x13, AA2, BB2, CC0; VPERM2I128 $0x13, CC2, DD2, DD0 - VPXOR (8*32)(inp), AA0, AA0; VPXOR (9*32)(inp), BB0, BB0; VPXOR (10*32)(inp), CC0, CC0; VPXOR (11*32)(inp), DD0, DD0 - VMOVDQU AA0, (8*32)(oup); VMOVDQU BB0, (9*32)(oup); VMOVDQU CC0, (10*32)(oup); VMOVDQU DD0, (11*32)(oup) - VPERM2I128 $0x02, AA3, BB3, AA0; VPERM2I128 $0x02, tmpStoreAVX2, DD3, BB0; VPERM2I128 $0x13, AA3, BB3, CC0; VPERM2I128 $0x13, tmpStoreAVX2, DD3, DD0 - VPXOR (12*32)(inp), AA0, AA0; VPXOR (13*32)(inp), BB0, BB0; VPXOR (14*32)(inp), CC0, CC0; VPXOR (15*32)(inp), DD0, DD0 - VMOVDQU AA0, (12*32)(oup); VMOVDQU BB0, (13*32)(oup); VMOVDQU CC0, (14*32)(oup); VMOVDQU DD0, (15*32)(oup) - LEAQ (32*16)(inp), inp - SUBQ $(32*16), inl - CMPQ inl, $512 - JG sealAVX2MainLoop - - // Tail can only hash 480 bytes - polyAdd(0*8(oup)) - polyMulAVX2 - polyAdd(2*8(oup)) - polyMulAVX2 - LEAQ 32(oup), oup - - MOVQ $10, itr1 - MOVQ $0, itr2 - CMPQ inl, $128 - JBE sealAVX2Tail128 - CMPQ inl, $256 - JBE sealAVX2Tail256 - CMPQ inl, $384 - JBE sealAVX2Tail384 - JMP sealAVX2Tail512 - -// ---------------------------------------------------------------------------- -// Special optimization for buffers smaller than 193 bytes -seal192AVX2: - // For up to 192 bytes of ciphertext and 64 bytes for the poly key, we process four blocks - VMOVDQA AA0, AA1 - VMOVDQA BB0, BB1 - VMOVDQA CC0, CC1 - VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA AA0, AA2 - VMOVDQA BB0, BB2 - VMOVDQA CC0, CC2 - VMOVDQA DD0, DD2 - VMOVDQA DD1, TT3 - MOVQ $10, itr2 - -sealAVX2192InnerCipherLoop: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1 - DECQ itr2 - JNE sealAVX2192InnerCipherLoop - VPADDD AA2, AA0, AA0; VPADDD AA2, AA1, AA1 - VPADDD BB2, BB0, BB0; VPADDD BB2, BB1, BB1 - VPADDD CC2, CC0, CC0; VPADDD CC2, CC1, CC1 - VPADDD DD2, DD0, DD0; VPADDD TT3, DD1, DD1 - VPERM2I128 $0x02, AA0, BB0, TT0 - - // Clamp and store poly key - VPAND ·polyClampMask<>(SB), TT0, TT0 - VMOVDQA TT0, rsStoreAVX2 - - // Stream for up to 192 bytes - VPERM2I128 $0x13, AA0, BB0, AA0 - VPERM2I128 $0x13, CC0, DD0, BB0 - VPERM2I128 $0x02, AA1, BB1, CC0 - VPERM2I128 $0x02, CC1, DD1, DD0 - VPERM2I128 $0x13, AA1, BB1, AA1 - VPERM2I128 $0x13, CC1, DD1, BB1 - -sealAVX2ShortSeal: - // Hash aad - MOVQ ad_len+80(FP), itr2 - CALL polyHashADInternal<>(SB) - XORQ itr1, itr1 - -sealAVX2SealHash: - // itr1 holds the number of bytes encrypted but not yet hashed - CMPQ itr1, $16 - JB sealAVX2ShortSealLoop - polyAdd(0(oup)) - polyMul - SUBQ $16, itr1 - ADDQ $16, oup - JMP sealAVX2SealHash - -sealAVX2ShortSealLoop: - CMPQ inl, $32 - JB sealAVX2ShortTail32 - SUBQ $32, inl - - // Load for encryption - VPXOR (inp), AA0, AA0 - VMOVDQU AA0, (oup) - LEAQ (1*32)(inp), inp - - // Now can hash - polyAdd(0*8(oup)) - polyMulAVX2 - polyAdd(2*8(oup)) - polyMulAVX2 - LEAQ (1*32)(oup), oup - - // Shift stream left - VMOVDQA BB0, AA0 - VMOVDQA CC0, BB0 - VMOVDQA DD0, CC0 - VMOVDQA AA1, DD0 - VMOVDQA BB1, AA1 - VMOVDQA CC1, BB1 - VMOVDQA DD1, CC1 - VMOVDQA AA2, DD1 - VMOVDQA BB2, AA2 - JMP sealAVX2ShortSealLoop - -sealAVX2ShortTail32: - CMPQ inl, $16 - VMOVDQA A0, A1 - JB sealAVX2ShortDone - - SUBQ $16, inl - - // Load for encryption - VPXOR (inp), A0, T0 - VMOVDQU T0, (oup) - LEAQ (1*16)(inp), inp - - // Hash - polyAdd(0*8(oup)) - polyMulAVX2 - LEAQ (1*16)(oup), oup - VPERM2I128 $0x11, AA0, AA0, AA0 - VMOVDQA A0, A1 - -sealAVX2ShortDone: - VZEROUPPER - JMP sealSSETail - -// ---------------------------------------------------------------------------- -// Special optimization for buffers smaller than 321 bytes -seal320AVX2: - // For up to 320 bytes of ciphertext and 64 bytes for the poly key, we process six blocks - VMOVDQA AA0, AA1; VMOVDQA BB0, BB1; VMOVDQA CC0, CC1; VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA AA0, AA2; VMOVDQA BB0, BB2; VMOVDQA CC0, CC2; VPADDD ·avx2IncMask<>(SB), DD1, DD2 - VMOVDQA BB0, TT1; VMOVDQA CC0, TT2; VMOVDQA DD0, TT3 - MOVQ $10, itr2 - -sealAVX2320InnerCipherLoop: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2 - DECQ itr2 - JNE sealAVX2320InnerCipherLoop - - VMOVDQA ·chacha20Constants<>(SB), TT0 - VPADDD TT0, AA0, AA0; VPADDD TT0, AA1, AA1; VPADDD TT0, AA2, AA2 - VPADDD TT1, BB0, BB0; VPADDD TT1, BB1, BB1; VPADDD TT1, BB2, BB2 - VPADDD TT2, CC0, CC0; VPADDD TT2, CC1, CC1; VPADDD TT2, CC2, CC2 - VMOVDQA ·avx2IncMask<>(SB), TT0 - VPADDD TT3, DD0, DD0; VPADDD TT0, TT3, TT3 - VPADDD TT3, DD1, DD1; VPADDD TT0, TT3, TT3 - VPADDD TT3, DD2, DD2 - - // Clamp and store poly key - VPERM2I128 $0x02, AA0, BB0, TT0 - VPAND ·polyClampMask<>(SB), TT0, TT0 - VMOVDQA TT0, rsStoreAVX2 - - // Stream for up to 320 bytes - VPERM2I128 $0x13, AA0, BB0, AA0 - VPERM2I128 $0x13, CC0, DD0, BB0 - VPERM2I128 $0x02, AA1, BB1, CC0 - VPERM2I128 $0x02, CC1, DD1, DD0 - VPERM2I128 $0x13, AA1, BB1, AA1 - VPERM2I128 $0x13, CC1, DD1, BB1 - VPERM2I128 $0x02, AA2, BB2, CC1 - VPERM2I128 $0x02, CC2, DD2, DD1 - VPERM2I128 $0x13, AA2, BB2, AA2 - VPERM2I128 $0x13, CC2, DD2, BB2 - JMP sealAVX2ShortSeal - -// ---------------------------------------------------------------------------- -// Special optimization for the last 128 bytes of ciphertext -sealAVX2Tail128: - // Need to decrypt up to 128 bytes - prepare two blocks - // If we got here after the main loop - there are 512 encrypted bytes waiting to be hashed - // If we got here before the main loop - there are 448 encrpyred bytes waiting to be hashed - VMOVDQA ·chacha20Constants<>(SB), AA0 - VMOVDQA state1StoreAVX2, BB0 - VMOVDQA state2StoreAVX2, CC0 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0 - VMOVDQA DD0, DD1 - -sealAVX2Tail128LoopA: - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealAVX2Tail128LoopB: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0) - polyAdd(0(oup)) - polyMul - VPALIGNR $4, BB0, BB0, BB0 - VPALIGNR $8, CC0, CC0, CC0 - VPALIGNR $12, DD0, DD0, DD0 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0) - polyAdd(16(oup)) - polyMul - LEAQ 32(oup), oup - VPALIGNR $12, BB0, BB0, BB0 - VPALIGNR $8, CC0, CC0, CC0 - VPALIGNR $4, DD0, DD0, DD0 - DECQ itr1 - JG sealAVX2Tail128LoopA - DECQ itr2 - JGE sealAVX2Tail128LoopB - - VPADDD ·chacha20Constants<>(SB), AA0, AA1 - VPADDD state1StoreAVX2, BB0, BB1 - VPADDD state2StoreAVX2, CC0, CC1 - VPADDD DD1, DD0, DD1 - - VPERM2I128 $0x02, AA1, BB1, AA0 - VPERM2I128 $0x02, CC1, DD1, BB0 - VPERM2I128 $0x13, AA1, BB1, CC0 - VPERM2I128 $0x13, CC1, DD1, DD0 - JMP sealAVX2ShortSealLoop - -// ---------------------------------------------------------------------------- -// Special optimization for the last 256 bytes of ciphertext -sealAVX2Tail256: - // Need to decrypt up to 256 bytes - prepare two blocks - // If we got here after the main loop - there are 512 encrypted bytes waiting to be hashed - // If we got here before the main loop - there are 448 encrpyred bytes waiting to be hashed - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA ·chacha20Constants<>(SB), AA1 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA state1StoreAVX2, BB1 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA state2StoreAVX2, CC1 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD1 - VMOVDQA DD0, TT1 - VMOVDQA DD1, TT2 - -sealAVX2Tail256LoopA: - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealAVX2Tail256LoopB: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - polyAdd(0(oup)) - polyMul - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0) - polyAdd(16(oup)) - polyMul - LEAQ 32(oup), oup - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1 - DECQ itr1 - JG sealAVX2Tail256LoopA - DECQ itr2 - JGE sealAVX2Tail256LoopB - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1 - VPADDD TT1, DD0, DD0; VPADDD TT2, DD1, DD1 - VPERM2I128 $0x02, AA0, BB0, TT0 - VPERM2I128 $0x02, CC0, DD0, TT1 - VPERM2I128 $0x13, AA0, BB0, TT2 - VPERM2I128 $0x13, CC0, DD0, TT3 - VPXOR (0*32)(inp), TT0, TT0; VPXOR (1*32)(inp), TT1, TT1; VPXOR (2*32)(inp), TT2, TT2; VPXOR (3*32)(inp), TT3, TT3 - VMOVDQU TT0, (0*32)(oup); VMOVDQU TT1, (1*32)(oup); VMOVDQU TT2, (2*32)(oup); VMOVDQU TT3, (3*32)(oup) - MOVQ $128, itr1 - LEAQ 128(inp), inp - SUBQ $128, inl - VPERM2I128 $0x02, AA1, BB1, AA0 - VPERM2I128 $0x02, CC1, DD1, BB0 - VPERM2I128 $0x13, AA1, BB1, CC0 - VPERM2I128 $0x13, CC1, DD1, DD0 - - JMP sealAVX2SealHash - -// ---------------------------------------------------------------------------- -// Special optimization for the last 384 bytes of ciphertext -sealAVX2Tail384: - // Need to decrypt up to 384 bytes - prepare two blocks - // If we got here after the main loop - there are 512 encrypted bytes waiting to be hashed - // If we got here before the main loop - there are 448 encrpyred bytes waiting to be hashed - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2 - VMOVDQA DD0, TT1; VMOVDQA DD1, TT2; VMOVDQA DD2, TT3 - -sealAVX2Tail384LoopA: - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealAVX2Tail384LoopB: - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - polyAdd(0(oup)) - polyMul - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2 - chachaQR_AVX2(AA0, BB0, CC0, DD0, TT0); chachaQR_AVX2(AA1, BB1, CC1, DD1, TT0); chachaQR_AVX2(AA2, BB2, CC2, DD2, TT0) - polyAdd(16(oup)) - polyMul - LEAQ 32(oup), oup - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2 - DECQ itr1 - JG sealAVX2Tail384LoopA - DECQ itr2 - JGE sealAVX2Tail384LoopB - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2 - VPADDD TT1, DD0, DD0; VPADDD TT2, DD1, DD1; VPADDD TT3, DD2, DD2 - VPERM2I128 $0x02, AA0, BB0, TT0 - VPERM2I128 $0x02, CC0, DD0, TT1 - VPERM2I128 $0x13, AA0, BB0, TT2 - VPERM2I128 $0x13, CC0, DD0, TT3 - VPXOR (0*32)(inp), TT0, TT0; VPXOR (1*32)(inp), TT1, TT1; VPXOR (2*32)(inp), TT2, TT2; VPXOR (3*32)(inp), TT3, TT3 - VMOVDQU TT0, (0*32)(oup); VMOVDQU TT1, (1*32)(oup); VMOVDQU TT2, (2*32)(oup); VMOVDQU TT3, (3*32)(oup) - VPERM2I128 $0x02, AA1, BB1, TT0 - VPERM2I128 $0x02, CC1, DD1, TT1 - VPERM2I128 $0x13, AA1, BB1, TT2 - VPERM2I128 $0x13, CC1, DD1, TT3 - VPXOR (4*32)(inp), TT0, TT0; VPXOR (5*32)(inp), TT1, TT1; VPXOR (6*32)(inp), TT2, TT2; VPXOR (7*32)(inp), TT3, TT3 - VMOVDQU TT0, (4*32)(oup); VMOVDQU TT1, (5*32)(oup); VMOVDQU TT2, (6*32)(oup); VMOVDQU TT3, (7*32)(oup) - MOVQ $256, itr1 - LEAQ 256(inp), inp - SUBQ $256, inl - VPERM2I128 $0x02, AA2, BB2, AA0 - VPERM2I128 $0x02, CC2, DD2, BB0 - VPERM2I128 $0x13, AA2, BB2, CC0 - VPERM2I128 $0x13, CC2, DD2, DD0 - - JMP sealAVX2SealHash - -// ---------------------------------------------------------------------------- -// Special optimization for the last 512 bytes of ciphertext -sealAVX2Tail512: - // Need to decrypt up to 512 bytes - prepare two blocks - // If we got here after the main loop - there are 512 encrypted bytes waiting to be hashed - // If we got here before the main loop - there are 448 encrpyred bytes waiting to be hashed - VMOVDQA ·chacha20Constants<>(SB), AA0; VMOVDQA AA0, AA1; VMOVDQA AA0, AA2; VMOVDQA AA0, AA3 - VMOVDQA state1StoreAVX2, BB0; VMOVDQA BB0, BB1; VMOVDQA BB0, BB2; VMOVDQA BB0, BB3 - VMOVDQA state2StoreAVX2, CC0; VMOVDQA CC0, CC1; VMOVDQA CC0, CC2; VMOVDQA CC0, CC3 - VMOVDQA ctr3StoreAVX2, DD0 - VPADDD ·avx2IncMask<>(SB), DD0, DD0; VPADDD ·avx2IncMask<>(SB), DD0, DD1; VPADDD ·avx2IncMask<>(SB), DD1, DD2; VPADDD ·avx2IncMask<>(SB), DD2, DD3 - VMOVDQA DD0, ctr0StoreAVX2; VMOVDQA DD1, ctr1StoreAVX2; VMOVDQA DD2, ctr2StoreAVX2; VMOVDQA DD3, ctr3StoreAVX2 - -sealAVX2Tail512LoopA: - polyAdd(0(oup)) - polyMul - LEAQ 16(oup), oup - -sealAVX2Tail512LoopB: - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - polyAdd(0*8(oup)) - polyMulAVX2 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPALIGNR $4, BB0, BB0, BB0; VPALIGNR $4, BB1, BB1, BB1; VPALIGNR $4, BB2, BB2, BB2; VPALIGNR $4, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $12, DD0, DD0, DD0; VPALIGNR $12, DD1, DD1, DD1; VPALIGNR $12, DD2, DD2, DD2; VPALIGNR $12, DD3, DD3, DD3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol16<>(SB), DD0, DD0; VPSHUFB ·rol16<>(SB), DD1, DD1; VPSHUFB ·rol16<>(SB), DD2, DD2; VPSHUFB ·rol16<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - polyAdd(2*8(oup)) - polyMulAVX2 - LEAQ (4*8)(oup), oup - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $12, BB0, CC3; VPSRLD $20, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $12, BB1, CC3; VPSRLD $20, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $12, BB2, CC3; VPSRLD $20, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $12, BB3, CC3; VPSRLD $20, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPADDD BB0, AA0, AA0; VPADDD BB1, AA1, AA1; VPADDD BB2, AA2, AA2; VPADDD BB3, AA3, AA3 - VPXOR AA0, DD0, DD0; VPXOR AA1, DD1, DD1; VPXOR AA2, DD2, DD2; VPXOR AA3, DD3, DD3 - VPSHUFB ·rol8<>(SB), DD0, DD0; VPSHUFB ·rol8<>(SB), DD1, DD1; VPSHUFB ·rol8<>(SB), DD2, DD2; VPSHUFB ·rol8<>(SB), DD3, DD3 - VPADDD DD0, CC0, CC0; VPADDD DD1, CC1, CC1; VPADDD DD2, CC2, CC2; VPADDD DD3, CC3, CC3 - VPXOR CC0, BB0, BB0; VPXOR CC1, BB1, BB1; VPXOR CC2, BB2, BB2; VPXOR CC3, BB3, BB3 - VMOVDQA CC3, tmpStoreAVX2 - VPSLLD $7, BB0, CC3; VPSRLD $25, BB0, BB0; VPXOR CC3, BB0, BB0 - VPSLLD $7, BB1, CC3; VPSRLD $25, BB1, BB1; VPXOR CC3, BB1, BB1 - VPSLLD $7, BB2, CC3; VPSRLD $25, BB2, BB2; VPXOR CC3, BB2, BB2 - VPSLLD $7, BB3, CC3; VPSRLD $25, BB3, BB3; VPXOR CC3, BB3, BB3 - VMOVDQA tmpStoreAVX2, CC3 - VPALIGNR $12, BB0, BB0, BB0; VPALIGNR $12, BB1, BB1, BB1; VPALIGNR $12, BB2, BB2, BB2; VPALIGNR $12, BB3, BB3, BB3 - VPALIGNR $8, CC0, CC0, CC0; VPALIGNR $8, CC1, CC1, CC1; VPALIGNR $8, CC2, CC2, CC2; VPALIGNR $8, CC3, CC3, CC3 - VPALIGNR $4, DD0, DD0, DD0; VPALIGNR $4, DD1, DD1, DD1; VPALIGNR $4, DD2, DD2, DD2; VPALIGNR $4, DD3, DD3, DD3 - - DECQ itr1 - JG sealAVX2Tail512LoopA - DECQ itr2 - JGE sealAVX2Tail512LoopB - - VPADDD ·chacha20Constants<>(SB), AA0, AA0; VPADDD ·chacha20Constants<>(SB), AA1, AA1; VPADDD ·chacha20Constants<>(SB), AA2, AA2; VPADDD ·chacha20Constants<>(SB), AA3, AA3 - VPADDD state1StoreAVX2, BB0, BB0; VPADDD state1StoreAVX2, BB1, BB1; VPADDD state1StoreAVX2, BB2, BB2; VPADDD state1StoreAVX2, BB3, BB3 - VPADDD state2StoreAVX2, CC0, CC0; VPADDD state2StoreAVX2, CC1, CC1; VPADDD state2StoreAVX2, CC2, CC2; VPADDD state2StoreAVX2, CC3, CC3 - VPADDD ctr0StoreAVX2, DD0, DD0; VPADDD ctr1StoreAVX2, DD1, DD1; VPADDD ctr2StoreAVX2, DD2, DD2; VPADDD ctr3StoreAVX2, DD3, DD3 - VMOVDQA CC3, tmpStoreAVX2 - VPERM2I128 $0x02, AA0, BB0, CC3 - VPXOR (0*32)(inp), CC3, CC3 - VMOVDQU CC3, (0*32)(oup) - VPERM2I128 $0x02, CC0, DD0, CC3 - VPXOR (1*32)(inp), CC3, CC3 - VMOVDQU CC3, (1*32)(oup) - VPERM2I128 $0x13, AA0, BB0, CC3 - VPXOR (2*32)(inp), CC3, CC3 - VMOVDQU CC3, (2*32)(oup) - VPERM2I128 $0x13, CC0, DD0, CC3 - VPXOR (3*32)(inp), CC3, CC3 - VMOVDQU CC3, (3*32)(oup) - - VPERM2I128 $0x02, AA1, BB1, AA0 - VPERM2I128 $0x02, CC1, DD1, BB0 - VPERM2I128 $0x13, AA1, BB1, CC0 - VPERM2I128 $0x13, CC1, DD1, DD0 - VPXOR (4*32)(inp), AA0, AA0; VPXOR (5*32)(inp), BB0, BB0; VPXOR (6*32)(inp), CC0, CC0; VPXOR (7*32)(inp), DD0, DD0 - VMOVDQU AA0, (4*32)(oup); VMOVDQU BB0, (5*32)(oup); VMOVDQU CC0, (6*32)(oup); VMOVDQU DD0, (7*32)(oup) - - VPERM2I128 $0x02, AA2, BB2, AA0 - VPERM2I128 $0x02, CC2, DD2, BB0 - VPERM2I128 $0x13, AA2, BB2, CC0 - VPERM2I128 $0x13, CC2, DD2, DD0 - VPXOR (8*32)(inp), AA0, AA0; VPXOR (9*32)(inp), BB0, BB0; VPXOR (10*32)(inp), CC0, CC0; VPXOR (11*32)(inp), DD0, DD0 - VMOVDQU AA0, (8*32)(oup); VMOVDQU BB0, (9*32)(oup); VMOVDQU CC0, (10*32)(oup); VMOVDQU DD0, (11*32)(oup) - - MOVQ $384, itr1 - LEAQ 384(inp), inp - SUBQ $384, inl - VPERM2I128 $0x02, AA3, BB3, AA0 - VPERM2I128 $0x02, tmpStoreAVX2, DD3, BB0 - VPERM2I128 $0x13, AA3, BB3, CC0 - VPERM2I128 $0x13, tmpStoreAVX2, DD3, DD0 - - JMP sealAVX2SealHash diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go index 75f24bab..cb8fbc57 100644 --- a/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -86,7 +86,7 @@ func feFromBytes(dst *fieldElement, src *[32]byte) { h6 := load3(src[20:]) << 7 h7 := load3(src[23:]) << 5 h8 := load3(src[26:]) << 4 - h9 := (load3(src[29:]) & 0x7fffff) << 2 + h9 := load3(src[29:]) << 2 var carry [10]int64 carry[9] = (h9 + 1<<24) >> 25 diff --git a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s index e0ac30c7..9e9040b2 100644 --- a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s @@ -121,18 +121,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -236,18 +236,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -441,18 +441,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -591,18 +591,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -731,18 +731,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -846,18 +846,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -996,18 +996,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -1146,18 +1146,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -1332,18 +1332,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,SI,CX + SHLQ $13,CX:SI ANDQ DX,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX diff --git a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s index 1f76d1a3..5ce80a2e 100644 --- a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s @@ -124,18 +124,18 @@ TEXT ·mul(SB),0,$16-24 ADDQ AX,R14 ADCQ DX,R15 MOVQ $REDMASK51,SI - SHLQ $13,R8,R9 + SHLQ $13,R9:R8 ANDQ SI,R8 - SHLQ $13,R10,R11 + SHLQ $13,R11:R10 ANDQ SI,R10 ADDQ R9,R10 - SHLQ $13,R12,R13 + SHLQ $13,R13:R12 ANDQ SI,R12 ADDQ R11,R12 - SHLQ $13,R14,R15 + SHLQ $13,R15:R14 ANDQ SI,R14 ADDQ R13,R14 - SHLQ $13,BX,BP + SHLQ $13,BP:BX ANDQ SI,BX ADDQ R15,BX IMUL3Q $19,BP,DX diff --git a/vendor/golang.org/x/crypto/curve25519/square_amd64.s b/vendor/golang.org/x/crypto/curve25519/square_amd64.s index 07511a45..12f73734 100644 --- a/vendor/golang.org/x/crypto/curve25519/square_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/square_amd64.s @@ -87,18 +87,18 @@ TEXT ·square(SB),7,$0-16 ADDQ AX,R13 ADCQ DX,R14 MOVQ $REDMASK51,SI - SHLQ $13,CX,R8 + SHLQ $13,R8:CX ANDQ SI,CX - SHLQ $13,R9,R10 + SHLQ $13,R10:R9 ANDQ SI,R9 ADDQ R8,R9 - SHLQ $13,R11,R12 + SHLQ $13,R12:R11 ANDQ SI,R11 ADDQ R10,R11 - SHLQ $13,R13,R14 + SHLQ $13,R14:R13 ANDQ SI,R13 ADDQ R12,R13 - SHLQ $13,R15,BX + SHLQ $13,BX:R15 ANDQ SI,R15 ADDQ R14,R15 IMUL3Q $19,BX,DX diff --git a/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s b/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s deleted file mode 100644 index b3a16ef7..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/asm_arm64.s +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.11 -// +build !gccgo,!appengine - -#include "textflag.h" - -#define NUM_ROUNDS 10 - -// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) -TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0 - MOVD dst+0(FP), R1 - MOVD src+24(FP), R2 - MOVD src_len+32(FP), R3 - MOVD key+48(FP), R4 - MOVD nonce+56(FP), R6 - MOVD counter+64(FP), R7 - - MOVD $·constants(SB), R10 - MOVD $·incRotMatrix(SB), R11 - - MOVW (R7), R20 - - AND $~255, R3, R13 - ADD R2, R13, R12 // R12 for block end - AND $255, R3, R13 -loop: - MOVD $NUM_ROUNDS, R21 - VLD1 (R11), [V30.S4, V31.S4] - - // load contants - // VLD4R (R10), [V0.S4, V1.S4, V2.S4, V3.S4] - WORD $0x4D60E940 - - // load keys - // VLD4R 16(R4), [V4.S4, V5.S4, V6.S4, V7.S4] - WORD $0x4DFFE884 - // VLD4R 16(R4), [V8.S4, V9.S4, V10.S4, V11.S4] - WORD $0x4DFFE888 - SUB $32, R4 - - // load counter + nonce - // VLD1R (R7), [V12.S4] - WORD $0x4D40C8EC - - // VLD3R (R6), [V13.S4, V14.S4, V15.S4] - WORD $0x4D40E8CD - - // update counter - VADD V30.S4, V12.S4, V12.S4 - -chacha: - // V0..V3 += V4..V7 - // V12..V15 <<<= ((V12..V15 XOR V0..V3), 16) - VADD V0.S4, V4.S4, V0.S4 - VADD V1.S4, V5.S4, V1.S4 - VADD V2.S4, V6.S4, V2.S4 - VADD V3.S4, V7.S4, V3.S4 - VEOR V12.B16, V0.B16, V12.B16 - VEOR V13.B16, V1.B16, V13.B16 - VEOR V14.B16, V2.B16, V14.B16 - VEOR V15.B16, V3.B16, V15.B16 - VREV32 V12.H8, V12.H8 - VREV32 V13.H8, V13.H8 - VREV32 V14.H8, V14.H8 - VREV32 V15.H8, V15.H8 - // V8..V11 += V12..V15 - // V4..V7 <<<= ((V4..V7 XOR V8..V11), 12) - VADD V8.S4, V12.S4, V8.S4 - VADD V9.S4, V13.S4, V9.S4 - VADD V10.S4, V14.S4, V10.S4 - VADD V11.S4, V15.S4, V11.S4 - VEOR V8.B16, V4.B16, V16.B16 - VEOR V9.B16, V5.B16, V17.B16 - VEOR V10.B16, V6.B16, V18.B16 - VEOR V11.B16, V7.B16, V19.B16 - VSHL $12, V16.S4, V4.S4 - VSHL $12, V17.S4, V5.S4 - VSHL $12, V18.S4, V6.S4 - VSHL $12, V19.S4, V7.S4 - VSRI $20, V16.S4, V4.S4 - VSRI $20, V17.S4, V5.S4 - VSRI $20, V18.S4, V6.S4 - VSRI $20, V19.S4, V7.S4 - - // V0..V3 += V4..V7 - // V12..V15 <<<= ((V12..V15 XOR V0..V3), 8) - VADD V0.S4, V4.S4, V0.S4 - VADD V1.S4, V5.S4, V1.S4 - VADD V2.S4, V6.S4, V2.S4 - VADD V3.S4, V7.S4, V3.S4 - VEOR V12.B16, V0.B16, V12.B16 - VEOR V13.B16, V1.B16, V13.B16 - VEOR V14.B16, V2.B16, V14.B16 - VEOR V15.B16, V3.B16, V15.B16 - VTBL V31.B16, [V12.B16], V12.B16 - VTBL V31.B16, [V13.B16], V13.B16 - VTBL V31.B16, [V14.B16], V14.B16 - VTBL V31.B16, [V15.B16], V15.B16 - - // V8..V11 += V12..V15 - // V4..V7 <<<= ((V4..V7 XOR V8..V11), 7) - VADD V12.S4, V8.S4, V8.S4 - VADD V13.S4, V9.S4, V9.S4 - VADD V14.S4, V10.S4, V10.S4 - VADD V15.S4, V11.S4, V11.S4 - VEOR V8.B16, V4.B16, V16.B16 - VEOR V9.B16, V5.B16, V17.B16 - VEOR V10.B16, V6.B16, V18.B16 - VEOR V11.B16, V7.B16, V19.B16 - VSHL $7, V16.S4, V4.S4 - VSHL $7, V17.S4, V5.S4 - VSHL $7, V18.S4, V6.S4 - VSHL $7, V19.S4, V7.S4 - VSRI $25, V16.S4, V4.S4 - VSRI $25, V17.S4, V5.S4 - VSRI $25, V18.S4, V6.S4 - VSRI $25, V19.S4, V7.S4 - - // V0..V3 += V5..V7, V4 - // V15,V12-V14 <<<= ((V15,V12-V14 XOR V0..V3), 16) - VADD V0.S4, V5.S4, V0.S4 - VADD V1.S4, V6.S4, V1.S4 - VADD V2.S4, V7.S4, V2.S4 - VADD V3.S4, V4.S4, V3.S4 - VEOR V15.B16, V0.B16, V15.B16 - VEOR V12.B16, V1.B16, V12.B16 - VEOR V13.B16, V2.B16, V13.B16 - VEOR V14.B16, V3.B16, V14.B16 - VREV32 V12.H8, V12.H8 - VREV32 V13.H8, V13.H8 - VREV32 V14.H8, V14.H8 - VREV32 V15.H8, V15.H8 - - // V10 += V15; V5 <<<= ((V10 XOR V5), 12) - // ... - VADD V15.S4, V10.S4, V10.S4 - VADD V12.S4, V11.S4, V11.S4 - VADD V13.S4, V8.S4, V8.S4 - VADD V14.S4, V9.S4, V9.S4 - VEOR V10.B16, V5.B16, V16.B16 - VEOR V11.B16, V6.B16, V17.B16 - VEOR V8.B16, V7.B16, V18.B16 - VEOR V9.B16, V4.B16, V19.B16 - VSHL $12, V16.S4, V5.S4 - VSHL $12, V17.S4, V6.S4 - VSHL $12, V18.S4, V7.S4 - VSHL $12, V19.S4, V4.S4 - VSRI $20, V16.S4, V5.S4 - VSRI $20, V17.S4, V6.S4 - VSRI $20, V18.S4, V7.S4 - VSRI $20, V19.S4, V4.S4 - - // V0 += V5; V15 <<<= ((V0 XOR V15), 8) - // ... - VADD V5.S4, V0.S4, V0.S4 - VADD V6.S4, V1.S4, V1.S4 - VADD V7.S4, V2.S4, V2.S4 - VADD V4.S4, V3.S4, V3.S4 - VEOR V0.B16, V15.B16, V15.B16 - VEOR V1.B16, V12.B16, V12.B16 - VEOR V2.B16, V13.B16, V13.B16 - VEOR V3.B16, V14.B16, V14.B16 - VTBL V31.B16, [V12.B16], V12.B16 - VTBL V31.B16, [V13.B16], V13.B16 - VTBL V31.B16, [V14.B16], V14.B16 - VTBL V31.B16, [V15.B16], V15.B16 - - // V10 += V15; V5 <<<= ((V10 XOR V5), 7) - // ... - VADD V15.S4, V10.S4, V10.S4 - VADD V12.S4, V11.S4, V11.S4 - VADD V13.S4, V8.S4, V8.S4 - VADD V14.S4, V9.S4, V9.S4 - VEOR V10.B16, V5.B16, V16.B16 - VEOR V11.B16, V6.B16, V17.B16 - VEOR V8.B16, V7.B16, V18.B16 - VEOR V9.B16, V4.B16, V19.B16 - VSHL $7, V16.S4, V5.S4 - VSHL $7, V17.S4, V6.S4 - VSHL $7, V18.S4, V7.S4 - VSHL $7, V19.S4, V4.S4 - VSRI $25, V16.S4, V5.S4 - VSRI $25, V17.S4, V6.S4 - VSRI $25, V18.S4, V7.S4 - VSRI $25, V19.S4, V4.S4 - - SUB $1, R21 - CBNZ R21, chacha - - // VLD4R (R10), [V16.S4, V17.S4, V18.S4, V19.S4] - WORD $0x4D60E950 - - // VLD4R 16(R4), [V20.S4, V21.S4, V22.S4, V23.S4] - WORD $0x4DFFE894 - VADD V30.S4, V12.S4, V12.S4 - VADD V16.S4, V0.S4, V0.S4 - VADD V17.S4, V1.S4, V1.S4 - VADD V18.S4, V2.S4, V2.S4 - VADD V19.S4, V3.S4, V3.S4 - // VLD4R 16(R4), [V24.S4, V25.S4, V26.S4, V27.S4] - WORD $0x4DFFE898 - // restore R4 - SUB $32, R4 - - // load counter + nonce - // VLD1R (R7), [V28.S4] - WORD $0x4D40C8FC - // VLD3R (R6), [V29.S4, V30.S4, V31.S4] - WORD $0x4D40E8DD - - VADD V20.S4, V4.S4, V4.S4 - VADD V21.S4, V5.S4, V5.S4 - VADD V22.S4, V6.S4, V6.S4 - VADD V23.S4, V7.S4, V7.S4 - VADD V24.S4, V8.S4, V8.S4 - VADD V25.S4, V9.S4, V9.S4 - VADD V26.S4, V10.S4, V10.S4 - VADD V27.S4, V11.S4, V11.S4 - VADD V28.S4, V12.S4, V12.S4 - VADD V29.S4, V13.S4, V13.S4 - VADD V30.S4, V14.S4, V14.S4 - VADD V31.S4, V15.S4, V15.S4 - - VZIP1 V1.S4, V0.S4, V16.S4 - VZIP2 V1.S4, V0.S4, V17.S4 - VZIP1 V3.S4, V2.S4, V18.S4 - VZIP2 V3.S4, V2.S4, V19.S4 - VZIP1 V5.S4, V4.S4, V20.S4 - VZIP2 V5.S4, V4.S4, V21.S4 - VZIP1 V7.S4, V6.S4, V22.S4 - VZIP2 V7.S4, V6.S4, V23.S4 - VZIP1 V9.S4, V8.S4, V24.S4 - VZIP2 V9.S4, V8.S4, V25.S4 - VZIP1 V11.S4, V10.S4, V26.S4 - VZIP2 V11.S4, V10.S4, V27.S4 - VZIP1 V13.S4, V12.S4, V28.S4 - VZIP2 V13.S4, V12.S4, V29.S4 - VZIP1 V15.S4, V14.S4, V30.S4 - VZIP2 V15.S4, V14.S4, V31.S4 - VZIP1 V18.D2, V16.D2, V0.D2 - VZIP2 V18.D2, V16.D2, V4.D2 - VZIP1 V19.D2, V17.D2, V8.D2 - VZIP2 V19.D2, V17.D2, V12.D2 - VLD1.P 64(R2), [V16.B16, V17.B16, V18.B16, V19.B16] - - VZIP1 V22.D2, V20.D2, V1.D2 - VZIP2 V22.D2, V20.D2, V5.D2 - VZIP1 V23.D2, V21.D2, V9.D2 - VZIP2 V23.D2, V21.D2, V13.D2 - VLD1.P 64(R2), [V20.B16, V21.B16, V22.B16, V23.B16] - VZIP1 V26.D2, V24.D2, V2.D2 - VZIP2 V26.D2, V24.D2, V6.D2 - VZIP1 V27.D2, V25.D2, V10.D2 - VZIP2 V27.D2, V25.D2, V14.D2 - VLD1.P 64(R2), [V24.B16, V25.B16, V26.B16, V27.B16] - VZIP1 V30.D2, V28.D2, V3.D2 - VZIP2 V30.D2, V28.D2, V7.D2 - VZIP1 V31.D2, V29.D2, V11.D2 - VZIP2 V31.D2, V29.D2, V15.D2 - VLD1.P 64(R2), [V28.B16, V29.B16, V30.B16, V31.B16] - VEOR V0.B16, V16.B16, V16.B16 - VEOR V1.B16, V17.B16, V17.B16 - VEOR V2.B16, V18.B16, V18.B16 - VEOR V3.B16, V19.B16, V19.B16 - VST1.P [V16.B16, V17.B16, V18.B16, V19.B16], 64(R1) - VEOR V4.B16, V20.B16, V20.B16 - VEOR V5.B16, V21.B16, V21.B16 - VEOR V6.B16, V22.B16, V22.B16 - VEOR V7.B16, V23.B16, V23.B16 - VST1.P [V20.B16, V21.B16, V22.B16, V23.B16], 64(R1) - VEOR V8.B16, V24.B16, V24.B16 - VEOR V9.B16, V25.B16, V25.B16 - VEOR V10.B16, V26.B16, V26.B16 - VEOR V11.B16, V27.B16, V27.B16 - VST1.P [V24.B16, V25.B16, V26.B16, V27.B16], 64(R1) - VEOR V12.B16, V28.B16, V28.B16 - VEOR V13.B16, V29.B16, V29.B16 - VEOR V14.B16, V30.B16, V30.B16 - VEOR V15.B16, V31.B16, V31.B16 - VST1.P [V28.B16, V29.B16, V30.B16, V31.B16], 64(R1) - - ADD $4, R20 - MOVW R20, (R7) // update counter - - CMP R2, R12 - BGT loop - - RET - - -DATA ·constants+0x00(SB)/4, $0x61707865 -DATA ·constants+0x04(SB)/4, $0x3320646e -DATA ·constants+0x08(SB)/4, $0x79622d32 -DATA ·constants+0x0c(SB)/4, $0x6b206574 -GLOBL ·constants(SB), NOPTR|RODATA, $32 - -DATA ·incRotMatrix+0x00(SB)/4, $0x00000000 -DATA ·incRotMatrix+0x04(SB)/4, $0x00000001 -DATA ·incRotMatrix+0x08(SB)/4, $0x00000002 -DATA ·incRotMatrix+0x0c(SB)/4, $0x00000003 -DATA ·incRotMatrix+0x10(SB)/4, $0x02010003 -DATA ·incRotMatrix+0x14(SB)/4, $0x06050407 -DATA ·incRotMatrix+0x18(SB)/4, $0x0A09080B -DATA ·incRotMatrix+0x1c(SB)/4, $0x0E0D0C0F -GLOBL ·incRotMatrix(SB), NOPTR|RODATA, $32 diff --git a/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s b/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s deleted file mode 100644 index cde3fc98..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s +++ /dev/null @@ -1,668 +0,0 @@ -// Copyright 2019 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. - -// Based on CRYPTOGAMS code with the following comment: -// # ==================================================================== -// # Written by Andy Polyakov for the OpenSSL -// # project. The module is, however, dual licensed under OpenSSL and -// # CRYPTOGAMS licenses depending on where you obtain it. For further -// # details see http://www.openssl.org/~appro/cryptogams/. -// # ==================================================================== - -// Original code can be found at the link below: -// https://github.com/dot-asm/cryptogams/commit/a60f5b50ed908e91e5c39ca79126a4a876d5d8ff - -// There are some differences between CRYPTOGAMS code and this one. The round -// loop for "_int" isn't the same as the original. Some adjustments were -// necessary because there are less vector registers available. For example, some -// X variables (r12, r13, r14, and r15) share the same register used by the -// counter. The original code uses ctr to name the counter. Here we use CNT -// because golang uses CTR as the counter register name. - -// +build ppc64le,!gccgo,!appengine - -#include "textflag.h" - -#define OUT R3 -#define INP R4 -#define LEN R5 -#define KEY R6 -#define CNT R7 - -#define TEMP R8 - -#define X0 R11 -#define X1 R12 -#define X2 R14 -#define X3 R15 -#define X4 R16 -#define X5 R17 -#define X6 R18 -#define X7 R19 -#define X8 R20 -#define X9 R21 -#define X10 R22 -#define X11 R23 -#define X12 R24 -#define X13 R25 -#define X14 R26 -#define X15 R27 - -#define CON0 X0 -#define CON1 X1 -#define CON2 X2 -#define CON3 X3 - -#define KEY0 X4 -#define KEY1 X5 -#define KEY2 X6 -#define KEY3 X7 -#define KEY4 X8 -#define KEY5 X9 -#define KEY6 X10 -#define KEY7 X11 - -#define CNT0 X12 -#define CNT1 X13 -#define CNT2 X14 -#define CNT3 X15 - -#define TMP0 R9 -#define TMP1 R10 -#define TMP2 R28 -#define TMP3 R29 - -#define CONSTS R8 - -#define A0 V0 -#define B0 V1 -#define C0 V2 -#define D0 V3 -#define A1 V4 -#define B1 V5 -#define C1 V6 -#define D1 V7 -#define A2 V8 -#define B2 V9 -#define C2 V10 -#define D2 V11 -#define T0 V12 -#define T1 V13 -#define T2 V14 - -#define K0 V15 -#define K1 V16 -#define K2 V17 -#define K3 V18 -#define K4 V19 -#define K5 V20 - -#define FOUR V21 -#define SIXTEEN V22 -#define TWENTY4 V23 -#define TWENTY V24 -#define TWELVE V25 -#define TWENTY5 V26 -#define SEVEN V27 - -#define INPPERM V28 -#define OUTPERM V29 -#define OUTMASK V30 - -#define DD0 V31 -#define DD1 SEVEN -#define DD2 T0 -#define DD3 T1 -#define DD4 T2 - -DATA ·consts+0x00(SB)/8, $0x3320646e61707865 -DATA ·consts+0x08(SB)/8, $0x6b20657479622d32 -DATA ·consts+0x10(SB)/8, $0x0000000000000001 -DATA ·consts+0x18(SB)/8, $0x0000000000000000 -DATA ·consts+0x20(SB)/8, $0x0000000000000004 -DATA ·consts+0x28(SB)/8, $0x0000000000000000 -DATA ·consts+0x30(SB)/8, $0x0a0b08090e0f0c0d -DATA ·consts+0x38(SB)/8, $0x0203000106070405 -DATA ·consts+0x40(SB)/8, $0x090a0b080d0e0f0c -DATA ·consts+0x48(SB)/8, $0x0102030005060704 -GLOBL ·consts(SB), RODATA, $80 - -//func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[32]byte, counter *[16]byte) -TEXT ·chaCha20_ctr32_vmx(SB),NOSPLIT|NOFRAME,$0 - // Load the arguments inside the registers - MOVD out+0(FP), OUT - MOVD inp+8(FP), INP - MOVD len+16(FP), LEN - MOVD key+24(FP), KEY - MOVD counter+32(FP), CNT - - MOVD $·consts(SB), CONSTS // point to consts addr - - MOVD $16, X0 - MOVD $32, X1 - MOVD $48, X2 - MOVD $64, X3 - MOVD $31, X4 - MOVD $15, X5 - - // Load key - LVX (KEY)(R0), K1 - LVSR (KEY)(R0), T0 - LVX (KEY)(X0), K2 - LVX (KEY)(X4), DD0 - - // Load counter - LVX (CNT)(R0), K3 - LVSR (CNT)(R0), T1 - LVX (CNT)(X5), DD1 - - // Load constants - LVX (CONSTS)(R0), K0 - LVX (CONSTS)(X0), K5 - LVX (CONSTS)(X1), FOUR - LVX (CONSTS)(X2), SIXTEEN - LVX (CONSTS)(X3), TWENTY4 - - // Align key and counter - VPERM K2, K1, T0, K1 - VPERM DD0, K2, T0, K2 - VPERM DD1, K3, T1, K3 - - // Load counter to GPR - MOVWZ 0(CNT), CNT0 - MOVWZ 4(CNT), CNT1 - MOVWZ 8(CNT), CNT2 - MOVWZ 12(CNT), CNT3 - - // Adjust vectors for the initial state - VADDUWM K3, K5, K3 - VADDUWM K3, K5, K4 - VADDUWM K4, K5, K5 - - // Synthesized constants - VSPLTISW $-12, TWENTY - VSPLTISW $12, TWELVE - VSPLTISW $-7, TWENTY5 - - VXOR T0, T0, T0 - VSPLTISW $-1, OUTMASK - LVSR (INP)(R0), INPPERM - LVSL (OUT)(R0), OUTPERM - VPERM OUTMASK, T0, OUTPERM, OUTMASK - -loop_outer_vmx: - // Load constant - MOVD $0x61707865, CON0 - MOVD $0x3320646e, CON1 - MOVD $0x79622d32, CON2 - MOVD $0x6b206574, CON3 - - VOR K0, K0, A0 - VOR K0, K0, A1 - VOR K0, K0, A2 - VOR K1, K1, B0 - - MOVD $10, TEMP - - // Load key to GPR - MOVWZ 0(KEY), X4 - MOVWZ 4(KEY), X5 - MOVWZ 8(KEY), X6 - MOVWZ 12(KEY), X7 - VOR K1, K1, B1 - VOR K1, K1, B2 - MOVWZ 16(KEY), X8 - MOVWZ 0(CNT), X12 - MOVWZ 20(KEY), X9 - MOVWZ 4(CNT), X13 - VOR K2, K2, C0 - VOR K2, K2, C1 - MOVWZ 24(KEY), X10 - MOVWZ 8(CNT), X14 - VOR K2, K2, C2 - VOR K3, K3, D0 - MOVWZ 28(KEY), X11 - MOVWZ 12(CNT), X15 - VOR K4, K4, D1 - VOR K5, K5, D2 - - MOVD X4, TMP0 - MOVD X5, TMP1 - MOVD X6, TMP2 - MOVD X7, TMP3 - VSPLTISW $7, SEVEN - - MOVD TEMP, CTR - -loop_vmx: - // CRYPTOGAMS uses a macro to create a loop using perl. This isn't possible - // using assembly macros. Therefore, the macro expansion result was used - // in order to maintain the algorithm efficiency. - // This loop generates three keystream blocks using VMX instructions and, - // in parallel, one keystream block using scalar instructions. - ADD X4, X0, X0 - ADD X5, X1, X1 - VADDUWM A0, B0, A0 - VADDUWM A1, B1, A1 - ADD X6, X2, X2 - ADD X7, X3, X3 - VADDUWM A2, B2, A2 - VXOR D0, A0, D0 - XOR X0, X12, X12 - XOR X1, X13, X13 - VXOR D1, A1, D1 - VXOR D2, A2, D2 - XOR X2, X14, X14 - XOR X3, X15, X15 - VPERM D0, D0, SIXTEEN, D0 - VPERM D1, D1, SIXTEEN, D1 - ROTLW $16, X12, X12 - ROTLW $16, X13, X13 - VPERM D2, D2, SIXTEEN, D2 - VADDUWM C0, D0, C0 - ROTLW $16, X14, X14 - ROTLW $16, X15, X15 - VADDUWM C1, D1, C1 - VADDUWM C2, D2, C2 - ADD X12, X8, X8 - ADD X13, X9, X9 - VXOR B0, C0, T0 - VXOR B1, C1, T1 - ADD X14, X10, X10 - ADD X15, X11, X11 - VXOR B2, C2, T2 - VRLW T0, TWELVE, B0 - XOR X8, X4, X4 - XOR X9, X5, X5 - VRLW T1, TWELVE, B1 - VRLW T2, TWELVE, B2 - XOR X10, X6, X6 - XOR X11, X7, X7 - VADDUWM A0, B0, A0 - VADDUWM A1, B1, A1 - ROTLW $12, X4, X4 - ROTLW $12, X5, X5 - VADDUWM A2, B2, A2 - VXOR D0, A0, D0 - ROTLW $12, X6, X6 - ROTLW $12, X7, X7 - VXOR D1, A1, D1 - VXOR D2, A2, D2 - ADD X4, X0, X0 - ADD X5, X1, X1 - VPERM D0, D0, TWENTY4, D0 - VPERM D1, D1, TWENTY4, D1 - ADD X6, X2, X2 - ADD X7, X3, X3 - VPERM D2, D2, TWENTY4, D2 - VADDUWM C0, D0, C0 - XOR X0, X12, X12 - XOR X1, X13, X13 - VADDUWM C1, D1, C1 - VADDUWM C2, D2, C2 - XOR X2, X14, X14 - XOR X3, X15, X15 - VXOR B0, C0, T0 - VXOR B1, C1, T1 - ROTLW $8, X12, X12 - ROTLW $8, X13, X13 - VXOR B2, C2, T2 - VRLW T0, SEVEN, B0 - ROTLW $8, X14, X14 - ROTLW $8, X15, X15 - VRLW T1, SEVEN, B1 - VRLW T2, SEVEN, B2 - ADD X12, X8, X8 - ADD X13, X9, X9 - VSLDOI $8, C0, C0, C0 - VSLDOI $8, C1, C1, C1 - ADD X14, X10, X10 - ADD X15, X11, X11 - VSLDOI $8, C2, C2, C2 - VSLDOI $12, B0, B0, B0 - XOR X8, X4, X4 - XOR X9, X5, X5 - VSLDOI $12, B1, B1, B1 - VSLDOI $12, B2, B2, B2 - XOR X10, X6, X6 - XOR X11, X7, X7 - VSLDOI $4, D0, D0, D0 - VSLDOI $4, D1, D1, D1 - ROTLW $7, X4, X4 - ROTLW $7, X5, X5 - VSLDOI $4, D2, D2, D2 - VADDUWM A0, B0, A0 - ROTLW $7, X6, X6 - ROTLW $7, X7, X7 - VADDUWM A1, B1, A1 - VADDUWM A2, B2, A2 - ADD X5, X0, X0 - ADD X6, X1, X1 - VXOR D0, A0, D0 - VXOR D1, A1, D1 - ADD X7, X2, X2 - ADD X4, X3, X3 - VXOR D2, A2, D2 - VPERM D0, D0, SIXTEEN, D0 - XOR X0, X15, X15 - XOR X1, X12, X12 - VPERM D1, D1, SIXTEEN, D1 - VPERM D2, D2, SIXTEEN, D2 - XOR X2, X13, X13 - XOR X3, X14, X14 - VADDUWM C0, D0, C0 - VADDUWM C1, D1, C1 - ROTLW $16, X15, X15 - ROTLW $16, X12, X12 - VADDUWM C2, D2, C2 - VXOR B0, C0, T0 - ROTLW $16, X13, X13 - ROTLW $16, X14, X14 - VXOR B1, C1, T1 - VXOR B2, C2, T2 - ADD X15, X10, X10 - ADD X12, X11, X11 - VRLW T0, TWELVE, B0 - VRLW T1, TWELVE, B1 - ADD X13, X8, X8 - ADD X14, X9, X9 - VRLW T2, TWELVE, B2 - VADDUWM A0, B0, A0 - XOR X10, X5, X5 - XOR X11, X6, X6 - VADDUWM A1, B1, A1 - VADDUWM A2, B2, A2 - XOR X8, X7, X7 - XOR X9, X4, X4 - VXOR D0, A0, D0 - VXOR D1, A1, D1 - ROTLW $12, X5, X5 - ROTLW $12, X6, X6 - VXOR D2, A2, D2 - VPERM D0, D0, TWENTY4, D0 - ROTLW $12, X7, X7 - ROTLW $12, X4, X4 - VPERM D1, D1, TWENTY4, D1 - VPERM D2, D2, TWENTY4, D2 - ADD X5, X0, X0 - ADD X6, X1, X1 - VADDUWM C0, D0, C0 - VADDUWM C1, D1, C1 - ADD X7, X2, X2 - ADD X4, X3, X3 - VADDUWM C2, D2, C2 - VXOR B0, C0, T0 - XOR X0, X15, X15 - XOR X1, X12, X12 - VXOR B1, C1, T1 - VXOR B2, C2, T2 - XOR X2, X13, X13 - XOR X3, X14, X14 - VRLW T0, SEVEN, B0 - VRLW T1, SEVEN, B1 - ROTLW $8, X15, X15 - ROTLW $8, X12, X12 - VRLW T2, SEVEN, B2 - VSLDOI $8, C0, C0, C0 - ROTLW $8, X13, X13 - ROTLW $8, X14, X14 - VSLDOI $8, C1, C1, C1 - VSLDOI $8, C2, C2, C2 - ADD X15, X10, X10 - ADD X12, X11, X11 - VSLDOI $4, B0, B0, B0 - VSLDOI $4, B1, B1, B1 - ADD X13, X8, X8 - ADD X14, X9, X9 - VSLDOI $4, B2, B2, B2 - VSLDOI $12, D0, D0, D0 - XOR X10, X5, X5 - XOR X11, X6, X6 - VSLDOI $12, D1, D1, D1 - VSLDOI $12, D2, D2, D2 - XOR X8, X7, X7 - XOR X9, X4, X4 - ROTLW $7, X5, X5 - ROTLW $7, X6, X6 - ROTLW $7, X7, X7 - ROTLW $7, X4, X4 - BC 0x10, 0, loop_vmx - - SUB $256, LEN, LEN - - // Accumulate key block - ADD $0x61707865, X0, X0 - ADD $0x3320646e, X1, X1 - ADD $0x79622d32, X2, X2 - ADD $0x6b206574, X3, X3 - ADD TMP0, X4, X4 - ADD TMP1, X5, X5 - ADD TMP2, X6, X6 - ADD TMP3, X7, X7 - MOVWZ 16(KEY), TMP0 - MOVWZ 20(KEY), TMP1 - MOVWZ 24(KEY), TMP2 - MOVWZ 28(KEY), TMP3 - ADD TMP0, X8, X8 - ADD TMP1, X9, X9 - ADD TMP2, X10, X10 - ADD TMP3, X11, X11 - - MOVWZ 12(CNT), TMP0 - MOVWZ 8(CNT), TMP1 - MOVWZ 4(CNT), TMP2 - MOVWZ 0(CNT), TEMP - ADD TMP0, X15, X15 - ADD TMP1, X14, X14 - ADD TMP2, X13, X13 - ADD TEMP, X12, X12 - - // Accumulate key block - VADDUWM A0, K0, A0 - VADDUWM A1, K0, A1 - VADDUWM A2, K0, A2 - VADDUWM B0, K1, B0 - VADDUWM B1, K1, B1 - VADDUWM B2, K1, B2 - VADDUWM C0, K2, C0 - VADDUWM C1, K2, C1 - VADDUWM C2, K2, C2 - VADDUWM D0, K3, D0 - VADDUWM D1, K4, D1 - VADDUWM D2, K5, D2 - - // Increment counter - ADD $4, TEMP, TEMP - MOVW TEMP, 0(CNT) - - VADDUWM K3, FOUR, K3 - VADDUWM K4, FOUR, K4 - VADDUWM K5, FOUR, K5 - - // XOR the input slice (INP) with the keystream, which is stored in GPRs (X0-X3). - - // Load input (aligned or not) - MOVWZ 0(INP), TMP0 - MOVWZ 4(INP), TMP1 - MOVWZ 8(INP), TMP2 - MOVWZ 12(INP), TMP3 - - // XOR with input - XOR TMP0, X0, X0 - XOR TMP1, X1, X1 - XOR TMP2, X2, X2 - XOR TMP3, X3, X3 - MOVWZ 16(INP), TMP0 - MOVWZ 20(INP), TMP1 - MOVWZ 24(INP), TMP2 - MOVWZ 28(INP), TMP3 - XOR TMP0, X4, X4 - XOR TMP1, X5, X5 - XOR TMP2, X6, X6 - XOR TMP3, X7, X7 - MOVWZ 32(INP), TMP0 - MOVWZ 36(INP), TMP1 - MOVWZ 40(INP), TMP2 - MOVWZ 44(INP), TMP3 - XOR TMP0, X8, X8 - XOR TMP1, X9, X9 - XOR TMP2, X10, X10 - XOR TMP3, X11, X11 - MOVWZ 48(INP), TMP0 - MOVWZ 52(INP), TMP1 - MOVWZ 56(INP), TMP2 - MOVWZ 60(INP), TMP3 - XOR TMP0, X12, X12 - XOR TMP1, X13, X13 - XOR TMP2, X14, X14 - XOR TMP3, X15, X15 - - // Store output (aligned or not) - MOVW X0, 0(OUT) - MOVW X1, 4(OUT) - MOVW X2, 8(OUT) - MOVW X3, 12(OUT) - - ADD $64, INP, INP // INP points to the end of the slice for the alignment code below - - MOVW X4, 16(OUT) - MOVD $16, TMP0 - MOVW X5, 20(OUT) - MOVD $32, TMP1 - MOVW X6, 24(OUT) - MOVD $48, TMP2 - MOVW X7, 28(OUT) - MOVD $64, TMP3 - MOVW X8, 32(OUT) - MOVW X9, 36(OUT) - MOVW X10, 40(OUT) - MOVW X11, 44(OUT) - MOVW X12, 48(OUT) - MOVW X13, 52(OUT) - MOVW X14, 56(OUT) - MOVW X15, 60(OUT) - ADD $64, OUT, OUT - - // Load input - LVX (INP)(R0), DD0 - LVX (INP)(TMP0), DD1 - LVX (INP)(TMP1), DD2 - LVX (INP)(TMP2), DD3 - LVX (INP)(TMP3), DD4 - ADD $64, INP, INP - - VPERM DD1, DD0, INPPERM, DD0 // Align input - VPERM DD2, DD1, INPPERM, DD1 - VPERM DD3, DD2, INPPERM, DD2 - VPERM DD4, DD3, INPPERM, DD3 - VXOR A0, DD0, A0 // XOR with input - VXOR B0, DD1, B0 - LVX (INP)(TMP0), DD1 // Keep loading input - VXOR C0, DD2, C0 - LVX (INP)(TMP1), DD2 - VXOR D0, DD3, D0 - LVX (INP)(TMP2), DD3 - LVX (INP)(TMP3), DD0 - ADD $64, INP, INP - MOVD $63, TMP3 // 63 is not a typo - VPERM A0, A0, OUTPERM, A0 - VPERM B0, B0, OUTPERM, B0 - VPERM C0, C0, OUTPERM, C0 - VPERM D0, D0, OUTPERM, D0 - - VPERM DD1, DD4, INPPERM, DD4 // Align input - VPERM DD2, DD1, INPPERM, DD1 - VPERM DD3, DD2, INPPERM, DD2 - VPERM DD0, DD3, INPPERM, DD3 - VXOR A1, DD4, A1 - VXOR B1, DD1, B1 - LVX (INP)(TMP0), DD1 // Keep loading - VXOR C1, DD2, C1 - LVX (INP)(TMP1), DD2 - VXOR D1, DD3, D1 - LVX (INP)(TMP2), DD3 - - // Note that the LVX address is always rounded down to the nearest 16-byte - // boundary, and that it always points to at most 15 bytes beyond the end of - // the slice, so we cannot cross a page boundary. - LVX (INP)(TMP3), DD4 // Redundant in aligned case. - ADD $64, INP, INP - VPERM A1, A1, OUTPERM, A1 // Pre-misalign output - VPERM B1, B1, OUTPERM, B1 - VPERM C1, C1, OUTPERM, C1 - VPERM D1, D1, OUTPERM, D1 - - VPERM DD1, DD0, INPPERM, DD0 // Align Input - VPERM DD2, DD1, INPPERM, DD1 - VPERM DD3, DD2, INPPERM, DD2 - VPERM DD4, DD3, INPPERM, DD3 - VXOR A2, DD0, A2 - VXOR B2, DD1, B2 - VXOR C2, DD2, C2 - VXOR D2, DD3, D2 - VPERM A2, A2, OUTPERM, A2 - VPERM B2, B2, OUTPERM, B2 - VPERM C2, C2, OUTPERM, C2 - VPERM D2, D2, OUTPERM, D2 - - ANDCC $15, OUT, X1 // Is out aligned? - MOVD OUT, X0 - - VSEL A0, B0, OUTMASK, DD0 // Collect pre-misaligned output - VSEL B0, C0, OUTMASK, DD1 - VSEL C0, D0, OUTMASK, DD2 - VSEL D0, A1, OUTMASK, DD3 - VSEL A1, B1, OUTMASK, B0 - VSEL B1, C1, OUTMASK, C0 - VSEL C1, D1, OUTMASK, D0 - VSEL D1, A2, OUTMASK, A1 - VSEL A2, B2, OUTMASK, B1 - VSEL B2, C2, OUTMASK, C1 - VSEL C2, D2, OUTMASK, D1 - - STVX DD0, (OUT+TMP0) - STVX DD1, (OUT+TMP1) - STVX DD2, (OUT+TMP2) - ADD $64, OUT, OUT - STVX DD3, (OUT+R0) - STVX B0, (OUT+TMP0) - STVX C0, (OUT+TMP1) - STVX D0, (OUT+TMP2) - ADD $64, OUT, OUT - STVX A1, (OUT+R0) - STVX B1, (OUT+TMP0) - STVX C1, (OUT+TMP1) - STVX D1, (OUT+TMP2) - ADD $64, OUT, OUT - - BEQ aligned_vmx - - SUB X1, OUT, X2 // in misaligned case edges - MOVD $0, X3 // are written byte-by-byte - -unaligned_tail_vmx: - STVEBX D2, (X2+X3) - ADD $1, X3, X3 - CMPW X3, X1 - BNE unaligned_tail_vmx - SUB X1, X0, X2 - -unaligned_head_vmx: - STVEBX A0, (X2+X1) - CMPW X1, $15 - ADD $1, X1, X1 - BNE unaligned_head_vmx - - CMPU LEN, $255 // done with 256-byte block yet? - BGT loop_outer_vmx - - JMP done_vmx - -aligned_vmx: - STVX A0, (X0+R0) - CMPU LEN, $255 // done with 256-byte block yet? - BGT loop_outer_vmx - -done_vmx: - RET diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go deleted file mode 100644 index ad74e23a..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_arm64.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.11 -// +build !gccgo - -package chacha20 - -const ( - haveAsm = true - bufSize = 256 -) - -//go:noescape -func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32) - -func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { - - if len(src) >= bufSize { - xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter) - } - - if len(src)%bufSize != 0 { - i := len(src) - len(src)%bufSize - c.buf = [bufSize]byte{} - copy(c.buf[:], src[i:]) - xorKeyStreamVX(c.buf[:], c.buf[:], &c.key, &c.nonce, &c.counter) - c.len = bufSize - copy(dst[i:], c.buf[:len(src)%bufSize]) - } -} diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go deleted file mode 100644 index bf8beba6..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !ppc64le,!arm64,!s390x arm64,!go1.11 gccgo appengine - -package chacha20 - -const ( - bufSize = 64 - haveAsm = false -) - -func (*Cipher) xorKeyStreamAsm(dst, src []byte) { - panic("not implemented") -} diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go deleted file mode 100644 index 638cb5e5..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2019 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 ppc64le,!gccgo,!appengine - -package chacha20 - -import "encoding/binary" - -const ( - bufSize = 256 - haveAsm = true -) - -//go:noescape -func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[8]uint32, counter *uint32) - -func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { - if len(src) >= bufSize { - chaCha20_ctr32_vmx(&dst[0], &src[0], len(src)-len(src)%bufSize, &c.key, &c.counter) - } - if len(src)%bufSize != 0 { - chaCha20_ctr32_vmx(&c.buf[0], &c.buf[0], bufSize, &c.key, &c.counter) - start := len(src) - len(src)%bufSize - ts, td, tb := src[start:], dst[start:], c.buf[:] - // Unroll loop to XOR 32 bytes per iteration. - for i := 0; i < len(ts)-32; i += 32 { - td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination - s0 := binary.LittleEndian.Uint64(ts[0:8]) - s1 := binary.LittleEndian.Uint64(ts[8:16]) - s2 := binary.LittleEndian.Uint64(ts[16:24]) - s3 := binary.LittleEndian.Uint64(ts[24:32]) - b0 := binary.LittleEndian.Uint64(tb[0:8]) - b1 := binary.LittleEndian.Uint64(tb[8:16]) - b2 := binary.LittleEndian.Uint64(tb[16:24]) - b3 := binary.LittleEndian.Uint64(tb[24:32]) - binary.LittleEndian.PutUint64(td[0:8], s0^b0) - binary.LittleEndian.PutUint64(td[8:16], s1^b1) - binary.LittleEndian.PutUint64(td[16:24], s2^b2) - binary.LittleEndian.PutUint64(td[24:32], s3^b3) - ts, td, tb = ts[32:], td[32:], tb[32:] - } - td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination - for i, v := range ts { - td[i] = tb[i] ^ v - } - c.len = bufSize - (len(src) % bufSize) - - } - -} diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go deleted file mode 100644 index aad645b4..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,!gccgo,!appengine - -package chacha20 - -import ( - "golang.org/x/sys/cpu" -) - -var haveAsm = cpu.S390X.HasVX - -const bufSize = 256 - -// xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only -// be called when the vector facility is available. -// Implementation in asm_s390x.s. -//go:noescape -func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32, buf *[256]byte, len *int) - -func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { - xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter, &c.buf, &c.len) -} - -// EXRL targets, DO NOT CALL! -func mvcSrcToBuf() -func mvcBufToDst() diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s deleted file mode 100644 index 57df4044..00000000 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_s390x.s +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,!gccgo,!appengine - -#include "go_asm.h" -#include "textflag.h" - -// This is an implementation of the ChaCha20 encryption algorithm as -// specified in RFC 7539. It uses vector instructions to compute -// 4 keystream blocks in parallel (256 bytes) which are then XORed -// with the bytes in the input slice. - -GLOBL ·constants<>(SB), RODATA|NOPTR, $32 -// BSWAP: swap bytes in each 4-byte element -DATA ·constants<>+0x00(SB)/4, $0x03020100 -DATA ·constants<>+0x04(SB)/4, $0x07060504 -DATA ·constants<>+0x08(SB)/4, $0x0b0a0908 -DATA ·constants<>+0x0c(SB)/4, $0x0f0e0d0c -// J0: [j0, j1, j2, j3] -DATA ·constants<>+0x10(SB)/4, $0x61707865 -DATA ·constants<>+0x14(SB)/4, $0x3320646e -DATA ·constants<>+0x18(SB)/4, $0x79622d32 -DATA ·constants<>+0x1c(SB)/4, $0x6b206574 - -// EXRL targets: -TEXT ·mvcSrcToBuf(SB), NOFRAME|NOSPLIT, $0 - MVC $1, (R1), (R8) - RET - -TEXT ·mvcBufToDst(SB), NOFRAME|NOSPLIT, $0 - MVC $1, (R8), (R9) - RET - -#define BSWAP V5 -#define J0 V6 -#define KEY0 V7 -#define KEY1 V8 -#define NONCE V9 -#define CTR V10 -#define M0 V11 -#define M1 V12 -#define M2 V13 -#define M3 V14 -#define INC V15 -#define X0 V16 -#define X1 V17 -#define X2 V18 -#define X3 V19 -#define X4 V20 -#define X5 V21 -#define X6 V22 -#define X7 V23 -#define X8 V24 -#define X9 V25 -#define X10 V26 -#define X11 V27 -#define X12 V28 -#define X13 V29 -#define X14 V30 -#define X15 V31 - -#define NUM_ROUNDS 20 - -#define ROUND4(a0, a1, a2, a3, b0, b1, b2, b3, c0, c1, c2, c3, d0, d1, d2, d3) \ - VAF a1, a0, a0 \ - VAF b1, b0, b0 \ - VAF c1, c0, c0 \ - VAF d1, d0, d0 \ - VX a0, a2, a2 \ - VX b0, b2, b2 \ - VX c0, c2, c2 \ - VX d0, d2, d2 \ - VERLLF $16, a2, a2 \ - VERLLF $16, b2, b2 \ - VERLLF $16, c2, c2 \ - VERLLF $16, d2, d2 \ - VAF a2, a3, a3 \ - VAF b2, b3, b3 \ - VAF c2, c3, c3 \ - VAF d2, d3, d3 \ - VX a3, a1, a1 \ - VX b3, b1, b1 \ - VX c3, c1, c1 \ - VX d3, d1, d1 \ - VERLLF $12, a1, a1 \ - VERLLF $12, b1, b1 \ - VERLLF $12, c1, c1 \ - VERLLF $12, d1, d1 \ - VAF a1, a0, a0 \ - VAF b1, b0, b0 \ - VAF c1, c0, c0 \ - VAF d1, d0, d0 \ - VX a0, a2, a2 \ - VX b0, b2, b2 \ - VX c0, c2, c2 \ - VX d0, d2, d2 \ - VERLLF $8, a2, a2 \ - VERLLF $8, b2, b2 \ - VERLLF $8, c2, c2 \ - VERLLF $8, d2, d2 \ - VAF a2, a3, a3 \ - VAF b2, b3, b3 \ - VAF c2, c3, c3 \ - VAF d2, d3, d3 \ - VX a3, a1, a1 \ - VX b3, b1, b1 \ - VX c3, c1, c1 \ - VX d3, d1, d1 \ - VERLLF $7, a1, a1 \ - VERLLF $7, b1, b1 \ - VERLLF $7, c1, c1 \ - VERLLF $7, d1, d1 - -#define PERMUTE(mask, v0, v1, v2, v3) \ - VPERM v0, v0, mask, v0 \ - VPERM v1, v1, mask, v1 \ - VPERM v2, v2, mask, v2 \ - VPERM v3, v3, mask, v3 - -#define ADDV(x, v0, v1, v2, v3) \ - VAF x, v0, v0 \ - VAF x, v1, v1 \ - VAF x, v2, v2 \ - VAF x, v3, v3 - -#define XORV(off, dst, src, v0, v1, v2, v3) \ - VLM off(src), M0, M3 \ - PERMUTE(BSWAP, v0, v1, v2, v3) \ - VX v0, M0, M0 \ - VX v1, M1, M1 \ - VX v2, M2, M2 \ - VX v3, M3, M3 \ - VSTM M0, M3, off(dst) - -#define SHUFFLE(a, b, c, d, t, u, v, w) \ - VMRHF a, c, t \ // t = {a[0], c[0], a[1], c[1]} - VMRHF b, d, u \ // u = {b[0], d[0], b[1], d[1]} - VMRLF a, c, v \ // v = {a[2], c[2], a[3], c[3]} - VMRLF b, d, w \ // w = {b[2], d[2], b[3], d[3]} - VMRHF t, u, a \ // a = {a[0], b[0], c[0], d[0]} - VMRLF t, u, b \ // b = {a[1], b[1], c[1], d[1]} - VMRHF v, w, c \ // c = {a[2], b[2], c[2], d[2]} - VMRLF v, w, d // d = {a[3], b[3], c[3], d[3]} - -// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32, buf *[256]byte, len *int) -TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0 - MOVD $·constants<>(SB), R1 - MOVD dst+0(FP), R2 // R2=&dst[0] - LMG src+24(FP), R3, R4 // R3=&src[0] R4=len(src) - MOVD key+48(FP), R5 // R5=key - MOVD nonce+56(FP), R6 // R6=nonce - MOVD counter+64(FP), R7 // R7=counter - MOVD buf+72(FP), R8 // R8=buf - MOVD len+80(FP), R9 // R9=len - - // load BSWAP and J0 - VLM (R1), BSWAP, J0 - - // set up tail buffer - ADD $-1, R4, R12 - MOVBZ R12, R12 - CMPUBEQ R12, $255, aligned - MOVD R4, R1 - AND $~255, R1 - MOVD $(R3)(R1*1), R1 - EXRL $·mvcSrcToBuf(SB), R12 - MOVD $255, R0 - SUB R12, R0 - MOVD R0, (R9) // update len - -aligned: - // setup - MOVD $95, R0 - VLM (R5), KEY0, KEY1 - VLL R0, (R6), NONCE - VZERO M0 - VLEIB $7, $32, M0 - VSRLB M0, NONCE, NONCE - - // initialize counter values - VLREPF (R7), CTR - VZERO INC - VLEIF $1, $1, INC - VLEIF $2, $2, INC - VLEIF $3, $3, INC - VAF INC, CTR, CTR - VREPIF $4, INC - -chacha: - VREPF $0, J0, X0 - VREPF $1, J0, X1 - VREPF $2, J0, X2 - VREPF $3, J0, X3 - VREPF $0, KEY0, X4 - VREPF $1, KEY0, X5 - VREPF $2, KEY0, X6 - VREPF $3, KEY0, X7 - VREPF $0, KEY1, X8 - VREPF $1, KEY1, X9 - VREPF $2, KEY1, X10 - VREPF $3, KEY1, X11 - VLR CTR, X12 - VREPF $1, NONCE, X13 - VREPF $2, NONCE, X14 - VREPF $3, NONCE, X15 - - MOVD $(NUM_ROUNDS/2), R1 - -loop: - ROUND4(X0, X4, X12, X8, X1, X5, X13, X9, X2, X6, X14, X10, X3, X7, X15, X11) - ROUND4(X0, X5, X15, X10, X1, X6, X12, X11, X2, X7, X13, X8, X3, X4, X14, X9) - - ADD $-1, R1 - BNE loop - - // decrement length - ADD $-256, R4 - BLT tail - -continue: - // rearrange vectors - SHUFFLE(X0, X1, X2, X3, M0, M1, M2, M3) - ADDV(J0, X0, X1, X2, X3) - SHUFFLE(X4, X5, X6, X7, M0, M1, M2, M3) - ADDV(KEY0, X4, X5, X6, X7) - SHUFFLE(X8, X9, X10, X11, M0, M1, M2, M3) - ADDV(KEY1, X8, X9, X10, X11) - VAF CTR, X12, X12 - SHUFFLE(X12, X13, X14, X15, M0, M1, M2, M3) - ADDV(NONCE, X12, X13, X14, X15) - - // increment counters - VAF INC, CTR, CTR - - // xor keystream with plaintext - XORV(0*64, R2, R3, X0, X4, X8, X12) - XORV(1*64, R2, R3, X1, X5, X9, X13) - XORV(2*64, R2, R3, X2, X6, X10, X14) - XORV(3*64, R2, R3, X3, X7, X11, X15) - - // increment pointers - MOVD $256(R2), R2 - MOVD $256(R3), R3 - - CMPBNE R4, $0, chacha - CMPUBEQ R12, $255, return - EXRL $·mvcBufToDst(SB), R12 // len was updated during setup - -return: - VSTEF $0, CTR, (R7) - RET - -tail: - MOVD R2, R9 - MOVD R8, R2 - MOVD R8, R3 - MOVD $0, R4 - JMP continue diff --git a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/poly1305/mac_noasm.go deleted file mode 100644 index a8dd589a..00000000 --- a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64,!ppc64le gccgo appengine - -package poly1305 - -type mac struct{ macGeneric } - -func newMAC(key *[32]byte) mac { return mac{newMACGeneric(key)} } diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305.go b/vendor/golang.org/x/crypto/poly1305/poly1305.go deleted file mode 100644 index d076a562..00000000 --- a/vendor/golang.org/x/crypto/poly1305/poly1305.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package poly1305 implements Poly1305 one-time message authentication code as -// specified in https://cr.yp.to/mac/poly1305-20050329.pdf. -// -// Poly1305 is a fast, one-time authentication function. It is infeasible for an -// attacker to generate an authenticator for a message without the key. However, a -// key must only be used for a single message. Authenticating two different -// messages with the same key allows an attacker to forge authenticators for other -// messages with the same key. -// -// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was -// used with a fixed key in order to generate one-time keys from an nonce. -// However, in this package AES isn't used and the one-time key is specified -// directly. -package poly1305 // import "golang.org/x/crypto/poly1305" - -import "crypto/subtle" - -// TagSize is the size, in bytes, of a poly1305 authenticator. -const TagSize = 16 - -// Verify returns true if mac is a valid authenticator for m with the given -// key. -func Verify(mac *[16]byte, m []byte, key *[32]byte) bool { - var tmp [16]byte - Sum(&tmp, m, key) - return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1 -} - -// New returns a new MAC computing an authentication -// tag of all data written to it with the given key. -// This allows writing the message progressively instead -// of passing it as a single slice. Common users should use -// the Sum function instead. -// -// The key must be unique for each message, as authenticating -// two different messages with the same key allows an attacker -// to forge messages at will. -func New(key *[32]byte) *MAC { - return &MAC{ - mac: newMAC(key), - finalized: false, - } -} - -// MAC is an io.Writer computing an authentication tag -// of the data written to it. -// -// MAC cannot be used like common hash.Hash implementations, -// because using a poly1305 key twice breaks its security. -// Therefore writing data to a running MAC after calling -// Sum causes it to panic. -type MAC struct { - mac // platform-dependent implementation - - finalized bool -} - -// Size returns the number of bytes Sum will return. -func (h *MAC) Size() int { return TagSize } - -// Write adds more data to the running message authentication code. -// It never returns an error. -// -// It must not be called after the first call of Sum. -func (h *MAC) Write(p []byte) (n int, err error) { - if h.finalized { - panic("poly1305: write to MAC after Sum") - } - return h.mac.Write(p) -} - -// Sum computes the authenticator of all data written to the -// message authentication code. -func (h *MAC) Sum(b []byte) []byte { - var mac [TagSize]byte - h.mac.Sum(&mac) - h.finalized = true - return append(b, mac[:]...) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/poly1305/sum_amd64.go deleted file mode 100644 index 2dbf42aa..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2012 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 amd64,!gccgo,!appengine - -package poly1305 - -//go:noescape -func initialize(state *[7]uint64, key *[32]byte) - -//go:noescape -func update(state *[7]uint64, msg []byte) - -//go:noescape -func finalize(tag *[TagSize]byte, state *[7]uint64) - -// Sum generates an authenticator for m using a one-time key and puts the -// 16-byte result into out. Authenticating two different messages with the same -// key allows an attacker to forge messages at will. -func Sum(out *[16]byte, m []byte, key *[32]byte) { - h := newMAC(key) - h.Write(m) - h.Sum(out) -} - -func newMAC(key *[32]byte) (h mac) { - initialize(&h.state, key) - return -} - -type mac struct { - state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 } - - buffer [TagSize]byte - offset int -} - -func (h *mac) Write(p []byte) (n int, err error) { - n = len(p) - if h.offset > 0 { - remaining := TagSize - h.offset - if n < remaining { - h.offset += copy(h.buffer[h.offset:], p) - return n, nil - } - copy(h.buffer[h.offset:], p[:remaining]) - p = p[remaining:] - h.offset = 0 - update(&h.state, h.buffer[:]) - } - if nn := len(p) - (len(p) % TagSize); nn > 0 { - update(&h.state, p[:nn]) - p = p[nn:] - } - if len(p) > 0 { - h.offset += copy(h.buffer[h.offset:], p) - } - return n, nil -} - -func (h *mac) Sum(out *[16]byte) { - state := h.state - if h.offset > 0 { - update(&state, h.buffer[:h.offset]) - } - finalize(out, &state) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/poly1305/sum_amd64.s deleted file mode 100644 index 7d600f13..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2012 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 amd64,!gccgo,!appengine - -#include "textflag.h" - -#define POLY1305_ADD(msg, h0, h1, h2) \ - ADDQ 0(msg), h0; \ - ADCQ 8(msg), h1; \ - ADCQ $1, h2; \ - LEAQ 16(msg), msg - -#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3) \ - MOVQ r0, AX; \ - MULQ h0; \ - MOVQ AX, t0; \ - MOVQ DX, t1; \ - MOVQ r0, AX; \ - MULQ h1; \ - ADDQ AX, t1; \ - ADCQ $0, DX; \ - MOVQ r0, t2; \ - IMULQ h2, t2; \ - ADDQ DX, t2; \ - \ - MOVQ r1, AX; \ - MULQ h0; \ - ADDQ AX, t1; \ - ADCQ $0, DX; \ - MOVQ DX, h0; \ - MOVQ r1, t3; \ - IMULQ h2, t3; \ - MOVQ r1, AX; \ - MULQ h1; \ - ADDQ AX, t2; \ - ADCQ DX, t3; \ - ADDQ h0, t2; \ - ADCQ $0, t3; \ - \ - MOVQ t0, h0; \ - MOVQ t1, h1; \ - MOVQ t2, h2; \ - ANDQ $3, h2; \ - MOVQ t2, t0; \ - ANDQ $0xFFFFFFFFFFFFFFFC, t0; \ - ADDQ t0, h0; \ - ADCQ t3, h1; \ - ADCQ $0, h2; \ - SHRQ $2, t3, t2; \ - SHRQ $2, t3; \ - ADDQ t2, h0; \ - ADCQ t3, h1; \ - ADCQ $0, h2 - -DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF -DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC -GLOBL ·poly1305Mask<>(SB), RODATA, $16 - -// func update(state *[7]uint64, msg []byte) -TEXT ·update(SB), $0-32 - MOVQ state+0(FP), DI - MOVQ msg_base+8(FP), SI - MOVQ msg_len+16(FP), R15 - - MOVQ 0(DI), R8 // h0 - MOVQ 8(DI), R9 // h1 - MOVQ 16(DI), R10 // h2 - MOVQ 24(DI), R11 // r0 - MOVQ 32(DI), R12 // r1 - - CMPQ R15, $16 - JB bytes_between_0_and_15 - -loop: - POLY1305_ADD(SI, R8, R9, R10) - -multiply: - POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14) - SUBQ $16, R15 - CMPQ R15, $16 - JAE loop - -bytes_between_0_and_15: - TESTQ R15, R15 - JZ done - MOVQ $1, BX - XORQ CX, CX - XORQ R13, R13 - ADDQ R15, SI - -flush_buffer: - SHLQ $8, BX, CX - SHLQ $8, BX - MOVB -1(SI), R13 - XORQ R13, BX - DECQ SI - DECQ R15 - JNZ flush_buffer - - ADDQ BX, R8 - ADCQ CX, R9 - ADCQ $0, R10 - MOVQ $16, R15 - JMP multiply - -done: - MOVQ R8, 0(DI) - MOVQ R9, 8(DI) - MOVQ R10, 16(DI) - RET - -// func initialize(state *[7]uint64, key *[32]byte) -TEXT ·initialize(SB), $0-16 - MOVQ state+0(FP), DI - MOVQ key+8(FP), SI - - // state[0...7] is initialized with zero - MOVOU 0(SI), X0 - MOVOU 16(SI), X1 - MOVOU ·poly1305Mask<>(SB), X2 - PAND X2, X0 - MOVOU X0, 24(DI) - MOVOU X1, 40(DI) - RET - -// func finalize(tag *[TagSize]byte, state *[7]uint64) -TEXT ·finalize(SB), $0-16 - MOVQ tag+0(FP), DI - MOVQ state+8(FP), SI - - MOVQ 0(SI), AX - MOVQ 8(SI), BX - MOVQ 16(SI), CX - MOVQ AX, R8 - MOVQ BX, R9 - SUBQ $0xFFFFFFFFFFFFFFFB, AX - SBBQ $0xFFFFFFFFFFFFFFFF, BX - SBBQ $3, CX - CMOVQCS R8, AX - CMOVQCS R9, BX - ADDQ 40(SI), AX - ADCQ 48(SI), BX - - MOVQ AX, 0(DI) - MOVQ BX, 8(DI) - RET diff --git a/vendor/golang.org/x/crypto/poly1305/sum_generic.go b/vendor/golang.org/x/crypto/poly1305/sum_generic.go deleted file mode 100644 index bab76ef0..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_generic.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package poly1305 - -import "encoding/binary" - -const ( - msgBlock = uint32(1 << 24) - finalBlock = uint32(0) -) - -// sumGeneric generates an authenticator for msg using a one-time key and -// puts the 16-byte result into out. This is the generic implementation of -// Sum and should be called if no assembly implementation is available. -func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) { - h := newMACGeneric(key) - h.Write(msg) - h.Sum(out) -} - -func newMACGeneric(key *[32]byte) (h macGeneric) { - h.r[0] = binary.LittleEndian.Uint32(key[0:]) & 0x3ffffff - h.r[1] = (binary.LittleEndian.Uint32(key[3:]) >> 2) & 0x3ffff03 - h.r[2] = (binary.LittleEndian.Uint32(key[6:]) >> 4) & 0x3ffc0ff - h.r[3] = (binary.LittleEndian.Uint32(key[9:]) >> 6) & 0x3f03fff - h.r[4] = (binary.LittleEndian.Uint32(key[12:]) >> 8) & 0x00fffff - - h.s[0] = binary.LittleEndian.Uint32(key[16:]) - h.s[1] = binary.LittleEndian.Uint32(key[20:]) - h.s[2] = binary.LittleEndian.Uint32(key[24:]) - h.s[3] = binary.LittleEndian.Uint32(key[28:]) - return -} - -type macGeneric struct { - h, r [5]uint32 - s [4]uint32 - - buffer [TagSize]byte - offset int -} - -func (h *macGeneric) Write(p []byte) (n int, err error) { - n = len(p) - if h.offset > 0 { - remaining := TagSize - h.offset - if n < remaining { - h.offset += copy(h.buffer[h.offset:], p) - return n, nil - } - copy(h.buffer[h.offset:], p[:remaining]) - p = p[remaining:] - h.offset = 0 - updateGeneric(h.buffer[:], msgBlock, &(h.h), &(h.r)) - } - if nn := len(p) - (len(p) % TagSize); nn > 0 { - updateGeneric(p, msgBlock, &(h.h), &(h.r)) - p = p[nn:] - } - if len(p) > 0 { - h.offset += copy(h.buffer[h.offset:], p) - } - return n, nil -} - -func (h *macGeneric) Sum(out *[16]byte) { - H, R := h.h, h.r - if h.offset > 0 { - var buffer [TagSize]byte - copy(buffer[:], h.buffer[:h.offset]) - buffer[h.offset] = 1 // invariant: h.offset < TagSize - updateGeneric(buffer[:], finalBlock, &H, &R) - } - finalizeGeneric(out, &H, &(h.s)) -} - -func updateGeneric(msg []byte, flag uint32, h, r *[5]uint32) { - h0, h1, h2, h3, h4 := h[0], h[1], h[2], h[3], h[4] - r0, r1, r2, r3, r4 := uint64(r[0]), uint64(r[1]), uint64(r[2]), uint64(r[3]), uint64(r[4]) - R1, R2, R3, R4 := r1*5, r2*5, r3*5, r4*5 - - for len(msg) >= TagSize { - // h += msg - h0 += binary.LittleEndian.Uint32(msg[0:]) & 0x3ffffff - h1 += (binary.LittleEndian.Uint32(msg[3:]) >> 2) & 0x3ffffff - h2 += (binary.LittleEndian.Uint32(msg[6:]) >> 4) & 0x3ffffff - h3 += (binary.LittleEndian.Uint32(msg[9:]) >> 6) & 0x3ffffff - h4 += (binary.LittleEndian.Uint32(msg[12:]) >> 8) | flag - - // h *= r - d0 := (uint64(h0) * r0) + (uint64(h1) * R4) + (uint64(h2) * R3) + (uint64(h3) * R2) + (uint64(h4) * R1) - d1 := (d0 >> 26) + (uint64(h0) * r1) + (uint64(h1) * r0) + (uint64(h2) * R4) + (uint64(h3) * R3) + (uint64(h4) * R2) - d2 := (d1 >> 26) + (uint64(h0) * r2) + (uint64(h1) * r1) + (uint64(h2) * r0) + (uint64(h3) * R4) + (uint64(h4) * R3) - d3 := (d2 >> 26) + (uint64(h0) * r3) + (uint64(h1) * r2) + (uint64(h2) * r1) + (uint64(h3) * r0) + (uint64(h4) * R4) - d4 := (d3 >> 26) + (uint64(h0) * r4) + (uint64(h1) * r3) + (uint64(h2) * r2) + (uint64(h3) * r1) + (uint64(h4) * r0) - - // h %= p - h0 = uint32(d0) & 0x3ffffff - h1 = uint32(d1) & 0x3ffffff - h2 = uint32(d2) & 0x3ffffff - h3 = uint32(d3) & 0x3ffffff - h4 = uint32(d4) & 0x3ffffff - - h0 += uint32(d4>>26) * 5 - h1 += h0 >> 26 - h0 = h0 & 0x3ffffff - - msg = msg[TagSize:] - } - - h[0], h[1], h[2], h[3], h[4] = h0, h1, h2, h3, h4 -} - -func finalizeGeneric(out *[TagSize]byte, h *[5]uint32, s *[4]uint32) { - h0, h1, h2, h3, h4 := h[0], h[1], h[2], h[3], h[4] - - // h %= p reduction - h2 += h1 >> 26 - h1 &= 0x3ffffff - h3 += h2 >> 26 - h2 &= 0x3ffffff - h4 += h3 >> 26 - h3 &= 0x3ffffff - h0 += 5 * (h4 >> 26) - h4 &= 0x3ffffff - h1 += h0 >> 26 - h0 &= 0x3ffffff - - // h - p - t0 := h0 + 5 - t1 := h1 + (t0 >> 26) - t2 := h2 + (t1 >> 26) - t3 := h3 + (t2 >> 26) - t4 := h4 + (t3 >> 26) - (1 << 26) - t0 &= 0x3ffffff - t1 &= 0x3ffffff - t2 &= 0x3ffffff - t3 &= 0x3ffffff - - // select h if h < p else h - p - t_mask := (t4 >> 31) - 1 - h_mask := ^t_mask - h0 = (h0 & h_mask) | (t0 & t_mask) - h1 = (h1 & h_mask) | (t1 & t_mask) - h2 = (h2 & h_mask) | (t2 & t_mask) - h3 = (h3 & h_mask) | (t3 & t_mask) - h4 = (h4 & h_mask) | (t4 & t_mask) - - // h %= 2^128 - h0 |= h1 << 26 - h1 = ((h1 >> 6) | (h2 << 20)) - h2 = ((h2 >> 12) | (h3 << 14)) - h3 = ((h3 >> 18) | (h4 << 8)) - - // s: the s part of the key - // tag = (h + s) % (2^128) - t := uint64(h0) + uint64(s[0]) - h0 = uint32(t) - t = uint64(h1) + uint64(s[1]) + (t >> 32) - h1 = uint32(t) - t = uint64(h2) + uint64(s[2]) + (t >> 32) - h2 = uint32(t) - t = uint64(h3) + uint64(s[3]) + (t >> 32) - h3 = uint32(t) - - binary.LittleEndian.PutUint32(out[0:], h0) - binary.LittleEndian.PutUint32(out[4:], h1) - binary.LittleEndian.PutUint32(out[8:], h2) - binary.LittleEndian.PutUint32(out[12:], h3) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go deleted file mode 100644 index 8a9c2070..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,!go1.11 !arm,!amd64,!s390x,!ppc64le gccgo appengine nacl - -package poly1305 - -// Sum generates an authenticator for msg using a one-time key and puts the -// 16-byte result into out. Authenticating two different messages with the same -// key allows an attacker to forge messages at will. -func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) { - h := newMAC(key) - h.Write(msg) - h.Sum(out) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go deleted file mode 100644 index 2402b637..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2019 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 ppc64le,!gccgo,!appengine - -package poly1305 - -//go:noescape -func initialize(state *[7]uint64, key *[32]byte) - -//go:noescape -func update(state *[7]uint64, msg []byte) - -//go:noescape -func finalize(tag *[TagSize]byte, state *[7]uint64) - -// Sum generates an authenticator for m using a one-time key and puts the -// 16-byte result into out. Authenticating two different messages with the same -// key allows an attacker to forge messages at will. -func Sum(out *[16]byte, m []byte, key *[32]byte) { - h := newMAC(key) - h.Write(m) - h.Sum(out) -} - -func newMAC(key *[32]byte) (h mac) { - initialize(&h.state, key) - return -} - -type mac struct { - state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 } - - buffer [TagSize]byte - offset int -} - -func (h *mac) Write(p []byte) (n int, err error) { - n = len(p) - if h.offset > 0 { - remaining := TagSize - h.offset - if n < remaining { - h.offset += copy(h.buffer[h.offset:], p) - return n, nil - } - copy(h.buffer[h.offset:], p[:remaining]) - p = p[remaining:] - h.offset = 0 - update(&h.state, h.buffer[:]) - } - if nn := len(p) - (len(p) % TagSize); nn > 0 { - update(&h.state, p[:nn]) - p = p[nn:] - } - if len(p) > 0 { - h.offset += copy(h.buffer[h.offset:], p) - } - return n, nil -} - -func (h *mac) Sum(out *[16]byte) { - state := h.state - if h.offset > 0 { - update(&state, h.buffer[:h.offset]) - } - finalize(out, &state) -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s deleted file mode 100644 index 55c7167e..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2019 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 ppc64le,!gccgo,!appengine - -#include "textflag.h" - -// This was ported from the amd64 implementation. - -#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \ - MOVD (msg), t0; \ - MOVD 8(msg), t1; \ - MOVD $1, t2; \ - ADDC t0, h0, h0; \ - ADDE t1, h1, h1; \ - ADDE t2, h2; \ - ADD $16, msg - -#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \ - MULLD r0, h0, t0; \ - MULLD r0, h1, t4; \ - MULHDU r0, h0, t1; \ - MULHDU r0, h1, t5; \ - ADDC t4, t1, t1; \ - MULLD r0, h2, t2; \ - ADDZE t5; \ - MULHDU r1, h0, t4; \ - MULLD r1, h0, h0; \ - ADD t5, t2, t2; \ - ADDC h0, t1, t1; \ - MULLD h2, r1, t3; \ - ADDZE t4, h0; \ - MULHDU r1, h1, t5; \ - MULLD r1, h1, t4; \ - ADDC t4, t2, t2; \ - ADDE t5, t3, t3; \ - ADDC h0, t2, t2; \ - MOVD $-4, t4; \ - MOVD t0, h0; \ - MOVD t1, h1; \ - ADDZE t3; \ - ANDCC $3, t2, h2; \ - AND t2, t4, t0; \ - ADDC t0, h0, h0; \ - ADDE t3, h1, h1; \ - SLD $62, t3, t4; \ - SRD $2, t2; \ - ADDZE h2; \ - OR t4, t2, t2; \ - SRD $2, t3; \ - ADDC t2, h0, h0; \ - ADDE t3, h1, h1; \ - ADDZE h2 - -DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF -DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC -GLOBL ·poly1305Mask<>(SB), RODATA, $16 - -// func update(state *[7]uint64, msg []byte) - -TEXT ·update(SB), $0-32 - MOVD state+0(FP), R3 - MOVD msg_base+8(FP), R4 - MOVD msg_len+16(FP), R5 - - MOVD 0(R3), R8 // h0 - MOVD 8(R3), R9 // h1 - MOVD 16(R3), R10 // h2 - MOVD 24(R3), R11 // r0 - MOVD 32(R3), R12 // r1 - - CMP R5, $16 - BLT bytes_between_0_and_15 - -loop: - POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22) - -multiply: - POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21) - ADD $-16, R5 - CMP R5, $16 - BGE loop - -bytes_between_0_and_15: - CMP $0, R5 - BEQ done - MOVD $0, R16 // h0 - MOVD $0, R17 // h1 - -flush_buffer: - CMP R5, $8 - BLE just1 - - MOVD $8, R21 - SUB R21, R5, R21 - - // Greater than 8 -- load the rightmost remaining bytes in msg - // and put into R17 (h1) - MOVD (R4)(R21), R17 - MOVD $16, R22 - - // Find the offset to those bytes - SUB R5, R22, R22 - SLD $3, R22 - - // Shift to get only the bytes in msg - SRD R22, R17, R17 - - // Put 1 at high end - MOVD $1, R23 - SLD $3, R21 - SLD R21, R23, R23 - OR R23, R17, R17 - - // Remainder is 8 - MOVD $8, R5 - -just1: - CMP R5, $8 - BLT less8 - - // Exactly 8 - MOVD (R4), R16 - - CMP $0, R17 - - // Check if we've already set R17; if not - // set 1 to indicate end of msg. - BNE carry - MOVD $1, R17 - BR carry - -less8: - MOVD $0, R16 // h0 - MOVD $0, R22 // shift count - CMP R5, $4 - BLT less4 - MOVWZ (R4), R16 - ADD $4, R4 - ADD $-4, R5 - MOVD $32, R22 - -less4: - CMP R5, $2 - BLT less2 - MOVHZ (R4), R21 - SLD R22, R21, R21 - OR R16, R21, R16 - ADD $16, R22 - ADD $-2, R5 - ADD $2, R4 - -less2: - CMP $0, R5 - BEQ insert1 - MOVBZ (R4), R21 - SLD R22, R21, R21 - OR R16, R21, R16 - ADD $8, R22 - -insert1: - // Insert 1 at end of msg - MOVD $1, R21 - SLD R22, R21, R21 - OR R16, R21, R16 - -carry: - // Add new values to h0, h1, h2 - ADDC R16, R8 - ADDE R17, R9 - ADDE $0, R10 - MOVD $16, R5 - ADD R5, R4 - BR multiply - -done: - // Save h0, h1, h2 in state - MOVD R8, 0(R3) - MOVD R9, 8(R3) - MOVD R10, 16(R3) - RET - -// func initialize(state *[7]uint64, key *[32]byte) -TEXT ·initialize(SB), $0-16 - MOVD state+0(FP), R3 - MOVD key+8(FP), R4 - - // state[0...7] is initialized with zero - // Load key - MOVD 0(R4), R5 - MOVD 8(R4), R6 - MOVD 16(R4), R7 - MOVD 24(R4), R8 - - // Address of key mask - MOVD $·poly1305Mask<>(SB), R9 - - // Save original key in state - MOVD R7, 40(R3) - MOVD R8, 48(R3) - - // Get mask - MOVD (R9), R7 - MOVD 8(R9), R8 - - // And with key - AND R5, R7, R5 - AND R6, R8, R6 - - // Save masked key in state - MOVD R5, 24(R3) - MOVD R6, 32(R3) - RET - -// func finalize(tag *[TagSize]byte, state *[7]uint64) -TEXT ·finalize(SB), $0-16 - MOVD tag+0(FP), R3 - MOVD state+8(FP), R4 - - // Get h0, h1, h2 from state - MOVD 0(R4), R5 - MOVD 8(R4), R6 - MOVD 16(R4), R7 - - // Save h0, h1 - MOVD R5, R8 - MOVD R6, R9 - MOVD $3, R20 - MOVD $-1, R21 - SUBC $-5, R5 - SUBE R21, R6 - SUBE R20, R7 - MOVD $0, R21 - SUBZE R21 - - // Check for carry - CMP $0, R21 - ISEL $2, R5, R8, R5 - ISEL $2, R6, R9, R6 - MOVD 40(R4), R8 - MOVD 48(R4), R9 - ADDC R8, R5 - ADDE R9, R6 - MOVD R5, 0(R3) - MOVD R6, 8(R3) - RET diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/poly1305/sum_s390x.go deleted file mode 100644 index ec99e07e..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,go1.11,!gccgo,!appengine - -package poly1305 - -import ( - "golang.org/x/sys/cpu" -) - -// poly1305vx is an assembly implementation of Poly1305 that uses vector -// instructions. It must only be called if the vector facility (vx) is -// available. -//go:noescape -func poly1305vx(out *[16]byte, m *byte, mlen uint64, key *[32]byte) - -// poly1305vmsl is an assembly implementation of Poly1305 that uses vector -// instructions, including VMSL. It must only be called if the vector facility (vx) is -// available and if VMSL is supported. -//go:noescape -func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]byte) - -// Sum generates an authenticator for m using a one-time key and puts the -// 16-byte result into out. Authenticating two different messages with the same -// key allows an attacker to forge messages at will. -func Sum(out *[16]byte, m []byte, key *[32]byte) { - if cpu.S390X.HasVX { - var mPtr *byte - if len(m) > 0 { - mPtr = &m[0] - } - if cpu.S390X.HasVXE && len(m) > 256 { - poly1305vmsl(out, mPtr, uint64(len(m)), key) - } else { - poly1305vx(out, mPtr, uint64(len(m)), key) - } - } else { - sumGeneric(out, m, key) - } -} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_s390x.s deleted file mode 100644 index ca5a309d..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,go1.11,!gccgo,!appengine - -#include "textflag.h" - -// Implementation of Poly1305 using the vector facility (vx). - -// constants -#define MOD26 V0 -#define EX0 V1 -#define EX1 V2 -#define EX2 V3 - -// temporaries -#define T_0 V4 -#define T_1 V5 -#define T_2 V6 -#define T_3 V7 -#define T_4 V8 - -// key (r) -#define R_0 V9 -#define R_1 V10 -#define R_2 V11 -#define R_3 V12 -#define R_4 V13 -#define R5_1 V14 -#define R5_2 V15 -#define R5_3 V16 -#define R5_4 V17 -#define RSAVE_0 R5 -#define RSAVE_1 R6 -#define RSAVE_2 R7 -#define RSAVE_3 R8 -#define RSAVE_4 R9 -#define R5SAVE_1 V28 -#define R5SAVE_2 V29 -#define R5SAVE_3 V30 -#define R5SAVE_4 V31 - -// message block -#define F_0 V18 -#define F_1 V19 -#define F_2 V20 -#define F_3 V21 -#define F_4 V22 - -// accumulator -#define H_0 V23 -#define H_1 V24 -#define H_2 V25 -#define H_3 V26 -#define H_4 V27 - -GLOBL ·keyMask<>(SB), RODATA, $16 -DATA ·keyMask<>+0(SB)/8, $0xffffff0ffcffff0f -DATA ·keyMask<>+8(SB)/8, $0xfcffff0ffcffff0f - -GLOBL ·bswapMask<>(SB), RODATA, $16 -DATA ·bswapMask<>+0(SB)/8, $0x0f0e0d0c0b0a0908 -DATA ·bswapMask<>+8(SB)/8, $0x0706050403020100 - -GLOBL ·constants<>(SB), RODATA, $64 -// MOD26 -DATA ·constants<>+0(SB)/8, $0x3ffffff -DATA ·constants<>+8(SB)/8, $0x3ffffff -// EX0 -DATA ·constants<>+16(SB)/8, $0x0006050403020100 -DATA ·constants<>+24(SB)/8, $0x1016151413121110 -// EX1 -DATA ·constants<>+32(SB)/8, $0x060c0b0a09080706 -DATA ·constants<>+40(SB)/8, $0x161c1b1a19181716 -// EX2 -DATA ·constants<>+48(SB)/8, $0x0d0d0d0d0d0f0e0d -DATA ·constants<>+56(SB)/8, $0x1d1d1d1d1d1f1e1d - -// h = (f*g) % (2**130-5) [partial reduction] -#define MULTIPLY(f0, f1, f2, f3, f4, g0, g1, g2, g3, g4, g51, g52, g53, g54, h0, h1, h2, h3, h4) \ - VMLOF f0, g0, h0 \ - VMLOF f0, g1, h1 \ - VMLOF f0, g2, h2 \ - VMLOF f0, g3, h3 \ - VMLOF f0, g4, h4 \ - VMLOF f1, g54, T_0 \ - VMLOF f1, g0, T_1 \ - VMLOF f1, g1, T_2 \ - VMLOF f1, g2, T_3 \ - VMLOF f1, g3, T_4 \ - VMALOF f2, g53, h0, h0 \ - VMALOF f2, g54, h1, h1 \ - VMALOF f2, g0, h2, h2 \ - VMALOF f2, g1, h3, h3 \ - VMALOF f2, g2, h4, h4 \ - VMALOF f3, g52, T_0, T_0 \ - VMALOF f3, g53, T_1, T_1 \ - VMALOF f3, g54, T_2, T_2 \ - VMALOF f3, g0, T_3, T_3 \ - VMALOF f3, g1, T_4, T_4 \ - VMALOF f4, g51, h0, h0 \ - VMALOF f4, g52, h1, h1 \ - VMALOF f4, g53, h2, h2 \ - VMALOF f4, g54, h3, h3 \ - VMALOF f4, g0, h4, h4 \ - VAG T_0, h0, h0 \ - VAG T_1, h1, h1 \ - VAG T_2, h2, h2 \ - VAG T_3, h3, h3 \ - VAG T_4, h4, h4 - -// carry h0->h1 h3->h4, h1->h2 h4->h0, h0->h1 h2->h3, h3->h4 -#define REDUCE(h0, h1, h2, h3, h4) \ - VESRLG $26, h0, T_0 \ - VESRLG $26, h3, T_1 \ - VN MOD26, h0, h0 \ - VN MOD26, h3, h3 \ - VAG T_0, h1, h1 \ - VAG T_1, h4, h4 \ - VESRLG $26, h1, T_2 \ - VESRLG $26, h4, T_3 \ - VN MOD26, h1, h1 \ - VN MOD26, h4, h4 \ - VESLG $2, T_3, T_4 \ - VAG T_3, T_4, T_4 \ - VAG T_2, h2, h2 \ - VAG T_4, h0, h0 \ - VESRLG $26, h2, T_0 \ - VESRLG $26, h0, T_1 \ - VN MOD26, h2, h2 \ - VN MOD26, h0, h0 \ - VAG T_0, h3, h3 \ - VAG T_1, h1, h1 \ - VESRLG $26, h3, T_2 \ - VN MOD26, h3, h3 \ - VAG T_2, h4, h4 - -// expand in0 into d[0] and in1 into d[1] -#define EXPAND(in0, in1, d0, d1, d2, d3, d4) \ - VGBM $0x0707, d1 \ // d1=tmp - VPERM in0, in1, EX2, d4 \ - VPERM in0, in1, EX0, d0 \ - VPERM in0, in1, EX1, d2 \ - VN d1, d4, d4 \ - VESRLG $26, d0, d1 \ - VESRLG $30, d2, d3 \ - VESRLG $4, d2, d2 \ - VN MOD26, d0, d0 \ - VN MOD26, d1, d1 \ - VN MOD26, d2, d2 \ - VN MOD26, d3, d3 - -// pack h4:h0 into h1:h0 (no carry) -#define PACK(h0, h1, h2, h3, h4) \ - VESLG $26, h1, h1 \ - VESLG $26, h3, h3 \ - VO h0, h1, h0 \ - VO h2, h3, h2 \ - VESLG $4, h2, h2 \ - VLEIB $7, $48, h1 \ - VSLB h1, h2, h2 \ - VO h0, h2, h0 \ - VLEIB $7, $104, h1 \ - VSLB h1, h4, h3 \ - VO h3, h0, h0 \ - VLEIB $7, $24, h1 \ - VSRLB h1, h4, h1 - -// if h > 2**130-5 then h -= 2**130-5 -#define MOD(h0, h1, t0, t1, t2) \ - VZERO t0 \ - VLEIG $1, $5, t0 \ - VACCQ h0, t0, t1 \ - VAQ h0, t0, t0 \ - VONE t2 \ - VLEIG $1, $-4, t2 \ - VAQ t2, t1, t1 \ - VACCQ h1, t1, t1 \ - VONE t2 \ - VAQ t2, t1, t1 \ - VN h0, t1, t2 \ - VNC t0, t1, t1 \ - VO t1, t2, h0 - -// func poly1305vx(out *[16]byte, m *byte, mlen uint64, key *[32]key) -TEXT ·poly1305vx(SB), $0-32 - // This code processes up to 2 blocks (32 bytes) per iteration - // using the algorithm described in: - // NEON crypto, Daniel J. Bernstein & Peter Schwabe - // https://cryptojedi.org/papers/neoncrypto-20120320.pdf - LMG out+0(FP), R1, R4 // R1=out, R2=m, R3=mlen, R4=key - - // load MOD26, EX0, EX1 and EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), MOD26, EX2 - - // setup r - VL (R4), T_0 - MOVD $·keyMask<>(SB), R6 - VL (R6), T_1 - VN T_0, T_1, T_0 - EXPAND(T_0, T_0, R_0, R_1, R_2, R_3, R_4) - - // setup r*5 - VLEIG $0, $5, T_0 - VLEIG $1, $5, T_0 - - // store r (for final block) - VMLOF T_0, R_1, R5SAVE_1 - VMLOF T_0, R_2, R5SAVE_2 - VMLOF T_0, R_3, R5SAVE_3 - VMLOF T_0, R_4, R5SAVE_4 - VLGVG $0, R_0, RSAVE_0 - VLGVG $0, R_1, RSAVE_1 - VLGVG $0, R_2, RSAVE_2 - VLGVG $0, R_3, RSAVE_3 - VLGVG $0, R_4, RSAVE_4 - - // skip r**2 calculation - CMPBLE R3, $16, skip - - // calculate r**2 - MULTIPLY(R_0, R_1, R_2, R_3, R_4, R_0, R_1, R_2, R_3, R_4, R5SAVE_1, R5SAVE_2, R5SAVE_3, R5SAVE_4, H_0, H_1, H_2, H_3, H_4) - REDUCE(H_0, H_1, H_2, H_3, H_4) - VLEIG $0, $5, T_0 - VLEIG $1, $5, T_0 - VMLOF T_0, H_1, R5_1 - VMLOF T_0, H_2, R5_2 - VMLOF T_0, H_3, R5_3 - VMLOF T_0, H_4, R5_4 - VLR H_0, R_0 - VLR H_1, R_1 - VLR H_2, R_2 - VLR H_3, R_3 - VLR H_4, R_4 - - // initialize h - VZERO H_0 - VZERO H_1 - VZERO H_2 - VZERO H_3 - VZERO H_4 - -loop: - CMPBLE R3, $32, b2 - VLM (R2), T_0, T_1 - SUB $32, R3 - MOVD $32(R2), R2 - EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4) - VLEIB $4, $1, F_4 - VLEIB $12, $1, F_4 - -multiply: - VAG H_0, F_0, F_0 - VAG H_1, F_1, F_1 - VAG H_2, F_2, F_2 - VAG H_3, F_3, F_3 - VAG H_4, F_4, F_4 - MULTIPLY(F_0, F_1, F_2, F_3, F_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, H_0, H_1, H_2, H_3, H_4) - REDUCE(H_0, H_1, H_2, H_3, H_4) - CMPBNE R3, $0, loop - -finish: - // sum vectors - VZERO T_0 - VSUMQG H_0, T_0, H_0 - VSUMQG H_1, T_0, H_1 - VSUMQG H_2, T_0, H_2 - VSUMQG H_3, T_0, H_3 - VSUMQG H_4, T_0, H_4 - - // h may be >= 2*(2**130-5) so we need to reduce it again - REDUCE(H_0, H_1, H_2, H_3, H_4) - - // carry h1->h4 - VESRLG $26, H_1, T_1 - VN MOD26, H_1, H_1 - VAQ T_1, H_2, H_2 - VESRLG $26, H_2, T_2 - VN MOD26, H_2, H_2 - VAQ T_2, H_3, H_3 - VESRLG $26, H_3, T_3 - VN MOD26, H_3, H_3 - VAQ T_3, H_4, H_4 - - // h is now < 2*(2**130-5) - // pack h into h1 (hi) and h0 (lo) - PACK(H_0, H_1, H_2, H_3, H_4) - - // if h > 2**130-5 then h -= 2**130-5 - MOD(H_0, H_1, T_0, T_1, T_2) - - // h += s - MOVD $·bswapMask<>(SB), R5 - VL (R5), T_1 - VL 16(R4), T_0 - VPERM T_0, T_0, T_1, T_0 // reverse bytes (to big) - VAQ T_0, H_0, H_0 - VPERM H_0, H_0, T_1, H_0 // reverse bytes (to little) - VST H_0, (R1) - - RET - -b2: - CMPBLE R3, $16, b1 - - // 2 blocks remaining - SUB $17, R3 - VL (R2), T_0 - VLL R3, 16(R2), T_1 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, T_1 - EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4) - CMPBNE R3, $16, 2(PC) - VLEIB $12, $1, F_4 - VLEIB $4, $1, F_4 - - // setup [r²,r] - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, RSAVE_3, R_3 - VLVGG $1, RSAVE_4, R_4 - VPDI $0, R5_1, R5SAVE_1, R5_1 - VPDI $0, R5_2, R5SAVE_2, R5_2 - VPDI $0, R5_3, R5SAVE_3, R5_3 - VPDI $0, R5_4, R5SAVE_4, R5_4 - - MOVD $0, R3 - BR multiply - -skip: - VZERO H_0 - VZERO H_1 - VZERO H_2 - VZERO H_3 - VZERO H_4 - - CMPBEQ R3, $0, finish - -b1: - // 1 block remaining - SUB $1, R3 - VLL R3, (R2), T_0 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, T_0 - VZERO T_1 - EXPAND(T_0, T_1, F_0, F_1, F_2, F_3, F_4) - CMPBNE R3, $16, 2(PC) - VLEIB $4, $1, F_4 - VLEIG $1, $1, R_0 - VZERO R_1 - VZERO R_2 - VZERO R_3 - VZERO R_4 - VZERO R5_1 - VZERO R5_2 - VZERO R5_3 - VZERO R5_4 - - // setup [r, 1] - VLVGG $0, RSAVE_0, R_0 - VLVGG $0, RSAVE_1, R_1 - VLVGG $0, RSAVE_2, R_2 - VLVGG $0, RSAVE_3, R_3 - VLVGG $0, RSAVE_4, R_4 - VPDI $0, R5SAVE_1, R5_1, R5_1 - VPDI $0, R5SAVE_2, R5_2, R5_2 - VPDI $0, R5SAVE_3, R5_3, R5_3 - VPDI $0, R5SAVE_4, R5_4, R5_4 - - MOVD $0, R3 - BR multiply diff --git a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s b/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s deleted file mode 100644 index e60bbc1d..00000000 --- a/vendor/golang.org/x/crypto/poly1305/sum_vmsl_s390x.s +++ /dev/null @@ -1,909 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build s390x,go1.11,!gccgo,!appengine - -#include "textflag.h" - -// Implementation of Poly1305 using the vector facility (vx) and the VMSL instruction. - -// constants -#define EX0 V1 -#define EX1 V2 -#define EX2 V3 - -// temporaries -#define T_0 V4 -#define T_1 V5 -#define T_2 V6 -#define T_3 V7 -#define T_4 V8 -#define T_5 V9 -#define T_6 V10 -#define T_7 V11 -#define T_8 V12 -#define T_9 V13 -#define T_10 V14 - -// r**2 & r**4 -#define R_0 V15 -#define R_1 V16 -#define R_2 V17 -#define R5_1 V18 -#define R5_2 V19 -// key (r) -#define RSAVE_0 R7 -#define RSAVE_1 R8 -#define RSAVE_2 R9 -#define R5SAVE_1 R10 -#define R5SAVE_2 R11 - -// message block -#define M0 V20 -#define M1 V21 -#define M2 V22 -#define M3 V23 -#define M4 V24 -#define M5 V25 - -// accumulator -#define H0_0 V26 -#define H1_0 V27 -#define H2_0 V28 -#define H0_1 V29 -#define H1_1 V30 -#define H2_1 V31 - -GLOBL ·keyMask<>(SB), RODATA, $16 -DATA ·keyMask<>+0(SB)/8, $0xffffff0ffcffff0f -DATA ·keyMask<>+8(SB)/8, $0xfcffff0ffcffff0f - -GLOBL ·bswapMask<>(SB), RODATA, $16 -DATA ·bswapMask<>+0(SB)/8, $0x0f0e0d0c0b0a0908 -DATA ·bswapMask<>+8(SB)/8, $0x0706050403020100 - -GLOBL ·constants<>(SB), RODATA, $48 -// EX0 -DATA ·constants<>+0(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+8(SB)/8, $0x0000050403020100 -// EX1 -DATA ·constants<>+16(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+24(SB)/8, $0x00000a0908070605 -// EX2 -DATA ·constants<>+32(SB)/8, $0x18191a1b1c1d1e1f -DATA ·constants<>+40(SB)/8, $0x0000000f0e0d0c0b - -GLOBL ·c<>(SB), RODATA, $48 -// EX0 -DATA ·c<>+0(SB)/8, $0x0000050403020100 -DATA ·c<>+8(SB)/8, $0x0000151413121110 -// EX1 -DATA ·c<>+16(SB)/8, $0x00000a0908070605 -DATA ·c<>+24(SB)/8, $0x00001a1918171615 -// EX2 -DATA ·c<>+32(SB)/8, $0x0000000f0e0d0c0b -DATA ·c<>+40(SB)/8, $0x0000001f1e1d1c1b - -GLOBL ·reduce<>(SB), RODATA, $32 -// 44 bit -DATA ·reduce<>+0(SB)/8, $0x0 -DATA ·reduce<>+8(SB)/8, $0xfffffffffff -// 42 bit -DATA ·reduce<>+16(SB)/8, $0x0 -DATA ·reduce<>+24(SB)/8, $0x3ffffffffff - -// h = (f*g) % (2**130-5) [partial reduction] -// uses T_0...T_9 temporary registers -// input: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 -// output: m02_0, m02_1, m02_2, m13_0, m13_1, m13_2 -#define MULTIPLY(m02_0, m02_1, m02_2, m13_0, m13_1, m13_2, r_0, r_1, r_2, r5_1, r5_2, m4_0, m4_1, m4_2, m5_0, m5_1, m5_2, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9) \ - \ // Eliminate the dependency for the last 2 VMSLs - VMSLG m02_0, r_2, m4_2, m4_2 \ - VMSLG m13_0, r_2, m5_2, m5_2 \ // 8 VMSLs pipelined - VMSLG m02_0, r_0, m4_0, m4_0 \ - VMSLG m02_1, r5_2, V0, T_0 \ - VMSLG m02_0, r_1, m4_1, m4_1 \ - VMSLG m02_1, r_0, V0, T_1 \ - VMSLG m02_1, r_1, V0, T_2 \ - VMSLG m02_2, r5_1, V0, T_3 \ - VMSLG m02_2, r5_2, V0, T_4 \ - VMSLG m13_0, r_0, m5_0, m5_0 \ - VMSLG m13_1, r5_2, V0, T_5 \ - VMSLG m13_0, r_1, m5_1, m5_1 \ - VMSLG m13_1, r_0, V0, T_6 \ - VMSLG m13_1, r_1, V0, T_7 \ - VMSLG m13_2, r5_1, V0, T_8 \ - VMSLG m13_2, r5_2, V0, T_9 \ - VMSLG m02_2, r_0, m4_2, m4_2 \ - VMSLG m13_2, r_0, m5_2, m5_2 \ - VAQ m4_0, T_0, m02_0 \ - VAQ m4_1, T_1, m02_1 \ - VAQ m5_0, T_5, m13_0 \ - VAQ m5_1, T_6, m13_1 \ - VAQ m02_0, T_3, m02_0 \ - VAQ m02_1, T_4, m02_1 \ - VAQ m13_0, T_8, m13_0 \ - VAQ m13_1, T_9, m13_1 \ - VAQ m4_2, T_2, m02_2 \ - VAQ m5_2, T_7, m13_2 \ - -// SQUARE uses three limbs of r and r_2*5 to output square of r -// uses T_1, T_5 and T_7 temporary registers -// input: r_0, r_1, r_2, r5_2 -// temp: TEMP0, TEMP1, TEMP2 -// output: p0, p1, p2 -#define SQUARE(r_0, r_1, r_2, r5_2, p0, p1, p2, TEMP0, TEMP1, TEMP2) \ - VMSLG r_0, r_0, p0, p0 \ - VMSLG r_1, r5_2, V0, TEMP0 \ - VMSLG r_2, r5_2, p1, p1 \ - VMSLG r_0, r_1, V0, TEMP1 \ - VMSLG r_1, r_1, p2, p2 \ - VMSLG r_0, r_2, V0, TEMP2 \ - VAQ TEMP0, p0, p0 \ - VAQ TEMP1, p1, p1 \ - VAQ TEMP2, p2, p2 \ - VAQ TEMP0, p0, p0 \ - VAQ TEMP1, p1, p1 \ - VAQ TEMP2, p2, p2 \ - -// carry h0->h1->h2->h0 || h3->h4->h5->h3 -// uses T_2, T_4, T_5, T_7, T_8, T_9 -// t6, t7, t8, t9, t10, t11 -// input: h0, h1, h2, h3, h4, h5 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11 -// output: h0, h1, h2, h3, h4, h5 -#define REDUCE(h0, h1, h2, h3, h4, h5, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) \ - VLM (R12), t6, t7 \ // 44 and 42 bit clear mask - VLEIB $7, $0x28, t10 \ // 5 byte shift mask - VREPIB $4, t8 \ // 4 bit shift mask - VREPIB $2, t11 \ // 2 bit shift mask - VSRLB t10, h0, t0 \ // h0 byte shift - VSRLB t10, h1, t1 \ // h1 byte shift - VSRLB t10, h2, t2 \ // h2 byte shift - VSRLB t10, h3, t3 \ // h3 byte shift - VSRLB t10, h4, t4 \ // h4 byte shift - VSRLB t10, h5, t5 \ // h5 byte shift - VSRL t8, t0, t0 \ // h0 bit shift - VSRL t8, t1, t1 \ // h2 bit shift - VSRL t11, t2, t2 \ // h2 bit shift - VSRL t8, t3, t3 \ // h3 bit shift - VSRL t8, t4, t4 \ // h4 bit shift - VESLG $2, t2, t9 \ // h2 carry x5 - VSRL t11, t5, t5 \ // h5 bit shift - VN t6, h0, h0 \ // h0 clear carry - VAQ t2, t9, t2 \ // h2 carry x5 - VESLG $2, t5, t9 \ // h5 carry x5 - VN t6, h1, h1 \ // h1 clear carry - VN t7, h2, h2 \ // h2 clear carry - VAQ t5, t9, t5 \ // h5 carry x5 - VN t6, h3, h3 \ // h3 clear carry - VN t6, h4, h4 \ // h4 clear carry - VN t7, h5, h5 \ // h5 clear carry - VAQ t0, h1, h1 \ // h0->h1 - VAQ t3, h4, h4 \ // h3->h4 - VAQ t1, h2, h2 \ // h1->h2 - VAQ t4, h5, h5 \ // h4->h5 - VAQ t2, h0, h0 \ // h2->h0 - VAQ t5, h3, h3 \ // h5->h3 - VREPG $1, t6, t6 \ // 44 and 42 bit masks across both halves - VREPG $1, t7, t7 \ - VSLDB $8, h0, h0, h0 \ // set up [h0/1/2, h3/4/5] - VSLDB $8, h1, h1, h1 \ - VSLDB $8, h2, h2, h2 \ - VO h0, h3, h3 \ - VO h1, h4, h4 \ - VO h2, h5, h5 \ - VESRLG $44, h3, t0 \ // 44 bit shift right - VESRLG $44, h4, t1 \ - VESRLG $42, h5, t2 \ - VN t6, h3, h3 \ // clear carry bits - VN t6, h4, h4 \ - VN t7, h5, h5 \ - VESLG $2, t2, t9 \ // multiply carry by 5 - VAQ t9, t2, t2 \ - VAQ t0, h4, h4 \ - VAQ t1, h5, h5 \ - VAQ t2, h3, h3 \ - -// carry h0->h1->h2->h0 -// input: h0, h1, h2 -// temp: t0, t1, t2, t3, t4, t5, t6, t7, t8 -// output: h0, h1, h2 -#define REDUCE2(h0, h1, h2, t0, t1, t2, t3, t4, t5, t6, t7, t8) \ - VLEIB $7, $0x28, t3 \ // 5 byte shift mask - VREPIB $4, t4 \ // 4 bit shift mask - VREPIB $2, t7 \ // 2 bit shift mask - VGBM $0x003F, t5 \ // mask to clear carry bits - VSRLB t3, h0, t0 \ - VSRLB t3, h1, t1 \ - VSRLB t3, h2, t2 \ - VESRLG $4, t5, t5 \ // 44 bit clear mask - VSRL t4, t0, t0 \ - VSRL t4, t1, t1 \ - VSRL t7, t2, t2 \ - VESRLG $2, t5, t6 \ // 42 bit clear mask - VESLG $2, t2, t8 \ - VAQ t8, t2, t2 \ - VN t5, h0, h0 \ - VN t5, h1, h1 \ - VN t6, h2, h2 \ - VAQ t0, h1, h1 \ - VAQ t1, h2, h2 \ - VAQ t2, h0, h0 \ - VSRLB t3, h0, t0 \ - VSRLB t3, h1, t1 \ - VSRLB t3, h2, t2 \ - VSRL t4, t0, t0 \ - VSRL t4, t1, t1 \ - VSRL t7, t2, t2 \ - VN t5, h0, h0 \ - VN t5, h1, h1 \ - VESLG $2, t2, t8 \ - VN t6, h2, h2 \ - VAQ t0, h1, h1 \ - VAQ t8, t2, t2 \ - VAQ t1, h2, h2 \ - VAQ t2, h0, h0 \ - -// expands two message blocks into the lower halfs of the d registers -// moves the contents of the d registers into upper halfs -// input: in1, in2, d0, d1, d2, d3, d4, d5 -// temp: TEMP0, TEMP1, TEMP2, TEMP3 -// output: d0, d1, d2, d3, d4, d5 -#define EXPACC(in1, in2, d0, d1, d2, d3, d4, d5, TEMP0, TEMP1, TEMP2, TEMP3) \ - VGBM $0xff3f, TEMP0 \ - VGBM $0xff1f, TEMP1 \ - VESLG $4, d1, TEMP2 \ - VESLG $4, d4, TEMP3 \ - VESRLG $4, TEMP0, TEMP0 \ - VPERM in1, d0, EX0, d0 \ - VPERM in2, d3, EX0, d3 \ - VPERM in1, d2, EX2, d2 \ - VPERM in2, d5, EX2, d5 \ - VPERM in1, TEMP2, EX1, d1 \ - VPERM in2, TEMP3, EX1, d4 \ - VN TEMP0, d0, d0 \ - VN TEMP0, d3, d3 \ - VESRLG $4, d1, d1 \ - VESRLG $4, d4, d4 \ - VN TEMP1, d2, d2 \ - VN TEMP1, d5, d5 \ - VN TEMP0, d1, d1 \ - VN TEMP0, d4, d4 \ - -// expands one message block into the lower halfs of the d registers -// moves the contents of the d registers into upper halfs -// input: in, d0, d1, d2 -// temp: TEMP0, TEMP1, TEMP2 -// output: d0, d1, d2 -#define EXPACC2(in, d0, d1, d2, TEMP0, TEMP1, TEMP2) \ - VGBM $0xff3f, TEMP0 \ - VESLG $4, d1, TEMP2 \ - VGBM $0xff1f, TEMP1 \ - VPERM in, d0, EX0, d0 \ - VESRLG $4, TEMP0, TEMP0 \ - VPERM in, d2, EX2, d2 \ - VPERM in, TEMP2, EX1, d1 \ - VN TEMP0, d0, d0 \ - VN TEMP1, d2, d2 \ - VESRLG $4, d1, d1 \ - VN TEMP0, d1, d1 \ - -// pack h2:h0 into h1:h0 (no carry) -// input: h0, h1, h2 -// output: h0, h1, h2 -#define PACK(h0, h1, h2) \ - VMRLG h1, h2, h2 \ // copy h1 to upper half h2 - VESLG $44, h1, h1 \ // shift limb 1 44 bits, leaving 20 - VO h0, h1, h0 \ // combine h0 with 20 bits from limb 1 - VESRLG $20, h2, h1 \ // put top 24 bits of limb 1 into h1 - VLEIG $1, $0, h1 \ // clear h2 stuff from lower half of h1 - VO h0, h1, h0 \ // h0 now has 88 bits (limb 0 and 1) - VLEIG $0, $0, h2 \ // clear upper half of h2 - VESRLG $40, h2, h1 \ // h1 now has upper two bits of result - VLEIB $7, $88, h1 \ // for byte shift (11 bytes) - VSLB h1, h2, h2 \ // shift h2 11 bytes to the left - VO h0, h2, h0 \ // combine h0 with 20 bits from limb 1 - VLEIG $0, $0, h1 \ // clear upper half of h1 - -// if h > 2**130-5 then h -= 2**130-5 -// input: h0, h1 -// temp: t0, t1, t2 -// output: h0 -#define MOD(h0, h1, t0, t1, t2) \ - VZERO t0 \ - VLEIG $1, $5, t0 \ - VACCQ h0, t0, t1 \ - VAQ h0, t0, t0 \ - VONE t2 \ - VLEIG $1, $-4, t2 \ - VAQ t2, t1, t1 \ - VACCQ h1, t1, t1 \ - VONE t2 \ - VAQ t2, t1, t1 \ - VN h0, t1, t2 \ - VNC t0, t1, t1 \ - VO t1, t2, h0 \ - -// func poly1305vmsl(out *[16]byte, m *byte, mlen uint64, key *[32]key) -TEXT ·poly1305vmsl(SB), $0-32 - // This code processes 6 + up to 4 blocks (32 bytes) per iteration - // using the algorithm described in: - // NEON crypto, Daniel J. Bernstein & Peter Schwabe - // https://cryptojedi.org/papers/neoncrypto-20120320.pdf - // And as moddified for VMSL as described in - // Accelerating Poly1305 Cryptographic Message Authentication on the z14 - // O'Farrell et al, CASCON 2017, p48-55 - // https://ibm.ent.box.com/s/jf9gedj0e9d2vjctfyh186shaztavnht - - LMG out+0(FP), R1, R4 // R1=out, R2=m, R3=mlen, R4=key - VZERO V0 // c - - // load EX0, EX1 and EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 // c - - // setup r - VL (R4), T_0 - MOVD $·keyMask<>(SB), R6 - VL (R6), T_1 - VN T_0, T_1, T_0 - VZERO T_2 // limbs for r - VZERO T_3 - VZERO T_4 - EXPACC2(T_0, T_2, T_3, T_4, T_1, T_5, T_7) - - // T_2, T_3, T_4: [0, r] - - // setup r*20 - VLEIG $0, $0, T_0 - VLEIG $1, $20, T_0 // T_0: [0, 20] - VZERO T_5 - VZERO T_6 - VMSLG T_0, T_3, T_5, T_5 - VMSLG T_0, T_4, T_6, T_6 - - // store r for final block in GR - VLGVG $1, T_2, RSAVE_0 // c - VLGVG $1, T_3, RSAVE_1 // c - VLGVG $1, T_4, RSAVE_2 // c - VLGVG $1, T_5, R5SAVE_1 // c - VLGVG $1, T_6, R5SAVE_2 // c - - // initialize h - VZERO H0_0 - VZERO H1_0 - VZERO H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - // initialize pointer for reduce constants - MOVD $·reduce<>(SB), R12 - - // calculate r**2 and 20*(r**2) - VZERO R_0 - VZERO R_1 - VZERO R_2 - SQUARE(T_2, T_3, T_4, T_6, R_0, R_1, R_2, T_1, T_5, T_7) - REDUCE2(R_0, R_1, R_2, M0, M1, M2, M3, M4, R5_1, R5_2, M5, T_1) - VZERO R5_1 - VZERO R5_2 - VMSLG T_0, R_1, R5_1, R5_1 - VMSLG T_0, R_2, R5_2, R5_2 - - // skip r**4 calculation if 3 blocks or less - CMPBLE R3, $48, b4 - - // calculate r**4 and 20*(r**4) - VZERO T_8 - VZERO T_9 - VZERO T_10 - SQUARE(R_0, R_1, R_2, R5_2, T_8, T_9, T_10, T_1, T_5, T_7) - REDUCE2(T_8, T_9, T_10, M0, M1, M2, M3, M4, T_2, T_3, M5, T_1) - VZERO T_2 - VZERO T_3 - VMSLG T_0, T_9, T_2, T_2 - VMSLG T_0, T_10, T_3, T_3 - - // put r**2 to the right and r**4 to the left of R_0, R_1, R_2 - VSLDB $8, T_8, T_8, T_8 - VSLDB $8, T_9, T_9, T_9 - VSLDB $8, T_10, T_10, T_10 - VSLDB $8, T_2, T_2, T_2 - VSLDB $8, T_3, T_3, T_3 - - VO T_8, R_0, R_0 - VO T_9, R_1, R_1 - VO T_10, R_2, R_2 - VO T_2, R5_1, R5_1 - VO T_3, R5_2, R5_2 - - CMPBLE R3, $80, load // less than or equal to 5 blocks in message - - // 6(or 5+1) blocks - SUB $81, R3 - VLM (R2), M0, M4 - VLL R3, 80(R2), M5 - ADD $1, R3 - MOVBZ $1, R0 - CMPBGE R3, $16, 2(PC) - VLVGB R3, R0, M5 - MOVD $96(R2), R2 - EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - EXPACC(M2, M3, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - VLEIB $2, $1, H2_0 - VLEIB $2, $1, H2_1 - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO T_4 - VZERO T_10 - EXPACC(M4, M5, M0, M1, M2, M3, T_4, T_10, T_0, T_1, T_2, T_3) - VLR T_4, M4 - VLEIB $10, $1, M2 - CMPBLT R3, $16, 2(PC) - VLEIB $10, $1, T_10 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - SUB $16, R3 - CMPBLE R3, $0, square - -load: - // load EX0, EX1 and EX2 - MOVD $·c<>(SB), R5 - VLM (R5), EX0, EX2 - -loop: - CMPBLE R3, $64, add // b4 // last 4 or less blocks left - - // next 4 full blocks - VLM (R2), M2, M5 - SUB $64, R3 - MOVD $64(R2), R2 - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, T_0, T_1, T_3, T_4, T_5, T_2, T_7, T_8, T_9) - - // expacc in-lined to create [m2, m3] limbs - VGBM $0x3f3f, T_0 // 44 bit clear mask - VGBM $0x1f1f, T_1 // 40 bit clear mask - VPERM M2, M3, EX0, T_3 - VESRLG $4, T_0, T_0 // 44 bit clear mask ready - VPERM M2, M3, EX1, T_4 - VPERM M2, M3, EX2, T_5 - VN T_0, T_3, T_3 - VESRLG $4, T_4, T_4 - VN T_1, T_5, T_5 - VN T_0, T_4, T_4 - VMRHG H0_1, T_3, H0_0 - VMRHG H1_1, T_4, H1_0 - VMRHG H2_1, T_5, H2_0 - VMRLG H0_1, T_3, H0_1 - VMRLG H1_1, T_4, H1_1 - VMRLG H2_1, T_5, H2_1 - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - VPERM M4, M5, EX0, T_3 - VPERM M4, M5, EX1, T_4 - VPERM M4, M5, EX2, T_5 - VN T_0, T_3, T_3 - VESRLG $4, T_4, T_4 - VN T_1, T_5, T_5 - VN T_0, T_4, T_4 - VMRHG V0, T_3, M0 - VMRHG V0, T_4, M1 - VMRHG V0, T_5, M2 - VMRLG V0, T_3, M3 - VMRLG V0, T_4, M4 - VMRLG V0, T_5, M5 - VLEIB $10, $1, M2 - VLEIB $10, $1, M5 - - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - CMPBNE R3, $0, loop - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - // load EX0, EX1, EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 - - // sum vectors - VAQ H0_0, H0_1, H0_0 - VAQ H1_0, H1_1, H1_0 - VAQ H2_0, H2_1, H2_0 - - // h may be >= 2*(2**130-5) so we need to reduce it again - // M0...M4 are used as temps here - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - -next: // carry h1->h2 - VLEIB $7, $0x28, T_1 - VREPIB $4, T_2 - VGBM $0x003F, T_3 - VESRLG $4, T_3 - - // byte shift - VSRLB T_1, H1_0, T_4 - - // bit shift - VSRL T_2, T_4, T_4 - - // clear h1 carry bits - VN T_3, H1_0, H1_0 - - // add carry - VAQ T_4, H2_0, H2_0 - - // h is now < 2*(2**130-5) - // pack h into h1 (hi) and h0 (lo) - PACK(H0_0, H1_0, H2_0) - - // if h > 2**130-5 then h -= 2**130-5 - MOD(H0_0, H1_0, T_0, T_1, T_2) - - // h += s - MOVD $·bswapMask<>(SB), R5 - VL (R5), T_1 - VL 16(R4), T_0 - VPERM T_0, T_0, T_1, T_0 // reverse bytes (to big) - VAQ T_0, H0_0, H0_0 - VPERM H0_0, H0_0, T_1, H0_0 // reverse bytes (to little) - VST H0_0, (R1) - RET - -add: - // load EX0, EX1, EX2 - MOVD $·constants<>(SB), R5 - VLM (R5), EX0, EX2 - - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - CMPBLE R3, $64, b4 - -b4: - CMPBLE R3, $48, b3 // 3 blocks or less - - // 4(3+1) blocks remaining - SUB $49, R3 - VLM (R2), M0, M2 - VLL R3, 48(R2), M3 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M3 - MOVD $64(R2), R2 - EXPACC(M0, M1, H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_0, T_1, T_2, T_3) - VLEIB $10, $1, H2_0 - VLEIB $10, $1, H2_1 - VZERO M0 - VZERO M1 - VZERO M4 - VZERO M5 - VZERO T_4 - VZERO T_10 - EXPACC(M2, M3, M0, M1, M4, M5, T_4, T_10, T_0, T_1, T_2, T_3) - VLR T_4, M2 - VLEIB $10, $1, M4 - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_10 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M4, M5, M2, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M3, M4, M5, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - SUB $16, R3 - CMPBLE R3, $0, square // this condition must always hold true! - -b3: - CMPBLE R3, $32, b2 - - // 3 blocks remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, T_10, M5) - - SUB $33, R3 - VLM (R2), M0, M1 - VLL R3, 32(R2), M2 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M2 - - // H += m0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6) - VLEIB $10, $1, T_3 - VAG H0_0, T_1, H0_0 - VAG H1_0, T_2, H1_0 - VAG H2_0, T_3, H2_0 - - VZERO M0 - VZERO M3 - VZERO M4 - VZERO M5 - VZERO T_10 - - // (H+m0)*r - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M3, M4, M5, V0, T_10, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_10, H0_1, H1_1, H2_1, T_9) - - // H += m1 - VZERO V0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M1, T_1, T_2, T_3, T_4, T_5, T_6) - VLEIB $10, $1, T_3 - VAQ H0_0, T_1, H0_0 - VAQ H1_0, T_2, H1_0 - VAQ H2_0, T_3, H2_0 - REDUCE2(H0_0, H1_0, H2_0, M0, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10) - - // [H, m2] * [r**2, r] - EXPACC2(M2, H0_0, H1_0, H2_0, T_1, T_2, T_3) - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, H2_0 - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, H0_1, H1_1, M5, T_10) - SUB $16, R3 - CMPBLE R3, $0, next // this condition must always hold true! - -b2: - CMPBLE R3, $16, b1 - - // 2 blocks remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, T_10, M0, M1, M2, M3, M4, T_4, T_5, T_2, T_7, T_8, T_9) - VMRHG V0, H0_1, H0_0 - VMRHG V0, H1_1, H1_0 - VMRHG V0, H2_1, H2_0 - VMRLG V0, H0_1, H0_1 - VMRLG V0, H1_1, H1_1 - VMRLG V0, H2_1, H2_1 - - // move h to the left and 0s at the right - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - - // get message blocks and append 1 to start - SUB $17, R3 - VL (R2), M0 - VLL R3, 16(R2), M1 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M1 - VZERO T_6 - VZERO T_7 - VZERO T_8 - EXPACC2(M0, T_6, T_7, T_8, T_1, T_2, T_3) - EXPACC2(M1, T_6, T_7, T_8, T_1, T_2, T_3) - VLEIB $2, $1, T_8 - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_8 - - // add [m0, m1] to h - VAG H0_0, T_6, H0_0 - VAG H1_0, T_7, H1_0 - VAG H2_0, T_8, H2_0 - - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - VZERO T_10 - VZERO M0 - - // at this point R_0 .. R5_2 look like [r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M2, M3, M4, M5, T_10, M0, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M2, M3, M4, M5, T_9, H0_1, H1_1, H2_1, T_10) - SUB $16, R3, R3 - CMPBLE R3, $0, next - -b1: - CMPBLE R3, $0, next - - // 1 block remaining - - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // H*[r**2, r] - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - - // set up [0, m0] limbs - SUB $1, R3 - VLL R3, (R2), M0 - ADD $1, R3 - MOVBZ $1, R0 - CMPBEQ R3, $16, 2(PC) - VLVGB R3, R0, M0 - VZERO T_1 - VZERO T_2 - VZERO T_3 - EXPACC2(M0, T_1, T_2, T_3, T_4, T_5, T_6)// limbs: [0, m] - CMPBNE R3, $16, 2(PC) - VLEIB $10, $1, T_3 - - // h+m0 - VAQ H0_0, T_1, H0_0 - VAQ H1_0, T_2, H1_0 - VAQ H2_0, T_3, H2_0 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - - BR next - -square: - // setup [r²,r] - VSLDB $8, R_0, R_0, R_0 - VSLDB $8, R_1, R_1, R_1 - VSLDB $8, R_2, R_2, R_2 - VSLDB $8, R5_1, R5_1, R5_1 - VSLDB $8, R5_2, R5_2, R5_2 - - VLVGG $1, RSAVE_0, R_0 - VLVGG $1, RSAVE_1, R_1 - VLVGG $1, RSAVE_2, R_2 - VLVGG $1, R5SAVE_1, R5_1 - VLVGG $1, R5SAVE_2, R5_2 - - // setup [h0, h1] - VSLDB $8, H0_0, H0_0, H0_0 - VSLDB $8, H1_0, H1_0, H1_0 - VSLDB $8, H2_0, H2_0, H2_0 - VO H0_1, H0_0, H0_0 - VO H1_1, H1_0, H1_0 - VO H2_1, H2_0, H2_0 - VZERO H0_1 - VZERO H1_1 - VZERO H2_1 - - VZERO M0 - VZERO M1 - VZERO M2 - VZERO M3 - VZERO M4 - VZERO M5 - - // (h0*r**2) + (h1*r) - MULTIPLY(H0_0, H1_0, H2_0, H0_1, H1_1, H2_1, R_0, R_1, R_2, R5_1, R5_2, M0, M1, M2, M3, M4, M5, T_0, T_1, T_2, T_3, T_4, T_5, T_6, T_7, T_8, T_9) - REDUCE2(H0_0, H1_0, H2_0, M0, M1, M2, M3, M4, T_9, T_10, H0_1, M5) - BR next diff --git a/vendor/golang.org/x/crypto/ripemd160/ripemd160.go b/vendor/golang.org/x/crypto/ripemd160/ripemd160.go index cf3eeb15..fd97ba1b 100644 --- a/vendor/golang.org/x/crypto/ripemd160/ripemd160.go +++ b/vendor/golang.org/x/crypto/ripemd160/ripemd160.go @@ -3,10 +3,6 @@ // license that can be found in the LICENSE file. // Package ripemd160 implements the RIPEMD-160 hash algorithm. -// -// Deprecated: RIPEMD-160 is a legacy hash and should not be used for new -// applications. Also, this package does not and will not provide an optimized -// implementation. Instead, use a modern hash like SHA-256 (from crypto/sha256). package ripemd160 // import "golang.org/x/crypto/ripemd160" // RIPEMD-160 is designed by Hans Dobbertin, Antoon Bosselaers, and Bart diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go deleted file mode 100644 index 656e8df9..00000000 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 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 amd64,!appengine,!gccgo - -package salsa - -//go:noescape - -// salsa2020XORKeyStream is implemented in salsa20_amd64.s. -func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte) - -// XORKeyStream crypts bytes from in to out using the given key and counters. -// In and out must overlap entirely or not at all. Counter -// contains the raw salsa20 counter bytes (both nonce and block counter). -func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) { - if len(in) == 0 { - return - } - _ = out[len(in)-1] - salsa2020XORKeyStream(&out[0], &in[0], uint64(len(in)), &counter[0], &key[0]) -} diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s deleted file mode 100644 index 18085d2e..00000000 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s +++ /dev/null @@ -1,883 +0,0 @@ -// Copyright 2012 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 amd64,!appengine,!gccgo - -// This code was translated into a form compatible with 6a from the public -// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html - -// func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte) -// This needs up to 64 bytes at 360(SP); hence the non-obvious frame size. -TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment - MOVQ out+0(FP),DI - MOVQ in+8(FP),SI - MOVQ n+16(FP),DX - MOVQ nonce+24(FP),CX - MOVQ key+32(FP),R8 - - MOVQ SP,R12 - MOVQ SP,R9 - ADDQ $31, R9 - ANDQ $~31, R9 - MOVQ R9, SP - - MOVQ DX,R9 - MOVQ CX,DX - MOVQ R8,R10 - CMPQ R9,$0 - JBE DONE - START: - MOVL 20(R10),CX - MOVL 0(R10),R8 - MOVL 0(DX),AX - MOVL 16(R10),R11 - MOVL CX,0(SP) - MOVL R8, 4 (SP) - MOVL AX, 8 (SP) - MOVL R11, 12 (SP) - MOVL 8(DX),CX - MOVL 24(R10),R8 - MOVL 4(R10),AX - MOVL 4(DX),R11 - MOVL CX,16(SP) - MOVL R8, 20 (SP) - MOVL AX, 24 (SP) - MOVL R11, 28 (SP) - MOVL 12(DX),CX - MOVL 12(R10),DX - MOVL 28(R10),R8 - MOVL 8(R10),AX - MOVL DX,32(SP) - MOVL CX, 36 (SP) - MOVL R8, 40 (SP) - MOVL AX, 44 (SP) - MOVQ $1634760805,DX - MOVQ $857760878,CX - MOVQ $2036477234,R8 - MOVQ $1797285236,AX - MOVL DX,48(SP) - MOVL CX, 52 (SP) - MOVL R8, 56 (SP) - MOVL AX, 60 (SP) - CMPQ R9,$256 - JB BYTESBETWEEN1AND255 - MOVOA 48(SP),X0 - PSHUFL $0X55,X0,X1 - PSHUFL $0XAA,X0,X2 - PSHUFL $0XFF,X0,X3 - PSHUFL $0X00,X0,X0 - MOVOA X1,64(SP) - MOVOA X2,80(SP) - MOVOA X3,96(SP) - MOVOA X0,112(SP) - MOVOA 0(SP),X0 - PSHUFL $0XAA,X0,X1 - PSHUFL $0XFF,X0,X2 - PSHUFL $0X00,X0,X3 - PSHUFL $0X55,X0,X0 - MOVOA X1,128(SP) - MOVOA X2,144(SP) - MOVOA X3,160(SP) - MOVOA X0,176(SP) - MOVOA 16(SP),X0 - PSHUFL $0XFF,X0,X1 - PSHUFL $0X55,X0,X2 - PSHUFL $0XAA,X0,X0 - MOVOA X1,192(SP) - MOVOA X2,208(SP) - MOVOA X0,224(SP) - MOVOA 32(SP),X0 - PSHUFL $0X00,X0,X1 - PSHUFL $0XAA,X0,X2 - PSHUFL $0XFF,X0,X0 - MOVOA X1,240(SP) - MOVOA X2,256(SP) - MOVOA X0,272(SP) - BYTESATLEAST256: - MOVL 16(SP),DX - MOVL 36 (SP),CX - MOVL DX,288(SP) - MOVL CX,304(SP) - SHLQ $32,CX - ADDQ CX,DX - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 292 (SP) - MOVL CX, 308 (SP) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 296 (SP) - MOVL CX, 312 (SP) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX, 300 (SP) - MOVL CX, 316 (SP) - ADDQ $1,DX - MOVQ DX,CX - SHRQ $32,CX - MOVL DX,16(SP) - MOVL CX, 36 (SP) - MOVQ R9,352(SP) - MOVQ $20,DX - MOVOA 64(SP),X0 - MOVOA 80(SP),X1 - MOVOA 96(SP),X2 - MOVOA 256(SP),X3 - MOVOA 272(SP),X4 - MOVOA 128(SP),X5 - MOVOA 144(SP),X6 - MOVOA 176(SP),X7 - MOVOA 192(SP),X8 - MOVOA 208(SP),X9 - MOVOA 224(SP),X10 - MOVOA 304(SP),X11 - MOVOA 112(SP),X12 - MOVOA 160(SP),X13 - MOVOA 240(SP),X14 - MOVOA 288(SP),X15 - MAINLOOP1: - MOVOA X1,320(SP) - MOVOA X2,336(SP) - MOVOA X13,X1 - PADDL X12,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X14 - PSRLL $25,X2 - PXOR X2,X14 - MOVOA X7,X1 - PADDL X0,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X11 - PSRLL $25,X2 - PXOR X2,X11 - MOVOA X12,X1 - PADDL X14,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X15 - PSRLL $23,X2 - PXOR X2,X15 - MOVOA X0,X1 - PADDL X11,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X9 - PSRLL $23,X2 - PXOR X2,X9 - MOVOA X14,X1 - PADDL X15,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X13 - PSRLL $19,X2 - PXOR X2,X13 - MOVOA X11,X1 - PADDL X9,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X7 - PSRLL $19,X2 - PXOR X2,X7 - MOVOA X15,X1 - PADDL X13,X1 - MOVOA X1,X2 - PSLLL $18,X1 - PXOR X1,X12 - PSRLL $14,X2 - PXOR X2,X12 - MOVOA 320(SP),X1 - MOVOA X12,320(SP) - MOVOA X9,X2 - PADDL X7,X2 - MOVOA X2,X12 - PSLLL $18,X2 - PXOR X2,X0 - PSRLL $14,X12 - PXOR X12,X0 - MOVOA X5,X2 - PADDL X1,X2 - MOVOA X2,X12 - PSLLL $7,X2 - PXOR X2,X3 - PSRLL $25,X12 - PXOR X12,X3 - MOVOA 336(SP),X2 - MOVOA X0,336(SP) - MOVOA X6,X0 - PADDL X2,X0 - MOVOA X0,X12 - PSLLL $7,X0 - PXOR X0,X4 - PSRLL $25,X12 - PXOR X12,X4 - MOVOA X1,X0 - PADDL X3,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X10 - PSRLL $23,X12 - PXOR X12,X10 - MOVOA X2,X0 - PADDL X4,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X8 - PSRLL $23,X12 - PXOR X12,X8 - MOVOA X3,X0 - PADDL X10,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X5 - PSRLL $19,X12 - PXOR X12,X5 - MOVOA X4,X0 - PADDL X8,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X6 - PSRLL $19,X12 - PXOR X12,X6 - MOVOA X10,X0 - PADDL X5,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X1 - PSRLL $14,X12 - PXOR X12,X1 - MOVOA 320(SP),X0 - MOVOA X1,320(SP) - MOVOA X4,X1 - PADDL X0,X1 - MOVOA X1,X12 - PSLLL $7,X1 - PXOR X1,X7 - PSRLL $25,X12 - PXOR X12,X7 - MOVOA X8,X1 - PADDL X6,X1 - MOVOA X1,X12 - PSLLL $18,X1 - PXOR X1,X2 - PSRLL $14,X12 - PXOR X12,X2 - MOVOA 336(SP),X12 - MOVOA X2,336(SP) - MOVOA X14,X1 - PADDL X12,X1 - MOVOA X1,X2 - PSLLL $7,X1 - PXOR X1,X5 - PSRLL $25,X2 - PXOR X2,X5 - MOVOA X0,X1 - PADDL X7,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X10 - PSRLL $23,X2 - PXOR X2,X10 - MOVOA X12,X1 - PADDL X5,X1 - MOVOA X1,X2 - PSLLL $9,X1 - PXOR X1,X8 - PSRLL $23,X2 - PXOR X2,X8 - MOVOA X7,X1 - PADDL X10,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X4 - PSRLL $19,X2 - PXOR X2,X4 - MOVOA X5,X1 - PADDL X8,X1 - MOVOA X1,X2 - PSLLL $13,X1 - PXOR X1,X14 - PSRLL $19,X2 - PXOR X2,X14 - MOVOA X10,X1 - PADDL X4,X1 - MOVOA X1,X2 - PSLLL $18,X1 - PXOR X1,X0 - PSRLL $14,X2 - PXOR X2,X0 - MOVOA 320(SP),X1 - MOVOA X0,320(SP) - MOVOA X8,X0 - PADDL X14,X0 - MOVOA X0,X2 - PSLLL $18,X0 - PXOR X0,X12 - PSRLL $14,X2 - PXOR X2,X12 - MOVOA X11,X0 - PADDL X1,X0 - MOVOA X0,X2 - PSLLL $7,X0 - PXOR X0,X6 - PSRLL $25,X2 - PXOR X2,X6 - MOVOA 336(SP),X2 - MOVOA X12,336(SP) - MOVOA X3,X0 - PADDL X2,X0 - MOVOA X0,X12 - PSLLL $7,X0 - PXOR X0,X13 - PSRLL $25,X12 - PXOR X12,X13 - MOVOA X1,X0 - PADDL X6,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X15 - PSRLL $23,X12 - PXOR X12,X15 - MOVOA X2,X0 - PADDL X13,X0 - MOVOA X0,X12 - PSLLL $9,X0 - PXOR X0,X9 - PSRLL $23,X12 - PXOR X12,X9 - MOVOA X6,X0 - PADDL X15,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X11 - PSRLL $19,X12 - PXOR X12,X11 - MOVOA X13,X0 - PADDL X9,X0 - MOVOA X0,X12 - PSLLL $13,X0 - PXOR X0,X3 - PSRLL $19,X12 - PXOR X12,X3 - MOVOA X15,X0 - PADDL X11,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X1 - PSRLL $14,X12 - PXOR X12,X1 - MOVOA X9,X0 - PADDL X3,X0 - MOVOA X0,X12 - PSLLL $18,X0 - PXOR X0,X2 - PSRLL $14,X12 - PXOR X12,X2 - MOVOA 320(SP),X12 - MOVOA 336(SP),X0 - SUBQ $2,DX - JA MAINLOOP1 - PADDL 112(SP),X12 - PADDL 176(SP),X7 - PADDL 224(SP),X10 - PADDL 272(SP),X4 - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 0(SI),DX - XORL 4(SI),CX - XORL 8(SI),R8 - XORL 12(SI),R9 - MOVL DX,0(DI) - MOVL CX,4(DI) - MOVL R8,8(DI) - MOVL R9,12(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 64(SI),DX - XORL 68(SI),CX - XORL 72(SI),R8 - XORL 76(SI),R9 - MOVL DX,64(DI) - MOVL CX,68(DI) - MOVL R8,72(DI) - MOVL R9,76(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - PSHUFL $0X39,X12,X12 - PSHUFL $0X39,X7,X7 - PSHUFL $0X39,X10,X10 - PSHUFL $0X39,X4,X4 - XORL 128(SI),DX - XORL 132(SI),CX - XORL 136(SI),R8 - XORL 140(SI),R9 - MOVL DX,128(DI) - MOVL CX,132(DI) - MOVL R8,136(DI) - MOVL R9,140(DI) - MOVD X12,DX - MOVD X7,CX - MOVD X10,R8 - MOVD X4,R9 - XORL 192(SI),DX - XORL 196(SI),CX - XORL 200(SI),R8 - XORL 204(SI),R9 - MOVL DX,192(DI) - MOVL CX,196(DI) - MOVL R8,200(DI) - MOVL R9,204(DI) - PADDL 240(SP),X14 - PADDL 64(SP),X0 - PADDL 128(SP),X5 - PADDL 192(SP),X8 - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 16(SI),DX - XORL 20(SI),CX - XORL 24(SI),R8 - XORL 28(SI),R9 - MOVL DX,16(DI) - MOVL CX,20(DI) - MOVL R8,24(DI) - MOVL R9,28(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 80(SI),DX - XORL 84(SI),CX - XORL 88(SI),R8 - XORL 92(SI),R9 - MOVL DX,80(DI) - MOVL CX,84(DI) - MOVL R8,88(DI) - MOVL R9,92(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - PSHUFL $0X39,X14,X14 - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X5,X5 - PSHUFL $0X39,X8,X8 - XORL 144(SI),DX - XORL 148(SI),CX - XORL 152(SI),R8 - XORL 156(SI),R9 - MOVL DX,144(DI) - MOVL CX,148(DI) - MOVL R8,152(DI) - MOVL R9,156(DI) - MOVD X14,DX - MOVD X0,CX - MOVD X5,R8 - MOVD X8,R9 - XORL 208(SI),DX - XORL 212(SI),CX - XORL 216(SI),R8 - XORL 220(SI),R9 - MOVL DX,208(DI) - MOVL CX,212(DI) - MOVL R8,216(DI) - MOVL R9,220(DI) - PADDL 288(SP),X15 - PADDL 304(SP),X11 - PADDL 80(SP),X1 - PADDL 144(SP),X6 - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 32(SI),DX - XORL 36(SI),CX - XORL 40(SI),R8 - XORL 44(SI),R9 - MOVL DX,32(DI) - MOVL CX,36(DI) - MOVL R8,40(DI) - MOVL R9,44(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 96(SI),DX - XORL 100(SI),CX - XORL 104(SI),R8 - XORL 108(SI),R9 - MOVL DX,96(DI) - MOVL CX,100(DI) - MOVL R8,104(DI) - MOVL R9,108(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - PSHUFL $0X39,X15,X15 - PSHUFL $0X39,X11,X11 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X6,X6 - XORL 160(SI),DX - XORL 164(SI),CX - XORL 168(SI),R8 - XORL 172(SI),R9 - MOVL DX,160(DI) - MOVL CX,164(DI) - MOVL R8,168(DI) - MOVL R9,172(DI) - MOVD X15,DX - MOVD X11,CX - MOVD X1,R8 - MOVD X6,R9 - XORL 224(SI),DX - XORL 228(SI),CX - XORL 232(SI),R8 - XORL 236(SI),R9 - MOVL DX,224(DI) - MOVL CX,228(DI) - MOVL R8,232(DI) - MOVL R9,236(DI) - PADDL 160(SP),X13 - PADDL 208(SP),X9 - PADDL 256(SP),X3 - PADDL 96(SP),X2 - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 48(SI),DX - XORL 52(SI),CX - XORL 56(SI),R8 - XORL 60(SI),R9 - MOVL DX,48(DI) - MOVL CX,52(DI) - MOVL R8,56(DI) - MOVL R9,60(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 112(SI),DX - XORL 116(SI),CX - XORL 120(SI),R8 - XORL 124(SI),R9 - MOVL DX,112(DI) - MOVL CX,116(DI) - MOVL R8,120(DI) - MOVL R9,124(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - PSHUFL $0X39,X13,X13 - PSHUFL $0X39,X9,X9 - PSHUFL $0X39,X3,X3 - PSHUFL $0X39,X2,X2 - XORL 176(SI),DX - XORL 180(SI),CX - XORL 184(SI),R8 - XORL 188(SI),R9 - MOVL DX,176(DI) - MOVL CX,180(DI) - MOVL R8,184(DI) - MOVL R9,188(DI) - MOVD X13,DX - MOVD X9,CX - MOVD X3,R8 - MOVD X2,R9 - XORL 240(SI),DX - XORL 244(SI),CX - XORL 248(SI),R8 - XORL 252(SI),R9 - MOVL DX,240(DI) - MOVL CX,244(DI) - MOVL R8,248(DI) - MOVL R9,252(DI) - MOVQ 352(SP),R9 - SUBQ $256,R9 - ADDQ $256,SI - ADDQ $256,DI - CMPQ R9,$256 - JAE BYTESATLEAST256 - CMPQ R9,$0 - JBE DONE - BYTESBETWEEN1AND255: - CMPQ R9,$64 - JAE NOCOPY - MOVQ DI,DX - LEAQ 360(SP),DI - MOVQ R9,CX - REP; MOVSB - LEAQ 360(SP),DI - LEAQ 360(SP),SI - NOCOPY: - MOVQ R9,352(SP) - MOVOA 48(SP),X0 - MOVOA 0(SP),X1 - MOVOA 16(SP),X2 - MOVOA 32(SP),X3 - MOVOA X1,X4 - MOVQ $20,CX - MAINLOOP2: - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X3 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X3,X3 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X1 - PSHUFL $0X4E,X2,X2 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X1,X1 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X1 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X1,X1 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X3 - PSHUFL $0X4E,X2,X2 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X3,X3 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X3 - PXOR X6,X3 - PADDL X3,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X3,X3 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X1 - PSHUFL $0X4E,X2,X2 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X3,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X1,X1 - PXOR X6,X0 - PADDL X0,X4 - MOVOA X0,X5 - MOVOA X4,X6 - PSLLL $7,X4 - PSRLL $25,X6 - PXOR X4,X1 - PXOR X6,X1 - PADDL X1,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $9,X5 - PSRLL $23,X6 - PXOR X5,X2 - PSHUFL $0X93,X1,X1 - PXOR X6,X2 - PADDL X2,X4 - MOVOA X2,X5 - MOVOA X4,X6 - PSLLL $13,X4 - PSRLL $19,X6 - PXOR X4,X3 - PSHUFL $0X4E,X2,X2 - PXOR X6,X3 - SUBQ $4,CX - PADDL X3,X5 - MOVOA X1,X4 - MOVOA X5,X6 - PSLLL $18,X5 - PXOR X7,X7 - PSRLL $14,X6 - PXOR X5,X0 - PSHUFL $0X39,X3,X3 - PXOR X6,X0 - JA MAINLOOP2 - PADDL 48(SP),X0 - PADDL 0(SP),X1 - PADDL 16(SP),X2 - PADDL 32(SP),X3 - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 0(SI),CX - XORL 48(SI),R8 - XORL 32(SI),R9 - XORL 16(SI),AX - MOVL CX,0(DI) - MOVL R8,48(DI) - MOVL R9,32(DI) - MOVL AX,16(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 20(SI),CX - XORL 4(SI),R8 - XORL 52(SI),R9 - XORL 36(SI),AX - MOVL CX,20(DI) - MOVL R8,4(DI) - MOVL R9,52(DI) - MOVL AX,36(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - PSHUFL $0X39,X0,X0 - PSHUFL $0X39,X1,X1 - PSHUFL $0X39,X2,X2 - PSHUFL $0X39,X3,X3 - XORL 40(SI),CX - XORL 24(SI),R8 - XORL 8(SI),R9 - XORL 56(SI),AX - MOVL CX,40(DI) - MOVL R8,24(DI) - MOVL R9,8(DI) - MOVL AX,56(DI) - MOVD X0,CX - MOVD X1,R8 - MOVD X2,R9 - MOVD X3,AX - XORL 60(SI),CX - XORL 44(SI),R8 - XORL 28(SI),R9 - XORL 12(SI),AX - MOVL CX,60(DI) - MOVL R8,44(DI) - MOVL R9,28(DI) - MOVL AX,12(DI) - MOVQ 352(SP),R9 - MOVL 16(SP),CX - MOVL 36 (SP),R8 - ADDQ $1,CX - SHLQ $32,R8 - ADDQ R8,CX - MOVQ CX,R8 - SHRQ $32,R8 - MOVL CX,16(SP) - MOVL R8, 36 (SP) - CMPQ R9,$64 - JA BYTESATLEAST65 - JAE BYTESATLEAST64 - MOVQ DI,SI - MOVQ DX,DI - MOVQ R9,CX - REP; MOVSB - BYTESATLEAST64: - DONE: - MOVQ R12,SP - RET - BYTESATLEAST65: - SUBQ $64,R9 - ADDQ $64,DI - ADDQ $64,SI - JMP BYTESBETWEEN1AND255 diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go deleted file mode 100644 index 8a46bd2b..00000000 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2019 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 !amd64 appengine gccgo - -package salsa - -// XORKeyStream crypts bytes from in to out using the given key and counters. -// In and out must overlap entirely or not at all. Counter -// contains the raw salsa20 counter bytes (both nonce and block counter). -func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) { - genericXORKeyStream(out, in, counter, key) -} diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go deleted file mode 100644 index 68169c6d..00000000 --- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package salsa - -const rounds = 20 - -// core applies the Salsa20 core function to 16-byte input in, 32-byte key k, -// and 16-byte constant c, and puts the result into 64-byte array out. -func core(out *[64]byte, in *[16]byte, k *[32]byte, c *[16]byte) { - j0 := uint32(c[0]) | uint32(c[1])<<8 | uint32(c[2])<<16 | uint32(c[3])<<24 - j1 := uint32(k[0]) | uint32(k[1])<<8 | uint32(k[2])<<16 | uint32(k[3])<<24 - j2 := uint32(k[4]) | uint32(k[5])<<8 | uint32(k[6])<<16 | uint32(k[7])<<24 - j3 := uint32(k[8]) | uint32(k[9])<<8 | uint32(k[10])<<16 | uint32(k[11])<<24 - j4 := uint32(k[12]) | uint32(k[13])<<8 | uint32(k[14])<<16 | uint32(k[15])<<24 - j5 := uint32(c[4]) | uint32(c[5])<<8 | uint32(c[6])<<16 | uint32(c[7])<<24 - j6 := uint32(in[0]) | uint32(in[1])<<8 | uint32(in[2])<<16 | uint32(in[3])<<24 - j7 := uint32(in[4]) | uint32(in[5])<<8 | uint32(in[6])<<16 | uint32(in[7])<<24 - j8 := uint32(in[8]) | uint32(in[9])<<8 | uint32(in[10])<<16 | uint32(in[11])<<24 - j9 := uint32(in[12]) | uint32(in[13])<<8 | uint32(in[14])<<16 | uint32(in[15])<<24 - j10 := uint32(c[8]) | uint32(c[9])<<8 | uint32(c[10])<<16 | uint32(c[11])<<24 - j11 := uint32(k[16]) | uint32(k[17])<<8 | uint32(k[18])<<16 | uint32(k[19])<<24 - j12 := uint32(k[20]) | uint32(k[21])<<8 | uint32(k[22])<<16 | uint32(k[23])<<24 - j13 := uint32(k[24]) | uint32(k[25])<<8 | uint32(k[26])<<16 | uint32(k[27])<<24 - j14 := uint32(k[28]) | uint32(k[29])<<8 | uint32(k[30])<<16 | uint32(k[31])<<24 - j15 := uint32(c[12]) | uint32(c[13])<<8 | uint32(c[14])<<16 | uint32(c[15])<<24 - - x0, x1, x2, x3, x4, x5, x6, x7, x8 := j0, j1, j2, j3, j4, j5, j6, j7, j8 - x9, x10, x11, x12, x13, x14, x15 := j9, j10, j11, j12, j13, j14, j15 - - for i := 0; i < rounds; i += 2 { - u := x0 + x12 - x4 ^= u<<7 | u>>(32-7) - u = x4 + x0 - x8 ^= u<<9 | u>>(32-9) - u = x8 + x4 - x12 ^= u<<13 | u>>(32-13) - u = x12 + x8 - x0 ^= u<<18 | u>>(32-18) - - u = x5 + x1 - x9 ^= u<<7 | u>>(32-7) - u = x9 + x5 - x13 ^= u<<9 | u>>(32-9) - u = x13 + x9 - x1 ^= u<<13 | u>>(32-13) - u = x1 + x13 - x5 ^= u<<18 | u>>(32-18) - - u = x10 + x6 - x14 ^= u<<7 | u>>(32-7) - u = x14 + x10 - x2 ^= u<<9 | u>>(32-9) - u = x2 + x14 - x6 ^= u<<13 | u>>(32-13) - u = x6 + x2 - x10 ^= u<<18 | u>>(32-18) - - u = x15 + x11 - x3 ^= u<<7 | u>>(32-7) - u = x3 + x15 - x7 ^= u<<9 | u>>(32-9) - u = x7 + x3 - x11 ^= u<<13 | u>>(32-13) - u = x11 + x7 - x15 ^= u<<18 | u>>(32-18) - - u = x0 + x3 - x1 ^= u<<7 | u>>(32-7) - u = x1 + x0 - x2 ^= u<<9 | u>>(32-9) - u = x2 + x1 - x3 ^= u<<13 | u>>(32-13) - u = x3 + x2 - x0 ^= u<<18 | u>>(32-18) - - u = x5 + x4 - x6 ^= u<<7 | u>>(32-7) - u = x6 + x5 - x7 ^= u<<9 | u>>(32-9) - u = x7 + x6 - x4 ^= u<<13 | u>>(32-13) - u = x4 + x7 - x5 ^= u<<18 | u>>(32-18) - - u = x10 + x9 - x11 ^= u<<7 | u>>(32-7) - u = x11 + x10 - x8 ^= u<<9 | u>>(32-9) - u = x8 + x11 - x9 ^= u<<13 | u>>(32-13) - u = x9 + x8 - x10 ^= u<<18 | u>>(32-18) - - u = x15 + x14 - x12 ^= u<<7 | u>>(32-7) - u = x12 + x15 - x13 ^= u<<9 | u>>(32-9) - u = x13 + x12 - x14 ^= u<<13 | u>>(32-13) - u = x14 + x13 - x15 ^= u<<18 | u>>(32-18) - } - x0 += j0 - x1 += j1 - x2 += j2 - x3 += j3 - x4 += j4 - x5 += j5 - x6 += j6 - x7 += j7 - x8 += j8 - x9 += j9 - x10 += j10 - x11 += j11 - x12 += j12 - x13 += j13 - x14 += j14 - x15 += j15 - - out[0] = byte(x0) - out[1] = byte(x0 >> 8) - out[2] = byte(x0 >> 16) - out[3] = byte(x0 >> 24) - - out[4] = byte(x1) - out[5] = byte(x1 >> 8) - out[6] = byte(x1 >> 16) - out[7] = byte(x1 >> 24) - - out[8] = byte(x2) - out[9] = byte(x2 >> 8) - out[10] = byte(x2 >> 16) - out[11] = byte(x2 >> 24) - - out[12] = byte(x3) - out[13] = byte(x3 >> 8) - out[14] = byte(x3 >> 16) - out[15] = byte(x3 >> 24) - - out[16] = byte(x4) - out[17] = byte(x4 >> 8) - out[18] = byte(x4 >> 16) - out[19] = byte(x4 >> 24) - - out[20] = byte(x5) - out[21] = byte(x5 >> 8) - out[22] = byte(x5 >> 16) - out[23] = byte(x5 >> 24) - - out[24] = byte(x6) - out[25] = byte(x6 >> 8) - out[26] = byte(x6 >> 16) - out[27] = byte(x6 >> 24) - - out[28] = byte(x7) - out[29] = byte(x7 >> 8) - out[30] = byte(x7 >> 16) - out[31] = byte(x7 >> 24) - - out[32] = byte(x8) - out[33] = byte(x8 >> 8) - out[34] = byte(x8 >> 16) - out[35] = byte(x8 >> 24) - - out[36] = byte(x9) - out[37] = byte(x9 >> 8) - out[38] = byte(x9 >> 16) - out[39] = byte(x9 >> 24) - - out[40] = byte(x10) - out[41] = byte(x10 >> 8) - out[42] = byte(x10 >> 16) - out[43] = byte(x10 >> 24) - - out[44] = byte(x11) - out[45] = byte(x11 >> 8) - out[46] = byte(x11 >> 16) - out[47] = byte(x11 >> 24) - - out[48] = byte(x12) - out[49] = byte(x12 >> 8) - out[50] = byte(x12 >> 16) - out[51] = byte(x12 >> 24) - - out[52] = byte(x13) - out[53] = byte(x13 >> 8) - out[54] = byte(x13 >> 16) - out[55] = byte(x13 >> 24) - - out[56] = byte(x14) - out[57] = byte(x14 >> 8) - out[58] = byte(x14 >> 16) - out[59] = byte(x14 >> 24) - - out[60] = byte(x15) - out[61] = byte(x15 >> 8) - out[62] = byte(x15 >> 16) - out[63] = byte(x15 >> 24) -} - -// genericXORKeyStream is the generic implementation of XORKeyStream to be used -// when no assembly implementation is available. -func genericXORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) { - var block [64]byte - var counterCopy [16]byte - copy(counterCopy[:], counter[:]) - - for len(in) >= 64 { - core(&block, &counterCopy, key, &Sigma) - for i, x := range block { - out[i] = in[i] ^ x - } - u := uint32(1) - for i := 8; i < 16; i++ { - u += uint32(counterCopy[i]) - counterCopy[i] = byte(u) - u >>= 8 - } - in = in[64:] - out = out[64:] - } - - if len(in) > 0 { - core(&block, &counterCopy, key, &Sigma) - for i, v := range in { - out[i] = v ^ block[i] - } - } -} diff --git a/vendor/golang.org/x/crypto/scrypt/scrypt.go b/vendor/golang.org/x/crypto/scrypt/scrypt.go index 2f81fe41..3362afd1 100644 --- a/vendor/golang.org/x/crypto/scrypt/scrypt.go +++ b/vendor/golang.org/x/crypto/scrypt/scrypt.go @@ -10,7 +10,6 @@ package scrypt // import "golang.org/x/crypto/scrypt" import ( "crypto/sha256" "errors" - "math/bits" "golang.org/x/crypto/pbkdf2" ) @@ -53,45 +52,77 @@ func salsaXOR(tmp *[16]uint32, in, out []uint32) { x9, x10, x11, x12, x13, x14, x15 := w9, w10, w11, w12, w13, w14, w15 for i := 0; i < 8; i += 2 { - x4 ^= bits.RotateLeft32(x0+x12, 7) - x8 ^= bits.RotateLeft32(x4+x0, 9) - x12 ^= bits.RotateLeft32(x8+x4, 13) - x0 ^= bits.RotateLeft32(x12+x8, 18) + u := x0 + x12 + x4 ^= u<<7 | u>>(32-7) + u = x4 + x0 + x8 ^= u<<9 | u>>(32-9) + u = x8 + x4 + x12 ^= u<<13 | u>>(32-13) + u = x12 + x8 + x0 ^= u<<18 | u>>(32-18) - x9 ^= bits.RotateLeft32(x5+x1, 7) - x13 ^= bits.RotateLeft32(x9+x5, 9) - x1 ^= bits.RotateLeft32(x13+x9, 13) - x5 ^= bits.RotateLeft32(x1+x13, 18) + u = x5 + x1 + x9 ^= u<<7 | u>>(32-7) + u = x9 + x5 + x13 ^= u<<9 | u>>(32-9) + u = x13 + x9 + x1 ^= u<<13 | u>>(32-13) + u = x1 + x13 + x5 ^= u<<18 | u>>(32-18) - x14 ^= bits.RotateLeft32(x10+x6, 7) - x2 ^= bits.RotateLeft32(x14+x10, 9) - x6 ^= bits.RotateLeft32(x2+x14, 13) - x10 ^= bits.RotateLeft32(x6+x2, 18) + u = x10 + x6 + x14 ^= u<<7 | u>>(32-7) + u = x14 + x10 + x2 ^= u<<9 | u>>(32-9) + u = x2 + x14 + x6 ^= u<<13 | u>>(32-13) + u = x6 + x2 + x10 ^= u<<18 | u>>(32-18) - x3 ^= bits.RotateLeft32(x15+x11, 7) - x7 ^= bits.RotateLeft32(x3+x15, 9) - x11 ^= bits.RotateLeft32(x7+x3, 13) - x15 ^= bits.RotateLeft32(x11+x7, 18) + u = x15 + x11 + x3 ^= u<<7 | u>>(32-7) + u = x3 + x15 + x7 ^= u<<9 | u>>(32-9) + u = x7 + x3 + x11 ^= u<<13 | u>>(32-13) + u = x11 + x7 + x15 ^= u<<18 | u>>(32-18) - x1 ^= bits.RotateLeft32(x0+x3, 7) - x2 ^= bits.RotateLeft32(x1+x0, 9) - x3 ^= bits.RotateLeft32(x2+x1, 13) - x0 ^= bits.RotateLeft32(x3+x2, 18) + u = x0 + x3 + x1 ^= u<<7 | u>>(32-7) + u = x1 + x0 + x2 ^= u<<9 | u>>(32-9) + u = x2 + x1 + x3 ^= u<<13 | u>>(32-13) + u = x3 + x2 + x0 ^= u<<18 | u>>(32-18) - x6 ^= bits.RotateLeft32(x5+x4, 7) - x7 ^= bits.RotateLeft32(x6+x5, 9) - x4 ^= bits.RotateLeft32(x7+x6, 13) - x5 ^= bits.RotateLeft32(x4+x7, 18) + u = x5 + x4 + x6 ^= u<<7 | u>>(32-7) + u = x6 + x5 + x7 ^= u<<9 | u>>(32-9) + u = x7 + x6 + x4 ^= u<<13 | u>>(32-13) + u = x4 + x7 + x5 ^= u<<18 | u>>(32-18) - x11 ^= bits.RotateLeft32(x10+x9, 7) - x8 ^= bits.RotateLeft32(x11+x10, 9) - x9 ^= bits.RotateLeft32(x8+x11, 13) - x10 ^= bits.RotateLeft32(x9+x8, 18) + u = x10 + x9 + x11 ^= u<<7 | u>>(32-7) + u = x11 + x10 + x8 ^= u<<9 | u>>(32-9) + u = x8 + x11 + x9 ^= u<<13 | u>>(32-13) + u = x9 + x8 + x10 ^= u<<18 | u>>(32-18) - x12 ^= bits.RotateLeft32(x15+x14, 7) - x13 ^= bits.RotateLeft32(x12+x15, 9) - x14 ^= bits.RotateLeft32(x13+x12, 13) - x15 ^= bits.RotateLeft32(x14+x13, 18) + u = x15 + x14 + x12 ^= u<<7 | u>>(32-7) + u = x12 + x15 + x13 ^= u<<9 | u>>(32-9) + u = x13 + x12 + x14 ^= u<<13 | u>>(32-13) + u = x14 + x13 + x15 ^= u<<18 | u>>(32-18) } x0 += w0 x1 += w1 diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go index b6cbc5c4..f1fb79cc 100644 --- a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go +++ b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go @@ -12,8 +12,6 @@ package sha3 import ( "hash" - - "golang.org/x/sys/cpu" ) // codes represent 7-bit KIMD/KLMD function codes as defined in @@ -31,6 +29,13 @@ const ( nopad = 0x100 ) +// hasMSA6 reports whether the machine supports the SHA-3 and SHAKE function +// codes, as defined in message-security-assist extension 6. +func hasMSA6() bool + +// hasAsm caches the result of hasMSA6 (which might be expensive to call). +var hasAsm = hasMSA6() + // kimd is a wrapper for the 'compute intermediate message digest' instruction. // src must be a multiple of the rate for the given function code. //go:noescape @@ -232,7 +237,7 @@ func (s *asmState) Clone() ShakeHash { // new224Asm returns an assembly implementation of SHA3-224 if available, // otherwise it returns nil. func new224Asm() hash.Hash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(sha3_224) } return nil @@ -241,7 +246,7 @@ func new224Asm() hash.Hash { // new256Asm returns an assembly implementation of SHA3-256 if available, // otherwise it returns nil. func new256Asm() hash.Hash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(sha3_256) } return nil @@ -250,7 +255,7 @@ func new256Asm() hash.Hash { // new384Asm returns an assembly implementation of SHA3-384 if available, // otherwise it returns nil. func new384Asm() hash.Hash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(sha3_384) } return nil @@ -259,7 +264,7 @@ func new384Asm() hash.Hash { // new512Asm returns an assembly implementation of SHA3-512 if available, // otherwise it returns nil. func new512Asm() hash.Hash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(sha3_512) } return nil @@ -268,7 +273,7 @@ func new512Asm() hash.Hash { // newShake128Asm returns an assembly implementation of SHAKE-128 if available, // otherwise it returns nil. func newShake128Asm() ShakeHash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(shake_128) } return nil @@ -277,7 +282,7 @@ func newShake128Asm() ShakeHash { // newShake256Asm returns an assembly implementation of SHAKE-256 if available, // otherwise it returns nil. func newShake256Asm() ShakeHash { - if cpu.S390X.HasSHA3 { + if hasAsm { return newAsmState(shake_256) } return nil diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.s b/vendor/golang.org/x/crypto/sha3/sha3_s390x.s index b2ef69f8..20978fc7 100644 --- a/vendor/golang.org/x/crypto/sha3/sha3_s390x.s +++ b/vendor/golang.org/x/crypto/sha3/sha3_s390x.s @@ -6,10 +6,26 @@ #include "textflag.h" -// func kimd(function code, chain *[200]byte, src []byte) +TEXT ·hasMSA6(SB), NOSPLIT, $16-1 + MOVD $0, R0 // KIMD-Query function code + MOVD $tmp-16(SP), R1 // parameter block + XC $16, (R1), (R1) // clear the parameter block + WORD $0xB93E0002 // KIMD --, -- + WORD $0x91FC1004 // TM 4(R1), 0xFC (test bits [32-37]) + BVS yes + +no: + MOVB $0, ret+0(FP) + RET + +yes: + MOVB $1, ret+0(FP) + RET + +// func kimd(function code, params *[200]byte, src []byte) TEXT ·kimd(SB), NOFRAME|NOSPLIT, $0-40 MOVD function+0(FP), R0 - MOVD chain+8(FP), R1 + MOVD params+8(FP), R1 LMG src+16(FP), R2, R3 // R2=base, R3=len continue: @@ -18,11 +34,11 @@ continue: MOVD $0, R0 // reset R0 for pre-go1.8 compilers RET -// func klmd(function code, chain *[200]byte, dst, src []byte) +// func klmd(function code, params *[200]byte, dst, src []byte) TEXT ·klmd(SB), NOFRAME|NOSPLIT, $0-64 // TODO: SHAKE support MOVD function+0(FP), R0 - MOVD chain+8(FP), R1 + MOVD params+8(FP), R1 LMG dst+16(FP), R2, R3 // R2=base, R3=len LMG src+40(FP), R4, R5 // R4=base, R5=len diff --git a/vendor/golang.org/x/crypto/sha3/shake.go b/vendor/golang.org/x/crypto/sha3/shake.go index d7be2954..97c9b062 100644 --- a/vendor/golang.org/x/crypto/sha3/shake.go +++ b/vendor/golang.org/x/crypto/sha3/shake.go @@ -5,18 +5,10 @@ package sha3 // This file defines the ShakeHash interface, and provides -// functions for creating SHAKE and cSHAKE instances, as well as utility +// functions for creating SHAKE instances, as well as utility // functions for hashing bytes to arbitrary-length output. -// -// -// SHAKE implementation is based on FIPS PUB 202 [1] -// cSHAKE implementations is based on NIST SP 800-185 [2] -// -// [1] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf -// [2] https://doi.org/10.6028/NIST.SP.800-185 import ( - "encoding/binary" "io" ) @@ -39,77 +31,8 @@ type ShakeHash interface { Reset() } -// cSHAKE specific context -type cshakeState struct { - *state // SHA-3 state context and Read/Write operations - - // initBlock is the cSHAKE specific initialization set of bytes. It is initialized - // by newCShake function and stores concatenation of N followed by S, encoded - // by the method specified in 3.3 of [1]. - // It is stored here in order for Reset() to be able to put context into - // initial state. - initBlock []byte -} - -// Consts for configuring initial SHA-3 state -const ( - dsbyteShake = 0x1f - dsbyteCShake = 0x04 - rate128 = 168 - rate256 = 136 -) - -func bytepad(input []byte, w int) []byte { - // leftEncode always returns max 9 bytes - buf := make([]byte, 0, 9+len(input)+w) - buf = append(buf, leftEncode(uint64(w))...) - buf = append(buf, input...) - padlen := w - (len(buf) % w) - return append(buf, make([]byte, padlen)...) -} - -func leftEncode(value uint64) []byte { - var b [9]byte - binary.BigEndian.PutUint64(b[1:], value) - // Trim all but last leading zero bytes - i := byte(1) - for i < 8 && b[i] == 0 { - i++ - } - // Prepend number of encoded bytes - b[i-1] = 9 - i - return b[i-1:] -} - -func newCShake(N, S []byte, rate int, dsbyte byte) ShakeHash { - c := cshakeState{state: &state{rate: rate, dsbyte: dsbyte}} - - // leftEncode returns max 9 bytes - c.initBlock = make([]byte, 0, 9*2+len(N)+len(S)) - c.initBlock = append(c.initBlock, leftEncode(uint64(len(N)*8))...) - c.initBlock = append(c.initBlock, N...) - c.initBlock = append(c.initBlock, leftEncode(uint64(len(S)*8))...) - c.initBlock = append(c.initBlock, S...) - c.Write(bytepad(c.initBlock, c.rate)) - return &c -} - -// Reset resets the hash to initial state. -func (c *cshakeState) Reset() { - c.state.Reset() - c.Write(bytepad(c.initBlock, c.rate)) -} - -// Clone returns copy of a cSHAKE context within its current state. -func (c *cshakeState) Clone() ShakeHash { - b := make([]byte, len(c.initBlock)) - copy(b, c.initBlock) - return &cshakeState{state: c.clone(), initBlock: b} -} - -// Clone returns copy of SHAKE context within its current state. -func (c *state) Clone() ShakeHash { - return c.clone() +func (d *state) Clone() ShakeHash { + return d.clone() } // NewShake128 creates a new SHAKE128 variable-output-length ShakeHash. @@ -119,7 +42,7 @@ func NewShake128() ShakeHash { if h := newShake128Asm(); h != nil { return h } - return &state{rate: rate128, dsbyte: dsbyteShake} + return &state{rate: 168, dsbyte: 0x1f} } // NewShake256 creates a new SHAKE256 variable-output-length ShakeHash. @@ -129,33 +52,7 @@ func NewShake256() ShakeHash { if h := newShake256Asm(); h != nil { return h } - return &state{rate: rate256, dsbyte: dsbyteShake} -} - -// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash, -// a customizable variant of SHAKE128. -// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is -// desired. S is a customization byte string used for domain separation - two cSHAKE -// computations on same input with different S yield unrelated outputs. -// When N and S are both empty, this is equivalent to NewShake128. -func NewCShake128(N, S []byte) ShakeHash { - if len(N) == 0 && len(S) == 0 { - return NewShake128() - } - return newCShake(N, S, rate128, dsbyteCShake) -} - -// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash, -// a customizable variant of SHAKE256. -// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is -// desired. S is a customization byte string used for domain separation - two cSHAKE -// computations on same input with different S yield unrelated outputs. -// When N and S are both empty, this is equivalent to NewShake256. -func NewCShake256(N, S []byte) ShakeHash { - if len(N) == 0 && len(S) == 0 { - return NewShake256() - } - return newCShake(N, S, rate256, dsbyteCShake) + return &state{rate: 136, dsbyte: 0x1f} } // ShakeSum128 writes an arbitrary-length digest of data into hash. diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go index 2f04ee5b..9a887598 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go @@ -7,7 +7,6 @@ package terminal import ( "bytes" "io" - "strconv" "sync" "unicode/utf8" ) @@ -160,10 +159,6 @@ func bytesToKey(b []byte, pasteActive bool) (rune, []byte) { return keyClearScreen, b[1:] case 23: // ^W return keyDeleteWord, b[1:] - case 14: // ^N - return keyDown, b[1:] - case 16: // ^P - return keyUp, b[1:] } } @@ -272,44 +267,34 @@ func (t *Terminal) moveCursorToPos(pos int) { } func (t *Terminal) move(up, down, left, right int) { - m := []rune{} - - // 1 unit up can be expressed as ^[[A or ^[A - // 5 units up can be expressed as ^[[5A - - if up == 1 { - m = append(m, keyEscape, '[', 'A') - } else if up > 1 { - m = append(m, keyEscape, '[') - m = append(m, []rune(strconv.Itoa(up))...) - m = append(m, 'A') + movement := make([]rune, 3*(up+down+left+right)) + m := movement + for i := 0; i < up; i++ { + m[0] = keyEscape + m[1] = '[' + m[2] = 'A' + m = m[3:] + } + for i := 0; i < down; i++ { + m[0] = keyEscape + m[1] = '[' + m[2] = 'B' + m = m[3:] + } + for i := 0; i < left; i++ { + m[0] = keyEscape + m[1] = '[' + m[2] = 'D' + m = m[3:] + } + for i := 0; i < right; i++ { + m[0] = keyEscape + m[1] = '[' + m[2] = 'C' + m = m[3:] } - if down == 1 { - m = append(m, keyEscape, '[', 'B') - } else if down > 1 { - m = append(m, keyEscape, '[') - m = append(m, []rune(strconv.Itoa(down))...) - m = append(m, 'B') - } - - if right == 1 { - m = append(m, keyEscape, '[', 'C') - } else if right > 1 { - m = append(m, keyEscape, '[') - m = append(m, []rune(strconv.Itoa(right))...) - m = append(m, 'C') - } - - if left == 1 { - m = append(m, keyEscape, '[', 'D') - } else if left > 1 { - m = append(m, keyEscape, '[') - m = append(m, []rune(strconv.Itoa(left))...) - m = append(m, 'D') - } - - t.queue(m) + t.queue(movement) } func (t *Terminal) clearLineToRight() { diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go index 5cfdf8f3..6cb8a950 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go @@ -64,15 +64,13 @@ func Restore(fd int, state *State) error { return windows.SetConsoleMode(windows.Handle(fd), state.mode) } -// GetSize returns the visible dimensions of the given terminal. -// -// These dimensions don't include any scrollback buffer height. +// GetSize returns the dimensions of the given terminal. func GetSize(fd int) (width, height int, err error) { var info windows.ConsoleScreenBufferInfo if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil { return 0, 0, err } - return int(info.Window.Right - info.Window.Left + 1), int(info.Window.Bottom - info.Window.Top + 1), nil + return int(info.Size.X), int(info.Size.Y), nil } // ReadPassword reads a line of input from a terminal without local echo. This diff --git a/vendor/golang.org/x/net/bpf/constants.go b/vendor/golang.org/x/net/bpf/constants.go deleted file mode 100644 index 12f3ee83..00000000 --- a/vendor/golang.org/x/net/bpf/constants.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bpf - -// A Register is a register of the BPF virtual machine. -type Register uint16 - -const ( - // RegA is the accumulator register. RegA is always the - // destination register of ALU operations. - RegA Register = iota - // RegX is the indirection register, used by LoadIndirect - // operations. - RegX -) - -// An ALUOp is an arithmetic or logic operation. -type ALUOp uint16 - -// ALU binary operation types. -const ( - ALUOpAdd ALUOp = iota << 4 - ALUOpSub - ALUOpMul - ALUOpDiv - ALUOpOr - ALUOpAnd - ALUOpShiftLeft - ALUOpShiftRight - aluOpNeg // Not exported because it's the only unary ALU operation, and gets its own instruction type. - ALUOpMod - ALUOpXor -) - -// A JumpTest is a comparison operator used in conditional jumps. -type JumpTest uint16 - -// Supported operators for conditional jumps. -// K can be RegX for JumpIfX -const ( - // K == A - JumpEqual JumpTest = iota - // K != A - JumpNotEqual - // K > A - JumpGreaterThan - // K < A - JumpLessThan - // K >= A - JumpGreaterOrEqual - // K <= A - JumpLessOrEqual - // K & A != 0 - JumpBitsSet - // K & A == 0 - JumpBitsNotSet -) - -// An Extension is a function call provided by the kernel that -// performs advanced operations that are expensive or impossible -// within the BPF virtual machine. -// -// Extensions are only implemented by the Linux kernel. -// -// TODO: should we prune this list? Some of these extensions seem -// either broken or near-impossible to use correctly, whereas other -// (len, random, ifindex) are quite useful. -type Extension int - -// Extension functions available in the Linux kernel. -const ( - // extOffset is the negative maximum number of instructions used - // to load instructions by overloading the K argument. - extOffset = -0x1000 - // ExtLen returns the length of the packet. - ExtLen Extension = 1 - // ExtProto returns the packet's L3 protocol type. - ExtProto Extension = 0 - // ExtType returns the packet's type (skb->pkt_type in the kernel) - // - // TODO: better documentation. How nice an API do we want to - // provide for these esoteric extensions? - ExtType Extension = 4 - // ExtPayloadOffset returns the offset of the packet payload, or - // the first protocol header that the kernel does not know how to - // parse. - ExtPayloadOffset Extension = 52 - // ExtInterfaceIndex returns the index of the interface on which - // the packet was received. - ExtInterfaceIndex Extension = 8 - // ExtNetlinkAttr returns the netlink attribute of type X at - // offset A. - ExtNetlinkAttr Extension = 12 - // ExtNetlinkAttrNested returns the nested netlink attribute of - // type X at offset A. - ExtNetlinkAttrNested Extension = 16 - // ExtMark returns the packet's mark value. - ExtMark Extension = 20 - // ExtQueue returns the packet's assigned hardware queue. - ExtQueue Extension = 24 - // ExtLinkLayerType returns the packet's hardware address type - // (e.g. Ethernet, Infiniband). - ExtLinkLayerType Extension = 28 - // ExtRXHash returns the packets receive hash. - // - // TODO: figure out what this rxhash actually is. - ExtRXHash Extension = 32 - // ExtCPUID returns the ID of the CPU processing the current - // packet. - ExtCPUID Extension = 36 - // ExtVLANTag returns the packet's VLAN tag. - ExtVLANTag Extension = 44 - // ExtVLANTagPresent returns non-zero if the packet has a VLAN - // tag. - // - // TODO: I think this might be a lie: it reads bit 0x1000 of the - // VLAN header, which changed meaning in recent revisions of the - // spec - this extension may now return meaningless information. - ExtVLANTagPresent Extension = 48 - // ExtVLANProto returns 0x8100 if the frame has a VLAN header, - // 0x88a8 if the frame has a "Q-in-Q" double VLAN header, or some - // other value if no VLAN information is present. - ExtVLANProto Extension = 60 - // ExtRand returns a uniformly random uint32. - ExtRand Extension = 56 -) - -// The following gives names to various bit patterns used in opcode construction. - -const ( - opMaskCls uint16 = 0x7 - // opClsLoad masks - opMaskLoadDest = 0x01 - opMaskLoadWidth = 0x18 - opMaskLoadMode = 0xe0 - // opClsALU & opClsJump - opMaskOperand = 0x08 - opMaskOperator = 0xf0 -) - -const ( - // +---------------+-----------------+---+---+---+ - // | AddrMode (3b) | LoadWidth (2b) | 0 | 0 | 0 | - // +---------------+-----------------+---+---+---+ - opClsLoadA uint16 = iota - // +---------------+-----------------+---+---+---+ - // | AddrMode (3b) | LoadWidth (2b) | 0 | 0 | 1 | - // +---------------+-----------------+---+---+---+ - opClsLoadX - // +---+---+---+---+---+---+---+---+ - // | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | - // +---+---+---+---+---+---+---+---+ - opClsStoreA - // +---+---+---+---+---+---+---+---+ - // | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | - // +---+---+---+---+---+---+---+---+ - opClsStoreX - // +---------------+-----------------+---+---+---+ - // | Operator (4b) | OperandSrc (1b) | 1 | 0 | 0 | - // +---------------+-----------------+---+---+---+ - opClsALU - // +-----------------------------+---+---+---+---+ - // | TestOperator (4b) | 0 | 1 | 0 | 1 | - // +-----------------------------+---+---+---+---+ - opClsJump - // +---+-------------------------+---+---+---+---+ - // | 0 | 0 | 0 | RetSrc (1b) | 0 | 1 | 1 | 0 | - // +---+-------------------------+---+---+---+---+ - opClsReturn - // +---+-------------------------+---+---+---+---+ - // | 0 | 0 | 0 | TXAorTAX (1b) | 0 | 1 | 1 | 1 | - // +---+-------------------------+---+---+---+---+ - opClsMisc -) - -const ( - opAddrModeImmediate uint16 = iota << 5 - opAddrModeAbsolute - opAddrModeIndirect - opAddrModeScratch - opAddrModePacketLen // actually an extension, not an addressing mode. - opAddrModeMemShift -) - -const ( - opLoadWidth4 uint16 = iota << 3 - opLoadWidth2 - opLoadWidth1 -) - -// Operand for ALU and Jump instructions -type opOperand uint16 - -// Supported operand sources. -const ( - opOperandConstant opOperand = iota << 3 - opOperandX -) - -// An jumpOp is a conditional jump condition. -type jumpOp uint16 - -// Supported jump conditions. -const ( - opJumpAlways jumpOp = iota << 4 - opJumpEqual - opJumpGT - opJumpGE - opJumpSet -) - -const ( - opRetSrcConstant uint16 = iota << 4 - opRetSrcA -) - -const ( - opMiscTAX = 0x00 - opMiscTXA = 0x80 -) diff --git a/vendor/golang.org/x/net/bpf/instructions.go b/vendor/golang.org/x/net/bpf/instructions.go deleted file mode 100644 index 3cffcaa0..00000000 --- a/vendor/golang.org/x/net/bpf/instructions.go +++ /dev/null @@ -1,726 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bpf - -import "fmt" - -// An Instruction is one instruction executed by the BPF virtual -// machine. -type Instruction interface { - // Assemble assembles the Instruction into a RawInstruction. - Assemble() (RawInstruction, error) -} - -// A RawInstruction is a raw BPF virtual machine instruction. -type RawInstruction struct { - // Operation to execute. - Op uint16 - // For conditional jump instructions, the number of instructions - // to skip if the condition is true/false. - Jt uint8 - Jf uint8 - // Constant parameter. The meaning depends on the Op. - K uint32 -} - -// Assemble implements the Instruction Assemble method. -func (ri RawInstruction) Assemble() (RawInstruction, error) { return ri, nil } - -// Disassemble parses ri into an Instruction and returns it. If ri is -// not recognized by this package, ri itself is returned. -func (ri RawInstruction) Disassemble() Instruction { - switch ri.Op & opMaskCls { - case opClsLoadA, opClsLoadX: - reg := Register(ri.Op & opMaskLoadDest) - sz := 0 - switch ri.Op & opMaskLoadWidth { - case opLoadWidth4: - sz = 4 - case opLoadWidth2: - sz = 2 - case opLoadWidth1: - sz = 1 - default: - return ri - } - switch ri.Op & opMaskLoadMode { - case opAddrModeImmediate: - if sz != 4 { - return ri - } - return LoadConstant{Dst: reg, Val: ri.K} - case opAddrModeScratch: - if sz != 4 || ri.K > 15 { - return ri - } - return LoadScratch{Dst: reg, N: int(ri.K)} - case opAddrModeAbsolute: - if ri.K > extOffset+0xffffffff { - return LoadExtension{Num: Extension(-extOffset + ri.K)} - } - return LoadAbsolute{Size: sz, Off: ri.K} - case opAddrModeIndirect: - return LoadIndirect{Size: sz, Off: ri.K} - case opAddrModePacketLen: - if sz != 4 { - return ri - } - return LoadExtension{Num: ExtLen} - case opAddrModeMemShift: - return LoadMemShift{Off: ri.K} - default: - return ri - } - - case opClsStoreA: - if ri.Op != opClsStoreA || ri.K > 15 { - return ri - } - return StoreScratch{Src: RegA, N: int(ri.K)} - - case opClsStoreX: - if ri.Op != opClsStoreX || ri.K > 15 { - return ri - } - return StoreScratch{Src: RegX, N: int(ri.K)} - - case opClsALU: - switch op := ALUOp(ri.Op & opMaskOperator); op { - case ALUOpAdd, ALUOpSub, ALUOpMul, ALUOpDiv, ALUOpOr, ALUOpAnd, ALUOpShiftLeft, ALUOpShiftRight, ALUOpMod, ALUOpXor: - switch operand := opOperand(ri.Op & opMaskOperand); operand { - case opOperandX: - return ALUOpX{Op: op} - case opOperandConstant: - return ALUOpConstant{Op: op, Val: ri.K} - default: - return ri - } - case aluOpNeg: - return NegateA{} - default: - return ri - } - - case opClsJump: - switch op := jumpOp(ri.Op & opMaskOperator); op { - case opJumpAlways: - return Jump{Skip: ri.K} - case opJumpEqual, opJumpGT, opJumpGE, opJumpSet: - cond, skipTrue, skipFalse := jumpOpToTest(op, ri.Jt, ri.Jf) - switch operand := opOperand(ri.Op & opMaskOperand); operand { - case opOperandX: - return JumpIfX{Cond: cond, SkipTrue: skipTrue, SkipFalse: skipFalse} - case opOperandConstant: - return JumpIf{Cond: cond, Val: ri.K, SkipTrue: skipTrue, SkipFalse: skipFalse} - default: - return ri - } - default: - return ri - } - - case opClsReturn: - switch ri.Op { - case opClsReturn | opRetSrcA: - return RetA{} - case opClsReturn | opRetSrcConstant: - return RetConstant{Val: ri.K} - default: - return ri - } - - case opClsMisc: - switch ri.Op { - case opClsMisc | opMiscTAX: - return TAX{} - case opClsMisc | opMiscTXA: - return TXA{} - default: - return ri - } - - default: - panic("unreachable") // switch is exhaustive on the bit pattern - } -} - -func jumpOpToTest(op jumpOp, skipTrue uint8, skipFalse uint8) (JumpTest, uint8, uint8) { - var test JumpTest - - // Decode "fake" jump conditions that don't appear in machine code - // Ensures the Assemble -> Disassemble stage recreates the same instructions - // See https://github.com/golang/go/issues/18470 - if skipTrue == 0 { - switch op { - case opJumpEqual: - test = JumpNotEqual - case opJumpGT: - test = JumpLessOrEqual - case opJumpGE: - test = JumpLessThan - case opJumpSet: - test = JumpBitsNotSet - } - - return test, skipFalse, 0 - } - - switch op { - case opJumpEqual: - test = JumpEqual - case opJumpGT: - test = JumpGreaterThan - case opJumpGE: - test = JumpGreaterOrEqual - case opJumpSet: - test = JumpBitsSet - } - - return test, skipTrue, skipFalse -} - -// LoadConstant loads Val into register Dst. -type LoadConstant struct { - Dst Register - Val uint32 -} - -// Assemble implements the Instruction Assemble method. -func (a LoadConstant) Assemble() (RawInstruction, error) { - return assembleLoad(a.Dst, 4, opAddrModeImmediate, a.Val) -} - -// String returns the instruction in assembler notation. -func (a LoadConstant) String() string { - switch a.Dst { - case RegA: - return fmt.Sprintf("ld #%d", a.Val) - case RegX: - return fmt.Sprintf("ldx #%d", a.Val) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// LoadScratch loads scratch[N] into register Dst. -type LoadScratch struct { - Dst Register - N int // 0-15 -} - -// Assemble implements the Instruction Assemble method. -func (a LoadScratch) Assemble() (RawInstruction, error) { - if a.N < 0 || a.N > 15 { - return RawInstruction{}, fmt.Errorf("invalid scratch slot %d", a.N) - } - return assembleLoad(a.Dst, 4, opAddrModeScratch, uint32(a.N)) -} - -// String returns the instruction in assembler notation. -func (a LoadScratch) String() string { - switch a.Dst { - case RegA: - return fmt.Sprintf("ld M[%d]", a.N) - case RegX: - return fmt.Sprintf("ldx M[%d]", a.N) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// LoadAbsolute loads packet[Off:Off+Size] as an integer value into -// register A. -type LoadAbsolute struct { - Off uint32 - Size int // 1, 2 or 4 -} - -// Assemble implements the Instruction Assemble method. -func (a LoadAbsolute) Assemble() (RawInstruction, error) { - return assembleLoad(RegA, a.Size, opAddrModeAbsolute, a.Off) -} - -// String returns the instruction in assembler notation. -func (a LoadAbsolute) String() string { - switch a.Size { - case 1: // byte - return fmt.Sprintf("ldb [%d]", a.Off) - case 2: // half word - return fmt.Sprintf("ldh [%d]", a.Off) - case 4: // word - if a.Off > extOffset+0xffffffff { - return LoadExtension{Num: Extension(a.Off + 0x1000)}.String() - } - return fmt.Sprintf("ld [%d]", a.Off) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// LoadIndirect loads packet[X+Off:X+Off+Size] as an integer value -// into register A. -type LoadIndirect struct { - Off uint32 - Size int // 1, 2 or 4 -} - -// Assemble implements the Instruction Assemble method. -func (a LoadIndirect) Assemble() (RawInstruction, error) { - return assembleLoad(RegA, a.Size, opAddrModeIndirect, a.Off) -} - -// String returns the instruction in assembler notation. -func (a LoadIndirect) String() string { - switch a.Size { - case 1: // byte - return fmt.Sprintf("ldb [x + %d]", a.Off) - case 2: // half word - return fmt.Sprintf("ldh [x + %d]", a.Off) - case 4: // word - return fmt.Sprintf("ld [x + %d]", a.Off) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// LoadMemShift multiplies the first 4 bits of the byte at packet[Off] -// by 4 and stores the result in register X. -// -// This instruction is mainly useful to load into X the length of an -// IPv4 packet header in a single instruction, rather than have to do -// the arithmetic on the header's first byte by hand. -type LoadMemShift struct { - Off uint32 -} - -// Assemble implements the Instruction Assemble method. -func (a LoadMemShift) Assemble() (RawInstruction, error) { - return assembleLoad(RegX, 1, opAddrModeMemShift, a.Off) -} - -// String returns the instruction in assembler notation. -func (a LoadMemShift) String() string { - return fmt.Sprintf("ldx 4*([%d]&0xf)", a.Off) -} - -// LoadExtension invokes a linux-specific extension and stores the -// result in register A. -type LoadExtension struct { - Num Extension -} - -// Assemble implements the Instruction Assemble method. -func (a LoadExtension) Assemble() (RawInstruction, error) { - if a.Num == ExtLen { - return assembleLoad(RegA, 4, opAddrModePacketLen, 0) - } - return assembleLoad(RegA, 4, opAddrModeAbsolute, uint32(extOffset+a.Num)) -} - -// String returns the instruction in assembler notation. -func (a LoadExtension) String() string { - switch a.Num { - case ExtLen: - return "ld #len" - case ExtProto: - return "ld #proto" - case ExtType: - return "ld #type" - case ExtPayloadOffset: - return "ld #poff" - case ExtInterfaceIndex: - return "ld #ifidx" - case ExtNetlinkAttr: - return "ld #nla" - case ExtNetlinkAttrNested: - return "ld #nlan" - case ExtMark: - return "ld #mark" - case ExtQueue: - return "ld #queue" - case ExtLinkLayerType: - return "ld #hatype" - case ExtRXHash: - return "ld #rxhash" - case ExtCPUID: - return "ld #cpu" - case ExtVLANTag: - return "ld #vlan_tci" - case ExtVLANTagPresent: - return "ld #vlan_avail" - case ExtVLANProto: - return "ld #vlan_tpid" - case ExtRand: - return "ld #rand" - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// StoreScratch stores register Src into scratch[N]. -type StoreScratch struct { - Src Register - N int // 0-15 -} - -// Assemble implements the Instruction Assemble method. -func (a StoreScratch) Assemble() (RawInstruction, error) { - if a.N < 0 || a.N > 15 { - return RawInstruction{}, fmt.Errorf("invalid scratch slot %d", a.N) - } - var op uint16 - switch a.Src { - case RegA: - op = opClsStoreA - case RegX: - op = opClsStoreX - default: - return RawInstruction{}, fmt.Errorf("invalid source register %v", a.Src) - } - - return RawInstruction{ - Op: op, - K: uint32(a.N), - }, nil -} - -// String returns the instruction in assembler notation. -func (a StoreScratch) String() string { - switch a.Src { - case RegA: - return fmt.Sprintf("st M[%d]", a.N) - case RegX: - return fmt.Sprintf("stx M[%d]", a.N) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// ALUOpConstant executes A = A Val. -type ALUOpConstant struct { - Op ALUOp - Val uint32 -} - -// Assemble implements the Instruction Assemble method. -func (a ALUOpConstant) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsALU | uint16(opOperandConstant) | uint16(a.Op), - K: a.Val, - }, nil -} - -// String returns the instruction in assembler notation. -func (a ALUOpConstant) String() string { - switch a.Op { - case ALUOpAdd: - return fmt.Sprintf("add #%d", a.Val) - case ALUOpSub: - return fmt.Sprintf("sub #%d", a.Val) - case ALUOpMul: - return fmt.Sprintf("mul #%d", a.Val) - case ALUOpDiv: - return fmt.Sprintf("div #%d", a.Val) - case ALUOpMod: - return fmt.Sprintf("mod #%d", a.Val) - case ALUOpAnd: - return fmt.Sprintf("and #%d", a.Val) - case ALUOpOr: - return fmt.Sprintf("or #%d", a.Val) - case ALUOpXor: - return fmt.Sprintf("xor #%d", a.Val) - case ALUOpShiftLeft: - return fmt.Sprintf("lsh #%d", a.Val) - case ALUOpShiftRight: - return fmt.Sprintf("rsh #%d", a.Val) - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// ALUOpX executes A = A X -type ALUOpX struct { - Op ALUOp -} - -// Assemble implements the Instruction Assemble method. -func (a ALUOpX) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsALU | uint16(opOperandX) | uint16(a.Op), - }, nil -} - -// String returns the instruction in assembler notation. -func (a ALUOpX) String() string { - switch a.Op { - case ALUOpAdd: - return "add x" - case ALUOpSub: - return "sub x" - case ALUOpMul: - return "mul x" - case ALUOpDiv: - return "div x" - case ALUOpMod: - return "mod x" - case ALUOpAnd: - return "and x" - case ALUOpOr: - return "or x" - case ALUOpXor: - return "xor x" - case ALUOpShiftLeft: - return "lsh x" - case ALUOpShiftRight: - return "rsh x" - default: - return fmt.Sprintf("unknown instruction: %#v", a) - } -} - -// NegateA executes A = -A. -type NegateA struct{} - -// Assemble implements the Instruction Assemble method. -func (a NegateA) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsALU | uint16(aluOpNeg), - }, nil -} - -// String returns the instruction in assembler notation. -func (a NegateA) String() string { - return fmt.Sprintf("neg") -} - -// Jump skips the following Skip instructions in the program. -type Jump struct { - Skip uint32 -} - -// Assemble implements the Instruction Assemble method. -func (a Jump) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsJump | uint16(opJumpAlways), - K: a.Skip, - }, nil -} - -// String returns the instruction in assembler notation. -func (a Jump) String() string { - return fmt.Sprintf("ja %d", a.Skip) -} - -// JumpIf skips the following Skip instructions in the program if A -// Val is true. -type JumpIf struct { - Cond JumpTest - Val uint32 - SkipTrue uint8 - SkipFalse uint8 -} - -// Assemble implements the Instruction Assemble method. -func (a JumpIf) Assemble() (RawInstruction, error) { - return jumpToRaw(a.Cond, opOperandConstant, a.Val, a.SkipTrue, a.SkipFalse) -} - -// String returns the instruction in assembler notation. -func (a JumpIf) String() string { - return jumpToString(a.Cond, fmt.Sprintf("#%d", a.Val), a.SkipTrue, a.SkipFalse) -} - -// JumpIfX skips the following Skip instructions in the program if A -// X is true. -type JumpIfX struct { - Cond JumpTest - SkipTrue uint8 - SkipFalse uint8 -} - -// Assemble implements the Instruction Assemble method. -func (a JumpIfX) Assemble() (RawInstruction, error) { - return jumpToRaw(a.Cond, opOperandX, 0, a.SkipTrue, a.SkipFalse) -} - -// String returns the instruction in assembler notation. -func (a JumpIfX) String() string { - return jumpToString(a.Cond, "x", a.SkipTrue, a.SkipFalse) -} - -// jumpToRaw assembles a jump instruction into a RawInstruction -func jumpToRaw(test JumpTest, operand opOperand, k uint32, skipTrue, skipFalse uint8) (RawInstruction, error) { - var ( - cond jumpOp - flip bool - ) - switch test { - case JumpEqual: - cond = opJumpEqual - case JumpNotEqual: - cond, flip = opJumpEqual, true - case JumpGreaterThan: - cond = opJumpGT - case JumpLessThan: - cond, flip = opJumpGE, true - case JumpGreaterOrEqual: - cond = opJumpGE - case JumpLessOrEqual: - cond, flip = opJumpGT, true - case JumpBitsSet: - cond = opJumpSet - case JumpBitsNotSet: - cond, flip = opJumpSet, true - default: - return RawInstruction{}, fmt.Errorf("unknown JumpTest %v", test) - } - jt, jf := skipTrue, skipFalse - if flip { - jt, jf = jf, jt - } - return RawInstruction{ - Op: opClsJump | uint16(cond) | uint16(operand), - Jt: jt, - Jf: jf, - K: k, - }, nil -} - -// jumpToString converts a jump instruction to assembler notation -func jumpToString(cond JumpTest, operand string, skipTrue, skipFalse uint8) string { - switch cond { - // K == A - case JumpEqual: - return conditionalJump(operand, skipTrue, skipFalse, "jeq", "jneq") - // K != A - case JumpNotEqual: - return fmt.Sprintf("jneq %s,%d", operand, skipTrue) - // K > A - case JumpGreaterThan: - return conditionalJump(operand, skipTrue, skipFalse, "jgt", "jle") - // K < A - case JumpLessThan: - return fmt.Sprintf("jlt %s,%d", operand, skipTrue) - // K >= A - case JumpGreaterOrEqual: - return conditionalJump(operand, skipTrue, skipFalse, "jge", "jlt") - // K <= A - case JumpLessOrEqual: - return fmt.Sprintf("jle %s,%d", operand, skipTrue) - // K & A != 0 - case JumpBitsSet: - if skipFalse > 0 { - return fmt.Sprintf("jset %s,%d,%d", operand, skipTrue, skipFalse) - } - return fmt.Sprintf("jset %s,%d", operand, skipTrue) - // K & A == 0, there is no assembler instruction for JumpBitNotSet, use JumpBitSet and invert skips - case JumpBitsNotSet: - return jumpToString(JumpBitsSet, operand, skipFalse, skipTrue) - default: - return fmt.Sprintf("unknown JumpTest %#v", cond) - } -} - -func conditionalJump(operand string, skipTrue, skipFalse uint8, positiveJump, negativeJump string) string { - if skipTrue > 0 { - if skipFalse > 0 { - return fmt.Sprintf("%s %s,%d,%d", positiveJump, operand, skipTrue, skipFalse) - } - return fmt.Sprintf("%s %s,%d", positiveJump, operand, skipTrue) - } - return fmt.Sprintf("%s %s,%d", negativeJump, operand, skipFalse) -} - -// RetA exits the BPF program, returning the value of register A. -type RetA struct{} - -// Assemble implements the Instruction Assemble method. -func (a RetA) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsReturn | opRetSrcA, - }, nil -} - -// String returns the instruction in assembler notation. -func (a RetA) String() string { - return fmt.Sprintf("ret a") -} - -// RetConstant exits the BPF program, returning a constant value. -type RetConstant struct { - Val uint32 -} - -// Assemble implements the Instruction Assemble method. -func (a RetConstant) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsReturn | opRetSrcConstant, - K: a.Val, - }, nil -} - -// String returns the instruction in assembler notation. -func (a RetConstant) String() string { - return fmt.Sprintf("ret #%d", a.Val) -} - -// TXA copies the value of register X to register A. -type TXA struct{} - -// Assemble implements the Instruction Assemble method. -func (a TXA) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsMisc | opMiscTXA, - }, nil -} - -// String returns the instruction in assembler notation. -func (a TXA) String() string { - return fmt.Sprintf("txa") -} - -// TAX copies the value of register A to register X. -type TAX struct{} - -// Assemble implements the Instruction Assemble method. -func (a TAX) Assemble() (RawInstruction, error) { - return RawInstruction{ - Op: opClsMisc | opMiscTAX, - }, nil -} - -// String returns the instruction in assembler notation. -func (a TAX) String() string { - return fmt.Sprintf("tax") -} - -func assembleLoad(dst Register, loadSize int, mode uint16, k uint32) (RawInstruction, error) { - var ( - cls uint16 - sz uint16 - ) - switch dst { - case RegA: - cls = opClsLoadA - case RegX: - cls = opClsLoadX - default: - return RawInstruction{}, fmt.Errorf("invalid target register %v", dst) - } - switch loadSize { - case 1: - sz = opLoadWidth1 - case 2: - sz = opLoadWidth2 - case 4: - sz = opLoadWidth4 - default: - return RawInstruction{}, fmt.Errorf("invalid load byte length %d", sz) - } - return RawInstruction{ - Op: cls | sz | mode, - K: k, - }, nil -} diff --git a/vendor/golang.org/x/net/bpf/vm.go b/vendor/golang.org/x/net/bpf/vm.go deleted file mode 100644 index 73f57f1f..00000000 --- a/vendor/golang.org/x/net/bpf/vm.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bpf - -import ( - "errors" - "fmt" -) - -// A VM is an emulated BPF virtual machine. -type VM struct { - filter []Instruction -} - -// NewVM returns a new VM using the input BPF program. -func NewVM(filter []Instruction) (*VM, error) { - if len(filter) == 0 { - return nil, errors.New("one or more Instructions must be specified") - } - - for i, ins := range filter { - check := len(filter) - (i + 1) - switch ins := ins.(type) { - // Check for out-of-bounds jumps in instructions - case Jump: - if check <= int(ins.Skip) { - return nil, fmt.Errorf("cannot jump %d instructions; jumping past program bounds", ins.Skip) - } - case JumpIf: - if check <= int(ins.SkipTrue) { - return nil, fmt.Errorf("cannot jump %d instructions in true case; jumping past program bounds", ins.SkipTrue) - } - if check <= int(ins.SkipFalse) { - return nil, fmt.Errorf("cannot jump %d instructions in false case; jumping past program bounds", ins.SkipFalse) - } - case JumpIfX: - if check <= int(ins.SkipTrue) { - return nil, fmt.Errorf("cannot jump %d instructions in true case; jumping past program bounds", ins.SkipTrue) - } - if check <= int(ins.SkipFalse) { - return nil, fmt.Errorf("cannot jump %d instructions in false case; jumping past program bounds", ins.SkipFalse) - } - // Check for division or modulus by zero - case ALUOpConstant: - if ins.Val != 0 { - break - } - - switch ins.Op { - case ALUOpDiv, ALUOpMod: - return nil, errors.New("cannot divide by zero using ALUOpConstant") - } - // Check for unknown extensions - case LoadExtension: - switch ins.Num { - case ExtLen: - default: - return nil, fmt.Errorf("extension %d not implemented", ins.Num) - } - } - } - - // Make sure last instruction is a return instruction - switch filter[len(filter)-1].(type) { - case RetA, RetConstant: - default: - return nil, errors.New("BPF program must end with RetA or RetConstant") - } - - // Though our VM works using disassembled instructions, we - // attempt to assemble the input filter anyway to ensure it is compatible - // with an operating system VM. - _, err := Assemble(filter) - - return &VM{ - filter: filter, - }, err -} - -// Run runs the VM's BPF program against the input bytes. -// Run returns the number of bytes accepted by the BPF program, and any errors -// which occurred while processing the program. -func (v *VM) Run(in []byte) (int, error) { - var ( - // Registers of the virtual machine - regA uint32 - regX uint32 - regScratch [16]uint32 - - // OK is true if the program should continue processing the next - // instruction, or false if not, causing the loop to break - ok = true - ) - - // TODO(mdlayher): implement: - // - NegateA: - // - would require a change from uint32 registers to int32 - // registers - - // TODO(mdlayher): add interop tests that check signedness of ALU - // operations against kernel implementation, and make sure Go - // implementation matches behavior - - for i := 0; i < len(v.filter) && ok; i++ { - ins := v.filter[i] - - switch ins := ins.(type) { - case ALUOpConstant: - regA = aluOpConstant(ins, regA) - case ALUOpX: - regA, ok = aluOpX(ins, regA, regX) - case Jump: - i += int(ins.Skip) - case JumpIf: - jump := jumpIf(ins, regA) - i += jump - case JumpIfX: - jump := jumpIfX(ins, regA, regX) - i += jump - case LoadAbsolute: - regA, ok = loadAbsolute(ins, in) - case LoadConstant: - regA, regX = loadConstant(ins, regA, regX) - case LoadExtension: - regA = loadExtension(ins, in) - case LoadIndirect: - regA, ok = loadIndirect(ins, in, regX) - case LoadMemShift: - regX, ok = loadMemShift(ins, in) - case LoadScratch: - regA, regX = loadScratch(ins, regScratch, regA, regX) - case RetA: - return int(regA), nil - case RetConstant: - return int(ins.Val), nil - case StoreScratch: - regScratch = storeScratch(ins, regScratch, regA, regX) - case TAX: - regX = regA - case TXA: - regA = regX - default: - return 0, fmt.Errorf("unknown Instruction at index %d: %T", i, ins) - } - } - - return 0, nil -} diff --git a/vendor/golang.org/x/net/bpf/vm_instructions.go b/vendor/golang.org/x/net/bpf/vm_instructions.go deleted file mode 100644 index cf8947c3..00000000 --- a/vendor/golang.org/x/net/bpf/vm_instructions.go +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bpf - -import ( - "encoding/binary" - "fmt" -) - -func aluOpConstant(ins ALUOpConstant, regA uint32) uint32 { - return aluOpCommon(ins.Op, regA, ins.Val) -} - -func aluOpX(ins ALUOpX, regA uint32, regX uint32) (uint32, bool) { - // Guard against division or modulus by zero by terminating - // the program, as the OS BPF VM does - if regX == 0 { - switch ins.Op { - case ALUOpDiv, ALUOpMod: - return 0, false - } - } - - return aluOpCommon(ins.Op, regA, regX), true -} - -func aluOpCommon(op ALUOp, regA uint32, value uint32) uint32 { - switch op { - case ALUOpAdd: - return regA + value - case ALUOpSub: - return regA - value - case ALUOpMul: - return regA * value - case ALUOpDiv: - // Division by zero not permitted by NewVM and aluOpX checks - return regA / value - case ALUOpOr: - return regA | value - case ALUOpAnd: - return regA & value - case ALUOpShiftLeft: - return regA << value - case ALUOpShiftRight: - return regA >> value - case ALUOpMod: - // Modulus by zero not permitted by NewVM and aluOpX checks - return regA % value - case ALUOpXor: - return regA ^ value - default: - return regA - } -} - -func jumpIf(ins JumpIf, regA uint32) int { - return jumpIfCommon(ins.Cond, ins.SkipTrue, ins.SkipFalse, regA, ins.Val) -} - -func jumpIfX(ins JumpIfX, regA uint32, regX uint32) int { - return jumpIfCommon(ins.Cond, ins.SkipTrue, ins.SkipFalse, regA, regX) -} - -func jumpIfCommon(cond JumpTest, skipTrue, skipFalse uint8, regA uint32, value uint32) int { - var ok bool - - switch cond { - case JumpEqual: - ok = regA == value - case JumpNotEqual: - ok = regA != value - case JumpGreaterThan: - ok = regA > value - case JumpLessThan: - ok = regA < value - case JumpGreaterOrEqual: - ok = regA >= value - case JumpLessOrEqual: - ok = regA <= value - case JumpBitsSet: - ok = (regA & value) != 0 - case JumpBitsNotSet: - ok = (regA & value) == 0 - } - - if ok { - return int(skipTrue) - } - - return int(skipFalse) -} - -func loadAbsolute(ins LoadAbsolute, in []byte) (uint32, bool) { - offset := int(ins.Off) - size := int(ins.Size) - - return loadCommon(in, offset, size) -} - -func loadConstant(ins LoadConstant, regA uint32, regX uint32) (uint32, uint32) { - switch ins.Dst { - case RegA: - regA = ins.Val - case RegX: - regX = ins.Val - } - - return regA, regX -} - -func loadExtension(ins LoadExtension, in []byte) uint32 { - switch ins.Num { - case ExtLen: - return uint32(len(in)) - default: - panic(fmt.Sprintf("unimplemented extension: %d", ins.Num)) - } -} - -func loadIndirect(ins LoadIndirect, in []byte, regX uint32) (uint32, bool) { - offset := int(ins.Off) + int(regX) - size := int(ins.Size) - - return loadCommon(in, offset, size) -} - -func loadMemShift(ins LoadMemShift, in []byte) (uint32, bool) { - offset := int(ins.Off) - - // Size of LoadMemShift is always 1 byte - if !inBounds(len(in), offset, 1) { - return 0, false - } - - // Mask off high 4 bits and multiply low 4 bits by 4 - return uint32(in[offset]&0x0f) * 4, true -} - -func inBounds(inLen int, offset int, size int) bool { - return offset+size <= inLen -} - -func loadCommon(in []byte, offset int, size int) (uint32, bool) { - if !inBounds(len(in), offset, size) { - return 0, false - } - - switch size { - case 1: - return uint32(in[offset]), true - case 2: - return uint32(binary.BigEndian.Uint16(in[offset : offset+size])), true - case 4: - return uint32(binary.BigEndian.Uint32(in[offset : offset+size])), true - default: - panic(fmt.Sprintf("invalid load size: %d", size)) - } -} - -func loadScratch(ins LoadScratch, regScratch [16]uint32, regA uint32, regX uint32) (uint32, uint32) { - switch ins.Dst { - case RegA: - regA = regScratch[ins.N] - case RegX: - regX = regScratch[ins.N] - } - - return regA, regX -} - -func storeScratch(ins StoreScratch, regScratch [16]uint32, regA uint32, regX uint32) [16]uint32 { - switch ins.Src { - case RegA: - regScratch[ins.N] = regA - case RegX: - regScratch[ins.N] = regX - } - - return regScratch -} diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go index a3a918f0..5eb7c5a8 100644 --- a/vendor/golang.org/x/net/html/const.go +++ b/vendor/golang.org/x/net/html/const.go @@ -97,16 +97,8 @@ func isSpecialElement(element *Node) bool { switch element.Namespace { case "", "html": return isSpecialElementMap[element.Data] - case "math": - switch element.Data { - case "mi", "mo", "mn", "ms", "mtext", "annotation-xml": - return true - } case "svg": - switch element.Data { - case "foreignObject", "desc", "title": - return true - } + return element.Data == "foreignObject" } return false } diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go index 633ee15d..2c1cade6 100644 --- a/vendor/golang.org/x/net/html/node.go +++ b/vendor/golang.org/x/net/html/node.go @@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int { // contains returns whether a is within s. func (s *nodeStack) contains(a atom.Atom) bool { for _, n := range *s { - if n.DataAtom == a && n.Namespace == "" { + if n.DataAtom == a { return true } } diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 992cff2a..091fb0d1 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -439,6 +439,9 @@ func (p *parser) resetInsertionMode() { case a.Select: if !last { for ancestor, first := n, p.oe[0]; ancestor != first; { + if ancestor == first { + break + } ancestor = p.oe[p.oe.index(ancestor)-1] switch ancestor.DataAtom { case a.Template: @@ -467,10 +470,6 @@ func (p *parser) resetInsertionMode() { case a.Table: p.im = inTableIM case a.Template: - // TODO: remove this divergence from the HTML5 spec. - if n.Namespace != "" { - continue - } p.im = p.templateStack.top() case a.Head: // TODO: remove this divergence from the HTML5 spec. @@ -630,16 +629,7 @@ func inHeadIM(p *parser) bool { p.oe.pop() p.acknowledgeSelfClosingTag() return true - case a.Noscript: - p.addElement() - if p.scripting { - p.setOriginalIM() - p.im = textIM - } else { - p.im = inHeadNoscriptIM - } - return true - case a.Script, a.Title, a.Noframes, a.Style: + case a.Script, a.Title, a.Noscript, a.Noframes, a.Style: p.addElement() p.setOriginalIM() p.im = textIM @@ -701,49 +691,6 @@ func inHeadIM(p *parser) bool { return false } -// 12.2.6.4.5. -func inHeadNoscriptIM(p *parser) bool { - switch p.tok.Type { - case DoctypeToken: - // Ignore the token. - return true - case StartTagToken: - switch p.tok.DataAtom { - case a.Html: - return inBodyIM(p) - case a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Style: - return inHeadIM(p) - case a.Head, a.Noscript: - // Ignore the token. - return true - } - case EndTagToken: - switch p.tok.DataAtom { - case a.Noscript, a.Br: - default: - // Ignore the token. - return true - } - case TextToken: - s := strings.TrimLeft(p.tok.Data, whitespace) - if len(s) == 0 { - // It was all whitespace. - return inHeadIM(p) - } - case CommentToken: - return inHeadIM(p) - } - p.oe.pop() - if p.top().DataAtom != a.Head { - panic("html: the new current node will be a head element.") - } - p.im = inHeadIM - if p.tok.DataAtom == a.Noscript { - return true - } - return false -} - // Section 12.2.6.4.6. func afterHeadIM(p *parser) bool { switch p.tok.Type { @@ -953,7 +900,7 @@ func inBodyIM(p *parser) bool { case a.A: for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- { if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A { - p.inBodyEndTagFormatting(a.A, "a") + p.inBodyEndTagFormatting(a.A) p.oe.remove(n) p.afe.remove(n) break @@ -967,7 +914,7 @@ func inBodyIM(p *parser) bool { case a.Nobr: p.reconstructActiveFormattingElements() if p.elementInScope(defaultScope, a.Nobr) { - p.inBodyEndTagFormatting(a.Nobr, "nobr") + p.inBodyEndTagFormatting(a.Nobr) p.reconstructActiveFormattingElements() } p.addFormattingElement() @@ -1037,14 +984,6 @@ func inBodyIM(p *parser) bool { p.acknowledgeSelfClosingTag() p.popUntil(buttonScope, a.P) 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 != "" { p.form.Attr = []Attribute{{Key: "action", Val: action}} } @@ -1175,7 +1114,7 @@ func inBodyIM(p *parser) bool { case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6) case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U: - p.inBodyEndTagFormatting(p.tok.DataAtom, p.tok.Data) + p.inBodyEndTagFormatting(p.tok.DataAtom) case a.Applet, a.Marquee, a.Object: if p.popUntil(defaultScope, p.tok.DataAtom) { p.clearActiveFormattingElements() @@ -1186,7 +1125,7 @@ func inBodyIM(p *parser) bool { case a.Template: return inHeadIM(p) default: - p.inBodyEndTagOther(p.tok.DataAtom, p.tok.Data) + p.inBodyEndTagOther(p.tok.DataAtom) } case CommentToken: p.addChild(&Node{ @@ -1213,7 +1152,7 @@ func inBodyIM(p *parser) bool { return true } -func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { +func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { // This is the "adoption agency" algorithm, described at // https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency @@ -1235,7 +1174,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { } } if formattingElement == nil { - p.inBodyEndTagOther(tagAtom, tagName) + p.inBodyEndTagOther(tagAtom) return } feIndex := p.oe.index(formattingElement) @@ -1313,6 +1252,12 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { switch commonAncestor.DataAtom { case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: p.fosterParent(lastNode) + case a.Template: + // TODO: remove namespace checking + if commonAncestor.Namespace == "html" { + commonAncestor = commonAncestor.LastChild + } + fallthrough default: commonAncestor.AppendChild(lastNode) } @@ -1340,17 +1285,9 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { // inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM. // "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign -func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) { +func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { for i := len(p.oe) - 1; i >= 0; i-- { - // Two element nodes have the same tag if they have the same Data (a - // string-typed field). As an optimization, for common HTML tags, each - // Data string is assigned a unique, non-zero DataAtom (a uint32-typed - // field), since integer comparison is faster than string comparison. - // Uncommon (custom) tags get a zero DataAtom. - // - // The if condition here is equivalent to (p.oe[i].Data == tagName). - if (p.oe[i].DataAtom == tagAtom) && - ((tagAtom != 0) || (p.oe[i].Data == tagName)) { + if p.oe[i].DataAtom == tagAtom { p.oe = p.oe[:i] break } @@ -1744,9 +1681,8 @@ func inCellIM(p *parser) bool { return true } // Close the cell and reprocess. - if p.popUntil(tableScope, a.Td, a.Th) { - p.clearActiveFormattingElements() - } + p.popUntil(tableScope, a.Td, a.Th) + p.clearActiveFormattingElements() p.im = inRowIM return false } @@ -1777,12 +1713,8 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - if p.popUntil(selectScope, a.Select) { - p.resetInsertionMode() - } else { - // Ignore the token. - return true - } + p.tok.Type = EndTagToken + return false case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1812,9 +1744,6 @@ func inSelectIM(p *parser) bool { case a.Select: if p.popUntil(selectScope, a.Select) { p.resetInsertionMode() - } else { - // Ignore the token. - return true } case a.Template: return inHeadIM(p) @@ -1840,22 +1769,13 @@ func inSelectInTableIM(p *parser) bool { case StartTagToken, EndTagToken: switch p.tok.DataAtom { case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th: - if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) { + if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) { + p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) + return false + } else { // Ignore the token. return true } - // This is like p.popUntil(selectScope, a.Select), but it also - // matches , not just - /debug/requests - - - - -

/debug/requests

-{{end}} {{/* end of Prolog */}} - -{{define "StatusTable"}} - - {{range $fam := .Families}} - - - - {{$n := index $.ActiveTraceCount $fam}} - - - {{$f := index $.CompletedTraces $fam}} - {{range $i, $b := $f.Buckets}} - {{$empty := $b.Empty}} - - {{end}} - - {{$nb := len $f.Buckets}} - - - - - - {{end}} -
{{$fam}} - {{if $n}}{{end}} - [{{$n}} active] - {{if $n}}{{end}} - - {{if not $empty}}{{end}} - [{{.Cond}}] - {{if not $empty}}{{end}} - - [minute] - - [hour] - - [total] -
-{{end}} {{/* end of StatusTable */}} - -{{define "Epilog"}} -{{if $.Traces}} -
-

Family: {{$.Family}}

- -{{if or $.Expanded $.Traced}} - [Normal/Summary] -{{else}} - [Normal/Summary] -{{end}} - -{{if or (not $.Expanded) $.Traced}} - [Normal/Expanded] -{{else}} - [Normal/Expanded] -{{end}} - -{{if not $.Active}} - {{if or $.Expanded (not $.Traced)}} - [Traced/Summary] - {{else}} - [Traced/Summary] - {{end}} - {{if or (not $.Expanded) (not $.Traced)}} - [Traced/Expanded] - {{else}} - [Traced/Expanded] - {{end}} -{{end}} - -{{if $.Total}} -

Showing {{len $.Traces}} of {{$.Total}} traces.

-{{end}} - - - - - {{range $tr := $.Traces}} - - - - - {{/* TODO: include traceID/spanID */}} - - {{if $.Expanded}} - {{range $tr.Events}} - - - - - - {{end}} - {{end}} - {{end}} -
- {{if $.Active}}Active{{else}}Completed{{end}} Requests -
WhenElapsed (s)
{{$tr.When}}{{$tr.ElapsedTime}}{{$tr.Title}}
{{.WhenString}}{{elapsed .Elapsed}}{{if or $.ShowSensitive (not .Sensitive)}}... {{.What}}{{else}}[redacted]{{end}}
-{{end}} {{/* if $.Traces */}} - -{{if $.Histogram}} -

Latency (µs) of {{$.Family}} over {{$.HistogramWindow}}

-{{$.Histogram}} -{{end}} {{/* if $.Histogram */}} - - - -{{end}} {{/* end of Epilog */}} -` diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go index 9857fe53..533438d9 100644 --- a/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -7,8 +7,9 @@ package errgroup import ( - "context" "sync" + + "golang.org/x/net/context" ) // A Group is a collection of goroutines working on subtasks that are part of diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s deleted file mode 100644 index 06f84b85..00000000 --- a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go -// - -TEXT ·syscall6(SB),NOSPLIT,$0-88 - JMP syscall·syscall6(SB) - -TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 - JMP syscall·rawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/cpu/byteorder.go b/vendor/golang.org/x/sys/cpu/byteorder.go deleted file mode 100644 index da6b9e43..00000000 --- a/vendor/golang.org/x/sys/cpu/byteorder.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cpu - -import ( - "encoding/binary" - "runtime" -) - -// hostByteOrder returns binary.LittleEndian on little-endian machines and -// binary.BigEndian on big-endian machines. -func hostByteOrder() binary.ByteOrder { - switch runtime.GOARCH { - case "386", "amd64", "amd64p32", - "arm", "arm64", - "mipsle", "mips64le", "mips64p32le", - "ppc64le", - "riscv", "riscv64": - return binary.LittleEndian - case "armbe", "arm64be", - "mips", "mips64", "mips64p32", - "ppc", "ppc64", - "s390", "s390x", - "sparc", "sparc64": - return binary.BigEndian - } - panic("unknown architecture") -} diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 679e78c2..3d88f866 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -6,13 +6,6 @@ // various CPU architectures. package cpu -// Initialized reports whether the CPU features were initialized. -// -// For some GOOS/GOARCH combinations initialization of the CPU features depends -// on reading an operating specific file, e.g. /proc/self/auxv on linux/arm -// Initialized will report false if reading the file fails. -var Initialized bool - // CacheLinePad is used to pad structs to avoid false sharing. type CacheLinePad struct{ _ [cacheLineSize]byte } @@ -36,8 +29,6 @@ var X86 struct { HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM HasPOPCNT bool // Hamming weight instruction POPCNT. - HasRDRAND bool // RDRAND instruction (on-chip random number generator) - HasRDSEED bool // RDSEED instruction (on-chip random number generator) HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64) HasSSE3 bool // Streaming SIMD extension 3 HasSSSE3 bool // Supplemental streaming SIMD extension 3 @@ -45,82 +36,3 @@ var X86 struct { HasSSE42 bool // Streaming SIMD extension 4 and 4.2 _ CacheLinePad } - -// ARM64 contains the supported CPU features of the -// current ARMv8(aarch64) platform. If the current platform -// is not arm64 then all feature flags are false. -var ARM64 struct { - _ CacheLinePad - HasFP bool // Floating-point instruction set (always available) - HasASIMD bool // Advanced SIMD (always available) - HasEVTSTRM bool // Event stream support - HasAES bool // AES hardware implementation - HasPMULL bool // Polynomial multiplication instruction set - HasSHA1 bool // SHA1 hardware implementation - HasSHA2 bool // SHA2 hardware implementation - HasCRC32 bool // CRC32 hardware implementation - HasATOMICS bool // Atomic memory operation instruction set - HasFPHP bool // Half precision floating-point instruction set - HasASIMDHP bool // Advanced SIMD half precision instruction set - HasCPUID bool // CPUID identification scheme registers - HasASIMDRDM bool // Rounding double multiply add/subtract instruction set - HasJSCVT bool // Javascript conversion from floating-point to integer - HasFCMA bool // Floating-point multiplication and addition of complex numbers - HasLRCPC bool // Release Consistent processor consistent support - HasDCPOP bool // Persistent memory support - HasSHA3 bool // SHA3 hardware implementation - HasSM3 bool // SM3 hardware implementation - HasSM4 bool // SM4 hardware implementation - HasASIMDDP bool // Advanced SIMD double precision instruction set - HasSHA512 bool // SHA512 hardware implementation - HasSVE bool // Scalable Vector Extensions - HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 - _ CacheLinePad -} - -// PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms. -// If the current platform is not ppc64/ppc64le then all feature flags are false. -// -// For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00, -// since there are no optional categories. There are some exceptions that also -// require kernel support to work (DARN, SCV), so there are feature bits for -// those as well. The minimum processor requirement is POWER8 (ISA 2.07). -// The struct is padded to avoid false sharing. -var PPC64 struct { - _ CacheLinePad - HasDARN bool // Hardware random number generator (requires kernel enablement) - HasSCV bool // Syscall vectored (requires kernel enablement) - IsPOWER8 bool // ISA v2.07 (POWER8) - IsPOWER9 bool // ISA v3.00 (POWER9) - _ CacheLinePad -} - -// S390X contains the supported CPU features of the current IBM Z -// (s390x) platform. If the current platform is not IBM Z then all -// feature flags are false. -// -// S390X is padded to avoid false sharing. Further HasVX is only set -// if the OS supports vector registers in addition to the STFLE -// feature bit being set. -var S390X struct { - _ CacheLinePad - HasZARCH bool // z/Architecture mode is active [mandatory] - HasSTFLE bool // store facility list extended - HasLDISP bool // long (20-bit) displacements - HasEIMM bool // 32-bit immediates - HasDFP bool // decimal floating point - HasETF3EH bool // ETF-3 enhanced - HasMSA bool // message security assist (CPACF) - HasAES bool // KM-AES{128,192,256} functions - HasAESCBC bool // KMC-AES{128,192,256} functions - HasAESCTR bool // KMCTR-AES{128,192,256} functions - HasAESGCM bool // KMA-GCM-AES{128,192,256} functions - HasGHASH bool // KIMD-GHASH function - HasSHA1 bool // K{I,L}MD-SHA-1 functions - HasSHA256 bool // K{I,L}MD-SHA-256 functions - HasSHA512 bool // K{I,L}MD-SHA-512 functions - HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions - HasVX bool // vector facility - HasVXE bool // vector-enhancements facility 1 - _ CacheLinePad -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go b/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go deleted file mode 100644 index be602722..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 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 aix,ppc64 - -package cpu - -const cacheLineSize = 128 - -const ( - // getsystemcfg constants - _SC_IMPL = 2 - _IMPL_POWER8 = 0x10000 - _IMPL_POWER9 = 0x20000 -) - -func init() { - impl := getsystemcfg(_SC_IMPL) - if impl&_IMPL_POWER8 != 0 { - PPC64.IsPOWER8 = true - } - if impl&_IMPL_POWER9 != 0 { - PPC64.IsPOWER9 = true - } - - Initialized = true -} - -func getsystemcfg(label int) (n uint64) { - r0, _ := callgetsystemcfg(label) - n = uint64(r0) - return -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm.go b/vendor/golang.org/x/sys/cpu/cpu_arm.go index 7f2348b7..d93036f7 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm.go @@ -5,5 +5,3 @@ package cpu const cacheLineSize = 32 - -func doinit() {} diff --git a/vendor/golang.org/x/net/internal/socket/empty.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.go similarity index 64% rename from vendor/golang.org/x/net/internal/socket/empty.s rename to vendor/golang.org/x/sys/cpu/cpu_arm64.go index bff0231c..1d2ab290 100644 --- a/vendor/golang.org/x/net/internal/socket/empty.s +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,go1.12 +package cpu -// This exists solely so we can linkname in symbols from syscall. +const cacheLineSize = 64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go deleted file mode 100644 index 568bcd03..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2019 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 !gccgo - -package cpu - -// haveAsmFunctions reports whether the other functions in this file can -// be safely called. -func haveAsmFunctions() bool { return true } - -// The following feature detection functions are defined in cpu_s390x.s. -// They are likely to be expensive to call so the results should be cached. -func stfle() facilityList -func kmQuery() queryResult -func kmcQuery() queryResult -func kmctrQuery() queryResult -func kmaQuery() queryResult -func kimdQuery() queryResult -func klmdQuery() queryResult diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go deleted file mode 100644 index aa986f77..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2019 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 gccgo - -package cpu - -// haveAsmFunctions reports whether the other functions in this file can -// be safely called. -func haveAsmFunctions() bool { return false } - -// TODO(mundaym): the following feature detection functions are currently -// stubs. See https://golang.org/cl/162887 for how to fix this. -// They are likely to be expensive to call so the results should be cached. -func stfle() facilityList { panic("not implemented for gccgo") } -func kmQuery() queryResult { panic("not implemented for gccgo") } -func kmcQuery() queryResult { panic("not implemented for gccgo") } -func kmctrQuery() queryResult { panic("not implemented for gccgo") } -func kmaQuery() queryResult { panic("not implemented for gccgo") } -func kimdQuery() queryResult { panic("not implemented for gccgo") } -func klmdQuery() queryResult { panic("not implemented for gccgo") } diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go deleted file mode 100644 index 76b5f507..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//+build !amd64,!amd64p32,!386 - -package cpu - -import ( - "io/ioutil" -) - -const ( - _AT_HWCAP = 16 - _AT_HWCAP2 = 26 - - procAuxv = "/proc/self/auxv" - - uintSize = int(32 << (^uint(0) >> 63)) -) - -// For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2 -// These are initialized in cpu_$GOARCH.go -// and should not be changed after they are initialized. -var hwCap uint -var hwCap2 uint - -func init() { - buf, err := ioutil.ReadFile(procAuxv) - if err != nil { - // e.g. on android /proc/self/auxv is not accessible, so silently - // ignore the error and leave Initialized = false - return - } - - bo := hostByteOrder() - for len(buf) >= 2*(uintSize/8) { - var tag, val uint - switch uintSize { - case 32: - tag = uint(bo.Uint32(buf[0:])) - val = uint(bo.Uint32(buf[4:])) - buf = buf[8:] - case 64: - tag = uint(bo.Uint64(buf[0:])) - val = uint(bo.Uint64(buf[8:])) - buf = buf[16:] - } - switch tag { - case _AT_HWCAP: - hwCap = val - case _AT_HWCAP2: - hwCap2 = val - } - } - doinit() - - Initialized = true -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go deleted file mode 100644 index fa7fb1bd..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cpu - -const cacheLineSize = 64 - -// HWCAP/HWCAP2 bits. These are exposed by Linux. -const ( - hwcap_FP = 1 << 0 - hwcap_ASIMD = 1 << 1 - hwcap_EVTSTRM = 1 << 2 - hwcap_AES = 1 << 3 - hwcap_PMULL = 1 << 4 - hwcap_SHA1 = 1 << 5 - hwcap_SHA2 = 1 << 6 - hwcap_CRC32 = 1 << 7 - hwcap_ATOMICS = 1 << 8 - hwcap_FPHP = 1 << 9 - hwcap_ASIMDHP = 1 << 10 - hwcap_CPUID = 1 << 11 - hwcap_ASIMDRDM = 1 << 12 - hwcap_JSCVT = 1 << 13 - hwcap_FCMA = 1 << 14 - hwcap_LRCPC = 1 << 15 - hwcap_DCPOP = 1 << 16 - hwcap_SHA3 = 1 << 17 - hwcap_SM3 = 1 << 18 - hwcap_SM4 = 1 << 19 - hwcap_ASIMDDP = 1 << 20 - hwcap_SHA512 = 1 << 21 - hwcap_SVE = 1 << 22 - hwcap_ASIMDFHM = 1 << 23 -) - -func doinit() { - // HWCAP feature bits - ARM64.HasFP = isSet(hwCap, hwcap_FP) - ARM64.HasASIMD = isSet(hwCap, hwcap_ASIMD) - ARM64.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) - ARM64.HasAES = isSet(hwCap, hwcap_AES) - ARM64.HasPMULL = isSet(hwCap, hwcap_PMULL) - ARM64.HasSHA1 = isSet(hwCap, hwcap_SHA1) - ARM64.HasSHA2 = isSet(hwCap, hwcap_SHA2) - ARM64.HasCRC32 = isSet(hwCap, hwcap_CRC32) - ARM64.HasATOMICS = isSet(hwCap, hwcap_ATOMICS) - ARM64.HasFPHP = isSet(hwCap, hwcap_FPHP) - ARM64.HasASIMDHP = isSet(hwCap, hwcap_ASIMDHP) - ARM64.HasCPUID = isSet(hwCap, hwcap_CPUID) - ARM64.HasASIMDRDM = isSet(hwCap, hwcap_ASIMDRDM) - ARM64.HasJSCVT = isSet(hwCap, hwcap_JSCVT) - ARM64.HasFCMA = isSet(hwCap, hwcap_FCMA) - ARM64.HasLRCPC = isSet(hwCap, hwcap_LRCPC) - ARM64.HasDCPOP = isSet(hwCap, hwcap_DCPOP) - ARM64.HasSHA3 = isSet(hwCap, hwcap_SHA3) - ARM64.HasSM3 = isSet(hwCap, hwcap_SM3) - ARM64.HasSM4 = isSet(hwCap, hwcap_SM4) - ARM64.HasASIMDDP = isSet(hwCap, hwcap_ASIMDDP) - ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) - ARM64.HasSVE = isSet(hwCap, hwcap_SVE) - ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) -} - -func isSet(hwc uint, value uint) bool { - return hwc&value != 0 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go deleted file mode 100644 index 6c8d975d..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build ppc64 ppc64le - -package cpu - -const cacheLineSize = 128 - -// HWCAP/HWCAP2 bits. These are exposed by the kernel. -const ( - // ISA Level - _PPC_FEATURE2_ARCH_2_07 = 0x80000000 - _PPC_FEATURE2_ARCH_3_00 = 0x00800000 - - // CPU features - _PPC_FEATURE2_DARN = 0x00200000 - _PPC_FEATURE2_SCV = 0x00100000 -) - -func doinit() { - // HWCAP2 feature bits - PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07) - PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00) - PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN) - PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV) -} - -func isSet(hwc uint, value uint) bool { - return hwc&value != 0 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go deleted file mode 100644 index d579eaef..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cpu - -const cacheLineSize = 256 - -const ( - // bit mask values from /usr/include/bits/hwcap.h - hwcap_ZARCH = 2 - hwcap_STFLE = 4 - hwcap_MSA = 8 - hwcap_LDISP = 16 - hwcap_EIMM = 32 - hwcap_DFP = 64 - hwcap_ETF3EH = 256 - hwcap_VX = 2048 - hwcap_VXE = 8192 -) - -// bitIsSet reports whether the bit at index is set. The bit index -// is in big endian order, so bit index 0 is the leftmost bit. -func bitIsSet(bits []uint64, index uint) bool { - return bits[index/64]&((1<<63)>>(index%64)) != 0 -} - -// function is the code for the named cryptographic function. -type function uint8 - -const ( - // KM{,A,C,CTR} function codes - aes128 function = 18 // AES-128 - aes192 function = 19 // AES-192 - aes256 function = 20 // AES-256 - - // K{I,L}MD function codes - sha1 function = 1 // SHA-1 - sha256 function = 2 // SHA-256 - sha512 function = 3 // SHA-512 - sha3_224 function = 32 // SHA3-224 - sha3_256 function = 33 // SHA3-256 - sha3_384 function = 34 // SHA3-384 - sha3_512 function = 35 // SHA3-512 - shake128 function = 36 // SHAKE-128 - shake256 function = 37 // SHAKE-256 - - // KLMD function codes - ghash function = 65 // GHASH -) - -// queryResult contains the result of a Query function -// call. Bits are numbered in big endian order so the -// leftmost bit (the MSB) is at index 0. -type queryResult struct { - bits [2]uint64 -} - -// Has reports whether the given functions are present. -func (q *queryResult) Has(fns ...function) bool { - if len(fns) == 0 { - panic("no function codes provided") - } - for _, f := range fns { - if !bitIsSet(q.bits[:], uint(f)) { - return false - } - } - return true -} - -// facility is a bit index for the named facility. -type facility uint8 - -const ( - // cryptography facilities - msa4 facility = 77 // message-security-assist extension 4 - msa8 facility = 146 // message-security-assist extension 8 -) - -// facilityList contains the result of an STFLE call. -// Bits are numbered in big endian order so the -// leftmost bit (the MSB) is at index 0. -type facilityList struct { - bits [4]uint64 -} - -// Has reports whether the given facilities are present. -func (s *facilityList) Has(fs ...facility) bool { - if len(fs) == 0 { - panic("no facility bits provided") - } - for _, f := range fs { - if !bitIsSet(s.bits[:], uint(f)) { - return false - } - } - return true -} - -func doinit() { - // test HWCAP bit vector - has := func(featureMask uint) bool { - return hwCap&featureMask == featureMask - } - - // mandatory - S390X.HasZARCH = has(hwcap_ZARCH) - - // optional - S390X.HasSTFLE = has(hwcap_STFLE) - S390X.HasLDISP = has(hwcap_LDISP) - S390X.HasEIMM = has(hwcap_EIMM) - S390X.HasETF3EH = has(hwcap_ETF3EH) - S390X.HasDFP = has(hwcap_DFP) - S390X.HasMSA = has(hwcap_MSA) - S390X.HasVX = has(hwcap_VX) - if S390X.HasVX { - S390X.HasVXE = has(hwcap_VXE) - } - - // We need implementations of stfle, km and so on - // to detect cryptographic features. - if !haveAsmFunctions() { - return - } - - // optional cryptographic functions - if S390X.HasMSA { - aes := []function{aes128, aes192, aes256} - - // cipher message - km, kmc := kmQuery(), kmcQuery() - S390X.HasAES = km.Has(aes...) - S390X.HasAESCBC = kmc.Has(aes...) - if S390X.HasSTFLE { - facilities := stfle() - if facilities.Has(msa4) { - kmctr := kmctrQuery() - S390X.HasAESCTR = kmctr.Has(aes...) - } - if facilities.Has(msa8) { - kma := kmaQuery() - S390X.HasAESGCM = kma.Has(aes...) - } - } - - // compute message digest - kimd := kimdQuery() // intermediate (no padding) - klmd := klmdQuery() // last (padding) - S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1) - S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256) - S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512) - S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist - sha3 := []function{ - sha3_224, sha3_256, sha3_384, sha3_512, - shake128, shake256, - } - S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...) - } -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go index f55e0c82..6165f121 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -7,5 +7,3 @@ package cpu const cacheLineSize = 32 - -func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go index cda87b1a..1269eee8 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go +++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -7,5 +7,3 @@ package cpu const cacheLineSize = 32 - -func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go deleted file mode 100644 index dd1e76dc..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 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 !linux,arm64 - -package cpu - -const cacheLineSize = 64 - -func doinit() {} diff --git a/vendor/golang.org/x/xerrors/internal/internal.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go similarity index 57% rename from vendor/golang.org/x/xerrors/internal/internal.go rename to vendor/golang.org/x/sys/cpu/cpu_ppc64x.go index 89f4eca5..d10759a5 100644 --- a/vendor/golang.org/x/xerrors/internal/internal.go +++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package internal +// +build ppc64 ppc64le -// EnableTrace indicates whether stack information should be recorded in errors. -var EnableTrace = true +package cpu + +const cacheLineSize = 128 diff --git a/vendor/golang.org/x/sys/windows/asm_windows_arm.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.go similarity index 51% rename from vendor/golang.org/x/sys/windows/asm_windows_arm.s rename to vendor/golang.org/x/sys/cpu/cpu_s390x.go index 55d8b91a..684c4f00 100644 --- a/vendor/golang.org/x/sys/windows/asm_windows_arm.s +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.go @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -#include "textflag.h" +package cpu -TEXT ·getprocaddress(SB),NOSPLIT,$0 - B syscall·getprocaddress(SB) - -TEXT ·loadlibrary(SB),NOSPLIT,$0 - B syscall·loadlibrary(SB) +const cacheLineSize = 256 diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s deleted file mode 100644 index e5037d92..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_s390x.s +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2019 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 !gccgo - -#include "textflag.h" - -// func stfle() facilityList -TEXT ·stfle(SB), NOSPLIT|NOFRAME, $0-32 - MOVD $ret+0(FP), R1 - MOVD $3, R0 // last doubleword index to store - XC $32, (R1), (R1) // clear 4 doublewords (32 bytes) - WORD $0xb2b01000 // store facility list extended (STFLE) - RET - -// func kmQuery() queryResult -TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KM-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xB92E0024 // cipher message (KM) - RET - -// func kmcQuery() queryResult -TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KMC-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xB92F0024 // cipher message with chaining (KMC) - RET - -// func kmctrQuery() queryResult -TEXT ·kmctrQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KMCTR-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xB92D4024 // cipher message with counter (KMCTR) - RET - -// func kmaQuery() queryResult -TEXT ·kmaQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KMA-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xb9296024 // cipher message with authentication (KMA) - RET - -// func kimdQuery() queryResult -TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KIMD-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xB93E0024 // compute intermediate message digest (KIMD) - RET - -// func klmdQuery() queryResult -TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16 - MOVD $0, R0 // set function code to 0 (KLMD-Query) - MOVD $ret+0(FP), R1 // address of 16-byte return value - WORD $0xB93F0024 // compute last message digest (KLMD) - RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go deleted file mode 100644 index bd9bbda0..00000000 --- a/vendor/golang.org/x/sys/cpu/cpu_wasm.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2019 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 wasm - -package cpu - -// We're compiling the cpu package for an unknown (software-abstracted) CPU. -// Make CacheLinePad an empty struct and hope that the usual struct alignment -// rules are good enough. - -const cacheLineSize = 0 - -func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index d70d317f..71e288b0 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -9,8 +9,6 @@ package cpu const cacheLineSize = 64 func init() { - Initialized = true - maxID, _, _, _ := cpuid(0, 0) if maxID < 1 { @@ -29,7 +27,6 @@ func init() { X86.HasPOPCNT = isSet(23, ecx1) X86.HasAES = isSet(25, ecx1) X86.HasOSXSAVE = isSet(27, ecx1) - X86.HasRDRAND = isSet(30, ecx1) osSupportsAVX := false // For XGETBV, OSXSAVE bit is required and sufficient. @@ -50,7 +47,6 @@ func init() { X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX X86.HasBMI2 = isSet(8, ebx7) X86.HasERMS = isSet(9, ebx7) - X86.HasRDSEED = isSet(18, ebx7) X86.HasADX = isSet(19, ebx7) } diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go deleted file mode 100644 index 78fe25e8..00000000 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2019 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. - -// Minimal copy of x/sys/unix so the cpu package can make a -// system call on AIX without depending on x/sys/unix. -// (See golang.org/issue/32102) - -// +build aix,ppc64 -// +build !gccgo - -package cpu - -import ( - "syscall" - "unsafe" -) - -//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" - -//go:linkname libc_getsystemcfg libc_getsystemcfg - -type syscallFunc uintptr - -var libc_getsystemcfg syscallFunc - -type errno = syscall.Errno - -// Implemented in runtime/syscall_aix.go. -func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) -func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) - -func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) - return -} diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md index eb2f78ae..bc6f6031 100644 --- a/vendor/golang.org/x/sys/unix/README.md +++ b/vendor/golang.org/x/sys/unix/README.md @@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible. This is being done on an OS-by-OS basis. Please update this documentation as components of the build system change. -### Old Build System (currently for `GOOS != "linux"`) +### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`) The old build system generates the Go files based on the C header files present on your system. This means that files @@ -32,9 +32,9 @@ To build the files for your current OS and architecture, make sure GOOS and GOARCH are set correctly and run `mkall.sh`. This will generate the files for your specific system. Running `mkall.sh -n` shows the commands that will be run. -Requirements: bash, go +Requirements: bash, perl, go -### New Build System (currently for `GOOS == "linux"`) +### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`) The new build system uses a Docker container to generate the go files directly from source checkouts of the kernel and various system libraries. This means @@ -52,14 +52,14 @@ system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will then generate all of the files for all of the GOOS/GOARCH pairs in the new build system. Running `mkall.sh -n` shows the commands that will be run. -Requirements: bash, go, docker +Requirements: bash, perl, go, docker ## Component files This section describes the various files used in the code generation process. It also contains instructions on how to modify these files to add a new architecture/OS or to add additional syscalls, types, or constants. Note that -if you are using the new build system, the scripts/programs cannot be called normally. +if you are using the new build system, the scripts cannot be called normally. They must be called from within the docker container. ### asm files @@ -81,8 +81,8 @@ each GOOS/GOARCH pair. ### mksysnum -Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go` -for the old system). This program takes in a list of header files containing the +Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl` +for the old system). This script takes in a list of header files containing the syscall number declarations and parses them to produce the corresponding list of Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated constants. @@ -92,14 +92,14 @@ new installation of the target OS (or updating the source checkouts for the new build system). However, depending on the OS, you make need to update the parsing in mksysnum. -### mksyscall.go +### mksyscall.pl The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are hand-written Go files which implement system calls (for unix, the specific OS, or the specific OS/Architecture pair respectively) that need special handling and list `//sys` comments giving prototypes for ones that can be generated. -The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts +The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts them into syscalls. This requires the name of the prototype in the comment to match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function prototype can be exported (capitalized) or not. @@ -160,7 +160,7 @@ signal numbers, and constants. Generated by `mkerrors.sh` (see above). ### `zsyscall_${GOOS}_${GOARCH}.go` A file containing all the generated syscalls for a specific GOOS and GOARCH. -Generated by `mksyscall.go` (see above). +Generated by `mksyscall.pl` (see above). ### `zsysnum_${GOOS}_${GOARCH}.go` diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s deleted file mode 100644 index 06f84b85..00000000 --- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go -// - -TEXT ·syscall6(SB),NOSPLIT,$0-88 - JMP syscall·syscall6(SB) - -TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 - JMP syscall·rawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s deleted file mode 100644 index d9318cbf..00000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for ARM64, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 88f71255..649e5871 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -15,6 +15,12 @@ // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. +TEXT ·Syscall(SB),NOSPLIT,$0-56 + BR syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + BR syscall·Syscall6(SB) + TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 BL runtime·entersyscall(SB) MOVD a1+8(FP), R3 @@ -30,6 +36,12 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 BL runtime·exitsyscall(SB) RET +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + BR syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + BR syscall·RawSyscall6(SB) + TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 MOVD a1+8(FP), R3 MOVD a2+16(FP), R4 diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s deleted file mode 100644 index 6db717de..00000000 --- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2019 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,!gccgo - -#include "textflag.h" - -// -// System calls for linux/riscv64. -// -// Where available, just jump to package syscall's implementation of -// these functions. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 - CALL runtime·entersyscall(SB) - MOV a1+8(FP), A0 - MOV a2+16(FP), A1 - MOV a3+24(FP), A2 - MOV $0, A3 - MOV $0, A4 - MOV $0, A5 - MOV $0, A6 - MOV trap+0(FP), A7 // syscall entry - ECALL - MOV A0, r1+32(FP) // r1 - MOV A1, r2+40(FP) // r2 - CALL runtime·exitsyscall(SB) - RET - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) - -TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 - MOV a1+8(FP), A0 - MOV a2+16(FP), A1 - MOV a3+24(FP), A2 - MOV ZERO, A3 - MOV ZERO, A4 - MOV ZERO, A5 - MOV trap+0(FP), A7 // syscall entry - ECALL - MOV A0, r1+32(FP) - MOV A1, r2+40(FP) - RET diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s deleted file mode 100644 index 6f98ba5a..00000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 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 !gccgo - -#include "textflag.h" - -// -// System call support for ARM64, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s deleted file mode 100644 index 0cedea3d..00000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 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 !gccgo - -#include "textflag.h" - -// -// System call support for arm64, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index 39c03f1e..9379ba9c 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd linux netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/vendor/golang.org/x/sys/unix/fcntl_darwin.go deleted file mode 100644 index 5868a4a4..00000000 --- a/vendor/golang.org/x/sys/unix/fcntl_darwin.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import "unsafe" - -// FcntlInt performs a fcntl syscall on fd with the provided command and argument. -func FcntlInt(fd uintptr, cmd, arg int) (int, error) { - return fcntl(int(fd), cmd, arg) -} - -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. -func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { - _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) - return err -} diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index 5a22eca9..edb176f1 100755 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -10,14 +10,13 @@ GOOSARCH="${GOOS}_${GOARCH}" # defaults -mksyscall="go run mksyscall.go" +mksyscall="./mksyscall.pl" mkerrors="./mkerrors.sh" zerrors="zerrors_$GOOSARCH.go" mksysctl="" zsysctl="zsysctl_$GOOSARCH.go" mksysnum= mktypes= -mkasm= run="sh" cmd="" @@ -46,8 +45,8 @@ case "$#" in exit 2 esac -if [[ "$GOOS" = "linux" ]]; then - # Use the Docker-based build system +if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then + # Use then new build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) $cmd docker build --tag generate:$GOOS $GOOS $cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS @@ -62,130 +61,112 @@ _* | *_ | _) ;; aix_ppc) mkerrors="$mkerrors -maix32" - mksyscall="go run mksyscall_aix_ppc.go -aix" + mksyscall="perl mksyscall_aix.pl -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; aix_ppc64) mkerrors="$mkerrors -maix64" - mksyscall="go run mksyscall_aix_ppc64.go -aix" + mksyscall="perl mksyscall_aix.pl -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; darwin_386) mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" + mksyscall="./mksyscall.pl -l32" + mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" ;; darwin_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" + mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" ;; darwin_arm) mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" + mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" ;; darwin_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" + mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" ;; dragonfly_amd64) mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -dragonfly" - mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -dragonfly" + mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_386) mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32" + mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_arm) mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32 -arm" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32 -arm" + mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; -freebsd_arm64) +linux_sparc64) + GOOSARCH_in=syscall_linux_sparc64.go + unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="./mksysnum_linux.pl $unistd_h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_386) mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32 -netbsd" - mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32 -netbsd" + mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_amd64) mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -netbsd" - mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -netbsd" + mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_arm) mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32 -netbsd -arm" - mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32 -netbsd -arm" + mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; -netbsd_arm64) - mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -netbsd" - mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - ;; openbsd_386) mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32 -openbsd" - mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32 -openbsd" + mksysctl="./mksysctl_openbsd.pl" + mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -openbsd" - mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -openbsd" + mksysctl="./mksysctl_openbsd.pl" + mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_arm) mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32 -openbsd -arm" - mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" - # Let the type of C char be signed for making the bare syscall - # API consistent across platforms. - mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" - ;; -openbsd_arm64) - mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -openbsd" - mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksyscall="./mksyscall.pl -l32 -openbsd -arm" + mksysctl="./mksysctl_openbsd.pl" + mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; solaris_amd64) - mksyscall="go run mksyscall_solaris.go" + mksyscall="./mksyscall_solaris.pl" mkerrors="$mkerrors -m64" mksysnum= mktypes="GOARCH=$GOARCH go tool cgo -godefs" @@ -206,22 +187,12 @@ esac syscall_goos="syscall_bsd.go $syscall_goos" ;; esac - if [ -n "$mksyscall" ]; then - if [ "$GOOSARCH" == "aix_ppc64" ]; then - # aix/ppc64 script generates files instead of writing to stdin. - echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ; - elif [ "$GOOS" == "darwin" ]; then - # pre-1.12, direct syscalls - echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go"; - # 1.12 and later, syscalls via libSystem - echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; - else - echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; - fi - fi + if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi + ;; esac if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi - if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi - if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi + if [ -n "$mktypes" ]; then + echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; + fi ) | $run diff --git a/vendor/golang.org/x/sys/unix/mkasm_darwin.go b/vendor/golang.org/x/sys/unix/mkasm_darwin.go deleted file mode 100644 index 4548b993..00000000 --- a/vendor/golang.org/x/sys/unix/mkasm_darwin.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. -//This program must be run after mksyscall.go. -package main - -import ( - "bytes" - "fmt" - "io/ioutil" - "log" - "os" - "strings" -) - -func main() { - in1, err := ioutil.ReadFile("syscall_darwin.go") - if err != nil { - log.Fatalf("can't open syscall_darwin.go: %s", err) - } - arch := os.Args[1] - in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch)) - if err != nil { - log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err) - } - in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch)) - if err != nil { - log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err) - } - in := string(in1) + string(in2) + string(in3) - - trampolines := map[string]bool{} - - var out bytes.Buffer - - fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " ")) - fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") - fmt.Fprintf(&out, "\n") - fmt.Fprintf(&out, "// +build go1.12\n") - fmt.Fprintf(&out, "\n") - fmt.Fprintf(&out, "#include \"textflag.h\"\n") - for _, line := range strings.Split(in, "\n") { - if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { - continue - } - fn := line[5 : len(line)-13] - if !trampolines[fn] { - trampolines[fn] = true - fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) - fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) - } - } - err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644) - if err != nil { - log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err) - } -} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 4c91159c..c8449cf3 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -17,10 +17,12 @@ if test -z "$GOARCH" -o -z "$GOOS"; then fi # Check that we are using the new build system if we should -if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then - echo 1>&2 "In the Docker based build system, mkerrors should not be called directly." - echo 1>&2 "See README.md" - exit 1 +if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then + if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then + echo 1>&2 "In the new build system, mkerrors should not be called directly." + echo 1>&2 "See README.md" + exit 1 + fi fi if [[ "$GOOS" = "aix" ]]; then @@ -85,7 +87,6 @@ includes_DragonFly=' #include #include #include -#include #include #include #include @@ -99,7 +100,7 @@ includes_DragonFly=' ' includes_FreeBSD=' -#include +#include #include #include #include @@ -179,28 +180,21 @@ struct ltchars { #include #include #include -#include #include #include -#include -#include #include #include #include #include -#include #include #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include @@ -222,19 +216,9 @@ struct ltchars { #include #include #include -#include -#include #include #include - -#if defined(__sparc__) -// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the -// definition in glibc. As only the error constants are needed here, include the -// generic termibits.h (which is included by termbits.h on sparc). -#include -#else #include -#endif #ifndef MSG_FASTOPEN #define MSG_FASTOPEN 0x20000000 @@ -270,7 +254,6 @@ includes_NetBSD=' #include #include #include -#include #include #include #include @@ -296,7 +279,6 @@ includes_OpenBSD=' #include #include #include -#include #include #include #include @@ -398,7 +380,6 @@ ccflags="$@" $2 ~ /^EXTATTR_NAMESPACE_NAMES/ || $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next} - $2 !~ /^ECCAPBITS/ && $2 !~ /^ETH_/ && $2 !~ /^EPROC_/ && $2 !~ /^EQUIV_/ && @@ -434,7 +415,7 @@ ccflags="$@" $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|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 ~ /^FALLOC_/ || $2 == "ICMPV6_FILTER" || @@ -445,14 +426,11 @@ ccflags="$@" $2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ || $2 ~ /^HW_MACHINE$/ || $2 ~ /^SYSCTL_VERS/ || - $2 !~ "MNT_BITS" && $2 ~ /^(MS|MNT|UMOUNT)_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || - $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ || - $2 ~ /^KEXEC_/ || + $2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ || $2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || - $2 ~ /^MODULE_INIT_/ || $2 !~ "NLA_TYPE_MASK" && $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ || $2 ~ /^SIOC/ || @@ -467,15 +445,14 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && + $2 !~ /^(BPF_TIMEVAL)$/ && $2 ~ /^(BPF|DLT)_/ || - $2 ~ /^(CLOCK|TIMER)_/ || + $2 ~ /^CLOCK_/ || $2 ~ /^CAN_/ || $2 ~ /^CAP_/ || $2 ~ /^ALG_/ || $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ || $2 ~ /^GRND_/ || - $2 ~ /^RND/ || $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_EVENT_IOC_/ || @@ -499,13 +476,9 @@ ccflags="$@" $2 ~ /^FSOPT_/ || $2 ~ /^WDIOC_/ || $2 ~ /^NFN/ || - $2 ~ /^XDP_/ || $2 ~ /^(HDIO|WIN|SMART)_/ || - $2 ~ /^CRYPTO_/ || $2 !~ "WMESGLEN" && $2 ~ /^W[A-Z0-9]+$/ || - $2 ~/^PPPIOC/ || - $2 ~ /^FAN_|FANOTIFY_/ || $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} diff --git a/vendor/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go index 4d5b531b..7e5c22c4 100644 --- a/vendor/golang.org/x/sys/unix/mkpost.go +++ b/vendor/golang.org/x/sys/unix/mkpost.go @@ -28,10 +28,10 @@ func main() { if goarch == "" { goarch = os.Getenv("GOARCH") } - // Check that we are using the Docker-based build system if we should be. - if goos == "linux" { + // Check that we are using the new build system if we should be. + if goos == "linux" && goarch != "sparc64" { if os.Getenv("GOLANG_SYS_BUILD") != "docker" { - os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n") + os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n") os.Stderr.WriteString("See README.md\n") os.Exit(1) } @@ -42,21 +42,10 @@ func main() { log.Fatal(err) } - if goos == "aix" { - // Replace type of Atim, Mtim and Ctim by Timespec in Stat_t - // to avoid having both StTimespec and Timespec. - sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`) - b = sttimespec.ReplaceAll(b, []byte("Timespec")) - } - // Intentionally export __val fields in Fsid and Sigset_t valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`) b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}")) - // Intentionally export __fds_bits field in FdSet - fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`) - b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}")) - // If we have empty Ptrace structs, we should delete them. Only s390x emits // nonempty Ptrace structs. ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`) @@ -76,10 +65,6 @@ func main() { convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`) b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte")) - // Convert [1024]int8 to [1024]byte in Ptmget members - convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`) - b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte")) - // Remove spare fields (e.g. in Statx_t) spareFieldsRegex := regexp.MustCompile(`X__spare\S*`) b = spareFieldsRegex.ReplaceAll(b, []byte("_")) @@ -103,15 +88,6 @@ func main() { cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`) b = cgoCommandRegex.ReplaceAll(b, []byte(replacement)) - // Rename Stat_t time fields - if goos == "freebsd" && goarch == "386" { - // Hide Stat_t.[AMCB]tim_ext fields - renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`) - b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_")) - } - renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`) - b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}")) - // gofmt b, err = format.Source(b) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/mksyscall.go b/vendor/golang.org/x/sys/unix/mksyscall.go deleted file mode 100644 index e4af9424..00000000 --- a/vendor/golang.org/x/sys/unix/mksyscall.go +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -/* -This program reads a file containing function prototypes -(like syscall_darwin.go) and generates system call bodies. -The prototypes are marked by lines beginning with "//sys" -and read like func declarations if //sys is replaced by func, but: - * The parameter lists must give a name for each argument. - This includes return parameters. - * The parameter lists must give a type for each argument: - the (x, y, z int) shorthand is not allowed. - * If the return parameter is an error number, it must be named errno. - -A line beginning with //sysnb is like //sys, except that the -goroutine will not be suspended during the execution of the system -call. This must only be used for system calls which can never -block, as otherwise the system call could cause all goroutines to -hang. -*/ -package main - -import ( - "bufio" - "flag" - "fmt" - "os" - "regexp" - "strings" -) - -var ( - b32 = flag.Bool("b32", false, "32bit big-endian") - l32 = flag.Bool("l32", false, "32bit little-endian") - plan9 = flag.Bool("plan9", false, "plan9") - openbsd = flag.Bool("openbsd", false, "openbsd") - netbsd = flag.Bool("netbsd", false, "netbsd") - dragonfly = flag.Bool("dragonfly", false, "dragonfly") - arm = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair - tags = flag.String("tags", "", "build tags") - filename = flag.String("output", "", "output file name (standard output if omitted)") -) - -// cmdLine returns this programs's commandline arguments -func cmdLine() string { - return "go run mksyscall.go " + strings.Join(os.Args[1:], " ") -} - -// buildTags returns build tags -func buildTags() string { - return *tags -} - -// Param is function parameter -type Param struct { - Name string - Type string -} - -// usage prints the program usage -func usage() { - fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n") - os.Exit(1) -} - -// parseParamList parses parameter list and returns a slice of parameters -func parseParamList(list string) []string { - list = strings.TrimSpace(list) - if list == "" { - return []string{} - } - return regexp.MustCompile(`\s*,\s*`).Split(list, -1) -} - -// parseParam splits a parameter into name and type -func parseParam(p string) Param { - ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p) - if ps == nil { - fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p) - os.Exit(1) - } - return Param{ps[1], ps[2]} -} - -func main() { - // Get the OS and architecture (using GOARCH_TARGET if it exists) - goos := os.Getenv("GOOS") - if goos == "" { - fmt.Fprintln(os.Stderr, "GOOS not defined in environment") - os.Exit(1) - } - goarch := os.Getenv("GOARCH_TARGET") - if goarch == "" { - goarch = os.Getenv("GOARCH") - } - - // Check that we are using the Docker-based build system if we should - if goos == "linux" { - if os.Getenv("GOLANG_SYS_BUILD") != "docker" { - fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n") - fmt.Fprintf(os.Stderr, "See README.md\n") - os.Exit(1) - } - } - - flag.Usage = usage - flag.Parse() - if len(flag.Args()) <= 0 { - fmt.Fprintf(os.Stderr, "no files to parse provided\n") - usage() - } - - endianness := "" - if *b32 { - endianness = "big-endian" - } else if *l32 { - endianness = "little-endian" - } - - libc := false - if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") { - libc = true - } - trampolines := map[string]bool{} - - text := "" - for _, path := range flag.Args() { - file, err := os.Open(path) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - s := bufio.NewScanner(file) - for s.Scan() { - t := s.Text() - t = strings.TrimSpace(t) - t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `) - nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t) - if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil { - continue - } - - // Line must be of the form - // func Open(path string, mode int, perm int) (fd int, errno error) - // Split into name, in params, out params. - f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t) - if f == nil { - fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t) - os.Exit(1) - } - funct, inps, outps, sysname := f[2], f[3], f[4], f[5] - - // ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers. - if goos == "darwin" && !libc && funct == "ClockGettime" { - continue - } - - // Split argument lists on comma. - in := parseParamList(inps) - out := parseParamList(outps) - - // Try in vain to keep people from editing this file. - // The theory is that they jump into the middle of the file - // without reading the header. - text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" - - // Go function header. - outDecl := "" - if len(out) > 0 { - outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", ")) - } - text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl) - - // Check if err return available - errvar := "" - for _, param := range out { - p := parseParam(param) - if p.Type == "error" { - errvar = p.Name - break - } - } - - // Prepare arguments to Syscall. - var args []string - n := 0 - for _, param := range in { - p := parseParam(param) - if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { - args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))") - } else if p.Type == "string" && errvar != "" { - text += fmt.Sprintf("\tvar _p%d *byte\n", n) - text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name) - text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) - args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - n++ - } else if p.Type == "string" { - fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n") - text += fmt.Sprintf("\tvar _p%d *byte\n", n) - text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name) - args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - n++ - } else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil { - // Convert slice into pointer, length. - // Have to be careful not to take address of &a[0] if len == 0: - // pass dummy pointer in that case. - // Used to pass nil, but some OSes or simulators reject write(fd, nil, 0). - text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n) - text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name) - text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n) - args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name)) - n++ - } else if p.Type == "int64" && (*openbsd || *netbsd) { - args = append(args, "0") - if endianness == "big-endian" { - args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name)) - } else if endianness == "little-endian" { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name)) - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name)) - } - } else if p.Type == "int64" && *dragonfly { - if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil { - args = append(args, "0") - } - if endianness == "big-endian" { - args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name)) - } else if endianness == "little-endian" { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name)) - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name)) - } - } else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" { - if len(args)%2 == 1 && *arm { - // arm abi specifies 64-bit argument uses - // (even, odd) pair - args = append(args, "0") - } - if endianness == "big-endian" { - args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name)) - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name)) - } - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name)) - } - } - - // Determine which form to use; pad args with zeros. - asm := "Syscall" - if nonblock != nil { - if errvar == "" && goos == "linux" { - asm = "RawSyscallNoError" - } else { - asm = "RawSyscall" - } - } else { - if errvar == "" && goos == "linux" { - asm = "SyscallNoError" - } - } - if len(args) <= 3 { - for len(args) < 3 { - args = append(args, "0") - } - } else if len(args) <= 6 { - asm += "6" - for len(args) < 6 { - args = append(args, "0") - } - } else if len(args) <= 9 { - asm += "9" - for len(args) < 9 { - args = append(args, "0") - } - } else { - fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct) - } - - // System call number. - if sysname == "" { - sysname = "SYS_" + funct - sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`) - sysname = strings.ToUpper(sysname) - } - - var libcFn string - if libc { - asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call - sysname = strings.TrimPrefix(sysname, "SYS_") // remove SYS_ - sysname = strings.ToLower(sysname) // lowercase - if sysname == "getdirentries64" { - // Special case - libSystem name and - // raw syscall name don't match. - sysname = "__getdirentries64" - } - libcFn = sysname - sysname = "funcPC(libc_" + sysname + "_trampoline)" - } - - // Actual call. - arglist := strings.Join(args, ", ") - call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist) - - // Assign return values. - body := "" - ret := []string{"_", "_", "_"} - doErrno := false - for i := 0; i < len(out); i++ { - p := parseParam(out[i]) - reg := "" - if p.Name == "err" && !*plan9 { - reg = "e1" - ret[2] = reg - doErrno = true - } else if p.Name == "err" && *plan9 { - ret[0] = "r0" - ret[2] = "e1" - break - } else { - reg = fmt.Sprintf("r%d", i) - ret[i] = reg - } - if p.Type == "bool" { - reg = fmt.Sprintf("%s != 0", reg) - } - if p.Type == "int64" && endianness != "" { - // 64-bit number in r1:r0 or r0:r1. - if i+2 > len(out) { - fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct) - } - if endianness == "big-endian" { - reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1) - } else { - reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i) - } - ret[i] = fmt.Sprintf("r%d", i) - ret[i+1] = fmt.Sprintf("r%d", i+1) - } - if reg != "e1" || *plan9 { - body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg) - } - } - if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" { - text += fmt.Sprintf("\t%s\n", call) - } else { - if errvar == "" && goos == "linux" { - // raw syscall without error on Linux, see golang.org/issue/22924 - text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call) - } else { - text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call) - } - } - text += body - - if *plan9 && ret[2] == "e1" { - text += "\tif int32(r0) == -1 {\n" - text += "\t\terr = e1\n" - text += "\t}\n" - } else if doErrno { - text += "\tif e1 != 0 {\n" - text += "\t\terr = errnoErr(e1)\n" - text += "\t}\n" - } - text += "\treturn\n" - text += "}\n\n" - - if libc && !trampolines[libcFn] { - // some system calls share a trampoline, like read and readlen. - trampolines[libcFn] = true - // Declare assembly trampoline. - text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn) - // Assembly trampoline calls the libc_* function, which this magic - // redirects to use the function from libSystem. - text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn) - text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn) - text += "\n" - } - } - if err := s.Err(); err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - file.Close() - } - fmt.Printf(srcTemplate, cmdLine(), buildTags(), text) -} - -const srcTemplate = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -%s -` diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl new file mode 100755 index 00000000..1f6b926f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/mksyscall.pl @@ -0,0 +1,341 @@ +#!/usr/bin/env perl +# Copyright 2009 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# This program reads a file containing function prototypes +# (like syscall_darwin.go) and generates system call bodies. +# The prototypes are marked by lines beginning with "//sys" +# and read like func declarations if //sys is replaced by func, but: +# * The parameter lists must give a name for each argument. +# This includes return parameters. +# * The parameter lists must give a type for each argument: +# the (x, y, z int) shorthand is not allowed. +# * If the return parameter is an error number, it must be named errno. + +# A line beginning with //sysnb is like //sys, except that the +# goroutine will not be suspended during the execution of the system +# call. This must only be used for system calls which can never +# block, as otherwise the system call could cause all goroutines to +# hang. + +use strict; + +my $cmdline = "mksyscall.pl " . join(' ', @ARGV); +my $errors = 0; +my $_32bit = ""; +my $plan9 = 0; +my $openbsd = 0; +my $netbsd = 0; +my $dragonfly = 0; +my $arm = 0; # 64-bit value should use (even, odd)-pair +my $tags = ""; # build tags + +if($ARGV[0] eq "-b32") { + $_32bit = "big-endian"; + shift; +} elsif($ARGV[0] eq "-l32") { + $_32bit = "little-endian"; + shift; +} +if($ARGV[0] eq "-plan9") { + $plan9 = 1; + shift; +} +if($ARGV[0] eq "-openbsd") { + $openbsd = 1; + shift; +} +if($ARGV[0] eq "-netbsd") { + $netbsd = 1; + shift; +} +if($ARGV[0] eq "-dragonfly") { + $dragonfly = 1; + shift; +} +if($ARGV[0] eq "-arm") { + $arm = 1; + shift; +} +if($ARGV[0] eq "-tags") { + shift; + $tags = $ARGV[0]; + shift; +} + +if($ARGV[0] =~ /^-/) { + print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n"; + exit 1; +} + +# Check that we are using the new build system if we should +if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") { + if($ENV{'GOLANG_SYS_BUILD'} ne "docker") { + print STDERR "In the new build system, mksyscall should not be called directly.\n"; + print STDERR "See README.md\n"; + exit 1; + } +} + + +sub parseparamlist($) { + my ($list) = @_; + $list =~ s/^\s*//; + $list =~ s/\s*$//; + if($list eq "") { + return (); + } + return split(/\s*,\s*/, $list); +} + +sub parseparam($) { + my ($p) = @_; + if($p !~ /^(\S*) (\S*)$/) { + print STDERR "$ARGV:$.: malformed parameter: $p\n"; + $errors = 1; + return ("xx", "int"); + } + return ($1, $2); +} + +my $text = ""; +while(<>) { + chomp; + s/\s+/ /g; + s/^\s+//; + s/\s+$//; + my $nonblock = /^\/\/sysnb /; + next if !/^\/\/sys / && !$nonblock; + + # Line must be of the form + # func Open(path string, mode int, perm int) (fd int, errno error) + # Split into name, in params, out params. + if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) { + print STDERR "$ARGV:$.: malformed //sys declaration\n"; + $errors = 1; + next; + } + my ($func, $in, $out, $sysname) = ($2, $3, $4, $5); + + # Split argument lists on comma. + my @in = parseparamlist($in); + my @out = parseparamlist($out); + + # Try in vain to keep people from editing this file. + # The theory is that they jump into the middle of the file + # without reading the header. + $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; + + # Go function header. + my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : ""; + $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl; + + # Check if err return available + my $errvar = ""; + foreach my $p (@out) { + my ($name, $type) = parseparam($p); + if($type eq "error") { + $errvar = $name; + last; + } + } + + # Prepare arguments to Syscall. + my @args = (); + my $n = 0; + foreach my $p (@in) { + my ($name, $type) = parseparam($p); + if($type =~ /^\*/) { + push @args, "uintptr(unsafe.Pointer($name))"; + } elsif($type eq "string" && $errvar ne "") { + $text .= "\tvar _p$n *byte\n"; + $text .= "\t_p$n, $errvar = BytePtrFromString($name)\n"; + $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; + push @args, "uintptr(unsafe.Pointer(_p$n))"; + $n++; + } elsif($type eq "string") { + print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; + $text .= "\tvar _p$n *byte\n"; + $text .= "\t_p$n, _ = BytePtrFromString($name)\n"; + push @args, "uintptr(unsafe.Pointer(_p$n))"; + $n++; + } elsif($type =~ /^\[\](.*)/) { + # Convert slice into pointer, length. + # Have to be careful not to take address of &a[0] if len == 0: + # pass dummy pointer in that case. + # Used to pass nil, but some OSes or simulators reject write(fd, nil, 0). + $text .= "\tvar _p$n unsafe.Pointer\n"; + $text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}"; + $text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}"; + $text .= "\n"; + push @args, "uintptr(_p$n)", "uintptr(len($name))"; + $n++; + } elsif($type eq "int64" && ($openbsd || $netbsd)) { + push @args, "0"; + if($_32bit eq "big-endian") { + push @args, "uintptr($name>>32)", "uintptr($name)"; + } elsif($_32bit eq "little-endian") { + push @args, "uintptr($name)", "uintptr($name>>32)"; + } else { + push @args, "uintptr($name)"; + } + } elsif($type eq "int64" && $dragonfly) { + if ($func !~ /^extp(read|write)/i) { + push @args, "0"; + } + if($_32bit eq "big-endian") { + push @args, "uintptr($name>>32)", "uintptr($name)"; + } elsif($_32bit eq "little-endian") { + push @args, "uintptr($name)", "uintptr($name>>32)"; + } else { + push @args, "uintptr($name)"; + } + } elsif($type eq "int64" && $_32bit ne "") { + if(@args % 2 && $arm) { + # arm abi specifies 64-bit argument uses + # (even, odd) pair + push @args, "0" + } + if($_32bit eq "big-endian") { + push @args, "uintptr($name>>32)", "uintptr($name)"; + } else { + push @args, "uintptr($name)", "uintptr($name>>32)"; + } + } else { + push @args, "uintptr($name)"; + } + } + + # Determine which form to use; pad args with zeros. + my $asm = "Syscall"; + if ($nonblock) { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { + $asm = "RawSyscallNoError"; + } else { + $asm = "RawSyscall"; + } + } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { + $asm = "SyscallNoError"; + } + } + if(@args <= 3) { + while(@args < 3) { + push @args, "0"; + } + } elsif(@args <= 6) { + $asm .= "6"; + while(@args < 6) { + push @args, "0"; + } + } elsif(@args <= 9) { + $asm .= "9"; + while(@args < 9) { + push @args, "0"; + } + } else { + print STDERR "$ARGV:$.: too many arguments to system call\n"; + } + + # System call number. + if($sysname eq "") { + $sysname = "SYS_$func"; + $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar + $sysname =~ y/a-z/A-Z/; + } + + # Actual call. + my $args = join(', ', @args); + my $call = "$asm($sysname, $args)"; + + # Assign return values. + my $body = ""; + my @ret = ("_", "_", "_"); + my $do_errno = 0; + for(my $i=0; $i<@out; $i++) { + my $p = $out[$i]; + my ($name, $type) = parseparam($p); + my $reg = ""; + if($name eq "err" && !$plan9) { + $reg = "e1"; + $ret[2] = $reg; + $do_errno = 1; + } elsif($name eq "err" && $plan9) { + $ret[0] = "r0"; + $ret[2] = "e1"; + next; + } else { + $reg = sprintf("r%d", $i); + $ret[$i] = $reg; + } + if($type eq "bool") { + $reg = "$reg != 0"; + } + if($type eq "int64" && $_32bit ne "") { + # 64-bit number in r1:r0 or r0:r1. + if($i+2 > @out) { + print STDERR "$ARGV:$.: not enough registers for int64 return\n"; + } + if($_32bit eq "big-endian") { + $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1); + } else { + $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i); + } + $ret[$i] = sprintf("r%d", $i); + $ret[$i+1] = sprintf("r%d", $i+1); + } + if($reg ne "e1" || $plan9) { + $body .= "\t$name = $type($reg)\n"; + } + } + if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { + $text .= "\t$call\n"; + } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { + # raw syscall without error on Linux, see golang.org/issue/22924 + $text .= "\t$ret[0], $ret[1] := $call\n"; + } else { + $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; + } + } + $text .= $body; + + if ($plan9 && $ret[2] eq "e1") { + $text .= "\tif int32(r0) == -1 {\n"; + $text .= "\t\terr = e1\n"; + $text .= "\t}\n"; + } elsif ($do_errno) { + $text .= "\tif e1 != 0 {\n"; + $text .= "\t\terr = errnoErr(e1)\n"; + $text .= "\t}\n"; + } + $text .= "\treturn\n"; + $text .= "}\n\n"; +} + +chomp $text; +chomp $text; + +if($errors) { + exit 1; +} + +print <) { + chomp; + s/\s+/ /g; + s/^\s+//; + s/\s+$//; + $package = $1 if !$package && /^package (\S+)$/; + my $nonblock = /^\/\/sysnb /; + next if !/^\/\/sys / && !$nonblock; + + # Line must be of the form + # func Open(path string, mode int, perm int) (fd int, err error) + # Split into name, in params, out params. + if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { + print STDERR "$ARGV:$.: malformed //sys declaration\n"; + $errors = 1; + next; + } + my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); + + # Split argument lists on comma. + my @in = parseparamlist($in); + my @out = parseparamlist($out); + + $in = join(', ', @in); + $out = join(', ', @out); + + # Try in vain to keep people from editing this file. + # The theory is that they jump into the middle of the file + # without reading the header. + $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; + + # Check if value return, err return available + my $errvar = ""; + my $retvar = ""; + my $rettype = ""; + foreach my $p (@out) { + my ($name, $type) = parseparam($p); + if($type eq "error") { + $errvar = $name; + } else { + $retvar = $name; + $rettype = $type; + } + } + + # System call name. + #if($func ne "fcntl") { + + if($sysname eq "") { + $sysname = "$func"; + } + + $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; + $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. + + my $C_rettype = ""; + if($rettype eq "unsafe.Pointer") { + $C_rettype = "uintptr_t"; + } elsif($rettype eq "uintptr") { + $C_rettype = "uintptr_t"; + } elsif($rettype =~ /^_/) { + $C_rettype = "uintptr_t"; + } elsif($rettype eq "int") { + $C_rettype = "int"; + } elsif($rettype eq "int32") { + $C_rettype = "int"; + } elsif($rettype eq "int64") { + $C_rettype = "long long"; + } elsif($rettype eq "uint32") { + $C_rettype = "unsigned int"; + } elsif($rettype eq "uint64") { + $C_rettype = "unsigned long long"; + } else { + $C_rettype = "int"; + } + if($sysname eq "exit") { + $C_rettype = "void"; + } + + # Change types to c + my @c_in = (); + foreach my $p (@in) { + my ($name, $type) = parseparam($p); + if($type =~ /^\*/) { + push @c_in, "uintptr_t"; + } elsif($type eq "string") { + push @c_in, "uintptr_t"; + } elsif($type =~ /^\[\](.*)/) { + push @c_in, "uintptr_t", "size_t"; + } elsif($type eq "unsafe.Pointer") { + push @c_in, "uintptr_t"; + } elsif($type eq "uintptr") { + push @c_in, "uintptr_t"; + } elsif($type =~ /^_/) { + push @c_in, "uintptr_t"; + } elsif($type eq "int") { + push @c_in, "int"; + } elsif($type eq "int32") { + push @c_in, "int"; + } elsif($type eq "int64") { + push @c_in, "long long"; + } elsif($type eq "uint32") { + push @c_in, "unsigned int"; + } elsif($type eq "uint64") { + push @c_in, "unsigned long long"; + } else { + push @c_in, "int"; + } + } + + if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") { + # Imports of system calls from libc + $c_extern .= "$C_rettype $sysname"; + my $c_in = join(', ', @c_in); + $c_extern .= "($c_in);\n"; + } + + # So file name. + if($aix) { + if($modname eq "") { + $modname = "libc.a/shr_64.o"; + } else { + print STDERR "$func: only syscall using libc are available\n"; + $errors = 1; + next; + } + } + + my $strconvfunc = "C.CString"; + my $strconvtype = "*byte"; + + # Go function header. + if($out ne "") { + $out = " ($out)"; + } + if($text ne "") { + $text .= "\n" + } + + $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ; + + # Prepare arguments to call. + my @args = (); + my $n = 0; + my $arg_n = 0; + foreach my $p (@in) { + my ($name, $type) = parseparam($p); + if($type =~ /^\*/) { + push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))"; + } elsif($type eq "string" && $errvar ne "") { + $text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n"; + push @args, "C.uintptr_t(_p$n)"; + $n++; + } elsif($type eq "string") { + print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; + $text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n"; + push @args, "C.uintptr_t(_p$n)"; + $n++; + } elsif($type =~ /^\[\](.*)/) { + # Convert slice into pointer, length. + # Have to be careful not to take address of &a[0] if len == 0: + # pass nil in that case. + $text .= "\tvar _p$n *$1\n"; + $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; + push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))"; + $n++; + $text .= "\tvar _p$n int\n"; + $text .= "\t_p$n = len($name)\n"; + push @args, "C.size_t(_p$n)"; + $n++; + } elsif($type eq "int64" && $_32bit ne "") { + if($_32bit eq "big-endian") { + push @args, "uintptr($name >> 32)", "uintptr($name)"; + } else { + push @args, "uintptr($name)", "uintptr($name >> 32)"; + } + $n++; + } elsif($type eq "bool") { + $text .= "\tvar _p$n uint32\n"; + $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; + push @args, "_p$n"; + $n++; + } elsif($type =~ /^_/) { + push @args, "C.uintptr_t(uintptr($name))"; + } elsif($type eq "unsafe.Pointer") { + push @args, "C.uintptr_t(uintptr($name))"; + } elsif($type eq "int") { + if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) { + push @args, "C.size_t($name)"; + } elsif ($arg_n == 0 && $func eq "fcntl") { + push @args, "C.uintptr_t($name)"; + } elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) { + push @args, "C.uintptr_t($name)"; + } else { + push @args, "C.int($name)"; + } + } elsif($type eq "int32") { + push @args, "C.int($name)"; + } elsif($type eq "int64") { + push @args, "C.longlong($name)"; + } elsif($type eq "uint32") { + push @args, "C.uint($name)"; + } elsif($type eq "uint64") { + push @args, "C.ulonglong($name)"; + } elsif($type eq "uintptr") { + push @args, "C.uintptr_t($name)"; + } else { + push @args, "C.int($name)"; + } + $arg_n++; + } + my $nargs = @args; + + + # Determine which form to use; pad args with zeros. + if ($nonblock) { + } + + my $args = join(', ', @args); + my $call = ""; + if ($sysname eq "exit") { + if ($errvar ne "") { + $call .= "er :="; + } else { + $call .= ""; + } + } elsif ($errvar ne "") { + $call .= "r0,er :="; + } elsif ($retvar ne "") { + $call .= "r0,_ :="; + } else { + $call .= "" + } + $call .= "C.$sysname($args)"; + + # Assign return values. + my $body = ""; + my $failexpr = ""; + + for(my $i=0; $i<@out; $i++) { + my $p = $out[$i]; + my ($name, $type) = parseparam($p); + my $reg = ""; + if($name eq "err") { + $reg = "e1"; + } else { + $reg = "r0"; + } + if($reg ne "e1" ) { + $body .= "\t$name = $type($reg)\n"; + } + } + + # verify return + if ($sysname ne "exit" && $errvar ne "") { + if ($C_rettype =~ /^uintptr/) { + $body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n"; + $body .= "\t\t$errvar = er\n"; + $body .= "\t}\n"; + } else { + $body .= "\tif \(r0 ==-1 && er != nil\) {\n"; + $body .= "\t\t$errvar = er\n"; + $body .= "\t}\n"; + } + } elsif ($errvar ne "") { + $body .= "\tif \(er != nil\) {\n"; + $body .= "\t\t$errvar = er\n"; + $body .= "\t}\n"; + } + + $text .= "\t$call\n"; + $text .= $body; + + $text .= "\treturn\n"; + $text .= "}\n"; +} + +if($errors) { + exit 1; +} + +print < 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name) - args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n)) - n++ - text += fmt.Sprintf("\tvar _p%d int\n", n) - text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name) - args = append(args, fmt.Sprintf("C.size_t(_p%d)", n)) - n++ - } else if p.Type == "int64" && endianness != "" { - if endianness == "big-endian" { - args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name)) - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name)) - } - n++ - } else if p.Type == "bool" { - text += fmt.Sprintf("\tvar _p%d uint32\n", n) - text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n) - args = append(args, fmt.Sprintf("_p%d", n)) - } else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil { - args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name)) - } else if p.Type == "unsafe.Pointer" { - args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name)) - } else if p.Type == "int" { - if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) { - args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name)) - } else if argN == 0 && funct == "fcntl" { - args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) { - args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else { - args = append(args, fmt.Sprintf("C.int(%s)", p.Name)) - } - } else if p.Type == "int32" { - args = append(args, fmt.Sprintf("C.int(%s)", p.Name)) - } else if p.Type == "int64" { - args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name)) - } else if p.Type == "uint32" { - args = append(args, fmt.Sprintf("C.uint(%s)", p.Name)) - } else if p.Type == "uint64" { - args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name)) - } else if p.Type == "uintptr" { - args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else { - args = append(args, fmt.Sprintf("C.int(%s)", p.Name)) - } - argN++ - } - - // Actual call. - arglist := strings.Join(args, ", ") - call := "" - if sysname == "exit" { - if errvar != "" { - call += "er :=" - } else { - call += "" - } - } else if errvar != "" { - call += "r0,er :=" - } else if retvar != "" { - call += "r0,_ :=" - } else { - call += "" - } - if sysname == "select" { - // select is a keyword of Go. Its name is - // changed to c_select. - call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist) - } else { - call += fmt.Sprintf("C.%s(%s)", sysname, arglist) - } - - // Assign return values. - body := "" - for i := 0; i < len(out); i++ { - p := parseParam(out[i]) - reg := "" - if p.Name == "err" { - reg = "e1" - } else { - reg = "r0" - } - if reg != "e1" { - body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg) - } - } - - // verify return - if sysname != "exit" && errvar != "" { - if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil { - body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n" - body += fmt.Sprintf("\t\t%s = er\n", errvar) - body += "\t}\n" - } else { - body += "\tif (r0 ==-1 && er != nil) {\n" - body += fmt.Sprintf("\t\t%s = er\n", errvar) - body += "\t}\n" - } - } else if errvar != "" { - body += "\tif (er != nil) {\n" - body += fmt.Sprintf("\t\t%s = er\n", errvar) - body += "\t}\n" - } - - text += fmt.Sprintf("\t%s\n", call) - text += body - - text += "\treturn\n" - text += "}\n" - } - if err := s.Err(); err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - file.Close() - } - imp := "" - if pack != "unix" { - imp = "import \"golang.org/x/sys/unix\"\n" - - } - fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text) -} - -const srcTemplate = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s - -package %s - - -%s -*/ -import "C" -import ( - "unsafe" -) - - -%s - -%s -` diff --git a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go deleted file mode 100644 index c9600995..00000000 --- a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright 2019 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 ignore - -/* -This program reads a file containing function prototypes -(like syscall_aix.go) and generates system call bodies. -The prototypes are marked by lines beginning with "//sys" -and read like func declarations if //sys is replaced by func, but: - * The parameter lists must give a name for each argument. - This includes return parameters. - * The parameter lists must give a type for each argument: - the (x, y, z int) shorthand is not allowed. - * If the return parameter is an error number, it must be named err. - * If go func name needs to be different than its libc name, - * or the function is not in libc, name could be specified - * at the end, after "=" sign, like - //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt - - -This program will generate three files and handle both gc and gccgo implementation: - - zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation) - - zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6 - - zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type. - - The generated code looks like this - -zsyscall_aix_ppc64.go -func asyscall(...) (n int, err error) { - // Pointer Creation - r1, e1 := callasyscall(...) - // Type Conversion - // Error Handler - return -} - -zsyscall_aix_ppc64_gc.go -//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o" -//go:linkname libc_asyscall libc_asyscall -var asyscall syscallFunc - -func callasyscall(...) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... ) - return -} - -zsyscall_aix_ppc64_ggcgo.go - -// int asyscall(...) - -import "C" - -func callasyscall(...) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.asyscall(...)) - e1 = syscall.GetErrno() - return -} -*/ - -package main - -import ( - "bufio" - "flag" - "fmt" - "io/ioutil" - "os" - "regexp" - "strings" -) - -var ( - b32 = flag.Bool("b32", false, "32bit big-endian") - l32 = flag.Bool("l32", false, "32bit little-endian") - aix = flag.Bool("aix", false, "aix") - tags = flag.String("tags", "", "build tags") -) - -// cmdLine returns this programs's commandline arguments -func cmdLine() string { - return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ") -} - -// buildTags returns build tags -func buildTags() string { - return *tags -} - -// Param is function parameter -type Param struct { - Name string - Type string -} - -// usage prints the program usage -func usage() { - fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n") - os.Exit(1) -} - -// parseParamList parses parameter list and returns a slice of parameters -func parseParamList(list string) []string { - list = strings.TrimSpace(list) - if list == "" { - return []string{} - } - return regexp.MustCompile(`\s*,\s*`).Split(list, -1) -} - -// parseParam splits a parameter into name and type -func parseParam(p string) Param { - ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p) - if ps == nil { - fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p) - os.Exit(1) - } - return Param{ps[1], ps[2]} -} - -func main() { - flag.Usage = usage - flag.Parse() - if len(flag.Args()) <= 0 { - fmt.Fprintf(os.Stderr, "no files to parse provided\n") - usage() - } - - endianness := "" - if *b32 { - endianness = "big-endian" - } else if *l32 { - endianness = "little-endian" - } - - pack := "" - // GCCGO - textgccgo := "" - cExtern := "/*\n#include \n" - // GC - textgc := "" - dynimports := "" - linknames := "" - var vars []string - // COMMON - textcommon := "" - for _, path := range flag.Args() { - file, err := os.Open(path) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - s := bufio.NewScanner(file) - for s.Scan() { - t := s.Text() - t = strings.TrimSpace(t) - t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `) - if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" { - pack = p[1] - } - nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t) - if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil { - continue - } - - // Line must be of the form - // func Open(path string, mode int, perm int) (fd int, err error) - // Split into name, in params, out params. - f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t) - if f == nil { - fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t) - os.Exit(1) - } - funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6] - - // Split argument lists on comma. - in := parseParamList(inps) - out := parseParamList(outps) - - inps = strings.Join(in, ", ") - outps = strings.Join(out, ", ") - - if sysname == "" { - sysname = funct - } - - onlyCommon := false - if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" { - // This function call another syscall which is already implemented. - // Therefore, the gc and gccgo part must not be generated. - onlyCommon = true - } - - // Try in vain to keep people from editing this file. - // The theory is that they jump into the middle of the file - // without reading the header. - - textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" - if !onlyCommon { - textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" - textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" - } - - // Check if value return, err return available - errvar := "" - rettype := "" - for _, param := range out { - p := parseParam(param) - if p.Type == "error" { - errvar = p.Name - } else { - rettype = p.Type - } - } - - sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`) - sysname = strings.ToLower(sysname) // All libc functions are lowercase. - - // GCCGO Prototype return type - cRettype := "" - if rettype == "unsafe.Pointer" { - cRettype = "uintptr_t" - } else if rettype == "uintptr" { - cRettype = "uintptr_t" - } else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil { - cRettype = "uintptr_t" - } else if rettype == "int" { - cRettype = "int" - } else if rettype == "int32" { - cRettype = "int" - } else if rettype == "int64" { - cRettype = "long long" - } else if rettype == "uint32" { - cRettype = "unsigned int" - } else if rettype == "uint64" { - cRettype = "unsigned long long" - } else { - cRettype = "int" - } - if sysname == "exit" { - cRettype = "void" - } - - // GCCGO Prototype arguments type - var cIn []string - for i, param := range in { - p := parseParam(param) - if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { - cIn = append(cIn, "uintptr_t") - } else if p.Type == "string" { - cIn = append(cIn, "uintptr_t") - } else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil { - cIn = append(cIn, "uintptr_t", "size_t") - } else if p.Type == "unsafe.Pointer" { - cIn = append(cIn, "uintptr_t") - } else if p.Type == "uintptr" { - cIn = append(cIn, "uintptr_t") - } else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil { - cIn = append(cIn, "uintptr_t") - } else if p.Type == "int" { - if (i == 0 || i == 2) && funct == "fcntl" { - // These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock - cIn = append(cIn, "uintptr_t") - } else { - cIn = append(cIn, "int") - } - - } else if p.Type == "int32" { - cIn = append(cIn, "int") - } else if p.Type == "int64" { - cIn = append(cIn, "long long") - } else if p.Type == "uint32" { - cIn = append(cIn, "unsigned int") - } else if p.Type == "uint64" { - cIn = append(cIn, "unsigned long long") - } else { - cIn = append(cIn, "int") - } - } - - if !onlyCommon { - // GCCGO Prototype Generation - // Imports of system calls from libc - if sysname == "select" { - // select is a keyword of Go. Its name is - // changed to c_select. - cExtern += "#define c_select select\n" - } - cExtern += fmt.Sprintf("%s %s", cRettype, sysname) - cIn := strings.Join(cIn, ", ") - cExtern += fmt.Sprintf("(%s);\n", cIn) - } - // GC Library name - if modname == "" { - modname = "libc.a/shr_64.o" - } else { - fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct) - os.Exit(1) - } - sysvarname := fmt.Sprintf("libc_%s", sysname) - - if !onlyCommon { - // GC Runtime import of function to allow cross-platform builds. - dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname) - // GC Link symbol to proc address variable. - linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname) - // GC Library proc address variable. - vars = append(vars, sysvarname) - } - - strconvfunc := "BytePtrFromString" - strconvtype := "*byte" - - // Go function header. - if outps != "" { - outps = fmt.Sprintf(" (%s)", outps) - } - if textcommon != "" { - textcommon += "\n" - } - - textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps) - - // Prepare arguments tocall. - var argscommon []string // Arguments in the common part - var argscall []string // Arguments for call prototype - var argsgc []string // Arguments for gc call (with syscall6) - var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall) - n := 0 - argN := 0 - for _, param := range in { - p := parseParam(param) - if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { - argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name)) - argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) - argsgc = append(argsgc, p.Name) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else if p.Type == "string" && errvar != "" { - textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) - textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name) - textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) - - argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n)) - argsgc = append(argsgc, fmt.Sprintf("_p%d", n)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n)) - n++ - } else if p.Type == "string" { - fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n") - textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) - textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name) - textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) - - argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n)) - argsgc = append(argsgc, fmt.Sprintf("_p%d", n)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n)) - n++ - } else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil { - // Convert slice into pointer, length. - // Have to be careful not to take address of &a[0] if len == 0: - // pass nil in that case. - textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1]) - textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name) - argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name)) - argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n)) - argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n)) - n++ - } else if p.Type == "int64" && endianness != "" { - fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n") - } else if p.Type == "bool" { - fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n") - } else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" { - argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name)) - argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) - argsgc = append(argsgc, p.Name) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else if p.Type == "int" { - if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) { - // These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock - argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name)) - argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) - argsgc = append(argsgc, p.Name) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - - } else { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s int", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) - } - } else if p.Type == "int32" { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s int32", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) - } else if p.Type == "int64" { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s int64", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name)) - } else if p.Type == "uint32" { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name)) - } else if p.Type == "uint64" { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name)) - } else if p.Type == "uintptr" { - argscommon = append(argscommon, p.Name) - argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) - argsgc = append(argsgc, p.Name) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) - } else { - argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name)) - argscall = append(argscall, fmt.Sprintf("%s int", p.Name)) - argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) - argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) - } - argN++ - } - nargs := len(argsgc) - - // COMMON function generation - argscommonlist := strings.Join(argscommon, ", ") - callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist) - ret := []string{"_", "_"} - body := "" - doErrno := false - for i := 0; i < len(out); i++ { - p := parseParam(out[i]) - reg := "" - if p.Name == "err" { - reg = "e1" - ret[1] = reg - doErrno = true - } else { - reg = "r0" - ret[0] = reg - } - if p.Type == "bool" { - reg = fmt.Sprintf("%s != 0", reg) - } - if reg != "e1" { - body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg) - } - } - if ret[0] == "_" && ret[1] == "_" { - textcommon += fmt.Sprintf("\t%s\n", callcommon) - } else { - textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon) - } - textcommon += body - - if doErrno { - textcommon += "\tif e1 != 0 {\n" - textcommon += "\t\terr = errnoErr(e1)\n" - textcommon += "\t}\n" - } - textcommon += "\treturn\n" - textcommon += "}\n" - - if onlyCommon { - continue - } - - // CALL Prototype - callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", ")) - - // GC function generation - asm := "syscall6" - if nonblock != nil { - asm = "rawSyscall6" - } - - if len(argsgc) <= 6 { - for len(argsgc) < 6 { - argsgc = append(argsgc, "0") - } - } else { - fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct) - os.Exit(1) - } - argsgclist := strings.Join(argsgc, ", ") - callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist) - - textgc += callProto - textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc) - textgc += "\treturn\n}\n" - - // GCCGO function generation - argsgccgolist := strings.Join(argsgccgo, ", ") - var callgccgo string - if sysname == "select" { - // select is a keyword of Go. Its name is - // changed to c_select. - callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist) - } else { - callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) - } - textgccgo += callProto - textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo) - textgccgo += "\te1 = syscall.GetErrno()\n" - textgccgo += "\treturn\n}\n" - } - if err := s.Err(); err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - file.Close() - } - imp := "" - if pack != "unix" { - imp = "import \"golang.org/x/sys/unix\"\n" - - } - - // Print zsyscall_aix_ppc64.go - err := ioutil.WriteFile("zsyscall_aix_ppc64.go", - []byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)), - 0644) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - - // Print zsyscall_aix_ppc64_gc.go - vardecls := "\t" + strings.Join(vars, ",\n\t") - vardecls += " syscallFunc" - err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go", - []byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)), - 0644) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - - // Print zsyscall_aix_ppc64_gccgo.go - err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go", - []byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)), - 0644) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } -} - -const srcTemplate1 = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s - -package %s - -import ( - "unsafe" -) - - -%s - -%s -` -const srcTemplate2 = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s -// +build !gccgo - -package %s - -import ( - "unsafe" -) -%s -%s -%s -type syscallFunc uintptr - -var ( -%s -) - -// Implemented in runtime/syscall_aix.go. -func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) - -%s -` -const srcTemplate3 = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s -// +build gccgo - -package %s - -%s -*/ -import "C" -import ( - "syscall" -) - - -%s - -%s -` diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.go b/vendor/golang.org/x/sys/unix/mksyscall_solaris.go deleted file mode 100644 index 3d864738..00000000 --- a/vendor/golang.org/x/sys/unix/mksyscall_solaris.go +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright 2019 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 ignore - -/* - This program reads a file containing function prototypes - (like syscall_solaris.go) and generates system call bodies. - The prototypes are marked by lines beginning with "//sys" - and read like func declarations if //sys is replaced by func, but: - * The parameter lists must give a name for each argument. - This includes return parameters. - * The parameter lists must give a type for each argument: - the (x, y, z int) shorthand is not allowed. - * If the return parameter is an error number, it must be named err. - * If go func name needs to be different than its libc name, - * or the function is not in libc, name could be specified - * at the end, after "=" sign, like - //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt -*/ - -package main - -import ( - "bufio" - "flag" - "fmt" - "os" - "regexp" - "strings" -) - -var ( - b32 = flag.Bool("b32", false, "32bit big-endian") - l32 = flag.Bool("l32", false, "32bit little-endian") - tags = flag.String("tags", "", "build tags") -) - -// cmdLine returns this programs's commandline arguments -func cmdLine() string { - return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ") -} - -// buildTags returns build tags -func buildTags() string { - return *tags -} - -// Param is function parameter -type Param struct { - Name string - Type string -} - -// usage prints the program usage -func usage() { - fmt.Fprintf(os.Stderr, "usage: go run mksyscall_solaris.go [-b32 | -l32] [-tags x,y] [file ...]\n") - os.Exit(1) -} - -// parseParamList parses parameter list and returns a slice of parameters -func parseParamList(list string) []string { - list = strings.TrimSpace(list) - if list == "" { - return []string{} - } - return regexp.MustCompile(`\s*,\s*`).Split(list, -1) -} - -// parseParam splits a parameter into name and type -func parseParam(p string) Param { - ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p) - if ps == nil { - fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p) - os.Exit(1) - } - return Param{ps[1], ps[2]} -} - -func main() { - flag.Usage = usage - flag.Parse() - if len(flag.Args()) <= 0 { - fmt.Fprintf(os.Stderr, "no files to parse provided\n") - usage() - } - - endianness := "" - if *b32 { - endianness = "big-endian" - } else if *l32 { - endianness = "little-endian" - } - - pack := "" - text := "" - dynimports := "" - linknames := "" - var vars []string - for _, path := range flag.Args() { - file, err := os.Open(path) - if err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - s := bufio.NewScanner(file) - for s.Scan() { - t := s.Text() - t = strings.TrimSpace(t) - t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `) - if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" { - pack = p[1] - } - nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t) - if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil { - continue - } - - // Line must be of the form - // func Open(path string, mode int, perm int) (fd int, err error) - // Split into name, in params, out params. - f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t) - if f == nil { - fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t) - os.Exit(1) - } - funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6] - - // Split argument lists on comma. - in := parseParamList(inps) - out := parseParamList(outps) - - inps = strings.Join(in, ", ") - outps = strings.Join(out, ", ") - - // Try in vain to keep people from editing this file. - // The theory is that they jump into the middle of the file - // without reading the header. - text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" - - // So file name. - if modname == "" { - modname = "libc" - } - - // System call name. - if sysname == "" { - sysname = funct - } - - // System call pointer variable name. - sysvarname := fmt.Sprintf("proc%s", sysname) - - strconvfunc := "BytePtrFromString" - strconvtype := "*byte" - - sysname = strings.ToLower(sysname) // All libc functions are lowercase. - - // Runtime import of function to allow cross-platform builds. - dynimports += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"%s.so\"\n", sysname, sysname, modname) - // Link symbol to proc address variable. - linknames += fmt.Sprintf("//go:linkname %s libc_%s\n", sysvarname, sysname) - // Library proc address variable. - vars = append(vars, sysvarname) - - // Go function header. - outlist := strings.Join(out, ", ") - if outlist != "" { - outlist = fmt.Sprintf(" (%s)", outlist) - } - if text != "" { - text += "\n" - } - text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outlist) - - // Check if err return available - errvar := "" - for _, param := range out { - p := parseParam(param) - if p.Type == "error" { - errvar = p.Name - continue - } - } - - // Prepare arguments to Syscall. - var args []string - n := 0 - for _, param := range in { - p := parseParam(param) - if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { - args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))") - } else if p.Type == "string" && errvar != "" { - text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) - text += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name) - text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) - args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - n++ - } else if p.Type == "string" { - fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n") - text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) - text += fmt.Sprintf("\t_p%d, _ = %s(%s)\n", n, strconvfunc, p.Name) - args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) - n++ - } else if s := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); s != nil { - // Convert slice into pointer, length. - // Have to be careful not to take address of &a[0] if len == 0: - // pass nil in that case. - text += fmt.Sprintf("\tvar _p%d *%s\n", n, s[1]) - text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name) - args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("uintptr(len(%s))", p.Name)) - n++ - } else if p.Type == "int64" && endianness != "" { - if endianness == "big-endian" { - args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name)) - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name)) - } - } else if p.Type == "bool" { - text += fmt.Sprintf("\tvar _p%d uint32\n", n) - text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n) - args = append(args, fmt.Sprintf("uintptr(_p%d)", n)) - n++ - } else { - args = append(args, fmt.Sprintf("uintptr(%s)", p.Name)) - } - } - nargs := len(args) - - // Determine which form to use; pad args with zeros. - asm := "sysvicall6" - if nonblock != nil { - asm = "rawSysvicall6" - } - if len(args) <= 6 { - for len(args) < 6 { - args = append(args, "0") - } - } else { - fmt.Fprintf(os.Stderr, "%s: too many arguments to system call\n", path) - os.Exit(1) - } - - // Actual call. - arglist := strings.Join(args, ", ") - call := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, arglist) - - // Assign return values. - body := "" - ret := []string{"_", "_", "_"} - doErrno := false - for i := 0; i < len(out); i++ { - p := parseParam(out[i]) - reg := "" - if p.Name == "err" { - reg = "e1" - ret[2] = reg - doErrno = true - } else { - reg = fmt.Sprintf("r%d", i) - ret[i] = reg - } - if p.Type == "bool" { - reg = fmt.Sprintf("%d != 0", reg) - } - if p.Type == "int64" && endianness != "" { - // 64-bit number in r1:r0 or r0:r1. - if i+2 > len(out) { - fmt.Fprintf(os.Stderr, "%s: not enough registers for int64 return\n", path) - os.Exit(1) - } - if endianness == "big-endian" { - reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1) - } else { - reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i) - } - ret[i] = fmt.Sprintf("r%d", i) - ret[i+1] = fmt.Sprintf("r%d", i+1) - } - if reg != "e1" { - body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg) - } - } - if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" { - text += fmt.Sprintf("\t%s\n", call) - } else { - text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call) - } - text += body - - if doErrno { - text += "\tif e1 != 0 {\n" - text += "\t\terr = e1\n" - text += "\t}\n" - } - text += "\treturn\n" - text += "}\n" - } - if err := s.Err(); err != nil { - fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } - file.Close() - } - imp := "" - if pack != "unix" { - imp = "import \"golang.org/x/sys/unix\"\n" - - } - vardecls := "\t" + strings.Join(vars, ",\n\t") - vardecls += " syscallFunc" - fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text) -} - -const srcTemplate = `// %s -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build %s - -package %s - -import ( - "syscall" - "unsafe" -) -%s -%s -%s -var ( -%s -) - -%s -` diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl new file mode 100755 index 00000000..3e6ed9df --- /dev/null +++ b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl @@ -0,0 +1,289 @@ +#!/usr/bin/env perl +# Copyright 2009 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# This program reads a file containing function prototypes +# (like syscall_solaris.go) and generates system call bodies. +# The prototypes are marked by lines beginning with "//sys" +# and read like func declarations if //sys is replaced by func, but: +# * The parameter lists must give a name for each argument. +# This includes return parameters. +# * The parameter lists must give a type for each argument: +# the (x, y, z int) shorthand is not allowed. +# * If the return parameter is an error number, it must be named err. +# * If go func name needs to be different than its libc name, +# * or the function is not in libc, name could be specified +# * at the end, after "=" sign, like +# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt + +use strict; + +my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV); +my $errors = 0; +my $_32bit = ""; +my $tags = ""; # build tags + +binmode STDOUT; + +if($ARGV[0] eq "-b32") { + $_32bit = "big-endian"; + shift; +} elsif($ARGV[0] eq "-l32") { + $_32bit = "little-endian"; + shift; +} +if($ARGV[0] eq "-tags") { + shift; + $tags = $ARGV[0]; + shift; +} + +if($ARGV[0] =~ /^-/) { + print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n"; + exit 1; +} + +sub parseparamlist($) { + my ($list) = @_; + $list =~ s/^\s*//; + $list =~ s/\s*$//; + if($list eq "") { + return (); + } + return split(/\s*,\s*/, $list); +} + +sub parseparam($) { + my ($p) = @_; + if($p !~ /^(\S*) (\S*)$/) { + print STDERR "$ARGV:$.: malformed parameter: $p\n"; + $errors = 1; + return ("xx", "int"); + } + return ($1, $2); +} + +my $package = ""; +my $text = ""; +my $dynimports = ""; +my $linknames = ""; +my @vars = (); +while(<>) { + chomp; + s/\s+/ /g; + s/^\s+//; + s/\s+$//; + $package = $1 if !$package && /^package (\S+)$/; + my $nonblock = /^\/\/sysnb /; + next if !/^\/\/sys / && !$nonblock; + + # Line must be of the form + # func Open(path string, mode int, perm int) (fd int, err error) + # Split into name, in params, out params. + if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { + print STDERR "$ARGV:$.: malformed //sys declaration\n"; + $errors = 1; + next; + } + my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); + + # Split argument lists on comma. + my @in = parseparamlist($in); + my @out = parseparamlist($out); + + # So file name. + if($modname eq "") { + $modname = "libc"; + } + + # System call name. + if($sysname eq "") { + $sysname = "$func"; + } + + # System call pointer variable name. + my $sysvarname = "proc$sysname"; + + my $strconvfunc = "BytePtrFromString"; + my $strconvtype = "*byte"; + + $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. + + # Runtime import of function to allow cross-platform builds. + $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n"; + # Link symbol to proc address variable. + $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n"; + # Library proc address variable. + push @vars, $sysvarname; + + # Go function header. + $out = join(', ', @out); + if($out ne "") { + $out = " ($out)"; + } + if($text ne "") { + $text .= "\n" + } + $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out; + + # Check if err return available + my $errvar = ""; + foreach my $p (@out) { + my ($name, $type) = parseparam($p); + if($type eq "error") { + $errvar = $name; + last; + } + } + + # Prepare arguments to Syscall. + my @args = (); + my $n = 0; + foreach my $p (@in) { + my ($name, $type) = parseparam($p); + if($type =~ /^\*/) { + push @args, "uintptr(unsafe.Pointer($name))"; + } elsif($type eq "string" && $errvar ne "") { + $text .= "\tvar _p$n $strconvtype\n"; + $text .= "\t_p$n, $errvar = $strconvfunc($name)\n"; + $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; + push @args, "uintptr(unsafe.Pointer(_p$n))"; + $n++; + } elsif($type eq "string") { + print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; + $text .= "\tvar _p$n $strconvtype\n"; + $text .= "\t_p$n, _ = $strconvfunc($name)\n"; + push @args, "uintptr(unsafe.Pointer(_p$n))"; + $n++; + } elsif($type =~ /^\[\](.*)/) { + # Convert slice into pointer, length. + # Have to be careful not to take address of &a[0] if len == 0: + # pass nil in that case. + $text .= "\tvar _p$n *$1\n"; + $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; + push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))"; + $n++; + } elsif($type eq "int64" && $_32bit ne "") { + if($_32bit eq "big-endian") { + push @args, "uintptr($name >> 32)", "uintptr($name)"; + } else { + push @args, "uintptr($name)", "uintptr($name >> 32)"; + } + } elsif($type eq "bool") { + $text .= "\tvar _p$n uint32\n"; + $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; + push @args, "uintptr(_p$n)"; + $n++; + } else { + push @args, "uintptr($name)"; + } + } + my $nargs = @args; + + # Determine which form to use; pad args with zeros. + my $asm = "sysvicall6"; + if ($nonblock) { + $asm = "rawSysvicall6"; + } + if(@args <= 6) { + while(@args < 6) { + push @args, "0"; + } + } else { + print STDERR "$ARGV:$.: too many arguments to system call\n"; + } + + # Actual call. + my $args = join(', ', @args); + my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)"; + + # Assign return values. + my $body = ""; + my $failexpr = ""; + my @ret = ("_", "_", "_"); + my @pout= (); + my $do_errno = 0; + for(my $i=0; $i<@out; $i++) { + my $p = $out[$i]; + my ($name, $type) = parseparam($p); + my $reg = ""; + if($name eq "err") { + $reg = "e1"; + $ret[2] = $reg; + $do_errno = 1; + } else { + $reg = sprintf("r%d", $i); + $ret[$i] = $reg; + } + if($type eq "bool") { + $reg = "$reg != 0"; + } + if($type eq "int64" && $_32bit ne "") { + # 64-bit number in r1:r0 or r0:r1. + if($i+2 > @out) { + print STDERR "$ARGV:$.: not enough registers for int64 return\n"; + } + if($_32bit eq "big-endian") { + $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1); + } else { + $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i); + } + $ret[$i] = sprintf("r%d", $i); + $ret[$i+1] = sprintf("r%d", $i+1); + } + if($reg ne "e1") { + $body .= "\t$name = $type($reg)\n"; + } + } + if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { + $text .= "\t$call\n"; + } else { + $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; + } + $text .= $body; + + if ($do_errno) { + $text .= "\tif e1 != 0 {\n"; + $text .= "\t\terr = e1\n"; + $text .= "\t}\n"; + } + $text .= "\treturn\n"; + $text .= "}\n"; +} + +if($errors) { + exit 1; +} + +print < "net.inet", + "net.inet.ipproto" => "net.inet", + "net.inet6.ipv6proto" => "net.inet6", + "net.inet6.ipv6" => "net.inet6.ip6", + "net.inet.icmpv6" => "net.inet6.icmp6", + "net.inet6.divert6" => "net.inet6.divert", + "net.inet6.tcp6" => "net.inet.tcp", + "net.inet6.udp6" => "net.inet.udp", + "mpls" => "net.mpls", + "swpenc" => "vm.swapencrypt" +); + +# Node mappings +my %node_map = ( + "net.inet.ip.ifq" => "net.ifq", + "net.inet.pfsync" => "net.pfsync", + "net.mpls.ifq" => "net.ifq" +); + +my $ctlname; +my %mib = (); +my %sysctl = (); +my $node; + +sub debug() { + print STDERR "$_[0]\n" if $debug; +} + +# Walk the MIB and build a sysctl name to OID mapping. +sub build_sysctl() { + my ($node, $name, $oid) = @_; + my %node = %{$node}; + my @oid = @{$oid}; + + foreach my $key (sort keys %node) { + my @node = @{$node{$key}}; + my $nodename = $name.($name ne '' ? '.' : '').$key; + my @nodeoid = (@oid, $node[0]); + if ($node[1] eq 'CTLTYPE_NODE') { + if (exists $node_map{$nodename}) { + $node = \%mib; + $ctlname = $node_map{$nodename}; + foreach my $part (split /\./, $ctlname) { + $node = \%{@{$$node{$part}}[2]}; + } + } else { + $node = $node[2]; + } + &build_sysctl($node, $nodename, \@nodeoid); + } elsif ($node[1] ne '') { + $sysctl{$nodename} = \@nodeoid; + } + } +} + +foreach my $ctl (@ctls) { + $ctls{$ctl} = $ctl; +} + +# Build MIB +foreach my $header (@headers) { + &debug("Processing $header..."); + open HEADER, "/usr/include/$header" || + print STDERR "Failed to open $header\n"; + while (
) { + if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ || + $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ || + $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) { + if ($1 eq 'CTL_NAMES') { + # Top level. + $node = \%mib; + } else { + # Node. + my $nodename = lc($2); + if ($header =~ /^netinet\//) { + $ctlname = "net.inet.$nodename"; + } elsif ($header =~ /^netinet6\//) { + $ctlname = "net.inet6.$nodename"; + } elsif ($header =~ /^net\//) { + $ctlname = "net.$nodename"; + } else { + $ctlname = "$nodename"; + $ctlname =~ s/^(fs|net|kern)_/$1\./; + } + if (exists $ctl_map{$ctlname}) { + $ctlname = $ctl_map{$ctlname}; + } + if (not exists $ctls{$ctlname}) { + &debug("Ignoring $ctlname..."); + next; + } + + # Walk down from the top of the MIB. + $node = \%mib; + foreach my $part (split /\./, $ctlname) { + if (not exists $$node{$part}) { + &debug("Missing node $part"); + $$node{$part} = [ 0, '', {} ]; + } + $node = \%{@{$$node{$part}}[2]}; + } + } + + # Populate current node with entries. + my $i = -1; + while (defined($_) && $_ !~ /^}/) { + $_ =
; + $i++ if $_ =~ /{.*}/; + next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/; + $$node{$1} = [ $i, $2, {} ]; + } + } + } + close HEADER; +} + +&build_sysctl(\%mib, "", []); + +print <){ + if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ + my $name = $1; + my $num = $2; + $name =~ y/a-z/A-Z/; + print " SYS_$name = $num;" + } +} + +print <){ + if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ + my $num = $1; + my $proto = $2; + my $name = "SYS_$3"; + $name =~ y/a-z/A-Z/; + + # There are multiple entries for enosys and nosys, so comment them out. + if($name =~ /^SYS_E?NOSYS$/){ + $name = "// $name"; + } + if($name eq 'SYS_SYS_EXIT'){ + $name = 'SYS_EXIT'; + } + + print " $name = $num; // $proto\n"; + } +} + +print <){ + if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){ + my $num = $1; + my $proto = $2; + my $name = "SYS_$3"; + $name =~ y/a-z/A-Z/; + + # There are multiple entries for enosys and nosys, so comment them out. + if($name =~ /^SYS_E?NOSYS$/){ + $name = "// $name"; + } + if($name eq 'SYS_SYS_EXIT'){ + $name = 'SYS_EXIT'; + } + + print " $name = $num; // $proto\n"; + } +} + +print <){ + if($line =~ /^(.*)\\$/) { + # Handle continuation + $line = $1; + $_ =~ s/^\s+//; + $line .= $_; + } else { + # New line + $line = $_; + } + next if $line =~ /\\$/; + if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { + my $num = $1; + my $proto = $6; + my $compat = $8; + my $name = "$7_$9"; + + $name = "$7_$11" if $11 ne ''; + $name =~ y/a-z/A-Z/; + + if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') { + print " $name = $num; // $proto\n"; + } + } +} + +print <){ + if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ + my $num = $1; + my $proto = $3; + my $name = $4; + $name =~ y/a-z/A-Z/; + + # There are multiple entries for enosys and nosys, so comment them out. + if($name =~ /^SYS_E?NOSYS$/){ + $name = "// $name"; + } + if($name eq 'SYS_SYS_EXIT'){ + $name = 'SYS_EXIT'; + } + + print " $name = $num; // $proto\n"; + } +} + +print <>8) & 0xFF + return syscall.Signal(w>>8) & 0xFF } func (w WaitStatus) Exited() bool { return w&0xFF == 0 } @@ -325,11 +321,11 @@ func (w WaitStatus) ExitStatus() int { } func (w WaitStatus) Signaled() bool { return w&0x40 == 0 && w&0xFF != 0 } -func (w WaitStatus) Signal() Signal { +func (w WaitStatus) Signal() syscall.Signal { if !w.Signaled() { return -1 } - return Signal(w>>16) & 0xFF + return syscall.Signal(w>>16) & 0xFF } func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 } @@ -387,7 +383,9 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. //sys FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) = fcntl -//sys fcntl(fd int, cmd int, arg int) (val int, err error) +func Flock(fd int, how int) (err error) { + return syscall.Flock(fd, how) +} /* * Direct access @@ -398,12 +396,15 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys Chroot(path string) (err error) //sys Close(fd int) (err error) //sys Dup(oldfd int) (fd int, err error) +//sys Dup3(oldfd int, newfd int, flags int) (err error) //sys Exit(code int) //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) +//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error) //sys Fchdir(fd int) (err error) //sys Fchmod(fd int, mode uint32) (err error) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) +//sys fcntl(fd int, cmd int, arg int) (val int, err error) //sys Fdatasync(fd int) (err error) //sys Fsync(fd int) (err error) // readdir_r @@ -416,7 +417,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys Getpriority(which int, who int) (prio int, err error) //sysnb Getrusage(who int, rusage *Rusage) (err error) //sysnb Getsid(pid int) (sid int, err error) -//sysnb Kill(pid int, sig Signal) (err error) +//sysnb Kill(pid int, sig syscall.Signal) (err error) //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) @@ -428,6 +429,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) +//sys Removexattr(path string, attr string) (err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Setdomainname(p []byte) (err error) //sys Sethostname(p []byte) (err error) @@ -441,11 +443,15 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys Setpriority(which int, who int, prio int) (err error) //sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) //sys Sync() +//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error) //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) //sysnb Uname(buf *Utsname) (err error) +//TODO umount +// //sys Unmount(target string, flags int) (err error) = umount //sys Unlink(path string) (err error) //sys Unlinkat(dirfd int, path string, flags int) (err error) +//sys Unshare(flags int) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys write(fd int, p []byte) (n int, err error) //sys readlen(fd int, p *byte, np int) (n int, err error) = read @@ -454,8 +460,8 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sys Dup2(oldfd int, newfd int) (err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64 //sys Fchown(fd int, uid int, gid int) (err error) -//sys fstat(fd int, stat *Stat_t) (err error) -//sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat +//sys Fstat(fd int, stat *Stat_t) (err error) +//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys Ftruncate(fd int, length int64) (err error) //sysnb Getegid() (egid int) @@ -464,17 +470,18 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { //sysnb Getuid() (uid int) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) -//sys lstat(path string, stat *Stat_t) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64 -//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) +//TODO Select +// //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) //sysnb Setregid(rgid int, egid int) (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) -//sys stat(path string, statptr *Stat_t) (err error) +//sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, buf *Statfs_t) (err error) //sys Truncate(path string, length int64) (err error) @@ -490,10 +497,8 @@ func IoctlGetTermios(fd int, req uint) (*Termios, 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) - -// In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used. -//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg -//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg +//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 munmap(addr uintptr, length uintptr) (err error) @@ -532,6 +537,19 @@ func Pipe(p []int) (err error) { 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 +} + //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) func Poll(fds []PollFd, timeout int) (n int, err error) { @@ -544,14 +562,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { //sys gettimeofday(tv *Timeval, tzp *Timezone) (err error) //sysnb Time(t *Time_t) (tt Time_t, err error) //sys Utime(path string, buf *Utimbuf) (err error) - -//sys Getsystemcfg(label int) (n uint64) - -//sys umount(target string) (err error) -func Unmount(target string, flags int) (err error) { - if flags != 0 { - // AIX doesn't have any flags for umount. - return ENOSYS - } - return umount(target) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index bf05603f..c28af1f8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -32,19 +32,3 @@ func (msghdr *Msghdr) SetControllen(length int) { func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } - -func Fstat(fd int, stat *Stat_t) error { - return fstat(fd, stat) -} - -func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { - return fstatat(dirfd, path, stat, flags) -} - -func Lstat(path string, stat *Stat_t) error { - return lstat(path, stat) -} - -func Stat(path string, statptr *Stat_t) error { - return stat(path, statptr) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 13d4321f..881cacc6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -32,50 +32,3 @@ func (msghdr *Msghdr) SetControllen(length int) { func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } - -// In order to only have Timespec structure, type of Stat_t's fields -// Atim, Mtim and Ctim is changed from StTimespec to Timespec during -// ztypes generation. -// On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an -// int32, so the fields' value must be modified. -func fixStatTimFields(stat *Stat_t) { - stat.Atim.Nsec >>= 32 - stat.Mtim.Nsec >>= 32 - stat.Ctim.Nsec >>= 32 -} - -func Fstat(fd int, stat *Stat_t) error { - err := fstat(fd, stat) - if err != nil { - return err - } - fixStatTimFields(stat) - return nil -} - -func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { - err := fstatat(dirfd, path, stat, flags) - if err != nil { - return err - } - fixStatTimFields(stat) - return nil -} - -func Lstat(path string, stat *Stat_t) error { - err := lstat(path, stat) - if err != nil { - return err - } - fixStatTimFields(stat) - return nil -} - -func Stat(path string, statptr *Stat_t) error { - err := stat(path, statptr) - if err != nil { - return err - } - fixStatTimFields(statptr) - return nil -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 21200918..1aabc560 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -108,8 +108,17 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) ( return nil, err } - if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil { - return nil, err + _, _, e1 := Syscall6( + SYS_GETATTRLIST, + uintptr(unsafe.Pointer(_p0)), + uintptr(unsafe.Pointer(&attrList)), + uintptr(unsafe.Pointer(&attrBuf[0])), + uintptr(len(attrBuf)), + uintptr(options), + 0, + ) + if e1 != 0 { + return nil, e1 } size := *(*uint32)(unsafe.Pointer(&attrBuf[0])) @@ -142,25 +151,6 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) ( return } -//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) - -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() (r int, w int, err error) func Pipe(p []int) (err error) { @@ -178,7 +168,12 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { _p0 = unsafe.Pointer(&buf[0]) bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - return getfsstat(_p0, bufsize, flags) + r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = e1 + } + return } func xattrPointer(dest []byte) *byte { @@ -303,16 +298,21 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { if flags&AT_SYMLINK_NOFOLLOW != 0 { options |= FSOPT_NOFOLLOW } - return setattrlist( - _p0, - unsafe.Pointer(&attrList), - unsafe.Pointer(&attributes), - unsafe.Sizeof(attributes), - options) + _, _, e1 := Syscall6( + SYS_SETATTRLIST, + uintptr(unsafe.Pointer(_p0)), + uintptr(unsafe.Pointer(&attrList)), + uintptr(unsafe.Pointer(&attributes)), + uintptr(unsafe.Sizeof(attributes)), + uintptr(options), + 0, + ) + if e1 != 0 { + return e1 + } + return nil } -//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) - func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { // Darwin doesn't support SYS_UTIMENSAT return ENOSYS @@ -411,18 +411,6 @@ func Uname(uname *Utsname) error { return nil } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - var length = int64(count) - err = sendfile(infd, outfd, *offset, &length, nil, 0) - written = int(length) - return -} - -//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) - /* * Exposed directly */ @@ -433,7 +421,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) -//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) @@ -448,8 +435,12 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) +//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 +//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 +//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) +//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) @@ -469,6 +460,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Link(path string, link string) (err error) //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Mkdir(path string, mode uint32) (err error) //sys Mkdirat(dirfd int, path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) @@ -500,6 +492,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) +//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 +//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 //sys Symlink(path string, link string) (err error) //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go index 489726fa..b3ac109a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go @@ -8,6 +8,7 @@ package unix import ( "syscall" + "unsafe" ) func setTimespec(sec, nsec int64) Timespec { @@ -47,17 +48,21 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var length = uint64(count) + + _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) + + written = int(length) + + if e1 != 0 { + err = e1 + } + return +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions // of darwin/386 the syscall is called sysctl instead of __sysctl. const SYS___SYSCTL = SYS_SYSCTL - -//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 -//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 -//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 -//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 -//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index 914b89bd..75219444 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -8,6 +8,7 @@ package unix import ( "syscall" + "unsafe" ) func setTimespec(sec, nsec int64) Timespec { @@ -47,17 +48,21 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var length = uint64(count) + + _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) + + written = int(length) + + if e1 != 0 { + err = e1 + } + return +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions // of darwin/amd64 the syscall is called sysctl instead of __sysctl. const SYS___SYSCTL = SYS_SYSCTL - -//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 -//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 -//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 -//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 -//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go index 4a284cf5..faae207a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go @@ -6,6 +6,7 @@ package unix import ( "syscall" + "unsafe" ) func setTimespec(sec, nsec int64) Timespec { @@ -45,20 +46,21 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var length = uint64(count) + + _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) + + written = int(length) + + if e1 != 0 { + err = e1 + } + return +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions // of darwin/arm the syscall is called sysctl instead of __sysctl. const SYS___SYSCTL = SYS_SYSCTL - -//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, stat *Statfs_t) (err error) -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT -//sys Lstat(path string, stat *Stat_t) (err error) -//sys Stat(path string, stat *Stat_t) (err error) -//sys Statfs(path string, stat *Statfs_t) (err error) - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index 52dcd88f..d6d96280 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -8,6 +8,7 @@ package unix import ( "syscall" + "unsafe" ) func setTimespec(sec, nsec int64) Timespec { @@ -47,20 +48,21 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var length = uint64(count) + + _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) + + written = int(length) + + if e1 != 0 { + err = e1 + } + return +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions // of darwin/arm64 the syscall is called sysctl instead of __sysctl. const SYS___SYSCTL = SYS_SYSCTL - -//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, stat *Statfs_t) (err error) -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT -//sys Lstat(path string, stat *Stat_t) (err error) -//sys Stat(path string, stat *Stat_t) (err error) -//sys Statfs(path string, stat *Statfs_t) (err error) - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go deleted file mode 100644 index 4b4ae460..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin,go1.12 - -package unix - -import "unsafe" - -// Implemented in the runtime package (runtime/sys_darwin.go) -func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only -func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) - -//go:linkname syscall_syscall syscall.syscall -//go:linkname syscall_syscall6 syscall.syscall6 -//go:linkname syscall_syscall6X syscall.syscall6X -//go:linkname syscall_syscall9 syscall.syscall9 -//go:linkname syscall_rawSyscall syscall.rawSyscall -//go:linkname syscall_rawSyscall6 syscall.rawSyscall6 - -// Find the entry point for f. See comments in runtime/proc.go for the -// function of the same name. -//go:nosplit -func funcPC(f func()) uintptr { - return **(**uintptr)(unsafe.Pointer(&f)) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 962eee30..79d125b3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -234,13 +234,6 @@ func Uname(uname *Utsname) error { return nil } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - /* * Exposed directly */ @@ -255,13 +248,11 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) //sys Exit(code int) -//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchdir(fd int) (err error) //sys Fchflags(fd int, flags int) (err error) //sys Fchmod(fd int, mode uint32) (err error) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fstat(fd int, stat *Stat_t) (err error) @@ -289,22 +280,17 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Kqueue() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Mkdir(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 Mknod(path string, mode uint32, dev int) (err error) -//sys Mknodat(fd int, path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) -//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) //sys Rename(from string, to string) (err error) -//sys Renameat(fromfd int, from string, tofd int, to string) (err error) //sys Revoke(path string) (err error) //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK @@ -326,13 +312,11 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error) //sys Symlink(path string, link string) (err error) -//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) //sys Truncate(path string, length int64) (err error) //sys Umask(newmask int) (oldmask int) //sys Undelete(path string) (err error) //sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 1b6abe12..77a634c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -13,34 +13,9 @@ package unix import ( - "sync" "unsafe" ) -const ( - SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); } - SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \ - SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \ - SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \ - SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \ - SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \ - SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \ -) - -// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html. -var ( - osreldateOnce sync.Once - osreldate uint32 -) - -// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h -const _ino64First = 1200031 - -func supportsABI(ver uint32) bool { - osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") }) - return osreldate >= ver -} - // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 @@ -146,39 +121,17 @@ func Getwd() (string, error) { } func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { - var ( - _p0 unsafe.Pointer - bufsize uintptr - oldBuf []statfs_freebsd11_t - needsConvert bool - ) - + var _p0 unsafe.Pointer + var bufsize uintptr if len(buf) > 0 { - if supportsABI(_ino64First) { - _p0 = unsafe.Pointer(&buf[0]) - bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) - } else { - n := len(buf) - oldBuf = make([]statfs_freebsd11_t, n) - _p0 = unsafe.Pointer(&oldBuf[0]) - bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n) - needsConvert = true - } + _p0 = unsafe.Pointer(&buf[0]) + bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - var sysno uintptr = SYS_GETFSSTAT - if supportsABI(_ino64First) { - sysno = SYS_GETFSSTAT_FREEBSD12 - } - r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags)) + r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) n = int(r0) if e1 != 0 { err = e1 } - if e1 == 0 && needsConvert { - for i := range oldBuf { - buf[i].convertFrom(&oldBuf[i]) - } - } return } @@ -272,255 +225,6 @@ func Uname(uname *Utsname) error { return nil } -func Stat(path string, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(AT_FDCWD, path, st, 0) - } - err = stat(path, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Lstat(path string, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW) - } - err = lstat(path, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Fstat(fd int, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstat_freebsd12(fd, st) - } - err = fstat(fd, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(fd, path, st, flags) - } - err = fstatat(fd, path, &oldStat, flags) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Statfs(path string, st *Statfs_t) (err error) { - var oldStatfs statfs_freebsd11_t - if supportsABI(_ino64First) { - return statfs_freebsd12(path, st) - } - err = statfs(path, &oldStatfs) - if err != nil { - return err - } - - st.convertFrom(&oldStatfs) - return nil -} - -func Fstatfs(fd int, st *Statfs_t) (err error) { - var oldStatfs statfs_freebsd11_t - if supportsABI(_ino64First) { - return fstatfs_freebsd12(fd, st) - } - err = fstatfs(fd, &oldStatfs) - if err != nil { - return err - } - - st.convertFrom(&oldStatfs) - return nil -} - -func Getdents(fd int, buf []byte) (n int, err error) { - return Getdirentries(fd, buf, nil) -} - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - if supportsABI(_ino64First) { - if unsafe.Sizeof(*basep) == 8 { - return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep))) - } - // The freebsd12 syscall needs a 64-bit base. On 32-bit machines - // we can't just use the basep passed in. See #32498. - var base uint64 = uint64(*basep) - n, err = getdirentries_freebsd12(fd, buf, &base) - *basep = uintptr(base) - if base>>32 != 0 { - // We can't stuff the base back into a uintptr, so any - // future calls would be suspect. Generate an error. - // EIO is allowed by getdirentries. - err = EIO - } - return - } - - // The old syscall entries are smaller than the new. Use 1/4 of the original - // buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c). - oldBufLen := roundup(len(buf)/4, _dirblksiz) - oldBuf := make([]byte, oldBufLen) - n, err = getdirentries(fd, oldBuf, basep) - if err == nil && n > 0 { - n = convertFromDirents11(buf, oldBuf[:n]) - } - return -} - -func Mknod(path string, mode uint32, dev uint64) (err error) { - var oldDev int - if supportsABI(_ino64First) { - return mknodat_freebsd12(AT_FDCWD, path, mode, dev) - } - oldDev = int(dev) - return mknod(path, mode, oldDev) -} - -func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { - var oldDev int - if supportsABI(_ino64First) { - return mknodat_freebsd12(fd, path, mode, dev) - } - oldDev = int(dev) - return mknodat(fd, path, mode, oldDev) -} - -// round x to the nearest multiple of y, larger or equal to x. -// -// from /usr/include/sys/param.h Macros for counting and rounding. -// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -func roundup(x, y int) int { - return ((x + y - 1) / y) * y -} - -func (s *Stat_t) convertFrom(old *stat_freebsd11_t) { - *s = Stat_t{ - Dev: uint64(old.Dev), - Ino: uint64(old.Ino), - Nlink: uint64(old.Nlink), - Mode: old.Mode, - Uid: old.Uid, - Gid: old.Gid, - Rdev: uint64(old.Rdev), - Atim: old.Atim, - Mtim: old.Mtim, - Ctim: old.Ctim, - Btim: old.Btim, - Size: old.Size, - Blocks: old.Blocks, - Blksize: old.Blksize, - Flags: old.Flags, - Gen: uint64(old.Gen), - } -} - -func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) { - *s = Statfs_t{ - Version: _statfsVersion, - Type: old.Type, - Flags: old.Flags, - Bsize: old.Bsize, - Iosize: old.Iosize, - Blocks: old.Blocks, - Bfree: old.Bfree, - Bavail: old.Bavail, - Files: old.Files, - Ffree: old.Ffree, - Syncwrites: old.Syncwrites, - Asyncwrites: old.Asyncwrites, - Syncreads: old.Syncreads, - Asyncreads: old.Asyncreads, - // Spare - Namemax: old.Namemax, - Owner: old.Owner, - Fsid: old.Fsid, - // Charspare - // Fstypename - // Mntfromname - // Mntonname - } - - sl := old.Fstypename[:] - n := clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Fstypename[:], old.Fstypename[:n]) - - sl = old.Mntfromname[:] - n = clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Mntfromname[:], old.Mntfromname[:n]) - - sl = old.Mntonname[:] - n = clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Mntonname[:], old.Mntonname[:n]) -} - -func convertFromDirents11(buf []byte, old []byte) int { - const ( - fixedSize = int(unsafe.Offsetof(Dirent{}.Name)) - oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name)) - ) - - dstPos := 0 - srcPos := 0 - for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) { - dstDirent := (*Dirent)(unsafe.Pointer(&buf[dstPos])) - srcDirent := (*dirent_freebsd11)(unsafe.Pointer(&old[srcPos])) - - reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8) - if dstPos+reclen > len(buf) { - break - } - - dstDirent.Fileno = uint64(srcDirent.Fileno) - dstDirent.Off = 0 - dstDirent.Reclen = uint16(reclen) - dstDirent.Type = srcDirent.Type - dstDirent.Pad0 = 0 - dstDirent.Namlen = uint16(srcDirent.Namlen) - dstDirent.Pad1 = 0 - - copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen]) - padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen] - for i := range padding { - padding[i] = 0 - } - - dstPos += int(dstDirent.Reclen) - srcPos += int(srcDirent.Reclen) - } - - return dstPos -} - -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - /* * Exposed directly */ @@ -560,16 +264,13 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) -//sys fstat(fd int, stat *stat_freebsd11_t) (err error) -//sys fstat_freebsd12(fd int, stat *Stat_t) (err error) -//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) -//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) -//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error) -//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (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, stat *Statfs_t) (err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) -//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) -//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) +//sys Getdents(fd int, buf []byte) (n int, err error) +//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) @@ -591,13 +292,11 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Link(path string, link string) (err error) //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) -//sys lstat(path string, stat *stat_freebsd11_t) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) //sys Mkdir(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 mknod(path string, mode uint32, dev int) (err error) -//sys mknodat(fd int, path string, mode uint32, dev int) (err error) -//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) +//sys Mknod(path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) @@ -627,9 +326,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) -//sys stat(path string, stat *stat_freebsd11_t) (err error) -//sys statfs(path string, stat *statfs_freebsd11_t) (err error) -//sys statfs_freebsd12(path string, stat *Statfs_t) (err error) +//sys Stat(path string, stat *Stat_t) (err error) +//sys Statfs(path string, stat *Statfs_t) (err error) //sys Symlink(path string, link string) (err error) //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) @@ -684,7 +382,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // Kqueue_portset // Getattrlist // Setattrlist -// Getdents // Getdirentriesattr // Searchfs // Delete diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go deleted file mode 100644 index a3180548..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64,freebsd - -package unix - -import ( - "syscall" - "unsafe" -) - -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 SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint64(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - var writtenOut uint64 = 0 - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) - - written = int(writtenOut) - - if e1 != 0 { - err = e1 - } - return -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index c92545ea..e193fd30 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -12,9 +12,6 @@ package unix import ( - "encoding/binary" - "net" - "runtime" "syscall" "unsafe" ) @@ -39,20 +36,6 @@ func Creat(path string, mode uint32) (fd int, err error) { return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) } -//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) -//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) - -func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (err error) { - if pathname == "" { - return fanotifyMark(fd, flags, mask, dirFd, nil) - } - p, err := BytePtrFromString(pathname) - if err != nil { - return err - } - return fanotifyMark(fd, flags, mask, dirFd, p) -} - //sys fchmodat(dirfd int, path string, mode uint32) (err error) func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -72,15 +55,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { // ioctl itself should not be exposed directly, but additional get/set // functions for specific types are permissible. -// IoctlSetPointerInt performs an ioctl operation which sets an -// integer value on fd, using the specified request number. The ioctl -// argument is called with a pointer to the integer value, rather than -// passing the integer value directly. -func IoctlSetPointerInt(fd int, req uint, value int) error { - v := int32(value) - return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) -} - // IoctlSetInt performs an ioctl operation which sets an integer value // on fd, using the specified request number. func IoctlSetInt(fd int, req uint, value int) error { @@ -95,12 +69,6 @@ func ioctlSetTermios(fd int, req uint, value *Termios) error { return ioctl(fd, req, uintptr(unsafe.Pointer(value))) } -func IoctlSetRTCTime(fd int, value *RTCTime) error { - err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - // IoctlGetInt performs an ioctl operation which gets an integer value // from fd, using the specified request number. func IoctlGetInt(fd int, req uint) (int, error) { @@ -109,12 +77,6 @@ func IoctlGetInt(fd int, req uint) (int, error) { return value, err } -func IoctlGetUint32(fd int, req uint) (uint32, error) { - var value uint32 - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return value, err -} - func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { var value Winsize err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) @@ -127,12 +89,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { return &value, err } -func IoctlGetRTCTime(fd int) (*RTCTime, error) { - var value RTCTime - err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) - return &value, err -} - //sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) func Link(oldpath string, newpath string) (err error) { @@ -736,69 +692,6 @@ func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { 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 -} - -// This constant mirrors the #define of PX_PROTO_OE in -// linux/if_pppox.h. We're defining this by hand here instead of -// autogenerating through mkerrors.sh because including -// linux/if_pppox.h causes some declaration conflicts with other -// includes (linux/if_pppox.h includes linux/in.h, which conflicts -// with netinet/in.h). Given that we only need a single zero constant -// out of that file, it's cleaner to just define it by hand here. -const px_proto_oe = 0 - -type SockaddrPPPoE struct { - SID uint16 - Remote net.HardwareAddr - Dev string - raw RawSockaddrPPPoX -} - -func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) { - if len(sa.Remote) != 6 { - return nil, 0, EINVAL - } - if len(sa.Dev) > IFNAMSIZ-1 { - return nil, 0, EINVAL - } - - *(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX - // This next field is in host-endian byte order. We can't use the - // same unsafe pointer cast as above, because this value is not - // 32-bit aligned and some architectures don't allow unaligned - // access. - // - // However, the value of px_proto_oe is 0, so we can use - // encoding/binary helpers to write the bytes without worrying - // about the ordering. - binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe) - // This field is deliberately big-endian, unlike the previous - // one. The kernel expects SID to be in network byte order. - binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID) - copy(sa.raw[8:14], sa.Remote) - for i := 14; i < 14+IFNAMSIZ; i++ { - sa.raw[i] = 0 - } - copy(sa.raw[14:], sa.Dev) - return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil -} - func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { switch rsa.Addr.Family { case AF_NETLINK: @@ -900,31 +793,6 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } 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 - case AF_PPPOX: - pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa)) - if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe { - return nil, EINVAL - } - sa := &SockaddrPPPoE{ - SID: binary.BigEndian.Uint16(pp[6:8]), - Remote: net.HardwareAddr(pp[8:14]), - } - for i := 14; i < 14+IFNAMSIZ; i++ { - if pp[i] == 0 { - sa.Dev = string(pp[14:i]) - break - } - } - return sa, nil } return nil, EAFNOSUPPORT } @@ -1010,50 +878,10 @@ func GetsockoptString(fd, level, opt int) (string, error) { return string(buf[:vallen-1]), nil } -func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) { - var value TpacketStats - vallen := _Socklen(SizeofTpacketStats) - err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) - return &value, err -} - -func GetsockoptTpacketStatsV3(fd, level, opt int) (*TpacketStatsV3, error) { - var value TpacketStatsV3 - vallen := _Socklen(SizeofTpacketStatsV3) - err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) - return &value, err -} - func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) } -func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error { - return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) -} - -// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a -// socket to filter incoming packets. See 'man 7 socket' for usage information. -func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error { - return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog)) -} - -func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error { - var p unsafe.Pointer - if len(filter) > 0 { - p = unsafe.Pointer(&filter[0]) - } - return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter)) -} - -func SetsockoptTpacketReq(fd, level, opt int, tp *TpacketReq) error { - return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp)) -} - -func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error { - return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp)) -} - // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1267,7 +1095,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro // The ptrace syscall differs from glibc's ptrace. // 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 // access (PEEKUSER warns that it might), but if we don't @@ -1275,12 +1103,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. n := 0 - if addr%SizeofPtr != 0 { - err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + if addr%sizeofPtr != 0 { + err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return 0, err } - n += copy(out, buf[addr%SizeofPtr:]) + n += copy(out, buf[addr%sizeofPtr:]) out = out[n:] } @@ -1318,15 +1146,15 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c // Leading edge. n := 0 - if addr%SizeofPtr != 0 { - var buf [SizeofPtr]byte - err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) + if addr%sizeofPtr != 0 { + var buf [sizeofPtr]byte + err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return 0, err } - n += copy(buf[addr%SizeofPtr:], data) + n += copy(buf[addr%sizeofPtr:], data) 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 { return 0, err } @@ -1334,19 +1162,19 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c } // Interior. - for len(data) > SizeofPtr { + for len(data) > sizeofPtr { word := *((*uintptr)(unsafe.Pointer(&data[0]))) err = ptrace(pokeReq, pid, addr+uintptr(n), word) if err != nil { return n, err } - n += SizeofPtr - data = data[SizeofPtr:] + n += sizeofPtr + data = data[sizeofPtr:] } // Trailing edge. if len(data) > 0 { - var buf [SizeofPtr]byte + var buf [sizeofPtr]byte err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0]))) if err != nil { return n, err @@ -1433,13 +1261,6 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri return mount(source, target, fstype, flags, datap) } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - // Sendto // Recvfrom // Socketpair @@ -1452,12 +1273,9 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Adjtimex(buf *Timex) (state int, err error) //sys Chdir(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 ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (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 DeleteModule(name string, flags int) (err error) //sys Dup(oldfd int) (fd int, err error) //sys Dup3(oldfd int, newfd int, flags int) (err error) //sysnb EpollCreate1(flag int) (fd int, err error) @@ -1471,7 +1289,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys fcntl(fd int, cmd int, arg int) (val int, err error) //sys Fdatasync(fd int) (err error) //sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) -//sys FinitModule(fd int, params string, flags int) (err error) //sys Flistxattr(fd int, dest []byte) (sz int, err error) //sys Flock(fd int, how int) (err error) //sys Fremovexattr(fd int, attr string) (err error) @@ -1493,7 +1310,6 @@ func Getpgrp() (pid int) { //sysnb Getsid(pid int) (sid int, err error) //sysnb Gettid() (tid int) //sys Getxattr(path string, attr string, dest []byte) (sz int, err error) -//sys InitModule(moduleImage []byte, params string) (err error) //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) //sysnb InotifyInit1(flags int) (fd int, err error) //sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) @@ -1515,6 +1331,7 @@ func Getpgrp() (pid int) { //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) //sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) //sys Setdomainname(p []byte) (err error) @@ -1537,13 +1354,8 @@ func Setgid(uid int) (err error) { return EOPNOTSUPP } -func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { - return signalfd(fd, sigmask, _C__NSIG/8, flags) -} - //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) -//sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4 //sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) //sys Sync() //sys Syncfs(fd int) (err error) @@ -1588,12 +1400,15 @@ func Munmap(b []byte) (err error) { // Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd, // using the specified flags. func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) { - var p unsafe.Pointer - if len(iovs) > 0 { - p = unsafe.Pointer(&iovs[0]) - } - - n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0) + n, _, errno := Syscall6( + SYS_VMSPLICE, + uintptr(fd), + uintptr(unsafe.Pointer(&iovs[0])), + uintptr(len(iovs)), + uintptr(flags), + 0, + 0, + ) if errno != 0 { return 0, syscall.Errno(errno) } @@ -1672,82 +1487,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return EACCES } -//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT -//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT - -// fileHandle is the argument to nameToHandleAt and openByHandleAt. We -// originally tried to generate it via unix/linux/types.go with "type -// fileHandle C.struct_file_handle" but that generated empty structs -// for mips64 and mips64le. Instead, hard code it for now (it's the -// same everywhere else) until the mips64 generator issue is fixed. -type fileHandle struct { - Bytes uint32 - Type int32 -} - -// FileHandle represents the C struct file_handle used by -// name_to_handle_at (see NameToHandleAt) and open_by_handle_at (see -// OpenByHandleAt). -type FileHandle struct { - *fileHandle -} - -// NewFileHandle constructs a FileHandle. -func NewFileHandle(handleType int32, handle []byte) FileHandle { - const hdrSize = unsafe.Sizeof(fileHandle{}) - buf := make([]byte, hdrSize+uintptr(len(handle))) - copy(buf[hdrSize:], handle) - fh := (*fileHandle)(unsafe.Pointer(&buf[0])) - fh.Type = handleType - fh.Bytes = uint32(len(handle)) - return FileHandle{fh} -} - -func (fh *FileHandle) Size() int { return int(fh.fileHandle.Bytes) } -func (fh *FileHandle) Type() int32 { return fh.fileHandle.Type } -func (fh *FileHandle) Bytes() []byte { - n := fh.Size() - if n == 0 { - return nil - } - return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n] -} - -// NameToHandleAt wraps the name_to_handle_at system call; it obtains -// a handle for a path name. -func NameToHandleAt(dirfd int, path string, flags int) (handle FileHandle, mountID int, err error) { - var mid _C_int - // Try first with a small buffer, assuming the handle will - // only be 32 bytes. - size := uint32(32 + unsafe.Sizeof(fileHandle{})) - didResize := false - for { - buf := make([]byte, size) - fh := (*fileHandle)(unsafe.Pointer(&buf[0])) - fh.Bytes = size - uint32(unsafe.Sizeof(fileHandle{})) - err = nameToHandleAt(dirfd, path, fh, &mid, flags) - if err == EOVERFLOW { - if didResize { - // We shouldn't need to resize more than once - return - } - didResize = true - size = fh.Bytes + uint32(unsafe.Sizeof(fileHandle{})) - continue - } - if err != nil { - return - } - return FileHandle{fh}, int(mid), nil - } -} - -// OpenByHandleAt wraps the open_by_handle_at system call; it opens a -// file via a handle as previously returned by NameToHandleAt. -func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err error) { - return openByHandleAt(mountFD, handle.fileHandle, flags) -} - /* * Unimplemented */ @@ -1757,9 +1496,12 @@ func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err erro // Brk // Capget // Capset +// ClockGetres // ClockNanosleep // ClockSettime // Clone +// CreateModule +// DeleteModule // EpollCtlOld // EpollPwait // EpollWaitOld @@ -1803,6 +1545,7 @@ func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err erro // Pselect6 // Ptrace // Putpmsg +// QueryModule // Quotactl // Readahead // Readv @@ -1836,6 +1579,7 @@ func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err erro // Shmdt // Shmget // Sigaltstack +// Signalfd // Swapoff // Swapon // Sysfs diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index e2f8cf6e..74bc098c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -68,7 +68,6 @@ func Pipe2(p []int, flags int) (err error) { //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Setfsgid(gid int) (err error) = SYS_SETFSGID32 //sys Setfsuid(uid int) (err error) = SYS_SETFSUID32 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 87a30744..5f9b2454 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -20,30 +20,15 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb inotifyInit() (fd int, err error) - -func InotifyInit() (fd int, err error) { - // First try inotify_init1, because Android's seccomp policy blocks the latter. - fd, err = InotifyInit1(0) - if err == ENOSYS { - fd, err = inotifyInit() - } - return -} - +//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) - -func Lstat(path string, stat *Stat_t) (err error) { - return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW) -} - +//sys Lstat(path string, stat *Stat_t) (err error) //sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //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) { @@ -175,16 +160,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } 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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index f6267944..3ec7a932 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -19,18 +19,12 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL } var pp [2]_C_int - // Try pipe2 first for Android O, then try pipe for kernel 2.6.23. err = pipe2(&pp, 0) - if err == ENOSYS { - err = pipe(&pp) - } p[0] = int(pp[0]) p[1] = int(pp[1]) return @@ -95,7 +89,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Pause() (err error) -//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys Setfsgid(gid int) (err error) = SYS_SETFSGID32 @@ -264,24 +257,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return poll(&fds[0], len(fds), timeout) } - -//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE - -func SyncFileRange(fd int, off int64, n int64, flags int) error { - // The sync_file_range and arm_sync_file_range syscalls differ only in the - // order of their arguments. - return armSyncFileRange(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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index cb20b15d..646f295a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -30,7 +30,6 @@ func EpollCreate(size int) (fd int, err error) { //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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //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) { @@ -192,9 +191,12 @@ func Dup2(oldfd int, newfd int) (err error) { return Dup3(oldfd, newfd, 0) } -func Pause() error { - _, err := ppoll(nil, 0, nil, nil) - return err +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) { @@ -208,16 +210,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return ppoll(&fds[0], len(fds), ts, nil) } - -//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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index b3b21ec1..ad991031 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -12,6 +12,7 @@ package unix //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //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 Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys Ftruncate(fd int, length int64) (err error) //sysnb Getegid() (egid int) @@ -24,7 +25,6 @@ package unix //sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //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) { @@ -148,7 +148,6 @@ type stat_t struct { } //sys fstat(fd int, st *stat_t) (err error) -//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT //sys lstat(path string, st *stat_t) (err error) //sys stat(path string, st *stat_t) (err error) @@ -159,13 +158,6 @@ func Fstat(fd int, s *Stat_t) (err error) { return } -func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) { - st := &stat_t{} - err = fstatat(dirfd, path, st, flags) - fillStat_t(s, st) - return -} - func Lstat(path string, s *Stat_t) (err error) { st := &stat_t{} err = lstat(path, st) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index 5144d4e1..99e0e999 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -28,7 +28,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Setfsgid(gid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 0a100b66..6a38dfd5 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -30,7 +30,6 @@ package unix //sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) @@ -137,16 +136,3 @@ func SyncFileRange(fd int, off int64, n int64, flags int) error { // 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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 6230f640..512077fe 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -191,9 +191,12 @@ func Dup2(oldfd int, newfd int) (err error) { return Dup3(oldfd, newfd, 0) } -func Pause() error { - _, err := ppoll(nil, 0, nil, nil) - return err +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) { @@ -207,20 +210,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return ppoll(&fds[0], len(fds), ts, nil) } - -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0) -} - -//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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index f81dbdc9..6e4ee0cf 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -30,7 +30,6 @@ import ( //sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) @@ -323,16 +322,3 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } 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) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index b6956561..72e64187 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -26,7 +26,6 @@ package unix //sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 8f4c320e..6f8ebde3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -13,7 +13,6 @@ package unix import ( - "runtime" "syscall" "unsafe" ) @@ -94,23 +93,6 @@ func nametomib(name string) (mib []_C_int, err error) { 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) func Pipe(p []int) (err error) { if len(p) != 2 { @@ -120,30 +102,9 @@ func Pipe(p []int) (err error) { return } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sys getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - n, err = Getdents(fd, buf) - if err != nil || basep == nil { - return - } - - var off int64 - off, err = Seek(fd, 0, 1 /* SEEK_CUR */) - if err != nil { - *basep = ^uintptr(0) - return - } - *basep = uintptr(off) - if unsafe.Sizeof(*basep) == 8 { - return - } - if off>>4 != 0 { - // We can't stuff the offset back into a uintptr, so any - // future calls would be suspect. Generate an error. - // EIO is allowed by getdirentries. - err = EIO - } - return + return getdents(fd, buf) } const ImplementsGetwd = true @@ -212,13 +173,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { return &value, err } -func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) { - var value Ptmget - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - runtime.KeepAlive(value) - return &value, err -} - func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} n := unsafe.Sizeof(uname.Sysname) @@ -265,13 +219,6 @@ func Uname(uname *Utsname) error { return nil } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - /* * Exposed directly */ @@ -305,7 +252,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fchmod(fd int, mode uint32) (err error) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fstat(fd int, stat *Stat_t) (err error) @@ -330,26 +276,19 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Kqueue() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Mkdir(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 Mkfifoat(dirfd int, 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 Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) -//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) -//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) //sys Rename(from string, to string) (err error) -//sys Renameat(fromfd int, from string, tofd int, to string) (err error) //sys Revoke(path string) (err error) //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK @@ -367,12 +306,10 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setuid(uid int) (err error) //sys Stat(path string, stat *Stat_t) (err error) //sys Symlink(path string, link string) (err error) -//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) //sys Truncate(path string, length int64) (err error) //sys Umask(newmask int) (oldmask int) //sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go deleted file mode 100644 index f3434465..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2019 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 arm64,netbsd - -package unix - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: nsec} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint64(fd) - k.Filter = uint32(mode) - k.Flags = uint32(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 276c93be..07e6669c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -43,40 +43,6 @@ func nametomib(name string) (mib []_C_int, err error) { return nil, EINVAL } -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 -} - -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) func Pipe(p []int) (err error) { if len(p) != 2 { @@ -89,30 +55,9 @@ func Pipe(p []int) (err error) { return } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sys getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - n, err = Getdents(fd, buf) - if err != nil || basep == nil { - return - } - - var off int64 - off, err = Seek(fd, 0, 1 /* SEEK_CUR */) - if err != nil { - *basep = ^uintptr(0) - return - } - *basep = uintptr(off) - if unsafe.Sizeof(*basep) == 8 { - return - } - if off>>4 != 0 { - // We can't stuff the offset back into a uintptr, so any - // future calls would be suspect. Generate an error. - // EIO was allowed by getdirentries. - err = EIO - } - return + return getdents(fd, buf) } const ImplementsGetwd = true @@ -132,13 +77,6 @@ func Getwd() (string, error) { return string(buf[:n]), nil } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - // TODO func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { return -1, ENOSYS @@ -203,15 +141,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { return &value, err } -//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) - -func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - if len(fds) == 0 { - return ppoll(nil, 0, timeout, sigmask) - } - return ppoll(&fds[0], len(fds), timeout, sigmask) -} - func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} n := unsafe.Sizeof(uname.Sysname) @@ -278,7 +207,6 @@ func Uname(uname *Utsname) error { //sys Fchmod(fd int, mode uint32) (err error) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fstat(fd int, stat *Stat_t) (err error) @@ -305,26 +233,19 @@ func Uname(uname *Utsname) error { //sys Kqueue() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Mkdir(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 Mkfifoat(dirfd int, 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 Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) -//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) //sys Pathconf(path string, name int) (val int, err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) -//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) //sys Rename(from string, to string) (err error) -//sys Renameat(fromfd int, from string, tofd int, to string) (err error) //sys Revoke(path string) (err error) //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK @@ -347,12 +268,10 @@ func Uname(uname *Utsname) error { //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error) //sys Symlink(path string, link string) (err error) -//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) //sys Truncate(path string, length int64) (err error) //sys Umask(newmask int) (oldmask int) //sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) @@ -375,11 +294,15 @@ func Uname(uname *Utsname) error { // clock_settime // closefrom // execve +// faccessat +// fchmodat +// fchownat // fcntl // fhopen // fhstat // fhstatfs // fork +// fstatat // futimens // getfh // getgid @@ -393,8 +316,12 @@ func Uname(uname *Utsname) error { // lfs_markv // lfs_segclean // lfs_segwait +// linkat // mincore // minherit +// mkdirat +// mkfifoat +// mknodat // mount // mquery // msgctl @@ -403,10 +330,12 @@ func Uname(uname *Utsname) error { // msgsnd // nfssvc // nnpfspioctl +// openat // preadv // profil // pwritev // quotactl +// readlinkat // readv // reboot // renameat @@ -427,11 +356,13 @@ func Uname(uname *Utsname) error { // sigprocmask // sigreturn // sigsuspend +// symlinkat // sysarch // syscall // threxit // thrsigdivert // thrsleep // thrwakeup +// unlinkat // vfork // writev diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index d62da60d..994964a9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -31,7 +31,3 @@ func (msghdr *Msghdr) SetControllen(length int) { func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of openbsd/386 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 5d812aae..59844f50 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -31,7 +31,3 @@ func (msghdr *Msghdr) SetControllen(length int) { func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of openbsd/arm the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go deleted file mode 100644 index 0fb39cf5..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2019 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 arm64,openbsd - -package unix - -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 SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint64(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of openbsd/amd64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index e4780127..53b80782 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -585,13 +585,6 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { return poll(&fds[0], len(fds), timeout) } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - return sendfile(outfd, infd, offset, count) -} - /* * Exposed directly */ diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 3de37566..13956b79 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -8,6 +8,7 @@ package unix import ( "bytes" + "runtime" "sort" "sync" "syscall" @@ -20,6 +21,13 @@ var ( Stderr = 2 ) +const ( + darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8 + dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8 + netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4 + solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8 +) + // Do the interface allocations only once for common // Errno values. var ( @@ -28,11 +36,6 @@ var ( errENOENT error = syscall.ENOENT ) -var ( - signalNameMapOnce sync.Once - signalNameMap map[string]syscall.Signal -) - // errnoErr returns common boxed Errno values, to prevent // allocations at runtime. func errnoErr(e syscall.Errno) error { @@ -71,19 +74,6 @@ func SignalName(s syscall.Signal) string { return "" } -// SignalNum returns the syscall.Signal for signal named s, -// or 0 if a signal with such name is not found. -// The signal name should start with "SIG". -func SignalNum(s string) syscall.Signal { - signalNameMapOnce.Do(func() { - signalNameMap = make(map[string]syscall.Signal) - for _, signal := range signalList { - signalNameMap[signal.name] = signal.num - } - }) - return signalNameMap[s] -} - // clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte. func clen(n []byte) int { i := bytes.IndexByte(n, 0) @@ -294,13 +284,6 @@ func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) { return &tv, err } -func GetsockoptUint64(fd, level, opt int) (value uint64, err error) { - var n uint64 - vallen := _Socklen(8) - err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) - return n, err -} - func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -351,21 +334,13 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) { } func SetsockoptString(fd, level, opt int, s string) (err error) { - var p unsafe.Pointer - if len(s) > 0 { - p = unsafe.Pointer(&[]byte(s)[0]) - } - return setsockopt(fd, level, opt, p, uintptr(len(s))) + return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s))) } func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv)) } -func SetsockoptUint64(fd, level, opt int, value uint64) (err error) { - return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8) -} - func Socket(domain, typ, proto int) (fd int, err error) { if domain == AF_INET6 && SocketDisableIPv6 { return -1, EAFNOSUPPORT @@ -384,6 +359,13 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) { return } +func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + return sendfile(outfd, infd, offset, count) +} + var ioSync int64 func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) } @@ -410,22 +392,3 @@ func SetNonblock(fd int, nonblocking bool) (err error) { func Exec(argv0 string, argv []string, envv []string) error { return syscall.Exec(argv0, argv, envv) } - -// Lutimes sets the access and modification times tv on path. If path refers to -// a symlink, it is not dereferenced and the timestamps are set on the symlink. -// If tv is nil, the access and modification times are set to the current time. -// Otherwise tv must contain exactly 2 elements, with access time as the first -// element and modification time as the second element. -func Lutimes(path string, tv []Timeval) error { - if tv == nil { - return UtimesNanoAt(AT_FDCWD, path, nil, AT_SYMLINK_NOFOLLOW) - } - if len(tv) != 2 { - return EINVAL - } - ts := []Timespec{ - NsecToTimespec(TimevalToNsec(tv[0])), - NsecToTimespec(TimevalToNsec(tv[1])), - } - return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index 1c70d1b6..4cb8e8ed 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // +build darwin dragonfly freebsd linux netbsd openbsd solaris -// +build !gccgo,!ppc64le,!ppc64 +// +build !gccgo package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go deleted file mode 100644 index 86dc765a..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build ppc64le ppc64 -// +build !gccgo - -package unix - -import "syscall" - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.Syscall(trap, a1, a2, a3) -} -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) -} -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.RawSyscall(trap, a1, a2, a3) -} -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { - return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) -} diff --git a/vendor/golang.org/x/sys/unix/types_aix.go b/vendor/golang.org/x/sys/unix/types_aix.go index 40d2beed..18fbddd5 100644 --- a/vendor/golang.org/x/sys/unix/types_aix.go +++ b/vendor/golang.org/x/sys/unix/types_aix.go @@ -59,14 +59,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong PathMax = C.PATH_MAX ) @@ -87,6 +87,8 @@ type Mode_t C.mode_t type Timespec C.struct_timespec +type StTimespec C.struct_st_timespec + type Timeval C.struct_timeval type Timeval32 C.struct_timeval32 @@ -131,8 +133,6 @@ type RawSockaddrInet6 C.struct_sockaddr_in6 type RawSockaddrUnix C.struct_sockaddr_un -type RawSockaddrDatalink C.struct_sockaddr_dl - type RawSockaddr C.struct_sockaddr type RawSockaddrAny C.struct_sockaddr_any @@ -156,18 +156,17 @@ type Linger C.struct_linger type Msghdr C.struct_msghdr const ( - SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in - SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 - SizeofSockaddrAny = C.sizeof_struct_sockaddr_any - SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un - SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl - SizeofLinger = C.sizeof_struct_linger - SizeofIPMreq = C.sizeof_struct_ip_mreq - SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq - SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo - SizeofMsghdr = C.sizeof_struct_msghdr - SizeofCmsghdr = C.sizeof_struct_cmsghdr - SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter + SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in + SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 + SizeofSockaddrAny = C.sizeof_struct_sockaddr_any + SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un + SizeofLinger = C.sizeof_struct_linger + SizeofIPMreq = C.sizeof_struct_ip_mreq + SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq + SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo + SizeofMsghdr = C.sizeof_struct_msghdr + SizeofCmsghdr = C.sizeof_struct_cmsghdr + SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter ) // Routing and interface messages diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go index 155c2e69..46b9908e 100644 --- a/vendor/golang.org/x/sys/unix/types_darwin.go +++ b/vendor/golang.org/x/sys/unix/types_darwin.go @@ -70,14 +70,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types @@ -275,9 +275,3 @@ const ( // uname type Utsname C.struct_utsname - -// Clockinfo - -const SizeofClockinfo = C.sizeof_struct_clockinfo - -type Clockinfo C.struct_clockinfo diff --git a/vendor/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go index 3365dd79..386d5f89 100644 --- a/vendor/golang.org/x/sys/unix/types_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/types_dragonfly.go @@ -65,14 +65,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types diff --git a/vendor/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go index 74707989..e84a892d 100644 --- a/vendor/golang.org/x/sys/unix/types_freebsd.go +++ b/vendor/golang.org/x/sys/unix/types_freebsd.go @@ -14,11 +14,7 @@ Input to cgo -godefs. See README.md package unix /* -#define _WANT_FREEBSD11_STAT 1 -#define _WANT_FREEBSD11_STATFS 1 -#define _WANT_FREEBSD11_DIRENT 1 -#define _WANT_FREEBSD11_KEVENT 1 - +#define KERNEL #include #include #include @@ -26,7 +22,7 @@ package unix #include #include #include -#include +#include #include #include #include @@ -67,6 +63,50 @@ struct sockaddr_any { char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; }; +// This structure is a duplicate of stat on FreeBSD 8-STABLE. +// See /usr/include/sys/stat.h. +struct stat8 { +#undef st_atimespec st_atim +#undef st_mtimespec st_mtim +#undef st_ctimespec st_ctim +#undef st_birthtimespec st_birthtim + __dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + __dev_t st_rdev; +#if __BSD_VISIBLE + struct timespec st_atimespec; + struct timespec st_mtimespec; + struct timespec st_ctimespec; +#else + time_t st_atime; + long __st_atimensec; + time_t st_mtime; + long __st_mtimensec; + time_t st_ctime; + long __st_ctimensec; +#endif + off_t st_size; + blkcnt_t st_blocks; + blksize_t st_blksize; + fflags_t st_flags; + __uint32_t st_gen; + __int32_t st_lspare; +#if __BSD_VISIBLE + struct timespec st_birthtimespec; + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); +#else + time_t st_birthtime; + long st_birthtimensec; + unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); +#endif +}; + // This structure is a duplicate of if_data on FreeBSD 8-STABLE. // See /usr/include/net/if.h. struct if_data8 { @@ -114,14 +154,14 @@ struct if_msghdr8 { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types @@ -149,25 +189,14 @@ type _Gid_t C.gid_t // Files -const ( - _statfsVersion = C.STATFS_VERSION - _dirblksiz = C.DIRBLKSIZ -) - -type Stat_t C.struct_stat - -type stat_freebsd11_t C.struct_freebsd11_stat +type Stat_t C.struct_stat8 type Statfs_t C.struct_statfs -type statfs_freebsd11_t C.struct_freebsd11_statfs - type Flock_t C.struct_flock type Dirent C.struct_dirent -type dirent_freebsd11 C.struct_freebsd11_dirent - type Fsid C.struct_fsid // File system limits @@ -250,7 +279,7 @@ const ( // Events (kqueue, kevent) -type Kevent_t C.struct_kevent_freebsd11 +type Kevent_t C.struct_kevent // Select diff --git a/vendor/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go index 2dd4f954..1494aafc 100644 --- a/vendor/golang.org/x/sys/unix/types_netbsd.go +++ b/vendor/golang.org/x/sys/unix/types_netbsd.go @@ -67,14 +67,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types @@ -248,8 +248,6 @@ type Termios C.struct_termios type Winsize C.struct_winsize -type Ptmget C.struct_ptmget - // fchmodat-like syscalls. const ( @@ -281,9 +279,3 @@ type Sysctlnode C.struct_sysctlnode // Uname type Utsname C.struct_utsname - -// Clockinfo - -const SizeofClockinfo = C.sizeof_struct_clockinfo - -type Clockinfo C.struct_clockinfo diff --git a/vendor/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go index 8aafbe44..8f2fe704 100644 --- a/vendor/golang.org/x/sys/unix/types_openbsd.go +++ b/vendor/golang.org/x/sys/unix/types_openbsd.go @@ -38,7 +38,6 @@ package unix #include #include #include -#include #include #include #include @@ -67,14 +66,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong ) // Basic types @@ -261,22 +260,6 @@ const ( POLLWRNORM = C.POLLWRNORM ) -// Signal Sets - -type Sigset_t C.sigset_t - // Uname type Utsname C.struct_utsname - -// Uvmexp - -const SizeofUvmexp = C.sizeof_struct_uvmexp - -type Uvmexp C.struct_uvmexp - -// Clockinfo - -const SizeofClockinfo = C.sizeof_struct_clockinfo - -type Clockinfo C.struct_clockinfo diff --git a/vendor/golang.org/x/sys/unix/types_solaris.go b/vendor/golang.org/x/sys/unix/types_solaris.go index 2b716f93..8cef71bd 100644 --- a/vendor/golang.org/x/sys/unix/types_solaris.go +++ b/vendor/golang.org/x/sys/unix/types_solaris.go @@ -75,14 +75,14 @@ struct sockaddr_any { */ import "C" -// Machine characteristics +// Machine characteristics; for internal use. const ( - SizeofPtr = C.sizeofPtr - SizeofShort = C.sizeof_short - SizeofInt = C.sizeof_int - SizeofLong = C.sizeof_long - SizeofLongLong = C.sizeof_longlong + sizeofPtr = C.sizeofPtr + sizeofShort = C.sizeof_short + sizeofInt = C.sizeof_int + sizeofLong = C.sizeof_long + sizeofLongLong = C.sizeof_longlong PathMax = C.PATH_MAX MaxHostNameLen = C.MAXHOSTNAMELEN ) diff --git a/vendor/golang.org/x/sys/unix/unveil_openbsd.go b/vendor/golang.org/x/sys/unix/unveil_openbsd.go deleted file mode 100644 index 168d5ae7..00000000 --- a/vendor/golang.org/x/sys/unix/unveil_openbsd.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import ( - "syscall" - "unsafe" -) - -// Unveil implements the unveil syscall. -// For more information see unveil(2). -// Note that the special case of blocking further -// unveil calls is handled by UnveilBlock. -func Unveil(path string, flags string) error { - pathPtr, err := syscall.BytePtrFromString(path) - if err != nil { - return err - } - flagsPtr, err := syscall.BytePtrFromString(flags) - if err != nil { - return err - } - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) - if e != 0 { - return e - } - return nil -} - -// UnveilBlock blocks future unveil calls. -// For more information see unveil(2). -func UnveilBlock() error { - // Both pointers must be nil. - var pathUnsafe, flagsUnsafe unsafe.Pointer - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) - if e != 0 { - return e - } - return nil -} diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index 30c1d71f..93049932 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -81,10 +81,7 @@ func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { // flags are unused on FreeBSD func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { - var d unsafe.Pointer - if len(data) > 0 { - d = unsafe.Pointer(&data[0]) - } + d := unsafe.Pointer(&data[0]) datasiz := len(data) nsid, a, err := xattrnamespace(attr) @@ -97,10 +94,7 @@ func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { } func Setxattr(file string, attr string, data []byte, flags int) (err error) { - var d unsafe.Pointer - if len(data) > 0 { - d = unsafe.Pointer(&data[0]) - } + d := unsafe.Pointer(&data[0]) datasiz := len(data) nsid, a, err := xattrnamespace(attr) @@ -113,10 +107,7 @@ func Setxattr(file string, attr string, data []byte, flags int) (err error) { } func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { - var d unsafe.Pointer - if len(data) > 0 { - d = unsafe.Pointer(&data[0]) - } + d := unsafe.Pointer(&data[0]) datasiz := len(data) nsid, a, err := xattrnamespace(attr) diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index 1def8a58..4b7b9650 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -926,8 +926,6 @@ const ( TCSETSF = 0x5404 TCSETSW = 0x5403 TCXONC = 0x540b - TIMER_ABSTIME = 0x3e7 - TIMER_MAX = 0x20 TIOC = 0x5400 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 03187dea..ed04fd1b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -3,7 +3,7 @@ // +build ppc64,aix -// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -maix64 _const.go package unix @@ -926,8 +926,6 @@ const ( TCSETSF = 0x5404 TCSETSW = 0x5403 TCXONC = 0x540b - TIMER_ABSTIME = 0x3e7 - TIMER_MAX = 0x20 TIOC = 0x5400 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index bbe6089b..1de69989 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -880,40 +880,6 @@ const ( MAP_VPAGETABLE = 0x2000 MCL_CURRENT = 0x1 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_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go deleted file mode 100644 index d4a192fe..00000000 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ /dev/null @@ -1,1794 +0,0 @@ -// mkerrors.sh -m64 -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,freebsd - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_ARP = 0x23 - AF_ATM = 0x1e - AF_BLUETOOTH = 0x24 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1a - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1c - AF_INET6_SDP = 0x2a - AF_INET_SDP = 0x28 - AF_IPX = 0x17 - AF_ISDN = 0x1a - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x2a - AF_NATM = 0x1d - AF_NETBIOS = 0x6 - AF_NETGRAPH = 0x20 - AF_OSI = 0x7 - AF_PUP = 0x4 - AF_ROUTE = 0x11 - AF_SCLUSTER = 0x22 - AF_SIP = 0x18 - AF_SLOW = 0x21 - AF_SNA = 0xb - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_VENDOR00 = 0x27 - AF_VENDOR01 = 0x29 - AF_VENDOR02 = 0x2b - AF_VENDOR03 = 0x2d - AF_VENDOR04 = 0x2f - AF_VENDOR05 = 0x31 - AF_VENDOR06 = 0x33 - AF_VENDOR07 = 0x35 - AF_VENDOR08 = 0x37 - AF_VENDOR09 = 0x39 - AF_VENDOR10 = 0x3b - AF_VENDOR11 = 0x3d - AF_VENDOR12 = 0x3f - AF_VENDOR13 = 0x41 - AF_VENDOR14 = 0x43 - AF_VENDOR15 = 0x45 - AF_VENDOR16 = 0x47 - AF_VENDOR17 = 0x49 - AF_VENDOR18 = 0x4b - AF_VENDOR19 = 0x4d - AF_VENDOR20 = 0x4f - AF_VENDOR21 = 0x51 - AF_VENDOR22 = 0x53 - AF_VENDOR23 = 0x55 - AF_VENDOR24 = 0x57 - AF_VENDOR25 = 0x59 - AF_VENDOR26 = 0x5b - AF_VENDOR27 = 0x5d - AF_VENDOR28 = 0x5f - AF_VENDOR29 = 0x61 - AF_VENDOR30 = 0x63 - AF_VENDOR31 = 0x65 - AF_VENDOR32 = 0x67 - AF_VENDOR33 = 0x69 - AF_VENDOR34 = 0x6b - AF_VENDOR35 = 0x6d - AF_VENDOR36 = 0x6f - AF_VENDOR37 = 0x71 - AF_VENDOR38 = 0x73 - AF_VENDOR39 = 0x75 - AF_VENDOR40 = 0x77 - AF_VENDOR41 = 0x79 - AF_VENDOR42 = 0x7b - AF_VENDOR43 = 0x7d - AF_VENDOR44 = 0x7f - AF_VENDOR45 = 0x81 - AF_VENDOR46 = 0x83 - AF_VENDOR47 = 0x85 - ALTWERASE = 0x200 - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B460800 = 0x70800 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B921600 = 0xe1000 - B9600 = 0x2580 - BIOCFEEDBACK = 0x8004427c - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDIRECTION = 0x40044276 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc0104279 - BIOCGETBUFMODE = 0x4004427d - BIOCGETIF = 0x4020426b - BIOCGETZMAX = 0x4008427f - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCGTSTAMP = 0x40044283 - BIOCIMMEDIATE = 0x80044270 - BIOCLOCK = 0x2000427a - BIOCPROMISC = 0x20004269 - BIOCROTZBUF = 0x40184280 - BIOCSBLEN = 0xc0044266 - BIOCSDIRECTION = 0x80044277 - BIOCSDLT = 0x80044278 - BIOCSETBUFMODE = 0x8004427e - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x80104282 - BIOCSETIF = 0x8020426c - BIOCSETWF = 0x8010427b - BIOCSETZBUF = 0x80184281 - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCSTSTAMP = 0x80044284 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x8 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_BUFMODE_BUFFER = 0x1 - BPF_BUFMODE_ZBUF = 0x2 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MOD = 0x90 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_T_BINTIME = 0x2 - BPF_T_BINTIME_FAST = 0x102 - BPF_T_BINTIME_MONOTONIC = 0x202 - BPF_T_BINTIME_MONOTONIC_FAST = 0x302 - BPF_T_FAST = 0x100 - BPF_T_FLAG_MASK = 0x300 - BPF_T_FORMAT_MASK = 0x3 - BPF_T_MICROTIME = 0x0 - BPF_T_MICROTIME_FAST = 0x100 - BPF_T_MICROTIME_MONOTONIC = 0x200 - BPF_T_MICROTIME_MONOTONIC_FAST = 0x300 - BPF_T_MONOTONIC = 0x200 - BPF_T_MONOTONIC_FAST = 0x300 - BPF_T_NANOTIME = 0x1 - BPF_T_NANOTIME_FAST = 0x101 - BPF_T_NANOTIME_MONOTONIC = 0x201 - BPF_T_NANOTIME_MONOTONIC_FAST = 0x301 - BPF_T_NONE = 0x3 - BPF_T_NORMAL = 0x0 - BPF_W = 0x0 - BPF_X = 0x8 - BPF_XOR = 0xa0 - BRKINT = 0x2 - CAP_ACCEPT = 0x200000020000000 - CAP_ACL_CHECK = 0x400000000010000 - CAP_ACL_DELETE = 0x400000000020000 - CAP_ACL_GET = 0x400000000040000 - CAP_ACL_SET = 0x400000000080000 - CAP_ALL0 = 0x20007ffffffffff - CAP_ALL1 = 0x4000000001fffff - CAP_BIND = 0x200000040000000 - CAP_BINDAT = 0x200008000000400 - CAP_CHFLAGSAT = 0x200000000001400 - CAP_CONNECT = 0x200000080000000 - CAP_CONNECTAT = 0x200010000000400 - CAP_CREATE = 0x200000000000040 - CAP_EVENT = 0x400000000000020 - CAP_EXTATTR_DELETE = 0x400000000001000 - CAP_EXTATTR_GET = 0x400000000002000 - CAP_EXTATTR_LIST = 0x400000000004000 - CAP_EXTATTR_SET = 0x400000000008000 - CAP_FCHDIR = 0x200000000000800 - CAP_FCHFLAGS = 0x200000000001000 - CAP_FCHMOD = 0x200000000002000 - CAP_FCHMODAT = 0x200000000002400 - CAP_FCHOWN = 0x200000000004000 - CAP_FCHOWNAT = 0x200000000004400 - CAP_FCNTL = 0x200000000008000 - CAP_FCNTL_ALL = 0x78 - CAP_FCNTL_GETFL = 0x8 - CAP_FCNTL_GETOWN = 0x20 - CAP_FCNTL_SETFL = 0x10 - CAP_FCNTL_SETOWN = 0x40 - CAP_FEXECVE = 0x200000000000080 - CAP_FLOCK = 0x200000000010000 - CAP_FPATHCONF = 0x200000000020000 - CAP_FSCK = 0x200000000040000 - CAP_FSTAT = 0x200000000080000 - CAP_FSTATAT = 0x200000000080400 - CAP_FSTATFS = 0x200000000100000 - CAP_FSYNC = 0x200000000000100 - CAP_FTRUNCATE = 0x200000000000200 - CAP_FUTIMES = 0x200000000200000 - CAP_FUTIMESAT = 0x200000000200400 - CAP_GETPEERNAME = 0x200000100000000 - CAP_GETSOCKNAME = 0x200000200000000 - CAP_GETSOCKOPT = 0x200000400000000 - CAP_IOCTL = 0x400000000000080 - CAP_IOCTLS_ALL = 0x7fffffffffffffff - CAP_KQUEUE = 0x400000000100040 - CAP_KQUEUE_CHANGE = 0x400000000100000 - CAP_KQUEUE_EVENT = 0x400000000000040 - CAP_LINKAT_SOURCE = 0x200020000000400 - CAP_LINKAT_TARGET = 0x200000000400400 - CAP_LISTEN = 0x200000800000000 - CAP_LOOKUP = 0x200000000000400 - CAP_MAC_GET = 0x400000000000001 - CAP_MAC_SET = 0x400000000000002 - CAP_MKDIRAT = 0x200000000800400 - CAP_MKFIFOAT = 0x200000001000400 - CAP_MKNODAT = 0x200000002000400 - CAP_MMAP = 0x200000000000010 - CAP_MMAP_R = 0x20000000000001d - CAP_MMAP_RW = 0x20000000000001f - CAP_MMAP_RWX = 0x20000000000003f - CAP_MMAP_RX = 0x20000000000003d - CAP_MMAP_W = 0x20000000000001e - CAP_MMAP_WX = 0x20000000000003e - CAP_MMAP_X = 0x20000000000003c - CAP_PDGETPID = 0x400000000000200 - CAP_PDKILL = 0x400000000000800 - CAP_PDWAIT = 0x400000000000400 - CAP_PEELOFF = 0x200001000000000 - CAP_POLL_EVENT = 0x400000000000020 - CAP_PREAD = 0x20000000000000d - CAP_PWRITE = 0x20000000000000e - CAP_READ = 0x200000000000001 - CAP_RECV = 0x200000000000001 - CAP_RENAMEAT_SOURCE = 0x200000004000400 - CAP_RENAMEAT_TARGET = 0x200040000000400 - CAP_RIGHTS_VERSION = 0x0 - CAP_RIGHTS_VERSION_00 = 0x0 - CAP_SEEK = 0x20000000000000c - CAP_SEEK_TELL = 0x200000000000004 - CAP_SEM_GETVALUE = 0x400000000000004 - CAP_SEM_POST = 0x400000000000008 - CAP_SEM_WAIT = 0x400000000000010 - CAP_SEND = 0x200000000000002 - CAP_SETSOCKOPT = 0x200002000000000 - CAP_SHUTDOWN = 0x200004000000000 - CAP_SOCK_CLIENT = 0x200007780000003 - CAP_SOCK_SERVER = 0x200007f60000003 - CAP_SYMLINKAT = 0x200000008000400 - CAP_TTYHOOK = 0x400000000000100 - CAP_UNLINKAT = 0x200000010000400 - CAP_UNUSED0_44 = 0x200080000000000 - CAP_UNUSED0_57 = 0x300000000000000 - CAP_UNUSED1_22 = 0x400000000200000 - CAP_UNUSED1_57 = 0x500000000000000 - CAP_WRITE = 0x200000000000002 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x4 - CLOCK_MONOTONIC_FAST = 0xc - CLOCK_MONOTONIC_PRECISE = 0xb - CLOCK_PROCESS_CPUTIME_ID = 0xf - CLOCK_PROF = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_FAST = 0xa - CLOCK_REALTIME_PRECISE = 0x9 - CLOCK_SECOND = 0xd - CLOCK_THREAD_CPUTIME_ID = 0xe - CLOCK_UPTIME = 0x5 - CLOCK_UPTIME_FAST = 0x8 - CLOCK_UPTIME_PRECISE = 0x7 - CLOCK_VIRTUAL = 0x1 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0x18 - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_BREDR_BB = 0xff - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_BLUETOOTH_LE_LL = 0xfb - DLT_BLUETOOTH_LE_LL_WITH_PHDR = 0x100 - DLT_BLUETOOTH_LINUX_MONITOR = 0xfe - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_EPON = 0x103 - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_INFINIBAND = 0xf7 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPMI_HPM_2 = 0x104 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x104 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NETLINK = 0xfd - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x79 - DLT_PKTAP = 0x102 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PROFIBUS_DL = 0x101 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_RTAC_SERIAL = 0xfa - DLT_SCCP = 0x8e - DLT_SCTP = 0xf8 - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USBPCAP = 0xf9 - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_WIRESHARK_UPPER_PDU = 0xfc - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_FS = -0x9 - EVFILT_LIO = -0xa - EVFILT_PROC = -0x5 - EVFILT_PROCDESC = -0x8 - EVFILT_READ = -0x1 - EVFILT_SENDFILE = -0xc - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xc - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xb - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DROP = 0x1000 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG1 = 0x2000 - EV_FLAG2 = 0x4000 - EV_FORCEONESHOT = 0x100 - EV_ONESHOT = 0x10 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EXTA = 0x4b00 - EXTATTR_NAMESPACE_EMPTY = 0x0 - EXTATTR_NAMESPACE_SYSTEM = 0x2 - EXTATTR_NAMESPACE_USER = 0x1 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FLUSHO = 0x800000 - F_CANCEL = 0x5 - F_DUP2FD = 0xa - F_DUP2FD_CLOEXEC = 0x12 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x11 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0xb - F_GETOWN = 0x5 - F_OGETLK = 0x7 - F_OK = 0x0 - F_OSETLK = 0x8 - F_OSETLKW = 0x9 - F_RDAHEAD = 0x10 - F_RDLCK = 0x1 - F_READAHEAD = 0xf - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0xc - F_SETLKW = 0xd - F_SETLK_REMOTE = 0xe - F_SETOWN = 0x6 - F_UNLCK = 0x2 - F_UNLCKSYS = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFAN_ARRIVAL = 0x0 - IFAN_DEPARTURE = 0x1 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x218f52 - IFF_CANTCONFIG = 0x10000 - IFF_DEBUG = 0x4 - IFF_DRV_OACTIVE = 0x400 - IFF_DRV_RUNNING = 0x40 - IFF_DYING = 0x200000 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MONITOR = 0x40000 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PPROMISC = 0x20000 - IFF_PROMISC = 0x100 - IFF_RENAMING = 0x400000 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_STATICARP = 0x80000 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_IEEE1394 = 0x90 - IFT_INFINIBAND = 0xc7 - IFT_L2VLAN = 0x87 - IFT_L3IPVLAN = 0x88 - IFT_PPP = 0x17 - IFT_PROPVIRTUAL = 0x35 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LOOPBACKNET = 0x7f - IN_RFC3021_MASK = 0xfffffffe - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CARP = 0x70 - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0x102 - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HIP = 0x8b - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MEAS = 0x13 - IPPROTO_MH = 0x87 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MOBILE = 0x37 - IPPROTO_MPLS = 0x89 - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OLD_DIVERT = 0xfe - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PFSYNC = 0xf0 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_RESERVED_253 = 0xfd - IPPROTO_RESERVED_254 = 0xfe - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEND = 0x103 - IPPROTO_SEP = 0x21 - IPPROTO_SHIM6 = 0x8c - IPPROTO_SKIP = 0x39 - IPPROTO_SPACER = 0x7fff - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TLSP = 0x38 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_AUTOFLOWLABEL = 0x3b - IPV6_BINDANY = 0x40 - IPV6_BINDMULTI = 0x41 - IPV6_BINDV6ONLY = 0x1b - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_DONTFRAG = 0x3e - IPV6_DSTOPTS = 0x32 - IPV6_FLOWID = 0x43 - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOWTYPE = 0x44 - IPV6_FRAGTTL = 0x78 - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_HOPLIMIT = 0x2f - IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MSFILTER = 0x4a - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_NEXTHOP = 0x30 - IPV6_PATHMTU = 0x2c - IPV6_PKTINFO = 0x2e - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_PREFER_TEMPADDR = 0x3f - IPV6_RECVDSTOPTS = 0x28 - IPV6_RECVFLOWID = 0x46 - IPV6_RECVHOPLIMIT = 0x25 - IPV6_RECVHOPOPTS = 0x27 - IPV6_RECVPATHMTU = 0x2b - IPV6_RECVPKTINFO = 0x24 - IPV6_RECVRSSBUCKETID = 0x47 - IPV6_RECVRTHDR = 0x26 - IPV6_RECVTCLASS = 0x39 - IPV6_RSSBUCKETID = 0x45 - IPV6_RSS_LISTEN_BUCKET = 0x42 - IPV6_RTHDR = 0x33 - IPV6_RTHDRDSTOPTS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x3d - IPV6_UNICAST_HOPS = 0x4 - IPV6_USE_MIN_MTU = 0x2a - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BINDANY = 0x18 - IP_BINDMULTI = 0x19 - IP_BLOCK_SOURCE = 0x48 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DONTFRAG = 0x43 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET3 = 0x31 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FLOWID = 0x5a - IP_FLOWTYPE = 0x5b - IP_FW3 = 0x30 - IP_FW_ADD = 0x32 - IP_FW_DEL = 0x33 - IP_FW_FLUSH = 0x34 - IP_FW_GET = 0x36 - IP_FW_NAT_CFG = 0x38 - IP_FW_NAT_DEL = 0x39 - IP_FW_NAT_GET_CONFIG = 0x3a - IP_FW_NAT_GET_LOG = 0x3b - IP_FW_RESETLOG = 0x37 - IP_FW_TABLE_ADD = 0x28 - IP_FW_TABLE_DEL = 0x29 - IP_FW_TABLE_FLUSH = 0x2a - IP_FW_TABLE_GETSIZE = 0x2b - IP_FW_TABLE_LIST = 0x2c - IP_FW_ZERO = 0x35 - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MAX_SOURCE_FILTER = 0x400 - IP_MF = 0x2000 - IP_MINTTL = 0x42 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_OFFMASK = 0x1fff - IP_ONESBCAST = 0x17 - IP_OPTIONS = 0x1 - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVFLOWID = 0x5d - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVRETOPTS = 0x6 - IP_RECVRSSBUCKETID = 0x5e - IP_RECVTOS = 0x44 - IP_RECVTTL = 0x41 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSSBUCKETID = 0x5c - IP_RSS_LISTEN_BUCKET = 0x1a - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_SENDSRCADDR = 0x7 - IP_TOS = 0x3 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_AUTOSYNC = 0x7 - MADV_CORE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_NOCORE = 0x8 - MADV_NORMAL = 0x0 - MADV_NOSYNC = 0x6 - MADV_PROTECT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MAP_32BIT = 0x80000 - MAP_ALIGNED_SUPER = 0x1000000 - MAP_ALIGNMENT_MASK = -0x1000000 - MAP_ALIGNMENT_SHIFT = 0x18 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_EXCL = 0x4000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_NOCORE = 0x20000 - MAP_NOSYNC = 0x800 - MAP_PREFAULT_READ = 0x40000 - MAP_PRIVATE = 0x2 - MAP_RESERVED0020 = 0x20 - MAP_RESERVED0040 = 0x40 - MAP_RESERVED0080 = 0x80 - MAP_RESERVED0100 = 0x100 - MAP_SHARED = 0x1 - MAP_STACK = 0x400 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ACLS = 0x8000000 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x200000000 - MNT_BYFSID = 0x8000000 - MNT_CMDFLAGS = 0xd0f0000 - 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_GJOURNAL = 0x2000000 - MNT_IGNORE = 0x800000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NFS4ACLS = 0x10 - MNT_NOATIME = 0x10000000 - MNT_NOCLUSTERR = 0x40000000 - MNT_NOCLUSTERW = 0x80000000 - MNT_NOEXEC = 0x4 - MNT_NONBUSY = 0x4000000 - MNT_NOSUID = 0x8 - MNT_NOSYMFOLLOW = 0x400000 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x1000000 - MNT_SOFTDEP = 0x200000 - MNT_SUIDDIR = 0x100000 - MNT_SUJ = 0x100000000 - MNT_SUSPEND = 0x4 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_UPDATEMASK = 0x2d8d0807e - MNT_USER = 0x8000 - MNT_VISFLAGMASK = 0x3fef0ffff - MNT_WAIT = 0x1 - MSG_CMSG_CLOEXEC = 0x40000 - MSG_COMPAT = 0x8000 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_NBIO = 0x4000 - MSG_NOSIGNAL = 0x20000 - MSG_NOTIFICATION = 0x2000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITFORONE = 0x80000 - MS_ASYNC = 0x1 - MS_INVALIDATE = 0x2 - MS_SYNC = 0x0 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLISTL = 0x5 - NET_RT_IFMALIST = 0x4 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ATTRIB = 0x8 - NOTE_CHILD = 0x4 - NOTE_CLOSE = 0x100 - NOTE_CLOSE_WRITE = 0x200 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FILE_POLL = 0x2 - NOTE_FORK = 0x40000000 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MSECONDS = 0x2 - NOTE_NSECONDS = 0x8 - NOTE_OPEN = 0x80 - NOTE_PCTRLMASK = 0xf0000000 - NOTE_PDATAMASK = 0xfffff - NOTE_READ = 0x400 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x4 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x100000 - O_CREAT = 0x200 - O_DIRECT = 0x10000 - O_DIRECTORY = 0x20000 - O_EXCL = 0x800 - O_EXEC = 0x40000 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x8000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_TTY_INIT = 0x80000 - O_VERIFY = 0x200000 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - RLIMIT_AS = 0xa - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_FIXEDMTU = 0x80000 - RTF_FMASK = 0x1004d808 - RTF_GATEWAY = 0x2 - RTF_GWFLAG_COMPAT = 0x80000000 - RTF_HOST = 0x4 - RTF_LLDATA = 0x400 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_PINNED = 0x100000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_REJECT = 0x8 - RTF_RNH_LOCKED = 0x40000000 - RTF_STATIC = 0x800 - RTF_STICKY = 0x10000000 - RTF_UP = 0x1 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_IEEE80211 = 0x12 - RTM_IFANNOUNCE = 0x11 - RTM_IFINFO = 0xe - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RTV_WEIGHT = 0x100 - RT_ALL_FIBS = -0x1 - RT_BLACKHOLE = 0x40 - RT_CACHING_CONTEXT = 0x1 - RT_DEFAULT_FIB = 0x0 - RT_HAS_GW = 0x80 - RT_HAS_HEADER = 0x10 - RT_HAS_HEADER_BIT = 0x4 - RT_L2_ME = 0x4 - RT_L2_ME_BIT = 0x2 - RT_LLE_CACHE = 0x100 - RT_MAY_LOOP = 0x8 - RT_MAY_LOOP_BIT = 0x3 - RT_NORTREF = 0x2 - RT_REJECT = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_BINTIME = 0x4 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCAIFGROUP = 0x80286987 - SIOCATMARK = 0x40047307 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFGROUP = 0x80286989 - SIOCDIFPHYADDR = 0x80206949 - SIOCGDRVSPEC = 0xc028697b - SIOCGETSGCNT = 0xc0207210 - SIOCGETVIFCNT = 0xc028720f - SIOCGHIWAT = 0x40047301 - SIOCGI2C = 0xc020693d - SIOCGIFADDR = 0xc0206921 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020691f - SIOCGIFCONF = 0xc0106924 - SIOCGIFDESCR = 0xc020692a - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFIB = 0xc020695c - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFGMEMB = 0xc028698a - SIOCGIFGROUP = 0xc0286988 - SIOCGIFINDEX = 0xc0206920 - SIOCGIFMAC = 0xc0206926 - SIOCGIFMEDIA = 0xc0306938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206948 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc0206947 - SIOCGIFSTATUS = 0xc331693b - SIOCGIFXMEDIA = 0xc030698b - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCGPRIVATE_0 = 0xc0206950 - SIOCGPRIVATE_1 = 0xc0206951 - SIOCGTUNFIB = 0xc020695e - SIOCIFCREATE = 0xc020697a - SIOCIFCREATE2 = 0xc020697c - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106978 - SIOCSDRVSPEC = 0x8028697b - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020691e - SIOCSIFDESCR = 0x80206929 - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFIB = 0x8020695d - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206927 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNAME = 0x80206928 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x80406946 - SIOCSIFPHYS = 0x80206936 - SIOCSIFRVNET = 0xc020695b - SIOCSIFVNET = 0xc020695a - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SIOCSTUNFIB = 0x8020695f - SOCK_CLOEXEC = 0x10000000 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_NONBLOCK = 0x20000000 - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_ACCEPTFILTER = 0x1000 - SO_BINTIME = 0x2000 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1009 - SO_LINGER = 0x80 - SO_LISTENINCQLEN = 0x1013 - SO_LISTENQLEN = 0x1012 - SO_LISTENQLIMIT = 0x1011 - SO_NOSIGPIPE = 0x800 - SO_NO_DDP = 0x8000 - SO_NO_OFFLOAD = 0x4000 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1010 - SO_PROTOCOL = 0x1016 - SO_PROTOTYPE = 0x1016 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_SETFIB = 0x1014 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TYPE = 0x1008 - SO_USELOOPBACK = 0x40 - SO_USER_COOKIE = 0x1015 - SO_VENDOR = 0x80000000 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB3 = 0x4 - TABDLY = 0x4 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CA_NAME_MAX = 0x10 - TCP_CCALGOOPT = 0x41 - TCP_CONGESTION = 0x40 - TCP_FASTOPEN = 0x401 - TCP_FUNCTION_BLK = 0x2000 - TCP_FUNCTION_NAME_LEN_MAX = 0x20 - TCP_INFO = 0x20 - TCP_KEEPCNT = 0x400 - TCP_KEEPIDLE = 0x100 - TCP_KEEPINIT = 0x80 - TCP_KEEPINTVL = 0x200 - TCP_MAXBURST = 0x4 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0x10 - TCP_MINMSS = 0xd8 - TCP_MSS = 0x218 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_PCAP_IN = 0x1000 - TCP_PCAP_OUT = 0x800 - TCP_VENDOR = 0x80000000 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDRAIN = 0x2000745e - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x402c7413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGPTN = 0x4004740f - TIOCGSID = 0x40047463 - TIOCGWINSZ = 0x40087468 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DCD = 0x40 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTMASTER = 0x2000741c - TIOCSBRK = 0x2000747b - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x802c7414 - TIOCSETAF = 0x802c7416 - TIOCSETAW = 0x802c7415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2004745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VERASE2 = 0x7 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x4 - WCOREFLAG = 0x80 - WEXITED = 0x10 - WLINUXCLONE = 0x80000000 - WNOHANG = 0x1 - WNOWAIT = 0x8 - WSTOPPED = 0x2 - WTRAPPED = 0x20 - WUNTRACED = 0x2 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADF = syscall.Errno(0x9) - EBADMSG = syscall.Errno(0x59) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x55) - ECAPMODE = syscall.Errno(0x5e) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDOM = syscall.Errno(0x21) - EDOOFUS = syscall.Errno(0x58) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x52) - EILSEQ = syscall.Errno(0x56) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5a) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x57) - ENOBUFS = syscall.Errno(0x37) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x5b) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x53) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCAPABLE = syscall.Errno(0x5d) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x5f) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x2d) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x60) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x5c) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGLIBRT = syscall.Signal(0x21) - SIGLWP = syscall.Signal(0x20) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTHR = syscall.Signal(0x20) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "device busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "EOPNOTSUPP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "operation timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EIDRM", "identifier removed"}, - {83, "ENOMSG", "no message of desired type"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "ECANCELED", "operation canceled"}, - {86, "EILSEQ", "illegal byte sequence"}, - {87, "ENOATTR", "attribute not found"}, - {88, "EDOOFUS", "programming error"}, - {89, "EBADMSG", "bad message"}, - {90, "EMULTIHOP", "multihop attempted"}, - {91, "ENOLINK", "link has been severed"}, - {92, "EPROTO", "protocol error"}, - {93, "ENOTCAPABLE", "capabilities insufficient"}, - {94, "ECAPMODE", "not permitted in capability mode"}, - {95, "ENOTRECOVERABLE", "state not recoverable"}, - {96, "EOWNERDEAD", "previous owner died"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGIOT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "suspended (signal)"}, - {18, "SIGTSTP", "suspended"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, - {32, "SIGTHR", "unknown signal"}, - {33, "SIGLIBRT", "unknown signal"}, -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 881e69f1..3800ff37 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80041270 BLKBSZSET = 0x40041271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,60 +485,6 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 @@ -622,7 +492,6 @@ const ( FFDLY = 0x8000 FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -644,7 +513,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -769,7 +638,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -837,7 +706,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -909,7 +777,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1011,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1045,11 +892,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1059,10 +901,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1136,15 +974,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1158,9 +987,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1173,8 +1000,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1251,7 +1076,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1273,7 +1097,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1395,7 +1219,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1445,36 +1268,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40042406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8008743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40087446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x400c744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40087447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1537,12 +1330,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1580,10 +1367,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1685,13 +1470,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1785,7 +1563,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1806,7 +1583,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1821,12 +1597,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1841,8 +1616,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1891,16 +1666,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1951,9 +1722,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2043,7 +1811,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2051,7 +1818,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2063,17 +1829,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2100,8 +1855,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2113,18 +1866,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2203,7 +1947,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2216,10 +1960,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2234,7 +1975,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2254,9 +1994,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2271,7 +2008,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2288,7 +2024,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2296,7 +2031,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2350,7 +2084,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2391,7 +2124,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2419,10 +2151,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2563,29 +2293,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 039b007d..9c204cf7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,60 +485,6 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 @@ -622,7 +492,6 @@ const ( FFDLY = 0x8000 FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -644,7 +513,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -769,7 +638,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -837,7 +706,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -909,7 +777,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1011,26 +878,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1045,11 +892,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1059,10 +901,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1136,15 +974,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1158,9 +987,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1173,8 +1000,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1251,7 +1076,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1273,7 +1097,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1395,7 +1219,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1445,36 +1268,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40082406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8010743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40107446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x4010744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40107447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1537,12 +1330,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1580,10 +1367,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1686,13 +1471,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1786,7 +1564,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1807,7 +1584,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1822,12 +1598,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1842,8 +1617,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1892,16 +1667,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1952,9 +1723,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2044,7 +1812,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2052,7 +1819,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2064,17 +1830,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2101,8 +1856,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2114,18 +1867,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2204,7 +1948,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2217,10 +1961,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2235,7 +1976,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2255,9 +1995,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2272,7 +2009,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2289,7 +2025,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2297,7 +2032,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2351,7 +2085,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2392,7 +2125,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2420,10 +2152,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2563,29 +2293,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 97ed569a..03e2b341 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80041270 BLKBSZSET = 0x40041271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x1000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40042406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8008743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40087446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x400c744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40087447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1692,13 +1477,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1792,7 +1570,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1813,7 +1590,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1828,12 +1604,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1848,8 +1623,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1898,16 +1673,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1958,9 +1729,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2050,7 +1818,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2058,7 +1825,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2070,17 +1836,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2107,8 +1862,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2120,18 +1873,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2210,7 +1954,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2223,10 +1967,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2241,7 +1982,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2261,9 +2001,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2278,7 +2015,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2295,7 +2031,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2303,7 +2038,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2357,7 +2091,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2398,7 +2131,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2426,10 +2158,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2569,29 +2299,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index d47f3ba6..bc9a8bb9 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -563,60 +487,6 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 @@ -624,7 +494,6 @@ const ( FFDLY = 0x8000 FLUSHO = 0x1000 FPSIMD_MAGIC = 0x46508001 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -646,7 +515,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -771,7 +640,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -839,7 +708,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -911,7 +779,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1013,26 +880,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1047,11 +894,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1061,10 +903,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1137,15 +975,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1159,9 +988,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1174,8 +1001,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1252,7 +1077,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1274,7 +1098,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1396,7 +1220,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1446,36 +1269,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40082406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8010743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40107446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x4010744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40107447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1538,12 +1331,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1581,10 +1368,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1676,13 +1461,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1776,7 +1554,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1797,7 +1574,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1812,12 +1588,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1832,8 +1607,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1882,16 +1657,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1942,9 +1713,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2034,7 +1802,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2042,7 +1809,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2054,17 +1820,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2091,8 +1846,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2104,18 +1857,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2195,7 +1939,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2208,10 +1952,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2226,7 +1967,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2246,9 +1986,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2263,7 +2000,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2280,7 +2016,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2288,7 +2023,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2342,7 +2076,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2383,7 +2116,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2411,10 +2143,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2554,29 +2284,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 0ae030ee..2309829e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40041270 BLKBSZSET = 0x80041271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x2000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80042406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4008743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80087446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x800c744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80087447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1685,13 +1470,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1785,7 +1563,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1806,7 +1583,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1821,12 +1597,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1841,8 +1616,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1891,16 +1666,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1951,9 +1722,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x40047309 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2043,7 +1811,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 SO_ATTACH_BPF = 0x32 @@ -2051,7 +1818,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2063,17 +1829,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2100,8 +1855,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2113,19 +1866,10 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2204,7 +1948,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x5407 TCGETA = 0x5401 TCGETS = 0x540d @@ -2216,10 +1960,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2234,7 +1975,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2254,9 +1994,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2271,7 +2008,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2285,7 +2021,6 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d @@ -2294,7 +2029,6 @@ const ( TIOCGETP = 0x7408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x5492 - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x548b TIOCGLTC = 0x7474 TIOCGPGRP = 0x40047477 @@ -2351,7 +2085,6 @@ const ( TIOCSETN = 0x740a TIOCSETP = 0x7409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x548c TIOCSLTC = 0x7475 TIOCSPGRP = 0x80047476 @@ -2393,7 +2126,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2421,10 +2153,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2565,29 +2295,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 91b49ddd..0660b02d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x2000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80082406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4010743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80107446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x8010744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80107447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1685,13 +1470,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1785,7 +1563,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1806,7 +1583,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1821,12 +1597,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1841,8 +1616,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1891,16 +1666,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1951,9 +1722,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x40047309 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2043,7 +1811,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 SO_ATTACH_BPF = 0x32 @@ -2051,7 +1818,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2063,17 +1829,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2100,8 +1855,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2113,19 +1866,10 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2204,7 +1948,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x5407 TCGETA = 0x5401 TCGETS = 0x540d @@ -2216,10 +1960,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2234,7 +1975,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2254,9 +1994,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2271,7 +2008,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2285,7 +2021,6 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d @@ -2294,7 +2029,6 @@ const ( TIOCGETP = 0x7408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x5492 - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x548b TIOCGLTC = 0x7474 TIOCGPGRP = 0x40047477 @@ -2351,7 +2085,6 @@ const ( TIOCSETN = 0x740a TIOCSETP = 0x7409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x548c TIOCSLTC = 0x7475 TIOCSPGRP = 0x80047476 @@ -2393,7 +2126,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2421,10 +2153,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2565,29 +2295,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 7f1ef04e..2761f2a6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x2000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80082406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4010743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80107446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x8010744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80107447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1685,13 +1470,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1785,7 +1563,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1806,7 +1583,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1821,12 +1597,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1841,8 +1616,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1891,16 +1666,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1951,9 +1722,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x40047309 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2043,7 +1811,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 SO_ATTACH_BPF = 0x32 @@ -2051,7 +1818,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2063,17 +1829,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2100,8 +1855,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2113,19 +1866,10 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2204,7 +1948,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x5407 TCGETA = 0x5401 TCGETS = 0x540d @@ -2216,10 +1960,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2234,7 +1975,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2254,9 +1994,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2271,7 +2008,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2285,7 +2021,6 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d @@ -2294,7 +2029,6 @@ const ( TIOCGETP = 0x7408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x5492 - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x548b TIOCGLTC = 0x7474 TIOCGPGRP = 0x40047477 @@ -2351,7 +2085,6 @@ const ( TIOCSETN = 0x740a TIOCSETP = 0x7409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x548c TIOCSLTC = 0x7475 TIOCSPGRP = 0x80047476 @@ -2393,7 +2126,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2421,10 +2153,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2565,29 +2295,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 724a244f..127bf06f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40041270 BLKBSZSET = 0x80041271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x2000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80042406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4008743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80087446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x800c744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80087447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1685,13 +1470,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1785,7 +1563,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1806,7 +1583,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1821,12 +1597,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1841,8 +1616,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1891,16 +1666,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1951,9 +1722,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x40047309 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2043,7 +1811,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 SO_ATTACH_BPF = 0x32 @@ -2051,7 +1818,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2063,17 +1829,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2100,8 +1855,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2113,19 +1866,10 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2204,7 +1948,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x5407 TCGETA = 0x5401 TCGETS = 0x540d @@ -2216,10 +1960,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2234,7 +1975,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2254,9 +1994,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2271,7 +2008,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2285,7 +2021,6 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d @@ -2294,7 +2029,6 @@ const ( TIOCGETP = 0x7408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x5492 - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x548b TIOCGLTC = 0x7474 TIOCGPGRP = 0x40047477 @@ -2351,7 +2085,6 @@ const ( TIOCSETN = 0x740a TIOCSETP = 0x7409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x548c TIOCSLTC = 0x7475 TIOCSPGRP = 0x80047476 @@ -2393,7 +2126,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2421,10 +2153,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2565,29 +2295,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 25044629..d972fd82 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x400 IXON = 0x200 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1133,15 +971,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x20000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 @@ -1155,9 +984,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1170,8 +997,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1248,7 +1073,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1270,7 +1094,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1394,7 +1218,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1444,36 +1267,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80082406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4010743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80107446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x8010744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80107447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1537,12 +1330,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1580,10 +1367,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1662,8 +1447,6 @@ const ( PTRACE_SINGLEBLOCK = 0x100 PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 - PTRACE_SYSEMU = 0x1d - PTRACE_SYSEMU_SINGLESTEP = 0x1e PTRACE_TRACEME = 0x0 PT_CCR = 0x26 PT_CTR = 0x23 @@ -1743,13 +1526,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1843,7 +1619,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1864,7 +1639,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1879,12 +1653,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1899,8 +1672,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1949,16 +1722,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -2009,9 +1778,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2101,7 +1867,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2109,7 +1874,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2121,17 +1885,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2158,8 +1911,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVTIMEO = 0x12 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x12 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2171,18 +1922,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x11 SO_SNDTIMEO = 0x13 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x13 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2261,7 +2003,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x2000741f TCGETA = 0x40147417 TCGETS = 0x402c7413 @@ -2272,10 +2014,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2290,7 +2029,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2310,9 +2048,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2327,7 +2062,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x2000741d TCSBRKP = 0x5425 @@ -2338,7 +2072,6 @@ const ( TCSETSF = 0x802c7416 TCSETSW = 0x802c7415 TCXONC = 0x2000741e - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2348,7 +2081,6 @@ const ( TIOCGETP = 0x40067408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x5456 TIOCGLTC = 0x40067474 TIOCGPGRP = 0x40047477 @@ -2409,7 +2141,6 @@ const ( TIOCSETN = 0x8006740a TIOCSETP = 0x80067409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSLTC = 0x80067475 TIOCSPGRP = 0x80047476 @@ -2453,7 +2184,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2481,10 +2211,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2624,29 +2352,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0xc00 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index e7c49911..b6e169aa 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x400 IXON = 0x200 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1133,15 +971,6 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x20000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 @@ -1155,9 +984,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1170,8 +997,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1248,7 +1073,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1270,7 +1094,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1394,7 +1218,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1444,36 +1267,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x80082406 PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4010743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80107446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x8010744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80107447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1537,12 +1330,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1580,10 +1367,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1662,8 +1447,6 @@ const ( PTRACE_SINGLEBLOCK = 0x100 PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 - PTRACE_SYSEMU = 0x1d - PTRACE_SYSEMU_SINGLESTEP = 0x1e PTRACE_TRACEME = 0x0 PT_CCR = 0x26 PT_CTR = 0x23 @@ -1743,13 +1526,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1843,7 +1619,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1864,7 +1639,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1879,12 +1653,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1899,8 +1672,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1949,16 +1722,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -2009,9 +1778,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2101,7 +1867,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2109,7 +1874,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2121,17 +1885,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2158,8 +1911,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVTIMEO = 0x12 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x12 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2171,18 +1922,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x11 SO_SNDTIMEO = 0x13 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x13 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2261,7 +2003,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x2000741f TCGETA = 0x40147417 TCGETS = 0x402c7413 @@ -2272,10 +2014,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2290,7 +2029,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2310,9 +2048,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2327,7 +2062,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x2000741d TCSBRKP = 0x5425 @@ -2338,7 +2072,6 @@ const ( TCSETSF = 0x802c7416 TCSETSW = 0x802c7415 TCXONC = 0x2000741e - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2348,7 +2081,6 @@ const ( TIOCGETP = 0x40067408 TIOCGEXCL = 0x40045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x40285442 TIOCGLCKTRMIOS = 0x5456 TIOCGLTC = 0x40067474 TIOCGPGRP = 0x40047477 @@ -2409,7 +2141,6 @@ const ( TIOCSETN = 0x8006740a TIOCSETP = 0x80067409 TIOCSIG = 0x80045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSLTC = 0x80067475 TIOCSPGRP = 0x80047476 @@ -2453,7 +2184,6 @@ const ( TUNGETVNETBE = 0x400454df TUNGETVNETHDRSZ = 0x400454d7 TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 TUNSETDEBUG = 0x800454c9 TUNSETFILTEREBPF = 0x400454e1 TUNSETGROUP = 0x800454ce @@ -2481,10 +2211,8 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2624,29 +2352,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0xc00 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 0373d65a..de94141f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x1000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40082406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8010743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40107446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x4010744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40107447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1673,13 +1458,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1773,7 +1551,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1794,7 +1571,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1809,12 +1585,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1829,8 +1604,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1879,16 +1654,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1939,9 +1710,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2031,7 +1799,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2039,7 +1806,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2051,17 +1817,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2088,8 +1843,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2101,18 +1854,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2191,7 +1935,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2204,10 +1948,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2222,7 +1963,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2242,9 +1982,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2259,7 +1996,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2276,7 +2012,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2284,7 +2019,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2338,7 +2072,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2379,7 +2112,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2407,10 +2139,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2550,29 +2280,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index b2ed7ee6..0e4dba12 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2d + AF_MAX = 0x2c AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -64,7 +64,6 @@ const ( AF_VSOCK = 0x28 AF_WANPIPE = 0x19 AF_X25 = 0x9 - AF_XDP = 0x2c ALG_OP_DECRYPT = 0x0 ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 @@ -174,7 +173,6 @@ const ( B9600 = 0xd BALLOON_KVM_MAGIC = 0x13661366 BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 @@ -197,59 +195,10 @@ const ( BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALU = 0x4 - BPF_ALU64 = 0x7 BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -257,16 +206,8 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -280,33 +221,20 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 - BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 - BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -390,10 +318,6 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -561,67 +485,12 @@ const ( FALLOC_FL_PUNCH_HOLE = 0x2 FALLOC_FL_UNSHARE_RANGE = 0x40 FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 FLUSHO = 0x1000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 @@ -643,7 +512,7 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 + FS_POLICY_FLAGS_VALID = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -768,7 +637,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0x9 IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -836,7 +705,6 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -908,7 +776,6 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1010,26 +877,6 @@ const ( IXOFF = 0x1000 IXON = 0x400 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_CHOWN = 0x4 KEYCTL_CLEAR = 0x7 @@ -1044,11 +891,6 @@ const ( KEYCTL_JOIN_SESSION_KEYRING = 0x1 KEYCTL_LINK = 0x8 KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c KEYCTL_READ = 0xb KEYCTL_REJECT = 0x13 KEYCTL_RESTRICT_KEYRING = 0x1d @@ -1058,10 +900,6 @@ const ( KEYCTL_SETPERM = 0x5 KEYCTL_SET_REQKEY_KEYRING = 0xe KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 KEY_REQKEY_DEFL_DEFAULT = 0x0 @@ -1134,15 +972,6 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1156,9 +985,7 @@ const ( MFD_HUGE_256MB = 0x70000000 MFD_HUGE_2GB = 0x7c000000 MFD_HUGE_2MB = 0x54000000 - MFD_HUGE_32MB = 0x64000000 MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 MFD_HUGE_64KB = 0x40000000 MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f @@ -1171,8 +998,6 @@ const ( MNT_DETACH = 0x2 MNT_EXPIRE = 0x4 MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1249,7 +1074,6 @@ const ( NETLINK_FIB_LOOKUP = 0xa NETLINK_FIREWALL = 0x3 NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc NETLINK_INET_DIAG = 0x4 NETLINK_IP6_FW = 0xd NETLINK_ISCSI = 0x8 @@ -1271,7 +1095,7 @@ const ( NETLINK_UNUSED = 0x1 NETLINK_USERSOCK = 0x2 NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 + NETNSA_MAX = 0x3 NETNSA_NSID_NOT_ASSIGNED = -0x1 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 @@ -1393,7 +1217,6 @@ const ( PACKET_FASTROUTE = 0x6 PACKET_HDRLEN = 0xb PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 PACKET_KERNEL = 0x7 PACKET_LOOPBACK = 0x5 PACKET_LOSS = 0xe @@ -1443,36 +1266,6 @@ const ( PERF_EVENT_IOC_SET_FILTER = 0x40082406 PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x4004743d - PPPIOCATTCHAN = 0x40047438 - PPPIOCCONNECT = 0x4004743a - PPPIOCDETACH = 0x4004743c - PPPIOCDISCONN = 0x7439 - PPPIOCGASYNCMAP = 0x80047458 - PPPIOCGCHAN = 0x80047437 - PPPIOCGDEBUG = 0x80047441 - PPPIOCGFLAGS = 0x8004745a - PPPIOCGIDLE = 0x8010743f - PPPIOCGL2TPSTATS = 0x80487436 - PPPIOCGMRU = 0x80047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x80047455 - PPPIOCGUNIT = 0x80047456 - PPPIOCGXASYNCMAP = 0x80207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x40107446 - PPPIOCSASYNCMAP = 0x40047457 - PPPIOCSCOMPRESS = 0x4010744d - PPPIOCSDEBUG = 0x40047440 - PPPIOCSFLAGS = 0x40047459 - PPPIOCSMAXCID = 0x40047451 - PPPIOCSMRRU = 0x4004743b - PPPIOCSMRU = 0x40047452 - PPPIOCSNPMODE = 0x4008744b - PPPIOCSPASS = 0x40107447 - PPPIOCSRASYNCMAP = 0x40047454 - PPPIOCSXASYNCMAP = 0x4020744f - PPPIOCXFERUNIT = 0x744e PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1535,12 +1328,6 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1578,10 +1365,8 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -1746,13 +1531,6 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x40085203 - RNDADDTOENTCNT = 0x40045201 - RNDCLEARPOOL = 0x5206 - RNDGETENTCNT = 0x80045200 - RNDGETPOOL = 0x80085202 - RNDRESEEDCRNG = 0x5207 - RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1846,7 +1624,6 @@ const ( RTM_DELACTION = 0x31 RTM_DELADDR = 0x15 RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 RTM_DELLINK = 0x11 RTM_DELMDB = 0x55 RTM_DELNEIGH = 0x1d @@ -1867,7 +1644,6 @@ const ( RTM_GETADDR = 0x16 RTM_GETADDRLABEL = 0x4a RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 RTM_GETDCB = 0x4e RTM_GETLINK = 0x12 RTM_GETMDB = 0x56 @@ -1882,12 +1658,11 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 + RTM_MAX = 0x63 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 RTM_NEWLINK = 0x10 RTM_NEWMDB = 0x54 RTM_NEWNDUSEROPT = 0x44 @@ -1902,8 +1677,8 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 + RTM_NR_FAMILIES = 0x15 + RTM_NR_MSGTYPES = 0x54 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 @@ -1952,16 +1727,12 @@ const ( SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPNS = 0x23 - SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 - SC_LOG_FLUSH = 0x100000 SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x80000 - SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -2012,9 +1783,6 @@ const ( SIOCGMIIPHY = 0x8947 SIOCGMIIREG = 0x8948 SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 SIOCGRARP = 0x8961 SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 @@ -2104,7 +1872,6 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_X25 = 0x106 - SOL_XDP = 0x11b SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e SO_ATTACH_BPF = 0x32 @@ -2112,7 +1879,6 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 - SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2124,17 +1890,6 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2161,8 +1916,6 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 - SO_RCVTIMEO_NEW = 0x42 - SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2174,18 +1927,9 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 - SO_SNDTIMEO_NEW = 0x43 - SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 - SO_TIMESTAMPING_NEW = 0x41 - SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 - SO_TIMESTAMPNS_NEW = 0x40 - SO_TIMESTAMPNS_OLD = 0x23 - SO_TIMESTAMP_NEW = 0x3f - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 @@ -2264,7 +2008,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 + TASKSTATS_VERSION = 0x8 TCFLSH = 0x540b TCGETA = 0x5405 TCGETS = 0x5401 @@ -2277,10 +2021,7 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2295,7 +2036,6 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb - TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2315,9 +2055,6 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2332,7 +2069,6 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2349,7 +2085,6 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a - TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c @@ -2357,7 +2092,6 @@ const ( TIOCGETD = 0x5424 TIOCGEXCL = 0x80045440 TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x80285442 TIOCGLCKTRMIOS = 0x5456 TIOCGPGRP = 0x540f TIOCGPKT = 0x80045438 @@ -2411,7 +2145,6 @@ const ( TIOCSER_TEMT = 0x1 TIOCSETD = 0x5423 TIOCSIG = 0x40045436 - TIOCSISO7816 = 0xc0285443 TIOCSLCKTRMIOS = 0x5457 TIOCSPGRP = 0x5410 TIOCSPTLCK = 0x40045431 @@ -2452,7 +2185,6 @@ const ( TUNGETVNETBE = 0x800454df TUNGETVNETHDRSZ = 0x800454d7 TUNGETVNETLE = 0x800454dd - TUNSETCARRIER = 0x400454e2 TUNSETDEBUG = 0x400454c9 TUNSETFILTEREBPF = 0x800454e1 TUNSETGROUP = 0x400454ce @@ -2480,10 +2212,8 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 - UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 - UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2623,29 +2353,7 @@ const ( XATTR_CREATE = 0x1 XATTR_REPLACE = 0x2 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 XTABS = 0x1800 ZSMALLOC_MAGIC = 0x58295829 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 58067c52..7fdc85b1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -1,2643 +1,1792 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -// Code generated by the command above; see README.md. DO NOT EDIT. +// mkerrors.sh -m64 +// Code generated by the command above; DO NOT EDIT. // +build sparc64,linux -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs -- -m64 _const.go package unix import "syscall" const ( - AAFS_MAGIC = 0x5a3c69f0 - ADFS_SUPER_MAGIC = 0xadf5 - AFFS_SUPER_MAGIC = 0xadff - AFS_FS_MAGIC = 0x6b414653 - AFS_SUPER_MAGIC = 0x5346414f - AF_ALG = 0x26 - AF_APPLETALK = 0x5 - AF_ASH = 0x12 - AF_ATMPVC = 0x8 - AF_ATMSVC = 0x14 - AF_AX25 = 0x3 - AF_BLUETOOTH = 0x1f - AF_BRIDGE = 0x7 - AF_CAIF = 0x25 - AF_CAN = 0x1d - AF_DECnet = 0xc - AF_ECONET = 0x13 - AF_FILE = 0x1 - AF_IB = 0x1b - AF_IEEE802154 = 0x24 - AF_INET = 0x2 - AF_INET6 = 0xa - AF_IPX = 0x4 - AF_IRDA = 0x17 - AF_ISDN = 0x22 - AF_IUCV = 0x20 - AF_KCM = 0x29 - AF_KEY = 0xf - AF_LLC = 0x1a - AF_LOCAL = 0x1 - AF_MAX = 0x2d - AF_MPLS = 0x1c - AF_NETBEUI = 0xd - AF_NETLINK = 0x10 - AF_NETROM = 0x6 - AF_NFC = 0x27 - AF_PACKET = 0x11 - AF_PHONET = 0x23 - AF_PPPOX = 0x18 - AF_QIPCRTR = 0x2a - AF_RDS = 0x15 - AF_ROSE = 0xb - AF_ROUTE = 0x10 - AF_RXRPC = 0x21 - AF_SECURITY = 0xe - AF_SMC = 0x2b - AF_SNA = 0x16 - AF_TIPC = 0x1e - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_VSOCK = 0x28 - AF_WANPIPE = 0x19 - AF_X25 = 0x9 - AF_XDP = 0x2c - ALG_OP_DECRYPT = 0x0 - ALG_OP_ENCRYPT = 0x1 - ALG_SET_AEAD_ASSOCLEN = 0x4 - ALG_SET_AEAD_AUTHSIZE = 0x5 - ALG_SET_IV = 0x2 - ALG_SET_KEY = 0x1 - ALG_SET_OP = 0x3 - ANON_INODE_FS_MAGIC = 0x9041934 - ARPHRD_6LOWPAN = 0x339 - ARPHRD_ADAPT = 0x108 - ARPHRD_APPLETLK = 0x8 - ARPHRD_ARCNET = 0x7 - ARPHRD_ASH = 0x30d - ARPHRD_ATM = 0x13 - ARPHRD_AX25 = 0x3 - ARPHRD_BIF = 0x307 - ARPHRD_CAIF = 0x336 - ARPHRD_CAN = 0x118 - ARPHRD_CHAOS = 0x5 - ARPHRD_CISCO = 0x201 - ARPHRD_CSLIP = 0x101 - ARPHRD_CSLIP6 = 0x103 - ARPHRD_DDCMP = 0x205 - ARPHRD_DLCI = 0xf - ARPHRD_ECONET = 0x30e - ARPHRD_EETHER = 0x2 - ARPHRD_ETHER = 0x1 - ARPHRD_EUI64 = 0x1b - ARPHRD_FCAL = 0x311 - ARPHRD_FCFABRIC = 0x313 - ARPHRD_FCPL = 0x312 - ARPHRD_FCPP = 0x310 - ARPHRD_FDDI = 0x306 - ARPHRD_FRAD = 0x302 - ARPHRD_HDLC = 0x201 - ARPHRD_HIPPI = 0x30c - ARPHRD_HWX25 = 0x110 - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - ARPHRD_IEEE80211 = 0x321 - ARPHRD_IEEE80211_PRISM = 0x322 - ARPHRD_IEEE80211_RADIOTAP = 0x323 - ARPHRD_IEEE802154 = 0x324 - ARPHRD_IEEE802154_MONITOR = 0x325 - ARPHRD_IEEE802_TR = 0x320 - ARPHRD_INFINIBAND = 0x20 - ARPHRD_IP6GRE = 0x337 - ARPHRD_IPDDP = 0x309 - ARPHRD_IPGRE = 0x30a - ARPHRD_IRDA = 0x30f - ARPHRD_LAPB = 0x204 - ARPHRD_LOCALTLK = 0x305 - ARPHRD_LOOPBACK = 0x304 - ARPHRD_METRICOM = 0x17 - ARPHRD_NETLINK = 0x338 - ARPHRD_NETROM = 0x0 - ARPHRD_NONE = 0xfffe - ARPHRD_PHONET = 0x334 - ARPHRD_PHONET_PIPE = 0x335 - ARPHRD_PIMREG = 0x30b - ARPHRD_PPP = 0x200 - ARPHRD_PRONET = 0x4 - ARPHRD_RAWHDLC = 0x206 - ARPHRD_RAWIP = 0x207 - ARPHRD_ROSE = 0x10e - ARPHRD_RSRVD = 0x104 - ARPHRD_SIT = 0x308 - ARPHRD_SKIP = 0x303 - ARPHRD_SLIP = 0x100 - ARPHRD_SLIP6 = 0x102 - ARPHRD_TUNNEL = 0x300 - ARPHRD_TUNNEL6 = 0x301 - ARPHRD_VOID = 0xffff - ARPHRD_VSOCKMON = 0x33a - ARPHRD_X25 = 0x10f - ASI_LEON_DFLUSH = 0x11 - ASI_LEON_IFLUSH = 0x10 - ASI_LEON_MMUFLUSH = 0x18 - AUTOFS_SUPER_MAGIC = 0x187 - B0 = 0x0 - B1000000 = 0x1008 - B110 = 0x3 - B115200 = 0x1002 - B1152000 = 0x1009 - B1200 = 0x9 - B134 = 0x4 - B150 = 0x5 - B1500000 = 0x100a - B1800 = 0xa - B19200 = 0xe - B200 = 0x6 - B2000000 = 0x100b - B230400 = 0x1003 - B2400 = 0xb - B2500000 = 0x100c - B300 = 0x7 - B3000000 = 0x100d - B3500000 = 0x100e - B38400 = 0xf - B4000000 = 0x100f - B460800 = 0x1004 - B4800 = 0xc - B50 = 0x1 - B500000 = 0x1005 - B57600 = 0x1001 - B576000 = 0x1006 - B600 = 0x8 - B75 = 0x2 - B921600 = 0x1007 - B9600 = 0xd - BALLOON_KVM_MAGIC = 0x13661366 - BDEVFS_MAGIC = 0x62646576 - BINDERFS_SUPER_MAGIC = 0x6c6f6f70 - BINFMTFS_MAGIC = 0x42494e4d - BLKBSZGET = 0x40081270 - BLKBSZSET = 0x80081271 - BLKFLSBUF = 0x20001261 - BLKFRAGET = 0x20001265 - BLKFRASET = 0x20001264 - BLKGETSIZE = 0x20001260 - BLKGETSIZE64 = 0x40081272 - BLKPBSZGET = 0x2000127b - BLKRAGET = 0x20001263 - BLKRASET = 0x20001262 - BLKROGET = 0x2000125e - BLKROSET = 0x2000125d - BLKRRPART = 0x2000125f - BLKSECTGET = 0x20001267 - BLKSECTSET = 0x20001266 - BLKSSZGET = 0x20001268 - BOTHER = 0x1000 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALU = 0x4 - BPF_ALU64 = 0x7 - BPF_AND = 0x50 - BPF_ANY = 0x0 - BPF_ARSH = 0xc0 - BPF_B = 0x10 - BPF_BUILD_ID_SIZE = 0x14 - BPF_CALL = 0x80 - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 - BPF_DIV = 0x30 - BPF_DW = 0x18 - BPF_END = 0xd0 - BPF_EXIST = 0x2 - BPF_EXIT = 0x90 - BPF_FROM_BE = 0x8 - BPF_FROM_LE = 0x0 - BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ALLOW_MULTI = 0x2 - BPF_F_ALLOW_OVERRIDE = 0x1 - BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_INGRESS = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NUMA_NODE = 0x4 - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_QUERY_EFFECTIVE = 0x1 - BPF_F_RDONLY = 0x8 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_USER_STACK = 0x100 - BPF_F_WRONLY = 0x10 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_ZERO_SEED = 0x40 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JLE = 0xb0 - BPF_JLT = 0xa0 - BPF_JMP = 0x5 - BPF_JMP32 = 0x6 - BPF_JNE = 0x50 - BPF_JSET = 0x40 - BPF_JSGE = 0x70 - BPF_JSGT = 0x60 - BPF_JSLE = 0xd0 - BPF_JSLT = 0xc0 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LL_OFF = -0x200000 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXINSNS = 0x1000 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MOD = 0x90 - BPF_MOV = 0xb0 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_NET_OFF = -0x100000 - BPF_NOEXIST = 0x1 - BPF_OBJ_NAME_LEN = 0x10 - BPF_OR = 0x40 - BPF_PSEUDO_CALL = 0x1 - BPF_PSEUDO_MAP_FD = 0x1 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAG_SIZE = 0x8 - BPF_TAX = 0x0 - BPF_TO_BE = 0x8 - BPF_TO_LE = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BPF_XADD = 0xc0 - BPF_XOR = 0xa0 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x2000 - BSDLY = 0x2000 - BTRFS_SUPER_MAGIC = 0x9123683e - BTRFS_TEST_MAGIC = 0x73727279 - CAN_BCM = 0x2 - CAN_EFF_FLAG = 0x80000000 - CAN_EFF_ID_BITS = 0x1d - CAN_EFF_MASK = 0x1fffffff - CAN_ERR_FLAG = 0x20000000 - CAN_ERR_MASK = 0x1fffffff - CAN_INV_FILTER = 0x20000000 - CAN_ISOTP = 0x6 - CAN_MAX_DLC = 0x8 - CAN_MAX_DLEN = 0x8 - CAN_MCNET = 0x5 - CAN_MTU = 0x10 - CAN_NPROTO = 0x7 - CAN_RAW = 0x1 - CAN_RAW_FILTER_MAX = 0x200 - CAN_RTR_FLAG = 0x40000000 - CAN_SFF_ID_BITS = 0xb - CAN_SFF_MASK = 0x7ff - CAN_TP16 = 0x3 - CAN_TP20 = 0x4 - CBAUD = 0x100f - CBAUDEX = 0x1000 - CFLUSH = 0xf - CGROUP2_SUPER_MAGIC = 0x63677270 - CGROUP_SUPER_MAGIC = 0x27e0eb - CIBAUD = 0x100f0000 - CLOCAL = 0x800 - CLOCK_BOOTTIME = 0x7 - CLOCK_BOOTTIME_ALARM = 0x9 - CLOCK_DEFAULT = 0x0 - CLOCK_EXT = 0x1 - CLOCK_INT = 0x2 - CLOCK_MONOTONIC = 0x1 - CLOCK_MONOTONIC_COARSE = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_REALTIME_ALARM = 0x8 - CLOCK_REALTIME_COARSE = 0x5 - CLOCK_TAI = 0xb - CLOCK_THREAD_CPUTIME_ID = 0x3 - CLOCK_TXFROMRX = 0x4 - CLOCK_TXINT = 0x3 - CLONE_CHILD_CLEARTID = 0x200000 - CLONE_CHILD_SETTID = 0x1000000 - CLONE_DETACHED = 0x400000 - CLONE_FILES = 0x400 - CLONE_FS = 0x200 - CLONE_IO = 0x80000000 - CLONE_NEWCGROUP = 0x2000000 - CLONE_NEWIPC = 0x8000000 - CLONE_NEWNET = 0x40000000 - CLONE_NEWNS = 0x20000 - CLONE_NEWPID = 0x20000000 - CLONE_NEWUSER = 0x10000000 - CLONE_NEWUTS = 0x4000000 - CLONE_PARENT = 0x8000 - CLONE_PARENT_SETTID = 0x100000 - CLONE_PTRACE = 0x2000 - CLONE_SETTLS = 0x80000 - CLONE_SIGHAND = 0x800 - CLONE_SYSVSEM = 0x40000 - CLONE_THREAD = 0x10000 - CLONE_UNTRACED = 0x800000 - CLONE_VFORK = 0x4000 - CLONE_VM = 0x100 - CMSPAR = 0x40000000 - CODA_SUPER_MAGIC = 0x73757245 - CR0 = 0x0 - CR1 = 0x200 - CR2 = 0x400 - CR3 = 0x600 - CRAMFS_MAGIC = 0x28cd3d45 - CRDLY = 0x600 - CREAD = 0x80 - CRTSCTS = 0x80000000 - CRYPTO_MAX_NAME = 0x40 - CRYPTO_MSG_MAX = 0x15 - CRYPTO_NR_MSGTYPES = 0x6 - CRYPTO_REPORT_MAXSIZE = 0x160 - CS5 = 0x0 - CS6 = 0x10 - CS7 = 0x20 - CS8 = 0x30 - CSIGNAL = 0xff - CSIZE = 0x30 - CSTART = 0x11 - CSTATUS = 0x0 - CSTOP = 0x13 - CSTOPB = 0x40 - CSUSP = 0x1a - DAXFS_MAGIC = 0x64646178 - DEBUGFS_MAGIC = 0x64626720 - DEVPTS_SUPER_MAGIC = 0x1cd1 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x200 - ECHOE = 0x10 - ECHOK = 0x20 - ECHOKE = 0x800 - ECHONL = 0x40 - ECHOPRT = 0x400 - ECRYPTFS_SUPER_MAGIC = 0xf15f - EFD_CLOEXEC = 0x400000 - EFD_NONBLOCK = 0x4000 - EFD_SEMAPHORE = 0x1 - EFIVARFS_MAGIC = 0xde5e81e4 - EFS_SUPER_MAGIC = 0x414a53 - EMT_TAGOVF = 0x1 - ENCODING_DEFAULT = 0x0 - ENCODING_FM_MARK = 0x3 - ENCODING_FM_SPACE = 0x4 - ENCODING_MANCHESTER = 0x5 - ENCODING_NRZ = 0x1 - ENCODING_NRZI = 0x2 - EPOLLERR = 0x8 - EPOLLET = 0x80000000 - EPOLLEXCLUSIVE = 0x10000000 - EPOLLHUP = 0x10 - EPOLLIN = 0x1 - EPOLLMSG = 0x400 - EPOLLONESHOT = 0x40000000 - EPOLLOUT = 0x4 - EPOLLPRI = 0x2 - EPOLLRDBAND = 0x80 - EPOLLRDHUP = 0x2000 - EPOLLRDNORM = 0x40 - EPOLLWAKEUP = 0x20000000 - EPOLLWRBAND = 0x200 - EPOLLWRNORM = 0x100 - EPOLL_CLOEXEC = 0x400000 - EPOLL_CTL_ADD = 0x1 - EPOLL_CTL_DEL = 0x2 - EPOLL_CTL_MOD = 0x3 - ETH_P_1588 = 0x88f7 - ETH_P_8021AD = 0x88a8 - ETH_P_8021AH = 0x88e7 - ETH_P_8021Q = 0x8100 - ETH_P_80221 = 0x8917 - ETH_P_802_2 = 0x4 - ETH_P_802_3 = 0x1 - ETH_P_802_3_MIN = 0x600 - ETH_P_802_EX1 = 0x88b5 - ETH_P_AARP = 0x80f3 - ETH_P_AF_IUCV = 0xfbfb - ETH_P_ALL = 0x3 - ETH_P_AOE = 0x88a2 - ETH_P_ARCNET = 0x1a - ETH_P_ARP = 0x806 - ETH_P_ATALK = 0x809b - ETH_P_ATMFATE = 0x8884 - ETH_P_ATMMPOA = 0x884c - ETH_P_AX25 = 0x2 - ETH_P_BATMAN = 0x4305 - ETH_P_BPQ = 0x8ff - ETH_P_CAIF = 0xf7 - ETH_P_CAN = 0xc - ETH_P_CANFD = 0xd - ETH_P_CONTROL = 0x16 - ETH_P_CUST = 0x6006 - ETH_P_DDCMP = 0x6 - ETH_P_DEC = 0x6000 - ETH_P_DIAG = 0x6005 - ETH_P_DNA_DL = 0x6001 - ETH_P_DNA_RC = 0x6002 - ETH_P_DNA_RT = 0x6003 - ETH_P_DSA = 0x1b - ETH_P_ECONET = 0x18 - ETH_P_EDSA = 0xdada - ETH_P_ERSPAN = 0x88be - ETH_P_ERSPAN2 = 0x22eb - ETH_P_FCOE = 0x8906 - ETH_P_FIP = 0x8914 - ETH_P_HDLC = 0x19 - ETH_P_HSR = 0x892f - ETH_P_IBOE = 0x8915 - ETH_P_IEEE802154 = 0xf6 - ETH_P_IEEEPUP = 0xa00 - ETH_P_IEEEPUPAT = 0xa01 - ETH_P_IFE = 0xed3e - ETH_P_IP = 0x800 - ETH_P_IPV6 = 0x86dd - ETH_P_IPX = 0x8137 - ETH_P_IRDA = 0x17 - ETH_P_LAT = 0x6004 - ETH_P_LINK_CTL = 0x886c - ETH_P_LOCALTALK = 0x9 - ETH_P_LOOP = 0x60 - ETH_P_LOOPBACK = 0x9000 - ETH_P_MACSEC = 0x88e5 - ETH_P_MAP = 0xf9 - ETH_P_MOBITEX = 0x15 - ETH_P_MPLS_MC = 0x8848 - ETH_P_MPLS_UC = 0x8847 - ETH_P_MVRP = 0x88f5 - ETH_P_NCSI = 0x88f8 - ETH_P_NSH = 0x894f - ETH_P_PAE = 0x888e - ETH_P_PAUSE = 0x8808 - ETH_P_PHONET = 0xf5 - ETH_P_PPPTALK = 0x10 - ETH_P_PPP_DISC = 0x8863 - ETH_P_PPP_MP = 0x8 - ETH_P_PPP_SES = 0x8864 - ETH_P_PREAUTH = 0x88c7 - ETH_P_PRP = 0x88fb - ETH_P_PUP = 0x200 - ETH_P_PUPAT = 0x201 - ETH_P_QINQ1 = 0x9100 - ETH_P_QINQ2 = 0x9200 - ETH_P_QINQ3 = 0x9300 - ETH_P_RARP = 0x8035 - ETH_P_SCA = 0x6007 - ETH_P_SLOW = 0x8809 - ETH_P_SNAP = 0x5 - ETH_P_TDLS = 0x890d - ETH_P_TEB = 0x6558 - ETH_P_TIPC = 0x88ca - ETH_P_TRAILER = 0x1c - ETH_P_TR_802_2 = 0x11 - ETH_P_TSN = 0x22f0 - ETH_P_WAN_PPP = 0x7 - ETH_P_WCCP = 0x883e - ETH_P_X25 = 0x805 - ETH_P_XDSA = 0xf8 - EXABYTE_ENABLE_NEST = 0xf0 - EXT2_SUPER_MAGIC = 0xef53 - EXT3_SUPER_MAGIC = 0xef53 - EXT4_SUPER_MAGIC = 0xef53 - EXTA = 0xe - EXTB = 0xf - EXTPROC = 0x10000 - F2FS_SUPER_MAGIC = 0xf2f52010 - FALLOC_FL_COLLAPSE_RANGE = 0x8 - FALLOC_FL_INSERT_RANGE = 0x20 - FALLOC_FL_KEEP_SIZE = 0x1 - FALLOC_FL_NO_HIDE_STALE = 0x4 - FALLOC_FL_PUNCH_HOLE = 0x2 - FALLOC_FL_UNSHARE_RANGE = 0x40 - FALLOC_FL_ZERO_RANGE = 0x10 - FANOTIFY_METADATA_VERSION = 0x3 - FAN_ACCESS = 0x1 - FAN_ACCESS_PERM = 0x20000 - FAN_ALLOW = 0x1 - FAN_ALL_CLASS_BITS = 0xc - FAN_ALL_EVENTS = 0x3b - FAN_ALL_INIT_FLAGS = 0x3f - FAN_ALL_MARK_FLAGS = 0xff - FAN_ALL_OUTGOING_EVENTS = 0x3403b - FAN_ALL_PERM_EVENTS = 0x30000 - FAN_ATTRIB = 0x4 - FAN_AUDIT = 0x10 - FAN_CLASS_CONTENT = 0x4 - FAN_CLASS_NOTIF = 0x0 - FAN_CLASS_PRE_CONTENT = 0x8 - FAN_CLOEXEC = 0x1 - FAN_CLOSE = 0x18 - FAN_CLOSE_NOWRITE = 0x10 - FAN_CLOSE_WRITE = 0x8 - FAN_CREATE = 0x100 - FAN_DELETE = 0x200 - FAN_DELETE_SELF = 0x400 - FAN_DENY = 0x2 - FAN_ENABLE_AUDIT = 0x40 - FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_METADATA_LEN = 0x18 - FAN_EVENT_ON_CHILD = 0x8000000 - FAN_MARK_ADD = 0x1 - FAN_MARK_DONT_FOLLOW = 0x4 - FAN_MARK_FILESYSTEM = 0x100 - FAN_MARK_FLUSH = 0x80 - FAN_MARK_IGNORED_MASK = 0x20 - FAN_MARK_IGNORED_SURV_MODIFY = 0x40 - FAN_MARK_INODE = 0x0 - FAN_MARK_MOUNT = 0x10 - FAN_MARK_ONLYDIR = 0x8 - FAN_MARK_REMOVE = 0x2 - FAN_MODIFY = 0x2 - FAN_MOVE = 0xc0 - FAN_MOVED_FROM = 0x40 - FAN_MOVED_TO = 0x80 - FAN_MOVE_SELF = 0x800 - FAN_NOFD = -0x1 - FAN_NONBLOCK = 0x2 - FAN_ONDIR = 0x40000000 - FAN_OPEN = 0x20 - FAN_OPEN_EXEC = 0x1000 - FAN_OPEN_EXEC_PERM = 0x40000 - FAN_OPEN_PERM = 0x10000 - FAN_Q_OVERFLOW = 0x4000 - FAN_REPORT_FID = 0x200 - FAN_REPORT_TID = 0x100 - FAN_UNLIMITED_MARKS = 0x20 - FAN_UNLIMITED_QUEUE = 0x10 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x8000 - FFDLY = 0x8000 - FLUSHO = 0x1000 - FS_ENCRYPTION_MODE_ADIANTUM = 0x9 - FS_ENCRYPTION_MODE_AES_128_CBC = 0x5 - FS_ENCRYPTION_MODE_AES_128_CTS = 0x6 - FS_ENCRYPTION_MODE_AES_256_CBC = 0x3 - FS_ENCRYPTION_MODE_AES_256_CTS = 0x4 - FS_ENCRYPTION_MODE_AES_256_GCM = 0x2 - FS_ENCRYPTION_MODE_AES_256_XTS = 0x1 - FS_ENCRYPTION_MODE_INVALID = 0x0 - FS_ENCRYPTION_MODE_SPECK128_256_CTS = 0x8 - FS_ENCRYPTION_MODE_SPECK128_256_XTS = 0x7 - FS_IOC_GET_ENCRYPTION_POLICY = 0x800c6615 - FS_IOC_GET_ENCRYPTION_PWSALT = 0x80106614 - FS_IOC_SET_ENCRYPTION_POLICY = 0x400c6613 - FS_KEY_DESCRIPTOR_SIZE = 0x8 - FS_KEY_DESC_PREFIX = "fscrypt:" - FS_KEY_DESC_PREFIX_SIZE = 0x8 - FS_MAX_KEY_SIZE = 0x40 - FS_POLICY_FLAGS_PAD_16 = 0x2 - FS_POLICY_FLAGS_PAD_32 = 0x3 - FS_POLICY_FLAGS_PAD_4 = 0x0 - FS_POLICY_FLAGS_PAD_8 = 0x1 - FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x7 - FUTEXFS_SUPER_MAGIC = 0xbad1dea - F_ADD_SEALS = 0x409 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x406 - F_EXLCK = 0x4 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLEASE = 0x401 - F_GETLK = 0x7 - F_GETLK64 = 0x7 - F_GETOWN = 0x5 - F_GETOWN_EX = 0x10 - F_GETPIPE_SZ = 0x408 - F_GETSIG = 0xb - F_GET_FILE_RW_HINT = 0x40d - F_GET_RW_HINT = 0x40b - F_GET_SEALS = 0x40a - F_LOCK = 0x1 - F_NOTIFY = 0x402 - F_OFD_GETLK = 0x24 - F_OFD_SETLK = 0x25 - F_OFD_SETLKW = 0x26 - F_OK = 0x0 - F_RDLCK = 0x1 - F_SEAL_GROW = 0x4 - F_SEAL_SEAL = 0x1 - F_SEAL_SHRINK = 0x2 - F_SEAL_WRITE = 0x8 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLEASE = 0x400 - F_SETLK = 0x8 - F_SETLK64 = 0x8 - F_SETLKW = 0x9 - F_SETLKW64 = 0x9 - F_SETOWN = 0x6 - F_SETOWN_EX = 0xf - F_SETPIPE_SZ = 0x407 - F_SETSIG = 0xa - F_SET_FILE_RW_HINT = 0x40e - F_SET_RW_HINT = 0x40c - F_SHLCK = 0x8 - F_TEST = 0x3 - F_TLOCK = 0x2 - F_ULOCK = 0x0 - F_UNLCK = 0x3 - F_WRLCK = 0x2 - GENL_ADMIN_PERM = 0x1 - GENL_CMD_CAP_DO = 0x2 - GENL_CMD_CAP_DUMP = 0x4 - GENL_CMD_CAP_HASPOL = 0x8 - GENL_HDRLEN = 0x4 - GENL_ID_CTRL = 0x10 - GENL_ID_PMCRAID = 0x12 - GENL_ID_VFS_DQUOT = 0x11 - GENL_MAX_ID = 0x3ff - GENL_MIN_ID = 0x10 - GENL_NAMSIZ = 0x10 - GENL_START_ALLOC = 0x13 - GENL_UNS_ADMIN_PERM = 0x10 - GRND_NONBLOCK = 0x1 - GRND_RANDOM = 0x2 - HDIO_DRIVE_CMD = 0x31f - HDIO_DRIVE_CMD_AEB = 0x31e - HDIO_DRIVE_CMD_HDR_SIZE = 0x4 - HDIO_DRIVE_HOB_HDR_SIZE = 0x8 - HDIO_DRIVE_RESET = 0x31c - HDIO_DRIVE_TASK = 0x31e - HDIO_DRIVE_TASKFILE = 0x31d - HDIO_DRIVE_TASK_HDR_SIZE = 0x8 - HDIO_GETGEO = 0x301 - HDIO_GET_32BIT = 0x309 - HDIO_GET_ACOUSTIC = 0x30f - HDIO_GET_ADDRESS = 0x310 - HDIO_GET_BUSSTATE = 0x31a - HDIO_GET_DMA = 0x30b - HDIO_GET_IDENTITY = 0x30d - HDIO_GET_KEEPSETTINGS = 0x308 - HDIO_GET_MULTCOUNT = 0x304 - HDIO_GET_NICE = 0x30c - HDIO_GET_NOWERR = 0x30a - HDIO_GET_QDMA = 0x305 - HDIO_GET_UNMASKINTR = 0x302 - HDIO_GET_WCACHE = 0x30e - HDIO_OBSOLETE_IDENTITY = 0x307 - HDIO_SCAN_HWIF = 0x328 - HDIO_SET_32BIT = 0x324 - HDIO_SET_ACOUSTIC = 0x32c - HDIO_SET_ADDRESS = 0x32f - HDIO_SET_BUSSTATE = 0x32d - HDIO_SET_DMA = 0x326 - HDIO_SET_KEEPSETTINGS = 0x323 - HDIO_SET_MULTCOUNT = 0x321 - HDIO_SET_NICE = 0x329 - HDIO_SET_NOWERR = 0x325 - HDIO_SET_PIO_MODE = 0x327 - HDIO_SET_QDMA = 0x32e - HDIO_SET_UNMASKINTR = 0x322 - HDIO_SET_WCACHE = 0x32b - HDIO_SET_XFER = 0x306 - HDIO_TRISTATE_HWIF = 0x31b - HDIO_UNREGISTER_HWIF = 0x32a - HOSTFS_SUPER_MAGIC = 0xc0ffee - HPFS_SUPER_MAGIC = 0xf995e849 - HUGETLBFS_MAGIC = 0x958458f6 - HUPCL = 0x400 - IBSHIFT = 0x10 - ICANON = 0x2 - ICMPV6_FILTER = 0x1 - ICRNL = 0x100 - IEXTEN = 0x8000 - IFA_F_DADFAILED = 0x8 - IFA_F_DEPRECATED = 0x20 - IFA_F_HOMEADDRESS = 0x10 - IFA_F_MANAGETEMPADDR = 0x100 - IFA_F_MCAUTOJOIN = 0x400 - IFA_F_NODAD = 0x2 - IFA_F_NOPREFIXROUTE = 0x200 - IFA_F_OPTIMISTIC = 0x4 - IFA_F_PERMANENT = 0x80 - IFA_F_SECONDARY = 0x1 - IFA_F_STABLE_PRIVACY = 0x800 - IFA_F_TEMPORARY = 0x1 - IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa - IFF_ALLMULTI = 0x200 - IFF_ATTACH_QUEUE = 0x200 - IFF_AUTOMEDIA = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_DETACH_QUEUE = 0x400 - IFF_DORMANT = 0x20000 - IFF_DYNAMIC = 0x8000 - IFF_ECHO = 0x40000 - IFF_LOOPBACK = 0x8 - IFF_LOWER_UP = 0x10000 - IFF_MASTER = 0x400 - IFF_MULTICAST = 0x1000 - IFF_MULTI_QUEUE = 0x100 - IFF_NAPI = 0x10 - IFF_NAPI_FRAGS = 0x20 - IFF_NOARP = 0x80 - IFF_NOFILTER = 0x1000 - IFF_NOTRAILERS = 0x20 - IFF_NO_PI = 0x1000 - IFF_ONE_QUEUE = 0x2000 - IFF_PERSIST = 0x800 - IFF_POINTOPOINT = 0x10 - IFF_PORTSEL = 0x2000 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SLAVE = 0x800 - IFF_TAP = 0x2 - IFF_TUN = 0x1 - IFF_TUN_EXCL = 0x8000 - IFF_UP = 0x1 - IFF_VNET_HDR = 0x4000 - IFF_VOLATILE = 0x70c5a - IFNAMSIZ = 0x10 - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_ACCESS = 0x1 - IN_ALL_EVENTS = 0xfff - IN_ATTRIB = 0x4 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLOEXEC = 0x400000 - IN_CLOSE = 0x18 - IN_CLOSE_NOWRITE = 0x10 - IN_CLOSE_WRITE = 0x8 - IN_CREATE = 0x100 - IN_DELETE = 0x200 - IN_DELETE_SELF = 0x400 - IN_DONT_FOLLOW = 0x2000000 - IN_EXCL_UNLINK = 0x4000000 - IN_IGNORED = 0x8000 - IN_ISDIR = 0x40000000 - IN_LOOPBACKNET = 0x7f - IN_MASK_ADD = 0x20000000 - IN_MASK_CREATE = 0x10000000 - IN_MODIFY = 0x2 - IN_MOVE = 0xc0 - IN_MOVED_FROM = 0x40 - IN_MOVED_TO = 0x80 - IN_MOVE_SELF = 0x800 - IN_NONBLOCK = 0x4000 - IN_ONESHOT = 0x80000000 - IN_ONLYDIR = 0x1000000 - IN_OPEN = 0x20 - IN_Q_OVERFLOW = 0x4000 - IN_UNMOUNT = 0x2000 - IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 - IPPROTO_AH = 0x33 - IPPROTO_BEETPH = 0x5e - IPPROTO_COMP = 0x6c - IPPROTO_DCCP = 0x21 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_ESP = 0x32 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPIP = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_MH = 0x87 - IPPROTO_MPLS = 0x89 - IPPROTO_MTP = 0x5c - IPPROTO_NONE = 0x3b - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_SCTP = 0x84 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPPROTO_UDPLITE = 0x88 - IPV6_2292DSTOPTS = 0x4 - IPV6_2292HOPLIMIT = 0x8 - IPV6_2292HOPOPTS = 0x3 - IPV6_2292PKTINFO = 0x2 - IPV6_2292PKTOPTIONS = 0x6 - IPV6_2292RTHDR = 0x5 - IPV6_ADDRFORM = 0x1 - IPV6_ADDR_PREFERENCES = 0x48 - IPV6_ADD_MEMBERSHIP = 0x14 - IPV6_AUTHHDR = 0xa - IPV6_AUTOFLOWLABEL = 0x46 - IPV6_CHECKSUM = 0x7 - IPV6_DONTFRAG = 0x3e - IPV6_DROP_MEMBERSHIP = 0x15 - IPV6_DSTOPTS = 0x3b - IPV6_FREEBIND = 0x4e - IPV6_HDRINCL = 0x24 - IPV6_HOPLIMIT = 0x34 - IPV6_HOPOPTS = 0x36 - IPV6_IPSEC_POLICY = 0x22 - IPV6_JOIN_ANYCAST = 0x1b - IPV6_JOIN_GROUP = 0x14 - IPV6_LEAVE_ANYCAST = 0x1c - IPV6_LEAVE_GROUP = 0x15 - IPV6_MINHOPCOUNT = 0x49 - IPV6_MTU = 0x18 - IPV6_MTU_DISCOVER = 0x17 - IPV6_MULTICAST_ALL = 0x1d - IPV6_MULTICAST_HOPS = 0x12 - IPV6_MULTICAST_IF = 0x11 - IPV6_MULTICAST_LOOP = 0x13 - IPV6_NEXTHOP = 0x9 - IPV6_ORIGDSTADDR = 0x4a - IPV6_PATHMTU = 0x3d - IPV6_PKTINFO = 0x32 - IPV6_PMTUDISC_DO = 0x2 - IPV6_PMTUDISC_DONT = 0x0 - IPV6_PMTUDISC_INTERFACE = 0x4 - IPV6_PMTUDISC_OMIT = 0x5 - IPV6_PMTUDISC_PROBE = 0x3 - IPV6_PMTUDISC_WANT = 0x1 - IPV6_RECVDSTOPTS = 0x3a - IPV6_RECVERR = 0x19 - IPV6_RECVFRAGSIZE = 0x4d - IPV6_RECVHOPLIMIT = 0x33 - IPV6_RECVHOPOPTS = 0x35 - IPV6_RECVORIGDSTADDR = 0x4a - IPV6_RECVPATHMTU = 0x3c - IPV6_RECVPKTINFO = 0x31 - IPV6_RECVRTHDR = 0x38 - IPV6_RECVTCLASS = 0x42 - IPV6_ROUTER_ALERT = 0x16 - IPV6_RTHDR = 0x39 - IPV6_RTHDRDSTOPTS = 0x37 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_RXDSTOPTS = 0x3b - IPV6_RXHOPOPTS = 0x36 - IPV6_TCLASS = 0x43 - IPV6_TRANSPARENT = 0x4b - IPV6_UNICAST_HOPS = 0x10 - IPV6_UNICAST_IF = 0x4c - IPV6_V6ONLY = 0x1a - IPV6_XFRM_POLICY = 0x23 - IP_ADD_MEMBERSHIP = 0x23 - IP_ADD_SOURCE_MEMBERSHIP = 0x27 - IP_BIND_ADDRESS_NO_PORT = 0x18 - IP_BLOCK_SOURCE = 0x26 - IP_CHECKSUM = 0x17 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0x24 - IP_DROP_SOURCE_MEMBERSHIP = 0x28 - IP_FREEBIND = 0xf - IP_HDRINCL = 0x3 - IP_IPSEC_POLICY = 0x10 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0x14 - IP_MF = 0x2000 - IP_MINTTL = 0x15 - IP_MSFILTER = 0x29 - IP_MSS = 0x240 - IP_MTU = 0xe - IP_MTU_DISCOVER = 0xa - IP_MULTICAST_ALL = 0x31 - IP_MULTICAST_IF = 0x20 - IP_MULTICAST_LOOP = 0x22 - IP_MULTICAST_TTL = 0x21 - IP_NODEFRAG = 0x16 - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x4 - IP_ORIGDSTADDR = 0x14 - IP_PASSSEC = 0x12 - IP_PKTINFO = 0x8 - IP_PKTOPTIONS = 0x9 - IP_PMTUDISC = 0xa - IP_PMTUDISC_DO = 0x2 - IP_PMTUDISC_DONT = 0x0 - IP_PMTUDISC_INTERFACE = 0x4 - IP_PMTUDISC_OMIT = 0x5 - IP_PMTUDISC_PROBE = 0x3 - IP_PMTUDISC_WANT = 0x1 - IP_RECVERR = 0xb - IP_RECVFRAGSIZE = 0x19 - IP_RECVOPTS = 0x6 - IP_RECVORIGDSTADDR = 0x14 - IP_RECVRETOPTS = 0x7 - IP_RECVTOS = 0xd - IP_RECVTTL = 0xc - IP_RETOPTS = 0x7 - IP_RF = 0x8000 - IP_ROUTER_ALERT = 0x5 - IP_TOS = 0x1 - IP_TRANSPARENT = 0x13 - IP_TTL = 0x2 - IP_UNBLOCK_SOURCE = 0x25 - IP_UNICAST_IF = 0x32 - IP_XFRM_POLICY = 0x11 - ISIG = 0x1 - ISOFS_SUPER_MAGIC = 0x9660 - ISTRIP = 0x20 - IUCLC = 0x200 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x1000 - IXON = 0x400 - 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_CHOWN = 0x4 - KEYCTL_CLEAR = 0x7 - KEYCTL_DESCRIBE = 0x6 - KEYCTL_DH_COMPUTE = 0x17 - KEYCTL_GET_KEYRING_ID = 0x0 - KEYCTL_GET_PERSISTENT = 0x16 - KEYCTL_GET_SECURITY = 0x11 - KEYCTL_INSTANTIATE = 0xc - KEYCTL_INSTANTIATE_IOV = 0x14 - KEYCTL_INVALIDATE = 0x15 - KEYCTL_JOIN_SESSION_KEYRING = 0x1 - KEYCTL_LINK = 0x8 - KEYCTL_NEGATE = 0xd - KEYCTL_PKEY_DECRYPT = 0x1a - KEYCTL_PKEY_ENCRYPT = 0x19 - KEYCTL_PKEY_QUERY = 0x18 - KEYCTL_PKEY_SIGN = 0x1b - KEYCTL_PKEY_VERIFY = 0x1c - KEYCTL_READ = 0xb - KEYCTL_REJECT = 0x13 - KEYCTL_RESTRICT_KEYRING = 0x1d - KEYCTL_REVOKE = 0x3 - KEYCTL_SEARCH = 0xa - KEYCTL_SESSION_TO_PARENT = 0x12 - KEYCTL_SETPERM = 0x5 - KEYCTL_SET_REQKEY_KEYRING = 0xe - KEYCTL_SET_TIMEOUT = 0xf - KEYCTL_SUPPORTS_DECRYPT = 0x2 - KEYCTL_SUPPORTS_ENCRYPT = 0x1 - KEYCTL_SUPPORTS_SIGN = 0x4 - KEYCTL_SUPPORTS_VERIFY = 0x8 - KEYCTL_UNLINK = 0x9 - KEYCTL_UPDATE = 0x2 - KEY_REQKEY_DEFL_DEFAULT = 0x0 - KEY_REQKEY_DEFL_GROUP_KEYRING = 0x6 - KEY_REQKEY_DEFL_NO_CHANGE = -0x1 - KEY_REQKEY_DEFL_PROCESS_KEYRING = 0x2 - KEY_REQKEY_DEFL_REQUESTOR_KEYRING = 0x7 - KEY_REQKEY_DEFL_SESSION_KEYRING = 0x3 - KEY_REQKEY_DEFL_THREAD_KEYRING = 0x1 - KEY_REQKEY_DEFL_USER_KEYRING = 0x4 - KEY_REQKEY_DEFL_USER_SESSION_KEYRING = 0x5 - KEY_SPEC_GROUP_KEYRING = -0x6 - KEY_SPEC_PROCESS_KEYRING = -0x2 - KEY_SPEC_REQKEY_AUTH_KEY = -0x7 - KEY_SPEC_REQUESTOR_KEYRING = -0x8 - KEY_SPEC_SESSION_KEYRING = -0x3 - KEY_SPEC_THREAD_KEYRING = -0x1 - KEY_SPEC_USER_KEYRING = -0x4 - KEY_SPEC_USER_SESSION_KEYRING = -0x5 - LINUX_REBOOT_CMD_CAD_OFF = 0x0 - LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef - LINUX_REBOOT_CMD_HALT = 0xcdef0123 - LINUX_REBOOT_CMD_KEXEC = 0x45584543 - LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc - LINUX_REBOOT_CMD_RESTART = 0x1234567 - LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 - LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 - LINUX_REBOOT_MAGIC1 = 0xfee1dead - LINUX_REBOOT_MAGIC2 = 0x28121969 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DODUMP = 0x11 - MADV_DOFORK = 0xb - MADV_DONTDUMP = 0x10 - MADV_DONTFORK = 0xa - MADV_DONTNEED = 0x4 - MADV_FREE = 0x8 - MADV_HUGEPAGE = 0xe - MADV_HWPOISON = 0x64 - MADV_KEEPONFORK = 0x13 - MADV_MERGEABLE = 0xc - MADV_NOHUGEPAGE = 0xf - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_REMOVE = 0x9 - MADV_SEQUENTIAL = 0x2 - MADV_UNMERGEABLE = 0xd - MADV_WILLNEED = 0x3 - MADV_WIPEONFORK = 0x12 - MAP_ANON = 0x20 - MAP_ANONYMOUS = 0x20 - MAP_DENYWRITE = 0x800 - MAP_EXECUTABLE = 0x1000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_FIXED_NOREPLACE = 0x100000 - MAP_GROWSDOWN = 0x200 - MAP_HUGETLB = 0x40000 - MAP_HUGE_MASK = 0x3f - MAP_HUGE_SHIFT = 0x1a - MAP_LOCKED = 0x100 - MAP_NONBLOCK = 0x10000 - MAP_NORESERVE = 0x40 - MAP_POPULATE = 0x8000 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_SHARED = 0x1 - MAP_SHARED_VALIDATE = 0x3 - MAP_STACK = 0x20000 - MAP_TYPE = 0xf - MCAST_BLOCK_SOURCE = 0x2b - MCAST_EXCLUDE = 0x0 - MCAST_INCLUDE = 0x1 - MCAST_JOIN_GROUP = 0x2a - MCAST_JOIN_SOURCE_GROUP = 0x2e - MCAST_LEAVE_GROUP = 0x2d - MCAST_LEAVE_SOURCE_GROUP = 0x2f - MCAST_MSFILTER = 0x30 - MCAST_UNBLOCK_SOURCE = 0x2c - MCL_CURRENT = 0x2000 - MCL_FUTURE = 0x4000 - 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_32MB = 0x64000000 - MFD_HUGE_512KB = 0x4c000000 - MFD_HUGE_512MB = 0x74000000 - MFD_HUGE_64KB = 0x40000000 - MFD_HUGE_8MB = 0x5c000000 - MFD_HUGE_MASK = 0x3f - MFD_HUGE_SHIFT = 0x1a - MINIX2_SUPER_MAGIC = 0x2468 - MINIX2_SUPER_MAGIC2 = 0x2478 - MINIX3_SUPER_MAGIC = 0x4d5a - MINIX_SUPER_MAGIC = 0x137f - MINIX_SUPER_MAGIC2 = 0x138f - MNT_DETACH = 0x2 - MNT_EXPIRE = 0x4 - MNT_FORCE = 0x1 - MODULE_INIT_IGNORE_MODVERSIONS = 0x1 - MODULE_INIT_IGNORE_VERMAGIC = 0x2 - MSDOS_SUPER_MAGIC = 0x4d44 - MSG_BATCH = 0x40000 - MSG_CMSG_CLOEXEC = 0x40000000 - MSG_CONFIRM = 0x800 - MSG_CTRUNC = 0x8 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x40 - MSG_EOR = 0x80 - MSG_ERRQUEUE = 0x2000 - MSG_FASTOPEN = 0x20000000 - MSG_FIN = 0x200 - MSG_MORE = 0x8000 - MSG_NOSIGNAL = 0x4000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_PROXY = 0x10 - MSG_RST = 0x1000 - MSG_SYN = 0x400 - MSG_TRUNC = 0x20 - MSG_TRYHARD = 0x4 - MSG_WAITALL = 0x100 - MSG_WAITFORONE = 0x10000 - MSG_ZEROCOPY = 0x4000000 - MS_ACTIVE = 0x40000000 - MS_ASYNC = 0x1 - MS_BIND = 0x1000 - MS_BORN = 0x20000000 - MS_DIRSYNC = 0x80 - MS_INVALIDATE = 0x2 - MS_I_VERSION = 0x800000 - MS_KERNMOUNT = 0x400000 - MS_LAZYTIME = 0x2000000 - MS_MANDLOCK = 0x40 - MS_MGC_MSK = 0xffff0000 - MS_MGC_VAL = 0xc0ed0000 - MS_MOVE = 0x2000 - MS_NOATIME = 0x400 - MS_NODEV = 0x4 - MS_NODIRATIME = 0x800 - MS_NOEXEC = 0x8 - MS_NOREMOTELOCK = 0x8000000 - MS_NOSEC = 0x10000000 - MS_NOSUID = 0x2 - MS_NOUSER = -0x80000000 - MS_POSIXACL = 0x10000 - MS_PRIVATE = 0x40000 - MS_RDONLY = 0x1 - MS_REC = 0x4000 - MS_RELATIME = 0x200000 - MS_REMOUNT = 0x20 - MS_RMT_MASK = 0x2800051 - MS_SHARED = 0x100000 - MS_SILENT = 0x8000 - MS_SLAVE = 0x80000 - MS_STRICTATIME = 0x1000000 - MS_SUBMOUNT = 0x4000000 - MS_SYNC = 0x4 - MS_SYNCHRONOUS = 0x10 - MS_UNBINDABLE = 0x20000 - MS_VERBOSE = 0x8000 - MTD_INODE_FS_MAGIC = 0x11307854 - NAME_MAX = 0xff - NCP_SUPER_MAGIC = 0x564c - NETLINK_ADD_MEMBERSHIP = 0x1 - NETLINK_AUDIT = 0x9 - NETLINK_BROADCAST_ERROR = 0x4 - NETLINK_CAP_ACK = 0xa - NETLINK_CONNECTOR = 0xb - NETLINK_CRYPTO = 0x15 - NETLINK_DNRTMSG = 0xe - NETLINK_DROP_MEMBERSHIP = 0x2 - NETLINK_ECRYPTFS = 0x13 - NETLINK_EXT_ACK = 0xb - NETLINK_FIB_LOOKUP = 0xa - NETLINK_FIREWALL = 0x3 - NETLINK_GENERIC = 0x10 - NETLINK_GET_STRICT_CHK = 0xc - NETLINK_INET_DIAG = 0x4 - NETLINK_IP6_FW = 0xd - NETLINK_ISCSI = 0x8 - NETLINK_KOBJECT_UEVENT = 0xf - NETLINK_LISTEN_ALL_NSID = 0x8 - NETLINK_LIST_MEMBERSHIPS = 0x9 - NETLINK_NETFILTER = 0xc - NETLINK_NFLOG = 0x5 - NETLINK_NO_ENOBUFS = 0x5 - NETLINK_PKTINFO = 0x3 - NETLINK_RDMA = 0x14 - NETLINK_ROUTE = 0x0 - NETLINK_RX_RING = 0x6 - NETLINK_SCSITRANSPORT = 0x12 - NETLINK_SELINUX = 0x7 - NETLINK_SMC = 0x16 - NETLINK_SOCK_DIAG = 0x4 - NETLINK_TX_RING = 0x7 - NETLINK_UNUSED = 0x1 - NETLINK_USERSOCK = 0x2 - NETLINK_XFRM = 0x6 - NETNSA_MAX = 0x5 - NETNSA_NSID_NOT_ASSIGNED = -0x1 - NFNETLINK_V0 = 0x0 - NFNLGRP_ACCT_QUOTA = 0x8 - NFNLGRP_CONNTRACK_DESTROY = 0x3 - NFNLGRP_CONNTRACK_EXP_DESTROY = 0x6 - NFNLGRP_CONNTRACK_EXP_NEW = 0x4 - NFNLGRP_CONNTRACK_EXP_UPDATE = 0x5 - NFNLGRP_CONNTRACK_NEW = 0x1 - NFNLGRP_CONNTRACK_UPDATE = 0x2 - NFNLGRP_MAX = 0x9 - NFNLGRP_NFTABLES = 0x7 - NFNLGRP_NFTRACE = 0x9 - NFNLGRP_NONE = 0x0 - NFNL_BATCH_MAX = 0x1 - NFNL_MSG_BATCH_BEGIN = 0x10 - NFNL_MSG_BATCH_END = 0x11 - NFNL_NFA_NEST = 0x8000 - NFNL_SUBSYS_ACCT = 0x7 - NFNL_SUBSYS_COUNT = 0xc - NFNL_SUBSYS_CTHELPER = 0x9 - NFNL_SUBSYS_CTNETLINK = 0x1 - NFNL_SUBSYS_CTNETLINK_EXP = 0x2 - NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8 - NFNL_SUBSYS_IPSET = 0x6 - NFNL_SUBSYS_NFTABLES = 0xa - NFNL_SUBSYS_NFT_COMPAT = 0xb - NFNL_SUBSYS_NONE = 0x0 - NFNL_SUBSYS_OSF = 0x5 - NFNL_SUBSYS_QUEUE = 0x3 - NFNL_SUBSYS_ULOG = 0x4 - NFS_SUPER_MAGIC = 0x6969 - NILFS_SUPER_MAGIC = 0x3434 - NL0 = 0x0 - NL1 = 0x100 - NLA_ALIGNTO = 0x4 - NLA_F_NESTED = 0x8000 - NLA_F_NET_BYTEORDER = 0x4000 - NLA_HDRLEN = 0x4 - NLDLY = 0x100 - NLMSG_ALIGNTO = 0x4 - NLMSG_DONE = 0x3 - NLMSG_ERROR = 0x2 - NLMSG_HDRLEN = 0x10 - NLMSG_MIN_TYPE = 0x10 - NLMSG_NOOP = 0x1 - NLMSG_OVERRUN = 0x4 - NLM_F_ACK = 0x4 - NLM_F_ACK_TLVS = 0x200 - NLM_F_APPEND = 0x800 - NLM_F_ATOMIC = 0x400 - NLM_F_CAPPED = 0x100 - NLM_F_CREATE = 0x400 - NLM_F_DUMP = 0x300 - NLM_F_DUMP_FILTERED = 0x20 - NLM_F_DUMP_INTR = 0x10 - NLM_F_ECHO = 0x8 - NLM_F_EXCL = 0x200 - NLM_F_MATCH = 0x200 - NLM_F_MULTI = 0x2 - NLM_F_NONREC = 0x100 - NLM_F_REPLACE = 0x100 - NLM_F_REQUEST = 0x1 - NLM_F_ROOT = 0x100 - NOFLSH = 0x80 - NSFS_MAGIC = 0x6e736673 - OCFS2_SUPER_MAGIC = 0x7461636f - OCRNL = 0x8 - OFDEL = 0x80 - OFILL = 0x40 - OLCUC = 0x2 - ONLCR = 0x4 - ONLRET = 0x20 - ONOCR = 0x10 - OPENPROM_SUPER_MAGIC = 0x9fa1 - OPOST = 0x1 - OVERLAYFS_SUPER_MAGIC = 0x794c7630 - O_ACCMODE = 0x3 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x400000 - O_CREAT = 0x200 - O_DIRECT = 0x100000 - O_DIRECTORY = 0x10000 - O_DSYNC = 0x2000 - O_EXCL = 0x800 - O_FSYNC = 0x802000 - O_LARGEFILE = 0x0 - O_NDELAY = 0x4004 - O_NOATIME = 0x200000 - O_NOCTTY = 0x8000 - O_NOFOLLOW = 0x20000 - O_NONBLOCK = 0x4000 - O_PATH = 0x1000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x802000 - O_SYNC = 0x802000 - O_TMPFILE = 0x2010000 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PACKET_ADD_MEMBERSHIP = 0x1 - PACKET_AUXDATA = 0x8 - PACKET_BROADCAST = 0x1 - PACKET_COPY_THRESH = 0x7 - PACKET_DROP_MEMBERSHIP = 0x2 - PACKET_FANOUT = 0x12 - PACKET_FANOUT_CBPF = 0x6 - PACKET_FANOUT_CPU = 0x2 - PACKET_FANOUT_DATA = 0x16 - PACKET_FANOUT_EBPF = 0x7 - PACKET_FANOUT_FLAG_DEFRAG = 0x8000 - PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 - PACKET_FANOUT_FLAG_UNIQUEID = 0x2000 - PACKET_FANOUT_HASH = 0x0 - PACKET_FANOUT_LB = 0x1 - PACKET_FANOUT_QM = 0x5 - PACKET_FANOUT_RND = 0x4 - PACKET_FANOUT_ROLLOVER = 0x3 - PACKET_FASTROUTE = 0x6 - PACKET_HDRLEN = 0xb - PACKET_HOST = 0x0 - PACKET_IGNORE_OUTGOING = 0x17 - PACKET_KERNEL = 0x7 - PACKET_LOOPBACK = 0x5 - PACKET_LOSS = 0xe - PACKET_MR_ALLMULTI = 0x2 - PACKET_MR_MULTICAST = 0x0 - PACKET_MR_PROMISC = 0x1 - PACKET_MR_UNICAST = 0x3 - PACKET_MULTICAST = 0x2 - PACKET_ORIGDEV = 0x9 - PACKET_OTHERHOST = 0x3 - PACKET_OUTGOING = 0x4 - PACKET_QDISC_BYPASS = 0x14 - PACKET_RECV_OUTPUT = 0x3 - PACKET_RESERVE = 0xc - PACKET_ROLLOVER_STATS = 0x15 - PACKET_RX_RING = 0x5 - PACKET_STATISTICS = 0x6 - PACKET_TIMESTAMP = 0x11 - PACKET_TX_HAS_OFF = 0x13 - PACKET_TX_RING = 0xd - PACKET_TX_TIMESTAMP = 0x10 - PACKET_USER = 0x6 - PACKET_VERSION = 0xa - PACKET_VNET_HDR = 0xf - PARENB = 0x100 - PARITY_CRC16_PR0 = 0x2 - PARITY_CRC16_PR0_CCITT = 0x4 - PARITY_CRC16_PR1 = 0x3 - PARITY_CRC16_PR1_CCITT = 0x5 - PARITY_CRC32_PR0_CCITT = 0x6 - PARITY_CRC32_PR1_CCITT = 0x7 - PARITY_DEFAULT = 0x0 - PARITY_NONE = 0x1 - PARMRK = 0x8 - PARODD = 0x200 - PENDIN = 0x4000 - PERF_EVENT_IOC_DISABLE = 0x20002401 - PERF_EVENT_IOC_ENABLE = 0x20002400 - PERF_EVENT_IOC_ID = 0x40082407 - PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b - PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 - PERF_EVENT_IOC_PERIOD = 0x80082404 - PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - PERF_EVENT_IOC_REFRESH = 0x20002402 - PERF_EVENT_IOC_RESET = 0x20002403 - PERF_EVENT_IOC_SET_BPF = 0x80042408 - PERF_EVENT_IOC_SET_FILTER = 0x80082406 - PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 - PIPEFS_MAGIC = 0x50495045 - PPPIOCATTACH = 0x8004743d - PPPIOCATTCHAN = 0x80047438 - PPPIOCCONNECT = 0x8004743a - PPPIOCDETACH = 0x8004743c - PPPIOCDISCONN = 0x20007439 - PPPIOCGASYNCMAP = 0x40047458 - PPPIOCGCHAN = 0x40047437 - PPPIOCGDEBUG = 0x40047441 - PPPIOCGFLAGS = 0x4004745a - PPPIOCGIDLE = 0x4010743f - PPPIOCGL2TPSTATS = 0x40487436 - PPPIOCGMRU = 0x40047453 - PPPIOCGNPMODE = 0xc008744c - PPPIOCGRASYNCMAP = 0x40047455 - PPPIOCGUNIT = 0x40047456 - PPPIOCGXASYNCMAP = 0x40207450 - PPPIOCNEWUNIT = 0xc004743e - PPPIOCSACTIVE = 0x80107446 - PPPIOCSASYNCMAP = 0x80047457 - PPPIOCSCOMPRESS = 0x8010744d - PPPIOCSDEBUG = 0x80047440 - PPPIOCSFLAGS = 0x80047459 - PPPIOCSMAXCID = 0x80047451 - PPPIOCSMRRU = 0x8004743b - PPPIOCSMRU = 0x80047452 - PPPIOCSNPMODE = 0x8008744b - PPPIOCSPASS = 0x80107447 - PPPIOCSRASYNCMAP = 0x80047454 - PPPIOCSXASYNCMAP = 0x8020744f - PPPIOCXFERUNIT = 0x2000744e - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROC_SUPER_MAGIC = 0x9fa0 - PROT_EXEC = 0x4 - PROT_GROWSDOWN = 0x1000000 - PROT_GROWSUP = 0x2000000 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PR_CAPBSET_DROP = 0x18 - PR_CAPBSET_READ = 0x17 - PR_CAP_AMBIENT = 0x2f - PR_CAP_AMBIENT_CLEAR_ALL = 0x4 - PR_CAP_AMBIENT_IS_SET = 0x1 - PR_CAP_AMBIENT_LOWER = 0x3 - PR_CAP_AMBIENT_RAISE = 0x2 - PR_ENDIAN_BIG = 0x0 - PR_ENDIAN_LITTLE = 0x1 - PR_ENDIAN_PPC_LITTLE = 0x2 - PR_FPEMU_NOPRINT = 0x1 - PR_FPEMU_SIGFPE = 0x2 - PR_FP_EXC_ASYNC = 0x2 - PR_FP_EXC_DISABLED = 0x0 - PR_FP_EXC_DIV = 0x10000 - PR_FP_EXC_INV = 0x100000 - PR_FP_EXC_NONRECOV = 0x1 - PR_FP_EXC_OVF = 0x20000 - PR_FP_EXC_PRECISE = 0x3 - PR_FP_EXC_RES = 0x80000 - PR_FP_EXC_SW_ENABLE = 0x80 - PR_FP_EXC_UND = 0x40000 - PR_FP_MODE_FR = 0x1 - PR_FP_MODE_FRE = 0x2 - PR_GET_CHILD_SUBREAPER = 0x25 - PR_GET_DUMPABLE = 0x3 - PR_GET_ENDIAN = 0x13 - PR_GET_FPEMU = 0x9 - PR_GET_FPEXC = 0xb - PR_GET_FP_MODE = 0x2e - PR_GET_KEEPCAPS = 0x7 - PR_GET_NAME = 0x10 - PR_GET_NO_NEW_PRIVS = 0x27 - PR_GET_PDEATHSIG = 0x2 - PR_GET_SECCOMP = 0x15 - PR_GET_SECUREBITS = 0x1b - PR_GET_SPECULATION_CTRL = 0x34 - PR_GET_THP_DISABLE = 0x2a - PR_GET_TID_ADDRESS = 0x28 - PR_GET_TIMERSLACK = 0x1e - PR_GET_TIMING = 0xd - PR_GET_TSC = 0x19 - PR_GET_UNALIGN = 0x5 - PR_MCE_KILL = 0x21 - PR_MCE_KILL_CLEAR = 0x0 - PR_MCE_KILL_DEFAULT = 0x2 - PR_MCE_KILL_EARLY = 0x1 - PR_MCE_KILL_GET = 0x22 - PR_MCE_KILL_LATE = 0x0 - PR_MCE_KILL_SET = 0x1 - PR_MPX_DISABLE_MANAGEMENT = 0x2c - PR_MPX_ENABLE_MANAGEMENT = 0x2b - PR_PAC_APDAKEY = 0x4 - PR_PAC_APDBKEY = 0x8 - PR_PAC_APGAKEY = 0x10 - PR_PAC_APIAKEY = 0x1 - PR_PAC_APIBKEY = 0x2 - PR_PAC_RESET_KEYS = 0x36 - PR_SET_CHILD_SUBREAPER = 0x24 - PR_SET_DUMPABLE = 0x4 - PR_SET_ENDIAN = 0x14 - PR_SET_FPEMU = 0xa - PR_SET_FPEXC = 0xc - PR_SET_FP_MODE = 0x2d - PR_SET_KEEPCAPS = 0x8 - PR_SET_MM = 0x23 - PR_SET_MM_ARG_END = 0x9 - PR_SET_MM_ARG_START = 0x8 - PR_SET_MM_AUXV = 0xc - PR_SET_MM_BRK = 0x7 - PR_SET_MM_END_CODE = 0x2 - PR_SET_MM_END_DATA = 0x4 - PR_SET_MM_ENV_END = 0xb - PR_SET_MM_ENV_START = 0xa - PR_SET_MM_EXE_FILE = 0xd - PR_SET_MM_MAP = 0xe - PR_SET_MM_MAP_SIZE = 0xf - PR_SET_MM_START_BRK = 0x6 - PR_SET_MM_START_CODE = 0x1 - PR_SET_MM_START_DATA = 0x3 - PR_SET_MM_START_STACK = 0x5 - PR_SET_NAME = 0xf - PR_SET_NO_NEW_PRIVS = 0x26 - PR_SET_PDEATHSIG = 0x1 - PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = 0xffffffffffffffff - PR_SET_SECCOMP = 0x16 - PR_SET_SECUREBITS = 0x1c - PR_SET_SPECULATION_CTRL = 0x35 - PR_SET_THP_DISABLE = 0x29 - PR_SET_TIMERSLACK = 0x1d - PR_SET_TIMING = 0xe - PR_SET_TSC = 0x1a - PR_SET_UNALIGN = 0x6 - PR_SPEC_DISABLE = 0x4 - PR_SPEC_DISABLE_NOEXEC = 0x10 - PR_SPEC_ENABLE = 0x2 - PR_SPEC_FORCE_DISABLE = 0x8 - PR_SPEC_INDIRECT_BRANCH = 0x1 - PR_SPEC_NOT_AFFECTED = 0x0 - PR_SPEC_PRCTL = 0x1 - PR_SPEC_STORE_BYPASS = 0x0 - PR_SVE_GET_VL = 0x33 - PR_SVE_SET_VL = 0x32 - PR_SVE_SET_VL_ONEXEC = 0x40000 - PR_SVE_VL_INHERIT = 0x20000 - PR_SVE_VL_LEN_MASK = 0xffff - PR_TASK_PERF_EVENTS_DISABLE = 0x1f - PR_TASK_PERF_EVENTS_ENABLE = 0x20 - PR_TIMING_STATISTICAL = 0x0 - PR_TIMING_TIMESTAMP = 0x1 - PR_TSC_ENABLE = 0x1 - PR_TSC_SIGSEGV = 0x2 - PR_UNALIGN_NOPRINT = 0x1 - PR_UNALIGN_SIGBUS = 0x2 - PSTOREFS_MAGIC = 0x6165676c - PTRACE_ATTACH = 0x10 - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0x11 - PTRACE_EVENT_CLONE = 0x3 - PTRACE_EVENT_EXEC = 0x4 - PTRACE_EVENT_EXIT = 0x6 - PTRACE_EVENT_FORK = 0x1 - PTRACE_EVENT_SECCOMP = 0x7 - PTRACE_EVENT_STOP = 0x80 - PTRACE_EVENT_VFORK = 0x2 - PTRACE_EVENT_VFORK_DONE = 0x5 - PTRACE_GETEVENTMSG = 0x4201 - PTRACE_GETFPAREGS = 0x14 - PTRACE_GETFPREGS = 0xe - PTRACE_GETFPREGS64 = 0x19 - PTRACE_GETREGS = 0xc - PTRACE_GETREGS64 = 0x16 - PTRACE_GETREGSET = 0x4204 - PTRACE_GETSIGINFO = 0x4202 - PTRACE_GETSIGMASK = 0x420a - PTRACE_INTERRUPT = 0x4207 - PTRACE_KILL = 0x8 - PTRACE_LISTEN = 0x4208 - PTRACE_O_EXITKILL = 0x100000 - PTRACE_O_MASK = 0x3000ff - PTRACE_O_SUSPEND_SECCOMP = 0x200000 - PTRACE_O_TRACECLONE = 0x8 - PTRACE_O_TRACEEXEC = 0x10 - PTRACE_O_TRACEEXIT = 0x40 - PTRACE_O_TRACEFORK = 0x2 - PTRACE_O_TRACESECCOMP = 0x80 - PTRACE_O_TRACESYSGOOD = 0x1 - PTRACE_O_TRACEVFORK = 0x4 - PTRACE_O_TRACEVFORKDONE = 0x20 - PTRACE_PEEKDATA = 0x2 - PTRACE_PEEKSIGINFO = 0x4209 - PTRACE_PEEKSIGINFO_SHARED = 0x1 - PTRACE_PEEKTEXT = 0x1 - PTRACE_PEEKUSR = 0x3 - PTRACE_POKEDATA = 0x5 - PTRACE_POKETEXT = 0x4 - PTRACE_POKEUSR = 0x6 - PTRACE_READDATA = 0x10 - PTRACE_READTEXT = 0x12 - PTRACE_SECCOMP_GET_FILTER = 0x420c - PTRACE_SECCOMP_GET_METADATA = 0x420d - PTRACE_SEIZE = 0x4206 - PTRACE_SETFPAREGS = 0x15 - PTRACE_SETFPREGS = 0xf - PTRACE_SETFPREGS64 = 0x1a - PTRACE_SETOPTIONS = 0x4200 - PTRACE_SETREGS = 0xd - PTRACE_SETREGS64 = 0x17 - PTRACE_SETREGSET = 0x4205 - PTRACE_SETSIGINFO = 0x4203 - PTRACE_SETSIGMASK = 0x420b - PTRACE_SINGLESTEP = 0x9 - PTRACE_SPARC_DETACH = 0xb - PTRACE_SYSCALL = 0x18 - PTRACE_TRACEME = 0x0 - PTRACE_WRITEDATA = 0x11 - PTRACE_WRITETEXT = 0x13 - PT_FP = 0x48 - PT_G0 = 0x10 - PT_G1 = 0x14 - PT_G2 = 0x18 - PT_G3 = 0x1c - PT_G4 = 0x20 - PT_G5 = 0x24 - PT_G6 = 0x28 - PT_G7 = 0x2c - PT_I0 = 0x30 - PT_I1 = 0x34 - PT_I2 = 0x38 - PT_I3 = 0x3c - PT_I4 = 0x40 - PT_I5 = 0x44 - PT_I6 = 0x48 - PT_I7 = 0x4c - PT_NPC = 0x8 - PT_PC = 0x4 - PT_PSR = 0x0 - PT_REGS_MAGIC = 0x57ac6c00 - PT_TNPC = 0x90 - PT_TPC = 0x88 - PT_TSTATE = 0x80 - PT_V9_FP = 0x70 - PT_V9_G0 = 0x0 - PT_V9_G1 = 0x8 - PT_V9_G2 = 0x10 - PT_V9_G3 = 0x18 - PT_V9_G4 = 0x20 - PT_V9_G5 = 0x28 - PT_V9_G6 = 0x30 - PT_V9_G7 = 0x38 - PT_V9_I0 = 0x40 - PT_V9_I1 = 0x48 - PT_V9_I2 = 0x50 - PT_V9_I3 = 0x58 - PT_V9_I4 = 0x60 - PT_V9_I5 = 0x68 - PT_V9_I6 = 0x70 - PT_V9_I7 = 0x78 - PT_V9_MAGIC = 0x9c - PT_V9_TNPC = 0x90 - PT_V9_TPC = 0x88 - PT_V9_TSTATE = 0x80 - PT_V9_Y = 0x98 - PT_WIM = 0x10 - PT_Y = 0xc - QNX4_SUPER_MAGIC = 0x2f - QNX6_SUPER_MAGIC = 0x68191122 - RAMFS_MAGIC = 0x858458f6 - RDTGROUP_SUPER_MAGIC = 0x7655821 - REISERFS_SUPER_MAGIC = 0x52654973 - RENAME_EXCHANGE = 0x2 - RENAME_NOREPLACE = 0x1 - RENAME_WHITEOUT = 0x4 - RLIMIT_AS = 0x9 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_LOCKS = 0xa - RLIMIT_MEMLOCK = 0x8 - RLIMIT_MSGQUEUE = 0xc - RLIMIT_NICE = 0xd - RLIMIT_NOFILE = 0x6 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_RTPRIO = 0xe - RLIMIT_RTTIME = 0xf - RLIMIT_SIGPENDING = 0xb - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0xffffffffffffffff - RNDADDENTROPY = 0x80085203 - RNDADDTOENTCNT = 0x80045201 - RNDCLEARPOOL = 0x20005206 - RNDGETENTCNT = 0x40045200 - RNDGETPOOL = 0x40085202 - RNDRESEEDCRNG = 0x20005207 - RNDZAPENTCNT = 0x20005204 - RTAX_ADVMSS = 0x8 - RTAX_CC_ALGO = 0x10 - RTAX_CWND = 0x7 - RTAX_FASTOPEN_NO_COOKIE = 0x11 - RTAX_FEATURES = 0xc - RTAX_FEATURE_ALLFRAG = 0x8 - RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_MASK = 0xf - RTAX_FEATURE_SACK = 0x2 - RTAX_FEATURE_TIMESTAMP = 0x4 - RTAX_HOPLIMIT = 0xa - RTAX_INITCWND = 0xb - RTAX_INITRWND = 0xe - RTAX_LOCK = 0x1 - RTAX_MAX = 0x11 - RTAX_MTU = 0x2 - RTAX_QUICKACK = 0xf - RTAX_REORDERING = 0x9 - RTAX_RTO_MIN = 0xd - RTAX_RTT = 0x4 - RTAX_RTTVAR = 0x5 - RTAX_SSTHRESH = 0x6 - RTAX_UNSPEC = 0x0 - RTAX_WINDOW = 0x3 - RTA_ALIGNTO = 0x4 - RTA_MAX = 0x1d - RTCF_DIRECTSRC = 0x4000000 - RTCF_DOREDIRECT = 0x1000000 - RTCF_LOG = 0x2000000 - RTCF_MASQ = 0x400000 - RTCF_NAT = 0x800000 - RTCF_VALVE = 0x200000 - RTC_AF = 0x20 - RTC_AIE_OFF = 0x20007002 - RTC_AIE_ON = 0x20007001 - RTC_ALM_READ = 0x40247008 - RTC_ALM_SET = 0x80247007 - RTC_EPOCH_READ = 0x4008700d - RTC_EPOCH_SET = 0x8008700e - RTC_IRQF = 0x80 - RTC_IRQP_READ = 0x4008700b - RTC_IRQP_SET = 0x8008700c - RTC_MAX_FREQ = 0x2000 - RTC_PF = 0x40 - RTC_PIE_OFF = 0x20007006 - RTC_PIE_ON = 0x20007005 - RTC_PLL_GET = 0x40207011 - RTC_PLL_SET = 0x80207012 - RTC_RD_TIME = 0x40247009 - RTC_SET_TIME = 0x8024700a - RTC_UF = 0x10 - RTC_UIE_OFF = 0x20007004 - RTC_UIE_ON = 0x20007003 - RTC_VL_CLR = 0x20007014 - RTC_VL_READ = 0x40047013 - RTC_WIE_OFF = 0x20007010 - RTC_WIE_ON = 0x2000700f - RTC_WKALM_RD = 0x40287010 - RTC_WKALM_SET = 0x8028700f - RTF_ADDRCLASSMASK = 0xf8000000 - RTF_ADDRCONF = 0x40000 - RTF_ALLONLINK = 0x20000 - RTF_BROADCAST = 0x10000000 - RTF_CACHE = 0x1000000 - RTF_DEFAULT = 0x10000 - RTF_DYNAMIC = 0x10 - RTF_FLOW = 0x2000000 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_INTERFACE = 0x40000000 - RTF_IRTT = 0x100 - RTF_LINKRT = 0x100000 - RTF_LOCAL = 0x80000000 - RTF_MODIFIED = 0x20 - RTF_MSS = 0x40 - RTF_MTU = 0x40 - RTF_MULTICAST = 0x20000000 - RTF_NAT = 0x8000000 - RTF_NOFORWARD = 0x1000 - RTF_NONEXTHOP = 0x200000 - RTF_NOPMTUDISC = 0x4000 - RTF_POLICY = 0x4000000 - RTF_REINSTATE = 0x8 - RTF_REJECT = 0x200 - RTF_STATIC = 0x400 - RTF_THROW = 0x2000 - RTF_UP = 0x1 - RTF_WINDOW = 0x80 - RTF_XRESOLVE = 0x800 - RTM_BASE = 0x10 - RTM_DELACTION = 0x31 - RTM_DELADDR = 0x15 - RTM_DELADDRLABEL = 0x49 - RTM_DELCHAIN = 0x65 - RTM_DELLINK = 0x11 - RTM_DELMDB = 0x55 - RTM_DELNEIGH = 0x1d - RTM_DELNETCONF = 0x51 - RTM_DELNSID = 0x59 - RTM_DELQDISC = 0x25 - RTM_DELROUTE = 0x19 - RTM_DELRULE = 0x21 - RTM_DELTCLASS = 0x29 - RTM_DELTFILTER = 0x2d - RTM_F_CLONED = 0x200 - RTM_F_EQUALIZE = 0x400 - RTM_F_FIB_MATCH = 0x2000 - RTM_F_LOOKUP_TABLE = 0x1000 - RTM_F_NOTIFY = 0x100 - RTM_F_PREFIX = 0x800 - RTM_GETACTION = 0x32 - RTM_GETADDR = 0x16 - RTM_GETADDRLABEL = 0x4a - RTM_GETANYCAST = 0x3e - RTM_GETCHAIN = 0x66 - RTM_GETDCB = 0x4e - RTM_GETLINK = 0x12 - RTM_GETMDB = 0x56 - RTM_GETMULTICAST = 0x3a - RTM_GETNEIGH = 0x1e - RTM_GETNEIGHTBL = 0x42 - RTM_GETNETCONF = 0x52 - RTM_GETNSID = 0x5a - RTM_GETQDISC = 0x26 - RTM_GETROUTE = 0x1a - RTM_GETRULE = 0x22 - RTM_GETSTATS = 0x5e - RTM_GETTCLASS = 0x2a - RTM_GETTFILTER = 0x2e - RTM_MAX = 0x67 - RTM_NEWACTION = 0x30 - RTM_NEWADDR = 0x14 - RTM_NEWADDRLABEL = 0x48 - RTM_NEWCACHEREPORT = 0x60 - RTM_NEWCHAIN = 0x64 - RTM_NEWLINK = 0x10 - RTM_NEWMDB = 0x54 - RTM_NEWNDUSEROPT = 0x44 - RTM_NEWNEIGH = 0x1c - RTM_NEWNEIGHTBL = 0x40 - RTM_NEWNETCONF = 0x50 - RTM_NEWNSID = 0x58 - RTM_NEWPREFIX = 0x34 - RTM_NEWQDISC = 0x24 - RTM_NEWROUTE = 0x18 - RTM_NEWRULE = 0x20 - RTM_NEWSTATS = 0x5c - RTM_NEWTCLASS = 0x28 - RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x16 - RTM_NR_MSGTYPES = 0x58 - RTM_SETDCB = 0x4f - RTM_SETLINK = 0x13 - RTM_SETNEIGHTBL = 0x43 - RTNH_ALIGNTO = 0x4 - RTNH_COMPARE_MASK = 0x19 - RTNH_F_DEAD = 0x1 - RTNH_F_LINKDOWN = 0x10 - RTNH_F_OFFLOAD = 0x8 - RTNH_F_ONLINK = 0x4 - RTNH_F_PERVASIVE = 0x2 - RTNH_F_UNRESOLVED = 0x20 - RTN_MAX = 0xb - RTPROT_BABEL = 0x2a - RTPROT_BGP = 0xba - RTPROT_BIRD = 0xc - RTPROT_BOOT = 0x3 - RTPROT_DHCP = 0x10 - RTPROT_DNROUTED = 0xd - RTPROT_EIGRP = 0xc0 - RTPROT_GATED = 0x8 - RTPROT_ISIS = 0xbb - RTPROT_KERNEL = 0x2 - RTPROT_MROUTED = 0x11 - RTPROT_MRT = 0xa - RTPROT_NTK = 0xf - RTPROT_OSPF = 0xbc - RTPROT_RA = 0x9 - RTPROT_REDIRECT = 0x1 - RTPROT_RIP = 0xbd - RTPROT_STATIC = 0x4 - RTPROT_UNSPEC = 0x0 - RTPROT_XORP = 0xe - RTPROT_ZEBRA = 0xb - RT_CLASS_DEFAULT = 0xfd - RT_CLASS_LOCAL = 0xff - RT_CLASS_MAIN = 0xfe - RT_CLASS_MAX = 0xff - RT_CLASS_UNSPEC = 0x0 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_CREDENTIALS = 0x2 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x1d - SCM_TIMESTAMPING = 0x23 - SCM_TIMESTAMPING_OPT_STATS = 0x38 - SCM_TIMESTAMPING_PKTINFO = 0x3c - SCM_TIMESTAMPNS = 0x21 - SCM_TXTIME = 0x3f - SCM_WIFI_STATUS = 0x25 - SC_LOG_FLUSH = 0x100000 - SECCOMP_MODE_DISABLED = 0x0 - SECCOMP_MODE_FILTER = 0x2 - SECCOMP_MODE_STRICT = 0x1 - SECURITYFS_MAGIC = 0x73636673 - SELINUX_MAGIC = 0xf97cff8c - SFD_CLOEXEC = 0x400000 - SFD_NONBLOCK = 0x4000 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDDLCI = 0x8980 - SIOCADDMULTI = 0x8931 - SIOCADDRT = 0x890b - SIOCATMARK = 0x8905 - SIOCBONDCHANGEACTIVE = 0x8995 - SIOCBONDENSLAVE = 0x8990 - SIOCBONDINFOQUERY = 0x8994 - SIOCBONDRELEASE = 0x8991 - SIOCBONDSETHWADDR = 0x8992 - SIOCBONDSLAVEINFOQUERY = 0x8993 - SIOCBRADDBR = 0x89a0 - SIOCBRADDIF = 0x89a2 - SIOCBRDELBR = 0x89a1 - SIOCBRDELIF = 0x89a3 - SIOCDARP = 0x8953 - SIOCDELDLCI = 0x8981 - SIOCDELMULTI = 0x8932 - SIOCDELRT = 0x890c - SIOCDEVPRIVATE = 0x89f0 - SIOCDIFADDR = 0x8936 - SIOCDRARP = 0x8960 - SIOCETHTOOL = 0x8946 - SIOCGARP = 0x8954 - SIOCGHWTSTAMP = 0x89b1 - SIOCGIFADDR = 0x8915 - SIOCGIFBR = 0x8940 - SIOCGIFBRDADDR = 0x8919 - SIOCGIFCONF = 0x8912 - SIOCGIFCOUNT = 0x8938 - SIOCGIFDSTADDR = 0x8917 - SIOCGIFENCAP = 0x8925 - SIOCGIFFLAGS = 0x8913 - SIOCGIFHWADDR = 0x8927 - SIOCGIFINDEX = 0x8933 - SIOCGIFMAP = 0x8970 - SIOCGIFMEM = 0x891f - SIOCGIFMETRIC = 0x891d - SIOCGIFMTU = 0x8921 - SIOCGIFNAME = 0x8910 - SIOCGIFNETMASK = 0x891b - SIOCGIFPFLAGS = 0x8935 - SIOCGIFSLAVE = 0x8929 - SIOCGIFTXQLEN = 0x8942 - SIOCGIFVLAN = 0x8982 - SIOCGMIIPHY = 0x8947 - SIOCGMIIREG = 0x8948 - SIOCGPGRP = 0x8904 - SIOCGPPPCSTATS = 0x89f2 - SIOCGPPPSTATS = 0x89f0 - SIOCGPPPVER = 0x89f1 - SIOCGRARP = 0x8961 - SIOCGSKNS = 0x894c - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 - SIOCINQ = 0x4004667f - SIOCOUTQ = 0x40047473 - SIOCOUTQNSD = 0x894b - SIOCPROTOPRIVATE = 0x89e0 - SIOCRTMSG = 0x890d - SIOCSARP = 0x8955 - SIOCSHWTSTAMP = 0x89b0 - SIOCSIFADDR = 0x8916 - SIOCSIFBR = 0x8941 - SIOCSIFBRDADDR = 0x891a - SIOCSIFDSTADDR = 0x8918 - SIOCSIFENCAP = 0x8926 - SIOCSIFFLAGS = 0x8914 - SIOCSIFHWADDR = 0x8924 - SIOCSIFHWBROADCAST = 0x8937 - SIOCSIFLINK = 0x8911 - SIOCSIFMAP = 0x8971 - SIOCSIFMEM = 0x8920 - SIOCSIFMETRIC = 0x891e - SIOCSIFMTU = 0x8922 - SIOCSIFNAME = 0x8923 - SIOCSIFNETMASK = 0x891c - SIOCSIFPFLAGS = 0x8934 - SIOCSIFSLAVE = 0x8930 - SIOCSIFTXQLEN = 0x8943 - SIOCSIFVLAN = 0x8983 - SIOCSMIIREG = 0x8949 - SIOCSPGRP = 0x8902 - SIOCSRARP = 0x8962 - SIOCWANDEV = 0x894a - SMACK_MAGIC = 0x43415d53 - SMART_AUTOSAVE = 0xd2 - SMART_AUTO_OFFLINE = 0xdb - SMART_DISABLE = 0xd9 - SMART_ENABLE = 0xd8 - SMART_HCYL_PASS = 0xc2 - SMART_IMMEDIATE_OFFLINE = 0xd4 - SMART_LCYL_PASS = 0x4f - SMART_READ_LOG_SECTOR = 0xd5 - SMART_READ_THRESHOLDS = 0xd1 - SMART_READ_VALUES = 0xd0 - SMART_SAVE = 0xd3 - SMART_STATUS = 0xda - SMART_WRITE_LOG_SECTOR = 0xd6 - SMART_WRITE_THRESHOLDS = 0xd7 - SMB_SUPER_MAGIC = 0x517b - SOCKFS_MAGIC = 0x534f434b - SOCK_CLOEXEC = 0x400000 - SOCK_DCCP = 0x6 - SOCK_DGRAM = 0x2 - SOCK_IOC_TYPE = 0x89 - SOCK_NONBLOCK = 0x4000 - SOCK_PACKET = 0xa - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_AAL = 0x109 - SOL_ALG = 0x117 - SOL_ATM = 0x108 - SOL_CAIF = 0x116 - SOL_CAN_BASE = 0x64 - SOL_DCCP = 0x10d - SOL_DECNET = 0x105 - SOL_ICMPV6 = 0x3a - SOL_IP = 0x0 - SOL_IPV6 = 0x29 - SOL_IRDA = 0x10a - SOL_IUCV = 0x115 - SOL_KCM = 0x119 - SOL_LLC = 0x10c - SOL_NETBEUI = 0x10b - SOL_NETLINK = 0x10e - SOL_NFC = 0x118 - SOL_PACKET = 0x107 - SOL_PNPIPE = 0x113 - SOL_PPPOL2TP = 0x111 - SOL_RAW = 0xff - SOL_RDS = 0x114 - SOL_RXRPC = 0x110 - SOL_SOCKET = 0xffff - SOL_TCP = 0x6 - SOL_TIPC = 0x10f - SOL_TLS = 0x11a - SOL_X25 = 0x106 - SOL_XDP = 0x11b - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x8000 - SO_ATTACH_BPF = 0x34 - SO_ATTACH_FILTER = 0x1a - SO_ATTACH_REUSEPORT_CBPF = 0x35 - SO_ATTACH_REUSEPORT_EBPF = 0x36 - SO_BINDTODEVICE = 0xd - SO_BINDTOIFINDEX = 0x41 - SO_BPF_EXTENSIONS = 0x32 - SO_BROADCAST = 0x20 - SO_BSDCOMPAT = 0x400 - SO_BUSY_POLL = 0x30 - SO_CNX_ADVICE = 0x37 - SO_COOKIE = 0x3b - SO_DEBUG = 0x1 - SO_DETACH_BPF = 0x1b - SO_DETACH_FILTER = 0x1b - SO_DOMAIN = 0x1029 - SO_DONTROUTE = 0x10 - SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 - SO_EE_CODE_TXTIME_MISSED = 0x2 - SO_EE_CODE_ZEROCOPY_COPIED = 0x1 - SO_EE_ORIGIN_ICMP = 0x2 - SO_EE_ORIGIN_ICMP6 = 0x3 - SO_EE_ORIGIN_LOCAL = 0x1 - SO_EE_ORIGIN_NONE = 0x0 - SO_EE_ORIGIN_TIMESTAMPING = 0x4 - SO_EE_ORIGIN_TXSTATUS = 0x4 - SO_EE_ORIGIN_TXTIME = 0x6 - SO_EE_ORIGIN_ZEROCOPY = 0x5 - SO_ERROR = 0x1007 - SO_GET_FILTER = 0x1a - SO_INCOMING_CPU = 0x33 - SO_INCOMING_NAPI_ID = 0x3a - SO_KEEPALIVE = 0x8 - SO_LINGER = 0x80 - SO_LOCK_FILTER = 0x28 - SO_MARK = 0x22 - SO_MAX_PACING_RATE = 0x31 - SO_MEMINFO = 0x39 - SO_NOFCS = 0x27 - SO_NO_CHECK = 0xb - SO_OOBINLINE = 0x100 - SO_PASSCRED = 0x2 - SO_PASSSEC = 0x1f - SO_PEEK_OFF = 0x26 - SO_PEERCRED = 0x40 - SO_PEERGROUPS = 0x3d - SO_PEERNAME = 0x1c - SO_PEERSEC = 0x1e - SO_PRIORITY = 0xc - SO_PROTOCOL = 0x1028 - SO_RCVBUF = 0x1002 - SO_RCVBUFFORCE = 0x100b - SO_RCVLOWAT = 0x800 - SO_RCVTIMEO = 0x2000 - SO_RCVTIMEO_NEW = 0x44 - SO_RCVTIMEO_OLD = 0x2000 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_RXQ_OVFL = 0x24 - SO_SECURITY_AUTHENTICATION = 0x5001 - SO_SECURITY_ENCRYPTION_NETWORK = 0x5004 - SO_SECURITY_ENCRYPTION_TRANSPORT = 0x5002 - SO_SELECT_ERR_QUEUE = 0x29 - SO_SNDBUF = 0x1001 - SO_SNDBUFFORCE = 0x100a - SO_SNDLOWAT = 0x1000 - SO_SNDTIMEO = 0x4000 - SO_SNDTIMEO_NEW = 0x45 - SO_SNDTIMEO_OLD = 0x4000 - SO_TIMESTAMP = 0x1d - SO_TIMESTAMPING = 0x23 - SO_TIMESTAMPING_NEW = 0x43 - SO_TIMESTAMPING_OLD = 0x23 - SO_TIMESTAMPNS = 0x21 - SO_TIMESTAMPNS_NEW = 0x42 - SO_TIMESTAMPNS_OLD = 0x21 - SO_TIMESTAMP_NEW = 0x46 - SO_TIMESTAMP_OLD = 0x1d - SO_TXTIME = 0x3f - SO_TYPE = 0x1008 - SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 - SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 - SO_VM_SOCKETS_BUFFER_SIZE = 0x0 - SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6 - SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7 - SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 - SO_VM_SOCKETS_TRUSTED = 0x5 - SO_WIFI_STATUS = 0x25 - SO_ZEROCOPY = 0x3e - SPLICE_F_GIFT = 0x8 - SPLICE_F_MORE = 0x4 - SPLICE_F_MOVE = 0x1 - SPLICE_F_NONBLOCK = 0x2 - SQUASHFS_MAGIC = 0x73717368 - STACK_END_MAGIC = 0x57ac6e9d - STATX_ALL = 0xfff - STATX_ATIME = 0x20 - STATX_ATTR_APPEND = 0x20 - STATX_ATTR_AUTOMOUNT = 0x1000 - STATX_ATTR_COMPRESSED = 0x4 - STATX_ATTR_ENCRYPTED = 0x800 - STATX_ATTR_IMMUTABLE = 0x10 - STATX_ATTR_NODUMP = 0x40 - STATX_BASIC_STATS = 0x7ff - STATX_BLOCKS = 0x400 - STATX_BTIME = 0x800 - STATX_CTIME = 0x80 - STATX_GID = 0x10 - STATX_INO = 0x100 - STATX_MODE = 0x2 - STATX_MTIME = 0x40 - STATX_NLINK = 0x4 - STATX_SIZE = 0x200 - STATX_TYPE = 0x1 - STATX_UID = 0x8 - STATX__RESERVED = 0x80000000 - SYNC_FILE_RANGE_WAIT_AFTER = 0x4 - SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 - SYNC_FILE_RANGE_WRITE = 0x2 - SYSFS_MAGIC = 0x62656572 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x800 - TAB2 = 0x1000 - TAB3 = 0x1800 - TABDLY = 0x1800 - TASKSTATS_CMD_ATTR_MAX = 0x4 - TASKSTATS_CMD_MAX = 0x2 - TASKSTATS_GENL_NAME = "TASKSTATS" - TASKSTATS_GENL_VERSION = 0x1 - TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x9 - TCFLSH = 0x20005407 - TCGETA = 0x40125401 - TCGETS = 0x40245408 - TCGETS2 = 0x402c540c - TCIFLUSH = 0x0 - TCIOFF = 0x2 - TCIOFLUSH = 0x2 - TCION = 0x3 - TCOFLUSH = 0x1 - TCOOFF = 0x0 - TCOON = 0x1 - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea - TCP_CC_INFO = 0x1a - TCP_CM_INQ = 0x24 - TCP_CONGESTION = 0xd - TCP_COOKIE_IN_ALWAYS = 0x1 - TCP_COOKIE_MAX = 0x10 - TCP_COOKIE_MIN = 0x8 - TCP_COOKIE_OUT_NEVER = 0x2 - TCP_COOKIE_PAIR_SIZE = 0x20 - TCP_COOKIE_TRANSACTIONS = 0xf - TCP_CORK = 0x3 - TCP_DEFER_ACCEPT = 0x9 - TCP_FASTOPEN = 0x17 - TCP_FASTOPEN_CONNECT = 0x1e - TCP_FASTOPEN_KEY = 0x21 - TCP_FASTOPEN_NO_COOKIE = 0x22 - TCP_INFO = 0xb - TCP_INQ = 0x24 - TCP_KEEPCNT = 0x6 - TCP_KEEPIDLE = 0x4 - TCP_KEEPINTVL = 0x5 - TCP_LINGER2 = 0x8 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0xe - TCP_MD5SIG_EXT = 0x20 - TCP_MD5SIG_FLAG_PREFIX = 0x1 - TCP_MD5SIG_MAXKEYLEN = 0x50 - TCP_MSS = 0x200 - TCP_MSS_DEFAULT = 0x218 - TCP_MSS_DESIRED = 0x4c4 - TCP_NODELAY = 0x1 - TCP_NOTSENT_LOWAT = 0x19 - TCP_QUEUE_SEQ = 0x15 - TCP_QUICKACK = 0xc - TCP_REPAIR = 0x13 - TCP_REPAIR_OFF = 0x0 - TCP_REPAIR_OFF_NO_WP = -0x1 - TCP_REPAIR_ON = 0x1 - TCP_REPAIR_OPTIONS = 0x16 - TCP_REPAIR_QUEUE = 0x14 - TCP_REPAIR_WINDOW = 0x1d - TCP_SAVED_SYN = 0x1c - TCP_SAVE_SYN = 0x1b - TCP_SYNCNT = 0x7 - TCP_S_DATA_IN = 0x4 - TCP_S_DATA_OUT = 0x8 - TCP_THIN_DUPACK = 0x11 - TCP_THIN_LINEAR_TIMEOUTS = 0x10 - TCP_TIMESTAMP = 0x18 - TCP_ULP = 0x1f - TCP_USER_TIMEOUT = 0x12 - TCP_WINDOW_CLAMP = 0xa - TCP_ZEROCOPY_RECEIVE = 0x23 - TCSAFLUSH = 0x2 - TCSBRK = 0x20005405 - TCSBRKP = 0x5425 - TCSETA = 0x80125402 - TCSETAF = 0x80125404 - TCSETAW = 0x80125403 - TCSETS = 0x80245409 - TCSETS2 = 0x802c540d - TCSETSF = 0x8024540b - TCSETSF2 = 0x802c540f - TCSETSW = 0x8024540a - TCSETSW2 = 0x802c540e - TCXONC = 0x20005406 - TIMER_ABSTIME = 0x1 - TIOCCBRK = 0x2000747a - TIOCCONS = 0x20007424 - TIOCEXCL = 0x2000740d - TIOCGDEV = 0x40045432 - TIOCGETD = 0x40047400 - TIOCGEXCL = 0x40045440 - TIOCGICOUNT = 0x545d - TIOCGISO7816 = 0x40285443 - TIOCGLCKTRMIOS = 0x5456 - TIOCGPGRP = 0x40047483 - TIOCGPKT = 0x40045438 - TIOCGPTLCK = 0x40045439 - TIOCGPTN = 0x40047486 - TIOCGPTPEER = 0x20007489 - TIOCGRS485 = 0x40205441 - TIOCGSERIAL = 0x541e - TIOCGSID = 0x40047485 - TIOCGSOFTCAR = 0x40047464 - TIOCGWINSZ = 0x40087468 - TIOCINQ = 0x4004667f - TIOCLINUX = 0x541c - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGET = 0x4004746a - TIOCMIWAIT = 0x545c - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCSBRK = 0x2000747b - TIOCSCTTY = 0x20007484 - TIOCSERCONFIG = 0x5453 - TIOCSERGETLSR = 0x5459 - TIOCSERGETMULTI = 0x545a - TIOCSERGSTRUCT = 0x5458 - TIOCSERGWILD = 0x5454 - TIOCSERSETMULTI = 0x545b - TIOCSERSWILD = 0x5455 - TIOCSETD = 0x80047401 - TIOCSIG = 0x80047488 - TIOCSISO7816 = 0xc0285444 - TIOCSLCKTRMIOS = 0x5457 - TIOCSPGRP = 0x80047482 - TIOCSPTLCK = 0x80047487 - TIOCSRS485 = 0xc0205442 - TIOCSSERIAL = 0x541f - TIOCSSOFTCAR = 0x80047465 - TIOCSTART = 0x2000746e - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCVHANGUP = 0x20005437 - TMPFS_MAGIC = 0x1021994 - TOSTOP = 0x100 - TPACKET_ALIGNMENT = 0x10 - TPACKET_HDRLEN = 0x34 - TP_STATUS_AVAILABLE = 0x0 - TP_STATUS_BLK_TMO = 0x20 - TP_STATUS_COPY = 0x2 - TP_STATUS_CSUMNOTREADY = 0x8 - TP_STATUS_CSUM_VALID = 0x80 - TP_STATUS_KERNEL = 0x0 - TP_STATUS_LOSING = 0x4 - TP_STATUS_SENDING = 0x2 - TP_STATUS_SEND_REQUEST = 0x1 - TP_STATUS_TS_RAW_HARDWARE = -0x80000000 - TP_STATUS_TS_SOFTWARE = 0x20000000 - TP_STATUS_TS_SYS_HARDWARE = 0x40000000 - TP_STATUS_USER = 0x1 - TP_STATUS_VLAN_TPID_VALID = 0x40 - TP_STATUS_VLAN_VALID = 0x10 - TP_STATUS_WRONG_FORMAT = 0x4 - TRACEFS_MAGIC = 0x74726163 - TS_COMM_LEN = 0x20 - TUNATTACHFILTER = 0x801054d5 - TUNDETACHFILTER = 0x801054d6 - TUNGETFEATURES = 0x400454cf - TUNGETFILTER = 0x401054db - TUNGETIFF = 0x400454d2 - TUNGETSNDBUF = 0x400454d3 - TUNGETVNETBE = 0x400454df - TUNGETVNETHDRSZ = 0x400454d7 - TUNGETVNETLE = 0x400454dd - TUNSETCARRIER = 0x800454e2 - TUNSETDEBUG = 0x800454c9 - TUNSETFILTEREBPF = 0x400454e1 - TUNSETGROUP = 0x800454ce - TUNSETIFF = 0x800454ca - TUNSETIFINDEX = 0x800454da - TUNSETLINK = 0x800454cd - TUNSETNOCSUM = 0x800454c8 - TUNSETOFFLOAD = 0x800454d0 - TUNSETOWNER = 0x800454cc - TUNSETPERSIST = 0x800454cb - TUNSETQUEUE = 0x800454d9 - TUNSETSNDBUF = 0x800454d4 - TUNSETSTEERINGEBPF = 0x400454e0 - TUNSETTXFILTER = 0x800454d1 - TUNSETVNETBE = 0x800454de - TUNSETVNETHDRSZ = 0x800454d8 - TUNSETVNETLE = 0x800454dc - UBI_IOCATT = 0x80186f40 - UBI_IOCDET = 0x80046f41 - UBI_IOCEBCH = 0x80044f02 - UBI_IOCEBER = 0x80044f01 - UBI_IOCEBISMAP = 0x40044f05 - UBI_IOCEBMAP = 0x80084f03 - UBI_IOCEBUNMAP = 0x80044f04 - UBI_IOCMKVOL = 0x80986f00 - UBI_IOCRMVOL = 0x80046f01 - UBI_IOCRNVOL = 0x91106f03 - UBI_IOCRPEB = 0x80046f04 - UBI_IOCRSVOL = 0x800c6f02 - UBI_IOCSETVOLPROP = 0x80104f06 - UBI_IOCSPEB = 0x80046f05 - UBI_IOCVOLCRBLK = 0x80804f07 - UBI_IOCVOLRMBLK = 0x20004f08 - UBI_IOCVOLUP = 0x80084f00 - UDF_SUPER_MAGIC = 0x15013346 - UMOUNT_NOFOLLOW = 0x8 - USBDEVICE_SUPER_MAGIC = 0x9fa2 - UTIME_NOW = 0x3fffffff - UTIME_OMIT = 0x3ffffffe - V9FS_MAGIC = 0x1021997 - VDISCARD = 0xd - VEOF = 0x4 - VEOL = 0xb - VEOL2 = 0x10 - VERASE = 0x2 - VINTR = 0x0 - VKILL = 0x3 - VLNEXT = 0xf - VMADDR_CID_ANY = 0xffffffff - VMADDR_CID_HOST = 0x2 - VMADDR_CID_HYPERVISOR = 0x0 - VMADDR_CID_RESERVED = 0x1 - VMADDR_PORT_ANY = 0xffffffff - VMIN = 0x6 - VM_SOCKETS_INVALID_VERSION = 0xffffffff - VQUIT = 0x1 - VREPRINT = 0xc - VSTART = 0x8 - VSTOP = 0x9 - VSUSP = 0xa - VSWTC = 0x7 - VT0 = 0x0 - VT1 = 0x4000 - VTDLY = 0x4000 - VTIME = 0x5 - VWERASE = 0xe - WALL = 0x40000000 - WCLONE = 0x80000000 - WCONTINUED = 0x8 - WDIOC_GETBOOTSTATUS = 0x40045702 - WDIOC_GETPRETIMEOUT = 0x40045709 - WDIOC_GETSTATUS = 0x40045701 - WDIOC_GETSUPPORT = 0x40285700 - WDIOC_GETTEMP = 0x40045703 - WDIOC_GETTIMELEFT = 0x4004570a - WDIOC_GETTIMEOUT = 0x40045707 - WDIOC_KEEPALIVE = 0x40045705 - WDIOC_SETOPTIONS = 0x40045704 - WDIOC_SETPRETIMEOUT = 0xc0045708 - WDIOC_SETTIMEOUT = 0xc0045706 - WEXITED = 0x4 - WIN_ACKMEDIACHANGE = 0xdb - WIN_CHECKPOWERMODE1 = 0xe5 - WIN_CHECKPOWERMODE2 = 0x98 - WIN_DEVICE_RESET = 0x8 - WIN_DIAGNOSE = 0x90 - WIN_DOORLOCK = 0xde - WIN_DOORUNLOCK = 0xdf - WIN_DOWNLOAD_MICROCODE = 0x92 - WIN_FLUSH_CACHE = 0xe7 - WIN_FLUSH_CACHE_EXT = 0xea - WIN_FORMAT = 0x50 - WIN_GETMEDIASTATUS = 0xda - WIN_IDENTIFY = 0xec - WIN_IDENTIFY_DMA = 0xee - WIN_IDLEIMMEDIATE = 0xe1 - WIN_INIT = 0x60 - WIN_MEDIAEJECT = 0xed - WIN_MULTREAD = 0xc4 - WIN_MULTREAD_EXT = 0x29 - WIN_MULTWRITE = 0xc5 - WIN_MULTWRITE_EXT = 0x39 - WIN_NOP = 0x0 - WIN_PACKETCMD = 0xa0 - WIN_PIDENTIFY = 0xa1 - WIN_POSTBOOT = 0xdc - WIN_PREBOOT = 0xdd - WIN_QUEUED_SERVICE = 0xa2 - WIN_READ = 0x20 - WIN_READDMA = 0xc8 - WIN_READDMA_EXT = 0x25 - WIN_READDMA_ONCE = 0xc9 - WIN_READDMA_QUEUED = 0xc7 - WIN_READDMA_QUEUED_EXT = 0x26 - WIN_READ_BUFFER = 0xe4 - WIN_READ_EXT = 0x24 - WIN_READ_LONG = 0x22 - WIN_READ_LONG_ONCE = 0x23 - WIN_READ_NATIVE_MAX = 0xf8 - WIN_READ_NATIVE_MAX_EXT = 0x27 - WIN_READ_ONCE = 0x21 - WIN_RECAL = 0x10 - WIN_RESTORE = 0x10 - WIN_SECURITY_DISABLE = 0xf6 - WIN_SECURITY_ERASE_PREPARE = 0xf3 - WIN_SECURITY_ERASE_UNIT = 0xf4 - WIN_SECURITY_FREEZE_LOCK = 0xf5 - WIN_SECURITY_SET_PASS = 0xf1 - WIN_SECURITY_UNLOCK = 0xf2 - WIN_SEEK = 0x70 - WIN_SETFEATURES = 0xef - WIN_SETIDLE1 = 0xe3 - WIN_SETIDLE2 = 0x97 - WIN_SETMULT = 0xc6 - WIN_SET_MAX = 0xf9 - WIN_SET_MAX_EXT = 0x37 - WIN_SLEEPNOW1 = 0xe6 - WIN_SLEEPNOW2 = 0x99 - WIN_SMART = 0xb0 - WIN_SPECIFY = 0x91 - WIN_SRST = 0x8 - WIN_STANDBY = 0xe2 - WIN_STANDBY2 = 0x96 - WIN_STANDBYNOW1 = 0xe0 - WIN_STANDBYNOW2 = 0x94 - WIN_VERIFY = 0x40 - WIN_VERIFY_EXT = 0x42 - WIN_VERIFY_ONCE = 0x41 - WIN_WRITE = 0x30 - WIN_WRITEDMA = 0xca - WIN_WRITEDMA_EXT = 0x35 - WIN_WRITEDMA_ONCE = 0xcb - WIN_WRITEDMA_QUEUED = 0xcc - WIN_WRITEDMA_QUEUED_EXT = 0x36 - WIN_WRITE_BUFFER = 0xe8 - WIN_WRITE_EXT = 0x34 - WIN_WRITE_LONG = 0x32 - WIN_WRITE_LONG_ONCE = 0x33 - WIN_WRITE_ONCE = 0x31 - WIN_WRITE_SAME = 0xe9 - WIN_WRITE_VERIFY = 0x3c - WNOHANG = 0x1 - WNOTHREAD = 0x20000000 - WNOWAIT = 0x1000000 - WORDSIZE = 0x40 - WSTOPPED = 0x2 - WUNTRACED = 0x2 - XATTR_CREATE = 0x1 - XATTR_REPLACE = 0x2 - 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_PACKET_HEADROOM = 0x100 - 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 - XFS_SUPER_MAGIC = 0x58465342 - XTABS = 0x1800 - ZSMALLOC_MAGIC = 0x58295829 - __TIOCFLUSH = 0x80047410 + AF_ALG = 0x26 + AF_APPLETALK = 0x5 + AF_ASH = 0x12 + AF_ATMPVC = 0x8 + AF_ATMSVC = 0x14 + AF_AX25 = 0x3 + AF_BLUETOOTH = 0x1f + AF_BRIDGE = 0x7 + AF_CAIF = 0x25 + AF_CAN = 0x1d + AF_DECnet = 0xc + AF_ECONET = 0x13 + AF_FILE = 0x1 + AF_IB = 0x1b + AF_IEEE802154 = 0x24 + AF_INET = 0x2 + AF_INET6 = 0xa + AF_IPX = 0x4 + AF_IRDA = 0x17 + AF_ISDN = 0x22 + AF_IUCV = 0x20 + AF_KCM = 0x29 + AF_KEY = 0xf + AF_LLC = 0x1a + AF_LOCAL = 0x1 + AF_MAX = 0x2a + AF_MPLS = 0x1c + AF_NETBEUI = 0xd + AF_NETLINK = 0x10 + AF_NETROM = 0x6 + AF_NFC = 0x27 + AF_PACKET = 0x11 + AF_PHONET = 0x23 + AF_PPPOX = 0x18 + AF_RDS = 0x15 + AF_ROSE = 0xb + AF_ROUTE = 0x10 + AF_RXRPC = 0x21 + AF_SECURITY = 0xe + AF_SNA = 0x16 + AF_TIPC = 0x1e + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_VSOCK = 0x28 + AF_WANPIPE = 0x19 + AF_X25 = 0x9 + ALG_OP_DECRYPT = 0x0 + ALG_OP_ENCRYPT = 0x1 + ALG_SET_AEAD_ASSOCLEN = 0x4 + ALG_SET_AEAD_AUTHSIZE = 0x5 + ALG_SET_IV = 0x2 + ALG_SET_KEY = 0x1 + ALG_SET_OP = 0x3 + ARPHRD_6LOWPAN = 0x339 + ARPHRD_ADAPT = 0x108 + ARPHRD_APPLETLK = 0x8 + ARPHRD_ARCNET = 0x7 + ARPHRD_ASH = 0x30d + ARPHRD_ATM = 0x13 + ARPHRD_AX25 = 0x3 + ARPHRD_BIF = 0x307 + ARPHRD_CAIF = 0x336 + ARPHRD_CAN = 0x118 + ARPHRD_CHAOS = 0x5 + ARPHRD_CISCO = 0x201 + ARPHRD_CSLIP = 0x101 + ARPHRD_CSLIP6 = 0x103 + ARPHRD_DDCMP = 0x205 + ARPHRD_DLCI = 0xf + ARPHRD_ECONET = 0x30e + ARPHRD_EETHER = 0x2 + ARPHRD_ETHER = 0x1 + ARPHRD_EUI64 = 0x1b + ARPHRD_FCAL = 0x311 + ARPHRD_FCFABRIC = 0x313 + ARPHRD_FCPL = 0x312 + ARPHRD_FCPP = 0x310 + ARPHRD_FDDI = 0x306 + ARPHRD_FRAD = 0x302 + ARPHRD_HDLC = 0x201 + ARPHRD_HIPPI = 0x30c + ARPHRD_HWX25 = 0x110 + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + ARPHRD_IEEE80211 = 0x321 + ARPHRD_IEEE80211_PRISM = 0x322 + ARPHRD_IEEE80211_RADIOTAP = 0x323 + ARPHRD_IEEE802154 = 0x324 + ARPHRD_IEEE802154_MONITOR = 0x325 + ARPHRD_IEEE802_TR = 0x320 + ARPHRD_INFINIBAND = 0x20 + ARPHRD_IP6GRE = 0x337 + ARPHRD_IPDDP = 0x309 + ARPHRD_IPGRE = 0x30a + ARPHRD_IRDA = 0x30f + ARPHRD_LAPB = 0x204 + ARPHRD_LOCALTLK = 0x305 + ARPHRD_LOOPBACK = 0x304 + ARPHRD_METRICOM = 0x17 + ARPHRD_NETLINK = 0x338 + ARPHRD_NETROM = 0x0 + ARPHRD_NONE = 0xfffe + ARPHRD_PHONET = 0x334 + ARPHRD_PHONET_PIPE = 0x335 + ARPHRD_PIMREG = 0x30b + ARPHRD_PPP = 0x200 + ARPHRD_PRONET = 0x4 + ARPHRD_RAWHDLC = 0x206 + ARPHRD_ROSE = 0x10e + ARPHRD_RSRVD = 0x104 + ARPHRD_SIT = 0x308 + ARPHRD_SKIP = 0x303 + ARPHRD_SLIP = 0x100 + ARPHRD_SLIP6 = 0x102 + ARPHRD_TUNNEL = 0x300 + ARPHRD_TUNNEL6 = 0x301 + ARPHRD_VOID = 0xffff + ARPHRD_X25 = 0x10f + ASI_LEON_DFLUSH = 0x11 + ASI_LEON_IFLUSH = 0x10 + ASI_LEON_MMUFLUSH = 0x18 + B0 = 0x0 + B1000000 = 0x100c + B110 = 0x3 + B115200 = 0x1002 + B1152000 = 0x100d + B1200 = 0x9 + B134 = 0x4 + B150 = 0x5 + B1500000 = 0x100e + B153600 = 0x1006 + B1800 = 0xa + B19200 = 0xe + B200 = 0x6 + B2000000 = 0x100f + B230400 = 0x1003 + B2400 = 0xb + B300 = 0x7 + B307200 = 0x1007 + B38400 = 0xf + B460800 = 0x1004 + B4800 = 0xc + B50 = 0x1 + B500000 = 0x100a + B57600 = 0x1001 + B576000 = 0x100b + B600 = 0x8 + B614400 = 0x1008 + B75 = 0x2 + B76800 = 0x1005 + B921600 = 0x1009 + B9600 = 0xd + BLKBSZGET = 0x80081270 + BLKBSZSET = 0x40081271 + BLKFLSBUF = 0x1261 + BLKFRAGET = 0x1265 + BLKFRASET = 0x1264 + BLKGETSIZE = 0x1260 + BLKGETSIZE64 = 0x80081272 + BLKRAGET = 0x1263 + BLKRASET = 0x1262 + BLKROGET = 0x125e + BLKROSET = 0x125d + BLKRRPART = 0x125f + BLKSECTGET = 0x1267 + BLKSECTSET = 0x1266 + BLKSSZGET = 0x1268 + BOTHER = 0x1000 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LL_OFF = -0x200000 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXINSNS = 0x1000 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MOD = 0x90 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_NET_OFF = -0x100000 + BPF_OR = 0x40 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BPF_XOR = 0xa0 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x2000 + BSDLY = 0x2000 + CAN_BCM = 0x2 + CAN_EFF_FLAG = 0x80000000 + CAN_EFF_ID_BITS = 0x1d + CAN_EFF_MASK = 0x1fffffff + CAN_ERR_FLAG = 0x20000000 + CAN_ERR_MASK = 0x1fffffff + CAN_INV_FILTER = 0x20000000 + CAN_ISOTP = 0x6 + CAN_MAX_DLC = 0x8 + CAN_MAX_DLEN = 0x8 + CAN_MCNET = 0x5 + CAN_MTU = 0x10 + CAN_NPROTO = 0x7 + CAN_RAW = 0x1 + CAN_RTR_FLAG = 0x40000000 + CAN_SFF_ID_BITS = 0xb + CAN_SFF_MASK = 0x7ff + CAN_TP16 = 0x3 + CAN_TP20 = 0x4 + CBAUD = 0x100f + CBAUDEX = 0x1000 + CFLUSH = 0xf + CIBAUD = 0x100f0000 + CLOCAL = 0x800 + CLOCK_BOOTTIME = 0x7 + CLOCK_BOOTTIME_ALARM = 0x9 + CLOCK_DEFAULT = 0x0 + CLOCK_EXT = 0x1 + CLOCK_INT = 0x2 + CLOCK_MONOTONIC = 0x1 + CLOCK_MONOTONIC_COARSE = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_REALTIME_ALARM = 0x8 + CLOCK_REALTIME_COARSE = 0x5 + CLOCK_TAI = 0xb + CLOCK_THREAD_CPUTIME_ID = 0x3 + CLOCK_TXFROMRX = 0x4 + CLOCK_TXINT = 0x3 + CLONE_CHILD_CLEARTID = 0x200000 + CLONE_CHILD_SETTID = 0x1000000 + CLONE_DETACHED = 0x400000 + CLONE_FILES = 0x400 + CLONE_FS = 0x200 + CLONE_IO = 0x80000000 + CLONE_NEWCGROUP = 0x2000000 + CLONE_NEWIPC = 0x8000000 + CLONE_NEWNET = 0x40000000 + CLONE_NEWNS = 0x20000 + CLONE_NEWPID = 0x20000000 + CLONE_NEWUSER = 0x10000000 + CLONE_NEWUTS = 0x4000000 + CLONE_PARENT = 0x8000 + CLONE_PARENT_SETTID = 0x100000 + CLONE_PTRACE = 0x2000 + CLONE_SETTLS = 0x80000 + CLONE_SIGHAND = 0x800 + CLONE_SYSVSEM = 0x40000 + CLONE_THREAD = 0x10000 + CLONE_UNTRACED = 0x800000 + CLONE_VFORK = 0x4000 + CLONE_VM = 0x100 + CMSPAR = 0x40000000 + CR0 = 0x0 + CR1 = 0x200 + CR2 = 0x400 + CR3 = 0x600 + CRDLY = 0x600 + CREAD = 0x80 + CRTSCTS = 0x80000000 + CS5 = 0x0 + CS6 = 0x10 + CS7 = 0x20 + CS8 = 0x30 + CSIGNAL = 0xff + CSIZE = 0x30 + CSTART = 0x11 + CSTATUS = 0x0 + CSTOP = 0x13 + CSTOPB = 0x40 + CSUSP = 0x1a + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x200 + ECHOE = 0x10 + ECHOK = 0x20 + ECHOKE = 0x800 + ECHONL = 0x40 + ECHOPRT = 0x400 + EMT_TAGOVF = 0x1 + ENCODING_DEFAULT = 0x0 + ENCODING_FM_MARK = 0x3 + ENCODING_FM_SPACE = 0x4 + ENCODING_MANCHESTER = 0x5 + ENCODING_NRZ = 0x1 + ENCODING_NRZI = 0x2 + EPOLLERR = 0x8 + EPOLLET = 0x80000000 + EPOLLEXCLUSIVE = 0x10000000 + EPOLLHUP = 0x10 + EPOLLIN = 0x1 + EPOLLMSG = 0x400 + EPOLLONESHOT = 0x40000000 + EPOLLOUT = 0x4 + EPOLLPRI = 0x2 + EPOLLRDBAND = 0x80 + EPOLLRDHUP = 0x2000 + EPOLLRDNORM = 0x40 + EPOLLWAKEUP = 0x20000000 + EPOLLWRBAND = 0x200 + EPOLLWRNORM = 0x100 + EPOLL_CLOEXEC = 0x400000 + EPOLL_CTL_ADD = 0x1 + EPOLL_CTL_DEL = 0x2 + EPOLL_CTL_MOD = 0x3 + ETH_P_1588 = 0x88f7 + ETH_P_8021AD = 0x88a8 + ETH_P_8021AH = 0x88e7 + ETH_P_8021Q = 0x8100 + ETH_P_80221 = 0x8917 + ETH_P_802_2 = 0x4 + ETH_P_802_3 = 0x1 + ETH_P_802_3_MIN = 0x600 + ETH_P_802_EX1 = 0x88b5 + ETH_P_AARP = 0x80f3 + ETH_P_AF_IUCV = 0xfbfb + ETH_P_ALL = 0x3 + ETH_P_AOE = 0x88a2 + ETH_P_ARCNET = 0x1a + ETH_P_ARP = 0x806 + ETH_P_ATALK = 0x809b + ETH_P_ATMFATE = 0x8884 + ETH_P_ATMMPOA = 0x884c + ETH_P_AX25 = 0x2 + ETH_P_BATMAN = 0x4305 + ETH_P_BPQ = 0x8ff + ETH_P_CAIF = 0xf7 + ETH_P_CAN = 0xc + ETH_P_CANFD = 0xd + ETH_P_CONTROL = 0x16 + ETH_P_CUST = 0x6006 + ETH_P_DDCMP = 0x6 + ETH_P_DEC = 0x6000 + ETH_P_DIAG = 0x6005 + ETH_P_DNA_DL = 0x6001 + ETH_P_DNA_RC = 0x6002 + ETH_P_DNA_RT = 0x6003 + ETH_P_DSA = 0x1b + ETH_P_ECONET = 0x18 + ETH_P_EDSA = 0xdada + ETH_P_FCOE = 0x8906 + ETH_P_FIP = 0x8914 + ETH_P_HDLC = 0x19 + ETH_P_HSR = 0x892f + ETH_P_IEEE802154 = 0xf6 + ETH_P_IEEEPUP = 0xa00 + ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IP = 0x800 + ETH_P_IPV6 = 0x86dd + ETH_P_IPX = 0x8137 + ETH_P_IRDA = 0x17 + ETH_P_LAT = 0x6004 + ETH_P_LINK_CTL = 0x886c + ETH_P_LOCALTALK = 0x9 + ETH_P_LOOP = 0x60 + ETH_P_LOOPBACK = 0x9000 + ETH_P_MACSEC = 0x88e5 + ETH_P_MOBITEX = 0x15 + ETH_P_MPLS_MC = 0x8848 + ETH_P_MPLS_UC = 0x8847 + ETH_P_MVRP = 0x88f5 + ETH_P_PAE = 0x888e + ETH_P_PAUSE = 0x8808 + ETH_P_PHONET = 0xf5 + ETH_P_PPPTALK = 0x10 + ETH_P_PPP_DISC = 0x8863 + ETH_P_PPP_MP = 0x8 + ETH_P_PPP_SES = 0x8864 + ETH_P_PRP = 0x88fb + ETH_P_PUP = 0x200 + ETH_P_PUPAT = 0x201 + ETH_P_QINQ1 = 0x9100 + ETH_P_QINQ2 = 0x9200 + ETH_P_QINQ3 = 0x9300 + ETH_P_RARP = 0x8035 + ETH_P_SCA = 0x6007 + ETH_P_SLOW = 0x8809 + ETH_P_SNAP = 0x5 + ETH_P_TDLS = 0x890d + ETH_P_TEB = 0x6558 + ETH_P_TIPC = 0x88ca + ETH_P_TRAILER = 0x1c + ETH_P_TR_802_2 = 0x11 + ETH_P_TSN = 0x22f0 + ETH_P_WAN_PPP = 0x7 + ETH_P_WCCP = 0x883e + ETH_P_X25 = 0x805 + ETH_P_XDSA = 0xf8 + EXTA = 0xe + EXTB = 0xf + EXTPROC = 0x10000 + FALLOC_FL_COLLAPSE_RANGE = 0x8 + FALLOC_FL_INSERT_RANGE = 0x20 + FALLOC_FL_KEEP_SIZE = 0x1 + FALLOC_FL_NO_HIDE_STALE = 0x4 + FALLOC_FL_PUNCH_HOLE = 0x2 + FALLOC_FL_ZERO_RANGE = 0x10 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x8000 + FFDLY = 0x8000 + FLUSHO = 0x2000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x406 + F_EXLCK = 0x4 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLEASE = 0x401 + F_GETLK = 0x7 + F_GETLK64 = 0x7 + F_GETOWN = 0x5 + F_GETOWN_EX = 0x10 + F_GETPIPE_SZ = 0x408 + F_GETSIG = 0xb + F_LOCK = 0x1 + F_NOTIFY = 0x402 + F_OFD_GETLK = 0x24 + F_OFD_SETLK = 0x25 + F_OFD_SETLKW = 0x26 + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLEASE = 0x400 + F_SETLK = 0x8 + F_SETLK64 = 0x8 + F_SETLKW = 0x9 + F_SETLKW64 = 0x9 + F_SETOWN = 0x6 + F_SETOWN_EX = 0xf + F_SETPIPE_SZ = 0x407 + F_SETSIG = 0xa + F_SHLCK = 0x8 + F_TEST = 0x3 + F_TLOCK = 0x2 + F_ULOCK = 0x0 + F_UNLCK = 0x3 + F_WRLCK = 0x2 + GRND_NONBLOCK = 0x1 + GRND_RANDOM = 0x2 + HUPCL = 0x400 + IBSHIFT = 0x10 + ICANON = 0x2 + ICMPV6_FILTER = 0x1 + ICRNL = 0x100 + IEXTEN = 0x8000 + IFA_F_DADFAILED = 0x8 + IFA_F_DEPRECATED = 0x20 + IFA_F_HOMEADDRESS = 0x10 + IFA_F_MANAGETEMPADDR = 0x100 + IFA_F_MCAUTOJOIN = 0x400 + IFA_F_NODAD = 0x2 + IFA_F_NOPREFIXROUTE = 0x200 + IFA_F_OPTIMISTIC = 0x4 + IFA_F_PERMANENT = 0x80 + IFA_F_SECONDARY = 0x1 + IFA_F_STABLE_PRIVACY = 0x800 + IFA_F_TEMPORARY = 0x1 + IFA_F_TENTATIVE = 0x40 + IFA_MAX = 0x8 + IFF_ALLMULTI = 0x200 + IFF_ATTACH_QUEUE = 0x200 + IFF_AUTOMEDIA = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_DETACH_QUEUE = 0x400 + IFF_DORMANT = 0x20000 + IFF_DYNAMIC = 0x8000 + IFF_ECHO = 0x40000 + IFF_LOOPBACK = 0x8 + IFF_LOWER_UP = 0x10000 + IFF_MASTER = 0x400 + IFF_MULTICAST = 0x1000 + IFF_MULTI_QUEUE = 0x100 + IFF_NOARP = 0x80 + IFF_NOFILTER = 0x1000 + IFF_NOTRAILERS = 0x20 + IFF_NO_PI = 0x1000 + IFF_ONE_QUEUE = 0x2000 + IFF_PERSIST = 0x800 + IFF_POINTOPOINT = 0x10 + IFF_PORTSEL = 0x2000 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SLAVE = 0x800 + IFF_TAP = 0x2 + IFF_TUN = 0x1 + IFF_TUN_EXCL = 0x8000 + IFF_UP = 0x1 + IFF_VNET_HDR = 0x4000 + IFF_VOLATILE = 0x70c5a + IFNAMSIZ = 0x10 + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_ACCESS = 0x1 + IN_ALL_EVENTS = 0xfff + IN_ATTRIB = 0x4 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLOEXEC = 0x400000 + IN_CLOSE = 0x18 + IN_CLOSE_NOWRITE = 0x10 + IN_CLOSE_WRITE = 0x8 + IN_CREATE = 0x100 + IN_DELETE = 0x200 + IN_DELETE_SELF = 0x400 + IN_DONT_FOLLOW = 0x2000000 + IN_EXCL_UNLINK = 0x4000000 + IN_IGNORED = 0x8000 + IN_ISDIR = 0x40000000 + IN_LOOPBACKNET = 0x7f + IN_MASK_ADD = 0x20000000 + IN_MODIFY = 0x2 + IN_MOVE = 0xc0 + IN_MOVED_FROM = 0x40 + IN_MOVED_TO = 0x80 + IN_MOVE_SELF = 0x800 + IN_NONBLOCK = 0x4000 + IN_ONESHOT = 0x80000000 + IN_ONLYDIR = 0x1000000 + IN_OPEN = 0x20 + IN_Q_OVERFLOW = 0x4000 + IN_UNMOUNT = 0x2000 + IPPROTO_AH = 0x33 + IPPROTO_BEETPH = 0x5e + IPPROTO_COMP = 0x6c + IPPROTO_DCCP = 0x21 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_ESP = 0x32 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPIP = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MH = 0x87 + IPPROTO_MPLS = 0x89 + IPPROTO_MTP = 0x5c + IPPROTO_NONE = 0x3b + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_2292DSTOPTS = 0x4 + IPV6_2292HOPLIMIT = 0x8 + IPV6_2292HOPOPTS = 0x3 + IPV6_2292PKTINFO = 0x2 + IPV6_2292PKTOPTIONS = 0x6 + IPV6_2292RTHDR = 0x5 + IPV6_ADDRFORM = 0x1 + IPV6_ADD_MEMBERSHIP = 0x14 + IPV6_AUTHHDR = 0xa + IPV6_CHECKSUM = 0x7 + IPV6_DONTFRAG = 0x3e + IPV6_DROP_MEMBERSHIP = 0x15 + IPV6_DSTOPTS = 0x3b + IPV6_HDRINCL = 0x24 + IPV6_HOPLIMIT = 0x34 + IPV6_HOPOPTS = 0x36 + IPV6_IPSEC_POLICY = 0x22 + IPV6_JOIN_ANYCAST = 0x1b + IPV6_JOIN_GROUP = 0x14 + IPV6_LEAVE_ANYCAST = 0x1c + IPV6_LEAVE_GROUP = 0x15 + IPV6_MTU = 0x18 + IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_HOPS = 0x12 + IPV6_MULTICAST_IF = 0x11 + IPV6_MULTICAST_LOOP = 0x13 + IPV6_NEXTHOP = 0x9 + IPV6_PATHMTU = 0x3d + IPV6_PKTINFO = 0x32 + IPV6_PMTUDISC_DO = 0x2 + IPV6_PMTUDISC_DONT = 0x0 + IPV6_PMTUDISC_INTERFACE = 0x4 + IPV6_PMTUDISC_OMIT = 0x5 + IPV6_PMTUDISC_PROBE = 0x3 + IPV6_PMTUDISC_WANT = 0x1 + IPV6_RECVDSTOPTS = 0x3a + IPV6_RECVERR = 0x19 + IPV6_RECVHOPLIMIT = 0x33 + IPV6_RECVHOPOPTS = 0x35 + IPV6_RECVPATHMTU = 0x3c + IPV6_RECVPKTINFO = 0x31 + IPV6_RECVRTHDR = 0x38 + IPV6_RECVTCLASS = 0x42 + IPV6_ROUTER_ALERT = 0x16 + IPV6_RTHDR = 0x39 + IPV6_RTHDRDSTOPTS = 0x37 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_RXDSTOPTS = 0x3b + IPV6_RXHOPOPTS = 0x36 + IPV6_TCLASS = 0x43 + IPV6_UNICAST_HOPS = 0x10 + IPV6_V6ONLY = 0x1a + IPV6_XFRM_POLICY = 0x23 + IP_ADD_MEMBERSHIP = 0x23 + IP_ADD_SOURCE_MEMBERSHIP = 0x27 + IP_BIND_ADDRESS_NO_PORT = 0x18 + IP_BLOCK_SOURCE = 0x26 + IP_CHECKSUM = 0x17 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0x24 + IP_DROP_SOURCE_MEMBERSHIP = 0x28 + IP_FREEBIND = 0xf + IP_HDRINCL = 0x3 + IP_IPSEC_POLICY = 0x10 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0x14 + IP_MF = 0x2000 + IP_MINTTL = 0x15 + IP_MSFILTER = 0x29 + IP_MSS = 0x240 + IP_MTU = 0xe + IP_MTU_DISCOVER = 0xa + IP_MULTICAST_ALL = 0x31 + IP_MULTICAST_IF = 0x20 + IP_MULTICAST_LOOP = 0x22 + IP_MULTICAST_TTL = 0x21 + IP_NODEFRAG = 0x16 + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x4 + IP_ORIGDSTADDR = 0x14 + IP_PASSSEC = 0x12 + IP_PKTINFO = 0x8 + IP_PKTOPTIONS = 0x9 + IP_PMTUDISC = 0xa + IP_PMTUDISC_DO = 0x2 + IP_PMTUDISC_DONT = 0x0 + IP_PMTUDISC_INTERFACE = 0x4 + IP_PMTUDISC_OMIT = 0x5 + IP_PMTUDISC_PROBE = 0x3 + IP_PMTUDISC_WANT = 0x1 + IP_RECVERR = 0xb + IP_RECVOPTS = 0x6 + IP_RECVORIGDSTADDR = 0x14 + IP_RECVRETOPTS = 0x7 + IP_RECVTOS = 0xd + IP_RECVTTL = 0xc + IP_RETOPTS = 0x7 + IP_RF = 0x8000 + IP_ROUTER_ALERT = 0x5 + IP_TOS = 0x1 + IP_TRANSPARENT = 0x13 + IP_TTL = 0x2 + IP_UNBLOCK_SOURCE = 0x25 + IP_UNICAST_IF = 0x32 + IP_XFRM_POLICY = 0x11 + ISIG = 0x1 + ISTRIP = 0x20 + IUCLC = 0x200 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x1000 + IXON = 0x400 + LINUX_REBOOT_CMD_CAD_OFF = 0x0 + LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef + LINUX_REBOOT_CMD_HALT = 0xcdef0123 + LINUX_REBOOT_CMD_KEXEC = 0x45584543 + LINUX_REBOOT_CMD_POWER_OFF = 0x4321fedc + LINUX_REBOOT_CMD_RESTART = 0x1234567 + LINUX_REBOOT_CMD_RESTART2 = 0xa1b2c3d4 + LINUX_REBOOT_CMD_SW_SUSPEND = 0xd000fce2 + LINUX_REBOOT_MAGIC1 = 0xfee1dead + LINUX_REBOOT_MAGIC2 = 0x28121969 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DODUMP = 0x11 + MADV_DOFORK = 0xb + MADV_DONTDUMP = 0x10 + MADV_DONTFORK = 0xa + MADV_DONTNEED = 0x4 + MADV_FREE = 0x8 + MADV_HUGEPAGE = 0xe + MADV_HWPOISON = 0x64 + MADV_MERGEABLE = 0xc + MADV_NOHUGEPAGE = 0xf + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_REMOVE = 0x9 + MADV_SEQUENTIAL = 0x2 + MADV_UNMERGEABLE = 0xd + MADV_WILLNEED = 0x3 + MAP_ANON = 0x20 + MAP_ANONYMOUS = 0x20 + MAP_DENYWRITE = 0x800 + MAP_EXECUTABLE = 0x1000 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_GROWSDOWN = 0x200 + MAP_HUGETLB = 0x40000 + MAP_HUGE_MASK = 0x3f + MAP_HUGE_SHIFT = 0x1a + MAP_LOCKED = 0x100 + MAP_NONBLOCK = 0x10000 + MAP_NORESERVE = 0x40 + MAP_POPULATE = 0x8000 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_SHARED = 0x1 + MAP_STACK = 0x20000 + MAP_TYPE = 0xf + MCL_CURRENT = 0x2000 + MCL_FUTURE = 0x4000 + MCL_ONFAULT = 0x8000 + MNT_DETACH = 0x2 + MNT_EXPIRE = 0x4 + MNT_FORCE = 0x1 + MSG_BATCH = 0x40000 + MSG_CMSG_CLOEXEC = 0x40000000 + MSG_CONFIRM = 0x800 + MSG_CTRUNC = 0x8 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x40 + MSG_EOR = 0x80 + MSG_ERRQUEUE = 0x2000 + MSG_FASTOPEN = 0x20000000 + MSG_FIN = 0x200 + MSG_MORE = 0x8000 + MSG_NOSIGNAL = 0x4000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_PROXY = 0x10 + MSG_RST = 0x1000 + MSG_SYN = 0x400 + MSG_TRUNC = 0x20 + MSG_TRYHARD = 0x4 + MSG_WAITALL = 0x100 + MSG_WAITFORONE = 0x10000 + MS_ACTIVE = 0x40000000 + MS_ASYNC = 0x1 + MS_BIND = 0x1000 + MS_DIRSYNC = 0x80 + MS_INVALIDATE = 0x2 + MS_I_VERSION = 0x800000 + MS_KERNMOUNT = 0x400000 + MS_LAZYTIME = 0x2000000 + MS_MANDLOCK = 0x40 + MS_MGC_MSK = 0xffff0000 + MS_MGC_VAL = 0xc0ed0000 + MS_MOVE = 0x2000 + MS_NOATIME = 0x400 + MS_NODEV = 0x4 + MS_NODIRATIME = 0x800 + MS_NOEXEC = 0x8 + MS_NOSUID = 0x2 + MS_NOUSER = -0x80000000 + MS_POSIXACL = 0x10000 + MS_PRIVATE = 0x40000 + MS_RDONLY = 0x1 + MS_REC = 0x4000 + MS_RELATIME = 0x200000 + MS_REMOUNT = 0x20 + MS_RMT_MASK = 0x2800051 + MS_SHARED = 0x100000 + MS_SILENT = 0x8000 + MS_SLAVE = 0x80000 + MS_STRICTATIME = 0x1000000 + MS_SYNC = 0x4 + MS_SYNCHRONOUS = 0x10 + MS_UNBINDABLE = 0x20000 + NAME_MAX = 0xff + NETLINK_ADD_MEMBERSHIP = 0x1 + NETLINK_AUDIT = 0x9 + NETLINK_BROADCAST_ERROR = 0x4 + NETLINK_CAP_ACK = 0xa + NETLINK_CONNECTOR = 0xb + NETLINK_CRYPTO = 0x15 + NETLINK_DNRTMSG = 0xe + NETLINK_DROP_MEMBERSHIP = 0x2 + NETLINK_ECRYPTFS = 0x13 + NETLINK_FIB_LOOKUP = 0xa + NETLINK_FIREWALL = 0x3 + NETLINK_GENERIC = 0x10 + NETLINK_INET_DIAG = 0x4 + NETLINK_IP6_FW = 0xd + NETLINK_ISCSI = 0x8 + NETLINK_KOBJECT_UEVENT = 0xf + NETLINK_LISTEN_ALL_NSID = 0x8 + NETLINK_LIST_MEMBERSHIPS = 0x9 + NETLINK_NETFILTER = 0xc + NETLINK_NFLOG = 0x5 + NETLINK_NO_ENOBUFS = 0x5 + NETLINK_PKTINFO = 0x3 + NETLINK_RDMA = 0x14 + NETLINK_ROUTE = 0x0 + NETLINK_RX_RING = 0x6 + NETLINK_SCSITRANSPORT = 0x12 + NETLINK_SELINUX = 0x7 + NETLINK_SOCK_DIAG = 0x4 + NETLINK_TX_RING = 0x7 + NETLINK_UNUSED = 0x1 + NETLINK_USERSOCK = 0x2 + NETLINK_XFRM = 0x6 + NL0 = 0x0 + NL1 = 0x100 + NLA_ALIGNTO = 0x4 + NLA_F_NESTED = 0x8000 + NLA_F_NET_BYTEORDER = 0x4000 + NLA_HDRLEN = 0x4 + NLDLY = 0x100 + NLMSG_ALIGNTO = 0x4 + NLMSG_DONE = 0x3 + NLMSG_ERROR = 0x2 + NLMSG_HDRLEN = 0x10 + NLMSG_MIN_TYPE = 0x10 + NLMSG_NOOP = 0x1 + NLMSG_OVERRUN = 0x4 + NLM_F_ACK = 0x4 + NLM_F_APPEND = 0x800 + NLM_F_ATOMIC = 0x400 + NLM_F_CREATE = 0x400 + NLM_F_DUMP = 0x300 + NLM_F_DUMP_FILTERED = 0x20 + NLM_F_DUMP_INTR = 0x10 + NLM_F_ECHO = 0x8 + NLM_F_EXCL = 0x200 + NLM_F_MATCH = 0x200 + NLM_F_MULTI = 0x2 + NLM_F_REPLACE = 0x100 + NLM_F_REQUEST = 0x1 + NLM_F_ROOT = 0x100 + NOFLSH = 0x80 + OCRNL = 0x8 + OFDEL = 0x80 + OFILL = 0x40 + OLCUC = 0x2 + ONLCR = 0x4 + ONLRET = 0x20 + ONOCR = 0x10 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x400000 + O_CREAT = 0x200 + O_DIRECT = 0x100000 + O_DIRECTORY = 0x10000 + O_DSYNC = 0x2000 + O_EXCL = 0x800 + O_FSYNC = 0x802000 + O_LARGEFILE = 0x0 + O_NDELAY = 0x4004 + O_NOATIME = 0x200000 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x20000 + O_NONBLOCK = 0x4000 + O_PATH = 0x1000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x802000 + O_SYNC = 0x802000 + O_TMPFILE = 0x2010000 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PACKET_ADD_MEMBERSHIP = 0x1 + PACKET_AUXDATA = 0x8 + PACKET_BROADCAST = 0x1 + PACKET_COPY_THRESH = 0x7 + PACKET_DROP_MEMBERSHIP = 0x2 + PACKET_FANOUT = 0x12 + PACKET_FANOUT_CBPF = 0x6 + PACKET_FANOUT_CPU = 0x2 + PACKET_FANOUT_DATA = 0x16 + PACKET_FANOUT_EBPF = 0x7 + PACKET_FANOUT_FLAG_DEFRAG = 0x8000 + PACKET_FANOUT_FLAG_ROLLOVER = 0x1000 + PACKET_FANOUT_HASH = 0x0 + PACKET_FANOUT_LB = 0x1 + PACKET_FANOUT_QM = 0x5 + PACKET_FANOUT_RND = 0x4 + PACKET_FANOUT_ROLLOVER = 0x3 + PACKET_FASTROUTE = 0x6 + PACKET_HDRLEN = 0xb + PACKET_HOST = 0x0 + PACKET_KERNEL = 0x7 + PACKET_LOOPBACK = 0x5 + PACKET_LOSS = 0xe + PACKET_MR_ALLMULTI = 0x2 + PACKET_MR_MULTICAST = 0x0 + PACKET_MR_PROMISC = 0x1 + PACKET_MR_UNICAST = 0x3 + PACKET_MULTICAST = 0x2 + PACKET_ORIGDEV = 0x9 + PACKET_OTHERHOST = 0x3 + PACKET_OUTGOING = 0x4 + PACKET_QDISC_BYPASS = 0x14 + PACKET_RECV_OUTPUT = 0x3 + PACKET_RESERVE = 0xc + PACKET_ROLLOVER_STATS = 0x15 + PACKET_RX_RING = 0x5 + PACKET_STATISTICS = 0x6 + PACKET_TIMESTAMP = 0x11 + PACKET_TX_HAS_OFF = 0x13 + PACKET_TX_RING = 0xd + PACKET_TX_TIMESTAMP = 0x10 + PACKET_USER = 0x6 + PACKET_VERSION = 0xa + PACKET_VNET_HDR = 0xf + PARENB = 0x100 + PARITY_CRC16_PR0 = 0x2 + PARITY_CRC16_PR0_CCITT = 0x4 + PARITY_CRC16_PR1 = 0x3 + PARITY_CRC16_PR1_CCITT = 0x5 + PARITY_CRC32_PR0_CCITT = 0x6 + PARITY_CRC32_PR1_CCITT = 0x7 + PARITY_DEFAULT = 0x0 + PARITY_NONE = 0x1 + PARMRK = 0x8 + PARODD = 0x200 + PENDIN = 0x4000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_GROWSDOWN = 0x1000000 + PROT_GROWSUP = 0x2000000 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PR_CAPBSET_DROP = 0x18 + PR_CAPBSET_READ = 0x17 + PR_CAP_AMBIENT = 0x2f + PR_CAP_AMBIENT_CLEAR_ALL = 0x4 + PR_CAP_AMBIENT_IS_SET = 0x1 + PR_CAP_AMBIENT_LOWER = 0x3 + PR_CAP_AMBIENT_RAISE = 0x2 + PR_ENDIAN_BIG = 0x0 + PR_ENDIAN_LITTLE = 0x1 + PR_ENDIAN_PPC_LITTLE = 0x2 + PR_FPEMU_NOPRINT = 0x1 + PR_FPEMU_SIGFPE = 0x2 + PR_FP_EXC_ASYNC = 0x2 + PR_FP_EXC_DISABLED = 0x0 + PR_FP_EXC_DIV = 0x10000 + PR_FP_EXC_INV = 0x100000 + PR_FP_EXC_NONRECOV = 0x1 + PR_FP_EXC_OVF = 0x20000 + PR_FP_EXC_PRECISE = 0x3 + PR_FP_EXC_RES = 0x80000 + PR_FP_EXC_SW_ENABLE = 0x80 + PR_FP_EXC_UND = 0x40000 + PR_FP_MODE_FR = 0x1 + PR_FP_MODE_FRE = 0x2 + PR_GET_CHILD_SUBREAPER = 0x25 + PR_GET_DUMPABLE = 0x3 + PR_GET_ENDIAN = 0x13 + PR_GET_FPEMU = 0x9 + PR_GET_FPEXC = 0xb + PR_GET_FP_MODE = 0x2e + PR_GET_KEEPCAPS = 0x7 + PR_GET_NAME = 0x10 + PR_GET_NO_NEW_PRIVS = 0x27 + PR_GET_PDEATHSIG = 0x2 + PR_GET_SECCOMP = 0x15 + PR_GET_SECUREBITS = 0x1b + PR_GET_THP_DISABLE = 0x2a + PR_GET_TID_ADDRESS = 0x28 + PR_GET_TIMERSLACK = 0x1e + PR_GET_TIMING = 0xd + PR_GET_TSC = 0x19 + PR_GET_UNALIGN = 0x5 + PR_MCE_KILL = 0x21 + PR_MCE_KILL_CLEAR = 0x0 + PR_MCE_KILL_DEFAULT = 0x2 + PR_MCE_KILL_EARLY = 0x1 + PR_MCE_KILL_GET = 0x22 + PR_MCE_KILL_LATE = 0x0 + PR_MCE_KILL_SET = 0x1 + PR_MPX_DISABLE_MANAGEMENT = 0x2c + PR_MPX_ENABLE_MANAGEMENT = 0x2b + PR_SET_CHILD_SUBREAPER = 0x24 + PR_SET_DUMPABLE = 0x4 + PR_SET_ENDIAN = 0x14 + PR_SET_FPEMU = 0xa + PR_SET_FPEXC = 0xc + PR_SET_FP_MODE = 0x2d + PR_SET_KEEPCAPS = 0x8 + PR_SET_MM = 0x23 + PR_SET_MM_ARG_END = 0x9 + PR_SET_MM_ARG_START = 0x8 + PR_SET_MM_AUXV = 0xc + PR_SET_MM_BRK = 0x7 + PR_SET_MM_END_CODE = 0x2 + PR_SET_MM_END_DATA = 0x4 + PR_SET_MM_ENV_END = 0xb + PR_SET_MM_ENV_START = 0xa + PR_SET_MM_EXE_FILE = 0xd + PR_SET_MM_MAP = 0xe + PR_SET_MM_MAP_SIZE = 0xf + PR_SET_MM_START_BRK = 0x6 + PR_SET_MM_START_CODE = 0x1 + PR_SET_MM_START_DATA = 0x3 + PR_SET_MM_START_STACK = 0x5 + PR_SET_NAME = 0xf + PR_SET_NO_NEW_PRIVS = 0x26 + PR_SET_PDEATHSIG = 0x1 + PR_SET_PTRACER = 0x59616d61 + PR_SET_PTRACER_ANY = -0x1 + PR_SET_SECCOMP = 0x16 + PR_SET_SECUREBITS = 0x1c + PR_SET_THP_DISABLE = 0x29 + PR_SET_TIMERSLACK = 0x1d + PR_SET_TIMING = 0xe + PR_SET_TSC = 0x1a + PR_SET_UNALIGN = 0x6 + PR_TASK_PERF_EVENTS_DISABLE = 0x1f + PR_TASK_PERF_EVENTS_ENABLE = 0x20 + PR_TIMING_STATISTICAL = 0x0 + PR_TIMING_TIMESTAMP = 0x1 + PR_TSC_ENABLE = 0x1 + PR_TSC_SIGSEGV = 0x2 + PR_UNALIGN_NOPRINT = 0x1 + PR_UNALIGN_SIGBUS = 0x2 + PTRACE_ATTACH = 0x10 + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0x11 + PTRACE_EVENT_CLONE = 0x3 + PTRACE_EVENT_EXEC = 0x4 + PTRACE_EVENT_EXIT = 0x6 + PTRACE_EVENT_FORK = 0x1 + PTRACE_EVENT_SECCOMP = 0x7 + PTRACE_EVENT_STOP = 0x80 + PTRACE_EVENT_VFORK = 0x2 + PTRACE_EVENT_VFORK_DONE = 0x5 + PTRACE_GETEVENTMSG = 0x4201 + PTRACE_GETFPAREGS = 0x14 + PTRACE_GETFPREGS = 0xe + PTRACE_GETFPREGS64 = 0x19 + PTRACE_GETREGS = 0xc + PTRACE_GETREGS64 = 0x16 + PTRACE_GETREGSET = 0x4204 + PTRACE_GETSIGINFO = 0x4202 + PTRACE_GETSIGMASK = 0x420a + PTRACE_INTERRUPT = 0x4207 + PTRACE_KILL = 0x8 + PTRACE_LISTEN = 0x4208 + PTRACE_O_EXITKILL = 0x100000 + PTRACE_O_MASK = 0x3000ff + PTRACE_O_SUSPEND_SECCOMP = 0x200000 + PTRACE_O_TRACECLONE = 0x8 + PTRACE_O_TRACEEXEC = 0x10 + PTRACE_O_TRACEEXIT = 0x40 + PTRACE_O_TRACEFORK = 0x2 + PTRACE_O_TRACESECCOMP = 0x80 + PTRACE_O_TRACESYSGOOD = 0x1 + PTRACE_O_TRACEVFORK = 0x4 + PTRACE_O_TRACEVFORKDONE = 0x20 + PTRACE_PEEKDATA = 0x2 + PTRACE_PEEKSIGINFO = 0x4209 + PTRACE_PEEKSIGINFO_SHARED = 0x1 + PTRACE_PEEKTEXT = 0x1 + PTRACE_PEEKUSR = 0x3 + PTRACE_POKEDATA = 0x5 + PTRACE_POKETEXT = 0x4 + PTRACE_POKEUSR = 0x6 + PTRACE_READDATA = 0x10 + PTRACE_READTEXT = 0x12 + PTRACE_SECCOMP_GET_FILTER = 0x420c + PTRACE_SEIZE = 0x4206 + PTRACE_SETFPAREGS = 0x15 + PTRACE_SETFPREGS = 0xf + PTRACE_SETFPREGS64 = 0x1a + PTRACE_SETOPTIONS = 0x4200 + PTRACE_SETREGS = 0xd + PTRACE_SETREGS64 = 0x17 + PTRACE_SETREGSET = 0x4205 + PTRACE_SETSIGINFO = 0x4203 + PTRACE_SETSIGMASK = 0x420b + PTRACE_SINGLESTEP = 0x9 + PTRACE_SPARC_DETACH = 0xb + PTRACE_SYSCALL = 0x18 + PTRACE_TRACEME = 0x0 + PTRACE_WRITEDATA = 0x11 + PTRACE_WRITETEXT = 0x13 + PT_FP = 0x48 + PT_G0 = 0x10 + PT_G1 = 0x14 + PT_G2 = 0x18 + PT_G3 = 0x1c + PT_G4 = 0x20 + PT_G5 = 0x24 + PT_G6 = 0x28 + PT_G7 = 0x2c + PT_I0 = 0x30 + PT_I1 = 0x34 + PT_I2 = 0x38 + PT_I3 = 0x3c + PT_I4 = 0x40 + PT_I5 = 0x44 + PT_I6 = 0x48 + PT_I7 = 0x4c + PT_NPC = 0x8 + PT_PC = 0x4 + PT_PSR = 0x0 + PT_REGS_MAGIC = 0x57ac6c00 + PT_TNPC = 0x90 + PT_TPC = 0x88 + PT_TSTATE = 0x80 + PT_V9_FP = 0x70 + PT_V9_G0 = 0x0 + PT_V9_G1 = 0x8 + PT_V9_G2 = 0x10 + PT_V9_G3 = 0x18 + PT_V9_G4 = 0x20 + PT_V9_G5 = 0x28 + PT_V9_G6 = 0x30 + PT_V9_G7 = 0x38 + PT_V9_I0 = 0x40 + PT_V9_I1 = 0x48 + PT_V9_I2 = 0x50 + PT_V9_I3 = 0x58 + PT_V9_I4 = 0x60 + PT_V9_I5 = 0x68 + PT_V9_I6 = 0x70 + PT_V9_I7 = 0x78 + PT_V9_MAGIC = 0x9c + PT_V9_TNPC = 0x90 + PT_V9_TPC = 0x88 + PT_V9_TSTATE = 0x80 + PT_V9_Y = 0x98 + PT_WIM = 0x10 + PT_Y = 0xc + RLIMIT_AS = 0x9 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_NOFILE = 0x6 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = -0x1 + RTAX_ADVMSS = 0x8 + RTAX_CC_ALGO = 0x10 + RTAX_CWND = 0x7 + RTAX_FEATURES = 0xc + RTAX_FEATURE_ALLFRAG = 0x8 + RTAX_FEATURE_ECN = 0x1 + RTAX_FEATURE_MASK = 0xf + RTAX_FEATURE_SACK = 0x2 + RTAX_FEATURE_TIMESTAMP = 0x4 + RTAX_HOPLIMIT = 0xa + RTAX_INITCWND = 0xb + RTAX_INITRWND = 0xe + RTAX_LOCK = 0x1 + RTAX_MAX = 0x10 + RTAX_MTU = 0x2 + RTAX_QUICKACK = 0xf + RTAX_REORDERING = 0x9 + RTAX_RTO_MIN = 0xd + RTAX_RTT = 0x4 + RTAX_RTTVAR = 0x5 + RTAX_SSTHRESH = 0x6 + RTAX_UNSPEC = 0x0 + RTAX_WINDOW = 0x3 + RTA_ALIGNTO = 0x4 + RTA_MAX = 0x18 + RTCF_DIRECTSRC = 0x4000000 + RTCF_DOREDIRECT = 0x1000000 + RTCF_LOG = 0x2000000 + RTCF_MASQ = 0x400000 + RTCF_NAT = 0x800000 + RTCF_VALVE = 0x200000 + RTF_ADDRCLASSMASK = 0xf8000000 + RTF_ADDRCONF = 0x40000 + RTF_ALLONLINK = 0x20000 + RTF_BROADCAST = 0x10000000 + RTF_CACHE = 0x1000000 + RTF_DEFAULT = 0x10000 + RTF_DYNAMIC = 0x10 + RTF_FLOW = 0x2000000 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_INTERFACE = 0x40000000 + RTF_IRTT = 0x100 + RTF_LINKRT = 0x100000 + RTF_LOCAL = 0x80000000 + RTF_MODIFIED = 0x20 + RTF_MSS = 0x40 + RTF_MTU = 0x40 + RTF_MULTICAST = 0x20000000 + RTF_NAT = 0x8000000 + RTF_NOFORWARD = 0x1000 + RTF_NONEXTHOP = 0x200000 + RTF_NOPMTUDISC = 0x4000 + RTF_POLICY = 0x4000000 + RTF_REINSTATE = 0x8 + RTF_REJECT = 0x200 + RTF_STATIC = 0x400 + RTF_THROW = 0x2000 + RTF_UP = 0x1 + RTF_WINDOW = 0x80 + RTF_XRESOLVE = 0x800 + RTM_BASE = 0x10 + RTM_DELACTION = 0x31 + RTM_DELADDR = 0x15 + RTM_DELADDRLABEL = 0x49 + RTM_DELLINK = 0x11 + RTM_DELMDB = 0x55 + RTM_DELNEIGH = 0x1d + RTM_DELNSID = 0x59 + RTM_DELQDISC = 0x25 + RTM_DELROUTE = 0x19 + RTM_DELRULE = 0x21 + RTM_DELTCLASS = 0x29 + RTM_DELTFILTER = 0x2d + RTM_F_CLONED = 0x200 + RTM_F_EQUALIZE = 0x400 + RTM_F_LOOKUP_TABLE = 0x1000 + RTM_F_NOTIFY = 0x100 + RTM_F_PREFIX = 0x800 + RTM_GETACTION = 0x32 + RTM_GETADDR = 0x16 + RTM_GETADDRLABEL = 0x4a + RTM_GETANYCAST = 0x3e + RTM_GETDCB = 0x4e + RTM_GETLINK = 0x12 + RTM_GETMDB = 0x56 + RTM_GETMULTICAST = 0x3a + RTM_GETNEIGH = 0x1e + RTM_GETNEIGHTBL = 0x42 + RTM_GETNETCONF = 0x52 + RTM_GETNSID = 0x5a + RTM_GETQDISC = 0x26 + RTM_GETROUTE = 0x1a + RTM_GETRULE = 0x22 + RTM_GETSTATS = 0x5e + RTM_GETTCLASS = 0x2a + RTM_GETTFILTER = 0x2e + RTM_MAX = 0x5f + RTM_NEWACTION = 0x30 + RTM_NEWADDR = 0x14 + RTM_NEWADDRLABEL = 0x48 + RTM_NEWLINK = 0x10 + RTM_NEWMDB = 0x54 + RTM_NEWNDUSEROPT = 0x44 + RTM_NEWNEIGH = 0x1c + RTM_NEWNEIGHTBL = 0x40 + RTM_NEWNETCONF = 0x50 + RTM_NEWNSID = 0x58 + RTM_NEWPREFIX = 0x34 + RTM_NEWQDISC = 0x24 + RTM_NEWROUTE = 0x18 + RTM_NEWRULE = 0x20 + RTM_NEWSTATS = 0x5c + RTM_NEWTCLASS = 0x28 + RTM_NEWTFILTER = 0x2c + RTM_NR_FAMILIES = 0x14 + RTM_NR_MSGTYPES = 0x50 + RTM_SETDCB = 0x4f + RTM_SETLINK = 0x13 + RTM_SETNEIGHTBL = 0x43 + RTNH_ALIGNTO = 0x4 + RTNH_COMPARE_MASK = 0x11 + RTNH_F_DEAD = 0x1 + RTNH_F_LINKDOWN = 0x10 + RTNH_F_OFFLOAD = 0x8 + RTNH_F_ONLINK = 0x4 + RTNH_F_PERVASIVE = 0x2 + RTN_MAX = 0xb + RTPROT_BABEL = 0x2a + RTPROT_BIRD = 0xc + RTPROT_BOOT = 0x3 + RTPROT_DHCP = 0x10 + RTPROT_DNROUTED = 0xd + RTPROT_GATED = 0x8 + RTPROT_KERNEL = 0x2 + RTPROT_MROUTED = 0x11 + RTPROT_MRT = 0xa + RTPROT_NTK = 0xf + RTPROT_RA = 0x9 + RTPROT_REDIRECT = 0x1 + RTPROT_STATIC = 0x4 + RTPROT_UNSPEC = 0x0 + RTPROT_XORP = 0xe + RTPROT_ZEBRA = 0xb + RT_CLASS_DEFAULT = 0xfd + RT_CLASS_LOCAL = 0xff + RT_CLASS_MAIN = 0xfe + RT_CLASS_MAX = 0xff + RT_CLASS_UNSPEC = 0x0 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_CREDENTIALS = 0x2 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x1d + SCM_TIMESTAMPING = 0x23 + SCM_TIMESTAMPNS = 0x21 + SCM_WIFI_STATUS = 0x25 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDDLCI = 0x8980 + SIOCADDMULTI = 0x8931 + SIOCADDRT = 0x890b + SIOCATMARK = 0x8905 + SIOCBONDCHANGEACTIVE = 0x8995 + SIOCBONDENSLAVE = 0x8990 + SIOCBONDINFOQUERY = 0x8994 + SIOCBONDRELEASE = 0x8991 + SIOCBONDSETHWADDR = 0x8992 + SIOCBONDSLAVEINFOQUERY = 0x8993 + SIOCBRADDBR = 0x89a0 + SIOCBRADDIF = 0x89a2 + SIOCBRDELBR = 0x89a1 + SIOCBRDELIF = 0x89a3 + SIOCDARP = 0x8953 + SIOCDELDLCI = 0x8981 + SIOCDELMULTI = 0x8932 + SIOCDELRT = 0x890c + SIOCDEVPRIVATE = 0x89f0 + SIOCDIFADDR = 0x8936 + SIOCDRARP = 0x8960 + SIOCETHTOOL = 0x8946 + SIOCGARP = 0x8954 + SIOCGHWTSTAMP = 0x89b1 + SIOCGIFADDR = 0x8915 + SIOCGIFBR = 0x8940 + SIOCGIFBRDADDR = 0x8919 + SIOCGIFCONF = 0x8912 + SIOCGIFCOUNT = 0x8938 + SIOCGIFDSTADDR = 0x8917 + SIOCGIFENCAP = 0x8925 + SIOCGIFFLAGS = 0x8913 + SIOCGIFHWADDR = 0x8927 + SIOCGIFINDEX = 0x8933 + SIOCGIFMAP = 0x8970 + SIOCGIFMEM = 0x891f + SIOCGIFMETRIC = 0x891d + SIOCGIFMTU = 0x8921 + SIOCGIFNAME = 0x8910 + SIOCGIFNETMASK = 0x891b + SIOCGIFPFLAGS = 0x8935 + SIOCGIFSLAVE = 0x8929 + SIOCGIFTXQLEN = 0x8942 + SIOCGIFVLAN = 0x8982 + SIOCGMIIPHY = 0x8947 + SIOCGMIIREG = 0x8948 + SIOCGPGRP = 0x8904 + SIOCGRARP = 0x8961 + SIOCGSTAMP = 0x8906 + SIOCGSTAMPNS = 0x8907 + SIOCINQ = 0x4004667f + SIOCOUTQ = 0x40047473 + SIOCOUTQNSD = 0x894b + SIOCPROTOPRIVATE = 0x89e0 + SIOCRTMSG = 0x890d + SIOCSARP = 0x8955 + SIOCSHWTSTAMP = 0x89b0 + SIOCSIFADDR = 0x8916 + SIOCSIFBR = 0x8941 + SIOCSIFBRDADDR = 0x891a + SIOCSIFDSTADDR = 0x8918 + SIOCSIFENCAP = 0x8926 + SIOCSIFFLAGS = 0x8914 + SIOCSIFHWADDR = 0x8924 + SIOCSIFHWBROADCAST = 0x8937 + SIOCSIFLINK = 0x8911 + SIOCSIFMAP = 0x8971 + SIOCSIFMEM = 0x8920 + SIOCSIFMETRIC = 0x891e + SIOCSIFMTU = 0x8922 + SIOCSIFNAME = 0x8923 + SIOCSIFNETMASK = 0x891c + SIOCSIFPFLAGS = 0x8934 + SIOCSIFSLAVE = 0x8930 + SIOCSIFTXQLEN = 0x8943 + SIOCSIFVLAN = 0x8983 + SIOCSMIIREG = 0x8949 + SIOCSPGRP = 0x8902 + SIOCSRARP = 0x8962 + SIOCWANDEV = 0x894a + SOCK_CLOEXEC = 0x400000 + SOCK_DCCP = 0x6 + SOCK_DGRAM = 0x2 + SOCK_NONBLOCK = 0x4000 + SOCK_PACKET = 0xa + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_AAL = 0x109 + SOL_ALG = 0x117 + SOL_ATM = 0x108 + SOL_CAIF = 0x116 + SOL_DCCP = 0x10d + SOL_DECNET = 0x105 + SOL_ICMPV6 = 0x3a + SOL_IP = 0x0 + SOL_IPV6 = 0x29 + SOL_IRDA = 0x10a + SOL_IUCV = 0x115 + SOL_KCM = 0x119 + SOL_LLC = 0x10c + SOL_NETBEUI = 0x10b + SOL_NETLINK = 0x10e + SOL_NFC = 0x118 + SOL_PACKET = 0x107 + SOL_PNPIPE = 0x113 + SOL_PPPOL2TP = 0x111 + SOL_RAW = 0xff + SOL_RDS = 0x114 + SOL_RXRPC = 0x110 + SOL_SOCKET = 0xffff + SOL_TCP = 0x6 + SOL_TIPC = 0x10f + SOL_X25 = 0x106 + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x8000 + SO_ATTACH_BPF = 0x34 + SO_ATTACH_FILTER = 0x1a + SO_ATTACH_REUSEPORT_CBPF = 0x35 + SO_ATTACH_REUSEPORT_EBPF = 0x36 + SO_BINDTODEVICE = 0xd + SO_BPF_EXTENSIONS = 0x32 + SO_BROADCAST = 0x20 + SO_BSDCOMPAT = 0x400 + SO_BUSY_POLL = 0x30 + SO_CNX_ADVICE = 0x37 + SO_DEBUG = 0x1 + SO_DETACH_BPF = 0x1b + SO_DETACH_FILTER = 0x1b + SO_DOMAIN = 0x1029 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_GET_FILTER = 0x1a + SO_INCOMING_CPU = 0x33 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_LOCK_FILTER = 0x28 + SO_MARK = 0x22 + SO_MAX_PACING_RATE = 0x31 + SO_NOFCS = 0x27 + SO_NO_CHECK = 0xb + SO_OOBINLINE = 0x100 + SO_PASSCRED = 0x2 + SO_PASSSEC = 0x1f + SO_PEEK_OFF = 0x26 + SO_PEERCRED = 0x40 + SO_PEERNAME = 0x1c + SO_PEERSEC = 0x1e + SO_PRIORITY = 0xc + SO_PROTOCOL = 0x1028 + SO_RCVBUF = 0x1002 + SO_RCVBUFFORCE = 0x100b + SO_RCVLOWAT = 0x800 + SO_RCVTIMEO = 0x2000 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RXQ_OVFL = 0x24 + SO_SECURITY_AUTHENTICATION = 0x5001 + SO_SECURITY_ENCRYPTION_NETWORK = 0x5004 + SO_SECURITY_ENCRYPTION_TRANSPORT = 0x5002 + SO_SELECT_ERR_QUEUE = 0x29 + SO_SNDBUF = 0x1001 + SO_SNDBUFFORCE = 0x100a + SO_SNDLOWAT = 0x1000 + SO_SNDTIMEO = 0x4000 + SO_TIMESTAMP = 0x1d + SO_TIMESTAMPING = 0x23 + SO_TIMESTAMPNS = 0x21 + SO_TYPE = 0x1008 + SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 + SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 + SO_VM_SOCKETS_BUFFER_SIZE = 0x0 + SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6 + SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7 + SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 + SO_VM_SOCKETS_TRUSTED = 0x5 + SO_WIFI_STATUS = 0x25 + SPLICE_F_GIFT = 0x8 + SPLICE_F_MORE = 0x4 + SPLICE_F_MOVE = 0x1 + SPLICE_F_NONBLOCK = 0x2 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x800 + TAB2 = 0x1000 + TAB3 = 0x1800 + TABDLY = 0x1800 + TCFLSH = 0x20005407 + TCGETA = 0x40125401 + TCGETS = 0x40245408 + TCGETS2 = 0x402c540c + TCIFLUSH = 0x0 + TCIOFF = 0x2 + TCIOFLUSH = 0x2 + TCION = 0x3 + TCOFLUSH = 0x1 + TCOOFF = 0x0 + TCOON = 0x1 + TCP_CC_INFO = 0x1a + TCP_CONGESTION = 0xd + TCP_COOKIE_IN_ALWAYS = 0x1 + TCP_COOKIE_MAX = 0x10 + TCP_COOKIE_MIN = 0x8 + TCP_COOKIE_OUT_NEVER = 0x2 + TCP_COOKIE_PAIR_SIZE = 0x20 + TCP_COOKIE_TRANSACTIONS = 0xf + TCP_CORK = 0x3 + TCP_DEFER_ACCEPT = 0x9 + TCP_FASTOPEN = 0x17 + TCP_INFO = 0xb + TCP_KEEPCNT = 0x6 + TCP_KEEPIDLE = 0x4 + TCP_KEEPINTVL = 0x5 + TCP_LINGER2 = 0x8 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0xe + TCP_MD5SIG_MAXKEYLEN = 0x50 + TCP_MSS = 0x200 + TCP_MSS_DEFAULT = 0x218 + TCP_MSS_DESIRED = 0x4c4 + TCP_NODELAY = 0x1 + TCP_NOTSENT_LOWAT = 0x19 + TCP_QUEUE_SEQ = 0x15 + TCP_QUICKACK = 0xc + TCP_REPAIR = 0x13 + TCP_REPAIR_OPTIONS = 0x16 + TCP_REPAIR_QUEUE = 0x14 + TCP_SAVED_SYN = 0x1c + TCP_SAVE_SYN = 0x1b + TCP_SYNCNT = 0x7 + TCP_S_DATA_IN = 0x4 + TCP_S_DATA_OUT = 0x8 + TCP_THIN_DUPACK = 0x11 + TCP_THIN_LINEAR_TIMEOUTS = 0x10 + TCP_TIMESTAMP = 0x18 + TCP_USER_TIMEOUT = 0x12 + TCP_WINDOW_CLAMP = 0xa + TCSAFLUSH = 0x2 + TCSBRK = 0x20005405 + TCSBRKP = 0x5425 + TCSETA = 0x80125402 + TCSETAF = 0x80125404 + TCSETAW = 0x80125403 + TCSETS = 0x80245409 + TCSETS2 = 0x802c540d + TCSETSF = 0x8024540b + TCSETSF2 = 0x802c540f + TCSETSW = 0x8024540a + TCSETSW2 = 0x802c540e + TCXONC = 0x20005406 + TIOCCBRK = 0x2000747a + TIOCCONS = 0x20007424 + TIOCEXCL = 0x2000740d + TIOCGDEV = 0x40045432 + TIOCGETD = 0x40047400 + TIOCGEXCL = 0x40045440 + TIOCGICOUNT = 0x545d + TIOCGLCKTRMIOS = 0x5456 + TIOCGPGRP = 0x40047483 + TIOCGPKT = 0x40045438 + TIOCGPTLCK = 0x40045439 + TIOCGPTN = 0x40047486 + TIOCGRS485 = 0x40205441 + TIOCGSERIAL = 0x541e + TIOCGSID = 0x40047485 + TIOCGSOFTCAR = 0x40047464 + TIOCGWINSZ = 0x40087468 + TIOCINQ = 0x4004667f + TIOCLINUX = 0x541c + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMIWAIT = 0x545c + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_LOOP = 0x8000 + TIOCM_OUT1 = 0x2000 + TIOCM_OUT2 = 0x4000 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007484 + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETD = 0x80047401 + TIOCSIG = 0x80047488 + TIOCSLCKTRMIOS = 0x5457 + TIOCSPGRP = 0x80047482 + TIOCSPTLCK = 0x80047487 + TIOCSRS485 = 0xc0205442 + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x80047465 + TIOCSTART = 0x2000746e + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCVHANGUP = 0x20005437 + TOSTOP = 0x100 + TUNATTACHFILTER = 0x801054d5 + TUNDETACHFILTER = 0x801054d6 + TUNGETFEATURES = 0x400454cf + TUNGETFILTER = 0x401054db + TUNGETIFF = 0x400454d2 + TUNGETSNDBUF = 0x400454d3 + TUNGETVNETBE = 0x400454df + TUNGETVNETHDRSZ = 0x400454d7 + TUNGETVNETLE = 0x400454dd + TUNSETDEBUG = 0x800454c9 + TUNSETGROUP = 0x800454ce + TUNSETIFF = 0x800454ca + TUNSETIFINDEX = 0x800454da + TUNSETLINK = 0x800454cd + TUNSETNOCSUM = 0x800454c8 + TUNSETOFFLOAD = 0x800454d0 + TUNSETOWNER = 0x800454cc + TUNSETPERSIST = 0x800454cb + TUNSETQUEUE = 0x800454d9 + TUNSETSNDBUF = 0x800454d4 + TUNSETTXFILTER = 0x800454d1 + TUNSETVNETBE = 0x800454de + TUNSETVNETHDRSZ = 0x800454d8 + TUNSETVNETLE = 0x800454dc + VDISCARD = 0xd + VDSUSP = 0xb + VEOF = 0x4 + VEOL = 0x5 + VEOL2 = 0x6 + VERASE = 0x2 + VINTR = 0x0 + VKILL = 0x3 + VLNEXT = 0xf + VMADDR_CID_ANY = 0xffffffff + VMADDR_CID_HOST = 0x2 + VMADDR_CID_HYPERVISOR = 0x0 + VMADDR_CID_RESERVED = 0x1 + VMADDR_PORT_ANY = 0xffffffff + VMIN = 0x4 + VQUIT = 0x1 + VREPRINT = 0xc + VSTART = 0x8 + VSTOP = 0x9 + VSUSP = 0xa + VSWTC = 0x7 + VT0 = 0x0 + VT1 = 0x4000 + VTDLY = 0x4000 + VTIME = 0x5 + VWERASE = 0xe + WALL = 0x40000000 + WCLONE = 0x80000000 + WCONTINUED = 0x8 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOTHREAD = 0x20000000 + WNOWAIT = 0x1000000 + WORDSIZE = 0x40 + WRAP = 0x20000 + WSTOPPED = 0x2 + WUNTRACED = 0x2 + XCASE = 0x4 + XTABS = 0x1800 + __TIOCFLUSH = 0x80047410 ) // Errors @@ -2820,182 +1969,174 @@ const ( ) // Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "no such device or address"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EAGAIN", "resource temporarily unavailable"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "device or resource busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "invalid cross-device link"}, - {19, "ENODEV", "no such device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "numerical result out of range"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "cannot assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "transport endpoint is already connected"}, - {57, "ENOTCONN", "transport endpoint is not connected"}, - {58, "ESHUTDOWN", "cannot send after transport endpoint shutdown"}, - {59, "ETOOMANYREFS", "too many references: cannot splice"}, - {60, "ETIMEDOUT", "connection timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disk quota exceeded"}, - {70, "ESTALE", "stale file handle"}, - {71, "EREMOTE", "object is remote"}, - {72, "ENOSTR", "device not a stream"}, - {73, "ETIME", "timer expired"}, - {74, "ENOSR", "out of streams resources"}, - {75, "ENOMSG", "no message of desired type"}, - {76, "EBADMSG", "bad message"}, - {77, "EIDRM", "identifier removed"}, - {78, "EDEADLK", "resource deadlock avoided"}, - {79, "ENOLCK", "no locks available"}, - {80, "ENONET", "machine is not on the network"}, - {81, "ERREMOTE", "unknown error 81"}, - {82, "ENOLINK", "link has been severed"}, - {83, "EADV", "advertise error"}, - {84, "ESRMNT", "srmount error"}, - {85, "ECOMM", "communication error on send"}, - {86, "EPROTO", "protocol error"}, - {87, "EMULTIHOP", "multihop attempted"}, - {88, "EDOTDOT", "RFS specific error"}, - {89, "EREMCHG", "remote address changed"}, - {90, "ENOSYS", "function not implemented"}, - {91, "ESTRPIPE", "streams pipe error"}, - {92, "EOVERFLOW", "value too large for defined data type"}, - {93, "EBADFD", "file descriptor in bad state"}, - {94, "ECHRNG", "channel number out of range"}, - {95, "EL2NSYNC", "level 2 not synchronized"}, - {96, "EL3HLT", "level 3 halted"}, - {97, "EL3RST", "level 3 reset"}, - {98, "ELNRNG", "link number out of range"}, - {99, "EUNATCH", "protocol driver not attached"}, - {100, "ENOCSI", "no CSI structure available"}, - {101, "EL2HLT", "level 2 halted"}, - {102, "EBADE", "invalid exchange"}, - {103, "EBADR", "invalid request descriptor"}, - {104, "EXFULL", "exchange full"}, - {105, "ENOANO", "no anode"}, - {106, "EBADRQC", "invalid request code"}, - {107, "EBADSLT", "invalid slot"}, - {108, "EDEADLOCK", "file locking deadlock error"}, - {109, "EBFONT", "bad font file format"}, - {110, "ELIBEXEC", "cannot exec a shared library directly"}, - {111, "ENODATA", "no data available"}, - {112, "ELIBBAD", "accessing a corrupted shared library"}, - {113, "ENOPKG", "package not installed"}, - {114, "ELIBACC", "can not access a needed shared library"}, - {115, "ENOTUNIQ", "name not unique on network"}, - {116, "ERESTART", "interrupted system call should be restarted"}, - {117, "EUCLEAN", "structure needs cleaning"}, - {118, "ENOTNAM", "not a XENIX named type file"}, - {119, "ENAVAIL", "no XENIX semaphores available"}, - {120, "EISNAM", "is a named type file"}, - {121, "EREMOTEIO", "remote I/O error"}, - {122, "EILSEQ", "invalid or incomplete multibyte or wide character"}, - {123, "ELIBMAX", "attempting to link in too many shared libraries"}, - {124, "ELIBSCN", ".lib section in a.out corrupted"}, - {125, "ENOMEDIUM", "no medium found"}, - {126, "EMEDIUMTYPE", "wrong medium type"}, - {127, "ECANCELED", "operation canceled"}, - {128, "ENOKEY", "required key not available"}, - {129, "EKEYEXPIRED", "key has expired"}, - {130, "EKEYREVOKED", "key has been revoked"}, - {131, "EKEYREJECTED", "key was rejected by service"}, - {132, "EOWNERDEAD", "owner died"}, - {133, "ENOTRECOVERABLE", "state not recoverable"}, - {134, "ERFKILL", "operation not possible due to RF-kill"}, - {135, "EHWPOISON", "memory page has hardware error"}, +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol", + 48: "address already in use", + 49: "cannot assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "transport endpoint is already connected", + 57: "transport endpoint is not connected", + 58: "cannot send after transport endpoint shutdown", + 59: "too many references: cannot splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale file handle", + 71: "object is remote", + 72: "device not a stream", + 73: "timer expired", + 74: "out of streams resources", + 75: "no message of desired type", + 76: "bad message", + 77: "identifier removed", + 78: "resource deadlock avoided", + 79: "no locks available", + 80: "machine is not on the network", + 81: "unknown error 81", + 82: "link has been severed", + 83: "advertise error", + 84: "srmount error", + 85: "communication error on send", + 86: "protocol error", + 87: "multihop attempted", + 88: "RFS specific error", + 89: "remote address changed", + 90: "function not implemented", + 91: "streams pipe error", + 92: "value too large for defined data type", + 93: "file descriptor in bad state", + 94: "channel number out of range", + 95: "level 2 not synchronized", + 96: "level 3 halted", + 97: "level 3 reset", + 98: "link number out of range", + 99: "protocol driver not attached", + 100: "no CSI structure available", + 101: "level 2 halted", + 102: "invalid exchange", + 103: "invalid request descriptor", + 104: "exchange full", + 105: "no anode", + 106: "invalid request code", + 107: "invalid slot", + 108: "file locking deadlock error", + 109: "bad font file format", + 110: "cannot exec a shared library directly", + 111: "no data available", + 112: "accessing a corrupted shared library", + 113: "package not installed", + 114: "can not access a needed shared library", + 115: "name not unique on network", + 116: "interrupted system call should be restarted", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "invalid or incomplete multibyte or wide character", + 123: "attempting to link in too many shared libraries", + 124: ".lib section in a.out corrupted", + 125: "no medium found", + 126: "wrong medium type", + 127: "operation canceled", + 128: "required key not available", + 129: "key has expired", + 130: "key has been revoked", + 131: "key was rejected by service", + 132: "owner died", + 133: "state not recoverable", + 134: "operation not possible due to RF-kill", + 135: "memory page has hardware error", } // Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/breakpoint trap"}, - {6, "SIGABRT", "aborted"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "stopped (signal)"}, - {18, "SIGTSTP", "stopped"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "CPU time limit exceeded"}, - {25, "SIGXFSZ", "file size limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window changed"}, - {29, "SIGLOST", "power failure"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "resource lost", + 30: "user defined signal 1", + 31: "user defined signal 2", } diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 78cc04ea..19316b1d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -1020,43 +1020,6 @@ const ( MAP_WIRED = 0x800 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_BASIC_FLAGS = 0xe782807f - MNT_DEFEXPORTED = 0x200 - MNT_DISCARD = 0x800000 - MNT_EXKERB = 0x800 - MNT_EXNORESPORT = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x10000000 - MNT_EXRDONLY = 0x80 - MNT_EXTATTR = 0x1000000 - MNT_FORCE = 0x80000 - MNT_GETARGS = 0x400000 - MNT_IGNORE = 0x100000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_LOG = 0x2000000 - MNT_NOATIME = 0x4000000 - MNT_NOCOREDUMP = 0x8000 - MNT_NODEV = 0x10 - MNT_NODEVMTIME = 0x40000000 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_OP_FLAGS = 0x4d0000 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELATIME = 0x20000 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x80000000 - MNT_SYMPERM = 0x20000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xff90ffff - MNT_WAIT = 0x1 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CONTROLMBUF = 0x2000000 @@ -1150,10 +1113,7 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 92185e69..f2cf500f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -1010,43 +1010,6 @@ const ( MAP_WIRED = 0x800 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_BASIC_FLAGS = 0xe782807f - MNT_DEFEXPORTED = 0x200 - MNT_DISCARD = 0x800000 - MNT_EXKERB = 0x800 - MNT_EXNORESPORT = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x10000000 - MNT_EXRDONLY = 0x80 - MNT_EXTATTR = 0x1000000 - MNT_FORCE = 0x80000 - MNT_GETARGS = 0x400000 - MNT_IGNORE = 0x100000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_LOG = 0x2000000 - MNT_NOATIME = 0x4000000 - MNT_NOCOREDUMP = 0x8000 - MNT_NODEV = 0x10 - MNT_NODEVMTIME = 0x40000000 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_OP_FLAGS = 0x4d0000 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELATIME = 0x20000 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x80000000 - MNT_SYMPERM = 0x20000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xff90ffff - MNT_WAIT = 0x1 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CONTROLMBUF = 0x2000000 @@ -1140,10 +1103,7 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index 373ad454..858e2999 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -1000,43 +1000,6 @@ const ( MAP_STACK = 0x2000 MAP_TRYFIXED = 0x400 MAP_WIRED = 0x800 - MNT_ASYNC = 0x40 - MNT_BASIC_FLAGS = 0xe782807f - MNT_DEFEXPORTED = 0x200 - MNT_DISCARD = 0x800000 - MNT_EXKERB = 0x800 - MNT_EXNORESPORT = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x10000000 - MNT_EXRDONLY = 0x80 - MNT_EXTATTR = 0x1000000 - MNT_FORCE = 0x80000 - MNT_GETARGS = 0x400000 - MNT_IGNORE = 0x100000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_LOG = 0x2000000 - MNT_NOATIME = 0x4000000 - MNT_NOCOREDUMP = 0x8000 - MNT_NODEV = 0x10 - MNT_NODEVMTIME = 0x40000000 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_OP_FLAGS = 0x4d0000 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELATIME = 0x20000 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x80000000 - MNT_SYMPERM = 0x20000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xff90ffff - MNT_WAIT = 0x1 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CONTROLMBUF = 0x2000000 @@ -1130,10 +1093,7 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go deleted file mode 100644 index fb6c6044..00000000 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ /dev/null @@ -1,1762 +0,0 @@ -// mkerrors.sh -m64 -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,netbsd - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_ARP = 0x1c - AF_BLUETOOTH = 0x1f - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1a - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x20 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x18 - AF_IPX = 0x17 - AF_ISDN = 0x1a - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x23 - AF_MPLS = 0x21 - AF_NATM = 0x1b - AF_NS = 0x6 - AF_OROUTE = 0x11 - AF_OSI = 0x7 - AF_PUP = 0x4 - AF_ROUTE = 0x22 - AF_SNA = 0xb - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - ARPHRD_ARCNET = 0x7 - ARPHRD_ETHER = 0x1 - ARPHRD_FRELAY = 0xf - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - ARPHRD_STRIP = 0x17 - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B460800 = 0x70800 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B921600 = 0xe1000 - B9600 = 0x2580 - BIOCFEEDBACK = 0x8004427d - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc0104277 - BIOCGETIF = 0x4090426b - BIOCGFEEDBACK = 0x4004427c - BIOCGHDRCMPLT = 0x40044274 - BIOCGRTIMEOUT = 0x4010427b - BIOCGSEESENT = 0x40044278 - BIOCGSTATS = 0x4080426f - BIOCGSTATSOLD = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044276 - BIOCSETF = 0x80104267 - BIOCSETIF = 0x8090426c - BIOCSFEEDBACK = 0x8004427d - BIOCSHDRCMPLT = 0x80044275 - BIOCSRTIMEOUT = 0x8010427a - BIOCSSEESENT = 0x80044279 - BIOCSTCPF = 0x80104272 - BIOCSUDPF = 0x80104273 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x8 - BPF_ALIGNMENT32 = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DFLTBUFSIZE = 0x100000 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x1000000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLONE_CSIGNAL = 0xff - CLONE_FILES = 0x400 - CLONE_FS = 0x200 - CLONE_PID = 0x1000 - CLONE_PTRACE = 0x2000 - CLONE_SIGHAND = 0x800 - CLONE_VFORK = 0x4000 - CLONE_VM = 0x100 - CREAD = 0x800 - CRTSCTS = 0x10000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - CTL_QUERY = -0x2 - DIOCBSFLUSH = 0x20006478 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HDLC = 0x10 - DLT_HHDLC = 0x79 - DLT_HIPPI = 0xf - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0xe - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RAWAF_MASK = 0x2240000 - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xd - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EMUL_LINUX = 0x1 - EMUL_LINUX32 = 0x5 - EMUL_MAXID = 0x6 - ETHERCAP_JUMBO_MTU = 0x4 - ETHERCAP_VLAN_HWTAGGING = 0x2 - ETHERCAP_VLAN_MTU = 0x1 - ETHERMIN = 0x2e - ETHERMTU = 0x5dc - ETHERMTU_JUMBO = 0x2328 - ETHERTYPE_8023 = 0x4 - ETHERTYPE_AARP = 0x80f3 - ETHERTYPE_ACCTON = 0x8390 - ETHERTYPE_AEONIC = 0x8036 - ETHERTYPE_ALPHA = 0x814a - ETHERTYPE_AMBER = 0x6008 - ETHERTYPE_AMOEBA = 0x8145 - ETHERTYPE_APOLLO = 0x80f7 - ETHERTYPE_APOLLODOMAIN = 0x8019 - ETHERTYPE_APPLETALK = 0x809b - ETHERTYPE_APPLITEK = 0x80c7 - ETHERTYPE_ARGONAUT = 0x803a - ETHERTYPE_ARP = 0x806 - ETHERTYPE_AT = 0x809b - ETHERTYPE_ATALK = 0x809b - ETHERTYPE_ATOMIC = 0x86df - ETHERTYPE_ATT = 0x8069 - ETHERTYPE_ATTSTANFORD = 0x8008 - ETHERTYPE_AUTOPHON = 0x806a - ETHERTYPE_AXIS = 0x8856 - ETHERTYPE_BCLOOP = 0x9003 - ETHERTYPE_BOFL = 0x8102 - ETHERTYPE_CABLETRON = 0x7034 - ETHERTYPE_CHAOS = 0x804 - ETHERTYPE_COMDESIGN = 0x806c - ETHERTYPE_COMPUGRAPHIC = 0x806d - ETHERTYPE_COUNTERPOINT = 0x8062 - ETHERTYPE_CRONUS = 0x8004 - ETHERTYPE_CRONUSVLN = 0x8003 - ETHERTYPE_DCA = 0x1234 - ETHERTYPE_DDE = 0x807b - ETHERTYPE_DEBNI = 0xaaaa - ETHERTYPE_DECAM = 0x8048 - ETHERTYPE_DECCUST = 0x6006 - ETHERTYPE_DECDIAG = 0x6005 - ETHERTYPE_DECDNS = 0x803c - ETHERTYPE_DECDTS = 0x803e - ETHERTYPE_DECEXPER = 0x6000 - ETHERTYPE_DECLAST = 0x8041 - ETHERTYPE_DECLTM = 0x803f - ETHERTYPE_DECMUMPS = 0x6009 - ETHERTYPE_DECNETBIOS = 0x8040 - ETHERTYPE_DELTACON = 0x86de - ETHERTYPE_DIDDLE = 0x4321 - ETHERTYPE_DLOG1 = 0x660 - ETHERTYPE_DLOG2 = 0x661 - ETHERTYPE_DN = 0x6003 - ETHERTYPE_DOGFIGHT = 0x1989 - ETHERTYPE_DSMD = 0x8039 - ETHERTYPE_ECMA = 0x803 - ETHERTYPE_ENCRYPT = 0x803d - ETHERTYPE_ES = 0x805d - ETHERTYPE_EXCELAN = 0x8010 - ETHERTYPE_EXPERDATA = 0x8049 - ETHERTYPE_FLIP = 0x8146 - ETHERTYPE_FLOWCONTROL = 0x8808 - ETHERTYPE_FRARP = 0x808 - ETHERTYPE_GENDYN = 0x8068 - ETHERTYPE_HAYES = 0x8130 - ETHERTYPE_HIPPI_FP = 0x8180 - ETHERTYPE_HITACHI = 0x8820 - ETHERTYPE_HP = 0x8005 - ETHERTYPE_IEEEPUP = 0xa00 - ETHERTYPE_IEEEPUPAT = 0xa01 - ETHERTYPE_IMLBL = 0x4c42 - ETHERTYPE_IMLBLDIAG = 0x424c - ETHERTYPE_IP = 0x800 - ETHERTYPE_IPAS = 0x876c - ETHERTYPE_IPV6 = 0x86dd - ETHERTYPE_IPX = 0x8137 - ETHERTYPE_IPXNEW = 0x8037 - ETHERTYPE_KALPANA = 0x8582 - ETHERTYPE_LANBRIDGE = 0x8038 - ETHERTYPE_LANPROBE = 0x8888 - ETHERTYPE_LAT = 0x6004 - ETHERTYPE_LBACK = 0x9000 - ETHERTYPE_LITTLE = 0x8060 - ETHERTYPE_LOGICRAFT = 0x8148 - ETHERTYPE_LOOPBACK = 0x9000 - ETHERTYPE_MATRA = 0x807a - ETHERTYPE_MAX = 0xffff - ETHERTYPE_MERIT = 0x807c - ETHERTYPE_MICP = 0x873a - ETHERTYPE_MOPDL = 0x6001 - ETHERTYPE_MOPRC = 0x6002 - ETHERTYPE_MOTOROLA = 0x818d - ETHERTYPE_MPLS = 0x8847 - ETHERTYPE_MPLS_MCAST = 0x8848 - ETHERTYPE_MUMPS = 0x813f - ETHERTYPE_NBPCC = 0x3c04 - ETHERTYPE_NBPCLAIM = 0x3c09 - ETHERTYPE_NBPCLREQ = 0x3c05 - ETHERTYPE_NBPCLRSP = 0x3c06 - ETHERTYPE_NBPCREQ = 0x3c02 - ETHERTYPE_NBPCRSP = 0x3c03 - ETHERTYPE_NBPDG = 0x3c07 - ETHERTYPE_NBPDGB = 0x3c08 - ETHERTYPE_NBPDLTE = 0x3c0a - ETHERTYPE_NBPRAR = 0x3c0c - ETHERTYPE_NBPRAS = 0x3c0b - ETHERTYPE_NBPRST = 0x3c0d - ETHERTYPE_NBPSCD = 0x3c01 - ETHERTYPE_NBPVCD = 0x3c00 - ETHERTYPE_NBS = 0x802 - ETHERTYPE_NCD = 0x8149 - ETHERTYPE_NESTAR = 0x8006 - ETHERTYPE_NETBEUI = 0x8191 - ETHERTYPE_NOVELL = 0x8138 - ETHERTYPE_NS = 0x600 - ETHERTYPE_NSAT = 0x601 - ETHERTYPE_NSCOMPAT = 0x807 - ETHERTYPE_NTRAILER = 0x10 - ETHERTYPE_OS9 = 0x7007 - ETHERTYPE_OS9NET = 0x7009 - ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e - ETHERTYPE_PCS = 0x4242 - ETHERTYPE_PLANNING = 0x8044 - ETHERTYPE_PPP = 0x880b - ETHERTYPE_PPPOE = 0x8864 - ETHERTYPE_PPPOEDISC = 0x8863 - ETHERTYPE_PRIMENTS = 0x7031 - ETHERTYPE_PUP = 0x200 - ETHERTYPE_PUPAT = 0x200 - ETHERTYPE_RACAL = 0x7030 - ETHERTYPE_RATIONAL = 0x8150 - ETHERTYPE_RAWFR = 0x6559 - ETHERTYPE_RCL = 0x1995 - ETHERTYPE_RDP = 0x8739 - ETHERTYPE_RETIX = 0x80f2 - ETHERTYPE_REVARP = 0x8035 - ETHERTYPE_SCA = 0x6007 - ETHERTYPE_SECTRA = 0x86db - ETHERTYPE_SECUREDATA = 0x876d - ETHERTYPE_SGITW = 0x817e - ETHERTYPE_SG_BOUNCE = 0x8016 - ETHERTYPE_SG_DIAG = 0x8013 - ETHERTYPE_SG_NETGAMES = 0x8014 - ETHERTYPE_SG_RESV = 0x8015 - ETHERTYPE_SIMNET = 0x5208 - ETHERTYPE_SLOWPROTOCOLS = 0x8809 - ETHERTYPE_SNA = 0x80d5 - ETHERTYPE_SNMP = 0x814c - ETHERTYPE_SONIX = 0xfaf5 - ETHERTYPE_SPIDER = 0x809f - ETHERTYPE_SPRITE = 0x500 - ETHERTYPE_STP = 0x8181 - ETHERTYPE_TALARIS = 0x812b - ETHERTYPE_TALARISMC = 0x852b - ETHERTYPE_TCPCOMP = 0x876b - ETHERTYPE_TCPSM = 0x9002 - ETHERTYPE_TEC = 0x814f - ETHERTYPE_TIGAN = 0x802f - ETHERTYPE_TRAIL = 0x1000 - ETHERTYPE_TRANSETHER = 0x6558 - ETHERTYPE_TYMSHARE = 0x802e - ETHERTYPE_UBBST = 0x7005 - ETHERTYPE_UBDEBUG = 0x900 - ETHERTYPE_UBDIAGLOOP = 0x7002 - ETHERTYPE_UBDL = 0x7000 - ETHERTYPE_UBNIU = 0x7001 - ETHERTYPE_UBNMC = 0x7003 - ETHERTYPE_VALID = 0x1600 - ETHERTYPE_VARIAN = 0x80dd - ETHERTYPE_VAXELN = 0x803b - ETHERTYPE_VEECO = 0x8067 - ETHERTYPE_VEXP = 0x805b - ETHERTYPE_VGLAB = 0x8131 - ETHERTYPE_VINES = 0xbad - ETHERTYPE_VINESECHO = 0xbaf - ETHERTYPE_VINESLOOP = 0xbae - ETHERTYPE_VITAL = 0xff00 - ETHERTYPE_VLAN = 0x8100 - ETHERTYPE_VLTLMAN = 0x8080 - ETHERTYPE_VPROD = 0x805c - ETHERTYPE_VURESERVED = 0x8147 - ETHERTYPE_WATERLOO = 0x8130 - ETHERTYPE_WELLFLEET = 0x8103 - ETHERTYPE_X25 = 0x805 - ETHERTYPE_X75 = 0x801 - ETHERTYPE_XNSSM = 0x9001 - ETHERTYPE_XTP = 0x817d - ETHER_ADDR_LEN = 0x6 - ETHER_CRC_LEN = 0x4 - ETHER_CRC_POLY_BE = 0x4c11db6 - ETHER_CRC_POLY_LE = 0xedb88320 - ETHER_HDR_LEN = 0xe - ETHER_MAX_LEN = 0x5ee - ETHER_MAX_LEN_JUMBO = 0x233a - ETHER_MIN_LEN = 0x40 - ETHER_PPPOE_ENCAP_LEN = 0x8 - ETHER_TYPE_LEN = 0x2 - ETHER_VLAN_ENCAP_LEN = 0x4 - EVFILT_AIO = 0x2 - EVFILT_PROC = 0x4 - EVFILT_READ = 0x0 - EVFILT_SIGNAL = 0x5 - EVFILT_SYSCOUNT = 0x7 - EVFILT_TIMER = 0x6 - EVFILT_VNODE = 0x3 - EVFILT_WRITE = 0x1 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_SYSFLAGS = 0xf000 - EXTA = 0x4b00 - EXTATTR_CMD_START = 0x1 - EXTATTR_CMD_STOP = 0x2 - EXTATTR_NAMESPACE_SYSTEM = 0x2 - EXTATTR_NAMESPACE_USER = 0x1 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x100 - FLUSHO = 0x800000 - F_CLOSEM = 0xa - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0xc - F_FSCTL = -0x80000000 - F_FSDIRMASK = 0x70000000 - F_FSIN = 0x10000000 - F_FSINOUT = 0x30000000 - F_FSOUT = 0x20000000 - F_FSPRIV = 0x8000 - F_FSVOID = 0x40000000 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETNOSIGPIPE = 0xd - F_GETOWN = 0x5 - F_MAXFD = 0xb - F_OK = 0x0 - F_PARAM_MASK = 0xfff - F_PARAM_MAX = 0xfff - F_RDLCK = 0x1 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETNOSIGPIPE = 0xe - F_SETOWN = 0x6 - F_UNLCK = 0x2 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFAN_ARRIVAL = 0x0 - IFAN_DEPARTURE = 0x1 - IFA_ROUTE = 0x1 - IFF_ALLMULTI = 0x200 - IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x8f52 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_A12MPPSWITCH = 0x82 - IFT_AAL2 = 0xbb - IFT_AAL5 = 0x31 - IFT_ADSL = 0x5e - IFT_AFLANE8023 = 0x3b - IFT_AFLANE8025 = 0x3c - IFT_ARAP = 0x58 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ASYNC = 0x54 - IFT_ATM = 0x25 - IFT_ATMDXI = 0x69 - IFT_ATMFUNI = 0x6a - IFT_ATMIMA = 0x6b - IFT_ATMLOGICAL = 0x50 - IFT_ATMRADIO = 0xbd - IFT_ATMSUBINTERFACE = 0x86 - IFT_ATMVCIENDPT = 0xc2 - IFT_ATMVIRTUAL = 0x95 - IFT_BGPPOLICYACCOUNTING = 0xa2 - IFT_BRIDGE = 0xd1 - IFT_BSC = 0x53 - IFT_CARP = 0xf8 - IFT_CCTEMUL = 0x3d - IFT_CEPT = 0x13 - IFT_CES = 0x85 - IFT_CHANNEL = 0x46 - IFT_CNR = 0x55 - IFT_COFFEE = 0x84 - IFT_COMPOSITELINK = 0x9b - IFT_DCN = 0x8d - IFT_DIGITALPOWERLINE = 0x8a - IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba - IFT_DLSW = 0x4a - IFT_DOCSCABLEDOWNSTREAM = 0x80 - IFT_DOCSCABLEMACLAYER = 0x7f - IFT_DOCSCABLEUPSTREAM = 0x81 - IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd - IFT_DS0 = 0x51 - IFT_DS0BUNDLE = 0x52 - IFT_DS1FDL = 0xaa - IFT_DS3 = 0x1e - IFT_DTM = 0x8c - IFT_DVBASILN = 0xac - IFT_DVBASIOUT = 0xad - IFT_DVBRCCDOWNSTREAM = 0x93 - IFT_DVBRCCMACLAYER = 0x92 - IFT_DVBRCCUPSTREAM = 0x94 - IFT_ECONET = 0xce - IFT_EON = 0x19 - IFT_EPLRS = 0x57 - IFT_ESCON = 0x49 - IFT_ETHER = 0x6 - IFT_FAITH = 0xf2 - IFT_FAST = 0x7d - IFT_FASTETHER = 0x3e - IFT_FASTETHERFX = 0x45 - IFT_FDDI = 0xf - IFT_FIBRECHANNEL = 0x38 - IFT_FRAMERELAYINTERCONNECT = 0x3a - IFT_FRAMERELAYMPI = 0x5c - IFT_FRDLCIENDPT = 0xc1 - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_FRF16MFRBUNDLE = 0xa3 - IFT_FRFORWARD = 0x9e - IFT_G703AT2MB = 0x43 - IFT_G703AT64K = 0x42 - IFT_GIF = 0xf0 - IFT_GIGABITETHERNET = 0x75 - IFT_GR303IDT = 0xb2 - IFT_GR303RDT = 0xb1 - IFT_H323GATEKEEPER = 0xa4 - IFT_H323PROXY = 0xa5 - IFT_HDH1822 = 0x3 - IFT_HDLC = 0x76 - IFT_HDSL2 = 0xa8 - IFT_HIPERLAN2 = 0xb7 - IFT_HIPPI = 0x2f - IFT_HIPPIINTERFACE = 0x39 - IFT_HOSTPAD = 0x5a - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IBM370PARCHAN = 0x48 - IFT_IDSL = 0x9a - IFT_IEEE1394 = 0x90 - IFT_IEEE80211 = 0x47 - IFT_IEEE80212 = 0x37 - IFT_IEEE8023ADLAG = 0xa1 - IFT_IFGSN = 0x91 - IFT_IMT = 0xbe - IFT_INFINIBAND = 0xc7 - IFT_INTERLEAVE = 0x7c - IFT_IP = 0x7e - IFT_IPFORWARD = 0x8e - IFT_IPOVERATM = 0x72 - IFT_IPOVERCDLC = 0x6d - IFT_IPOVERCLAW = 0x6e - IFT_IPSWITCH = 0x4e - IFT_ISDN = 0x3f - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISDNS = 0x4b - IFT_ISDNU = 0x4c - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88025CRFPINT = 0x62 - IFT_ISO88025DTR = 0x56 - IFT_ISO88025FIBER = 0x73 - IFT_ISO88026 = 0xa - IFT_ISUP = 0xb3 - IFT_L2VLAN = 0x87 - IFT_L3IPVLAN = 0x88 - IFT_L3IPXVLAN = 0x89 - IFT_LAPB = 0x10 - IFT_LAPD = 0x4d - IFT_LAPF = 0x77 - IFT_LINEGROUP = 0xd2 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MEDIAMAILOVERIP = 0x8b - IFT_MFSIGLINK = 0xa7 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_MPC = 0x71 - IFT_MPLS = 0xa6 - IFT_MPLSTUNNEL = 0x96 - IFT_MSDSL = 0x8f - IFT_MVL = 0xbf - IFT_MYRINET = 0x63 - IFT_NFAS = 0xaf - IFT_NSIP = 0x1b - IFT_OPTICALCHANNEL = 0xc3 - IFT_OPTICALTRANSPORT = 0xc4 - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PLC = 0xae - IFT_PON155 = 0xcf - IFT_PON622 = 0xd0 - IFT_POS = 0xab - IFT_PPP = 0x17 - IFT_PPPMULTILINKBUNDLE = 0x6c - IFT_PROPATM = 0xc5 - IFT_PROPBWAP2MP = 0xb8 - IFT_PROPCNLS = 0x59 - IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 - IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 - IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PROPWIRELESSP2P = 0x9d - IFT_PTPSERIAL = 0x16 - IFT_PVC = 0xf1 - IFT_Q2931 = 0xc9 - IFT_QLLC = 0x44 - IFT_RADIOMAC = 0xbc - IFT_RADSL = 0x5f - IFT_REACHDSL = 0xc0 - IFT_RFC1483 = 0x9f - IFT_RS232 = 0x21 - IFT_RSRB = 0x4f - IFT_SDLC = 0x11 - IFT_SDSL = 0x60 - IFT_SHDSL = 0xa9 - IFT_SIP = 0x1f - IFT_SIPSIG = 0xcc - IFT_SIPTG = 0xcb - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETOVERHEADCHANNEL = 0xb9 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_SRP = 0x97 - IFT_SS7SIGLINK = 0x9c - IFT_STACKTOSTACK = 0x6f - IFT_STARLAN = 0xb - IFT_STF = 0xd7 - IFT_T1 = 0x12 - IFT_TDLC = 0x74 - IFT_TELINK = 0xc8 - IFT_TERMPAD = 0x5b - IFT_TR008 = 0xb0 - IFT_TRANSPHDLC = 0x7b - IFT_TUNNEL = 0x83 - IFT_ULTRA = 0x1d - IFT_USB = 0xa0 - IFT_V11 = 0x40 - IFT_V35 = 0x2d - IFT_V36 = 0x41 - IFT_V37 = 0x78 - IFT_VDSL = 0x61 - IFT_VIRTUALIPADDRESS = 0x70 - IFT_VIRTUALTG = 0xca - IFT_VOICEDID = 0xd5 - IFT_VOICEEM = 0x64 - IFT_VOICEEMFGD = 0xd3 - IFT_VOICEENCAP = 0x67 - IFT_VOICEFGDEANA = 0xd4 - IFT_VOICEFXO = 0x65 - IFT_VOICEFXS = 0x66 - IFT_VOICEOVERATM = 0x98 - IFT_VOICEOVERCABLE = 0xc6 - IFT_VOICEOVERFRAMERELAY = 0x99 - IFT_VOICEOVERIP = 0x68 - IFT_X213 = 0x5d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25HUNTGROUP = 0x7a - IFT_X25MLP = 0x79 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LOOPBACKNET = 0x7f - IPPROTO_AH = 0x33 - IPPROTO_CARP = 0x70 - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPIP = 0x4 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IPV6_ICMP = 0x3a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MOBILE = 0x37 - IPPROTO_NONE = 0x3b - IPPROTO_PFSYNC = 0xf0 - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPPROTO_VRRP = 0x70 - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_DONTFRAG = 0x3e - IPV6_DSTOPTS = 0x32 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FRAGTTL = 0x78 - IPV6_HLIMDEC = 0x1 - IPV6_HOPLIMIT = 0x2f - IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXPACKET = 0xffff - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_NEXTHOP = 0x30 - IPV6_PATHMTU = 0x2c - IPV6_PKTINFO = 0x2e - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVDSTOPTS = 0x28 - IPV6_RECVHOPLIMIT = 0x25 - IPV6_RECVHOPOPTS = 0x27 - IPV6_RECVPATHMTU = 0x2b - IPV6_RECVPKTINFO = 0x24 - IPV6_RECVRTHDR = 0x26 - IPV6_RECVTCLASS = 0x39 - IPV6_RTHDR = 0x33 - IPV6_RTHDRDSTOPTS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x3d - IPV6_UNICAST_HOPS = 0x4 - IPV6_USE_MIN_MTU = 0x2a - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_EF = 0x8000 - IP_ERRORMTU = 0x15 - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x16 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0x14 - IP_MF = 0x2000 - IP_MINFRAGSIZE = 0x45 - IP_MINTTL = 0x18 - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x1 - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVRETOPTS = 0x6 - IP_RECVTTL = 0x17 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_TOS = 0x3 - IP_TTL = 0x4 - ISIG = 0x80 - ISTRIP = 0x20 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x6 - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_SPACEAVAIL = 0x5 - MADV_WILLNEED = 0x3 - MAP_ALIGNMENT_16MB = 0x18000000 - MAP_ALIGNMENT_1TB = 0x28000000 - MAP_ALIGNMENT_256TB = 0x30000000 - MAP_ALIGNMENT_4GB = 0x20000000 - MAP_ALIGNMENT_64KB = 0x10000000 - MAP_ALIGNMENT_64PB = 0x38000000 - MAP_ALIGNMENT_MASK = -0x1000000 - MAP_ALIGNMENT_SHIFT = 0x18 - MAP_ANON = 0x1000 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_INHERIT = 0x80 - MAP_INHERIT_COPY = 0x1 - MAP_INHERIT_DEFAULT = 0x1 - MAP_INHERIT_DONATE_COPY = 0x3 - MAP_INHERIT_NONE = 0x2 - MAP_INHERIT_SHARE = 0x0 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_SHARED = 0x1 - MAP_STACK = 0x2000 - MAP_TRYFIXED = 0x400 - MAP_WIRED = 0x800 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_BASIC_FLAGS = 0xe782807f - MNT_DEFEXPORTED = 0x200 - MNT_DISCARD = 0x800000 - MNT_EXKERB = 0x800 - MNT_EXNORESPORT = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x10000000 - MNT_EXRDONLY = 0x80 - MNT_EXTATTR = 0x1000000 - MNT_FORCE = 0x80000 - MNT_GETARGS = 0x400000 - MNT_IGNORE = 0x100000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_LOG = 0x2000000 - MNT_NOATIME = 0x4000000 - MNT_NOCOREDUMP = 0x8000 - MNT_NODEV = 0x10 - MNT_NODEVMTIME = 0x40000000 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_OP_FLAGS = 0x4d0000 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELATIME = 0x20000 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x80000000 - MNT_SYMPERM = 0x20000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0xff90ffff - MNT_WAIT = 0x1 - MSG_BCAST = 0x100 - MSG_CMSG_CLOEXEC = 0x800 - MSG_CONTROLMBUF = 0x2000000 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOR = 0x8 - MSG_IOVUSRSPACE = 0x4000000 - MSG_LENUSRSPACE = 0x8000000 - MSG_MCAST = 0x200 - MSG_NAMEMBUF = 0x1000000 - MSG_NBIO = 0x1000 - MSG_NOSIGNAL = 0x400 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_TRUNC = 0x10 - MSG_USERFLAGS = 0xffffff - MSG_WAITALL = 0x40 - MS_ASYNC = 0x1 - MS_INVALIDATE = 0x2 - MS_SYNC = 0x4 - NAME_MAX = 0x1ff - NET_RT_DUMP = 0x1 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x5 - NET_RT_MAXID = 0x6 - NET_RT_OIFLIST = 0x4 - NET_RT_OOIFLIST = 0x3 - NOFLSH = 0x80000000 - NOTE_ATTRIB = 0x8 - NOTE_CHILD = 0x4 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXTEND = 0x4 - NOTE_FORK = 0x40000000 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_PCTRLMASK = 0xf0000000 - NOTE_PDATAMASK = 0xfffff - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFIOGETBMAP = 0xc004667a - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - O_ACCMODE = 0x3 - O_ALT_IO = 0x40000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x400000 - O_CREAT = 0x200 - O_DIRECT = 0x80000 - O_DIRECTORY = 0x200000 - O_DSYNC = 0x10000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x8000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_NOSIGPIPE = 0x1000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x20000 - O_SHLOCK = 0x10 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PRI_IOFLUSH = 0x7c - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - RLIMIT_AS = 0xa - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x9 - RTAX_NETMASK = 0x2 - RTAX_TAG = 0x8 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTA_TAG = 0x100 - RTF_ANNOUNCE = 0x20000 - RTF_BLACKHOLE = 0x1000 - RTF_CLONED = 0x2000 - RTF_CLONING = 0x100 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_LLINFO = 0x400 - RTF_MASK = 0x80 - RTF_MODIFIED = 0x20 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_REJECT = 0x8 - RTF_SRC = 0x10000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_CHGADDR = 0x15 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_GET = 0x4 - RTM_IEEE80211 = 0x11 - RTM_IFANNOUNCE = 0x10 - RTM_IFINFO = 0x14 - RTM_LLINFO_UPD = 0x13 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_OIFINFO = 0xf - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_OOIFINFO = 0xe - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_SETGATE = 0x12 - RTM_VERSION = 0x4 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x4 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x8 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80906931 - SIOCADDRT = 0x8038720a - SIOCAIFADDR = 0x8040691a - SIOCALIFADDR = 0x8118691c - SIOCATMARK = 0x40047307 - SIOCDELMULTI = 0x80906932 - SIOCDELRT = 0x8038720b - SIOCDIFADDR = 0x80906919 - SIOCDIFPHYADDR = 0x80906949 - SIOCDLIFADDR = 0x8118691e - SIOCGDRVSPEC = 0xc028697b - SIOCGETPFSYNC = 0xc09069f8 - SIOCGETSGCNT = 0xc0207534 - SIOCGETVIFCNT = 0xc0287533 - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0906921 - SIOCGIFADDRPREF = 0xc0986920 - SIOCGIFALIAS = 0xc040691b - SIOCGIFBRDADDR = 0xc0906923 - SIOCGIFCAP = 0xc0206976 - SIOCGIFCONF = 0xc0106926 - SIOCGIFDATA = 0xc0986985 - SIOCGIFDLT = 0xc0906977 - SIOCGIFDSTADDR = 0xc0906922 - SIOCGIFFLAGS = 0xc0906911 - SIOCGIFGENERIC = 0xc090693a - SIOCGIFMEDIA = 0xc0306936 - SIOCGIFMETRIC = 0xc0906917 - SIOCGIFMTU = 0xc090697e - SIOCGIFNETMASK = 0xc0906925 - SIOCGIFPDSTADDR = 0xc0906948 - SIOCGIFPSRCADDR = 0xc0906947 - SIOCGLIFADDR = 0xc118691d - SIOCGLIFPHYADDR = 0xc118694b - SIOCGLINKSTR = 0xc0286987 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCGVH = 0xc0906983 - SIOCIFCREATE = 0x8090697a - SIOCIFDESTROY = 0x80906979 - SIOCIFGCLONERS = 0xc0106978 - SIOCINITIFADDR = 0xc0706984 - SIOCSDRVSPEC = 0x8028697b - SIOCSETPFSYNC = 0x809069f7 - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8090690c - SIOCSIFADDRPREF = 0x8098691f - SIOCSIFBRDADDR = 0x80906913 - SIOCSIFCAP = 0x80206975 - SIOCSIFDSTADDR = 0x8090690e - SIOCSIFFLAGS = 0x80906910 - SIOCSIFGENERIC = 0x80906939 - SIOCSIFMEDIA = 0xc0906935 - SIOCSIFMETRIC = 0x80906918 - SIOCSIFMTU = 0x8090697f - SIOCSIFNETMASK = 0x80906916 - SIOCSIFPHYADDR = 0x80406946 - SIOCSLIFPHYADDR = 0x8118694a - SIOCSLINKSTR = 0x80286988 - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SIOCSVH = 0xc0906982 - SIOCZIFDATA = 0xc0986986 - SOCK_CLOEXEC = 0x10000000 - SOCK_DGRAM = 0x2 - SOCK_FLAGS_MASK = 0xf0000000 - SOCK_NONBLOCK = 0x20000000 - SOCK_NOSIGPIPE = 0x40000000 - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_ACCEPTFILTER = 0x1000 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LINGER = 0x80 - SO_NOHEADER = 0x100a - SO_NOSIGPIPE = 0x800 - SO_OOBINLINE = 0x100 - SO_OVERFLOWED = 0x1009 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x100c - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x100b - SO_TIMESTAMP = 0x2000 - SO_TYPE = 0x1008 - SO_USELOOPBACK = 0x40 - SYSCTL_VERSION = 0x1000000 - SYSCTL_VERS_0 = 0x0 - SYSCTL_VERS_1 = 0x1000000 - SYSCTL_VERS_MASK = 0xff000000 - S_ARCH1 = 0x10000 - S_ARCH2 = 0x20000 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - S_LOGIN_SET = 0x1 - TCIFLUSH = 0x1 - TCIOFLUSH = 0x3 - TCOFLUSH = 0x2 - TCP_CONGCTL = 0x20 - TCP_KEEPCNT = 0x6 - TCP_KEEPIDLE = 0x3 - TCP_KEEPINIT = 0x7 - TCP_KEEPINTVL = 0x5 - TCP_MAXBURST = 0x4 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0x10 - TCP_MINMSS = 0xd8 - TCP_MSS = 0x218 - TCP_NODELAY = 0x1 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLAG_CDTRCTS = 0x10 - TIOCFLAG_CLOCAL = 0x2 - TIOCFLAG_CRTSCTS = 0x4 - TIOCFLAG_MDMBUF = 0x8 - TIOCFLAG_SOFTCAR = 0x1 - TIOCFLUSH = 0x80047410 - TIOCGETA = 0x402c7413 - TIOCGETD = 0x4004741a - TIOCGFLAGS = 0x4004745d - TIOCGLINED = 0x40207442 - TIOCGPGRP = 0x40047477 - TIOCGQSIZE = 0x40047481 - TIOCGRANTPT = 0x20007447 - TIOCGSID = 0x40047463 - TIOCGSIZE = 0x40087468 - TIOCGWINSZ = 0x40087468 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGET = 0x4004746a - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTMGET = 0x40287446 - TIOCPTSNAME = 0x40287448 - TIOCRCVFRAME = 0x80087445 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCTTY = 0x20007461 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x802c7414 - TIOCSETAF = 0x802c7416 - TIOCSETAW = 0x802c7415 - TIOCSETD = 0x8004741b - TIOCSFLAGS = 0x8004745c - TIOCSIG = 0x2000745f - TIOCSLINED = 0x80207443 - TIOCSPGRP = 0x80047476 - TIOCSQSIZE = 0x80047480 - TIOCSSIZE = 0x80087467 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x80047465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCUCNTL = 0x80047466 - TIOCXMTFRAME = 0x80087444 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VTIME = 0x11 - VWERASE = 0x4 - WALL = 0x8 - WALLSIG = 0x8 - WALTSIG = 0x4 - WCLONE = 0x4 - WCOREFLAG = 0x80 - WNOHANG = 0x1 - WNOWAIT = 0x10000 - WNOZOMBIE = 0x20000 - WOPTSCHECKED = 0x40000 - WSTOPPED = 0x7f - WUNTRACED = 0x2 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADF = syscall.Errno(0x9) - EBADMSG = syscall.Errno(0x58) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x57) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x52) - EILSEQ = syscall.Errno(0x55) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5e) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x59) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x5f) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x53) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x5a) - ENOSTR = syscall.Errno(0x5b) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x56) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x2d) - EOVERFLOW = syscall.Errno(0x54) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x60) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x5c) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGPWR = syscall.Signal(0x20) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "device busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large or too small"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol option not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "EOPNOTSUPP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "connection timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EIDRM", "identifier removed"}, - {83, "ENOMSG", "no message of desired type"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "EILSEQ", "illegal byte sequence"}, - {86, "ENOTSUP", "not supported"}, - {87, "ECANCELED", "operation Canceled"}, - {88, "EBADMSG", "bad or Corrupt message"}, - {89, "ENODATA", "no message available"}, - {90, "ENOSR", "no STREAM resources"}, - {91, "ENOSTR", "not a STREAM"}, - {92, "ETIME", "STREAM ioctl timeout"}, - {93, "ENOATTR", "attribute not found"}, - {94, "EMULTIHOP", "multihop attempted"}, - {95, "ENOLINK", "link has been severed"}, - {96, "ELAST", "protocol error"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGIOT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "stopped (signal)"}, - {18, "SIGTSTP", "stopped"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, - {32, "SIGPWR", "power fail/restart"}, -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index d8be0451..7d92f2c5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -899,32 +899,6 @@ const ( MAP_TRYFIXED = 0x400 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_DOOMED = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_NOATIME = 0x8000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x4000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x400ffff - MNT_WAIT = 0x1 - MNT_WANTRDWR = 0x2000000 - MNT_WXALLOWED = 0x800 MSG_BCAST = 0x100 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 1f9e8a29..b0a7ebaf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -939,34 +939,6 @@ const ( MAP_TRYFIXED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_DOOMED = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_NOATIME = 0x8000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOPERM = 0x20 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x4000000 - MNT_STALLED = 0x100000 - MNT_SYNCHRONOUS = 0x2 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x400ffff - MNT_WAIT = 0x1 - MNT_WANTRDWR = 0x2000000 - MNT_WXALLOWED = 0x800 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 @@ -1443,8 +1415,6 @@ const ( TIOCUCNTL_CBRK = 0x7a TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 - UTIME_NOW = -0x2 - UTIME_OMIT = -0x1 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 79d5695c..50c1d9f3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -899,32 +899,6 @@ const ( MAP_TRYFIXED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_DOOMED = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_NOATIME = 0x8000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x4000000 - MNT_SYNCHRONOUS = 0x2 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x400ffff - MNT_WAIT = 0x1 - MNT_WANTRDWR = 0x2000000 - MNT_WXALLOWED = 0x800 MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go deleted file mode 100644 index ec5f92de..00000000 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ /dev/null @@ -1,1789 +0,0 @@ -// mkerrors.sh -m64 -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,openbsd - -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -m64 _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_BLUETOOTH = 0x20 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1a - AF_ECMA = 0x8 - AF_ENCAP = 0x1c - AF_HYLINK = 0xf - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x18 - AF_IPX = 0x17 - AF_ISDN = 0x1a - AF_ISO = 0x7 - AF_KEY = 0x1e - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x24 - AF_MPLS = 0x21 - AF_NATM = 0x1b - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PUP = 0x4 - AF_ROUTE = 0x11 - AF_SIP = 0x1d - AF_SNA = 0xb - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - ALTWERASE = 0x200 - ARPHRD_ETHER = 0x1 - ARPHRD_FRELAY = 0xf - ARPHRD_IEEE1394 = 0x18 - ARPHRD_IEEE802 = 0x6 - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDIRFILT = 0x4004427c - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc010427b - BIOCGETIF = 0x4020426b - BIOCGFILDROP = 0x40044278 - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044273 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCLOCK = 0x20004276 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDIRFILT = 0x8004427d - BIOCSDLT = 0x8004427a - BIOCSETF = 0x80104267 - BIOCSETIF = 0x8020426c - BIOCSETWF = 0x80104277 - BIOCSFILDROP = 0x80044279 - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044272 - BIOCSRTIMEOUT = 0x8010426d - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIRECTION_IN = 0x1 - BPF_DIRECTION_OUT = 0x2 - BPF_DIV = 0x30 - BPF_FILDROP_CAPTURE = 0x1 - BPF_FILDROP_DROP = 0x2 - BPF_FILDROP_PASS = 0x0 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x200000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_BOOTTIME = 0x6 - CLOCK_MONOTONIC = 0x3 - CLOCK_PROCESS_CPUTIME_ID = 0x2 - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x4 - CLOCK_UPTIME = 0x5 - CREAD = 0x800 - CRTSCTS = 0x10000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0xff - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DIOCOSFPFLUSH = 0x2000444e - DLT_ARCNET = 0x7 - DLT_ATM_RFC1483 = 0xb - DLT_AX25 = 0x3 - DLT_CHAOS = 0x5 - DLT_C_HDLC = 0x68 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0xd - DLT_FDDI = 0xa - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_LOOP = 0xc - DLT_MPLS = 0xdb - DLT_NULL = 0x0 - DLT_OPENFLOW = 0x10b - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_SERIAL = 0x32 - DLT_PRONET = 0x4 - DLT_RAW = 0xe - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_USBPCAP = 0xf9 - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EMT_TAGOVF = 0x1 - EMUL_ENABLED = 0x1 - EMUL_NATIVE = 0x2 - ENDRUNDISC = 0x9 - ETHERMIN = 0x2e - ETHERMTU = 0x5dc - ETHERTYPE_8023 = 0x4 - ETHERTYPE_AARP = 0x80f3 - ETHERTYPE_ACCTON = 0x8390 - ETHERTYPE_AEONIC = 0x8036 - ETHERTYPE_ALPHA = 0x814a - ETHERTYPE_AMBER = 0x6008 - ETHERTYPE_AMOEBA = 0x8145 - ETHERTYPE_AOE = 0x88a2 - ETHERTYPE_APOLLO = 0x80f7 - ETHERTYPE_APOLLODOMAIN = 0x8019 - ETHERTYPE_APPLETALK = 0x809b - ETHERTYPE_APPLITEK = 0x80c7 - ETHERTYPE_ARGONAUT = 0x803a - ETHERTYPE_ARP = 0x806 - ETHERTYPE_AT = 0x809b - ETHERTYPE_ATALK = 0x809b - ETHERTYPE_ATOMIC = 0x86df - ETHERTYPE_ATT = 0x8069 - ETHERTYPE_ATTSTANFORD = 0x8008 - ETHERTYPE_AUTOPHON = 0x806a - ETHERTYPE_AXIS = 0x8856 - ETHERTYPE_BCLOOP = 0x9003 - ETHERTYPE_BOFL = 0x8102 - ETHERTYPE_CABLETRON = 0x7034 - ETHERTYPE_CHAOS = 0x804 - ETHERTYPE_COMDESIGN = 0x806c - ETHERTYPE_COMPUGRAPHIC = 0x806d - ETHERTYPE_COUNTERPOINT = 0x8062 - ETHERTYPE_CRONUS = 0x8004 - ETHERTYPE_CRONUSVLN = 0x8003 - ETHERTYPE_DCA = 0x1234 - ETHERTYPE_DDE = 0x807b - ETHERTYPE_DEBNI = 0xaaaa - ETHERTYPE_DECAM = 0x8048 - ETHERTYPE_DECCUST = 0x6006 - ETHERTYPE_DECDIAG = 0x6005 - ETHERTYPE_DECDNS = 0x803c - ETHERTYPE_DECDTS = 0x803e - ETHERTYPE_DECEXPER = 0x6000 - ETHERTYPE_DECLAST = 0x8041 - ETHERTYPE_DECLTM = 0x803f - ETHERTYPE_DECMUMPS = 0x6009 - ETHERTYPE_DECNETBIOS = 0x8040 - ETHERTYPE_DELTACON = 0x86de - ETHERTYPE_DIDDLE = 0x4321 - ETHERTYPE_DLOG1 = 0x660 - ETHERTYPE_DLOG2 = 0x661 - ETHERTYPE_DN = 0x6003 - ETHERTYPE_DOGFIGHT = 0x1989 - ETHERTYPE_DSMD = 0x8039 - ETHERTYPE_ECMA = 0x803 - ETHERTYPE_ENCRYPT = 0x803d - ETHERTYPE_ES = 0x805d - ETHERTYPE_EXCELAN = 0x8010 - ETHERTYPE_EXPERDATA = 0x8049 - ETHERTYPE_FLIP = 0x8146 - ETHERTYPE_FLOWCONTROL = 0x8808 - ETHERTYPE_FRARP = 0x808 - ETHERTYPE_GENDYN = 0x8068 - ETHERTYPE_HAYES = 0x8130 - ETHERTYPE_HIPPI_FP = 0x8180 - ETHERTYPE_HITACHI = 0x8820 - ETHERTYPE_HP = 0x8005 - ETHERTYPE_IEEEPUP = 0xa00 - ETHERTYPE_IEEEPUPAT = 0xa01 - ETHERTYPE_IMLBL = 0x4c42 - ETHERTYPE_IMLBLDIAG = 0x424c - ETHERTYPE_IP = 0x800 - ETHERTYPE_IPAS = 0x876c - ETHERTYPE_IPV6 = 0x86dd - ETHERTYPE_IPX = 0x8137 - ETHERTYPE_IPXNEW = 0x8037 - ETHERTYPE_KALPANA = 0x8582 - ETHERTYPE_LANBRIDGE = 0x8038 - ETHERTYPE_LANPROBE = 0x8888 - ETHERTYPE_LAT = 0x6004 - ETHERTYPE_LBACK = 0x9000 - ETHERTYPE_LITTLE = 0x8060 - ETHERTYPE_LLDP = 0x88cc - ETHERTYPE_LOGICRAFT = 0x8148 - ETHERTYPE_LOOPBACK = 0x9000 - ETHERTYPE_MATRA = 0x807a - ETHERTYPE_MAX = 0xffff - ETHERTYPE_MERIT = 0x807c - ETHERTYPE_MICP = 0x873a - ETHERTYPE_MOPDL = 0x6001 - ETHERTYPE_MOPRC = 0x6002 - ETHERTYPE_MOTOROLA = 0x818d - ETHERTYPE_MPLS = 0x8847 - ETHERTYPE_MPLS_MCAST = 0x8848 - ETHERTYPE_MUMPS = 0x813f - ETHERTYPE_NBPCC = 0x3c04 - ETHERTYPE_NBPCLAIM = 0x3c09 - ETHERTYPE_NBPCLREQ = 0x3c05 - ETHERTYPE_NBPCLRSP = 0x3c06 - ETHERTYPE_NBPCREQ = 0x3c02 - ETHERTYPE_NBPCRSP = 0x3c03 - ETHERTYPE_NBPDG = 0x3c07 - ETHERTYPE_NBPDGB = 0x3c08 - ETHERTYPE_NBPDLTE = 0x3c0a - ETHERTYPE_NBPRAR = 0x3c0c - ETHERTYPE_NBPRAS = 0x3c0b - ETHERTYPE_NBPRST = 0x3c0d - ETHERTYPE_NBPSCD = 0x3c01 - ETHERTYPE_NBPVCD = 0x3c00 - ETHERTYPE_NBS = 0x802 - ETHERTYPE_NCD = 0x8149 - ETHERTYPE_NESTAR = 0x8006 - ETHERTYPE_NETBEUI = 0x8191 - ETHERTYPE_NOVELL = 0x8138 - ETHERTYPE_NS = 0x600 - ETHERTYPE_NSAT = 0x601 - ETHERTYPE_NSCOMPAT = 0x807 - ETHERTYPE_NTRAILER = 0x10 - ETHERTYPE_OS9 = 0x7007 - ETHERTYPE_OS9NET = 0x7009 - ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e - ETHERTYPE_PBB = 0x88e7 - ETHERTYPE_PCS = 0x4242 - ETHERTYPE_PLANNING = 0x8044 - ETHERTYPE_PPP = 0x880b - ETHERTYPE_PPPOE = 0x8864 - ETHERTYPE_PPPOEDISC = 0x8863 - ETHERTYPE_PRIMENTS = 0x7031 - ETHERTYPE_PUP = 0x200 - ETHERTYPE_PUPAT = 0x200 - ETHERTYPE_QINQ = 0x88a8 - ETHERTYPE_RACAL = 0x7030 - ETHERTYPE_RATIONAL = 0x8150 - ETHERTYPE_RAWFR = 0x6559 - ETHERTYPE_RCL = 0x1995 - ETHERTYPE_RDP = 0x8739 - ETHERTYPE_RETIX = 0x80f2 - ETHERTYPE_REVARP = 0x8035 - ETHERTYPE_SCA = 0x6007 - ETHERTYPE_SECTRA = 0x86db - ETHERTYPE_SECUREDATA = 0x876d - ETHERTYPE_SGITW = 0x817e - ETHERTYPE_SG_BOUNCE = 0x8016 - ETHERTYPE_SG_DIAG = 0x8013 - ETHERTYPE_SG_NETGAMES = 0x8014 - ETHERTYPE_SG_RESV = 0x8015 - ETHERTYPE_SIMNET = 0x5208 - ETHERTYPE_SLOW = 0x8809 - ETHERTYPE_SNA = 0x80d5 - ETHERTYPE_SNMP = 0x814c - ETHERTYPE_SONIX = 0xfaf5 - ETHERTYPE_SPIDER = 0x809f - ETHERTYPE_SPRITE = 0x500 - ETHERTYPE_STP = 0x8181 - ETHERTYPE_TALARIS = 0x812b - ETHERTYPE_TALARISMC = 0x852b - ETHERTYPE_TCPCOMP = 0x876b - ETHERTYPE_TCPSM = 0x9002 - ETHERTYPE_TEC = 0x814f - ETHERTYPE_TIGAN = 0x802f - ETHERTYPE_TRAIL = 0x1000 - ETHERTYPE_TRANSETHER = 0x6558 - ETHERTYPE_TYMSHARE = 0x802e - ETHERTYPE_UBBST = 0x7005 - ETHERTYPE_UBDEBUG = 0x900 - ETHERTYPE_UBDIAGLOOP = 0x7002 - ETHERTYPE_UBDL = 0x7000 - ETHERTYPE_UBNIU = 0x7001 - ETHERTYPE_UBNMC = 0x7003 - ETHERTYPE_VALID = 0x1600 - ETHERTYPE_VARIAN = 0x80dd - ETHERTYPE_VAXELN = 0x803b - ETHERTYPE_VEECO = 0x8067 - ETHERTYPE_VEXP = 0x805b - ETHERTYPE_VGLAB = 0x8131 - ETHERTYPE_VINES = 0xbad - ETHERTYPE_VINESECHO = 0xbaf - ETHERTYPE_VINESLOOP = 0xbae - ETHERTYPE_VITAL = 0xff00 - ETHERTYPE_VLAN = 0x8100 - ETHERTYPE_VLTLMAN = 0x8080 - ETHERTYPE_VPROD = 0x805c - ETHERTYPE_VURESERVED = 0x8147 - ETHERTYPE_WATERLOO = 0x8130 - ETHERTYPE_WELLFLEET = 0x8103 - ETHERTYPE_X25 = 0x805 - ETHERTYPE_X75 = 0x801 - ETHERTYPE_XNSSM = 0x9001 - ETHERTYPE_XTP = 0x817d - ETHER_ADDR_LEN = 0x6 - ETHER_ALIGN = 0x2 - ETHER_CRC_LEN = 0x4 - ETHER_CRC_POLY_BE = 0x4c11db6 - ETHER_CRC_POLY_LE = 0xedb88320 - ETHER_HDR_LEN = 0xe - ETHER_MAX_DIX_LEN = 0x600 - ETHER_MAX_HARDMTU_LEN = 0xff9b - ETHER_MAX_LEN = 0x5ee - ETHER_MIN_LEN = 0x40 - ETHER_TYPE_LEN = 0x2 - ETHER_VLAN_ENCAP_LEN = 0x4 - EVFILT_AIO = -0x3 - EVFILT_DEVICE = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x8 - EVFILT_TIMER = -0x7 - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EVL_ENCAPLEN = 0x4 - EVL_PRIO_BITS = 0xd - EVL_PRIO_MAX = 0x7 - EVL_VLID_MASK = 0xfff - EVL_VLID_MAX = 0xffe - EVL_VLID_MIN = 0x1 - EVL_VLID_NULL = 0x0 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FLUSHO = 0x800000 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0xa - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETOWN = 0x5 - F_ISATTY = 0xb - F_OK = 0x0 - F_RDLCK = 0x1 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETOWN = 0x6 - F_UNLCK = 0x2 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFAN_ARRIVAL = 0x0 - IFAN_DEPARTURE = 0x1 - IFF_ALLMULTI = 0x200 - IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x8e52 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_STATICARP = 0x20 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_A12MPPSWITCH = 0x82 - IFT_AAL2 = 0xbb - IFT_AAL5 = 0x31 - IFT_ADSL = 0x5e - IFT_AFLANE8023 = 0x3b - IFT_AFLANE8025 = 0x3c - IFT_ARAP = 0x58 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ASYNC = 0x54 - IFT_ATM = 0x25 - IFT_ATMDXI = 0x69 - IFT_ATMFUNI = 0x6a - IFT_ATMIMA = 0x6b - IFT_ATMLOGICAL = 0x50 - IFT_ATMRADIO = 0xbd - IFT_ATMSUBINTERFACE = 0x86 - IFT_ATMVCIENDPT = 0xc2 - IFT_ATMVIRTUAL = 0x95 - IFT_BGPPOLICYACCOUNTING = 0xa2 - IFT_BLUETOOTH = 0xf8 - IFT_BRIDGE = 0xd1 - IFT_BSC = 0x53 - IFT_CARP = 0xf7 - IFT_CCTEMUL = 0x3d - IFT_CEPT = 0x13 - IFT_CES = 0x85 - IFT_CHANNEL = 0x46 - IFT_CNR = 0x55 - IFT_COFFEE = 0x84 - IFT_COMPOSITELINK = 0x9b - IFT_DCN = 0x8d - IFT_DIGITALPOWERLINE = 0x8a - IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba - IFT_DLSW = 0x4a - IFT_DOCSCABLEDOWNSTREAM = 0x80 - IFT_DOCSCABLEMACLAYER = 0x7f - IFT_DOCSCABLEUPSTREAM = 0x81 - IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd - IFT_DS0 = 0x51 - IFT_DS0BUNDLE = 0x52 - IFT_DS1FDL = 0xaa - IFT_DS3 = 0x1e - IFT_DTM = 0x8c - IFT_DUMMY = 0xf1 - IFT_DVBASILN = 0xac - IFT_DVBASIOUT = 0xad - IFT_DVBRCCDOWNSTREAM = 0x93 - IFT_DVBRCCMACLAYER = 0x92 - IFT_DVBRCCUPSTREAM = 0x94 - IFT_ECONET = 0xce - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_EPLRS = 0x57 - IFT_ESCON = 0x49 - IFT_ETHER = 0x6 - IFT_FAITH = 0xf3 - IFT_FAST = 0x7d - IFT_FASTETHER = 0x3e - IFT_FASTETHERFX = 0x45 - IFT_FDDI = 0xf - IFT_FIBRECHANNEL = 0x38 - IFT_FRAMERELAYINTERCONNECT = 0x3a - IFT_FRAMERELAYMPI = 0x5c - IFT_FRDLCIENDPT = 0xc1 - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_FRF16MFRBUNDLE = 0xa3 - IFT_FRFORWARD = 0x9e - IFT_G703AT2MB = 0x43 - IFT_G703AT64K = 0x42 - IFT_GIF = 0xf0 - IFT_GIGABITETHERNET = 0x75 - IFT_GR303IDT = 0xb2 - IFT_GR303RDT = 0xb1 - IFT_H323GATEKEEPER = 0xa4 - IFT_H323PROXY = 0xa5 - IFT_HDH1822 = 0x3 - IFT_HDLC = 0x76 - IFT_HDSL2 = 0xa8 - IFT_HIPERLAN2 = 0xb7 - IFT_HIPPI = 0x2f - IFT_HIPPIINTERFACE = 0x39 - IFT_HOSTPAD = 0x5a - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IBM370PARCHAN = 0x48 - IFT_IDSL = 0x9a - IFT_IEEE1394 = 0x90 - IFT_IEEE80211 = 0x47 - IFT_IEEE80212 = 0x37 - IFT_IEEE8023ADLAG = 0xa1 - IFT_IFGSN = 0x91 - IFT_IMT = 0xbe - IFT_INFINIBAND = 0xc7 - IFT_INTERLEAVE = 0x7c - IFT_IP = 0x7e - IFT_IPFORWARD = 0x8e - IFT_IPOVERATM = 0x72 - IFT_IPOVERCDLC = 0x6d - IFT_IPOVERCLAW = 0x6e - IFT_IPSWITCH = 0x4e - IFT_ISDN = 0x3f - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISDNS = 0x4b - IFT_ISDNU = 0x4c - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88025CRFPINT = 0x62 - IFT_ISO88025DTR = 0x56 - IFT_ISO88025FIBER = 0x73 - IFT_ISO88026 = 0xa - IFT_ISUP = 0xb3 - IFT_L2VLAN = 0x87 - IFT_L3IPVLAN = 0x88 - IFT_L3IPXVLAN = 0x89 - IFT_LAPB = 0x10 - IFT_LAPD = 0x4d - IFT_LAPF = 0x77 - IFT_LINEGROUP = 0xd2 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MBIM = 0xfa - IFT_MEDIAMAILOVERIP = 0x8b - IFT_MFSIGLINK = 0xa7 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_MPC = 0x71 - IFT_MPLS = 0xa6 - IFT_MPLSTUNNEL = 0x96 - IFT_MSDSL = 0x8f - IFT_MVL = 0xbf - IFT_MYRINET = 0x63 - IFT_NFAS = 0xaf - IFT_NSIP = 0x1b - IFT_OPTICALCHANNEL = 0xc3 - IFT_OPTICALTRANSPORT = 0xc4 - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PFLOG = 0xf5 - IFT_PFLOW = 0xf9 - IFT_PFSYNC = 0xf6 - IFT_PLC = 0xae - IFT_PON155 = 0xcf - IFT_PON622 = 0xd0 - IFT_POS = 0xab - IFT_PPP = 0x17 - IFT_PPPMULTILINKBUNDLE = 0x6c - IFT_PROPATM = 0xc5 - IFT_PROPBWAP2MP = 0xb8 - IFT_PROPCNLS = 0x59 - IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 - IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 - IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PROPWIRELESSP2P = 0x9d - IFT_PTPSERIAL = 0x16 - IFT_PVC = 0xf2 - IFT_Q2931 = 0xc9 - IFT_QLLC = 0x44 - IFT_RADIOMAC = 0xbc - IFT_RADSL = 0x5f - IFT_REACHDSL = 0xc0 - IFT_RFC1483 = 0x9f - IFT_RS232 = 0x21 - IFT_RSRB = 0x4f - IFT_SDLC = 0x11 - IFT_SDSL = 0x60 - IFT_SHDSL = 0xa9 - IFT_SIP = 0x1f - IFT_SIPSIG = 0xcc - IFT_SIPTG = 0xcb - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETOVERHEADCHANNEL = 0xb9 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_SRP = 0x97 - IFT_SS7SIGLINK = 0x9c - IFT_STACKTOSTACK = 0x6f - IFT_STARLAN = 0xb - IFT_T1 = 0x12 - IFT_TDLC = 0x74 - IFT_TELINK = 0xc8 - IFT_TERMPAD = 0x5b - IFT_TR008 = 0xb0 - IFT_TRANSPHDLC = 0x7b - IFT_TUNNEL = 0x83 - IFT_ULTRA = 0x1d - IFT_USB = 0xa0 - IFT_V11 = 0x40 - IFT_V35 = 0x2d - IFT_V36 = 0x41 - IFT_V37 = 0x78 - IFT_VDSL = 0x61 - IFT_VIRTUALIPADDRESS = 0x70 - IFT_VIRTUALTG = 0xca - IFT_VOICEDID = 0xd5 - IFT_VOICEEM = 0x64 - IFT_VOICEEMFGD = 0xd3 - IFT_VOICEENCAP = 0x67 - IFT_VOICEFGDEANA = 0xd4 - IFT_VOICEFXO = 0x65 - IFT_VOICEFXS = 0x66 - IFT_VOICEOVERATM = 0x98 - IFT_VOICEOVERCABLE = 0xc6 - IFT_VOICEOVERFRAMERELAY = 0x99 - IFT_VOICEOVERIP = 0x68 - IFT_X213 = 0x5d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25HUNTGROUP = 0x7a - IFT_X25MLP = 0x79 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LOOPBACKNET = 0x7f - IN_RFC3021_HOST = 0x1 - IN_RFC3021_NET = 0xfffffffe - IN_RFC3021_NSHIFT = 0x1f - IPPROTO_AH = 0x33 - IPPROTO_CARP = 0x70 - IPPROTO_DIVERT = 0x102 - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GRE = 0x2f - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IGMP = 0x2 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPIP = 0x4 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x103 - IPPROTO_MOBILE = 0x37 - IPPROTO_MPLS = 0x89 - IPPROTO_NONE = 0x3b - IPPROTO_PFSYNC = 0xf0 - IPPROTO_PIM = 0x67 - IPPROTO_PUP = 0xc - IPPROTO_RAW = 0xff - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_UDP = 0x11 - IPV6_AUTH_LEVEL = 0x35 - IPV6_AUTOFLOWLABEL = 0x3b - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_DONTFRAG = 0x3e - IPV6_DSTOPTS = 0x32 - IPV6_ESP_NETWORK_LEVEL = 0x37 - IPV6_ESP_TRANS_LEVEL = 0x36 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FRAGTTL = 0x78 - IPV6_HLIMDEC = 0x1 - IPV6_HOPLIMIT = 0x2f - IPV6_HOPOPTS = 0x31 - IPV6_IPCOMP_LEVEL = 0x3c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXPACKET = 0xffff - IPV6_MINHOPCOUNT = 0x41 - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_NEXTHOP = 0x30 - IPV6_OPTIONS = 0x1 - IPV6_PATHMTU = 0x2c - IPV6_PIPEX = 0x3f - IPV6_PKTINFO = 0x2e - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVDSTOPTS = 0x28 - IPV6_RECVDSTPORT = 0x40 - IPV6_RECVHOPLIMIT = 0x25 - IPV6_RECVHOPOPTS = 0x27 - IPV6_RECVPATHMTU = 0x2b - IPV6_RECVPKTINFO = 0x24 - IPV6_RECVRTHDR = 0x26 - IPV6_RECVTCLASS = 0x39 - IPV6_RTABLE = 0x1021 - IPV6_RTHDR = 0x33 - IPV6_RTHDRDSTOPTS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x3d - IPV6_UNICAST_HOPS = 0x4 - IPV6_USE_MIN_MTU = 0x2a - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_AUTH_LEVEL = 0x14 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_ESP_NETWORK_LEVEL = 0x16 - IP_ESP_TRANS_LEVEL = 0x15 - IP_HDRINCL = 0x2 - IP_IPCOMP_LEVEL = 0x1d - IP_IPDEFTTL = 0x25 - IP_IPSECFLOWINFO = 0x24 - IP_IPSEC_LOCAL_AUTH = 0x1b - IP_IPSEC_LOCAL_CRED = 0x19 - IP_IPSEC_LOCAL_ID = 0x17 - IP_IPSEC_REMOTE_AUTH = 0x1c - IP_IPSEC_REMOTE_CRED = 0x1a - IP_IPSEC_REMOTE_ID = 0x18 - IP_MAXPACKET = 0xffff - IP_MAX_MEMBERSHIPS = 0xfff - IP_MF = 0x2000 - IP_MINTTL = 0x20 - IP_MIN_MEMBERSHIPS = 0xf - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_OFFMASK = 0x1fff - IP_OPTIONS = 0x1 - IP_PIPEX = 0x22 - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVDSTPORT = 0x21 - IP_RECVIF = 0x1e - IP_RECVOPTS = 0x5 - IP_RECVRETOPTS = 0x6 - IP_RECVRTABLE = 0x23 - IP_RECVTTL = 0x1f - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RTABLE = 0x1021 - IP_SENDSRCADDR = 0x7 - IP_TOS = 0x3 - IP_TTL = 0x4 - ISIG = 0x80 - ISTRIP = 0x20 - IUCLC = 0x1000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LCNT_OVERLOAD_FLUSH = 0x6 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x6 - MADV_NORMAL = 0x0 - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_SPACEAVAIL = 0x5 - MADV_WILLNEED = 0x3 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_CONCEAL = 0x8000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_FLAGMASK = 0xfff7 - MAP_HASSEMAPHORE = 0x0 - MAP_INHERIT = 0x0 - MAP_INHERIT_COPY = 0x1 - MAP_INHERIT_NONE = 0x2 - MAP_INHERIT_SHARE = 0x0 - MAP_INHERIT_ZERO = 0x3 - MAP_NOEXTEND = 0x0 - MAP_NORESERVE = 0x0 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x0 - MAP_SHARED = 0x1 - MAP_STACK = 0x4000 - MAP_TRYFIXED = 0x0 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_DOOMED = 0x8000000 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_NOATIME = 0x8000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOPERM = 0x20 - MNT_NOSUID = 0x8 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SOFTDEP = 0x4000000 - MNT_STALLED = 0x100000 - MNT_SWAPPABLE = 0x200000 - MNT_SYNCHRONOUS = 0x2 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x400ffff - MNT_WAIT = 0x1 - MNT_WANTRDWR = 0x2000000 - MNT_WXALLOWED = 0x800 - MSG_BCAST = 0x100 - MSG_CMSG_CLOEXEC = 0x800 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOR = 0x8 - MSG_MCAST = 0x200 - MSG_NOSIGNAL = 0x400 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MS_ASYNC = 0x1 - MS_INVALIDATE = 0x4 - MS_SYNC = 0x2 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFNAMES = 0x6 - NET_RT_MAXID = 0x7 - NET_RT_STATS = 0x4 - NET_RT_TABLE = 0x5 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ATTRIB = 0x8 - NOTE_CHANGE = 0x1 - NOTE_CHILD = 0x4 - NOTE_DELETE = 0x1 - NOTE_EOF = 0x2 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXTEND = 0x4 - NOTE_FORK = 0x40000000 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_PCTRLMASK = 0xf0000000 - NOTE_PDATAMASK = 0xfffff - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRUNCATE = 0x80 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OLCUC = 0x20 - ONLCR = 0x2 - ONLRET = 0x80 - ONOCR = 0x40 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x10000 - O_CREAT = 0x200 - O_DIRECTORY = 0x20000 - O_DSYNC = 0x80 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x8000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_RSYNC = 0x80 - O_SHLOCK = 0x10 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PF_FLUSH = 0x1 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BFD = 0xb - RTAX_BRD = 0x7 - RTAX_DNS = 0xc - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_LABEL = 0xa - RTAX_MAX = 0xf - RTAX_NETMASK = 0x2 - RTAX_SEARCH = 0xe - RTAX_SRC = 0x8 - RTAX_SRCMASK = 0x9 - RTAX_STATIC = 0xd - RTA_AUTHOR = 0x40 - RTA_BFD = 0x800 - RTA_BRD = 0x80 - RTA_DNS = 0x1000 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_LABEL = 0x400 - RTA_NETMASK = 0x4 - RTA_SEARCH = 0x4000 - RTA_SRC = 0x100 - RTA_SRCMASK = 0x200 - RTA_STATIC = 0x2000 - RTF_ANNOUNCE = 0x4000 - RTF_BFD = 0x1000000 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CACHED = 0x20000 - RTF_CLONED = 0x10000 - RTF_CLONING = 0x100 - RTF_CONNECTED = 0x800000 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_FMASK = 0x110fc08 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MPATH = 0x40000 - RTF_MPLS = 0x100000 - RTF_MULTICAST = 0x200 - RTF_PERMANENT_ARP = 0x2000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x2000 - RTF_REJECT = 0x8 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_USETRAILERS = 0x8000 - RTM_80211INFO = 0x15 - RTM_ADD = 0x1 - RTM_BFD = 0x12 - RTM_CHANGE = 0x3 - RTM_CHGADDRATTR = 0x14 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DESYNC = 0x10 - RTM_GET = 0x4 - RTM_IFANNOUNCE = 0xf - RTM_IFINFO = 0xe - RTM_INVALIDATE = 0x11 - RTM_LOSING = 0x5 - RTM_MAXSIZE = 0x800 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_PROPOSAL = 0x13 - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RT_TABLEID_BITS = 0x8 - RT_TABLEID_MASK = 0xff - RT_TABLEID_MAX = 0xff - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - RUSAGE_THREAD = 0x1 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCAIFGROUP = 0x80286987 - SIOCATMARK = 0x40047307 - SIOCBRDGADD = 0x8060693c - SIOCBRDGADDL = 0x80606949 - SIOCBRDGADDS = 0x80606941 - SIOCBRDGARL = 0x808c694d - SIOCBRDGDADDR = 0x81286947 - SIOCBRDGDEL = 0x8060693d - SIOCBRDGDELS = 0x80606942 - SIOCBRDGFLUSH = 0x80606948 - SIOCBRDGFRL = 0x808c694e - SIOCBRDGGCACHE = 0xc0186941 - SIOCBRDGGFD = 0xc0186952 - SIOCBRDGGHT = 0xc0186951 - SIOCBRDGGIFFLGS = 0xc060693e - SIOCBRDGGMA = 0xc0186953 - SIOCBRDGGPARAM = 0xc0406958 - SIOCBRDGGPRI = 0xc0186950 - SIOCBRDGGRL = 0xc030694f - SIOCBRDGGTO = 0xc0186946 - SIOCBRDGIFS = 0xc0606942 - SIOCBRDGRTS = 0xc0206943 - SIOCBRDGSADDR = 0xc1286944 - SIOCBRDGSCACHE = 0x80186940 - SIOCBRDGSFD = 0x80186952 - SIOCBRDGSHT = 0x80186951 - SIOCBRDGSIFCOST = 0x80606955 - SIOCBRDGSIFFLGS = 0x8060693f - SIOCBRDGSIFPRIO = 0x80606954 - SIOCBRDGSIFPROT = 0x8060694a - SIOCBRDGSMA = 0x80186953 - SIOCBRDGSPRI = 0x80186950 - SIOCBRDGSPROTO = 0x8018695a - SIOCBRDGSTO = 0x80186945 - SIOCBRDGSTXHC = 0x80186959 - SIOCDELLABEL = 0x80206997 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFGROUP = 0x80286989 - SIOCDIFPARENT = 0x802069b4 - SIOCDIFPHYADDR = 0x80206949 - SIOCDPWE3NEIGHBOR = 0x802069de - SIOCDVNETID = 0x802069af - SIOCGETKALIVE = 0xc01869a4 - SIOCGETLABEL = 0x8020699a - SIOCGETMPWCFG = 0xc02069ae - SIOCGETPFLOW = 0xc02069fe - SIOCGETPFSYNC = 0xc02069f8 - SIOCGETSGCNT = 0xc0207534 - SIOCGETVIFCNT = 0xc0287533 - SIOCGETVLAN = 0xc0206990 - SIOCGIFADDR = 0xc0206921 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCONF = 0xc0106924 - SIOCGIFDATA = 0xc020691b - SIOCGIFDESCR = 0xc0206981 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGATTR = 0xc028698b - SIOCGIFGENERIC = 0xc020693a - SIOCGIFGLIST = 0xc028698d - SIOCGIFGMEMB = 0xc028698a - SIOCGIFGROUP = 0xc0286988 - SIOCGIFHARDMTU = 0xc02069a5 - SIOCGIFLLPRIO = 0xc02069b6 - SIOCGIFMEDIA = 0xc0406938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc020697e - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPAIR = 0xc02069b1 - SIOCGIFPARENT = 0xc02069b3 - SIOCGIFPRIORITY = 0xc020699c - SIOCGIFRDOMAIN = 0xc02069a0 - SIOCGIFRTLABEL = 0xc0206983 - SIOCGIFRXR = 0x802069aa - SIOCGIFSFFPAGE = 0xc1126939 - SIOCGIFXFLAGS = 0xc020699e - SIOCGLIFPHYADDR = 0xc218694b - SIOCGLIFPHYDF = 0xc02069c2 - SIOCGLIFPHYECN = 0xc02069c8 - SIOCGLIFPHYRTABLE = 0xc02069a2 - SIOCGLIFPHYTTL = 0xc02069a9 - SIOCGPGRP = 0x40047309 - SIOCGPWE3 = 0xc0206998 - SIOCGPWE3CTRLWORD = 0xc02069dc - SIOCGPWE3FAT = 0xc02069dd - SIOCGPWE3NEIGHBOR = 0xc21869de - SIOCGSPPPPARAMS = 0xc0206994 - SIOCGTXHPRIO = 0xc02069c6 - SIOCGUMBINFO = 0xc02069be - SIOCGUMBPARAM = 0xc02069c0 - SIOCGVH = 0xc02069f6 - SIOCGVNETFLOWID = 0xc02069c4 - SIOCGVNETID = 0xc02069a7 - SIOCIFAFATTACH = 0x801169ab - SIOCIFAFDETACH = 0x801169ac - SIOCIFCREATE = 0x8020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106978 - SIOCSETKALIVE = 0x801869a3 - SIOCSETLABEL = 0x80206999 - SIOCSETMPWCFG = 0x802069ad - SIOCSETPFLOW = 0x802069fd - SIOCSETPFSYNC = 0x802069f7 - SIOCSETVLAN = 0x8020698f - SIOCSIFADDR = 0x8020690c - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFDESCR = 0x80206980 - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGATTR = 0x8028698c - SIOCSIFGENERIC = 0x80206939 - SIOCSIFLLADDR = 0x8020691f - SIOCSIFLLPRIO = 0x802069b5 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x8020697f - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPAIR = 0x802069b0 - SIOCSIFPARENT = 0x802069b2 - SIOCSIFPRIORITY = 0x8020699b - SIOCSIFRDOMAIN = 0x8020699f - SIOCSIFRTLABEL = 0x80206982 - SIOCSIFXFLAGS = 0x8020699d - SIOCSLIFPHYADDR = 0x8218694a - SIOCSLIFPHYDF = 0x802069c1 - SIOCSLIFPHYECN = 0x802069c7 - SIOCSLIFPHYRTABLE = 0x802069a1 - SIOCSLIFPHYTTL = 0x802069a8 - SIOCSPGRP = 0x80047308 - SIOCSPWE3CTRLWORD = 0x802069dc - SIOCSPWE3FAT = 0x802069dd - SIOCSPWE3NEIGHBOR = 0x821869de - SIOCSSPPPPARAMS = 0x80206993 - SIOCSTXHPRIO = 0x802069c5 - SIOCSUMBPARAM = 0x802069bf - SIOCSVH = 0xc02069f5 - SIOCSVNETFLOWID = 0x802069c3 - SIOCSVNETID = 0x802069a6 - SIOCSWGDPID = 0xc018695b - SIOCSWGMAXFLOW = 0xc0186960 - SIOCSWGMAXGROUP = 0xc018695d - SIOCSWSDPID = 0x8018695c - SIOCSWSPORTNO = 0xc060695f - SOCK_CLOEXEC = 0x8000 - SOCK_DGRAM = 0x2 - SOCK_DNS = 0x1000 - SOCK_NONBLOCK = 0x4000 - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BINDANY = 0x1000 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LINGER = 0x80 - SO_NETPROC = 0x1020 - SO_OOBINLINE = 0x100 - SO_PEERCRED = 0x1022 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_RTABLE = 0x1021 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_SPLICE = 0x1023 - SO_TIMESTAMP = 0x800 - SO_TYPE = 0x1008 - SO_USELOOPBACK = 0x40 - SO_ZEROIZE = 0x2000 - S_BLKSIZE = 0x200 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_MAXBURST = 0x4 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x3 - TCP_MAX_WINSHIFT = 0xe - TCP_MD5SIG = 0x4 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOPUSH = 0x10 - TCP_SACK_ENABLE = 0x8 - TCSAFLUSH = 0x2 - TIMER_ABSTIME = 0x1 - TIMER_RELTIME = 0x0 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCHKVERAUTH = 0x2000741e - TIOCCLRVERAUTH = 0x2000741d - TIOCCONS = 0x80047462 - TIOCDRAIN = 0x2000745e - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLAG_CLOCAL = 0x2 - TIOCFLAG_CRTSCTS = 0x4 - TIOCFLAG_MDMBUF = 0x8 - TIOCFLAG_PPS = 0x10 - TIOCFLAG_SOFTCAR = 0x1 - TIOCFLUSH = 0x80047410 - TIOCGETA = 0x402c7413 - TIOCGETD = 0x4004741a - TIOCGFLAGS = 0x4004745d - TIOCGPGRP = 0x40047477 - TIOCGSID = 0x40047463 - TIOCGTSTAMP = 0x4010745b - TIOCGWINSZ = 0x40087468 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGET = 0x4004746a - TIOCMODG = 0x4004746a - TIOCMODS = 0x8004746d - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCTTY = 0x20007461 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x802c7414 - TIOCSETAF = 0x802c7416 - TIOCSETAW = 0x802c7415 - TIOCSETD = 0x8004741b - TIOCSETVERAUTH = 0x8004741c - TIOCSFLAGS = 0x8004745c - TIOCSIG = 0x8004745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTOP = 0x2000746f - TIOCSTSTAMP = 0x8008745a - TIOCSWINSZ = 0x80087467 - TIOCUCNTL = 0x80047466 - TIOCUCNTL_CBRK = 0x7a - TIOCUCNTL_SBRK = 0x7b - TOSTOP = 0x400000 - UTIME_NOW = -0x2 - UTIME_OMIT = -0x1 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_ANONMIN = 0x7 - VM_LOADAVG = 0x2 - VM_MALLOC_CONF = 0xc - VM_MAXID = 0xd - VM_MAXSLP = 0xa - VM_METER = 0x1 - VM_NKMEMPAGES = 0x6 - VM_PSSTRINGS = 0x3 - VM_SWAPENCRYPT = 0x5 - VM_USPACE = 0xb - VM_UVMEXP = 0x4 - VM_VNODEMIN = 0x9 - VM_VTEXTMIN = 0x8 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VTIME = 0x11 - VWERASE = 0x4 - WALTSIG = 0x4 - WCONTINUED = 0x8 - WCOREFLAG = 0x80 - WNOHANG = 0x1 - WUNTRACED = 0x2 - XCASE = 0x1000000 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADF = syscall.Errno(0x9) - EBADMSG = syscall.Errno(0x5c) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x58) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x59) - EILSEQ = syscall.Errno(0x54) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EIPSEC = syscall.Errno(0x52) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x5f) - ELOOP = syscall.Errno(0x3e) - EMEDIUMTYPE = syscall.Errno(0x56) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x53) - ENOBUFS = syscall.Errno(0x37) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOMEDIUM = syscall.Errno(0x55) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5a) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x5d) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x5b) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x2d) - EOVERFLOW = syscall.Errno(0x57) - EOWNERDEAD = syscall.Errno(0x5e) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x5f) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTHR = syscall.Signal(0x20) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "device busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "EOPNOTSUPP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "operation timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disk quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC program not available"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EIPSEC", "IPsec processing failure"}, - {83, "ENOATTR", "attribute not found"}, - {84, "EILSEQ", "illegal byte sequence"}, - {85, "ENOMEDIUM", "no medium found"}, - {86, "EMEDIUMTYPE", "wrong medium type"}, - {87, "EOVERFLOW", "value too large to be stored in data type"}, - {88, "ECANCELED", "operation canceled"}, - {89, "EIDRM", "identifier removed"}, - {90, "ENOMSG", "no message of desired type"}, - {91, "ENOTSUP", "not supported"}, - {92, "EBADMSG", "bad message"}, - {93, "ENOTRECOVERABLE", "state not recoverable"}, - {94, "EOWNERDEAD", "previous owner died"}, - {95, "ELAST", "protocol error"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "suspended (signal)"}, - {18, "SIGTSTP", "suspended"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, - {32, "SIGTHR", "thread AST"}, -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index ed657ff1..ab2f7612 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -1,4 +1,4 @@ -// go run mksyscall_aix_ppc.go -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go +// mksyscall_aix.pl -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc @@ -7,7 +7,6 @@ package unix /* #include -#include int utimes(uintptr_t, uintptr_t); int utimensat(int, uintptr_t, uintptr_t, int); int getcwd(uintptr_t, size_t); @@ -21,8 +20,10 @@ int chdir(uintptr_t); int chroot(uintptr_t); int close(int); int dup(int); +int dup3(int, int, int); void exit(int); int faccessat(int, uintptr_t, unsigned int, int); +int fallocate(int, unsigned int, long long, long long); int fchdir(int); int fchmod(int, unsigned int); int fchmodat(int, uintptr_t, unsigned int, int); @@ -48,6 +49,7 @@ int open64(uintptr_t, int, unsigned int); int openat(int, uintptr_t, int, unsigned int); int read(int, uintptr_t, size_t); int readlink(uintptr_t, uintptr_t, size_t); +int removexattr(uintptr_t, uintptr_t); int renameat(int, uintptr_t, int, uintptr_t); int setdomainname(uintptr_t, size_t); int sethostname(uintptr_t, size_t); @@ -59,11 +61,13 @@ int setgid(int); int setpriority(int, int, int); int statx(int, uintptr_t, int, int, uintptr_t); int sync(); +long long tee(int, int, int, int); uintptr_t times(uintptr_t); int umask(int); int uname(uintptr_t); int unlink(uintptr_t); int unlinkat(int, uintptr_t, int); +int unshare(int); int ustat(int, uintptr_t); int write(int, uintptr_t, size_t); int dup2(int, int); @@ -83,8 +87,6 @@ int lstat(uintptr_t, uintptr_t); int pause(); int pread64(int, uintptr_t, size_t, long long); int pwrite64(int, uintptr_t, size_t, long long); -#define c_select select -int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int setregid(int, int); int setreuid(int, int); @@ -105,8 +107,8 @@ int getpeername(int, uintptr_t, uintptr_t); int getsockname(int, uintptr_t, uintptr_t); int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); -int nrecvmsg(int, uintptr_t, int); -int nsendmsg(int, uintptr_t, int); +int recvmsg(int, uintptr_t, int); +int sendmsg(int, uintptr_t, int); int munmap(uintptr_t, uintptr_t); int madvise(uintptr_t, size_t, int); int mprotect(uintptr_t, size_t, int); @@ -116,12 +118,11 @@ int msync(uintptr_t, size_t, int); int munlock(uintptr_t, size_t); int munlockall(); int pipe(uintptr_t); +int pipe2(uintptr_t, int); int poll(uintptr_t, int, int); int gettimeofday(uintptr_t, uintptr_t); int time(uintptr_t); int utime(uintptr_t, uintptr_t); -unsigned long long getsystemcfg(int); -int umount(uintptr_t); int getrlimit64(int, uintptr_t); int setrlimit64(int, uintptr_t); long long lseek64(int, long long, int); @@ -130,6 +131,7 @@ uintptr_t mmap(uintptr_t, uintptr_t, int, int, int, long long); */ import "C" import ( + "syscall" "unsafe" ) @@ -243,17 +245,6 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)) - val = int(r0) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Acct(path string) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.acct(C.uintptr_t(_p0)) @@ -308,6 +299,16 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Dup3(oldfd int, newfd int, flags int) (err error) { + r0, er := C.dup3(C.int(oldfd), C.int(newfd), C.int(flags)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Exit(code int) { C.exit(C.int(code)) return @@ -326,6 +327,16 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { + r0, er := C.fallocate(C.int(fd), C.uint(mode), C.longlong(off), C.longlong(len)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchdir(fd int) (err error) { r0, er := C.fchdir(C.int(fd)) if r0 == -1 && er != nil { @@ -368,6 +379,17 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)) + val = int(r0) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fdatasync(fd int) (err error) { r0, er := C.fdatasync(C.int(fd)) if r0 == -1 && er != nil { @@ -455,7 +477,7 @@ func Getsid(pid int) (sid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Kill(pid int, sig Signal) (err error) { +func Kill(pid int, sig syscall.Signal) (err error) { r0, er := C.kill(C.int(pid), C.int(sig)) if r0 == -1 && er != nil { err = er @@ -606,6 +628,18 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Removexattr(path string, attr string) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + _p1 := uintptr(unsafe.Pointer(C.CString(attr))) + r0, er := C.removexattr(C.uintptr_t(_p0), C.uintptr_t(_p1)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(oldpath))) _p1 := uintptr(unsafe.Pointer(C.CString(newpath))) @@ -729,6 +763,17 @@ func Sync() { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { + r0, er := C.tee(C.int(rfd), C.int(wfd), C.int(len), C.int(flags)) + n = int64(r0) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Times(tms *Tms) (ticks uintptr, err error) { r0, er := C.times(C.uintptr_t(uintptr(unsafe.Pointer(tms)))) ticks = uintptr(r0) @@ -780,6 +825,16 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Unshare(flags int) (err error) { + r0, er := C.unshare(C.int(flags)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Ustat(dev int, ubuf *Ustat_t) (err error) { r0, er := C.ustat(C.int(dev), C.uintptr_t(uintptr(unsafe.Pointer(ubuf)))) if r0 == -1 && er != nil { @@ -859,7 +914,7 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *Stat_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) if r0 == -1 && er != nil { err = er @@ -869,7 +924,7 @@ func fstat(fd int, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags)) if r0 == -1 && er != nil { @@ -953,7 +1008,7 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *Stat_t) (err error) { +func Lstat(path string, stat *Stat_t) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) if r0 == -1 && er != nil { @@ -1008,17 +1063,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, er := C.c_select(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout)))) - n = int(r0) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask)))) n = int(r0) @@ -1071,9 +1115,9 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, statptr *Stat_t) (err error) { +func Stat(path string, stat *Stat_t) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) - r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(statptr)))) + r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) if r0 == -1 && er != nil { err = er } @@ -1240,7 +1284,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, er := C.nrecvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) + r0, er := C.recvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) if r0 == -1 && er != nil { err = er @@ -1251,7 +1295,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, er := C.nsendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) + r0, er := C.sendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) if r0 == -1 && er != nil { err = er @@ -1381,6 +1425,16 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + r0, er := C.pipe2(C.uintptr_t(uintptr(unsafe.Pointer(p))), C.int(flags)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, er := C.poll(C.uintptr_t(uintptr(unsafe.Pointer(fds))), C.int(nfds), C.int(timeout)) n = int(r0) @@ -1424,25 +1478,6 @@ func Utime(path string, buf *Utimbuf) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getsystemcfg(label int) (n uint64) { - r0, _ := C.getsystemcfg(C.int(label)) - n = uint64(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func umount(target string) (err error) { - _p0 := uintptr(unsafe.Pointer(C.CString(target))) - r0, er := C.umount(C.uintptr_t(_p0)) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrlimit(resource int, rlim *Rlimit) (err error) { r0, er := C.getrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) if r0 == -1 && er != nil { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 664b293b..2e4f93fb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -1,25 +1,147 @@ -// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go +// mksyscall_aix.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc64 package unix +/* +#include +int utimes(uintptr_t, uintptr_t); +int utimensat(int, uintptr_t, uintptr_t, int); +int getcwd(uintptr_t, size_t); +int accept(int, uintptr_t, uintptr_t); +int getdirent(int, uintptr_t, size_t); +int wait4(int, uintptr_t, int, uintptr_t); +int ioctl(int, int, uintptr_t); +int fcntl(uintptr_t, int, uintptr_t); +int acct(uintptr_t); +int chdir(uintptr_t); +int chroot(uintptr_t); +int close(int); +int dup(int); +int dup3(int, int, int); +void exit(int); +int faccessat(int, uintptr_t, unsigned int, int); +int fallocate(int, unsigned int, long long, long long); +int fchdir(int); +int fchmod(int, unsigned int); +int fchmodat(int, uintptr_t, unsigned int, int); +int fchownat(int, uintptr_t, int, int, int); +int fdatasync(int); +int fsync(int); +int getpgid(int); +int getpgrp(); +int getpid(); +int getppid(); +int getpriority(int, int); +int getrusage(int, uintptr_t); +int getsid(int); +int kill(int, int); +int syslog(int, uintptr_t, size_t); +int mkdir(int, uintptr_t, unsigned int); +int mkdirat(int, uintptr_t, unsigned int); +int mkfifo(uintptr_t, unsigned int); +int mknod(uintptr_t, unsigned int, int); +int mknodat(int, uintptr_t, unsigned int, int); +int nanosleep(uintptr_t, uintptr_t); +int open64(uintptr_t, int, unsigned int); +int openat(int, uintptr_t, int, unsigned int); +int read(int, uintptr_t, size_t); +int readlink(uintptr_t, uintptr_t, size_t); +int removexattr(uintptr_t, uintptr_t); +int renameat(int, uintptr_t, int, uintptr_t); +int setdomainname(uintptr_t, size_t); +int sethostname(uintptr_t, size_t); +int setpgid(int, int); +int setsid(); +int settimeofday(uintptr_t); +int setuid(int); +int setgid(int); +int setpriority(int, int, int); +int statx(int, uintptr_t, int, int, uintptr_t); +int sync(); +long long tee(int, int, int, int); +uintptr_t times(uintptr_t); +int umask(int); +int uname(uintptr_t); +int unlink(uintptr_t); +int unlinkat(int, uintptr_t, int); +int unshare(int); +int ustat(int, uintptr_t); +int write(int, uintptr_t, size_t); +int dup2(int, int); +int posix_fadvise64(int, long long, long long, int); +int fchown(int, int, int); +int fstat(int, uintptr_t); +int fstatat(int, uintptr_t, uintptr_t, int); +int fstatfs(int, uintptr_t); +int ftruncate(int, long long); +int getegid(); +int geteuid(); +int getgid(); +int getuid(); +int lchown(uintptr_t, int, int); +int listen(int, int); +int lstat(uintptr_t, uintptr_t); +int pause(); +int pread64(int, uintptr_t, size_t, long long); +int pwrite64(int, uintptr_t, size_t, long long); +int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); +int setregid(int, int); +int setreuid(int, int); +int shutdown(int, int); +long long splice(int, uintptr_t, int, uintptr_t, int, int); +int stat(uintptr_t, uintptr_t); +int statfs(uintptr_t, uintptr_t); +int truncate(uintptr_t, long long); +int bind(int, uintptr_t, uintptr_t); +int connect(int, uintptr_t, uintptr_t); +int getgroups(int, uintptr_t); +int setgroups(int, uintptr_t); +int getsockopt(int, int, int, uintptr_t, uintptr_t); +int setsockopt(int, int, int, uintptr_t, uintptr_t); +int socket(int, int, int); +int socketpair(int, int, int, uintptr_t); +int getpeername(int, uintptr_t, uintptr_t); +int getsockname(int, uintptr_t, uintptr_t); +int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); +int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); +int recvmsg(int, uintptr_t, int); +int sendmsg(int, uintptr_t, int); +int munmap(uintptr_t, uintptr_t); +int madvise(uintptr_t, size_t, int); +int mprotect(uintptr_t, size_t, int); +int mlock(uintptr_t, size_t); +int mlockall(int); +int msync(uintptr_t, size_t, int); +int munlock(uintptr_t, size_t); +int munlockall(); +int pipe(uintptr_t); +int pipe2(uintptr_t, int); +int poll(uintptr_t, int, int); +int gettimeofday(uintptr_t, uintptr_t); +int time(uintptr_t); +int utime(uintptr_t, uintptr_t); +int getrlimit(int, uintptr_t); +int setrlimit(int, uintptr_t); +long long lseek(int, long long, int); +uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long); + +*/ +import "C" import ( + "syscall" "unsafe" ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callutimes(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.utimes(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(times)))) + if r0 == -1 && er != nil { + err = er } return } @@ -27,14 +149,10 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callutimensat(dirfd, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), flag) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.utimensat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(times))), C.int(flag)) + if r0 == -1 && er != nil { + err = er } return } @@ -46,9 +164,11 @@ func getcwd(buf []byte) (err error) { if len(buf) > 0 { _p0 = &buf[0] } - _, e1 := callgetcwd(uintptr(unsafe.Pointer(_p0)), len(buf)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(buf) + r0, er := C.getcwd(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -56,10 +176,10 @@ func getcwd(buf []byte) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, e1 := callaccept(s, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, er := C.accept(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(rsa))), C.uintptr_t(uintptr(unsafe.Pointer(addrlen)))) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -71,10 +191,12 @@ func getdirent(fd int, buf []byte) (n int, err error) { if len(buf) > 0 { _p0 = &buf[0] } - r0, e1 := callgetdirent(fd, uintptr(unsafe.Pointer(_p0)), len(buf)) + var _p1 int + _p1 = len(buf) + r0, er := C.getdirent(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -82,10 +204,10 @@ func getdirent(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error) { - r0, e1 := callwait4(int(pid), uintptr(unsafe.Pointer(status)), options, uintptr(unsafe.Pointer(rusage))) + r0, er := C.wait4(C.int(pid), C.uintptr_t(uintptr(unsafe.Pointer(status))), C.int(options), C.uintptr_t(uintptr(unsafe.Pointer(rusage)))) wpid = Pid_t(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -93,9 +215,9 @@ func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, e1 := callioctl(fd, int(req), arg) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(arg)) + if r0 == -1 && er != nil { + err = er } return } @@ -103,10 +225,10 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func FcntlInt(fd uintptr, cmd int, arg int) (r int, err error) { - r0, e1 := callfcntl(fd, cmd, uintptr(arg)) + r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)) r = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -114,20 +236,9 @@ func FcntlInt(fd uintptr, cmd int, arg int) (r int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) { - _, e1 := callfcntl(fd, cmd, uintptr(unsafe.Pointer(lk))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, e1 := callfcntl(uintptr(fd), cmd, uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(uintptr(unsafe.Pointer(lk)))) + if r0 == -1 && er != nil { + err = er } return } @@ -135,14 +246,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Acct(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callacct(uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.acct(C.uintptr_t(_p0)) + if r0 == -1 && er != nil { + err = er } return } @@ -150,14 +257,10 @@ func Acct(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callchdir(uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.chdir(C.uintptr_t(_p0)) + if r0 == -1 && er != nil { + err = er } return } @@ -165,14 +268,10 @@ func Chdir(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callchroot(uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.chroot(C.uintptr_t(_p0)) + if r0 == -1 && er != nil { + err = er } return } @@ -180,9 +279,9 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, e1 := callclose(fd) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.close(C.int(fd)) + if r0 == -1 && er != nil { + err = er } return } @@ -190,10 +289,20 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { - r0, e1 := calldup(oldfd) + r0, er := C.dup(C.int(oldfd)) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup3(oldfd int, newfd int, flags int) (err error) { + r0, er := C.dup3(C.int(oldfd), C.int(newfd), C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -201,21 +310,27 @@ func Dup(oldfd int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - callexit(code) + C.exit(C.int(code)) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.faccessat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(flags)) + if r0 == -1 && er != nil { + err = er } - _, e1 := callfaccessat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, flags) - if e1 != 0 { - err = errnoErr(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { + r0, er := C.fallocate(C.int(fd), C.uint(mode), C.longlong(off), C.longlong(len)) + if r0 == -1 && er != nil { + err = er } return } @@ -223,9 +338,9 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, e1 := callfchdir(fd) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fchdir(C.int(fd)) + if r0 == -1 && er != nil { + err = er } return } @@ -233,9 +348,9 @@ func Fchdir(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, e1 := callfchmod(fd, mode) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fchmod(C.int(fd), C.uint(mode)) + if r0 == -1 && er != nil { + err = er } return } @@ -243,14 +358,10 @@ func Fchmod(fd int, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callfchmodat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, flags) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.fchmodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -258,14 +369,21 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.fchownat(C.int(dirfd), C.uintptr_t(_p0), C.int(uid), C.int(gid), C.int(flags)) + if r0 == -1 && er != nil { + err = er } - _, e1 := callfchownat(dirfd, uintptr(unsafe.Pointer(_p0)), uid, gid, flags) - if e1 != 0 { - err = errnoErr(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)) + val = int(r0) + if r0 == -1 && er != nil { + err = er } return } @@ -273,9 +391,9 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fdatasync(fd int) (err error) { - _, e1 := callfdatasync(fd) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fdatasync(C.int(fd)) + if r0 == -1 && er != nil { + err = er } return } @@ -283,9 +401,9 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, e1 := callfsync(fd) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fsync(C.int(fd)) + if r0 == -1 && er != nil { + err = er } return } @@ -293,10 +411,10 @@ func Fsync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, e1 := callgetpgid(pid) + r0, er := C.getpgid(C.int(pid)) pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -304,7 +422,7 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pid int) { - r0, _ := callgetpgrp() + r0, _ := C.getpgrp() pid = int(r0) return } @@ -312,7 +430,7 @@ func Getpgrp() (pid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _ := callgetpid() + r0, _ := C.getpid() pid = int(r0) return } @@ -320,7 +438,7 @@ func Getpid() (pid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _ := callgetppid() + r0, _ := C.getppid() ppid = int(r0) return } @@ -328,10 +446,10 @@ func Getppid() (ppid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, e1 := callgetpriority(which, who) + r0, er := C.getpriority(C.int(which), C.int(who)) prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -339,9 +457,9 @@ func Getpriority(which int, who int) (prio int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, e1 := callgetrusage(who, uintptr(unsafe.Pointer(rusage))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.getrusage(C.int(who), C.uintptr_t(uintptr(unsafe.Pointer(rusage)))) + if r0 == -1 && er != nil { + err = er } return } @@ -349,20 +467,20 @@ func Getrusage(who int, rusage *Rusage) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, e1 := callgetsid(pid) + r0, er := C.getsid(C.int(pid)) sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Kill(pid int, sig Signal) (err error) { - _, e1 := callkill(pid, int(sig)) - if e1 != 0 { - err = errnoErr(e1) +func Kill(pid int, sig syscall.Signal) (err error) { + r0, er := C.kill(C.int(pid), C.int(sig)) + if r0 == -1 && er != nil { + err = er } return } @@ -374,10 +492,12 @@ func Klogctl(typ int, buf []byte) (n int, err error) { if len(buf) > 0 { _p0 = &buf[0] } - r0, e1 := callsyslog(typ, uintptr(unsafe.Pointer(_p0)), len(buf)) + var _p1 int + _p1 = len(buf) + r0, er := C.syslog(C.int(typ), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -385,14 +505,10 @@ func Klogctl(typ int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callmkdir(dirfd, uintptr(unsafe.Pointer(_p0)), mode) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.mkdir(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode)) + if r0 == -1 && er != nil { + err = er } return } @@ -400,14 +516,10 @@ func Mkdir(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callmkdirat(dirfd, uintptr(unsafe.Pointer(_p0)), mode) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.mkdirat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode)) + if r0 == -1 && er != nil { + err = er } return } @@ -415,14 +527,10 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callmkfifo(uintptr(unsafe.Pointer(_p0)), mode) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.mkfifo(C.uintptr_t(_p0), C.uint(mode)) + if r0 == -1 && er != nil { + err = er } return } @@ -430,14 +538,10 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callmknod(uintptr(unsafe.Pointer(_p0)), mode, dev) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.mknod(C.uintptr_t(_p0), C.uint(mode), C.int(dev)) + if r0 == -1 && er != nil { + err = er } return } @@ -445,14 +549,10 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callmknodat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, dev) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.mknodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(dev)) + if r0 == -1 && er != nil { + err = er } return } @@ -460,9 +560,9 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, e1 := callnanosleep(uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.nanosleep(C.uintptr_t(uintptr(unsafe.Pointer(time))), C.uintptr_t(uintptr(unsafe.Pointer(leftover)))) + if r0 == -1 && er != nil { + err = er } return } @@ -470,15 +570,11 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, e1 := callopen64(uintptr(unsafe.Pointer(_p0)), mode, perm) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.open64(C.uintptr_t(_p0), C.int(mode), C.uint(perm)) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -486,15 +582,11 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, e1 := callopenat(dirfd, uintptr(unsafe.Pointer(_p0)), flags, mode) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.openat(C.int(dirfd), C.uintptr_t(_p0), C.int(flags), C.uint(mode)) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -506,10 +598,12 @@ func read(fd int, p []byte) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, e1 := callread(fd, uintptr(unsafe.Pointer(_p0)), len(p)) + var _p1 int + _p1 = len(p) + r0, er := C.read(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -517,19 +611,29 @@ func read(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } + _p0 := uintptr(unsafe.Pointer(C.CString(path))) var _p1 *byte if len(buf) > 0 { _p1 = &buf[0] } - r0, e1 := callreadlink(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), len(buf)) + var _p2 int + _p2 = len(buf) + r0, er := C.readlink(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(_p1))), C.size_t(_p2)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Removexattr(path string, attr string) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + _p1 := uintptr(unsafe.Pointer(C.CString(attr))) + r0, er := C.removexattr(C.uintptr_t(_p0), C.uintptr_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -537,19 +641,11 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, e1 := callrenameat(olddirfd, uintptr(unsafe.Pointer(_p0)), newdirfd, uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(oldpath))) + _p1 := uintptr(unsafe.Pointer(C.CString(newpath))) + r0, er := C.renameat(C.int(olddirfd), C.uintptr_t(_p0), C.int(newdirfd), C.uintptr_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -561,9 +657,11 @@ func Setdomainname(p []byte) (err error) { if len(p) > 0 { _p0 = &p[0] } - _, e1 := callsetdomainname(uintptr(unsafe.Pointer(_p0)), len(p)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(p) + r0, er := C.setdomainname(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -575,9 +673,11 @@ func Sethostname(p []byte) (err error) { if len(p) > 0 { _p0 = &p[0] } - _, e1 := callsethostname(uintptr(unsafe.Pointer(_p0)), len(p)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(p) + r0, er := C.sethostname(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -585,9 +685,9 @@ func Sethostname(p []byte) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, e1 := callsetpgid(pid, pgid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setpgid(C.int(pid), C.int(pgid)) + if r0 == -1 && er != nil { + err = er } return } @@ -595,10 +695,10 @@ func Setpgid(pid int, pgid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, e1 := callsetsid() + r0, er := C.setsid() pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -606,9 +706,9 @@ func Setsid() (pid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tv *Timeval) (err error) { - _, e1 := callsettimeofday(uintptr(unsafe.Pointer(tv))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.settimeofday(C.uintptr_t(uintptr(unsafe.Pointer(tv)))) + if r0 == -1 && er != nil { + err = er } return } @@ -616,9 +716,9 @@ func Settimeofday(tv *Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, e1 := callsetuid(uid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setuid(C.int(uid)) + if r0 == -1 && er != nil { + err = er } return } @@ -626,9 +726,9 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(uid int) (err error) { - _, e1 := callsetgid(uid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setgid(C.int(uid)) + if r0 == -1 && er != nil { + err = er } return } @@ -636,9 +736,9 @@ func Setgid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, e1 := callsetpriority(which, who, prio) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setpriority(C.int(which), C.int(who), C.int(prio)) + if r0 == -1 && er != nil { + err = er } return } @@ -646,14 +746,10 @@ func Setpriority(which int, who int, prio int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callstatx(dirfd, uintptr(unsafe.Pointer(_p0)), flags, mask, uintptr(unsafe.Pointer(stat))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.statx(C.int(dirfd), C.uintptr_t(_p0), C.int(flags), C.int(mask), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) + if r0 == -1 && er != nil { + err = er } return } @@ -661,17 +757,28 @@ func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err erro // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() { - callsync() + C.sync() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { + r0, er := C.tee(C.int(rfd), C.int(wfd), C.int(len), C.int(flags)) + n = int64(r0) + if r0 == -1 && er != nil { + err = er + } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Times(tms *Tms) (ticks uintptr, err error) { - r0, e1 := calltimes(uintptr(unsafe.Pointer(tms))) + r0, er := C.times(C.uintptr_t(uintptr(unsafe.Pointer(tms)))) ticks = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) + if uintptr(r0) == ^uintptr(0) && er != nil { + err = er } return } @@ -679,7 +786,7 @@ func Times(tms *Tms) (ticks uintptr, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(mask int) (oldmask int) { - r0, _ := callumask(mask) + r0, _ := C.umask(C.int(mask)) oldmask = int(r0) return } @@ -687,9 +794,9 @@ func Umask(mask int) (oldmask int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Uname(buf *Utsname) (err error) { - _, e1 := calluname(uintptr(unsafe.Pointer(buf))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.uname(C.uintptr_t(uintptr(unsafe.Pointer(buf)))) + if r0 == -1 && er != nil { + err = er } return } @@ -697,14 +804,10 @@ func Uname(buf *Utsname) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callunlink(uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.unlink(C.uintptr_t(_p0)) + if r0 == -1 && er != nil { + err = er } return } @@ -712,14 +815,20 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.unlinkat(C.int(dirfd), C.uintptr_t(_p0), C.int(flags)) + if r0 == -1 && er != nil { + err = er } - _, e1 := callunlinkat(dirfd, uintptr(unsafe.Pointer(_p0)), flags) - if e1 != 0 { - err = errnoErr(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unshare(flags int) (err error) { + r0, er := C.unshare(C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -727,9 +836,9 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, e1 := callustat(dev, uintptr(unsafe.Pointer(ubuf))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.ustat(C.int(dev), C.uintptr_t(uintptr(unsafe.Pointer(ubuf)))) + if r0 == -1 && er != nil { + err = er } return } @@ -741,10 +850,12 @@ func write(fd int, p []byte) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, e1 := callwrite(fd, uintptr(unsafe.Pointer(_p0)), len(p)) + var _p1 int + _p1 = len(p) + r0, er := C.write(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -752,10 +863,10 @@ func write(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, p *byte, np int) (n int, err error) { - r0, e1 := callread(fd, uintptr(unsafe.Pointer(p)), np) + r0, er := C.read(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -763,10 +874,10 @@ func readlen(fd int, p *byte, np int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, p *byte, np int) (n int, err error) { - r0, e1 := callwrite(fd, uintptr(unsafe.Pointer(p)), np) + r0, er := C.write(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -774,9 +885,9 @@ func writelen(fd int, p *byte, np int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(oldfd int, newfd int) (err error) { - _, e1 := calldup2(oldfd, newfd) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.dup2(C.int(oldfd), C.int(newfd)) + if r0 == -1 && er != nil { + err = er } return } @@ -784,9 +895,9 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, e1 := callposix_fadvise64(fd, offset, length, advice) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.posix_fadvise64(C.int(fd), C.longlong(offset), C.longlong(length), C.int(advice)) + if r0 == -1 && er != nil { + err = er } return } @@ -794,34 +905,30 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, e1 := callfchown(fd, uid, gid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fchown(C.int(fd), C.int(uid), C.int(gid)) + if r0 == -1 && er != nil { + err = er } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *Stat_t) (err error) { - _, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat))) - if e1 != 0 { - err = errnoErr(e1) +func Fstat(fd int, stat *Stat_t) (err error) { + r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) + if r0 == -1 && er != nil { + err = er } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callfstatat(dirfd, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), flags) - if e1 != 0 { - err = errnoErr(e1) +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -829,9 +936,9 @@ func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, buf *Statfs_t) (err error) { - _, e1 := callfstatfs(fd, uintptr(unsafe.Pointer(buf))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.fstatfs(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(buf)))) + if r0 == -1 && er != nil { + err = er } return } @@ -839,9 +946,9 @@ func Fstatfs(fd int, buf *Statfs_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, e1 := callftruncate(fd, length) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.ftruncate(C.int(fd), C.longlong(length)) + if r0 == -1 && er != nil { + err = er } return } @@ -849,7 +956,7 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _ := callgetegid() + r0, _ := C.getegid() egid = int(r0) return } @@ -857,7 +964,7 @@ func Getegid() (egid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (euid int) { - r0, _ := callgeteuid() + r0, _ := C.geteuid() euid = int(r0) return } @@ -865,7 +972,7 @@ func Geteuid() (euid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _ := callgetgid() + r0, _ := C.getgid() gid = int(r0) return } @@ -873,7 +980,7 @@ func Getgid() (gid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _ := callgetuid() + r0, _ := C.getuid() uid = int(r0) return } @@ -881,14 +988,10 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := calllchown(uintptr(unsafe.Pointer(_p0)), uid, gid) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.lchown(C.uintptr_t(_p0), C.int(uid), C.int(gid)) + if r0 == -1 && er != nil { + err = er } return } @@ -896,24 +999,20 @@ func Lchown(path string, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, n int) (err error) { - _, e1 := calllisten(s, n) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.listen(C.int(s), C.int(n)) + if r0 == -1 && er != nil { + err = er } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := calllstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat))) - if e1 != 0 { - err = errnoErr(e1) +func Lstat(path string, stat *Stat_t) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) + if r0 == -1 && er != nil { + err = er } return } @@ -921,9 +1020,9 @@ func lstat(path string, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pause() (err error) { - _, e1 := callpause() - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.pause() + if r0 == -1 && er != nil { + err = er } return } @@ -935,10 +1034,12 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, e1 := callpread64(fd, uintptr(unsafe.Pointer(_p0)), len(p), offset) + var _p1 int + _p1 = len(p) + r0, er := C.pread64(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.longlong(offset)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -950,21 +1051,12 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { if len(p) > 0 { _p0 = &p[0] } - r0, e1 := callpwrite64(fd, uintptr(unsafe.Pointer(_p0)), len(p), offset) + var _p1 int + _p1 = len(p) + r0, er := C.pwrite64(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.longlong(offset)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, e1 := callselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -972,10 +1064,10 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) + r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask)))) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -983,9 +1075,9 @@ func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask * // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, e1 := callsetregid(rgid, egid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setregid(C.int(rgid), C.int(egid)) + if r0 == -1 && er != nil { + err = er } return } @@ -993,9 +1085,9 @@ func Setregid(rgid int, egid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, e1 := callsetreuid(ruid, euid) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setreuid(C.int(ruid), C.int(euid)) + if r0 == -1 && er != nil { + err = er } return } @@ -1003,9 +1095,9 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(fd int, how int) (err error) { - _, e1 := callshutdown(fd, how) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.shutdown(C.int(fd), C.int(how)) + if r0 == -1 && er != nil { + err = er } return } @@ -1013,25 +1105,21 @@ func Shutdown(fd int, how int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { - r0, e1 := callsplice(rfd, uintptr(unsafe.Pointer(roff)), wfd, uintptr(unsafe.Pointer(woff)), len, flags) + r0, er := C.splice(C.int(rfd), C.uintptr_t(uintptr(unsafe.Pointer(roff))), C.int(wfd), C.uintptr_t(uintptr(unsafe.Pointer(woff))), C.int(len), C.int(flags)) n = int64(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, statptr *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statptr))) - if e1 != 0 { - err = errnoErr(e1) +func Stat(path string, stat *Stat_t) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1039,14 +1127,10 @@ func stat(path string, statptr *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, buf *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callstatfs(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.statfs(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(buf)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1054,14 +1138,10 @@ func Statfs(path string, buf *Statfs_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := calltruncate(uintptr(unsafe.Pointer(_p0)), length) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.truncate(C.uintptr_t(_p0), C.longlong(length)) + if r0 == -1 && er != nil { + err = er } return } @@ -1069,9 +1149,9 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, e1 := callbind(s, uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.bind(C.int(s), C.uintptr_t(uintptr(addr)), C.uintptr_t(uintptr(addrlen))) + if r0 == -1 && er != nil { + err = er } return } @@ -1079,9 +1159,9 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, e1 := callconnect(s, uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.connect(C.int(s), C.uintptr_t(uintptr(addr)), C.uintptr_t(uintptr(addrlen))) + if r0 == -1 && er != nil { + err = er } return } @@ -1089,10 +1169,10 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(n int, list *_Gid_t) (nn int, err error) { - r0, e1 := callgetgroups(n, uintptr(unsafe.Pointer(list))) + r0, er := C.getgroups(C.int(n), C.uintptr_t(uintptr(unsafe.Pointer(list)))) nn = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1100,9 +1180,9 @@ func getgroups(n int, list *_Gid_t) (nn int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(n int, list *_Gid_t) (err error) { - _, e1 := callsetgroups(n, uintptr(unsafe.Pointer(list))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setgroups(C.int(n), C.uintptr_t(uintptr(unsafe.Pointer(list)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1110,9 +1190,9 @@ func setgroups(n int, list *_Gid_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, e1 := callgetsockopt(s, level, name, uintptr(val), uintptr(unsafe.Pointer(vallen))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.getsockopt(C.int(s), C.int(level), C.int(name), C.uintptr_t(uintptr(val)), C.uintptr_t(uintptr(unsafe.Pointer(vallen)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1120,9 +1200,9 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, e1 := callsetsockopt(s, level, name, uintptr(val), vallen) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setsockopt(C.int(s), C.int(level), C.int(name), C.uintptr_t(uintptr(val)), C.uintptr_t(vallen)) + if r0 == -1 && er != nil { + err = er } return } @@ -1130,10 +1210,10 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, e1 := callsocket(domain, typ, proto) + r0, er := C.socket(C.int(domain), C.int(typ), C.int(proto)) fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1141,9 +1221,9 @@ func socket(domain int, typ int, proto int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, e1 := callsocketpair(domain, typ, proto, uintptr(unsafe.Pointer(fd))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.socketpair(C.int(domain), C.int(typ), C.int(proto), C.uintptr_t(uintptr(unsafe.Pointer(fd)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1151,9 +1231,9 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, e1 := callgetpeername(fd, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.getpeername(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(rsa))), C.uintptr_t(uintptr(unsafe.Pointer(addrlen)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1161,9 +1241,9 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, e1 := callgetsockname(fd, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.getsockname(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(rsa))), C.uintptr_t(uintptr(unsafe.Pointer(addrlen)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1175,10 +1255,12 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl if len(p) > 0 { _p0 = &p[0] } - r0, e1 := callrecvfrom(fd, uintptr(unsafe.Pointer(_p0)), len(p), flags, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + var _p1 int + _p1 = len(p) + r0, er := C.recvfrom(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.int(flags), C.uintptr_t(uintptr(unsafe.Pointer(from))), C.uintptr_t(uintptr(unsafe.Pointer(fromlen)))) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1190,9 +1272,11 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( if len(buf) > 0 { _p0 = &buf[0] } - _, e1 := callsendto(s, uintptr(unsafe.Pointer(_p0)), len(buf), flags, uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(buf) + r0, er := C.sendto(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.int(flags), C.uintptr_t(uintptr(to)), C.uintptr_t(uintptr(addrlen))) + if r0 == -1 && er != nil { + err = er } return } @@ -1200,10 +1284,10 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, e1 := callnrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) + r0, er := C.recvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1211,10 +1295,10 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, e1 := callnsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) + r0, er := C.sendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1222,9 +1306,9 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, e1 := callmunmap(addr, length) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.munmap(C.uintptr_t(addr), C.uintptr_t(length)) + if r0 == -1 && er != nil { + err = er } return } @@ -1236,9 +1320,11 @@ func Madvise(b []byte, advice int) (err error) { if len(b) > 0 { _p0 = &b[0] } - _, e1 := callmadvise(uintptr(unsafe.Pointer(_p0)), len(b), advice) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(b) + r0, er := C.madvise(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.int(advice)) + if r0 == -1 && er != nil { + err = er } return } @@ -1250,9 +1336,11 @@ func Mprotect(b []byte, prot int) (err error) { if len(b) > 0 { _p0 = &b[0] } - _, e1 := callmprotect(uintptr(unsafe.Pointer(_p0)), len(b), prot) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(b) + r0, er := C.mprotect(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.int(prot)) + if r0 == -1 && er != nil { + err = er } return } @@ -1264,9 +1352,11 @@ func Mlock(b []byte) (err error) { if len(b) > 0 { _p0 = &b[0] } - _, e1 := callmlock(uintptr(unsafe.Pointer(_p0)), len(b)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(b) + r0, er := C.mlock(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -1274,9 +1364,9 @@ func Mlock(b []byte) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, e1 := callmlockall(flags) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.mlockall(C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -1288,9 +1378,11 @@ func Msync(b []byte, flags int) (err error) { if len(b) > 0 { _p0 = &b[0] } - _, e1 := callmsync(uintptr(unsafe.Pointer(_p0)), len(b), flags) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(b) + r0, er := C.msync(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1), C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -1302,9 +1394,11 @@ func Munlock(b []byte) (err error) { if len(b) > 0 { _p0 = &b[0] } - _, e1 := callmunlock(uintptr(unsafe.Pointer(_p0)), len(b)) - if e1 != 0 { - err = errnoErr(e1) + var _p1 int + _p1 = len(b) + r0, er := C.munlock(C.uintptr_t(uintptr(unsafe.Pointer(_p0))), C.size_t(_p1)) + if r0 == -1 && er != nil { + err = er } return } @@ -1312,9 +1406,9 @@ func Munlock(b []byte) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, e1 := callmunlockall() - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.munlockall() + if r0 == -1 && er != nil { + err = er } return } @@ -1322,9 +1416,19 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]_C_int) (err error) { - _, e1 := callpipe(uintptr(unsafe.Pointer(p))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.pipe(C.uintptr_t(uintptr(unsafe.Pointer(p)))) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + r0, er := C.pipe2(C.uintptr_t(uintptr(unsafe.Pointer(p))), C.int(flags)) + if r0 == -1 && er != nil { + err = er } return } @@ -1332,10 +1436,10 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, e1 := callpoll(uintptr(unsafe.Pointer(fds)), nfds, timeout) + r0, er := C.poll(C.uintptr_t(uintptr(unsafe.Pointer(fds))), C.int(nfds), C.int(timeout)) n = int(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1343,9 +1447,9 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tv *Timeval, tzp *Timezone) (err error) { - _, e1 := callgettimeofday(uintptr(unsafe.Pointer(tv)), uintptr(unsafe.Pointer(tzp))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.gettimeofday(C.uintptr_t(uintptr(unsafe.Pointer(tv))), C.uintptr_t(uintptr(unsafe.Pointer(tzp)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1353,10 +1457,10 @@ func gettimeofday(tv *Timeval, tzp *Timezone) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Time(t *Time_t) (tt Time_t, err error) { - r0, e1 := calltime(uintptr(unsafe.Pointer(t))) + r0, er := C.time(C.uintptr_t(uintptr(unsafe.Pointer(t)))) tt = Time_t(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1364,37 +1468,10 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, e1 := callutime(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsystemcfg(label int) (n uint64) { - r0, _ := callgetsystemcfg(label) - n = uint64(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func umount(target string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(target) - if err != nil { - return - } - _, e1 := callumount(uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) + _p0 := uintptr(unsafe.Pointer(C.CString(path))) + r0, er := C.utime(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(buf)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1402,9 +1479,9 @@ func umount(target string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(resource int, rlim *Rlimit) (err error) { - _, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.getrlimit(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1412,9 +1489,9 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, e1 := callsetrlimit(resource, uintptr(unsafe.Pointer(rlim))) - if e1 != 0 { - err = errnoErr(e1) + r0, er := C.setrlimit(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) + if r0 == -1 && er != nil { + err = er } return } @@ -1422,10 +1499,10 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (off int64, err error) { - r0, e1 := calllseek(fd, offset, whence) + r0, er := C.lseek(C.int(fd), C.longlong(offset), C.int(whence)) off = int64(r0) - if e1 != 0 { - err = errnoErr(e1) + if r0 == -1 && er != nil { + err = er } return } @@ -1433,10 +1510,10 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - r0, e1 := callmmap64(addr, length, prot, flags, fd, offset) + r0, er := C.mmap64(C.uintptr_t(addr), C.uintptr_t(length), C.int(prot), C.int(flags), C.int(fd), C.longlong(offset)) xaddr = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) + if uintptr(r0) == ^uintptr(0) && er != nil { + err = er } return } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go deleted file mode 100644 index 4b3a8ad7..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ /dev/null @@ -1,1192 +0,0 @@ -// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build aix,ppc64 -// +build !gccgo - -package unix - -import ( - "unsafe" -) - -//go:cgo_import_dynamic libc_utimes utimes "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_utimensat utimensat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getcwd getcwd "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_accept accept "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getdirent getdirent "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_wait4 wait4 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_ioctl ioctl "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fcntl fcntl "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_acct acct "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_chdir chdir "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_chroot chroot "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_close close "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_dup dup "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_exit exit "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_faccessat faccessat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fchdir fchdir "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fchmod fchmod "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fchownat fchownat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fdatasync fdatasync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fsync fsync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getpgid getpgid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getpid getpid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getppid getppid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getpriority getpriority "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getrusage getrusage "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getsid getsid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_kill kill "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_syslog syslog "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mkdir mkdir "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mknod mknod "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mknodat mknodat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_open64 open64 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_openat openat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_read read "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_readlink readlink "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_renameat renameat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setdomainname setdomainname "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_sethostname sethostname "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setpgid setpgid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setsid setsid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setuid setuid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setgid setgid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setpriority setpriority "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_statx statx "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_sync sync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_times times "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_umask umask "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_uname uname "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_unlink unlink "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_ustat ustat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_write write "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_dup2 dup2 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_posix_fadvise64 posix_fadvise64 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fchown fchown "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fstat fstat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fstatat fstatat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getegid getegid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_geteuid geteuid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getgid getgid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getuid getuid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_lchown lchown "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_listen listen "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_lstat lstat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_pause pause "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_pread64 pread64 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_pwrite64 pwrite64 "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_select select "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_pselect pselect "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setregid setregid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setreuid setreuid "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_shutdown shutdown "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_splice splice "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_stat stat "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_statfs statfs "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_truncate truncate "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_bind bind "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_connect connect "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getgroups getgroups "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setgroups setgroups "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_socket socket "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_socketpair socketpair "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getpeername getpeername "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getsockname getsockname "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_sendto sendto "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_nrecvmsg nrecvmsg "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_nsendmsg nsendmsg "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_madvise madvise "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mprotect mprotect "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mlock mlock "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mlockall mlockall "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_msync msync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_munlock munlock "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_munlockall munlockall "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_pipe pipe "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_poll poll "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_time time "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_utime utime "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_mmap64 mmap64 "libc.a/shr_64.o" - -//go:linkname libc_utimes libc_utimes -//go:linkname libc_utimensat libc_utimensat -//go:linkname libc_getcwd libc_getcwd -//go:linkname libc_accept libc_accept -//go:linkname libc_getdirent libc_getdirent -//go:linkname libc_wait4 libc_wait4 -//go:linkname libc_ioctl libc_ioctl -//go:linkname libc_fcntl libc_fcntl -//go:linkname libc_acct libc_acct -//go:linkname libc_chdir libc_chdir -//go:linkname libc_chroot libc_chroot -//go:linkname libc_close libc_close -//go:linkname libc_dup libc_dup -//go:linkname libc_exit libc_exit -//go:linkname libc_faccessat libc_faccessat -//go:linkname libc_fchdir libc_fchdir -//go:linkname libc_fchmod libc_fchmod -//go:linkname libc_fchmodat libc_fchmodat -//go:linkname libc_fchownat libc_fchownat -//go:linkname libc_fdatasync libc_fdatasync -//go:linkname libc_fsync libc_fsync -//go:linkname libc_getpgid libc_getpgid -//go:linkname libc_getpgrp libc_getpgrp -//go:linkname libc_getpid libc_getpid -//go:linkname libc_getppid libc_getppid -//go:linkname libc_getpriority libc_getpriority -//go:linkname libc_getrusage libc_getrusage -//go:linkname libc_getsid libc_getsid -//go:linkname libc_kill libc_kill -//go:linkname libc_syslog libc_syslog -//go:linkname libc_mkdir libc_mkdir -//go:linkname libc_mkdirat libc_mkdirat -//go:linkname libc_mkfifo libc_mkfifo -//go:linkname libc_mknod libc_mknod -//go:linkname libc_mknodat libc_mknodat -//go:linkname libc_nanosleep libc_nanosleep -//go:linkname libc_open64 libc_open64 -//go:linkname libc_openat libc_openat -//go:linkname libc_read libc_read -//go:linkname libc_readlink libc_readlink -//go:linkname libc_renameat libc_renameat -//go:linkname libc_setdomainname libc_setdomainname -//go:linkname libc_sethostname libc_sethostname -//go:linkname libc_setpgid libc_setpgid -//go:linkname libc_setsid libc_setsid -//go:linkname libc_settimeofday libc_settimeofday -//go:linkname libc_setuid libc_setuid -//go:linkname libc_setgid libc_setgid -//go:linkname libc_setpriority libc_setpriority -//go:linkname libc_statx libc_statx -//go:linkname libc_sync libc_sync -//go:linkname libc_times libc_times -//go:linkname libc_umask libc_umask -//go:linkname libc_uname libc_uname -//go:linkname libc_unlink libc_unlink -//go:linkname libc_unlinkat libc_unlinkat -//go:linkname libc_ustat libc_ustat -//go:linkname libc_write libc_write -//go:linkname libc_dup2 libc_dup2 -//go:linkname libc_posix_fadvise64 libc_posix_fadvise64 -//go:linkname libc_fchown libc_fchown -//go:linkname libc_fstat libc_fstat -//go:linkname libc_fstatat libc_fstatat -//go:linkname libc_fstatfs libc_fstatfs -//go:linkname libc_ftruncate libc_ftruncate -//go:linkname libc_getegid libc_getegid -//go:linkname libc_geteuid libc_geteuid -//go:linkname libc_getgid libc_getgid -//go:linkname libc_getuid libc_getuid -//go:linkname libc_lchown libc_lchown -//go:linkname libc_listen libc_listen -//go:linkname libc_lstat libc_lstat -//go:linkname libc_pause libc_pause -//go:linkname libc_pread64 libc_pread64 -//go:linkname libc_pwrite64 libc_pwrite64 -//go:linkname libc_select libc_select -//go:linkname libc_pselect libc_pselect -//go:linkname libc_setregid libc_setregid -//go:linkname libc_setreuid libc_setreuid -//go:linkname libc_shutdown libc_shutdown -//go:linkname libc_splice libc_splice -//go:linkname libc_stat libc_stat -//go:linkname libc_statfs libc_statfs -//go:linkname libc_truncate libc_truncate -//go:linkname libc_bind libc_bind -//go:linkname libc_connect libc_connect -//go:linkname libc_getgroups libc_getgroups -//go:linkname libc_setgroups libc_setgroups -//go:linkname libc_getsockopt libc_getsockopt -//go:linkname libc_setsockopt libc_setsockopt -//go:linkname libc_socket libc_socket -//go:linkname libc_socketpair libc_socketpair -//go:linkname libc_getpeername libc_getpeername -//go:linkname libc_getsockname libc_getsockname -//go:linkname libc_recvfrom libc_recvfrom -//go:linkname libc_sendto libc_sendto -//go:linkname libc_nrecvmsg libc_nrecvmsg -//go:linkname libc_nsendmsg libc_nsendmsg -//go:linkname libc_munmap libc_munmap -//go:linkname libc_madvise libc_madvise -//go:linkname libc_mprotect libc_mprotect -//go:linkname libc_mlock libc_mlock -//go:linkname libc_mlockall libc_mlockall -//go:linkname libc_msync libc_msync -//go:linkname libc_munlock libc_munlock -//go:linkname libc_munlockall libc_munlockall -//go:linkname libc_pipe libc_pipe -//go:linkname libc_poll libc_poll -//go:linkname libc_gettimeofday libc_gettimeofday -//go:linkname libc_time libc_time -//go:linkname libc_utime libc_utime -//go:linkname libc_getsystemcfg libc_getsystemcfg -//go:linkname libc_umount libc_umount -//go:linkname libc_getrlimit libc_getrlimit -//go:linkname libc_setrlimit libc_setrlimit -//go:linkname libc_lseek libc_lseek -//go:linkname libc_mmap64 libc_mmap64 - -type syscallFunc uintptr - -var ( - libc_utimes, - libc_utimensat, - libc_getcwd, - libc_accept, - libc_getdirent, - libc_wait4, - libc_ioctl, - libc_fcntl, - libc_acct, - libc_chdir, - libc_chroot, - libc_close, - libc_dup, - libc_exit, - libc_faccessat, - libc_fchdir, - libc_fchmod, - libc_fchmodat, - libc_fchownat, - libc_fdatasync, - libc_fsync, - libc_getpgid, - libc_getpgrp, - libc_getpid, - libc_getppid, - libc_getpriority, - libc_getrusage, - libc_getsid, - libc_kill, - libc_syslog, - libc_mkdir, - libc_mkdirat, - libc_mkfifo, - libc_mknod, - libc_mknodat, - libc_nanosleep, - libc_open64, - libc_openat, - libc_read, - libc_readlink, - libc_renameat, - libc_setdomainname, - libc_sethostname, - libc_setpgid, - libc_setsid, - libc_settimeofday, - libc_setuid, - libc_setgid, - libc_setpriority, - libc_statx, - libc_sync, - libc_times, - libc_umask, - libc_uname, - libc_unlink, - libc_unlinkat, - libc_ustat, - libc_write, - libc_dup2, - libc_posix_fadvise64, - libc_fchown, - libc_fstat, - libc_fstatat, - libc_fstatfs, - libc_ftruncate, - libc_getegid, - libc_geteuid, - libc_getgid, - libc_getuid, - libc_lchown, - libc_listen, - libc_lstat, - libc_pause, - libc_pread64, - libc_pwrite64, - libc_select, - libc_pselect, - libc_setregid, - libc_setreuid, - libc_shutdown, - libc_splice, - libc_stat, - libc_statfs, - libc_truncate, - libc_bind, - libc_connect, - libc_getgroups, - libc_setgroups, - libc_getsockopt, - libc_setsockopt, - libc_socket, - libc_socketpair, - libc_getpeername, - libc_getsockname, - libc_recvfrom, - libc_sendto, - libc_nrecvmsg, - libc_nsendmsg, - libc_munmap, - libc_madvise, - libc_mprotect, - libc_mlock, - libc_mlockall, - libc_msync, - libc_munlock, - libc_munlockall, - libc_pipe, - libc_poll, - libc_gettimeofday, - libc_time, - libc_utime, - libc_getsystemcfg, - libc_umount, - libc_getrlimit, - libc_setrlimit, - libc_lseek, - libc_mmap64 syscallFunc -) - -// Implemented in runtime/syscall_aix.go. -func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutimes(_p0 uintptr, times uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_utimes)), 2, _p0, times, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutimensat(dirfd int, _p0 uintptr, times uintptr, flag int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_utimensat)), 4, uintptr(dirfd), _p0, times, uintptr(flag), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetcwd(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getcwd)), 2, _p0, uintptr(_lenp0), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callaccept(s int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_accept)), 3, uintptr(s), rsa, addrlen, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetdirent(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getdirent)), 3, uintptr(fd), _p0, uintptr(_lenp0), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callwait4(pid int, status uintptr, options int, rusage uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_wait4)), 4, uintptr(pid), status, uintptr(options), rusage, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callioctl(fd int, req int, arg uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_ioctl)), 3, uintptr(fd), uintptr(req), arg, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, fd, uintptr(cmd), arg, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_acct)), 1, _p0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callchdir(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_chdir)), 1, _p0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callchroot(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_chroot)), 1, _p0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callclose(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_close)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calldup(oldfd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_dup)), 1, uintptr(oldfd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callexit(code int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_exit)), 1, uintptr(code), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfaccessat(dirfd int, _p0 uintptr, mode uint32, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_faccessat)), 4, uintptr(dirfd), _p0, uintptr(mode), uintptr(flags), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchdir(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchmod(fd int, mode uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchmodat(dirfd int, _p0 uintptr, mode uint32, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchmodat)), 4, uintptr(dirfd), _p0, uintptr(mode), uintptr(flags), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchownat(dirfd int, _p0 uintptr, uid int, gid int, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchownat)), 5, uintptr(dirfd), _p0, uintptr(uid), uintptr(gid), uintptr(flags), 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfdatasync(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpgid(pid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpgrp() (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getpgrp)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getpid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetppid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getppid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpriority(which int, who int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetrusage(who int, rusage uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrusage)), 2, uintptr(who), rusage, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsid(pid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getsid)), 1, uintptr(pid), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callkill(pid int, sig int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_kill)), 2, uintptr(pid), uintptr(sig), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsyslog(typ int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_syslog)), 3, uintptr(typ), _p0, uintptr(_lenp0), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkdir(dirfd int, _p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mkdir)), 3, uintptr(dirfd), _p0, uintptr(mode), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkdirat(dirfd int, _p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mkdirat)), 3, uintptr(dirfd), _p0, uintptr(mode), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkfifo(_p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mkfifo)), 2, _p0, uintptr(mode), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmknod(_p0 uintptr, mode uint32, dev int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mknod)), 3, _p0, uintptr(mode), uintptr(dev), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmknodat(dirfd int, _p0 uintptr, mode uint32, dev int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mknodat)), 4, uintptr(dirfd), _p0, uintptr(mode), uintptr(dev), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnanosleep(time uintptr, leftover uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nanosleep)), 2, time, leftover, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callopen64(_p0 uintptr, mode int, perm uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_open64)), 3, _p0, uintptr(mode), uintptr(perm), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callopenat(dirfd int, _p0 uintptr, flags int, mode uint32) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_openat)), 4, uintptr(dirfd), _p0, uintptr(flags), uintptr(mode), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callread(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_read)), 3, uintptr(fd), _p0, uintptr(_lenp0), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callreadlink(_p0 uintptr, _p1 uintptr, _lenp1 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_readlink)), 3, _p0, _p1, uintptr(_lenp1), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callrenameat(olddirfd int, _p0 uintptr, newdirfd int, _p1 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_renameat)), 4, uintptr(olddirfd), _p0, uintptr(newdirfd), _p1, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetdomainname(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_setdomainname)), 2, _p0, uintptr(_lenp0), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsethostname(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sethostname)), 2, _p0, uintptr(_lenp0), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetpgid(pid int, pgid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetsid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setsid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsettimeofday(tv uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_settimeofday)), 1, tv, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetuid(uid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_setuid)), 1, uintptr(uid), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetgid(uid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_setgid)), 1, uintptr(uid), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetpriority(which int, who int, prio int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_setpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstatx(dirfd int, _p0 uintptr, flags int, mask int, stat uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_statx)), 5, uintptr(dirfd), _p0, uintptr(flags), uintptr(mask), stat, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsync() (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sync)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltimes(tms uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_times)), 1, tms, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callumask(mask int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_umask)), 1, uintptr(mask), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calluname(buf uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_uname)), 1, buf, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callunlink(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_unlink)), 1, _p0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callunlinkat(dirfd int, _p0 uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_unlinkat)), 3, uintptr(dirfd), _p0, uintptr(flags), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callustat(dev int, ubuf uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_ustat)), 2, uintptr(dev), ubuf, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callwrite(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_write)), 3, uintptr(fd), _p0, uintptr(_lenp0), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calldup2(oldfd int, newfd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_dup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callposix_fadvise64(fd int, offset int64, length int64, advice int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_posix_fadvise64)), 4, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchown(fd int, uid int, gid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstat(fd int, stat uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fstat)), 2, uintptr(fd), stat, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstatat(dirfd int, _p0 uintptr, stat uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fstatat)), 4, uintptr(dirfd), _p0, stat, uintptr(flags), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstatfs(fd int, buf uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fstatfs)), 2, uintptr(fd), buf, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callftruncate(fd int, length int64) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_ftruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetegid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getegid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgeteuid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_geteuid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetgid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getgid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetuid() (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getuid)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllchown(_p0 uintptr, uid int, gid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lchown)), 3, _p0, uintptr(uid), uintptr(gid), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllisten(s int, n int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_listen)), 2, uintptr(s), uintptr(n), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lstat)), 2, _p0, stat, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpause() (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pause)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpread64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pread64)), 4, uintptr(fd), _p0, uintptr(_lenp0), uintptr(offset), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pwrite64)), 4, uintptr(fd), _p0, uintptr(_lenp0), uintptr(offset), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_select)), 5, uintptr(nfd), r, w, e, timeout, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pselect)), 6, uintptr(nfd), r, w, e, timeout, sigmask) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetregid(rgid int, egid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetreuid(ruid int, euid int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callshutdown(fd int, how int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_shutdown)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_splice)), 6, uintptr(rfd), roff, uintptr(wfd), woff, uintptr(len), uintptr(flags)) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, statptr, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstatfs(_p0 uintptr, buf uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_statfs)), 2, _p0, buf, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltruncate(_p0 uintptr, length int64) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_truncate)), 2, _p0, uintptr(length), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callbind(s int, addr uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_bind)), 3, uintptr(s), addr, addrlen, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callconnect(s int, addr uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_connect)), 3, uintptr(s), addr, addrlen, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetgroups(n int, list uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getgroups)), 2, uintptr(n), list, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetgroups(n int, list uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setgroups)), 2, uintptr(n), list, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsockopt(s int, level int, name int, val uintptr, vallen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), val, vallen, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetsockopt(s int, level int, name int, val uintptr, vallen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_setsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), val, vallen, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsocket(domain int, typ int, proto int) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_socket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsocketpair(domain int, typ int, proto int, fd uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_socketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), fd, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpeername(fd int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getpeername)), 3, uintptr(fd), rsa, addrlen, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsockname(fd int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getsockname)), 3, uintptr(fd), rsa, addrlen, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callrecvfrom(fd int, _p0 uintptr, _lenp0 int, flags int, from uintptr, fromlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_recvfrom)), 6, uintptr(fd), _p0, uintptr(_lenp0), uintptr(flags), from, fromlen) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sendto)), 6, uintptr(s), _p0, uintptr(_lenp0), uintptr(flags), to, addrlen) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nrecvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nsendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunmap(addr uintptr, length uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_munmap)), 2, addr, length, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmadvise(_p0 uintptr, _lenp0 int, advice int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_madvise)), 3, _p0, uintptr(_lenp0), uintptr(advice), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmprotect(_p0 uintptr, _lenp0 int, prot int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mprotect)), 3, _p0, uintptr(_lenp0), uintptr(prot), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmlock(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mlock)), 2, _p0, uintptr(_lenp0), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmlockall(flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmsync(_p0 uintptr, _lenp0 int, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_msync)), 3, _p0, uintptr(_lenp0), uintptr(flags), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunlock(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_munlock)), 2, _p0, uintptr(_lenp0), 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunlockall() (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_munlockall)), 0, 0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpipe(p uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_pipe)), 1, p, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpoll(fds uintptr, nfds int, timeout int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_poll)), 3, fds, uintptr(nfds), uintptr(timeout), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgettimeofday(tv uintptr, tzp uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_gettimeofday)), 2, tv, tzp, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltime(t uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_time)), 1, t, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutime(_p0 uintptr, buf uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_utime)), 2, _p0, buf, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_umount)), 1, _p0, 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmmap64(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_mmap64)), 6, addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go deleted file mode 100644 index cde4dbc5..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ /dev/null @@ -1,1070 +0,0 @@ -// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build aix,ppc64 -// +build gccgo - -package unix - -/* -#include -int utimes(uintptr_t, uintptr_t); -int utimensat(int, uintptr_t, uintptr_t, int); -int getcwd(uintptr_t, size_t); -int accept(int, uintptr_t, uintptr_t); -int getdirent(int, uintptr_t, size_t); -int wait4(int, uintptr_t, int, uintptr_t); -int ioctl(int, int, uintptr_t); -int fcntl(uintptr_t, int, uintptr_t); -int acct(uintptr_t); -int chdir(uintptr_t); -int chroot(uintptr_t); -int close(int); -int dup(int); -void exit(int); -int faccessat(int, uintptr_t, unsigned int, int); -int fchdir(int); -int fchmod(int, unsigned int); -int fchmodat(int, uintptr_t, unsigned int, int); -int fchownat(int, uintptr_t, int, int, int); -int fdatasync(int); -int fsync(int); -int getpgid(int); -int getpgrp(); -int getpid(); -int getppid(); -int getpriority(int, int); -int getrusage(int, uintptr_t); -int getsid(int); -int kill(int, int); -int syslog(int, uintptr_t, size_t); -int mkdir(int, uintptr_t, unsigned int); -int mkdirat(int, uintptr_t, unsigned int); -int mkfifo(uintptr_t, unsigned int); -int mknod(uintptr_t, unsigned int, int); -int mknodat(int, uintptr_t, unsigned int, int); -int nanosleep(uintptr_t, uintptr_t); -int open64(uintptr_t, int, unsigned int); -int openat(int, uintptr_t, int, unsigned int); -int read(int, uintptr_t, size_t); -int readlink(uintptr_t, uintptr_t, size_t); -int renameat(int, uintptr_t, int, uintptr_t); -int setdomainname(uintptr_t, size_t); -int sethostname(uintptr_t, size_t); -int setpgid(int, int); -int setsid(); -int settimeofday(uintptr_t); -int setuid(int); -int setgid(int); -int setpriority(int, int, int); -int statx(int, uintptr_t, int, int, uintptr_t); -int sync(); -uintptr_t times(uintptr_t); -int umask(int); -int uname(uintptr_t); -int unlink(uintptr_t); -int unlinkat(int, uintptr_t, int); -int ustat(int, uintptr_t); -int write(int, uintptr_t, size_t); -int dup2(int, int); -int posix_fadvise64(int, long long, long long, int); -int fchown(int, int, int); -int fstat(int, uintptr_t); -int fstatat(int, uintptr_t, uintptr_t, int); -int fstatfs(int, uintptr_t); -int ftruncate(int, long long); -int getegid(); -int geteuid(); -int getgid(); -int getuid(); -int lchown(uintptr_t, int, int); -int listen(int, int); -int lstat(uintptr_t, uintptr_t); -int pause(); -int pread64(int, uintptr_t, size_t, long long); -int pwrite64(int, uintptr_t, size_t, long long); -#define c_select select -int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); -int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); -int setregid(int, int); -int setreuid(int, int); -int shutdown(int, int); -long long splice(int, uintptr_t, int, uintptr_t, int, int); -int stat(uintptr_t, uintptr_t); -int statfs(uintptr_t, uintptr_t); -int truncate(uintptr_t, long long); -int bind(int, uintptr_t, uintptr_t); -int connect(int, uintptr_t, uintptr_t); -int getgroups(int, uintptr_t); -int setgroups(int, uintptr_t); -int getsockopt(int, int, int, uintptr_t, uintptr_t); -int setsockopt(int, int, int, uintptr_t, uintptr_t); -int socket(int, int, int); -int socketpair(int, int, int, uintptr_t); -int getpeername(int, uintptr_t, uintptr_t); -int getsockname(int, uintptr_t, uintptr_t); -int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); -int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); -int nrecvmsg(int, uintptr_t, int); -int nsendmsg(int, uintptr_t, int); -int munmap(uintptr_t, uintptr_t); -int madvise(uintptr_t, size_t, int); -int mprotect(uintptr_t, size_t, int); -int mlock(uintptr_t, size_t); -int mlockall(int); -int msync(uintptr_t, size_t, int); -int munlock(uintptr_t, size_t); -int munlockall(); -int pipe(uintptr_t); -int poll(uintptr_t, int, int); -int gettimeofday(uintptr_t, uintptr_t); -int time(uintptr_t); -int utime(uintptr_t, uintptr_t); -unsigned long long getsystemcfg(int); -int umount(uintptr_t); -int getrlimit(int, uintptr_t); -int setrlimit(int, uintptr_t); -long long lseek(int, long long, int); -uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long); - -*/ -import "C" -import ( - "syscall" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutimes(_p0 uintptr, times uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.utimes(C.uintptr_t(_p0), C.uintptr_t(times))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutimensat(dirfd int, _p0 uintptr, times uintptr, flag int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.utimensat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(times), C.int(flag))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetcwd(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getcwd(C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callaccept(s int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.accept(C.int(s), C.uintptr_t(rsa), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetdirent(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getdirent(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callwait4(pid int, status uintptr, options int, rusage uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.wait4(C.int(pid), C.uintptr_t(status), C.int(options), C.uintptr_t(rusage))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callioctl(fd int, req int, arg uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.ioctl(C.int(fd), C.int(req), C.uintptr_t(arg))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.acct(C.uintptr_t(_p0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callchdir(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.chdir(C.uintptr_t(_p0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callchroot(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.chroot(C.uintptr_t(_p0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callclose(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.close(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calldup(oldfd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.dup(C.int(oldfd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callexit(code int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.exit(C.int(code))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfaccessat(dirfd int, _p0 uintptr, mode uint32, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.faccessat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchdir(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fchdir(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchmod(fd int, mode uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fchmod(C.int(fd), C.uint(mode))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchmodat(dirfd int, _p0 uintptr, mode uint32, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fchmodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchownat(dirfd int, _p0 uintptr, uid int, gid int, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fchownat(C.int(dirfd), C.uintptr_t(_p0), C.int(uid), C.int(gid), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfdatasync(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fdatasync(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fsync(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpgid(pid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getpgid(C.int(pid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpgrp() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getpgrp()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getpid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetppid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getppid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpriority(which int, who int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getpriority(C.int(which), C.int(who))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetrusage(who int, rusage uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getrusage(C.int(who), C.uintptr_t(rusage))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsid(pid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getsid(C.int(pid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callkill(pid int, sig int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.kill(C.int(pid), C.int(sig))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsyslog(typ int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.syslog(C.int(typ), C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkdir(dirfd int, _p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mkdir(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkdirat(dirfd int, _p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mkdirat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmkfifo(_p0 uintptr, mode uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mkfifo(C.uintptr_t(_p0), C.uint(mode))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmknod(_p0 uintptr, mode uint32, dev int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mknod(C.uintptr_t(_p0), C.uint(mode), C.int(dev))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmknodat(dirfd int, _p0 uintptr, mode uint32, dev int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mknodat(C.int(dirfd), C.uintptr_t(_p0), C.uint(mode), C.int(dev))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnanosleep(time uintptr, leftover uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.nanosleep(C.uintptr_t(time), C.uintptr_t(leftover))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callopen64(_p0 uintptr, mode int, perm uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.open64(C.uintptr_t(_p0), C.int(mode), C.uint(perm))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callopenat(dirfd int, _p0 uintptr, flags int, mode uint32) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.openat(C.int(dirfd), C.uintptr_t(_p0), C.int(flags), C.uint(mode))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callread(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.read(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callreadlink(_p0 uintptr, _p1 uintptr, _lenp1 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.readlink(C.uintptr_t(_p0), C.uintptr_t(_p1), C.size_t(_lenp1))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callrenameat(olddirfd int, _p0 uintptr, newdirfd int, _p1 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.renameat(C.int(olddirfd), C.uintptr_t(_p0), C.int(newdirfd), C.uintptr_t(_p1))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetdomainname(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setdomainname(C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsethostname(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.sethostname(C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetpgid(pid int, pgid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setpgid(C.int(pid), C.int(pgid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetsid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setsid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsettimeofday(tv uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.settimeofday(C.uintptr_t(tv))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetuid(uid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setuid(C.int(uid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetgid(uid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setgid(C.int(uid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetpriority(which int, who int, prio int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setpriority(C.int(which), C.int(who), C.int(prio))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstatx(dirfd int, _p0 uintptr, flags int, mask int, stat uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.statx(C.int(dirfd), C.uintptr_t(_p0), C.int(flags), C.int(mask), C.uintptr_t(stat))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsync() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.sync()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltimes(tms uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.times(C.uintptr_t(tms))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callumask(mask int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.umask(C.int(mask))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calluname(buf uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.uname(C.uintptr_t(buf))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callunlink(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.unlink(C.uintptr_t(_p0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callunlinkat(dirfd int, _p0 uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.unlinkat(C.int(dirfd), C.uintptr_t(_p0), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callustat(dev int, ubuf uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.ustat(C.int(dev), C.uintptr_t(ubuf))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callwrite(fd int, _p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.write(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calldup2(oldfd int, newfd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.dup2(C.int(oldfd), C.int(newfd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callposix_fadvise64(fd int, offset int64, length int64, advice int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.posix_fadvise64(C.int(fd), C.longlong(offset), C.longlong(length), C.int(advice))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfchown(fd int, uid int, gid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fchown(C.int(fd), C.int(uid), C.int(gid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstat(fd int, stat uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fstat(C.int(fd), C.uintptr_t(stat))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstatat(dirfd int, _p0 uintptr, stat uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(stat), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callfstatfs(fd int, buf uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fstatfs(C.int(fd), C.uintptr_t(buf))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callftruncate(fd int, length int64) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.ftruncate(C.int(fd), C.longlong(length))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetegid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getegid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgeteuid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.geteuid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetgid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getgid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetuid() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getuid()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllchown(_p0 uintptr, uid int, gid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.lchown(C.uintptr_t(_p0), C.int(uid), C.int(gid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllisten(s int, n int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.listen(C.int(s), C.int(n))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.lstat(C.uintptr_t(_p0), C.uintptr_t(stat))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpause() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.pause()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpread64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.pread64(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0), C.longlong(offset))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.pwrite64(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0), C.longlong(offset))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.c_select(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.pselect(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout), C.uintptr_t(sigmask))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetregid(rgid int, egid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setregid(C.int(rgid), C.int(egid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetreuid(ruid int, euid int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setreuid(C.int(ruid), C.int(euid))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callshutdown(fd int, how int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.shutdown(C.int(fd), C.int(how))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.splice(C.int(rfd), C.uintptr_t(roff), C.int(wfd), C.uintptr_t(woff), C.int(len), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(statptr))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callstatfs(_p0 uintptr, buf uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.statfs(C.uintptr_t(_p0), C.uintptr_t(buf))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltruncate(_p0 uintptr, length int64) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.truncate(C.uintptr_t(_p0), C.longlong(length))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callbind(s int, addr uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.bind(C.int(s), C.uintptr_t(addr), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callconnect(s int, addr uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.connect(C.int(s), C.uintptr_t(addr), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetgroups(n int, list uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getgroups(C.int(n), C.uintptr_t(list))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetgroups(n int, list uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setgroups(C.int(n), C.uintptr_t(list))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsockopt(s int, level int, name int, val uintptr, vallen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getsockopt(C.int(s), C.int(level), C.int(name), C.uintptr_t(val), C.uintptr_t(vallen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetsockopt(s int, level int, name int, val uintptr, vallen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setsockopt(C.int(s), C.int(level), C.int(name), C.uintptr_t(val), C.uintptr_t(vallen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsocket(domain int, typ int, proto int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.socket(C.int(domain), C.int(typ), C.int(proto))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsocketpair(domain int, typ int, proto int, fd uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.socketpair(C.int(domain), C.int(typ), C.int(proto), C.uintptr_t(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetpeername(fd int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getpeername(C.int(fd), C.uintptr_t(rsa), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsockname(fd int, rsa uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getsockname(C.int(fd), C.uintptr_t(rsa), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callrecvfrom(fd int, _p0 uintptr, _lenp0 int, flags int, from uintptr, fromlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.recvfrom(C.int(fd), C.uintptr_t(_p0), C.size_t(_lenp0), C.int(flags), C.uintptr_t(from), C.uintptr_t(fromlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.sendto(C.int(s), C.uintptr_t(_p0), C.size_t(_lenp0), C.int(flags), C.uintptr_t(to), C.uintptr_t(addrlen))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.nrecvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.nsendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunmap(addr uintptr, length uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.munmap(C.uintptr_t(addr), C.uintptr_t(length))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmadvise(_p0 uintptr, _lenp0 int, advice int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.madvise(C.uintptr_t(_p0), C.size_t(_lenp0), C.int(advice))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmprotect(_p0 uintptr, _lenp0 int, prot int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mprotect(C.uintptr_t(_p0), C.size_t(_lenp0), C.int(prot))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmlock(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mlock(C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmlockall(flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mlockall(C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmsync(_p0 uintptr, _lenp0 int, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.msync(C.uintptr_t(_p0), C.size_t(_lenp0), C.int(flags))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunlock(_p0 uintptr, _lenp0 int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.munlock(C.uintptr_t(_p0), C.size_t(_lenp0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmunlockall() (r1 uintptr, e1 Errno) { - r1 = uintptr(C.munlockall()) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpipe(p uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.pipe(C.uintptr_t(p))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callpoll(fds uintptr, nfds int, timeout int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.poll(C.uintptr_t(fds), C.int(nfds), C.int(timeout))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgettimeofday(tv uintptr, tzp uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.gettimeofday(C.uintptr_t(tv), C.uintptr_t(tzp))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calltime(t uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.time(C.uintptr_t(t))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callutime(_p0 uintptr, buf uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.utime(C.uintptr_t(_p0), C.uintptr_t(buf))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getsystemcfg(C.int(label))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.umount(C.uintptr_t(_p0))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.getrlimit(C.int(resource), C.uintptr_t(rlim))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setrlimit(C.int(resource), C.uintptr_t(rlim))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.lseek(C.int(fd), C.longlong(offset), C.int(whence))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func callmmap64(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.mmap64(C.uintptr_t(addr), C.uintptr_t(length), C.int(prot), C.int(flags), C.int(fd), C.longlong(offset))) - e1 = syscall.GetErrno() - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go deleted file mode 100644 index c4ec7ff8..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go +++ /dev/null @@ -1,1810 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int32(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go index 23346dc6..9ce06df6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go @@ -1,7 +1,7 @@ -// go run mksyscall.go -l32 -tags darwin,386,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go +// mksyscall.pl -l32 -tags darwin,386 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,386,go1.12 +// +build darwin,386 package unix @@ -15,7 +15,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +23,20 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +44,10 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +55,30 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,101 +86,66 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -220,7 +155,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,11 +163,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -242,22 +172,17 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +190,10 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +201,10 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,11 +212,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -311,18 +221,13 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc___sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc___sysctl_trampoline() - -//go:linkname libc___sysctl libc___sysctl -//go:cgo_import_dynamic libc___sysctl __sysctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -331,37 +236,27 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -369,15 +264,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -385,11 +275,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -399,18 +284,13 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -420,33 +300,23 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -456,18 +326,13 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -477,18 +342,13 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -498,67 +358,37 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) + r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { @@ -567,11 +397,6 @@ func pipe() (r int, w int, err error) { return } -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -585,7 +410,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -593,11 +418,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -606,7 +426,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -614,11 +434,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -632,18 +447,13 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -652,18 +462,13 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { @@ -677,18 +482,13 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { @@ -697,18 +497,13 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { @@ -717,7 +512,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -725,15 +520,10 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -741,71 +531,26 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -814,33 +559,23 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -849,18 +584,13 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -869,18 +599,13 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -889,18 +614,13 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -909,18 +629,13 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -929,37 +644,27 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -967,26 +672,16 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -1000,30 +695,20 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + Syscall(SYS_EXIT, uintptr(code), 0, 0) return } -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1032,63 +717,43 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1097,33 +762,23 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -1132,37 +787,27 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1170,97 +815,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,54 +930,34 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1323,45 +965,30 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1369,41 +996,26 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1411,11 +1023,6 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -1424,18 +1031,13 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -1449,18 +1051,13 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -1474,32 +1071,37 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1509,18 +1111,13 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1529,18 +1126,13 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1549,18 +1141,13 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1569,18 +1156,13 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1589,7 +1171,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1597,11 +1179,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1610,7 +1187,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1618,11 +1195,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1631,7 +1203,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1639,11 +1211,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1653,7 +1220,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1661,11 +1228,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1675,7 +1237,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1683,11 +1245,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1697,7 +1254,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1705,11 +1262,6 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1724,7 +1276,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1732,11 +1284,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1751,7 +1298,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1759,11 +1306,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1777,18 +1319,13 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1802,18 +1339,13 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1822,18 +1354,13 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1842,22 +1369,17 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) + r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) @@ -1865,71 +1387,46 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1938,112 +1435,77 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2051,40 +1513,55 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2099,18 +1576,13 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -2124,33 +1596,23 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -2159,31 +1621,21 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -2192,18 +1644,13 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -2212,18 +1659,13 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -2232,18 +1674,13 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -2252,18 +1689,13 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -2273,7 +1705,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2281,15 +1713,10 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2297,30 +1724,20 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2331,7 +1748,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2342,7 +1759,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int32(r0) usec = int32(r1) if e1 != 0 { @@ -2350,156 +1767,3 @@ func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { } return } - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat64_trampoline() - -//go:linkname libc_fstat64 libc_fstat64 -//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat64_trampoline() - -//go:linkname libc_fstatat64 libc_fstatat64 -//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs64_trampoline() - -//go:linkname libc_fstatfs64 libc_fstatfs64 -//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc___getdirentries64_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc___getdirentries64_trampoline() - -//go:linkname libc___getdirentries64 libc___getdirentries64 -//go:cgo_import_dynamic libc___getdirentries64 __getdirentries64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat64_trampoline() - -//go:linkname libc_getfsstat64 libc_getfsstat64 -//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat64_trampoline() - -//go:linkname libc_lstat64 libc_lstat64 -//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat64_trampoline() - -//go:linkname libc_stat64 libc_stat64 -//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs64_trampoline() - -//go:linkname libc_statfs64 libc_statfs64 -//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s deleted file mode 100644 index 37b85b4f..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s +++ /dev/null @@ -1,284 +0,0 @@ -// go run mkasm_darwin.go 386 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc___sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc___sysctl(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs64(SB) -TEXT ·libc___getdirentries64_trampoline(SB),NOSPLIT,$0-0 - JMP libc___getdirentries64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat64(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs64(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go deleted file mode 100644 index 2581e896..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go +++ /dev/null @@ -1,1810 +0,0 @@ -// go run mksyscall.go -tags darwin,amd64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,amd64,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int64(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index c142e33e..de992704 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1,7 +1,7 @@ -// go run mksyscall.go -tags darwin,amd64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go +// mksyscall.pl -tags darwin,amd64 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,amd64,go1.12 +// +build darwin,amd64 package unix @@ -15,7 +15,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +23,20 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +44,10 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +55,30 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,101 +86,66 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -220,7 +155,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,11 +163,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -242,22 +172,17 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +190,10 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +201,10 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,11 +212,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -311,18 +221,13 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc___sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc___sysctl_trampoline() - -//go:linkname libc___sysctl libc___sysctl -//go:cgo_import_dynamic libc___sysctl __sysctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -331,37 +236,27 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -369,15 +264,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -385,11 +275,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -399,18 +284,13 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -420,33 +300,23 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -456,18 +326,13 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -477,18 +342,13 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -498,67 +358,37 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) + r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { @@ -567,11 +397,6 @@ func pipe() (r int, w int, err error) { return } -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -585,7 +410,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -593,11 +418,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -606,7 +426,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -614,11 +434,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -632,18 +447,13 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -652,18 +462,13 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { @@ -677,18 +482,13 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { @@ -697,18 +497,13 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { @@ -717,7 +512,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -725,15 +520,10 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -741,71 +531,26 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -814,33 +559,23 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -849,18 +584,13 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -869,18 +599,13 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -889,18 +614,13 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -909,18 +629,13 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -929,52 +644,27 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clock_gettime_trampoline() - -//go:linkname libc_clock_gettime libc_clock_gettime -//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -982,26 +672,16 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -1015,30 +695,20 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + Syscall(SYS_EXIT, uintptr(code), 0, 0) return } -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1047,63 +717,43 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1112,33 +762,23 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -1147,37 +787,27 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1185,97 +815,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1283,54 +930,34 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1338,45 +965,30 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1384,41 +996,26 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1426,11 +1023,6 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -1439,18 +1031,13 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -1464,18 +1051,13 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -1489,32 +1071,37 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1524,18 +1111,13 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1544,18 +1126,13 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1564,18 +1141,13 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1584,18 +1156,13 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1604,7 +1171,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1612,11 +1179,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1625,7 +1187,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1633,11 +1195,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1646,7 +1203,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1654,11 +1211,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1668,7 +1220,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1676,11 +1228,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1690,7 +1237,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1698,11 +1245,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1712,7 +1254,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1720,11 +1262,6 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1739,7 +1276,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1747,11 +1284,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1766,7 +1298,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1774,11 +1306,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1792,18 +1319,13 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1817,18 +1339,13 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1837,18 +1354,13 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1857,22 +1369,17 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1880,71 +1387,46 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1953,112 +1435,77 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2066,40 +1513,55 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2114,18 +1576,13 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -2139,33 +1596,23 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -2174,31 +1621,21 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -2207,18 +1644,13 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -2227,18 +1659,13 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -2247,18 +1674,13 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -2267,18 +1689,13 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -2288,7 +1705,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2296,15 +1713,10 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2312,30 +1724,20 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2346,7 +1748,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2357,7 +1759,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int64(r0) usec = int32(r1) if e1 != 0 { @@ -2365,156 +1767,3 @@ func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { } return } - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat64_trampoline() - -//go:linkname libc_fstat64 libc_fstat64 -//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat64_trampoline() - -//go:linkname libc_fstatat64 libc_fstatat64 -//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs64_trampoline() - -//go:linkname libc_fstatfs64 libc_fstatfs64 -//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc___getdirentries64_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc___getdirentries64_trampoline() - -//go:linkname libc___getdirentries64 libc___getdirentries64 -//go:cgo_import_dynamic libc___getdirentries64 __getdirentries64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat64_trampoline() - -//go:linkname libc_getfsstat64 libc_getfsstat64 -//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat64_trampoline() - -//go:linkname libc_lstat64 libc_lstat64 -//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat64_trampoline() - -//go:linkname libc_stat64 libc_stat64 -//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs64_trampoline() - -//go:linkname libc_statfs64 libc_statfs64 -//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s deleted file mode 100644 index 1a391519..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ /dev/null @@ -1,286 +0,0 @@ -// go run mkasm_darwin.go amd64 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc___sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc___sysctl(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs64(SB) -TEXT ·libc___getdirentries64_trampoline(SB),NOSPLIT,$0-0 - JMP libc___getdirentries64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat64(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs64(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go deleted file mode 100644 index f8caecef..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go +++ /dev/null @@ -1,1793 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int32(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go index 01cffbf4..81c4f093 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go @@ -1,7 +1,7 @@ -// go run mksyscall.go -l32 -tags darwin,arm,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go +// mksyscall.pl -l32 -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,arm,go1.12 +// +build darwin,arm package unix @@ -15,7 +15,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +23,20 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +44,10 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +55,30 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,101 +86,66 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -220,7 +155,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,11 +163,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -242,22 +172,17 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +190,10 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +201,10 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,11 +212,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -311,18 +221,13 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc___sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc___sysctl_trampoline() - -//go:linkname libc___sysctl libc___sysctl -//go:cgo_import_dynamic libc___sysctl __sysctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -331,37 +236,27 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -369,15 +264,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -385,11 +275,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -399,18 +284,13 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -420,33 +300,23 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -456,18 +326,13 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -477,18 +342,13 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -498,67 +358,37 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) + r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { @@ -567,11 +397,6 @@ func pipe() (r int, w int, err error) { return } -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -585,7 +410,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -593,11 +418,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -606,7 +426,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -614,11 +434,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -632,18 +447,13 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -652,18 +462,13 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { @@ -677,18 +482,13 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { @@ -697,18 +497,13 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { @@ -717,7 +512,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -725,15 +520,10 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -741,71 +531,26 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -814,33 +559,23 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -849,18 +584,13 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -869,18 +599,13 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -889,18 +614,13 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -909,18 +629,13 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -929,37 +644,27 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -967,26 +672,16 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -1000,30 +695,20 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + Syscall(SYS_EXIT, uintptr(code), 0, 0) return } -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1032,63 +717,43 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1097,33 +762,23 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -1132,37 +787,27 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1170,97 +815,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,54 +930,34 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1323,45 +965,30 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1369,41 +996,26 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1411,11 +1023,6 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -1424,18 +1031,13 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -1449,18 +1051,13 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -1474,32 +1071,37 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1509,18 +1111,13 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1529,18 +1126,13 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1549,18 +1141,13 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1569,18 +1156,13 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1589,7 +1171,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1597,11 +1179,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1610,7 +1187,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1618,11 +1195,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1631,7 +1203,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1639,11 +1211,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1653,7 +1220,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1661,11 +1228,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1675,7 +1237,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1683,11 +1245,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1697,7 +1254,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1705,11 +1262,6 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1724,7 +1276,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1732,11 +1284,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1751,7 +1298,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1759,11 +1306,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1777,18 +1319,13 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1802,18 +1339,13 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1822,18 +1354,13 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1842,22 +1369,17 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) + r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) @@ -1865,71 +1387,46 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1938,112 +1435,77 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2051,40 +1513,55 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2099,18 +1576,13 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -2124,33 +1596,23 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -2159,31 +1621,21 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -2192,18 +1644,13 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -2212,18 +1659,13 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -2232,18 +1674,13 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -2252,18 +1689,13 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -2273,7 +1705,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2281,15 +1713,10 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2297,30 +1724,20 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2331,7 +1748,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2342,7 +1759,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int32(r0) usec = int32(r1) if e1 != 0 { @@ -2350,134 +1767,3 @@ func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { } return } - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat_trampoline() - -//go:linkname libc_fstat libc_fstat -//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat_trampoline() - -//go:linkname libc_fstatat libc_fstatat -//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs_trampoline() - -//go:linkname libc_fstatfs libc_fstatfs -//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat_trampoline() - -//go:linkname libc_getfsstat libc_getfsstat -//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat_trampoline() - -//go:linkname libc_lstat libc_lstat -//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat_trampoline() - -//go:linkname libc_stat libc_stat -//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs_trampoline() - -//go:linkname libc_statfs libc_statfs -//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s deleted file mode 100644 index 994056f3..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s +++ /dev/null @@ -1,282 +0,0 @@ -// go run mkasm_darwin.go arm -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc___sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc___sysctl(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go deleted file mode 100644 index 3fd0f3c8..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go +++ /dev/null @@ -1,1793 +0,0 @@ -// go run mksyscall.go -tags darwin,arm64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm64,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { - r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - sec = int64(r0) - usec = int32(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 8f2691de..338c32d4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -1,7 +1,7 @@ -// go run mksyscall.go -tags darwin,arm64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go +// mksyscall.pl -tags darwin,arm64 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,arm64,go1.12 +// +build darwin,arm64 package unix @@ -15,7 +15,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +23,20 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +44,10 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +55,30 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,101 +86,66 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -220,7 +155,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,11 +163,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -242,22 +172,17 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +190,10 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +201,10 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,11 +212,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -311,18 +221,13 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc___sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc___sysctl_trampoline() - -//go:linkname libc___sysctl libc___sysctl -//go:cgo_import_dynamic libc___sysctl __sysctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -331,37 +236,27 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -369,15 +264,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -385,11 +275,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -399,18 +284,13 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -420,33 +300,23 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -456,18 +326,13 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -477,18 +342,13 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -498,67 +358,37 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) + r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { @@ -567,11 +397,6 @@ func pipe() (r int, w int, err error) { return } -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -585,7 +410,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -593,11 +418,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { @@ -606,7 +426,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -614,11 +434,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -632,18 +447,13 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { @@ -652,18 +462,13 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { @@ -677,18 +482,13 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { @@ -697,18 +497,13 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { @@ -717,7 +512,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -725,15 +520,10 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -741,71 +531,26 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -814,33 +559,23 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -849,18 +584,13 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -869,18 +599,13 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -889,18 +614,13 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -909,18 +629,13 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -929,37 +644,27 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -967,26 +672,16 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -1000,30 +695,20 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + Syscall(SYS_EXIT, uintptr(code), 0, 0) return } -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1032,63 +717,43 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -1097,33 +762,23 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -1132,37 +787,27 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1170,97 +815,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,54 +930,34 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1323,45 +965,30 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1369,41 +996,26 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1411,11 +1023,6 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -1424,18 +1031,13 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -1449,18 +1051,13 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -1474,32 +1071,37 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1509,18 +1111,13 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1529,18 +1126,13 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1549,18 +1141,13 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1569,18 +1156,13 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1589,7 +1171,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1597,11 +1179,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1610,7 +1187,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1618,11 +1195,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1631,7 +1203,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1639,11 +1211,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1653,7 +1220,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1661,11 +1228,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1675,7 +1237,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1683,11 +1245,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1697,7 +1254,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1705,11 +1262,6 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1724,7 +1276,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1732,11 +1284,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1751,7 +1298,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1759,11 +1306,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1777,18 +1319,13 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1802,18 +1339,13 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1822,18 +1354,13 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1842,22 +1369,17 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1865,71 +1387,46 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1938,112 +1435,77 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2051,40 +1513,55 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2099,18 +1576,13 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -2124,33 +1596,23 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -2159,31 +1621,21 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -2192,18 +1644,13 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -2212,18 +1659,13 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -2232,18 +1674,13 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -2252,18 +1689,13 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -2273,7 +1705,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2281,15 +1713,10 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2297,30 +1724,20 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2331,7 +1748,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2342,7 +1759,7 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int64(r0) usec = int32(r1) if e1 != 0 { @@ -2350,134 +1767,3 @@ func gettimeofday(tp *Timeval) (sec int64, usec int32, err error) { } return } - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat_trampoline() - -//go:linkname libc_fstat libc_fstat -//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat_trampoline() - -//go:linkname libc_fstatat libc_fstatat -//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs_trampoline() - -//go:linkname libc_fstatfs libc_fstatfs -//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat_trampoline() - -//go:linkname libc_getfsstat libc_getfsstat -//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat_trampoline() - -//go:linkname libc_lstat libc_lstat -//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat_trampoline() - -//go:linkname libc_stat libc_stat -//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs_trampoline() - -//go:linkname libc_statfs libc_statfs -//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s deleted file mode 100644 index 61dc0d4c..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ /dev/null @@ -1,282 +0,0 @@ -// go run mkasm_darwin.go arm64 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc___sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc___sysctl(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index ae9f1a21..91f36e9e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go +// mksyscall.pl -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build dragonfly,amd64 @@ -588,21 +588,6 @@ func Exit(code int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { @@ -658,21 +643,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -957,26 +927,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -1017,21 +967,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1062,21 +997,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1103,22 +1023,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1194,26 +1098,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1461,26 +1345,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1544,21 +1408,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 2707c013..ad77882b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go +// mksyscall.pl -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build freebsd,386 @@ -912,7 +912,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +922,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +937,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +947,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,14 +967,14 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1019,14 +984,14 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1257,7 +1222,7 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { +func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1317,7 +1282,7 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { +func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1332,36 +1297,6 @@ func mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1752,7 +1687,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { +func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1767,7 +1702,7 @@ func stat(path string, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1782,21 +1717,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 8e3c0cea..d3ba6c46 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go +// mksyscall.pl -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build freebsd,amd64 @@ -912,7 +912,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +922,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +937,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +947,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,14 +967,14 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1019,14 +984,14 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1257,7 +1222,7 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { +func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1317,7 +1282,7 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { +func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1332,36 +1297,6 @@ func mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1752,7 +1687,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { +func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1767,7 +1702,7 @@ func stat(path string, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1782,21 +1717,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 641f86a0..9dfd77b6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go +// mksyscall.pl -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build freebsd,arm @@ -912,7 +912,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +922,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +937,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +947,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,14 +967,14 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1019,14 +984,14 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1257,7 +1222,7 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { +func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1317,7 +1282,7 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { +func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1332,36 +1297,6 @@ func mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1752,7 +1687,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { +func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1767,7 +1702,7 @@ func stat(path string, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1782,21 +1717,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go deleted file mode 100644 index 68fbccf7..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ /dev/null @@ -1,2015 +0,0 @@ -// go run mksyscall.go -tags freebsd,arm64 -- syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build freebsd,arm64 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func CapEnter() (err error) { - _, _, e1 := Syscall(SYS_CAP_ENTER, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func capRightsGet(version int, fd int, rightsp *CapRights) (err error) { - _, _, e1 := Syscall(SYS___CAP_RIGHTS_GET, uintptr(version), uintptr(fd), uintptr(unsafe.Pointer(rightsp))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func capRightsLimit(fd int, rightsp *CapRights) (err error) { - _, _, e1 := Syscall(SYS_CAP_RIGHTS_LIMIT, uintptr(fd), uintptr(unsafe.Pointer(rightsp)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstat(fd int, stat *stat_freebsd11_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lstat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(fdat), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func stat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs(path string, stat *statfs_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 81d90a27..a1c7d785 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go +// mksyscall.pl -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,386 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { @@ -1949,26 +1840,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 0c184586..47503919 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go +// mksyscall.pl -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,amd64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1854,7 +1745,7 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func inotifyInit() (fd int, err error) { +func InotifyInit() (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) fd = int(r0) if e1 != 0 { @@ -1910,6 +1801,21 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { @@ -1954,26 +1860,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2400,18 +2286,3 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 18ef8a62..389c42af 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go +// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,arm @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,42 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { @@ -2074,26 +1955,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) @@ -2360,28 +2221,3 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { - _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 2fba25d0..97f6a2c5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go +// mksyscall.pl -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,arm64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -1877,26 +1768,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2257,18 +2128,3 @@ func pipe2(p *[2]_C_int, flags int) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index c330f4ff..889eaf1a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go +// mksyscall.pl -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,mips @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask>>32), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1868,26 +1759,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 8e9e0098..06016870 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go +// mksyscall.pl -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,mips64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1767,6 +1658,21 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fstatfs(fd int, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { @@ -1898,26 +1804,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2346,21 +2232,6 @@ func fstat(fd int, st *stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat(dirfd int, path string, st *stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func lstat(path string, st *stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index c22d6260..76dc324b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go +// mksyscall.pl -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,mips64le @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1767,6 +1658,21 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fstatfs(fd int, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { @@ -1898,26 +1804,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2346,21 +2232,6 @@ func fstat(fd int, st *stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat(dirfd int, path string, st *stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func lstat(path string, st *stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 700a99e9..a8428e92 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go +// mksyscall.pl -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,mipsle @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1868,26 +1759,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index cec4c106..1cb8eb4e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go +// mksyscall.pl -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,ppc64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1969,26 +1860,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2462,18 +2333,3 @@ func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 677ef5a6..5f0cb9d8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go +// mksyscall.pl -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,ppc64le @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1969,26 +1860,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2462,18 +2333,3 @@ func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 565034c5..6977f045 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,riscv64 syscall_linux.go syscall_linux_riscv64.go +// mksyscall.pl -tags linux,riscv64 syscall_linux.go syscall_linux_riscv64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,riscv64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -2237,18 +2128,3 @@ func pipe2(p *[2]_C_int, flags int) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 7feb2c6b..2bfd3d0c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,s390x syscall_linux.go syscall_linux_s390x.go +// mksyscall.pl -tags linux,s390x syscall_linux.go syscall_linux_s390x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,s390x @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -652,21 +596,6 @@ func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { @@ -868,27 +797,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1226,6 +1134,26 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1381,17 +1309,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1683,32 +1600,6 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { @@ -1939,26 +1830,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) @@ -2232,18 +2103,3 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(cmdline) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 07655c45..b26aee95 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go +// mksyscall.pl -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,sparc64 @@ -14,27 +14,6 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { - r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { - _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fchmodat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -438,16 +417,6 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockGetres(clockid int32, res *Timespec) (err error) { - _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { @@ -458,16 +427,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { - _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -489,21 +448,6 @@ func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags in // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func DeleteModule(name string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_DELETE_MODULE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) @@ -564,6 +508,21 @@ func Exit(code int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) if e1 != 0 { @@ -630,60 +589,6 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func FinitModule(fd int, params string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flistxattr(fd int, dest []byte) (sz int, err error) { - var _p0 unsafe.Pointer - if len(dest) > 0 { - _p0 = unsafe.Pointer(&dest[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_FLISTXATTR, uintptr(fd), uintptr(_p0), uintptr(len(dest))) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -694,42 +599,6 @@ func Flock(fd int, how int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fremovexattr(fd int, attr string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsetxattr(fd int, attr string, dest []byte, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -868,27 +737,6 @@ func Getxattr(path string, attr string, dest []byte) (sz int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InitModule(moduleImage []byte, params string) (err error) { - var _p0 unsafe.Pointer - if len(moduleImage) > 0 { - _p0 = unsafe.Pointer(&moduleImage[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - var _p1 *byte - _p1, err = BytePtrFromString(params) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1071,22 +919,6 @@ func Lsetxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func MemfdCreate(name string, flags int) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_MEMFD_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1226,7 +1058,7 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -1237,7 +1069,7 @@ func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT2, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1381,17 +1213,6 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { - r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) - newfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1668,47 +1489,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func faccessat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(pathname) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { - r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -1938,26 +1718,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 7e058266..f1874d5a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go +// mksyscall.pl -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build netbsd,386 @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -865,21 +865,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1129,26 +1114,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -1189,21 +1154,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1219,21 +1169,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1249,21 +1184,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1290,22 +1210,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1395,28 +1299,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1437,26 +1319,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1654,26 +1516,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1722,21 +1564,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index d94d076a..eb802839 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go +// mksyscall.pl -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build netbsd,amd64 @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -865,21 +865,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1129,26 +1114,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -1189,21 +1154,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1219,21 +1169,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1249,21 +1184,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1290,22 +1210,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1395,28 +1299,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1437,26 +1319,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1654,26 +1516,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1722,21 +1564,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index cf5bf3d0..7b36499d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -netbsd -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go +// mksyscall.pl -l32 -netbsd -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build netbsd,arm @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -865,21 +865,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1129,26 +1114,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -1189,21 +1154,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1219,21 +1169,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1249,21 +1184,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1290,22 +1210,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1395,28 +1299,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1437,26 +1319,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1654,26 +1516,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1722,21 +1564,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go deleted file mode 100644 index 243a9317..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ /dev/null @@ -1,1826 +0,0 @@ -// go run mksyscall.go -netbsd -tags netbsd,arm64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build netbsd,arm64 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (fd1 int, fd2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - fd1 = int(r0) - fd2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdents(fd int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(file) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attrname) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(link) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) - ret = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fadvise(fd int, offset int64, length int64, advice int) (err error) { - _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), 0, uintptr(length), uintptr(advice)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index a9532d07..1942049b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go +// mksyscall.pl -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build openbsd,386 @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -431,17 +431,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -650,21 +639,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -935,26 +909,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -995,21 +949,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1025,21 +964,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1055,21 +979,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1096,22 +1005,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1201,28 +1094,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1243,26 +1114,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1520,26 +1371,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1588,21 +1419,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 0cb9f017..d351c72c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go +// mksyscall.pl -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build openbsd,amd64 @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -431,17 +431,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -650,21 +639,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -935,26 +909,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -995,21 +949,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1025,21 +964,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1055,21 +979,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1096,22 +1005,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1201,28 +1094,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1243,26 +1114,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1520,26 +1371,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1588,21 +1419,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 6fc99b54..617d47f0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go +// mksyscall.pl -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build openbsd,arm @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdents(fd int, buf []byte) (n int, err error) { +func getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -431,17 +431,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -650,21 +639,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -935,26 +909,6 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { @@ -995,21 +949,6 @@ func Mkdir(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1025,21 +964,6 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1055,21 +979,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1096,22 +1005,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1201,28 +1094,6 @@ func Readlink(path string, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1243,26 +1114,6 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1520,26 +1371,6 @@ func Symlink(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { @@ -1588,21 +1419,6 @@ func Unlink(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go deleted file mode 100644 index 27878a72..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ /dev/null @@ -1,1692 +0,0 @@ -// go run mksyscall.go -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build openbsd,arm64 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdents(fd int, buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) - rtable = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifoat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 5f614760..e2e5fc5e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall_solaris.go -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go +// mksyscall_solaris.pl -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build solaris,amd64 @@ -399,8 +399,6 @@ var ( procrecvfrom syscallFunc ) -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe(p *[2]_C_int) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0) n = int(r0) @@ -410,8 +408,6 @@ func pipe(p *[2]_C_int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -420,8 +416,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -435,8 +429,6 @@ func Getcwd(buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) n = int(r0) @@ -446,8 +438,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) if e1 != 0 { @@ -456,8 +446,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int32(r0) @@ -467,8 +455,6 @@ func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func gethostname(buf []byte) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -482,8 +468,6 @@ func gethostname(buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -497,8 +481,6 @@ func utimes(path string, times *[2]Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -512,8 +494,6 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) val = int(r0) @@ -523,8 +503,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfutimesat)), 3, uintptr(fildes), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)), 0, 0, 0) if e1 != 0 { @@ -533,8 +511,6 @@ func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept)), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) fd = int(r0) @@ -544,8 +520,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_recvmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) @@ -555,8 +529,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) @@ -566,8 +538,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func acct(path *byte) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procacct)), 1, uintptr(unsafe.Pointer(path)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -576,32 +546,24 @@ func acct(path *byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __makedev(version int, major uint, minor uint) (val uint64) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__makedev)), 3, uintptr(version), uintptr(major), uintptr(minor), 0, 0, 0) val = uint64(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __major(version int, dev uint64) (val uint) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__major)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0) val = uint(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func __minor(version int, dev uint64) (val uint) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__minor)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0) val = uint(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) if e1 != 0 { @@ -610,8 +572,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpoll)), 3, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout), 0, 0, 0) n = int(r0) @@ -621,8 +581,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -636,8 +594,6 @@ func Access(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0) if e1 != 0 { @@ -646,8 +602,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -661,8 +615,6 @@ func Chdir(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -676,8 +628,6 @@ func Chmod(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -691,8 +641,6 @@ func Chown(path string, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -706,8 +654,6 @@ func Chroot(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Close(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -716,8 +662,6 @@ func Close(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Creat(path string, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -732,8 +676,6 @@ func Creat(path string, mode uint32) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup(fd int) (nfd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup)), 1, uintptr(fd), 0, 0, 0, 0, 0) nfd = int(r0) @@ -743,8 +685,6 @@ func Dup(fd int) (nfd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0) if e1 != 0 { @@ -753,15 +693,11 @@ func Dup2(oldfd int, newfd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Exit(code int) { sysvicall6(uintptr(unsafe.Pointer(&procExit)), 1, uintptr(code), 0, 0, 0, 0, 0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -775,8 +711,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchdir(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -785,8 +719,6 @@ func Fchdir(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { @@ -795,8 +727,6 @@ func Fchmod(fd int, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -810,8 +740,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { @@ -820,8 +748,6 @@ func Fchown(fd int, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -835,8 +761,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fdatasync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -845,8 +769,6 @@ func Fdatasync(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Flock(fd int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFlock)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0) if e1 != 0 { @@ -855,8 +777,6 @@ func Flock(fd int, how int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFpathconf)), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0) val = int(r0) @@ -866,8 +786,6 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstat)), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { @@ -876,8 +794,6 @@ func Fstat(fd int, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -891,8 +807,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0) if e1 != 0 { @@ -901,8 +815,6 @@ func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 *byte if len(buf) > 0 { @@ -916,24 +828,18 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getgid() (gid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetgid)), 0, 0, 0, 0, 0, 0, 0) gid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) pgid = int(r0) @@ -943,8 +849,6 @@ func Getpgid(pid int) (pgid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgrp() (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgrp)), 0, 0, 0, 0, 0, 0, 0) pgid = int(r0) @@ -954,32 +858,24 @@ func Getpgrp() (pgid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Geteuid() (euid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGeteuid)), 0, 0, 0, 0, 0, 0, 0) euid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getegid() (egid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetegid)), 0, 0, 0, 0, 0, 0, 0) egid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getppid() (ppid int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procGetppid)), 0, 0, 0, 0, 0, 0, 0) ppid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpriority(which int, who int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) n = int(r0) @@ -989,8 +885,6 @@ func Getpriority(which int, who int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { @@ -999,8 +893,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrusage)), 2, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0, 0, 0, 0) if e1 != 0 { @@ -1009,8 +901,6 @@ func Getrusage(who int, rusage *Rusage) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1019,16 +909,12 @@ func Gettimeofday(tv *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getuid() (uid int) { r0, _, _ := rawSysvicall6(uintptr(unsafe.Pointer(&procGetuid)), 0, 0, 0, 0, 0, 0, 0) uid = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procKill)), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0) if e1 != 0 { @@ -1037,8 +923,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1052,8 +936,6 @@ func Lchown(path string, uid int, gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1072,8 +954,6 @@ func Link(path string, link string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Listen(s int, backlog int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { @@ -1082,8 +962,6 @@ func Listen(s int, backlog int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1097,8 +975,6 @@ func Lstat(path string, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Madvise(b []byte, advice int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1111,8 +987,6 @@ func Madvise(b []byte, advice int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1126,8 +1000,6 @@ func Mkdir(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1141,8 +1013,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1156,8 +1026,6 @@ func Mkfifo(path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkfifoat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1171,8 +1039,6 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1186,8 +1052,6 @@ func Mknod(path string, mode uint32, dev int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1201,8 +1065,6 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mlock(b []byte) (err error) { var _p0 *byte if len(b) > 0 { @@ -1215,8 +1077,6 @@ func Mlock(b []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mlockall(flags int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1225,8 +1085,6 @@ func Mlockall(flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mprotect(b []byte, prot int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1239,8 +1097,6 @@ func Mprotect(b []byte, prot int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Msync(b []byte, flags int) (err error) { var _p0 *byte if len(b) > 0 { @@ -1253,8 +1109,6 @@ func Msync(b []byte, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Munlock(b []byte) (err error) { var _p0 *byte if len(b) > 0 { @@ -1267,8 +1121,6 @@ func Munlock(b []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Munlockall() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlockall)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1277,8 +1129,6 @@ func Munlockall() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procNanosleep)), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0) if e1 != 0 { @@ -1287,8 +1137,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1303,8 +1151,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1319,8 +1165,6 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1335,8 +1179,6 @@ func Pathconf(path string, name int) (val int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pause() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPause)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1345,8 +1187,6 @@ func Pause() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1360,8 +1200,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1375,8 +1213,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1390,8 +1226,6 @@ func read(fd int, p []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1410,8 +1244,6 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) @@ -1430,8 +1262,6 @@ func Rename(from string, to string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1450,8 +1280,6 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1465,8 +1293,6 @@ func Rmdir(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) newoffset = int64(r0) @@ -1476,8 +1302,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSelect)), 5, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { @@ -1486,8 +1310,6 @@ func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setegid(egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetegid)), 1, uintptr(egid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1496,8 +1318,6 @@ func Setegid(egid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seteuid(euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSeteuid)), 1, uintptr(euid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1506,8 +1326,6 @@ func Seteuid(euid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setgid(gid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetgid)), 1, uintptr(gid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1516,8 +1334,6 @@ func Setgid(gid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sethostname(p []byte) (err error) { var _p0 *byte if len(p) > 0 { @@ -1530,8 +1346,6 @@ func Sethostname(p []byte) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setpgid(pid int, pgid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) if e1 != 0 { @@ -1540,8 +1354,6 @@ func Setpgid(pid int, pgid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSetpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) if e1 != 0 { @@ -1550,8 +1362,6 @@ func Setpriority(which int, who int, prio int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setregid(rgid int, egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) if e1 != 0 { @@ -1560,8 +1370,6 @@ func Setregid(rgid int, egid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setreuid(ruid int, euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) if e1 != 0 { @@ -1570,8 +1378,6 @@ func Setreuid(ruid int, euid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { @@ -1580,8 +1386,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) @@ -1591,8 +1395,6 @@ func Setsid() (pid int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setuid(uid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetuid)), 1, uintptr(uid), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1601,8 +1403,6 @@ func Setuid(uid int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(s int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procshutdown)), 2, uintptr(s), uintptr(how), 0, 0, 0, 0) if e1 != 0 { @@ -1611,8 +1411,6 @@ func Shutdown(s int, how int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1626,8 +1424,6 @@ func Stat(path string, stat *Stat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Statvfs(path string, vfsstat *Statvfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1641,8 +1437,6 @@ func Statvfs(path string, vfsstat *Statvfs_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1661,8 +1455,6 @@ func Symlink(path string, link string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Sync() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSync)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { @@ -1671,8 +1463,6 @@ func Sync() (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) ticks = uintptr(r0) @@ -1682,8 +1472,6 @@ func Times(tms *Tms) (ticks uintptr, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1697,8 +1485,6 @@ func Truncate(path string, length int64) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1707,8 +1493,6 @@ func Fsync(fd int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ftruncate(fd int, length int64) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFtruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) if e1 != 0 { @@ -1717,16 +1501,12 @@ func Ftruncate(fd int, length int64) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Umask(mask int) (oldmask int) { r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procUmask)), 1, uintptr(mask), 0, 0, 0, 0, 0) oldmask = int(r0) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Uname(buf *Utsname) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1735,8 +1515,6 @@ func Uname(buf *Utsname) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unmount(target string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(target) @@ -1750,8 +1528,6 @@ func Unmount(target string, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1765,8 +1541,6 @@ func Unlink(path string) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1780,8 +1554,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUstat)), 2, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0, 0, 0, 0) if e1 != 0 { @@ -1790,8 +1562,6 @@ func Ustat(dev int, ubuf *Ustat_t) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1805,8 +1575,6 @@ func Utime(path string, buf *Utimbuf) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_bind)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { @@ -1815,8 +1583,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_connect)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { @@ -1825,8 +1591,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) @@ -1836,8 +1600,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmunmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) if e1 != 0 { @@ -1846,8 +1608,6 @@ func munmap(addr uintptr, length uintptr) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendfile)), 4, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) @@ -1857,8 +1617,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 *byte if len(buf) > 0 { @@ -1871,8 +1629,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) fd = int(r0) @@ -1882,8 +1638,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { @@ -1892,8 +1646,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 *byte if len(p) > 0 { @@ -1907,8 +1659,6 @@ func write(fd int, p []byte) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { @@ -1917,8 +1667,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -1927,8 +1675,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { @@ -1937,8 +1683,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 *byte if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 37dcc74c..b005031a 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -1,8 +1,6 @@ // mksysctl_openbsd.pl // Code generated by the command above; DO NOT EDIT. -// +build 386,openbsd - package unix type mibentry struct { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index fe6caa6e..90c95c2c 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysctl_openbsd.go +// mksysctl_openbsd.pl // Code generated by the command above; DO NOT EDIT. // +build amd64,openbsd @@ -254,17 +254,4 @@ var sysctlMib = []mibentry{ {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, } diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index 6eb8c0b0..b005031a 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -1,8 +1,6 @@ -// go run mksysctl_openbsd.go +// mksysctl_openbsd.pl // Code generated by the command above; DO NOT EDIT. -// +build arm,openbsd - package unix type mibentry struct { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go deleted file mode 100644 index ba4304fd..00000000 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ /dev/null @@ -1,275 +0,0 @@ -// go run mksysctl_openbsd.go -// Code generated by the command above; DO NOT EDIT. - -// +build arm64,openbsd - -package unix - -type mibentry struct { - ctlname string - ctloid []_C_int -} - -var sysctlMib = []mibentry{ - {"ddb.console", []_C_int{9, 6}}, - {"ddb.log", []_C_int{9, 7}}, - {"ddb.max_line", []_C_int{9, 3}}, - {"ddb.max_width", []_C_int{9, 2}}, - {"ddb.panic", []_C_int{9, 5}}, - {"ddb.profile", []_C_int{9, 9}}, - {"ddb.radix", []_C_int{9, 1}}, - {"ddb.tab_stop_width", []_C_int{9, 4}}, - {"ddb.trigger", []_C_int{9, 8}}, - {"fs.posix.setuid", []_C_int{3, 1, 1}}, - {"hw.allowpowerdown", []_C_int{6, 22}}, - {"hw.byteorder", []_C_int{6, 4}}, - {"hw.cpuspeed", []_C_int{6, 12}}, - {"hw.diskcount", []_C_int{6, 10}}, - {"hw.disknames", []_C_int{6, 8}}, - {"hw.diskstats", []_C_int{6, 9}}, - {"hw.machine", []_C_int{6, 1}}, - {"hw.model", []_C_int{6, 2}}, - {"hw.ncpu", []_C_int{6, 3}}, - {"hw.ncpufound", []_C_int{6, 21}}, - {"hw.ncpuonline", []_C_int{6, 25}}, - {"hw.pagesize", []_C_int{6, 7}}, - {"hw.perfpolicy", []_C_int{6, 23}}, - {"hw.physmem", []_C_int{6, 19}}, - {"hw.product", []_C_int{6, 15}}, - {"hw.serialno", []_C_int{6, 17}}, - {"hw.setperf", []_C_int{6, 13}}, - {"hw.smt", []_C_int{6, 24}}, - {"hw.usermem", []_C_int{6, 20}}, - {"hw.uuid", []_C_int{6, 18}}, - {"hw.vendor", []_C_int{6, 14}}, - {"hw.version", []_C_int{6, 16}}, - {"kern.allowkmem", []_C_int{1, 52}}, - {"kern.argmax", []_C_int{1, 8}}, - {"kern.audio", []_C_int{1, 84}}, - {"kern.boottime", []_C_int{1, 21}}, - {"kern.bufcachepercent", []_C_int{1, 72}}, - {"kern.ccpu", []_C_int{1, 45}}, - {"kern.clockrate", []_C_int{1, 12}}, - {"kern.consdev", []_C_int{1, 75}}, - {"kern.cp_time", []_C_int{1, 40}}, - {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cpustats", []_C_int{1, 85}}, - {"kern.domainname", []_C_int{1, 22}}, - {"kern.file", []_C_int{1, 73}}, - {"kern.forkstat", []_C_int{1, 42}}, - {"kern.fscale", []_C_int{1, 46}}, - {"kern.fsync", []_C_int{1, 33}}, - {"kern.global_ptrace", []_C_int{1, 81}}, - {"kern.hostid", []_C_int{1, 11}}, - {"kern.hostname", []_C_int{1, 10}}, - {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, - {"kern.job_control", []_C_int{1, 19}}, - {"kern.malloc.buckets", []_C_int{1, 39, 1}}, - {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, - {"kern.maxclusters", []_C_int{1, 67}}, - {"kern.maxfiles", []_C_int{1, 7}}, - {"kern.maxlocksperuid", []_C_int{1, 70}}, - {"kern.maxpartitions", []_C_int{1, 23}}, - {"kern.maxproc", []_C_int{1, 6}}, - {"kern.maxthread", []_C_int{1, 25}}, - {"kern.maxvnodes", []_C_int{1, 5}}, - {"kern.mbstat", []_C_int{1, 59}}, - {"kern.msgbuf", []_C_int{1, 48}}, - {"kern.msgbufsize", []_C_int{1, 38}}, - {"kern.nchstats", []_C_int{1, 41}}, - {"kern.netlivelocks", []_C_int{1, 76}}, - {"kern.nfiles", []_C_int{1, 56}}, - {"kern.ngroups", []_C_int{1, 18}}, - {"kern.nosuidcoredump", []_C_int{1, 32}}, - {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, - {"kern.nthreads", []_C_int{1, 26}}, - {"kern.numvnodes", []_C_int{1, 58}}, - {"kern.osrelease", []_C_int{1, 2}}, - {"kern.osrevision", []_C_int{1, 3}}, - {"kern.ostype", []_C_int{1, 1}}, - {"kern.osversion", []_C_int{1, 27}}, - {"kern.pool_debug", []_C_int{1, 77}}, - {"kern.posix1version", []_C_int{1, 17}}, - {"kern.proc", []_C_int{1, 66}}, - {"kern.rawpartition", []_C_int{1, 24}}, - {"kern.saved_ids", []_C_int{1, 20}}, - {"kern.securelevel", []_C_int{1, 9}}, - {"kern.seminfo", []_C_int{1, 61}}, - {"kern.shminfo", []_C_int{1, 62}}, - {"kern.somaxconn", []_C_int{1, 28}}, - {"kern.sominconn", []_C_int{1, 29}}, - {"kern.splassert", []_C_int{1, 54}}, - {"kern.stackgap_random", []_C_int{1, 50}}, - {"kern.sysvipc_info", []_C_int{1, 51}}, - {"kern.sysvmsg", []_C_int{1, 34}}, - {"kern.sysvsem", []_C_int{1, 35}}, - {"kern.sysvshm", []_C_int{1, 36}}, - {"kern.timecounter.choice", []_C_int{1, 69, 4}}, - {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, - {"kern.timecounter.tick", []_C_int{1, 69, 1}}, - {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, - {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, - {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, - {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, - {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, - {"kern.ttycount", []_C_int{1, 57}}, - {"kern.version", []_C_int{1, 4}}, - {"kern.watchdog.auto", []_C_int{1, 64, 2}}, - {"kern.watchdog.period", []_C_int{1, 64, 1}}, - {"kern.witnesswatch", []_C_int{1, 53}}, - {"kern.wxabort", []_C_int{1, 74}}, - {"net.bpf.bufsize", []_C_int{4, 31, 1}}, - {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, - {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, - {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, - {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, - {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, - {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, - {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, - {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, - {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, - {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, - {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, - {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, - {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, - {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, - {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, - {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, - {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, - {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, - {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, - {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, - {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, - {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, - {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, - {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, - {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, - {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, - {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, - {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, - {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, - {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, - {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, - {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, - {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, - {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, - {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, - {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, - {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, - {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, - {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, - {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, - {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, - {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, - {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, - {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, - {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, - {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, - {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, - {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, - {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, - {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, - {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, - {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, - {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, - {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, - {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, - {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, - {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, - {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, - {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, - {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, - {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, - {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, - {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, - {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, - {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, - {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, - {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, - {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, - {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, - {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, - {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, - {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, - {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, - {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, - {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, - {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, - {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, - {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, - {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, - {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, - {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, - {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, - {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, - {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, - {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, - {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, - {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, - {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, - {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, - {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, - {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, - {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, - {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, - {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, - {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, - {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, - {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, - {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, - {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, - {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, - {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, - {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, - {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, - {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, - {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, - {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, - {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, - {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, - {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, - {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, - {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, - {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, - {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, - {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, - {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, - {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, - {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, - {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.key.sadb_dump", []_C_int{4, 30, 1}}, - {"net.key.spd_dump", []_C_int{4, 30, 2}}, - {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, - {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, - {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, - {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, - {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, - {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, - {"net.mpls.ttl", []_C_int{4, 33, 2}}, - {"net.pflow.stats", []_C_int{4, 34, 1}}, - {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.malloc_conf", []_C_int{2, 12}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, -} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go index f3361453..d1d36da3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,darwin diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index 654dd3da..e35de414 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,darwin @@ -431,8 +431,6 @@ const ( SYS_NTP_ADJTIME = 527 SYS_NTP_GETTIME = 528 SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_KQUEUE_WORKLOOP_CTL = 530 - SYS___MACH_BRIDGE_REMOTE_TIME = 531 - SYS_MAXSYSCALL = 532 + SYS_MAXSYSCALL = 530 SYS_INVALID = 63 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go index 103a72ed..f2df27db 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,darwin diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 7ab2130b..96946302 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,darwin diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 464c9a98..b2c9ef81 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master +// mksysnum_dragonfly.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,dragonfly @@ -13,7 +13,7 @@ const ( SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, \ SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } @@ -22,17 +22,17 @@ const ( SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int - SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, \ SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, \ SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, \ SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, \ SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } @@ -45,8 +45,8 @@ const ( SYS_DUP = 41 // { int dup(int fd); } SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, \ SYS_GETGID = 47 // { gid_t getgid(void); } SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } @@ -67,32 +67,32 @@ const ( SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, \ SYS_SWAPON = 85 // { int swapon(char *name); } SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(int from, int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ SYS_FSYNC = 95 // { int fsync(int fd); } SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } @@ -100,15 +100,15 @@ const ( SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, \ SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } @@ -116,53 +116,53 @@ const ( SYS_SETDOMAINNAME = 163 // { int setdomainname(char *domainname, int len); } SYS_UNAME = 164 // { int uname(struct utsname *name); } SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } - SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ + SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, \ + SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, \ SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ + SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, \ // SYS_NOSYS = 198; // { int nosys(void); } __syscall __syscall_args int - SYS_LSEEK = 199 // { off_t lseek(int fd, int pad, off_t offset, int whence); } + SYS_LSEEK = 199 // { off_t lseek(int fd, int pad, off_t offset, \ SYS_TRUNCATE = 200 // { int truncate(char *path, int pad, off_t length); } SYS_FTRUNCATE = 201 // { int ftruncate(int fd, int pad, off_t length); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, \ SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS___SEMCTL = 220 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ + SYS___SEMCTL = 220 // { int __semctl(int semid, int semnum, int cmd, \ SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, u_int nsops); } - SYS_MSGCTL = 224 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ + SYS_MSGCTL = 224 // { int msgctl(int msqid, int cmd, \ SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { caddr_t shmat(int shmid, const void *shmaddr, int shmflg); } - SYS_SHMCTL = 229 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, \ + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, \ + SYS_SHMAT = 228 // { caddr_t shmat(int shmid, const void *shmaddr, \ + SYS_SHMCTL = 229 // { int shmctl(int shmid, int cmd, \ SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, \ + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, \ SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, u_int iovcnt, int flags, off_t offset); } - SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,u_int iovcnt, int flags, off_t offset); } + SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, \ + SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,\ SYS_FHSTATFS = 297 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } SYS_MODNEXT = 300 // { int modnext(int modid); } @@ -200,34 +200,34 @@ const ( SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, \ SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } - SYS_SIGACTION = 342 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } + SYS_SIGACTION = 342 // { int sigaction(int sig, const struct sigaction *act, \ SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } SYS_SIGRETURN = 344 // { int sigreturn(ucontext_t *sigcntxp); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set,siginfo_t *info, const struct timespec *timeout); } - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set,siginfo_t *info); } - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set,\ + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set,\ + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, \ + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, \ + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { int extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { int extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, \ + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ + SYS_EXTATTR_SET_FILE = 356 // { int extattr_set_file(const char *path, \ + SYS_EXTATTR_GET_FILE = 357 // { int extattr_get_file(const char *path, \ + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_KEVENT = 363 // { int kevent(int fd, \ SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } SYS_LCHFLAGS = 391 // { int lchflags(char *path, int flags); } SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, \ SYS_VARSYM_SET = 450 // { int varsym_set(int level, const char *name, const char *data); } SYS_VARSYM_GET = 451 // { int varsym_get(int mask, const char *wild, char *buf, int bufsize); } SYS_VARSYM_LIST = 452 // { int varsym_list(int level, char *buf, int maxsize, int *marker); } @@ -245,58 +245,58 @@ const ( SYS_FSTAT = 476 // { int fstat(int fd, struct stat *sb); } SYS_LSTAT = 477 // { int lstat(const char *path, struct stat *ub); } SYS_FHSTAT = 478 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } - SYS_GETDIRENTRIES = 479 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } + SYS_GETDIRENTRIES = 479 // { int getdirentries(int fd, char *buf, u_int count, \ SYS_GETDENTS = 480 // { int getdents(int fd, char *buf, size_t count); } - SYS_USCHED_SET = 481 // { int usched_set(pid_t pid, int cmd, void *data, int bytes); } + SYS_USCHED_SET = 481 // { int usched_set(pid_t pid, int cmd, void *data, \ SYS_EXTACCEPT = 482 // { int extaccept(int s, int flags, caddr_t name, int *anamelen); } SYS_EXTCONNECT = 483 // { int extconnect(int s, int flags, caddr_t name, int namelen); } SYS_MCONTROL = 485 // { int mcontrol(void *addr, size_t len, int behav, off_t value); } SYS_VMSPACE_CREATE = 486 // { int vmspace_create(void *id, int type, void *data); } SYS_VMSPACE_DESTROY = 487 // { int vmspace_destroy(void *id); } - SYS_VMSPACE_CTL = 488 // { int vmspace_ctl(void *id, int cmd, struct trapframe *tframe, struct vextframe *vframe); } - SYS_VMSPACE_MMAP = 489 // { int vmspace_mmap(void *id, void *addr, size_t len, int prot, int flags, int fd, off_t offset); } - SYS_VMSPACE_MUNMAP = 490 // { int vmspace_munmap(void *id, void *addr, size_t len); } - SYS_VMSPACE_MCONTROL = 491 // { int vmspace_mcontrol(void *id, void *addr, size_t len, int behav, off_t value); } - SYS_VMSPACE_PREAD = 492 // { ssize_t vmspace_pread(void *id, void *buf, size_t nbyte, int flags, off_t offset); } - SYS_VMSPACE_PWRITE = 493 // { ssize_t vmspace_pwrite(void *id, const void *buf, size_t nbyte, int flags, off_t offset); } + SYS_VMSPACE_CTL = 488 // { int vmspace_ctl(void *id, int cmd, \ + SYS_VMSPACE_MMAP = 489 // { int vmspace_mmap(void *id, void *addr, size_t len, \ + SYS_VMSPACE_MUNMAP = 490 // { int vmspace_munmap(void *id, void *addr, \ + SYS_VMSPACE_MCONTROL = 491 // { int vmspace_mcontrol(void *id, void *addr, \ + SYS_VMSPACE_PREAD = 492 // { ssize_t vmspace_pread(void *id, void *buf, \ + SYS_VMSPACE_PWRITE = 493 // { ssize_t vmspace_pwrite(void *id, const void *buf, \ SYS_EXTEXIT = 494 // { void extexit(int how, int status, void *addr); } SYS_LWP_CREATE = 495 // { int lwp_create(struct lwp_params *params); } SYS_LWP_GETTID = 496 // { lwpid_t lwp_gettid(void); } SYS_LWP_KILL = 497 // { int lwp_kill(pid_t pid, lwpid_t tid, int signum); } SYS_LWP_RTPRIO = 498 // { int lwp_rtprio(int function, pid_t pid, lwpid_t tid, struct rtprio *rtp); } - SYS_PSELECT = 499 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sigmask); } + SYS_PSELECT = 499 // { int pselect(int nd, fd_set *in, fd_set *ou, \ SYS_STATVFS = 500 // { int statvfs(const char *path, struct statvfs *buf); } SYS_FSTATVFS = 501 // { int fstatvfs(int fd, struct statvfs *buf); } SYS_FHSTATVFS = 502 // { int fhstatvfs(const struct fhandle *u_fhp, struct statvfs *buf); } - SYS_GETVFSSTAT = 503 // { int getvfsstat(struct statfs *buf, struct statvfs *vbuf, long vbufsize, int flags); } + SYS_GETVFSSTAT = 503 // { int getvfsstat(struct statfs *buf, \ SYS_OPENAT = 504 // { int openat(int fd, char *path, int flags, int mode); } - SYS_FSTATAT = 505 // { int fstatat(int fd, char *path, struct stat *sb, int flags); } - SYS_FCHMODAT = 506 // { int fchmodat(int fd, char *path, int mode, int flags); } - SYS_FCHOWNAT = 507 // { int fchownat(int fd, char *path, int uid, int gid, int flags); } + SYS_FSTATAT = 505 // { int fstatat(int fd, char *path, \ + SYS_FCHMODAT = 506 // { int fchmodat(int fd, char *path, int mode, \ + SYS_FCHOWNAT = 507 // { int fchownat(int fd, char *path, int uid, int gid, \ SYS_UNLINKAT = 508 // { int unlinkat(int fd, char *path, int flags); } - SYS_FACCESSAT = 509 // { int faccessat(int fd, char *path, int amode, int flags); } - SYS_MQ_OPEN = 510 // { mqd_t mq_open(const char * name, int oflag, mode_t mode, struct mq_attr *attr); } + SYS_FACCESSAT = 509 // { int faccessat(int fd, char *path, int amode, \ + SYS_MQ_OPEN = 510 // { mqd_t mq_open(const char * name, int oflag, \ SYS_MQ_CLOSE = 511 // { int mq_close(mqd_t mqdes); } SYS_MQ_UNLINK = 512 // { int mq_unlink(const char *name); } - SYS_MQ_GETATTR = 513 // { int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat); } - SYS_MQ_SETATTR = 514 // { int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat, struct mq_attr *omqstat); } - SYS_MQ_NOTIFY = 515 // { int mq_notify(mqd_t mqdes, const struct sigevent *notification); } - SYS_MQ_SEND = 516 // { int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio); } - SYS_MQ_RECEIVE = 517 // { ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio); } - SYS_MQ_TIMEDSEND = 518 // { int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } - SYS_MQ_TIMEDRECEIVE = 519 // { ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_MQ_GETATTR = 513 // { int mq_getattr(mqd_t mqdes, \ + SYS_MQ_SETATTR = 514 // { int mq_setattr(mqd_t mqdes, \ + SYS_MQ_NOTIFY = 515 // { int mq_notify(mqd_t mqdes, \ + SYS_MQ_SEND = 516 // { int mq_send(mqd_t mqdes, const char *msg_ptr, \ + SYS_MQ_RECEIVE = 517 // { ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, \ + SYS_MQ_TIMEDSEND = 518 // { int mq_timedsend(mqd_t mqdes, \ + SYS_MQ_TIMEDRECEIVE = 519 // { ssize_t mq_timedreceive(mqd_t mqdes, \ SYS_IOPRIO_SET = 520 // { int ioprio_set(int which, int who, int prio); } SYS_IOPRIO_GET = 521 // { int ioprio_get(int which, int who); } SYS_CHROOT_KERNEL = 522 // { int chroot_kernel(char *path); } - SYS_RENAMEAT = 523 // { int renameat(int oldfd, char *old, int newfd, char *new); } + SYS_RENAMEAT = 523 // { int renameat(int oldfd, char *old, int newfd, \ SYS_MKDIRAT = 524 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 525 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 526 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } - SYS_READLINKAT = 527 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_MKNODAT = 526 // { int mknodat(int fd, char *path, mode_t mode, \ + SYS_READLINKAT = 527 // { int readlinkat(int fd, char *path, char *buf, \ SYS_SYMLINKAT = 528 // { int symlinkat(char *path1, int fd, char *path2); } SYS_SWAPOFF = 529 // { int swapoff(char *name); } - SYS_VQUOTACTL = 530 // { int vquotactl(const char *path, struct plistref *pref); } - SYS_LINKAT = 531 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flags); } + SYS_VQUOTACTL = 530 // { int vquotactl(const char *path, \ + SYS_LINKAT = 531 // { int linkat(int fd1, char *path1, int fd2, \ SYS_EACCESS = 532 // { int eaccess(char *path, int flags); } SYS_LPATHCONF = 533 // { int lpathconf(char *path, int name); } SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); } @@ -308,7 +308,7 @@ const ( SYS_FUTIMENS = 540 // { int futimens(int fd, const struct timespec *ts); } SYS_ACCEPT4 = 541 // { int accept4(int s, caddr_t name, int *anamelen, int flags); } SYS_LWP_SETNAME = 542 // { int lwp_setname(lwpid_t tid, const char *name); } - SYS_PPOLL = 543 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *sigmask); } + SYS_PPOLL = 543 // { int ppoll(struct pollfd *fds, u_int nfds, \ SYS_LWP_SETAFFINITY = 544 // { int lwp_setaffinity(pid_t pid, lwpid_t tid, const cpumask_t *mask); } SYS_LWP_GETAFFINITY = 545 // { int lwp_getaffinity(pid_t pid, lwpid_t tid, cpumask_t *mask); } SYS_LWP_CREATE2 = 546 // { int lwp_create2(struct lwp_params *params, const cpumask_t *mask); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 9474974b..1ab8780c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// mksysnum_freebsd.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,freebsd @@ -7,13 +7,13 @@ package unix const ( // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void + SYS_EXIT = 1 // { void sys_exit(int rval); } exit \ SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, \ + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, \ SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, \ SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } @@ -21,20 +21,20 @@ const ( SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_OBREAK = 17 // { int obreak(char *nsize); } break \ SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, \ SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, \ + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, \ + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, \ + SYS_ACCEPT = 30 // { int accept(int s, \ + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, \ + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, \ SYS_ACCESS = 33 // { int access(char *path, int amode); } SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } @@ -44,55 +44,55 @@ const ( SYS_DUP = 41 // { int dup(u_int fd); } SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, \ SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int \ SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, \ + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, \ SYS_REBOOT = 55 // { int reboot(int opt); } SYS_REVOKE = 56 // { int revoke(char *path); } SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, \ + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, \ + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args \ SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, \ SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int + SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise \ SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, \ + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, \ + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, \ + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, \ SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct \ SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, \ SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, \ + SYS_SOCKET = 97 // { int socket(int domain, int type, \ + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, \ SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, \ + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ + SYS_GETRUSAGE = 117 // { int getrusage(int who, \ + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, \ + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } @@ -100,24 +100,26 @@ const ( SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_UTIMES = 138 // { int utimes(char *path, \ + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_LGETFH = 160 // { int lgetfh(char *fname, \ + SYS_GETFH = 161 // { int getfh(char *fname, \ SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } - SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } - SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, \ + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, \ + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, \ + SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, \ + SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, \ SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -128,269 +130,274 @@ const ( SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ + SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, \ + SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, \ + SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, \ + SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, \ + SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, \ + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, \ SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, \ + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, \ + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, \ + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, \ + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 233 // { int clock_settime( \ + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, \ SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } - SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } - SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, \ + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct \ SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } - SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( \ + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( \ + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,\ SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, \ SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, \ + SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, \ SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } - SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } + SYS_LUTIMES = 276 // { int lutimes(char *path, \ SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } - SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, \ + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, \ + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, \ + SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, \ SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, \ SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct \ SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, \ + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, \ + SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend( \ + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, \ SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } + SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } + SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } + SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, \ SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } - SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } - SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } - SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } SYS_SCHED_YIELD = 331 // { int sched_yield (void); } SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } - SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, \ SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } - SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, \ SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, \ SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } - SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } - SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, \ + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, \ + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, \ + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, \ + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, \ + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, \ + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( \ + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( \ + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ + SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( \ + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, \ + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, \ SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS_KEVENT = 363 // { int kevent(int fd, \ + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, \ + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, \ + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, \ SYS___SETUGID = 374 // { int __setugid(int flag); } SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } - SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, \ SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } - SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } - SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } - SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, \ + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, \ + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, \ + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, \ + SYS_KENV = 390 // { int kenv(int what, const char *name, \ + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, \ + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, \ + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, \ + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, \ + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, \ + SYS_STATFS = 396 // { int statfs(char *path, \ SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, \ SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } - SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } - SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, \ + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, \ SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } - SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } - SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } - SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, \ + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, \ + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, \ + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( \ + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( \ + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( \ + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, \ + SYS_SIGACTION = 416 // { int sigaction(int sig, \ + SYS_SIGRETURN = 417 // { int sigreturn( \ SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } - SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext( \ + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, \ SYS_SWAPOFF = 424 // { int swapoff(const char *name); } - SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } - SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } - SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, \ + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, \ + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, \ + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, \ + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, \ + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, \ SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } + SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } + SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } - SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, \ + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( \ + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( \ + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, \ + SYS_THR_SUSPEND = 442 // { int thr_suspend( \ SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } - SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } - SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } + SYS_AUDIT = 445 // { int audit(const void *record, \ + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, \ SYS_GETAUID = 447 // { int getauid(uid_t *auid); } SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( \ + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( \ SYS_AUDITCTL = 453 // { int auditctl(char *path); } - SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } - SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, \ + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, \ SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } - SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, \ + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, \ + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, \ + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, \ + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, \ SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } - SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, \ SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } - SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } - SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } - SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } - SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, \ + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, \ + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, \ + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, \ SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } - SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, \ SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } - SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } - SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } - SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } - SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } - SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } - SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } - SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } - SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } - SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, \ + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, \ + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, \ + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, \ + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, \ + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, \ + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, \ + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, \ + SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, \ + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, \ + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, \ SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } - SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } - SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } + SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, \ + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, \ + SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, \ + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, \ + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, \ SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } - SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, \ + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, \ SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } - SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, \ + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, \ + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, \ SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } - SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, \ SYS_CAP_ENTER = 516 // { int cap_enter(void); } SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } - SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } - SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, \ + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, \ SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } - SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } - SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } - SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } - SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } - SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } - SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } - SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } - SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } - SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } - SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } - SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } - SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, \ + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, \ + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, \ + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, \ + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, \ + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, \ + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, \ + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, \ + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, \ + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, \ + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, \ + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, \ + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, \ + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, \ + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, \ + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, \ + SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } - SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } - SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } - SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } - SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ + SYS_FUTIMENS = 546 // { int futimens(int fd, \ + SYS_UTIMENSAT = 547 // { int utimensat(int fd, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 48a7beae..b66f900d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// mksysnum_freebsd.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,freebsd @@ -7,13 +7,13 @@ package unix const ( // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void + SYS_EXIT = 1 // { void sys_exit(int rval); } exit \ SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, \ + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, \ SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, \ SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } @@ -21,20 +21,20 @@ const ( SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_OBREAK = 17 // { int obreak(char *nsize); } break \ SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, \ SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, \ + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, \ + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, \ + SYS_ACCEPT = 30 // { int accept(int s, \ + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, \ + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, \ SYS_ACCESS = 33 // { int access(char *path, int amode); } SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } @@ -44,55 +44,55 @@ const ( SYS_DUP = 41 // { int dup(u_int fd); } SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, \ SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int \ SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, \ + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, \ SYS_REBOOT = 55 // { int reboot(int opt); } SYS_REVOKE = 56 // { int revoke(char *path); } SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, \ + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, \ + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args \ SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, \ SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int + SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise \ SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, \ + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, \ + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, \ + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, \ SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct \ SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, \ SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, \ + SYS_SOCKET = 97 // { int socket(int domain, int type, \ + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, \ SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, \ + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ + SYS_GETRUSAGE = 117 // { int getrusage(int who, \ + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, \ + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } @@ -100,24 +100,26 @@ const ( SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_UTIMES = 138 // { int utimes(char *path, \ + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_LGETFH = 160 // { int lgetfh(char *fname, \ + SYS_GETFH = 161 // { int getfh(char *fname, \ SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } - SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } - SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, \ + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, \ + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, \ + SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, \ + SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, \ SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -128,269 +130,274 @@ const ( SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ + SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, \ + SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, \ + SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, \ + SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, \ + SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, \ + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, \ SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, \ + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, \ + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, \ + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, \ + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 233 // { int clock_settime( \ + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, \ SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } - SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } - SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, \ + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct \ SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } - SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( \ + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( \ + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,\ SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, \ SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, \ + SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, \ SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } - SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } + SYS_LUTIMES = 276 // { int lutimes(char *path, \ SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } - SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, \ + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, \ + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, \ + SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, \ SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, \ SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct \ SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, \ + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, \ + SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend( \ + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, \ SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } + SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } + SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } + SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, \ SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } - SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } - SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } - SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } SYS_SCHED_YIELD = 331 // { int sched_yield (void); } SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } - SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, \ SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } - SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, \ SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, \ SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } - SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } - SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, \ + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, \ + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, \ + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, \ + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, \ + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, \ + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( \ + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( \ + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ + SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( \ + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, \ + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, \ SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS_KEVENT = 363 // { int kevent(int fd, \ + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, \ + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, \ + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, \ SYS___SETUGID = 374 // { int __setugid(int flag); } SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } - SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, \ SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } - SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } - SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } - SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, \ + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, \ + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, \ + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, \ + SYS_KENV = 390 // { int kenv(int what, const char *name, \ + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, \ + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, \ + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, \ + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, \ + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, \ + SYS_STATFS = 396 // { int statfs(char *path, \ SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, \ SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } - SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } - SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, \ + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, \ SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } - SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } - SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } - SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, \ + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, \ + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, \ + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( \ + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( \ + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( \ + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, \ + SYS_SIGACTION = 416 // { int sigaction(int sig, \ + SYS_SIGRETURN = 417 // { int sigreturn( \ SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } - SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext( \ + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, \ SYS_SWAPOFF = 424 // { int swapoff(const char *name); } - SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } - SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } - SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, \ + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, \ + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, \ + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, \ + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, \ + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, \ SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } + SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } + SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } - SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, \ + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( \ + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( \ + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, \ + SYS_THR_SUSPEND = 442 // { int thr_suspend( \ SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } - SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } - SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } + SYS_AUDIT = 445 // { int audit(const void *record, \ + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, \ SYS_GETAUID = 447 // { int getauid(uid_t *auid); } SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( \ + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( \ SYS_AUDITCTL = 453 // { int auditctl(char *path); } - SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } - SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, \ + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, \ SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } - SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, \ + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, \ + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, \ + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, \ + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, \ SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } - SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, \ SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } - SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } - SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } - SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } - SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, \ + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, \ + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, \ + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, \ SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } - SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, \ SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } - SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } - SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } - SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } - SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } - SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } - SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } - SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } - SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } - SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, \ + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, \ + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, \ + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, \ + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, \ + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, \ + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, \ + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, \ + SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, \ + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, \ + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, \ SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } - SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } - SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } + SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, \ + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, \ + SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, \ + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, \ + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, \ SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } - SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, \ + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, \ SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } - SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, \ + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, \ + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, \ SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } - SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, \ SYS_CAP_ENTER = 516 // { int cap_enter(void); } SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } - SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } - SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, \ + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, \ SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } - SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } - SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } - SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } - SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } - SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } - SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } - SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } - SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } - SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } - SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } - SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } - SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, \ + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, \ + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, \ + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, \ + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, \ + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, \ + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, \ + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, \ + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, \ + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, \ + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, \ + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, \ + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, \ + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, \ + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, \ + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, \ + SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } - SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } - SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } - SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } - SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ + SYS_FUTIMENS = 546 // { int futimens(int fd, \ + SYS_UTIMENSAT = 547 // { int utimensat(int fd, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index 4a6dfd4a..d61941ba 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// mksysnum_freebsd.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,freebsd @@ -7,13 +7,13 @@ package unix const ( // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void + SYS_EXIT = 1 // { void sys_exit(int rval); } exit \ SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, \ + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, \ SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, \ SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } @@ -21,20 +21,20 @@ const ( SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_OBREAK = 17 // { int obreak(char *nsize); } break \ SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, \ SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, \ + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, \ + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, \ + SYS_ACCEPT = 30 // { int accept(int s, \ + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, \ + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, \ SYS_ACCESS = 33 // { int access(char *path, int amode); } SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } @@ -44,55 +44,55 @@ const ( SYS_DUP = 41 // { int dup(u_int fd); } SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, \ SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int \ SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, \ + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, \ SYS_REBOOT = 55 // { int reboot(int opt); } SYS_REVOKE = 56 // { int revoke(char *path); } SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, \ + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, \ + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args \ SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, \ SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int + SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise \ SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, \ + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, \ + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, \ + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, \ SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct \ SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, \ SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, \ + SYS_SOCKET = 97 // { int socket(int domain, int type, \ + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, \ SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, \ + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ + SYS_GETRUSAGE = 117 // { int getrusage(int who, \ + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, \ + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } @@ -100,24 +100,26 @@ const ( SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_UTIMES = 138 // { int utimes(char *path, \ + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_LGETFH = 160 // { int lgetfh(char *fname, \ + SYS_GETFH = 161 // { int getfh(char *fname, \ SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } - SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } - SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, \ + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, \ + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, \ + SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, \ + SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, \ SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -128,269 +130,274 @@ const ( SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ + SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, \ + SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, \ + SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, \ + SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, \ + SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, \ + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, \ SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, \ + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, \ + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, \ + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, \ + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 233 // { int clock_settime( \ + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, \ SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } - SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } - SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, \ + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct \ SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } - SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( \ + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( \ + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,\ SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, \ SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, \ + SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, \ SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } - SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } + SYS_LUTIMES = 276 // { int lutimes(char *path, \ SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } - SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, \ + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, \ + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, \ + SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, \ SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, \ SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct \ SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, \ + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, \ + SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend( \ + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, \ SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } + SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } + SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } + SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, \ SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } - SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } - SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } - SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } SYS_SCHED_YIELD = 331 // { int sched_yield (void); } SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } - SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, \ SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } - SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, \ SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, \ SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } - SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } - SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, \ + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, \ + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, \ + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, \ + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, \ + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, \ + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( \ + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( \ + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ + SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( \ + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, \ + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, \ SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS_KEVENT = 363 // { int kevent(int fd, \ + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, \ + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, \ + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, \ SYS___SETUGID = 374 // { int __setugid(int flag); } SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } - SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, \ SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } - SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } - SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } - SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, \ + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, \ + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, \ + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, \ + SYS_KENV = 390 // { int kenv(int what, const char *name, \ + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, \ + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, \ + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, \ + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, \ + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, \ + SYS_STATFS = 396 // { int statfs(char *path, \ SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, \ SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } - SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } - SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, \ + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, \ SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } - SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } - SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } - SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, \ + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, \ + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, \ + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( \ + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( \ + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( \ + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, \ + SYS_SIGACTION = 416 // { int sigaction(int sig, \ + SYS_SIGRETURN = 417 // { int sigreturn( \ SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } - SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext( \ + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, \ SYS_SWAPOFF = 424 // { int swapoff(const char *name); } - SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } - SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } - SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, \ + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, \ + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, \ + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, \ + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, \ + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, \ SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } + SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } + SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } - SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, \ + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( \ + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( \ + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, \ + SYS_THR_SUSPEND = 442 // { int thr_suspend( \ SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } - SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } - SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } + SYS_AUDIT = 445 // { int audit(const void *record, \ + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, \ SYS_GETAUID = 447 // { int getauid(uid_t *auid); } SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( \ + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( \ SYS_AUDITCTL = 453 // { int auditctl(char *path); } - SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } - SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, \ + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, \ SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } - SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, \ + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, \ + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, \ + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, \ + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, \ SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } - SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, \ SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } - SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } - SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } - SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } - SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, \ + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, \ + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, \ + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, \ SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } - SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, \ SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } - SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } - SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } - SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } - SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } - SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } - SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } - SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } - SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } - SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, \ + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, \ + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, \ + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, \ + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, \ + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, \ + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, \ + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, \ + SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, \ + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, \ + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, \ SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } - SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } - SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } + SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, \ + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, \ + SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, \ + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, \ + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, \ SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } - SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, \ + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, \ SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } - SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, \ + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, \ + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, \ SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } - SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, \ SYS_CAP_ENTER = 516 // { int cap_enter(void); } SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } - SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } - SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, \ + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, \ SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } - SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } - SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } - SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } - SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } - SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } - SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } - SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } - SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } - SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } - SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } - SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } - SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, \ + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, \ + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, \ + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, \ + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, \ + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, \ + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, \ + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, \ + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, \ + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, \ + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, \ + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, \ + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, \ + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, \ + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, \ + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, \ + SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } - SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } - SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } - SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } - SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ + SYS_FUTIMENS = 546 // { int futimens(int fd, \ + SYS_UTIMENSAT = 547 // { int utimensat(int fd, \ ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go deleted file mode 100644 index 3e51af8e..00000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ /dev/null @@ -1,396 +0,0 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,freebsd - -package unix - -const ( - // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } - SYS_LINK = 9 // { int link(char *path, char *link); } - SYS_UNLINK = 10 // { int unlink(char *path); } - SYS_CHDIR = 12 // { int chdir(char *path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(char *path, int mode); } - SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int - SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } - SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t getuid(void); } - SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } - SYS_ACCESS = 33 // { int access(char *path, int amode); } - SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum); } - SYS_GETPPID = 39 // { pid_t getppid(void); } - SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } - SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int - SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } - SYS_VFORK = 66 // { int vfork(void); } - SYS_SBRK = 69 // { int sbrk(int incr); } - SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int - SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } - SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } - SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } - SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } - SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } - SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } - SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } - SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } - SYS_SETFIB = 175 // { int setfib(int fibnum); } - SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } - SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } - SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int - SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } - SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } - SYS_UNDELETE = 205 // { int undelete(char *path); } - SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } - SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } - SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } - SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } - SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } - SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } - SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } - SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } - SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } - SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } - SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_ISSETUGID = 253 // { int issetugid(void); } - SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } - SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } - SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } - SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } - SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } - SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } - SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } - SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } - SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } - SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } - SYS_MODFNEXT = 302 // { int modfnext(int modid); } - SYS_MODFIND = 303 // { int modfind(const char *name); } - SYS_KLDLOAD = 304 // { int kldload(const char *file); } - SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } - SYS_KLDFIND = 306 // { int kldfind(const char *file); } - SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } - SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } - SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } - SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } - SYS_YIELD = 321 // { int yield(void); } - SYS_MLOCKALL = 324 // { int mlockall(int how); } - SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } - SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } - SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } - SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } - SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } - SYS_SCHED_YIELD = 331 // { int sched_yield (void); } - SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } - SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } - SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } - SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } - SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } - SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } - SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } - SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } - SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } - SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } - SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } - SYS___SETUGID = 374 // { int __setugid(int flag); } - SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } - SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } - SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } - SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } - SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } - SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } - SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } - SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } - SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } - SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } - SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } - SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } - SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } - SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } - SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } - SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } - SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } - SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } - SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } - SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } - SYS_SWAPOFF = 424 // { int swapoff(const char *name); } - SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } - SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } - SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } - SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } - SYS_THR_EXIT = 431 // { void thr_exit(long *state); } - SYS_THR_SELF = 432 // { int thr_self(long *id); } - SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } - SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } - SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } - SYS_THR_WAKE = 443 // { int thr_wake(long id); } - SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } - SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } - SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } - SYS_GETAUID = 447 // { int getauid(uid_t *auid); } - SYS_SETAUID = 448 // { int setauid(uid_t *auid); } - SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } - SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_AUDITCTL = 453 // { int auditctl(char *path); } - SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } - SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } - SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } - SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } - SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } - SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } - SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } - SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } - SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } - SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } - SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } - SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } - SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } - SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } - SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } - SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } - SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } - SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } - SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } - SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } - SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } - SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } - SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } - SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } - SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } - SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } - SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } - SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } - SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } - SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } - SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } - SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } - SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } - SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } - SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } - SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } - SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } - SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } - SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } - SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } - SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } - SYS_CAP_ENTER = 516 // { int cap_enter(void); } - SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } - SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } - SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } - SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } - SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } - SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } - SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } - SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } - SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } - SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } - SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } - SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } - SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } - SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } - SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } - SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } - SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } - SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } - SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } - SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } - SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } - SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } - SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } - SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } - SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } - SYS_FDATASYNC = 550 // { int fdatasync(int fd); } -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 33b6e4d1..8f33ece7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,linux @@ -6,421 +6,387 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86OLD = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_VM86 = 166 - SYS_QUERY_MODULE = 167 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_SETRESGID = 170 - SYS_GETRESGID = 171 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_CHOWN = 182 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_GETPMSG = 188 - SYS_PUTPMSG = 189 - SYS_VFORK = 190 - SYS_UGETRLIMIT = 191 - SYS_MMAP2 = 192 - SYS_TRUNCATE64 = 193 - SYS_FTRUNCATE64 = 194 - SYS_STAT64 = 195 - SYS_LSTAT64 = 196 - SYS_FSTAT64 = 197 - SYS_LCHOWN32 = 198 - SYS_GETUID32 = 199 - SYS_GETGID32 = 200 - SYS_GETEUID32 = 201 - SYS_GETEGID32 = 202 - SYS_SETREUID32 = 203 - SYS_SETREGID32 = 204 - SYS_GETGROUPS32 = 205 - SYS_SETGROUPS32 = 206 - SYS_FCHOWN32 = 207 - SYS_SETRESUID32 = 208 - SYS_GETRESUID32 = 209 - SYS_SETRESGID32 = 210 - SYS_GETRESGID32 = 211 - SYS_CHOWN32 = 212 - SYS_SETUID32 = 213 - SYS_SETGID32 = 214 - SYS_SETFSUID32 = 215 - SYS_SETFSGID32 = 216 - SYS_PIVOT_ROOT = 217 - SYS_MINCORE = 218 - SYS_MADVISE = 219 - SYS_GETDENTS64 = 220 - SYS_FCNTL64 = 221 - SYS_GETTID = 224 - SYS_READAHEAD = 225 - SYS_SETXATTR = 226 - SYS_LSETXATTR = 227 - SYS_FSETXATTR = 228 - SYS_GETXATTR = 229 - SYS_LGETXATTR = 230 - SYS_FGETXATTR = 231 - SYS_LISTXATTR = 232 - SYS_LLISTXATTR = 233 - SYS_FLISTXATTR = 234 - SYS_REMOVEXATTR = 235 - SYS_LREMOVEXATTR = 236 - SYS_FREMOVEXATTR = 237 - SYS_TKILL = 238 - SYS_SENDFILE64 = 239 - SYS_FUTEX = 240 - SYS_SCHED_SETAFFINITY = 241 - SYS_SCHED_GETAFFINITY = 242 - SYS_SET_THREAD_AREA = 243 - SYS_GET_THREAD_AREA = 244 - SYS_IO_SETUP = 245 - SYS_IO_DESTROY = 246 - SYS_IO_GETEVENTS = 247 - SYS_IO_SUBMIT = 248 - SYS_IO_CANCEL = 249 - SYS_FADVISE64 = 250 - SYS_EXIT_GROUP = 252 - SYS_LOOKUP_DCOOKIE = 253 - SYS_EPOLL_CREATE = 254 - SYS_EPOLL_CTL = 255 - SYS_EPOLL_WAIT = 256 - SYS_REMAP_FILE_PAGES = 257 - SYS_SET_TID_ADDRESS = 258 - SYS_TIMER_CREATE = 259 - SYS_TIMER_SETTIME = 260 - SYS_TIMER_GETTIME = 261 - SYS_TIMER_GETOVERRUN = 262 - SYS_TIMER_DELETE = 263 - SYS_CLOCK_SETTIME = 264 - SYS_CLOCK_GETTIME = 265 - SYS_CLOCK_GETRES = 266 - SYS_CLOCK_NANOSLEEP = 267 - SYS_STATFS64 = 268 - SYS_FSTATFS64 = 269 - SYS_TGKILL = 270 - SYS_UTIMES = 271 - SYS_FADVISE64_64 = 272 - SYS_VSERVER = 273 - SYS_MBIND = 274 - SYS_GET_MEMPOLICY = 275 - SYS_SET_MEMPOLICY = 276 - SYS_MQ_OPEN = 277 - SYS_MQ_UNLINK = 278 - SYS_MQ_TIMEDSEND = 279 - SYS_MQ_TIMEDRECEIVE = 280 - SYS_MQ_NOTIFY = 281 - SYS_MQ_GETSETATTR = 282 - SYS_KEXEC_LOAD = 283 - SYS_WAITID = 284 - SYS_ADD_KEY = 286 - SYS_REQUEST_KEY = 287 - SYS_KEYCTL = 288 - SYS_IOPRIO_SET = 289 - SYS_IOPRIO_GET = 290 - SYS_INOTIFY_INIT = 291 - SYS_INOTIFY_ADD_WATCH = 292 - SYS_INOTIFY_RM_WATCH = 293 - SYS_MIGRATE_PAGES = 294 - SYS_OPENAT = 295 - SYS_MKDIRAT = 296 - SYS_MKNODAT = 297 - SYS_FCHOWNAT = 298 - SYS_FUTIMESAT = 299 - SYS_FSTATAT64 = 300 - SYS_UNLINKAT = 301 - SYS_RENAMEAT = 302 - SYS_LINKAT = 303 - SYS_SYMLINKAT = 304 - SYS_READLINKAT = 305 - SYS_FCHMODAT = 306 - SYS_FACCESSAT = 307 - SYS_PSELECT6 = 308 - SYS_PPOLL = 309 - SYS_UNSHARE = 310 - SYS_SET_ROBUST_LIST = 311 - SYS_GET_ROBUST_LIST = 312 - SYS_SPLICE = 313 - SYS_SYNC_FILE_RANGE = 314 - SYS_TEE = 315 - SYS_VMSPLICE = 316 - SYS_MOVE_PAGES = 317 - SYS_GETCPU = 318 - SYS_EPOLL_PWAIT = 319 - SYS_UTIMENSAT = 320 - SYS_SIGNALFD = 321 - SYS_TIMERFD_CREATE = 322 - SYS_EVENTFD = 323 - SYS_FALLOCATE = 324 - SYS_TIMERFD_SETTIME = 325 - SYS_TIMERFD_GETTIME = 326 - SYS_SIGNALFD4 = 327 - SYS_EVENTFD2 = 328 - SYS_EPOLL_CREATE1 = 329 - SYS_DUP3 = 330 - SYS_PIPE2 = 331 - SYS_INOTIFY_INIT1 = 332 - SYS_PREADV = 333 - SYS_PWRITEV = 334 - SYS_RT_TGSIGQUEUEINFO = 335 - SYS_PERF_EVENT_OPEN = 336 - SYS_RECVMMSG = 337 - SYS_FANOTIFY_INIT = 338 - SYS_FANOTIFY_MARK = 339 - SYS_PRLIMIT64 = 340 - SYS_NAME_TO_HANDLE_AT = 341 - SYS_OPEN_BY_HANDLE_AT = 342 - SYS_CLOCK_ADJTIME = 343 - SYS_SYNCFS = 344 - SYS_SENDMMSG = 345 - SYS_SETNS = 346 - SYS_PROCESS_VM_READV = 347 - SYS_PROCESS_VM_WRITEV = 348 - SYS_KCMP = 349 - SYS_FINIT_MODULE = 350 - SYS_SCHED_SETATTR = 351 - SYS_SCHED_GETATTR = 352 - SYS_RENAMEAT2 = 353 - SYS_SECCOMP = 354 - SYS_GETRANDOM = 355 - SYS_MEMFD_CREATE = 356 - SYS_BPF = 357 - SYS_EXECVEAT = 358 - SYS_SOCKET = 359 - SYS_SOCKETPAIR = 360 - SYS_BIND = 361 - SYS_CONNECT = 362 - SYS_LISTEN = 363 - SYS_ACCEPT4 = 364 - SYS_GETSOCKOPT = 365 - SYS_SETSOCKOPT = 366 - SYS_GETSOCKNAME = 367 - SYS_GETPEERNAME = 368 - SYS_SENDTO = 369 - SYS_SENDMSG = 370 - SYS_RECVFROM = 371 - SYS_RECVMSG = 372 - SYS_SHUTDOWN = 373 - SYS_USERFAULTFD = 374 - SYS_MEMBARRIER = 375 - SYS_MLOCK2 = 376 - SYS_COPY_FILE_RANGE = 377 - SYS_PREADV2 = 378 - SYS_PWRITEV2 = 379 - SYS_PKEY_MPROTECT = 380 - SYS_PKEY_ALLOC = 381 - SYS_PKEY_FREE = 382 - SYS_STATX = 383 - SYS_ARCH_PRCTL = 384 - SYS_IO_PGETEVENTS = 385 - SYS_RSEQ = 386 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_CLOCK_GETTIME64 = 403 - SYS_CLOCK_SETTIME64 = 404 - SYS_CLOCK_ADJTIME64 = 405 - SYS_CLOCK_GETRES_TIME64 = 406 - SYS_CLOCK_NANOSLEEP_TIME64 = 407 - SYS_TIMER_GETTIME64 = 408 - SYS_TIMER_SETTIME64 = 409 - SYS_TIMERFD_GETTIME64 = 410 - SYS_TIMERFD_SETTIME64 = 411 - SYS_UTIMENSAT_TIME64 = 412 - SYS_PSELECT6_TIME64 = 413 - SYS_PPOLL_TIME64 = 414 - SYS_IO_PGETEVENTS_TIME64 = 416 - SYS_RECVMMSG_TIME64 = 417 - SYS_MQ_TIMEDSEND_TIME64 = 418 - SYS_MQ_TIMEDRECEIVE_TIME64 = 419 - SYS_SEMTIMEDOP_TIME64 = 420 - SYS_RT_SIGTIMEDWAIT_TIME64 = 421 - SYS_FUTEX_TIME64 = 422 - SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86OLD = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_VM86 = 166 + SYS_QUERY_MODULE = 167 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_SETRESGID = 170 + SYS_GETRESGID = 171 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_CHOWN = 182 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_GETPMSG = 188 + SYS_PUTPMSG = 189 + SYS_VFORK = 190 + SYS_UGETRLIMIT = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_LCHOWN32 = 198 + SYS_GETUID32 = 199 + SYS_GETGID32 = 200 + SYS_GETEUID32 = 201 + SYS_GETEGID32 = 202 + SYS_SETREUID32 = 203 + SYS_SETREGID32 = 204 + SYS_GETGROUPS32 = 205 + SYS_SETGROUPS32 = 206 + SYS_FCHOWN32 = 207 + SYS_SETRESUID32 = 208 + SYS_GETRESUID32 = 209 + SYS_SETRESGID32 = 210 + SYS_GETRESGID32 = 211 + SYS_CHOWN32 = 212 + SYS_SETUID32 = 213 + SYS_SETGID32 = 214 + SYS_SETFSUID32 = 215 + SYS_SETFSGID32 = 216 + SYS_PIVOT_ROOT = 217 + SYS_MINCORE = 218 + SYS_MADVISE = 219 + SYS_GETDENTS64 = 220 + SYS_FCNTL64 = 221 + SYS_GETTID = 224 + SYS_READAHEAD = 225 + SYS_SETXATTR = 226 + SYS_LSETXATTR = 227 + SYS_FSETXATTR = 228 + SYS_GETXATTR = 229 + SYS_LGETXATTR = 230 + SYS_FGETXATTR = 231 + SYS_LISTXATTR = 232 + SYS_LLISTXATTR = 233 + SYS_FLISTXATTR = 234 + SYS_REMOVEXATTR = 235 + SYS_LREMOVEXATTR = 236 + SYS_FREMOVEXATTR = 237 + SYS_TKILL = 238 + SYS_SENDFILE64 = 239 + SYS_FUTEX = 240 + SYS_SCHED_SETAFFINITY = 241 + SYS_SCHED_GETAFFINITY = 242 + SYS_SET_THREAD_AREA = 243 + SYS_GET_THREAD_AREA = 244 + SYS_IO_SETUP = 245 + SYS_IO_DESTROY = 246 + SYS_IO_GETEVENTS = 247 + SYS_IO_SUBMIT = 248 + SYS_IO_CANCEL = 249 + SYS_FADVISE64 = 250 + SYS_EXIT_GROUP = 252 + SYS_LOOKUP_DCOOKIE = 253 + SYS_EPOLL_CREATE = 254 + SYS_EPOLL_CTL = 255 + SYS_EPOLL_WAIT = 256 + SYS_REMAP_FILE_PAGES = 257 + SYS_SET_TID_ADDRESS = 258 + SYS_TIMER_CREATE = 259 + SYS_TIMER_SETTIME = 260 + SYS_TIMER_GETTIME = 261 + SYS_TIMER_GETOVERRUN = 262 + SYS_TIMER_DELETE = 263 + SYS_CLOCK_SETTIME = 264 + SYS_CLOCK_GETTIME = 265 + SYS_CLOCK_GETRES = 266 + SYS_CLOCK_NANOSLEEP = 267 + SYS_STATFS64 = 268 + SYS_FSTATFS64 = 269 + SYS_TGKILL = 270 + SYS_UTIMES = 271 + SYS_FADVISE64_64 = 272 + SYS_VSERVER = 273 + SYS_MBIND = 274 + SYS_GET_MEMPOLICY = 275 + SYS_SET_MEMPOLICY = 276 + SYS_MQ_OPEN = 277 + SYS_MQ_UNLINK = 278 + SYS_MQ_TIMEDSEND = 279 + SYS_MQ_TIMEDRECEIVE = 280 + SYS_MQ_NOTIFY = 281 + SYS_MQ_GETSETATTR = 282 + SYS_KEXEC_LOAD = 283 + SYS_WAITID = 284 + SYS_ADD_KEY = 286 + SYS_REQUEST_KEY = 287 + SYS_KEYCTL = 288 + SYS_IOPRIO_SET = 289 + SYS_IOPRIO_GET = 290 + SYS_INOTIFY_INIT = 291 + SYS_INOTIFY_ADD_WATCH = 292 + SYS_INOTIFY_RM_WATCH = 293 + SYS_MIGRATE_PAGES = 294 + SYS_OPENAT = 295 + SYS_MKDIRAT = 296 + SYS_MKNODAT = 297 + SYS_FCHOWNAT = 298 + SYS_FUTIMESAT = 299 + SYS_FSTATAT64 = 300 + SYS_UNLINKAT = 301 + SYS_RENAMEAT = 302 + SYS_LINKAT = 303 + SYS_SYMLINKAT = 304 + SYS_READLINKAT = 305 + SYS_FCHMODAT = 306 + SYS_FACCESSAT = 307 + SYS_PSELECT6 = 308 + SYS_PPOLL = 309 + SYS_UNSHARE = 310 + SYS_SET_ROBUST_LIST = 311 + SYS_GET_ROBUST_LIST = 312 + SYS_SPLICE = 313 + SYS_SYNC_FILE_RANGE = 314 + SYS_TEE = 315 + SYS_VMSPLICE = 316 + SYS_MOVE_PAGES = 317 + SYS_GETCPU = 318 + SYS_EPOLL_PWAIT = 319 + SYS_UTIMENSAT = 320 + SYS_SIGNALFD = 321 + SYS_TIMERFD_CREATE = 322 + SYS_EVENTFD = 323 + SYS_FALLOCATE = 324 + SYS_TIMERFD_SETTIME = 325 + SYS_TIMERFD_GETTIME = 326 + SYS_SIGNALFD4 = 327 + SYS_EVENTFD2 = 328 + SYS_EPOLL_CREATE1 = 329 + SYS_DUP3 = 330 + SYS_PIPE2 = 331 + SYS_INOTIFY_INIT1 = 332 + SYS_PREADV = 333 + SYS_PWRITEV = 334 + SYS_RT_TGSIGQUEUEINFO = 335 + SYS_PERF_EVENT_OPEN = 336 + SYS_RECVMMSG = 337 + SYS_FANOTIFY_INIT = 338 + SYS_FANOTIFY_MARK = 339 + SYS_PRLIMIT64 = 340 + SYS_NAME_TO_HANDLE_AT = 341 + SYS_OPEN_BY_HANDLE_AT = 342 + SYS_CLOCK_ADJTIME = 343 + SYS_SYNCFS = 344 + SYS_SENDMMSG = 345 + SYS_SETNS = 346 + SYS_PROCESS_VM_READV = 347 + SYS_PROCESS_VM_WRITEV = 348 + SYS_KCMP = 349 + SYS_FINIT_MODULE = 350 + SYS_SCHED_SETATTR = 351 + SYS_SCHED_GETATTR = 352 + SYS_RENAMEAT2 = 353 + SYS_SECCOMP = 354 + SYS_GETRANDOM = 355 + SYS_MEMFD_CREATE = 356 + SYS_BPF = 357 + SYS_EXECVEAT = 358 + SYS_SOCKET = 359 + SYS_SOCKETPAIR = 360 + SYS_BIND = 361 + SYS_CONNECT = 362 + SYS_LISTEN = 363 + SYS_ACCEPT4 = 364 + SYS_GETSOCKOPT = 365 + SYS_SETSOCKOPT = 366 + SYS_GETSOCKNAME = 367 + SYS_GETPEERNAME = 368 + SYS_SENDTO = 369 + SYS_SENDMSG = 370 + SYS_RECVFROM = 371 + SYS_RECVMSG = 372 + SYS_SHUTDOWN = 373 + SYS_USERFAULTFD = 374 + SYS_MEMBARRIER = 375 + SYS_MLOCK2 = 376 + SYS_COPY_FILE_RANGE = 377 + SYS_PREADV2 = 378 + SYS_PWRITEV2 = 379 + SYS_PKEY_MPROTECT = 380 + SYS_PKEY_ALLOC = 381 + SYS_PKEY_FREE = 382 + SYS_STATX = 383 + SYS_ARCH_PRCTL = 384 + SYS_IO_PGETEVENTS = 385 + SYS_RSEQ = 386 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 9ba20784..70c1a2c1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,linux @@ -341,8 +341,4 @@ const ( SYS_STATX = 332 SYS_IO_PGETEVENTS = 333 SYS_RSEQ = 334 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 94f68f10..a1db143f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,linux @@ -6,385 +6,358 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_PTRACE = 26 - SYS_PAUSE = 29 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_SETPGID = 57 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SYMLINK = 83 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_VHANGUP = 111 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_SETRESGID = 170 - SYS_GETRESGID = 171 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_CHOWN = 182 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_VFORK = 190 - SYS_UGETRLIMIT = 191 - SYS_MMAP2 = 192 - SYS_TRUNCATE64 = 193 - SYS_FTRUNCATE64 = 194 - SYS_STAT64 = 195 - SYS_LSTAT64 = 196 - SYS_FSTAT64 = 197 - SYS_LCHOWN32 = 198 - SYS_GETUID32 = 199 - SYS_GETGID32 = 200 - SYS_GETEUID32 = 201 - SYS_GETEGID32 = 202 - SYS_SETREUID32 = 203 - SYS_SETREGID32 = 204 - SYS_GETGROUPS32 = 205 - SYS_SETGROUPS32 = 206 - SYS_FCHOWN32 = 207 - SYS_SETRESUID32 = 208 - SYS_GETRESUID32 = 209 - SYS_SETRESGID32 = 210 - SYS_GETRESGID32 = 211 - SYS_CHOWN32 = 212 - SYS_SETUID32 = 213 - SYS_SETGID32 = 214 - SYS_SETFSUID32 = 215 - SYS_SETFSGID32 = 216 - SYS_GETDENTS64 = 217 - SYS_PIVOT_ROOT = 218 - SYS_MINCORE = 219 - SYS_MADVISE = 220 - SYS_FCNTL64 = 221 - SYS_GETTID = 224 - SYS_READAHEAD = 225 - SYS_SETXATTR = 226 - SYS_LSETXATTR = 227 - SYS_FSETXATTR = 228 - SYS_GETXATTR = 229 - SYS_LGETXATTR = 230 - SYS_FGETXATTR = 231 - SYS_LISTXATTR = 232 - SYS_LLISTXATTR = 233 - SYS_FLISTXATTR = 234 - SYS_REMOVEXATTR = 235 - SYS_LREMOVEXATTR = 236 - SYS_FREMOVEXATTR = 237 - SYS_TKILL = 238 - SYS_SENDFILE64 = 239 - SYS_FUTEX = 240 - SYS_SCHED_SETAFFINITY = 241 - SYS_SCHED_GETAFFINITY = 242 - SYS_IO_SETUP = 243 - SYS_IO_DESTROY = 244 - SYS_IO_GETEVENTS = 245 - SYS_IO_SUBMIT = 246 - SYS_IO_CANCEL = 247 - SYS_EXIT_GROUP = 248 - SYS_LOOKUP_DCOOKIE = 249 - SYS_EPOLL_CREATE = 250 - SYS_EPOLL_CTL = 251 - SYS_EPOLL_WAIT = 252 - SYS_REMAP_FILE_PAGES = 253 - SYS_SET_TID_ADDRESS = 256 - SYS_TIMER_CREATE = 257 - SYS_TIMER_SETTIME = 258 - SYS_TIMER_GETTIME = 259 - SYS_TIMER_GETOVERRUN = 260 - SYS_TIMER_DELETE = 261 - SYS_CLOCK_SETTIME = 262 - SYS_CLOCK_GETTIME = 263 - SYS_CLOCK_GETRES = 264 - SYS_CLOCK_NANOSLEEP = 265 - SYS_STATFS64 = 266 - SYS_FSTATFS64 = 267 - SYS_TGKILL = 268 - SYS_UTIMES = 269 - SYS_ARM_FADVISE64_64 = 270 - SYS_PCICONFIG_IOBASE = 271 - SYS_PCICONFIG_READ = 272 - SYS_PCICONFIG_WRITE = 273 - SYS_MQ_OPEN = 274 - SYS_MQ_UNLINK = 275 - SYS_MQ_TIMEDSEND = 276 - SYS_MQ_TIMEDRECEIVE = 277 - SYS_MQ_NOTIFY = 278 - SYS_MQ_GETSETATTR = 279 - SYS_WAITID = 280 - SYS_SOCKET = 281 - SYS_BIND = 282 - SYS_CONNECT = 283 - SYS_LISTEN = 284 - SYS_ACCEPT = 285 - SYS_GETSOCKNAME = 286 - SYS_GETPEERNAME = 287 - SYS_SOCKETPAIR = 288 - SYS_SEND = 289 - SYS_SENDTO = 290 - SYS_RECV = 291 - SYS_RECVFROM = 292 - SYS_SHUTDOWN = 293 - SYS_SETSOCKOPT = 294 - SYS_GETSOCKOPT = 295 - SYS_SENDMSG = 296 - SYS_RECVMSG = 297 - SYS_SEMOP = 298 - SYS_SEMGET = 299 - SYS_SEMCTL = 300 - SYS_MSGSND = 301 - SYS_MSGRCV = 302 - SYS_MSGGET = 303 - SYS_MSGCTL = 304 - SYS_SHMAT = 305 - SYS_SHMDT = 306 - SYS_SHMGET = 307 - SYS_SHMCTL = 308 - SYS_ADD_KEY = 309 - SYS_REQUEST_KEY = 310 - SYS_KEYCTL = 311 - SYS_SEMTIMEDOP = 312 - SYS_VSERVER = 313 - SYS_IOPRIO_SET = 314 - SYS_IOPRIO_GET = 315 - SYS_INOTIFY_INIT = 316 - SYS_INOTIFY_ADD_WATCH = 317 - SYS_INOTIFY_RM_WATCH = 318 - SYS_MBIND = 319 - SYS_GET_MEMPOLICY = 320 - SYS_SET_MEMPOLICY = 321 - SYS_OPENAT = 322 - SYS_MKDIRAT = 323 - SYS_MKNODAT = 324 - SYS_FCHOWNAT = 325 - SYS_FUTIMESAT = 326 - SYS_FSTATAT64 = 327 - SYS_UNLINKAT = 328 - SYS_RENAMEAT = 329 - SYS_LINKAT = 330 - SYS_SYMLINKAT = 331 - SYS_READLINKAT = 332 - SYS_FCHMODAT = 333 - SYS_FACCESSAT = 334 - SYS_PSELECT6 = 335 - SYS_PPOLL = 336 - SYS_UNSHARE = 337 - SYS_SET_ROBUST_LIST = 338 - SYS_GET_ROBUST_LIST = 339 - SYS_SPLICE = 340 - SYS_ARM_SYNC_FILE_RANGE = 341 - SYS_TEE = 342 - SYS_VMSPLICE = 343 - SYS_MOVE_PAGES = 344 - SYS_GETCPU = 345 - SYS_EPOLL_PWAIT = 346 - SYS_KEXEC_LOAD = 347 - SYS_UTIMENSAT = 348 - SYS_SIGNALFD = 349 - SYS_TIMERFD_CREATE = 350 - SYS_EVENTFD = 351 - SYS_FALLOCATE = 352 - SYS_TIMERFD_SETTIME = 353 - SYS_TIMERFD_GETTIME = 354 - SYS_SIGNALFD4 = 355 - SYS_EVENTFD2 = 356 - SYS_EPOLL_CREATE1 = 357 - SYS_DUP3 = 358 - SYS_PIPE2 = 359 - SYS_INOTIFY_INIT1 = 360 - SYS_PREADV = 361 - SYS_PWRITEV = 362 - SYS_RT_TGSIGQUEUEINFO = 363 - SYS_PERF_EVENT_OPEN = 364 - SYS_RECVMMSG = 365 - SYS_ACCEPT4 = 366 - SYS_FANOTIFY_INIT = 367 - SYS_FANOTIFY_MARK = 368 - SYS_PRLIMIT64 = 369 - SYS_NAME_TO_HANDLE_AT = 370 - SYS_OPEN_BY_HANDLE_AT = 371 - SYS_CLOCK_ADJTIME = 372 - SYS_SYNCFS = 373 - SYS_SENDMMSG = 374 - SYS_SETNS = 375 - SYS_PROCESS_VM_READV = 376 - SYS_PROCESS_VM_WRITEV = 377 - SYS_KCMP = 378 - SYS_FINIT_MODULE = 379 - SYS_SCHED_SETATTR = 380 - SYS_SCHED_GETATTR = 381 - SYS_RENAMEAT2 = 382 - SYS_SECCOMP = 383 - SYS_GETRANDOM = 384 - SYS_MEMFD_CREATE = 385 - SYS_BPF = 386 - SYS_EXECVEAT = 387 - SYS_USERFAULTFD = 388 - SYS_MEMBARRIER = 389 - SYS_MLOCK2 = 390 - SYS_COPY_FILE_RANGE = 391 - SYS_PREADV2 = 392 - SYS_PWRITEV2 = 393 - SYS_PKEY_MPROTECT = 394 - SYS_PKEY_ALLOC = 395 - SYS_PKEY_FREE = 396 - SYS_STATX = 397 - SYS_RSEQ = 398 - SYS_IO_PGETEVENTS = 399 - SYS_MIGRATE_PAGES = 400 - SYS_KEXEC_FILE_LOAD = 401 - SYS_CLOCK_GETTIME64 = 403 - SYS_CLOCK_SETTIME64 = 404 - SYS_CLOCK_ADJTIME64 = 405 - SYS_CLOCK_GETRES_TIME64 = 406 - SYS_CLOCK_NANOSLEEP_TIME64 = 407 - SYS_TIMER_GETTIME64 = 408 - SYS_TIMER_SETTIME64 = 409 - SYS_TIMERFD_GETTIME64 = 410 - SYS_TIMERFD_SETTIME64 = 411 - SYS_UTIMENSAT_TIME64 = 412 - SYS_PSELECT6_TIME64 = 413 - SYS_PPOLL_TIME64 = 414 - SYS_IO_PGETEVENTS_TIME64 = 416 - SYS_RECVMMSG_TIME64 = 417 - SYS_MQ_TIMEDSEND_TIME64 = 418 - SYS_MQ_TIMEDRECEIVE_TIME64 = 419 - SYS_SEMTIMEDOP_TIME64 = 420 - SYS_RT_SIGTIMEDWAIT_TIME64 = 421 - SYS_FUTEX_TIME64 = 422 - SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_PTRACE = 26 + SYS_PAUSE = 29 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_SETPGID = 57 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SYMLINK = 83 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_VHANGUP = 111 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_SETRESGID = 170 + SYS_GETRESGID = 171 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_CHOWN = 182 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_VFORK = 190 + SYS_UGETRLIMIT = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_LCHOWN32 = 198 + SYS_GETUID32 = 199 + SYS_GETGID32 = 200 + SYS_GETEUID32 = 201 + SYS_GETEGID32 = 202 + SYS_SETREUID32 = 203 + SYS_SETREGID32 = 204 + SYS_GETGROUPS32 = 205 + SYS_SETGROUPS32 = 206 + SYS_FCHOWN32 = 207 + SYS_SETRESUID32 = 208 + SYS_GETRESUID32 = 209 + SYS_SETRESGID32 = 210 + SYS_GETRESGID32 = 211 + SYS_CHOWN32 = 212 + SYS_SETUID32 = 213 + SYS_SETGID32 = 214 + SYS_SETFSUID32 = 215 + SYS_SETFSGID32 = 216 + SYS_GETDENTS64 = 217 + SYS_PIVOT_ROOT = 218 + SYS_MINCORE = 219 + SYS_MADVISE = 220 + SYS_FCNTL64 = 221 + SYS_GETTID = 224 + SYS_READAHEAD = 225 + SYS_SETXATTR = 226 + SYS_LSETXATTR = 227 + SYS_FSETXATTR = 228 + SYS_GETXATTR = 229 + SYS_LGETXATTR = 230 + SYS_FGETXATTR = 231 + SYS_LISTXATTR = 232 + SYS_LLISTXATTR = 233 + SYS_FLISTXATTR = 234 + SYS_REMOVEXATTR = 235 + SYS_LREMOVEXATTR = 236 + SYS_FREMOVEXATTR = 237 + SYS_TKILL = 238 + SYS_SENDFILE64 = 239 + SYS_FUTEX = 240 + SYS_SCHED_SETAFFINITY = 241 + SYS_SCHED_GETAFFINITY = 242 + SYS_IO_SETUP = 243 + SYS_IO_DESTROY = 244 + SYS_IO_GETEVENTS = 245 + SYS_IO_SUBMIT = 246 + SYS_IO_CANCEL = 247 + SYS_EXIT_GROUP = 248 + SYS_LOOKUP_DCOOKIE = 249 + SYS_EPOLL_CREATE = 250 + SYS_EPOLL_CTL = 251 + SYS_EPOLL_WAIT = 252 + SYS_REMAP_FILE_PAGES = 253 + SYS_SET_TID_ADDRESS = 256 + SYS_TIMER_CREATE = 257 + SYS_TIMER_SETTIME = 258 + SYS_TIMER_GETTIME = 259 + SYS_TIMER_GETOVERRUN = 260 + SYS_TIMER_DELETE = 261 + SYS_CLOCK_SETTIME = 262 + SYS_CLOCK_GETTIME = 263 + SYS_CLOCK_GETRES = 264 + SYS_CLOCK_NANOSLEEP = 265 + SYS_STATFS64 = 266 + SYS_FSTATFS64 = 267 + SYS_TGKILL = 268 + SYS_UTIMES = 269 + SYS_ARM_FADVISE64_64 = 270 + SYS_PCICONFIG_IOBASE = 271 + SYS_PCICONFIG_READ = 272 + SYS_PCICONFIG_WRITE = 273 + SYS_MQ_OPEN = 274 + SYS_MQ_UNLINK = 275 + SYS_MQ_TIMEDSEND = 276 + SYS_MQ_TIMEDRECEIVE = 277 + SYS_MQ_NOTIFY = 278 + SYS_MQ_GETSETATTR = 279 + SYS_WAITID = 280 + SYS_SOCKET = 281 + SYS_BIND = 282 + SYS_CONNECT = 283 + SYS_LISTEN = 284 + SYS_ACCEPT = 285 + SYS_GETSOCKNAME = 286 + SYS_GETPEERNAME = 287 + SYS_SOCKETPAIR = 288 + SYS_SEND = 289 + SYS_SENDTO = 290 + SYS_RECV = 291 + SYS_RECVFROM = 292 + SYS_SHUTDOWN = 293 + SYS_SETSOCKOPT = 294 + SYS_GETSOCKOPT = 295 + SYS_SENDMSG = 296 + SYS_RECVMSG = 297 + SYS_SEMOP = 298 + SYS_SEMGET = 299 + SYS_SEMCTL = 300 + SYS_MSGSND = 301 + SYS_MSGRCV = 302 + SYS_MSGGET = 303 + SYS_MSGCTL = 304 + SYS_SHMAT = 305 + SYS_SHMDT = 306 + SYS_SHMGET = 307 + SYS_SHMCTL = 308 + SYS_ADD_KEY = 309 + SYS_REQUEST_KEY = 310 + SYS_KEYCTL = 311 + SYS_SEMTIMEDOP = 312 + SYS_VSERVER = 313 + SYS_IOPRIO_SET = 314 + SYS_IOPRIO_GET = 315 + SYS_INOTIFY_INIT = 316 + SYS_INOTIFY_ADD_WATCH = 317 + SYS_INOTIFY_RM_WATCH = 318 + SYS_MBIND = 319 + SYS_GET_MEMPOLICY = 320 + SYS_SET_MEMPOLICY = 321 + SYS_OPENAT = 322 + SYS_MKDIRAT = 323 + SYS_MKNODAT = 324 + SYS_FCHOWNAT = 325 + SYS_FUTIMESAT = 326 + SYS_FSTATAT64 = 327 + SYS_UNLINKAT = 328 + SYS_RENAMEAT = 329 + SYS_LINKAT = 330 + SYS_SYMLINKAT = 331 + SYS_READLINKAT = 332 + SYS_FCHMODAT = 333 + SYS_FACCESSAT = 334 + SYS_PSELECT6 = 335 + SYS_PPOLL = 336 + SYS_UNSHARE = 337 + SYS_SET_ROBUST_LIST = 338 + SYS_GET_ROBUST_LIST = 339 + SYS_SPLICE = 340 + SYS_ARM_SYNC_FILE_RANGE = 341 + SYS_TEE = 342 + SYS_VMSPLICE = 343 + SYS_MOVE_PAGES = 344 + SYS_GETCPU = 345 + SYS_EPOLL_PWAIT = 346 + SYS_KEXEC_LOAD = 347 + SYS_UTIMENSAT = 348 + SYS_SIGNALFD = 349 + SYS_TIMERFD_CREATE = 350 + SYS_EVENTFD = 351 + SYS_FALLOCATE = 352 + SYS_TIMERFD_SETTIME = 353 + SYS_TIMERFD_GETTIME = 354 + SYS_SIGNALFD4 = 355 + SYS_EVENTFD2 = 356 + SYS_EPOLL_CREATE1 = 357 + SYS_DUP3 = 358 + SYS_PIPE2 = 359 + SYS_INOTIFY_INIT1 = 360 + SYS_PREADV = 361 + SYS_PWRITEV = 362 + SYS_RT_TGSIGQUEUEINFO = 363 + SYS_PERF_EVENT_OPEN = 364 + SYS_RECVMMSG = 365 + SYS_ACCEPT4 = 366 + SYS_FANOTIFY_INIT = 367 + SYS_FANOTIFY_MARK = 368 + SYS_PRLIMIT64 = 369 + SYS_NAME_TO_HANDLE_AT = 370 + SYS_OPEN_BY_HANDLE_AT = 371 + SYS_CLOCK_ADJTIME = 372 + SYS_SYNCFS = 373 + SYS_SENDMMSG = 374 + SYS_SETNS = 375 + SYS_PROCESS_VM_READV = 376 + SYS_PROCESS_VM_WRITEV = 377 + SYS_KCMP = 378 + SYS_FINIT_MODULE = 379 + SYS_SCHED_SETATTR = 380 + SYS_SCHED_GETATTR = 381 + SYS_RENAMEAT2 = 382 + SYS_SECCOMP = 383 + SYS_GETRANDOM = 384 + SYS_MEMFD_CREATE = 385 + SYS_BPF = 386 + SYS_EXECVEAT = 387 + SYS_USERFAULTFD = 388 + SYS_MEMBARRIER = 389 + SYS_MLOCK2 = 390 + SYS_COPY_FILE_RANGE = 391 + SYS_PREADV2 = 392 + SYS_PWRITEV2 = 393 + SYS_PKEY_MPROTECT = 394 + SYS_PKEY_ALLOC = 395 + SYS_PKEY_FREE = 396 + SYS_STATX = 397 + SYS_RSEQ = 398 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 15c41351..2e4cee70 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,linux @@ -284,10 +284,4 @@ const ( SYS_PKEY_FREE = 290 SYS_STATX = 291 SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 638465b1..16714491 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build mips,linux @@ -6,406 +6,372 @@ package unix const ( - SYS_SYSCALL = 4000 - SYS_EXIT = 4001 - SYS_FORK = 4002 - SYS_READ = 4003 - SYS_WRITE = 4004 - SYS_OPEN = 4005 - SYS_CLOSE = 4006 - SYS_WAITPID = 4007 - SYS_CREAT = 4008 - SYS_LINK = 4009 - SYS_UNLINK = 4010 - SYS_EXECVE = 4011 - SYS_CHDIR = 4012 - SYS_TIME = 4013 - SYS_MKNOD = 4014 - SYS_CHMOD = 4015 - SYS_LCHOWN = 4016 - SYS_BREAK = 4017 - SYS_UNUSED18 = 4018 - SYS_LSEEK = 4019 - SYS_GETPID = 4020 - SYS_MOUNT = 4021 - SYS_UMOUNT = 4022 - SYS_SETUID = 4023 - SYS_GETUID = 4024 - SYS_STIME = 4025 - SYS_PTRACE = 4026 - SYS_ALARM = 4027 - SYS_UNUSED28 = 4028 - SYS_PAUSE = 4029 - SYS_UTIME = 4030 - SYS_STTY = 4031 - SYS_GTTY = 4032 - SYS_ACCESS = 4033 - SYS_NICE = 4034 - SYS_FTIME = 4035 - SYS_SYNC = 4036 - SYS_KILL = 4037 - SYS_RENAME = 4038 - SYS_MKDIR = 4039 - SYS_RMDIR = 4040 - SYS_DUP = 4041 - SYS_PIPE = 4042 - SYS_TIMES = 4043 - SYS_PROF = 4044 - SYS_BRK = 4045 - SYS_SETGID = 4046 - SYS_GETGID = 4047 - SYS_SIGNAL = 4048 - SYS_GETEUID = 4049 - SYS_GETEGID = 4050 - SYS_ACCT = 4051 - SYS_UMOUNT2 = 4052 - SYS_LOCK = 4053 - SYS_IOCTL = 4054 - SYS_FCNTL = 4055 - SYS_MPX = 4056 - SYS_SETPGID = 4057 - SYS_ULIMIT = 4058 - SYS_UNUSED59 = 4059 - SYS_UMASK = 4060 - SYS_CHROOT = 4061 - SYS_USTAT = 4062 - SYS_DUP2 = 4063 - SYS_GETPPID = 4064 - SYS_GETPGRP = 4065 - SYS_SETSID = 4066 - SYS_SIGACTION = 4067 - SYS_SGETMASK = 4068 - SYS_SSETMASK = 4069 - SYS_SETREUID = 4070 - SYS_SETREGID = 4071 - SYS_SIGSUSPEND = 4072 - SYS_SIGPENDING = 4073 - SYS_SETHOSTNAME = 4074 - SYS_SETRLIMIT = 4075 - SYS_GETRLIMIT = 4076 - SYS_GETRUSAGE = 4077 - SYS_GETTIMEOFDAY = 4078 - SYS_SETTIMEOFDAY = 4079 - SYS_GETGROUPS = 4080 - SYS_SETGROUPS = 4081 - SYS_RESERVED82 = 4082 - SYS_SYMLINK = 4083 - SYS_UNUSED84 = 4084 - SYS_READLINK = 4085 - SYS_USELIB = 4086 - SYS_SWAPON = 4087 - SYS_REBOOT = 4088 - SYS_READDIR = 4089 - SYS_MMAP = 4090 - SYS_MUNMAP = 4091 - SYS_TRUNCATE = 4092 - SYS_FTRUNCATE = 4093 - SYS_FCHMOD = 4094 - SYS_FCHOWN = 4095 - SYS_GETPRIORITY = 4096 - SYS_SETPRIORITY = 4097 - SYS_PROFIL = 4098 - SYS_STATFS = 4099 - SYS_FSTATFS = 4100 - SYS_IOPERM = 4101 - SYS_SOCKETCALL = 4102 - SYS_SYSLOG = 4103 - SYS_SETITIMER = 4104 - SYS_GETITIMER = 4105 - SYS_STAT = 4106 - SYS_LSTAT = 4107 - SYS_FSTAT = 4108 - SYS_UNUSED109 = 4109 - SYS_IOPL = 4110 - SYS_VHANGUP = 4111 - SYS_IDLE = 4112 - SYS_VM86 = 4113 - SYS_WAIT4 = 4114 - SYS_SWAPOFF = 4115 - SYS_SYSINFO = 4116 - SYS_IPC = 4117 - SYS_FSYNC = 4118 - SYS_SIGRETURN = 4119 - SYS_CLONE = 4120 - SYS_SETDOMAINNAME = 4121 - SYS_UNAME = 4122 - SYS_MODIFY_LDT = 4123 - SYS_ADJTIMEX = 4124 - SYS_MPROTECT = 4125 - SYS_SIGPROCMASK = 4126 - SYS_CREATE_MODULE = 4127 - SYS_INIT_MODULE = 4128 - SYS_DELETE_MODULE = 4129 - SYS_GET_KERNEL_SYMS = 4130 - SYS_QUOTACTL = 4131 - SYS_GETPGID = 4132 - SYS_FCHDIR = 4133 - SYS_BDFLUSH = 4134 - SYS_SYSFS = 4135 - SYS_PERSONALITY = 4136 - SYS_AFS_SYSCALL = 4137 - SYS_SETFSUID = 4138 - SYS_SETFSGID = 4139 - SYS__LLSEEK = 4140 - SYS_GETDENTS = 4141 - SYS__NEWSELECT = 4142 - SYS_FLOCK = 4143 - SYS_MSYNC = 4144 - SYS_READV = 4145 - SYS_WRITEV = 4146 - SYS_CACHEFLUSH = 4147 - SYS_CACHECTL = 4148 - SYS_SYSMIPS = 4149 - SYS_UNUSED150 = 4150 - SYS_GETSID = 4151 - SYS_FDATASYNC = 4152 - SYS__SYSCTL = 4153 - SYS_MLOCK = 4154 - SYS_MUNLOCK = 4155 - SYS_MLOCKALL = 4156 - SYS_MUNLOCKALL = 4157 - SYS_SCHED_SETPARAM = 4158 - SYS_SCHED_GETPARAM = 4159 - SYS_SCHED_SETSCHEDULER = 4160 - SYS_SCHED_GETSCHEDULER = 4161 - SYS_SCHED_YIELD = 4162 - SYS_SCHED_GET_PRIORITY_MAX = 4163 - SYS_SCHED_GET_PRIORITY_MIN = 4164 - SYS_SCHED_RR_GET_INTERVAL = 4165 - SYS_NANOSLEEP = 4166 - SYS_MREMAP = 4167 - SYS_ACCEPT = 4168 - SYS_BIND = 4169 - SYS_CONNECT = 4170 - SYS_GETPEERNAME = 4171 - SYS_GETSOCKNAME = 4172 - SYS_GETSOCKOPT = 4173 - SYS_LISTEN = 4174 - SYS_RECV = 4175 - SYS_RECVFROM = 4176 - SYS_RECVMSG = 4177 - SYS_SEND = 4178 - SYS_SENDMSG = 4179 - SYS_SENDTO = 4180 - SYS_SETSOCKOPT = 4181 - SYS_SHUTDOWN = 4182 - SYS_SOCKET = 4183 - SYS_SOCKETPAIR = 4184 - SYS_SETRESUID = 4185 - SYS_GETRESUID = 4186 - SYS_QUERY_MODULE = 4187 - SYS_POLL = 4188 - SYS_NFSSERVCTL = 4189 - SYS_SETRESGID = 4190 - SYS_GETRESGID = 4191 - SYS_PRCTL = 4192 - SYS_RT_SIGRETURN = 4193 - SYS_RT_SIGACTION = 4194 - SYS_RT_SIGPROCMASK = 4195 - SYS_RT_SIGPENDING = 4196 - SYS_RT_SIGTIMEDWAIT = 4197 - SYS_RT_SIGQUEUEINFO = 4198 - SYS_RT_SIGSUSPEND = 4199 - SYS_PREAD64 = 4200 - SYS_PWRITE64 = 4201 - SYS_CHOWN = 4202 - SYS_GETCWD = 4203 - SYS_CAPGET = 4204 - SYS_CAPSET = 4205 - SYS_SIGALTSTACK = 4206 - SYS_SENDFILE = 4207 - SYS_GETPMSG = 4208 - SYS_PUTPMSG = 4209 - SYS_MMAP2 = 4210 - SYS_TRUNCATE64 = 4211 - SYS_FTRUNCATE64 = 4212 - SYS_STAT64 = 4213 - SYS_LSTAT64 = 4214 - SYS_FSTAT64 = 4215 - SYS_PIVOT_ROOT = 4216 - SYS_MINCORE = 4217 - SYS_MADVISE = 4218 - SYS_GETDENTS64 = 4219 - SYS_FCNTL64 = 4220 - SYS_RESERVED221 = 4221 - SYS_GETTID = 4222 - SYS_READAHEAD = 4223 - SYS_SETXATTR = 4224 - SYS_LSETXATTR = 4225 - SYS_FSETXATTR = 4226 - SYS_GETXATTR = 4227 - SYS_LGETXATTR = 4228 - SYS_FGETXATTR = 4229 - SYS_LISTXATTR = 4230 - SYS_LLISTXATTR = 4231 - SYS_FLISTXATTR = 4232 - SYS_REMOVEXATTR = 4233 - SYS_LREMOVEXATTR = 4234 - SYS_FREMOVEXATTR = 4235 - SYS_TKILL = 4236 - SYS_SENDFILE64 = 4237 - SYS_FUTEX = 4238 - SYS_SCHED_SETAFFINITY = 4239 - SYS_SCHED_GETAFFINITY = 4240 - SYS_IO_SETUP = 4241 - SYS_IO_DESTROY = 4242 - SYS_IO_GETEVENTS = 4243 - SYS_IO_SUBMIT = 4244 - SYS_IO_CANCEL = 4245 - SYS_EXIT_GROUP = 4246 - SYS_LOOKUP_DCOOKIE = 4247 - SYS_EPOLL_CREATE = 4248 - SYS_EPOLL_CTL = 4249 - SYS_EPOLL_WAIT = 4250 - SYS_REMAP_FILE_PAGES = 4251 - SYS_SET_TID_ADDRESS = 4252 - SYS_RESTART_SYSCALL = 4253 - SYS_FADVISE64 = 4254 - SYS_STATFS64 = 4255 - SYS_FSTATFS64 = 4256 - SYS_TIMER_CREATE = 4257 - SYS_TIMER_SETTIME = 4258 - SYS_TIMER_GETTIME = 4259 - SYS_TIMER_GETOVERRUN = 4260 - SYS_TIMER_DELETE = 4261 - SYS_CLOCK_SETTIME = 4262 - SYS_CLOCK_GETTIME = 4263 - SYS_CLOCK_GETRES = 4264 - SYS_CLOCK_NANOSLEEP = 4265 - SYS_TGKILL = 4266 - SYS_UTIMES = 4267 - SYS_MBIND = 4268 - SYS_GET_MEMPOLICY = 4269 - SYS_SET_MEMPOLICY = 4270 - SYS_MQ_OPEN = 4271 - SYS_MQ_UNLINK = 4272 - SYS_MQ_TIMEDSEND = 4273 - SYS_MQ_TIMEDRECEIVE = 4274 - SYS_MQ_NOTIFY = 4275 - SYS_MQ_GETSETATTR = 4276 - SYS_VSERVER = 4277 - SYS_WAITID = 4278 - SYS_ADD_KEY = 4280 - SYS_REQUEST_KEY = 4281 - SYS_KEYCTL = 4282 - SYS_SET_THREAD_AREA = 4283 - SYS_INOTIFY_INIT = 4284 - SYS_INOTIFY_ADD_WATCH = 4285 - SYS_INOTIFY_RM_WATCH = 4286 - SYS_MIGRATE_PAGES = 4287 - SYS_OPENAT = 4288 - SYS_MKDIRAT = 4289 - SYS_MKNODAT = 4290 - SYS_FCHOWNAT = 4291 - SYS_FUTIMESAT = 4292 - SYS_FSTATAT64 = 4293 - SYS_UNLINKAT = 4294 - SYS_RENAMEAT = 4295 - SYS_LINKAT = 4296 - SYS_SYMLINKAT = 4297 - SYS_READLINKAT = 4298 - SYS_FCHMODAT = 4299 - SYS_FACCESSAT = 4300 - SYS_PSELECT6 = 4301 - SYS_PPOLL = 4302 - SYS_UNSHARE = 4303 - SYS_SPLICE = 4304 - SYS_SYNC_FILE_RANGE = 4305 - SYS_TEE = 4306 - SYS_VMSPLICE = 4307 - SYS_MOVE_PAGES = 4308 - SYS_SET_ROBUST_LIST = 4309 - SYS_GET_ROBUST_LIST = 4310 - SYS_KEXEC_LOAD = 4311 - SYS_GETCPU = 4312 - SYS_EPOLL_PWAIT = 4313 - SYS_IOPRIO_SET = 4314 - SYS_IOPRIO_GET = 4315 - SYS_UTIMENSAT = 4316 - SYS_SIGNALFD = 4317 - SYS_TIMERFD = 4318 - SYS_EVENTFD = 4319 - SYS_FALLOCATE = 4320 - SYS_TIMERFD_CREATE = 4321 - SYS_TIMERFD_GETTIME = 4322 - SYS_TIMERFD_SETTIME = 4323 - SYS_SIGNALFD4 = 4324 - SYS_EVENTFD2 = 4325 - SYS_EPOLL_CREATE1 = 4326 - SYS_DUP3 = 4327 - SYS_PIPE2 = 4328 - SYS_INOTIFY_INIT1 = 4329 - SYS_PREADV = 4330 - SYS_PWRITEV = 4331 - SYS_RT_TGSIGQUEUEINFO = 4332 - SYS_PERF_EVENT_OPEN = 4333 - SYS_ACCEPT4 = 4334 - SYS_RECVMMSG = 4335 - SYS_FANOTIFY_INIT = 4336 - SYS_FANOTIFY_MARK = 4337 - SYS_PRLIMIT64 = 4338 - SYS_NAME_TO_HANDLE_AT = 4339 - SYS_OPEN_BY_HANDLE_AT = 4340 - SYS_CLOCK_ADJTIME = 4341 - SYS_SYNCFS = 4342 - SYS_SENDMMSG = 4343 - SYS_SETNS = 4344 - SYS_PROCESS_VM_READV = 4345 - SYS_PROCESS_VM_WRITEV = 4346 - SYS_KCMP = 4347 - SYS_FINIT_MODULE = 4348 - SYS_SCHED_SETATTR = 4349 - SYS_SCHED_GETATTR = 4350 - SYS_RENAMEAT2 = 4351 - SYS_SECCOMP = 4352 - SYS_GETRANDOM = 4353 - SYS_MEMFD_CREATE = 4354 - SYS_BPF = 4355 - SYS_EXECVEAT = 4356 - SYS_USERFAULTFD = 4357 - SYS_MEMBARRIER = 4358 - SYS_MLOCK2 = 4359 - SYS_COPY_FILE_RANGE = 4360 - SYS_PREADV2 = 4361 - SYS_PWRITEV2 = 4362 - SYS_PKEY_MPROTECT = 4363 - SYS_PKEY_ALLOC = 4364 - SYS_PKEY_FREE = 4365 - SYS_STATX = 4366 - SYS_RSEQ = 4367 - SYS_IO_PGETEVENTS = 4368 - SYS_SEMGET = 4393 - SYS_SEMCTL = 4394 - SYS_SHMGET = 4395 - SYS_SHMCTL = 4396 - SYS_SHMAT = 4397 - SYS_SHMDT = 4398 - SYS_MSGGET = 4399 - SYS_MSGSND = 4400 - SYS_MSGRCV = 4401 - SYS_MSGCTL = 4402 - SYS_CLOCK_GETTIME64 = 4403 - SYS_CLOCK_SETTIME64 = 4404 - SYS_CLOCK_ADJTIME64 = 4405 - SYS_CLOCK_GETRES_TIME64 = 4406 - SYS_CLOCK_NANOSLEEP_TIME64 = 4407 - SYS_TIMER_GETTIME64 = 4408 - SYS_TIMER_SETTIME64 = 4409 - SYS_TIMERFD_GETTIME64 = 4410 - SYS_TIMERFD_SETTIME64 = 4411 - SYS_UTIMENSAT_TIME64 = 4412 - SYS_PSELECT6_TIME64 = 4413 - SYS_PPOLL_TIME64 = 4414 - SYS_IO_PGETEVENTS_TIME64 = 4416 - SYS_RECVMMSG_TIME64 = 4417 - SYS_MQ_TIMEDSEND_TIME64 = 4418 - SYS_MQ_TIMEDRECEIVE_TIME64 = 4419 - SYS_SEMTIMEDOP_TIME64 = 4420 - SYS_RT_SIGTIMEDWAIT_TIME64 = 4421 - SYS_FUTEX_TIME64 = 4422 - SYS_SCHED_RR_GET_INTERVAL_TIME64 = 4423 - SYS_PIDFD_SEND_SIGNAL = 4424 - SYS_IO_URING_SETUP = 4425 - SYS_IO_URING_ENTER = 4426 - SYS_IO_URING_REGISTER = 4427 + SYS_SYSCALL = 4000 + SYS_EXIT = 4001 + SYS_FORK = 4002 + SYS_READ = 4003 + SYS_WRITE = 4004 + SYS_OPEN = 4005 + SYS_CLOSE = 4006 + SYS_WAITPID = 4007 + SYS_CREAT = 4008 + SYS_LINK = 4009 + SYS_UNLINK = 4010 + SYS_EXECVE = 4011 + SYS_CHDIR = 4012 + SYS_TIME = 4013 + SYS_MKNOD = 4014 + SYS_CHMOD = 4015 + SYS_LCHOWN = 4016 + SYS_BREAK = 4017 + SYS_UNUSED18 = 4018 + SYS_LSEEK = 4019 + SYS_GETPID = 4020 + SYS_MOUNT = 4021 + SYS_UMOUNT = 4022 + SYS_SETUID = 4023 + SYS_GETUID = 4024 + SYS_STIME = 4025 + SYS_PTRACE = 4026 + SYS_ALARM = 4027 + SYS_UNUSED28 = 4028 + SYS_PAUSE = 4029 + SYS_UTIME = 4030 + SYS_STTY = 4031 + SYS_GTTY = 4032 + SYS_ACCESS = 4033 + SYS_NICE = 4034 + SYS_FTIME = 4035 + SYS_SYNC = 4036 + SYS_KILL = 4037 + SYS_RENAME = 4038 + SYS_MKDIR = 4039 + SYS_RMDIR = 4040 + SYS_DUP = 4041 + SYS_PIPE = 4042 + SYS_TIMES = 4043 + SYS_PROF = 4044 + SYS_BRK = 4045 + SYS_SETGID = 4046 + SYS_GETGID = 4047 + SYS_SIGNAL = 4048 + SYS_GETEUID = 4049 + SYS_GETEGID = 4050 + SYS_ACCT = 4051 + SYS_UMOUNT2 = 4052 + SYS_LOCK = 4053 + SYS_IOCTL = 4054 + SYS_FCNTL = 4055 + SYS_MPX = 4056 + SYS_SETPGID = 4057 + SYS_ULIMIT = 4058 + SYS_UNUSED59 = 4059 + SYS_UMASK = 4060 + SYS_CHROOT = 4061 + SYS_USTAT = 4062 + SYS_DUP2 = 4063 + SYS_GETPPID = 4064 + SYS_GETPGRP = 4065 + SYS_SETSID = 4066 + SYS_SIGACTION = 4067 + SYS_SGETMASK = 4068 + SYS_SSETMASK = 4069 + SYS_SETREUID = 4070 + SYS_SETREGID = 4071 + SYS_SIGSUSPEND = 4072 + SYS_SIGPENDING = 4073 + SYS_SETHOSTNAME = 4074 + SYS_SETRLIMIT = 4075 + SYS_GETRLIMIT = 4076 + SYS_GETRUSAGE = 4077 + SYS_GETTIMEOFDAY = 4078 + SYS_SETTIMEOFDAY = 4079 + SYS_GETGROUPS = 4080 + SYS_SETGROUPS = 4081 + SYS_RESERVED82 = 4082 + SYS_SYMLINK = 4083 + SYS_UNUSED84 = 4084 + SYS_READLINK = 4085 + SYS_USELIB = 4086 + SYS_SWAPON = 4087 + SYS_REBOOT = 4088 + SYS_READDIR = 4089 + SYS_MMAP = 4090 + SYS_MUNMAP = 4091 + SYS_TRUNCATE = 4092 + SYS_FTRUNCATE = 4093 + SYS_FCHMOD = 4094 + SYS_FCHOWN = 4095 + SYS_GETPRIORITY = 4096 + SYS_SETPRIORITY = 4097 + SYS_PROFIL = 4098 + SYS_STATFS = 4099 + SYS_FSTATFS = 4100 + SYS_IOPERM = 4101 + SYS_SOCKETCALL = 4102 + SYS_SYSLOG = 4103 + SYS_SETITIMER = 4104 + SYS_GETITIMER = 4105 + SYS_STAT = 4106 + SYS_LSTAT = 4107 + SYS_FSTAT = 4108 + SYS_UNUSED109 = 4109 + SYS_IOPL = 4110 + SYS_VHANGUP = 4111 + SYS_IDLE = 4112 + SYS_VM86 = 4113 + SYS_WAIT4 = 4114 + SYS_SWAPOFF = 4115 + SYS_SYSINFO = 4116 + SYS_IPC = 4117 + SYS_FSYNC = 4118 + SYS_SIGRETURN = 4119 + SYS_CLONE = 4120 + SYS_SETDOMAINNAME = 4121 + SYS_UNAME = 4122 + SYS_MODIFY_LDT = 4123 + SYS_ADJTIMEX = 4124 + SYS_MPROTECT = 4125 + SYS_SIGPROCMASK = 4126 + SYS_CREATE_MODULE = 4127 + SYS_INIT_MODULE = 4128 + SYS_DELETE_MODULE = 4129 + SYS_GET_KERNEL_SYMS = 4130 + SYS_QUOTACTL = 4131 + SYS_GETPGID = 4132 + SYS_FCHDIR = 4133 + SYS_BDFLUSH = 4134 + SYS_SYSFS = 4135 + SYS_PERSONALITY = 4136 + SYS_AFS_SYSCALL = 4137 + SYS_SETFSUID = 4138 + SYS_SETFSGID = 4139 + SYS__LLSEEK = 4140 + SYS_GETDENTS = 4141 + SYS__NEWSELECT = 4142 + SYS_FLOCK = 4143 + SYS_MSYNC = 4144 + SYS_READV = 4145 + SYS_WRITEV = 4146 + SYS_CACHEFLUSH = 4147 + SYS_CACHECTL = 4148 + SYS_SYSMIPS = 4149 + SYS_UNUSED150 = 4150 + SYS_GETSID = 4151 + SYS_FDATASYNC = 4152 + SYS__SYSCTL = 4153 + SYS_MLOCK = 4154 + SYS_MUNLOCK = 4155 + SYS_MLOCKALL = 4156 + SYS_MUNLOCKALL = 4157 + SYS_SCHED_SETPARAM = 4158 + SYS_SCHED_GETPARAM = 4159 + SYS_SCHED_SETSCHEDULER = 4160 + SYS_SCHED_GETSCHEDULER = 4161 + SYS_SCHED_YIELD = 4162 + SYS_SCHED_GET_PRIORITY_MAX = 4163 + SYS_SCHED_GET_PRIORITY_MIN = 4164 + SYS_SCHED_RR_GET_INTERVAL = 4165 + SYS_NANOSLEEP = 4166 + SYS_MREMAP = 4167 + SYS_ACCEPT = 4168 + SYS_BIND = 4169 + SYS_CONNECT = 4170 + SYS_GETPEERNAME = 4171 + SYS_GETSOCKNAME = 4172 + SYS_GETSOCKOPT = 4173 + SYS_LISTEN = 4174 + SYS_RECV = 4175 + SYS_RECVFROM = 4176 + SYS_RECVMSG = 4177 + SYS_SEND = 4178 + SYS_SENDMSG = 4179 + SYS_SENDTO = 4180 + SYS_SETSOCKOPT = 4181 + SYS_SHUTDOWN = 4182 + SYS_SOCKET = 4183 + SYS_SOCKETPAIR = 4184 + SYS_SETRESUID = 4185 + SYS_GETRESUID = 4186 + SYS_QUERY_MODULE = 4187 + SYS_POLL = 4188 + SYS_NFSSERVCTL = 4189 + SYS_SETRESGID = 4190 + SYS_GETRESGID = 4191 + SYS_PRCTL = 4192 + SYS_RT_SIGRETURN = 4193 + SYS_RT_SIGACTION = 4194 + SYS_RT_SIGPROCMASK = 4195 + SYS_RT_SIGPENDING = 4196 + SYS_RT_SIGTIMEDWAIT = 4197 + SYS_RT_SIGQUEUEINFO = 4198 + SYS_RT_SIGSUSPEND = 4199 + SYS_PREAD64 = 4200 + SYS_PWRITE64 = 4201 + SYS_CHOWN = 4202 + SYS_GETCWD = 4203 + SYS_CAPGET = 4204 + SYS_CAPSET = 4205 + SYS_SIGALTSTACK = 4206 + SYS_SENDFILE = 4207 + SYS_GETPMSG = 4208 + SYS_PUTPMSG = 4209 + SYS_MMAP2 = 4210 + SYS_TRUNCATE64 = 4211 + SYS_FTRUNCATE64 = 4212 + SYS_STAT64 = 4213 + SYS_LSTAT64 = 4214 + SYS_FSTAT64 = 4215 + SYS_PIVOT_ROOT = 4216 + SYS_MINCORE = 4217 + SYS_MADVISE = 4218 + SYS_GETDENTS64 = 4219 + SYS_FCNTL64 = 4220 + SYS_RESERVED221 = 4221 + SYS_GETTID = 4222 + SYS_READAHEAD = 4223 + SYS_SETXATTR = 4224 + SYS_LSETXATTR = 4225 + SYS_FSETXATTR = 4226 + SYS_GETXATTR = 4227 + SYS_LGETXATTR = 4228 + SYS_FGETXATTR = 4229 + SYS_LISTXATTR = 4230 + SYS_LLISTXATTR = 4231 + SYS_FLISTXATTR = 4232 + SYS_REMOVEXATTR = 4233 + SYS_LREMOVEXATTR = 4234 + SYS_FREMOVEXATTR = 4235 + SYS_TKILL = 4236 + SYS_SENDFILE64 = 4237 + SYS_FUTEX = 4238 + SYS_SCHED_SETAFFINITY = 4239 + SYS_SCHED_GETAFFINITY = 4240 + SYS_IO_SETUP = 4241 + SYS_IO_DESTROY = 4242 + SYS_IO_GETEVENTS = 4243 + SYS_IO_SUBMIT = 4244 + SYS_IO_CANCEL = 4245 + SYS_EXIT_GROUP = 4246 + SYS_LOOKUP_DCOOKIE = 4247 + SYS_EPOLL_CREATE = 4248 + SYS_EPOLL_CTL = 4249 + SYS_EPOLL_WAIT = 4250 + SYS_REMAP_FILE_PAGES = 4251 + SYS_SET_TID_ADDRESS = 4252 + SYS_RESTART_SYSCALL = 4253 + SYS_FADVISE64 = 4254 + SYS_STATFS64 = 4255 + SYS_FSTATFS64 = 4256 + SYS_TIMER_CREATE = 4257 + SYS_TIMER_SETTIME = 4258 + SYS_TIMER_GETTIME = 4259 + SYS_TIMER_GETOVERRUN = 4260 + SYS_TIMER_DELETE = 4261 + SYS_CLOCK_SETTIME = 4262 + SYS_CLOCK_GETTIME = 4263 + SYS_CLOCK_GETRES = 4264 + SYS_CLOCK_NANOSLEEP = 4265 + SYS_TGKILL = 4266 + SYS_UTIMES = 4267 + SYS_MBIND = 4268 + SYS_GET_MEMPOLICY = 4269 + SYS_SET_MEMPOLICY = 4270 + SYS_MQ_OPEN = 4271 + SYS_MQ_UNLINK = 4272 + SYS_MQ_TIMEDSEND = 4273 + SYS_MQ_TIMEDRECEIVE = 4274 + SYS_MQ_NOTIFY = 4275 + SYS_MQ_GETSETATTR = 4276 + SYS_VSERVER = 4277 + SYS_WAITID = 4278 + SYS_ADD_KEY = 4280 + SYS_REQUEST_KEY = 4281 + SYS_KEYCTL = 4282 + SYS_SET_THREAD_AREA = 4283 + SYS_INOTIFY_INIT = 4284 + SYS_INOTIFY_ADD_WATCH = 4285 + SYS_INOTIFY_RM_WATCH = 4286 + SYS_MIGRATE_PAGES = 4287 + SYS_OPENAT = 4288 + SYS_MKDIRAT = 4289 + SYS_MKNODAT = 4290 + SYS_FCHOWNAT = 4291 + SYS_FUTIMESAT = 4292 + SYS_FSTATAT64 = 4293 + SYS_UNLINKAT = 4294 + SYS_RENAMEAT = 4295 + SYS_LINKAT = 4296 + SYS_SYMLINKAT = 4297 + SYS_READLINKAT = 4298 + SYS_FCHMODAT = 4299 + SYS_FACCESSAT = 4300 + SYS_PSELECT6 = 4301 + SYS_PPOLL = 4302 + SYS_UNSHARE = 4303 + SYS_SPLICE = 4304 + SYS_SYNC_FILE_RANGE = 4305 + SYS_TEE = 4306 + SYS_VMSPLICE = 4307 + SYS_MOVE_PAGES = 4308 + SYS_SET_ROBUST_LIST = 4309 + SYS_GET_ROBUST_LIST = 4310 + SYS_KEXEC_LOAD = 4311 + SYS_GETCPU = 4312 + SYS_EPOLL_PWAIT = 4313 + SYS_IOPRIO_SET = 4314 + SYS_IOPRIO_GET = 4315 + SYS_UTIMENSAT = 4316 + SYS_SIGNALFD = 4317 + SYS_TIMERFD = 4318 + SYS_EVENTFD = 4319 + SYS_FALLOCATE = 4320 + SYS_TIMERFD_CREATE = 4321 + SYS_TIMERFD_GETTIME = 4322 + SYS_TIMERFD_SETTIME = 4323 + SYS_SIGNALFD4 = 4324 + SYS_EVENTFD2 = 4325 + SYS_EPOLL_CREATE1 = 4326 + SYS_DUP3 = 4327 + SYS_PIPE2 = 4328 + SYS_INOTIFY_INIT1 = 4329 + SYS_PREADV = 4330 + SYS_PWRITEV = 4331 + SYS_RT_TGSIGQUEUEINFO = 4332 + SYS_PERF_EVENT_OPEN = 4333 + SYS_ACCEPT4 = 4334 + SYS_RECVMMSG = 4335 + SYS_FANOTIFY_INIT = 4336 + SYS_FANOTIFY_MARK = 4337 + SYS_PRLIMIT64 = 4338 + SYS_NAME_TO_HANDLE_AT = 4339 + SYS_OPEN_BY_HANDLE_AT = 4340 + SYS_CLOCK_ADJTIME = 4341 + SYS_SYNCFS = 4342 + SYS_SENDMMSG = 4343 + SYS_SETNS = 4344 + SYS_PROCESS_VM_READV = 4345 + SYS_PROCESS_VM_WRITEV = 4346 + SYS_KCMP = 4347 + SYS_FINIT_MODULE = 4348 + SYS_SCHED_SETATTR = 4349 + SYS_SCHED_GETATTR = 4350 + SYS_RENAMEAT2 = 4351 + SYS_SECCOMP = 4352 + SYS_GETRANDOM = 4353 + SYS_MEMFD_CREATE = 4354 + SYS_BPF = 4355 + SYS_EXECVEAT = 4356 + SYS_USERFAULTFD = 4357 + SYS_MEMBARRIER = 4358 + SYS_MLOCK2 = 4359 + SYS_COPY_FILE_RANGE = 4360 + SYS_PREADV2 = 4361 + SYS_PWRITEV2 = 4362 + SYS_PKEY_MPROTECT = 4363 + SYS_PKEY_ALLOC = 4364 + SYS_PKEY_FREE = 4365 + SYS_STATX = 4366 + SYS_RSEQ = 4367 + SYS_IO_PGETEVENTS = 4368 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 57ec82aa..1270a1c9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build mips64,linux @@ -334,8 +334,4 @@ const ( SYS_STATX = 5326 SYS_RSEQ = 5327 SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 825a3e3b..93980be1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build mips64le,linux @@ -334,8 +334,4 @@ const ( SYS_STATX = 5326 SYS_RSEQ = 5327 SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index f152dfdd..0fc77261 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build mipsle,linux @@ -6,406 +6,372 @@ package unix const ( - SYS_SYSCALL = 4000 - SYS_EXIT = 4001 - SYS_FORK = 4002 - SYS_READ = 4003 - SYS_WRITE = 4004 - SYS_OPEN = 4005 - SYS_CLOSE = 4006 - SYS_WAITPID = 4007 - SYS_CREAT = 4008 - SYS_LINK = 4009 - SYS_UNLINK = 4010 - SYS_EXECVE = 4011 - SYS_CHDIR = 4012 - SYS_TIME = 4013 - SYS_MKNOD = 4014 - SYS_CHMOD = 4015 - SYS_LCHOWN = 4016 - SYS_BREAK = 4017 - SYS_UNUSED18 = 4018 - SYS_LSEEK = 4019 - SYS_GETPID = 4020 - SYS_MOUNT = 4021 - SYS_UMOUNT = 4022 - SYS_SETUID = 4023 - SYS_GETUID = 4024 - SYS_STIME = 4025 - SYS_PTRACE = 4026 - SYS_ALARM = 4027 - SYS_UNUSED28 = 4028 - SYS_PAUSE = 4029 - SYS_UTIME = 4030 - SYS_STTY = 4031 - SYS_GTTY = 4032 - SYS_ACCESS = 4033 - SYS_NICE = 4034 - SYS_FTIME = 4035 - SYS_SYNC = 4036 - SYS_KILL = 4037 - SYS_RENAME = 4038 - SYS_MKDIR = 4039 - SYS_RMDIR = 4040 - SYS_DUP = 4041 - SYS_PIPE = 4042 - SYS_TIMES = 4043 - SYS_PROF = 4044 - SYS_BRK = 4045 - SYS_SETGID = 4046 - SYS_GETGID = 4047 - SYS_SIGNAL = 4048 - SYS_GETEUID = 4049 - SYS_GETEGID = 4050 - SYS_ACCT = 4051 - SYS_UMOUNT2 = 4052 - SYS_LOCK = 4053 - SYS_IOCTL = 4054 - SYS_FCNTL = 4055 - SYS_MPX = 4056 - SYS_SETPGID = 4057 - SYS_ULIMIT = 4058 - SYS_UNUSED59 = 4059 - SYS_UMASK = 4060 - SYS_CHROOT = 4061 - SYS_USTAT = 4062 - SYS_DUP2 = 4063 - SYS_GETPPID = 4064 - SYS_GETPGRP = 4065 - SYS_SETSID = 4066 - SYS_SIGACTION = 4067 - SYS_SGETMASK = 4068 - SYS_SSETMASK = 4069 - SYS_SETREUID = 4070 - SYS_SETREGID = 4071 - SYS_SIGSUSPEND = 4072 - SYS_SIGPENDING = 4073 - SYS_SETHOSTNAME = 4074 - SYS_SETRLIMIT = 4075 - SYS_GETRLIMIT = 4076 - SYS_GETRUSAGE = 4077 - SYS_GETTIMEOFDAY = 4078 - SYS_SETTIMEOFDAY = 4079 - SYS_GETGROUPS = 4080 - SYS_SETGROUPS = 4081 - SYS_RESERVED82 = 4082 - SYS_SYMLINK = 4083 - SYS_UNUSED84 = 4084 - SYS_READLINK = 4085 - SYS_USELIB = 4086 - SYS_SWAPON = 4087 - SYS_REBOOT = 4088 - SYS_READDIR = 4089 - SYS_MMAP = 4090 - SYS_MUNMAP = 4091 - SYS_TRUNCATE = 4092 - SYS_FTRUNCATE = 4093 - SYS_FCHMOD = 4094 - SYS_FCHOWN = 4095 - SYS_GETPRIORITY = 4096 - SYS_SETPRIORITY = 4097 - SYS_PROFIL = 4098 - SYS_STATFS = 4099 - SYS_FSTATFS = 4100 - SYS_IOPERM = 4101 - SYS_SOCKETCALL = 4102 - SYS_SYSLOG = 4103 - SYS_SETITIMER = 4104 - SYS_GETITIMER = 4105 - SYS_STAT = 4106 - SYS_LSTAT = 4107 - SYS_FSTAT = 4108 - SYS_UNUSED109 = 4109 - SYS_IOPL = 4110 - SYS_VHANGUP = 4111 - SYS_IDLE = 4112 - SYS_VM86 = 4113 - SYS_WAIT4 = 4114 - SYS_SWAPOFF = 4115 - SYS_SYSINFO = 4116 - SYS_IPC = 4117 - SYS_FSYNC = 4118 - SYS_SIGRETURN = 4119 - SYS_CLONE = 4120 - SYS_SETDOMAINNAME = 4121 - SYS_UNAME = 4122 - SYS_MODIFY_LDT = 4123 - SYS_ADJTIMEX = 4124 - SYS_MPROTECT = 4125 - SYS_SIGPROCMASK = 4126 - SYS_CREATE_MODULE = 4127 - SYS_INIT_MODULE = 4128 - SYS_DELETE_MODULE = 4129 - SYS_GET_KERNEL_SYMS = 4130 - SYS_QUOTACTL = 4131 - SYS_GETPGID = 4132 - SYS_FCHDIR = 4133 - SYS_BDFLUSH = 4134 - SYS_SYSFS = 4135 - SYS_PERSONALITY = 4136 - SYS_AFS_SYSCALL = 4137 - SYS_SETFSUID = 4138 - SYS_SETFSGID = 4139 - SYS__LLSEEK = 4140 - SYS_GETDENTS = 4141 - SYS__NEWSELECT = 4142 - SYS_FLOCK = 4143 - SYS_MSYNC = 4144 - SYS_READV = 4145 - SYS_WRITEV = 4146 - SYS_CACHEFLUSH = 4147 - SYS_CACHECTL = 4148 - SYS_SYSMIPS = 4149 - SYS_UNUSED150 = 4150 - SYS_GETSID = 4151 - SYS_FDATASYNC = 4152 - SYS__SYSCTL = 4153 - SYS_MLOCK = 4154 - SYS_MUNLOCK = 4155 - SYS_MLOCKALL = 4156 - SYS_MUNLOCKALL = 4157 - SYS_SCHED_SETPARAM = 4158 - SYS_SCHED_GETPARAM = 4159 - SYS_SCHED_SETSCHEDULER = 4160 - SYS_SCHED_GETSCHEDULER = 4161 - SYS_SCHED_YIELD = 4162 - SYS_SCHED_GET_PRIORITY_MAX = 4163 - SYS_SCHED_GET_PRIORITY_MIN = 4164 - SYS_SCHED_RR_GET_INTERVAL = 4165 - SYS_NANOSLEEP = 4166 - SYS_MREMAP = 4167 - SYS_ACCEPT = 4168 - SYS_BIND = 4169 - SYS_CONNECT = 4170 - SYS_GETPEERNAME = 4171 - SYS_GETSOCKNAME = 4172 - SYS_GETSOCKOPT = 4173 - SYS_LISTEN = 4174 - SYS_RECV = 4175 - SYS_RECVFROM = 4176 - SYS_RECVMSG = 4177 - SYS_SEND = 4178 - SYS_SENDMSG = 4179 - SYS_SENDTO = 4180 - SYS_SETSOCKOPT = 4181 - SYS_SHUTDOWN = 4182 - SYS_SOCKET = 4183 - SYS_SOCKETPAIR = 4184 - SYS_SETRESUID = 4185 - SYS_GETRESUID = 4186 - SYS_QUERY_MODULE = 4187 - SYS_POLL = 4188 - SYS_NFSSERVCTL = 4189 - SYS_SETRESGID = 4190 - SYS_GETRESGID = 4191 - SYS_PRCTL = 4192 - SYS_RT_SIGRETURN = 4193 - SYS_RT_SIGACTION = 4194 - SYS_RT_SIGPROCMASK = 4195 - SYS_RT_SIGPENDING = 4196 - SYS_RT_SIGTIMEDWAIT = 4197 - SYS_RT_SIGQUEUEINFO = 4198 - SYS_RT_SIGSUSPEND = 4199 - SYS_PREAD64 = 4200 - SYS_PWRITE64 = 4201 - SYS_CHOWN = 4202 - SYS_GETCWD = 4203 - SYS_CAPGET = 4204 - SYS_CAPSET = 4205 - SYS_SIGALTSTACK = 4206 - SYS_SENDFILE = 4207 - SYS_GETPMSG = 4208 - SYS_PUTPMSG = 4209 - SYS_MMAP2 = 4210 - SYS_TRUNCATE64 = 4211 - SYS_FTRUNCATE64 = 4212 - SYS_STAT64 = 4213 - SYS_LSTAT64 = 4214 - SYS_FSTAT64 = 4215 - SYS_PIVOT_ROOT = 4216 - SYS_MINCORE = 4217 - SYS_MADVISE = 4218 - SYS_GETDENTS64 = 4219 - SYS_FCNTL64 = 4220 - SYS_RESERVED221 = 4221 - SYS_GETTID = 4222 - SYS_READAHEAD = 4223 - SYS_SETXATTR = 4224 - SYS_LSETXATTR = 4225 - SYS_FSETXATTR = 4226 - SYS_GETXATTR = 4227 - SYS_LGETXATTR = 4228 - SYS_FGETXATTR = 4229 - SYS_LISTXATTR = 4230 - SYS_LLISTXATTR = 4231 - SYS_FLISTXATTR = 4232 - SYS_REMOVEXATTR = 4233 - SYS_LREMOVEXATTR = 4234 - SYS_FREMOVEXATTR = 4235 - SYS_TKILL = 4236 - SYS_SENDFILE64 = 4237 - SYS_FUTEX = 4238 - SYS_SCHED_SETAFFINITY = 4239 - SYS_SCHED_GETAFFINITY = 4240 - SYS_IO_SETUP = 4241 - SYS_IO_DESTROY = 4242 - SYS_IO_GETEVENTS = 4243 - SYS_IO_SUBMIT = 4244 - SYS_IO_CANCEL = 4245 - SYS_EXIT_GROUP = 4246 - SYS_LOOKUP_DCOOKIE = 4247 - SYS_EPOLL_CREATE = 4248 - SYS_EPOLL_CTL = 4249 - SYS_EPOLL_WAIT = 4250 - SYS_REMAP_FILE_PAGES = 4251 - SYS_SET_TID_ADDRESS = 4252 - SYS_RESTART_SYSCALL = 4253 - SYS_FADVISE64 = 4254 - SYS_STATFS64 = 4255 - SYS_FSTATFS64 = 4256 - SYS_TIMER_CREATE = 4257 - SYS_TIMER_SETTIME = 4258 - SYS_TIMER_GETTIME = 4259 - SYS_TIMER_GETOVERRUN = 4260 - SYS_TIMER_DELETE = 4261 - SYS_CLOCK_SETTIME = 4262 - SYS_CLOCK_GETTIME = 4263 - SYS_CLOCK_GETRES = 4264 - SYS_CLOCK_NANOSLEEP = 4265 - SYS_TGKILL = 4266 - SYS_UTIMES = 4267 - SYS_MBIND = 4268 - SYS_GET_MEMPOLICY = 4269 - SYS_SET_MEMPOLICY = 4270 - SYS_MQ_OPEN = 4271 - SYS_MQ_UNLINK = 4272 - SYS_MQ_TIMEDSEND = 4273 - SYS_MQ_TIMEDRECEIVE = 4274 - SYS_MQ_NOTIFY = 4275 - SYS_MQ_GETSETATTR = 4276 - SYS_VSERVER = 4277 - SYS_WAITID = 4278 - SYS_ADD_KEY = 4280 - SYS_REQUEST_KEY = 4281 - SYS_KEYCTL = 4282 - SYS_SET_THREAD_AREA = 4283 - SYS_INOTIFY_INIT = 4284 - SYS_INOTIFY_ADD_WATCH = 4285 - SYS_INOTIFY_RM_WATCH = 4286 - SYS_MIGRATE_PAGES = 4287 - SYS_OPENAT = 4288 - SYS_MKDIRAT = 4289 - SYS_MKNODAT = 4290 - SYS_FCHOWNAT = 4291 - SYS_FUTIMESAT = 4292 - SYS_FSTATAT64 = 4293 - SYS_UNLINKAT = 4294 - SYS_RENAMEAT = 4295 - SYS_LINKAT = 4296 - SYS_SYMLINKAT = 4297 - SYS_READLINKAT = 4298 - SYS_FCHMODAT = 4299 - SYS_FACCESSAT = 4300 - SYS_PSELECT6 = 4301 - SYS_PPOLL = 4302 - SYS_UNSHARE = 4303 - SYS_SPLICE = 4304 - SYS_SYNC_FILE_RANGE = 4305 - SYS_TEE = 4306 - SYS_VMSPLICE = 4307 - SYS_MOVE_PAGES = 4308 - SYS_SET_ROBUST_LIST = 4309 - SYS_GET_ROBUST_LIST = 4310 - SYS_KEXEC_LOAD = 4311 - SYS_GETCPU = 4312 - SYS_EPOLL_PWAIT = 4313 - SYS_IOPRIO_SET = 4314 - SYS_IOPRIO_GET = 4315 - SYS_UTIMENSAT = 4316 - SYS_SIGNALFD = 4317 - SYS_TIMERFD = 4318 - SYS_EVENTFD = 4319 - SYS_FALLOCATE = 4320 - SYS_TIMERFD_CREATE = 4321 - SYS_TIMERFD_GETTIME = 4322 - SYS_TIMERFD_SETTIME = 4323 - SYS_SIGNALFD4 = 4324 - SYS_EVENTFD2 = 4325 - SYS_EPOLL_CREATE1 = 4326 - SYS_DUP3 = 4327 - SYS_PIPE2 = 4328 - SYS_INOTIFY_INIT1 = 4329 - SYS_PREADV = 4330 - SYS_PWRITEV = 4331 - SYS_RT_TGSIGQUEUEINFO = 4332 - SYS_PERF_EVENT_OPEN = 4333 - SYS_ACCEPT4 = 4334 - SYS_RECVMMSG = 4335 - SYS_FANOTIFY_INIT = 4336 - SYS_FANOTIFY_MARK = 4337 - SYS_PRLIMIT64 = 4338 - SYS_NAME_TO_HANDLE_AT = 4339 - SYS_OPEN_BY_HANDLE_AT = 4340 - SYS_CLOCK_ADJTIME = 4341 - SYS_SYNCFS = 4342 - SYS_SENDMMSG = 4343 - SYS_SETNS = 4344 - SYS_PROCESS_VM_READV = 4345 - SYS_PROCESS_VM_WRITEV = 4346 - SYS_KCMP = 4347 - SYS_FINIT_MODULE = 4348 - SYS_SCHED_SETATTR = 4349 - SYS_SCHED_GETATTR = 4350 - SYS_RENAMEAT2 = 4351 - SYS_SECCOMP = 4352 - SYS_GETRANDOM = 4353 - SYS_MEMFD_CREATE = 4354 - SYS_BPF = 4355 - SYS_EXECVEAT = 4356 - SYS_USERFAULTFD = 4357 - SYS_MEMBARRIER = 4358 - SYS_MLOCK2 = 4359 - SYS_COPY_FILE_RANGE = 4360 - SYS_PREADV2 = 4361 - SYS_PWRITEV2 = 4362 - SYS_PKEY_MPROTECT = 4363 - SYS_PKEY_ALLOC = 4364 - SYS_PKEY_FREE = 4365 - SYS_STATX = 4366 - SYS_RSEQ = 4367 - SYS_IO_PGETEVENTS = 4368 - SYS_SEMGET = 4393 - SYS_SEMCTL = 4394 - SYS_SHMGET = 4395 - SYS_SHMCTL = 4396 - SYS_SHMAT = 4397 - SYS_SHMDT = 4398 - SYS_MSGGET = 4399 - SYS_MSGSND = 4400 - SYS_MSGRCV = 4401 - SYS_MSGCTL = 4402 - SYS_CLOCK_GETTIME64 = 4403 - SYS_CLOCK_SETTIME64 = 4404 - SYS_CLOCK_ADJTIME64 = 4405 - SYS_CLOCK_GETRES_TIME64 = 4406 - SYS_CLOCK_NANOSLEEP_TIME64 = 4407 - SYS_TIMER_GETTIME64 = 4408 - SYS_TIMER_SETTIME64 = 4409 - SYS_TIMERFD_GETTIME64 = 4410 - SYS_TIMERFD_SETTIME64 = 4411 - SYS_UTIMENSAT_TIME64 = 4412 - SYS_PSELECT6_TIME64 = 4413 - SYS_PPOLL_TIME64 = 4414 - SYS_IO_PGETEVENTS_TIME64 = 4416 - SYS_RECVMMSG_TIME64 = 4417 - SYS_MQ_TIMEDSEND_TIME64 = 4418 - SYS_MQ_TIMEDRECEIVE_TIME64 = 4419 - SYS_SEMTIMEDOP_TIME64 = 4420 - SYS_RT_SIGTIMEDWAIT_TIME64 = 4421 - SYS_FUTEX_TIME64 = 4422 - SYS_SCHED_RR_GET_INTERVAL_TIME64 = 4423 - SYS_PIDFD_SEND_SIGNAL = 4424 - SYS_IO_URING_SETUP = 4425 - SYS_IO_URING_ENTER = 4426 - SYS_IO_URING_REGISTER = 4427 + SYS_SYSCALL = 4000 + SYS_EXIT = 4001 + SYS_FORK = 4002 + SYS_READ = 4003 + SYS_WRITE = 4004 + SYS_OPEN = 4005 + SYS_CLOSE = 4006 + SYS_WAITPID = 4007 + SYS_CREAT = 4008 + SYS_LINK = 4009 + SYS_UNLINK = 4010 + SYS_EXECVE = 4011 + SYS_CHDIR = 4012 + SYS_TIME = 4013 + SYS_MKNOD = 4014 + SYS_CHMOD = 4015 + SYS_LCHOWN = 4016 + SYS_BREAK = 4017 + SYS_UNUSED18 = 4018 + SYS_LSEEK = 4019 + SYS_GETPID = 4020 + SYS_MOUNT = 4021 + SYS_UMOUNT = 4022 + SYS_SETUID = 4023 + SYS_GETUID = 4024 + SYS_STIME = 4025 + SYS_PTRACE = 4026 + SYS_ALARM = 4027 + SYS_UNUSED28 = 4028 + SYS_PAUSE = 4029 + SYS_UTIME = 4030 + SYS_STTY = 4031 + SYS_GTTY = 4032 + SYS_ACCESS = 4033 + SYS_NICE = 4034 + SYS_FTIME = 4035 + SYS_SYNC = 4036 + SYS_KILL = 4037 + SYS_RENAME = 4038 + SYS_MKDIR = 4039 + SYS_RMDIR = 4040 + SYS_DUP = 4041 + SYS_PIPE = 4042 + SYS_TIMES = 4043 + SYS_PROF = 4044 + SYS_BRK = 4045 + SYS_SETGID = 4046 + SYS_GETGID = 4047 + SYS_SIGNAL = 4048 + SYS_GETEUID = 4049 + SYS_GETEGID = 4050 + SYS_ACCT = 4051 + SYS_UMOUNT2 = 4052 + SYS_LOCK = 4053 + SYS_IOCTL = 4054 + SYS_FCNTL = 4055 + SYS_MPX = 4056 + SYS_SETPGID = 4057 + SYS_ULIMIT = 4058 + SYS_UNUSED59 = 4059 + SYS_UMASK = 4060 + SYS_CHROOT = 4061 + SYS_USTAT = 4062 + SYS_DUP2 = 4063 + SYS_GETPPID = 4064 + SYS_GETPGRP = 4065 + SYS_SETSID = 4066 + SYS_SIGACTION = 4067 + SYS_SGETMASK = 4068 + SYS_SSETMASK = 4069 + SYS_SETREUID = 4070 + SYS_SETREGID = 4071 + SYS_SIGSUSPEND = 4072 + SYS_SIGPENDING = 4073 + SYS_SETHOSTNAME = 4074 + SYS_SETRLIMIT = 4075 + SYS_GETRLIMIT = 4076 + SYS_GETRUSAGE = 4077 + SYS_GETTIMEOFDAY = 4078 + SYS_SETTIMEOFDAY = 4079 + SYS_GETGROUPS = 4080 + SYS_SETGROUPS = 4081 + SYS_RESERVED82 = 4082 + SYS_SYMLINK = 4083 + SYS_UNUSED84 = 4084 + SYS_READLINK = 4085 + SYS_USELIB = 4086 + SYS_SWAPON = 4087 + SYS_REBOOT = 4088 + SYS_READDIR = 4089 + SYS_MMAP = 4090 + SYS_MUNMAP = 4091 + SYS_TRUNCATE = 4092 + SYS_FTRUNCATE = 4093 + SYS_FCHMOD = 4094 + SYS_FCHOWN = 4095 + SYS_GETPRIORITY = 4096 + SYS_SETPRIORITY = 4097 + SYS_PROFIL = 4098 + SYS_STATFS = 4099 + SYS_FSTATFS = 4100 + SYS_IOPERM = 4101 + SYS_SOCKETCALL = 4102 + SYS_SYSLOG = 4103 + SYS_SETITIMER = 4104 + SYS_GETITIMER = 4105 + SYS_STAT = 4106 + SYS_LSTAT = 4107 + SYS_FSTAT = 4108 + SYS_UNUSED109 = 4109 + SYS_IOPL = 4110 + SYS_VHANGUP = 4111 + SYS_IDLE = 4112 + SYS_VM86 = 4113 + SYS_WAIT4 = 4114 + SYS_SWAPOFF = 4115 + SYS_SYSINFO = 4116 + SYS_IPC = 4117 + SYS_FSYNC = 4118 + SYS_SIGRETURN = 4119 + SYS_CLONE = 4120 + SYS_SETDOMAINNAME = 4121 + SYS_UNAME = 4122 + SYS_MODIFY_LDT = 4123 + SYS_ADJTIMEX = 4124 + SYS_MPROTECT = 4125 + SYS_SIGPROCMASK = 4126 + SYS_CREATE_MODULE = 4127 + SYS_INIT_MODULE = 4128 + SYS_DELETE_MODULE = 4129 + SYS_GET_KERNEL_SYMS = 4130 + SYS_QUOTACTL = 4131 + SYS_GETPGID = 4132 + SYS_FCHDIR = 4133 + SYS_BDFLUSH = 4134 + SYS_SYSFS = 4135 + SYS_PERSONALITY = 4136 + SYS_AFS_SYSCALL = 4137 + SYS_SETFSUID = 4138 + SYS_SETFSGID = 4139 + SYS__LLSEEK = 4140 + SYS_GETDENTS = 4141 + SYS__NEWSELECT = 4142 + SYS_FLOCK = 4143 + SYS_MSYNC = 4144 + SYS_READV = 4145 + SYS_WRITEV = 4146 + SYS_CACHEFLUSH = 4147 + SYS_CACHECTL = 4148 + SYS_SYSMIPS = 4149 + SYS_UNUSED150 = 4150 + SYS_GETSID = 4151 + SYS_FDATASYNC = 4152 + SYS__SYSCTL = 4153 + SYS_MLOCK = 4154 + SYS_MUNLOCK = 4155 + SYS_MLOCKALL = 4156 + SYS_MUNLOCKALL = 4157 + SYS_SCHED_SETPARAM = 4158 + SYS_SCHED_GETPARAM = 4159 + SYS_SCHED_SETSCHEDULER = 4160 + SYS_SCHED_GETSCHEDULER = 4161 + SYS_SCHED_YIELD = 4162 + SYS_SCHED_GET_PRIORITY_MAX = 4163 + SYS_SCHED_GET_PRIORITY_MIN = 4164 + SYS_SCHED_RR_GET_INTERVAL = 4165 + SYS_NANOSLEEP = 4166 + SYS_MREMAP = 4167 + SYS_ACCEPT = 4168 + SYS_BIND = 4169 + SYS_CONNECT = 4170 + SYS_GETPEERNAME = 4171 + SYS_GETSOCKNAME = 4172 + SYS_GETSOCKOPT = 4173 + SYS_LISTEN = 4174 + SYS_RECV = 4175 + SYS_RECVFROM = 4176 + SYS_RECVMSG = 4177 + SYS_SEND = 4178 + SYS_SENDMSG = 4179 + SYS_SENDTO = 4180 + SYS_SETSOCKOPT = 4181 + SYS_SHUTDOWN = 4182 + SYS_SOCKET = 4183 + SYS_SOCKETPAIR = 4184 + SYS_SETRESUID = 4185 + SYS_GETRESUID = 4186 + SYS_QUERY_MODULE = 4187 + SYS_POLL = 4188 + SYS_NFSSERVCTL = 4189 + SYS_SETRESGID = 4190 + SYS_GETRESGID = 4191 + SYS_PRCTL = 4192 + SYS_RT_SIGRETURN = 4193 + SYS_RT_SIGACTION = 4194 + SYS_RT_SIGPROCMASK = 4195 + SYS_RT_SIGPENDING = 4196 + SYS_RT_SIGTIMEDWAIT = 4197 + SYS_RT_SIGQUEUEINFO = 4198 + SYS_RT_SIGSUSPEND = 4199 + SYS_PREAD64 = 4200 + SYS_PWRITE64 = 4201 + SYS_CHOWN = 4202 + SYS_GETCWD = 4203 + SYS_CAPGET = 4204 + SYS_CAPSET = 4205 + SYS_SIGALTSTACK = 4206 + SYS_SENDFILE = 4207 + SYS_GETPMSG = 4208 + SYS_PUTPMSG = 4209 + SYS_MMAP2 = 4210 + SYS_TRUNCATE64 = 4211 + SYS_FTRUNCATE64 = 4212 + SYS_STAT64 = 4213 + SYS_LSTAT64 = 4214 + SYS_FSTAT64 = 4215 + SYS_PIVOT_ROOT = 4216 + SYS_MINCORE = 4217 + SYS_MADVISE = 4218 + SYS_GETDENTS64 = 4219 + SYS_FCNTL64 = 4220 + SYS_RESERVED221 = 4221 + SYS_GETTID = 4222 + SYS_READAHEAD = 4223 + SYS_SETXATTR = 4224 + SYS_LSETXATTR = 4225 + SYS_FSETXATTR = 4226 + SYS_GETXATTR = 4227 + SYS_LGETXATTR = 4228 + SYS_FGETXATTR = 4229 + SYS_LISTXATTR = 4230 + SYS_LLISTXATTR = 4231 + SYS_FLISTXATTR = 4232 + SYS_REMOVEXATTR = 4233 + SYS_LREMOVEXATTR = 4234 + SYS_FREMOVEXATTR = 4235 + SYS_TKILL = 4236 + SYS_SENDFILE64 = 4237 + SYS_FUTEX = 4238 + SYS_SCHED_SETAFFINITY = 4239 + SYS_SCHED_GETAFFINITY = 4240 + SYS_IO_SETUP = 4241 + SYS_IO_DESTROY = 4242 + SYS_IO_GETEVENTS = 4243 + SYS_IO_SUBMIT = 4244 + SYS_IO_CANCEL = 4245 + SYS_EXIT_GROUP = 4246 + SYS_LOOKUP_DCOOKIE = 4247 + SYS_EPOLL_CREATE = 4248 + SYS_EPOLL_CTL = 4249 + SYS_EPOLL_WAIT = 4250 + SYS_REMAP_FILE_PAGES = 4251 + SYS_SET_TID_ADDRESS = 4252 + SYS_RESTART_SYSCALL = 4253 + SYS_FADVISE64 = 4254 + SYS_STATFS64 = 4255 + SYS_FSTATFS64 = 4256 + SYS_TIMER_CREATE = 4257 + SYS_TIMER_SETTIME = 4258 + SYS_TIMER_GETTIME = 4259 + SYS_TIMER_GETOVERRUN = 4260 + SYS_TIMER_DELETE = 4261 + SYS_CLOCK_SETTIME = 4262 + SYS_CLOCK_GETTIME = 4263 + SYS_CLOCK_GETRES = 4264 + SYS_CLOCK_NANOSLEEP = 4265 + SYS_TGKILL = 4266 + SYS_UTIMES = 4267 + SYS_MBIND = 4268 + SYS_GET_MEMPOLICY = 4269 + SYS_SET_MEMPOLICY = 4270 + SYS_MQ_OPEN = 4271 + SYS_MQ_UNLINK = 4272 + SYS_MQ_TIMEDSEND = 4273 + SYS_MQ_TIMEDRECEIVE = 4274 + SYS_MQ_NOTIFY = 4275 + SYS_MQ_GETSETATTR = 4276 + SYS_VSERVER = 4277 + SYS_WAITID = 4278 + SYS_ADD_KEY = 4280 + SYS_REQUEST_KEY = 4281 + SYS_KEYCTL = 4282 + SYS_SET_THREAD_AREA = 4283 + SYS_INOTIFY_INIT = 4284 + SYS_INOTIFY_ADD_WATCH = 4285 + SYS_INOTIFY_RM_WATCH = 4286 + SYS_MIGRATE_PAGES = 4287 + SYS_OPENAT = 4288 + SYS_MKDIRAT = 4289 + SYS_MKNODAT = 4290 + SYS_FCHOWNAT = 4291 + SYS_FUTIMESAT = 4292 + SYS_FSTATAT64 = 4293 + SYS_UNLINKAT = 4294 + SYS_RENAMEAT = 4295 + SYS_LINKAT = 4296 + SYS_SYMLINKAT = 4297 + SYS_READLINKAT = 4298 + SYS_FCHMODAT = 4299 + SYS_FACCESSAT = 4300 + SYS_PSELECT6 = 4301 + SYS_PPOLL = 4302 + SYS_UNSHARE = 4303 + SYS_SPLICE = 4304 + SYS_SYNC_FILE_RANGE = 4305 + SYS_TEE = 4306 + SYS_VMSPLICE = 4307 + SYS_MOVE_PAGES = 4308 + SYS_SET_ROBUST_LIST = 4309 + SYS_GET_ROBUST_LIST = 4310 + SYS_KEXEC_LOAD = 4311 + SYS_GETCPU = 4312 + SYS_EPOLL_PWAIT = 4313 + SYS_IOPRIO_SET = 4314 + SYS_IOPRIO_GET = 4315 + SYS_UTIMENSAT = 4316 + SYS_SIGNALFD = 4317 + SYS_TIMERFD = 4318 + SYS_EVENTFD = 4319 + SYS_FALLOCATE = 4320 + SYS_TIMERFD_CREATE = 4321 + SYS_TIMERFD_GETTIME = 4322 + SYS_TIMERFD_SETTIME = 4323 + SYS_SIGNALFD4 = 4324 + SYS_EVENTFD2 = 4325 + SYS_EPOLL_CREATE1 = 4326 + SYS_DUP3 = 4327 + SYS_PIPE2 = 4328 + SYS_INOTIFY_INIT1 = 4329 + SYS_PREADV = 4330 + SYS_PWRITEV = 4331 + SYS_RT_TGSIGQUEUEINFO = 4332 + SYS_PERF_EVENT_OPEN = 4333 + SYS_ACCEPT4 = 4334 + SYS_RECVMMSG = 4335 + SYS_FANOTIFY_INIT = 4336 + SYS_FANOTIFY_MARK = 4337 + SYS_PRLIMIT64 = 4338 + SYS_NAME_TO_HANDLE_AT = 4339 + SYS_OPEN_BY_HANDLE_AT = 4340 + SYS_CLOCK_ADJTIME = 4341 + SYS_SYNCFS = 4342 + SYS_SENDMMSG = 4343 + SYS_SETNS = 4344 + SYS_PROCESS_VM_READV = 4345 + SYS_PROCESS_VM_WRITEV = 4346 + SYS_KCMP = 4347 + SYS_FINIT_MODULE = 4348 + SYS_SCHED_SETATTR = 4349 + SYS_SCHED_GETATTR = 4350 + SYS_RENAMEAT2 = 4351 + SYS_SECCOMP = 4352 + SYS_GETRANDOM = 4353 + SYS_MEMFD_CREATE = 4354 + SYS_BPF = 4355 + SYS_EXECVEAT = 4356 + SYS_USERFAULTFD = 4357 + SYS_MEMBARRIER = 4358 + SYS_MLOCK2 = 4359 + SYS_COPY_FILE_RANGE = 4360 + SYS_PREADV2 = 4361 + SYS_PWRITEV2 = 4362 + SYS_PKEY_MPROTECT = 4363 + SYS_PKEY_ALLOC = 4364 + SYS_PKEY_FREE = 4365 + SYS_STATX = 4366 + SYS_RSEQ = 4367 + SYS_IO_PGETEVENTS = 4368 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 7cbe78b1..a5c5f3de 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build ppc64,linux @@ -372,19 +372,4 @@ const ( SYS_PKEY_MPROTECT = 386 SYS_RSEQ = 387 SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 51a2f123..5470eadb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build ppc64le,linux @@ -372,19 +372,4 @@ const ( SYS_PKEY_MPROTECT = 386 SYS_RSEQ = 387 SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 323432ae..41e4fd1d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build riscv64,linux @@ -283,10 +283,4 @@ const ( SYS_PKEY_FREE = 290 SYS_STATX = 291 SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 9dca9748..de0245a9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h +// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build s390x,linux @@ -334,22 +334,4 @@ const ( SYS_KEXEC_FILE_LOAD = 381 SYS_IO_PGETEVENTS = 382 SYS_RSEQ = 383 - SYS_PKEY_MPROTECT = 384 - SYS_PKEY_ALLOC = 385 - SYS_PKEY_FREE = 386 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index d3da46f0..2d099367 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -1,5 +1,5 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__arch64__ linux/usr/include/asm/unistd.h +// Code generated by the command above; DO NOT EDIT. // +build sparc64,linux @@ -253,7 +253,6 @@ const ( SYS_TIMER_GETOVERRUN = 264 SYS_TIMER_DELETE = 265 SYS_TIMER_CREATE = 266 - SYS_VSERVER = 267 SYS_IO_SETUP = 268 SYS_IO_DESTROY = 269 SYS_IO_SUBMIT = 270 @@ -346,25 +345,4 @@ const ( SYS_COPY_FILE_RANGE = 357 SYS_PREADV2 = 358 SYS_PWRITEV2 = 359 - SYS_STATX = 360 - SYS_IO_PGETEVENTS = 361 - SYS_PKEY_MPROTECT = 362 - SYS_PKEY_ALLOC = 363 - SYS_PKEY_FREE = 364 - SYS_RSEQ = 365 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index e66a8c9d..f0daa05a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -1,5 +1,5 @@ -// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_netbsd.pl +// Code generated by the command above; DO NOT EDIT. // +build 386,netbsd diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 42c788f2..ddb25b94 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -1,5 +1,5 @@ -// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_netbsd.pl +// Code generated by the command above; DO NOT EDIT. // +build amd64,netbsd diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index 0a075717..315bd63f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -1,5 +1,5 @@ -// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_netbsd.pl +// Code generated by the command above; DO NOT EDIT. // +build arm,netbsd diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go deleted file mode 100644 index 0291c093..00000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ /dev/null @@ -1,274 +0,0 @@ -// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; DO NOT EDIT. - -// +build arm64,netbsd - -package unix - -const ( - SYS_EXIT = 1 // { void|sys||exit(int rval); } - SYS_FORK = 2 // { int|sys||fork(void); } - SYS_READ = 3 // { ssize_t|sys||read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t|sys||write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int|sys||open(const char *path, int flags, ... mode_t mode); } - SYS_CLOSE = 6 // { int|sys||close(int fd); } - SYS_LINK = 9 // { int|sys||link(const char *path, const char *link); } - SYS_UNLINK = 10 // { int|sys||unlink(const char *path); } - SYS_CHDIR = 12 // { int|sys||chdir(const char *path); } - SYS_FCHDIR = 13 // { int|sys||fchdir(int fd); } - SYS_CHMOD = 15 // { int|sys||chmod(const char *path, mode_t mode); } - SYS_CHOWN = 16 // { int|sys||chown(const char *path, uid_t uid, gid_t gid); } - SYS_BREAK = 17 // { int|sys||obreak(char *nsize); } - SYS_GETPID = 20 // { pid_t|sys||getpid_with_ppid(void); } - SYS_UNMOUNT = 22 // { int|sys||unmount(const char *path, int flags); } - SYS_SETUID = 23 // { int|sys||setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t|sys||getuid_with_euid(void); } - SYS_GETEUID = 25 // { uid_t|sys||geteuid(void); } - SYS_PTRACE = 26 // { int|sys||ptrace(int req, pid_t pid, void *addr, int data); } - SYS_RECVMSG = 27 // { ssize_t|sys||recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { ssize_t|sys||sendmsg(int s, const struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { ssize_t|sys||recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } - SYS_ACCEPT = 30 // { int|sys||accept(int s, struct sockaddr *name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int|sys||getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int|sys||getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_ACCESS = 33 // { int|sys||access(const char *path, int flags); } - SYS_CHFLAGS = 34 // { int|sys||chflags(const char *path, u_long flags); } - SYS_FCHFLAGS = 35 // { int|sys||fchflags(int fd, u_long flags); } - SYS_SYNC = 36 // { void|sys||sync(void); } - SYS_KILL = 37 // { int|sys||kill(pid_t pid, int signum); } - SYS_GETPPID = 39 // { pid_t|sys||getppid(void); } - SYS_DUP = 41 // { int|sys||dup(int fd); } - SYS_PIPE = 42 // { int|sys||pipe(void); } - SYS_GETEGID = 43 // { gid_t|sys||getegid(void); } - SYS_PROFIL = 44 // { int|sys||profil(char *samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int|sys||ktrace(const char *fname, int ops, int facs, pid_t pid); } - SYS_GETGID = 47 // { gid_t|sys||getgid_with_egid(void); } - SYS___GETLOGIN = 49 // { int|sys||__getlogin(char *namebuf, size_t namelen); } - SYS___SETLOGIN = 50 // { int|sys||__setlogin(const char *namebuf); } - SYS_ACCT = 51 // { int|sys||acct(const char *path); } - SYS_IOCTL = 54 // { int|sys||ioctl(int fd, u_long com, ... void *data); } - SYS_REVOKE = 56 // { int|sys||revoke(const char *path); } - SYS_SYMLINK = 57 // { int|sys||symlink(const char *path, const char *link); } - SYS_READLINK = 58 // { ssize_t|sys||readlink(const char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int|sys||execve(const char *path, char * const *argp, char * const *envp); } - SYS_UMASK = 60 // { mode_t|sys||umask(mode_t newmask); } - SYS_CHROOT = 61 // { int|sys||chroot(const char *path); } - SYS_VFORK = 66 // { int|sys||vfork(void); } - SYS_SBRK = 69 // { int|sys||sbrk(intptr_t incr); } - SYS_SSTK = 70 // { int|sys||sstk(int incr); } - SYS_VADVISE = 72 // { int|sys||ovadvise(int anom); } - SYS_MUNMAP = 73 // { int|sys||munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int|sys||mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int|sys||madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int|sys||mincore(void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int|sys||getgroups(int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int|sys||setgroups(int gidsetsize, const gid_t *gidset); } - SYS_GETPGRP = 81 // { int|sys||getpgrp(void); } - SYS_SETPGID = 82 // { int|sys||setpgid(pid_t pid, pid_t pgid); } - SYS_DUP2 = 90 // { int|sys||dup2(int from, int to); } - SYS_FCNTL = 92 // { int|sys||fcntl(int fd, int cmd, ... void *arg); } - SYS_FSYNC = 95 // { int|sys||fsync(int fd); } - SYS_SETPRIORITY = 96 // { int|sys||setpriority(int which, id_t who, int prio); } - SYS_CONNECT = 98 // { int|sys||connect(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_GETPRIORITY = 100 // { int|sys||getpriority(int which, id_t who); } - SYS_BIND = 104 // { int|sys||bind(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int|sys||setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } - SYS_LISTEN = 106 // { int|sys||listen(int s, int backlog); } - SYS_GETSOCKOPT = 118 // { int|sys||getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } - SYS_READV = 120 // { ssize_t|sys||readv(int fd, const struct iovec *iovp, int iovcnt); } - SYS_WRITEV = 121 // { ssize_t|sys||writev(int fd, const struct iovec *iovp, int iovcnt); } - SYS_FCHOWN = 123 // { int|sys||fchown(int fd, uid_t uid, gid_t gid); } - SYS_FCHMOD = 124 // { int|sys||fchmod(int fd, mode_t mode); } - SYS_SETREUID = 126 // { int|sys||setreuid(uid_t ruid, uid_t euid); } - SYS_SETREGID = 127 // { int|sys||setregid(gid_t rgid, gid_t egid); } - SYS_RENAME = 128 // { int|sys||rename(const char *from, const char *to); } - SYS_FLOCK = 131 // { int|sys||flock(int fd, int how); } - SYS_MKFIFO = 132 // { int|sys||mkfifo(const char *path, mode_t mode); } - SYS_SENDTO = 133 // { ssize_t|sys||sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } - SYS_SHUTDOWN = 134 // { int|sys||shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int|sys||socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int|sys||mkdir(const char *path, mode_t mode); } - SYS_RMDIR = 137 // { int|sys||rmdir(const char *path); } - SYS_SETSID = 147 // { int|sys||setsid(void); } - SYS_SYSARCH = 165 // { int|sys||sysarch(int op, void *parms); } - SYS_PREAD = 173 // { ssize_t|sys||pread(int fd, void *buf, size_t nbyte, int PAD, off_t offset); } - SYS_PWRITE = 174 // { ssize_t|sys||pwrite(int fd, const void *buf, size_t nbyte, int PAD, off_t offset); } - SYS_NTP_ADJTIME = 176 // { int|sys||ntp_adjtime(struct timex *tp); } - SYS_SETGID = 181 // { int|sys||setgid(gid_t gid); } - SYS_SETEGID = 182 // { int|sys||setegid(gid_t egid); } - SYS_SETEUID = 183 // { int|sys||seteuid(uid_t euid); } - SYS_PATHCONF = 191 // { long|sys||pathconf(const char *path, int name); } - SYS_FPATHCONF = 192 // { long|sys||fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int|sys||getrlimit(int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int|sys||setrlimit(int which, const struct rlimit *rlp); } - SYS_MMAP = 197 // { void *|sys||mmap(void *addr, size_t len, int prot, int flags, int fd, long PAD, off_t pos); } - SYS_LSEEK = 199 // { off_t|sys||lseek(int fd, int PAD, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int|sys||truncate(const char *path, int PAD, off_t length); } - SYS_FTRUNCATE = 201 // { int|sys||ftruncate(int fd, int PAD, off_t length); } - SYS___SYSCTL = 202 // { int|sys||__sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, const void *new, size_t newlen); } - SYS_MLOCK = 203 // { int|sys||mlock(const void *addr, size_t len); } - SYS_MUNLOCK = 204 // { int|sys||munlock(const void *addr, size_t len); } - SYS_UNDELETE = 205 // { int|sys||undelete(const char *path); } - SYS_GETPGID = 207 // { pid_t|sys||getpgid(pid_t pid); } - SYS_REBOOT = 208 // { int|sys||reboot(int opt, char *bootstr); } - SYS_POLL = 209 // { int|sys||poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_SEMGET = 221 // { int|sys||semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 222 // { int|sys||semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_SEMCONFIG = 223 // { int|sys||semconfig(int flag); } - SYS_MSGGET = 225 // { int|sys||msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int|sys||msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { ssize_t|sys||msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { void *|sys||shmat(int shmid, const void *shmaddr, int shmflg); } - SYS_SHMDT = 230 // { int|sys||shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int|sys||shmget(key_t key, size_t size, int shmflg); } - SYS_TIMER_CREATE = 235 // { int|sys||timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid); } - SYS_TIMER_DELETE = 236 // { int|sys||timer_delete(timer_t timerid); } - SYS_TIMER_GETOVERRUN = 239 // { int|sys||timer_getoverrun(timer_t timerid); } - SYS_FDATASYNC = 241 // { int|sys||fdatasync(int fd); } - SYS_MLOCKALL = 242 // { int|sys||mlockall(int flags); } - SYS_MUNLOCKALL = 243 // { int|sys||munlockall(void); } - SYS_SIGQUEUEINFO = 245 // { int|sys||sigqueueinfo(pid_t pid, const siginfo_t *info); } - SYS_MODCTL = 246 // { int|sys||modctl(int cmd, void *arg); } - SYS___POSIX_RENAME = 270 // { int|sys||__posix_rename(const char *from, const char *to); } - SYS_SWAPCTL = 271 // { int|sys||swapctl(int cmd, void *arg, int misc); } - SYS_MINHERIT = 273 // { int|sys||minherit(void *addr, size_t len, int inherit); } - SYS_LCHMOD = 274 // { int|sys||lchmod(const char *path, mode_t mode); } - SYS_LCHOWN = 275 // { int|sys||lchown(const char *path, uid_t uid, gid_t gid); } - SYS_MSYNC = 277 // { int|sys|13|msync(void *addr, size_t len, int flags); } - SYS___POSIX_CHOWN = 283 // { int|sys||__posix_chown(const char *path, uid_t uid, gid_t gid); } - SYS___POSIX_FCHOWN = 284 // { int|sys||__posix_fchown(int fd, uid_t uid, gid_t gid); } - SYS___POSIX_LCHOWN = 285 // { int|sys||__posix_lchown(const char *path, uid_t uid, gid_t gid); } - SYS_GETSID = 286 // { pid_t|sys||getsid(pid_t pid); } - SYS___CLONE = 287 // { pid_t|sys||__clone(int flags, void *stack); } - SYS_FKTRACE = 288 // { int|sys||fktrace(int fd, int ops, int facs, pid_t pid); } - SYS_PREADV = 289 // { ssize_t|sys||preadv(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } - SYS_PWRITEV = 290 // { ssize_t|sys||pwritev(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } - SYS___GETCWD = 296 // { int|sys||__getcwd(char *bufp, size_t length); } - SYS_FCHROOT = 297 // { int|sys||fchroot(int fd); } - SYS_LCHFLAGS = 304 // { int|sys||lchflags(const char *path, u_long flags); } - SYS_ISSETUGID = 305 // { int|sys||issetugid(void); } - SYS_UTRACE = 306 // { int|sys||utrace(const char *label, void *addr, size_t len); } - SYS_GETCONTEXT = 307 // { int|sys||getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 308 // { int|sys||setcontext(const struct __ucontext *ucp); } - SYS__LWP_CREATE = 309 // { int|sys||_lwp_create(const struct __ucontext *ucp, u_long flags, lwpid_t *new_lwp); } - SYS__LWP_EXIT = 310 // { int|sys||_lwp_exit(void); } - SYS__LWP_SELF = 311 // { lwpid_t|sys||_lwp_self(void); } - SYS__LWP_WAIT = 312 // { int|sys||_lwp_wait(lwpid_t wait_for, lwpid_t *departed); } - SYS__LWP_SUSPEND = 313 // { int|sys||_lwp_suspend(lwpid_t target); } - SYS__LWP_CONTINUE = 314 // { int|sys||_lwp_continue(lwpid_t target); } - SYS__LWP_WAKEUP = 315 // { int|sys||_lwp_wakeup(lwpid_t target); } - SYS__LWP_GETPRIVATE = 316 // { void *|sys||_lwp_getprivate(void); } - SYS__LWP_SETPRIVATE = 317 // { void|sys||_lwp_setprivate(void *ptr); } - SYS__LWP_KILL = 318 // { int|sys||_lwp_kill(lwpid_t target, int signo); } - SYS__LWP_DETACH = 319 // { int|sys||_lwp_detach(lwpid_t target); } - SYS__LWP_UNPARK = 321 // { int|sys||_lwp_unpark(lwpid_t target, const void *hint); } - SYS__LWP_UNPARK_ALL = 322 // { ssize_t|sys||_lwp_unpark_all(const lwpid_t *targets, size_t ntargets, const void *hint); } - SYS__LWP_SETNAME = 323 // { int|sys||_lwp_setname(lwpid_t target, const char *name); } - SYS__LWP_GETNAME = 324 // { int|sys||_lwp_getname(lwpid_t target, char *name, size_t len); } - SYS__LWP_CTL = 325 // { int|sys||_lwp_ctl(int features, struct lwpctl **address); } - SYS___SIGACTION_SIGTRAMP = 340 // { int|sys||__sigaction_sigtramp(int signum, const struct sigaction *nsa, struct sigaction *osa, const void *tramp, int vers); } - SYS_PMC_GET_INFO = 341 // { int|sys||pmc_get_info(int ctr, int op, void *args); } - SYS_PMC_CONTROL = 342 // { int|sys||pmc_control(int ctr, int op, void *args); } - SYS_RASCTL = 343 // { int|sys||rasctl(void *addr, size_t len, int op); } - SYS_KQUEUE = 344 // { int|sys||kqueue(void); } - SYS__SCHED_SETPARAM = 346 // { int|sys||_sched_setparam(pid_t pid, lwpid_t lid, int policy, const struct sched_param *params); } - SYS__SCHED_GETPARAM = 347 // { int|sys||_sched_getparam(pid_t pid, lwpid_t lid, int *policy, struct sched_param *params); } - SYS__SCHED_SETAFFINITY = 348 // { int|sys||_sched_setaffinity(pid_t pid, lwpid_t lid, size_t size, const cpuset_t *cpuset); } - SYS__SCHED_GETAFFINITY = 349 // { int|sys||_sched_getaffinity(pid_t pid, lwpid_t lid, size_t size, cpuset_t *cpuset); } - SYS_SCHED_YIELD = 350 // { int|sys||sched_yield(void); } - SYS_FSYNC_RANGE = 354 // { int|sys||fsync_range(int fd, int flags, off_t start, off_t length); } - SYS_UUIDGEN = 355 // { int|sys||uuidgen(struct uuid *store, int count); } - SYS_GETVFSSTAT = 356 // { int|sys||getvfsstat(struct statvfs *buf, size_t bufsize, int flags); } - SYS_STATVFS1 = 357 // { int|sys||statvfs1(const char *path, struct statvfs *buf, int flags); } - SYS_FSTATVFS1 = 358 // { int|sys||fstatvfs1(int fd, struct statvfs *buf, int flags); } - SYS_EXTATTRCTL = 360 // { int|sys||extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 361 // { int|sys||extattr_set_file(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 362 // { ssize_t|sys||extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FILE = 363 // { int|sys||extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FD = 364 // { int|sys||extattr_set_fd(int fd, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } - SYS_EXTATTR_GET_FD = 365 // { ssize_t|sys||extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_FD = 366 // { int|sys||extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_LINK = 367 // { int|sys||extattr_set_link(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 368 // { ssize_t|sys||extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 369 // { int|sys||extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } - SYS_EXTATTR_LIST_FD = 370 // { ssize_t|sys||extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 371 // { ssize_t|sys||extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 372 // { ssize_t|sys||extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_SETXATTR = 375 // { int|sys||setxattr(const char *path, const char *name, const void *value, size_t size, int flags); } - SYS_LSETXATTR = 376 // { int|sys||lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags); } - SYS_FSETXATTR = 377 // { int|sys||fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); } - SYS_GETXATTR = 378 // { int|sys||getxattr(const char *path, const char *name, void *value, size_t size); } - SYS_LGETXATTR = 379 // { int|sys||lgetxattr(const char *path, const char *name, void *value, size_t size); } - SYS_FGETXATTR = 380 // { int|sys||fgetxattr(int fd, const char *name, void *value, size_t size); } - SYS_LISTXATTR = 381 // { int|sys||listxattr(const char *path, char *list, size_t size); } - SYS_LLISTXATTR = 382 // { int|sys||llistxattr(const char *path, char *list, size_t size); } - SYS_FLISTXATTR = 383 // { int|sys||flistxattr(int fd, char *list, size_t size); } - SYS_REMOVEXATTR = 384 // { int|sys||removexattr(const char *path, const char *name); } - SYS_LREMOVEXATTR = 385 // { int|sys||lremovexattr(const char *path, const char *name); } - SYS_FREMOVEXATTR = 386 // { int|sys||fremovexattr(int fd, const char *name); } - SYS_GETDENTS = 390 // { int|sys|30|getdents(int fd, char *buf, size_t count); } - SYS_SOCKET = 394 // { int|sys|30|socket(int domain, int type, int protocol); } - SYS_GETFH = 395 // { int|sys|30|getfh(const char *fname, void *fhp, size_t *fh_size); } - SYS_MOUNT = 410 // { int|sys|50|mount(const char *type, const char *path, int flags, void *data, size_t data_len); } - SYS_MREMAP = 411 // { void *|sys||mremap(void *old_address, size_t old_size, void *new_address, size_t new_size, int flags); } - SYS_PSET_CREATE = 412 // { int|sys||pset_create(psetid_t *psid); } - SYS_PSET_DESTROY = 413 // { int|sys||pset_destroy(psetid_t psid); } - SYS_PSET_ASSIGN = 414 // { int|sys||pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); } - SYS__PSET_BIND = 415 // { int|sys||_pset_bind(idtype_t idtype, id_t first_id, id_t second_id, psetid_t psid, psetid_t *opsid); } - SYS_POSIX_FADVISE = 416 // { int|sys|50|posix_fadvise(int fd, int PAD, off_t offset, off_t len, int advice); } - SYS_SELECT = 417 // { int|sys|50|select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_GETTIMEOFDAY = 418 // { int|sys|50|gettimeofday(struct timeval *tp, void *tzp); } - SYS_SETTIMEOFDAY = 419 // { int|sys|50|settimeofday(const struct timeval *tv, const void *tzp); } - SYS_UTIMES = 420 // { int|sys|50|utimes(const char *path, const struct timeval *tptr); } - SYS_ADJTIME = 421 // { int|sys|50|adjtime(const struct timeval *delta, struct timeval *olddelta); } - SYS_FUTIMES = 423 // { int|sys|50|futimes(int fd, const struct timeval *tptr); } - SYS_LUTIMES = 424 // { int|sys|50|lutimes(const char *path, const struct timeval *tptr); } - SYS_SETITIMER = 425 // { int|sys|50|setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } - SYS_GETITIMER = 426 // { int|sys|50|getitimer(int which, struct itimerval *itv); } - SYS_CLOCK_GETTIME = 427 // { int|sys|50|clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 428 // { int|sys|50|clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 429 // { int|sys|50|clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_NANOSLEEP = 430 // { int|sys|50|nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } - SYS___SIGTIMEDWAIT = 431 // { int|sys|50|__sigtimedwait(const sigset_t *set, siginfo_t *info, struct timespec *timeout); } - SYS__LWP_PARK = 434 // { int|sys|50|_lwp_park(const struct timespec *ts, lwpid_t unpark, const void *hint, const void *unparkhint); } - SYS_KEVENT = 435 // { int|sys|50|kevent(int fd, const struct kevent *changelist, size_t nchanges, struct kevent *eventlist, size_t nevents, const struct timespec *timeout); } - SYS_PSELECT = 436 // { int|sys|50|pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } - SYS_POLLTS = 437 // { int|sys|50|pollts(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } - SYS_STAT = 439 // { int|sys|50|stat(const char *path, struct stat *ub); } - SYS_FSTAT = 440 // { int|sys|50|fstat(int fd, struct stat *sb); } - SYS_LSTAT = 441 // { int|sys|50|lstat(const char *path, struct stat *ub); } - SYS___SEMCTL = 442 // { int|sys|50|__semctl(int semid, int semnum, int cmd, ... union __semun *arg); } - SYS_SHMCTL = 443 // { int|sys|50|shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_MSGCTL = 444 // { int|sys|50|msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_GETRUSAGE = 445 // { int|sys|50|getrusage(int who, struct rusage *rusage); } - SYS_TIMER_SETTIME = 446 // { int|sys|50|timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } - SYS_TIMER_GETTIME = 447 // { int|sys|50|timer_gettime(timer_t timerid, struct itimerspec *value); } - SYS_NTP_GETTIME = 448 // { int|sys|50|ntp_gettime(struct ntptimeval *ntvp); } - SYS_WAIT4 = 449 // { int|sys|50|wait4(pid_t pid, int *status, int options, struct rusage *rusage); } - SYS_MKNOD = 450 // { int|sys|50|mknod(const char *path, mode_t mode, dev_t dev); } - SYS_FHSTAT = 451 // { int|sys|50|fhstat(const void *fhp, size_t fh_size, struct stat *sb); } - SYS_PIPE2 = 453 // { int|sys||pipe2(int *fildes, int flags); } - SYS_DUP3 = 454 // { int|sys||dup3(int from, int to, int flags); } - SYS_KQUEUE1 = 455 // { int|sys||kqueue1(int flags); } - SYS_PACCEPT = 456 // { int|sys||paccept(int s, struct sockaddr *name, socklen_t *anamelen, const sigset_t *mask, int flags); } - SYS_LINKAT = 457 // { int|sys||linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); } - SYS_RENAMEAT = 458 // { int|sys||renameat(int fromfd, const char *from, int tofd, const char *to); } - SYS_MKFIFOAT = 459 // { int|sys||mkfifoat(int fd, const char *path, mode_t mode); } - SYS_MKNODAT = 460 // { int|sys||mknodat(int fd, const char *path, mode_t mode, uint32_t dev); } - SYS_MKDIRAT = 461 // { int|sys||mkdirat(int fd, const char *path, mode_t mode); } - SYS_FACCESSAT = 462 // { int|sys||faccessat(int fd, const char *path, int amode, int flag); } - SYS_FCHMODAT = 463 // { int|sys||fchmodat(int fd, const char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 464 // { int|sys||fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); } - SYS_FEXECVE = 465 // { int|sys||fexecve(int fd, char * const *argp, char * const *envp); } - SYS_FSTATAT = 466 // { int|sys||fstatat(int fd, const char *path, struct stat *buf, int flag); } - SYS_UTIMENSAT = 467 // { int|sys||utimensat(int fd, const char *path, const struct timespec *tptr, int flag); } - SYS_OPENAT = 468 // { int|sys||openat(int fd, const char *path, int oflags, ... mode_t mode); } - SYS_READLINKAT = 469 // { int|sys||readlinkat(int fd, const char *path, char *buf, size_t bufsize); } - SYS_SYMLINKAT = 470 // { int|sys||symlinkat(const char *path1, int fd, const char *path2); } - SYS_UNLINKAT = 471 // { int|sys||unlinkat(int fd, const char *path, int flag); } - SYS_FUTIMENS = 472 // { int|sys||futimens(int fd, const struct timespec *tptr); } - SYS___QUOTACTL = 473 // { int|sys||__quotactl(const char *path, struct quotactl_args *args); } - SYS_POSIX_SPAWN = 474 // { int|sys||posix_spawn(pid_t *pid, const char *path, const struct posix_spawn_file_actions *file_actions, const struct posix_spawnattr *attrp, char *const *argv, char *const *envp); } - SYS_RECVMMSG = 475 // { int|sys||recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); } - SYS_SENDMMSG = 476 // { int|sys||sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); } -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index b0207d1c..07787301 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -1,5 +1,5 @@ -// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_openbsd.pl +// Code generated by the command above; DO NOT EDIT. // +build 386,openbsd @@ -9,119 +9,109 @@ const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \ + SYS_OPEN = 5 // { int sys_open(const char *path, \ SYS_CLOSE = 6 // { int sys_close(int fd); } - SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } - SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \ SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } SYS_UNLINK = 10 // { int sys_unlink(const char *path); } - SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, \ SYS_CHDIR = 12 // { int sys_chdir(const char *path); } SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } - SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, \ SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } - SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, \ SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } - SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, \ SYS_GETPID = 20 // { pid_t sys_getpid(void); } - SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, \ SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t sys_getuid(void); } SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } - SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } - SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, \ + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, \ + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, \ + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \ + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \ + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \ + SYS_ACCESS = 33 // { int sys_access(const char *path, int flags); } SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } SYS_SYNC = 36 // { void sys_sync(void); } + SYS_KILL = 37 // { int sys_kill(int pid, int signum); } SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } SYS_GETPPID = 39 // { pid_t sys_getppid(void); } SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } SYS_DUP = 41 // { int sys_dup(int fd); } - SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, \ SYS_GETEGID = 43 // { gid_t sys_getegid(void); } - SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } - SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, \ + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \ SYS_GETGID = 47 // { gid_t sys_getgid(void); } SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_GETLOGIN = 49 // { int sys_getlogin(char *namebuf, u_int namelen); } SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } SYS_ACCT = 51 // { int sys_acct(const char *path); } SYS_SIGPENDING = 52 // { int sys_sigpending(void); } SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } - SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, \ SYS_REBOOT = 55 // { int sys_reboot(int opt); } SYS_REVOKE = 56 // { int sys_revoke(const char *path); } - SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } - SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \ + SYS_READLINK = 58 // { int sys_readlink(const char *path, char *buf, \ + SYS_EXECVE = 59 // { int sys_execve(const char *path, \ SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } SYS_CHROOT = 61 // { int sys_chroot(const char *path); } - SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } - SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, \ + SYS_STATFS = 63 // { int sys_statfs(const char *path, \ SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, \ SYS_VFORK = 66 // { int sys_vfork(void); } - SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } - SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } - SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } - SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, \ + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, \ + SYS_SETITIMER = 69 // { int sys_setitimer(int which, \ + SYS_GETITIMER = 70 // { int sys_getitimer(int which, \ + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, \ + SYS_KEVENT = 72 // { int sys_kevent(int fd, \ SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } - SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } - SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } - SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, \ + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, \ + SYS_UTIMES = 76 // { int sys_utimes(const char *path, \ + SYS_FUTIMES = 77 // { int sys_futimes(int fd, \ + SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \ + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \ SYS_GETPGRP = 81 // { int sys_getpgrp(void); } - SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } - SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } - SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } - SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } - SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } - SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, int pgid); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \ + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \ + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \ + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \ SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } - SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \ SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } - SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } - SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \ SYS_FSYNC = 95 // { int sys_fsync(int fd); } SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \ SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } - SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } - SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } - SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \ + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } - SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } - SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } - SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } - SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \ + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } - SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } - SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } - SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } - SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } - SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } - SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } - SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \ + SYS_READV = 120 // { ssize_t sys_readv(int fd, \ + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \ SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } @@ -129,90 +119,89 @@ const ( SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } - SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, \ SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } - SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } - SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \ SYS_SETSID = 147 // { int sys_setsid(void); } - SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \ SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } - SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, \ + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, \ SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } - SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } - SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } - SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, \ + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, \ + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, \ + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \ + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \ SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } - SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS___SYSCTL = 202 // { int sys___sysctl(const int *name, u_int namelen, \ SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } - SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, \ SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \ + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \ + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } - SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } - SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, \ + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int sys_issetugid(void); } SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } SYS_PIPE = 263 // { int sys_pipe(int *fdp); } SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } - SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } - SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, \ + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, \ SYS_KQUEUE = 269 // { int sys_kqueue(void); } SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } - SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } - SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, \ + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, \ + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, \ + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, \ + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, \ SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } - SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, \ SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } - SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } - SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, \ + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, \ + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, \ + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, \ + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, \ SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } - SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, \ SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } - SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, \ SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } - SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, \ SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } SYS_GETRTABLE = 311 // { int sys_getrtable(void); } - SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } - SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } - SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } - SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } - SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } - SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } - SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } - SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } - SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } - SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, \ + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, \ + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, \ + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, \ + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, \ + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, \ + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, \ + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, \ + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, \ + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, \ + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, \ + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, \ SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index f0dec6f0..bc7fa579 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// mksysnum_openbsd.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,openbsd @@ -9,35 +9,35 @@ const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \ + SYS_OPEN = 5 // { int sys_open(const char *path, \ SYS_CLOSE = 6 // { int sys_close(int fd); } SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } - SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \ SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } SYS_UNLINK = 10 // { int sys_unlink(const char *path); } - SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, \ SYS_CHDIR = 12 // { int sys_chdir(const char *path); } SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } - SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, \ SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } - SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, \ SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } - SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, \ SYS_GETPID = 20 // { pid_t sys_getpid(void); } - SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, \ SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t sys_getuid(void); } SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } - SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } - SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, \ + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, \ + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, \ + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \ + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \ + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \ SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } @@ -46,81 +46,81 @@ const ( SYS_GETPPID = 39 // { pid_t sys_getppid(void); } SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } SYS_DUP = 41 // { int sys_dup(int fd); } - SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, \ SYS_GETEGID = 43 // { gid_t sys_getegid(void); } - SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } - SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, \ + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \ SYS_GETGID = 47 // { gid_t sys_getgid(void); } SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } SYS_ACCT = 51 // { int sys_acct(const char *path); } SYS_SIGPENDING = 52 // { int sys_sigpending(void); } SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } - SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, \ SYS_REBOOT = 55 // { int sys_reboot(int opt); } SYS_REVOKE = 56 // { int sys_revoke(const char *path); } - SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } - SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \ + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, \ + SYS_EXECVE = 59 // { int sys_execve(const char *path, \ SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } SYS_CHROOT = 61 // { int sys_chroot(const char *path); } - SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } - SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, \ + SYS_STATFS = 63 // { int sys_statfs(const char *path, \ SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, \ SYS_VFORK = 66 // { int sys_vfork(void); } - SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } - SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } - SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } - SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, \ + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, \ + SYS_SETITIMER = 69 // { int sys_setitimer(int which, \ + SYS_GETITIMER = 70 // { int sys_getitimer(int which, \ + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, \ + SYS_KEVENT = 72 // { int sys_kevent(int fd, \ SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } - SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } - SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } - SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, \ + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, \ + SYS_UTIMES = 76 // { int sys_utimes(const char *path, \ + SYS_FUTIMES = 77 // { int sys_futimes(int fd, \ + SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \ + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \ SYS_GETPGRP = 81 // { int sys_getpgrp(void); } SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } - SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } - SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } - SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } - SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } - SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, \ + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \ + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \ + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, \ + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \ + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \ SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } - SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \ SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } - SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } - SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, \ + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \ SYS_FSYNC = 95 // { int sys_fsync(int fd); } SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \ SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } - SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \ + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } - SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } - SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } - SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } - SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, \ + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, \ + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \ + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } - SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } - SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } - SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, \ + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, \ + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \ SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } - SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } - SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, \ + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \ SYS_KILL = 122 // { int sys_kill(int pid, int signum); } SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } @@ -129,90 +129,90 @@ const ( SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } - SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, \ SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } - SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \ SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } SYS_SETSID = 147 // { int sys_setsid(void); } - SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \ SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } - SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, \ + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, \ SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } - SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } - SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } - SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, \ + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, \ + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, \ + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \ + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \ SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } - SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, \ SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } - SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, \ SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \ + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \ + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } - SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } - SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, \ + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int sys_issetugid(void); } SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } SYS_PIPE = 263 // { int sys_pipe(int *fdp); } SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } - SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } - SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, \ + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, \ SYS_KQUEUE = 269 // { int sys_kqueue(void); } SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } - SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } - SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, \ + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, \ + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, \ + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, \ + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, \ SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } - SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, \ SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } - SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } - SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, \ + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, \ + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, \ + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, \ + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, \ SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } - SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, \ SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } - SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, \ SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } - SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, \ SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } SYS_GETRTABLE = 311 // { int sys_getrtable(void); } - SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } - SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } - SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } - SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } - SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } - SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } - SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } - SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } - SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } - SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, \ + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, \ + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, \ + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, \ + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, \ + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, \ + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, \ + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, \ + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, \ + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, \ + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, \ + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, \ SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index 33d1dc54..7a1693ac 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -1,5 +1,5 @@ -// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. +// mksysnum_openbsd.pl +// Code generated by the command above; DO NOT EDIT. // +build arm,openbsd @@ -9,35 +9,35 @@ const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \ + SYS_OPEN = 5 // { int sys_open(const char *path, \ SYS_CLOSE = 6 // { int sys_close(int fd); } SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } - SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \ SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } SYS_UNLINK = 10 // { int sys_unlink(const char *path); } - SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, \ SYS_CHDIR = 12 // { int sys_chdir(const char *path); } SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } - SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, \ SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } - SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, \ SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } - SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, \ SYS_GETPID = 20 // { pid_t sys_getpid(void); } - SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, \ SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t sys_getuid(void); } SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } - SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } - SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, \ + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, \ + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, \ + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, \ + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \ + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \ + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \ SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } @@ -46,81 +46,77 @@ const ( SYS_GETPPID = 39 // { pid_t sys_getppid(void); } SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } SYS_DUP = 41 // { int sys_dup(int fd); } - SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, \ SYS_GETEGID = 43 // { gid_t sys_getegid(void); } - SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } - SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, \ + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, \ + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \ SYS_GETGID = 47 // { gid_t sys_getgid(void); } SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_GETLOGIN = 49 // { int sys_getlogin(char *namebuf, u_int namelen); } SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } SYS_ACCT = 51 // { int sys_acct(const char *path); } SYS_SIGPENDING = 52 // { int sys_sigpending(void); } SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } - SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, \ SYS_REBOOT = 55 // { int sys_reboot(int opt); } SYS_REVOKE = 56 // { int sys_revoke(const char *path); } - SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } - SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \ + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, \ + SYS_EXECVE = 59 // { int sys_execve(const char *path, \ SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } SYS_CHROOT = 61 // { int sys_chroot(const char *path); } - SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } - SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, \ + SYS_STATFS = 63 // { int sys_statfs(const char *path, \ SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, \ SYS_VFORK = 66 // { int sys_vfork(void); } - SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } - SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } - SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } - SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, \ + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, \ + SYS_SETITIMER = 69 // { int sys_setitimer(int which, \ + SYS_GETITIMER = 70 // { int sys_getitimer(int which, \ + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, \ + SYS_KEVENT = 72 // { int sys_kevent(int fd, \ SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } - SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } - SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } - SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, \ + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, \ + SYS_UTIMES = 76 // { int sys_utimes(const char *path, \ + SYS_FUTIMES = 77 // { int sys_futimes(int fd, \ + SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, \ + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \ + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \ SYS_GETPGRP = 81 // { int sys_getpgrp(void); } SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } - SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } - SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } - SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } - SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } - SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_SENDSYSLOG = 83 // { int sys_sendsyslog(const void *buf, size_t nbyte); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \ + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \ + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \ + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \ + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \ SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } - SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \ SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } - SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } - SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, \ + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \ SYS_FSYNC = 95 // { int sys_fsync(int fd); } SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \ SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } - SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \ + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } - SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } - SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } - SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } - SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, \ + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \ + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } - SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } - SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } - SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } - SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } - SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } - SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \ + SYS_READV = 120 // { ssize_t sys_readv(int fd, \ + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \ SYS_KILL = 122 // { int sys_kill(int pid, int signum); } SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } @@ -129,90 +125,89 @@ const ( SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } - SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, \ SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } - SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } - SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \ SYS_SETSID = 147 // { int sys_setsid(void); } - SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \ SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } - SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, \ + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, \ SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } - SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } - SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } - SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, \ + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, \ + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, \ + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \ + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \ SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } - SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS___SYSCTL = 202 // { int sys___sysctl(const int *name, u_int namelen, \ SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } - SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, \ SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \ + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \ + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } - SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } - SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, \ + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int sys_issetugid(void); } SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } SYS_PIPE = 263 // { int sys_pipe(int *fdp); } SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } - SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } - SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, \ + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, \ SYS_KQUEUE = 269 // { int sys_kqueue(void); } SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } - SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } - SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, \ + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, \ + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, \ + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, \ + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, \ SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } - SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, \ SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } - SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } - SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, \ + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, \ + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, \ + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, \ + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, \ SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } - SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, \ SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } - SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, \ SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } - SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, \ SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } SYS_GETRTABLE = 311 // { int sys_getrtable(void); } - SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } - SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } - SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } - SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } - SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } - SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } - SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } - SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } - SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } - SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, \ + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, \ + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, \ + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, \ + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, \ + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, \ + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, \ + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, \ + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, \ + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, \ + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, \ + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, \ SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go deleted file mode 100644 index fe2b689b..00000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ /dev/null @@ -1,217 +0,0 @@ -// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,openbsd - -package unix - -const ( - SYS_EXIT = 1 // { void sys_exit(int rval); } - SYS_FORK = 2 // { int sys_fork(void); } - SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } - SYS_CLOSE = 6 // { int sys_close(int fd); } - SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } - SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } - SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } - SYS_UNLINK = 10 // { int sys_unlink(const char *path); } - SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } - SYS_CHDIR = 12 // { int sys_chdir(const char *path); } - SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } - SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } - SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } - SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } - SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break - SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } - SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } - SYS_GETPID = 20 // { pid_t sys_getpid(void); } - SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } - SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } - SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t sys_getuid(void); } - SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } - SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } - SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } - SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } - SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } - SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } - SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } - SYS_SYNC = 36 // { void sys_sync(void); } - SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } - SYS_GETPPID = 39 // { pid_t sys_getppid(void); } - SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } - SYS_DUP = 41 // { int sys_dup(int fd); } - SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } - SYS_GETEGID = 43 // { gid_t sys_getegid(void); } - SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } - SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } - SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } - SYS_GETGID = 47 // { gid_t sys_getgid(void); } - SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } - SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } - SYS_ACCT = 51 // { int sys_acct(const char *path); } - SYS_SIGPENDING = 52 // { int sys_sigpending(void); } - SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } - SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } - SYS_REBOOT = 55 // { int sys_reboot(int opt); } - SYS_REVOKE = 56 // { int sys_revoke(const char *path); } - SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } - SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } - SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } - SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } - SYS_CHROOT = 61 // { int sys_chroot(const char *path); } - SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } - SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } - SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } - SYS_VFORK = 66 // { int sys_vfork(void); } - SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } - SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } - SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } - SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } - SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } - SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } - SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } - SYS_GETPGRP = 81 // { int sys_getpgrp(void); } - SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } - SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } - SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } - SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } - SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } - SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } - SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } - SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } - SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } - SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } - SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } - SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } - SYS_FSYNC = 95 // { int sys_fsync(int fd); } - SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } - SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } - SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } - SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } - SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } - SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } - SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } - SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } - SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } - SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } - SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } - SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } - SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } - SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } - SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } - SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } - SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } - SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } - SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } - SYS_KILL = 122 // { int sys_kill(int pid, int signum); } - SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } - SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } - SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } - SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } - SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } - SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } - SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } - SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } - SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } - SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } - SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } - SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } - SYS_SETSID = 147 // { int sys_setsid(void); } - SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } - SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } - SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } - SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } - SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } - SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } - SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } - SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } - SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } - SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } - SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } - SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } - SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } - SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } - SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } - SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } - SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } - SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } - SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } - SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } - SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } - SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } - SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } - SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } - SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_ISSETUGID = 253 // { int sys_issetugid(void); } - SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } - SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } - SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } - SYS_PIPE = 263 // { int sys_pipe(int *fdp); } - SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } - SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } - SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } - SYS_KQUEUE = 269 // { int sys_kqueue(void); } - SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } - SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } - SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } - SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } - SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } - SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } - SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } - SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } - SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } - SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } - SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } - SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } - SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } - SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } - SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } - SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } - SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } - SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } - SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } - SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } - SYS_GETRTABLE = 311 // { int sys_getrtable(void); } - SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } - SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } - SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } - SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } - SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } - SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } - SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } - SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } - SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } - SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } - SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } - SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } - SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } - SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 2c1f815e..f1cfe7db 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x3ff ) @@ -30,6 +30,11 @@ type Timespec struct { Nsec int32 } +type StTimespec struct { + Sec int32 + Nsec int32 +} + type Timeval struct { Sec int32 Usec int32 @@ -96,9 +101,9 @@ type Stat_t struct { Gid uint32 Rdev uint32 Size int32 - Atim Timespec - Mtim Timespec - Ctim Timespec + Atim StTimespec + Mtim StTimespec + Ctim StTimespec Blksize int32 Blocks int32 Vfstype int32 @@ -143,17 +148,6 @@ type RawSockaddrUnix struct { Path [1023]uint8 } -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [120]uint8 -} - type RawSockaddr struct { Len uint8 Family uint8 @@ -213,18 +207,17 @@ type Msghdr struct { } const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x404 - SizeofSockaddrUnix = 0x401 - SizeofSockaddrDatalink = 0x80 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x404 + SizeofSockaddrUnix = 0x401 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc + SizeofICMPv6Filter = 0x20 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index b4a069ec..95581a3b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x3ff ) @@ -30,6 +30,12 @@ type Timespec struct { Nsec int64 } +type StTimespec struct { + Sec int64 + Nsec int32 + _ [4]byte +} + type Timeval struct { Sec int64 Usec int32 @@ -97,9 +103,10 @@ type Stat_t struct { Gid uint32 Rdev uint64 Ssize int32 - Atim Timespec - Mtim Timespec - Ctim Timespec + _ [4]byte + Atim StTimespec + Mtim StTimespec + Ctim StTimespec Blksize int64 Blocks int64 Vfstype int32 @@ -147,17 +154,6 @@ type RawSockaddrUnix struct { Path [1023]uint8 } -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [120]uint8 -} - type RawSockaddr struct { Len uint8 Family uint8 @@ -209,26 +205,27 @@ type Linger struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen int32 + _ [4]byte Control *byte Controllen uint32 Flags int32 } const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x404 - SizeofSockaddrUnix = 0x401 - SizeofSockaddrDatalink = 0x80 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x404 + SizeofSockaddrUnix = 0x401 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofICMPv6Filter = 0x20 ) const ( @@ -342,6 +339,7 @@ type Statfs_t struct { Ffree uint64 Fsid Fsid64_t Vfstype int32 + _ [4]byte Fsize uint64 Vfsnumber int32 Vfsoff int32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index 9f47b87c..327af5fb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -59,24 +59,24 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { @@ -487,13 +487,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 966798a8..116e6e07 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -63,25 +63,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - _ [4]byte - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + _ [4]byte + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { @@ -497,13 +497,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 4fe4c9cd..2750ad76 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -7,11 +7,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -60,24 +60,24 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { @@ -488,13 +488,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 21999e4b..8cead099 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -63,25 +63,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - _ [4]byte - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + _ [4]byte + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { @@ -497,13 +497,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index c206f2b0..c01ae670 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -57,25 +57,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Ino uint64 - Nlink uint32 - Dev uint32 - Mode uint16 - _1 uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare1 int64 - Qspare2 int64 + Ino uint64 + Nlink uint32 + Dev uint32 + Mode uint16 + Padding1 uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare1 int64 + Qspare2 int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 0edc5409..8006c563 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -56,84 +56,28 @@ type Rlimit struct { type _Gid_t uint32 -const ( - _statfsVersion = 0x20140518 - _dirblksiz = 0x400 -) - type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - _ int32 - Atim Timespec - _ int32 - Mtim Timespec - _ int32 - Ctim Timespec - _ int32 - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 -} - -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec - _ [8]byte + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Birthtimespec Timespec + Pad_cgo_0 [8]byte } type Statfs_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]int8 - Mntfromname [1024]int8 - Mntonname [1024]int8 -} - -type statfs_freebsd11_t struct { Version uint32 Type uint32 Flags uint64 @@ -168,17 +112,6 @@ type Flock_t struct { } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Pad0 uint8 - Namlen uint16 - Pad1 uint16 - Name [256]int8 -} - -type dirent_freebsd11 struct { Fileno uint32 Reclen uint16 Type uint8 @@ -339,7 +272,7 @@ type Kevent_t struct { } type FdSet struct { - Bits [32]uint32 + X__fds_bits [32]uint32 } const ( @@ -355,53 +288,53 @@ const ( ) type ifMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data ifData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data ifData } type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data IfData } type ifData struct { - Type uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Vhid uint8 - Datalen uint16 - Mtu uint32 - Metric uint32 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Oqdrops uint64 - Noproto uint64 - Hwassist uint64 - _ [8]byte - _ [16]byte + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Vhid uint8 + Datalen uint16 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Hwassist uint64 + X__ifi_epoch [8]byte + X__ifi_lastchange [16]byte } type IfData struct { @@ -433,24 +366,24 @@ type IfData struct { } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Metric int32 } type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte } type IfAnnounceMsghdr struct { @@ -463,19 +396,19 @@ type IfAnnounceMsghdr struct { } type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Fmask int32 - Inits uint32 - Rmx RtMetrics + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Pad_cgo_0 [2]byte + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Fmask int32 + Inits uint32 + Rmx RtMetrics } type RtMetrics struct { @@ -532,18 +465,18 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte + Tstamp Timeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [2]byte } type BpfZbufHeader struct { Kernel_gen uint32 Kernel_len uint32 User_gen uint32 - _ [5]uint32 + X_bzh_pad [5]uint32 } type Termios struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 8881ce84..716774de 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -56,79 +56,27 @@ type Rlimit struct { type _Gid_t uint32 -const ( - _statfsVersion = 0x20140518 - _dirblksiz = 0x400 -) - type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 -} - -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Birthtimespec Timespec } type Statfs_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]int8 - Mntfromname [1024]int8 - Mntonname [1024]int8 -} - -type statfs_freebsd11_t struct { Version uint32 Type uint32 Flags uint64 @@ -154,27 +102,16 @@ type statfs_freebsd11_t struct { } type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 - Sysid int32 - _ [4]byte + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 + Sysid int32 + Pad_cgo_0 [4]byte } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Pad0 uint8 - Namlen uint16 - Pad1 uint16 - Name [256]int8 -} - -type dirent_freebsd11 struct { Fileno uint32 Reclen uint16 Type uint8 @@ -275,10 +212,10 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte + Pad_cgo_0 [4]byte Iov *Iovec Iovlen int32 - _ [4]byte + Pad_cgo_1 [4]byte Control *byte Controllen uint32 Flags int32 @@ -337,7 +274,7 @@ type Kevent_t struct { } type FdSet struct { - Bits [16]uint64 + X__fds_bits [16]uint64 } const ( @@ -353,53 +290,53 @@ const ( ) type ifMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data ifData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data ifData } type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data IfData } type ifData struct { - Type uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Vhid uint8 - Datalen uint16 - Mtu uint32 - Metric uint32 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Oqdrops uint64 - Noproto uint64 - Hwassist uint64 - _ [8]byte - _ [16]byte + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Vhid uint8 + Datalen uint16 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Hwassist uint64 + X__ifi_epoch [8]byte + X__ifi_lastchange [16]byte } type IfData struct { @@ -431,24 +368,24 @@ type IfData struct { } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Metric int32 } type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte } type IfAnnounceMsghdr struct { @@ -461,19 +398,19 @@ type IfAnnounceMsghdr struct { } type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Fmask int32 - Inits uint64 - Rmx RtMetrics + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Pad_cgo_0 [2]byte + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Fmask int32 + Inits uint64 + Rmx RtMetrics } type RtMetrics struct { @@ -518,9 +455,9 @@ type BpfZbuf struct { } type BpfProgram struct { - Len uint32 - _ [4]byte - Insns *BpfInsn + Len uint32 + Pad_cgo_0 [4]byte + Insns *BpfInsn } type BpfInsn struct { @@ -531,18 +468,18 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [6]byte + Tstamp Timeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [6]byte } type BpfZbufHeader struct { Kernel_gen uint32 Kernel_len uint32 User_gen uint32 - _ [5]uint32 + X_bzh_pad [5]uint32 } type Termios struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index fc713999..92e07b00 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -21,15 +21,15 @@ type ( ) type Timespec struct { - Sec int64 - Nsec int32 - _ [4]byte + Sec int64 + Nsec int32 + Pad_cgo_0 [4]byte } type Timeval struct { - Sec int64 - Usec int32 - _ [4]byte + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte } type Rusage struct { @@ -58,79 +58,27 @@ type Rlimit struct { type _Gid_t uint32 -const ( - _statfsVersion = 0x20140518 - _dirblksiz = 0x400 -) - type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 -} - -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Birthtimespec Timespec } type Statfs_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]int8 - Mntfromname [1024]int8 - Mntonname [1024]int8 -} - -type statfs_freebsd11_t struct { Version uint32 Type uint32 Flags uint64 @@ -156,27 +104,16 @@ type statfs_freebsd11_t struct { } type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 - Sysid int32 - _ [4]byte + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 + Sysid int32 + Pad_cgo_0 [4]byte } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Pad0 uint8 - Namlen uint16 - Pad1 uint16 - Name [256]int8 -} - -type dirent_freebsd11 struct { Fileno uint32 Reclen uint16 Type uint8 @@ -337,7 +274,7 @@ type Kevent_t struct { } type FdSet struct { - Bits [32]uint32 + X__fds_bits [32]uint32 } const ( @@ -353,53 +290,53 @@ const ( ) type ifMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data ifData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data ifData } type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data IfData } type ifData struct { - Type uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Vhid uint8 - Datalen uint16 - Mtu uint32 - Metric uint32 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Oqdrops uint64 - Noproto uint64 - Hwassist uint64 - _ [8]byte - _ [16]byte + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Vhid uint8 + Datalen uint16 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Hwassist uint64 + X__ifi_epoch [8]byte + X__ifi_lastchange [16]byte } type IfData struct { @@ -426,30 +363,30 @@ type IfData struct { Iqdrops uint32 Noproto uint32 Hwassist uint32 - _ [4]byte + Pad_cgo_0 [4]byte Epoch int64 Lastchange Timeval } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Metric int32 } type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte } type IfAnnounceMsghdr struct { @@ -462,19 +399,19 @@ type IfAnnounceMsghdr struct { } type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Fmask int32 - Inits uint32 - Rmx RtMetrics + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Pad_cgo_0 [2]byte + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Fmask int32 + Inits uint32 + Rmx RtMetrics } type RtMetrics struct { @@ -531,18 +468,18 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [6]byte + Tstamp Timeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [6]byte } type BpfZbufHeader struct { Kernel_gen uint32 Kernel_len uint32 User_gen uint32 - _ [5]uint32 + X_bzh_pad [5]uint32 } type Termios struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go deleted file mode 100644 index 5a0753ee..00000000 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ /dev/null @@ -1,602 +0,0 @@ -// cgo -godefs types_freebsd.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,freebsd - -package unix - -const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int64 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur int64 - Max int64 -} - -type _Gid_t uint32 - -const ( - _statfsVersion = 0x20140518 - _dirblksiz = 0x400 -) - -type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 -} - -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec -} - -type Statfs_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]int8 - Mntfromname [1024]int8 - Mntonname [1024]int8 -} - -type statfs_freebsd11_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]int8 - Mntfromname [88]int8 - Mntonname [88]int8 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 - Sysid int32 - _ [4]byte -} - -type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Pad0 uint8 - Namlen uint16 - Pad1 uint16 - Name [256]int8 -} - -type dirent_freebsd11 struct { - Fileno uint32 - Reclen uint16 - Type uint8 - Namlen uint8 - Name [256]int8 -} - -type Fsid struct { - Val [2]int32 -} - -const ( - PathMax = 0x400 -) - -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [46]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - _ [4]byte - Iov *Iovec - Iovlen int32 - _ [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x36 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint64 - Filter int16 - Flags uint16 - Fflags uint32 - Data int64 - Udata *byte -} - -type FdSet struct { - Bits [16]uint64 -} - -const ( - sizeofIfMsghdr = 0xa8 - SizeofIfMsghdr = 0xa8 - sizeofIfData = 0x98 - SizeofIfData = 0x98 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfAnnounceMsghdr = 0x18 - SizeofRtMsghdr = 0x98 - SizeofRtMetrics = 0x70 -) - -type ifMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data ifData -} - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData -} - -type ifData struct { - Type uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Vhid uint8 - Datalen uint16 - Mtu uint32 - Metric uint32 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Oqdrops uint64 - Noproto uint64 - Hwassist uint64 - _ [8]byte - _ [16]byte -} - -type IfData struct { - Type uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Spare_char1 uint8 - Spare_char2 uint8 - Datalen uint8 - Mtu uint64 - Metric uint64 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Noproto uint64 - Hwassist uint64 - Epoch int64 - Lastchange Timeval -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte -} - -type IfAnnounceMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Name [16]int8 - What uint16 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Fmask int32 - Inits uint64 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint64 - Mtu uint64 - Hopcount uint64 - Expire uint64 - Recvpipe uint64 - Sendpipe uint64 - Ssthresh uint64 - Rtt uint64 - Rttvar uint64 - Pksent uint64 - Weight uint64 - Filler [3]uint64 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfZbuf = 0x18 - SizeofBpfProgram = 0x10 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x20 - SizeofBpfZbufHeader = 0x20 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfZbuf struct { - Bufa *byte - Bufb *byte - Buflen uint64 -} - -type BpfProgram struct { - Len uint32 - _ [4]byte - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [6]byte -} - -type BpfZbufHeader struct { - Kernel_gen uint32 - Kernel_len uint32 - User_gen uint32 - _ [5]uint32 -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 - AT_SYMLINK_NOFOLLOW = 0x200 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLINIGNEOF = 0x2000 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type CapRights struct { - Rights [2]uint64 -} - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 06e3a3f4..96493171 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -98,6 +98,7 @@ type _Gid_t uint32 type Stat_t struct { Dev uint64 _ uint16 + _ [2]byte _ uint32 Mode uint32 Nlink uint32 @@ -105,6 +106,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 + _ [2]byte Size int64 Blksize int32 Blocks int64 @@ -255,6 +257,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -275,16 +278,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -379,6 +372,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -405,11 +399,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -423,8 +412,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -439,185 +426,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -683,27 +626,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -718,6 +640,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [2]byte Filter *SockFilter } @@ -829,32 +752,7 @@ type Sigset_t struct { Val [32]uint32 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -878,10 +776,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -923,8 +822,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1027,8 +924,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1131,7 +1027,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1153,38 +1048,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1197,7 +1075,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1454,21 +1331,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1517,9 +1379,6 @@ const ( SizeofTpacketHdr = 0x18 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1995,6 +1854,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2036,434 +1896,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index cef25e73..5408e882 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -159,6 +162,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -255,6 +259,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -275,16 +280,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -333,6 +328,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -380,6 +376,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -406,11 +403,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -424,8 +416,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -440,185 +430,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -684,27 +630,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -719,6 +644,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -776,6 +702,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -794,6 +721,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 @@ -842,32 +770,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -891,9 +794,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -911,6 +816,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -934,8 +840,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1038,8 +942,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1142,7 +1045,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1164,38 +1066,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1208,7 +1093,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1304,6 +1188,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1466,21 +1351,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1529,9 +1399,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -2007,6 +1874,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2024,6 +1892,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2049,434 +1918,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index c4369361..5c7c0522 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -98,6 +98,7 @@ type _Gid_t uint32 type Stat_t struct { Dev uint64 _ uint16 + _ [2]byte _ uint32 Mode uint32 Nlink uint32 @@ -105,7 +106,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 - _ [4]byte + _ [6]byte Size int64 Blksize int32 _ [4]byte @@ -259,6 +260,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -279,16 +281,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -383,6 +375,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -409,11 +402,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -427,8 +415,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -443,185 +429,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -687,27 +629,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -722,6 +643,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [2]byte Filter *SockFilter } @@ -818,32 +740,7 @@ type Sigset_t struct { Val [32]uint32 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -867,10 +764,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -912,8 +810,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1016,8 +912,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1120,7 +1015,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1142,38 +1036,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1186,7 +1063,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1444,21 +1320,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1507,9 +1368,6 @@ const ( SizeofTpacketHdr = 0x18 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1985,6 +1843,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2027,434 +1886,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]uint8 - Driver_name [64]uint8 - Module_name [64]uint8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]uint8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]uint8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]uint8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]uint8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]uint8 -} - -type CryptoReportLarval struct { - Type [64]uint8 -} - -type CryptoReportHash struct { - Type [64]uint8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]uint8 -} - -type CryptoReportRNG struct { - Type [64]uint8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]uint8 -} - -type CryptoReportKPP struct { - Type [64]uint8 -} - -type CryptoReportAcomp struct { - Type [64]uint8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 76c55e05..99192a27 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -160,6 +163,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -256,6 +260,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -276,16 +281,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -334,6 +329,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -381,6 +377,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -407,11 +404,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -425,8 +417,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -441,185 +431,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -685,27 +631,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -720,6 +645,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -754,6 +680,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -772,6 +699,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 @@ -821,32 +749,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -870,9 +773,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -890,6 +795,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -913,8 +819,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1017,8 +921,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1121,7 +1024,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1143,38 +1045,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1187,7 +1072,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1283,6 +1167,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1445,21 +1330,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1508,9 +1378,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1986,6 +1853,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2003,6 +1871,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2028,434 +1897,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 4302d574..97fd2a33 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -258,6 +258,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -278,16 +279,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -382,6 +373,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -408,11 +400,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -426,8 +413,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -442,185 +427,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -686,27 +627,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -721,6 +641,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [2]byte Filter *SockFilter } @@ -823,32 +744,7 @@ type Sigset_t struct { Val [32]uint32 } -const _C__NSIG = 0x80 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -872,10 +768,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -917,8 +814,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1021,8 +916,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1125,7 +1019,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1147,38 +1040,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1191,7 +1067,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1450,21 +1325,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1513,9 +1373,6 @@ const ( SizeofTpacketHdr = 0x18 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1991,6 +1848,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2033,434 +1891,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 7ea742be..af924683 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -160,6 +163,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -256,6 +260,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -276,16 +281,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -334,6 +329,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -381,6 +377,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -407,11 +404,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -425,8 +417,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -441,185 +431,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -685,27 +631,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -720,6 +645,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -757,6 +683,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -775,6 +702,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 @@ -823,32 +751,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x80 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -872,9 +775,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -892,6 +797,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -915,8 +821,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1019,8 +923,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1123,7 +1026,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1145,38 +1047,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1189,7 +1074,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1285,6 +1169,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1447,21 +1332,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1510,9 +1380,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1988,6 +1855,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2005,6 +1873,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2030,434 +1899,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 8f2b8ad4..835e8e37 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -160,6 +163,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -256,6 +260,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -276,16 +281,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -334,6 +329,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -381,6 +377,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -407,11 +404,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -425,8 +417,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -441,185 +431,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -685,27 +631,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -720,6 +645,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -757,6 +683,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -775,6 +702,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 @@ -823,32 +751,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x80 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -872,9 +775,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -892,6 +797,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -915,8 +821,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1019,8 +923,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1123,7 +1026,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1145,38 +1047,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1189,7 +1074,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1285,6 +1169,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1447,21 +1332,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1510,9 +1380,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1988,6 +1855,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2005,6 +1873,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2030,434 +1899,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 865bf57d..17190b24 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -258,6 +258,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -278,16 +279,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -382,6 +373,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -408,11 +400,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -426,8 +413,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -442,185 +427,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -686,27 +627,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -721,6 +641,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [2]byte Filter *SockFilter } @@ -823,32 +744,7 @@ type Sigset_t struct { Val [32]uint32 } -const _C__NSIG = 0x80 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -872,10 +768,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [4]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -917,8 +814,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1021,8 +916,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1125,7 +1019,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1147,38 +1040,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1191,7 +1067,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1450,21 +1325,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1513,9 +1373,6 @@ const ( SizeofTpacketHdr = 0x18 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1991,6 +1848,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2033,434 +1891,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 2b68027d..17d8283f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -161,6 +164,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -257,6 +261,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -277,16 +282,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -335,6 +330,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -382,6 +378,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -408,11 +405,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -426,8 +418,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -442,185 +432,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -686,27 +632,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -721,6 +646,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -764,6 +690,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -782,6 +709,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]uint8 Fpack [6]uint8 @@ -831,32 +759,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -880,9 +783,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -900,6 +805,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -923,8 +829,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1027,8 +931,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1131,7 +1034,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1153,38 +1055,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1197,7 +1082,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1293,6 +1177,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1455,21 +1340,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1518,9 +1388,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1996,6 +1863,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2013,6 +1881,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2038,434 +1907,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]uint8 - Driver_name [64]uint8 - Module_name [64]uint8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]uint8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]uint8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]uint8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]uint8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]uint8 -} - -type CryptoReportLarval struct { - Type [64]uint8 -} - -type CryptoReportHash struct { - Type [64]uint8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]uint8 -} - -type CryptoReportRNG struct { - Type [64]uint8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]uint8 -} - -type CryptoReportKPP struct { - Type [64]uint8 -} - -type CryptoReportAcomp struct { - Type [64]uint8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 76cd7e64..19bda5bf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -161,6 +164,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -257,6 +261,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -277,16 +282,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -335,6 +330,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -382,6 +378,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -408,11 +405,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -426,8 +418,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -442,185 +432,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -686,27 +632,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -721,6 +646,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -764,6 +690,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -782,6 +709,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]uint8 Fpack [6]uint8 @@ -831,32 +759,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x40045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -880,9 +783,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -900,6 +805,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -923,8 +829,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1027,8 +931,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1131,7 +1034,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1153,38 +1055,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1197,7 +1082,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1293,6 +1177,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1455,21 +1340,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1518,9 +1388,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -1996,6 +1863,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2013,6 +1881,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2038,434 +1907,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]uint8 - Driver_name [64]uint8 - Module_name [64]uint8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]uint8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]uint8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]uint8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]uint8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]uint8 -} - -type CryptoReportLarval struct { - Type [64]uint8 -} - -type CryptoReportHash struct { - Type [64]uint8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]uint8 -} - -type CryptoReportRNG struct { - Type [64]uint8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]uint8 -} - -type CryptoReportKPP struct { - Type [64]uint8 -} - -type CryptoReportAcomp struct { - Type [64]uint8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index f99f0615..97875c3f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -160,6 +163,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -212,7 +216,7 @@ type RawSockaddrInet6 struct { type RawSockaddrUnix struct { Family uint16 - Path [108]int8 + Path [108]uint8 } type RawSockaddrLinklayer struct { @@ -256,6 +260,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -276,16 +281,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -334,6 +329,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -381,6 +377,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -407,11 +404,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -425,8 +417,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -441,185 +431,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -685,27 +631,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -720,6 +645,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -782,6 +708,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -800,6 +727,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]uint8 Fpack [6]uint8 @@ -848,32 +776,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -897,9 +800,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -917,6 +822,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -940,8 +846,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1044,8 +948,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1148,7 +1051,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1170,38 +1072,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1214,7 +1099,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1310,6 +1194,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1472,21 +1357,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1535,9 +1405,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -2013,6 +1880,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2030,6 +1898,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2055,434 +1924,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]uint8 - Driver_name [64]uint8 - Module_name [64]uint8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]uint8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]uint8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]uint8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]uint8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]uint8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]uint8 -} - -type CryptoReportLarval struct { - Type [64]uint8 -} - -type CryptoReportHash struct { - Type [64]uint8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]uint8 - Geniv [64]uint8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]uint8 -} - -type CryptoReportRNG struct { - Type [64]uint8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]uint8 -} - -type CryptoReportKPP struct { - Type [64]uint8 -} - -type CryptoReportAcomp struct { - Type [64]uint8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index d9d03ae4..705f1239 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -33,11 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -46,6 +48,7 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 @@ -159,6 +162,7 @@ type Fsid struct { type Flock_t struct { Type int16 Whence int16 + _ [4]byte Start int64 Len int64 Pid int32 @@ -255,6 +259,7 @@ type RawSockaddrRFCOMM struct { type RawSockaddrCAN struct { Family uint16 + _ [2]byte Ifindex int32 Addr [8]byte } @@ -275,16 +280,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -333,6 +328,7 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte @@ -380,6 +376,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -406,11 +403,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -424,8 +416,6 @@ const ( SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -440,185 +430,141 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_INFO_KIND = 0x1 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x31 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -684,27 +630,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -719,6 +644,7 @@ type SockFilter struct { type SockFprog struct { Len uint16 + _ [6]byte Filter *SockFilter } @@ -748,15 +674,18 @@ type PtracePsw struct { type PtraceFpregs struct { Fpc uint32 + _ [4]byte Fprs [16]float64 } type PtracePer struct { _ [0]uint64 - _ [32]byte + _ [24]byte + _ [8]byte Starting_addr uint64 Ending_addr uint64 Perc_atmid uint16 + _ [6]byte Address uint64 Access_id uint8 _ [7]byte @@ -777,6 +706,7 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 @@ -795,6 +725,7 @@ type Utsname struct { type Ustat_t struct { Tfree int32 + _ [4]byte Tinode uint64 Fname [6]int8 Fpack [6]int8 @@ -844,32 +775,7 @@ type Sigset_t struct { Val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} +const RNDGETENTCNT = 0x80045200 const PERF_IOC_FLAG_GROUP = 0x1 @@ -893,9 +799,11 @@ type Winsize struct { type Taskstats struct { Version uint16 + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -913,6 +821,7 @@ type Taskstats struct { Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -936,8 +845,6 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 } const ( @@ -1040,8 +947,7 @@ type PerfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 + _ uint32 } type PerfEventMmapPage struct { @@ -1144,7 +1050,6 @@ const ( PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 @@ -1166,38 +1071,21 @@ const ( PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 @@ -1210,7 +1098,6 @@ const ( PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( @@ -1306,6 +1193,7 @@ type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 + _ [4]byte Start uint64 } @@ -1469,21 +1357,6 @@ type TpacketBlockDesc struct { Hdr [40]byte } -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -1532,9 +1405,6 @@ const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc ) const ( @@ -2010,6 +1880,7 @@ type RTCTime struct { type RTCWkAlrm struct { Enabled uint8 Pending uint8 + _ [2]byte Time RTCTime } @@ -2027,6 +1898,7 @@ type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 + _ [4]byte Data *byte } @@ -2052,434 +1924,3 @@ const ( NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index b247fe94..8e7384b8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,16 +1,15 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - // +build sparc64,linux +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs types_linux.go | go run mkpost.go package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x1000 ) @@ -27,18 +26,20 @@ type Timespec struct { } type Timeval struct { - Sec int64 - Usec int32 - _ [4]byte + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte } type Timex struct { Modes uint32 + Pad_cgo_0 [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 + Pad_cgo_1 [4]byte Constant int64 Precision int64 Tolerance int64 @@ -47,13 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 + Pad_cgo_2 [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - _ [44]byte + Pad_cgo_3 [44]byte } type Time_t int64 @@ -97,96 +99,64 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - _ uint16 - Ino uint64 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint64 - _ uint16 - Size int64 - Blksize int64 - Blocks int64 - Atim Timespec - Mtim Timespec - Ctim Timespec - _ uint64 - _ uint64 + Dev uint64 + X__pad1 uint16 + Pad_cgo_0 [6]byte + Ino uint64 + Mode uint32 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + X__pad2 uint16 + Pad_cgo_1 [6]byte + Size int64 + Blksize int64 + Blocks int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + X__glibc_reserved4 uint64 + X__glibc_reserved5 uint64 } -type StatxTimestamp struct { - Sec int64 - Nsec uint32 - _ int32 -} - -type Statx_t struct { - Mask uint32 - Blksize uint32 - Attributes uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Mode uint16 - _ [1]uint16 - Ino uint64 - Size uint64 - Blocks uint64 - Attributes_mask uint64 - Atime StatxTimestamp - Btime StatxTimestamp - Ctime StatxTimestamp - Mtime StatxTimestamp - Rdev_major uint32 - Rdev_minor uint32 - Dev_major uint32 - Dev_minor uint32 - _ [14]uint64 +type Statfs_t struct { + Type int64 + Bsize int64 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid Fsid + Namelen int64 + Frsize int64 + Flags int64 + Spare [4]int64 } type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - _ [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + Pad_cgo_0 [5]byte } type Fsid struct { - Val [2]int32 + X__val [2]int32 } type Flock_t struct { - Type int16 - Whence int16 - Start int64 - Len int64 - Pid int32 - _ int16 - _ [2]byte -} - -type FscryptPolicy struct { - Version uint8 - Contents_encryption_mode uint8 - Filenames_encryption_mode uint8 - Flags uint8 - Master_key_descriptor [8]uint8 -} - -type FscryptKey struct { - Mode uint32 - Raw [64]uint8 - Size uint32 -} - -type KeyctlDHParams struct { - Private int32 - Prime int32 - Base int32 + Type int16 + Whence int16 + Pad_cgo_0 [4]byte + Start int64 + Len int64 + Pid int32 + X__glibc_reserved int16 + Pad_cgo_1 [2]byte } const ( @@ -241,26 +211,11 @@ type RawSockaddrHCI struct { Channel uint16 } -type RawSockaddrL2 struct { - Family uint16 - Psm uint16 - Bdaddr [6]uint8 - Cid uint16 - Bdaddr_type uint8 - _ [1]byte -} - -type RawSockaddrRFCOMM struct { - Family uint16 - Bdaddr [6]uint8 - Channel uint8 - _ [1]byte -} - type RawSockaddrCAN struct { - Family uint16 - Ifindex int32 - Addr [8]byte + Family uint16 + Pad_cgo_0 [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -279,16 +234,6 @@ type RawSockaddrVM struct { Zero [4]uint8 } -type RawSockaddrXDP struct { - Family uint16 - Flags uint16 - Ifindex uint32 - Queue_id uint32 - Shared_umem_fd uint32 -} - -type RawSockaddrPPPoX [0x1e]byte - type RawSockaddr struct { Family uint16 Data [14]int8 @@ -327,22 +272,16 @@ type IPv6Mreq struct { Interface uint32 } -type PacketMreq struct { - Ifindex int32 - Type uint16 - Alen uint16 - Address [8]uint8 -} - type Msghdr struct { Name *byte Namelen uint32 + Pad_cgo_0 [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - _ [4]byte + Pad_cgo_1 [4]byte } type Cmsghdr struct { @@ -384,6 +323,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 + Pad_cgo_0 [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -410,11 +350,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -423,19 +358,13 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 - SizeofSockaddrL2 = 0xe - SizeofSockaddrRFCOMM = 0xa SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 - SizeofSockaddrXDP = 0x10 - SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 - SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 - SizeofPacketMreq = 0x10 SizeofMsghdr = 0x38 SizeofCmsghdr = 0x10 SizeofInet4Pktinfo = 0xc @@ -444,185 +373,126 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x33 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -653,12 +523,12 @@ type RtAttr struct { } type IfInfomsg struct { - Family uint8 - _ uint8 - Type uint16 - Index int32 - Flags uint32 - Change uint32 + Family uint8 + X__ifi_pad uint8 + Type uint16 + Index int32 + Flags uint32 + Change uint32 } type IfAddrmsg struct { @@ -688,27 +558,6 @@ type RtNexthop struct { Ifindex int32 } -type NdUseroptmsg struct { - Family uint8 - Pad1 uint8 - Opts_len uint16 - Ifindex int32 - Icmp_type uint8 - Icmp_code uint8 - Pad2 uint16 - Pad3 uint32 -} - -type NdMsg struct { - Family uint8 - Pad1 uint8 - Pad2 uint16 - Ifindex int32 - State uint16 - Flags uint8 - Type uint8 -} - const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -722,8 +571,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Filter *SockFilter + Len uint16 + Pad_cgo_0 [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -744,6 +594,15 @@ type PtraceRegs struct { Magic uint32 } +type ptracePsw struct { +} + +type ptraceFpregs struct { +} + +type ptracePer struct { +} + type FdSet struct { Bits [16]int64 } @@ -759,11 +618,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 + Pad_cgo_0 [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 - _ [0]int8 - _ [4]byte + X_f [0]int8 + Pad_cgo_1 [4]byte } type Utsname struct { @@ -776,34 +636,26 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - _ [4]byte + Tfree int32 + Pad_cgo_0 [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + Pad_cgo_1 [4]byte } type EpollEvent struct { - Events uint32 - _ int32 - Fd int32 - Pad int32 + Events uint32 + X_padFd int32 + Fd int32 + Pad int32 } const ( - AT_EMPTY_PATH = 0x1000 - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 - - AT_STATX_SYNC_AS_STAT = 0x0 - AT_STATX_FORCE_SYNC = 0x2000 - AT_STATX_DONT_SYNC = 0x4000 - + AT_FDCWD = -0x64 + AT_REMOVEDIR = 0x200 AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 - - AT_EACCESS = 0x200 ) type PollFd struct { @@ -823,38 +675,9 @@ const ( ) type Sigset_t struct { - Val [16]uint64 + X__val [16]uint64 } -const _C__NSIG = 0x41 - -type SignalfdSiginfo struct { - Signo uint32 - Errno int32 - Code int32 - Pid uint32 - Uid uint32 - Fd int32 - Tid uint32 - Band uint32 - Overrun uint32 - Trapno uint32 - Status int32 - Int int32 - Ptr uint64 - Utime uint64 - Stime uint64 - Addr uint64 - Addr_lsb uint16 - _ uint16 - Syscall int32 - Call_addr uint64 - Arch uint32 - _ [28]uint8 -} - -const PERF_IOC_FLAG_GROUP = 0x1 - type Termios struct { Iflag uint32 Oflag uint32 @@ -865,1602 +688,3 @@ type Termios struct { Ispeed uint32 Ospeed uint32 } - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -type Taskstats struct { - Version uint16 - Ac_exitcode uint32 - Ac_flag uint8 - Ac_nice uint8 - Cpu_count uint64 - Cpu_delay_total uint64 - Blkio_count uint64 - Blkio_delay_total uint64 - Swapin_count uint64 - Swapin_delay_total uint64 - Cpu_run_real_total uint64 - Cpu_run_virtual_total uint64 - Ac_comm [32]int8 - Ac_sched uint8 - Ac_pad [3]uint8 - _ [4]byte - Ac_uid uint32 - Ac_gid uint32 - Ac_pid uint32 - Ac_ppid uint32 - Ac_btime uint32 - Ac_etime uint64 - Ac_utime uint64 - Ac_stime uint64 - Ac_minflt uint64 - Ac_majflt uint64 - Coremem uint64 - Virtmem uint64 - Hiwater_rss uint64 - Hiwater_vm uint64 - Read_char uint64 - Write_char uint64 - Read_syscalls uint64 - Write_syscalls uint64 - Read_bytes uint64 - Write_bytes uint64 - Cancelled_write_bytes uint64 - Nvcsw uint64 - Nivcsw uint64 - Ac_utimescaled uint64 - Ac_stimescaled uint64 - Cpu_scaled_run_real_total uint64 - Freepages_count uint64 - Freepages_delay_total uint64 - Thrashing_count uint64 - Thrashing_delay_total uint64 -} - -const ( - TASKSTATS_CMD_UNSPEC = 0x0 - TASKSTATS_CMD_GET = 0x1 - TASKSTATS_CMD_NEW = 0x2 - TASKSTATS_TYPE_UNSPEC = 0x0 - TASKSTATS_TYPE_PID = 0x1 - TASKSTATS_TYPE_TGID = 0x2 - TASKSTATS_TYPE_STATS = 0x3 - TASKSTATS_TYPE_AGGR_PID = 0x4 - TASKSTATS_TYPE_AGGR_TGID = 0x5 - TASKSTATS_TYPE_NULL = 0x6 - TASKSTATS_CMD_ATTR_UNSPEC = 0x0 - TASKSTATS_CMD_ATTR_PID = 0x1 - TASKSTATS_CMD_ATTR_TGID = 0x2 - TASKSTATS_CMD_ATTR_REGISTER_CPUMASK = 0x3 - TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4 -) - -type CGroupStats struct { - Sleeping uint64 - Running uint64 - Stopped uint64 - Uninterruptible uint64 - Io_wait uint64 -} - -const ( - CGROUPSTATS_CMD_UNSPEC = 0x3 - CGROUPSTATS_CMD_GET = 0x4 - CGROUPSTATS_CMD_NEW = 0x5 - CGROUPSTATS_TYPE_UNSPEC = 0x0 - CGROUPSTATS_TYPE_CGROUP_STATS = 0x1 - CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0 - CGROUPSTATS_CMD_ATTR_FD = 0x1 -) - -type Genlmsghdr struct { - Cmd uint8 - Version uint8 - Reserved uint16 -} - -const ( - CTRL_CMD_UNSPEC = 0x0 - CTRL_CMD_NEWFAMILY = 0x1 - CTRL_CMD_DELFAMILY = 0x2 - CTRL_CMD_GETFAMILY = 0x3 - CTRL_CMD_NEWOPS = 0x4 - CTRL_CMD_DELOPS = 0x5 - CTRL_CMD_GETOPS = 0x6 - CTRL_CMD_NEWMCAST_GRP = 0x7 - CTRL_CMD_DELMCAST_GRP = 0x8 - CTRL_CMD_GETMCAST_GRP = 0x9 - CTRL_ATTR_UNSPEC = 0x0 - CTRL_ATTR_FAMILY_ID = 0x1 - CTRL_ATTR_FAMILY_NAME = 0x2 - CTRL_ATTR_VERSION = 0x3 - CTRL_ATTR_HDRSIZE = 0x4 - CTRL_ATTR_MAXATTR = 0x5 - CTRL_ATTR_OPS = 0x6 - CTRL_ATTR_MCAST_GROUPS = 0x7 - CTRL_ATTR_OP_UNSPEC = 0x0 - CTRL_ATTR_OP_ID = 0x1 - CTRL_ATTR_OP_FLAGS = 0x2 - CTRL_ATTR_MCAST_GRP_UNSPEC = 0x0 - CTRL_ATTR_MCAST_GRP_NAME = 0x1 - CTRL_ATTR_MCAST_GRP_ID = 0x2 -) - -type cpuMask uint64 - -const ( - _CPU_SETSIZE = 0x400 - _NCPUBITS = 0x40 -) - -const ( - BDADDR_BREDR = 0x0 - BDADDR_LE_PUBLIC = 0x1 - BDADDR_LE_RANDOM = 0x2 -) - -type PerfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - -type PerfEventMmapPage struct { - Version uint32 - Compat_version uint32 - Lock uint32 - Index uint32 - Offset int64 - Time_enabled uint64 - Time_running uint64 - Capabilities uint64 - Pmc_width uint16 - Time_shift uint16 - Time_mult uint32 - Time_offset uint64 - Time_zero uint64 - Size uint32 - _ [948]uint8 - Data_head uint64 - Data_tail uint64 - Data_offset uint64 - Data_size uint64 - Aux_head uint64 - Aux_tail uint64 - Aux_offset uint64 - Aux_size uint64 -} - -const ( - PerfBitDisabled uint64 = CBitFieldMaskBit0 - PerfBitInherit = CBitFieldMaskBit1 - PerfBitPinned = CBitFieldMaskBit2 - PerfBitExclusive = CBitFieldMaskBit3 - PerfBitExcludeUser = CBitFieldMaskBit4 - PerfBitExcludeKernel = CBitFieldMaskBit5 - PerfBitExcludeHv = CBitFieldMaskBit6 - PerfBitExcludeIdle = CBitFieldMaskBit7 - PerfBitMmap = CBitFieldMaskBit8 - PerfBitComm = CBitFieldMaskBit9 - PerfBitFreq = CBitFieldMaskBit10 - PerfBitInheritStat = CBitFieldMaskBit11 - PerfBitEnableOnExec = CBitFieldMaskBit12 - PerfBitTask = CBitFieldMaskBit13 - PerfBitWatermark = CBitFieldMaskBit14 - PerfBitPreciseIPBit1 = CBitFieldMaskBit15 - PerfBitPreciseIPBit2 = CBitFieldMaskBit16 - PerfBitMmapData = CBitFieldMaskBit17 - PerfBitSampleIDAll = CBitFieldMaskBit18 - PerfBitExcludeHost = CBitFieldMaskBit19 - PerfBitExcludeGuest = CBitFieldMaskBit20 - PerfBitExcludeCallchainKernel = CBitFieldMaskBit21 - PerfBitExcludeCallchainUser = CBitFieldMaskBit22 - PerfBitMmap2 = CBitFieldMaskBit23 - PerfBitCommExec = CBitFieldMaskBit24 - PerfBitUseClockID = CBitFieldMaskBit25 - PerfBitContextSwitch = CBitFieldMaskBit26 -) - -const ( - PERF_TYPE_HARDWARE = 0x0 - PERF_TYPE_SOFTWARE = 0x1 - PERF_TYPE_TRACEPOINT = 0x2 - PERF_TYPE_HW_CACHE = 0x3 - PERF_TYPE_RAW = 0x4 - PERF_TYPE_BREAKPOINT = 0x5 - - PERF_COUNT_HW_CPU_CYCLES = 0x0 - PERF_COUNT_HW_INSTRUCTIONS = 0x1 - PERF_COUNT_HW_CACHE_REFERENCES = 0x2 - PERF_COUNT_HW_CACHE_MISSES = 0x3 - PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 - PERF_COUNT_HW_BRANCH_MISSES = 0x5 - PERF_COUNT_HW_BUS_CYCLES = 0x6 - PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 - PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 - PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - - PERF_COUNT_HW_CACHE_L1D = 0x0 - PERF_COUNT_HW_CACHE_L1I = 0x1 - PERF_COUNT_HW_CACHE_LL = 0x2 - PERF_COUNT_HW_CACHE_DTLB = 0x3 - PERF_COUNT_HW_CACHE_ITLB = 0x4 - PERF_COUNT_HW_CACHE_BPU = 0x5 - PERF_COUNT_HW_CACHE_NODE = 0x6 - - PERF_COUNT_HW_CACHE_OP_READ = 0x0 - PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 - PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - - PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 - PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - - PERF_COUNT_SW_CPU_CLOCK = 0x0 - PERF_COUNT_SW_TASK_CLOCK = 0x1 - PERF_COUNT_SW_PAGE_FAULTS = 0x2 - PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 - PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 - PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 - PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 - PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 - PERF_COUNT_SW_EMULATION_FAULTS = 0x8 - PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa - - PERF_SAMPLE_IP = 0x1 - PERF_SAMPLE_TID = 0x2 - PERF_SAMPLE_TIME = 0x4 - PERF_SAMPLE_ADDR = 0x8 - PERF_SAMPLE_READ = 0x10 - PERF_SAMPLE_CALLCHAIN = 0x20 - PERF_SAMPLE_ID = 0x40 - PERF_SAMPLE_CPU = 0x80 - PERF_SAMPLE_PERIOD = 0x100 - PERF_SAMPLE_STREAM_ID = 0x200 - PERF_SAMPLE_RAW = 0x400 - PERF_SAMPLE_BRANCH_STACK = 0x800 - - PERF_SAMPLE_BRANCH_USER = 0x1 - PERF_SAMPLE_BRANCH_KERNEL = 0x2 - PERF_SAMPLE_BRANCH_HV = 0x4 - PERF_SAMPLE_BRANCH_ANY = 0x8 - PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 - PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 - PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - - PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 - PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 - PERF_FORMAT_ID = 0x4 - PERF_FORMAT_GROUP = 0x8 - - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 - - PERF_CONTEXT_HV = -0x20 - PERF_CONTEXT_KERNEL = -0x80 - PERF_CONTEXT_USER = -0x200 - - PERF_CONTEXT_GUEST = -0x800 - PERF_CONTEXT_GUEST_KERNEL = -0x880 - PERF_CONTEXT_GUEST_USER = -0xa00 - - PERF_FLAG_FD_NO_GROUP = 0x1 - PERF_FLAG_FD_OUTPUT = 0x2 - PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 -) - -const ( - CBitFieldMaskBit0 = 0x8000000000000000 - CBitFieldMaskBit1 = 0x4000000000000000 - CBitFieldMaskBit2 = 0x2000000000000000 - CBitFieldMaskBit3 = 0x1000000000000000 - CBitFieldMaskBit4 = 0x800000000000000 - CBitFieldMaskBit5 = 0x400000000000000 - CBitFieldMaskBit6 = 0x200000000000000 - CBitFieldMaskBit7 = 0x100000000000000 - CBitFieldMaskBit8 = 0x80000000000000 - CBitFieldMaskBit9 = 0x40000000000000 - CBitFieldMaskBit10 = 0x20000000000000 - CBitFieldMaskBit11 = 0x10000000000000 - CBitFieldMaskBit12 = 0x8000000000000 - CBitFieldMaskBit13 = 0x4000000000000 - CBitFieldMaskBit14 = 0x2000000000000 - CBitFieldMaskBit15 = 0x1000000000000 - CBitFieldMaskBit16 = 0x800000000000 - CBitFieldMaskBit17 = 0x400000000000 - CBitFieldMaskBit18 = 0x200000000000 - CBitFieldMaskBit19 = 0x100000000000 - CBitFieldMaskBit20 = 0x80000000000 - CBitFieldMaskBit21 = 0x40000000000 - CBitFieldMaskBit22 = 0x20000000000 - CBitFieldMaskBit23 = 0x10000000000 - CBitFieldMaskBit24 = 0x8000000000 - CBitFieldMaskBit25 = 0x4000000000 - CBitFieldMaskBit26 = 0x2000000000 - CBitFieldMaskBit27 = 0x1000000000 - CBitFieldMaskBit28 = 0x800000000 - CBitFieldMaskBit29 = 0x400000000 - CBitFieldMaskBit30 = 0x200000000 - CBitFieldMaskBit31 = 0x100000000 - CBitFieldMaskBit32 = 0x80000000 - CBitFieldMaskBit33 = 0x40000000 - CBitFieldMaskBit34 = 0x20000000 - CBitFieldMaskBit35 = 0x10000000 - CBitFieldMaskBit36 = 0x8000000 - CBitFieldMaskBit37 = 0x4000000 - CBitFieldMaskBit38 = 0x2000000 - CBitFieldMaskBit39 = 0x1000000 - CBitFieldMaskBit40 = 0x800000 - CBitFieldMaskBit41 = 0x400000 - CBitFieldMaskBit42 = 0x200000 - CBitFieldMaskBit43 = 0x100000 - CBitFieldMaskBit44 = 0x80000 - CBitFieldMaskBit45 = 0x40000 - CBitFieldMaskBit46 = 0x20000 - CBitFieldMaskBit47 = 0x10000 - CBitFieldMaskBit48 = 0x8000 - CBitFieldMaskBit49 = 0x4000 - CBitFieldMaskBit50 = 0x2000 - CBitFieldMaskBit51 = 0x1000 - CBitFieldMaskBit52 = 0x800 - CBitFieldMaskBit53 = 0x400 - CBitFieldMaskBit54 = 0x200 - CBitFieldMaskBit55 = 0x100 - CBitFieldMaskBit56 = 0x80 - CBitFieldMaskBit57 = 0x40 - CBitFieldMaskBit58 = 0x20 - CBitFieldMaskBit59 = 0x10 - CBitFieldMaskBit60 = 0x8 - CBitFieldMaskBit61 = 0x4 - CBitFieldMaskBit62 = 0x2 - CBitFieldMaskBit63 = 0x1 -) - -type SockaddrStorage struct { - Family uint16 - _ [118]int8 - _ uint64 -} - -type TCPMD5Sig struct { - Addr SockaddrStorage - Flags uint8 - Prefixlen uint8 - Keylen uint16 - _ uint32 - Key [80]uint8 -} - -type HDDriveCmdHdr struct { - Command uint8 - Number uint8 - Feature uint8 - Count uint8 -} - -type HDGeometry struct { - Heads uint8 - Sectors uint8 - Cylinders uint16 - Start uint64 -} - -type HDDriveID struct { - Config uint16 - Cyls uint16 - Reserved2 uint16 - Heads uint16 - Track_bytes uint16 - Sector_bytes uint16 - Sectors uint16 - Vendor0 uint16 - Vendor1 uint16 - Vendor2 uint16 - Serial_no [20]uint8 - Buf_type uint16 - Buf_size uint16 - Ecc_bytes uint16 - Fw_rev [8]uint8 - Model [40]uint8 - Max_multsect uint8 - Vendor3 uint8 - Dword_io uint16 - Vendor4 uint8 - Capability uint8 - Reserved50 uint16 - Vendor5 uint8 - TPIO uint8 - Vendor6 uint8 - TDMA uint8 - Field_valid uint16 - Cur_cyls uint16 - Cur_heads uint16 - Cur_sectors uint16 - Cur_capacity0 uint16 - Cur_capacity1 uint16 - Multsect uint8 - Multsect_valid uint8 - Lba_capacity uint32 - Dma_1word uint16 - Dma_mword uint16 - Eide_pio_modes uint16 - Eide_dma_min uint16 - Eide_dma_time uint16 - Eide_pio uint16 - Eide_pio_iordy uint16 - Words69_70 [2]uint16 - Words71_74 [4]uint16 - Queue_depth uint16 - Words76_79 [4]uint16 - Major_rev_num uint16 - Minor_rev_num uint16 - Command_set_1 uint16 - Command_set_2 uint16 - Cfsse uint16 - Cfs_enable_1 uint16 - Cfs_enable_2 uint16 - Csf_default uint16 - Dma_ultra uint16 - Trseuc uint16 - TrsEuc uint16 - CurAPMvalues uint16 - Mprc uint16 - Hw_config uint16 - Acoustic uint16 - Msrqs uint16 - Sxfert uint16 - Sal uint16 - Spg uint32 - Lba_capacity_2 uint64 - Words104_125 [22]uint16 - Last_lun uint16 - Word127 uint16 - Dlf uint16 - Csfo uint16 - Words130_155 [26]uint16 - Word156 uint16 - Words157_159 [3]uint16 - Cfa_power uint16 - Words161_175 [15]uint16 - Words176_205 [30]uint16 - Words206_254 [49]uint16 - Integrity_word uint16 -} - -type Statfs_t struct { - Type int64 - Bsize int64 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Namelen int64 - Frsize int64 - Flags int64 - Spare [4]int64 -} - -const ( - ST_MANDLOCK = 0x40 - ST_NOATIME = 0x400 - ST_NODEV = 0x4 - ST_NODIRATIME = 0x800 - ST_NOEXEC = 0x8 - ST_NOSUID = 0x2 - ST_RDONLY = 0x1 - ST_RELATIME = 0x1000 - ST_SYNCHRONOUS = 0x10 -) - -type TpacketHdr struct { - Status uint64 - Len uint32 - Snaplen uint32 - Mac uint16 - Net uint16 - Sec uint32 - Usec uint32 - _ [4]byte -} - -type Tpacket2Hdr struct { - Status uint32 - Len uint32 - Snaplen uint32 - Mac uint16 - Net uint16 - Sec uint32 - Nsec uint32 - Vlan_tci uint16 - Vlan_tpid uint16 - _ [4]uint8 -} - -type Tpacket3Hdr struct { - Next_offset uint32 - Sec uint32 - Nsec uint32 - Snaplen uint32 - Len uint32 - Status uint32 - Mac uint16 - Net uint16 - Hv1 TpacketHdrVariant1 - _ [8]uint8 -} - -type TpacketHdrVariant1 struct { - Rxhash uint32 - Vlan_tci uint32 - Vlan_tpid uint16 - _ uint16 -} - -type TpacketBlockDesc struct { - Version uint32 - To_priv uint32 - Hdr [40]byte -} - -type TpacketBDTS struct { - Sec uint32 - Usec uint32 -} - -type TpacketHdrV1 struct { - Block_status uint32 - Num_pkts uint32 - Offset_to_first_pkt uint32 - Blk_len uint32 - Seq_num uint64 - Ts_first_pkt TpacketBDTS - Ts_last_pkt TpacketBDTS -} - -type TpacketReq struct { - Block_size uint32 - Block_nr uint32 - Frame_size uint32 - Frame_nr uint32 -} - -type TpacketReq3 struct { - Block_size uint32 - Block_nr uint32 - Frame_size uint32 - Frame_nr uint32 - Retire_blk_tov uint32 - Sizeof_priv uint32 - Feature_req_word uint32 -} - -type TpacketStats struct { - Packets uint32 - Drops uint32 -} - -type TpacketStatsV3 struct { - Packets uint32 - Drops uint32 - Freeze_q_cnt uint32 -} - -type TpacketAuxdata struct { - Status uint32 - Len uint32 - Snaplen uint32 - Mac uint16 - Net uint16 - Vlan_tci uint16 - Vlan_tpid uint16 -} - -const ( - TPACKET_V1 = 0x0 - TPACKET_V2 = 0x1 - TPACKET_V3 = 0x2 -) - -const ( - SizeofTpacketHdr = 0x20 - SizeofTpacket2Hdr = 0x20 - SizeofTpacket3Hdr = 0x30 - - SizeofTpacketStats = 0x8 - SizeofTpacketStatsV3 = 0xc -) - -const ( - NF_INET_PRE_ROUTING = 0x0 - NF_INET_LOCAL_IN = 0x1 - NF_INET_FORWARD = 0x2 - NF_INET_LOCAL_OUT = 0x3 - NF_INET_POST_ROUTING = 0x4 - NF_INET_NUMHOOKS = 0x5 -) - -const ( - NF_NETDEV_INGRESS = 0x0 - NF_NETDEV_NUMHOOKS = 0x1 -) - -const ( - NFPROTO_UNSPEC = 0x0 - NFPROTO_INET = 0x1 - NFPROTO_IPV4 = 0x2 - NFPROTO_ARP = 0x3 - NFPROTO_NETDEV = 0x5 - NFPROTO_BRIDGE = 0x7 - NFPROTO_IPV6 = 0xa - NFPROTO_DECNET = 0xc - NFPROTO_NUMPROTO = 0xd -) - -type Nfgenmsg struct { - Nfgen_family uint8 - Version uint8 - Res_id uint16 -} - -const ( - NFNL_BATCH_UNSPEC = 0x0 - NFNL_BATCH_GENID = 0x1 -) - -const ( - NFT_REG_VERDICT = 0x0 - NFT_REG_1 = 0x1 - NFT_REG_2 = 0x2 - NFT_REG_3 = 0x3 - NFT_REG_4 = 0x4 - NFT_REG32_00 = 0x8 - NFT_REG32_01 = 0x9 - NFT_REG32_02 = 0xa - NFT_REG32_03 = 0xb - NFT_REG32_04 = 0xc - NFT_REG32_05 = 0xd - NFT_REG32_06 = 0xe - NFT_REG32_07 = 0xf - NFT_REG32_08 = 0x10 - NFT_REG32_09 = 0x11 - NFT_REG32_10 = 0x12 - NFT_REG32_11 = 0x13 - NFT_REG32_12 = 0x14 - NFT_REG32_13 = 0x15 - NFT_REG32_14 = 0x16 - NFT_REG32_15 = 0x17 - NFT_CONTINUE = -0x1 - NFT_BREAK = -0x2 - NFT_JUMP = -0x3 - NFT_GOTO = -0x4 - NFT_RETURN = -0x5 - NFT_MSG_NEWTABLE = 0x0 - NFT_MSG_GETTABLE = 0x1 - NFT_MSG_DELTABLE = 0x2 - NFT_MSG_NEWCHAIN = 0x3 - NFT_MSG_GETCHAIN = 0x4 - NFT_MSG_DELCHAIN = 0x5 - NFT_MSG_NEWRULE = 0x6 - NFT_MSG_GETRULE = 0x7 - NFT_MSG_DELRULE = 0x8 - NFT_MSG_NEWSET = 0x9 - NFT_MSG_GETSET = 0xa - NFT_MSG_DELSET = 0xb - NFT_MSG_NEWSETELEM = 0xc - NFT_MSG_GETSETELEM = 0xd - NFT_MSG_DELSETELEM = 0xe - NFT_MSG_NEWGEN = 0xf - NFT_MSG_GETGEN = 0x10 - NFT_MSG_TRACE = 0x11 - NFT_MSG_NEWOBJ = 0x12 - NFT_MSG_GETOBJ = 0x13 - NFT_MSG_DELOBJ = 0x14 - NFT_MSG_GETOBJ_RESET = 0x15 - NFT_MSG_MAX = 0x19 - NFTA_LIST_UNPEC = 0x0 - NFTA_LIST_ELEM = 0x1 - NFTA_HOOK_UNSPEC = 0x0 - NFTA_HOOK_HOOKNUM = 0x1 - NFTA_HOOK_PRIORITY = 0x2 - NFTA_HOOK_DEV = 0x3 - NFT_TABLE_F_DORMANT = 0x1 - NFTA_TABLE_UNSPEC = 0x0 - NFTA_TABLE_NAME = 0x1 - NFTA_TABLE_FLAGS = 0x2 - NFTA_TABLE_USE = 0x3 - NFTA_CHAIN_UNSPEC = 0x0 - NFTA_CHAIN_TABLE = 0x1 - NFTA_CHAIN_HANDLE = 0x2 - NFTA_CHAIN_NAME = 0x3 - NFTA_CHAIN_HOOK = 0x4 - NFTA_CHAIN_POLICY = 0x5 - NFTA_CHAIN_USE = 0x6 - NFTA_CHAIN_TYPE = 0x7 - NFTA_CHAIN_COUNTERS = 0x8 - NFTA_CHAIN_PAD = 0x9 - NFTA_RULE_UNSPEC = 0x0 - NFTA_RULE_TABLE = 0x1 - NFTA_RULE_CHAIN = 0x2 - NFTA_RULE_HANDLE = 0x3 - NFTA_RULE_EXPRESSIONS = 0x4 - NFTA_RULE_COMPAT = 0x5 - NFTA_RULE_POSITION = 0x6 - NFTA_RULE_USERDATA = 0x7 - NFTA_RULE_PAD = 0x8 - NFTA_RULE_ID = 0x9 - NFT_RULE_COMPAT_F_INV = 0x2 - NFT_RULE_COMPAT_F_MASK = 0x2 - NFTA_RULE_COMPAT_UNSPEC = 0x0 - NFTA_RULE_COMPAT_PROTO = 0x1 - NFTA_RULE_COMPAT_FLAGS = 0x2 - NFT_SET_ANONYMOUS = 0x1 - NFT_SET_CONSTANT = 0x2 - NFT_SET_INTERVAL = 0x4 - NFT_SET_MAP = 0x8 - NFT_SET_TIMEOUT = 0x10 - NFT_SET_EVAL = 0x20 - NFT_SET_OBJECT = 0x40 - NFT_SET_POL_PERFORMANCE = 0x0 - NFT_SET_POL_MEMORY = 0x1 - NFTA_SET_DESC_UNSPEC = 0x0 - NFTA_SET_DESC_SIZE = 0x1 - NFTA_SET_UNSPEC = 0x0 - NFTA_SET_TABLE = 0x1 - NFTA_SET_NAME = 0x2 - NFTA_SET_FLAGS = 0x3 - NFTA_SET_KEY_TYPE = 0x4 - NFTA_SET_KEY_LEN = 0x5 - NFTA_SET_DATA_TYPE = 0x6 - NFTA_SET_DATA_LEN = 0x7 - NFTA_SET_POLICY = 0x8 - NFTA_SET_DESC = 0x9 - NFTA_SET_ID = 0xa - NFTA_SET_TIMEOUT = 0xb - NFTA_SET_GC_INTERVAL = 0xc - NFTA_SET_USERDATA = 0xd - NFTA_SET_PAD = 0xe - NFTA_SET_OBJ_TYPE = 0xf - NFT_SET_ELEM_INTERVAL_END = 0x1 - NFTA_SET_ELEM_UNSPEC = 0x0 - NFTA_SET_ELEM_KEY = 0x1 - NFTA_SET_ELEM_DATA = 0x2 - NFTA_SET_ELEM_FLAGS = 0x3 - NFTA_SET_ELEM_TIMEOUT = 0x4 - NFTA_SET_ELEM_EXPIRATION = 0x5 - NFTA_SET_ELEM_USERDATA = 0x6 - NFTA_SET_ELEM_EXPR = 0x7 - NFTA_SET_ELEM_PAD = 0x8 - NFTA_SET_ELEM_OBJREF = 0x9 - NFTA_SET_ELEM_LIST_UNSPEC = 0x0 - NFTA_SET_ELEM_LIST_TABLE = 0x1 - NFTA_SET_ELEM_LIST_SET = 0x2 - NFTA_SET_ELEM_LIST_ELEMENTS = 0x3 - NFTA_SET_ELEM_LIST_SET_ID = 0x4 - NFT_DATA_VALUE = 0x0 - NFT_DATA_VERDICT = 0xffffff00 - NFTA_DATA_UNSPEC = 0x0 - NFTA_DATA_VALUE = 0x1 - NFTA_DATA_VERDICT = 0x2 - NFTA_VERDICT_UNSPEC = 0x0 - NFTA_VERDICT_CODE = 0x1 - NFTA_VERDICT_CHAIN = 0x2 - NFTA_EXPR_UNSPEC = 0x0 - NFTA_EXPR_NAME = 0x1 - NFTA_EXPR_DATA = 0x2 - NFTA_IMMEDIATE_UNSPEC = 0x0 - NFTA_IMMEDIATE_DREG = 0x1 - NFTA_IMMEDIATE_DATA = 0x2 - NFTA_BITWISE_UNSPEC = 0x0 - NFTA_BITWISE_SREG = 0x1 - NFTA_BITWISE_DREG = 0x2 - NFTA_BITWISE_LEN = 0x3 - NFTA_BITWISE_MASK = 0x4 - NFTA_BITWISE_XOR = 0x5 - NFT_BYTEORDER_NTOH = 0x0 - NFT_BYTEORDER_HTON = 0x1 - NFTA_BYTEORDER_UNSPEC = 0x0 - NFTA_BYTEORDER_SREG = 0x1 - NFTA_BYTEORDER_DREG = 0x2 - NFTA_BYTEORDER_OP = 0x3 - NFTA_BYTEORDER_LEN = 0x4 - NFTA_BYTEORDER_SIZE = 0x5 - NFT_CMP_EQ = 0x0 - NFT_CMP_NEQ = 0x1 - NFT_CMP_LT = 0x2 - NFT_CMP_LTE = 0x3 - NFT_CMP_GT = 0x4 - NFT_CMP_GTE = 0x5 - NFTA_CMP_UNSPEC = 0x0 - NFTA_CMP_SREG = 0x1 - NFTA_CMP_OP = 0x2 - NFTA_CMP_DATA = 0x3 - NFT_RANGE_EQ = 0x0 - NFT_RANGE_NEQ = 0x1 - NFTA_RANGE_UNSPEC = 0x0 - NFTA_RANGE_SREG = 0x1 - NFTA_RANGE_OP = 0x2 - NFTA_RANGE_FROM_DATA = 0x3 - NFTA_RANGE_TO_DATA = 0x4 - NFT_LOOKUP_F_INV = 0x1 - NFTA_LOOKUP_UNSPEC = 0x0 - NFTA_LOOKUP_SET = 0x1 - NFTA_LOOKUP_SREG = 0x2 - NFTA_LOOKUP_DREG = 0x3 - NFTA_LOOKUP_SET_ID = 0x4 - NFTA_LOOKUP_FLAGS = 0x5 - NFT_DYNSET_OP_ADD = 0x0 - NFT_DYNSET_OP_UPDATE = 0x1 - NFT_DYNSET_F_INV = 0x1 - NFTA_DYNSET_UNSPEC = 0x0 - NFTA_DYNSET_SET_NAME = 0x1 - NFTA_DYNSET_SET_ID = 0x2 - NFTA_DYNSET_OP = 0x3 - NFTA_DYNSET_SREG_KEY = 0x4 - NFTA_DYNSET_SREG_DATA = 0x5 - NFTA_DYNSET_TIMEOUT = 0x6 - NFTA_DYNSET_EXPR = 0x7 - NFTA_DYNSET_PAD = 0x8 - NFTA_DYNSET_FLAGS = 0x9 - NFT_PAYLOAD_LL_HEADER = 0x0 - NFT_PAYLOAD_NETWORK_HEADER = 0x1 - NFT_PAYLOAD_TRANSPORT_HEADER = 0x2 - NFT_PAYLOAD_CSUM_NONE = 0x0 - NFT_PAYLOAD_CSUM_INET = 0x1 - NFT_PAYLOAD_L4CSUM_PSEUDOHDR = 0x1 - NFTA_PAYLOAD_UNSPEC = 0x0 - NFTA_PAYLOAD_DREG = 0x1 - NFTA_PAYLOAD_BASE = 0x2 - NFTA_PAYLOAD_OFFSET = 0x3 - NFTA_PAYLOAD_LEN = 0x4 - NFTA_PAYLOAD_SREG = 0x5 - NFTA_PAYLOAD_CSUM_TYPE = 0x6 - NFTA_PAYLOAD_CSUM_OFFSET = 0x7 - NFTA_PAYLOAD_CSUM_FLAGS = 0x8 - NFT_EXTHDR_F_PRESENT = 0x1 - NFT_EXTHDR_OP_IPV6 = 0x0 - NFT_EXTHDR_OP_TCPOPT = 0x1 - NFTA_EXTHDR_UNSPEC = 0x0 - NFTA_EXTHDR_DREG = 0x1 - NFTA_EXTHDR_TYPE = 0x2 - NFTA_EXTHDR_OFFSET = 0x3 - NFTA_EXTHDR_LEN = 0x4 - NFTA_EXTHDR_FLAGS = 0x5 - NFTA_EXTHDR_OP = 0x6 - NFTA_EXTHDR_SREG = 0x7 - NFT_META_LEN = 0x0 - NFT_META_PROTOCOL = 0x1 - NFT_META_PRIORITY = 0x2 - NFT_META_MARK = 0x3 - NFT_META_IIF = 0x4 - NFT_META_OIF = 0x5 - NFT_META_IIFNAME = 0x6 - NFT_META_OIFNAME = 0x7 - NFT_META_IIFTYPE = 0x8 - NFT_META_OIFTYPE = 0x9 - NFT_META_SKUID = 0xa - NFT_META_SKGID = 0xb - NFT_META_NFTRACE = 0xc - NFT_META_RTCLASSID = 0xd - NFT_META_SECMARK = 0xe - NFT_META_NFPROTO = 0xf - NFT_META_L4PROTO = 0x10 - NFT_META_BRI_IIFNAME = 0x11 - NFT_META_BRI_OIFNAME = 0x12 - NFT_META_PKTTYPE = 0x13 - NFT_META_CPU = 0x14 - NFT_META_IIFGROUP = 0x15 - NFT_META_OIFGROUP = 0x16 - NFT_META_CGROUP = 0x17 - NFT_META_PRANDOM = 0x18 - NFT_RT_CLASSID = 0x0 - NFT_RT_NEXTHOP4 = 0x1 - NFT_RT_NEXTHOP6 = 0x2 - NFT_RT_TCPMSS = 0x3 - NFT_HASH_JENKINS = 0x0 - NFT_HASH_SYM = 0x1 - NFTA_HASH_UNSPEC = 0x0 - NFTA_HASH_SREG = 0x1 - NFTA_HASH_DREG = 0x2 - NFTA_HASH_LEN = 0x3 - NFTA_HASH_MODULUS = 0x4 - NFTA_HASH_SEED = 0x5 - NFTA_HASH_OFFSET = 0x6 - NFTA_HASH_TYPE = 0x7 - NFTA_META_UNSPEC = 0x0 - NFTA_META_DREG = 0x1 - NFTA_META_KEY = 0x2 - NFTA_META_SREG = 0x3 - NFTA_RT_UNSPEC = 0x0 - NFTA_RT_DREG = 0x1 - NFTA_RT_KEY = 0x2 - NFT_CT_STATE = 0x0 - NFT_CT_DIRECTION = 0x1 - NFT_CT_STATUS = 0x2 - NFT_CT_MARK = 0x3 - NFT_CT_SECMARK = 0x4 - NFT_CT_EXPIRATION = 0x5 - NFT_CT_HELPER = 0x6 - NFT_CT_L3PROTOCOL = 0x7 - NFT_CT_SRC = 0x8 - NFT_CT_DST = 0x9 - NFT_CT_PROTOCOL = 0xa - NFT_CT_PROTO_SRC = 0xb - NFT_CT_PROTO_DST = 0xc - NFT_CT_LABELS = 0xd - NFT_CT_PKTS = 0xe - NFT_CT_BYTES = 0xf - NFT_CT_AVGPKT = 0x10 - NFT_CT_ZONE = 0x11 - NFT_CT_EVENTMASK = 0x12 - NFTA_CT_UNSPEC = 0x0 - NFTA_CT_DREG = 0x1 - NFTA_CT_KEY = 0x2 - NFTA_CT_DIRECTION = 0x3 - NFTA_CT_SREG = 0x4 - NFT_LIMIT_PKTS = 0x0 - NFT_LIMIT_PKT_BYTES = 0x1 - NFT_LIMIT_F_INV = 0x1 - NFTA_LIMIT_UNSPEC = 0x0 - NFTA_LIMIT_RATE = 0x1 - NFTA_LIMIT_UNIT = 0x2 - NFTA_LIMIT_BURST = 0x3 - NFTA_LIMIT_TYPE = 0x4 - NFTA_LIMIT_FLAGS = 0x5 - NFTA_LIMIT_PAD = 0x6 - NFTA_COUNTER_UNSPEC = 0x0 - NFTA_COUNTER_BYTES = 0x1 - NFTA_COUNTER_PACKETS = 0x2 - NFTA_COUNTER_PAD = 0x3 - NFTA_LOG_UNSPEC = 0x0 - NFTA_LOG_GROUP = 0x1 - NFTA_LOG_PREFIX = 0x2 - NFTA_LOG_SNAPLEN = 0x3 - NFTA_LOG_QTHRESHOLD = 0x4 - NFTA_LOG_LEVEL = 0x5 - NFTA_LOG_FLAGS = 0x6 - NFTA_QUEUE_UNSPEC = 0x0 - NFTA_QUEUE_NUM = 0x1 - NFTA_QUEUE_TOTAL = 0x2 - NFTA_QUEUE_FLAGS = 0x3 - NFTA_QUEUE_SREG_QNUM = 0x4 - NFT_QUOTA_F_INV = 0x1 - NFT_QUOTA_F_DEPLETED = 0x2 - NFTA_QUOTA_UNSPEC = 0x0 - NFTA_QUOTA_BYTES = 0x1 - NFTA_QUOTA_FLAGS = 0x2 - NFTA_QUOTA_PAD = 0x3 - NFTA_QUOTA_CONSUMED = 0x4 - NFT_REJECT_ICMP_UNREACH = 0x0 - NFT_REJECT_TCP_RST = 0x1 - NFT_REJECT_ICMPX_UNREACH = 0x2 - NFT_REJECT_ICMPX_NO_ROUTE = 0x0 - NFT_REJECT_ICMPX_PORT_UNREACH = 0x1 - NFT_REJECT_ICMPX_HOST_UNREACH = 0x2 - NFT_REJECT_ICMPX_ADMIN_PROHIBITED = 0x3 - NFTA_REJECT_UNSPEC = 0x0 - NFTA_REJECT_TYPE = 0x1 - NFTA_REJECT_ICMP_CODE = 0x2 - NFT_NAT_SNAT = 0x0 - NFT_NAT_DNAT = 0x1 - NFTA_NAT_UNSPEC = 0x0 - NFTA_NAT_TYPE = 0x1 - NFTA_NAT_FAMILY = 0x2 - NFTA_NAT_REG_ADDR_MIN = 0x3 - NFTA_NAT_REG_ADDR_MAX = 0x4 - NFTA_NAT_REG_PROTO_MIN = 0x5 - NFTA_NAT_REG_PROTO_MAX = 0x6 - NFTA_NAT_FLAGS = 0x7 - NFTA_MASQ_UNSPEC = 0x0 - NFTA_MASQ_FLAGS = 0x1 - NFTA_MASQ_REG_PROTO_MIN = 0x2 - NFTA_MASQ_REG_PROTO_MAX = 0x3 - NFTA_REDIR_UNSPEC = 0x0 - NFTA_REDIR_REG_PROTO_MIN = 0x1 - NFTA_REDIR_REG_PROTO_MAX = 0x2 - NFTA_REDIR_FLAGS = 0x3 - NFTA_DUP_UNSPEC = 0x0 - NFTA_DUP_SREG_ADDR = 0x1 - NFTA_DUP_SREG_DEV = 0x2 - NFTA_FWD_UNSPEC = 0x0 - NFTA_FWD_SREG_DEV = 0x1 - NFTA_OBJREF_UNSPEC = 0x0 - NFTA_OBJREF_IMM_TYPE = 0x1 - NFTA_OBJREF_IMM_NAME = 0x2 - NFTA_OBJREF_SET_SREG = 0x3 - NFTA_OBJREF_SET_NAME = 0x4 - NFTA_OBJREF_SET_ID = 0x5 - NFTA_GEN_UNSPEC = 0x0 - NFTA_GEN_ID = 0x1 - NFTA_GEN_PROC_PID = 0x2 - NFTA_GEN_PROC_NAME = 0x3 - NFTA_FIB_UNSPEC = 0x0 - NFTA_FIB_DREG = 0x1 - NFTA_FIB_RESULT = 0x2 - NFTA_FIB_FLAGS = 0x3 - NFT_FIB_RESULT_UNSPEC = 0x0 - NFT_FIB_RESULT_OIF = 0x1 - NFT_FIB_RESULT_OIFNAME = 0x2 - NFT_FIB_RESULT_ADDRTYPE = 0x3 - NFTA_FIB_F_SADDR = 0x1 - NFTA_FIB_F_DADDR = 0x2 - NFTA_FIB_F_MARK = 0x4 - NFTA_FIB_F_IIF = 0x8 - NFTA_FIB_F_OIF = 0x10 - NFTA_FIB_F_PRESENT = 0x20 - NFTA_CT_HELPER_UNSPEC = 0x0 - NFTA_CT_HELPER_NAME = 0x1 - NFTA_CT_HELPER_L3PROTO = 0x2 - NFTA_CT_HELPER_L4PROTO = 0x3 - NFTA_OBJ_UNSPEC = 0x0 - NFTA_OBJ_TABLE = 0x1 - NFTA_OBJ_NAME = 0x2 - NFTA_OBJ_TYPE = 0x3 - NFTA_OBJ_DATA = 0x4 - NFTA_OBJ_USE = 0x5 - NFTA_TRACE_UNSPEC = 0x0 - NFTA_TRACE_TABLE = 0x1 - NFTA_TRACE_CHAIN = 0x2 - NFTA_TRACE_RULE_HANDLE = 0x3 - NFTA_TRACE_TYPE = 0x4 - NFTA_TRACE_VERDICT = 0x5 - NFTA_TRACE_ID = 0x6 - NFTA_TRACE_LL_HEADER = 0x7 - NFTA_TRACE_NETWORK_HEADER = 0x8 - NFTA_TRACE_TRANSPORT_HEADER = 0x9 - NFTA_TRACE_IIF = 0xa - NFTA_TRACE_IIFTYPE = 0xb - NFTA_TRACE_OIF = 0xc - NFTA_TRACE_OIFTYPE = 0xd - NFTA_TRACE_MARK = 0xe - NFTA_TRACE_NFPROTO = 0xf - NFTA_TRACE_POLICY = 0x10 - NFTA_TRACE_PAD = 0x11 - NFT_TRACETYPE_UNSPEC = 0x0 - NFT_TRACETYPE_POLICY = 0x1 - NFT_TRACETYPE_RETURN = 0x2 - NFT_TRACETYPE_RULE = 0x3 - NFTA_NG_UNSPEC = 0x0 - NFTA_NG_DREG = 0x1 - NFTA_NG_MODULUS = 0x2 - NFTA_NG_TYPE = 0x3 - NFTA_NG_OFFSET = 0x4 - NFT_NG_INCREMENTAL = 0x0 - NFT_NG_RANDOM = 0x1 -) - -type RTCTime struct { - Sec int32 - Min int32 - Hour int32 - Mday int32 - Mon int32 - Year int32 - Wday int32 - Yday int32 - Isdst int32 -} - -type RTCWkAlrm struct { - Enabled uint8 - Pending uint8 - Time RTCTime -} - -type RTCPLLInfo struct { - Ctrl int32 - Value int32 - Max int32 - Min int32 - Posmult int32 - Negmult int32 - Clock int64 -} - -type BlkpgIoctlArg struct { - Op int32 - Flags int32 - Datalen int32 - Data *byte -} - -type BlkpgPartition struct { - Start int64 - Length int64 - Pno int32 - Devname [64]uint8 - Volname [64]uint8 - _ [4]byte -} - -const ( - BLKPG = 0x20001269 - BLKPG_ADD_PARTITION = 0x1 - BLKPG_DEL_PARTITION = 0x2 - BLKPG_RESIZE_PARTITION = 0x3 -) - -const ( - NETNSA_NONE = 0x0 - NETNSA_NSID = 0x1 - NETNSA_PID = 0x2 - NETNSA_FD = 0x3 -) - -type XDPRingOffset struct { - Producer uint64 - Consumer uint64 - Desc uint64 -} - -type XDPMmapOffsets struct { - Rx XDPRingOffset - Tx XDPRingOffset - Fr XDPRingOffset - Cr XDPRingOffset -} - -type XDPUmemReg struct { - Addr uint64 - Len uint64 - Size uint32 - Headroom uint32 -} - -type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 -} - -type XDPDesc struct { - Addr uint64 - Len uint32 - Options uint32 -} - -const ( - NCSI_CMD_UNSPEC = 0x0 - NCSI_CMD_PKG_INFO = 0x1 - NCSI_CMD_SET_INTERFACE = 0x2 - NCSI_CMD_CLEAR_INTERFACE = 0x3 - NCSI_ATTR_UNSPEC = 0x0 - NCSI_ATTR_IFINDEX = 0x1 - NCSI_ATTR_PACKAGE_LIST = 0x2 - NCSI_ATTR_PACKAGE_ID = 0x3 - NCSI_ATTR_CHANNEL_ID = 0x4 - NCSI_PKG_ATTR_UNSPEC = 0x0 - NCSI_PKG_ATTR = 0x1 - NCSI_PKG_ATTR_ID = 0x2 - NCSI_PKG_ATTR_FORCED = 0x3 - NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 - NCSI_CHANNEL_ATTR_UNSPEC = 0x0 - NCSI_CHANNEL_ATTR = 0x1 - NCSI_CHANNEL_ATTR_ID = 0x2 - NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 - NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 - NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 - NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 - NCSI_CHANNEL_ATTR_ACTIVE = 0x7 - NCSI_CHANNEL_ATTR_FORCED = 0x8 - NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 - NCSI_CHANNEL_ATTR_VLAN_ID = 0xa -) - -type ScmTimestamping struct { - Ts [3]Timespec -} - -const ( - SOF_TIMESTAMPING_TX_HARDWARE = 0x1 - SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 - SOF_TIMESTAMPING_RX_HARDWARE = 0x4 - SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 - SOF_TIMESTAMPING_SOFTWARE = 0x10 - SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 - SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 - SOF_TIMESTAMPING_OPT_ID = 0x80 - SOF_TIMESTAMPING_TX_SCHED = 0x100 - SOF_TIMESTAMPING_TX_ACK = 0x200 - SOF_TIMESTAMPING_OPT_CMSG = 0x400 - SOF_TIMESTAMPING_OPT_TSONLY = 0x800 - SOF_TIMESTAMPING_OPT_STATS = 0x1000 - SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 - SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff - - SCM_TSTAMP_SND = 0x0 - SCM_TSTAMP_SCHED = 0x1 - SCM_TSTAMP_ACK = 0x2 -) - -type SockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type FanotifyEventMetadata struct { - Event_len uint32 - Vers uint8 - Reserved uint8 - Metadata_len uint16 - Mask uint64 - Fd int32 - Pid int32 -} - -type FanotifyResponse struct { - Fd int32 - Response uint32 -} - -const ( - CRYPTO_MSG_BASE = 0x10 - CRYPTO_MSG_NEWALG = 0x10 - CRYPTO_MSG_DELALG = 0x11 - CRYPTO_MSG_UPDATEALG = 0x12 - CRYPTO_MSG_GETALG = 0x13 - CRYPTO_MSG_DELRNG = 0x14 - CRYPTO_MSG_GETSTAT = 0x15 -) - -const ( - CRYPTOCFGA_UNSPEC = 0x0 - CRYPTOCFGA_PRIORITY_VAL = 0x1 - CRYPTOCFGA_REPORT_LARVAL = 0x2 - CRYPTOCFGA_REPORT_HASH = 0x3 - CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 - CRYPTOCFGA_REPORT_AEAD = 0x5 - CRYPTOCFGA_REPORT_COMPRESS = 0x6 - CRYPTOCFGA_REPORT_RNG = 0x7 - CRYPTOCFGA_REPORT_CIPHER = 0x8 - CRYPTOCFGA_REPORT_AKCIPHER = 0x9 - CRYPTOCFGA_REPORT_KPP = 0xa - CRYPTOCFGA_REPORT_ACOMP = 0xb - CRYPTOCFGA_STAT_LARVAL = 0xc - CRYPTOCFGA_STAT_HASH = 0xd - CRYPTOCFGA_STAT_BLKCIPHER = 0xe - CRYPTOCFGA_STAT_AEAD = 0xf - CRYPTOCFGA_STAT_COMPRESS = 0x10 - CRYPTOCFGA_STAT_RNG = 0x11 - CRYPTOCFGA_STAT_CIPHER = 0x12 - CRYPTOCFGA_STAT_AKCIPHER = 0x13 - CRYPTOCFGA_STAT_KPP = 0x14 - CRYPTOCFGA_STAT_ACOMP = 0x15 -) - -type CryptoUserAlg struct { - Name [64]int8 - Driver_name [64]int8 - Module_name [64]int8 - Type uint32 - Mask uint32 - Refcnt uint32 - Flags uint32 -} - -type CryptoStatAEAD struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatAKCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Verify_cnt uint64 - Sign_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatCipher struct { - Type [64]int8 - Encrypt_cnt uint64 - Encrypt_tlen uint64 - Decrypt_cnt uint64 - Decrypt_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatCompress struct { - Type [64]int8 - Compress_cnt uint64 - Compress_tlen uint64 - Decompress_cnt uint64 - Decompress_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatHash struct { - Type [64]int8 - Hash_cnt uint64 - Hash_tlen uint64 - Err_cnt uint64 -} - -type CryptoStatKPP struct { - Type [64]int8 - Setsecret_cnt uint64 - Generate_public_key_cnt uint64 - Compute_shared_secret_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatRNG struct { - Type [64]int8 - Generate_cnt uint64 - Generate_tlen uint64 - Seed_cnt uint64 - Err_cnt uint64 -} - -type CryptoStatLarval struct { - Type [64]int8 -} - -type CryptoReportLarval struct { - Type [64]int8 -} - -type CryptoReportHash struct { - Type [64]int8 - Blocksize uint32 - Digestsize uint32 -} - -type CryptoReportCipher struct { - Type [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 -} - -type CryptoReportBlkCipher struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Min_keysize uint32 - Max_keysize uint32 - Ivsize uint32 -} - -type CryptoReportAEAD struct { - Type [64]int8 - Geniv [64]int8 - Blocksize uint32 - Maxauthsize uint32 - Ivsize uint32 -} - -type CryptoReportComp struct { - Type [64]int8 -} - -type CryptoReportRNG struct { - Type [64]int8 - Seedsize uint32 -} - -type CryptoReportAKCipher struct { - Type [64]int8 -} - -type CryptoReportKPP struct { - Type [64]int8 -} - -type CryptoReportAcomp struct { - Type [64]int8 -} - -const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_ADJ_ROOM_NET = 0x0 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 -) diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index a2268b4f..4b86fb2b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -57,23 +57,23 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 + Dev uint64 + Mode uint32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 } type Statfs_t [0]byte @@ -402,13 +402,6 @@ type Winsize struct { Ypixel uint16 } -type Ptmget struct { - Cfd int32 - Sfd int32 - Cn [1024]byte - Sn [1024]byte -} - const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 @@ -453,13 +446,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 59e1da0a..9048a509 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -58,26 +58,26 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - _ [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - _ [4]byte - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - _ [4]byte + Dev uint64 + Mode uint32 + Pad_cgo_0 [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Pad_cgo_1 [4]byte + Rdev uint64 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + Pad_cgo_2 [4]byte } type Statfs_t [0]byte @@ -409,13 +409,6 @@ type Winsize struct { Ypixel uint16 } -type Ptmget struct { - Cfd int32 - Sfd int32 - Cn [1024]byte - Sn [1024]byte -} - const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 @@ -460,13 +453,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index 1f1f0f38..00525e7b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -59,26 +59,26 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - _ [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - _ [4]byte - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - _ [4]byte + Dev uint64 + Mode uint32 + Pad_cgo_0 [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Pad_cgo_1 [4]byte + Rdev uint64 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + Pad_cgo_2 [4]byte } type Statfs_t [0]byte @@ -407,13 +407,6 @@ type Winsize struct { Ypixel uint16 } -type Ptmget struct { - Cfd int32 - Sfd int32 - Cn [1024]byte - Sn [1024]byte -} - const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 @@ -458,13 +451,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go deleted file mode 100644 index 8dca204a..00000000 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ /dev/null @@ -1,472 +0,0 @@ -// cgo -godefs types_netbsd.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,netbsd - -package unix - -const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int32 - Pad_cgo_0 [4]byte -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev uint64 - Mode uint32 - _ [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - _ [4]byte - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - _ [4]byte -} - -type Statfs_t [0]byte - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Dirent struct { - Fileno uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [512]int8 - Pad_cgo_0 [3]byte -} - -type Fsid struct { - X__fsid_val [2]int32 -} - -const ( - PathMax = 0x400 -) - -const ( - FADV_NORMAL = 0x0 - FADV_RANDOM = 0x1 - FADV_SEQUENTIAL = 0x2 - FADV_WILLNEED = 0x3 - FADV_DONTNEED = 0x4 - FADV_NOREUSE = 0x5 -) - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *Iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint64 - Filter uint32 - Flags uint32 - Fflags uint32 - Pad_cgo_0 [4]byte - Data int64 - Udata int64 -} - -type FdSet struct { - Bits [8]uint32 -} - -const ( - SizeofIfMsghdr = 0x98 - SizeofIfData = 0x88 - SizeofIfaMsghdr = 0x18 - SizeofIfAnnounceMsghdr = 0x18 - SizeofRtMsghdr = 0x78 - SizeofRtMetrics = 0x50 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Pad_cgo_0 [2]byte - Data IfData -} - -type IfData struct { - Type uint8 - Addrlen uint8 - Hdrlen uint8 - Pad_cgo_0 [1]byte - Link_state int32 - Mtu uint64 - Metric uint64 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Noproto uint64 - Lastchange Timespec -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Metric int32 - Index uint16 - Pad_cgo_0 [6]byte -} - -type IfAnnounceMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Name [16]int8 - What uint16 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Pad_cgo_0 [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits int32 - Pad_cgo_1 [4]byte - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint64 - Mtu uint64 - Hopcount uint64 - Recvpipe uint64 - Sendpipe uint64 - Ssthresh uint64 - Rtt uint64 - Rttvar uint64 - Expire int64 - Pksent int64 -} - -type Mclpool [0]byte - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x80 - SizeofBpfProgram = 0x10 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x20 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint64 - Drop uint64 - Capt uint64 - Padding [13]uint64 -} - -type BpfProgram struct { - Len uint32 - Pad_cgo_0 [4]byte - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp BpfTimeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - Pad_cgo_0 [6]byte -} - -type BpfTimeval struct { - Sec int64 - Usec int64 -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed int32 - Ospeed int32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -type Ptmget struct { - Cfd int32 - Sfd int32 - Cn [1024]byte - Sn [1024]byte -} - -const ( - AT_FDCWD = -0x64 - AT_SYMLINK_NOFOLLOW = 0x200 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Sysctlnode struct { - Flags uint32 - Num int32 - Name [32]int8 - Ver uint32 - X__rsvd uint32 - Un [16]byte - X_sysctl_size [8]byte - X_sysctl_func [8]byte - X_sysctl_parent [8]byte - X_sysctl_desc [8]byte -} - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 900fb446..231f4e8e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -458,8 +458,6 @@ const ( POLLWRNORM = 0x4 ) -type Sigset_t uint32 - type Utsname struct { Sysname [256]byte Nodename [256]byte @@ -467,104 +465,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Anonpages int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Nanonneeded int32 - Nfreeanon int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Zeroaborts int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 - Fpswtch int32 - Kmapent int32 -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 028fa78d..bb2c4488 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 ) type ( @@ -458,8 +458,6 @@ const ( POLLWRNORM = 0x4 ) -type Sigset_t uint32 - type Utsname struct { Sysname [256]byte Nodename [256]byte @@ -467,104 +465,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Anonpages int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Nanonneeded int32 - Nfreeanon int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Zeroaborts int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 - Fpswtch int32 - Kmapent int32 -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index b45d5eed..941367ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// cgo -godefs types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,openbsd @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 + sizeofPtr = 0x4 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x4 + sizeofLongLong = 0x8 ) type ( @@ -23,13 +23,11 @@ type ( type Timespec struct { Sec int64 Nsec int32 - _ [4]byte } type Timeval struct { Sec int64 Usec int32 - _ [4]byte } type Rusage struct { @@ -59,30 +57,28 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Mode uint32 - Dev int32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - _ [4]byte - _ Timespec + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + X__st_birthtim Timespec } type Statfs_t struct { F_flags uint32 F_bsize uint32 F_iosize uint32 - _ [4]byte F_blocks uint64 F_bfree uint64 F_bavail int64 @@ -97,11 +93,11 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 - _ [2]byte + F_fstypename [16]uint8 + F_mntonname [90]uint8 + F_mntfromname [90]uint8 + F_mntfromspec [90]uint8 + Pad_cgo_0 [2]byte Mount_info [160]byte } @@ -114,13 +110,13 @@ type Flock_t struct { } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Namlen uint8 - _ [4]uint8 - Name [256]int8 + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + X__d_padding [4]uint8 + Name [256]uint8 } type Fsid struct { @@ -255,10 +251,8 @@ type Kevent_t struct { Filter int16 Flags uint16 Fflags uint32 - _ [4]byte Data int64 Udata *byte - _ [4]byte } type FdSet struct { @@ -266,8 +260,8 @@ type FdSet struct { } const ( - SizeofIfMsghdr = 0xa8 - SizeofIfData = 0x90 + SizeofIfMsghdr = 0x98 + SizeofIfData = 0x80 SizeofIfaMsghdr = 0x18 SizeofIfAnnounceMsghdr = 0x1a SizeofRtMsghdr = 0x60 @@ -296,7 +290,7 @@ type IfData struct { Link_state uint8 Mtu uint32 Metric uint32 - Rdomain uint32 + Pad uint32 Baudrate uint64 Ipackets uint64 Ierrors uint64 @@ -308,10 +302,8 @@ type IfData struct { Imcasts uint64 Omcasts uint64 Iqdrops uint64 - Oqdrops uint64 Noproto uint64 Capabilities uint32 - _ [4]byte Lastchange Timeval } @@ -336,7 +328,7 @@ type IfAnnounceMsghdr struct { Hdrlen uint16 Index uint16 What uint16 - Name [16]int8 + Name [16]uint8 } type RtMsghdr struct { @@ -406,11 +398,11 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp BpfTimeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [2]byte } type BpfTimeval struct { @@ -459,8 +451,6 @@ const ( POLLWRNORM = 0x4 ) -type Sigset_t uint32 - type Utsname struct { Sysname [256]byte Nodename [256]byte @@ -468,104 +458,3 @@ type Utsname struct { Version [256]byte Machine [256]byte } - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Unused01 int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Unused05 int32 - Unused06 int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Unused07 int32 - Unused08 int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Unused09 int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Unused11 int32 - Unused12 int32 - Unused13 int32 - Fpswtch int32 - Kmapent int32 -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go deleted file mode 100644 index fa369a32..00000000 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ /dev/null @@ -1,564 +0,0 @@ -// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,openbsd - -package unix - -const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int64 - _C_long_long int64 -) - -type Timespec struct { - Sec int64 - Nsec int64 -} - -type Timeval struct { - Sec int64 - Usec int64 -} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int64 - Ixrss int64 - Idrss int64 - Isrss int64 - Minflt int64 - Majflt int64 - Nswap int64 - Inblock int64 - Oublock int64 - Msgsnd int64 - Msgrcv int64 - Nsignals int64 - Nvcsw int64 - Nivcsw int64 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Mode uint32 - Dev int32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - _ Timespec -} - -type Statfs_t struct { - F_flags uint32 - F_bsize uint32 - F_iosize uint32 - F_blocks uint64 - F_bfree uint64 - F_bavail int64 - F_files uint64 - F_ffree uint64 - F_favail int64 - F_syncwrites uint64 - F_syncreads uint64 - F_asyncwrites uint64 - F_asyncreads uint64 - F_fsid Fsid - F_namemax uint32 - F_owner uint32 - F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 - _ [2]byte - Mount_info [160]byte -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Namlen uint8 - _ [4]uint8 - Name [256]int8 -} - -type Fsid struct { - Val [2]int32 -} - -const ( - PathMax = 0x400 -) - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [24]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint64 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x20 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint64 - Filter int16 - Flags uint16 - Fflags uint32 - Data int64 - Udata *byte -} - -type FdSet struct { - Bits [32]uint32 -} - -const ( - SizeofIfMsghdr = 0xa8 - SizeofIfData = 0x90 - SizeofIfaMsghdr = 0x18 - SizeofIfAnnounceMsghdr = 0x1a - SizeofRtMsghdr = 0x60 - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Hdrlen uint16 - Index uint16 - Tableid uint16 - Pad1 uint8 - Pad2 uint8 - Addrs int32 - Flags int32 - Xflags int32 - Data IfData -} - -type IfData struct { - Type uint8 - Addrlen uint8 - Hdrlen uint8 - Link_state uint8 - Mtu uint32 - Metric uint32 - Rdomain uint32 - Baudrate uint64 - Ipackets uint64 - Ierrors uint64 - Opackets uint64 - Oerrors uint64 - Collisions uint64 - Ibytes uint64 - Obytes uint64 - Imcasts uint64 - Omcasts uint64 - Iqdrops uint64 - Oqdrops uint64 - Noproto uint64 - Capabilities uint32 - Lastchange Timeval -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Hdrlen uint16 - Index uint16 - Tableid uint16 - Pad1 uint8 - Pad2 uint8 - Addrs int32 - Flags int32 - Metric int32 -} - -type IfAnnounceMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Hdrlen uint16 - Index uint16 - What uint16 - Name [16]int8 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Hdrlen uint16 - Index uint16 - Tableid uint16 - Priority uint8 - Mpls uint8 - Addrs int32 - Flags int32 - Fmask int32 - Pid int32 - Seq int32 - Errno int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Pksent uint64 - Expire int64 - Locks uint32 - Mtu uint32 - Refcnt uint32 - Hopcount uint32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pad uint32 -} - -type Mclpool struct{} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x10 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp BpfTimeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte -} - -type BpfTimeval struct { - Sec uint32 - Usec uint32 -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed int32 - Ospeed int32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x64 - AT_SYMLINK_NOFOLLOW = 0x2 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Sigset_t uint32 - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofUvmexp = 0x158 - -type Uvmexp struct { - Pagesize int32 - Pagemask int32 - Pageshift int32 - Npages int32 - Free int32 - Active int32 - Inactive int32 - Paging int32 - Wired int32 - Zeropages int32 - Reserve_pagedaemon int32 - Reserve_kernel int32 - Unused01 int32 - Vnodepages int32 - Vtextpages int32 - Freemin int32 - Freetarg int32 - Inactarg int32 - Wiredmax int32 - Anonmin int32 - Vtextmin int32 - Vnodemin int32 - Anonminpct int32 - Vtextminpct int32 - Vnodeminpct int32 - Nswapdev int32 - Swpages int32 - Swpginuse int32 - Swpgonly int32 - Nswget int32 - Nanon int32 - Unused05 int32 - Unused06 int32 - Faults int32 - Traps int32 - Intrs int32 - Swtch int32 - Softs int32 - Syscalls int32 - Pageins int32 - Unused07 int32 - Unused08 int32 - Pgswapin int32 - Pgswapout int32 - Forks int32 - Forks_ppwait int32 - Forks_sharevm int32 - Pga_zerohit int32 - Pga_zeromiss int32 - Unused09 int32 - Fltnoram int32 - Fltnoanon int32 - Fltnoamap int32 - Fltpgwait int32 - Fltpgrele int32 - Fltrelck int32 - Fltrelckok int32 - Fltanget int32 - Fltanretry int32 - Fltamcopy int32 - Fltnamap int32 - Fltnomap int32 - Fltlget int32 - Fltget int32 - Flt_anon int32 - Flt_acow int32 - Flt_obj int32 - Flt_prcopy int32 - Flt_przero int32 - Pdwoke int32 - Pdrevs int32 - Pdswout int32 - Pdfreed int32 - Pdscans int32 - Pdanscan int32 - Pdobscan int32 - Pdreact int32 - Pdbusy int32 - Pdpageouts int32 - Pdpending int32 - Pddeact int32 - Unused11 int32 - Unused12 int32 - Unused13 int32 - Fpswtch int32 - Kmapent int32 -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 8531a190..0543e1a4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -6,11 +6,11 @@ package unix const ( - SizeofPtr = 0x8 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x8 - SizeofLongLong = 0x8 + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 PathMax = 0x400 MaxHostNameLen = 0x100 ) diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go index ba67658d..e92c05b2 100644 --- a/vendor/golang.org/x/sys/windows/dll_windows.go +++ b/vendor/golang.org/x/sys/windows/dll_windows.go @@ -359,11 +359,11 @@ func loadLibraryEx(name string, system bool) (*DLL, error) { // trying to load "foo.dll" out of the system // folder, but LoadLibraryEx doesn't support // that yet on their system, so emulate it. - systemdir, err := GetSystemDirectory() - if err != nil { - return nil, err + windir, _ := Getenv("WINDIR") // old var; apparently works on XP + if windir == "" { + return nil, errString("%WINDIR% not defined") } - loadDLL = systemdir + "\\" + name + loadDLL = windir + "\\System32\\" + name } } h, err := LoadLibraryEx(loadDLL, 0, flags) diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go index f482a9fa..bdc71e24 100644 --- a/vendor/golang.org/x/sys/windows/env_windows.go +++ b/vendor/golang.org/x/sys/windows/env_windows.go @@ -6,11 +6,7 @@ package windows -import ( - "syscall" - "unicode/utf16" - "unsafe" -) +import "syscall" func Getenv(key string) (value string, found bool) { return syscall.Getenv(key) @@ -28,34 +24,6 @@ func Environ() []string { return syscall.Environ() } -// Returns a default environment associated with the token, rather than the current -// process. If inheritExisting is true, then this environment also inherits the -// environment of the current process. -func (token Token) Environ(inheritExisting bool) (env []string, err error) { - var block *uint16 - err = CreateEnvironmentBlock(&block, token, inheritExisting) - if err != nil { - return nil, err - } - defer DestroyEnvironmentBlock(block) - blockp := uintptr(unsafe.Pointer(block)) - for { - entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(blockp))[:] - for i, v := range entry { - if v == 0 { - entry = entry[:i] - break - } - } - if len(entry) == 0 { - break - } - env = append(env, string(utf16.Decode(entry))) - blockp += 2 * (uintptr(len(entry)) + 1) - } - return env, nil -} - func Unsetenv(key string) error { return syscall.Unsetenv(key) } diff --git a/vendor/golang.org/x/sys/windows/mkerrors.bash b/vendor/golang.org/x/sys/windows/mkerrors.bash deleted file mode 100755 index 2163843a..00000000 --- a/vendor/golang.org/x/sys/windows/mkerrors.bash +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -set -e -shopt -s nullglob - -winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" -[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } - -declare -A errors - -{ - echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT." - echo - echo "package windows" - echo "import \"syscall\"" - echo "const (" - - while read -r line; do - unset vtype - if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then - key="${BASH_REMATCH[1]}" - value="${BASH_REMATCH[3]}" - elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then - key="${BASH_REMATCH[1]}" - value="${BASH_REMATCH[3]}" - vtype="${BASH_REMATCH[2]}" - elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then - key="${BASH_REMATCH[1]}" - value="${BASH_REMATCH[3]}" - vtype="${BASH_REMATCH[2]}" - else - continue - fi - [[ -n $key && -n $value ]] || continue - [[ -z ${errors["$key"]} ]] || continue - errors["$key"]="$value" - if [[ -v vtype ]]; then - if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then - vtype="" - elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then - vtype="Handle" - else - vtype="syscall.Errno" - fi - last_vtype="$vtype" - else - vtype="" - if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then - value="S_OK" - elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then - value="ERROR_SUCCESS" - fi - fi - - echo "$key $vtype = $value" - done < "$winerror" - - echo ")" -} | gofmt > "zerrors_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mkknownfolderids.bash b/vendor/golang.org/x/sys/windows/mkknownfolderids.bash deleted file mode 100755 index ab8924e9..00000000 --- a/vendor/golang.org/x/sys/windows/mkknownfolderids.bash +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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. - -set -e -shopt -s nullglob - -knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)" -[[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; } - -{ - echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT." - echo - echo "package windows" - echo "type KNOWNFOLDERID GUID" - echo "var (" - while read -r line; do - [[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue - printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \ - "${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \ - $(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \ - $(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" )) - done < "$knownfolders" - echo ")" -} | gofmt > "zknownfolderids_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go index 62770572..fb7db0ef 100644 --- a/vendor/golang.org/x/sys/windows/mksyscall.go +++ b/vendor/golang.org/x/sys/windows/mksyscall.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build generate - package windows //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 61b49647..4f17a333 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -149,7 +149,7 @@ const ( DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d - DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e + DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 @@ -169,21 +169,15 @@ const ( //sys GetLengthSid(sid *SID) (len uint32) = advapi32.GetLengthSid //sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid //sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid -//sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid -//sys isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) = advapi32.IsWellKnownSid //sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid //sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid -//sys getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) = advapi32.GetSidIdentifierAuthority -//sys getSidSubAuthorityCount(sid *SID) (count *uint8) = advapi32.GetSidSubAuthorityCount -//sys getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) = advapi32.GetSidSubAuthority -//sys isValidSid(sid *SID) (isValid bool) = advapi32.IsValidSid // The security identifier (SID) structure is a variable-length // structure used to uniquely identify users or groups. type SID struct{} // StringToSid converts a string-format security identifier -// SID into a valid, functional SID. +// sid into a valid, functional sid. func StringToSid(s string) (*SID, error) { var sid *SID p, e := UTF16PtrFromString(s) @@ -198,7 +192,7 @@ func StringToSid(s string) (*SID, error) { return sid.Copy() } -// LookupSID retrieves a security identifier SID for the account +// LookupSID retrieves a security identifier sid for the account // and the name of the domain on which the account was found. // System specify target computer to search. func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) { @@ -235,7 +229,7 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32, } } -// String converts SID to a string format +// String converts sid to a string format // suitable for display, storage, or transmission. func (sid *SID) String() (string, error) { var s *uint16 @@ -247,12 +241,12 @@ func (sid *SID) String() (string, error) { return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil } -// Len returns the length, in bytes, of a valid security identifier SID. +// Len returns the length, in bytes, of a valid security identifier sid. func (sid *SID) Len() int { return int(GetLengthSid(sid)) } -// Copy creates a duplicate of security identifier SID. +// Copy creates a duplicate of security identifier sid. func (sid *SID) Copy() (*SID, error) { b := make([]byte, sid.Len()) sid2 := (*SID)(unsafe.Pointer(&b[0])) @@ -263,42 +257,8 @@ func (sid *SID) Copy() (*SID, error) { return sid2, nil } -// IdentifierAuthority returns the identifier authority of the SID. -func (sid *SID) IdentifierAuthority() SidIdentifierAuthority { - return *getSidIdentifierAuthority(sid) -} - -// SubAuthorityCount returns the number of sub-authorities in the SID. -func (sid *SID) SubAuthorityCount() uint8 { - return *getSidSubAuthorityCount(sid) -} - -// SubAuthority returns the sub-authority of the SID as specified by -// the index, which must be less than sid.SubAuthorityCount(). -func (sid *SID) SubAuthority(idx uint32) uint32 { - if idx >= uint32(sid.SubAuthorityCount()) { - panic("sub-authority index out of range") - } - return *getSidSubAuthority(sid, idx) -} - -// IsValid returns whether the SID has a valid revision and length. -func (sid *SID) IsValid() bool { - return isValidSid(sid) -} - -// Equals compares two SIDs for equality. -func (sid *SID) Equals(sid2 *SID) bool { - return EqualSid(sid, sid2) -} - -// IsWellKnown determines whether the SID matches the well-known sidType. -func (sid *SID) IsWellKnown(sidType WELL_KNOWN_SID_TYPE) bool { - return isWellKnownSid(sid, sidType) -} - -// LookupAccount retrieves the name of the account for this SID -// and the name of the first domain on which this SID is found. +// LookupAccount retrieves the name of the account for this sid +// and the name of the first domain on which this sid is found. // System specify target computer to search for. func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) { var sys *uint16 @@ -326,158 +286,6 @@ func (sid *SID) LookupAccount(system string) (account, domain string, accType ui } } -// Various types of pre-specified SIDs that can be synthesized and compared at runtime. -type WELL_KNOWN_SID_TYPE uint32 - -const ( - WinNullSid = 0 - WinWorldSid = 1 - WinLocalSid = 2 - WinCreatorOwnerSid = 3 - WinCreatorGroupSid = 4 - WinCreatorOwnerServerSid = 5 - WinCreatorGroupServerSid = 6 - WinNtAuthoritySid = 7 - WinDialupSid = 8 - WinNetworkSid = 9 - WinBatchSid = 10 - WinInteractiveSid = 11 - WinServiceSid = 12 - WinAnonymousSid = 13 - WinProxySid = 14 - WinEnterpriseControllersSid = 15 - WinSelfSid = 16 - WinAuthenticatedUserSid = 17 - WinRestrictedCodeSid = 18 - WinTerminalServerSid = 19 - WinRemoteLogonIdSid = 20 - WinLogonIdsSid = 21 - WinLocalSystemSid = 22 - WinLocalServiceSid = 23 - WinNetworkServiceSid = 24 - WinBuiltinDomainSid = 25 - WinBuiltinAdministratorsSid = 26 - WinBuiltinUsersSid = 27 - WinBuiltinGuestsSid = 28 - WinBuiltinPowerUsersSid = 29 - WinBuiltinAccountOperatorsSid = 30 - WinBuiltinSystemOperatorsSid = 31 - WinBuiltinPrintOperatorsSid = 32 - WinBuiltinBackupOperatorsSid = 33 - WinBuiltinReplicatorSid = 34 - WinBuiltinPreWindows2000CompatibleAccessSid = 35 - WinBuiltinRemoteDesktopUsersSid = 36 - WinBuiltinNetworkConfigurationOperatorsSid = 37 - WinAccountAdministratorSid = 38 - WinAccountGuestSid = 39 - WinAccountKrbtgtSid = 40 - WinAccountDomainAdminsSid = 41 - WinAccountDomainUsersSid = 42 - WinAccountDomainGuestsSid = 43 - WinAccountComputersSid = 44 - WinAccountControllersSid = 45 - WinAccountCertAdminsSid = 46 - WinAccountSchemaAdminsSid = 47 - WinAccountEnterpriseAdminsSid = 48 - WinAccountPolicyAdminsSid = 49 - WinAccountRasAndIasServersSid = 50 - WinNTLMAuthenticationSid = 51 - WinDigestAuthenticationSid = 52 - WinSChannelAuthenticationSid = 53 - WinThisOrganizationSid = 54 - WinOtherOrganizationSid = 55 - WinBuiltinIncomingForestTrustBuildersSid = 56 - WinBuiltinPerfMonitoringUsersSid = 57 - WinBuiltinPerfLoggingUsersSid = 58 - WinBuiltinAuthorizationAccessSid = 59 - WinBuiltinTerminalServerLicenseServersSid = 60 - WinBuiltinDCOMUsersSid = 61 - WinBuiltinIUsersSid = 62 - WinIUserSid = 63 - WinBuiltinCryptoOperatorsSid = 64 - WinUntrustedLabelSid = 65 - WinLowLabelSid = 66 - WinMediumLabelSid = 67 - WinHighLabelSid = 68 - WinSystemLabelSid = 69 - WinWriteRestrictedCodeSid = 70 - WinCreatorOwnerRightsSid = 71 - WinCacheablePrincipalsGroupSid = 72 - WinNonCacheablePrincipalsGroupSid = 73 - WinEnterpriseReadonlyControllersSid = 74 - WinAccountReadonlyControllersSid = 75 - WinBuiltinEventLogReadersGroup = 76 - WinNewEnterpriseReadonlyControllersSid = 77 - WinBuiltinCertSvcDComAccessGroup = 78 - WinMediumPlusLabelSid = 79 - WinLocalLogonSid = 80 - WinConsoleLogonSid = 81 - WinThisOrganizationCertificateSid = 82 - WinApplicationPackageAuthoritySid = 83 - WinBuiltinAnyPackageSid = 84 - WinCapabilityInternetClientSid = 85 - WinCapabilityInternetClientServerSid = 86 - WinCapabilityPrivateNetworkClientServerSid = 87 - WinCapabilityPicturesLibrarySid = 88 - WinCapabilityVideosLibrarySid = 89 - WinCapabilityMusicLibrarySid = 90 - WinCapabilityDocumentsLibrarySid = 91 - WinCapabilitySharedUserCertificatesSid = 92 - WinCapabilityEnterpriseAuthenticationSid = 93 - WinCapabilityRemovableStorageSid = 94 - WinBuiltinRDSRemoteAccessServersSid = 95 - WinBuiltinRDSEndpointServersSid = 96 - WinBuiltinRDSManagementServersSid = 97 - WinUserModeDriversSid = 98 - WinBuiltinHyperVAdminsSid = 99 - WinAccountCloneableControllersSid = 100 - WinBuiltinAccessControlAssistanceOperatorsSid = 101 - WinBuiltinRemoteManagementUsersSid = 102 - WinAuthenticationAuthorityAssertedSid = 103 - WinAuthenticationServiceAssertedSid = 104 - WinLocalAccountSid = 105 - WinLocalAccountAndAdministratorSid = 106 - WinAccountProtectedUsersSid = 107 - WinCapabilityAppointmentsSid = 108 - WinCapabilityContactsSid = 109 - WinAccountDefaultSystemManagedSid = 110 - WinBuiltinDefaultSystemManagedGroupSid = 111 - WinBuiltinStorageReplicaAdminsSid = 112 - WinAccountKeyAdminsSid = 113 - WinAccountEnterpriseKeyAdminsSid = 114 - WinAuthenticationKeyTrustSid = 115 - WinAuthenticationKeyPropertyMFASid = 116 - WinAuthenticationKeyPropertyAttestationSid = 117 - WinAuthenticationFreshKeyAuthSid = 118 - WinBuiltinDeviceOwnersSid = 119 -) - -// Creates a SID for a well-known predefined alias, generally using the constants of the form -// Win*Sid, for the local machine. -func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) { - return CreateWellKnownDomainSid(sidType, nil) -} - -// Creates a SID for a well-known predefined alias, generally using the constants of the form -// Win*Sid, for the domain specified by the domainSid parameter. -func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) { - n := uint32(50) - for { - b := make([]byte, n) - sid := (*SID)(unsafe.Pointer(&b[0])) - err := createWellKnownSid(sidType, domainSid, sid, &n) - if err == nil { - return sid, nil - } - if err != ERROR_INSUFFICIENT_BUFFER { - return nil, err - } - if n <= uint32(len(b)) { - return nil, err - } - } -} - const ( // do not reorder TOKEN_ASSIGN_PRIMARY = 1 << iota @@ -541,53 +349,6 @@ const ( MaxTokenInfoClass ) -// Group attributes inside of Tokengroups.Groups[i].Attributes -const ( - SE_GROUP_MANDATORY = 0x00000001 - SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002 - SE_GROUP_ENABLED = 0x00000004 - SE_GROUP_OWNER = 0x00000008 - SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010 - SE_GROUP_INTEGRITY = 0x00000020 - SE_GROUP_INTEGRITY_ENABLED = 0x00000040 - SE_GROUP_LOGON_ID = 0xC0000000 - SE_GROUP_RESOURCE = 0x20000000 - SE_GROUP_VALID_ATTRIBUTES = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED -) - -// Privilege attributes -const ( - SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001 - SE_PRIVILEGE_ENABLED = 0x00000002 - SE_PRIVILEGE_REMOVED = 0x00000004 - SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 - SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS -) - -// Token types -const ( - TokenPrimary = 1 - TokenImpersonation = 2 -) - -// Impersonation levels -const ( - SecurityAnonymous = 0 - SecurityIdentification = 1 - SecurityImpersonation = 2 - SecurityDelegation = 3 -) - -type LUID struct { - LowPart uint32 - HighPart int32 -} - -type LUIDAndAttributes struct { - Luid LUID - Attributes uint32 -} - type SIDAndAttributes struct { Sid *SID Attributes uint32 @@ -603,47 +364,14 @@ type Tokenprimarygroup struct { type Tokengroups struct { GroupCount uint32 - Groups [1]SIDAndAttributes // Use AllGroups() for iterating. -} - -// AllGroups returns a slice that can be used to iterate over the groups in g. -func (g *Tokengroups) AllGroups() []SIDAndAttributes { - return (*[(1 << 28) - 1]SIDAndAttributes)(unsafe.Pointer(&g.Groups[0]))[:g.GroupCount:g.GroupCount] -} - -type Tokenprivileges struct { - PrivilegeCount uint32 - Privileges [1]LUIDAndAttributes // Use AllPrivileges() for iterating. -} - -// AllPrivileges returns a slice that can be used to iterate over the privileges in p. -func (p *Tokenprivileges) AllPrivileges() []LUIDAndAttributes { - return (*[(1 << 27) - 1]LUIDAndAttributes)(unsafe.Pointer(&p.Privileges[0]))[:p.PrivilegeCount:p.PrivilegeCount] -} - -type Tokenmandatorylabel struct { - Label SIDAndAttributes -} - -func (tml *Tokenmandatorylabel) Size() uint32 { - return uint32(unsafe.Sizeof(Tokenmandatorylabel{})) + GetLengthSid(tml.Label.Sid) + Groups [1]SIDAndAttributes } // Authorization Functions -//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership -//sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken -//sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken -//sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf -//sys RevertToSelf() (err error) = advapi32.RevertToSelf -//sys SetThreadToken(thread *Handle, token Token) (err error) = advapi32.SetThreadToken -//sys LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) = advapi32.LookupPrivilegeValueW -//sys AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) = advapi32.AdjustTokenPrivileges -//sys AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) = advapi32.AdjustTokenGroups -//sys GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation -//sys SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) = advapi32.SetTokenInformation -//sys DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) = advapi32.DuplicateTokenEx +//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership +//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken +//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation //sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW -//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW // An access token contains the security information for a logon session. // The system creates an access token when a user logs on, and every @@ -655,9 +383,7 @@ func (tml *Tokenmandatorylabel) Size() uint32 { type Token Handle // OpenCurrentProcessToken opens the access token -// associated with current process. It is a real -// token that needs to be closed, unlike -// GetCurrentProcessToken. +// associated with current process. func OpenCurrentProcessToken() (Token, error) { p, e := GetCurrentProcess() if e != nil { @@ -671,27 +397,6 @@ func OpenCurrentProcessToken() (Token, error) { return t, nil } -// GetCurrentProcessToken returns the access token associated with -// the current process. It is a pseudo token that does not need -// to be closed. -func GetCurrentProcessToken() Token { - return Token(^uintptr(4 - 1)) -} - -// GetCurrentThreadToken return the access token associated with -// the current thread. It is a pseudo token that does not need -// to be closed. -func GetCurrentThreadToken() Token { - return Token(^uintptr(5 - 1)) -} - -// GetCurrentThreadEffectiveToken returns the effective access token -// associated with the current thread. It is a pseudo token that does -// not need to be closed. -func GetCurrentThreadEffectiveToken() Token { - return Token(^uintptr(6 - 1)) -} - // Close releases access to access token. func (t Token) Close() error { return CloseHandle(Handle(t)) @@ -763,45 +468,6 @@ func (t Token) GetUserProfileDirectory() (string, error) { } } -// IsElevated returns whether the current token is elevated from a UAC perspective. -func (token Token) IsElevated() bool { - var isElevated uint32 - var outLen uint32 - err := GetTokenInformation(token, TokenElevation, (*byte)(unsafe.Pointer(&isElevated)), uint32(unsafe.Sizeof(isElevated)), &outLen) - if err != nil { - return false - } - return outLen == uint32(unsafe.Sizeof(isElevated)) && isElevated != 0 -} - -// GetLinkedToken returns the linked token, which may be an elevated UAC token. -func (token Token) GetLinkedToken() (Token, error) { - var linkedToken Token - var outLen uint32 - err := GetTokenInformation(token, TokenLinkedToken, (*byte)(unsafe.Pointer(&linkedToken)), uint32(unsafe.Sizeof(linkedToken)), &outLen) - if err != nil { - return Token(0), err - } - return linkedToken, nil -} - -// GetSystemDirectory retrieves path to current location of the system -// directory, which is typically, though not always, C:\Windows\System32. -func GetSystemDirectory() (string, error) { - n := uint32(MAX_PATH) - for { - b := make([]uint16, n) - l, e := getSystemDirectory(&b[0], n) - if e != nil { - return "", e - } - if l <= n { - return UTF16ToString(b[:l]), nil - } - n = l - } -} - // IsMember reports whether the access token t is a member of the provided SID. func (t Token) IsMember(sid *SID) (bool, error) { var b int32 @@ -810,45 +476,3 @@ func (t Token) IsMember(sid *SID) (bool, error) { } return b != 0, nil } - -const ( - WTS_CONSOLE_CONNECT = 0x1 - WTS_CONSOLE_DISCONNECT = 0x2 - WTS_REMOTE_CONNECT = 0x3 - WTS_REMOTE_DISCONNECT = 0x4 - WTS_SESSION_LOGON = 0x5 - WTS_SESSION_LOGOFF = 0x6 - WTS_SESSION_LOCK = 0x7 - WTS_SESSION_UNLOCK = 0x8 - WTS_SESSION_REMOTE_CONTROL = 0x9 - WTS_SESSION_CREATE = 0xa - WTS_SESSION_TERMINATE = 0xb -) - -const ( - WTSActive = 0 - WTSConnected = 1 - WTSConnectQuery = 2 - WTSShadow = 3 - WTSDisconnected = 4 - WTSIdle = 5 - WTSListen = 6 - WTSReset = 7 - WTSDown = 8 - WTSInit = 9 -) - -type WTSSESSION_NOTIFICATION struct { - Size uint32 - SessionID uint32 -} - -type WTS_SESSION_INFO struct { - SessionID uint32 - WindowStationName *uint16 - State uint32 -} - -//sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken -//sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW -//sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index 03383f1d..62fc31b4 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -85,47 +85,23 @@ const ( SERVICE_INACTIVE = 2 SERVICE_STATE_ALL = 3 - SERVICE_QUERY_CONFIG = 1 - SERVICE_CHANGE_CONFIG = 2 - SERVICE_QUERY_STATUS = 4 - SERVICE_ENUMERATE_DEPENDENTS = 8 - SERVICE_START = 16 - SERVICE_STOP = 32 - SERVICE_PAUSE_CONTINUE = 64 - SERVICE_INTERROGATE = 128 - SERVICE_USER_DEFINED_CONTROL = 256 - SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL - + SERVICE_QUERY_CONFIG = 1 + SERVICE_CHANGE_CONFIG = 2 + SERVICE_QUERY_STATUS = 4 + SERVICE_ENUMERATE_DEPENDENTS = 8 + SERVICE_START = 16 + SERVICE_STOP = 32 + SERVICE_PAUSE_CONTINUE = 64 + SERVICE_INTERROGATE = 128 + SERVICE_USER_DEFINED_CONTROL = 256 + SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL SERVICE_RUNS_IN_SYSTEM_PROCESS = 1 + SERVICE_CONFIG_DESCRIPTION = 1 + SERVICE_CONFIG_FAILURE_ACTIONS = 2 - SERVICE_CONFIG_DESCRIPTION = 1 - SERVICE_CONFIG_FAILURE_ACTIONS = 2 - SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3 - SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4 - SERVICE_CONFIG_SERVICE_SID_INFO = 5 - SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6 - SERVICE_CONFIG_PRESHUTDOWN_INFO = 7 - SERVICE_CONFIG_TRIGGER_INFO = 8 - SERVICE_CONFIG_PREFERRED_NODE = 9 - SERVICE_CONFIG_LAUNCH_PROTECTED = 12 - - SERVICE_SID_TYPE_NONE = 0 - SERVICE_SID_TYPE_UNRESTRICTED = 1 - SERVICE_SID_TYPE_RESTRICTED = 2 | SERVICE_SID_TYPE_UNRESTRICTED + NO_ERROR = 0 SC_ENUM_PROCESS_INFO = 0 - - SERVICE_NOTIFY_STATUS_CHANGE = 2 - SERVICE_NOTIFY_STOPPED = 0x00000001 - SERVICE_NOTIFY_START_PENDING = 0x00000002 - SERVICE_NOTIFY_STOP_PENDING = 0x00000004 - SERVICE_NOTIFY_RUNNING = 0x00000008 - SERVICE_NOTIFY_CONTINUE_PENDING = 0x00000010 - SERVICE_NOTIFY_PAUSE_PENDING = 0x00000020 - SERVICE_NOTIFY_PAUSED = 0x00000040 - SERVICE_NOTIFY_CREATED = 0x00000080 - SERVICE_NOTIFY_DELETED = 0x00000100 - SERVICE_NOTIFY_DELETE_PENDING = 0x00000200 ) type SERVICE_STATUS struct { @@ -177,16 +153,6 @@ type ENUM_SERVICE_STATUS_PROCESS struct { ServiceStatusProcess SERVICE_STATUS_PROCESS } -type SERVICE_NOTIFY struct { - Version uint32 - NotifyCallback uintptr - Context uintptr - NotificationStatus uint32 - ServiceStatus SERVICE_STATUS_PROCESS - NotificationTriggered uint32 - ServiceNames *uint16 -} - type SERVICE_FAILURE_ACTIONS struct { ResetPeriod uint32 RebootMsg *uint16 @@ -200,19 +166,12 @@ type SC_ACTION struct { Delay uint32 } -type QUERY_SERVICE_LOCK_STATUS struct { - IsLocked uint32 - LockOwner *uint16 - LockDuration uint32 -} - //sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle //sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW //sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW //sys DeleteService(service Handle) (err error) = advapi32.DeleteService //sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW //sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus -//sys QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceLockStatusW //sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService //sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW //sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus @@ -221,5 +180,4 @@ type QUERY_SERVICE_LOCK_STATUS struct { //sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W //sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W //sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW -//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx -//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW +//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 92ce02bb..8a00b71f 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -10,7 +10,6 @@ import ( errorspkg "errors" "sync" "syscall" - "time" "unicode/utf16" "unsafe" ) @@ -56,10 +55,6 @@ const ( FILE_UNICODE_ON_DISK = 0x00000004 FILE_VOLUME_IS_COMPRESSED = 0x00008000 FILE_VOLUME_QUOTAS = 0x00000020 - - // Return values of SleepEx and other APC functions - STATUS_USER_APC = 0x000000C0 - WAIT_IO_COMPLETION = STATUS_USER_APC ) // StringToUTF16 is deprecated. Use UTF16FromString instead. @@ -139,11 +134,9 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW //sys ExitProcess(exitcode uint32) -//sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process -//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) -//sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) //sys SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) [failretval==0xffffffff] //sys CloseHandle(handle Handle) (err error) //sys GetStdHandle(stdhandle uint32) (handle Handle, err error) [failretval==InvalidHandle] @@ -152,7 +145,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW //sys FindClose(handle Handle) (err error) //sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) -//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) //sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW //sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW //sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW @@ -172,18 +164,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CancelIo(s Handle) (err error) //sys CancelIoEx(s Handle, o *Overlapped) (err error) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW -//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) -//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) = shell32.ShellExecuteW -//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath +//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) //sys TerminateProcess(handle Handle, exitcode uint32) (err error) //sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) //sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW //sys GetCurrentProcess() (pseudoHandle Handle, err error) -//sys GetCurrentThread() (pseudoHandle Handle, err error) //sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) //sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) //sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] -//sys waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] = WaitForMultipleObjects //sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW //sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) //sys GetFileType(filehandle Handle) (n uint32, err error) @@ -194,9 +182,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW //sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW //sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW -//sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock -//sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock -//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 //sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW //sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW @@ -235,7 +220,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW //sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW //sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW -//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId +//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId //sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo @@ -244,8 +229,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot //sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW //sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW -//sys Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) -//sys Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) //sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) // This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. //sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW @@ -257,18 +240,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetEvent(event Handle) (err error) = kernel32.SetEvent //sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent //sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent -//sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx -//sys CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) = kernel32.CreateJobObjectW -//sys AssignProcessToJobObject(job Handle, process Handle) (err error) = kernel32.AssignProcessToJobObject -//sys TerminateJobObject(job Handle, exitCode uint32) (err error) = kernel32.TerminateJobObject -//sys SetErrorMode(mode uint32) (ret uint32) = kernel32.SetErrorMode -//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread -//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass -//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass -//sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) -//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) -//sys GetProcessId(process Handle) (id uint32, err error) -//sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) // Volume Management Functions //sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW @@ -290,11 +261,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW //sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW //sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW -//sys MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW -//sys clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) = ole32.CLSIDFromString -//sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 -//sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid -//sys coTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree // syscall interface implementation for other packages @@ -509,10 +475,6 @@ func ComputerName() (name string, err error) { return string(utf16.Decode(b[0:n])), nil } -func DurationSinceBoot() time.Duration { - return time.Duration(getTickCount64()) * time.Millisecond -} - func Ftruncate(fd Handle, length int64) (err error) { curoffset, e := Seek(fd, 0, 1) if e != nil { @@ -596,6 +558,9 @@ func Fsync(fd Handle) (err error) { } func Chmod(path string, mode uint32) (err error) { + if mode == 0 { + return syscall.EINVAL + } p, e := UTF16PtrFromString(path) if e != nil { return e @@ -624,18 +589,6 @@ func LoadSetFileCompletionNotificationModes() error { return procSetFileCompletionNotificationModes.Find() } -func WaitForMultipleObjects(handles []Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { - // Every other win32 array API takes arguments as "pointer, count", except for this function. So we - // can't declare it as a usual [] type, because mksyscall will use the opposite order. We therefore - // trivially stub this ourselves. - - var handlePtr *Handle - if len(handles) > 0 { - handlePtr = &handles[0] - } - return waitForMultipleObjects(uint32(len(handles)), uintptr(unsafe.Pointer(handlePtr)), waitAll, waitMilliseconds) -} - // net api calls const socket_error = uintptr(^uint32(0)) @@ -1122,7 +1075,7 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } -func Getpid() (pid int) { return int(GetCurrentProcessId()) } +func Getpid() (pid int) { return int(getCurrentProcessId()) } func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { // NOTE(rsc): The Win32finddata struct is wrong for the system call: @@ -1250,57 +1203,3 @@ func Readlink(path string, buf []byte) (n int, err error) { return n, nil } - -// GUIDFromString parses a string in the form of -// "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" into a GUID. -func GUIDFromString(str string) (GUID, error) { - guid := GUID{} - str16, err := syscall.UTF16PtrFromString(str) - if err != nil { - return guid, err - } - err = clsidFromString(str16, &guid) - if err != nil { - return guid, err - } - return guid, nil -} - -// GenerateGUID creates a new random GUID. -func GenerateGUID() (GUID, error) { - guid := GUID{} - err := coCreateGuid(&guid) - if err != nil { - return guid, err - } - return guid, nil -} - -// String returns the canonical string form of the GUID, -// in the form of "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}". -func (guid GUID) String() string { - var str [100]uint16 - chars := stringFromGUID2(&guid, &str[0], int32(len(str))) - if chars <= 1 { - return "" - } - return string(utf16.Decode(str[:chars-1])) -} - -// KnownFolderPath returns a well-known folder path for the current user, specified by one of -// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. -func KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { - return Token(0).KnownFolderPath(folderID, flags) -} - -// KnownFolderPath returns a well-known folder path for the user token, specified by one of -// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. -func (t Token) KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { - var p *uint16 - err := shGetKnownFolderPath(folderID, flags, t, &p) - if err != nil { - return "", err - } - defer coTaskMemFree(unsafe.Pointer(p)) - return UTF16ToString((*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]), nil -} diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 1cba11ed..141ca81b 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -4,10 +4,33 @@ package windows -import ( - "net" - "syscall" - "unsafe" +import "syscall" + +const ( + // Windows errors. + ERROR_FILE_NOT_FOUND syscall.Errno = 2 + ERROR_PATH_NOT_FOUND syscall.Errno = 3 + ERROR_ACCESS_DENIED syscall.Errno = 5 + ERROR_NO_MORE_FILES syscall.Errno = 18 + ERROR_HANDLE_EOF syscall.Errno = 38 + ERROR_NETNAME_DELETED syscall.Errno = 64 + ERROR_FILE_EXISTS syscall.Errno = 80 + ERROR_BROKEN_PIPE syscall.Errno = 109 + ERROR_BUFFER_OVERFLOW syscall.Errno = 111 + ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 + ERROR_MOD_NOT_FOUND syscall.Errno = 126 + ERROR_PROC_NOT_FOUND syscall.Errno = 127 + ERROR_ALREADY_EXISTS syscall.Errno = 183 + ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 + ERROR_MORE_DATA syscall.Errno = 234 + ERROR_OPERATION_ABORTED syscall.Errno = 995 + ERROR_IO_PENDING syscall.Errno = 997 + ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 + ERROR_NOT_FOUND syscall.Errno = 1168 + ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 + WSAEACCES syscall.Errno = 10013 + WSAEMSGSIZE syscall.Errno = 10040 + WSAECONNRESET syscall.Errno = 10054 ) const ( @@ -103,19 +126,9 @@ const ( OPEN_ALWAYS = 4 TRUNCATE_EXISTING = 5 - FILE_FLAG_OPEN_REQUIRING_OPLOCK = 0x00040000 - FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000 - FILE_FLAG_OPEN_NO_RECALL = 0x00100000 - FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 - FILE_FLAG_SESSION_AWARE = 0x00800000 - FILE_FLAG_POSIX_SEMANTICS = 0x01000000 - FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 - FILE_FLAG_DELETE_ON_CLOSE = 0x04000000 - FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000 - FILE_FLAG_RANDOM_ACCESS = 0x10000000 - FILE_FLAG_NO_BUFFERING = 0x20000000 - FILE_FLAG_OVERLAPPED = 0x40000000 - FILE_FLAG_WRITE_THROUGH = 0x80000000 + FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 + FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 + FILE_FLAG_OVERLAPPED = 0x40000000 HANDLE_FLAG_INHERIT = 0x00000001 STARTF_USESTDHANDLES = 0x00000100 @@ -154,43 +167,14 @@ const ( IGNORE = 0 INFINITE = 0xffffffff + WAIT_TIMEOUT = 258 WAIT_ABANDONED = 0x00000080 WAIT_OBJECT_0 = 0x00000000 WAIT_FAILED = 0xFFFFFFFF - // Standard access rights. - DELETE = 0x00010000 - READ_CONTROL = 0x00020000 - SYNCHRONIZE = 0x00100000 - WRITE_DAC = 0x00040000 - WRITE_OWNER = 0x00080000 - - // Access rights for process. - PROCESS_CREATE_PROCESS = 0x0080 - PROCESS_CREATE_THREAD = 0x0002 - PROCESS_DUP_HANDLE = 0x0040 - PROCESS_QUERY_INFORMATION = 0x0400 - PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 - PROCESS_SET_INFORMATION = 0x0200 - PROCESS_SET_QUOTA = 0x0100 - PROCESS_SUSPEND_RESUME = 0x0800 - PROCESS_TERMINATE = 0x0001 - PROCESS_VM_OPERATION = 0x0008 - PROCESS_VM_READ = 0x0010 - PROCESS_VM_WRITE = 0x0020 - - // Access rights for thread. - THREAD_DIRECT_IMPERSONATION = 0x0200 - THREAD_GET_CONTEXT = 0x0008 - THREAD_IMPERSONATE = 0x0100 - THREAD_QUERY_INFORMATION = 0x0040 - THREAD_QUERY_LIMITED_INFORMATION = 0x0800 - THREAD_SET_CONTEXT = 0x0010 - THREAD_SET_INFORMATION = 0x0020 - THREAD_SET_LIMITED_INFORMATION = 0x0400 - THREAD_SET_THREAD_TOKEN = 0x0080 - THREAD_SUSPEND_RESUME = 0x0002 - THREAD_TERMINATE = 0x0001 + PROCESS_TERMINATE = 1 + PROCESS_QUERY_INFORMATION = 0x00000400 + SYNCHRONIZE = 0x00100000 FILE_MAP_COPY = 0x01 FILE_MAP_WRITE = 0x02 @@ -418,6 +402,12 @@ const ( CERT_CHAIN_POLICY_EV = 8 CERT_CHAIN_POLICY_SSL_F12 = 9 + CERT_E_EXPIRED = 0x800B0101 + CERT_E_ROLE = 0x800B0103 + CERT_E_PURPOSE = 0x800B0106 + CERT_E_UNTRUSTEDROOT = 0x800B0109 + CERT_E_CN_NO_MATCH = 0x800B010F + /* AuthType values for SSLExtraCertChainPolicyPara struct */ AUTHTYPE_CLIENT = 1 AUTHTYPE_SERVER = 2 @@ -430,26 +420,6 @@ const ( SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000 ) -const ( - // flags for SetErrorMode - SEM_FAILCRITICALERRORS = 0x0001 - SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 - SEM_NOGPFAULTERRORBOX = 0x0002 - SEM_NOOPENFILEERRORBOX = 0x8000 -) - -const ( - // Priority class. - ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 - BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 - HIGH_PRIORITY_CLASS = 0x00000080 - IDLE_PRIORITY_CLASS = 0x00000040 - NORMAL_PRIORITY_CLASS = 0x00000020 - PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000 - PROCESS_MODE_BACKGROUND_END = 0x00200000 - REALTIME_PRIORITY_CLASS = 0x00000100 -) - var ( OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00") OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00") @@ -659,16 +629,6 @@ type ProcessEntry32 struct { ExeFile [MAX_PATH]uint16 } -type ThreadEntry32 struct { - Size uint32 - Usage uint32 - ThreadID uint32 - OwnerProcessID uint32 - BasePri int32 - DeltaPri int32 - Flags uint32 -} - type Systemtime struct { Year uint16 Month uint16 @@ -889,6 +849,10 @@ const ( DNS_TYPE_NBSTAT = 0xff01 ) +const ( + DNS_INFO_NO_RECORDS = 0x251D +) + const ( // flags inside DNSRecord.Dw DnsSectionQuestion = 0x0000 @@ -1350,41 +1314,6 @@ const ( ComputerNameMax = 8 ) -// For MessageBox() -const ( - MB_OK = 0x00000000 - MB_OKCANCEL = 0x00000001 - MB_ABORTRETRYIGNORE = 0x00000002 - MB_YESNOCANCEL = 0x00000003 - MB_YESNO = 0x00000004 - MB_RETRYCANCEL = 0x00000005 - MB_CANCELTRYCONTINUE = 0x00000006 - MB_ICONHAND = 0x00000010 - MB_ICONQUESTION = 0x00000020 - MB_ICONEXCLAMATION = 0x00000030 - MB_ICONASTERISK = 0x00000040 - MB_USERICON = 0x00000080 - MB_ICONWARNING = MB_ICONEXCLAMATION - MB_ICONERROR = MB_ICONHAND - MB_ICONINFORMATION = MB_ICONASTERISK - MB_ICONSTOP = MB_ICONHAND - MB_DEFBUTTON1 = 0x00000000 - MB_DEFBUTTON2 = 0x00000100 - MB_DEFBUTTON3 = 0x00000200 - MB_DEFBUTTON4 = 0x00000300 - MB_APPLMODAL = 0x00000000 - MB_SYSTEMMODAL = 0x00001000 - MB_TASKMODAL = 0x00002000 - MB_HELP = 0x00004000 - MB_NOFOCUS = 0x00008000 - MB_SETFOREGROUND = 0x00010000 - MB_DEFAULT_DESKTOP_ONLY = 0x00020000 - MB_TOPMOST = 0x00040000 - MB_RIGHT = 0x00080000 - MB_RTLREADING = 0x00100000 - MB_SERVICE_NOTIFICATION = 0x00200000 -) - const ( MOVEFILE_REPLACE_EXISTING = 0x1 MOVEFILE_COPY_ALLOWED = 0x2 @@ -1413,16 +1342,6 @@ type SocketAddress struct { SockaddrLength int32 } -// IP returns an IPv4 or IPv6 address, or nil if the underlying SocketAddress is neither. -func (addr *SocketAddress) IP() net.IP { - if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet4{}) && addr.Sockaddr.Addr.Family == AF_INET { - return (*RawSockaddrInet4)(unsafe.Pointer(addr.Sockaddr)).Addr[:] - } else if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet6{}) && addr.Sockaddr.Addr.Family == AF_INET6 { - return (*RawSockaddrInet6)(unsafe.Pointer(addr.Sockaddr)).Addr[:] - } - return nil -} - type IpAdapterUnicastAddress struct { Length uint32 Flags uint32 @@ -1548,104 +1467,3 @@ type ConsoleScreenBufferInfo struct { } const UNIX_PATH_MAX = 108 // defined in afunix.h - -const ( - // flags for JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags - JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008 - JOB_OBJECT_LIMIT_AFFINITY = 0x00000010 - JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800 - JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400 - JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200 - JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004 - JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000 - JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040 - JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020 - JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100 - JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002 - JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080 - JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000 - JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000 - JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 -) - -type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { - PerProcessUserTimeLimit int64 - PerJobUserTimeLimit int64 - LimitFlags uint32 - MinimumWorkingSetSize uintptr - MaximumWorkingSetSize uintptr - ActiveProcessLimit uint32 - Affinity uintptr - PriorityClass uint32 - SchedulingClass uint32 -} - -type IO_COUNTERS struct { - ReadOperationCount uint64 - WriteOperationCount uint64 - OtherOperationCount uint64 - ReadTransferCount uint64 - WriteTransferCount uint64 - OtherTransferCount uint64 -} - -type JOBOBJECT_EXTENDED_LIMIT_INFORMATION struct { - BasicLimitInformation JOBOBJECT_BASIC_LIMIT_INFORMATION - IoInfo IO_COUNTERS - ProcessMemoryLimit uintptr - JobMemoryLimit uintptr - PeakProcessMemoryUsed uintptr - PeakJobMemoryUsed uintptr -} - -const ( - // UIRestrictionsClass - JOB_OBJECT_UILIMIT_DESKTOP = 0x00000040 - JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x00000010 - JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x00000080 - JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020 - JOB_OBJECT_UILIMIT_HANDLES = 0x00000001 - JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x00000002 - JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x00000008 - JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x00000004 -) - -type JOBOBJECT_BASIC_UI_RESTRICTIONS struct { - UIRestrictionsClass uint32 -} - -const ( - // JobObjectInformationClass - JobObjectAssociateCompletionPortInformation = 7 - JobObjectBasicLimitInformation = 2 - JobObjectBasicUIRestrictions = 4 - JobObjectCpuRateControlInformation = 15 - JobObjectEndOfJobTimeInformation = 6 - JobObjectExtendedLimitInformation = 9 - JobObjectGroupInformation = 11 - JobObjectGroupInformationEx = 14 - JobObjectLimitViolationInformation2 = 35 - JobObjectNetRateControlInformation = 32 - JobObjectNotificationLimitInformation = 12 - JobObjectNotificationLimitInformation2 = 34 - JobObjectSecurityLimitInformation = 5 -) - -const ( - KF_FLAG_DEFAULT = 0x00000000 - KF_FLAG_FORCE_APP_DATA_REDIRECTION = 0x00080000 - KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET = 0x00040000 - KF_FLAG_FORCE_PACKAGE_REDIRECTION = 0x00020000 - KF_FLAG_NO_PACKAGE_REDIRECTION = 0x00010000 - KF_FLAG_FORCE_APPCONTAINER_REDIRECTION = 0x00020000 - KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000 - KF_FLAG_CREATE = 0x00008000 - KF_FLAG_DONT_VERIFY = 0x00004000 - KF_FLAG_DONT_UNEXPAND = 0x00002000 - KF_FLAG_NO_ALIAS = 0x00001000 - KF_FLAG_INIT = 0x00000800 - KF_FLAG_DEFAULT_PATH = 0x00000400 - KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200 - KF_FLAG_SIMPLE_IDLIST = 0x00000100 - KF_FLAG_ALIAS_ONLY = 0x80000000 -) diff --git a/vendor/golang.org/x/sys/windows/types_windows_arm.go b/vendor/golang.org/x/sys/windows/types_windows_arm.go deleted file mode 100644 index 74571e36..00000000 --- a/vendor/golang.org/x/sys/windows/types_windows_arm.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -type WSAData struct { - Version uint16 - HighVersion uint16 - Description [WSADESCRIPTION_LEN + 1]byte - SystemStatus [WSASYS_STATUS_LEN + 1]byte - MaxSockets uint16 - MaxUdpDg uint16 - VendorInfo *byte -} - -type Servent struct { - Name *byte - Aliases **byte - Port uint16 - Proto *byte -} diff --git a/vendor/golang.org/x/sys/windows/zerrors_windows.go b/vendor/golang.org/x/sys/windows/zerrors_windows.go deleted file mode 100644 index f0212003..00000000 --- a/vendor/golang.org/x/sys/windows/zerrors_windows.go +++ /dev/null @@ -1,6853 +0,0 @@ -// Code generated by 'mkerrors.bash'; DO NOT EDIT. - -package windows - -import "syscall" - -const ( - FACILITY_NULL = 0 - FACILITY_RPC = 1 - FACILITY_DISPATCH = 2 - FACILITY_STORAGE = 3 - FACILITY_ITF = 4 - FACILITY_WIN32 = 7 - FACILITY_WINDOWS = 8 - FACILITY_SSPI = 9 - FACILITY_SECURITY = 9 - FACILITY_CONTROL = 10 - FACILITY_CERT = 11 - FACILITY_INTERNET = 12 - FACILITY_MEDIASERVER = 13 - FACILITY_MSMQ = 14 - FACILITY_SETUPAPI = 15 - FACILITY_SCARD = 16 - FACILITY_COMPLUS = 17 - FACILITY_AAF = 18 - FACILITY_URT = 19 - FACILITY_ACS = 20 - FACILITY_DPLAY = 21 - FACILITY_UMI = 22 - FACILITY_SXS = 23 - FACILITY_WINDOWS_CE = 24 - FACILITY_HTTP = 25 - FACILITY_USERMODE_COMMONLOG = 26 - FACILITY_WER = 27 - FACILITY_USERMODE_FILTER_MANAGER = 31 - FACILITY_BACKGROUNDCOPY = 32 - FACILITY_CONFIGURATION = 33 - FACILITY_WIA = 33 - FACILITY_STATE_MANAGEMENT = 34 - FACILITY_METADIRECTORY = 35 - FACILITY_WINDOWSUPDATE = 36 - FACILITY_DIRECTORYSERVICE = 37 - FACILITY_GRAPHICS = 38 - FACILITY_SHELL = 39 - FACILITY_NAP = 39 - FACILITY_TPM_SERVICES = 40 - FACILITY_TPM_SOFTWARE = 41 - FACILITY_UI = 42 - FACILITY_XAML = 43 - FACILITY_ACTION_QUEUE = 44 - FACILITY_PLA = 48 - FACILITY_WINDOWS_SETUP = 48 - FACILITY_FVE = 49 - FACILITY_FWP = 50 - FACILITY_WINRM = 51 - FACILITY_NDIS = 52 - FACILITY_USERMODE_HYPERVISOR = 53 - FACILITY_CMI = 54 - FACILITY_USERMODE_VIRTUALIZATION = 55 - FACILITY_USERMODE_VOLMGR = 56 - FACILITY_BCD = 57 - FACILITY_USERMODE_VHD = 58 - FACILITY_USERMODE_HNS = 59 - FACILITY_SDIAG = 60 - FACILITY_WEBSERVICES = 61 - FACILITY_WINPE = 61 - FACILITY_WPN = 62 - FACILITY_WINDOWS_STORE = 63 - FACILITY_INPUT = 64 - FACILITY_EAP = 66 - FACILITY_WINDOWS_DEFENDER = 80 - FACILITY_OPC = 81 - FACILITY_XPS = 82 - FACILITY_MBN = 84 - FACILITY_POWERSHELL = 84 - FACILITY_RAS = 83 - FACILITY_P2P_INT = 98 - FACILITY_P2P = 99 - FACILITY_DAF = 100 - FACILITY_BLUETOOTH_ATT = 101 - FACILITY_AUDIO = 102 - FACILITY_STATEREPOSITORY = 103 - FACILITY_VISUALCPP = 109 - FACILITY_SCRIPT = 112 - FACILITY_PARSE = 113 - FACILITY_BLB = 120 - FACILITY_BLB_CLI = 121 - FACILITY_WSBAPP = 122 - FACILITY_BLBUI = 128 - FACILITY_USN = 129 - FACILITY_USERMODE_VOLSNAP = 130 - FACILITY_TIERING = 131 - FACILITY_WSB_ONLINE = 133 - FACILITY_ONLINE_ID = 134 - FACILITY_DEVICE_UPDATE_AGENT = 135 - FACILITY_DRVSERVICING = 136 - FACILITY_DLS = 153 - FACILITY_DELIVERY_OPTIMIZATION = 208 - FACILITY_USERMODE_SPACES = 231 - FACILITY_USER_MODE_SECURITY_CORE = 232 - FACILITY_USERMODE_LICENSING = 234 - FACILITY_SOS = 160 - FACILITY_DEBUGGERS = 176 - FACILITY_SPP = 256 - FACILITY_RESTORE = 256 - FACILITY_DMSERVER = 256 - FACILITY_DEPLOYMENT_SERVICES_SERVER = 257 - FACILITY_DEPLOYMENT_SERVICES_IMAGING = 258 - FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT = 259 - FACILITY_DEPLOYMENT_SERVICES_UTIL = 260 - FACILITY_DEPLOYMENT_SERVICES_BINLSVC = 261 - FACILITY_DEPLOYMENT_SERVICES_PXE = 263 - FACILITY_DEPLOYMENT_SERVICES_TFTP = 264 - FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT = 272 - FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING = 278 - FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER = 289 - FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT = 290 - FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER = 293 - FACILITY_LINGUISTIC_SERVICES = 305 - FACILITY_AUDIOSTREAMING = 1094 - FACILITY_ACCELERATOR = 1536 - FACILITY_WMAAECMA = 1996 - FACILITY_DIRECTMUSIC = 2168 - FACILITY_DIRECT3D10 = 2169 - FACILITY_DXGI = 2170 - FACILITY_DXGI_DDI = 2171 - FACILITY_DIRECT3D11 = 2172 - FACILITY_DIRECT3D11_DEBUG = 2173 - FACILITY_DIRECT3D12 = 2174 - FACILITY_DIRECT3D12_DEBUG = 2175 - FACILITY_LEAP = 2184 - FACILITY_AUDCLNT = 2185 - FACILITY_WINCODEC_DWRITE_DWM = 2200 - FACILITY_WINML = 2192 - FACILITY_DIRECT2D = 2201 - FACILITY_DEFRAG = 2304 - FACILITY_USERMODE_SDBUS = 2305 - FACILITY_JSCRIPT = 2306 - FACILITY_PIDGENX = 2561 - FACILITY_EAS = 85 - FACILITY_WEB = 885 - FACILITY_WEB_SOCKET = 886 - FACILITY_MOBILE = 1793 - FACILITY_SQLITE = 1967 - FACILITY_UTC = 1989 - FACILITY_WEP = 2049 - FACILITY_SYNCENGINE = 2050 - FACILITY_XBOX = 2339 - FACILITY_PIX = 2748 - ERROR_SUCCESS syscall.Errno = 0 - NO_ERROR = 0 - SEC_E_OK Handle = 0x00000000 - ERROR_INVALID_FUNCTION syscall.Errno = 1 - ERROR_FILE_NOT_FOUND syscall.Errno = 2 - ERROR_PATH_NOT_FOUND syscall.Errno = 3 - ERROR_TOO_MANY_OPEN_FILES syscall.Errno = 4 - ERROR_ACCESS_DENIED syscall.Errno = 5 - ERROR_INVALID_HANDLE syscall.Errno = 6 - ERROR_ARENA_TRASHED syscall.Errno = 7 - ERROR_NOT_ENOUGH_MEMORY syscall.Errno = 8 - ERROR_INVALID_BLOCK syscall.Errno = 9 - ERROR_BAD_ENVIRONMENT syscall.Errno = 10 - ERROR_BAD_FORMAT syscall.Errno = 11 - ERROR_INVALID_ACCESS syscall.Errno = 12 - ERROR_INVALID_DATA syscall.Errno = 13 - ERROR_OUTOFMEMORY syscall.Errno = 14 - ERROR_INVALID_DRIVE syscall.Errno = 15 - ERROR_CURRENT_DIRECTORY syscall.Errno = 16 - ERROR_NOT_SAME_DEVICE syscall.Errno = 17 - ERROR_NO_MORE_FILES syscall.Errno = 18 - ERROR_WRITE_PROTECT syscall.Errno = 19 - ERROR_BAD_UNIT syscall.Errno = 20 - ERROR_NOT_READY syscall.Errno = 21 - ERROR_BAD_COMMAND syscall.Errno = 22 - ERROR_CRC syscall.Errno = 23 - ERROR_BAD_LENGTH syscall.Errno = 24 - ERROR_SEEK syscall.Errno = 25 - ERROR_NOT_DOS_DISK syscall.Errno = 26 - ERROR_SECTOR_NOT_FOUND syscall.Errno = 27 - ERROR_OUT_OF_PAPER syscall.Errno = 28 - ERROR_WRITE_FAULT syscall.Errno = 29 - ERROR_READ_FAULT syscall.Errno = 30 - ERROR_GEN_FAILURE syscall.Errno = 31 - ERROR_SHARING_VIOLATION syscall.Errno = 32 - ERROR_LOCK_VIOLATION syscall.Errno = 33 - ERROR_WRONG_DISK syscall.Errno = 34 - ERROR_SHARING_BUFFER_EXCEEDED syscall.Errno = 36 - ERROR_HANDLE_EOF syscall.Errno = 38 - ERROR_HANDLE_DISK_FULL syscall.Errno = 39 - ERROR_NOT_SUPPORTED syscall.Errno = 50 - ERROR_REM_NOT_LIST syscall.Errno = 51 - ERROR_DUP_NAME syscall.Errno = 52 - ERROR_BAD_NETPATH syscall.Errno = 53 - ERROR_NETWORK_BUSY syscall.Errno = 54 - ERROR_DEV_NOT_EXIST syscall.Errno = 55 - ERROR_TOO_MANY_CMDS syscall.Errno = 56 - ERROR_ADAP_HDW_ERR syscall.Errno = 57 - ERROR_BAD_NET_RESP syscall.Errno = 58 - ERROR_UNEXP_NET_ERR syscall.Errno = 59 - ERROR_BAD_REM_ADAP syscall.Errno = 60 - ERROR_PRINTQ_FULL syscall.Errno = 61 - ERROR_NO_SPOOL_SPACE syscall.Errno = 62 - ERROR_PRINT_CANCELLED syscall.Errno = 63 - ERROR_NETNAME_DELETED syscall.Errno = 64 - ERROR_NETWORK_ACCESS_DENIED syscall.Errno = 65 - ERROR_BAD_DEV_TYPE syscall.Errno = 66 - ERROR_BAD_NET_NAME syscall.Errno = 67 - ERROR_TOO_MANY_NAMES syscall.Errno = 68 - ERROR_TOO_MANY_SESS syscall.Errno = 69 - ERROR_SHARING_PAUSED syscall.Errno = 70 - ERROR_REQ_NOT_ACCEP syscall.Errno = 71 - ERROR_REDIR_PAUSED syscall.Errno = 72 - ERROR_FILE_EXISTS syscall.Errno = 80 - ERROR_CANNOT_MAKE syscall.Errno = 82 - ERROR_FAIL_I24 syscall.Errno = 83 - ERROR_OUT_OF_STRUCTURES syscall.Errno = 84 - ERROR_ALREADY_ASSIGNED syscall.Errno = 85 - ERROR_INVALID_PASSWORD syscall.Errno = 86 - ERROR_INVALID_PARAMETER syscall.Errno = 87 - ERROR_NET_WRITE_FAULT syscall.Errno = 88 - ERROR_NO_PROC_SLOTS syscall.Errno = 89 - ERROR_TOO_MANY_SEMAPHORES syscall.Errno = 100 - ERROR_EXCL_SEM_ALREADY_OWNED syscall.Errno = 101 - ERROR_SEM_IS_SET syscall.Errno = 102 - ERROR_TOO_MANY_SEM_REQUESTS syscall.Errno = 103 - ERROR_INVALID_AT_INTERRUPT_TIME syscall.Errno = 104 - ERROR_SEM_OWNER_DIED syscall.Errno = 105 - ERROR_SEM_USER_LIMIT syscall.Errno = 106 - ERROR_DISK_CHANGE syscall.Errno = 107 - ERROR_DRIVE_LOCKED syscall.Errno = 108 - ERROR_BROKEN_PIPE syscall.Errno = 109 - ERROR_OPEN_FAILED syscall.Errno = 110 - ERROR_BUFFER_OVERFLOW syscall.Errno = 111 - ERROR_DISK_FULL syscall.Errno = 112 - ERROR_NO_MORE_SEARCH_HANDLES syscall.Errno = 113 - ERROR_INVALID_TARGET_HANDLE syscall.Errno = 114 - ERROR_INVALID_CATEGORY syscall.Errno = 117 - ERROR_INVALID_VERIFY_SWITCH syscall.Errno = 118 - ERROR_BAD_DRIVER_LEVEL syscall.Errno = 119 - ERROR_CALL_NOT_IMPLEMENTED syscall.Errno = 120 - ERROR_SEM_TIMEOUT syscall.Errno = 121 - ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 - ERROR_INVALID_NAME syscall.Errno = 123 - ERROR_INVALID_LEVEL syscall.Errno = 124 - ERROR_NO_VOLUME_LABEL syscall.Errno = 125 - ERROR_MOD_NOT_FOUND syscall.Errno = 126 - ERROR_PROC_NOT_FOUND syscall.Errno = 127 - ERROR_WAIT_NO_CHILDREN syscall.Errno = 128 - ERROR_CHILD_NOT_COMPLETE syscall.Errno = 129 - ERROR_DIRECT_ACCESS_HANDLE syscall.Errno = 130 - ERROR_NEGATIVE_SEEK syscall.Errno = 131 - ERROR_SEEK_ON_DEVICE syscall.Errno = 132 - ERROR_IS_JOIN_TARGET syscall.Errno = 133 - ERROR_IS_JOINED syscall.Errno = 134 - ERROR_IS_SUBSTED syscall.Errno = 135 - ERROR_NOT_JOINED syscall.Errno = 136 - ERROR_NOT_SUBSTED syscall.Errno = 137 - ERROR_JOIN_TO_JOIN syscall.Errno = 138 - ERROR_SUBST_TO_SUBST syscall.Errno = 139 - ERROR_JOIN_TO_SUBST syscall.Errno = 140 - ERROR_SUBST_TO_JOIN syscall.Errno = 141 - ERROR_BUSY_DRIVE syscall.Errno = 142 - ERROR_SAME_DRIVE syscall.Errno = 143 - ERROR_DIR_NOT_ROOT syscall.Errno = 144 - ERROR_DIR_NOT_EMPTY syscall.Errno = 145 - ERROR_IS_SUBST_PATH syscall.Errno = 146 - ERROR_IS_JOIN_PATH syscall.Errno = 147 - ERROR_PATH_BUSY syscall.Errno = 148 - ERROR_IS_SUBST_TARGET syscall.Errno = 149 - ERROR_SYSTEM_TRACE syscall.Errno = 150 - ERROR_INVALID_EVENT_COUNT syscall.Errno = 151 - ERROR_TOO_MANY_MUXWAITERS syscall.Errno = 152 - ERROR_INVALID_LIST_FORMAT syscall.Errno = 153 - ERROR_LABEL_TOO_LONG syscall.Errno = 154 - ERROR_TOO_MANY_TCBS syscall.Errno = 155 - ERROR_SIGNAL_REFUSED syscall.Errno = 156 - ERROR_DISCARDED syscall.Errno = 157 - ERROR_NOT_LOCKED syscall.Errno = 158 - ERROR_BAD_THREADID_ADDR syscall.Errno = 159 - ERROR_BAD_ARGUMENTS syscall.Errno = 160 - ERROR_BAD_PATHNAME syscall.Errno = 161 - ERROR_SIGNAL_PENDING syscall.Errno = 162 - ERROR_MAX_THRDS_REACHED syscall.Errno = 164 - ERROR_LOCK_FAILED syscall.Errno = 167 - ERROR_BUSY syscall.Errno = 170 - ERROR_DEVICE_SUPPORT_IN_PROGRESS syscall.Errno = 171 - ERROR_CANCEL_VIOLATION syscall.Errno = 173 - ERROR_ATOMIC_LOCKS_NOT_SUPPORTED syscall.Errno = 174 - ERROR_INVALID_SEGMENT_NUMBER syscall.Errno = 180 - ERROR_INVALID_ORDINAL syscall.Errno = 182 - ERROR_ALREADY_EXISTS syscall.Errno = 183 - ERROR_INVALID_FLAG_NUMBER syscall.Errno = 186 - ERROR_SEM_NOT_FOUND syscall.Errno = 187 - ERROR_INVALID_STARTING_CODESEG syscall.Errno = 188 - ERROR_INVALID_STACKSEG syscall.Errno = 189 - ERROR_INVALID_MODULETYPE syscall.Errno = 190 - ERROR_INVALID_EXE_SIGNATURE syscall.Errno = 191 - ERROR_EXE_MARKED_INVALID syscall.Errno = 192 - ERROR_BAD_EXE_FORMAT syscall.Errno = 193 - ERROR_ITERATED_DATA_EXCEEDS_64k syscall.Errno = 194 - ERROR_INVALID_MINALLOCSIZE syscall.Errno = 195 - ERROR_DYNLINK_FROM_INVALID_RING syscall.Errno = 196 - ERROR_IOPL_NOT_ENABLED syscall.Errno = 197 - ERROR_INVALID_SEGDPL syscall.Errno = 198 - ERROR_AUTODATASEG_EXCEEDS_64k syscall.Errno = 199 - ERROR_RING2SEG_MUST_BE_MOVABLE syscall.Errno = 200 - ERROR_RELOC_CHAIN_XEEDS_SEGLIM syscall.Errno = 201 - ERROR_INFLOOP_IN_RELOC_CHAIN syscall.Errno = 202 - ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 - ERROR_NO_SIGNAL_SENT syscall.Errno = 205 - ERROR_FILENAME_EXCED_RANGE syscall.Errno = 206 - ERROR_RING2_STACK_IN_USE syscall.Errno = 207 - ERROR_META_EXPANSION_TOO_LONG syscall.Errno = 208 - ERROR_INVALID_SIGNAL_NUMBER syscall.Errno = 209 - ERROR_THREAD_1_INACTIVE syscall.Errno = 210 - ERROR_LOCKED syscall.Errno = 212 - ERROR_TOO_MANY_MODULES syscall.Errno = 214 - ERROR_NESTING_NOT_ALLOWED syscall.Errno = 215 - ERROR_EXE_MACHINE_TYPE_MISMATCH syscall.Errno = 216 - ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY syscall.Errno = 217 - ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY syscall.Errno = 218 - ERROR_FILE_CHECKED_OUT syscall.Errno = 220 - ERROR_CHECKOUT_REQUIRED syscall.Errno = 221 - ERROR_BAD_FILE_TYPE syscall.Errno = 222 - ERROR_FILE_TOO_LARGE syscall.Errno = 223 - ERROR_FORMS_AUTH_REQUIRED syscall.Errno = 224 - ERROR_VIRUS_INFECTED syscall.Errno = 225 - ERROR_VIRUS_DELETED syscall.Errno = 226 - ERROR_PIPE_LOCAL syscall.Errno = 229 - ERROR_BAD_PIPE syscall.Errno = 230 - ERROR_PIPE_BUSY syscall.Errno = 231 - ERROR_NO_DATA syscall.Errno = 232 - ERROR_PIPE_NOT_CONNECTED syscall.Errno = 233 - ERROR_MORE_DATA syscall.Errno = 234 - ERROR_NO_WORK_DONE syscall.Errno = 235 - ERROR_VC_DISCONNECTED syscall.Errno = 240 - ERROR_INVALID_EA_NAME syscall.Errno = 254 - ERROR_EA_LIST_INCONSISTENT syscall.Errno = 255 - WAIT_TIMEOUT syscall.Errno = 258 - ERROR_NO_MORE_ITEMS syscall.Errno = 259 - ERROR_CANNOT_COPY syscall.Errno = 266 - ERROR_DIRECTORY syscall.Errno = 267 - ERROR_EAS_DIDNT_FIT syscall.Errno = 275 - ERROR_EA_FILE_CORRUPT syscall.Errno = 276 - ERROR_EA_TABLE_FULL syscall.Errno = 277 - ERROR_INVALID_EA_HANDLE syscall.Errno = 278 - ERROR_EAS_NOT_SUPPORTED syscall.Errno = 282 - ERROR_NOT_OWNER syscall.Errno = 288 - ERROR_TOO_MANY_POSTS syscall.Errno = 298 - ERROR_PARTIAL_COPY syscall.Errno = 299 - ERROR_OPLOCK_NOT_GRANTED syscall.Errno = 300 - ERROR_INVALID_OPLOCK_PROTOCOL syscall.Errno = 301 - ERROR_DISK_TOO_FRAGMENTED syscall.Errno = 302 - ERROR_DELETE_PENDING syscall.Errno = 303 - ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING syscall.Errno = 304 - ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME syscall.Errno = 305 - ERROR_SECURITY_STREAM_IS_INCONSISTENT syscall.Errno = 306 - ERROR_INVALID_LOCK_RANGE syscall.Errno = 307 - ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT syscall.Errno = 308 - ERROR_NOTIFICATION_GUID_ALREADY_DEFINED syscall.Errno = 309 - ERROR_INVALID_EXCEPTION_HANDLER syscall.Errno = 310 - ERROR_DUPLICATE_PRIVILEGES syscall.Errno = 311 - ERROR_NO_RANGES_PROCESSED syscall.Errno = 312 - ERROR_NOT_ALLOWED_ON_SYSTEM_FILE syscall.Errno = 313 - ERROR_DISK_RESOURCES_EXHAUSTED syscall.Errno = 314 - ERROR_INVALID_TOKEN syscall.Errno = 315 - ERROR_DEVICE_FEATURE_NOT_SUPPORTED syscall.Errno = 316 - ERROR_MR_MID_NOT_FOUND syscall.Errno = 317 - ERROR_SCOPE_NOT_FOUND syscall.Errno = 318 - ERROR_UNDEFINED_SCOPE syscall.Errno = 319 - ERROR_INVALID_CAP syscall.Errno = 320 - ERROR_DEVICE_UNREACHABLE syscall.Errno = 321 - ERROR_DEVICE_NO_RESOURCES syscall.Errno = 322 - ERROR_DATA_CHECKSUM_ERROR syscall.Errno = 323 - ERROR_INTERMIXED_KERNEL_EA_OPERATION syscall.Errno = 324 - ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED syscall.Errno = 326 - ERROR_OFFSET_ALIGNMENT_VIOLATION syscall.Errno = 327 - ERROR_INVALID_FIELD_IN_PARAMETER_LIST syscall.Errno = 328 - ERROR_OPERATION_IN_PROGRESS syscall.Errno = 329 - ERROR_BAD_DEVICE_PATH syscall.Errno = 330 - ERROR_TOO_MANY_DESCRIPTORS syscall.Errno = 331 - ERROR_SCRUB_DATA_DISABLED syscall.Errno = 332 - ERROR_NOT_REDUNDANT_STORAGE syscall.Errno = 333 - ERROR_RESIDENT_FILE_NOT_SUPPORTED syscall.Errno = 334 - ERROR_COMPRESSED_FILE_NOT_SUPPORTED syscall.Errno = 335 - ERROR_DIRECTORY_NOT_SUPPORTED syscall.Errno = 336 - ERROR_NOT_READ_FROM_COPY syscall.Errno = 337 - ERROR_FT_WRITE_FAILURE syscall.Errno = 338 - ERROR_FT_DI_SCAN_REQUIRED syscall.Errno = 339 - ERROR_INVALID_KERNEL_INFO_VERSION syscall.Errno = 340 - ERROR_INVALID_PEP_INFO_VERSION syscall.Errno = 341 - ERROR_OBJECT_NOT_EXTERNALLY_BACKED syscall.Errno = 342 - ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN syscall.Errno = 343 - ERROR_COMPRESSION_NOT_BENEFICIAL syscall.Errno = 344 - ERROR_STORAGE_TOPOLOGY_ID_MISMATCH syscall.Errno = 345 - ERROR_BLOCKED_BY_PARENTAL_CONTROLS syscall.Errno = 346 - ERROR_BLOCK_TOO_MANY_REFERENCES syscall.Errno = 347 - ERROR_MARKED_TO_DISALLOW_WRITES syscall.Errno = 348 - ERROR_ENCLAVE_FAILURE syscall.Errno = 349 - ERROR_FAIL_NOACTION_REBOOT syscall.Errno = 350 - ERROR_FAIL_SHUTDOWN syscall.Errno = 351 - ERROR_FAIL_RESTART syscall.Errno = 352 - ERROR_MAX_SESSIONS_REACHED syscall.Errno = 353 - ERROR_NETWORK_ACCESS_DENIED_EDP syscall.Errno = 354 - ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL syscall.Errno = 355 - ERROR_EDP_POLICY_DENIES_OPERATION syscall.Errno = 356 - ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED syscall.Errno = 357 - ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT syscall.Errno = 358 - ERROR_DEVICE_IN_MAINTENANCE syscall.Errno = 359 - ERROR_NOT_SUPPORTED_ON_DAX syscall.Errno = 360 - ERROR_DAX_MAPPING_EXISTS syscall.Errno = 361 - ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING syscall.Errno = 362 - ERROR_CLOUD_FILE_METADATA_CORRUPT syscall.Errno = 363 - ERROR_CLOUD_FILE_METADATA_TOO_LARGE syscall.Errno = 364 - ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE syscall.Errno = 365 - ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH syscall.Errno = 366 - ERROR_CHILD_PROCESS_BLOCKED syscall.Errno = 367 - ERROR_STORAGE_LOST_DATA_PERSISTENCE syscall.Errno = 368 - ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE syscall.Errno = 369 - ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT syscall.Errno = 370 - ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY syscall.Errno = 371 - ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN syscall.Errno = 372 - ERROR_GDI_HANDLE_LEAK syscall.Errno = 373 - ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS syscall.Errno = 374 - ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED syscall.Errno = 375 - ERROR_NOT_A_CLOUD_FILE syscall.Errno = 376 - ERROR_CLOUD_FILE_NOT_IN_SYNC syscall.Errno = 377 - ERROR_CLOUD_FILE_ALREADY_CONNECTED syscall.Errno = 378 - ERROR_CLOUD_FILE_NOT_SUPPORTED syscall.Errno = 379 - ERROR_CLOUD_FILE_INVALID_REQUEST syscall.Errno = 380 - ERROR_CLOUD_FILE_READ_ONLY_VOLUME syscall.Errno = 381 - ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY syscall.Errno = 382 - ERROR_CLOUD_FILE_VALIDATION_FAILED syscall.Errno = 383 - ERROR_SMB1_NOT_AVAILABLE syscall.Errno = 384 - ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION syscall.Errno = 385 - ERROR_CLOUD_FILE_AUTHENTICATION_FAILED syscall.Errno = 386 - ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES syscall.Errno = 387 - ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE syscall.Errno = 388 - ERROR_CLOUD_FILE_UNSUCCESSFUL syscall.Errno = 389 - ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT syscall.Errno = 390 - ERROR_CLOUD_FILE_IN_USE syscall.Errno = 391 - ERROR_CLOUD_FILE_PINNED syscall.Errno = 392 - ERROR_CLOUD_FILE_REQUEST_ABORTED syscall.Errno = 393 - ERROR_CLOUD_FILE_PROPERTY_CORRUPT syscall.Errno = 394 - ERROR_CLOUD_FILE_ACCESS_DENIED syscall.Errno = 395 - ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS syscall.Errno = 396 - ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT syscall.Errno = 397 - ERROR_CLOUD_FILE_REQUEST_CANCELED syscall.Errno = 398 - ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED syscall.Errno = 399 - ERROR_THREAD_MODE_ALREADY_BACKGROUND syscall.Errno = 400 - ERROR_THREAD_MODE_NOT_BACKGROUND syscall.Errno = 401 - ERROR_PROCESS_MODE_ALREADY_BACKGROUND syscall.Errno = 402 - ERROR_PROCESS_MODE_NOT_BACKGROUND syscall.Errno = 403 - ERROR_CLOUD_FILE_PROVIDER_TERMINATED syscall.Errno = 404 - ERROR_NOT_A_CLOUD_SYNC_ROOT syscall.Errno = 405 - ERROR_FILE_PROTECTED_UNDER_DPL syscall.Errno = 406 - ERROR_VOLUME_NOT_CLUSTER_ALIGNED syscall.Errno = 407 - ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND syscall.Errno = 408 - ERROR_APPX_FILE_NOT_ENCRYPTED syscall.Errno = 409 - ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED syscall.Errno = 410 - ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET syscall.Errno = 411 - ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE syscall.Errno = 412 - ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER syscall.Errno = 413 - ERROR_LINUX_SUBSYSTEM_NOT_PRESENT syscall.Errno = 414 - ERROR_FT_READ_FAILURE syscall.Errno = 415 - ERROR_STORAGE_RESERVE_ID_INVALID syscall.Errno = 416 - ERROR_STORAGE_RESERVE_DOES_NOT_EXIST syscall.Errno = 417 - ERROR_STORAGE_RESERVE_ALREADY_EXISTS syscall.Errno = 418 - ERROR_STORAGE_RESERVE_NOT_EMPTY syscall.Errno = 419 - ERROR_NOT_A_DAX_VOLUME syscall.Errno = 420 - ERROR_NOT_DAX_MAPPABLE syscall.Errno = 421 - ERROR_TIME_CRITICAL_THREAD syscall.Errno = 422 - ERROR_DPL_NOT_SUPPORTED_FOR_USER syscall.Errno = 423 - ERROR_CASE_DIFFERING_NAMES_IN_DIR syscall.Errno = 424 - ERROR_CAPAUTHZ_NOT_DEVUNLOCKED syscall.Errno = 450 - ERROR_CAPAUTHZ_CHANGE_TYPE syscall.Errno = 451 - ERROR_CAPAUTHZ_NOT_PROVISIONED syscall.Errno = 452 - ERROR_CAPAUTHZ_NOT_AUTHORIZED syscall.Errno = 453 - ERROR_CAPAUTHZ_NO_POLICY syscall.Errno = 454 - ERROR_CAPAUTHZ_DB_CORRUPTED syscall.Errno = 455 - ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG syscall.Errno = 456 - ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY syscall.Errno = 457 - ERROR_CAPAUTHZ_SCCD_PARSE_ERROR syscall.Errno = 458 - ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED syscall.Errno = 459 - ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH syscall.Errno = 460 - ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT syscall.Errno = 480 - ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT syscall.Errno = 481 - ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT syscall.Errno = 482 - ERROR_DEVICE_HARDWARE_ERROR syscall.Errno = 483 - ERROR_INVALID_ADDRESS syscall.Errno = 487 - ERROR_VRF_CFG_ENABLED syscall.Errno = 1183 - ERROR_PARTITION_TERMINATING syscall.Errno = 1184 - ERROR_USER_PROFILE_LOAD syscall.Errno = 500 - ERROR_ARITHMETIC_OVERFLOW syscall.Errno = 534 - ERROR_PIPE_CONNECTED syscall.Errno = 535 - ERROR_PIPE_LISTENING syscall.Errno = 536 - ERROR_VERIFIER_STOP syscall.Errno = 537 - ERROR_ABIOS_ERROR syscall.Errno = 538 - ERROR_WX86_WARNING syscall.Errno = 539 - ERROR_WX86_ERROR syscall.Errno = 540 - ERROR_TIMER_NOT_CANCELED syscall.Errno = 541 - ERROR_UNWIND syscall.Errno = 542 - ERROR_BAD_STACK syscall.Errno = 543 - ERROR_INVALID_UNWIND_TARGET syscall.Errno = 544 - ERROR_INVALID_PORT_ATTRIBUTES syscall.Errno = 545 - ERROR_PORT_MESSAGE_TOO_LONG syscall.Errno = 546 - ERROR_INVALID_QUOTA_LOWER syscall.Errno = 547 - ERROR_DEVICE_ALREADY_ATTACHED syscall.Errno = 548 - ERROR_INSTRUCTION_MISALIGNMENT syscall.Errno = 549 - ERROR_PROFILING_NOT_STARTED syscall.Errno = 550 - ERROR_PROFILING_NOT_STOPPED syscall.Errno = 551 - ERROR_COULD_NOT_INTERPRET syscall.Errno = 552 - ERROR_PROFILING_AT_LIMIT syscall.Errno = 553 - ERROR_CANT_WAIT syscall.Errno = 554 - ERROR_CANT_TERMINATE_SELF syscall.Errno = 555 - ERROR_UNEXPECTED_MM_CREATE_ERR syscall.Errno = 556 - ERROR_UNEXPECTED_MM_MAP_ERROR syscall.Errno = 557 - ERROR_UNEXPECTED_MM_EXTEND_ERR syscall.Errno = 558 - ERROR_BAD_FUNCTION_TABLE syscall.Errno = 559 - ERROR_NO_GUID_TRANSLATION syscall.Errno = 560 - ERROR_INVALID_LDT_SIZE syscall.Errno = 561 - ERROR_INVALID_LDT_OFFSET syscall.Errno = 563 - ERROR_INVALID_LDT_DESCRIPTOR syscall.Errno = 564 - ERROR_TOO_MANY_THREADS syscall.Errno = 565 - ERROR_THREAD_NOT_IN_PROCESS syscall.Errno = 566 - ERROR_PAGEFILE_QUOTA_EXCEEDED syscall.Errno = 567 - ERROR_LOGON_SERVER_CONFLICT syscall.Errno = 568 - ERROR_SYNCHRONIZATION_REQUIRED syscall.Errno = 569 - ERROR_NET_OPEN_FAILED syscall.Errno = 570 - ERROR_IO_PRIVILEGE_FAILED syscall.Errno = 571 - ERROR_CONTROL_C_EXIT syscall.Errno = 572 - ERROR_MISSING_SYSTEMFILE syscall.Errno = 573 - ERROR_UNHANDLED_EXCEPTION syscall.Errno = 574 - ERROR_APP_INIT_FAILURE syscall.Errno = 575 - ERROR_PAGEFILE_CREATE_FAILED syscall.Errno = 576 - ERROR_INVALID_IMAGE_HASH syscall.Errno = 577 - ERROR_NO_PAGEFILE syscall.Errno = 578 - ERROR_ILLEGAL_FLOAT_CONTEXT syscall.Errno = 579 - ERROR_NO_EVENT_PAIR syscall.Errno = 580 - ERROR_DOMAIN_CTRLR_CONFIG_ERROR syscall.Errno = 581 - ERROR_ILLEGAL_CHARACTER syscall.Errno = 582 - ERROR_UNDEFINED_CHARACTER syscall.Errno = 583 - ERROR_FLOPPY_VOLUME syscall.Errno = 584 - ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT syscall.Errno = 585 - ERROR_BACKUP_CONTROLLER syscall.Errno = 586 - ERROR_MUTANT_LIMIT_EXCEEDED syscall.Errno = 587 - ERROR_FS_DRIVER_REQUIRED syscall.Errno = 588 - ERROR_CANNOT_LOAD_REGISTRY_FILE syscall.Errno = 589 - ERROR_DEBUG_ATTACH_FAILED syscall.Errno = 590 - ERROR_SYSTEM_PROCESS_TERMINATED syscall.Errno = 591 - ERROR_DATA_NOT_ACCEPTED syscall.Errno = 592 - ERROR_VDM_HARD_ERROR syscall.Errno = 593 - ERROR_DRIVER_CANCEL_TIMEOUT syscall.Errno = 594 - ERROR_REPLY_MESSAGE_MISMATCH syscall.Errno = 595 - ERROR_LOST_WRITEBEHIND_DATA syscall.Errno = 596 - ERROR_CLIENT_SERVER_PARAMETERS_INVALID syscall.Errno = 597 - ERROR_NOT_TINY_STREAM syscall.Errno = 598 - ERROR_STACK_OVERFLOW_READ syscall.Errno = 599 - ERROR_CONVERT_TO_LARGE syscall.Errno = 600 - ERROR_FOUND_OUT_OF_SCOPE syscall.Errno = 601 - ERROR_ALLOCATE_BUCKET syscall.Errno = 602 - ERROR_MARSHALL_OVERFLOW syscall.Errno = 603 - ERROR_INVALID_VARIANT syscall.Errno = 604 - ERROR_BAD_COMPRESSION_BUFFER syscall.Errno = 605 - ERROR_AUDIT_FAILED syscall.Errno = 606 - ERROR_TIMER_RESOLUTION_NOT_SET syscall.Errno = 607 - ERROR_INSUFFICIENT_LOGON_INFO syscall.Errno = 608 - ERROR_BAD_DLL_ENTRYPOINT syscall.Errno = 609 - ERROR_BAD_SERVICE_ENTRYPOINT syscall.Errno = 610 - ERROR_IP_ADDRESS_CONFLICT1 syscall.Errno = 611 - ERROR_IP_ADDRESS_CONFLICT2 syscall.Errno = 612 - ERROR_REGISTRY_QUOTA_LIMIT syscall.Errno = 613 - ERROR_NO_CALLBACK_ACTIVE syscall.Errno = 614 - ERROR_PWD_TOO_SHORT syscall.Errno = 615 - ERROR_PWD_TOO_RECENT syscall.Errno = 616 - ERROR_PWD_HISTORY_CONFLICT syscall.Errno = 617 - ERROR_UNSUPPORTED_COMPRESSION syscall.Errno = 618 - ERROR_INVALID_HW_PROFILE syscall.Errno = 619 - ERROR_INVALID_PLUGPLAY_DEVICE_PATH syscall.Errno = 620 - ERROR_QUOTA_LIST_INCONSISTENT syscall.Errno = 621 - ERROR_EVALUATION_EXPIRATION syscall.Errno = 622 - ERROR_ILLEGAL_DLL_RELOCATION syscall.Errno = 623 - ERROR_DLL_INIT_FAILED_LOGOFF syscall.Errno = 624 - ERROR_VALIDATE_CONTINUE syscall.Errno = 625 - ERROR_NO_MORE_MATCHES syscall.Errno = 626 - ERROR_RANGE_LIST_CONFLICT syscall.Errno = 627 - ERROR_SERVER_SID_MISMATCH syscall.Errno = 628 - ERROR_CANT_ENABLE_DENY_ONLY syscall.Errno = 629 - ERROR_FLOAT_MULTIPLE_FAULTS syscall.Errno = 630 - ERROR_FLOAT_MULTIPLE_TRAPS syscall.Errno = 631 - ERROR_NOINTERFACE syscall.Errno = 632 - ERROR_DRIVER_FAILED_SLEEP syscall.Errno = 633 - ERROR_CORRUPT_SYSTEM_FILE syscall.Errno = 634 - ERROR_COMMITMENT_MINIMUM syscall.Errno = 635 - ERROR_PNP_RESTART_ENUMERATION syscall.Errno = 636 - ERROR_SYSTEM_IMAGE_BAD_SIGNATURE syscall.Errno = 637 - ERROR_PNP_REBOOT_REQUIRED syscall.Errno = 638 - ERROR_INSUFFICIENT_POWER syscall.Errno = 639 - ERROR_MULTIPLE_FAULT_VIOLATION syscall.Errno = 640 - ERROR_SYSTEM_SHUTDOWN syscall.Errno = 641 - ERROR_PORT_NOT_SET syscall.Errno = 642 - ERROR_DS_VERSION_CHECK_FAILURE syscall.Errno = 643 - ERROR_RANGE_NOT_FOUND syscall.Errno = 644 - ERROR_NOT_SAFE_MODE_DRIVER syscall.Errno = 646 - ERROR_FAILED_DRIVER_ENTRY syscall.Errno = 647 - ERROR_DEVICE_ENUMERATION_ERROR syscall.Errno = 648 - ERROR_MOUNT_POINT_NOT_RESOLVED syscall.Errno = 649 - ERROR_INVALID_DEVICE_OBJECT_PARAMETER syscall.Errno = 650 - ERROR_MCA_OCCURED syscall.Errno = 651 - ERROR_DRIVER_DATABASE_ERROR syscall.Errno = 652 - ERROR_SYSTEM_HIVE_TOO_LARGE syscall.Errno = 653 - ERROR_DRIVER_FAILED_PRIOR_UNLOAD syscall.Errno = 654 - ERROR_VOLSNAP_PREPARE_HIBERNATE syscall.Errno = 655 - ERROR_HIBERNATION_FAILURE syscall.Errno = 656 - ERROR_PWD_TOO_LONG syscall.Errno = 657 - ERROR_FILE_SYSTEM_LIMITATION syscall.Errno = 665 - ERROR_ASSERTION_FAILURE syscall.Errno = 668 - ERROR_ACPI_ERROR syscall.Errno = 669 - ERROR_WOW_ASSERTION syscall.Errno = 670 - ERROR_PNP_BAD_MPS_TABLE syscall.Errno = 671 - ERROR_PNP_TRANSLATION_FAILED syscall.Errno = 672 - ERROR_PNP_IRQ_TRANSLATION_FAILED syscall.Errno = 673 - ERROR_PNP_INVALID_ID syscall.Errno = 674 - ERROR_WAKE_SYSTEM_DEBUGGER syscall.Errno = 675 - ERROR_HANDLES_CLOSED syscall.Errno = 676 - ERROR_EXTRANEOUS_INFORMATION syscall.Errno = 677 - ERROR_RXACT_COMMIT_NECESSARY syscall.Errno = 678 - ERROR_MEDIA_CHECK syscall.Errno = 679 - ERROR_GUID_SUBSTITUTION_MADE syscall.Errno = 680 - ERROR_STOPPED_ON_SYMLINK syscall.Errno = 681 - ERROR_LONGJUMP syscall.Errno = 682 - ERROR_PLUGPLAY_QUERY_VETOED syscall.Errno = 683 - ERROR_UNWIND_CONSOLIDATE syscall.Errno = 684 - ERROR_REGISTRY_HIVE_RECOVERED syscall.Errno = 685 - ERROR_DLL_MIGHT_BE_INSECURE syscall.Errno = 686 - ERROR_DLL_MIGHT_BE_INCOMPATIBLE syscall.Errno = 687 - ERROR_DBG_EXCEPTION_NOT_HANDLED syscall.Errno = 688 - ERROR_DBG_REPLY_LATER syscall.Errno = 689 - ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE syscall.Errno = 690 - ERROR_DBG_TERMINATE_THREAD syscall.Errno = 691 - ERROR_DBG_TERMINATE_PROCESS syscall.Errno = 692 - ERROR_DBG_CONTROL_C syscall.Errno = 693 - ERROR_DBG_PRINTEXCEPTION_C syscall.Errno = 694 - ERROR_DBG_RIPEXCEPTION syscall.Errno = 695 - ERROR_DBG_CONTROL_BREAK syscall.Errno = 696 - ERROR_DBG_COMMAND_EXCEPTION syscall.Errno = 697 - ERROR_OBJECT_NAME_EXISTS syscall.Errno = 698 - ERROR_THREAD_WAS_SUSPENDED syscall.Errno = 699 - ERROR_IMAGE_NOT_AT_BASE syscall.Errno = 700 - ERROR_RXACT_STATE_CREATED syscall.Errno = 701 - ERROR_SEGMENT_NOTIFICATION syscall.Errno = 702 - ERROR_BAD_CURRENT_DIRECTORY syscall.Errno = 703 - ERROR_FT_READ_RECOVERY_FROM_BACKUP syscall.Errno = 704 - ERROR_FT_WRITE_RECOVERY syscall.Errno = 705 - ERROR_IMAGE_MACHINE_TYPE_MISMATCH syscall.Errno = 706 - ERROR_RECEIVE_PARTIAL syscall.Errno = 707 - ERROR_RECEIVE_EXPEDITED syscall.Errno = 708 - ERROR_RECEIVE_PARTIAL_EXPEDITED syscall.Errno = 709 - ERROR_EVENT_DONE syscall.Errno = 710 - ERROR_EVENT_PENDING syscall.Errno = 711 - ERROR_CHECKING_FILE_SYSTEM syscall.Errno = 712 - ERROR_FATAL_APP_EXIT syscall.Errno = 713 - ERROR_PREDEFINED_HANDLE syscall.Errno = 714 - ERROR_WAS_UNLOCKED syscall.Errno = 715 - ERROR_SERVICE_NOTIFICATION syscall.Errno = 716 - ERROR_WAS_LOCKED syscall.Errno = 717 - ERROR_LOG_HARD_ERROR syscall.Errno = 718 - ERROR_ALREADY_WIN32 syscall.Errno = 719 - ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE syscall.Errno = 720 - ERROR_NO_YIELD_PERFORMED syscall.Errno = 721 - ERROR_TIMER_RESUME_IGNORED syscall.Errno = 722 - ERROR_ARBITRATION_UNHANDLED syscall.Errno = 723 - ERROR_CARDBUS_NOT_SUPPORTED syscall.Errno = 724 - ERROR_MP_PROCESSOR_MISMATCH syscall.Errno = 725 - ERROR_HIBERNATED syscall.Errno = 726 - ERROR_RESUME_HIBERNATION syscall.Errno = 727 - ERROR_FIRMWARE_UPDATED syscall.Errno = 728 - ERROR_DRIVERS_LEAKING_LOCKED_PAGES syscall.Errno = 729 - ERROR_WAKE_SYSTEM syscall.Errno = 730 - ERROR_WAIT_1 syscall.Errno = 731 - ERROR_WAIT_2 syscall.Errno = 732 - ERROR_WAIT_3 syscall.Errno = 733 - ERROR_WAIT_63 syscall.Errno = 734 - ERROR_ABANDONED_WAIT_0 syscall.Errno = 735 - ERROR_ABANDONED_WAIT_63 syscall.Errno = 736 - ERROR_USER_APC syscall.Errno = 737 - ERROR_KERNEL_APC syscall.Errno = 738 - ERROR_ALERTED syscall.Errno = 739 - ERROR_ELEVATION_REQUIRED syscall.Errno = 740 - ERROR_REPARSE syscall.Errno = 741 - ERROR_OPLOCK_BREAK_IN_PROGRESS syscall.Errno = 742 - ERROR_VOLUME_MOUNTED syscall.Errno = 743 - ERROR_RXACT_COMMITTED syscall.Errno = 744 - ERROR_NOTIFY_CLEANUP syscall.Errno = 745 - ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED syscall.Errno = 746 - ERROR_PAGE_FAULT_TRANSITION syscall.Errno = 747 - ERROR_PAGE_FAULT_DEMAND_ZERO syscall.Errno = 748 - ERROR_PAGE_FAULT_COPY_ON_WRITE syscall.Errno = 749 - ERROR_PAGE_FAULT_GUARD_PAGE syscall.Errno = 750 - ERROR_PAGE_FAULT_PAGING_FILE syscall.Errno = 751 - ERROR_CACHE_PAGE_LOCKED syscall.Errno = 752 - ERROR_CRASH_DUMP syscall.Errno = 753 - ERROR_BUFFER_ALL_ZEROS syscall.Errno = 754 - ERROR_REPARSE_OBJECT syscall.Errno = 755 - ERROR_RESOURCE_REQUIREMENTS_CHANGED syscall.Errno = 756 - ERROR_TRANSLATION_COMPLETE syscall.Errno = 757 - ERROR_NOTHING_TO_TERMINATE syscall.Errno = 758 - ERROR_PROCESS_NOT_IN_JOB syscall.Errno = 759 - ERROR_PROCESS_IN_JOB syscall.Errno = 760 - ERROR_VOLSNAP_HIBERNATE_READY syscall.Errno = 761 - ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY syscall.Errno = 762 - ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED syscall.Errno = 763 - ERROR_INTERRUPT_STILL_CONNECTED syscall.Errno = 764 - ERROR_WAIT_FOR_OPLOCK syscall.Errno = 765 - ERROR_DBG_EXCEPTION_HANDLED syscall.Errno = 766 - ERROR_DBG_CONTINUE syscall.Errno = 767 - ERROR_CALLBACK_POP_STACK syscall.Errno = 768 - ERROR_COMPRESSION_DISABLED syscall.Errno = 769 - ERROR_CANTFETCHBACKWARDS syscall.Errno = 770 - ERROR_CANTSCROLLBACKWARDS syscall.Errno = 771 - ERROR_ROWSNOTRELEASED syscall.Errno = 772 - ERROR_BAD_ACCESSOR_FLAGS syscall.Errno = 773 - ERROR_ERRORS_ENCOUNTERED syscall.Errno = 774 - ERROR_NOT_CAPABLE syscall.Errno = 775 - ERROR_REQUEST_OUT_OF_SEQUENCE syscall.Errno = 776 - ERROR_VERSION_PARSE_ERROR syscall.Errno = 777 - ERROR_BADSTARTPOSITION syscall.Errno = 778 - ERROR_MEMORY_HARDWARE syscall.Errno = 779 - ERROR_DISK_REPAIR_DISABLED syscall.Errno = 780 - ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE syscall.Errno = 781 - ERROR_SYSTEM_POWERSTATE_TRANSITION syscall.Errno = 782 - ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION syscall.Errno = 783 - ERROR_MCA_EXCEPTION syscall.Errno = 784 - ERROR_ACCESS_AUDIT_BY_POLICY syscall.Errno = 785 - ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY syscall.Errno = 786 - ERROR_ABANDON_HIBERFILE syscall.Errno = 787 - ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED syscall.Errno = 788 - ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR syscall.Errno = 789 - ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR syscall.Errno = 790 - ERROR_BAD_MCFG_TABLE syscall.Errno = 791 - ERROR_DISK_REPAIR_REDIRECTED syscall.Errno = 792 - ERROR_DISK_REPAIR_UNSUCCESSFUL syscall.Errno = 793 - ERROR_CORRUPT_LOG_OVERFULL syscall.Errno = 794 - ERROR_CORRUPT_LOG_CORRUPTED syscall.Errno = 795 - ERROR_CORRUPT_LOG_UNAVAILABLE syscall.Errno = 796 - ERROR_CORRUPT_LOG_DELETED_FULL syscall.Errno = 797 - ERROR_CORRUPT_LOG_CLEARED syscall.Errno = 798 - ERROR_ORPHAN_NAME_EXHAUSTED syscall.Errno = 799 - ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE syscall.Errno = 800 - ERROR_CANNOT_GRANT_REQUESTED_OPLOCK syscall.Errno = 801 - ERROR_CANNOT_BREAK_OPLOCK syscall.Errno = 802 - ERROR_OPLOCK_HANDLE_CLOSED syscall.Errno = 803 - ERROR_NO_ACE_CONDITION syscall.Errno = 804 - ERROR_INVALID_ACE_CONDITION syscall.Errno = 805 - ERROR_FILE_HANDLE_REVOKED syscall.Errno = 806 - ERROR_IMAGE_AT_DIFFERENT_BASE syscall.Errno = 807 - ERROR_ENCRYPTED_IO_NOT_POSSIBLE syscall.Errno = 808 - ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS syscall.Errno = 809 - ERROR_QUOTA_ACTIVITY syscall.Errno = 810 - ERROR_HANDLE_REVOKED syscall.Errno = 811 - ERROR_CALLBACK_INVOKE_INLINE syscall.Errno = 812 - ERROR_CPU_SET_INVALID syscall.Errno = 813 - ERROR_ENCLAVE_NOT_TERMINATED syscall.Errno = 814 - ERROR_ENCLAVE_VIOLATION syscall.Errno = 815 - ERROR_EA_ACCESS_DENIED syscall.Errno = 994 - ERROR_OPERATION_ABORTED syscall.Errno = 995 - ERROR_IO_INCOMPLETE syscall.Errno = 996 - ERROR_IO_PENDING syscall.Errno = 997 - ERROR_NOACCESS syscall.Errno = 998 - ERROR_SWAPERROR syscall.Errno = 999 - ERROR_STACK_OVERFLOW syscall.Errno = 1001 - ERROR_INVALID_MESSAGE syscall.Errno = 1002 - ERROR_CAN_NOT_COMPLETE syscall.Errno = 1003 - ERROR_INVALID_FLAGS syscall.Errno = 1004 - ERROR_UNRECOGNIZED_VOLUME syscall.Errno = 1005 - ERROR_FILE_INVALID syscall.Errno = 1006 - ERROR_FULLSCREEN_MODE syscall.Errno = 1007 - ERROR_NO_TOKEN syscall.Errno = 1008 - ERROR_BADDB syscall.Errno = 1009 - ERROR_BADKEY syscall.Errno = 1010 - ERROR_CANTOPEN syscall.Errno = 1011 - ERROR_CANTREAD syscall.Errno = 1012 - ERROR_CANTWRITE syscall.Errno = 1013 - ERROR_REGISTRY_RECOVERED syscall.Errno = 1014 - ERROR_REGISTRY_CORRUPT syscall.Errno = 1015 - ERROR_REGISTRY_IO_FAILED syscall.Errno = 1016 - ERROR_NOT_REGISTRY_FILE syscall.Errno = 1017 - ERROR_KEY_DELETED syscall.Errno = 1018 - ERROR_NO_LOG_SPACE syscall.Errno = 1019 - ERROR_KEY_HAS_CHILDREN syscall.Errno = 1020 - ERROR_CHILD_MUST_BE_VOLATILE syscall.Errno = 1021 - ERROR_NOTIFY_ENUM_DIR syscall.Errno = 1022 - ERROR_DEPENDENT_SERVICES_RUNNING syscall.Errno = 1051 - ERROR_INVALID_SERVICE_CONTROL syscall.Errno = 1052 - ERROR_SERVICE_REQUEST_TIMEOUT syscall.Errno = 1053 - ERROR_SERVICE_NO_THREAD syscall.Errno = 1054 - ERROR_SERVICE_DATABASE_LOCKED syscall.Errno = 1055 - ERROR_SERVICE_ALREADY_RUNNING syscall.Errno = 1056 - ERROR_INVALID_SERVICE_ACCOUNT syscall.Errno = 1057 - ERROR_SERVICE_DISABLED syscall.Errno = 1058 - ERROR_CIRCULAR_DEPENDENCY syscall.Errno = 1059 - ERROR_SERVICE_DOES_NOT_EXIST syscall.Errno = 1060 - ERROR_SERVICE_CANNOT_ACCEPT_CTRL syscall.Errno = 1061 - ERROR_SERVICE_NOT_ACTIVE syscall.Errno = 1062 - ERROR_FAILED_SERVICE_CONTROLLER_CONNECT syscall.Errno = 1063 - ERROR_EXCEPTION_IN_SERVICE syscall.Errno = 1064 - ERROR_DATABASE_DOES_NOT_EXIST syscall.Errno = 1065 - ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 - ERROR_PROCESS_ABORTED syscall.Errno = 1067 - ERROR_SERVICE_DEPENDENCY_FAIL syscall.Errno = 1068 - ERROR_SERVICE_LOGON_FAILED syscall.Errno = 1069 - ERROR_SERVICE_START_HANG syscall.Errno = 1070 - ERROR_INVALID_SERVICE_LOCK syscall.Errno = 1071 - ERROR_SERVICE_MARKED_FOR_DELETE syscall.Errno = 1072 - ERROR_SERVICE_EXISTS syscall.Errno = 1073 - ERROR_ALREADY_RUNNING_LKG syscall.Errno = 1074 - ERROR_SERVICE_DEPENDENCY_DELETED syscall.Errno = 1075 - ERROR_BOOT_ALREADY_ACCEPTED syscall.Errno = 1076 - ERROR_SERVICE_NEVER_STARTED syscall.Errno = 1077 - ERROR_DUPLICATE_SERVICE_NAME syscall.Errno = 1078 - ERROR_DIFFERENT_SERVICE_ACCOUNT syscall.Errno = 1079 - ERROR_CANNOT_DETECT_DRIVER_FAILURE syscall.Errno = 1080 - ERROR_CANNOT_DETECT_PROCESS_ABORT syscall.Errno = 1081 - ERROR_NO_RECOVERY_PROGRAM syscall.Errno = 1082 - ERROR_SERVICE_NOT_IN_EXE syscall.Errno = 1083 - ERROR_NOT_SAFEBOOT_SERVICE syscall.Errno = 1084 - ERROR_END_OF_MEDIA syscall.Errno = 1100 - ERROR_FILEMARK_DETECTED syscall.Errno = 1101 - ERROR_BEGINNING_OF_MEDIA syscall.Errno = 1102 - ERROR_SETMARK_DETECTED syscall.Errno = 1103 - ERROR_NO_DATA_DETECTED syscall.Errno = 1104 - ERROR_PARTITION_FAILURE syscall.Errno = 1105 - ERROR_INVALID_BLOCK_LENGTH syscall.Errno = 1106 - ERROR_DEVICE_NOT_PARTITIONED syscall.Errno = 1107 - ERROR_UNABLE_TO_LOCK_MEDIA syscall.Errno = 1108 - ERROR_UNABLE_TO_UNLOAD_MEDIA syscall.Errno = 1109 - ERROR_MEDIA_CHANGED syscall.Errno = 1110 - ERROR_BUS_RESET syscall.Errno = 1111 - ERROR_NO_MEDIA_IN_DRIVE syscall.Errno = 1112 - ERROR_NO_UNICODE_TRANSLATION syscall.Errno = 1113 - ERROR_DLL_INIT_FAILED syscall.Errno = 1114 - ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 1115 - ERROR_NO_SHUTDOWN_IN_PROGRESS syscall.Errno = 1116 - ERROR_IO_DEVICE syscall.Errno = 1117 - ERROR_SERIAL_NO_DEVICE syscall.Errno = 1118 - ERROR_IRQ_BUSY syscall.Errno = 1119 - ERROR_MORE_WRITES syscall.Errno = 1120 - ERROR_COUNTER_TIMEOUT syscall.Errno = 1121 - ERROR_FLOPPY_ID_MARK_NOT_FOUND syscall.Errno = 1122 - ERROR_FLOPPY_WRONG_CYLINDER syscall.Errno = 1123 - ERROR_FLOPPY_UNKNOWN_ERROR syscall.Errno = 1124 - ERROR_FLOPPY_BAD_REGISTERS syscall.Errno = 1125 - ERROR_DISK_RECALIBRATE_FAILED syscall.Errno = 1126 - ERROR_DISK_OPERATION_FAILED syscall.Errno = 1127 - ERROR_DISK_RESET_FAILED syscall.Errno = 1128 - ERROR_EOM_OVERFLOW syscall.Errno = 1129 - ERROR_NOT_ENOUGH_SERVER_MEMORY syscall.Errno = 1130 - ERROR_POSSIBLE_DEADLOCK syscall.Errno = 1131 - ERROR_MAPPED_ALIGNMENT syscall.Errno = 1132 - ERROR_SET_POWER_STATE_VETOED syscall.Errno = 1140 - ERROR_SET_POWER_STATE_FAILED syscall.Errno = 1141 - ERROR_TOO_MANY_LINKS syscall.Errno = 1142 - ERROR_OLD_WIN_VERSION syscall.Errno = 1150 - ERROR_APP_WRONG_OS syscall.Errno = 1151 - ERROR_SINGLE_INSTANCE_APP syscall.Errno = 1152 - ERROR_RMODE_APP syscall.Errno = 1153 - ERROR_INVALID_DLL syscall.Errno = 1154 - ERROR_NO_ASSOCIATION syscall.Errno = 1155 - ERROR_DDE_FAIL syscall.Errno = 1156 - ERROR_DLL_NOT_FOUND syscall.Errno = 1157 - ERROR_NO_MORE_USER_HANDLES syscall.Errno = 1158 - ERROR_MESSAGE_SYNC_ONLY syscall.Errno = 1159 - ERROR_SOURCE_ELEMENT_EMPTY syscall.Errno = 1160 - ERROR_DESTINATION_ELEMENT_FULL syscall.Errno = 1161 - ERROR_ILLEGAL_ELEMENT_ADDRESS syscall.Errno = 1162 - ERROR_MAGAZINE_NOT_PRESENT syscall.Errno = 1163 - ERROR_DEVICE_REINITIALIZATION_NEEDED syscall.Errno = 1164 - ERROR_DEVICE_REQUIRES_CLEANING syscall.Errno = 1165 - ERROR_DEVICE_DOOR_OPEN syscall.Errno = 1166 - ERROR_DEVICE_NOT_CONNECTED syscall.Errno = 1167 - ERROR_NOT_FOUND syscall.Errno = 1168 - ERROR_NO_MATCH syscall.Errno = 1169 - ERROR_SET_NOT_FOUND syscall.Errno = 1170 - ERROR_POINT_NOT_FOUND syscall.Errno = 1171 - ERROR_NO_TRACKING_SERVICE syscall.Errno = 1172 - ERROR_NO_VOLUME_ID syscall.Errno = 1173 - ERROR_UNABLE_TO_REMOVE_REPLACED syscall.Errno = 1175 - ERROR_UNABLE_TO_MOVE_REPLACEMENT syscall.Errno = 1176 - ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 syscall.Errno = 1177 - ERROR_JOURNAL_DELETE_IN_PROGRESS syscall.Errno = 1178 - ERROR_JOURNAL_NOT_ACTIVE syscall.Errno = 1179 - ERROR_POTENTIAL_FILE_FOUND syscall.Errno = 1180 - ERROR_JOURNAL_ENTRY_DELETED syscall.Errno = 1181 - ERROR_SHUTDOWN_IS_SCHEDULED syscall.Errno = 1190 - ERROR_SHUTDOWN_USERS_LOGGED_ON syscall.Errno = 1191 - ERROR_BAD_DEVICE syscall.Errno = 1200 - ERROR_CONNECTION_UNAVAIL syscall.Errno = 1201 - ERROR_DEVICE_ALREADY_REMEMBERED syscall.Errno = 1202 - ERROR_NO_NET_OR_BAD_PATH syscall.Errno = 1203 - ERROR_BAD_PROVIDER syscall.Errno = 1204 - ERROR_CANNOT_OPEN_PROFILE syscall.Errno = 1205 - ERROR_BAD_PROFILE syscall.Errno = 1206 - ERROR_NOT_CONTAINER syscall.Errno = 1207 - ERROR_EXTENDED_ERROR syscall.Errno = 1208 - ERROR_INVALID_GROUPNAME syscall.Errno = 1209 - ERROR_INVALID_COMPUTERNAME syscall.Errno = 1210 - ERROR_INVALID_EVENTNAME syscall.Errno = 1211 - ERROR_INVALID_DOMAINNAME syscall.Errno = 1212 - ERROR_INVALID_SERVICENAME syscall.Errno = 1213 - ERROR_INVALID_NETNAME syscall.Errno = 1214 - ERROR_INVALID_SHARENAME syscall.Errno = 1215 - ERROR_INVALID_PASSWORDNAME syscall.Errno = 1216 - ERROR_INVALID_MESSAGENAME syscall.Errno = 1217 - ERROR_INVALID_MESSAGEDEST syscall.Errno = 1218 - ERROR_SESSION_CREDENTIAL_CONFLICT syscall.Errno = 1219 - ERROR_REMOTE_SESSION_LIMIT_EXCEEDED syscall.Errno = 1220 - ERROR_DUP_DOMAINNAME syscall.Errno = 1221 - ERROR_NO_NETWORK syscall.Errno = 1222 - ERROR_CANCELLED syscall.Errno = 1223 - ERROR_USER_MAPPED_FILE syscall.Errno = 1224 - ERROR_CONNECTION_REFUSED syscall.Errno = 1225 - ERROR_GRACEFUL_DISCONNECT syscall.Errno = 1226 - ERROR_ADDRESS_ALREADY_ASSOCIATED syscall.Errno = 1227 - ERROR_ADDRESS_NOT_ASSOCIATED syscall.Errno = 1228 - ERROR_CONNECTION_INVALID syscall.Errno = 1229 - ERROR_CONNECTION_ACTIVE syscall.Errno = 1230 - ERROR_NETWORK_UNREACHABLE syscall.Errno = 1231 - ERROR_HOST_UNREACHABLE syscall.Errno = 1232 - ERROR_PROTOCOL_UNREACHABLE syscall.Errno = 1233 - ERROR_PORT_UNREACHABLE syscall.Errno = 1234 - ERROR_REQUEST_ABORTED syscall.Errno = 1235 - ERROR_CONNECTION_ABORTED syscall.Errno = 1236 - ERROR_RETRY syscall.Errno = 1237 - ERROR_CONNECTION_COUNT_LIMIT syscall.Errno = 1238 - ERROR_LOGIN_TIME_RESTRICTION syscall.Errno = 1239 - ERROR_LOGIN_WKSTA_RESTRICTION syscall.Errno = 1240 - ERROR_INCORRECT_ADDRESS syscall.Errno = 1241 - ERROR_ALREADY_REGISTERED syscall.Errno = 1242 - ERROR_SERVICE_NOT_FOUND syscall.Errno = 1243 - ERROR_NOT_AUTHENTICATED syscall.Errno = 1244 - ERROR_NOT_LOGGED_ON syscall.Errno = 1245 - ERROR_CONTINUE syscall.Errno = 1246 - ERROR_ALREADY_INITIALIZED syscall.Errno = 1247 - ERROR_NO_MORE_DEVICES syscall.Errno = 1248 - ERROR_NO_SUCH_SITE syscall.Errno = 1249 - ERROR_DOMAIN_CONTROLLER_EXISTS syscall.Errno = 1250 - ERROR_ONLY_IF_CONNECTED syscall.Errno = 1251 - ERROR_OVERRIDE_NOCHANGES syscall.Errno = 1252 - ERROR_BAD_USER_PROFILE syscall.Errno = 1253 - ERROR_NOT_SUPPORTED_ON_SBS syscall.Errno = 1254 - ERROR_SERVER_SHUTDOWN_IN_PROGRESS syscall.Errno = 1255 - ERROR_HOST_DOWN syscall.Errno = 1256 - ERROR_NON_ACCOUNT_SID syscall.Errno = 1257 - ERROR_NON_DOMAIN_SID syscall.Errno = 1258 - ERROR_APPHELP_BLOCK syscall.Errno = 1259 - ERROR_ACCESS_DISABLED_BY_POLICY syscall.Errno = 1260 - ERROR_REG_NAT_CONSUMPTION syscall.Errno = 1261 - ERROR_CSCSHARE_OFFLINE syscall.Errno = 1262 - ERROR_PKINIT_FAILURE syscall.Errno = 1263 - ERROR_SMARTCARD_SUBSYSTEM_FAILURE syscall.Errno = 1264 - ERROR_DOWNGRADE_DETECTED syscall.Errno = 1265 - ERROR_MACHINE_LOCKED syscall.Errno = 1271 - ERROR_SMB_GUEST_LOGON_BLOCKED syscall.Errno = 1272 - ERROR_CALLBACK_SUPPLIED_INVALID_DATA syscall.Errno = 1273 - ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED syscall.Errno = 1274 - ERROR_DRIVER_BLOCKED syscall.Errno = 1275 - ERROR_INVALID_IMPORT_OF_NON_DLL syscall.Errno = 1276 - ERROR_ACCESS_DISABLED_WEBBLADE syscall.Errno = 1277 - ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER syscall.Errno = 1278 - ERROR_RECOVERY_FAILURE syscall.Errno = 1279 - ERROR_ALREADY_FIBER syscall.Errno = 1280 - ERROR_ALREADY_THREAD syscall.Errno = 1281 - ERROR_STACK_BUFFER_OVERRUN syscall.Errno = 1282 - ERROR_PARAMETER_QUOTA_EXCEEDED syscall.Errno = 1283 - ERROR_DEBUGGER_INACTIVE syscall.Errno = 1284 - ERROR_DELAY_LOAD_FAILED syscall.Errno = 1285 - ERROR_VDM_DISALLOWED syscall.Errno = 1286 - ERROR_UNIDENTIFIED_ERROR syscall.Errno = 1287 - ERROR_INVALID_CRUNTIME_PARAMETER syscall.Errno = 1288 - ERROR_BEYOND_VDL syscall.Errno = 1289 - ERROR_INCOMPATIBLE_SERVICE_SID_TYPE syscall.Errno = 1290 - ERROR_DRIVER_PROCESS_TERMINATED syscall.Errno = 1291 - ERROR_IMPLEMENTATION_LIMIT syscall.Errno = 1292 - ERROR_PROCESS_IS_PROTECTED syscall.Errno = 1293 - ERROR_SERVICE_NOTIFY_CLIENT_LAGGING syscall.Errno = 1294 - ERROR_DISK_QUOTA_EXCEEDED syscall.Errno = 1295 - ERROR_CONTENT_BLOCKED syscall.Errno = 1296 - ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE syscall.Errno = 1297 - ERROR_APP_HANG syscall.Errno = 1298 - ERROR_INVALID_LABEL syscall.Errno = 1299 - ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 - ERROR_SOME_NOT_MAPPED syscall.Errno = 1301 - ERROR_NO_QUOTAS_FOR_ACCOUNT syscall.Errno = 1302 - ERROR_LOCAL_USER_SESSION_KEY syscall.Errno = 1303 - ERROR_NULL_LM_PASSWORD syscall.Errno = 1304 - ERROR_UNKNOWN_REVISION syscall.Errno = 1305 - ERROR_REVISION_MISMATCH syscall.Errno = 1306 - ERROR_INVALID_OWNER syscall.Errno = 1307 - ERROR_INVALID_PRIMARY_GROUP syscall.Errno = 1308 - ERROR_NO_IMPERSONATION_TOKEN syscall.Errno = 1309 - ERROR_CANT_DISABLE_MANDATORY syscall.Errno = 1310 - ERROR_NO_LOGON_SERVERS syscall.Errno = 1311 - ERROR_NO_SUCH_LOGON_SESSION syscall.Errno = 1312 - ERROR_NO_SUCH_PRIVILEGE syscall.Errno = 1313 - ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 - ERROR_INVALID_ACCOUNT_NAME syscall.Errno = 1315 - ERROR_USER_EXISTS syscall.Errno = 1316 - ERROR_NO_SUCH_USER syscall.Errno = 1317 - ERROR_GROUP_EXISTS syscall.Errno = 1318 - ERROR_NO_SUCH_GROUP syscall.Errno = 1319 - ERROR_MEMBER_IN_GROUP syscall.Errno = 1320 - ERROR_MEMBER_NOT_IN_GROUP syscall.Errno = 1321 - ERROR_LAST_ADMIN syscall.Errno = 1322 - ERROR_WRONG_PASSWORD syscall.Errno = 1323 - ERROR_ILL_FORMED_PASSWORD syscall.Errno = 1324 - ERROR_PASSWORD_RESTRICTION syscall.Errno = 1325 - ERROR_LOGON_FAILURE syscall.Errno = 1326 - ERROR_ACCOUNT_RESTRICTION syscall.Errno = 1327 - ERROR_INVALID_LOGON_HOURS syscall.Errno = 1328 - ERROR_INVALID_WORKSTATION syscall.Errno = 1329 - ERROR_PASSWORD_EXPIRED syscall.Errno = 1330 - ERROR_ACCOUNT_DISABLED syscall.Errno = 1331 - ERROR_NONE_MAPPED syscall.Errno = 1332 - ERROR_TOO_MANY_LUIDS_REQUESTED syscall.Errno = 1333 - ERROR_LUIDS_EXHAUSTED syscall.Errno = 1334 - ERROR_INVALID_SUB_AUTHORITY syscall.Errno = 1335 - ERROR_INVALID_ACL syscall.Errno = 1336 - ERROR_INVALID_SID syscall.Errno = 1337 - ERROR_INVALID_SECURITY_DESCR syscall.Errno = 1338 - ERROR_BAD_INHERITANCE_ACL syscall.Errno = 1340 - ERROR_SERVER_DISABLED syscall.Errno = 1341 - ERROR_SERVER_NOT_DISABLED syscall.Errno = 1342 - ERROR_INVALID_ID_AUTHORITY syscall.Errno = 1343 - ERROR_ALLOTTED_SPACE_EXCEEDED syscall.Errno = 1344 - ERROR_INVALID_GROUP_ATTRIBUTES syscall.Errno = 1345 - ERROR_BAD_IMPERSONATION_LEVEL syscall.Errno = 1346 - ERROR_CANT_OPEN_ANONYMOUS syscall.Errno = 1347 - ERROR_BAD_VALIDATION_CLASS syscall.Errno = 1348 - ERROR_BAD_TOKEN_TYPE syscall.Errno = 1349 - ERROR_NO_SECURITY_ON_OBJECT syscall.Errno = 1350 - ERROR_CANT_ACCESS_DOMAIN_INFO syscall.Errno = 1351 - ERROR_INVALID_SERVER_STATE syscall.Errno = 1352 - ERROR_INVALID_DOMAIN_STATE syscall.Errno = 1353 - ERROR_INVALID_DOMAIN_ROLE syscall.Errno = 1354 - ERROR_NO_SUCH_DOMAIN syscall.Errno = 1355 - ERROR_DOMAIN_EXISTS syscall.Errno = 1356 - ERROR_DOMAIN_LIMIT_EXCEEDED syscall.Errno = 1357 - ERROR_INTERNAL_DB_CORRUPTION syscall.Errno = 1358 - ERROR_INTERNAL_ERROR syscall.Errno = 1359 - ERROR_GENERIC_NOT_MAPPED syscall.Errno = 1360 - ERROR_BAD_DESCRIPTOR_FORMAT syscall.Errno = 1361 - ERROR_NOT_LOGON_PROCESS syscall.Errno = 1362 - ERROR_LOGON_SESSION_EXISTS syscall.Errno = 1363 - ERROR_NO_SUCH_PACKAGE syscall.Errno = 1364 - ERROR_BAD_LOGON_SESSION_STATE syscall.Errno = 1365 - ERROR_LOGON_SESSION_COLLISION syscall.Errno = 1366 - ERROR_INVALID_LOGON_TYPE syscall.Errno = 1367 - ERROR_CANNOT_IMPERSONATE syscall.Errno = 1368 - ERROR_RXACT_INVALID_STATE syscall.Errno = 1369 - ERROR_RXACT_COMMIT_FAILURE syscall.Errno = 1370 - ERROR_SPECIAL_ACCOUNT syscall.Errno = 1371 - ERROR_SPECIAL_GROUP syscall.Errno = 1372 - ERROR_SPECIAL_USER syscall.Errno = 1373 - ERROR_MEMBERS_PRIMARY_GROUP syscall.Errno = 1374 - ERROR_TOKEN_ALREADY_IN_USE syscall.Errno = 1375 - ERROR_NO_SUCH_ALIAS syscall.Errno = 1376 - ERROR_MEMBER_NOT_IN_ALIAS syscall.Errno = 1377 - ERROR_MEMBER_IN_ALIAS syscall.Errno = 1378 - ERROR_ALIAS_EXISTS syscall.Errno = 1379 - ERROR_LOGON_NOT_GRANTED syscall.Errno = 1380 - ERROR_TOO_MANY_SECRETS syscall.Errno = 1381 - ERROR_SECRET_TOO_LONG syscall.Errno = 1382 - ERROR_INTERNAL_DB_ERROR syscall.Errno = 1383 - ERROR_TOO_MANY_CONTEXT_IDS syscall.Errno = 1384 - ERROR_LOGON_TYPE_NOT_GRANTED syscall.Errno = 1385 - ERROR_NT_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1386 - ERROR_NO_SUCH_MEMBER syscall.Errno = 1387 - ERROR_INVALID_MEMBER syscall.Errno = 1388 - ERROR_TOO_MANY_SIDS syscall.Errno = 1389 - ERROR_LM_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1390 - ERROR_NO_INHERITANCE syscall.Errno = 1391 - ERROR_FILE_CORRUPT syscall.Errno = 1392 - ERROR_DISK_CORRUPT syscall.Errno = 1393 - ERROR_NO_USER_SESSION_KEY syscall.Errno = 1394 - ERROR_LICENSE_QUOTA_EXCEEDED syscall.Errno = 1395 - ERROR_WRONG_TARGET_NAME syscall.Errno = 1396 - ERROR_MUTUAL_AUTH_FAILED syscall.Errno = 1397 - ERROR_TIME_SKEW syscall.Errno = 1398 - ERROR_CURRENT_DOMAIN_NOT_ALLOWED syscall.Errno = 1399 - ERROR_INVALID_WINDOW_HANDLE syscall.Errno = 1400 - ERROR_INVALID_MENU_HANDLE syscall.Errno = 1401 - ERROR_INVALID_CURSOR_HANDLE syscall.Errno = 1402 - ERROR_INVALID_ACCEL_HANDLE syscall.Errno = 1403 - ERROR_INVALID_HOOK_HANDLE syscall.Errno = 1404 - ERROR_INVALID_DWP_HANDLE syscall.Errno = 1405 - ERROR_TLW_WITH_WSCHILD syscall.Errno = 1406 - ERROR_CANNOT_FIND_WND_CLASS syscall.Errno = 1407 - ERROR_WINDOW_OF_OTHER_THREAD syscall.Errno = 1408 - ERROR_HOTKEY_ALREADY_REGISTERED syscall.Errno = 1409 - ERROR_CLASS_ALREADY_EXISTS syscall.Errno = 1410 - ERROR_CLASS_DOES_NOT_EXIST syscall.Errno = 1411 - ERROR_CLASS_HAS_WINDOWS syscall.Errno = 1412 - ERROR_INVALID_INDEX syscall.Errno = 1413 - ERROR_INVALID_ICON_HANDLE syscall.Errno = 1414 - ERROR_PRIVATE_DIALOG_INDEX syscall.Errno = 1415 - ERROR_LISTBOX_ID_NOT_FOUND syscall.Errno = 1416 - ERROR_NO_WILDCARD_CHARACTERS syscall.Errno = 1417 - ERROR_CLIPBOARD_NOT_OPEN syscall.Errno = 1418 - ERROR_HOTKEY_NOT_REGISTERED syscall.Errno = 1419 - ERROR_WINDOW_NOT_DIALOG syscall.Errno = 1420 - ERROR_CONTROL_ID_NOT_FOUND syscall.Errno = 1421 - ERROR_INVALID_COMBOBOX_MESSAGE syscall.Errno = 1422 - ERROR_WINDOW_NOT_COMBOBOX syscall.Errno = 1423 - ERROR_INVALID_EDIT_HEIGHT syscall.Errno = 1424 - ERROR_DC_NOT_FOUND syscall.Errno = 1425 - ERROR_INVALID_HOOK_FILTER syscall.Errno = 1426 - ERROR_INVALID_FILTER_PROC syscall.Errno = 1427 - ERROR_HOOK_NEEDS_HMOD syscall.Errno = 1428 - ERROR_GLOBAL_ONLY_HOOK syscall.Errno = 1429 - ERROR_JOURNAL_HOOK_SET syscall.Errno = 1430 - ERROR_HOOK_NOT_INSTALLED syscall.Errno = 1431 - ERROR_INVALID_LB_MESSAGE syscall.Errno = 1432 - ERROR_SETCOUNT_ON_BAD_LB syscall.Errno = 1433 - ERROR_LB_WITHOUT_TABSTOPS syscall.Errno = 1434 - ERROR_DESTROY_OBJECT_OF_OTHER_THREAD syscall.Errno = 1435 - ERROR_CHILD_WINDOW_MENU syscall.Errno = 1436 - ERROR_NO_SYSTEM_MENU syscall.Errno = 1437 - ERROR_INVALID_MSGBOX_STYLE syscall.Errno = 1438 - ERROR_INVALID_SPI_VALUE syscall.Errno = 1439 - ERROR_SCREEN_ALREADY_LOCKED syscall.Errno = 1440 - ERROR_HWNDS_HAVE_DIFF_PARENT syscall.Errno = 1441 - ERROR_NOT_CHILD_WINDOW syscall.Errno = 1442 - ERROR_INVALID_GW_COMMAND syscall.Errno = 1443 - ERROR_INVALID_THREAD_ID syscall.Errno = 1444 - ERROR_NON_MDICHILD_WINDOW syscall.Errno = 1445 - ERROR_POPUP_ALREADY_ACTIVE syscall.Errno = 1446 - ERROR_NO_SCROLLBARS syscall.Errno = 1447 - ERROR_INVALID_SCROLLBAR_RANGE syscall.Errno = 1448 - ERROR_INVALID_SHOWWIN_COMMAND syscall.Errno = 1449 - ERROR_NO_SYSTEM_RESOURCES syscall.Errno = 1450 - ERROR_NONPAGED_SYSTEM_RESOURCES syscall.Errno = 1451 - ERROR_PAGED_SYSTEM_RESOURCES syscall.Errno = 1452 - ERROR_WORKING_SET_QUOTA syscall.Errno = 1453 - ERROR_PAGEFILE_QUOTA syscall.Errno = 1454 - ERROR_COMMITMENT_LIMIT syscall.Errno = 1455 - ERROR_MENU_ITEM_NOT_FOUND syscall.Errno = 1456 - ERROR_INVALID_KEYBOARD_HANDLE syscall.Errno = 1457 - ERROR_HOOK_TYPE_NOT_ALLOWED syscall.Errno = 1458 - ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION syscall.Errno = 1459 - ERROR_TIMEOUT syscall.Errno = 1460 - ERROR_INVALID_MONITOR_HANDLE syscall.Errno = 1461 - ERROR_INCORRECT_SIZE syscall.Errno = 1462 - ERROR_SYMLINK_CLASS_DISABLED syscall.Errno = 1463 - ERROR_SYMLINK_NOT_SUPPORTED syscall.Errno = 1464 - ERROR_XML_PARSE_ERROR syscall.Errno = 1465 - ERROR_XMLDSIG_ERROR syscall.Errno = 1466 - ERROR_RESTART_APPLICATION syscall.Errno = 1467 - ERROR_WRONG_COMPARTMENT syscall.Errno = 1468 - ERROR_AUTHIP_FAILURE syscall.Errno = 1469 - ERROR_NO_NVRAM_RESOURCES syscall.Errno = 1470 - ERROR_NOT_GUI_PROCESS syscall.Errno = 1471 - ERROR_EVENTLOG_FILE_CORRUPT syscall.Errno = 1500 - ERROR_EVENTLOG_CANT_START syscall.Errno = 1501 - ERROR_LOG_FILE_FULL syscall.Errno = 1502 - ERROR_EVENTLOG_FILE_CHANGED syscall.Errno = 1503 - ERROR_CONTAINER_ASSIGNED syscall.Errno = 1504 - ERROR_JOB_NO_CONTAINER syscall.Errno = 1505 - ERROR_INVALID_TASK_NAME syscall.Errno = 1550 - ERROR_INVALID_TASK_INDEX syscall.Errno = 1551 - ERROR_THREAD_ALREADY_IN_TASK syscall.Errno = 1552 - ERROR_INSTALL_SERVICE_FAILURE syscall.Errno = 1601 - ERROR_INSTALL_USEREXIT syscall.Errno = 1602 - ERROR_INSTALL_FAILURE syscall.Errno = 1603 - ERROR_INSTALL_SUSPEND syscall.Errno = 1604 - ERROR_UNKNOWN_PRODUCT syscall.Errno = 1605 - ERROR_UNKNOWN_FEATURE syscall.Errno = 1606 - ERROR_UNKNOWN_COMPONENT syscall.Errno = 1607 - ERROR_UNKNOWN_PROPERTY syscall.Errno = 1608 - ERROR_INVALID_HANDLE_STATE syscall.Errno = 1609 - ERROR_BAD_CONFIGURATION syscall.Errno = 1610 - ERROR_INDEX_ABSENT syscall.Errno = 1611 - ERROR_INSTALL_SOURCE_ABSENT syscall.Errno = 1612 - ERROR_INSTALL_PACKAGE_VERSION syscall.Errno = 1613 - ERROR_PRODUCT_UNINSTALLED syscall.Errno = 1614 - ERROR_BAD_QUERY_SYNTAX syscall.Errno = 1615 - ERROR_INVALID_FIELD syscall.Errno = 1616 - ERROR_DEVICE_REMOVED syscall.Errno = 1617 - ERROR_INSTALL_ALREADY_RUNNING syscall.Errno = 1618 - ERROR_INSTALL_PACKAGE_OPEN_FAILED syscall.Errno = 1619 - ERROR_INSTALL_PACKAGE_INVALID syscall.Errno = 1620 - ERROR_INSTALL_UI_FAILURE syscall.Errno = 1621 - ERROR_INSTALL_LOG_FAILURE syscall.Errno = 1622 - ERROR_INSTALL_LANGUAGE_UNSUPPORTED syscall.Errno = 1623 - ERROR_INSTALL_TRANSFORM_FAILURE syscall.Errno = 1624 - ERROR_INSTALL_PACKAGE_REJECTED syscall.Errno = 1625 - ERROR_FUNCTION_NOT_CALLED syscall.Errno = 1626 - ERROR_FUNCTION_FAILED syscall.Errno = 1627 - ERROR_INVALID_TABLE syscall.Errno = 1628 - ERROR_DATATYPE_MISMATCH syscall.Errno = 1629 - ERROR_UNSUPPORTED_TYPE syscall.Errno = 1630 - ERROR_CREATE_FAILED syscall.Errno = 1631 - ERROR_INSTALL_TEMP_UNWRITABLE syscall.Errno = 1632 - ERROR_INSTALL_PLATFORM_UNSUPPORTED syscall.Errno = 1633 - ERROR_INSTALL_NOTUSED syscall.Errno = 1634 - ERROR_PATCH_PACKAGE_OPEN_FAILED syscall.Errno = 1635 - ERROR_PATCH_PACKAGE_INVALID syscall.Errno = 1636 - ERROR_PATCH_PACKAGE_UNSUPPORTED syscall.Errno = 1637 - ERROR_PRODUCT_VERSION syscall.Errno = 1638 - ERROR_INVALID_COMMAND_LINE syscall.Errno = 1639 - ERROR_INSTALL_REMOTE_DISALLOWED syscall.Errno = 1640 - ERROR_SUCCESS_REBOOT_INITIATED syscall.Errno = 1641 - ERROR_PATCH_TARGET_NOT_FOUND syscall.Errno = 1642 - ERROR_PATCH_PACKAGE_REJECTED syscall.Errno = 1643 - ERROR_INSTALL_TRANSFORM_REJECTED syscall.Errno = 1644 - ERROR_INSTALL_REMOTE_PROHIBITED syscall.Errno = 1645 - ERROR_PATCH_REMOVAL_UNSUPPORTED syscall.Errno = 1646 - ERROR_UNKNOWN_PATCH syscall.Errno = 1647 - ERROR_PATCH_NO_SEQUENCE syscall.Errno = 1648 - ERROR_PATCH_REMOVAL_DISALLOWED syscall.Errno = 1649 - ERROR_INVALID_PATCH_XML syscall.Errno = 1650 - ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT syscall.Errno = 1651 - ERROR_INSTALL_SERVICE_SAFEBOOT syscall.Errno = 1652 - ERROR_FAIL_FAST_EXCEPTION syscall.Errno = 1653 - ERROR_INSTALL_REJECTED syscall.Errno = 1654 - ERROR_DYNAMIC_CODE_BLOCKED syscall.Errno = 1655 - ERROR_NOT_SAME_OBJECT syscall.Errno = 1656 - ERROR_STRICT_CFG_VIOLATION syscall.Errno = 1657 - ERROR_SET_CONTEXT_DENIED syscall.Errno = 1660 - ERROR_CROSS_PARTITION_VIOLATION syscall.Errno = 1661 - RPC_S_INVALID_STRING_BINDING syscall.Errno = 1700 - RPC_S_WRONG_KIND_OF_BINDING syscall.Errno = 1701 - RPC_S_INVALID_BINDING syscall.Errno = 1702 - RPC_S_PROTSEQ_NOT_SUPPORTED syscall.Errno = 1703 - RPC_S_INVALID_RPC_PROTSEQ syscall.Errno = 1704 - RPC_S_INVALID_STRING_UUID syscall.Errno = 1705 - RPC_S_INVALID_ENDPOINT_FORMAT syscall.Errno = 1706 - RPC_S_INVALID_NET_ADDR syscall.Errno = 1707 - RPC_S_NO_ENDPOINT_FOUND syscall.Errno = 1708 - RPC_S_INVALID_TIMEOUT syscall.Errno = 1709 - RPC_S_OBJECT_NOT_FOUND syscall.Errno = 1710 - RPC_S_ALREADY_REGISTERED syscall.Errno = 1711 - RPC_S_TYPE_ALREADY_REGISTERED syscall.Errno = 1712 - RPC_S_ALREADY_LISTENING syscall.Errno = 1713 - RPC_S_NO_PROTSEQS_REGISTERED syscall.Errno = 1714 - RPC_S_NOT_LISTENING syscall.Errno = 1715 - RPC_S_UNKNOWN_MGR_TYPE syscall.Errno = 1716 - RPC_S_UNKNOWN_IF syscall.Errno = 1717 - RPC_S_NO_BINDINGS syscall.Errno = 1718 - RPC_S_NO_PROTSEQS syscall.Errno = 1719 - RPC_S_CANT_CREATE_ENDPOINT syscall.Errno = 1720 - RPC_S_OUT_OF_RESOURCES syscall.Errno = 1721 - RPC_S_SERVER_UNAVAILABLE syscall.Errno = 1722 - RPC_S_SERVER_TOO_BUSY syscall.Errno = 1723 - RPC_S_INVALID_NETWORK_OPTIONS syscall.Errno = 1724 - RPC_S_NO_CALL_ACTIVE syscall.Errno = 1725 - RPC_S_CALL_FAILED syscall.Errno = 1726 - RPC_S_CALL_FAILED_DNE syscall.Errno = 1727 - RPC_S_PROTOCOL_ERROR syscall.Errno = 1728 - RPC_S_PROXY_ACCESS_DENIED syscall.Errno = 1729 - RPC_S_UNSUPPORTED_TRANS_SYN syscall.Errno = 1730 - RPC_S_UNSUPPORTED_TYPE syscall.Errno = 1732 - RPC_S_INVALID_TAG syscall.Errno = 1733 - RPC_S_INVALID_BOUND syscall.Errno = 1734 - RPC_S_NO_ENTRY_NAME syscall.Errno = 1735 - RPC_S_INVALID_NAME_SYNTAX syscall.Errno = 1736 - RPC_S_UNSUPPORTED_NAME_SYNTAX syscall.Errno = 1737 - RPC_S_UUID_NO_ADDRESS syscall.Errno = 1739 - RPC_S_DUPLICATE_ENDPOINT syscall.Errno = 1740 - RPC_S_UNKNOWN_AUTHN_TYPE syscall.Errno = 1741 - RPC_S_MAX_CALLS_TOO_SMALL syscall.Errno = 1742 - RPC_S_STRING_TOO_LONG syscall.Errno = 1743 - RPC_S_PROTSEQ_NOT_FOUND syscall.Errno = 1744 - RPC_S_PROCNUM_OUT_OF_RANGE syscall.Errno = 1745 - RPC_S_BINDING_HAS_NO_AUTH syscall.Errno = 1746 - RPC_S_UNKNOWN_AUTHN_SERVICE syscall.Errno = 1747 - RPC_S_UNKNOWN_AUTHN_LEVEL syscall.Errno = 1748 - RPC_S_INVALID_AUTH_IDENTITY syscall.Errno = 1749 - RPC_S_UNKNOWN_AUTHZ_SERVICE syscall.Errno = 1750 - EPT_S_INVALID_ENTRY syscall.Errno = 1751 - EPT_S_CANT_PERFORM_OP syscall.Errno = 1752 - EPT_S_NOT_REGISTERED syscall.Errno = 1753 - RPC_S_NOTHING_TO_EXPORT syscall.Errno = 1754 - RPC_S_INCOMPLETE_NAME syscall.Errno = 1755 - RPC_S_INVALID_VERS_OPTION syscall.Errno = 1756 - RPC_S_NO_MORE_MEMBERS syscall.Errno = 1757 - RPC_S_NOT_ALL_OBJS_UNEXPORTED syscall.Errno = 1758 - RPC_S_INTERFACE_NOT_FOUND syscall.Errno = 1759 - RPC_S_ENTRY_ALREADY_EXISTS syscall.Errno = 1760 - RPC_S_ENTRY_NOT_FOUND syscall.Errno = 1761 - RPC_S_NAME_SERVICE_UNAVAILABLE syscall.Errno = 1762 - RPC_S_INVALID_NAF_ID syscall.Errno = 1763 - RPC_S_CANNOT_SUPPORT syscall.Errno = 1764 - RPC_S_NO_CONTEXT_AVAILABLE syscall.Errno = 1765 - RPC_S_INTERNAL_ERROR syscall.Errno = 1766 - RPC_S_ZERO_DIVIDE syscall.Errno = 1767 - RPC_S_ADDRESS_ERROR syscall.Errno = 1768 - RPC_S_FP_DIV_ZERO syscall.Errno = 1769 - RPC_S_FP_UNDERFLOW syscall.Errno = 1770 - RPC_S_FP_OVERFLOW syscall.Errno = 1771 - RPC_X_NO_MORE_ENTRIES syscall.Errno = 1772 - RPC_X_SS_CHAR_TRANS_OPEN_FAIL syscall.Errno = 1773 - RPC_X_SS_CHAR_TRANS_SHORT_FILE syscall.Errno = 1774 - RPC_X_SS_IN_NULL_CONTEXT syscall.Errno = 1775 - RPC_X_SS_CONTEXT_DAMAGED syscall.Errno = 1777 - RPC_X_SS_HANDLES_MISMATCH syscall.Errno = 1778 - RPC_X_SS_CANNOT_GET_CALL_HANDLE syscall.Errno = 1779 - RPC_X_NULL_REF_POINTER syscall.Errno = 1780 - RPC_X_ENUM_VALUE_OUT_OF_RANGE syscall.Errno = 1781 - RPC_X_BYTE_COUNT_TOO_SMALL syscall.Errno = 1782 - RPC_X_BAD_STUB_DATA syscall.Errno = 1783 - ERROR_INVALID_USER_BUFFER syscall.Errno = 1784 - ERROR_UNRECOGNIZED_MEDIA syscall.Errno = 1785 - ERROR_NO_TRUST_LSA_SECRET syscall.Errno = 1786 - ERROR_NO_TRUST_SAM_ACCOUNT syscall.Errno = 1787 - ERROR_TRUSTED_DOMAIN_FAILURE syscall.Errno = 1788 - ERROR_TRUSTED_RELATIONSHIP_FAILURE syscall.Errno = 1789 - ERROR_TRUST_FAILURE syscall.Errno = 1790 - RPC_S_CALL_IN_PROGRESS syscall.Errno = 1791 - ERROR_NETLOGON_NOT_STARTED syscall.Errno = 1792 - ERROR_ACCOUNT_EXPIRED syscall.Errno = 1793 - ERROR_REDIRECTOR_HAS_OPEN_HANDLES syscall.Errno = 1794 - ERROR_PRINTER_DRIVER_ALREADY_INSTALLED syscall.Errno = 1795 - ERROR_UNKNOWN_PORT syscall.Errno = 1796 - ERROR_UNKNOWN_PRINTER_DRIVER syscall.Errno = 1797 - ERROR_UNKNOWN_PRINTPROCESSOR syscall.Errno = 1798 - ERROR_INVALID_SEPARATOR_FILE syscall.Errno = 1799 - ERROR_INVALID_PRIORITY syscall.Errno = 1800 - ERROR_INVALID_PRINTER_NAME syscall.Errno = 1801 - ERROR_PRINTER_ALREADY_EXISTS syscall.Errno = 1802 - ERROR_INVALID_PRINTER_COMMAND syscall.Errno = 1803 - ERROR_INVALID_DATATYPE syscall.Errno = 1804 - ERROR_INVALID_ENVIRONMENT syscall.Errno = 1805 - RPC_S_NO_MORE_BINDINGS syscall.Errno = 1806 - ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT syscall.Errno = 1807 - ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT syscall.Errno = 1808 - ERROR_NOLOGON_SERVER_TRUST_ACCOUNT syscall.Errno = 1809 - ERROR_DOMAIN_TRUST_INCONSISTENT syscall.Errno = 1810 - ERROR_SERVER_HAS_OPEN_HANDLES syscall.Errno = 1811 - ERROR_RESOURCE_DATA_NOT_FOUND syscall.Errno = 1812 - ERROR_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 1813 - ERROR_RESOURCE_NAME_NOT_FOUND syscall.Errno = 1814 - ERROR_RESOURCE_LANG_NOT_FOUND syscall.Errno = 1815 - ERROR_NOT_ENOUGH_QUOTA syscall.Errno = 1816 - RPC_S_NO_INTERFACES syscall.Errno = 1817 - RPC_S_CALL_CANCELLED syscall.Errno = 1818 - RPC_S_BINDING_INCOMPLETE syscall.Errno = 1819 - RPC_S_COMM_FAILURE syscall.Errno = 1820 - RPC_S_UNSUPPORTED_AUTHN_LEVEL syscall.Errno = 1821 - RPC_S_NO_PRINC_NAME syscall.Errno = 1822 - RPC_S_NOT_RPC_ERROR syscall.Errno = 1823 - RPC_S_UUID_LOCAL_ONLY syscall.Errno = 1824 - RPC_S_SEC_PKG_ERROR syscall.Errno = 1825 - RPC_S_NOT_CANCELLED syscall.Errno = 1826 - RPC_X_INVALID_ES_ACTION syscall.Errno = 1827 - RPC_X_WRONG_ES_VERSION syscall.Errno = 1828 - RPC_X_WRONG_STUB_VERSION syscall.Errno = 1829 - RPC_X_INVALID_PIPE_OBJECT syscall.Errno = 1830 - RPC_X_WRONG_PIPE_ORDER syscall.Errno = 1831 - RPC_X_WRONG_PIPE_VERSION syscall.Errno = 1832 - RPC_S_COOKIE_AUTH_FAILED syscall.Errno = 1833 - RPC_S_DO_NOT_DISTURB syscall.Errno = 1834 - RPC_S_SYSTEM_HANDLE_COUNT_EXCEEDED syscall.Errno = 1835 - RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH syscall.Errno = 1836 - RPC_S_GROUP_MEMBER_NOT_FOUND syscall.Errno = 1898 - EPT_S_CANT_CREATE syscall.Errno = 1899 - RPC_S_INVALID_OBJECT syscall.Errno = 1900 - ERROR_INVALID_TIME syscall.Errno = 1901 - ERROR_INVALID_FORM_NAME syscall.Errno = 1902 - ERROR_INVALID_FORM_SIZE syscall.Errno = 1903 - ERROR_ALREADY_WAITING syscall.Errno = 1904 - ERROR_PRINTER_DELETED syscall.Errno = 1905 - ERROR_INVALID_PRINTER_STATE syscall.Errno = 1906 - ERROR_PASSWORD_MUST_CHANGE syscall.Errno = 1907 - ERROR_DOMAIN_CONTROLLER_NOT_FOUND syscall.Errno = 1908 - ERROR_ACCOUNT_LOCKED_OUT syscall.Errno = 1909 - OR_INVALID_OXID syscall.Errno = 1910 - OR_INVALID_OID syscall.Errno = 1911 - OR_INVALID_SET syscall.Errno = 1912 - RPC_S_SEND_INCOMPLETE syscall.Errno = 1913 - RPC_S_INVALID_ASYNC_HANDLE syscall.Errno = 1914 - RPC_S_INVALID_ASYNC_CALL syscall.Errno = 1915 - RPC_X_PIPE_CLOSED syscall.Errno = 1916 - RPC_X_PIPE_DISCIPLINE_ERROR syscall.Errno = 1917 - RPC_X_PIPE_EMPTY syscall.Errno = 1918 - ERROR_NO_SITENAME syscall.Errno = 1919 - ERROR_CANT_ACCESS_FILE syscall.Errno = 1920 - ERROR_CANT_RESOLVE_FILENAME syscall.Errno = 1921 - RPC_S_ENTRY_TYPE_MISMATCH syscall.Errno = 1922 - RPC_S_NOT_ALL_OBJS_EXPORTED syscall.Errno = 1923 - RPC_S_INTERFACE_NOT_EXPORTED syscall.Errno = 1924 - RPC_S_PROFILE_NOT_ADDED syscall.Errno = 1925 - RPC_S_PRF_ELT_NOT_ADDED syscall.Errno = 1926 - RPC_S_PRF_ELT_NOT_REMOVED syscall.Errno = 1927 - RPC_S_GRP_ELT_NOT_ADDED syscall.Errno = 1928 - RPC_S_GRP_ELT_NOT_REMOVED syscall.Errno = 1929 - ERROR_KM_DRIVER_BLOCKED syscall.Errno = 1930 - ERROR_CONTEXT_EXPIRED syscall.Errno = 1931 - ERROR_PER_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1932 - ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1933 - ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED syscall.Errno = 1934 - ERROR_AUTHENTICATION_FIREWALL_FAILED syscall.Errno = 1935 - ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED syscall.Errno = 1936 - ERROR_NTLM_BLOCKED syscall.Errno = 1937 - ERROR_PASSWORD_CHANGE_REQUIRED syscall.Errno = 1938 - ERROR_LOST_MODE_LOGON_RESTRICTION syscall.Errno = 1939 - ERROR_INVALID_PIXEL_FORMAT syscall.Errno = 2000 - ERROR_BAD_DRIVER syscall.Errno = 2001 - ERROR_INVALID_WINDOW_STYLE syscall.Errno = 2002 - ERROR_METAFILE_NOT_SUPPORTED syscall.Errno = 2003 - ERROR_TRANSFORM_NOT_SUPPORTED syscall.Errno = 2004 - ERROR_CLIPPING_NOT_SUPPORTED syscall.Errno = 2005 - ERROR_INVALID_CMM syscall.Errno = 2010 - ERROR_INVALID_PROFILE syscall.Errno = 2011 - ERROR_TAG_NOT_FOUND syscall.Errno = 2012 - ERROR_TAG_NOT_PRESENT syscall.Errno = 2013 - ERROR_DUPLICATE_TAG syscall.Errno = 2014 - ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE syscall.Errno = 2015 - ERROR_PROFILE_NOT_FOUND syscall.Errno = 2016 - ERROR_INVALID_COLORSPACE syscall.Errno = 2017 - ERROR_ICM_NOT_ENABLED syscall.Errno = 2018 - ERROR_DELETING_ICM_XFORM syscall.Errno = 2019 - ERROR_INVALID_TRANSFORM syscall.Errno = 2020 - ERROR_COLORSPACE_MISMATCH syscall.Errno = 2021 - ERROR_INVALID_COLORINDEX syscall.Errno = 2022 - ERROR_PROFILE_DOES_NOT_MATCH_DEVICE syscall.Errno = 2023 - ERROR_CONNECTED_OTHER_PASSWORD syscall.Errno = 2108 - ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT syscall.Errno = 2109 - ERROR_BAD_USERNAME syscall.Errno = 2202 - ERROR_NOT_CONNECTED syscall.Errno = 2250 - ERROR_OPEN_FILES syscall.Errno = 2401 - ERROR_ACTIVE_CONNECTIONS syscall.Errno = 2402 - ERROR_DEVICE_IN_USE syscall.Errno = 2404 - ERROR_UNKNOWN_PRINT_MONITOR syscall.Errno = 3000 - ERROR_PRINTER_DRIVER_IN_USE syscall.Errno = 3001 - ERROR_SPOOL_FILE_NOT_FOUND syscall.Errno = 3002 - ERROR_SPL_NO_STARTDOC syscall.Errno = 3003 - ERROR_SPL_NO_ADDJOB syscall.Errno = 3004 - ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED syscall.Errno = 3005 - ERROR_PRINT_MONITOR_ALREADY_INSTALLED syscall.Errno = 3006 - ERROR_INVALID_PRINT_MONITOR syscall.Errno = 3007 - ERROR_PRINT_MONITOR_IN_USE syscall.Errno = 3008 - ERROR_PRINTER_HAS_JOBS_QUEUED syscall.Errno = 3009 - ERROR_SUCCESS_REBOOT_REQUIRED syscall.Errno = 3010 - ERROR_SUCCESS_RESTART_REQUIRED syscall.Errno = 3011 - ERROR_PRINTER_NOT_FOUND syscall.Errno = 3012 - ERROR_PRINTER_DRIVER_WARNED syscall.Errno = 3013 - ERROR_PRINTER_DRIVER_BLOCKED syscall.Errno = 3014 - ERROR_PRINTER_DRIVER_PACKAGE_IN_USE syscall.Errno = 3015 - ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND syscall.Errno = 3016 - ERROR_FAIL_REBOOT_REQUIRED syscall.Errno = 3017 - ERROR_FAIL_REBOOT_INITIATED syscall.Errno = 3018 - ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED syscall.Errno = 3019 - ERROR_PRINT_JOB_RESTART_REQUIRED syscall.Errno = 3020 - ERROR_INVALID_PRINTER_DRIVER_MANIFEST syscall.Errno = 3021 - ERROR_PRINTER_NOT_SHAREABLE syscall.Errno = 3022 - ERROR_REQUEST_PAUSED syscall.Errno = 3050 - ERROR_APPEXEC_CONDITION_NOT_SATISFIED syscall.Errno = 3060 - ERROR_APPEXEC_HANDLE_INVALIDATED syscall.Errno = 3061 - ERROR_APPEXEC_INVALID_HOST_GENERATION syscall.Errno = 3062 - ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION syscall.Errno = 3063 - ERROR_APPEXEC_INVALID_HOST_STATE syscall.Errno = 3064 - ERROR_APPEXEC_NO_DONOR syscall.Errno = 3065 - ERROR_APPEXEC_HOST_ID_MISMATCH syscall.Errno = 3066 - ERROR_APPEXEC_UNKNOWN_USER syscall.Errno = 3067 - ERROR_IO_REISSUE_AS_CACHED syscall.Errno = 3950 - ERROR_WINS_INTERNAL syscall.Errno = 4000 - ERROR_CAN_NOT_DEL_LOCAL_WINS syscall.Errno = 4001 - ERROR_STATIC_INIT syscall.Errno = 4002 - ERROR_INC_BACKUP syscall.Errno = 4003 - ERROR_FULL_BACKUP syscall.Errno = 4004 - ERROR_REC_NON_EXISTENT syscall.Errno = 4005 - ERROR_RPL_NOT_ALLOWED syscall.Errno = 4006 - PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED syscall.Errno = 4050 - PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO syscall.Errno = 4051 - PEERDIST_ERROR_MISSING_DATA syscall.Errno = 4052 - PEERDIST_ERROR_NO_MORE syscall.Errno = 4053 - PEERDIST_ERROR_NOT_INITIALIZED syscall.Errno = 4054 - PEERDIST_ERROR_ALREADY_INITIALIZED syscall.Errno = 4055 - PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 4056 - PEERDIST_ERROR_INVALIDATED syscall.Errno = 4057 - PEERDIST_ERROR_ALREADY_EXISTS syscall.Errno = 4058 - PEERDIST_ERROR_OPERATION_NOTFOUND syscall.Errno = 4059 - PEERDIST_ERROR_ALREADY_COMPLETED syscall.Errno = 4060 - PEERDIST_ERROR_OUT_OF_BOUNDS syscall.Errno = 4061 - PEERDIST_ERROR_VERSION_UNSUPPORTED syscall.Errno = 4062 - PEERDIST_ERROR_INVALID_CONFIGURATION syscall.Errno = 4063 - PEERDIST_ERROR_NOT_LICENSED syscall.Errno = 4064 - PEERDIST_ERROR_SERVICE_UNAVAILABLE syscall.Errno = 4065 - PEERDIST_ERROR_TRUST_FAILURE syscall.Errno = 4066 - ERROR_DHCP_ADDRESS_CONFLICT syscall.Errno = 4100 - ERROR_WMI_GUID_NOT_FOUND syscall.Errno = 4200 - ERROR_WMI_INSTANCE_NOT_FOUND syscall.Errno = 4201 - ERROR_WMI_ITEMID_NOT_FOUND syscall.Errno = 4202 - ERROR_WMI_TRY_AGAIN syscall.Errno = 4203 - ERROR_WMI_DP_NOT_FOUND syscall.Errno = 4204 - ERROR_WMI_UNRESOLVED_INSTANCE_REF syscall.Errno = 4205 - ERROR_WMI_ALREADY_ENABLED syscall.Errno = 4206 - ERROR_WMI_GUID_DISCONNECTED syscall.Errno = 4207 - ERROR_WMI_SERVER_UNAVAILABLE syscall.Errno = 4208 - ERROR_WMI_DP_FAILED syscall.Errno = 4209 - ERROR_WMI_INVALID_MOF syscall.Errno = 4210 - ERROR_WMI_INVALID_REGINFO syscall.Errno = 4211 - ERROR_WMI_ALREADY_DISABLED syscall.Errno = 4212 - ERROR_WMI_READ_ONLY syscall.Errno = 4213 - ERROR_WMI_SET_FAILURE syscall.Errno = 4214 - ERROR_NOT_APPCONTAINER syscall.Errno = 4250 - ERROR_APPCONTAINER_REQUIRED syscall.Errno = 4251 - ERROR_NOT_SUPPORTED_IN_APPCONTAINER syscall.Errno = 4252 - ERROR_INVALID_PACKAGE_SID_LENGTH syscall.Errno = 4253 - ERROR_INVALID_MEDIA syscall.Errno = 4300 - ERROR_INVALID_LIBRARY syscall.Errno = 4301 - ERROR_INVALID_MEDIA_POOL syscall.Errno = 4302 - ERROR_DRIVE_MEDIA_MISMATCH syscall.Errno = 4303 - ERROR_MEDIA_OFFLINE syscall.Errno = 4304 - ERROR_LIBRARY_OFFLINE syscall.Errno = 4305 - ERROR_EMPTY syscall.Errno = 4306 - ERROR_NOT_EMPTY syscall.Errno = 4307 - ERROR_MEDIA_UNAVAILABLE syscall.Errno = 4308 - ERROR_RESOURCE_DISABLED syscall.Errno = 4309 - ERROR_INVALID_CLEANER syscall.Errno = 4310 - ERROR_UNABLE_TO_CLEAN syscall.Errno = 4311 - ERROR_OBJECT_NOT_FOUND syscall.Errno = 4312 - ERROR_DATABASE_FAILURE syscall.Errno = 4313 - ERROR_DATABASE_FULL syscall.Errno = 4314 - ERROR_MEDIA_INCOMPATIBLE syscall.Errno = 4315 - ERROR_RESOURCE_NOT_PRESENT syscall.Errno = 4316 - ERROR_INVALID_OPERATION syscall.Errno = 4317 - ERROR_MEDIA_NOT_AVAILABLE syscall.Errno = 4318 - ERROR_DEVICE_NOT_AVAILABLE syscall.Errno = 4319 - ERROR_REQUEST_REFUSED syscall.Errno = 4320 - ERROR_INVALID_DRIVE_OBJECT syscall.Errno = 4321 - ERROR_LIBRARY_FULL syscall.Errno = 4322 - ERROR_MEDIUM_NOT_ACCESSIBLE syscall.Errno = 4323 - ERROR_UNABLE_TO_LOAD_MEDIUM syscall.Errno = 4324 - ERROR_UNABLE_TO_INVENTORY_DRIVE syscall.Errno = 4325 - ERROR_UNABLE_TO_INVENTORY_SLOT syscall.Errno = 4326 - ERROR_UNABLE_TO_INVENTORY_TRANSPORT syscall.Errno = 4327 - ERROR_TRANSPORT_FULL syscall.Errno = 4328 - ERROR_CONTROLLING_IEPORT syscall.Errno = 4329 - ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA syscall.Errno = 4330 - ERROR_CLEANER_SLOT_SET syscall.Errno = 4331 - ERROR_CLEANER_SLOT_NOT_SET syscall.Errno = 4332 - ERROR_CLEANER_CARTRIDGE_SPENT syscall.Errno = 4333 - ERROR_UNEXPECTED_OMID syscall.Errno = 4334 - ERROR_CANT_DELETE_LAST_ITEM syscall.Errno = 4335 - ERROR_MESSAGE_EXCEEDS_MAX_SIZE syscall.Errno = 4336 - ERROR_VOLUME_CONTAINS_SYS_FILES syscall.Errno = 4337 - ERROR_INDIGENOUS_TYPE syscall.Errno = 4338 - ERROR_NO_SUPPORTING_DRIVES syscall.Errno = 4339 - ERROR_CLEANER_CARTRIDGE_INSTALLED syscall.Errno = 4340 - ERROR_IEPORT_FULL syscall.Errno = 4341 - ERROR_FILE_OFFLINE syscall.Errno = 4350 - ERROR_REMOTE_STORAGE_NOT_ACTIVE syscall.Errno = 4351 - ERROR_REMOTE_STORAGE_MEDIA_ERROR syscall.Errno = 4352 - ERROR_NOT_A_REPARSE_POINT syscall.Errno = 4390 - ERROR_REPARSE_ATTRIBUTE_CONFLICT syscall.Errno = 4391 - ERROR_INVALID_REPARSE_DATA syscall.Errno = 4392 - ERROR_REPARSE_TAG_INVALID syscall.Errno = 4393 - ERROR_REPARSE_TAG_MISMATCH syscall.Errno = 4394 - ERROR_REPARSE_POINT_ENCOUNTERED syscall.Errno = 4395 - ERROR_APP_DATA_NOT_FOUND syscall.Errno = 4400 - ERROR_APP_DATA_EXPIRED syscall.Errno = 4401 - ERROR_APP_DATA_CORRUPT syscall.Errno = 4402 - ERROR_APP_DATA_LIMIT_EXCEEDED syscall.Errno = 4403 - ERROR_APP_DATA_REBOOT_REQUIRED syscall.Errno = 4404 - ERROR_SECUREBOOT_ROLLBACK_DETECTED syscall.Errno = 4420 - ERROR_SECUREBOOT_POLICY_VIOLATION syscall.Errno = 4421 - ERROR_SECUREBOOT_INVALID_POLICY syscall.Errno = 4422 - ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND syscall.Errno = 4423 - ERROR_SECUREBOOT_POLICY_NOT_SIGNED syscall.Errno = 4424 - ERROR_SECUREBOOT_NOT_ENABLED syscall.Errno = 4425 - ERROR_SECUREBOOT_FILE_REPLACED syscall.Errno = 4426 - ERROR_SECUREBOOT_POLICY_NOT_AUTHORIZED syscall.Errno = 4427 - ERROR_SECUREBOOT_POLICY_UNKNOWN syscall.Errno = 4428 - ERROR_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION syscall.Errno = 4429 - ERROR_SECUREBOOT_PLATFORM_ID_MISMATCH syscall.Errno = 4430 - ERROR_SECUREBOOT_POLICY_ROLLBACK_DETECTED syscall.Errno = 4431 - ERROR_SECUREBOOT_POLICY_UPGRADE_MISMATCH syscall.Errno = 4432 - ERROR_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING syscall.Errno = 4433 - ERROR_SECUREBOOT_NOT_BASE_POLICY syscall.Errno = 4434 - ERROR_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY syscall.Errno = 4435 - ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED syscall.Errno = 4440 - ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED syscall.Errno = 4441 - ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED syscall.Errno = 4442 - ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED syscall.Errno = 4443 - ERROR_ALREADY_HAS_STREAM_ID syscall.Errno = 4444 - ERROR_SMR_GARBAGE_COLLECTION_REQUIRED syscall.Errno = 4445 - ERROR_WOF_WIM_HEADER_CORRUPT syscall.Errno = 4446 - ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT syscall.Errno = 4447 - ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT syscall.Errno = 4448 - ERROR_VOLUME_NOT_SIS_ENABLED syscall.Errno = 4500 - ERROR_SYSTEM_INTEGRITY_ROLLBACK_DETECTED syscall.Errno = 4550 - ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION syscall.Errno = 4551 - ERROR_SYSTEM_INTEGRITY_INVALID_POLICY syscall.Errno = 4552 - ERROR_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED syscall.Errno = 4553 - ERROR_VSM_NOT_INITIALIZED syscall.Errno = 4560 - ERROR_VSM_DMA_PROTECTION_NOT_IN_USE syscall.Errno = 4561 - ERROR_PLATFORM_MANIFEST_NOT_AUTHORIZED syscall.Errno = 4570 - ERROR_PLATFORM_MANIFEST_INVALID syscall.Errno = 4571 - ERROR_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED syscall.Errno = 4572 - ERROR_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED syscall.Errno = 4573 - ERROR_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND syscall.Errno = 4574 - ERROR_PLATFORM_MANIFEST_NOT_ACTIVE syscall.Errno = 4575 - ERROR_PLATFORM_MANIFEST_NOT_SIGNED syscall.Errno = 4576 - ERROR_DEPENDENT_RESOURCE_EXISTS syscall.Errno = 5001 - ERROR_DEPENDENCY_NOT_FOUND syscall.Errno = 5002 - ERROR_DEPENDENCY_ALREADY_EXISTS syscall.Errno = 5003 - ERROR_RESOURCE_NOT_ONLINE syscall.Errno = 5004 - ERROR_HOST_NODE_NOT_AVAILABLE syscall.Errno = 5005 - ERROR_RESOURCE_NOT_AVAILABLE syscall.Errno = 5006 - ERROR_RESOURCE_NOT_FOUND syscall.Errno = 5007 - ERROR_SHUTDOWN_CLUSTER syscall.Errno = 5008 - ERROR_CANT_EVICT_ACTIVE_NODE syscall.Errno = 5009 - ERROR_OBJECT_ALREADY_EXISTS syscall.Errno = 5010 - ERROR_OBJECT_IN_LIST syscall.Errno = 5011 - ERROR_GROUP_NOT_AVAILABLE syscall.Errno = 5012 - ERROR_GROUP_NOT_FOUND syscall.Errno = 5013 - ERROR_GROUP_NOT_ONLINE syscall.Errno = 5014 - ERROR_HOST_NODE_NOT_RESOURCE_OWNER syscall.Errno = 5015 - ERROR_HOST_NODE_NOT_GROUP_OWNER syscall.Errno = 5016 - ERROR_RESMON_CREATE_FAILED syscall.Errno = 5017 - ERROR_RESMON_ONLINE_FAILED syscall.Errno = 5018 - ERROR_RESOURCE_ONLINE syscall.Errno = 5019 - ERROR_QUORUM_RESOURCE syscall.Errno = 5020 - ERROR_NOT_QUORUM_CAPABLE syscall.Errno = 5021 - ERROR_CLUSTER_SHUTTING_DOWN syscall.Errno = 5022 - ERROR_INVALID_STATE syscall.Errno = 5023 - ERROR_RESOURCE_PROPERTIES_STORED syscall.Errno = 5024 - ERROR_NOT_QUORUM_CLASS syscall.Errno = 5025 - ERROR_CORE_RESOURCE syscall.Errno = 5026 - ERROR_QUORUM_RESOURCE_ONLINE_FAILED syscall.Errno = 5027 - ERROR_QUORUMLOG_OPEN_FAILED syscall.Errno = 5028 - ERROR_CLUSTERLOG_CORRUPT syscall.Errno = 5029 - ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE syscall.Errno = 5030 - ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE syscall.Errno = 5031 - ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND syscall.Errno = 5032 - ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE syscall.Errno = 5033 - ERROR_QUORUM_OWNER_ALIVE syscall.Errno = 5034 - ERROR_NETWORK_NOT_AVAILABLE syscall.Errno = 5035 - ERROR_NODE_NOT_AVAILABLE syscall.Errno = 5036 - ERROR_ALL_NODES_NOT_AVAILABLE syscall.Errno = 5037 - ERROR_RESOURCE_FAILED syscall.Errno = 5038 - ERROR_CLUSTER_INVALID_NODE syscall.Errno = 5039 - ERROR_CLUSTER_NODE_EXISTS syscall.Errno = 5040 - ERROR_CLUSTER_JOIN_IN_PROGRESS syscall.Errno = 5041 - ERROR_CLUSTER_NODE_NOT_FOUND syscall.Errno = 5042 - ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND syscall.Errno = 5043 - ERROR_CLUSTER_NETWORK_EXISTS syscall.Errno = 5044 - ERROR_CLUSTER_NETWORK_NOT_FOUND syscall.Errno = 5045 - ERROR_CLUSTER_NETINTERFACE_EXISTS syscall.Errno = 5046 - ERROR_CLUSTER_NETINTERFACE_NOT_FOUND syscall.Errno = 5047 - ERROR_CLUSTER_INVALID_REQUEST syscall.Errno = 5048 - ERROR_CLUSTER_INVALID_NETWORK_PROVIDER syscall.Errno = 5049 - ERROR_CLUSTER_NODE_DOWN syscall.Errno = 5050 - ERROR_CLUSTER_NODE_UNREACHABLE syscall.Errno = 5051 - ERROR_CLUSTER_NODE_NOT_MEMBER syscall.Errno = 5052 - ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS syscall.Errno = 5053 - ERROR_CLUSTER_INVALID_NETWORK syscall.Errno = 5054 - ERROR_CLUSTER_NODE_UP syscall.Errno = 5056 - ERROR_CLUSTER_IPADDR_IN_USE syscall.Errno = 5057 - ERROR_CLUSTER_NODE_NOT_PAUSED syscall.Errno = 5058 - ERROR_CLUSTER_NO_SECURITY_CONTEXT syscall.Errno = 5059 - ERROR_CLUSTER_NETWORK_NOT_INTERNAL syscall.Errno = 5060 - ERROR_CLUSTER_NODE_ALREADY_UP syscall.Errno = 5061 - ERROR_CLUSTER_NODE_ALREADY_DOWN syscall.Errno = 5062 - ERROR_CLUSTER_NETWORK_ALREADY_ONLINE syscall.Errno = 5063 - ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE syscall.Errno = 5064 - ERROR_CLUSTER_NODE_ALREADY_MEMBER syscall.Errno = 5065 - ERROR_CLUSTER_LAST_INTERNAL_NETWORK syscall.Errno = 5066 - ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS syscall.Errno = 5067 - ERROR_INVALID_OPERATION_ON_QUORUM syscall.Errno = 5068 - ERROR_DEPENDENCY_NOT_ALLOWED syscall.Errno = 5069 - ERROR_CLUSTER_NODE_PAUSED syscall.Errno = 5070 - ERROR_NODE_CANT_HOST_RESOURCE syscall.Errno = 5071 - ERROR_CLUSTER_NODE_NOT_READY syscall.Errno = 5072 - ERROR_CLUSTER_NODE_SHUTTING_DOWN syscall.Errno = 5073 - ERROR_CLUSTER_JOIN_ABORTED syscall.Errno = 5074 - ERROR_CLUSTER_INCOMPATIBLE_VERSIONS syscall.Errno = 5075 - ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED syscall.Errno = 5076 - ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED syscall.Errno = 5077 - ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 5078 - ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED syscall.Errno = 5079 - ERROR_CLUSTER_RESNAME_NOT_FOUND syscall.Errno = 5080 - ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED syscall.Errno = 5081 - ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST syscall.Errno = 5082 - ERROR_CLUSTER_DATABASE_SEQMISMATCH syscall.Errno = 5083 - ERROR_RESMON_INVALID_STATE syscall.Errno = 5084 - ERROR_CLUSTER_GUM_NOT_LOCKER syscall.Errno = 5085 - ERROR_QUORUM_DISK_NOT_FOUND syscall.Errno = 5086 - ERROR_DATABASE_BACKUP_CORRUPT syscall.Errno = 5087 - ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT syscall.Errno = 5088 - ERROR_RESOURCE_PROPERTY_UNCHANGEABLE syscall.Errno = 5089 - ERROR_NO_ADMIN_ACCESS_POINT syscall.Errno = 5090 - ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE syscall.Errno = 5890 - ERROR_CLUSTER_QUORUMLOG_NOT_FOUND syscall.Errno = 5891 - ERROR_CLUSTER_MEMBERSHIP_HALT syscall.Errno = 5892 - ERROR_CLUSTER_INSTANCE_ID_MISMATCH syscall.Errno = 5893 - ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP syscall.Errno = 5894 - ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH syscall.Errno = 5895 - ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP syscall.Errno = 5896 - ERROR_CLUSTER_PARAMETER_MISMATCH syscall.Errno = 5897 - ERROR_NODE_CANNOT_BE_CLUSTERED syscall.Errno = 5898 - ERROR_CLUSTER_WRONG_OS_VERSION syscall.Errno = 5899 - ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME syscall.Errno = 5900 - ERROR_CLUSCFG_ALREADY_COMMITTED syscall.Errno = 5901 - ERROR_CLUSCFG_ROLLBACK_FAILED syscall.Errno = 5902 - ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT syscall.Errno = 5903 - ERROR_CLUSTER_OLD_VERSION syscall.Errno = 5904 - ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME syscall.Errno = 5905 - ERROR_CLUSTER_NO_NET_ADAPTERS syscall.Errno = 5906 - ERROR_CLUSTER_POISONED syscall.Errno = 5907 - ERROR_CLUSTER_GROUP_MOVING syscall.Errno = 5908 - ERROR_CLUSTER_RESOURCE_TYPE_BUSY syscall.Errno = 5909 - ERROR_RESOURCE_CALL_TIMED_OUT syscall.Errno = 5910 - ERROR_INVALID_CLUSTER_IPV6_ADDRESS syscall.Errno = 5911 - ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION syscall.Errno = 5912 - ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS syscall.Errno = 5913 - ERROR_CLUSTER_PARTIAL_SEND syscall.Errno = 5914 - ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION syscall.Errno = 5915 - ERROR_CLUSTER_INVALID_STRING_TERMINATION syscall.Errno = 5916 - ERROR_CLUSTER_INVALID_STRING_FORMAT syscall.Errno = 5917 - ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS syscall.Errno = 5918 - ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS syscall.Errno = 5919 - ERROR_CLUSTER_NULL_DATA syscall.Errno = 5920 - ERROR_CLUSTER_PARTIAL_READ syscall.Errno = 5921 - ERROR_CLUSTER_PARTIAL_WRITE syscall.Errno = 5922 - ERROR_CLUSTER_CANT_DESERIALIZE_DATA syscall.Errno = 5923 - ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT syscall.Errno = 5924 - ERROR_CLUSTER_NO_QUORUM syscall.Errno = 5925 - ERROR_CLUSTER_INVALID_IPV6_NETWORK syscall.Errno = 5926 - ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK syscall.Errno = 5927 - ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP syscall.Errno = 5928 - ERROR_DEPENDENCY_TREE_TOO_COMPLEX syscall.Errno = 5929 - ERROR_EXCEPTION_IN_RESOURCE_CALL syscall.Errno = 5930 - ERROR_CLUSTER_RHS_FAILED_INITIALIZATION syscall.Errno = 5931 - ERROR_CLUSTER_NOT_INSTALLED syscall.Errno = 5932 - ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE syscall.Errno = 5933 - ERROR_CLUSTER_MAX_NODES_IN_CLUSTER syscall.Errno = 5934 - ERROR_CLUSTER_TOO_MANY_NODES syscall.Errno = 5935 - ERROR_CLUSTER_OBJECT_ALREADY_USED syscall.Errno = 5936 - ERROR_NONCORE_GROUPS_FOUND syscall.Errno = 5937 - ERROR_FILE_SHARE_RESOURCE_CONFLICT syscall.Errno = 5938 - ERROR_CLUSTER_EVICT_INVALID_REQUEST syscall.Errno = 5939 - ERROR_CLUSTER_SINGLETON_RESOURCE syscall.Errno = 5940 - ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE syscall.Errno = 5941 - ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED syscall.Errno = 5942 - ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR syscall.Errno = 5943 - ERROR_CLUSTER_GROUP_BUSY syscall.Errno = 5944 - ERROR_CLUSTER_NOT_SHARED_VOLUME syscall.Errno = 5945 - ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR syscall.Errno = 5946 - ERROR_CLUSTER_SHARED_VOLUMES_IN_USE syscall.Errno = 5947 - ERROR_CLUSTER_USE_SHARED_VOLUMES_API syscall.Errno = 5948 - ERROR_CLUSTER_BACKUP_IN_PROGRESS syscall.Errno = 5949 - ERROR_NON_CSV_PATH syscall.Errno = 5950 - ERROR_CSV_VOLUME_NOT_LOCAL syscall.Errno = 5951 - ERROR_CLUSTER_WATCHDOG_TERMINATING syscall.Errno = 5952 - ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES syscall.Errno = 5953 - ERROR_CLUSTER_INVALID_NODE_WEIGHT syscall.Errno = 5954 - ERROR_CLUSTER_RESOURCE_VETOED_CALL syscall.Errno = 5955 - ERROR_RESMON_SYSTEM_RESOURCES_LACKING syscall.Errno = 5956 - ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION syscall.Errno = 5957 - ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE syscall.Errno = 5958 - ERROR_CLUSTER_GROUP_QUEUED syscall.Errno = 5959 - ERROR_CLUSTER_RESOURCE_LOCKED_STATUS syscall.Errno = 5960 - ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED syscall.Errno = 5961 - ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS syscall.Errno = 5962 - ERROR_CLUSTER_DISK_NOT_CONNECTED syscall.Errno = 5963 - ERROR_DISK_NOT_CSV_CAPABLE syscall.Errno = 5964 - ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE syscall.Errno = 5965 - ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED syscall.Errno = 5966 - ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED syscall.Errno = 5967 - ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES syscall.Errno = 5968 - ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES syscall.Errno = 5969 - ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE syscall.Errno = 5970 - ERROR_CLUSTER_AFFINITY_CONFLICT syscall.Errno = 5971 - ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE syscall.Errno = 5972 - ERROR_CLUSTER_UPGRADE_INCOMPATIBLE_VERSIONS syscall.Errno = 5973 - ERROR_CLUSTER_UPGRADE_FIX_QUORUM_NOT_SUPPORTED syscall.Errno = 5974 - ERROR_CLUSTER_UPGRADE_RESTART_REQUIRED syscall.Errno = 5975 - ERROR_CLUSTER_UPGRADE_IN_PROGRESS syscall.Errno = 5976 - ERROR_CLUSTER_UPGRADE_INCOMPLETE syscall.Errno = 5977 - ERROR_CLUSTER_NODE_IN_GRACE_PERIOD syscall.Errno = 5978 - ERROR_CLUSTER_CSV_IO_PAUSE_TIMEOUT syscall.Errno = 5979 - ERROR_NODE_NOT_ACTIVE_CLUSTER_MEMBER syscall.Errno = 5980 - ERROR_CLUSTER_RESOURCE_NOT_MONITORED syscall.Errno = 5981 - ERROR_CLUSTER_RESOURCE_DOES_NOT_SUPPORT_UNMONITORED syscall.Errno = 5982 - ERROR_CLUSTER_RESOURCE_IS_REPLICATED syscall.Errno = 5983 - ERROR_CLUSTER_NODE_ISOLATED syscall.Errno = 5984 - ERROR_CLUSTER_NODE_QUARANTINED syscall.Errno = 5985 - ERROR_CLUSTER_DATABASE_UPDATE_CONDITION_FAILED syscall.Errno = 5986 - ERROR_CLUSTER_SPACE_DEGRADED syscall.Errno = 5987 - ERROR_CLUSTER_TOKEN_DELEGATION_NOT_SUPPORTED syscall.Errno = 5988 - ERROR_CLUSTER_CSV_INVALID_HANDLE syscall.Errno = 5989 - ERROR_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR syscall.Errno = 5990 - ERROR_GROUPSET_NOT_AVAILABLE syscall.Errno = 5991 - ERROR_GROUPSET_NOT_FOUND syscall.Errno = 5992 - ERROR_GROUPSET_CANT_PROVIDE syscall.Errno = 5993 - ERROR_CLUSTER_FAULT_DOMAIN_PARENT_NOT_FOUND syscall.Errno = 5994 - ERROR_CLUSTER_FAULT_DOMAIN_INVALID_HIERARCHY syscall.Errno = 5995 - ERROR_CLUSTER_FAULT_DOMAIN_FAILED_S2D_VALIDATION syscall.Errno = 5996 - ERROR_CLUSTER_FAULT_DOMAIN_S2D_CONNECTIVITY_LOSS syscall.Errno = 5997 - ERROR_CLUSTER_INVALID_INFRASTRUCTURE_FILESERVER_NAME syscall.Errno = 5998 - ERROR_CLUSTERSET_MANAGEMENT_CLUSTER_UNREACHABLE syscall.Errno = 5999 - ERROR_ENCRYPTION_FAILED syscall.Errno = 6000 - ERROR_DECRYPTION_FAILED syscall.Errno = 6001 - ERROR_FILE_ENCRYPTED syscall.Errno = 6002 - ERROR_NO_RECOVERY_POLICY syscall.Errno = 6003 - ERROR_NO_EFS syscall.Errno = 6004 - ERROR_WRONG_EFS syscall.Errno = 6005 - ERROR_NO_USER_KEYS syscall.Errno = 6006 - ERROR_FILE_NOT_ENCRYPTED syscall.Errno = 6007 - ERROR_NOT_EXPORT_FORMAT syscall.Errno = 6008 - ERROR_FILE_READ_ONLY syscall.Errno = 6009 - ERROR_DIR_EFS_DISALLOWED syscall.Errno = 6010 - ERROR_EFS_SERVER_NOT_TRUSTED syscall.Errno = 6011 - ERROR_BAD_RECOVERY_POLICY syscall.Errno = 6012 - ERROR_EFS_ALG_BLOB_TOO_BIG syscall.Errno = 6013 - ERROR_VOLUME_NOT_SUPPORT_EFS syscall.Errno = 6014 - ERROR_EFS_DISABLED syscall.Errno = 6015 - ERROR_EFS_VERSION_NOT_SUPPORT syscall.Errno = 6016 - ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE syscall.Errno = 6017 - ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER syscall.Errno = 6018 - ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE syscall.Errno = 6019 - ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE syscall.Errno = 6020 - ERROR_CS_ENCRYPTION_FILE_NOT_CSE syscall.Errno = 6021 - ERROR_ENCRYPTION_POLICY_DENIES_OPERATION syscall.Errno = 6022 - ERROR_NO_BROWSER_SERVERS_FOUND syscall.Errno = 6118 - SCHED_E_SERVICE_NOT_LOCALSYSTEM syscall.Errno = 6200 - ERROR_LOG_SECTOR_INVALID syscall.Errno = 6600 - ERROR_LOG_SECTOR_PARITY_INVALID syscall.Errno = 6601 - ERROR_LOG_SECTOR_REMAPPED syscall.Errno = 6602 - ERROR_LOG_BLOCK_INCOMPLETE syscall.Errno = 6603 - ERROR_LOG_INVALID_RANGE syscall.Errno = 6604 - ERROR_LOG_BLOCKS_EXHAUSTED syscall.Errno = 6605 - ERROR_LOG_READ_CONTEXT_INVALID syscall.Errno = 6606 - ERROR_LOG_RESTART_INVALID syscall.Errno = 6607 - ERROR_LOG_BLOCK_VERSION syscall.Errno = 6608 - ERROR_LOG_BLOCK_INVALID syscall.Errno = 6609 - ERROR_LOG_READ_MODE_INVALID syscall.Errno = 6610 - ERROR_LOG_NO_RESTART syscall.Errno = 6611 - ERROR_LOG_METADATA_CORRUPT syscall.Errno = 6612 - ERROR_LOG_METADATA_INVALID syscall.Errno = 6613 - ERROR_LOG_METADATA_INCONSISTENT syscall.Errno = 6614 - ERROR_LOG_RESERVATION_INVALID syscall.Errno = 6615 - ERROR_LOG_CANT_DELETE syscall.Errno = 6616 - ERROR_LOG_CONTAINER_LIMIT_EXCEEDED syscall.Errno = 6617 - ERROR_LOG_START_OF_LOG syscall.Errno = 6618 - ERROR_LOG_POLICY_ALREADY_INSTALLED syscall.Errno = 6619 - ERROR_LOG_POLICY_NOT_INSTALLED syscall.Errno = 6620 - ERROR_LOG_POLICY_INVALID syscall.Errno = 6621 - ERROR_LOG_POLICY_CONFLICT syscall.Errno = 6622 - ERROR_LOG_PINNED_ARCHIVE_TAIL syscall.Errno = 6623 - ERROR_LOG_RECORD_NONEXISTENT syscall.Errno = 6624 - ERROR_LOG_RECORDS_RESERVED_INVALID syscall.Errno = 6625 - ERROR_LOG_SPACE_RESERVED_INVALID syscall.Errno = 6626 - ERROR_LOG_TAIL_INVALID syscall.Errno = 6627 - ERROR_LOG_FULL syscall.Errno = 6628 - ERROR_COULD_NOT_RESIZE_LOG syscall.Errno = 6629 - ERROR_LOG_MULTIPLEXED syscall.Errno = 6630 - ERROR_LOG_DEDICATED syscall.Errno = 6631 - ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS syscall.Errno = 6632 - ERROR_LOG_ARCHIVE_IN_PROGRESS syscall.Errno = 6633 - ERROR_LOG_EPHEMERAL syscall.Errno = 6634 - ERROR_LOG_NOT_ENOUGH_CONTAINERS syscall.Errno = 6635 - ERROR_LOG_CLIENT_ALREADY_REGISTERED syscall.Errno = 6636 - ERROR_LOG_CLIENT_NOT_REGISTERED syscall.Errno = 6637 - ERROR_LOG_FULL_HANDLER_IN_PROGRESS syscall.Errno = 6638 - ERROR_LOG_CONTAINER_READ_FAILED syscall.Errno = 6639 - ERROR_LOG_CONTAINER_WRITE_FAILED syscall.Errno = 6640 - ERROR_LOG_CONTAINER_OPEN_FAILED syscall.Errno = 6641 - ERROR_LOG_CONTAINER_STATE_INVALID syscall.Errno = 6642 - ERROR_LOG_STATE_INVALID syscall.Errno = 6643 - ERROR_LOG_PINNED syscall.Errno = 6644 - ERROR_LOG_METADATA_FLUSH_FAILED syscall.Errno = 6645 - ERROR_LOG_INCONSISTENT_SECURITY syscall.Errno = 6646 - ERROR_LOG_APPENDED_FLUSH_FAILED syscall.Errno = 6647 - ERROR_LOG_PINNED_RESERVATION syscall.Errno = 6648 - ERROR_INVALID_TRANSACTION syscall.Errno = 6700 - ERROR_TRANSACTION_NOT_ACTIVE syscall.Errno = 6701 - ERROR_TRANSACTION_REQUEST_NOT_VALID syscall.Errno = 6702 - ERROR_TRANSACTION_NOT_REQUESTED syscall.Errno = 6703 - ERROR_TRANSACTION_ALREADY_ABORTED syscall.Errno = 6704 - ERROR_TRANSACTION_ALREADY_COMMITTED syscall.Errno = 6705 - ERROR_TM_INITIALIZATION_FAILED syscall.Errno = 6706 - ERROR_RESOURCEMANAGER_READ_ONLY syscall.Errno = 6707 - ERROR_TRANSACTION_NOT_JOINED syscall.Errno = 6708 - ERROR_TRANSACTION_SUPERIOR_EXISTS syscall.Errno = 6709 - ERROR_CRM_PROTOCOL_ALREADY_EXISTS syscall.Errno = 6710 - ERROR_TRANSACTION_PROPAGATION_FAILED syscall.Errno = 6711 - ERROR_CRM_PROTOCOL_NOT_FOUND syscall.Errno = 6712 - ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER syscall.Errno = 6713 - ERROR_CURRENT_TRANSACTION_NOT_VALID syscall.Errno = 6714 - ERROR_TRANSACTION_NOT_FOUND syscall.Errno = 6715 - ERROR_RESOURCEMANAGER_NOT_FOUND syscall.Errno = 6716 - ERROR_ENLISTMENT_NOT_FOUND syscall.Errno = 6717 - ERROR_TRANSACTIONMANAGER_NOT_FOUND syscall.Errno = 6718 - ERROR_TRANSACTIONMANAGER_NOT_ONLINE syscall.Errno = 6719 - ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION syscall.Errno = 6720 - ERROR_TRANSACTION_NOT_ROOT syscall.Errno = 6721 - ERROR_TRANSACTION_OBJECT_EXPIRED syscall.Errno = 6722 - ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED syscall.Errno = 6723 - ERROR_TRANSACTION_RECORD_TOO_LONG syscall.Errno = 6724 - ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED syscall.Errno = 6725 - ERROR_TRANSACTION_INTEGRITY_VIOLATED syscall.Errno = 6726 - ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH syscall.Errno = 6727 - ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT syscall.Errno = 6728 - ERROR_TRANSACTION_MUST_WRITETHROUGH syscall.Errno = 6729 - ERROR_TRANSACTION_NO_SUPERIOR syscall.Errno = 6730 - ERROR_HEURISTIC_DAMAGE_POSSIBLE syscall.Errno = 6731 - ERROR_TRANSACTIONAL_CONFLICT syscall.Errno = 6800 - ERROR_RM_NOT_ACTIVE syscall.Errno = 6801 - ERROR_RM_METADATA_CORRUPT syscall.Errno = 6802 - ERROR_DIRECTORY_NOT_RM syscall.Errno = 6803 - ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE syscall.Errno = 6805 - ERROR_LOG_RESIZE_INVALID_SIZE syscall.Errno = 6806 - ERROR_OBJECT_NO_LONGER_EXISTS syscall.Errno = 6807 - ERROR_STREAM_MINIVERSION_NOT_FOUND syscall.Errno = 6808 - ERROR_STREAM_MINIVERSION_NOT_VALID syscall.Errno = 6809 - ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION syscall.Errno = 6810 - ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT syscall.Errno = 6811 - ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS syscall.Errno = 6812 - ERROR_REMOTE_FILE_VERSION_MISMATCH syscall.Errno = 6814 - ERROR_HANDLE_NO_LONGER_VALID syscall.Errno = 6815 - ERROR_NO_TXF_METADATA syscall.Errno = 6816 - ERROR_LOG_CORRUPTION_DETECTED syscall.Errno = 6817 - ERROR_CANT_RECOVER_WITH_HANDLE_OPEN syscall.Errno = 6818 - ERROR_RM_DISCONNECTED syscall.Errno = 6819 - ERROR_ENLISTMENT_NOT_SUPERIOR syscall.Errno = 6820 - ERROR_RECOVERY_NOT_NEEDED syscall.Errno = 6821 - ERROR_RM_ALREADY_STARTED syscall.Errno = 6822 - ERROR_FILE_IDENTITY_NOT_PERSISTENT syscall.Errno = 6823 - ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY syscall.Errno = 6824 - ERROR_CANT_CROSS_RM_BOUNDARY syscall.Errno = 6825 - ERROR_TXF_DIR_NOT_EMPTY syscall.Errno = 6826 - ERROR_INDOUBT_TRANSACTIONS_EXIST syscall.Errno = 6827 - ERROR_TM_VOLATILE syscall.Errno = 6828 - ERROR_ROLLBACK_TIMER_EXPIRED syscall.Errno = 6829 - ERROR_TXF_ATTRIBUTE_CORRUPT syscall.Errno = 6830 - ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6831 - ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED syscall.Errno = 6832 - ERROR_LOG_GROWTH_FAILED syscall.Errno = 6833 - ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE syscall.Errno = 6834 - ERROR_TXF_METADATA_ALREADY_PRESENT syscall.Errno = 6835 - ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET syscall.Errno = 6836 - ERROR_TRANSACTION_REQUIRED_PROMOTION syscall.Errno = 6837 - ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION syscall.Errno = 6838 - ERROR_TRANSACTIONS_NOT_FROZEN syscall.Errno = 6839 - ERROR_TRANSACTION_FREEZE_IN_PROGRESS syscall.Errno = 6840 - ERROR_NOT_SNAPSHOT_VOLUME syscall.Errno = 6841 - ERROR_NO_SAVEPOINT_WITH_OPEN_FILES syscall.Errno = 6842 - ERROR_DATA_LOST_REPAIR syscall.Errno = 6843 - ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6844 - ERROR_TM_IDENTITY_MISMATCH syscall.Errno = 6845 - ERROR_FLOATED_SECTION syscall.Errno = 6846 - ERROR_CANNOT_ACCEPT_TRANSACTED_WORK syscall.Errno = 6847 - ERROR_CANNOT_ABORT_TRANSACTIONS syscall.Errno = 6848 - ERROR_BAD_CLUSTERS syscall.Errno = 6849 - ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6850 - ERROR_VOLUME_DIRTY syscall.Errno = 6851 - ERROR_NO_LINK_TRACKING_IN_TRANSACTION syscall.Errno = 6852 - ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION syscall.Errno = 6853 - ERROR_EXPIRED_HANDLE syscall.Errno = 6854 - ERROR_TRANSACTION_NOT_ENLISTED syscall.Errno = 6855 - ERROR_CTX_WINSTATION_NAME_INVALID syscall.Errno = 7001 - ERROR_CTX_INVALID_PD syscall.Errno = 7002 - ERROR_CTX_PD_NOT_FOUND syscall.Errno = 7003 - ERROR_CTX_WD_NOT_FOUND syscall.Errno = 7004 - ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY syscall.Errno = 7005 - ERROR_CTX_SERVICE_NAME_COLLISION syscall.Errno = 7006 - ERROR_CTX_CLOSE_PENDING syscall.Errno = 7007 - ERROR_CTX_NO_OUTBUF syscall.Errno = 7008 - ERROR_CTX_MODEM_INF_NOT_FOUND syscall.Errno = 7009 - ERROR_CTX_INVALID_MODEMNAME syscall.Errno = 7010 - ERROR_CTX_MODEM_RESPONSE_ERROR syscall.Errno = 7011 - ERROR_CTX_MODEM_RESPONSE_TIMEOUT syscall.Errno = 7012 - ERROR_CTX_MODEM_RESPONSE_NO_CARRIER syscall.Errno = 7013 - ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE syscall.Errno = 7014 - ERROR_CTX_MODEM_RESPONSE_BUSY syscall.Errno = 7015 - ERROR_CTX_MODEM_RESPONSE_VOICE syscall.Errno = 7016 - ERROR_CTX_TD_ERROR syscall.Errno = 7017 - ERROR_CTX_WINSTATION_NOT_FOUND syscall.Errno = 7022 - ERROR_CTX_WINSTATION_ALREADY_EXISTS syscall.Errno = 7023 - ERROR_CTX_WINSTATION_BUSY syscall.Errno = 7024 - ERROR_CTX_BAD_VIDEO_MODE syscall.Errno = 7025 - ERROR_CTX_GRAPHICS_INVALID syscall.Errno = 7035 - ERROR_CTX_LOGON_DISABLED syscall.Errno = 7037 - ERROR_CTX_NOT_CONSOLE syscall.Errno = 7038 - ERROR_CTX_CLIENT_QUERY_TIMEOUT syscall.Errno = 7040 - ERROR_CTX_CONSOLE_DISCONNECT syscall.Errno = 7041 - ERROR_CTX_CONSOLE_CONNECT syscall.Errno = 7042 - ERROR_CTX_SHADOW_DENIED syscall.Errno = 7044 - ERROR_CTX_WINSTATION_ACCESS_DENIED syscall.Errno = 7045 - ERROR_CTX_INVALID_WD syscall.Errno = 7049 - ERROR_CTX_SHADOW_INVALID syscall.Errno = 7050 - ERROR_CTX_SHADOW_DISABLED syscall.Errno = 7051 - ERROR_CTX_CLIENT_LICENSE_IN_USE syscall.Errno = 7052 - ERROR_CTX_CLIENT_LICENSE_NOT_SET syscall.Errno = 7053 - ERROR_CTX_LICENSE_NOT_AVAILABLE syscall.Errno = 7054 - ERROR_CTX_LICENSE_CLIENT_INVALID syscall.Errno = 7055 - ERROR_CTX_LICENSE_EXPIRED syscall.Errno = 7056 - ERROR_CTX_SHADOW_NOT_RUNNING syscall.Errno = 7057 - ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE syscall.Errno = 7058 - ERROR_ACTIVATION_COUNT_EXCEEDED syscall.Errno = 7059 - ERROR_CTX_WINSTATIONS_DISABLED syscall.Errno = 7060 - ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED syscall.Errno = 7061 - ERROR_CTX_SESSION_IN_USE syscall.Errno = 7062 - ERROR_CTX_NO_FORCE_LOGOFF syscall.Errno = 7063 - ERROR_CTX_ACCOUNT_RESTRICTION syscall.Errno = 7064 - ERROR_RDP_PROTOCOL_ERROR syscall.Errno = 7065 - ERROR_CTX_CDM_CONNECT syscall.Errno = 7066 - ERROR_CTX_CDM_DISCONNECT syscall.Errno = 7067 - ERROR_CTX_SECURITY_LAYER_ERROR syscall.Errno = 7068 - ERROR_TS_INCOMPATIBLE_SESSIONS syscall.Errno = 7069 - ERROR_TS_VIDEO_SUBSYSTEM_ERROR syscall.Errno = 7070 - FRS_ERR_INVALID_API_SEQUENCE syscall.Errno = 8001 - FRS_ERR_STARTING_SERVICE syscall.Errno = 8002 - FRS_ERR_STOPPING_SERVICE syscall.Errno = 8003 - FRS_ERR_INTERNAL_API syscall.Errno = 8004 - FRS_ERR_INTERNAL syscall.Errno = 8005 - FRS_ERR_SERVICE_COMM syscall.Errno = 8006 - FRS_ERR_INSUFFICIENT_PRIV syscall.Errno = 8007 - FRS_ERR_AUTHENTICATION syscall.Errno = 8008 - FRS_ERR_PARENT_INSUFFICIENT_PRIV syscall.Errno = 8009 - FRS_ERR_PARENT_AUTHENTICATION syscall.Errno = 8010 - FRS_ERR_CHILD_TO_PARENT_COMM syscall.Errno = 8011 - FRS_ERR_PARENT_TO_CHILD_COMM syscall.Errno = 8012 - FRS_ERR_SYSVOL_POPULATE syscall.Errno = 8013 - FRS_ERR_SYSVOL_POPULATE_TIMEOUT syscall.Errno = 8014 - FRS_ERR_SYSVOL_IS_BUSY syscall.Errno = 8015 - FRS_ERR_SYSVOL_DEMOTE syscall.Errno = 8016 - FRS_ERR_INVALID_SERVICE_PARAMETER syscall.Errno = 8017 - DS_S_SUCCESS = ERROR_SUCCESS - ERROR_DS_NOT_INSTALLED syscall.Errno = 8200 - ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY syscall.Errno = 8201 - ERROR_DS_NO_ATTRIBUTE_OR_VALUE syscall.Errno = 8202 - ERROR_DS_INVALID_ATTRIBUTE_SYNTAX syscall.Errno = 8203 - ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED syscall.Errno = 8204 - ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS syscall.Errno = 8205 - ERROR_DS_BUSY syscall.Errno = 8206 - ERROR_DS_UNAVAILABLE syscall.Errno = 8207 - ERROR_DS_NO_RIDS_ALLOCATED syscall.Errno = 8208 - ERROR_DS_NO_MORE_RIDS syscall.Errno = 8209 - ERROR_DS_INCORRECT_ROLE_OWNER syscall.Errno = 8210 - ERROR_DS_RIDMGR_INIT_ERROR syscall.Errno = 8211 - ERROR_DS_OBJ_CLASS_VIOLATION syscall.Errno = 8212 - ERROR_DS_CANT_ON_NON_LEAF syscall.Errno = 8213 - ERROR_DS_CANT_ON_RDN syscall.Errno = 8214 - ERROR_DS_CANT_MOD_OBJ_CLASS syscall.Errno = 8215 - ERROR_DS_CROSS_DOM_MOVE_ERROR syscall.Errno = 8216 - ERROR_DS_GC_NOT_AVAILABLE syscall.Errno = 8217 - ERROR_SHARED_POLICY syscall.Errno = 8218 - ERROR_POLICY_OBJECT_NOT_FOUND syscall.Errno = 8219 - ERROR_POLICY_ONLY_IN_DS syscall.Errno = 8220 - ERROR_PROMOTION_ACTIVE syscall.Errno = 8221 - ERROR_NO_PROMOTION_ACTIVE syscall.Errno = 8222 - ERROR_DS_OPERATIONS_ERROR syscall.Errno = 8224 - ERROR_DS_PROTOCOL_ERROR syscall.Errno = 8225 - ERROR_DS_TIMELIMIT_EXCEEDED syscall.Errno = 8226 - ERROR_DS_SIZELIMIT_EXCEEDED syscall.Errno = 8227 - ERROR_DS_ADMIN_LIMIT_EXCEEDED syscall.Errno = 8228 - ERROR_DS_COMPARE_FALSE syscall.Errno = 8229 - ERROR_DS_COMPARE_TRUE syscall.Errno = 8230 - ERROR_DS_AUTH_METHOD_NOT_SUPPORTED syscall.Errno = 8231 - ERROR_DS_STRONG_AUTH_REQUIRED syscall.Errno = 8232 - ERROR_DS_INAPPROPRIATE_AUTH syscall.Errno = 8233 - ERROR_DS_AUTH_UNKNOWN syscall.Errno = 8234 - ERROR_DS_REFERRAL syscall.Errno = 8235 - ERROR_DS_UNAVAILABLE_CRIT_EXTENSION syscall.Errno = 8236 - ERROR_DS_CONFIDENTIALITY_REQUIRED syscall.Errno = 8237 - ERROR_DS_INAPPROPRIATE_MATCHING syscall.Errno = 8238 - ERROR_DS_CONSTRAINT_VIOLATION syscall.Errno = 8239 - ERROR_DS_NO_SUCH_OBJECT syscall.Errno = 8240 - ERROR_DS_ALIAS_PROBLEM syscall.Errno = 8241 - ERROR_DS_INVALID_DN_SYNTAX syscall.Errno = 8242 - ERROR_DS_IS_LEAF syscall.Errno = 8243 - ERROR_DS_ALIAS_DEREF_PROBLEM syscall.Errno = 8244 - ERROR_DS_UNWILLING_TO_PERFORM syscall.Errno = 8245 - ERROR_DS_LOOP_DETECT syscall.Errno = 8246 - ERROR_DS_NAMING_VIOLATION syscall.Errno = 8247 - ERROR_DS_OBJECT_RESULTS_TOO_LARGE syscall.Errno = 8248 - ERROR_DS_AFFECTS_MULTIPLE_DSAS syscall.Errno = 8249 - ERROR_DS_SERVER_DOWN syscall.Errno = 8250 - ERROR_DS_LOCAL_ERROR syscall.Errno = 8251 - ERROR_DS_ENCODING_ERROR syscall.Errno = 8252 - ERROR_DS_DECODING_ERROR syscall.Errno = 8253 - ERROR_DS_FILTER_UNKNOWN syscall.Errno = 8254 - ERROR_DS_PARAM_ERROR syscall.Errno = 8255 - ERROR_DS_NOT_SUPPORTED syscall.Errno = 8256 - ERROR_DS_NO_RESULTS_RETURNED syscall.Errno = 8257 - ERROR_DS_CONTROL_NOT_FOUND syscall.Errno = 8258 - ERROR_DS_CLIENT_LOOP syscall.Errno = 8259 - ERROR_DS_REFERRAL_LIMIT_EXCEEDED syscall.Errno = 8260 - ERROR_DS_SORT_CONTROL_MISSING syscall.Errno = 8261 - ERROR_DS_OFFSET_RANGE_ERROR syscall.Errno = 8262 - ERROR_DS_RIDMGR_DISABLED syscall.Errno = 8263 - ERROR_DS_ROOT_MUST_BE_NC syscall.Errno = 8301 - ERROR_DS_ADD_REPLICA_INHIBITED syscall.Errno = 8302 - ERROR_DS_ATT_NOT_DEF_IN_SCHEMA syscall.Errno = 8303 - ERROR_DS_MAX_OBJ_SIZE_EXCEEDED syscall.Errno = 8304 - ERROR_DS_OBJ_STRING_NAME_EXISTS syscall.Errno = 8305 - ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA syscall.Errno = 8306 - ERROR_DS_RDN_DOESNT_MATCH_SCHEMA syscall.Errno = 8307 - ERROR_DS_NO_REQUESTED_ATTS_FOUND syscall.Errno = 8308 - ERROR_DS_USER_BUFFER_TO_SMALL syscall.Errno = 8309 - ERROR_DS_ATT_IS_NOT_ON_OBJ syscall.Errno = 8310 - ERROR_DS_ILLEGAL_MOD_OPERATION syscall.Errno = 8311 - ERROR_DS_OBJ_TOO_LARGE syscall.Errno = 8312 - ERROR_DS_BAD_INSTANCE_TYPE syscall.Errno = 8313 - ERROR_DS_MASTERDSA_REQUIRED syscall.Errno = 8314 - ERROR_DS_OBJECT_CLASS_REQUIRED syscall.Errno = 8315 - ERROR_DS_MISSING_REQUIRED_ATT syscall.Errno = 8316 - ERROR_DS_ATT_NOT_DEF_FOR_CLASS syscall.Errno = 8317 - ERROR_DS_ATT_ALREADY_EXISTS syscall.Errno = 8318 - ERROR_DS_CANT_ADD_ATT_VALUES syscall.Errno = 8320 - ERROR_DS_SINGLE_VALUE_CONSTRAINT syscall.Errno = 8321 - ERROR_DS_RANGE_CONSTRAINT syscall.Errno = 8322 - ERROR_DS_ATT_VAL_ALREADY_EXISTS syscall.Errno = 8323 - ERROR_DS_CANT_REM_MISSING_ATT syscall.Errno = 8324 - ERROR_DS_CANT_REM_MISSING_ATT_VAL syscall.Errno = 8325 - ERROR_DS_ROOT_CANT_BE_SUBREF syscall.Errno = 8326 - ERROR_DS_NO_CHAINING syscall.Errno = 8327 - ERROR_DS_NO_CHAINED_EVAL syscall.Errno = 8328 - ERROR_DS_NO_PARENT_OBJECT syscall.Errno = 8329 - ERROR_DS_PARENT_IS_AN_ALIAS syscall.Errno = 8330 - ERROR_DS_CANT_MIX_MASTER_AND_REPS syscall.Errno = 8331 - ERROR_DS_CHILDREN_EXIST syscall.Errno = 8332 - ERROR_DS_OBJ_NOT_FOUND syscall.Errno = 8333 - ERROR_DS_ALIASED_OBJ_MISSING syscall.Errno = 8334 - ERROR_DS_BAD_NAME_SYNTAX syscall.Errno = 8335 - ERROR_DS_ALIAS_POINTS_TO_ALIAS syscall.Errno = 8336 - ERROR_DS_CANT_DEREF_ALIAS syscall.Errno = 8337 - ERROR_DS_OUT_OF_SCOPE syscall.Errno = 8338 - ERROR_DS_OBJECT_BEING_REMOVED syscall.Errno = 8339 - ERROR_DS_CANT_DELETE_DSA_OBJ syscall.Errno = 8340 - ERROR_DS_GENERIC_ERROR syscall.Errno = 8341 - ERROR_DS_DSA_MUST_BE_INT_MASTER syscall.Errno = 8342 - ERROR_DS_CLASS_NOT_DSA syscall.Errno = 8343 - ERROR_DS_INSUFF_ACCESS_RIGHTS syscall.Errno = 8344 - ERROR_DS_ILLEGAL_SUPERIOR syscall.Errno = 8345 - ERROR_DS_ATTRIBUTE_OWNED_BY_SAM syscall.Errno = 8346 - ERROR_DS_NAME_TOO_MANY_PARTS syscall.Errno = 8347 - ERROR_DS_NAME_TOO_LONG syscall.Errno = 8348 - ERROR_DS_NAME_VALUE_TOO_LONG syscall.Errno = 8349 - ERROR_DS_NAME_UNPARSEABLE syscall.Errno = 8350 - ERROR_DS_NAME_TYPE_UNKNOWN syscall.Errno = 8351 - ERROR_DS_NOT_AN_OBJECT syscall.Errno = 8352 - ERROR_DS_SEC_DESC_TOO_SHORT syscall.Errno = 8353 - ERROR_DS_SEC_DESC_INVALID syscall.Errno = 8354 - ERROR_DS_NO_DELETED_NAME syscall.Errno = 8355 - ERROR_DS_SUBREF_MUST_HAVE_PARENT syscall.Errno = 8356 - ERROR_DS_NCNAME_MUST_BE_NC syscall.Errno = 8357 - ERROR_DS_CANT_ADD_SYSTEM_ONLY syscall.Errno = 8358 - ERROR_DS_CLASS_MUST_BE_CONCRETE syscall.Errno = 8359 - ERROR_DS_INVALID_DMD syscall.Errno = 8360 - ERROR_DS_OBJ_GUID_EXISTS syscall.Errno = 8361 - ERROR_DS_NOT_ON_BACKLINK syscall.Errno = 8362 - ERROR_DS_NO_CROSSREF_FOR_NC syscall.Errno = 8363 - ERROR_DS_SHUTTING_DOWN syscall.Errno = 8364 - ERROR_DS_UNKNOWN_OPERATION syscall.Errno = 8365 - ERROR_DS_INVALID_ROLE_OWNER syscall.Errno = 8366 - ERROR_DS_COULDNT_CONTACT_FSMO syscall.Errno = 8367 - ERROR_DS_CROSS_NC_DN_RENAME syscall.Errno = 8368 - ERROR_DS_CANT_MOD_SYSTEM_ONLY syscall.Errno = 8369 - ERROR_DS_REPLICATOR_ONLY syscall.Errno = 8370 - ERROR_DS_OBJ_CLASS_NOT_DEFINED syscall.Errno = 8371 - ERROR_DS_OBJ_CLASS_NOT_SUBCLASS syscall.Errno = 8372 - ERROR_DS_NAME_REFERENCE_INVALID syscall.Errno = 8373 - ERROR_DS_CROSS_REF_EXISTS syscall.Errno = 8374 - ERROR_DS_CANT_DEL_MASTER_CROSSREF syscall.Errno = 8375 - ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD syscall.Errno = 8376 - ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX syscall.Errno = 8377 - ERROR_DS_DUP_RDN syscall.Errno = 8378 - ERROR_DS_DUP_OID syscall.Errno = 8379 - ERROR_DS_DUP_MAPI_ID syscall.Errno = 8380 - ERROR_DS_DUP_SCHEMA_ID_GUID syscall.Errno = 8381 - ERROR_DS_DUP_LDAP_DISPLAY_NAME syscall.Errno = 8382 - ERROR_DS_SEMANTIC_ATT_TEST syscall.Errno = 8383 - ERROR_DS_SYNTAX_MISMATCH syscall.Errno = 8384 - ERROR_DS_EXISTS_IN_MUST_HAVE syscall.Errno = 8385 - ERROR_DS_EXISTS_IN_MAY_HAVE syscall.Errno = 8386 - ERROR_DS_NONEXISTENT_MAY_HAVE syscall.Errno = 8387 - ERROR_DS_NONEXISTENT_MUST_HAVE syscall.Errno = 8388 - ERROR_DS_AUX_CLS_TEST_FAIL syscall.Errno = 8389 - ERROR_DS_NONEXISTENT_POSS_SUP syscall.Errno = 8390 - ERROR_DS_SUB_CLS_TEST_FAIL syscall.Errno = 8391 - ERROR_DS_BAD_RDN_ATT_ID_SYNTAX syscall.Errno = 8392 - ERROR_DS_EXISTS_IN_AUX_CLS syscall.Errno = 8393 - ERROR_DS_EXISTS_IN_SUB_CLS syscall.Errno = 8394 - ERROR_DS_EXISTS_IN_POSS_SUP syscall.Errno = 8395 - ERROR_DS_RECALCSCHEMA_FAILED syscall.Errno = 8396 - ERROR_DS_TREE_DELETE_NOT_FINISHED syscall.Errno = 8397 - ERROR_DS_CANT_DELETE syscall.Errno = 8398 - ERROR_DS_ATT_SCHEMA_REQ_ID syscall.Errno = 8399 - ERROR_DS_BAD_ATT_SCHEMA_SYNTAX syscall.Errno = 8400 - ERROR_DS_CANT_CACHE_ATT syscall.Errno = 8401 - ERROR_DS_CANT_CACHE_CLASS syscall.Errno = 8402 - ERROR_DS_CANT_REMOVE_ATT_CACHE syscall.Errno = 8403 - ERROR_DS_CANT_REMOVE_CLASS_CACHE syscall.Errno = 8404 - ERROR_DS_CANT_RETRIEVE_DN syscall.Errno = 8405 - ERROR_DS_MISSING_SUPREF syscall.Errno = 8406 - ERROR_DS_CANT_RETRIEVE_INSTANCE syscall.Errno = 8407 - ERROR_DS_CODE_INCONSISTENCY syscall.Errno = 8408 - ERROR_DS_DATABASE_ERROR syscall.Errno = 8409 - ERROR_DS_GOVERNSID_MISSING syscall.Errno = 8410 - ERROR_DS_MISSING_EXPECTED_ATT syscall.Errno = 8411 - ERROR_DS_NCNAME_MISSING_CR_REF syscall.Errno = 8412 - ERROR_DS_SECURITY_CHECKING_ERROR syscall.Errno = 8413 - ERROR_DS_SCHEMA_NOT_LOADED syscall.Errno = 8414 - ERROR_DS_SCHEMA_ALLOC_FAILED syscall.Errno = 8415 - ERROR_DS_ATT_SCHEMA_REQ_SYNTAX syscall.Errno = 8416 - ERROR_DS_GCVERIFY_ERROR syscall.Errno = 8417 - ERROR_DS_DRA_SCHEMA_MISMATCH syscall.Errno = 8418 - ERROR_DS_CANT_FIND_DSA_OBJ syscall.Errno = 8419 - ERROR_DS_CANT_FIND_EXPECTED_NC syscall.Errno = 8420 - ERROR_DS_CANT_FIND_NC_IN_CACHE syscall.Errno = 8421 - ERROR_DS_CANT_RETRIEVE_CHILD syscall.Errno = 8422 - ERROR_DS_SECURITY_ILLEGAL_MODIFY syscall.Errno = 8423 - ERROR_DS_CANT_REPLACE_HIDDEN_REC syscall.Errno = 8424 - ERROR_DS_BAD_HIERARCHY_FILE syscall.Errno = 8425 - ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED syscall.Errno = 8426 - ERROR_DS_CONFIG_PARAM_MISSING syscall.Errno = 8427 - ERROR_DS_COUNTING_AB_INDICES_FAILED syscall.Errno = 8428 - ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED syscall.Errno = 8429 - ERROR_DS_INTERNAL_FAILURE syscall.Errno = 8430 - ERROR_DS_UNKNOWN_ERROR syscall.Errno = 8431 - ERROR_DS_ROOT_REQUIRES_CLASS_TOP syscall.Errno = 8432 - ERROR_DS_REFUSING_FSMO_ROLES syscall.Errno = 8433 - ERROR_DS_MISSING_FSMO_SETTINGS syscall.Errno = 8434 - ERROR_DS_UNABLE_TO_SURRENDER_ROLES syscall.Errno = 8435 - ERROR_DS_DRA_GENERIC syscall.Errno = 8436 - ERROR_DS_DRA_INVALID_PARAMETER syscall.Errno = 8437 - ERROR_DS_DRA_BUSY syscall.Errno = 8438 - ERROR_DS_DRA_BAD_DN syscall.Errno = 8439 - ERROR_DS_DRA_BAD_NC syscall.Errno = 8440 - ERROR_DS_DRA_DN_EXISTS syscall.Errno = 8441 - ERROR_DS_DRA_INTERNAL_ERROR syscall.Errno = 8442 - ERROR_DS_DRA_INCONSISTENT_DIT syscall.Errno = 8443 - ERROR_DS_DRA_CONNECTION_FAILED syscall.Errno = 8444 - ERROR_DS_DRA_BAD_INSTANCE_TYPE syscall.Errno = 8445 - ERROR_DS_DRA_OUT_OF_MEM syscall.Errno = 8446 - ERROR_DS_DRA_MAIL_PROBLEM syscall.Errno = 8447 - ERROR_DS_DRA_REF_ALREADY_EXISTS syscall.Errno = 8448 - ERROR_DS_DRA_REF_NOT_FOUND syscall.Errno = 8449 - ERROR_DS_DRA_OBJ_IS_REP_SOURCE syscall.Errno = 8450 - ERROR_DS_DRA_DB_ERROR syscall.Errno = 8451 - ERROR_DS_DRA_NO_REPLICA syscall.Errno = 8452 - ERROR_DS_DRA_ACCESS_DENIED syscall.Errno = 8453 - ERROR_DS_DRA_NOT_SUPPORTED syscall.Errno = 8454 - ERROR_DS_DRA_RPC_CANCELLED syscall.Errno = 8455 - ERROR_DS_DRA_SOURCE_DISABLED syscall.Errno = 8456 - ERROR_DS_DRA_SINK_DISABLED syscall.Errno = 8457 - ERROR_DS_DRA_NAME_COLLISION syscall.Errno = 8458 - ERROR_DS_DRA_SOURCE_REINSTALLED syscall.Errno = 8459 - ERROR_DS_DRA_MISSING_PARENT syscall.Errno = 8460 - ERROR_DS_DRA_PREEMPTED syscall.Errno = 8461 - ERROR_DS_DRA_ABANDON_SYNC syscall.Errno = 8462 - ERROR_DS_DRA_SHUTDOWN syscall.Errno = 8463 - ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET syscall.Errno = 8464 - ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA syscall.Errno = 8465 - ERROR_DS_DRA_EXTN_CONNECTION_FAILED syscall.Errno = 8466 - ERROR_DS_INSTALL_SCHEMA_MISMATCH syscall.Errno = 8467 - ERROR_DS_DUP_LINK_ID syscall.Errno = 8468 - ERROR_DS_NAME_ERROR_RESOLVING syscall.Errno = 8469 - ERROR_DS_NAME_ERROR_NOT_FOUND syscall.Errno = 8470 - ERROR_DS_NAME_ERROR_NOT_UNIQUE syscall.Errno = 8471 - ERROR_DS_NAME_ERROR_NO_MAPPING syscall.Errno = 8472 - ERROR_DS_NAME_ERROR_DOMAIN_ONLY syscall.Errno = 8473 - ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING syscall.Errno = 8474 - ERROR_DS_CONSTRUCTED_ATT_MOD syscall.Errno = 8475 - ERROR_DS_WRONG_OM_OBJ_CLASS syscall.Errno = 8476 - ERROR_DS_DRA_REPL_PENDING syscall.Errno = 8477 - ERROR_DS_DS_REQUIRED syscall.Errno = 8478 - ERROR_DS_INVALID_LDAP_DISPLAY_NAME syscall.Errno = 8479 - ERROR_DS_NON_BASE_SEARCH syscall.Errno = 8480 - ERROR_DS_CANT_RETRIEVE_ATTS syscall.Errno = 8481 - ERROR_DS_BACKLINK_WITHOUT_LINK syscall.Errno = 8482 - ERROR_DS_EPOCH_MISMATCH syscall.Errno = 8483 - ERROR_DS_SRC_NAME_MISMATCH syscall.Errno = 8484 - ERROR_DS_SRC_AND_DST_NC_IDENTICAL syscall.Errno = 8485 - ERROR_DS_DST_NC_MISMATCH syscall.Errno = 8486 - ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC syscall.Errno = 8487 - ERROR_DS_SRC_GUID_MISMATCH syscall.Errno = 8488 - ERROR_DS_CANT_MOVE_DELETED_OBJECT syscall.Errno = 8489 - ERROR_DS_PDC_OPERATION_IN_PROGRESS syscall.Errno = 8490 - ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD syscall.Errno = 8491 - ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION syscall.Errno = 8492 - ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS syscall.Errno = 8493 - ERROR_DS_NC_MUST_HAVE_NC_PARENT syscall.Errno = 8494 - ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE syscall.Errno = 8495 - ERROR_DS_DST_DOMAIN_NOT_NATIVE syscall.Errno = 8496 - ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER syscall.Errno = 8497 - ERROR_DS_CANT_MOVE_ACCOUNT_GROUP syscall.Errno = 8498 - ERROR_DS_CANT_MOVE_RESOURCE_GROUP syscall.Errno = 8499 - ERROR_DS_INVALID_SEARCH_FLAG syscall.Errno = 8500 - ERROR_DS_NO_TREE_DELETE_ABOVE_NC syscall.Errno = 8501 - ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE syscall.Errno = 8502 - ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE syscall.Errno = 8503 - ERROR_DS_SAM_INIT_FAILURE syscall.Errno = 8504 - ERROR_DS_SENSITIVE_GROUP_VIOLATION syscall.Errno = 8505 - ERROR_DS_CANT_MOD_PRIMARYGROUPID syscall.Errno = 8506 - ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD syscall.Errno = 8507 - ERROR_DS_NONSAFE_SCHEMA_CHANGE syscall.Errno = 8508 - ERROR_DS_SCHEMA_UPDATE_DISALLOWED syscall.Errno = 8509 - ERROR_DS_CANT_CREATE_UNDER_SCHEMA syscall.Errno = 8510 - ERROR_DS_INSTALL_NO_SRC_SCH_VERSION syscall.Errno = 8511 - ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE syscall.Errno = 8512 - ERROR_DS_INVALID_GROUP_TYPE syscall.Errno = 8513 - ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8514 - ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8515 - ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8516 - ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8517 - ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8518 - ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER syscall.Errno = 8519 - ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER syscall.Errno = 8520 - ERROR_DS_HAVE_PRIMARY_MEMBERS syscall.Errno = 8521 - ERROR_DS_STRING_SD_CONVERSION_FAILED syscall.Errno = 8522 - ERROR_DS_NAMING_MASTER_GC syscall.Errno = 8523 - ERROR_DS_DNS_LOOKUP_FAILURE syscall.Errno = 8524 - ERROR_DS_COULDNT_UPDATE_SPNS syscall.Errno = 8525 - ERROR_DS_CANT_RETRIEVE_SD syscall.Errno = 8526 - ERROR_DS_KEY_NOT_UNIQUE syscall.Errno = 8527 - ERROR_DS_WRONG_LINKED_ATT_SYNTAX syscall.Errno = 8528 - ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD syscall.Errno = 8529 - ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY syscall.Errno = 8530 - ERROR_DS_CANT_START syscall.Errno = 8531 - ERROR_DS_INIT_FAILURE syscall.Errno = 8532 - ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION syscall.Errno = 8533 - ERROR_DS_SOURCE_DOMAIN_IN_FOREST syscall.Errno = 8534 - ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST syscall.Errno = 8535 - ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED syscall.Errno = 8536 - ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN syscall.Errno = 8537 - ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER syscall.Errno = 8538 - ERROR_DS_SRC_SID_EXISTS_IN_FOREST syscall.Errno = 8539 - ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH syscall.Errno = 8540 - ERROR_SAM_INIT_FAILURE syscall.Errno = 8541 - ERROR_DS_DRA_SCHEMA_INFO_SHIP syscall.Errno = 8542 - ERROR_DS_DRA_SCHEMA_CONFLICT syscall.Errno = 8543 - ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT syscall.Errno = 8544 - ERROR_DS_DRA_OBJ_NC_MISMATCH syscall.Errno = 8545 - ERROR_DS_NC_STILL_HAS_DSAS syscall.Errno = 8546 - ERROR_DS_GC_REQUIRED syscall.Errno = 8547 - ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY syscall.Errno = 8548 - ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS syscall.Errno = 8549 - ERROR_DS_CANT_ADD_TO_GC syscall.Errno = 8550 - ERROR_DS_NO_CHECKPOINT_WITH_PDC syscall.Errno = 8551 - ERROR_DS_SOURCE_AUDITING_NOT_ENABLED syscall.Errno = 8552 - ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC syscall.Errno = 8553 - ERROR_DS_INVALID_NAME_FOR_SPN syscall.Errno = 8554 - ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS syscall.Errno = 8555 - ERROR_DS_UNICODEPWD_NOT_IN_QUOTES syscall.Errno = 8556 - ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED syscall.Errno = 8557 - ERROR_DS_MUST_BE_RUN_ON_DST_DC syscall.Errno = 8558 - ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER syscall.Errno = 8559 - ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ syscall.Errno = 8560 - ERROR_DS_INIT_FAILURE_CONSOLE syscall.Errno = 8561 - ERROR_DS_SAM_INIT_FAILURE_CONSOLE syscall.Errno = 8562 - ERROR_DS_FOREST_VERSION_TOO_HIGH syscall.Errno = 8563 - ERROR_DS_DOMAIN_VERSION_TOO_HIGH syscall.Errno = 8564 - ERROR_DS_FOREST_VERSION_TOO_LOW syscall.Errno = 8565 - ERROR_DS_DOMAIN_VERSION_TOO_LOW syscall.Errno = 8566 - ERROR_DS_INCOMPATIBLE_VERSION syscall.Errno = 8567 - ERROR_DS_LOW_DSA_VERSION syscall.Errno = 8568 - ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN syscall.Errno = 8569 - ERROR_DS_NOT_SUPPORTED_SORT_ORDER syscall.Errno = 8570 - ERROR_DS_NAME_NOT_UNIQUE syscall.Errno = 8571 - ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 syscall.Errno = 8572 - ERROR_DS_OUT_OF_VERSION_STORE syscall.Errno = 8573 - ERROR_DS_INCOMPATIBLE_CONTROLS_USED syscall.Errno = 8574 - ERROR_DS_NO_REF_DOMAIN syscall.Errno = 8575 - ERROR_DS_RESERVED_LINK_ID syscall.Errno = 8576 - ERROR_DS_LINK_ID_NOT_AVAILABLE syscall.Errno = 8577 - ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8578 - ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE syscall.Errno = 8579 - ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC syscall.Errno = 8580 - ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG syscall.Errno = 8581 - ERROR_DS_MODIFYDN_WRONG_GRANDPARENT syscall.Errno = 8582 - ERROR_DS_NAME_ERROR_TRUST_REFERRAL syscall.Errno = 8583 - ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER syscall.Errno = 8584 - ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD syscall.Errno = 8585 - ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 syscall.Errno = 8586 - ERROR_DS_THREAD_LIMIT_EXCEEDED syscall.Errno = 8587 - ERROR_DS_NOT_CLOSEST syscall.Errno = 8588 - ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF syscall.Errno = 8589 - ERROR_DS_SINGLE_USER_MODE_FAILED syscall.Errno = 8590 - ERROR_DS_NTDSCRIPT_SYNTAX_ERROR syscall.Errno = 8591 - ERROR_DS_NTDSCRIPT_PROCESS_ERROR syscall.Errno = 8592 - ERROR_DS_DIFFERENT_REPL_EPOCHS syscall.Errno = 8593 - ERROR_DS_DRS_EXTENSIONS_CHANGED syscall.Errno = 8594 - ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR syscall.Errno = 8595 - ERROR_DS_NO_MSDS_INTID syscall.Errno = 8596 - ERROR_DS_DUP_MSDS_INTID syscall.Errno = 8597 - ERROR_DS_EXISTS_IN_RDNATTID syscall.Errno = 8598 - ERROR_DS_AUTHORIZATION_FAILED syscall.Errno = 8599 - ERROR_DS_INVALID_SCRIPT syscall.Errno = 8600 - ERROR_DS_REMOTE_CROSSREF_OP_FAILED syscall.Errno = 8601 - ERROR_DS_CROSS_REF_BUSY syscall.Errno = 8602 - ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN syscall.Errno = 8603 - ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC syscall.Errno = 8604 - ERROR_DS_DUPLICATE_ID_FOUND syscall.Errno = 8605 - ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT syscall.Errno = 8606 - ERROR_DS_GROUP_CONVERSION_ERROR syscall.Errno = 8607 - ERROR_DS_CANT_MOVE_APP_BASIC_GROUP syscall.Errno = 8608 - ERROR_DS_CANT_MOVE_APP_QUERY_GROUP syscall.Errno = 8609 - ERROR_DS_ROLE_NOT_VERIFIED syscall.Errno = 8610 - ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL syscall.Errno = 8611 - ERROR_DS_DOMAIN_RENAME_IN_PROGRESS syscall.Errno = 8612 - ERROR_DS_EXISTING_AD_CHILD_NC syscall.Errno = 8613 - ERROR_DS_REPL_LIFETIME_EXCEEDED syscall.Errno = 8614 - ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER syscall.Errno = 8615 - ERROR_DS_LDAP_SEND_QUEUE_FULL syscall.Errno = 8616 - ERROR_DS_DRA_OUT_SCHEDULE_WINDOW syscall.Errno = 8617 - ERROR_DS_POLICY_NOT_KNOWN syscall.Errno = 8618 - ERROR_NO_SITE_SETTINGS_OBJECT syscall.Errno = 8619 - ERROR_NO_SECRETS syscall.Errno = 8620 - ERROR_NO_WRITABLE_DC_FOUND syscall.Errno = 8621 - ERROR_DS_NO_SERVER_OBJECT syscall.Errno = 8622 - ERROR_DS_NO_NTDSA_OBJECT syscall.Errno = 8623 - ERROR_DS_NON_ASQ_SEARCH syscall.Errno = 8624 - ERROR_DS_AUDIT_FAILURE syscall.Errno = 8625 - ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE syscall.Errno = 8626 - ERROR_DS_INVALID_SEARCH_FLAG_TUPLE syscall.Errno = 8627 - ERROR_DS_HIERARCHY_TABLE_TOO_DEEP syscall.Errno = 8628 - ERROR_DS_DRA_CORRUPT_UTD_VECTOR syscall.Errno = 8629 - ERROR_DS_DRA_SECRETS_DENIED syscall.Errno = 8630 - ERROR_DS_RESERVED_MAPI_ID syscall.Errno = 8631 - ERROR_DS_MAPI_ID_NOT_AVAILABLE syscall.Errno = 8632 - ERROR_DS_DRA_MISSING_KRBTGT_SECRET syscall.Errno = 8633 - ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST syscall.Errno = 8634 - ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST syscall.Errno = 8635 - ERROR_INVALID_USER_PRINCIPAL_NAME syscall.Errno = 8636 - ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS syscall.Errno = 8637 - ERROR_DS_OID_NOT_FOUND syscall.Errno = 8638 - ERROR_DS_DRA_RECYCLED_TARGET syscall.Errno = 8639 - ERROR_DS_DISALLOWED_NC_REDIRECT syscall.Errno = 8640 - ERROR_DS_HIGH_ADLDS_FFL syscall.Errno = 8641 - ERROR_DS_HIGH_DSA_VERSION syscall.Errno = 8642 - ERROR_DS_LOW_ADLDS_FFL syscall.Errno = 8643 - ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION syscall.Errno = 8644 - ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED syscall.Errno = 8645 - ERROR_INCORRECT_ACCOUNT_TYPE syscall.Errno = 8646 - ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8647 - ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8648 - ERROR_DS_MISSING_FOREST_TRUST syscall.Errno = 8649 - ERROR_DS_VALUE_KEY_NOT_UNIQUE syscall.Errno = 8650 - DNS_ERROR_RESPONSE_CODES_BASE syscall.Errno = 9000 - DNS_ERROR_RCODE_NO_ERROR = ERROR_SUCCESS - DNS_ERROR_MASK syscall.Errno = 0x00002328 - DNS_ERROR_RCODE_FORMAT_ERROR syscall.Errno = 9001 - DNS_ERROR_RCODE_SERVER_FAILURE syscall.Errno = 9002 - DNS_ERROR_RCODE_NAME_ERROR syscall.Errno = 9003 - DNS_ERROR_RCODE_NOT_IMPLEMENTED syscall.Errno = 9004 - DNS_ERROR_RCODE_REFUSED syscall.Errno = 9005 - DNS_ERROR_RCODE_YXDOMAIN syscall.Errno = 9006 - DNS_ERROR_RCODE_YXRRSET syscall.Errno = 9007 - DNS_ERROR_RCODE_NXRRSET syscall.Errno = 9008 - DNS_ERROR_RCODE_NOTAUTH syscall.Errno = 9009 - DNS_ERROR_RCODE_NOTZONE syscall.Errno = 9010 - DNS_ERROR_RCODE_BADSIG syscall.Errno = 9016 - DNS_ERROR_RCODE_BADKEY syscall.Errno = 9017 - DNS_ERROR_RCODE_BADTIME syscall.Errno = 9018 - DNS_ERROR_RCODE_LAST = DNS_ERROR_RCODE_BADTIME - DNS_ERROR_DNSSEC_BASE syscall.Errno = 9100 - DNS_ERROR_KEYMASTER_REQUIRED syscall.Errno = 9101 - DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE syscall.Errno = 9102 - DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 syscall.Errno = 9103 - DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS syscall.Errno = 9104 - DNS_ERROR_UNSUPPORTED_ALGORITHM syscall.Errno = 9105 - DNS_ERROR_INVALID_KEY_SIZE syscall.Errno = 9106 - DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE syscall.Errno = 9107 - DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION syscall.Errno = 9108 - DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR syscall.Errno = 9109 - DNS_ERROR_UNEXPECTED_CNG_ERROR syscall.Errno = 9110 - DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION syscall.Errno = 9111 - DNS_ERROR_KSP_NOT_ACCESSIBLE syscall.Errno = 9112 - DNS_ERROR_TOO_MANY_SKDS syscall.Errno = 9113 - DNS_ERROR_INVALID_ROLLOVER_PERIOD syscall.Errno = 9114 - DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET syscall.Errno = 9115 - DNS_ERROR_ROLLOVER_IN_PROGRESS syscall.Errno = 9116 - DNS_ERROR_STANDBY_KEY_NOT_PRESENT syscall.Errno = 9117 - DNS_ERROR_NOT_ALLOWED_ON_ZSK syscall.Errno = 9118 - DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD syscall.Errno = 9119 - DNS_ERROR_ROLLOVER_ALREADY_QUEUED syscall.Errno = 9120 - DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE syscall.Errno = 9121 - DNS_ERROR_BAD_KEYMASTER syscall.Errno = 9122 - DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD syscall.Errno = 9123 - DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT syscall.Errno = 9124 - DNS_ERROR_DNSSEC_IS_DISABLED syscall.Errno = 9125 - DNS_ERROR_INVALID_XML syscall.Errno = 9126 - DNS_ERROR_NO_VALID_TRUST_ANCHORS syscall.Errno = 9127 - DNS_ERROR_ROLLOVER_NOT_POKEABLE syscall.Errno = 9128 - DNS_ERROR_NSEC3_NAME_COLLISION syscall.Errno = 9129 - DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 syscall.Errno = 9130 - DNS_ERROR_PACKET_FMT_BASE syscall.Errno = 9500 - DNS_INFO_NO_RECORDS syscall.Errno = 9501 - DNS_ERROR_BAD_PACKET syscall.Errno = 9502 - DNS_ERROR_NO_PACKET syscall.Errno = 9503 - DNS_ERROR_RCODE syscall.Errno = 9504 - DNS_ERROR_UNSECURE_PACKET syscall.Errno = 9505 - DNS_STATUS_PACKET_UNSECURE = DNS_ERROR_UNSECURE_PACKET - DNS_REQUEST_PENDING syscall.Errno = 9506 - DNS_ERROR_NO_MEMORY = ERROR_OUTOFMEMORY - DNS_ERROR_INVALID_NAME = ERROR_INVALID_NAME - DNS_ERROR_INVALID_DATA = ERROR_INVALID_DATA - DNS_ERROR_GENERAL_API_BASE syscall.Errno = 9550 - DNS_ERROR_INVALID_TYPE syscall.Errno = 9551 - DNS_ERROR_INVALID_IP_ADDRESS syscall.Errno = 9552 - DNS_ERROR_INVALID_PROPERTY syscall.Errno = 9553 - DNS_ERROR_TRY_AGAIN_LATER syscall.Errno = 9554 - DNS_ERROR_NOT_UNIQUE syscall.Errno = 9555 - DNS_ERROR_NON_RFC_NAME syscall.Errno = 9556 - DNS_STATUS_FQDN syscall.Errno = 9557 - DNS_STATUS_DOTTED_NAME syscall.Errno = 9558 - DNS_STATUS_SINGLE_PART_NAME syscall.Errno = 9559 - DNS_ERROR_INVALID_NAME_CHAR syscall.Errno = 9560 - DNS_ERROR_NUMERIC_NAME syscall.Errno = 9561 - DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER syscall.Errno = 9562 - DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION syscall.Errno = 9563 - DNS_ERROR_CANNOT_FIND_ROOT_HINTS syscall.Errno = 9564 - DNS_ERROR_INCONSISTENT_ROOT_HINTS syscall.Errno = 9565 - DNS_ERROR_DWORD_VALUE_TOO_SMALL syscall.Errno = 9566 - DNS_ERROR_DWORD_VALUE_TOO_LARGE syscall.Errno = 9567 - DNS_ERROR_BACKGROUND_LOADING syscall.Errno = 9568 - DNS_ERROR_NOT_ALLOWED_ON_RODC syscall.Errno = 9569 - DNS_ERROR_NOT_ALLOWED_UNDER_DNAME syscall.Errno = 9570 - DNS_ERROR_DELEGATION_REQUIRED syscall.Errno = 9571 - DNS_ERROR_INVALID_POLICY_TABLE syscall.Errno = 9572 - DNS_ERROR_ADDRESS_REQUIRED syscall.Errno = 9573 - DNS_ERROR_ZONE_BASE syscall.Errno = 9600 - DNS_ERROR_ZONE_DOES_NOT_EXIST syscall.Errno = 9601 - DNS_ERROR_NO_ZONE_INFO syscall.Errno = 9602 - DNS_ERROR_INVALID_ZONE_OPERATION syscall.Errno = 9603 - DNS_ERROR_ZONE_CONFIGURATION_ERROR syscall.Errno = 9604 - DNS_ERROR_ZONE_HAS_NO_SOA_RECORD syscall.Errno = 9605 - DNS_ERROR_ZONE_HAS_NO_NS_RECORDS syscall.Errno = 9606 - DNS_ERROR_ZONE_LOCKED syscall.Errno = 9607 - DNS_ERROR_ZONE_CREATION_FAILED syscall.Errno = 9608 - DNS_ERROR_ZONE_ALREADY_EXISTS syscall.Errno = 9609 - DNS_ERROR_AUTOZONE_ALREADY_EXISTS syscall.Errno = 9610 - DNS_ERROR_INVALID_ZONE_TYPE syscall.Errno = 9611 - DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP syscall.Errno = 9612 - DNS_ERROR_ZONE_NOT_SECONDARY syscall.Errno = 9613 - DNS_ERROR_NEED_SECONDARY_ADDRESSES syscall.Errno = 9614 - DNS_ERROR_WINS_INIT_FAILED syscall.Errno = 9615 - DNS_ERROR_NEED_WINS_SERVERS syscall.Errno = 9616 - DNS_ERROR_NBSTAT_INIT_FAILED syscall.Errno = 9617 - DNS_ERROR_SOA_DELETE_INVALID syscall.Errno = 9618 - DNS_ERROR_FORWARDER_ALREADY_EXISTS syscall.Errno = 9619 - DNS_ERROR_ZONE_REQUIRES_MASTER_IP syscall.Errno = 9620 - DNS_ERROR_ZONE_IS_SHUTDOWN syscall.Errno = 9621 - DNS_ERROR_ZONE_LOCKED_FOR_SIGNING syscall.Errno = 9622 - DNS_ERROR_DATAFILE_BASE syscall.Errno = 9650 - DNS_ERROR_PRIMARY_REQUIRES_DATAFILE syscall.Errno = 9651 - DNS_ERROR_INVALID_DATAFILE_NAME syscall.Errno = 9652 - DNS_ERROR_DATAFILE_OPEN_FAILURE syscall.Errno = 9653 - DNS_ERROR_FILE_WRITEBACK_FAILED syscall.Errno = 9654 - DNS_ERROR_DATAFILE_PARSING syscall.Errno = 9655 - DNS_ERROR_DATABASE_BASE syscall.Errno = 9700 - DNS_ERROR_RECORD_DOES_NOT_EXIST syscall.Errno = 9701 - DNS_ERROR_RECORD_FORMAT syscall.Errno = 9702 - DNS_ERROR_NODE_CREATION_FAILED syscall.Errno = 9703 - DNS_ERROR_UNKNOWN_RECORD_TYPE syscall.Errno = 9704 - DNS_ERROR_RECORD_TIMED_OUT syscall.Errno = 9705 - DNS_ERROR_NAME_NOT_IN_ZONE syscall.Errno = 9706 - DNS_ERROR_CNAME_LOOP syscall.Errno = 9707 - DNS_ERROR_NODE_IS_CNAME syscall.Errno = 9708 - DNS_ERROR_CNAME_COLLISION syscall.Errno = 9709 - DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT syscall.Errno = 9710 - DNS_ERROR_RECORD_ALREADY_EXISTS syscall.Errno = 9711 - DNS_ERROR_SECONDARY_DATA syscall.Errno = 9712 - DNS_ERROR_NO_CREATE_CACHE_DATA syscall.Errno = 9713 - DNS_ERROR_NAME_DOES_NOT_EXIST syscall.Errno = 9714 - DNS_WARNING_PTR_CREATE_FAILED syscall.Errno = 9715 - DNS_WARNING_DOMAIN_UNDELETED syscall.Errno = 9716 - DNS_ERROR_DS_UNAVAILABLE syscall.Errno = 9717 - DNS_ERROR_DS_ZONE_ALREADY_EXISTS syscall.Errno = 9718 - DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE syscall.Errno = 9719 - DNS_ERROR_NODE_IS_DNAME syscall.Errno = 9720 - DNS_ERROR_DNAME_COLLISION syscall.Errno = 9721 - DNS_ERROR_ALIAS_LOOP syscall.Errno = 9722 - DNS_ERROR_OPERATION_BASE syscall.Errno = 9750 - DNS_INFO_AXFR_COMPLETE syscall.Errno = 9751 - DNS_ERROR_AXFR syscall.Errno = 9752 - DNS_INFO_ADDED_LOCAL_WINS syscall.Errno = 9753 - DNS_ERROR_SECURE_BASE syscall.Errno = 9800 - DNS_STATUS_CONTINUE_NEEDED syscall.Errno = 9801 - DNS_ERROR_SETUP_BASE syscall.Errno = 9850 - DNS_ERROR_NO_TCPIP syscall.Errno = 9851 - DNS_ERROR_NO_DNS_SERVERS syscall.Errno = 9852 - DNS_ERROR_DP_BASE syscall.Errno = 9900 - DNS_ERROR_DP_DOES_NOT_EXIST syscall.Errno = 9901 - DNS_ERROR_DP_ALREADY_EXISTS syscall.Errno = 9902 - DNS_ERROR_DP_NOT_ENLISTED syscall.Errno = 9903 - DNS_ERROR_DP_ALREADY_ENLISTED syscall.Errno = 9904 - DNS_ERROR_DP_NOT_AVAILABLE syscall.Errno = 9905 - DNS_ERROR_DP_FSMO_ERROR syscall.Errno = 9906 - DNS_ERROR_RRL_NOT_ENABLED syscall.Errno = 9911 - DNS_ERROR_RRL_INVALID_WINDOW_SIZE syscall.Errno = 9912 - DNS_ERROR_RRL_INVALID_IPV4_PREFIX syscall.Errno = 9913 - DNS_ERROR_RRL_INVALID_IPV6_PREFIX syscall.Errno = 9914 - DNS_ERROR_RRL_INVALID_TC_RATE syscall.Errno = 9915 - DNS_ERROR_RRL_INVALID_LEAK_RATE syscall.Errno = 9916 - DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE syscall.Errno = 9917 - DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS syscall.Errno = 9921 - DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST syscall.Errno = 9922 - DNS_ERROR_VIRTUALIZATION_TREE_LOCKED syscall.Errno = 9923 - DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME syscall.Errno = 9924 - DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE syscall.Errno = 9925 - DNS_ERROR_ZONESCOPE_ALREADY_EXISTS syscall.Errno = 9951 - DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST syscall.Errno = 9952 - DNS_ERROR_DEFAULT_ZONESCOPE syscall.Errno = 9953 - DNS_ERROR_INVALID_ZONESCOPE_NAME syscall.Errno = 9954 - DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES syscall.Errno = 9955 - DNS_ERROR_LOAD_ZONESCOPE_FAILED syscall.Errno = 9956 - DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED syscall.Errno = 9957 - DNS_ERROR_INVALID_SCOPE_NAME syscall.Errno = 9958 - DNS_ERROR_SCOPE_DOES_NOT_EXIST syscall.Errno = 9959 - DNS_ERROR_DEFAULT_SCOPE syscall.Errno = 9960 - DNS_ERROR_INVALID_SCOPE_OPERATION syscall.Errno = 9961 - DNS_ERROR_SCOPE_LOCKED syscall.Errno = 9962 - DNS_ERROR_SCOPE_ALREADY_EXISTS syscall.Errno = 9963 - DNS_ERROR_POLICY_ALREADY_EXISTS syscall.Errno = 9971 - DNS_ERROR_POLICY_DOES_NOT_EXIST syscall.Errno = 9972 - DNS_ERROR_POLICY_INVALID_CRITERIA syscall.Errno = 9973 - DNS_ERROR_POLICY_INVALID_SETTINGS syscall.Errno = 9974 - DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED syscall.Errno = 9975 - DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST syscall.Errno = 9976 - DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS syscall.Errno = 9977 - DNS_ERROR_SUBNET_DOES_NOT_EXIST syscall.Errno = 9978 - DNS_ERROR_SUBNET_ALREADY_EXISTS syscall.Errno = 9979 - DNS_ERROR_POLICY_LOCKED syscall.Errno = 9980 - DNS_ERROR_POLICY_INVALID_WEIGHT syscall.Errno = 9981 - DNS_ERROR_POLICY_INVALID_NAME syscall.Errno = 9982 - DNS_ERROR_POLICY_MISSING_CRITERIA syscall.Errno = 9983 - DNS_ERROR_INVALID_CLIENT_SUBNET_NAME syscall.Errno = 9984 - DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID syscall.Errno = 9985 - DNS_ERROR_POLICY_SCOPE_MISSING syscall.Errno = 9986 - DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED syscall.Errno = 9987 - DNS_ERROR_SERVERSCOPE_IS_REFERENCED syscall.Errno = 9988 - DNS_ERROR_ZONESCOPE_IS_REFERENCED syscall.Errno = 9989 - DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET syscall.Errno = 9990 - DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL syscall.Errno = 9991 - DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL syscall.Errno = 9992 - DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE syscall.Errno = 9993 - DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN syscall.Errno = 9994 - DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE syscall.Errno = 9995 - DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY syscall.Errno = 9996 - WSABASEERR syscall.Errno = 10000 - WSAEINTR syscall.Errno = 10004 - WSAEBADF syscall.Errno = 10009 - WSAEACCES syscall.Errno = 10013 - WSAEFAULT syscall.Errno = 10014 - WSAEINVAL syscall.Errno = 10022 - WSAEMFILE syscall.Errno = 10024 - WSAEWOULDBLOCK syscall.Errno = 10035 - WSAEINPROGRESS syscall.Errno = 10036 - WSAEALREADY syscall.Errno = 10037 - WSAENOTSOCK syscall.Errno = 10038 - WSAEDESTADDRREQ syscall.Errno = 10039 - WSAEMSGSIZE syscall.Errno = 10040 - WSAEPROTOTYPE syscall.Errno = 10041 - WSAENOPROTOOPT syscall.Errno = 10042 - WSAEPROTONOSUPPORT syscall.Errno = 10043 - WSAESOCKTNOSUPPORT syscall.Errno = 10044 - WSAEOPNOTSUPP syscall.Errno = 10045 - WSAEPFNOSUPPORT syscall.Errno = 10046 - WSAEAFNOSUPPORT syscall.Errno = 10047 - WSAEADDRINUSE syscall.Errno = 10048 - WSAEADDRNOTAVAIL syscall.Errno = 10049 - WSAENETDOWN syscall.Errno = 10050 - WSAENETUNREACH syscall.Errno = 10051 - WSAENETRESET syscall.Errno = 10052 - WSAECONNABORTED syscall.Errno = 10053 - WSAECONNRESET syscall.Errno = 10054 - WSAENOBUFS syscall.Errno = 10055 - WSAEISCONN syscall.Errno = 10056 - WSAENOTCONN syscall.Errno = 10057 - WSAESHUTDOWN syscall.Errno = 10058 - WSAETOOMANYREFS syscall.Errno = 10059 - WSAETIMEDOUT syscall.Errno = 10060 - WSAECONNREFUSED syscall.Errno = 10061 - WSAELOOP syscall.Errno = 10062 - WSAENAMETOOLONG syscall.Errno = 10063 - WSAEHOSTDOWN syscall.Errno = 10064 - WSAEHOSTUNREACH syscall.Errno = 10065 - WSAENOTEMPTY syscall.Errno = 10066 - WSAEPROCLIM syscall.Errno = 10067 - WSAEUSERS syscall.Errno = 10068 - WSAEDQUOT syscall.Errno = 10069 - WSAESTALE syscall.Errno = 10070 - WSAEREMOTE syscall.Errno = 10071 - WSASYSNOTREADY syscall.Errno = 10091 - WSAVERNOTSUPPORTED syscall.Errno = 10092 - WSANOTINITIALISED syscall.Errno = 10093 - WSAEDISCON syscall.Errno = 10101 - WSAENOMORE syscall.Errno = 10102 - WSAECANCELLED syscall.Errno = 10103 - WSAEINVALIDPROCTABLE syscall.Errno = 10104 - WSAEINVALIDPROVIDER syscall.Errno = 10105 - WSAEPROVIDERFAILEDINIT syscall.Errno = 10106 - WSASYSCALLFAILURE syscall.Errno = 10107 - WSASERVICE_NOT_FOUND syscall.Errno = 10108 - WSATYPE_NOT_FOUND syscall.Errno = 10109 - WSA_E_NO_MORE syscall.Errno = 10110 - WSA_E_CANCELLED syscall.Errno = 10111 - WSAEREFUSED syscall.Errno = 10112 - WSAHOST_NOT_FOUND syscall.Errno = 11001 - WSATRY_AGAIN syscall.Errno = 11002 - WSANO_RECOVERY syscall.Errno = 11003 - WSANO_DATA syscall.Errno = 11004 - WSA_QOS_RECEIVERS syscall.Errno = 11005 - WSA_QOS_SENDERS syscall.Errno = 11006 - WSA_QOS_NO_SENDERS syscall.Errno = 11007 - WSA_QOS_NO_RECEIVERS syscall.Errno = 11008 - WSA_QOS_REQUEST_CONFIRMED syscall.Errno = 11009 - WSA_QOS_ADMISSION_FAILURE syscall.Errno = 11010 - WSA_QOS_POLICY_FAILURE syscall.Errno = 11011 - WSA_QOS_BAD_STYLE syscall.Errno = 11012 - WSA_QOS_BAD_OBJECT syscall.Errno = 11013 - WSA_QOS_TRAFFIC_CTRL_ERROR syscall.Errno = 11014 - WSA_QOS_GENERIC_ERROR syscall.Errno = 11015 - WSA_QOS_ESERVICETYPE syscall.Errno = 11016 - WSA_QOS_EFLOWSPEC syscall.Errno = 11017 - WSA_QOS_EPROVSPECBUF syscall.Errno = 11018 - WSA_QOS_EFILTERSTYLE syscall.Errno = 11019 - WSA_QOS_EFILTERTYPE syscall.Errno = 11020 - WSA_QOS_EFILTERCOUNT syscall.Errno = 11021 - WSA_QOS_EOBJLENGTH syscall.Errno = 11022 - WSA_QOS_EFLOWCOUNT syscall.Errno = 11023 - WSA_QOS_EUNKOWNPSOBJ syscall.Errno = 11024 - WSA_QOS_EPOLICYOBJ syscall.Errno = 11025 - WSA_QOS_EFLOWDESC syscall.Errno = 11026 - WSA_QOS_EPSFLOWSPEC syscall.Errno = 11027 - WSA_QOS_EPSFILTERSPEC syscall.Errno = 11028 - WSA_QOS_ESDMODEOBJ syscall.Errno = 11029 - WSA_QOS_ESHAPERATEOBJ syscall.Errno = 11030 - WSA_QOS_RESERVED_PETYPE syscall.Errno = 11031 - WSA_SECURE_HOST_NOT_FOUND syscall.Errno = 11032 - WSA_IPSEC_NAME_POLICY_ERROR syscall.Errno = 11033 - ERROR_IPSEC_QM_POLICY_EXISTS syscall.Errno = 13000 - ERROR_IPSEC_QM_POLICY_NOT_FOUND syscall.Errno = 13001 - ERROR_IPSEC_QM_POLICY_IN_USE syscall.Errno = 13002 - ERROR_IPSEC_MM_POLICY_EXISTS syscall.Errno = 13003 - ERROR_IPSEC_MM_POLICY_NOT_FOUND syscall.Errno = 13004 - ERROR_IPSEC_MM_POLICY_IN_USE syscall.Errno = 13005 - ERROR_IPSEC_MM_FILTER_EXISTS syscall.Errno = 13006 - ERROR_IPSEC_MM_FILTER_NOT_FOUND syscall.Errno = 13007 - ERROR_IPSEC_TRANSPORT_FILTER_EXISTS syscall.Errno = 13008 - ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND syscall.Errno = 13009 - ERROR_IPSEC_MM_AUTH_EXISTS syscall.Errno = 13010 - ERROR_IPSEC_MM_AUTH_NOT_FOUND syscall.Errno = 13011 - ERROR_IPSEC_MM_AUTH_IN_USE syscall.Errno = 13012 - ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND syscall.Errno = 13013 - ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND syscall.Errno = 13014 - ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND syscall.Errno = 13015 - ERROR_IPSEC_TUNNEL_FILTER_EXISTS syscall.Errno = 13016 - ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND syscall.Errno = 13017 - ERROR_IPSEC_MM_FILTER_PENDING_DELETION syscall.Errno = 13018 - ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION syscall.Errno = 13019 - ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION syscall.Errno = 13020 - ERROR_IPSEC_MM_POLICY_PENDING_DELETION syscall.Errno = 13021 - ERROR_IPSEC_MM_AUTH_PENDING_DELETION syscall.Errno = 13022 - ERROR_IPSEC_QM_POLICY_PENDING_DELETION syscall.Errno = 13023 - WARNING_IPSEC_MM_POLICY_PRUNED syscall.Errno = 13024 - WARNING_IPSEC_QM_POLICY_PRUNED syscall.Errno = 13025 - ERROR_IPSEC_IKE_NEG_STATUS_BEGIN syscall.Errno = 13800 - ERROR_IPSEC_IKE_AUTH_FAIL syscall.Errno = 13801 - ERROR_IPSEC_IKE_ATTRIB_FAIL syscall.Errno = 13802 - ERROR_IPSEC_IKE_NEGOTIATION_PENDING syscall.Errno = 13803 - ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR syscall.Errno = 13804 - ERROR_IPSEC_IKE_TIMED_OUT syscall.Errno = 13805 - ERROR_IPSEC_IKE_NO_CERT syscall.Errno = 13806 - ERROR_IPSEC_IKE_SA_DELETED syscall.Errno = 13807 - ERROR_IPSEC_IKE_SA_REAPED syscall.Errno = 13808 - ERROR_IPSEC_IKE_MM_ACQUIRE_DROP syscall.Errno = 13809 - ERROR_IPSEC_IKE_QM_ACQUIRE_DROP syscall.Errno = 13810 - ERROR_IPSEC_IKE_QUEUE_DROP_MM syscall.Errno = 13811 - ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM syscall.Errno = 13812 - ERROR_IPSEC_IKE_DROP_NO_RESPONSE syscall.Errno = 13813 - ERROR_IPSEC_IKE_MM_DELAY_DROP syscall.Errno = 13814 - ERROR_IPSEC_IKE_QM_DELAY_DROP syscall.Errno = 13815 - ERROR_IPSEC_IKE_ERROR syscall.Errno = 13816 - ERROR_IPSEC_IKE_CRL_FAILED syscall.Errno = 13817 - ERROR_IPSEC_IKE_INVALID_KEY_USAGE syscall.Errno = 13818 - ERROR_IPSEC_IKE_INVALID_CERT_TYPE syscall.Errno = 13819 - ERROR_IPSEC_IKE_NO_PRIVATE_KEY syscall.Errno = 13820 - ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY syscall.Errno = 13821 - ERROR_IPSEC_IKE_DH_FAIL syscall.Errno = 13822 - ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED syscall.Errno = 13823 - ERROR_IPSEC_IKE_INVALID_HEADER syscall.Errno = 13824 - ERROR_IPSEC_IKE_NO_POLICY syscall.Errno = 13825 - ERROR_IPSEC_IKE_INVALID_SIGNATURE syscall.Errno = 13826 - ERROR_IPSEC_IKE_KERBEROS_ERROR syscall.Errno = 13827 - ERROR_IPSEC_IKE_NO_PUBLIC_KEY syscall.Errno = 13828 - ERROR_IPSEC_IKE_PROCESS_ERR syscall.Errno = 13829 - ERROR_IPSEC_IKE_PROCESS_ERR_SA syscall.Errno = 13830 - ERROR_IPSEC_IKE_PROCESS_ERR_PROP syscall.Errno = 13831 - ERROR_IPSEC_IKE_PROCESS_ERR_TRANS syscall.Errno = 13832 - ERROR_IPSEC_IKE_PROCESS_ERR_KE syscall.Errno = 13833 - ERROR_IPSEC_IKE_PROCESS_ERR_ID syscall.Errno = 13834 - ERROR_IPSEC_IKE_PROCESS_ERR_CERT syscall.Errno = 13835 - ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ syscall.Errno = 13836 - ERROR_IPSEC_IKE_PROCESS_ERR_HASH syscall.Errno = 13837 - ERROR_IPSEC_IKE_PROCESS_ERR_SIG syscall.Errno = 13838 - ERROR_IPSEC_IKE_PROCESS_ERR_NONCE syscall.Errno = 13839 - ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY syscall.Errno = 13840 - ERROR_IPSEC_IKE_PROCESS_ERR_DELETE syscall.Errno = 13841 - ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR syscall.Errno = 13842 - ERROR_IPSEC_IKE_INVALID_PAYLOAD syscall.Errno = 13843 - ERROR_IPSEC_IKE_LOAD_SOFT_SA syscall.Errno = 13844 - ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN syscall.Errno = 13845 - ERROR_IPSEC_IKE_INVALID_COOKIE syscall.Errno = 13846 - ERROR_IPSEC_IKE_NO_PEER_CERT syscall.Errno = 13847 - ERROR_IPSEC_IKE_PEER_CRL_FAILED syscall.Errno = 13848 - ERROR_IPSEC_IKE_POLICY_CHANGE syscall.Errno = 13849 - ERROR_IPSEC_IKE_NO_MM_POLICY syscall.Errno = 13850 - ERROR_IPSEC_IKE_NOTCBPRIV syscall.Errno = 13851 - ERROR_IPSEC_IKE_SECLOADFAIL syscall.Errno = 13852 - ERROR_IPSEC_IKE_FAILSSPINIT syscall.Errno = 13853 - ERROR_IPSEC_IKE_FAILQUERYSSP syscall.Errno = 13854 - ERROR_IPSEC_IKE_SRVACQFAIL syscall.Errno = 13855 - ERROR_IPSEC_IKE_SRVQUERYCRED syscall.Errno = 13856 - ERROR_IPSEC_IKE_GETSPIFAIL syscall.Errno = 13857 - ERROR_IPSEC_IKE_INVALID_FILTER syscall.Errno = 13858 - ERROR_IPSEC_IKE_OUT_OF_MEMORY syscall.Errno = 13859 - ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED syscall.Errno = 13860 - ERROR_IPSEC_IKE_INVALID_POLICY syscall.Errno = 13861 - ERROR_IPSEC_IKE_UNKNOWN_DOI syscall.Errno = 13862 - ERROR_IPSEC_IKE_INVALID_SITUATION syscall.Errno = 13863 - ERROR_IPSEC_IKE_DH_FAILURE syscall.Errno = 13864 - ERROR_IPSEC_IKE_INVALID_GROUP syscall.Errno = 13865 - ERROR_IPSEC_IKE_ENCRYPT syscall.Errno = 13866 - ERROR_IPSEC_IKE_DECRYPT syscall.Errno = 13867 - ERROR_IPSEC_IKE_POLICY_MATCH syscall.Errno = 13868 - ERROR_IPSEC_IKE_UNSUPPORTED_ID syscall.Errno = 13869 - ERROR_IPSEC_IKE_INVALID_HASH syscall.Errno = 13870 - ERROR_IPSEC_IKE_INVALID_HASH_ALG syscall.Errno = 13871 - ERROR_IPSEC_IKE_INVALID_HASH_SIZE syscall.Errno = 13872 - ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG syscall.Errno = 13873 - ERROR_IPSEC_IKE_INVALID_AUTH_ALG syscall.Errno = 13874 - ERROR_IPSEC_IKE_INVALID_SIG syscall.Errno = 13875 - ERROR_IPSEC_IKE_LOAD_FAILED syscall.Errno = 13876 - ERROR_IPSEC_IKE_RPC_DELETE syscall.Errno = 13877 - ERROR_IPSEC_IKE_BENIGN_REINIT syscall.Errno = 13878 - ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY syscall.Errno = 13879 - ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION syscall.Errno = 13880 - ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN syscall.Errno = 13881 - ERROR_IPSEC_IKE_MM_LIMIT syscall.Errno = 13882 - ERROR_IPSEC_IKE_NEGOTIATION_DISABLED syscall.Errno = 13883 - ERROR_IPSEC_IKE_QM_LIMIT syscall.Errno = 13884 - ERROR_IPSEC_IKE_MM_EXPIRED syscall.Errno = 13885 - ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID syscall.Errno = 13886 - ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH syscall.Errno = 13887 - ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID syscall.Errno = 13888 - ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD syscall.Errno = 13889 - ERROR_IPSEC_IKE_DOS_COOKIE_SENT syscall.Errno = 13890 - ERROR_IPSEC_IKE_SHUTTING_DOWN syscall.Errno = 13891 - ERROR_IPSEC_IKE_CGA_AUTH_FAILED syscall.Errno = 13892 - ERROR_IPSEC_IKE_PROCESS_ERR_NATOA syscall.Errno = 13893 - ERROR_IPSEC_IKE_INVALID_MM_FOR_QM syscall.Errno = 13894 - ERROR_IPSEC_IKE_QM_EXPIRED syscall.Errno = 13895 - ERROR_IPSEC_IKE_TOO_MANY_FILTERS syscall.Errno = 13896 - ERROR_IPSEC_IKE_NEG_STATUS_END syscall.Errno = 13897 - ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL syscall.Errno = 13898 - ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE syscall.Errno = 13899 - ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING syscall.Errno = 13900 - ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING syscall.Errno = 13901 - ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS syscall.Errno = 13902 - ERROR_IPSEC_IKE_RATELIMIT_DROP syscall.Errno = 13903 - ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE syscall.Errno = 13904 - ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE syscall.Errno = 13905 - ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE syscall.Errno = 13906 - ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY syscall.Errno = 13907 - ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE syscall.Errno = 13908 - ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END syscall.Errno = 13909 - ERROR_IPSEC_BAD_SPI syscall.Errno = 13910 - ERROR_IPSEC_SA_LIFETIME_EXPIRED syscall.Errno = 13911 - ERROR_IPSEC_WRONG_SA syscall.Errno = 13912 - ERROR_IPSEC_REPLAY_CHECK_FAILED syscall.Errno = 13913 - ERROR_IPSEC_INVALID_PACKET syscall.Errno = 13914 - ERROR_IPSEC_INTEGRITY_CHECK_FAILED syscall.Errno = 13915 - ERROR_IPSEC_CLEAR_TEXT_DROP syscall.Errno = 13916 - ERROR_IPSEC_AUTH_FIREWALL_DROP syscall.Errno = 13917 - ERROR_IPSEC_THROTTLE_DROP syscall.Errno = 13918 - ERROR_IPSEC_DOSP_BLOCK syscall.Errno = 13925 - ERROR_IPSEC_DOSP_RECEIVED_MULTICAST syscall.Errno = 13926 - ERROR_IPSEC_DOSP_INVALID_PACKET syscall.Errno = 13927 - ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED syscall.Errno = 13928 - ERROR_IPSEC_DOSP_MAX_ENTRIES syscall.Errno = 13929 - ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED syscall.Errno = 13930 - ERROR_IPSEC_DOSP_NOT_INSTALLED syscall.Errno = 13931 - ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES syscall.Errno = 13932 - ERROR_SXS_SECTION_NOT_FOUND syscall.Errno = 14000 - ERROR_SXS_CANT_GEN_ACTCTX syscall.Errno = 14001 - ERROR_SXS_INVALID_ACTCTXDATA_FORMAT syscall.Errno = 14002 - ERROR_SXS_ASSEMBLY_NOT_FOUND syscall.Errno = 14003 - ERROR_SXS_MANIFEST_FORMAT_ERROR syscall.Errno = 14004 - ERROR_SXS_MANIFEST_PARSE_ERROR syscall.Errno = 14005 - ERROR_SXS_ACTIVATION_CONTEXT_DISABLED syscall.Errno = 14006 - ERROR_SXS_KEY_NOT_FOUND syscall.Errno = 14007 - ERROR_SXS_VERSION_CONFLICT syscall.Errno = 14008 - ERROR_SXS_WRONG_SECTION_TYPE syscall.Errno = 14009 - ERROR_SXS_THREAD_QUERIES_DISABLED syscall.Errno = 14010 - ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET syscall.Errno = 14011 - ERROR_SXS_UNKNOWN_ENCODING_GROUP syscall.Errno = 14012 - ERROR_SXS_UNKNOWN_ENCODING syscall.Errno = 14013 - ERROR_SXS_INVALID_XML_NAMESPACE_URI syscall.Errno = 14014 - ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14015 - ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14016 - ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14017 - ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14018 - ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14019 - ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT syscall.Errno = 14020 - ERROR_SXS_DUPLICATE_DLL_NAME syscall.Errno = 14021 - ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME syscall.Errno = 14022 - ERROR_SXS_DUPLICATE_CLSID syscall.Errno = 14023 - ERROR_SXS_DUPLICATE_IID syscall.Errno = 14024 - ERROR_SXS_DUPLICATE_TLBID syscall.Errno = 14025 - ERROR_SXS_DUPLICATE_PROGID syscall.Errno = 14026 - ERROR_SXS_DUPLICATE_ASSEMBLY_NAME syscall.Errno = 14027 - ERROR_SXS_FILE_HASH_MISMATCH syscall.Errno = 14028 - ERROR_SXS_POLICY_PARSE_ERROR syscall.Errno = 14029 - ERROR_SXS_XML_E_MISSINGQUOTE syscall.Errno = 14030 - ERROR_SXS_XML_E_COMMENTSYNTAX syscall.Errno = 14031 - ERROR_SXS_XML_E_BADSTARTNAMECHAR syscall.Errno = 14032 - ERROR_SXS_XML_E_BADNAMECHAR syscall.Errno = 14033 - ERROR_SXS_XML_E_BADCHARINSTRING syscall.Errno = 14034 - ERROR_SXS_XML_E_XMLDECLSYNTAX syscall.Errno = 14035 - ERROR_SXS_XML_E_BADCHARDATA syscall.Errno = 14036 - ERROR_SXS_XML_E_MISSINGWHITESPACE syscall.Errno = 14037 - ERROR_SXS_XML_E_EXPECTINGTAGEND syscall.Errno = 14038 - ERROR_SXS_XML_E_MISSINGSEMICOLON syscall.Errno = 14039 - ERROR_SXS_XML_E_UNBALANCEDPAREN syscall.Errno = 14040 - ERROR_SXS_XML_E_INTERNALERROR syscall.Errno = 14041 - ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE syscall.Errno = 14042 - ERROR_SXS_XML_E_INCOMPLETE_ENCODING syscall.Errno = 14043 - ERROR_SXS_XML_E_MISSING_PAREN syscall.Errno = 14044 - ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE syscall.Errno = 14045 - ERROR_SXS_XML_E_MULTIPLE_COLONS syscall.Errno = 14046 - ERROR_SXS_XML_E_INVALID_DECIMAL syscall.Errno = 14047 - ERROR_SXS_XML_E_INVALID_HEXIDECIMAL syscall.Errno = 14048 - ERROR_SXS_XML_E_INVALID_UNICODE syscall.Errno = 14049 - ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK syscall.Errno = 14050 - ERROR_SXS_XML_E_UNEXPECTEDENDTAG syscall.Errno = 14051 - ERROR_SXS_XML_E_UNCLOSEDTAG syscall.Errno = 14052 - ERROR_SXS_XML_E_DUPLICATEATTRIBUTE syscall.Errno = 14053 - ERROR_SXS_XML_E_MULTIPLEROOTS syscall.Errno = 14054 - ERROR_SXS_XML_E_INVALIDATROOTLEVEL syscall.Errno = 14055 - ERROR_SXS_XML_E_BADXMLDECL syscall.Errno = 14056 - ERROR_SXS_XML_E_MISSINGROOT syscall.Errno = 14057 - ERROR_SXS_XML_E_UNEXPECTEDEOF syscall.Errno = 14058 - ERROR_SXS_XML_E_BADPEREFINSUBSET syscall.Errno = 14059 - ERROR_SXS_XML_E_UNCLOSEDSTARTTAG syscall.Errno = 14060 - ERROR_SXS_XML_E_UNCLOSEDENDTAG syscall.Errno = 14061 - ERROR_SXS_XML_E_UNCLOSEDSTRING syscall.Errno = 14062 - ERROR_SXS_XML_E_UNCLOSEDCOMMENT syscall.Errno = 14063 - ERROR_SXS_XML_E_UNCLOSEDDECL syscall.Errno = 14064 - ERROR_SXS_XML_E_UNCLOSEDCDATA syscall.Errno = 14065 - ERROR_SXS_XML_E_RESERVEDNAMESPACE syscall.Errno = 14066 - ERROR_SXS_XML_E_INVALIDENCODING syscall.Errno = 14067 - ERROR_SXS_XML_E_INVALIDSWITCH syscall.Errno = 14068 - ERROR_SXS_XML_E_BADXMLCASE syscall.Errno = 14069 - ERROR_SXS_XML_E_INVALID_STANDALONE syscall.Errno = 14070 - ERROR_SXS_XML_E_UNEXPECTED_STANDALONE syscall.Errno = 14071 - ERROR_SXS_XML_E_INVALID_VERSION syscall.Errno = 14072 - ERROR_SXS_XML_E_MISSINGEQUALS syscall.Errno = 14073 - ERROR_SXS_PROTECTION_RECOVERY_FAILED syscall.Errno = 14074 - ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT syscall.Errno = 14075 - ERROR_SXS_PROTECTION_CATALOG_NOT_VALID syscall.Errno = 14076 - ERROR_SXS_UNTRANSLATABLE_HRESULT syscall.Errno = 14077 - ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING syscall.Errno = 14078 - ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14079 - ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14080 - ERROR_SXS_ASSEMBLY_MISSING syscall.Errno = 14081 - ERROR_SXS_CORRUPT_ACTIVATION_STACK syscall.Errno = 14082 - ERROR_SXS_CORRUPTION syscall.Errno = 14083 - ERROR_SXS_EARLY_DEACTIVATION syscall.Errno = 14084 - ERROR_SXS_INVALID_DEACTIVATION syscall.Errno = 14085 - ERROR_SXS_MULTIPLE_DEACTIVATION syscall.Errno = 14086 - ERROR_SXS_PROCESS_TERMINATION_REQUESTED syscall.Errno = 14087 - ERROR_SXS_RELEASE_ACTIVATION_CONTEXT syscall.Errno = 14088 - ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY syscall.Errno = 14089 - ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE syscall.Errno = 14090 - ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14091 - ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE syscall.Errno = 14092 - ERROR_SXS_IDENTITY_PARSE_ERROR syscall.Errno = 14093 - ERROR_MALFORMED_SUBSTITUTION_STRING syscall.Errno = 14094 - ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN syscall.Errno = 14095 - ERROR_UNMAPPED_SUBSTITUTION_STRING syscall.Errno = 14096 - ERROR_SXS_ASSEMBLY_NOT_LOCKED syscall.Errno = 14097 - ERROR_SXS_COMPONENT_STORE_CORRUPT syscall.Errno = 14098 - ERROR_ADVANCED_INSTALLER_FAILED syscall.Errno = 14099 - ERROR_XML_ENCODING_MISMATCH syscall.Errno = 14100 - ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT syscall.Errno = 14101 - ERROR_SXS_IDENTITIES_DIFFERENT syscall.Errno = 14102 - ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT syscall.Errno = 14103 - ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY syscall.Errno = 14104 - ERROR_SXS_MANIFEST_TOO_BIG syscall.Errno = 14105 - ERROR_SXS_SETTING_NOT_REGISTERED syscall.Errno = 14106 - ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE syscall.Errno = 14107 - ERROR_SMI_PRIMITIVE_INSTALLER_FAILED syscall.Errno = 14108 - ERROR_GENERIC_COMMAND_FAILED syscall.Errno = 14109 - ERROR_SXS_FILE_HASH_MISSING syscall.Errno = 14110 - ERROR_EVT_INVALID_CHANNEL_PATH syscall.Errno = 15000 - ERROR_EVT_INVALID_QUERY syscall.Errno = 15001 - ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND syscall.Errno = 15002 - ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND syscall.Errno = 15003 - ERROR_EVT_INVALID_PUBLISHER_NAME syscall.Errno = 15004 - ERROR_EVT_INVALID_EVENT_DATA syscall.Errno = 15005 - ERROR_EVT_CHANNEL_NOT_FOUND syscall.Errno = 15007 - ERROR_EVT_MALFORMED_XML_TEXT syscall.Errno = 15008 - ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL syscall.Errno = 15009 - ERROR_EVT_CONFIGURATION_ERROR syscall.Errno = 15010 - ERROR_EVT_QUERY_RESULT_STALE syscall.Errno = 15011 - ERROR_EVT_QUERY_RESULT_INVALID_POSITION syscall.Errno = 15012 - ERROR_EVT_NON_VALIDATING_MSXML syscall.Errno = 15013 - ERROR_EVT_FILTER_ALREADYSCOPED syscall.Errno = 15014 - ERROR_EVT_FILTER_NOTELTSET syscall.Errno = 15015 - ERROR_EVT_FILTER_INVARG syscall.Errno = 15016 - ERROR_EVT_FILTER_INVTEST syscall.Errno = 15017 - ERROR_EVT_FILTER_INVTYPE syscall.Errno = 15018 - ERROR_EVT_FILTER_PARSEERR syscall.Errno = 15019 - ERROR_EVT_FILTER_UNSUPPORTEDOP syscall.Errno = 15020 - ERROR_EVT_FILTER_UNEXPECTEDTOKEN syscall.Errno = 15021 - ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL syscall.Errno = 15022 - ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE syscall.Errno = 15023 - ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE syscall.Errno = 15024 - ERROR_EVT_CHANNEL_CANNOT_ACTIVATE syscall.Errno = 15025 - ERROR_EVT_FILTER_TOO_COMPLEX syscall.Errno = 15026 - ERROR_EVT_MESSAGE_NOT_FOUND syscall.Errno = 15027 - ERROR_EVT_MESSAGE_ID_NOT_FOUND syscall.Errno = 15028 - ERROR_EVT_UNRESOLVED_VALUE_INSERT syscall.Errno = 15029 - ERROR_EVT_UNRESOLVED_PARAMETER_INSERT syscall.Errno = 15030 - ERROR_EVT_MAX_INSERTS_REACHED syscall.Errno = 15031 - ERROR_EVT_EVENT_DEFINITION_NOT_FOUND syscall.Errno = 15032 - ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND syscall.Errno = 15033 - ERROR_EVT_VERSION_TOO_OLD syscall.Errno = 15034 - ERROR_EVT_VERSION_TOO_NEW syscall.Errno = 15035 - ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY syscall.Errno = 15036 - ERROR_EVT_PUBLISHER_DISABLED syscall.Errno = 15037 - ERROR_EVT_FILTER_OUT_OF_RANGE syscall.Errno = 15038 - ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE syscall.Errno = 15080 - ERROR_EC_LOG_DISABLED syscall.Errno = 15081 - ERROR_EC_CIRCULAR_FORWARDING syscall.Errno = 15082 - ERROR_EC_CREDSTORE_FULL syscall.Errno = 15083 - ERROR_EC_CRED_NOT_FOUND syscall.Errno = 15084 - ERROR_EC_NO_ACTIVE_CHANNEL syscall.Errno = 15085 - ERROR_MUI_FILE_NOT_FOUND syscall.Errno = 15100 - ERROR_MUI_INVALID_FILE syscall.Errno = 15101 - ERROR_MUI_INVALID_RC_CONFIG syscall.Errno = 15102 - ERROR_MUI_INVALID_LOCALE_NAME syscall.Errno = 15103 - ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME syscall.Errno = 15104 - ERROR_MUI_FILE_NOT_LOADED syscall.Errno = 15105 - ERROR_RESOURCE_ENUM_USER_STOP syscall.Errno = 15106 - ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED syscall.Errno = 15107 - ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME syscall.Errno = 15108 - ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE syscall.Errno = 15110 - ERROR_MRM_INVALID_PRICONFIG syscall.Errno = 15111 - ERROR_MRM_INVALID_FILE_TYPE syscall.Errno = 15112 - ERROR_MRM_UNKNOWN_QUALIFIER syscall.Errno = 15113 - ERROR_MRM_INVALID_QUALIFIER_VALUE syscall.Errno = 15114 - ERROR_MRM_NO_CANDIDATE syscall.Errno = 15115 - ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE syscall.Errno = 15116 - ERROR_MRM_RESOURCE_TYPE_MISMATCH syscall.Errno = 15117 - ERROR_MRM_DUPLICATE_MAP_NAME syscall.Errno = 15118 - ERROR_MRM_DUPLICATE_ENTRY syscall.Errno = 15119 - ERROR_MRM_INVALID_RESOURCE_IDENTIFIER syscall.Errno = 15120 - ERROR_MRM_FILEPATH_TOO_LONG syscall.Errno = 15121 - ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE syscall.Errno = 15122 - ERROR_MRM_INVALID_PRI_FILE syscall.Errno = 15126 - ERROR_MRM_NAMED_RESOURCE_NOT_FOUND syscall.Errno = 15127 - ERROR_MRM_MAP_NOT_FOUND syscall.Errno = 15135 - ERROR_MRM_UNSUPPORTED_PROFILE_TYPE syscall.Errno = 15136 - ERROR_MRM_INVALID_QUALIFIER_OPERATOR syscall.Errno = 15137 - ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE syscall.Errno = 15138 - ERROR_MRM_AUTOMERGE_ENABLED syscall.Errno = 15139 - ERROR_MRM_TOO_MANY_RESOURCES syscall.Errno = 15140 - ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE syscall.Errno = 15141 - ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE syscall.Errno = 15142 - ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD syscall.Errno = 15143 - ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST syscall.Errno = 15144 - ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT syscall.Errno = 15145 - ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE syscall.Errno = 15146 - ERROR_MRM_GENERATION_COUNT_MISMATCH syscall.Errno = 15147 - ERROR_PRI_MERGE_VERSION_MISMATCH syscall.Errno = 15148 - ERROR_PRI_MERGE_MISSING_SCHEMA syscall.Errno = 15149 - ERROR_PRI_MERGE_LOAD_FILE_FAILED syscall.Errno = 15150 - ERROR_PRI_MERGE_ADD_FILE_FAILED syscall.Errno = 15151 - ERROR_PRI_MERGE_WRITE_FILE_FAILED syscall.Errno = 15152 - ERROR_PRI_MERGE_MULTIPLE_PACKAGE_FAMILIES_NOT_ALLOWED syscall.Errno = 15153 - ERROR_PRI_MERGE_MULTIPLE_MAIN_PACKAGES_NOT_ALLOWED syscall.Errno = 15154 - ERROR_PRI_MERGE_BUNDLE_PACKAGES_NOT_ALLOWED syscall.Errno = 15155 - ERROR_PRI_MERGE_MAIN_PACKAGE_REQUIRED syscall.Errno = 15156 - ERROR_PRI_MERGE_RESOURCE_PACKAGE_REQUIRED syscall.Errno = 15157 - ERROR_PRI_MERGE_INVALID_FILE_NAME syscall.Errno = 15158 - ERROR_MRM_PACKAGE_NOT_FOUND syscall.Errno = 15159 - ERROR_MCA_INVALID_CAPABILITIES_STRING syscall.Errno = 15200 - ERROR_MCA_INVALID_VCP_VERSION syscall.Errno = 15201 - ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION syscall.Errno = 15202 - ERROR_MCA_MCCS_VERSION_MISMATCH syscall.Errno = 15203 - ERROR_MCA_UNSUPPORTED_MCCS_VERSION syscall.Errno = 15204 - ERROR_MCA_INTERNAL_ERROR syscall.Errno = 15205 - ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED syscall.Errno = 15206 - ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE syscall.Errno = 15207 - ERROR_AMBIGUOUS_SYSTEM_DEVICE syscall.Errno = 15250 - ERROR_SYSTEM_DEVICE_NOT_FOUND syscall.Errno = 15299 - ERROR_HASH_NOT_SUPPORTED syscall.Errno = 15300 - ERROR_HASH_NOT_PRESENT syscall.Errno = 15301 - ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED syscall.Errno = 15321 - ERROR_GPIO_CLIENT_INFORMATION_INVALID syscall.Errno = 15322 - ERROR_GPIO_VERSION_NOT_SUPPORTED syscall.Errno = 15323 - ERROR_GPIO_INVALID_REGISTRATION_PACKET syscall.Errno = 15324 - ERROR_GPIO_OPERATION_DENIED syscall.Errno = 15325 - ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE syscall.Errno = 15326 - ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED syscall.Errno = 15327 - ERROR_CANNOT_SWITCH_RUNLEVEL syscall.Errno = 15400 - ERROR_INVALID_RUNLEVEL_SETTING syscall.Errno = 15401 - ERROR_RUNLEVEL_SWITCH_TIMEOUT syscall.Errno = 15402 - ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT syscall.Errno = 15403 - ERROR_RUNLEVEL_SWITCH_IN_PROGRESS syscall.Errno = 15404 - ERROR_SERVICES_FAILED_AUTOSTART syscall.Errno = 15405 - ERROR_COM_TASK_STOP_PENDING syscall.Errno = 15501 - ERROR_INSTALL_OPEN_PACKAGE_FAILED syscall.Errno = 15600 - ERROR_INSTALL_PACKAGE_NOT_FOUND syscall.Errno = 15601 - ERROR_INSTALL_INVALID_PACKAGE syscall.Errno = 15602 - ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED syscall.Errno = 15603 - ERROR_INSTALL_OUT_OF_DISK_SPACE syscall.Errno = 15604 - ERROR_INSTALL_NETWORK_FAILURE syscall.Errno = 15605 - ERROR_INSTALL_REGISTRATION_FAILURE syscall.Errno = 15606 - ERROR_INSTALL_DEREGISTRATION_FAILURE syscall.Errno = 15607 - ERROR_INSTALL_CANCEL syscall.Errno = 15608 - ERROR_INSTALL_FAILED syscall.Errno = 15609 - ERROR_REMOVE_FAILED syscall.Errno = 15610 - ERROR_PACKAGE_ALREADY_EXISTS syscall.Errno = 15611 - ERROR_NEEDS_REMEDIATION syscall.Errno = 15612 - ERROR_INSTALL_PREREQUISITE_FAILED syscall.Errno = 15613 - ERROR_PACKAGE_REPOSITORY_CORRUPTED syscall.Errno = 15614 - ERROR_INSTALL_POLICY_FAILURE syscall.Errno = 15615 - ERROR_PACKAGE_UPDATING syscall.Errno = 15616 - ERROR_DEPLOYMENT_BLOCKED_BY_POLICY syscall.Errno = 15617 - ERROR_PACKAGES_IN_USE syscall.Errno = 15618 - ERROR_RECOVERY_FILE_CORRUPT syscall.Errno = 15619 - ERROR_INVALID_STAGED_SIGNATURE syscall.Errno = 15620 - ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED syscall.Errno = 15621 - ERROR_INSTALL_PACKAGE_DOWNGRADE syscall.Errno = 15622 - ERROR_SYSTEM_NEEDS_REMEDIATION syscall.Errno = 15623 - ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN syscall.Errno = 15624 - ERROR_RESILIENCY_FILE_CORRUPT syscall.Errno = 15625 - ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING syscall.Errno = 15626 - ERROR_PACKAGE_MOVE_FAILED syscall.Errno = 15627 - ERROR_INSTALL_VOLUME_NOT_EMPTY syscall.Errno = 15628 - ERROR_INSTALL_VOLUME_OFFLINE syscall.Errno = 15629 - ERROR_INSTALL_VOLUME_CORRUPT syscall.Errno = 15630 - ERROR_NEEDS_REGISTRATION syscall.Errno = 15631 - ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE syscall.Errno = 15632 - ERROR_DEV_SIDELOAD_LIMIT_EXCEEDED syscall.Errno = 15633 - ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE syscall.Errno = 15634 - ERROR_PACKAGE_NOT_SUPPORTED_ON_FILESYSTEM syscall.Errno = 15635 - ERROR_PACKAGE_MOVE_BLOCKED_BY_STREAMING syscall.Errno = 15636 - ERROR_INSTALL_OPTIONAL_PACKAGE_APPLICATIONID_NOT_UNIQUE syscall.Errno = 15637 - ERROR_PACKAGE_STAGING_ONHOLD syscall.Errno = 15638 - ERROR_INSTALL_INVALID_RELATED_SET_UPDATE syscall.Errno = 15639 - ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_FULLTRUST_CAPABILITY syscall.Errno = 15640 - ERROR_DEPLOYMENT_BLOCKED_BY_USER_LOG_OFF syscall.Errno = 15641 - ERROR_PROVISION_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_PROVISIONED syscall.Errno = 15642 - ERROR_PACKAGES_REPUTATION_CHECK_FAILED syscall.Errno = 15643 - ERROR_PACKAGES_REPUTATION_CHECK_TIMEDOUT syscall.Errno = 15644 - ERROR_DEPLOYMENT_OPTION_NOT_SUPPORTED syscall.Errno = 15645 - ERROR_APPINSTALLER_ACTIVATION_BLOCKED syscall.Errno = 15646 - ERROR_REGISTRATION_FROM_REMOTE_DRIVE_NOT_SUPPORTED syscall.Errno = 15647 - APPMODEL_ERROR_NO_PACKAGE syscall.Errno = 15700 - APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT syscall.Errno = 15701 - APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT syscall.Errno = 15702 - APPMODEL_ERROR_NO_APPLICATION syscall.Errno = 15703 - APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED syscall.Errno = 15704 - APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID syscall.Errno = 15705 - APPMODEL_ERROR_PACKAGE_NOT_AVAILABLE syscall.Errno = 15706 - ERROR_STATE_LOAD_STORE_FAILED syscall.Errno = 15800 - ERROR_STATE_GET_VERSION_FAILED syscall.Errno = 15801 - ERROR_STATE_SET_VERSION_FAILED syscall.Errno = 15802 - ERROR_STATE_STRUCTURED_RESET_FAILED syscall.Errno = 15803 - ERROR_STATE_OPEN_CONTAINER_FAILED syscall.Errno = 15804 - ERROR_STATE_CREATE_CONTAINER_FAILED syscall.Errno = 15805 - ERROR_STATE_DELETE_CONTAINER_FAILED syscall.Errno = 15806 - ERROR_STATE_READ_SETTING_FAILED syscall.Errno = 15807 - ERROR_STATE_WRITE_SETTING_FAILED syscall.Errno = 15808 - ERROR_STATE_DELETE_SETTING_FAILED syscall.Errno = 15809 - ERROR_STATE_QUERY_SETTING_FAILED syscall.Errno = 15810 - ERROR_STATE_READ_COMPOSITE_SETTING_FAILED syscall.Errno = 15811 - ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED syscall.Errno = 15812 - ERROR_STATE_ENUMERATE_CONTAINER_FAILED syscall.Errno = 15813 - ERROR_STATE_ENUMERATE_SETTINGS_FAILED syscall.Errno = 15814 - ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15815 - ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15816 - ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15817 - ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15818 - ERROR_API_UNAVAILABLE syscall.Errno = 15841 - STORE_ERROR_UNLICENSED syscall.Errno = 15861 - STORE_ERROR_UNLICENSED_USER syscall.Errno = 15862 - STORE_ERROR_PENDING_COM_TRANSACTION syscall.Errno = 15863 - STORE_ERROR_LICENSE_REVOKED syscall.Errno = 15864 - SEVERITY_SUCCESS syscall.Errno = 0 - SEVERITY_ERROR syscall.Errno = 1 - FACILITY_NT_BIT = 0x10000000 - E_NOT_SET = ERROR_NOT_FOUND - E_NOT_VALID_STATE = ERROR_INVALID_STATE - E_NOT_SUFFICIENT_BUFFER = ERROR_INSUFFICIENT_BUFFER - E_TIME_CRITICAL_THREAD = ERROR_TIME_CRITICAL_THREAD - NOERROR syscall.Errno = 0 - E_UNEXPECTED Handle = 0x8000FFFF - E_NOTIMPL Handle = 0x80004001 - E_OUTOFMEMORY Handle = 0x8007000E - E_INVALIDARG Handle = 0x80070057 - E_NOINTERFACE Handle = 0x80004002 - E_POINTER Handle = 0x80004003 - E_HANDLE Handle = 0x80070006 - E_ABORT Handle = 0x80004004 - E_FAIL Handle = 0x80004005 - E_ACCESSDENIED Handle = 0x80070005 - E_PENDING Handle = 0x8000000A - E_BOUNDS Handle = 0x8000000B - E_CHANGED_STATE Handle = 0x8000000C - E_ILLEGAL_STATE_CHANGE Handle = 0x8000000D - E_ILLEGAL_METHOD_CALL Handle = 0x8000000E - RO_E_METADATA_NAME_NOT_FOUND Handle = 0x8000000F - RO_E_METADATA_NAME_IS_NAMESPACE Handle = 0x80000010 - RO_E_METADATA_INVALID_TYPE_FORMAT Handle = 0x80000011 - RO_E_INVALID_METADATA_FILE Handle = 0x80000012 - RO_E_CLOSED Handle = 0x80000013 - RO_E_EXCLUSIVE_WRITE Handle = 0x80000014 - RO_E_CHANGE_NOTIFICATION_IN_PROGRESS Handle = 0x80000015 - RO_E_ERROR_STRING_NOT_FOUND Handle = 0x80000016 - E_STRING_NOT_NULL_TERMINATED Handle = 0x80000017 - E_ILLEGAL_DELEGATE_ASSIGNMENT Handle = 0x80000018 - E_ASYNC_OPERATION_NOT_STARTED Handle = 0x80000019 - E_APPLICATION_EXITING Handle = 0x8000001A - E_APPLICATION_VIEW_EXITING Handle = 0x8000001B - RO_E_MUST_BE_AGILE Handle = 0x8000001C - RO_E_UNSUPPORTED_FROM_MTA Handle = 0x8000001D - RO_E_COMMITTED Handle = 0x8000001E - RO_E_BLOCKED_CROSS_ASTA_CALL Handle = 0x8000001F - RO_E_CANNOT_ACTIVATE_FULL_TRUST_SERVER Handle = 0x80000020 - RO_E_CANNOT_ACTIVATE_UNIVERSAL_APPLICATION_SERVER Handle = 0x80000021 - CO_E_INIT_TLS Handle = 0x80004006 - CO_E_INIT_SHARED_ALLOCATOR Handle = 0x80004007 - CO_E_INIT_MEMORY_ALLOCATOR Handle = 0x80004008 - CO_E_INIT_CLASS_CACHE Handle = 0x80004009 - CO_E_INIT_RPC_CHANNEL Handle = 0x8000400A - CO_E_INIT_TLS_SET_CHANNEL_CONTROL Handle = 0x8000400B - CO_E_INIT_TLS_CHANNEL_CONTROL Handle = 0x8000400C - CO_E_INIT_UNACCEPTED_USER_ALLOCATOR Handle = 0x8000400D - CO_E_INIT_SCM_MUTEX_EXISTS Handle = 0x8000400E - CO_E_INIT_SCM_FILE_MAPPING_EXISTS Handle = 0x8000400F - CO_E_INIT_SCM_MAP_VIEW_OF_FILE Handle = 0x80004010 - CO_E_INIT_SCM_EXEC_FAILURE Handle = 0x80004011 - CO_E_INIT_ONLY_SINGLE_THREADED Handle = 0x80004012 - CO_E_CANT_REMOTE Handle = 0x80004013 - CO_E_BAD_SERVER_NAME Handle = 0x80004014 - CO_E_WRONG_SERVER_IDENTITY Handle = 0x80004015 - CO_E_OLE1DDE_DISABLED Handle = 0x80004016 - CO_E_RUNAS_SYNTAX Handle = 0x80004017 - CO_E_CREATEPROCESS_FAILURE Handle = 0x80004018 - CO_E_RUNAS_CREATEPROCESS_FAILURE Handle = 0x80004019 - CO_E_RUNAS_LOGON_FAILURE Handle = 0x8000401A - CO_E_LAUNCH_PERMSSION_DENIED Handle = 0x8000401B - CO_E_START_SERVICE_FAILURE Handle = 0x8000401C - CO_E_REMOTE_COMMUNICATION_FAILURE Handle = 0x8000401D - CO_E_SERVER_START_TIMEOUT Handle = 0x8000401E - CO_E_CLSREG_INCONSISTENT Handle = 0x8000401F - CO_E_IIDREG_INCONSISTENT Handle = 0x80004020 - CO_E_NOT_SUPPORTED Handle = 0x80004021 - CO_E_RELOAD_DLL Handle = 0x80004022 - CO_E_MSI_ERROR Handle = 0x80004023 - CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT Handle = 0x80004024 - CO_E_SERVER_PAUSED Handle = 0x80004025 - CO_E_SERVER_NOT_PAUSED Handle = 0x80004026 - CO_E_CLASS_DISABLED Handle = 0x80004027 - CO_E_CLRNOTAVAILABLE Handle = 0x80004028 - CO_E_ASYNC_WORK_REJECTED Handle = 0x80004029 - CO_E_SERVER_INIT_TIMEOUT Handle = 0x8000402A - CO_E_NO_SECCTX_IN_ACTIVATE Handle = 0x8000402B - CO_E_TRACKER_CONFIG Handle = 0x80004030 - CO_E_THREADPOOL_CONFIG Handle = 0x80004031 - CO_E_SXS_CONFIG Handle = 0x80004032 - CO_E_MALFORMED_SPN Handle = 0x80004033 - CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN Handle = 0x80004034 - CO_E_PREMATURE_STUB_RUNDOWN Handle = 0x80004035 - S_OK Handle = 0 - S_FALSE Handle = 1 - OLE_E_FIRST Handle = 0x80040000 - OLE_E_LAST Handle = 0x800400FF - OLE_S_FIRST Handle = 0x00040000 - OLE_S_LAST Handle = 0x000400FF - OLE_E_OLEVERB Handle = 0x80040000 - OLE_E_ADVF Handle = 0x80040001 - OLE_E_ENUM_NOMORE Handle = 0x80040002 - OLE_E_ADVISENOTSUPPORTED Handle = 0x80040003 - OLE_E_NOCONNECTION Handle = 0x80040004 - OLE_E_NOTRUNNING Handle = 0x80040005 - OLE_E_NOCACHE Handle = 0x80040006 - OLE_E_BLANK Handle = 0x80040007 - OLE_E_CLASSDIFF Handle = 0x80040008 - OLE_E_CANT_GETMONIKER Handle = 0x80040009 - OLE_E_CANT_BINDTOSOURCE Handle = 0x8004000A - OLE_E_STATIC Handle = 0x8004000B - OLE_E_PROMPTSAVECANCELLED Handle = 0x8004000C - OLE_E_INVALIDRECT Handle = 0x8004000D - OLE_E_WRONGCOMPOBJ Handle = 0x8004000E - OLE_E_INVALIDHWND Handle = 0x8004000F - OLE_E_NOT_INPLACEACTIVE Handle = 0x80040010 - OLE_E_CANTCONVERT Handle = 0x80040011 - OLE_E_NOSTORAGE Handle = 0x80040012 - DV_E_FORMATETC Handle = 0x80040064 - DV_E_DVTARGETDEVICE Handle = 0x80040065 - DV_E_STGMEDIUM Handle = 0x80040066 - DV_E_STATDATA Handle = 0x80040067 - DV_E_LINDEX Handle = 0x80040068 - DV_E_TYMED Handle = 0x80040069 - DV_E_CLIPFORMAT Handle = 0x8004006A - DV_E_DVASPECT Handle = 0x8004006B - DV_E_DVTARGETDEVICE_SIZE Handle = 0x8004006C - DV_E_NOIVIEWOBJECT Handle = 0x8004006D - DRAGDROP_E_FIRST syscall.Errno = 0x80040100 - DRAGDROP_E_LAST syscall.Errno = 0x8004010F - DRAGDROP_S_FIRST syscall.Errno = 0x00040100 - DRAGDROP_S_LAST syscall.Errno = 0x0004010F - DRAGDROP_E_NOTREGISTERED Handle = 0x80040100 - DRAGDROP_E_ALREADYREGISTERED Handle = 0x80040101 - DRAGDROP_E_INVALIDHWND Handle = 0x80040102 - DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED Handle = 0x80040103 - CLASSFACTORY_E_FIRST syscall.Errno = 0x80040110 - CLASSFACTORY_E_LAST syscall.Errno = 0x8004011F - CLASSFACTORY_S_FIRST syscall.Errno = 0x00040110 - CLASSFACTORY_S_LAST syscall.Errno = 0x0004011F - CLASS_E_NOAGGREGATION Handle = 0x80040110 - CLASS_E_CLASSNOTAVAILABLE Handle = 0x80040111 - CLASS_E_NOTLICENSED Handle = 0x80040112 - MARSHAL_E_FIRST syscall.Errno = 0x80040120 - MARSHAL_E_LAST syscall.Errno = 0x8004012F - MARSHAL_S_FIRST syscall.Errno = 0x00040120 - MARSHAL_S_LAST syscall.Errno = 0x0004012F - DATA_E_FIRST syscall.Errno = 0x80040130 - DATA_E_LAST syscall.Errno = 0x8004013F - DATA_S_FIRST syscall.Errno = 0x00040130 - DATA_S_LAST syscall.Errno = 0x0004013F - VIEW_E_FIRST syscall.Errno = 0x80040140 - VIEW_E_LAST syscall.Errno = 0x8004014F - VIEW_S_FIRST syscall.Errno = 0x00040140 - VIEW_S_LAST syscall.Errno = 0x0004014F - VIEW_E_DRAW Handle = 0x80040140 - REGDB_E_FIRST syscall.Errno = 0x80040150 - REGDB_E_LAST syscall.Errno = 0x8004015F - REGDB_S_FIRST syscall.Errno = 0x00040150 - REGDB_S_LAST syscall.Errno = 0x0004015F - REGDB_E_READREGDB Handle = 0x80040150 - REGDB_E_WRITEREGDB Handle = 0x80040151 - REGDB_E_KEYMISSING Handle = 0x80040152 - REGDB_E_INVALIDVALUE Handle = 0x80040153 - REGDB_E_CLASSNOTREG Handle = 0x80040154 - REGDB_E_IIDNOTREG Handle = 0x80040155 - REGDB_E_BADTHREADINGMODEL Handle = 0x80040156 - REGDB_E_PACKAGEPOLICYVIOLATION Handle = 0x80040157 - CAT_E_FIRST syscall.Errno = 0x80040160 - CAT_E_LAST syscall.Errno = 0x80040161 - CAT_E_CATIDNOEXIST Handle = 0x80040160 - CAT_E_NODESCRIPTION Handle = 0x80040161 - CS_E_FIRST syscall.Errno = 0x80040164 - CS_E_LAST syscall.Errno = 0x8004016F - CS_E_PACKAGE_NOTFOUND Handle = 0x80040164 - CS_E_NOT_DELETABLE Handle = 0x80040165 - CS_E_CLASS_NOTFOUND Handle = 0x80040166 - CS_E_INVALID_VERSION Handle = 0x80040167 - CS_E_NO_CLASSSTORE Handle = 0x80040168 - CS_E_OBJECT_NOTFOUND Handle = 0x80040169 - CS_E_OBJECT_ALREADY_EXISTS Handle = 0x8004016A - CS_E_INVALID_PATH Handle = 0x8004016B - CS_E_NETWORK_ERROR Handle = 0x8004016C - CS_E_ADMIN_LIMIT_EXCEEDED Handle = 0x8004016D - CS_E_SCHEMA_MISMATCH Handle = 0x8004016E - CS_E_INTERNAL_ERROR Handle = 0x8004016F - CACHE_E_FIRST syscall.Errno = 0x80040170 - CACHE_E_LAST syscall.Errno = 0x8004017F - CACHE_S_FIRST syscall.Errno = 0x00040170 - CACHE_S_LAST syscall.Errno = 0x0004017F - CACHE_E_NOCACHE_UPDATED Handle = 0x80040170 - OLEOBJ_E_FIRST syscall.Errno = 0x80040180 - OLEOBJ_E_LAST syscall.Errno = 0x8004018F - OLEOBJ_S_FIRST syscall.Errno = 0x00040180 - OLEOBJ_S_LAST syscall.Errno = 0x0004018F - OLEOBJ_E_NOVERBS Handle = 0x80040180 - OLEOBJ_E_INVALIDVERB Handle = 0x80040181 - CLIENTSITE_E_FIRST syscall.Errno = 0x80040190 - CLIENTSITE_E_LAST syscall.Errno = 0x8004019F - CLIENTSITE_S_FIRST syscall.Errno = 0x00040190 - CLIENTSITE_S_LAST syscall.Errno = 0x0004019F - INPLACE_E_NOTUNDOABLE Handle = 0x800401A0 - INPLACE_E_NOTOOLSPACE Handle = 0x800401A1 - INPLACE_E_FIRST syscall.Errno = 0x800401A0 - INPLACE_E_LAST syscall.Errno = 0x800401AF - INPLACE_S_FIRST syscall.Errno = 0x000401A0 - INPLACE_S_LAST syscall.Errno = 0x000401AF - ENUM_E_FIRST syscall.Errno = 0x800401B0 - ENUM_E_LAST syscall.Errno = 0x800401BF - ENUM_S_FIRST syscall.Errno = 0x000401B0 - ENUM_S_LAST syscall.Errno = 0x000401BF - CONVERT10_E_FIRST syscall.Errno = 0x800401C0 - CONVERT10_E_LAST syscall.Errno = 0x800401CF - CONVERT10_S_FIRST syscall.Errno = 0x000401C0 - CONVERT10_S_LAST syscall.Errno = 0x000401CF - CONVERT10_E_OLESTREAM_GET Handle = 0x800401C0 - CONVERT10_E_OLESTREAM_PUT Handle = 0x800401C1 - CONVERT10_E_OLESTREAM_FMT Handle = 0x800401C2 - CONVERT10_E_OLESTREAM_BITMAP_TO_DIB Handle = 0x800401C3 - CONVERT10_E_STG_FMT Handle = 0x800401C4 - CONVERT10_E_STG_NO_STD_STREAM Handle = 0x800401C5 - CONVERT10_E_STG_DIB_TO_BITMAP Handle = 0x800401C6 - CLIPBRD_E_FIRST syscall.Errno = 0x800401D0 - CLIPBRD_E_LAST syscall.Errno = 0x800401DF - CLIPBRD_S_FIRST syscall.Errno = 0x000401D0 - CLIPBRD_S_LAST syscall.Errno = 0x000401DF - CLIPBRD_E_CANT_OPEN Handle = 0x800401D0 - CLIPBRD_E_CANT_EMPTY Handle = 0x800401D1 - CLIPBRD_E_CANT_SET Handle = 0x800401D2 - CLIPBRD_E_BAD_DATA Handle = 0x800401D3 - CLIPBRD_E_CANT_CLOSE Handle = 0x800401D4 - MK_E_FIRST syscall.Errno = 0x800401E0 - MK_E_LAST syscall.Errno = 0x800401EF - MK_S_FIRST syscall.Errno = 0x000401E0 - MK_S_LAST syscall.Errno = 0x000401EF - MK_E_CONNECTMANUALLY Handle = 0x800401E0 - MK_E_EXCEEDEDDEADLINE Handle = 0x800401E1 - MK_E_NEEDGENERIC Handle = 0x800401E2 - MK_E_UNAVAILABLE Handle = 0x800401E3 - MK_E_SYNTAX Handle = 0x800401E4 - MK_E_NOOBJECT Handle = 0x800401E5 - MK_E_INVALIDEXTENSION Handle = 0x800401E6 - MK_E_INTERMEDIATEINTERFACENOTSUPPORTED Handle = 0x800401E7 - MK_E_NOTBINDABLE Handle = 0x800401E8 - MK_E_NOTBOUND Handle = 0x800401E9 - MK_E_CANTOPENFILE Handle = 0x800401EA - MK_E_MUSTBOTHERUSER Handle = 0x800401EB - MK_E_NOINVERSE Handle = 0x800401EC - MK_E_NOSTORAGE Handle = 0x800401ED - MK_E_NOPREFIX Handle = 0x800401EE - MK_E_ENUMERATION_FAILED Handle = 0x800401EF - CO_E_FIRST syscall.Errno = 0x800401F0 - CO_E_LAST syscall.Errno = 0x800401FF - CO_S_FIRST syscall.Errno = 0x000401F0 - CO_S_LAST syscall.Errno = 0x000401FF - CO_E_NOTINITIALIZED Handle = 0x800401F0 - CO_E_ALREADYINITIALIZED Handle = 0x800401F1 - CO_E_CANTDETERMINECLASS Handle = 0x800401F2 - CO_E_CLASSSTRING Handle = 0x800401F3 - CO_E_IIDSTRING Handle = 0x800401F4 - CO_E_APPNOTFOUND Handle = 0x800401F5 - CO_E_APPSINGLEUSE Handle = 0x800401F6 - CO_E_ERRORINAPP Handle = 0x800401F7 - CO_E_DLLNOTFOUND Handle = 0x800401F8 - CO_E_ERRORINDLL Handle = 0x800401F9 - CO_E_WRONGOSFORAPP Handle = 0x800401FA - CO_E_OBJNOTREG Handle = 0x800401FB - CO_E_OBJISREG Handle = 0x800401FC - CO_E_OBJNOTCONNECTED Handle = 0x800401FD - CO_E_APPDIDNTREG Handle = 0x800401FE - CO_E_RELEASED Handle = 0x800401FF - EVENT_E_FIRST syscall.Errno = 0x80040200 - EVENT_E_LAST syscall.Errno = 0x8004021F - EVENT_S_FIRST syscall.Errno = 0x00040200 - EVENT_S_LAST syscall.Errno = 0x0004021F - EVENT_S_SOME_SUBSCRIBERS_FAILED Handle = 0x00040200 - EVENT_E_ALL_SUBSCRIBERS_FAILED Handle = 0x80040201 - EVENT_S_NOSUBSCRIBERS Handle = 0x00040202 - EVENT_E_QUERYSYNTAX Handle = 0x80040203 - EVENT_E_QUERYFIELD Handle = 0x80040204 - EVENT_E_INTERNALEXCEPTION Handle = 0x80040205 - EVENT_E_INTERNALERROR Handle = 0x80040206 - EVENT_E_INVALID_PER_USER_SID Handle = 0x80040207 - EVENT_E_USER_EXCEPTION Handle = 0x80040208 - EVENT_E_TOO_MANY_METHODS Handle = 0x80040209 - EVENT_E_MISSING_EVENTCLASS Handle = 0x8004020A - EVENT_E_NOT_ALL_REMOVED Handle = 0x8004020B - EVENT_E_COMPLUS_NOT_INSTALLED Handle = 0x8004020C - EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT Handle = 0x8004020D - EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT Handle = 0x8004020E - EVENT_E_INVALID_EVENT_CLASS_PARTITION Handle = 0x8004020F - EVENT_E_PER_USER_SID_NOT_LOGGED_ON Handle = 0x80040210 - TPC_E_INVALID_PROPERTY Handle = 0x80040241 - TPC_E_NO_DEFAULT_TABLET Handle = 0x80040212 - TPC_E_UNKNOWN_PROPERTY Handle = 0x8004021B - TPC_E_INVALID_INPUT_RECT Handle = 0x80040219 - TPC_E_INVALID_STROKE Handle = 0x80040222 - TPC_E_INITIALIZE_FAIL Handle = 0x80040223 - TPC_E_NOT_RELEVANT Handle = 0x80040232 - TPC_E_INVALID_PACKET_DESCRIPTION Handle = 0x80040233 - TPC_E_RECOGNIZER_NOT_REGISTERED Handle = 0x80040235 - TPC_E_INVALID_RIGHTS Handle = 0x80040236 - TPC_E_OUT_OF_ORDER_CALL Handle = 0x80040237 - TPC_E_QUEUE_FULL Handle = 0x80040238 - TPC_E_INVALID_CONFIGURATION Handle = 0x80040239 - TPC_E_INVALID_DATA_FROM_RECOGNIZER Handle = 0x8004023A - TPC_S_TRUNCATED Handle = 0x00040252 - TPC_S_INTERRUPTED Handle = 0x00040253 - TPC_S_NO_DATA_TO_PROCESS Handle = 0x00040254 - XACT_E_FIRST syscall.Errno = 0x8004D000 - XACT_E_LAST syscall.Errno = 0x8004D02B - XACT_S_FIRST syscall.Errno = 0x0004D000 - XACT_S_LAST syscall.Errno = 0x0004D010 - XACT_E_ALREADYOTHERSINGLEPHASE Handle = 0x8004D000 - XACT_E_CANTRETAIN Handle = 0x8004D001 - XACT_E_COMMITFAILED Handle = 0x8004D002 - XACT_E_COMMITPREVENTED Handle = 0x8004D003 - XACT_E_HEURISTICABORT Handle = 0x8004D004 - XACT_E_HEURISTICCOMMIT Handle = 0x8004D005 - XACT_E_HEURISTICDAMAGE Handle = 0x8004D006 - XACT_E_HEURISTICDANGER Handle = 0x8004D007 - XACT_E_ISOLATIONLEVEL Handle = 0x8004D008 - XACT_E_NOASYNC Handle = 0x8004D009 - XACT_E_NOENLIST Handle = 0x8004D00A - XACT_E_NOISORETAIN Handle = 0x8004D00B - XACT_E_NORESOURCE Handle = 0x8004D00C - XACT_E_NOTCURRENT Handle = 0x8004D00D - XACT_E_NOTRANSACTION Handle = 0x8004D00E - XACT_E_NOTSUPPORTED Handle = 0x8004D00F - XACT_E_UNKNOWNRMGRID Handle = 0x8004D010 - XACT_E_WRONGSTATE Handle = 0x8004D011 - XACT_E_WRONGUOW Handle = 0x8004D012 - XACT_E_XTIONEXISTS Handle = 0x8004D013 - XACT_E_NOIMPORTOBJECT Handle = 0x8004D014 - XACT_E_INVALIDCOOKIE Handle = 0x8004D015 - XACT_E_INDOUBT Handle = 0x8004D016 - XACT_E_NOTIMEOUT Handle = 0x8004D017 - XACT_E_ALREADYINPROGRESS Handle = 0x8004D018 - XACT_E_ABORTED Handle = 0x8004D019 - XACT_E_LOGFULL Handle = 0x8004D01A - XACT_E_TMNOTAVAILABLE Handle = 0x8004D01B - XACT_E_CONNECTION_DOWN Handle = 0x8004D01C - XACT_E_CONNECTION_DENIED Handle = 0x8004D01D - XACT_E_REENLISTTIMEOUT Handle = 0x8004D01E - XACT_E_TIP_CONNECT_FAILED Handle = 0x8004D01F - XACT_E_TIP_PROTOCOL_ERROR Handle = 0x8004D020 - XACT_E_TIP_PULL_FAILED Handle = 0x8004D021 - XACT_E_DEST_TMNOTAVAILABLE Handle = 0x8004D022 - XACT_E_TIP_DISABLED Handle = 0x8004D023 - XACT_E_NETWORK_TX_DISABLED Handle = 0x8004D024 - XACT_E_PARTNER_NETWORK_TX_DISABLED Handle = 0x8004D025 - XACT_E_XA_TX_DISABLED Handle = 0x8004D026 - XACT_E_UNABLE_TO_READ_DTC_CONFIG Handle = 0x8004D027 - XACT_E_UNABLE_TO_LOAD_DTC_PROXY Handle = 0x8004D028 - XACT_E_ABORTING Handle = 0x8004D029 - XACT_E_PUSH_COMM_FAILURE Handle = 0x8004D02A - XACT_E_PULL_COMM_FAILURE Handle = 0x8004D02B - XACT_E_LU_TX_DISABLED Handle = 0x8004D02C - XACT_E_CLERKNOTFOUND Handle = 0x8004D080 - XACT_E_CLERKEXISTS Handle = 0x8004D081 - XACT_E_RECOVERYINPROGRESS Handle = 0x8004D082 - XACT_E_TRANSACTIONCLOSED Handle = 0x8004D083 - XACT_E_INVALIDLSN Handle = 0x8004D084 - XACT_E_REPLAYREQUEST Handle = 0x8004D085 - XACT_S_ASYNC Handle = 0x0004D000 - XACT_S_DEFECT Handle = 0x0004D001 - XACT_S_READONLY Handle = 0x0004D002 - XACT_S_SOMENORETAIN Handle = 0x0004D003 - XACT_S_OKINFORM Handle = 0x0004D004 - XACT_S_MADECHANGESCONTENT Handle = 0x0004D005 - XACT_S_MADECHANGESINFORM Handle = 0x0004D006 - XACT_S_ALLNORETAIN Handle = 0x0004D007 - XACT_S_ABORTING Handle = 0x0004D008 - XACT_S_SINGLEPHASE Handle = 0x0004D009 - XACT_S_LOCALLY_OK Handle = 0x0004D00A - XACT_S_LASTRESOURCEMANAGER Handle = 0x0004D010 - CONTEXT_E_FIRST syscall.Errno = 0x8004E000 - CONTEXT_E_LAST syscall.Errno = 0x8004E02F - CONTEXT_S_FIRST syscall.Errno = 0x0004E000 - CONTEXT_S_LAST syscall.Errno = 0x0004E02F - CONTEXT_E_ABORTED Handle = 0x8004E002 - CONTEXT_E_ABORTING Handle = 0x8004E003 - CONTEXT_E_NOCONTEXT Handle = 0x8004E004 - CONTEXT_E_WOULD_DEADLOCK Handle = 0x8004E005 - CONTEXT_E_SYNCH_TIMEOUT Handle = 0x8004E006 - CONTEXT_E_OLDREF Handle = 0x8004E007 - CONTEXT_E_ROLENOTFOUND Handle = 0x8004E00C - CONTEXT_E_TMNOTAVAILABLE Handle = 0x8004E00F - CO_E_ACTIVATIONFAILED Handle = 0x8004E021 - CO_E_ACTIVATIONFAILED_EVENTLOGGED Handle = 0x8004E022 - CO_E_ACTIVATIONFAILED_CATALOGERROR Handle = 0x8004E023 - CO_E_ACTIVATIONFAILED_TIMEOUT Handle = 0x8004E024 - CO_E_INITIALIZATIONFAILED Handle = 0x8004E025 - CONTEXT_E_NOJIT Handle = 0x8004E026 - CONTEXT_E_NOTRANSACTION Handle = 0x8004E027 - CO_E_THREADINGMODEL_CHANGED Handle = 0x8004E028 - CO_E_NOIISINTRINSICS Handle = 0x8004E029 - CO_E_NOCOOKIES Handle = 0x8004E02A - CO_E_DBERROR Handle = 0x8004E02B - CO_E_NOTPOOLED Handle = 0x8004E02C - CO_E_NOTCONSTRUCTED Handle = 0x8004E02D - CO_E_NOSYNCHRONIZATION Handle = 0x8004E02E - CO_E_ISOLEVELMISMATCH Handle = 0x8004E02F - CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED Handle = 0x8004E030 - CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED Handle = 0x8004E031 - OLE_S_USEREG Handle = 0x00040000 - OLE_S_STATIC Handle = 0x00040001 - OLE_S_MAC_CLIPFORMAT Handle = 0x00040002 - DRAGDROP_S_DROP Handle = 0x00040100 - DRAGDROP_S_CANCEL Handle = 0x00040101 - DRAGDROP_S_USEDEFAULTCURSORS Handle = 0x00040102 - DATA_S_SAMEFORMATETC Handle = 0x00040130 - VIEW_S_ALREADY_FROZEN Handle = 0x00040140 - CACHE_S_FORMATETC_NOTSUPPORTED Handle = 0x00040170 - CACHE_S_SAMECACHE Handle = 0x00040171 - CACHE_S_SOMECACHES_NOTUPDATED Handle = 0x00040172 - OLEOBJ_S_INVALIDVERB Handle = 0x00040180 - OLEOBJ_S_CANNOT_DOVERB_NOW Handle = 0x00040181 - OLEOBJ_S_INVALIDHWND Handle = 0x00040182 - INPLACE_S_TRUNCATED Handle = 0x000401A0 - CONVERT10_S_NO_PRESENTATION Handle = 0x000401C0 - MK_S_REDUCED_TO_SELF Handle = 0x000401E2 - MK_S_ME Handle = 0x000401E4 - MK_S_HIM Handle = 0x000401E5 - MK_S_US Handle = 0x000401E6 - MK_S_MONIKERALREADYREGISTERED Handle = 0x000401E7 - SCHED_S_TASK_READY Handle = 0x00041300 - SCHED_S_TASK_RUNNING Handle = 0x00041301 - SCHED_S_TASK_DISABLED Handle = 0x00041302 - SCHED_S_TASK_HAS_NOT_RUN Handle = 0x00041303 - SCHED_S_TASK_NO_MORE_RUNS Handle = 0x00041304 - SCHED_S_TASK_NOT_SCHEDULED Handle = 0x00041305 - SCHED_S_TASK_TERMINATED Handle = 0x00041306 - SCHED_S_TASK_NO_VALID_TRIGGERS Handle = 0x00041307 - SCHED_S_EVENT_TRIGGER Handle = 0x00041308 - SCHED_E_TRIGGER_NOT_FOUND Handle = 0x80041309 - SCHED_E_TASK_NOT_READY Handle = 0x8004130A - SCHED_E_TASK_NOT_RUNNING Handle = 0x8004130B - SCHED_E_SERVICE_NOT_INSTALLED Handle = 0x8004130C - SCHED_E_CANNOT_OPEN_TASK Handle = 0x8004130D - SCHED_E_INVALID_TASK Handle = 0x8004130E - SCHED_E_ACCOUNT_INFORMATION_NOT_SET Handle = 0x8004130F - SCHED_E_ACCOUNT_NAME_NOT_FOUND Handle = 0x80041310 - SCHED_E_ACCOUNT_DBASE_CORRUPT Handle = 0x80041311 - SCHED_E_NO_SECURITY_SERVICES Handle = 0x80041312 - SCHED_E_UNKNOWN_OBJECT_VERSION Handle = 0x80041313 - SCHED_E_UNSUPPORTED_ACCOUNT_OPTION Handle = 0x80041314 - SCHED_E_SERVICE_NOT_RUNNING Handle = 0x80041315 - SCHED_E_UNEXPECTEDNODE Handle = 0x80041316 - SCHED_E_NAMESPACE Handle = 0x80041317 - SCHED_E_INVALIDVALUE Handle = 0x80041318 - SCHED_E_MISSINGNODE Handle = 0x80041319 - SCHED_E_MALFORMEDXML Handle = 0x8004131A - SCHED_S_SOME_TRIGGERS_FAILED Handle = 0x0004131B - SCHED_S_BATCH_LOGON_PROBLEM Handle = 0x0004131C - SCHED_E_TOO_MANY_NODES Handle = 0x8004131D - SCHED_E_PAST_END_BOUNDARY Handle = 0x8004131E - SCHED_E_ALREADY_RUNNING Handle = 0x8004131F - SCHED_E_USER_NOT_LOGGED_ON Handle = 0x80041320 - SCHED_E_INVALID_TASK_HASH Handle = 0x80041321 - SCHED_E_SERVICE_NOT_AVAILABLE Handle = 0x80041322 - SCHED_E_SERVICE_TOO_BUSY Handle = 0x80041323 - SCHED_E_TASK_ATTEMPTED Handle = 0x80041324 - SCHED_S_TASK_QUEUED Handle = 0x00041325 - SCHED_E_TASK_DISABLED Handle = 0x80041326 - SCHED_E_TASK_NOT_V1_COMPAT Handle = 0x80041327 - SCHED_E_START_ON_DEMAND Handle = 0x80041328 - SCHED_E_TASK_NOT_UBPM_COMPAT Handle = 0x80041329 - SCHED_E_DEPRECATED_FEATURE_USED Handle = 0x80041330 - CO_E_CLASS_CREATE_FAILED Handle = 0x80080001 - CO_E_SCM_ERROR Handle = 0x80080002 - CO_E_SCM_RPC_FAILURE Handle = 0x80080003 - CO_E_BAD_PATH Handle = 0x80080004 - CO_E_SERVER_EXEC_FAILURE Handle = 0x80080005 - CO_E_OBJSRV_RPC_FAILURE Handle = 0x80080006 - MK_E_NO_NORMALIZED Handle = 0x80080007 - CO_E_SERVER_STOPPING Handle = 0x80080008 - MEM_E_INVALID_ROOT Handle = 0x80080009 - MEM_E_INVALID_LINK Handle = 0x80080010 - MEM_E_INVALID_SIZE Handle = 0x80080011 - CO_S_NOTALLINTERFACES Handle = 0x00080012 - CO_S_MACHINENAMENOTFOUND Handle = 0x00080013 - CO_E_MISSING_DISPLAYNAME Handle = 0x80080015 - CO_E_RUNAS_VALUE_MUST_BE_AAA Handle = 0x80080016 - CO_E_ELEVATION_DISABLED Handle = 0x80080017 - APPX_E_PACKAGING_INTERNAL Handle = 0x80080200 - APPX_E_INTERLEAVING_NOT_ALLOWED Handle = 0x80080201 - APPX_E_RELATIONSHIPS_NOT_ALLOWED Handle = 0x80080202 - APPX_E_MISSING_REQUIRED_FILE Handle = 0x80080203 - APPX_E_INVALID_MANIFEST Handle = 0x80080204 - APPX_E_INVALID_BLOCKMAP Handle = 0x80080205 - APPX_E_CORRUPT_CONTENT Handle = 0x80080206 - APPX_E_BLOCK_HASH_INVALID Handle = 0x80080207 - APPX_E_REQUESTED_RANGE_TOO_LARGE Handle = 0x80080208 - APPX_E_INVALID_SIP_CLIENT_DATA Handle = 0x80080209 - APPX_E_INVALID_KEY_INFO Handle = 0x8008020A - APPX_E_INVALID_CONTENTGROUPMAP Handle = 0x8008020B - APPX_E_INVALID_APPINSTALLER Handle = 0x8008020C - APPX_E_DELTA_BASELINE_VERSION_MISMATCH Handle = 0x8008020D - APPX_E_DELTA_PACKAGE_MISSING_FILE Handle = 0x8008020E - APPX_E_INVALID_DELTA_PACKAGE Handle = 0x8008020F - APPX_E_DELTA_APPENDED_PACKAGE_NOT_ALLOWED Handle = 0x80080210 - APPX_E_INVALID_PACKAGING_LAYOUT Handle = 0x80080211 - APPX_E_INVALID_PACKAGESIGNCONFIG Handle = 0x80080212 - APPX_E_RESOURCESPRI_NOT_ALLOWED Handle = 0x80080213 - APPX_E_FILE_COMPRESSION_MISMATCH Handle = 0x80080214 - APPX_E_INVALID_PAYLOAD_PACKAGE_EXTENSION Handle = 0x80080215 - APPX_E_INVALID_ENCRYPTION_EXCLUSION_FILE_LIST Handle = 0x80080216 - BT_E_SPURIOUS_ACTIVATION Handle = 0x80080300 - DISP_E_UNKNOWNINTERFACE Handle = 0x80020001 - DISP_E_MEMBERNOTFOUND Handle = 0x80020003 - DISP_E_PARAMNOTFOUND Handle = 0x80020004 - DISP_E_TYPEMISMATCH Handle = 0x80020005 - DISP_E_UNKNOWNNAME Handle = 0x80020006 - DISP_E_NONAMEDARGS Handle = 0x80020007 - DISP_E_BADVARTYPE Handle = 0x80020008 - DISP_E_EXCEPTION Handle = 0x80020009 - DISP_E_OVERFLOW Handle = 0x8002000A - DISP_E_BADINDEX Handle = 0x8002000B - DISP_E_UNKNOWNLCID Handle = 0x8002000C - DISP_E_ARRAYISLOCKED Handle = 0x8002000D - DISP_E_BADPARAMCOUNT Handle = 0x8002000E - DISP_E_PARAMNOTOPTIONAL Handle = 0x8002000F - DISP_E_BADCALLEE Handle = 0x80020010 - DISP_E_NOTACOLLECTION Handle = 0x80020011 - DISP_E_DIVBYZERO Handle = 0x80020012 - DISP_E_BUFFERTOOSMALL Handle = 0x80020013 - TYPE_E_BUFFERTOOSMALL Handle = 0x80028016 - TYPE_E_FIELDNOTFOUND Handle = 0x80028017 - TYPE_E_INVDATAREAD Handle = 0x80028018 - TYPE_E_UNSUPFORMAT Handle = 0x80028019 - TYPE_E_REGISTRYACCESS Handle = 0x8002801C - TYPE_E_LIBNOTREGISTERED Handle = 0x8002801D - TYPE_E_UNDEFINEDTYPE Handle = 0x80028027 - TYPE_E_QUALIFIEDNAMEDISALLOWED Handle = 0x80028028 - TYPE_E_INVALIDSTATE Handle = 0x80028029 - TYPE_E_WRONGTYPEKIND Handle = 0x8002802A - TYPE_E_ELEMENTNOTFOUND Handle = 0x8002802B - TYPE_E_AMBIGUOUSNAME Handle = 0x8002802C - TYPE_E_NAMECONFLICT Handle = 0x8002802D - TYPE_E_UNKNOWNLCID Handle = 0x8002802E - TYPE_E_DLLFUNCTIONNOTFOUND Handle = 0x8002802F - TYPE_E_BADMODULEKIND Handle = 0x800288BD - TYPE_E_SIZETOOBIG Handle = 0x800288C5 - TYPE_E_DUPLICATEID Handle = 0x800288C6 - TYPE_E_INVALIDID Handle = 0x800288CF - TYPE_E_TYPEMISMATCH Handle = 0x80028CA0 - TYPE_E_OUTOFBOUNDS Handle = 0x80028CA1 - TYPE_E_IOERROR Handle = 0x80028CA2 - TYPE_E_CANTCREATETMPFILE Handle = 0x80028CA3 - TYPE_E_CANTLOADLIBRARY Handle = 0x80029C4A - TYPE_E_INCONSISTENTPROPFUNCS Handle = 0x80029C83 - TYPE_E_CIRCULARTYPE Handle = 0x80029C84 - STG_E_INVALIDFUNCTION Handle = 0x80030001 - STG_E_FILENOTFOUND Handle = 0x80030002 - STG_E_PATHNOTFOUND Handle = 0x80030003 - STG_E_TOOMANYOPENFILES Handle = 0x80030004 - STG_E_ACCESSDENIED Handle = 0x80030005 - STG_E_INVALIDHANDLE Handle = 0x80030006 - STG_E_INSUFFICIENTMEMORY Handle = 0x80030008 - STG_E_INVALIDPOINTER Handle = 0x80030009 - STG_E_NOMOREFILES Handle = 0x80030012 - STG_E_DISKISWRITEPROTECTED Handle = 0x80030013 - STG_E_SEEKERROR Handle = 0x80030019 - STG_E_WRITEFAULT Handle = 0x8003001D - STG_E_READFAULT Handle = 0x8003001E - STG_E_SHAREVIOLATION Handle = 0x80030020 - STG_E_LOCKVIOLATION Handle = 0x80030021 - STG_E_FILEALREADYEXISTS Handle = 0x80030050 - STG_E_INVALIDPARAMETER Handle = 0x80030057 - STG_E_MEDIUMFULL Handle = 0x80030070 - STG_E_PROPSETMISMATCHED Handle = 0x800300F0 - STG_E_ABNORMALAPIEXIT Handle = 0x800300FA - STG_E_INVALIDHEADER Handle = 0x800300FB - STG_E_INVALIDNAME Handle = 0x800300FC - STG_E_UNKNOWN Handle = 0x800300FD - STG_E_UNIMPLEMENTEDFUNCTION Handle = 0x800300FE - STG_E_INVALIDFLAG Handle = 0x800300FF - STG_E_INUSE Handle = 0x80030100 - STG_E_NOTCURRENT Handle = 0x80030101 - STG_E_REVERTED Handle = 0x80030102 - STG_E_CANTSAVE Handle = 0x80030103 - STG_E_OLDFORMAT Handle = 0x80030104 - STG_E_OLDDLL Handle = 0x80030105 - STG_E_SHAREREQUIRED Handle = 0x80030106 - STG_E_NOTFILEBASEDSTORAGE Handle = 0x80030107 - STG_E_EXTANTMARSHALLINGS Handle = 0x80030108 - STG_E_DOCFILECORRUPT Handle = 0x80030109 - STG_E_BADBASEADDRESS Handle = 0x80030110 - STG_E_DOCFILETOOLARGE Handle = 0x80030111 - STG_E_NOTSIMPLEFORMAT Handle = 0x80030112 - STG_E_INCOMPLETE Handle = 0x80030201 - STG_E_TERMINATED Handle = 0x80030202 - STG_S_CONVERTED Handle = 0x00030200 - STG_S_BLOCK Handle = 0x00030201 - STG_S_RETRYNOW Handle = 0x00030202 - STG_S_MONITORING Handle = 0x00030203 - STG_S_MULTIPLEOPENS Handle = 0x00030204 - STG_S_CONSOLIDATIONFAILED Handle = 0x00030205 - STG_S_CANNOTCONSOLIDATE Handle = 0x00030206 - STG_S_POWER_CYCLE_REQUIRED Handle = 0x00030207 - STG_E_FIRMWARE_SLOT_INVALID Handle = 0x80030208 - STG_E_FIRMWARE_IMAGE_INVALID Handle = 0x80030209 - STG_E_DEVICE_UNRESPONSIVE Handle = 0x8003020A - STG_E_STATUS_COPY_PROTECTION_FAILURE Handle = 0x80030305 - STG_E_CSS_AUTHENTICATION_FAILURE Handle = 0x80030306 - STG_E_CSS_KEY_NOT_PRESENT Handle = 0x80030307 - STG_E_CSS_KEY_NOT_ESTABLISHED Handle = 0x80030308 - STG_E_CSS_SCRAMBLED_SECTOR Handle = 0x80030309 - STG_E_CSS_REGION_MISMATCH Handle = 0x8003030A - STG_E_RESETS_EXHAUSTED Handle = 0x8003030B - RPC_E_CALL_REJECTED Handle = 0x80010001 - RPC_E_CALL_CANCELED Handle = 0x80010002 - RPC_E_CANTPOST_INSENDCALL Handle = 0x80010003 - RPC_E_CANTCALLOUT_INASYNCCALL Handle = 0x80010004 - RPC_E_CANTCALLOUT_INEXTERNALCALL Handle = 0x80010005 - RPC_E_CONNECTION_TERMINATED Handle = 0x80010006 - RPC_E_SERVER_DIED Handle = 0x80010007 - RPC_E_CLIENT_DIED Handle = 0x80010008 - RPC_E_INVALID_DATAPACKET Handle = 0x80010009 - RPC_E_CANTTRANSMIT_CALL Handle = 0x8001000A - RPC_E_CLIENT_CANTMARSHAL_DATA Handle = 0x8001000B - RPC_E_CLIENT_CANTUNMARSHAL_DATA Handle = 0x8001000C - RPC_E_SERVER_CANTMARSHAL_DATA Handle = 0x8001000D - RPC_E_SERVER_CANTUNMARSHAL_DATA Handle = 0x8001000E - RPC_E_INVALID_DATA Handle = 0x8001000F - RPC_E_INVALID_PARAMETER Handle = 0x80010010 - RPC_E_CANTCALLOUT_AGAIN Handle = 0x80010011 - RPC_E_SERVER_DIED_DNE Handle = 0x80010012 - RPC_E_SYS_CALL_FAILED Handle = 0x80010100 - RPC_E_OUT_OF_RESOURCES Handle = 0x80010101 - RPC_E_ATTEMPTED_MULTITHREAD Handle = 0x80010102 - RPC_E_NOT_REGISTERED Handle = 0x80010103 - RPC_E_FAULT Handle = 0x80010104 - RPC_E_SERVERFAULT Handle = 0x80010105 - RPC_E_CHANGED_MODE Handle = 0x80010106 - RPC_E_INVALIDMETHOD Handle = 0x80010107 - RPC_E_DISCONNECTED Handle = 0x80010108 - RPC_E_RETRY Handle = 0x80010109 - RPC_E_SERVERCALL_RETRYLATER Handle = 0x8001010A - RPC_E_SERVERCALL_REJECTED Handle = 0x8001010B - RPC_E_INVALID_CALLDATA Handle = 0x8001010C - RPC_E_CANTCALLOUT_ININPUTSYNCCALL Handle = 0x8001010D - RPC_E_WRONG_THREAD Handle = 0x8001010E - RPC_E_THREAD_NOT_INIT Handle = 0x8001010F - RPC_E_VERSION_MISMATCH Handle = 0x80010110 - RPC_E_INVALID_HEADER Handle = 0x80010111 - RPC_E_INVALID_EXTENSION Handle = 0x80010112 - RPC_E_INVALID_IPID Handle = 0x80010113 - RPC_E_INVALID_OBJECT Handle = 0x80010114 - RPC_S_CALLPENDING Handle = 0x80010115 - RPC_S_WAITONTIMER Handle = 0x80010116 - RPC_E_CALL_COMPLETE Handle = 0x80010117 - RPC_E_UNSECURE_CALL Handle = 0x80010118 - RPC_E_TOO_LATE Handle = 0x80010119 - RPC_E_NO_GOOD_SECURITY_PACKAGES Handle = 0x8001011A - RPC_E_ACCESS_DENIED Handle = 0x8001011B - RPC_E_REMOTE_DISABLED Handle = 0x8001011C - RPC_E_INVALID_OBJREF Handle = 0x8001011D - RPC_E_NO_CONTEXT Handle = 0x8001011E - RPC_E_TIMEOUT Handle = 0x8001011F - RPC_E_NO_SYNC Handle = 0x80010120 - RPC_E_FULLSIC_REQUIRED Handle = 0x80010121 - RPC_E_INVALID_STD_NAME Handle = 0x80010122 - CO_E_FAILEDTOIMPERSONATE Handle = 0x80010123 - CO_E_FAILEDTOGETSECCTX Handle = 0x80010124 - CO_E_FAILEDTOOPENTHREADTOKEN Handle = 0x80010125 - CO_E_FAILEDTOGETTOKENINFO Handle = 0x80010126 - CO_E_TRUSTEEDOESNTMATCHCLIENT Handle = 0x80010127 - CO_E_FAILEDTOQUERYCLIENTBLANKET Handle = 0x80010128 - CO_E_FAILEDTOSETDACL Handle = 0x80010129 - CO_E_ACCESSCHECKFAILED Handle = 0x8001012A - CO_E_NETACCESSAPIFAILED Handle = 0x8001012B - CO_E_WRONGTRUSTEENAMESYNTAX Handle = 0x8001012C - CO_E_INVALIDSID Handle = 0x8001012D - CO_E_CONVERSIONFAILED Handle = 0x8001012E - CO_E_NOMATCHINGSIDFOUND Handle = 0x8001012F - CO_E_LOOKUPACCSIDFAILED Handle = 0x80010130 - CO_E_NOMATCHINGNAMEFOUND Handle = 0x80010131 - CO_E_LOOKUPACCNAMEFAILED Handle = 0x80010132 - CO_E_SETSERLHNDLFAILED Handle = 0x80010133 - CO_E_FAILEDTOGETWINDIR Handle = 0x80010134 - CO_E_PATHTOOLONG Handle = 0x80010135 - CO_E_FAILEDTOGENUUID Handle = 0x80010136 - CO_E_FAILEDTOCREATEFILE Handle = 0x80010137 - CO_E_FAILEDTOCLOSEHANDLE Handle = 0x80010138 - CO_E_EXCEEDSYSACLLIMIT Handle = 0x80010139 - CO_E_ACESINWRONGORDER Handle = 0x8001013A - CO_E_INCOMPATIBLESTREAMVERSION Handle = 0x8001013B - CO_E_FAILEDTOOPENPROCESSTOKEN Handle = 0x8001013C - CO_E_DECODEFAILED Handle = 0x8001013D - CO_E_ACNOTINITIALIZED Handle = 0x8001013F - CO_E_CANCEL_DISABLED Handle = 0x80010140 - RPC_E_UNEXPECTED Handle = 0x8001FFFF - ERROR_AUDITING_DISABLED Handle = 0xC0090001 - ERROR_ALL_SIDS_FILTERED Handle = 0xC0090002 - ERROR_BIZRULES_NOT_ENABLED Handle = 0xC0090003 - NTE_BAD_UID Handle = 0x80090001 - NTE_BAD_HASH Handle = 0x80090002 - NTE_BAD_KEY Handle = 0x80090003 - NTE_BAD_LEN Handle = 0x80090004 - NTE_BAD_DATA Handle = 0x80090005 - NTE_BAD_SIGNATURE Handle = 0x80090006 - NTE_BAD_VER Handle = 0x80090007 - NTE_BAD_ALGID Handle = 0x80090008 - NTE_BAD_FLAGS Handle = 0x80090009 - NTE_BAD_TYPE Handle = 0x8009000A - NTE_BAD_KEY_STATE Handle = 0x8009000B - NTE_BAD_HASH_STATE Handle = 0x8009000C - NTE_NO_KEY Handle = 0x8009000D - NTE_NO_MEMORY Handle = 0x8009000E - NTE_EXISTS Handle = 0x8009000F - NTE_PERM Handle = 0x80090010 - NTE_NOT_FOUND Handle = 0x80090011 - NTE_DOUBLE_ENCRYPT Handle = 0x80090012 - NTE_BAD_PROVIDER Handle = 0x80090013 - NTE_BAD_PROV_TYPE Handle = 0x80090014 - NTE_BAD_PUBLIC_KEY Handle = 0x80090015 - NTE_BAD_KEYSET Handle = 0x80090016 - NTE_PROV_TYPE_NOT_DEF Handle = 0x80090017 - NTE_PROV_TYPE_ENTRY_BAD Handle = 0x80090018 - NTE_KEYSET_NOT_DEF Handle = 0x80090019 - NTE_KEYSET_ENTRY_BAD Handle = 0x8009001A - NTE_PROV_TYPE_NO_MATCH Handle = 0x8009001B - NTE_SIGNATURE_FILE_BAD Handle = 0x8009001C - NTE_PROVIDER_DLL_FAIL Handle = 0x8009001D - NTE_PROV_DLL_NOT_FOUND Handle = 0x8009001E - NTE_BAD_KEYSET_PARAM Handle = 0x8009001F - NTE_FAIL Handle = 0x80090020 - NTE_SYS_ERR Handle = 0x80090021 - NTE_SILENT_CONTEXT Handle = 0x80090022 - NTE_TOKEN_KEYSET_STORAGE_FULL Handle = 0x80090023 - NTE_TEMPORARY_PROFILE Handle = 0x80090024 - NTE_FIXEDPARAMETER Handle = 0x80090025 - NTE_INVALID_HANDLE Handle = 0x80090026 - NTE_INVALID_PARAMETER Handle = 0x80090027 - NTE_BUFFER_TOO_SMALL Handle = 0x80090028 - NTE_NOT_SUPPORTED Handle = 0x80090029 - NTE_NO_MORE_ITEMS Handle = 0x8009002A - NTE_BUFFERS_OVERLAP Handle = 0x8009002B - NTE_DECRYPTION_FAILURE Handle = 0x8009002C - NTE_INTERNAL_ERROR Handle = 0x8009002D - NTE_UI_REQUIRED Handle = 0x8009002E - NTE_HMAC_NOT_SUPPORTED Handle = 0x8009002F - NTE_DEVICE_NOT_READY Handle = 0x80090030 - NTE_AUTHENTICATION_IGNORED Handle = 0x80090031 - NTE_VALIDATION_FAILED Handle = 0x80090032 - NTE_INCORRECT_PASSWORD Handle = 0x80090033 - NTE_ENCRYPTION_FAILURE Handle = 0x80090034 - NTE_DEVICE_NOT_FOUND Handle = 0x80090035 - NTE_USER_CANCELLED Handle = 0x80090036 - NTE_PASSWORD_CHANGE_REQUIRED Handle = 0x80090037 - NTE_NOT_ACTIVE_CONSOLE Handle = 0x80090038 - SEC_E_INSUFFICIENT_MEMORY Handle = 0x80090300 - SEC_E_INVALID_HANDLE Handle = 0x80090301 - SEC_E_UNSUPPORTED_FUNCTION Handle = 0x80090302 - SEC_E_TARGET_UNKNOWN Handle = 0x80090303 - SEC_E_INTERNAL_ERROR Handle = 0x80090304 - SEC_E_SECPKG_NOT_FOUND Handle = 0x80090305 - SEC_E_NOT_OWNER Handle = 0x80090306 - SEC_E_CANNOT_INSTALL Handle = 0x80090307 - SEC_E_INVALID_TOKEN Handle = 0x80090308 - SEC_E_CANNOT_PACK Handle = 0x80090309 - SEC_E_QOP_NOT_SUPPORTED Handle = 0x8009030A - SEC_E_NO_IMPERSONATION Handle = 0x8009030B - SEC_E_LOGON_DENIED Handle = 0x8009030C - SEC_E_UNKNOWN_CREDENTIALS Handle = 0x8009030D - SEC_E_NO_CREDENTIALS Handle = 0x8009030E - SEC_E_MESSAGE_ALTERED Handle = 0x8009030F - SEC_E_OUT_OF_SEQUENCE Handle = 0x80090310 - SEC_E_NO_AUTHENTICATING_AUTHORITY Handle = 0x80090311 - SEC_I_CONTINUE_NEEDED Handle = 0x00090312 - SEC_I_COMPLETE_NEEDED Handle = 0x00090313 - SEC_I_COMPLETE_AND_CONTINUE Handle = 0x00090314 - SEC_I_LOCAL_LOGON Handle = 0x00090315 - SEC_E_BAD_PKGID Handle = 0x80090316 - SEC_E_CONTEXT_EXPIRED Handle = 0x80090317 - SEC_I_CONTEXT_EXPIRED Handle = 0x00090317 - SEC_E_INCOMPLETE_MESSAGE Handle = 0x80090318 - SEC_E_INCOMPLETE_CREDENTIALS Handle = 0x80090320 - SEC_E_BUFFER_TOO_SMALL Handle = 0x80090321 - SEC_I_INCOMPLETE_CREDENTIALS Handle = 0x00090320 - SEC_I_RENEGOTIATE Handle = 0x00090321 - SEC_E_WRONG_PRINCIPAL Handle = 0x80090322 - SEC_I_NO_LSA_CONTEXT Handle = 0x00090323 - SEC_E_TIME_SKEW Handle = 0x80090324 - SEC_E_UNTRUSTED_ROOT Handle = 0x80090325 - SEC_E_ILLEGAL_MESSAGE Handle = 0x80090326 - SEC_E_CERT_UNKNOWN Handle = 0x80090327 - SEC_E_CERT_EXPIRED Handle = 0x80090328 - SEC_E_ENCRYPT_FAILURE Handle = 0x80090329 - SEC_E_DECRYPT_FAILURE Handle = 0x80090330 - SEC_E_ALGORITHM_MISMATCH Handle = 0x80090331 - SEC_E_SECURITY_QOS_FAILED Handle = 0x80090332 - SEC_E_UNFINISHED_CONTEXT_DELETED Handle = 0x80090333 - SEC_E_NO_TGT_REPLY Handle = 0x80090334 - SEC_E_NO_IP_ADDRESSES Handle = 0x80090335 - SEC_E_WRONG_CREDENTIAL_HANDLE Handle = 0x80090336 - SEC_E_CRYPTO_SYSTEM_INVALID Handle = 0x80090337 - SEC_E_MAX_REFERRALS_EXCEEDED Handle = 0x80090338 - SEC_E_MUST_BE_KDC Handle = 0x80090339 - SEC_E_STRONG_CRYPTO_NOT_SUPPORTED Handle = 0x8009033A - SEC_E_TOO_MANY_PRINCIPALS Handle = 0x8009033B - SEC_E_NO_PA_DATA Handle = 0x8009033C - SEC_E_PKINIT_NAME_MISMATCH Handle = 0x8009033D - SEC_E_SMARTCARD_LOGON_REQUIRED Handle = 0x8009033E - SEC_E_SHUTDOWN_IN_PROGRESS Handle = 0x8009033F - SEC_E_KDC_INVALID_REQUEST Handle = 0x80090340 - SEC_E_KDC_UNABLE_TO_REFER Handle = 0x80090341 - SEC_E_KDC_UNKNOWN_ETYPE Handle = 0x80090342 - SEC_E_UNSUPPORTED_PREAUTH Handle = 0x80090343 - SEC_E_DELEGATION_REQUIRED Handle = 0x80090345 - SEC_E_BAD_BINDINGS Handle = 0x80090346 - SEC_E_MULTIPLE_ACCOUNTS Handle = 0x80090347 - SEC_E_NO_KERB_KEY Handle = 0x80090348 - SEC_E_CERT_WRONG_USAGE Handle = 0x80090349 - SEC_E_DOWNGRADE_DETECTED Handle = 0x80090350 - SEC_E_SMARTCARD_CERT_REVOKED Handle = 0x80090351 - SEC_E_ISSUING_CA_UNTRUSTED Handle = 0x80090352 - SEC_E_REVOCATION_OFFLINE_C Handle = 0x80090353 - SEC_E_PKINIT_CLIENT_FAILURE Handle = 0x80090354 - SEC_E_SMARTCARD_CERT_EXPIRED Handle = 0x80090355 - SEC_E_NO_S4U_PROT_SUPPORT Handle = 0x80090356 - SEC_E_CROSSREALM_DELEGATION_FAILURE Handle = 0x80090357 - SEC_E_REVOCATION_OFFLINE_KDC Handle = 0x80090358 - SEC_E_ISSUING_CA_UNTRUSTED_KDC Handle = 0x80090359 - SEC_E_KDC_CERT_EXPIRED Handle = 0x8009035A - SEC_E_KDC_CERT_REVOKED Handle = 0x8009035B - SEC_I_SIGNATURE_NEEDED Handle = 0x0009035C - SEC_E_INVALID_PARAMETER Handle = 0x8009035D - SEC_E_DELEGATION_POLICY Handle = 0x8009035E - SEC_E_POLICY_NLTM_ONLY Handle = 0x8009035F - SEC_I_NO_RENEGOTIATION Handle = 0x00090360 - SEC_E_NO_CONTEXT Handle = 0x80090361 - SEC_E_PKU2U_CERT_FAILURE Handle = 0x80090362 - SEC_E_MUTUAL_AUTH_FAILED Handle = 0x80090363 - SEC_I_MESSAGE_FRAGMENT Handle = 0x00090364 - SEC_E_ONLY_HTTPS_ALLOWED Handle = 0x80090365 - SEC_I_CONTINUE_NEEDED_MESSAGE_OK Handle = 0x00090366 - SEC_E_APPLICATION_PROTOCOL_MISMATCH Handle = 0x80090367 - SEC_I_ASYNC_CALL_PENDING Handle = 0x00090368 - SEC_E_INVALID_UPN_NAME Handle = 0x80090369 - SEC_E_NO_SPM = SEC_E_INTERNAL_ERROR - SEC_E_NOT_SUPPORTED = SEC_E_UNSUPPORTED_FUNCTION - CRYPT_E_MSG_ERROR Handle = 0x80091001 - CRYPT_E_UNKNOWN_ALGO Handle = 0x80091002 - CRYPT_E_OID_FORMAT Handle = 0x80091003 - CRYPT_E_INVALID_MSG_TYPE Handle = 0x80091004 - CRYPT_E_UNEXPECTED_ENCODING Handle = 0x80091005 - CRYPT_E_AUTH_ATTR_MISSING Handle = 0x80091006 - CRYPT_E_HASH_VALUE Handle = 0x80091007 - CRYPT_E_INVALID_INDEX Handle = 0x80091008 - CRYPT_E_ALREADY_DECRYPTED Handle = 0x80091009 - CRYPT_E_NOT_DECRYPTED Handle = 0x8009100A - CRYPT_E_RECIPIENT_NOT_FOUND Handle = 0x8009100B - CRYPT_E_CONTROL_TYPE Handle = 0x8009100C - CRYPT_E_ISSUER_SERIALNUMBER Handle = 0x8009100D - CRYPT_E_SIGNER_NOT_FOUND Handle = 0x8009100E - CRYPT_E_ATTRIBUTES_MISSING Handle = 0x8009100F - CRYPT_E_STREAM_MSG_NOT_READY Handle = 0x80091010 - CRYPT_E_STREAM_INSUFFICIENT_DATA Handle = 0x80091011 - CRYPT_I_NEW_PROTECTION_REQUIRED Handle = 0x00091012 - CRYPT_E_BAD_LEN Handle = 0x80092001 - CRYPT_E_BAD_ENCODE Handle = 0x80092002 - CRYPT_E_FILE_ERROR Handle = 0x80092003 - CRYPT_E_NOT_FOUND Handle = 0x80092004 - CRYPT_E_EXISTS Handle = 0x80092005 - CRYPT_E_NO_PROVIDER Handle = 0x80092006 - CRYPT_E_SELF_SIGNED Handle = 0x80092007 - CRYPT_E_DELETED_PREV Handle = 0x80092008 - CRYPT_E_NO_MATCH Handle = 0x80092009 - CRYPT_E_UNEXPECTED_MSG_TYPE Handle = 0x8009200A - CRYPT_E_NO_KEY_PROPERTY Handle = 0x8009200B - CRYPT_E_NO_DECRYPT_CERT Handle = 0x8009200C - CRYPT_E_BAD_MSG Handle = 0x8009200D - CRYPT_E_NO_SIGNER Handle = 0x8009200E - CRYPT_E_PENDING_CLOSE Handle = 0x8009200F - CRYPT_E_REVOKED Handle = 0x80092010 - CRYPT_E_NO_REVOCATION_DLL Handle = 0x80092011 - CRYPT_E_NO_REVOCATION_CHECK Handle = 0x80092012 - CRYPT_E_REVOCATION_OFFLINE Handle = 0x80092013 - CRYPT_E_NOT_IN_REVOCATION_DATABASE Handle = 0x80092014 - CRYPT_E_INVALID_NUMERIC_STRING Handle = 0x80092020 - CRYPT_E_INVALID_PRINTABLE_STRING Handle = 0x80092021 - CRYPT_E_INVALID_IA5_STRING Handle = 0x80092022 - CRYPT_E_INVALID_X500_STRING Handle = 0x80092023 - CRYPT_E_NOT_CHAR_STRING Handle = 0x80092024 - CRYPT_E_FILERESIZED Handle = 0x80092025 - CRYPT_E_SECURITY_SETTINGS Handle = 0x80092026 - CRYPT_E_NO_VERIFY_USAGE_DLL Handle = 0x80092027 - CRYPT_E_NO_VERIFY_USAGE_CHECK Handle = 0x80092028 - CRYPT_E_VERIFY_USAGE_OFFLINE Handle = 0x80092029 - CRYPT_E_NOT_IN_CTL Handle = 0x8009202A - CRYPT_E_NO_TRUSTED_SIGNER Handle = 0x8009202B - CRYPT_E_MISSING_PUBKEY_PARA Handle = 0x8009202C - CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND Handle = 0x8009202D - CRYPT_E_OSS_ERROR Handle = 0x80093000 - OSS_MORE_BUF Handle = 0x80093001 - OSS_NEGATIVE_UINTEGER Handle = 0x80093002 - OSS_PDU_RANGE Handle = 0x80093003 - OSS_MORE_INPUT Handle = 0x80093004 - OSS_DATA_ERROR Handle = 0x80093005 - OSS_BAD_ARG Handle = 0x80093006 - OSS_BAD_VERSION Handle = 0x80093007 - OSS_OUT_MEMORY Handle = 0x80093008 - OSS_PDU_MISMATCH Handle = 0x80093009 - OSS_LIMITED Handle = 0x8009300A - OSS_BAD_PTR Handle = 0x8009300B - OSS_BAD_TIME Handle = 0x8009300C - OSS_INDEFINITE_NOT_SUPPORTED Handle = 0x8009300D - OSS_MEM_ERROR Handle = 0x8009300E - OSS_BAD_TABLE Handle = 0x8009300F - OSS_TOO_LONG Handle = 0x80093010 - OSS_CONSTRAINT_VIOLATED Handle = 0x80093011 - OSS_FATAL_ERROR Handle = 0x80093012 - OSS_ACCESS_SERIALIZATION_ERROR Handle = 0x80093013 - OSS_NULL_TBL Handle = 0x80093014 - OSS_NULL_FCN Handle = 0x80093015 - OSS_BAD_ENCRULES Handle = 0x80093016 - OSS_UNAVAIL_ENCRULES Handle = 0x80093017 - OSS_CANT_OPEN_TRACE_WINDOW Handle = 0x80093018 - OSS_UNIMPLEMENTED Handle = 0x80093019 - OSS_OID_DLL_NOT_LINKED Handle = 0x8009301A - OSS_CANT_OPEN_TRACE_FILE Handle = 0x8009301B - OSS_TRACE_FILE_ALREADY_OPEN Handle = 0x8009301C - OSS_TABLE_MISMATCH Handle = 0x8009301D - OSS_TYPE_NOT_SUPPORTED Handle = 0x8009301E - OSS_REAL_DLL_NOT_LINKED Handle = 0x8009301F - OSS_REAL_CODE_NOT_LINKED Handle = 0x80093020 - OSS_OUT_OF_RANGE Handle = 0x80093021 - OSS_COPIER_DLL_NOT_LINKED Handle = 0x80093022 - OSS_CONSTRAINT_DLL_NOT_LINKED Handle = 0x80093023 - OSS_COMPARATOR_DLL_NOT_LINKED Handle = 0x80093024 - OSS_COMPARATOR_CODE_NOT_LINKED Handle = 0x80093025 - OSS_MEM_MGR_DLL_NOT_LINKED Handle = 0x80093026 - OSS_PDV_DLL_NOT_LINKED Handle = 0x80093027 - OSS_PDV_CODE_NOT_LINKED Handle = 0x80093028 - OSS_API_DLL_NOT_LINKED Handle = 0x80093029 - OSS_BERDER_DLL_NOT_LINKED Handle = 0x8009302A - OSS_PER_DLL_NOT_LINKED Handle = 0x8009302B - OSS_OPEN_TYPE_ERROR Handle = 0x8009302C - OSS_MUTEX_NOT_CREATED Handle = 0x8009302D - OSS_CANT_CLOSE_TRACE_FILE Handle = 0x8009302E - CRYPT_E_ASN1_ERROR Handle = 0x80093100 - CRYPT_E_ASN1_INTERNAL Handle = 0x80093101 - CRYPT_E_ASN1_EOD Handle = 0x80093102 - CRYPT_E_ASN1_CORRUPT Handle = 0x80093103 - CRYPT_E_ASN1_LARGE Handle = 0x80093104 - CRYPT_E_ASN1_CONSTRAINT Handle = 0x80093105 - CRYPT_E_ASN1_MEMORY Handle = 0x80093106 - CRYPT_E_ASN1_OVERFLOW Handle = 0x80093107 - CRYPT_E_ASN1_BADPDU Handle = 0x80093108 - CRYPT_E_ASN1_BADARGS Handle = 0x80093109 - CRYPT_E_ASN1_BADREAL Handle = 0x8009310A - CRYPT_E_ASN1_BADTAG Handle = 0x8009310B - CRYPT_E_ASN1_CHOICE Handle = 0x8009310C - CRYPT_E_ASN1_RULE Handle = 0x8009310D - CRYPT_E_ASN1_UTF8 Handle = 0x8009310E - CRYPT_E_ASN1_PDU_TYPE Handle = 0x80093133 - CRYPT_E_ASN1_NYI Handle = 0x80093134 - CRYPT_E_ASN1_EXTENDED Handle = 0x80093201 - CRYPT_E_ASN1_NOEOD Handle = 0x80093202 - CERTSRV_E_BAD_REQUESTSUBJECT Handle = 0x80094001 - CERTSRV_E_NO_REQUEST Handle = 0x80094002 - CERTSRV_E_BAD_REQUESTSTATUS Handle = 0x80094003 - CERTSRV_E_PROPERTY_EMPTY Handle = 0x80094004 - CERTSRV_E_INVALID_CA_CERTIFICATE Handle = 0x80094005 - CERTSRV_E_SERVER_SUSPENDED Handle = 0x80094006 - CERTSRV_E_ENCODING_LENGTH Handle = 0x80094007 - CERTSRV_E_ROLECONFLICT Handle = 0x80094008 - CERTSRV_E_RESTRICTEDOFFICER Handle = 0x80094009 - CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED Handle = 0x8009400A - CERTSRV_E_NO_VALID_KRA Handle = 0x8009400B - CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL Handle = 0x8009400C - CERTSRV_E_NO_CAADMIN_DEFINED Handle = 0x8009400D - CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE Handle = 0x8009400E - CERTSRV_E_NO_DB_SESSIONS Handle = 0x8009400F - CERTSRV_E_ALIGNMENT_FAULT Handle = 0x80094010 - CERTSRV_E_ENROLL_DENIED Handle = 0x80094011 - CERTSRV_E_TEMPLATE_DENIED Handle = 0x80094012 - CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE Handle = 0x80094013 - CERTSRV_E_ADMIN_DENIED_REQUEST Handle = 0x80094014 - CERTSRV_E_NO_POLICY_SERVER Handle = 0x80094015 - CERTSRV_E_WEAK_SIGNATURE_OR_KEY Handle = 0x80094016 - CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED Handle = 0x80094017 - CERTSRV_E_ENCRYPTION_CERT_REQUIRED Handle = 0x80094018 - CERTSRV_E_UNSUPPORTED_CERT_TYPE Handle = 0x80094800 - CERTSRV_E_NO_CERT_TYPE Handle = 0x80094801 - CERTSRV_E_TEMPLATE_CONFLICT Handle = 0x80094802 - CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED Handle = 0x80094803 - CERTSRV_E_ARCHIVED_KEY_REQUIRED Handle = 0x80094804 - CERTSRV_E_SMIME_REQUIRED Handle = 0x80094805 - CERTSRV_E_BAD_RENEWAL_SUBJECT Handle = 0x80094806 - CERTSRV_E_BAD_TEMPLATE_VERSION Handle = 0x80094807 - CERTSRV_E_TEMPLATE_POLICY_REQUIRED Handle = 0x80094808 - CERTSRV_E_SIGNATURE_POLICY_REQUIRED Handle = 0x80094809 - CERTSRV_E_SIGNATURE_COUNT Handle = 0x8009480A - CERTSRV_E_SIGNATURE_REJECTED Handle = 0x8009480B - CERTSRV_E_ISSUANCE_POLICY_REQUIRED Handle = 0x8009480C - CERTSRV_E_SUBJECT_UPN_REQUIRED Handle = 0x8009480D - CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED Handle = 0x8009480E - CERTSRV_E_SUBJECT_DNS_REQUIRED Handle = 0x8009480F - CERTSRV_E_ARCHIVED_KEY_UNEXPECTED Handle = 0x80094810 - CERTSRV_E_KEY_LENGTH Handle = 0x80094811 - CERTSRV_E_SUBJECT_EMAIL_REQUIRED Handle = 0x80094812 - CERTSRV_E_UNKNOWN_CERT_TYPE Handle = 0x80094813 - CERTSRV_E_CERT_TYPE_OVERLAP Handle = 0x80094814 - CERTSRV_E_TOO_MANY_SIGNATURES Handle = 0x80094815 - CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY Handle = 0x80094816 - CERTSRV_E_INVALID_EK Handle = 0x80094817 - CERTSRV_E_INVALID_IDBINDING Handle = 0x80094818 - CERTSRV_E_INVALID_ATTESTATION Handle = 0x80094819 - CERTSRV_E_KEY_ATTESTATION Handle = 0x8009481A - CERTSRV_E_CORRUPT_KEY_ATTESTATION Handle = 0x8009481B - CERTSRV_E_EXPIRED_CHALLENGE Handle = 0x8009481C - CERTSRV_E_INVALID_RESPONSE Handle = 0x8009481D - CERTSRV_E_INVALID_REQUESTID Handle = 0x8009481E - CERTSRV_E_REQUEST_PRECERTIFICATE_MISMATCH Handle = 0x8009481F - CERTSRV_E_PENDING_CLIENT_RESPONSE Handle = 0x80094820 - XENROLL_E_KEY_NOT_EXPORTABLE Handle = 0x80095000 - XENROLL_E_CANNOT_ADD_ROOT_CERT Handle = 0x80095001 - XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND Handle = 0x80095002 - XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH Handle = 0x80095003 - XENROLL_E_RESPONSE_KA_HASH_MISMATCH Handle = 0x80095004 - XENROLL_E_KEYSPEC_SMIME_MISMATCH Handle = 0x80095005 - TRUST_E_SYSTEM_ERROR Handle = 0x80096001 - TRUST_E_NO_SIGNER_CERT Handle = 0x80096002 - TRUST_E_COUNTER_SIGNER Handle = 0x80096003 - TRUST_E_CERT_SIGNATURE Handle = 0x80096004 - TRUST_E_TIME_STAMP Handle = 0x80096005 - TRUST_E_BAD_DIGEST Handle = 0x80096010 - TRUST_E_MALFORMED_SIGNATURE Handle = 0x80096011 - TRUST_E_BASIC_CONSTRAINTS Handle = 0x80096019 - TRUST_E_FINANCIAL_CRITERIA Handle = 0x8009601E - MSSIPOTF_E_OUTOFMEMRANGE Handle = 0x80097001 - MSSIPOTF_E_CANTGETOBJECT Handle = 0x80097002 - MSSIPOTF_E_NOHEADTABLE Handle = 0x80097003 - MSSIPOTF_E_BAD_MAGICNUMBER Handle = 0x80097004 - MSSIPOTF_E_BAD_OFFSET_TABLE Handle = 0x80097005 - MSSIPOTF_E_TABLE_TAGORDER Handle = 0x80097006 - MSSIPOTF_E_TABLE_LONGWORD Handle = 0x80097007 - MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT Handle = 0x80097008 - MSSIPOTF_E_TABLES_OVERLAP Handle = 0x80097009 - MSSIPOTF_E_TABLE_PADBYTES Handle = 0x8009700A - MSSIPOTF_E_FILETOOSMALL Handle = 0x8009700B - MSSIPOTF_E_TABLE_CHECKSUM Handle = 0x8009700C - MSSIPOTF_E_FILE_CHECKSUM Handle = 0x8009700D - MSSIPOTF_E_FAILED_POLICY Handle = 0x80097010 - MSSIPOTF_E_FAILED_HINTS_CHECK Handle = 0x80097011 - MSSIPOTF_E_NOT_OPENTYPE Handle = 0x80097012 - MSSIPOTF_E_FILE Handle = 0x80097013 - MSSIPOTF_E_CRYPT Handle = 0x80097014 - MSSIPOTF_E_BADVERSION Handle = 0x80097015 - MSSIPOTF_E_DSIG_STRUCTURE Handle = 0x80097016 - MSSIPOTF_E_PCONST_CHECK Handle = 0x80097017 - MSSIPOTF_E_STRUCTURE Handle = 0x80097018 - ERROR_CRED_REQUIRES_CONFIRMATION Handle = 0x80097019 - NTE_OP_OK syscall.Errno = 0 - TRUST_E_PROVIDER_UNKNOWN Handle = 0x800B0001 - TRUST_E_ACTION_UNKNOWN Handle = 0x800B0002 - TRUST_E_SUBJECT_FORM_UNKNOWN Handle = 0x800B0003 - TRUST_E_SUBJECT_NOT_TRUSTED Handle = 0x800B0004 - DIGSIG_E_ENCODE Handle = 0x800B0005 - DIGSIG_E_DECODE Handle = 0x800B0006 - DIGSIG_E_EXTENSIBILITY Handle = 0x800B0007 - DIGSIG_E_CRYPTO Handle = 0x800B0008 - PERSIST_E_SIZEDEFINITE Handle = 0x800B0009 - PERSIST_E_SIZEINDEFINITE Handle = 0x800B000A - PERSIST_E_NOTSELFSIZING Handle = 0x800B000B - TRUST_E_NOSIGNATURE Handle = 0x800B0100 - CERT_E_EXPIRED Handle = 0x800B0101 - CERT_E_VALIDITYPERIODNESTING Handle = 0x800B0102 - CERT_E_ROLE Handle = 0x800B0103 - CERT_E_PATHLENCONST Handle = 0x800B0104 - CERT_E_CRITICAL Handle = 0x800B0105 - CERT_E_PURPOSE Handle = 0x800B0106 - CERT_E_ISSUERCHAINING Handle = 0x800B0107 - CERT_E_MALFORMED Handle = 0x800B0108 - CERT_E_UNTRUSTEDROOT Handle = 0x800B0109 - CERT_E_CHAINING Handle = 0x800B010A - TRUST_E_FAIL Handle = 0x800B010B - CERT_E_REVOKED Handle = 0x800B010C - CERT_E_UNTRUSTEDTESTROOT Handle = 0x800B010D - CERT_E_REVOCATION_FAILURE Handle = 0x800B010E - CERT_E_CN_NO_MATCH Handle = 0x800B010F - CERT_E_WRONG_USAGE Handle = 0x800B0110 - TRUST_E_EXPLICIT_DISTRUST Handle = 0x800B0111 - CERT_E_UNTRUSTEDCA Handle = 0x800B0112 - CERT_E_INVALID_POLICY Handle = 0x800B0113 - CERT_E_INVALID_NAME Handle = 0x800B0114 - SPAPI_E_EXPECTED_SECTION_NAME Handle = 0x800F0000 - SPAPI_E_BAD_SECTION_NAME_LINE Handle = 0x800F0001 - SPAPI_E_SECTION_NAME_TOO_LONG Handle = 0x800F0002 - SPAPI_E_GENERAL_SYNTAX Handle = 0x800F0003 - SPAPI_E_WRONG_INF_STYLE Handle = 0x800F0100 - SPAPI_E_SECTION_NOT_FOUND Handle = 0x800F0101 - SPAPI_E_LINE_NOT_FOUND Handle = 0x800F0102 - SPAPI_E_NO_BACKUP Handle = 0x800F0103 - SPAPI_E_NO_ASSOCIATED_CLASS Handle = 0x800F0200 - SPAPI_E_CLASS_MISMATCH Handle = 0x800F0201 - SPAPI_E_DUPLICATE_FOUND Handle = 0x800F0202 - SPAPI_E_NO_DRIVER_SELECTED Handle = 0x800F0203 - SPAPI_E_KEY_DOES_NOT_EXIST Handle = 0x800F0204 - SPAPI_E_INVALID_DEVINST_NAME Handle = 0x800F0205 - SPAPI_E_INVALID_CLASS Handle = 0x800F0206 - SPAPI_E_DEVINST_ALREADY_EXISTS Handle = 0x800F0207 - SPAPI_E_DEVINFO_NOT_REGISTERED Handle = 0x800F0208 - SPAPI_E_INVALID_REG_PROPERTY Handle = 0x800F0209 - SPAPI_E_NO_INF Handle = 0x800F020A - SPAPI_E_NO_SUCH_DEVINST Handle = 0x800F020B - SPAPI_E_CANT_LOAD_CLASS_ICON Handle = 0x800F020C - SPAPI_E_INVALID_CLASS_INSTALLER Handle = 0x800F020D - SPAPI_E_DI_DO_DEFAULT Handle = 0x800F020E - SPAPI_E_DI_NOFILECOPY Handle = 0x800F020F - SPAPI_E_INVALID_HWPROFILE Handle = 0x800F0210 - SPAPI_E_NO_DEVICE_SELECTED Handle = 0x800F0211 - SPAPI_E_DEVINFO_LIST_LOCKED Handle = 0x800F0212 - SPAPI_E_DEVINFO_DATA_LOCKED Handle = 0x800F0213 - SPAPI_E_DI_BAD_PATH Handle = 0x800F0214 - SPAPI_E_NO_CLASSINSTALL_PARAMS Handle = 0x800F0215 - SPAPI_E_FILEQUEUE_LOCKED Handle = 0x800F0216 - SPAPI_E_BAD_SERVICE_INSTALLSECT Handle = 0x800F0217 - SPAPI_E_NO_CLASS_DRIVER_LIST Handle = 0x800F0218 - SPAPI_E_NO_ASSOCIATED_SERVICE Handle = 0x800F0219 - SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE Handle = 0x800F021A - SPAPI_E_DEVICE_INTERFACE_ACTIVE Handle = 0x800F021B - SPAPI_E_DEVICE_INTERFACE_REMOVED Handle = 0x800F021C - SPAPI_E_BAD_INTERFACE_INSTALLSECT Handle = 0x800F021D - SPAPI_E_NO_SUCH_INTERFACE_CLASS Handle = 0x800F021E - SPAPI_E_INVALID_REFERENCE_STRING Handle = 0x800F021F - SPAPI_E_INVALID_MACHINENAME Handle = 0x800F0220 - SPAPI_E_REMOTE_COMM_FAILURE Handle = 0x800F0221 - SPAPI_E_MACHINE_UNAVAILABLE Handle = 0x800F0222 - SPAPI_E_NO_CONFIGMGR_SERVICES Handle = 0x800F0223 - SPAPI_E_INVALID_PROPPAGE_PROVIDER Handle = 0x800F0224 - SPAPI_E_NO_SUCH_DEVICE_INTERFACE Handle = 0x800F0225 - SPAPI_E_DI_POSTPROCESSING_REQUIRED Handle = 0x800F0226 - SPAPI_E_INVALID_COINSTALLER Handle = 0x800F0227 - SPAPI_E_NO_COMPAT_DRIVERS Handle = 0x800F0228 - SPAPI_E_NO_DEVICE_ICON Handle = 0x800F0229 - SPAPI_E_INVALID_INF_LOGCONFIG Handle = 0x800F022A - SPAPI_E_DI_DONT_INSTALL Handle = 0x800F022B - SPAPI_E_INVALID_FILTER_DRIVER Handle = 0x800F022C - SPAPI_E_NON_WINDOWS_NT_DRIVER Handle = 0x800F022D - SPAPI_E_NON_WINDOWS_DRIVER Handle = 0x800F022E - SPAPI_E_NO_CATALOG_FOR_OEM_INF Handle = 0x800F022F - SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE Handle = 0x800F0230 - SPAPI_E_NOT_DISABLEABLE Handle = 0x800F0231 - SPAPI_E_CANT_REMOVE_DEVINST Handle = 0x800F0232 - SPAPI_E_INVALID_TARGET Handle = 0x800F0233 - SPAPI_E_DRIVER_NONNATIVE Handle = 0x800F0234 - SPAPI_E_IN_WOW64 Handle = 0x800F0235 - SPAPI_E_SET_SYSTEM_RESTORE_POINT Handle = 0x800F0236 - SPAPI_E_INCORRECTLY_COPIED_INF Handle = 0x800F0237 - SPAPI_E_SCE_DISABLED Handle = 0x800F0238 - SPAPI_E_UNKNOWN_EXCEPTION Handle = 0x800F0239 - SPAPI_E_PNP_REGISTRY_ERROR Handle = 0x800F023A - SPAPI_E_REMOTE_REQUEST_UNSUPPORTED Handle = 0x800F023B - SPAPI_E_NOT_AN_INSTALLED_OEM_INF Handle = 0x800F023C - SPAPI_E_INF_IN_USE_BY_DEVICES Handle = 0x800F023D - SPAPI_E_DI_FUNCTION_OBSOLETE Handle = 0x800F023E - SPAPI_E_NO_AUTHENTICODE_CATALOG Handle = 0x800F023F - SPAPI_E_AUTHENTICODE_DISALLOWED Handle = 0x800F0240 - SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER Handle = 0x800F0241 - SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED Handle = 0x800F0242 - SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED Handle = 0x800F0243 - SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH Handle = 0x800F0244 - SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE Handle = 0x800F0245 - SPAPI_E_DEVICE_INSTALLER_NOT_READY Handle = 0x800F0246 - SPAPI_E_DRIVER_STORE_ADD_FAILED Handle = 0x800F0247 - SPAPI_E_DEVICE_INSTALL_BLOCKED Handle = 0x800F0248 - SPAPI_E_DRIVER_INSTALL_BLOCKED Handle = 0x800F0249 - SPAPI_E_WRONG_INF_TYPE Handle = 0x800F024A - SPAPI_E_FILE_HASH_NOT_IN_CATALOG Handle = 0x800F024B - SPAPI_E_DRIVER_STORE_DELETE_FAILED Handle = 0x800F024C - SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW Handle = 0x800F0300 - SPAPI_E_ERROR_NOT_INSTALLED Handle = 0x800F1000 - SCARD_S_SUCCESS = S_OK - SCARD_F_INTERNAL_ERROR Handle = 0x80100001 - SCARD_E_CANCELLED Handle = 0x80100002 - SCARD_E_INVALID_HANDLE Handle = 0x80100003 - SCARD_E_INVALID_PARAMETER Handle = 0x80100004 - SCARD_E_INVALID_TARGET Handle = 0x80100005 - SCARD_E_NO_MEMORY Handle = 0x80100006 - SCARD_F_WAITED_TOO_LONG Handle = 0x80100007 - SCARD_E_INSUFFICIENT_BUFFER Handle = 0x80100008 - SCARD_E_UNKNOWN_READER Handle = 0x80100009 - SCARD_E_TIMEOUT Handle = 0x8010000A - SCARD_E_SHARING_VIOLATION Handle = 0x8010000B - SCARD_E_NO_SMARTCARD Handle = 0x8010000C - SCARD_E_UNKNOWN_CARD Handle = 0x8010000D - SCARD_E_CANT_DISPOSE Handle = 0x8010000E - SCARD_E_PROTO_MISMATCH Handle = 0x8010000F - SCARD_E_NOT_READY Handle = 0x80100010 - SCARD_E_INVALID_VALUE Handle = 0x80100011 - SCARD_E_SYSTEM_CANCELLED Handle = 0x80100012 - SCARD_F_COMM_ERROR Handle = 0x80100013 - SCARD_F_UNKNOWN_ERROR Handle = 0x80100014 - SCARD_E_INVALID_ATR Handle = 0x80100015 - SCARD_E_NOT_TRANSACTED Handle = 0x80100016 - SCARD_E_READER_UNAVAILABLE Handle = 0x80100017 - SCARD_P_SHUTDOWN Handle = 0x80100018 - SCARD_E_PCI_TOO_SMALL Handle = 0x80100019 - SCARD_E_READER_UNSUPPORTED Handle = 0x8010001A - SCARD_E_DUPLICATE_READER Handle = 0x8010001B - SCARD_E_CARD_UNSUPPORTED Handle = 0x8010001C - SCARD_E_NO_SERVICE Handle = 0x8010001D - SCARD_E_SERVICE_STOPPED Handle = 0x8010001E - SCARD_E_UNEXPECTED Handle = 0x8010001F - SCARD_E_ICC_INSTALLATION Handle = 0x80100020 - SCARD_E_ICC_CREATEORDER Handle = 0x80100021 - SCARD_E_UNSUPPORTED_FEATURE Handle = 0x80100022 - SCARD_E_DIR_NOT_FOUND Handle = 0x80100023 - SCARD_E_FILE_NOT_FOUND Handle = 0x80100024 - SCARD_E_NO_DIR Handle = 0x80100025 - SCARD_E_NO_FILE Handle = 0x80100026 - SCARD_E_NO_ACCESS Handle = 0x80100027 - SCARD_E_WRITE_TOO_MANY Handle = 0x80100028 - SCARD_E_BAD_SEEK Handle = 0x80100029 - SCARD_E_INVALID_CHV Handle = 0x8010002A - SCARD_E_UNKNOWN_RES_MNG Handle = 0x8010002B - SCARD_E_NO_SUCH_CERTIFICATE Handle = 0x8010002C - SCARD_E_CERTIFICATE_UNAVAILABLE Handle = 0x8010002D - SCARD_E_NO_READERS_AVAILABLE Handle = 0x8010002E - SCARD_E_COMM_DATA_LOST Handle = 0x8010002F - SCARD_E_NO_KEY_CONTAINER Handle = 0x80100030 - SCARD_E_SERVER_TOO_BUSY Handle = 0x80100031 - SCARD_E_PIN_CACHE_EXPIRED Handle = 0x80100032 - SCARD_E_NO_PIN_CACHE Handle = 0x80100033 - SCARD_E_READ_ONLY_CARD Handle = 0x80100034 - SCARD_W_UNSUPPORTED_CARD Handle = 0x80100065 - SCARD_W_UNRESPONSIVE_CARD Handle = 0x80100066 - SCARD_W_UNPOWERED_CARD Handle = 0x80100067 - SCARD_W_RESET_CARD Handle = 0x80100068 - SCARD_W_REMOVED_CARD Handle = 0x80100069 - SCARD_W_SECURITY_VIOLATION Handle = 0x8010006A - SCARD_W_WRONG_CHV Handle = 0x8010006B - SCARD_W_CHV_BLOCKED Handle = 0x8010006C - SCARD_W_EOF Handle = 0x8010006D - SCARD_W_CANCELLED_BY_USER Handle = 0x8010006E - SCARD_W_CARD_NOT_AUTHENTICATED Handle = 0x8010006F - SCARD_W_CACHE_ITEM_NOT_FOUND Handle = 0x80100070 - SCARD_W_CACHE_ITEM_STALE Handle = 0x80100071 - SCARD_W_CACHE_ITEM_TOO_BIG Handle = 0x80100072 - COMADMIN_E_OBJECTERRORS Handle = 0x80110401 - COMADMIN_E_OBJECTINVALID Handle = 0x80110402 - COMADMIN_E_KEYMISSING Handle = 0x80110403 - COMADMIN_E_ALREADYINSTALLED Handle = 0x80110404 - COMADMIN_E_APP_FILE_WRITEFAIL Handle = 0x80110407 - COMADMIN_E_APP_FILE_READFAIL Handle = 0x80110408 - COMADMIN_E_APP_FILE_VERSION Handle = 0x80110409 - COMADMIN_E_BADPATH Handle = 0x8011040A - COMADMIN_E_APPLICATIONEXISTS Handle = 0x8011040B - COMADMIN_E_ROLEEXISTS Handle = 0x8011040C - COMADMIN_E_CANTCOPYFILE Handle = 0x8011040D - COMADMIN_E_NOUSER Handle = 0x8011040F - COMADMIN_E_INVALIDUSERIDS Handle = 0x80110410 - COMADMIN_E_NOREGISTRYCLSID Handle = 0x80110411 - COMADMIN_E_BADREGISTRYPROGID Handle = 0x80110412 - COMADMIN_E_AUTHENTICATIONLEVEL Handle = 0x80110413 - COMADMIN_E_USERPASSWDNOTVALID Handle = 0x80110414 - COMADMIN_E_CLSIDORIIDMISMATCH Handle = 0x80110418 - COMADMIN_E_REMOTEINTERFACE Handle = 0x80110419 - COMADMIN_E_DLLREGISTERSERVER Handle = 0x8011041A - COMADMIN_E_NOSERVERSHARE Handle = 0x8011041B - COMADMIN_E_DLLLOADFAILED Handle = 0x8011041D - COMADMIN_E_BADREGISTRYLIBID Handle = 0x8011041E - COMADMIN_E_APPDIRNOTFOUND Handle = 0x8011041F - COMADMIN_E_REGISTRARFAILED Handle = 0x80110423 - COMADMIN_E_COMPFILE_DOESNOTEXIST Handle = 0x80110424 - COMADMIN_E_COMPFILE_LOADDLLFAIL Handle = 0x80110425 - COMADMIN_E_COMPFILE_GETCLASSOBJ Handle = 0x80110426 - COMADMIN_E_COMPFILE_CLASSNOTAVAIL Handle = 0x80110427 - COMADMIN_E_COMPFILE_BADTLB Handle = 0x80110428 - COMADMIN_E_COMPFILE_NOTINSTALLABLE Handle = 0x80110429 - COMADMIN_E_NOTCHANGEABLE Handle = 0x8011042A - COMADMIN_E_NOTDELETEABLE Handle = 0x8011042B - COMADMIN_E_SESSION Handle = 0x8011042C - COMADMIN_E_COMP_MOVE_LOCKED Handle = 0x8011042D - COMADMIN_E_COMP_MOVE_BAD_DEST Handle = 0x8011042E - COMADMIN_E_REGISTERTLB Handle = 0x80110430 - COMADMIN_E_SYSTEMAPP Handle = 0x80110433 - COMADMIN_E_COMPFILE_NOREGISTRAR Handle = 0x80110434 - COMADMIN_E_COREQCOMPINSTALLED Handle = 0x80110435 - COMADMIN_E_SERVICENOTINSTALLED Handle = 0x80110436 - COMADMIN_E_PROPERTYSAVEFAILED Handle = 0x80110437 - COMADMIN_E_OBJECTEXISTS Handle = 0x80110438 - COMADMIN_E_COMPONENTEXISTS Handle = 0x80110439 - COMADMIN_E_REGFILE_CORRUPT Handle = 0x8011043B - COMADMIN_E_PROPERTY_OVERFLOW Handle = 0x8011043C - COMADMIN_E_NOTINREGISTRY Handle = 0x8011043E - COMADMIN_E_OBJECTNOTPOOLABLE Handle = 0x8011043F - COMADMIN_E_APPLID_MATCHES_CLSID Handle = 0x80110446 - COMADMIN_E_ROLE_DOES_NOT_EXIST Handle = 0x80110447 - COMADMIN_E_START_APP_NEEDS_COMPONENTS Handle = 0x80110448 - COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM Handle = 0x80110449 - COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY Handle = 0x8011044A - COMADMIN_E_CAN_NOT_START_APP Handle = 0x8011044B - COMADMIN_E_CAN_NOT_EXPORT_SYS_APP Handle = 0x8011044C - COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT Handle = 0x8011044D - COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER Handle = 0x8011044E - COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE Handle = 0x8011044F - COMADMIN_E_BASE_PARTITION_ONLY Handle = 0x80110450 - COMADMIN_E_START_APP_DISABLED Handle = 0x80110451 - COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME Handle = 0x80110457 - COMADMIN_E_CAT_INVALID_PARTITION_NAME Handle = 0x80110458 - COMADMIN_E_CAT_PARTITION_IN_USE Handle = 0x80110459 - COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES Handle = 0x8011045A - COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED Handle = 0x8011045B - COMADMIN_E_AMBIGUOUS_APPLICATION_NAME Handle = 0x8011045C - COMADMIN_E_AMBIGUOUS_PARTITION_NAME Handle = 0x8011045D - COMADMIN_E_REGDB_NOTINITIALIZED Handle = 0x80110472 - COMADMIN_E_REGDB_NOTOPEN Handle = 0x80110473 - COMADMIN_E_REGDB_SYSTEMERR Handle = 0x80110474 - COMADMIN_E_REGDB_ALREADYRUNNING Handle = 0x80110475 - COMADMIN_E_MIG_VERSIONNOTSUPPORTED Handle = 0x80110480 - COMADMIN_E_MIG_SCHEMANOTFOUND Handle = 0x80110481 - COMADMIN_E_CAT_BITNESSMISMATCH Handle = 0x80110482 - COMADMIN_E_CAT_UNACCEPTABLEBITNESS Handle = 0x80110483 - COMADMIN_E_CAT_WRONGAPPBITNESS Handle = 0x80110484 - COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED Handle = 0x80110485 - COMADMIN_E_CAT_SERVERFAULT Handle = 0x80110486 - COMQC_E_APPLICATION_NOT_QUEUED Handle = 0x80110600 - COMQC_E_NO_QUEUEABLE_INTERFACES Handle = 0x80110601 - COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE Handle = 0x80110602 - COMQC_E_NO_IPERSISTSTREAM Handle = 0x80110603 - COMQC_E_BAD_MESSAGE Handle = 0x80110604 - COMQC_E_UNAUTHENTICATED Handle = 0x80110605 - COMQC_E_UNTRUSTED_ENQUEUER Handle = 0x80110606 - MSDTC_E_DUPLICATE_RESOURCE Handle = 0x80110701 - COMADMIN_E_OBJECT_PARENT_MISSING Handle = 0x80110808 - COMADMIN_E_OBJECT_DOES_NOT_EXIST Handle = 0x80110809 - COMADMIN_E_APP_NOT_RUNNING Handle = 0x8011080A - COMADMIN_E_INVALID_PARTITION Handle = 0x8011080B - COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE Handle = 0x8011080D - COMADMIN_E_USER_IN_SET Handle = 0x8011080E - COMADMIN_E_CANTRECYCLELIBRARYAPPS Handle = 0x8011080F - COMADMIN_E_CANTRECYCLESERVICEAPPS Handle = 0x80110811 - COMADMIN_E_PROCESSALREADYRECYCLED Handle = 0x80110812 - COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED Handle = 0x80110813 - COMADMIN_E_CANTMAKEINPROCSERVICE Handle = 0x80110814 - COMADMIN_E_PROGIDINUSEBYCLSID Handle = 0x80110815 - COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET Handle = 0x80110816 - COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED Handle = 0x80110817 - COMADMIN_E_PARTITION_ACCESSDENIED Handle = 0x80110818 - COMADMIN_E_PARTITION_MSI_ONLY Handle = 0x80110819 - COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT Handle = 0x8011081A - COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS Handle = 0x8011081B - COMADMIN_E_COMP_MOVE_SOURCE Handle = 0x8011081C - COMADMIN_E_COMP_MOVE_DEST Handle = 0x8011081D - COMADMIN_E_COMP_MOVE_PRIVATE Handle = 0x8011081E - COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET Handle = 0x8011081F - COMADMIN_E_CANNOT_ALIAS_EVENTCLASS Handle = 0x80110820 - COMADMIN_E_PRIVATE_ACCESSDENIED Handle = 0x80110821 - COMADMIN_E_SAFERINVALID Handle = 0x80110822 - COMADMIN_E_REGISTRY_ACCESSDENIED Handle = 0x80110823 - COMADMIN_E_PARTITIONS_DISABLED Handle = 0x80110824 - WER_S_REPORT_DEBUG Handle = 0x001B0000 - WER_S_REPORT_UPLOADED Handle = 0x001B0001 - WER_S_REPORT_QUEUED Handle = 0x001B0002 - WER_S_DISABLED Handle = 0x001B0003 - WER_S_SUSPENDED_UPLOAD Handle = 0x001B0004 - WER_S_DISABLED_QUEUE Handle = 0x001B0005 - WER_S_DISABLED_ARCHIVE Handle = 0x001B0006 - WER_S_REPORT_ASYNC Handle = 0x001B0007 - WER_S_IGNORE_ASSERT_INSTANCE Handle = 0x001B0008 - WER_S_IGNORE_ALL_ASSERTS Handle = 0x001B0009 - WER_S_ASSERT_CONTINUE Handle = 0x001B000A - WER_S_THROTTLED Handle = 0x001B000B - WER_S_REPORT_UPLOADED_CAB Handle = 0x001B000C - WER_E_CRASH_FAILURE Handle = 0x801B8000 - WER_E_CANCELED Handle = 0x801B8001 - WER_E_NETWORK_FAILURE Handle = 0x801B8002 - WER_E_NOT_INITIALIZED Handle = 0x801B8003 - WER_E_ALREADY_REPORTING Handle = 0x801B8004 - WER_E_DUMP_THROTTLED Handle = 0x801B8005 - WER_E_INSUFFICIENT_CONSENT Handle = 0x801B8006 - WER_E_TOO_HEAVY Handle = 0x801B8007 - ERROR_FLT_IO_COMPLETE Handle = 0x001F0001 - ERROR_FLT_NO_HANDLER_DEFINED Handle = 0x801F0001 - ERROR_FLT_CONTEXT_ALREADY_DEFINED Handle = 0x801F0002 - ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST Handle = 0x801F0003 - ERROR_FLT_DISALLOW_FAST_IO Handle = 0x801F0004 - ERROR_FLT_INVALID_NAME_REQUEST Handle = 0x801F0005 - ERROR_FLT_NOT_SAFE_TO_POST_OPERATION Handle = 0x801F0006 - ERROR_FLT_NOT_INITIALIZED Handle = 0x801F0007 - ERROR_FLT_FILTER_NOT_READY Handle = 0x801F0008 - ERROR_FLT_POST_OPERATION_CLEANUP Handle = 0x801F0009 - ERROR_FLT_INTERNAL_ERROR Handle = 0x801F000A - ERROR_FLT_DELETING_OBJECT Handle = 0x801F000B - ERROR_FLT_MUST_BE_NONPAGED_POOL Handle = 0x801F000C - ERROR_FLT_DUPLICATE_ENTRY Handle = 0x801F000D - ERROR_FLT_CBDQ_DISABLED Handle = 0x801F000E - ERROR_FLT_DO_NOT_ATTACH Handle = 0x801F000F - ERROR_FLT_DO_NOT_DETACH Handle = 0x801F0010 - ERROR_FLT_INSTANCE_ALTITUDE_COLLISION Handle = 0x801F0011 - ERROR_FLT_INSTANCE_NAME_COLLISION Handle = 0x801F0012 - ERROR_FLT_FILTER_NOT_FOUND Handle = 0x801F0013 - ERROR_FLT_VOLUME_NOT_FOUND Handle = 0x801F0014 - ERROR_FLT_INSTANCE_NOT_FOUND Handle = 0x801F0015 - ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND Handle = 0x801F0016 - ERROR_FLT_INVALID_CONTEXT_REGISTRATION Handle = 0x801F0017 - ERROR_FLT_NAME_CACHE_MISS Handle = 0x801F0018 - ERROR_FLT_NO_DEVICE_OBJECT Handle = 0x801F0019 - ERROR_FLT_VOLUME_ALREADY_MOUNTED Handle = 0x801F001A - ERROR_FLT_ALREADY_ENLISTED Handle = 0x801F001B - ERROR_FLT_CONTEXT_ALREADY_LINKED Handle = 0x801F001C - ERROR_FLT_NO_WAITER_FOR_REPLY Handle = 0x801F0020 - ERROR_FLT_REGISTRATION_BUSY Handle = 0x801F0023 - ERROR_HUNG_DISPLAY_DRIVER_THREAD Handle = 0x80260001 - DWM_E_COMPOSITIONDISABLED Handle = 0x80263001 - DWM_E_REMOTING_NOT_SUPPORTED Handle = 0x80263002 - DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x80263003 - DWM_E_NOT_QUEUING_PRESENTS Handle = 0x80263004 - DWM_E_ADAPTER_NOT_FOUND Handle = 0x80263005 - DWM_S_GDI_REDIRECTION_SURFACE Handle = 0x00263005 - DWM_E_TEXTURE_TOO_LARGE Handle = 0x80263007 - DWM_S_GDI_REDIRECTION_SURFACE_BLT_VIA_GDI Handle = 0x00263008 - ERROR_MONITOR_NO_DESCRIPTOR Handle = 0x00261001 - ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT Handle = 0x00261002 - ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM Handle = 0xC0261003 - ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK Handle = 0xC0261004 - ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED Handle = 0xC0261005 - ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK Handle = 0xC0261006 - ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK Handle = 0xC0261007 - ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA Handle = 0xC0261008 - ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK Handle = 0xC0261009 - ERROR_MONITOR_INVALID_MANUFACTURE_DATE Handle = 0xC026100A - ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER Handle = 0xC0262000 - ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER Handle = 0xC0262001 - ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER Handle = 0xC0262002 - ERROR_GRAPHICS_ADAPTER_WAS_RESET Handle = 0xC0262003 - ERROR_GRAPHICS_INVALID_DRIVER_MODEL Handle = 0xC0262004 - ERROR_GRAPHICS_PRESENT_MODE_CHANGED Handle = 0xC0262005 - ERROR_GRAPHICS_PRESENT_OCCLUDED Handle = 0xC0262006 - ERROR_GRAPHICS_PRESENT_DENIED Handle = 0xC0262007 - ERROR_GRAPHICS_CANNOTCOLORCONVERT Handle = 0xC0262008 - ERROR_GRAPHICS_DRIVER_MISMATCH Handle = 0xC0262009 - ERROR_GRAPHICS_PARTIAL_DATA_POPULATED Handle = 0x4026200A - ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED Handle = 0xC026200B - ERROR_GRAPHICS_PRESENT_UNOCCLUDED Handle = 0xC026200C - ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE Handle = 0xC026200D - ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED Handle = 0xC026200E - ERROR_GRAPHICS_PRESENT_INVALID_WINDOW Handle = 0xC026200F - ERROR_GRAPHICS_PRESENT_BUFFER_NOT_BOUND Handle = 0xC0262010 - ERROR_GRAPHICS_VAIL_STATE_CHANGED Handle = 0xC0262011 - ERROR_GRAPHICS_NO_VIDEO_MEMORY Handle = 0xC0262100 - ERROR_GRAPHICS_CANT_LOCK_MEMORY Handle = 0xC0262101 - ERROR_GRAPHICS_ALLOCATION_BUSY Handle = 0xC0262102 - ERROR_GRAPHICS_TOO_MANY_REFERENCES Handle = 0xC0262103 - ERROR_GRAPHICS_TRY_AGAIN_LATER Handle = 0xC0262104 - ERROR_GRAPHICS_TRY_AGAIN_NOW Handle = 0xC0262105 - ERROR_GRAPHICS_ALLOCATION_INVALID Handle = 0xC0262106 - ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE Handle = 0xC0262107 - ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED Handle = 0xC0262108 - ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION Handle = 0xC0262109 - ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE Handle = 0xC0262110 - ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION Handle = 0xC0262111 - ERROR_GRAPHICS_ALLOCATION_CLOSED Handle = 0xC0262112 - ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE Handle = 0xC0262113 - ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE Handle = 0xC0262114 - ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE Handle = 0xC0262115 - ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST Handle = 0xC0262116 - ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE Handle = 0xC0262200 - ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION Handle = 0x40262201 - ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY Handle = 0xC0262300 - ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED Handle = 0xC0262301 - ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED Handle = 0xC0262302 - ERROR_GRAPHICS_INVALID_VIDPN Handle = 0xC0262303 - ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE Handle = 0xC0262304 - ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET Handle = 0xC0262305 - ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED Handle = 0xC0262306 - ERROR_GRAPHICS_MODE_NOT_PINNED Handle = 0x00262307 - ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET Handle = 0xC0262308 - ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET Handle = 0xC0262309 - ERROR_GRAPHICS_INVALID_FREQUENCY Handle = 0xC026230A - ERROR_GRAPHICS_INVALID_ACTIVE_REGION Handle = 0xC026230B - ERROR_GRAPHICS_INVALID_TOTAL_REGION Handle = 0xC026230C - ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE Handle = 0xC0262310 - ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE Handle = 0xC0262311 - ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET Handle = 0xC0262312 - ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY Handle = 0xC0262313 - ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET Handle = 0xC0262314 - ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET Handle = 0xC0262315 - ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET Handle = 0xC0262316 - ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET Handle = 0xC0262317 - ERROR_GRAPHICS_TARGET_ALREADY_IN_SET Handle = 0xC0262318 - ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH Handle = 0xC0262319 - ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY Handle = 0xC026231A - ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET Handle = 0xC026231B - ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE Handle = 0xC026231C - ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET Handle = 0xC026231D - ERROR_GRAPHICS_NO_PREFERRED_MODE Handle = 0x0026231E - ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET Handle = 0xC026231F - ERROR_GRAPHICS_STALE_MODESET Handle = 0xC0262320 - ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET Handle = 0xC0262321 - ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE Handle = 0xC0262322 - ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN Handle = 0xC0262323 - ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE Handle = 0xC0262324 - ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION Handle = 0xC0262325 - ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES Handle = 0xC0262326 - ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY Handle = 0xC0262327 - ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE Handle = 0xC0262328 - ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET Handle = 0xC0262329 - ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET Handle = 0xC026232A - ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR Handle = 0xC026232B - ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET Handle = 0xC026232C - ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET Handle = 0xC026232D - ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE Handle = 0xC026232E - ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE Handle = 0xC026232F - ERROR_GRAPHICS_RESOURCES_NOT_RELATED Handle = 0xC0262330 - ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE Handle = 0xC0262331 - ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE Handle = 0xC0262332 - ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET Handle = 0xC0262333 - ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER Handle = 0xC0262334 - ERROR_GRAPHICS_NO_VIDPNMGR Handle = 0xC0262335 - ERROR_GRAPHICS_NO_ACTIVE_VIDPN Handle = 0xC0262336 - ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY Handle = 0xC0262337 - ERROR_GRAPHICS_MONITOR_NOT_CONNECTED Handle = 0xC0262338 - ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY Handle = 0xC0262339 - ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE Handle = 0xC026233A - ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE Handle = 0xC026233B - ERROR_GRAPHICS_INVALID_STRIDE Handle = 0xC026233C - ERROR_GRAPHICS_INVALID_PIXELFORMAT Handle = 0xC026233D - ERROR_GRAPHICS_INVALID_COLORBASIS Handle = 0xC026233E - ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE Handle = 0xC026233F - ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY Handle = 0xC0262340 - ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT Handle = 0xC0262341 - ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0xC0262342 - ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN Handle = 0xC0262343 - ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL Handle = 0xC0262344 - ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION Handle = 0xC0262345 - ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED Handle = 0xC0262346 - ERROR_GRAPHICS_INVALID_GAMMA_RAMP Handle = 0xC0262347 - ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED Handle = 0xC0262348 - ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED Handle = 0xC0262349 - ERROR_GRAPHICS_MODE_NOT_IN_MODESET Handle = 0xC026234A - ERROR_GRAPHICS_DATASET_IS_EMPTY Handle = 0x0026234B - ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET Handle = 0x0026234C - ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON Handle = 0xC026234D - ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE Handle = 0xC026234E - ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE Handle = 0xC026234F - ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS Handle = 0xC0262350 - ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED Handle = 0x00262351 - ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING Handle = 0xC0262352 - ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED Handle = 0xC0262353 - ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS Handle = 0xC0262354 - ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT Handle = 0xC0262355 - ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM Handle = 0xC0262356 - ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN Handle = 0xC0262357 - ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT Handle = 0xC0262358 - ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED Handle = 0xC0262359 - ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION Handle = 0xC026235A - ERROR_GRAPHICS_INVALID_CLIENT_TYPE Handle = 0xC026235B - ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET Handle = 0xC026235C - ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED Handle = 0xC0262400 - ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED Handle = 0xC0262401 - ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS Handle = 0x4026242F - ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER Handle = 0xC0262430 - ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED Handle = 0xC0262431 - ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED Handle = 0xC0262432 - ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY Handle = 0xC0262433 - ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED Handle = 0xC0262434 - ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON Handle = 0xC0262435 - ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE Handle = 0xC0262436 - ERROR_GRAPHICS_LEADLINK_START_DEFERRED Handle = 0x40262437 - ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER Handle = 0xC0262438 - ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY Handle = 0x40262439 - ERROR_GRAPHICS_START_DEFERRED Handle = 0x4026243A - ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED Handle = 0xC026243B - ERROR_GRAPHICS_DEPENDABLE_CHILD_STATUS Handle = 0x4026243C - ERROR_GRAPHICS_OPM_NOT_SUPPORTED Handle = 0xC0262500 - ERROR_GRAPHICS_COPP_NOT_SUPPORTED Handle = 0xC0262501 - ERROR_GRAPHICS_UAB_NOT_SUPPORTED Handle = 0xC0262502 - ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS Handle = 0xC0262503 - ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST Handle = 0xC0262505 - ERROR_GRAPHICS_OPM_INTERNAL_ERROR Handle = 0xC026250B - ERROR_GRAPHICS_OPM_INVALID_HANDLE Handle = 0xC026250C - ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH Handle = 0xC026250E - ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED Handle = 0xC026250F - ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED Handle = 0xC0262510 - ERROR_GRAPHICS_PVP_HFS_FAILED Handle = 0xC0262511 - ERROR_GRAPHICS_OPM_INVALID_SRM Handle = 0xC0262512 - ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP Handle = 0xC0262513 - ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP Handle = 0xC0262514 - ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA Handle = 0xC0262515 - ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET Handle = 0xC0262516 - ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH Handle = 0xC0262517 - ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE Handle = 0xC0262518 - ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS Handle = 0xC026251A - ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC026251B - ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS Handle = 0xC026251C - ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST Handle = 0xC026251D - ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR Handle = 0xC026251E - ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS Handle = 0xC026251F - ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED Handle = 0xC0262520 - ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST Handle = 0xC0262521 - ERROR_GRAPHICS_I2C_NOT_SUPPORTED Handle = 0xC0262580 - ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST Handle = 0xC0262581 - ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA Handle = 0xC0262582 - ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA Handle = 0xC0262583 - ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED Handle = 0xC0262584 - ERROR_GRAPHICS_DDCCI_INVALID_DATA Handle = 0xC0262585 - ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE Handle = 0xC0262586 - ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING Handle = 0xC0262587 - ERROR_GRAPHICS_MCA_INTERNAL_ERROR Handle = 0xC0262588 - ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND Handle = 0xC0262589 - ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH Handle = 0xC026258A - ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM Handle = 0xC026258B - ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE Handle = 0xC026258C - ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS Handle = 0xC026258D - ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE Handle = 0xC02625D8 - ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION Handle = 0xC02625D9 - ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION Handle = 0xC02625DA - ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH Handle = 0xC02625DB - ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION Handle = 0xC02625DC - ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED Handle = 0xC02625DE - ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE Handle = 0xC02625DF - ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED Handle = 0xC02625E0 - ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME Handle = 0xC02625E1 - ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP Handle = 0xC02625E2 - ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED Handle = 0xC02625E3 - ERROR_GRAPHICS_INVALID_POINTER Handle = 0xC02625E4 - ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE Handle = 0xC02625E5 - ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL Handle = 0xC02625E6 - ERROR_GRAPHICS_INTERNAL_ERROR Handle = 0xC02625E7 - ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC02605E8 - NAP_E_INVALID_PACKET Handle = 0x80270001 - NAP_E_MISSING_SOH Handle = 0x80270002 - NAP_E_CONFLICTING_ID Handle = 0x80270003 - NAP_E_NO_CACHED_SOH Handle = 0x80270004 - NAP_E_STILL_BOUND Handle = 0x80270005 - NAP_E_NOT_REGISTERED Handle = 0x80270006 - NAP_E_NOT_INITIALIZED Handle = 0x80270007 - NAP_E_MISMATCHED_ID Handle = 0x80270008 - NAP_E_NOT_PENDING Handle = 0x80270009 - NAP_E_ID_NOT_FOUND Handle = 0x8027000A - NAP_E_MAXSIZE_TOO_SMALL Handle = 0x8027000B - NAP_E_SERVICE_NOT_RUNNING Handle = 0x8027000C - NAP_S_CERT_ALREADY_PRESENT Handle = 0x0027000D - NAP_E_ENTITY_DISABLED Handle = 0x8027000E - NAP_E_NETSH_GROUPPOLICY_ERROR Handle = 0x8027000F - NAP_E_TOO_MANY_CALLS Handle = 0x80270010 - NAP_E_SHV_CONFIG_EXISTED Handle = 0x80270011 - NAP_E_SHV_CONFIG_NOT_FOUND Handle = 0x80270012 - NAP_E_SHV_TIMEOUT Handle = 0x80270013 - TPM_E_ERROR_MASK Handle = 0x80280000 - TPM_E_AUTHFAIL Handle = 0x80280001 - TPM_E_BADINDEX Handle = 0x80280002 - TPM_E_BAD_PARAMETER Handle = 0x80280003 - TPM_E_AUDITFAILURE Handle = 0x80280004 - TPM_E_CLEAR_DISABLED Handle = 0x80280005 - TPM_E_DEACTIVATED Handle = 0x80280006 - TPM_E_DISABLED Handle = 0x80280007 - TPM_E_DISABLED_CMD Handle = 0x80280008 - TPM_E_FAIL Handle = 0x80280009 - TPM_E_BAD_ORDINAL Handle = 0x8028000A - TPM_E_INSTALL_DISABLED Handle = 0x8028000B - TPM_E_INVALID_KEYHANDLE Handle = 0x8028000C - TPM_E_KEYNOTFOUND Handle = 0x8028000D - TPM_E_INAPPROPRIATE_ENC Handle = 0x8028000E - TPM_E_MIGRATEFAIL Handle = 0x8028000F - TPM_E_INVALID_PCR_INFO Handle = 0x80280010 - TPM_E_NOSPACE Handle = 0x80280011 - TPM_E_NOSRK Handle = 0x80280012 - TPM_E_NOTSEALED_BLOB Handle = 0x80280013 - TPM_E_OWNER_SET Handle = 0x80280014 - TPM_E_RESOURCES Handle = 0x80280015 - TPM_E_SHORTRANDOM Handle = 0x80280016 - TPM_E_SIZE Handle = 0x80280017 - TPM_E_WRONGPCRVAL Handle = 0x80280018 - TPM_E_BAD_PARAM_SIZE Handle = 0x80280019 - TPM_E_SHA_THREAD Handle = 0x8028001A - TPM_E_SHA_ERROR Handle = 0x8028001B - TPM_E_FAILEDSELFTEST Handle = 0x8028001C - TPM_E_AUTH2FAIL Handle = 0x8028001D - TPM_E_BADTAG Handle = 0x8028001E - TPM_E_IOERROR Handle = 0x8028001F - TPM_E_ENCRYPT_ERROR Handle = 0x80280020 - TPM_E_DECRYPT_ERROR Handle = 0x80280021 - TPM_E_INVALID_AUTHHANDLE Handle = 0x80280022 - TPM_E_NO_ENDORSEMENT Handle = 0x80280023 - TPM_E_INVALID_KEYUSAGE Handle = 0x80280024 - TPM_E_WRONG_ENTITYTYPE Handle = 0x80280025 - TPM_E_INVALID_POSTINIT Handle = 0x80280026 - TPM_E_INAPPROPRIATE_SIG Handle = 0x80280027 - TPM_E_BAD_KEY_PROPERTY Handle = 0x80280028 - TPM_E_BAD_MIGRATION Handle = 0x80280029 - TPM_E_BAD_SCHEME Handle = 0x8028002A - TPM_E_BAD_DATASIZE Handle = 0x8028002B - TPM_E_BAD_MODE Handle = 0x8028002C - TPM_E_BAD_PRESENCE Handle = 0x8028002D - TPM_E_BAD_VERSION Handle = 0x8028002E - TPM_E_NO_WRAP_TRANSPORT Handle = 0x8028002F - TPM_E_AUDITFAIL_UNSUCCESSFUL Handle = 0x80280030 - TPM_E_AUDITFAIL_SUCCESSFUL Handle = 0x80280031 - TPM_E_NOTRESETABLE Handle = 0x80280032 - TPM_E_NOTLOCAL Handle = 0x80280033 - TPM_E_BAD_TYPE Handle = 0x80280034 - TPM_E_INVALID_RESOURCE Handle = 0x80280035 - TPM_E_NOTFIPS Handle = 0x80280036 - TPM_E_INVALID_FAMILY Handle = 0x80280037 - TPM_E_NO_NV_PERMISSION Handle = 0x80280038 - TPM_E_REQUIRES_SIGN Handle = 0x80280039 - TPM_E_KEY_NOTSUPPORTED Handle = 0x8028003A - TPM_E_AUTH_CONFLICT Handle = 0x8028003B - TPM_E_AREA_LOCKED Handle = 0x8028003C - TPM_E_BAD_LOCALITY Handle = 0x8028003D - TPM_E_READ_ONLY Handle = 0x8028003E - TPM_E_PER_NOWRITE Handle = 0x8028003F - TPM_E_FAMILYCOUNT Handle = 0x80280040 - TPM_E_WRITE_LOCKED Handle = 0x80280041 - TPM_E_BAD_ATTRIBUTES Handle = 0x80280042 - TPM_E_INVALID_STRUCTURE Handle = 0x80280043 - TPM_E_KEY_OWNER_CONTROL Handle = 0x80280044 - TPM_E_BAD_COUNTER Handle = 0x80280045 - TPM_E_NOT_FULLWRITE Handle = 0x80280046 - TPM_E_CONTEXT_GAP Handle = 0x80280047 - TPM_E_MAXNVWRITES Handle = 0x80280048 - TPM_E_NOOPERATOR Handle = 0x80280049 - TPM_E_RESOURCEMISSING Handle = 0x8028004A - TPM_E_DELEGATE_LOCK Handle = 0x8028004B - TPM_E_DELEGATE_FAMILY Handle = 0x8028004C - TPM_E_DELEGATE_ADMIN Handle = 0x8028004D - TPM_E_TRANSPORT_NOTEXCLUSIVE Handle = 0x8028004E - TPM_E_OWNER_CONTROL Handle = 0x8028004F - TPM_E_DAA_RESOURCES Handle = 0x80280050 - TPM_E_DAA_INPUT_DATA0 Handle = 0x80280051 - TPM_E_DAA_INPUT_DATA1 Handle = 0x80280052 - TPM_E_DAA_ISSUER_SETTINGS Handle = 0x80280053 - TPM_E_DAA_TPM_SETTINGS Handle = 0x80280054 - TPM_E_DAA_STAGE Handle = 0x80280055 - TPM_E_DAA_ISSUER_VALIDITY Handle = 0x80280056 - TPM_E_DAA_WRONG_W Handle = 0x80280057 - TPM_E_BAD_HANDLE Handle = 0x80280058 - TPM_E_BAD_DELEGATE Handle = 0x80280059 - TPM_E_BADCONTEXT Handle = 0x8028005A - TPM_E_TOOMANYCONTEXTS Handle = 0x8028005B - TPM_E_MA_TICKET_SIGNATURE Handle = 0x8028005C - TPM_E_MA_DESTINATION Handle = 0x8028005D - TPM_E_MA_SOURCE Handle = 0x8028005E - TPM_E_MA_AUTHORITY Handle = 0x8028005F - TPM_E_PERMANENTEK Handle = 0x80280061 - TPM_E_BAD_SIGNATURE Handle = 0x80280062 - TPM_E_NOCONTEXTSPACE Handle = 0x80280063 - TPM_20_E_ASYMMETRIC Handle = 0x80280081 - TPM_20_E_ATTRIBUTES Handle = 0x80280082 - TPM_20_E_HASH Handle = 0x80280083 - TPM_20_E_VALUE Handle = 0x80280084 - TPM_20_E_HIERARCHY Handle = 0x80280085 - TPM_20_E_KEY_SIZE Handle = 0x80280087 - TPM_20_E_MGF Handle = 0x80280088 - TPM_20_E_MODE Handle = 0x80280089 - TPM_20_E_TYPE Handle = 0x8028008A - TPM_20_E_HANDLE Handle = 0x8028008B - TPM_20_E_KDF Handle = 0x8028008C - TPM_20_E_RANGE Handle = 0x8028008D - TPM_20_E_AUTH_FAIL Handle = 0x8028008E - TPM_20_E_NONCE Handle = 0x8028008F - TPM_20_E_PP Handle = 0x80280090 - TPM_20_E_SCHEME Handle = 0x80280092 - TPM_20_E_SIZE Handle = 0x80280095 - TPM_20_E_SYMMETRIC Handle = 0x80280096 - TPM_20_E_TAG Handle = 0x80280097 - TPM_20_E_SELECTOR Handle = 0x80280098 - TPM_20_E_INSUFFICIENT Handle = 0x8028009A - TPM_20_E_SIGNATURE Handle = 0x8028009B - TPM_20_E_KEY Handle = 0x8028009C - TPM_20_E_POLICY_FAIL Handle = 0x8028009D - TPM_20_E_INTEGRITY Handle = 0x8028009F - TPM_20_E_TICKET Handle = 0x802800A0 - TPM_20_E_RESERVED_BITS Handle = 0x802800A1 - TPM_20_E_BAD_AUTH Handle = 0x802800A2 - TPM_20_E_EXPIRED Handle = 0x802800A3 - TPM_20_E_POLICY_CC Handle = 0x802800A4 - TPM_20_E_BINDING Handle = 0x802800A5 - TPM_20_E_CURVE Handle = 0x802800A6 - TPM_20_E_ECC_POINT Handle = 0x802800A7 - TPM_20_E_INITIALIZE Handle = 0x80280100 - TPM_20_E_FAILURE Handle = 0x80280101 - TPM_20_E_SEQUENCE Handle = 0x80280103 - TPM_20_E_PRIVATE Handle = 0x8028010B - TPM_20_E_HMAC Handle = 0x80280119 - TPM_20_E_DISABLED Handle = 0x80280120 - TPM_20_E_EXCLUSIVE Handle = 0x80280121 - TPM_20_E_ECC_CURVE Handle = 0x80280123 - TPM_20_E_AUTH_TYPE Handle = 0x80280124 - TPM_20_E_AUTH_MISSING Handle = 0x80280125 - TPM_20_E_POLICY Handle = 0x80280126 - TPM_20_E_PCR Handle = 0x80280127 - TPM_20_E_PCR_CHANGED Handle = 0x80280128 - TPM_20_E_UPGRADE Handle = 0x8028012D - TPM_20_E_TOO_MANY_CONTEXTS Handle = 0x8028012E - TPM_20_E_AUTH_UNAVAILABLE Handle = 0x8028012F - TPM_20_E_REBOOT Handle = 0x80280130 - TPM_20_E_UNBALANCED Handle = 0x80280131 - TPM_20_E_COMMAND_SIZE Handle = 0x80280142 - TPM_20_E_COMMAND_CODE Handle = 0x80280143 - TPM_20_E_AUTHSIZE Handle = 0x80280144 - TPM_20_E_AUTH_CONTEXT Handle = 0x80280145 - TPM_20_E_NV_RANGE Handle = 0x80280146 - TPM_20_E_NV_SIZE Handle = 0x80280147 - TPM_20_E_NV_LOCKED Handle = 0x80280148 - TPM_20_E_NV_AUTHORIZATION Handle = 0x80280149 - TPM_20_E_NV_UNINITIALIZED Handle = 0x8028014A - TPM_20_E_NV_SPACE Handle = 0x8028014B - TPM_20_E_NV_DEFINED Handle = 0x8028014C - TPM_20_E_BAD_CONTEXT Handle = 0x80280150 - TPM_20_E_CPHASH Handle = 0x80280151 - TPM_20_E_PARENT Handle = 0x80280152 - TPM_20_E_NEEDS_TEST Handle = 0x80280153 - TPM_20_E_NO_RESULT Handle = 0x80280154 - TPM_20_E_SENSITIVE Handle = 0x80280155 - TPM_E_COMMAND_BLOCKED Handle = 0x80280400 - TPM_E_INVALID_HANDLE Handle = 0x80280401 - TPM_E_DUPLICATE_VHANDLE Handle = 0x80280402 - TPM_E_EMBEDDED_COMMAND_BLOCKED Handle = 0x80280403 - TPM_E_EMBEDDED_COMMAND_UNSUPPORTED Handle = 0x80280404 - TPM_E_RETRY Handle = 0x80280800 - TPM_E_NEEDS_SELFTEST Handle = 0x80280801 - TPM_E_DOING_SELFTEST Handle = 0x80280802 - TPM_E_DEFEND_LOCK_RUNNING Handle = 0x80280803 - TPM_20_E_CONTEXT_GAP Handle = 0x80280901 - TPM_20_E_OBJECT_MEMORY Handle = 0x80280902 - TPM_20_E_SESSION_MEMORY Handle = 0x80280903 - TPM_20_E_MEMORY Handle = 0x80280904 - TPM_20_E_SESSION_HANDLES Handle = 0x80280905 - TPM_20_E_OBJECT_HANDLES Handle = 0x80280906 - TPM_20_E_LOCALITY Handle = 0x80280907 - TPM_20_E_YIELDED Handle = 0x80280908 - TPM_20_E_CANCELED Handle = 0x80280909 - TPM_20_E_TESTING Handle = 0x8028090A - TPM_20_E_NV_RATE Handle = 0x80280920 - TPM_20_E_LOCKOUT Handle = 0x80280921 - TPM_20_E_RETRY Handle = 0x80280922 - TPM_20_E_NV_UNAVAILABLE Handle = 0x80280923 - TBS_E_INTERNAL_ERROR Handle = 0x80284001 - TBS_E_BAD_PARAMETER Handle = 0x80284002 - TBS_E_INVALID_OUTPUT_POINTER Handle = 0x80284003 - TBS_E_INVALID_CONTEXT Handle = 0x80284004 - TBS_E_INSUFFICIENT_BUFFER Handle = 0x80284005 - TBS_E_IOERROR Handle = 0x80284006 - TBS_E_INVALID_CONTEXT_PARAM Handle = 0x80284007 - TBS_E_SERVICE_NOT_RUNNING Handle = 0x80284008 - TBS_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80284009 - TBS_E_TOO_MANY_RESOURCES Handle = 0x8028400A - TBS_E_SERVICE_START_PENDING Handle = 0x8028400B - TBS_E_PPI_NOT_SUPPORTED Handle = 0x8028400C - TBS_E_COMMAND_CANCELED Handle = 0x8028400D - TBS_E_BUFFER_TOO_LARGE Handle = 0x8028400E - TBS_E_TPM_NOT_FOUND Handle = 0x8028400F - TBS_E_SERVICE_DISABLED Handle = 0x80284010 - TBS_E_NO_EVENT_LOG Handle = 0x80284011 - TBS_E_ACCESS_DENIED Handle = 0x80284012 - TBS_E_PROVISIONING_NOT_ALLOWED Handle = 0x80284013 - TBS_E_PPI_FUNCTION_UNSUPPORTED Handle = 0x80284014 - TBS_E_OWNERAUTH_NOT_FOUND Handle = 0x80284015 - TBS_E_PROVISIONING_INCOMPLETE Handle = 0x80284016 - TPMAPI_E_INVALID_STATE Handle = 0x80290100 - TPMAPI_E_NOT_ENOUGH_DATA Handle = 0x80290101 - TPMAPI_E_TOO_MUCH_DATA Handle = 0x80290102 - TPMAPI_E_INVALID_OUTPUT_POINTER Handle = 0x80290103 - TPMAPI_E_INVALID_PARAMETER Handle = 0x80290104 - TPMAPI_E_OUT_OF_MEMORY Handle = 0x80290105 - TPMAPI_E_BUFFER_TOO_SMALL Handle = 0x80290106 - TPMAPI_E_INTERNAL_ERROR Handle = 0x80290107 - TPMAPI_E_ACCESS_DENIED Handle = 0x80290108 - TPMAPI_E_AUTHORIZATION_FAILED Handle = 0x80290109 - TPMAPI_E_INVALID_CONTEXT_HANDLE Handle = 0x8029010A - TPMAPI_E_TBS_COMMUNICATION_ERROR Handle = 0x8029010B - TPMAPI_E_TPM_COMMAND_ERROR Handle = 0x8029010C - TPMAPI_E_MESSAGE_TOO_LARGE Handle = 0x8029010D - TPMAPI_E_INVALID_ENCODING Handle = 0x8029010E - TPMAPI_E_INVALID_KEY_SIZE Handle = 0x8029010F - TPMAPI_E_ENCRYPTION_FAILED Handle = 0x80290110 - TPMAPI_E_INVALID_KEY_PARAMS Handle = 0x80290111 - TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB Handle = 0x80290112 - TPMAPI_E_INVALID_PCR_INDEX Handle = 0x80290113 - TPMAPI_E_INVALID_DELEGATE_BLOB Handle = 0x80290114 - TPMAPI_E_INVALID_CONTEXT_PARAMS Handle = 0x80290115 - TPMAPI_E_INVALID_KEY_BLOB Handle = 0x80290116 - TPMAPI_E_INVALID_PCR_DATA Handle = 0x80290117 - TPMAPI_E_INVALID_OWNER_AUTH Handle = 0x80290118 - TPMAPI_E_FIPS_RNG_CHECK_FAILED Handle = 0x80290119 - TPMAPI_E_EMPTY_TCG_LOG Handle = 0x8029011A - TPMAPI_E_INVALID_TCG_LOG_ENTRY Handle = 0x8029011B - TPMAPI_E_TCG_SEPARATOR_ABSENT Handle = 0x8029011C - TPMAPI_E_TCG_INVALID_DIGEST_ENTRY Handle = 0x8029011D - TPMAPI_E_POLICY_DENIES_OPERATION Handle = 0x8029011E - TPMAPI_E_NV_BITS_NOT_DEFINED Handle = 0x8029011F - TPMAPI_E_NV_BITS_NOT_READY Handle = 0x80290120 - TPMAPI_E_SEALING_KEY_NOT_AVAILABLE Handle = 0x80290121 - TPMAPI_E_NO_AUTHORIZATION_CHAIN_FOUND Handle = 0x80290122 - TPMAPI_E_SVN_COUNTER_NOT_AVAILABLE Handle = 0x80290123 - TPMAPI_E_OWNER_AUTH_NOT_NULL Handle = 0x80290124 - TPMAPI_E_ENDORSEMENT_AUTH_NOT_NULL Handle = 0x80290125 - TPMAPI_E_AUTHORIZATION_REVOKED Handle = 0x80290126 - TPMAPI_E_MALFORMED_AUTHORIZATION_KEY Handle = 0x80290127 - TPMAPI_E_AUTHORIZING_KEY_NOT_SUPPORTED Handle = 0x80290128 - TPMAPI_E_INVALID_AUTHORIZATION_SIGNATURE Handle = 0x80290129 - TPMAPI_E_MALFORMED_AUTHORIZATION_POLICY Handle = 0x8029012A - TPMAPI_E_MALFORMED_AUTHORIZATION_OTHER Handle = 0x8029012B - TPMAPI_E_SEALING_KEY_CHANGED Handle = 0x8029012C - TBSIMP_E_BUFFER_TOO_SMALL Handle = 0x80290200 - TBSIMP_E_CLEANUP_FAILED Handle = 0x80290201 - TBSIMP_E_INVALID_CONTEXT_HANDLE Handle = 0x80290202 - TBSIMP_E_INVALID_CONTEXT_PARAM Handle = 0x80290203 - TBSIMP_E_TPM_ERROR Handle = 0x80290204 - TBSIMP_E_HASH_BAD_KEY Handle = 0x80290205 - TBSIMP_E_DUPLICATE_VHANDLE Handle = 0x80290206 - TBSIMP_E_INVALID_OUTPUT_POINTER Handle = 0x80290207 - TBSIMP_E_INVALID_PARAMETER Handle = 0x80290208 - TBSIMP_E_RPC_INIT_FAILED Handle = 0x80290209 - TBSIMP_E_SCHEDULER_NOT_RUNNING Handle = 0x8029020A - TBSIMP_E_COMMAND_CANCELED Handle = 0x8029020B - TBSIMP_E_OUT_OF_MEMORY Handle = 0x8029020C - TBSIMP_E_LIST_NO_MORE_ITEMS Handle = 0x8029020D - TBSIMP_E_LIST_NOT_FOUND Handle = 0x8029020E - TBSIMP_E_NOT_ENOUGH_SPACE Handle = 0x8029020F - TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS Handle = 0x80290210 - TBSIMP_E_COMMAND_FAILED Handle = 0x80290211 - TBSIMP_E_UNKNOWN_ORDINAL Handle = 0x80290212 - TBSIMP_E_RESOURCE_EXPIRED Handle = 0x80290213 - TBSIMP_E_INVALID_RESOURCE Handle = 0x80290214 - TBSIMP_E_NOTHING_TO_UNLOAD Handle = 0x80290215 - TBSIMP_E_HASH_TABLE_FULL Handle = 0x80290216 - TBSIMP_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80290217 - TBSIMP_E_TOO_MANY_RESOURCES Handle = 0x80290218 - TBSIMP_E_PPI_NOT_SUPPORTED Handle = 0x80290219 - TBSIMP_E_TPM_INCOMPATIBLE Handle = 0x8029021A - TBSIMP_E_NO_EVENT_LOG Handle = 0x8029021B - TPM_E_PPI_ACPI_FAILURE Handle = 0x80290300 - TPM_E_PPI_USER_ABORT Handle = 0x80290301 - TPM_E_PPI_BIOS_FAILURE Handle = 0x80290302 - TPM_E_PPI_NOT_SUPPORTED Handle = 0x80290303 - TPM_E_PPI_BLOCKED_IN_BIOS Handle = 0x80290304 - TPM_E_PCP_ERROR_MASK Handle = 0x80290400 - TPM_E_PCP_DEVICE_NOT_READY Handle = 0x80290401 - TPM_E_PCP_INVALID_HANDLE Handle = 0x80290402 - TPM_E_PCP_INVALID_PARAMETER Handle = 0x80290403 - TPM_E_PCP_FLAG_NOT_SUPPORTED Handle = 0x80290404 - TPM_E_PCP_NOT_SUPPORTED Handle = 0x80290405 - TPM_E_PCP_BUFFER_TOO_SMALL Handle = 0x80290406 - TPM_E_PCP_INTERNAL_ERROR Handle = 0x80290407 - TPM_E_PCP_AUTHENTICATION_FAILED Handle = 0x80290408 - TPM_E_PCP_AUTHENTICATION_IGNORED Handle = 0x80290409 - TPM_E_PCP_POLICY_NOT_FOUND Handle = 0x8029040A - TPM_E_PCP_PROFILE_NOT_FOUND Handle = 0x8029040B - TPM_E_PCP_VALIDATION_FAILED Handle = 0x8029040C - TPM_E_PCP_WRONG_PARENT Handle = 0x8029040E - TPM_E_KEY_NOT_LOADED Handle = 0x8029040F - TPM_E_NO_KEY_CERTIFICATION Handle = 0x80290410 - TPM_E_KEY_NOT_FINALIZED Handle = 0x80290411 - TPM_E_ATTESTATION_CHALLENGE_NOT_SET Handle = 0x80290412 - TPM_E_NOT_PCR_BOUND Handle = 0x80290413 - TPM_E_KEY_ALREADY_FINALIZED Handle = 0x80290414 - TPM_E_KEY_USAGE_POLICY_NOT_SUPPORTED Handle = 0x80290415 - TPM_E_KEY_USAGE_POLICY_INVALID Handle = 0x80290416 - TPM_E_SOFT_KEY_ERROR Handle = 0x80290417 - TPM_E_KEY_NOT_AUTHENTICATED Handle = 0x80290418 - TPM_E_PCP_KEY_NOT_AIK Handle = 0x80290419 - TPM_E_KEY_NOT_SIGNING_KEY Handle = 0x8029041A - TPM_E_LOCKED_OUT Handle = 0x8029041B - TPM_E_CLAIM_TYPE_NOT_SUPPORTED Handle = 0x8029041C - TPM_E_VERSION_NOT_SUPPORTED Handle = 0x8029041D - TPM_E_BUFFER_LENGTH_MISMATCH Handle = 0x8029041E - TPM_E_PCP_IFX_RSA_KEY_CREATION_BLOCKED Handle = 0x8029041F - TPM_E_PCP_TICKET_MISSING Handle = 0x80290420 - TPM_E_PCP_RAW_POLICY_NOT_SUPPORTED Handle = 0x80290421 - TPM_E_PCP_KEY_HANDLE_INVALIDATED Handle = 0x80290422 - TPM_E_PCP_UNSUPPORTED_PSS_SALT Handle = 0x40290423 - TPM_E_ZERO_EXHAUST_ENABLED Handle = 0x80290500 - PLA_E_DCS_NOT_FOUND Handle = 0x80300002 - PLA_E_DCS_IN_USE Handle = 0x803000AA - PLA_E_TOO_MANY_FOLDERS Handle = 0x80300045 - PLA_E_NO_MIN_DISK Handle = 0x80300070 - PLA_E_DCS_ALREADY_EXISTS Handle = 0x803000B7 - PLA_S_PROPERTY_IGNORED Handle = 0x00300100 - PLA_E_PROPERTY_CONFLICT Handle = 0x80300101 - PLA_E_DCS_SINGLETON_REQUIRED Handle = 0x80300102 - PLA_E_CREDENTIALS_REQUIRED Handle = 0x80300103 - PLA_E_DCS_NOT_RUNNING Handle = 0x80300104 - PLA_E_CONFLICT_INCL_EXCL_API Handle = 0x80300105 - PLA_E_NETWORK_EXE_NOT_VALID Handle = 0x80300106 - PLA_E_EXE_ALREADY_CONFIGURED Handle = 0x80300107 - PLA_E_EXE_PATH_NOT_VALID Handle = 0x80300108 - PLA_E_DC_ALREADY_EXISTS Handle = 0x80300109 - PLA_E_DCS_START_WAIT_TIMEOUT Handle = 0x8030010A - PLA_E_DC_START_WAIT_TIMEOUT Handle = 0x8030010B - PLA_E_REPORT_WAIT_TIMEOUT Handle = 0x8030010C - PLA_E_NO_DUPLICATES Handle = 0x8030010D - PLA_E_EXE_FULL_PATH_REQUIRED Handle = 0x8030010E - PLA_E_INVALID_SESSION_NAME Handle = 0x8030010F - PLA_E_PLA_CHANNEL_NOT_ENABLED Handle = 0x80300110 - PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED Handle = 0x80300111 - PLA_E_RULES_MANAGER_FAILED Handle = 0x80300112 - PLA_E_CABAPI_FAILURE Handle = 0x80300113 - FVE_E_LOCKED_VOLUME Handle = 0x80310000 - FVE_E_NOT_ENCRYPTED Handle = 0x80310001 - FVE_E_NO_TPM_BIOS Handle = 0x80310002 - FVE_E_NO_MBR_METRIC Handle = 0x80310003 - FVE_E_NO_BOOTSECTOR_METRIC Handle = 0x80310004 - FVE_E_NO_BOOTMGR_METRIC Handle = 0x80310005 - FVE_E_WRONG_BOOTMGR Handle = 0x80310006 - FVE_E_SECURE_KEY_REQUIRED Handle = 0x80310007 - FVE_E_NOT_ACTIVATED Handle = 0x80310008 - FVE_E_ACTION_NOT_ALLOWED Handle = 0x80310009 - FVE_E_AD_SCHEMA_NOT_INSTALLED Handle = 0x8031000A - FVE_E_AD_INVALID_DATATYPE Handle = 0x8031000B - FVE_E_AD_INVALID_DATASIZE Handle = 0x8031000C - FVE_E_AD_NO_VALUES Handle = 0x8031000D - FVE_E_AD_ATTR_NOT_SET Handle = 0x8031000E - FVE_E_AD_GUID_NOT_FOUND Handle = 0x8031000F - FVE_E_BAD_INFORMATION Handle = 0x80310010 - FVE_E_TOO_SMALL Handle = 0x80310011 - FVE_E_SYSTEM_VOLUME Handle = 0x80310012 - FVE_E_FAILED_WRONG_FS Handle = 0x80310013 - FVE_E_BAD_PARTITION_SIZE Handle = 0x80310014 - FVE_E_NOT_SUPPORTED Handle = 0x80310015 - FVE_E_BAD_DATA Handle = 0x80310016 - FVE_E_VOLUME_NOT_BOUND Handle = 0x80310017 - FVE_E_TPM_NOT_OWNED Handle = 0x80310018 - FVE_E_NOT_DATA_VOLUME Handle = 0x80310019 - FVE_E_AD_INSUFFICIENT_BUFFER Handle = 0x8031001A - FVE_E_CONV_READ Handle = 0x8031001B - FVE_E_CONV_WRITE Handle = 0x8031001C - FVE_E_KEY_REQUIRED Handle = 0x8031001D - FVE_E_CLUSTERING_NOT_SUPPORTED Handle = 0x8031001E - FVE_E_VOLUME_BOUND_ALREADY Handle = 0x8031001F - FVE_E_OS_NOT_PROTECTED Handle = 0x80310020 - FVE_E_PROTECTION_DISABLED Handle = 0x80310021 - FVE_E_RECOVERY_KEY_REQUIRED Handle = 0x80310022 - FVE_E_FOREIGN_VOLUME Handle = 0x80310023 - FVE_E_OVERLAPPED_UPDATE Handle = 0x80310024 - FVE_E_TPM_SRK_AUTH_NOT_ZERO Handle = 0x80310025 - FVE_E_FAILED_SECTOR_SIZE Handle = 0x80310026 - FVE_E_FAILED_AUTHENTICATION Handle = 0x80310027 - FVE_E_NOT_OS_VOLUME Handle = 0x80310028 - FVE_E_AUTOUNLOCK_ENABLED Handle = 0x80310029 - FVE_E_WRONG_BOOTSECTOR Handle = 0x8031002A - FVE_E_WRONG_SYSTEM_FS Handle = 0x8031002B - FVE_E_POLICY_PASSWORD_REQUIRED Handle = 0x8031002C - FVE_E_CANNOT_SET_FVEK_ENCRYPTED Handle = 0x8031002D - FVE_E_CANNOT_ENCRYPT_NO_KEY Handle = 0x8031002E - FVE_E_BOOTABLE_CDDVD Handle = 0x80310030 - FVE_E_PROTECTOR_EXISTS Handle = 0x80310031 - FVE_E_RELATIVE_PATH Handle = 0x80310032 - FVE_E_PROTECTOR_NOT_FOUND Handle = 0x80310033 - FVE_E_INVALID_KEY_FORMAT Handle = 0x80310034 - FVE_E_INVALID_PASSWORD_FORMAT Handle = 0x80310035 - FVE_E_FIPS_RNG_CHECK_FAILED Handle = 0x80310036 - FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD Handle = 0x80310037 - FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT Handle = 0x80310038 - FVE_E_NOT_DECRYPTED Handle = 0x80310039 - FVE_E_INVALID_PROTECTOR_TYPE Handle = 0x8031003A - FVE_E_NO_PROTECTORS_TO_TEST Handle = 0x8031003B - FVE_E_KEYFILE_NOT_FOUND Handle = 0x8031003C - FVE_E_KEYFILE_INVALID Handle = 0x8031003D - FVE_E_KEYFILE_NO_VMK Handle = 0x8031003E - FVE_E_TPM_DISABLED Handle = 0x8031003F - FVE_E_NOT_ALLOWED_IN_SAFE_MODE Handle = 0x80310040 - FVE_E_TPM_INVALID_PCR Handle = 0x80310041 - FVE_E_TPM_NO_VMK Handle = 0x80310042 - FVE_E_PIN_INVALID Handle = 0x80310043 - FVE_E_AUTH_INVALID_APPLICATION Handle = 0x80310044 - FVE_E_AUTH_INVALID_CONFIG Handle = 0x80310045 - FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED Handle = 0x80310046 - FVE_E_FS_NOT_EXTENDED Handle = 0x80310047 - FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED Handle = 0x80310048 - FVE_E_NO_LICENSE Handle = 0x80310049 - FVE_E_NOT_ON_STACK Handle = 0x8031004A - FVE_E_FS_MOUNTED Handle = 0x8031004B - FVE_E_TOKEN_NOT_IMPERSONATED Handle = 0x8031004C - FVE_E_DRY_RUN_FAILED Handle = 0x8031004D - FVE_E_REBOOT_REQUIRED Handle = 0x8031004E - FVE_E_DEBUGGER_ENABLED Handle = 0x8031004F - FVE_E_RAW_ACCESS Handle = 0x80310050 - FVE_E_RAW_BLOCKED Handle = 0x80310051 - FVE_E_BCD_APPLICATIONS_PATH_INCORRECT Handle = 0x80310052 - FVE_E_NOT_ALLOWED_IN_VERSION Handle = 0x80310053 - FVE_E_NO_AUTOUNLOCK_MASTER_KEY Handle = 0x80310054 - FVE_E_MOR_FAILED Handle = 0x80310055 - FVE_E_HIDDEN_VOLUME Handle = 0x80310056 - FVE_E_TRANSIENT_STATE Handle = 0x80310057 - FVE_E_PUBKEY_NOT_ALLOWED Handle = 0x80310058 - FVE_E_VOLUME_HANDLE_OPEN Handle = 0x80310059 - FVE_E_NO_FEATURE_LICENSE Handle = 0x8031005A - FVE_E_INVALID_STARTUP_OPTIONS Handle = 0x8031005B - FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED Handle = 0x8031005C - FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED Handle = 0x8031005D - FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED Handle = 0x8031005E - FVE_E_POLICY_RECOVERY_KEY_REQUIRED Handle = 0x8031005F - FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED Handle = 0x80310060 - FVE_E_POLICY_STARTUP_PIN_REQUIRED Handle = 0x80310061 - FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED Handle = 0x80310062 - FVE_E_POLICY_STARTUP_KEY_REQUIRED Handle = 0x80310063 - FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED Handle = 0x80310064 - FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED Handle = 0x80310065 - FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED Handle = 0x80310066 - FVE_E_POLICY_STARTUP_TPM_REQUIRED Handle = 0x80310067 - FVE_E_POLICY_INVALID_PIN_LENGTH Handle = 0x80310068 - FVE_E_KEY_PROTECTOR_NOT_SUPPORTED Handle = 0x80310069 - FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006A - FVE_E_POLICY_PASSPHRASE_REQUIRED Handle = 0x8031006B - FVE_E_FIPS_PREVENTS_PASSPHRASE Handle = 0x8031006C - FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006D - FVE_E_INVALID_BITLOCKER_OID Handle = 0x8031006E - FVE_E_VOLUME_TOO_SMALL Handle = 0x8031006F - FVE_E_DV_NOT_SUPPORTED_ON_FS Handle = 0x80310070 - FVE_E_DV_NOT_ALLOWED_BY_GP Handle = 0x80310071 - FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED Handle = 0x80310072 - FVE_E_POLICY_USER_CERTIFICATE_REQUIRED Handle = 0x80310073 - FVE_E_POLICY_USER_CERT_MUST_BE_HW Handle = 0x80310074 - FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310075 - FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310076 - FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED Handle = 0x80310077 - FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED Handle = 0x80310078 - FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED Handle = 0x80310079 - FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH Handle = 0x80310080 - FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE Handle = 0x80310081 - FVE_E_RECOVERY_PARTITION Handle = 0x80310082 - FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON Handle = 0x80310083 - FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON Handle = 0x80310084 - FVE_E_NON_BITLOCKER_OID Handle = 0x80310085 - FVE_E_POLICY_PROHIBITS_SELFSIGNED Handle = 0x80310086 - FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED Handle = 0x80310087 - FVE_E_CONV_RECOVERY_FAILED Handle = 0x80310088 - FVE_E_VIRTUALIZED_SPACE_TOO_BIG Handle = 0x80310089 - FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON Handle = 0x80310090 - FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON Handle = 0x80310091 - FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON Handle = 0x80310092 - FVE_E_NON_BITLOCKER_KU Handle = 0x80310093 - FVE_E_PRIVATEKEY_AUTH_FAILED Handle = 0x80310094 - FVE_E_REMOVAL_OF_DRA_FAILED Handle = 0x80310095 - FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME Handle = 0x80310096 - FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME Handle = 0x80310097 - FVE_E_FIPS_HASH_KDF_NOT_ALLOWED Handle = 0x80310098 - FVE_E_ENH_PIN_INVALID Handle = 0x80310099 - FVE_E_INVALID_PIN_CHARS Handle = 0x8031009A - FVE_E_INVALID_DATUM_TYPE Handle = 0x8031009B - FVE_E_EFI_ONLY Handle = 0x8031009C - FVE_E_MULTIPLE_NKP_CERTS Handle = 0x8031009D - FVE_E_REMOVAL_OF_NKP_FAILED Handle = 0x8031009E - FVE_E_INVALID_NKP_CERT Handle = 0x8031009F - FVE_E_NO_EXISTING_PIN Handle = 0x803100A0 - FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH Handle = 0x803100A1 - FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100A2 - FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED Handle = 0x803100A3 - FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII Handle = 0x803100A4 - FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A5 - FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A6 - FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE Handle = 0x803100A7 - FVE_E_NO_EXISTING_PASSPHRASE Handle = 0x803100A8 - FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH Handle = 0x803100A9 - FVE_E_PASSPHRASE_TOO_LONG Handle = 0x803100AA - FVE_E_NO_PASSPHRASE_WITH_TPM Handle = 0x803100AB - FVE_E_NO_TPM_WITH_PASSPHRASE Handle = 0x803100AC - FVE_E_NOT_ALLOWED_ON_CSV_STACK Handle = 0x803100AD - FVE_E_NOT_ALLOWED_ON_CLUSTER Handle = 0x803100AE - FVE_E_EDRIVE_NO_FAILOVER_TO_SW Handle = 0x803100AF - FVE_E_EDRIVE_BAND_IN_USE Handle = 0x803100B0 - FVE_E_EDRIVE_DISALLOWED_BY_GP Handle = 0x803100B1 - FVE_E_EDRIVE_INCOMPATIBLE_VOLUME Handle = 0x803100B2 - FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING Handle = 0x803100B3 - FVE_E_EDRIVE_DV_NOT_SUPPORTED Handle = 0x803100B4 - FVE_E_NO_PREBOOT_KEYBOARD_DETECTED Handle = 0x803100B5 - FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED Handle = 0x803100B6 - FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE Handle = 0x803100B7 - FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE Handle = 0x803100B8 - FVE_E_WIPE_CANCEL_NOT_APPLICABLE Handle = 0x803100B9 - FVE_E_SECUREBOOT_DISABLED Handle = 0x803100BA - FVE_E_SECUREBOOT_CONFIGURATION_INVALID Handle = 0x803100BB - FVE_E_EDRIVE_DRY_RUN_FAILED Handle = 0x803100BC - FVE_E_SHADOW_COPY_PRESENT Handle = 0x803100BD - FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS Handle = 0x803100BE - FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE Handle = 0x803100BF - FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED Handle = 0x803100C0 - FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100C1 - FVE_E_LIVEID_ACCOUNT_SUSPENDED Handle = 0x803100C2 - FVE_E_LIVEID_ACCOUNT_BLOCKED Handle = 0x803100C3 - FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x803100C4 - FVE_E_DE_FIXED_DATA_NOT_SUPPORTED Handle = 0x803100C5 - FVE_E_DE_HARDWARE_NOT_COMPLIANT Handle = 0x803100C6 - FVE_E_DE_WINRE_NOT_CONFIGURED Handle = 0x803100C7 - FVE_E_DE_PROTECTION_SUSPENDED Handle = 0x803100C8 - FVE_E_DE_OS_VOLUME_NOT_PROTECTED Handle = 0x803100C9 - FVE_E_DE_DEVICE_LOCKEDOUT Handle = 0x803100CA - FVE_E_DE_PROTECTION_NOT_YET_ENABLED Handle = 0x803100CB - FVE_E_INVALID_PIN_CHARS_DETAILED Handle = 0x803100CC - FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE Handle = 0x803100CD - FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH Handle = 0x803100CE - FVE_E_BUFFER_TOO_LARGE Handle = 0x803100CF - FVE_E_NO_SUCH_CAPABILITY_ON_TARGET Handle = 0x803100D0 - FVE_E_DE_PREVENTED_FOR_OS Handle = 0x803100D1 - FVE_E_DE_VOLUME_OPTED_OUT Handle = 0x803100D2 - FVE_E_DE_VOLUME_NOT_SUPPORTED Handle = 0x803100D3 - FVE_E_EOW_NOT_SUPPORTED_IN_VERSION Handle = 0x803100D4 - FVE_E_ADBACKUP_NOT_ENABLED Handle = 0x803100D5 - FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT Handle = 0x803100D6 - FVE_E_NOT_DE_VOLUME Handle = 0x803100D7 - FVE_E_PROTECTION_CANNOT_BE_DISABLED Handle = 0x803100D8 - FVE_E_OSV_KSR_NOT_ALLOWED Handle = 0x803100D9 - FWP_E_CALLOUT_NOT_FOUND Handle = 0x80320001 - FWP_E_CONDITION_NOT_FOUND Handle = 0x80320002 - FWP_E_FILTER_NOT_FOUND Handle = 0x80320003 - FWP_E_LAYER_NOT_FOUND Handle = 0x80320004 - FWP_E_PROVIDER_NOT_FOUND Handle = 0x80320005 - FWP_E_PROVIDER_CONTEXT_NOT_FOUND Handle = 0x80320006 - FWP_E_SUBLAYER_NOT_FOUND Handle = 0x80320007 - FWP_E_NOT_FOUND Handle = 0x80320008 - FWP_E_ALREADY_EXISTS Handle = 0x80320009 - FWP_E_IN_USE Handle = 0x8032000A - FWP_E_DYNAMIC_SESSION_IN_PROGRESS Handle = 0x8032000B - FWP_E_WRONG_SESSION Handle = 0x8032000C - FWP_E_NO_TXN_IN_PROGRESS Handle = 0x8032000D - FWP_E_TXN_IN_PROGRESS Handle = 0x8032000E - FWP_E_TXN_ABORTED Handle = 0x8032000F - FWP_E_SESSION_ABORTED Handle = 0x80320010 - FWP_E_INCOMPATIBLE_TXN Handle = 0x80320011 - FWP_E_TIMEOUT Handle = 0x80320012 - FWP_E_NET_EVENTS_DISABLED Handle = 0x80320013 - FWP_E_INCOMPATIBLE_LAYER Handle = 0x80320014 - FWP_E_KM_CLIENTS_ONLY Handle = 0x80320015 - FWP_E_LIFETIME_MISMATCH Handle = 0x80320016 - FWP_E_BUILTIN_OBJECT Handle = 0x80320017 - FWP_E_TOO_MANY_CALLOUTS Handle = 0x80320018 - FWP_E_NOTIFICATION_DROPPED Handle = 0x80320019 - FWP_E_TRAFFIC_MISMATCH Handle = 0x8032001A - FWP_E_INCOMPATIBLE_SA_STATE Handle = 0x8032001B - FWP_E_NULL_POINTER Handle = 0x8032001C - FWP_E_INVALID_ENUMERATOR Handle = 0x8032001D - FWP_E_INVALID_FLAGS Handle = 0x8032001E - FWP_E_INVALID_NET_MASK Handle = 0x8032001F - FWP_E_INVALID_RANGE Handle = 0x80320020 - FWP_E_INVALID_INTERVAL Handle = 0x80320021 - FWP_E_ZERO_LENGTH_ARRAY Handle = 0x80320022 - FWP_E_NULL_DISPLAY_NAME Handle = 0x80320023 - FWP_E_INVALID_ACTION_TYPE Handle = 0x80320024 - FWP_E_INVALID_WEIGHT Handle = 0x80320025 - FWP_E_MATCH_TYPE_MISMATCH Handle = 0x80320026 - FWP_E_TYPE_MISMATCH Handle = 0x80320027 - FWP_E_OUT_OF_BOUNDS Handle = 0x80320028 - FWP_E_RESERVED Handle = 0x80320029 - FWP_E_DUPLICATE_CONDITION Handle = 0x8032002A - FWP_E_DUPLICATE_KEYMOD Handle = 0x8032002B - FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002C - FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER Handle = 0x8032002D - FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002E - FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT Handle = 0x8032002F - FWP_E_INCOMPATIBLE_AUTH_METHOD Handle = 0x80320030 - FWP_E_INCOMPATIBLE_DH_GROUP Handle = 0x80320031 - FWP_E_EM_NOT_SUPPORTED Handle = 0x80320032 - FWP_E_NEVER_MATCH Handle = 0x80320033 - FWP_E_PROVIDER_CONTEXT_MISMATCH Handle = 0x80320034 - FWP_E_INVALID_PARAMETER Handle = 0x80320035 - FWP_E_TOO_MANY_SUBLAYERS Handle = 0x80320036 - FWP_E_CALLOUT_NOTIFICATION_FAILED Handle = 0x80320037 - FWP_E_INVALID_AUTH_TRANSFORM Handle = 0x80320038 - FWP_E_INVALID_CIPHER_TRANSFORM Handle = 0x80320039 - FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM Handle = 0x8032003A - FWP_E_INVALID_TRANSFORM_COMBINATION Handle = 0x8032003B - FWP_E_DUPLICATE_AUTH_METHOD Handle = 0x8032003C - FWP_E_INVALID_TUNNEL_ENDPOINT Handle = 0x8032003D - FWP_E_L2_DRIVER_NOT_READY Handle = 0x8032003E - FWP_E_KEY_DICTATOR_ALREADY_REGISTERED Handle = 0x8032003F - FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL Handle = 0x80320040 - FWP_E_CONNECTIONS_DISABLED Handle = 0x80320041 - FWP_E_INVALID_DNS_NAME Handle = 0x80320042 - FWP_E_STILL_ON Handle = 0x80320043 - FWP_E_IKEEXT_NOT_RUNNING Handle = 0x80320044 - FWP_E_DROP_NOICMP Handle = 0x80320104 - WS_S_ASYNC Handle = 0x003D0000 - WS_S_END Handle = 0x003D0001 - WS_E_INVALID_FORMAT Handle = 0x803D0000 - WS_E_OBJECT_FAULTED Handle = 0x803D0001 - WS_E_NUMERIC_OVERFLOW Handle = 0x803D0002 - WS_E_INVALID_OPERATION Handle = 0x803D0003 - WS_E_OPERATION_ABORTED Handle = 0x803D0004 - WS_E_ENDPOINT_ACCESS_DENIED Handle = 0x803D0005 - WS_E_OPERATION_TIMED_OUT Handle = 0x803D0006 - WS_E_OPERATION_ABANDONED Handle = 0x803D0007 - WS_E_QUOTA_EXCEEDED Handle = 0x803D0008 - WS_E_NO_TRANSLATION_AVAILABLE Handle = 0x803D0009 - WS_E_SECURITY_VERIFICATION_FAILURE Handle = 0x803D000A - WS_E_ADDRESS_IN_USE Handle = 0x803D000B - WS_E_ADDRESS_NOT_AVAILABLE Handle = 0x803D000C - WS_E_ENDPOINT_NOT_FOUND Handle = 0x803D000D - WS_E_ENDPOINT_NOT_AVAILABLE Handle = 0x803D000E - WS_E_ENDPOINT_FAILURE Handle = 0x803D000F - WS_E_ENDPOINT_UNREACHABLE Handle = 0x803D0010 - WS_E_ENDPOINT_ACTION_NOT_SUPPORTED Handle = 0x803D0011 - WS_E_ENDPOINT_TOO_BUSY Handle = 0x803D0012 - WS_E_ENDPOINT_FAULT_RECEIVED Handle = 0x803D0013 - WS_E_ENDPOINT_DISCONNECTED Handle = 0x803D0014 - WS_E_PROXY_FAILURE Handle = 0x803D0015 - WS_E_PROXY_ACCESS_DENIED Handle = 0x803D0016 - WS_E_NOT_SUPPORTED Handle = 0x803D0017 - WS_E_PROXY_REQUIRES_BASIC_AUTH Handle = 0x803D0018 - WS_E_PROXY_REQUIRES_DIGEST_AUTH Handle = 0x803D0019 - WS_E_PROXY_REQUIRES_NTLM_AUTH Handle = 0x803D001A - WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001B - WS_E_SERVER_REQUIRES_BASIC_AUTH Handle = 0x803D001C - WS_E_SERVER_REQUIRES_DIGEST_AUTH Handle = 0x803D001D - WS_E_SERVER_REQUIRES_NTLM_AUTH Handle = 0x803D001E - WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001F - WS_E_INVALID_ENDPOINT_URL Handle = 0x803D0020 - WS_E_OTHER Handle = 0x803D0021 - WS_E_SECURITY_TOKEN_EXPIRED Handle = 0x803D0022 - WS_E_SECURITY_SYSTEM_FAILURE Handle = 0x803D0023 - ERROR_NDIS_INTERFACE_CLOSING syscall.Errno = 0x80340002 - ERROR_NDIS_BAD_VERSION syscall.Errno = 0x80340004 - ERROR_NDIS_BAD_CHARACTERISTICS syscall.Errno = 0x80340005 - ERROR_NDIS_ADAPTER_NOT_FOUND syscall.Errno = 0x80340006 - ERROR_NDIS_OPEN_FAILED syscall.Errno = 0x80340007 - ERROR_NDIS_DEVICE_FAILED syscall.Errno = 0x80340008 - ERROR_NDIS_MULTICAST_FULL syscall.Errno = 0x80340009 - ERROR_NDIS_MULTICAST_EXISTS syscall.Errno = 0x8034000A - ERROR_NDIS_MULTICAST_NOT_FOUND syscall.Errno = 0x8034000B - ERROR_NDIS_REQUEST_ABORTED syscall.Errno = 0x8034000C - ERROR_NDIS_RESET_IN_PROGRESS syscall.Errno = 0x8034000D - ERROR_NDIS_NOT_SUPPORTED syscall.Errno = 0x803400BB - ERROR_NDIS_INVALID_PACKET syscall.Errno = 0x8034000F - ERROR_NDIS_ADAPTER_NOT_READY syscall.Errno = 0x80340011 - ERROR_NDIS_INVALID_LENGTH syscall.Errno = 0x80340014 - ERROR_NDIS_INVALID_DATA syscall.Errno = 0x80340015 - ERROR_NDIS_BUFFER_TOO_SHORT syscall.Errno = 0x80340016 - ERROR_NDIS_INVALID_OID syscall.Errno = 0x80340017 - ERROR_NDIS_ADAPTER_REMOVED syscall.Errno = 0x80340018 - ERROR_NDIS_UNSUPPORTED_MEDIA syscall.Errno = 0x80340019 - ERROR_NDIS_GROUP_ADDRESS_IN_USE syscall.Errno = 0x8034001A - ERROR_NDIS_FILE_NOT_FOUND syscall.Errno = 0x8034001B - ERROR_NDIS_ERROR_READING_FILE syscall.Errno = 0x8034001C - ERROR_NDIS_ALREADY_MAPPED syscall.Errno = 0x8034001D - ERROR_NDIS_RESOURCE_CONFLICT syscall.Errno = 0x8034001E - ERROR_NDIS_MEDIA_DISCONNECTED syscall.Errno = 0x8034001F - ERROR_NDIS_INVALID_ADDRESS syscall.Errno = 0x80340022 - ERROR_NDIS_INVALID_DEVICE_REQUEST syscall.Errno = 0x80340010 - ERROR_NDIS_PAUSED syscall.Errno = 0x8034002A - ERROR_NDIS_INTERFACE_NOT_FOUND syscall.Errno = 0x8034002B - ERROR_NDIS_UNSUPPORTED_REVISION syscall.Errno = 0x8034002C - ERROR_NDIS_INVALID_PORT syscall.Errno = 0x8034002D - ERROR_NDIS_INVALID_PORT_STATE syscall.Errno = 0x8034002E - ERROR_NDIS_LOW_POWER_STATE syscall.Errno = 0x8034002F - ERROR_NDIS_REINIT_REQUIRED syscall.Errno = 0x80340030 - ERROR_NDIS_NO_QUEUES syscall.Errno = 0x80340031 - ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED syscall.Errno = 0x80342000 - ERROR_NDIS_DOT11_MEDIA_IN_USE syscall.Errno = 0x80342001 - ERROR_NDIS_DOT11_POWER_STATE_INVALID syscall.Errno = 0x80342002 - ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL syscall.Errno = 0x80342003 - ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL syscall.Errno = 0x80342004 - ERROR_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342005 - ERROR_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342006 - ERROR_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED syscall.Errno = 0x80342007 - ERROR_NDIS_DOT11_AP_BAND_NOT_ALLOWED syscall.Errno = 0x80342008 - ERROR_NDIS_INDICATION_REQUIRED syscall.Errno = 0x00340001 - ERROR_NDIS_OFFLOAD_POLICY syscall.Errno = 0xC034100F - ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED syscall.Errno = 0xC0341012 - ERROR_NDIS_OFFLOAD_PATH_REJECTED syscall.Errno = 0xC0341013 - ERROR_HV_INVALID_HYPERCALL_CODE syscall.Errno = 0xC0350002 - ERROR_HV_INVALID_HYPERCALL_INPUT syscall.Errno = 0xC0350003 - ERROR_HV_INVALID_ALIGNMENT syscall.Errno = 0xC0350004 - ERROR_HV_INVALID_PARAMETER syscall.Errno = 0xC0350005 - ERROR_HV_ACCESS_DENIED syscall.Errno = 0xC0350006 - ERROR_HV_INVALID_PARTITION_STATE syscall.Errno = 0xC0350007 - ERROR_HV_OPERATION_DENIED syscall.Errno = 0xC0350008 - ERROR_HV_UNKNOWN_PROPERTY syscall.Errno = 0xC0350009 - ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE syscall.Errno = 0xC035000A - ERROR_HV_INSUFFICIENT_MEMORY syscall.Errno = 0xC035000B - ERROR_HV_PARTITION_TOO_DEEP syscall.Errno = 0xC035000C - ERROR_HV_INVALID_PARTITION_ID syscall.Errno = 0xC035000D - ERROR_HV_INVALID_VP_INDEX syscall.Errno = 0xC035000E - ERROR_HV_INVALID_PORT_ID syscall.Errno = 0xC0350011 - ERROR_HV_INVALID_CONNECTION_ID syscall.Errno = 0xC0350012 - ERROR_HV_INSUFFICIENT_BUFFERS syscall.Errno = 0xC0350013 - ERROR_HV_NOT_ACKNOWLEDGED syscall.Errno = 0xC0350014 - ERROR_HV_INVALID_VP_STATE syscall.Errno = 0xC0350015 - ERROR_HV_ACKNOWLEDGED syscall.Errno = 0xC0350016 - ERROR_HV_INVALID_SAVE_RESTORE_STATE syscall.Errno = 0xC0350017 - ERROR_HV_INVALID_SYNIC_STATE syscall.Errno = 0xC0350018 - ERROR_HV_OBJECT_IN_USE syscall.Errno = 0xC0350019 - ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO syscall.Errno = 0xC035001A - ERROR_HV_NO_DATA syscall.Errno = 0xC035001B - ERROR_HV_INACTIVE syscall.Errno = 0xC035001C - ERROR_HV_NO_RESOURCES syscall.Errno = 0xC035001D - ERROR_HV_FEATURE_UNAVAILABLE syscall.Errno = 0xC035001E - ERROR_HV_INSUFFICIENT_BUFFER syscall.Errno = 0xC0350033 - ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS syscall.Errno = 0xC0350038 - ERROR_HV_CPUID_FEATURE_VALIDATION syscall.Errno = 0xC035003C - ERROR_HV_CPUID_XSAVE_FEATURE_VALIDATION syscall.Errno = 0xC035003D - ERROR_HV_PROCESSOR_STARTUP_TIMEOUT syscall.Errno = 0xC035003E - ERROR_HV_SMX_ENABLED syscall.Errno = 0xC035003F - ERROR_HV_INVALID_LP_INDEX syscall.Errno = 0xC0350041 - ERROR_HV_INVALID_REGISTER_VALUE syscall.Errno = 0xC0350050 - ERROR_HV_INVALID_VTL_STATE syscall.Errno = 0xC0350051 - ERROR_HV_NX_NOT_DETECTED syscall.Errno = 0xC0350055 - ERROR_HV_INVALID_DEVICE_ID syscall.Errno = 0xC0350057 - ERROR_HV_INVALID_DEVICE_STATE syscall.Errno = 0xC0350058 - ERROR_HV_PENDING_PAGE_REQUESTS syscall.Errno = 0x00350059 - ERROR_HV_PAGE_REQUEST_INVALID syscall.Errno = 0xC0350060 - ERROR_HV_INVALID_CPU_GROUP_ID syscall.Errno = 0xC035006F - ERROR_HV_INVALID_CPU_GROUP_STATE syscall.Errno = 0xC0350070 - ERROR_HV_OPERATION_FAILED syscall.Errno = 0xC0350071 - ERROR_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE syscall.Errno = 0xC0350072 - ERROR_HV_INSUFFICIENT_ROOT_MEMORY syscall.Errno = 0xC0350073 - ERROR_HV_NOT_PRESENT syscall.Errno = 0xC0351000 - ERROR_VID_DUPLICATE_HANDLER syscall.Errno = 0xC0370001 - ERROR_VID_TOO_MANY_HANDLERS syscall.Errno = 0xC0370002 - ERROR_VID_QUEUE_FULL syscall.Errno = 0xC0370003 - ERROR_VID_HANDLER_NOT_PRESENT syscall.Errno = 0xC0370004 - ERROR_VID_INVALID_OBJECT_NAME syscall.Errno = 0xC0370005 - ERROR_VID_PARTITION_NAME_TOO_LONG syscall.Errno = 0xC0370006 - ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG syscall.Errno = 0xC0370007 - ERROR_VID_PARTITION_ALREADY_EXISTS syscall.Errno = 0xC0370008 - ERROR_VID_PARTITION_DOES_NOT_EXIST syscall.Errno = 0xC0370009 - ERROR_VID_PARTITION_NAME_NOT_FOUND syscall.Errno = 0xC037000A - ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS syscall.Errno = 0xC037000B - ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT syscall.Errno = 0xC037000C - ERROR_VID_MB_STILL_REFERENCED syscall.Errno = 0xC037000D - ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED syscall.Errno = 0xC037000E - ERROR_VID_INVALID_NUMA_SETTINGS syscall.Errno = 0xC037000F - ERROR_VID_INVALID_NUMA_NODE_INDEX syscall.Errno = 0xC0370010 - ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED syscall.Errno = 0xC0370011 - ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE syscall.Errno = 0xC0370012 - ERROR_VID_PAGE_RANGE_OVERFLOW syscall.Errno = 0xC0370013 - ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE syscall.Errno = 0xC0370014 - ERROR_VID_INVALID_GPA_RANGE_HANDLE syscall.Errno = 0xC0370015 - ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE syscall.Errno = 0xC0370016 - ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED syscall.Errno = 0xC0370017 - ERROR_VID_INVALID_PPM_HANDLE syscall.Errno = 0xC0370018 - ERROR_VID_MBPS_ARE_LOCKED syscall.Errno = 0xC0370019 - ERROR_VID_MESSAGE_QUEUE_CLOSED syscall.Errno = 0xC037001A - ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED syscall.Errno = 0xC037001B - ERROR_VID_STOP_PENDING syscall.Errno = 0xC037001C - ERROR_VID_INVALID_PROCESSOR_STATE syscall.Errno = 0xC037001D - ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT syscall.Errno = 0xC037001E - ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED syscall.Errno = 0xC037001F - ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET syscall.Errno = 0xC0370020 - ERROR_VID_MMIO_RANGE_DESTROYED syscall.Errno = 0xC0370021 - ERROR_VID_INVALID_CHILD_GPA_PAGE_SET syscall.Errno = 0xC0370022 - ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED syscall.Errno = 0xC0370023 - ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL syscall.Errno = 0xC0370024 - ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE syscall.Errno = 0xC0370025 - ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT syscall.Errno = 0xC0370026 - ERROR_VID_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370027 - ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM syscall.Errno = 0xC0370028 - ERROR_VID_SAVED_STATE_INCOMPATIBLE syscall.Errno = 0xC0370029 - ERROR_VID_VTL_ACCESS_DENIED syscall.Errno = 0xC037002A - ERROR_VMCOMPUTE_TERMINATED_DURING_START syscall.Errno = 0xC0370100 - ERROR_VMCOMPUTE_IMAGE_MISMATCH syscall.Errno = 0xC0370101 - ERROR_VMCOMPUTE_HYPERV_NOT_INSTALLED syscall.Errno = 0xC0370102 - ERROR_VMCOMPUTE_OPERATION_PENDING syscall.Errno = 0xC0370103 - ERROR_VMCOMPUTE_TOO_MANY_NOTIFICATIONS syscall.Errno = 0xC0370104 - ERROR_VMCOMPUTE_INVALID_STATE syscall.Errno = 0xC0370105 - ERROR_VMCOMPUTE_UNEXPECTED_EXIT syscall.Errno = 0xC0370106 - ERROR_VMCOMPUTE_TERMINATED syscall.Errno = 0xC0370107 - ERROR_VMCOMPUTE_CONNECT_FAILED syscall.Errno = 0xC0370108 - ERROR_VMCOMPUTE_TIMEOUT syscall.Errno = 0xC0370109 - ERROR_VMCOMPUTE_CONNECTION_CLOSED syscall.Errno = 0xC037010A - ERROR_VMCOMPUTE_UNKNOWN_MESSAGE syscall.Errno = 0xC037010B - ERROR_VMCOMPUTE_UNSUPPORTED_PROTOCOL_VERSION syscall.Errno = 0xC037010C - ERROR_VMCOMPUTE_INVALID_JSON syscall.Errno = 0xC037010D - ERROR_VMCOMPUTE_SYSTEM_NOT_FOUND syscall.Errno = 0xC037010E - ERROR_VMCOMPUTE_SYSTEM_ALREADY_EXISTS syscall.Errno = 0xC037010F - ERROR_VMCOMPUTE_SYSTEM_ALREADY_STOPPED syscall.Errno = 0xC0370110 - ERROR_VMCOMPUTE_PROTOCOL_ERROR syscall.Errno = 0xC0370111 - ERROR_VMCOMPUTE_INVALID_LAYER syscall.Errno = 0xC0370112 - ERROR_VMCOMPUTE_WINDOWS_INSIDER_REQUIRED syscall.Errno = 0xC0370113 - HCS_E_TERMINATED_DURING_START Handle = 0x80370100 - HCS_E_IMAGE_MISMATCH Handle = 0x80370101 - HCS_E_HYPERV_NOT_INSTALLED Handle = 0x80370102 - HCS_E_INVALID_STATE Handle = 0x80370105 - HCS_E_UNEXPECTED_EXIT Handle = 0x80370106 - HCS_E_TERMINATED Handle = 0x80370107 - HCS_E_CONNECT_FAILED Handle = 0x80370108 - HCS_E_CONNECTION_TIMEOUT Handle = 0x80370109 - HCS_E_CONNECTION_CLOSED Handle = 0x8037010A - HCS_E_UNKNOWN_MESSAGE Handle = 0x8037010B - HCS_E_UNSUPPORTED_PROTOCOL_VERSION Handle = 0x8037010C - HCS_E_INVALID_JSON Handle = 0x8037010D - HCS_E_SYSTEM_NOT_FOUND Handle = 0x8037010E - HCS_E_SYSTEM_ALREADY_EXISTS Handle = 0x8037010F - HCS_E_SYSTEM_ALREADY_STOPPED Handle = 0x80370110 - HCS_E_PROTOCOL_ERROR Handle = 0x80370111 - HCS_E_INVALID_LAYER Handle = 0x80370112 - HCS_E_WINDOWS_INSIDER_REQUIRED Handle = 0x80370113 - HCS_E_SERVICE_NOT_AVAILABLE Handle = 0x80370114 - HCS_E_OPERATION_NOT_STARTED Handle = 0x80370115 - HCS_E_OPERATION_ALREADY_STARTED Handle = 0x80370116 - HCS_E_OPERATION_PENDING Handle = 0x80370117 - HCS_E_OPERATION_TIMEOUT Handle = 0x80370118 - HCS_E_OPERATION_SYSTEM_CALLBACK_ALREADY_SET Handle = 0x80370119 - HCS_E_OPERATION_RESULT_ALLOCATION_FAILED Handle = 0x8037011A - HCS_E_ACCESS_DENIED Handle = 0x8037011B - HCS_E_GUEST_CRITICAL_ERROR Handle = 0x8037011C - ERROR_VNET_VIRTUAL_SWITCH_NAME_NOT_FOUND syscall.Errno = 0xC0370200 - ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED syscall.Errno = 0x80370001 - WHV_E_UNKNOWN_CAPABILITY Handle = 0x80370300 - WHV_E_INSUFFICIENT_BUFFER Handle = 0x80370301 - WHV_E_UNKNOWN_PROPERTY Handle = 0x80370302 - WHV_E_UNSUPPORTED_HYPERVISOR_CONFIG Handle = 0x80370303 - WHV_E_INVALID_PARTITION_CONFIG Handle = 0x80370304 - WHV_E_GPA_RANGE_NOT_FOUND Handle = 0x80370305 - WHV_E_VP_ALREADY_EXISTS Handle = 0x80370306 - WHV_E_VP_DOES_NOT_EXIST Handle = 0x80370307 - WHV_E_INVALID_VP_STATE Handle = 0x80370308 - WHV_E_INVALID_VP_REGISTER_NAME Handle = 0x80370309 - ERROR_VSMB_SAVED_STATE_FILE_NOT_FOUND syscall.Errno = 0xC0370400 - ERROR_VSMB_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370401 - ERROR_VOLMGR_INCOMPLETE_REGENERATION syscall.Errno = 0x80380001 - ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION syscall.Errno = 0x80380002 - ERROR_VOLMGR_DATABASE_FULL syscall.Errno = 0xC0380001 - ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED syscall.Errno = 0xC0380002 - ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC syscall.Errno = 0xC0380003 - ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED syscall.Errno = 0xC0380004 - ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME syscall.Errno = 0xC0380005 - ERROR_VOLMGR_DISK_DUPLICATE syscall.Errno = 0xC0380006 - ERROR_VOLMGR_DISK_DYNAMIC syscall.Errno = 0xC0380007 - ERROR_VOLMGR_DISK_ID_INVALID syscall.Errno = 0xC0380008 - ERROR_VOLMGR_DISK_INVALID syscall.Errno = 0xC0380009 - ERROR_VOLMGR_DISK_LAST_VOTER syscall.Errno = 0xC038000A - ERROR_VOLMGR_DISK_LAYOUT_INVALID syscall.Errno = 0xC038000B - ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS syscall.Errno = 0xC038000C - ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED syscall.Errno = 0xC038000D - ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL syscall.Errno = 0xC038000E - ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS syscall.Errno = 0xC038000F - ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS syscall.Errno = 0xC0380010 - ERROR_VOLMGR_DISK_MISSING syscall.Errno = 0xC0380011 - ERROR_VOLMGR_DISK_NOT_EMPTY syscall.Errno = 0xC0380012 - ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE syscall.Errno = 0xC0380013 - ERROR_VOLMGR_DISK_REVECTORING_FAILED syscall.Errno = 0xC0380014 - ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID syscall.Errno = 0xC0380015 - ERROR_VOLMGR_DISK_SET_NOT_CONTAINED syscall.Errno = 0xC0380016 - ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS syscall.Errno = 0xC0380017 - ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES syscall.Errno = 0xC0380018 - ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED syscall.Errno = 0xC0380019 - ERROR_VOLMGR_EXTENT_ALREADY_USED syscall.Errno = 0xC038001A - ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS syscall.Errno = 0xC038001B - ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION syscall.Errno = 0xC038001C - ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED syscall.Errno = 0xC038001D - ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION syscall.Errno = 0xC038001E - ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH syscall.Errno = 0xC038001F - ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED syscall.Errno = 0xC0380020 - ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID syscall.Errno = 0xC0380021 - ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS syscall.Errno = 0xC0380022 - ERROR_VOLMGR_MEMBER_IN_SYNC syscall.Errno = 0xC0380023 - ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE syscall.Errno = 0xC0380024 - ERROR_VOLMGR_MEMBER_INDEX_INVALID syscall.Errno = 0xC0380025 - ERROR_VOLMGR_MEMBER_MISSING syscall.Errno = 0xC0380026 - ERROR_VOLMGR_MEMBER_NOT_DETACHED syscall.Errno = 0xC0380027 - ERROR_VOLMGR_MEMBER_REGENERATING syscall.Errno = 0xC0380028 - ERROR_VOLMGR_ALL_DISKS_FAILED syscall.Errno = 0xC0380029 - ERROR_VOLMGR_NO_REGISTERED_USERS syscall.Errno = 0xC038002A - ERROR_VOLMGR_NO_SUCH_USER syscall.Errno = 0xC038002B - ERROR_VOLMGR_NOTIFICATION_RESET syscall.Errno = 0xC038002C - ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID syscall.Errno = 0xC038002D - ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID syscall.Errno = 0xC038002E - ERROR_VOLMGR_PACK_DUPLICATE syscall.Errno = 0xC038002F - ERROR_VOLMGR_PACK_ID_INVALID syscall.Errno = 0xC0380030 - ERROR_VOLMGR_PACK_INVALID syscall.Errno = 0xC0380031 - ERROR_VOLMGR_PACK_NAME_INVALID syscall.Errno = 0xC0380032 - ERROR_VOLMGR_PACK_OFFLINE syscall.Errno = 0xC0380033 - ERROR_VOLMGR_PACK_HAS_QUORUM syscall.Errno = 0xC0380034 - ERROR_VOLMGR_PACK_WITHOUT_QUORUM syscall.Errno = 0xC0380035 - ERROR_VOLMGR_PARTITION_STYLE_INVALID syscall.Errno = 0xC0380036 - ERROR_VOLMGR_PARTITION_UPDATE_FAILED syscall.Errno = 0xC0380037 - ERROR_VOLMGR_PLEX_IN_SYNC syscall.Errno = 0xC0380038 - ERROR_VOLMGR_PLEX_INDEX_DUPLICATE syscall.Errno = 0xC0380039 - ERROR_VOLMGR_PLEX_INDEX_INVALID syscall.Errno = 0xC038003A - ERROR_VOLMGR_PLEX_LAST_ACTIVE syscall.Errno = 0xC038003B - ERROR_VOLMGR_PLEX_MISSING syscall.Errno = 0xC038003C - ERROR_VOLMGR_PLEX_REGENERATING syscall.Errno = 0xC038003D - ERROR_VOLMGR_PLEX_TYPE_INVALID syscall.Errno = 0xC038003E - ERROR_VOLMGR_PLEX_NOT_RAID5 syscall.Errno = 0xC038003F - ERROR_VOLMGR_PLEX_NOT_SIMPLE syscall.Errno = 0xC0380040 - ERROR_VOLMGR_STRUCTURE_SIZE_INVALID syscall.Errno = 0xC0380041 - ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS syscall.Errno = 0xC0380042 - ERROR_VOLMGR_TRANSACTION_IN_PROGRESS syscall.Errno = 0xC0380043 - ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE syscall.Errno = 0xC0380044 - ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK syscall.Errno = 0xC0380045 - ERROR_VOLMGR_VOLUME_ID_INVALID syscall.Errno = 0xC0380046 - ERROR_VOLMGR_VOLUME_LENGTH_INVALID syscall.Errno = 0xC0380047 - ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE syscall.Errno = 0xC0380048 - ERROR_VOLMGR_VOLUME_NOT_MIRRORED syscall.Errno = 0xC0380049 - ERROR_VOLMGR_VOLUME_NOT_RETAINED syscall.Errno = 0xC038004A - ERROR_VOLMGR_VOLUME_OFFLINE syscall.Errno = 0xC038004B - ERROR_VOLMGR_VOLUME_RETAINED syscall.Errno = 0xC038004C - ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID syscall.Errno = 0xC038004D - ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE syscall.Errno = 0xC038004E - ERROR_VOLMGR_BAD_BOOT_DISK syscall.Errno = 0xC038004F - ERROR_VOLMGR_PACK_CONFIG_OFFLINE syscall.Errno = 0xC0380050 - ERROR_VOLMGR_PACK_CONFIG_ONLINE syscall.Errno = 0xC0380051 - ERROR_VOLMGR_NOT_PRIMARY_PACK syscall.Errno = 0xC0380052 - ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED syscall.Errno = 0xC0380053 - ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID syscall.Errno = 0xC0380054 - ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID syscall.Errno = 0xC0380055 - ERROR_VOLMGR_VOLUME_MIRRORED syscall.Errno = 0xC0380056 - ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED syscall.Errno = 0xC0380057 - ERROR_VOLMGR_NO_VALID_LOG_COPIES syscall.Errno = 0xC0380058 - ERROR_VOLMGR_PRIMARY_PACK_PRESENT syscall.Errno = 0xC0380059 - ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID syscall.Errno = 0xC038005A - ERROR_VOLMGR_MIRROR_NOT_SUPPORTED syscall.Errno = 0xC038005B - ERROR_VOLMGR_RAID5_NOT_SUPPORTED syscall.Errno = 0xC038005C - ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED syscall.Errno = 0x80390001 - ERROR_BCD_TOO_MANY_ELEMENTS syscall.Errno = 0xC0390002 - ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED syscall.Errno = 0x80390003 - ERROR_VHD_DRIVE_FOOTER_MISSING syscall.Errno = 0xC03A0001 - ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0002 - ERROR_VHD_DRIVE_FOOTER_CORRUPT syscall.Errno = 0xC03A0003 - ERROR_VHD_FORMAT_UNKNOWN syscall.Errno = 0xC03A0004 - ERROR_VHD_FORMAT_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0005 - ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0006 - ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0007 - ERROR_VHD_SPARSE_HEADER_CORRUPT syscall.Errno = 0xC03A0008 - ERROR_VHD_BLOCK_ALLOCATION_FAILURE syscall.Errno = 0xC03A0009 - ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT syscall.Errno = 0xC03A000A - ERROR_VHD_INVALID_BLOCK_SIZE syscall.Errno = 0xC03A000B - ERROR_VHD_BITMAP_MISMATCH syscall.Errno = 0xC03A000C - ERROR_VHD_PARENT_VHD_NOT_FOUND syscall.Errno = 0xC03A000D - ERROR_VHD_CHILD_PARENT_ID_MISMATCH syscall.Errno = 0xC03A000E - ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH syscall.Errno = 0xC03A000F - ERROR_VHD_METADATA_READ_FAILURE syscall.Errno = 0xC03A0010 - ERROR_VHD_METADATA_WRITE_FAILURE syscall.Errno = 0xC03A0011 - ERROR_VHD_INVALID_SIZE syscall.Errno = 0xC03A0012 - ERROR_VHD_INVALID_FILE_SIZE syscall.Errno = 0xC03A0013 - ERROR_VIRTDISK_PROVIDER_NOT_FOUND syscall.Errno = 0xC03A0014 - ERROR_VIRTDISK_NOT_VIRTUAL_DISK syscall.Errno = 0xC03A0015 - ERROR_VHD_PARENT_VHD_ACCESS_DENIED syscall.Errno = 0xC03A0016 - ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH syscall.Errno = 0xC03A0017 - ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED syscall.Errno = 0xC03A0018 - ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT syscall.Errno = 0xC03A0019 - ERROR_VIRTUAL_DISK_LIMITATION syscall.Errno = 0xC03A001A - ERROR_VHD_INVALID_TYPE syscall.Errno = 0xC03A001B - ERROR_VHD_INVALID_STATE syscall.Errno = 0xC03A001C - ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE syscall.Errno = 0xC03A001D - ERROR_VIRTDISK_DISK_ALREADY_OWNED syscall.Errno = 0xC03A001E - ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE syscall.Errno = 0xC03A001F - ERROR_CTLOG_TRACKING_NOT_INITIALIZED syscall.Errno = 0xC03A0020 - ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE syscall.Errno = 0xC03A0021 - ERROR_CTLOG_VHD_CHANGED_OFFLINE syscall.Errno = 0xC03A0022 - ERROR_CTLOG_INVALID_TRACKING_STATE syscall.Errno = 0xC03A0023 - ERROR_CTLOG_INCONSISTENT_TRACKING_FILE syscall.Errno = 0xC03A0024 - ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA syscall.Errno = 0xC03A0025 - ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0026 - ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0027 - ERROR_VHD_METADATA_FULL syscall.Errno = 0xC03A0028 - ERROR_VHD_INVALID_CHANGE_TRACKING_ID syscall.Errno = 0xC03A0029 - ERROR_VHD_CHANGE_TRACKING_DISABLED syscall.Errno = 0xC03A002A - ERROR_VHD_MISSING_CHANGE_TRACKING_INFORMATION syscall.Errno = 0xC03A0030 - ERROR_QUERY_STORAGE_ERROR syscall.Errno = 0x803A0001 - HCN_E_NETWORK_NOT_FOUND Handle = 0x803B0001 - HCN_E_ENDPOINT_NOT_FOUND Handle = 0x803B0002 - HCN_E_LAYER_NOT_FOUND Handle = 0x803B0003 - HCN_E_SWITCH_NOT_FOUND Handle = 0x803B0004 - HCN_E_SUBNET_NOT_FOUND Handle = 0x803B0005 - HCN_E_ADAPTER_NOT_FOUND Handle = 0x803B0006 - HCN_E_PORT_NOT_FOUND Handle = 0x803B0007 - HCN_E_POLICY_NOT_FOUND Handle = 0x803B0008 - HCN_E_VFP_PORTSETTING_NOT_FOUND Handle = 0x803B0009 - HCN_E_INVALID_NETWORK Handle = 0x803B000A - HCN_E_INVALID_NETWORK_TYPE Handle = 0x803B000B - HCN_E_INVALID_ENDPOINT Handle = 0x803B000C - HCN_E_INVALID_POLICY Handle = 0x803B000D - HCN_E_INVALID_POLICY_TYPE Handle = 0x803B000E - HCN_E_INVALID_REMOTE_ENDPOINT_OPERATION Handle = 0x803B000F - HCN_E_NETWORK_ALREADY_EXISTS Handle = 0x803B0010 - HCN_E_LAYER_ALREADY_EXISTS Handle = 0x803B0011 - HCN_E_POLICY_ALREADY_EXISTS Handle = 0x803B0012 - HCN_E_PORT_ALREADY_EXISTS Handle = 0x803B0013 - HCN_E_ENDPOINT_ALREADY_ATTACHED Handle = 0x803B0014 - HCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0015 - HCN_E_MAPPING_NOT_SUPPORTED Handle = 0x803B0016 - HCN_E_DEGRADED_OPERATION Handle = 0x803B0017 - HCN_E_SHARED_SWITCH_MODIFICATION Handle = 0x803B0018 - HCN_E_GUID_CONVERSION_FAILURE Handle = 0x803B0019 - HCN_E_REGKEY_FAILURE Handle = 0x803B001A - HCN_E_INVALID_JSON Handle = 0x803B001B - HCN_E_INVALID_JSON_REFERENCE Handle = 0x803B001C - HCN_E_ENDPOINT_SHARING_DISABLED Handle = 0x803B001D - HCN_E_INVALID_IP Handle = 0x803B001E - HCN_E_SWITCH_EXTENSION_NOT_FOUND Handle = 0x803B001F - HCN_E_MANAGER_STOPPED Handle = 0x803B0020 - GCN_E_MODULE_NOT_FOUND Handle = 0x803B0021 - GCN_E_NO_REQUEST_HANDLERS Handle = 0x803B0022 - GCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0023 - GCN_E_RUNTIMEKEYS_FAILED Handle = 0x803B0024 - GCN_E_NETADAPTER_TIMEOUT Handle = 0x803B0025 - GCN_E_NETADAPTER_NOT_FOUND Handle = 0x803B0026 - GCN_E_NETCOMPARTMENT_NOT_FOUND Handle = 0x803B0027 - GCN_E_NETINTERFACE_NOT_FOUND Handle = 0x803B0028 - GCN_E_DEFAULTNAMESPACE_EXISTS Handle = 0x803B0029 - SDIAG_E_CANCELLED syscall.Errno = 0x803C0100 - SDIAG_E_SCRIPT syscall.Errno = 0x803C0101 - SDIAG_E_POWERSHELL syscall.Errno = 0x803C0102 - SDIAG_E_MANAGEDHOST syscall.Errno = 0x803C0103 - SDIAG_E_NOVERIFIER syscall.Errno = 0x803C0104 - SDIAG_S_CANNOTRUN syscall.Errno = 0x003C0105 - SDIAG_E_DISABLED syscall.Errno = 0x803C0106 - SDIAG_E_TRUST syscall.Errno = 0x803C0107 - SDIAG_E_CANNOTRUN syscall.Errno = 0x803C0108 - SDIAG_E_VERSION syscall.Errno = 0x803C0109 - SDIAG_E_RESOURCE syscall.Errno = 0x803C010A - SDIAG_E_ROOTCAUSE syscall.Errno = 0x803C010B - WPN_E_CHANNEL_CLOSED Handle = 0x803E0100 - WPN_E_CHANNEL_REQUEST_NOT_COMPLETE Handle = 0x803E0101 - WPN_E_INVALID_APP Handle = 0x803E0102 - WPN_E_OUTSTANDING_CHANNEL_REQUEST Handle = 0x803E0103 - WPN_E_DUPLICATE_CHANNEL Handle = 0x803E0104 - WPN_E_PLATFORM_UNAVAILABLE Handle = 0x803E0105 - WPN_E_NOTIFICATION_POSTED Handle = 0x803E0106 - WPN_E_NOTIFICATION_HIDDEN Handle = 0x803E0107 - WPN_E_NOTIFICATION_NOT_POSTED Handle = 0x803E0108 - WPN_E_CLOUD_DISABLED Handle = 0x803E0109 - WPN_E_CLOUD_INCAPABLE Handle = 0x803E0110 - WPN_E_CLOUD_AUTH_UNAVAILABLE Handle = 0x803E011A - WPN_E_CLOUD_SERVICE_UNAVAILABLE Handle = 0x803E011B - WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION Handle = 0x803E011C - WPN_E_NOTIFICATION_DISABLED Handle = 0x803E0111 - WPN_E_NOTIFICATION_INCAPABLE Handle = 0x803E0112 - WPN_E_INTERNET_INCAPABLE Handle = 0x803E0113 - WPN_E_NOTIFICATION_TYPE_DISABLED Handle = 0x803E0114 - WPN_E_NOTIFICATION_SIZE Handle = 0x803E0115 - WPN_E_TAG_SIZE Handle = 0x803E0116 - WPN_E_ACCESS_DENIED Handle = 0x803E0117 - WPN_E_DUPLICATE_REGISTRATION Handle = 0x803E0118 - WPN_E_PUSH_NOTIFICATION_INCAPABLE Handle = 0x803E0119 - WPN_E_DEV_ID_SIZE Handle = 0x803E0120 - WPN_E_TAG_ALPHANUMERIC Handle = 0x803E012A - WPN_E_INVALID_HTTP_STATUS_CODE Handle = 0x803E012B - WPN_E_OUT_OF_SESSION Handle = 0x803E0200 - WPN_E_POWER_SAVE Handle = 0x803E0201 - WPN_E_IMAGE_NOT_FOUND_IN_CACHE Handle = 0x803E0202 - WPN_E_ALL_URL_NOT_COMPLETED Handle = 0x803E0203 - WPN_E_INVALID_CLOUD_IMAGE Handle = 0x803E0204 - WPN_E_NOTIFICATION_ID_MATCHED Handle = 0x803E0205 - WPN_E_CALLBACK_ALREADY_REGISTERED Handle = 0x803E0206 - WPN_E_TOAST_NOTIFICATION_DROPPED Handle = 0x803E0207 - WPN_E_STORAGE_LOCKED Handle = 0x803E0208 - WPN_E_GROUP_SIZE Handle = 0x803E0209 - WPN_E_GROUP_ALPHANUMERIC Handle = 0x803E020A - WPN_E_CLOUD_DISABLED_FOR_APP Handle = 0x803E020B - E_MBN_CONTEXT_NOT_ACTIVATED Handle = 0x80548201 - E_MBN_BAD_SIM Handle = 0x80548202 - E_MBN_DATA_CLASS_NOT_AVAILABLE Handle = 0x80548203 - E_MBN_INVALID_ACCESS_STRING Handle = 0x80548204 - E_MBN_MAX_ACTIVATED_CONTEXTS Handle = 0x80548205 - E_MBN_PACKET_SVC_DETACHED Handle = 0x80548206 - E_MBN_PROVIDER_NOT_VISIBLE Handle = 0x80548207 - E_MBN_RADIO_POWER_OFF Handle = 0x80548208 - E_MBN_SERVICE_NOT_ACTIVATED Handle = 0x80548209 - E_MBN_SIM_NOT_INSERTED Handle = 0x8054820A - E_MBN_VOICE_CALL_IN_PROGRESS Handle = 0x8054820B - E_MBN_INVALID_CACHE Handle = 0x8054820C - E_MBN_NOT_REGISTERED Handle = 0x8054820D - E_MBN_PROVIDERS_NOT_FOUND Handle = 0x8054820E - E_MBN_PIN_NOT_SUPPORTED Handle = 0x8054820F - E_MBN_PIN_REQUIRED Handle = 0x80548210 - E_MBN_PIN_DISABLED Handle = 0x80548211 - E_MBN_FAILURE Handle = 0x80548212 - E_MBN_INVALID_PROFILE Handle = 0x80548218 - E_MBN_DEFAULT_PROFILE_EXIST Handle = 0x80548219 - E_MBN_SMS_ENCODING_NOT_SUPPORTED Handle = 0x80548220 - E_MBN_SMS_FILTER_NOT_SUPPORTED Handle = 0x80548221 - E_MBN_SMS_INVALID_MEMORY_INDEX Handle = 0x80548222 - E_MBN_SMS_LANG_NOT_SUPPORTED Handle = 0x80548223 - E_MBN_SMS_MEMORY_FAILURE Handle = 0x80548224 - E_MBN_SMS_NETWORK_TIMEOUT Handle = 0x80548225 - E_MBN_SMS_UNKNOWN_SMSC_ADDRESS Handle = 0x80548226 - E_MBN_SMS_FORMAT_NOT_SUPPORTED Handle = 0x80548227 - E_MBN_SMS_OPERATION_NOT_ALLOWED Handle = 0x80548228 - E_MBN_SMS_MEMORY_FULL Handle = 0x80548229 - PEER_E_IPV6_NOT_INSTALLED Handle = 0x80630001 - PEER_E_NOT_INITIALIZED Handle = 0x80630002 - PEER_E_CANNOT_START_SERVICE Handle = 0x80630003 - PEER_E_NOT_LICENSED Handle = 0x80630004 - PEER_E_INVALID_GRAPH Handle = 0x80630010 - PEER_E_DBNAME_CHANGED Handle = 0x80630011 - PEER_E_DUPLICATE_GRAPH Handle = 0x80630012 - PEER_E_GRAPH_NOT_READY Handle = 0x80630013 - PEER_E_GRAPH_SHUTTING_DOWN Handle = 0x80630014 - PEER_E_GRAPH_IN_USE Handle = 0x80630015 - PEER_E_INVALID_DATABASE Handle = 0x80630016 - PEER_E_TOO_MANY_ATTRIBUTES Handle = 0x80630017 - PEER_E_CONNECTION_NOT_FOUND Handle = 0x80630103 - PEER_E_CONNECT_SELF Handle = 0x80630106 - PEER_E_ALREADY_LISTENING Handle = 0x80630107 - PEER_E_NODE_NOT_FOUND Handle = 0x80630108 - PEER_E_CONNECTION_FAILED Handle = 0x80630109 - PEER_E_CONNECTION_NOT_AUTHENTICATED Handle = 0x8063010A - PEER_E_CONNECTION_REFUSED Handle = 0x8063010B - PEER_E_CLASSIFIER_TOO_LONG Handle = 0x80630201 - PEER_E_TOO_MANY_IDENTITIES Handle = 0x80630202 - PEER_E_NO_KEY_ACCESS Handle = 0x80630203 - PEER_E_GROUPS_EXIST Handle = 0x80630204 - PEER_E_RECORD_NOT_FOUND Handle = 0x80630301 - PEER_E_DATABASE_ACCESSDENIED Handle = 0x80630302 - PEER_E_DBINITIALIZATION_FAILED Handle = 0x80630303 - PEER_E_MAX_RECORD_SIZE_EXCEEDED Handle = 0x80630304 - PEER_E_DATABASE_ALREADY_PRESENT Handle = 0x80630305 - PEER_E_DATABASE_NOT_PRESENT Handle = 0x80630306 - PEER_E_IDENTITY_NOT_FOUND Handle = 0x80630401 - PEER_E_EVENT_HANDLE_NOT_FOUND Handle = 0x80630501 - PEER_E_INVALID_SEARCH Handle = 0x80630601 - PEER_E_INVALID_ATTRIBUTES Handle = 0x80630602 - PEER_E_INVITATION_NOT_TRUSTED Handle = 0x80630701 - PEER_E_CHAIN_TOO_LONG Handle = 0x80630703 - PEER_E_INVALID_TIME_PERIOD Handle = 0x80630705 - PEER_E_CIRCULAR_CHAIN_DETECTED Handle = 0x80630706 - PEER_E_CERT_STORE_CORRUPTED Handle = 0x80630801 - PEER_E_NO_CLOUD Handle = 0x80631001 - PEER_E_CLOUD_NAME_AMBIGUOUS Handle = 0x80631005 - PEER_E_INVALID_RECORD Handle = 0x80632010 - PEER_E_NOT_AUTHORIZED Handle = 0x80632020 - PEER_E_PASSWORD_DOES_NOT_MEET_POLICY Handle = 0x80632021 - PEER_E_DEFERRED_VALIDATION Handle = 0x80632030 - PEER_E_INVALID_GROUP_PROPERTIES Handle = 0x80632040 - PEER_E_INVALID_PEER_NAME Handle = 0x80632050 - PEER_E_INVALID_CLASSIFIER Handle = 0x80632060 - PEER_E_INVALID_FRIENDLY_NAME Handle = 0x80632070 - PEER_E_INVALID_ROLE_PROPERTY Handle = 0x80632071 - PEER_E_INVALID_CLASSIFIER_PROPERTY Handle = 0x80632072 - PEER_E_INVALID_RECORD_EXPIRATION Handle = 0x80632080 - PEER_E_INVALID_CREDENTIAL_INFO Handle = 0x80632081 - PEER_E_INVALID_CREDENTIAL Handle = 0x80632082 - PEER_E_INVALID_RECORD_SIZE Handle = 0x80632083 - PEER_E_UNSUPPORTED_VERSION Handle = 0x80632090 - PEER_E_GROUP_NOT_READY Handle = 0x80632091 - PEER_E_GROUP_IN_USE Handle = 0x80632092 - PEER_E_INVALID_GROUP Handle = 0x80632093 - PEER_E_NO_MEMBERS_FOUND Handle = 0x80632094 - PEER_E_NO_MEMBER_CONNECTIONS Handle = 0x80632095 - PEER_E_UNABLE_TO_LISTEN Handle = 0x80632096 - PEER_E_IDENTITY_DELETED Handle = 0x806320A0 - PEER_E_SERVICE_NOT_AVAILABLE Handle = 0x806320A1 - PEER_E_CONTACT_NOT_FOUND Handle = 0x80636001 - PEER_S_GRAPH_DATA_CREATED Handle = 0x00630001 - PEER_S_NO_EVENT_DATA Handle = 0x00630002 - PEER_S_ALREADY_CONNECTED Handle = 0x00632000 - PEER_S_SUBSCRIPTION_EXISTS Handle = 0x00636000 - PEER_S_NO_CONNECTIVITY Handle = 0x00630005 - PEER_S_ALREADY_A_MEMBER Handle = 0x00630006 - PEER_E_CANNOT_CONVERT_PEER_NAME Handle = 0x80634001 - PEER_E_INVALID_PEER_HOST_NAME Handle = 0x80634002 - PEER_E_NO_MORE Handle = 0x80634003 - PEER_E_PNRP_DUPLICATE_PEER_NAME Handle = 0x80634005 - PEER_E_INVITE_CANCELLED Handle = 0x80637000 - PEER_E_INVITE_RESPONSE_NOT_AVAILABLE Handle = 0x80637001 - PEER_E_NOT_SIGNED_IN Handle = 0x80637003 - PEER_E_PRIVACY_DECLINED Handle = 0x80637004 - PEER_E_TIMEOUT Handle = 0x80637005 - PEER_E_INVALID_ADDRESS Handle = 0x80637007 - PEER_E_FW_EXCEPTION_DISABLED Handle = 0x80637008 - PEER_E_FW_BLOCKED_BY_POLICY Handle = 0x80637009 - PEER_E_FW_BLOCKED_BY_SHIELDS_UP Handle = 0x8063700A - PEER_E_FW_DECLINED Handle = 0x8063700B - UI_E_CREATE_FAILED Handle = 0x802A0001 - UI_E_SHUTDOWN_CALLED Handle = 0x802A0002 - UI_E_ILLEGAL_REENTRANCY Handle = 0x802A0003 - UI_E_OBJECT_SEALED Handle = 0x802A0004 - UI_E_VALUE_NOT_SET Handle = 0x802A0005 - UI_E_VALUE_NOT_DETERMINED Handle = 0x802A0006 - UI_E_INVALID_OUTPUT Handle = 0x802A0007 - UI_E_BOOLEAN_EXPECTED Handle = 0x802A0008 - UI_E_DIFFERENT_OWNER Handle = 0x802A0009 - UI_E_AMBIGUOUS_MATCH Handle = 0x802A000A - UI_E_FP_OVERFLOW Handle = 0x802A000B - UI_E_WRONG_THREAD Handle = 0x802A000C - UI_E_STORYBOARD_ACTIVE Handle = 0x802A0101 - UI_E_STORYBOARD_NOT_PLAYING Handle = 0x802A0102 - UI_E_START_KEYFRAME_AFTER_END Handle = 0x802A0103 - UI_E_END_KEYFRAME_NOT_DETERMINED Handle = 0x802A0104 - UI_E_LOOPS_OVERLAP Handle = 0x802A0105 - UI_E_TRANSITION_ALREADY_USED Handle = 0x802A0106 - UI_E_TRANSITION_NOT_IN_STORYBOARD Handle = 0x802A0107 - UI_E_TRANSITION_ECLIPSED Handle = 0x802A0108 - UI_E_TIME_BEFORE_LAST_UPDATE Handle = 0x802A0109 - UI_E_TIMER_CLIENT_ALREADY_CONNECTED Handle = 0x802A010A - UI_E_INVALID_DIMENSION Handle = 0x802A010B - UI_E_PRIMITIVE_OUT_OF_BOUNDS Handle = 0x802A010C - UI_E_WINDOW_CLOSED Handle = 0x802A0201 - E_BLUETOOTH_ATT_INVALID_HANDLE Handle = 0x80650001 - E_BLUETOOTH_ATT_READ_NOT_PERMITTED Handle = 0x80650002 - E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED Handle = 0x80650003 - E_BLUETOOTH_ATT_INVALID_PDU Handle = 0x80650004 - E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION Handle = 0x80650005 - E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED Handle = 0x80650006 - E_BLUETOOTH_ATT_INVALID_OFFSET Handle = 0x80650007 - E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION Handle = 0x80650008 - E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL Handle = 0x80650009 - E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND Handle = 0x8065000A - E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG Handle = 0x8065000B - E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE Handle = 0x8065000C - E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH Handle = 0x8065000D - E_BLUETOOTH_ATT_UNLIKELY Handle = 0x8065000E - E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION Handle = 0x8065000F - E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE Handle = 0x80650010 - E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES Handle = 0x80650011 - E_BLUETOOTH_ATT_UNKNOWN_ERROR Handle = 0x80651000 - E_AUDIO_ENGINE_NODE_NOT_FOUND Handle = 0x80660001 - E_HDAUDIO_EMPTY_CONNECTION_LIST Handle = 0x80660002 - E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED Handle = 0x80660003 - E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED Handle = 0x80660004 - E_HDAUDIO_NULL_LINKED_LIST_ENTRY Handle = 0x80660005 - STATEREPOSITORY_E_CONCURRENCY_LOCKING_FAILURE Handle = 0x80670001 - STATEREPOSITORY_E_STATEMENT_INPROGRESS Handle = 0x80670002 - STATEREPOSITORY_E_CONFIGURATION_INVALID Handle = 0x80670003 - STATEREPOSITORY_E_UNKNOWN_SCHEMA_VERSION Handle = 0x80670004 - STATEREPOSITORY_ERROR_DICTIONARY_CORRUPTED Handle = 0x80670005 - STATEREPOSITORY_E_BLOCKED Handle = 0x80670006 - STATEREPOSITORY_E_BUSY_RETRY Handle = 0x80670007 - STATEREPOSITORY_E_BUSY_RECOVERY_RETRY Handle = 0x80670008 - STATEREPOSITORY_E_LOCKED_RETRY Handle = 0x80670009 - STATEREPOSITORY_E_LOCKED_SHAREDCACHE_RETRY Handle = 0x8067000A - STATEREPOSITORY_E_TRANSACTION_REQUIRED Handle = 0x8067000B - STATEREPOSITORY_E_BUSY_TIMEOUT_EXCEEDED Handle = 0x8067000C - STATEREPOSITORY_E_BUSY_RECOVERY_TIMEOUT_EXCEEDED Handle = 0x8067000D - STATEREPOSITORY_E_LOCKED_TIMEOUT_EXCEEDED Handle = 0x8067000E - STATEREPOSITORY_E_LOCKED_SHAREDCACHE_TIMEOUT_EXCEEDED Handle = 0x8067000F - STATEREPOSITORY_E_SERVICE_STOP_IN_PROGRESS Handle = 0x80670010 - STATEREPOSTORY_E_NESTED_TRANSACTION_NOT_SUPPORTED Handle = 0x80670011 - STATEREPOSITORY_ERROR_CACHE_CORRUPTED Handle = 0x80670012 - STATEREPOSITORY_TRANSACTION_CALLER_ID_CHANGED Handle = 0x00670013 - STATEREPOSITORY_TRANSACTION_IN_PROGRESS Handle = 0x00670014 - ERROR_SPACES_POOL_WAS_DELETED Handle = 0x00E70001 - ERROR_SPACES_FAULT_DOMAIN_TYPE_INVALID Handle = 0x80E70001 - ERROR_SPACES_INTERNAL_ERROR Handle = 0x80E70002 - ERROR_SPACES_RESILIENCY_TYPE_INVALID Handle = 0x80E70003 - ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID Handle = 0x80E70004 - ERROR_SPACES_DRIVE_REDUNDANCY_INVALID Handle = 0x80E70006 - ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID Handle = 0x80E70007 - ERROR_SPACES_PARITY_LAYOUT_INVALID Handle = 0x80E70008 - ERROR_SPACES_INTERLEAVE_LENGTH_INVALID Handle = 0x80E70009 - ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID Handle = 0x80E7000A - ERROR_SPACES_NOT_ENOUGH_DRIVES Handle = 0x80E7000B - ERROR_SPACES_EXTENDED_ERROR Handle = 0x80E7000C - ERROR_SPACES_PROVISIONING_TYPE_INVALID Handle = 0x80E7000D - ERROR_SPACES_ALLOCATION_SIZE_INVALID Handle = 0x80E7000E - ERROR_SPACES_ENCLOSURE_AWARE_INVALID Handle = 0x80E7000F - ERROR_SPACES_WRITE_CACHE_SIZE_INVALID Handle = 0x80E70010 - ERROR_SPACES_NUMBER_OF_GROUPS_INVALID Handle = 0x80E70011 - ERROR_SPACES_DRIVE_OPERATIONAL_STATE_INVALID Handle = 0x80E70012 - ERROR_SPACES_ENTRY_INCOMPLETE Handle = 0x80E70013 - ERROR_SPACES_ENTRY_INVALID Handle = 0x80E70014 - ERROR_VOLSNAP_BOOTFILE_NOT_VALID Handle = 0x80820001 - ERROR_VOLSNAP_ACTIVATION_TIMEOUT Handle = 0x80820002 - ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME Handle = 0x80830001 - ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS Handle = 0x80830002 - ERROR_TIERING_STORAGE_TIER_NOT_FOUND Handle = 0x80830003 - ERROR_TIERING_INVALID_FILE_ID Handle = 0x80830004 - ERROR_TIERING_WRONG_CLUSTER_NODE Handle = 0x80830005 - ERROR_TIERING_ALREADY_PROCESSING Handle = 0x80830006 - ERROR_TIERING_CANNOT_PIN_OBJECT Handle = 0x80830007 - ERROR_TIERING_FILE_IS_NOT_PINNED Handle = 0x80830008 - ERROR_NOT_A_TIERED_VOLUME Handle = 0x80830009 - ERROR_ATTRIBUTE_NOT_PRESENT Handle = 0x8083000A - ERROR_SECCORE_INVALID_COMMAND Handle = 0xC0E80000 - ERROR_NO_APPLICABLE_APP_LICENSES_FOUND Handle = 0xC0EA0001 - ERROR_CLIP_LICENSE_NOT_FOUND Handle = 0xC0EA0002 - ERROR_CLIP_DEVICE_LICENSE_MISSING Handle = 0xC0EA0003 - ERROR_CLIP_LICENSE_INVALID_SIGNATURE Handle = 0xC0EA0004 - ERROR_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID Handle = 0xC0EA0005 - ERROR_CLIP_LICENSE_EXPIRED Handle = 0xC0EA0006 - ERROR_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE Handle = 0xC0EA0007 - ERROR_CLIP_LICENSE_NOT_SIGNED Handle = 0xC0EA0008 - ERROR_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE Handle = 0xC0EA0009 - ERROR_CLIP_LICENSE_DEVICE_ID_MISMATCH Handle = 0xC0EA000A - DXGI_STATUS_OCCLUDED Handle = 0x087A0001 - DXGI_STATUS_CLIPPED Handle = 0x087A0002 - DXGI_STATUS_NO_REDIRECTION Handle = 0x087A0004 - DXGI_STATUS_NO_DESKTOP_ACCESS Handle = 0x087A0005 - DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x087A0006 - DXGI_STATUS_MODE_CHANGED Handle = 0x087A0007 - DXGI_STATUS_MODE_CHANGE_IN_PROGRESS Handle = 0x087A0008 - DXGI_ERROR_INVALID_CALL Handle = 0x887A0001 - DXGI_ERROR_NOT_FOUND Handle = 0x887A0002 - DXGI_ERROR_MORE_DATA Handle = 0x887A0003 - DXGI_ERROR_UNSUPPORTED Handle = 0x887A0004 - DXGI_ERROR_DEVICE_REMOVED Handle = 0x887A0005 - DXGI_ERROR_DEVICE_HUNG Handle = 0x887A0006 - DXGI_ERROR_DEVICE_RESET Handle = 0x887A0007 - DXGI_ERROR_WAS_STILL_DRAWING Handle = 0x887A000A - DXGI_ERROR_FRAME_STATISTICS_DISJOINT Handle = 0x887A000B - DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x887A000C - DXGI_ERROR_DRIVER_INTERNAL_ERROR Handle = 0x887A0020 - DXGI_ERROR_NONEXCLUSIVE Handle = 0x887A0021 - DXGI_ERROR_NOT_CURRENTLY_AVAILABLE Handle = 0x887A0022 - DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED Handle = 0x887A0023 - DXGI_ERROR_REMOTE_OUTOFMEMORY Handle = 0x887A0024 - DXGI_ERROR_ACCESS_LOST Handle = 0x887A0026 - DXGI_ERROR_WAIT_TIMEOUT Handle = 0x887A0027 - DXGI_ERROR_SESSION_DISCONNECTED Handle = 0x887A0028 - DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE Handle = 0x887A0029 - DXGI_ERROR_CANNOT_PROTECT_CONTENT Handle = 0x887A002A - DXGI_ERROR_ACCESS_DENIED Handle = 0x887A002B - DXGI_ERROR_NAME_ALREADY_EXISTS Handle = 0x887A002C - DXGI_ERROR_SDK_COMPONENT_MISSING Handle = 0x887A002D - DXGI_ERROR_NOT_CURRENT Handle = 0x887A002E - DXGI_ERROR_HW_PROTECTION_OUTOFMEMORY Handle = 0x887A0030 - DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION Handle = 0x887A0031 - DXGI_ERROR_NON_COMPOSITED_UI Handle = 0x887A0032 - DXGI_STATUS_UNOCCLUDED Handle = 0x087A0009 - DXGI_STATUS_DDA_WAS_STILL_DRAWING Handle = 0x087A000A - DXGI_ERROR_MODE_CHANGE_IN_PROGRESS Handle = 0x887A0025 - DXGI_STATUS_PRESENT_REQUIRED Handle = 0x087A002F - DXGI_ERROR_CACHE_CORRUPT Handle = 0x887A0033 - DXGI_ERROR_CACHE_FULL Handle = 0x887A0034 - DXGI_ERROR_CACHE_HASH_COLLISION Handle = 0x887A0035 - DXGI_ERROR_ALREADY_EXISTS Handle = 0x887A0036 - DXGI_DDI_ERR_WASSTILLDRAWING Handle = 0x887B0001 - DXGI_DDI_ERR_UNSUPPORTED Handle = 0x887B0002 - DXGI_DDI_ERR_NONEXCLUSIVE Handle = 0x887B0003 - D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x88790001 - D3D10_ERROR_FILE_NOT_FOUND Handle = 0x88790002 - D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x887C0001 - D3D11_ERROR_FILE_NOT_FOUND Handle = 0x887C0002 - D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS Handle = 0x887C0003 - D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD Handle = 0x887C0004 - D3D12_ERROR_ADAPTER_NOT_FOUND Handle = 0x887E0001 - D3D12_ERROR_DRIVER_VERSION_MISMATCH Handle = 0x887E0002 - D2DERR_WRONG_STATE Handle = 0x88990001 - D2DERR_NOT_INITIALIZED Handle = 0x88990002 - D2DERR_UNSUPPORTED_OPERATION Handle = 0x88990003 - D2DERR_SCANNER_FAILED Handle = 0x88990004 - D2DERR_SCREEN_ACCESS_DENIED Handle = 0x88990005 - D2DERR_DISPLAY_STATE_INVALID Handle = 0x88990006 - D2DERR_ZERO_VECTOR Handle = 0x88990007 - D2DERR_INTERNAL_ERROR Handle = 0x88990008 - D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED Handle = 0x88990009 - D2DERR_INVALID_CALL Handle = 0x8899000A - D2DERR_NO_HARDWARE_DEVICE Handle = 0x8899000B - D2DERR_RECREATE_TARGET Handle = 0x8899000C - D2DERR_TOO_MANY_SHADER_ELEMENTS Handle = 0x8899000D - D2DERR_SHADER_COMPILE_FAILED Handle = 0x8899000E - D2DERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8899000F - D2DERR_UNSUPPORTED_VERSION Handle = 0x88990010 - D2DERR_BAD_NUMBER Handle = 0x88990011 - D2DERR_WRONG_FACTORY Handle = 0x88990012 - D2DERR_LAYER_ALREADY_IN_USE Handle = 0x88990013 - D2DERR_POP_CALL_DID_NOT_MATCH_PUSH Handle = 0x88990014 - D2DERR_WRONG_RESOURCE_DOMAIN Handle = 0x88990015 - D2DERR_PUSH_POP_UNBALANCED Handle = 0x88990016 - D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT Handle = 0x88990017 - D2DERR_INCOMPATIBLE_BRUSH_TYPES Handle = 0x88990018 - D2DERR_WIN32_ERROR Handle = 0x88990019 - D2DERR_TARGET_NOT_GDI_COMPATIBLE Handle = 0x8899001A - D2DERR_TEXT_EFFECT_IS_WRONG_TYPE Handle = 0x8899001B - D2DERR_TEXT_RENDERER_NOT_RELEASED Handle = 0x8899001C - D2DERR_EXCEEDS_MAX_BITMAP_SIZE Handle = 0x8899001D - D2DERR_INVALID_GRAPH_CONFIGURATION Handle = 0x8899001E - D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION Handle = 0x8899001F - D2DERR_CYCLIC_GRAPH Handle = 0x88990020 - D2DERR_BITMAP_CANNOT_DRAW Handle = 0x88990021 - D2DERR_OUTSTANDING_BITMAP_REFERENCES Handle = 0x88990022 - D2DERR_ORIGINAL_TARGET_NOT_BOUND Handle = 0x88990023 - D2DERR_INVALID_TARGET Handle = 0x88990024 - D2DERR_BITMAP_BOUND_AS_TARGET Handle = 0x88990025 - D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES Handle = 0x88990026 - D2DERR_INTERMEDIATE_TOO_LARGE Handle = 0x88990027 - D2DERR_EFFECT_IS_NOT_REGISTERED Handle = 0x88990028 - D2DERR_INVALID_PROPERTY Handle = 0x88990029 - D2DERR_NO_SUBPROPERTIES Handle = 0x8899002A - D2DERR_PRINT_JOB_CLOSED Handle = 0x8899002B - D2DERR_PRINT_FORMAT_NOT_SUPPORTED Handle = 0x8899002C - D2DERR_TOO_MANY_TRANSFORM_INPUTS Handle = 0x8899002D - D2DERR_INVALID_GLYPH_IMAGE Handle = 0x8899002E - DWRITE_E_FILEFORMAT Handle = 0x88985000 - DWRITE_E_UNEXPECTED Handle = 0x88985001 - DWRITE_E_NOFONT Handle = 0x88985002 - DWRITE_E_FILENOTFOUND Handle = 0x88985003 - DWRITE_E_FILEACCESS Handle = 0x88985004 - DWRITE_E_FONTCOLLECTIONOBSOLETE Handle = 0x88985005 - DWRITE_E_ALREADYREGISTERED Handle = 0x88985006 - DWRITE_E_CACHEFORMAT Handle = 0x88985007 - DWRITE_E_CACHEVERSION Handle = 0x88985008 - DWRITE_E_UNSUPPORTEDOPERATION Handle = 0x88985009 - DWRITE_E_TEXTRENDERERINCOMPATIBLE Handle = 0x8898500A - DWRITE_E_FLOWDIRECTIONCONFLICTS Handle = 0x8898500B - DWRITE_E_NOCOLOR Handle = 0x8898500C - DWRITE_E_REMOTEFONT Handle = 0x8898500D - DWRITE_E_DOWNLOADCANCELLED Handle = 0x8898500E - DWRITE_E_DOWNLOADFAILED Handle = 0x8898500F - DWRITE_E_TOOMANYDOWNLOADS Handle = 0x88985010 - WINCODEC_ERR_WRONGSTATE Handle = 0x88982F04 - WINCODEC_ERR_VALUEOUTOFRANGE Handle = 0x88982F05 - WINCODEC_ERR_UNKNOWNIMAGEFORMAT Handle = 0x88982F07 - WINCODEC_ERR_UNSUPPORTEDVERSION Handle = 0x88982F0B - WINCODEC_ERR_NOTINITIALIZED Handle = 0x88982F0C - WINCODEC_ERR_ALREADYLOCKED Handle = 0x88982F0D - WINCODEC_ERR_PROPERTYNOTFOUND Handle = 0x88982F40 - WINCODEC_ERR_PROPERTYNOTSUPPORTED Handle = 0x88982F41 - WINCODEC_ERR_PROPERTYSIZE Handle = 0x88982F42 - WINCODEC_ERR_CODECPRESENT Handle = 0x88982F43 - WINCODEC_ERR_CODECNOTHUMBNAIL Handle = 0x88982F44 - WINCODEC_ERR_PALETTEUNAVAILABLE Handle = 0x88982F45 - WINCODEC_ERR_CODECTOOMANYSCANLINES Handle = 0x88982F46 - WINCODEC_ERR_INTERNALERROR Handle = 0x88982F48 - WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS Handle = 0x88982F49 - WINCODEC_ERR_COMPONENTNOTFOUND Handle = 0x88982F50 - WINCODEC_ERR_IMAGESIZEOUTOFRANGE Handle = 0x88982F51 - WINCODEC_ERR_TOOMUCHMETADATA Handle = 0x88982F52 - WINCODEC_ERR_BADIMAGE Handle = 0x88982F60 - WINCODEC_ERR_BADHEADER Handle = 0x88982F61 - WINCODEC_ERR_FRAMEMISSING Handle = 0x88982F62 - WINCODEC_ERR_BADMETADATAHEADER Handle = 0x88982F63 - WINCODEC_ERR_BADSTREAMDATA Handle = 0x88982F70 - WINCODEC_ERR_STREAMWRITE Handle = 0x88982F71 - WINCODEC_ERR_STREAMREAD Handle = 0x88982F72 - WINCODEC_ERR_STREAMNOTAVAILABLE Handle = 0x88982F73 - WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT Handle = 0x88982F80 - WINCODEC_ERR_UNSUPPORTEDOPERATION Handle = 0x88982F81 - WINCODEC_ERR_INVALIDREGISTRATION Handle = 0x88982F8A - WINCODEC_ERR_COMPONENTINITIALIZEFAILURE Handle = 0x88982F8B - WINCODEC_ERR_INSUFFICIENTBUFFER Handle = 0x88982F8C - WINCODEC_ERR_DUPLICATEMETADATAPRESENT Handle = 0x88982F8D - WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE Handle = 0x88982F8E - WINCODEC_ERR_UNEXPECTEDSIZE Handle = 0x88982F8F - WINCODEC_ERR_INVALIDQUERYREQUEST Handle = 0x88982F90 - WINCODEC_ERR_UNEXPECTEDMETADATATYPE Handle = 0x88982F91 - WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT Handle = 0x88982F92 - WINCODEC_ERR_INVALIDQUERYCHARACTER Handle = 0x88982F93 - WINCODEC_ERR_WIN32ERROR Handle = 0x88982F94 - WINCODEC_ERR_INVALIDPROGRESSIVELEVEL Handle = 0x88982F95 - WINCODEC_ERR_INVALIDJPEGSCANINDEX Handle = 0x88982F96 - MILERR_OBJECTBUSY Handle = 0x88980001 - MILERR_INSUFFICIENTBUFFER Handle = 0x88980002 - MILERR_WIN32ERROR Handle = 0x88980003 - MILERR_SCANNER_FAILED Handle = 0x88980004 - MILERR_SCREENACCESSDENIED Handle = 0x88980005 - MILERR_DISPLAYSTATEINVALID Handle = 0x88980006 - MILERR_NONINVERTIBLEMATRIX Handle = 0x88980007 - MILERR_ZEROVECTOR Handle = 0x88980008 - MILERR_TERMINATED Handle = 0x88980009 - MILERR_BADNUMBER Handle = 0x8898000A - MILERR_INTERNALERROR Handle = 0x88980080 - MILERR_DISPLAYFORMATNOTSUPPORTED Handle = 0x88980084 - MILERR_INVALIDCALL Handle = 0x88980085 - MILERR_ALREADYLOCKED Handle = 0x88980086 - MILERR_NOTLOCKED Handle = 0x88980087 - MILERR_DEVICECANNOTRENDERTEXT Handle = 0x88980088 - MILERR_GLYPHBITMAPMISSED Handle = 0x88980089 - MILERR_MALFORMEDGLYPHCACHE Handle = 0x8898008A - MILERR_GENERIC_IGNORE Handle = 0x8898008B - MILERR_MALFORMED_GUIDELINE_DATA Handle = 0x8898008C - MILERR_NO_HARDWARE_DEVICE Handle = 0x8898008D - MILERR_NEED_RECREATE_AND_PRESENT Handle = 0x8898008E - MILERR_ALREADY_INITIALIZED Handle = 0x8898008F - MILERR_MISMATCHED_SIZE Handle = 0x88980090 - MILERR_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x88980091 - MILERR_REMOTING_NOT_SUPPORTED Handle = 0x88980092 - MILERR_QUEUED_PRESENT_NOT_SUPPORTED Handle = 0x88980093 - MILERR_NOT_QUEUING_PRESENTS Handle = 0x88980094 - MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER Handle = 0x88980095 - MILERR_TOOMANYSHADERELEMNTS Handle = 0x88980096 - MILERR_MROW_READLOCK_FAILED Handle = 0x88980097 - MILERR_MROW_UPDATE_FAILED Handle = 0x88980098 - MILERR_SHADER_COMPILE_FAILED Handle = 0x88980099 - MILERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8898009A - MILERR_QPC_TIME_WENT_BACKWARD Handle = 0x8898009B - MILERR_DXGI_ENUMERATION_OUT_OF_SYNC Handle = 0x8898009D - MILERR_ADAPTER_NOT_FOUND Handle = 0x8898009E - MILERR_COLORSPACE_NOT_SUPPORTED Handle = 0x8898009F - MILERR_PREFILTER_NOT_SUPPORTED Handle = 0x889800A0 - MILERR_DISPLAYID_ACCESS_DENIED Handle = 0x889800A1 - UCEERR_INVALIDPACKETHEADER Handle = 0x88980400 - UCEERR_UNKNOWNPACKET Handle = 0x88980401 - UCEERR_ILLEGALPACKET Handle = 0x88980402 - UCEERR_MALFORMEDPACKET Handle = 0x88980403 - UCEERR_ILLEGALHANDLE Handle = 0x88980404 - UCEERR_HANDLELOOKUPFAILED Handle = 0x88980405 - UCEERR_RENDERTHREADFAILURE Handle = 0x88980406 - UCEERR_CTXSTACKFRSTTARGETNULL Handle = 0x88980407 - UCEERR_CONNECTIONIDLOOKUPFAILED Handle = 0x88980408 - UCEERR_BLOCKSFULL Handle = 0x88980409 - UCEERR_MEMORYFAILURE Handle = 0x8898040A - UCEERR_PACKETRECORDOUTOFRANGE Handle = 0x8898040B - UCEERR_ILLEGALRECORDTYPE Handle = 0x8898040C - UCEERR_OUTOFHANDLES Handle = 0x8898040D - UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED Handle = 0x8898040E - UCEERR_NO_MULTIPLE_WORKER_THREADS Handle = 0x8898040F - UCEERR_REMOTINGNOTSUPPORTED Handle = 0x88980410 - UCEERR_MISSINGENDCOMMAND Handle = 0x88980411 - UCEERR_MISSINGBEGINCOMMAND Handle = 0x88980412 - UCEERR_CHANNELSYNCTIMEDOUT Handle = 0x88980413 - UCEERR_CHANNELSYNCABANDONED Handle = 0x88980414 - UCEERR_UNSUPPORTEDTRANSPORTVERSION Handle = 0x88980415 - UCEERR_TRANSPORTUNAVAILABLE Handle = 0x88980416 - UCEERR_FEEDBACK_UNSUPPORTED Handle = 0x88980417 - UCEERR_COMMANDTRANSPORTDENIED Handle = 0x88980418 - UCEERR_GRAPHICSSTREAMUNAVAILABLE Handle = 0x88980419 - UCEERR_GRAPHICSSTREAMALREADYOPEN Handle = 0x88980420 - UCEERR_TRANSPORTDISCONNECTED Handle = 0x88980421 - UCEERR_TRANSPORTOVERLOADED Handle = 0x88980422 - UCEERR_PARTITION_ZOMBIED Handle = 0x88980423 - MILAVERR_NOCLOCK Handle = 0x88980500 - MILAVERR_NOMEDIATYPE Handle = 0x88980501 - MILAVERR_NOVIDEOMIXER Handle = 0x88980502 - MILAVERR_NOVIDEOPRESENTER Handle = 0x88980503 - MILAVERR_NOREADYFRAMES Handle = 0x88980504 - MILAVERR_MODULENOTLOADED Handle = 0x88980505 - MILAVERR_WMPFACTORYNOTREGISTERED Handle = 0x88980506 - MILAVERR_INVALIDWMPVERSION Handle = 0x88980507 - MILAVERR_INSUFFICIENTVIDEORESOURCES Handle = 0x88980508 - MILAVERR_VIDEOACCELERATIONNOTAVAILABLE Handle = 0x88980509 - MILAVERR_REQUESTEDTEXTURETOOBIG Handle = 0x8898050A - MILAVERR_SEEKFAILED Handle = 0x8898050B - MILAVERR_UNEXPECTEDWMPFAILURE Handle = 0x8898050C - MILAVERR_MEDIAPLAYERCLOSED Handle = 0x8898050D - MILAVERR_UNKNOWNHARDWAREERROR Handle = 0x8898050E - MILEFFECTSERR_UNKNOWNPROPERTY Handle = 0x8898060E - MILEFFECTSERR_EFFECTNOTPARTOFGROUP Handle = 0x8898060F - MILEFFECTSERR_NOINPUTSOURCEATTACHED Handle = 0x88980610 - MILEFFECTSERR_CONNECTORNOTCONNECTED Handle = 0x88980611 - MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT Handle = 0x88980612 - MILEFFECTSERR_RESERVED Handle = 0x88980613 - MILEFFECTSERR_CYCLEDETECTED Handle = 0x88980614 - MILEFFECTSERR_EFFECTINMORETHANONEGRAPH Handle = 0x88980615 - MILEFFECTSERR_EFFECTALREADYINAGRAPH Handle = 0x88980616 - MILEFFECTSERR_EFFECTHASNOCHILDREN Handle = 0x88980617 - MILEFFECTSERR_ALREADYATTACHEDTOLISTENER Handle = 0x88980618 - MILEFFECTSERR_NOTAFFINETRANSFORM Handle = 0x88980619 - MILEFFECTSERR_EMPTYBOUNDS Handle = 0x8898061A - MILEFFECTSERR_OUTPUTSIZETOOLARGE Handle = 0x8898061B - DWMERR_STATE_TRANSITION_FAILED Handle = 0x88980700 - DWMERR_THEME_FAILED Handle = 0x88980701 - DWMERR_CATASTROPHIC_FAILURE Handle = 0x88980702 - DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED Handle = 0x88980800 - DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED Handle = 0x88980801 - DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED Handle = 0x88980802 - ONL_E_INVALID_AUTHENTICATION_TARGET Handle = 0x80860001 - ONL_E_ACCESS_DENIED_BY_TOU Handle = 0x80860002 - ONL_E_INVALID_APPLICATION Handle = 0x80860003 - ONL_E_PASSWORD_UPDATE_REQUIRED Handle = 0x80860004 - ONL_E_ACCOUNT_UPDATE_REQUIRED Handle = 0x80860005 - ONL_E_FORCESIGNIN Handle = 0x80860006 - ONL_E_ACCOUNT_LOCKED Handle = 0x80860007 - ONL_E_PARENTAL_CONSENT_REQUIRED Handle = 0x80860008 - ONL_E_EMAIL_VERIFICATION_REQUIRED Handle = 0x80860009 - ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE Handle = 0x8086000A - ONL_E_ACCOUNT_SUSPENDED_ABUSE Handle = 0x8086000B - ONL_E_ACTION_REQUIRED Handle = 0x8086000C - ONL_CONNECTION_COUNT_LIMIT Handle = 0x8086000D - ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT Handle = 0x8086000E - ONL_E_USER_AUTHENTICATION_REQUIRED Handle = 0x8086000F - ONL_E_REQUEST_THROTTLED Handle = 0x80860010 - FA_E_MAX_PERSISTED_ITEMS_REACHED Handle = 0x80270220 - FA_E_HOMEGROUP_NOT_AVAILABLE Handle = 0x80270222 - E_MONITOR_RESOLUTION_TOO_LOW Handle = 0x80270250 - E_ELEVATED_ACTIVATION_NOT_SUPPORTED Handle = 0x80270251 - E_UAC_DISABLED Handle = 0x80270252 - E_FULL_ADMIN_NOT_SUPPORTED Handle = 0x80270253 - E_APPLICATION_NOT_REGISTERED Handle = 0x80270254 - E_MULTIPLE_EXTENSIONS_FOR_APPLICATION Handle = 0x80270255 - E_MULTIPLE_PACKAGES_FOR_FAMILY Handle = 0x80270256 - E_APPLICATION_MANAGER_NOT_RUNNING Handle = 0x80270257 - S_STORE_LAUNCHED_FOR_REMEDIATION Handle = 0x00270258 - S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG Handle = 0x00270259 - E_APPLICATION_ACTIVATION_TIMED_OUT Handle = 0x8027025A - E_APPLICATION_ACTIVATION_EXEC_FAILURE Handle = 0x8027025B - E_APPLICATION_TEMPORARY_LICENSE_ERROR Handle = 0x8027025C - E_APPLICATION_TRIAL_LICENSE_EXPIRED Handle = 0x8027025D - E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED Handle = 0x80270260 - E_SKYDRIVE_ROOT_TARGET_OVERLAP Handle = 0x80270261 - E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX Handle = 0x80270262 - E_SKYDRIVE_FILE_NOT_UPLOADED Handle = 0x80270263 - E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL Handle = 0x80270264 - E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED Handle = 0x80270265 - E_SYNCENGINE_FILE_SIZE_OVER_LIMIT Handle = 0x8802B001 - E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA Handle = 0x8802B002 - E_SYNCENGINE_UNSUPPORTED_FILE_NAME Handle = 0x8802B003 - E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED Handle = 0x8802B004 - E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR Handle = 0x8802B005 - E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE Handle = 0x8802B006 - E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN Handle = 0x8802C002 - E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED Handle = 0x8802C003 - E_SYNCENGINE_UNKNOWN_SERVICE_ERROR Handle = 0x8802C004 - E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE Handle = 0x8802C005 - E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE Handle = 0x8802C006 - E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR Handle = 0x8802C007 - E_SYNCENGINE_FOLDER_INACCESSIBLE Handle = 0x8802D001 - E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME Handle = 0x8802D002 - E_SYNCENGINE_UNSUPPORTED_MARKET Handle = 0x8802D003 - E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D004 - E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D005 - E_SYNCENGINE_CLIENT_UPDATE_NEEDED Handle = 0x8802D006 - E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED Handle = 0x8802D007 - E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED Handle = 0x8802D008 - E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT Handle = 0x8802D009 - E_SYNCENGINE_STORAGE_SERVICE_BLOCKED Handle = 0x8802D00A - E_SYNCENGINE_FOLDER_IN_REDIRECTION Handle = 0x8802D00B - EAS_E_POLICY_NOT_MANAGED_BY_OS Handle = 0x80550001 - EAS_E_POLICY_COMPLIANT_WITH_ACTIONS Handle = 0x80550002 - EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE Handle = 0x80550003 - EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD Handle = 0x80550004 - EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE Handle = 0x80550005 - EAS_E_USER_CANNOT_CHANGE_PASSWORD Handle = 0x80550006 - EAS_E_ADMINS_HAVE_BLANK_PASSWORD Handle = 0x80550007 - EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD Handle = 0x80550008 - EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD Handle = 0x80550009 - EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS Handle = 0x8055000A - EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000B - EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER Handle = 0x8055000C - EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000D - WEB_E_UNSUPPORTED_FORMAT Handle = 0x83750001 - WEB_E_INVALID_XML Handle = 0x83750002 - WEB_E_MISSING_REQUIRED_ELEMENT Handle = 0x83750003 - WEB_E_MISSING_REQUIRED_ATTRIBUTE Handle = 0x83750004 - WEB_E_UNEXPECTED_CONTENT Handle = 0x83750005 - WEB_E_RESOURCE_TOO_LARGE Handle = 0x83750006 - WEB_E_INVALID_JSON_STRING Handle = 0x83750007 - WEB_E_INVALID_JSON_NUMBER Handle = 0x83750008 - WEB_E_JSON_VALUE_NOT_FOUND Handle = 0x83750009 - HTTP_E_STATUS_UNEXPECTED Handle = 0x80190001 - HTTP_E_STATUS_UNEXPECTED_REDIRECTION Handle = 0x80190003 - HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR Handle = 0x80190004 - HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR Handle = 0x80190005 - HTTP_E_STATUS_AMBIGUOUS Handle = 0x8019012C - HTTP_E_STATUS_MOVED Handle = 0x8019012D - HTTP_E_STATUS_REDIRECT Handle = 0x8019012E - HTTP_E_STATUS_REDIRECT_METHOD Handle = 0x8019012F - HTTP_E_STATUS_NOT_MODIFIED Handle = 0x80190130 - HTTP_E_STATUS_USE_PROXY Handle = 0x80190131 - HTTP_E_STATUS_REDIRECT_KEEP_VERB Handle = 0x80190133 - HTTP_E_STATUS_BAD_REQUEST Handle = 0x80190190 - HTTP_E_STATUS_DENIED Handle = 0x80190191 - HTTP_E_STATUS_PAYMENT_REQ Handle = 0x80190192 - HTTP_E_STATUS_FORBIDDEN Handle = 0x80190193 - HTTP_E_STATUS_NOT_FOUND Handle = 0x80190194 - HTTP_E_STATUS_BAD_METHOD Handle = 0x80190195 - HTTP_E_STATUS_NONE_ACCEPTABLE Handle = 0x80190196 - HTTP_E_STATUS_PROXY_AUTH_REQ Handle = 0x80190197 - HTTP_E_STATUS_REQUEST_TIMEOUT Handle = 0x80190198 - HTTP_E_STATUS_CONFLICT Handle = 0x80190199 - HTTP_E_STATUS_GONE Handle = 0x8019019A - HTTP_E_STATUS_LENGTH_REQUIRED Handle = 0x8019019B - HTTP_E_STATUS_PRECOND_FAILED Handle = 0x8019019C - HTTP_E_STATUS_REQUEST_TOO_LARGE Handle = 0x8019019D - HTTP_E_STATUS_URI_TOO_LONG Handle = 0x8019019E - HTTP_E_STATUS_UNSUPPORTED_MEDIA Handle = 0x8019019F - HTTP_E_STATUS_RANGE_NOT_SATISFIABLE Handle = 0x801901A0 - HTTP_E_STATUS_EXPECTATION_FAILED Handle = 0x801901A1 - HTTP_E_STATUS_SERVER_ERROR Handle = 0x801901F4 - HTTP_E_STATUS_NOT_SUPPORTED Handle = 0x801901F5 - HTTP_E_STATUS_BAD_GATEWAY Handle = 0x801901F6 - HTTP_E_STATUS_SERVICE_UNAVAIL Handle = 0x801901F7 - HTTP_E_STATUS_GATEWAY_TIMEOUT Handle = 0x801901F8 - HTTP_E_STATUS_VERSION_NOT_SUP Handle = 0x801901F9 - E_INVALID_PROTOCOL_OPERATION Handle = 0x83760001 - E_INVALID_PROTOCOL_FORMAT Handle = 0x83760002 - E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED Handle = 0x83760003 - E_SUBPROTOCOL_NOT_SUPPORTED Handle = 0x83760004 - E_PROTOCOL_VERSION_NOT_SUPPORTED Handle = 0x83760005 - INPUT_E_OUT_OF_ORDER Handle = 0x80400000 - INPUT_E_REENTRANCY Handle = 0x80400001 - INPUT_E_MULTIMODAL Handle = 0x80400002 - INPUT_E_PACKET Handle = 0x80400003 - INPUT_E_FRAME Handle = 0x80400004 - INPUT_E_HISTORY Handle = 0x80400005 - INPUT_E_DEVICE_INFO Handle = 0x80400006 - INPUT_E_TRANSFORM Handle = 0x80400007 - INPUT_E_DEVICE_PROPERTY Handle = 0x80400008 - INET_E_INVALID_URL Handle = 0x800C0002 - INET_E_NO_SESSION Handle = 0x800C0003 - INET_E_CANNOT_CONNECT Handle = 0x800C0004 - INET_E_RESOURCE_NOT_FOUND Handle = 0x800C0005 - INET_E_OBJECT_NOT_FOUND Handle = 0x800C0006 - INET_E_DATA_NOT_AVAILABLE Handle = 0x800C0007 - INET_E_DOWNLOAD_FAILURE Handle = 0x800C0008 - INET_E_AUTHENTICATION_REQUIRED Handle = 0x800C0009 - INET_E_NO_VALID_MEDIA Handle = 0x800C000A - INET_E_CONNECTION_TIMEOUT Handle = 0x800C000B - INET_E_INVALID_REQUEST Handle = 0x800C000C - INET_E_UNKNOWN_PROTOCOL Handle = 0x800C000D - INET_E_SECURITY_PROBLEM Handle = 0x800C000E - INET_E_CANNOT_LOAD_DATA Handle = 0x800C000F - INET_E_CANNOT_INSTANTIATE_OBJECT Handle = 0x800C0010 - INET_E_INVALID_CERTIFICATE Handle = 0x800C0019 - INET_E_REDIRECT_FAILED Handle = 0x800C0014 - INET_E_REDIRECT_TO_DIR Handle = 0x800C0015 - ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00001 - ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00002 - ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00003 - ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00004 - ERROR_IO_PREEMPTED Handle = 0x89010001 - JSCRIPT_E_CANTEXECUTE Handle = 0x89020001 - WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x88010001 - WEP_E_FIXED_DATA_NOT_SUPPORTED Handle = 0x88010002 - WEP_E_HARDWARE_NOT_COMPLIANT Handle = 0x88010003 - WEP_E_LOCK_NOT_CONFIGURED Handle = 0x88010004 - WEP_E_PROTECTION_SUSPENDED Handle = 0x88010005 - WEP_E_NO_LICENSE Handle = 0x88010006 - WEP_E_OS_NOT_PROTECTED Handle = 0x88010007 - WEP_E_UNEXPECTED_FAIL Handle = 0x88010008 - WEP_E_BUFFER_TOO_LARGE Handle = 0x88010009 - ERROR_SVHDX_ERROR_STORED Handle = 0xC05C0000 - ERROR_SVHDX_ERROR_NOT_AVAILABLE Handle = 0xC05CFF00 - ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE Handle = 0xC05CFF01 - ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED Handle = 0xC05CFF02 - ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED Handle = 0xC05CFF03 - ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED Handle = 0xC05CFF04 - ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED Handle = 0xC05CFF05 - ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED Handle = 0xC05CFF06 - ERROR_SVHDX_RESERVATION_CONFLICT Handle = 0xC05CFF07 - ERROR_SVHDX_WRONG_FILE_TYPE Handle = 0xC05CFF08 - ERROR_SVHDX_VERSION_MISMATCH Handle = 0xC05CFF09 - ERROR_VHD_SHARED Handle = 0xC05CFF0A - ERROR_SVHDX_NO_INITIATOR Handle = 0xC05CFF0B - ERROR_VHDSET_BACKING_STORAGE_NOT_FOUND Handle = 0xC05CFF0C - ERROR_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP Handle = 0xC05D0000 - ERROR_SMB_BAD_CLUSTER_DIALECT Handle = 0xC05D0001 - WININET_E_OUT_OF_HANDLES Handle = 0x80072EE1 - WININET_E_TIMEOUT Handle = 0x80072EE2 - WININET_E_EXTENDED_ERROR Handle = 0x80072EE3 - WININET_E_INTERNAL_ERROR Handle = 0x80072EE4 - WININET_E_INVALID_URL Handle = 0x80072EE5 - WININET_E_UNRECOGNIZED_SCHEME Handle = 0x80072EE6 - WININET_E_NAME_NOT_RESOLVED Handle = 0x80072EE7 - WININET_E_PROTOCOL_NOT_FOUND Handle = 0x80072EE8 - WININET_E_INVALID_OPTION Handle = 0x80072EE9 - WININET_E_BAD_OPTION_LENGTH Handle = 0x80072EEA - WININET_E_OPTION_NOT_SETTABLE Handle = 0x80072EEB - WININET_E_SHUTDOWN Handle = 0x80072EEC - WININET_E_INCORRECT_USER_NAME Handle = 0x80072EED - WININET_E_INCORRECT_PASSWORD Handle = 0x80072EEE - WININET_E_LOGIN_FAILURE Handle = 0x80072EEF - WININET_E_INVALID_OPERATION Handle = 0x80072EF0 - WININET_E_OPERATION_CANCELLED Handle = 0x80072EF1 - WININET_E_INCORRECT_HANDLE_TYPE Handle = 0x80072EF2 - WININET_E_INCORRECT_HANDLE_STATE Handle = 0x80072EF3 - WININET_E_NOT_PROXY_REQUEST Handle = 0x80072EF4 - WININET_E_REGISTRY_VALUE_NOT_FOUND Handle = 0x80072EF5 - WININET_E_BAD_REGISTRY_PARAMETER Handle = 0x80072EF6 - WININET_E_NO_DIRECT_ACCESS Handle = 0x80072EF7 - WININET_E_NO_CONTEXT Handle = 0x80072EF8 - WININET_E_NO_CALLBACK Handle = 0x80072EF9 - WININET_E_REQUEST_PENDING Handle = 0x80072EFA - WININET_E_INCORRECT_FORMAT Handle = 0x80072EFB - WININET_E_ITEM_NOT_FOUND Handle = 0x80072EFC - WININET_E_CANNOT_CONNECT Handle = 0x80072EFD - WININET_E_CONNECTION_ABORTED Handle = 0x80072EFE - WININET_E_CONNECTION_RESET Handle = 0x80072EFF - WININET_E_FORCE_RETRY Handle = 0x80072F00 - WININET_E_INVALID_PROXY_REQUEST Handle = 0x80072F01 - WININET_E_NEED_UI Handle = 0x80072F02 - WININET_E_HANDLE_EXISTS Handle = 0x80072F04 - WININET_E_SEC_CERT_DATE_INVALID Handle = 0x80072F05 - WININET_E_SEC_CERT_CN_INVALID Handle = 0x80072F06 - WININET_E_HTTP_TO_HTTPS_ON_REDIR Handle = 0x80072F07 - WININET_E_HTTPS_TO_HTTP_ON_REDIR Handle = 0x80072F08 - WININET_E_MIXED_SECURITY Handle = 0x80072F09 - WININET_E_CHG_POST_IS_NON_SECURE Handle = 0x80072F0A - WININET_E_POST_IS_NON_SECURE Handle = 0x80072F0B - WININET_E_CLIENT_AUTH_CERT_NEEDED Handle = 0x80072F0C - WININET_E_INVALID_CA Handle = 0x80072F0D - WININET_E_CLIENT_AUTH_NOT_SETUP Handle = 0x80072F0E - WININET_E_ASYNC_THREAD_FAILED Handle = 0x80072F0F - WININET_E_REDIRECT_SCHEME_CHANGE Handle = 0x80072F10 - WININET_E_DIALOG_PENDING Handle = 0x80072F11 - WININET_E_RETRY_DIALOG Handle = 0x80072F12 - WININET_E_NO_NEW_CONTAINERS Handle = 0x80072F13 - WININET_E_HTTPS_HTTP_SUBMIT_REDIR Handle = 0x80072F14 - WININET_E_SEC_CERT_ERRORS Handle = 0x80072F17 - WININET_E_SEC_CERT_REV_FAILED Handle = 0x80072F19 - WININET_E_HEADER_NOT_FOUND Handle = 0x80072F76 - WININET_E_DOWNLEVEL_SERVER Handle = 0x80072F77 - WININET_E_INVALID_SERVER_RESPONSE Handle = 0x80072F78 - WININET_E_INVALID_HEADER Handle = 0x80072F79 - WININET_E_INVALID_QUERY_REQUEST Handle = 0x80072F7A - WININET_E_HEADER_ALREADY_EXISTS Handle = 0x80072F7B - WININET_E_REDIRECT_FAILED Handle = 0x80072F7C - WININET_E_SECURITY_CHANNEL_ERROR Handle = 0x80072F7D - WININET_E_UNABLE_TO_CACHE_FILE Handle = 0x80072F7E - WININET_E_TCPIP_NOT_INSTALLED Handle = 0x80072F7F - WININET_E_DISCONNECTED Handle = 0x80072F83 - WININET_E_SERVER_UNREACHABLE Handle = 0x80072F84 - WININET_E_PROXY_SERVER_UNREACHABLE Handle = 0x80072F85 - WININET_E_BAD_AUTO_PROXY_SCRIPT Handle = 0x80072F86 - WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT Handle = 0x80072F87 - WININET_E_SEC_INVALID_CERT Handle = 0x80072F89 - WININET_E_SEC_CERT_REVOKED Handle = 0x80072F8A - WININET_E_FAILED_DUETOSECURITYCHECK Handle = 0x80072F8B - WININET_E_NOT_INITIALIZED Handle = 0x80072F8C - WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY Handle = 0x80072F8E - WININET_E_DECODING_FAILED Handle = 0x80072F8F - WININET_E_NOT_REDIRECTED Handle = 0x80072F80 - WININET_E_COOKIE_NEEDS_CONFIRMATION Handle = 0x80072F81 - WININET_E_COOKIE_DECLINED Handle = 0x80072F82 - WININET_E_REDIRECT_NEEDS_CONFIRMATION Handle = 0x80072F88 - SQLITE_E_ERROR Handle = 0x87AF0001 - SQLITE_E_INTERNAL Handle = 0x87AF0002 - SQLITE_E_PERM Handle = 0x87AF0003 - SQLITE_E_ABORT Handle = 0x87AF0004 - SQLITE_E_BUSY Handle = 0x87AF0005 - SQLITE_E_LOCKED Handle = 0x87AF0006 - SQLITE_E_NOMEM Handle = 0x87AF0007 - SQLITE_E_READONLY Handle = 0x87AF0008 - SQLITE_E_INTERRUPT Handle = 0x87AF0009 - SQLITE_E_IOERR Handle = 0x87AF000A - SQLITE_E_CORRUPT Handle = 0x87AF000B - SQLITE_E_NOTFOUND Handle = 0x87AF000C - SQLITE_E_FULL Handle = 0x87AF000D - SQLITE_E_CANTOPEN Handle = 0x87AF000E - SQLITE_E_PROTOCOL Handle = 0x87AF000F - SQLITE_E_EMPTY Handle = 0x87AF0010 - SQLITE_E_SCHEMA Handle = 0x87AF0011 - SQLITE_E_TOOBIG Handle = 0x87AF0012 - SQLITE_E_CONSTRAINT Handle = 0x87AF0013 - SQLITE_E_MISMATCH Handle = 0x87AF0014 - SQLITE_E_MISUSE Handle = 0x87AF0015 - SQLITE_E_NOLFS Handle = 0x87AF0016 - SQLITE_E_AUTH Handle = 0x87AF0017 - SQLITE_E_FORMAT Handle = 0x87AF0018 - SQLITE_E_RANGE Handle = 0x87AF0019 - SQLITE_E_NOTADB Handle = 0x87AF001A - SQLITE_E_NOTICE Handle = 0x87AF001B - SQLITE_E_WARNING Handle = 0x87AF001C - SQLITE_E_ROW Handle = 0x87AF0064 - SQLITE_E_DONE Handle = 0x87AF0065 - SQLITE_E_IOERR_READ Handle = 0x87AF010A - SQLITE_E_IOERR_SHORT_READ Handle = 0x87AF020A - SQLITE_E_IOERR_WRITE Handle = 0x87AF030A - SQLITE_E_IOERR_FSYNC Handle = 0x87AF040A - SQLITE_E_IOERR_DIR_FSYNC Handle = 0x87AF050A - SQLITE_E_IOERR_TRUNCATE Handle = 0x87AF060A - SQLITE_E_IOERR_FSTAT Handle = 0x87AF070A - SQLITE_E_IOERR_UNLOCK Handle = 0x87AF080A - SQLITE_E_IOERR_RDLOCK Handle = 0x87AF090A - SQLITE_E_IOERR_DELETE Handle = 0x87AF0A0A - SQLITE_E_IOERR_BLOCKED Handle = 0x87AF0B0A - SQLITE_E_IOERR_NOMEM Handle = 0x87AF0C0A - SQLITE_E_IOERR_ACCESS Handle = 0x87AF0D0A - SQLITE_E_IOERR_CHECKRESERVEDLOCK Handle = 0x87AF0E0A - SQLITE_E_IOERR_LOCK Handle = 0x87AF0F0A - SQLITE_E_IOERR_CLOSE Handle = 0x87AF100A - SQLITE_E_IOERR_DIR_CLOSE Handle = 0x87AF110A - SQLITE_E_IOERR_SHMOPEN Handle = 0x87AF120A - SQLITE_E_IOERR_SHMSIZE Handle = 0x87AF130A - SQLITE_E_IOERR_SHMLOCK Handle = 0x87AF140A - SQLITE_E_IOERR_SHMMAP Handle = 0x87AF150A - SQLITE_E_IOERR_SEEK Handle = 0x87AF160A - SQLITE_E_IOERR_DELETE_NOENT Handle = 0x87AF170A - SQLITE_E_IOERR_MMAP Handle = 0x87AF180A - SQLITE_E_IOERR_GETTEMPPATH Handle = 0x87AF190A - SQLITE_E_IOERR_CONVPATH Handle = 0x87AF1A0A - SQLITE_E_IOERR_VNODE Handle = 0x87AF1A02 - SQLITE_E_IOERR_AUTH Handle = 0x87AF1A03 - SQLITE_E_LOCKED_SHAREDCACHE Handle = 0x87AF0106 - SQLITE_E_BUSY_RECOVERY Handle = 0x87AF0105 - SQLITE_E_BUSY_SNAPSHOT Handle = 0x87AF0205 - SQLITE_E_CANTOPEN_NOTEMPDIR Handle = 0x87AF010E - SQLITE_E_CANTOPEN_ISDIR Handle = 0x87AF020E - SQLITE_E_CANTOPEN_FULLPATH Handle = 0x87AF030E - SQLITE_E_CANTOPEN_CONVPATH Handle = 0x87AF040E - SQLITE_E_CORRUPT_VTAB Handle = 0x87AF010B - SQLITE_E_READONLY_RECOVERY Handle = 0x87AF0108 - SQLITE_E_READONLY_CANTLOCK Handle = 0x87AF0208 - SQLITE_E_READONLY_ROLLBACK Handle = 0x87AF0308 - SQLITE_E_READONLY_DBMOVED Handle = 0x87AF0408 - SQLITE_E_ABORT_ROLLBACK Handle = 0x87AF0204 - SQLITE_E_CONSTRAINT_CHECK Handle = 0x87AF0113 - SQLITE_E_CONSTRAINT_COMMITHOOK Handle = 0x87AF0213 - SQLITE_E_CONSTRAINT_FOREIGNKEY Handle = 0x87AF0313 - SQLITE_E_CONSTRAINT_FUNCTION Handle = 0x87AF0413 - SQLITE_E_CONSTRAINT_NOTNULL Handle = 0x87AF0513 - SQLITE_E_CONSTRAINT_PRIMARYKEY Handle = 0x87AF0613 - SQLITE_E_CONSTRAINT_TRIGGER Handle = 0x87AF0713 - SQLITE_E_CONSTRAINT_UNIQUE Handle = 0x87AF0813 - SQLITE_E_CONSTRAINT_VTAB Handle = 0x87AF0913 - SQLITE_E_CONSTRAINT_ROWID Handle = 0x87AF0A13 - SQLITE_E_NOTICE_RECOVER_WAL Handle = 0x87AF011B - SQLITE_E_NOTICE_RECOVER_ROLLBACK Handle = 0x87AF021B - SQLITE_E_WARNING_AUTOINDEX Handle = 0x87AF011C - UTC_E_TOGGLE_TRACE_STARTED Handle = 0x87C51001 - UTC_E_ALTERNATIVE_TRACE_CANNOT_PREEMPT Handle = 0x87C51002 - UTC_E_AOT_NOT_RUNNING Handle = 0x87C51003 - UTC_E_SCRIPT_TYPE_INVALID Handle = 0x87C51004 - UTC_E_SCENARIODEF_NOT_FOUND Handle = 0x87C51005 - UTC_E_TRACEPROFILE_NOT_FOUND Handle = 0x87C51006 - UTC_E_FORWARDER_ALREADY_ENABLED Handle = 0x87C51007 - UTC_E_FORWARDER_ALREADY_DISABLED Handle = 0x87C51008 - UTC_E_EVENTLOG_ENTRY_MALFORMED Handle = 0x87C51009 - UTC_E_DIAGRULES_SCHEMAVERSION_MISMATCH Handle = 0x87C5100A - UTC_E_SCRIPT_TERMINATED Handle = 0x87C5100B - UTC_E_INVALID_CUSTOM_FILTER Handle = 0x87C5100C - UTC_E_TRACE_NOT_RUNNING Handle = 0x87C5100D - UTC_E_REESCALATED_TOO_QUICKLY Handle = 0x87C5100E - UTC_E_ESCALATION_ALREADY_RUNNING Handle = 0x87C5100F - UTC_E_PERFTRACK_ALREADY_TRACING Handle = 0x87C51010 - UTC_E_REACHED_MAX_ESCALATIONS Handle = 0x87C51011 - UTC_E_FORWARDER_PRODUCER_MISMATCH Handle = 0x87C51012 - UTC_E_INTENTIONAL_SCRIPT_FAILURE Handle = 0x87C51013 - UTC_E_SQM_INIT_FAILED Handle = 0x87C51014 - UTC_E_NO_WER_LOGGER_SUPPORTED Handle = 0x87C51015 - UTC_E_TRACERS_DONT_EXIST Handle = 0x87C51016 - UTC_E_WINRT_INIT_FAILED Handle = 0x87C51017 - UTC_E_SCENARIODEF_SCHEMAVERSION_MISMATCH Handle = 0x87C51018 - UTC_E_INVALID_FILTER Handle = 0x87C51019 - UTC_E_EXE_TERMINATED Handle = 0x87C5101A - UTC_E_ESCALATION_NOT_AUTHORIZED Handle = 0x87C5101B - UTC_E_SETUP_NOT_AUTHORIZED Handle = 0x87C5101C - UTC_E_CHILD_PROCESS_FAILED Handle = 0x87C5101D - UTC_E_COMMAND_LINE_NOT_AUTHORIZED Handle = 0x87C5101E - UTC_E_CANNOT_LOAD_SCENARIO_EDITOR_XML Handle = 0x87C5101F - UTC_E_ESCALATION_TIMED_OUT Handle = 0x87C51020 - UTC_E_SETUP_TIMED_OUT Handle = 0x87C51021 - UTC_E_TRIGGER_MISMATCH Handle = 0x87C51022 - UTC_E_TRIGGER_NOT_FOUND Handle = 0x87C51023 - UTC_E_SIF_NOT_SUPPORTED Handle = 0x87C51024 - UTC_E_DELAY_TERMINATED Handle = 0x87C51025 - UTC_E_DEVICE_TICKET_ERROR Handle = 0x87C51026 - UTC_E_TRACE_BUFFER_LIMIT_EXCEEDED Handle = 0x87C51027 - UTC_E_API_RESULT_UNAVAILABLE Handle = 0x87C51028 - UTC_E_RPC_TIMEOUT Handle = 0x87C51029 - UTC_E_RPC_WAIT_FAILED Handle = 0x87C5102A - UTC_E_API_BUSY Handle = 0x87C5102B - UTC_E_TRACE_MIN_DURATION_REQUIREMENT_NOT_MET Handle = 0x87C5102C - UTC_E_EXCLUSIVITY_NOT_AVAILABLE Handle = 0x87C5102D - UTC_E_GETFILE_FILE_PATH_NOT_APPROVED Handle = 0x87C5102E - UTC_E_ESCALATION_DIRECTORY_ALREADY_EXISTS Handle = 0x87C5102F - UTC_E_TIME_TRIGGER_ON_START_INVALID Handle = 0x87C51030 - UTC_E_TIME_TRIGGER_ONLY_VALID_ON_SINGLE_TRANSITION Handle = 0x87C51031 - UTC_E_TIME_TRIGGER_INVALID_TIME_RANGE Handle = 0x87C51032 - UTC_E_MULTIPLE_TIME_TRIGGER_ON_SINGLE_STATE Handle = 0x87C51033 - UTC_E_BINARY_MISSING Handle = 0x87C51034 - UTC_E_NETWORK_CAPTURE_NOT_ALLOWED Handle = 0x87C51035 - UTC_E_FAILED_TO_RESOLVE_CONTAINER_ID Handle = 0x87C51036 - UTC_E_UNABLE_TO_RESOLVE_SESSION Handle = 0x87C51037 - UTC_E_THROTTLED Handle = 0x87C51038 - UTC_E_UNAPPROVED_SCRIPT Handle = 0x87C51039 - UTC_E_SCRIPT_MISSING Handle = 0x87C5103A - UTC_E_SCENARIO_THROTTLED Handle = 0x87C5103B - UTC_E_API_NOT_SUPPORTED Handle = 0x87C5103C - UTC_E_GETFILE_EXTERNAL_PATH_NOT_APPROVED Handle = 0x87C5103D - UTC_E_TRY_GET_SCENARIO_TIMEOUT_EXCEEDED Handle = 0x87C5103E - UTC_E_CERT_REV_FAILED Handle = 0x87C5103F - UTC_E_FAILED_TO_START_NDISCAP Handle = 0x87C51040 - UTC_E_KERNELDUMP_LIMIT_REACHED Handle = 0x87C51041 - UTC_E_MISSING_AGGREGATE_EVENT_TAG Handle = 0x87C51042 - UTC_E_INVALID_AGGREGATION_STRUCT Handle = 0x87C51043 - UTC_E_ACTION_NOT_SUPPORTED_IN_DESTINATION Handle = 0x87C51044 - UTC_E_FILTER_MISSING_ATTRIBUTE Handle = 0x87C51045 - UTC_E_FILTER_INVALID_TYPE Handle = 0x87C51046 - UTC_E_FILTER_VARIABLE_NOT_FOUND Handle = 0x87C51047 - UTC_E_FILTER_FUNCTION_RESTRICTED Handle = 0x87C51048 - UTC_E_FILTER_VERSION_MISMATCH Handle = 0x87C51049 - UTC_E_FILTER_INVALID_FUNCTION Handle = 0x87C51050 - UTC_E_FILTER_INVALID_FUNCTION_PARAMS Handle = 0x87C51051 - UTC_E_FILTER_INVALID_COMMAND Handle = 0x87C51052 - UTC_E_FILTER_ILLEGAL_EVAL Handle = 0x87C51053 - UTC_E_TTTRACER_RETURNED_ERROR Handle = 0x87C51054 - UTC_E_AGENT_DIAGNOSTICS_TOO_LARGE Handle = 0x87C51055 - UTC_E_FAILED_TO_RECEIVE_AGENT_DIAGNOSTICS Handle = 0x87C51056 - UTC_E_SCENARIO_HAS_NO_ACTIONS Handle = 0x87C51057 - UTC_E_TTTRACER_STORAGE_FULL Handle = 0x87C51058 - UTC_E_INSUFFICIENT_SPACE_TO_START_TRACE Handle = 0x87C51059 - UTC_E_ESCALATION_CANCELLED_AT_SHUTDOWN Handle = 0x87C5105A - UTC_E_GETFILEINFOACTION_FILE_NOT_APPROVED Handle = 0x87C5105B - WINML_ERR_INVALID_DEVICE Handle = 0x88900001 - WINML_ERR_INVALID_BINDING Handle = 0x88900002 - WINML_ERR_VALUE_NOTFOUND Handle = 0x88900003 - WINML_ERR_SIZE_MISMATCH Handle = 0x88900004 -) diff --git a/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go b/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go deleted file mode 100644 index 6048ac67..00000000 --- a/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT. - -package windows - -type KNOWNFOLDERID GUID - -var ( - FOLDERID_NetworkFolder = &KNOWNFOLDERID{0xd20beec4, 0x5ca8, 0x4905, [8]byte{0xae, 0x3b, 0xbf, 0x25, 0x1e, 0xa0, 0x9b, 0x53}} - FOLDERID_ComputerFolder = &KNOWNFOLDERID{0x0ac0837c, 0xbbf8, 0x452a, [8]byte{0x85, 0x0d, 0x79, 0xd0, 0x8e, 0x66, 0x7c, 0xa7}} - FOLDERID_InternetFolder = &KNOWNFOLDERID{0x4d9f7874, 0x4e0c, 0x4904, [8]byte{0x96, 0x7b, 0x40, 0xb0, 0xd2, 0x0c, 0x3e, 0x4b}} - FOLDERID_ControlPanelFolder = &KNOWNFOLDERID{0x82a74aeb, 0xaeb4, 0x465c, [8]byte{0xa0, 0x14, 0xd0, 0x97, 0xee, 0x34, 0x6d, 0x63}} - FOLDERID_PrintersFolder = &KNOWNFOLDERID{0x76fc4e2d, 0xd6ad, 0x4519, [8]byte{0xa6, 0x63, 0x37, 0xbd, 0x56, 0x06, 0x81, 0x85}} - FOLDERID_SyncManagerFolder = &KNOWNFOLDERID{0x43668bf8, 0xc14e, 0x49b2, [8]byte{0x97, 0xc9, 0x74, 0x77, 0x84, 0xd7, 0x84, 0xb7}} - FOLDERID_SyncSetupFolder = &KNOWNFOLDERID{0x0f214138, 0xb1d3, 0x4a90, [8]byte{0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a}} - FOLDERID_ConflictFolder = &KNOWNFOLDERID{0x4bfefb45, 0x347d, 0x4006, [8]byte{0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92}} - FOLDERID_SyncResultsFolder = &KNOWNFOLDERID{0x289a9a43, 0xbe44, 0x4057, [8]byte{0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9}} - FOLDERID_RecycleBinFolder = &KNOWNFOLDERID{0xb7534046, 0x3ecb, 0x4c18, [8]byte{0xbe, 0x4e, 0x64, 0xcd, 0x4c, 0xb7, 0xd6, 0xac}} - FOLDERID_ConnectionsFolder = &KNOWNFOLDERID{0x6f0cd92b, 0x2e97, 0x45d1, [8]byte{0x88, 0xff, 0xb0, 0xd1, 0x86, 0xb8, 0xde, 0xdd}} - FOLDERID_Fonts = &KNOWNFOLDERID{0xfd228cb7, 0xae11, 0x4ae3, [8]byte{0x86, 0x4c, 0x16, 0xf3, 0x91, 0x0a, 0xb8, 0xfe}} - FOLDERID_Desktop = &KNOWNFOLDERID{0xb4bfcc3a, 0xdb2c, 0x424c, [8]byte{0xb0, 0x29, 0x7f, 0xe9, 0x9a, 0x87, 0xc6, 0x41}} - FOLDERID_Startup = &KNOWNFOLDERID{0xb97d20bb, 0xf46a, 0x4c97, [8]byte{0xba, 0x10, 0x5e, 0x36, 0x08, 0x43, 0x08, 0x54}} - FOLDERID_Programs = &KNOWNFOLDERID{0xa77f5d77, 0x2e2b, 0x44c3, [8]byte{0xa6, 0xa2, 0xab, 0xa6, 0x01, 0x05, 0x4a, 0x51}} - FOLDERID_StartMenu = &KNOWNFOLDERID{0x625b53c3, 0xab48, 0x4ec1, [8]byte{0xba, 0x1f, 0xa1, 0xef, 0x41, 0x46, 0xfc, 0x19}} - FOLDERID_Recent = &KNOWNFOLDERID{0xae50c081, 0xebd2, 0x438a, [8]byte{0x86, 0x55, 0x8a, 0x09, 0x2e, 0x34, 0x98, 0x7a}} - FOLDERID_SendTo = &KNOWNFOLDERID{0x8983036c, 0x27c0, 0x404b, [8]byte{0x8f, 0x08, 0x10, 0x2d, 0x10, 0xdc, 0xfd, 0x74}} - FOLDERID_Documents = &KNOWNFOLDERID{0xfdd39ad0, 0x238f, 0x46af, [8]byte{0xad, 0xb4, 0x6c, 0x85, 0x48, 0x03, 0x69, 0xc7}} - FOLDERID_Favorites = &KNOWNFOLDERID{0x1777f761, 0x68ad, 0x4d8a, [8]byte{0x87, 0xbd, 0x30, 0xb7, 0x59, 0xfa, 0x33, 0xdd}} - FOLDERID_NetHood = &KNOWNFOLDERID{0xc5abbf53, 0xe17f, 0x4121, [8]byte{0x89, 0x00, 0x86, 0x62, 0x6f, 0xc2, 0xc9, 0x73}} - FOLDERID_PrintHood = &KNOWNFOLDERID{0x9274bd8d, 0xcfd1, 0x41c3, [8]byte{0xb3, 0x5e, 0xb1, 0x3f, 0x55, 0xa7, 0x58, 0xf4}} - FOLDERID_Templates = &KNOWNFOLDERID{0xa63293e8, 0x664e, 0x48db, [8]byte{0xa0, 0x79, 0xdf, 0x75, 0x9e, 0x05, 0x09, 0xf7}} - FOLDERID_CommonStartup = &KNOWNFOLDERID{0x82a5ea35, 0xd9cd, 0x47c5, [8]byte{0x96, 0x29, 0xe1, 0x5d, 0x2f, 0x71, 0x4e, 0x6e}} - FOLDERID_CommonPrograms = &KNOWNFOLDERID{0x0139d44e, 0x6afe, 0x49f2, [8]byte{0x86, 0x90, 0x3d, 0xaf, 0xca, 0xe6, 0xff, 0xb8}} - FOLDERID_CommonStartMenu = &KNOWNFOLDERID{0xa4115719, 0xd62e, 0x491d, [8]byte{0xaa, 0x7c, 0xe7, 0x4b, 0x8b, 0xe3, 0xb0, 0x67}} - FOLDERID_PublicDesktop = &KNOWNFOLDERID{0xc4aa340d, 0xf20f, 0x4863, [8]byte{0xaf, 0xef, 0xf8, 0x7e, 0xf2, 0xe6, 0xba, 0x25}} - FOLDERID_ProgramData = &KNOWNFOLDERID{0x62ab5d82, 0xfdc1, 0x4dc3, [8]byte{0xa9, 0xdd, 0x07, 0x0d, 0x1d, 0x49, 0x5d, 0x97}} - FOLDERID_CommonTemplates = &KNOWNFOLDERID{0xb94237e7, 0x57ac, 0x4347, [8]byte{0x91, 0x51, 0xb0, 0x8c, 0x6c, 0x32, 0xd1, 0xf7}} - FOLDERID_PublicDocuments = &KNOWNFOLDERID{0xed4824af, 0xdce4, 0x45a8, [8]byte{0x81, 0xe2, 0xfc, 0x79, 0x65, 0x08, 0x36, 0x34}} - FOLDERID_RoamingAppData = &KNOWNFOLDERID{0x3eb685db, 0x65f9, 0x4cf6, [8]byte{0xa0, 0x3a, 0xe3, 0xef, 0x65, 0x72, 0x9f, 0x3d}} - FOLDERID_LocalAppData = &KNOWNFOLDERID{0xf1b32785, 0x6fba, 0x4fcf, [8]byte{0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91}} - FOLDERID_LocalAppDataLow = &KNOWNFOLDERID{0xa520a1a4, 0x1780, 0x4ff6, [8]byte{0xbd, 0x18, 0x16, 0x73, 0x43, 0xc5, 0xaf, 0x16}} - FOLDERID_InternetCache = &KNOWNFOLDERID{0x352481e8, 0x33be, 0x4251, [8]byte{0xba, 0x85, 0x60, 0x07, 0xca, 0xed, 0xcf, 0x9d}} - FOLDERID_Cookies = &KNOWNFOLDERID{0x2b0f765d, 0xc0e9, 0x4171, [8]byte{0x90, 0x8e, 0x08, 0xa6, 0x11, 0xb8, 0x4f, 0xf6}} - FOLDERID_History = &KNOWNFOLDERID{0xd9dc8a3b, 0xb784, 0x432e, [8]byte{0xa7, 0x81, 0x5a, 0x11, 0x30, 0xa7, 0x59, 0x63}} - FOLDERID_System = &KNOWNFOLDERID{0x1ac14e77, 0x02e7, 0x4e5d, [8]byte{0xb7, 0x44, 0x2e, 0xb1, 0xae, 0x51, 0x98, 0xb7}} - FOLDERID_SystemX86 = &KNOWNFOLDERID{0xd65231b0, 0xb2f1, 0x4857, [8]byte{0xa4, 0xce, 0xa8, 0xe7, 0xc6, 0xea, 0x7d, 0x27}} - FOLDERID_Windows = &KNOWNFOLDERID{0xf38bf404, 0x1d43, 0x42f2, [8]byte{0x93, 0x05, 0x67, 0xde, 0x0b, 0x28, 0xfc, 0x23}} - FOLDERID_Profile = &KNOWNFOLDERID{0x5e6c858f, 0x0e22, 0x4760, [8]byte{0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73}} - FOLDERID_Pictures = &KNOWNFOLDERID{0x33e28130, 0x4e1e, 0x4676, [8]byte{0x83, 0x5a, 0x98, 0x39, 0x5c, 0x3b, 0xc3, 0xbb}} - FOLDERID_ProgramFilesX86 = &KNOWNFOLDERID{0x7c5a40ef, 0xa0fb, 0x4bfc, [8]byte{0x87, 0x4a, 0xc0, 0xf2, 0xe0, 0xb9, 0xfa, 0x8e}} - FOLDERID_ProgramFilesCommonX86 = &KNOWNFOLDERID{0xde974d24, 0xd9c6, 0x4d3e, [8]byte{0xbf, 0x91, 0xf4, 0x45, 0x51, 0x20, 0xb9, 0x17}} - FOLDERID_ProgramFilesX64 = &KNOWNFOLDERID{0x6d809377, 0x6af0, 0x444b, [8]byte{0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e}} - FOLDERID_ProgramFilesCommonX64 = &KNOWNFOLDERID{0x6365d5a7, 0x0f0d, 0x45e5, [8]byte{0x87, 0xf6, 0x0d, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d}} - FOLDERID_ProgramFiles = &KNOWNFOLDERID{0x905e63b6, 0xc1bf, 0x494e, [8]byte{0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a}} - FOLDERID_ProgramFilesCommon = &KNOWNFOLDERID{0xf7f1ed05, 0x9f6d, 0x47a2, [8]byte{0xaa, 0xae, 0x29, 0xd3, 0x17, 0xc6, 0xf0, 0x66}} - FOLDERID_UserProgramFiles = &KNOWNFOLDERID{0x5cd7aee2, 0x2219, 0x4a67, [8]byte{0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb}} - FOLDERID_UserProgramFilesCommon = &KNOWNFOLDERID{0xbcbd3057, 0xca5c, 0x4622, [8]byte{0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16}} - FOLDERID_AdminTools = &KNOWNFOLDERID{0x724ef170, 0xa42d, 0x4fef, [8]byte{0x9f, 0x26, 0xb6, 0x0e, 0x84, 0x6f, 0xba, 0x4f}} - FOLDERID_CommonAdminTools = &KNOWNFOLDERID{0xd0384e7d, 0xbac3, 0x4797, [8]byte{0x8f, 0x14, 0xcb, 0xa2, 0x29, 0xb3, 0x92, 0xb5}} - FOLDERID_Music = &KNOWNFOLDERID{0x4bd8d571, 0x6d19, 0x48d3, [8]byte{0xbe, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0e, 0x43}} - FOLDERID_Videos = &KNOWNFOLDERID{0x18989b1d, 0x99b5, 0x455b, [8]byte{0x84, 0x1c, 0xab, 0x7c, 0x74, 0xe4, 0xdd, 0xfc}} - FOLDERID_Ringtones = &KNOWNFOLDERID{0xc870044b, 0xf49e, 0x4126, [8]byte{0xa9, 0xc3, 0xb5, 0x2a, 0x1f, 0xf4, 0x11, 0xe8}} - FOLDERID_PublicPictures = &KNOWNFOLDERID{0xb6ebfb86, 0x6907, 0x413c, [8]byte{0x9a, 0xf7, 0x4f, 0xc2, 0xab, 0xf0, 0x7c, 0xc5}} - FOLDERID_PublicMusic = &KNOWNFOLDERID{0x3214fab5, 0x9757, 0x4298, [8]byte{0xbb, 0x61, 0x92, 0xa9, 0xde, 0xaa, 0x44, 0xff}} - FOLDERID_PublicVideos = &KNOWNFOLDERID{0x2400183a, 0x6185, 0x49fb, [8]byte{0xa2, 0xd8, 0x4a, 0x39, 0x2a, 0x60, 0x2b, 0xa3}} - FOLDERID_PublicRingtones = &KNOWNFOLDERID{0xe555ab60, 0x153b, 0x4d17, [8]byte{0x9f, 0x04, 0xa5, 0xfe, 0x99, 0xfc, 0x15, 0xec}} - FOLDERID_ResourceDir = &KNOWNFOLDERID{0x8ad10c31, 0x2adb, 0x4296, [8]byte{0xa8, 0xf7, 0xe4, 0x70, 0x12, 0x32, 0xc9, 0x72}} - FOLDERID_LocalizedResourcesDir = &KNOWNFOLDERID{0x2a00375e, 0x224c, 0x49de, [8]byte{0xb8, 0xd1, 0x44, 0x0d, 0xf7, 0xef, 0x3d, 0xdc}} - FOLDERID_CommonOEMLinks = &KNOWNFOLDERID{0xc1bae2d0, 0x10df, 0x4334, [8]byte{0xbe, 0xdd, 0x7a, 0xa2, 0x0b, 0x22, 0x7a, 0x9d}} - FOLDERID_CDBurning = &KNOWNFOLDERID{0x9e52ab10, 0xf80d, 0x49df, [8]byte{0xac, 0xb8, 0x43, 0x30, 0xf5, 0x68, 0x78, 0x55}} - FOLDERID_UserProfiles = &KNOWNFOLDERID{0x0762d272, 0xc50a, 0x4bb0, [8]byte{0xa3, 0x82, 0x69, 0x7d, 0xcd, 0x72, 0x9b, 0x80}} - FOLDERID_Playlists = &KNOWNFOLDERID{0xde92c1c7, 0x837f, 0x4f69, [8]byte{0xa3, 0xbb, 0x86, 0xe6, 0x31, 0x20, 0x4a, 0x23}} - FOLDERID_SamplePlaylists = &KNOWNFOLDERID{0x15ca69b3, 0x30ee, 0x49c1, [8]byte{0xac, 0xe1, 0x6b, 0x5e, 0xc3, 0x72, 0xaf, 0xb5}} - FOLDERID_SampleMusic = &KNOWNFOLDERID{0xb250c668, 0xf57d, 0x4ee1, [8]byte{0xa6, 0x3c, 0x29, 0x0e, 0xe7, 0xd1, 0xaa, 0x1f}} - FOLDERID_SamplePictures = &KNOWNFOLDERID{0xc4900540, 0x2379, 0x4c75, [8]byte{0x84, 0x4b, 0x64, 0xe6, 0xfa, 0xf8, 0x71, 0x6b}} - FOLDERID_SampleVideos = &KNOWNFOLDERID{0x859ead94, 0x2e85, 0x48ad, [8]byte{0xa7, 0x1a, 0x09, 0x69, 0xcb, 0x56, 0xa6, 0xcd}} - FOLDERID_PhotoAlbums = &KNOWNFOLDERID{0x69d2cf90, 0xfc33, 0x4fb7, [8]byte{0x9a, 0x0c, 0xeb, 0xb0, 0xf0, 0xfc, 0xb4, 0x3c}} - FOLDERID_Public = &KNOWNFOLDERID{0xdfdf76a2, 0xc82a, 0x4d63, [8]byte{0x90, 0x6a, 0x56, 0x44, 0xac, 0x45, 0x73, 0x85}} - FOLDERID_ChangeRemovePrograms = &KNOWNFOLDERID{0xdf7266ac, 0x9274, 0x4867, [8]byte{0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d}} - FOLDERID_AppUpdates = &KNOWNFOLDERID{0xa305ce99, 0xf527, 0x492b, [8]byte{0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4}} - FOLDERID_AddNewPrograms = &KNOWNFOLDERID{0xde61d971, 0x5ebc, 0x4f02, [8]byte{0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04}} - FOLDERID_Downloads = &KNOWNFOLDERID{0x374de290, 0x123f, 0x4565, [8]byte{0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}} - FOLDERID_PublicDownloads = &KNOWNFOLDERID{0x3d644c9b, 0x1fb8, 0x4f30, [8]byte{0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0}} - FOLDERID_SavedSearches = &KNOWNFOLDERID{0x7d1d3a04, 0xdebb, 0x4115, [8]byte{0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda}} - FOLDERID_QuickLaunch = &KNOWNFOLDERID{0x52a4f021, 0x7b75, 0x48a9, [8]byte{0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f}} - FOLDERID_Contacts = &KNOWNFOLDERID{0x56784854, 0xc6cb, 0x462b, [8]byte{0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82}} - FOLDERID_SidebarParts = &KNOWNFOLDERID{0xa75d362e, 0x50fc, 0x4fb7, [8]byte{0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93}} - FOLDERID_SidebarDefaultParts = &KNOWNFOLDERID{0x7b396e54, 0x9ec5, 0x4300, [8]byte{0xbe, 0x0a, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26}} - FOLDERID_PublicGameTasks = &KNOWNFOLDERID{0xdebf2536, 0xe1a8, 0x4c59, [8]byte{0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea}} - FOLDERID_GameTasks = &KNOWNFOLDERID{0x054fae61, 0x4dd8, 0x4787, [8]byte{0x80, 0xb6, 0x09, 0x02, 0x20, 0xc4, 0xb7, 0x00}} - FOLDERID_SavedGames = &KNOWNFOLDERID{0x4c5c32ff, 0xbb9d, 0x43b0, [8]byte{0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4}} - FOLDERID_Games = &KNOWNFOLDERID{0xcac52c1a, 0xb53d, 0x4edc, [8]byte{0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34}} - FOLDERID_SEARCH_MAPI = &KNOWNFOLDERID{0x98ec0e18, 0x2098, 0x4d44, [8]byte{0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81}} - FOLDERID_SEARCH_CSC = &KNOWNFOLDERID{0xee32e446, 0x31ca, 0x4aba, [8]byte{0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e}} - FOLDERID_Links = &KNOWNFOLDERID{0xbfb9d5e0, 0xc6a9, 0x404c, [8]byte{0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68}} - FOLDERID_UsersFiles = &KNOWNFOLDERID{0xf3ce0f7c, 0x4901, 0x4acc, [8]byte{0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f}} - FOLDERID_UsersLibraries = &KNOWNFOLDERID{0xa302545d, 0xdeff, 0x464b, [8]byte{0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b}} - FOLDERID_SearchHome = &KNOWNFOLDERID{0x190337d1, 0xb8ca, 0x4121, [8]byte{0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a}} - FOLDERID_OriginalImages = &KNOWNFOLDERID{0x2c36c0aa, 0x5812, 0x4b87, [8]byte{0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39}} - FOLDERID_DocumentsLibrary = &KNOWNFOLDERID{0x7b0db17d, 0x9cd2, 0x4a93, [8]byte{0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c}} - FOLDERID_MusicLibrary = &KNOWNFOLDERID{0x2112ab0a, 0xc86a, 0x4ffe, [8]byte{0xa3, 0x68, 0x0d, 0xe9, 0x6e, 0x47, 0x01, 0x2e}} - FOLDERID_PicturesLibrary = &KNOWNFOLDERID{0xa990ae9f, 0xa03b, 0x4e80, [8]byte{0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x04}} - FOLDERID_VideosLibrary = &KNOWNFOLDERID{0x491e922f, 0x5643, 0x4af4, [8]byte{0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74}} - FOLDERID_RecordedTVLibrary = &KNOWNFOLDERID{0x1a6fdba2, 0xf42d, 0x4358, [8]byte{0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5}} - FOLDERID_HomeGroup = &KNOWNFOLDERID{0x52528a6b, 0xb9e3, 0x4add, [8]byte{0xb6, 0x0d, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d}} - FOLDERID_HomeGroupCurrentUser = &KNOWNFOLDERID{0x9b74b6a3, 0x0dfd, 0x4f11, [8]byte{0x9e, 0x78, 0x5f, 0x78, 0x00, 0xf2, 0xe7, 0x72}} - FOLDERID_DeviceMetadataStore = &KNOWNFOLDERID{0x5ce4a5e9, 0xe4eb, 0x479d, [8]byte{0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55}} - FOLDERID_Libraries = &KNOWNFOLDERID{0x1b3ea5dc, 0xb587, 0x4786, [8]byte{0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae}} - FOLDERID_PublicLibraries = &KNOWNFOLDERID{0x48daf80b, 0xe6cf, 0x4f4e, [8]byte{0xb8, 0x00, 0x0e, 0x69, 0xd8, 0x4e, 0xe3, 0x84}} - FOLDERID_UserPinned = &KNOWNFOLDERID{0x9e3995ab, 0x1f9c, 0x4f13, [8]byte{0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74}} - FOLDERID_ImplicitAppShortcuts = &KNOWNFOLDERID{0xbcb5256f, 0x79f6, 0x4cee, [8]byte{0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x02, 0xfd, 0x46}} - FOLDERID_AccountPictures = &KNOWNFOLDERID{0x008ca0b1, 0x55b4, 0x4c56, [8]byte{0xb8, 0xa8, 0x4d, 0xe4, 0xb2, 0x99, 0xd3, 0xbe}} - FOLDERID_PublicUserTiles = &KNOWNFOLDERID{0x0482af6c, 0x08f1, 0x4c34, [8]byte{0x8c, 0x90, 0xe1, 0x7e, 0xc9, 0x8b, 0x1e, 0x17}} - FOLDERID_AppsFolder = &KNOWNFOLDERID{0x1e87508d, 0x89c2, 0x42f0, [8]byte{0x8a, 0x7e, 0x64, 0x5a, 0x0f, 0x50, 0xca, 0x58}} - FOLDERID_StartMenuAllPrograms = &KNOWNFOLDERID{0xf26305ef, 0x6948, 0x40b9, [8]byte{0xb2, 0x55, 0x81, 0x45, 0x3d, 0x09, 0xc7, 0x85}} - FOLDERID_CommonStartMenuPlaces = &KNOWNFOLDERID{0xa440879f, 0x87a0, 0x4f7d, [8]byte{0xb7, 0x00, 0x02, 0x07, 0xb9, 0x66, 0x19, 0x4a}} - FOLDERID_ApplicationShortcuts = &KNOWNFOLDERID{0xa3918781, 0xe5f2, 0x4890, [8]byte{0xb3, 0xd9, 0xa7, 0xe5, 0x43, 0x32, 0x32, 0x8c}} - FOLDERID_RoamingTiles = &KNOWNFOLDERID{0x00bcfc5a, 0xed94, 0x4e48, [8]byte{0x96, 0xa1, 0x3f, 0x62, 0x17, 0xf2, 0x19, 0x90}} - FOLDERID_RoamedTileImages = &KNOWNFOLDERID{0xaaa8d5a5, 0xf1d6, 0x4259, [8]byte{0xba, 0xa8, 0x78, 0xe7, 0xef, 0x60, 0x83, 0x5e}} - FOLDERID_Screenshots = &KNOWNFOLDERID{0xb7bede81, 0xdf94, 0x4682, [8]byte{0xa7, 0xd8, 0x57, 0xa5, 0x26, 0x20, 0xb8, 0x6f}} - FOLDERID_CameraRoll = &KNOWNFOLDERID{0xab5fb87b, 0x7ce2, 0x4f83, [8]byte{0x91, 0x5d, 0x55, 0x08, 0x46, 0xc9, 0x53, 0x7b}} - FOLDERID_SkyDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} - FOLDERID_OneDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} - FOLDERID_SkyDriveDocuments = &KNOWNFOLDERID{0x24d89e24, 0x2f19, 0x4534, [8]byte{0x9d, 0xde, 0x6a, 0x66, 0x71, 0xfb, 0xb8, 0xfe}} - FOLDERID_SkyDrivePictures = &KNOWNFOLDERID{0x339719b5, 0x8c47, 0x4894, [8]byte{0x94, 0xc2, 0xd8, 0xf7, 0x7a, 0xdd, 0x44, 0xa6}} - FOLDERID_SkyDriveMusic = &KNOWNFOLDERID{0xc3f2459e, 0x80d6, 0x45dc, [8]byte{0xbf, 0xef, 0x1f, 0x76, 0x9f, 0x2b, 0xe7, 0x30}} - FOLDERID_SkyDriveCameraRoll = &KNOWNFOLDERID{0x767e6811, 0x49cb, 0x4273, [8]byte{0x87, 0xc2, 0x20, 0xf3, 0x55, 0xe1, 0x08, 0x5b}} - FOLDERID_SearchHistory = &KNOWNFOLDERID{0x0d4c3db6, 0x03a3, 0x462f, [8]byte{0xa0, 0xe6, 0x08, 0x92, 0x4c, 0x41, 0xb5, 0xd4}} - FOLDERID_SearchTemplates = &KNOWNFOLDERID{0x7e636bfe, 0xdfa9, 0x4d5e, [8]byte{0xb4, 0x56, 0xd7, 0xb3, 0x98, 0x51, 0xd8, 0xa9}} - FOLDERID_CameraRollLibrary = &KNOWNFOLDERID{0x2b20df75, 0x1eda, 0x4039, [8]byte{0x80, 0x97, 0x38, 0x79, 0x82, 0x27, 0xd5, 0xb7}} - FOLDERID_SavedPictures = &KNOWNFOLDERID{0x3b193882, 0xd3ad, 0x4eab, [8]byte{0x96, 0x5a, 0x69, 0x82, 0x9d, 0x1f, 0xb5, 0x9f}} - FOLDERID_SavedPicturesLibrary = &KNOWNFOLDERID{0xe25b5812, 0xbe88, 0x4bd9, [8]byte{0x94, 0xb0, 0x29, 0x23, 0x34, 0x77, 0xb6, 0xc3}} - FOLDERID_RetailDemo = &KNOWNFOLDERID{0x12d4c69e, 0x24ad, 0x4923, [8]byte{0xbe, 0x19, 0x31, 0x32, 0x1c, 0x43, 0xa7, 0x67}} - FOLDERID_Device = &KNOWNFOLDERID{0x1c2ac1dc, 0x4358, 0x4b6c, [8]byte{0x97, 0x33, 0xaf, 0x21, 0x15, 0x65, 0x76, 0xf0}} - FOLDERID_DevelopmentFiles = &KNOWNFOLDERID{0xdbe8e08e, 0x3053, 0x4bbc, [8]byte{0xb1, 0x83, 0x2a, 0x7b, 0x2b, 0x19, 0x1e, 0x59}} - FOLDERID_Objects3D = &KNOWNFOLDERID{0x31c0dd25, 0x9439, 0x4f12, [8]byte{0xbf, 0x41, 0x7f, 0xf4, 0xed, 0xa3, 0x87, 0x22}} - FOLDERID_AppCaptures = &KNOWNFOLDERID{0xedc0fe71, 0x98d8, 0x4f4a, [8]byte{0xb9, 0x20, 0xc8, 0xdc, 0x13, 0x3c, 0xb1, 0x65}} - FOLDERID_LocalDocuments = &KNOWNFOLDERID{0xf42ee2d3, 0x909f, 0x4907, [8]byte{0x88, 0x71, 0x4c, 0x22, 0xfc, 0x0b, 0xf7, 0x56}} - FOLDERID_LocalPictures = &KNOWNFOLDERID{0x0ddd015d, 0xb06c, 0x45d5, [8]byte{0x8c, 0x4c, 0xf5, 0x97, 0x13, 0x85, 0x46, 0x39}} - FOLDERID_LocalVideos = &KNOWNFOLDERID{0x35286a68, 0x3c57, 0x41a1, [8]byte{0xbb, 0xb1, 0x0e, 0xae, 0x73, 0xd7, 0x6c, 0x95}} - FOLDERID_LocalMusic = &KNOWNFOLDERID{0xa0c69a99, 0x21c8, 0x4671, [8]byte{0x87, 0x03, 0x79, 0x34, 0x16, 0x2f, 0xcf, 0x1d}} - FOLDERID_LocalDownloads = &KNOWNFOLDERID{0x7d83ee9b, 0x2244, 0x4e70, [8]byte{0xb1, 0xf5, 0x53, 0x93, 0x04, 0x2a, 0xf1, 0xe4}} - FOLDERID_RecordedCalls = &KNOWNFOLDERID{0x2f8b40c2, 0x83ed, 0x48ee, [8]byte{0xb3, 0x83, 0xa1, 0xf1, 0x57, 0xec, 0x6f, 0x9a}} - FOLDERID_AllAppMods = &KNOWNFOLDERID{0x7ad67899, 0x66af, 0x43ba, [8]byte{0x91, 0x56, 0x6a, 0xad, 0x42, 0xe6, 0xc5, 0x96}} - FOLDERID_CurrentAppMods = &KNOWNFOLDERID{0x3db40b20, 0x2a30, 0x4dbe, [8]byte{0x91, 0x7e, 0x77, 0x1d, 0xd2, 0x1d, 0xd0, 0x99}} - FOLDERID_AppDataDesktop = &KNOWNFOLDERID{0xb2c5e279, 0x7add, 0x439f, [8]byte{0xb2, 0x8c, 0xc4, 0x1f, 0xe1, 0xbb, 0xf6, 0x72}} - FOLDERID_AppDataDocuments = &KNOWNFOLDERID{0x7be16610, 0x1f7f, 0x44ac, [8]byte{0xbf, 0xf0, 0x83, 0xe1, 0x5f, 0x2f, 0xfc, 0xa1}} - FOLDERID_AppDataFavorites = &KNOWNFOLDERID{0x7cfbefbc, 0xde1f, 0x45aa, [8]byte{0xb8, 0x43, 0xa5, 0x42, 0xac, 0x53, 0x6c, 0xc9}} - FOLDERID_AppDataProgramData = &KNOWNFOLDERID{0x559d40a3, 0xa036, 0x40fa, [8]byte{0xaf, 0x61, 0x84, 0xcb, 0x43, 0x0a, 0x4d, 0x34}} -) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index e66ab049..fc56aec0 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -38,17 +38,14 @@ var ( modadvapi32 = NewLazySystemDLL("advapi32.dll") modkernel32 = NewLazySystemDLL("kernel32.dll") modshell32 = NewLazySystemDLL("shell32.dll") - moduserenv = NewLazySystemDLL("userenv.dll") modmswsock = NewLazySystemDLL("mswsock.dll") modcrypt32 = NewLazySystemDLL("crypt32.dll") - moduser32 = NewLazySystemDLL("user32.dll") - modole32 = NewLazySystemDLL("ole32.dll") modws2_32 = NewLazySystemDLL("ws2_32.dll") moddnsapi = NewLazySystemDLL("dnsapi.dll") modiphlpapi = NewLazySystemDLL("iphlpapi.dll") modsecur32 = NewLazySystemDLL("secur32.dll") modnetapi32 = NewLazySystemDLL("netapi32.dll") - modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") + moduserenv = NewLazySystemDLL("userenv.dll") procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW") procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") @@ -60,7 +57,6 @@ var ( procDeleteService = modadvapi32.NewProc("DeleteService") procStartServiceW = modadvapi32.NewProc("StartServiceW") procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") - procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW") procControlService = modadvapi32.NewProc("ControlService") procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW") procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus") @@ -70,7 +66,6 @@ var ( procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx") - procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW") procGetLastError = modkernel32.NewProc("GetLastError") procLoadLibraryW = modkernel32.NewProc("LoadLibraryW") procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW") @@ -79,11 +74,9 @@ var ( procGetVersion = modkernel32.NewProc("GetVersion") procFormatMessageW = modkernel32.NewProc("FormatMessageW") procExitProcess = modkernel32.NewProc("ExitProcess") - procIsWow64Process = modkernel32.NewProc("IsWow64Process") procCreateFileW = modkernel32.NewProc("CreateFileW") procReadFile = modkernel32.NewProc("ReadFile") procWriteFile = modkernel32.NewProc("WriteFile") - procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult") procSetFilePointer = modkernel32.NewProc("SetFilePointer") procCloseHandle = modkernel32.NewProc("CloseHandle") procGetStdHandle = modkernel32.NewProc("GetStdHandle") @@ -92,7 +85,6 @@ var ( procFindNextFileW = modkernel32.NewProc("FindNextFileW") procFindClose = modkernel32.NewProc("FindClose") procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") - procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") @@ -113,17 +105,13 @@ var ( procCancelIoEx = modkernel32.NewProc("CancelIoEx") procCreateProcessW = modkernel32.NewProc("CreateProcessW") procOpenProcess = modkernel32.NewProc("OpenProcess") - procShellExecuteW = modshell32.NewProc("ShellExecuteW") - procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") procTerminateProcess = modkernel32.NewProc("TerminateProcess") procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess") procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW") procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess") - procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") - procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") procGetTempPathW = modkernel32.NewProc("GetTempPathW") procCreatePipe = modkernel32.NewProc("CreatePipe") procGetFileType = modkernel32.NewProc("GetFileType") @@ -134,9 +122,6 @@ var ( procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW") procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW") procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") - procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") - procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") - procGetTickCount64 = modkernel32.NewProc("GetTickCount64") procSetFileTime = modkernel32.NewProc("SetFileTime") procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW") @@ -184,8 +169,6 @@ var ( procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") procProcess32FirstW = modkernel32.NewProc("Process32FirstW") procProcess32NextW = modkernel32.NewProc("Process32NextW") - procThread32First = modkernel32.NewProc("Thread32First") - procThread32Next = modkernel32.NewProc("Thread32Next") procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") @@ -196,18 +179,6 @@ var ( procSetEvent = modkernel32.NewProc("SetEvent") procResetEvent = modkernel32.NewProc("ResetEvent") procPulseEvent = modkernel32.NewProc("PulseEvent") - procSleepEx = modkernel32.NewProc("SleepEx") - procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW") - procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") - procTerminateJobObject = modkernel32.NewProc("TerminateJobObject") - procSetErrorMode = modkernel32.NewProc("SetErrorMode") - procResumeThread = modkernel32.NewProc("ResumeThread") - procSetPriorityClass = modkernel32.NewProc("SetPriorityClass") - procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") - procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") - procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") - procGetProcessId = modkernel32.NewProc("GetProcessId") - procOpenThread = modkernel32.NewProc("OpenThread") procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW") procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW") @@ -227,11 +198,6 @@ var ( procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") - procMessageBoxW = moduser32.NewProc("MessageBoxW") - procCLSIDFromString = modole32.NewProc("CLSIDFromString") - procStringFromGUID2 = modole32.NewProc("StringFromGUID2") - procCoCreateGuid = modole32.NewProc("CoCreateGuid") - procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") procWSAStartup = modws2_32.NewProc("WSAStartup") procWSACleanup = modws2_32.NewProc("WSACleanup") procWSAIoctl = modws2_32.NewProc("WSAIoctl") @@ -279,31 +245,12 @@ var ( procGetLengthSid = modadvapi32.NewProc("GetLengthSid") procCopySid = modadvapi32.NewProc("CopySid") procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid") - procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid") - procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid") procFreeSid = modadvapi32.NewProc("FreeSid") procEqualSid = modadvapi32.NewProc("EqualSid") - procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority") - procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount") - procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority") - procIsValidSid = modadvapi32.NewProc("IsValidSid") procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership") procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") - procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") - procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") - procRevertToSelf = modadvapi32.NewProc("RevertToSelf") - procSetThreadToken = modadvapi32.NewProc("SetThreadToken") - procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") - procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") - procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups") procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") - procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation") - procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") - procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW") - procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken") - procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW") - procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory") ) func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { @@ -430,18 +377,6 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { return } -func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { @@ -550,14 +485,6 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize return } -func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { - r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) - if r0 != 0 { - ret = syscall.Errno(r0) - } - return -} - func GetLastError() (lasterr error) { r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) if r0 != 0 { @@ -679,19 +606,7 @@ func ExitProcess(exitcode uint32) { return } -func IsWow64Process(handle Handle, isWow64 *bool) (err error) { - r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(isWow64)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle { @@ -736,24 +651,6 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) return } -func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) { - var _p0 uint32 - if wait { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) newlowoffset = uint32(r0) @@ -853,18 +750,6 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e return } -func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) @@ -1088,14 +973,14 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA return } -func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) { +func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) { var _p0 uint32 if inheritHandle { _p0 = 1 } else { _p0 = 0 } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) + r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid)) handle = Handle(r0) if handle == 0 { if e1 != 0 { @@ -1107,26 +992,6 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha return } -func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { - r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { - r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) - } - return -} - func TerminateProcess(handle Handle, exitcode uint32) (err error) { r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) if r1 == 0 { @@ -1176,19 +1041,6 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) { return } -func GetCurrentThread() (pseudoHandle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) - pseudoHandle = Handle(r0) - if pseudoHandle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) if r1 == 0 { @@ -1232,25 +1084,6 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, return } -func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { - var _p0 uint32 - if waitAll { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) - event = uint32(r0) - if event == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) @@ -1375,42 +1208,6 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { return } -func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { - var _p0 uint32 - if inheritExisting { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getTickCount64() (ms uint64) { - r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) - ms = uint64(r0) - return -} - func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { @@ -1853,7 +1650,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 return } -func GetCurrentProcessId() (pid uint32) { +func getCurrentProcessId() (pid uint32) { r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) pid = uint32(r0) return @@ -1956,30 +1753,6 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { return } -func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { @@ -2103,156 +1876,6 @@ func PulseEvent(event Handle) (err error) { return } -func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { - var _p0 uint32 - if alertable { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) - ret = uint32(r0) - return -} - -func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func AssignProcessToJobObject(job Handle, process Handle) (err error) { - r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func TerminateJobObject(job Handle, exitCode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetErrorMode(mode uint32) (ret uint32) { - r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) - ret = uint32(r0) - return -} - -func ResumeThread(thread Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) - ret = uint32(r0) - if ret == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetPriorityClass(process Handle, priorityClass uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetPriorityClass(process Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) - ret = uint32(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { - r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) - ret = int(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetProcessId(process Handle) (id uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) - id = uint32(r0) - if id == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) { - var _p0 uint32 - if inheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { @@ -2480,46 +2103,6 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro return } -func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { - r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) - ret = int32(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) - if r0 != 0 { - ret = syscall.Errno(r0) - } - return -} - -func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { - r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) - chars = int32(r0) - return -} - -func coCreateGuid(pguid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) - } - return -} - -func coTaskMemFree(address unsafe.Pointer) { - syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) - return -} - func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) if r0 != 0 { @@ -3050,24 +2633,6 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s return } -func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { - r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) - isWellKnown = r0 != 0 - return -} - func FreeSid(sid *SID) (err error) { r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) if r1 != 0 { @@ -3086,30 +2651,6 @@ func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { return } -func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { - r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) - return -} - -func getSidSubAuthorityCount(sid *SID) (count *uint8) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - count = (*uint8)(unsafe.Pointer(r0)) - return -} - -func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) - subAuthority = (*uint32)(unsafe.Pointer(r0)) - return -} - -func isValidSid(sid *SID) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - isValid = r0 != 0 - return -} - func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { @@ -3122,8 +2663,8 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( return } -func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) +func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { + r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) @@ -3134,134 +2675,8 @@ func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { return } -func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) { - var _p0 uint32 - if openAsSelf { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func RevertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetThreadToken(thread *Handle, token Token) (err error) { - r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) { - var _p0 uint32 - if disableAllPrivileges { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) { - var _p0 uint32 - if resetToDefault { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { - r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) +func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) @@ -3283,45 +2698,3 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { } return } - -func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) - len = uint32(r0) - if len == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WTSQueryUserToken(session uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WTSFreeMemory(ptr uintptr) { - syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) - return -} diff --git a/vendor/golang.org/x/text/encoding/encoding.go b/vendor/golang.org/x/text/encoding/encoding.go index a0bd7cd4..221f175c 100644 --- a/vendor/golang.org/x/text/encoding/encoding.go +++ b/vendor/golang.org/x/text/encoding/encoding.go @@ -124,7 +124,7 @@ func (e *Encoder) Writer(w io.Writer) io.Writer { } // ASCIISub is the ASCII substitute character, as recommended by -// https://unicode.org/reports/tr36/#Text_Comparison +// http://unicode.org/reports/tr36/#Text_Comparison const ASCIISub = '\x1a' // Nop is the nop encoding. Its transformed bytes are the same as the source diff --git a/vendor/golang.org/x/text/encoding/htmlindex/tables.go b/vendor/golang.org/x/text/encoding/htmlindex/tables.go index f074e2c6..9d6b4315 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/tables.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/tables.go @@ -306,7 +306,6 @@ var nameMap = map[string]htmlEncoding{ "iso-2022-cn": replacement, "iso-2022-cn-ext": replacement, "iso-2022-kr": replacement, - "replacement": replacement, "utf-16be": utf16be, "utf-16": utf16le, "utf-16le": utf16le, diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/gen.go b/vendor/golang.org/x/text/encoding/internal/identifier/gen.go index 26cfef9c..0c8eba7e 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/gen.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/gen.go @@ -109,12 +109,7 @@ func main() { use = use || a.Value != "person" } if a.Name.Local == "data" && use { - // Patch up URLs to use https. From some links, the - // https version is different from the http one. - s := a.Value - s = strings.Replace(s, "http://", "https://", -1) - s = strings.Replace(s, "/unicode/", "/", -1) - attr = s + " " + attr = a.Value + " " } } } diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go index 5c9b85c2..7351b4ef 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go @@ -34,7 +34,7 @@ package identifier // - http://www.iana.org/assignments/character-sets/character-sets.xhtml // - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib // - http://www.ietf.org/rfc/rfc2978.txt -// - https://www.unicode.org/reports/tr22/ +// - http://www.unicode.org/reports/tr22/ // - http://www.w3.org/TR/encoding/ // - https://encoding.spec.whatwg.org/ // - https://encoding.spec.whatwg.org/encodings.json diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go index fc7df1bc..768842b0 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go @@ -538,6 +538,8 @@ const ( // ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic. // // ISO registry + // (formerly ECMA + // registry ) ISO111ECMACyrillic MIB = 77 // ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1. @@ -730,18 +732,18 @@ const ( // ISO885913 is the MIB identifier with IANA name ISO-8859-13. // - // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-13 https://www.iana.org/assignments/charset-reg/ISO-8859-13 + // ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-13 http://www.iana.org/assignments/charset-reg/ISO-8859-13 ISO885913 MIB = 109 // ISO885914 is the MIB identifier with IANA name ISO-8859-14. // - // ISO See https://www.iana.org/assignments/charset-reg/ISO-8859-14 + // ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-14 ISO885914 MIB = 110 // ISO885915 is the MIB identifier with IANA name ISO-8859-15. // // ISO - // Please see: https://www.iana.org/assignments/charset-reg/ISO-8859-15 + // Please see: http://www.iana.org/assignments/charset-reg/ISO-8859-15 ISO885915 MIB = 111 // ISO885916 is the MIB identifier with IANA name ISO-8859-16. @@ -752,41 +754,41 @@ const ( // GBK is the MIB identifier with IANA name GBK. // // Chinese IT Standardization Technical Committee - // Please see: https://www.iana.org/assignments/charset-reg/GBK + // Please see: http://www.iana.org/assignments/charset-reg/GBK GBK MIB = 113 // GB18030 is the MIB identifier with IANA name GB18030. // // Chinese IT Standardization Technical Committee - // Please see: https://www.iana.org/assignments/charset-reg/GB18030 + // Please see: http://www.iana.org/assignments/charset-reg/GB18030 GB18030 MIB = 114 // OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15. // // Fujitsu-Siemens standard mainframe EBCDIC encoding - // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15 + // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15 OSDEBCDICDF0415 MIB = 115 // OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV. // // Fujitsu-Siemens standard mainframe EBCDIC encoding - // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV + // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV OSDEBCDICDF03IRV MIB = 116 // OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1. // // Fujitsu-Siemens standard mainframe EBCDIC encoding - // Please see: https://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1 + // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1 OSDEBCDICDF041 MIB = 117 // ISO115481 is the MIB identifier with IANA name ISO-11548-1. // - // See https://www.iana.org/assignments/charset-reg/ISO-11548-1 + // See http://www.iana.org/assignments/charset-reg/ISO-11548-1 ISO115481 MIB = 118 // KZ1048 is the MIB identifier with IANA name KZ-1048. // - // See https://www.iana.org/assignments/charset-reg/KZ-1048 + // See http://www.iana.org/assignments/charset-reg/KZ-1048 KZ1048 MIB = 119 // Unicode is the MIB identifier with IANA name ISO-10646-UCS-2. @@ -853,7 +855,7 @@ const ( // SCSU is the MIB identifier with IANA name SCSU. // - // SCSU See https://www.iana.org/assignments/charset-reg/SCSU + // SCSU See http://www.iana.org/assignments/charset-reg/SCSU SCSU MIB = 1011 // UTF7 is the MIB identifier with IANA name UTF-7. @@ -882,27 +884,27 @@ const ( // CESU8 is the MIB identifier with IANA name CESU-8. // - // https://www.unicode.org/reports/tr26 + // http://www.unicode.org/unicode/reports/tr26 CESU8 MIB = 1016 // UTF32 is the MIB identifier with IANA name UTF-32. // - // https://www.unicode.org/reports/tr19/ + // http://www.unicode.org/unicode/reports/tr19/ UTF32 MIB = 1017 // UTF32BE is the MIB identifier with IANA name UTF-32BE. // - // https://www.unicode.org/reports/tr19/ + // http://www.unicode.org/unicode/reports/tr19/ UTF32BE MIB = 1018 // UTF32LE is the MIB identifier with IANA name UTF-32LE. // - // https://www.unicode.org/reports/tr19/ + // http://www.unicode.org/unicode/reports/tr19/ UTF32LE MIB = 1019 // BOCU1 is the MIB identifier with IANA name BOCU-1. // - // https://www.unicode.org/notes/tn6/ + // http://www.unicode.org/notes/tn6/ BOCU1 MIB = 1020 // Windows30Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.0-Latin-1. @@ -1459,152 +1461,152 @@ const ( // IBM00858 is the MIB identifier with IANA name IBM00858. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM00858 + // IBM See http://www.iana.org/assignments/charset-reg/IBM00858 IBM00858 MIB = 2089 // IBM00924 is the MIB identifier with IANA name IBM00924. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM00924 + // IBM See http://www.iana.org/assignments/charset-reg/IBM00924 IBM00924 MIB = 2090 // IBM01140 is the MIB identifier with IANA name IBM01140. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01140 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01140 IBM01140 MIB = 2091 // IBM01141 is the MIB identifier with IANA name IBM01141. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01141 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01141 IBM01141 MIB = 2092 // IBM01142 is the MIB identifier with IANA name IBM01142. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01142 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01142 IBM01142 MIB = 2093 // IBM01143 is the MIB identifier with IANA name IBM01143. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01143 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01143 IBM01143 MIB = 2094 // IBM01144 is the MIB identifier with IANA name IBM01144. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01144 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01144 IBM01144 MIB = 2095 // IBM01145 is the MIB identifier with IANA name IBM01145. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01145 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01145 IBM01145 MIB = 2096 // IBM01146 is the MIB identifier with IANA name IBM01146. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01146 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01146 IBM01146 MIB = 2097 // IBM01147 is the MIB identifier with IANA name IBM01147. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01147 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01147 IBM01147 MIB = 2098 // IBM01148 is the MIB identifier with IANA name IBM01148. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01148 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01148 IBM01148 MIB = 2099 // IBM01149 is the MIB identifier with IANA name IBM01149. // - // IBM See https://www.iana.org/assignments/charset-reg/IBM01149 + // IBM See http://www.iana.org/assignments/charset-reg/IBM01149 IBM01149 MIB = 2100 // Big5HKSCS is the MIB identifier with IANA name Big5-HKSCS. // - // See https://www.iana.org/assignments/charset-reg/Big5-HKSCS + // See http://www.iana.org/assignments/charset-reg/Big5-HKSCS Big5HKSCS MIB = 2101 // IBM1047 is the MIB identifier with IANA name IBM1047. // - // IBM1047 (EBCDIC Latin 1/Open Systems) https://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf + // IBM1047 (EBCDIC Latin 1/Open Systems) http://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf IBM1047 MIB = 2102 // PTCP154 is the MIB identifier with IANA name PTCP154. // - // See https://www.iana.org/assignments/charset-reg/PTCP154 + // See http://www.iana.org/assignments/charset-reg/PTCP154 PTCP154 MIB = 2103 // Amiga1251 is the MIB identifier with IANA name Amiga-1251. // - // See https://www.amiga.ultranet.ru/Amiga-1251.html + // See http://www.amiga.ultranet.ru/Amiga-1251.html Amiga1251 MIB = 2104 // KOI7switched is the MIB identifier with IANA name KOI7-switched. // - // See https://www.iana.org/assignments/charset-reg/KOI7-switched + // See http://www.iana.org/assignments/charset-reg/KOI7-switched KOI7switched MIB = 2105 // BRF is the MIB identifier with IANA name BRF. // - // See https://www.iana.org/assignments/charset-reg/BRF + // See http://www.iana.org/assignments/charset-reg/BRF BRF MIB = 2106 // TSCII is the MIB identifier with IANA name TSCII. // - // See https://www.iana.org/assignments/charset-reg/TSCII + // See http://www.iana.org/assignments/charset-reg/TSCII TSCII MIB = 2107 // CP51932 is the MIB identifier with IANA name CP51932. // - // See https://www.iana.org/assignments/charset-reg/CP51932 + // See http://www.iana.org/assignments/charset-reg/CP51932 CP51932 MIB = 2108 // Windows874 is the MIB identifier with IANA name windows-874. // - // See https://www.iana.org/assignments/charset-reg/windows-874 + // See http://www.iana.org/assignments/charset-reg/windows-874 Windows874 MIB = 2109 // Windows1250 is the MIB identifier with IANA name windows-1250. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1250 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1250 Windows1250 MIB = 2250 // Windows1251 is the MIB identifier with IANA name windows-1251. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1251 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1251 Windows1251 MIB = 2251 // Windows1252 is the MIB identifier with IANA name windows-1252. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1252 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1252 Windows1252 MIB = 2252 // Windows1253 is the MIB identifier with IANA name windows-1253. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1253 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1253 Windows1253 MIB = 2253 // Windows1254 is the MIB identifier with IANA name windows-1254. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1254 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1254 Windows1254 MIB = 2254 // Windows1255 is the MIB identifier with IANA name windows-1255. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1255 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1255 Windows1255 MIB = 2255 // Windows1256 is the MIB identifier with IANA name windows-1256. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1256 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1256 Windows1256 MIB = 2256 // Windows1257 is the MIB identifier with IANA name windows-1257. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1257 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1257 Windows1257 MIB = 2257 // Windows1258 is the MIB identifier with IANA name windows-1258. // - // Microsoft https://www.iana.org/assignments/charset-reg/windows-1258 + // Microsoft http://www.iana.org/assignments/charset-reg/windows-1258 Windows1258 MIB = 2258 // TIS620 is the MIB identifier with IANA name TIS-620. @@ -1614,6 +1616,6 @@ const ( // CP50220 is the MIB identifier with IANA name CP50220. // - // See https://www.iana.org/assignments/charset-reg/CP50220 + // See http://www.iana.org/assignments/charset-reg/CP50220 CP50220 MIB = 2260 ) diff --git a/vendor/golang.org/x/text/encoding/japanese/maketables.go b/vendor/golang.org/x/text/encoding/japanese/maketables.go index 023957a6..d6c10deb 100644 --- a/vendor/golang.org/x/text/encoding/japanese/maketables.go +++ b/vendor/golang.org/x/text/encoding/japanese/maketables.go @@ -10,8 +10,8 @@ package main // go run maketables.go | gofmt > tables.go // TODO: Emoji extensions? -// https://www.unicode.org/faq/emoji_dingbats.html -// https://www.unicode.org/Public/UNIDATA/EmojiSources.txt +// http://www.unicode.org/faq/emoji_dingbats.html +// http://www.unicode.org/Public/UNIDATA/EmojiSources.txt import ( "bufio" diff --git a/vendor/golang.org/x/text/encoding/unicode/unicode.go b/vendor/golang.org/x/text/encoding/unicode/unicode.go index 4850ff36..579cadfb 100644 --- a/vendor/golang.org/x/text/encoding/unicode/unicode.go +++ b/vendor/golang.org/x/text/encoding/unicode/unicode.go @@ -145,7 +145,7 @@ func (utf8Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err e // and consumed in a greater context that implies a certain endianness, use // IgnoreBOM. Otherwise, use ExpectBOM and always produce and consume a BOM. // -// In the language of https://www.unicode.org/faq/utf_bom.html#bom10, IgnoreBOM +// In the language of http://www.unicode.org/faq/utf_bom.html#bom10, IgnoreBOM // corresponds to "Where the precise type of the data stream is known... the // BOM should not be used" and ExpectBOM corresponds to "A particular // protocol... may require use of the BOM". diff --git a/vendor/golang.org/x/text/internal/gen/code.go b/vendor/golang.org/x/text/internal/gen/code.go index 75435c9b..0389509f 100644 --- a/vendor/golang.org/x/text/internal/gen/code.go +++ b/vendor/golang.org/x/text/internal/gen/code.go @@ -48,7 +48,7 @@ func NewCodeWriter() *CodeWriter { } // WriteGoFile appends the buffer with the total size of all created structures -// and writes it as a Go file to the given file with the given package name. +// and writes it as a Go file to the the given file with the given package name. func (w *CodeWriter) WriteGoFile(filename, pkg string) { f, err := os.Create(filename) if err != nil { @@ -61,14 +61,12 @@ func (w *CodeWriter) WriteGoFile(filename, pkg string) { } // WriteVersionedGoFile appends the buffer with the total size of all created -// structures and writes it as a Go file to the given file with the given +// structures and writes it as a Go file to the the given file with the given // package name and build tags for the current Unicode version, func (w *CodeWriter) WriteVersionedGoFile(filename, pkg string) { tags := buildTags() if tags != "" { - pattern := fileToPattern(filename) - updateBuildTags(pattern) - filename = fmt.Sprintf(pattern, UnicodeVersion()) + filename = insertVersion(filename, UnicodeVersion()) } f, err := os.Create(filename) if err != nil { @@ -81,12 +79,10 @@ func (w *CodeWriter) WriteVersionedGoFile(filename, pkg string) { } // WriteGo appends the buffer with the total size of all created structures and -// writes it as a Go file to the given writer with the given package name. +// writes it as a Go file to the the given writer with the given package name. func (w *CodeWriter) WriteGo(out io.Writer, pkg, tags string) (n int, err error) { sz := w.Size - if sz > 0 { - w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32()) - } + w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32()) defer w.buf.Reset() return WriteGo(out, pkg, tags, w.buf.Bytes()) } @@ -203,6 +199,7 @@ func (w *CodeWriter) writeValue(v reflect.Value) { // WriteString writes a string literal. func (w *CodeWriter) WriteString(s string) { + s = strings.Replace(s, `\`, `\\`, -1) io.WriteString(w.Hash, s) // content hash w.Size += len(s) @@ -253,9 +250,6 @@ func (w *CodeWriter) WriteString(s string) { out = fmt.Sprintf("\\U%08x", r) } chars = len(out) - } else if r == '\\' { - out = "\\" + string(r) - chars = 2 } if n -= chars; n < 0 { nLines++ diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go index cc6510fd..4c3f7606 100644 --- a/vendor/golang.org/x/text/internal/gen/gen.go +++ b/vendor/golang.org/x/text/internal/gen/gen.go @@ -7,7 +7,7 @@ // // This package defines command line flags that are common to most generation // tools. The flags allow for specifying specific Unicode and CLDR versions -// in the public Unicode data repository (https://www.unicode.org/Public). +// in the public Unicode data repository (http://www.unicode.org/Public). // // A local Unicode data mirror can be set through the flag -local or the // environment variable UNICODE_DIR. The former takes precedence. The local @@ -31,7 +31,6 @@ import ( "os" "path" "path/filepath" - "regexp" "strings" "sync" "unicode" @@ -41,7 +40,7 @@ import ( var ( url = flag.String("url", - "https://www.unicode.org/Public", + "http://www.unicode.org/Public", "URL of Unicode database directory") iana = flag.String("iana", "http://www.iana.org", @@ -84,21 +83,25 @@ func CLDRVersion() string { } var tags = []struct{ version, buildTags string }{ - {"9.0.0", "!go1.10"}, - {"10.0.0", "go1.10,!go1.13"}, - {"11.0.0", "go1.13"}, + {"10.0.0", "go1.10"}, + {"", "!go1.10"}, } // buildTags reports the build tags used for the current Unicode version. func buildTags() string { v := UnicodeVersion() - for _, e := range tags { - if e.version == v { - return e.buildTags + for _, x := range tags { + // We should do a numeric comparison, but including the collate package + // would create an import cycle. We approximate it by assuming that + // longer version strings are later. + if len(x.version) <= len(v) { + return x.buildTags + } + if len(x.version) == len(v) && x.version <= v { + return x.buildTags } } - log.Fatalf("Unknown build tags for Unicode version %q.", v) - return "" + return tags[0].buildTags } // IsLocal reports whether data files are available locally. @@ -266,29 +269,12 @@ func WriteGoFile(filename, pkg string, b []byte) { } } -func fileToPattern(filename string) string { +func insertVersion(filename, version string) string { suffix := ".go" if strings.HasSuffix(filename, "_test.go") { suffix = "_test.go" } - prefix := filename[:len(filename)-len(suffix)] - return fmt.Sprint(prefix, "%s", suffix) -} - -func updateBuildTags(pattern string) { - for _, t := range tags { - oldFile := fmt.Sprintf(pattern, t.version) - b, err := ioutil.ReadFile(oldFile) - if err != nil { - continue - } - build := fmt.Sprintf("// +build %s", t.buildTags) - b = regexp.MustCompile(`// \+build .*`).ReplaceAll(b, []byte(build)) - err = ioutil.WriteFile(oldFile, b, 0644) - if err != nil { - log.Fatal(err) - } - } + return fmt.Sprint(filename[:len(filename)-len(suffix)], version, suffix) } // WriteVersionedGoFile prepends a standard file comment, adds build tags to @@ -296,16 +282,16 @@ func updateBuildTags(pattern string) { // the given bytes, applies gofmt, and writes them to a file with the given // name. It will call log.Fatal if there are any errors. func WriteVersionedGoFile(filename, pkg string, b []byte) { - pattern := fileToPattern(filename) - updateBuildTags(pattern) - filename = fmt.Sprintf(pattern, UnicodeVersion()) - + tags := buildTags() + if tags != "" { + filename = insertVersion(filename, UnicodeVersion()) + } w, err := os.Create(filename) if err != nil { log.Fatalf("Could not create file %s: %v", filename, err) } defer w.Close() - if _, err = WriteGo(w, pkg, buildTags(), b); err != nil { + if _, err = WriteGo(w, pkg, tags, b); err != nil { log.Fatalf("Error writing file %s: %v", filename, err) } } diff --git a/vendor/golang.org/x/text/internal/language/compact.go b/vendor/golang.org/x/text/internal/language/compact.go deleted file mode 100644 index 46a00150..00000000 --- a/vendor/golang.org/x/text/internal/language/compact.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -// CompactCoreInfo is a compact integer with the three core tags encoded. -type CompactCoreInfo uint32 - -// GetCompactCore generates a uint32 value that is guaranteed to be unique for -// different language, region, and script values. -func GetCompactCore(t Tag) (cci CompactCoreInfo, ok bool) { - if t.LangID > langNoIndexOffset { - return 0, false - } - cci |= CompactCoreInfo(t.LangID) << (8 + 12) - cci |= CompactCoreInfo(t.ScriptID) << 12 - cci |= CompactCoreInfo(t.RegionID) - return cci, true -} - -// Tag generates a tag from c. -func (c CompactCoreInfo) Tag() Tag { - return Tag{ - LangID: Language(c >> 20), - RegionID: Region(c & 0x3ff), - ScriptID: Script(c>>12) & 0xff, - } -} diff --git a/vendor/golang.org/x/text/internal/language/compact/compact.go b/vendor/golang.org/x/text/internal/language/compact/compact.go deleted file mode 100644 index 1b36935e..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/compact.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package compact defines a compact representation of language tags. -// -// Common language tags (at least all for which locale information is defined -// in CLDR) are assigned a unique index. Each Tag is associated with such an -// ID for selecting language-related resources (such as translations) as well -// as one for selecting regional defaults (currency, number formatting, etc.) -// -// It may want to export this functionality at some point, but at this point -// this is only available for use within x/text. -package compact // import "golang.org/x/text/internal/language/compact" - -import ( - "sort" - "strings" - - "golang.org/x/text/internal/language" -) - -// ID is an integer identifying a single tag. -type ID uint16 - -func getCoreIndex(t language.Tag) (id ID, ok bool) { - cci, ok := language.GetCompactCore(t) - if !ok { - return 0, false - } - i := sort.Search(len(coreTags), func(i int) bool { - return cci <= coreTags[i] - }) - if i == len(coreTags) || coreTags[i] != cci { - return 0, false - } - return ID(i), true -} - -// Parent returns the ID of the parent or the root ID if id is already the root. -func (id ID) Parent() ID { - return parents[id] -} - -// Tag converts id to an internal language Tag. -func (id ID) Tag() language.Tag { - if int(id) >= len(coreTags) { - return specialTags[int(id)-len(coreTags)] - } - return coreTags[id].Tag() -} - -var specialTags []language.Tag - -func init() { - tags := strings.Split(specialTagsStr, " ") - specialTags = make([]language.Tag, len(tags)) - for i, t := range tags { - specialTags[i] = language.MustParse(t) - } -} diff --git a/vendor/golang.org/x/text/internal/language/compact/gen.go b/vendor/golang.org/x/text/internal/language/compact/gen.go deleted file mode 100644 index 0c36a052..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/gen.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2013 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 ignore - -// Language tag table generator. -// Data read from the web. - -package main - -import ( - "flag" - "fmt" - "log" - - "golang.org/x/text/internal/gen" - "golang.org/x/text/unicode/cldr" -) - -var ( - test = flag.Bool("test", - false, - "test existing tables; can be used to compare web data with package data.") - outputFile = flag.String("output", - "tables.go", - "output file for generated tables") -) - -func main() { - gen.Init() - - w := gen.NewCodeWriter() - defer w.WriteGoFile("tables.go", "compact") - - fmt.Fprintln(w, `import "golang.org/x/text/internal/language"`) - - b := newBuilder(w) - gen.WriteCLDRVersion(w) - - b.writeCompactIndex() -} - -type builder struct { - w *gen.CodeWriter - data *cldr.CLDR - supp *cldr.SupplementalData -} - -func newBuilder(w *gen.CodeWriter) *builder { - r := gen.OpenCLDRCoreZip() - defer r.Close() - d := &cldr.Decoder{} - data, err := d.DecodeZip(r) - if err != nil { - log.Fatal(err) - } - b := builder{ - w: w, - data: data, - supp: data.Supplemental(), - } - return &b -} diff --git a/vendor/golang.org/x/text/internal/language/compact/gen_index.go b/vendor/golang.org/x/text/internal/language/compact/gen_index.go deleted file mode 100644 index 136cefaf..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/gen_index.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2015 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 ignore - -package main - -// This file generates derivative tables based on the language package itself. - -import ( - "fmt" - "log" - "sort" - "strings" - - "golang.org/x/text/internal/language" -) - -// Compact indices: -// Note -va-X variants only apply to localization variants. -// BCP variants only ever apply to language. -// The only ambiguity between tags is with regions. - -func (b *builder) writeCompactIndex() { - // Collect all language tags for which we have any data in CLDR. - m := map[language.Tag]bool{} - for _, lang := range b.data.Locales() { - // We include all locales unconditionally to be consistent with en_US. - // We want en_US, even though it has no data associated with it. - - // TODO: put any of the languages for which no data exists at the end - // of the index. This allows all components based on ICU to use that - // as the cutoff point. - // if x := data.RawLDML(lang); false || - // x.LocaleDisplayNames != nil || - // x.Characters != nil || - // x.Delimiters != nil || - // x.Measurement != nil || - // x.Dates != nil || - // x.Numbers != nil || - // x.Units != nil || - // x.ListPatterns != nil || - // x.Collations != nil || - // x.Segmentations != nil || - // x.Rbnf != nil || - // x.Annotations != nil || - // x.Metadata != nil { - - // TODO: support POSIX natively, albeit non-standard. - tag := language.Make(strings.Replace(lang, "_POSIX", "-u-va-posix", 1)) - m[tag] = true - // } - } - - // TODO: plural rules are also defined for the deprecated tags: - // iw mo sh tl - // Consider removing these as compact tags. - - // Include locales for plural rules, which uses a different structure. - for _, plurals := range b.supp.Plurals { - for _, rules := range plurals.PluralRules { - for _, lang := range strings.Split(rules.Locales, " ") { - m[language.Make(lang)] = true - } - } - } - - var coreTags []language.CompactCoreInfo - var special []string - - for t := range m { - if x := t.Extensions(); len(x) != 0 && fmt.Sprint(x) != "[u-va-posix]" { - log.Fatalf("Unexpected extension %v in %v", x, t) - } - if len(t.Variants()) == 0 && len(t.Extensions()) == 0 { - cci, ok := language.GetCompactCore(t) - if !ok { - log.Fatalf("Locale for non-basic language %q", t) - } - coreTags = append(coreTags, cci) - } else { - special = append(special, t.String()) - } - } - - w := b.w - - sort.Slice(coreTags, func(i, j int) bool { return coreTags[i] < coreTags[j] }) - sort.Strings(special) - - w.WriteComment(` - NumCompactTags is the number of common tags. The maximum tag is - NumCompactTags-1.`) - w.WriteConst("NumCompactTags", len(m)) - - fmt.Fprintln(w, "const (") - for i, t := range coreTags { - fmt.Fprintf(w, "%s ID = %d\n", ident(t.Tag().String()), i) - } - for i, t := range special { - fmt.Fprintf(w, "%s ID = %d\n", ident(t), i+len(coreTags)) - } - fmt.Fprintln(w, ")") - - w.WriteVar("coreTags", coreTags) - - w.WriteConst("specialTagsStr", strings.Join(special, " ")) -} - -func ident(s string) string { - return strings.Replace(s, "-", "", -1) + "Index" -} diff --git a/vendor/golang.org/x/text/internal/language/compact/gen_parents.go b/vendor/golang.org/x/text/internal/language/compact/gen_parents.go deleted file mode 100644 index 9543d583..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/gen_parents.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -package main - -import ( - "log" - - "golang.org/x/text/internal/gen" - "golang.org/x/text/internal/language" - "golang.org/x/text/internal/language/compact" - "golang.org/x/text/unicode/cldr" -) - -func main() { - r := gen.OpenCLDRCoreZip() - defer r.Close() - - d := &cldr.Decoder{} - data, err := d.DecodeZip(r) - if err != nil { - log.Fatalf("DecodeZip: %v", err) - } - - w := gen.NewCodeWriter() - defer w.WriteGoFile("parents.go", "compact") - - // Create parents table. - type ID uint16 - parents := make([]ID, compact.NumCompactTags) - for _, loc := range data.Locales() { - tag := language.MustParse(loc) - index, ok := compact.FromTag(tag) - if !ok { - continue - } - parentIndex := compact.ID(0) // und - for p := tag.Parent(); p != language.Und; p = p.Parent() { - if x, ok := compact.FromTag(p); ok { - parentIndex = x - break - } - } - parents[index] = ID(parentIndex) - } - - w.WriteComment(` - parents maps a compact index of a tag to the compact index of the parent of - this tag.`) - w.WriteVar("parents", parents) -} diff --git a/vendor/golang.org/x/text/internal/language/compact/language.go b/vendor/golang.org/x/text/internal/language/compact/language.go deleted file mode 100644 index 83816a72..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/language.go +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go gen_index.go -output tables.go -//go:generate go run gen_parents.go - -package compact - -// TODO: Remove above NOTE after: -// - verifying that tables are dropped correctly (most notably matcher tables). - -import ( - "strings" - - "golang.org/x/text/internal/language" -) - -// Tag represents a BCP 47 language tag. It is used to specify an instance of a -// specific language or locale. All language tag values are guaranteed to be -// well-formed. -type Tag struct { - // NOTE: exported tags will become part of the public API. - language ID - locale ID - full fullTag // always a language.Tag for now. -} - -const _und = 0 - -type fullTag interface { - IsRoot() bool - Parent() language.Tag -} - -// Make a compact Tag from a fully specified internal language Tag. -func Make(t language.Tag) (tag Tag) { - if region := t.TypeForKey("rg"); len(region) == 6 && region[2:] == "zzzz" { - if r, err := language.ParseRegion(region[:2]); err == nil { - tFull := t - t, _ = t.SetTypeForKey("rg", "") - // TODO: should we not consider "va" for the language tag? - var exact1, exact2 bool - tag.language, exact1 = FromTag(t) - t.RegionID = r - tag.locale, exact2 = FromTag(t) - if !exact1 || !exact2 { - tag.full = tFull - } - return tag - } - } - lang, ok := FromTag(t) - tag.language = lang - tag.locale = lang - if !ok { - tag.full = t - } - return tag -} - -// Tag returns an internal language Tag version of this tag. -func (t Tag) Tag() language.Tag { - if t.full != nil { - return t.full.(language.Tag) - } - tag := t.language.Tag() - if t.language != t.locale { - loc := t.locale.Tag() - tag, _ = tag.SetTypeForKey("rg", strings.ToLower(loc.RegionID.String())+"zzzz") - } - return tag -} - -// IsCompact reports whether this tag is fully defined in terms of ID. -func (t *Tag) IsCompact() bool { - return t.full == nil -} - -// MayHaveVariants reports whether a tag may have variants. If it returns false -// it is guaranteed the tag does not have variants. -func (t Tag) MayHaveVariants() bool { - return t.full != nil || int(t.language) >= len(coreTags) -} - -// MayHaveExtensions reports whether a tag may have extensions. If it returns -// false it is guaranteed the tag does not have them. -func (t Tag) MayHaveExtensions() bool { - return t.full != nil || - int(t.language) >= len(coreTags) || - t.language != t.locale -} - -// IsRoot returns true if t is equal to language "und". -func (t Tag) IsRoot() bool { - if t.full != nil { - return t.full.IsRoot() - } - return t.language == _und -} - -// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a -// specific language are substituted with fields from the parent language. -// The parent for a language may change for newer versions of CLDR. -func (t Tag) Parent() Tag { - if t.full != nil { - return Make(t.full.Parent()) - } - if t.language != t.locale { - // Simulate stripping -u-rg-xxxxxx - return Tag{language: t.language, locale: t.language} - } - // TODO: use parent lookup table once cycle from internal package is - // removed. Probably by internalizing the table and declaring this fast - // enough. - // lang := compactID(internal.Parent(uint16(t.language))) - lang, _ := FromTag(t.language.Tag().Parent()) - return Tag{language: lang, locale: lang} -} - -// returns token t and the rest of the string. -func nextToken(s string) (t, tail string) { - p := strings.Index(s[1:], "-") - if p == -1 { - return s[1:], "" - } - p++ - return s[1:p], s[p:] -} - -// LanguageID returns an index, where 0 <= index < NumCompactTags, for tags -// for which data exists in the text repository.The index will change over time -// and should not be stored in persistent storage. If t does not match a compact -// index, exact will be false and the compact index will be returned for the -// first match after repeatedly taking the Parent of t. -func LanguageID(t Tag) (id ID, exact bool) { - return t.language, t.full == nil -} - -// RegionalID returns the ID for the regional variant of this tag. This index is -// used to indicate region-specific overrides, such as default currency, default -// calendar and week data, default time cycle, and default measurement system -// and unit preferences. -// -// For instance, the tag en-GB-u-rg-uszzzz specifies British English with US -// settings for currency, number formatting, etc. The CompactIndex for this tag -// will be that for en-GB, while the RegionalID will be the one corresponding to -// en-US. -func RegionalID(t Tag) (id ID, exact bool) { - return t.locale, t.full == nil -} - -// LanguageTag returns t stripped of regional variant indicators. -// -// At the moment this means it is stripped of a regional and variant subtag "rg" -// and "va" in the "u" extension. -func (t Tag) LanguageTag() Tag { - if t.full == nil { - return Tag{language: t.language, locale: t.language} - } - tt := t.Tag() - tt.SetTypeForKey("rg", "") - tt.SetTypeForKey("va", "") - return Make(tt) -} - -// RegionalTag returns the regional variant of the tag. -// -// At the moment this means that the region is set from the regional subtag -// "rg" in the "u" extension. -func (t Tag) RegionalTag() Tag { - rt := Tag{language: t.locale, locale: t.locale} - if t.full == nil { - return rt - } - b := language.Builder{} - tag := t.Tag() - // tag, _ = tag.SetTypeForKey("rg", "") - b.SetTag(t.locale.Tag()) - if v := tag.Variants(); v != "" { - for _, v := range strings.Split(v, "-") { - b.AddVariant(v) - } - } - for _, e := range tag.Extensions() { - b.AddExt(e) - } - return t -} - -// FromTag reports closest matching ID for an internal language Tag. -func FromTag(t language.Tag) (id ID, exact bool) { - // TODO: perhaps give more frequent tags a lower index. - // TODO: we could make the indexes stable. This will excluded some - // possibilities for optimization, so don't do this quite yet. - exact = true - - b, s, r := t.Raw() - if t.HasString() { - if t.IsPrivateUse() { - // We have no entries for user-defined tags. - return 0, false - } - hasExtra := false - if t.HasVariants() { - if t.HasExtensions() { - build := language.Builder{} - build.SetTag(language.Tag{LangID: b, ScriptID: s, RegionID: r}) - build.AddVariant(t.Variants()) - exact = false - t = build.Make() - } - hasExtra = true - } else if _, ok := t.Extension('u'); ok { - // TODO: va may mean something else. Consider not considering it. - // Strip all but the 'va' entry. - old := t - variant := t.TypeForKey("va") - t = language.Tag{LangID: b, ScriptID: s, RegionID: r} - if variant != "" { - t, _ = t.SetTypeForKey("va", variant) - hasExtra = true - } - exact = old == t - } else { - exact = false - } - if hasExtra { - // We have some variants. - for i, s := range specialTags { - if s == t { - return ID(i + len(coreTags)), exact - } - } - exact = false - } - } - if x, ok := getCoreIndex(t); ok { - return x, exact - } - exact = false - if r != 0 && s == 0 { - // Deal with cases where an extra script is inserted for the region. - t, _ := t.Maximize() - if x, ok := getCoreIndex(t); ok { - return x, exact - } - } - for t = t.Parent(); t != root; t = t.Parent() { - // No variants specified: just compare core components. - // The key has the form lllssrrr, where l, s, and r are nibbles for - // respectively the langID, scriptID, and regionID. - if x, ok := getCoreIndex(t); ok { - return x, exact - } - } - return 0, exact -} - -var root = language.Tag{} diff --git a/vendor/golang.org/x/text/internal/language/compact/parents.go b/vendor/golang.org/x/text/internal/language/compact/parents.go deleted file mode 100644 index 8d810723..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/parents.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package compact - -// parents maps a compact index of a tag to the compact index of the parent of -// this tag. -var parents = []ID{ // 775 elements - // Entry 0 - 3F - 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0004, 0x0000, 0x0006, - 0x0000, 0x0008, 0x0000, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, - 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, - 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, - 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x0000, - 0x0000, 0x0028, 0x0000, 0x002a, 0x0000, 0x002c, 0x0000, 0x0000, - 0x002f, 0x002e, 0x002e, 0x0000, 0x0033, 0x0000, 0x0035, 0x0000, - 0x0037, 0x0000, 0x0039, 0x0000, 0x003b, 0x0000, 0x0000, 0x003e, - // Entry 40 - 7F - 0x0000, 0x0040, 0x0040, 0x0000, 0x0043, 0x0043, 0x0000, 0x0046, - 0x0000, 0x0048, 0x0000, 0x0000, 0x004b, 0x004a, 0x004a, 0x0000, - 0x004f, 0x004f, 0x004f, 0x004f, 0x0000, 0x0054, 0x0054, 0x0000, - 0x0057, 0x0000, 0x0059, 0x0000, 0x005b, 0x0000, 0x005d, 0x005d, - 0x0000, 0x0060, 0x0000, 0x0062, 0x0000, 0x0064, 0x0000, 0x0066, - 0x0066, 0x0000, 0x0069, 0x0000, 0x006b, 0x006b, 0x006b, 0x006b, - 0x006b, 0x006b, 0x006b, 0x0000, 0x0073, 0x0000, 0x0075, 0x0000, - 0x0077, 0x0000, 0x0000, 0x007a, 0x0000, 0x007c, 0x0000, 0x007e, - // Entry 80 - BF - 0x0000, 0x0080, 0x0080, 0x0000, 0x0083, 0x0083, 0x0000, 0x0086, - 0x0087, 0x0087, 0x0087, 0x0086, 0x0088, 0x0087, 0x0087, 0x0087, - 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, - 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087, 0x0088, 0x0087, - 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0087, 0x0086, - // Entry C0 - FF - 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0088, 0x0087, - 0x0087, 0x0088, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, - 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0086, 0x0086, 0x0087, - 0x0087, 0x0086, 0x0087, 0x0087, 0x0087, 0x0087, 0x0087, 0x0000, - 0x00ef, 0x0000, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, - 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f1, 0x00f1, - // Entry 100 - 13F - 0x00f2, 0x00f2, 0x00f1, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f1, - 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x00f2, 0x0000, 0x010e, - 0x0000, 0x0110, 0x0000, 0x0112, 0x0000, 0x0114, 0x0114, 0x0000, - 0x0117, 0x0117, 0x0117, 0x0117, 0x0000, 0x011c, 0x0000, 0x011e, - 0x0000, 0x0120, 0x0120, 0x0000, 0x0123, 0x0123, 0x0123, 0x0123, - 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, - 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, - 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, - // Entry 140 - 17F - 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, - 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, 0x0123, - 0x0123, 0x0123, 0x0000, 0x0152, 0x0000, 0x0154, 0x0000, 0x0156, - 0x0000, 0x0158, 0x0000, 0x015a, 0x0000, 0x015c, 0x015c, 0x015c, - 0x0000, 0x0160, 0x0000, 0x0000, 0x0163, 0x0000, 0x0165, 0x0000, - 0x0167, 0x0167, 0x0167, 0x0000, 0x016b, 0x0000, 0x016d, 0x0000, - 0x016f, 0x0000, 0x0171, 0x0171, 0x0000, 0x0174, 0x0000, 0x0176, - 0x0000, 0x0178, 0x0000, 0x017a, 0x0000, 0x017c, 0x0000, 0x017e, - // Entry 180 - 1BF - 0x0000, 0x0000, 0x0000, 0x0182, 0x0000, 0x0184, 0x0184, 0x0184, - 0x0184, 0x0000, 0x0000, 0x0000, 0x018b, 0x0000, 0x0000, 0x018e, - 0x0000, 0x0000, 0x0191, 0x0000, 0x0000, 0x0000, 0x0195, 0x0000, - 0x0197, 0x0000, 0x0000, 0x019a, 0x0000, 0x0000, 0x019d, 0x0000, - 0x019f, 0x0000, 0x01a1, 0x0000, 0x01a3, 0x0000, 0x01a5, 0x0000, - 0x01a7, 0x0000, 0x01a9, 0x0000, 0x01ab, 0x0000, 0x01ad, 0x0000, - 0x01af, 0x0000, 0x01b1, 0x01b1, 0x0000, 0x01b4, 0x0000, 0x01b6, - 0x0000, 0x01b8, 0x0000, 0x01ba, 0x0000, 0x01bc, 0x0000, 0x0000, - // Entry 1C0 - 1FF - 0x01bf, 0x0000, 0x01c1, 0x0000, 0x01c3, 0x0000, 0x01c5, 0x0000, - 0x01c7, 0x0000, 0x01c9, 0x0000, 0x01cb, 0x01cb, 0x01cb, 0x01cb, - 0x0000, 0x01d0, 0x0000, 0x01d2, 0x01d2, 0x0000, 0x01d5, 0x0000, - 0x01d7, 0x0000, 0x01d9, 0x0000, 0x01db, 0x0000, 0x01dd, 0x0000, - 0x01df, 0x01df, 0x0000, 0x01e2, 0x0000, 0x01e4, 0x0000, 0x01e6, - 0x0000, 0x01e8, 0x0000, 0x01ea, 0x0000, 0x01ec, 0x0000, 0x01ee, - 0x0000, 0x01f0, 0x0000, 0x0000, 0x01f3, 0x0000, 0x01f5, 0x01f5, - 0x01f5, 0x0000, 0x01f9, 0x0000, 0x01fb, 0x0000, 0x01fd, 0x0000, - // Entry 200 - 23F - 0x01ff, 0x0000, 0x0000, 0x0202, 0x0000, 0x0204, 0x0204, 0x0000, - 0x0207, 0x0000, 0x0209, 0x0209, 0x0000, 0x020c, 0x020c, 0x0000, - 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x020f, 0x0000, - 0x0217, 0x0000, 0x0219, 0x0000, 0x021b, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0221, 0x0000, 0x0000, 0x0224, 0x0000, 0x0226, - 0x0226, 0x0000, 0x0229, 0x0000, 0x022b, 0x022b, 0x0000, 0x0000, - 0x022f, 0x022e, 0x022e, 0x0000, 0x0000, 0x0234, 0x0000, 0x0236, - 0x0000, 0x0238, 0x0000, 0x0244, 0x023a, 0x0244, 0x0244, 0x0244, - // Entry 240 - 27F - 0x0244, 0x0244, 0x0244, 0x0244, 0x023a, 0x0244, 0x0244, 0x0000, - 0x0247, 0x0247, 0x0247, 0x0000, 0x024b, 0x0000, 0x024d, 0x0000, - 0x024f, 0x024f, 0x0000, 0x0252, 0x0000, 0x0254, 0x0254, 0x0254, - 0x0254, 0x0254, 0x0254, 0x0000, 0x025b, 0x0000, 0x025d, 0x0000, - 0x025f, 0x0000, 0x0261, 0x0000, 0x0263, 0x0000, 0x0265, 0x0000, - 0x0000, 0x0268, 0x0268, 0x0268, 0x0000, 0x026c, 0x0000, 0x026e, - 0x0000, 0x0270, 0x0000, 0x0000, 0x0000, 0x0274, 0x0273, 0x0273, - 0x0000, 0x0278, 0x0000, 0x027a, 0x0000, 0x027c, 0x0000, 0x0000, - // Entry 280 - 2BF - 0x0000, 0x0000, 0x0281, 0x0000, 0x0000, 0x0284, 0x0000, 0x0286, - 0x0286, 0x0286, 0x0286, 0x0000, 0x028b, 0x028b, 0x028b, 0x0000, - 0x028f, 0x028f, 0x028f, 0x028f, 0x028f, 0x0000, 0x0295, 0x0295, - 0x0295, 0x0295, 0x0000, 0x0000, 0x0000, 0x0000, 0x029d, 0x029d, - 0x029d, 0x0000, 0x02a1, 0x02a1, 0x02a1, 0x02a1, 0x0000, 0x0000, - 0x02a7, 0x02a7, 0x02a7, 0x02a7, 0x0000, 0x02ac, 0x0000, 0x02ae, - 0x02ae, 0x0000, 0x02b1, 0x0000, 0x02b3, 0x0000, 0x02b5, 0x02b5, - 0x0000, 0x0000, 0x02b9, 0x0000, 0x0000, 0x0000, 0x02bd, 0x0000, - // Entry 2C0 - 2FF - 0x02bf, 0x02bf, 0x0000, 0x0000, 0x02c3, 0x0000, 0x02c5, 0x0000, - 0x02c7, 0x0000, 0x02c9, 0x0000, 0x02cb, 0x0000, 0x02cd, 0x02cd, - 0x0000, 0x0000, 0x02d1, 0x0000, 0x02d3, 0x02d0, 0x02d0, 0x0000, - 0x0000, 0x02d8, 0x02d7, 0x02d7, 0x0000, 0x0000, 0x02dd, 0x0000, - 0x02df, 0x0000, 0x02e1, 0x0000, 0x0000, 0x02e4, 0x0000, 0x02e6, - 0x0000, 0x0000, 0x02e9, 0x0000, 0x02eb, 0x0000, 0x02ed, 0x0000, - 0x02ef, 0x02ef, 0x0000, 0x0000, 0x02f3, 0x02f2, 0x02f2, 0x0000, - 0x02f7, 0x0000, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x02f9, 0x0000, - // Entry 300 - 33F - 0x02ff, 0x0300, 0x02ff, 0x0000, 0x0303, 0x0051, 0x00e6, -} // Size: 1574 bytes - -// Total table size 1574 bytes (1KiB); checksum: 895AAF0B diff --git a/vendor/golang.org/x/text/internal/language/compact/tables.go b/vendor/golang.org/x/text/internal/language/compact/tables.go deleted file mode 100644 index 554ca354..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/tables.go +++ /dev/null @@ -1,1015 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package compact - -import "golang.org/x/text/internal/language" - -// CLDRVersion is the CLDR version from which the tables in this package are derived. -const CLDRVersion = "32" - -// NumCompactTags is the number of common tags. The maximum tag is -// NumCompactTags-1. -const NumCompactTags = 775 -const ( - undIndex ID = 0 - afIndex ID = 1 - afNAIndex ID = 2 - afZAIndex ID = 3 - agqIndex ID = 4 - agqCMIndex ID = 5 - akIndex ID = 6 - akGHIndex ID = 7 - amIndex ID = 8 - amETIndex ID = 9 - arIndex ID = 10 - ar001Index ID = 11 - arAEIndex ID = 12 - arBHIndex ID = 13 - arDJIndex ID = 14 - arDZIndex ID = 15 - arEGIndex ID = 16 - arEHIndex ID = 17 - arERIndex ID = 18 - arILIndex ID = 19 - arIQIndex ID = 20 - arJOIndex ID = 21 - arKMIndex ID = 22 - arKWIndex ID = 23 - arLBIndex ID = 24 - arLYIndex ID = 25 - arMAIndex ID = 26 - arMRIndex ID = 27 - arOMIndex ID = 28 - arPSIndex ID = 29 - arQAIndex ID = 30 - arSAIndex ID = 31 - arSDIndex ID = 32 - arSOIndex ID = 33 - arSSIndex ID = 34 - arSYIndex ID = 35 - arTDIndex ID = 36 - arTNIndex ID = 37 - arYEIndex ID = 38 - arsIndex ID = 39 - asIndex ID = 40 - asINIndex ID = 41 - asaIndex ID = 42 - asaTZIndex ID = 43 - astIndex ID = 44 - astESIndex ID = 45 - azIndex ID = 46 - azCyrlIndex ID = 47 - azCyrlAZIndex ID = 48 - azLatnIndex ID = 49 - azLatnAZIndex ID = 50 - basIndex ID = 51 - basCMIndex ID = 52 - beIndex ID = 53 - beBYIndex ID = 54 - bemIndex ID = 55 - bemZMIndex ID = 56 - bezIndex ID = 57 - bezTZIndex ID = 58 - bgIndex ID = 59 - bgBGIndex ID = 60 - bhIndex ID = 61 - bmIndex ID = 62 - bmMLIndex ID = 63 - bnIndex ID = 64 - bnBDIndex ID = 65 - bnINIndex ID = 66 - boIndex ID = 67 - boCNIndex ID = 68 - boINIndex ID = 69 - brIndex ID = 70 - brFRIndex ID = 71 - brxIndex ID = 72 - brxINIndex ID = 73 - bsIndex ID = 74 - bsCyrlIndex ID = 75 - bsCyrlBAIndex ID = 76 - bsLatnIndex ID = 77 - bsLatnBAIndex ID = 78 - caIndex ID = 79 - caADIndex ID = 80 - caESIndex ID = 81 - caFRIndex ID = 82 - caITIndex ID = 83 - ccpIndex ID = 84 - ccpBDIndex ID = 85 - ccpINIndex ID = 86 - ceIndex ID = 87 - ceRUIndex ID = 88 - cggIndex ID = 89 - cggUGIndex ID = 90 - chrIndex ID = 91 - chrUSIndex ID = 92 - ckbIndex ID = 93 - ckbIQIndex ID = 94 - ckbIRIndex ID = 95 - csIndex ID = 96 - csCZIndex ID = 97 - cuIndex ID = 98 - cuRUIndex ID = 99 - cyIndex ID = 100 - cyGBIndex ID = 101 - daIndex ID = 102 - daDKIndex ID = 103 - daGLIndex ID = 104 - davIndex ID = 105 - davKEIndex ID = 106 - deIndex ID = 107 - deATIndex ID = 108 - deBEIndex ID = 109 - deCHIndex ID = 110 - deDEIndex ID = 111 - deITIndex ID = 112 - deLIIndex ID = 113 - deLUIndex ID = 114 - djeIndex ID = 115 - djeNEIndex ID = 116 - dsbIndex ID = 117 - dsbDEIndex ID = 118 - duaIndex ID = 119 - duaCMIndex ID = 120 - dvIndex ID = 121 - dyoIndex ID = 122 - dyoSNIndex ID = 123 - dzIndex ID = 124 - dzBTIndex ID = 125 - ebuIndex ID = 126 - ebuKEIndex ID = 127 - eeIndex ID = 128 - eeGHIndex ID = 129 - eeTGIndex ID = 130 - elIndex ID = 131 - elCYIndex ID = 132 - elGRIndex ID = 133 - enIndex ID = 134 - en001Index ID = 135 - en150Index ID = 136 - enAGIndex ID = 137 - enAIIndex ID = 138 - enASIndex ID = 139 - enATIndex ID = 140 - enAUIndex ID = 141 - enBBIndex ID = 142 - enBEIndex ID = 143 - enBIIndex ID = 144 - enBMIndex ID = 145 - enBSIndex ID = 146 - enBWIndex ID = 147 - enBZIndex ID = 148 - enCAIndex ID = 149 - enCCIndex ID = 150 - enCHIndex ID = 151 - enCKIndex ID = 152 - enCMIndex ID = 153 - enCXIndex ID = 154 - enCYIndex ID = 155 - enDEIndex ID = 156 - enDGIndex ID = 157 - enDKIndex ID = 158 - enDMIndex ID = 159 - enERIndex ID = 160 - enFIIndex ID = 161 - enFJIndex ID = 162 - enFKIndex ID = 163 - enFMIndex ID = 164 - enGBIndex ID = 165 - enGDIndex ID = 166 - enGGIndex ID = 167 - enGHIndex ID = 168 - enGIIndex ID = 169 - enGMIndex ID = 170 - enGUIndex ID = 171 - enGYIndex ID = 172 - enHKIndex ID = 173 - enIEIndex ID = 174 - enILIndex ID = 175 - enIMIndex ID = 176 - enINIndex ID = 177 - enIOIndex ID = 178 - enJEIndex ID = 179 - enJMIndex ID = 180 - enKEIndex ID = 181 - enKIIndex ID = 182 - enKNIndex ID = 183 - enKYIndex ID = 184 - enLCIndex ID = 185 - enLRIndex ID = 186 - enLSIndex ID = 187 - enMGIndex ID = 188 - enMHIndex ID = 189 - enMOIndex ID = 190 - enMPIndex ID = 191 - enMSIndex ID = 192 - enMTIndex ID = 193 - enMUIndex ID = 194 - enMWIndex ID = 195 - enMYIndex ID = 196 - enNAIndex ID = 197 - enNFIndex ID = 198 - enNGIndex ID = 199 - enNLIndex ID = 200 - enNRIndex ID = 201 - enNUIndex ID = 202 - enNZIndex ID = 203 - enPGIndex ID = 204 - enPHIndex ID = 205 - enPKIndex ID = 206 - enPNIndex ID = 207 - enPRIndex ID = 208 - enPWIndex ID = 209 - enRWIndex ID = 210 - enSBIndex ID = 211 - enSCIndex ID = 212 - enSDIndex ID = 213 - enSEIndex ID = 214 - enSGIndex ID = 215 - enSHIndex ID = 216 - enSIIndex ID = 217 - enSLIndex ID = 218 - enSSIndex ID = 219 - enSXIndex ID = 220 - enSZIndex ID = 221 - enTCIndex ID = 222 - enTKIndex ID = 223 - enTOIndex ID = 224 - enTTIndex ID = 225 - enTVIndex ID = 226 - enTZIndex ID = 227 - enUGIndex ID = 228 - enUMIndex ID = 229 - enUSIndex ID = 230 - enVCIndex ID = 231 - enVGIndex ID = 232 - enVIIndex ID = 233 - enVUIndex ID = 234 - enWSIndex ID = 235 - enZAIndex ID = 236 - enZMIndex ID = 237 - enZWIndex ID = 238 - eoIndex ID = 239 - eo001Index ID = 240 - esIndex ID = 241 - es419Index ID = 242 - esARIndex ID = 243 - esBOIndex ID = 244 - esBRIndex ID = 245 - esBZIndex ID = 246 - esCLIndex ID = 247 - esCOIndex ID = 248 - esCRIndex ID = 249 - esCUIndex ID = 250 - esDOIndex ID = 251 - esEAIndex ID = 252 - esECIndex ID = 253 - esESIndex ID = 254 - esGQIndex ID = 255 - esGTIndex ID = 256 - esHNIndex ID = 257 - esICIndex ID = 258 - esMXIndex ID = 259 - esNIIndex ID = 260 - esPAIndex ID = 261 - esPEIndex ID = 262 - esPHIndex ID = 263 - esPRIndex ID = 264 - esPYIndex ID = 265 - esSVIndex ID = 266 - esUSIndex ID = 267 - esUYIndex ID = 268 - esVEIndex ID = 269 - etIndex ID = 270 - etEEIndex ID = 271 - euIndex ID = 272 - euESIndex ID = 273 - ewoIndex ID = 274 - ewoCMIndex ID = 275 - faIndex ID = 276 - faAFIndex ID = 277 - faIRIndex ID = 278 - ffIndex ID = 279 - ffCMIndex ID = 280 - ffGNIndex ID = 281 - ffMRIndex ID = 282 - ffSNIndex ID = 283 - fiIndex ID = 284 - fiFIIndex ID = 285 - filIndex ID = 286 - filPHIndex ID = 287 - foIndex ID = 288 - foDKIndex ID = 289 - foFOIndex ID = 290 - frIndex ID = 291 - frBEIndex ID = 292 - frBFIndex ID = 293 - frBIIndex ID = 294 - frBJIndex ID = 295 - frBLIndex ID = 296 - frCAIndex ID = 297 - frCDIndex ID = 298 - frCFIndex ID = 299 - frCGIndex ID = 300 - frCHIndex ID = 301 - frCIIndex ID = 302 - frCMIndex ID = 303 - frDJIndex ID = 304 - frDZIndex ID = 305 - frFRIndex ID = 306 - frGAIndex ID = 307 - frGFIndex ID = 308 - frGNIndex ID = 309 - frGPIndex ID = 310 - frGQIndex ID = 311 - frHTIndex ID = 312 - frKMIndex ID = 313 - frLUIndex ID = 314 - frMAIndex ID = 315 - frMCIndex ID = 316 - frMFIndex ID = 317 - frMGIndex ID = 318 - frMLIndex ID = 319 - frMQIndex ID = 320 - frMRIndex ID = 321 - frMUIndex ID = 322 - frNCIndex ID = 323 - frNEIndex ID = 324 - frPFIndex ID = 325 - frPMIndex ID = 326 - frREIndex ID = 327 - frRWIndex ID = 328 - frSCIndex ID = 329 - frSNIndex ID = 330 - frSYIndex ID = 331 - frTDIndex ID = 332 - frTGIndex ID = 333 - frTNIndex ID = 334 - frVUIndex ID = 335 - frWFIndex ID = 336 - frYTIndex ID = 337 - furIndex ID = 338 - furITIndex ID = 339 - fyIndex ID = 340 - fyNLIndex ID = 341 - gaIndex ID = 342 - gaIEIndex ID = 343 - gdIndex ID = 344 - gdGBIndex ID = 345 - glIndex ID = 346 - glESIndex ID = 347 - gswIndex ID = 348 - gswCHIndex ID = 349 - gswFRIndex ID = 350 - gswLIIndex ID = 351 - guIndex ID = 352 - guINIndex ID = 353 - guwIndex ID = 354 - guzIndex ID = 355 - guzKEIndex ID = 356 - gvIndex ID = 357 - gvIMIndex ID = 358 - haIndex ID = 359 - haGHIndex ID = 360 - haNEIndex ID = 361 - haNGIndex ID = 362 - hawIndex ID = 363 - hawUSIndex ID = 364 - heIndex ID = 365 - heILIndex ID = 366 - hiIndex ID = 367 - hiINIndex ID = 368 - hrIndex ID = 369 - hrBAIndex ID = 370 - hrHRIndex ID = 371 - hsbIndex ID = 372 - hsbDEIndex ID = 373 - huIndex ID = 374 - huHUIndex ID = 375 - hyIndex ID = 376 - hyAMIndex ID = 377 - idIndex ID = 378 - idIDIndex ID = 379 - igIndex ID = 380 - igNGIndex ID = 381 - iiIndex ID = 382 - iiCNIndex ID = 383 - inIndex ID = 384 - ioIndex ID = 385 - isIndex ID = 386 - isISIndex ID = 387 - itIndex ID = 388 - itCHIndex ID = 389 - itITIndex ID = 390 - itSMIndex ID = 391 - itVAIndex ID = 392 - iuIndex ID = 393 - iwIndex ID = 394 - jaIndex ID = 395 - jaJPIndex ID = 396 - jboIndex ID = 397 - jgoIndex ID = 398 - jgoCMIndex ID = 399 - jiIndex ID = 400 - jmcIndex ID = 401 - jmcTZIndex ID = 402 - jvIndex ID = 403 - jwIndex ID = 404 - kaIndex ID = 405 - kaGEIndex ID = 406 - kabIndex ID = 407 - kabDZIndex ID = 408 - kajIndex ID = 409 - kamIndex ID = 410 - kamKEIndex ID = 411 - kcgIndex ID = 412 - kdeIndex ID = 413 - kdeTZIndex ID = 414 - keaIndex ID = 415 - keaCVIndex ID = 416 - khqIndex ID = 417 - khqMLIndex ID = 418 - kiIndex ID = 419 - kiKEIndex ID = 420 - kkIndex ID = 421 - kkKZIndex ID = 422 - kkjIndex ID = 423 - kkjCMIndex ID = 424 - klIndex ID = 425 - klGLIndex ID = 426 - klnIndex ID = 427 - klnKEIndex ID = 428 - kmIndex ID = 429 - kmKHIndex ID = 430 - knIndex ID = 431 - knINIndex ID = 432 - koIndex ID = 433 - koKPIndex ID = 434 - koKRIndex ID = 435 - kokIndex ID = 436 - kokINIndex ID = 437 - ksIndex ID = 438 - ksINIndex ID = 439 - ksbIndex ID = 440 - ksbTZIndex ID = 441 - ksfIndex ID = 442 - ksfCMIndex ID = 443 - kshIndex ID = 444 - kshDEIndex ID = 445 - kuIndex ID = 446 - kwIndex ID = 447 - kwGBIndex ID = 448 - kyIndex ID = 449 - kyKGIndex ID = 450 - lagIndex ID = 451 - lagTZIndex ID = 452 - lbIndex ID = 453 - lbLUIndex ID = 454 - lgIndex ID = 455 - lgUGIndex ID = 456 - lktIndex ID = 457 - lktUSIndex ID = 458 - lnIndex ID = 459 - lnAOIndex ID = 460 - lnCDIndex ID = 461 - lnCFIndex ID = 462 - lnCGIndex ID = 463 - loIndex ID = 464 - loLAIndex ID = 465 - lrcIndex ID = 466 - lrcIQIndex ID = 467 - lrcIRIndex ID = 468 - ltIndex ID = 469 - ltLTIndex ID = 470 - luIndex ID = 471 - luCDIndex ID = 472 - luoIndex ID = 473 - luoKEIndex ID = 474 - luyIndex ID = 475 - luyKEIndex ID = 476 - lvIndex ID = 477 - lvLVIndex ID = 478 - masIndex ID = 479 - masKEIndex ID = 480 - masTZIndex ID = 481 - merIndex ID = 482 - merKEIndex ID = 483 - mfeIndex ID = 484 - mfeMUIndex ID = 485 - mgIndex ID = 486 - mgMGIndex ID = 487 - mghIndex ID = 488 - mghMZIndex ID = 489 - mgoIndex ID = 490 - mgoCMIndex ID = 491 - mkIndex ID = 492 - mkMKIndex ID = 493 - mlIndex ID = 494 - mlINIndex ID = 495 - mnIndex ID = 496 - mnMNIndex ID = 497 - moIndex ID = 498 - mrIndex ID = 499 - mrINIndex ID = 500 - msIndex ID = 501 - msBNIndex ID = 502 - msMYIndex ID = 503 - msSGIndex ID = 504 - mtIndex ID = 505 - mtMTIndex ID = 506 - muaIndex ID = 507 - muaCMIndex ID = 508 - myIndex ID = 509 - myMMIndex ID = 510 - mznIndex ID = 511 - mznIRIndex ID = 512 - nahIndex ID = 513 - naqIndex ID = 514 - naqNAIndex ID = 515 - nbIndex ID = 516 - nbNOIndex ID = 517 - nbSJIndex ID = 518 - ndIndex ID = 519 - ndZWIndex ID = 520 - ndsIndex ID = 521 - ndsDEIndex ID = 522 - ndsNLIndex ID = 523 - neIndex ID = 524 - neINIndex ID = 525 - neNPIndex ID = 526 - nlIndex ID = 527 - nlAWIndex ID = 528 - nlBEIndex ID = 529 - nlBQIndex ID = 530 - nlCWIndex ID = 531 - nlNLIndex ID = 532 - nlSRIndex ID = 533 - nlSXIndex ID = 534 - nmgIndex ID = 535 - nmgCMIndex ID = 536 - nnIndex ID = 537 - nnNOIndex ID = 538 - nnhIndex ID = 539 - nnhCMIndex ID = 540 - noIndex ID = 541 - nqoIndex ID = 542 - nrIndex ID = 543 - nsoIndex ID = 544 - nusIndex ID = 545 - nusSSIndex ID = 546 - nyIndex ID = 547 - nynIndex ID = 548 - nynUGIndex ID = 549 - omIndex ID = 550 - omETIndex ID = 551 - omKEIndex ID = 552 - orIndex ID = 553 - orINIndex ID = 554 - osIndex ID = 555 - osGEIndex ID = 556 - osRUIndex ID = 557 - paIndex ID = 558 - paArabIndex ID = 559 - paArabPKIndex ID = 560 - paGuruIndex ID = 561 - paGuruINIndex ID = 562 - papIndex ID = 563 - plIndex ID = 564 - plPLIndex ID = 565 - prgIndex ID = 566 - prg001Index ID = 567 - psIndex ID = 568 - psAFIndex ID = 569 - ptIndex ID = 570 - ptAOIndex ID = 571 - ptBRIndex ID = 572 - ptCHIndex ID = 573 - ptCVIndex ID = 574 - ptGQIndex ID = 575 - ptGWIndex ID = 576 - ptLUIndex ID = 577 - ptMOIndex ID = 578 - ptMZIndex ID = 579 - ptPTIndex ID = 580 - ptSTIndex ID = 581 - ptTLIndex ID = 582 - quIndex ID = 583 - quBOIndex ID = 584 - quECIndex ID = 585 - quPEIndex ID = 586 - rmIndex ID = 587 - rmCHIndex ID = 588 - rnIndex ID = 589 - rnBIIndex ID = 590 - roIndex ID = 591 - roMDIndex ID = 592 - roROIndex ID = 593 - rofIndex ID = 594 - rofTZIndex ID = 595 - ruIndex ID = 596 - ruBYIndex ID = 597 - ruKGIndex ID = 598 - ruKZIndex ID = 599 - ruMDIndex ID = 600 - ruRUIndex ID = 601 - ruUAIndex ID = 602 - rwIndex ID = 603 - rwRWIndex ID = 604 - rwkIndex ID = 605 - rwkTZIndex ID = 606 - sahIndex ID = 607 - sahRUIndex ID = 608 - saqIndex ID = 609 - saqKEIndex ID = 610 - sbpIndex ID = 611 - sbpTZIndex ID = 612 - sdIndex ID = 613 - sdPKIndex ID = 614 - sdhIndex ID = 615 - seIndex ID = 616 - seFIIndex ID = 617 - seNOIndex ID = 618 - seSEIndex ID = 619 - sehIndex ID = 620 - sehMZIndex ID = 621 - sesIndex ID = 622 - sesMLIndex ID = 623 - sgIndex ID = 624 - sgCFIndex ID = 625 - shIndex ID = 626 - shiIndex ID = 627 - shiLatnIndex ID = 628 - shiLatnMAIndex ID = 629 - shiTfngIndex ID = 630 - shiTfngMAIndex ID = 631 - siIndex ID = 632 - siLKIndex ID = 633 - skIndex ID = 634 - skSKIndex ID = 635 - slIndex ID = 636 - slSIIndex ID = 637 - smaIndex ID = 638 - smiIndex ID = 639 - smjIndex ID = 640 - smnIndex ID = 641 - smnFIIndex ID = 642 - smsIndex ID = 643 - snIndex ID = 644 - snZWIndex ID = 645 - soIndex ID = 646 - soDJIndex ID = 647 - soETIndex ID = 648 - soKEIndex ID = 649 - soSOIndex ID = 650 - sqIndex ID = 651 - sqALIndex ID = 652 - sqMKIndex ID = 653 - sqXKIndex ID = 654 - srIndex ID = 655 - srCyrlIndex ID = 656 - srCyrlBAIndex ID = 657 - srCyrlMEIndex ID = 658 - srCyrlRSIndex ID = 659 - srCyrlXKIndex ID = 660 - srLatnIndex ID = 661 - srLatnBAIndex ID = 662 - srLatnMEIndex ID = 663 - srLatnRSIndex ID = 664 - srLatnXKIndex ID = 665 - ssIndex ID = 666 - ssyIndex ID = 667 - stIndex ID = 668 - svIndex ID = 669 - svAXIndex ID = 670 - svFIIndex ID = 671 - svSEIndex ID = 672 - swIndex ID = 673 - swCDIndex ID = 674 - swKEIndex ID = 675 - swTZIndex ID = 676 - swUGIndex ID = 677 - syrIndex ID = 678 - taIndex ID = 679 - taINIndex ID = 680 - taLKIndex ID = 681 - taMYIndex ID = 682 - taSGIndex ID = 683 - teIndex ID = 684 - teINIndex ID = 685 - teoIndex ID = 686 - teoKEIndex ID = 687 - teoUGIndex ID = 688 - tgIndex ID = 689 - tgTJIndex ID = 690 - thIndex ID = 691 - thTHIndex ID = 692 - tiIndex ID = 693 - tiERIndex ID = 694 - tiETIndex ID = 695 - tigIndex ID = 696 - tkIndex ID = 697 - tkTMIndex ID = 698 - tlIndex ID = 699 - tnIndex ID = 700 - toIndex ID = 701 - toTOIndex ID = 702 - trIndex ID = 703 - trCYIndex ID = 704 - trTRIndex ID = 705 - tsIndex ID = 706 - ttIndex ID = 707 - ttRUIndex ID = 708 - twqIndex ID = 709 - twqNEIndex ID = 710 - tzmIndex ID = 711 - tzmMAIndex ID = 712 - ugIndex ID = 713 - ugCNIndex ID = 714 - ukIndex ID = 715 - ukUAIndex ID = 716 - urIndex ID = 717 - urINIndex ID = 718 - urPKIndex ID = 719 - uzIndex ID = 720 - uzArabIndex ID = 721 - uzArabAFIndex ID = 722 - uzCyrlIndex ID = 723 - uzCyrlUZIndex ID = 724 - uzLatnIndex ID = 725 - uzLatnUZIndex ID = 726 - vaiIndex ID = 727 - vaiLatnIndex ID = 728 - vaiLatnLRIndex ID = 729 - vaiVaiiIndex ID = 730 - vaiVaiiLRIndex ID = 731 - veIndex ID = 732 - viIndex ID = 733 - viVNIndex ID = 734 - voIndex ID = 735 - vo001Index ID = 736 - vunIndex ID = 737 - vunTZIndex ID = 738 - waIndex ID = 739 - waeIndex ID = 740 - waeCHIndex ID = 741 - woIndex ID = 742 - woSNIndex ID = 743 - xhIndex ID = 744 - xogIndex ID = 745 - xogUGIndex ID = 746 - yavIndex ID = 747 - yavCMIndex ID = 748 - yiIndex ID = 749 - yi001Index ID = 750 - yoIndex ID = 751 - yoBJIndex ID = 752 - yoNGIndex ID = 753 - yueIndex ID = 754 - yueHansIndex ID = 755 - yueHansCNIndex ID = 756 - yueHantIndex ID = 757 - yueHantHKIndex ID = 758 - zghIndex ID = 759 - zghMAIndex ID = 760 - zhIndex ID = 761 - zhHansIndex ID = 762 - zhHansCNIndex ID = 763 - zhHansHKIndex ID = 764 - zhHansMOIndex ID = 765 - zhHansSGIndex ID = 766 - zhHantIndex ID = 767 - zhHantHKIndex ID = 768 - zhHantMOIndex ID = 769 - zhHantTWIndex ID = 770 - zuIndex ID = 771 - zuZAIndex ID = 772 - caESvalenciaIndex ID = 773 - enUSuvaposixIndex ID = 774 -) - -var coreTags = []language.CompactCoreInfo{ // 773 elements - // Entry 0 - 1F - 0x00000000, 0x01600000, 0x016000d2, 0x01600161, - 0x01c00000, 0x01c00052, 0x02100000, 0x02100080, - 0x02700000, 0x0270006f, 0x03a00000, 0x03a00001, - 0x03a00023, 0x03a00039, 0x03a00062, 0x03a00067, - 0x03a0006b, 0x03a0006c, 0x03a0006d, 0x03a00097, - 0x03a0009b, 0x03a000a1, 0x03a000a8, 0x03a000ac, - 0x03a000b0, 0x03a000b9, 0x03a000ba, 0x03a000c9, - 0x03a000e1, 0x03a000ed, 0x03a000f3, 0x03a00108, - // Entry 20 - 3F - 0x03a0010b, 0x03a00115, 0x03a00117, 0x03a0011c, - 0x03a00120, 0x03a00128, 0x03a0015e, 0x04000000, - 0x04300000, 0x04300099, 0x04400000, 0x0440012f, - 0x04800000, 0x0480006e, 0x05800000, 0x0581f000, - 0x0581f032, 0x05857000, 0x05857032, 0x05e00000, - 0x05e00052, 0x07100000, 0x07100047, 0x07500000, - 0x07500162, 0x07900000, 0x0790012f, 0x07e00000, - 0x07e00038, 0x08200000, 0x0a000000, 0x0a0000c3, - // Entry 40 - 5F - 0x0a500000, 0x0a500035, 0x0a500099, 0x0a900000, - 0x0a900053, 0x0a900099, 0x0b200000, 0x0b200078, - 0x0b500000, 0x0b500099, 0x0b700000, 0x0b71f000, - 0x0b71f033, 0x0b757000, 0x0b757033, 0x0d700000, - 0x0d700022, 0x0d70006e, 0x0d700078, 0x0d70009e, - 0x0db00000, 0x0db00035, 0x0db00099, 0x0dc00000, - 0x0dc00106, 0x0df00000, 0x0df00131, 0x0e500000, - 0x0e500135, 0x0e900000, 0x0e90009b, 0x0e90009c, - // Entry 60 - 7F - 0x0fa00000, 0x0fa0005e, 0x0fe00000, 0x0fe00106, - 0x10000000, 0x1000007b, 0x10100000, 0x10100063, - 0x10100082, 0x10800000, 0x108000a4, 0x10d00000, - 0x10d0002e, 0x10d00036, 0x10d0004e, 0x10d00060, - 0x10d0009e, 0x10d000b2, 0x10d000b7, 0x11700000, - 0x117000d4, 0x11f00000, 0x11f00060, 0x12400000, - 0x12400052, 0x12800000, 0x12b00000, 0x12b00114, - 0x12d00000, 0x12d00043, 0x12f00000, 0x12f000a4, - // Entry 80 - 9F - 0x13000000, 0x13000080, 0x13000122, 0x13600000, - 0x1360005d, 0x13600087, 0x13900000, 0x13900001, - 0x1390001a, 0x13900025, 0x13900026, 0x1390002d, - 0x1390002e, 0x1390002f, 0x13900034, 0x13900036, - 0x1390003a, 0x1390003d, 0x13900042, 0x13900046, - 0x13900048, 0x13900049, 0x1390004a, 0x1390004e, - 0x13900050, 0x13900052, 0x1390005c, 0x1390005d, - 0x13900060, 0x13900061, 0x13900063, 0x13900064, - // Entry A0 - BF - 0x1390006d, 0x13900072, 0x13900073, 0x13900074, - 0x13900075, 0x1390007b, 0x1390007c, 0x1390007f, - 0x13900080, 0x13900081, 0x13900083, 0x1390008a, - 0x1390008c, 0x1390008d, 0x13900096, 0x13900097, - 0x13900098, 0x13900099, 0x1390009a, 0x1390009f, - 0x139000a0, 0x139000a4, 0x139000a7, 0x139000a9, - 0x139000ad, 0x139000b1, 0x139000b4, 0x139000b5, - 0x139000bf, 0x139000c0, 0x139000c6, 0x139000c7, - // Entry C0 - DF - 0x139000ca, 0x139000cb, 0x139000cc, 0x139000ce, - 0x139000d0, 0x139000d2, 0x139000d5, 0x139000d6, - 0x139000d9, 0x139000dd, 0x139000df, 0x139000e0, - 0x139000e6, 0x139000e7, 0x139000e8, 0x139000eb, - 0x139000ec, 0x139000f0, 0x13900107, 0x13900109, - 0x1390010a, 0x1390010b, 0x1390010c, 0x1390010d, - 0x1390010e, 0x1390010f, 0x13900112, 0x13900117, - 0x1390011b, 0x1390011d, 0x1390011f, 0x13900125, - // Entry E0 - FF - 0x13900129, 0x1390012c, 0x1390012d, 0x1390012f, - 0x13900131, 0x13900133, 0x13900135, 0x13900139, - 0x1390013c, 0x1390013d, 0x1390013f, 0x13900142, - 0x13900161, 0x13900162, 0x13900164, 0x13c00000, - 0x13c00001, 0x13e00000, 0x13e0001f, 0x13e0002c, - 0x13e0003f, 0x13e00041, 0x13e00048, 0x13e00051, - 0x13e00054, 0x13e00056, 0x13e00059, 0x13e00065, - 0x13e00068, 0x13e00069, 0x13e0006e, 0x13e00086, - // Entry 100 - 11F - 0x13e00089, 0x13e0008f, 0x13e00094, 0x13e000cf, - 0x13e000d8, 0x13e000e2, 0x13e000e4, 0x13e000e7, - 0x13e000ec, 0x13e000f1, 0x13e0011a, 0x13e00135, - 0x13e00136, 0x13e0013b, 0x14000000, 0x1400006a, - 0x14500000, 0x1450006e, 0x14600000, 0x14600052, - 0x14800000, 0x14800024, 0x1480009c, 0x14e00000, - 0x14e00052, 0x14e00084, 0x14e000c9, 0x14e00114, - 0x15100000, 0x15100072, 0x15300000, 0x153000e7, - // Entry 120 - 13F - 0x15800000, 0x15800063, 0x15800076, 0x15e00000, - 0x15e00036, 0x15e00037, 0x15e0003a, 0x15e0003b, - 0x15e0003c, 0x15e00049, 0x15e0004b, 0x15e0004c, - 0x15e0004d, 0x15e0004e, 0x15e0004f, 0x15e00052, - 0x15e00062, 0x15e00067, 0x15e00078, 0x15e0007a, - 0x15e0007e, 0x15e00084, 0x15e00085, 0x15e00086, - 0x15e00091, 0x15e000a8, 0x15e000b7, 0x15e000ba, - 0x15e000bb, 0x15e000be, 0x15e000bf, 0x15e000c3, - // Entry 140 - 15F - 0x15e000c8, 0x15e000c9, 0x15e000cc, 0x15e000d3, - 0x15e000d4, 0x15e000e5, 0x15e000ea, 0x15e00102, - 0x15e00107, 0x15e0010a, 0x15e00114, 0x15e0011c, - 0x15e00120, 0x15e00122, 0x15e00128, 0x15e0013f, - 0x15e00140, 0x15e0015f, 0x16900000, 0x1690009e, - 0x16d00000, 0x16d000d9, 0x16e00000, 0x16e00096, - 0x17e00000, 0x17e0007b, 0x19000000, 0x1900006e, - 0x1a300000, 0x1a30004e, 0x1a300078, 0x1a3000b2, - // Entry 160 - 17F - 0x1a400000, 0x1a400099, 0x1a900000, 0x1ab00000, - 0x1ab000a4, 0x1ac00000, 0x1ac00098, 0x1b400000, - 0x1b400080, 0x1b4000d4, 0x1b4000d6, 0x1b800000, - 0x1b800135, 0x1bc00000, 0x1bc00097, 0x1be00000, - 0x1be00099, 0x1d100000, 0x1d100033, 0x1d100090, - 0x1d200000, 0x1d200060, 0x1d500000, 0x1d500092, - 0x1d700000, 0x1d700028, 0x1e100000, 0x1e100095, - 0x1e700000, 0x1e7000d6, 0x1ea00000, 0x1ea00053, - // Entry 180 - 19F - 0x1f300000, 0x1f500000, 0x1f800000, 0x1f80009d, - 0x1f900000, 0x1f90004e, 0x1f90009e, 0x1f900113, - 0x1f900138, 0x1fa00000, 0x1fb00000, 0x20000000, - 0x200000a2, 0x20300000, 0x20700000, 0x20700052, - 0x20800000, 0x20a00000, 0x20a0012f, 0x20e00000, - 0x20f00000, 0x21000000, 0x2100007d, 0x21200000, - 0x21200067, 0x21600000, 0x21700000, 0x217000a4, - 0x21f00000, 0x22300000, 0x2230012f, 0x22700000, - // Entry 1A0 - 1BF - 0x2270005a, 0x23400000, 0x234000c3, 0x23900000, - 0x239000a4, 0x24200000, 0x242000ae, 0x24400000, - 0x24400052, 0x24500000, 0x24500082, 0x24600000, - 0x246000a4, 0x24a00000, 0x24a000a6, 0x25100000, - 0x25100099, 0x25400000, 0x254000aa, 0x254000ab, - 0x25600000, 0x25600099, 0x26a00000, 0x26a00099, - 0x26b00000, 0x26b0012f, 0x26d00000, 0x26d00052, - 0x26e00000, 0x26e00060, 0x27400000, 0x28100000, - // Entry 1C0 - 1DF - 0x2810007b, 0x28a00000, 0x28a000a5, 0x29100000, - 0x2910012f, 0x29500000, 0x295000b7, 0x2a300000, - 0x2a300131, 0x2af00000, 0x2af00135, 0x2b500000, - 0x2b50002a, 0x2b50004b, 0x2b50004c, 0x2b50004d, - 0x2b800000, 0x2b8000af, 0x2bf00000, 0x2bf0009b, - 0x2bf0009c, 0x2c000000, 0x2c0000b6, 0x2c200000, - 0x2c20004b, 0x2c400000, 0x2c4000a4, 0x2c500000, - 0x2c5000a4, 0x2c700000, 0x2c7000b8, 0x2d100000, - // Entry 1E0 - 1FF - 0x2d1000a4, 0x2d10012f, 0x2e900000, 0x2e9000a4, - 0x2ed00000, 0x2ed000cc, 0x2f100000, 0x2f1000bf, - 0x2f200000, 0x2f2000d1, 0x2f400000, 0x2f400052, - 0x2ff00000, 0x2ff000c2, 0x30400000, 0x30400099, - 0x30b00000, 0x30b000c5, 0x31000000, 0x31b00000, - 0x31b00099, 0x31f00000, 0x31f0003e, 0x31f000d0, - 0x31f0010d, 0x32000000, 0x320000cb, 0x32500000, - 0x32500052, 0x33100000, 0x331000c4, 0x33a00000, - // Entry 200 - 21F - 0x33a0009c, 0x34100000, 0x34500000, 0x345000d2, - 0x34700000, 0x347000da, 0x34700110, 0x34e00000, - 0x34e00164, 0x35000000, 0x35000060, 0x350000d9, - 0x35100000, 0x35100099, 0x351000db, 0x36700000, - 0x36700030, 0x36700036, 0x36700040, 0x3670005b, - 0x367000d9, 0x36700116, 0x3670011b, 0x36800000, - 0x36800052, 0x36a00000, 0x36a000da, 0x36c00000, - 0x36c00052, 0x36f00000, 0x37500000, 0x37600000, - // Entry 220 - 23F - 0x37a00000, 0x38000000, 0x38000117, 0x38700000, - 0x38900000, 0x38900131, 0x39000000, 0x3900006f, - 0x390000a4, 0x39500000, 0x39500099, 0x39800000, - 0x3980007d, 0x39800106, 0x39d00000, 0x39d05000, - 0x39d050e8, 0x39d33000, 0x39d33099, 0x3a100000, - 0x3b300000, 0x3b3000e9, 0x3bd00000, 0x3bd00001, - 0x3be00000, 0x3be00024, 0x3c000000, 0x3c00002a, - 0x3c000041, 0x3c00004e, 0x3c00005a, 0x3c000086, - // Entry 240 - 25F - 0x3c00008b, 0x3c0000b7, 0x3c0000c6, 0x3c0000d1, - 0x3c0000ee, 0x3c000118, 0x3c000126, 0x3c400000, - 0x3c40003f, 0x3c400069, 0x3c4000e4, 0x3d400000, - 0x3d40004e, 0x3d900000, 0x3d90003a, 0x3dc00000, - 0x3dc000bc, 0x3dc00104, 0x3de00000, 0x3de0012f, - 0x3e200000, 0x3e200047, 0x3e2000a5, 0x3e2000ae, - 0x3e2000bc, 0x3e200106, 0x3e200130, 0x3e500000, - 0x3e500107, 0x3e600000, 0x3e60012f, 0x3eb00000, - // Entry 260 - 27F - 0x3eb00106, 0x3ec00000, 0x3ec000a4, 0x3f300000, - 0x3f30012f, 0x3fa00000, 0x3fa000e8, 0x3fc00000, - 0x3fd00000, 0x3fd00072, 0x3fd000da, 0x3fd0010c, - 0x3ff00000, 0x3ff000d1, 0x40100000, 0x401000c3, - 0x40200000, 0x4020004c, 0x40700000, 0x40800000, - 0x40857000, 0x408570ba, 0x408dc000, 0x408dc0ba, - 0x40c00000, 0x40c000b3, 0x41200000, 0x41200111, - 0x41600000, 0x4160010f, 0x41c00000, 0x41d00000, - // Entry 280 - 29F - 0x41e00000, 0x41f00000, 0x41f00072, 0x42200000, - 0x42300000, 0x42300164, 0x42900000, 0x42900062, - 0x4290006f, 0x429000a4, 0x42900115, 0x43100000, - 0x43100027, 0x431000c2, 0x4310014d, 0x43200000, - 0x4321f000, 0x4321f033, 0x4321f0bd, 0x4321f105, - 0x4321f14d, 0x43257000, 0x43257033, 0x432570bd, - 0x43257105, 0x4325714d, 0x43700000, 0x43a00000, - 0x43b00000, 0x44400000, 0x44400031, 0x44400072, - // Entry 2A0 - 2BF - 0x4440010c, 0x44500000, 0x4450004b, 0x445000a4, - 0x4450012f, 0x44500131, 0x44e00000, 0x45000000, - 0x45000099, 0x450000b3, 0x450000d0, 0x4500010d, - 0x46100000, 0x46100099, 0x46400000, 0x464000a4, - 0x46400131, 0x46700000, 0x46700124, 0x46b00000, - 0x46b00123, 0x46f00000, 0x46f0006d, 0x46f0006f, - 0x47100000, 0x47600000, 0x47600127, 0x47a00000, - 0x48000000, 0x48200000, 0x48200129, 0x48a00000, - // Entry 2C0 - 2DF - 0x48a0005d, 0x48a0012b, 0x48e00000, 0x49400000, - 0x49400106, 0x4a400000, 0x4a4000d4, 0x4a900000, - 0x4a9000ba, 0x4ac00000, 0x4ac00053, 0x4ae00000, - 0x4ae00130, 0x4b400000, 0x4b400099, 0x4b4000e8, - 0x4bc00000, 0x4bc05000, 0x4bc05024, 0x4bc1f000, - 0x4bc1f137, 0x4bc57000, 0x4bc57137, 0x4be00000, - 0x4be57000, 0x4be570b4, 0x4bee3000, 0x4bee30b4, - 0x4c000000, 0x4c300000, 0x4c30013e, 0x4c900000, - // Entry 2E0 - 2FF - 0x4c900001, 0x4cc00000, 0x4cc0012f, 0x4ce00000, - 0x4cf00000, 0x4cf0004e, 0x4e500000, 0x4e500114, - 0x4f200000, 0x4fb00000, 0x4fb00131, 0x50900000, - 0x50900052, 0x51200000, 0x51200001, 0x51800000, - 0x5180003b, 0x518000d6, 0x51f00000, 0x51f38000, - 0x51f38053, 0x51f39000, 0x51f3908d, 0x52800000, - 0x528000ba, 0x52900000, 0x52938000, 0x52938053, - 0x5293808d, 0x529380c6, 0x5293810d, 0x52939000, - // Entry 300 - 31F - 0x5293908d, 0x529390c6, 0x5293912e, 0x52f00000, - 0x52f00161, -} // Size: 3116 bytes - -const specialTagsStr string = "ca-ES-valencia en-US-u-va-posix" - -// Total table size 3147 bytes (3KiB); checksum: F4E57D15 diff --git a/vendor/golang.org/x/text/internal/language/compact/tags.go b/vendor/golang.org/x/text/internal/language/compact/tags.go deleted file mode 100644 index ca135d29..00000000 --- a/vendor/golang.org/x/text/internal/language/compact/tags.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package compact - -var ( - und = Tag{} - - Und Tag = Tag{} - - Afrikaans Tag = Tag{language: afIndex, locale: afIndex} - Amharic Tag = Tag{language: amIndex, locale: amIndex} - Arabic Tag = Tag{language: arIndex, locale: arIndex} - ModernStandardArabic Tag = Tag{language: ar001Index, locale: ar001Index} - Azerbaijani Tag = Tag{language: azIndex, locale: azIndex} - Bulgarian Tag = Tag{language: bgIndex, locale: bgIndex} - Bengali Tag = Tag{language: bnIndex, locale: bnIndex} - Catalan Tag = Tag{language: caIndex, locale: caIndex} - Czech Tag = Tag{language: csIndex, locale: csIndex} - Danish Tag = Tag{language: daIndex, locale: daIndex} - German Tag = Tag{language: deIndex, locale: deIndex} - Greek Tag = Tag{language: elIndex, locale: elIndex} - English Tag = Tag{language: enIndex, locale: enIndex} - AmericanEnglish Tag = Tag{language: enUSIndex, locale: enUSIndex} - BritishEnglish Tag = Tag{language: enGBIndex, locale: enGBIndex} - Spanish Tag = Tag{language: esIndex, locale: esIndex} - EuropeanSpanish Tag = Tag{language: esESIndex, locale: esESIndex} - LatinAmericanSpanish Tag = Tag{language: es419Index, locale: es419Index} - Estonian Tag = Tag{language: etIndex, locale: etIndex} - Persian Tag = Tag{language: faIndex, locale: faIndex} - Finnish Tag = Tag{language: fiIndex, locale: fiIndex} - Filipino Tag = Tag{language: filIndex, locale: filIndex} - French Tag = Tag{language: frIndex, locale: frIndex} - CanadianFrench Tag = Tag{language: frCAIndex, locale: frCAIndex} - Gujarati Tag = Tag{language: guIndex, locale: guIndex} - Hebrew Tag = Tag{language: heIndex, locale: heIndex} - Hindi Tag = Tag{language: hiIndex, locale: hiIndex} - Croatian Tag = Tag{language: hrIndex, locale: hrIndex} - Hungarian Tag = Tag{language: huIndex, locale: huIndex} - Armenian Tag = Tag{language: hyIndex, locale: hyIndex} - Indonesian Tag = Tag{language: idIndex, locale: idIndex} - Icelandic Tag = Tag{language: isIndex, locale: isIndex} - Italian Tag = Tag{language: itIndex, locale: itIndex} - Japanese Tag = Tag{language: jaIndex, locale: jaIndex} - Georgian Tag = Tag{language: kaIndex, locale: kaIndex} - Kazakh Tag = Tag{language: kkIndex, locale: kkIndex} - Khmer Tag = Tag{language: kmIndex, locale: kmIndex} - Kannada Tag = Tag{language: knIndex, locale: knIndex} - Korean Tag = Tag{language: koIndex, locale: koIndex} - Kirghiz Tag = Tag{language: kyIndex, locale: kyIndex} - Lao Tag = Tag{language: loIndex, locale: loIndex} - Lithuanian Tag = Tag{language: ltIndex, locale: ltIndex} - Latvian Tag = Tag{language: lvIndex, locale: lvIndex} - Macedonian Tag = Tag{language: mkIndex, locale: mkIndex} - Malayalam Tag = Tag{language: mlIndex, locale: mlIndex} - Mongolian Tag = Tag{language: mnIndex, locale: mnIndex} - Marathi Tag = Tag{language: mrIndex, locale: mrIndex} - Malay Tag = Tag{language: msIndex, locale: msIndex} - Burmese Tag = Tag{language: myIndex, locale: myIndex} - Nepali Tag = Tag{language: neIndex, locale: neIndex} - Dutch Tag = Tag{language: nlIndex, locale: nlIndex} - Norwegian Tag = Tag{language: noIndex, locale: noIndex} - Punjabi Tag = Tag{language: paIndex, locale: paIndex} - Polish Tag = Tag{language: plIndex, locale: plIndex} - Portuguese Tag = Tag{language: ptIndex, locale: ptIndex} - BrazilianPortuguese Tag = Tag{language: ptBRIndex, locale: ptBRIndex} - EuropeanPortuguese Tag = Tag{language: ptPTIndex, locale: ptPTIndex} - Romanian Tag = Tag{language: roIndex, locale: roIndex} - Russian Tag = Tag{language: ruIndex, locale: ruIndex} - Sinhala Tag = Tag{language: siIndex, locale: siIndex} - Slovak Tag = Tag{language: skIndex, locale: skIndex} - Slovenian Tag = Tag{language: slIndex, locale: slIndex} - Albanian Tag = Tag{language: sqIndex, locale: sqIndex} - Serbian Tag = Tag{language: srIndex, locale: srIndex} - SerbianLatin Tag = Tag{language: srLatnIndex, locale: srLatnIndex} - Swedish Tag = Tag{language: svIndex, locale: svIndex} - Swahili Tag = Tag{language: swIndex, locale: swIndex} - Tamil Tag = Tag{language: taIndex, locale: taIndex} - Telugu Tag = Tag{language: teIndex, locale: teIndex} - Thai Tag = Tag{language: thIndex, locale: thIndex} - Turkish Tag = Tag{language: trIndex, locale: trIndex} - Ukrainian Tag = Tag{language: ukIndex, locale: ukIndex} - Urdu Tag = Tag{language: urIndex, locale: urIndex} - Uzbek Tag = Tag{language: uzIndex, locale: uzIndex} - Vietnamese Tag = Tag{language: viIndex, locale: viIndex} - Chinese Tag = Tag{language: zhIndex, locale: zhIndex} - SimplifiedChinese Tag = Tag{language: zhHansIndex, locale: zhHansIndex} - TraditionalChinese Tag = Tag{language: zhHantIndex, locale: zhHantIndex} - Zulu Tag = Tag{language: zuIndex, locale: zuIndex} -) diff --git a/vendor/golang.org/x/text/internal/language/compose.go b/vendor/golang.org/x/text/internal/language/compose.go deleted file mode 100644 index 4ae78e0f..00000000 --- a/vendor/golang.org/x/text/internal/language/compose.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -import ( - "sort" - "strings" -) - -// A Builder allows constructing a Tag from individual components. -// Its main user is Compose in the top-level language package. -type Builder struct { - Tag Tag - - private string // the x extension - variants []string - extensions []string -} - -// Make returns a new Tag from the current settings. -func (b *Builder) Make() Tag { - t := b.Tag - - if len(b.extensions) > 0 || len(b.variants) > 0 { - sort.Sort(sortVariants(b.variants)) - sort.Strings(b.extensions) - - if b.private != "" { - b.extensions = append(b.extensions, b.private) - } - n := maxCoreSize + tokenLen(b.variants...) + tokenLen(b.extensions...) - buf := make([]byte, n) - p := t.genCoreBytes(buf) - t.pVariant = byte(p) - p += appendTokens(buf[p:], b.variants...) - t.pExt = uint16(p) - p += appendTokens(buf[p:], b.extensions...) - t.str = string(buf[:p]) - // We may not always need to remake the string, but when or when not - // to do so is rather tricky. - scan := makeScanner(buf[:p]) - t, _ = parse(&scan, "") - return t - - } else if b.private != "" { - t.str = b.private - t.RemakeString() - } - return t -} - -// SetTag copies all the settings from a given Tag. Any previously set values -// are discarded. -func (b *Builder) SetTag(t Tag) { - b.Tag.LangID = t.LangID - b.Tag.RegionID = t.RegionID - b.Tag.ScriptID = t.ScriptID - // TODO: optimize - b.variants = b.variants[:0] - if variants := t.Variants(); variants != "" { - for _, vr := range strings.Split(variants[1:], "-") { - b.variants = append(b.variants, vr) - } - } - b.extensions, b.private = b.extensions[:0], "" - for _, e := range t.Extensions() { - b.AddExt(e) - } -} - -// AddExt adds extension e to the tag. e must be a valid extension as returned -// by Tag.Extension. If the extension already exists, it will be discarded, -// except for a -u extension, where non-existing key-type pairs will added. -func (b *Builder) AddExt(e string) { - if e[0] == 'x' { - if b.private == "" { - b.private = e - } - return - } - for i, s := range b.extensions { - if s[0] == e[0] { - if e[0] == 'u' { - b.extensions[i] += e[1:] - } - return - } - } - b.extensions = append(b.extensions, e) -} - -// SetExt sets the extension e to the tag. e must be a valid extension as -// returned by Tag.Extension. If the extension already exists, it will be -// overwritten, except for a -u extension, where the individual key-type pairs -// will be set. -func (b *Builder) SetExt(e string) { - if e[0] == 'x' { - b.private = e - return - } - for i, s := range b.extensions { - if s[0] == e[0] { - if e[0] == 'u' { - b.extensions[i] = e + s[1:] - } else { - b.extensions[i] = e - } - return - } - } - b.extensions = append(b.extensions, e) -} - -// AddVariant adds any number of variants. -func (b *Builder) AddVariant(v ...string) { - for _, v := range v { - if v != "" { - b.variants = append(b.variants, v) - } - } -} - -// ClearVariants removes any variants previously added, including those -// copied from a Tag in SetTag. -func (b *Builder) ClearVariants() { - b.variants = b.variants[:0] -} - -// ClearExtensions removes any extensions previously added, including those -// copied from a Tag in SetTag. -func (b *Builder) ClearExtensions() { - b.private = "" - b.extensions = b.extensions[:0] -} - -func tokenLen(token ...string) (n int) { - for _, t := range token { - n += len(t) + 1 - } - return -} - -func appendTokens(b []byte, token ...string) int { - p := 0 - for _, t := range token { - b[p] = '-' - copy(b[p+1:], t) - p += 1 + len(t) - } - return p -} - -type sortVariants []string - -func (s sortVariants) Len() int { - return len(s) -} - -func (s sortVariants) Swap(i, j int) { - s[j], s[i] = s[i], s[j] -} - -func (s sortVariants) Less(i, j int) bool { - return variantIndex[s[i]] < variantIndex[s[j]] -} diff --git a/vendor/golang.org/x/text/internal/language/coverage.go b/vendor/golang.org/x/text/internal/language/coverage.go deleted file mode 100644 index 9b20b88f..00000000 --- a/vendor/golang.org/x/text/internal/language/coverage.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -// BaseLanguages returns the list of all supported base languages. It generates -// the list by traversing the internal structures. -func BaseLanguages() []Language { - base := make([]Language, 0, NumLanguages) - for i := 0; i < langNoIndexOffset; i++ { - // We included "und" already for the value 0. - if i != nonCanonicalUnd { - base = append(base, Language(i)) - } - } - i := langNoIndexOffset - for _, v := range langNoIndex { - for k := 0; k < 8; k++ { - if v&1 == 1 { - base = append(base, Language(i)) - } - v >>= 1 - i++ - } - } - return base -} diff --git a/vendor/golang.org/x/text/internal/language/gen.go b/vendor/golang.org/x/text/internal/language/gen.go deleted file mode 100644 index cdcc7feb..00000000 --- a/vendor/golang.org/x/text/internal/language/gen.go +++ /dev/null @@ -1,1520 +0,0 @@ -// Copyright 2013 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 ignore - -// Language tag table generator. -// Data read from the web. - -package main - -import ( - "bufio" - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "math" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - - "golang.org/x/text/internal/gen" - "golang.org/x/text/internal/tag" - "golang.org/x/text/unicode/cldr" -) - -var ( - test = flag.Bool("test", - false, - "test existing tables; can be used to compare web data with package data.") - outputFile = flag.String("output", - "tables.go", - "output file for generated tables") -) - -var comment = []string{ - ` -lang holds an alphabetically sorted list of ISO-639 language identifiers. -All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. -For 2-byte language identifiers, the two successive bytes have the following meaning: - - if the first letter of the 2- and 3-letter ISO codes are the same: - the second and third letter of the 3-letter ISO code. - - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. -For 3-byte language identifiers the 4th byte is 0.`, - ` -langNoIndex is a bit vector of all 3-letter language codes that are not used as an index -in lookup tables. The language ids for these language codes are derived directly -from the letters and are not consecutive.`, - ` -altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives -to 2-letter language codes that cannot be derived using the method described above. -Each 3-letter code is followed by its 1-byte langID.`, - ` -altLangIndex is used to convert indexes in altLangISO3 to langIDs.`, - ` -AliasMap maps langIDs to their suggested replacements.`, - ` -script is an alphabetically sorted list of ISO 15924 codes. The index -of the script in the string, divided by 4, is the internal scriptID.`, - ` -isoRegionOffset needs to be added to the index of regionISO to obtain the regionID -for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for -the UN.M49 codes used for groups.)`, - ` -regionISO holds a list of alphabetically sorted 2-letter ISO region codes. -Each 2-letter codes is followed by two bytes with the following meaning: - - [A-Z}{2}: the first letter of the 2-letter code plus these two - letters form the 3-letter ISO code. - - 0, n: index into altRegionISO3.`, - ` -regionTypes defines the status of a region for various standards.`, - ` -m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are -codes indicating collections of regions.`, - ` -m49Index gives indexes into fromM49 based on the three most significant bits -of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in - fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] -for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. -The region code is stored in the 9 lsb of the indexed value.`, - ` -fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details.`, - ` -altRegionISO3 holds a list of 3-letter region codes that cannot be -mapped to 2-letter codes using the default algorithm. This is a short list.`, - ` -altRegionIDs holds a list of regionIDs the positions of which match those -of the 3-letter ISO codes in altRegionISO3.`, - ` -variantNumSpecialized is the number of specialized variants in variants.`, - ` -suppressScript is an index from langID to the dominant script for that language, -if it exists. If a script is given, it should be suppressed from the language tag.`, - ` -likelyLang is a lookup table, indexed by langID, for the most likely -scripts and regions given incomplete information. If more entries exist for a -given language, region and script are the index and size respectively -of the list in likelyLangList.`, - ` -likelyLangList holds lists info associated with likelyLang.`, - ` -likelyRegion is a lookup table, indexed by regionID, for the most likely -languages and scripts given incomplete information. If more entries exist -for a given regionID, lang and script are the index and size respectively -of the list in likelyRegionList. -TODO: exclude containers and user-definable regions from the list.`, - ` -likelyRegionList holds lists info associated with likelyRegion.`, - ` -likelyScript is a lookup table, indexed by scriptID, for the most likely -languages and regions given a script.`, - ` -nRegionGroups is the number of region groups.`, - ` -regionInclusion maps region identifiers to sets of regions in regionInclusionBits, -where each set holds all groupings that are directly connected in a region -containment graph.`, - ` -regionInclusionBits is an array of bit vectors where every vector represents -a set of region groupings. These sets are used to compute the distance -between two regions for the purpose of language matching.`, - ` -regionInclusionNext marks, for each entry in regionInclusionBits, the set of -all groups that are reachable from the groups set in the respective entry.`, -} - -// TODO: consider changing some of these structures to tries. This can reduce -// memory, but may increase the need for memory allocations. This could be -// mitigated if we can piggyback on language tags for common cases. - -func failOnError(e error) { - if e != nil { - log.Panic(e) - } -} - -type setType int - -const ( - Indexed setType = 1 + iota // all elements must be of same size - Linear -) - -type stringSet struct { - s []string - sorted, frozen bool - - // We often need to update values after the creation of an index is completed. - // We include a convenience map for keeping track of this. - update map[string]string - typ setType // used for checking. -} - -func (ss *stringSet) clone() stringSet { - c := *ss - c.s = append([]string(nil), c.s...) - return c -} - -func (ss *stringSet) setType(t setType) { - if ss.typ != t && ss.typ != 0 { - log.Panicf("type %d cannot be assigned as it was already %d", t, ss.typ) - } -} - -// parse parses a whitespace-separated string and initializes ss with its -// components. -func (ss *stringSet) parse(s string) { - scan := bufio.NewScanner(strings.NewReader(s)) - scan.Split(bufio.ScanWords) - for scan.Scan() { - ss.add(scan.Text()) - } -} - -func (ss *stringSet) assertChangeable() { - if ss.frozen { - log.Panic("attempt to modify a frozen stringSet") - } -} - -func (ss *stringSet) add(s string) { - ss.assertChangeable() - ss.s = append(ss.s, s) - ss.sorted = ss.frozen -} - -func (ss *stringSet) freeze() { - ss.compact() - ss.frozen = true -} - -func (ss *stringSet) compact() { - if ss.sorted { - return - } - a := ss.s - sort.Strings(a) - k := 0 - for i := 1; i < len(a); i++ { - if a[k] != a[i] { - a[k+1] = a[i] - k++ - } - } - ss.s = a[:k+1] - ss.sorted = ss.frozen -} - -type funcSorter struct { - fn func(a, b string) bool - sort.StringSlice -} - -func (s funcSorter) Less(i, j int) bool { - return s.fn(s.StringSlice[i], s.StringSlice[j]) -} - -func (ss *stringSet) sortFunc(f func(a, b string) bool) { - ss.compact() - sort.Sort(funcSorter{f, sort.StringSlice(ss.s)}) -} - -func (ss *stringSet) remove(s string) { - ss.assertChangeable() - if i, ok := ss.find(s); ok { - copy(ss.s[i:], ss.s[i+1:]) - ss.s = ss.s[:len(ss.s)-1] - } -} - -func (ss *stringSet) replace(ol, nu string) { - ss.s[ss.index(ol)] = nu - ss.sorted = ss.frozen -} - -func (ss *stringSet) index(s string) int { - ss.setType(Indexed) - i, ok := ss.find(s) - if !ok { - if i < len(ss.s) { - log.Panicf("find: item %q is not in list. Closest match is %q.", s, ss.s[i]) - } - log.Panicf("find: item %q is not in list", s) - - } - return i -} - -func (ss *stringSet) find(s string) (int, bool) { - ss.compact() - i := sort.SearchStrings(ss.s, s) - return i, i != len(ss.s) && ss.s[i] == s -} - -func (ss *stringSet) slice() []string { - ss.compact() - return ss.s -} - -func (ss *stringSet) updateLater(v, key string) { - if ss.update == nil { - ss.update = map[string]string{} - } - ss.update[v] = key -} - -// join joins the string and ensures that all entries are of the same length. -func (ss *stringSet) join() string { - ss.setType(Indexed) - n := len(ss.s[0]) - for _, s := range ss.s { - if len(s) != n { - log.Panicf("join: not all entries are of the same length: %q", s) - } - } - ss.s = append(ss.s, strings.Repeat("\xff", n)) - return strings.Join(ss.s, "") -} - -// ianaEntry holds information for an entry in the IANA Language Subtag Repository. -// All types use the same entry. -// See http://tools.ietf.org/html/bcp47#section-5.1 for a description of the various -// fields. -type ianaEntry struct { - typ string - description []string - scope string - added string - preferred string - deprecated string - suppressScript string - macro string - prefix []string -} - -type builder struct { - w *gen.CodeWriter - hw io.Writer // MultiWriter for w and w.Hash - data *cldr.CLDR - supp *cldr.SupplementalData - - // indices - locale stringSet // common locales - lang stringSet // canonical language ids (2 or 3 letter ISO codes) with data - langNoIndex stringSet // 3-letter ISO codes with no associated data - script stringSet // 4-letter ISO codes - region stringSet // 2-letter ISO or 3-digit UN M49 codes - variant stringSet // 4-8-alphanumeric variant code. - - // Region codes that are groups with their corresponding group IDs. - groups map[int]index - - // langInfo - registry map[string]*ianaEntry -} - -type index uint - -func newBuilder(w *gen.CodeWriter) *builder { - r := gen.OpenCLDRCoreZip() - defer r.Close() - d := &cldr.Decoder{} - data, err := d.DecodeZip(r) - failOnError(err) - b := builder{ - w: w, - hw: io.MultiWriter(w, w.Hash), - data: data, - supp: data.Supplemental(), - } - b.parseRegistry() - return &b -} - -func (b *builder) parseRegistry() { - r := gen.OpenIANAFile("assignments/language-subtag-registry") - defer r.Close() - b.registry = make(map[string]*ianaEntry) - - scan := bufio.NewScanner(r) - scan.Split(bufio.ScanWords) - var record *ianaEntry - for more := scan.Scan(); more; { - key := scan.Text() - more = scan.Scan() - value := scan.Text() - switch key { - case "Type:": - record = &ianaEntry{typ: value} - case "Subtag:", "Tag:": - if s := strings.SplitN(value, "..", 2); len(s) > 1 { - for a := s[0]; a <= s[1]; a = inc(a) { - b.addToRegistry(a, record) - } - } else { - b.addToRegistry(value, record) - } - case "Suppress-Script:": - record.suppressScript = value - case "Added:": - record.added = value - case "Deprecated:": - record.deprecated = value - case "Macrolanguage:": - record.macro = value - case "Preferred-Value:": - record.preferred = value - case "Prefix:": - record.prefix = append(record.prefix, value) - case "Scope:": - record.scope = value - case "Description:": - buf := []byte(value) - for more = scan.Scan(); more; more = scan.Scan() { - b := scan.Bytes() - if b[0] == '%' || b[len(b)-1] == ':' { - break - } - buf = append(buf, ' ') - buf = append(buf, b...) - } - record.description = append(record.description, string(buf)) - continue - default: - continue - } - more = scan.Scan() - } - if scan.Err() != nil { - log.Panic(scan.Err()) - } -} - -func (b *builder) addToRegistry(key string, entry *ianaEntry) { - if info, ok := b.registry[key]; ok { - if info.typ != "language" || entry.typ != "extlang" { - log.Fatalf("parseRegistry: tag %q already exists", key) - } - } else { - b.registry[key] = entry - } -} - -var commentIndex = make(map[string]string) - -func init() { - for _, s := range comment { - key := strings.TrimSpace(strings.SplitN(s, " ", 2)[0]) - commentIndex[key] = s - } -} - -func (b *builder) comment(name string) { - if s := commentIndex[name]; len(s) > 0 { - b.w.WriteComment(s) - } else { - fmt.Fprintln(b.w) - } -} - -func (b *builder) pf(f string, x ...interface{}) { - fmt.Fprintf(b.hw, f, x...) - fmt.Fprint(b.hw, "\n") -} - -func (b *builder) p(x ...interface{}) { - fmt.Fprintln(b.hw, x...) -} - -func (b *builder) addSize(s int) { - b.w.Size += s - b.pf("// Size: %d bytes", s) -} - -func (b *builder) writeConst(name string, x interface{}) { - b.comment(name) - b.w.WriteConst(name, x) -} - -// writeConsts computes f(v) for all v in values and writes the results -// as constants named _v to a single constant block. -func (b *builder) writeConsts(f func(string) int, values ...string) { - b.pf("const (") - for _, v := range values { - b.pf("\t_%s = %v", v, f(v)) - } - b.pf(")") -} - -// writeType writes the type of the given value, which must be a struct. -func (b *builder) writeType(value interface{}) { - b.comment(reflect.TypeOf(value).Name()) - b.w.WriteType(value) -} - -func (b *builder) writeSlice(name string, ss interface{}) { - b.writeSliceAddSize(name, 0, ss) -} - -func (b *builder) writeSliceAddSize(name string, extraSize int, ss interface{}) { - b.comment(name) - b.w.Size += extraSize - v := reflect.ValueOf(ss) - t := v.Type().Elem() - b.pf("// Size: %d bytes, %d elements", v.Len()*int(t.Size())+extraSize, v.Len()) - - fmt.Fprintf(b.w, "var %s = ", name) - b.w.WriteArray(ss) - b.p() -} - -type FromTo struct { - From, To uint16 -} - -func (b *builder) writeSortedMap(name string, ss *stringSet, index func(s string) uint16) { - ss.sortFunc(func(a, b string) bool { - return index(a) < index(b) - }) - m := []FromTo{} - for _, s := range ss.s { - m = append(m, FromTo{index(s), index(ss.update[s])}) - } - b.writeSlice(name, m) -} - -const base = 'z' - 'a' + 1 - -func strToInt(s string) uint { - v := uint(0) - for i := 0; i < len(s); i++ { - v *= base - v += uint(s[i] - 'a') - } - return v -} - -// converts the given integer to the original ASCII string passed to strToInt. -// len(s) must match the number of characters obtained. -func intToStr(v uint, s []byte) { - for i := len(s) - 1; i >= 0; i-- { - s[i] = byte(v%base) + 'a' - v /= base - } -} - -func (b *builder) writeBitVector(name string, ss []string) { - vec := make([]uint8, int(math.Ceil(math.Pow(base, float64(len(ss[0])))/8))) - for _, s := range ss { - v := strToInt(s) - vec[v/8] |= 1 << (v % 8) - } - b.writeSlice(name, vec) -} - -// TODO: convert this type into a list or two-stage trie. -func (b *builder) writeMapFunc(name string, m map[string]string, f func(string) uint16) { - b.comment(name) - v := reflect.ValueOf(m) - sz := v.Len() * (2 + int(v.Type().Key().Size())) - for _, k := range m { - sz += len(k) - } - b.addSize(sz) - keys := []string{} - b.pf(`var %s = map[string]uint16{`, name) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - b.pf("\t%q: %v,", k, f(m[k])) - } - b.p("}") -} - -func (b *builder) writeMap(name string, m interface{}) { - b.comment(name) - v := reflect.ValueOf(m) - sz := v.Len() * (2 + int(v.Type().Key().Size()) + int(v.Type().Elem().Size())) - b.addSize(sz) - f := strings.FieldsFunc(fmt.Sprintf("%#v", m), func(r rune) bool { - return strings.IndexRune("{}, ", r) != -1 - }) - sort.Strings(f[1:]) - b.pf(`var %s = %s{`, name, f[0]) - for _, kv := range f[1:] { - b.pf("\t%s,", kv) - } - b.p("}") -} - -func (b *builder) langIndex(s string) uint16 { - if s == "und" { - return 0 - } - if i, ok := b.lang.find(s); ok { - return uint16(i) - } - return uint16(strToInt(s)) + uint16(len(b.lang.s)) -} - -// inc advances the string to its lexicographical successor. -func inc(s string) string { - const maxTagLength = 4 - var buf [maxTagLength]byte - intToStr(strToInt(strings.ToLower(s))+1, buf[:len(s)]) - for i := 0; i < len(s); i++ { - if s[i] <= 'Z' { - buf[i] -= 'a' - 'A' - } - } - return string(buf[:len(s)]) -} - -func (b *builder) parseIndices() { - meta := b.supp.Metadata - - for k, v := range b.registry { - var ss *stringSet - switch v.typ { - case "language": - if len(k) == 2 || v.suppressScript != "" || v.scope == "special" { - b.lang.add(k) - continue - } else { - ss = &b.langNoIndex - } - case "region": - ss = &b.region - case "script": - ss = &b.script - case "variant": - ss = &b.variant - default: - continue - } - ss.add(k) - } - // Include any language for which there is data. - for _, lang := range b.data.Locales() { - if x := b.data.RawLDML(lang); false || - x.LocaleDisplayNames != nil || - x.Characters != nil || - x.Delimiters != nil || - x.Measurement != nil || - x.Dates != nil || - x.Numbers != nil || - x.Units != nil || - x.ListPatterns != nil || - x.Collations != nil || - x.Segmentations != nil || - x.Rbnf != nil || - x.Annotations != nil || - x.Metadata != nil { - - from := strings.Split(lang, "_") - if lang := from[0]; lang != "root" { - b.lang.add(lang) - } - } - } - // Include locales for plural rules, which uses a different structure. - for _, plurals := range b.data.Supplemental().Plurals { - for _, rules := range plurals.PluralRules { - for _, lang := range strings.Split(rules.Locales, " ") { - if lang = strings.Split(lang, "_")[0]; lang != "root" { - b.lang.add(lang) - } - } - } - } - // Include languages in likely subtags. - for _, m := range b.supp.LikelySubtags.LikelySubtag { - from := strings.Split(m.From, "_") - b.lang.add(from[0]) - } - // Include ISO-639 alpha-3 bibliographic entries. - for _, a := range meta.Alias.LanguageAlias { - if a.Reason == "bibliographic" { - b.langNoIndex.add(a.Type) - } - } - // Include regions in territoryAlias (not all are in the IANA registry!) - for _, reg := range b.supp.Metadata.Alias.TerritoryAlias { - if len(reg.Type) == 2 { - b.region.add(reg.Type) - } - } - - for _, s := range b.lang.s { - if len(s) == 3 { - b.langNoIndex.remove(s) - } - } - b.writeConst("NumLanguages", len(b.lang.slice())+len(b.langNoIndex.slice())) - b.writeConst("NumScripts", len(b.script.slice())) - b.writeConst("NumRegions", len(b.region.slice())) - - // Add dummy codes at the start of each list to represent "unspecified". - b.lang.add("---") - b.script.add("----") - b.region.add("---") - - // common locales - b.locale.parse(meta.DefaultContent.Locales) -} - -// TODO: region inclusion data will probably not be use used in future matchers. - -func (b *builder) computeRegionGroups() { - b.groups = make(map[int]index) - - // Create group indices. - for i := 1; b.region.s[i][0] < 'A'; i++ { // Base M49 indices on regionID. - b.groups[i] = index(len(b.groups)) - } - for _, g := range b.supp.TerritoryContainment.Group { - // Skip UN and EURO zone as they are flattening the containment - // relationship. - if g.Type == "EZ" || g.Type == "UN" { - continue - } - group := b.region.index(g.Type) - if _, ok := b.groups[group]; !ok { - b.groups[group] = index(len(b.groups)) - } - } - if len(b.groups) > 64 { - log.Fatalf("only 64 groups supported, found %d", len(b.groups)) - } - b.writeConst("nRegionGroups", len(b.groups)) -} - -var langConsts = []string{ - "af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es", - "et", "fa", "fi", "fil", "fr", "gu", "he", "hi", "hr", "hu", "hy", "id", "is", - "it", "ja", "ka", "kk", "km", "kn", "ko", "ky", "lo", "lt", "lv", "mk", "ml", - "mn", "mo", "mr", "ms", "mul", "my", "nb", "ne", "nl", "no", "pa", "pl", "pt", - "ro", "ru", "sh", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", - "tl", "tn", "tr", "uk", "ur", "uz", "vi", "zh", "zu", - - // constants for grandfathered tags (if not already defined) - "jbo", "ami", "bnn", "hak", "tlh", "lb", "nv", "pwn", "tao", "tay", "tsu", - "nn", "sfb", "vgt", "sgg", "cmn", "nan", "hsn", -} - -// writeLanguage generates all tables needed for language canonicalization. -func (b *builder) writeLanguage() { - meta := b.supp.Metadata - - b.writeConst("nonCanonicalUnd", b.lang.index("und")) - b.writeConsts(func(s string) int { return int(b.langIndex(s)) }, langConsts...) - b.writeConst("langPrivateStart", b.langIndex("qaa")) - b.writeConst("langPrivateEnd", b.langIndex("qtz")) - - // Get language codes that need to be mapped (overlong 3-letter codes, - // deprecated 2-letter codes, legacy and grandfathered tags.) - langAliasMap := stringSet{} - aliasTypeMap := map[string]AliasType{} - - // altLangISO3 get the alternative ISO3 names that need to be mapped. - altLangISO3 := stringSet{} - // Add dummy start to avoid the use of index 0. - altLangISO3.add("---") - altLangISO3.updateLater("---", "aa") - - lang := b.lang.clone() - for _, a := range meta.Alias.LanguageAlias { - if a.Replacement == "" { - a.Replacement = "und" - } - // TODO: support mapping to tags - repl := strings.SplitN(a.Replacement, "_", 2)[0] - if a.Reason == "overlong" { - if len(a.Replacement) == 2 && len(a.Type) == 3 { - lang.updateLater(a.Replacement, a.Type) - } - } else if len(a.Type) <= 3 { - switch a.Reason { - case "macrolanguage": - aliasTypeMap[a.Type] = Macro - case "deprecated": - // handled elsewhere - continue - case "bibliographic", "legacy": - if a.Type == "no" { - continue - } - aliasTypeMap[a.Type] = Legacy - default: - log.Fatalf("new %s alias: %s", a.Reason, a.Type) - } - langAliasMap.add(a.Type) - langAliasMap.updateLater(a.Type, repl) - } - } - // Manually add the mapping of "nb" (Norwegian) to its macro language. - // This can be removed if CLDR adopts this change. - langAliasMap.add("nb") - langAliasMap.updateLater("nb", "no") - aliasTypeMap["nb"] = Macro - - for k, v := range b.registry { - // Also add deprecated values for 3-letter ISO codes, which CLDR omits. - if v.typ == "language" && v.deprecated != "" && v.preferred != "" { - langAliasMap.add(k) - langAliasMap.updateLater(k, v.preferred) - aliasTypeMap[k] = Deprecated - } - } - // Fix CLDR mappings. - lang.updateLater("tl", "tgl") - lang.updateLater("sh", "hbs") - lang.updateLater("mo", "mol") - lang.updateLater("no", "nor") - lang.updateLater("tw", "twi") - lang.updateLater("nb", "nob") - lang.updateLater("ak", "aka") - lang.updateLater("bh", "bih") - - // Ensure that each 2-letter code is matched with a 3-letter code. - for _, v := range lang.s[1:] { - s, ok := lang.update[v] - if !ok { - if s, ok = lang.update[langAliasMap.update[v]]; !ok { - continue - } - lang.update[v] = s - } - if v[0] != s[0] { - altLangISO3.add(s) - altLangISO3.updateLater(s, v) - } - } - - // Complete canonicalized language tags. - lang.freeze() - for i, v := range lang.s { - // We can avoid these manual entries by using the IANA registry directly. - // Seems easier to update the list manually, as changes are rare. - // The panic in this loop will trigger if we miss an entry. - add := "" - if s, ok := lang.update[v]; ok { - if s[0] == v[0] { - add = s[1:] - } else { - add = string([]byte{0, byte(altLangISO3.index(s))}) - } - } else if len(v) == 3 { - add = "\x00" - } else { - log.Panicf("no data for long form of %q", v) - } - lang.s[i] += add - } - b.writeConst("lang", tag.Index(lang.join())) - - b.writeConst("langNoIndexOffset", len(b.lang.s)) - - // space of all valid 3-letter language identifiers. - b.writeBitVector("langNoIndex", b.langNoIndex.slice()) - - altLangIndex := []uint16{} - for i, s := range altLangISO3.slice() { - altLangISO3.s[i] += string([]byte{byte(len(altLangIndex))}) - if i > 0 { - idx := b.lang.index(altLangISO3.update[s]) - altLangIndex = append(altLangIndex, uint16(idx)) - } - } - b.writeConst("altLangISO3", tag.Index(altLangISO3.join())) - b.writeSlice("altLangIndex", altLangIndex) - - b.writeSortedMap("AliasMap", &langAliasMap, b.langIndex) - types := make([]AliasType, len(langAliasMap.s)) - for i, s := range langAliasMap.s { - types[i] = aliasTypeMap[s] - } - b.writeSlice("AliasTypes", types) -} - -var scriptConsts = []string{ - "Latn", "Hani", "Hans", "Hant", "Qaaa", "Qaai", "Qabx", "Zinh", "Zyyy", - "Zzzz", -} - -func (b *builder) writeScript() { - b.writeConsts(b.script.index, scriptConsts...) - b.writeConst("script", tag.Index(b.script.join())) - - supp := make([]uint8, len(b.lang.slice())) - for i, v := range b.lang.slice()[1:] { - if sc := b.registry[v].suppressScript; sc != "" { - supp[i+1] = uint8(b.script.index(sc)) - } - } - b.writeSlice("suppressScript", supp) - - // There is only one deprecated script in CLDR. This value is hard-coded. - // We check here if the code must be updated. - for _, a := range b.supp.Metadata.Alias.ScriptAlias { - if a.Type != "Qaai" { - log.Panicf("unexpected deprecated stript %q", a.Type) - } - } -} - -func parseM49(s string) int16 { - if len(s) == 0 { - return 0 - } - v, err := strconv.ParseUint(s, 10, 10) - failOnError(err) - return int16(v) -} - -var regionConsts = []string{ - "001", "419", "BR", "CA", "ES", "GB", "MD", "PT", "UK", "US", - "ZZ", "XA", "XC", "XK", // Unofficial tag for Kosovo. -} - -func (b *builder) writeRegion() { - b.writeConsts(b.region.index, regionConsts...) - - isoOffset := b.region.index("AA") - m49map := make([]int16, len(b.region.slice())) - fromM49map := make(map[int16]int) - altRegionISO3 := "" - altRegionIDs := []uint16{} - - b.writeConst("isoRegionOffset", isoOffset) - - // 2-letter region lookup and mapping to numeric codes. - regionISO := b.region.clone() - regionISO.s = regionISO.s[isoOffset:] - regionISO.sorted = false - - regionTypes := make([]byte, len(b.region.s)) - - // Is the region valid BCP 47? - for s, e := range b.registry { - if len(s) == 2 && s == strings.ToUpper(s) { - i := b.region.index(s) - for _, d := range e.description { - if strings.Contains(d, "Private use") { - regionTypes[i] = iso3166UserAssigned - } - } - regionTypes[i] |= bcp47Region - } - } - - // Is the region a valid ccTLD? - r := gen.OpenIANAFile("domains/root/db") - defer r.Close() - - buf, err := ioutil.ReadAll(r) - failOnError(err) - re := regexp.MustCompile(`"/domains/root/db/([a-z]{2}).html"`) - for _, m := range re.FindAllSubmatch(buf, -1) { - i := b.region.index(strings.ToUpper(string(m[1]))) - regionTypes[i] |= ccTLD - } - - b.writeSlice("regionTypes", regionTypes) - - iso3Set := make(map[string]int) - update := func(iso2, iso3 string) { - i := regionISO.index(iso2) - if j, ok := iso3Set[iso3]; !ok && iso3[0] == iso2[0] { - regionISO.s[i] += iso3[1:] - iso3Set[iso3] = -1 - } else { - if ok && j >= 0 { - regionISO.s[i] += string([]byte{0, byte(j)}) - } else { - iso3Set[iso3] = len(altRegionISO3) - regionISO.s[i] += string([]byte{0, byte(len(altRegionISO3))}) - altRegionISO3 += iso3 - altRegionIDs = append(altRegionIDs, uint16(isoOffset+i)) - } - } - } - for _, tc := range b.supp.CodeMappings.TerritoryCodes { - i := regionISO.index(tc.Type) + isoOffset - if d := m49map[i]; d != 0 { - log.Panicf("%s found as a duplicate UN.M49 code of %03d", tc.Numeric, d) - } - m49 := parseM49(tc.Numeric) - m49map[i] = m49 - if r := fromM49map[m49]; r == 0 { - fromM49map[m49] = i - } else if r != i { - dep := b.registry[regionISO.s[r-isoOffset]].deprecated - if t := b.registry[tc.Type]; t != nil && dep != "" && (t.deprecated == "" || t.deprecated > dep) { - fromM49map[m49] = i - } - } - } - for _, ta := range b.supp.Metadata.Alias.TerritoryAlias { - if len(ta.Type) == 3 && ta.Type[0] <= '9' && len(ta.Replacement) == 2 { - from := parseM49(ta.Type) - if r := fromM49map[from]; r == 0 { - fromM49map[from] = regionISO.index(ta.Replacement) + isoOffset - } - } - } - for _, tc := range b.supp.CodeMappings.TerritoryCodes { - if len(tc.Alpha3) == 3 { - update(tc.Type, tc.Alpha3) - } - } - // This entries are not included in territoryCodes. Mostly 3-letter variants - // of deleted codes and an entry for QU. - for _, m := range []struct{ iso2, iso3 string }{ - {"CT", "CTE"}, - {"DY", "DHY"}, - {"HV", "HVO"}, - {"JT", "JTN"}, - {"MI", "MID"}, - {"NH", "NHB"}, - {"NQ", "ATN"}, - {"PC", "PCI"}, - {"PU", "PUS"}, - {"PZ", "PCZ"}, - {"RH", "RHO"}, - {"VD", "VDR"}, - {"WK", "WAK"}, - // These three-letter codes are used for others as well. - {"FQ", "ATF"}, - } { - update(m.iso2, m.iso3) - } - for i, s := range regionISO.s { - if len(s) != 4 { - regionISO.s[i] = s + " " - } - } - b.writeConst("regionISO", tag.Index(regionISO.join())) - b.writeConst("altRegionISO3", altRegionISO3) - b.writeSlice("altRegionIDs", altRegionIDs) - - // Create list of deprecated regions. - // TODO: consider inserting SF -> FI. Not included by CLDR, but is the only - // Transitionally-reserved mapping not included. - regionOldMap := stringSet{} - // Include regions in territoryAlias (not all are in the IANA registry!) - for _, reg := range b.supp.Metadata.Alias.TerritoryAlias { - if len(reg.Type) == 2 && reg.Reason == "deprecated" && len(reg.Replacement) == 2 { - regionOldMap.add(reg.Type) - regionOldMap.updateLater(reg.Type, reg.Replacement) - i, _ := regionISO.find(reg.Type) - j, _ := regionISO.find(reg.Replacement) - if k := m49map[i+isoOffset]; k == 0 { - m49map[i+isoOffset] = m49map[j+isoOffset] - } - } - } - b.writeSortedMap("regionOldMap", ®ionOldMap, func(s string) uint16 { - return uint16(b.region.index(s)) - }) - // 3-digit region lookup, groupings. - for i := 1; i < isoOffset; i++ { - m := parseM49(b.region.s[i]) - m49map[i] = m - fromM49map[m] = i - } - b.writeSlice("m49", m49map) - - const ( - searchBits = 7 - regionBits = 9 - ) - if len(m49map) >= 1< %d", len(m49map), 1<>searchBits] = int16(len(fromM49)) - } - b.writeSlice("m49Index", m49Index) - b.writeSlice("fromM49", fromM49) -} - -const ( - // TODO: put these lists in regionTypes as user data? Could be used for - // various optimizations and refinements and could be exposed in the API. - iso3166Except = "AC CP DG EA EU FX IC SU TA UK" - iso3166Trans = "AN BU CS NT TP YU ZR" // SF is not in our set of Regions. - // DY and RH are actually not deleted, but indeterminately reserved. - iso3166DelCLDR = "CT DD DY FQ HV JT MI NH NQ PC PU PZ RH VD WK YD" -) - -const ( - iso3166UserAssigned = 1 << iota - ccTLD - bcp47Region -) - -func find(list []string, s string) int { - for i, t := range list { - if t == s { - return i - } - } - return -1 -} - -// writeVariants generates per-variant information and creates a map from variant -// name to index value. We assign index values such that sorting multiple -// variants by index value will result in the correct order. -// There are two types of variants: specialized and general. Specialized variants -// are only applicable to certain language or language-script pairs. Generalized -// variants apply to any language. Generalized variants always sort after -// specialized variants. We will therefore always assign a higher index value -// to a generalized variant than any other variant. Generalized variants are -// sorted alphabetically among themselves. -// Specialized variants may also sort after other specialized variants. Such -// variants will be ordered after any of the variants they may follow. -// We assume that if a variant x is followed by a variant y, then for any prefix -// p of x, p-x is a prefix of y. This allows us to order tags based on the -// maximum of the length of any of its prefixes. -// TODO: it is possible to define a set of Prefix values on variants such that -// a total order cannot be defined to the point that this algorithm breaks. -// In other words, we cannot guarantee the same order of variants for the -// future using the same algorithm or for non-compliant combinations of -// variants. For this reason, consider using simple alphabetic sorting -// of variants and ignore Prefix restrictions altogether. -func (b *builder) writeVariant() { - generalized := stringSet{} - specialized := stringSet{} - specializedExtend := stringSet{} - // Collate the variants by type and check assumptions. - for _, v := range b.variant.slice() { - e := b.registry[v] - if len(e.prefix) == 0 { - generalized.add(v) - continue - } - c := strings.Split(e.prefix[0], "-") - hasScriptOrRegion := false - if len(c) > 1 { - _, hasScriptOrRegion = b.script.find(c[1]) - if !hasScriptOrRegion { - _, hasScriptOrRegion = b.region.find(c[1]) - - } - } - if len(c) == 1 || len(c) == 2 && hasScriptOrRegion { - // Variant is preceded by a language. - specialized.add(v) - continue - } - // Variant is preceded by another variant. - specializedExtend.add(v) - prefix := c[0] + "-" - if hasScriptOrRegion { - prefix += c[1] - } - for _, p := range e.prefix { - // Verify that the prefix minus the last element is a prefix of the - // predecessor element. - i := strings.LastIndex(p, "-") - pred := b.registry[p[i+1:]] - if find(pred.prefix, p[:i]) < 0 { - log.Fatalf("prefix %q for variant %q not consistent with predecessor spec", p, v) - } - // The sorting used below does not work in the general case. It works - // if we assume that variants that may be followed by others only have - // prefixes of the same length. Verify this. - count := strings.Count(p[:i], "-") - for _, q := range pred.prefix { - if c := strings.Count(q, "-"); c != count { - log.Fatalf("variant %q preceding %q has a prefix %q of size %d; want %d", p[i+1:], v, q, c, count) - } - } - if !strings.HasPrefix(p, prefix) { - log.Fatalf("prefix %q of variant %q should start with %q", p, v, prefix) - } - } - } - - // Sort extended variants. - a := specializedExtend.s - less := func(v, w string) bool { - // Sort by the maximum number of elements. - maxCount := func(s string) (max int) { - for _, p := range b.registry[s].prefix { - if c := strings.Count(p, "-"); c > max { - max = c - } - } - return - } - if cv, cw := maxCount(v), maxCount(w); cv != cw { - return cv < cw - } - // Sort by name as tie breaker. - return v < w - } - sort.Sort(funcSorter{less, sort.StringSlice(a)}) - specializedExtend.frozen = true - - // Create index from variant name to index. - variantIndex := make(map[string]uint8) - add := func(s []string) { - for _, v := range s { - variantIndex[v] = uint8(len(variantIndex)) - } - } - add(specialized.slice()) - add(specializedExtend.s) - numSpecialized := len(variantIndex) - add(generalized.slice()) - if n := len(variantIndex); n > 255 { - log.Fatalf("maximum number of variants exceeded: was %d; want <= 255", n) - } - b.writeMap("variantIndex", variantIndex) - b.writeConst("variantNumSpecialized", numSpecialized) -} - -func (b *builder) writeLanguageInfo() { -} - -// writeLikelyData writes tables that are used both for finding parent relations and for -// language matching. Each entry contains additional bits to indicate the status of the -// data to know when it cannot be used for parent relations. -func (b *builder) writeLikelyData() { - const ( - isList = 1 << iota - scriptInFrom - regionInFrom - ) - type ( // generated types - likelyScriptRegion struct { - region uint16 - script uint8 - flags uint8 - } - likelyLangScript struct { - lang uint16 - script uint8 - flags uint8 - } - likelyLangRegion struct { - lang uint16 - region uint16 - } - // likelyTag is used for getting likely tags for group regions, where - // the likely region might be a region contained in the group. - likelyTag struct { - lang uint16 - region uint16 - script uint8 - } - ) - var ( // generated variables - likelyRegionGroup = make([]likelyTag, len(b.groups)) - likelyLang = make([]likelyScriptRegion, len(b.lang.s)) - likelyRegion = make([]likelyLangScript, len(b.region.s)) - likelyScript = make([]likelyLangRegion, len(b.script.s)) - likelyLangList = []likelyScriptRegion{} - likelyRegionList = []likelyLangScript{} - ) - type fromTo struct { - from, to []string - } - langToOther := map[int][]fromTo{} - regionToOther := map[int][]fromTo{} - for _, m := range b.supp.LikelySubtags.LikelySubtag { - from := strings.Split(m.From, "_") - to := strings.Split(m.To, "_") - if len(to) != 3 { - log.Fatalf("invalid number of subtags in %q: found %d, want 3", m.To, len(to)) - } - if len(from) > 3 { - log.Fatalf("invalid number of subtags: found %d, want 1-3", len(from)) - } - if from[0] != to[0] && from[0] != "und" { - log.Fatalf("unexpected language change in expansion: %s -> %s", from, to) - } - if len(from) == 3 { - if from[2] != to[2] { - log.Fatalf("unexpected region change in expansion: %s -> %s", from, to) - } - if from[0] != "und" { - log.Fatalf("unexpected fully specified from tag: %s -> %s", from, to) - } - } - if len(from) == 1 || from[0] != "und" { - id := 0 - if from[0] != "und" { - id = b.lang.index(from[0]) - } - langToOther[id] = append(langToOther[id], fromTo{from, to}) - } else if len(from) == 2 && len(from[1]) == 4 { - sid := b.script.index(from[1]) - likelyScript[sid].lang = uint16(b.langIndex(to[0])) - likelyScript[sid].region = uint16(b.region.index(to[2])) - } else { - r := b.region.index(from[len(from)-1]) - if id, ok := b.groups[r]; ok { - if from[0] != "und" { - log.Fatalf("region changed unexpectedly: %s -> %s", from, to) - } - likelyRegionGroup[id].lang = uint16(b.langIndex(to[0])) - likelyRegionGroup[id].script = uint8(b.script.index(to[1])) - likelyRegionGroup[id].region = uint16(b.region.index(to[2])) - } else { - regionToOther[r] = append(regionToOther[r], fromTo{from, to}) - } - } - } - b.writeType(likelyLangRegion{}) - b.writeSlice("likelyScript", likelyScript) - - for id := range b.lang.s { - list := langToOther[id] - if len(list) == 1 { - likelyLang[id].region = uint16(b.region.index(list[0].to[2])) - likelyLang[id].script = uint8(b.script.index(list[0].to[1])) - } else if len(list) > 1 { - likelyLang[id].flags = isList - likelyLang[id].region = uint16(len(likelyLangList)) - likelyLang[id].script = uint8(len(list)) - for _, x := range list { - flags := uint8(0) - if len(x.from) > 1 { - if x.from[1] == x.to[2] { - flags = regionInFrom - } else { - flags = scriptInFrom - } - } - likelyLangList = append(likelyLangList, likelyScriptRegion{ - region: uint16(b.region.index(x.to[2])), - script: uint8(b.script.index(x.to[1])), - flags: flags, - }) - } - } - } - // TODO: merge suppressScript data with this table. - b.writeType(likelyScriptRegion{}) - b.writeSlice("likelyLang", likelyLang) - b.writeSlice("likelyLangList", likelyLangList) - - for id := range b.region.s { - list := regionToOther[id] - if len(list) == 1 { - likelyRegion[id].lang = uint16(b.langIndex(list[0].to[0])) - likelyRegion[id].script = uint8(b.script.index(list[0].to[1])) - if len(list[0].from) > 2 { - likelyRegion[id].flags = scriptInFrom - } - } else if len(list) > 1 { - likelyRegion[id].flags = isList - likelyRegion[id].lang = uint16(len(likelyRegionList)) - likelyRegion[id].script = uint8(len(list)) - for i, x := range list { - if len(x.from) == 2 && i != 0 || i > 0 && len(x.from) != 3 { - log.Fatalf("unspecified script must be first in list: %v at %d", x.from, i) - } - x := likelyLangScript{ - lang: uint16(b.langIndex(x.to[0])), - script: uint8(b.script.index(x.to[1])), - } - if len(list[0].from) > 2 { - x.flags = scriptInFrom - } - likelyRegionList = append(likelyRegionList, x) - } - } - } - b.writeType(likelyLangScript{}) - b.writeSlice("likelyRegion", likelyRegion) - b.writeSlice("likelyRegionList", likelyRegionList) - - b.writeType(likelyTag{}) - b.writeSlice("likelyRegionGroup", likelyRegionGroup) -} - -func (b *builder) writeRegionInclusionData() { - var ( - // mm holds for each group the set of groups with a distance of 1. - mm = make(map[int][]index) - - // containment holds for each group the transitive closure of - // containment of other groups. - containment = make(map[index][]index) - ) - for _, g := range b.supp.TerritoryContainment.Group { - // Skip UN and EURO zone as they are flattening the containment - // relationship. - if g.Type == "EZ" || g.Type == "UN" { - continue - } - group := b.region.index(g.Type) - groupIdx := b.groups[group] - for _, mem := range strings.Split(g.Contains, " ") { - r := b.region.index(mem) - mm[r] = append(mm[r], groupIdx) - if g, ok := b.groups[r]; ok { - mm[group] = append(mm[group], g) - containment[groupIdx] = append(containment[groupIdx], g) - } - } - } - - regionContainment := make([]uint64, len(b.groups)) - for _, g := range b.groups { - l := containment[g] - - // Compute the transitive closure of containment. - for i := 0; i < len(l); i++ { - l = append(l, containment[l[i]]...) - } - - // Compute the bitmask. - regionContainment[g] = 1 << g - for _, v := range l { - regionContainment[g] |= 1 << v - } - } - b.writeSlice("regionContainment", regionContainment) - - regionInclusion := make([]uint8, len(b.region.s)) - bvs := make(map[uint64]index) - // Make the first bitvector positions correspond with the groups. - for r, i := range b.groups { - bv := uint64(1 << i) - for _, g := range mm[r] { - bv |= 1 << g - } - bvs[bv] = i - regionInclusion[r] = uint8(bvs[bv]) - } - for r := 1; r < len(b.region.s); r++ { - if _, ok := b.groups[r]; !ok { - bv := uint64(0) - for _, g := range mm[r] { - bv |= 1 << g - } - if bv == 0 { - // Pick the world for unspecified regions. - bv = 1 << b.groups[b.region.index("001")] - } - if _, ok := bvs[bv]; !ok { - bvs[bv] = index(len(bvs)) - } - regionInclusion[r] = uint8(bvs[bv]) - } - } - b.writeSlice("regionInclusion", regionInclusion) - regionInclusionBits := make([]uint64, len(bvs)) - for k, v := range bvs { - regionInclusionBits[v] = uint64(k) - } - // Add bit vectors for increasingly large distances until a fixed point is reached. - regionInclusionNext := []uint8{} - for i := 0; i < len(regionInclusionBits); i++ { - bits := regionInclusionBits[i] - next := bits - for i := uint(0); i < uint(len(b.groups)); i++ { - if bits&(1< 0 { - extra = extra[1:] - } - if t.equalTags(Und) && strings.HasPrefix(extra, "x-") { - t.str = extra - t.pVariant = 0 - t.pExt = 0 - return - } - var buf [max99thPercentileSize]byte // avoid extra memory allocation in most cases. - b := buf[:t.genCoreBytes(buf[:])] - if extra != "" { - diff := len(b) - int(t.pVariant) - b = append(b, '-') - b = append(b, extra...) - t.pVariant = uint8(int(t.pVariant) + diff) - t.pExt = uint16(int(t.pExt) + diff) - } else { - t.pVariant = uint8(len(b)) - t.pExt = uint16(len(b)) - } - t.str = string(b) -} - -// genCoreBytes writes a string for the base languages, script and region tags -// to the given buffer and returns the number of bytes written. It will never -// write more than maxCoreSize bytes. -func (t *Tag) genCoreBytes(buf []byte) int { - n := t.LangID.StringToBuf(buf[:]) - if t.ScriptID != 0 { - n += copy(buf[n:], "-") - n += copy(buf[n:], t.ScriptID.String()) - } - if t.RegionID != 0 { - n += copy(buf[n:], "-") - n += copy(buf[n:], t.RegionID.String()) - } - return n -} - -// String returns the canonical string representation of the language tag. -func (t Tag) String() string { - if t.str != "" { - return t.str - } - if t.ScriptID == 0 && t.RegionID == 0 { - return t.LangID.String() - } - buf := [maxCoreSize]byte{} - return string(buf[:t.genCoreBytes(buf[:])]) -} - -// MarshalText implements encoding.TextMarshaler. -func (t Tag) MarshalText() (text []byte, err error) { - if t.str != "" { - text = append(text, t.str...) - } else if t.ScriptID == 0 && t.RegionID == 0 { - text = append(text, t.LangID.String()...) - } else { - buf := [maxCoreSize]byte{} - text = buf[:t.genCoreBytes(buf[:])] - } - return text, nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (t *Tag) UnmarshalText(text []byte) error { - tag, err := Parse(string(text)) - *t = tag - return err -} - -// Variants returns the part of the tag holding all variants or the empty string -// if there are no variants defined. -func (t Tag) Variants() string { - if t.pVariant == 0 { - return "" - } - return t.str[t.pVariant:t.pExt] -} - -// VariantOrPrivateUseTags returns variants or private use tags. -func (t Tag) VariantOrPrivateUseTags() string { - if t.pExt > 0 { - return t.str[t.pVariant:t.pExt] - } - return t.str[t.pVariant:] -} - -// HasString reports whether this tag defines more than just the raw -// components. -func (t Tag) HasString() bool { - return t.str != "" -} - -// Parent returns the CLDR parent of t. In CLDR, missing fields in data for a -// specific language are substituted with fields from the parent language. -// The parent for a language may change for newer versions of CLDR. -func (t Tag) Parent() Tag { - if t.str != "" { - // Strip the variants and extensions. - b, s, r := t.Raw() - t = Tag{LangID: b, ScriptID: s, RegionID: r} - if t.RegionID == 0 && t.ScriptID != 0 && t.LangID != 0 { - base, _ := addTags(Tag{LangID: t.LangID}) - if base.ScriptID == t.ScriptID { - return Tag{LangID: t.LangID} - } - } - return t - } - if t.LangID != 0 { - if t.RegionID != 0 { - maxScript := t.ScriptID - if maxScript == 0 { - max, _ := addTags(t) - maxScript = max.ScriptID - } - - for i := range parents { - if Language(parents[i].lang) == t.LangID && Script(parents[i].maxScript) == maxScript { - for _, r := range parents[i].fromRegion { - if Region(r) == t.RegionID { - return Tag{ - LangID: t.LangID, - ScriptID: Script(parents[i].script), - RegionID: Region(parents[i].toRegion), - } - } - } - } - } - - // Strip the script if it is the default one. - base, _ := addTags(Tag{LangID: t.LangID}) - if base.ScriptID != maxScript { - return Tag{LangID: t.LangID, ScriptID: maxScript} - } - return Tag{LangID: t.LangID} - } else if t.ScriptID != 0 { - // The parent for an base-script pair with a non-default script is - // "und" instead of the base language. - base, _ := addTags(Tag{LangID: t.LangID}) - if base.ScriptID != t.ScriptID { - return Und - } - return Tag{LangID: t.LangID} - } - } - return Und -} - -// ParseExtension parses s as an extension and returns it on success. -func ParseExtension(s string) (ext string, err error) { - scan := makeScannerString(s) - var end int - if n := len(scan.token); n != 1 { - return "", ErrSyntax - } - scan.toLower(0, len(scan.b)) - end = parseExtension(&scan) - if end != len(s) { - return "", ErrSyntax - } - return string(scan.b), nil -} - -// HasVariants reports whether t has variants. -func (t Tag) HasVariants() bool { - return uint16(t.pVariant) < t.pExt -} - -// HasExtensions reports whether t has extensions. -func (t Tag) HasExtensions() bool { - return int(t.pExt) < len(t.str) -} - -// Extension returns the extension of type x for tag t. It will return -// false for ok if t does not have the requested extension. The returned -// extension will be invalid in this case. -func (t Tag) Extension(x byte) (ext string, ok bool) { - for i := int(t.pExt); i < len(t.str)-1; { - var ext string - i, ext = getExtension(t.str, i) - if ext[0] == x { - return ext, true - } - } - return "", false -} - -// Extensions returns all extensions of t. -func (t Tag) Extensions() []string { - e := []string{} - for i := int(t.pExt); i < len(t.str)-1; { - var ext string - i, ext = getExtension(t.str, i) - e = append(e, ext) - } - return e -} - -// TypeForKey returns the type associated with the given key, where key and type -// are of the allowed values defined for the Unicode locale extension ('u') in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. -// TypeForKey will traverse the inheritance chain to get the correct value. -func (t Tag) TypeForKey(key string) string { - if start, end, _ := t.findTypeForKey(key); end != start { - return t.str[start:end] - } - return "" -} - -var ( - errPrivateUse = errors.New("cannot set a key on a private use tag") - errInvalidArguments = errors.New("invalid key or type") -) - -// SetTypeForKey returns a new Tag with the key set to type, where key and type -// are of the allowed values defined for the Unicode locale extension ('u') in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. -// An empty value removes an existing pair with the same key. -func (t Tag) SetTypeForKey(key, value string) (Tag, error) { - if t.IsPrivateUse() { - return t, errPrivateUse - } - if len(key) != 2 { - return t, errInvalidArguments - } - - // Remove the setting if value is "". - if value == "" { - start, end, _ := t.findTypeForKey(key) - if start != end { - // Remove key tag and leading '-'. - start -= 4 - - // Remove a possible empty extension. - if (end == len(t.str) || t.str[end+2] == '-') && t.str[start-2] == '-' { - start -= 2 - } - if start == int(t.pVariant) && end == len(t.str) { - t.str = "" - t.pVariant, t.pExt = 0, 0 - } else { - t.str = fmt.Sprintf("%s%s", t.str[:start], t.str[end:]) - } - } - return t, nil - } - - if len(value) < 3 || len(value) > 8 { - return t, errInvalidArguments - } - - var ( - buf [maxCoreSize + maxSimpleUExtensionSize]byte - uStart int // start of the -u extension. - ) - - // Generate the tag string if needed. - if t.str == "" { - uStart = t.genCoreBytes(buf[:]) - buf[uStart] = '-' - uStart++ - } - - // Create new key-type pair and parse it to verify. - b := buf[uStart:] - copy(b, "u-") - copy(b[2:], key) - b[4] = '-' - b = b[:5+copy(b[5:], value)] - scan := makeScanner(b) - if parseExtensions(&scan); scan.err != nil { - return t, scan.err - } - - // Assemble the replacement string. - if t.str == "" { - t.pVariant, t.pExt = byte(uStart-1), uint16(uStart-1) - t.str = string(buf[:uStart+len(b)]) - } else { - s := t.str - start, end, hasExt := t.findTypeForKey(key) - if start == end { - if hasExt { - b = b[2:] - } - t.str = fmt.Sprintf("%s-%s%s", s[:start], b, s[end:]) - } else { - t.str = fmt.Sprintf("%s%s%s", s[:start], value, s[end:]) - } - } - return t, nil -} - -// findKeyAndType returns the start and end position for the type corresponding -// to key or the point at which to insert the key-value pair if the type -// wasn't found. The hasExt return value reports whether an -u extension was present. -// Note: the extensions are typically very small and are likely to contain -// only one key-type pair. -func (t Tag) findTypeForKey(key string) (start, end int, hasExt bool) { - p := int(t.pExt) - if len(key) != 2 || p == len(t.str) || p == 0 { - return p, p, false - } - s := t.str - - // Find the correct extension. - for p++; s[p] != 'u'; p++ { - if s[p] > 'u' { - p-- - return p, p, false - } - if p = nextExtension(s, p); p == len(s) { - return len(s), len(s), false - } - } - // Proceed to the hyphen following the extension name. - p++ - - // curKey is the key currently being processed. - curKey := "" - - // Iterate over keys until we get the end of a section. - for { - // p points to the hyphen preceding the current token. - if p3 := p + 3; s[p3] == '-' { - // Found a key. - // Check whether we just processed the key that was requested. - if curKey == key { - return start, p, true - } - // Set to the next key and continue scanning type tokens. - curKey = s[p+1 : p3] - if curKey > key { - return p, p, true - } - // Start of the type token sequence. - start = p + 4 - // A type is at least 3 characters long. - p += 7 // 4 + 3 - } else { - // Attribute or type, which is at least 3 characters long. - p += 4 - } - // p points past the third character of a type or attribute. - max := p + 5 // maximum length of token plus hyphen. - if len(s) < max { - max = len(s) - } - for ; p < max && s[p] != '-'; p++ { - } - // Bail if we have exhausted all tokens or if the next token starts - // a new extension. - if p == len(s) || s[p+2] == '-' { - if curKey == key { - return start, p, true - } - return p, p, true - } - } -} - -// ParseBase parses a 2- or 3-letter ISO 639 code. -// It returns a ValueError if s is a well-formed but unknown language identifier -// or another error if another error occurred. -func ParseBase(s string) (Language, error) { - if n := len(s); n < 2 || 3 < n { - return 0, ErrSyntax - } - var buf [3]byte - return getLangID(buf[:copy(buf[:], s)]) -} - -// ParseScript parses a 4-letter ISO 15924 code. -// It returns a ValueError if s is a well-formed but unknown script identifier -// or another error if another error occurred. -func ParseScript(s string) (Script, error) { - if len(s) != 4 { - return 0, ErrSyntax - } - var buf [4]byte - return getScriptID(script, buf[:copy(buf[:], s)]) -} - -// EncodeM49 returns the Region for the given UN M.49 code. -// It returns an error if r is not a valid code. -func EncodeM49(r int) (Region, error) { - return getRegionM49(r) -} - -// ParseRegion parses a 2- or 3-letter ISO 3166-1 or a UN M.49 code. -// It returns a ValueError if s is a well-formed but unknown region identifier -// or another error if another error occurred. -func ParseRegion(s string) (Region, error) { - if n := len(s); n < 2 || 3 < n { - return 0, ErrSyntax - } - var buf [3]byte - return getRegionID(buf[:copy(buf[:], s)]) -} - -// IsCountry returns whether this region is a country or autonomous area. This -// includes non-standard definitions from CLDR. -func (r Region) IsCountry() bool { - if r == 0 || r.IsGroup() || r.IsPrivateUse() && r != _XK { - return false - } - return true -} - -// IsGroup returns whether this region defines a collection of regions. This -// includes non-standard definitions from CLDR. -func (r Region) IsGroup() bool { - if r == 0 { - return false - } - return int(regionInclusion[r]) < len(regionContainment) -} - -// Contains returns whether Region c is contained by Region r. It returns true -// if c == r. -func (r Region) Contains(c Region) bool { - if r == c { - return true - } - g := regionInclusion[r] - if g >= nRegionGroups { - return false - } - m := regionContainment[g] - - d := regionInclusion[c] - b := regionInclusionBits[d] - - // A contained country may belong to multiple disjoint groups. Matching any - // of these indicates containment. If the contained region is a group, it - // must strictly be a subset. - if d >= nRegionGroups { - return b&m != 0 - } - return b&^m == 0 -} - -var errNoTLD = errors.New("language: region is not a valid ccTLD") - -// TLD returns the country code top-level domain (ccTLD). UK is returned for GB. -// In all other cases it returns either the region itself or an error. -// -// This method may return an error for a region for which there exists a -// canonical form with a ccTLD. To get that ccTLD canonicalize r first. The -// region will already be canonicalized it was obtained from a Tag that was -// obtained using any of the default methods. -func (r Region) TLD() (Region, error) { - // See http://en.wikipedia.org/wiki/Country_code_top-level_domain for the - // difference between ISO 3166-1 and IANA ccTLD. - if r == _GB { - r = _UK - } - if (r.typ() & ccTLD) == 0 { - return 0, errNoTLD - } - return r, nil -} - -// Canonicalize returns the region or a possible replacement if the region is -// deprecated. It will not return a replacement for deprecated regions that -// are split into multiple regions. -func (r Region) Canonicalize() Region { - if cr := normRegion(r); cr != 0 { - return cr - } - return r -} - -// Variant represents a registered variant of a language as defined by BCP 47. -type Variant struct { - ID uint8 - str string -} - -// ParseVariant parses and returns a Variant. An error is returned if s is not -// a valid variant. -func ParseVariant(s string) (Variant, error) { - s = strings.ToLower(s) - if id, ok := variantIndex[s]; ok { - return Variant{id, s}, nil - } - return Variant{}, NewValueError([]byte(s)) -} - -// String returns the string representation of the variant. -func (v Variant) String() string { - return v.str -} diff --git a/vendor/golang.org/x/text/internal/language/match.go b/vendor/golang.org/x/text/internal/language/match.go deleted file mode 100644 index 75a2dbca..00000000 --- a/vendor/golang.org/x/text/internal/language/match.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -import "errors" - -type scriptRegionFlags uint8 - -const ( - isList = 1 << iota - scriptInFrom - regionInFrom -) - -func (t *Tag) setUndefinedLang(id Language) { - if t.LangID == 0 { - t.LangID = id - } -} - -func (t *Tag) setUndefinedScript(id Script) { - if t.ScriptID == 0 { - t.ScriptID = id - } -} - -func (t *Tag) setUndefinedRegion(id Region) { - if t.RegionID == 0 || t.RegionID.Contains(id) { - t.RegionID = id - } -} - -// ErrMissingLikelyTagsData indicates no information was available -// to compute likely values of missing tags. -var ErrMissingLikelyTagsData = errors.New("missing likely tags data") - -// addLikelySubtags sets subtags to their most likely value, given the locale. -// In most cases this means setting fields for unknown values, but in some -// cases it may alter a value. It returns an ErrMissingLikelyTagsData error -// if the given locale cannot be expanded. -func (t Tag) addLikelySubtags() (Tag, error) { - id, err := addTags(t) - if err != nil { - return t, err - } else if id.equalTags(t) { - return t, nil - } - id.RemakeString() - return id, nil -} - -// specializeRegion attempts to specialize a group region. -func specializeRegion(t *Tag) bool { - if i := regionInclusion[t.RegionID]; i < nRegionGroups { - x := likelyRegionGroup[i] - if Language(x.lang) == t.LangID && Script(x.script) == t.ScriptID { - t.RegionID = Region(x.region) - } - return true - } - return false -} - -// Maximize returns a new tag with missing tags filled in. -func (t Tag) Maximize() (Tag, error) { - return addTags(t) -} - -func addTags(t Tag) (Tag, error) { - // We leave private use identifiers alone. - if t.IsPrivateUse() { - return t, nil - } - if t.ScriptID != 0 && t.RegionID != 0 { - if t.LangID != 0 { - // already fully specified - specializeRegion(&t) - return t, nil - } - // Search matches for und-script-region. Note that for these cases - // region will never be a group so there is no need to check for this. - list := likelyRegion[t.RegionID : t.RegionID+1] - if x := list[0]; x.flags&isList != 0 { - list = likelyRegionList[x.lang : x.lang+uint16(x.script)] - } - for _, x := range list { - // Deviating from the spec. See match_test.go for details. - if Script(x.script) == t.ScriptID { - t.setUndefinedLang(Language(x.lang)) - return t, nil - } - } - } - if t.LangID != 0 { - // Search matches for lang-script and lang-region, where lang != und. - if t.LangID < langNoIndexOffset { - x := likelyLang[t.LangID] - if x.flags&isList != 0 { - list := likelyLangList[x.region : x.region+uint16(x.script)] - if t.ScriptID != 0 { - for _, x := range list { - if Script(x.script) == t.ScriptID && x.flags&scriptInFrom != 0 { - t.setUndefinedRegion(Region(x.region)) - return t, nil - } - } - } else if t.RegionID != 0 { - count := 0 - goodScript := true - tt := t - for _, x := range list { - // We visit all entries for which the script was not - // defined, including the ones where the region was not - // defined. This allows for proper disambiguation within - // regions. - if x.flags&scriptInFrom == 0 && t.RegionID.Contains(Region(x.region)) { - tt.RegionID = Region(x.region) - tt.setUndefinedScript(Script(x.script)) - goodScript = goodScript && tt.ScriptID == Script(x.script) - count++ - } - } - if count == 1 { - return tt, nil - } - // Even if we fail to find a unique Region, we might have - // an unambiguous script. - if goodScript { - t.ScriptID = tt.ScriptID - } - } - } - } - } else { - // Search matches for und-script. - if t.ScriptID != 0 { - x := likelyScript[t.ScriptID] - if x.region != 0 { - t.setUndefinedRegion(Region(x.region)) - t.setUndefinedLang(Language(x.lang)) - return t, nil - } - } - // Search matches for und-region. If und-script-region exists, it would - // have been found earlier. - if t.RegionID != 0 { - if i := regionInclusion[t.RegionID]; i < nRegionGroups { - x := likelyRegionGroup[i] - if x.region != 0 { - t.setUndefinedLang(Language(x.lang)) - t.setUndefinedScript(Script(x.script)) - t.RegionID = Region(x.region) - } - } else { - x := likelyRegion[t.RegionID] - if x.flags&isList != 0 { - x = likelyRegionList[x.lang] - } - if x.script != 0 && x.flags != scriptInFrom { - t.setUndefinedLang(Language(x.lang)) - t.setUndefinedScript(Script(x.script)) - return t, nil - } - } - } - } - - // Search matches for lang. - if t.LangID < langNoIndexOffset { - x := likelyLang[t.LangID] - if x.flags&isList != 0 { - x = likelyLangList[x.region] - } - if x.region != 0 { - t.setUndefinedScript(Script(x.script)) - t.setUndefinedRegion(Region(x.region)) - } - specializeRegion(&t) - if t.LangID == 0 { - t.LangID = _en // default language - } - return t, nil - } - return t, ErrMissingLikelyTagsData -} - -func (t *Tag) setTagsFrom(id Tag) { - t.LangID = id.LangID - t.ScriptID = id.ScriptID - t.RegionID = id.RegionID -} - -// minimize removes the region or script subtags from t such that -// t.addLikelySubtags() == t.minimize().addLikelySubtags(). -func (t Tag) minimize() (Tag, error) { - t, err := minimizeTags(t) - if err != nil { - return t, err - } - t.RemakeString() - return t, nil -} - -// minimizeTags mimics the behavior of the ICU 51 C implementation. -func minimizeTags(t Tag) (Tag, error) { - if t.equalTags(Und) { - return t, nil - } - max, err := addTags(t) - if err != nil { - return t, err - } - for _, id := range [...]Tag{ - {LangID: t.LangID}, - {LangID: t.LangID, RegionID: t.RegionID}, - {LangID: t.LangID, ScriptID: t.ScriptID}, - } { - if x, err := addTags(id); err == nil && max.equalTags(x) { - t.setTagsFrom(id) - break - } - } - return t, nil -} diff --git a/vendor/golang.org/x/text/internal/language/parse.go b/vendor/golang.org/x/text/internal/language/parse.go deleted file mode 100644 index 2be83e1d..00000000 --- a/vendor/golang.org/x/text/internal/language/parse.go +++ /dev/null @@ -1,594 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -import ( - "bytes" - "errors" - "fmt" - "sort" - - "golang.org/x/text/internal/tag" -) - -// isAlpha returns true if the byte is not a digit. -// b must be an ASCII letter or digit. -func isAlpha(b byte) bool { - return b > '9' -} - -// isAlphaNum returns true if the string contains only ASCII letters or digits. -func isAlphaNum(s []byte) bool { - for _, c := range s { - if !('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9') { - return false - } - } - return true -} - -// ErrSyntax is returned by any of the parsing functions when the -// input is not well-formed, according to BCP 47. -// TODO: return the position at which the syntax error occurred? -var ErrSyntax = errors.New("language: tag is not well-formed") - -// ErrDuplicateKey is returned when a tag contains the same key twice with -// different values in the -u section. -var ErrDuplicateKey = errors.New("language: different values for same key in -u extension") - -// ValueError is returned by any of the parsing functions when the -// input is well-formed but the respective subtag is not recognized -// as a valid value. -type ValueError struct { - v [8]byte -} - -// NewValueError creates a new ValueError. -func NewValueError(tag []byte) ValueError { - var e ValueError - copy(e.v[:], tag) - return e -} - -func (e ValueError) tag() []byte { - n := bytes.IndexByte(e.v[:], 0) - if n == -1 { - n = 8 - } - return e.v[:n] -} - -// Error implements the error interface. -func (e ValueError) Error() string { - return fmt.Sprintf("language: subtag %q is well-formed but unknown", e.tag()) -} - -// Subtag returns the subtag for which the error occurred. -func (e ValueError) Subtag() string { - return string(e.tag()) -} - -// scanner is used to scan BCP 47 tokens, which are separated by _ or -. -type scanner struct { - b []byte - bytes [max99thPercentileSize]byte - token []byte - start int // start position of the current token - end int // end position of the current token - next int // next point for scan - err error - done bool -} - -func makeScannerString(s string) scanner { - scan := scanner{} - if len(s) <= len(scan.bytes) { - scan.b = scan.bytes[:copy(scan.bytes[:], s)] - } else { - scan.b = []byte(s) - } - scan.init() - return scan -} - -// makeScanner returns a scanner using b as the input buffer. -// b is not copied and may be modified by the scanner routines. -func makeScanner(b []byte) scanner { - scan := scanner{b: b} - scan.init() - return scan -} - -func (s *scanner) init() { - for i, c := range s.b { - if c == '_' { - s.b[i] = '-' - } - } - s.scan() -} - -// restToLower converts the string between start and end to lower case. -func (s *scanner) toLower(start, end int) { - for i := start; i < end; i++ { - c := s.b[i] - if 'A' <= c && c <= 'Z' { - s.b[i] += 'a' - 'A' - } - } -} - -func (s *scanner) setError(e error) { - if s.err == nil || (e == ErrSyntax && s.err != ErrSyntax) { - s.err = e - } -} - -// resizeRange shrinks or grows the array at position oldStart such that -// a new string of size newSize can fit between oldStart and oldEnd. -// Sets the scan point to after the resized range. -func (s *scanner) resizeRange(oldStart, oldEnd, newSize int) { - s.start = oldStart - if end := oldStart + newSize; end != oldEnd { - diff := end - oldEnd - if end < cap(s.b) { - b := make([]byte, len(s.b)+diff) - copy(b, s.b[:oldStart]) - copy(b[end:], s.b[oldEnd:]) - s.b = b - } else { - s.b = append(s.b[end:], s.b[oldEnd:]...) - } - s.next = end + (s.next - s.end) - s.end = end - } -} - -// replace replaces the current token with repl. -func (s *scanner) replace(repl string) { - s.resizeRange(s.start, s.end, len(repl)) - copy(s.b[s.start:], repl) -} - -// gobble removes the current token from the input. -// Caller must call scan after calling gobble. -func (s *scanner) gobble(e error) { - s.setError(e) - if s.start == 0 { - s.b = s.b[:+copy(s.b, s.b[s.next:])] - s.end = 0 - } else { - s.b = s.b[:s.start-1+copy(s.b[s.start-1:], s.b[s.end:])] - s.end = s.start - 1 - } - s.next = s.start -} - -// deleteRange removes the given range from s.b before the current token. -func (s *scanner) deleteRange(start, end int) { - s.b = s.b[:start+copy(s.b[start:], s.b[end:])] - diff := end - start - s.next -= diff - s.start -= diff - s.end -= diff -} - -// scan parses the next token of a BCP 47 string. Tokens that are larger -// than 8 characters or include non-alphanumeric characters result in an error -// and are gobbled and removed from the output. -// It returns the end position of the last token consumed. -func (s *scanner) scan() (end int) { - end = s.end - s.token = nil - for s.start = s.next; s.next < len(s.b); { - i := bytes.IndexByte(s.b[s.next:], '-') - if i == -1 { - s.end = len(s.b) - s.next = len(s.b) - i = s.end - s.start - } else { - s.end = s.next + i - s.next = s.end + 1 - } - token := s.b[s.start:s.end] - if i < 1 || i > 8 || !isAlphaNum(token) { - s.gobble(ErrSyntax) - continue - } - s.token = token - return end - } - if n := len(s.b); n > 0 && s.b[n-1] == '-' { - s.setError(ErrSyntax) - s.b = s.b[:len(s.b)-1] - } - s.done = true - return end -} - -// acceptMinSize parses multiple tokens of the given size or greater. -// It returns the end position of the last token consumed. -func (s *scanner) acceptMinSize(min int) (end int) { - end = s.end - s.scan() - for ; len(s.token) >= min; s.scan() { - end = s.end - } - return end -} - -// Parse parses the given BCP 47 string and returns a valid Tag. If parsing -// failed it returns an error and any part of the tag that could be parsed. -// If parsing succeeded but an unknown value was found, it returns -// ValueError. The Tag returned in this case is just stripped of the unknown -// value. All other values are preserved. It accepts tags in the BCP 47 format -// and extensions to this standard defined in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. -func Parse(s string) (t Tag, err error) { - // TODO: consider supporting old-style locale key-value pairs. - if s == "" { - return Und, ErrSyntax - } - if len(s) <= maxAltTaglen { - b := [maxAltTaglen]byte{} - for i, c := range s { - // Generating invalid UTF-8 is okay as it won't match. - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } else if c == '_' { - c = '-' - } - b[i] = byte(c) - } - if t, ok := grandfathered(b); ok { - return t, nil - } - } - scan := makeScannerString(s) - return parse(&scan, s) -} - -func parse(scan *scanner, s string) (t Tag, err error) { - t = Und - var end int - if n := len(scan.token); n <= 1 { - scan.toLower(0, len(scan.b)) - if n == 0 || scan.token[0] != 'x' { - return t, ErrSyntax - } - end = parseExtensions(scan) - } else if n >= 4 { - return Und, ErrSyntax - } else { // the usual case - t, end = parseTag(scan) - if n := len(scan.token); n == 1 { - t.pExt = uint16(end) - end = parseExtensions(scan) - } else if end < len(scan.b) { - scan.setError(ErrSyntax) - scan.b = scan.b[:end] - } - } - if int(t.pVariant) < len(scan.b) { - if end < len(s) { - s = s[:end] - } - if len(s) > 0 && tag.Compare(s, scan.b) == 0 { - t.str = s - } else { - t.str = string(scan.b) - } - } else { - t.pVariant, t.pExt = 0, 0 - } - return t, scan.err -} - -// parseTag parses language, script, region and variants. -// It returns a Tag and the end position in the input that was parsed. -func parseTag(scan *scanner) (t Tag, end int) { - var e error - // TODO: set an error if an unknown lang, script or region is encountered. - t.LangID, e = getLangID(scan.token) - scan.setError(e) - scan.replace(t.LangID.String()) - langStart := scan.start - end = scan.scan() - for len(scan.token) == 3 && isAlpha(scan.token[0]) { - // From http://tools.ietf.org/html/bcp47, - tags are equivalent - // to a tag of the form . - lang, e := getLangID(scan.token) - if lang != 0 { - t.LangID = lang - copy(scan.b[langStart:], lang.String()) - scan.b[langStart+3] = '-' - scan.start = langStart + 4 - } - scan.gobble(e) - end = scan.scan() - } - if len(scan.token) == 4 && isAlpha(scan.token[0]) { - t.ScriptID, e = getScriptID(script, scan.token) - if t.ScriptID == 0 { - scan.gobble(e) - } - end = scan.scan() - } - if n := len(scan.token); n >= 2 && n <= 3 { - t.RegionID, e = getRegionID(scan.token) - if t.RegionID == 0 { - scan.gobble(e) - } else { - scan.replace(t.RegionID.String()) - } - end = scan.scan() - } - scan.toLower(scan.start, len(scan.b)) - t.pVariant = byte(end) - end = parseVariants(scan, end, t) - t.pExt = uint16(end) - return t, end -} - -var separator = []byte{'-'} - -// parseVariants scans tokens as long as each token is a valid variant string. -// Duplicate variants are removed. -func parseVariants(scan *scanner, end int, t Tag) int { - start := scan.start - varIDBuf := [4]uint8{} - variantBuf := [4][]byte{} - varID := varIDBuf[:0] - variant := variantBuf[:0] - last := -1 - needSort := false - for ; len(scan.token) >= 4; scan.scan() { - // TODO: measure the impact of needing this conversion and redesign - // the data structure if there is an issue. - v, ok := variantIndex[string(scan.token)] - if !ok { - // unknown variant - // TODO: allow user-defined variants? - scan.gobble(NewValueError(scan.token)) - continue - } - varID = append(varID, v) - variant = append(variant, scan.token) - if !needSort { - if last < int(v) { - last = int(v) - } else { - needSort = true - // There is no legal combinations of more than 7 variants - // (and this is by no means a useful sequence). - const maxVariants = 8 - if len(varID) > maxVariants { - break - } - } - } - end = scan.end - } - if needSort { - sort.Sort(variantsSort{varID, variant}) - k, l := 0, -1 - for i, v := range varID { - w := int(v) - if l == w { - // Remove duplicates. - continue - } - varID[k] = varID[i] - variant[k] = variant[i] - k++ - l = w - } - if str := bytes.Join(variant[:k], separator); len(str) == 0 { - end = start - 1 - } else { - scan.resizeRange(start, end, len(str)) - copy(scan.b[scan.start:], str) - end = scan.end - } - } - return end -} - -type variantsSort struct { - i []uint8 - v [][]byte -} - -func (s variantsSort) Len() int { - return len(s.i) -} - -func (s variantsSort) Swap(i, j int) { - s.i[i], s.i[j] = s.i[j], s.i[i] - s.v[i], s.v[j] = s.v[j], s.v[i] -} - -func (s variantsSort) Less(i, j int) bool { - return s.i[i] < s.i[j] -} - -type bytesSort struct { - b [][]byte - n int // first n bytes to compare -} - -func (b bytesSort) Len() int { - return len(b.b) -} - -func (b bytesSort) Swap(i, j int) { - b.b[i], b.b[j] = b.b[j], b.b[i] -} - -func (b bytesSort) Less(i, j int) bool { - for k := 0; k < b.n; k++ { - if b.b[i][k] == b.b[j][k] { - continue - } - return b.b[i][k] < b.b[j][k] - } - return false -} - -// parseExtensions parses and normalizes the extensions in the buffer. -// It returns the last position of scan.b that is part of any extension. -// It also trims scan.b to remove excess parts accordingly. -func parseExtensions(scan *scanner) int { - start := scan.start - exts := [][]byte{} - private := []byte{} - end := scan.end - for len(scan.token) == 1 { - extStart := scan.start - ext := scan.token[0] - end = parseExtension(scan) - extension := scan.b[extStart:end] - if len(extension) < 3 || (ext != 'x' && len(extension) < 4) { - scan.setError(ErrSyntax) - end = extStart - continue - } else if start == extStart && (ext == 'x' || scan.start == len(scan.b)) { - scan.b = scan.b[:end] - return end - } else if ext == 'x' { - private = extension - break - } - exts = append(exts, extension) - } - sort.Sort(bytesSort{exts, 1}) - if len(private) > 0 { - exts = append(exts, private) - } - scan.b = scan.b[:start] - if len(exts) > 0 { - scan.b = append(scan.b, bytes.Join(exts, separator)...) - } else if start > 0 { - // Strip trailing '-'. - scan.b = scan.b[:start-1] - } - return end -} - -// parseExtension parses a single extension and returns the position of -// the extension end. -func parseExtension(scan *scanner) int { - start, end := scan.start, scan.end - switch scan.token[0] { - case 'u': - attrStart := end - scan.scan() - for last := []byte{}; len(scan.token) > 2; scan.scan() { - if bytes.Compare(scan.token, last) != -1 { - // Attributes are unsorted. Start over from scratch. - p := attrStart + 1 - scan.next = p - attrs := [][]byte{} - for scan.scan(); len(scan.token) > 2; scan.scan() { - attrs = append(attrs, scan.token) - end = scan.end - } - sort.Sort(bytesSort{attrs, 3}) - copy(scan.b[p:], bytes.Join(attrs, separator)) - break - } - last = scan.token - end = scan.end - } - var last, key []byte - for attrEnd := end; len(scan.token) == 2; last = key { - key = scan.token - keyEnd := scan.end - end = scan.acceptMinSize(3) - // TODO: check key value validity - if keyEnd == end || bytes.Compare(key, last) != 1 { - // We have an invalid key or the keys are not sorted. - // Start scanning keys from scratch and reorder. - p := attrEnd + 1 - scan.next = p - keys := [][]byte{} - for scan.scan(); len(scan.token) == 2; { - keyStart, keyEnd := scan.start, scan.end - end = scan.acceptMinSize(3) - if keyEnd != end { - keys = append(keys, scan.b[keyStart:end]) - } else { - scan.setError(ErrSyntax) - end = keyStart - } - } - sort.Stable(bytesSort{keys, 2}) - if n := len(keys); n > 0 { - k := 0 - for i := 1; i < n; i++ { - if !bytes.Equal(keys[k][:2], keys[i][:2]) { - k++ - keys[k] = keys[i] - } else if !bytes.Equal(keys[k], keys[i]) { - scan.setError(ErrDuplicateKey) - } - } - keys = keys[:k+1] - } - reordered := bytes.Join(keys, separator) - if e := p + len(reordered); e < end { - scan.deleteRange(e, end) - end = e - } - copy(scan.b[p:], reordered) - break - } - } - case 't': - scan.scan() - if n := len(scan.token); n >= 2 && n <= 3 && isAlpha(scan.token[1]) { - _, end = parseTag(scan) - scan.toLower(start, end) - } - for len(scan.token) == 2 && !isAlpha(scan.token[1]) { - end = scan.acceptMinSize(3) - } - case 'x': - end = scan.acceptMinSize(1) - default: - end = scan.acceptMinSize(2) - } - return end -} - -// getExtension returns the name, body and end position of the extension. -func getExtension(s string, p int) (end int, ext string) { - if s[p] == '-' { - p++ - } - if s[p] == 'x' { - return len(s), s[p:] - } - end = nextExtension(s, p) - return end, s[p:end] -} - -// nextExtension finds the next extension within the string, searching -// for the -- pattern from position p. -// In the fast majority of cases, language tags will have at most -// one extension and extensions tend to be small. -func nextExtension(s string, p int) int { - for n := len(s) - 3; p < n; { - if s[p] == '-' { - if s[p+2] == '-' { - return p - } - p += 3 - } else { - p++ - } - } - return len(s) -} diff --git a/vendor/golang.org/x/text/internal/language/tables.go b/vendor/golang.org/x/text/internal/language/tables.go deleted file mode 100644 index 239e2d29..00000000 --- a/vendor/golang.org/x/text/internal/language/tables.go +++ /dev/null @@ -1,3431 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package language - -import "golang.org/x/text/internal/tag" - -// CLDRVersion is the CLDR version from which the tables in this package are derived. -const CLDRVersion = "32" - -const NumLanguages = 8665 - -const NumScripts = 242 - -const NumRegions = 357 - -type FromTo struct { - From uint16 - To uint16 -} - -const nonCanonicalUnd = 1201 -const ( - _af = 22 - _am = 39 - _ar = 58 - _az = 88 - _bg = 126 - _bn = 165 - _ca = 215 - _cs = 250 - _da = 257 - _de = 269 - _el = 310 - _en = 313 - _es = 318 - _et = 320 - _fa = 328 - _fi = 337 - _fil = 339 - _fr = 350 - _gu = 420 - _he = 444 - _hi = 446 - _hr = 465 - _hu = 469 - _hy = 471 - _id = 481 - _is = 504 - _it = 505 - _ja = 512 - _ka = 528 - _kk = 578 - _km = 586 - _kn = 593 - _ko = 596 - _ky = 650 - _lo = 696 - _lt = 704 - _lv = 711 - _mk = 767 - _ml = 772 - _mn = 779 - _mo = 784 - _mr = 795 - _ms = 799 - _mul = 806 - _my = 817 - _nb = 839 - _ne = 849 - _nl = 871 - _no = 879 - _pa = 925 - _pl = 947 - _pt = 960 - _ro = 988 - _ru = 994 - _sh = 1031 - _si = 1036 - _sk = 1042 - _sl = 1046 - _sq = 1073 - _sr = 1074 - _sv = 1092 - _sw = 1093 - _ta = 1104 - _te = 1121 - _th = 1131 - _tl = 1146 - _tn = 1152 - _tr = 1162 - _uk = 1198 - _ur = 1204 - _uz = 1212 - _vi = 1219 - _zh = 1321 - _zu = 1327 - _jbo = 515 - _ami = 1650 - _bnn = 2357 - _hak = 438 - _tlh = 14467 - _lb = 661 - _nv = 899 - _pwn = 12055 - _tao = 14188 - _tay = 14198 - _tsu = 14662 - _nn = 874 - _sfb = 13629 - _vgt = 15701 - _sgg = 13660 - _cmn = 3007 - _nan = 835 - _hsn = 467 -) - -const langPrivateStart = 0x2f72 - -const langPrivateEnd = 0x3179 - -// lang holds an alphabetically sorted list of ISO-639 language identifiers. -// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. -// For 2-byte language identifiers, the two successive bytes have the following meaning: -// - if the first letter of the 2- and 3-letter ISO codes are the same: -// the second and third letter of the 3-letter ISO code. -// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. -// For 3-byte language identifiers the 4th byte is 0. -const lang tag.Index = "" + // Size: 5324 bytes - "---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abq\x00abr\x00abt\x00aby\x00a" + - "cd\x00ace\x00ach\x00ada\x00ade\x00adj\x00ady\x00adz\x00aeveaeb\x00aey" + - "\x00affragc\x00agd\x00agg\x00agm\x00ago\x00agq\x00aha\x00ahl\x00aho\x00a" + - "jg\x00akkaakk\x00ala\x00ali\x00aln\x00alt\x00ammhamm\x00amn\x00amo\x00am" + - "p\x00anrganc\x00ank\x00ann\x00any\x00aoj\x00aom\x00aoz\x00apc\x00apd\x00" + - "ape\x00apr\x00aps\x00apz\x00arraarc\x00arh\x00arn\x00aro\x00arq\x00ars" + - "\x00ary\x00arz\x00assmasa\x00ase\x00asg\x00aso\x00ast\x00ata\x00atg\x00a" + - "tj\x00auy\x00avvaavl\x00avn\x00avt\x00avu\x00awa\x00awb\x00awo\x00awx" + - "\x00ayymayb\x00azzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bav\x00bax\x00" + - "bba\x00bbb\x00bbc\x00bbd\x00bbj\x00bbp\x00bbr\x00bcf\x00bch\x00bci\x00bc" + - "m\x00bcn\x00bco\x00bcq\x00bcu\x00bdd\x00beelbef\x00beh\x00bej\x00bem\x00" + - "bet\x00bew\x00bex\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc\x00bgn" + - "\x00bgx\x00bhihbhb\x00bhg\x00bhi\x00bhk\x00bhl\x00bho\x00bhy\x00biisbib" + - "\x00big\x00bik\x00bim\x00bin\x00bio\x00biq\x00bjh\x00bji\x00bjj\x00bjn" + - "\x00bjo\x00bjr\x00bjt\x00bjz\x00bkc\x00bkm\x00bkq\x00bku\x00bkv\x00blt" + - "\x00bmambmh\x00bmk\x00bmq\x00bmu\x00bnenbng\x00bnm\x00bnp\x00boodboj\x00" + - "bom\x00bon\x00bpy\x00bqc\x00bqi\x00bqp\x00bqv\x00brrebra\x00brh\x00brx" + - "\x00brz\x00bsosbsj\x00bsq\x00bss\x00bst\x00bto\x00btt\x00btv\x00bua\x00b" + - "uc\x00bud\x00bug\x00buk\x00bum\x00buo\x00bus\x00buu\x00bvb\x00bwd\x00bwr" + - "\x00bxh\x00bye\x00byn\x00byr\x00bys\x00byv\x00byx\x00bza\x00bze\x00bzf" + - "\x00bzh\x00bzw\x00caatcan\x00cbj\x00cch\x00ccp\x00ceheceb\x00cfa\x00cgg" + - "\x00chhachk\x00chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00cjv\x00ckb\x00c" + - "kl\x00cko\x00cky\x00cla\x00cme\x00cmg\x00cooscop\x00cps\x00crrecrh\x00cr" + - "j\x00crk\x00crl\x00crm\x00crs\x00csescsb\x00csw\x00ctd\x00cuhucvhvcyymda" + - "andad\x00daf\x00dag\x00dah\x00dak\x00dar\x00dav\x00dbd\x00dbq\x00dcc\x00" + - "ddn\x00deeuded\x00den\x00dga\x00dgh\x00dgi\x00dgl\x00dgr\x00dgz\x00dia" + - "\x00dje\x00dnj\x00dob\x00doi\x00dop\x00dow\x00dri\x00drs\x00dsb\x00dtm" + - "\x00dtp\x00dts\x00dty\x00dua\x00duc\x00dud\x00dug\x00dvivdva\x00dww\x00d" + - "yo\x00dyu\x00dzzodzg\x00ebu\x00eeweefi\x00egl\x00egy\x00eka\x00eky\x00el" + - "llema\x00emi\x00enngenn\x00enq\x00eopoeri\x00es\x00\x05esu\x00etstetr" + - "\x00ett\x00etu\x00etx\x00euusewo\x00ext\x00faasfaa\x00fab\x00fag\x00fai" + - "\x00fan\x00ffulffi\x00ffm\x00fiinfia\x00fil\x00fit\x00fjijflr\x00fmp\x00" + - "foaofod\x00fon\x00for\x00fpe\x00fqs\x00frrafrc\x00frp\x00frr\x00frs\x00f" + - "ub\x00fud\x00fue\x00fuf\x00fuh\x00fuq\x00fur\x00fuv\x00fuy\x00fvr\x00fyr" + - "ygalegaa\x00gaf\x00gag\x00gah\x00gaj\x00gam\x00gan\x00gaw\x00gay\x00gba" + - "\x00gbf\x00gbm\x00gby\x00gbz\x00gcr\x00gdlagde\x00gdn\x00gdr\x00geb\x00g" + - "ej\x00gel\x00gez\x00gfk\x00ggn\x00ghs\x00gil\x00gim\x00gjk\x00gjn\x00gju" + - "\x00gkn\x00gkp\x00gllgglk\x00gmm\x00gmv\x00gnrngnd\x00gng\x00god\x00gof" + - "\x00goi\x00gom\x00gon\x00gor\x00gos\x00got\x00grb\x00grc\x00grt\x00grw" + - "\x00gsw\x00guujgub\x00guc\x00gud\x00gur\x00guw\x00gux\x00guz\x00gvlvgvf" + - "\x00gvr\x00gvs\x00gwc\x00gwi\x00gwt\x00gyi\x00haauhag\x00hak\x00ham\x00h" + - "aw\x00haz\x00hbb\x00hdy\x00heebhhy\x00hiinhia\x00hif\x00hig\x00hih\x00hi" + - "l\x00hla\x00hlu\x00hmd\x00hmt\x00hnd\x00hne\x00hnj\x00hnn\x00hno\x00homo" + - "hoc\x00hoj\x00hot\x00hrrvhsb\x00hsn\x00htathuunhui\x00hyyehzerianaian" + - "\x00iar\x00iba\x00ibb\x00iby\x00ica\x00ich\x00idndidd\x00idi\x00idu\x00i" + - "eleife\x00igboigb\x00ige\x00iiiiijj\x00ikpkikk\x00ikt\x00ikw\x00ikx\x00i" + - "lo\x00imo\x00inndinh\x00iodoiou\x00iri\x00isslittaiukuiw\x00\x03iwm\x00i" + - "ws\x00izh\x00izi\x00japnjab\x00jam\x00jbo\x00jbu\x00jen\x00jgk\x00jgo" + - "\x00ji\x00\x06jib\x00jmc\x00jml\x00jra\x00jut\x00jvavjwavkaatkaa\x00kab" + - "\x00kac\x00kad\x00kai\x00kaj\x00kam\x00kao\x00kbd\x00kbm\x00kbp\x00kbq" + - "\x00kbx\x00kby\x00kcg\x00kck\x00kcl\x00kct\x00kde\x00kdh\x00kdl\x00kdt" + - "\x00kea\x00ken\x00kez\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgf\x00kgp\x00k" + - "ha\x00khb\x00khn\x00khq\x00khs\x00kht\x00khw\x00khz\x00kiikkij\x00kiu" + - "\x00kiw\x00kjuakjd\x00kjg\x00kjs\x00kjy\x00kkazkkc\x00kkj\x00klalkln\x00" + - "klq\x00klt\x00klx\x00kmhmkmb\x00kmh\x00kmo\x00kms\x00kmu\x00kmw\x00knank" + - "nf\x00knp\x00koorkoi\x00kok\x00kol\x00kos\x00koz\x00kpe\x00kpf\x00kpo" + - "\x00kpr\x00kpx\x00kqb\x00kqf\x00kqs\x00kqy\x00kraukrc\x00kri\x00krj\x00k" + - "rl\x00krs\x00kru\x00ksasksb\x00ksd\x00ksf\x00ksh\x00ksj\x00ksr\x00ktb" + - "\x00ktm\x00kto\x00kuurkub\x00kud\x00kue\x00kuj\x00kum\x00kun\x00kup\x00k" + - "us\x00kvomkvg\x00kvr\x00kvx\x00kw\x00\x01kwj\x00kwo\x00kxa\x00kxc\x00kxm" + - "\x00kxp\x00kxw\x00kxz\x00kyirkye\x00kyx\x00kzr\x00laatlab\x00lad\x00lag" + - "\x00lah\x00laj\x00las\x00lbtzlbe\x00lbu\x00lbw\x00lcm\x00lcp\x00ldb\x00l" + - "ed\x00lee\x00lem\x00lep\x00leq\x00leu\x00lez\x00lguglgg\x00liimlia\x00li" + - "d\x00lif\x00lig\x00lih\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lle\x00lln" + - "\x00lmn\x00lmo\x00lmp\x00lninlns\x00lnu\x00loaoloj\x00lok\x00lol\x00lor" + - "\x00los\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy\x00luz\x00lvav" + - "lwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00man\x00mas\x00ma" + - "w\x00maz\x00mbh\x00mbo\x00mbq\x00mbu\x00mbw\x00mci\x00mcp\x00mcq\x00mcr" + - "\x00mcu\x00mda\x00mde\x00mdf\x00mdh\x00mdj\x00mdr\x00mdx\x00med\x00mee" + - "\x00mek\x00men\x00mer\x00met\x00meu\x00mfa\x00mfe\x00mfn\x00mfo\x00mfq" + - "\x00mglgmgh\x00mgl\x00mgo\x00mgp\x00mgy\x00mhahmhi\x00mhl\x00mirimif\x00" + - "min\x00mis\x00miw\x00mkkdmki\x00mkl\x00mkp\x00mkw\x00mlalmle\x00mlp\x00m" + - "ls\x00mmo\x00mmu\x00mmx\x00mnonmna\x00mnf\x00mni\x00mnw\x00moolmoa\x00mo" + - "e\x00moh\x00mos\x00mox\x00mpp\x00mps\x00mpt\x00mpx\x00mql\x00mrarmrd\x00" + - "mrj\x00mro\x00mssamtltmtc\x00mtf\x00mti\x00mtr\x00mua\x00mul\x00mur\x00m" + - "us\x00mva\x00mvn\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00mxm\x00myyamyk" + - "\x00mym\x00myv\x00myw\x00myx\x00myz\x00mzk\x00mzm\x00mzn\x00mzp\x00mzw" + - "\x00mzz\x00naaunac\x00naf\x00nah\x00nak\x00nan\x00nap\x00naq\x00nas\x00n" + - "bobnca\x00nce\x00ncf\x00nch\x00nco\x00ncu\x00nddendc\x00nds\x00neepneb" + - "\x00new\x00nex\x00nfr\x00ngdonga\x00ngb\x00ngl\x00nhb\x00nhe\x00nhw\x00n" + - "if\x00nii\x00nij\x00nin\x00niu\x00niy\x00niz\x00njo\x00nkg\x00nko\x00nll" + - "dnmg\x00nmz\x00nnnonnf\x00nnh\x00nnk\x00nnm\x00noornod\x00noe\x00non\x00" + - "nop\x00nou\x00nqo\x00nrblnrb\x00nsk\x00nsn\x00nso\x00nss\x00ntm\x00ntr" + - "\x00nui\x00nup\x00nus\x00nuv\x00nux\x00nvavnwb\x00nxq\x00nxr\x00nyyanym" + - "\x00nyn\x00nzi\x00occiogc\x00ojjiokr\x00okv\x00omrmong\x00onn\x00ons\x00" + - "opm\x00orrioro\x00oru\x00osssosa\x00ota\x00otk\x00ozm\x00paanpag\x00pal" + - "\x00pam\x00pap\x00pau\x00pbi\x00pcd\x00pcm\x00pdc\x00pdt\x00ped\x00peo" + - "\x00pex\x00pfl\x00phl\x00phn\x00pilipil\x00pip\x00pka\x00pko\x00plolpla" + - "\x00pms\x00png\x00pnn\x00pnt\x00pon\x00ppo\x00pra\x00prd\x00prg\x00psusp" + - "ss\x00ptorptp\x00puu\x00pwa\x00quuequc\x00qug\x00rai\x00raj\x00rao\x00rc" + - "f\x00rej\x00rel\x00res\x00rgn\x00rhg\x00ria\x00rif\x00rjs\x00rkt\x00rmoh" + - "rmf\x00rmo\x00rmt\x00rmu\x00rnunrna\x00rng\x00roonrob\x00rof\x00roo\x00r" + - "ro\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00rwo\x00ryu\x00saansaf" + - "\x00sah\x00saq\x00sas\x00sat\x00sav\x00saz\x00sba\x00sbe\x00sbp\x00scrds" + - "ck\x00scl\x00scn\x00sco\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00se" + - "i\x00ses\x00sgagsga\x00sgs\x00sgw\x00sgz\x00sh\x00\x02shi\x00shk\x00shn" + - "\x00shu\x00siinsid\x00sig\x00sil\x00sim\x00sjr\x00sklkskc\x00skr\x00sks" + - "\x00sllvsld\x00sli\x00sll\x00sly\x00smmosma\x00smi\x00smj\x00smn\x00smp" + - "\x00smq\x00sms\x00snnasnc\x00snk\x00snp\x00snx\x00sny\x00soomsok\x00soq" + - "\x00sou\x00soy\x00spd\x00spl\x00sps\x00sqqisrrpsrb\x00srn\x00srr\x00srx" + - "\x00ssswssd\x00ssg\x00ssy\x00stotstk\x00stq\x00suunsua\x00sue\x00suk\x00" + - "sur\x00sus\x00svweswwaswb\x00swc\x00swg\x00swp\x00swv\x00sxn\x00sxw\x00s" + - "yl\x00syr\x00szl\x00taamtaj\x00tal\x00tan\x00taq\x00tbc\x00tbd\x00tbf" + - "\x00tbg\x00tbo\x00tbw\x00tbz\x00tci\x00tcy\x00tdd\x00tdg\x00tdh\x00teelt" + - "ed\x00tem\x00teo\x00tet\x00tfi\x00tggktgc\x00tgo\x00tgu\x00thhathl\x00th" + - "q\x00thr\x00tiirtif\x00tig\x00tik\x00tim\x00tio\x00tiv\x00tkuktkl\x00tkr" + - "\x00tkt\x00tlgltlf\x00tlx\x00tly\x00tmh\x00tmy\x00tnsntnh\x00toontof\x00" + - "tog\x00toq\x00tpi\x00tpm\x00tpz\x00tqo\x00trurtru\x00trv\x00trw\x00tssot" + - "sd\x00tsf\x00tsg\x00tsj\x00tsw\x00ttatttd\x00tte\x00ttj\x00ttr\x00tts" + - "\x00ttt\x00tuh\x00tul\x00tum\x00tuq\x00tvd\x00tvl\x00tvu\x00twwitwh\x00t" + - "wq\x00txg\x00tyahtya\x00tyv\x00tzm\x00ubu\x00udm\x00ugiguga\x00ukkruli" + - "\x00umb\x00und\x00unr\x00unx\x00urrduri\x00urt\x00urw\x00usa\x00utr\x00u" + - "vh\x00uvl\x00uzzbvag\x00vai\x00van\x00veenvec\x00vep\x00viievic\x00viv" + - "\x00vls\x00vmf\x00vmw\x00voolvot\x00vro\x00vun\x00vut\x00walnwae\x00waj" + - "\x00wal\x00wan\x00war\x00wbp\x00wbq\x00wbr\x00wci\x00wer\x00wgi\x00whg" + - "\x00wib\x00wiu\x00wiv\x00wja\x00wji\x00wls\x00wmo\x00wnc\x00wni\x00wnu" + - "\x00woolwob\x00wos\x00wrs\x00wsk\x00wtm\x00wuu\x00wuv\x00wwa\x00xav\x00x" + - "bi\x00xcr\x00xes\x00xhhoxla\x00xlc\x00xld\x00xmf\x00xmn\x00xmr\x00xna" + - "\x00xnr\x00xog\x00xon\x00xpr\x00xrb\x00xsa\x00xsi\x00xsm\x00xsr\x00xwe" + - "\x00yam\x00yao\x00yap\x00yas\x00yat\x00yav\x00yay\x00yaz\x00yba\x00ybb" + - "\x00yby\x00yer\x00ygr\x00ygw\x00yiidyko\x00yle\x00ylg\x00yll\x00yml\x00y" + - "ooryon\x00yrb\x00yre\x00yrl\x00yss\x00yua\x00yue\x00yuj\x00yut\x00yuw" + - "\x00zahazag\x00zbl\x00zdj\x00zea\x00zgh\x00zhhozhx\x00zia\x00zlm\x00zmi" + - "\x00zne\x00zuulzxx\x00zza\x00\xff\xff\xff\xff" - -const langNoIndexOffset = 1330 - -// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index -// in lookup tables. The language ids for these language codes are derived directly -// from the letters and are not consecutive. -// Size: 2197 bytes, 2197 elements -var langNoIndex = [2197]uint8{ - // Entry 0 - 3F - 0xff, 0xf8, 0xed, 0xfe, 0xeb, 0xd3, 0x3b, 0xd2, - 0xfb, 0xbf, 0x7a, 0xfa, 0x37, 0x1d, 0x3c, 0x57, - 0x6e, 0x97, 0x73, 0x38, 0xfb, 0xea, 0xbf, 0x70, - 0xad, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x84, 0x62, - 0xe9, 0xbf, 0xfd, 0xbf, 0xbf, 0xf7, 0xfd, 0x77, - 0x0f, 0xff, 0xef, 0x6f, 0xff, 0xfb, 0xdf, 0xe2, - 0xc9, 0xf8, 0x7f, 0x7e, 0x4d, 0xb8, 0x0a, 0x6a, - 0x7c, 0xea, 0xe3, 0xfa, 0x7a, 0xbf, 0x67, 0xff, - // Entry 40 - 7F - 0xff, 0xff, 0xff, 0xdf, 0x2a, 0x54, 0x91, 0xc0, - 0x5d, 0xe3, 0x97, 0x14, 0x07, 0x20, 0xdd, 0xed, - 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0x35, - 0x7c, 0x5f, 0xff, 0x5f, 0x8e, 0x6e, 0xdf, 0xff, - 0xff, 0xff, 0x55, 0x7c, 0xd3, 0xfd, 0xbf, 0xb5, - 0x7b, 0xdf, 0x7f, 0xf7, 0xca, 0xfe, 0xdb, 0xa3, - 0xa8, 0xff, 0x1f, 0x67, 0x7d, 0xeb, 0xef, 0xce, - 0xff, 0xff, 0x9f, 0xff, 0xb7, 0xef, 0xfe, 0xcf, - // Entry 80 - BF - 0xdb, 0xff, 0xf3, 0xcd, 0xfb, 0x2f, 0xff, 0xff, - 0xbb, 0xee, 0xf7, 0xbd, 0xdb, 0xff, 0x5f, 0xf7, - 0xfd, 0xf2, 0xfd, 0xff, 0x5e, 0x2f, 0x3b, 0xba, - 0x7e, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xdd, 0xff, - 0xfd, 0xdf, 0xfb, 0xfe, 0x9d, 0xb4, 0xd3, 0xff, - 0xef, 0xff, 0xdf, 0xf7, 0x7f, 0xb7, 0xfd, 0xd5, - 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c, - 0x08, 0x20, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80, - // Entry C0 - FF - 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96, - 0x1b, 0x14, 0x08, 0xf2, 0x2b, 0xe7, 0x17, 0x56, - 0x05, 0x7d, 0x0e, 0x1c, 0x37, 0x71, 0xf3, 0xef, - 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10, - 0xbc, 0x85, 0xaf, 0xdf, 0xff, 0xf7, 0x73, 0x35, - 0x3e, 0x87, 0xc7, 0xdf, 0xff, 0x00, 0x81, 0x00, - 0xb0, 0x05, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x40, 0x00, 0x40, 0x92, 0x21, 0x50, 0xb1, 0x5d, - // Entry 100 - 13F - 0xfd, 0xdc, 0xbe, 0x5e, 0x00, 0x00, 0x02, 0x64, - 0x0d, 0x19, 0x41, 0xdf, 0x79, 0x22, 0x00, 0x00, - 0x00, 0x5e, 0x64, 0xdc, 0x24, 0xe5, 0xd9, 0xe3, - 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x01, 0x0c, - 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc5, 0x67, 0x5f, - 0x56, 0x89, 0x5e, 0xb5, 0x6c, 0xaf, 0x03, 0x00, - 0x02, 0x00, 0x00, 0x00, 0xc0, 0x37, 0xda, 0x56, - 0x90, 0x69, 0x01, 0x2c, 0x96, 0x69, 0x20, 0xfb, - // Entry 140 - 17F - 0xff, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x08, 0x16, - 0x01, 0x00, 0x00, 0xb0, 0x14, 0x03, 0x50, 0x06, - 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x09, - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x04, - 0x08, 0x00, 0x00, 0x04, 0x00, 0x80, 0x28, 0x04, - 0x00, 0x00, 0x40, 0xd5, 0x2d, 0x00, 0x64, 0x35, - 0x24, 0x52, 0xf4, 0xd4, 0xbd, 0x62, 0xc9, 0x03, - // Entry 180 - 1BF - 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x13, 0x39, 0x01, 0xdd, 0x57, 0x98, - 0x21, 0x18, 0x81, 0x00, 0x00, 0x01, 0x40, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0x80, 0xea, - 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - // Entry 1C0 - 1FF - 0x00, 0x01, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x20, 0x04, 0xa6, 0x00, 0x04, 0x00, 0x00, - 0x81, 0x50, 0x00, 0x00, 0x00, 0x11, 0x84, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x55, - 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x40, - 0x30, 0x83, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1e, 0xcd, 0xbf, 0x7a, 0xbf, - // Entry 200 - 23F - 0xdf, 0xc3, 0x83, 0x82, 0xc0, 0xfb, 0x57, 0x27, - 0xcd, 0x55, 0xe7, 0x01, 0x00, 0x20, 0xb2, 0xc5, - 0xa4, 0x45, 0x25, 0x9b, 0x02, 0xdf, 0xe0, 0xdf, - 0x03, 0x44, 0x08, 0x10, 0x01, 0x04, 0x01, 0xe3, - 0x92, 0x54, 0xdb, 0x28, 0xd1, 0x5f, 0xf6, 0x6d, - 0x79, 0xed, 0x1c, 0x7d, 0x04, 0x08, 0x00, 0x01, - 0x21, 0x12, 0x64, 0x5f, 0xdd, 0x0e, 0x85, 0x4f, - 0x40, 0x40, 0x00, 0x04, 0xf1, 0xfd, 0x3d, 0x54, - // Entry 240 - 27F - 0xe8, 0x03, 0xb4, 0x27, 0x23, 0x0d, 0x00, 0x00, - 0x20, 0x7b, 0x38, 0x02, 0x05, 0x84, 0x00, 0xf0, - 0xbb, 0x7e, 0x5a, 0x00, 0x18, 0x04, 0x81, 0x00, - 0x00, 0x00, 0x80, 0x10, 0x90, 0x1c, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04, - 0x08, 0xa0, 0x70, 0xa5, 0x0c, 0x40, 0x00, 0x00, - 0x11, 0x04, 0x04, 0x68, 0x00, 0x20, 0x70, 0xff, - 0x7b, 0x7f, 0x60, 0x00, 0x05, 0x9b, 0xdd, 0x66, - // Entry 280 - 2BF - 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05, - 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51, - 0xe2, 0xef, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x60, - 0xe7, 0x48, 0x00, 0x81, 0x20, 0xc0, 0x05, 0x80, - 0x03, 0x00, 0x00, 0x00, 0x8c, 0x50, 0x40, 0x04, - 0x84, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20, - // Entry 2C0 - 2FF - 0x02, 0x50, 0x80, 0x11, 0x00, 0x91, 0x6c, 0xe2, - 0x50, 0x27, 0x1d, 0x11, 0x29, 0x06, 0x59, 0xe9, - 0x33, 0x08, 0x00, 0x20, 0x04, 0x40, 0x10, 0x00, - 0x00, 0x00, 0x50, 0x44, 0x92, 0x49, 0xd6, 0x5d, - 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00, - 0x08, 0x00, 0x80, 0x00, 0x40, 0x04, 0x00, 0x01, - 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x00, 0x08, - 0xd8, 0xeb, 0xf6, 0x39, 0xc4, 0x89, 0x12, 0x00, - // Entry 300 - 33F - 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa0, - 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, - 0x04, 0x10, 0xd0, 0x9d, 0x95, 0x13, 0x04, 0x80, - 0x00, 0x01, 0xd0, 0x12, 0x40, 0x00, 0x10, 0xb0, - 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00, - 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0x80, - 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00, - // Entry 340 - 37F - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, - 0x00, 0x10, 0x00, 0x00, 0x00, 0xf0, 0x84, 0xe3, - 0xdd, 0xbf, 0xf9, 0xf9, 0x3b, 0x7f, 0x7f, 0xdb, - 0xfd, 0xfc, 0xfe, 0xdf, 0xff, 0xfd, 0xff, 0xf6, - 0xfb, 0xfc, 0xf7, 0x1f, 0xff, 0xb3, 0x6c, 0xff, - 0xd9, 0xad, 0xdf, 0xfe, 0xef, 0xba, 0xdf, 0xff, - 0xff, 0xff, 0xb7, 0xdd, 0x7d, 0xbf, 0xab, 0x7f, - 0xfd, 0xfd, 0xdf, 0x2f, 0x9c, 0xdf, 0xf3, 0x6f, - // Entry 380 - 3BF - 0xdf, 0xdd, 0xff, 0xfb, 0xee, 0xd2, 0xab, 0x5f, - 0xd5, 0xdf, 0x7f, 0xff, 0xeb, 0xff, 0xe4, 0x4d, - 0xf9, 0xff, 0xfe, 0xf7, 0xfd, 0xdf, 0xfb, 0xbf, - 0xee, 0xdb, 0x6f, 0xef, 0xff, 0x7f, 0xff, 0xff, - 0xf7, 0x5f, 0xd3, 0x3b, 0xfd, 0xd9, 0xdf, 0xeb, - 0xbc, 0x08, 0x05, 0x24, 0xff, 0x07, 0x70, 0xfe, - 0xe6, 0x5e, 0x00, 0x08, 0x00, 0x83, 0x3d, 0x1b, - 0x06, 0xe6, 0x72, 0x60, 0xd1, 0x3c, 0x7f, 0x44, - // Entry 3C0 - 3FF - 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xbd, 0x7f, 0x57, - 0xf2, 0xff, 0x31, 0xff, 0xf2, 0x1e, 0x90, 0xf7, - 0xf1, 0xf9, 0x45, 0x80, 0x01, 0x02, 0x00, 0x00, - 0x40, 0x54, 0x9f, 0x8a, 0xd9, 0xd9, 0x0e, 0x11, - 0x86, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x00, 0x01, - 0x05, 0xd1, 0x50, 0x58, 0x00, 0x00, 0x00, 0x10, - 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2, - 0xb9, 0xfd, 0xfc, 0xba, 0xfe, 0xef, 0xc7, 0xbe, - // Entry 400 - 43F - 0x53, 0x6f, 0xdf, 0xe7, 0xdb, 0x65, 0xbb, 0x7f, - 0xfa, 0xff, 0x77, 0xf3, 0xef, 0xbf, 0xfd, 0xf7, - 0xdf, 0xdf, 0x9b, 0x7f, 0xff, 0xff, 0x7f, 0x6f, - 0xf7, 0xfb, 0xeb, 0xdf, 0xbc, 0xff, 0xbf, 0x6b, - 0x7b, 0xfb, 0xff, 0xce, 0x76, 0xbd, 0xf7, 0xf7, - 0xdf, 0xdc, 0xf7, 0xf7, 0xff, 0xdf, 0xf3, 0xfe, - 0xef, 0xff, 0xff, 0xff, 0xb6, 0x7f, 0x7f, 0xde, - 0xf7, 0xb9, 0xeb, 0x77, 0xff, 0xfb, 0xbf, 0xdf, - // Entry 440 - 47F - 0xfd, 0xfe, 0xfb, 0xff, 0xfe, 0xeb, 0x1f, 0x7d, - 0x2f, 0xfd, 0xb6, 0xb5, 0xa5, 0xfc, 0xff, 0xfd, - 0x7f, 0x4e, 0xbf, 0x8f, 0xae, 0xff, 0xee, 0xdf, - 0x7f, 0xf7, 0x73, 0x02, 0x02, 0x04, 0xfc, 0xf7, - 0xff, 0xb7, 0xd7, 0xef, 0xfe, 0xcd, 0xf5, 0xce, - 0xe2, 0x8e, 0xe7, 0xbf, 0xb7, 0xff, 0x56, 0xbd, - 0xcd, 0xff, 0xfb, 0xff, 0xdf, 0xd7, 0xea, 0xff, - 0xe5, 0x5f, 0x6d, 0x0f, 0xa7, 0x51, 0x06, 0xc4, - // Entry 480 - 4BF - 0x13, 0x50, 0x5d, 0xaf, 0xa6, 0xfd, 0x99, 0xfb, - 0x63, 0x1d, 0x53, 0xff, 0xef, 0xb7, 0x35, 0x20, - 0x14, 0x00, 0x55, 0x51, 0x82, 0x65, 0xf5, 0x41, - 0xe2, 0xff, 0xfc, 0xdf, 0x00, 0x05, 0xc5, 0x05, - 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x04, - 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x51, 0x20, 0x05, 0x04, 0x01, 0x00, 0x00, - 0x06, 0x01, 0x20, 0x00, 0x18, 0x01, 0x92, 0xb1, - // Entry 4C0 - 4FF - 0xfd, 0x47, 0x49, 0x06, 0x95, 0x06, 0x57, 0xed, - 0xfb, 0x4c, 0x1c, 0x6b, 0x83, 0x04, 0x62, 0x40, - 0x00, 0x11, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83, - 0xb8, 0x4f, 0x10, 0x8c, 0x89, 0x46, 0xde, 0xf7, - 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, - 0x01, 0x00, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x3d, - 0xba, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41, - // Entry 500 - 53F - 0x30, 0xff, 0x79, 0x72, 0x04, 0x00, 0x00, 0x49, - 0x2d, 0x14, 0x27, 0x57, 0xed, 0xf1, 0x3f, 0xe7, - 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xf8, - 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xe5, 0xf7, - 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7e, 0x10, - 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9, - 0x5b, 0x05, 0x86, 0xed, 0xf5, 0x77, 0xbd, 0x3c, - 0x00, 0x00, 0x00, 0x42, 0x71, 0x42, 0x00, 0x40, - // Entry 540 - 57F - 0x00, 0x00, 0x01, 0x43, 0x19, 0x00, 0x08, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - // Entry 580 - 5BF - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d, - 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0xce, 0xfb, 0xbf, - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x00, 0x30, 0x15, 0xa3, 0x10, 0x00, 0x00, 0x00, - 0x11, 0x04, 0x16, 0x00, 0x00, 0x02, 0x00, 0x81, - 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40, - // Entry 5C0 - 5FF - 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0x3e, 0x02, - 0xaa, 0x10, 0x5d, 0x98, 0x52, 0x00, 0x80, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x02, - 0x19, 0x00, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d, - 0x31, 0x00, 0x00, 0x00, 0x01, 0x10, 0x02, 0x20, - 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00, - 0x00, 0x1f, 0xdf, 0xd2, 0xb9, 0xff, 0xfd, 0x3f, - 0x1f, 0x98, 0xcf, 0x9c, 0xbf, 0xaf, 0x5f, 0xfe, - // Entry 600 - 63F - 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xd9, - 0xb7, 0xf6, 0xfb, 0xb3, 0xc7, 0xff, 0x6f, 0xf1, - 0x73, 0xb1, 0x7f, 0x9f, 0x7f, 0xbd, 0xfc, 0xb7, - 0xee, 0x1c, 0xfa, 0xcb, 0xef, 0xdd, 0xf9, 0xbd, - 0x6e, 0xae, 0x55, 0xfd, 0x6e, 0x81, 0x76, 0x1f, - 0xd4, 0x77, 0xf5, 0x7d, 0xfb, 0xff, 0xeb, 0xfe, - 0xbe, 0x5f, 0x46, 0x1b, 0xe9, 0x5f, 0x50, 0x18, - 0x02, 0xfa, 0xf7, 0x9d, 0x15, 0x97, 0x05, 0x0f, - // Entry 640 - 67F - 0x75, 0xc4, 0x7d, 0x81, 0x92, 0xf1, 0x57, 0x6c, - 0xff, 0xe4, 0xef, 0x6f, 0xff, 0xfc, 0xdd, 0xde, - 0xfc, 0xfd, 0x76, 0x5f, 0x7a, 0x1f, 0x00, 0x98, - 0x02, 0xfb, 0xa3, 0xef, 0xf3, 0xd6, 0xf2, 0xff, - 0xb9, 0xda, 0x7d, 0x50, 0x1e, 0x15, 0x7b, 0xb4, - 0xf5, 0x3e, 0xff, 0xff, 0xf1, 0xf7, 0xff, 0xe7, - 0x5f, 0xff, 0xff, 0x9e, 0xdb, 0xf6, 0xd7, 0xb9, - 0xef, 0x27, 0x80, 0xbb, 0xc5, 0xff, 0xff, 0xe3, - // Entry 680 - 6BF - 0x97, 0x9d, 0xbf, 0x9f, 0xf7, 0xc7, 0xfd, 0x37, - 0xce, 0x7f, 0x04, 0x1d, 0x53, 0x7f, 0xf8, 0xda, - 0x5d, 0xce, 0x7d, 0x06, 0xb9, 0xea, 0x69, 0xa0, - 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x08, - 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00, - 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x01, 0x06, - 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, - 0x04, 0x00, 0x10, 0xcc, 0x58, 0xd5, 0x0d, 0x0f, - // Entry 6C0 - 6FF - 0x14, 0x4d, 0xf1, 0x16, 0x44, 0xd1, 0x42, 0x08, - 0x40, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, - 0x00, 0xdc, 0xfb, 0xcb, 0x0e, 0x58, 0x08, 0x41, - 0x04, 0x20, 0x04, 0x00, 0x30, 0x12, 0x40, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xab, - 0x6d, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00, - // Entry 700 - 73F - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, - 0x80, 0x86, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xdf, 0x18, 0x00, 0x00, 0x02, 0xf0, 0xfd, 0x79, - 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, - 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 740 - 77F - 0x00, 0x00, 0x00, 0xef, 0xd5, 0xfd, 0xcf, 0x7e, - 0xb0, 0x11, 0x00, 0x00, 0x00, 0x92, 0x01, 0x44, - 0xcd, 0xf9, 0x5c, 0x00, 0x01, 0x00, 0x30, 0x04, - 0x04, 0x55, 0x00, 0x01, 0x04, 0xf4, 0x3f, 0x4a, - 0x01, 0x00, 0x00, 0xb0, 0x80, 0x00, 0x55, 0x55, - 0x97, 0x7c, 0x9f, 0x31, 0xcc, 0x68, 0xd1, 0x03, - 0xd5, 0x57, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x2c, 0xf7, 0xcb, 0x1f, 0x14, 0x60, - // Entry 780 - 7BF - 0x03, 0x68, 0x01, 0x10, 0x8b, 0x38, 0x8a, 0x01, - 0x00, 0x00, 0x20, 0x00, 0x24, 0x44, 0x00, 0x00, - 0x10, 0x03, 0x11, 0x02, 0x01, 0x00, 0x00, 0xf0, - 0xf5, 0xff, 0xd5, 0x97, 0xbc, 0x70, 0xd6, 0x78, - 0x78, 0x15, 0x50, 0x01, 0xa4, 0x84, 0xa9, 0x41, - 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x00, - 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02, - 0xff, 0xef, 0xff, 0x4b, 0x85, 0x53, 0xf4, 0xed, - // Entry 7C0 - 7FF - 0xdd, 0xbf, 0x72, 0x19, 0xc7, 0x0c, 0xd5, 0x42, - 0x54, 0xdd, 0x77, 0x14, 0x00, 0x80, 0x40, 0x56, - 0xcc, 0x16, 0x9e, 0xea, 0x35, 0x7d, 0xef, 0xff, - 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x4d, - 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80, - 0x10, 0x20, 0x24, 0x00, 0xff, 0x2f, 0xd3, 0x60, - 0xfe, 0x01, 0x02, 0x88, 0x0a, 0x40, 0x16, 0x01, - 0x01, 0x15, 0x2b, 0x3c, 0x01, 0x00, 0x00, 0x10, - // Entry 800 - 83F - 0x90, 0x49, 0x41, 0x02, 0x02, 0x01, 0xe1, 0xbf, - 0xbf, 0x03, 0x00, 0x00, 0x10, 0xd4, 0xa3, 0xd1, - 0x40, 0x9c, 0x44, 0xdf, 0xf5, 0x8f, 0x66, 0xb3, - 0x55, 0x20, 0xd4, 0xc1, 0xd8, 0x30, 0x3d, 0x80, - 0x00, 0x00, 0x00, 0x04, 0xd4, 0x11, 0xc5, 0x84, - 0x2e, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbd, 0x93, - 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10, - 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00, - // Entry 840 - 87F - 0xf0, 0xfb, 0xfd, 0x3f, 0x05, 0x00, 0x12, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28, - 0x84, 0x00, 0x21, 0xc0, 0x23, 0x24, 0x00, 0x00, - 0x00, 0xcb, 0xe4, 0x3a, 0x42, 0x88, 0x14, 0xf1, - 0xef, 0xff, 0x7f, 0x12, 0x01, 0x01, 0x84, 0x50, - 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40, - 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1, - // Entry 880 - 8BF - 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24, - 0x0a, 0x00, 0x80, 0x00, 0x00, -} - -// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives -// to 2-letter language codes that cannot be derived using the method described above. -// Each 3-letter code is followed by its 1-byte langID. -const altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff" - -// altLangIndex is used to convert indexes in altLangISO3 to langIDs. -// Size: 12 bytes, 6 elements -var altLangIndex = [6]uint16{ - 0x0281, 0x0407, 0x01fb, 0x03e5, 0x013e, 0x0208, -} - -// AliasMap maps langIDs to their suggested replacements. -// Size: 656 bytes, 164 elements -var AliasMap = [164]FromTo{ - 0: {From: 0x82, To: 0x88}, - 1: {From: 0x187, To: 0x1ae}, - 2: {From: 0x1f3, To: 0x1e1}, - 3: {From: 0x1fb, To: 0x1bc}, - 4: {From: 0x208, To: 0x512}, - 5: {From: 0x20f, To: 0x20e}, - 6: {From: 0x310, To: 0x3dc}, - 7: {From: 0x347, To: 0x36f}, - 8: {From: 0x407, To: 0x432}, - 9: {From: 0x47a, To: 0x153}, - 10: {From: 0x490, To: 0x451}, - 11: {From: 0x4a2, To: 0x21}, - 12: {From: 0x53e, To: 0x544}, - 13: {From: 0x58f, To: 0x12d}, - 14: {From: 0x630, To: 0x1eb1}, - 15: {From: 0x651, To: 0x431}, - 16: {From: 0x662, To: 0x431}, - 17: {From: 0x6ed, To: 0x3a}, - 18: {From: 0x6f8, To: 0x1d7}, - 19: {From: 0x73e, To: 0x21a1}, - 20: {From: 0x7b3, To: 0x56}, - 21: {From: 0x7b9, To: 0x299b}, - 22: {From: 0x7c5, To: 0x58}, - 23: {From: 0x7e6, To: 0x145}, - 24: {From: 0x80c, To: 0x5a}, - 25: {From: 0x815, To: 0x8d}, - 26: {From: 0x87e, To: 0x810}, - 27: {From: 0x8c3, To: 0xee3}, - 28: {From: 0x9ef, To: 0x331}, - 29: {From: 0xa36, To: 0x2c5}, - 30: {From: 0xa3d, To: 0xbf}, - 31: {From: 0xabe, To: 0x3322}, - 32: {From: 0xb38, To: 0x529}, - 33: {From: 0xb75, To: 0x265a}, - 34: {From: 0xb7e, To: 0xbc3}, - 35: {From: 0xb9b, To: 0x44e}, - 36: {From: 0xbbc, To: 0x4229}, - 37: {From: 0xbbf, To: 0x529}, - 38: {From: 0xbfe, To: 0x2da7}, - 39: {From: 0xc2e, To: 0x3181}, - 40: {From: 0xcb9, To: 0xf3}, - 41: {From: 0xd08, To: 0xfa}, - 42: {From: 0xdc8, To: 0x11a}, - 43: {From: 0xdd7, To: 0x32d}, - 44: {From: 0xdf8, To: 0xdfb}, - 45: {From: 0xdfe, To: 0x531}, - 46: {From: 0xedf, To: 0x205a}, - 47: {From: 0xeee, To: 0x2e9a}, - 48: {From: 0xf39, To: 0x367}, - 49: {From: 0x10d0, To: 0x140}, - 50: {From: 0x1104, To: 0x2d0}, - 51: {From: 0x11a0, To: 0x1ec}, - 52: {From: 0x1279, To: 0x21}, - 53: {From: 0x1424, To: 0x15e}, - 54: {From: 0x1470, To: 0x14e}, - 55: {From: 0x151f, To: 0xd9b}, - 56: {From: 0x1523, To: 0x390}, - 57: {From: 0x1532, To: 0x19f}, - 58: {From: 0x1580, To: 0x210}, - 59: {From: 0x1583, To: 0x10d}, - 60: {From: 0x15a3, To: 0x3caf}, - 61: {From: 0x166a, To: 0x19b}, - 62: {From: 0x16c8, To: 0x136}, - 63: {From: 0x1700, To: 0x29f8}, - 64: {From: 0x1718, To: 0x194}, - 65: {From: 0x1727, To: 0xf3f}, - 66: {From: 0x177a, To: 0x178}, - 67: {From: 0x1809, To: 0x17b6}, - 68: {From: 0x1816, To: 0x18f3}, - 69: {From: 0x188a, To: 0x436}, - 70: {From: 0x1979, To: 0x1d01}, - 71: {From: 0x1a74, To: 0x2bb0}, - 72: {From: 0x1a8a, To: 0x1f8}, - 73: {From: 0x1b5a, To: 0x1fa}, - 74: {From: 0x1b86, To: 0x1515}, - 75: {From: 0x1d64, To: 0x2c9b}, - 76: {From: 0x2038, To: 0x37b1}, - 77: {From: 0x203d, To: 0x20dd}, - 78: {From: 0x205a, To: 0x30b}, - 79: {From: 0x20e3, To: 0x274}, - 80: {From: 0x20ee, To: 0x263}, - 81: {From: 0x20f2, To: 0x22d}, - 82: {From: 0x20f9, To: 0x256}, - 83: {From: 0x210f, To: 0x21eb}, - 84: {From: 0x2135, To: 0x27d}, - 85: {From: 0x2160, To: 0x913}, - 86: {From: 0x2199, To: 0x121}, - 87: {From: 0x21ce, To: 0x1561}, - 88: {From: 0x21e6, To: 0x504}, - 89: {From: 0x21f4, To: 0x49f}, - 90: {From: 0x222d, To: 0x121}, - 91: {From: 0x2237, To: 0x121}, - 92: {From: 0x2262, To: 0x92a}, - 93: {From: 0x2316, To: 0x3226}, - 94: {From: 0x2382, To: 0x3365}, - 95: {From: 0x2472, To: 0x2c7}, - 96: {From: 0x24e4, To: 0x2ff}, - 97: {From: 0x24f0, To: 0x2fa}, - 98: {From: 0x24fa, To: 0x31f}, - 99: {From: 0x2550, To: 0xb5b}, - 100: {From: 0x25a9, To: 0xe2}, - 101: {From: 0x263e, To: 0x2d0}, - 102: {From: 0x26c9, To: 0x26b4}, - 103: {From: 0x26f9, To: 0x3c8}, - 104: {From: 0x2727, To: 0x3caf}, - 105: {From: 0x2765, To: 0x26b4}, - 106: {From: 0x2789, To: 0x4358}, - 107: {From: 0x28ef, To: 0x2837}, - 108: {From: 0x2914, To: 0x351}, - 109: {From: 0x2986, To: 0x2da7}, - 110: {From: 0x2b1a, To: 0x38d}, - 111: {From: 0x2bfc, To: 0x395}, - 112: {From: 0x2c3f, To: 0x3caf}, - 113: {From: 0x2cfc, To: 0x3be}, - 114: {From: 0x2d13, To: 0x597}, - 115: {From: 0x2d47, To: 0x148}, - 116: {From: 0x2d48, To: 0x148}, - 117: {From: 0x2dff, To: 0x2f1}, - 118: {From: 0x2e08, To: 0x19cc}, - 119: {From: 0x2e1a, To: 0x2d95}, - 120: {From: 0x2e21, To: 0x292}, - 121: {From: 0x2e54, To: 0x7d}, - 122: {From: 0x2e65, To: 0x2282}, - 123: {From: 0x2ea0, To: 0x2e9b}, - 124: {From: 0x2eef, To: 0x2ed7}, - 125: {From: 0x3193, To: 0x3c4}, - 126: {From: 0x3366, To: 0x338e}, - 127: {From: 0x342a, To: 0x3dc}, - 128: {From: 0x34ee, To: 0x18d0}, - 129: {From: 0x35c8, To: 0x2c9b}, - 130: {From: 0x35e6, To: 0x412}, - 131: {From: 0x3658, To: 0x246}, - 132: {From: 0x3676, To: 0x3f4}, - 133: {From: 0x36fd, To: 0x445}, - 134: {From: 0x37c0, To: 0x121}, - 135: {From: 0x3816, To: 0x38f2}, - 136: {From: 0x382b, To: 0x2c9b}, - 137: {From: 0x382f, To: 0xa9}, - 138: {From: 0x3832, To: 0x3228}, - 139: {From: 0x386c, To: 0x39a6}, - 140: {From: 0x3892, To: 0x3fc0}, - 141: {From: 0x38a5, To: 0x39d7}, - 142: {From: 0x38b4, To: 0x1fa4}, - 143: {From: 0x38b5, To: 0x2e9a}, - 144: {From: 0x395c, To: 0x47e}, - 145: {From: 0x3b4e, To: 0xd91}, - 146: {From: 0x3b78, To: 0x137}, - 147: {From: 0x3c99, To: 0x4bc}, - 148: {From: 0x3fbd, To: 0x100}, - 149: {From: 0x4208, To: 0xa91}, - 150: {From: 0x42be, To: 0x573}, - 151: {From: 0x42f9, To: 0x3f60}, - 152: {From: 0x4378, To: 0x25a}, - 153: {From: 0x43cb, To: 0x36cb}, - 154: {From: 0x43cd, To: 0x10f}, - 155: {From: 0x44af, To: 0x3322}, - 156: {From: 0x44e3, To: 0x512}, - 157: {From: 0x45ca, To: 0x2409}, - 158: {From: 0x45dd, To: 0x26dc}, - 159: {From: 0x4610, To: 0x48ae}, - 160: {From: 0x46ae, To: 0x46a0}, - 161: {From: 0x473e, To: 0x4745}, - 162: {From: 0x4916, To: 0x31f}, - 163: {From: 0x49a7, To: 0x523}, -} - -// Size: 164 bytes, 164 elements -var AliasTypes = [164]AliasType{ - // Entry 0 - 3F - 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 1, 2, - 1, 1, 2, 0, 1, 0, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, - 2, 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 0, 0, - 2, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 0, 1, 2, 0, - // Entry 40 - 7F - 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, - 2, 2, 2, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, - 0, 1, 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2, - // Entry 80 - BF - 0, 0, 2, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, - 0, 1, 1, 1, -} - -const ( - _Latn = 87 - _Hani = 54 - _Hans = 56 - _Hant = 57 - _Qaaa = 139 - _Qaai = 147 - _Qabx = 188 - _Zinh = 236 - _Zyyy = 241 - _Zzzz = 242 -) - -// script is an alphabetically sorted list of ISO 15924 codes. The index -// of the script in the string, divided by 4, is the internal scriptID. -const script tag.Index = "" + // Size: 976 bytes - "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" + - "BrahBraiBugiBuhdCakmCansCariChamCherCirtCoptCpmnCprtCyrlCyrsDevaDogrDsrt" + - "DuplEgydEgyhEgypElbaEthiGeokGeorGlagGongGonmGothGranGrekGujrGuruHanbHang" + - "HaniHanoHansHantHatrHebrHiraHluwHmngHmnpHrktHungIndsItalJamoJavaJpanJurc" + - "KaliKanaKharKhmrKhojKitlKitsKndaKoreKpelKthiLanaLaooLatfLatgLatnLekeLepc" + - "LimbLinaLinbLisuLomaLyciLydiMahjMakaMandManiMarcMayaMedfMendMercMeroMlym" + - "ModiMongMoonMrooMteiMultMymrNarbNbatNewaNkdbNkgbNkooNshuOgamOlckOrkhOrya" + - "OsgeOsmaPalmPaucPermPhagPhliPhlpPhlvPhnxPiqdPlrdPrtiQaaaQaabQaacQaadQaae" + - "QaafQaagQaahQaaiQaajQaakQaalQaamQaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaaw" + - "QaaxQaayQaazQabaQabbQabcQabdQabeQabfQabgQabhQabiQabjQabkQablQabmQabnQabo" + - "QabpQabqQabrQabsQabtQabuQabvQabwQabxRjngRoroRunrSamrSaraSarbSaurSgnwShaw" + - "ShrdShuiSiddSindSinhSoraSoyoSundSyloSyrcSyreSyrjSyrnTagbTakrTaleTaluTaml" + - "TangTavtTeluTengTfngTglgThaaThaiTibtTirhUgarVaiiVispWaraWchoWoleXpeoXsux" + - "YiiiZanbZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff\xff" - -// suppressScript is an index from langID to the dominant script for that language, -// if it exists. If a script is given, it should be suppressed from the language tag. -// Size: 1330 bytes, 1330 elements -var suppressScript = [1330]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 40 - 7F - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, - // Entry 80 - BF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry C0 - FF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 100 - 13F - 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xde, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x57, 0x00, - // Entry 140 - 17F - 0x57, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 180 - 1BF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x21, 0x00, - // Entry 1C0 - 1FF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x57, 0x00, 0x57, 0x57, 0x00, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x57, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, - // Entry 200 - 23F - 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 240 - 27F - 0x00, 0x00, 0x1f, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x4f, 0x00, 0x00, 0x50, 0x00, 0x21, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 280 - 2BF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 2C0 - 2FF - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, - // Entry 300 - 33F - 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x57, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - // Entry 340 - 37F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x57, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x57, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 380 - 3BF - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, - // Entry 3C0 - 3FF - 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1f, 0x00, 0x00, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 400 - 43F - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - // Entry 440 - 47F - 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xda, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x29, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, - // Entry 480 - 4BF - 0x57, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 4C0 - 4FF - 0x57, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Entry 500 - 53F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, - 0x00, 0x00, -} - -const ( - _001 = 1 - _419 = 31 - _BR = 65 - _CA = 73 - _ES = 110 - _GB = 123 - _MD = 188 - _PT = 238 - _UK = 306 - _US = 309 - _ZZ = 357 - _XA = 323 - _XC = 325 - _XK = 333 -) - -// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID -// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for -// the UN.M49 codes used for groups.) -const isoRegionOffset = 32 - -// regionTypes defines the status of a region for various standards. -// Size: 358 bytes, 358 elements -var regionTypes = [358]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry 40 - 7F - 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x04, - 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, - 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, - 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry 80 - BF - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x00, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry C0 - FF - 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, 0x06, - 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x06, 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - // Entry 100 - 13F - 0x05, 0x05, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x02, 0x06, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, - // Entry 140 - 17F - 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x06, - 0x04, 0x06, 0x06, 0x04, 0x06, 0x05, -} - -// regionISO holds a list of alphabetically sorted 2-letter ISO region codes. -// Each 2-letter codes is followed by two bytes with the following meaning: -// - [A-Z}{2}: the first letter of the 2-letter code plus these two -// letters form the 3-letter ISO code. -// - 0, n: index into altRegionISO3. -const regionISO tag.Index = "" + // Size: 1308 bytes - "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" + - "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" + - "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" + - "CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADOOMDY" + - "HYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03EZ FIINFJJIFKLKFMSMFORO" + - "FQ\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQNQGR" + - "RCGS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERLILSR" + - "IMMNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM\x00" + - "\x09KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSOLTTU" + - "LUUXLVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNPMQTQ" + - "MRRTMSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLDNOOR" + - "NPPLNQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM\x00" + - "\x12PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSSQTTT" + - "QU\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLBSCYC" + - "SDDNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXMSYYR" + - "SZWZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTTTOTV" + - "UVTWWNTZZAUAKRUGGAUK UMMIUN USSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVNNMVU" + - "UTWFLFWKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXNNNXO" + - "OOXPPPXQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUGZAAF" + - "ZMMBZRARZWWEZZZZ\xff\xff\xff\xff" - -// altRegionISO3 holds a list of 3-letter region codes that cannot be -// mapped to 2-letter codes using the default algorithm. This is a short list. -const altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN" - -// altRegionIDs holds a list of regionIDs the positions of which match those -// of the 3-letter ISO codes in altRegionISO3. -// Size: 22 bytes, 11 elements -var altRegionIDs = [11]uint16{ - 0x0057, 0x0070, 0x0088, 0x00a8, 0x00aa, 0x00ad, 0x00ea, 0x0105, - 0x0121, 0x015f, 0x00dc, -} - -// Size: 80 bytes, 20 elements -var regionOldMap = [20]FromTo{ - 0: {From: 0x44, To: 0xc4}, - 1: {From: 0x58, To: 0xa7}, - 2: {From: 0x5f, To: 0x60}, - 3: {From: 0x66, To: 0x3b}, - 4: {From: 0x79, To: 0x78}, - 5: {From: 0x93, To: 0x37}, - 6: {From: 0xa3, To: 0x133}, - 7: {From: 0xc1, To: 0x133}, - 8: {From: 0xd7, To: 0x13f}, - 9: {From: 0xdc, To: 0x2b}, - 10: {From: 0xef, To: 0x133}, - 11: {From: 0xf2, To: 0xe2}, - 12: {From: 0xfc, To: 0x70}, - 13: {From: 0x103, To: 0x164}, - 14: {From: 0x12a, To: 0x126}, - 15: {From: 0x132, To: 0x7b}, - 16: {From: 0x13a, To: 0x13e}, - 17: {From: 0x141, To: 0x133}, - 18: {From: 0x15d, To: 0x15e}, - 19: {From: 0x163, To: 0x4b}, -} - -// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are -// codes indicating collections of regions. -// Size: 716 bytes, 358 elements -var m49 = [358]int16{ - // Entry 0 - 3F - 0, 1, 2, 3, 5, 9, 11, 13, - 14, 15, 17, 18, 19, 21, 29, 30, - 34, 35, 39, 53, 54, 57, 61, 142, - 143, 145, 150, 151, 154, 155, 202, 419, - 958, 0, 20, 784, 4, 28, 660, 8, - 51, 530, 24, 10, 32, 16, 40, 36, - 533, 248, 31, 70, 52, 50, 56, 854, - 100, 48, 108, 204, 652, 60, 96, 68, - // Entry 40 - 7F - 535, 76, 44, 64, 104, 74, 72, 112, - 84, 124, 166, 180, 140, 178, 756, 384, - 184, 152, 120, 156, 170, 0, 188, 891, - 296, 192, 132, 531, 162, 196, 203, 278, - 276, 0, 262, 208, 212, 214, 204, 12, - 0, 218, 233, 818, 732, 232, 724, 231, - 967, 0, 246, 242, 238, 583, 234, 0, - 250, 249, 266, 826, 308, 268, 254, 831, - // Entry 80 - BF - 288, 292, 304, 270, 324, 312, 226, 300, - 239, 320, 316, 624, 328, 344, 334, 340, - 191, 332, 348, 854, 0, 360, 372, 376, - 833, 356, 86, 368, 364, 352, 380, 832, - 388, 400, 392, 581, 404, 417, 116, 296, - 174, 659, 408, 410, 414, 136, 398, 418, - 422, 662, 438, 144, 430, 426, 440, 442, - 428, 434, 504, 492, 498, 499, 663, 450, - // Entry C0 - FF - 584, 581, 807, 466, 104, 496, 446, 580, - 474, 478, 500, 470, 480, 462, 454, 484, - 458, 508, 516, 540, 562, 574, 566, 548, - 558, 528, 578, 524, 10, 520, 536, 570, - 554, 512, 591, 0, 604, 258, 598, 608, - 586, 616, 666, 612, 630, 275, 620, 581, - 585, 600, 591, 634, 959, 960, 961, 962, - 963, 964, 965, 966, 967, 968, 969, 970, - // Entry 100 - 13F - 971, 972, 638, 716, 642, 688, 643, 646, - 682, 90, 690, 729, 752, 702, 654, 705, - 744, 703, 694, 674, 686, 706, 740, 728, - 678, 810, 222, 534, 760, 748, 0, 796, - 148, 260, 768, 764, 762, 772, 626, 795, - 788, 776, 626, 792, 780, 798, 158, 834, - 804, 800, 826, 581, 0, 840, 858, 860, - 336, 670, 704, 862, 92, 850, 704, 548, - // Entry 140 - 17F - 876, 581, 882, 973, 974, 975, 976, 977, - 978, 979, 980, 981, 982, 983, 984, 985, - 986, 987, 988, 989, 990, 991, 992, 993, - 994, 995, 996, 997, 998, 720, 887, 175, - 891, 710, 894, 180, 716, 999, -} - -// m49Index gives indexes into fromM49 based on the three most significant bits -// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in -// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] -// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. -// The region code is stored in the 9 lsb of the indexed value. -// Size: 18 bytes, 9 elements -var m49Index = [9]int16{ - 0, 59, 108, 143, 181, 220, 259, 291, - 333, -} - -// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details. -// Size: 666 bytes, 333 elements -var fromM49 = [333]uint16{ - // Entry 0 - 3F - 0x0201, 0x0402, 0x0603, 0x0824, 0x0a04, 0x1027, 0x1205, 0x142b, - 0x1606, 0x1867, 0x1a07, 0x1c08, 0x1e09, 0x202d, 0x220a, 0x240b, - 0x260c, 0x2822, 0x2a0d, 0x302a, 0x3825, 0x3a0e, 0x3c0f, 0x3e32, - 0x402c, 0x4410, 0x4611, 0x482f, 0x4e12, 0x502e, 0x5842, 0x6039, - 0x6435, 0x6628, 0x6834, 0x6a13, 0x6c14, 0x7036, 0x7215, 0x783d, - 0x7a16, 0x8043, 0x883f, 0x8c33, 0x9046, 0x9445, 0x9841, 0xa848, - 0xac9a, 0xb509, 0xb93c, 0xc03e, 0xc838, 0xd0c4, 0xd83a, 0xe047, - 0xe8a6, 0xf052, 0xf849, 0x085a, 0x10ad, 0x184c, 0x1c17, 0x1e18, - // Entry 40 - 7F - 0x20b3, 0x2219, 0x2920, 0x2c1a, 0x2e1b, 0x3051, 0x341c, 0x361d, - 0x3853, 0x3d2e, 0x445c, 0x4c4a, 0x5454, 0x5ca8, 0x5f5f, 0x644d, - 0x684b, 0x7050, 0x7856, 0x7e90, 0x8059, 0x885d, 0x941e, 0x965e, - 0x983b, 0xa063, 0xa864, 0xac65, 0xb469, 0xbd1a, 0xc486, 0xcc6f, - 0xce6f, 0xd06d, 0xd26a, 0xd476, 0xdc74, 0xde88, 0xe473, 0xec72, - 0xf031, 0xf279, 0xf478, 0xfc7e, 0x04e5, 0x0921, 0x0c62, 0x147a, - 0x187d, 0x1c83, 0x26ed, 0x2860, 0x2c5f, 0x3060, 0x4080, 0x4881, - 0x50a7, 0x5887, 0x6082, 0x687c, 0x7085, 0x788a, 0x8089, 0x8884, - // Entry 80 - BF - 0x908c, 0x9891, 0x9c8e, 0xa138, 0xa88f, 0xb08d, 0xb892, 0xc09d, - 0xc899, 0xd095, 0xd89c, 0xe09b, 0xe896, 0xf097, 0xf89e, 0x004f, - 0x08a0, 0x10a2, 0x1cae, 0x20a1, 0x28a4, 0x30aa, 0x34ab, 0x3cac, - 0x42a5, 0x44af, 0x461f, 0x4cb0, 0x54b5, 0x58b8, 0x5cb4, 0x64b9, - 0x6cb2, 0x70b6, 0x74b7, 0x7cc6, 0x84bf, 0x8cce, 0x94d0, 0x9ccd, - 0xa4c3, 0xaccb, 0xb4c8, 0xbcc9, 0xc0cc, 0xc8cf, 0xd8bb, 0xe0c5, - 0xe4bc, 0xe6bd, 0xe8ca, 0xf0ba, 0xf8d1, 0x00e1, 0x08d2, 0x10dd, - 0x18db, 0x20d9, 0x2429, 0x265b, 0x2a30, 0x2d1b, 0x2e40, 0x30de, - // Entry C0 - FF - 0x38d3, 0x493f, 0x54e0, 0x5cd8, 0x64d4, 0x6cd6, 0x74df, 0x7cd5, - 0x84da, 0x88c7, 0x8b33, 0x8e75, 0x90c0, 0x92f0, 0x94e8, 0x9ee2, - 0xace6, 0xb0f1, 0xb8e4, 0xc0e7, 0xc8eb, 0xd0e9, 0xd8ee, 0xe08b, - 0xe526, 0xecec, 0xf4f3, 0xfd02, 0x0504, 0x0706, 0x0d07, 0x183c, - 0x1d0e, 0x26a9, 0x2826, 0x2cb1, 0x2ebe, 0x34ea, 0x3d39, 0x4513, - 0x4d18, 0x5508, 0x5d14, 0x6105, 0x650a, 0x6d12, 0x7d0d, 0x7f11, - 0x813e, 0x830f, 0x8515, 0x8d61, 0x9964, 0xa15d, 0xa86e, 0xb117, - 0xb30b, 0xb86c, 0xc10b, 0xc916, 0xd110, 0xd91d, 0xe10c, 0xe84e, - // Entry 100 - 13F - 0xf11c, 0xf524, 0xf923, 0x0122, 0x0925, 0x1129, 0x192c, 0x2023, - 0x2928, 0x312b, 0x3727, 0x391f, 0x3d2d, 0x4131, 0x4930, 0x4ec2, - 0x5519, 0x646b, 0x747b, 0x7e7f, 0x809f, 0x8298, 0x852f, 0x9135, - 0xa53d, 0xac37, 0xb536, 0xb937, 0xbd3b, 0xd940, 0xe542, 0xed5e, - 0xef5e, 0xf657, 0xfd62, 0x7c20, 0x7ef4, 0x80f5, 0x82f6, 0x84f7, - 0x86f8, 0x88f9, 0x8afa, 0x8cfb, 0x8e70, 0x90fd, 0x92fe, 0x94ff, - 0x9700, 0x9901, 0x9b43, 0x9d44, 0x9f45, 0xa146, 0xa347, 0xa548, - 0xa749, 0xa94a, 0xab4b, 0xad4c, 0xaf4d, 0xb14e, 0xb34f, 0xb550, - // Entry 140 - 17F - 0xb751, 0xb952, 0xbb53, 0xbd54, 0xbf55, 0xc156, 0xc357, 0xc558, - 0xc759, 0xc95a, 0xcb5b, 0xcd5c, 0xcf65, -} - -// Size: 1615 bytes -var variantIndex = map[string]uint8{ - "1606nict": 0x0, - "1694acad": 0x1, - "1901": 0x2, - "1959acad": 0x3, - "1994": 0x4d, - "1996": 0x4, - "abl1943": 0x5, - "akuapem": 0x6, - "alalc97": 0x4f, - "aluku": 0x7, - "ao1990": 0x8, - "arevela": 0x9, - "arevmda": 0xa, - "asante": 0xb, - "baku1926": 0xc, - "balanka": 0xd, - "barla": 0xe, - "basiceng": 0xf, - "bauddha": 0x10, - "biscayan": 0x11, - "biske": 0x48, - "bohoric": 0x12, - "boont": 0x13, - "colb1945": 0x14, - "cornu": 0x15, - "dajnko": 0x16, - "ekavsk": 0x17, - "emodeng": 0x18, - "fonipa": 0x50, - "fonnapa": 0x51, - "fonupa": 0x52, - "fonxsamp": 0x53, - "hepburn": 0x19, - "heploc": 0x4e, - "hognorsk": 0x1a, - "hsistemo": 0x1b, - "ijekavsk": 0x1c, - "itihasa": 0x1d, - "jauer": 0x1e, - "jyutping": 0x1f, - "kkcor": 0x20, - "kociewie": 0x21, - "kscor": 0x22, - "laukika": 0x23, - "lipaw": 0x49, - "luna1918": 0x24, - "metelko": 0x25, - "monoton": 0x26, - "ndyuka": 0x27, - "nedis": 0x28, - "newfound": 0x29, - "njiva": 0x4a, - "nulik": 0x2a, - "osojs": 0x4b, - "oxendict": 0x2b, - "pahawh2": 0x2c, - "pahawh3": 0x2d, - "pahawh4": 0x2e, - "pamaka": 0x2f, - "petr1708": 0x30, - "pinyin": 0x31, - "polyton": 0x32, - "puter": 0x33, - "rigik": 0x34, - "rozaj": 0x35, - "rumgr": 0x36, - "scotland": 0x37, - "scouse": 0x38, - "simple": 0x54, - "solba": 0x4c, - "sotav": 0x39, - "spanglis": 0x3a, - "surmiran": 0x3b, - "sursilv": 0x3c, - "sutsilv": 0x3d, - "tarask": 0x3e, - "uccor": 0x3f, - "ucrcor": 0x40, - "ulster": 0x41, - "unifon": 0x42, - "vaidika": 0x43, - "valencia": 0x44, - "vallader": 0x45, - "wadegile": 0x46, - "xsistemo": 0x47, -} - -// variantNumSpecialized is the number of specialized variants in variants. -const variantNumSpecialized = 79 - -// nRegionGroups is the number of region groups. -const nRegionGroups = 33 - -type likelyLangRegion struct { - lang uint16 - region uint16 -} - -// likelyScript is a lookup table, indexed by scriptID, for the most likely -// languages and regions given a script. -// Size: 976 bytes, 244 elements -var likelyScript = [244]likelyLangRegion{ - 1: {lang: 0x14e, region: 0x84}, - 3: {lang: 0x2a2, region: 0x106}, - 4: {lang: 0x1f, region: 0x99}, - 5: {lang: 0x3a, region: 0x6b}, - 7: {lang: 0x3b, region: 0x9c}, - 8: {lang: 0x1d7, region: 0x28}, - 9: {lang: 0x13, region: 0x9c}, - 10: {lang: 0x5b, region: 0x95}, - 11: {lang: 0x60, region: 0x52}, - 12: {lang: 0xb9, region: 0xb4}, - 13: {lang: 0x63, region: 0x95}, - 14: {lang: 0xa5, region: 0x35}, - 15: {lang: 0x3e9, region: 0x99}, - 17: {lang: 0x529, region: 0x12e}, - 18: {lang: 0x3b1, region: 0x99}, - 19: {lang: 0x15e, region: 0x78}, - 20: {lang: 0xc2, region: 0x95}, - 21: {lang: 0x9d, region: 0xe7}, - 22: {lang: 0xdb, region: 0x35}, - 23: {lang: 0xf3, region: 0x49}, - 24: {lang: 0x4f0, region: 0x12b}, - 25: {lang: 0xe7, region: 0x13e}, - 26: {lang: 0xe5, region: 0x135}, - 28: {lang: 0xf1, region: 0x6b}, - 30: {lang: 0x1a0, region: 0x5d}, - 31: {lang: 0x3e2, region: 0x106}, - 33: {lang: 0x1be, region: 0x99}, - 36: {lang: 0x15e, region: 0x78}, - 39: {lang: 0x133, region: 0x6b}, - 40: {lang: 0x431, region: 0x27}, - 41: {lang: 0x27, region: 0x6f}, - 43: {lang: 0x210, region: 0x7d}, - 44: {lang: 0xfe, region: 0x38}, - 46: {lang: 0x19b, region: 0x99}, - 47: {lang: 0x19e, region: 0x130}, - 48: {lang: 0x3e9, region: 0x99}, - 49: {lang: 0x136, region: 0x87}, - 50: {lang: 0x1a4, region: 0x99}, - 51: {lang: 0x39d, region: 0x99}, - 52: {lang: 0x529, region: 0x12e}, - 53: {lang: 0x254, region: 0xab}, - 54: {lang: 0x529, region: 0x53}, - 55: {lang: 0x1cb, region: 0xe7}, - 56: {lang: 0x529, region: 0x53}, - 57: {lang: 0x529, region: 0x12e}, - 58: {lang: 0x2fd, region: 0x9b}, - 59: {lang: 0x1bc, region: 0x97}, - 60: {lang: 0x200, region: 0xa2}, - 61: {lang: 0x1c5, region: 0x12b}, - 62: {lang: 0x1ca, region: 0xaf}, - 65: {lang: 0x1d5, region: 0x92}, - 67: {lang: 0x142, region: 0x9e}, - 68: {lang: 0x254, region: 0xab}, - 69: {lang: 0x20e, region: 0x95}, - 70: {lang: 0x200, region: 0xa2}, - 72: {lang: 0x135, region: 0xc4}, - 73: {lang: 0x200, region: 0xa2}, - 74: {lang: 0x3bb, region: 0xe8}, - 75: {lang: 0x24a, region: 0xa6}, - 76: {lang: 0x3fa, region: 0x99}, - 79: {lang: 0x251, region: 0x99}, - 80: {lang: 0x254, region: 0xab}, - 82: {lang: 0x88, region: 0x99}, - 83: {lang: 0x370, region: 0x123}, - 84: {lang: 0x2b8, region: 0xaf}, - 89: {lang: 0x29f, region: 0x99}, - 90: {lang: 0x2a8, region: 0x99}, - 91: {lang: 0x28f, region: 0x87}, - 92: {lang: 0x1a0, region: 0x87}, - 93: {lang: 0x2ac, region: 0x53}, - 95: {lang: 0x4f4, region: 0x12b}, - 96: {lang: 0x4f5, region: 0x12b}, - 97: {lang: 0x1be, region: 0x99}, - 99: {lang: 0x337, region: 0x9c}, - 100: {lang: 0x4f7, region: 0x53}, - 101: {lang: 0xa9, region: 0x53}, - 104: {lang: 0x2e8, region: 0x112}, - 105: {lang: 0x4f8, region: 0x10b}, - 106: {lang: 0x4f8, region: 0x10b}, - 107: {lang: 0x304, region: 0x99}, - 108: {lang: 0x31b, region: 0x99}, - 109: {lang: 0x30b, region: 0x53}, - 111: {lang: 0x31e, region: 0x35}, - 112: {lang: 0x30e, region: 0x99}, - 113: {lang: 0x414, region: 0xe8}, - 114: {lang: 0x331, region: 0xc4}, - 115: {lang: 0x4f9, region: 0x108}, - 116: {lang: 0x3b, region: 0xa1}, - 117: {lang: 0x353, region: 0xdb}, - 120: {lang: 0x2d0, region: 0x84}, - 121: {lang: 0x52a, region: 0x53}, - 122: {lang: 0x403, region: 0x96}, - 123: {lang: 0x3ee, region: 0x99}, - 124: {lang: 0x39b, region: 0xc5}, - 125: {lang: 0x395, region: 0x99}, - 126: {lang: 0x399, region: 0x135}, - 127: {lang: 0x429, region: 0x115}, - 128: {lang: 0x3b, region: 0x11c}, - 129: {lang: 0xfd, region: 0xc4}, - 130: {lang: 0x27d, region: 0x106}, - 131: {lang: 0x2c9, region: 0x53}, - 132: {lang: 0x39f, region: 0x9c}, - 133: {lang: 0x39f, region: 0x53}, - 135: {lang: 0x3ad, region: 0xb0}, - 137: {lang: 0x1c6, region: 0x53}, - 138: {lang: 0x4fd, region: 0x9c}, - 189: {lang: 0x3cb, region: 0x95}, - 191: {lang: 0x372, region: 0x10c}, - 192: {lang: 0x420, region: 0x97}, - 194: {lang: 0x4ff, region: 0x15e}, - 195: {lang: 0x3f0, region: 0x99}, - 196: {lang: 0x45, region: 0x135}, - 197: {lang: 0x139, region: 0x7b}, - 198: {lang: 0x3e9, region: 0x99}, - 200: {lang: 0x3e9, region: 0x99}, - 201: {lang: 0x3fa, region: 0x99}, - 202: {lang: 0x40c, region: 0xb3}, - 203: {lang: 0x433, region: 0x99}, - 204: {lang: 0xef, region: 0xc5}, - 205: {lang: 0x43e, region: 0x95}, - 206: {lang: 0x44d, region: 0x35}, - 207: {lang: 0x44e, region: 0x9b}, - 211: {lang: 0x45a, region: 0xe7}, - 212: {lang: 0x11a, region: 0x99}, - 213: {lang: 0x45e, region: 0x53}, - 214: {lang: 0x232, region: 0x53}, - 215: {lang: 0x450, region: 0x99}, - 216: {lang: 0x4a5, region: 0x53}, - 217: {lang: 0x9f, region: 0x13e}, - 218: {lang: 0x461, region: 0x99}, - 220: {lang: 0x528, region: 0xba}, - 221: {lang: 0x153, region: 0xe7}, - 222: {lang: 0x128, region: 0xcd}, - 223: {lang: 0x46b, region: 0x123}, - 224: {lang: 0xa9, region: 0x53}, - 225: {lang: 0x2ce, region: 0x99}, - 226: {lang: 0x4ad, region: 0x11c}, - 227: {lang: 0x4be, region: 0xb4}, - 229: {lang: 0x1ce, region: 0x99}, - 232: {lang: 0x3a9, region: 0x9c}, - 233: {lang: 0x22, region: 0x9b}, - 234: {lang: 0x1ea, region: 0x53}, - 235: {lang: 0xef, region: 0xc5}, -} - -type likelyScriptRegion struct { - region uint16 - script uint8 - flags uint8 -} - -// likelyLang is a lookup table, indexed by langID, for the most likely -// scripts and regions given incomplete information. If more entries exist for a -// given language, region and script are the index and size respectively -// of the list in likelyLangList. -// Size: 5320 bytes, 1330 elements -var likelyLang = [1330]likelyScriptRegion{ - 0: {region: 0x135, script: 0x57, flags: 0x0}, - 1: {region: 0x6f, script: 0x57, flags: 0x0}, - 2: {region: 0x165, script: 0x57, flags: 0x0}, - 3: {region: 0x165, script: 0x57, flags: 0x0}, - 4: {region: 0x165, script: 0x57, flags: 0x0}, - 5: {region: 0x7d, script: 0x1f, flags: 0x0}, - 6: {region: 0x165, script: 0x57, flags: 0x0}, - 7: {region: 0x165, script: 0x1f, flags: 0x0}, - 8: {region: 0x80, script: 0x57, flags: 0x0}, - 9: {region: 0x165, script: 0x57, flags: 0x0}, - 10: {region: 0x165, script: 0x57, flags: 0x0}, - 11: {region: 0x165, script: 0x57, flags: 0x0}, - 12: {region: 0x95, script: 0x57, flags: 0x0}, - 13: {region: 0x131, script: 0x57, flags: 0x0}, - 14: {region: 0x80, script: 0x57, flags: 0x0}, - 15: {region: 0x165, script: 0x57, flags: 0x0}, - 16: {region: 0x165, script: 0x57, flags: 0x0}, - 17: {region: 0x106, script: 0x1f, flags: 0x0}, - 18: {region: 0x165, script: 0x57, flags: 0x0}, - 19: {region: 0x9c, script: 0x9, flags: 0x0}, - 20: {region: 0x128, script: 0x5, flags: 0x0}, - 21: {region: 0x165, script: 0x57, flags: 0x0}, - 22: {region: 0x161, script: 0x57, flags: 0x0}, - 23: {region: 0x165, script: 0x57, flags: 0x0}, - 24: {region: 0x165, script: 0x57, flags: 0x0}, - 25: {region: 0x165, script: 0x57, flags: 0x0}, - 26: {region: 0x165, script: 0x57, flags: 0x0}, - 27: {region: 0x165, script: 0x57, flags: 0x0}, - 28: {region: 0x52, script: 0x57, flags: 0x0}, - 29: {region: 0x165, script: 0x57, flags: 0x0}, - 30: {region: 0x165, script: 0x57, flags: 0x0}, - 31: {region: 0x99, script: 0x4, flags: 0x0}, - 32: {region: 0x165, script: 0x57, flags: 0x0}, - 33: {region: 0x80, script: 0x57, flags: 0x0}, - 34: {region: 0x9b, script: 0xe9, flags: 0x0}, - 35: {region: 0x165, script: 0x57, flags: 0x0}, - 36: {region: 0x165, script: 0x57, flags: 0x0}, - 37: {region: 0x14d, script: 0x57, flags: 0x0}, - 38: {region: 0x106, script: 0x1f, flags: 0x0}, - 39: {region: 0x6f, script: 0x29, flags: 0x0}, - 40: {region: 0x165, script: 0x57, flags: 0x0}, - 41: {region: 0x165, script: 0x57, flags: 0x0}, - 42: {region: 0xd6, script: 0x57, flags: 0x0}, - 43: {region: 0x165, script: 0x57, flags: 0x0}, - 45: {region: 0x165, script: 0x57, flags: 0x0}, - 46: {region: 0x165, script: 0x57, flags: 0x0}, - 47: {region: 0x165, script: 0x57, flags: 0x0}, - 48: {region: 0x165, script: 0x57, flags: 0x0}, - 49: {region: 0x165, script: 0x57, flags: 0x0}, - 50: {region: 0x165, script: 0x57, flags: 0x0}, - 51: {region: 0x95, script: 0x57, flags: 0x0}, - 52: {region: 0x165, script: 0x5, flags: 0x0}, - 53: {region: 0x122, script: 0x5, flags: 0x0}, - 54: {region: 0x165, script: 0x57, flags: 0x0}, - 55: {region: 0x165, script: 0x57, flags: 0x0}, - 56: {region: 0x165, script: 0x57, flags: 0x0}, - 57: {region: 0x165, script: 0x57, flags: 0x0}, - 58: {region: 0x6b, script: 0x5, flags: 0x0}, - 59: {region: 0x0, script: 0x3, flags: 0x1}, - 60: {region: 0x165, script: 0x57, flags: 0x0}, - 61: {region: 0x51, script: 0x57, flags: 0x0}, - 62: {region: 0x3f, script: 0x57, flags: 0x0}, - 63: {region: 0x67, script: 0x5, flags: 0x0}, - 65: {region: 0xba, script: 0x5, flags: 0x0}, - 66: {region: 0x6b, script: 0x5, flags: 0x0}, - 67: {region: 0x99, script: 0xe, flags: 0x0}, - 68: {region: 0x12f, script: 0x57, flags: 0x0}, - 69: {region: 0x135, script: 0xc4, flags: 0x0}, - 70: {region: 0x165, script: 0x57, flags: 0x0}, - 71: {region: 0x165, script: 0x57, flags: 0x0}, - 72: {region: 0x6e, script: 0x57, flags: 0x0}, - 73: {region: 0x165, script: 0x57, flags: 0x0}, - 74: {region: 0x165, script: 0x57, flags: 0x0}, - 75: {region: 0x49, script: 0x57, flags: 0x0}, - 76: {region: 0x165, script: 0x57, flags: 0x0}, - 77: {region: 0x106, script: 0x1f, flags: 0x0}, - 78: {region: 0x165, script: 0x5, flags: 0x0}, - 79: {region: 0x165, script: 0x57, flags: 0x0}, - 80: {region: 0x165, script: 0x57, flags: 0x0}, - 81: {region: 0x165, script: 0x57, flags: 0x0}, - 82: {region: 0x99, script: 0x21, flags: 0x0}, - 83: {region: 0x165, script: 0x57, flags: 0x0}, - 84: {region: 0x165, script: 0x57, flags: 0x0}, - 85: {region: 0x165, script: 0x57, flags: 0x0}, - 86: {region: 0x3f, script: 0x57, flags: 0x0}, - 87: {region: 0x165, script: 0x57, flags: 0x0}, - 88: {region: 0x3, script: 0x5, flags: 0x1}, - 89: {region: 0x106, script: 0x1f, flags: 0x0}, - 90: {region: 0xe8, script: 0x5, flags: 0x0}, - 91: {region: 0x95, script: 0x57, flags: 0x0}, - 92: {region: 0xdb, script: 0x21, flags: 0x0}, - 93: {region: 0x2e, script: 0x57, flags: 0x0}, - 94: {region: 0x52, script: 0x57, flags: 0x0}, - 95: {region: 0x165, script: 0x57, flags: 0x0}, - 96: {region: 0x52, script: 0xb, flags: 0x0}, - 97: {region: 0x165, script: 0x57, flags: 0x0}, - 98: {region: 0x165, script: 0x57, flags: 0x0}, - 99: {region: 0x95, script: 0x57, flags: 0x0}, - 100: {region: 0x165, script: 0x57, flags: 0x0}, - 101: {region: 0x52, script: 0x57, flags: 0x0}, - 102: {region: 0x165, script: 0x57, flags: 0x0}, - 103: {region: 0x165, script: 0x57, flags: 0x0}, - 104: {region: 0x165, script: 0x57, flags: 0x0}, - 105: {region: 0x165, script: 0x57, flags: 0x0}, - 106: {region: 0x4f, script: 0x57, flags: 0x0}, - 107: {region: 0x165, script: 0x57, flags: 0x0}, - 108: {region: 0x165, script: 0x57, flags: 0x0}, - 109: {region: 0x165, script: 0x57, flags: 0x0}, - 110: {region: 0x165, script: 0x29, flags: 0x0}, - 111: {region: 0x165, script: 0x57, flags: 0x0}, - 112: {region: 0x165, script: 0x57, flags: 0x0}, - 113: {region: 0x47, script: 0x1f, flags: 0x0}, - 114: {region: 0x165, script: 0x57, flags: 0x0}, - 115: {region: 0x165, script: 0x57, flags: 0x0}, - 116: {region: 0x10b, script: 0x5, flags: 0x0}, - 117: {region: 0x162, script: 0x57, flags: 0x0}, - 118: {region: 0x165, script: 0x57, flags: 0x0}, - 119: {region: 0x95, script: 0x57, flags: 0x0}, - 120: {region: 0x165, script: 0x57, flags: 0x0}, - 121: {region: 0x12f, script: 0x57, flags: 0x0}, - 122: {region: 0x52, script: 0x57, flags: 0x0}, - 123: {region: 0x99, script: 0xd7, flags: 0x0}, - 124: {region: 0xe8, script: 0x5, flags: 0x0}, - 125: {region: 0x99, script: 0x21, flags: 0x0}, - 126: {region: 0x38, script: 0x1f, flags: 0x0}, - 127: {region: 0x99, script: 0x21, flags: 0x0}, - 128: {region: 0xe8, script: 0x5, flags: 0x0}, - 129: {region: 0x12b, script: 0x31, flags: 0x0}, - 131: {region: 0x99, script: 0x21, flags: 0x0}, - 132: {region: 0x165, script: 0x57, flags: 0x0}, - 133: {region: 0x99, script: 0x21, flags: 0x0}, - 134: {region: 0xe7, script: 0x57, flags: 0x0}, - 135: {region: 0x165, script: 0x57, flags: 0x0}, - 136: {region: 0x99, script: 0x21, flags: 0x0}, - 137: {region: 0x165, script: 0x57, flags: 0x0}, - 138: {region: 0x13f, script: 0x57, flags: 0x0}, - 139: {region: 0x165, script: 0x57, flags: 0x0}, - 140: {region: 0x165, script: 0x57, flags: 0x0}, - 141: {region: 0xe7, script: 0x57, flags: 0x0}, - 142: {region: 0x165, script: 0x57, flags: 0x0}, - 143: {region: 0xd6, script: 0x57, flags: 0x0}, - 144: {region: 0x165, script: 0x57, flags: 0x0}, - 145: {region: 0x165, script: 0x57, flags: 0x0}, - 146: {region: 0x165, script: 0x57, flags: 0x0}, - 147: {region: 0x165, script: 0x29, flags: 0x0}, - 148: {region: 0x99, script: 0x21, flags: 0x0}, - 149: {region: 0x95, script: 0x57, flags: 0x0}, - 150: {region: 0x165, script: 0x57, flags: 0x0}, - 151: {region: 0x165, script: 0x57, flags: 0x0}, - 152: {region: 0x114, script: 0x57, flags: 0x0}, - 153: {region: 0x165, script: 0x57, flags: 0x0}, - 154: {region: 0x165, script: 0x57, flags: 0x0}, - 155: {region: 0x52, script: 0x57, flags: 0x0}, - 156: {region: 0x165, script: 0x57, flags: 0x0}, - 157: {region: 0xe7, script: 0x57, flags: 0x0}, - 158: {region: 0x165, script: 0x57, flags: 0x0}, - 159: {region: 0x13e, script: 0xd9, flags: 0x0}, - 160: {region: 0xc3, script: 0x57, flags: 0x0}, - 161: {region: 0x165, script: 0x57, flags: 0x0}, - 162: {region: 0x165, script: 0x57, flags: 0x0}, - 163: {region: 0xc3, script: 0x57, flags: 0x0}, - 164: {region: 0x165, script: 0x57, flags: 0x0}, - 165: {region: 0x35, script: 0xe, flags: 0x0}, - 166: {region: 0x165, script: 0x57, flags: 0x0}, - 167: {region: 0x165, script: 0x57, flags: 0x0}, - 168: {region: 0x165, script: 0x57, flags: 0x0}, - 169: {region: 0x53, script: 0xe0, flags: 0x0}, - 170: {region: 0x165, script: 0x57, flags: 0x0}, - 171: {region: 0x165, script: 0x57, flags: 0x0}, - 172: {region: 0x165, script: 0x57, flags: 0x0}, - 173: {region: 0x99, script: 0xe, flags: 0x0}, - 174: {region: 0x165, script: 0x57, flags: 0x0}, - 175: {region: 0x9c, script: 0x5, flags: 0x0}, - 176: {region: 0x165, script: 0x57, flags: 0x0}, - 177: {region: 0x4f, script: 0x57, flags: 0x0}, - 178: {region: 0x78, script: 0x57, flags: 0x0}, - 179: {region: 0x99, script: 0x21, flags: 0x0}, - 180: {region: 0xe8, script: 0x5, flags: 0x0}, - 181: {region: 0x99, script: 0x21, flags: 0x0}, - 182: {region: 0x165, script: 0x57, flags: 0x0}, - 183: {region: 0x33, script: 0x57, flags: 0x0}, - 184: {region: 0x165, script: 0x57, flags: 0x0}, - 185: {region: 0xb4, script: 0xc, flags: 0x0}, - 186: {region: 0x52, script: 0x57, flags: 0x0}, - 187: {region: 0x165, script: 0x29, flags: 0x0}, - 188: {region: 0xe7, script: 0x57, flags: 0x0}, - 189: {region: 0x165, script: 0x57, flags: 0x0}, - 190: {region: 0xe8, script: 0x21, flags: 0x0}, - 191: {region: 0x106, script: 0x1f, flags: 0x0}, - 192: {region: 0x15f, script: 0x57, flags: 0x0}, - 193: {region: 0x165, script: 0x57, flags: 0x0}, - 194: {region: 0x95, script: 0x57, flags: 0x0}, - 195: {region: 0x165, script: 0x57, flags: 0x0}, - 196: {region: 0x52, script: 0x57, flags: 0x0}, - 197: {region: 0x165, script: 0x57, flags: 0x0}, - 198: {region: 0x165, script: 0x57, flags: 0x0}, - 199: {region: 0x165, script: 0x57, flags: 0x0}, - 200: {region: 0x86, script: 0x57, flags: 0x0}, - 201: {region: 0x165, script: 0x57, flags: 0x0}, - 202: {region: 0x165, script: 0x57, flags: 0x0}, - 203: {region: 0x165, script: 0x57, flags: 0x0}, - 204: {region: 0x165, script: 0x57, flags: 0x0}, - 205: {region: 0x6d, script: 0x29, flags: 0x0}, - 206: {region: 0x165, script: 0x57, flags: 0x0}, - 207: {region: 0x165, script: 0x57, flags: 0x0}, - 208: {region: 0x52, script: 0x57, flags: 0x0}, - 209: {region: 0x165, script: 0x57, flags: 0x0}, - 210: {region: 0x165, script: 0x57, flags: 0x0}, - 211: {region: 0xc3, script: 0x57, flags: 0x0}, - 212: {region: 0x165, script: 0x57, flags: 0x0}, - 213: {region: 0x165, script: 0x57, flags: 0x0}, - 214: {region: 0x165, script: 0x57, flags: 0x0}, - 215: {region: 0x6e, script: 0x57, flags: 0x0}, - 216: {region: 0x165, script: 0x57, flags: 0x0}, - 217: {region: 0x165, script: 0x57, flags: 0x0}, - 218: {region: 0xd6, script: 0x57, flags: 0x0}, - 219: {region: 0x35, script: 0x16, flags: 0x0}, - 220: {region: 0x106, script: 0x1f, flags: 0x0}, - 221: {region: 0xe7, script: 0x57, flags: 0x0}, - 222: {region: 0x165, script: 0x57, flags: 0x0}, - 223: {region: 0x131, script: 0x57, flags: 0x0}, - 224: {region: 0x8a, script: 0x57, flags: 0x0}, - 225: {region: 0x75, script: 0x57, flags: 0x0}, - 226: {region: 0x106, script: 0x1f, flags: 0x0}, - 227: {region: 0x135, script: 0x57, flags: 0x0}, - 228: {region: 0x49, script: 0x57, flags: 0x0}, - 229: {region: 0x135, script: 0x1a, flags: 0x0}, - 230: {region: 0xa6, script: 0x5, flags: 0x0}, - 231: {region: 0x13e, script: 0x19, flags: 0x0}, - 232: {region: 0x165, script: 0x57, flags: 0x0}, - 233: {region: 0x9b, script: 0x5, flags: 0x0}, - 234: {region: 0x165, script: 0x57, flags: 0x0}, - 235: {region: 0x165, script: 0x57, flags: 0x0}, - 236: {region: 0x165, script: 0x57, flags: 0x0}, - 237: {region: 0x165, script: 0x57, flags: 0x0}, - 238: {region: 0x165, script: 0x57, flags: 0x0}, - 239: {region: 0xc5, script: 0xcc, flags: 0x0}, - 240: {region: 0x78, script: 0x57, flags: 0x0}, - 241: {region: 0x6b, script: 0x1c, flags: 0x0}, - 242: {region: 0xe7, script: 0x57, flags: 0x0}, - 243: {region: 0x49, script: 0x17, flags: 0x0}, - 244: {region: 0x130, script: 0x1f, flags: 0x0}, - 245: {region: 0x49, script: 0x17, flags: 0x0}, - 246: {region: 0x49, script: 0x17, flags: 0x0}, - 247: {region: 0x49, script: 0x17, flags: 0x0}, - 248: {region: 0x49, script: 0x17, flags: 0x0}, - 249: {region: 0x10a, script: 0x57, flags: 0x0}, - 250: {region: 0x5e, script: 0x57, flags: 0x0}, - 251: {region: 0xe9, script: 0x57, flags: 0x0}, - 252: {region: 0x49, script: 0x17, flags: 0x0}, - 253: {region: 0xc4, script: 0x81, flags: 0x0}, - 254: {region: 0x8, script: 0x2, flags: 0x1}, - 255: {region: 0x106, script: 0x1f, flags: 0x0}, - 256: {region: 0x7b, script: 0x57, flags: 0x0}, - 257: {region: 0x63, script: 0x57, flags: 0x0}, - 258: {region: 0x165, script: 0x57, flags: 0x0}, - 259: {region: 0x165, script: 0x57, flags: 0x0}, - 260: {region: 0x165, script: 0x57, flags: 0x0}, - 261: {region: 0x165, script: 0x57, flags: 0x0}, - 262: {region: 0x135, script: 0x57, flags: 0x0}, - 263: {region: 0x106, script: 0x1f, flags: 0x0}, - 264: {region: 0xa4, script: 0x57, flags: 0x0}, - 265: {region: 0x165, script: 0x57, flags: 0x0}, - 266: {region: 0x165, script: 0x57, flags: 0x0}, - 267: {region: 0x99, script: 0x5, flags: 0x0}, - 268: {region: 0x165, script: 0x57, flags: 0x0}, - 269: {region: 0x60, script: 0x57, flags: 0x0}, - 270: {region: 0x165, script: 0x57, flags: 0x0}, - 271: {region: 0x49, script: 0x57, flags: 0x0}, - 272: {region: 0x165, script: 0x57, flags: 0x0}, - 273: {region: 0x165, script: 0x57, flags: 0x0}, - 274: {region: 0x165, script: 0x57, flags: 0x0}, - 275: {region: 0x165, script: 0x5, flags: 0x0}, - 276: {region: 0x49, script: 0x57, flags: 0x0}, - 277: {region: 0x165, script: 0x57, flags: 0x0}, - 278: {region: 0x165, script: 0x57, flags: 0x0}, - 279: {region: 0xd4, script: 0x57, flags: 0x0}, - 280: {region: 0x4f, script: 0x57, flags: 0x0}, - 281: {region: 0x165, script: 0x57, flags: 0x0}, - 282: {region: 0x99, script: 0x5, flags: 0x0}, - 283: {region: 0x165, script: 0x57, flags: 0x0}, - 284: {region: 0x165, script: 0x57, flags: 0x0}, - 285: {region: 0x165, script: 0x57, flags: 0x0}, - 286: {region: 0x165, script: 0x29, flags: 0x0}, - 287: {region: 0x60, script: 0x57, flags: 0x0}, - 288: {region: 0xc3, script: 0x57, flags: 0x0}, - 289: {region: 0xd0, script: 0x57, flags: 0x0}, - 290: {region: 0x165, script: 0x57, flags: 0x0}, - 291: {region: 0xdb, script: 0x21, flags: 0x0}, - 292: {region: 0x52, script: 0x57, flags: 0x0}, - 293: {region: 0x165, script: 0x57, flags: 0x0}, - 294: {region: 0x165, script: 0x57, flags: 0x0}, - 295: {region: 0x165, script: 0x57, flags: 0x0}, - 296: {region: 0xcd, script: 0xde, flags: 0x0}, - 297: {region: 0x165, script: 0x57, flags: 0x0}, - 298: {region: 0x165, script: 0x57, flags: 0x0}, - 299: {region: 0x114, script: 0x57, flags: 0x0}, - 300: {region: 0x37, script: 0x57, flags: 0x0}, - 301: {region: 0x43, script: 0xe0, flags: 0x0}, - 302: {region: 0x165, script: 0x57, flags: 0x0}, - 303: {region: 0xa4, script: 0x57, flags: 0x0}, - 304: {region: 0x80, script: 0x57, flags: 0x0}, - 305: {region: 0xd6, script: 0x57, flags: 0x0}, - 306: {region: 0x9e, script: 0x57, flags: 0x0}, - 307: {region: 0x6b, script: 0x27, flags: 0x0}, - 308: {region: 0x165, script: 0x57, flags: 0x0}, - 309: {region: 0xc4, script: 0x48, flags: 0x0}, - 310: {region: 0x87, script: 0x31, flags: 0x0}, - 311: {region: 0x165, script: 0x57, flags: 0x0}, - 312: {region: 0x165, script: 0x57, flags: 0x0}, - 313: {region: 0xa, script: 0x2, flags: 0x1}, - 314: {region: 0x165, script: 0x57, flags: 0x0}, - 315: {region: 0x165, script: 0x57, flags: 0x0}, - 316: {region: 0x1, script: 0x57, flags: 0x0}, - 317: {region: 0x165, script: 0x57, flags: 0x0}, - 318: {region: 0x6e, script: 0x57, flags: 0x0}, - 319: {region: 0x135, script: 0x57, flags: 0x0}, - 320: {region: 0x6a, script: 0x57, flags: 0x0}, - 321: {region: 0x165, script: 0x57, flags: 0x0}, - 322: {region: 0x9e, script: 0x43, flags: 0x0}, - 323: {region: 0x165, script: 0x57, flags: 0x0}, - 324: {region: 0x165, script: 0x57, flags: 0x0}, - 325: {region: 0x6e, script: 0x57, flags: 0x0}, - 326: {region: 0x52, script: 0x57, flags: 0x0}, - 327: {region: 0x6e, script: 0x57, flags: 0x0}, - 328: {region: 0x9c, script: 0x5, flags: 0x0}, - 329: {region: 0x165, script: 0x57, flags: 0x0}, - 330: {region: 0x165, script: 0x57, flags: 0x0}, - 331: {region: 0x165, script: 0x57, flags: 0x0}, - 332: {region: 0x165, script: 0x57, flags: 0x0}, - 333: {region: 0x86, script: 0x57, flags: 0x0}, - 334: {region: 0xc, script: 0x2, flags: 0x1}, - 335: {region: 0x165, script: 0x57, flags: 0x0}, - 336: {region: 0xc3, script: 0x57, flags: 0x0}, - 337: {region: 0x72, script: 0x57, flags: 0x0}, - 338: {region: 0x10b, script: 0x5, flags: 0x0}, - 339: {region: 0xe7, script: 0x57, flags: 0x0}, - 340: {region: 0x10c, script: 0x57, flags: 0x0}, - 341: {region: 0x73, script: 0x57, flags: 0x0}, - 342: {region: 0x165, script: 0x57, flags: 0x0}, - 343: {region: 0x165, script: 0x57, flags: 0x0}, - 344: {region: 0x76, script: 0x57, flags: 0x0}, - 345: {region: 0x165, script: 0x57, flags: 0x0}, - 346: {region: 0x3b, script: 0x57, flags: 0x0}, - 347: {region: 0x165, script: 0x57, flags: 0x0}, - 348: {region: 0x165, script: 0x57, flags: 0x0}, - 349: {region: 0x165, script: 0x57, flags: 0x0}, - 350: {region: 0x78, script: 0x57, flags: 0x0}, - 351: {region: 0x135, script: 0x57, flags: 0x0}, - 352: {region: 0x78, script: 0x57, flags: 0x0}, - 353: {region: 0x60, script: 0x57, flags: 0x0}, - 354: {region: 0x60, script: 0x57, flags: 0x0}, - 355: {region: 0x52, script: 0x5, flags: 0x0}, - 356: {region: 0x140, script: 0x57, flags: 0x0}, - 357: {region: 0x165, script: 0x57, flags: 0x0}, - 358: {region: 0x84, script: 0x57, flags: 0x0}, - 359: {region: 0x165, script: 0x57, flags: 0x0}, - 360: {region: 0xd4, script: 0x57, flags: 0x0}, - 361: {region: 0x9e, script: 0x57, flags: 0x0}, - 362: {region: 0xd6, script: 0x57, flags: 0x0}, - 363: {region: 0x165, script: 0x57, flags: 0x0}, - 364: {region: 0x10b, script: 0x57, flags: 0x0}, - 365: {region: 0xd9, script: 0x57, flags: 0x0}, - 366: {region: 0x96, script: 0x57, flags: 0x0}, - 367: {region: 0x80, script: 0x57, flags: 0x0}, - 368: {region: 0x165, script: 0x57, flags: 0x0}, - 369: {region: 0xbc, script: 0x57, flags: 0x0}, - 370: {region: 0x165, script: 0x57, flags: 0x0}, - 371: {region: 0x165, script: 0x57, flags: 0x0}, - 372: {region: 0x165, script: 0x57, flags: 0x0}, - 373: {region: 0x53, script: 0x38, flags: 0x0}, - 374: {region: 0x165, script: 0x57, flags: 0x0}, - 375: {region: 0x95, script: 0x57, flags: 0x0}, - 376: {region: 0x165, script: 0x57, flags: 0x0}, - 377: {region: 0x165, script: 0x57, flags: 0x0}, - 378: {region: 0x99, script: 0x21, flags: 0x0}, - 379: {region: 0x165, script: 0x57, flags: 0x0}, - 380: {region: 0x9c, script: 0x5, flags: 0x0}, - 381: {region: 0x7e, script: 0x57, flags: 0x0}, - 382: {region: 0x7b, script: 0x57, flags: 0x0}, - 383: {region: 0x165, script: 0x57, flags: 0x0}, - 384: {region: 0x165, script: 0x57, flags: 0x0}, - 385: {region: 0x165, script: 0x57, flags: 0x0}, - 386: {region: 0x165, script: 0x57, flags: 0x0}, - 387: {region: 0x165, script: 0x57, flags: 0x0}, - 388: {region: 0x165, script: 0x57, flags: 0x0}, - 389: {region: 0x6f, script: 0x29, flags: 0x0}, - 390: {region: 0x165, script: 0x57, flags: 0x0}, - 391: {region: 0xdb, script: 0x21, flags: 0x0}, - 392: {region: 0x165, script: 0x57, flags: 0x0}, - 393: {region: 0xa7, script: 0x57, flags: 0x0}, - 394: {region: 0x165, script: 0x57, flags: 0x0}, - 395: {region: 0xe8, script: 0x5, flags: 0x0}, - 396: {region: 0x165, script: 0x57, flags: 0x0}, - 397: {region: 0xe8, script: 0x5, flags: 0x0}, - 398: {region: 0x165, script: 0x57, flags: 0x0}, - 399: {region: 0x165, script: 0x57, flags: 0x0}, - 400: {region: 0x6e, script: 0x57, flags: 0x0}, - 401: {region: 0x9c, script: 0x5, flags: 0x0}, - 402: {region: 0x165, script: 0x57, flags: 0x0}, - 403: {region: 0x165, script: 0x29, flags: 0x0}, - 404: {region: 0xf1, script: 0x57, flags: 0x0}, - 405: {region: 0x165, script: 0x57, flags: 0x0}, - 406: {region: 0x165, script: 0x57, flags: 0x0}, - 407: {region: 0x165, script: 0x57, flags: 0x0}, - 408: {region: 0x165, script: 0x29, flags: 0x0}, - 409: {region: 0x165, script: 0x57, flags: 0x0}, - 410: {region: 0x99, script: 0x21, flags: 0x0}, - 411: {region: 0x99, script: 0xda, flags: 0x0}, - 412: {region: 0x95, script: 0x57, flags: 0x0}, - 413: {region: 0xd9, script: 0x57, flags: 0x0}, - 414: {region: 0x130, script: 0x2f, flags: 0x0}, - 415: {region: 0x165, script: 0x57, flags: 0x0}, - 416: {region: 0xe, script: 0x2, flags: 0x1}, - 417: {region: 0x99, script: 0xe, flags: 0x0}, - 418: {region: 0x165, script: 0x57, flags: 0x0}, - 419: {region: 0x4e, script: 0x57, flags: 0x0}, - 420: {region: 0x99, script: 0x32, flags: 0x0}, - 421: {region: 0x41, script: 0x57, flags: 0x0}, - 422: {region: 0x54, script: 0x57, flags: 0x0}, - 423: {region: 0x165, script: 0x57, flags: 0x0}, - 424: {region: 0x80, script: 0x57, flags: 0x0}, - 425: {region: 0x165, script: 0x57, flags: 0x0}, - 426: {region: 0x165, script: 0x57, flags: 0x0}, - 427: {region: 0xa4, script: 0x57, flags: 0x0}, - 428: {region: 0x98, script: 0x57, flags: 0x0}, - 429: {region: 0x165, script: 0x57, flags: 0x0}, - 430: {region: 0xdb, script: 0x21, flags: 0x0}, - 431: {region: 0x165, script: 0x57, flags: 0x0}, - 432: {region: 0x165, script: 0x5, flags: 0x0}, - 433: {region: 0x49, script: 0x57, flags: 0x0}, - 434: {region: 0x165, script: 0x5, flags: 0x0}, - 435: {region: 0x165, script: 0x57, flags: 0x0}, - 436: {region: 0x10, script: 0x3, flags: 0x1}, - 437: {region: 0x165, script: 0x57, flags: 0x0}, - 438: {region: 0x53, script: 0x38, flags: 0x0}, - 439: {region: 0x165, script: 0x57, flags: 0x0}, - 440: {region: 0x135, script: 0x57, flags: 0x0}, - 441: {region: 0x24, script: 0x5, flags: 0x0}, - 442: {region: 0x165, script: 0x57, flags: 0x0}, - 443: {region: 0x165, script: 0x29, flags: 0x0}, - 444: {region: 0x97, script: 0x3b, flags: 0x0}, - 445: {region: 0x165, script: 0x57, flags: 0x0}, - 446: {region: 0x99, script: 0x21, flags: 0x0}, - 447: {region: 0x165, script: 0x57, flags: 0x0}, - 448: {region: 0x73, script: 0x57, flags: 0x0}, - 449: {region: 0x165, script: 0x57, flags: 0x0}, - 450: {region: 0x165, script: 0x57, flags: 0x0}, - 451: {region: 0xe7, script: 0x57, flags: 0x0}, - 452: {region: 0x165, script: 0x57, flags: 0x0}, - 453: {region: 0x12b, script: 0x3d, flags: 0x0}, - 454: {region: 0x53, script: 0x89, flags: 0x0}, - 455: {region: 0x165, script: 0x57, flags: 0x0}, - 456: {region: 0xe8, script: 0x5, flags: 0x0}, - 457: {region: 0x99, script: 0x21, flags: 0x0}, - 458: {region: 0xaf, script: 0x3e, flags: 0x0}, - 459: {region: 0xe7, script: 0x57, flags: 0x0}, - 460: {region: 0xe8, script: 0x5, flags: 0x0}, - 461: {region: 0xe6, script: 0x57, flags: 0x0}, - 462: {region: 0x99, script: 0x21, flags: 0x0}, - 463: {region: 0x99, script: 0x21, flags: 0x0}, - 464: {region: 0x165, script: 0x57, flags: 0x0}, - 465: {region: 0x90, script: 0x57, flags: 0x0}, - 466: {region: 0x60, script: 0x57, flags: 0x0}, - 467: {region: 0x53, script: 0x38, flags: 0x0}, - 468: {region: 0x91, script: 0x57, flags: 0x0}, - 469: {region: 0x92, script: 0x57, flags: 0x0}, - 470: {region: 0x165, script: 0x57, flags: 0x0}, - 471: {region: 0x28, script: 0x8, flags: 0x0}, - 472: {region: 0xd2, script: 0x57, flags: 0x0}, - 473: {region: 0x78, script: 0x57, flags: 0x0}, - 474: {region: 0x165, script: 0x57, flags: 0x0}, - 475: {region: 0x165, script: 0x57, flags: 0x0}, - 476: {region: 0xd0, script: 0x57, flags: 0x0}, - 477: {region: 0xd6, script: 0x57, flags: 0x0}, - 478: {region: 0x165, script: 0x57, flags: 0x0}, - 479: {region: 0x165, script: 0x57, flags: 0x0}, - 480: {region: 0x165, script: 0x57, flags: 0x0}, - 481: {region: 0x95, script: 0x57, flags: 0x0}, - 482: {region: 0x165, script: 0x57, flags: 0x0}, - 483: {region: 0x165, script: 0x57, flags: 0x0}, - 484: {region: 0x165, script: 0x57, flags: 0x0}, - 486: {region: 0x122, script: 0x57, flags: 0x0}, - 487: {region: 0xd6, script: 0x57, flags: 0x0}, - 488: {region: 0x165, script: 0x57, flags: 0x0}, - 489: {region: 0x165, script: 0x57, flags: 0x0}, - 490: {region: 0x53, script: 0xea, flags: 0x0}, - 491: {region: 0x165, script: 0x57, flags: 0x0}, - 492: {region: 0x135, script: 0x57, flags: 0x0}, - 493: {region: 0x165, script: 0x57, flags: 0x0}, - 494: {region: 0x49, script: 0x57, flags: 0x0}, - 495: {region: 0x165, script: 0x57, flags: 0x0}, - 496: {region: 0x165, script: 0x57, flags: 0x0}, - 497: {region: 0xe7, script: 0x57, flags: 0x0}, - 498: {region: 0x165, script: 0x57, flags: 0x0}, - 499: {region: 0x95, script: 0x57, flags: 0x0}, - 500: {region: 0x106, script: 0x1f, flags: 0x0}, - 501: {region: 0x1, script: 0x57, flags: 0x0}, - 502: {region: 0x165, script: 0x57, flags: 0x0}, - 503: {region: 0x165, script: 0x57, flags: 0x0}, - 504: {region: 0x9d, script: 0x57, flags: 0x0}, - 505: {region: 0x9e, script: 0x57, flags: 0x0}, - 506: {region: 0x49, script: 0x17, flags: 0x0}, - 507: {region: 0x97, script: 0x3b, flags: 0x0}, - 508: {region: 0x165, script: 0x57, flags: 0x0}, - 509: {region: 0x165, script: 0x57, flags: 0x0}, - 510: {region: 0x106, script: 0x57, flags: 0x0}, - 511: {region: 0x165, script: 0x57, flags: 0x0}, - 512: {region: 0xa2, script: 0x46, flags: 0x0}, - 513: {region: 0x165, script: 0x57, flags: 0x0}, - 514: {region: 0xa0, script: 0x57, flags: 0x0}, - 515: {region: 0x1, script: 0x57, flags: 0x0}, - 516: {region: 0x165, script: 0x57, flags: 0x0}, - 517: {region: 0x165, script: 0x57, flags: 0x0}, - 518: {region: 0x165, script: 0x57, flags: 0x0}, - 519: {region: 0x52, script: 0x57, flags: 0x0}, - 520: {region: 0x130, script: 0x3b, flags: 0x0}, - 521: {region: 0x165, script: 0x57, flags: 0x0}, - 522: {region: 0x12f, script: 0x57, flags: 0x0}, - 523: {region: 0xdb, script: 0x21, flags: 0x0}, - 524: {region: 0x165, script: 0x57, flags: 0x0}, - 525: {region: 0x63, script: 0x57, flags: 0x0}, - 526: {region: 0x95, script: 0x57, flags: 0x0}, - 527: {region: 0x95, script: 0x57, flags: 0x0}, - 528: {region: 0x7d, script: 0x2b, flags: 0x0}, - 529: {region: 0x137, script: 0x1f, flags: 0x0}, - 530: {region: 0x67, script: 0x57, flags: 0x0}, - 531: {region: 0xc4, script: 0x57, flags: 0x0}, - 532: {region: 0x165, script: 0x57, flags: 0x0}, - 533: {region: 0x165, script: 0x57, flags: 0x0}, - 534: {region: 0xd6, script: 0x57, flags: 0x0}, - 535: {region: 0xa4, script: 0x57, flags: 0x0}, - 536: {region: 0xc3, script: 0x57, flags: 0x0}, - 537: {region: 0x106, script: 0x1f, flags: 0x0}, - 538: {region: 0x165, script: 0x57, flags: 0x0}, - 539: {region: 0x165, script: 0x57, flags: 0x0}, - 540: {region: 0x165, script: 0x57, flags: 0x0}, - 541: {region: 0x165, script: 0x57, flags: 0x0}, - 542: {region: 0xd4, script: 0x5, flags: 0x0}, - 543: {region: 0xd6, script: 0x57, flags: 0x0}, - 544: {region: 0x164, script: 0x57, flags: 0x0}, - 545: {region: 0x165, script: 0x57, flags: 0x0}, - 546: {region: 0x165, script: 0x57, flags: 0x0}, - 547: {region: 0x12f, script: 0x57, flags: 0x0}, - 548: {region: 0x122, script: 0x5, flags: 0x0}, - 549: {region: 0x165, script: 0x57, flags: 0x0}, - 550: {region: 0x123, script: 0xdf, flags: 0x0}, - 551: {region: 0x5a, script: 0x57, flags: 0x0}, - 552: {region: 0x52, script: 0x57, flags: 0x0}, - 553: {region: 0x165, script: 0x57, flags: 0x0}, - 554: {region: 0x4f, script: 0x57, flags: 0x0}, - 555: {region: 0x99, script: 0x21, flags: 0x0}, - 556: {region: 0x99, script: 0x21, flags: 0x0}, - 557: {region: 0x4b, script: 0x57, flags: 0x0}, - 558: {region: 0x95, script: 0x57, flags: 0x0}, - 559: {region: 0x165, script: 0x57, flags: 0x0}, - 560: {region: 0x41, script: 0x57, flags: 0x0}, - 561: {region: 0x99, script: 0x57, flags: 0x0}, - 562: {region: 0x53, script: 0xd6, flags: 0x0}, - 563: {region: 0x99, script: 0x21, flags: 0x0}, - 564: {region: 0xc3, script: 0x57, flags: 0x0}, - 565: {region: 0x165, script: 0x57, flags: 0x0}, - 566: {region: 0x99, script: 0x72, flags: 0x0}, - 567: {region: 0xe8, script: 0x5, flags: 0x0}, - 568: {region: 0x165, script: 0x57, flags: 0x0}, - 569: {region: 0xa4, script: 0x57, flags: 0x0}, - 570: {region: 0x165, script: 0x57, flags: 0x0}, - 571: {region: 0x12b, script: 0x57, flags: 0x0}, - 572: {region: 0x165, script: 0x57, flags: 0x0}, - 573: {region: 0xd2, script: 0x57, flags: 0x0}, - 574: {region: 0x165, script: 0x57, flags: 0x0}, - 575: {region: 0xaf, script: 0x54, flags: 0x0}, - 576: {region: 0x165, script: 0x57, flags: 0x0}, - 577: {region: 0x165, script: 0x57, flags: 0x0}, - 578: {region: 0x13, script: 0x6, flags: 0x1}, - 579: {region: 0x165, script: 0x57, flags: 0x0}, - 580: {region: 0x52, script: 0x57, flags: 0x0}, - 581: {region: 0x82, script: 0x57, flags: 0x0}, - 582: {region: 0xa4, script: 0x57, flags: 0x0}, - 583: {region: 0x165, script: 0x57, flags: 0x0}, - 584: {region: 0x165, script: 0x57, flags: 0x0}, - 585: {region: 0x165, script: 0x57, flags: 0x0}, - 586: {region: 0xa6, script: 0x4b, flags: 0x0}, - 587: {region: 0x2a, script: 0x57, flags: 0x0}, - 588: {region: 0x165, script: 0x57, flags: 0x0}, - 589: {region: 0x165, script: 0x57, flags: 0x0}, - 590: {region: 0x165, script: 0x57, flags: 0x0}, - 591: {region: 0x165, script: 0x57, flags: 0x0}, - 592: {region: 0x165, script: 0x57, flags: 0x0}, - 593: {region: 0x99, script: 0x4f, flags: 0x0}, - 594: {region: 0x8b, script: 0x57, flags: 0x0}, - 595: {region: 0x165, script: 0x57, flags: 0x0}, - 596: {region: 0xab, script: 0x50, flags: 0x0}, - 597: {region: 0x106, script: 0x1f, flags: 0x0}, - 598: {region: 0x99, script: 0x21, flags: 0x0}, - 599: {region: 0x165, script: 0x57, flags: 0x0}, - 600: {region: 0x75, script: 0x57, flags: 0x0}, - 601: {region: 0x165, script: 0x57, flags: 0x0}, - 602: {region: 0xb4, script: 0x57, flags: 0x0}, - 603: {region: 0x165, script: 0x57, flags: 0x0}, - 604: {region: 0x165, script: 0x57, flags: 0x0}, - 605: {region: 0x165, script: 0x57, flags: 0x0}, - 606: {region: 0x165, script: 0x57, flags: 0x0}, - 607: {region: 0x165, script: 0x57, flags: 0x0}, - 608: {region: 0x165, script: 0x57, flags: 0x0}, - 609: {region: 0x165, script: 0x57, flags: 0x0}, - 610: {region: 0x165, script: 0x29, flags: 0x0}, - 611: {region: 0x165, script: 0x57, flags: 0x0}, - 612: {region: 0x106, script: 0x1f, flags: 0x0}, - 613: {region: 0x112, script: 0x57, flags: 0x0}, - 614: {region: 0xe7, script: 0x57, flags: 0x0}, - 615: {region: 0x106, script: 0x57, flags: 0x0}, - 616: {region: 0x165, script: 0x57, flags: 0x0}, - 617: {region: 0x99, script: 0x21, flags: 0x0}, - 618: {region: 0x99, script: 0x5, flags: 0x0}, - 619: {region: 0x12f, script: 0x57, flags: 0x0}, - 620: {region: 0x165, script: 0x57, flags: 0x0}, - 621: {region: 0x52, script: 0x57, flags: 0x0}, - 622: {region: 0x60, script: 0x57, flags: 0x0}, - 623: {region: 0x165, script: 0x57, flags: 0x0}, - 624: {region: 0x165, script: 0x57, flags: 0x0}, - 625: {region: 0x165, script: 0x29, flags: 0x0}, - 626: {region: 0x165, script: 0x57, flags: 0x0}, - 627: {region: 0x165, script: 0x57, flags: 0x0}, - 628: {region: 0x19, script: 0x3, flags: 0x1}, - 629: {region: 0x165, script: 0x57, flags: 0x0}, - 630: {region: 0x165, script: 0x57, flags: 0x0}, - 631: {region: 0x165, script: 0x57, flags: 0x0}, - 632: {region: 0x165, script: 0x57, flags: 0x0}, - 633: {region: 0x106, script: 0x1f, flags: 0x0}, - 634: {region: 0x165, script: 0x57, flags: 0x0}, - 635: {region: 0x165, script: 0x57, flags: 0x0}, - 636: {region: 0x165, script: 0x57, flags: 0x0}, - 637: {region: 0x106, script: 0x1f, flags: 0x0}, - 638: {region: 0x165, script: 0x57, flags: 0x0}, - 639: {region: 0x95, script: 0x57, flags: 0x0}, - 640: {region: 0xe8, script: 0x5, flags: 0x0}, - 641: {region: 0x7b, script: 0x57, flags: 0x0}, - 642: {region: 0x165, script: 0x57, flags: 0x0}, - 643: {region: 0x165, script: 0x57, flags: 0x0}, - 644: {region: 0x165, script: 0x57, flags: 0x0}, - 645: {region: 0x165, script: 0x29, flags: 0x0}, - 646: {region: 0x123, script: 0xdf, flags: 0x0}, - 647: {region: 0xe8, script: 0x5, flags: 0x0}, - 648: {region: 0x165, script: 0x57, flags: 0x0}, - 649: {region: 0x165, script: 0x57, flags: 0x0}, - 650: {region: 0x1c, script: 0x5, flags: 0x1}, - 651: {region: 0x165, script: 0x57, flags: 0x0}, - 652: {region: 0x165, script: 0x57, flags: 0x0}, - 653: {region: 0x165, script: 0x57, flags: 0x0}, - 654: {region: 0x138, script: 0x57, flags: 0x0}, - 655: {region: 0x87, script: 0x5b, flags: 0x0}, - 656: {region: 0x97, script: 0x3b, flags: 0x0}, - 657: {region: 0x12f, script: 0x57, flags: 0x0}, - 658: {region: 0xe8, script: 0x5, flags: 0x0}, - 659: {region: 0x131, script: 0x57, flags: 0x0}, - 660: {region: 0x165, script: 0x57, flags: 0x0}, - 661: {region: 0xb7, script: 0x57, flags: 0x0}, - 662: {region: 0x106, script: 0x1f, flags: 0x0}, - 663: {region: 0x165, script: 0x57, flags: 0x0}, - 664: {region: 0x95, script: 0x57, flags: 0x0}, - 665: {region: 0x165, script: 0x57, flags: 0x0}, - 666: {region: 0x53, script: 0xdf, flags: 0x0}, - 667: {region: 0x165, script: 0x57, flags: 0x0}, - 668: {region: 0x165, script: 0x57, flags: 0x0}, - 669: {region: 0x165, script: 0x57, flags: 0x0}, - 670: {region: 0x165, script: 0x57, flags: 0x0}, - 671: {region: 0x99, script: 0x59, flags: 0x0}, - 672: {region: 0x165, script: 0x57, flags: 0x0}, - 673: {region: 0x165, script: 0x57, flags: 0x0}, - 674: {region: 0x106, script: 0x1f, flags: 0x0}, - 675: {region: 0x131, script: 0x57, flags: 0x0}, - 676: {region: 0x165, script: 0x57, flags: 0x0}, - 677: {region: 0xd9, script: 0x57, flags: 0x0}, - 678: {region: 0x165, script: 0x57, flags: 0x0}, - 679: {region: 0x165, script: 0x57, flags: 0x0}, - 680: {region: 0x21, script: 0x2, flags: 0x1}, - 681: {region: 0x165, script: 0x57, flags: 0x0}, - 682: {region: 0x165, script: 0x57, flags: 0x0}, - 683: {region: 0x9e, script: 0x57, flags: 0x0}, - 684: {region: 0x53, script: 0x5d, flags: 0x0}, - 685: {region: 0x95, script: 0x57, flags: 0x0}, - 686: {region: 0x9c, script: 0x5, flags: 0x0}, - 687: {region: 0x135, script: 0x57, flags: 0x0}, - 688: {region: 0x165, script: 0x57, flags: 0x0}, - 689: {region: 0x165, script: 0x57, flags: 0x0}, - 690: {region: 0x99, script: 0xda, flags: 0x0}, - 691: {region: 0x9e, script: 0x57, flags: 0x0}, - 692: {region: 0x165, script: 0x57, flags: 0x0}, - 693: {region: 0x4b, script: 0x57, flags: 0x0}, - 694: {region: 0x165, script: 0x57, flags: 0x0}, - 695: {region: 0x165, script: 0x57, flags: 0x0}, - 696: {region: 0xaf, script: 0x54, flags: 0x0}, - 697: {region: 0x165, script: 0x57, flags: 0x0}, - 698: {region: 0x165, script: 0x57, flags: 0x0}, - 699: {region: 0x4b, script: 0x57, flags: 0x0}, - 700: {region: 0x165, script: 0x57, flags: 0x0}, - 701: {region: 0x165, script: 0x57, flags: 0x0}, - 702: {region: 0x162, script: 0x57, flags: 0x0}, - 703: {region: 0x9c, script: 0x5, flags: 0x0}, - 704: {region: 0xb6, script: 0x57, flags: 0x0}, - 705: {region: 0xb8, script: 0x57, flags: 0x0}, - 706: {region: 0x4b, script: 0x57, flags: 0x0}, - 707: {region: 0x4b, script: 0x57, flags: 0x0}, - 708: {region: 0xa4, script: 0x57, flags: 0x0}, - 709: {region: 0xa4, script: 0x57, flags: 0x0}, - 710: {region: 0x9c, script: 0x5, flags: 0x0}, - 711: {region: 0xb8, script: 0x57, flags: 0x0}, - 712: {region: 0x123, script: 0xdf, flags: 0x0}, - 713: {region: 0x53, script: 0x38, flags: 0x0}, - 714: {region: 0x12b, script: 0x57, flags: 0x0}, - 715: {region: 0x95, script: 0x57, flags: 0x0}, - 716: {region: 0x52, script: 0x57, flags: 0x0}, - 717: {region: 0x99, script: 0x21, flags: 0x0}, - 718: {region: 0x99, script: 0x21, flags: 0x0}, - 719: {region: 0x95, script: 0x57, flags: 0x0}, - 720: {region: 0x23, script: 0x3, flags: 0x1}, - 721: {region: 0xa4, script: 0x57, flags: 0x0}, - 722: {region: 0x165, script: 0x57, flags: 0x0}, - 723: {region: 0xcf, script: 0x57, flags: 0x0}, - 724: {region: 0x165, script: 0x57, flags: 0x0}, - 725: {region: 0x165, script: 0x57, flags: 0x0}, - 726: {region: 0x165, script: 0x57, flags: 0x0}, - 727: {region: 0x165, script: 0x57, flags: 0x0}, - 728: {region: 0x165, script: 0x57, flags: 0x0}, - 729: {region: 0x165, script: 0x57, flags: 0x0}, - 730: {region: 0x165, script: 0x57, flags: 0x0}, - 731: {region: 0x165, script: 0x57, flags: 0x0}, - 732: {region: 0x165, script: 0x57, flags: 0x0}, - 733: {region: 0x165, script: 0x57, flags: 0x0}, - 734: {region: 0x165, script: 0x57, flags: 0x0}, - 735: {region: 0x165, script: 0x5, flags: 0x0}, - 736: {region: 0x106, script: 0x1f, flags: 0x0}, - 737: {region: 0xe7, script: 0x57, flags: 0x0}, - 738: {region: 0x165, script: 0x57, flags: 0x0}, - 739: {region: 0x95, script: 0x57, flags: 0x0}, - 740: {region: 0x165, script: 0x29, flags: 0x0}, - 741: {region: 0x165, script: 0x57, flags: 0x0}, - 742: {region: 0x165, script: 0x57, flags: 0x0}, - 743: {region: 0x165, script: 0x57, flags: 0x0}, - 744: {region: 0x112, script: 0x57, flags: 0x0}, - 745: {region: 0xa4, script: 0x57, flags: 0x0}, - 746: {region: 0x165, script: 0x57, flags: 0x0}, - 747: {region: 0x165, script: 0x57, flags: 0x0}, - 748: {region: 0x123, script: 0x5, flags: 0x0}, - 749: {region: 0xcc, script: 0x57, flags: 0x0}, - 750: {region: 0x165, script: 0x57, flags: 0x0}, - 751: {region: 0x165, script: 0x57, flags: 0x0}, - 752: {region: 0x165, script: 0x57, flags: 0x0}, - 753: {region: 0xbf, script: 0x57, flags: 0x0}, - 754: {region: 0xd1, script: 0x57, flags: 0x0}, - 755: {region: 0x165, script: 0x57, flags: 0x0}, - 756: {region: 0x52, script: 0x57, flags: 0x0}, - 757: {region: 0xdb, script: 0x21, flags: 0x0}, - 758: {region: 0x12f, script: 0x57, flags: 0x0}, - 759: {region: 0xc0, script: 0x57, flags: 0x0}, - 760: {region: 0x165, script: 0x57, flags: 0x0}, - 761: {region: 0x165, script: 0x57, flags: 0x0}, - 762: {region: 0xe0, script: 0x57, flags: 0x0}, - 763: {region: 0x165, script: 0x57, flags: 0x0}, - 764: {region: 0x95, script: 0x57, flags: 0x0}, - 765: {region: 0x9b, script: 0x3a, flags: 0x0}, - 766: {region: 0x165, script: 0x57, flags: 0x0}, - 767: {region: 0xc2, script: 0x1f, flags: 0x0}, - 768: {region: 0x165, script: 0x5, flags: 0x0}, - 769: {region: 0x165, script: 0x57, flags: 0x0}, - 770: {region: 0x165, script: 0x57, flags: 0x0}, - 771: {region: 0x165, script: 0x57, flags: 0x0}, - 772: {region: 0x99, script: 0x6b, flags: 0x0}, - 773: {region: 0x165, script: 0x57, flags: 0x0}, - 774: {region: 0x165, script: 0x57, flags: 0x0}, - 775: {region: 0x10b, script: 0x57, flags: 0x0}, - 776: {region: 0x165, script: 0x57, flags: 0x0}, - 777: {region: 0x165, script: 0x57, flags: 0x0}, - 778: {region: 0x165, script: 0x57, flags: 0x0}, - 779: {region: 0x26, script: 0x3, flags: 0x1}, - 780: {region: 0x165, script: 0x57, flags: 0x0}, - 781: {region: 0x165, script: 0x57, flags: 0x0}, - 782: {region: 0x99, script: 0xe, flags: 0x0}, - 783: {region: 0xc4, script: 0x72, flags: 0x0}, - 785: {region: 0x165, script: 0x57, flags: 0x0}, - 786: {region: 0x49, script: 0x57, flags: 0x0}, - 787: {region: 0x49, script: 0x57, flags: 0x0}, - 788: {region: 0x37, script: 0x57, flags: 0x0}, - 789: {region: 0x165, script: 0x57, flags: 0x0}, - 790: {region: 0x165, script: 0x57, flags: 0x0}, - 791: {region: 0x165, script: 0x57, flags: 0x0}, - 792: {region: 0x165, script: 0x57, flags: 0x0}, - 793: {region: 0x165, script: 0x57, flags: 0x0}, - 794: {region: 0x165, script: 0x57, flags: 0x0}, - 795: {region: 0x99, script: 0x21, flags: 0x0}, - 796: {region: 0xdb, script: 0x21, flags: 0x0}, - 797: {region: 0x106, script: 0x1f, flags: 0x0}, - 798: {region: 0x35, script: 0x6f, flags: 0x0}, - 799: {region: 0x29, script: 0x3, flags: 0x1}, - 800: {region: 0xcb, script: 0x57, flags: 0x0}, - 801: {region: 0x165, script: 0x57, flags: 0x0}, - 802: {region: 0x165, script: 0x57, flags: 0x0}, - 803: {region: 0x165, script: 0x57, flags: 0x0}, - 804: {region: 0x99, script: 0x21, flags: 0x0}, - 805: {region: 0x52, script: 0x57, flags: 0x0}, - 807: {region: 0x165, script: 0x57, flags: 0x0}, - 808: {region: 0x135, script: 0x57, flags: 0x0}, - 809: {region: 0x165, script: 0x57, flags: 0x0}, - 810: {region: 0x165, script: 0x57, flags: 0x0}, - 811: {region: 0xe8, script: 0x5, flags: 0x0}, - 812: {region: 0xc3, script: 0x57, flags: 0x0}, - 813: {region: 0x99, script: 0x21, flags: 0x0}, - 814: {region: 0x95, script: 0x57, flags: 0x0}, - 815: {region: 0x164, script: 0x57, flags: 0x0}, - 816: {region: 0x165, script: 0x57, flags: 0x0}, - 817: {region: 0xc4, script: 0x72, flags: 0x0}, - 818: {region: 0x165, script: 0x57, flags: 0x0}, - 819: {region: 0x165, script: 0x29, flags: 0x0}, - 820: {region: 0x106, script: 0x1f, flags: 0x0}, - 821: {region: 0x165, script: 0x57, flags: 0x0}, - 822: {region: 0x131, script: 0x57, flags: 0x0}, - 823: {region: 0x9c, script: 0x63, flags: 0x0}, - 824: {region: 0x165, script: 0x57, flags: 0x0}, - 825: {region: 0x165, script: 0x57, flags: 0x0}, - 826: {region: 0x9c, script: 0x5, flags: 0x0}, - 827: {region: 0x165, script: 0x57, flags: 0x0}, - 828: {region: 0x165, script: 0x57, flags: 0x0}, - 829: {region: 0x165, script: 0x57, flags: 0x0}, - 830: {region: 0xdd, script: 0x57, flags: 0x0}, - 831: {region: 0x165, script: 0x57, flags: 0x0}, - 832: {region: 0x165, script: 0x57, flags: 0x0}, - 834: {region: 0x165, script: 0x57, flags: 0x0}, - 835: {region: 0x53, script: 0x38, flags: 0x0}, - 836: {region: 0x9e, script: 0x57, flags: 0x0}, - 837: {region: 0xd2, script: 0x57, flags: 0x0}, - 838: {region: 0x165, script: 0x57, flags: 0x0}, - 839: {region: 0xda, script: 0x57, flags: 0x0}, - 840: {region: 0x165, script: 0x57, flags: 0x0}, - 841: {region: 0x165, script: 0x57, flags: 0x0}, - 842: {region: 0x165, script: 0x57, flags: 0x0}, - 843: {region: 0xcf, script: 0x57, flags: 0x0}, - 844: {region: 0x165, script: 0x57, flags: 0x0}, - 845: {region: 0x165, script: 0x57, flags: 0x0}, - 846: {region: 0x164, script: 0x57, flags: 0x0}, - 847: {region: 0xd1, script: 0x57, flags: 0x0}, - 848: {region: 0x60, script: 0x57, flags: 0x0}, - 849: {region: 0xdb, script: 0x21, flags: 0x0}, - 850: {region: 0x165, script: 0x57, flags: 0x0}, - 851: {region: 0xdb, script: 0x21, flags: 0x0}, - 852: {region: 0x165, script: 0x57, flags: 0x0}, - 853: {region: 0x165, script: 0x57, flags: 0x0}, - 854: {region: 0xd2, script: 0x57, flags: 0x0}, - 855: {region: 0x165, script: 0x57, flags: 0x0}, - 856: {region: 0x165, script: 0x57, flags: 0x0}, - 857: {region: 0xd1, script: 0x57, flags: 0x0}, - 858: {region: 0x165, script: 0x57, flags: 0x0}, - 859: {region: 0xcf, script: 0x57, flags: 0x0}, - 860: {region: 0xcf, script: 0x57, flags: 0x0}, - 861: {region: 0x165, script: 0x57, flags: 0x0}, - 862: {region: 0x165, script: 0x57, flags: 0x0}, - 863: {region: 0x95, script: 0x57, flags: 0x0}, - 864: {region: 0x165, script: 0x57, flags: 0x0}, - 865: {region: 0xdf, script: 0x57, flags: 0x0}, - 866: {region: 0x165, script: 0x57, flags: 0x0}, - 867: {region: 0x165, script: 0x57, flags: 0x0}, - 868: {region: 0x99, script: 0x57, flags: 0x0}, - 869: {region: 0x165, script: 0x57, flags: 0x0}, - 870: {region: 0x165, script: 0x57, flags: 0x0}, - 871: {region: 0xd9, script: 0x57, flags: 0x0}, - 872: {region: 0x52, script: 0x57, flags: 0x0}, - 873: {region: 0x165, script: 0x57, flags: 0x0}, - 874: {region: 0xda, script: 0x57, flags: 0x0}, - 875: {region: 0x165, script: 0x57, flags: 0x0}, - 876: {region: 0x52, script: 0x57, flags: 0x0}, - 877: {region: 0x165, script: 0x57, flags: 0x0}, - 878: {region: 0x165, script: 0x57, flags: 0x0}, - 879: {region: 0xda, script: 0x57, flags: 0x0}, - 880: {region: 0x123, script: 0x53, flags: 0x0}, - 881: {region: 0x99, script: 0x21, flags: 0x0}, - 882: {region: 0x10c, script: 0xbf, flags: 0x0}, - 883: {region: 0x165, script: 0x57, flags: 0x0}, - 884: {region: 0x165, script: 0x57, flags: 0x0}, - 885: {region: 0x84, script: 0x78, flags: 0x0}, - 886: {region: 0x161, script: 0x57, flags: 0x0}, - 887: {region: 0x165, script: 0x57, flags: 0x0}, - 888: {region: 0x49, script: 0x17, flags: 0x0}, - 889: {region: 0x165, script: 0x57, flags: 0x0}, - 890: {region: 0x161, script: 0x57, flags: 0x0}, - 891: {region: 0x165, script: 0x57, flags: 0x0}, - 892: {region: 0x165, script: 0x57, flags: 0x0}, - 893: {region: 0x165, script: 0x57, flags: 0x0}, - 894: {region: 0x165, script: 0x57, flags: 0x0}, - 895: {region: 0x165, script: 0x57, flags: 0x0}, - 896: {region: 0x117, script: 0x57, flags: 0x0}, - 897: {region: 0x165, script: 0x57, flags: 0x0}, - 898: {region: 0x165, script: 0x57, flags: 0x0}, - 899: {region: 0x135, script: 0x57, flags: 0x0}, - 900: {region: 0x165, script: 0x57, flags: 0x0}, - 901: {region: 0x53, script: 0x57, flags: 0x0}, - 902: {region: 0x165, script: 0x57, flags: 0x0}, - 903: {region: 0xce, script: 0x57, flags: 0x0}, - 904: {region: 0x12f, script: 0x57, flags: 0x0}, - 905: {region: 0x131, script: 0x57, flags: 0x0}, - 906: {region: 0x80, script: 0x57, flags: 0x0}, - 907: {region: 0x78, script: 0x57, flags: 0x0}, - 908: {region: 0x165, script: 0x57, flags: 0x0}, - 910: {region: 0x165, script: 0x57, flags: 0x0}, - 911: {region: 0x165, script: 0x57, flags: 0x0}, - 912: {region: 0x6f, script: 0x57, flags: 0x0}, - 913: {region: 0x165, script: 0x57, flags: 0x0}, - 914: {region: 0x165, script: 0x57, flags: 0x0}, - 915: {region: 0x165, script: 0x57, flags: 0x0}, - 916: {region: 0x165, script: 0x57, flags: 0x0}, - 917: {region: 0x99, script: 0x7d, flags: 0x0}, - 918: {region: 0x165, script: 0x57, flags: 0x0}, - 919: {region: 0x165, script: 0x5, flags: 0x0}, - 920: {region: 0x7d, script: 0x1f, flags: 0x0}, - 921: {region: 0x135, script: 0x7e, flags: 0x0}, - 922: {region: 0x165, script: 0x5, flags: 0x0}, - 923: {region: 0xc5, script: 0x7c, flags: 0x0}, - 924: {region: 0x165, script: 0x57, flags: 0x0}, - 925: {region: 0x2c, script: 0x3, flags: 0x1}, - 926: {region: 0xe7, script: 0x57, flags: 0x0}, - 927: {region: 0x2f, script: 0x2, flags: 0x1}, - 928: {region: 0xe7, script: 0x57, flags: 0x0}, - 929: {region: 0x30, script: 0x57, flags: 0x0}, - 930: {region: 0xf0, script: 0x57, flags: 0x0}, - 931: {region: 0x165, script: 0x57, flags: 0x0}, - 932: {region: 0x78, script: 0x57, flags: 0x0}, - 933: {region: 0xd6, script: 0x57, flags: 0x0}, - 934: {region: 0x135, script: 0x57, flags: 0x0}, - 935: {region: 0x49, script: 0x57, flags: 0x0}, - 936: {region: 0x165, script: 0x57, flags: 0x0}, - 937: {region: 0x9c, script: 0xe8, flags: 0x0}, - 938: {region: 0x165, script: 0x57, flags: 0x0}, - 939: {region: 0x60, script: 0x57, flags: 0x0}, - 940: {region: 0x165, script: 0x5, flags: 0x0}, - 941: {region: 0xb0, script: 0x87, flags: 0x0}, - 943: {region: 0x165, script: 0x57, flags: 0x0}, - 944: {region: 0x165, script: 0x57, flags: 0x0}, - 945: {region: 0x99, script: 0x12, flags: 0x0}, - 946: {region: 0xa4, script: 0x57, flags: 0x0}, - 947: {region: 0xe9, script: 0x57, flags: 0x0}, - 948: {region: 0x165, script: 0x57, flags: 0x0}, - 949: {region: 0x9e, script: 0x57, flags: 0x0}, - 950: {region: 0x165, script: 0x57, flags: 0x0}, - 951: {region: 0x165, script: 0x57, flags: 0x0}, - 952: {region: 0x87, script: 0x31, flags: 0x0}, - 953: {region: 0x75, script: 0x57, flags: 0x0}, - 954: {region: 0x165, script: 0x57, flags: 0x0}, - 955: {region: 0xe8, script: 0x4a, flags: 0x0}, - 956: {region: 0x9c, script: 0x5, flags: 0x0}, - 957: {region: 0x1, script: 0x57, flags: 0x0}, - 958: {region: 0x24, script: 0x5, flags: 0x0}, - 959: {region: 0x165, script: 0x57, flags: 0x0}, - 960: {region: 0x41, script: 0x57, flags: 0x0}, - 961: {region: 0x165, script: 0x57, flags: 0x0}, - 962: {region: 0x7a, script: 0x57, flags: 0x0}, - 963: {region: 0x165, script: 0x57, flags: 0x0}, - 964: {region: 0xe4, script: 0x57, flags: 0x0}, - 965: {region: 0x89, script: 0x57, flags: 0x0}, - 966: {region: 0x69, script: 0x57, flags: 0x0}, - 967: {region: 0x165, script: 0x57, flags: 0x0}, - 968: {region: 0x99, script: 0x21, flags: 0x0}, - 969: {region: 0x165, script: 0x57, flags: 0x0}, - 970: {region: 0x102, script: 0x57, flags: 0x0}, - 971: {region: 0x95, script: 0x57, flags: 0x0}, - 972: {region: 0x165, script: 0x57, flags: 0x0}, - 973: {region: 0x165, script: 0x57, flags: 0x0}, - 974: {region: 0x9e, script: 0x57, flags: 0x0}, - 975: {region: 0x165, script: 0x5, flags: 0x0}, - 976: {region: 0x99, script: 0x57, flags: 0x0}, - 977: {region: 0x31, script: 0x2, flags: 0x1}, - 978: {region: 0xdb, script: 0x21, flags: 0x0}, - 979: {region: 0x35, script: 0xe, flags: 0x0}, - 980: {region: 0x4e, script: 0x57, flags: 0x0}, - 981: {region: 0x72, script: 0x57, flags: 0x0}, - 982: {region: 0x4e, script: 0x57, flags: 0x0}, - 983: {region: 0x9c, script: 0x5, flags: 0x0}, - 984: {region: 0x10c, script: 0x57, flags: 0x0}, - 985: {region: 0x3a, script: 0x57, flags: 0x0}, - 986: {region: 0x165, script: 0x57, flags: 0x0}, - 987: {region: 0xd1, script: 0x57, flags: 0x0}, - 988: {region: 0x104, script: 0x57, flags: 0x0}, - 989: {region: 0x95, script: 0x57, flags: 0x0}, - 990: {region: 0x12f, script: 0x57, flags: 0x0}, - 991: {region: 0x165, script: 0x57, flags: 0x0}, - 992: {region: 0x165, script: 0x57, flags: 0x0}, - 993: {region: 0x73, script: 0x57, flags: 0x0}, - 994: {region: 0x106, script: 0x1f, flags: 0x0}, - 995: {region: 0x130, script: 0x1f, flags: 0x0}, - 996: {region: 0x109, script: 0x57, flags: 0x0}, - 997: {region: 0x107, script: 0x57, flags: 0x0}, - 998: {region: 0x12f, script: 0x57, flags: 0x0}, - 999: {region: 0x165, script: 0x57, flags: 0x0}, - 1000: {region: 0xa2, script: 0x49, flags: 0x0}, - 1001: {region: 0x99, script: 0x21, flags: 0x0}, - 1002: {region: 0x80, script: 0x57, flags: 0x0}, - 1003: {region: 0x106, script: 0x1f, flags: 0x0}, - 1004: {region: 0xa4, script: 0x57, flags: 0x0}, - 1005: {region: 0x95, script: 0x57, flags: 0x0}, - 1006: {region: 0x99, script: 0x57, flags: 0x0}, - 1007: {region: 0x114, script: 0x57, flags: 0x0}, - 1008: {region: 0x99, script: 0xc3, flags: 0x0}, - 1009: {region: 0x165, script: 0x57, flags: 0x0}, - 1010: {region: 0x165, script: 0x57, flags: 0x0}, - 1011: {region: 0x12f, script: 0x57, flags: 0x0}, - 1012: {region: 0x9e, script: 0x57, flags: 0x0}, - 1013: {region: 0x99, script: 0x21, flags: 0x0}, - 1014: {region: 0x165, script: 0x5, flags: 0x0}, - 1015: {region: 0x9e, script: 0x57, flags: 0x0}, - 1016: {region: 0x7b, script: 0x57, flags: 0x0}, - 1017: {region: 0x49, script: 0x57, flags: 0x0}, - 1018: {region: 0x33, script: 0x4, flags: 0x1}, - 1019: {region: 0x9e, script: 0x57, flags: 0x0}, - 1020: {region: 0x9c, script: 0x5, flags: 0x0}, - 1021: {region: 0xda, script: 0x57, flags: 0x0}, - 1022: {region: 0x4f, script: 0x57, flags: 0x0}, - 1023: {region: 0xd1, script: 0x57, flags: 0x0}, - 1024: {region: 0xcf, script: 0x57, flags: 0x0}, - 1025: {region: 0xc3, script: 0x57, flags: 0x0}, - 1026: {region: 0x4c, script: 0x57, flags: 0x0}, - 1027: {region: 0x96, script: 0x7a, flags: 0x0}, - 1028: {region: 0xb6, script: 0x57, flags: 0x0}, - 1029: {region: 0x165, script: 0x29, flags: 0x0}, - 1030: {region: 0x165, script: 0x57, flags: 0x0}, - 1032: {region: 0xba, script: 0xdc, flags: 0x0}, - 1033: {region: 0x165, script: 0x57, flags: 0x0}, - 1034: {region: 0xc4, script: 0x72, flags: 0x0}, - 1035: {region: 0x165, script: 0x5, flags: 0x0}, - 1036: {region: 0xb3, script: 0xca, flags: 0x0}, - 1037: {region: 0x6f, script: 0x57, flags: 0x0}, - 1038: {region: 0x165, script: 0x57, flags: 0x0}, - 1039: {region: 0x165, script: 0x57, flags: 0x0}, - 1040: {region: 0x165, script: 0x57, flags: 0x0}, - 1041: {region: 0x165, script: 0x57, flags: 0x0}, - 1042: {region: 0x111, script: 0x57, flags: 0x0}, - 1043: {region: 0x165, script: 0x57, flags: 0x0}, - 1044: {region: 0xe8, script: 0x5, flags: 0x0}, - 1045: {region: 0x165, script: 0x57, flags: 0x0}, - 1046: {region: 0x10f, script: 0x57, flags: 0x0}, - 1047: {region: 0x165, script: 0x57, flags: 0x0}, - 1048: {region: 0xe9, script: 0x57, flags: 0x0}, - 1049: {region: 0x165, script: 0x57, flags: 0x0}, - 1050: {region: 0x95, script: 0x57, flags: 0x0}, - 1051: {region: 0x142, script: 0x57, flags: 0x0}, - 1052: {region: 0x10c, script: 0x57, flags: 0x0}, - 1054: {region: 0x10c, script: 0x57, flags: 0x0}, - 1055: {region: 0x72, script: 0x57, flags: 0x0}, - 1056: {region: 0x97, script: 0xc0, flags: 0x0}, - 1057: {region: 0x165, script: 0x57, flags: 0x0}, - 1058: {region: 0x72, script: 0x57, flags: 0x0}, - 1059: {region: 0x164, script: 0x57, flags: 0x0}, - 1060: {region: 0x165, script: 0x57, flags: 0x0}, - 1061: {region: 0xc3, script: 0x57, flags: 0x0}, - 1062: {region: 0x165, script: 0x57, flags: 0x0}, - 1063: {region: 0x165, script: 0x57, flags: 0x0}, - 1064: {region: 0x165, script: 0x57, flags: 0x0}, - 1065: {region: 0x115, script: 0x57, flags: 0x0}, - 1066: {region: 0x165, script: 0x57, flags: 0x0}, - 1067: {region: 0x165, script: 0x57, flags: 0x0}, - 1068: {region: 0x123, script: 0xdf, flags: 0x0}, - 1069: {region: 0x165, script: 0x57, flags: 0x0}, - 1070: {region: 0x165, script: 0x57, flags: 0x0}, - 1071: {region: 0x165, script: 0x57, flags: 0x0}, - 1072: {region: 0x165, script: 0x57, flags: 0x0}, - 1073: {region: 0x27, script: 0x57, flags: 0x0}, - 1074: {region: 0x37, script: 0x5, flags: 0x1}, - 1075: {region: 0x99, script: 0xcb, flags: 0x0}, - 1076: {region: 0x116, script: 0x57, flags: 0x0}, - 1077: {region: 0x114, script: 0x57, flags: 0x0}, - 1078: {region: 0x99, script: 0x21, flags: 0x0}, - 1079: {region: 0x161, script: 0x57, flags: 0x0}, - 1080: {region: 0x165, script: 0x57, flags: 0x0}, - 1081: {region: 0x165, script: 0x57, flags: 0x0}, - 1082: {region: 0x6d, script: 0x57, flags: 0x0}, - 1083: {region: 0x161, script: 0x57, flags: 0x0}, - 1084: {region: 0x165, script: 0x57, flags: 0x0}, - 1085: {region: 0x60, script: 0x57, flags: 0x0}, - 1086: {region: 0x95, script: 0x57, flags: 0x0}, - 1087: {region: 0x165, script: 0x57, flags: 0x0}, - 1088: {region: 0x165, script: 0x57, flags: 0x0}, - 1089: {region: 0x12f, script: 0x57, flags: 0x0}, - 1090: {region: 0x165, script: 0x57, flags: 0x0}, - 1091: {region: 0x84, script: 0x57, flags: 0x0}, - 1092: {region: 0x10c, script: 0x57, flags: 0x0}, - 1093: {region: 0x12f, script: 0x57, flags: 0x0}, - 1094: {region: 0x15f, script: 0x5, flags: 0x0}, - 1095: {region: 0x4b, script: 0x57, flags: 0x0}, - 1096: {region: 0x60, script: 0x57, flags: 0x0}, - 1097: {region: 0x165, script: 0x57, flags: 0x0}, - 1098: {region: 0x99, script: 0x21, flags: 0x0}, - 1099: {region: 0x95, script: 0x57, flags: 0x0}, - 1100: {region: 0x165, script: 0x57, flags: 0x0}, - 1101: {region: 0x35, script: 0xe, flags: 0x0}, - 1102: {region: 0x9b, script: 0xcf, flags: 0x0}, - 1103: {region: 0xe9, script: 0x57, flags: 0x0}, - 1104: {region: 0x99, script: 0xd7, flags: 0x0}, - 1105: {region: 0xdb, script: 0x21, flags: 0x0}, - 1106: {region: 0x165, script: 0x57, flags: 0x0}, - 1107: {region: 0x165, script: 0x57, flags: 0x0}, - 1108: {region: 0x165, script: 0x57, flags: 0x0}, - 1109: {region: 0x165, script: 0x57, flags: 0x0}, - 1110: {region: 0x165, script: 0x57, flags: 0x0}, - 1111: {region: 0x165, script: 0x57, flags: 0x0}, - 1112: {region: 0x165, script: 0x57, flags: 0x0}, - 1113: {region: 0x165, script: 0x57, flags: 0x0}, - 1114: {region: 0xe7, script: 0x57, flags: 0x0}, - 1115: {region: 0x165, script: 0x57, flags: 0x0}, - 1116: {region: 0x165, script: 0x57, flags: 0x0}, - 1117: {region: 0x99, script: 0x4f, flags: 0x0}, - 1118: {region: 0x53, script: 0xd5, flags: 0x0}, - 1119: {region: 0xdb, script: 0x21, flags: 0x0}, - 1120: {region: 0xdb, script: 0x21, flags: 0x0}, - 1121: {region: 0x99, script: 0xda, flags: 0x0}, - 1122: {region: 0x165, script: 0x57, flags: 0x0}, - 1123: {region: 0x112, script: 0x57, flags: 0x0}, - 1124: {region: 0x131, script: 0x57, flags: 0x0}, - 1125: {region: 0x126, script: 0x57, flags: 0x0}, - 1126: {region: 0x165, script: 0x57, flags: 0x0}, - 1127: {region: 0x3c, script: 0x3, flags: 0x1}, - 1128: {region: 0x165, script: 0x57, flags: 0x0}, - 1129: {region: 0x165, script: 0x57, flags: 0x0}, - 1130: {region: 0x165, script: 0x57, flags: 0x0}, - 1131: {region: 0x123, script: 0xdf, flags: 0x0}, - 1132: {region: 0xdb, script: 0x21, flags: 0x0}, - 1133: {region: 0xdb, script: 0x21, flags: 0x0}, - 1134: {region: 0xdb, script: 0x21, flags: 0x0}, - 1135: {region: 0x6f, script: 0x29, flags: 0x0}, - 1136: {region: 0x165, script: 0x57, flags: 0x0}, - 1137: {region: 0x6d, script: 0x29, flags: 0x0}, - 1138: {region: 0x165, script: 0x57, flags: 0x0}, - 1139: {region: 0x165, script: 0x57, flags: 0x0}, - 1140: {region: 0x165, script: 0x57, flags: 0x0}, - 1141: {region: 0xd6, script: 0x57, flags: 0x0}, - 1142: {region: 0x127, script: 0x57, flags: 0x0}, - 1143: {region: 0x125, script: 0x57, flags: 0x0}, - 1144: {region: 0x32, script: 0x57, flags: 0x0}, - 1145: {region: 0xdb, script: 0x21, flags: 0x0}, - 1146: {region: 0xe7, script: 0x57, flags: 0x0}, - 1147: {region: 0x165, script: 0x57, flags: 0x0}, - 1148: {region: 0x165, script: 0x57, flags: 0x0}, - 1149: {region: 0x32, script: 0x57, flags: 0x0}, - 1150: {region: 0xd4, script: 0x57, flags: 0x0}, - 1151: {region: 0x165, script: 0x57, flags: 0x0}, - 1152: {region: 0x161, script: 0x57, flags: 0x0}, - 1153: {region: 0x165, script: 0x57, flags: 0x0}, - 1154: {region: 0x129, script: 0x57, flags: 0x0}, - 1155: {region: 0x165, script: 0x57, flags: 0x0}, - 1156: {region: 0xce, script: 0x57, flags: 0x0}, - 1157: {region: 0x165, script: 0x57, flags: 0x0}, - 1158: {region: 0xe6, script: 0x57, flags: 0x0}, - 1159: {region: 0x165, script: 0x57, flags: 0x0}, - 1160: {region: 0x165, script: 0x57, flags: 0x0}, - 1161: {region: 0x165, script: 0x57, flags: 0x0}, - 1162: {region: 0x12b, script: 0x57, flags: 0x0}, - 1163: {region: 0x12b, script: 0x57, flags: 0x0}, - 1164: {region: 0x12e, script: 0x57, flags: 0x0}, - 1165: {region: 0x165, script: 0x5, flags: 0x0}, - 1166: {region: 0x161, script: 0x57, flags: 0x0}, - 1167: {region: 0x87, script: 0x31, flags: 0x0}, - 1168: {region: 0xdb, script: 0x21, flags: 0x0}, - 1169: {region: 0xe7, script: 0x57, flags: 0x0}, - 1170: {region: 0x43, script: 0xe0, flags: 0x0}, - 1171: {region: 0x165, script: 0x57, flags: 0x0}, - 1172: {region: 0x106, script: 0x1f, flags: 0x0}, - 1173: {region: 0x165, script: 0x57, flags: 0x0}, - 1174: {region: 0x165, script: 0x57, flags: 0x0}, - 1175: {region: 0x131, script: 0x57, flags: 0x0}, - 1176: {region: 0x165, script: 0x57, flags: 0x0}, - 1177: {region: 0x123, script: 0xdf, flags: 0x0}, - 1178: {region: 0x32, script: 0x57, flags: 0x0}, - 1179: {region: 0x165, script: 0x57, flags: 0x0}, - 1180: {region: 0x165, script: 0x57, flags: 0x0}, - 1181: {region: 0xce, script: 0x57, flags: 0x0}, - 1182: {region: 0x165, script: 0x57, flags: 0x0}, - 1183: {region: 0x165, script: 0x57, flags: 0x0}, - 1184: {region: 0x12d, script: 0x57, flags: 0x0}, - 1185: {region: 0x165, script: 0x57, flags: 0x0}, - 1187: {region: 0x165, script: 0x57, flags: 0x0}, - 1188: {region: 0xd4, script: 0x57, flags: 0x0}, - 1189: {region: 0x53, script: 0xd8, flags: 0x0}, - 1190: {region: 0xe5, script: 0x57, flags: 0x0}, - 1191: {region: 0x165, script: 0x57, flags: 0x0}, - 1192: {region: 0x106, script: 0x1f, flags: 0x0}, - 1193: {region: 0xba, script: 0x57, flags: 0x0}, - 1194: {region: 0x165, script: 0x57, flags: 0x0}, - 1195: {region: 0x106, script: 0x1f, flags: 0x0}, - 1196: {region: 0x3f, script: 0x4, flags: 0x1}, - 1197: {region: 0x11c, script: 0xe2, flags: 0x0}, - 1198: {region: 0x130, script: 0x1f, flags: 0x0}, - 1199: {region: 0x75, script: 0x57, flags: 0x0}, - 1200: {region: 0x2a, script: 0x57, flags: 0x0}, - 1202: {region: 0x43, script: 0x3, flags: 0x1}, - 1203: {region: 0x99, script: 0xe, flags: 0x0}, - 1204: {region: 0xe8, script: 0x5, flags: 0x0}, - 1205: {region: 0x165, script: 0x57, flags: 0x0}, - 1206: {region: 0x165, script: 0x57, flags: 0x0}, - 1207: {region: 0x165, script: 0x57, flags: 0x0}, - 1208: {region: 0x165, script: 0x57, flags: 0x0}, - 1209: {region: 0x165, script: 0x57, flags: 0x0}, - 1210: {region: 0x165, script: 0x57, flags: 0x0}, - 1211: {region: 0x165, script: 0x57, flags: 0x0}, - 1212: {region: 0x46, script: 0x4, flags: 0x1}, - 1213: {region: 0x165, script: 0x57, flags: 0x0}, - 1214: {region: 0xb4, script: 0xe3, flags: 0x0}, - 1215: {region: 0x165, script: 0x57, flags: 0x0}, - 1216: {region: 0x161, script: 0x57, flags: 0x0}, - 1217: {region: 0x9e, script: 0x57, flags: 0x0}, - 1218: {region: 0x106, script: 0x57, flags: 0x0}, - 1219: {region: 0x13e, script: 0x57, flags: 0x0}, - 1220: {region: 0x11b, script: 0x57, flags: 0x0}, - 1221: {region: 0x165, script: 0x57, flags: 0x0}, - 1222: {region: 0x36, script: 0x57, flags: 0x0}, - 1223: {region: 0x60, script: 0x57, flags: 0x0}, - 1224: {region: 0xd1, script: 0x57, flags: 0x0}, - 1225: {region: 0x1, script: 0x57, flags: 0x0}, - 1226: {region: 0x106, script: 0x57, flags: 0x0}, - 1227: {region: 0x6a, script: 0x57, flags: 0x0}, - 1228: {region: 0x12f, script: 0x57, flags: 0x0}, - 1229: {region: 0x165, script: 0x57, flags: 0x0}, - 1230: {region: 0x36, script: 0x57, flags: 0x0}, - 1231: {region: 0x4e, script: 0x57, flags: 0x0}, - 1232: {region: 0x165, script: 0x57, flags: 0x0}, - 1233: {region: 0x6f, script: 0x29, flags: 0x0}, - 1234: {region: 0x165, script: 0x57, flags: 0x0}, - 1235: {region: 0xe7, script: 0x57, flags: 0x0}, - 1236: {region: 0x2f, script: 0x57, flags: 0x0}, - 1237: {region: 0x99, script: 0xda, flags: 0x0}, - 1238: {region: 0x99, script: 0x21, flags: 0x0}, - 1239: {region: 0x165, script: 0x57, flags: 0x0}, - 1240: {region: 0x165, script: 0x57, flags: 0x0}, - 1241: {region: 0x165, script: 0x57, flags: 0x0}, - 1242: {region: 0x165, script: 0x57, flags: 0x0}, - 1243: {region: 0x165, script: 0x57, flags: 0x0}, - 1244: {region: 0x165, script: 0x57, flags: 0x0}, - 1245: {region: 0x165, script: 0x57, flags: 0x0}, - 1246: {region: 0x165, script: 0x57, flags: 0x0}, - 1247: {region: 0x165, script: 0x57, flags: 0x0}, - 1248: {region: 0x140, script: 0x57, flags: 0x0}, - 1249: {region: 0x165, script: 0x57, flags: 0x0}, - 1250: {region: 0x165, script: 0x57, flags: 0x0}, - 1251: {region: 0xa8, script: 0x5, flags: 0x0}, - 1252: {region: 0x165, script: 0x57, flags: 0x0}, - 1253: {region: 0x114, script: 0x57, flags: 0x0}, - 1254: {region: 0x165, script: 0x57, flags: 0x0}, - 1255: {region: 0x165, script: 0x57, flags: 0x0}, - 1256: {region: 0x165, script: 0x57, flags: 0x0}, - 1257: {region: 0x165, script: 0x57, flags: 0x0}, - 1258: {region: 0x99, script: 0x21, flags: 0x0}, - 1259: {region: 0x53, script: 0x38, flags: 0x0}, - 1260: {region: 0x165, script: 0x57, flags: 0x0}, - 1261: {region: 0x165, script: 0x57, flags: 0x0}, - 1262: {region: 0x41, script: 0x57, flags: 0x0}, - 1263: {region: 0x165, script: 0x57, flags: 0x0}, - 1264: {region: 0x12b, script: 0x18, flags: 0x0}, - 1265: {region: 0x165, script: 0x57, flags: 0x0}, - 1266: {region: 0x161, script: 0x57, flags: 0x0}, - 1267: {region: 0x165, script: 0x57, flags: 0x0}, - 1268: {region: 0x12b, script: 0x5f, flags: 0x0}, - 1269: {region: 0x12b, script: 0x60, flags: 0x0}, - 1270: {region: 0x7d, script: 0x2b, flags: 0x0}, - 1271: {region: 0x53, script: 0x64, flags: 0x0}, - 1272: {region: 0x10b, script: 0x69, flags: 0x0}, - 1273: {region: 0x108, script: 0x73, flags: 0x0}, - 1274: {region: 0x99, script: 0x21, flags: 0x0}, - 1275: {region: 0x131, script: 0x57, flags: 0x0}, - 1276: {region: 0x165, script: 0x57, flags: 0x0}, - 1277: {region: 0x9c, script: 0x8a, flags: 0x0}, - 1278: {region: 0x165, script: 0x57, flags: 0x0}, - 1279: {region: 0x15e, script: 0xc2, flags: 0x0}, - 1280: {region: 0x165, script: 0x57, flags: 0x0}, - 1281: {region: 0x165, script: 0x57, flags: 0x0}, - 1282: {region: 0xdb, script: 0x21, flags: 0x0}, - 1283: {region: 0x165, script: 0x57, flags: 0x0}, - 1284: {region: 0x165, script: 0x57, flags: 0x0}, - 1285: {region: 0xd1, script: 0x57, flags: 0x0}, - 1286: {region: 0x75, script: 0x57, flags: 0x0}, - 1287: {region: 0x165, script: 0x57, flags: 0x0}, - 1288: {region: 0x165, script: 0x57, flags: 0x0}, - 1289: {region: 0x52, script: 0x57, flags: 0x0}, - 1290: {region: 0x165, script: 0x57, flags: 0x0}, - 1291: {region: 0x165, script: 0x57, flags: 0x0}, - 1292: {region: 0x165, script: 0x57, flags: 0x0}, - 1293: {region: 0x52, script: 0x57, flags: 0x0}, - 1294: {region: 0x165, script: 0x57, flags: 0x0}, - 1295: {region: 0x165, script: 0x57, flags: 0x0}, - 1296: {region: 0x165, script: 0x57, flags: 0x0}, - 1297: {region: 0x165, script: 0x57, flags: 0x0}, - 1298: {region: 0x1, script: 0x3b, flags: 0x0}, - 1299: {region: 0x165, script: 0x57, flags: 0x0}, - 1300: {region: 0x165, script: 0x57, flags: 0x0}, - 1301: {region: 0x165, script: 0x57, flags: 0x0}, - 1302: {region: 0x165, script: 0x57, flags: 0x0}, - 1303: {region: 0x165, script: 0x57, flags: 0x0}, - 1304: {region: 0xd6, script: 0x57, flags: 0x0}, - 1305: {region: 0x165, script: 0x57, flags: 0x0}, - 1306: {region: 0x165, script: 0x57, flags: 0x0}, - 1307: {region: 0x165, script: 0x57, flags: 0x0}, - 1308: {region: 0x41, script: 0x57, flags: 0x0}, - 1309: {region: 0x165, script: 0x57, flags: 0x0}, - 1310: {region: 0xcf, script: 0x57, flags: 0x0}, - 1311: {region: 0x4a, script: 0x3, flags: 0x1}, - 1312: {region: 0x165, script: 0x57, flags: 0x0}, - 1313: {region: 0x165, script: 0x57, flags: 0x0}, - 1314: {region: 0x165, script: 0x57, flags: 0x0}, - 1315: {region: 0x53, script: 0x57, flags: 0x0}, - 1316: {region: 0x10b, script: 0x57, flags: 0x0}, - 1318: {region: 0xa8, script: 0x5, flags: 0x0}, - 1319: {region: 0xd9, script: 0x57, flags: 0x0}, - 1320: {region: 0xba, script: 0xdc, flags: 0x0}, - 1321: {region: 0x4d, script: 0x14, flags: 0x1}, - 1322: {region: 0x53, script: 0x79, flags: 0x0}, - 1323: {region: 0x165, script: 0x57, flags: 0x0}, - 1324: {region: 0x122, script: 0x57, flags: 0x0}, - 1325: {region: 0xd0, script: 0x57, flags: 0x0}, - 1326: {region: 0x165, script: 0x57, flags: 0x0}, - 1327: {region: 0x161, script: 0x57, flags: 0x0}, - 1329: {region: 0x12b, script: 0x57, flags: 0x0}, -} - -// likelyLangList holds lists info associated with likelyLang. -// Size: 388 bytes, 97 elements -var likelyLangList = [97]likelyScriptRegion{ - 0: {region: 0x9c, script: 0x7, flags: 0x0}, - 1: {region: 0xa1, script: 0x74, flags: 0x2}, - 2: {region: 0x11c, script: 0x80, flags: 0x2}, - 3: {region: 0x32, script: 0x57, flags: 0x0}, - 4: {region: 0x9b, script: 0x5, flags: 0x4}, - 5: {region: 0x9c, script: 0x5, flags: 0x4}, - 6: {region: 0x106, script: 0x1f, flags: 0x4}, - 7: {region: 0x9c, script: 0x5, flags: 0x2}, - 8: {region: 0x106, script: 0x1f, flags: 0x0}, - 9: {region: 0x38, script: 0x2c, flags: 0x2}, - 10: {region: 0x135, script: 0x57, flags: 0x0}, - 11: {region: 0x7b, script: 0xc5, flags: 0x2}, - 12: {region: 0x114, script: 0x57, flags: 0x0}, - 13: {region: 0x84, script: 0x1, flags: 0x2}, - 14: {region: 0x5d, script: 0x1e, flags: 0x0}, - 15: {region: 0x87, script: 0x5c, flags: 0x2}, - 16: {region: 0xd6, script: 0x57, flags: 0x0}, - 17: {region: 0x52, script: 0x5, flags: 0x4}, - 18: {region: 0x10b, script: 0x5, flags: 0x4}, - 19: {region: 0xae, script: 0x1f, flags: 0x0}, - 20: {region: 0x24, script: 0x5, flags: 0x4}, - 21: {region: 0x53, script: 0x5, flags: 0x4}, - 22: {region: 0x9c, script: 0x5, flags: 0x4}, - 23: {region: 0xc5, script: 0x5, flags: 0x4}, - 24: {region: 0x53, script: 0x5, flags: 0x2}, - 25: {region: 0x12b, script: 0x57, flags: 0x0}, - 26: {region: 0xb0, script: 0x5, flags: 0x4}, - 27: {region: 0x9b, script: 0x5, flags: 0x2}, - 28: {region: 0xa5, script: 0x1f, flags: 0x0}, - 29: {region: 0x53, script: 0x5, flags: 0x4}, - 30: {region: 0x12b, script: 0x57, flags: 0x4}, - 31: {region: 0x53, script: 0x5, flags: 0x2}, - 32: {region: 0x12b, script: 0x57, flags: 0x2}, - 33: {region: 0xdb, script: 0x21, flags: 0x0}, - 34: {region: 0x99, script: 0x5a, flags: 0x2}, - 35: {region: 0x83, script: 0x57, flags: 0x0}, - 36: {region: 0x84, script: 0x78, flags: 0x4}, - 37: {region: 0x84, script: 0x78, flags: 0x2}, - 38: {region: 0xc5, script: 0x1f, flags: 0x0}, - 39: {region: 0x53, script: 0x6d, flags: 0x4}, - 40: {region: 0x53, script: 0x6d, flags: 0x2}, - 41: {region: 0xd0, script: 0x57, flags: 0x0}, - 42: {region: 0x4a, script: 0x5, flags: 0x4}, - 43: {region: 0x95, script: 0x5, flags: 0x4}, - 44: {region: 0x99, script: 0x33, flags: 0x0}, - 45: {region: 0xe8, script: 0x5, flags: 0x4}, - 46: {region: 0xe8, script: 0x5, flags: 0x2}, - 47: {region: 0x9c, script: 0x84, flags: 0x0}, - 48: {region: 0x53, script: 0x85, flags: 0x2}, - 49: {region: 0xba, script: 0xdc, flags: 0x0}, - 50: {region: 0xd9, script: 0x57, flags: 0x4}, - 51: {region: 0xe8, script: 0x5, flags: 0x0}, - 52: {region: 0x99, script: 0x21, flags: 0x2}, - 53: {region: 0x99, script: 0x4c, flags: 0x2}, - 54: {region: 0x99, script: 0xc9, flags: 0x2}, - 55: {region: 0x105, script: 0x1f, flags: 0x0}, - 56: {region: 0xbd, script: 0x57, flags: 0x4}, - 57: {region: 0x104, script: 0x57, flags: 0x4}, - 58: {region: 0x106, script: 0x57, flags: 0x4}, - 59: {region: 0x12b, script: 0x57, flags: 0x4}, - 60: {region: 0x124, script: 0x1f, flags: 0x0}, - 61: {region: 0xe8, script: 0x5, flags: 0x4}, - 62: {region: 0xe8, script: 0x5, flags: 0x2}, - 63: {region: 0x53, script: 0x5, flags: 0x0}, - 64: {region: 0xae, script: 0x1f, flags: 0x4}, - 65: {region: 0xc5, script: 0x1f, flags: 0x4}, - 66: {region: 0xae, script: 0x1f, flags: 0x2}, - 67: {region: 0x99, script: 0xe, flags: 0x0}, - 68: {region: 0xdb, script: 0x21, flags: 0x4}, - 69: {region: 0xdb, script: 0x21, flags: 0x2}, - 70: {region: 0x137, script: 0x57, flags: 0x0}, - 71: {region: 0x24, script: 0x5, flags: 0x4}, - 72: {region: 0x53, script: 0x1f, flags: 0x4}, - 73: {region: 0x24, script: 0x5, flags: 0x2}, - 74: {region: 0x8d, script: 0x39, flags: 0x0}, - 75: {region: 0x53, script: 0x38, flags: 0x4}, - 76: {region: 0x53, script: 0x38, flags: 0x2}, - 77: {region: 0x53, script: 0x38, flags: 0x0}, - 78: {region: 0x2f, script: 0x39, flags: 0x4}, - 79: {region: 0x3e, script: 0x39, flags: 0x4}, - 80: {region: 0x7b, script: 0x39, flags: 0x4}, - 81: {region: 0x7e, script: 0x39, flags: 0x4}, - 82: {region: 0x8d, script: 0x39, flags: 0x4}, - 83: {region: 0x95, script: 0x39, flags: 0x4}, - 84: {region: 0xc6, script: 0x39, flags: 0x4}, - 85: {region: 0xd0, script: 0x39, flags: 0x4}, - 86: {region: 0xe2, script: 0x39, flags: 0x4}, - 87: {region: 0xe5, script: 0x39, flags: 0x4}, - 88: {region: 0xe7, script: 0x39, flags: 0x4}, - 89: {region: 0x116, script: 0x39, flags: 0x4}, - 90: {region: 0x123, script: 0x39, flags: 0x4}, - 91: {region: 0x12e, script: 0x39, flags: 0x4}, - 92: {region: 0x135, script: 0x39, flags: 0x4}, - 93: {region: 0x13e, script: 0x39, flags: 0x4}, - 94: {region: 0x12e, script: 0x11, flags: 0x2}, - 95: {region: 0x12e, script: 0x34, flags: 0x2}, - 96: {region: 0x12e, script: 0x39, flags: 0x2}, -} - -type likelyLangScript struct { - lang uint16 - script uint8 - flags uint8 -} - -// likelyRegion is a lookup table, indexed by regionID, for the most likely -// languages and scripts given incomplete information. If more entries exist -// for a given regionID, lang and script are the index and size respectively -// of the list in likelyRegionList. -// TODO: exclude containers and user-definable regions from the list. -// Size: 1432 bytes, 358 elements -var likelyRegion = [358]likelyLangScript{ - 34: {lang: 0xd7, script: 0x57, flags: 0x0}, - 35: {lang: 0x3a, script: 0x5, flags: 0x0}, - 36: {lang: 0x0, script: 0x2, flags: 0x1}, - 39: {lang: 0x2, script: 0x2, flags: 0x1}, - 40: {lang: 0x4, script: 0x2, flags: 0x1}, - 42: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 43: {lang: 0x0, script: 0x57, flags: 0x0}, - 44: {lang: 0x13e, script: 0x57, flags: 0x0}, - 45: {lang: 0x41b, script: 0x57, flags: 0x0}, - 46: {lang: 0x10d, script: 0x57, flags: 0x0}, - 48: {lang: 0x367, script: 0x57, flags: 0x0}, - 49: {lang: 0x444, script: 0x57, flags: 0x0}, - 50: {lang: 0x58, script: 0x57, flags: 0x0}, - 51: {lang: 0x6, script: 0x2, flags: 0x1}, - 53: {lang: 0xa5, script: 0xe, flags: 0x0}, - 54: {lang: 0x367, script: 0x57, flags: 0x0}, - 55: {lang: 0x15e, script: 0x57, flags: 0x0}, - 56: {lang: 0x7e, script: 0x1f, flags: 0x0}, - 57: {lang: 0x3a, script: 0x5, flags: 0x0}, - 58: {lang: 0x3d9, script: 0x57, flags: 0x0}, - 59: {lang: 0x15e, script: 0x57, flags: 0x0}, - 60: {lang: 0x15e, script: 0x57, flags: 0x0}, - 62: {lang: 0x31f, script: 0x57, flags: 0x0}, - 63: {lang: 0x13e, script: 0x57, flags: 0x0}, - 64: {lang: 0x3a1, script: 0x57, flags: 0x0}, - 65: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 67: {lang: 0x8, script: 0x2, flags: 0x1}, - 69: {lang: 0x0, script: 0x57, flags: 0x0}, - 71: {lang: 0x71, script: 0x1f, flags: 0x0}, - 73: {lang: 0x512, script: 0x3b, flags: 0x2}, - 74: {lang: 0x31f, script: 0x5, flags: 0x2}, - 75: {lang: 0x445, script: 0x57, flags: 0x0}, - 76: {lang: 0x15e, script: 0x57, flags: 0x0}, - 77: {lang: 0x15e, script: 0x57, flags: 0x0}, - 78: {lang: 0x10d, script: 0x57, flags: 0x0}, - 79: {lang: 0x15e, script: 0x57, flags: 0x0}, - 81: {lang: 0x13e, script: 0x57, flags: 0x0}, - 82: {lang: 0x15e, script: 0x57, flags: 0x0}, - 83: {lang: 0xa, script: 0x4, flags: 0x1}, - 84: {lang: 0x13e, script: 0x57, flags: 0x0}, - 85: {lang: 0x0, script: 0x57, flags: 0x0}, - 86: {lang: 0x13e, script: 0x57, flags: 0x0}, - 89: {lang: 0x13e, script: 0x57, flags: 0x0}, - 90: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 91: {lang: 0x3a1, script: 0x57, flags: 0x0}, - 93: {lang: 0xe, script: 0x2, flags: 0x1}, - 94: {lang: 0xfa, script: 0x57, flags: 0x0}, - 96: {lang: 0x10d, script: 0x57, flags: 0x0}, - 98: {lang: 0x1, script: 0x57, flags: 0x0}, - 99: {lang: 0x101, script: 0x57, flags: 0x0}, - 101: {lang: 0x13e, script: 0x57, flags: 0x0}, - 103: {lang: 0x10, script: 0x2, flags: 0x1}, - 104: {lang: 0x13e, script: 0x57, flags: 0x0}, - 105: {lang: 0x13e, script: 0x57, flags: 0x0}, - 106: {lang: 0x140, script: 0x57, flags: 0x0}, - 107: {lang: 0x3a, script: 0x5, flags: 0x0}, - 108: {lang: 0x3a, script: 0x5, flags: 0x0}, - 109: {lang: 0x46f, script: 0x29, flags: 0x0}, - 110: {lang: 0x13e, script: 0x57, flags: 0x0}, - 111: {lang: 0x12, script: 0x2, flags: 0x1}, - 113: {lang: 0x10d, script: 0x57, flags: 0x0}, - 114: {lang: 0x151, script: 0x57, flags: 0x0}, - 115: {lang: 0x1c0, script: 0x21, flags: 0x2}, - 118: {lang: 0x158, script: 0x57, flags: 0x0}, - 120: {lang: 0x15e, script: 0x57, flags: 0x0}, - 122: {lang: 0x15e, script: 0x57, flags: 0x0}, - 123: {lang: 0x14, script: 0x2, flags: 0x1}, - 125: {lang: 0x16, script: 0x3, flags: 0x1}, - 126: {lang: 0x15e, script: 0x57, flags: 0x0}, - 128: {lang: 0x21, script: 0x57, flags: 0x0}, - 130: {lang: 0x245, script: 0x57, flags: 0x0}, - 132: {lang: 0x15e, script: 0x57, flags: 0x0}, - 133: {lang: 0x15e, script: 0x57, flags: 0x0}, - 134: {lang: 0x13e, script: 0x57, flags: 0x0}, - 135: {lang: 0x19, script: 0x2, flags: 0x1}, - 136: {lang: 0x0, script: 0x57, flags: 0x0}, - 137: {lang: 0x13e, script: 0x57, flags: 0x0}, - 139: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 141: {lang: 0x529, script: 0x39, flags: 0x0}, - 142: {lang: 0x0, script: 0x57, flags: 0x0}, - 143: {lang: 0x13e, script: 0x57, flags: 0x0}, - 144: {lang: 0x1d1, script: 0x57, flags: 0x0}, - 145: {lang: 0x1d4, script: 0x57, flags: 0x0}, - 146: {lang: 0x1d5, script: 0x57, flags: 0x0}, - 148: {lang: 0x13e, script: 0x57, flags: 0x0}, - 149: {lang: 0x1b, script: 0x2, flags: 0x1}, - 151: {lang: 0x1bc, script: 0x3b, flags: 0x0}, - 153: {lang: 0x1d, script: 0x3, flags: 0x1}, - 155: {lang: 0x3a, script: 0x5, flags: 0x0}, - 156: {lang: 0x20, script: 0x2, flags: 0x1}, - 157: {lang: 0x1f8, script: 0x57, flags: 0x0}, - 158: {lang: 0x1f9, script: 0x57, flags: 0x0}, - 161: {lang: 0x3a, script: 0x5, flags: 0x0}, - 162: {lang: 0x200, script: 0x46, flags: 0x0}, - 164: {lang: 0x445, script: 0x57, flags: 0x0}, - 165: {lang: 0x28a, script: 0x1f, flags: 0x0}, - 166: {lang: 0x22, script: 0x3, flags: 0x1}, - 168: {lang: 0x25, script: 0x2, flags: 0x1}, - 170: {lang: 0x254, script: 0x50, flags: 0x0}, - 171: {lang: 0x254, script: 0x50, flags: 0x0}, - 172: {lang: 0x3a, script: 0x5, flags: 0x0}, - 174: {lang: 0x3e2, script: 0x1f, flags: 0x0}, - 175: {lang: 0x27, script: 0x2, flags: 0x1}, - 176: {lang: 0x3a, script: 0x5, flags: 0x0}, - 178: {lang: 0x10d, script: 0x57, flags: 0x0}, - 179: {lang: 0x40c, script: 0xca, flags: 0x0}, - 181: {lang: 0x43b, script: 0x57, flags: 0x0}, - 182: {lang: 0x2c0, script: 0x57, flags: 0x0}, - 183: {lang: 0x15e, script: 0x57, flags: 0x0}, - 184: {lang: 0x2c7, script: 0x57, flags: 0x0}, - 185: {lang: 0x3a, script: 0x5, flags: 0x0}, - 186: {lang: 0x29, script: 0x2, flags: 0x1}, - 187: {lang: 0x15e, script: 0x57, flags: 0x0}, - 188: {lang: 0x2b, script: 0x2, flags: 0x1}, - 189: {lang: 0x432, script: 0x57, flags: 0x0}, - 190: {lang: 0x15e, script: 0x57, flags: 0x0}, - 191: {lang: 0x2f1, script: 0x57, flags: 0x0}, - 194: {lang: 0x2d, script: 0x2, flags: 0x1}, - 195: {lang: 0xa0, script: 0x57, flags: 0x0}, - 196: {lang: 0x2f, script: 0x2, flags: 0x1}, - 197: {lang: 0x31, script: 0x2, flags: 0x1}, - 198: {lang: 0x33, script: 0x2, flags: 0x1}, - 200: {lang: 0x15e, script: 0x57, flags: 0x0}, - 201: {lang: 0x35, script: 0x2, flags: 0x1}, - 203: {lang: 0x320, script: 0x57, flags: 0x0}, - 204: {lang: 0x37, script: 0x3, flags: 0x1}, - 205: {lang: 0x128, script: 0xde, flags: 0x0}, - 207: {lang: 0x13e, script: 0x57, flags: 0x0}, - 208: {lang: 0x31f, script: 0x57, flags: 0x0}, - 209: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 210: {lang: 0x16, script: 0x57, flags: 0x0}, - 211: {lang: 0x15e, script: 0x57, flags: 0x0}, - 212: {lang: 0x1b4, script: 0x57, flags: 0x0}, - 214: {lang: 0x1b4, script: 0x5, flags: 0x2}, - 216: {lang: 0x13e, script: 0x57, flags: 0x0}, - 217: {lang: 0x367, script: 0x57, flags: 0x0}, - 218: {lang: 0x347, script: 0x57, flags: 0x0}, - 219: {lang: 0x351, script: 0x21, flags: 0x0}, - 225: {lang: 0x3a, script: 0x5, flags: 0x0}, - 226: {lang: 0x13e, script: 0x57, flags: 0x0}, - 228: {lang: 0x13e, script: 0x57, flags: 0x0}, - 229: {lang: 0x15e, script: 0x57, flags: 0x0}, - 230: {lang: 0x486, script: 0x57, flags: 0x0}, - 231: {lang: 0x153, script: 0x57, flags: 0x0}, - 232: {lang: 0x3a, script: 0x3, flags: 0x1}, - 233: {lang: 0x3b3, script: 0x57, flags: 0x0}, - 234: {lang: 0x15e, script: 0x57, flags: 0x0}, - 236: {lang: 0x13e, script: 0x57, flags: 0x0}, - 237: {lang: 0x3a, script: 0x5, flags: 0x0}, - 238: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 240: {lang: 0x3a2, script: 0x57, flags: 0x0}, - 241: {lang: 0x194, script: 0x57, flags: 0x0}, - 243: {lang: 0x3a, script: 0x5, flags: 0x0}, - 258: {lang: 0x15e, script: 0x57, flags: 0x0}, - 260: {lang: 0x3d, script: 0x2, flags: 0x1}, - 261: {lang: 0x432, script: 0x1f, flags: 0x0}, - 262: {lang: 0x3f, script: 0x2, flags: 0x1}, - 263: {lang: 0x3e5, script: 0x57, flags: 0x0}, - 264: {lang: 0x3a, script: 0x5, flags: 0x0}, - 266: {lang: 0x15e, script: 0x57, flags: 0x0}, - 267: {lang: 0x3a, script: 0x5, flags: 0x0}, - 268: {lang: 0x41, script: 0x2, flags: 0x1}, - 271: {lang: 0x416, script: 0x57, flags: 0x0}, - 272: {lang: 0x347, script: 0x57, flags: 0x0}, - 273: {lang: 0x43, script: 0x2, flags: 0x1}, - 275: {lang: 0x1f9, script: 0x57, flags: 0x0}, - 276: {lang: 0x15e, script: 0x57, flags: 0x0}, - 277: {lang: 0x429, script: 0x57, flags: 0x0}, - 278: {lang: 0x367, script: 0x57, flags: 0x0}, - 280: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 282: {lang: 0x13e, script: 0x57, flags: 0x0}, - 284: {lang: 0x45, script: 0x2, flags: 0x1}, - 288: {lang: 0x15e, script: 0x57, flags: 0x0}, - 289: {lang: 0x15e, script: 0x57, flags: 0x0}, - 290: {lang: 0x47, script: 0x2, flags: 0x1}, - 291: {lang: 0x49, script: 0x3, flags: 0x1}, - 292: {lang: 0x4c, script: 0x2, flags: 0x1}, - 293: {lang: 0x477, script: 0x57, flags: 0x0}, - 294: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 295: {lang: 0x476, script: 0x57, flags: 0x0}, - 296: {lang: 0x4e, script: 0x2, flags: 0x1}, - 297: {lang: 0x482, script: 0x57, flags: 0x0}, - 299: {lang: 0x50, script: 0x4, flags: 0x1}, - 301: {lang: 0x4a0, script: 0x57, flags: 0x0}, - 302: {lang: 0x54, script: 0x2, flags: 0x1}, - 303: {lang: 0x445, script: 0x57, flags: 0x0}, - 304: {lang: 0x56, script: 0x3, flags: 0x1}, - 305: {lang: 0x445, script: 0x57, flags: 0x0}, - 309: {lang: 0x512, script: 0x3b, flags: 0x2}, - 310: {lang: 0x13e, script: 0x57, flags: 0x0}, - 311: {lang: 0x4bc, script: 0x57, flags: 0x0}, - 312: {lang: 0x1f9, script: 0x57, flags: 0x0}, - 315: {lang: 0x13e, script: 0x57, flags: 0x0}, - 318: {lang: 0x4c3, script: 0x57, flags: 0x0}, - 319: {lang: 0x8a, script: 0x57, flags: 0x0}, - 320: {lang: 0x15e, script: 0x57, flags: 0x0}, - 322: {lang: 0x41b, script: 0x57, flags: 0x0}, - 333: {lang: 0x59, script: 0x2, flags: 0x1}, - 350: {lang: 0x3a, script: 0x5, flags: 0x0}, - 351: {lang: 0x5b, script: 0x2, flags: 0x1}, - 356: {lang: 0x423, script: 0x57, flags: 0x0}, -} - -// likelyRegionList holds lists info associated with likelyRegion. -// Size: 372 bytes, 93 elements -var likelyRegionList = [93]likelyLangScript{ - 0: {lang: 0x148, script: 0x5, flags: 0x0}, - 1: {lang: 0x476, script: 0x57, flags: 0x0}, - 2: {lang: 0x431, script: 0x57, flags: 0x0}, - 3: {lang: 0x2ff, script: 0x1f, flags: 0x0}, - 4: {lang: 0x1d7, script: 0x8, flags: 0x0}, - 5: {lang: 0x274, script: 0x57, flags: 0x0}, - 6: {lang: 0xb7, script: 0x57, flags: 0x0}, - 7: {lang: 0x432, script: 0x1f, flags: 0x0}, - 8: {lang: 0x12d, script: 0xe0, flags: 0x0}, - 9: {lang: 0x351, script: 0x21, flags: 0x0}, - 10: {lang: 0x529, script: 0x38, flags: 0x0}, - 11: {lang: 0x4ac, script: 0x5, flags: 0x0}, - 12: {lang: 0x523, script: 0x57, flags: 0x0}, - 13: {lang: 0x29a, script: 0xdf, flags: 0x0}, - 14: {lang: 0x136, script: 0x31, flags: 0x0}, - 15: {lang: 0x48a, script: 0x57, flags: 0x0}, - 16: {lang: 0x3a, script: 0x5, flags: 0x0}, - 17: {lang: 0x15e, script: 0x57, flags: 0x0}, - 18: {lang: 0x27, script: 0x29, flags: 0x0}, - 19: {lang: 0x139, script: 0x57, flags: 0x0}, - 20: {lang: 0x26a, script: 0x5, flags: 0x2}, - 21: {lang: 0x512, script: 0x3b, flags: 0x2}, - 22: {lang: 0x210, script: 0x2b, flags: 0x0}, - 23: {lang: 0x5, script: 0x1f, flags: 0x0}, - 24: {lang: 0x274, script: 0x57, flags: 0x0}, - 25: {lang: 0x136, script: 0x31, flags: 0x0}, - 26: {lang: 0x2ff, script: 0x1f, flags: 0x0}, - 27: {lang: 0x1e1, script: 0x57, flags: 0x0}, - 28: {lang: 0x31f, script: 0x5, flags: 0x0}, - 29: {lang: 0x1be, script: 0x21, flags: 0x0}, - 30: {lang: 0x4b4, script: 0x5, flags: 0x0}, - 31: {lang: 0x236, script: 0x72, flags: 0x0}, - 32: {lang: 0x148, script: 0x5, flags: 0x0}, - 33: {lang: 0x476, script: 0x57, flags: 0x0}, - 34: {lang: 0x24a, script: 0x4b, flags: 0x0}, - 35: {lang: 0xe6, script: 0x5, flags: 0x0}, - 36: {lang: 0x226, script: 0xdf, flags: 0x0}, - 37: {lang: 0x3a, script: 0x5, flags: 0x0}, - 38: {lang: 0x15e, script: 0x57, flags: 0x0}, - 39: {lang: 0x2b8, script: 0x54, flags: 0x0}, - 40: {lang: 0x226, script: 0xdf, flags: 0x0}, - 41: {lang: 0x3a, script: 0x5, flags: 0x0}, - 42: {lang: 0x15e, script: 0x57, flags: 0x0}, - 43: {lang: 0x3dc, script: 0x57, flags: 0x0}, - 44: {lang: 0x4ae, script: 0x1f, flags: 0x0}, - 45: {lang: 0x2ff, script: 0x1f, flags: 0x0}, - 46: {lang: 0x431, script: 0x57, flags: 0x0}, - 47: {lang: 0x331, script: 0x72, flags: 0x0}, - 48: {lang: 0x213, script: 0x57, flags: 0x0}, - 49: {lang: 0x30b, script: 0x1f, flags: 0x0}, - 50: {lang: 0x242, script: 0x5, flags: 0x0}, - 51: {lang: 0x529, script: 0x39, flags: 0x0}, - 52: {lang: 0x3c0, script: 0x57, flags: 0x0}, - 53: {lang: 0x3a, script: 0x5, flags: 0x0}, - 54: {lang: 0x15e, script: 0x57, flags: 0x0}, - 55: {lang: 0x2ed, script: 0x57, flags: 0x0}, - 56: {lang: 0x4b4, script: 0x5, flags: 0x0}, - 57: {lang: 0x88, script: 0x21, flags: 0x0}, - 58: {lang: 0x4b4, script: 0x5, flags: 0x0}, - 59: {lang: 0x4b4, script: 0x5, flags: 0x0}, - 60: {lang: 0xbe, script: 0x21, flags: 0x0}, - 61: {lang: 0x3dc, script: 0x57, flags: 0x0}, - 62: {lang: 0x7e, script: 0x1f, flags: 0x0}, - 63: {lang: 0x3e2, script: 0x1f, flags: 0x0}, - 64: {lang: 0x267, script: 0x57, flags: 0x0}, - 65: {lang: 0x444, script: 0x57, flags: 0x0}, - 66: {lang: 0x512, script: 0x3b, flags: 0x0}, - 67: {lang: 0x412, script: 0x57, flags: 0x0}, - 68: {lang: 0x4ae, script: 0x1f, flags: 0x0}, - 69: {lang: 0x3a, script: 0x5, flags: 0x0}, - 70: {lang: 0x15e, script: 0x57, flags: 0x0}, - 71: {lang: 0x15e, script: 0x57, flags: 0x0}, - 72: {lang: 0x35, script: 0x5, flags: 0x0}, - 73: {lang: 0x46b, script: 0xdf, flags: 0x0}, - 74: {lang: 0x2ec, script: 0x5, flags: 0x0}, - 75: {lang: 0x30f, script: 0x72, flags: 0x0}, - 76: {lang: 0x467, script: 0x1f, flags: 0x0}, - 77: {lang: 0x148, script: 0x5, flags: 0x0}, - 78: {lang: 0x3a, script: 0x5, flags: 0x0}, - 79: {lang: 0x15e, script: 0x57, flags: 0x0}, - 80: {lang: 0x48a, script: 0x57, flags: 0x0}, - 81: {lang: 0x58, script: 0x5, flags: 0x0}, - 82: {lang: 0x219, script: 0x1f, flags: 0x0}, - 83: {lang: 0x81, script: 0x31, flags: 0x0}, - 84: {lang: 0x529, script: 0x39, flags: 0x0}, - 85: {lang: 0x48c, script: 0x57, flags: 0x0}, - 86: {lang: 0x4ae, script: 0x1f, flags: 0x0}, - 87: {lang: 0x512, script: 0x3b, flags: 0x0}, - 88: {lang: 0x3b3, script: 0x57, flags: 0x0}, - 89: {lang: 0x431, script: 0x57, flags: 0x0}, - 90: {lang: 0x432, script: 0x1f, flags: 0x0}, - 91: {lang: 0x15e, script: 0x57, flags: 0x0}, - 92: {lang: 0x446, script: 0x5, flags: 0x0}, -} - -type likelyTag struct { - lang uint16 - region uint16 - script uint8 -} - -// Size: 198 bytes, 33 elements -var likelyRegionGroup = [33]likelyTag{ - 1: {lang: 0x139, region: 0xd6, script: 0x57}, - 2: {lang: 0x139, region: 0x135, script: 0x57}, - 3: {lang: 0x3c0, region: 0x41, script: 0x57}, - 4: {lang: 0x139, region: 0x2f, script: 0x57}, - 5: {lang: 0x139, region: 0xd6, script: 0x57}, - 6: {lang: 0x13e, region: 0xcf, script: 0x57}, - 7: {lang: 0x445, region: 0x12f, script: 0x57}, - 8: {lang: 0x3a, region: 0x6b, script: 0x5}, - 9: {lang: 0x445, region: 0x4b, script: 0x57}, - 10: {lang: 0x139, region: 0x161, script: 0x57}, - 11: {lang: 0x139, region: 0x135, script: 0x57}, - 12: {lang: 0x139, region: 0x135, script: 0x57}, - 13: {lang: 0x13e, region: 0x59, script: 0x57}, - 14: {lang: 0x529, region: 0x53, script: 0x38}, - 15: {lang: 0x1be, region: 0x99, script: 0x21}, - 16: {lang: 0x1e1, region: 0x95, script: 0x57}, - 17: {lang: 0x1f9, region: 0x9e, script: 0x57}, - 18: {lang: 0x139, region: 0x2f, script: 0x57}, - 19: {lang: 0x139, region: 0xe6, script: 0x57}, - 20: {lang: 0x139, region: 0x8a, script: 0x57}, - 21: {lang: 0x41b, region: 0x142, script: 0x57}, - 22: {lang: 0x529, region: 0x53, script: 0x38}, - 23: {lang: 0x4bc, region: 0x137, script: 0x57}, - 24: {lang: 0x3a, region: 0x108, script: 0x5}, - 25: {lang: 0x3e2, region: 0x106, script: 0x1f}, - 26: {lang: 0x3e2, region: 0x106, script: 0x1f}, - 27: {lang: 0x139, region: 0x7b, script: 0x57}, - 28: {lang: 0x10d, region: 0x60, script: 0x57}, - 29: {lang: 0x139, region: 0xd6, script: 0x57}, - 30: {lang: 0x13e, region: 0x1f, script: 0x57}, - 31: {lang: 0x139, region: 0x9a, script: 0x57}, - 32: {lang: 0x139, region: 0x7b, script: 0x57}, -} - -// Size: 264 bytes, 33 elements -var regionContainment = [33]uint64{ - // Entry 0 - 1F - 0x00000001ffffffff, 0x00000000200007a2, 0x0000000000003044, 0x0000000000000008, - 0x00000000803c0010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080, - 0x0000000000000100, 0x0000000000000200, 0x0000000000000400, 0x000000004000384c, - 0x0000000000001000, 0x0000000000002000, 0x0000000000004000, 0x0000000000008000, - 0x0000000000010000, 0x0000000000020000, 0x0000000000040000, 0x0000000000080000, - 0x0000000000100000, 0x0000000000200000, 0x0000000001c1c000, 0x0000000000800000, - 0x0000000001000000, 0x000000001e020000, 0x0000000004000000, 0x0000000008000000, - 0x0000000010000000, 0x00000000200006a0, 0x0000000040002048, 0x0000000080000000, - // Entry 20 - 3F - 0x0000000100000000, -} - -// regionInclusion maps region identifiers to sets of regions in regionInclusionBits, -// where each set holds all groupings that are directly connected in a region -// containment graph. -// Size: 358 bytes, 358 elements -var regionInclusion = [358]uint8{ - // Entry 0 - 3F - 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x23, - 0x24, 0x26, 0x27, 0x22, 0x28, 0x29, 0x2a, 0x2b, - 0x26, 0x2c, 0x24, 0x23, 0x26, 0x25, 0x2a, 0x2d, - 0x2e, 0x24, 0x2f, 0x2d, 0x26, 0x30, 0x31, 0x28, - // Entry 40 - 7F - 0x26, 0x28, 0x26, 0x25, 0x31, 0x22, 0x32, 0x33, - 0x34, 0x30, 0x22, 0x27, 0x27, 0x27, 0x35, 0x2d, - 0x29, 0x28, 0x27, 0x36, 0x28, 0x22, 0x34, 0x23, - 0x21, 0x26, 0x2d, 0x26, 0x22, 0x37, 0x2e, 0x35, - 0x2a, 0x22, 0x2f, 0x38, 0x26, 0x26, 0x21, 0x39, - 0x39, 0x28, 0x38, 0x39, 0x39, 0x2f, 0x3a, 0x2f, - 0x20, 0x21, 0x38, 0x3b, 0x28, 0x3c, 0x2c, 0x21, - 0x2a, 0x35, 0x27, 0x38, 0x26, 0x24, 0x28, 0x2c, - // Entry 80 - BF - 0x2d, 0x23, 0x30, 0x2d, 0x2d, 0x26, 0x27, 0x3a, - 0x22, 0x34, 0x3c, 0x2d, 0x28, 0x36, 0x22, 0x34, - 0x3a, 0x26, 0x2e, 0x21, 0x39, 0x31, 0x38, 0x24, - 0x2c, 0x25, 0x22, 0x24, 0x25, 0x2c, 0x3a, 0x2c, - 0x26, 0x24, 0x36, 0x21, 0x2f, 0x3d, 0x31, 0x3c, - 0x2f, 0x26, 0x36, 0x36, 0x24, 0x26, 0x3d, 0x31, - 0x24, 0x26, 0x35, 0x25, 0x2d, 0x32, 0x38, 0x2a, - 0x38, 0x39, 0x39, 0x35, 0x33, 0x23, 0x26, 0x2f, - // Entry C0 - FF - 0x3c, 0x21, 0x23, 0x2d, 0x31, 0x36, 0x36, 0x3c, - 0x26, 0x2d, 0x26, 0x3a, 0x2f, 0x25, 0x2f, 0x34, - 0x31, 0x2f, 0x32, 0x3b, 0x2d, 0x2b, 0x2d, 0x21, - 0x34, 0x2a, 0x2c, 0x25, 0x21, 0x3c, 0x24, 0x29, - 0x2b, 0x24, 0x34, 0x21, 0x28, 0x29, 0x3b, 0x31, - 0x25, 0x2e, 0x30, 0x29, 0x26, 0x24, 0x3a, 0x21, - 0x3c, 0x28, 0x21, 0x24, 0x21, 0x21, 0x1f, 0x21, - 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, - // Entry 100 - 13F - 0x21, 0x21, 0x2f, 0x21, 0x2e, 0x23, 0x33, 0x2f, - 0x24, 0x3b, 0x2f, 0x39, 0x38, 0x31, 0x2d, 0x3a, - 0x2c, 0x2e, 0x2d, 0x23, 0x2d, 0x2f, 0x28, 0x2f, - 0x27, 0x33, 0x34, 0x26, 0x24, 0x32, 0x22, 0x26, - 0x27, 0x22, 0x2d, 0x31, 0x3d, 0x29, 0x31, 0x3d, - 0x39, 0x29, 0x31, 0x24, 0x26, 0x29, 0x36, 0x2f, - 0x33, 0x2f, 0x21, 0x22, 0x21, 0x30, 0x28, 0x3d, - 0x23, 0x26, 0x21, 0x28, 0x26, 0x26, 0x31, 0x3b, - // Entry 140 - 17F - 0x29, 0x21, 0x29, 0x21, 0x21, 0x21, 0x21, 0x21, - 0x21, 0x21, 0x21, 0x21, 0x21, 0x23, 0x21, 0x21, - 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, - 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x2f, - 0x23, 0x32, 0x2f, 0x27, 0x2f, 0x21, -} - -// regionInclusionBits is an array of bit vectors where every vector represents -// a set of region groupings. These sets are used to compute the distance -// between two regions for the purpose of language matching. -// Size: 584 bytes, 73 elements -var regionInclusionBits = [73]uint64{ - // Entry 0 - 1F - 0x0000000102400813, 0x00000000200007a3, 0x0000000000003844, 0x0000000040000808, - 0x00000000803c0011, 0x0000000020000022, 0x0000000040000844, 0x0000000020000082, - 0x0000000000000102, 0x0000000020000202, 0x0000000020000402, 0x000000004000384d, - 0x0000000000001804, 0x0000000040002804, 0x0000000000404000, 0x0000000000408000, - 0x0000000000410000, 0x0000000002020000, 0x0000000000040010, 0x0000000000080010, - 0x0000000000100010, 0x0000000000200010, 0x0000000001c1c001, 0x0000000000c00000, - 0x0000000001400000, 0x000000001e020001, 0x0000000006000000, 0x000000000a000000, - 0x0000000012000000, 0x00000000200006a2, 0x0000000040002848, 0x0000000080000010, - // Entry 20 - 3F - 0x0000000100000001, 0x0000000000000001, 0x0000000080000000, 0x0000000000020000, - 0x0000000001000000, 0x0000000000008000, 0x0000000000002000, 0x0000000000000200, - 0x0000000000000008, 0x0000000000200000, 0x0000000110000000, 0x0000000000040000, - 0x0000000008000000, 0x0000000000000020, 0x0000000104000000, 0x0000000000000080, - 0x0000000000001000, 0x0000000000010000, 0x0000000000000400, 0x0000000004000000, - 0x0000000000000040, 0x0000000010000000, 0x0000000000004000, 0x0000000101000000, - 0x0000000108000000, 0x0000000000000100, 0x0000000100020000, 0x0000000000080000, - 0x0000000000100000, 0x0000000000800000, 0x00000001ffffffff, 0x0000000122400fb3, - // Entry 40 - 5F - 0x00000001827c0813, 0x000000014240385f, 0x0000000103c1c813, 0x000000011e420813, - 0x0000000112000001, 0x0000000106000001, 0x0000000101400001, 0x000000010a000001, - 0x0000000102020001, -} - -// regionInclusionNext marks, for each entry in regionInclusionBits, the set of -// all groups that are reachable from the groups set in the respective entry. -// Size: 73 bytes, 73 elements -var regionInclusionNext = [73]uint8{ - // Entry 0 - 3F - 0x3e, 0x3f, 0x0b, 0x0b, 0x40, 0x01, 0x0b, 0x01, - 0x01, 0x01, 0x01, 0x41, 0x0b, 0x0b, 0x16, 0x16, - 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x42, 0x16, - 0x16, 0x43, 0x19, 0x19, 0x19, 0x01, 0x0b, 0x04, - 0x00, 0x00, 0x1f, 0x11, 0x18, 0x0f, 0x0d, 0x09, - 0x03, 0x15, 0x44, 0x12, 0x1b, 0x05, 0x45, 0x07, - 0x0c, 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x46, - 0x47, 0x08, 0x48, 0x13, 0x14, 0x17, 0x3e, 0x3e, - // Entry 40 - 7F - 0x3e, 0x3e, 0x3e, 0x3e, 0x43, 0x43, 0x42, 0x43, - 0x43, -} - -type parentRel struct { - lang uint16 - script uint8 - maxScript uint8 - toRegion uint16 - fromRegion []uint16 -} - -// Size: 414 bytes, 5 elements -var parents = [5]parentRel{ - 0: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x25, 0x26, 0x2f, 0x34, 0x36, 0x3d, 0x42, 0x46, 0x48, 0x49, 0x4a, 0x50, 0x52, 0x5c, 0x5d, 0x61, 0x64, 0x6d, 0x73, 0x74, 0x75, 0x7b, 0x7c, 0x7f, 0x80, 0x81, 0x83, 0x8c, 0x8d, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9f, 0xa0, 0xa4, 0xa7, 0xa9, 0xad, 0xb1, 0xb4, 0xb5, 0xbf, 0xc6, 0xca, 0xcb, 0xcc, 0xce, 0xd0, 0xd2, 0xd5, 0xd6, 0xdd, 0xdf, 0xe0, 0xe6, 0xe7, 0xe8, 0xeb, 0xf0, 0x107, 0x109, 0x10a, 0x10b, 0x10d, 0x10e, 0x112, 0x117, 0x11b, 0x11d, 0x11f, 0x125, 0x129, 0x12c, 0x12d, 0x12f, 0x131, 0x139, 0x13c, 0x13f, 0x142, 0x161, 0x162, 0x164}}, - 1: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1a, fromRegion: []uint16{0x2e, 0x4e, 0x60, 0x63, 0x72, 0xd9, 0x10c, 0x10f}}, - 2: {lang: 0x13e, script: 0x0, maxScript: 0x57, toRegion: 0x1f, fromRegion: []uint16{0x2c, 0x3f, 0x41, 0x48, 0x51, 0x54, 0x56, 0x59, 0x65, 0x69, 0x89, 0x8f, 0xcf, 0xd8, 0xe2, 0xe4, 0xec, 0xf1, 0x11a, 0x135, 0x136, 0x13b}}, - 3: {lang: 0x3c0, script: 0x0, maxScript: 0x57, toRegion: 0xee, fromRegion: []uint16{0x2a, 0x4e, 0x5a, 0x86, 0x8b, 0xb7, 0xc6, 0xd1, 0x118, 0x126}}, - 4: {lang: 0x529, script: 0x39, maxScript: 0x39, toRegion: 0x8d, fromRegion: []uint16{0xc6}}, -} - -// Total table size 25886 bytes (25KiB); checksum: 50D3D57D diff --git a/vendor/golang.org/x/text/internal/language/tags.go b/vendor/golang.org/x/text/internal/language/tags.go deleted file mode 100644 index e7afd318..00000000 --- a/vendor/golang.org/x/text/internal/language/tags.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package language - -// MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. -// It simplifies safe initialization of Tag values. -func MustParse(s string) Tag { - t, err := Parse(s) - if err != nil { - panic(err) - } - return t -} - -// MustParseBase is like ParseBase, but panics if the given base cannot be parsed. -// It simplifies safe initialization of Base values. -func MustParseBase(s string) Language { - b, err := ParseBase(s) - if err != nil { - panic(err) - } - return b -} - -// MustParseScript is like ParseScript, but panics if the given script cannot be -// parsed. It simplifies safe initialization of Script values. -func MustParseScript(s string) Script { - scr, err := ParseScript(s) - if err != nil { - panic(err) - } - return scr -} - -// MustParseRegion is like ParseRegion, but panics if the given region cannot be -// parsed. It simplifies safe initialization of Region values. -func MustParseRegion(s string) Region { - r, err := ParseRegion(s) - if err != nil { - panic(err) - } - return r -} - -// Und is the root language. -var Und Tag diff --git a/vendor/golang.org/x/text/internal/triegen/triegen.go b/vendor/golang.org/x/text/internal/triegen/triegen.go index 51d218a3..adb01081 100644 --- a/vendor/golang.org/x/text/internal/triegen/triegen.go +++ b/vendor/golang.org/x/text/internal/triegen/triegen.go @@ -53,7 +53,7 @@ // Indexes of starter blocks in case of multiple trie roots. // // It is recommended that users test the generated trie by checking the returned -// value for every rune. Such exhaustive tests are possible as the number of +// value for every rune. Such exhaustive tests are possible as the the number of // runes in Unicode is limited. package triegen // import "golang.org/x/text/internal/triegen" diff --git a/vendor/golang.org/x/text/internal/ucd/ucd.go b/vendor/golang.org/x/text/internal/ucd/ucd.go index 0879bc84..8c45b5f3 100644 --- a/vendor/golang.org/x/text/internal/ucd/ucd.go +++ b/vendor/golang.org/x/text/internal/ucd/ucd.go @@ -3,8 +3,8 @@ // license that can be found in the LICENSE file. // Package ucd provides a parser for Unicode Character Database files, the -// format of which is defined in https://www.unicode.org/reports/tr44/. See -// https://www.unicode.org/Public/UCD/latest/ucd/ for example files. +// format of which is defined in http://www.unicode.org/reports/tr44/. See +// http://www.unicode.org/Public/UCD/latest/ucd/ for example files. // // It currently does not support substitutions of missing fields. package ucd // import "golang.org/x/text/internal/ucd" diff --git a/vendor/golang.org/x/text/language/Makefile b/vendor/golang.org/x/text/language/Makefile new file mode 100644 index 00000000..79f00578 --- /dev/null +++ b/vendor/golang.org/x/text/language/Makefile @@ -0,0 +1,16 @@ +# Copyright 2013 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. + +CLEANFILES+=maketables + +maketables: maketables.go + go build $^ + +tables: maketables + ./maketables > tables.go + gofmt -w -s tables.go + +# Build (but do not run) maketables during testing, +# just to make sure it still compiles. +testshort: maketables diff --git a/vendor/golang.org/x/text/internal/language/common.go b/vendor/golang.org/x/text/language/common.go similarity index 50% rename from vendor/golang.org/x/text/internal/language/common.go rename to vendor/golang.org/x/text/language/common.go index cdfdb749..9d86e185 100644 --- a/vendor/golang.org/x/text/internal/language/common.go +++ b/vendor/golang.org/x/text/language/common.go @@ -4,13 +4,13 @@ package language // This file contains code common to the maketables.go and the package code. -// AliasType is the type of an alias in AliasMap. -type AliasType int8 +// langAliasType is the type of an alias in langAliasMap. +type langAliasType int8 const ( - Deprecated AliasType = iota - Macro - Legacy + langDeprecated langAliasType = iota + langMacro + langLegacy - AliasTypeUnknown AliasType = -1 + langAliasTypeUnknown langAliasType = -1 ) diff --git a/vendor/golang.org/x/text/language/coverage.go b/vendor/golang.org/x/text/language/coverage.go index a24fd1a4..101fd23c 100644 --- a/vendor/golang.org/x/text/language/coverage.go +++ b/vendor/golang.org/x/text/language/coverage.go @@ -7,8 +7,6 @@ package language import ( "fmt" "sort" - - "golang.org/x/text/internal/language" ) // The Coverage interface is used to define the level of coverage of an @@ -46,9 +44,9 @@ type allSubtags struct{} // consecutive range, it simply returns a slice of numbers in increasing order. // The "undefined" region is not returned. func (s allSubtags) Regions() []Region { - reg := make([]Region, language.NumRegions) + reg := make([]Region, numRegions) for i := range reg { - reg[i] = Region{language.Region(i + 1)} + reg[i] = Region{regionID(i + 1)} } return reg } @@ -57,9 +55,9 @@ func (s allSubtags) Regions() []Region { // consecutive range, it simply returns a slice of numbers in increasing order. // The "undefined" script is not returned. func (s allSubtags) Scripts() []Script { - scr := make([]Script, language.NumScripts) + scr := make([]Script, numScripts) for i := range scr { - scr[i] = Script{language.Script(i + 1)} + scr[i] = Script{scriptID(i + 1)} } return scr } @@ -67,10 +65,22 @@ func (s allSubtags) Scripts() []Script { // BaseLanguages returns the list of all supported base languages. It generates // the list by traversing the internal structures. func (s allSubtags) BaseLanguages() []Base { - bs := language.BaseLanguages() - base := make([]Base, len(bs)) - for i, b := range bs { - base[i] = Base{b} + base := make([]Base, 0, numLanguages) + for i := 0; i < langNoIndexOffset; i++ { + // We included "und" already for the value 0. + if i != nonCanonicalUnd { + base = append(base, Base{langID(i)}) + } + } + i := langNoIndexOffset + for _, v := range langNoIndex { + for k := 0; k < 8; k++ { + if v&1 == 1 { + base = append(base, Base{langID(i)}) + } + v >>= 1 + i++ + } } return base } @@ -80,7 +90,7 @@ func (s allSubtags) Tags() []Tag { return nil } -// coverage is used by NewCoverage which is used as a convenient way for +// coverage is used used by NewCoverage which is used as a convenient way for // creating Coverage implementations for partially defined data. Very often a // package will only need to define a subset of slices. coverage provides a // convenient way to do this. Moreover, packages using NewCoverage, instead of @@ -124,7 +134,7 @@ func (s *coverage) BaseLanguages() []Base { } a := make([]Base, len(tags)) for i, t := range tags { - a[i] = Base{language.Language(t.lang())} + a[i] = Base{langID(t.lang)} } sort.Sort(bases(a)) k := 0 diff --git a/vendor/golang.org/x/text/language/gen.go b/vendor/golang.org/x/text/language/gen.go index 3004eb42..302f1940 100644 --- a/vendor/golang.org/x/text/language/gen.go +++ b/vendor/golang.org/x/text/language/gen.go @@ -10,16 +10,21 @@ package main import ( + "bufio" "flag" "fmt" "io" + "io/ioutil" "log" + "math" + "reflect" + "regexp" "sort" "strconv" "strings" "golang.org/x/text/internal/gen" - "golang.org/x/text/internal/language" + "golang.org/x/text/internal/tag" "golang.org/x/text/unicode/cldr" ) @@ -32,17 +37,272 @@ var ( "output file for generated tables") ) -func main() { - gen.Init() +var comment = []string{ + ` +lang holds an alphabetically sorted list of ISO-639 language identifiers. +All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. +For 2-byte language identifiers, the two successive bytes have the following meaning: + - if the first letter of the 2- and 3-letter ISO codes are the same: + the second and third letter of the 3-letter ISO code. + - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. +For 3-byte language identifiers the 4th byte is 0.`, + ` +langNoIndex is a bit vector of all 3-letter language codes that are not used as an index +in lookup tables. The language ids for these language codes are derived directly +from the letters and are not consecutive.`, + ` +altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives +to 2-letter language codes that cannot be derived using the method described above. +Each 3-letter code is followed by its 1-byte langID.`, + ` +altLangIndex is used to convert indexes in altLangISO3 to langIDs.`, + ` +langAliasMap maps langIDs to their suggested replacements.`, + ` +script is an alphabetically sorted list of ISO 15924 codes. The index +of the script in the string, divided by 4, is the internal scriptID.`, + ` +isoRegionOffset needs to be added to the index of regionISO to obtain the regionID +for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for +the UN.M49 codes used for groups.)`, + ` +regionISO holds a list of alphabetically sorted 2-letter ISO region codes. +Each 2-letter codes is followed by two bytes with the following meaning: + - [A-Z}{2}: the first letter of the 2-letter code plus these two + letters form the 3-letter ISO code. + - 0, n: index into altRegionISO3.`, + ` +regionTypes defines the status of a region for various standards.`, + ` +m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are +codes indicating collections of regions.`, + ` +m49Index gives indexes into fromM49 based on the three most significant bits +of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in + fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] +for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. +The region code is stored in the 9 lsb of the indexed value.`, + ` +fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details.`, + ` +altRegionISO3 holds a list of 3-letter region codes that cannot be +mapped to 2-letter codes using the default algorithm. This is a short list.`, + ` +altRegionIDs holds a list of regionIDs the positions of which match those +of the 3-letter ISO codes in altRegionISO3.`, + ` +variantNumSpecialized is the number of specialized variants in variants.`, + ` +suppressScript is an index from langID to the dominant script for that language, +if it exists. If a script is given, it should be suppressed from the language tag.`, + ` +likelyLang is a lookup table, indexed by langID, for the most likely +scripts and regions given incomplete information. If more entries exist for a +given language, region and script are the index and size respectively +of the list in likelyLangList.`, + ` +likelyLangList holds lists info associated with likelyLang.`, + ` +likelyRegion is a lookup table, indexed by regionID, for the most likely +languages and scripts given incomplete information. If more entries exist +for a given regionID, lang and script are the index and size respectively +of the list in likelyRegionList. +TODO: exclude containers and user-definable regions from the list.`, + ` +likelyRegionList holds lists info associated with likelyRegion.`, + ` +likelyScript is a lookup table, indexed by scriptID, for the most likely +languages and regions given a script.`, + ` +matchLang holds pairs of langIDs of base languages that are typically +mutually intelligible. Each pair is associated with a confidence and +whether the intelligibility goes one or both ways.`, + ` +matchScript holds pairs of scriptIDs where readers of one script +can typically also read the other. Each is associated with a confidence.`, + ` +nRegionGroups is the number of region groups.`, + ` +regionInclusion maps region identifiers to sets of regions in regionInclusionBits, +where each set holds all groupings that are directly connected in a region +containment graph.`, + ` +regionInclusionBits is an array of bit vectors where every vector represents +a set of region groupings. These sets are used to compute the distance +between two regions for the purpose of language matching.`, + ` +regionInclusionNext marks, for each entry in regionInclusionBits, the set of +all groups that are reachable from the groups set in the respective entry.`, +} - w := gen.NewCodeWriter() - defer w.WriteGoFile("tables.go", "language") +// TODO: consider changing some of these structures to tries. This can reduce +// memory, but may increase the need for memory allocations. This could be +// mitigated if we can piggyback on language tags for common cases. - b := newBuilder(w) - gen.WriteCLDRVersion(w) +func failOnError(e error) { + if e != nil { + log.Panic(e) + } +} - b.writeConstants() - b.writeMatchData() +type setType int + +const ( + Indexed setType = 1 + iota // all elements must be of same size + Linear +) + +type stringSet struct { + s []string + sorted, frozen bool + + // We often need to update values after the creation of an index is completed. + // We include a convenience map for keeping track of this. + update map[string]string + typ setType // used for checking. +} + +func (ss *stringSet) clone() stringSet { + c := *ss + c.s = append([]string(nil), c.s...) + return c +} + +func (ss *stringSet) setType(t setType) { + if ss.typ != t && ss.typ != 0 { + log.Panicf("type %d cannot be assigned as it was already %d", t, ss.typ) + } +} + +// parse parses a whitespace-separated string and initializes ss with its +// components. +func (ss *stringSet) parse(s string) { + scan := bufio.NewScanner(strings.NewReader(s)) + scan.Split(bufio.ScanWords) + for scan.Scan() { + ss.add(scan.Text()) + } +} + +func (ss *stringSet) assertChangeable() { + if ss.frozen { + log.Panic("attempt to modify a frozen stringSet") + } +} + +func (ss *stringSet) add(s string) { + ss.assertChangeable() + ss.s = append(ss.s, s) + ss.sorted = ss.frozen +} + +func (ss *stringSet) freeze() { + ss.compact() + ss.frozen = true +} + +func (ss *stringSet) compact() { + if ss.sorted { + return + } + a := ss.s + sort.Strings(a) + k := 0 + for i := 1; i < len(a); i++ { + if a[k] != a[i] { + a[k+1] = a[i] + k++ + } + } + ss.s = a[:k+1] + ss.sorted = ss.frozen +} + +type funcSorter struct { + fn func(a, b string) bool + sort.StringSlice +} + +func (s funcSorter) Less(i, j int) bool { + return s.fn(s.StringSlice[i], s.StringSlice[j]) +} + +func (ss *stringSet) sortFunc(f func(a, b string) bool) { + ss.compact() + sort.Sort(funcSorter{f, sort.StringSlice(ss.s)}) +} + +func (ss *stringSet) remove(s string) { + ss.assertChangeable() + if i, ok := ss.find(s); ok { + copy(ss.s[i:], ss.s[i+1:]) + ss.s = ss.s[:len(ss.s)-1] + } +} + +func (ss *stringSet) replace(ol, nu string) { + ss.s[ss.index(ol)] = nu + ss.sorted = ss.frozen +} + +func (ss *stringSet) index(s string) int { + ss.setType(Indexed) + i, ok := ss.find(s) + if !ok { + if i < len(ss.s) { + log.Panicf("find: item %q is not in list. Closest match is %q.", s, ss.s[i]) + } + log.Panicf("find: item %q is not in list", s) + + } + return i +} + +func (ss *stringSet) find(s string) (int, bool) { + ss.compact() + i := sort.SearchStrings(ss.s, s) + return i, i != len(ss.s) && ss.s[i] == s +} + +func (ss *stringSet) slice() []string { + ss.compact() + return ss.s +} + +func (ss *stringSet) updateLater(v, key string) { + if ss.update == nil { + ss.update = map[string]string{} + } + ss.update[v] = key +} + +// join joins the string and ensures that all entries are of the same length. +func (ss *stringSet) join() string { + ss.setType(Indexed) + n := len(ss.s[0]) + for _, s := range ss.s { + if len(s) != n { + log.Panicf("join: not all entries are of the same length: %q", s) + } + } + ss.s = append(ss.s, strings.Repeat("\xff", n)) + return strings.Join(ss.s, "") +} + +// ianaEntry holds information for an entry in the IANA Language Subtag Repository. +// All types use the same entry. +// See http://tools.ietf.org/html/bcp47#section-5.1 for a description of the various +// fields. +type ianaEntry struct { + typ string + description []string + scope string + added string + preferred string + deprecated string + suppressScript string + macro string + prefix []string } type builder struct { @@ -50,51 +310,546 @@ type builder struct { hw io.Writer // MultiWriter for w and w.Hash data *cldr.CLDR supp *cldr.SupplementalData + + // indices + locale stringSet // common locales + lang stringSet // canonical language ids (2 or 3 letter ISO codes) with data + langNoIndex stringSet // 3-letter ISO codes with no associated data + script stringSet // 4-letter ISO codes + region stringSet // 2-letter ISO or 3-digit UN M49 codes + variant stringSet // 4-8-alphanumeric variant code. + + // Region codes that are groups with their corresponding group IDs. + groups map[int]index + + // langInfo + registry map[string]*ianaEntry } -func (b *builder) langIndex(s string) uint16 { - return uint16(language.MustParseBase(s)) -} - -func (b *builder) regionIndex(s string) int { - return int(language.MustParseRegion(s)) -} - -func (b *builder) scriptIndex(s string) int { - return int(language.MustParseScript(s)) -} +type index uint func newBuilder(w *gen.CodeWriter) *builder { r := gen.OpenCLDRCoreZip() defer r.Close() d := &cldr.Decoder{} data, err := d.DecodeZip(r) - if err != nil { - log.Fatal(err) - } + failOnError(err) b := builder{ w: w, hw: io.MultiWriter(w, w.Hash), data: data, supp: data.Supplemental(), } + b.parseRegistry() return &b } +func (b *builder) parseRegistry() { + r := gen.OpenIANAFile("assignments/language-subtag-registry") + defer r.Close() + b.registry = make(map[string]*ianaEntry) + + scan := bufio.NewScanner(r) + scan.Split(bufio.ScanWords) + var record *ianaEntry + for more := scan.Scan(); more; { + key := scan.Text() + more = scan.Scan() + value := scan.Text() + switch key { + case "Type:": + record = &ianaEntry{typ: value} + case "Subtag:", "Tag:": + if s := strings.SplitN(value, "..", 2); len(s) > 1 { + for a := s[0]; a <= s[1]; a = inc(a) { + b.addToRegistry(a, record) + } + } else { + b.addToRegistry(value, record) + } + case "Suppress-Script:": + record.suppressScript = value + case "Added:": + record.added = value + case "Deprecated:": + record.deprecated = value + case "Macrolanguage:": + record.macro = value + case "Preferred-Value:": + record.preferred = value + case "Prefix:": + record.prefix = append(record.prefix, value) + case "Scope:": + record.scope = value + case "Description:": + buf := []byte(value) + for more = scan.Scan(); more; more = scan.Scan() { + b := scan.Bytes() + if b[0] == '%' || b[len(b)-1] == ':' { + break + } + buf = append(buf, ' ') + buf = append(buf, b...) + } + record.description = append(record.description, string(buf)) + continue + default: + continue + } + more = scan.Scan() + } + if scan.Err() != nil { + log.Panic(scan.Err()) + } +} + +func (b *builder) addToRegistry(key string, entry *ianaEntry) { + if info, ok := b.registry[key]; ok { + if info.typ != "language" || entry.typ != "extlang" { + log.Fatalf("parseRegistry: tag %q already exists", key) + } + } else { + b.registry[key] = entry + } +} + +var commentIndex = make(map[string]string) + +func init() { + for _, s := range comment { + key := strings.TrimSpace(strings.SplitN(s, " ", 2)[0]) + commentIndex[key] = s + } +} + +func (b *builder) comment(name string) { + if s := commentIndex[name]; len(s) > 0 { + b.w.WriteComment(s) + } else { + fmt.Fprintln(b.w) + } +} + +func (b *builder) pf(f string, x ...interface{}) { + fmt.Fprintf(b.hw, f, x...) + fmt.Fprint(b.hw, "\n") +} + +func (b *builder) p(x ...interface{}) { + fmt.Fprintln(b.hw, x...) +} + +func (b *builder) addSize(s int) { + b.w.Size += s + b.pf("// Size: %d bytes", s) +} + +func (b *builder) writeConst(name string, x interface{}) { + b.comment(name) + b.w.WriteConst(name, x) +} + // writeConsts computes f(v) for all v in values and writes the results // as constants named _v to a single constant block. func (b *builder) writeConsts(f func(string) int, values ...string) { - fmt.Fprintln(b.w, "const (") + b.pf("const (") for _, v := range values { - fmt.Fprintf(b.w, "\t_%s = %v\n", v, f(v)) + b.pf("\t_%s = %v", v, f(v)) } - fmt.Fprintln(b.w, ")") + b.pf(")") +} + +// writeType writes the type of the given value, which must be a struct. +func (b *builder) writeType(value interface{}) { + b.comment(reflect.TypeOf(value).Name()) + b.w.WriteType(value) +} + +func (b *builder) writeSlice(name string, ss interface{}) { + b.writeSliceAddSize(name, 0, ss) +} + +func (b *builder) writeSliceAddSize(name string, extraSize int, ss interface{}) { + b.comment(name) + b.w.Size += extraSize + v := reflect.ValueOf(ss) + t := v.Type().Elem() + b.pf("// Size: %d bytes, %d elements", v.Len()*int(t.Size())+extraSize, v.Len()) + + fmt.Fprintf(b.w, "var %s = ", name) + b.w.WriteArray(ss) + b.p() +} + +type fromTo struct { + from, to uint16 +} + +func (b *builder) writeSortedMap(name string, ss *stringSet, index func(s string) uint16) { + ss.sortFunc(func(a, b string) bool { + return index(a) < index(b) + }) + m := []fromTo{} + for _, s := range ss.s { + m = append(m, fromTo{index(s), index(ss.update[s])}) + } + b.writeSlice(name, m) +} + +const base = 'z' - 'a' + 1 + +func strToInt(s string) uint { + v := uint(0) + for i := 0; i < len(s); i++ { + v *= base + v += uint(s[i] - 'a') + } + return v +} + +// converts the given integer to the original ASCII string passed to strToInt. +// len(s) must match the number of characters obtained. +func intToStr(v uint, s []byte) { + for i := len(s) - 1; i >= 0; i-- { + s[i] = byte(v%base) + 'a' + v /= base + } +} + +func (b *builder) writeBitVector(name string, ss []string) { + vec := make([]uint8, int(math.Ceil(math.Pow(base, float64(len(ss[0])))/8))) + for _, s := range ss { + v := strToInt(s) + vec[v/8] |= 1 << (v % 8) + } + b.writeSlice(name, vec) +} + +// TODO: convert this type into a list or two-stage trie. +func (b *builder) writeMapFunc(name string, m map[string]string, f func(string) uint16) { + b.comment(name) + v := reflect.ValueOf(m) + sz := v.Len() * (2 + int(v.Type().Key().Size())) + for _, k := range m { + sz += len(k) + } + b.addSize(sz) + keys := []string{} + b.pf(`var %s = map[string]uint16{`, name) + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + b.pf("\t%q: %v,", k, f(m[k])) + } + b.p("}") +} + +func (b *builder) writeMap(name string, m interface{}) { + b.comment(name) + v := reflect.ValueOf(m) + sz := v.Len() * (2 + int(v.Type().Key().Size()) + int(v.Type().Elem().Size())) + b.addSize(sz) + f := strings.FieldsFunc(fmt.Sprintf("%#v", m), func(r rune) bool { + return strings.IndexRune("{}, ", r) != -1 + }) + sort.Strings(f[1:]) + b.pf(`var %s = %s{`, name, f[0]) + for _, kv := range f[1:] { + b.pf("\t%s,", kv) + } + b.p("}") +} + +func (b *builder) langIndex(s string) uint16 { + if s == "und" { + return 0 + } + if i, ok := b.lang.find(s); ok { + return uint16(i) + } + return uint16(strToInt(s)) + uint16(len(b.lang.s)) +} + +// inc advances the string to its lexicographical successor. +func inc(s string) string { + const maxTagLength = 4 + var buf [maxTagLength]byte + intToStr(strToInt(strings.ToLower(s))+1, buf[:len(s)]) + for i := 0; i < len(s); i++ { + if s[i] <= 'Z' { + buf[i] -= 'a' - 'A' + } + } + return string(buf[:len(s)]) +} + +func (b *builder) parseIndices() { + meta := b.supp.Metadata + + for k, v := range b.registry { + var ss *stringSet + switch v.typ { + case "language": + if len(k) == 2 || v.suppressScript != "" || v.scope == "special" { + b.lang.add(k) + continue + } else { + ss = &b.langNoIndex + } + case "region": + ss = &b.region + case "script": + ss = &b.script + case "variant": + ss = &b.variant + default: + continue + } + ss.add(k) + } + // Include any language for which there is data. + for _, lang := range b.data.Locales() { + if x := b.data.RawLDML(lang); false || + x.LocaleDisplayNames != nil || + x.Characters != nil || + x.Delimiters != nil || + x.Measurement != nil || + x.Dates != nil || + x.Numbers != nil || + x.Units != nil || + x.ListPatterns != nil || + x.Collations != nil || + x.Segmentations != nil || + x.Rbnf != nil || + x.Annotations != nil || + x.Metadata != nil { + + from := strings.Split(lang, "_") + if lang := from[0]; lang != "root" { + b.lang.add(lang) + } + } + } + // Include locales for plural rules, which uses a different structure. + for _, plurals := range b.data.Supplemental().Plurals { + for _, rules := range plurals.PluralRules { + for _, lang := range strings.Split(rules.Locales, " ") { + if lang = strings.Split(lang, "_")[0]; lang != "root" { + b.lang.add(lang) + } + } + } + } + // Include languages in likely subtags. + for _, m := range b.supp.LikelySubtags.LikelySubtag { + from := strings.Split(m.From, "_") + b.lang.add(from[0]) + } + // Include ISO-639 alpha-3 bibliographic entries. + for _, a := range meta.Alias.LanguageAlias { + if a.Reason == "bibliographic" { + b.langNoIndex.add(a.Type) + } + } + // Include regions in territoryAlias (not all are in the IANA registry!) + for _, reg := range b.supp.Metadata.Alias.TerritoryAlias { + if len(reg.Type) == 2 { + b.region.add(reg.Type) + } + } + + for _, s := range b.lang.s { + if len(s) == 3 { + b.langNoIndex.remove(s) + } + } + b.writeConst("numLanguages", len(b.lang.slice())+len(b.langNoIndex.slice())) + b.writeConst("numScripts", len(b.script.slice())) + b.writeConst("numRegions", len(b.region.slice())) + + // Add dummy codes at the start of each list to represent "unspecified". + b.lang.add("---") + b.script.add("----") + b.region.add("---") + + // common locales + b.locale.parse(meta.DefaultContent.Locales) } // TODO: region inclusion data will probably not be use used in future matchers. +func (b *builder) computeRegionGroups() { + b.groups = make(map[int]index) + + // Create group indices. + for i := 1; b.region.s[i][0] < 'A'; i++ { // Base M49 indices on regionID. + b.groups[i] = index(len(b.groups)) + } + for _, g := range b.supp.TerritoryContainment.Group { + // Skip UN and EURO zone as they are flattening the containment + // relationship. + if g.Type == "EZ" || g.Type == "UN" { + continue + } + group := b.region.index(g.Type) + if _, ok := b.groups[group]; !ok { + b.groups[group] = index(len(b.groups)) + } + } + if len(b.groups) > 64 { + log.Fatalf("only 64 groups supported, found %d", len(b.groups)) + } + b.writeConst("nRegionGroups", len(b.groups)) +} + var langConsts = []string{ - "de", "en", "fr", "it", "mo", "no", "nb", "pt", "sh", "mul", "und", + "af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es", + "et", "fa", "fi", "fil", "fr", "gu", "he", "hi", "hr", "hu", "hy", "id", "is", + "it", "ja", "ka", "kk", "km", "kn", "ko", "ky", "lo", "lt", "lv", "mk", "ml", + "mn", "mo", "mr", "ms", "mul", "my", "nb", "ne", "nl", "no", "pa", "pl", "pt", + "ro", "ru", "sh", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", + "tl", "tn", "tr", "uk", "ur", "uz", "vi", "zh", "zu", + + // constants for grandfathered tags (if not already defined) + "jbo", "ami", "bnn", "hak", "tlh", "lb", "nv", "pwn", "tao", "tay", "tsu", + "nn", "sfb", "vgt", "sgg", "cmn", "nan", "hsn", +} + +// writeLanguage generates all tables needed for language canonicalization. +func (b *builder) writeLanguage() { + meta := b.supp.Metadata + + b.writeConst("nonCanonicalUnd", b.lang.index("und")) + b.writeConsts(func(s string) int { return int(b.langIndex(s)) }, langConsts...) + b.writeConst("langPrivateStart", b.langIndex("qaa")) + b.writeConst("langPrivateEnd", b.langIndex("qtz")) + + // Get language codes that need to be mapped (overlong 3-letter codes, + // deprecated 2-letter codes, legacy and grandfathered tags.) + langAliasMap := stringSet{} + aliasTypeMap := map[string]langAliasType{} + + // altLangISO3 get the alternative ISO3 names that need to be mapped. + altLangISO3 := stringSet{} + // Add dummy start to avoid the use of index 0. + altLangISO3.add("---") + altLangISO3.updateLater("---", "aa") + + lang := b.lang.clone() + for _, a := range meta.Alias.LanguageAlias { + if a.Replacement == "" { + a.Replacement = "und" + } + // TODO: support mapping to tags + repl := strings.SplitN(a.Replacement, "_", 2)[0] + if a.Reason == "overlong" { + if len(a.Replacement) == 2 && len(a.Type) == 3 { + lang.updateLater(a.Replacement, a.Type) + } + } else if len(a.Type) <= 3 { + switch a.Reason { + case "macrolanguage": + aliasTypeMap[a.Type] = langMacro + case "deprecated": + // handled elsewhere + continue + case "bibliographic", "legacy": + if a.Type == "no" { + continue + } + aliasTypeMap[a.Type] = langLegacy + default: + log.Fatalf("new %s alias: %s", a.Reason, a.Type) + } + langAliasMap.add(a.Type) + langAliasMap.updateLater(a.Type, repl) + } + } + // Manually add the mapping of "nb" (Norwegian) to its macro language. + // This can be removed if CLDR adopts this change. + langAliasMap.add("nb") + langAliasMap.updateLater("nb", "no") + aliasTypeMap["nb"] = langMacro + + for k, v := range b.registry { + // Also add deprecated values for 3-letter ISO codes, which CLDR omits. + if v.typ == "language" && v.deprecated != "" && v.preferred != "" { + langAliasMap.add(k) + langAliasMap.updateLater(k, v.preferred) + aliasTypeMap[k] = langDeprecated + } + } + // Fix CLDR mappings. + lang.updateLater("tl", "tgl") + lang.updateLater("sh", "hbs") + lang.updateLater("mo", "mol") + lang.updateLater("no", "nor") + lang.updateLater("tw", "twi") + lang.updateLater("nb", "nob") + lang.updateLater("ak", "aka") + lang.updateLater("bh", "bih") + + // Ensure that each 2-letter code is matched with a 3-letter code. + for _, v := range lang.s[1:] { + s, ok := lang.update[v] + if !ok { + if s, ok = lang.update[langAliasMap.update[v]]; !ok { + continue + } + lang.update[v] = s + } + if v[0] != s[0] { + altLangISO3.add(s) + altLangISO3.updateLater(s, v) + } + } + + // Complete canonicalized language tags. + lang.freeze() + for i, v := range lang.s { + // We can avoid these manual entries by using the IANA registry directly. + // Seems easier to update the list manually, as changes are rare. + // The panic in this loop will trigger if we miss an entry. + add := "" + if s, ok := lang.update[v]; ok { + if s[0] == v[0] { + add = s[1:] + } else { + add = string([]byte{0, byte(altLangISO3.index(s))}) + } + } else if len(v) == 3 { + add = "\x00" + } else { + log.Panicf("no data for long form of %q", v) + } + lang.s[i] += add + } + b.writeConst("lang", tag.Index(lang.join())) + + b.writeConst("langNoIndexOffset", len(b.lang.s)) + + // space of all valid 3-letter language identifiers. + b.writeBitVector("langNoIndex", b.langNoIndex.slice()) + + altLangIndex := []uint16{} + for i, s := range altLangISO3.slice() { + altLangISO3.s[i] += string([]byte{byte(len(altLangIndex))}) + if i > 0 { + idx := b.lang.index(altLangISO3.update[s]) + altLangIndex = append(altLangIndex, uint16(idx)) + } + } + b.writeConst("altLangISO3", tag.Index(altLangISO3.join())) + b.writeSlice("altLangIndex", altLangIndex) + + b.writeSortedMap("langAliasMap", &langAliasMap, b.langIndex) + types := make([]langAliasType, len(langAliasMap.s)) + for i, s := range langAliasMap.s { + types[i] = aliasTypeMap[s] + } + b.writeSlice("langAliasTypes", types) } var scriptConsts = []string{ @@ -102,15 +857,508 @@ var scriptConsts = []string{ "Zzzz", } +func (b *builder) writeScript() { + b.writeConsts(b.script.index, scriptConsts...) + b.writeConst("script", tag.Index(b.script.join())) + + supp := make([]uint8, len(b.lang.slice())) + for i, v := range b.lang.slice()[1:] { + if sc := b.registry[v].suppressScript; sc != "" { + supp[i+1] = uint8(b.script.index(sc)) + } + } + b.writeSlice("suppressScript", supp) + + // There is only one deprecated script in CLDR. This value is hard-coded. + // We check here if the code must be updated. + for _, a := range b.supp.Metadata.Alias.ScriptAlias { + if a.Type != "Qaai" { + log.Panicf("unexpected deprecated stript %q", a.Type) + } + } +} + +func parseM49(s string) int16 { + if len(s) == 0 { + return 0 + } + v, err := strconv.ParseUint(s, 10, 10) + failOnError(err) + return int16(v) +} + var regionConsts = []string{ "001", "419", "BR", "CA", "ES", "GB", "MD", "PT", "UK", "US", "ZZ", "XA", "XC", "XK", // Unofficial tag for Kosovo. } -func (b *builder) writeConstants() { - b.writeConsts(func(s string) int { return int(b.langIndex(s)) }, langConsts...) - b.writeConsts(b.regionIndex, regionConsts...) - b.writeConsts(b.scriptIndex, scriptConsts...) +func (b *builder) writeRegion() { + b.writeConsts(b.region.index, regionConsts...) + + isoOffset := b.region.index("AA") + m49map := make([]int16, len(b.region.slice())) + fromM49map := make(map[int16]int) + altRegionISO3 := "" + altRegionIDs := []uint16{} + + b.writeConst("isoRegionOffset", isoOffset) + + // 2-letter region lookup and mapping to numeric codes. + regionISO := b.region.clone() + regionISO.s = regionISO.s[isoOffset:] + regionISO.sorted = false + + regionTypes := make([]byte, len(b.region.s)) + + // Is the region valid BCP 47? + for s, e := range b.registry { + if len(s) == 2 && s == strings.ToUpper(s) { + i := b.region.index(s) + for _, d := range e.description { + if strings.Contains(d, "Private use") { + regionTypes[i] = iso3166UserAssigned + } + } + regionTypes[i] |= bcp47Region + } + } + + // Is the region a valid ccTLD? + r := gen.OpenIANAFile("domains/root/db") + defer r.Close() + + buf, err := ioutil.ReadAll(r) + failOnError(err) + re := regexp.MustCompile(`"/domains/root/db/([a-z]{2}).html"`) + for _, m := range re.FindAllSubmatch(buf, -1) { + i := b.region.index(strings.ToUpper(string(m[1]))) + regionTypes[i] |= ccTLD + } + + b.writeSlice("regionTypes", regionTypes) + + iso3Set := make(map[string]int) + update := func(iso2, iso3 string) { + i := regionISO.index(iso2) + if j, ok := iso3Set[iso3]; !ok && iso3[0] == iso2[0] { + regionISO.s[i] += iso3[1:] + iso3Set[iso3] = -1 + } else { + if ok && j >= 0 { + regionISO.s[i] += string([]byte{0, byte(j)}) + } else { + iso3Set[iso3] = len(altRegionISO3) + regionISO.s[i] += string([]byte{0, byte(len(altRegionISO3))}) + altRegionISO3 += iso3 + altRegionIDs = append(altRegionIDs, uint16(isoOffset+i)) + } + } + } + for _, tc := range b.supp.CodeMappings.TerritoryCodes { + i := regionISO.index(tc.Type) + isoOffset + if d := m49map[i]; d != 0 { + log.Panicf("%s found as a duplicate UN.M49 code of %03d", tc.Numeric, d) + } + m49 := parseM49(tc.Numeric) + m49map[i] = m49 + if r := fromM49map[m49]; r == 0 { + fromM49map[m49] = i + } else if r != i { + dep := b.registry[regionISO.s[r-isoOffset]].deprecated + if t := b.registry[tc.Type]; t != nil && dep != "" && (t.deprecated == "" || t.deprecated > dep) { + fromM49map[m49] = i + } + } + } + for _, ta := range b.supp.Metadata.Alias.TerritoryAlias { + if len(ta.Type) == 3 && ta.Type[0] <= '9' && len(ta.Replacement) == 2 { + from := parseM49(ta.Type) + if r := fromM49map[from]; r == 0 { + fromM49map[from] = regionISO.index(ta.Replacement) + isoOffset + } + } + } + for _, tc := range b.supp.CodeMappings.TerritoryCodes { + if len(tc.Alpha3) == 3 { + update(tc.Type, tc.Alpha3) + } + } + // This entries are not included in territoryCodes. Mostly 3-letter variants + // of deleted codes and an entry for QU. + for _, m := range []struct{ iso2, iso3 string }{ + {"CT", "CTE"}, + {"DY", "DHY"}, + {"HV", "HVO"}, + {"JT", "JTN"}, + {"MI", "MID"}, + {"NH", "NHB"}, + {"NQ", "ATN"}, + {"PC", "PCI"}, + {"PU", "PUS"}, + {"PZ", "PCZ"}, + {"RH", "RHO"}, + {"VD", "VDR"}, + {"WK", "WAK"}, + // These three-letter codes are used for others as well. + {"FQ", "ATF"}, + } { + update(m.iso2, m.iso3) + } + for i, s := range regionISO.s { + if len(s) != 4 { + regionISO.s[i] = s + " " + } + } + b.writeConst("regionISO", tag.Index(regionISO.join())) + b.writeConst("altRegionISO3", altRegionISO3) + b.writeSlice("altRegionIDs", altRegionIDs) + + // Create list of deprecated regions. + // TODO: consider inserting SF -> FI. Not included by CLDR, but is the only + // Transitionally-reserved mapping not included. + regionOldMap := stringSet{} + // Include regions in territoryAlias (not all are in the IANA registry!) + for _, reg := range b.supp.Metadata.Alias.TerritoryAlias { + if len(reg.Type) == 2 && reg.Reason == "deprecated" && len(reg.Replacement) == 2 { + regionOldMap.add(reg.Type) + regionOldMap.updateLater(reg.Type, reg.Replacement) + i, _ := regionISO.find(reg.Type) + j, _ := regionISO.find(reg.Replacement) + if k := m49map[i+isoOffset]; k == 0 { + m49map[i+isoOffset] = m49map[j+isoOffset] + } + } + } + b.writeSortedMap("regionOldMap", ®ionOldMap, func(s string) uint16 { + return uint16(b.region.index(s)) + }) + // 3-digit region lookup, groupings. + for i := 1; i < isoOffset; i++ { + m := parseM49(b.region.s[i]) + m49map[i] = m + fromM49map[m] = i + } + b.writeSlice("m49", m49map) + + const ( + searchBits = 7 + regionBits = 9 + ) + if len(m49map) >= 1< %d", len(m49map), 1<>searchBits] = int16(len(fromM49)) + } + b.writeSlice("m49Index", m49Index) + b.writeSlice("fromM49", fromM49) +} + +const ( + // TODO: put these lists in regionTypes as user data? Could be used for + // various optimizations and refinements and could be exposed in the API. + iso3166Except = "AC CP DG EA EU FX IC SU TA UK" + iso3166Trans = "AN BU CS NT TP YU ZR" // SF is not in our set of Regions. + // DY and RH are actually not deleted, but indeterminately reserved. + iso3166DelCLDR = "CT DD DY FQ HV JT MI NH NQ PC PU PZ RH VD WK YD" +) + +const ( + iso3166UserAssigned = 1 << iota + ccTLD + bcp47Region +) + +func find(list []string, s string) int { + for i, t := range list { + if t == s { + return i + } + } + return -1 +} + +// writeVariants generates per-variant information and creates a map from variant +// name to index value. We assign index values such that sorting multiple +// variants by index value will result in the correct order. +// There are two types of variants: specialized and general. Specialized variants +// are only applicable to certain language or language-script pairs. Generalized +// variants apply to any language. Generalized variants always sort after +// specialized variants. We will therefore always assign a higher index value +// to a generalized variant than any other variant. Generalized variants are +// sorted alphabetically among themselves. +// Specialized variants may also sort after other specialized variants. Such +// variants will be ordered after any of the variants they may follow. +// We assume that if a variant x is followed by a variant y, then for any prefix +// p of x, p-x is a prefix of y. This allows us to order tags based on the +// maximum of the length of any of its prefixes. +// TODO: it is possible to define a set of Prefix values on variants such that +// a total order cannot be defined to the point that this algorithm breaks. +// In other words, we cannot guarantee the same order of variants for the +// future using the same algorithm or for non-compliant combinations of +// variants. For this reason, consider using simple alphabetic sorting +// of variants and ignore Prefix restrictions altogether. +func (b *builder) writeVariant() { + generalized := stringSet{} + specialized := stringSet{} + specializedExtend := stringSet{} + // Collate the variants by type and check assumptions. + for _, v := range b.variant.slice() { + e := b.registry[v] + if len(e.prefix) == 0 { + generalized.add(v) + continue + } + c := strings.Split(e.prefix[0], "-") + hasScriptOrRegion := false + if len(c) > 1 { + _, hasScriptOrRegion = b.script.find(c[1]) + if !hasScriptOrRegion { + _, hasScriptOrRegion = b.region.find(c[1]) + + } + } + if len(c) == 1 || len(c) == 2 && hasScriptOrRegion { + // Variant is preceded by a language. + specialized.add(v) + continue + } + // Variant is preceded by another variant. + specializedExtend.add(v) + prefix := c[0] + "-" + if hasScriptOrRegion { + prefix += c[1] + } + for _, p := range e.prefix { + // Verify that the prefix minus the last element is a prefix of the + // predecessor element. + i := strings.LastIndex(p, "-") + pred := b.registry[p[i+1:]] + if find(pred.prefix, p[:i]) < 0 { + log.Fatalf("prefix %q for variant %q not consistent with predecessor spec", p, v) + } + // The sorting used below does not work in the general case. It works + // if we assume that variants that may be followed by others only have + // prefixes of the same length. Verify this. + count := strings.Count(p[:i], "-") + for _, q := range pred.prefix { + if c := strings.Count(q, "-"); c != count { + log.Fatalf("variant %q preceding %q has a prefix %q of size %d; want %d", p[i+1:], v, q, c, count) + } + } + if !strings.HasPrefix(p, prefix) { + log.Fatalf("prefix %q of variant %q should start with %q", p, v, prefix) + } + } + } + + // Sort extended variants. + a := specializedExtend.s + less := func(v, w string) bool { + // Sort by the maximum number of elements. + maxCount := func(s string) (max int) { + for _, p := range b.registry[s].prefix { + if c := strings.Count(p, "-"); c > max { + max = c + } + } + return + } + if cv, cw := maxCount(v), maxCount(w); cv != cw { + return cv < cw + } + // Sort by name as tie breaker. + return v < w + } + sort.Sort(funcSorter{less, sort.StringSlice(a)}) + specializedExtend.frozen = true + + // Create index from variant name to index. + variantIndex := make(map[string]uint8) + add := func(s []string) { + for _, v := range s { + variantIndex[v] = uint8(len(variantIndex)) + } + } + add(specialized.slice()) + add(specializedExtend.s) + numSpecialized := len(variantIndex) + add(generalized.slice()) + if n := len(variantIndex); n > 255 { + log.Fatalf("maximum number of variants exceeded: was %d; want <= 255", n) + } + b.writeMap("variantIndex", variantIndex) + b.writeConst("variantNumSpecialized", numSpecialized) +} + +func (b *builder) writeLanguageInfo() { +} + +// writeLikelyData writes tables that are used both for finding parent relations and for +// language matching. Each entry contains additional bits to indicate the status of the +// data to know when it cannot be used for parent relations. +func (b *builder) writeLikelyData() { + const ( + isList = 1 << iota + scriptInFrom + regionInFrom + ) + type ( // generated types + likelyScriptRegion struct { + region uint16 + script uint8 + flags uint8 + } + likelyLangScript struct { + lang uint16 + script uint8 + flags uint8 + } + likelyLangRegion struct { + lang uint16 + region uint16 + } + // likelyTag is used for getting likely tags for group regions, where + // the likely region might be a region contained in the group. + likelyTag struct { + lang uint16 + region uint16 + script uint8 + } + ) + var ( // generated variables + likelyRegionGroup = make([]likelyTag, len(b.groups)) + likelyLang = make([]likelyScriptRegion, len(b.lang.s)) + likelyRegion = make([]likelyLangScript, len(b.region.s)) + likelyScript = make([]likelyLangRegion, len(b.script.s)) + likelyLangList = []likelyScriptRegion{} + likelyRegionList = []likelyLangScript{} + ) + type fromTo struct { + from, to []string + } + langToOther := map[int][]fromTo{} + regionToOther := map[int][]fromTo{} + for _, m := range b.supp.LikelySubtags.LikelySubtag { + from := strings.Split(m.From, "_") + to := strings.Split(m.To, "_") + if len(to) != 3 { + log.Fatalf("invalid number of subtags in %q: found %d, want 3", m.To, len(to)) + } + if len(from) > 3 { + log.Fatalf("invalid number of subtags: found %d, want 1-3", len(from)) + } + if from[0] != to[0] && from[0] != "und" { + log.Fatalf("unexpected language change in expansion: %s -> %s", from, to) + } + if len(from) == 3 { + if from[2] != to[2] { + log.Fatalf("unexpected region change in expansion: %s -> %s", from, to) + } + if from[0] != "und" { + log.Fatalf("unexpected fully specified from tag: %s -> %s", from, to) + } + } + if len(from) == 1 || from[0] != "und" { + id := 0 + if from[0] != "und" { + id = b.lang.index(from[0]) + } + langToOther[id] = append(langToOther[id], fromTo{from, to}) + } else if len(from) == 2 && len(from[1]) == 4 { + sid := b.script.index(from[1]) + likelyScript[sid].lang = uint16(b.langIndex(to[0])) + likelyScript[sid].region = uint16(b.region.index(to[2])) + } else { + r := b.region.index(from[len(from)-1]) + if id, ok := b.groups[r]; ok { + if from[0] != "und" { + log.Fatalf("region changed unexpectedly: %s -> %s", from, to) + } + likelyRegionGroup[id].lang = uint16(b.langIndex(to[0])) + likelyRegionGroup[id].script = uint8(b.script.index(to[1])) + likelyRegionGroup[id].region = uint16(b.region.index(to[2])) + } else { + regionToOther[r] = append(regionToOther[r], fromTo{from, to}) + } + } + } + b.writeType(likelyLangRegion{}) + b.writeSlice("likelyScript", likelyScript) + + for id := range b.lang.s { + list := langToOther[id] + if len(list) == 1 { + likelyLang[id].region = uint16(b.region.index(list[0].to[2])) + likelyLang[id].script = uint8(b.script.index(list[0].to[1])) + } else if len(list) > 1 { + likelyLang[id].flags = isList + likelyLang[id].region = uint16(len(likelyLangList)) + likelyLang[id].script = uint8(len(list)) + for _, x := range list { + flags := uint8(0) + if len(x.from) > 1 { + if x.from[1] == x.to[2] { + flags = regionInFrom + } else { + flags = scriptInFrom + } + } + likelyLangList = append(likelyLangList, likelyScriptRegion{ + region: uint16(b.region.index(x.to[2])), + script: uint8(b.script.index(x.to[1])), + flags: flags, + }) + } + } + } + // TODO: merge suppressScript data with this table. + b.writeType(likelyScriptRegion{}) + b.writeSlice("likelyLang", likelyLang) + b.writeSlice("likelyLangList", likelyLangList) + + for id := range b.region.s { + list := regionToOther[id] + if len(list) == 1 { + likelyRegion[id].lang = uint16(b.langIndex(list[0].to[0])) + likelyRegion[id].script = uint8(b.script.index(list[0].to[1])) + if len(list[0].from) > 2 { + likelyRegion[id].flags = scriptInFrom + } + } else if len(list) > 1 { + likelyRegion[id].flags = isList + likelyRegion[id].lang = uint16(len(likelyRegionList)) + likelyRegion[id].script = uint8(len(list)) + for i, x := range list { + if len(x.from) == 2 && i != 0 || i > 0 && len(x.from) != 3 { + log.Fatalf("unspecified script must be first in list: %v at %d", x.from, i) + } + x := likelyLangScript{ + lang: uint16(b.langIndex(x.to[0])), + script: uint8(b.script.index(x.to[1])), + } + if len(list[0].from) > 2 { + x.flags = scriptInFrom + } + likelyRegionList = append(likelyRegionList, x) + } + } + } + b.writeType(likelyLangScript{}) + b.writeSlice("likelyRegion", likelyRegion) + b.writeSlice("likelyRegionList", likelyRegionList) + + b.writeType(likelyTag{}) + b.writeSlice("likelyRegionGroup", likelyRegionGroup) } type mutualIntelligibility struct { @@ -149,7 +1397,7 @@ func (b *builder) writeMatchData() { regions := strings.Split(g.Contains, " ") regionHierarchy[g.Type] = append(regionHierarchy[g.Type], regions...) } - regionToGroups := make([]uint8, language.NumRegions) + regionToGroups := make([]uint8, len(b.region.s)) idToIndex := map[string]uint8{} for i, mv := range lm[0].MatchVariable { @@ -162,12 +1410,12 @@ func (b *builder) writeMatchData() { todo := []string{r} for k := 0; k < len(todo); k++ { r := todo[k] - regionToGroups[b.regionIndex(r)] |= 1 << uint8(i) + regionToGroups[b.region.index(r)] |= 1 << uint8(i) todo = append(todo, regionHierarchy[r]...) } } } - b.w.WriteVar("regionToGroups", regionToGroups) + b.writeSlice("regionToGroups", regionToGroups) // maps language id to in- and out-of-group region. paradigmLocales := [][3]uint16{} @@ -178,16 +1426,16 @@ func (b *builder) writeMatchData() { pc := strings.SplitN(locales[i+j], "-", 2) x[0] = b.langIndex(pc[0]) if len(pc) == 2 { - x[1+j] = uint16(b.regionIndex(pc[1])) + x[1+j] = uint16(b.region.index(pc[1])) } } paradigmLocales = append(paradigmLocales, x) } - b.w.WriteVar("paradigmLocales", paradigmLocales) + b.writeSlice("paradigmLocales", paradigmLocales) - b.w.WriteType(mutualIntelligibility{}) - b.w.WriteType(scriptIntelligibility{}) - b.w.WriteType(regionIntelligibility{}) + b.writeType(mutualIntelligibility{}) + b.writeType(scriptIntelligibility{}) + b.writeType(regionIntelligibility{}) matchLang := []mutualIntelligibility{} matchScript := []scriptIntelligibility{} @@ -213,16 +1461,16 @@ func (b *builder) writeMatchData() { matchScript = append(matchScript, scriptIntelligibility{ wantLang: uint16(b.langIndex(d[0])), haveLang: uint16(b.langIndex(s[0])), - wantScript: uint8(b.scriptIndex(d[1])), - haveScript: uint8(b.scriptIndex(s[1])), + wantScript: uint8(b.script.index(d[1])), + haveScript: uint8(b.script.index(s[1])), distance: uint8(distance), }) if m.Oneway != "true" { matchScript = append(matchScript, scriptIntelligibility{ wantLang: uint16(b.langIndex(s[0])), haveLang: uint16(b.langIndex(d[0])), - wantScript: uint8(b.scriptIndex(s[1])), - haveScript: uint8(b.scriptIndex(d[1])), + wantScript: uint8(b.script.index(s[1])), + haveScript: uint8(b.script.index(d[1])), distance: uint8(distance), }) } @@ -264,7 +1512,7 @@ func (b *builder) writeMatchData() { distance: uint8(distance), } if d[1] != "*" { - ri.script = uint8(b.scriptIndex(d[1])) + ri.script = uint8(b.script.index(d[1])) } switch { case d[2] == "*": @@ -284,22 +1532,181 @@ func (b *builder) writeMatchData() { sort.SliceStable(matchLang, func(i, j int) bool { return matchLang[i].distance < matchLang[j].distance }) - b.w.WriteComment(` - matchLang holds pairs of langIDs of base languages that are typically - mutually intelligible. Each pair is associated with a confidence and - whether the intelligibility goes one or both ways.`) - b.w.WriteVar("matchLang", matchLang) + b.writeSlice("matchLang", matchLang) - b.w.WriteComment(` - matchScript holds pairs of scriptIDs where readers of one script - can typically also read the other. Each is associated with a confidence.`) sort.SliceStable(matchScript, func(i, j int) bool { return matchScript[i].distance < matchScript[j].distance }) - b.w.WriteVar("matchScript", matchScript) + b.writeSlice("matchScript", matchScript) sort.SliceStable(matchRegion, func(i, j int) bool { return matchRegion[i].distance < matchRegion[j].distance }) - b.w.WriteVar("matchRegion", matchRegion) + b.writeSlice("matchRegion", matchRegion) +} + +func (b *builder) writeRegionInclusionData() { + var ( + // mm holds for each group the set of groups with a distance of 1. + mm = make(map[int][]index) + + // containment holds for each group the transitive closure of + // containment of other groups. + containment = make(map[index][]index) + ) + for _, g := range b.supp.TerritoryContainment.Group { + // Skip UN and EURO zone as they are flattening the containment + // relationship. + if g.Type == "EZ" || g.Type == "UN" { + continue + } + group := b.region.index(g.Type) + groupIdx := b.groups[group] + for _, mem := range strings.Split(g.Contains, " ") { + r := b.region.index(mem) + mm[r] = append(mm[r], groupIdx) + if g, ok := b.groups[r]; ok { + mm[group] = append(mm[group], g) + containment[groupIdx] = append(containment[groupIdx], g) + } + } + } + + regionContainment := make([]uint64, len(b.groups)) + for _, g := range b.groups { + l := containment[g] + + // Compute the transitive closure of containment. + for i := 0; i < len(l); i++ { + l = append(l, containment[l[i]]...) + } + + // Compute the bitmask. + regionContainment[g] = 1 << g + for _, v := range l { + regionContainment[g] |= 1 << v + } + } + b.writeSlice("regionContainment", regionContainment) + + regionInclusion := make([]uint8, len(b.region.s)) + bvs := make(map[uint64]index) + // Make the first bitvector positions correspond with the groups. + for r, i := range b.groups { + bv := uint64(1 << i) + for _, g := range mm[r] { + bv |= 1 << g + } + bvs[bv] = i + regionInclusion[r] = uint8(bvs[bv]) + } + for r := 1; r < len(b.region.s); r++ { + if _, ok := b.groups[r]; !ok { + bv := uint64(0) + for _, g := range mm[r] { + bv |= 1 << g + } + if bv == 0 { + // Pick the world for unspecified regions. + bv = 1 << b.groups[b.region.index("001")] + } + if _, ok := bvs[bv]; !ok { + bvs[bv] = index(len(bvs)) + } + regionInclusion[r] = uint8(bvs[bv]) + } + } + b.writeSlice("regionInclusion", regionInclusion) + regionInclusionBits := make([]uint64, len(bvs)) + for k, v := range bvs { + regionInclusionBits[v] = uint64(k) + } + // Add bit vectors for increasingly large distances until a fixed point is reached. + regionInclusionNext := []uint8{} + for i := 0; i < len(regionInclusionBits); i++ { + bits := regionInclusionBits[i] + next := bits + for i := uint(0); i < uint(len(b.groups)); i++ { + if bits&(1< b'. Using + // bytes.Replace will do. + out := bytes.Replace(buf.Bytes(), []byte("language."), nil, -1) + if err := ioutil.WriteFile("index.go", out, 0600); err != nil { + log.Fatalf("Could not create file index.go: %v", err) + } + }() + + m := map[language.Tag]bool{} + for _, lang := range data.Locales() { + // We include all locales unconditionally to be consistent with en_US. + // We want en_US, even though it has no data associated with it. + + // TODO: put any of the languages for which no data exists at the end + // of the index. This allows all components based on ICU to use that + // as the cutoff point. + // if x := data.RawLDML(lang); false || + // x.LocaleDisplayNames != nil || + // x.Characters != nil || + // x.Delimiters != nil || + // x.Measurement != nil || + // x.Dates != nil || + // x.Numbers != nil || + // x.Units != nil || + // x.ListPatterns != nil || + // x.Collations != nil || + // x.Segmentations != nil || + // x.Rbnf != nil || + // x.Annotations != nil || + // x.Metadata != nil { + + // TODO: support POSIX natively, albeit non-standard. + tag := language.Make(strings.Replace(lang, "_POSIX", "-u-va-posix", 1)) + m[tag] = true + // } + } + // Include locales for plural rules, which uses a different structure. + for _, plurals := range data.Supplemental().Plurals { + for _, rules := range plurals.PluralRules { + for _, lang := range strings.Split(rules.Locales, " ") { + m[language.Make(lang)] = true + } + } + } + + var core, special []language.Tag + + for t := range m { + if x := t.Extensions(); len(x) != 0 && fmt.Sprint(x) != "[u-va-posix]" { + log.Fatalf("Unexpected extension %v in %v", x, t) + } + if len(t.Variants()) == 0 && len(t.Extensions()) == 0 { + core = append(core, t) + } else { + special = append(special, t) + } + } + + w.WriteComment(` + NumCompactTags is the number of common tags. The maximum tag is + NumCompactTags-1.`) + w.WriteConst("NumCompactTags", len(core)+len(special)) + + sort.Sort(byAlpha(special)) + w.WriteVar("specialTags", special) + + // TODO: order by frequency? + sort.Sort(byAlpha(core)) + + // Size computations are just an estimate. + w.Size += int(reflect.TypeOf(map[uint32]uint16{}).Size()) + w.Size += len(core) * 6 // size of uint32 and uint16 + + fmt.Fprintln(w) + fmt.Fprintln(w, "var coreTags = map[uint32]uint16{") + fmt.Fprintln(w, "0x0: 0, // und") + i := len(special) + 1 // Und and special tags already written. + for _, t := range core { + if t == language.Und { + continue + } + fmt.Fprint(w.Hash, t, i) + b, s, r := t.Raw() + fmt.Fprintf(w, "0x%s%s%s: %d, // %s\n", + getIndex(b, 3), // 3 is enough as it is guaranteed to be a compact number + getIndex(s, 2), + getIndex(r, 3), + i, t) + i++ + } + fmt.Fprintln(w, "}") +} + +// getIndex prints the subtag type and extracts its index of size nibble. +// If the index is less than n nibbles, the result is prefixed with 0s. +func getIndex(x interface{}, n int) string { + s := fmt.Sprintf("%#v", x) // s is of form Type{typeID: 0x00} + s = s[strings.Index(s, "0x")+2 : len(s)-1] + return strings.Repeat("0", n-len(s)) + s +} + +type byAlpha []language.Tag + +func (a byAlpha) Len() int { return len(a) } +func (a byAlpha) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byAlpha) Less(i, j int) bool { return a[i].String() < a[j].String() } diff --git a/vendor/golang.org/x/text/language/index.go b/vendor/golang.org/x/text/language/index.go new file mode 100644 index 00000000..5311e5cb --- /dev/null +++ b/vendor/golang.org/x/text/language/index.go @@ -0,0 +1,783 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package language + +// NumCompactTags is the number of common tags. The maximum tag is +// NumCompactTags-1. +const NumCompactTags = 768 + +var specialTags = []Tag{ // 2 elements + 0: {lang: 0xd7, region: 0x6e, script: 0x0, pVariant: 0x5, pExt: 0xe, str: "ca-ES-valencia"}, + 1: {lang: 0x139, region: 0x135, script: 0x0, pVariant: 0x5, pExt: 0x5, str: "en-US-u-va-posix"}, +} // Size: 72 bytes + +var coreTags = map[uint32]uint16{ + 0x0: 0, // und + 0x01600000: 3, // af + 0x016000d2: 4, // af-NA + 0x01600161: 5, // af-ZA + 0x01c00000: 6, // agq + 0x01c00052: 7, // agq-CM + 0x02100000: 8, // ak + 0x02100080: 9, // ak-GH + 0x02700000: 10, // am + 0x0270006f: 11, // am-ET + 0x03a00000: 12, // ar + 0x03a00001: 13, // ar-001 + 0x03a00023: 14, // ar-AE + 0x03a00039: 15, // ar-BH + 0x03a00062: 16, // ar-DJ + 0x03a00067: 17, // ar-DZ + 0x03a0006b: 18, // ar-EG + 0x03a0006c: 19, // ar-EH + 0x03a0006d: 20, // ar-ER + 0x03a00097: 21, // ar-IL + 0x03a0009b: 22, // ar-IQ + 0x03a000a1: 23, // ar-JO + 0x03a000a8: 24, // ar-KM + 0x03a000ac: 25, // ar-KW + 0x03a000b0: 26, // ar-LB + 0x03a000b9: 27, // ar-LY + 0x03a000ba: 28, // ar-MA + 0x03a000c9: 29, // ar-MR + 0x03a000e1: 30, // ar-OM + 0x03a000ed: 31, // ar-PS + 0x03a000f3: 32, // ar-QA + 0x03a00108: 33, // ar-SA + 0x03a0010b: 34, // ar-SD + 0x03a00115: 35, // ar-SO + 0x03a00117: 36, // ar-SS + 0x03a0011c: 37, // ar-SY + 0x03a00120: 38, // ar-TD + 0x03a00128: 39, // ar-TN + 0x03a0015e: 40, // ar-YE + 0x04000000: 41, // ars + 0x04300000: 42, // as + 0x04300099: 43, // as-IN + 0x04400000: 44, // asa + 0x0440012f: 45, // asa-TZ + 0x04800000: 46, // ast + 0x0480006e: 47, // ast-ES + 0x05800000: 48, // az + 0x0581f000: 49, // az-Cyrl + 0x0581f032: 50, // az-Cyrl-AZ + 0x05857000: 51, // az-Latn + 0x05857032: 52, // az-Latn-AZ + 0x05e00000: 53, // bas + 0x05e00052: 54, // bas-CM + 0x07100000: 55, // be + 0x07100047: 56, // be-BY + 0x07500000: 57, // bem + 0x07500162: 58, // bem-ZM + 0x07900000: 59, // bez + 0x0790012f: 60, // bez-TZ + 0x07e00000: 61, // bg + 0x07e00038: 62, // bg-BG + 0x08200000: 63, // bh + 0x0a000000: 64, // bm + 0x0a0000c3: 65, // bm-ML + 0x0a500000: 66, // bn + 0x0a500035: 67, // bn-BD + 0x0a500099: 68, // bn-IN + 0x0a900000: 69, // bo + 0x0a900053: 70, // bo-CN + 0x0a900099: 71, // bo-IN + 0x0b200000: 72, // br + 0x0b200078: 73, // br-FR + 0x0b500000: 74, // brx + 0x0b500099: 75, // brx-IN + 0x0b700000: 76, // bs + 0x0b71f000: 77, // bs-Cyrl + 0x0b71f033: 78, // bs-Cyrl-BA + 0x0b757000: 79, // bs-Latn + 0x0b757033: 80, // bs-Latn-BA + 0x0d700000: 81, // ca + 0x0d700022: 82, // ca-AD + 0x0d70006e: 83, // ca-ES + 0x0d700078: 84, // ca-FR + 0x0d70009e: 85, // ca-IT + 0x0db00000: 86, // ccp + 0x0db00035: 87, // ccp-BD + 0x0db00099: 88, // ccp-IN + 0x0dc00000: 89, // ce + 0x0dc00106: 90, // ce-RU + 0x0df00000: 91, // cgg + 0x0df00131: 92, // cgg-UG + 0x0e500000: 93, // chr + 0x0e500135: 94, // chr-US + 0x0e900000: 95, // ckb + 0x0e90009b: 96, // ckb-IQ + 0x0e90009c: 97, // ckb-IR + 0x0fa00000: 98, // cs + 0x0fa0005e: 99, // cs-CZ + 0x0fe00000: 100, // cu + 0x0fe00106: 101, // cu-RU + 0x10000000: 102, // cy + 0x1000007b: 103, // cy-GB + 0x10100000: 104, // da + 0x10100063: 105, // da-DK + 0x10100082: 106, // da-GL + 0x10800000: 107, // dav + 0x108000a4: 108, // dav-KE + 0x10d00000: 109, // de + 0x10d0002e: 110, // de-AT + 0x10d00036: 111, // de-BE + 0x10d0004e: 112, // de-CH + 0x10d00060: 113, // de-DE + 0x10d0009e: 114, // de-IT + 0x10d000b2: 115, // de-LI + 0x10d000b7: 116, // de-LU + 0x11700000: 117, // dje + 0x117000d4: 118, // dje-NE + 0x11f00000: 119, // dsb + 0x11f00060: 120, // dsb-DE + 0x12400000: 121, // dua + 0x12400052: 122, // dua-CM + 0x12800000: 123, // dv + 0x12b00000: 124, // dyo + 0x12b00114: 125, // dyo-SN + 0x12d00000: 126, // dz + 0x12d00043: 127, // dz-BT + 0x12f00000: 128, // ebu + 0x12f000a4: 129, // ebu-KE + 0x13000000: 130, // ee + 0x13000080: 131, // ee-GH + 0x13000122: 132, // ee-TG + 0x13600000: 133, // el + 0x1360005d: 134, // el-CY + 0x13600087: 135, // el-GR + 0x13900000: 136, // en + 0x13900001: 137, // en-001 + 0x1390001a: 138, // en-150 + 0x13900025: 139, // en-AG + 0x13900026: 140, // en-AI + 0x1390002d: 141, // en-AS + 0x1390002e: 142, // en-AT + 0x1390002f: 143, // en-AU + 0x13900034: 144, // en-BB + 0x13900036: 145, // en-BE + 0x1390003a: 146, // en-BI + 0x1390003d: 147, // en-BM + 0x13900042: 148, // en-BS + 0x13900046: 149, // en-BW + 0x13900048: 150, // en-BZ + 0x13900049: 151, // en-CA + 0x1390004a: 152, // en-CC + 0x1390004e: 153, // en-CH + 0x13900050: 154, // en-CK + 0x13900052: 155, // en-CM + 0x1390005c: 156, // en-CX + 0x1390005d: 157, // en-CY + 0x13900060: 158, // en-DE + 0x13900061: 159, // en-DG + 0x13900063: 160, // en-DK + 0x13900064: 161, // en-DM + 0x1390006d: 162, // en-ER + 0x13900072: 163, // en-FI + 0x13900073: 164, // en-FJ + 0x13900074: 165, // en-FK + 0x13900075: 166, // en-FM + 0x1390007b: 167, // en-GB + 0x1390007c: 168, // en-GD + 0x1390007f: 169, // en-GG + 0x13900080: 170, // en-GH + 0x13900081: 171, // en-GI + 0x13900083: 172, // en-GM + 0x1390008a: 173, // en-GU + 0x1390008c: 174, // en-GY + 0x1390008d: 175, // en-HK + 0x13900096: 176, // en-IE + 0x13900097: 177, // en-IL + 0x13900098: 178, // en-IM + 0x13900099: 179, // en-IN + 0x1390009a: 180, // en-IO + 0x1390009f: 181, // en-JE + 0x139000a0: 182, // en-JM + 0x139000a4: 183, // en-KE + 0x139000a7: 184, // en-KI + 0x139000a9: 185, // en-KN + 0x139000ad: 186, // en-KY + 0x139000b1: 187, // en-LC + 0x139000b4: 188, // en-LR + 0x139000b5: 189, // en-LS + 0x139000bf: 190, // en-MG + 0x139000c0: 191, // en-MH + 0x139000c6: 192, // en-MO + 0x139000c7: 193, // en-MP + 0x139000ca: 194, // en-MS + 0x139000cb: 195, // en-MT + 0x139000cc: 196, // en-MU + 0x139000ce: 197, // en-MW + 0x139000d0: 198, // en-MY + 0x139000d2: 199, // en-NA + 0x139000d5: 200, // en-NF + 0x139000d6: 201, // en-NG + 0x139000d9: 202, // en-NL + 0x139000dd: 203, // en-NR + 0x139000df: 204, // en-NU + 0x139000e0: 205, // en-NZ + 0x139000e6: 206, // en-PG + 0x139000e7: 207, // en-PH + 0x139000e8: 208, // en-PK + 0x139000eb: 209, // en-PN + 0x139000ec: 210, // en-PR + 0x139000f0: 211, // en-PW + 0x13900107: 212, // en-RW + 0x13900109: 213, // en-SB + 0x1390010a: 214, // en-SC + 0x1390010b: 215, // en-SD + 0x1390010c: 216, // en-SE + 0x1390010d: 217, // en-SG + 0x1390010e: 218, // en-SH + 0x1390010f: 219, // en-SI + 0x13900112: 220, // en-SL + 0x13900117: 221, // en-SS + 0x1390011b: 222, // en-SX + 0x1390011d: 223, // en-SZ + 0x1390011f: 224, // en-TC + 0x13900125: 225, // en-TK + 0x13900129: 226, // en-TO + 0x1390012c: 227, // en-TT + 0x1390012d: 228, // en-TV + 0x1390012f: 229, // en-TZ + 0x13900131: 230, // en-UG + 0x13900133: 231, // en-UM + 0x13900135: 232, // en-US + 0x13900139: 233, // en-VC + 0x1390013c: 234, // en-VG + 0x1390013d: 235, // en-VI + 0x1390013f: 236, // en-VU + 0x13900142: 237, // en-WS + 0x13900161: 238, // en-ZA + 0x13900162: 239, // en-ZM + 0x13900164: 240, // en-ZW + 0x13c00000: 241, // eo + 0x13c00001: 242, // eo-001 + 0x13e00000: 243, // es + 0x13e0001f: 244, // es-419 + 0x13e0002c: 245, // es-AR + 0x13e0003f: 246, // es-BO + 0x13e00041: 247, // es-BR + 0x13e00048: 248, // es-BZ + 0x13e00051: 249, // es-CL + 0x13e00054: 250, // es-CO + 0x13e00056: 251, // es-CR + 0x13e00059: 252, // es-CU + 0x13e00065: 253, // es-DO + 0x13e00068: 254, // es-EA + 0x13e00069: 255, // es-EC + 0x13e0006e: 256, // es-ES + 0x13e00086: 257, // es-GQ + 0x13e00089: 258, // es-GT + 0x13e0008f: 259, // es-HN + 0x13e00094: 260, // es-IC + 0x13e000cf: 261, // es-MX + 0x13e000d8: 262, // es-NI + 0x13e000e2: 263, // es-PA + 0x13e000e4: 264, // es-PE + 0x13e000e7: 265, // es-PH + 0x13e000ec: 266, // es-PR + 0x13e000f1: 267, // es-PY + 0x13e0011a: 268, // es-SV + 0x13e00135: 269, // es-US + 0x13e00136: 270, // es-UY + 0x13e0013b: 271, // es-VE + 0x14000000: 272, // et + 0x1400006a: 273, // et-EE + 0x14500000: 274, // eu + 0x1450006e: 275, // eu-ES + 0x14600000: 276, // ewo + 0x14600052: 277, // ewo-CM + 0x14800000: 278, // fa + 0x14800024: 279, // fa-AF + 0x1480009c: 280, // fa-IR + 0x14e00000: 281, // ff + 0x14e00052: 282, // ff-CM + 0x14e00084: 283, // ff-GN + 0x14e000c9: 284, // ff-MR + 0x14e00114: 285, // ff-SN + 0x15100000: 286, // fi + 0x15100072: 287, // fi-FI + 0x15300000: 288, // fil + 0x153000e7: 289, // fil-PH + 0x15800000: 290, // fo + 0x15800063: 291, // fo-DK + 0x15800076: 292, // fo-FO + 0x15e00000: 293, // fr + 0x15e00036: 294, // fr-BE + 0x15e00037: 295, // fr-BF + 0x15e0003a: 296, // fr-BI + 0x15e0003b: 297, // fr-BJ + 0x15e0003c: 298, // fr-BL + 0x15e00049: 299, // fr-CA + 0x15e0004b: 300, // fr-CD + 0x15e0004c: 301, // fr-CF + 0x15e0004d: 302, // fr-CG + 0x15e0004e: 303, // fr-CH + 0x15e0004f: 304, // fr-CI + 0x15e00052: 305, // fr-CM + 0x15e00062: 306, // fr-DJ + 0x15e00067: 307, // fr-DZ + 0x15e00078: 308, // fr-FR + 0x15e0007a: 309, // fr-GA + 0x15e0007e: 310, // fr-GF + 0x15e00084: 311, // fr-GN + 0x15e00085: 312, // fr-GP + 0x15e00086: 313, // fr-GQ + 0x15e00091: 314, // fr-HT + 0x15e000a8: 315, // fr-KM + 0x15e000b7: 316, // fr-LU + 0x15e000ba: 317, // fr-MA + 0x15e000bb: 318, // fr-MC + 0x15e000be: 319, // fr-MF + 0x15e000bf: 320, // fr-MG + 0x15e000c3: 321, // fr-ML + 0x15e000c8: 322, // fr-MQ + 0x15e000c9: 323, // fr-MR + 0x15e000cc: 324, // fr-MU + 0x15e000d3: 325, // fr-NC + 0x15e000d4: 326, // fr-NE + 0x15e000e5: 327, // fr-PF + 0x15e000ea: 328, // fr-PM + 0x15e00102: 329, // fr-RE + 0x15e00107: 330, // fr-RW + 0x15e0010a: 331, // fr-SC + 0x15e00114: 332, // fr-SN + 0x15e0011c: 333, // fr-SY + 0x15e00120: 334, // fr-TD + 0x15e00122: 335, // fr-TG + 0x15e00128: 336, // fr-TN + 0x15e0013f: 337, // fr-VU + 0x15e00140: 338, // fr-WF + 0x15e0015f: 339, // fr-YT + 0x16900000: 340, // fur + 0x1690009e: 341, // fur-IT + 0x16d00000: 342, // fy + 0x16d000d9: 343, // fy-NL + 0x16e00000: 344, // ga + 0x16e00096: 345, // ga-IE + 0x17e00000: 346, // gd + 0x17e0007b: 347, // gd-GB + 0x19000000: 348, // gl + 0x1900006e: 349, // gl-ES + 0x1a300000: 350, // gsw + 0x1a30004e: 351, // gsw-CH + 0x1a300078: 352, // gsw-FR + 0x1a3000b2: 353, // gsw-LI + 0x1a400000: 354, // gu + 0x1a400099: 355, // gu-IN + 0x1a900000: 356, // guw + 0x1ab00000: 357, // guz + 0x1ab000a4: 358, // guz-KE + 0x1ac00000: 359, // gv + 0x1ac00098: 360, // gv-IM + 0x1b400000: 361, // ha + 0x1b400080: 362, // ha-GH + 0x1b4000d4: 363, // ha-NE + 0x1b4000d6: 364, // ha-NG + 0x1b800000: 365, // haw + 0x1b800135: 366, // haw-US + 0x1bc00000: 367, // he + 0x1bc00097: 368, // he-IL + 0x1be00000: 369, // hi + 0x1be00099: 370, // hi-IN + 0x1d100000: 371, // hr + 0x1d100033: 372, // hr-BA + 0x1d100090: 373, // hr-HR + 0x1d200000: 374, // hsb + 0x1d200060: 375, // hsb-DE + 0x1d500000: 376, // hu + 0x1d500092: 377, // hu-HU + 0x1d700000: 378, // hy + 0x1d700028: 379, // hy-AM + 0x1e100000: 380, // id + 0x1e100095: 381, // id-ID + 0x1e700000: 382, // ig + 0x1e7000d6: 383, // ig-NG + 0x1ea00000: 384, // ii + 0x1ea00053: 385, // ii-CN + 0x1f500000: 386, // io + 0x1f800000: 387, // is + 0x1f80009d: 388, // is-IS + 0x1f900000: 389, // it + 0x1f90004e: 390, // it-CH + 0x1f90009e: 391, // it-IT + 0x1f900113: 392, // it-SM + 0x1f900138: 393, // it-VA + 0x1fa00000: 394, // iu + 0x20000000: 395, // ja + 0x200000a2: 396, // ja-JP + 0x20300000: 397, // jbo + 0x20700000: 398, // jgo + 0x20700052: 399, // jgo-CM + 0x20a00000: 400, // jmc + 0x20a0012f: 401, // jmc-TZ + 0x20e00000: 402, // jv + 0x21000000: 403, // ka + 0x2100007d: 404, // ka-GE + 0x21200000: 405, // kab + 0x21200067: 406, // kab-DZ + 0x21600000: 407, // kaj + 0x21700000: 408, // kam + 0x217000a4: 409, // kam-KE + 0x21f00000: 410, // kcg + 0x22300000: 411, // kde + 0x2230012f: 412, // kde-TZ + 0x22700000: 413, // kea + 0x2270005a: 414, // kea-CV + 0x23400000: 415, // khq + 0x234000c3: 416, // khq-ML + 0x23900000: 417, // ki + 0x239000a4: 418, // ki-KE + 0x24200000: 419, // kk + 0x242000ae: 420, // kk-KZ + 0x24400000: 421, // kkj + 0x24400052: 422, // kkj-CM + 0x24500000: 423, // kl + 0x24500082: 424, // kl-GL + 0x24600000: 425, // kln + 0x246000a4: 426, // kln-KE + 0x24a00000: 427, // km + 0x24a000a6: 428, // km-KH + 0x25100000: 429, // kn + 0x25100099: 430, // kn-IN + 0x25400000: 431, // ko + 0x254000aa: 432, // ko-KP + 0x254000ab: 433, // ko-KR + 0x25600000: 434, // kok + 0x25600099: 435, // kok-IN + 0x26a00000: 436, // ks + 0x26a00099: 437, // ks-IN + 0x26b00000: 438, // ksb + 0x26b0012f: 439, // ksb-TZ + 0x26d00000: 440, // ksf + 0x26d00052: 441, // ksf-CM + 0x26e00000: 442, // ksh + 0x26e00060: 443, // ksh-DE + 0x27400000: 444, // ku + 0x28100000: 445, // kw + 0x2810007b: 446, // kw-GB + 0x28a00000: 447, // ky + 0x28a000a5: 448, // ky-KG + 0x29100000: 449, // lag + 0x2910012f: 450, // lag-TZ + 0x29500000: 451, // lb + 0x295000b7: 452, // lb-LU + 0x2a300000: 453, // lg + 0x2a300131: 454, // lg-UG + 0x2af00000: 455, // lkt + 0x2af00135: 456, // lkt-US + 0x2b500000: 457, // ln + 0x2b50002a: 458, // ln-AO + 0x2b50004b: 459, // ln-CD + 0x2b50004c: 460, // ln-CF + 0x2b50004d: 461, // ln-CG + 0x2b800000: 462, // lo + 0x2b8000af: 463, // lo-LA + 0x2bf00000: 464, // lrc + 0x2bf0009b: 465, // lrc-IQ + 0x2bf0009c: 466, // lrc-IR + 0x2c000000: 467, // lt + 0x2c0000b6: 468, // lt-LT + 0x2c200000: 469, // lu + 0x2c20004b: 470, // lu-CD + 0x2c400000: 471, // luo + 0x2c4000a4: 472, // luo-KE + 0x2c500000: 473, // luy + 0x2c5000a4: 474, // luy-KE + 0x2c700000: 475, // lv + 0x2c7000b8: 476, // lv-LV + 0x2d100000: 477, // mas + 0x2d1000a4: 478, // mas-KE + 0x2d10012f: 479, // mas-TZ + 0x2e900000: 480, // mer + 0x2e9000a4: 481, // mer-KE + 0x2ed00000: 482, // mfe + 0x2ed000cc: 483, // mfe-MU + 0x2f100000: 484, // mg + 0x2f1000bf: 485, // mg-MG + 0x2f200000: 486, // mgh + 0x2f2000d1: 487, // mgh-MZ + 0x2f400000: 488, // mgo + 0x2f400052: 489, // mgo-CM + 0x2ff00000: 490, // mk + 0x2ff000c2: 491, // mk-MK + 0x30400000: 492, // ml + 0x30400099: 493, // ml-IN + 0x30b00000: 494, // mn + 0x30b000c5: 495, // mn-MN + 0x31b00000: 496, // mr + 0x31b00099: 497, // mr-IN + 0x31f00000: 498, // ms + 0x31f0003e: 499, // ms-BN + 0x31f000d0: 500, // ms-MY + 0x31f0010d: 501, // ms-SG + 0x32000000: 502, // mt + 0x320000cb: 503, // mt-MT + 0x32500000: 504, // mua + 0x32500052: 505, // mua-CM + 0x33100000: 506, // my + 0x331000c4: 507, // my-MM + 0x33a00000: 508, // mzn + 0x33a0009c: 509, // mzn-IR + 0x34100000: 510, // nah + 0x34500000: 511, // naq + 0x345000d2: 512, // naq-NA + 0x34700000: 513, // nb + 0x347000da: 514, // nb-NO + 0x34700110: 515, // nb-SJ + 0x34e00000: 516, // nd + 0x34e00164: 517, // nd-ZW + 0x35000000: 518, // nds + 0x35000060: 519, // nds-DE + 0x350000d9: 520, // nds-NL + 0x35100000: 521, // ne + 0x35100099: 522, // ne-IN + 0x351000db: 523, // ne-NP + 0x36700000: 524, // nl + 0x36700030: 525, // nl-AW + 0x36700036: 526, // nl-BE + 0x36700040: 527, // nl-BQ + 0x3670005b: 528, // nl-CW + 0x367000d9: 529, // nl-NL + 0x36700116: 530, // nl-SR + 0x3670011b: 531, // nl-SX + 0x36800000: 532, // nmg + 0x36800052: 533, // nmg-CM + 0x36a00000: 534, // nn + 0x36a000da: 535, // nn-NO + 0x36c00000: 536, // nnh + 0x36c00052: 537, // nnh-CM + 0x36f00000: 538, // no + 0x37500000: 539, // nqo + 0x37600000: 540, // nr + 0x37a00000: 541, // nso + 0x38000000: 542, // nus + 0x38000117: 543, // nus-SS + 0x38700000: 544, // ny + 0x38900000: 545, // nyn + 0x38900131: 546, // nyn-UG + 0x39000000: 547, // om + 0x3900006f: 548, // om-ET + 0x390000a4: 549, // om-KE + 0x39500000: 550, // or + 0x39500099: 551, // or-IN + 0x39800000: 552, // os + 0x3980007d: 553, // os-GE + 0x39800106: 554, // os-RU + 0x39d00000: 555, // pa + 0x39d05000: 556, // pa-Arab + 0x39d050e8: 557, // pa-Arab-PK + 0x39d33000: 558, // pa-Guru + 0x39d33099: 559, // pa-Guru-IN + 0x3a100000: 560, // pap + 0x3b300000: 561, // pl + 0x3b3000e9: 562, // pl-PL + 0x3bd00000: 563, // prg + 0x3bd00001: 564, // prg-001 + 0x3be00000: 565, // ps + 0x3be00024: 566, // ps-AF + 0x3c000000: 567, // pt + 0x3c00002a: 568, // pt-AO + 0x3c000041: 569, // pt-BR + 0x3c00004e: 570, // pt-CH + 0x3c00005a: 571, // pt-CV + 0x3c000086: 572, // pt-GQ + 0x3c00008b: 573, // pt-GW + 0x3c0000b7: 574, // pt-LU + 0x3c0000c6: 575, // pt-MO + 0x3c0000d1: 576, // pt-MZ + 0x3c0000ee: 577, // pt-PT + 0x3c000118: 578, // pt-ST + 0x3c000126: 579, // pt-TL + 0x3c400000: 580, // qu + 0x3c40003f: 581, // qu-BO + 0x3c400069: 582, // qu-EC + 0x3c4000e4: 583, // qu-PE + 0x3d400000: 584, // rm + 0x3d40004e: 585, // rm-CH + 0x3d900000: 586, // rn + 0x3d90003a: 587, // rn-BI + 0x3dc00000: 588, // ro + 0x3dc000bc: 589, // ro-MD + 0x3dc00104: 590, // ro-RO + 0x3de00000: 591, // rof + 0x3de0012f: 592, // rof-TZ + 0x3e200000: 593, // ru + 0x3e200047: 594, // ru-BY + 0x3e2000a5: 595, // ru-KG + 0x3e2000ae: 596, // ru-KZ + 0x3e2000bc: 597, // ru-MD + 0x3e200106: 598, // ru-RU + 0x3e200130: 599, // ru-UA + 0x3e500000: 600, // rw + 0x3e500107: 601, // rw-RW + 0x3e600000: 602, // rwk + 0x3e60012f: 603, // rwk-TZ + 0x3eb00000: 604, // sah + 0x3eb00106: 605, // sah-RU + 0x3ec00000: 606, // saq + 0x3ec000a4: 607, // saq-KE + 0x3f300000: 608, // sbp + 0x3f30012f: 609, // sbp-TZ + 0x3fa00000: 610, // sd + 0x3fa000e8: 611, // sd-PK + 0x3fc00000: 612, // sdh + 0x3fd00000: 613, // se + 0x3fd00072: 614, // se-FI + 0x3fd000da: 615, // se-NO + 0x3fd0010c: 616, // se-SE + 0x3ff00000: 617, // seh + 0x3ff000d1: 618, // seh-MZ + 0x40100000: 619, // ses + 0x401000c3: 620, // ses-ML + 0x40200000: 621, // sg + 0x4020004c: 622, // sg-CF + 0x40800000: 623, // shi + 0x40857000: 624, // shi-Latn + 0x408570ba: 625, // shi-Latn-MA + 0x408dc000: 626, // shi-Tfng + 0x408dc0ba: 627, // shi-Tfng-MA + 0x40c00000: 628, // si + 0x40c000b3: 629, // si-LK + 0x41200000: 630, // sk + 0x41200111: 631, // sk-SK + 0x41600000: 632, // sl + 0x4160010f: 633, // sl-SI + 0x41c00000: 634, // sma + 0x41d00000: 635, // smi + 0x41e00000: 636, // smj + 0x41f00000: 637, // smn + 0x41f00072: 638, // smn-FI + 0x42200000: 639, // sms + 0x42300000: 640, // sn + 0x42300164: 641, // sn-ZW + 0x42900000: 642, // so + 0x42900062: 643, // so-DJ + 0x4290006f: 644, // so-ET + 0x429000a4: 645, // so-KE + 0x42900115: 646, // so-SO + 0x43100000: 647, // sq + 0x43100027: 648, // sq-AL + 0x431000c2: 649, // sq-MK + 0x4310014d: 650, // sq-XK + 0x43200000: 651, // sr + 0x4321f000: 652, // sr-Cyrl + 0x4321f033: 653, // sr-Cyrl-BA + 0x4321f0bd: 654, // sr-Cyrl-ME + 0x4321f105: 655, // sr-Cyrl-RS + 0x4321f14d: 656, // sr-Cyrl-XK + 0x43257000: 657, // sr-Latn + 0x43257033: 658, // sr-Latn-BA + 0x432570bd: 659, // sr-Latn-ME + 0x43257105: 660, // sr-Latn-RS + 0x4325714d: 661, // sr-Latn-XK + 0x43700000: 662, // ss + 0x43a00000: 663, // ssy + 0x43b00000: 664, // st + 0x44400000: 665, // sv + 0x44400031: 666, // sv-AX + 0x44400072: 667, // sv-FI + 0x4440010c: 668, // sv-SE + 0x44500000: 669, // sw + 0x4450004b: 670, // sw-CD + 0x445000a4: 671, // sw-KE + 0x4450012f: 672, // sw-TZ + 0x44500131: 673, // sw-UG + 0x44e00000: 674, // syr + 0x45000000: 675, // ta + 0x45000099: 676, // ta-IN + 0x450000b3: 677, // ta-LK + 0x450000d0: 678, // ta-MY + 0x4500010d: 679, // ta-SG + 0x46100000: 680, // te + 0x46100099: 681, // te-IN + 0x46400000: 682, // teo + 0x464000a4: 683, // teo-KE + 0x46400131: 684, // teo-UG + 0x46700000: 685, // tg + 0x46700124: 686, // tg-TJ + 0x46b00000: 687, // th + 0x46b00123: 688, // th-TH + 0x46f00000: 689, // ti + 0x46f0006d: 690, // ti-ER + 0x46f0006f: 691, // ti-ET + 0x47100000: 692, // tig + 0x47600000: 693, // tk + 0x47600127: 694, // tk-TM + 0x48000000: 695, // tn + 0x48200000: 696, // to + 0x48200129: 697, // to-TO + 0x48a00000: 698, // tr + 0x48a0005d: 699, // tr-CY + 0x48a0012b: 700, // tr-TR + 0x48e00000: 701, // ts + 0x49400000: 702, // tt + 0x49400106: 703, // tt-RU + 0x4a400000: 704, // twq + 0x4a4000d4: 705, // twq-NE + 0x4a900000: 706, // tzm + 0x4a9000ba: 707, // tzm-MA + 0x4ac00000: 708, // ug + 0x4ac00053: 709, // ug-CN + 0x4ae00000: 710, // uk + 0x4ae00130: 711, // uk-UA + 0x4b400000: 712, // ur + 0x4b400099: 713, // ur-IN + 0x4b4000e8: 714, // ur-PK + 0x4bc00000: 715, // uz + 0x4bc05000: 716, // uz-Arab + 0x4bc05024: 717, // uz-Arab-AF + 0x4bc1f000: 718, // uz-Cyrl + 0x4bc1f137: 719, // uz-Cyrl-UZ + 0x4bc57000: 720, // uz-Latn + 0x4bc57137: 721, // uz-Latn-UZ + 0x4be00000: 722, // vai + 0x4be57000: 723, // vai-Latn + 0x4be570b4: 724, // vai-Latn-LR + 0x4bee3000: 725, // vai-Vaii + 0x4bee30b4: 726, // vai-Vaii-LR + 0x4c000000: 727, // ve + 0x4c300000: 728, // vi + 0x4c30013e: 729, // vi-VN + 0x4c900000: 730, // vo + 0x4c900001: 731, // vo-001 + 0x4cc00000: 732, // vun + 0x4cc0012f: 733, // vun-TZ + 0x4ce00000: 734, // wa + 0x4cf00000: 735, // wae + 0x4cf0004e: 736, // wae-CH + 0x4e500000: 737, // wo + 0x4e500114: 738, // wo-SN + 0x4f200000: 739, // xh + 0x4fb00000: 740, // xog + 0x4fb00131: 741, // xog-UG + 0x50900000: 742, // yav + 0x50900052: 743, // yav-CM + 0x51200000: 744, // yi + 0x51200001: 745, // yi-001 + 0x51800000: 746, // yo + 0x5180003b: 747, // yo-BJ + 0x518000d6: 748, // yo-NG + 0x51f00000: 749, // yue + 0x51f38000: 750, // yue-Hans + 0x51f38053: 751, // yue-Hans-CN + 0x51f39000: 752, // yue-Hant + 0x51f3908d: 753, // yue-Hant-HK + 0x52800000: 754, // zgh + 0x528000ba: 755, // zgh-MA + 0x52900000: 756, // zh + 0x52938000: 757, // zh-Hans + 0x52938053: 758, // zh-Hans-CN + 0x5293808d: 759, // zh-Hans-HK + 0x529380c6: 760, // zh-Hans-MO + 0x5293810d: 761, // zh-Hans-SG + 0x52939000: 762, // zh-Hant + 0x5293908d: 763, // zh-Hant-HK + 0x529390c6: 764, // zh-Hant-MO + 0x5293912e: 765, // zh-Hant-TW + 0x52f00000: 766, // zu + 0x52f00161: 767, // zu-ZA +} + +// Total table size 4676 bytes (4KiB); checksum: 17BE3673 diff --git a/vendor/golang.org/x/text/language/language.go b/vendor/golang.org/x/text/language/language.go index abfa17f6..b65e213f 100644 --- a/vendor/golang.org/x/text/language/language.go +++ b/vendor/golang.org/x/text/language/language.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate go run gen.go -output tables.go +//go:generate go run gen.go gen_common.go -output tables.go +//go:generate go run gen_index.go package language @@ -10,34 +11,47 @@ package language // - verifying that tables are dropped correctly (most notably matcher tables). import ( + "errors" + "fmt" "strings" +) - "golang.org/x/text/internal/language" - "golang.org/x/text/internal/language/compact" +const ( + // maxCoreSize is the maximum size of a BCP 47 tag without variants and + // extensions. Equals max lang (3) + script (4) + max reg (3) + 2 dashes. + maxCoreSize = 12 + + // max99thPercentileSize is a somewhat arbitrary buffer size that presumably + // is large enough to hold at least 99% of the BCP 47 tags. + max99thPercentileSize = 32 + + // maxSimpleUExtensionSize is the maximum size of a -u extension with one + // key-type pair. Equals len("-u-") + key (2) + dash + max value (8). + maxSimpleUExtensionSize = 14 ) // Tag represents a BCP 47 language tag. It is used to specify an instance of a // specific language or locale. All language tag values are guaranteed to be // well-formed. -type Tag compact.Tag +type Tag struct { + lang langID + region regionID + // TODO: we will soon run out of positions for script. Idea: instead of + // storing lang, region, and script codes, store only the compact index and + // have a lookup table from this code to its expansion. This greatly speeds + // up table lookup, speed up common variant cases. + // This will also immediately free up 3 extra bytes. Also, the pVariant + // field can now be moved to the lookup table, as the compact index uniquely + // determines the offset of a possible variant. + script scriptID + pVariant byte // offset in str, includes preceding '-' + pExt uint16 // offset of first extension, includes preceding '-' -func makeTag(t language.Tag) (tag Tag) { - return Tag(compact.Make(t)) + // str is the string representation of the Tag. It will only be used if the + // tag has variants or extensions. + str string } -func (t *Tag) tag() language.Tag { - return (*compact.Tag)(t).Tag() -} - -func (t *Tag) isCompact() bool { - return (*compact.Tag)(t).IsCompact() -} - -// TODO: improve performance. -func (t *Tag) lang() language.Language { return t.tag().LangID } -func (t *Tag) region() language.Region { return t.tag().RegionID } -func (t *Tag) script() language.Script { return t.tag().ScriptID } - // Make is a convenience wrapper for Parse that omits the error. // In case of an error, a sensible default is returned. func Make(s string) Tag { @@ -54,13 +68,25 @@ func (c CanonType) Make(s string) Tag { // Raw returns the raw base language, script and region, without making an // attempt to infer their values. func (t Tag) Raw() (b Base, s Script, r Region) { - tt := t.tag() - return Base{tt.LangID}, Script{tt.ScriptID}, Region{tt.RegionID} + return Base{t.lang}, Script{t.script}, Region{t.region} +} + +// equalTags compares language, script and region subtags only. +func (t Tag) equalTags(a Tag) bool { + return t.lang == a.lang && t.script == a.script && t.region == a.region } // IsRoot returns true if t is equal to language "und". func (t Tag) IsRoot() bool { - return compact.Tag(t).IsRoot() + if int(t.pVariant) < len(t.str) { + return false + } + return t.equalTags(und) +} + +// private reports whether the Tag consists solely of a private use tag. +func (t Tag) private() bool { + return t.str != "" && t.pVariant == 0 } // CanonType can be used to enable or disable various types of canonicalization. @@ -112,73 +138,73 @@ const ( // canonicalize returns the canonicalized equivalent of the tag and // whether there was any change. -func canonicalize(c CanonType, t language.Tag) (language.Tag, bool) { +func (t Tag) canonicalize(c CanonType) (Tag, bool) { if c == Raw { return t, false } changed := false if c&SuppressScript != 0 { - if t.LangID.SuppressScript() == t.ScriptID { - t.ScriptID = 0 + if t.lang < langNoIndexOffset && uint8(t.script) == suppressScript[t.lang] { + t.script = 0 changed = true } } if c&canonLang != 0 { for { - if l, aliasType := t.LangID.Canonicalize(); l != t.LangID { + if l, aliasType := normLang(t.lang); l != t.lang { switch aliasType { - case language.Legacy: + case langLegacy: if c&Legacy != 0 { - if t.LangID == _sh && t.ScriptID == 0 { - t.ScriptID = _Latn + if t.lang == _sh && t.script == 0 { + t.script = _Latn } - t.LangID = l + t.lang = l changed = true } - case language.Macro: + case langMacro: if c&Macro != 0 { // We deviate here from CLDR. The mapping "nb" -> "no" // qualifies as a typical Macro language mapping. However, // for legacy reasons, CLDR maps "no", the macro language // code for Norwegian, to the dominant variant "nb". This // change is currently under consideration for CLDR as well. - // See https://unicode.org/cldr/trac/ticket/2698 and also - // https://unicode.org/cldr/trac/ticket/1790 for some of the + // See http://unicode.org/cldr/trac/ticket/2698 and also + // http://unicode.org/cldr/trac/ticket/1790 for some of the // practical implications. TODO: this check could be removed // if CLDR adopts this change. - if c&CLDR == 0 || t.LangID != _nb { + if c&CLDR == 0 || t.lang != _nb { changed = true - t.LangID = l + t.lang = l } } - case language.Deprecated: + case langDeprecated: if c&DeprecatedBase != 0 { - if t.LangID == _mo && t.RegionID == 0 { - t.RegionID = _MD + if t.lang == _mo && t.region == 0 { + t.region = _MD } - t.LangID = l + t.lang = l changed = true // Other canonicalization types may still apply. continue } } - } else if c&Legacy != 0 && t.LangID == _no && c&CLDR != 0 { - t.LangID = _nb + } else if c&Legacy != 0 && t.lang == _no && c&CLDR != 0 { + t.lang = _nb changed = true } break } } if c&DeprecatedScript != 0 { - if t.ScriptID == _Qaai { + if t.script == _Qaai { changed = true - t.ScriptID = _Zinh + t.script = _Zinh } } if c&DeprecatedRegion != 0 { - if r := t.RegionID.Canonicalize(); r != t.RegionID { + if r := normRegion(t.region); r != 0 { changed = true - t.RegionID = r + t.region = r } } return t, changed @@ -186,20 +212,11 @@ func canonicalize(c CanonType, t language.Tag) (language.Tag, bool) { // Canonicalize returns the canonicalized equivalent of the tag. func (c CanonType) Canonicalize(t Tag) (Tag, error) { - // First try fast path. - if t.isCompact() { - if _, changed := canonicalize(c, compact.Tag(t).Tag()); !changed { - return t, nil - } - } - // It is unlikely that one will canonicalize a tag after matching. So do - // a slow but simple approach here. - if tag, changed := canonicalize(c, t.tag()); changed { - tag.RemakeString() - return makeTag(tag), nil + t, changed := t.canonicalize(c) + if changed { + t.remakeString() } return t, nil - } // Confidence indicates the level of certainty for a given return value. @@ -222,21 +239,83 @@ func (c Confidence) String() string { return confName[c] } +// remakeString is used to update t.str in case lang, script or region changed. +// It is assumed that pExt and pVariant still point to the start of the +// respective parts. +func (t *Tag) remakeString() { + if t.str == "" { + return + } + extra := t.str[t.pVariant:] + if t.pVariant > 0 { + extra = extra[1:] + } + if t.equalTags(und) && strings.HasPrefix(extra, "x-") { + t.str = extra + t.pVariant = 0 + t.pExt = 0 + return + } + var buf [max99thPercentileSize]byte // avoid extra memory allocation in most cases. + b := buf[:t.genCoreBytes(buf[:])] + if extra != "" { + diff := len(b) - int(t.pVariant) + b = append(b, '-') + b = append(b, extra...) + t.pVariant = uint8(int(t.pVariant) + diff) + t.pExt = uint16(int(t.pExt) + diff) + } else { + t.pVariant = uint8(len(b)) + t.pExt = uint16(len(b)) + } + t.str = string(b) +} + +// genCoreBytes writes a string for the base languages, script and region tags +// to the given buffer and returns the number of bytes written. It will never +// write more than maxCoreSize bytes. +func (t *Tag) genCoreBytes(buf []byte) int { + n := t.lang.stringToBuf(buf[:]) + if t.script != 0 { + n += copy(buf[n:], "-") + n += copy(buf[n:], t.script.String()) + } + if t.region != 0 { + n += copy(buf[n:], "-") + n += copy(buf[n:], t.region.String()) + } + return n +} + // String returns the canonical string representation of the language tag. func (t Tag) String() string { - return t.tag().String() + if t.str != "" { + return t.str + } + if t.script == 0 && t.region == 0 { + return t.lang.String() + } + buf := [maxCoreSize]byte{} + return string(buf[:t.genCoreBytes(buf[:])]) } // MarshalText implements encoding.TextMarshaler. func (t Tag) MarshalText() (text []byte, err error) { - return t.tag().MarshalText() + if t.str != "" { + text = append(text, t.str...) + } else if t.script == 0 && t.region == 0 { + text = append(text, t.lang.String()...) + } else { + buf := [maxCoreSize]byte{} + text = buf[:t.genCoreBytes(buf[:])] + } + return text, nil } // UnmarshalText implements encoding.TextUnmarshaler. func (t *Tag) UnmarshalText(text []byte) error { - var tag language.Tag - err := tag.UnmarshalText(text) - *t = makeTag(tag) + tag, err := Raw.Parse(string(text)) + *t = tag return err } @@ -244,16 +323,15 @@ func (t *Tag) UnmarshalText(text []byte) error { // unspecified, an attempt will be made to infer it from the context. // It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. func (t Tag) Base() (Base, Confidence) { - if b := t.lang(); b != 0 { - return Base{b}, Exact + if t.lang != 0 { + return Base{t.lang}, Exact } - tt := t.tag() c := High - if tt.ScriptID == 0 && !tt.RegionID.IsCountry() { + if t.script == 0 && !(Region{t.region}).IsCountry() { c = Low } - if tag, err := tt.Maximize(); err == nil && tag.LangID != 0 { - return Base{tag.LangID}, c + if tag, err := addTags(t); err == nil && tag.lang != 0 { + return Base{tag.lang}, c } return Base{0}, No } @@ -266,34 +344,35 @@ func (t Tag) Base() (Base, Confidence) { // If a script cannot be inferred (Zzzz, No) is returned. We do not use Zyyy (undetermined) // as one would suspect from the IANA registry for BCP 47. In a Unicode context Zyyy marks // common characters (like 1, 2, 3, '.', etc.) and is therefore more like multiple scripts. -// See https://www.unicode.org/reports/tr24/#Values for more details. Zzzz is also used for +// See http://www.unicode.org/reports/tr24/#Values for more details. Zzzz is also used for // unknown value in CLDR. (Zzzz, Exact) is returned if Zzzz was explicitly specified. // Note that an inferred script is never guaranteed to be the correct one. Latin is // almost exclusively used for Afrikaans, but Arabic has been used for some texts // in the past. Also, the script that is commonly used may change over time. // It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. func (t Tag) Script() (Script, Confidence) { - if scr := t.script(); scr != 0 { - return Script{scr}, Exact + if t.script != 0 { + return Script{t.script}, Exact } - tt := t.tag() - sc, c := language.Script(_Zzzz), No - if scr := tt.LangID.SuppressScript(); scr != 0 { - // Note: it is not always the case that a language with a suppress - // script value is only written in one script (e.g. kk, ms, pa). - if tt.RegionID == 0 { - return Script{scr}, High + sc, c := scriptID(_Zzzz), No + if t.lang < langNoIndexOffset { + if scr := scriptID(suppressScript[t.lang]); scr != 0 { + // Note: it is not always the case that a language with a suppress + // script value is only written in one script (e.g. kk, ms, pa). + if t.region == 0 { + return Script{scriptID(scr)}, High + } + sc, c = scr, High } - sc, c = scr, High } - if tag, err := tt.Maximize(); err == nil { - if tag.ScriptID != sc { - sc, c = tag.ScriptID, Low + if tag, err := addTags(t); err == nil { + if tag.script != sc { + sc, c = tag.script, Low } } else { - tt, _ = canonicalize(Deprecated|Macro, tt) - if tag, err := tt.Maximize(); err == nil && tag.ScriptID != sc { - sc, c = tag.ScriptID, Low + t, _ = (Deprecated | Macro).Canonicalize(t) + if tag, err := addTags(t); err == nil && tag.script != sc { + sc, c = tag.script, Low } } return Script{sc}, c @@ -303,31 +382,28 @@ func (t Tag) Script() (Script, Confidence) { // infer a most likely candidate from the context. // It uses a variant of CLDR's Add Likely Subtags algorithm. This is subject to change. func (t Tag) Region() (Region, Confidence) { - if r := t.region(); r != 0 { - return Region{r}, Exact + if t.region != 0 { + return Region{t.region}, Exact } - tt := t.tag() - if tt, err := tt.Maximize(); err == nil { - return Region{tt.RegionID}, Low // TODO: differentiate between high and low. + if t, err := addTags(t); err == nil { + return Region{t.region}, Low // TODO: differentiate between high and low. } - tt, _ = canonicalize(Deprecated|Macro, tt) - if tag, err := tt.Maximize(); err == nil { - return Region{tag.RegionID}, Low + t, _ = (Deprecated | Macro).Canonicalize(t) + if tag, err := addTags(t); err == nil { + return Region{tag.region}, Low } return Region{_ZZ}, No // TODO: return world instead of undetermined? } -// Variants returns the variants specified explicitly for this language tag. +// Variant returns the variants specified explicitly for this language tag. // or nil if no variant was specified. func (t Tag) Variants() []Variant { - if !compact.Tag(t).MayHaveVariants() { - return nil - } v := []Variant{} - x, str := "", t.tag().Variants() - for str != "" { - x, str = nextToken(str) - v = append(v, Variant{x}) + if int(t.pVariant) < int(t.pExt) { + for x, str := "", t.str[t.pVariant:t.pExt]; str != ""; { + x, str = nextToken(str) + v = append(v, Variant{x}) + } } return v } @@ -335,13 +411,57 @@ func (t Tag) Variants() []Variant { // Parent returns the CLDR parent of t. In CLDR, missing fields in data for a // specific language are substituted with fields from the parent language. // The parent for a language may change for newer versions of CLDR. -// -// Parent returns a tag for a less specific language that is mutually -// intelligible or Und if there is no such language. This may not be the same as -// simply stripping the last BCP 47 subtag. For instance, the parent of "zh-TW" -// is "zh-Hant", and the parent of "zh-Hant" is "und". func (t Tag) Parent() Tag { - return Tag(compact.Tag(t).Parent()) + if t.str != "" { + // Strip the variants and extensions. + t, _ = Raw.Compose(t.Raw()) + if t.region == 0 && t.script != 0 && t.lang != 0 { + base, _ := addTags(Tag{lang: t.lang}) + if base.script == t.script { + return Tag{lang: t.lang} + } + } + return t + } + if t.lang != 0 { + if t.region != 0 { + maxScript := t.script + if maxScript == 0 { + max, _ := addTags(t) + maxScript = max.script + } + + for i := range parents { + if langID(parents[i].lang) == t.lang && scriptID(parents[i].maxScript) == maxScript { + for _, r := range parents[i].fromRegion { + if regionID(r) == t.region { + return Tag{ + lang: t.lang, + script: scriptID(parents[i].script), + region: regionID(parents[i].toRegion), + } + } + } + } + } + + // Strip the script if it is the default one. + base, _ := addTags(Tag{lang: t.lang}) + if base.script != maxScript { + return Tag{lang: t.lang, script: maxScript} + } + return Tag{lang: t.lang} + } else if t.script != 0 { + // The parent for an base-script pair with a non-default script is + // "und" instead of the base language. + base, _ := addTags(Tag{lang: t.lang}) + if base.script != t.script { + return und + } + return Tag{lang: t.lang} + } + } + return und } // returns token t and the rest of the string. @@ -367,8 +487,17 @@ func (e Extension) String() string { // ParseExtension parses s as an extension and returns it on success. func ParseExtension(s string) (e Extension, err error) { - ext, err := language.ParseExtension(s) - return Extension{ext}, err + scan := makeScannerString(s) + var end int + if n := len(scan.token); n != 1 { + return Extension{}, errSyntax + } + scan.toLower(0, len(scan.b)) + end = parseExtension(&scan) + if end != len(s) { + return Extension{}, errSyntax + } + return Extension{string(scan.b)}, nil } // Type returns the one-byte extension type of e. It returns 0 for the zero @@ -389,20 +518,22 @@ func (e Extension) Tokens() []string { // false for ok if t does not have the requested extension. The returned // extension will be invalid in this case. func (t Tag) Extension(x byte) (ext Extension, ok bool) { - if !compact.Tag(t).MayHaveExtensions() { - return Extension{}, false + for i := int(t.pExt); i < len(t.str)-1; { + var ext string + i, ext = getExtension(t.str, i) + if ext[0] == x { + return Extension{ext}, true + } } - e, ok := t.tag().Extension(x) - return Extension{e}, ok + return Extension{}, false } // Extensions returns all extensions of t. func (t Tag) Extensions() []Extension { - if !compact.Tag(t).MayHaveExtensions() { - return nil - } e := []Extension{} - for _, ext := range t.tag().Extensions() { + for i := int(t.pExt); i < len(t.str)-1; { + var ext string + i, ext = getExtension(t.str, i) e = append(e, Extension{ext}) } return e @@ -410,105 +541,259 @@ func (t Tag) Extensions() []Extension { // TypeForKey returns the type associated with the given key, where key and type // are of the allowed values defined for the Unicode locale extension ('u') in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. // TypeForKey will traverse the inheritance chain to get the correct value. func (t Tag) TypeForKey(key string) string { - if !compact.Tag(t).MayHaveExtensions() { - if key != "rg" && key != "va" { - return "" - } + if start, end, _ := t.findTypeForKey(key); end != start { + return t.str[start:end] } - return t.tag().TypeForKey(key) + return "" } +var ( + errPrivateUse = errors.New("cannot set a key on a private use tag") + errInvalidArguments = errors.New("invalid key or type") +) + // SetTypeForKey returns a new Tag with the key set to type, where key and type // are of the allowed values defined for the Unicode locale extension ('u') in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. // An empty value removes an existing pair with the same key. func (t Tag) SetTypeForKey(key, value string) (Tag, error) { - tt, err := t.tag().SetTypeForKey(key, value) - return makeTag(tt), err + if t.private() { + return t, errPrivateUse + } + if len(key) != 2 { + return t, errInvalidArguments + } + + // Remove the setting if value is "". + if value == "" { + start, end, _ := t.findTypeForKey(key) + if start != end { + // Remove key tag and leading '-'. + start -= 4 + + // Remove a possible empty extension. + if (end == len(t.str) || t.str[end+2] == '-') && t.str[start-2] == '-' { + start -= 2 + } + if start == int(t.pVariant) && end == len(t.str) { + t.str = "" + t.pVariant, t.pExt = 0, 0 + } else { + t.str = fmt.Sprintf("%s%s", t.str[:start], t.str[end:]) + } + } + return t, nil + } + + if len(value) < 3 || len(value) > 8 { + return t, errInvalidArguments + } + + var ( + buf [maxCoreSize + maxSimpleUExtensionSize]byte + uStart int // start of the -u extension. + ) + + // Generate the tag string if needed. + if t.str == "" { + uStart = t.genCoreBytes(buf[:]) + buf[uStart] = '-' + uStart++ + } + + // Create new key-type pair and parse it to verify. + b := buf[uStart:] + copy(b, "u-") + copy(b[2:], key) + b[4] = '-' + b = b[:5+copy(b[5:], value)] + scan := makeScanner(b) + if parseExtensions(&scan); scan.err != nil { + return t, scan.err + } + + // Assemble the replacement string. + if t.str == "" { + t.pVariant, t.pExt = byte(uStart-1), uint16(uStart-1) + t.str = string(buf[:uStart+len(b)]) + } else { + s := t.str + start, end, hasExt := t.findTypeForKey(key) + if start == end { + if hasExt { + b = b[2:] + } + t.str = fmt.Sprintf("%s-%s%s", s[:start], b, s[end:]) + } else { + t.str = fmt.Sprintf("%s%s%s", s[:start], value, s[end:]) + } + } + return t, nil } -// NumCompactTags is the number of compact tags. The maximum tag is -// NumCompactTags-1. -const NumCompactTags = compact.NumCompactTags +// findKeyAndType returns the start and end position for the type corresponding +// to key or the point at which to insert the key-value pair if the type +// wasn't found. The hasExt return value reports whether an -u extension was present. +// Note: the extensions are typically very small and are likely to contain +// only one key-type pair. +func (t Tag) findTypeForKey(key string) (start, end int, hasExt bool) { + p := int(t.pExt) + if len(key) != 2 || p == len(t.str) || p == 0 { + return p, p, false + } + s := t.str + + // Find the correct extension. + for p++; s[p] != 'u'; p++ { + if s[p] > 'u' { + p-- + return p, p, false + } + if p = nextExtension(s, p); p == len(s) { + return len(s), len(s), false + } + } + // Proceed to the hyphen following the extension name. + p++ + + // curKey is the key currently being processed. + curKey := "" + + // Iterate over keys until we get the end of a section. + for { + // p points to the hyphen preceding the current token. + if p3 := p + 3; s[p3] == '-' { + // Found a key. + // Check whether we just processed the key that was requested. + if curKey == key { + return start, p, true + } + // Set to the next key and continue scanning type tokens. + curKey = s[p+1 : p3] + if curKey > key { + return p, p, true + } + // Start of the type token sequence. + start = p + 4 + // A type is at least 3 characters long. + p += 7 // 4 + 3 + } else { + // Attribute or type, which is at least 3 characters long. + p += 4 + } + // p points past the third character of a type or attribute. + max := p + 5 // maximum length of token plus hyphen. + if len(s) < max { + max = len(s) + } + for ; p < max && s[p] != '-'; p++ { + } + // Bail if we have exhausted all tokens or if the next token starts + // a new extension. + if p == len(s) || s[p+2] == '-' { + if curKey == key { + return start, p, true + } + return p, p, true + } + } +} // CompactIndex returns an index, where 0 <= index < NumCompactTags, for tags -// for which data exists in the text repository.The index will change over time -// and should not be stored in persistent storage. If t does not match a compact -// index, exact will be false and the compact index will be returned for the -// first match after repeatedly taking the Parent of t. -func CompactIndex(t Tag) (index int, exact bool) { - id, exact := compact.LanguageID(compact.Tag(t)) - return int(id), exact +// for which data exists in the text repository. The index will change over time +// and should not be stored in persistent storage. Extensions, except for the +// 'va' type of the 'u' extension, are ignored. It will return 0, false if no +// compact tag exists, where 0 is the index for the root language (Und). +func CompactIndex(t Tag) (index int, ok bool) { + // TODO: perhaps give more frequent tags a lower index. + // TODO: we could make the indexes stable. This will excluded some + // possibilities for optimization, so don't do this quite yet. + b, s, r := t.Raw() + if len(t.str) > 0 { + if strings.HasPrefix(t.str, "x-") { + // We have no entries for user-defined tags. + return 0, false + } + if uint16(t.pVariant) != t.pExt { + // There are no tags with variants and an u-va type. + if t.TypeForKey("va") != "" { + return 0, false + } + t, _ = Raw.Compose(b, s, r, t.Variants()) + } else if _, ok := t.Extension('u'); ok { + // Strip all but the 'va' entry. + variant := t.TypeForKey("va") + t, _ = Raw.Compose(b, s, r) + t, _ = t.SetTypeForKey("va", variant) + } + if len(t.str) > 0 { + // We have some variants. + for i, s := range specialTags { + if s == t { + return i + 1, true + } + } + return 0, false + } + } + // No variants specified: just compare core components. + // The key has the form lllssrrr, where l, s, and r are nibbles for + // respectively the langID, scriptID, and regionID. + key := uint32(b.langID) << (8 + 12) + key |= uint32(s.scriptID) << 12 + key |= uint32(r.regionID) + x, ok := coreTags[key] + return int(x), ok } -var root = language.Tag{} - // Base is an ISO 639 language code, used for encoding the base language // of a language tag. type Base struct { - langID language.Language + langID } // ParseBase parses a 2- or 3-letter ISO 639 code. // It returns a ValueError if s is a well-formed but unknown language identifier // or another error if another error occurred. func ParseBase(s string) (Base, error) { - l, err := language.ParseBase(s) + if n := len(s); n < 2 || 3 < n { + return Base{}, errSyntax + } + var buf [3]byte + l, err := getLangID(buf[:copy(buf[:], s)]) return Base{l}, err } -// String returns the BCP 47 representation of the base language. -func (b Base) String() string { - return b.langID.String() -} - -// ISO3 returns the ISO 639-3 language code. -func (b Base) ISO3() string { - return b.langID.ISO3() -} - -// IsPrivateUse reports whether this language code is reserved for private use. -func (b Base) IsPrivateUse() bool { - return b.langID.IsPrivateUse() -} - // Script is a 4-letter ISO 15924 code for representing scripts. // It is idiomatically represented in title case. type Script struct { - scriptID language.Script + scriptID } // ParseScript parses a 4-letter ISO 15924 code. // It returns a ValueError if s is a well-formed but unknown script identifier // or another error if another error occurred. func ParseScript(s string) (Script, error) { - sc, err := language.ParseScript(s) + if len(s) != 4 { + return Script{}, errSyntax + } + var buf [4]byte + sc, err := getScriptID(script, buf[:copy(buf[:], s)]) return Script{sc}, err } -// String returns the script code in title case. -// It returns "Zzzz" for an unspecified script. -func (s Script) String() string { - return s.scriptID.String() -} - -// IsPrivateUse reports whether this script code is reserved for private use. -func (s Script) IsPrivateUse() bool { - return s.scriptID.IsPrivateUse() -} - // Region is an ISO 3166-1 or UN M.49 code for representing countries and regions. type Region struct { - regionID language.Region + regionID } // EncodeM49 returns the Region for the given UN M.49 code. // It returns an error if r is not a valid code. func EncodeM49(r int) (Region, error) { - rid, err := language.EncodeM49(r) + rid, err := getRegionM49(r) return Region{rid}, err } @@ -516,54 +801,62 @@ func EncodeM49(r int) (Region, error) { // It returns a ValueError if s is a well-formed but unknown region identifier // or another error if another error occurred. func ParseRegion(s string) (Region, error) { - r, err := language.ParseRegion(s) + if n := len(s); n < 2 || 3 < n { + return Region{}, errSyntax + } + var buf [3]byte + r, err := getRegionID(buf[:copy(buf[:], s)]) return Region{r}, err } -// String returns the BCP 47 representation for the region. -// It returns "ZZ" for an unspecified region. -func (r Region) String() string { - return r.regionID.String() -} - -// ISO3 returns the 3-letter ISO code of r. -// Note that not all regions have a 3-letter ISO code. -// In such cases this method returns "ZZZ". -func (r Region) ISO3() string { - return r.regionID.ISO3() -} - -// M49 returns the UN M.49 encoding of r, or 0 if this encoding -// is not defined for r. -func (r Region) M49() int { - return r.regionID.M49() -} - -// IsPrivateUse reports whether r has the ISO 3166 User-assigned status. This -// may include private-use tags that are assigned by CLDR and used in this -// implementation. So IsPrivateUse and IsCountry can be simultaneously true. -func (r Region) IsPrivateUse() bool { - return r.regionID.IsPrivateUse() -} - // IsCountry returns whether this region is a country or autonomous area. This // includes non-standard definitions from CLDR. func (r Region) IsCountry() bool { - return r.regionID.IsCountry() + if r.regionID == 0 || r.IsGroup() || r.IsPrivateUse() && r.regionID != _XK { + return false + } + return true } // IsGroup returns whether this region defines a collection of regions. This // includes non-standard definitions from CLDR. func (r Region) IsGroup() bool { - return r.regionID.IsGroup() + if r.regionID == 0 { + return false + } + return int(regionInclusion[r.regionID]) < len(regionContainment) } // Contains returns whether Region c is contained by Region r. It returns true // if c == r. func (r Region) Contains(c Region) bool { - return r.regionID.Contains(c.regionID) + return r.regionID.contains(c.regionID) } +func (r regionID) contains(c regionID) bool { + if r == c { + return true + } + g := regionInclusion[r] + if g >= nRegionGroups { + return false + } + m := regionContainment[g] + + d := regionInclusion[c] + b := regionInclusionBits[d] + + // A contained country may belong to multiple disjoint groups. Matching any + // of these indicates containment. If the contained region is a group, it + // must strictly be a subset. + if d >= nRegionGroups { + return b&m != 0 + } + return b&^m == 0 +} + +var errNoTLD = errors.New("language: region is not a valid ccTLD") + // TLD returns the country code top-level domain (ccTLD). UK is returned for GB. // In all other cases it returns either the region itself or an error. // @@ -572,15 +865,25 @@ func (r Region) Contains(c Region) bool { // region will already be canonicalized it was obtained from a Tag that was // obtained using any of the default methods. func (r Region) TLD() (Region, error) { - tld, err := r.regionID.TLD() - return Region{tld}, err + // See http://en.wikipedia.org/wiki/Country_code_top-level_domain for the + // difference between ISO 3166-1 and IANA ccTLD. + if r.regionID == _GB { + r = Region{_UK} + } + if (r.typ() & ccTLD) == 0 { + return Region{}, errNoTLD + } + return r, nil } // Canonicalize returns the region or a possible replacement if the region is // deprecated. It will not return a replacement for deprecated regions that // are split into multiple regions. func (r Region) Canonicalize() Region { - return Region{r.regionID.Canonicalize()} + if cr := normRegion(r.regionID); cr != 0 { + return Region{cr} + } + return r } // Variant represents a registered variant of a language as defined by BCP 47. @@ -591,8 +894,11 @@ type Variant struct { // ParseVariant parses and returns a Variant. An error is returned if s is not // a valid variant. func ParseVariant(s string) (Variant, error) { - v, err := language.ParseVariant(s) - return Variant{v.String()}, err + s = strings.ToLower(s) + if _, ok := variantIndex[s]; ok { + return Variant{s}, nil + } + return Variant{}, mkErrInvalid([]byte(s)) } // String returns the string representation of the variant. diff --git a/vendor/golang.org/x/text/internal/language/lookup.go b/vendor/golang.org/x/text/language/lookup.go similarity index 80% rename from vendor/golang.org/x/text/internal/language/lookup.go rename to vendor/golang.org/x/text/language/lookup.go index 6294b815..1d80ac37 100644 --- a/vendor/golang.org/x/text/internal/language/lookup.go +++ b/vendor/golang.org/x/text/language/lookup.go @@ -17,11 +17,11 @@ import ( // if it could not be found. func findIndex(idx tag.Index, key []byte, form string) (index int, err error) { if !tag.FixCase(form, key) { - return 0, ErrSyntax + return 0, errSyntax } i := idx.Index(key) if i == -1 { - return 0, NewValueError(key) + return 0, mkErrInvalid(key) } return i, nil } @@ -32,45 +32,38 @@ func searchUint(imap []uint16, key uint16) int { }) } -type Language uint16 +type langID uint16 // getLangID returns the langID of s if s is a canonical subtag // or langUnknown if s is not a canonical subtag. -func getLangID(s []byte) (Language, error) { +func getLangID(s []byte) (langID, error) { if len(s) == 2 { return getLangISO2(s) } return getLangISO3(s) } -// TODO language normalization as well as the AliasMaps could be moved to the -// higher level package, but it is a bit tricky to separate the generation. - -func (id Language) Canonicalize() (Language, AliasType) { - return normLang(id) -} - // mapLang returns the mapped langID of id according to mapping m. -func normLang(id Language) (Language, AliasType) { - k := sort.Search(len(AliasMap), func(i int) bool { - return AliasMap[i].From >= uint16(id) +func normLang(id langID) (langID, langAliasType) { + k := sort.Search(len(langAliasMap), func(i int) bool { + return langAliasMap[i].from >= uint16(id) }) - if k < len(AliasMap) && AliasMap[k].From == uint16(id) { - return Language(AliasMap[k].To), AliasTypes[k] + if k < len(langAliasMap) && langAliasMap[k].from == uint16(id) { + return langID(langAliasMap[k].to), langAliasTypes[k] } - return id, AliasTypeUnknown + return id, langAliasTypeUnknown } // getLangISO2 returns the langID for the given 2-letter ISO language code // or unknownLang if this does not exist. -func getLangISO2(s []byte) (Language, error) { +func getLangISO2(s []byte) (langID, error) { if !tag.FixCase("zz", s) { - return 0, ErrSyntax + return 0, errSyntax } if i := lang.Index(s); i != -1 && lang.Elem(i)[3] != 0 { - return Language(i), nil + return langID(i), nil } - return 0, NewValueError(s) + return 0, mkErrInvalid(s) } const base = 'z' - 'a' + 1 @@ -95,7 +88,7 @@ func intToStr(v uint, s []byte) { // getLangISO3 returns the langID for the given 3-letter ISO language code // or unknownLang if this does not exist. -func getLangISO3(s []byte) (Language, error) { +func getLangISO3(s []byte) (langID, error) { if tag.FixCase("und", s) { // first try to match canonical 3-letter entries for i := lang.Index(s[:2]); i != -1; i = lang.Next(s[:2], i) { @@ -103,7 +96,7 @@ func getLangISO3(s []byte) (Language, error) { // We treat "und" as special and always translate it to "unspecified". // Note that ZZ and Zzzz are private use and are not treated as // unspecified by default. - id := Language(i) + id := langID(i) if id == nonCanonicalUnd { return 0, nil } @@ -111,26 +104,26 @@ func getLangISO3(s []byte) (Language, error) { } } if i := altLangISO3.Index(s); i != -1 { - return Language(altLangIndex[altLangISO3.Elem(i)[3]]), nil + return langID(altLangIndex[altLangISO3.Elem(i)[3]]), nil } n := strToInt(s) if langNoIndex[n/8]&(1<<(n%8)) != 0 { - return Language(n) + langNoIndexOffset, nil + return langID(n) + langNoIndexOffset, nil } // Check for non-canonical uses of ISO3. for i := lang.Index(s[:1]); i != -1; i = lang.Next(s[:1], i) { if e := lang.Elem(i); e[2] == s[1] && e[3] == s[2] { - return Language(i), nil + return langID(i), nil } } - return 0, NewValueError(s) + return 0, mkErrInvalid(s) } - return 0, ErrSyntax + return 0, errSyntax } -// StringToBuf writes the string to b and returns the number of bytes +// stringToBuf writes the string to b and returns the number of bytes // written. cap(b) must be >= 3. -func (id Language) StringToBuf(b []byte) int { +func (id langID) stringToBuf(b []byte) int { if id >= langNoIndexOffset { intToStr(uint(id)-langNoIndexOffset, b[:3]) return 3 @@ -147,7 +140,7 @@ func (id Language) StringToBuf(b []byte) int { // String returns the BCP 47 representation of the langID. // Use b as variable name, instead of id, to ensure the variable // used is consistent with that of Base in which this type is embedded. -func (b Language) String() string { +func (b langID) String() string { if b == 0 { return "und" } else if b >= langNoIndexOffset { @@ -164,7 +157,7 @@ func (b Language) String() string { } // ISO3 returns the ISO 639-3 language code. -func (b Language) ISO3() string { +func (b langID) ISO3() string { if b == 0 || b >= langNoIndexOffset { return b.String() } @@ -180,24 +173,15 @@ func (b Language) ISO3() string { } // IsPrivateUse reports whether this language code is reserved for private use. -func (b Language) IsPrivateUse() bool { +func (b langID) IsPrivateUse() bool { return langPrivateStart <= b && b <= langPrivateEnd } -// SuppressScript returns the script marked as SuppressScript in the IANA -// language tag repository, or 0 if there is no such script. -func (b Language) SuppressScript() Script { - if b < langNoIndexOffset { - return Script(suppressScript[b]) - } - return 0 -} - -type Region uint16 +type regionID uint16 // getRegionID returns the region id for s if s is a valid 2-letter region code // or unknownRegion. -func getRegionID(s []byte) (Region, error) { +func getRegionID(s []byte) (regionID, error) { if len(s) == 3 { if isAlpha(s[0]) { return getRegionISO3(s) @@ -211,34 +195,34 @@ func getRegionID(s []byte) (Region, error) { // getRegionISO2 returns the regionID for the given 2-letter ISO country code // or unknownRegion if this does not exist. -func getRegionISO2(s []byte) (Region, error) { +func getRegionISO2(s []byte) (regionID, error) { i, err := findIndex(regionISO, s, "ZZ") if err != nil { return 0, err } - return Region(i) + isoRegionOffset, nil + return regionID(i) + isoRegionOffset, nil } // getRegionISO3 returns the regionID for the given 3-letter ISO country code // or unknownRegion if this does not exist. -func getRegionISO3(s []byte) (Region, error) { +func getRegionISO3(s []byte) (regionID, error) { if tag.FixCase("ZZZ", s) { for i := regionISO.Index(s[:1]); i != -1; i = regionISO.Next(s[:1], i) { if e := regionISO.Elem(i); e[2] == s[1] && e[3] == s[2] { - return Region(i) + isoRegionOffset, nil + return regionID(i) + isoRegionOffset, nil } } for i := 0; i < len(altRegionISO3); i += 3 { if tag.Compare(altRegionISO3[i:i+3], s) == 0 { - return Region(altRegionIDs[i/3]), nil + return regionID(altRegionIDs[i/3]), nil } } - return 0, NewValueError(s) + return 0, mkErrInvalid(s) } - return 0, ErrSyntax + return 0, errSyntax } -func getRegionM49(n int) (Region, error) { +func getRegionM49(n int) (regionID, error) { if 0 < n && n <= 999 { const ( searchBits = 7 @@ -252,7 +236,7 @@ func getRegionM49(n int) (Region, error) { return buf[i] >= val }) if r := fromM49[int(m49Index[idx])+i]; r&^regionMask == val { - return Region(r & regionMask), nil + return regionID(r & regionMask), nil } } var e ValueError @@ -263,13 +247,13 @@ func getRegionM49(n int) (Region, error) { // normRegion returns a region if r is deprecated or 0 otherwise. // TODO: consider supporting BYS (-> BLR), CSK (-> 200 or CZ), PHI (-> PHL) and AFI (-> DJ). // TODO: consider mapping split up regions to new most populous one (like CLDR). -func normRegion(r Region) Region { +func normRegion(r regionID) regionID { m := regionOldMap k := sort.Search(len(m), func(i int) bool { - return m[i].From >= uint16(r) + return m[i].from >= uint16(r) }) - if k < len(m) && m[k].From == uint16(r) { - return Region(m[k].To) + if k < len(m) && m[k].from == uint16(r) { + return regionID(m[k].to) } return 0 } @@ -280,13 +264,13 @@ const ( bcp47Region ) -func (r Region) typ() byte { +func (r regionID) typ() byte { return regionTypes[r] } // String returns the BCP 47 representation for the region. // It returns "ZZ" for an unspecified region. -func (r Region) String() string { +func (r regionID) String() string { if r < isoRegionOffset { if r == 0 { return "ZZ" @@ -300,7 +284,7 @@ func (r Region) String() string { // ISO3 returns the 3-letter ISO code of r. // Note that not all regions have a 3-letter ISO code. // In such cases this method returns "ZZZ". -func (r Region) ISO3() string { +func (r regionID) ISO3() string { if r < isoRegionOffset { return "ZZZ" } @@ -317,29 +301,29 @@ func (r Region) ISO3() string { // M49 returns the UN M.49 encoding of r, or 0 if this encoding // is not defined for r. -func (r Region) M49() int { +func (r regionID) M49() int { return int(m49[r]) } // IsPrivateUse reports whether r has the ISO 3166 User-assigned status. This // may include private-use tags that are assigned by CLDR and used in this // implementation. So IsPrivateUse and IsCountry can be simultaneously true. -func (r Region) IsPrivateUse() bool { +func (r regionID) IsPrivateUse() bool { return r.typ()&iso3166UserAssigned != 0 } -type Script uint8 +type scriptID uint8 // getScriptID returns the script id for string s. It assumes that s // is of the format [A-Z][a-z]{3}. -func getScriptID(idx tag.Index, s []byte) (Script, error) { +func getScriptID(idx tag.Index, s []byte) (scriptID, error) { i, err := findIndex(idx, s, "Zzzz") - return Script(i), err + return scriptID(i), err } // String returns the script code in title case. // It returns "Zzzz" for an unspecified script. -func (s Script) String() string { +func (s scriptID) String() string { if s == 0 { return "Zzzz" } @@ -347,7 +331,7 @@ func (s Script) String() string { } // IsPrivateUse reports whether this script code is reserved for private use. -func (s Script) IsPrivateUse() bool { +func (s scriptID) IsPrivateUse() bool { return _Qaaa <= s && s <= _Qabx } @@ -405,7 +389,7 @@ func grandfathered(s [maxAltTaglen]byte) (t Tag, ok bool) { if v < 0 { return Make(altTags[altTagIndex[-v-1]:altTagIndex[-v]]), true } - t.LangID = Language(v) + t.lang = langID(v) return t, true } return t, false diff --git a/vendor/golang.org/x/text/language/match.go b/vendor/golang.org/x/text/language/match.go index f7349213..15b74d12 100644 --- a/vendor/golang.org/x/text/language/match.go +++ b/vendor/golang.org/x/text/language/match.go @@ -4,12 +4,7 @@ package language -import ( - "errors" - "strings" - - "golang.org/x/text/internal/language" -) +import "errors" // A MatchOption configures a Matcher. type MatchOption func(*matcher) @@ -79,13 +74,12 @@ func NewMatcher(t []Tag, options ...MatchOption) Matcher { } func (m *matcher) Match(want ...Tag) (t Tag, index int, c Confidence) { - var tt language.Tag match, w, c := m.getBest(want...) if match != nil { - tt, index = match.tag, match.index + t, index = match.tag, match.index } else { // TODO: this should be an option - tt = m.default_.tag + t = m.default_.tag if m.preferSameScript { outer: for _, w := range want { @@ -97,7 +91,7 @@ func (m *matcher) Match(want ...Tag) (t Tag, index int, c Confidence) { } for i, h := range m.supported { if script.scriptID == h.maxScript { - tt, index = h.tag, i + t, index = h.tag, i break outer } } @@ -105,45 +99,238 @@ func (m *matcher) Match(want ...Tag) (t Tag, index int, c Confidence) { } // TODO: select first language tag based on script. } - if w.RegionID != tt.RegionID && w.RegionID != 0 { - if w.RegionID != 0 && tt.RegionID != 0 && tt.RegionID.Contains(w.RegionID) { - tt.RegionID = w.RegionID - tt.RemakeString() - } else if r := w.RegionID.String(); len(r) == 2 { - // TODO: also filter macro and deprecated. - tt, _ = tt.SetTypeForKey("rg", strings.ToLower(r)+"zzzz") - } + if w.region != 0 && t.region != 0 && t.region.contains(w.region) { + t, _ = Raw.Compose(t, Region{w.region}) } // Copy options from the user-provided tag into the result tag. This is hard // to do after the fact, so we do it here. // TODO: add in alternative variants to -u-va-. // TODO: add preferred region to -u-rg-. if e := w.Extensions(); len(e) > 0 { - b := language.Builder{} - b.SetTag(tt) - for _, e := range e { - b.AddExt(e) - } - tt = b.Make() + t, _ = Raw.Compose(t, e) + } + return t, index, c +} + +type scriptRegionFlags uint8 + +const ( + isList = 1 << iota + scriptInFrom + regionInFrom +) + +func (t *Tag) setUndefinedLang(id langID) { + if t.lang == 0 { + t.lang = id + } +} + +func (t *Tag) setUndefinedScript(id scriptID) { + if t.script == 0 { + t.script = id + } +} + +func (t *Tag) setUndefinedRegion(id regionID) { + if t.region == 0 || t.region.contains(id) { + t.region = id } - return makeTag(tt), index, c } // ErrMissingLikelyTagsData indicates no information was available // to compute likely values of missing tags. var ErrMissingLikelyTagsData = errors.New("missing likely tags data") -// func (t *Tag) setTagsFrom(id Tag) { -// t.LangID = id.LangID -// t.ScriptID = id.ScriptID -// t.RegionID = id.RegionID -// } +// addLikelySubtags sets subtags to their most likely value, given the locale. +// In most cases this means setting fields for unknown values, but in some +// cases it may alter a value. It returns an ErrMissingLikelyTagsData error +// if the given locale cannot be expanded. +func (t Tag) addLikelySubtags() (Tag, error) { + id, err := addTags(t) + if err != nil { + return t, err + } else if id.equalTags(t) { + return t, nil + } + id.remakeString() + return id, nil +} + +// specializeRegion attempts to specialize a group region. +func specializeRegion(t *Tag) bool { + if i := regionInclusion[t.region]; i < nRegionGroups { + x := likelyRegionGroup[i] + if langID(x.lang) == t.lang && scriptID(x.script) == t.script { + t.region = regionID(x.region) + } + return true + } + return false +} + +func addTags(t Tag) (Tag, error) { + // We leave private use identifiers alone. + if t.private() { + return t, nil + } + if t.script != 0 && t.region != 0 { + if t.lang != 0 { + // already fully specified + specializeRegion(&t) + return t, nil + } + // Search matches for und-script-region. Note that for these cases + // region will never be a group so there is no need to check for this. + list := likelyRegion[t.region : t.region+1] + if x := list[0]; x.flags&isList != 0 { + list = likelyRegionList[x.lang : x.lang+uint16(x.script)] + } + for _, x := range list { + // Deviating from the spec. See match_test.go for details. + if scriptID(x.script) == t.script { + t.setUndefinedLang(langID(x.lang)) + return t, nil + } + } + } + if t.lang != 0 { + // Search matches for lang-script and lang-region, where lang != und. + if t.lang < langNoIndexOffset { + x := likelyLang[t.lang] + if x.flags&isList != 0 { + list := likelyLangList[x.region : x.region+uint16(x.script)] + if t.script != 0 { + for _, x := range list { + if scriptID(x.script) == t.script && x.flags&scriptInFrom != 0 { + t.setUndefinedRegion(regionID(x.region)) + return t, nil + } + } + } else if t.region != 0 { + count := 0 + goodScript := true + tt := t + for _, x := range list { + // We visit all entries for which the script was not + // defined, including the ones where the region was not + // defined. This allows for proper disambiguation within + // regions. + if x.flags&scriptInFrom == 0 && t.region.contains(regionID(x.region)) { + tt.region = regionID(x.region) + tt.setUndefinedScript(scriptID(x.script)) + goodScript = goodScript && tt.script == scriptID(x.script) + count++ + } + } + if count == 1 { + return tt, nil + } + // Even if we fail to find a unique Region, we might have + // an unambiguous script. + if goodScript { + t.script = tt.script + } + } + } + } + } else { + // Search matches for und-script. + if t.script != 0 { + x := likelyScript[t.script] + if x.region != 0 { + t.setUndefinedRegion(regionID(x.region)) + t.setUndefinedLang(langID(x.lang)) + return t, nil + } + } + // Search matches for und-region. If und-script-region exists, it would + // have been found earlier. + if t.region != 0 { + if i := regionInclusion[t.region]; i < nRegionGroups { + x := likelyRegionGroup[i] + if x.region != 0 { + t.setUndefinedLang(langID(x.lang)) + t.setUndefinedScript(scriptID(x.script)) + t.region = regionID(x.region) + } + } else { + x := likelyRegion[t.region] + if x.flags&isList != 0 { + x = likelyRegionList[x.lang] + } + if x.script != 0 && x.flags != scriptInFrom { + t.setUndefinedLang(langID(x.lang)) + t.setUndefinedScript(scriptID(x.script)) + return t, nil + } + } + } + } + + // Search matches for lang. + if t.lang < langNoIndexOffset { + x := likelyLang[t.lang] + if x.flags&isList != 0 { + x = likelyLangList[x.region] + } + if x.region != 0 { + t.setUndefinedScript(scriptID(x.script)) + t.setUndefinedRegion(regionID(x.region)) + } + specializeRegion(&t) + if t.lang == 0 { + t.lang = _en // default language + } + return t, nil + } + return t, ErrMissingLikelyTagsData +} + +func (t *Tag) setTagsFrom(id Tag) { + t.lang = id.lang + t.script = id.script + t.region = id.region +} + +// minimize removes the region or script subtags from t such that +// t.addLikelySubtags() == t.minimize().addLikelySubtags(). +func (t Tag) minimize() (Tag, error) { + t, err := minimizeTags(t) + if err != nil { + return t, err + } + t.remakeString() + return t, nil +} + +// minimizeTags mimics the behavior of the ICU 51 C implementation. +func minimizeTags(t Tag) (Tag, error) { + if t.equalTags(und) { + return t, nil + } + max, err := addTags(t) + if err != nil { + return t, err + } + for _, id := range [...]Tag{ + {lang: t.lang}, + {lang: t.lang, region: t.region}, + {lang: t.lang, script: t.script}, + } { + if x, err := addTags(id); err == nil && max.equalTags(x) { + t.setTagsFrom(id) + break + } + } + return t, nil +} // Tag Matching // CLDR defines an algorithm for finding the best match between two sets of language // tags. The basic algorithm defines how to score a possible match and then find // the match with the best score -// (see https://www.unicode.org/reports/tr35/#LanguageMatching). +// (see http://www.unicode.org/reports/tr35/#LanguageMatching). // Using scoring has several disadvantages. The scoring obfuscates the importance of // the various factors considered, making the algorithm harder to understand. Using // scoring also requires the full score to be computed for each pair of tags. @@ -254,7 +441,7 @@ var ErrMissingLikelyTagsData = errors.New("missing likely tags data") type matcher struct { default_ *haveTag supported []*haveTag - index map[language.Language]*matchHeader + index map[langID]*matchHeader passSettings bool preferSameScript bool } @@ -269,7 +456,7 @@ type matchHeader struct { // haveTag holds a supported Tag and its maximized script and region. The maximized // or canonicalized language is not stored as it is not needed during matching. type haveTag struct { - tag language.Tag + tag Tag // index of this tag in the original list of supported tags. index int @@ -279,37 +466,37 @@ type haveTag struct { conf Confidence // Maximized region and script. - maxRegion language.Region - maxScript language.Script + maxRegion regionID + maxScript scriptID // altScript may be checked as an alternative match to maxScript. If altScript // matches, the confidence level for this match is Low. Theoretically there // could be multiple alternative scripts. This does not occur in practice. - altScript language.Script + altScript scriptID // nextMax is the index of the next haveTag with the same maximized tags. nextMax uint16 } -func makeHaveTag(tag language.Tag, index int) (haveTag, language.Language) { +func makeHaveTag(tag Tag, index int) (haveTag, langID) { max := tag - if tag.LangID != 0 || tag.RegionID != 0 || tag.ScriptID != 0 { - max, _ = canonicalize(All, max) - max, _ = max.Maximize() - max.RemakeString() + if tag.lang != 0 || tag.region != 0 || tag.script != 0 { + max, _ = max.canonicalize(All) + max, _ = addTags(max) + max.remakeString() } - return haveTag{tag, index, Exact, max.RegionID, max.ScriptID, altScript(max.LangID, max.ScriptID), 0}, max.LangID + return haveTag{tag, index, Exact, max.region, max.script, altScript(max.lang, max.script), 0}, max.lang } // altScript returns an alternative script that may match the given script with // a low confidence. At the moment, the langMatch data allows for at most one // script to map to another and we rely on this to keep the code simple. -func altScript(l language.Language, s language.Script) language.Script { +func altScript(l langID, s scriptID) scriptID { for _, alt := range matchScript { // TODO: also match cases where language is not the same. - if (language.Language(alt.wantLang) == l || language.Language(alt.haveLang) == l) && - language.Script(alt.haveScript) == s { - return language.Script(alt.wantScript) + if (langID(alt.wantLang) == l || langID(alt.haveLang) == l) && + scriptID(alt.haveScript) == s { + return scriptID(alt.wantScript) } } return 0 @@ -321,7 +508,7 @@ func (h *matchHeader) addIfNew(n haveTag, exact bool) { h.original = h.original || exact // Don't add new exact matches. for _, v := range h.haveTags { - if equalsRest(v.tag, n.tag) { + if v.tag.equalsRest(n.tag) { return } } @@ -330,7 +517,7 @@ func (h *matchHeader) addIfNew(n haveTag, exact bool) { for i, v := range h.haveTags { if v.maxScript == n.maxScript && v.maxRegion == n.maxRegion && - v.tag.VariantOrPrivateUseTags() == n.tag.VariantOrPrivateUseTags() { + v.tag.variantOrPrivateTagStr() == n.tag.variantOrPrivateTagStr() { for h.haveTags[i].nextMax != 0 { i = int(h.haveTags[i].nextMax) } @@ -343,7 +530,7 @@ func (h *matchHeader) addIfNew(n haveTag, exact bool) { // header returns the matchHeader for the given language. It creates one if // it doesn't already exist. -func (m *matcher) header(l language.Language) *matchHeader { +func (m *matcher) header(l langID) *matchHeader { if h := m.index[l]; h != nil { return h } @@ -367,7 +554,7 @@ func toConf(d uint8) Confidence { // for a given tag. func newMatcher(supported []Tag, options []MatchOption) *matcher { m := &matcher{ - index: make(map[language.Language]*matchHeader), + index: make(map[langID]*matchHeader), preferSameScript: true, } for _, o := range options { @@ -380,18 +567,16 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher { // Add supported languages to the index. Add exact matches first to give // them precedence. for i, tag := range supported { - tt := tag.tag() - pair, _ := makeHaveTag(tt, i) - m.header(tt.LangID).addIfNew(pair, true) + pair, _ := makeHaveTag(tag, i) + m.header(tag.lang).addIfNew(pair, true) m.supported = append(m.supported, &pair) } - m.default_ = m.header(supported[0].lang()).haveTags[0] + m.default_ = m.header(supported[0].lang).haveTags[0] // Keep these in two different loops to support the case that two equivalent // languages are distinguished, such as iw and he. for i, tag := range supported { - tt := tag.tag() - pair, max := makeHaveTag(tt, i) - if max != tt.LangID { + pair, max := makeHaveTag(tag, i) + if max != tag.lang { m.header(max).addIfNew(pair, true) } } @@ -400,11 +585,11 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher { // update will only add entries to original indexes, thus not computing any // transitive relations. update := func(want, have uint16, conf Confidence) { - if hh := m.index[language.Language(have)]; hh != nil { + if hh := m.index[langID(have)]; hh != nil { if !hh.original { return } - hw := m.header(language.Language(want)) + hw := m.header(langID(want)) for _, ht := range hh.haveTags { v := *ht if conf < v.conf { @@ -412,7 +597,7 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher { } v.nextMax = 0 // this value needs to be recomputed if v.altScript != 0 { - v.altScript = altScript(language.Language(want), v.maxScript) + v.altScript = altScript(langID(want), v.maxScript) } hw.addIfNew(v, conf == Exact && hh.original) } @@ -433,67 +618,66 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher { // First we match deprecated equivalents. If they are perfect equivalents // (their canonicalization simply substitutes a different language code, but // nothing else), the match confidence is Exact, otherwise it is High. - for i, lm := range language.AliasMap { + for i, lm := range langAliasMap { // If deprecated codes match and there is no fiddling with the script or // or region, we consider it an exact match. conf := Exact - if language.AliasTypes[i] != language.Macro { - if !isExactEquivalent(language.Language(lm.From)) { + if langAliasTypes[i] != langMacro { + if !isExactEquivalent(langID(lm.from)) { conf = High } - update(lm.To, lm.From, conf) + update(lm.to, lm.from, conf) } - update(lm.From, lm.To, conf) + update(lm.from, lm.to, conf) } return m } // getBest gets the best matching tag in m for any of the given tags, taking into // account the order of preference of the given tags. -func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confidence) { +func (m *matcher) getBest(want ...Tag) (got *haveTag, orig Tag, c Confidence) { best := bestMatch{} - for i, ww := range want { - w := ww.tag() - var max language.Tag + for i, w := range want { + var max Tag // Check for exact match first. - h := m.index[w.LangID] - if w.LangID != 0 { + h := m.index[w.lang] + if w.lang != 0 { if h == nil { continue } // Base language is defined. - max, _ = canonicalize(Legacy|Deprecated|Macro, w) + max, _ = w.canonicalize(Legacy | Deprecated | Macro) // A region that is added through canonicalization is stronger than // a maximized region: set it in the original (e.g. mo -> ro-MD). - if w.RegionID != max.RegionID { - w.RegionID = max.RegionID + if w.region != max.region { + w.region = max.region } // TODO: should we do the same for scripts? // See test case: en, sr, nl ; sh ; sr - max, _ = max.Maximize() + max, _ = addTags(max) } else { // Base language is not defined. if h != nil { for i := range h.haveTags { have := h.haveTags[i] - if equalsRest(have.tag, w) { + if have.tag.equalsRest(w) { return have, w, Exact } } } - if w.ScriptID == 0 && w.RegionID == 0 { + if w.script == 0 && w.region == 0 { // We skip all tags matching und for approximate matching, including // private tags. continue } - max, _ = w.Maximize() - if h = m.index[max.LangID]; h == nil { + max, _ = addTags(w) + if h = m.index[max.lang]; h == nil { continue } } pin := true for _, t := range want[i+1:] { - if w.LangID == t.lang() { + if w.lang == t.lang { pin = false break } @@ -501,11 +685,11 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confi // Check for match based on maximized tag. for i := range h.haveTags { have := h.haveTags[i] - best.update(have, w, max.ScriptID, max.RegionID, pin) + best.update(have, w, max.script, max.region, pin) if best.conf == Exact { for have.nextMax != 0 { have = h.haveTags[have.nextMax] - best.update(have, w, max.ScriptID, max.RegionID, pin) + best.update(have, w, max.script, max.region, pin) } return best.have, best.want, best.conf } @@ -513,9 +697,9 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confi } if best.conf <= No { if len(want) != 0 { - return nil, want[0].tag(), No + return nil, want[0], No } - return nil, language.Tag{}, No + return nil, Tag{}, No } return best.have, best.want, best.conf } @@ -523,9 +707,9 @@ func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confi // bestMatch accumulates the best match so far. type bestMatch struct { have *haveTag - want language.Tag + want Tag conf Confidence - pinnedRegion language.Region + pinnedRegion regionID pinLanguage bool sameRegionGroup bool // Cached results from applying tie-breaking rules. @@ -550,19 +734,19 @@ type bestMatch struct { // still prefer a second language over a dialect of the preferred language by // explicitly specifying dialects, e.g. "en, nl, en-GB". In this case pin should // be false. -func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.Script, maxRegion language.Region, pin bool) { +func (m *bestMatch) update(have *haveTag, tag Tag, maxScript scriptID, maxRegion regionID, pin bool) { // Bail if the maximum attainable confidence is below that of the current best match. c := have.conf if c < m.conf { return } // Don't change the language once we already have found an exact match. - if m.pinLanguage && tag.LangID != m.want.LangID { + if m.pinLanguage && tag.lang != m.want.lang { return } // Pin the region group if we are comparing tags for the same language. - if tag.LangID == m.want.LangID && m.sameRegionGroup { - _, sameGroup := regionGroupDist(m.pinnedRegion, have.maxRegion, have.maxScript, m.want.LangID) + if tag.lang == m.want.lang && m.sameRegionGroup { + _, sameGroup := regionGroupDist(m.pinnedRegion, have.maxRegion, have.maxScript, m.want.lang) if !sameGroup { return } @@ -572,7 +756,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S // don't pin anything, otherwise pin the language. m.pinLanguage = pin } - if equalsRest(have.tag, tag) { + if have.tag.equalsRest(tag) { } else if have.maxScript != maxScript { // There is usually very little comprehension between different scripts. // In a few cases there may still be Low comprehension. This possibility @@ -602,7 +786,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S // Tie-breaker rules: // We prefer if the pre-maximized language was specified and identical. - origLang := have.tag.LangID == tag.LangID && tag.LangID != 0 + origLang := have.tag.lang == tag.lang && tag.lang != 0 if !beaten && m.origLang != origLang { if m.origLang { return @@ -611,7 +795,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S } // We prefer if the pre-maximized region was specified and identical. - origReg := have.tag.RegionID == tag.RegionID && tag.RegionID != 0 + origReg := have.tag.region == tag.region && tag.region != 0 if !beaten && m.origReg != origReg { if m.origReg { return @@ -619,7 +803,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S beaten = true } - regGroupDist, sameGroup := regionGroupDist(have.maxRegion, maxRegion, maxScript, tag.LangID) + regGroupDist, sameGroup := regionGroupDist(have.maxRegion, maxRegion, maxScript, tag.lang) if !beaten && m.regGroupDist != regGroupDist { if regGroupDist > m.regGroupDist { return @@ -627,7 +811,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S beaten = true } - paradigmReg := isParadigmLocale(tag.LangID, have.maxRegion) + paradigmReg := isParadigmLocale(tag.lang, have.maxRegion) if !beaten && m.paradigmReg != paradigmReg { if !paradigmReg { return @@ -636,7 +820,7 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S } // Next we prefer if the pre-maximized script was specified and identical. - origScript := have.tag.ScriptID == tag.ScriptID && tag.ScriptID != 0 + origScript := have.tag.script == tag.script && tag.script != 0 if !beaten && m.origScript != origScript { if m.origScript { return @@ -659,9 +843,9 @@ func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.S } } -func isParadigmLocale(lang language.Language, r language.Region) bool { +func isParadigmLocale(lang langID, r regionID) bool { for _, e := range paradigmLocales { - if language.Language(e[0]) == lang && (r == language.Region(e[1]) || r == language.Region(e[2])) { + if langID(e[0]) == lang && (r == regionID(e[1]) || r == regionID(e[2])) { return true } } @@ -670,13 +854,13 @@ func isParadigmLocale(lang language.Language, r language.Region) bool { // regionGroupDist computes the distance between two regions based on their // CLDR grouping. -func regionGroupDist(a, b language.Region, script language.Script, lang language.Language) (dist uint8, same bool) { +func regionGroupDist(a, b regionID, script scriptID, lang langID) (dist uint8, same bool) { const defaultDistance = 4 aGroup := uint(regionToGroups[a]) << 1 bGroup := uint(regionToGroups[b]) << 1 for _, ri := range matchRegion { - if language.Language(ri.lang) == lang && (ri.script == 0 || language.Script(ri.script) == script) { + if langID(ri.lang) == lang && (ri.script == 0 || scriptID(ri.script) == script) { group := uint(1 << (ri.group &^ 0x80)) if 0x80&ri.group == 0 { if aGroup&bGroup&group != 0 { // Both regions are in the group. @@ -692,16 +876,31 @@ func regionGroupDist(a, b language.Region, script language.Script, lang language return defaultDistance, true } +func (t Tag) variants() string { + if t.pVariant == 0 { + return "" + } + return t.str[t.pVariant:t.pExt] +} + +// variantOrPrivateTagStr returns variants or private use tags. +func (t Tag) variantOrPrivateTagStr() string { + if t.pExt > 0 { + return t.str[t.pVariant:t.pExt] + } + return t.str[t.pVariant:] +} + // equalsRest compares everything except the language. -func equalsRest(a, b language.Tag) bool { +func (a Tag) equalsRest(b Tag) bool { // TODO: don't include extensions in this comparison. To do this efficiently, // though, we should handle private tags separately. - return a.ScriptID == b.ScriptID && a.RegionID == b.RegionID && a.VariantOrPrivateUseTags() == b.VariantOrPrivateUseTags() + return a.script == b.script && a.region == b.region && a.variantOrPrivateTagStr() == b.variantOrPrivateTagStr() } // isExactEquivalent returns true if canonicalizing the language will not alter // the script or region of a tag. -func isExactEquivalent(l language.Language) bool { +func isExactEquivalent(l langID) bool { for _, o := range notEquivalent { if o == l { return false @@ -710,26 +909,25 @@ func isExactEquivalent(l language.Language) bool { return true } -var notEquivalent []language.Language +var notEquivalent []langID func init() { // Create a list of all languages for which canonicalization may alter the // script or region. - for _, lm := range language.AliasMap { - tag := language.Tag{LangID: language.Language(lm.From)} - if tag, _ = canonicalize(All, tag); tag.ScriptID != 0 || tag.RegionID != 0 { - notEquivalent = append(notEquivalent, language.Language(lm.From)) + for _, lm := range langAliasMap { + tag := Tag{lang: langID(lm.from)} + if tag, _ = tag.canonicalize(All); tag.script != 0 || tag.region != 0 { + notEquivalent = append(notEquivalent, langID(lm.from)) } } // Maximize undefined regions of paradigm locales. for i, v := range paradigmLocales { - t := language.Tag{LangID: language.Language(v[0])} - max, _ := t.Maximize() + max, _ := addTags(Tag{lang: langID(v[0])}) if v[1] == 0 { - paradigmLocales[i][1] = uint16(max.RegionID) + paradigmLocales[i][1] = uint16(max.region) } if v[2] == 0 { - paradigmLocales[i][2] = uint16(max.RegionID) + paradigmLocales[i][2] = uint16(max.region) } } } diff --git a/vendor/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go index 11acfd88..fca2d30e 100644 --- a/vendor/golang.org/x/text/language/parse.go +++ b/vendor/golang.org/x/text/language/parse.go @@ -5,21 +5,216 @@ package language import ( + "bytes" "errors" + "fmt" + "sort" "strconv" "strings" - "golang.org/x/text/internal/language" + "golang.org/x/text/internal/tag" ) +// isAlpha returns true if the byte is not a digit. +// b must be an ASCII letter or digit. +func isAlpha(b byte) bool { + return b > '9' +} + +// isAlphaNum returns true if the string contains only ASCII letters or digits. +func isAlphaNum(s []byte) bool { + for _, c := range s { + if !('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9') { + return false + } + } + return true +} + +// errSyntax is returned by any of the parsing functions when the +// input is not well-formed, according to BCP 47. +// TODO: return the position at which the syntax error occurred? +var errSyntax = errors.New("language: tag is not well-formed") + // ValueError is returned by any of the parsing functions when the // input is well-formed but the respective subtag is not recognized // as a valid value. -type ValueError interface { - error +type ValueError struct { + v [8]byte +} - // Subtag returns the subtag for which the error occurred. - Subtag() string +func mkErrInvalid(s []byte) error { + var e ValueError + copy(e.v[:], s) + return e +} + +func (e ValueError) tag() []byte { + n := bytes.IndexByte(e.v[:], 0) + if n == -1 { + n = 8 + } + return e.v[:n] +} + +// Error implements the error interface. +func (e ValueError) Error() string { + return fmt.Sprintf("language: subtag %q is well-formed but unknown", e.tag()) +} + +// Subtag returns the subtag for which the error occurred. +func (e ValueError) Subtag() string { + return string(e.tag()) +} + +// scanner is used to scan BCP 47 tokens, which are separated by _ or -. +type scanner struct { + b []byte + bytes [max99thPercentileSize]byte + token []byte + start int // start position of the current token + end int // end position of the current token + next int // next point for scan + err error + done bool +} + +func makeScannerString(s string) scanner { + scan := scanner{} + if len(s) <= len(scan.bytes) { + scan.b = scan.bytes[:copy(scan.bytes[:], s)] + } else { + scan.b = []byte(s) + } + scan.init() + return scan +} + +// makeScanner returns a scanner using b as the input buffer. +// b is not copied and may be modified by the scanner routines. +func makeScanner(b []byte) scanner { + scan := scanner{b: b} + scan.init() + return scan +} + +func (s *scanner) init() { + for i, c := range s.b { + if c == '_' { + s.b[i] = '-' + } + } + s.scan() +} + +// restToLower converts the string between start and end to lower case. +func (s *scanner) toLower(start, end int) { + for i := start; i < end; i++ { + c := s.b[i] + if 'A' <= c && c <= 'Z' { + s.b[i] += 'a' - 'A' + } + } +} + +func (s *scanner) setError(e error) { + if s.err == nil || (e == errSyntax && s.err != errSyntax) { + s.err = e + } +} + +// resizeRange shrinks or grows the array at position oldStart such that +// a new string of size newSize can fit between oldStart and oldEnd. +// Sets the scan point to after the resized range. +func (s *scanner) resizeRange(oldStart, oldEnd, newSize int) { + s.start = oldStart + if end := oldStart + newSize; end != oldEnd { + diff := end - oldEnd + if end < cap(s.b) { + b := make([]byte, len(s.b)+diff) + copy(b, s.b[:oldStart]) + copy(b[end:], s.b[oldEnd:]) + s.b = b + } else { + s.b = append(s.b[end:], s.b[oldEnd:]...) + } + s.next = end + (s.next - s.end) + s.end = end + } +} + +// replace replaces the current token with repl. +func (s *scanner) replace(repl string) { + s.resizeRange(s.start, s.end, len(repl)) + copy(s.b[s.start:], repl) +} + +// gobble removes the current token from the input. +// Caller must call scan after calling gobble. +func (s *scanner) gobble(e error) { + s.setError(e) + if s.start == 0 { + s.b = s.b[:+copy(s.b, s.b[s.next:])] + s.end = 0 + } else { + s.b = s.b[:s.start-1+copy(s.b[s.start-1:], s.b[s.end:])] + s.end = s.start - 1 + } + s.next = s.start +} + +// deleteRange removes the given range from s.b before the current token. +func (s *scanner) deleteRange(start, end int) { + s.setError(errSyntax) + s.b = s.b[:start+copy(s.b[start:], s.b[end:])] + diff := end - start + s.next -= diff + s.start -= diff + s.end -= diff +} + +// scan parses the next token of a BCP 47 string. Tokens that are larger +// than 8 characters or include non-alphanumeric characters result in an error +// and are gobbled and removed from the output. +// It returns the end position of the last token consumed. +func (s *scanner) scan() (end int) { + end = s.end + s.token = nil + for s.start = s.next; s.next < len(s.b); { + i := bytes.IndexByte(s.b[s.next:], '-') + if i == -1 { + s.end = len(s.b) + s.next = len(s.b) + i = s.end - s.start + } else { + s.end = s.next + i + s.next = s.end + 1 + } + token := s.b[s.start:s.end] + if i < 1 || i > 8 || !isAlphaNum(token) { + s.gobble(errSyntax) + continue + } + s.token = token + return end + } + if n := len(s.b); n > 0 && s.b[n-1] == '-' { + s.setError(errSyntax) + s.b = s.b[:len(s.b)-1] + } + s.done = true + return end +} + +// acceptMinSize parses multiple tokens of the given size or greater. +// It returns the end position of the last token consumed. +func (s *scanner) acceptMinSize(min int) (end int) { + end = s.end + s.scan() + for ; len(s.token) >= min; s.scan() { + end = s.end + } + return end } // Parse parses the given BCP 47 string and returns a valid Tag. If parsing @@ -28,7 +223,7 @@ type ValueError interface { // ValueError. The Tag returned in this case is just stripped of the unknown // value. All other values are preserved. It accepts tags in the BCP 47 format // and extensions to this standard defined in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. // The resulting tag is canonicalized using the default canonicalization type. func Parse(s string) (t Tag, err error) { return Default.Parse(s) @@ -40,18 +235,327 @@ func Parse(s string) (t Tag, err error) { // ValueError. The Tag returned in this case is just stripped of the unknown // value. All other values are preserved. It accepts tags in the BCP 47 format // and extensions to this standard defined in -// https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. -// The resulting tag is canonicalized using the canonicalization type c. +// http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. +// The resulting tag is canonicalized using the the canonicalization type c. func (c CanonType) Parse(s string) (t Tag, err error) { - tt, err := language.Parse(s) - if err != nil { - return makeTag(tt), err + // TODO: consider supporting old-style locale key-value pairs. + if s == "" { + return und, errSyntax } - tt, changed := canonicalize(c, tt) + if len(s) <= maxAltTaglen { + b := [maxAltTaglen]byte{} + for i, c := range s { + // Generating invalid UTF-8 is okay as it won't match. + if 'A' <= c && c <= 'Z' { + c += 'a' - 'A' + } else if c == '_' { + c = '-' + } + b[i] = byte(c) + } + if t, ok := grandfathered(b); ok { + return t, nil + } + } + scan := makeScannerString(s) + t, err = parse(&scan, s) + t, changed := t.canonicalize(c) if changed { - tt.RemakeString() + t.remakeString() } - return makeTag(tt), err + return t, err +} + +func parse(scan *scanner, s string) (t Tag, err error) { + t = und + var end int + if n := len(scan.token); n <= 1 { + scan.toLower(0, len(scan.b)) + if n == 0 || scan.token[0] != 'x' { + return t, errSyntax + } + end = parseExtensions(scan) + } else if n >= 4 { + return und, errSyntax + } else { // the usual case + t, end = parseTag(scan) + if n := len(scan.token); n == 1 { + t.pExt = uint16(end) + end = parseExtensions(scan) + } else if end < len(scan.b) { + scan.setError(errSyntax) + scan.b = scan.b[:end] + } + } + if int(t.pVariant) < len(scan.b) { + if end < len(s) { + s = s[:end] + } + if len(s) > 0 && tag.Compare(s, scan.b) == 0 { + t.str = s + } else { + t.str = string(scan.b) + } + } else { + t.pVariant, t.pExt = 0, 0 + } + return t, scan.err +} + +// parseTag parses language, script, region and variants. +// It returns a Tag and the end position in the input that was parsed. +func parseTag(scan *scanner) (t Tag, end int) { + var e error + // TODO: set an error if an unknown lang, script or region is encountered. + t.lang, e = getLangID(scan.token) + scan.setError(e) + scan.replace(t.lang.String()) + langStart := scan.start + end = scan.scan() + for len(scan.token) == 3 && isAlpha(scan.token[0]) { + // From http://tools.ietf.org/html/bcp47, - tags are equivalent + // to a tag of the form . + lang, e := getLangID(scan.token) + if lang != 0 { + t.lang = lang + copy(scan.b[langStart:], lang.String()) + scan.b[langStart+3] = '-' + scan.start = langStart + 4 + } + scan.gobble(e) + end = scan.scan() + } + if len(scan.token) == 4 && isAlpha(scan.token[0]) { + t.script, e = getScriptID(script, scan.token) + if t.script == 0 { + scan.gobble(e) + } + end = scan.scan() + } + if n := len(scan.token); n >= 2 && n <= 3 { + t.region, e = getRegionID(scan.token) + if t.region == 0 { + scan.gobble(e) + } else { + scan.replace(t.region.String()) + } + end = scan.scan() + } + scan.toLower(scan.start, len(scan.b)) + t.pVariant = byte(end) + end = parseVariants(scan, end, t) + t.pExt = uint16(end) + return t, end +} + +var separator = []byte{'-'} + +// parseVariants scans tokens as long as each token is a valid variant string. +// Duplicate variants are removed. +func parseVariants(scan *scanner, end int, t Tag) int { + start := scan.start + varIDBuf := [4]uint8{} + variantBuf := [4][]byte{} + varID := varIDBuf[:0] + variant := variantBuf[:0] + last := -1 + needSort := false + for ; len(scan.token) >= 4; scan.scan() { + // TODO: measure the impact of needing this conversion and redesign + // the data structure if there is an issue. + v, ok := variantIndex[string(scan.token)] + if !ok { + // unknown variant + // TODO: allow user-defined variants? + scan.gobble(mkErrInvalid(scan.token)) + continue + } + varID = append(varID, v) + variant = append(variant, scan.token) + if !needSort { + if last < int(v) { + last = int(v) + } else { + needSort = true + // There is no legal combinations of more than 7 variants + // (and this is by no means a useful sequence). + const maxVariants = 8 + if len(varID) > maxVariants { + break + } + } + } + end = scan.end + } + if needSort { + sort.Sort(variantsSort{varID, variant}) + k, l := 0, -1 + for i, v := range varID { + w := int(v) + if l == w { + // Remove duplicates. + continue + } + varID[k] = varID[i] + variant[k] = variant[i] + k++ + l = w + } + if str := bytes.Join(variant[:k], separator); len(str) == 0 { + end = start - 1 + } else { + scan.resizeRange(start, end, len(str)) + copy(scan.b[scan.start:], str) + end = scan.end + } + } + return end +} + +type variantsSort struct { + i []uint8 + v [][]byte +} + +func (s variantsSort) Len() int { + return len(s.i) +} + +func (s variantsSort) Swap(i, j int) { + s.i[i], s.i[j] = s.i[j], s.i[i] + s.v[i], s.v[j] = s.v[j], s.v[i] +} + +func (s variantsSort) Less(i, j int) bool { + return s.i[i] < s.i[j] +} + +type bytesSort [][]byte + +func (b bytesSort) Len() int { + return len(b) +} + +func (b bytesSort) Swap(i, j int) { + b[i], b[j] = b[j], b[i] +} + +func (b bytesSort) Less(i, j int) bool { + return bytes.Compare(b[i], b[j]) == -1 +} + +// parseExtensions parses and normalizes the extensions in the buffer. +// It returns the last position of scan.b that is part of any extension. +// It also trims scan.b to remove excess parts accordingly. +func parseExtensions(scan *scanner) int { + start := scan.start + exts := [][]byte{} + private := []byte{} + end := scan.end + for len(scan.token) == 1 { + extStart := scan.start + ext := scan.token[0] + end = parseExtension(scan) + extension := scan.b[extStart:end] + if len(extension) < 3 || (ext != 'x' && len(extension) < 4) { + scan.setError(errSyntax) + end = extStart + continue + } else if start == extStart && (ext == 'x' || scan.start == len(scan.b)) { + scan.b = scan.b[:end] + return end + } else if ext == 'x' { + private = extension + break + } + exts = append(exts, extension) + } + sort.Sort(bytesSort(exts)) + if len(private) > 0 { + exts = append(exts, private) + } + scan.b = scan.b[:start] + if len(exts) > 0 { + scan.b = append(scan.b, bytes.Join(exts, separator)...) + } else if start > 0 { + // Strip trailing '-'. + scan.b = scan.b[:start-1] + } + return end +} + +// parseExtension parses a single extension and returns the position of +// the extension end. +func parseExtension(scan *scanner) int { + start, end := scan.start, scan.end + switch scan.token[0] { + case 'u': + attrStart := end + scan.scan() + for last := []byte{}; len(scan.token) > 2; scan.scan() { + if bytes.Compare(scan.token, last) != -1 { + // Attributes are unsorted. Start over from scratch. + p := attrStart + 1 + scan.next = p + attrs := [][]byte{} + for scan.scan(); len(scan.token) > 2; scan.scan() { + attrs = append(attrs, scan.token) + end = scan.end + } + sort.Sort(bytesSort(attrs)) + copy(scan.b[p:], bytes.Join(attrs, separator)) + break + } + last = scan.token + end = scan.end + } + var last, key []byte + for attrEnd := end; len(scan.token) == 2; last = key { + key = scan.token + keyEnd := scan.end + end = scan.acceptMinSize(3) + // TODO: check key value validity + if keyEnd == end || bytes.Compare(key, last) != 1 { + // We have an invalid key or the keys are not sorted. + // Start scanning keys from scratch and reorder. + p := attrEnd + 1 + scan.next = p + keys := [][]byte{} + for scan.scan(); len(scan.token) == 2; { + keyStart, keyEnd := scan.start, scan.end + end = scan.acceptMinSize(3) + if keyEnd != end { + keys = append(keys, scan.b[keyStart:end]) + } else { + scan.setError(errSyntax) + end = keyStart + } + } + sort.Sort(bytesSort(keys)) + reordered := bytes.Join(keys, separator) + if e := p + len(reordered); e < end { + scan.deleteRange(e, end) + end = e + } + copy(scan.b[p:], bytes.Join(keys, separator)) + break + } + } + case 't': + scan.scan() + if n := len(scan.token); n >= 2 && n <= 3 && isAlpha(scan.token[1]) { + _, end = parseTag(scan) + scan.toLower(start, end) + } + for len(scan.token) == 2 && !isAlpha(scan.token[1]) { + end = scan.acceptMinSize(3) + } + case 'x': + end = scan.acceptMinSize(1) + default: + end = scan.acceptMinSize(2) + } + return end } // Compose creates a Tag from individual parts, which may be of type Tag, Base, @@ -59,11 +563,10 @@ func (c CanonType) Parse(s string) (t Tag, err error) { // Base, Script or Region or slice of type Variant or Extension is passed more // than once, the latter will overwrite the former. Variants and Extensions are // accumulated, but if two extensions of the same type are passed, the latter -// will replace the former. For -u extensions, though, the key-type pairs are -// added, where later values overwrite older ones. A Tag overwrites all former -// values and typically only makes sense as the first argument. The resulting -// tag is returned after canonicalizing using the Default CanonType. If one or -// more errors are encountered, one of the errors is returned. +// will replace the former. A Tag overwrites all former values and typically +// only makes sense as the first argument. The resulting tag is returned after +// canonicalizing using the Default CanonType. If one or more errors are +// encountered, one of the errors is returned. func Compose(part ...interface{}) (t Tag, err error) { return Default.Compose(part...) } @@ -73,65 +576,193 @@ func Compose(part ...interface{}) (t Tag, err error) { // Base, Script or Region or slice of type Variant or Extension is passed more // than once, the latter will overwrite the former. Variants and Extensions are // accumulated, but if two extensions of the same type are passed, the latter -// will replace the former. For -u extensions, though, the key-type pairs are -// added, where later values overwrite older ones. A Tag overwrites all former -// values and typically only makes sense as the first argument. The resulting -// tag is returned after canonicalizing using CanonType c. If one or more errors -// are encountered, one of the errors is returned. +// will replace the former. A Tag overwrites all former values and typically +// only makes sense as the first argument. The resulting tag is returned after +// canonicalizing using CanonType c. If one or more errors are encountered, +// one of the errors is returned. func (c CanonType) Compose(part ...interface{}) (t Tag, err error) { - var b language.Builder - if err = update(&b, part...); err != nil { + var b builder + if err = b.update(part...); err != nil { return und, err } - b.Tag, _ = canonicalize(c, b.Tag) - return makeTag(b.Make()), err + t, _ = b.tag.canonicalize(c) + + if len(b.ext) > 0 || len(b.variant) > 0 { + sort.Sort(sortVariant(b.variant)) + sort.Strings(b.ext) + if b.private != "" { + b.ext = append(b.ext, b.private) + } + n := maxCoreSize + tokenLen(b.variant...) + tokenLen(b.ext...) + buf := make([]byte, n) + p := t.genCoreBytes(buf) + t.pVariant = byte(p) + p += appendTokens(buf[p:], b.variant...) + t.pExt = uint16(p) + p += appendTokens(buf[p:], b.ext...) + t.str = string(buf[:p]) + } else if b.private != "" { + t.str = b.private + t.remakeString() + } + return +} + +type builder struct { + tag Tag + + private string // the x extension + ext []string + variant []string + + err error +} + +func (b *builder) addExt(e string) { + if e == "" { + } else if e[0] == 'x' { + b.private = e + } else { + b.ext = append(b.ext, e) + } } var errInvalidArgument = errors.New("invalid Extension or Variant") -func update(b *language.Builder, part ...interface{}) (err error) { +func (b *builder) update(part ...interface{}) (err error) { + replace := func(l *[]string, s string, eq func(a, b string) bool) bool { + if s == "" { + b.err = errInvalidArgument + return true + } + for i, v := range *l { + if eq(v, s) { + (*l)[i] = s + return true + } + } + return false + } for _, x := range part { switch v := x.(type) { case Tag: - b.SetTag(v.tag()) + b.tag.lang = v.lang + b.tag.region = v.region + b.tag.script = v.script + if v.str != "" { + b.variant = nil + for x, s := "", v.str[v.pVariant:v.pExt]; s != ""; { + x, s = nextToken(s) + b.variant = append(b.variant, x) + } + b.ext, b.private = nil, "" + for i, e := int(v.pExt), ""; i < len(v.str); { + i, e = getExtension(v.str, i) + b.addExt(e) + } + } case Base: - b.Tag.LangID = v.langID + b.tag.lang = v.langID case Script: - b.Tag.ScriptID = v.scriptID + b.tag.script = v.scriptID case Region: - b.Tag.RegionID = v.regionID + b.tag.region = v.regionID case Variant: - if v.variant == "" { - err = errInvalidArgument - break + if !replace(&b.variant, v.variant, func(a, b string) bool { return a == b }) { + b.variant = append(b.variant, v.variant) } - b.AddVariant(v.variant) case Extension: - if v.s == "" { - err = errInvalidArgument - break + if !replace(&b.ext, v.s, func(a, b string) bool { return a[0] == b[0] }) { + b.addExt(v.s) } - b.SetExt(v.s) case []Variant: - b.ClearVariants() - for _, v := range v { - b.AddVariant(v.variant) + b.variant = nil + for _, x := range v { + b.update(x) } case []Extension: - b.ClearExtensions() + b.ext, b.private = nil, "" for _, e := range v { - b.SetExt(e.s) + b.update(e) } // TODO: support parsing of raw strings based on morphology or just extensions? case error: - if v != nil { - err = v - } + err = v } } return } +func tokenLen(token ...string) (n int) { + for _, t := range token { + n += len(t) + 1 + } + return +} + +func appendTokens(b []byte, token ...string) int { + p := 0 + for _, t := range token { + b[p] = '-' + copy(b[p+1:], t) + p += 1 + len(t) + } + return p +} + +type sortVariant []string + +func (s sortVariant) Len() int { + return len(s) +} + +func (s sortVariant) Swap(i, j int) { + s[j], s[i] = s[i], s[j] +} + +func (s sortVariant) Less(i, j int) bool { + return variantIndex[s[i]] < variantIndex[s[j]] +} + +func findExt(list []string, x byte) int { + for i, e := range list { + if e[0] == x { + return i + } + } + return -1 +} + +// getExtension returns the name, body and end position of the extension. +func getExtension(s string, p int) (end int, ext string) { + if s[p] == '-' { + p++ + } + if s[p] == 'x' { + return len(s), s[p:] + } + end = nextExtension(s, p) + return end, s[p:end] +} + +// nextExtension finds the next extension within the string, searching +// for the -- pattern from position p. +// In the fast majority of cases, language tags will have at most +// one extension and extensions tend to be small. +func nextExtension(s string, p int) int { + for n := len(s) - 3; p < n; { + if s[p] == '-' { + if s[p+2] == '-' { + return p + } + p += 3 + } else { + p++ + } + } + return len(s) +} + var errInvalidWeight = errors.New("ParseAcceptLanguage: invalid weight") // ParseAcceptLanguage parses the contents of an Accept-Language header as @@ -157,7 +788,7 @@ func ParseAcceptLanguage(s string) (tag []Tag, q []float32, err error) { if !ok { return nil, nil, err } - t = makeTag(language.Tag{LangID: id}) + t = Tag{lang: id} } // Scan the optional weight. @@ -199,9 +830,9 @@ func split(s string, c byte) (head, tail string) { return strings.TrimSpace(s), "" } -// Add hack mapping to deal with a small number of cases that occur +// Add hack mapping to deal with a small number of cases that that occur // in Accept-Language (with reasonable frequency). -var acceptFallback = map[string]language.Language{ +var acceptFallback = map[string]langID{ "english": _en, "deutsch": _de, "italian": _it, diff --git a/vendor/golang.org/x/text/language/tables.go b/vendor/golang.org/x/text/language/tables.go index e2280771..b738d457 100644 --- a/vendor/golang.org/x/text/language/tables.go +++ b/vendor/golang.org/x/text/language/tables.go @@ -2,22 +2,997 @@ package language +import "golang.org/x/text/internal/tag" + // CLDRVersion is the CLDR version from which the tables in this package are derived. const CLDRVersion = "32" +const numLanguages = 8665 + +const numScripts = 242 + +const numRegions = 357 + +type fromTo struct { + from uint16 + to uint16 +} + +const nonCanonicalUnd = 1201 const ( + _af = 22 + _am = 39 + _ar = 58 + _az = 88 + _bg = 126 + _bn = 165 + _ca = 215 + _cs = 250 + _da = 257 _de = 269 + _el = 310 _en = 313 + _es = 318 + _et = 320 + _fa = 328 + _fi = 337 + _fil = 339 _fr = 350 + _gu = 420 + _he = 444 + _hi = 446 + _hr = 465 + _hu = 469 + _hy = 471 + _id = 481 + _is = 504 _it = 505 + _ja = 512 + _ka = 528 + _kk = 578 + _km = 586 + _kn = 593 + _ko = 596 + _ky = 650 + _lo = 696 + _lt = 704 + _lv = 711 + _mk = 767 + _ml = 772 + _mn = 779 _mo = 784 - _no = 879 - _nb = 839 - _pt = 960 - _sh = 1031 + _mr = 795 + _ms = 799 _mul = 806 - _und = 0 + _my = 817 + _nb = 839 + _ne = 849 + _nl = 871 + _no = 879 + _pa = 925 + _pl = 947 + _pt = 960 + _ro = 988 + _ru = 994 + _sh = 1031 + _si = 1036 + _sk = 1042 + _sl = 1046 + _sq = 1073 + _sr = 1074 + _sv = 1092 + _sw = 1093 + _ta = 1104 + _te = 1121 + _th = 1131 + _tl = 1146 + _tn = 1152 + _tr = 1162 + _uk = 1198 + _ur = 1204 + _uz = 1212 + _vi = 1219 + _zh = 1321 + _zu = 1327 + _jbo = 515 + _ami = 1650 + _bnn = 2357 + _hak = 438 + _tlh = 14467 + _lb = 661 + _nv = 899 + _pwn = 12055 + _tao = 14188 + _tay = 14198 + _tsu = 14662 + _nn = 874 + _sfb = 13629 + _vgt = 15701 + _sgg = 13660 + _cmn = 3007 + _nan = 835 + _hsn = 467 ) + +const langPrivateStart = 0x2f72 + +const langPrivateEnd = 0x3179 + +// lang holds an alphabetically sorted list of ISO-639 language identifiers. +// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag. +// For 2-byte language identifiers, the two successive bytes have the following meaning: +// - if the first letter of the 2- and 3-letter ISO codes are the same: +// the second and third letter of the 3-letter ISO code. +// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3. +// For 3-byte language identifiers the 4th byte is 0. +const lang tag.Index = "" + // Size: 5324 bytes + "---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abq\x00abr\x00abt\x00aby\x00a" + + "cd\x00ace\x00ach\x00ada\x00ade\x00adj\x00ady\x00adz\x00aeveaeb\x00aey" + + "\x00affragc\x00agd\x00agg\x00agm\x00ago\x00agq\x00aha\x00ahl\x00aho\x00a" + + "jg\x00akkaakk\x00ala\x00ali\x00aln\x00alt\x00ammhamm\x00amn\x00amo\x00am" + + "p\x00anrganc\x00ank\x00ann\x00any\x00aoj\x00aom\x00aoz\x00apc\x00apd\x00" + + "ape\x00apr\x00aps\x00apz\x00arraarc\x00arh\x00arn\x00aro\x00arq\x00ars" + + "\x00ary\x00arz\x00assmasa\x00ase\x00asg\x00aso\x00ast\x00ata\x00atg\x00a" + + "tj\x00auy\x00avvaavl\x00avn\x00avt\x00avu\x00awa\x00awb\x00awo\x00awx" + + "\x00ayymayb\x00azzebaakbal\x00ban\x00bap\x00bar\x00bas\x00bav\x00bax\x00" + + "bba\x00bbb\x00bbc\x00bbd\x00bbj\x00bbp\x00bbr\x00bcf\x00bch\x00bci\x00bc" + + "m\x00bcn\x00bco\x00bcq\x00bcu\x00bdd\x00beelbef\x00beh\x00bej\x00bem\x00" + + "bet\x00bew\x00bex\x00bez\x00bfd\x00bfq\x00bft\x00bfy\x00bgulbgc\x00bgn" + + "\x00bgx\x00bhihbhb\x00bhg\x00bhi\x00bhk\x00bhl\x00bho\x00bhy\x00biisbib" + + "\x00big\x00bik\x00bim\x00bin\x00bio\x00biq\x00bjh\x00bji\x00bjj\x00bjn" + + "\x00bjo\x00bjr\x00bjt\x00bjz\x00bkc\x00bkm\x00bkq\x00bku\x00bkv\x00blt" + + "\x00bmambmh\x00bmk\x00bmq\x00bmu\x00bnenbng\x00bnm\x00bnp\x00boodboj\x00" + + "bom\x00bon\x00bpy\x00bqc\x00bqi\x00bqp\x00bqv\x00brrebra\x00brh\x00brx" + + "\x00brz\x00bsosbsj\x00bsq\x00bss\x00bst\x00bto\x00btt\x00btv\x00bua\x00b" + + "uc\x00bud\x00bug\x00buk\x00bum\x00buo\x00bus\x00buu\x00bvb\x00bwd\x00bwr" + + "\x00bxh\x00bye\x00byn\x00byr\x00bys\x00byv\x00byx\x00bza\x00bze\x00bzf" + + "\x00bzh\x00bzw\x00caatcan\x00cbj\x00cch\x00ccp\x00ceheceb\x00cfa\x00cgg" + + "\x00chhachk\x00chm\x00cho\x00chp\x00chr\x00cja\x00cjm\x00cjv\x00ckb\x00c" + + "kl\x00cko\x00cky\x00cla\x00cme\x00cmg\x00cooscop\x00cps\x00crrecrh\x00cr" + + "j\x00crk\x00crl\x00crm\x00crs\x00csescsb\x00csw\x00ctd\x00cuhucvhvcyymda" + + "andad\x00daf\x00dag\x00dah\x00dak\x00dar\x00dav\x00dbd\x00dbq\x00dcc\x00" + + "ddn\x00deeuded\x00den\x00dga\x00dgh\x00dgi\x00dgl\x00dgr\x00dgz\x00dia" + + "\x00dje\x00dnj\x00dob\x00doi\x00dop\x00dow\x00dri\x00drs\x00dsb\x00dtm" + + "\x00dtp\x00dts\x00dty\x00dua\x00duc\x00dud\x00dug\x00dvivdva\x00dww\x00d" + + "yo\x00dyu\x00dzzodzg\x00ebu\x00eeweefi\x00egl\x00egy\x00eka\x00eky\x00el" + + "llema\x00emi\x00enngenn\x00enq\x00eopoeri\x00es\x00\x05esu\x00etstetr" + + "\x00ett\x00etu\x00etx\x00euusewo\x00ext\x00faasfaa\x00fab\x00fag\x00fai" + + "\x00fan\x00ffulffi\x00ffm\x00fiinfia\x00fil\x00fit\x00fjijflr\x00fmp\x00" + + "foaofod\x00fon\x00for\x00fpe\x00fqs\x00frrafrc\x00frp\x00frr\x00frs\x00f" + + "ub\x00fud\x00fue\x00fuf\x00fuh\x00fuq\x00fur\x00fuv\x00fuy\x00fvr\x00fyr" + + "ygalegaa\x00gaf\x00gag\x00gah\x00gaj\x00gam\x00gan\x00gaw\x00gay\x00gba" + + "\x00gbf\x00gbm\x00gby\x00gbz\x00gcr\x00gdlagde\x00gdn\x00gdr\x00geb\x00g" + + "ej\x00gel\x00gez\x00gfk\x00ggn\x00ghs\x00gil\x00gim\x00gjk\x00gjn\x00gju" + + "\x00gkn\x00gkp\x00gllgglk\x00gmm\x00gmv\x00gnrngnd\x00gng\x00god\x00gof" + + "\x00goi\x00gom\x00gon\x00gor\x00gos\x00got\x00grb\x00grc\x00grt\x00grw" + + "\x00gsw\x00guujgub\x00guc\x00gud\x00gur\x00guw\x00gux\x00guz\x00gvlvgvf" + + "\x00gvr\x00gvs\x00gwc\x00gwi\x00gwt\x00gyi\x00haauhag\x00hak\x00ham\x00h" + + "aw\x00haz\x00hbb\x00hdy\x00heebhhy\x00hiinhia\x00hif\x00hig\x00hih\x00hi" + + "l\x00hla\x00hlu\x00hmd\x00hmt\x00hnd\x00hne\x00hnj\x00hnn\x00hno\x00homo" + + "hoc\x00hoj\x00hot\x00hrrvhsb\x00hsn\x00htathuunhui\x00hyyehzerianaian" + + "\x00iar\x00iba\x00ibb\x00iby\x00ica\x00ich\x00idndidd\x00idi\x00idu\x00i" + + "eleife\x00igboigb\x00ige\x00iiiiijj\x00ikpkikk\x00ikt\x00ikw\x00ikx\x00i" + + "lo\x00imo\x00inndinh\x00iodoiou\x00iri\x00isslittaiukuiw\x00\x03iwm\x00i" + + "ws\x00izh\x00izi\x00japnjab\x00jam\x00jbo\x00jbu\x00jen\x00jgk\x00jgo" + + "\x00ji\x00\x06jib\x00jmc\x00jml\x00jra\x00jut\x00jvavjwavkaatkaa\x00kab" + + "\x00kac\x00kad\x00kai\x00kaj\x00kam\x00kao\x00kbd\x00kbm\x00kbp\x00kbq" + + "\x00kbx\x00kby\x00kcg\x00kck\x00kcl\x00kct\x00kde\x00kdh\x00kdl\x00kdt" + + "\x00kea\x00ken\x00kez\x00kfo\x00kfr\x00kfy\x00kgonkge\x00kgf\x00kgp\x00k" + + "ha\x00khb\x00khn\x00khq\x00khs\x00kht\x00khw\x00khz\x00kiikkij\x00kiu" + + "\x00kiw\x00kjuakjd\x00kjg\x00kjs\x00kjy\x00kkazkkc\x00kkj\x00klalkln\x00" + + "klq\x00klt\x00klx\x00kmhmkmb\x00kmh\x00kmo\x00kms\x00kmu\x00kmw\x00knank" + + "nf\x00knp\x00koorkoi\x00kok\x00kol\x00kos\x00koz\x00kpe\x00kpf\x00kpo" + + "\x00kpr\x00kpx\x00kqb\x00kqf\x00kqs\x00kqy\x00kraukrc\x00kri\x00krj\x00k" + + "rl\x00krs\x00kru\x00ksasksb\x00ksd\x00ksf\x00ksh\x00ksj\x00ksr\x00ktb" + + "\x00ktm\x00kto\x00kuurkub\x00kud\x00kue\x00kuj\x00kum\x00kun\x00kup\x00k" + + "us\x00kvomkvg\x00kvr\x00kvx\x00kw\x00\x01kwj\x00kwo\x00kxa\x00kxc\x00kxm" + + "\x00kxp\x00kxw\x00kxz\x00kyirkye\x00kyx\x00kzr\x00laatlab\x00lad\x00lag" + + "\x00lah\x00laj\x00las\x00lbtzlbe\x00lbu\x00lbw\x00lcm\x00lcp\x00ldb\x00l" + + "ed\x00lee\x00lem\x00lep\x00leq\x00leu\x00lez\x00lguglgg\x00liimlia\x00li" + + "d\x00lif\x00lig\x00lih\x00lij\x00lis\x00ljp\x00lki\x00lkt\x00lle\x00lln" + + "\x00lmn\x00lmo\x00lmp\x00lninlns\x00lnu\x00loaoloj\x00lok\x00lol\x00lor" + + "\x00los\x00loz\x00lrc\x00ltitltg\x00luublua\x00luo\x00luy\x00luz\x00lvav" + + "lwl\x00lzh\x00lzz\x00mad\x00maf\x00mag\x00mai\x00mak\x00man\x00mas\x00ma" + + "w\x00maz\x00mbh\x00mbo\x00mbq\x00mbu\x00mbw\x00mci\x00mcp\x00mcq\x00mcr" + + "\x00mcu\x00mda\x00mde\x00mdf\x00mdh\x00mdj\x00mdr\x00mdx\x00med\x00mee" + + "\x00mek\x00men\x00mer\x00met\x00meu\x00mfa\x00mfe\x00mfn\x00mfo\x00mfq" + + "\x00mglgmgh\x00mgl\x00mgo\x00mgp\x00mgy\x00mhahmhi\x00mhl\x00mirimif\x00" + + "min\x00mis\x00miw\x00mkkdmki\x00mkl\x00mkp\x00mkw\x00mlalmle\x00mlp\x00m" + + "ls\x00mmo\x00mmu\x00mmx\x00mnonmna\x00mnf\x00mni\x00mnw\x00moolmoa\x00mo" + + "e\x00moh\x00mos\x00mox\x00mpp\x00mps\x00mpt\x00mpx\x00mql\x00mrarmrd\x00" + + "mrj\x00mro\x00mssamtltmtc\x00mtf\x00mti\x00mtr\x00mua\x00mul\x00mur\x00m" + + "us\x00mva\x00mvn\x00mvy\x00mwk\x00mwr\x00mwv\x00mxc\x00mxm\x00myyamyk" + + "\x00mym\x00myv\x00myw\x00myx\x00myz\x00mzk\x00mzm\x00mzn\x00mzp\x00mzw" + + "\x00mzz\x00naaunac\x00naf\x00nah\x00nak\x00nan\x00nap\x00naq\x00nas\x00n" + + "bobnca\x00nce\x00ncf\x00nch\x00nco\x00ncu\x00nddendc\x00nds\x00neepneb" + + "\x00new\x00nex\x00nfr\x00ngdonga\x00ngb\x00ngl\x00nhb\x00nhe\x00nhw\x00n" + + "if\x00nii\x00nij\x00nin\x00niu\x00niy\x00niz\x00njo\x00nkg\x00nko\x00nll" + + "dnmg\x00nmz\x00nnnonnf\x00nnh\x00nnk\x00nnm\x00noornod\x00noe\x00non\x00" + + "nop\x00nou\x00nqo\x00nrblnrb\x00nsk\x00nsn\x00nso\x00nss\x00ntm\x00ntr" + + "\x00nui\x00nup\x00nus\x00nuv\x00nux\x00nvavnwb\x00nxq\x00nxr\x00nyyanym" + + "\x00nyn\x00nzi\x00occiogc\x00ojjiokr\x00okv\x00omrmong\x00onn\x00ons\x00" + + "opm\x00orrioro\x00oru\x00osssosa\x00ota\x00otk\x00ozm\x00paanpag\x00pal" + + "\x00pam\x00pap\x00pau\x00pbi\x00pcd\x00pcm\x00pdc\x00pdt\x00ped\x00peo" + + "\x00pex\x00pfl\x00phl\x00phn\x00pilipil\x00pip\x00pka\x00pko\x00plolpla" + + "\x00pms\x00png\x00pnn\x00pnt\x00pon\x00ppo\x00pra\x00prd\x00prg\x00psusp" + + "ss\x00ptorptp\x00puu\x00pwa\x00quuequc\x00qug\x00rai\x00raj\x00rao\x00rc" + + "f\x00rej\x00rel\x00res\x00rgn\x00rhg\x00ria\x00rif\x00rjs\x00rkt\x00rmoh" + + "rmf\x00rmo\x00rmt\x00rmu\x00rnunrna\x00rng\x00roonrob\x00rof\x00roo\x00r" + + "ro\x00rtm\x00ruusrue\x00rug\x00rw\x00\x04rwk\x00rwo\x00ryu\x00saansaf" + + "\x00sah\x00saq\x00sas\x00sat\x00sav\x00saz\x00sba\x00sbe\x00sbp\x00scrds" + + "ck\x00scl\x00scn\x00sco\x00scs\x00sdndsdc\x00sdh\x00semesef\x00seh\x00se" + + "i\x00ses\x00sgagsga\x00sgs\x00sgw\x00sgz\x00sh\x00\x02shi\x00shk\x00shn" + + "\x00shu\x00siinsid\x00sig\x00sil\x00sim\x00sjr\x00sklkskc\x00skr\x00sks" + + "\x00sllvsld\x00sli\x00sll\x00sly\x00smmosma\x00smi\x00smj\x00smn\x00smp" + + "\x00smq\x00sms\x00snnasnc\x00snk\x00snp\x00snx\x00sny\x00soomsok\x00soq" + + "\x00sou\x00soy\x00spd\x00spl\x00sps\x00sqqisrrpsrb\x00srn\x00srr\x00srx" + + "\x00ssswssd\x00ssg\x00ssy\x00stotstk\x00stq\x00suunsua\x00sue\x00suk\x00" + + "sur\x00sus\x00svweswwaswb\x00swc\x00swg\x00swp\x00swv\x00sxn\x00sxw\x00s" + + "yl\x00syr\x00szl\x00taamtaj\x00tal\x00tan\x00taq\x00tbc\x00tbd\x00tbf" + + "\x00tbg\x00tbo\x00tbw\x00tbz\x00tci\x00tcy\x00tdd\x00tdg\x00tdh\x00teelt" + + "ed\x00tem\x00teo\x00tet\x00tfi\x00tggktgc\x00tgo\x00tgu\x00thhathl\x00th" + + "q\x00thr\x00tiirtif\x00tig\x00tik\x00tim\x00tio\x00tiv\x00tkuktkl\x00tkr" + + "\x00tkt\x00tlgltlf\x00tlx\x00tly\x00tmh\x00tmy\x00tnsntnh\x00toontof\x00" + + "tog\x00toq\x00tpi\x00tpm\x00tpz\x00tqo\x00trurtru\x00trv\x00trw\x00tssot" + + "sd\x00tsf\x00tsg\x00tsj\x00tsw\x00ttatttd\x00tte\x00ttj\x00ttr\x00tts" + + "\x00ttt\x00tuh\x00tul\x00tum\x00tuq\x00tvd\x00tvl\x00tvu\x00twwitwh\x00t" + + "wq\x00txg\x00tyahtya\x00tyv\x00tzm\x00ubu\x00udm\x00ugiguga\x00ukkruli" + + "\x00umb\x00und\x00unr\x00unx\x00urrduri\x00urt\x00urw\x00usa\x00utr\x00u" + + "vh\x00uvl\x00uzzbvag\x00vai\x00van\x00veenvec\x00vep\x00viievic\x00viv" + + "\x00vls\x00vmf\x00vmw\x00voolvot\x00vro\x00vun\x00vut\x00walnwae\x00waj" + + "\x00wal\x00wan\x00war\x00wbp\x00wbq\x00wbr\x00wci\x00wer\x00wgi\x00whg" + + "\x00wib\x00wiu\x00wiv\x00wja\x00wji\x00wls\x00wmo\x00wnc\x00wni\x00wnu" + + "\x00woolwob\x00wos\x00wrs\x00wsk\x00wtm\x00wuu\x00wuv\x00wwa\x00xav\x00x" + + "bi\x00xcr\x00xes\x00xhhoxla\x00xlc\x00xld\x00xmf\x00xmn\x00xmr\x00xna" + + "\x00xnr\x00xog\x00xon\x00xpr\x00xrb\x00xsa\x00xsi\x00xsm\x00xsr\x00xwe" + + "\x00yam\x00yao\x00yap\x00yas\x00yat\x00yav\x00yay\x00yaz\x00yba\x00ybb" + + "\x00yby\x00yer\x00ygr\x00ygw\x00yiidyko\x00yle\x00ylg\x00yll\x00yml\x00y" + + "ooryon\x00yrb\x00yre\x00yrl\x00yss\x00yua\x00yue\x00yuj\x00yut\x00yuw" + + "\x00zahazag\x00zbl\x00zdj\x00zea\x00zgh\x00zhhozhx\x00zia\x00zlm\x00zmi" + + "\x00zne\x00zuulzxx\x00zza\x00\xff\xff\xff\xff" + +const langNoIndexOffset = 1330 + +// langNoIndex is a bit vector of all 3-letter language codes that are not used as an index +// in lookup tables. The language ids for these language codes are derived directly +// from the letters and are not consecutive. +// Size: 2197 bytes, 2197 elements +var langNoIndex = [2197]uint8{ + // Entry 0 - 3F + 0xff, 0xf8, 0xed, 0xfe, 0xeb, 0xd3, 0x3b, 0xd2, + 0xfb, 0xbf, 0x7a, 0xfa, 0x37, 0x1d, 0x3c, 0x57, + 0x6e, 0x97, 0x73, 0x38, 0xfb, 0xea, 0xbf, 0x70, + 0xad, 0x03, 0xff, 0xff, 0xcf, 0x05, 0x84, 0x62, + 0xe9, 0xbf, 0xfd, 0xbf, 0xbf, 0xf7, 0xfd, 0x77, + 0x0f, 0xff, 0xef, 0x6f, 0xff, 0xfb, 0xdf, 0xe2, + 0xc9, 0xf8, 0x7f, 0x7e, 0x4d, 0xb8, 0x0a, 0x6a, + 0x7c, 0xea, 0xe3, 0xfa, 0x7a, 0xbf, 0x67, 0xff, + // Entry 40 - 7F + 0xff, 0xff, 0xff, 0xdf, 0x2a, 0x54, 0x91, 0xc0, + 0x5d, 0xe3, 0x97, 0x14, 0x07, 0x20, 0xdd, 0xed, + 0x9f, 0x3f, 0xc9, 0x21, 0xf8, 0x3f, 0x94, 0x35, + 0x7c, 0x5f, 0xff, 0x5f, 0x8e, 0x6e, 0xdf, 0xff, + 0xff, 0xff, 0x55, 0x7c, 0xd3, 0xfd, 0xbf, 0xb5, + 0x7b, 0xdf, 0x7f, 0xf7, 0xca, 0xfe, 0xdb, 0xa3, + 0xa8, 0xff, 0x1f, 0x67, 0x7d, 0xeb, 0xef, 0xce, + 0xff, 0xff, 0x9f, 0xff, 0xb7, 0xef, 0xfe, 0xcf, + // Entry 80 - BF + 0xdb, 0xff, 0xf3, 0xcd, 0xfb, 0x2f, 0xff, 0xff, + 0xbb, 0xee, 0xf7, 0xbd, 0xdb, 0xff, 0x5f, 0xf7, + 0xfd, 0xf2, 0xfd, 0xff, 0x5e, 0x2f, 0x3b, 0xba, + 0x7e, 0xff, 0xff, 0xfe, 0xf7, 0xff, 0xdd, 0xff, + 0xfd, 0xdf, 0xfb, 0xfe, 0x9d, 0xb4, 0xd3, 0xff, + 0xef, 0xff, 0xdf, 0xf7, 0x7f, 0xb7, 0xfd, 0xd5, + 0xa5, 0x77, 0x40, 0xff, 0x9c, 0xc1, 0x41, 0x2c, + 0x08, 0x20, 0x41, 0x00, 0x50, 0x40, 0x00, 0x80, + // Entry C0 - FF + 0xfb, 0x4a, 0xf2, 0x9f, 0xb4, 0x42, 0x41, 0x96, + 0x1b, 0x14, 0x08, 0xf2, 0x2b, 0xe7, 0x17, 0x56, + 0x05, 0x7d, 0x0e, 0x1c, 0x37, 0x71, 0xf3, 0xef, + 0x97, 0xff, 0x5d, 0x38, 0x64, 0x08, 0x00, 0x10, + 0xbc, 0x85, 0xaf, 0xdf, 0xff, 0xf7, 0x73, 0x35, + 0x3e, 0x87, 0xc7, 0xdf, 0xff, 0x00, 0x81, 0x00, + 0xb0, 0x05, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x40, 0x00, 0x40, 0x92, 0x21, 0x50, 0xb1, 0x5d, + // Entry 100 - 13F + 0xfd, 0xdc, 0xbe, 0x5e, 0x00, 0x00, 0x02, 0x64, + 0x0d, 0x19, 0x41, 0xdf, 0x79, 0x22, 0x00, 0x00, + 0x00, 0x5e, 0x64, 0xdc, 0x24, 0xe5, 0xd9, 0xe3, + 0xfe, 0xff, 0xfd, 0xcb, 0x9f, 0x14, 0x01, 0x0c, + 0x86, 0x00, 0xd1, 0x00, 0xf0, 0xc5, 0x67, 0x5f, + 0x56, 0x89, 0x5e, 0xb5, 0x6c, 0xaf, 0x03, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xc0, 0x37, 0xda, 0x56, + 0x90, 0x69, 0x01, 0x2c, 0x96, 0x69, 0x20, 0xfb, + // Entry 140 - 17F + 0xff, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x08, 0x16, + 0x01, 0x00, 0x00, 0xb0, 0x14, 0x03, 0x50, 0x06, + 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x09, + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00, 0x04, + 0x08, 0x00, 0x00, 0x04, 0x00, 0x80, 0x28, 0x04, + 0x00, 0x00, 0x40, 0xd5, 0x2d, 0x00, 0x64, 0x35, + 0x24, 0x52, 0xf4, 0xd4, 0xbd, 0x62, 0xc9, 0x03, + // Entry 180 - 1BF + 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x13, 0x39, 0x01, 0xdd, 0x57, 0x98, + 0x21, 0x18, 0x81, 0x00, 0x00, 0x01, 0x40, 0x82, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x40, 0x00, 0x44, 0x00, 0x00, 0x80, 0xea, + 0xa9, 0x39, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x01, 0x28, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x20, 0x04, 0xa6, 0x00, 0x04, 0x00, 0x00, + 0x81, 0x50, 0x00, 0x00, 0x00, 0x11, 0x84, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x55, + 0x02, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x40, + 0x30, 0x83, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0xcd, 0xbf, 0x7a, 0xbf, + // Entry 200 - 23F + 0xdf, 0xc3, 0x83, 0x82, 0xc0, 0xfb, 0x57, 0x27, + 0xcd, 0x55, 0xe7, 0x01, 0x00, 0x20, 0xb2, 0xc5, + 0xa4, 0x45, 0x25, 0x9b, 0x02, 0xdf, 0xe0, 0xdf, + 0x03, 0x44, 0x08, 0x10, 0x01, 0x04, 0x01, 0xe3, + 0x92, 0x54, 0xdb, 0x28, 0xd1, 0x5f, 0xf6, 0x6d, + 0x79, 0xed, 0x1c, 0x7d, 0x04, 0x08, 0x00, 0x01, + 0x21, 0x12, 0x64, 0x5f, 0xdd, 0x0e, 0x85, 0x4f, + 0x40, 0x40, 0x00, 0x04, 0xf1, 0xfd, 0x3d, 0x54, + // Entry 240 - 27F + 0xe8, 0x03, 0xb4, 0x27, 0x23, 0x0d, 0x00, 0x00, + 0x20, 0x7b, 0x38, 0x02, 0x05, 0x84, 0x00, 0xf0, + 0xbb, 0x7e, 0x5a, 0x00, 0x18, 0x04, 0x81, 0x00, + 0x00, 0x00, 0x80, 0x10, 0x90, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x04, + 0x08, 0xa0, 0x70, 0xa5, 0x0c, 0x40, 0x00, 0x00, + 0x11, 0x04, 0x04, 0x68, 0x00, 0x20, 0x70, 0xff, + 0x7b, 0x7f, 0x60, 0x00, 0x05, 0x9b, 0xdd, 0x66, + // Entry 280 - 2BF + 0x03, 0x00, 0x11, 0x00, 0x00, 0x00, 0x40, 0x05, + 0xb5, 0xb6, 0x80, 0x08, 0x04, 0x00, 0x04, 0x51, + 0xe2, 0xef, 0xfd, 0x3f, 0x05, 0x09, 0x08, 0x05, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x60, + 0xe7, 0x48, 0x00, 0x81, 0x20, 0xc0, 0x05, 0x80, + 0x03, 0x00, 0x00, 0x00, 0x8c, 0x50, 0x40, 0x04, + 0x84, 0x47, 0x84, 0x40, 0x20, 0x10, 0x00, 0x20, + // Entry 2C0 - 2FF + 0x02, 0x50, 0x80, 0x11, 0x00, 0x91, 0x6c, 0xe2, + 0x50, 0x27, 0x1d, 0x11, 0x29, 0x06, 0x59, 0xe9, + 0x33, 0x08, 0x00, 0x20, 0x04, 0x40, 0x10, 0x00, + 0x00, 0x00, 0x50, 0x44, 0x92, 0x49, 0xd6, 0x5d, + 0xa7, 0x81, 0x47, 0x97, 0xfb, 0x00, 0x10, 0x00, + 0x08, 0x00, 0x80, 0x00, 0x40, 0x04, 0x00, 0x01, + 0x02, 0x00, 0x01, 0x40, 0x80, 0x00, 0x00, 0x08, + 0xd8, 0xeb, 0xf6, 0x39, 0xc4, 0x89, 0x12, 0x00, + // Entry 300 - 33F + 0x00, 0x0c, 0x04, 0x01, 0x20, 0x20, 0xdd, 0xa0, + 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x04, 0x10, 0xd0, 0x9d, 0x95, 0x13, 0x04, 0x80, + 0x00, 0x01, 0xd0, 0x12, 0x40, 0x00, 0x10, 0xb0, + 0x10, 0x62, 0x4c, 0xd2, 0x02, 0x01, 0x4a, 0x00, + 0x46, 0x04, 0x00, 0x08, 0x02, 0x00, 0x20, 0x80, + 0x00, 0x80, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0xd8, 0x6f, 0x15, 0x02, 0x08, 0x00, + // Entry 340 - 37F + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, + 0x00, 0x10, 0x00, 0x00, 0x00, 0xf0, 0x84, 0xe3, + 0xdd, 0xbf, 0xf9, 0xf9, 0x3b, 0x7f, 0x7f, 0xdb, + 0xfd, 0xfc, 0xfe, 0xdf, 0xff, 0xfd, 0xff, 0xf6, + 0xfb, 0xfc, 0xf7, 0x1f, 0xff, 0xb3, 0x6c, 0xff, + 0xd9, 0xad, 0xdf, 0xfe, 0xef, 0xba, 0xdf, 0xff, + 0xff, 0xff, 0xb7, 0xdd, 0x7d, 0xbf, 0xab, 0x7f, + 0xfd, 0xfd, 0xdf, 0x2f, 0x9c, 0xdf, 0xf3, 0x6f, + // Entry 380 - 3BF + 0xdf, 0xdd, 0xff, 0xfb, 0xee, 0xd2, 0xab, 0x5f, + 0xd5, 0xdf, 0x7f, 0xff, 0xeb, 0xff, 0xe4, 0x4d, + 0xf9, 0xff, 0xfe, 0xf7, 0xfd, 0xdf, 0xfb, 0xbf, + 0xee, 0xdb, 0x6f, 0xef, 0xff, 0x7f, 0xff, 0xff, + 0xf7, 0x5f, 0xd3, 0x3b, 0xfd, 0xd9, 0xdf, 0xeb, + 0xbc, 0x08, 0x05, 0x24, 0xff, 0x07, 0x70, 0xfe, + 0xe6, 0x5e, 0x00, 0x08, 0x00, 0x83, 0x3d, 0x1b, + 0x06, 0xe6, 0x72, 0x60, 0xd1, 0x3c, 0x7f, 0x44, + // Entry 3C0 - 3FF + 0x02, 0x30, 0x9f, 0x7a, 0x16, 0xbd, 0x7f, 0x57, + 0xf2, 0xff, 0x31, 0xff, 0xf2, 0x1e, 0x90, 0xf7, + 0xf1, 0xf9, 0x45, 0x80, 0x01, 0x02, 0x00, 0x00, + 0x40, 0x54, 0x9f, 0x8a, 0xd9, 0xd9, 0x0e, 0x11, + 0x86, 0x51, 0xc0, 0xf3, 0xfb, 0x47, 0x00, 0x01, + 0x05, 0xd1, 0x50, 0x58, 0x00, 0x00, 0x00, 0x10, + 0x04, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x17, 0xd2, + 0xb9, 0xfd, 0xfc, 0xba, 0xfe, 0xef, 0xc7, 0xbe, + // Entry 400 - 43F + 0x53, 0x6f, 0xdf, 0xe7, 0xdb, 0x65, 0xbb, 0x7f, + 0xfa, 0xff, 0x77, 0xf3, 0xef, 0xbf, 0xfd, 0xf7, + 0xdf, 0xdf, 0x9b, 0x7f, 0xff, 0xff, 0x7f, 0x6f, + 0xf7, 0xfb, 0xeb, 0xdf, 0xbc, 0xff, 0xbf, 0x6b, + 0x7b, 0xfb, 0xff, 0xce, 0x76, 0xbd, 0xf7, 0xf7, + 0xdf, 0xdc, 0xf7, 0xf7, 0xff, 0xdf, 0xf3, 0xfe, + 0xef, 0xff, 0xff, 0xff, 0xb6, 0x7f, 0x7f, 0xde, + 0xf7, 0xb9, 0xeb, 0x77, 0xff, 0xfb, 0xbf, 0xdf, + // Entry 440 - 47F + 0xfd, 0xfe, 0xfb, 0xff, 0xfe, 0xeb, 0x1f, 0x7d, + 0x2f, 0xfd, 0xb6, 0xb5, 0xa5, 0xfc, 0xff, 0xfd, + 0x7f, 0x4e, 0xbf, 0x8f, 0xae, 0xff, 0xee, 0xdf, + 0x7f, 0xf7, 0x73, 0x02, 0x02, 0x04, 0xfc, 0xf7, + 0xff, 0xb7, 0xd7, 0xef, 0xfe, 0xcd, 0xf5, 0xce, + 0xe2, 0x8e, 0xe7, 0xbf, 0xb7, 0xff, 0x56, 0xbd, + 0xcd, 0xff, 0xfb, 0xff, 0xdf, 0xd7, 0xea, 0xff, + 0xe5, 0x5f, 0x6d, 0x0f, 0xa7, 0x51, 0x06, 0xc4, + // Entry 480 - 4BF + 0x13, 0x50, 0x5d, 0xaf, 0xa6, 0xfd, 0x99, 0xfb, + 0x63, 0x1d, 0x53, 0xff, 0xef, 0xb7, 0x35, 0x20, + 0x14, 0x00, 0x55, 0x51, 0x82, 0x65, 0xf5, 0x41, + 0xe2, 0xff, 0xfc, 0xdf, 0x00, 0x05, 0xc5, 0x05, + 0x00, 0x22, 0x00, 0x74, 0x69, 0x10, 0x08, 0x04, + 0x41, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x51, 0x20, 0x05, 0x04, 0x01, 0x00, 0x00, + 0x06, 0x01, 0x20, 0x00, 0x18, 0x01, 0x92, 0xb1, + // Entry 4C0 - 4FF + 0xfd, 0x47, 0x49, 0x06, 0x95, 0x06, 0x57, 0xed, + 0xfb, 0x4c, 0x1c, 0x6b, 0x83, 0x04, 0x62, 0x40, + 0x00, 0x11, 0x42, 0x00, 0x00, 0x00, 0x54, 0x83, + 0xb8, 0x4f, 0x10, 0x8c, 0x89, 0x46, 0xde, 0xf7, + 0x13, 0x31, 0x00, 0x20, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, + 0x01, 0x00, 0x00, 0xf0, 0x5b, 0xf4, 0xbe, 0x3d, + 0xba, 0xcf, 0xf7, 0xaf, 0x42, 0x04, 0x84, 0x41, + // Entry 500 - 53F + 0x30, 0xff, 0x79, 0x72, 0x04, 0x00, 0x00, 0x49, + 0x2d, 0x14, 0x27, 0x57, 0xed, 0xf1, 0x3f, 0xe7, + 0x3f, 0x00, 0x00, 0x02, 0xc6, 0xa0, 0x1e, 0xf8, + 0xbb, 0xff, 0xfd, 0xfb, 0xb7, 0xfd, 0xe5, 0xf7, + 0xfd, 0xfc, 0xd5, 0xed, 0x47, 0xf4, 0x7e, 0x10, + 0x01, 0x01, 0x84, 0x6d, 0xff, 0xf7, 0xdd, 0xf9, + 0x5b, 0x05, 0x86, 0xed, 0xf5, 0x77, 0xbd, 0x3c, + 0x00, 0x00, 0x00, 0x42, 0x71, 0x42, 0x00, 0x40, + // Entry 540 - 57F + 0x00, 0x00, 0x01, 0x43, 0x19, 0x00, 0x08, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + // Entry 580 - 5BF + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xab, 0xbd, 0xe7, 0x57, 0xee, 0x13, 0x5d, + 0x09, 0xc1, 0x40, 0x21, 0xfa, 0x17, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0xce, 0xfb, 0xbf, + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x30, 0x15, 0xa3, 0x10, 0x00, 0x00, 0x00, + 0x11, 0x04, 0x16, 0x00, 0x00, 0x02, 0x00, 0x81, + 0xa3, 0x01, 0x50, 0x00, 0x00, 0x83, 0x11, 0x40, + // Entry 5C0 - 5FF + 0x00, 0x00, 0x00, 0xf0, 0xdd, 0x7b, 0x3e, 0x02, + 0xaa, 0x10, 0x5d, 0x98, 0x52, 0x00, 0x80, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x02, + 0x19, 0x00, 0x10, 0x02, 0x10, 0x61, 0x5a, 0x9d, + 0x31, 0x00, 0x00, 0x00, 0x01, 0x10, 0x02, 0x20, + 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x20, 0x00, + 0x00, 0x1f, 0xdf, 0xd2, 0xb9, 0xff, 0xfd, 0x3f, + 0x1f, 0x98, 0xcf, 0x9c, 0xbf, 0xaf, 0x5f, 0xfe, + // Entry 600 - 63F + 0x7b, 0x4b, 0x40, 0x10, 0xe1, 0xfd, 0xaf, 0xd9, + 0xb7, 0xf6, 0xfb, 0xb3, 0xc7, 0xff, 0x6f, 0xf1, + 0x73, 0xb1, 0x7f, 0x9f, 0x7f, 0xbd, 0xfc, 0xb7, + 0xee, 0x1c, 0xfa, 0xcb, 0xef, 0xdd, 0xf9, 0xbd, + 0x6e, 0xae, 0x55, 0xfd, 0x6e, 0x81, 0x76, 0x1f, + 0xd4, 0x77, 0xf5, 0x7d, 0xfb, 0xff, 0xeb, 0xfe, + 0xbe, 0x5f, 0x46, 0x1b, 0xe9, 0x5f, 0x50, 0x18, + 0x02, 0xfa, 0xf7, 0x9d, 0x15, 0x97, 0x05, 0x0f, + // Entry 640 - 67F + 0x75, 0xc4, 0x7d, 0x81, 0x92, 0xf1, 0x57, 0x6c, + 0xff, 0xe4, 0xef, 0x6f, 0xff, 0xfc, 0xdd, 0xde, + 0xfc, 0xfd, 0x76, 0x5f, 0x7a, 0x1f, 0x00, 0x98, + 0x02, 0xfb, 0xa3, 0xef, 0xf3, 0xd6, 0xf2, 0xff, + 0xb9, 0xda, 0x7d, 0x50, 0x1e, 0x15, 0x7b, 0xb4, + 0xf5, 0x3e, 0xff, 0xff, 0xf1, 0xf7, 0xff, 0xe7, + 0x5f, 0xff, 0xff, 0x9e, 0xdb, 0xf6, 0xd7, 0xb9, + 0xef, 0x27, 0x80, 0xbb, 0xc5, 0xff, 0xff, 0xe3, + // Entry 680 - 6BF + 0x97, 0x9d, 0xbf, 0x9f, 0xf7, 0xc7, 0xfd, 0x37, + 0xce, 0x7f, 0x04, 0x1d, 0x53, 0x7f, 0xf8, 0xda, + 0x5d, 0xce, 0x7d, 0x06, 0xb9, 0xea, 0x69, 0xa0, + 0x1a, 0x20, 0x00, 0x30, 0x02, 0x04, 0x24, 0x08, + 0x04, 0x00, 0x00, 0x40, 0xd4, 0x02, 0x04, 0x00, + 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x01, 0x06, + 0x50, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, + 0x04, 0x00, 0x10, 0xcc, 0x58, 0xd5, 0x0d, 0x0f, + // Entry 6C0 - 6FF + 0x14, 0x4d, 0xf1, 0x16, 0x44, 0xd1, 0x42, 0x08, + 0x40, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00, + 0x00, 0xdc, 0xfb, 0xcb, 0x0e, 0x58, 0x08, 0x41, + 0x04, 0x20, 0x04, 0x00, 0x30, 0x12, 0x40, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x80, 0x10, 0x10, 0xab, + 0x6d, 0x93, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x80, 0x25, 0x00, 0x00, + // Entry 700 - 73F + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x80, 0x86, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x01, + 0xdf, 0x18, 0x00, 0x00, 0x02, 0xf0, 0xfd, 0x79, + 0x3b, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x03, 0x00, 0x09, 0x20, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 740 - 77F + 0x00, 0x00, 0x00, 0xef, 0xd5, 0xfd, 0xcf, 0x7e, + 0xb0, 0x11, 0x00, 0x00, 0x00, 0x92, 0x01, 0x44, + 0xcd, 0xf9, 0x5c, 0x00, 0x01, 0x00, 0x30, 0x04, + 0x04, 0x55, 0x00, 0x01, 0x04, 0xf4, 0x3f, 0x4a, + 0x01, 0x00, 0x00, 0xb0, 0x80, 0x00, 0x55, 0x55, + 0x97, 0x7c, 0x9f, 0x31, 0xcc, 0x68, 0xd1, 0x03, + 0xd5, 0x57, 0x27, 0x14, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2c, 0xf7, 0xcb, 0x1f, 0x14, 0x60, + // Entry 780 - 7BF + 0x03, 0x68, 0x01, 0x10, 0x8b, 0x38, 0x8a, 0x01, + 0x00, 0x00, 0x20, 0x00, 0x24, 0x44, 0x00, 0x00, + 0x10, 0x03, 0x11, 0x02, 0x01, 0x00, 0x00, 0xf0, + 0xf5, 0xff, 0xd5, 0x97, 0xbc, 0x70, 0xd6, 0x78, + 0x78, 0x15, 0x50, 0x01, 0xa4, 0x84, 0xa9, 0x41, + 0x00, 0x00, 0x00, 0x6b, 0x39, 0x52, 0x74, 0x00, + 0xe8, 0x30, 0x90, 0x6a, 0x92, 0x00, 0x00, 0x02, + 0xff, 0xef, 0xff, 0x4b, 0x85, 0x53, 0xf4, 0xed, + // Entry 7C0 - 7FF + 0xdd, 0xbf, 0x72, 0x19, 0xc7, 0x0c, 0xd5, 0x42, + 0x54, 0xdd, 0x77, 0x14, 0x00, 0x80, 0x40, 0x56, + 0xcc, 0x16, 0x9e, 0xea, 0x35, 0x7d, 0xef, 0xff, + 0xbd, 0xa4, 0xaf, 0x01, 0x44, 0x18, 0x01, 0x4d, + 0x4e, 0x4a, 0x08, 0x50, 0x28, 0x30, 0xe0, 0x80, + 0x10, 0x20, 0x24, 0x00, 0xff, 0x2f, 0xd3, 0x60, + 0xfe, 0x01, 0x02, 0x88, 0x0a, 0x40, 0x16, 0x01, + 0x01, 0x15, 0x2b, 0x3c, 0x01, 0x00, 0x00, 0x10, + // Entry 800 - 83F + 0x90, 0x49, 0x41, 0x02, 0x02, 0x01, 0xe1, 0xbf, + 0xbf, 0x03, 0x00, 0x00, 0x10, 0xd4, 0xa3, 0xd1, + 0x40, 0x9c, 0x44, 0xdf, 0xf5, 0x8f, 0x66, 0xb3, + 0x55, 0x20, 0xd4, 0xc1, 0xd8, 0x30, 0x3d, 0x80, + 0x00, 0x00, 0x00, 0x04, 0xd4, 0x11, 0xc5, 0x84, + 0x2e, 0x50, 0x00, 0x22, 0x50, 0x6e, 0xbd, 0x93, + 0x07, 0x00, 0x20, 0x10, 0x84, 0xb2, 0x45, 0x10, + 0x06, 0x44, 0x00, 0x00, 0x12, 0x02, 0x11, 0x00, + // Entry 840 - 87F + 0xf0, 0xfb, 0xfd, 0x3f, 0x05, 0x00, 0x12, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x02, 0x28, + 0x84, 0x00, 0x21, 0xc0, 0x23, 0x24, 0x00, 0x00, + 0x00, 0xcb, 0xe4, 0x3a, 0x42, 0x88, 0x14, 0xf1, + 0xef, 0xff, 0x7f, 0x12, 0x01, 0x01, 0x84, 0x50, + 0x07, 0xfc, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x40, + 0x10, 0x38, 0x01, 0x01, 0x1c, 0x12, 0x40, 0xe1, + // Entry 880 - 8BF + 0x76, 0x16, 0x08, 0x03, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x24, + 0x0a, 0x00, 0x80, 0x00, 0x00, +} + +// altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives +// to 2-letter language codes that cannot be derived using the method described above. +// Each 3-letter code is followed by its 1-byte langID. +const altLangISO3 tag.Index = "---\x00cor\x00hbs\x01heb\x02kin\x03spa\x04yid\x05\xff\xff\xff\xff" + +// altLangIndex is used to convert indexes in altLangISO3 to langIDs. +// Size: 12 bytes, 6 elements +var altLangIndex = [6]uint16{ + 0x0281, 0x0407, 0x01fb, 0x03e5, 0x013e, 0x0208, +} + +// langAliasMap maps langIDs to their suggested replacements. +// Size: 656 bytes, 164 elements +var langAliasMap = [164]fromTo{ + 0: {from: 0x82, to: 0x88}, + 1: {from: 0x187, to: 0x1ae}, + 2: {from: 0x1f3, to: 0x1e1}, + 3: {from: 0x1fb, to: 0x1bc}, + 4: {from: 0x208, to: 0x512}, + 5: {from: 0x20f, to: 0x20e}, + 6: {from: 0x310, to: 0x3dc}, + 7: {from: 0x347, to: 0x36f}, + 8: {from: 0x407, to: 0x432}, + 9: {from: 0x47a, to: 0x153}, + 10: {from: 0x490, to: 0x451}, + 11: {from: 0x4a2, to: 0x21}, + 12: {from: 0x53e, to: 0x544}, + 13: {from: 0x58f, to: 0x12d}, + 14: {from: 0x630, to: 0x1eb1}, + 15: {from: 0x651, to: 0x431}, + 16: {from: 0x662, to: 0x431}, + 17: {from: 0x6ed, to: 0x3a}, + 18: {from: 0x6f8, to: 0x1d7}, + 19: {from: 0x73e, to: 0x21a1}, + 20: {from: 0x7b3, to: 0x56}, + 21: {from: 0x7b9, to: 0x299b}, + 22: {from: 0x7c5, to: 0x58}, + 23: {from: 0x7e6, to: 0x145}, + 24: {from: 0x80c, to: 0x5a}, + 25: {from: 0x815, to: 0x8d}, + 26: {from: 0x87e, to: 0x810}, + 27: {from: 0x8c3, to: 0xee3}, + 28: {from: 0x9ef, to: 0x331}, + 29: {from: 0xa36, to: 0x2c5}, + 30: {from: 0xa3d, to: 0xbf}, + 31: {from: 0xabe, to: 0x3322}, + 32: {from: 0xb38, to: 0x529}, + 33: {from: 0xb75, to: 0x265a}, + 34: {from: 0xb7e, to: 0xbc3}, + 35: {from: 0xb9b, to: 0x44e}, + 36: {from: 0xbbc, to: 0x4229}, + 37: {from: 0xbbf, to: 0x529}, + 38: {from: 0xbfe, to: 0x2da7}, + 39: {from: 0xc2e, to: 0x3181}, + 40: {from: 0xcb9, to: 0xf3}, + 41: {from: 0xd08, to: 0xfa}, + 42: {from: 0xdc8, to: 0x11a}, + 43: {from: 0xdd7, to: 0x32d}, + 44: {from: 0xdf8, to: 0xdfb}, + 45: {from: 0xdfe, to: 0x531}, + 46: {from: 0xedf, to: 0x205a}, + 47: {from: 0xeee, to: 0x2e9a}, + 48: {from: 0xf39, to: 0x367}, + 49: {from: 0x10d0, to: 0x140}, + 50: {from: 0x1104, to: 0x2d0}, + 51: {from: 0x11a0, to: 0x1ec}, + 52: {from: 0x1279, to: 0x21}, + 53: {from: 0x1424, to: 0x15e}, + 54: {from: 0x1470, to: 0x14e}, + 55: {from: 0x151f, to: 0xd9b}, + 56: {from: 0x1523, to: 0x390}, + 57: {from: 0x1532, to: 0x19f}, + 58: {from: 0x1580, to: 0x210}, + 59: {from: 0x1583, to: 0x10d}, + 60: {from: 0x15a3, to: 0x3caf}, + 61: {from: 0x166a, to: 0x19b}, + 62: {from: 0x16c8, to: 0x136}, + 63: {from: 0x1700, to: 0x29f8}, + 64: {from: 0x1718, to: 0x194}, + 65: {from: 0x1727, to: 0xf3f}, + 66: {from: 0x177a, to: 0x178}, + 67: {from: 0x1809, to: 0x17b6}, + 68: {from: 0x1816, to: 0x18f3}, + 69: {from: 0x188a, to: 0x436}, + 70: {from: 0x1979, to: 0x1d01}, + 71: {from: 0x1a74, to: 0x2bb0}, + 72: {from: 0x1a8a, to: 0x1f8}, + 73: {from: 0x1b5a, to: 0x1fa}, + 74: {from: 0x1b86, to: 0x1515}, + 75: {from: 0x1d64, to: 0x2c9b}, + 76: {from: 0x2038, to: 0x37b1}, + 77: {from: 0x203d, to: 0x20dd}, + 78: {from: 0x205a, to: 0x30b}, + 79: {from: 0x20e3, to: 0x274}, + 80: {from: 0x20ee, to: 0x263}, + 81: {from: 0x20f2, to: 0x22d}, + 82: {from: 0x20f9, to: 0x256}, + 83: {from: 0x210f, to: 0x21eb}, + 84: {from: 0x2135, to: 0x27d}, + 85: {from: 0x2160, to: 0x913}, + 86: {from: 0x2199, to: 0x121}, + 87: {from: 0x21ce, to: 0x1561}, + 88: {from: 0x21e6, to: 0x504}, + 89: {from: 0x21f4, to: 0x49f}, + 90: {from: 0x222d, to: 0x121}, + 91: {from: 0x2237, to: 0x121}, + 92: {from: 0x2262, to: 0x92a}, + 93: {from: 0x2316, to: 0x3226}, + 94: {from: 0x2382, to: 0x3365}, + 95: {from: 0x2472, to: 0x2c7}, + 96: {from: 0x24e4, to: 0x2ff}, + 97: {from: 0x24f0, to: 0x2fa}, + 98: {from: 0x24fa, to: 0x31f}, + 99: {from: 0x2550, to: 0xb5b}, + 100: {from: 0x25a9, to: 0xe2}, + 101: {from: 0x263e, to: 0x2d0}, + 102: {from: 0x26c9, to: 0x26b4}, + 103: {from: 0x26f9, to: 0x3c8}, + 104: {from: 0x2727, to: 0x3caf}, + 105: {from: 0x2765, to: 0x26b4}, + 106: {from: 0x2789, to: 0x4358}, + 107: {from: 0x28ef, to: 0x2837}, + 108: {from: 0x2914, to: 0x351}, + 109: {from: 0x2986, to: 0x2da7}, + 110: {from: 0x2b1a, to: 0x38d}, + 111: {from: 0x2bfc, to: 0x395}, + 112: {from: 0x2c3f, to: 0x3caf}, + 113: {from: 0x2cfc, to: 0x3be}, + 114: {from: 0x2d13, to: 0x597}, + 115: {from: 0x2d47, to: 0x148}, + 116: {from: 0x2d48, to: 0x148}, + 117: {from: 0x2dff, to: 0x2f1}, + 118: {from: 0x2e08, to: 0x19cc}, + 119: {from: 0x2e1a, to: 0x2d95}, + 120: {from: 0x2e21, to: 0x292}, + 121: {from: 0x2e54, to: 0x7d}, + 122: {from: 0x2e65, to: 0x2282}, + 123: {from: 0x2ea0, to: 0x2e9b}, + 124: {from: 0x2eef, to: 0x2ed7}, + 125: {from: 0x3193, to: 0x3c4}, + 126: {from: 0x3366, to: 0x338e}, + 127: {from: 0x342a, to: 0x3dc}, + 128: {from: 0x34ee, to: 0x18d0}, + 129: {from: 0x35c8, to: 0x2c9b}, + 130: {from: 0x35e6, to: 0x412}, + 131: {from: 0x3658, to: 0x246}, + 132: {from: 0x3676, to: 0x3f4}, + 133: {from: 0x36fd, to: 0x445}, + 134: {from: 0x37c0, to: 0x121}, + 135: {from: 0x3816, to: 0x38f2}, + 136: {from: 0x382b, to: 0x2c9b}, + 137: {from: 0x382f, to: 0xa9}, + 138: {from: 0x3832, to: 0x3228}, + 139: {from: 0x386c, to: 0x39a6}, + 140: {from: 0x3892, to: 0x3fc0}, + 141: {from: 0x38a5, to: 0x39d7}, + 142: {from: 0x38b4, to: 0x1fa4}, + 143: {from: 0x38b5, to: 0x2e9a}, + 144: {from: 0x395c, to: 0x47e}, + 145: {from: 0x3b4e, to: 0xd91}, + 146: {from: 0x3b78, to: 0x137}, + 147: {from: 0x3c99, to: 0x4bc}, + 148: {from: 0x3fbd, to: 0x100}, + 149: {from: 0x4208, to: 0xa91}, + 150: {from: 0x42be, to: 0x573}, + 151: {from: 0x42f9, to: 0x3f60}, + 152: {from: 0x4378, to: 0x25a}, + 153: {from: 0x43cb, to: 0x36cb}, + 154: {from: 0x43cd, to: 0x10f}, + 155: {from: 0x44af, to: 0x3322}, + 156: {from: 0x44e3, to: 0x512}, + 157: {from: 0x45ca, to: 0x2409}, + 158: {from: 0x45dd, to: 0x26dc}, + 159: {from: 0x4610, to: 0x48ae}, + 160: {from: 0x46ae, to: 0x46a0}, + 161: {from: 0x473e, to: 0x4745}, + 162: {from: 0x4916, to: 0x31f}, + 163: {from: 0x49a7, to: 0x523}, +} + +// Size: 164 bytes, 164 elements +var langAliasTypes = [164]langAliasType{ + // Entry 0 - 3F + 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 0, 1, 0, 0, 1, 2, + 1, 1, 2, 0, 1, 0, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, + 2, 0, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 0, 0, + 2, 1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 2, 0, 1, 2, 0, + // Entry 40 - 7F + 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, + 2, 2, 2, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, + 0, 1, 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 2, + // Entry 80 - BF + 0, 0, 2, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, + 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, + 0, 1, 1, 1, +} + +const ( + _Latn = 87 + _Hani = 54 + _Hans = 56 + _Hant = 57 + _Qaaa = 139 + _Qaai = 147 + _Qabx = 188 + _Zinh = 236 + _Zyyy = 241 + _Zzzz = 242 +) + +// script is an alphabetically sorted list of ISO 15924 codes. The index +// of the script in the string, divided by 4, is the internal scriptID. +const script tag.Index = "" + // Size: 976 bytes + "----AdlmAfakAghbAhomArabAranArmiArmnAvstBaliBamuBassBatkBengBhksBlisBopo" + + "BrahBraiBugiBuhdCakmCansCariChamCherCirtCoptCpmnCprtCyrlCyrsDevaDogrDsrt" + + "DuplEgydEgyhEgypElbaEthiGeokGeorGlagGongGonmGothGranGrekGujrGuruHanbHang" + + "HaniHanoHansHantHatrHebrHiraHluwHmngHmnpHrktHungIndsItalJamoJavaJpanJurc" + + "KaliKanaKharKhmrKhojKitlKitsKndaKoreKpelKthiLanaLaooLatfLatgLatnLekeLepc" + + "LimbLinaLinbLisuLomaLyciLydiMahjMakaMandManiMarcMayaMedfMendMercMeroMlym" + + "ModiMongMoonMrooMteiMultMymrNarbNbatNewaNkdbNkgbNkooNshuOgamOlckOrkhOrya" + + "OsgeOsmaPalmPaucPermPhagPhliPhlpPhlvPhnxPiqdPlrdPrtiQaaaQaabQaacQaadQaae" + + "QaafQaagQaahQaaiQaajQaakQaalQaamQaanQaaoQaapQaaqQaarQaasQaatQaauQaavQaaw" + + "QaaxQaayQaazQabaQabbQabcQabdQabeQabfQabgQabhQabiQabjQabkQablQabmQabnQabo" + + "QabpQabqQabrQabsQabtQabuQabvQabwQabxRjngRoroRunrSamrSaraSarbSaurSgnwShaw" + + "ShrdShuiSiddSindSinhSoraSoyoSundSyloSyrcSyreSyrjSyrnTagbTakrTaleTaluTaml" + + "TangTavtTeluTengTfngTglgThaaThaiTibtTirhUgarVaiiVispWaraWchoWoleXpeoXsux" + + "YiiiZanbZinhZmthZsyeZsymZxxxZyyyZzzz\xff\xff\xff\xff" + +// suppressScript is an index from langID to the dominant script for that language, +// if it exists. If a script is given, it should be suppressed from the language tag. +// Size: 1330 bytes, 1330 elements +var suppressScript = [1330]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 40 - 7F + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, + // Entry 80 - BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry C0 - FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 100 - 13F + 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x57, 0x00, + // Entry 140 - 17F + 0x57, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x57, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 180 - 1BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x21, 0x00, + // Entry 1C0 - 1FF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x57, 0x00, 0x57, 0x57, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x57, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, + // Entry 200 - 23F + 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 240 - 27F + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x4f, 0x00, 0x00, 0x50, 0x00, 0x21, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 280 - 2BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 2C0 - 2FF + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, + // Entry 300 - 33F + 0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x57, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + // Entry 340 - 37F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x57, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x57, 0x00, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 380 - 3BF + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, + // Entry 3C0 - 3FF + 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 400 - 43F + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + // Entry 440 - 47F + 0x00, 0x00, 0x00, 0x00, 0x57, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xda, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x29, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, + // Entry 480 - 4BF + 0x57, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x57, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 4C0 - 4FF + 0x57, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Entry 500 - 53F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, + 0x00, 0x00, +} + const ( _001 = 1 _419 = 31 @@ -34,20 +1009,2290 @@ const ( _XC = 325 _XK = 333 ) -const ( - _Latn = 87 - _Hani = 54 - _Hans = 56 - _Hant = 57 - _Qaaa = 139 - _Qaai = 147 - _Qabx = 188 - _Zinh = 236 - _Zyyy = 241 - _Zzzz = 242 -) -var regionToGroups = []uint8{ // 357 elements +// isoRegionOffset needs to be added to the index of regionISO to obtain the regionID +// for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for +// the UN.M49 codes used for groups.) +const isoRegionOffset = 32 + +// regionTypes defines the status of a region for various standards. +// Size: 358 bytes, 358 elements +var regionTypes = [358]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 40 - 7F + 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, 0x04, + 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, + 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, + 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x06, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 80 - BF + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x00, 0x04, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry C0 - FF + 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x00, 0x06, 0x04, 0x06, + 0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, + 0x06, 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + // Entry 100 - 13F + 0x05, 0x05, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x02, 0x06, 0x04, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, + // Entry 140 - 17F + 0x06, 0x00, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x06, 0x06, + 0x04, 0x06, 0x06, 0x04, 0x06, 0x05, +} + +// regionISO holds a list of alphabetically sorted 2-letter ISO region codes. +// Each 2-letter codes is followed by two bytes with the following meaning: +// - [A-Z}{2}: the first letter of the 2-letter code plus these two +// letters form the 3-letter ISO code. +// - 0, n: index into altRegionISO3. +const regionISO tag.Index = "" + // Size: 1308 bytes + "AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" + + "AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" + + "BUURBVVTBWWABYLRBZLZCAANCCCKCDODCFAFCGOGCHHECIIVCKOKCLHLCMMRCNHNCOOLCPPT" + + "CRRICS\x00\x00CTTECUUBCVPVCWUWCXXRCYYPCZZEDDDRDEEUDGGADJJIDKNKDMMADOOMDY" + + "HYDZZAEA ECCUEESTEGGYEHSHERRIESSPETTHEU\x00\x03EZ FIINFJJIFKLKFMSMFORO" + + "FQ\x00\x18FRRAFXXXGAABGBBRGDRDGEEOGFUFGGGYGHHAGIIBGLRLGMMBGNINGPLPGQNQGR" + + "RCGS\x00\x06GTTMGUUMGWNBGYUYHKKGHMMDHNNDHRRVHTTIHUUNHVVOIC IDDNIERLILSR" + + "IMMNINNDIOOTIQRQIRRNISSLITTAJEEYJMAMJOORJPPNJTTNKEENKGGZKHHMKIIRKM\x00" + + "\x09KNNAKP\x00\x0cKRORKWWTKY\x00\x0fKZAZLAAOLBBNLCCALIIELKKALRBRLSSOLTTU" + + "LUUXLVVALYBYMAARMCCOMDDAMENEMFAFMGDGMHHLMIIDMKKDMLLIMMMRMNNGMOACMPNPMQTQ" + + "MRRTMSSRMTLTMUUSMVDVMWWIMXEXMYYSMZOZNAAMNCCLNEERNFFKNGGANHHBNIICNLLDNOOR" + + "NPPLNQ\x00\x1eNRRUNTTZNUIUNZZLOMMNPAANPCCIPEERPFYFPGNGPHHLPKAKPLOLPM\x00" + + "\x12PNCNPRRIPSSEPTRTPUUSPWLWPYRYPZCZQAATQMMMQNNNQOOOQPPPQQQQQRRRQSSSQTTT" + + "QU\x00\x03QVVVQWWWQXXXQYYYQZZZREEURHHOROOURS\x00\x15RUUSRWWASAAUSBLBSCYC" + + "SDDNSEWESGGPSHHNSIVNSJJMSKVKSLLESMMRSNENSOOMSRURSSSDSTTPSUUNSVLVSXXMSYYR" + + "SZWZTAAATCCATDCDTF\x00\x18TGGOTHHATJJKTKKLTLLSTMKMTNUNTOONTPMPTRURTTTOTV" + + "UVTWWNTZZAUAKRUGGAUK UMMIUN USSAUYRYUZZBVAATVCCTVDDRVEENVGGBVIIRVNNMVU" + + "UTWFLFWKAKWSSMXAAAXBBBXCCCXDDDXEEEXFFFXGGGXHHHXIIIXJJJXKKKXLLLXMMMXNNNXO" + + "OOXPPPXQQQXRRRXSSSXTTTXUUUXVVVXWWWXXXXXYYYXZZZYDMDYEEMYT\x00\x1bYUUGZAAF" + + "ZMMBZRARZWWEZZZZ\xff\xff\xff\xff" + +// altRegionISO3 holds a list of 3-letter region codes that cannot be +// mapped to 2-letter codes using the default algorithm. This is a short list. +const altRegionISO3 string = "SCGQUUSGSCOMPRKCYMSPMSRBATFMYTATN" + +// altRegionIDs holds a list of regionIDs the positions of which match those +// of the 3-letter ISO codes in altRegionISO3. +// Size: 22 bytes, 11 elements +var altRegionIDs = [11]uint16{ + 0x0057, 0x0070, 0x0088, 0x00a8, 0x00aa, 0x00ad, 0x00ea, 0x0105, + 0x0121, 0x015f, 0x00dc, +} + +// Size: 80 bytes, 20 elements +var regionOldMap = [20]fromTo{ + 0: {from: 0x44, to: 0xc4}, + 1: {from: 0x58, to: 0xa7}, + 2: {from: 0x5f, to: 0x60}, + 3: {from: 0x66, to: 0x3b}, + 4: {from: 0x79, to: 0x78}, + 5: {from: 0x93, to: 0x37}, + 6: {from: 0xa3, to: 0x133}, + 7: {from: 0xc1, to: 0x133}, + 8: {from: 0xd7, to: 0x13f}, + 9: {from: 0xdc, to: 0x2b}, + 10: {from: 0xef, to: 0x133}, + 11: {from: 0xf2, to: 0xe2}, + 12: {from: 0xfc, to: 0x70}, + 13: {from: 0x103, to: 0x164}, + 14: {from: 0x12a, to: 0x126}, + 15: {from: 0x132, to: 0x7b}, + 16: {from: 0x13a, to: 0x13e}, + 17: {from: 0x141, to: 0x133}, + 18: {from: 0x15d, to: 0x15e}, + 19: {from: 0x163, to: 0x4b}, +} + +// m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are +// codes indicating collections of regions. +// Size: 716 bytes, 358 elements +var m49 = [358]int16{ + // Entry 0 - 3F + 0, 1, 2, 3, 5, 9, 11, 13, + 14, 15, 17, 18, 19, 21, 29, 30, + 34, 35, 39, 53, 54, 57, 61, 142, + 143, 145, 150, 151, 154, 155, 202, 419, + 958, 0, 20, 784, 4, 28, 660, 8, + 51, 530, 24, 10, 32, 16, 40, 36, + 533, 248, 31, 70, 52, 50, 56, 854, + 100, 48, 108, 204, 652, 60, 96, 68, + // Entry 40 - 7F + 535, 76, 44, 64, 104, 74, 72, 112, + 84, 124, 166, 180, 140, 178, 756, 384, + 184, 152, 120, 156, 170, 0, 188, 891, + 296, 192, 132, 531, 162, 196, 203, 278, + 276, 0, 262, 208, 212, 214, 204, 12, + 0, 218, 233, 818, 732, 232, 724, 231, + 967, 0, 246, 242, 238, 583, 234, 0, + 250, 249, 266, 826, 308, 268, 254, 831, + // Entry 80 - BF + 288, 292, 304, 270, 324, 312, 226, 300, + 239, 320, 316, 624, 328, 344, 334, 340, + 191, 332, 348, 854, 0, 360, 372, 376, + 833, 356, 86, 368, 364, 352, 380, 832, + 388, 400, 392, 581, 404, 417, 116, 296, + 174, 659, 408, 410, 414, 136, 398, 418, + 422, 662, 438, 144, 430, 426, 440, 442, + 428, 434, 504, 492, 498, 499, 663, 450, + // Entry C0 - FF + 584, 581, 807, 466, 104, 496, 446, 580, + 474, 478, 500, 470, 480, 462, 454, 484, + 458, 508, 516, 540, 562, 574, 566, 548, + 558, 528, 578, 524, 10, 520, 536, 570, + 554, 512, 591, 0, 604, 258, 598, 608, + 586, 616, 666, 612, 630, 275, 620, 581, + 585, 600, 591, 634, 959, 960, 961, 962, + 963, 964, 965, 966, 967, 968, 969, 970, + // Entry 100 - 13F + 971, 972, 638, 716, 642, 688, 643, 646, + 682, 90, 690, 729, 752, 702, 654, 705, + 744, 703, 694, 674, 686, 706, 740, 728, + 678, 810, 222, 534, 760, 748, 0, 796, + 148, 260, 768, 764, 762, 772, 626, 795, + 788, 776, 626, 792, 780, 798, 158, 834, + 804, 800, 826, 581, 0, 840, 858, 860, + 336, 670, 704, 862, 92, 850, 704, 548, + // Entry 140 - 17F + 876, 581, 882, 973, 974, 975, 976, 977, + 978, 979, 980, 981, 982, 983, 984, 985, + 986, 987, 988, 989, 990, 991, 992, 993, + 994, 995, 996, 997, 998, 720, 887, 175, + 891, 710, 894, 180, 716, 999, +} + +// m49Index gives indexes into fromM49 based on the three most significant bits +// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in +// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]] +// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code. +// The region code is stored in the 9 lsb of the indexed value. +// Size: 18 bytes, 9 elements +var m49Index = [9]int16{ + 0, 59, 108, 143, 181, 220, 259, 291, + 333, +} + +// fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details. +// Size: 666 bytes, 333 elements +var fromM49 = [333]uint16{ + // Entry 0 - 3F + 0x0201, 0x0402, 0x0603, 0x0824, 0x0a04, 0x1027, 0x1205, 0x142b, + 0x1606, 0x1867, 0x1a07, 0x1c08, 0x1e09, 0x202d, 0x220a, 0x240b, + 0x260c, 0x2822, 0x2a0d, 0x302a, 0x3825, 0x3a0e, 0x3c0f, 0x3e32, + 0x402c, 0x4410, 0x4611, 0x482f, 0x4e12, 0x502e, 0x5842, 0x6039, + 0x6435, 0x6628, 0x6834, 0x6a13, 0x6c14, 0x7036, 0x7215, 0x783d, + 0x7a16, 0x8043, 0x883f, 0x8c33, 0x9046, 0x9445, 0x9841, 0xa848, + 0xac9a, 0xb509, 0xb93c, 0xc03e, 0xc838, 0xd0c4, 0xd83a, 0xe047, + 0xe8a6, 0xf052, 0xf849, 0x085a, 0x10ad, 0x184c, 0x1c17, 0x1e18, + // Entry 40 - 7F + 0x20b3, 0x2219, 0x2920, 0x2c1a, 0x2e1b, 0x3051, 0x341c, 0x361d, + 0x3853, 0x3d2e, 0x445c, 0x4c4a, 0x5454, 0x5ca8, 0x5f5f, 0x644d, + 0x684b, 0x7050, 0x7856, 0x7e90, 0x8059, 0x885d, 0x941e, 0x965e, + 0x983b, 0xa063, 0xa864, 0xac65, 0xb469, 0xbd1a, 0xc486, 0xcc6f, + 0xce6f, 0xd06d, 0xd26a, 0xd476, 0xdc74, 0xde88, 0xe473, 0xec72, + 0xf031, 0xf279, 0xf478, 0xfc7e, 0x04e5, 0x0921, 0x0c62, 0x147a, + 0x187d, 0x1c83, 0x26ed, 0x2860, 0x2c5f, 0x3060, 0x4080, 0x4881, + 0x50a7, 0x5887, 0x6082, 0x687c, 0x7085, 0x788a, 0x8089, 0x8884, + // Entry 80 - BF + 0x908c, 0x9891, 0x9c8e, 0xa138, 0xa88f, 0xb08d, 0xb892, 0xc09d, + 0xc899, 0xd095, 0xd89c, 0xe09b, 0xe896, 0xf097, 0xf89e, 0x004f, + 0x08a0, 0x10a2, 0x1cae, 0x20a1, 0x28a4, 0x30aa, 0x34ab, 0x3cac, + 0x42a5, 0x44af, 0x461f, 0x4cb0, 0x54b5, 0x58b8, 0x5cb4, 0x64b9, + 0x6cb2, 0x70b6, 0x74b7, 0x7cc6, 0x84bf, 0x8cce, 0x94d0, 0x9ccd, + 0xa4c3, 0xaccb, 0xb4c8, 0xbcc9, 0xc0cc, 0xc8cf, 0xd8bb, 0xe0c5, + 0xe4bc, 0xe6bd, 0xe8ca, 0xf0ba, 0xf8d1, 0x00e1, 0x08d2, 0x10dd, + 0x18db, 0x20d9, 0x2429, 0x265b, 0x2a30, 0x2d1b, 0x2e40, 0x30de, + // Entry C0 - FF + 0x38d3, 0x493f, 0x54e0, 0x5cd8, 0x64d4, 0x6cd6, 0x74df, 0x7cd5, + 0x84da, 0x88c7, 0x8b33, 0x8e75, 0x90c0, 0x92f0, 0x94e8, 0x9ee2, + 0xace6, 0xb0f1, 0xb8e4, 0xc0e7, 0xc8eb, 0xd0e9, 0xd8ee, 0xe08b, + 0xe526, 0xecec, 0xf4f3, 0xfd02, 0x0504, 0x0706, 0x0d07, 0x183c, + 0x1d0e, 0x26a9, 0x2826, 0x2cb1, 0x2ebe, 0x34ea, 0x3d39, 0x4513, + 0x4d18, 0x5508, 0x5d14, 0x6105, 0x650a, 0x6d12, 0x7d0d, 0x7f11, + 0x813e, 0x830f, 0x8515, 0x8d61, 0x9964, 0xa15d, 0xa86e, 0xb117, + 0xb30b, 0xb86c, 0xc10b, 0xc916, 0xd110, 0xd91d, 0xe10c, 0xe84e, + // Entry 100 - 13F + 0xf11c, 0xf524, 0xf923, 0x0122, 0x0925, 0x1129, 0x192c, 0x2023, + 0x2928, 0x312b, 0x3727, 0x391f, 0x3d2d, 0x4131, 0x4930, 0x4ec2, + 0x5519, 0x646b, 0x747b, 0x7e7f, 0x809f, 0x8298, 0x852f, 0x9135, + 0xa53d, 0xac37, 0xb536, 0xb937, 0xbd3b, 0xd940, 0xe542, 0xed5e, + 0xef5e, 0xf657, 0xfd62, 0x7c20, 0x7ef4, 0x80f5, 0x82f6, 0x84f7, + 0x86f8, 0x88f9, 0x8afa, 0x8cfb, 0x8e70, 0x90fd, 0x92fe, 0x94ff, + 0x9700, 0x9901, 0x9b43, 0x9d44, 0x9f45, 0xa146, 0xa347, 0xa548, + 0xa749, 0xa94a, 0xab4b, 0xad4c, 0xaf4d, 0xb14e, 0xb34f, 0xb550, + // Entry 140 - 17F + 0xb751, 0xb952, 0xbb53, 0xbd54, 0xbf55, 0xc156, 0xc357, 0xc558, + 0xc759, 0xc95a, 0xcb5b, 0xcd5c, 0xcf65, +} + +// Size: 1615 bytes +var variantIndex = map[string]uint8{ + "1606nict": 0x0, + "1694acad": 0x1, + "1901": 0x2, + "1959acad": 0x3, + "1994": 0x4d, + "1996": 0x4, + "abl1943": 0x5, + "akuapem": 0x6, + "alalc97": 0x4f, + "aluku": 0x7, + "ao1990": 0x8, + "arevela": 0x9, + "arevmda": 0xa, + "asante": 0xb, + "baku1926": 0xc, + "balanka": 0xd, + "barla": 0xe, + "basiceng": 0xf, + "bauddha": 0x10, + "biscayan": 0x11, + "biske": 0x48, + "bohoric": 0x12, + "boont": 0x13, + "colb1945": 0x14, + "cornu": 0x15, + "dajnko": 0x16, + "ekavsk": 0x17, + "emodeng": 0x18, + "fonipa": 0x50, + "fonnapa": 0x51, + "fonupa": 0x52, + "fonxsamp": 0x53, + "hepburn": 0x19, + "heploc": 0x4e, + "hognorsk": 0x1a, + "hsistemo": 0x1b, + "ijekavsk": 0x1c, + "itihasa": 0x1d, + "jauer": 0x1e, + "jyutping": 0x1f, + "kkcor": 0x20, + "kociewie": 0x21, + "kscor": 0x22, + "laukika": 0x23, + "lipaw": 0x49, + "luna1918": 0x24, + "metelko": 0x25, + "monoton": 0x26, + "ndyuka": 0x27, + "nedis": 0x28, + "newfound": 0x29, + "njiva": 0x4a, + "nulik": 0x2a, + "osojs": 0x4b, + "oxendict": 0x2b, + "pahawh2": 0x2c, + "pahawh3": 0x2d, + "pahawh4": 0x2e, + "pamaka": 0x2f, + "petr1708": 0x30, + "pinyin": 0x31, + "polyton": 0x32, + "puter": 0x33, + "rigik": 0x34, + "rozaj": 0x35, + "rumgr": 0x36, + "scotland": 0x37, + "scouse": 0x38, + "simple": 0x54, + "solba": 0x4c, + "sotav": 0x39, + "spanglis": 0x3a, + "surmiran": 0x3b, + "sursilv": 0x3c, + "sutsilv": 0x3d, + "tarask": 0x3e, + "uccor": 0x3f, + "ucrcor": 0x40, + "ulster": 0x41, + "unifon": 0x42, + "vaidika": 0x43, + "valencia": 0x44, + "vallader": 0x45, + "wadegile": 0x46, + "xsistemo": 0x47, +} + +// variantNumSpecialized is the number of specialized variants in variants. +const variantNumSpecialized = 79 + +// nRegionGroups is the number of region groups. +const nRegionGroups = 33 + +type likelyLangRegion struct { + lang uint16 + region uint16 +} + +// likelyScript is a lookup table, indexed by scriptID, for the most likely +// languages and regions given a script. +// Size: 976 bytes, 244 elements +var likelyScript = [244]likelyLangRegion{ + 1: {lang: 0x14e, region: 0x84}, + 3: {lang: 0x2a2, region: 0x106}, + 4: {lang: 0x1f, region: 0x99}, + 5: {lang: 0x3a, region: 0x6b}, + 7: {lang: 0x3b, region: 0x9c}, + 8: {lang: 0x1d7, region: 0x28}, + 9: {lang: 0x13, region: 0x9c}, + 10: {lang: 0x5b, region: 0x95}, + 11: {lang: 0x60, region: 0x52}, + 12: {lang: 0xb9, region: 0xb4}, + 13: {lang: 0x63, region: 0x95}, + 14: {lang: 0xa5, region: 0x35}, + 15: {lang: 0x3e9, region: 0x99}, + 17: {lang: 0x529, region: 0x12e}, + 18: {lang: 0x3b1, region: 0x99}, + 19: {lang: 0x15e, region: 0x78}, + 20: {lang: 0xc2, region: 0x95}, + 21: {lang: 0x9d, region: 0xe7}, + 22: {lang: 0xdb, region: 0x35}, + 23: {lang: 0xf3, region: 0x49}, + 24: {lang: 0x4f0, region: 0x12b}, + 25: {lang: 0xe7, region: 0x13e}, + 26: {lang: 0xe5, region: 0x135}, + 28: {lang: 0xf1, region: 0x6b}, + 30: {lang: 0x1a0, region: 0x5d}, + 31: {lang: 0x3e2, region: 0x106}, + 33: {lang: 0x1be, region: 0x99}, + 36: {lang: 0x15e, region: 0x78}, + 39: {lang: 0x133, region: 0x6b}, + 40: {lang: 0x431, region: 0x27}, + 41: {lang: 0x27, region: 0x6f}, + 43: {lang: 0x210, region: 0x7d}, + 44: {lang: 0xfe, region: 0x38}, + 46: {lang: 0x19b, region: 0x99}, + 47: {lang: 0x19e, region: 0x130}, + 48: {lang: 0x3e9, region: 0x99}, + 49: {lang: 0x136, region: 0x87}, + 50: {lang: 0x1a4, region: 0x99}, + 51: {lang: 0x39d, region: 0x99}, + 52: {lang: 0x529, region: 0x12e}, + 53: {lang: 0x254, region: 0xab}, + 54: {lang: 0x529, region: 0x53}, + 55: {lang: 0x1cb, region: 0xe7}, + 56: {lang: 0x529, region: 0x53}, + 57: {lang: 0x529, region: 0x12e}, + 58: {lang: 0x2fd, region: 0x9b}, + 59: {lang: 0x1bc, region: 0x97}, + 60: {lang: 0x200, region: 0xa2}, + 61: {lang: 0x1c5, region: 0x12b}, + 62: {lang: 0x1ca, region: 0xaf}, + 65: {lang: 0x1d5, region: 0x92}, + 67: {lang: 0x142, region: 0x9e}, + 68: {lang: 0x254, region: 0xab}, + 69: {lang: 0x20e, region: 0x95}, + 70: {lang: 0x200, region: 0xa2}, + 72: {lang: 0x135, region: 0xc4}, + 73: {lang: 0x200, region: 0xa2}, + 74: {lang: 0x3bb, region: 0xe8}, + 75: {lang: 0x24a, region: 0xa6}, + 76: {lang: 0x3fa, region: 0x99}, + 79: {lang: 0x251, region: 0x99}, + 80: {lang: 0x254, region: 0xab}, + 82: {lang: 0x88, region: 0x99}, + 83: {lang: 0x370, region: 0x123}, + 84: {lang: 0x2b8, region: 0xaf}, + 89: {lang: 0x29f, region: 0x99}, + 90: {lang: 0x2a8, region: 0x99}, + 91: {lang: 0x28f, region: 0x87}, + 92: {lang: 0x1a0, region: 0x87}, + 93: {lang: 0x2ac, region: 0x53}, + 95: {lang: 0x4f4, region: 0x12b}, + 96: {lang: 0x4f5, region: 0x12b}, + 97: {lang: 0x1be, region: 0x99}, + 99: {lang: 0x337, region: 0x9c}, + 100: {lang: 0x4f7, region: 0x53}, + 101: {lang: 0xa9, region: 0x53}, + 104: {lang: 0x2e8, region: 0x112}, + 105: {lang: 0x4f8, region: 0x10b}, + 106: {lang: 0x4f8, region: 0x10b}, + 107: {lang: 0x304, region: 0x99}, + 108: {lang: 0x31b, region: 0x99}, + 109: {lang: 0x30b, region: 0x53}, + 111: {lang: 0x31e, region: 0x35}, + 112: {lang: 0x30e, region: 0x99}, + 113: {lang: 0x414, region: 0xe8}, + 114: {lang: 0x331, region: 0xc4}, + 115: {lang: 0x4f9, region: 0x108}, + 116: {lang: 0x3b, region: 0xa1}, + 117: {lang: 0x353, region: 0xdb}, + 120: {lang: 0x2d0, region: 0x84}, + 121: {lang: 0x52a, region: 0x53}, + 122: {lang: 0x403, region: 0x96}, + 123: {lang: 0x3ee, region: 0x99}, + 124: {lang: 0x39b, region: 0xc5}, + 125: {lang: 0x395, region: 0x99}, + 126: {lang: 0x399, region: 0x135}, + 127: {lang: 0x429, region: 0x115}, + 128: {lang: 0x3b, region: 0x11c}, + 129: {lang: 0xfd, region: 0xc4}, + 130: {lang: 0x27d, region: 0x106}, + 131: {lang: 0x2c9, region: 0x53}, + 132: {lang: 0x39f, region: 0x9c}, + 133: {lang: 0x39f, region: 0x53}, + 135: {lang: 0x3ad, region: 0xb0}, + 137: {lang: 0x1c6, region: 0x53}, + 138: {lang: 0x4fd, region: 0x9c}, + 189: {lang: 0x3cb, region: 0x95}, + 191: {lang: 0x372, region: 0x10c}, + 192: {lang: 0x420, region: 0x97}, + 194: {lang: 0x4ff, region: 0x15e}, + 195: {lang: 0x3f0, region: 0x99}, + 196: {lang: 0x45, region: 0x135}, + 197: {lang: 0x139, region: 0x7b}, + 198: {lang: 0x3e9, region: 0x99}, + 200: {lang: 0x3e9, region: 0x99}, + 201: {lang: 0x3fa, region: 0x99}, + 202: {lang: 0x40c, region: 0xb3}, + 203: {lang: 0x433, region: 0x99}, + 204: {lang: 0xef, region: 0xc5}, + 205: {lang: 0x43e, region: 0x95}, + 206: {lang: 0x44d, region: 0x35}, + 207: {lang: 0x44e, region: 0x9b}, + 211: {lang: 0x45a, region: 0xe7}, + 212: {lang: 0x11a, region: 0x99}, + 213: {lang: 0x45e, region: 0x53}, + 214: {lang: 0x232, region: 0x53}, + 215: {lang: 0x450, region: 0x99}, + 216: {lang: 0x4a5, region: 0x53}, + 217: {lang: 0x9f, region: 0x13e}, + 218: {lang: 0x461, region: 0x99}, + 220: {lang: 0x528, region: 0xba}, + 221: {lang: 0x153, region: 0xe7}, + 222: {lang: 0x128, region: 0xcd}, + 223: {lang: 0x46b, region: 0x123}, + 224: {lang: 0xa9, region: 0x53}, + 225: {lang: 0x2ce, region: 0x99}, + 226: {lang: 0x4ad, region: 0x11c}, + 227: {lang: 0x4be, region: 0xb4}, + 229: {lang: 0x1ce, region: 0x99}, + 232: {lang: 0x3a9, region: 0x9c}, + 233: {lang: 0x22, region: 0x9b}, + 234: {lang: 0x1ea, region: 0x53}, + 235: {lang: 0xef, region: 0xc5}, +} + +type likelyScriptRegion struct { + region uint16 + script uint8 + flags uint8 +} + +// likelyLang is a lookup table, indexed by langID, for the most likely +// scripts and regions given incomplete information. If more entries exist for a +// given language, region and script are the index and size respectively +// of the list in likelyLangList. +// Size: 5320 bytes, 1330 elements +var likelyLang = [1330]likelyScriptRegion{ + 0: {region: 0x135, script: 0x57, flags: 0x0}, + 1: {region: 0x6f, script: 0x57, flags: 0x0}, + 2: {region: 0x165, script: 0x57, flags: 0x0}, + 3: {region: 0x165, script: 0x57, flags: 0x0}, + 4: {region: 0x165, script: 0x57, flags: 0x0}, + 5: {region: 0x7d, script: 0x1f, flags: 0x0}, + 6: {region: 0x165, script: 0x57, flags: 0x0}, + 7: {region: 0x165, script: 0x1f, flags: 0x0}, + 8: {region: 0x80, script: 0x57, flags: 0x0}, + 9: {region: 0x165, script: 0x57, flags: 0x0}, + 10: {region: 0x165, script: 0x57, flags: 0x0}, + 11: {region: 0x165, script: 0x57, flags: 0x0}, + 12: {region: 0x95, script: 0x57, flags: 0x0}, + 13: {region: 0x131, script: 0x57, flags: 0x0}, + 14: {region: 0x80, script: 0x57, flags: 0x0}, + 15: {region: 0x165, script: 0x57, flags: 0x0}, + 16: {region: 0x165, script: 0x57, flags: 0x0}, + 17: {region: 0x106, script: 0x1f, flags: 0x0}, + 18: {region: 0x165, script: 0x57, flags: 0x0}, + 19: {region: 0x9c, script: 0x9, flags: 0x0}, + 20: {region: 0x128, script: 0x5, flags: 0x0}, + 21: {region: 0x165, script: 0x57, flags: 0x0}, + 22: {region: 0x161, script: 0x57, flags: 0x0}, + 23: {region: 0x165, script: 0x57, flags: 0x0}, + 24: {region: 0x165, script: 0x57, flags: 0x0}, + 25: {region: 0x165, script: 0x57, flags: 0x0}, + 26: {region: 0x165, script: 0x57, flags: 0x0}, + 27: {region: 0x165, script: 0x57, flags: 0x0}, + 28: {region: 0x52, script: 0x57, flags: 0x0}, + 29: {region: 0x165, script: 0x57, flags: 0x0}, + 30: {region: 0x165, script: 0x57, flags: 0x0}, + 31: {region: 0x99, script: 0x4, flags: 0x0}, + 32: {region: 0x165, script: 0x57, flags: 0x0}, + 33: {region: 0x80, script: 0x57, flags: 0x0}, + 34: {region: 0x9b, script: 0xe9, flags: 0x0}, + 35: {region: 0x165, script: 0x57, flags: 0x0}, + 36: {region: 0x165, script: 0x57, flags: 0x0}, + 37: {region: 0x14d, script: 0x57, flags: 0x0}, + 38: {region: 0x106, script: 0x1f, flags: 0x0}, + 39: {region: 0x6f, script: 0x29, flags: 0x0}, + 40: {region: 0x165, script: 0x57, flags: 0x0}, + 41: {region: 0x165, script: 0x57, flags: 0x0}, + 42: {region: 0xd6, script: 0x57, flags: 0x0}, + 43: {region: 0x165, script: 0x57, flags: 0x0}, + 45: {region: 0x165, script: 0x57, flags: 0x0}, + 46: {region: 0x165, script: 0x57, flags: 0x0}, + 47: {region: 0x165, script: 0x57, flags: 0x0}, + 48: {region: 0x165, script: 0x57, flags: 0x0}, + 49: {region: 0x165, script: 0x57, flags: 0x0}, + 50: {region: 0x165, script: 0x57, flags: 0x0}, + 51: {region: 0x95, script: 0x57, flags: 0x0}, + 52: {region: 0x165, script: 0x5, flags: 0x0}, + 53: {region: 0x122, script: 0x5, flags: 0x0}, + 54: {region: 0x165, script: 0x57, flags: 0x0}, + 55: {region: 0x165, script: 0x57, flags: 0x0}, + 56: {region: 0x165, script: 0x57, flags: 0x0}, + 57: {region: 0x165, script: 0x57, flags: 0x0}, + 58: {region: 0x6b, script: 0x5, flags: 0x0}, + 59: {region: 0x0, script: 0x3, flags: 0x1}, + 60: {region: 0x165, script: 0x57, flags: 0x0}, + 61: {region: 0x51, script: 0x57, flags: 0x0}, + 62: {region: 0x3f, script: 0x57, flags: 0x0}, + 63: {region: 0x67, script: 0x5, flags: 0x0}, + 65: {region: 0xba, script: 0x5, flags: 0x0}, + 66: {region: 0x6b, script: 0x5, flags: 0x0}, + 67: {region: 0x99, script: 0xe, flags: 0x0}, + 68: {region: 0x12f, script: 0x57, flags: 0x0}, + 69: {region: 0x135, script: 0xc4, flags: 0x0}, + 70: {region: 0x165, script: 0x57, flags: 0x0}, + 71: {region: 0x165, script: 0x57, flags: 0x0}, + 72: {region: 0x6e, script: 0x57, flags: 0x0}, + 73: {region: 0x165, script: 0x57, flags: 0x0}, + 74: {region: 0x165, script: 0x57, flags: 0x0}, + 75: {region: 0x49, script: 0x57, flags: 0x0}, + 76: {region: 0x165, script: 0x57, flags: 0x0}, + 77: {region: 0x106, script: 0x1f, flags: 0x0}, + 78: {region: 0x165, script: 0x5, flags: 0x0}, + 79: {region: 0x165, script: 0x57, flags: 0x0}, + 80: {region: 0x165, script: 0x57, flags: 0x0}, + 81: {region: 0x165, script: 0x57, flags: 0x0}, + 82: {region: 0x99, script: 0x21, flags: 0x0}, + 83: {region: 0x165, script: 0x57, flags: 0x0}, + 84: {region: 0x165, script: 0x57, flags: 0x0}, + 85: {region: 0x165, script: 0x57, flags: 0x0}, + 86: {region: 0x3f, script: 0x57, flags: 0x0}, + 87: {region: 0x165, script: 0x57, flags: 0x0}, + 88: {region: 0x3, script: 0x5, flags: 0x1}, + 89: {region: 0x106, script: 0x1f, flags: 0x0}, + 90: {region: 0xe8, script: 0x5, flags: 0x0}, + 91: {region: 0x95, script: 0x57, flags: 0x0}, + 92: {region: 0xdb, script: 0x21, flags: 0x0}, + 93: {region: 0x2e, script: 0x57, flags: 0x0}, + 94: {region: 0x52, script: 0x57, flags: 0x0}, + 95: {region: 0x165, script: 0x57, flags: 0x0}, + 96: {region: 0x52, script: 0xb, flags: 0x0}, + 97: {region: 0x165, script: 0x57, flags: 0x0}, + 98: {region: 0x165, script: 0x57, flags: 0x0}, + 99: {region: 0x95, script: 0x57, flags: 0x0}, + 100: {region: 0x165, script: 0x57, flags: 0x0}, + 101: {region: 0x52, script: 0x57, flags: 0x0}, + 102: {region: 0x165, script: 0x57, flags: 0x0}, + 103: {region: 0x165, script: 0x57, flags: 0x0}, + 104: {region: 0x165, script: 0x57, flags: 0x0}, + 105: {region: 0x165, script: 0x57, flags: 0x0}, + 106: {region: 0x4f, script: 0x57, flags: 0x0}, + 107: {region: 0x165, script: 0x57, flags: 0x0}, + 108: {region: 0x165, script: 0x57, flags: 0x0}, + 109: {region: 0x165, script: 0x57, flags: 0x0}, + 110: {region: 0x165, script: 0x29, flags: 0x0}, + 111: {region: 0x165, script: 0x57, flags: 0x0}, + 112: {region: 0x165, script: 0x57, flags: 0x0}, + 113: {region: 0x47, script: 0x1f, flags: 0x0}, + 114: {region: 0x165, script: 0x57, flags: 0x0}, + 115: {region: 0x165, script: 0x57, flags: 0x0}, + 116: {region: 0x10b, script: 0x5, flags: 0x0}, + 117: {region: 0x162, script: 0x57, flags: 0x0}, + 118: {region: 0x165, script: 0x57, flags: 0x0}, + 119: {region: 0x95, script: 0x57, flags: 0x0}, + 120: {region: 0x165, script: 0x57, flags: 0x0}, + 121: {region: 0x12f, script: 0x57, flags: 0x0}, + 122: {region: 0x52, script: 0x57, flags: 0x0}, + 123: {region: 0x99, script: 0xd7, flags: 0x0}, + 124: {region: 0xe8, script: 0x5, flags: 0x0}, + 125: {region: 0x99, script: 0x21, flags: 0x0}, + 126: {region: 0x38, script: 0x1f, flags: 0x0}, + 127: {region: 0x99, script: 0x21, flags: 0x0}, + 128: {region: 0xe8, script: 0x5, flags: 0x0}, + 129: {region: 0x12b, script: 0x31, flags: 0x0}, + 131: {region: 0x99, script: 0x21, flags: 0x0}, + 132: {region: 0x165, script: 0x57, flags: 0x0}, + 133: {region: 0x99, script: 0x21, flags: 0x0}, + 134: {region: 0xe7, script: 0x57, flags: 0x0}, + 135: {region: 0x165, script: 0x57, flags: 0x0}, + 136: {region: 0x99, script: 0x21, flags: 0x0}, + 137: {region: 0x165, script: 0x57, flags: 0x0}, + 138: {region: 0x13f, script: 0x57, flags: 0x0}, + 139: {region: 0x165, script: 0x57, flags: 0x0}, + 140: {region: 0x165, script: 0x57, flags: 0x0}, + 141: {region: 0xe7, script: 0x57, flags: 0x0}, + 142: {region: 0x165, script: 0x57, flags: 0x0}, + 143: {region: 0xd6, script: 0x57, flags: 0x0}, + 144: {region: 0x165, script: 0x57, flags: 0x0}, + 145: {region: 0x165, script: 0x57, flags: 0x0}, + 146: {region: 0x165, script: 0x57, flags: 0x0}, + 147: {region: 0x165, script: 0x29, flags: 0x0}, + 148: {region: 0x99, script: 0x21, flags: 0x0}, + 149: {region: 0x95, script: 0x57, flags: 0x0}, + 150: {region: 0x165, script: 0x57, flags: 0x0}, + 151: {region: 0x165, script: 0x57, flags: 0x0}, + 152: {region: 0x114, script: 0x57, flags: 0x0}, + 153: {region: 0x165, script: 0x57, flags: 0x0}, + 154: {region: 0x165, script: 0x57, flags: 0x0}, + 155: {region: 0x52, script: 0x57, flags: 0x0}, + 156: {region: 0x165, script: 0x57, flags: 0x0}, + 157: {region: 0xe7, script: 0x57, flags: 0x0}, + 158: {region: 0x165, script: 0x57, flags: 0x0}, + 159: {region: 0x13e, script: 0xd9, flags: 0x0}, + 160: {region: 0xc3, script: 0x57, flags: 0x0}, + 161: {region: 0x165, script: 0x57, flags: 0x0}, + 162: {region: 0x165, script: 0x57, flags: 0x0}, + 163: {region: 0xc3, script: 0x57, flags: 0x0}, + 164: {region: 0x165, script: 0x57, flags: 0x0}, + 165: {region: 0x35, script: 0xe, flags: 0x0}, + 166: {region: 0x165, script: 0x57, flags: 0x0}, + 167: {region: 0x165, script: 0x57, flags: 0x0}, + 168: {region: 0x165, script: 0x57, flags: 0x0}, + 169: {region: 0x53, script: 0xe0, flags: 0x0}, + 170: {region: 0x165, script: 0x57, flags: 0x0}, + 171: {region: 0x165, script: 0x57, flags: 0x0}, + 172: {region: 0x165, script: 0x57, flags: 0x0}, + 173: {region: 0x99, script: 0xe, flags: 0x0}, + 174: {region: 0x165, script: 0x57, flags: 0x0}, + 175: {region: 0x9c, script: 0x5, flags: 0x0}, + 176: {region: 0x165, script: 0x57, flags: 0x0}, + 177: {region: 0x4f, script: 0x57, flags: 0x0}, + 178: {region: 0x78, script: 0x57, flags: 0x0}, + 179: {region: 0x99, script: 0x21, flags: 0x0}, + 180: {region: 0xe8, script: 0x5, flags: 0x0}, + 181: {region: 0x99, script: 0x21, flags: 0x0}, + 182: {region: 0x165, script: 0x57, flags: 0x0}, + 183: {region: 0x33, script: 0x57, flags: 0x0}, + 184: {region: 0x165, script: 0x57, flags: 0x0}, + 185: {region: 0xb4, script: 0xc, flags: 0x0}, + 186: {region: 0x52, script: 0x57, flags: 0x0}, + 187: {region: 0x165, script: 0x29, flags: 0x0}, + 188: {region: 0xe7, script: 0x57, flags: 0x0}, + 189: {region: 0x165, script: 0x57, flags: 0x0}, + 190: {region: 0xe8, script: 0x21, flags: 0x0}, + 191: {region: 0x106, script: 0x1f, flags: 0x0}, + 192: {region: 0x15f, script: 0x57, flags: 0x0}, + 193: {region: 0x165, script: 0x57, flags: 0x0}, + 194: {region: 0x95, script: 0x57, flags: 0x0}, + 195: {region: 0x165, script: 0x57, flags: 0x0}, + 196: {region: 0x52, script: 0x57, flags: 0x0}, + 197: {region: 0x165, script: 0x57, flags: 0x0}, + 198: {region: 0x165, script: 0x57, flags: 0x0}, + 199: {region: 0x165, script: 0x57, flags: 0x0}, + 200: {region: 0x86, script: 0x57, flags: 0x0}, + 201: {region: 0x165, script: 0x57, flags: 0x0}, + 202: {region: 0x165, script: 0x57, flags: 0x0}, + 203: {region: 0x165, script: 0x57, flags: 0x0}, + 204: {region: 0x165, script: 0x57, flags: 0x0}, + 205: {region: 0x6d, script: 0x29, flags: 0x0}, + 206: {region: 0x165, script: 0x57, flags: 0x0}, + 207: {region: 0x165, script: 0x57, flags: 0x0}, + 208: {region: 0x52, script: 0x57, flags: 0x0}, + 209: {region: 0x165, script: 0x57, flags: 0x0}, + 210: {region: 0x165, script: 0x57, flags: 0x0}, + 211: {region: 0xc3, script: 0x57, flags: 0x0}, + 212: {region: 0x165, script: 0x57, flags: 0x0}, + 213: {region: 0x165, script: 0x57, flags: 0x0}, + 214: {region: 0x165, script: 0x57, flags: 0x0}, + 215: {region: 0x6e, script: 0x57, flags: 0x0}, + 216: {region: 0x165, script: 0x57, flags: 0x0}, + 217: {region: 0x165, script: 0x57, flags: 0x0}, + 218: {region: 0xd6, script: 0x57, flags: 0x0}, + 219: {region: 0x35, script: 0x16, flags: 0x0}, + 220: {region: 0x106, script: 0x1f, flags: 0x0}, + 221: {region: 0xe7, script: 0x57, flags: 0x0}, + 222: {region: 0x165, script: 0x57, flags: 0x0}, + 223: {region: 0x131, script: 0x57, flags: 0x0}, + 224: {region: 0x8a, script: 0x57, flags: 0x0}, + 225: {region: 0x75, script: 0x57, flags: 0x0}, + 226: {region: 0x106, script: 0x1f, flags: 0x0}, + 227: {region: 0x135, script: 0x57, flags: 0x0}, + 228: {region: 0x49, script: 0x57, flags: 0x0}, + 229: {region: 0x135, script: 0x1a, flags: 0x0}, + 230: {region: 0xa6, script: 0x5, flags: 0x0}, + 231: {region: 0x13e, script: 0x19, flags: 0x0}, + 232: {region: 0x165, script: 0x57, flags: 0x0}, + 233: {region: 0x9b, script: 0x5, flags: 0x0}, + 234: {region: 0x165, script: 0x57, flags: 0x0}, + 235: {region: 0x165, script: 0x57, flags: 0x0}, + 236: {region: 0x165, script: 0x57, flags: 0x0}, + 237: {region: 0x165, script: 0x57, flags: 0x0}, + 238: {region: 0x165, script: 0x57, flags: 0x0}, + 239: {region: 0xc5, script: 0xcc, flags: 0x0}, + 240: {region: 0x78, script: 0x57, flags: 0x0}, + 241: {region: 0x6b, script: 0x1c, flags: 0x0}, + 242: {region: 0xe7, script: 0x57, flags: 0x0}, + 243: {region: 0x49, script: 0x17, flags: 0x0}, + 244: {region: 0x130, script: 0x1f, flags: 0x0}, + 245: {region: 0x49, script: 0x17, flags: 0x0}, + 246: {region: 0x49, script: 0x17, flags: 0x0}, + 247: {region: 0x49, script: 0x17, flags: 0x0}, + 248: {region: 0x49, script: 0x17, flags: 0x0}, + 249: {region: 0x10a, script: 0x57, flags: 0x0}, + 250: {region: 0x5e, script: 0x57, flags: 0x0}, + 251: {region: 0xe9, script: 0x57, flags: 0x0}, + 252: {region: 0x49, script: 0x17, flags: 0x0}, + 253: {region: 0xc4, script: 0x81, flags: 0x0}, + 254: {region: 0x8, script: 0x2, flags: 0x1}, + 255: {region: 0x106, script: 0x1f, flags: 0x0}, + 256: {region: 0x7b, script: 0x57, flags: 0x0}, + 257: {region: 0x63, script: 0x57, flags: 0x0}, + 258: {region: 0x165, script: 0x57, flags: 0x0}, + 259: {region: 0x165, script: 0x57, flags: 0x0}, + 260: {region: 0x165, script: 0x57, flags: 0x0}, + 261: {region: 0x165, script: 0x57, flags: 0x0}, + 262: {region: 0x135, script: 0x57, flags: 0x0}, + 263: {region: 0x106, script: 0x1f, flags: 0x0}, + 264: {region: 0xa4, script: 0x57, flags: 0x0}, + 265: {region: 0x165, script: 0x57, flags: 0x0}, + 266: {region: 0x165, script: 0x57, flags: 0x0}, + 267: {region: 0x99, script: 0x5, flags: 0x0}, + 268: {region: 0x165, script: 0x57, flags: 0x0}, + 269: {region: 0x60, script: 0x57, flags: 0x0}, + 270: {region: 0x165, script: 0x57, flags: 0x0}, + 271: {region: 0x49, script: 0x57, flags: 0x0}, + 272: {region: 0x165, script: 0x57, flags: 0x0}, + 273: {region: 0x165, script: 0x57, flags: 0x0}, + 274: {region: 0x165, script: 0x57, flags: 0x0}, + 275: {region: 0x165, script: 0x5, flags: 0x0}, + 276: {region: 0x49, script: 0x57, flags: 0x0}, + 277: {region: 0x165, script: 0x57, flags: 0x0}, + 278: {region: 0x165, script: 0x57, flags: 0x0}, + 279: {region: 0xd4, script: 0x57, flags: 0x0}, + 280: {region: 0x4f, script: 0x57, flags: 0x0}, + 281: {region: 0x165, script: 0x57, flags: 0x0}, + 282: {region: 0x99, script: 0x5, flags: 0x0}, + 283: {region: 0x165, script: 0x57, flags: 0x0}, + 284: {region: 0x165, script: 0x57, flags: 0x0}, + 285: {region: 0x165, script: 0x57, flags: 0x0}, + 286: {region: 0x165, script: 0x29, flags: 0x0}, + 287: {region: 0x60, script: 0x57, flags: 0x0}, + 288: {region: 0xc3, script: 0x57, flags: 0x0}, + 289: {region: 0xd0, script: 0x57, flags: 0x0}, + 290: {region: 0x165, script: 0x57, flags: 0x0}, + 291: {region: 0xdb, script: 0x21, flags: 0x0}, + 292: {region: 0x52, script: 0x57, flags: 0x0}, + 293: {region: 0x165, script: 0x57, flags: 0x0}, + 294: {region: 0x165, script: 0x57, flags: 0x0}, + 295: {region: 0x165, script: 0x57, flags: 0x0}, + 296: {region: 0xcd, script: 0xde, flags: 0x0}, + 297: {region: 0x165, script: 0x57, flags: 0x0}, + 298: {region: 0x165, script: 0x57, flags: 0x0}, + 299: {region: 0x114, script: 0x57, flags: 0x0}, + 300: {region: 0x37, script: 0x57, flags: 0x0}, + 301: {region: 0x43, script: 0xe0, flags: 0x0}, + 302: {region: 0x165, script: 0x57, flags: 0x0}, + 303: {region: 0xa4, script: 0x57, flags: 0x0}, + 304: {region: 0x80, script: 0x57, flags: 0x0}, + 305: {region: 0xd6, script: 0x57, flags: 0x0}, + 306: {region: 0x9e, script: 0x57, flags: 0x0}, + 307: {region: 0x6b, script: 0x27, flags: 0x0}, + 308: {region: 0x165, script: 0x57, flags: 0x0}, + 309: {region: 0xc4, script: 0x48, flags: 0x0}, + 310: {region: 0x87, script: 0x31, flags: 0x0}, + 311: {region: 0x165, script: 0x57, flags: 0x0}, + 312: {region: 0x165, script: 0x57, flags: 0x0}, + 313: {region: 0xa, script: 0x2, flags: 0x1}, + 314: {region: 0x165, script: 0x57, flags: 0x0}, + 315: {region: 0x165, script: 0x57, flags: 0x0}, + 316: {region: 0x1, script: 0x57, flags: 0x0}, + 317: {region: 0x165, script: 0x57, flags: 0x0}, + 318: {region: 0x6e, script: 0x57, flags: 0x0}, + 319: {region: 0x135, script: 0x57, flags: 0x0}, + 320: {region: 0x6a, script: 0x57, flags: 0x0}, + 321: {region: 0x165, script: 0x57, flags: 0x0}, + 322: {region: 0x9e, script: 0x43, flags: 0x0}, + 323: {region: 0x165, script: 0x57, flags: 0x0}, + 324: {region: 0x165, script: 0x57, flags: 0x0}, + 325: {region: 0x6e, script: 0x57, flags: 0x0}, + 326: {region: 0x52, script: 0x57, flags: 0x0}, + 327: {region: 0x6e, script: 0x57, flags: 0x0}, + 328: {region: 0x9c, script: 0x5, flags: 0x0}, + 329: {region: 0x165, script: 0x57, flags: 0x0}, + 330: {region: 0x165, script: 0x57, flags: 0x0}, + 331: {region: 0x165, script: 0x57, flags: 0x0}, + 332: {region: 0x165, script: 0x57, flags: 0x0}, + 333: {region: 0x86, script: 0x57, flags: 0x0}, + 334: {region: 0xc, script: 0x2, flags: 0x1}, + 335: {region: 0x165, script: 0x57, flags: 0x0}, + 336: {region: 0xc3, script: 0x57, flags: 0x0}, + 337: {region: 0x72, script: 0x57, flags: 0x0}, + 338: {region: 0x10b, script: 0x5, flags: 0x0}, + 339: {region: 0xe7, script: 0x57, flags: 0x0}, + 340: {region: 0x10c, script: 0x57, flags: 0x0}, + 341: {region: 0x73, script: 0x57, flags: 0x0}, + 342: {region: 0x165, script: 0x57, flags: 0x0}, + 343: {region: 0x165, script: 0x57, flags: 0x0}, + 344: {region: 0x76, script: 0x57, flags: 0x0}, + 345: {region: 0x165, script: 0x57, flags: 0x0}, + 346: {region: 0x3b, script: 0x57, flags: 0x0}, + 347: {region: 0x165, script: 0x57, flags: 0x0}, + 348: {region: 0x165, script: 0x57, flags: 0x0}, + 349: {region: 0x165, script: 0x57, flags: 0x0}, + 350: {region: 0x78, script: 0x57, flags: 0x0}, + 351: {region: 0x135, script: 0x57, flags: 0x0}, + 352: {region: 0x78, script: 0x57, flags: 0x0}, + 353: {region: 0x60, script: 0x57, flags: 0x0}, + 354: {region: 0x60, script: 0x57, flags: 0x0}, + 355: {region: 0x52, script: 0x5, flags: 0x0}, + 356: {region: 0x140, script: 0x57, flags: 0x0}, + 357: {region: 0x165, script: 0x57, flags: 0x0}, + 358: {region: 0x84, script: 0x57, flags: 0x0}, + 359: {region: 0x165, script: 0x57, flags: 0x0}, + 360: {region: 0xd4, script: 0x57, flags: 0x0}, + 361: {region: 0x9e, script: 0x57, flags: 0x0}, + 362: {region: 0xd6, script: 0x57, flags: 0x0}, + 363: {region: 0x165, script: 0x57, flags: 0x0}, + 364: {region: 0x10b, script: 0x57, flags: 0x0}, + 365: {region: 0xd9, script: 0x57, flags: 0x0}, + 366: {region: 0x96, script: 0x57, flags: 0x0}, + 367: {region: 0x80, script: 0x57, flags: 0x0}, + 368: {region: 0x165, script: 0x57, flags: 0x0}, + 369: {region: 0xbc, script: 0x57, flags: 0x0}, + 370: {region: 0x165, script: 0x57, flags: 0x0}, + 371: {region: 0x165, script: 0x57, flags: 0x0}, + 372: {region: 0x165, script: 0x57, flags: 0x0}, + 373: {region: 0x53, script: 0x38, flags: 0x0}, + 374: {region: 0x165, script: 0x57, flags: 0x0}, + 375: {region: 0x95, script: 0x57, flags: 0x0}, + 376: {region: 0x165, script: 0x57, flags: 0x0}, + 377: {region: 0x165, script: 0x57, flags: 0x0}, + 378: {region: 0x99, script: 0x21, flags: 0x0}, + 379: {region: 0x165, script: 0x57, flags: 0x0}, + 380: {region: 0x9c, script: 0x5, flags: 0x0}, + 381: {region: 0x7e, script: 0x57, flags: 0x0}, + 382: {region: 0x7b, script: 0x57, flags: 0x0}, + 383: {region: 0x165, script: 0x57, flags: 0x0}, + 384: {region: 0x165, script: 0x57, flags: 0x0}, + 385: {region: 0x165, script: 0x57, flags: 0x0}, + 386: {region: 0x165, script: 0x57, flags: 0x0}, + 387: {region: 0x165, script: 0x57, flags: 0x0}, + 388: {region: 0x165, script: 0x57, flags: 0x0}, + 389: {region: 0x6f, script: 0x29, flags: 0x0}, + 390: {region: 0x165, script: 0x57, flags: 0x0}, + 391: {region: 0xdb, script: 0x21, flags: 0x0}, + 392: {region: 0x165, script: 0x57, flags: 0x0}, + 393: {region: 0xa7, script: 0x57, flags: 0x0}, + 394: {region: 0x165, script: 0x57, flags: 0x0}, + 395: {region: 0xe8, script: 0x5, flags: 0x0}, + 396: {region: 0x165, script: 0x57, flags: 0x0}, + 397: {region: 0xe8, script: 0x5, flags: 0x0}, + 398: {region: 0x165, script: 0x57, flags: 0x0}, + 399: {region: 0x165, script: 0x57, flags: 0x0}, + 400: {region: 0x6e, script: 0x57, flags: 0x0}, + 401: {region: 0x9c, script: 0x5, flags: 0x0}, + 402: {region: 0x165, script: 0x57, flags: 0x0}, + 403: {region: 0x165, script: 0x29, flags: 0x0}, + 404: {region: 0xf1, script: 0x57, flags: 0x0}, + 405: {region: 0x165, script: 0x57, flags: 0x0}, + 406: {region: 0x165, script: 0x57, flags: 0x0}, + 407: {region: 0x165, script: 0x57, flags: 0x0}, + 408: {region: 0x165, script: 0x29, flags: 0x0}, + 409: {region: 0x165, script: 0x57, flags: 0x0}, + 410: {region: 0x99, script: 0x21, flags: 0x0}, + 411: {region: 0x99, script: 0xda, flags: 0x0}, + 412: {region: 0x95, script: 0x57, flags: 0x0}, + 413: {region: 0xd9, script: 0x57, flags: 0x0}, + 414: {region: 0x130, script: 0x2f, flags: 0x0}, + 415: {region: 0x165, script: 0x57, flags: 0x0}, + 416: {region: 0xe, script: 0x2, flags: 0x1}, + 417: {region: 0x99, script: 0xe, flags: 0x0}, + 418: {region: 0x165, script: 0x57, flags: 0x0}, + 419: {region: 0x4e, script: 0x57, flags: 0x0}, + 420: {region: 0x99, script: 0x32, flags: 0x0}, + 421: {region: 0x41, script: 0x57, flags: 0x0}, + 422: {region: 0x54, script: 0x57, flags: 0x0}, + 423: {region: 0x165, script: 0x57, flags: 0x0}, + 424: {region: 0x80, script: 0x57, flags: 0x0}, + 425: {region: 0x165, script: 0x57, flags: 0x0}, + 426: {region: 0x165, script: 0x57, flags: 0x0}, + 427: {region: 0xa4, script: 0x57, flags: 0x0}, + 428: {region: 0x98, script: 0x57, flags: 0x0}, + 429: {region: 0x165, script: 0x57, flags: 0x0}, + 430: {region: 0xdb, script: 0x21, flags: 0x0}, + 431: {region: 0x165, script: 0x57, flags: 0x0}, + 432: {region: 0x165, script: 0x5, flags: 0x0}, + 433: {region: 0x49, script: 0x57, flags: 0x0}, + 434: {region: 0x165, script: 0x5, flags: 0x0}, + 435: {region: 0x165, script: 0x57, flags: 0x0}, + 436: {region: 0x10, script: 0x3, flags: 0x1}, + 437: {region: 0x165, script: 0x57, flags: 0x0}, + 438: {region: 0x53, script: 0x38, flags: 0x0}, + 439: {region: 0x165, script: 0x57, flags: 0x0}, + 440: {region: 0x135, script: 0x57, flags: 0x0}, + 441: {region: 0x24, script: 0x5, flags: 0x0}, + 442: {region: 0x165, script: 0x57, flags: 0x0}, + 443: {region: 0x165, script: 0x29, flags: 0x0}, + 444: {region: 0x97, script: 0x3b, flags: 0x0}, + 445: {region: 0x165, script: 0x57, flags: 0x0}, + 446: {region: 0x99, script: 0x21, flags: 0x0}, + 447: {region: 0x165, script: 0x57, flags: 0x0}, + 448: {region: 0x73, script: 0x57, flags: 0x0}, + 449: {region: 0x165, script: 0x57, flags: 0x0}, + 450: {region: 0x165, script: 0x57, flags: 0x0}, + 451: {region: 0xe7, script: 0x57, flags: 0x0}, + 452: {region: 0x165, script: 0x57, flags: 0x0}, + 453: {region: 0x12b, script: 0x3d, flags: 0x0}, + 454: {region: 0x53, script: 0x89, flags: 0x0}, + 455: {region: 0x165, script: 0x57, flags: 0x0}, + 456: {region: 0xe8, script: 0x5, flags: 0x0}, + 457: {region: 0x99, script: 0x21, flags: 0x0}, + 458: {region: 0xaf, script: 0x3e, flags: 0x0}, + 459: {region: 0xe7, script: 0x57, flags: 0x0}, + 460: {region: 0xe8, script: 0x5, flags: 0x0}, + 461: {region: 0xe6, script: 0x57, flags: 0x0}, + 462: {region: 0x99, script: 0x21, flags: 0x0}, + 463: {region: 0x99, script: 0x21, flags: 0x0}, + 464: {region: 0x165, script: 0x57, flags: 0x0}, + 465: {region: 0x90, script: 0x57, flags: 0x0}, + 466: {region: 0x60, script: 0x57, flags: 0x0}, + 467: {region: 0x53, script: 0x38, flags: 0x0}, + 468: {region: 0x91, script: 0x57, flags: 0x0}, + 469: {region: 0x92, script: 0x57, flags: 0x0}, + 470: {region: 0x165, script: 0x57, flags: 0x0}, + 471: {region: 0x28, script: 0x8, flags: 0x0}, + 472: {region: 0xd2, script: 0x57, flags: 0x0}, + 473: {region: 0x78, script: 0x57, flags: 0x0}, + 474: {region: 0x165, script: 0x57, flags: 0x0}, + 475: {region: 0x165, script: 0x57, flags: 0x0}, + 476: {region: 0xd0, script: 0x57, flags: 0x0}, + 477: {region: 0xd6, script: 0x57, flags: 0x0}, + 478: {region: 0x165, script: 0x57, flags: 0x0}, + 479: {region: 0x165, script: 0x57, flags: 0x0}, + 480: {region: 0x165, script: 0x57, flags: 0x0}, + 481: {region: 0x95, script: 0x57, flags: 0x0}, + 482: {region: 0x165, script: 0x57, flags: 0x0}, + 483: {region: 0x165, script: 0x57, flags: 0x0}, + 484: {region: 0x165, script: 0x57, flags: 0x0}, + 486: {region: 0x122, script: 0x57, flags: 0x0}, + 487: {region: 0xd6, script: 0x57, flags: 0x0}, + 488: {region: 0x165, script: 0x57, flags: 0x0}, + 489: {region: 0x165, script: 0x57, flags: 0x0}, + 490: {region: 0x53, script: 0xea, flags: 0x0}, + 491: {region: 0x165, script: 0x57, flags: 0x0}, + 492: {region: 0x135, script: 0x57, flags: 0x0}, + 493: {region: 0x165, script: 0x57, flags: 0x0}, + 494: {region: 0x49, script: 0x57, flags: 0x0}, + 495: {region: 0x165, script: 0x57, flags: 0x0}, + 496: {region: 0x165, script: 0x57, flags: 0x0}, + 497: {region: 0xe7, script: 0x57, flags: 0x0}, + 498: {region: 0x165, script: 0x57, flags: 0x0}, + 499: {region: 0x95, script: 0x57, flags: 0x0}, + 500: {region: 0x106, script: 0x1f, flags: 0x0}, + 501: {region: 0x1, script: 0x57, flags: 0x0}, + 502: {region: 0x165, script: 0x57, flags: 0x0}, + 503: {region: 0x165, script: 0x57, flags: 0x0}, + 504: {region: 0x9d, script: 0x57, flags: 0x0}, + 505: {region: 0x9e, script: 0x57, flags: 0x0}, + 506: {region: 0x49, script: 0x17, flags: 0x0}, + 507: {region: 0x97, script: 0x3b, flags: 0x0}, + 508: {region: 0x165, script: 0x57, flags: 0x0}, + 509: {region: 0x165, script: 0x57, flags: 0x0}, + 510: {region: 0x106, script: 0x57, flags: 0x0}, + 511: {region: 0x165, script: 0x57, flags: 0x0}, + 512: {region: 0xa2, script: 0x46, flags: 0x0}, + 513: {region: 0x165, script: 0x57, flags: 0x0}, + 514: {region: 0xa0, script: 0x57, flags: 0x0}, + 515: {region: 0x1, script: 0x57, flags: 0x0}, + 516: {region: 0x165, script: 0x57, flags: 0x0}, + 517: {region: 0x165, script: 0x57, flags: 0x0}, + 518: {region: 0x165, script: 0x57, flags: 0x0}, + 519: {region: 0x52, script: 0x57, flags: 0x0}, + 520: {region: 0x130, script: 0x3b, flags: 0x0}, + 521: {region: 0x165, script: 0x57, flags: 0x0}, + 522: {region: 0x12f, script: 0x57, flags: 0x0}, + 523: {region: 0xdb, script: 0x21, flags: 0x0}, + 524: {region: 0x165, script: 0x57, flags: 0x0}, + 525: {region: 0x63, script: 0x57, flags: 0x0}, + 526: {region: 0x95, script: 0x57, flags: 0x0}, + 527: {region: 0x95, script: 0x57, flags: 0x0}, + 528: {region: 0x7d, script: 0x2b, flags: 0x0}, + 529: {region: 0x137, script: 0x1f, flags: 0x0}, + 530: {region: 0x67, script: 0x57, flags: 0x0}, + 531: {region: 0xc4, script: 0x57, flags: 0x0}, + 532: {region: 0x165, script: 0x57, flags: 0x0}, + 533: {region: 0x165, script: 0x57, flags: 0x0}, + 534: {region: 0xd6, script: 0x57, flags: 0x0}, + 535: {region: 0xa4, script: 0x57, flags: 0x0}, + 536: {region: 0xc3, script: 0x57, flags: 0x0}, + 537: {region: 0x106, script: 0x1f, flags: 0x0}, + 538: {region: 0x165, script: 0x57, flags: 0x0}, + 539: {region: 0x165, script: 0x57, flags: 0x0}, + 540: {region: 0x165, script: 0x57, flags: 0x0}, + 541: {region: 0x165, script: 0x57, flags: 0x0}, + 542: {region: 0xd4, script: 0x5, flags: 0x0}, + 543: {region: 0xd6, script: 0x57, flags: 0x0}, + 544: {region: 0x164, script: 0x57, flags: 0x0}, + 545: {region: 0x165, script: 0x57, flags: 0x0}, + 546: {region: 0x165, script: 0x57, flags: 0x0}, + 547: {region: 0x12f, script: 0x57, flags: 0x0}, + 548: {region: 0x122, script: 0x5, flags: 0x0}, + 549: {region: 0x165, script: 0x57, flags: 0x0}, + 550: {region: 0x123, script: 0xdf, flags: 0x0}, + 551: {region: 0x5a, script: 0x57, flags: 0x0}, + 552: {region: 0x52, script: 0x57, flags: 0x0}, + 553: {region: 0x165, script: 0x57, flags: 0x0}, + 554: {region: 0x4f, script: 0x57, flags: 0x0}, + 555: {region: 0x99, script: 0x21, flags: 0x0}, + 556: {region: 0x99, script: 0x21, flags: 0x0}, + 557: {region: 0x4b, script: 0x57, flags: 0x0}, + 558: {region: 0x95, script: 0x57, flags: 0x0}, + 559: {region: 0x165, script: 0x57, flags: 0x0}, + 560: {region: 0x41, script: 0x57, flags: 0x0}, + 561: {region: 0x99, script: 0x57, flags: 0x0}, + 562: {region: 0x53, script: 0xd6, flags: 0x0}, + 563: {region: 0x99, script: 0x21, flags: 0x0}, + 564: {region: 0xc3, script: 0x57, flags: 0x0}, + 565: {region: 0x165, script: 0x57, flags: 0x0}, + 566: {region: 0x99, script: 0x72, flags: 0x0}, + 567: {region: 0xe8, script: 0x5, flags: 0x0}, + 568: {region: 0x165, script: 0x57, flags: 0x0}, + 569: {region: 0xa4, script: 0x57, flags: 0x0}, + 570: {region: 0x165, script: 0x57, flags: 0x0}, + 571: {region: 0x12b, script: 0x57, flags: 0x0}, + 572: {region: 0x165, script: 0x57, flags: 0x0}, + 573: {region: 0xd2, script: 0x57, flags: 0x0}, + 574: {region: 0x165, script: 0x57, flags: 0x0}, + 575: {region: 0xaf, script: 0x54, flags: 0x0}, + 576: {region: 0x165, script: 0x57, flags: 0x0}, + 577: {region: 0x165, script: 0x57, flags: 0x0}, + 578: {region: 0x13, script: 0x6, flags: 0x1}, + 579: {region: 0x165, script: 0x57, flags: 0x0}, + 580: {region: 0x52, script: 0x57, flags: 0x0}, + 581: {region: 0x82, script: 0x57, flags: 0x0}, + 582: {region: 0xa4, script: 0x57, flags: 0x0}, + 583: {region: 0x165, script: 0x57, flags: 0x0}, + 584: {region: 0x165, script: 0x57, flags: 0x0}, + 585: {region: 0x165, script: 0x57, flags: 0x0}, + 586: {region: 0xa6, script: 0x4b, flags: 0x0}, + 587: {region: 0x2a, script: 0x57, flags: 0x0}, + 588: {region: 0x165, script: 0x57, flags: 0x0}, + 589: {region: 0x165, script: 0x57, flags: 0x0}, + 590: {region: 0x165, script: 0x57, flags: 0x0}, + 591: {region: 0x165, script: 0x57, flags: 0x0}, + 592: {region: 0x165, script: 0x57, flags: 0x0}, + 593: {region: 0x99, script: 0x4f, flags: 0x0}, + 594: {region: 0x8b, script: 0x57, flags: 0x0}, + 595: {region: 0x165, script: 0x57, flags: 0x0}, + 596: {region: 0xab, script: 0x50, flags: 0x0}, + 597: {region: 0x106, script: 0x1f, flags: 0x0}, + 598: {region: 0x99, script: 0x21, flags: 0x0}, + 599: {region: 0x165, script: 0x57, flags: 0x0}, + 600: {region: 0x75, script: 0x57, flags: 0x0}, + 601: {region: 0x165, script: 0x57, flags: 0x0}, + 602: {region: 0xb4, script: 0x57, flags: 0x0}, + 603: {region: 0x165, script: 0x57, flags: 0x0}, + 604: {region: 0x165, script: 0x57, flags: 0x0}, + 605: {region: 0x165, script: 0x57, flags: 0x0}, + 606: {region: 0x165, script: 0x57, flags: 0x0}, + 607: {region: 0x165, script: 0x57, flags: 0x0}, + 608: {region: 0x165, script: 0x57, flags: 0x0}, + 609: {region: 0x165, script: 0x57, flags: 0x0}, + 610: {region: 0x165, script: 0x29, flags: 0x0}, + 611: {region: 0x165, script: 0x57, flags: 0x0}, + 612: {region: 0x106, script: 0x1f, flags: 0x0}, + 613: {region: 0x112, script: 0x57, flags: 0x0}, + 614: {region: 0xe7, script: 0x57, flags: 0x0}, + 615: {region: 0x106, script: 0x57, flags: 0x0}, + 616: {region: 0x165, script: 0x57, flags: 0x0}, + 617: {region: 0x99, script: 0x21, flags: 0x0}, + 618: {region: 0x99, script: 0x5, flags: 0x0}, + 619: {region: 0x12f, script: 0x57, flags: 0x0}, + 620: {region: 0x165, script: 0x57, flags: 0x0}, + 621: {region: 0x52, script: 0x57, flags: 0x0}, + 622: {region: 0x60, script: 0x57, flags: 0x0}, + 623: {region: 0x165, script: 0x57, flags: 0x0}, + 624: {region: 0x165, script: 0x57, flags: 0x0}, + 625: {region: 0x165, script: 0x29, flags: 0x0}, + 626: {region: 0x165, script: 0x57, flags: 0x0}, + 627: {region: 0x165, script: 0x57, flags: 0x0}, + 628: {region: 0x19, script: 0x3, flags: 0x1}, + 629: {region: 0x165, script: 0x57, flags: 0x0}, + 630: {region: 0x165, script: 0x57, flags: 0x0}, + 631: {region: 0x165, script: 0x57, flags: 0x0}, + 632: {region: 0x165, script: 0x57, flags: 0x0}, + 633: {region: 0x106, script: 0x1f, flags: 0x0}, + 634: {region: 0x165, script: 0x57, flags: 0x0}, + 635: {region: 0x165, script: 0x57, flags: 0x0}, + 636: {region: 0x165, script: 0x57, flags: 0x0}, + 637: {region: 0x106, script: 0x1f, flags: 0x0}, + 638: {region: 0x165, script: 0x57, flags: 0x0}, + 639: {region: 0x95, script: 0x57, flags: 0x0}, + 640: {region: 0xe8, script: 0x5, flags: 0x0}, + 641: {region: 0x7b, script: 0x57, flags: 0x0}, + 642: {region: 0x165, script: 0x57, flags: 0x0}, + 643: {region: 0x165, script: 0x57, flags: 0x0}, + 644: {region: 0x165, script: 0x57, flags: 0x0}, + 645: {region: 0x165, script: 0x29, flags: 0x0}, + 646: {region: 0x123, script: 0xdf, flags: 0x0}, + 647: {region: 0xe8, script: 0x5, flags: 0x0}, + 648: {region: 0x165, script: 0x57, flags: 0x0}, + 649: {region: 0x165, script: 0x57, flags: 0x0}, + 650: {region: 0x1c, script: 0x5, flags: 0x1}, + 651: {region: 0x165, script: 0x57, flags: 0x0}, + 652: {region: 0x165, script: 0x57, flags: 0x0}, + 653: {region: 0x165, script: 0x57, flags: 0x0}, + 654: {region: 0x138, script: 0x57, flags: 0x0}, + 655: {region: 0x87, script: 0x5b, flags: 0x0}, + 656: {region: 0x97, script: 0x3b, flags: 0x0}, + 657: {region: 0x12f, script: 0x57, flags: 0x0}, + 658: {region: 0xe8, script: 0x5, flags: 0x0}, + 659: {region: 0x131, script: 0x57, flags: 0x0}, + 660: {region: 0x165, script: 0x57, flags: 0x0}, + 661: {region: 0xb7, script: 0x57, flags: 0x0}, + 662: {region: 0x106, script: 0x1f, flags: 0x0}, + 663: {region: 0x165, script: 0x57, flags: 0x0}, + 664: {region: 0x95, script: 0x57, flags: 0x0}, + 665: {region: 0x165, script: 0x57, flags: 0x0}, + 666: {region: 0x53, script: 0xdf, flags: 0x0}, + 667: {region: 0x165, script: 0x57, flags: 0x0}, + 668: {region: 0x165, script: 0x57, flags: 0x0}, + 669: {region: 0x165, script: 0x57, flags: 0x0}, + 670: {region: 0x165, script: 0x57, flags: 0x0}, + 671: {region: 0x99, script: 0x59, flags: 0x0}, + 672: {region: 0x165, script: 0x57, flags: 0x0}, + 673: {region: 0x165, script: 0x57, flags: 0x0}, + 674: {region: 0x106, script: 0x1f, flags: 0x0}, + 675: {region: 0x131, script: 0x57, flags: 0x0}, + 676: {region: 0x165, script: 0x57, flags: 0x0}, + 677: {region: 0xd9, script: 0x57, flags: 0x0}, + 678: {region: 0x165, script: 0x57, flags: 0x0}, + 679: {region: 0x165, script: 0x57, flags: 0x0}, + 680: {region: 0x21, script: 0x2, flags: 0x1}, + 681: {region: 0x165, script: 0x57, flags: 0x0}, + 682: {region: 0x165, script: 0x57, flags: 0x0}, + 683: {region: 0x9e, script: 0x57, flags: 0x0}, + 684: {region: 0x53, script: 0x5d, flags: 0x0}, + 685: {region: 0x95, script: 0x57, flags: 0x0}, + 686: {region: 0x9c, script: 0x5, flags: 0x0}, + 687: {region: 0x135, script: 0x57, flags: 0x0}, + 688: {region: 0x165, script: 0x57, flags: 0x0}, + 689: {region: 0x165, script: 0x57, flags: 0x0}, + 690: {region: 0x99, script: 0xda, flags: 0x0}, + 691: {region: 0x9e, script: 0x57, flags: 0x0}, + 692: {region: 0x165, script: 0x57, flags: 0x0}, + 693: {region: 0x4b, script: 0x57, flags: 0x0}, + 694: {region: 0x165, script: 0x57, flags: 0x0}, + 695: {region: 0x165, script: 0x57, flags: 0x0}, + 696: {region: 0xaf, script: 0x54, flags: 0x0}, + 697: {region: 0x165, script: 0x57, flags: 0x0}, + 698: {region: 0x165, script: 0x57, flags: 0x0}, + 699: {region: 0x4b, script: 0x57, flags: 0x0}, + 700: {region: 0x165, script: 0x57, flags: 0x0}, + 701: {region: 0x165, script: 0x57, flags: 0x0}, + 702: {region: 0x162, script: 0x57, flags: 0x0}, + 703: {region: 0x9c, script: 0x5, flags: 0x0}, + 704: {region: 0xb6, script: 0x57, flags: 0x0}, + 705: {region: 0xb8, script: 0x57, flags: 0x0}, + 706: {region: 0x4b, script: 0x57, flags: 0x0}, + 707: {region: 0x4b, script: 0x57, flags: 0x0}, + 708: {region: 0xa4, script: 0x57, flags: 0x0}, + 709: {region: 0xa4, script: 0x57, flags: 0x0}, + 710: {region: 0x9c, script: 0x5, flags: 0x0}, + 711: {region: 0xb8, script: 0x57, flags: 0x0}, + 712: {region: 0x123, script: 0xdf, flags: 0x0}, + 713: {region: 0x53, script: 0x38, flags: 0x0}, + 714: {region: 0x12b, script: 0x57, flags: 0x0}, + 715: {region: 0x95, script: 0x57, flags: 0x0}, + 716: {region: 0x52, script: 0x57, flags: 0x0}, + 717: {region: 0x99, script: 0x21, flags: 0x0}, + 718: {region: 0x99, script: 0x21, flags: 0x0}, + 719: {region: 0x95, script: 0x57, flags: 0x0}, + 720: {region: 0x23, script: 0x3, flags: 0x1}, + 721: {region: 0xa4, script: 0x57, flags: 0x0}, + 722: {region: 0x165, script: 0x57, flags: 0x0}, + 723: {region: 0xcf, script: 0x57, flags: 0x0}, + 724: {region: 0x165, script: 0x57, flags: 0x0}, + 725: {region: 0x165, script: 0x57, flags: 0x0}, + 726: {region: 0x165, script: 0x57, flags: 0x0}, + 727: {region: 0x165, script: 0x57, flags: 0x0}, + 728: {region: 0x165, script: 0x57, flags: 0x0}, + 729: {region: 0x165, script: 0x57, flags: 0x0}, + 730: {region: 0x165, script: 0x57, flags: 0x0}, + 731: {region: 0x165, script: 0x57, flags: 0x0}, + 732: {region: 0x165, script: 0x57, flags: 0x0}, + 733: {region: 0x165, script: 0x57, flags: 0x0}, + 734: {region: 0x165, script: 0x57, flags: 0x0}, + 735: {region: 0x165, script: 0x5, flags: 0x0}, + 736: {region: 0x106, script: 0x1f, flags: 0x0}, + 737: {region: 0xe7, script: 0x57, flags: 0x0}, + 738: {region: 0x165, script: 0x57, flags: 0x0}, + 739: {region: 0x95, script: 0x57, flags: 0x0}, + 740: {region: 0x165, script: 0x29, flags: 0x0}, + 741: {region: 0x165, script: 0x57, flags: 0x0}, + 742: {region: 0x165, script: 0x57, flags: 0x0}, + 743: {region: 0x165, script: 0x57, flags: 0x0}, + 744: {region: 0x112, script: 0x57, flags: 0x0}, + 745: {region: 0xa4, script: 0x57, flags: 0x0}, + 746: {region: 0x165, script: 0x57, flags: 0x0}, + 747: {region: 0x165, script: 0x57, flags: 0x0}, + 748: {region: 0x123, script: 0x5, flags: 0x0}, + 749: {region: 0xcc, script: 0x57, flags: 0x0}, + 750: {region: 0x165, script: 0x57, flags: 0x0}, + 751: {region: 0x165, script: 0x57, flags: 0x0}, + 752: {region: 0x165, script: 0x57, flags: 0x0}, + 753: {region: 0xbf, script: 0x57, flags: 0x0}, + 754: {region: 0xd1, script: 0x57, flags: 0x0}, + 755: {region: 0x165, script: 0x57, flags: 0x0}, + 756: {region: 0x52, script: 0x57, flags: 0x0}, + 757: {region: 0xdb, script: 0x21, flags: 0x0}, + 758: {region: 0x12f, script: 0x57, flags: 0x0}, + 759: {region: 0xc0, script: 0x57, flags: 0x0}, + 760: {region: 0x165, script: 0x57, flags: 0x0}, + 761: {region: 0x165, script: 0x57, flags: 0x0}, + 762: {region: 0xe0, script: 0x57, flags: 0x0}, + 763: {region: 0x165, script: 0x57, flags: 0x0}, + 764: {region: 0x95, script: 0x57, flags: 0x0}, + 765: {region: 0x9b, script: 0x3a, flags: 0x0}, + 766: {region: 0x165, script: 0x57, flags: 0x0}, + 767: {region: 0xc2, script: 0x1f, flags: 0x0}, + 768: {region: 0x165, script: 0x5, flags: 0x0}, + 769: {region: 0x165, script: 0x57, flags: 0x0}, + 770: {region: 0x165, script: 0x57, flags: 0x0}, + 771: {region: 0x165, script: 0x57, flags: 0x0}, + 772: {region: 0x99, script: 0x6b, flags: 0x0}, + 773: {region: 0x165, script: 0x57, flags: 0x0}, + 774: {region: 0x165, script: 0x57, flags: 0x0}, + 775: {region: 0x10b, script: 0x57, flags: 0x0}, + 776: {region: 0x165, script: 0x57, flags: 0x0}, + 777: {region: 0x165, script: 0x57, flags: 0x0}, + 778: {region: 0x165, script: 0x57, flags: 0x0}, + 779: {region: 0x26, script: 0x3, flags: 0x1}, + 780: {region: 0x165, script: 0x57, flags: 0x0}, + 781: {region: 0x165, script: 0x57, flags: 0x0}, + 782: {region: 0x99, script: 0xe, flags: 0x0}, + 783: {region: 0xc4, script: 0x72, flags: 0x0}, + 785: {region: 0x165, script: 0x57, flags: 0x0}, + 786: {region: 0x49, script: 0x57, flags: 0x0}, + 787: {region: 0x49, script: 0x57, flags: 0x0}, + 788: {region: 0x37, script: 0x57, flags: 0x0}, + 789: {region: 0x165, script: 0x57, flags: 0x0}, + 790: {region: 0x165, script: 0x57, flags: 0x0}, + 791: {region: 0x165, script: 0x57, flags: 0x0}, + 792: {region: 0x165, script: 0x57, flags: 0x0}, + 793: {region: 0x165, script: 0x57, flags: 0x0}, + 794: {region: 0x165, script: 0x57, flags: 0x0}, + 795: {region: 0x99, script: 0x21, flags: 0x0}, + 796: {region: 0xdb, script: 0x21, flags: 0x0}, + 797: {region: 0x106, script: 0x1f, flags: 0x0}, + 798: {region: 0x35, script: 0x6f, flags: 0x0}, + 799: {region: 0x29, script: 0x3, flags: 0x1}, + 800: {region: 0xcb, script: 0x57, flags: 0x0}, + 801: {region: 0x165, script: 0x57, flags: 0x0}, + 802: {region: 0x165, script: 0x57, flags: 0x0}, + 803: {region: 0x165, script: 0x57, flags: 0x0}, + 804: {region: 0x99, script: 0x21, flags: 0x0}, + 805: {region: 0x52, script: 0x57, flags: 0x0}, + 807: {region: 0x165, script: 0x57, flags: 0x0}, + 808: {region: 0x135, script: 0x57, flags: 0x0}, + 809: {region: 0x165, script: 0x57, flags: 0x0}, + 810: {region: 0x165, script: 0x57, flags: 0x0}, + 811: {region: 0xe8, script: 0x5, flags: 0x0}, + 812: {region: 0xc3, script: 0x57, flags: 0x0}, + 813: {region: 0x99, script: 0x21, flags: 0x0}, + 814: {region: 0x95, script: 0x57, flags: 0x0}, + 815: {region: 0x164, script: 0x57, flags: 0x0}, + 816: {region: 0x165, script: 0x57, flags: 0x0}, + 817: {region: 0xc4, script: 0x72, flags: 0x0}, + 818: {region: 0x165, script: 0x57, flags: 0x0}, + 819: {region: 0x165, script: 0x29, flags: 0x0}, + 820: {region: 0x106, script: 0x1f, flags: 0x0}, + 821: {region: 0x165, script: 0x57, flags: 0x0}, + 822: {region: 0x131, script: 0x57, flags: 0x0}, + 823: {region: 0x9c, script: 0x63, flags: 0x0}, + 824: {region: 0x165, script: 0x57, flags: 0x0}, + 825: {region: 0x165, script: 0x57, flags: 0x0}, + 826: {region: 0x9c, script: 0x5, flags: 0x0}, + 827: {region: 0x165, script: 0x57, flags: 0x0}, + 828: {region: 0x165, script: 0x57, flags: 0x0}, + 829: {region: 0x165, script: 0x57, flags: 0x0}, + 830: {region: 0xdd, script: 0x57, flags: 0x0}, + 831: {region: 0x165, script: 0x57, flags: 0x0}, + 832: {region: 0x165, script: 0x57, flags: 0x0}, + 834: {region: 0x165, script: 0x57, flags: 0x0}, + 835: {region: 0x53, script: 0x38, flags: 0x0}, + 836: {region: 0x9e, script: 0x57, flags: 0x0}, + 837: {region: 0xd2, script: 0x57, flags: 0x0}, + 838: {region: 0x165, script: 0x57, flags: 0x0}, + 839: {region: 0xda, script: 0x57, flags: 0x0}, + 840: {region: 0x165, script: 0x57, flags: 0x0}, + 841: {region: 0x165, script: 0x57, flags: 0x0}, + 842: {region: 0x165, script: 0x57, flags: 0x0}, + 843: {region: 0xcf, script: 0x57, flags: 0x0}, + 844: {region: 0x165, script: 0x57, flags: 0x0}, + 845: {region: 0x165, script: 0x57, flags: 0x0}, + 846: {region: 0x164, script: 0x57, flags: 0x0}, + 847: {region: 0xd1, script: 0x57, flags: 0x0}, + 848: {region: 0x60, script: 0x57, flags: 0x0}, + 849: {region: 0xdb, script: 0x21, flags: 0x0}, + 850: {region: 0x165, script: 0x57, flags: 0x0}, + 851: {region: 0xdb, script: 0x21, flags: 0x0}, + 852: {region: 0x165, script: 0x57, flags: 0x0}, + 853: {region: 0x165, script: 0x57, flags: 0x0}, + 854: {region: 0xd2, script: 0x57, flags: 0x0}, + 855: {region: 0x165, script: 0x57, flags: 0x0}, + 856: {region: 0x165, script: 0x57, flags: 0x0}, + 857: {region: 0xd1, script: 0x57, flags: 0x0}, + 858: {region: 0x165, script: 0x57, flags: 0x0}, + 859: {region: 0xcf, script: 0x57, flags: 0x0}, + 860: {region: 0xcf, script: 0x57, flags: 0x0}, + 861: {region: 0x165, script: 0x57, flags: 0x0}, + 862: {region: 0x165, script: 0x57, flags: 0x0}, + 863: {region: 0x95, script: 0x57, flags: 0x0}, + 864: {region: 0x165, script: 0x57, flags: 0x0}, + 865: {region: 0xdf, script: 0x57, flags: 0x0}, + 866: {region: 0x165, script: 0x57, flags: 0x0}, + 867: {region: 0x165, script: 0x57, flags: 0x0}, + 868: {region: 0x99, script: 0x57, flags: 0x0}, + 869: {region: 0x165, script: 0x57, flags: 0x0}, + 870: {region: 0x165, script: 0x57, flags: 0x0}, + 871: {region: 0xd9, script: 0x57, flags: 0x0}, + 872: {region: 0x52, script: 0x57, flags: 0x0}, + 873: {region: 0x165, script: 0x57, flags: 0x0}, + 874: {region: 0xda, script: 0x57, flags: 0x0}, + 875: {region: 0x165, script: 0x57, flags: 0x0}, + 876: {region: 0x52, script: 0x57, flags: 0x0}, + 877: {region: 0x165, script: 0x57, flags: 0x0}, + 878: {region: 0x165, script: 0x57, flags: 0x0}, + 879: {region: 0xda, script: 0x57, flags: 0x0}, + 880: {region: 0x123, script: 0x53, flags: 0x0}, + 881: {region: 0x99, script: 0x21, flags: 0x0}, + 882: {region: 0x10c, script: 0xbf, flags: 0x0}, + 883: {region: 0x165, script: 0x57, flags: 0x0}, + 884: {region: 0x165, script: 0x57, flags: 0x0}, + 885: {region: 0x84, script: 0x78, flags: 0x0}, + 886: {region: 0x161, script: 0x57, flags: 0x0}, + 887: {region: 0x165, script: 0x57, flags: 0x0}, + 888: {region: 0x49, script: 0x17, flags: 0x0}, + 889: {region: 0x165, script: 0x57, flags: 0x0}, + 890: {region: 0x161, script: 0x57, flags: 0x0}, + 891: {region: 0x165, script: 0x57, flags: 0x0}, + 892: {region: 0x165, script: 0x57, flags: 0x0}, + 893: {region: 0x165, script: 0x57, flags: 0x0}, + 894: {region: 0x165, script: 0x57, flags: 0x0}, + 895: {region: 0x165, script: 0x57, flags: 0x0}, + 896: {region: 0x117, script: 0x57, flags: 0x0}, + 897: {region: 0x165, script: 0x57, flags: 0x0}, + 898: {region: 0x165, script: 0x57, flags: 0x0}, + 899: {region: 0x135, script: 0x57, flags: 0x0}, + 900: {region: 0x165, script: 0x57, flags: 0x0}, + 901: {region: 0x53, script: 0x57, flags: 0x0}, + 902: {region: 0x165, script: 0x57, flags: 0x0}, + 903: {region: 0xce, script: 0x57, flags: 0x0}, + 904: {region: 0x12f, script: 0x57, flags: 0x0}, + 905: {region: 0x131, script: 0x57, flags: 0x0}, + 906: {region: 0x80, script: 0x57, flags: 0x0}, + 907: {region: 0x78, script: 0x57, flags: 0x0}, + 908: {region: 0x165, script: 0x57, flags: 0x0}, + 910: {region: 0x165, script: 0x57, flags: 0x0}, + 911: {region: 0x165, script: 0x57, flags: 0x0}, + 912: {region: 0x6f, script: 0x57, flags: 0x0}, + 913: {region: 0x165, script: 0x57, flags: 0x0}, + 914: {region: 0x165, script: 0x57, flags: 0x0}, + 915: {region: 0x165, script: 0x57, flags: 0x0}, + 916: {region: 0x165, script: 0x57, flags: 0x0}, + 917: {region: 0x99, script: 0x7d, flags: 0x0}, + 918: {region: 0x165, script: 0x57, flags: 0x0}, + 919: {region: 0x165, script: 0x5, flags: 0x0}, + 920: {region: 0x7d, script: 0x1f, flags: 0x0}, + 921: {region: 0x135, script: 0x7e, flags: 0x0}, + 922: {region: 0x165, script: 0x5, flags: 0x0}, + 923: {region: 0xc5, script: 0x7c, flags: 0x0}, + 924: {region: 0x165, script: 0x57, flags: 0x0}, + 925: {region: 0x2c, script: 0x3, flags: 0x1}, + 926: {region: 0xe7, script: 0x57, flags: 0x0}, + 927: {region: 0x2f, script: 0x2, flags: 0x1}, + 928: {region: 0xe7, script: 0x57, flags: 0x0}, + 929: {region: 0x30, script: 0x57, flags: 0x0}, + 930: {region: 0xf0, script: 0x57, flags: 0x0}, + 931: {region: 0x165, script: 0x57, flags: 0x0}, + 932: {region: 0x78, script: 0x57, flags: 0x0}, + 933: {region: 0xd6, script: 0x57, flags: 0x0}, + 934: {region: 0x135, script: 0x57, flags: 0x0}, + 935: {region: 0x49, script: 0x57, flags: 0x0}, + 936: {region: 0x165, script: 0x57, flags: 0x0}, + 937: {region: 0x9c, script: 0xe8, flags: 0x0}, + 938: {region: 0x165, script: 0x57, flags: 0x0}, + 939: {region: 0x60, script: 0x57, flags: 0x0}, + 940: {region: 0x165, script: 0x5, flags: 0x0}, + 941: {region: 0xb0, script: 0x87, flags: 0x0}, + 943: {region: 0x165, script: 0x57, flags: 0x0}, + 944: {region: 0x165, script: 0x57, flags: 0x0}, + 945: {region: 0x99, script: 0x12, flags: 0x0}, + 946: {region: 0xa4, script: 0x57, flags: 0x0}, + 947: {region: 0xe9, script: 0x57, flags: 0x0}, + 948: {region: 0x165, script: 0x57, flags: 0x0}, + 949: {region: 0x9e, script: 0x57, flags: 0x0}, + 950: {region: 0x165, script: 0x57, flags: 0x0}, + 951: {region: 0x165, script: 0x57, flags: 0x0}, + 952: {region: 0x87, script: 0x31, flags: 0x0}, + 953: {region: 0x75, script: 0x57, flags: 0x0}, + 954: {region: 0x165, script: 0x57, flags: 0x0}, + 955: {region: 0xe8, script: 0x4a, flags: 0x0}, + 956: {region: 0x9c, script: 0x5, flags: 0x0}, + 957: {region: 0x1, script: 0x57, flags: 0x0}, + 958: {region: 0x24, script: 0x5, flags: 0x0}, + 959: {region: 0x165, script: 0x57, flags: 0x0}, + 960: {region: 0x41, script: 0x57, flags: 0x0}, + 961: {region: 0x165, script: 0x57, flags: 0x0}, + 962: {region: 0x7a, script: 0x57, flags: 0x0}, + 963: {region: 0x165, script: 0x57, flags: 0x0}, + 964: {region: 0xe4, script: 0x57, flags: 0x0}, + 965: {region: 0x89, script: 0x57, flags: 0x0}, + 966: {region: 0x69, script: 0x57, flags: 0x0}, + 967: {region: 0x165, script: 0x57, flags: 0x0}, + 968: {region: 0x99, script: 0x21, flags: 0x0}, + 969: {region: 0x165, script: 0x57, flags: 0x0}, + 970: {region: 0x102, script: 0x57, flags: 0x0}, + 971: {region: 0x95, script: 0x57, flags: 0x0}, + 972: {region: 0x165, script: 0x57, flags: 0x0}, + 973: {region: 0x165, script: 0x57, flags: 0x0}, + 974: {region: 0x9e, script: 0x57, flags: 0x0}, + 975: {region: 0x165, script: 0x5, flags: 0x0}, + 976: {region: 0x99, script: 0x57, flags: 0x0}, + 977: {region: 0x31, script: 0x2, flags: 0x1}, + 978: {region: 0xdb, script: 0x21, flags: 0x0}, + 979: {region: 0x35, script: 0xe, flags: 0x0}, + 980: {region: 0x4e, script: 0x57, flags: 0x0}, + 981: {region: 0x72, script: 0x57, flags: 0x0}, + 982: {region: 0x4e, script: 0x57, flags: 0x0}, + 983: {region: 0x9c, script: 0x5, flags: 0x0}, + 984: {region: 0x10c, script: 0x57, flags: 0x0}, + 985: {region: 0x3a, script: 0x57, flags: 0x0}, + 986: {region: 0x165, script: 0x57, flags: 0x0}, + 987: {region: 0xd1, script: 0x57, flags: 0x0}, + 988: {region: 0x104, script: 0x57, flags: 0x0}, + 989: {region: 0x95, script: 0x57, flags: 0x0}, + 990: {region: 0x12f, script: 0x57, flags: 0x0}, + 991: {region: 0x165, script: 0x57, flags: 0x0}, + 992: {region: 0x165, script: 0x57, flags: 0x0}, + 993: {region: 0x73, script: 0x57, flags: 0x0}, + 994: {region: 0x106, script: 0x1f, flags: 0x0}, + 995: {region: 0x130, script: 0x1f, flags: 0x0}, + 996: {region: 0x109, script: 0x57, flags: 0x0}, + 997: {region: 0x107, script: 0x57, flags: 0x0}, + 998: {region: 0x12f, script: 0x57, flags: 0x0}, + 999: {region: 0x165, script: 0x57, flags: 0x0}, + 1000: {region: 0xa2, script: 0x49, flags: 0x0}, + 1001: {region: 0x99, script: 0x21, flags: 0x0}, + 1002: {region: 0x80, script: 0x57, flags: 0x0}, + 1003: {region: 0x106, script: 0x1f, flags: 0x0}, + 1004: {region: 0xa4, script: 0x57, flags: 0x0}, + 1005: {region: 0x95, script: 0x57, flags: 0x0}, + 1006: {region: 0x99, script: 0x57, flags: 0x0}, + 1007: {region: 0x114, script: 0x57, flags: 0x0}, + 1008: {region: 0x99, script: 0xc3, flags: 0x0}, + 1009: {region: 0x165, script: 0x57, flags: 0x0}, + 1010: {region: 0x165, script: 0x57, flags: 0x0}, + 1011: {region: 0x12f, script: 0x57, flags: 0x0}, + 1012: {region: 0x9e, script: 0x57, flags: 0x0}, + 1013: {region: 0x99, script: 0x21, flags: 0x0}, + 1014: {region: 0x165, script: 0x5, flags: 0x0}, + 1015: {region: 0x9e, script: 0x57, flags: 0x0}, + 1016: {region: 0x7b, script: 0x57, flags: 0x0}, + 1017: {region: 0x49, script: 0x57, flags: 0x0}, + 1018: {region: 0x33, script: 0x4, flags: 0x1}, + 1019: {region: 0x9e, script: 0x57, flags: 0x0}, + 1020: {region: 0x9c, script: 0x5, flags: 0x0}, + 1021: {region: 0xda, script: 0x57, flags: 0x0}, + 1022: {region: 0x4f, script: 0x57, flags: 0x0}, + 1023: {region: 0xd1, script: 0x57, flags: 0x0}, + 1024: {region: 0xcf, script: 0x57, flags: 0x0}, + 1025: {region: 0xc3, script: 0x57, flags: 0x0}, + 1026: {region: 0x4c, script: 0x57, flags: 0x0}, + 1027: {region: 0x96, script: 0x7a, flags: 0x0}, + 1028: {region: 0xb6, script: 0x57, flags: 0x0}, + 1029: {region: 0x165, script: 0x29, flags: 0x0}, + 1030: {region: 0x165, script: 0x57, flags: 0x0}, + 1032: {region: 0xba, script: 0xdc, flags: 0x0}, + 1033: {region: 0x165, script: 0x57, flags: 0x0}, + 1034: {region: 0xc4, script: 0x72, flags: 0x0}, + 1035: {region: 0x165, script: 0x5, flags: 0x0}, + 1036: {region: 0xb3, script: 0xca, flags: 0x0}, + 1037: {region: 0x6f, script: 0x57, flags: 0x0}, + 1038: {region: 0x165, script: 0x57, flags: 0x0}, + 1039: {region: 0x165, script: 0x57, flags: 0x0}, + 1040: {region: 0x165, script: 0x57, flags: 0x0}, + 1041: {region: 0x165, script: 0x57, flags: 0x0}, + 1042: {region: 0x111, script: 0x57, flags: 0x0}, + 1043: {region: 0x165, script: 0x57, flags: 0x0}, + 1044: {region: 0xe8, script: 0x5, flags: 0x0}, + 1045: {region: 0x165, script: 0x57, flags: 0x0}, + 1046: {region: 0x10f, script: 0x57, flags: 0x0}, + 1047: {region: 0x165, script: 0x57, flags: 0x0}, + 1048: {region: 0xe9, script: 0x57, flags: 0x0}, + 1049: {region: 0x165, script: 0x57, flags: 0x0}, + 1050: {region: 0x95, script: 0x57, flags: 0x0}, + 1051: {region: 0x142, script: 0x57, flags: 0x0}, + 1052: {region: 0x10c, script: 0x57, flags: 0x0}, + 1054: {region: 0x10c, script: 0x57, flags: 0x0}, + 1055: {region: 0x72, script: 0x57, flags: 0x0}, + 1056: {region: 0x97, script: 0xc0, flags: 0x0}, + 1057: {region: 0x165, script: 0x57, flags: 0x0}, + 1058: {region: 0x72, script: 0x57, flags: 0x0}, + 1059: {region: 0x164, script: 0x57, flags: 0x0}, + 1060: {region: 0x165, script: 0x57, flags: 0x0}, + 1061: {region: 0xc3, script: 0x57, flags: 0x0}, + 1062: {region: 0x165, script: 0x57, flags: 0x0}, + 1063: {region: 0x165, script: 0x57, flags: 0x0}, + 1064: {region: 0x165, script: 0x57, flags: 0x0}, + 1065: {region: 0x115, script: 0x57, flags: 0x0}, + 1066: {region: 0x165, script: 0x57, flags: 0x0}, + 1067: {region: 0x165, script: 0x57, flags: 0x0}, + 1068: {region: 0x123, script: 0xdf, flags: 0x0}, + 1069: {region: 0x165, script: 0x57, flags: 0x0}, + 1070: {region: 0x165, script: 0x57, flags: 0x0}, + 1071: {region: 0x165, script: 0x57, flags: 0x0}, + 1072: {region: 0x165, script: 0x57, flags: 0x0}, + 1073: {region: 0x27, script: 0x57, flags: 0x0}, + 1074: {region: 0x37, script: 0x5, flags: 0x1}, + 1075: {region: 0x99, script: 0xcb, flags: 0x0}, + 1076: {region: 0x116, script: 0x57, flags: 0x0}, + 1077: {region: 0x114, script: 0x57, flags: 0x0}, + 1078: {region: 0x99, script: 0x21, flags: 0x0}, + 1079: {region: 0x161, script: 0x57, flags: 0x0}, + 1080: {region: 0x165, script: 0x57, flags: 0x0}, + 1081: {region: 0x165, script: 0x57, flags: 0x0}, + 1082: {region: 0x6d, script: 0x57, flags: 0x0}, + 1083: {region: 0x161, script: 0x57, flags: 0x0}, + 1084: {region: 0x165, script: 0x57, flags: 0x0}, + 1085: {region: 0x60, script: 0x57, flags: 0x0}, + 1086: {region: 0x95, script: 0x57, flags: 0x0}, + 1087: {region: 0x165, script: 0x57, flags: 0x0}, + 1088: {region: 0x165, script: 0x57, flags: 0x0}, + 1089: {region: 0x12f, script: 0x57, flags: 0x0}, + 1090: {region: 0x165, script: 0x57, flags: 0x0}, + 1091: {region: 0x84, script: 0x57, flags: 0x0}, + 1092: {region: 0x10c, script: 0x57, flags: 0x0}, + 1093: {region: 0x12f, script: 0x57, flags: 0x0}, + 1094: {region: 0x15f, script: 0x5, flags: 0x0}, + 1095: {region: 0x4b, script: 0x57, flags: 0x0}, + 1096: {region: 0x60, script: 0x57, flags: 0x0}, + 1097: {region: 0x165, script: 0x57, flags: 0x0}, + 1098: {region: 0x99, script: 0x21, flags: 0x0}, + 1099: {region: 0x95, script: 0x57, flags: 0x0}, + 1100: {region: 0x165, script: 0x57, flags: 0x0}, + 1101: {region: 0x35, script: 0xe, flags: 0x0}, + 1102: {region: 0x9b, script: 0xcf, flags: 0x0}, + 1103: {region: 0xe9, script: 0x57, flags: 0x0}, + 1104: {region: 0x99, script: 0xd7, flags: 0x0}, + 1105: {region: 0xdb, script: 0x21, flags: 0x0}, + 1106: {region: 0x165, script: 0x57, flags: 0x0}, + 1107: {region: 0x165, script: 0x57, flags: 0x0}, + 1108: {region: 0x165, script: 0x57, flags: 0x0}, + 1109: {region: 0x165, script: 0x57, flags: 0x0}, + 1110: {region: 0x165, script: 0x57, flags: 0x0}, + 1111: {region: 0x165, script: 0x57, flags: 0x0}, + 1112: {region: 0x165, script: 0x57, flags: 0x0}, + 1113: {region: 0x165, script: 0x57, flags: 0x0}, + 1114: {region: 0xe7, script: 0x57, flags: 0x0}, + 1115: {region: 0x165, script: 0x57, flags: 0x0}, + 1116: {region: 0x165, script: 0x57, flags: 0x0}, + 1117: {region: 0x99, script: 0x4f, flags: 0x0}, + 1118: {region: 0x53, script: 0xd5, flags: 0x0}, + 1119: {region: 0xdb, script: 0x21, flags: 0x0}, + 1120: {region: 0xdb, script: 0x21, flags: 0x0}, + 1121: {region: 0x99, script: 0xda, flags: 0x0}, + 1122: {region: 0x165, script: 0x57, flags: 0x0}, + 1123: {region: 0x112, script: 0x57, flags: 0x0}, + 1124: {region: 0x131, script: 0x57, flags: 0x0}, + 1125: {region: 0x126, script: 0x57, flags: 0x0}, + 1126: {region: 0x165, script: 0x57, flags: 0x0}, + 1127: {region: 0x3c, script: 0x3, flags: 0x1}, + 1128: {region: 0x165, script: 0x57, flags: 0x0}, + 1129: {region: 0x165, script: 0x57, flags: 0x0}, + 1130: {region: 0x165, script: 0x57, flags: 0x0}, + 1131: {region: 0x123, script: 0xdf, flags: 0x0}, + 1132: {region: 0xdb, script: 0x21, flags: 0x0}, + 1133: {region: 0xdb, script: 0x21, flags: 0x0}, + 1134: {region: 0xdb, script: 0x21, flags: 0x0}, + 1135: {region: 0x6f, script: 0x29, flags: 0x0}, + 1136: {region: 0x165, script: 0x57, flags: 0x0}, + 1137: {region: 0x6d, script: 0x29, flags: 0x0}, + 1138: {region: 0x165, script: 0x57, flags: 0x0}, + 1139: {region: 0x165, script: 0x57, flags: 0x0}, + 1140: {region: 0x165, script: 0x57, flags: 0x0}, + 1141: {region: 0xd6, script: 0x57, flags: 0x0}, + 1142: {region: 0x127, script: 0x57, flags: 0x0}, + 1143: {region: 0x125, script: 0x57, flags: 0x0}, + 1144: {region: 0x32, script: 0x57, flags: 0x0}, + 1145: {region: 0xdb, script: 0x21, flags: 0x0}, + 1146: {region: 0xe7, script: 0x57, flags: 0x0}, + 1147: {region: 0x165, script: 0x57, flags: 0x0}, + 1148: {region: 0x165, script: 0x57, flags: 0x0}, + 1149: {region: 0x32, script: 0x57, flags: 0x0}, + 1150: {region: 0xd4, script: 0x57, flags: 0x0}, + 1151: {region: 0x165, script: 0x57, flags: 0x0}, + 1152: {region: 0x161, script: 0x57, flags: 0x0}, + 1153: {region: 0x165, script: 0x57, flags: 0x0}, + 1154: {region: 0x129, script: 0x57, flags: 0x0}, + 1155: {region: 0x165, script: 0x57, flags: 0x0}, + 1156: {region: 0xce, script: 0x57, flags: 0x0}, + 1157: {region: 0x165, script: 0x57, flags: 0x0}, + 1158: {region: 0xe6, script: 0x57, flags: 0x0}, + 1159: {region: 0x165, script: 0x57, flags: 0x0}, + 1160: {region: 0x165, script: 0x57, flags: 0x0}, + 1161: {region: 0x165, script: 0x57, flags: 0x0}, + 1162: {region: 0x12b, script: 0x57, flags: 0x0}, + 1163: {region: 0x12b, script: 0x57, flags: 0x0}, + 1164: {region: 0x12e, script: 0x57, flags: 0x0}, + 1165: {region: 0x165, script: 0x5, flags: 0x0}, + 1166: {region: 0x161, script: 0x57, flags: 0x0}, + 1167: {region: 0x87, script: 0x31, flags: 0x0}, + 1168: {region: 0xdb, script: 0x21, flags: 0x0}, + 1169: {region: 0xe7, script: 0x57, flags: 0x0}, + 1170: {region: 0x43, script: 0xe0, flags: 0x0}, + 1171: {region: 0x165, script: 0x57, flags: 0x0}, + 1172: {region: 0x106, script: 0x1f, flags: 0x0}, + 1173: {region: 0x165, script: 0x57, flags: 0x0}, + 1174: {region: 0x165, script: 0x57, flags: 0x0}, + 1175: {region: 0x131, script: 0x57, flags: 0x0}, + 1176: {region: 0x165, script: 0x57, flags: 0x0}, + 1177: {region: 0x123, script: 0xdf, flags: 0x0}, + 1178: {region: 0x32, script: 0x57, flags: 0x0}, + 1179: {region: 0x165, script: 0x57, flags: 0x0}, + 1180: {region: 0x165, script: 0x57, flags: 0x0}, + 1181: {region: 0xce, script: 0x57, flags: 0x0}, + 1182: {region: 0x165, script: 0x57, flags: 0x0}, + 1183: {region: 0x165, script: 0x57, flags: 0x0}, + 1184: {region: 0x12d, script: 0x57, flags: 0x0}, + 1185: {region: 0x165, script: 0x57, flags: 0x0}, + 1187: {region: 0x165, script: 0x57, flags: 0x0}, + 1188: {region: 0xd4, script: 0x57, flags: 0x0}, + 1189: {region: 0x53, script: 0xd8, flags: 0x0}, + 1190: {region: 0xe5, script: 0x57, flags: 0x0}, + 1191: {region: 0x165, script: 0x57, flags: 0x0}, + 1192: {region: 0x106, script: 0x1f, flags: 0x0}, + 1193: {region: 0xba, script: 0x57, flags: 0x0}, + 1194: {region: 0x165, script: 0x57, flags: 0x0}, + 1195: {region: 0x106, script: 0x1f, flags: 0x0}, + 1196: {region: 0x3f, script: 0x4, flags: 0x1}, + 1197: {region: 0x11c, script: 0xe2, flags: 0x0}, + 1198: {region: 0x130, script: 0x1f, flags: 0x0}, + 1199: {region: 0x75, script: 0x57, flags: 0x0}, + 1200: {region: 0x2a, script: 0x57, flags: 0x0}, + 1202: {region: 0x43, script: 0x3, flags: 0x1}, + 1203: {region: 0x99, script: 0xe, flags: 0x0}, + 1204: {region: 0xe8, script: 0x5, flags: 0x0}, + 1205: {region: 0x165, script: 0x57, flags: 0x0}, + 1206: {region: 0x165, script: 0x57, flags: 0x0}, + 1207: {region: 0x165, script: 0x57, flags: 0x0}, + 1208: {region: 0x165, script: 0x57, flags: 0x0}, + 1209: {region: 0x165, script: 0x57, flags: 0x0}, + 1210: {region: 0x165, script: 0x57, flags: 0x0}, + 1211: {region: 0x165, script: 0x57, flags: 0x0}, + 1212: {region: 0x46, script: 0x4, flags: 0x1}, + 1213: {region: 0x165, script: 0x57, flags: 0x0}, + 1214: {region: 0xb4, script: 0xe3, flags: 0x0}, + 1215: {region: 0x165, script: 0x57, flags: 0x0}, + 1216: {region: 0x161, script: 0x57, flags: 0x0}, + 1217: {region: 0x9e, script: 0x57, flags: 0x0}, + 1218: {region: 0x106, script: 0x57, flags: 0x0}, + 1219: {region: 0x13e, script: 0x57, flags: 0x0}, + 1220: {region: 0x11b, script: 0x57, flags: 0x0}, + 1221: {region: 0x165, script: 0x57, flags: 0x0}, + 1222: {region: 0x36, script: 0x57, flags: 0x0}, + 1223: {region: 0x60, script: 0x57, flags: 0x0}, + 1224: {region: 0xd1, script: 0x57, flags: 0x0}, + 1225: {region: 0x1, script: 0x57, flags: 0x0}, + 1226: {region: 0x106, script: 0x57, flags: 0x0}, + 1227: {region: 0x6a, script: 0x57, flags: 0x0}, + 1228: {region: 0x12f, script: 0x57, flags: 0x0}, + 1229: {region: 0x165, script: 0x57, flags: 0x0}, + 1230: {region: 0x36, script: 0x57, flags: 0x0}, + 1231: {region: 0x4e, script: 0x57, flags: 0x0}, + 1232: {region: 0x165, script: 0x57, flags: 0x0}, + 1233: {region: 0x6f, script: 0x29, flags: 0x0}, + 1234: {region: 0x165, script: 0x57, flags: 0x0}, + 1235: {region: 0xe7, script: 0x57, flags: 0x0}, + 1236: {region: 0x2f, script: 0x57, flags: 0x0}, + 1237: {region: 0x99, script: 0xda, flags: 0x0}, + 1238: {region: 0x99, script: 0x21, flags: 0x0}, + 1239: {region: 0x165, script: 0x57, flags: 0x0}, + 1240: {region: 0x165, script: 0x57, flags: 0x0}, + 1241: {region: 0x165, script: 0x57, flags: 0x0}, + 1242: {region: 0x165, script: 0x57, flags: 0x0}, + 1243: {region: 0x165, script: 0x57, flags: 0x0}, + 1244: {region: 0x165, script: 0x57, flags: 0x0}, + 1245: {region: 0x165, script: 0x57, flags: 0x0}, + 1246: {region: 0x165, script: 0x57, flags: 0x0}, + 1247: {region: 0x165, script: 0x57, flags: 0x0}, + 1248: {region: 0x140, script: 0x57, flags: 0x0}, + 1249: {region: 0x165, script: 0x57, flags: 0x0}, + 1250: {region: 0x165, script: 0x57, flags: 0x0}, + 1251: {region: 0xa8, script: 0x5, flags: 0x0}, + 1252: {region: 0x165, script: 0x57, flags: 0x0}, + 1253: {region: 0x114, script: 0x57, flags: 0x0}, + 1254: {region: 0x165, script: 0x57, flags: 0x0}, + 1255: {region: 0x165, script: 0x57, flags: 0x0}, + 1256: {region: 0x165, script: 0x57, flags: 0x0}, + 1257: {region: 0x165, script: 0x57, flags: 0x0}, + 1258: {region: 0x99, script: 0x21, flags: 0x0}, + 1259: {region: 0x53, script: 0x38, flags: 0x0}, + 1260: {region: 0x165, script: 0x57, flags: 0x0}, + 1261: {region: 0x165, script: 0x57, flags: 0x0}, + 1262: {region: 0x41, script: 0x57, flags: 0x0}, + 1263: {region: 0x165, script: 0x57, flags: 0x0}, + 1264: {region: 0x12b, script: 0x18, flags: 0x0}, + 1265: {region: 0x165, script: 0x57, flags: 0x0}, + 1266: {region: 0x161, script: 0x57, flags: 0x0}, + 1267: {region: 0x165, script: 0x57, flags: 0x0}, + 1268: {region: 0x12b, script: 0x5f, flags: 0x0}, + 1269: {region: 0x12b, script: 0x60, flags: 0x0}, + 1270: {region: 0x7d, script: 0x2b, flags: 0x0}, + 1271: {region: 0x53, script: 0x64, flags: 0x0}, + 1272: {region: 0x10b, script: 0x69, flags: 0x0}, + 1273: {region: 0x108, script: 0x73, flags: 0x0}, + 1274: {region: 0x99, script: 0x21, flags: 0x0}, + 1275: {region: 0x131, script: 0x57, flags: 0x0}, + 1276: {region: 0x165, script: 0x57, flags: 0x0}, + 1277: {region: 0x9c, script: 0x8a, flags: 0x0}, + 1278: {region: 0x165, script: 0x57, flags: 0x0}, + 1279: {region: 0x15e, script: 0xc2, flags: 0x0}, + 1280: {region: 0x165, script: 0x57, flags: 0x0}, + 1281: {region: 0x165, script: 0x57, flags: 0x0}, + 1282: {region: 0xdb, script: 0x21, flags: 0x0}, + 1283: {region: 0x165, script: 0x57, flags: 0x0}, + 1284: {region: 0x165, script: 0x57, flags: 0x0}, + 1285: {region: 0xd1, script: 0x57, flags: 0x0}, + 1286: {region: 0x75, script: 0x57, flags: 0x0}, + 1287: {region: 0x165, script: 0x57, flags: 0x0}, + 1288: {region: 0x165, script: 0x57, flags: 0x0}, + 1289: {region: 0x52, script: 0x57, flags: 0x0}, + 1290: {region: 0x165, script: 0x57, flags: 0x0}, + 1291: {region: 0x165, script: 0x57, flags: 0x0}, + 1292: {region: 0x165, script: 0x57, flags: 0x0}, + 1293: {region: 0x52, script: 0x57, flags: 0x0}, + 1294: {region: 0x165, script: 0x57, flags: 0x0}, + 1295: {region: 0x165, script: 0x57, flags: 0x0}, + 1296: {region: 0x165, script: 0x57, flags: 0x0}, + 1297: {region: 0x165, script: 0x57, flags: 0x0}, + 1298: {region: 0x1, script: 0x3b, flags: 0x0}, + 1299: {region: 0x165, script: 0x57, flags: 0x0}, + 1300: {region: 0x165, script: 0x57, flags: 0x0}, + 1301: {region: 0x165, script: 0x57, flags: 0x0}, + 1302: {region: 0x165, script: 0x57, flags: 0x0}, + 1303: {region: 0x165, script: 0x57, flags: 0x0}, + 1304: {region: 0xd6, script: 0x57, flags: 0x0}, + 1305: {region: 0x165, script: 0x57, flags: 0x0}, + 1306: {region: 0x165, script: 0x57, flags: 0x0}, + 1307: {region: 0x165, script: 0x57, flags: 0x0}, + 1308: {region: 0x41, script: 0x57, flags: 0x0}, + 1309: {region: 0x165, script: 0x57, flags: 0x0}, + 1310: {region: 0xcf, script: 0x57, flags: 0x0}, + 1311: {region: 0x4a, script: 0x3, flags: 0x1}, + 1312: {region: 0x165, script: 0x57, flags: 0x0}, + 1313: {region: 0x165, script: 0x57, flags: 0x0}, + 1314: {region: 0x165, script: 0x57, flags: 0x0}, + 1315: {region: 0x53, script: 0x57, flags: 0x0}, + 1316: {region: 0x10b, script: 0x57, flags: 0x0}, + 1318: {region: 0xa8, script: 0x5, flags: 0x0}, + 1319: {region: 0xd9, script: 0x57, flags: 0x0}, + 1320: {region: 0xba, script: 0xdc, flags: 0x0}, + 1321: {region: 0x4d, script: 0x14, flags: 0x1}, + 1322: {region: 0x53, script: 0x79, flags: 0x0}, + 1323: {region: 0x165, script: 0x57, flags: 0x0}, + 1324: {region: 0x122, script: 0x57, flags: 0x0}, + 1325: {region: 0xd0, script: 0x57, flags: 0x0}, + 1326: {region: 0x165, script: 0x57, flags: 0x0}, + 1327: {region: 0x161, script: 0x57, flags: 0x0}, + 1329: {region: 0x12b, script: 0x57, flags: 0x0}, +} + +// likelyLangList holds lists info associated with likelyLang. +// Size: 388 bytes, 97 elements +var likelyLangList = [97]likelyScriptRegion{ + 0: {region: 0x9c, script: 0x7, flags: 0x0}, + 1: {region: 0xa1, script: 0x74, flags: 0x2}, + 2: {region: 0x11c, script: 0x80, flags: 0x2}, + 3: {region: 0x32, script: 0x57, flags: 0x0}, + 4: {region: 0x9b, script: 0x5, flags: 0x4}, + 5: {region: 0x9c, script: 0x5, flags: 0x4}, + 6: {region: 0x106, script: 0x1f, flags: 0x4}, + 7: {region: 0x9c, script: 0x5, flags: 0x2}, + 8: {region: 0x106, script: 0x1f, flags: 0x0}, + 9: {region: 0x38, script: 0x2c, flags: 0x2}, + 10: {region: 0x135, script: 0x57, flags: 0x0}, + 11: {region: 0x7b, script: 0xc5, flags: 0x2}, + 12: {region: 0x114, script: 0x57, flags: 0x0}, + 13: {region: 0x84, script: 0x1, flags: 0x2}, + 14: {region: 0x5d, script: 0x1e, flags: 0x0}, + 15: {region: 0x87, script: 0x5c, flags: 0x2}, + 16: {region: 0xd6, script: 0x57, flags: 0x0}, + 17: {region: 0x52, script: 0x5, flags: 0x4}, + 18: {region: 0x10b, script: 0x5, flags: 0x4}, + 19: {region: 0xae, script: 0x1f, flags: 0x0}, + 20: {region: 0x24, script: 0x5, flags: 0x4}, + 21: {region: 0x53, script: 0x5, flags: 0x4}, + 22: {region: 0x9c, script: 0x5, flags: 0x4}, + 23: {region: 0xc5, script: 0x5, flags: 0x4}, + 24: {region: 0x53, script: 0x5, flags: 0x2}, + 25: {region: 0x12b, script: 0x57, flags: 0x0}, + 26: {region: 0xb0, script: 0x5, flags: 0x4}, + 27: {region: 0x9b, script: 0x5, flags: 0x2}, + 28: {region: 0xa5, script: 0x1f, flags: 0x0}, + 29: {region: 0x53, script: 0x5, flags: 0x4}, + 30: {region: 0x12b, script: 0x57, flags: 0x4}, + 31: {region: 0x53, script: 0x5, flags: 0x2}, + 32: {region: 0x12b, script: 0x57, flags: 0x2}, + 33: {region: 0xdb, script: 0x21, flags: 0x0}, + 34: {region: 0x99, script: 0x5a, flags: 0x2}, + 35: {region: 0x83, script: 0x57, flags: 0x0}, + 36: {region: 0x84, script: 0x78, flags: 0x4}, + 37: {region: 0x84, script: 0x78, flags: 0x2}, + 38: {region: 0xc5, script: 0x1f, flags: 0x0}, + 39: {region: 0x53, script: 0x6d, flags: 0x4}, + 40: {region: 0x53, script: 0x6d, flags: 0x2}, + 41: {region: 0xd0, script: 0x57, flags: 0x0}, + 42: {region: 0x4a, script: 0x5, flags: 0x4}, + 43: {region: 0x95, script: 0x5, flags: 0x4}, + 44: {region: 0x99, script: 0x33, flags: 0x0}, + 45: {region: 0xe8, script: 0x5, flags: 0x4}, + 46: {region: 0xe8, script: 0x5, flags: 0x2}, + 47: {region: 0x9c, script: 0x84, flags: 0x0}, + 48: {region: 0x53, script: 0x85, flags: 0x2}, + 49: {region: 0xba, script: 0xdc, flags: 0x0}, + 50: {region: 0xd9, script: 0x57, flags: 0x4}, + 51: {region: 0xe8, script: 0x5, flags: 0x0}, + 52: {region: 0x99, script: 0x21, flags: 0x2}, + 53: {region: 0x99, script: 0x4c, flags: 0x2}, + 54: {region: 0x99, script: 0xc9, flags: 0x2}, + 55: {region: 0x105, script: 0x1f, flags: 0x0}, + 56: {region: 0xbd, script: 0x57, flags: 0x4}, + 57: {region: 0x104, script: 0x57, flags: 0x4}, + 58: {region: 0x106, script: 0x57, flags: 0x4}, + 59: {region: 0x12b, script: 0x57, flags: 0x4}, + 60: {region: 0x124, script: 0x1f, flags: 0x0}, + 61: {region: 0xe8, script: 0x5, flags: 0x4}, + 62: {region: 0xe8, script: 0x5, flags: 0x2}, + 63: {region: 0x53, script: 0x5, flags: 0x0}, + 64: {region: 0xae, script: 0x1f, flags: 0x4}, + 65: {region: 0xc5, script: 0x1f, flags: 0x4}, + 66: {region: 0xae, script: 0x1f, flags: 0x2}, + 67: {region: 0x99, script: 0xe, flags: 0x0}, + 68: {region: 0xdb, script: 0x21, flags: 0x4}, + 69: {region: 0xdb, script: 0x21, flags: 0x2}, + 70: {region: 0x137, script: 0x57, flags: 0x0}, + 71: {region: 0x24, script: 0x5, flags: 0x4}, + 72: {region: 0x53, script: 0x1f, flags: 0x4}, + 73: {region: 0x24, script: 0x5, flags: 0x2}, + 74: {region: 0x8d, script: 0x39, flags: 0x0}, + 75: {region: 0x53, script: 0x38, flags: 0x4}, + 76: {region: 0x53, script: 0x38, flags: 0x2}, + 77: {region: 0x53, script: 0x38, flags: 0x0}, + 78: {region: 0x2f, script: 0x39, flags: 0x4}, + 79: {region: 0x3e, script: 0x39, flags: 0x4}, + 80: {region: 0x7b, script: 0x39, flags: 0x4}, + 81: {region: 0x7e, script: 0x39, flags: 0x4}, + 82: {region: 0x8d, script: 0x39, flags: 0x4}, + 83: {region: 0x95, script: 0x39, flags: 0x4}, + 84: {region: 0xc6, script: 0x39, flags: 0x4}, + 85: {region: 0xd0, script: 0x39, flags: 0x4}, + 86: {region: 0xe2, script: 0x39, flags: 0x4}, + 87: {region: 0xe5, script: 0x39, flags: 0x4}, + 88: {region: 0xe7, script: 0x39, flags: 0x4}, + 89: {region: 0x116, script: 0x39, flags: 0x4}, + 90: {region: 0x123, script: 0x39, flags: 0x4}, + 91: {region: 0x12e, script: 0x39, flags: 0x4}, + 92: {region: 0x135, script: 0x39, flags: 0x4}, + 93: {region: 0x13e, script: 0x39, flags: 0x4}, + 94: {region: 0x12e, script: 0x11, flags: 0x2}, + 95: {region: 0x12e, script: 0x34, flags: 0x2}, + 96: {region: 0x12e, script: 0x39, flags: 0x2}, +} + +type likelyLangScript struct { + lang uint16 + script uint8 + flags uint8 +} + +// likelyRegion is a lookup table, indexed by regionID, for the most likely +// languages and scripts given incomplete information. If more entries exist +// for a given regionID, lang and script are the index and size respectively +// of the list in likelyRegionList. +// TODO: exclude containers and user-definable regions from the list. +// Size: 1432 bytes, 358 elements +var likelyRegion = [358]likelyLangScript{ + 34: {lang: 0xd7, script: 0x57, flags: 0x0}, + 35: {lang: 0x3a, script: 0x5, flags: 0x0}, + 36: {lang: 0x0, script: 0x2, flags: 0x1}, + 39: {lang: 0x2, script: 0x2, flags: 0x1}, + 40: {lang: 0x4, script: 0x2, flags: 0x1}, + 42: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 43: {lang: 0x0, script: 0x57, flags: 0x0}, + 44: {lang: 0x13e, script: 0x57, flags: 0x0}, + 45: {lang: 0x41b, script: 0x57, flags: 0x0}, + 46: {lang: 0x10d, script: 0x57, flags: 0x0}, + 48: {lang: 0x367, script: 0x57, flags: 0x0}, + 49: {lang: 0x444, script: 0x57, flags: 0x0}, + 50: {lang: 0x58, script: 0x57, flags: 0x0}, + 51: {lang: 0x6, script: 0x2, flags: 0x1}, + 53: {lang: 0xa5, script: 0xe, flags: 0x0}, + 54: {lang: 0x367, script: 0x57, flags: 0x0}, + 55: {lang: 0x15e, script: 0x57, flags: 0x0}, + 56: {lang: 0x7e, script: 0x1f, flags: 0x0}, + 57: {lang: 0x3a, script: 0x5, flags: 0x0}, + 58: {lang: 0x3d9, script: 0x57, flags: 0x0}, + 59: {lang: 0x15e, script: 0x57, flags: 0x0}, + 60: {lang: 0x15e, script: 0x57, flags: 0x0}, + 62: {lang: 0x31f, script: 0x57, flags: 0x0}, + 63: {lang: 0x13e, script: 0x57, flags: 0x0}, + 64: {lang: 0x3a1, script: 0x57, flags: 0x0}, + 65: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 67: {lang: 0x8, script: 0x2, flags: 0x1}, + 69: {lang: 0x0, script: 0x57, flags: 0x0}, + 71: {lang: 0x71, script: 0x1f, flags: 0x0}, + 73: {lang: 0x512, script: 0x3b, flags: 0x2}, + 74: {lang: 0x31f, script: 0x5, flags: 0x2}, + 75: {lang: 0x445, script: 0x57, flags: 0x0}, + 76: {lang: 0x15e, script: 0x57, flags: 0x0}, + 77: {lang: 0x15e, script: 0x57, flags: 0x0}, + 78: {lang: 0x10d, script: 0x57, flags: 0x0}, + 79: {lang: 0x15e, script: 0x57, flags: 0x0}, + 81: {lang: 0x13e, script: 0x57, flags: 0x0}, + 82: {lang: 0x15e, script: 0x57, flags: 0x0}, + 83: {lang: 0xa, script: 0x4, flags: 0x1}, + 84: {lang: 0x13e, script: 0x57, flags: 0x0}, + 85: {lang: 0x0, script: 0x57, flags: 0x0}, + 86: {lang: 0x13e, script: 0x57, flags: 0x0}, + 89: {lang: 0x13e, script: 0x57, flags: 0x0}, + 90: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 91: {lang: 0x3a1, script: 0x57, flags: 0x0}, + 93: {lang: 0xe, script: 0x2, flags: 0x1}, + 94: {lang: 0xfa, script: 0x57, flags: 0x0}, + 96: {lang: 0x10d, script: 0x57, flags: 0x0}, + 98: {lang: 0x1, script: 0x57, flags: 0x0}, + 99: {lang: 0x101, script: 0x57, flags: 0x0}, + 101: {lang: 0x13e, script: 0x57, flags: 0x0}, + 103: {lang: 0x10, script: 0x2, flags: 0x1}, + 104: {lang: 0x13e, script: 0x57, flags: 0x0}, + 105: {lang: 0x13e, script: 0x57, flags: 0x0}, + 106: {lang: 0x140, script: 0x57, flags: 0x0}, + 107: {lang: 0x3a, script: 0x5, flags: 0x0}, + 108: {lang: 0x3a, script: 0x5, flags: 0x0}, + 109: {lang: 0x46f, script: 0x29, flags: 0x0}, + 110: {lang: 0x13e, script: 0x57, flags: 0x0}, + 111: {lang: 0x12, script: 0x2, flags: 0x1}, + 113: {lang: 0x10d, script: 0x57, flags: 0x0}, + 114: {lang: 0x151, script: 0x57, flags: 0x0}, + 115: {lang: 0x1c0, script: 0x21, flags: 0x2}, + 118: {lang: 0x158, script: 0x57, flags: 0x0}, + 120: {lang: 0x15e, script: 0x57, flags: 0x0}, + 122: {lang: 0x15e, script: 0x57, flags: 0x0}, + 123: {lang: 0x14, script: 0x2, flags: 0x1}, + 125: {lang: 0x16, script: 0x3, flags: 0x1}, + 126: {lang: 0x15e, script: 0x57, flags: 0x0}, + 128: {lang: 0x21, script: 0x57, flags: 0x0}, + 130: {lang: 0x245, script: 0x57, flags: 0x0}, + 132: {lang: 0x15e, script: 0x57, flags: 0x0}, + 133: {lang: 0x15e, script: 0x57, flags: 0x0}, + 134: {lang: 0x13e, script: 0x57, flags: 0x0}, + 135: {lang: 0x19, script: 0x2, flags: 0x1}, + 136: {lang: 0x0, script: 0x57, flags: 0x0}, + 137: {lang: 0x13e, script: 0x57, flags: 0x0}, + 139: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 141: {lang: 0x529, script: 0x39, flags: 0x0}, + 142: {lang: 0x0, script: 0x57, flags: 0x0}, + 143: {lang: 0x13e, script: 0x57, flags: 0x0}, + 144: {lang: 0x1d1, script: 0x57, flags: 0x0}, + 145: {lang: 0x1d4, script: 0x57, flags: 0x0}, + 146: {lang: 0x1d5, script: 0x57, flags: 0x0}, + 148: {lang: 0x13e, script: 0x57, flags: 0x0}, + 149: {lang: 0x1b, script: 0x2, flags: 0x1}, + 151: {lang: 0x1bc, script: 0x3b, flags: 0x0}, + 153: {lang: 0x1d, script: 0x3, flags: 0x1}, + 155: {lang: 0x3a, script: 0x5, flags: 0x0}, + 156: {lang: 0x20, script: 0x2, flags: 0x1}, + 157: {lang: 0x1f8, script: 0x57, flags: 0x0}, + 158: {lang: 0x1f9, script: 0x57, flags: 0x0}, + 161: {lang: 0x3a, script: 0x5, flags: 0x0}, + 162: {lang: 0x200, script: 0x46, flags: 0x0}, + 164: {lang: 0x445, script: 0x57, flags: 0x0}, + 165: {lang: 0x28a, script: 0x1f, flags: 0x0}, + 166: {lang: 0x22, script: 0x3, flags: 0x1}, + 168: {lang: 0x25, script: 0x2, flags: 0x1}, + 170: {lang: 0x254, script: 0x50, flags: 0x0}, + 171: {lang: 0x254, script: 0x50, flags: 0x0}, + 172: {lang: 0x3a, script: 0x5, flags: 0x0}, + 174: {lang: 0x3e2, script: 0x1f, flags: 0x0}, + 175: {lang: 0x27, script: 0x2, flags: 0x1}, + 176: {lang: 0x3a, script: 0x5, flags: 0x0}, + 178: {lang: 0x10d, script: 0x57, flags: 0x0}, + 179: {lang: 0x40c, script: 0xca, flags: 0x0}, + 181: {lang: 0x43b, script: 0x57, flags: 0x0}, + 182: {lang: 0x2c0, script: 0x57, flags: 0x0}, + 183: {lang: 0x15e, script: 0x57, flags: 0x0}, + 184: {lang: 0x2c7, script: 0x57, flags: 0x0}, + 185: {lang: 0x3a, script: 0x5, flags: 0x0}, + 186: {lang: 0x29, script: 0x2, flags: 0x1}, + 187: {lang: 0x15e, script: 0x57, flags: 0x0}, + 188: {lang: 0x2b, script: 0x2, flags: 0x1}, + 189: {lang: 0x432, script: 0x57, flags: 0x0}, + 190: {lang: 0x15e, script: 0x57, flags: 0x0}, + 191: {lang: 0x2f1, script: 0x57, flags: 0x0}, + 194: {lang: 0x2d, script: 0x2, flags: 0x1}, + 195: {lang: 0xa0, script: 0x57, flags: 0x0}, + 196: {lang: 0x2f, script: 0x2, flags: 0x1}, + 197: {lang: 0x31, script: 0x2, flags: 0x1}, + 198: {lang: 0x33, script: 0x2, flags: 0x1}, + 200: {lang: 0x15e, script: 0x57, flags: 0x0}, + 201: {lang: 0x35, script: 0x2, flags: 0x1}, + 203: {lang: 0x320, script: 0x57, flags: 0x0}, + 204: {lang: 0x37, script: 0x3, flags: 0x1}, + 205: {lang: 0x128, script: 0xde, flags: 0x0}, + 207: {lang: 0x13e, script: 0x57, flags: 0x0}, + 208: {lang: 0x31f, script: 0x57, flags: 0x0}, + 209: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 210: {lang: 0x16, script: 0x57, flags: 0x0}, + 211: {lang: 0x15e, script: 0x57, flags: 0x0}, + 212: {lang: 0x1b4, script: 0x57, flags: 0x0}, + 214: {lang: 0x1b4, script: 0x5, flags: 0x2}, + 216: {lang: 0x13e, script: 0x57, flags: 0x0}, + 217: {lang: 0x367, script: 0x57, flags: 0x0}, + 218: {lang: 0x347, script: 0x57, flags: 0x0}, + 219: {lang: 0x351, script: 0x21, flags: 0x0}, + 225: {lang: 0x3a, script: 0x5, flags: 0x0}, + 226: {lang: 0x13e, script: 0x57, flags: 0x0}, + 228: {lang: 0x13e, script: 0x57, flags: 0x0}, + 229: {lang: 0x15e, script: 0x57, flags: 0x0}, + 230: {lang: 0x486, script: 0x57, flags: 0x0}, + 231: {lang: 0x153, script: 0x57, flags: 0x0}, + 232: {lang: 0x3a, script: 0x3, flags: 0x1}, + 233: {lang: 0x3b3, script: 0x57, flags: 0x0}, + 234: {lang: 0x15e, script: 0x57, flags: 0x0}, + 236: {lang: 0x13e, script: 0x57, flags: 0x0}, + 237: {lang: 0x3a, script: 0x5, flags: 0x0}, + 238: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 240: {lang: 0x3a2, script: 0x57, flags: 0x0}, + 241: {lang: 0x194, script: 0x57, flags: 0x0}, + 243: {lang: 0x3a, script: 0x5, flags: 0x0}, + 258: {lang: 0x15e, script: 0x57, flags: 0x0}, + 260: {lang: 0x3d, script: 0x2, flags: 0x1}, + 261: {lang: 0x432, script: 0x1f, flags: 0x0}, + 262: {lang: 0x3f, script: 0x2, flags: 0x1}, + 263: {lang: 0x3e5, script: 0x57, flags: 0x0}, + 264: {lang: 0x3a, script: 0x5, flags: 0x0}, + 266: {lang: 0x15e, script: 0x57, flags: 0x0}, + 267: {lang: 0x3a, script: 0x5, flags: 0x0}, + 268: {lang: 0x41, script: 0x2, flags: 0x1}, + 271: {lang: 0x416, script: 0x57, flags: 0x0}, + 272: {lang: 0x347, script: 0x57, flags: 0x0}, + 273: {lang: 0x43, script: 0x2, flags: 0x1}, + 275: {lang: 0x1f9, script: 0x57, flags: 0x0}, + 276: {lang: 0x15e, script: 0x57, flags: 0x0}, + 277: {lang: 0x429, script: 0x57, flags: 0x0}, + 278: {lang: 0x367, script: 0x57, flags: 0x0}, + 280: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 282: {lang: 0x13e, script: 0x57, flags: 0x0}, + 284: {lang: 0x45, script: 0x2, flags: 0x1}, + 288: {lang: 0x15e, script: 0x57, flags: 0x0}, + 289: {lang: 0x15e, script: 0x57, flags: 0x0}, + 290: {lang: 0x47, script: 0x2, flags: 0x1}, + 291: {lang: 0x49, script: 0x3, flags: 0x1}, + 292: {lang: 0x4c, script: 0x2, flags: 0x1}, + 293: {lang: 0x477, script: 0x57, flags: 0x0}, + 294: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 295: {lang: 0x476, script: 0x57, flags: 0x0}, + 296: {lang: 0x4e, script: 0x2, flags: 0x1}, + 297: {lang: 0x482, script: 0x57, flags: 0x0}, + 299: {lang: 0x50, script: 0x4, flags: 0x1}, + 301: {lang: 0x4a0, script: 0x57, flags: 0x0}, + 302: {lang: 0x54, script: 0x2, flags: 0x1}, + 303: {lang: 0x445, script: 0x57, flags: 0x0}, + 304: {lang: 0x56, script: 0x3, flags: 0x1}, + 305: {lang: 0x445, script: 0x57, flags: 0x0}, + 309: {lang: 0x512, script: 0x3b, flags: 0x2}, + 310: {lang: 0x13e, script: 0x57, flags: 0x0}, + 311: {lang: 0x4bc, script: 0x57, flags: 0x0}, + 312: {lang: 0x1f9, script: 0x57, flags: 0x0}, + 315: {lang: 0x13e, script: 0x57, flags: 0x0}, + 318: {lang: 0x4c3, script: 0x57, flags: 0x0}, + 319: {lang: 0x8a, script: 0x57, flags: 0x0}, + 320: {lang: 0x15e, script: 0x57, flags: 0x0}, + 322: {lang: 0x41b, script: 0x57, flags: 0x0}, + 333: {lang: 0x59, script: 0x2, flags: 0x1}, + 350: {lang: 0x3a, script: 0x5, flags: 0x0}, + 351: {lang: 0x5b, script: 0x2, flags: 0x1}, + 356: {lang: 0x423, script: 0x57, flags: 0x0}, +} + +// likelyRegionList holds lists info associated with likelyRegion. +// Size: 372 bytes, 93 elements +var likelyRegionList = [93]likelyLangScript{ + 0: {lang: 0x148, script: 0x5, flags: 0x0}, + 1: {lang: 0x476, script: 0x57, flags: 0x0}, + 2: {lang: 0x431, script: 0x57, flags: 0x0}, + 3: {lang: 0x2ff, script: 0x1f, flags: 0x0}, + 4: {lang: 0x1d7, script: 0x8, flags: 0x0}, + 5: {lang: 0x274, script: 0x57, flags: 0x0}, + 6: {lang: 0xb7, script: 0x57, flags: 0x0}, + 7: {lang: 0x432, script: 0x1f, flags: 0x0}, + 8: {lang: 0x12d, script: 0xe0, flags: 0x0}, + 9: {lang: 0x351, script: 0x21, flags: 0x0}, + 10: {lang: 0x529, script: 0x38, flags: 0x0}, + 11: {lang: 0x4ac, script: 0x5, flags: 0x0}, + 12: {lang: 0x523, script: 0x57, flags: 0x0}, + 13: {lang: 0x29a, script: 0xdf, flags: 0x0}, + 14: {lang: 0x136, script: 0x31, flags: 0x0}, + 15: {lang: 0x48a, script: 0x57, flags: 0x0}, + 16: {lang: 0x3a, script: 0x5, flags: 0x0}, + 17: {lang: 0x15e, script: 0x57, flags: 0x0}, + 18: {lang: 0x27, script: 0x29, flags: 0x0}, + 19: {lang: 0x139, script: 0x57, flags: 0x0}, + 20: {lang: 0x26a, script: 0x5, flags: 0x2}, + 21: {lang: 0x512, script: 0x3b, flags: 0x2}, + 22: {lang: 0x210, script: 0x2b, flags: 0x0}, + 23: {lang: 0x5, script: 0x1f, flags: 0x0}, + 24: {lang: 0x274, script: 0x57, flags: 0x0}, + 25: {lang: 0x136, script: 0x31, flags: 0x0}, + 26: {lang: 0x2ff, script: 0x1f, flags: 0x0}, + 27: {lang: 0x1e1, script: 0x57, flags: 0x0}, + 28: {lang: 0x31f, script: 0x5, flags: 0x0}, + 29: {lang: 0x1be, script: 0x21, flags: 0x0}, + 30: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 31: {lang: 0x236, script: 0x72, flags: 0x0}, + 32: {lang: 0x148, script: 0x5, flags: 0x0}, + 33: {lang: 0x476, script: 0x57, flags: 0x0}, + 34: {lang: 0x24a, script: 0x4b, flags: 0x0}, + 35: {lang: 0xe6, script: 0x5, flags: 0x0}, + 36: {lang: 0x226, script: 0xdf, flags: 0x0}, + 37: {lang: 0x3a, script: 0x5, flags: 0x0}, + 38: {lang: 0x15e, script: 0x57, flags: 0x0}, + 39: {lang: 0x2b8, script: 0x54, flags: 0x0}, + 40: {lang: 0x226, script: 0xdf, flags: 0x0}, + 41: {lang: 0x3a, script: 0x5, flags: 0x0}, + 42: {lang: 0x15e, script: 0x57, flags: 0x0}, + 43: {lang: 0x3dc, script: 0x57, flags: 0x0}, + 44: {lang: 0x4ae, script: 0x1f, flags: 0x0}, + 45: {lang: 0x2ff, script: 0x1f, flags: 0x0}, + 46: {lang: 0x431, script: 0x57, flags: 0x0}, + 47: {lang: 0x331, script: 0x72, flags: 0x0}, + 48: {lang: 0x213, script: 0x57, flags: 0x0}, + 49: {lang: 0x30b, script: 0x1f, flags: 0x0}, + 50: {lang: 0x242, script: 0x5, flags: 0x0}, + 51: {lang: 0x529, script: 0x39, flags: 0x0}, + 52: {lang: 0x3c0, script: 0x57, flags: 0x0}, + 53: {lang: 0x3a, script: 0x5, flags: 0x0}, + 54: {lang: 0x15e, script: 0x57, flags: 0x0}, + 55: {lang: 0x2ed, script: 0x57, flags: 0x0}, + 56: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 57: {lang: 0x88, script: 0x21, flags: 0x0}, + 58: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 59: {lang: 0x4b4, script: 0x5, flags: 0x0}, + 60: {lang: 0xbe, script: 0x21, flags: 0x0}, + 61: {lang: 0x3dc, script: 0x57, flags: 0x0}, + 62: {lang: 0x7e, script: 0x1f, flags: 0x0}, + 63: {lang: 0x3e2, script: 0x1f, flags: 0x0}, + 64: {lang: 0x267, script: 0x57, flags: 0x0}, + 65: {lang: 0x444, script: 0x57, flags: 0x0}, + 66: {lang: 0x512, script: 0x3b, flags: 0x0}, + 67: {lang: 0x412, script: 0x57, flags: 0x0}, + 68: {lang: 0x4ae, script: 0x1f, flags: 0x0}, + 69: {lang: 0x3a, script: 0x5, flags: 0x0}, + 70: {lang: 0x15e, script: 0x57, flags: 0x0}, + 71: {lang: 0x15e, script: 0x57, flags: 0x0}, + 72: {lang: 0x35, script: 0x5, flags: 0x0}, + 73: {lang: 0x46b, script: 0xdf, flags: 0x0}, + 74: {lang: 0x2ec, script: 0x5, flags: 0x0}, + 75: {lang: 0x30f, script: 0x72, flags: 0x0}, + 76: {lang: 0x467, script: 0x1f, flags: 0x0}, + 77: {lang: 0x148, script: 0x5, flags: 0x0}, + 78: {lang: 0x3a, script: 0x5, flags: 0x0}, + 79: {lang: 0x15e, script: 0x57, flags: 0x0}, + 80: {lang: 0x48a, script: 0x57, flags: 0x0}, + 81: {lang: 0x58, script: 0x5, flags: 0x0}, + 82: {lang: 0x219, script: 0x1f, flags: 0x0}, + 83: {lang: 0x81, script: 0x31, flags: 0x0}, + 84: {lang: 0x529, script: 0x39, flags: 0x0}, + 85: {lang: 0x48c, script: 0x57, flags: 0x0}, + 86: {lang: 0x4ae, script: 0x1f, flags: 0x0}, + 87: {lang: 0x512, script: 0x3b, flags: 0x0}, + 88: {lang: 0x3b3, script: 0x57, flags: 0x0}, + 89: {lang: 0x431, script: 0x57, flags: 0x0}, + 90: {lang: 0x432, script: 0x1f, flags: 0x0}, + 91: {lang: 0x15e, script: 0x57, flags: 0x0}, + 92: {lang: 0x446, script: 0x5, flags: 0x0}, +} + +type likelyTag struct { + lang uint16 + region uint16 + script uint8 +} + +// Size: 198 bytes, 33 elements +var likelyRegionGroup = [33]likelyTag{ + 1: {lang: 0x139, region: 0xd6, script: 0x57}, + 2: {lang: 0x139, region: 0x135, script: 0x57}, + 3: {lang: 0x3c0, region: 0x41, script: 0x57}, + 4: {lang: 0x139, region: 0x2f, script: 0x57}, + 5: {lang: 0x139, region: 0xd6, script: 0x57}, + 6: {lang: 0x13e, region: 0xcf, script: 0x57}, + 7: {lang: 0x445, region: 0x12f, script: 0x57}, + 8: {lang: 0x3a, region: 0x6b, script: 0x5}, + 9: {lang: 0x445, region: 0x4b, script: 0x57}, + 10: {lang: 0x139, region: 0x161, script: 0x57}, + 11: {lang: 0x139, region: 0x135, script: 0x57}, + 12: {lang: 0x139, region: 0x135, script: 0x57}, + 13: {lang: 0x13e, region: 0x59, script: 0x57}, + 14: {lang: 0x529, region: 0x53, script: 0x38}, + 15: {lang: 0x1be, region: 0x99, script: 0x21}, + 16: {lang: 0x1e1, region: 0x95, script: 0x57}, + 17: {lang: 0x1f9, region: 0x9e, script: 0x57}, + 18: {lang: 0x139, region: 0x2f, script: 0x57}, + 19: {lang: 0x139, region: 0xe6, script: 0x57}, + 20: {lang: 0x139, region: 0x8a, script: 0x57}, + 21: {lang: 0x41b, region: 0x142, script: 0x57}, + 22: {lang: 0x529, region: 0x53, script: 0x38}, + 23: {lang: 0x4bc, region: 0x137, script: 0x57}, + 24: {lang: 0x3a, region: 0x108, script: 0x5}, + 25: {lang: 0x3e2, region: 0x106, script: 0x1f}, + 26: {lang: 0x3e2, region: 0x106, script: 0x1f}, + 27: {lang: 0x139, region: 0x7b, script: 0x57}, + 28: {lang: 0x10d, region: 0x60, script: 0x57}, + 29: {lang: 0x139, region: 0xd6, script: 0x57}, + 30: {lang: 0x13e, region: 0x1f, script: 0x57}, + 31: {lang: 0x139, region: 0x9a, script: 0x57}, + 32: {lang: 0x139, region: 0x7b, script: 0x57}, +} + +// Size: 358 bytes, 358 elements +var regionToGroups = [358]uint8{ // Entry 0 - 3F 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, @@ -98,14 +3343,15 @@ var regionToGroups = []uint8{ // 357 elements 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, -} // Size: 381 bytes + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +} -var paradigmLocales = [][3]uint16{ // 3 elements +// Size: 18 bytes, 3 elements +var paradigmLocales = [3][3]uint16{ 0: [3]uint16{0x139, 0x0, 0x7b}, 1: [3]uint16{0x13e, 0x0, 0x1f}, 2: [3]uint16{0x3c0, 0x41, 0xee}, -} // Size: 42 bytes +} type mutualIntelligibility struct { want uint16 @@ -113,6 +3359,7 @@ type mutualIntelligibility struct { distance uint8 oneway bool } + type scriptIntelligibility struct { wantLang uint16 haveLang uint16 @@ -120,6 +3367,7 @@ type scriptIntelligibility struct { haveScript uint8 distance uint8 } + type regionIntelligibility struct { lang uint16 script uint8 @@ -130,7 +3378,8 @@ type regionIntelligibility struct { // matchLang holds pairs of langIDs of base languages that are typically // mutually intelligible. Each pair is associated with a confidence and // whether the intelligibility goes one or both ways. -var matchLang = []mutualIntelligibility{ // 113 elements +// Size: 678 bytes, 113 elements +var matchLang = [113]mutualIntelligibility{ 0: {want: 0x1d1, have: 0xb7, distance: 0x4, oneway: false}, 1: {want: 0x407, have: 0xb7, distance: 0x4, oneway: false}, 2: {want: 0x407, have: 0x1d1, distance: 0x4, oneway: false}, @@ -244,11 +3493,12 @@ var matchLang = []mutualIntelligibility{ // 113 elements 110: {want: 0x512, have: 0x139, distance: 0xa, oneway: true}, 111: {want: 0x518, have: 0x139, distance: 0xa, oneway: true}, 112: {want: 0x52f, have: 0x139, distance: 0xa, oneway: true}, -} // Size: 702 bytes +} // matchScript holds pairs of scriptIDs where readers of one script // can typically also read the other. Each is associated with a confidence. -var matchScript = []scriptIntelligibility{ // 26 elements +// Size: 208 bytes, 26 elements +var matchScript = [26]scriptIntelligibility{ 0: {wantLang: 0x432, haveLang: 0x432, wantScript: 0x57, haveScript: 0x1f, distance: 0x5}, 1: {wantLang: 0x432, haveLang: 0x432, wantScript: 0x1f, haveScript: 0x57, distance: 0x5}, 2: {wantLang: 0x58, haveLang: 0x3e2, wantScript: 0x57, haveScript: 0x1f, distance: 0xa}, @@ -275,9 +3525,10 @@ var matchScript = []scriptIntelligibility{ // 26 elements 23: {wantLang: 0x512, haveLang: 0x139, wantScript: 0x3b, haveScript: 0x57, distance: 0xa}, 24: {wantLang: 0x529, haveLang: 0x529, wantScript: 0x38, haveScript: 0x39, distance: 0xf}, 25: {wantLang: 0x529, haveLang: 0x529, wantScript: 0x39, haveScript: 0x38, distance: 0x13}, -} // Size: 232 bytes +} -var matchRegion = []regionIntelligibility{ // 15 elements +// Size: 90 bytes, 15 elements +var matchRegion = [15]regionIntelligibility{ 0: {lang: 0x3a, script: 0x0, group: 0x4, distance: 0x4}, 1: {lang: 0x3a, script: 0x0, group: 0x84, distance: 0x4}, 2: {lang: 0x139, script: 0x0, group: 0x1, distance: 0x4}, @@ -293,6 +3544,143 @@ var matchRegion = []regionIntelligibility{ // 15 elements 12: {lang: 0x13e, script: 0x0, group: 0x80, distance: 0x5}, 13: {lang: 0x3c0, script: 0x0, group: 0x80, distance: 0x5}, 14: {lang: 0x529, script: 0x39, group: 0x80, distance: 0x5}, -} // Size: 114 bytes +} -// Total table size 1471 bytes (1KiB); checksum: 4CB1CD46 +// Size: 264 bytes, 33 elements +var regionContainment = [33]uint64{ + // Entry 0 - 1F + 0x00000001ffffffff, 0x00000000200007a2, 0x0000000000003044, 0x0000000000000008, + 0x00000000803c0010, 0x0000000000000020, 0x0000000000000040, 0x0000000000000080, + 0x0000000000000100, 0x0000000000000200, 0x0000000000000400, 0x000000004000384c, + 0x0000000000001000, 0x0000000000002000, 0x0000000000004000, 0x0000000000008000, + 0x0000000000010000, 0x0000000000020000, 0x0000000000040000, 0x0000000000080000, + 0x0000000000100000, 0x0000000000200000, 0x0000000001c1c000, 0x0000000000800000, + 0x0000000001000000, 0x000000001e020000, 0x0000000004000000, 0x0000000008000000, + 0x0000000010000000, 0x00000000200006a0, 0x0000000040002048, 0x0000000080000000, + // Entry 20 - 3F + 0x0000000100000000, +} + +// regionInclusion maps region identifiers to sets of regions in regionInclusionBits, +// where each set holds all groupings that are directly connected in a region +// containment graph. +// Size: 358 bytes, 358 elements +var regionInclusion = [358]uint8{ + // Entry 0 - 3F + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, + 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x23, + 0x24, 0x26, 0x27, 0x22, 0x28, 0x29, 0x2a, 0x2b, + 0x26, 0x2c, 0x24, 0x23, 0x26, 0x25, 0x2a, 0x2d, + 0x2e, 0x24, 0x2f, 0x2d, 0x26, 0x30, 0x31, 0x28, + // Entry 40 - 7F + 0x26, 0x28, 0x26, 0x25, 0x31, 0x22, 0x32, 0x33, + 0x34, 0x30, 0x22, 0x27, 0x27, 0x27, 0x35, 0x2d, + 0x29, 0x28, 0x27, 0x36, 0x28, 0x22, 0x34, 0x23, + 0x21, 0x26, 0x2d, 0x26, 0x22, 0x37, 0x2e, 0x35, + 0x2a, 0x22, 0x2f, 0x38, 0x26, 0x26, 0x21, 0x39, + 0x39, 0x28, 0x38, 0x39, 0x39, 0x2f, 0x3a, 0x2f, + 0x20, 0x21, 0x38, 0x3b, 0x28, 0x3c, 0x2c, 0x21, + 0x2a, 0x35, 0x27, 0x38, 0x26, 0x24, 0x28, 0x2c, + // Entry 80 - BF + 0x2d, 0x23, 0x30, 0x2d, 0x2d, 0x26, 0x27, 0x3a, + 0x22, 0x34, 0x3c, 0x2d, 0x28, 0x36, 0x22, 0x34, + 0x3a, 0x26, 0x2e, 0x21, 0x39, 0x31, 0x38, 0x24, + 0x2c, 0x25, 0x22, 0x24, 0x25, 0x2c, 0x3a, 0x2c, + 0x26, 0x24, 0x36, 0x21, 0x2f, 0x3d, 0x31, 0x3c, + 0x2f, 0x26, 0x36, 0x36, 0x24, 0x26, 0x3d, 0x31, + 0x24, 0x26, 0x35, 0x25, 0x2d, 0x32, 0x38, 0x2a, + 0x38, 0x39, 0x39, 0x35, 0x33, 0x23, 0x26, 0x2f, + // Entry C0 - FF + 0x3c, 0x21, 0x23, 0x2d, 0x31, 0x36, 0x36, 0x3c, + 0x26, 0x2d, 0x26, 0x3a, 0x2f, 0x25, 0x2f, 0x34, + 0x31, 0x2f, 0x32, 0x3b, 0x2d, 0x2b, 0x2d, 0x21, + 0x34, 0x2a, 0x2c, 0x25, 0x21, 0x3c, 0x24, 0x29, + 0x2b, 0x24, 0x34, 0x21, 0x28, 0x29, 0x3b, 0x31, + 0x25, 0x2e, 0x30, 0x29, 0x26, 0x24, 0x3a, 0x21, + 0x3c, 0x28, 0x21, 0x24, 0x21, 0x21, 0x1f, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, + // Entry 100 - 13F + 0x21, 0x21, 0x2f, 0x21, 0x2e, 0x23, 0x33, 0x2f, + 0x24, 0x3b, 0x2f, 0x39, 0x38, 0x31, 0x2d, 0x3a, + 0x2c, 0x2e, 0x2d, 0x23, 0x2d, 0x2f, 0x28, 0x2f, + 0x27, 0x33, 0x34, 0x26, 0x24, 0x32, 0x22, 0x26, + 0x27, 0x22, 0x2d, 0x31, 0x3d, 0x29, 0x31, 0x3d, + 0x39, 0x29, 0x31, 0x24, 0x26, 0x29, 0x36, 0x2f, + 0x33, 0x2f, 0x21, 0x22, 0x21, 0x30, 0x28, 0x3d, + 0x23, 0x26, 0x21, 0x28, 0x26, 0x26, 0x31, 0x3b, + // Entry 140 - 17F + 0x29, 0x21, 0x29, 0x21, 0x21, 0x21, 0x21, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x23, 0x21, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, + 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x2f, + 0x23, 0x32, 0x2f, 0x27, 0x2f, 0x21, +} + +// regionInclusionBits is an array of bit vectors where every vector represents +// a set of region groupings. These sets are used to compute the distance +// between two regions for the purpose of language matching. +// Size: 584 bytes, 73 elements +var regionInclusionBits = [73]uint64{ + // Entry 0 - 1F + 0x0000000102400813, 0x00000000200007a3, 0x0000000000003844, 0x0000000040000808, + 0x00000000803c0011, 0x0000000020000022, 0x0000000040000844, 0x0000000020000082, + 0x0000000000000102, 0x0000000020000202, 0x0000000020000402, 0x000000004000384d, + 0x0000000000001804, 0x0000000040002804, 0x0000000000404000, 0x0000000000408000, + 0x0000000000410000, 0x0000000002020000, 0x0000000000040010, 0x0000000000080010, + 0x0000000000100010, 0x0000000000200010, 0x0000000001c1c001, 0x0000000000c00000, + 0x0000000001400000, 0x000000001e020001, 0x0000000006000000, 0x000000000a000000, + 0x0000000012000000, 0x00000000200006a2, 0x0000000040002848, 0x0000000080000010, + // Entry 20 - 3F + 0x0000000100000001, 0x0000000000000001, 0x0000000080000000, 0x0000000000020000, + 0x0000000001000000, 0x0000000000008000, 0x0000000000002000, 0x0000000000000200, + 0x0000000000000008, 0x0000000000200000, 0x0000000110000000, 0x0000000000040000, + 0x0000000008000000, 0x0000000000000020, 0x0000000104000000, 0x0000000000000080, + 0x0000000000001000, 0x0000000000010000, 0x0000000000000400, 0x0000000004000000, + 0x0000000000000040, 0x0000000010000000, 0x0000000000004000, 0x0000000101000000, + 0x0000000108000000, 0x0000000000000100, 0x0000000100020000, 0x0000000000080000, + 0x0000000000100000, 0x0000000000800000, 0x00000001ffffffff, 0x0000000122400fb3, + // Entry 40 - 5F + 0x00000001827c0813, 0x000000014240385f, 0x0000000103c1c813, 0x000000011e420813, + 0x0000000112000001, 0x0000000106000001, 0x0000000101400001, 0x000000010a000001, + 0x0000000102020001, +} + +// regionInclusionNext marks, for each entry in regionInclusionBits, the set of +// all groups that are reachable from the groups set in the respective entry. +// Size: 73 bytes, 73 elements +var regionInclusionNext = [73]uint8{ + // Entry 0 - 3F + 0x3e, 0x3f, 0x0b, 0x0b, 0x40, 0x01, 0x0b, 0x01, + 0x01, 0x01, 0x01, 0x41, 0x0b, 0x0b, 0x16, 0x16, + 0x16, 0x19, 0x04, 0x04, 0x04, 0x04, 0x42, 0x16, + 0x16, 0x43, 0x19, 0x19, 0x19, 0x01, 0x0b, 0x04, + 0x00, 0x00, 0x1f, 0x11, 0x18, 0x0f, 0x0d, 0x09, + 0x03, 0x15, 0x44, 0x12, 0x1b, 0x05, 0x45, 0x07, + 0x0c, 0x10, 0x0a, 0x1a, 0x06, 0x1c, 0x0e, 0x46, + 0x47, 0x08, 0x48, 0x13, 0x14, 0x17, 0x3e, 0x3e, + // Entry 40 - 7F + 0x3e, 0x3e, 0x3e, 0x3e, 0x43, 0x43, 0x42, 0x43, + 0x43, +} + +type parentRel struct { + lang uint16 + script uint8 + maxScript uint8 + toRegion uint16 + fromRegion []uint16 +} + +// Size: 414 bytes, 5 elements +var parents = [5]parentRel{ + 0: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1, fromRegion: []uint16{0x1a, 0x25, 0x26, 0x2f, 0x34, 0x36, 0x3d, 0x42, 0x46, 0x48, 0x49, 0x4a, 0x50, 0x52, 0x5c, 0x5d, 0x61, 0x64, 0x6d, 0x73, 0x74, 0x75, 0x7b, 0x7c, 0x7f, 0x80, 0x81, 0x83, 0x8c, 0x8d, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9f, 0xa0, 0xa4, 0xa7, 0xa9, 0xad, 0xb1, 0xb4, 0xb5, 0xbf, 0xc6, 0xca, 0xcb, 0xcc, 0xce, 0xd0, 0xd2, 0xd5, 0xd6, 0xdd, 0xdf, 0xe0, 0xe6, 0xe7, 0xe8, 0xeb, 0xf0, 0x107, 0x109, 0x10a, 0x10b, 0x10d, 0x10e, 0x112, 0x117, 0x11b, 0x11d, 0x11f, 0x125, 0x129, 0x12c, 0x12d, 0x12f, 0x131, 0x139, 0x13c, 0x13f, 0x142, 0x161, 0x162, 0x164}}, + 1: {lang: 0x139, script: 0x0, maxScript: 0x57, toRegion: 0x1a, fromRegion: []uint16{0x2e, 0x4e, 0x60, 0x63, 0x72, 0xd9, 0x10c, 0x10f}}, + 2: {lang: 0x13e, script: 0x0, maxScript: 0x57, toRegion: 0x1f, fromRegion: []uint16{0x2c, 0x3f, 0x41, 0x48, 0x51, 0x54, 0x56, 0x59, 0x65, 0x69, 0x89, 0x8f, 0xcf, 0xd8, 0xe2, 0xe4, 0xec, 0xf1, 0x11a, 0x135, 0x136, 0x13b}}, + 3: {lang: 0x3c0, script: 0x0, maxScript: 0x57, toRegion: 0xee, fromRegion: []uint16{0x2a, 0x4e, 0x5a, 0x86, 0x8b, 0xb7, 0xc6, 0xd1, 0x118, 0x126}}, + 4: {lang: 0x529, script: 0x39, maxScript: 0x39, toRegion: 0x8d, fromRegion: []uint16{0xc6}}, +} + +// Total table size 27238 bytes (26KiB); checksum: C9BBE4D5 diff --git a/vendor/golang.org/x/text/language/tags.go b/vendor/golang.org/x/text/language/tags.go index 42ea7926..de30155a 100644 --- a/vendor/golang.org/x/text/language/tags.go +++ b/vendor/golang.org/x/text/language/tags.go @@ -4,8 +4,6 @@ package language -import "golang.org/x/text/internal/language/compact" - // TODO: Various sets of commonly use tags and regions. // MustParse is like Parse, but panics if the given BCP 47 tag cannot be parsed. @@ -63,83 +61,83 @@ var ( Und Tag = Tag{} - Afrikaans Tag = Tag(compact.Afrikaans) - Amharic Tag = Tag(compact.Amharic) - Arabic Tag = Tag(compact.Arabic) - ModernStandardArabic Tag = Tag(compact.ModernStandardArabic) - Azerbaijani Tag = Tag(compact.Azerbaijani) - Bulgarian Tag = Tag(compact.Bulgarian) - Bengali Tag = Tag(compact.Bengali) - Catalan Tag = Tag(compact.Catalan) - Czech Tag = Tag(compact.Czech) - Danish Tag = Tag(compact.Danish) - German Tag = Tag(compact.German) - Greek Tag = Tag(compact.Greek) - English Tag = Tag(compact.English) - AmericanEnglish Tag = Tag(compact.AmericanEnglish) - BritishEnglish Tag = Tag(compact.BritishEnglish) - Spanish Tag = Tag(compact.Spanish) - EuropeanSpanish Tag = Tag(compact.EuropeanSpanish) - LatinAmericanSpanish Tag = Tag(compact.LatinAmericanSpanish) - Estonian Tag = Tag(compact.Estonian) - Persian Tag = Tag(compact.Persian) - Finnish Tag = Tag(compact.Finnish) - Filipino Tag = Tag(compact.Filipino) - French Tag = Tag(compact.French) - CanadianFrench Tag = Tag(compact.CanadianFrench) - Gujarati Tag = Tag(compact.Gujarati) - Hebrew Tag = Tag(compact.Hebrew) - Hindi Tag = Tag(compact.Hindi) - Croatian Tag = Tag(compact.Croatian) - Hungarian Tag = Tag(compact.Hungarian) - Armenian Tag = Tag(compact.Armenian) - Indonesian Tag = Tag(compact.Indonesian) - Icelandic Tag = Tag(compact.Icelandic) - Italian Tag = Tag(compact.Italian) - Japanese Tag = Tag(compact.Japanese) - Georgian Tag = Tag(compact.Georgian) - Kazakh Tag = Tag(compact.Kazakh) - Khmer Tag = Tag(compact.Khmer) - Kannada Tag = Tag(compact.Kannada) - Korean Tag = Tag(compact.Korean) - Kirghiz Tag = Tag(compact.Kirghiz) - Lao Tag = Tag(compact.Lao) - Lithuanian Tag = Tag(compact.Lithuanian) - Latvian Tag = Tag(compact.Latvian) - Macedonian Tag = Tag(compact.Macedonian) - Malayalam Tag = Tag(compact.Malayalam) - Mongolian Tag = Tag(compact.Mongolian) - Marathi Tag = Tag(compact.Marathi) - Malay Tag = Tag(compact.Malay) - Burmese Tag = Tag(compact.Burmese) - Nepali Tag = Tag(compact.Nepali) - Dutch Tag = Tag(compact.Dutch) - Norwegian Tag = Tag(compact.Norwegian) - Punjabi Tag = Tag(compact.Punjabi) - Polish Tag = Tag(compact.Polish) - Portuguese Tag = Tag(compact.Portuguese) - BrazilianPortuguese Tag = Tag(compact.BrazilianPortuguese) - EuropeanPortuguese Tag = Tag(compact.EuropeanPortuguese) - Romanian Tag = Tag(compact.Romanian) - Russian Tag = Tag(compact.Russian) - Sinhala Tag = Tag(compact.Sinhala) - Slovak Tag = Tag(compact.Slovak) - Slovenian Tag = Tag(compact.Slovenian) - Albanian Tag = Tag(compact.Albanian) - Serbian Tag = Tag(compact.Serbian) - SerbianLatin Tag = Tag(compact.SerbianLatin) - Swedish Tag = Tag(compact.Swedish) - Swahili Tag = Tag(compact.Swahili) - Tamil Tag = Tag(compact.Tamil) - Telugu Tag = Tag(compact.Telugu) - Thai Tag = Tag(compact.Thai) - Turkish Tag = Tag(compact.Turkish) - Ukrainian Tag = Tag(compact.Ukrainian) - Urdu Tag = Tag(compact.Urdu) - Uzbek Tag = Tag(compact.Uzbek) - Vietnamese Tag = Tag(compact.Vietnamese) - Chinese Tag = Tag(compact.Chinese) - SimplifiedChinese Tag = Tag(compact.SimplifiedChinese) - TraditionalChinese Tag = Tag(compact.TraditionalChinese) - Zulu Tag = Tag(compact.Zulu) + Afrikaans Tag = Tag{lang: _af} // af + Amharic Tag = Tag{lang: _am} // am + Arabic Tag = Tag{lang: _ar} // ar + ModernStandardArabic Tag = Tag{lang: _ar, region: _001} // ar-001 + Azerbaijani Tag = Tag{lang: _az} // az + Bulgarian Tag = Tag{lang: _bg} // bg + Bengali Tag = Tag{lang: _bn} // bn + Catalan Tag = Tag{lang: _ca} // ca + Czech Tag = Tag{lang: _cs} // cs + Danish Tag = Tag{lang: _da} // da + German Tag = Tag{lang: _de} // de + Greek Tag = Tag{lang: _el} // el + English Tag = Tag{lang: _en} // en + AmericanEnglish Tag = Tag{lang: _en, region: _US} // en-US + BritishEnglish Tag = Tag{lang: _en, region: _GB} // en-GB + Spanish Tag = Tag{lang: _es} // es + EuropeanSpanish Tag = Tag{lang: _es, region: _ES} // es-ES + LatinAmericanSpanish Tag = Tag{lang: _es, region: _419} // es-419 + Estonian Tag = Tag{lang: _et} // et + Persian Tag = Tag{lang: _fa} // fa + Finnish Tag = Tag{lang: _fi} // fi + Filipino Tag = Tag{lang: _fil} // fil + French Tag = Tag{lang: _fr} // fr + CanadianFrench Tag = Tag{lang: _fr, region: _CA} // fr-CA + Gujarati Tag = Tag{lang: _gu} // gu + Hebrew Tag = Tag{lang: _he} // he + Hindi Tag = Tag{lang: _hi} // hi + Croatian Tag = Tag{lang: _hr} // hr + Hungarian Tag = Tag{lang: _hu} // hu + Armenian Tag = Tag{lang: _hy} // hy + Indonesian Tag = Tag{lang: _id} // id + Icelandic Tag = Tag{lang: _is} // is + Italian Tag = Tag{lang: _it} // it + Japanese Tag = Tag{lang: _ja} // ja + Georgian Tag = Tag{lang: _ka} // ka + Kazakh Tag = Tag{lang: _kk} // kk + Khmer Tag = Tag{lang: _km} // km + Kannada Tag = Tag{lang: _kn} // kn + Korean Tag = Tag{lang: _ko} // ko + Kirghiz Tag = Tag{lang: _ky} // ky + Lao Tag = Tag{lang: _lo} // lo + Lithuanian Tag = Tag{lang: _lt} // lt + Latvian Tag = Tag{lang: _lv} // lv + Macedonian Tag = Tag{lang: _mk} // mk + Malayalam Tag = Tag{lang: _ml} // ml + Mongolian Tag = Tag{lang: _mn} // mn + Marathi Tag = Tag{lang: _mr} // mr + Malay Tag = Tag{lang: _ms} // ms + Burmese Tag = Tag{lang: _my} // my + Nepali Tag = Tag{lang: _ne} // ne + Dutch Tag = Tag{lang: _nl} // nl + Norwegian Tag = Tag{lang: _no} // no + Punjabi Tag = Tag{lang: _pa} // pa + Polish Tag = Tag{lang: _pl} // pl + Portuguese Tag = Tag{lang: _pt} // pt + BrazilianPortuguese Tag = Tag{lang: _pt, region: _BR} // pt-BR + EuropeanPortuguese Tag = Tag{lang: _pt, region: _PT} // pt-PT + Romanian Tag = Tag{lang: _ro} // ro + Russian Tag = Tag{lang: _ru} // ru + Sinhala Tag = Tag{lang: _si} // si + Slovak Tag = Tag{lang: _sk} // sk + Slovenian Tag = Tag{lang: _sl} // sl + Albanian Tag = Tag{lang: _sq} // sq + Serbian Tag = Tag{lang: _sr} // sr + SerbianLatin Tag = Tag{lang: _sr, script: _Latn} // sr-Latn + Swedish Tag = Tag{lang: _sv} // sv + Swahili Tag = Tag{lang: _sw} // sw + Tamil Tag = Tag{lang: _ta} // ta + Telugu Tag = Tag{lang: _te} // te + Thai Tag = Tag{lang: _th} // th + Turkish Tag = Tag{lang: _tr} // tr + Ukrainian Tag = Tag{lang: _uk} // uk + Urdu Tag = Tag{lang: _ur} // ur + Uzbek Tag = Tag{lang: _uz} // uz + Vietnamese Tag = Tag{lang: _vi} // vi + Chinese Tag = Tag{lang: _zh} // zh + SimplifiedChinese Tag = Tag{lang: _zh, script: _Hans} // zh-Hans + TraditionalChinese Tag = Tag{lang: _zh, script: _Hant} // zh-Hant + Zulu Tag = Tag{lang: _zu} // zu ) diff --git a/vendor/golang.org/x/text/transform/transform.go b/vendor/golang.org/x/text/transform/transform.go index 520b9ada..fe47b9b3 100644 --- a/vendor/golang.org/x/text/transform/transform.go +++ b/vendor/golang.org/x/text/transform/transform.go @@ -78,8 +78,8 @@ type SpanningTransformer interface { // considering the error err. // // A nil error means that all input bytes are known to be identical to the - // output produced by the Transformer. A nil error can be returned - // regardless of whether atEOF is true. If err is nil, then n must + // output produced by the Transformer. A nil error can be be returned + // regardless of whether atEOF is true. If err is nil, then then n must // equal len(src); the converse is not necessarily true. // // ErrEndOfSpan means that the Transformer output may differ from the @@ -493,7 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro return dstL.n, srcL.p, err } -// Deprecated: Use runes.Remove instead. +// Deprecated: use runes.Remove instead. func RemoveFunc(f func(r rune) bool) Transformer { return removeF(f) } diff --git a/vendor/golang.org/x/text/unicode/cldr/cldr.go b/vendor/golang.org/x/text/unicode/cldr/cldr.go index f39b2e3a..2197f8ac 100644 --- a/vendor/golang.org/x/text/unicode/cldr/cldr.go +++ b/vendor/golang.org/x/text/unicode/cldr/cldr.go @@ -5,15 +5,14 @@ //go:generate go run makexml.go -output xml.go // Package cldr provides a parser for LDML and related XML formats. -// -// This package is intended to be used by the table generation tools for the -// various packages in x/text and is not internal for historical reasons. -// -// As the XML types are generated from the CLDR DTD, and as the CLDR standard is -// periodically amended, this package may change considerably over time. This -// mostly means that data may appear and disappear between versions. That is, -// old code should keep compiling for newer versions, but data may have moved or -// changed. CLDR version 22 is the first version supported by this package. +// This package is intended to be used by the table generation tools +// for the various internationalization-related packages. +// As the XML types are generated from the CLDR DTD, and as the CLDR standard +// is periodically amended, this package may change considerably over time. +// This mostly means that data may appear and disappear between versions. +// That is, old code should keep compiling for newer versions, but data +// may have moved or changed. +// CLDR version 22 is the first version supported by this package. // Older versions may not work. package cldr // import "golang.org/x/text/unicode/cldr" @@ -95,12 +94,6 @@ func (cldr *CLDR) RawLDML(loc string) *LDML { // LDML returns the fully resolved LDML XML for loc, which must be one of // the strings returned by Locales. -// -// Deprecated: Use RawLDML and implement inheritance manually or using the -// internal cldrtree package. -// Inheritance has changed quite a bit since the onset of this package and in -// practice data often represented in a way where knowledge of how it was -// inherited is relevant. func (cldr *CLDR) LDML(loc string) (*LDML, error) { return cldr.resolve(loc) } diff --git a/vendor/golang.org/x/text/unicode/cldr/collate.go b/vendor/golang.org/x/text/unicode/cldr/collate.go index 27c5bac9..80ee28d7 100644 --- a/vendor/golang.org/x/text/unicode/cldr/collate.go +++ b/vendor/golang.org/x/text/unicode/cldr/collate.go @@ -27,7 +27,7 @@ const ( // cldrIndex is a Unicode-reserved sentinel value used to mark the start // of a grouping within an index. // We ignore any rule that starts with this rune. - // See https://unicode.org/reports/tr35/#Collation_Elements for details. + // See http://unicode.org/reports/tr35/#Collation_Elements for details. cldrIndex = "\uFDD0" // specialAnchor is the format in which to represent logical reset positions, @@ -51,7 +51,7 @@ func (c Collation) Process(p RuleProcessor) (err error) { } // processRules parses rules in the Collation Rule Syntax defined in -// https://www.unicode.org/reports/tr35/tr35-collation.html#Collation_Tailorings. +// http://www.unicode.org/reports/tr35/tr35-collation.html#Collation_Tailorings. func processRules(p RuleProcessor, s string) (err error) { chk := func(s string, e error) string { if err == nil { diff --git a/vendor/golang.org/x/text/unicode/cldr/decode.go b/vendor/golang.org/x/text/unicode/cldr/decode.go index 48f6bd62..094d4313 100644 --- a/vendor/golang.org/x/text/unicode/cldr/decode.go +++ b/vendor/golang.org/x/text/unicode/cldr/decode.go @@ -58,10 +58,9 @@ func (d *Decoder) Decode(l Loader) (cldr *CLDR, err error) { if len(d.dirFilter) > 0 && !in(d.dirFilter, m[1]) { continue } - var r io.ReadCloser + var r io.Reader if r, err = l.Reader(i); err == nil { err = d.decode(m[1], m[2], r) - r.Close() } if err != nil { return nil, err @@ -101,7 +100,7 @@ func (d *Decoder) decode(dir, id string, r io.Reader) error { if l.Identity == nil { return fmt.Errorf("%s/%s: missing identity element", dir, id) } - // TODO: verify when CLDR bug https://unicode.org/cldr/trac/ticket/8970 + // TODO: verify when CLDR bug http://unicode.org/cldr/trac/ticket/8970 // is resolved. // path := strings.Split(id, "_") // if lang := l.Identity.Language.Type; lang != path[0] { diff --git a/vendor/golang.org/x/text/unicode/cldr/makexml.go b/vendor/golang.org/x/text/unicode/cldr/makexml.go index eb26306d..6114d01c 100644 --- a/vendor/golang.org/x/text/unicode/cldr/makexml.go +++ b/vendor/golang.org/x/text/unicode/cldr/makexml.go @@ -153,7 +153,7 @@ var comments = map[string]string{ // Dates contains information regarding the format and parsing of dates and times. `, "localeDisplayNames": ` -// LocaleDisplayNames specifies localized display names for scripts, languages, +// LocaleDisplayNames specifies localized display names for for scripts, languages, // countries, currencies, and variants. `, "numbers": ` diff --git a/vendor/golang.org/x/text/unicode/cldr/resolve.go b/vendor/golang.org/x/text/unicode/cldr/resolve.go index 31cc7be3..691b5903 100644 --- a/vendor/golang.org/x/text/unicode/cldr/resolve.go +++ b/vendor/golang.org/x/text/unicode/cldr/resolve.go @@ -5,7 +5,7 @@ package cldr // This file implements the various inheritance constructs defined by LDML. -// See https://www.unicode.org/reports/tr35/#Inheritance_and_Validity +// See http://www.unicode.org/reports/tr35/#Inheritance_and_Validity // for more details. import ( @@ -309,7 +309,7 @@ func in(set []string, s string) bool { } // attrKey computes a key based on the distinguishable attributes of -// an element and its values. +// an element and it's values. func attrKey(v reflect.Value, exclude ...string) string { parts := []string{} ename := v.Interface().(Elem).GetCommon().name diff --git a/vendor/golang.org/x/text/unicode/cldr/xml.go b/vendor/golang.org/x/text/unicode/cldr/xml.go index bbae53bd..f847663b 100644 --- a/vendor/golang.org/x/text/unicode/cldr/xml.go +++ b/vendor/golang.org/x/text/unicode/cldr/xml.go @@ -1237,7 +1237,7 @@ type TimeZoneNames struct { } `xml:"metazone"` } -// LocaleDisplayNames specifies localized display names for scripts, languages, +// LocaleDisplayNames specifies localized display names for for scripts, languages, // countries, currencies, and variants. type LocaleDisplayNames struct { Common diff --git a/vendor/golang.org/x/text/unicode/norm/composition.go b/vendor/golang.org/x/text/unicode/norm/composition.go index e2087bce..bab4c5de 100644 --- a/vendor/golang.org/x/text/unicode/norm/composition.go +++ b/vendor/golang.org/x/text/unicode/norm/composition.go @@ -407,7 +407,7 @@ func decomposeHangul(buf []byte, r rune) int { // decomposeHangul algorithmically decomposes a Hangul rune into // its Jamo components. -// See https://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul. +// See http://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul. func (rb *reorderBuffer) decomposeHangul(r rune) { r -= hangulBase x := r % jamoTCount @@ -420,7 +420,7 @@ func (rb *reorderBuffer) decomposeHangul(r rune) { } // combineHangul algorithmically combines Jamo character components into Hangul. -// See https://unicode.org/reports/tr15/#Hangul for details on combining Hangul. +// See http://unicode.org/reports/tr15/#Hangul for details on combining Hangul. func (rb *reorderBuffer) combineHangul(s, i, k int) { b := rb.rune[:] bn := rb.nrune @@ -461,10 +461,6 @@ func (rb *reorderBuffer) combineHangul(s, i, k int) { // It should only be used to recompose a single segment, as it will not // handle alternations between Hangul and non-Hangul characters correctly. func (rb *reorderBuffer) compose() { - // Lazily load the map used by the combine func below, but do - // it outside of the loop. - recompMapOnce.Do(buildRecompMap) - // UAX #15, section X5 , including Corrigendum #5 // "In any character sequence beginning with starter S, a character C is // blocked from S if and only if there is some character B between S diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo.go b/vendor/golang.org/x/text/unicode/norm/forminfo.go index 526c7033..e67e7655 100644 --- a/vendor/golang.org/x/text/unicode/norm/forminfo.go +++ b/vendor/golang.org/x/text/unicode/norm/forminfo.go @@ -4,8 +4,6 @@ package norm -import "encoding/binary" - // This file contains Form-specific logic and wrappers for data in tables.go. // Rune info is stored in a separate trie per composing form. A composing form @@ -180,17 +178,6 @@ func (p Properties) TrailCCC() uint8 { return ccc[p.tccc] } -func buildRecompMap() { - recompMap = make(map[uint32]rune, len(recompMapPacked)/8) - var buf [8]byte - for i := 0; i < len(recompMapPacked); i += 8 { - copy(buf[:], recompMapPacked[i:i+8]) - key := binary.BigEndian.Uint32(buf[:4]) - val := binary.BigEndian.Uint32(buf[4:]) - recompMap[key] = rune(val) - } -} - // Recomposition // We use 32-bit keys instead of 64-bit for the two codepoint keys. // This clips off the bits of three entries, but we know this will not @@ -199,14 +186,8 @@ func buildRecompMap() { // Note that the recomposition map for NFC and NFKC are identical. // combine returns the combined rune or 0 if it doesn't exist. -// -// The caller is responsible for calling -// recompMapOnce.Do(buildRecompMap) sometime before this is called. func combine(a, b rune) rune { key := uint32(uint16(a))<<16 + uint32(uint16(b)) - if recompMap == nil { - panic("caller error") // see func comment - } return recompMap[key] } diff --git a/vendor/golang.org/x/text/unicode/norm/iter.go b/vendor/golang.org/x/text/unicode/norm/iter.go index 417c6b26..ce17f96c 100644 --- a/vendor/golang.org/x/text/unicode/norm/iter.go +++ b/vendor/golang.org/x/text/unicode/norm/iter.go @@ -128,9 +128,8 @@ func (i *Iter) Next() []byte { func nextASCIIBytes(i *Iter) []byte { p := i.p + 1 if p >= i.rb.nsrc { - p0 := i.p i.setDone() - return i.rb.src.bytes[p0:p] + return i.rb.src.bytes[i.p:p] } if i.rb.src.bytes[p] < utf8.RuneSelf { p0 := i.p diff --git a/vendor/golang.org/x/text/unicode/norm/maketables.go b/vendor/golang.org/x/text/unicode/norm/maketables.go index 30a3aa93..338c395e 100644 --- a/vendor/golang.org/x/text/unicode/norm/maketables.go +++ b/vendor/golang.org/x/text/unicode/norm/maketables.go @@ -12,7 +12,6 @@ package main import ( "bytes" - "encoding/binary" "flag" "fmt" "io" @@ -262,7 +261,7 @@ func compactCCC() { // CompositionExclusions.txt has form: // 0958 # ... -// See https://unicode.org/reports/tr44/ for full explanation +// See http://unicode.org/reports/tr44/ for full explanation func loadCompositionExclusions() { f := gen.OpenUCDFile("CompositionExclusions.txt") defer f.Close() @@ -736,8 +735,6 @@ func makeTables() { max = n } } - fmt.Fprintln(w, `import "sync"`) - fmt.Fprintln(w) fmt.Fprintln(w, "const (") fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.") @@ -785,23 +782,16 @@ func makeTables() { sz := nrentries * 8 size += sz fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz) - fmt.Fprintln(w, "var recompMap map[uint32]rune") - fmt.Fprintln(w, "var recompMapOnce sync.Once\n") - fmt.Fprintln(w, `const recompMapPacked = "" +`) - var buf [8]byte + fmt.Fprintln(w, "var recompMap = map[uint32]rune{") for i, c := range chars { f := c.forms[FCanonical] d := f.decomp if !f.isOneWay && len(d) > 0 { key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1])) - binary.BigEndian.PutUint32(buf[:4], key) - binary.BigEndian.PutUint32(buf[4:], uint32(i)) - fmt.Fprintf(w, "\t\t%q + // 0x%.8X: 0x%.8X\n", string(buf[:]), key, uint32(i)) + fmt.Fprintf(w, "0x%.8X: 0x%.4X,\n", key, i) } } - // hack so we don't have to special case the trailing plus sign - fmt.Fprintf(w, ` ""`) - fmt.Fprintln(w) + fmt.Fprintf(w, "}\n\n") } fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size) @@ -867,7 +857,7 @@ func verifyComputed() { // DerivedNormalizationProps.txt has form: // 00C0..00C5 ; NFD_QC; N # ... // 0374 ; NFD_QC; N # ... -// See https://unicode.org/reports/tr44/ for full explanation +// See http://unicode.org/reports/tr44/ for full explanation func testDerived() { f := gen.OpenUCDFile("DerivedNormalizationProps.txt") defer f.Close() diff --git a/vendor/golang.org/x/text/unicode/norm/normalize.go b/vendor/golang.org/x/text/unicode/norm/normalize.go index 95efcf26..e28ac641 100644 --- a/vendor/golang.org/x/text/unicode/norm/normalize.go +++ b/vendor/golang.org/x/text/unicode/norm/normalize.go @@ -29,8 +29,8 @@ import ( // proceed independently on both sides: // f(x) == append(f(x[0:n]), f(x[n:])...) // -// References: https://unicode.org/reports/tr15/ and -// https://unicode.org/notes/tn5/. +// References: http://unicode.org/reports/tr15/ and +// http://unicode.org/notes/tn5/. type Form int const ( diff --git a/vendor/golang.org/x/text/unicode/norm/readwriter.go b/vendor/golang.org/x/text/unicode/norm/readwriter.go index b38096f5..d926ee90 100644 --- a/vendor/golang.org/x/text/unicode/norm/readwriter.go +++ b/vendor/golang.org/x/text/unicode/norm/readwriter.go @@ -60,8 +60,8 @@ func (w *normWriter) Close() error { } // Writer returns a new writer that implements Write(b) -// by writing f(b) to w. The returned writer may use an -// internal buffer to maintain state across Write calls. +// by writing f(b) to w. The returned writer may use an +// an internal buffer to maintain state across Write calls. // Calling its Close method writes any buffered data to w. func (f Form) Writer(w io.Writer) io.WriteCloser { wr := &normWriter{rb: reorderBuffer{}, w: w} diff --git a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index 26fbd55a..44dd3978 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,11 +1,9 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -// +build go1.10,!go1.13 +// +build go1.10 package norm -import "sync" - const ( // Version is the Unicode edition from which the tables are derived. Version = "10.0.0" @@ -6709,949 +6707,947 @@ var nfkcSparseValues = [869]valueRange{ } // recompMap: 7520 bytes (entries only) -var recompMap map[uint32]rune -var recompMapOnce sync.Once +var recompMap = map[uint32]rune{ + 0x00410300: 0x00C0, + 0x00410301: 0x00C1, + 0x00410302: 0x00C2, + 0x00410303: 0x00C3, + 0x00410308: 0x00C4, + 0x0041030A: 0x00C5, + 0x00430327: 0x00C7, + 0x00450300: 0x00C8, + 0x00450301: 0x00C9, + 0x00450302: 0x00CA, + 0x00450308: 0x00CB, + 0x00490300: 0x00CC, + 0x00490301: 0x00CD, + 0x00490302: 0x00CE, + 0x00490308: 0x00CF, + 0x004E0303: 0x00D1, + 0x004F0300: 0x00D2, + 0x004F0301: 0x00D3, + 0x004F0302: 0x00D4, + 0x004F0303: 0x00D5, + 0x004F0308: 0x00D6, + 0x00550300: 0x00D9, + 0x00550301: 0x00DA, + 0x00550302: 0x00DB, + 0x00550308: 0x00DC, + 0x00590301: 0x00DD, + 0x00610300: 0x00E0, + 0x00610301: 0x00E1, + 0x00610302: 0x00E2, + 0x00610303: 0x00E3, + 0x00610308: 0x00E4, + 0x0061030A: 0x00E5, + 0x00630327: 0x00E7, + 0x00650300: 0x00E8, + 0x00650301: 0x00E9, + 0x00650302: 0x00EA, + 0x00650308: 0x00EB, + 0x00690300: 0x00EC, + 0x00690301: 0x00ED, + 0x00690302: 0x00EE, + 0x00690308: 0x00EF, + 0x006E0303: 0x00F1, + 0x006F0300: 0x00F2, + 0x006F0301: 0x00F3, + 0x006F0302: 0x00F4, + 0x006F0303: 0x00F5, + 0x006F0308: 0x00F6, + 0x00750300: 0x00F9, + 0x00750301: 0x00FA, + 0x00750302: 0x00FB, + 0x00750308: 0x00FC, + 0x00790301: 0x00FD, + 0x00790308: 0x00FF, + 0x00410304: 0x0100, + 0x00610304: 0x0101, + 0x00410306: 0x0102, + 0x00610306: 0x0103, + 0x00410328: 0x0104, + 0x00610328: 0x0105, + 0x00430301: 0x0106, + 0x00630301: 0x0107, + 0x00430302: 0x0108, + 0x00630302: 0x0109, + 0x00430307: 0x010A, + 0x00630307: 0x010B, + 0x0043030C: 0x010C, + 0x0063030C: 0x010D, + 0x0044030C: 0x010E, + 0x0064030C: 0x010F, + 0x00450304: 0x0112, + 0x00650304: 0x0113, + 0x00450306: 0x0114, + 0x00650306: 0x0115, + 0x00450307: 0x0116, + 0x00650307: 0x0117, + 0x00450328: 0x0118, + 0x00650328: 0x0119, + 0x0045030C: 0x011A, + 0x0065030C: 0x011B, + 0x00470302: 0x011C, + 0x00670302: 0x011D, + 0x00470306: 0x011E, + 0x00670306: 0x011F, + 0x00470307: 0x0120, + 0x00670307: 0x0121, + 0x00470327: 0x0122, + 0x00670327: 0x0123, + 0x00480302: 0x0124, + 0x00680302: 0x0125, + 0x00490303: 0x0128, + 0x00690303: 0x0129, + 0x00490304: 0x012A, + 0x00690304: 0x012B, + 0x00490306: 0x012C, + 0x00690306: 0x012D, + 0x00490328: 0x012E, + 0x00690328: 0x012F, + 0x00490307: 0x0130, + 0x004A0302: 0x0134, + 0x006A0302: 0x0135, + 0x004B0327: 0x0136, + 0x006B0327: 0x0137, + 0x004C0301: 0x0139, + 0x006C0301: 0x013A, + 0x004C0327: 0x013B, + 0x006C0327: 0x013C, + 0x004C030C: 0x013D, + 0x006C030C: 0x013E, + 0x004E0301: 0x0143, + 0x006E0301: 0x0144, + 0x004E0327: 0x0145, + 0x006E0327: 0x0146, + 0x004E030C: 0x0147, + 0x006E030C: 0x0148, + 0x004F0304: 0x014C, + 0x006F0304: 0x014D, + 0x004F0306: 0x014E, + 0x006F0306: 0x014F, + 0x004F030B: 0x0150, + 0x006F030B: 0x0151, + 0x00520301: 0x0154, + 0x00720301: 0x0155, + 0x00520327: 0x0156, + 0x00720327: 0x0157, + 0x0052030C: 0x0158, + 0x0072030C: 0x0159, + 0x00530301: 0x015A, + 0x00730301: 0x015B, + 0x00530302: 0x015C, + 0x00730302: 0x015D, + 0x00530327: 0x015E, + 0x00730327: 0x015F, + 0x0053030C: 0x0160, + 0x0073030C: 0x0161, + 0x00540327: 0x0162, + 0x00740327: 0x0163, + 0x0054030C: 0x0164, + 0x0074030C: 0x0165, + 0x00550303: 0x0168, + 0x00750303: 0x0169, + 0x00550304: 0x016A, + 0x00750304: 0x016B, + 0x00550306: 0x016C, + 0x00750306: 0x016D, + 0x0055030A: 0x016E, + 0x0075030A: 0x016F, + 0x0055030B: 0x0170, + 0x0075030B: 0x0171, + 0x00550328: 0x0172, + 0x00750328: 0x0173, + 0x00570302: 0x0174, + 0x00770302: 0x0175, + 0x00590302: 0x0176, + 0x00790302: 0x0177, + 0x00590308: 0x0178, + 0x005A0301: 0x0179, + 0x007A0301: 0x017A, + 0x005A0307: 0x017B, + 0x007A0307: 0x017C, + 0x005A030C: 0x017D, + 0x007A030C: 0x017E, + 0x004F031B: 0x01A0, + 0x006F031B: 0x01A1, + 0x0055031B: 0x01AF, + 0x0075031B: 0x01B0, + 0x0041030C: 0x01CD, + 0x0061030C: 0x01CE, + 0x0049030C: 0x01CF, + 0x0069030C: 0x01D0, + 0x004F030C: 0x01D1, + 0x006F030C: 0x01D2, + 0x0055030C: 0x01D3, + 0x0075030C: 0x01D4, + 0x00DC0304: 0x01D5, + 0x00FC0304: 0x01D6, + 0x00DC0301: 0x01D7, + 0x00FC0301: 0x01D8, + 0x00DC030C: 0x01D9, + 0x00FC030C: 0x01DA, + 0x00DC0300: 0x01DB, + 0x00FC0300: 0x01DC, + 0x00C40304: 0x01DE, + 0x00E40304: 0x01DF, + 0x02260304: 0x01E0, + 0x02270304: 0x01E1, + 0x00C60304: 0x01E2, + 0x00E60304: 0x01E3, + 0x0047030C: 0x01E6, + 0x0067030C: 0x01E7, + 0x004B030C: 0x01E8, + 0x006B030C: 0x01E9, + 0x004F0328: 0x01EA, + 0x006F0328: 0x01EB, + 0x01EA0304: 0x01EC, + 0x01EB0304: 0x01ED, + 0x01B7030C: 0x01EE, + 0x0292030C: 0x01EF, + 0x006A030C: 0x01F0, + 0x00470301: 0x01F4, + 0x00670301: 0x01F5, + 0x004E0300: 0x01F8, + 0x006E0300: 0x01F9, + 0x00C50301: 0x01FA, + 0x00E50301: 0x01FB, + 0x00C60301: 0x01FC, + 0x00E60301: 0x01FD, + 0x00D80301: 0x01FE, + 0x00F80301: 0x01FF, + 0x0041030F: 0x0200, + 0x0061030F: 0x0201, + 0x00410311: 0x0202, + 0x00610311: 0x0203, + 0x0045030F: 0x0204, + 0x0065030F: 0x0205, + 0x00450311: 0x0206, + 0x00650311: 0x0207, + 0x0049030F: 0x0208, + 0x0069030F: 0x0209, + 0x00490311: 0x020A, + 0x00690311: 0x020B, + 0x004F030F: 0x020C, + 0x006F030F: 0x020D, + 0x004F0311: 0x020E, + 0x006F0311: 0x020F, + 0x0052030F: 0x0210, + 0x0072030F: 0x0211, + 0x00520311: 0x0212, + 0x00720311: 0x0213, + 0x0055030F: 0x0214, + 0x0075030F: 0x0215, + 0x00550311: 0x0216, + 0x00750311: 0x0217, + 0x00530326: 0x0218, + 0x00730326: 0x0219, + 0x00540326: 0x021A, + 0x00740326: 0x021B, + 0x0048030C: 0x021E, + 0x0068030C: 0x021F, + 0x00410307: 0x0226, + 0x00610307: 0x0227, + 0x00450327: 0x0228, + 0x00650327: 0x0229, + 0x00D60304: 0x022A, + 0x00F60304: 0x022B, + 0x00D50304: 0x022C, + 0x00F50304: 0x022D, + 0x004F0307: 0x022E, + 0x006F0307: 0x022F, + 0x022E0304: 0x0230, + 0x022F0304: 0x0231, + 0x00590304: 0x0232, + 0x00790304: 0x0233, + 0x00A80301: 0x0385, + 0x03910301: 0x0386, + 0x03950301: 0x0388, + 0x03970301: 0x0389, + 0x03990301: 0x038A, + 0x039F0301: 0x038C, + 0x03A50301: 0x038E, + 0x03A90301: 0x038F, + 0x03CA0301: 0x0390, + 0x03990308: 0x03AA, + 0x03A50308: 0x03AB, + 0x03B10301: 0x03AC, + 0x03B50301: 0x03AD, + 0x03B70301: 0x03AE, + 0x03B90301: 0x03AF, + 0x03CB0301: 0x03B0, + 0x03B90308: 0x03CA, + 0x03C50308: 0x03CB, + 0x03BF0301: 0x03CC, + 0x03C50301: 0x03CD, + 0x03C90301: 0x03CE, + 0x03D20301: 0x03D3, + 0x03D20308: 0x03D4, + 0x04150300: 0x0400, + 0x04150308: 0x0401, + 0x04130301: 0x0403, + 0x04060308: 0x0407, + 0x041A0301: 0x040C, + 0x04180300: 0x040D, + 0x04230306: 0x040E, + 0x04180306: 0x0419, + 0x04380306: 0x0439, + 0x04350300: 0x0450, + 0x04350308: 0x0451, + 0x04330301: 0x0453, + 0x04560308: 0x0457, + 0x043A0301: 0x045C, + 0x04380300: 0x045D, + 0x04430306: 0x045E, + 0x0474030F: 0x0476, + 0x0475030F: 0x0477, + 0x04160306: 0x04C1, + 0x04360306: 0x04C2, + 0x04100306: 0x04D0, + 0x04300306: 0x04D1, + 0x04100308: 0x04D2, + 0x04300308: 0x04D3, + 0x04150306: 0x04D6, + 0x04350306: 0x04D7, + 0x04D80308: 0x04DA, + 0x04D90308: 0x04DB, + 0x04160308: 0x04DC, + 0x04360308: 0x04DD, + 0x04170308: 0x04DE, + 0x04370308: 0x04DF, + 0x04180304: 0x04E2, + 0x04380304: 0x04E3, + 0x04180308: 0x04E4, + 0x04380308: 0x04E5, + 0x041E0308: 0x04E6, + 0x043E0308: 0x04E7, + 0x04E80308: 0x04EA, + 0x04E90308: 0x04EB, + 0x042D0308: 0x04EC, + 0x044D0308: 0x04ED, + 0x04230304: 0x04EE, + 0x04430304: 0x04EF, + 0x04230308: 0x04F0, + 0x04430308: 0x04F1, + 0x0423030B: 0x04F2, + 0x0443030B: 0x04F3, + 0x04270308: 0x04F4, + 0x04470308: 0x04F5, + 0x042B0308: 0x04F8, + 0x044B0308: 0x04F9, + 0x06270653: 0x0622, + 0x06270654: 0x0623, + 0x06480654: 0x0624, + 0x06270655: 0x0625, + 0x064A0654: 0x0626, + 0x06D50654: 0x06C0, + 0x06C10654: 0x06C2, + 0x06D20654: 0x06D3, + 0x0928093C: 0x0929, + 0x0930093C: 0x0931, + 0x0933093C: 0x0934, + 0x09C709BE: 0x09CB, + 0x09C709D7: 0x09CC, + 0x0B470B56: 0x0B48, + 0x0B470B3E: 0x0B4B, + 0x0B470B57: 0x0B4C, + 0x0B920BD7: 0x0B94, + 0x0BC60BBE: 0x0BCA, + 0x0BC70BBE: 0x0BCB, + 0x0BC60BD7: 0x0BCC, + 0x0C460C56: 0x0C48, + 0x0CBF0CD5: 0x0CC0, + 0x0CC60CD5: 0x0CC7, + 0x0CC60CD6: 0x0CC8, + 0x0CC60CC2: 0x0CCA, + 0x0CCA0CD5: 0x0CCB, + 0x0D460D3E: 0x0D4A, + 0x0D470D3E: 0x0D4B, + 0x0D460D57: 0x0D4C, + 0x0DD90DCA: 0x0DDA, + 0x0DD90DCF: 0x0DDC, + 0x0DDC0DCA: 0x0DDD, + 0x0DD90DDF: 0x0DDE, + 0x1025102E: 0x1026, + 0x1B051B35: 0x1B06, + 0x1B071B35: 0x1B08, + 0x1B091B35: 0x1B0A, + 0x1B0B1B35: 0x1B0C, + 0x1B0D1B35: 0x1B0E, + 0x1B111B35: 0x1B12, + 0x1B3A1B35: 0x1B3B, + 0x1B3C1B35: 0x1B3D, + 0x1B3E1B35: 0x1B40, + 0x1B3F1B35: 0x1B41, + 0x1B421B35: 0x1B43, + 0x00410325: 0x1E00, + 0x00610325: 0x1E01, + 0x00420307: 0x1E02, + 0x00620307: 0x1E03, + 0x00420323: 0x1E04, + 0x00620323: 0x1E05, + 0x00420331: 0x1E06, + 0x00620331: 0x1E07, + 0x00C70301: 0x1E08, + 0x00E70301: 0x1E09, + 0x00440307: 0x1E0A, + 0x00640307: 0x1E0B, + 0x00440323: 0x1E0C, + 0x00640323: 0x1E0D, + 0x00440331: 0x1E0E, + 0x00640331: 0x1E0F, + 0x00440327: 0x1E10, + 0x00640327: 0x1E11, + 0x0044032D: 0x1E12, + 0x0064032D: 0x1E13, + 0x01120300: 0x1E14, + 0x01130300: 0x1E15, + 0x01120301: 0x1E16, + 0x01130301: 0x1E17, + 0x0045032D: 0x1E18, + 0x0065032D: 0x1E19, + 0x00450330: 0x1E1A, + 0x00650330: 0x1E1B, + 0x02280306: 0x1E1C, + 0x02290306: 0x1E1D, + 0x00460307: 0x1E1E, + 0x00660307: 0x1E1F, + 0x00470304: 0x1E20, + 0x00670304: 0x1E21, + 0x00480307: 0x1E22, + 0x00680307: 0x1E23, + 0x00480323: 0x1E24, + 0x00680323: 0x1E25, + 0x00480308: 0x1E26, + 0x00680308: 0x1E27, + 0x00480327: 0x1E28, + 0x00680327: 0x1E29, + 0x0048032E: 0x1E2A, + 0x0068032E: 0x1E2B, + 0x00490330: 0x1E2C, + 0x00690330: 0x1E2D, + 0x00CF0301: 0x1E2E, + 0x00EF0301: 0x1E2F, + 0x004B0301: 0x1E30, + 0x006B0301: 0x1E31, + 0x004B0323: 0x1E32, + 0x006B0323: 0x1E33, + 0x004B0331: 0x1E34, + 0x006B0331: 0x1E35, + 0x004C0323: 0x1E36, + 0x006C0323: 0x1E37, + 0x1E360304: 0x1E38, + 0x1E370304: 0x1E39, + 0x004C0331: 0x1E3A, + 0x006C0331: 0x1E3B, + 0x004C032D: 0x1E3C, + 0x006C032D: 0x1E3D, + 0x004D0301: 0x1E3E, + 0x006D0301: 0x1E3F, + 0x004D0307: 0x1E40, + 0x006D0307: 0x1E41, + 0x004D0323: 0x1E42, + 0x006D0323: 0x1E43, + 0x004E0307: 0x1E44, + 0x006E0307: 0x1E45, + 0x004E0323: 0x1E46, + 0x006E0323: 0x1E47, + 0x004E0331: 0x1E48, + 0x006E0331: 0x1E49, + 0x004E032D: 0x1E4A, + 0x006E032D: 0x1E4B, + 0x00D50301: 0x1E4C, + 0x00F50301: 0x1E4D, + 0x00D50308: 0x1E4E, + 0x00F50308: 0x1E4F, + 0x014C0300: 0x1E50, + 0x014D0300: 0x1E51, + 0x014C0301: 0x1E52, + 0x014D0301: 0x1E53, + 0x00500301: 0x1E54, + 0x00700301: 0x1E55, + 0x00500307: 0x1E56, + 0x00700307: 0x1E57, + 0x00520307: 0x1E58, + 0x00720307: 0x1E59, + 0x00520323: 0x1E5A, + 0x00720323: 0x1E5B, + 0x1E5A0304: 0x1E5C, + 0x1E5B0304: 0x1E5D, + 0x00520331: 0x1E5E, + 0x00720331: 0x1E5F, + 0x00530307: 0x1E60, + 0x00730307: 0x1E61, + 0x00530323: 0x1E62, + 0x00730323: 0x1E63, + 0x015A0307: 0x1E64, + 0x015B0307: 0x1E65, + 0x01600307: 0x1E66, + 0x01610307: 0x1E67, + 0x1E620307: 0x1E68, + 0x1E630307: 0x1E69, + 0x00540307: 0x1E6A, + 0x00740307: 0x1E6B, + 0x00540323: 0x1E6C, + 0x00740323: 0x1E6D, + 0x00540331: 0x1E6E, + 0x00740331: 0x1E6F, + 0x0054032D: 0x1E70, + 0x0074032D: 0x1E71, + 0x00550324: 0x1E72, + 0x00750324: 0x1E73, + 0x00550330: 0x1E74, + 0x00750330: 0x1E75, + 0x0055032D: 0x1E76, + 0x0075032D: 0x1E77, + 0x01680301: 0x1E78, + 0x01690301: 0x1E79, + 0x016A0308: 0x1E7A, + 0x016B0308: 0x1E7B, + 0x00560303: 0x1E7C, + 0x00760303: 0x1E7D, + 0x00560323: 0x1E7E, + 0x00760323: 0x1E7F, + 0x00570300: 0x1E80, + 0x00770300: 0x1E81, + 0x00570301: 0x1E82, + 0x00770301: 0x1E83, + 0x00570308: 0x1E84, + 0x00770308: 0x1E85, + 0x00570307: 0x1E86, + 0x00770307: 0x1E87, + 0x00570323: 0x1E88, + 0x00770323: 0x1E89, + 0x00580307: 0x1E8A, + 0x00780307: 0x1E8B, + 0x00580308: 0x1E8C, + 0x00780308: 0x1E8D, + 0x00590307: 0x1E8E, + 0x00790307: 0x1E8F, + 0x005A0302: 0x1E90, + 0x007A0302: 0x1E91, + 0x005A0323: 0x1E92, + 0x007A0323: 0x1E93, + 0x005A0331: 0x1E94, + 0x007A0331: 0x1E95, + 0x00680331: 0x1E96, + 0x00740308: 0x1E97, + 0x0077030A: 0x1E98, + 0x0079030A: 0x1E99, + 0x017F0307: 0x1E9B, + 0x00410323: 0x1EA0, + 0x00610323: 0x1EA1, + 0x00410309: 0x1EA2, + 0x00610309: 0x1EA3, + 0x00C20301: 0x1EA4, + 0x00E20301: 0x1EA5, + 0x00C20300: 0x1EA6, + 0x00E20300: 0x1EA7, + 0x00C20309: 0x1EA8, + 0x00E20309: 0x1EA9, + 0x00C20303: 0x1EAA, + 0x00E20303: 0x1EAB, + 0x1EA00302: 0x1EAC, + 0x1EA10302: 0x1EAD, + 0x01020301: 0x1EAE, + 0x01030301: 0x1EAF, + 0x01020300: 0x1EB0, + 0x01030300: 0x1EB1, + 0x01020309: 0x1EB2, + 0x01030309: 0x1EB3, + 0x01020303: 0x1EB4, + 0x01030303: 0x1EB5, + 0x1EA00306: 0x1EB6, + 0x1EA10306: 0x1EB7, + 0x00450323: 0x1EB8, + 0x00650323: 0x1EB9, + 0x00450309: 0x1EBA, + 0x00650309: 0x1EBB, + 0x00450303: 0x1EBC, + 0x00650303: 0x1EBD, + 0x00CA0301: 0x1EBE, + 0x00EA0301: 0x1EBF, + 0x00CA0300: 0x1EC0, + 0x00EA0300: 0x1EC1, + 0x00CA0309: 0x1EC2, + 0x00EA0309: 0x1EC3, + 0x00CA0303: 0x1EC4, + 0x00EA0303: 0x1EC5, + 0x1EB80302: 0x1EC6, + 0x1EB90302: 0x1EC7, + 0x00490309: 0x1EC8, + 0x00690309: 0x1EC9, + 0x00490323: 0x1ECA, + 0x00690323: 0x1ECB, + 0x004F0323: 0x1ECC, + 0x006F0323: 0x1ECD, + 0x004F0309: 0x1ECE, + 0x006F0309: 0x1ECF, + 0x00D40301: 0x1ED0, + 0x00F40301: 0x1ED1, + 0x00D40300: 0x1ED2, + 0x00F40300: 0x1ED3, + 0x00D40309: 0x1ED4, + 0x00F40309: 0x1ED5, + 0x00D40303: 0x1ED6, + 0x00F40303: 0x1ED7, + 0x1ECC0302: 0x1ED8, + 0x1ECD0302: 0x1ED9, + 0x01A00301: 0x1EDA, + 0x01A10301: 0x1EDB, + 0x01A00300: 0x1EDC, + 0x01A10300: 0x1EDD, + 0x01A00309: 0x1EDE, + 0x01A10309: 0x1EDF, + 0x01A00303: 0x1EE0, + 0x01A10303: 0x1EE1, + 0x01A00323: 0x1EE2, + 0x01A10323: 0x1EE3, + 0x00550323: 0x1EE4, + 0x00750323: 0x1EE5, + 0x00550309: 0x1EE6, + 0x00750309: 0x1EE7, + 0x01AF0301: 0x1EE8, + 0x01B00301: 0x1EE9, + 0x01AF0300: 0x1EEA, + 0x01B00300: 0x1EEB, + 0x01AF0309: 0x1EEC, + 0x01B00309: 0x1EED, + 0x01AF0303: 0x1EEE, + 0x01B00303: 0x1EEF, + 0x01AF0323: 0x1EF0, + 0x01B00323: 0x1EF1, + 0x00590300: 0x1EF2, + 0x00790300: 0x1EF3, + 0x00590323: 0x1EF4, + 0x00790323: 0x1EF5, + 0x00590309: 0x1EF6, + 0x00790309: 0x1EF7, + 0x00590303: 0x1EF8, + 0x00790303: 0x1EF9, + 0x03B10313: 0x1F00, + 0x03B10314: 0x1F01, + 0x1F000300: 0x1F02, + 0x1F010300: 0x1F03, + 0x1F000301: 0x1F04, + 0x1F010301: 0x1F05, + 0x1F000342: 0x1F06, + 0x1F010342: 0x1F07, + 0x03910313: 0x1F08, + 0x03910314: 0x1F09, + 0x1F080300: 0x1F0A, + 0x1F090300: 0x1F0B, + 0x1F080301: 0x1F0C, + 0x1F090301: 0x1F0D, + 0x1F080342: 0x1F0E, + 0x1F090342: 0x1F0F, + 0x03B50313: 0x1F10, + 0x03B50314: 0x1F11, + 0x1F100300: 0x1F12, + 0x1F110300: 0x1F13, + 0x1F100301: 0x1F14, + 0x1F110301: 0x1F15, + 0x03950313: 0x1F18, + 0x03950314: 0x1F19, + 0x1F180300: 0x1F1A, + 0x1F190300: 0x1F1B, + 0x1F180301: 0x1F1C, + 0x1F190301: 0x1F1D, + 0x03B70313: 0x1F20, + 0x03B70314: 0x1F21, + 0x1F200300: 0x1F22, + 0x1F210300: 0x1F23, + 0x1F200301: 0x1F24, + 0x1F210301: 0x1F25, + 0x1F200342: 0x1F26, + 0x1F210342: 0x1F27, + 0x03970313: 0x1F28, + 0x03970314: 0x1F29, + 0x1F280300: 0x1F2A, + 0x1F290300: 0x1F2B, + 0x1F280301: 0x1F2C, + 0x1F290301: 0x1F2D, + 0x1F280342: 0x1F2E, + 0x1F290342: 0x1F2F, + 0x03B90313: 0x1F30, + 0x03B90314: 0x1F31, + 0x1F300300: 0x1F32, + 0x1F310300: 0x1F33, + 0x1F300301: 0x1F34, + 0x1F310301: 0x1F35, + 0x1F300342: 0x1F36, + 0x1F310342: 0x1F37, + 0x03990313: 0x1F38, + 0x03990314: 0x1F39, + 0x1F380300: 0x1F3A, + 0x1F390300: 0x1F3B, + 0x1F380301: 0x1F3C, + 0x1F390301: 0x1F3D, + 0x1F380342: 0x1F3E, + 0x1F390342: 0x1F3F, + 0x03BF0313: 0x1F40, + 0x03BF0314: 0x1F41, + 0x1F400300: 0x1F42, + 0x1F410300: 0x1F43, + 0x1F400301: 0x1F44, + 0x1F410301: 0x1F45, + 0x039F0313: 0x1F48, + 0x039F0314: 0x1F49, + 0x1F480300: 0x1F4A, + 0x1F490300: 0x1F4B, + 0x1F480301: 0x1F4C, + 0x1F490301: 0x1F4D, + 0x03C50313: 0x1F50, + 0x03C50314: 0x1F51, + 0x1F500300: 0x1F52, + 0x1F510300: 0x1F53, + 0x1F500301: 0x1F54, + 0x1F510301: 0x1F55, + 0x1F500342: 0x1F56, + 0x1F510342: 0x1F57, + 0x03A50314: 0x1F59, + 0x1F590300: 0x1F5B, + 0x1F590301: 0x1F5D, + 0x1F590342: 0x1F5F, + 0x03C90313: 0x1F60, + 0x03C90314: 0x1F61, + 0x1F600300: 0x1F62, + 0x1F610300: 0x1F63, + 0x1F600301: 0x1F64, + 0x1F610301: 0x1F65, + 0x1F600342: 0x1F66, + 0x1F610342: 0x1F67, + 0x03A90313: 0x1F68, + 0x03A90314: 0x1F69, + 0x1F680300: 0x1F6A, + 0x1F690300: 0x1F6B, + 0x1F680301: 0x1F6C, + 0x1F690301: 0x1F6D, + 0x1F680342: 0x1F6E, + 0x1F690342: 0x1F6F, + 0x03B10300: 0x1F70, + 0x03B50300: 0x1F72, + 0x03B70300: 0x1F74, + 0x03B90300: 0x1F76, + 0x03BF0300: 0x1F78, + 0x03C50300: 0x1F7A, + 0x03C90300: 0x1F7C, + 0x1F000345: 0x1F80, + 0x1F010345: 0x1F81, + 0x1F020345: 0x1F82, + 0x1F030345: 0x1F83, + 0x1F040345: 0x1F84, + 0x1F050345: 0x1F85, + 0x1F060345: 0x1F86, + 0x1F070345: 0x1F87, + 0x1F080345: 0x1F88, + 0x1F090345: 0x1F89, + 0x1F0A0345: 0x1F8A, + 0x1F0B0345: 0x1F8B, + 0x1F0C0345: 0x1F8C, + 0x1F0D0345: 0x1F8D, + 0x1F0E0345: 0x1F8E, + 0x1F0F0345: 0x1F8F, + 0x1F200345: 0x1F90, + 0x1F210345: 0x1F91, + 0x1F220345: 0x1F92, + 0x1F230345: 0x1F93, + 0x1F240345: 0x1F94, + 0x1F250345: 0x1F95, + 0x1F260345: 0x1F96, + 0x1F270345: 0x1F97, + 0x1F280345: 0x1F98, + 0x1F290345: 0x1F99, + 0x1F2A0345: 0x1F9A, + 0x1F2B0345: 0x1F9B, + 0x1F2C0345: 0x1F9C, + 0x1F2D0345: 0x1F9D, + 0x1F2E0345: 0x1F9E, + 0x1F2F0345: 0x1F9F, + 0x1F600345: 0x1FA0, + 0x1F610345: 0x1FA1, + 0x1F620345: 0x1FA2, + 0x1F630345: 0x1FA3, + 0x1F640345: 0x1FA4, + 0x1F650345: 0x1FA5, + 0x1F660345: 0x1FA6, + 0x1F670345: 0x1FA7, + 0x1F680345: 0x1FA8, + 0x1F690345: 0x1FA9, + 0x1F6A0345: 0x1FAA, + 0x1F6B0345: 0x1FAB, + 0x1F6C0345: 0x1FAC, + 0x1F6D0345: 0x1FAD, + 0x1F6E0345: 0x1FAE, + 0x1F6F0345: 0x1FAF, + 0x03B10306: 0x1FB0, + 0x03B10304: 0x1FB1, + 0x1F700345: 0x1FB2, + 0x03B10345: 0x1FB3, + 0x03AC0345: 0x1FB4, + 0x03B10342: 0x1FB6, + 0x1FB60345: 0x1FB7, + 0x03910306: 0x1FB8, + 0x03910304: 0x1FB9, + 0x03910300: 0x1FBA, + 0x03910345: 0x1FBC, + 0x00A80342: 0x1FC1, + 0x1F740345: 0x1FC2, + 0x03B70345: 0x1FC3, + 0x03AE0345: 0x1FC4, + 0x03B70342: 0x1FC6, + 0x1FC60345: 0x1FC7, + 0x03950300: 0x1FC8, + 0x03970300: 0x1FCA, + 0x03970345: 0x1FCC, + 0x1FBF0300: 0x1FCD, + 0x1FBF0301: 0x1FCE, + 0x1FBF0342: 0x1FCF, + 0x03B90306: 0x1FD0, + 0x03B90304: 0x1FD1, + 0x03CA0300: 0x1FD2, + 0x03B90342: 0x1FD6, + 0x03CA0342: 0x1FD7, + 0x03990306: 0x1FD8, + 0x03990304: 0x1FD9, + 0x03990300: 0x1FDA, + 0x1FFE0300: 0x1FDD, + 0x1FFE0301: 0x1FDE, + 0x1FFE0342: 0x1FDF, + 0x03C50306: 0x1FE0, + 0x03C50304: 0x1FE1, + 0x03CB0300: 0x1FE2, + 0x03C10313: 0x1FE4, + 0x03C10314: 0x1FE5, + 0x03C50342: 0x1FE6, + 0x03CB0342: 0x1FE7, + 0x03A50306: 0x1FE8, + 0x03A50304: 0x1FE9, + 0x03A50300: 0x1FEA, + 0x03A10314: 0x1FEC, + 0x00A80300: 0x1FED, + 0x1F7C0345: 0x1FF2, + 0x03C90345: 0x1FF3, + 0x03CE0345: 0x1FF4, + 0x03C90342: 0x1FF6, + 0x1FF60345: 0x1FF7, + 0x039F0300: 0x1FF8, + 0x03A90300: 0x1FFA, + 0x03A90345: 0x1FFC, + 0x21900338: 0x219A, + 0x21920338: 0x219B, + 0x21940338: 0x21AE, + 0x21D00338: 0x21CD, + 0x21D40338: 0x21CE, + 0x21D20338: 0x21CF, + 0x22030338: 0x2204, + 0x22080338: 0x2209, + 0x220B0338: 0x220C, + 0x22230338: 0x2224, + 0x22250338: 0x2226, + 0x223C0338: 0x2241, + 0x22430338: 0x2244, + 0x22450338: 0x2247, + 0x22480338: 0x2249, + 0x003D0338: 0x2260, + 0x22610338: 0x2262, + 0x224D0338: 0x226D, + 0x003C0338: 0x226E, + 0x003E0338: 0x226F, + 0x22640338: 0x2270, + 0x22650338: 0x2271, + 0x22720338: 0x2274, + 0x22730338: 0x2275, + 0x22760338: 0x2278, + 0x22770338: 0x2279, + 0x227A0338: 0x2280, + 0x227B0338: 0x2281, + 0x22820338: 0x2284, + 0x22830338: 0x2285, + 0x22860338: 0x2288, + 0x22870338: 0x2289, + 0x22A20338: 0x22AC, + 0x22A80338: 0x22AD, + 0x22A90338: 0x22AE, + 0x22AB0338: 0x22AF, + 0x227C0338: 0x22E0, + 0x227D0338: 0x22E1, + 0x22910338: 0x22E2, + 0x22920338: 0x22E3, + 0x22B20338: 0x22EA, + 0x22B30338: 0x22EB, + 0x22B40338: 0x22EC, + 0x22B50338: 0x22ED, + 0x304B3099: 0x304C, + 0x304D3099: 0x304E, + 0x304F3099: 0x3050, + 0x30513099: 0x3052, + 0x30533099: 0x3054, + 0x30553099: 0x3056, + 0x30573099: 0x3058, + 0x30593099: 0x305A, + 0x305B3099: 0x305C, + 0x305D3099: 0x305E, + 0x305F3099: 0x3060, + 0x30613099: 0x3062, + 0x30643099: 0x3065, + 0x30663099: 0x3067, + 0x30683099: 0x3069, + 0x306F3099: 0x3070, + 0x306F309A: 0x3071, + 0x30723099: 0x3073, + 0x3072309A: 0x3074, + 0x30753099: 0x3076, + 0x3075309A: 0x3077, + 0x30783099: 0x3079, + 0x3078309A: 0x307A, + 0x307B3099: 0x307C, + 0x307B309A: 0x307D, + 0x30463099: 0x3094, + 0x309D3099: 0x309E, + 0x30AB3099: 0x30AC, + 0x30AD3099: 0x30AE, + 0x30AF3099: 0x30B0, + 0x30B13099: 0x30B2, + 0x30B33099: 0x30B4, + 0x30B53099: 0x30B6, + 0x30B73099: 0x30B8, + 0x30B93099: 0x30BA, + 0x30BB3099: 0x30BC, + 0x30BD3099: 0x30BE, + 0x30BF3099: 0x30C0, + 0x30C13099: 0x30C2, + 0x30C43099: 0x30C5, + 0x30C63099: 0x30C7, + 0x30C83099: 0x30C9, + 0x30CF3099: 0x30D0, + 0x30CF309A: 0x30D1, + 0x30D23099: 0x30D3, + 0x30D2309A: 0x30D4, + 0x30D53099: 0x30D6, + 0x30D5309A: 0x30D7, + 0x30D83099: 0x30D9, + 0x30D8309A: 0x30DA, + 0x30DB3099: 0x30DC, + 0x30DB309A: 0x30DD, + 0x30A63099: 0x30F4, + 0x30EF3099: 0x30F7, + 0x30F03099: 0x30F8, + 0x30F13099: 0x30F9, + 0x30F23099: 0x30FA, + 0x30FD3099: 0x30FE, + 0x109910BA: 0x1109A, + 0x109B10BA: 0x1109C, + 0x10A510BA: 0x110AB, + 0x11311127: 0x1112E, + 0x11321127: 0x1112F, + 0x1347133E: 0x1134B, + 0x13471357: 0x1134C, + 0x14B914BA: 0x114BB, + 0x14B914B0: 0x114BC, + 0x14B914BD: 0x114BE, + 0x15B815AF: 0x115BA, + 0x15B915AF: 0x115BB, +} -const recompMapPacked = "" + - "\x00A\x03\x00\x00\x00\x00\xc0" + // 0x00410300: 0x000000C0 - "\x00A\x03\x01\x00\x00\x00\xc1" + // 0x00410301: 0x000000C1 - "\x00A\x03\x02\x00\x00\x00\xc2" + // 0x00410302: 0x000000C2 - "\x00A\x03\x03\x00\x00\x00\xc3" + // 0x00410303: 0x000000C3 - "\x00A\x03\b\x00\x00\x00\xc4" + // 0x00410308: 0x000000C4 - "\x00A\x03\n\x00\x00\x00\xc5" + // 0x0041030A: 0x000000C5 - "\x00C\x03'\x00\x00\x00\xc7" + // 0x00430327: 0x000000C7 - "\x00E\x03\x00\x00\x00\x00\xc8" + // 0x00450300: 0x000000C8 - "\x00E\x03\x01\x00\x00\x00\xc9" + // 0x00450301: 0x000000C9 - "\x00E\x03\x02\x00\x00\x00\xca" + // 0x00450302: 0x000000CA - "\x00E\x03\b\x00\x00\x00\xcb" + // 0x00450308: 0x000000CB - "\x00I\x03\x00\x00\x00\x00\xcc" + // 0x00490300: 0x000000CC - "\x00I\x03\x01\x00\x00\x00\xcd" + // 0x00490301: 0x000000CD - "\x00I\x03\x02\x00\x00\x00\xce" + // 0x00490302: 0x000000CE - "\x00I\x03\b\x00\x00\x00\xcf" + // 0x00490308: 0x000000CF - "\x00N\x03\x03\x00\x00\x00\xd1" + // 0x004E0303: 0x000000D1 - "\x00O\x03\x00\x00\x00\x00\xd2" + // 0x004F0300: 0x000000D2 - "\x00O\x03\x01\x00\x00\x00\xd3" + // 0x004F0301: 0x000000D3 - "\x00O\x03\x02\x00\x00\x00\xd4" + // 0x004F0302: 0x000000D4 - "\x00O\x03\x03\x00\x00\x00\xd5" + // 0x004F0303: 0x000000D5 - "\x00O\x03\b\x00\x00\x00\xd6" + // 0x004F0308: 0x000000D6 - "\x00U\x03\x00\x00\x00\x00\xd9" + // 0x00550300: 0x000000D9 - "\x00U\x03\x01\x00\x00\x00\xda" + // 0x00550301: 0x000000DA - "\x00U\x03\x02\x00\x00\x00\xdb" + // 0x00550302: 0x000000DB - "\x00U\x03\b\x00\x00\x00\xdc" + // 0x00550308: 0x000000DC - "\x00Y\x03\x01\x00\x00\x00\xdd" + // 0x00590301: 0x000000DD - "\x00a\x03\x00\x00\x00\x00\xe0" + // 0x00610300: 0x000000E0 - "\x00a\x03\x01\x00\x00\x00\xe1" + // 0x00610301: 0x000000E1 - "\x00a\x03\x02\x00\x00\x00\xe2" + // 0x00610302: 0x000000E2 - "\x00a\x03\x03\x00\x00\x00\xe3" + // 0x00610303: 0x000000E3 - "\x00a\x03\b\x00\x00\x00\xe4" + // 0x00610308: 0x000000E4 - "\x00a\x03\n\x00\x00\x00\xe5" + // 0x0061030A: 0x000000E5 - "\x00c\x03'\x00\x00\x00\xe7" + // 0x00630327: 0x000000E7 - "\x00e\x03\x00\x00\x00\x00\xe8" + // 0x00650300: 0x000000E8 - "\x00e\x03\x01\x00\x00\x00\xe9" + // 0x00650301: 0x000000E9 - "\x00e\x03\x02\x00\x00\x00\xea" + // 0x00650302: 0x000000EA - "\x00e\x03\b\x00\x00\x00\xeb" + // 0x00650308: 0x000000EB - "\x00i\x03\x00\x00\x00\x00\xec" + // 0x00690300: 0x000000EC - "\x00i\x03\x01\x00\x00\x00\xed" + // 0x00690301: 0x000000ED - "\x00i\x03\x02\x00\x00\x00\xee" + // 0x00690302: 0x000000EE - "\x00i\x03\b\x00\x00\x00\xef" + // 0x00690308: 0x000000EF - "\x00n\x03\x03\x00\x00\x00\xf1" + // 0x006E0303: 0x000000F1 - "\x00o\x03\x00\x00\x00\x00\xf2" + // 0x006F0300: 0x000000F2 - "\x00o\x03\x01\x00\x00\x00\xf3" + // 0x006F0301: 0x000000F3 - "\x00o\x03\x02\x00\x00\x00\xf4" + // 0x006F0302: 0x000000F4 - "\x00o\x03\x03\x00\x00\x00\xf5" + // 0x006F0303: 0x000000F5 - "\x00o\x03\b\x00\x00\x00\xf6" + // 0x006F0308: 0x000000F6 - "\x00u\x03\x00\x00\x00\x00\xf9" + // 0x00750300: 0x000000F9 - "\x00u\x03\x01\x00\x00\x00\xfa" + // 0x00750301: 0x000000FA - "\x00u\x03\x02\x00\x00\x00\xfb" + // 0x00750302: 0x000000FB - "\x00u\x03\b\x00\x00\x00\xfc" + // 0x00750308: 0x000000FC - "\x00y\x03\x01\x00\x00\x00\xfd" + // 0x00790301: 0x000000FD - "\x00y\x03\b\x00\x00\x00\xff" + // 0x00790308: 0x000000FF - "\x00A\x03\x04\x00\x00\x01\x00" + // 0x00410304: 0x00000100 - "\x00a\x03\x04\x00\x00\x01\x01" + // 0x00610304: 0x00000101 - "\x00A\x03\x06\x00\x00\x01\x02" + // 0x00410306: 0x00000102 - "\x00a\x03\x06\x00\x00\x01\x03" + // 0x00610306: 0x00000103 - "\x00A\x03(\x00\x00\x01\x04" + // 0x00410328: 0x00000104 - "\x00a\x03(\x00\x00\x01\x05" + // 0x00610328: 0x00000105 - "\x00C\x03\x01\x00\x00\x01\x06" + // 0x00430301: 0x00000106 - "\x00c\x03\x01\x00\x00\x01\a" + // 0x00630301: 0x00000107 - "\x00C\x03\x02\x00\x00\x01\b" + // 0x00430302: 0x00000108 - "\x00c\x03\x02\x00\x00\x01\t" + // 0x00630302: 0x00000109 - "\x00C\x03\a\x00\x00\x01\n" + // 0x00430307: 0x0000010A - "\x00c\x03\a\x00\x00\x01\v" + // 0x00630307: 0x0000010B - "\x00C\x03\f\x00\x00\x01\f" + // 0x0043030C: 0x0000010C - "\x00c\x03\f\x00\x00\x01\r" + // 0x0063030C: 0x0000010D - "\x00D\x03\f\x00\x00\x01\x0e" + // 0x0044030C: 0x0000010E - "\x00d\x03\f\x00\x00\x01\x0f" + // 0x0064030C: 0x0000010F - "\x00E\x03\x04\x00\x00\x01\x12" + // 0x00450304: 0x00000112 - "\x00e\x03\x04\x00\x00\x01\x13" + // 0x00650304: 0x00000113 - "\x00E\x03\x06\x00\x00\x01\x14" + // 0x00450306: 0x00000114 - "\x00e\x03\x06\x00\x00\x01\x15" + // 0x00650306: 0x00000115 - "\x00E\x03\a\x00\x00\x01\x16" + // 0x00450307: 0x00000116 - "\x00e\x03\a\x00\x00\x01\x17" + // 0x00650307: 0x00000117 - "\x00E\x03(\x00\x00\x01\x18" + // 0x00450328: 0x00000118 - "\x00e\x03(\x00\x00\x01\x19" + // 0x00650328: 0x00000119 - "\x00E\x03\f\x00\x00\x01\x1a" + // 0x0045030C: 0x0000011A - "\x00e\x03\f\x00\x00\x01\x1b" + // 0x0065030C: 0x0000011B - "\x00G\x03\x02\x00\x00\x01\x1c" + // 0x00470302: 0x0000011C - "\x00g\x03\x02\x00\x00\x01\x1d" + // 0x00670302: 0x0000011D - "\x00G\x03\x06\x00\x00\x01\x1e" + // 0x00470306: 0x0000011E - "\x00g\x03\x06\x00\x00\x01\x1f" + // 0x00670306: 0x0000011F - "\x00G\x03\a\x00\x00\x01 " + // 0x00470307: 0x00000120 - "\x00g\x03\a\x00\x00\x01!" + // 0x00670307: 0x00000121 - "\x00G\x03'\x00\x00\x01\"" + // 0x00470327: 0x00000122 - "\x00g\x03'\x00\x00\x01#" + // 0x00670327: 0x00000123 - "\x00H\x03\x02\x00\x00\x01$" + // 0x00480302: 0x00000124 - "\x00h\x03\x02\x00\x00\x01%" + // 0x00680302: 0x00000125 - "\x00I\x03\x03\x00\x00\x01(" + // 0x00490303: 0x00000128 - "\x00i\x03\x03\x00\x00\x01)" + // 0x00690303: 0x00000129 - "\x00I\x03\x04\x00\x00\x01*" + // 0x00490304: 0x0000012A - "\x00i\x03\x04\x00\x00\x01+" + // 0x00690304: 0x0000012B - "\x00I\x03\x06\x00\x00\x01," + // 0x00490306: 0x0000012C - "\x00i\x03\x06\x00\x00\x01-" + // 0x00690306: 0x0000012D - "\x00I\x03(\x00\x00\x01." + // 0x00490328: 0x0000012E - "\x00i\x03(\x00\x00\x01/" + // 0x00690328: 0x0000012F - "\x00I\x03\a\x00\x00\x010" + // 0x00490307: 0x00000130 - "\x00J\x03\x02\x00\x00\x014" + // 0x004A0302: 0x00000134 - "\x00j\x03\x02\x00\x00\x015" + // 0x006A0302: 0x00000135 - "\x00K\x03'\x00\x00\x016" + // 0x004B0327: 0x00000136 - "\x00k\x03'\x00\x00\x017" + // 0x006B0327: 0x00000137 - "\x00L\x03\x01\x00\x00\x019" + // 0x004C0301: 0x00000139 - "\x00l\x03\x01\x00\x00\x01:" + // 0x006C0301: 0x0000013A - "\x00L\x03'\x00\x00\x01;" + // 0x004C0327: 0x0000013B - "\x00l\x03'\x00\x00\x01<" + // 0x006C0327: 0x0000013C - "\x00L\x03\f\x00\x00\x01=" + // 0x004C030C: 0x0000013D - "\x00l\x03\f\x00\x00\x01>" + // 0x006C030C: 0x0000013E - "\x00N\x03\x01\x00\x00\x01C" + // 0x004E0301: 0x00000143 - "\x00n\x03\x01\x00\x00\x01D" + // 0x006E0301: 0x00000144 - "\x00N\x03'\x00\x00\x01E" + // 0x004E0327: 0x00000145 - "\x00n\x03'\x00\x00\x01F" + // 0x006E0327: 0x00000146 - "\x00N\x03\f\x00\x00\x01G" + // 0x004E030C: 0x00000147 - "\x00n\x03\f\x00\x00\x01H" + // 0x006E030C: 0x00000148 - "\x00O\x03\x04\x00\x00\x01L" + // 0x004F0304: 0x0000014C - "\x00o\x03\x04\x00\x00\x01M" + // 0x006F0304: 0x0000014D - "\x00O\x03\x06\x00\x00\x01N" + // 0x004F0306: 0x0000014E - "\x00o\x03\x06\x00\x00\x01O" + // 0x006F0306: 0x0000014F - "\x00O\x03\v\x00\x00\x01P" + // 0x004F030B: 0x00000150 - "\x00o\x03\v\x00\x00\x01Q" + // 0x006F030B: 0x00000151 - "\x00R\x03\x01\x00\x00\x01T" + // 0x00520301: 0x00000154 - "\x00r\x03\x01\x00\x00\x01U" + // 0x00720301: 0x00000155 - "\x00R\x03'\x00\x00\x01V" + // 0x00520327: 0x00000156 - "\x00r\x03'\x00\x00\x01W" + // 0x00720327: 0x00000157 - "\x00R\x03\f\x00\x00\x01X" + // 0x0052030C: 0x00000158 - "\x00r\x03\f\x00\x00\x01Y" + // 0x0072030C: 0x00000159 - "\x00S\x03\x01\x00\x00\x01Z" + // 0x00530301: 0x0000015A - "\x00s\x03\x01\x00\x00\x01[" + // 0x00730301: 0x0000015B - "\x00S\x03\x02\x00\x00\x01\\" + // 0x00530302: 0x0000015C - "\x00s\x03\x02\x00\x00\x01]" + // 0x00730302: 0x0000015D - "\x00S\x03'\x00\x00\x01^" + // 0x00530327: 0x0000015E - "\x00s\x03'\x00\x00\x01_" + // 0x00730327: 0x0000015F - "\x00S\x03\f\x00\x00\x01`" + // 0x0053030C: 0x00000160 - "\x00s\x03\f\x00\x00\x01a" + // 0x0073030C: 0x00000161 - "\x00T\x03'\x00\x00\x01b" + // 0x00540327: 0x00000162 - "\x00t\x03'\x00\x00\x01c" + // 0x00740327: 0x00000163 - "\x00T\x03\f\x00\x00\x01d" + // 0x0054030C: 0x00000164 - "\x00t\x03\f\x00\x00\x01e" + // 0x0074030C: 0x00000165 - "\x00U\x03\x03\x00\x00\x01h" + // 0x00550303: 0x00000168 - "\x00u\x03\x03\x00\x00\x01i" + // 0x00750303: 0x00000169 - "\x00U\x03\x04\x00\x00\x01j" + // 0x00550304: 0x0000016A - "\x00u\x03\x04\x00\x00\x01k" + // 0x00750304: 0x0000016B - "\x00U\x03\x06\x00\x00\x01l" + // 0x00550306: 0x0000016C - "\x00u\x03\x06\x00\x00\x01m" + // 0x00750306: 0x0000016D - "\x00U\x03\n\x00\x00\x01n" + // 0x0055030A: 0x0000016E - "\x00u\x03\n\x00\x00\x01o" + // 0x0075030A: 0x0000016F - "\x00U\x03\v\x00\x00\x01p" + // 0x0055030B: 0x00000170 - "\x00u\x03\v\x00\x00\x01q" + // 0x0075030B: 0x00000171 - "\x00U\x03(\x00\x00\x01r" + // 0x00550328: 0x00000172 - "\x00u\x03(\x00\x00\x01s" + // 0x00750328: 0x00000173 - "\x00W\x03\x02\x00\x00\x01t" + // 0x00570302: 0x00000174 - "\x00w\x03\x02\x00\x00\x01u" + // 0x00770302: 0x00000175 - "\x00Y\x03\x02\x00\x00\x01v" + // 0x00590302: 0x00000176 - "\x00y\x03\x02\x00\x00\x01w" + // 0x00790302: 0x00000177 - "\x00Y\x03\b\x00\x00\x01x" + // 0x00590308: 0x00000178 - "\x00Z\x03\x01\x00\x00\x01y" + // 0x005A0301: 0x00000179 - "\x00z\x03\x01\x00\x00\x01z" + // 0x007A0301: 0x0000017A - "\x00Z\x03\a\x00\x00\x01{" + // 0x005A0307: 0x0000017B - "\x00z\x03\a\x00\x00\x01|" + // 0x007A0307: 0x0000017C - "\x00Z\x03\f\x00\x00\x01}" + // 0x005A030C: 0x0000017D - "\x00z\x03\f\x00\x00\x01~" + // 0x007A030C: 0x0000017E - "\x00O\x03\x1b\x00\x00\x01\xa0" + // 0x004F031B: 0x000001A0 - "\x00o\x03\x1b\x00\x00\x01\xa1" + // 0x006F031B: 0x000001A1 - "\x00U\x03\x1b\x00\x00\x01\xaf" + // 0x0055031B: 0x000001AF - "\x00u\x03\x1b\x00\x00\x01\xb0" + // 0x0075031B: 0x000001B0 - "\x00A\x03\f\x00\x00\x01\xcd" + // 0x0041030C: 0x000001CD - "\x00a\x03\f\x00\x00\x01\xce" + // 0x0061030C: 0x000001CE - "\x00I\x03\f\x00\x00\x01\xcf" + // 0x0049030C: 0x000001CF - "\x00i\x03\f\x00\x00\x01\xd0" + // 0x0069030C: 0x000001D0 - "\x00O\x03\f\x00\x00\x01\xd1" + // 0x004F030C: 0x000001D1 - "\x00o\x03\f\x00\x00\x01\xd2" + // 0x006F030C: 0x000001D2 - "\x00U\x03\f\x00\x00\x01\xd3" + // 0x0055030C: 0x000001D3 - "\x00u\x03\f\x00\x00\x01\xd4" + // 0x0075030C: 0x000001D4 - "\x00\xdc\x03\x04\x00\x00\x01\xd5" + // 0x00DC0304: 0x000001D5 - "\x00\xfc\x03\x04\x00\x00\x01\xd6" + // 0x00FC0304: 0x000001D6 - "\x00\xdc\x03\x01\x00\x00\x01\xd7" + // 0x00DC0301: 0x000001D7 - "\x00\xfc\x03\x01\x00\x00\x01\xd8" + // 0x00FC0301: 0x000001D8 - "\x00\xdc\x03\f\x00\x00\x01\xd9" + // 0x00DC030C: 0x000001D9 - "\x00\xfc\x03\f\x00\x00\x01\xda" + // 0x00FC030C: 0x000001DA - "\x00\xdc\x03\x00\x00\x00\x01\xdb" + // 0x00DC0300: 0x000001DB - "\x00\xfc\x03\x00\x00\x00\x01\xdc" + // 0x00FC0300: 0x000001DC - "\x00\xc4\x03\x04\x00\x00\x01\xde" + // 0x00C40304: 0x000001DE - "\x00\xe4\x03\x04\x00\x00\x01\xdf" + // 0x00E40304: 0x000001DF - "\x02&\x03\x04\x00\x00\x01\xe0" + // 0x02260304: 0x000001E0 - "\x02'\x03\x04\x00\x00\x01\xe1" + // 0x02270304: 0x000001E1 - "\x00\xc6\x03\x04\x00\x00\x01\xe2" + // 0x00C60304: 0x000001E2 - "\x00\xe6\x03\x04\x00\x00\x01\xe3" + // 0x00E60304: 0x000001E3 - "\x00G\x03\f\x00\x00\x01\xe6" + // 0x0047030C: 0x000001E6 - "\x00g\x03\f\x00\x00\x01\xe7" + // 0x0067030C: 0x000001E7 - "\x00K\x03\f\x00\x00\x01\xe8" + // 0x004B030C: 0x000001E8 - "\x00k\x03\f\x00\x00\x01\xe9" + // 0x006B030C: 0x000001E9 - "\x00O\x03(\x00\x00\x01\xea" + // 0x004F0328: 0x000001EA - "\x00o\x03(\x00\x00\x01\xeb" + // 0x006F0328: 0x000001EB - "\x01\xea\x03\x04\x00\x00\x01\xec" + // 0x01EA0304: 0x000001EC - "\x01\xeb\x03\x04\x00\x00\x01\xed" + // 0x01EB0304: 0x000001ED - "\x01\xb7\x03\f\x00\x00\x01\xee" + // 0x01B7030C: 0x000001EE - "\x02\x92\x03\f\x00\x00\x01\xef" + // 0x0292030C: 0x000001EF - "\x00j\x03\f\x00\x00\x01\xf0" + // 0x006A030C: 0x000001F0 - "\x00G\x03\x01\x00\x00\x01\xf4" + // 0x00470301: 0x000001F4 - "\x00g\x03\x01\x00\x00\x01\xf5" + // 0x00670301: 0x000001F5 - "\x00N\x03\x00\x00\x00\x01\xf8" + // 0x004E0300: 0x000001F8 - "\x00n\x03\x00\x00\x00\x01\xf9" + // 0x006E0300: 0x000001F9 - "\x00\xc5\x03\x01\x00\x00\x01\xfa" + // 0x00C50301: 0x000001FA - "\x00\xe5\x03\x01\x00\x00\x01\xfb" + // 0x00E50301: 0x000001FB - "\x00\xc6\x03\x01\x00\x00\x01\xfc" + // 0x00C60301: 0x000001FC - "\x00\xe6\x03\x01\x00\x00\x01\xfd" + // 0x00E60301: 0x000001FD - "\x00\xd8\x03\x01\x00\x00\x01\xfe" + // 0x00D80301: 0x000001FE - "\x00\xf8\x03\x01\x00\x00\x01\xff" + // 0x00F80301: 0x000001FF - "\x00A\x03\x0f\x00\x00\x02\x00" + // 0x0041030F: 0x00000200 - "\x00a\x03\x0f\x00\x00\x02\x01" + // 0x0061030F: 0x00000201 - "\x00A\x03\x11\x00\x00\x02\x02" + // 0x00410311: 0x00000202 - "\x00a\x03\x11\x00\x00\x02\x03" + // 0x00610311: 0x00000203 - "\x00E\x03\x0f\x00\x00\x02\x04" + // 0x0045030F: 0x00000204 - "\x00e\x03\x0f\x00\x00\x02\x05" + // 0x0065030F: 0x00000205 - "\x00E\x03\x11\x00\x00\x02\x06" + // 0x00450311: 0x00000206 - "\x00e\x03\x11\x00\x00\x02\a" + // 0x00650311: 0x00000207 - "\x00I\x03\x0f\x00\x00\x02\b" + // 0x0049030F: 0x00000208 - "\x00i\x03\x0f\x00\x00\x02\t" + // 0x0069030F: 0x00000209 - "\x00I\x03\x11\x00\x00\x02\n" + // 0x00490311: 0x0000020A - "\x00i\x03\x11\x00\x00\x02\v" + // 0x00690311: 0x0000020B - "\x00O\x03\x0f\x00\x00\x02\f" + // 0x004F030F: 0x0000020C - "\x00o\x03\x0f\x00\x00\x02\r" + // 0x006F030F: 0x0000020D - "\x00O\x03\x11\x00\x00\x02\x0e" + // 0x004F0311: 0x0000020E - "\x00o\x03\x11\x00\x00\x02\x0f" + // 0x006F0311: 0x0000020F - "\x00R\x03\x0f\x00\x00\x02\x10" + // 0x0052030F: 0x00000210 - "\x00r\x03\x0f\x00\x00\x02\x11" + // 0x0072030F: 0x00000211 - "\x00R\x03\x11\x00\x00\x02\x12" + // 0x00520311: 0x00000212 - "\x00r\x03\x11\x00\x00\x02\x13" + // 0x00720311: 0x00000213 - "\x00U\x03\x0f\x00\x00\x02\x14" + // 0x0055030F: 0x00000214 - "\x00u\x03\x0f\x00\x00\x02\x15" + // 0x0075030F: 0x00000215 - "\x00U\x03\x11\x00\x00\x02\x16" + // 0x00550311: 0x00000216 - "\x00u\x03\x11\x00\x00\x02\x17" + // 0x00750311: 0x00000217 - "\x00S\x03&\x00\x00\x02\x18" + // 0x00530326: 0x00000218 - "\x00s\x03&\x00\x00\x02\x19" + // 0x00730326: 0x00000219 - "\x00T\x03&\x00\x00\x02\x1a" + // 0x00540326: 0x0000021A - "\x00t\x03&\x00\x00\x02\x1b" + // 0x00740326: 0x0000021B - "\x00H\x03\f\x00\x00\x02\x1e" + // 0x0048030C: 0x0000021E - "\x00h\x03\f\x00\x00\x02\x1f" + // 0x0068030C: 0x0000021F - "\x00A\x03\a\x00\x00\x02&" + // 0x00410307: 0x00000226 - "\x00a\x03\a\x00\x00\x02'" + // 0x00610307: 0x00000227 - "\x00E\x03'\x00\x00\x02(" + // 0x00450327: 0x00000228 - "\x00e\x03'\x00\x00\x02)" + // 0x00650327: 0x00000229 - "\x00\xd6\x03\x04\x00\x00\x02*" + // 0x00D60304: 0x0000022A - "\x00\xf6\x03\x04\x00\x00\x02+" + // 0x00F60304: 0x0000022B - "\x00\xd5\x03\x04\x00\x00\x02," + // 0x00D50304: 0x0000022C - "\x00\xf5\x03\x04\x00\x00\x02-" + // 0x00F50304: 0x0000022D - "\x00O\x03\a\x00\x00\x02." + // 0x004F0307: 0x0000022E - "\x00o\x03\a\x00\x00\x02/" + // 0x006F0307: 0x0000022F - "\x02.\x03\x04\x00\x00\x020" + // 0x022E0304: 0x00000230 - "\x02/\x03\x04\x00\x00\x021" + // 0x022F0304: 0x00000231 - "\x00Y\x03\x04\x00\x00\x022" + // 0x00590304: 0x00000232 - "\x00y\x03\x04\x00\x00\x023" + // 0x00790304: 0x00000233 - "\x00\xa8\x03\x01\x00\x00\x03\x85" + // 0x00A80301: 0x00000385 - "\x03\x91\x03\x01\x00\x00\x03\x86" + // 0x03910301: 0x00000386 - "\x03\x95\x03\x01\x00\x00\x03\x88" + // 0x03950301: 0x00000388 - "\x03\x97\x03\x01\x00\x00\x03\x89" + // 0x03970301: 0x00000389 - "\x03\x99\x03\x01\x00\x00\x03\x8a" + // 0x03990301: 0x0000038A - "\x03\x9f\x03\x01\x00\x00\x03\x8c" + // 0x039F0301: 0x0000038C - "\x03\xa5\x03\x01\x00\x00\x03\x8e" + // 0x03A50301: 0x0000038E - "\x03\xa9\x03\x01\x00\x00\x03\x8f" + // 0x03A90301: 0x0000038F - "\x03\xca\x03\x01\x00\x00\x03\x90" + // 0x03CA0301: 0x00000390 - "\x03\x99\x03\b\x00\x00\x03\xaa" + // 0x03990308: 0x000003AA - "\x03\xa5\x03\b\x00\x00\x03\xab" + // 0x03A50308: 0x000003AB - "\x03\xb1\x03\x01\x00\x00\x03\xac" + // 0x03B10301: 0x000003AC - "\x03\xb5\x03\x01\x00\x00\x03\xad" + // 0x03B50301: 0x000003AD - "\x03\xb7\x03\x01\x00\x00\x03\xae" + // 0x03B70301: 0x000003AE - "\x03\xb9\x03\x01\x00\x00\x03\xaf" + // 0x03B90301: 0x000003AF - "\x03\xcb\x03\x01\x00\x00\x03\xb0" + // 0x03CB0301: 0x000003B0 - "\x03\xb9\x03\b\x00\x00\x03\xca" + // 0x03B90308: 0x000003CA - "\x03\xc5\x03\b\x00\x00\x03\xcb" + // 0x03C50308: 0x000003CB - "\x03\xbf\x03\x01\x00\x00\x03\xcc" + // 0x03BF0301: 0x000003CC - "\x03\xc5\x03\x01\x00\x00\x03\xcd" + // 0x03C50301: 0x000003CD - "\x03\xc9\x03\x01\x00\x00\x03\xce" + // 0x03C90301: 0x000003CE - "\x03\xd2\x03\x01\x00\x00\x03\xd3" + // 0x03D20301: 0x000003D3 - "\x03\xd2\x03\b\x00\x00\x03\xd4" + // 0x03D20308: 0x000003D4 - "\x04\x15\x03\x00\x00\x00\x04\x00" + // 0x04150300: 0x00000400 - "\x04\x15\x03\b\x00\x00\x04\x01" + // 0x04150308: 0x00000401 - "\x04\x13\x03\x01\x00\x00\x04\x03" + // 0x04130301: 0x00000403 - "\x04\x06\x03\b\x00\x00\x04\a" + // 0x04060308: 0x00000407 - "\x04\x1a\x03\x01\x00\x00\x04\f" + // 0x041A0301: 0x0000040C - "\x04\x18\x03\x00\x00\x00\x04\r" + // 0x04180300: 0x0000040D - "\x04#\x03\x06\x00\x00\x04\x0e" + // 0x04230306: 0x0000040E - "\x04\x18\x03\x06\x00\x00\x04\x19" + // 0x04180306: 0x00000419 - "\x048\x03\x06\x00\x00\x049" + // 0x04380306: 0x00000439 - "\x045\x03\x00\x00\x00\x04P" + // 0x04350300: 0x00000450 - "\x045\x03\b\x00\x00\x04Q" + // 0x04350308: 0x00000451 - "\x043\x03\x01\x00\x00\x04S" + // 0x04330301: 0x00000453 - "\x04V\x03\b\x00\x00\x04W" + // 0x04560308: 0x00000457 - "\x04:\x03\x01\x00\x00\x04\\" + // 0x043A0301: 0x0000045C - "\x048\x03\x00\x00\x00\x04]" + // 0x04380300: 0x0000045D - "\x04C\x03\x06\x00\x00\x04^" + // 0x04430306: 0x0000045E - "\x04t\x03\x0f\x00\x00\x04v" + // 0x0474030F: 0x00000476 - "\x04u\x03\x0f\x00\x00\x04w" + // 0x0475030F: 0x00000477 - "\x04\x16\x03\x06\x00\x00\x04\xc1" + // 0x04160306: 0x000004C1 - "\x046\x03\x06\x00\x00\x04\xc2" + // 0x04360306: 0x000004C2 - "\x04\x10\x03\x06\x00\x00\x04\xd0" + // 0x04100306: 0x000004D0 - "\x040\x03\x06\x00\x00\x04\xd1" + // 0x04300306: 0x000004D1 - "\x04\x10\x03\b\x00\x00\x04\xd2" + // 0x04100308: 0x000004D2 - "\x040\x03\b\x00\x00\x04\xd3" + // 0x04300308: 0x000004D3 - "\x04\x15\x03\x06\x00\x00\x04\xd6" + // 0x04150306: 0x000004D6 - "\x045\x03\x06\x00\x00\x04\xd7" + // 0x04350306: 0x000004D7 - "\x04\xd8\x03\b\x00\x00\x04\xda" + // 0x04D80308: 0x000004DA - "\x04\xd9\x03\b\x00\x00\x04\xdb" + // 0x04D90308: 0x000004DB - "\x04\x16\x03\b\x00\x00\x04\xdc" + // 0x04160308: 0x000004DC - "\x046\x03\b\x00\x00\x04\xdd" + // 0x04360308: 0x000004DD - "\x04\x17\x03\b\x00\x00\x04\xde" + // 0x04170308: 0x000004DE - "\x047\x03\b\x00\x00\x04\xdf" + // 0x04370308: 0x000004DF - "\x04\x18\x03\x04\x00\x00\x04\xe2" + // 0x04180304: 0x000004E2 - "\x048\x03\x04\x00\x00\x04\xe3" + // 0x04380304: 0x000004E3 - "\x04\x18\x03\b\x00\x00\x04\xe4" + // 0x04180308: 0x000004E4 - "\x048\x03\b\x00\x00\x04\xe5" + // 0x04380308: 0x000004E5 - "\x04\x1e\x03\b\x00\x00\x04\xe6" + // 0x041E0308: 0x000004E6 - "\x04>\x03\b\x00\x00\x04\xe7" + // 0x043E0308: 0x000004E7 - "\x04\xe8\x03\b\x00\x00\x04\xea" + // 0x04E80308: 0x000004EA - "\x04\xe9\x03\b\x00\x00\x04\xeb" + // 0x04E90308: 0x000004EB - "\x04-\x03\b\x00\x00\x04\xec" + // 0x042D0308: 0x000004EC - "\x04M\x03\b\x00\x00\x04\xed" + // 0x044D0308: 0x000004ED - "\x04#\x03\x04\x00\x00\x04\xee" + // 0x04230304: 0x000004EE - "\x04C\x03\x04\x00\x00\x04\xef" + // 0x04430304: 0x000004EF - "\x04#\x03\b\x00\x00\x04\xf0" + // 0x04230308: 0x000004F0 - "\x04C\x03\b\x00\x00\x04\xf1" + // 0x04430308: 0x000004F1 - "\x04#\x03\v\x00\x00\x04\xf2" + // 0x0423030B: 0x000004F2 - "\x04C\x03\v\x00\x00\x04\xf3" + // 0x0443030B: 0x000004F3 - "\x04'\x03\b\x00\x00\x04\xf4" + // 0x04270308: 0x000004F4 - "\x04G\x03\b\x00\x00\x04\xf5" + // 0x04470308: 0x000004F5 - "\x04+\x03\b\x00\x00\x04\xf8" + // 0x042B0308: 0x000004F8 - "\x04K\x03\b\x00\x00\x04\xf9" + // 0x044B0308: 0x000004F9 - "\x06'\x06S\x00\x00\x06\"" + // 0x06270653: 0x00000622 - "\x06'\x06T\x00\x00\x06#" + // 0x06270654: 0x00000623 - "\x06H\x06T\x00\x00\x06$" + // 0x06480654: 0x00000624 - "\x06'\x06U\x00\x00\x06%" + // 0x06270655: 0x00000625 - "\x06J\x06T\x00\x00\x06&" + // 0x064A0654: 0x00000626 - "\x06\xd5\x06T\x00\x00\x06\xc0" + // 0x06D50654: 0x000006C0 - "\x06\xc1\x06T\x00\x00\x06\xc2" + // 0x06C10654: 0x000006C2 - "\x06\xd2\x06T\x00\x00\x06\xd3" + // 0x06D20654: 0x000006D3 - "\t(\t<\x00\x00\t)" + // 0x0928093C: 0x00000929 - "\t0\t<\x00\x00\t1" + // 0x0930093C: 0x00000931 - "\t3\t<\x00\x00\t4" + // 0x0933093C: 0x00000934 - "\t\xc7\t\xbe\x00\x00\t\xcb" + // 0x09C709BE: 0x000009CB - "\t\xc7\t\xd7\x00\x00\t\xcc" + // 0x09C709D7: 0x000009CC - "\vG\vV\x00\x00\vH" + // 0x0B470B56: 0x00000B48 - "\vG\v>\x00\x00\vK" + // 0x0B470B3E: 0x00000B4B - "\vG\vW\x00\x00\vL" + // 0x0B470B57: 0x00000B4C - "\v\x92\v\xd7\x00\x00\v\x94" + // 0x0B920BD7: 0x00000B94 - "\v\xc6\v\xbe\x00\x00\v\xca" + // 0x0BC60BBE: 0x00000BCA - "\v\xc7\v\xbe\x00\x00\v\xcb" + // 0x0BC70BBE: 0x00000BCB - "\v\xc6\v\xd7\x00\x00\v\xcc" + // 0x0BC60BD7: 0x00000BCC - "\fF\fV\x00\x00\fH" + // 0x0C460C56: 0x00000C48 - "\f\xbf\f\xd5\x00\x00\f\xc0" + // 0x0CBF0CD5: 0x00000CC0 - "\f\xc6\f\xd5\x00\x00\f\xc7" + // 0x0CC60CD5: 0x00000CC7 - "\f\xc6\f\xd6\x00\x00\f\xc8" + // 0x0CC60CD6: 0x00000CC8 - "\f\xc6\f\xc2\x00\x00\f\xca" + // 0x0CC60CC2: 0x00000CCA - "\f\xca\f\xd5\x00\x00\f\xcb" + // 0x0CCA0CD5: 0x00000CCB - "\rF\r>\x00\x00\rJ" + // 0x0D460D3E: 0x00000D4A - "\rG\r>\x00\x00\rK" + // 0x0D470D3E: 0x00000D4B - "\rF\rW\x00\x00\rL" + // 0x0D460D57: 0x00000D4C - "\r\xd9\r\xca\x00\x00\r\xda" + // 0x0DD90DCA: 0x00000DDA - "\r\xd9\r\xcf\x00\x00\r\xdc" + // 0x0DD90DCF: 0x00000DDC - "\r\xdc\r\xca\x00\x00\r\xdd" + // 0x0DDC0DCA: 0x00000DDD - "\r\xd9\r\xdf\x00\x00\r\xde" + // 0x0DD90DDF: 0x00000DDE - "\x10%\x10.\x00\x00\x10&" + // 0x1025102E: 0x00001026 - "\x1b\x05\x1b5\x00\x00\x1b\x06" + // 0x1B051B35: 0x00001B06 - "\x1b\a\x1b5\x00\x00\x1b\b" + // 0x1B071B35: 0x00001B08 - "\x1b\t\x1b5\x00\x00\x1b\n" + // 0x1B091B35: 0x00001B0A - "\x1b\v\x1b5\x00\x00\x1b\f" + // 0x1B0B1B35: 0x00001B0C - "\x1b\r\x1b5\x00\x00\x1b\x0e" + // 0x1B0D1B35: 0x00001B0E - "\x1b\x11\x1b5\x00\x00\x1b\x12" + // 0x1B111B35: 0x00001B12 - "\x1b:\x1b5\x00\x00\x1b;" + // 0x1B3A1B35: 0x00001B3B - "\x1b<\x1b5\x00\x00\x1b=" + // 0x1B3C1B35: 0x00001B3D - "\x1b>\x1b5\x00\x00\x1b@" + // 0x1B3E1B35: 0x00001B40 - "\x1b?\x1b5\x00\x00\x1bA" + // 0x1B3F1B35: 0x00001B41 - "\x1bB\x1b5\x00\x00\x1bC" + // 0x1B421B35: 0x00001B43 - "\x00A\x03%\x00\x00\x1e\x00" + // 0x00410325: 0x00001E00 - "\x00a\x03%\x00\x00\x1e\x01" + // 0x00610325: 0x00001E01 - "\x00B\x03\a\x00\x00\x1e\x02" + // 0x00420307: 0x00001E02 - "\x00b\x03\a\x00\x00\x1e\x03" + // 0x00620307: 0x00001E03 - "\x00B\x03#\x00\x00\x1e\x04" + // 0x00420323: 0x00001E04 - "\x00b\x03#\x00\x00\x1e\x05" + // 0x00620323: 0x00001E05 - "\x00B\x031\x00\x00\x1e\x06" + // 0x00420331: 0x00001E06 - "\x00b\x031\x00\x00\x1e\a" + // 0x00620331: 0x00001E07 - "\x00\xc7\x03\x01\x00\x00\x1e\b" + // 0x00C70301: 0x00001E08 - "\x00\xe7\x03\x01\x00\x00\x1e\t" + // 0x00E70301: 0x00001E09 - "\x00D\x03\a\x00\x00\x1e\n" + // 0x00440307: 0x00001E0A - "\x00d\x03\a\x00\x00\x1e\v" + // 0x00640307: 0x00001E0B - "\x00D\x03#\x00\x00\x1e\f" + // 0x00440323: 0x00001E0C - "\x00d\x03#\x00\x00\x1e\r" + // 0x00640323: 0x00001E0D - "\x00D\x031\x00\x00\x1e\x0e" + // 0x00440331: 0x00001E0E - "\x00d\x031\x00\x00\x1e\x0f" + // 0x00640331: 0x00001E0F - "\x00D\x03'\x00\x00\x1e\x10" + // 0x00440327: 0x00001E10 - "\x00d\x03'\x00\x00\x1e\x11" + // 0x00640327: 0x00001E11 - "\x00D\x03-\x00\x00\x1e\x12" + // 0x0044032D: 0x00001E12 - "\x00d\x03-\x00\x00\x1e\x13" + // 0x0064032D: 0x00001E13 - "\x01\x12\x03\x00\x00\x00\x1e\x14" + // 0x01120300: 0x00001E14 - "\x01\x13\x03\x00\x00\x00\x1e\x15" + // 0x01130300: 0x00001E15 - "\x01\x12\x03\x01\x00\x00\x1e\x16" + // 0x01120301: 0x00001E16 - "\x01\x13\x03\x01\x00\x00\x1e\x17" + // 0x01130301: 0x00001E17 - "\x00E\x03-\x00\x00\x1e\x18" + // 0x0045032D: 0x00001E18 - "\x00e\x03-\x00\x00\x1e\x19" + // 0x0065032D: 0x00001E19 - "\x00E\x030\x00\x00\x1e\x1a" + // 0x00450330: 0x00001E1A - "\x00e\x030\x00\x00\x1e\x1b" + // 0x00650330: 0x00001E1B - "\x02(\x03\x06\x00\x00\x1e\x1c" + // 0x02280306: 0x00001E1C - "\x02)\x03\x06\x00\x00\x1e\x1d" + // 0x02290306: 0x00001E1D - "\x00F\x03\a\x00\x00\x1e\x1e" + // 0x00460307: 0x00001E1E - "\x00f\x03\a\x00\x00\x1e\x1f" + // 0x00660307: 0x00001E1F - "\x00G\x03\x04\x00\x00\x1e " + // 0x00470304: 0x00001E20 - "\x00g\x03\x04\x00\x00\x1e!" + // 0x00670304: 0x00001E21 - "\x00H\x03\a\x00\x00\x1e\"" + // 0x00480307: 0x00001E22 - "\x00h\x03\a\x00\x00\x1e#" + // 0x00680307: 0x00001E23 - "\x00H\x03#\x00\x00\x1e$" + // 0x00480323: 0x00001E24 - "\x00h\x03#\x00\x00\x1e%" + // 0x00680323: 0x00001E25 - "\x00H\x03\b\x00\x00\x1e&" + // 0x00480308: 0x00001E26 - "\x00h\x03\b\x00\x00\x1e'" + // 0x00680308: 0x00001E27 - "\x00H\x03'\x00\x00\x1e(" + // 0x00480327: 0x00001E28 - "\x00h\x03'\x00\x00\x1e)" + // 0x00680327: 0x00001E29 - "\x00H\x03.\x00\x00\x1e*" + // 0x0048032E: 0x00001E2A - "\x00h\x03.\x00\x00\x1e+" + // 0x0068032E: 0x00001E2B - "\x00I\x030\x00\x00\x1e," + // 0x00490330: 0x00001E2C - "\x00i\x030\x00\x00\x1e-" + // 0x00690330: 0x00001E2D - "\x00\xcf\x03\x01\x00\x00\x1e." + // 0x00CF0301: 0x00001E2E - "\x00\xef\x03\x01\x00\x00\x1e/" + // 0x00EF0301: 0x00001E2F - "\x00K\x03\x01\x00\x00\x1e0" + // 0x004B0301: 0x00001E30 - "\x00k\x03\x01\x00\x00\x1e1" + // 0x006B0301: 0x00001E31 - "\x00K\x03#\x00\x00\x1e2" + // 0x004B0323: 0x00001E32 - "\x00k\x03#\x00\x00\x1e3" + // 0x006B0323: 0x00001E33 - "\x00K\x031\x00\x00\x1e4" + // 0x004B0331: 0x00001E34 - "\x00k\x031\x00\x00\x1e5" + // 0x006B0331: 0x00001E35 - "\x00L\x03#\x00\x00\x1e6" + // 0x004C0323: 0x00001E36 - "\x00l\x03#\x00\x00\x1e7" + // 0x006C0323: 0x00001E37 - "\x1e6\x03\x04\x00\x00\x1e8" + // 0x1E360304: 0x00001E38 - "\x1e7\x03\x04\x00\x00\x1e9" + // 0x1E370304: 0x00001E39 - "\x00L\x031\x00\x00\x1e:" + // 0x004C0331: 0x00001E3A - "\x00l\x031\x00\x00\x1e;" + // 0x006C0331: 0x00001E3B - "\x00L\x03-\x00\x00\x1e<" + // 0x004C032D: 0x00001E3C - "\x00l\x03-\x00\x00\x1e=" + // 0x006C032D: 0x00001E3D - "\x00M\x03\x01\x00\x00\x1e>" + // 0x004D0301: 0x00001E3E - "\x00m\x03\x01\x00\x00\x1e?" + // 0x006D0301: 0x00001E3F - "\x00M\x03\a\x00\x00\x1e@" + // 0x004D0307: 0x00001E40 - "\x00m\x03\a\x00\x00\x1eA" + // 0x006D0307: 0x00001E41 - "\x00M\x03#\x00\x00\x1eB" + // 0x004D0323: 0x00001E42 - "\x00m\x03#\x00\x00\x1eC" + // 0x006D0323: 0x00001E43 - "\x00N\x03\a\x00\x00\x1eD" + // 0x004E0307: 0x00001E44 - "\x00n\x03\a\x00\x00\x1eE" + // 0x006E0307: 0x00001E45 - "\x00N\x03#\x00\x00\x1eF" + // 0x004E0323: 0x00001E46 - "\x00n\x03#\x00\x00\x1eG" + // 0x006E0323: 0x00001E47 - "\x00N\x031\x00\x00\x1eH" + // 0x004E0331: 0x00001E48 - "\x00n\x031\x00\x00\x1eI" + // 0x006E0331: 0x00001E49 - "\x00N\x03-\x00\x00\x1eJ" + // 0x004E032D: 0x00001E4A - "\x00n\x03-\x00\x00\x1eK" + // 0x006E032D: 0x00001E4B - "\x00\xd5\x03\x01\x00\x00\x1eL" + // 0x00D50301: 0x00001E4C - "\x00\xf5\x03\x01\x00\x00\x1eM" + // 0x00F50301: 0x00001E4D - "\x00\xd5\x03\b\x00\x00\x1eN" + // 0x00D50308: 0x00001E4E - "\x00\xf5\x03\b\x00\x00\x1eO" + // 0x00F50308: 0x00001E4F - "\x01L\x03\x00\x00\x00\x1eP" + // 0x014C0300: 0x00001E50 - "\x01M\x03\x00\x00\x00\x1eQ" + // 0x014D0300: 0x00001E51 - "\x01L\x03\x01\x00\x00\x1eR" + // 0x014C0301: 0x00001E52 - "\x01M\x03\x01\x00\x00\x1eS" + // 0x014D0301: 0x00001E53 - "\x00P\x03\x01\x00\x00\x1eT" + // 0x00500301: 0x00001E54 - "\x00p\x03\x01\x00\x00\x1eU" + // 0x00700301: 0x00001E55 - "\x00P\x03\a\x00\x00\x1eV" + // 0x00500307: 0x00001E56 - "\x00p\x03\a\x00\x00\x1eW" + // 0x00700307: 0x00001E57 - "\x00R\x03\a\x00\x00\x1eX" + // 0x00520307: 0x00001E58 - "\x00r\x03\a\x00\x00\x1eY" + // 0x00720307: 0x00001E59 - "\x00R\x03#\x00\x00\x1eZ" + // 0x00520323: 0x00001E5A - "\x00r\x03#\x00\x00\x1e[" + // 0x00720323: 0x00001E5B - "\x1eZ\x03\x04\x00\x00\x1e\\" + // 0x1E5A0304: 0x00001E5C - "\x1e[\x03\x04\x00\x00\x1e]" + // 0x1E5B0304: 0x00001E5D - "\x00R\x031\x00\x00\x1e^" + // 0x00520331: 0x00001E5E - "\x00r\x031\x00\x00\x1e_" + // 0x00720331: 0x00001E5F - "\x00S\x03\a\x00\x00\x1e`" + // 0x00530307: 0x00001E60 - "\x00s\x03\a\x00\x00\x1ea" + // 0x00730307: 0x00001E61 - "\x00S\x03#\x00\x00\x1eb" + // 0x00530323: 0x00001E62 - "\x00s\x03#\x00\x00\x1ec" + // 0x00730323: 0x00001E63 - "\x01Z\x03\a\x00\x00\x1ed" + // 0x015A0307: 0x00001E64 - "\x01[\x03\a\x00\x00\x1ee" + // 0x015B0307: 0x00001E65 - "\x01`\x03\a\x00\x00\x1ef" + // 0x01600307: 0x00001E66 - "\x01a\x03\a\x00\x00\x1eg" + // 0x01610307: 0x00001E67 - "\x1eb\x03\a\x00\x00\x1eh" + // 0x1E620307: 0x00001E68 - "\x1ec\x03\a\x00\x00\x1ei" + // 0x1E630307: 0x00001E69 - "\x00T\x03\a\x00\x00\x1ej" + // 0x00540307: 0x00001E6A - "\x00t\x03\a\x00\x00\x1ek" + // 0x00740307: 0x00001E6B - "\x00T\x03#\x00\x00\x1el" + // 0x00540323: 0x00001E6C - "\x00t\x03#\x00\x00\x1em" + // 0x00740323: 0x00001E6D - "\x00T\x031\x00\x00\x1en" + // 0x00540331: 0x00001E6E - "\x00t\x031\x00\x00\x1eo" + // 0x00740331: 0x00001E6F - "\x00T\x03-\x00\x00\x1ep" + // 0x0054032D: 0x00001E70 - "\x00t\x03-\x00\x00\x1eq" + // 0x0074032D: 0x00001E71 - "\x00U\x03$\x00\x00\x1er" + // 0x00550324: 0x00001E72 - "\x00u\x03$\x00\x00\x1es" + // 0x00750324: 0x00001E73 - "\x00U\x030\x00\x00\x1et" + // 0x00550330: 0x00001E74 - "\x00u\x030\x00\x00\x1eu" + // 0x00750330: 0x00001E75 - "\x00U\x03-\x00\x00\x1ev" + // 0x0055032D: 0x00001E76 - "\x00u\x03-\x00\x00\x1ew" + // 0x0075032D: 0x00001E77 - "\x01h\x03\x01\x00\x00\x1ex" + // 0x01680301: 0x00001E78 - "\x01i\x03\x01\x00\x00\x1ey" + // 0x01690301: 0x00001E79 - "\x01j\x03\b\x00\x00\x1ez" + // 0x016A0308: 0x00001E7A - "\x01k\x03\b\x00\x00\x1e{" + // 0x016B0308: 0x00001E7B - "\x00V\x03\x03\x00\x00\x1e|" + // 0x00560303: 0x00001E7C - "\x00v\x03\x03\x00\x00\x1e}" + // 0x00760303: 0x00001E7D - "\x00V\x03#\x00\x00\x1e~" + // 0x00560323: 0x00001E7E - "\x00v\x03#\x00\x00\x1e\u007f" + // 0x00760323: 0x00001E7F - "\x00W\x03\x00\x00\x00\x1e\x80" + // 0x00570300: 0x00001E80 - "\x00w\x03\x00\x00\x00\x1e\x81" + // 0x00770300: 0x00001E81 - "\x00W\x03\x01\x00\x00\x1e\x82" + // 0x00570301: 0x00001E82 - "\x00w\x03\x01\x00\x00\x1e\x83" + // 0x00770301: 0x00001E83 - "\x00W\x03\b\x00\x00\x1e\x84" + // 0x00570308: 0x00001E84 - "\x00w\x03\b\x00\x00\x1e\x85" + // 0x00770308: 0x00001E85 - "\x00W\x03\a\x00\x00\x1e\x86" + // 0x00570307: 0x00001E86 - "\x00w\x03\a\x00\x00\x1e\x87" + // 0x00770307: 0x00001E87 - "\x00W\x03#\x00\x00\x1e\x88" + // 0x00570323: 0x00001E88 - "\x00w\x03#\x00\x00\x1e\x89" + // 0x00770323: 0x00001E89 - "\x00X\x03\a\x00\x00\x1e\x8a" + // 0x00580307: 0x00001E8A - "\x00x\x03\a\x00\x00\x1e\x8b" + // 0x00780307: 0x00001E8B - "\x00X\x03\b\x00\x00\x1e\x8c" + // 0x00580308: 0x00001E8C - "\x00x\x03\b\x00\x00\x1e\x8d" + // 0x00780308: 0x00001E8D - "\x00Y\x03\a\x00\x00\x1e\x8e" + // 0x00590307: 0x00001E8E - "\x00y\x03\a\x00\x00\x1e\x8f" + // 0x00790307: 0x00001E8F - "\x00Z\x03\x02\x00\x00\x1e\x90" + // 0x005A0302: 0x00001E90 - "\x00z\x03\x02\x00\x00\x1e\x91" + // 0x007A0302: 0x00001E91 - "\x00Z\x03#\x00\x00\x1e\x92" + // 0x005A0323: 0x00001E92 - "\x00z\x03#\x00\x00\x1e\x93" + // 0x007A0323: 0x00001E93 - "\x00Z\x031\x00\x00\x1e\x94" + // 0x005A0331: 0x00001E94 - "\x00z\x031\x00\x00\x1e\x95" + // 0x007A0331: 0x00001E95 - "\x00h\x031\x00\x00\x1e\x96" + // 0x00680331: 0x00001E96 - "\x00t\x03\b\x00\x00\x1e\x97" + // 0x00740308: 0x00001E97 - "\x00w\x03\n\x00\x00\x1e\x98" + // 0x0077030A: 0x00001E98 - "\x00y\x03\n\x00\x00\x1e\x99" + // 0x0079030A: 0x00001E99 - "\x01\u007f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B - "\x00A\x03#\x00\x00\x1e\xa0" + // 0x00410323: 0x00001EA0 - "\x00a\x03#\x00\x00\x1e\xa1" + // 0x00610323: 0x00001EA1 - "\x00A\x03\t\x00\x00\x1e\xa2" + // 0x00410309: 0x00001EA2 - "\x00a\x03\t\x00\x00\x1e\xa3" + // 0x00610309: 0x00001EA3 - "\x00\xc2\x03\x01\x00\x00\x1e\xa4" + // 0x00C20301: 0x00001EA4 - "\x00\xe2\x03\x01\x00\x00\x1e\xa5" + // 0x00E20301: 0x00001EA5 - "\x00\xc2\x03\x00\x00\x00\x1e\xa6" + // 0x00C20300: 0x00001EA6 - "\x00\xe2\x03\x00\x00\x00\x1e\xa7" + // 0x00E20300: 0x00001EA7 - "\x00\xc2\x03\t\x00\x00\x1e\xa8" + // 0x00C20309: 0x00001EA8 - "\x00\xe2\x03\t\x00\x00\x1e\xa9" + // 0x00E20309: 0x00001EA9 - "\x00\xc2\x03\x03\x00\x00\x1e\xaa" + // 0x00C20303: 0x00001EAA - "\x00\xe2\x03\x03\x00\x00\x1e\xab" + // 0x00E20303: 0x00001EAB - "\x1e\xa0\x03\x02\x00\x00\x1e\xac" + // 0x1EA00302: 0x00001EAC - "\x1e\xa1\x03\x02\x00\x00\x1e\xad" + // 0x1EA10302: 0x00001EAD - "\x01\x02\x03\x01\x00\x00\x1e\xae" + // 0x01020301: 0x00001EAE - "\x01\x03\x03\x01\x00\x00\x1e\xaf" + // 0x01030301: 0x00001EAF - "\x01\x02\x03\x00\x00\x00\x1e\xb0" + // 0x01020300: 0x00001EB0 - "\x01\x03\x03\x00\x00\x00\x1e\xb1" + // 0x01030300: 0x00001EB1 - "\x01\x02\x03\t\x00\x00\x1e\xb2" + // 0x01020309: 0x00001EB2 - "\x01\x03\x03\t\x00\x00\x1e\xb3" + // 0x01030309: 0x00001EB3 - "\x01\x02\x03\x03\x00\x00\x1e\xb4" + // 0x01020303: 0x00001EB4 - "\x01\x03\x03\x03\x00\x00\x1e\xb5" + // 0x01030303: 0x00001EB5 - "\x1e\xa0\x03\x06\x00\x00\x1e\xb6" + // 0x1EA00306: 0x00001EB6 - "\x1e\xa1\x03\x06\x00\x00\x1e\xb7" + // 0x1EA10306: 0x00001EB7 - "\x00E\x03#\x00\x00\x1e\xb8" + // 0x00450323: 0x00001EB8 - "\x00e\x03#\x00\x00\x1e\xb9" + // 0x00650323: 0x00001EB9 - "\x00E\x03\t\x00\x00\x1e\xba" + // 0x00450309: 0x00001EBA - "\x00e\x03\t\x00\x00\x1e\xbb" + // 0x00650309: 0x00001EBB - "\x00E\x03\x03\x00\x00\x1e\xbc" + // 0x00450303: 0x00001EBC - "\x00e\x03\x03\x00\x00\x1e\xbd" + // 0x00650303: 0x00001EBD - "\x00\xca\x03\x01\x00\x00\x1e\xbe" + // 0x00CA0301: 0x00001EBE - "\x00\xea\x03\x01\x00\x00\x1e\xbf" + // 0x00EA0301: 0x00001EBF - "\x00\xca\x03\x00\x00\x00\x1e\xc0" + // 0x00CA0300: 0x00001EC0 - "\x00\xea\x03\x00\x00\x00\x1e\xc1" + // 0x00EA0300: 0x00001EC1 - "\x00\xca\x03\t\x00\x00\x1e\xc2" + // 0x00CA0309: 0x00001EC2 - "\x00\xea\x03\t\x00\x00\x1e\xc3" + // 0x00EA0309: 0x00001EC3 - "\x00\xca\x03\x03\x00\x00\x1e\xc4" + // 0x00CA0303: 0x00001EC4 - "\x00\xea\x03\x03\x00\x00\x1e\xc5" + // 0x00EA0303: 0x00001EC5 - "\x1e\xb8\x03\x02\x00\x00\x1e\xc6" + // 0x1EB80302: 0x00001EC6 - "\x1e\xb9\x03\x02\x00\x00\x1e\xc7" + // 0x1EB90302: 0x00001EC7 - "\x00I\x03\t\x00\x00\x1e\xc8" + // 0x00490309: 0x00001EC8 - "\x00i\x03\t\x00\x00\x1e\xc9" + // 0x00690309: 0x00001EC9 - "\x00I\x03#\x00\x00\x1e\xca" + // 0x00490323: 0x00001ECA - "\x00i\x03#\x00\x00\x1e\xcb" + // 0x00690323: 0x00001ECB - "\x00O\x03#\x00\x00\x1e\xcc" + // 0x004F0323: 0x00001ECC - "\x00o\x03#\x00\x00\x1e\xcd" + // 0x006F0323: 0x00001ECD - "\x00O\x03\t\x00\x00\x1e\xce" + // 0x004F0309: 0x00001ECE - "\x00o\x03\t\x00\x00\x1e\xcf" + // 0x006F0309: 0x00001ECF - "\x00\xd4\x03\x01\x00\x00\x1e\xd0" + // 0x00D40301: 0x00001ED0 - "\x00\xf4\x03\x01\x00\x00\x1e\xd1" + // 0x00F40301: 0x00001ED1 - "\x00\xd4\x03\x00\x00\x00\x1e\xd2" + // 0x00D40300: 0x00001ED2 - "\x00\xf4\x03\x00\x00\x00\x1e\xd3" + // 0x00F40300: 0x00001ED3 - "\x00\xd4\x03\t\x00\x00\x1e\xd4" + // 0x00D40309: 0x00001ED4 - "\x00\xf4\x03\t\x00\x00\x1e\xd5" + // 0x00F40309: 0x00001ED5 - "\x00\xd4\x03\x03\x00\x00\x1e\xd6" + // 0x00D40303: 0x00001ED6 - "\x00\xf4\x03\x03\x00\x00\x1e\xd7" + // 0x00F40303: 0x00001ED7 - "\x1e\xcc\x03\x02\x00\x00\x1e\xd8" + // 0x1ECC0302: 0x00001ED8 - "\x1e\xcd\x03\x02\x00\x00\x1e\xd9" + // 0x1ECD0302: 0x00001ED9 - "\x01\xa0\x03\x01\x00\x00\x1e\xda" + // 0x01A00301: 0x00001EDA - "\x01\xa1\x03\x01\x00\x00\x1e\xdb" + // 0x01A10301: 0x00001EDB - "\x01\xa0\x03\x00\x00\x00\x1e\xdc" + // 0x01A00300: 0x00001EDC - "\x01\xa1\x03\x00\x00\x00\x1e\xdd" + // 0x01A10300: 0x00001EDD - "\x01\xa0\x03\t\x00\x00\x1e\xde" + // 0x01A00309: 0x00001EDE - "\x01\xa1\x03\t\x00\x00\x1e\xdf" + // 0x01A10309: 0x00001EDF - "\x01\xa0\x03\x03\x00\x00\x1e\xe0" + // 0x01A00303: 0x00001EE0 - "\x01\xa1\x03\x03\x00\x00\x1e\xe1" + // 0x01A10303: 0x00001EE1 - "\x01\xa0\x03#\x00\x00\x1e\xe2" + // 0x01A00323: 0x00001EE2 - "\x01\xa1\x03#\x00\x00\x1e\xe3" + // 0x01A10323: 0x00001EE3 - "\x00U\x03#\x00\x00\x1e\xe4" + // 0x00550323: 0x00001EE4 - "\x00u\x03#\x00\x00\x1e\xe5" + // 0x00750323: 0x00001EE5 - "\x00U\x03\t\x00\x00\x1e\xe6" + // 0x00550309: 0x00001EE6 - "\x00u\x03\t\x00\x00\x1e\xe7" + // 0x00750309: 0x00001EE7 - "\x01\xaf\x03\x01\x00\x00\x1e\xe8" + // 0x01AF0301: 0x00001EE8 - "\x01\xb0\x03\x01\x00\x00\x1e\xe9" + // 0x01B00301: 0x00001EE9 - "\x01\xaf\x03\x00\x00\x00\x1e\xea" + // 0x01AF0300: 0x00001EEA - "\x01\xb0\x03\x00\x00\x00\x1e\xeb" + // 0x01B00300: 0x00001EEB - "\x01\xaf\x03\t\x00\x00\x1e\xec" + // 0x01AF0309: 0x00001EEC - "\x01\xb0\x03\t\x00\x00\x1e\xed" + // 0x01B00309: 0x00001EED - "\x01\xaf\x03\x03\x00\x00\x1e\xee" + // 0x01AF0303: 0x00001EEE - "\x01\xb0\x03\x03\x00\x00\x1e\xef" + // 0x01B00303: 0x00001EEF - "\x01\xaf\x03#\x00\x00\x1e\xf0" + // 0x01AF0323: 0x00001EF0 - "\x01\xb0\x03#\x00\x00\x1e\xf1" + // 0x01B00323: 0x00001EF1 - "\x00Y\x03\x00\x00\x00\x1e\xf2" + // 0x00590300: 0x00001EF2 - "\x00y\x03\x00\x00\x00\x1e\xf3" + // 0x00790300: 0x00001EF3 - "\x00Y\x03#\x00\x00\x1e\xf4" + // 0x00590323: 0x00001EF4 - "\x00y\x03#\x00\x00\x1e\xf5" + // 0x00790323: 0x00001EF5 - "\x00Y\x03\t\x00\x00\x1e\xf6" + // 0x00590309: 0x00001EF6 - "\x00y\x03\t\x00\x00\x1e\xf7" + // 0x00790309: 0x00001EF7 - "\x00Y\x03\x03\x00\x00\x1e\xf8" + // 0x00590303: 0x00001EF8 - "\x00y\x03\x03\x00\x00\x1e\xf9" + // 0x00790303: 0x00001EF9 - "\x03\xb1\x03\x13\x00\x00\x1f\x00" + // 0x03B10313: 0x00001F00 - "\x03\xb1\x03\x14\x00\x00\x1f\x01" + // 0x03B10314: 0x00001F01 - "\x1f\x00\x03\x00\x00\x00\x1f\x02" + // 0x1F000300: 0x00001F02 - "\x1f\x01\x03\x00\x00\x00\x1f\x03" + // 0x1F010300: 0x00001F03 - "\x1f\x00\x03\x01\x00\x00\x1f\x04" + // 0x1F000301: 0x00001F04 - "\x1f\x01\x03\x01\x00\x00\x1f\x05" + // 0x1F010301: 0x00001F05 - "\x1f\x00\x03B\x00\x00\x1f\x06" + // 0x1F000342: 0x00001F06 - "\x1f\x01\x03B\x00\x00\x1f\a" + // 0x1F010342: 0x00001F07 - "\x03\x91\x03\x13\x00\x00\x1f\b" + // 0x03910313: 0x00001F08 - "\x03\x91\x03\x14\x00\x00\x1f\t" + // 0x03910314: 0x00001F09 - "\x1f\b\x03\x00\x00\x00\x1f\n" + // 0x1F080300: 0x00001F0A - "\x1f\t\x03\x00\x00\x00\x1f\v" + // 0x1F090300: 0x00001F0B - "\x1f\b\x03\x01\x00\x00\x1f\f" + // 0x1F080301: 0x00001F0C - "\x1f\t\x03\x01\x00\x00\x1f\r" + // 0x1F090301: 0x00001F0D - "\x1f\b\x03B\x00\x00\x1f\x0e" + // 0x1F080342: 0x00001F0E - "\x1f\t\x03B\x00\x00\x1f\x0f" + // 0x1F090342: 0x00001F0F - "\x03\xb5\x03\x13\x00\x00\x1f\x10" + // 0x03B50313: 0x00001F10 - "\x03\xb5\x03\x14\x00\x00\x1f\x11" + // 0x03B50314: 0x00001F11 - "\x1f\x10\x03\x00\x00\x00\x1f\x12" + // 0x1F100300: 0x00001F12 - "\x1f\x11\x03\x00\x00\x00\x1f\x13" + // 0x1F110300: 0x00001F13 - "\x1f\x10\x03\x01\x00\x00\x1f\x14" + // 0x1F100301: 0x00001F14 - "\x1f\x11\x03\x01\x00\x00\x1f\x15" + // 0x1F110301: 0x00001F15 - "\x03\x95\x03\x13\x00\x00\x1f\x18" + // 0x03950313: 0x00001F18 - "\x03\x95\x03\x14\x00\x00\x1f\x19" + // 0x03950314: 0x00001F19 - "\x1f\x18\x03\x00\x00\x00\x1f\x1a" + // 0x1F180300: 0x00001F1A - "\x1f\x19\x03\x00\x00\x00\x1f\x1b" + // 0x1F190300: 0x00001F1B - "\x1f\x18\x03\x01\x00\x00\x1f\x1c" + // 0x1F180301: 0x00001F1C - "\x1f\x19\x03\x01\x00\x00\x1f\x1d" + // 0x1F190301: 0x00001F1D - "\x03\xb7\x03\x13\x00\x00\x1f " + // 0x03B70313: 0x00001F20 - "\x03\xb7\x03\x14\x00\x00\x1f!" + // 0x03B70314: 0x00001F21 - "\x1f \x03\x00\x00\x00\x1f\"" + // 0x1F200300: 0x00001F22 - "\x1f!\x03\x00\x00\x00\x1f#" + // 0x1F210300: 0x00001F23 - "\x1f \x03\x01\x00\x00\x1f$" + // 0x1F200301: 0x00001F24 - "\x1f!\x03\x01\x00\x00\x1f%" + // 0x1F210301: 0x00001F25 - "\x1f \x03B\x00\x00\x1f&" + // 0x1F200342: 0x00001F26 - "\x1f!\x03B\x00\x00\x1f'" + // 0x1F210342: 0x00001F27 - "\x03\x97\x03\x13\x00\x00\x1f(" + // 0x03970313: 0x00001F28 - "\x03\x97\x03\x14\x00\x00\x1f)" + // 0x03970314: 0x00001F29 - "\x1f(\x03\x00\x00\x00\x1f*" + // 0x1F280300: 0x00001F2A - "\x1f)\x03\x00\x00\x00\x1f+" + // 0x1F290300: 0x00001F2B - "\x1f(\x03\x01\x00\x00\x1f," + // 0x1F280301: 0x00001F2C - "\x1f)\x03\x01\x00\x00\x1f-" + // 0x1F290301: 0x00001F2D - "\x1f(\x03B\x00\x00\x1f." + // 0x1F280342: 0x00001F2E - "\x1f)\x03B\x00\x00\x1f/" + // 0x1F290342: 0x00001F2F - "\x03\xb9\x03\x13\x00\x00\x1f0" + // 0x03B90313: 0x00001F30 - "\x03\xb9\x03\x14\x00\x00\x1f1" + // 0x03B90314: 0x00001F31 - "\x1f0\x03\x00\x00\x00\x1f2" + // 0x1F300300: 0x00001F32 - "\x1f1\x03\x00\x00\x00\x1f3" + // 0x1F310300: 0x00001F33 - "\x1f0\x03\x01\x00\x00\x1f4" + // 0x1F300301: 0x00001F34 - "\x1f1\x03\x01\x00\x00\x1f5" + // 0x1F310301: 0x00001F35 - "\x1f0\x03B\x00\x00\x1f6" + // 0x1F300342: 0x00001F36 - "\x1f1\x03B\x00\x00\x1f7" + // 0x1F310342: 0x00001F37 - "\x03\x99\x03\x13\x00\x00\x1f8" + // 0x03990313: 0x00001F38 - "\x03\x99\x03\x14\x00\x00\x1f9" + // 0x03990314: 0x00001F39 - "\x1f8\x03\x00\x00\x00\x1f:" + // 0x1F380300: 0x00001F3A - "\x1f9\x03\x00\x00\x00\x1f;" + // 0x1F390300: 0x00001F3B - "\x1f8\x03\x01\x00\x00\x1f<" + // 0x1F380301: 0x00001F3C - "\x1f9\x03\x01\x00\x00\x1f=" + // 0x1F390301: 0x00001F3D - "\x1f8\x03B\x00\x00\x1f>" + // 0x1F380342: 0x00001F3E - "\x1f9\x03B\x00\x00\x1f?" + // 0x1F390342: 0x00001F3F - "\x03\xbf\x03\x13\x00\x00\x1f@" + // 0x03BF0313: 0x00001F40 - "\x03\xbf\x03\x14\x00\x00\x1fA" + // 0x03BF0314: 0x00001F41 - "\x1f@\x03\x00\x00\x00\x1fB" + // 0x1F400300: 0x00001F42 - "\x1fA\x03\x00\x00\x00\x1fC" + // 0x1F410300: 0x00001F43 - "\x1f@\x03\x01\x00\x00\x1fD" + // 0x1F400301: 0x00001F44 - "\x1fA\x03\x01\x00\x00\x1fE" + // 0x1F410301: 0x00001F45 - "\x03\x9f\x03\x13\x00\x00\x1fH" + // 0x039F0313: 0x00001F48 - "\x03\x9f\x03\x14\x00\x00\x1fI" + // 0x039F0314: 0x00001F49 - "\x1fH\x03\x00\x00\x00\x1fJ" + // 0x1F480300: 0x00001F4A - "\x1fI\x03\x00\x00\x00\x1fK" + // 0x1F490300: 0x00001F4B - "\x1fH\x03\x01\x00\x00\x1fL" + // 0x1F480301: 0x00001F4C - "\x1fI\x03\x01\x00\x00\x1fM" + // 0x1F490301: 0x00001F4D - "\x03\xc5\x03\x13\x00\x00\x1fP" + // 0x03C50313: 0x00001F50 - "\x03\xc5\x03\x14\x00\x00\x1fQ" + // 0x03C50314: 0x00001F51 - "\x1fP\x03\x00\x00\x00\x1fR" + // 0x1F500300: 0x00001F52 - "\x1fQ\x03\x00\x00\x00\x1fS" + // 0x1F510300: 0x00001F53 - "\x1fP\x03\x01\x00\x00\x1fT" + // 0x1F500301: 0x00001F54 - "\x1fQ\x03\x01\x00\x00\x1fU" + // 0x1F510301: 0x00001F55 - "\x1fP\x03B\x00\x00\x1fV" + // 0x1F500342: 0x00001F56 - "\x1fQ\x03B\x00\x00\x1fW" + // 0x1F510342: 0x00001F57 - "\x03\xa5\x03\x14\x00\x00\x1fY" + // 0x03A50314: 0x00001F59 - "\x1fY\x03\x00\x00\x00\x1f[" + // 0x1F590300: 0x00001F5B - "\x1fY\x03\x01\x00\x00\x1f]" + // 0x1F590301: 0x00001F5D - "\x1fY\x03B\x00\x00\x1f_" + // 0x1F590342: 0x00001F5F - "\x03\xc9\x03\x13\x00\x00\x1f`" + // 0x03C90313: 0x00001F60 - "\x03\xc9\x03\x14\x00\x00\x1fa" + // 0x03C90314: 0x00001F61 - "\x1f`\x03\x00\x00\x00\x1fb" + // 0x1F600300: 0x00001F62 - "\x1fa\x03\x00\x00\x00\x1fc" + // 0x1F610300: 0x00001F63 - "\x1f`\x03\x01\x00\x00\x1fd" + // 0x1F600301: 0x00001F64 - "\x1fa\x03\x01\x00\x00\x1fe" + // 0x1F610301: 0x00001F65 - "\x1f`\x03B\x00\x00\x1ff" + // 0x1F600342: 0x00001F66 - "\x1fa\x03B\x00\x00\x1fg" + // 0x1F610342: 0x00001F67 - "\x03\xa9\x03\x13\x00\x00\x1fh" + // 0x03A90313: 0x00001F68 - "\x03\xa9\x03\x14\x00\x00\x1fi" + // 0x03A90314: 0x00001F69 - "\x1fh\x03\x00\x00\x00\x1fj" + // 0x1F680300: 0x00001F6A - "\x1fi\x03\x00\x00\x00\x1fk" + // 0x1F690300: 0x00001F6B - "\x1fh\x03\x01\x00\x00\x1fl" + // 0x1F680301: 0x00001F6C - "\x1fi\x03\x01\x00\x00\x1fm" + // 0x1F690301: 0x00001F6D - "\x1fh\x03B\x00\x00\x1fn" + // 0x1F680342: 0x00001F6E - "\x1fi\x03B\x00\x00\x1fo" + // 0x1F690342: 0x00001F6F - "\x03\xb1\x03\x00\x00\x00\x1fp" + // 0x03B10300: 0x00001F70 - "\x03\xb5\x03\x00\x00\x00\x1fr" + // 0x03B50300: 0x00001F72 - "\x03\xb7\x03\x00\x00\x00\x1ft" + // 0x03B70300: 0x00001F74 - "\x03\xb9\x03\x00\x00\x00\x1fv" + // 0x03B90300: 0x00001F76 - "\x03\xbf\x03\x00\x00\x00\x1fx" + // 0x03BF0300: 0x00001F78 - "\x03\xc5\x03\x00\x00\x00\x1fz" + // 0x03C50300: 0x00001F7A - "\x03\xc9\x03\x00\x00\x00\x1f|" + // 0x03C90300: 0x00001F7C - "\x1f\x00\x03E\x00\x00\x1f\x80" + // 0x1F000345: 0x00001F80 - "\x1f\x01\x03E\x00\x00\x1f\x81" + // 0x1F010345: 0x00001F81 - "\x1f\x02\x03E\x00\x00\x1f\x82" + // 0x1F020345: 0x00001F82 - "\x1f\x03\x03E\x00\x00\x1f\x83" + // 0x1F030345: 0x00001F83 - "\x1f\x04\x03E\x00\x00\x1f\x84" + // 0x1F040345: 0x00001F84 - "\x1f\x05\x03E\x00\x00\x1f\x85" + // 0x1F050345: 0x00001F85 - "\x1f\x06\x03E\x00\x00\x1f\x86" + // 0x1F060345: 0x00001F86 - "\x1f\a\x03E\x00\x00\x1f\x87" + // 0x1F070345: 0x00001F87 - "\x1f\b\x03E\x00\x00\x1f\x88" + // 0x1F080345: 0x00001F88 - "\x1f\t\x03E\x00\x00\x1f\x89" + // 0x1F090345: 0x00001F89 - "\x1f\n\x03E\x00\x00\x1f\x8a" + // 0x1F0A0345: 0x00001F8A - "\x1f\v\x03E\x00\x00\x1f\x8b" + // 0x1F0B0345: 0x00001F8B - "\x1f\f\x03E\x00\x00\x1f\x8c" + // 0x1F0C0345: 0x00001F8C - "\x1f\r\x03E\x00\x00\x1f\x8d" + // 0x1F0D0345: 0x00001F8D - "\x1f\x0e\x03E\x00\x00\x1f\x8e" + // 0x1F0E0345: 0x00001F8E - "\x1f\x0f\x03E\x00\x00\x1f\x8f" + // 0x1F0F0345: 0x00001F8F - "\x1f \x03E\x00\x00\x1f\x90" + // 0x1F200345: 0x00001F90 - "\x1f!\x03E\x00\x00\x1f\x91" + // 0x1F210345: 0x00001F91 - "\x1f\"\x03E\x00\x00\x1f\x92" + // 0x1F220345: 0x00001F92 - "\x1f#\x03E\x00\x00\x1f\x93" + // 0x1F230345: 0x00001F93 - "\x1f$\x03E\x00\x00\x1f\x94" + // 0x1F240345: 0x00001F94 - "\x1f%\x03E\x00\x00\x1f\x95" + // 0x1F250345: 0x00001F95 - "\x1f&\x03E\x00\x00\x1f\x96" + // 0x1F260345: 0x00001F96 - "\x1f'\x03E\x00\x00\x1f\x97" + // 0x1F270345: 0x00001F97 - "\x1f(\x03E\x00\x00\x1f\x98" + // 0x1F280345: 0x00001F98 - "\x1f)\x03E\x00\x00\x1f\x99" + // 0x1F290345: 0x00001F99 - "\x1f*\x03E\x00\x00\x1f\x9a" + // 0x1F2A0345: 0x00001F9A - "\x1f+\x03E\x00\x00\x1f\x9b" + // 0x1F2B0345: 0x00001F9B - "\x1f,\x03E\x00\x00\x1f\x9c" + // 0x1F2C0345: 0x00001F9C - "\x1f-\x03E\x00\x00\x1f\x9d" + // 0x1F2D0345: 0x00001F9D - "\x1f.\x03E\x00\x00\x1f\x9e" + // 0x1F2E0345: 0x00001F9E - "\x1f/\x03E\x00\x00\x1f\x9f" + // 0x1F2F0345: 0x00001F9F - "\x1f`\x03E\x00\x00\x1f\xa0" + // 0x1F600345: 0x00001FA0 - "\x1fa\x03E\x00\x00\x1f\xa1" + // 0x1F610345: 0x00001FA1 - "\x1fb\x03E\x00\x00\x1f\xa2" + // 0x1F620345: 0x00001FA2 - "\x1fc\x03E\x00\x00\x1f\xa3" + // 0x1F630345: 0x00001FA3 - "\x1fd\x03E\x00\x00\x1f\xa4" + // 0x1F640345: 0x00001FA4 - "\x1fe\x03E\x00\x00\x1f\xa5" + // 0x1F650345: 0x00001FA5 - "\x1ff\x03E\x00\x00\x1f\xa6" + // 0x1F660345: 0x00001FA6 - "\x1fg\x03E\x00\x00\x1f\xa7" + // 0x1F670345: 0x00001FA7 - "\x1fh\x03E\x00\x00\x1f\xa8" + // 0x1F680345: 0x00001FA8 - "\x1fi\x03E\x00\x00\x1f\xa9" + // 0x1F690345: 0x00001FA9 - "\x1fj\x03E\x00\x00\x1f\xaa" + // 0x1F6A0345: 0x00001FAA - "\x1fk\x03E\x00\x00\x1f\xab" + // 0x1F6B0345: 0x00001FAB - "\x1fl\x03E\x00\x00\x1f\xac" + // 0x1F6C0345: 0x00001FAC - "\x1fm\x03E\x00\x00\x1f\xad" + // 0x1F6D0345: 0x00001FAD - "\x1fn\x03E\x00\x00\x1f\xae" + // 0x1F6E0345: 0x00001FAE - "\x1fo\x03E\x00\x00\x1f\xaf" + // 0x1F6F0345: 0x00001FAF - "\x03\xb1\x03\x06\x00\x00\x1f\xb0" + // 0x03B10306: 0x00001FB0 - "\x03\xb1\x03\x04\x00\x00\x1f\xb1" + // 0x03B10304: 0x00001FB1 - "\x1fp\x03E\x00\x00\x1f\xb2" + // 0x1F700345: 0x00001FB2 - "\x03\xb1\x03E\x00\x00\x1f\xb3" + // 0x03B10345: 0x00001FB3 - "\x03\xac\x03E\x00\x00\x1f\xb4" + // 0x03AC0345: 0x00001FB4 - "\x03\xb1\x03B\x00\x00\x1f\xb6" + // 0x03B10342: 0x00001FB6 - "\x1f\xb6\x03E\x00\x00\x1f\xb7" + // 0x1FB60345: 0x00001FB7 - "\x03\x91\x03\x06\x00\x00\x1f\xb8" + // 0x03910306: 0x00001FB8 - "\x03\x91\x03\x04\x00\x00\x1f\xb9" + // 0x03910304: 0x00001FB9 - "\x03\x91\x03\x00\x00\x00\x1f\xba" + // 0x03910300: 0x00001FBA - "\x03\x91\x03E\x00\x00\x1f\xbc" + // 0x03910345: 0x00001FBC - "\x00\xa8\x03B\x00\x00\x1f\xc1" + // 0x00A80342: 0x00001FC1 - "\x1ft\x03E\x00\x00\x1f\xc2" + // 0x1F740345: 0x00001FC2 - "\x03\xb7\x03E\x00\x00\x1f\xc3" + // 0x03B70345: 0x00001FC3 - "\x03\xae\x03E\x00\x00\x1f\xc4" + // 0x03AE0345: 0x00001FC4 - "\x03\xb7\x03B\x00\x00\x1f\xc6" + // 0x03B70342: 0x00001FC6 - "\x1f\xc6\x03E\x00\x00\x1f\xc7" + // 0x1FC60345: 0x00001FC7 - "\x03\x95\x03\x00\x00\x00\x1f\xc8" + // 0x03950300: 0x00001FC8 - "\x03\x97\x03\x00\x00\x00\x1f\xca" + // 0x03970300: 0x00001FCA - "\x03\x97\x03E\x00\x00\x1f\xcc" + // 0x03970345: 0x00001FCC - "\x1f\xbf\x03\x00\x00\x00\x1f\xcd" + // 0x1FBF0300: 0x00001FCD - "\x1f\xbf\x03\x01\x00\x00\x1f\xce" + // 0x1FBF0301: 0x00001FCE - "\x1f\xbf\x03B\x00\x00\x1f\xcf" + // 0x1FBF0342: 0x00001FCF - "\x03\xb9\x03\x06\x00\x00\x1f\xd0" + // 0x03B90306: 0x00001FD0 - "\x03\xb9\x03\x04\x00\x00\x1f\xd1" + // 0x03B90304: 0x00001FD1 - "\x03\xca\x03\x00\x00\x00\x1f\xd2" + // 0x03CA0300: 0x00001FD2 - "\x03\xb9\x03B\x00\x00\x1f\xd6" + // 0x03B90342: 0x00001FD6 - "\x03\xca\x03B\x00\x00\x1f\xd7" + // 0x03CA0342: 0x00001FD7 - "\x03\x99\x03\x06\x00\x00\x1f\xd8" + // 0x03990306: 0x00001FD8 - "\x03\x99\x03\x04\x00\x00\x1f\xd9" + // 0x03990304: 0x00001FD9 - "\x03\x99\x03\x00\x00\x00\x1f\xda" + // 0x03990300: 0x00001FDA - "\x1f\xfe\x03\x00\x00\x00\x1f\xdd" + // 0x1FFE0300: 0x00001FDD - "\x1f\xfe\x03\x01\x00\x00\x1f\xde" + // 0x1FFE0301: 0x00001FDE - "\x1f\xfe\x03B\x00\x00\x1f\xdf" + // 0x1FFE0342: 0x00001FDF - "\x03\xc5\x03\x06\x00\x00\x1f\xe0" + // 0x03C50306: 0x00001FE0 - "\x03\xc5\x03\x04\x00\x00\x1f\xe1" + // 0x03C50304: 0x00001FE1 - "\x03\xcb\x03\x00\x00\x00\x1f\xe2" + // 0x03CB0300: 0x00001FE2 - "\x03\xc1\x03\x13\x00\x00\x1f\xe4" + // 0x03C10313: 0x00001FE4 - "\x03\xc1\x03\x14\x00\x00\x1f\xe5" + // 0x03C10314: 0x00001FE5 - "\x03\xc5\x03B\x00\x00\x1f\xe6" + // 0x03C50342: 0x00001FE6 - "\x03\xcb\x03B\x00\x00\x1f\xe7" + // 0x03CB0342: 0x00001FE7 - "\x03\xa5\x03\x06\x00\x00\x1f\xe8" + // 0x03A50306: 0x00001FE8 - "\x03\xa5\x03\x04\x00\x00\x1f\xe9" + // 0x03A50304: 0x00001FE9 - "\x03\xa5\x03\x00\x00\x00\x1f\xea" + // 0x03A50300: 0x00001FEA - "\x03\xa1\x03\x14\x00\x00\x1f\xec" + // 0x03A10314: 0x00001FEC - "\x00\xa8\x03\x00\x00\x00\x1f\xed" + // 0x00A80300: 0x00001FED - "\x1f|\x03E\x00\x00\x1f\xf2" + // 0x1F7C0345: 0x00001FF2 - "\x03\xc9\x03E\x00\x00\x1f\xf3" + // 0x03C90345: 0x00001FF3 - "\x03\xce\x03E\x00\x00\x1f\xf4" + // 0x03CE0345: 0x00001FF4 - "\x03\xc9\x03B\x00\x00\x1f\xf6" + // 0x03C90342: 0x00001FF6 - "\x1f\xf6\x03E\x00\x00\x1f\xf7" + // 0x1FF60345: 0x00001FF7 - "\x03\x9f\x03\x00\x00\x00\x1f\xf8" + // 0x039F0300: 0x00001FF8 - "\x03\xa9\x03\x00\x00\x00\x1f\xfa" + // 0x03A90300: 0x00001FFA - "\x03\xa9\x03E\x00\x00\x1f\xfc" + // 0x03A90345: 0x00001FFC - "!\x90\x038\x00\x00!\x9a" + // 0x21900338: 0x0000219A - "!\x92\x038\x00\x00!\x9b" + // 0x21920338: 0x0000219B - "!\x94\x038\x00\x00!\xae" + // 0x21940338: 0x000021AE - "!\xd0\x038\x00\x00!\xcd" + // 0x21D00338: 0x000021CD - "!\xd4\x038\x00\x00!\xce" + // 0x21D40338: 0x000021CE - "!\xd2\x038\x00\x00!\xcf" + // 0x21D20338: 0x000021CF - "\"\x03\x038\x00\x00\"\x04" + // 0x22030338: 0x00002204 - "\"\b\x038\x00\x00\"\t" + // 0x22080338: 0x00002209 - "\"\v\x038\x00\x00\"\f" + // 0x220B0338: 0x0000220C - "\"#\x038\x00\x00\"$" + // 0x22230338: 0x00002224 - "\"%\x038\x00\x00\"&" + // 0x22250338: 0x00002226 - "\"<\x038\x00\x00\"A" + // 0x223C0338: 0x00002241 - "\"C\x038\x00\x00\"D" + // 0x22430338: 0x00002244 - "\"E\x038\x00\x00\"G" + // 0x22450338: 0x00002247 - "\"H\x038\x00\x00\"I" + // 0x22480338: 0x00002249 - "\x00=\x038\x00\x00\"`" + // 0x003D0338: 0x00002260 - "\"a\x038\x00\x00\"b" + // 0x22610338: 0x00002262 - "\"M\x038\x00\x00\"m" + // 0x224D0338: 0x0000226D - "\x00<\x038\x00\x00\"n" + // 0x003C0338: 0x0000226E - "\x00>\x038\x00\x00\"o" + // 0x003E0338: 0x0000226F - "\"d\x038\x00\x00\"p" + // 0x22640338: 0x00002270 - "\"e\x038\x00\x00\"q" + // 0x22650338: 0x00002271 - "\"r\x038\x00\x00\"t" + // 0x22720338: 0x00002274 - "\"s\x038\x00\x00\"u" + // 0x22730338: 0x00002275 - "\"v\x038\x00\x00\"x" + // 0x22760338: 0x00002278 - "\"w\x038\x00\x00\"y" + // 0x22770338: 0x00002279 - "\"z\x038\x00\x00\"\x80" + // 0x227A0338: 0x00002280 - "\"{\x038\x00\x00\"\x81" + // 0x227B0338: 0x00002281 - "\"\x82\x038\x00\x00\"\x84" + // 0x22820338: 0x00002284 - "\"\x83\x038\x00\x00\"\x85" + // 0x22830338: 0x00002285 - "\"\x86\x038\x00\x00\"\x88" + // 0x22860338: 0x00002288 - "\"\x87\x038\x00\x00\"\x89" + // 0x22870338: 0x00002289 - "\"\xa2\x038\x00\x00\"\xac" + // 0x22A20338: 0x000022AC - "\"\xa8\x038\x00\x00\"\xad" + // 0x22A80338: 0x000022AD - "\"\xa9\x038\x00\x00\"\xae" + // 0x22A90338: 0x000022AE - "\"\xab\x038\x00\x00\"\xaf" + // 0x22AB0338: 0x000022AF - "\"|\x038\x00\x00\"\xe0" + // 0x227C0338: 0x000022E0 - "\"}\x038\x00\x00\"\xe1" + // 0x227D0338: 0x000022E1 - "\"\x91\x038\x00\x00\"\xe2" + // 0x22910338: 0x000022E2 - "\"\x92\x038\x00\x00\"\xe3" + // 0x22920338: 0x000022E3 - "\"\xb2\x038\x00\x00\"\xea" + // 0x22B20338: 0x000022EA - "\"\xb3\x038\x00\x00\"\xeb" + // 0x22B30338: 0x000022EB - "\"\xb4\x038\x00\x00\"\xec" + // 0x22B40338: 0x000022EC - "\"\xb5\x038\x00\x00\"\xed" + // 0x22B50338: 0x000022ED - "0K0\x99\x00\x000L" + // 0x304B3099: 0x0000304C - "0M0\x99\x00\x000N" + // 0x304D3099: 0x0000304E - "0O0\x99\x00\x000P" + // 0x304F3099: 0x00003050 - "0Q0\x99\x00\x000R" + // 0x30513099: 0x00003052 - "0S0\x99\x00\x000T" + // 0x30533099: 0x00003054 - "0U0\x99\x00\x000V" + // 0x30553099: 0x00003056 - "0W0\x99\x00\x000X" + // 0x30573099: 0x00003058 - "0Y0\x99\x00\x000Z" + // 0x30593099: 0x0000305A - "0[0\x99\x00\x000\\" + // 0x305B3099: 0x0000305C - "0]0\x99\x00\x000^" + // 0x305D3099: 0x0000305E - "0_0\x99\x00\x000`" + // 0x305F3099: 0x00003060 - "0a0\x99\x00\x000b" + // 0x30613099: 0x00003062 - "0d0\x99\x00\x000e" + // 0x30643099: 0x00003065 - "0f0\x99\x00\x000g" + // 0x30663099: 0x00003067 - "0h0\x99\x00\x000i" + // 0x30683099: 0x00003069 - "0o0\x99\x00\x000p" + // 0x306F3099: 0x00003070 - "0o0\x9a\x00\x000q" + // 0x306F309A: 0x00003071 - "0r0\x99\x00\x000s" + // 0x30723099: 0x00003073 - "0r0\x9a\x00\x000t" + // 0x3072309A: 0x00003074 - "0u0\x99\x00\x000v" + // 0x30753099: 0x00003076 - "0u0\x9a\x00\x000w" + // 0x3075309A: 0x00003077 - "0x0\x99\x00\x000y" + // 0x30783099: 0x00003079 - "0x0\x9a\x00\x000z" + // 0x3078309A: 0x0000307A - "0{0\x99\x00\x000|" + // 0x307B3099: 0x0000307C - "0{0\x9a\x00\x000}" + // 0x307B309A: 0x0000307D - "0F0\x99\x00\x000\x94" + // 0x30463099: 0x00003094 - "0\x9d0\x99\x00\x000\x9e" + // 0x309D3099: 0x0000309E - "0\xab0\x99\x00\x000\xac" + // 0x30AB3099: 0x000030AC - "0\xad0\x99\x00\x000\xae" + // 0x30AD3099: 0x000030AE - "0\xaf0\x99\x00\x000\xb0" + // 0x30AF3099: 0x000030B0 - "0\xb10\x99\x00\x000\xb2" + // 0x30B13099: 0x000030B2 - "0\xb30\x99\x00\x000\xb4" + // 0x30B33099: 0x000030B4 - "0\xb50\x99\x00\x000\xb6" + // 0x30B53099: 0x000030B6 - "0\xb70\x99\x00\x000\xb8" + // 0x30B73099: 0x000030B8 - "0\xb90\x99\x00\x000\xba" + // 0x30B93099: 0x000030BA - "0\xbb0\x99\x00\x000\xbc" + // 0x30BB3099: 0x000030BC - "0\xbd0\x99\x00\x000\xbe" + // 0x30BD3099: 0x000030BE - "0\xbf0\x99\x00\x000\xc0" + // 0x30BF3099: 0x000030C0 - "0\xc10\x99\x00\x000\xc2" + // 0x30C13099: 0x000030C2 - "0\xc40\x99\x00\x000\xc5" + // 0x30C43099: 0x000030C5 - "0\xc60\x99\x00\x000\xc7" + // 0x30C63099: 0x000030C7 - "0\xc80\x99\x00\x000\xc9" + // 0x30C83099: 0x000030C9 - "0\xcf0\x99\x00\x000\xd0" + // 0x30CF3099: 0x000030D0 - "0\xcf0\x9a\x00\x000\xd1" + // 0x30CF309A: 0x000030D1 - "0\xd20\x99\x00\x000\xd3" + // 0x30D23099: 0x000030D3 - "0\xd20\x9a\x00\x000\xd4" + // 0x30D2309A: 0x000030D4 - "0\xd50\x99\x00\x000\xd6" + // 0x30D53099: 0x000030D6 - "0\xd50\x9a\x00\x000\xd7" + // 0x30D5309A: 0x000030D7 - "0\xd80\x99\x00\x000\xd9" + // 0x30D83099: 0x000030D9 - "0\xd80\x9a\x00\x000\xda" + // 0x30D8309A: 0x000030DA - "0\xdb0\x99\x00\x000\xdc" + // 0x30DB3099: 0x000030DC - "0\xdb0\x9a\x00\x000\xdd" + // 0x30DB309A: 0x000030DD - "0\xa60\x99\x00\x000\xf4" + // 0x30A63099: 0x000030F4 - "0\xef0\x99\x00\x000\xf7" + // 0x30EF3099: 0x000030F7 - "0\xf00\x99\x00\x000\xf8" + // 0x30F03099: 0x000030F8 - "0\xf10\x99\x00\x000\xf9" + // 0x30F13099: 0x000030F9 - "0\xf20\x99\x00\x000\xfa" + // 0x30F23099: 0x000030FA - "0\xfd0\x99\x00\x000\xfe" + // 0x30FD3099: 0x000030FE - "\x10\x99\x10\xba\x00\x01\x10\x9a" + // 0x109910BA: 0x0001109A - "\x10\x9b\x10\xba\x00\x01\x10\x9c" + // 0x109B10BA: 0x0001109C - "\x10\xa5\x10\xba\x00\x01\x10\xab" + // 0x10A510BA: 0x000110AB - "\x111\x11'\x00\x01\x11." + // 0x11311127: 0x0001112E - "\x112\x11'\x00\x01\x11/" + // 0x11321127: 0x0001112F - "\x13G\x13>\x00\x01\x13K" + // 0x1347133E: 0x0001134B - "\x13G\x13W\x00\x01\x13L" + // 0x13471357: 0x0001134C - "\x14\xb9\x14\xba\x00\x01\x14\xbb" + // 0x14B914BA: 0x000114BB - "\x14\xb9\x14\xb0\x00\x01\x14\xbc" + // 0x14B914B0: 0x000114BC - "\x14\xb9\x14\xbd\x00\x01\x14\xbe" + // 0x14B914BD: 0x000114BE - "\x15\xb8\x15\xaf\x00\x01\x15\xba" + // 0x15B815AF: 0x000115BA - "\x15\xb9\x15\xaf\x00\x01\x15\xbb" + // 0x15B915AF: 0x000115BB - "" - // Total size of tables: 53KB (54226 bytes) +// Total size of tables: 53KB (54226 bytes) diff --git a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go deleted file mode 100644 index 7297cce3..00000000 --- a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ /dev/null @@ -1,7693 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// +build go1.13 - -package norm - -import "sync" - -const ( - // Version is the Unicode edition from which the tables are derived. - Version = "11.0.0" - - // MaxTransformChunkSize indicates the maximum number of bytes that Transform - // may need to write atomically for any Form. Making a destination buffer at - // least this size ensures that Transform can always make progress and that - // the user does not need to grow the buffer on an ErrShortDst. - MaxTransformChunkSize = 35 + maxNonStarters*4 -) - -var ccc = [55]uint8{ - 0, 1, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, - 84, 91, 103, 107, 118, 122, 129, 130, - 132, 202, 214, 216, 218, 220, 222, 224, - 226, 228, 230, 232, 233, 234, 240, -} - -const ( - firstMulti = 0x186D - firstCCC = 0x2C9E - endMulti = 0x2F60 - firstLeadingCCC = 0x49AE - firstCCCZeroExcept = 0x4A78 - firstStarterWithNLead = 0x4A9F - lastDecomp = 0x4AA1 - maxDecomp = 0x8000 -) - -// decomps: 19105 bytes -var decomps = [...]byte{ - // Bytes 0 - 3f - 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, - 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, - 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, - 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, - 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, - 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, - 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, - 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, - // Bytes 40 - 7f - 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, - 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, - 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, - 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, - 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, - 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, - 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, - 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, - // Bytes 80 - bf - 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, - 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, - 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, - 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, - 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, - 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, - 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, - 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, - // Bytes c0 - ff - 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, - 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, - 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, - 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, - 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, - 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, - 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42, 0xC9, 0x90, - 0x42, 0xC9, 0x91, 0x42, 0xC9, 0x92, 0x42, 0xC9, - // Bytes 100 - 13f - 0x94, 0x42, 0xC9, 0x95, 0x42, 0xC9, 0x99, 0x42, - 0xC9, 0x9B, 0x42, 0xC9, 0x9C, 0x42, 0xC9, 0x9F, - 0x42, 0xC9, 0xA1, 0x42, 0xC9, 0xA3, 0x42, 0xC9, - 0xA5, 0x42, 0xC9, 0xA6, 0x42, 0xC9, 0xA8, 0x42, - 0xC9, 0xA9, 0x42, 0xC9, 0xAA, 0x42, 0xC9, 0xAB, - 0x42, 0xC9, 0xAD, 0x42, 0xC9, 0xAF, 0x42, 0xC9, - 0xB0, 0x42, 0xC9, 0xB1, 0x42, 0xC9, 0xB2, 0x42, - 0xC9, 0xB3, 0x42, 0xC9, 0xB4, 0x42, 0xC9, 0xB5, - // Bytes 140 - 17f - 0x42, 0xC9, 0xB8, 0x42, 0xC9, 0xB9, 0x42, 0xC9, - 0xBB, 0x42, 0xCA, 0x81, 0x42, 0xCA, 0x82, 0x42, - 0xCA, 0x83, 0x42, 0xCA, 0x89, 0x42, 0xCA, 0x8A, - 0x42, 0xCA, 0x8B, 0x42, 0xCA, 0x8C, 0x42, 0xCA, - 0x90, 0x42, 0xCA, 0x91, 0x42, 0xCA, 0x92, 0x42, - 0xCA, 0x95, 0x42, 0xCA, 0x9D, 0x42, 0xCA, 0x9F, - 0x42, 0xCA, 0xB9, 0x42, 0xCE, 0x91, 0x42, 0xCE, - 0x92, 0x42, 0xCE, 0x93, 0x42, 0xCE, 0x94, 0x42, - // Bytes 180 - 1bf - 0xCE, 0x95, 0x42, 0xCE, 0x96, 0x42, 0xCE, 0x97, - 0x42, 0xCE, 0x98, 0x42, 0xCE, 0x99, 0x42, 0xCE, - 0x9A, 0x42, 0xCE, 0x9B, 0x42, 0xCE, 0x9C, 0x42, - 0xCE, 0x9D, 0x42, 0xCE, 0x9E, 0x42, 0xCE, 0x9F, - 0x42, 0xCE, 0xA0, 0x42, 0xCE, 0xA1, 0x42, 0xCE, - 0xA3, 0x42, 0xCE, 0xA4, 0x42, 0xCE, 0xA5, 0x42, - 0xCE, 0xA6, 0x42, 0xCE, 0xA7, 0x42, 0xCE, 0xA8, - 0x42, 0xCE, 0xA9, 0x42, 0xCE, 0xB1, 0x42, 0xCE, - // Bytes 1c0 - 1ff - 0xB2, 0x42, 0xCE, 0xB3, 0x42, 0xCE, 0xB4, 0x42, - 0xCE, 0xB5, 0x42, 0xCE, 0xB6, 0x42, 0xCE, 0xB7, - 0x42, 0xCE, 0xB8, 0x42, 0xCE, 0xB9, 0x42, 0xCE, - 0xBA, 0x42, 0xCE, 0xBB, 0x42, 0xCE, 0xBC, 0x42, - 0xCE, 0xBD, 0x42, 0xCE, 0xBE, 0x42, 0xCE, 0xBF, - 0x42, 0xCF, 0x80, 0x42, 0xCF, 0x81, 0x42, 0xCF, - 0x82, 0x42, 0xCF, 0x83, 0x42, 0xCF, 0x84, 0x42, - 0xCF, 0x85, 0x42, 0xCF, 0x86, 0x42, 0xCF, 0x87, - // Bytes 200 - 23f - 0x42, 0xCF, 0x88, 0x42, 0xCF, 0x89, 0x42, 0xCF, - 0x9C, 0x42, 0xCF, 0x9D, 0x42, 0xD0, 0xBD, 0x42, - 0xD1, 0x8A, 0x42, 0xD1, 0x8C, 0x42, 0xD7, 0x90, - 0x42, 0xD7, 0x91, 0x42, 0xD7, 0x92, 0x42, 0xD7, - 0x93, 0x42, 0xD7, 0x94, 0x42, 0xD7, 0x9B, 0x42, - 0xD7, 0x9C, 0x42, 0xD7, 0x9D, 0x42, 0xD7, 0xA2, - 0x42, 0xD7, 0xA8, 0x42, 0xD7, 0xAA, 0x42, 0xD8, - 0xA1, 0x42, 0xD8, 0xA7, 0x42, 0xD8, 0xA8, 0x42, - // Bytes 240 - 27f - 0xD8, 0xA9, 0x42, 0xD8, 0xAA, 0x42, 0xD8, 0xAB, - 0x42, 0xD8, 0xAC, 0x42, 0xD8, 0xAD, 0x42, 0xD8, - 0xAE, 0x42, 0xD8, 0xAF, 0x42, 0xD8, 0xB0, 0x42, - 0xD8, 0xB1, 0x42, 0xD8, 0xB2, 0x42, 0xD8, 0xB3, - 0x42, 0xD8, 0xB4, 0x42, 0xD8, 0xB5, 0x42, 0xD8, - 0xB6, 0x42, 0xD8, 0xB7, 0x42, 0xD8, 0xB8, 0x42, - 0xD8, 0xB9, 0x42, 0xD8, 0xBA, 0x42, 0xD9, 0x81, - 0x42, 0xD9, 0x82, 0x42, 0xD9, 0x83, 0x42, 0xD9, - // Bytes 280 - 2bf - 0x84, 0x42, 0xD9, 0x85, 0x42, 0xD9, 0x86, 0x42, - 0xD9, 0x87, 0x42, 0xD9, 0x88, 0x42, 0xD9, 0x89, - 0x42, 0xD9, 0x8A, 0x42, 0xD9, 0xAE, 0x42, 0xD9, - 0xAF, 0x42, 0xD9, 0xB1, 0x42, 0xD9, 0xB9, 0x42, - 0xD9, 0xBA, 0x42, 0xD9, 0xBB, 0x42, 0xD9, 0xBE, - 0x42, 0xD9, 0xBF, 0x42, 0xDA, 0x80, 0x42, 0xDA, - 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, - 0xDA, 0x87, 0x42, 0xDA, 0x88, 0x42, 0xDA, 0x8C, - // Bytes 2c0 - 2ff - 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, - 0x91, 0x42, 0xDA, 0x98, 0x42, 0xDA, 0xA1, 0x42, - 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, - 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, - 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, - 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, - 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, - 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, - // Bytes 300 - 33f - 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, - 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, - 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, - 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, - 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, - 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, - 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, - 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, - // Bytes 340 - 37f - 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, - 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, - 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, - 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, - 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, - 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, - 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, - 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, - // Bytes 380 - 3bf - 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, - 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, - 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, - 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, - 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, - 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, - 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, - 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, - // Bytes 3c0 - 3ff - 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, - 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, - 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, - 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, - 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, - 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, - 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, - 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, - // Bytes 400 - 43f - 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, - 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, - 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, - 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, - 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, - 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, - 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, - 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, - // Bytes 440 - 47f - 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, - 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, - 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, - 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, - 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, - 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, - 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, - 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, - // Bytes 480 - 4bf - 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, - 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, - 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, - 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, - 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, - 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, - 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, - 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, - // Bytes 4c0 - 4ff - 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, - 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, - 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, - 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, - 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, - 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, - 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, - 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, - // Bytes 500 - 53f - 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, - 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, - 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, - 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, - 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, - 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, - 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, - 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, - // Bytes 540 - 57f - 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, - 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, - 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, - 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, - 0xE3, 0x83, 0xA0, 0x43, 0xE3, 0x83, 0xA1, 0x43, - 0xE3, 0x83, 0xA2, 0x43, 0xE3, 0x83, 0xA3, 0x43, - 0xE3, 0x83, 0xA4, 0x43, 0xE3, 0x83, 0xA5, 0x43, - 0xE3, 0x83, 0xA6, 0x43, 0xE3, 0x83, 0xA7, 0x43, - // Bytes 580 - 5bf - 0xE3, 0x83, 0xA8, 0x43, 0xE3, 0x83, 0xA9, 0x43, - 0xE3, 0x83, 0xAA, 0x43, 0xE3, 0x83, 0xAB, 0x43, - 0xE3, 0x83, 0xAC, 0x43, 0xE3, 0x83, 0xAD, 0x43, - 0xE3, 0x83, 0xAF, 0x43, 0xE3, 0x83, 0xB0, 0x43, - 0xE3, 0x83, 0xB1, 0x43, 0xE3, 0x83, 0xB2, 0x43, - 0xE3, 0x83, 0xB3, 0x43, 0xE3, 0x83, 0xBB, 0x43, - 0xE3, 0x83, 0xBC, 0x43, 0xE3, 0x92, 0x9E, 0x43, - 0xE3, 0x92, 0xB9, 0x43, 0xE3, 0x92, 0xBB, 0x43, - // Bytes 5c0 - 5ff - 0xE3, 0x93, 0x9F, 0x43, 0xE3, 0x94, 0x95, 0x43, - 0xE3, 0x9B, 0xAE, 0x43, 0xE3, 0x9B, 0xBC, 0x43, - 0xE3, 0x9E, 0x81, 0x43, 0xE3, 0xA0, 0xAF, 0x43, - 0xE3, 0xA1, 0xA2, 0x43, 0xE3, 0xA1, 0xBC, 0x43, - 0xE3, 0xA3, 0x87, 0x43, 0xE3, 0xA3, 0xA3, 0x43, - 0xE3, 0xA4, 0x9C, 0x43, 0xE3, 0xA4, 0xBA, 0x43, - 0xE3, 0xA8, 0xAE, 0x43, 0xE3, 0xA9, 0xAC, 0x43, - 0xE3, 0xAB, 0xA4, 0x43, 0xE3, 0xAC, 0x88, 0x43, - // Bytes 600 - 63f - 0xE3, 0xAC, 0x99, 0x43, 0xE3, 0xAD, 0x89, 0x43, - 0xE3, 0xAE, 0x9D, 0x43, 0xE3, 0xB0, 0x98, 0x43, - 0xE3, 0xB1, 0x8E, 0x43, 0xE3, 0xB4, 0xB3, 0x43, - 0xE3, 0xB6, 0x96, 0x43, 0xE3, 0xBA, 0xAC, 0x43, - 0xE3, 0xBA, 0xB8, 0x43, 0xE3, 0xBC, 0x9B, 0x43, - 0xE3, 0xBF, 0xBC, 0x43, 0xE4, 0x80, 0x88, 0x43, - 0xE4, 0x80, 0x98, 0x43, 0xE4, 0x80, 0xB9, 0x43, - 0xE4, 0x81, 0x86, 0x43, 0xE4, 0x82, 0x96, 0x43, - // Bytes 640 - 67f - 0xE4, 0x83, 0xA3, 0x43, 0xE4, 0x84, 0xAF, 0x43, - 0xE4, 0x88, 0x82, 0x43, 0xE4, 0x88, 0xA7, 0x43, - 0xE4, 0x8A, 0xA0, 0x43, 0xE4, 0x8C, 0x81, 0x43, - 0xE4, 0x8C, 0xB4, 0x43, 0xE4, 0x8D, 0x99, 0x43, - 0xE4, 0x8F, 0x95, 0x43, 0xE4, 0x8F, 0x99, 0x43, - 0xE4, 0x90, 0x8B, 0x43, 0xE4, 0x91, 0xAB, 0x43, - 0xE4, 0x94, 0xAB, 0x43, 0xE4, 0x95, 0x9D, 0x43, - 0xE4, 0x95, 0xA1, 0x43, 0xE4, 0x95, 0xAB, 0x43, - // Bytes 680 - 6bf - 0xE4, 0x97, 0x97, 0x43, 0xE4, 0x97, 0xB9, 0x43, - 0xE4, 0x98, 0xB5, 0x43, 0xE4, 0x9A, 0xBE, 0x43, - 0xE4, 0x9B, 0x87, 0x43, 0xE4, 0xA6, 0x95, 0x43, - 0xE4, 0xA7, 0xA6, 0x43, 0xE4, 0xA9, 0xAE, 0x43, - 0xE4, 0xA9, 0xB6, 0x43, 0xE4, 0xAA, 0xB2, 0x43, - 0xE4, 0xAC, 0xB3, 0x43, 0xE4, 0xAF, 0x8E, 0x43, - 0xE4, 0xB3, 0x8E, 0x43, 0xE4, 0xB3, 0xAD, 0x43, - 0xE4, 0xB3, 0xB8, 0x43, 0xE4, 0xB5, 0x96, 0x43, - // Bytes 6c0 - 6ff - 0xE4, 0xB8, 0x80, 0x43, 0xE4, 0xB8, 0x81, 0x43, - 0xE4, 0xB8, 0x83, 0x43, 0xE4, 0xB8, 0x89, 0x43, - 0xE4, 0xB8, 0x8A, 0x43, 0xE4, 0xB8, 0x8B, 0x43, - 0xE4, 0xB8, 0x8D, 0x43, 0xE4, 0xB8, 0x99, 0x43, - 0xE4, 0xB8, 0xA6, 0x43, 0xE4, 0xB8, 0xA8, 0x43, - 0xE4, 0xB8, 0xAD, 0x43, 0xE4, 0xB8, 0xB2, 0x43, - 0xE4, 0xB8, 0xB6, 0x43, 0xE4, 0xB8, 0xB8, 0x43, - 0xE4, 0xB8, 0xB9, 0x43, 0xE4, 0xB8, 0xBD, 0x43, - // Bytes 700 - 73f - 0xE4, 0xB8, 0xBF, 0x43, 0xE4, 0xB9, 0x81, 0x43, - 0xE4, 0xB9, 0x99, 0x43, 0xE4, 0xB9, 0x9D, 0x43, - 0xE4, 0xBA, 0x82, 0x43, 0xE4, 0xBA, 0x85, 0x43, - 0xE4, 0xBA, 0x86, 0x43, 0xE4, 0xBA, 0x8C, 0x43, - 0xE4, 0xBA, 0x94, 0x43, 0xE4, 0xBA, 0xA0, 0x43, - 0xE4, 0xBA, 0xA4, 0x43, 0xE4, 0xBA, 0xAE, 0x43, - 0xE4, 0xBA, 0xBA, 0x43, 0xE4, 0xBB, 0x80, 0x43, - 0xE4, 0xBB, 0x8C, 0x43, 0xE4, 0xBB, 0xA4, 0x43, - // Bytes 740 - 77f - 0xE4, 0xBC, 0x81, 0x43, 0xE4, 0xBC, 0x91, 0x43, - 0xE4, 0xBD, 0xA0, 0x43, 0xE4, 0xBE, 0x80, 0x43, - 0xE4, 0xBE, 0x86, 0x43, 0xE4, 0xBE, 0x8B, 0x43, - 0xE4, 0xBE, 0xAE, 0x43, 0xE4, 0xBE, 0xBB, 0x43, - 0xE4, 0xBE, 0xBF, 0x43, 0xE5, 0x80, 0x82, 0x43, - 0xE5, 0x80, 0xAB, 0x43, 0xE5, 0x81, 0xBA, 0x43, - 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, - 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, - // Bytes 780 - 7bf - 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, - 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, - 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, - 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, - 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, - 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, - 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, - 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, - // Bytes 7c0 - 7ff - 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, - 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, - 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, - 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, - 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, - 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, - 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, - 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, - // Bytes 800 - 83f - 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, - 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, - 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, - 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, - 0xE5, 0x88, 0xBB, 0x43, 0xE5, 0x89, 0x86, 0x43, - 0xE5, 0x89, 0x8D, 0x43, 0xE5, 0x89, 0xB2, 0x43, - 0xE5, 0x89, 0xB7, 0x43, 0xE5, 0x8A, 0x89, 0x43, - 0xE5, 0x8A, 0x9B, 0x43, 0xE5, 0x8A, 0xA3, 0x43, - // Bytes 840 - 87f - 0xE5, 0x8A, 0xB3, 0x43, 0xE5, 0x8A, 0xB4, 0x43, - 0xE5, 0x8B, 0x87, 0x43, 0xE5, 0x8B, 0x89, 0x43, - 0xE5, 0x8B, 0x92, 0x43, 0xE5, 0x8B, 0x9E, 0x43, - 0xE5, 0x8B, 0xA4, 0x43, 0xE5, 0x8B, 0xB5, 0x43, - 0xE5, 0x8B, 0xB9, 0x43, 0xE5, 0x8B, 0xBA, 0x43, - 0xE5, 0x8C, 0x85, 0x43, 0xE5, 0x8C, 0x86, 0x43, - 0xE5, 0x8C, 0x95, 0x43, 0xE5, 0x8C, 0x97, 0x43, - 0xE5, 0x8C, 0x9A, 0x43, 0xE5, 0x8C, 0xB8, 0x43, - // Bytes 880 - 8bf - 0xE5, 0x8C, 0xBB, 0x43, 0xE5, 0x8C, 0xBF, 0x43, - 0xE5, 0x8D, 0x81, 0x43, 0xE5, 0x8D, 0x84, 0x43, - 0xE5, 0x8D, 0x85, 0x43, 0xE5, 0x8D, 0x89, 0x43, - 0xE5, 0x8D, 0x91, 0x43, 0xE5, 0x8D, 0x94, 0x43, - 0xE5, 0x8D, 0x9A, 0x43, 0xE5, 0x8D, 0x9C, 0x43, - 0xE5, 0x8D, 0xA9, 0x43, 0xE5, 0x8D, 0xB0, 0x43, - 0xE5, 0x8D, 0xB3, 0x43, 0xE5, 0x8D, 0xB5, 0x43, - 0xE5, 0x8D, 0xBD, 0x43, 0xE5, 0x8D, 0xBF, 0x43, - // Bytes 8c0 - 8ff - 0xE5, 0x8E, 0x82, 0x43, 0xE5, 0x8E, 0xB6, 0x43, - 0xE5, 0x8F, 0x83, 0x43, 0xE5, 0x8F, 0x88, 0x43, - 0xE5, 0x8F, 0x8A, 0x43, 0xE5, 0x8F, 0x8C, 0x43, - 0xE5, 0x8F, 0x9F, 0x43, 0xE5, 0x8F, 0xA3, 0x43, - 0xE5, 0x8F, 0xA5, 0x43, 0xE5, 0x8F, 0xAB, 0x43, - 0xE5, 0x8F, 0xAF, 0x43, 0xE5, 0x8F, 0xB1, 0x43, - 0xE5, 0x8F, 0xB3, 0x43, 0xE5, 0x90, 0x86, 0x43, - 0xE5, 0x90, 0x88, 0x43, 0xE5, 0x90, 0x8D, 0x43, - // Bytes 900 - 93f - 0xE5, 0x90, 0x8F, 0x43, 0xE5, 0x90, 0x9D, 0x43, - 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, - 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, - 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, - 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, - 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, - 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, - 0xE5, 0x95, 0x95, 0x43, 0xE5, 0x95, 0xA3, 0x43, - // Bytes 940 - 97f - 0xE5, 0x96, 0x84, 0x43, 0xE5, 0x96, 0x87, 0x43, - 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, - 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, - 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, - 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, - 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, - 0xE5, 0x99, 0xA8, 0x43, 0xE5, 0x99, 0xB4, 0x43, - 0xE5, 0x9B, 0x97, 0x43, 0xE5, 0x9B, 0x9B, 0x43, - // Bytes 980 - 9bf - 0xE5, 0x9B, 0xB9, 0x43, 0xE5, 0x9C, 0x96, 0x43, - 0xE5, 0x9C, 0x97, 0x43, 0xE5, 0x9C, 0x9F, 0x43, - 0xE5, 0x9C, 0xB0, 0x43, 0xE5, 0x9E, 0x8B, 0x43, - 0xE5, 0x9F, 0x8E, 0x43, 0xE5, 0x9F, 0xB4, 0x43, - 0xE5, 0xA0, 0x8D, 0x43, 0xE5, 0xA0, 0xB1, 0x43, - 0xE5, 0xA0, 0xB2, 0x43, 0xE5, 0xA1, 0x80, 0x43, - 0xE5, 0xA1, 0x9A, 0x43, 0xE5, 0xA1, 0x9E, 0x43, - 0xE5, 0xA2, 0xA8, 0x43, 0xE5, 0xA2, 0xAC, 0x43, - // Bytes 9c0 - 9ff - 0xE5, 0xA2, 0xB3, 0x43, 0xE5, 0xA3, 0x98, 0x43, - 0xE5, 0xA3, 0x9F, 0x43, 0xE5, 0xA3, 0xAB, 0x43, - 0xE5, 0xA3, 0xAE, 0x43, 0xE5, 0xA3, 0xB0, 0x43, - 0xE5, 0xA3, 0xB2, 0x43, 0xE5, 0xA3, 0xB7, 0x43, - 0xE5, 0xA4, 0x82, 0x43, 0xE5, 0xA4, 0x86, 0x43, - 0xE5, 0xA4, 0x8A, 0x43, 0xE5, 0xA4, 0x95, 0x43, - 0xE5, 0xA4, 0x9A, 0x43, 0xE5, 0xA4, 0x9C, 0x43, - 0xE5, 0xA4, 0xA2, 0x43, 0xE5, 0xA4, 0xA7, 0x43, - // Bytes a00 - a3f - 0xE5, 0xA4, 0xA9, 0x43, 0xE5, 0xA5, 0x84, 0x43, - 0xE5, 0xA5, 0x88, 0x43, 0xE5, 0xA5, 0x91, 0x43, - 0xE5, 0xA5, 0x94, 0x43, 0xE5, 0xA5, 0xA2, 0x43, - 0xE5, 0xA5, 0xB3, 0x43, 0xE5, 0xA7, 0x98, 0x43, - 0xE5, 0xA7, 0xAC, 0x43, 0xE5, 0xA8, 0x9B, 0x43, - 0xE5, 0xA8, 0xA7, 0x43, 0xE5, 0xA9, 0xA2, 0x43, - 0xE5, 0xA9, 0xA6, 0x43, 0xE5, 0xAA, 0xB5, 0x43, - 0xE5, 0xAC, 0x88, 0x43, 0xE5, 0xAC, 0xA8, 0x43, - // Bytes a40 - a7f - 0xE5, 0xAC, 0xBE, 0x43, 0xE5, 0xAD, 0x90, 0x43, - 0xE5, 0xAD, 0x97, 0x43, 0xE5, 0xAD, 0xA6, 0x43, - 0xE5, 0xAE, 0x80, 0x43, 0xE5, 0xAE, 0x85, 0x43, - 0xE5, 0xAE, 0x97, 0x43, 0xE5, 0xAF, 0x83, 0x43, - 0xE5, 0xAF, 0x98, 0x43, 0xE5, 0xAF, 0xA7, 0x43, - 0xE5, 0xAF, 0xAE, 0x43, 0xE5, 0xAF, 0xB3, 0x43, - 0xE5, 0xAF, 0xB8, 0x43, 0xE5, 0xAF, 0xBF, 0x43, - 0xE5, 0xB0, 0x86, 0x43, 0xE5, 0xB0, 0x8F, 0x43, - // Bytes a80 - abf - 0xE5, 0xB0, 0xA2, 0x43, 0xE5, 0xB0, 0xB8, 0x43, - 0xE5, 0xB0, 0xBF, 0x43, 0xE5, 0xB1, 0xA0, 0x43, - 0xE5, 0xB1, 0xA2, 0x43, 0xE5, 0xB1, 0xA4, 0x43, - 0xE5, 0xB1, 0xA5, 0x43, 0xE5, 0xB1, 0xAE, 0x43, - 0xE5, 0xB1, 0xB1, 0x43, 0xE5, 0xB2, 0x8D, 0x43, - 0xE5, 0xB3, 0x80, 0x43, 0xE5, 0xB4, 0x99, 0x43, - 0xE5, 0xB5, 0x83, 0x43, 0xE5, 0xB5, 0x90, 0x43, - 0xE5, 0xB5, 0xAB, 0x43, 0xE5, 0xB5, 0xAE, 0x43, - // Bytes ac0 - aff - 0xE5, 0xB5, 0xBC, 0x43, 0xE5, 0xB6, 0xB2, 0x43, - 0xE5, 0xB6, 0xBA, 0x43, 0xE5, 0xB7, 0x9B, 0x43, - 0xE5, 0xB7, 0xA1, 0x43, 0xE5, 0xB7, 0xA2, 0x43, - 0xE5, 0xB7, 0xA5, 0x43, 0xE5, 0xB7, 0xA6, 0x43, - 0xE5, 0xB7, 0xB1, 0x43, 0xE5, 0xB7, 0xBD, 0x43, - 0xE5, 0xB7, 0xBE, 0x43, 0xE5, 0xB8, 0xA8, 0x43, - 0xE5, 0xB8, 0xBD, 0x43, 0xE5, 0xB9, 0xA9, 0x43, - 0xE5, 0xB9, 0xB2, 0x43, 0xE5, 0xB9, 0xB4, 0x43, - // Bytes b00 - b3f - 0xE5, 0xB9, 0xBA, 0x43, 0xE5, 0xB9, 0xBC, 0x43, - 0xE5, 0xB9, 0xBF, 0x43, 0xE5, 0xBA, 0xA6, 0x43, - 0xE5, 0xBA, 0xB0, 0x43, 0xE5, 0xBA, 0xB3, 0x43, - 0xE5, 0xBA, 0xB6, 0x43, 0xE5, 0xBB, 0x89, 0x43, - 0xE5, 0xBB, 0x8A, 0x43, 0xE5, 0xBB, 0x92, 0x43, - 0xE5, 0xBB, 0x93, 0x43, 0xE5, 0xBB, 0x99, 0x43, - 0xE5, 0xBB, 0xAC, 0x43, 0xE5, 0xBB, 0xB4, 0x43, - 0xE5, 0xBB, 0xBE, 0x43, 0xE5, 0xBC, 0x84, 0x43, - // Bytes b40 - b7f - 0xE5, 0xBC, 0x8B, 0x43, 0xE5, 0xBC, 0x93, 0x43, - 0xE5, 0xBC, 0xA2, 0x43, 0xE5, 0xBD, 0x90, 0x43, - 0xE5, 0xBD, 0x93, 0x43, 0xE5, 0xBD, 0xA1, 0x43, - 0xE5, 0xBD, 0xA2, 0x43, 0xE5, 0xBD, 0xA9, 0x43, - 0xE5, 0xBD, 0xAB, 0x43, 0xE5, 0xBD, 0xB3, 0x43, - 0xE5, 0xBE, 0x8B, 0x43, 0xE5, 0xBE, 0x8C, 0x43, - 0xE5, 0xBE, 0x97, 0x43, 0xE5, 0xBE, 0x9A, 0x43, - 0xE5, 0xBE, 0xA9, 0x43, 0xE5, 0xBE, 0xAD, 0x43, - // Bytes b80 - bbf - 0xE5, 0xBF, 0x83, 0x43, 0xE5, 0xBF, 0x8D, 0x43, - 0xE5, 0xBF, 0x97, 0x43, 0xE5, 0xBF, 0xB5, 0x43, - 0xE5, 0xBF, 0xB9, 0x43, 0xE6, 0x80, 0x92, 0x43, - 0xE6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, - 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, - 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, - 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, - 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, - // Bytes bc0 - bff - 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, - 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, - 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, - 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, - 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, - 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, - 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, - 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, - // Bytes c00 - c3f - 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, - 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, - 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, - 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, - 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, - 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, - 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, - 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, - // Bytes c40 - c7f - 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, - 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, - 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, - 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, - 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, - 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, - 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, - 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, - // Bytes c80 - cbf - 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, - 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, - 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, - 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, - 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, - 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, - 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, - 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, - // Bytes cc0 - cff - 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, - 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, - 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, - 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, - 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0x9A, 0x88, 0x43, - 0xE6, 0x9A, 0x91, 0x43, 0xE6, 0x9A, 0x9C, 0x43, - 0xE6, 0x9A, 0xB4, 0x43, 0xE6, 0x9B, 0x86, 0x43, - 0xE6, 0x9B, 0xB0, 0x43, 0xE6, 0x9B, 0xB4, 0x43, - // Bytes d00 - d3f - 0xE6, 0x9B, 0xB8, 0x43, 0xE6, 0x9C, 0x80, 0x43, - 0xE6, 0x9C, 0x88, 0x43, 0xE6, 0x9C, 0x89, 0x43, - 0xE6, 0x9C, 0x97, 0x43, 0xE6, 0x9C, 0x9B, 0x43, - 0xE6, 0x9C, 0xA1, 0x43, 0xE6, 0x9C, 0xA8, 0x43, - 0xE6, 0x9D, 0x8E, 0x43, 0xE6, 0x9D, 0x93, 0x43, - 0xE6, 0x9D, 0x96, 0x43, 0xE6, 0x9D, 0x9E, 0x43, - 0xE6, 0x9D, 0xBB, 0x43, 0xE6, 0x9E, 0x85, 0x43, - 0xE6, 0x9E, 0x97, 0x43, 0xE6, 0x9F, 0xB3, 0x43, - // Bytes d40 - d7f - 0xE6, 0x9F, 0xBA, 0x43, 0xE6, 0xA0, 0x97, 0x43, - 0xE6, 0xA0, 0x9F, 0x43, 0xE6, 0xA0, 0xAA, 0x43, - 0xE6, 0xA1, 0x92, 0x43, 0xE6, 0xA2, 0x81, 0x43, - 0xE6, 0xA2, 0x85, 0x43, 0xE6, 0xA2, 0x8E, 0x43, - 0xE6, 0xA2, 0xA8, 0x43, 0xE6, 0xA4, 0x94, 0x43, - 0xE6, 0xA5, 0x82, 0x43, 0xE6, 0xA6, 0xA3, 0x43, - 0xE6, 0xA7, 0xAA, 0x43, 0xE6, 0xA8, 0x82, 0x43, - 0xE6, 0xA8, 0x93, 0x43, 0xE6, 0xAA, 0xA8, 0x43, - // Bytes d80 - dbf - 0xE6, 0xAB, 0x93, 0x43, 0xE6, 0xAB, 0x9B, 0x43, - 0xE6, 0xAC, 0x84, 0x43, 0xE6, 0xAC, 0xA0, 0x43, - 0xE6, 0xAC, 0xA1, 0x43, 0xE6, 0xAD, 0x94, 0x43, - 0xE6, 0xAD, 0xA2, 0x43, 0xE6, 0xAD, 0xA3, 0x43, - 0xE6, 0xAD, 0xB2, 0x43, 0xE6, 0xAD, 0xB7, 0x43, - 0xE6, 0xAD, 0xB9, 0x43, 0xE6, 0xAE, 0x9F, 0x43, - 0xE6, 0xAE, 0xAE, 0x43, 0xE6, 0xAE, 0xB3, 0x43, - 0xE6, 0xAE, 0xBA, 0x43, 0xE6, 0xAE, 0xBB, 0x43, - // Bytes dc0 - dff - 0xE6, 0xAF, 0x8B, 0x43, 0xE6, 0xAF, 0x8D, 0x43, - 0xE6, 0xAF, 0x94, 0x43, 0xE6, 0xAF, 0x9B, 0x43, - 0xE6, 0xB0, 0x8F, 0x43, 0xE6, 0xB0, 0x94, 0x43, - 0xE6, 0xB0, 0xB4, 0x43, 0xE6, 0xB1, 0x8E, 0x43, - 0xE6, 0xB1, 0xA7, 0x43, 0xE6, 0xB2, 0x88, 0x43, - 0xE6, 0xB2, 0xBF, 0x43, 0xE6, 0xB3, 0x8C, 0x43, - 0xE6, 0xB3, 0x8D, 0x43, 0xE6, 0xB3, 0xA5, 0x43, - 0xE6, 0xB3, 0xA8, 0x43, 0xE6, 0xB4, 0x96, 0x43, - // Bytes e00 - e3f - 0xE6, 0xB4, 0x9B, 0x43, 0xE6, 0xB4, 0x9E, 0x43, - 0xE6, 0xB4, 0xB4, 0x43, 0xE6, 0xB4, 0xBE, 0x43, - 0xE6, 0xB5, 0x81, 0x43, 0xE6, 0xB5, 0xA9, 0x43, - 0xE6, 0xB5, 0xAA, 0x43, 0xE6, 0xB5, 0xB7, 0x43, - 0xE6, 0xB5, 0xB8, 0x43, 0xE6, 0xB6, 0x85, 0x43, - 0xE6, 0xB7, 0x8B, 0x43, 0xE6, 0xB7, 0x9A, 0x43, - 0xE6, 0xB7, 0xAA, 0x43, 0xE6, 0xB7, 0xB9, 0x43, - 0xE6, 0xB8, 0x9A, 0x43, 0xE6, 0xB8, 0xAF, 0x43, - // Bytes e40 - e7f - 0xE6, 0xB9, 0xAE, 0x43, 0xE6, 0xBA, 0x80, 0x43, - 0xE6, 0xBA, 0x9C, 0x43, 0xE6, 0xBA, 0xBA, 0x43, - 0xE6, 0xBB, 0x87, 0x43, 0xE6, 0xBB, 0x8B, 0x43, - 0xE6, 0xBB, 0x91, 0x43, 0xE6, 0xBB, 0x9B, 0x43, - 0xE6, 0xBC, 0x8F, 0x43, 0xE6, 0xBC, 0x94, 0x43, - 0xE6, 0xBC, 0xA2, 0x43, 0xE6, 0xBC, 0xA3, 0x43, - 0xE6, 0xBD, 0xAE, 0x43, 0xE6, 0xBF, 0x86, 0x43, - 0xE6, 0xBF, 0xAB, 0x43, 0xE6, 0xBF, 0xBE, 0x43, - // Bytes e80 - ebf - 0xE7, 0x80, 0x9B, 0x43, 0xE7, 0x80, 0x9E, 0x43, - 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, - 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, - 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, - 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, - 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, - 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, - 0xE7, 0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, - // Bytes ec0 - eff - 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, - 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, - 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, - 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, - 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, - 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, - 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, - 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, - // Bytes f00 - f3f - 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, - 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, - 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, - 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, - 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, - 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, - 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, - 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, - // Bytes f40 - f7f - 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, - 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, - 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, - 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, - 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, - 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, - 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, - 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, - // Bytes f80 - fbf - 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, - 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, - 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, - 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, - 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, - 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, - 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, - 0xE7, 0x96, 0x92, 0x43, 0xE7, 0x97, 0xA2, 0x43, - // Bytes fc0 - fff - 0xE7, 0x98, 0x90, 0x43, 0xE7, 0x98, 0x9D, 0x43, - 0xE7, 0x98, 0x9F, 0x43, 0xE7, 0x99, 0x82, 0x43, - 0xE7, 0x99, 0xA9, 0x43, 0xE7, 0x99, 0xB6, 0x43, - 0xE7, 0x99, 0xBD, 0x43, 0xE7, 0x9A, 0xAE, 0x43, - 0xE7, 0x9A, 0xBF, 0x43, 0xE7, 0x9B, 0x8A, 0x43, - 0xE7, 0x9B, 0x9B, 0x43, 0xE7, 0x9B, 0xA3, 0x43, - 0xE7, 0x9B, 0xA7, 0x43, 0xE7, 0x9B, 0xAE, 0x43, - 0xE7, 0x9B, 0xB4, 0x43, 0xE7, 0x9C, 0x81, 0x43, - // Bytes 1000 - 103f - 0xE7, 0x9C, 0x9E, 0x43, 0xE7, 0x9C, 0x9F, 0x43, - 0xE7, 0x9D, 0x80, 0x43, 0xE7, 0x9D, 0x8A, 0x43, - 0xE7, 0x9E, 0x8B, 0x43, 0xE7, 0x9E, 0xA7, 0x43, - 0xE7, 0x9F, 0x9B, 0x43, 0xE7, 0x9F, 0xA2, 0x43, - 0xE7, 0x9F, 0xB3, 0x43, 0xE7, 0xA1, 0x8E, 0x43, - 0xE7, 0xA1, 0xAB, 0x43, 0xE7, 0xA2, 0x8C, 0x43, - 0xE7, 0xA2, 0x91, 0x43, 0xE7, 0xA3, 0x8A, 0x43, - 0xE7, 0xA3, 0x8C, 0x43, 0xE7, 0xA3, 0xBB, 0x43, - // Bytes 1040 - 107f - 0xE7, 0xA4, 0xAA, 0x43, 0xE7, 0xA4, 0xBA, 0x43, - 0xE7, 0xA4, 0xBC, 0x43, 0xE7, 0xA4, 0xBE, 0x43, - 0xE7, 0xA5, 0x88, 0x43, 0xE7, 0xA5, 0x89, 0x43, - 0xE7, 0xA5, 0x90, 0x43, 0xE7, 0xA5, 0x96, 0x43, - 0xE7, 0xA5, 0x9D, 0x43, 0xE7, 0xA5, 0x9E, 0x43, - 0xE7, 0xA5, 0xA5, 0x43, 0xE7, 0xA5, 0xBF, 0x43, - 0xE7, 0xA6, 0x81, 0x43, 0xE7, 0xA6, 0x8D, 0x43, - 0xE7, 0xA6, 0x8E, 0x43, 0xE7, 0xA6, 0x8F, 0x43, - // Bytes 1080 - 10bf - 0xE7, 0xA6, 0xAE, 0x43, 0xE7, 0xA6, 0xB8, 0x43, - 0xE7, 0xA6, 0xBE, 0x43, 0xE7, 0xA7, 0x8A, 0x43, - 0xE7, 0xA7, 0x98, 0x43, 0xE7, 0xA7, 0xAB, 0x43, - 0xE7, 0xA8, 0x9C, 0x43, 0xE7, 0xA9, 0x80, 0x43, - 0xE7, 0xA9, 0x8A, 0x43, 0xE7, 0xA9, 0x8F, 0x43, - 0xE7, 0xA9, 0xB4, 0x43, 0xE7, 0xA9, 0xBA, 0x43, - 0xE7, 0xAA, 0x81, 0x43, 0xE7, 0xAA, 0xB1, 0x43, - 0xE7, 0xAB, 0x8B, 0x43, 0xE7, 0xAB, 0xAE, 0x43, - // Bytes 10c0 - 10ff - 0xE7, 0xAB, 0xB9, 0x43, 0xE7, 0xAC, 0xA0, 0x43, - 0xE7, 0xAE, 0x8F, 0x43, 0xE7, 0xAF, 0x80, 0x43, - 0xE7, 0xAF, 0x86, 0x43, 0xE7, 0xAF, 0x89, 0x43, - 0xE7, 0xB0, 0xBE, 0x43, 0xE7, 0xB1, 0xA0, 0x43, - 0xE7, 0xB1, 0xB3, 0x43, 0xE7, 0xB1, 0xBB, 0x43, - 0xE7, 0xB2, 0x92, 0x43, 0xE7, 0xB2, 0xBE, 0x43, - 0xE7, 0xB3, 0x92, 0x43, 0xE7, 0xB3, 0x96, 0x43, - 0xE7, 0xB3, 0xA3, 0x43, 0xE7, 0xB3, 0xA7, 0x43, - // Bytes 1100 - 113f - 0xE7, 0xB3, 0xA8, 0x43, 0xE7, 0xB3, 0xB8, 0x43, - 0xE7, 0xB4, 0x80, 0x43, 0xE7, 0xB4, 0x90, 0x43, - 0xE7, 0xB4, 0xA2, 0x43, 0xE7, 0xB4, 0xAF, 0x43, - 0xE7, 0xB5, 0x82, 0x43, 0xE7, 0xB5, 0x9B, 0x43, - 0xE7, 0xB5, 0xA3, 0x43, 0xE7, 0xB6, 0xA0, 0x43, - 0xE7, 0xB6, 0xBE, 0x43, 0xE7, 0xB7, 0x87, 0x43, - 0xE7, 0xB7, 0xB4, 0x43, 0xE7, 0xB8, 0x82, 0x43, - 0xE7, 0xB8, 0x89, 0x43, 0xE7, 0xB8, 0xB7, 0x43, - // Bytes 1140 - 117f - 0xE7, 0xB9, 0x81, 0x43, 0xE7, 0xB9, 0x85, 0x43, - 0xE7, 0xBC, 0xB6, 0x43, 0xE7, 0xBC, 0xBE, 0x43, - 0xE7, 0xBD, 0x91, 0x43, 0xE7, 0xBD, 0xB2, 0x43, - 0xE7, 0xBD, 0xB9, 0x43, 0xE7, 0xBD, 0xBA, 0x43, - 0xE7, 0xBE, 0x85, 0x43, 0xE7, 0xBE, 0x8A, 0x43, - 0xE7, 0xBE, 0x95, 0x43, 0xE7, 0xBE, 0x9A, 0x43, - 0xE7, 0xBE, 0xBD, 0x43, 0xE7, 0xBF, 0xBA, 0x43, - 0xE8, 0x80, 0x81, 0x43, 0xE8, 0x80, 0x85, 0x43, - // Bytes 1180 - 11bf - 0xE8, 0x80, 0x8C, 0x43, 0xE8, 0x80, 0x92, 0x43, - 0xE8, 0x80, 0xB3, 0x43, 0xE8, 0x81, 0x86, 0x43, - 0xE8, 0x81, 0xA0, 0x43, 0xE8, 0x81, 0xAF, 0x43, - 0xE8, 0x81, 0xB0, 0x43, 0xE8, 0x81, 0xBE, 0x43, - 0xE8, 0x81, 0xBF, 0x43, 0xE8, 0x82, 0x89, 0x43, - 0xE8, 0x82, 0x8B, 0x43, 0xE8, 0x82, 0xAD, 0x43, - 0xE8, 0x82, 0xB2, 0x43, 0xE8, 0x84, 0x83, 0x43, - 0xE8, 0x84, 0xBE, 0x43, 0xE8, 0x87, 0x98, 0x43, - // Bytes 11c0 - 11ff - 0xE8, 0x87, 0xA3, 0x43, 0xE8, 0x87, 0xA8, 0x43, - 0xE8, 0x87, 0xAA, 0x43, 0xE8, 0x87, 0xAD, 0x43, - 0xE8, 0x87, 0xB3, 0x43, 0xE8, 0x87, 0xBC, 0x43, - 0xE8, 0x88, 0x81, 0x43, 0xE8, 0x88, 0x84, 0x43, - 0xE8, 0x88, 0x8C, 0x43, 0xE8, 0x88, 0x98, 0x43, - 0xE8, 0x88, 0x9B, 0x43, 0xE8, 0x88, 0x9F, 0x43, - 0xE8, 0x89, 0xAE, 0x43, 0xE8, 0x89, 0xAF, 0x43, - 0xE8, 0x89, 0xB2, 0x43, 0xE8, 0x89, 0xB8, 0x43, - // Bytes 1200 - 123f - 0xE8, 0x89, 0xB9, 0x43, 0xE8, 0x8A, 0x8B, 0x43, - 0xE8, 0x8A, 0x91, 0x43, 0xE8, 0x8A, 0x9D, 0x43, - 0xE8, 0x8A, 0xB1, 0x43, 0xE8, 0x8A, 0xB3, 0x43, - 0xE8, 0x8A, 0xBD, 0x43, 0xE8, 0x8B, 0xA5, 0x43, - 0xE8, 0x8B, 0xA6, 0x43, 0xE8, 0x8C, 0x9D, 0x43, - 0xE8, 0x8C, 0xA3, 0x43, 0xE8, 0x8C, 0xB6, 0x43, - 0xE8, 0x8D, 0x92, 0x43, 0xE8, 0x8D, 0x93, 0x43, - 0xE8, 0x8D, 0xA3, 0x43, 0xE8, 0x8E, 0xAD, 0x43, - // Bytes 1240 - 127f - 0xE8, 0x8E, 0xBD, 0x43, 0xE8, 0x8F, 0x89, 0x43, - 0xE8, 0x8F, 0x8A, 0x43, 0xE8, 0x8F, 0x8C, 0x43, - 0xE8, 0x8F, 0x9C, 0x43, 0xE8, 0x8F, 0xA7, 0x43, - 0xE8, 0x8F, 0xAF, 0x43, 0xE8, 0x8F, 0xB1, 0x43, - 0xE8, 0x90, 0xBD, 0x43, 0xE8, 0x91, 0x89, 0x43, - 0xE8, 0x91, 0x97, 0x43, 0xE8, 0x93, 0xAE, 0x43, - 0xE8, 0x93, 0xB1, 0x43, 0xE8, 0x93, 0xB3, 0x43, - 0xE8, 0x93, 0xBC, 0x43, 0xE8, 0x94, 0x96, 0x43, - // Bytes 1280 - 12bf - 0xE8, 0x95, 0xA4, 0x43, 0xE8, 0x97, 0x8D, 0x43, - 0xE8, 0x97, 0xBA, 0x43, 0xE8, 0x98, 0x86, 0x43, - 0xE8, 0x98, 0x92, 0x43, 0xE8, 0x98, 0xAD, 0x43, - 0xE8, 0x98, 0xBF, 0x43, 0xE8, 0x99, 0x8D, 0x43, - 0xE8, 0x99, 0x90, 0x43, 0xE8, 0x99, 0x9C, 0x43, - 0xE8, 0x99, 0xA7, 0x43, 0xE8, 0x99, 0xA9, 0x43, - 0xE8, 0x99, 0xAB, 0x43, 0xE8, 0x9A, 0x88, 0x43, - 0xE8, 0x9A, 0xA9, 0x43, 0xE8, 0x9B, 0xA2, 0x43, - // Bytes 12c0 - 12ff - 0xE8, 0x9C, 0x8E, 0x43, 0xE8, 0x9C, 0xA8, 0x43, - 0xE8, 0x9D, 0xAB, 0x43, 0xE8, 0x9D, 0xB9, 0x43, - 0xE8, 0x9E, 0x86, 0x43, 0xE8, 0x9E, 0xBA, 0x43, - 0xE8, 0x9F, 0xA1, 0x43, 0xE8, 0xA0, 0x81, 0x43, - 0xE8, 0xA0, 0x9F, 0x43, 0xE8, 0xA1, 0x80, 0x43, - 0xE8, 0xA1, 0x8C, 0x43, 0xE8, 0xA1, 0xA0, 0x43, - 0xE8, 0xA1, 0xA3, 0x43, 0xE8, 0xA3, 0x82, 0x43, - 0xE8, 0xA3, 0x8F, 0x43, 0xE8, 0xA3, 0x97, 0x43, - // Bytes 1300 - 133f - 0xE8, 0xA3, 0x9E, 0x43, 0xE8, 0xA3, 0xA1, 0x43, - 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, - 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, - 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, - 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43, - 0xE8, 0xA6, 0x96, 0x43, 0xE8, 0xA7, 0x92, 0x43, - 0xE8, 0xA7, 0xA3, 0x43, 0xE8, 0xA8, 0x80, 0x43, - 0xE8, 0xAA, 0xA0, 0x43, 0xE8, 0xAA, 0xAA, 0x43, - // Bytes 1340 - 137f - 0xE8, 0xAA, 0xBF, 0x43, 0xE8, 0xAB, 0x8B, 0x43, - 0xE8, 0xAB, 0x92, 0x43, 0xE8, 0xAB, 0x96, 0x43, - 0xE8, 0xAB, 0xAD, 0x43, 0xE8, 0xAB, 0xB8, 0x43, - 0xE8, 0xAB, 0xBE, 0x43, 0xE8, 0xAC, 0x81, 0x43, - 0xE8, 0xAC, 0xB9, 0x43, 0xE8, 0xAD, 0x98, 0x43, - 0xE8, 0xAE, 0x80, 0x43, 0xE8, 0xAE, 0x8A, 0x43, - 0xE8, 0xB0, 0xB7, 0x43, 0xE8, 0xB1, 0x86, 0x43, - 0xE8, 0xB1, 0x88, 0x43, 0xE8, 0xB1, 0x95, 0x43, - // Bytes 1380 - 13bf - 0xE8, 0xB1, 0xB8, 0x43, 0xE8, 0xB2, 0x9D, 0x43, - 0xE8, 0xB2, 0xA1, 0x43, 0xE8, 0xB2, 0xA9, 0x43, - 0xE8, 0xB2, 0xAB, 0x43, 0xE8, 0xB3, 0x81, 0x43, - 0xE8, 0xB3, 0x82, 0x43, 0xE8, 0xB3, 0x87, 0x43, - 0xE8, 0xB3, 0x88, 0x43, 0xE8, 0xB3, 0x93, 0x43, - 0xE8, 0xB4, 0x88, 0x43, 0xE8, 0xB4, 0x9B, 0x43, - 0xE8, 0xB5, 0xA4, 0x43, 0xE8, 0xB5, 0xB0, 0x43, - 0xE8, 0xB5, 0xB7, 0x43, 0xE8, 0xB6, 0xB3, 0x43, - // Bytes 13c0 - 13ff - 0xE8, 0xB6, 0xBC, 0x43, 0xE8, 0xB7, 0x8B, 0x43, - 0xE8, 0xB7, 0xAF, 0x43, 0xE8, 0xB7, 0xB0, 0x43, - 0xE8, 0xBA, 0xAB, 0x43, 0xE8, 0xBB, 0x8A, 0x43, - 0xE8, 0xBB, 0x94, 0x43, 0xE8, 0xBC, 0xA6, 0x43, - 0xE8, 0xBC, 0xAA, 0x43, 0xE8, 0xBC, 0xB8, 0x43, - 0xE8, 0xBC, 0xBB, 0x43, 0xE8, 0xBD, 0xA2, 0x43, - 0xE8, 0xBE, 0x9B, 0x43, 0xE8, 0xBE, 0x9E, 0x43, - 0xE8, 0xBE, 0xB0, 0x43, 0xE8, 0xBE, 0xB5, 0x43, - // Bytes 1400 - 143f - 0xE8, 0xBE, 0xB6, 0x43, 0xE9, 0x80, 0xA3, 0x43, - 0xE9, 0x80, 0xB8, 0x43, 0xE9, 0x81, 0x8A, 0x43, - 0xE9, 0x81, 0xA9, 0x43, 0xE9, 0x81, 0xB2, 0x43, - 0xE9, 0x81, 0xBC, 0x43, 0xE9, 0x82, 0x8F, 0x43, - 0xE9, 0x82, 0x91, 0x43, 0xE9, 0x82, 0x94, 0x43, - 0xE9, 0x83, 0x8E, 0x43, 0xE9, 0x83, 0x9E, 0x43, - 0xE9, 0x83, 0xB1, 0x43, 0xE9, 0x83, 0xBD, 0x43, - 0xE9, 0x84, 0x91, 0x43, 0xE9, 0x84, 0x9B, 0x43, - // Bytes 1440 - 147f - 0xE9, 0x85, 0x89, 0x43, 0xE9, 0x85, 0x8D, 0x43, - 0xE9, 0x85, 0xAA, 0x43, 0xE9, 0x86, 0x99, 0x43, - 0xE9, 0x86, 0xB4, 0x43, 0xE9, 0x87, 0x86, 0x43, - 0xE9, 0x87, 0x8C, 0x43, 0xE9, 0x87, 0x8F, 0x43, - 0xE9, 0x87, 0x91, 0x43, 0xE9, 0x88, 0xB4, 0x43, - 0xE9, 0x88, 0xB8, 0x43, 0xE9, 0x89, 0xB6, 0x43, - 0xE9, 0x89, 0xBC, 0x43, 0xE9, 0x8B, 0x97, 0x43, - 0xE9, 0x8B, 0x98, 0x43, 0xE9, 0x8C, 0x84, 0x43, - // Bytes 1480 - 14bf - 0xE9, 0x8D, 0x8A, 0x43, 0xE9, 0x8F, 0xB9, 0x43, - 0xE9, 0x90, 0x95, 0x43, 0xE9, 0x95, 0xB7, 0x43, - 0xE9, 0x96, 0x80, 0x43, 0xE9, 0x96, 0x8B, 0x43, - 0xE9, 0x96, 0xAD, 0x43, 0xE9, 0x96, 0xB7, 0x43, - 0xE9, 0x98, 0x9C, 0x43, 0xE9, 0x98, 0xAE, 0x43, - 0xE9, 0x99, 0x8B, 0x43, 0xE9, 0x99, 0x8D, 0x43, - 0xE9, 0x99, 0xB5, 0x43, 0xE9, 0x99, 0xB8, 0x43, - 0xE9, 0x99, 0xBC, 0x43, 0xE9, 0x9A, 0x86, 0x43, - // Bytes 14c0 - 14ff - 0xE9, 0x9A, 0xA3, 0x43, 0xE9, 0x9A, 0xB6, 0x43, - 0xE9, 0x9A, 0xB7, 0x43, 0xE9, 0x9A, 0xB8, 0x43, - 0xE9, 0x9A, 0xB9, 0x43, 0xE9, 0x9B, 0x83, 0x43, - 0xE9, 0x9B, 0xA2, 0x43, 0xE9, 0x9B, 0xA3, 0x43, - 0xE9, 0x9B, 0xA8, 0x43, 0xE9, 0x9B, 0xB6, 0x43, - 0xE9, 0x9B, 0xB7, 0x43, 0xE9, 0x9C, 0xA3, 0x43, - 0xE9, 0x9C, 0xB2, 0x43, 0xE9, 0x9D, 0x88, 0x43, - 0xE9, 0x9D, 0x91, 0x43, 0xE9, 0x9D, 0x96, 0x43, - // Bytes 1500 - 153f - 0xE9, 0x9D, 0x9E, 0x43, 0xE9, 0x9D, 0xA2, 0x43, - 0xE9, 0x9D, 0xA9, 0x43, 0xE9, 0x9F, 0x8B, 0x43, - 0xE9, 0x9F, 0x9B, 0x43, 0xE9, 0x9F, 0xA0, 0x43, - 0xE9, 0x9F, 0xAD, 0x43, 0xE9, 0x9F, 0xB3, 0x43, - 0xE9, 0x9F, 0xBF, 0x43, 0xE9, 0xA0, 0x81, 0x43, - 0xE9, 0xA0, 0x85, 0x43, 0xE9, 0xA0, 0x8B, 0x43, - 0xE9, 0xA0, 0x98, 0x43, 0xE9, 0xA0, 0xA9, 0x43, - 0xE9, 0xA0, 0xBB, 0x43, 0xE9, 0xA1, 0x9E, 0x43, - // Bytes 1540 - 157f - 0xE9, 0xA2, 0xA8, 0x43, 0xE9, 0xA3, 0x9B, 0x43, - 0xE9, 0xA3, 0x9F, 0x43, 0xE9, 0xA3, 0xA2, 0x43, - 0xE9, 0xA3, 0xAF, 0x43, 0xE9, 0xA3, 0xBC, 0x43, - 0xE9, 0xA4, 0xA8, 0x43, 0xE9, 0xA4, 0xA9, 0x43, - 0xE9, 0xA6, 0x96, 0x43, 0xE9, 0xA6, 0x99, 0x43, - 0xE9, 0xA6, 0xA7, 0x43, 0xE9, 0xA6, 0xAC, 0x43, - 0xE9, 0xA7, 0x82, 0x43, 0xE9, 0xA7, 0xB1, 0x43, - 0xE9, 0xA7, 0xBE, 0x43, 0xE9, 0xA9, 0xAA, 0x43, - // Bytes 1580 - 15bf - 0xE9, 0xAA, 0xA8, 0x43, 0xE9, 0xAB, 0x98, 0x43, - 0xE9, 0xAB, 0x9F, 0x43, 0xE9, 0xAC, 0x92, 0x43, - 0xE9, 0xAC, 0xA5, 0x43, 0xE9, 0xAC, 0xAF, 0x43, - 0xE9, 0xAC, 0xB2, 0x43, 0xE9, 0xAC, 0xBC, 0x43, - 0xE9, 0xAD, 0x9A, 0x43, 0xE9, 0xAD, 0xAF, 0x43, - 0xE9, 0xB1, 0x80, 0x43, 0xE9, 0xB1, 0x97, 0x43, - 0xE9, 0xB3, 0xA5, 0x43, 0xE9, 0xB3, 0xBD, 0x43, - 0xE9, 0xB5, 0xA7, 0x43, 0xE9, 0xB6, 0xB4, 0x43, - // Bytes 15c0 - 15ff - 0xE9, 0xB7, 0xBA, 0x43, 0xE9, 0xB8, 0x9E, 0x43, - 0xE9, 0xB9, 0xB5, 0x43, 0xE9, 0xB9, 0xBF, 0x43, - 0xE9, 0xBA, 0x97, 0x43, 0xE9, 0xBA, 0x9F, 0x43, - 0xE9, 0xBA, 0xA5, 0x43, 0xE9, 0xBA, 0xBB, 0x43, - 0xE9, 0xBB, 0x83, 0x43, 0xE9, 0xBB, 0x8D, 0x43, - 0xE9, 0xBB, 0x8E, 0x43, 0xE9, 0xBB, 0x91, 0x43, - 0xE9, 0xBB, 0xB9, 0x43, 0xE9, 0xBB, 0xBD, 0x43, - 0xE9, 0xBB, 0xBE, 0x43, 0xE9, 0xBC, 0x85, 0x43, - // Bytes 1600 - 163f - 0xE9, 0xBC, 0x8E, 0x43, 0xE9, 0xBC, 0x8F, 0x43, - 0xE9, 0xBC, 0x93, 0x43, 0xE9, 0xBC, 0x96, 0x43, - 0xE9, 0xBC, 0xA0, 0x43, 0xE9, 0xBC, 0xBB, 0x43, - 0xE9, 0xBD, 0x83, 0x43, 0xE9, 0xBD, 0x8A, 0x43, - 0xE9, 0xBD, 0x92, 0x43, 0xE9, 0xBE, 0x8D, 0x43, - 0xE9, 0xBE, 0x8E, 0x43, 0xE9, 0xBE, 0x9C, 0x43, - 0xE9, 0xBE, 0x9F, 0x43, 0xE9, 0xBE, 0xA0, 0x43, - 0xEA, 0x9C, 0xA7, 0x43, 0xEA, 0x9D, 0xAF, 0x43, - // Bytes 1640 - 167f - 0xEA, 0xAC, 0xB7, 0x43, 0xEA, 0xAD, 0x92, 0x44, - 0xF0, 0xA0, 0x84, 0xA2, 0x44, 0xF0, 0xA0, 0x94, - 0x9C, 0x44, 0xF0, 0xA0, 0x94, 0xA5, 0x44, 0xF0, - 0xA0, 0x95, 0x8B, 0x44, 0xF0, 0xA0, 0x98, 0xBA, - 0x44, 0xF0, 0xA0, 0xA0, 0x84, 0x44, 0xF0, 0xA0, - 0xA3, 0x9E, 0x44, 0xF0, 0xA0, 0xA8, 0xAC, 0x44, - 0xF0, 0xA0, 0xAD, 0xA3, 0x44, 0xF0, 0xA1, 0x93, - 0xA4, 0x44, 0xF0, 0xA1, 0x9A, 0xA8, 0x44, 0xF0, - // Bytes 1680 - 16bf - 0xA1, 0x9B, 0xAA, 0x44, 0xF0, 0xA1, 0xA7, 0x88, - 0x44, 0xF0, 0xA1, 0xAC, 0x98, 0x44, 0xF0, 0xA1, - 0xB4, 0x8B, 0x44, 0xF0, 0xA1, 0xB7, 0xA4, 0x44, - 0xF0, 0xA1, 0xB7, 0xA6, 0x44, 0xF0, 0xA2, 0x86, - 0x83, 0x44, 0xF0, 0xA2, 0x86, 0x9F, 0x44, 0xF0, - 0xA2, 0x8C, 0xB1, 0x44, 0xF0, 0xA2, 0x9B, 0x94, - 0x44, 0xF0, 0xA2, 0xA1, 0x84, 0x44, 0xF0, 0xA2, - 0xA1, 0x8A, 0x44, 0xF0, 0xA2, 0xAC, 0x8C, 0x44, - // Bytes 16c0 - 16ff - 0xF0, 0xA2, 0xAF, 0xB1, 0x44, 0xF0, 0xA3, 0x80, - 0x8A, 0x44, 0xF0, 0xA3, 0x8A, 0xB8, 0x44, 0xF0, - 0xA3, 0x8D, 0x9F, 0x44, 0xF0, 0xA3, 0x8E, 0x93, - 0x44, 0xF0, 0xA3, 0x8E, 0x9C, 0x44, 0xF0, 0xA3, - 0x8F, 0x83, 0x44, 0xF0, 0xA3, 0x8F, 0x95, 0x44, - 0xF0, 0xA3, 0x91, 0xAD, 0x44, 0xF0, 0xA3, 0x9A, - 0xA3, 0x44, 0xF0, 0xA3, 0xA2, 0xA7, 0x44, 0xF0, - 0xA3, 0xAA, 0x8D, 0x44, 0xF0, 0xA3, 0xAB, 0xBA, - // Bytes 1700 - 173f - 0x44, 0xF0, 0xA3, 0xB2, 0xBC, 0x44, 0xF0, 0xA3, - 0xB4, 0x9E, 0x44, 0xF0, 0xA3, 0xBB, 0x91, 0x44, - 0xF0, 0xA3, 0xBD, 0x9E, 0x44, 0xF0, 0xA3, 0xBE, - 0x8E, 0x44, 0xF0, 0xA4, 0x89, 0xA3, 0x44, 0xF0, - 0xA4, 0x8B, 0xAE, 0x44, 0xF0, 0xA4, 0x8E, 0xAB, - 0x44, 0xF0, 0xA4, 0x98, 0x88, 0x44, 0xF0, 0xA4, - 0x9C, 0xB5, 0x44, 0xF0, 0xA4, 0xA0, 0x94, 0x44, - 0xF0, 0xA4, 0xB0, 0xB6, 0x44, 0xF0, 0xA4, 0xB2, - // Bytes 1740 - 177f - 0x92, 0x44, 0xF0, 0xA4, 0xBE, 0xA1, 0x44, 0xF0, - 0xA4, 0xBE, 0xB8, 0x44, 0xF0, 0xA5, 0x81, 0x84, - 0x44, 0xF0, 0xA5, 0x83, 0xB2, 0x44, 0xF0, 0xA5, - 0x83, 0xB3, 0x44, 0xF0, 0xA5, 0x84, 0x99, 0x44, - 0xF0, 0xA5, 0x84, 0xB3, 0x44, 0xF0, 0xA5, 0x89, - 0x89, 0x44, 0xF0, 0xA5, 0x90, 0x9D, 0x44, 0xF0, - 0xA5, 0x98, 0xA6, 0x44, 0xF0, 0xA5, 0x9A, 0x9A, - 0x44, 0xF0, 0xA5, 0x9B, 0x85, 0x44, 0xF0, 0xA5, - // Bytes 1780 - 17bf - 0xA5, 0xBC, 0x44, 0xF0, 0xA5, 0xAA, 0xA7, 0x44, - 0xF0, 0xA5, 0xAE, 0xAB, 0x44, 0xF0, 0xA5, 0xB2, - 0x80, 0x44, 0xF0, 0xA5, 0xB3, 0x90, 0x44, 0xF0, - 0xA5, 0xBE, 0x86, 0x44, 0xF0, 0xA6, 0x87, 0x9A, - 0x44, 0xF0, 0xA6, 0x88, 0xA8, 0x44, 0xF0, 0xA6, - 0x89, 0x87, 0x44, 0xF0, 0xA6, 0x8B, 0x99, 0x44, - 0xF0, 0xA6, 0x8C, 0xBE, 0x44, 0xF0, 0xA6, 0x93, - 0x9A, 0x44, 0xF0, 0xA6, 0x94, 0xA3, 0x44, 0xF0, - // Bytes 17c0 - 17ff - 0xA6, 0x96, 0xA8, 0x44, 0xF0, 0xA6, 0x9E, 0xA7, - 0x44, 0xF0, 0xA6, 0x9E, 0xB5, 0x44, 0xF0, 0xA6, - 0xAC, 0xBC, 0x44, 0xF0, 0xA6, 0xB0, 0xB6, 0x44, - 0xF0, 0xA6, 0xB3, 0x95, 0x44, 0xF0, 0xA6, 0xB5, - 0xAB, 0x44, 0xF0, 0xA6, 0xBC, 0xAC, 0x44, 0xF0, - 0xA6, 0xBE, 0xB1, 0x44, 0xF0, 0xA7, 0x83, 0x92, - 0x44, 0xF0, 0xA7, 0x8F, 0x8A, 0x44, 0xF0, 0xA7, - 0x99, 0xA7, 0x44, 0xF0, 0xA7, 0xA2, 0xAE, 0x44, - // Bytes 1800 - 183f - 0xF0, 0xA7, 0xA5, 0xA6, 0x44, 0xF0, 0xA7, 0xB2, - 0xA8, 0x44, 0xF0, 0xA7, 0xBB, 0x93, 0x44, 0xF0, - 0xA7, 0xBC, 0xAF, 0x44, 0xF0, 0xA8, 0x97, 0x92, - 0x44, 0xF0, 0xA8, 0x97, 0xAD, 0x44, 0xF0, 0xA8, - 0x9C, 0xAE, 0x44, 0xF0, 0xA8, 0xAF, 0xBA, 0x44, - 0xF0, 0xA8, 0xB5, 0xB7, 0x44, 0xF0, 0xA9, 0x85, - 0x85, 0x44, 0xF0, 0xA9, 0x87, 0x9F, 0x44, 0xF0, - 0xA9, 0x88, 0x9A, 0x44, 0xF0, 0xA9, 0x90, 0x8A, - // Bytes 1840 - 187f - 0x44, 0xF0, 0xA9, 0x92, 0x96, 0x44, 0xF0, 0xA9, - 0x96, 0xB6, 0x44, 0xF0, 0xA9, 0xAC, 0xB0, 0x44, - 0xF0, 0xAA, 0x83, 0x8E, 0x44, 0xF0, 0xAA, 0x84, - 0x85, 0x44, 0xF0, 0xAA, 0x88, 0x8E, 0x44, 0xF0, - 0xAA, 0x8A, 0x91, 0x44, 0xF0, 0xAA, 0x8E, 0x92, - 0x44, 0xF0, 0xAA, 0x98, 0x80, 0x42, 0x21, 0x21, - 0x42, 0x21, 0x3F, 0x42, 0x2E, 0x2E, 0x42, 0x30, - 0x2C, 0x42, 0x30, 0x2E, 0x42, 0x31, 0x2C, 0x42, - // Bytes 1880 - 18bf - 0x31, 0x2E, 0x42, 0x31, 0x30, 0x42, 0x31, 0x31, - 0x42, 0x31, 0x32, 0x42, 0x31, 0x33, 0x42, 0x31, - 0x34, 0x42, 0x31, 0x35, 0x42, 0x31, 0x36, 0x42, - 0x31, 0x37, 0x42, 0x31, 0x38, 0x42, 0x31, 0x39, - 0x42, 0x32, 0x2C, 0x42, 0x32, 0x2E, 0x42, 0x32, - 0x30, 0x42, 0x32, 0x31, 0x42, 0x32, 0x32, 0x42, - 0x32, 0x33, 0x42, 0x32, 0x34, 0x42, 0x32, 0x35, - 0x42, 0x32, 0x36, 0x42, 0x32, 0x37, 0x42, 0x32, - // Bytes 18c0 - 18ff - 0x38, 0x42, 0x32, 0x39, 0x42, 0x33, 0x2C, 0x42, - 0x33, 0x2E, 0x42, 0x33, 0x30, 0x42, 0x33, 0x31, - 0x42, 0x33, 0x32, 0x42, 0x33, 0x33, 0x42, 0x33, - 0x34, 0x42, 0x33, 0x35, 0x42, 0x33, 0x36, 0x42, - 0x33, 0x37, 0x42, 0x33, 0x38, 0x42, 0x33, 0x39, - 0x42, 0x34, 0x2C, 0x42, 0x34, 0x2E, 0x42, 0x34, - 0x30, 0x42, 0x34, 0x31, 0x42, 0x34, 0x32, 0x42, - 0x34, 0x33, 0x42, 0x34, 0x34, 0x42, 0x34, 0x35, - // Bytes 1900 - 193f - 0x42, 0x34, 0x36, 0x42, 0x34, 0x37, 0x42, 0x34, - 0x38, 0x42, 0x34, 0x39, 0x42, 0x35, 0x2C, 0x42, - 0x35, 0x2E, 0x42, 0x35, 0x30, 0x42, 0x36, 0x2C, - 0x42, 0x36, 0x2E, 0x42, 0x37, 0x2C, 0x42, 0x37, - 0x2E, 0x42, 0x38, 0x2C, 0x42, 0x38, 0x2E, 0x42, - 0x39, 0x2C, 0x42, 0x39, 0x2E, 0x42, 0x3D, 0x3D, - 0x42, 0x3F, 0x21, 0x42, 0x3F, 0x3F, 0x42, 0x41, - 0x55, 0x42, 0x42, 0x71, 0x42, 0x43, 0x44, 0x42, - // Bytes 1940 - 197f - 0x44, 0x4A, 0x42, 0x44, 0x5A, 0x42, 0x44, 0x7A, - 0x42, 0x47, 0x42, 0x42, 0x47, 0x79, 0x42, 0x48, - 0x50, 0x42, 0x48, 0x56, 0x42, 0x48, 0x67, 0x42, - 0x48, 0x7A, 0x42, 0x49, 0x49, 0x42, 0x49, 0x4A, - 0x42, 0x49, 0x55, 0x42, 0x49, 0x56, 0x42, 0x49, - 0x58, 0x42, 0x4B, 0x42, 0x42, 0x4B, 0x4B, 0x42, - 0x4B, 0x4D, 0x42, 0x4C, 0x4A, 0x42, 0x4C, 0x6A, - 0x42, 0x4D, 0x42, 0x42, 0x4D, 0x43, 0x42, 0x4D, - // Bytes 1980 - 19bf - 0x44, 0x42, 0x4D, 0x56, 0x42, 0x4D, 0x57, 0x42, - 0x4E, 0x4A, 0x42, 0x4E, 0x6A, 0x42, 0x4E, 0x6F, - 0x42, 0x50, 0x48, 0x42, 0x50, 0x52, 0x42, 0x50, - 0x61, 0x42, 0x52, 0x73, 0x42, 0x53, 0x44, 0x42, - 0x53, 0x4D, 0x42, 0x53, 0x53, 0x42, 0x53, 0x76, - 0x42, 0x54, 0x4D, 0x42, 0x56, 0x49, 0x42, 0x57, - 0x43, 0x42, 0x57, 0x5A, 0x42, 0x57, 0x62, 0x42, - 0x58, 0x49, 0x42, 0x63, 0x63, 0x42, 0x63, 0x64, - // Bytes 19c0 - 19ff - 0x42, 0x63, 0x6D, 0x42, 0x64, 0x42, 0x42, 0x64, - 0x61, 0x42, 0x64, 0x6C, 0x42, 0x64, 0x6D, 0x42, - 0x64, 0x7A, 0x42, 0x65, 0x56, 0x42, 0x66, 0x66, - 0x42, 0x66, 0x69, 0x42, 0x66, 0x6C, 0x42, 0x66, - 0x6D, 0x42, 0x68, 0x61, 0x42, 0x69, 0x69, 0x42, - 0x69, 0x6A, 0x42, 0x69, 0x6E, 0x42, 0x69, 0x76, - 0x42, 0x69, 0x78, 0x42, 0x6B, 0x41, 0x42, 0x6B, - 0x56, 0x42, 0x6B, 0x57, 0x42, 0x6B, 0x67, 0x42, - // Bytes 1a00 - 1a3f - 0x6B, 0x6C, 0x42, 0x6B, 0x6D, 0x42, 0x6B, 0x74, - 0x42, 0x6C, 0x6A, 0x42, 0x6C, 0x6D, 0x42, 0x6C, - 0x6E, 0x42, 0x6C, 0x78, 0x42, 0x6D, 0x32, 0x42, - 0x6D, 0x33, 0x42, 0x6D, 0x41, 0x42, 0x6D, 0x56, - 0x42, 0x6D, 0x57, 0x42, 0x6D, 0x62, 0x42, 0x6D, - 0x67, 0x42, 0x6D, 0x6C, 0x42, 0x6D, 0x6D, 0x42, - 0x6D, 0x73, 0x42, 0x6E, 0x41, 0x42, 0x6E, 0x46, - 0x42, 0x6E, 0x56, 0x42, 0x6E, 0x57, 0x42, 0x6E, - // Bytes 1a40 - 1a7f - 0x6A, 0x42, 0x6E, 0x6D, 0x42, 0x6E, 0x73, 0x42, - 0x6F, 0x56, 0x42, 0x70, 0x41, 0x42, 0x70, 0x46, - 0x42, 0x70, 0x56, 0x42, 0x70, 0x57, 0x42, 0x70, - 0x63, 0x42, 0x70, 0x73, 0x42, 0x73, 0x72, 0x42, - 0x73, 0x74, 0x42, 0x76, 0x69, 0x42, 0x78, 0x69, - 0x43, 0x28, 0x31, 0x29, 0x43, 0x28, 0x32, 0x29, - 0x43, 0x28, 0x33, 0x29, 0x43, 0x28, 0x34, 0x29, - 0x43, 0x28, 0x35, 0x29, 0x43, 0x28, 0x36, 0x29, - // Bytes 1a80 - 1abf - 0x43, 0x28, 0x37, 0x29, 0x43, 0x28, 0x38, 0x29, - 0x43, 0x28, 0x39, 0x29, 0x43, 0x28, 0x41, 0x29, - 0x43, 0x28, 0x42, 0x29, 0x43, 0x28, 0x43, 0x29, - 0x43, 0x28, 0x44, 0x29, 0x43, 0x28, 0x45, 0x29, - 0x43, 0x28, 0x46, 0x29, 0x43, 0x28, 0x47, 0x29, - 0x43, 0x28, 0x48, 0x29, 0x43, 0x28, 0x49, 0x29, - 0x43, 0x28, 0x4A, 0x29, 0x43, 0x28, 0x4B, 0x29, - 0x43, 0x28, 0x4C, 0x29, 0x43, 0x28, 0x4D, 0x29, - // Bytes 1ac0 - 1aff - 0x43, 0x28, 0x4E, 0x29, 0x43, 0x28, 0x4F, 0x29, - 0x43, 0x28, 0x50, 0x29, 0x43, 0x28, 0x51, 0x29, - 0x43, 0x28, 0x52, 0x29, 0x43, 0x28, 0x53, 0x29, - 0x43, 0x28, 0x54, 0x29, 0x43, 0x28, 0x55, 0x29, - 0x43, 0x28, 0x56, 0x29, 0x43, 0x28, 0x57, 0x29, - 0x43, 0x28, 0x58, 0x29, 0x43, 0x28, 0x59, 0x29, - 0x43, 0x28, 0x5A, 0x29, 0x43, 0x28, 0x61, 0x29, - 0x43, 0x28, 0x62, 0x29, 0x43, 0x28, 0x63, 0x29, - // Bytes 1b00 - 1b3f - 0x43, 0x28, 0x64, 0x29, 0x43, 0x28, 0x65, 0x29, - 0x43, 0x28, 0x66, 0x29, 0x43, 0x28, 0x67, 0x29, - 0x43, 0x28, 0x68, 0x29, 0x43, 0x28, 0x69, 0x29, - 0x43, 0x28, 0x6A, 0x29, 0x43, 0x28, 0x6B, 0x29, - 0x43, 0x28, 0x6C, 0x29, 0x43, 0x28, 0x6D, 0x29, - 0x43, 0x28, 0x6E, 0x29, 0x43, 0x28, 0x6F, 0x29, - 0x43, 0x28, 0x70, 0x29, 0x43, 0x28, 0x71, 0x29, - 0x43, 0x28, 0x72, 0x29, 0x43, 0x28, 0x73, 0x29, - // Bytes 1b40 - 1b7f - 0x43, 0x28, 0x74, 0x29, 0x43, 0x28, 0x75, 0x29, - 0x43, 0x28, 0x76, 0x29, 0x43, 0x28, 0x77, 0x29, - 0x43, 0x28, 0x78, 0x29, 0x43, 0x28, 0x79, 0x29, - 0x43, 0x28, 0x7A, 0x29, 0x43, 0x2E, 0x2E, 0x2E, - 0x43, 0x31, 0x30, 0x2E, 0x43, 0x31, 0x31, 0x2E, - 0x43, 0x31, 0x32, 0x2E, 0x43, 0x31, 0x33, 0x2E, - 0x43, 0x31, 0x34, 0x2E, 0x43, 0x31, 0x35, 0x2E, - 0x43, 0x31, 0x36, 0x2E, 0x43, 0x31, 0x37, 0x2E, - // Bytes 1b80 - 1bbf - 0x43, 0x31, 0x38, 0x2E, 0x43, 0x31, 0x39, 0x2E, - 0x43, 0x32, 0x30, 0x2E, 0x43, 0x3A, 0x3A, 0x3D, - 0x43, 0x3D, 0x3D, 0x3D, 0x43, 0x43, 0x6F, 0x2E, - 0x43, 0x46, 0x41, 0x58, 0x43, 0x47, 0x48, 0x7A, - 0x43, 0x47, 0x50, 0x61, 0x43, 0x49, 0x49, 0x49, - 0x43, 0x4C, 0x54, 0x44, 0x43, 0x4C, 0xC2, 0xB7, - 0x43, 0x4D, 0x48, 0x7A, 0x43, 0x4D, 0x50, 0x61, - 0x43, 0x4D, 0xCE, 0xA9, 0x43, 0x50, 0x50, 0x4D, - // Bytes 1bc0 - 1bff - 0x43, 0x50, 0x50, 0x56, 0x43, 0x50, 0x54, 0x45, - 0x43, 0x54, 0x45, 0x4C, 0x43, 0x54, 0x48, 0x7A, - 0x43, 0x56, 0x49, 0x49, 0x43, 0x58, 0x49, 0x49, - 0x43, 0x61, 0x2F, 0x63, 0x43, 0x61, 0x2F, 0x73, - 0x43, 0x61, 0xCA, 0xBE, 0x43, 0x62, 0x61, 0x72, - 0x43, 0x63, 0x2F, 0x6F, 0x43, 0x63, 0x2F, 0x75, - 0x43, 0x63, 0x61, 0x6C, 0x43, 0x63, 0x6D, 0x32, - 0x43, 0x63, 0x6D, 0x33, 0x43, 0x64, 0x6D, 0x32, - // Bytes 1c00 - 1c3f - 0x43, 0x64, 0x6D, 0x33, 0x43, 0x65, 0x72, 0x67, - 0x43, 0x66, 0x66, 0x69, 0x43, 0x66, 0x66, 0x6C, - 0x43, 0x67, 0x61, 0x6C, 0x43, 0x68, 0x50, 0x61, - 0x43, 0x69, 0x69, 0x69, 0x43, 0x6B, 0x48, 0x7A, - 0x43, 0x6B, 0x50, 0x61, 0x43, 0x6B, 0x6D, 0x32, - 0x43, 0x6B, 0x6D, 0x33, 0x43, 0x6B, 0xCE, 0xA9, - 0x43, 0x6C, 0x6F, 0x67, 0x43, 0x6C, 0xC2, 0xB7, - 0x43, 0x6D, 0x69, 0x6C, 0x43, 0x6D, 0x6D, 0x32, - // Bytes 1c40 - 1c7f - 0x43, 0x6D, 0x6D, 0x33, 0x43, 0x6D, 0x6F, 0x6C, - 0x43, 0x72, 0x61, 0x64, 0x43, 0x76, 0x69, 0x69, - 0x43, 0x78, 0x69, 0x69, 0x43, 0xC2, 0xB0, 0x43, - 0x43, 0xC2, 0xB0, 0x46, 0x43, 0xCA, 0xBC, 0x6E, - 0x43, 0xCE, 0xBC, 0x41, 0x43, 0xCE, 0xBC, 0x46, - 0x43, 0xCE, 0xBC, 0x56, 0x43, 0xCE, 0xBC, 0x57, - 0x43, 0xCE, 0xBC, 0x67, 0x43, 0xCE, 0xBC, 0x6C, - 0x43, 0xCE, 0xBC, 0x6D, 0x43, 0xCE, 0xBC, 0x73, - // Bytes 1c80 - 1cbf - 0x44, 0x28, 0x31, 0x30, 0x29, 0x44, 0x28, 0x31, - 0x31, 0x29, 0x44, 0x28, 0x31, 0x32, 0x29, 0x44, - 0x28, 0x31, 0x33, 0x29, 0x44, 0x28, 0x31, 0x34, - 0x29, 0x44, 0x28, 0x31, 0x35, 0x29, 0x44, 0x28, - 0x31, 0x36, 0x29, 0x44, 0x28, 0x31, 0x37, 0x29, - 0x44, 0x28, 0x31, 0x38, 0x29, 0x44, 0x28, 0x31, - 0x39, 0x29, 0x44, 0x28, 0x32, 0x30, 0x29, 0x44, - 0x30, 0xE7, 0x82, 0xB9, 0x44, 0x31, 0xE2, 0x81, - // Bytes 1cc0 - 1cff - 0x84, 0x44, 0x31, 0xE6, 0x97, 0xA5, 0x44, 0x31, - 0xE6, 0x9C, 0x88, 0x44, 0x31, 0xE7, 0x82, 0xB9, - 0x44, 0x32, 0xE6, 0x97, 0xA5, 0x44, 0x32, 0xE6, - 0x9C, 0x88, 0x44, 0x32, 0xE7, 0x82, 0xB9, 0x44, - 0x33, 0xE6, 0x97, 0xA5, 0x44, 0x33, 0xE6, 0x9C, - 0x88, 0x44, 0x33, 0xE7, 0x82, 0xB9, 0x44, 0x34, - 0xE6, 0x97, 0xA5, 0x44, 0x34, 0xE6, 0x9C, 0x88, - 0x44, 0x34, 0xE7, 0x82, 0xB9, 0x44, 0x35, 0xE6, - // Bytes 1d00 - 1d3f - 0x97, 0xA5, 0x44, 0x35, 0xE6, 0x9C, 0x88, 0x44, - 0x35, 0xE7, 0x82, 0xB9, 0x44, 0x36, 0xE6, 0x97, - 0xA5, 0x44, 0x36, 0xE6, 0x9C, 0x88, 0x44, 0x36, - 0xE7, 0x82, 0xB9, 0x44, 0x37, 0xE6, 0x97, 0xA5, - 0x44, 0x37, 0xE6, 0x9C, 0x88, 0x44, 0x37, 0xE7, - 0x82, 0xB9, 0x44, 0x38, 0xE6, 0x97, 0xA5, 0x44, - 0x38, 0xE6, 0x9C, 0x88, 0x44, 0x38, 0xE7, 0x82, - 0xB9, 0x44, 0x39, 0xE6, 0x97, 0xA5, 0x44, 0x39, - // Bytes 1d40 - 1d7f - 0xE6, 0x9C, 0x88, 0x44, 0x39, 0xE7, 0x82, 0xB9, - 0x44, 0x56, 0x49, 0x49, 0x49, 0x44, 0x61, 0x2E, - 0x6D, 0x2E, 0x44, 0x6B, 0x63, 0x61, 0x6C, 0x44, - 0x70, 0x2E, 0x6D, 0x2E, 0x44, 0x76, 0x69, 0x69, - 0x69, 0x44, 0xD5, 0xA5, 0xD6, 0x82, 0x44, 0xD5, - 0xB4, 0xD5, 0xA5, 0x44, 0xD5, 0xB4, 0xD5, 0xAB, - 0x44, 0xD5, 0xB4, 0xD5, 0xAD, 0x44, 0xD5, 0xB4, - 0xD5, 0xB6, 0x44, 0xD5, 0xBE, 0xD5, 0xB6, 0x44, - // Bytes 1d80 - 1dbf - 0xD7, 0x90, 0xD7, 0x9C, 0x44, 0xD8, 0xA7, 0xD9, - 0xB4, 0x44, 0xD8, 0xA8, 0xD8, 0xAC, 0x44, 0xD8, - 0xA8, 0xD8, 0xAD, 0x44, 0xD8, 0xA8, 0xD8, 0xAE, - 0x44, 0xD8, 0xA8, 0xD8, 0xB1, 0x44, 0xD8, 0xA8, - 0xD8, 0xB2, 0x44, 0xD8, 0xA8, 0xD9, 0x85, 0x44, - 0xD8, 0xA8, 0xD9, 0x86, 0x44, 0xD8, 0xA8, 0xD9, - 0x87, 0x44, 0xD8, 0xA8, 0xD9, 0x89, 0x44, 0xD8, - 0xA8, 0xD9, 0x8A, 0x44, 0xD8, 0xAA, 0xD8, 0xAC, - // Bytes 1dc0 - 1dff - 0x44, 0xD8, 0xAA, 0xD8, 0xAD, 0x44, 0xD8, 0xAA, - 0xD8, 0xAE, 0x44, 0xD8, 0xAA, 0xD8, 0xB1, 0x44, - 0xD8, 0xAA, 0xD8, 0xB2, 0x44, 0xD8, 0xAA, 0xD9, - 0x85, 0x44, 0xD8, 0xAA, 0xD9, 0x86, 0x44, 0xD8, - 0xAA, 0xD9, 0x87, 0x44, 0xD8, 0xAA, 0xD9, 0x89, - 0x44, 0xD8, 0xAA, 0xD9, 0x8A, 0x44, 0xD8, 0xAB, - 0xD8, 0xAC, 0x44, 0xD8, 0xAB, 0xD8, 0xB1, 0x44, - 0xD8, 0xAB, 0xD8, 0xB2, 0x44, 0xD8, 0xAB, 0xD9, - // Bytes 1e00 - 1e3f - 0x85, 0x44, 0xD8, 0xAB, 0xD9, 0x86, 0x44, 0xD8, - 0xAB, 0xD9, 0x87, 0x44, 0xD8, 0xAB, 0xD9, 0x89, - 0x44, 0xD8, 0xAB, 0xD9, 0x8A, 0x44, 0xD8, 0xAC, - 0xD8, 0xAD, 0x44, 0xD8, 0xAC, 0xD9, 0x85, 0x44, - 0xD8, 0xAC, 0xD9, 0x89, 0x44, 0xD8, 0xAC, 0xD9, - 0x8A, 0x44, 0xD8, 0xAD, 0xD8, 0xAC, 0x44, 0xD8, - 0xAD, 0xD9, 0x85, 0x44, 0xD8, 0xAD, 0xD9, 0x89, - 0x44, 0xD8, 0xAD, 0xD9, 0x8A, 0x44, 0xD8, 0xAE, - // Bytes 1e40 - 1e7f - 0xD8, 0xAC, 0x44, 0xD8, 0xAE, 0xD8, 0xAD, 0x44, - 0xD8, 0xAE, 0xD9, 0x85, 0x44, 0xD8, 0xAE, 0xD9, - 0x89, 0x44, 0xD8, 0xAE, 0xD9, 0x8A, 0x44, 0xD8, - 0xB3, 0xD8, 0xAC, 0x44, 0xD8, 0xB3, 0xD8, 0xAD, - 0x44, 0xD8, 0xB3, 0xD8, 0xAE, 0x44, 0xD8, 0xB3, - 0xD8, 0xB1, 0x44, 0xD8, 0xB3, 0xD9, 0x85, 0x44, - 0xD8, 0xB3, 0xD9, 0x87, 0x44, 0xD8, 0xB3, 0xD9, - 0x89, 0x44, 0xD8, 0xB3, 0xD9, 0x8A, 0x44, 0xD8, - // Bytes 1e80 - 1ebf - 0xB4, 0xD8, 0xAC, 0x44, 0xD8, 0xB4, 0xD8, 0xAD, - 0x44, 0xD8, 0xB4, 0xD8, 0xAE, 0x44, 0xD8, 0xB4, - 0xD8, 0xB1, 0x44, 0xD8, 0xB4, 0xD9, 0x85, 0x44, - 0xD8, 0xB4, 0xD9, 0x87, 0x44, 0xD8, 0xB4, 0xD9, - 0x89, 0x44, 0xD8, 0xB4, 0xD9, 0x8A, 0x44, 0xD8, - 0xB5, 0xD8, 0xAD, 0x44, 0xD8, 0xB5, 0xD8, 0xAE, - 0x44, 0xD8, 0xB5, 0xD8, 0xB1, 0x44, 0xD8, 0xB5, - 0xD9, 0x85, 0x44, 0xD8, 0xB5, 0xD9, 0x89, 0x44, - // Bytes 1ec0 - 1eff - 0xD8, 0xB5, 0xD9, 0x8A, 0x44, 0xD8, 0xB6, 0xD8, - 0xAC, 0x44, 0xD8, 0xB6, 0xD8, 0xAD, 0x44, 0xD8, - 0xB6, 0xD8, 0xAE, 0x44, 0xD8, 0xB6, 0xD8, 0xB1, - 0x44, 0xD8, 0xB6, 0xD9, 0x85, 0x44, 0xD8, 0xB6, - 0xD9, 0x89, 0x44, 0xD8, 0xB6, 0xD9, 0x8A, 0x44, - 0xD8, 0xB7, 0xD8, 0xAD, 0x44, 0xD8, 0xB7, 0xD9, - 0x85, 0x44, 0xD8, 0xB7, 0xD9, 0x89, 0x44, 0xD8, - 0xB7, 0xD9, 0x8A, 0x44, 0xD8, 0xB8, 0xD9, 0x85, - // Bytes 1f00 - 1f3f - 0x44, 0xD8, 0xB9, 0xD8, 0xAC, 0x44, 0xD8, 0xB9, - 0xD9, 0x85, 0x44, 0xD8, 0xB9, 0xD9, 0x89, 0x44, - 0xD8, 0xB9, 0xD9, 0x8A, 0x44, 0xD8, 0xBA, 0xD8, - 0xAC, 0x44, 0xD8, 0xBA, 0xD9, 0x85, 0x44, 0xD8, - 0xBA, 0xD9, 0x89, 0x44, 0xD8, 0xBA, 0xD9, 0x8A, - 0x44, 0xD9, 0x81, 0xD8, 0xAC, 0x44, 0xD9, 0x81, - 0xD8, 0xAD, 0x44, 0xD9, 0x81, 0xD8, 0xAE, 0x44, - 0xD9, 0x81, 0xD9, 0x85, 0x44, 0xD9, 0x81, 0xD9, - // Bytes 1f40 - 1f7f - 0x89, 0x44, 0xD9, 0x81, 0xD9, 0x8A, 0x44, 0xD9, - 0x82, 0xD8, 0xAD, 0x44, 0xD9, 0x82, 0xD9, 0x85, - 0x44, 0xD9, 0x82, 0xD9, 0x89, 0x44, 0xD9, 0x82, - 0xD9, 0x8A, 0x44, 0xD9, 0x83, 0xD8, 0xA7, 0x44, - 0xD9, 0x83, 0xD8, 0xAC, 0x44, 0xD9, 0x83, 0xD8, - 0xAD, 0x44, 0xD9, 0x83, 0xD8, 0xAE, 0x44, 0xD9, - 0x83, 0xD9, 0x84, 0x44, 0xD9, 0x83, 0xD9, 0x85, - 0x44, 0xD9, 0x83, 0xD9, 0x89, 0x44, 0xD9, 0x83, - // Bytes 1f80 - 1fbf - 0xD9, 0x8A, 0x44, 0xD9, 0x84, 0xD8, 0xA7, 0x44, - 0xD9, 0x84, 0xD8, 0xAC, 0x44, 0xD9, 0x84, 0xD8, - 0xAD, 0x44, 0xD9, 0x84, 0xD8, 0xAE, 0x44, 0xD9, - 0x84, 0xD9, 0x85, 0x44, 0xD9, 0x84, 0xD9, 0x87, - 0x44, 0xD9, 0x84, 0xD9, 0x89, 0x44, 0xD9, 0x84, - 0xD9, 0x8A, 0x44, 0xD9, 0x85, 0xD8, 0xA7, 0x44, - 0xD9, 0x85, 0xD8, 0xAC, 0x44, 0xD9, 0x85, 0xD8, - 0xAD, 0x44, 0xD9, 0x85, 0xD8, 0xAE, 0x44, 0xD9, - // Bytes 1fc0 - 1fff - 0x85, 0xD9, 0x85, 0x44, 0xD9, 0x85, 0xD9, 0x89, - 0x44, 0xD9, 0x85, 0xD9, 0x8A, 0x44, 0xD9, 0x86, - 0xD8, 0xAC, 0x44, 0xD9, 0x86, 0xD8, 0xAD, 0x44, - 0xD9, 0x86, 0xD8, 0xAE, 0x44, 0xD9, 0x86, 0xD8, - 0xB1, 0x44, 0xD9, 0x86, 0xD8, 0xB2, 0x44, 0xD9, - 0x86, 0xD9, 0x85, 0x44, 0xD9, 0x86, 0xD9, 0x86, - 0x44, 0xD9, 0x86, 0xD9, 0x87, 0x44, 0xD9, 0x86, - 0xD9, 0x89, 0x44, 0xD9, 0x86, 0xD9, 0x8A, 0x44, - // Bytes 2000 - 203f - 0xD9, 0x87, 0xD8, 0xAC, 0x44, 0xD9, 0x87, 0xD9, - 0x85, 0x44, 0xD9, 0x87, 0xD9, 0x89, 0x44, 0xD9, - 0x87, 0xD9, 0x8A, 0x44, 0xD9, 0x88, 0xD9, 0xB4, - 0x44, 0xD9, 0x8A, 0xD8, 0xAC, 0x44, 0xD9, 0x8A, - 0xD8, 0xAD, 0x44, 0xD9, 0x8A, 0xD8, 0xAE, 0x44, - 0xD9, 0x8A, 0xD8, 0xB1, 0x44, 0xD9, 0x8A, 0xD8, - 0xB2, 0x44, 0xD9, 0x8A, 0xD9, 0x85, 0x44, 0xD9, - 0x8A, 0xD9, 0x86, 0x44, 0xD9, 0x8A, 0xD9, 0x87, - // Bytes 2040 - 207f - 0x44, 0xD9, 0x8A, 0xD9, 0x89, 0x44, 0xD9, 0x8A, - 0xD9, 0x8A, 0x44, 0xD9, 0x8A, 0xD9, 0xB4, 0x44, - 0xDB, 0x87, 0xD9, 0xB4, 0x45, 0x28, 0xE1, 0x84, - 0x80, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x82, 0x29, - 0x45, 0x28, 0xE1, 0x84, 0x83, 0x29, 0x45, 0x28, - 0xE1, 0x84, 0x85, 0x29, 0x45, 0x28, 0xE1, 0x84, - 0x86, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x87, 0x29, - 0x45, 0x28, 0xE1, 0x84, 0x89, 0x29, 0x45, 0x28, - // Bytes 2080 - 20bf - 0xE1, 0x84, 0x8B, 0x29, 0x45, 0x28, 0xE1, 0x84, - 0x8C, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x8E, 0x29, - 0x45, 0x28, 0xE1, 0x84, 0x8F, 0x29, 0x45, 0x28, - 0xE1, 0x84, 0x90, 0x29, 0x45, 0x28, 0xE1, 0x84, - 0x91, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x92, 0x29, - 0x45, 0x28, 0xE4, 0xB8, 0x80, 0x29, 0x45, 0x28, - 0xE4, 0xB8, 0x83, 0x29, 0x45, 0x28, 0xE4, 0xB8, - 0x89, 0x29, 0x45, 0x28, 0xE4, 0xB9, 0x9D, 0x29, - // Bytes 20c0 - 20ff - 0x45, 0x28, 0xE4, 0xBA, 0x8C, 0x29, 0x45, 0x28, - 0xE4, 0xBA, 0x94, 0x29, 0x45, 0x28, 0xE4, 0xBB, - 0xA3, 0x29, 0x45, 0x28, 0xE4, 0xBC, 0x81, 0x29, - 0x45, 0x28, 0xE4, 0xBC, 0x91, 0x29, 0x45, 0x28, - 0xE5, 0x85, 0xAB, 0x29, 0x45, 0x28, 0xE5, 0x85, - 0xAD, 0x29, 0x45, 0x28, 0xE5, 0x8A, 0xB4, 0x29, - 0x45, 0x28, 0xE5, 0x8D, 0x81, 0x29, 0x45, 0x28, - 0xE5, 0x8D, 0x94, 0x29, 0x45, 0x28, 0xE5, 0x90, - // Bytes 2100 - 213f - 0x8D, 0x29, 0x45, 0x28, 0xE5, 0x91, 0xBC, 0x29, - 0x45, 0x28, 0xE5, 0x9B, 0x9B, 0x29, 0x45, 0x28, - 0xE5, 0x9C, 0x9F, 0x29, 0x45, 0x28, 0xE5, 0xAD, - 0xA6, 0x29, 0x45, 0x28, 0xE6, 0x97, 0xA5, 0x29, - 0x45, 0x28, 0xE6, 0x9C, 0x88, 0x29, 0x45, 0x28, - 0xE6, 0x9C, 0x89, 0x29, 0x45, 0x28, 0xE6, 0x9C, - 0xA8, 0x29, 0x45, 0x28, 0xE6, 0xA0, 0xAA, 0x29, - 0x45, 0x28, 0xE6, 0xB0, 0xB4, 0x29, 0x45, 0x28, - // Bytes 2140 - 217f - 0xE7, 0x81, 0xAB, 0x29, 0x45, 0x28, 0xE7, 0x89, - 0xB9, 0x29, 0x45, 0x28, 0xE7, 0x9B, 0xA3, 0x29, - 0x45, 0x28, 0xE7, 0xA4, 0xBE, 0x29, 0x45, 0x28, - 0xE7, 0xA5, 0x9D, 0x29, 0x45, 0x28, 0xE7, 0xA5, - 0xAD, 0x29, 0x45, 0x28, 0xE8, 0x87, 0xAA, 0x29, - 0x45, 0x28, 0xE8, 0x87, 0xB3, 0x29, 0x45, 0x28, - 0xE8, 0xB2, 0xA1, 0x29, 0x45, 0x28, 0xE8, 0xB3, - 0x87, 0x29, 0x45, 0x28, 0xE9, 0x87, 0x91, 0x29, - // Bytes 2180 - 21bf - 0x45, 0x30, 0xE2, 0x81, 0x84, 0x33, 0x45, 0x31, - 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x31, 0x30, 0xE6, - 0x9C, 0x88, 0x45, 0x31, 0x30, 0xE7, 0x82, 0xB9, - 0x45, 0x31, 0x31, 0xE6, 0x97, 0xA5, 0x45, 0x31, - 0x31, 0xE6, 0x9C, 0x88, 0x45, 0x31, 0x31, 0xE7, - 0x82, 0xB9, 0x45, 0x31, 0x32, 0xE6, 0x97, 0xA5, - 0x45, 0x31, 0x32, 0xE6, 0x9C, 0x88, 0x45, 0x31, - 0x32, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x33, 0xE6, - // Bytes 21c0 - 21ff - 0x97, 0xA5, 0x45, 0x31, 0x33, 0xE7, 0x82, 0xB9, - 0x45, 0x31, 0x34, 0xE6, 0x97, 0xA5, 0x45, 0x31, - 0x34, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x35, 0xE6, - 0x97, 0xA5, 0x45, 0x31, 0x35, 0xE7, 0x82, 0xB9, - 0x45, 0x31, 0x36, 0xE6, 0x97, 0xA5, 0x45, 0x31, - 0x36, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x37, 0xE6, - 0x97, 0xA5, 0x45, 0x31, 0x37, 0xE7, 0x82, 0xB9, - 0x45, 0x31, 0x38, 0xE6, 0x97, 0xA5, 0x45, 0x31, - // Bytes 2200 - 223f - 0x38, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x39, 0xE6, - 0x97, 0xA5, 0x45, 0x31, 0x39, 0xE7, 0x82, 0xB9, - 0x45, 0x31, 0xE2, 0x81, 0x84, 0x32, 0x45, 0x31, - 0xE2, 0x81, 0x84, 0x33, 0x45, 0x31, 0xE2, 0x81, - 0x84, 0x34, 0x45, 0x31, 0xE2, 0x81, 0x84, 0x35, - 0x45, 0x31, 0xE2, 0x81, 0x84, 0x36, 0x45, 0x31, - 0xE2, 0x81, 0x84, 0x37, 0x45, 0x31, 0xE2, 0x81, - 0x84, 0x38, 0x45, 0x31, 0xE2, 0x81, 0x84, 0x39, - // Bytes 2240 - 227f - 0x45, 0x32, 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x32, - 0x30, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x31, 0xE6, - 0x97, 0xA5, 0x45, 0x32, 0x31, 0xE7, 0x82, 0xB9, - 0x45, 0x32, 0x32, 0xE6, 0x97, 0xA5, 0x45, 0x32, - 0x32, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x33, 0xE6, - 0x97, 0xA5, 0x45, 0x32, 0x33, 0xE7, 0x82, 0xB9, - 0x45, 0x32, 0x34, 0xE6, 0x97, 0xA5, 0x45, 0x32, - 0x34, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x35, 0xE6, - // Bytes 2280 - 22bf - 0x97, 0xA5, 0x45, 0x32, 0x36, 0xE6, 0x97, 0xA5, - 0x45, 0x32, 0x37, 0xE6, 0x97, 0xA5, 0x45, 0x32, - 0x38, 0xE6, 0x97, 0xA5, 0x45, 0x32, 0x39, 0xE6, - 0x97, 0xA5, 0x45, 0x32, 0xE2, 0x81, 0x84, 0x33, - 0x45, 0x32, 0xE2, 0x81, 0x84, 0x35, 0x45, 0x33, - 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x33, 0x31, 0xE6, - 0x97, 0xA5, 0x45, 0x33, 0xE2, 0x81, 0x84, 0x34, - 0x45, 0x33, 0xE2, 0x81, 0x84, 0x35, 0x45, 0x33, - // Bytes 22c0 - 22ff - 0xE2, 0x81, 0x84, 0x38, 0x45, 0x34, 0xE2, 0x81, - 0x84, 0x35, 0x45, 0x35, 0xE2, 0x81, 0x84, 0x36, - 0x45, 0x35, 0xE2, 0x81, 0x84, 0x38, 0x45, 0x37, - 0xE2, 0x81, 0x84, 0x38, 0x45, 0x41, 0xE2, 0x88, - 0x95, 0x6D, 0x45, 0x56, 0xE2, 0x88, 0x95, 0x6D, - 0x45, 0x6D, 0xE2, 0x88, 0x95, 0x73, 0x46, 0x31, - 0xE2, 0x81, 0x84, 0x31, 0x30, 0x46, 0x43, 0xE2, - 0x88, 0x95, 0x6B, 0x67, 0x46, 0x6D, 0xE2, 0x88, - // Bytes 2300 - 233f - 0x95, 0x73, 0x32, 0x46, 0xD8, 0xA8, 0xD8, 0xAD, - 0xD9, 0x8A, 0x46, 0xD8, 0xA8, 0xD8, 0xAE, 0xD9, - 0x8A, 0x46, 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x85, - 0x46, 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x89, 0x46, - 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD8, - 0xAA, 0xD8, 0xAD, 0xD8, 0xAC, 0x46, 0xD8, 0xAA, - 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD8, 0xAA, 0xD8, - 0xAE, 0xD9, 0x85, 0x46, 0xD8, 0xAA, 0xD8, 0xAE, - // Bytes 2340 - 237f - 0xD9, 0x89, 0x46, 0xD8, 0xAA, 0xD8, 0xAE, 0xD9, - 0x8A, 0x46, 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAC, - 0x46, 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAD, 0x46, - 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAE, 0x46, 0xD8, - 0xAA, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, 0xAA, - 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xAC, 0xD8, - 0xAD, 0xD9, 0x89, 0x46, 0xD8, 0xAC, 0xD8, 0xAD, - 0xD9, 0x8A, 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD8, - // Bytes 2380 - 23bf - 0xAD, 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD9, 0x89, - 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD9, 0x8A, 0x46, - 0xD8, 0xAD, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD8, - 0xAD, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, 0xAD, - 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xB3, 0xD8, - 0xAC, 0xD8, 0xAD, 0x46, 0xD8, 0xB3, 0xD8, 0xAC, - 0xD9, 0x89, 0x46, 0xD8, 0xB3, 0xD8, 0xAD, 0xD8, - 0xAC, 0x46, 0xD8, 0xB3, 0xD8, 0xAE, 0xD9, 0x89, - // Bytes 23c0 - 23ff - 0x46, 0xD8, 0xB3, 0xD8, 0xAE, 0xD9, 0x8A, 0x46, - 0xD8, 0xB3, 0xD9, 0x85, 0xD8, 0xAC, 0x46, 0xD8, - 0xB3, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD8, 0xB3, - 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD8, 0xB4, 0xD8, - 0xAC, 0xD9, 0x8A, 0x46, 0xD8, 0xB4, 0xD8, 0xAD, - 0xD9, 0x85, 0x46, 0xD8, 0xB4, 0xD8, 0xAD, 0xD9, - 0x8A, 0x46, 0xD8, 0xB4, 0xD9, 0x85, 0xD8, 0xAE, - 0x46, 0xD8, 0xB4, 0xD9, 0x85, 0xD9, 0x85, 0x46, - // Bytes 2400 - 243f - 0xD8, 0xB5, 0xD8, 0xAD, 0xD8, 0xAD, 0x46, 0xD8, - 0xB5, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD8, 0xB5, - 0xD9, 0x84, 0xD9, 0x89, 0x46, 0xD8, 0xB5, 0xD9, - 0x84, 0xDB, 0x92, 0x46, 0xD8, 0xB5, 0xD9, 0x85, - 0xD9, 0x85, 0x46, 0xD8, 0xB6, 0xD8, 0xAD, 0xD9, - 0x89, 0x46, 0xD8, 0xB6, 0xD8, 0xAD, 0xD9, 0x8A, - 0x46, 0xD8, 0xB6, 0xD8, 0xAE, 0xD9, 0x85, 0x46, - 0xD8, 0xB7, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD8, - // Bytes 2440 - 247f - 0xB7, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD8, 0xB7, - 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xB9, 0xD8, - 0xAC, 0xD9, 0x85, 0x46, 0xD8, 0xB9, 0xD9, 0x85, - 0xD9, 0x85, 0x46, 0xD8, 0xB9, 0xD9, 0x85, 0xD9, - 0x89, 0x46, 0xD8, 0xB9, 0xD9, 0x85, 0xD9, 0x8A, - 0x46, 0xD8, 0xBA, 0xD9, 0x85, 0xD9, 0x85, 0x46, - 0xD8, 0xBA, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, - 0xBA, 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x81, - // Bytes 2480 - 24bf - 0xD8, 0xAE, 0xD9, 0x85, 0x46, 0xD9, 0x81, 0xD9, - 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x82, 0xD9, 0x84, - 0xDB, 0x92, 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD8, - 0xAD, 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD9, 0x85, - 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD9, 0x8A, 0x46, - 0xD9, 0x83, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD9, - 0x83, 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x84, - 0xD8, 0xAC, 0xD8, 0xAC, 0x46, 0xD9, 0x84, 0xD8, - // Bytes 24c0 - 24ff - 0xAC, 0xD9, 0x85, 0x46, 0xD9, 0x84, 0xD8, 0xAC, - 0xD9, 0x8A, 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, - 0x85, 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, 0x89, - 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, - 0xD9, 0x84, 0xD8, 0xAE, 0xD9, 0x85, 0x46, 0xD9, - 0x84, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD9, 0x84, - 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x85, 0xD8, - 0xAC, 0xD8, 0xAD, 0x46, 0xD9, 0x85, 0xD8, 0xAC, - // Bytes 2500 - 253f - 0xD8, 0xAE, 0x46, 0xD9, 0x85, 0xD8, 0xAC, 0xD9, - 0x85, 0x46, 0xD9, 0x85, 0xD8, 0xAC, 0xD9, 0x8A, - 0x46, 0xD9, 0x85, 0xD8, 0xAD, 0xD8, 0xAC, 0x46, - 0xD9, 0x85, 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD9, - 0x85, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD9, 0x85, - 0xD8, 0xAE, 0xD8, 0xAC, 0x46, 0xD9, 0x85, 0xD8, - 0xAE, 0xD9, 0x85, 0x46, 0xD9, 0x85, 0xD8, 0xAE, - 0xD9, 0x8A, 0x46, 0xD9, 0x85, 0xD9, 0x85, 0xD9, - // Bytes 2540 - 257f - 0x8A, 0x46, 0xD9, 0x86, 0xD8, 0xAC, 0xD8, 0xAD, - 0x46, 0xD9, 0x86, 0xD8, 0xAC, 0xD9, 0x85, 0x46, - 0xD9, 0x86, 0xD8, 0xAC, 0xD9, 0x89, 0x46, 0xD9, - 0x86, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD9, 0x86, - 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD9, 0x86, 0xD8, - 0xAD, 0xD9, 0x89, 0x46, 0xD9, 0x86, 0xD8, 0xAD, - 0xD9, 0x8A, 0x46, 0xD9, 0x86, 0xD9, 0x85, 0xD9, - 0x89, 0x46, 0xD9, 0x86, 0xD9, 0x85, 0xD9, 0x8A, - // Bytes 2580 - 25bf - 0x46, 0xD9, 0x87, 0xD9, 0x85, 0xD8, 0xAC, 0x46, - 0xD9, 0x87, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD9, - 0x8A, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD9, 0x8A, - 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD9, 0x8A, 0xD9, - 0x85, 0xD9, 0x85, 0x46, 0xD9, 0x8A, 0xD9, 0x85, - 0xD9, 0x8A, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, - 0xA7, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAC, - 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAD, 0x46, - // Bytes 25c0 - 25ff - 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAE, 0x46, 0xD9, - 0x8A, 0xD9, 0x94, 0xD8, 0xB1, 0x46, 0xD9, 0x8A, - 0xD9, 0x94, 0xD8, 0xB2, 0x46, 0xD9, 0x8A, 0xD9, - 0x94, 0xD9, 0x85, 0x46, 0xD9, 0x8A, 0xD9, 0x94, - 0xD9, 0x86, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, - 0x87, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x88, - 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x89, 0x46, - 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x8A, 0x46, 0xD9, - // Bytes 2600 - 263f - 0x8A, 0xD9, 0x94, 0xDB, 0x86, 0x46, 0xD9, 0x8A, - 0xD9, 0x94, 0xDB, 0x87, 0x46, 0xD9, 0x8A, 0xD9, - 0x94, 0xDB, 0x88, 0x46, 0xD9, 0x8A, 0xD9, 0x94, - 0xDB, 0x90, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xDB, - 0x95, 0x46, 0xE0, 0xB9, 0x8D, 0xE0, 0xB8, 0xB2, - 0x46, 0xE0, 0xBA, 0xAB, 0xE0, 0xBA, 0x99, 0x46, - 0xE0, 0xBA, 0xAB, 0xE0, 0xBA, 0xA1, 0x46, 0xE0, - 0xBB, 0x8D, 0xE0, 0xBA, 0xB2, 0x46, 0xE0, 0xBD, - // Bytes 2640 - 267f - 0x80, 0xE0, 0xBE, 0xB5, 0x46, 0xE0, 0xBD, 0x82, - 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBD, 0x8C, 0xE0, - 0xBE, 0xB7, 0x46, 0xE0, 0xBD, 0x91, 0xE0, 0xBE, - 0xB7, 0x46, 0xE0, 0xBD, 0x96, 0xE0, 0xBE, 0xB7, - 0x46, 0xE0, 0xBD, 0x9B, 0xE0, 0xBE, 0xB7, 0x46, - 0xE0, 0xBE, 0x90, 0xE0, 0xBE, 0xB5, 0x46, 0xE0, - 0xBE, 0x92, 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, - 0x9C, 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xA1, - // Bytes 2680 - 26bf - 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xA6, 0xE0, - 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xAB, 0xE0, 0xBE, - 0xB7, 0x46, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, - 0x46, 0xE2, 0x80, 0xB5, 0xE2, 0x80, 0xB5, 0x46, - 0xE2, 0x88, 0xAB, 0xE2, 0x88, 0xAB, 0x46, 0xE2, - 0x88, 0xAE, 0xE2, 0x88, 0xAE, 0x46, 0xE3, 0x81, - 0xBB, 0xE3, 0x81, 0x8B, 0x46, 0xE3, 0x82, 0x88, - 0xE3, 0x82, 0x8A, 0x46, 0xE3, 0x82, 0xAD, 0xE3, - // Bytes 26c0 - 26ff - 0x83, 0xAD, 0x46, 0xE3, 0x82, 0xB3, 0xE3, 0x82, - 0xB3, 0x46, 0xE3, 0x82, 0xB3, 0xE3, 0x83, 0x88, - 0x46, 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xB3, 0x46, - 0xE3, 0x83, 0x8A, 0xE3, 0x83, 0x8E, 0x46, 0xE3, - 0x83, 0x9B, 0xE3, 0x83, 0xB3, 0x46, 0xE3, 0x83, - 0x9F, 0xE3, 0x83, 0xAA, 0x46, 0xE3, 0x83, 0xAA, - 0xE3, 0x83, 0xA9, 0x46, 0xE3, 0x83, 0xAC, 0xE3, - 0x83, 0xA0, 0x46, 0xE5, 0xA4, 0xA7, 0xE6, 0xAD, - // Bytes 2700 - 273f - 0xA3, 0x46, 0xE5, 0xB9, 0xB3, 0xE6, 0x88, 0x90, - 0x46, 0xE6, 0x98, 0x8E, 0xE6, 0xB2, 0xBB, 0x46, - 0xE6, 0x98, 0xAD, 0xE5, 0x92, 0x8C, 0x47, 0x72, - 0x61, 0x64, 0xE2, 0x88, 0x95, 0x73, 0x47, 0xE3, - 0x80, 0x94, 0x53, 0xE3, 0x80, 0x95, 0x48, 0x28, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xA1, 0x29, 0x48, - 0x28, 0xE1, 0x84, 0x82, 0xE1, 0x85, 0xA1, 0x29, - 0x48, 0x28, 0xE1, 0x84, 0x83, 0xE1, 0x85, 0xA1, - // Bytes 2740 - 277f - 0x29, 0x48, 0x28, 0xE1, 0x84, 0x85, 0xE1, 0x85, - 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x86, 0xE1, - 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x87, - 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, - 0x89, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, - 0x84, 0x8B, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, - 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xA1, 0x29, 0x48, - 0x28, 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xAE, 0x29, - // Bytes 2780 - 27bf - 0x48, 0x28, 0xE1, 0x84, 0x8E, 0xE1, 0x85, 0xA1, - 0x29, 0x48, 0x28, 0xE1, 0x84, 0x8F, 0xE1, 0x85, - 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x90, 0xE1, - 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x91, - 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, - 0x92, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x72, 0x61, - 0x64, 0xE2, 0x88, 0x95, 0x73, 0x32, 0x48, 0xD8, - 0xA7, 0xD9, 0x83, 0xD8, 0xA8, 0xD8, 0xB1, 0x48, - // Bytes 27c0 - 27ff - 0xD8, 0xA7, 0xD9, 0x84, 0xD9, 0x84, 0xD9, 0x87, - 0x48, 0xD8, 0xB1, 0xD8, 0xB3, 0xD9, 0x88, 0xD9, - 0x84, 0x48, 0xD8, 0xB1, 0xDB, 0x8C, 0xD8, 0xA7, - 0xD9, 0x84, 0x48, 0xD8, 0xB5, 0xD9, 0x84, 0xD8, - 0xB9, 0xD9, 0x85, 0x48, 0xD8, 0xB9, 0xD9, 0x84, - 0xD9, 0x8A, 0xD9, 0x87, 0x48, 0xD9, 0x85, 0xD8, - 0xAD, 0xD9, 0x85, 0xD8, 0xAF, 0x48, 0xD9, 0x88, - 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85, 0x49, 0xE2, - // Bytes 2800 - 283f - 0x80, 0xB2, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, - 0x49, 0xE2, 0x80, 0xB5, 0xE2, 0x80, 0xB5, 0xE2, - 0x80, 0xB5, 0x49, 0xE2, 0x88, 0xAB, 0xE2, 0x88, - 0xAB, 0xE2, 0x88, 0xAB, 0x49, 0xE2, 0x88, 0xAE, - 0xE2, 0x88, 0xAE, 0xE2, 0x88, 0xAE, 0x49, 0xE3, - 0x80, 0x94, 0xE4, 0xB8, 0x89, 0xE3, 0x80, 0x95, - 0x49, 0xE3, 0x80, 0x94, 0xE4, 0xBA, 0x8C, 0xE3, - 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, 0xE5, 0x8B, - // Bytes 2840 - 287f - 0x9D, 0xE3, 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, - 0xE5, 0xAE, 0x89, 0xE3, 0x80, 0x95, 0x49, 0xE3, - 0x80, 0x94, 0xE6, 0x89, 0x93, 0xE3, 0x80, 0x95, - 0x49, 0xE3, 0x80, 0x94, 0xE6, 0x95, 0x97, 0xE3, - 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, 0xE6, 0x9C, - 0xAC, 0xE3, 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, - 0xE7, 0x82, 0xB9, 0xE3, 0x80, 0x95, 0x49, 0xE3, - 0x80, 0x94, 0xE7, 0x9B, 0x97, 0xE3, 0x80, 0x95, - // Bytes 2880 - 28bf - 0x49, 0xE3, 0x82, 0xA2, 0xE3, 0x83, 0xBC, 0xE3, - 0x83, 0xAB, 0x49, 0xE3, 0x82, 0xA4, 0xE3, 0x83, - 0xB3, 0xE3, 0x83, 0x81, 0x49, 0xE3, 0x82, 0xA6, - 0xE3, 0x82, 0xA9, 0xE3, 0x83, 0xB3, 0x49, 0xE3, - 0x82, 0xAA, 0xE3, 0x83, 0xB3, 0xE3, 0x82, 0xB9, - 0x49, 0xE3, 0x82, 0xAA, 0xE3, 0x83, 0xBC, 0xE3, - 0x83, 0xA0, 0x49, 0xE3, 0x82, 0xAB, 0xE3, 0x82, - 0xA4, 0xE3, 0x83, 0xAA, 0x49, 0xE3, 0x82, 0xB1, - // Bytes 28c0 - 28ff - 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xB9, 0x49, 0xE3, - 0x82, 0xB3, 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x8A, - 0x49, 0xE3, 0x82, 0xBB, 0xE3, 0x83, 0xB3, 0xE3, - 0x83, 0x81, 0x49, 0xE3, 0x82, 0xBB, 0xE3, 0x83, - 0xB3, 0xE3, 0x83, 0x88, 0x49, 0xE3, 0x83, 0x86, - 0xE3, 0x82, 0x99, 0xE3, 0x82, 0xB7, 0x49, 0xE3, - 0x83, 0x88, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, - 0x49, 0xE3, 0x83, 0x8E, 0xE3, 0x83, 0x83, 0xE3, - // Bytes 2900 - 293f - 0x83, 0x88, 0x49, 0xE3, 0x83, 0x8F, 0xE3, 0x82, - 0xA4, 0xE3, 0x83, 0x84, 0x49, 0xE3, 0x83, 0x92, - 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, 0x49, 0xE3, - 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, 0x82, 0xB3, - 0x49, 0xE3, 0x83, 0x95, 0xE3, 0x83, 0xA9, 0xE3, - 0x83, 0xB3, 0x49, 0xE3, 0x83, 0x98, 0xE3, 0x82, - 0x9A, 0xE3, 0x82, 0xBD, 0x49, 0xE3, 0x83, 0x98, - 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x84, 0x49, 0xE3, - // Bytes 2940 - 297f - 0x83, 0x9B, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0xAB, - 0x49, 0xE3, 0x83, 0x9B, 0xE3, 0x83, 0xBC, 0xE3, - 0x83, 0xB3, 0x49, 0xE3, 0x83, 0x9E, 0xE3, 0x82, - 0xA4, 0xE3, 0x83, 0xAB, 0x49, 0xE3, 0x83, 0x9E, - 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x8F, 0x49, 0xE3, - 0x83, 0x9E, 0xE3, 0x83, 0xAB, 0xE3, 0x82, 0xAF, - 0x49, 0xE3, 0x83, 0xA4, 0xE3, 0x83, 0xBC, 0xE3, - 0x83, 0xAB, 0x49, 0xE3, 0x83, 0xA6, 0xE3, 0x82, - // Bytes 2980 - 29bf - 0xA2, 0xE3, 0x83, 0xB3, 0x49, 0xE3, 0x83, 0xAF, - 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x88, 0x4C, 0xE2, - 0x80, 0xB2, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, - 0xE2, 0x80, 0xB2, 0x4C, 0xE2, 0x88, 0xAB, 0xE2, - 0x88, 0xAB, 0xE2, 0x88, 0xAB, 0xE2, 0x88, 0xAB, - 0x4C, 0xE3, 0x82, 0xA2, 0xE3, 0x83, 0xAB, 0xE3, - 0x83, 0x95, 0xE3, 0x82, 0xA1, 0x4C, 0xE3, 0x82, - 0xA8, 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xAB, 0xE3, - // Bytes 29c0 - 29ff - 0x83, 0xBC, 0x4C, 0xE3, 0x82, 0xAB, 0xE3, 0x82, - 0x99, 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xB3, 0x4C, - 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0xE3, 0x83, - 0xB3, 0xE3, 0x83, 0x9E, 0x4C, 0xE3, 0x82, 0xAB, - 0xE3, 0x83, 0xA9, 0xE3, 0x83, 0x83, 0xE3, 0x83, - 0x88, 0x4C, 0xE3, 0x82, 0xAB, 0xE3, 0x83, 0xAD, - 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xBC, 0x4C, 0xE3, - 0x82, 0xAD, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0x8B, - // Bytes 2a00 - 2a3f - 0xE3, 0x83, 0xBC, 0x4C, 0xE3, 0x82, 0xAD, 0xE3, - 0x83, 0xA5, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xBC, - 0x4C, 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, - 0x83, 0xA9, 0xE3, 0x83, 0xA0, 0x4C, 0xE3, 0x82, - 0xAF, 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xBC, 0xE3, - 0x83, 0x8D, 0x4C, 0xE3, 0x82, 0xB5, 0xE3, 0x82, - 0xA4, 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAB, 0x4C, - 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0xE3, 0x83, - // Bytes 2a40 - 2a7f - 0xBC, 0xE3, 0x82, 0xB9, 0x4C, 0xE3, 0x83, 0x8F, - 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, 0xE3, 0x83, - 0x84, 0x4C, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, - 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAB, 0x4C, 0xE3, - 0x83, 0x95, 0xE3, 0x82, 0xA3, 0xE3, 0x83, 0xBC, - 0xE3, 0x83, 0x88, 0x4C, 0xE3, 0x83, 0x98, 0xE3, - 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xBF, - 0x4C, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x9A, 0xE3, - // Bytes 2a80 - 2abf - 0x83, 0x8B, 0xE3, 0x83, 0x92, 0x4C, 0xE3, 0x83, - 0x98, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xB3, 0xE3, - 0x82, 0xB9, 0x4C, 0xE3, 0x83, 0x9B, 0xE3, 0x82, - 0x99, 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x88, 0x4C, - 0xE3, 0x83, 0x9E, 0xE3, 0x82, 0xA4, 0xE3, 0x82, - 0xAF, 0xE3, 0x83, 0xAD, 0x4C, 0xE3, 0x83, 0x9F, - 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAD, 0xE3, 0x83, - 0xB3, 0x4C, 0xE3, 0x83, 0xA1, 0xE3, 0x83, 0xBC, - // Bytes 2ac0 - 2aff - 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xAB, 0x4C, 0xE3, - 0x83, 0xAA, 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x88, - 0xE3, 0x83, 0xAB, 0x4C, 0xE3, 0x83, 0xAB, 0xE3, - 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, - 0x4C, 0xE6, 0xA0, 0xAA, 0xE5, 0xBC, 0x8F, 0xE4, - 0xBC, 0x9A, 0xE7, 0xA4, 0xBE, 0x4E, 0x28, 0xE1, - 0x84, 0x8B, 0xE1, 0x85, 0xA9, 0xE1, 0x84, 0x92, - 0xE1, 0x85, 0xAE, 0x29, 0x4F, 0xD8, 0xAC, 0xD9, - // Bytes 2b00 - 2b3f - 0x84, 0x20, 0xD8, 0xAC, 0xD9, 0x84, 0xD8, 0xA7, - 0xD9, 0x84, 0xD9, 0x87, 0x4F, 0xE3, 0x82, 0xA2, - 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x9A, 0xE3, 0x83, - 0xBC, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x82, 0xA2, - 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x98, 0xE3, 0x82, - 0x9A, 0xE3, 0x82, 0xA2, 0x4F, 0xE3, 0x82, 0xAD, - 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xAF, 0xE3, 0x83, - 0x83, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x82, 0xB5, - // Bytes 2b40 - 2b7f - 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x81, 0xE3, 0x83, - 0xBC, 0xE3, 0x83, 0xA0, 0x4F, 0xE3, 0x83, 0x8F, - 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x83, - 0xAC, 0xE3, 0x83, 0xAB, 0x4F, 0xE3, 0x83, 0x98, - 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0xBF, 0xE3, 0x83, - 0xBC, 0xE3, 0x83, 0xAB, 0x4F, 0xE3, 0x83, 0x9B, - 0xE3, 0x82, 0x9A, 0xE3, 0x82, 0xA4, 0xE3, 0x83, - 0xB3, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x83, 0x9E, - // Bytes 2b80 - 2bbf - 0xE3, 0x83, 0xB3, 0xE3, 0x82, 0xB7, 0xE3, 0x83, - 0xA7, 0xE3, 0x83, 0xB3, 0x4F, 0xE3, 0x83, 0xA1, - 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0xE3, 0x83, - 0x88, 0xE3, 0x83, 0xB3, 0x4F, 0xE3, 0x83, 0xAB, - 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x95, 0xE3, 0x82, - 0x99, 0xE3, 0x83, 0xAB, 0x51, 0x28, 0xE1, 0x84, - 0x8B, 0xE1, 0x85, 0xA9, 0xE1, 0x84, 0x8C, 0xE1, - 0x85, 0xA5, 0xE1, 0x86, 0xAB, 0x29, 0x52, 0xE3, - // Bytes 2bc0 - 2bff - 0x82, 0xAD, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, - 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0xE3, 0x83, - 0xBC, 0x52, 0xE3, 0x82, 0xAD, 0xE3, 0x83, 0xAD, - 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, 0x83, - 0xA9, 0xE3, 0x83, 0xA0, 0x52, 0xE3, 0x82, 0xAD, - 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xA1, 0xE3, 0x83, - 0xBC, 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xAB, 0x52, - 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, 0x83, - // Bytes 2c00 - 2c3f - 0xA9, 0xE3, 0x83, 0xA0, 0xE3, 0x83, 0x88, 0xE3, - 0x83, 0xB3, 0x52, 0xE3, 0x82, 0xAF, 0xE3, 0x83, - 0xAB, 0xE3, 0x82, 0xBB, 0xE3, 0x82, 0x99, 0xE3, - 0x82, 0xA4, 0xE3, 0x83, 0xAD, 0x52, 0xE3, 0x83, - 0x8F, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, 0xE3, - 0x82, 0xBB, 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x88, - 0x52, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, - 0x82, 0xA2, 0xE3, 0x82, 0xB9, 0xE3, 0x83, 0x88, - // Bytes 2c40 - 2c7f - 0xE3, 0x83, 0xAB, 0x52, 0xE3, 0x83, 0x95, 0xE3, - 0x82, 0x99, 0xE3, 0x83, 0x83, 0xE3, 0x82, 0xB7, - 0xE3, 0x82, 0xA7, 0xE3, 0x83, 0xAB, 0x52, 0xE3, - 0x83, 0x9F, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0x8F, - 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x83, - 0xAB, 0x52, 0xE3, 0x83, 0xAC, 0xE3, 0x83, 0xB3, - 0xE3, 0x83, 0x88, 0xE3, 0x82, 0xB1, 0xE3, 0x82, - 0x99, 0xE3, 0x83, 0xB3, 0x61, 0xD8, 0xB5, 0xD9, - // Bytes 2c80 - 2cbf - 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, - 0xD9, 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, - 0x84, 0xD9, 0x8A, 0xD9, 0x87, 0x20, 0xD9, 0x88, - 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85, 0x06, 0xE0, - 0xA7, 0x87, 0xE0, 0xA6, 0xBE, 0x01, 0x06, 0xE0, - 0xA7, 0x87, 0xE0, 0xA7, 0x97, 0x01, 0x06, 0xE0, - 0xAD, 0x87, 0xE0, 0xAC, 0xBE, 0x01, 0x06, 0xE0, - 0xAD, 0x87, 0xE0, 0xAD, 0x96, 0x01, 0x06, 0xE0, - // Bytes 2cc0 - 2cff - 0xAD, 0x87, 0xE0, 0xAD, 0x97, 0x01, 0x06, 0xE0, - 0xAE, 0x92, 0xE0, 0xAF, 0x97, 0x01, 0x06, 0xE0, - 0xAF, 0x86, 0xE0, 0xAE, 0xBE, 0x01, 0x06, 0xE0, - 0xAF, 0x86, 0xE0, 0xAF, 0x97, 0x01, 0x06, 0xE0, - 0xAF, 0x87, 0xE0, 0xAE, 0xBE, 0x01, 0x06, 0xE0, - 0xB2, 0xBF, 0xE0, 0xB3, 0x95, 0x01, 0x06, 0xE0, - 0xB3, 0x86, 0xE0, 0xB3, 0x95, 0x01, 0x06, 0xE0, - 0xB3, 0x86, 0xE0, 0xB3, 0x96, 0x01, 0x06, 0xE0, - // Bytes 2d00 - 2d3f - 0xB5, 0x86, 0xE0, 0xB4, 0xBE, 0x01, 0x06, 0xE0, - 0xB5, 0x86, 0xE0, 0xB5, 0x97, 0x01, 0x06, 0xE0, - 0xB5, 0x87, 0xE0, 0xB4, 0xBE, 0x01, 0x06, 0xE0, - 0xB7, 0x99, 0xE0, 0xB7, 0x9F, 0x01, 0x06, 0xE1, - 0x80, 0xA5, 0xE1, 0x80, 0xAE, 0x01, 0x06, 0xE1, - 0xAC, 0x85, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0x87, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0x89, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - // Bytes 2d40 - 2d7f - 0xAC, 0x8B, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0x8D, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0x91, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0xBA, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0xBC, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0xBE, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAC, 0xBF, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, - 0xAD, 0x82, 0xE1, 0xAC, 0xB5, 0x01, 0x08, 0xF0, - // Bytes 2d80 - 2dbf - 0x91, 0x84, 0xB1, 0xF0, 0x91, 0x84, 0xA7, 0x01, - 0x08, 0xF0, 0x91, 0x84, 0xB2, 0xF0, 0x91, 0x84, - 0xA7, 0x01, 0x08, 0xF0, 0x91, 0x8D, 0x87, 0xF0, - 0x91, 0x8C, 0xBE, 0x01, 0x08, 0xF0, 0x91, 0x8D, - 0x87, 0xF0, 0x91, 0x8D, 0x97, 0x01, 0x08, 0xF0, - 0x91, 0x92, 0xB9, 0xF0, 0x91, 0x92, 0xB0, 0x01, - 0x08, 0xF0, 0x91, 0x92, 0xB9, 0xF0, 0x91, 0x92, - 0xBA, 0x01, 0x08, 0xF0, 0x91, 0x92, 0xB9, 0xF0, - // Bytes 2dc0 - 2dff - 0x91, 0x92, 0xBD, 0x01, 0x08, 0xF0, 0x91, 0x96, - 0xB8, 0xF0, 0x91, 0x96, 0xAF, 0x01, 0x08, 0xF0, - 0x91, 0x96, 0xB9, 0xF0, 0x91, 0x96, 0xAF, 0x01, - 0x09, 0xE0, 0xB3, 0x86, 0xE0, 0xB3, 0x82, 0xE0, - 0xB3, 0x95, 0x02, 0x09, 0xE0, 0xB7, 0x99, 0xE0, - 0xB7, 0x8F, 0xE0, 0xB7, 0x8A, 0x12, 0x44, 0x44, - 0x5A, 0xCC, 0x8C, 0xC9, 0x44, 0x44, 0x7A, 0xCC, - 0x8C, 0xC9, 0x44, 0x64, 0x7A, 0xCC, 0x8C, 0xC9, - // Bytes 2e00 - 2e3f - 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x93, 0xC9, - 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x94, 0xC9, - 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x95, 0xB5, - 0x46, 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x82, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x83, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x85, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x86, 0xE1, 0x85, 0xA1, 0x01, - // Bytes 2e40 - 2e7f - 0x46, 0xE1, 0x84, 0x87, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x89, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xAE, 0x01, - 0x46, 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x8E, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x8F, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x90, 0xE1, 0x85, 0xA1, 0x01, - // Bytes 2e80 - 2ebf - 0x46, 0xE1, 0x84, 0x91, 0xE1, 0x85, 0xA1, 0x01, - 0x46, 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0x01, - 0x49, 0xE3, 0x83, 0xA1, 0xE3, 0x82, 0xAB, 0xE3, - 0x82, 0x99, 0x0D, 0x4C, 0xE1, 0x84, 0x8C, 0xE1, - 0x85, 0xAE, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xB4, - 0x01, 0x4C, 0xE3, 0x82, 0xAD, 0xE3, 0x82, 0x99, - 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0x0D, 0x4C, - 0xE3, 0x82, 0xB3, 0xE3, 0x83, 0xBC, 0xE3, 0x83, - // Bytes 2ec0 - 2eff - 0x9B, 0xE3, 0x82, 0x9A, 0x0D, 0x4C, 0xE3, 0x83, - 0xA4, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x88, 0xE3, - 0x82, 0x99, 0x0D, 0x4F, 0xE1, 0x84, 0x8E, 0xE1, - 0x85, 0xA1, 0xE1, 0x86, 0xB7, 0xE1, 0x84, 0x80, - 0xE1, 0x85, 0xA9, 0x01, 0x4F, 0xE3, 0x82, 0xA4, - 0xE3, 0x83, 0x8B, 0xE3, 0x83, 0xB3, 0xE3, 0x82, - 0xAF, 0xE3, 0x82, 0x99, 0x0D, 0x4F, 0xE3, 0x82, - 0xB7, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xB3, 0xE3, - // Bytes 2f00 - 2f3f - 0x82, 0xAF, 0xE3, 0x82, 0x99, 0x0D, 0x4F, 0xE3, - 0x83, 0x98, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, - 0xE3, 0x82, 0xB7, 0xE3, 0x82, 0x99, 0x0D, 0x4F, - 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x9A, 0xE3, 0x83, - 0xB3, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, - 0x52, 0xE3, 0x82, 0xA8, 0xE3, 0x82, 0xB9, 0xE3, - 0x82, 0xAF, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x88, - 0xE3, 0x82, 0x99, 0x0D, 0x52, 0xE3, 0x83, 0x95, - // Bytes 2f40 - 2f7f - 0xE3, 0x82, 0xA1, 0xE3, 0x83, 0xA9, 0xE3, 0x83, - 0x83, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, - 0x86, 0xE0, 0xB3, 0x86, 0xE0, 0xB3, 0x82, 0x01, - 0x86, 0xE0, 0xB7, 0x99, 0xE0, 0xB7, 0x8F, 0x01, - 0x03, 0x3C, 0xCC, 0xB8, 0x05, 0x03, 0x3D, 0xCC, - 0xB8, 0x05, 0x03, 0x3E, 0xCC, 0xB8, 0x05, 0x03, - 0x41, 0xCC, 0x80, 0xC9, 0x03, 0x41, 0xCC, 0x81, - 0xC9, 0x03, 0x41, 0xCC, 0x83, 0xC9, 0x03, 0x41, - // Bytes 2f80 - 2fbf - 0xCC, 0x84, 0xC9, 0x03, 0x41, 0xCC, 0x89, 0xC9, - 0x03, 0x41, 0xCC, 0x8C, 0xC9, 0x03, 0x41, 0xCC, - 0x8F, 0xC9, 0x03, 0x41, 0xCC, 0x91, 0xC9, 0x03, - 0x41, 0xCC, 0xA5, 0xB5, 0x03, 0x41, 0xCC, 0xA8, - 0xA5, 0x03, 0x42, 0xCC, 0x87, 0xC9, 0x03, 0x42, - 0xCC, 0xA3, 0xB5, 0x03, 0x42, 0xCC, 0xB1, 0xB5, - 0x03, 0x43, 0xCC, 0x81, 0xC9, 0x03, 0x43, 0xCC, - 0x82, 0xC9, 0x03, 0x43, 0xCC, 0x87, 0xC9, 0x03, - // Bytes 2fc0 - 2fff - 0x43, 0xCC, 0x8C, 0xC9, 0x03, 0x44, 0xCC, 0x87, - 0xC9, 0x03, 0x44, 0xCC, 0x8C, 0xC9, 0x03, 0x44, - 0xCC, 0xA3, 0xB5, 0x03, 0x44, 0xCC, 0xA7, 0xA5, - 0x03, 0x44, 0xCC, 0xAD, 0xB5, 0x03, 0x44, 0xCC, - 0xB1, 0xB5, 0x03, 0x45, 0xCC, 0x80, 0xC9, 0x03, - 0x45, 0xCC, 0x81, 0xC9, 0x03, 0x45, 0xCC, 0x83, - 0xC9, 0x03, 0x45, 0xCC, 0x86, 0xC9, 0x03, 0x45, - 0xCC, 0x87, 0xC9, 0x03, 0x45, 0xCC, 0x88, 0xC9, - // Bytes 3000 - 303f - 0x03, 0x45, 0xCC, 0x89, 0xC9, 0x03, 0x45, 0xCC, - 0x8C, 0xC9, 0x03, 0x45, 0xCC, 0x8F, 0xC9, 0x03, - 0x45, 0xCC, 0x91, 0xC9, 0x03, 0x45, 0xCC, 0xA8, - 0xA5, 0x03, 0x45, 0xCC, 0xAD, 0xB5, 0x03, 0x45, - 0xCC, 0xB0, 0xB5, 0x03, 0x46, 0xCC, 0x87, 0xC9, - 0x03, 0x47, 0xCC, 0x81, 0xC9, 0x03, 0x47, 0xCC, - 0x82, 0xC9, 0x03, 0x47, 0xCC, 0x84, 0xC9, 0x03, - 0x47, 0xCC, 0x86, 0xC9, 0x03, 0x47, 0xCC, 0x87, - // Bytes 3040 - 307f - 0xC9, 0x03, 0x47, 0xCC, 0x8C, 0xC9, 0x03, 0x47, - 0xCC, 0xA7, 0xA5, 0x03, 0x48, 0xCC, 0x82, 0xC9, - 0x03, 0x48, 0xCC, 0x87, 0xC9, 0x03, 0x48, 0xCC, - 0x88, 0xC9, 0x03, 0x48, 0xCC, 0x8C, 0xC9, 0x03, - 0x48, 0xCC, 0xA3, 0xB5, 0x03, 0x48, 0xCC, 0xA7, - 0xA5, 0x03, 0x48, 0xCC, 0xAE, 0xB5, 0x03, 0x49, - 0xCC, 0x80, 0xC9, 0x03, 0x49, 0xCC, 0x81, 0xC9, - 0x03, 0x49, 0xCC, 0x82, 0xC9, 0x03, 0x49, 0xCC, - // Bytes 3080 - 30bf - 0x83, 0xC9, 0x03, 0x49, 0xCC, 0x84, 0xC9, 0x03, - 0x49, 0xCC, 0x86, 0xC9, 0x03, 0x49, 0xCC, 0x87, - 0xC9, 0x03, 0x49, 0xCC, 0x89, 0xC9, 0x03, 0x49, - 0xCC, 0x8C, 0xC9, 0x03, 0x49, 0xCC, 0x8F, 0xC9, - 0x03, 0x49, 0xCC, 0x91, 0xC9, 0x03, 0x49, 0xCC, - 0xA3, 0xB5, 0x03, 0x49, 0xCC, 0xA8, 0xA5, 0x03, - 0x49, 0xCC, 0xB0, 0xB5, 0x03, 0x4A, 0xCC, 0x82, - 0xC9, 0x03, 0x4B, 0xCC, 0x81, 0xC9, 0x03, 0x4B, - // Bytes 30c0 - 30ff - 0xCC, 0x8C, 0xC9, 0x03, 0x4B, 0xCC, 0xA3, 0xB5, - 0x03, 0x4B, 0xCC, 0xA7, 0xA5, 0x03, 0x4B, 0xCC, - 0xB1, 0xB5, 0x03, 0x4C, 0xCC, 0x81, 0xC9, 0x03, - 0x4C, 0xCC, 0x8C, 0xC9, 0x03, 0x4C, 0xCC, 0xA7, - 0xA5, 0x03, 0x4C, 0xCC, 0xAD, 0xB5, 0x03, 0x4C, - 0xCC, 0xB1, 0xB5, 0x03, 0x4D, 0xCC, 0x81, 0xC9, - 0x03, 0x4D, 0xCC, 0x87, 0xC9, 0x03, 0x4D, 0xCC, - 0xA3, 0xB5, 0x03, 0x4E, 0xCC, 0x80, 0xC9, 0x03, - // Bytes 3100 - 313f - 0x4E, 0xCC, 0x81, 0xC9, 0x03, 0x4E, 0xCC, 0x83, - 0xC9, 0x03, 0x4E, 0xCC, 0x87, 0xC9, 0x03, 0x4E, - 0xCC, 0x8C, 0xC9, 0x03, 0x4E, 0xCC, 0xA3, 0xB5, - 0x03, 0x4E, 0xCC, 0xA7, 0xA5, 0x03, 0x4E, 0xCC, - 0xAD, 0xB5, 0x03, 0x4E, 0xCC, 0xB1, 0xB5, 0x03, - 0x4F, 0xCC, 0x80, 0xC9, 0x03, 0x4F, 0xCC, 0x81, - 0xC9, 0x03, 0x4F, 0xCC, 0x86, 0xC9, 0x03, 0x4F, - 0xCC, 0x89, 0xC9, 0x03, 0x4F, 0xCC, 0x8B, 0xC9, - // Bytes 3140 - 317f - 0x03, 0x4F, 0xCC, 0x8C, 0xC9, 0x03, 0x4F, 0xCC, - 0x8F, 0xC9, 0x03, 0x4F, 0xCC, 0x91, 0xC9, 0x03, - 0x50, 0xCC, 0x81, 0xC9, 0x03, 0x50, 0xCC, 0x87, - 0xC9, 0x03, 0x52, 0xCC, 0x81, 0xC9, 0x03, 0x52, - 0xCC, 0x87, 0xC9, 0x03, 0x52, 0xCC, 0x8C, 0xC9, - 0x03, 0x52, 0xCC, 0x8F, 0xC9, 0x03, 0x52, 0xCC, - 0x91, 0xC9, 0x03, 0x52, 0xCC, 0xA7, 0xA5, 0x03, - 0x52, 0xCC, 0xB1, 0xB5, 0x03, 0x53, 0xCC, 0x82, - // Bytes 3180 - 31bf - 0xC9, 0x03, 0x53, 0xCC, 0x87, 0xC9, 0x03, 0x53, - 0xCC, 0xA6, 0xB5, 0x03, 0x53, 0xCC, 0xA7, 0xA5, - 0x03, 0x54, 0xCC, 0x87, 0xC9, 0x03, 0x54, 0xCC, - 0x8C, 0xC9, 0x03, 0x54, 0xCC, 0xA3, 0xB5, 0x03, - 0x54, 0xCC, 0xA6, 0xB5, 0x03, 0x54, 0xCC, 0xA7, - 0xA5, 0x03, 0x54, 0xCC, 0xAD, 0xB5, 0x03, 0x54, - 0xCC, 0xB1, 0xB5, 0x03, 0x55, 0xCC, 0x80, 0xC9, - 0x03, 0x55, 0xCC, 0x81, 0xC9, 0x03, 0x55, 0xCC, - // Bytes 31c0 - 31ff - 0x82, 0xC9, 0x03, 0x55, 0xCC, 0x86, 0xC9, 0x03, - 0x55, 0xCC, 0x89, 0xC9, 0x03, 0x55, 0xCC, 0x8A, - 0xC9, 0x03, 0x55, 0xCC, 0x8B, 0xC9, 0x03, 0x55, - 0xCC, 0x8C, 0xC9, 0x03, 0x55, 0xCC, 0x8F, 0xC9, - 0x03, 0x55, 0xCC, 0x91, 0xC9, 0x03, 0x55, 0xCC, - 0xA3, 0xB5, 0x03, 0x55, 0xCC, 0xA4, 0xB5, 0x03, - 0x55, 0xCC, 0xA8, 0xA5, 0x03, 0x55, 0xCC, 0xAD, - 0xB5, 0x03, 0x55, 0xCC, 0xB0, 0xB5, 0x03, 0x56, - // Bytes 3200 - 323f - 0xCC, 0x83, 0xC9, 0x03, 0x56, 0xCC, 0xA3, 0xB5, - 0x03, 0x57, 0xCC, 0x80, 0xC9, 0x03, 0x57, 0xCC, - 0x81, 0xC9, 0x03, 0x57, 0xCC, 0x82, 0xC9, 0x03, - 0x57, 0xCC, 0x87, 0xC9, 0x03, 0x57, 0xCC, 0x88, - 0xC9, 0x03, 0x57, 0xCC, 0xA3, 0xB5, 0x03, 0x58, - 0xCC, 0x87, 0xC9, 0x03, 0x58, 0xCC, 0x88, 0xC9, - 0x03, 0x59, 0xCC, 0x80, 0xC9, 0x03, 0x59, 0xCC, - 0x81, 0xC9, 0x03, 0x59, 0xCC, 0x82, 0xC9, 0x03, - // Bytes 3240 - 327f - 0x59, 0xCC, 0x83, 0xC9, 0x03, 0x59, 0xCC, 0x84, - 0xC9, 0x03, 0x59, 0xCC, 0x87, 0xC9, 0x03, 0x59, - 0xCC, 0x88, 0xC9, 0x03, 0x59, 0xCC, 0x89, 0xC9, - 0x03, 0x59, 0xCC, 0xA3, 0xB5, 0x03, 0x5A, 0xCC, - 0x81, 0xC9, 0x03, 0x5A, 0xCC, 0x82, 0xC9, 0x03, - 0x5A, 0xCC, 0x87, 0xC9, 0x03, 0x5A, 0xCC, 0x8C, - 0xC9, 0x03, 0x5A, 0xCC, 0xA3, 0xB5, 0x03, 0x5A, - 0xCC, 0xB1, 0xB5, 0x03, 0x61, 0xCC, 0x80, 0xC9, - // Bytes 3280 - 32bf - 0x03, 0x61, 0xCC, 0x81, 0xC9, 0x03, 0x61, 0xCC, - 0x83, 0xC9, 0x03, 0x61, 0xCC, 0x84, 0xC9, 0x03, - 0x61, 0xCC, 0x89, 0xC9, 0x03, 0x61, 0xCC, 0x8C, - 0xC9, 0x03, 0x61, 0xCC, 0x8F, 0xC9, 0x03, 0x61, - 0xCC, 0x91, 0xC9, 0x03, 0x61, 0xCC, 0xA5, 0xB5, - 0x03, 0x61, 0xCC, 0xA8, 0xA5, 0x03, 0x62, 0xCC, - 0x87, 0xC9, 0x03, 0x62, 0xCC, 0xA3, 0xB5, 0x03, - 0x62, 0xCC, 0xB1, 0xB5, 0x03, 0x63, 0xCC, 0x81, - // Bytes 32c0 - 32ff - 0xC9, 0x03, 0x63, 0xCC, 0x82, 0xC9, 0x03, 0x63, - 0xCC, 0x87, 0xC9, 0x03, 0x63, 0xCC, 0x8C, 0xC9, - 0x03, 0x64, 0xCC, 0x87, 0xC9, 0x03, 0x64, 0xCC, - 0x8C, 0xC9, 0x03, 0x64, 0xCC, 0xA3, 0xB5, 0x03, - 0x64, 0xCC, 0xA7, 0xA5, 0x03, 0x64, 0xCC, 0xAD, - 0xB5, 0x03, 0x64, 0xCC, 0xB1, 0xB5, 0x03, 0x65, - 0xCC, 0x80, 0xC9, 0x03, 0x65, 0xCC, 0x81, 0xC9, - 0x03, 0x65, 0xCC, 0x83, 0xC9, 0x03, 0x65, 0xCC, - // Bytes 3300 - 333f - 0x86, 0xC9, 0x03, 0x65, 0xCC, 0x87, 0xC9, 0x03, - 0x65, 0xCC, 0x88, 0xC9, 0x03, 0x65, 0xCC, 0x89, - 0xC9, 0x03, 0x65, 0xCC, 0x8C, 0xC9, 0x03, 0x65, - 0xCC, 0x8F, 0xC9, 0x03, 0x65, 0xCC, 0x91, 0xC9, - 0x03, 0x65, 0xCC, 0xA8, 0xA5, 0x03, 0x65, 0xCC, - 0xAD, 0xB5, 0x03, 0x65, 0xCC, 0xB0, 0xB5, 0x03, - 0x66, 0xCC, 0x87, 0xC9, 0x03, 0x67, 0xCC, 0x81, - 0xC9, 0x03, 0x67, 0xCC, 0x82, 0xC9, 0x03, 0x67, - // Bytes 3340 - 337f - 0xCC, 0x84, 0xC9, 0x03, 0x67, 0xCC, 0x86, 0xC9, - 0x03, 0x67, 0xCC, 0x87, 0xC9, 0x03, 0x67, 0xCC, - 0x8C, 0xC9, 0x03, 0x67, 0xCC, 0xA7, 0xA5, 0x03, - 0x68, 0xCC, 0x82, 0xC9, 0x03, 0x68, 0xCC, 0x87, - 0xC9, 0x03, 0x68, 0xCC, 0x88, 0xC9, 0x03, 0x68, - 0xCC, 0x8C, 0xC9, 0x03, 0x68, 0xCC, 0xA3, 0xB5, - 0x03, 0x68, 0xCC, 0xA7, 0xA5, 0x03, 0x68, 0xCC, - 0xAE, 0xB5, 0x03, 0x68, 0xCC, 0xB1, 0xB5, 0x03, - // Bytes 3380 - 33bf - 0x69, 0xCC, 0x80, 0xC9, 0x03, 0x69, 0xCC, 0x81, - 0xC9, 0x03, 0x69, 0xCC, 0x82, 0xC9, 0x03, 0x69, - 0xCC, 0x83, 0xC9, 0x03, 0x69, 0xCC, 0x84, 0xC9, - 0x03, 0x69, 0xCC, 0x86, 0xC9, 0x03, 0x69, 0xCC, - 0x89, 0xC9, 0x03, 0x69, 0xCC, 0x8C, 0xC9, 0x03, - 0x69, 0xCC, 0x8F, 0xC9, 0x03, 0x69, 0xCC, 0x91, - 0xC9, 0x03, 0x69, 0xCC, 0xA3, 0xB5, 0x03, 0x69, - 0xCC, 0xA8, 0xA5, 0x03, 0x69, 0xCC, 0xB0, 0xB5, - // Bytes 33c0 - 33ff - 0x03, 0x6A, 0xCC, 0x82, 0xC9, 0x03, 0x6A, 0xCC, - 0x8C, 0xC9, 0x03, 0x6B, 0xCC, 0x81, 0xC9, 0x03, - 0x6B, 0xCC, 0x8C, 0xC9, 0x03, 0x6B, 0xCC, 0xA3, - 0xB5, 0x03, 0x6B, 0xCC, 0xA7, 0xA5, 0x03, 0x6B, - 0xCC, 0xB1, 0xB5, 0x03, 0x6C, 0xCC, 0x81, 0xC9, - 0x03, 0x6C, 0xCC, 0x8C, 0xC9, 0x03, 0x6C, 0xCC, - 0xA7, 0xA5, 0x03, 0x6C, 0xCC, 0xAD, 0xB5, 0x03, - 0x6C, 0xCC, 0xB1, 0xB5, 0x03, 0x6D, 0xCC, 0x81, - // Bytes 3400 - 343f - 0xC9, 0x03, 0x6D, 0xCC, 0x87, 0xC9, 0x03, 0x6D, - 0xCC, 0xA3, 0xB5, 0x03, 0x6E, 0xCC, 0x80, 0xC9, - 0x03, 0x6E, 0xCC, 0x81, 0xC9, 0x03, 0x6E, 0xCC, - 0x83, 0xC9, 0x03, 0x6E, 0xCC, 0x87, 0xC9, 0x03, - 0x6E, 0xCC, 0x8C, 0xC9, 0x03, 0x6E, 0xCC, 0xA3, - 0xB5, 0x03, 0x6E, 0xCC, 0xA7, 0xA5, 0x03, 0x6E, - 0xCC, 0xAD, 0xB5, 0x03, 0x6E, 0xCC, 0xB1, 0xB5, - 0x03, 0x6F, 0xCC, 0x80, 0xC9, 0x03, 0x6F, 0xCC, - // Bytes 3440 - 347f - 0x81, 0xC9, 0x03, 0x6F, 0xCC, 0x86, 0xC9, 0x03, - 0x6F, 0xCC, 0x89, 0xC9, 0x03, 0x6F, 0xCC, 0x8B, - 0xC9, 0x03, 0x6F, 0xCC, 0x8C, 0xC9, 0x03, 0x6F, - 0xCC, 0x8F, 0xC9, 0x03, 0x6F, 0xCC, 0x91, 0xC9, - 0x03, 0x70, 0xCC, 0x81, 0xC9, 0x03, 0x70, 0xCC, - 0x87, 0xC9, 0x03, 0x72, 0xCC, 0x81, 0xC9, 0x03, - 0x72, 0xCC, 0x87, 0xC9, 0x03, 0x72, 0xCC, 0x8C, - 0xC9, 0x03, 0x72, 0xCC, 0x8F, 0xC9, 0x03, 0x72, - // Bytes 3480 - 34bf - 0xCC, 0x91, 0xC9, 0x03, 0x72, 0xCC, 0xA7, 0xA5, - 0x03, 0x72, 0xCC, 0xB1, 0xB5, 0x03, 0x73, 0xCC, - 0x82, 0xC9, 0x03, 0x73, 0xCC, 0x87, 0xC9, 0x03, - 0x73, 0xCC, 0xA6, 0xB5, 0x03, 0x73, 0xCC, 0xA7, - 0xA5, 0x03, 0x74, 0xCC, 0x87, 0xC9, 0x03, 0x74, - 0xCC, 0x88, 0xC9, 0x03, 0x74, 0xCC, 0x8C, 0xC9, - 0x03, 0x74, 0xCC, 0xA3, 0xB5, 0x03, 0x74, 0xCC, - 0xA6, 0xB5, 0x03, 0x74, 0xCC, 0xA7, 0xA5, 0x03, - // Bytes 34c0 - 34ff - 0x74, 0xCC, 0xAD, 0xB5, 0x03, 0x74, 0xCC, 0xB1, - 0xB5, 0x03, 0x75, 0xCC, 0x80, 0xC9, 0x03, 0x75, - 0xCC, 0x81, 0xC9, 0x03, 0x75, 0xCC, 0x82, 0xC9, - 0x03, 0x75, 0xCC, 0x86, 0xC9, 0x03, 0x75, 0xCC, - 0x89, 0xC9, 0x03, 0x75, 0xCC, 0x8A, 0xC9, 0x03, - 0x75, 0xCC, 0x8B, 0xC9, 0x03, 0x75, 0xCC, 0x8C, - 0xC9, 0x03, 0x75, 0xCC, 0x8F, 0xC9, 0x03, 0x75, - 0xCC, 0x91, 0xC9, 0x03, 0x75, 0xCC, 0xA3, 0xB5, - // Bytes 3500 - 353f - 0x03, 0x75, 0xCC, 0xA4, 0xB5, 0x03, 0x75, 0xCC, - 0xA8, 0xA5, 0x03, 0x75, 0xCC, 0xAD, 0xB5, 0x03, - 0x75, 0xCC, 0xB0, 0xB5, 0x03, 0x76, 0xCC, 0x83, - 0xC9, 0x03, 0x76, 0xCC, 0xA3, 0xB5, 0x03, 0x77, - 0xCC, 0x80, 0xC9, 0x03, 0x77, 0xCC, 0x81, 0xC9, - 0x03, 0x77, 0xCC, 0x82, 0xC9, 0x03, 0x77, 0xCC, - 0x87, 0xC9, 0x03, 0x77, 0xCC, 0x88, 0xC9, 0x03, - 0x77, 0xCC, 0x8A, 0xC9, 0x03, 0x77, 0xCC, 0xA3, - // Bytes 3540 - 357f - 0xB5, 0x03, 0x78, 0xCC, 0x87, 0xC9, 0x03, 0x78, - 0xCC, 0x88, 0xC9, 0x03, 0x79, 0xCC, 0x80, 0xC9, - 0x03, 0x79, 0xCC, 0x81, 0xC9, 0x03, 0x79, 0xCC, - 0x82, 0xC9, 0x03, 0x79, 0xCC, 0x83, 0xC9, 0x03, - 0x79, 0xCC, 0x84, 0xC9, 0x03, 0x79, 0xCC, 0x87, - 0xC9, 0x03, 0x79, 0xCC, 0x88, 0xC9, 0x03, 0x79, - 0xCC, 0x89, 0xC9, 0x03, 0x79, 0xCC, 0x8A, 0xC9, - 0x03, 0x79, 0xCC, 0xA3, 0xB5, 0x03, 0x7A, 0xCC, - // Bytes 3580 - 35bf - 0x81, 0xC9, 0x03, 0x7A, 0xCC, 0x82, 0xC9, 0x03, - 0x7A, 0xCC, 0x87, 0xC9, 0x03, 0x7A, 0xCC, 0x8C, - 0xC9, 0x03, 0x7A, 0xCC, 0xA3, 0xB5, 0x03, 0x7A, - 0xCC, 0xB1, 0xB5, 0x04, 0xC2, 0xA8, 0xCC, 0x80, - 0xCA, 0x04, 0xC2, 0xA8, 0xCC, 0x81, 0xCA, 0x04, - 0xC2, 0xA8, 0xCD, 0x82, 0xCA, 0x04, 0xC3, 0x86, - 0xCC, 0x81, 0xC9, 0x04, 0xC3, 0x86, 0xCC, 0x84, - 0xC9, 0x04, 0xC3, 0x98, 0xCC, 0x81, 0xC9, 0x04, - // Bytes 35c0 - 35ff - 0xC3, 0xA6, 0xCC, 0x81, 0xC9, 0x04, 0xC3, 0xA6, - 0xCC, 0x84, 0xC9, 0x04, 0xC3, 0xB8, 0xCC, 0x81, - 0xC9, 0x04, 0xC5, 0xBF, 0xCC, 0x87, 0xC9, 0x04, - 0xC6, 0xB7, 0xCC, 0x8C, 0xC9, 0x04, 0xCA, 0x92, - 0xCC, 0x8C, 0xC9, 0x04, 0xCE, 0x91, 0xCC, 0x80, - 0xC9, 0x04, 0xCE, 0x91, 0xCC, 0x81, 0xC9, 0x04, - 0xCE, 0x91, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0x91, - 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0x91, 0xCD, 0x85, - // Bytes 3600 - 363f - 0xD9, 0x04, 0xCE, 0x95, 0xCC, 0x80, 0xC9, 0x04, - 0xCE, 0x95, 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0x97, - 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x97, 0xCC, 0x81, - 0xC9, 0x04, 0xCE, 0x97, 0xCD, 0x85, 0xD9, 0x04, - 0xCE, 0x99, 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x99, - 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0x99, 0xCC, 0x84, - 0xC9, 0x04, 0xCE, 0x99, 0xCC, 0x86, 0xC9, 0x04, - 0xCE, 0x99, 0xCC, 0x88, 0xC9, 0x04, 0xCE, 0x9F, - // Bytes 3640 - 367f - 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x9F, 0xCC, 0x81, - 0xC9, 0x04, 0xCE, 0xA1, 0xCC, 0x94, 0xC9, 0x04, - 0xCE, 0xA5, 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0xA5, - 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0xA5, 0xCC, 0x84, - 0xC9, 0x04, 0xCE, 0xA5, 0xCC, 0x86, 0xC9, 0x04, - 0xCE, 0xA5, 0xCC, 0x88, 0xC9, 0x04, 0xCE, 0xA9, - 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0xA9, 0xCC, 0x81, - 0xC9, 0x04, 0xCE, 0xA9, 0xCD, 0x85, 0xD9, 0x04, - // Bytes 3680 - 36bf - 0xCE, 0xB1, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0xB1, - 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0xB1, 0xCD, 0x85, - 0xD9, 0x04, 0xCE, 0xB5, 0xCC, 0x80, 0xC9, 0x04, - 0xCE, 0xB5, 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0xB7, - 0xCD, 0x85, 0xD9, 0x04, 0xCE, 0xB9, 0xCC, 0x80, - 0xC9, 0x04, 0xCE, 0xB9, 0xCC, 0x81, 0xC9, 0x04, - 0xCE, 0xB9, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0xB9, - 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0xB9, 0xCD, 0x82, - // Bytes 36c0 - 36ff - 0xC9, 0x04, 0xCE, 0xBF, 0xCC, 0x80, 0xC9, 0x04, - 0xCE, 0xBF, 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x81, - 0xCC, 0x93, 0xC9, 0x04, 0xCF, 0x81, 0xCC, 0x94, - 0xC9, 0x04, 0xCF, 0x85, 0xCC, 0x80, 0xC9, 0x04, - 0xCF, 0x85, 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x85, - 0xCC, 0x84, 0xC9, 0x04, 0xCF, 0x85, 0xCC, 0x86, - 0xC9, 0x04, 0xCF, 0x85, 0xCD, 0x82, 0xC9, 0x04, - 0xCF, 0x89, 0xCD, 0x85, 0xD9, 0x04, 0xCF, 0x92, - // Bytes 3700 - 373f - 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x92, 0xCC, 0x88, - 0xC9, 0x04, 0xD0, 0x86, 0xCC, 0x88, 0xC9, 0x04, - 0xD0, 0x90, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0x90, - 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x93, 0xCC, 0x81, - 0xC9, 0x04, 0xD0, 0x95, 0xCC, 0x80, 0xC9, 0x04, - 0xD0, 0x95, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0x95, - 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x96, 0xCC, 0x86, - 0xC9, 0x04, 0xD0, 0x96, 0xCC, 0x88, 0xC9, 0x04, - // Bytes 3740 - 377f - 0xD0, 0x97, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x98, - 0xCC, 0x80, 0xC9, 0x04, 0xD0, 0x98, 0xCC, 0x84, - 0xC9, 0x04, 0xD0, 0x98, 0xCC, 0x86, 0xC9, 0x04, - 0xD0, 0x98, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x9A, - 0xCC, 0x81, 0xC9, 0x04, 0xD0, 0x9E, 0xCC, 0x88, - 0xC9, 0x04, 0xD0, 0xA3, 0xCC, 0x84, 0xC9, 0x04, - 0xD0, 0xA3, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xA3, - 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xA3, 0xCC, 0x8B, - // Bytes 3780 - 37bf - 0xC9, 0x04, 0xD0, 0xA7, 0xCC, 0x88, 0xC9, 0x04, - 0xD0, 0xAB, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xAD, - 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xB0, 0xCC, 0x86, - 0xC9, 0x04, 0xD0, 0xB0, 0xCC, 0x88, 0xC9, 0x04, - 0xD0, 0xB3, 0xCC, 0x81, 0xC9, 0x04, 0xD0, 0xB5, - 0xCC, 0x80, 0xC9, 0x04, 0xD0, 0xB5, 0xCC, 0x86, - 0xC9, 0x04, 0xD0, 0xB5, 0xCC, 0x88, 0xC9, 0x04, - 0xD0, 0xB6, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xB6, - // Bytes 37c0 - 37ff - 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xB7, 0xCC, 0x88, - 0xC9, 0x04, 0xD0, 0xB8, 0xCC, 0x80, 0xC9, 0x04, - 0xD0, 0xB8, 0xCC, 0x84, 0xC9, 0x04, 0xD0, 0xB8, - 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xB8, 0xCC, 0x88, - 0xC9, 0x04, 0xD0, 0xBA, 0xCC, 0x81, 0xC9, 0x04, - 0xD0, 0xBE, 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0x83, - 0xCC, 0x84, 0xC9, 0x04, 0xD1, 0x83, 0xCC, 0x86, - 0xC9, 0x04, 0xD1, 0x83, 0xCC, 0x88, 0xC9, 0x04, - // Bytes 3800 - 383f - 0xD1, 0x83, 0xCC, 0x8B, 0xC9, 0x04, 0xD1, 0x87, - 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0x8B, 0xCC, 0x88, - 0xC9, 0x04, 0xD1, 0x8D, 0xCC, 0x88, 0xC9, 0x04, - 0xD1, 0x96, 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0xB4, - 0xCC, 0x8F, 0xC9, 0x04, 0xD1, 0xB5, 0xCC, 0x8F, - 0xC9, 0x04, 0xD3, 0x98, 0xCC, 0x88, 0xC9, 0x04, - 0xD3, 0x99, 0xCC, 0x88, 0xC9, 0x04, 0xD3, 0xA8, - 0xCC, 0x88, 0xC9, 0x04, 0xD3, 0xA9, 0xCC, 0x88, - // Bytes 3840 - 387f - 0xC9, 0x04, 0xD8, 0xA7, 0xD9, 0x93, 0xC9, 0x04, - 0xD8, 0xA7, 0xD9, 0x94, 0xC9, 0x04, 0xD8, 0xA7, - 0xD9, 0x95, 0xB5, 0x04, 0xD9, 0x88, 0xD9, 0x94, - 0xC9, 0x04, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, 0x04, - 0xDB, 0x81, 0xD9, 0x94, 0xC9, 0x04, 0xDB, 0x92, - 0xD9, 0x94, 0xC9, 0x04, 0xDB, 0x95, 0xD9, 0x94, - 0xC9, 0x05, 0x41, 0xCC, 0x82, 0xCC, 0x80, 0xCA, - 0x05, 0x41, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, - // Bytes 3880 - 38bf - 0x41, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x41, - 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x41, 0xCC, - 0x86, 0xCC, 0x80, 0xCA, 0x05, 0x41, 0xCC, 0x86, - 0xCC, 0x81, 0xCA, 0x05, 0x41, 0xCC, 0x86, 0xCC, - 0x83, 0xCA, 0x05, 0x41, 0xCC, 0x86, 0xCC, 0x89, - 0xCA, 0x05, 0x41, 0xCC, 0x87, 0xCC, 0x84, 0xCA, - 0x05, 0x41, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, - 0x41, 0xCC, 0x8A, 0xCC, 0x81, 0xCA, 0x05, 0x41, - // Bytes 38c0 - 38ff - 0xCC, 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x41, 0xCC, - 0xA3, 0xCC, 0x86, 0xCA, 0x05, 0x43, 0xCC, 0xA7, - 0xCC, 0x81, 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, - 0x80, 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x81, - 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x83, 0xCA, - 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, - 0x45, 0xCC, 0x84, 0xCC, 0x80, 0xCA, 0x05, 0x45, - 0xCC, 0x84, 0xCC, 0x81, 0xCA, 0x05, 0x45, 0xCC, - // Bytes 3900 - 393f - 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x45, 0xCC, 0xA7, - 0xCC, 0x86, 0xCA, 0x05, 0x49, 0xCC, 0x88, 0xCC, - 0x81, 0xCA, 0x05, 0x4C, 0xCC, 0xA3, 0xCC, 0x84, - 0xCA, 0x05, 0x4F, 0xCC, 0x82, 0xCC, 0x80, 0xCA, - 0x05, 0x4F, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, - 0x4F, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x4F, - 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x4F, 0xCC, - 0x83, 0xCC, 0x81, 0xCA, 0x05, 0x4F, 0xCC, 0x83, - // Bytes 3940 - 397f - 0xCC, 0x84, 0xCA, 0x05, 0x4F, 0xCC, 0x83, 0xCC, - 0x88, 0xCA, 0x05, 0x4F, 0xCC, 0x84, 0xCC, 0x80, - 0xCA, 0x05, 0x4F, 0xCC, 0x84, 0xCC, 0x81, 0xCA, - 0x05, 0x4F, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, - 0x4F, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x4F, - 0xCC, 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x4F, 0xCC, - 0x9B, 0xCC, 0x81, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, - 0xCC, 0x83, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, 0xCC, - // Bytes 3980 - 39bf - 0x89, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, 0xCC, 0xA3, - 0xB6, 0x05, 0x4F, 0xCC, 0xA3, 0xCC, 0x82, 0xCA, - 0x05, 0x4F, 0xCC, 0xA8, 0xCC, 0x84, 0xCA, 0x05, - 0x52, 0xCC, 0xA3, 0xCC, 0x84, 0xCA, 0x05, 0x53, - 0xCC, 0x81, 0xCC, 0x87, 0xCA, 0x05, 0x53, 0xCC, - 0x8C, 0xCC, 0x87, 0xCA, 0x05, 0x53, 0xCC, 0xA3, - 0xCC, 0x87, 0xCA, 0x05, 0x55, 0xCC, 0x83, 0xCC, - 0x81, 0xCA, 0x05, 0x55, 0xCC, 0x84, 0xCC, 0x88, - // Bytes 39c0 - 39ff - 0xCA, 0x05, 0x55, 0xCC, 0x88, 0xCC, 0x80, 0xCA, - 0x05, 0x55, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x05, - 0x55, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x55, - 0xCC, 0x88, 0xCC, 0x8C, 0xCA, 0x05, 0x55, 0xCC, - 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x55, 0xCC, 0x9B, - 0xCC, 0x81, 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, - 0x83, 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, 0x89, - 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, - // Bytes 3a00 - 3a3f - 0x05, 0x61, 0xCC, 0x82, 0xCC, 0x80, 0xCA, 0x05, - 0x61, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, 0x61, - 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x61, 0xCC, - 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x61, 0xCC, 0x86, - 0xCC, 0x80, 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, - 0x81, 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, 0x83, - 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, 0x89, 0xCA, - 0x05, 0x61, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, - // Bytes 3a40 - 3a7f - 0x61, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x61, - 0xCC, 0x8A, 0xCC, 0x81, 0xCA, 0x05, 0x61, 0xCC, - 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x61, 0xCC, 0xA3, - 0xCC, 0x86, 0xCA, 0x05, 0x63, 0xCC, 0xA7, 0xCC, - 0x81, 0xCA, 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x80, - 0xCA, 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x81, 0xCA, - 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, - 0x65, 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x65, - // Bytes 3a80 - 3abf - 0xCC, 0x84, 0xCC, 0x80, 0xCA, 0x05, 0x65, 0xCC, - 0x84, 0xCC, 0x81, 0xCA, 0x05, 0x65, 0xCC, 0xA3, - 0xCC, 0x82, 0xCA, 0x05, 0x65, 0xCC, 0xA7, 0xCC, - 0x86, 0xCA, 0x05, 0x69, 0xCC, 0x88, 0xCC, 0x81, - 0xCA, 0x05, 0x6C, 0xCC, 0xA3, 0xCC, 0x84, 0xCA, - 0x05, 0x6F, 0xCC, 0x82, 0xCC, 0x80, 0xCA, 0x05, - 0x6F, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, 0x6F, - 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x6F, 0xCC, - // Bytes 3ac0 - 3aff - 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x6F, 0xCC, 0x83, - 0xCC, 0x81, 0xCA, 0x05, 0x6F, 0xCC, 0x83, 0xCC, - 0x84, 0xCA, 0x05, 0x6F, 0xCC, 0x83, 0xCC, 0x88, - 0xCA, 0x05, 0x6F, 0xCC, 0x84, 0xCC, 0x80, 0xCA, - 0x05, 0x6F, 0xCC, 0x84, 0xCC, 0x81, 0xCA, 0x05, - 0x6F, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, 0x6F, - 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x6F, 0xCC, - 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, - // Bytes 3b00 - 3b3f - 0xCC, 0x81, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, - 0x83, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, 0x89, - 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, - 0x05, 0x6F, 0xCC, 0xA3, 0xCC, 0x82, 0xCA, 0x05, - 0x6F, 0xCC, 0xA8, 0xCC, 0x84, 0xCA, 0x05, 0x72, - 0xCC, 0xA3, 0xCC, 0x84, 0xCA, 0x05, 0x73, 0xCC, - 0x81, 0xCC, 0x87, 0xCA, 0x05, 0x73, 0xCC, 0x8C, - 0xCC, 0x87, 0xCA, 0x05, 0x73, 0xCC, 0xA3, 0xCC, - // Bytes 3b40 - 3b7f - 0x87, 0xCA, 0x05, 0x75, 0xCC, 0x83, 0xCC, 0x81, - 0xCA, 0x05, 0x75, 0xCC, 0x84, 0xCC, 0x88, 0xCA, - 0x05, 0x75, 0xCC, 0x88, 0xCC, 0x80, 0xCA, 0x05, - 0x75, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x05, 0x75, - 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x75, 0xCC, - 0x88, 0xCC, 0x8C, 0xCA, 0x05, 0x75, 0xCC, 0x9B, - 0xCC, 0x80, 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, - 0x81, 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0x83, - // Bytes 3b80 - 3bbf - 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0x89, 0xCA, - 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, 0x05, - 0xE1, 0xBE, 0xBF, 0xCC, 0x80, 0xCA, 0x05, 0xE1, - 0xBE, 0xBF, 0xCC, 0x81, 0xCA, 0x05, 0xE1, 0xBE, - 0xBF, 0xCD, 0x82, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, - 0xCC, 0x80, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, 0xCC, - 0x81, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, 0xCD, 0x82, - 0xCA, 0x05, 0xE2, 0x86, 0x90, 0xCC, 0xB8, 0x05, - // Bytes 3bc0 - 3bff - 0x05, 0xE2, 0x86, 0x92, 0xCC, 0xB8, 0x05, 0x05, - 0xE2, 0x86, 0x94, 0xCC, 0xB8, 0x05, 0x05, 0xE2, - 0x87, 0x90, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x87, - 0x92, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x87, 0x94, - 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x88, 0x83, 0xCC, - 0xB8, 0x05, 0x05, 0xE2, 0x88, 0x88, 0xCC, 0xB8, - 0x05, 0x05, 0xE2, 0x88, 0x8B, 0xCC, 0xB8, 0x05, - 0x05, 0xE2, 0x88, 0xA3, 0xCC, 0xB8, 0x05, 0x05, - // Bytes 3c00 - 3c3f - 0xE2, 0x88, 0xA5, 0xCC, 0xB8, 0x05, 0x05, 0xE2, - 0x88, 0xBC, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, - 0x83, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x85, - 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x88, 0xCC, - 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x8D, 0xCC, 0xB8, - 0x05, 0x05, 0xE2, 0x89, 0xA1, 0xCC, 0xB8, 0x05, - 0x05, 0xE2, 0x89, 0xA4, 0xCC, 0xB8, 0x05, 0x05, - 0xE2, 0x89, 0xA5, 0xCC, 0xB8, 0x05, 0x05, 0xE2, - // Bytes 3c40 - 3c7f - 0x89, 0xB2, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, - 0xB3, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xB6, - 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xB7, 0xCC, - 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xBA, 0xCC, 0xB8, - 0x05, 0x05, 0xE2, 0x89, 0xBB, 0xCC, 0xB8, 0x05, - 0x05, 0xE2, 0x89, 0xBC, 0xCC, 0xB8, 0x05, 0x05, - 0xE2, 0x89, 0xBD, 0xCC, 0xB8, 0x05, 0x05, 0xE2, - 0x8A, 0x82, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, - // Bytes 3c80 - 3cbf - 0x83, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x86, - 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x87, 0xCC, - 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x91, 0xCC, 0xB8, - 0x05, 0x05, 0xE2, 0x8A, 0x92, 0xCC, 0xB8, 0x05, - 0x05, 0xE2, 0x8A, 0xA2, 0xCC, 0xB8, 0x05, 0x05, - 0xE2, 0x8A, 0xA8, 0xCC, 0xB8, 0x05, 0x05, 0xE2, - 0x8A, 0xA9, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, - 0xAB, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB2, - // Bytes 3cc0 - 3cff - 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB3, 0xCC, - 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB4, 0xCC, 0xB8, - 0x05, 0x05, 0xE2, 0x8A, 0xB5, 0xCC, 0xB8, 0x05, - 0x06, 0xCE, 0x91, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0x91, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0x95, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0x95, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0x95, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - // Bytes 3d00 - 3d3f - 0x06, 0xCE, 0x95, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0x97, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0x97, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCD, 0x82, 0xCA, - 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - // Bytes 3d40 - 3d7f - 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCD, 0x82, 0xCA, - 0x06, 0xCE, 0x9F, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0x9F, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0x9F, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0x9F, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCD, 0x82, 0xCA, - // Bytes 3d80 - 3dbf - 0x06, 0xCE, 0xA9, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xA9, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB1, 0xCC, 0x80, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB1, 0xCC, 0x81, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB1, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB1, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB1, 0xCD, 0x82, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB5, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - // Bytes 3dc0 - 3dff - 0x06, 0xCE, 0xB5, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xB5, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xB5, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xB7, 0xCC, 0x80, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB7, 0xCC, 0x81, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB7, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB7, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCE, 0xB7, 0xCD, 0x82, 0xCD, 0x85, 0xDA, - // Bytes 3e00 - 3e3f - 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCD, 0x82, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCD, 0x82, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - // Bytes 3e40 - 3e7f - 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCD, 0x82, 0xCA, - 0x06, 0xCE, 0xBF, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xBF, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCE, 0xBF, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCE, 0xBF, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCC, 0x80, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCC, 0x81, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCD, 0x82, 0xCA, - // Bytes 3e80 - 3ebf - 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCC, 0x81, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCD, 0x82, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCC, 0x80, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCC, 0x81, 0xCA, - 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCD, 0x82, 0xCA, - 0x06, 0xCF, 0x89, 0xCC, 0x80, 0xCD, 0x85, 0xDA, - 0x06, 0xCF, 0x89, 0xCC, 0x81, 0xCD, 0x85, 0xDA, - // Bytes 3ec0 - 3eff - 0x06, 0xCF, 0x89, 0xCC, 0x93, 0xCD, 0x85, 0xDA, - 0x06, 0xCF, 0x89, 0xCC, 0x94, 0xCD, 0x85, 0xDA, - 0x06, 0xCF, 0x89, 0xCD, 0x82, 0xCD, 0x85, 0xDA, - 0x06, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBC, 0x09, - 0x06, 0xE0, 0xA4, 0xB0, 0xE0, 0xA4, 0xBC, 0x09, - 0x06, 0xE0, 0xA4, 0xB3, 0xE0, 0xA4, 0xBC, 0x09, - 0x06, 0xE0, 0xB1, 0x86, 0xE0, 0xB1, 0x96, 0x85, - 0x06, 0xE0, 0xB7, 0x99, 0xE0, 0xB7, 0x8A, 0x11, - // Bytes 3f00 - 3f3f - 0x06, 0xE3, 0x81, 0x86, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x8B, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x8D, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x8F, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x91, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x93, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x95, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x97, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 3f40 - 3f7f - 0x06, 0xE3, 0x81, 0x99, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x9B, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x9D, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0x9F, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xA1, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xA4, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xA6, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xA8, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 3f80 - 3fbf - 0x06, 0xE3, 0x81, 0xAF, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xAF, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x81, 0xB2, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xB2, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x81, 0xB5, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xB5, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x81, 0xB8, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xB8, 0xE3, 0x82, 0x9A, 0x0D, - // Bytes 3fc0 - 3fff - 0x06, 0xE3, 0x81, 0xBB, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x81, 0xBB, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x82, 0x9D, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xA6, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xAD, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xB1, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 4000 - 403f - 0x06, 0xE3, 0x82, 0xB3, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xB5, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xB7, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xB9, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xBB, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xBD, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x81, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 4040 - 407f - 0x06, 0xE3, 0x83, 0x84, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x86, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x83, 0x95, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 4080 - 40bf - 0x06, 0xE3, 0x83, 0x95, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x9A, 0x0D, - 0x06, 0xE3, 0x83, 0xAF, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0xB0, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0xB1, 0xE3, 0x82, 0x99, 0x0D, - // Bytes 40c0 - 40ff - 0x06, 0xE3, 0x83, 0xB2, 0xE3, 0x82, 0x99, 0x0D, - 0x06, 0xE3, 0x83, 0xBD, 0xE3, 0x82, 0x99, 0x0D, - 0x08, 0xCE, 0x91, 0xCC, 0x93, 0xCC, 0x80, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, 0x93, 0xCC, - 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, - 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0x91, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0x91, 0xCC, 0x94, 0xCC, 0x81, 0xCD, - // Bytes 4100 - 413f - 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, 0x94, 0xCD, - 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, - 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0x97, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0x97, 0xCC, 0x93, 0xCD, 0x82, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, 0x94, 0xCC, - 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, - 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - // Bytes 4140 - 417f - 0x97, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0xA9, 0xCC, 0x93, 0xCC, 0x80, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, 0x93, 0xCC, - 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, - 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0xA9, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0xA9, 0xCC, 0x94, 0xCC, 0x81, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, 0x94, 0xCD, - // Bytes 4180 - 41bf - 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, - 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0xB1, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0xB1, 0xCC, 0x93, 0xCD, 0x82, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, 0x94, 0xCC, - 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, - 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0xB1, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, - // Bytes 41c0 - 41ff - 0x08, 0xCE, 0xB7, 0xCC, 0x93, 0xCC, 0x80, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, 0x93, 0xCC, - 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, - 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, - 0xB7, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, - 0x08, 0xCE, 0xB7, 0xCC, 0x94, 0xCC, 0x81, 0xCD, - 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, 0x94, 0xCD, - 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, - // Bytes 4200 - 423f - 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCF, - 0x89, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, - 0x08, 0xCF, 0x89, 0xCC, 0x93, 0xCD, 0x82, 0xCD, - 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, 0x94, 0xCC, - 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, - 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCF, - 0x89, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, - 0x08, 0xF0, 0x91, 0x82, 0x99, 0xF0, 0x91, 0x82, - // Bytes 4240 - 427f - 0xBA, 0x09, 0x08, 0xF0, 0x91, 0x82, 0x9B, 0xF0, - 0x91, 0x82, 0xBA, 0x09, 0x08, 0xF0, 0x91, 0x82, - 0xA5, 0xF0, 0x91, 0x82, 0xBA, 0x09, 0x42, 0xC2, - 0xB4, 0x01, 0x43, 0x20, 0xCC, 0x81, 0xC9, 0x43, - 0x20, 0xCC, 0x83, 0xC9, 0x43, 0x20, 0xCC, 0x84, - 0xC9, 0x43, 0x20, 0xCC, 0x85, 0xC9, 0x43, 0x20, - 0xCC, 0x86, 0xC9, 0x43, 0x20, 0xCC, 0x87, 0xC9, - 0x43, 0x20, 0xCC, 0x88, 0xC9, 0x43, 0x20, 0xCC, - // Bytes 4280 - 42bf - 0x8A, 0xC9, 0x43, 0x20, 0xCC, 0x8B, 0xC9, 0x43, - 0x20, 0xCC, 0x93, 0xC9, 0x43, 0x20, 0xCC, 0x94, - 0xC9, 0x43, 0x20, 0xCC, 0xA7, 0xA5, 0x43, 0x20, - 0xCC, 0xA8, 0xA5, 0x43, 0x20, 0xCC, 0xB3, 0xB5, - 0x43, 0x20, 0xCD, 0x82, 0xC9, 0x43, 0x20, 0xCD, - 0x85, 0xD9, 0x43, 0x20, 0xD9, 0x8B, 0x59, 0x43, - 0x20, 0xD9, 0x8C, 0x5D, 0x43, 0x20, 0xD9, 0x8D, - 0x61, 0x43, 0x20, 0xD9, 0x8E, 0x65, 0x43, 0x20, - // Bytes 42c0 - 42ff - 0xD9, 0x8F, 0x69, 0x43, 0x20, 0xD9, 0x90, 0x6D, - 0x43, 0x20, 0xD9, 0x91, 0x71, 0x43, 0x20, 0xD9, - 0x92, 0x75, 0x43, 0x41, 0xCC, 0x8A, 0xC9, 0x43, - 0x73, 0xCC, 0x87, 0xC9, 0x44, 0x20, 0xE3, 0x82, - 0x99, 0x0D, 0x44, 0x20, 0xE3, 0x82, 0x9A, 0x0D, - 0x44, 0xC2, 0xA8, 0xCC, 0x81, 0xCA, 0x44, 0xCE, - 0x91, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0x95, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0x97, 0xCC, 0x81, 0xC9, - // Bytes 4300 - 433f - 0x44, 0xCE, 0x99, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0x9F, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, 0x88, 0xC9, - 0x44, 0xCE, 0xA9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0xB1, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xB5, 0xCC, - 0x81, 0xC9, 0x44, 0xCE, 0xB7, 0xCC, 0x81, 0xC9, - 0x44, 0xCE, 0xB9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, - 0xBF, 0xCC, 0x81, 0xC9, 0x44, 0xCF, 0x85, 0xCC, - // Bytes 4340 - 437f - 0x81, 0xC9, 0x44, 0xCF, 0x89, 0xCC, 0x81, 0xC9, - 0x44, 0xD7, 0x90, 0xD6, 0xB7, 0x31, 0x44, 0xD7, - 0x90, 0xD6, 0xB8, 0x35, 0x44, 0xD7, 0x90, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x91, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x91, 0xD6, 0xBF, 0x49, 0x44, 0xD7, - 0x92, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x93, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x94, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x95, 0xD6, 0xB9, 0x39, 0x44, 0xD7, - // Bytes 4380 - 43bf - 0x95, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x96, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x98, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x99, 0xD6, 0xB4, 0x25, 0x44, 0xD7, - 0x99, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9A, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0x9B, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0x9B, 0xD6, 0xBF, 0x49, 0x44, 0xD7, - 0x9C, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9E, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0xA0, 0xD6, 0xBC, 0x41, - // Bytes 43c0 - 43ff - 0x44, 0xD7, 0xA1, 0xD6, 0xBC, 0x41, 0x44, 0xD7, - 0xA3, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA4, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0xA4, 0xD6, 0xBF, 0x49, - 0x44, 0xD7, 0xA6, 0xD6, 0xBC, 0x41, 0x44, 0xD7, - 0xA7, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA8, 0xD6, - 0xBC, 0x41, 0x44, 0xD7, 0xA9, 0xD6, 0xBC, 0x41, - 0x44, 0xD7, 0xA9, 0xD7, 0x81, 0x4D, 0x44, 0xD7, - 0xA9, 0xD7, 0x82, 0x51, 0x44, 0xD7, 0xAA, 0xD6, - // Bytes 4400 - 443f - 0xBC, 0x41, 0x44, 0xD7, 0xB2, 0xD6, 0xB7, 0x31, - 0x44, 0xD8, 0xA7, 0xD9, 0x8B, 0x59, 0x44, 0xD8, - 0xA7, 0xD9, 0x93, 0xC9, 0x44, 0xD8, 0xA7, 0xD9, - 0x94, 0xC9, 0x44, 0xD8, 0xA7, 0xD9, 0x95, 0xB5, - 0x44, 0xD8, 0xB0, 0xD9, 0xB0, 0x79, 0x44, 0xD8, - 0xB1, 0xD9, 0xB0, 0x79, 0x44, 0xD9, 0x80, 0xD9, - 0x8B, 0x59, 0x44, 0xD9, 0x80, 0xD9, 0x8E, 0x65, - 0x44, 0xD9, 0x80, 0xD9, 0x8F, 0x69, 0x44, 0xD9, - // Bytes 4440 - 447f - 0x80, 0xD9, 0x90, 0x6D, 0x44, 0xD9, 0x80, 0xD9, - 0x91, 0x71, 0x44, 0xD9, 0x80, 0xD9, 0x92, 0x75, - 0x44, 0xD9, 0x87, 0xD9, 0xB0, 0x79, 0x44, 0xD9, - 0x88, 0xD9, 0x94, 0xC9, 0x44, 0xD9, 0x89, 0xD9, - 0xB0, 0x79, 0x44, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, - 0x44, 0xDB, 0x92, 0xD9, 0x94, 0xC9, 0x44, 0xDB, - 0x95, 0xD9, 0x94, 0xC9, 0x45, 0x20, 0xCC, 0x88, - 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCC, - // Bytes 4480 - 44bf - 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCD, 0x82, - 0xCA, 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x80, 0xCA, - 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x45, - 0x20, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x45, 0x20, - 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, - 0x94, 0xCC, 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x94, - 0xCD, 0x82, 0xCA, 0x45, 0x20, 0xD9, 0x8C, 0xD9, - 0x91, 0x72, 0x45, 0x20, 0xD9, 0x8D, 0xD9, 0x91, - // Bytes 44c0 - 44ff - 0x72, 0x45, 0x20, 0xD9, 0x8E, 0xD9, 0x91, 0x72, - 0x45, 0x20, 0xD9, 0x8F, 0xD9, 0x91, 0x72, 0x45, - 0x20, 0xD9, 0x90, 0xD9, 0x91, 0x72, 0x45, 0x20, - 0xD9, 0x91, 0xD9, 0xB0, 0x7A, 0x45, 0xE2, 0xAB, - 0x9D, 0xCC, 0xB8, 0x05, 0x46, 0xCE, 0xB9, 0xCC, - 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xCF, 0x85, 0xCC, - 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xD7, 0xA9, 0xD6, - 0xBC, 0xD7, 0x81, 0x4E, 0x46, 0xD7, 0xA9, 0xD6, - // Bytes 4500 - 453f - 0xBC, 0xD7, 0x82, 0x52, 0x46, 0xD9, 0x80, 0xD9, - 0x8E, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, - 0x8F, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, - 0x90, 0xD9, 0x91, 0x72, 0x46, 0xE0, 0xA4, 0x95, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x96, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x97, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x9C, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA1, - // Bytes 4540 - 457f - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA2, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAB, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAF, - 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA1, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA2, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xAF, - 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x96, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x97, - // Bytes 4580 - 45bf - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x9C, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xAB, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xB2, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xB8, - 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xAC, 0xA1, - 0xE0, 0xAC, 0xBC, 0x09, 0x46, 0xE0, 0xAC, 0xA2, - 0xE0, 0xAC, 0xBC, 0x09, 0x46, 0xE0, 0xBE, 0xB2, - 0xE0, 0xBE, 0x80, 0x9D, 0x46, 0xE0, 0xBE, 0xB3, - // Bytes 45c0 - 45ff - 0xE0, 0xBE, 0x80, 0x9D, 0x46, 0xE3, 0x83, 0x86, - 0xE3, 0x82, 0x99, 0x0D, 0x48, 0xF0, 0x9D, 0x85, - 0x97, 0xF0, 0x9D, 0x85, 0xA5, 0xAD, 0x48, 0xF0, - 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xAD, - 0x48, 0xF0, 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, - 0xA5, 0xAD, 0x48, 0xF0, 0x9D, 0x86, 0xBA, 0xF0, - 0x9D, 0x85, 0xA5, 0xAD, 0x49, 0xE0, 0xBE, 0xB2, - 0xE0, 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, 0x49, - // Bytes 4600 - 463f - 0xE0, 0xBE, 0xB3, 0xE0, 0xBD, 0xB1, 0xE0, 0xBE, - 0x80, 0x9E, 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, - 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xAE, 0xAE, - 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, - 0xA5, 0xF0, 0x9D, 0x85, 0xAF, 0xAE, 0x4C, 0xF0, - 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, - 0x9D, 0x85, 0xB0, 0xAE, 0x4C, 0xF0, 0x9D, 0x85, - 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, - // Bytes 4640 - 467f - 0xB1, 0xAE, 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, - 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xB2, 0xAE, - 0x4C, 0xF0, 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, - 0xA5, 0xF0, 0x9D, 0x85, 0xAE, 0xAE, 0x4C, 0xF0, - 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, - 0x9D, 0x85, 0xAF, 0xAE, 0x4C, 0xF0, 0x9D, 0x86, - 0xBA, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, - 0xAE, 0xAE, 0x4C, 0xF0, 0x9D, 0x86, 0xBA, 0xF0, - // Bytes 4680 - 46bf - 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xAF, 0xAE, - 0x83, 0x41, 0xCC, 0x82, 0xC9, 0x83, 0x41, 0xCC, - 0x86, 0xC9, 0x83, 0x41, 0xCC, 0x87, 0xC9, 0x83, - 0x41, 0xCC, 0x88, 0xC9, 0x83, 0x41, 0xCC, 0x8A, - 0xC9, 0x83, 0x41, 0xCC, 0xA3, 0xB5, 0x83, 0x43, - 0xCC, 0xA7, 0xA5, 0x83, 0x45, 0xCC, 0x82, 0xC9, - 0x83, 0x45, 0xCC, 0x84, 0xC9, 0x83, 0x45, 0xCC, - 0xA3, 0xB5, 0x83, 0x45, 0xCC, 0xA7, 0xA5, 0x83, - // Bytes 46c0 - 46ff - 0x49, 0xCC, 0x88, 0xC9, 0x83, 0x4C, 0xCC, 0xA3, - 0xB5, 0x83, 0x4F, 0xCC, 0x82, 0xC9, 0x83, 0x4F, - 0xCC, 0x83, 0xC9, 0x83, 0x4F, 0xCC, 0x84, 0xC9, - 0x83, 0x4F, 0xCC, 0x87, 0xC9, 0x83, 0x4F, 0xCC, - 0x88, 0xC9, 0x83, 0x4F, 0xCC, 0x9B, 0xAD, 0x83, - 0x4F, 0xCC, 0xA3, 0xB5, 0x83, 0x4F, 0xCC, 0xA8, - 0xA5, 0x83, 0x52, 0xCC, 0xA3, 0xB5, 0x83, 0x53, - 0xCC, 0x81, 0xC9, 0x83, 0x53, 0xCC, 0x8C, 0xC9, - // Bytes 4700 - 473f - 0x83, 0x53, 0xCC, 0xA3, 0xB5, 0x83, 0x55, 0xCC, - 0x83, 0xC9, 0x83, 0x55, 0xCC, 0x84, 0xC9, 0x83, - 0x55, 0xCC, 0x88, 0xC9, 0x83, 0x55, 0xCC, 0x9B, - 0xAD, 0x83, 0x61, 0xCC, 0x82, 0xC9, 0x83, 0x61, - 0xCC, 0x86, 0xC9, 0x83, 0x61, 0xCC, 0x87, 0xC9, - 0x83, 0x61, 0xCC, 0x88, 0xC9, 0x83, 0x61, 0xCC, - 0x8A, 0xC9, 0x83, 0x61, 0xCC, 0xA3, 0xB5, 0x83, - 0x63, 0xCC, 0xA7, 0xA5, 0x83, 0x65, 0xCC, 0x82, - // Bytes 4740 - 477f - 0xC9, 0x83, 0x65, 0xCC, 0x84, 0xC9, 0x83, 0x65, - 0xCC, 0xA3, 0xB5, 0x83, 0x65, 0xCC, 0xA7, 0xA5, - 0x83, 0x69, 0xCC, 0x88, 0xC9, 0x83, 0x6C, 0xCC, - 0xA3, 0xB5, 0x83, 0x6F, 0xCC, 0x82, 0xC9, 0x83, - 0x6F, 0xCC, 0x83, 0xC9, 0x83, 0x6F, 0xCC, 0x84, - 0xC9, 0x83, 0x6F, 0xCC, 0x87, 0xC9, 0x83, 0x6F, - 0xCC, 0x88, 0xC9, 0x83, 0x6F, 0xCC, 0x9B, 0xAD, - 0x83, 0x6F, 0xCC, 0xA3, 0xB5, 0x83, 0x6F, 0xCC, - // Bytes 4780 - 47bf - 0xA8, 0xA5, 0x83, 0x72, 0xCC, 0xA3, 0xB5, 0x83, - 0x73, 0xCC, 0x81, 0xC9, 0x83, 0x73, 0xCC, 0x8C, - 0xC9, 0x83, 0x73, 0xCC, 0xA3, 0xB5, 0x83, 0x75, - 0xCC, 0x83, 0xC9, 0x83, 0x75, 0xCC, 0x84, 0xC9, - 0x83, 0x75, 0xCC, 0x88, 0xC9, 0x83, 0x75, 0xCC, - 0x9B, 0xAD, 0x84, 0xCE, 0x91, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x91, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0x95, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x95, 0xCC, - // Bytes 47c0 - 47ff - 0x94, 0xC9, 0x84, 0xCE, 0x97, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x97, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0x99, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x99, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0x9F, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0x9F, 0xCC, 0x94, 0xC9, 0x84, 0xCE, - 0xA5, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, - 0x93, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, 0x94, 0xC9, - 0x84, 0xCE, 0xB1, 0xCC, 0x80, 0xC9, 0x84, 0xCE, - // Bytes 4800 - 483f - 0xB1, 0xCC, 0x81, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, - 0x93, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, 0x94, 0xC9, - 0x84, 0xCE, 0xB1, 0xCD, 0x82, 0xC9, 0x84, 0xCE, - 0xB5, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB5, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, 0x80, 0xC9, - 0x84, 0xCE, 0xB7, 0xCC, 0x81, 0xC9, 0x84, 0xCE, - 0xB7, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0xB7, 0xCD, 0x82, 0xC9, - // Bytes 4840 - 487f - 0x84, 0xCE, 0xB9, 0xCC, 0x88, 0xC9, 0x84, 0xCE, - 0xB9, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB9, 0xCC, - 0x94, 0xC9, 0x84, 0xCE, 0xBF, 0xCC, 0x93, 0xC9, - 0x84, 0xCE, 0xBF, 0xCC, 0x94, 0xC9, 0x84, 0xCF, - 0x85, 0xCC, 0x88, 0xC9, 0x84, 0xCF, 0x85, 0xCC, - 0x93, 0xC9, 0x84, 0xCF, 0x85, 0xCC, 0x94, 0xC9, - 0x84, 0xCF, 0x89, 0xCC, 0x80, 0xC9, 0x84, 0xCF, - 0x89, 0xCC, 0x81, 0xC9, 0x84, 0xCF, 0x89, 0xCC, - // Bytes 4880 - 48bf - 0x93, 0xC9, 0x84, 0xCF, 0x89, 0xCC, 0x94, 0xC9, - 0x84, 0xCF, 0x89, 0xCD, 0x82, 0xC9, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x91, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - // Bytes 48c0 - 48ff - 0x97, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0x97, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - // Bytes 4900 - 493f - 0xA9, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xA9, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - // Bytes 4940 - 497f - 0xB1, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB1, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, - 0xB7, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCF, - // Bytes 4980 - 49bf - 0x89, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCF, - 0x89, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x42, 0xCC, - 0x80, 0xC9, 0x32, 0x42, 0xCC, 0x81, 0xC9, 0x32, - 0x42, 0xCC, 0x93, 0xC9, 0x32, 0x43, 0xE1, 0x85, - // Bytes 49c0 - 49ff - 0xA1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA2, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xA3, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xA4, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xA5, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA6, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xA7, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xA8, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xA9, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAA, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xAB, 0x01, 0x00, 0x43, - // Bytes 4a00 - 4a3f - 0xE1, 0x85, 0xAC, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAE, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xAF, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xB1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xB2, 0x01, - 0x00, 0x43, 0xE1, 0x85, 0xB3, 0x01, 0x00, 0x43, - 0xE1, 0x85, 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x85, - 0xB5, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xAA, 0x01, - // Bytes 4a40 - 4a7f - 0x00, 0x43, 0xE1, 0x86, 0xAC, 0x01, 0x00, 0x43, - 0xE1, 0x86, 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x86, - 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB1, 0x01, - 0x00, 0x43, 0xE1, 0x86, 0xB2, 0x01, 0x00, 0x43, - 0xE1, 0x86, 0xB3, 0x01, 0x00, 0x43, 0xE1, 0x86, - 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB5, 0x01, - 0x00, 0x44, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x32, - 0x43, 0xE3, 0x82, 0x99, 0x0D, 0x03, 0x43, 0xE3, - // Bytes 4a80 - 4abf - 0x82, 0x9A, 0x0D, 0x03, 0x46, 0xE0, 0xBD, 0xB1, - 0xE0, 0xBD, 0xB2, 0x9E, 0x26, 0x46, 0xE0, 0xBD, - 0xB1, 0xE0, 0xBD, 0xB4, 0xA2, 0x26, 0x46, 0xE0, - 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, 0x26, 0x00, - 0x01, -} - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *nfcTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return nfcValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = nfcIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *nfcTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return nfcValues[c0] - } - i := nfcIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = nfcIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = nfcIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *nfcTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return nfcValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := nfcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = nfcIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *nfcTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return nfcValues[c0] - } - i := nfcIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = nfcIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = nfcIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// nfcTrie. Total size: 10586 bytes (10.34 KiB). Checksum: dd926e82067bee11. -type nfcTrie struct{} - -func newNfcTrie(i int) *nfcTrie { - return &nfcTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *nfcTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 46: - return uint16(nfcValues[n<<6+uint32(b)]) - default: - n -= 46 - return uint16(nfcSparse.lookup(n, b)) - } -} - -// nfcValues: 48 blocks, 3072 entries, 6144 bytes -// The third block is the zero block. -var nfcValues = [3072]uint16{ - // Block 0x0, offset 0x0 - 0x3c: 0xa000, 0x3d: 0xa000, 0x3e: 0xa000, - // Block 0x1, offset 0x40 - 0x41: 0xa000, 0x42: 0xa000, 0x43: 0xa000, 0x44: 0xa000, 0x45: 0xa000, - 0x46: 0xa000, 0x47: 0xa000, 0x48: 0xa000, 0x49: 0xa000, 0x4a: 0xa000, 0x4b: 0xa000, - 0x4c: 0xa000, 0x4d: 0xa000, 0x4e: 0xa000, 0x4f: 0xa000, 0x50: 0xa000, - 0x52: 0xa000, 0x53: 0xa000, 0x54: 0xa000, 0x55: 0xa000, 0x56: 0xa000, 0x57: 0xa000, - 0x58: 0xa000, 0x59: 0xa000, 0x5a: 0xa000, - 0x61: 0xa000, 0x62: 0xa000, 0x63: 0xa000, - 0x64: 0xa000, 0x65: 0xa000, 0x66: 0xa000, 0x67: 0xa000, 0x68: 0xa000, 0x69: 0xa000, - 0x6a: 0xa000, 0x6b: 0xa000, 0x6c: 0xa000, 0x6d: 0xa000, 0x6e: 0xa000, 0x6f: 0xa000, - 0x70: 0xa000, 0x72: 0xa000, 0x73: 0xa000, 0x74: 0xa000, 0x75: 0xa000, - 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, - 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, - 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, - 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, - 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, - 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, - 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, - 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, - 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, - 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, - 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, - // Block 0x4, offset 0x100 - 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, - 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, - 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, - 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, - 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, - 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, - 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, - 0x12a: 0x3082, 0x12b: 0x3393, 0x12c: 0x3087, 0x12d: 0x3398, 0x12e: 0x30aa, 0x12f: 0x33b6, - 0x130: 0x308c, 0x134: 0x30b4, 0x135: 0x33c0, - 0x136: 0x30c8, 0x137: 0x33d9, 0x139: 0x30d2, 0x13a: 0x33e3, 0x13b: 0x30dc, - 0x13c: 0x33ed, 0x13d: 0x30d7, 0x13e: 0x33e8, - // Block 0x5, offset 0x140 - 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, - 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, - 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, - 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, - 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, - 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, - 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, - 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, - 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, - 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, - 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0xa000, - // Block 0x6, offset 0x180 - 0x184: 0x8100, 0x185: 0x8100, - 0x186: 0x8100, - 0x18d: 0x2f88, 0x18e: 0x3294, 0x18f: 0x3096, 0x190: 0x33a2, 0x191: 0x3140, - 0x192: 0x3451, 0x193: 0x31d6, 0x194: 0x34ec, 0x195: 0x39cf, 0x196: 0x3b5e, 0x197: 0x39c8, - 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, - 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, - 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, - 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, - 0x1b0: 0x33c5, 0x1b4: 0x3028, 0x1b5: 0x3334, - 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, - 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x2f8d, 0x1c1: 0x3299, 0x1c2: 0x2f92, 0x1c3: 0x329e, 0x1c4: 0x300a, 0x1c5: 0x3316, - 0x1c6: 0x300f, 0x1c7: 0x331b, 0x1c8: 0x309b, 0x1c9: 0x33a7, 0x1ca: 0x30a0, 0x1cb: 0x33ac, - 0x1cc: 0x3145, 0x1cd: 0x3456, 0x1ce: 0x314a, 0x1cf: 0x345b, 0x1d0: 0x3168, 0x1d1: 0x3479, - 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, - 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, - 0x1de: 0x305a, 0x1df: 0x3366, - 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, - 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, - 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, - // Block 0x8, offset 0x200 - 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, - 0x206: 0x9932, 0x207: 0x9932, 0x208: 0x9932, 0x209: 0x9932, 0x20a: 0x9932, 0x20b: 0x9932, - 0x20c: 0x9932, 0x20d: 0x8132, 0x20e: 0x8132, 0x20f: 0x9932, 0x210: 0x8132, 0x211: 0x9932, - 0x212: 0x8132, 0x213: 0x9932, 0x214: 0x9932, 0x215: 0x8133, 0x216: 0x812d, 0x217: 0x812d, - 0x218: 0x812d, 0x219: 0x812d, 0x21a: 0x8133, 0x21b: 0x992b, 0x21c: 0x812d, 0x21d: 0x812d, - 0x21e: 0x812d, 0x21f: 0x812d, 0x220: 0x812d, 0x221: 0x8129, 0x222: 0x8129, 0x223: 0x992d, - 0x224: 0x992d, 0x225: 0x992d, 0x226: 0x992d, 0x227: 0x9929, 0x228: 0x9929, 0x229: 0x812d, - 0x22a: 0x812d, 0x22b: 0x812d, 0x22c: 0x812d, 0x22d: 0x992d, 0x22e: 0x992d, 0x22f: 0x812d, - 0x230: 0x992d, 0x231: 0x992d, 0x232: 0x812d, 0x233: 0x812d, 0x234: 0x8101, 0x235: 0x8101, - 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, - 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, - // Block 0x9, offset 0x240 - 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, - 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, - 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, - 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, - 0x258: 0x8133, 0x259: 0x812d, 0x25a: 0x812d, 0x25b: 0x8132, 0x25c: 0x8134, 0x25d: 0x8135, - 0x25e: 0x8135, 0x25f: 0x8134, 0x260: 0x8135, 0x261: 0x8135, 0x262: 0x8134, 0x263: 0x8132, - 0x264: 0x8132, 0x265: 0x8132, 0x266: 0x8132, 0x267: 0x8132, 0x268: 0x8132, 0x269: 0x8132, - 0x26a: 0x8132, 0x26b: 0x8132, 0x26c: 0x8132, 0x26d: 0x8132, 0x26e: 0x8132, 0x26f: 0x8132, - 0x274: 0x0170, - 0x27a: 0x8100, - 0x27e: 0x0037, - // Block 0xa, offset 0x280 - 0x284: 0x8100, 0x285: 0x35a1, - 0x286: 0x35e9, 0x287: 0x00ce, 0x288: 0x3607, 0x289: 0x3613, 0x28a: 0x3625, - 0x28c: 0x3643, 0x28e: 0x3655, 0x28f: 0x3673, 0x290: 0x3e08, 0x291: 0xa000, - 0x295: 0xa000, 0x297: 0xa000, - 0x299: 0xa000, - 0x29f: 0xa000, 0x2a1: 0xa000, - 0x2a5: 0xa000, 0x2a9: 0xa000, - 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, - 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, - 0x2b7: 0xa000, 0x2b9: 0xa000, - 0x2bf: 0xa000, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x3721, 0x2c1: 0x372d, 0x2c3: 0x371b, - 0x2c6: 0xa000, 0x2c7: 0x3709, - 0x2cc: 0x375d, 0x2cd: 0x3745, 0x2ce: 0x376f, 0x2d0: 0xa000, - 0x2d3: 0xa000, 0x2d5: 0xa000, 0x2d6: 0xa000, 0x2d7: 0xa000, - 0x2d8: 0xa000, 0x2d9: 0x3751, 0x2da: 0xa000, - 0x2de: 0xa000, 0x2e3: 0xa000, - 0x2e7: 0xa000, - 0x2eb: 0xa000, 0x2ed: 0xa000, - 0x2f0: 0xa000, 0x2f3: 0xa000, 0x2f5: 0xa000, - 0x2f6: 0xa000, 0x2f7: 0xa000, 0x2f8: 0xa000, 0x2f9: 0x37d5, 0x2fa: 0xa000, - 0x2fe: 0xa000, - // Block 0xc, offset 0x300 - 0x301: 0x3733, 0x302: 0x37b7, - 0x310: 0x370f, 0x311: 0x3793, - 0x312: 0x3715, 0x313: 0x3799, 0x316: 0x3727, 0x317: 0x37ab, - 0x318: 0xa000, 0x319: 0xa000, 0x31a: 0x3829, 0x31b: 0x382f, 0x31c: 0x3739, 0x31d: 0x37bd, - 0x31e: 0x373f, 0x31f: 0x37c3, 0x322: 0x374b, 0x323: 0x37cf, - 0x324: 0x3757, 0x325: 0x37db, 0x326: 0x3763, 0x327: 0x37e7, 0x328: 0xa000, 0x329: 0xa000, - 0x32a: 0x3835, 0x32b: 0x383b, 0x32c: 0x378d, 0x32d: 0x3811, 0x32e: 0x3769, 0x32f: 0x37ed, - 0x330: 0x3775, 0x331: 0x37f9, 0x332: 0x377b, 0x333: 0x37ff, 0x334: 0x3781, 0x335: 0x3805, - 0x338: 0x3787, 0x339: 0x380b, - // Block 0xd, offset 0x340 - 0x351: 0x812d, - 0x352: 0x8132, 0x353: 0x8132, 0x354: 0x8132, 0x355: 0x8132, 0x356: 0x812d, 0x357: 0x8132, - 0x358: 0x8132, 0x359: 0x8132, 0x35a: 0x812e, 0x35b: 0x812d, 0x35c: 0x8132, 0x35d: 0x8132, - 0x35e: 0x8132, 0x35f: 0x8132, 0x360: 0x8132, 0x361: 0x8132, 0x362: 0x812d, 0x363: 0x812d, - 0x364: 0x812d, 0x365: 0x812d, 0x366: 0x812d, 0x367: 0x812d, 0x368: 0x8132, 0x369: 0x8132, - 0x36a: 0x812d, 0x36b: 0x8132, 0x36c: 0x8132, 0x36d: 0x812e, 0x36e: 0x8131, 0x36f: 0x8132, - 0x370: 0x8105, 0x371: 0x8106, 0x372: 0x8107, 0x373: 0x8108, 0x374: 0x8109, 0x375: 0x810a, - 0x376: 0x810b, 0x377: 0x810c, 0x378: 0x810d, 0x379: 0x810e, 0x37a: 0x810e, 0x37b: 0x810f, - 0x37c: 0x8110, 0x37d: 0x8111, 0x37f: 0x8112, - // Block 0xe, offset 0x380 - 0x388: 0xa000, 0x38a: 0xa000, 0x38b: 0x8116, - 0x38c: 0x8117, 0x38d: 0x8118, 0x38e: 0x8119, 0x38f: 0x811a, 0x390: 0x811b, 0x391: 0x811c, - 0x392: 0x811d, 0x393: 0x9932, 0x394: 0x9932, 0x395: 0x992d, 0x396: 0x812d, 0x397: 0x8132, - 0x398: 0x8132, 0x399: 0x8132, 0x39a: 0x8132, 0x39b: 0x8132, 0x39c: 0x812d, 0x39d: 0x8132, - 0x39e: 0x8132, 0x39f: 0x812d, - 0x3b0: 0x811e, - // Block 0xf, offset 0x3c0 - 0x3d3: 0x812d, 0x3d4: 0x8132, 0x3d5: 0x8132, 0x3d6: 0x8132, 0x3d7: 0x8132, - 0x3d8: 0x8132, 0x3d9: 0x8132, 0x3da: 0x8132, 0x3db: 0x8132, 0x3dc: 0x8132, 0x3dd: 0x8132, - 0x3de: 0x8132, 0x3df: 0x8132, 0x3e0: 0x8132, 0x3e1: 0x8132, 0x3e3: 0x812d, - 0x3e4: 0x8132, 0x3e5: 0x8132, 0x3e6: 0x812d, 0x3e7: 0x8132, 0x3e8: 0x8132, 0x3e9: 0x812d, - 0x3ea: 0x8132, 0x3eb: 0x8132, 0x3ec: 0x8132, 0x3ed: 0x812d, 0x3ee: 0x812d, 0x3ef: 0x812d, - 0x3f0: 0x8116, 0x3f1: 0x8117, 0x3f2: 0x8118, 0x3f3: 0x8132, 0x3f4: 0x8132, 0x3f5: 0x8132, - 0x3f6: 0x812d, 0x3f7: 0x8132, 0x3f8: 0x8132, 0x3f9: 0x812d, 0x3fa: 0x812d, 0x3fb: 0x8132, - 0x3fc: 0x8132, 0x3fd: 0x8132, 0x3fe: 0x8132, 0x3ff: 0x8132, - // Block 0x10, offset 0x400 - 0x405: 0xa000, - 0x406: 0x2d26, 0x407: 0xa000, 0x408: 0x2d2e, 0x409: 0xa000, 0x40a: 0x2d36, 0x40b: 0xa000, - 0x40c: 0x2d3e, 0x40d: 0xa000, 0x40e: 0x2d46, 0x411: 0xa000, - 0x412: 0x2d4e, - 0x434: 0x8102, 0x435: 0x9900, - 0x43a: 0xa000, 0x43b: 0x2d56, - 0x43c: 0xa000, 0x43d: 0x2d5e, 0x43e: 0xa000, 0x43f: 0xa000, - // Block 0x11, offset 0x440 - 0x440: 0x8132, 0x441: 0x8132, 0x442: 0x812d, 0x443: 0x8132, 0x444: 0x8132, 0x445: 0x8132, - 0x446: 0x8132, 0x447: 0x8132, 0x448: 0x8132, 0x449: 0x8132, 0x44a: 0x812d, 0x44b: 0x8132, - 0x44c: 0x8132, 0x44d: 0x8135, 0x44e: 0x812a, 0x44f: 0x812d, 0x450: 0x8129, 0x451: 0x8132, - 0x452: 0x8132, 0x453: 0x8132, 0x454: 0x8132, 0x455: 0x8132, 0x456: 0x8132, 0x457: 0x8132, - 0x458: 0x8132, 0x459: 0x8132, 0x45a: 0x8132, 0x45b: 0x8132, 0x45c: 0x8132, 0x45d: 0x8132, - 0x45e: 0x8132, 0x45f: 0x8132, 0x460: 0x8132, 0x461: 0x8132, 0x462: 0x8132, 0x463: 0x8132, - 0x464: 0x8132, 0x465: 0x8132, 0x466: 0x8132, 0x467: 0x8132, 0x468: 0x8132, 0x469: 0x8132, - 0x46a: 0x8132, 0x46b: 0x8132, 0x46c: 0x8132, 0x46d: 0x8132, 0x46e: 0x8132, 0x46f: 0x8132, - 0x470: 0x8132, 0x471: 0x8132, 0x472: 0x8132, 0x473: 0x8132, 0x474: 0x8132, 0x475: 0x8132, - 0x476: 0x8133, 0x477: 0x8131, 0x478: 0x8131, 0x479: 0x812d, 0x47b: 0x8132, - 0x47c: 0x8134, 0x47d: 0x812d, 0x47e: 0x8132, 0x47f: 0x812d, - // Block 0x12, offset 0x480 - 0x480: 0x2f97, 0x481: 0x32a3, 0x482: 0x2fa1, 0x483: 0x32ad, 0x484: 0x2fa6, 0x485: 0x32b2, - 0x486: 0x2fab, 0x487: 0x32b7, 0x488: 0x38cc, 0x489: 0x3a5b, 0x48a: 0x2fc4, 0x48b: 0x32d0, - 0x48c: 0x2fce, 0x48d: 0x32da, 0x48e: 0x2fdd, 0x48f: 0x32e9, 0x490: 0x2fd3, 0x491: 0x32df, - 0x492: 0x2fd8, 0x493: 0x32e4, 0x494: 0x38ef, 0x495: 0x3a7e, 0x496: 0x38f6, 0x497: 0x3a85, - 0x498: 0x3019, 0x499: 0x3325, 0x49a: 0x301e, 0x49b: 0x332a, 0x49c: 0x3904, 0x49d: 0x3a93, - 0x49e: 0x3023, 0x49f: 0x332f, 0x4a0: 0x3032, 0x4a1: 0x333e, 0x4a2: 0x3050, 0x4a3: 0x335c, - 0x4a4: 0x305f, 0x4a5: 0x336b, 0x4a6: 0x3055, 0x4a7: 0x3361, 0x4a8: 0x3064, 0x4a9: 0x3370, - 0x4aa: 0x3069, 0x4ab: 0x3375, 0x4ac: 0x30af, 0x4ad: 0x33bb, 0x4ae: 0x390b, 0x4af: 0x3a9a, - 0x4b0: 0x30b9, 0x4b1: 0x33ca, 0x4b2: 0x30c3, 0x4b3: 0x33d4, 0x4b4: 0x30cd, 0x4b5: 0x33de, - 0x4b6: 0x46c4, 0x4b7: 0x4755, 0x4b8: 0x3912, 0x4b9: 0x3aa1, 0x4ba: 0x30e6, 0x4bb: 0x33f7, - 0x4bc: 0x30e1, 0x4bd: 0x33f2, 0x4be: 0x30eb, 0x4bf: 0x33fc, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x30f0, 0x4c1: 0x3401, 0x4c2: 0x30f5, 0x4c3: 0x3406, 0x4c4: 0x3109, 0x4c5: 0x341a, - 0x4c6: 0x3113, 0x4c7: 0x3424, 0x4c8: 0x3122, 0x4c9: 0x3433, 0x4ca: 0x311d, 0x4cb: 0x342e, - 0x4cc: 0x3935, 0x4cd: 0x3ac4, 0x4ce: 0x3943, 0x4cf: 0x3ad2, 0x4d0: 0x394a, 0x4d1: 0x3ad9, - 0x4d2: 0x3951, 0x4d3: 0x3ae0, 0x4d4: 0x314f, 0x4d5: 0x3460, 0x4d6: 0x3154, 0x4d7: 0x3465, - 0x4d8: 0x315e, 0x4d9: 0x346f, 0x4da: 0x46f1, 0x4db: 0x4782, 0x4dc: 0x3997, 0x4dd: 0x3b26, - 0x4de: 0x3177, 0x4df: 0x3488, 0x4e0: 0x3181, 0x4e1: 0x3492, 0x4e2: 0x4700, 0x4e3: 0x4791, - 0x4e4: 0x399e, 0x4e5: 0x3b2d, 0x4e6: 0x39a5, 0x4e7: 0x3b34, 0x4e8: 0x39ac, 0x4e9: 0x3b3b, - 0x4ea: 0x3190, 0x4eb: 0x34a1, 0x4ec: 0x319a, 0x4ed: 0x34b0, 0x4ee: 0x31ae, 0x4ef: 0x34c4, - 0x4f0: 0x31a9, 0x4f1: 0x34bf, 0x4f2: 0x31ea, 0x4f3: 0x3500, 0x4f4: 0x31f9, 0x4f5: 0x350f, - 0x4f6: 0x31f4, 0x4f7: 0x350a, 0x4f8: 0x39b3, 0x4f9: 0x3b42, 0x4fa: 0x39ba, 0x4fb: 0x3b49, - 0x4fc: 0x31fe, 0x4fd: 0x3514, 0x4fe: 0x3203, 0x4ff: 0x3519, - // Block 0x14, offset 0x500 - 0x500: 0x3208, 0x501: 0x351e, 0x502: 0x320d, 0x503: 0x3523, 0x504: 0x321c, 0x505: 0x3532, - 0x506: 0x3217, 0x507: 0x352d, 0x508: 0x3221, 0x509: 0x353c, 0x50a: 0x3226, 0x50b: 0x3541, - 0x50c: 0x322b, 0x50d: 0x3546, 0x50e: 0x3249, 0x50f: 0x3564, 0x510: 0x3262, 0x511: 0x3582, - 0x512: 0x3271, 0x513: 0x3591, 0x514: 0x3276, 0x515: 0x3596, 0x516: 0x337a, 0x517: 0x34a6, - 0x518: 0x3537, 0x519: 0x3573, 0x51b: 0x35d1, - 0x520: 0x46a1, 0x521: 0x4732, 0x522: 0x2f83, 0x523: 0x328f, - 0x524: 0x3878, 0x525: 0x3a07, 0x526: 0x3871, 0x527: 0x3a00, 0x528: 0x3886, 0x529: 0x3a15, - 0x52a: 0x387f, 0x52b: 0x3a0e, 0x52c: 0x38be, 0x52d: 0x3a4d, 0x52e: 0x3894, 0x52f: 0x3a23, - 0x530: 0x388d, 0x531: 0x3a1c, 0x532: 0x38a2, 0x533: 0x3a31, 0x534: 0x389b, 0x535: 0x3a2a, - 0x536: 0x38c5, 0x537: 0x3a54, 0x538: 0x46b5, 0x539: 0x4746, 0x53a: 0x3000, 0x53b: 0x330c, - 0x53c: 0x2fec, 0x53d: 0x32f8, 0x53e: 0x38da, 0x53f: 0x3a69, - // Block 0x15, offset 0x540 - 0x540: 0x38d3, 0x541: 0x3a62, 0x542: 0x38e8, 0x543: 0x3a77, 0x544: 0x38e1, 0x545: 0x3a70, - 0x546: 0x38fd, 0x547: 0x3a8c, 0x548: 0x3091, 0x549: 0x339d, 0x54a: 0x30a5, 0x54b: 0x33b1, - 0x54c: 0x46e7, 0x54d: 0x4778, 0x54e: 0x3136, 0x54f: 0x3447, 0x550: 0x3920, 0x551: 0x3aaf, - 0x552: 0x3919, 0x553: 0x3aa8, 0x554: 0x392e, 0x555: 0x3abd, 0x556: 0x3927, 0x557: 0x3ab6, - 0x558: 0x3989, 0x559: 0x3b18, 0x55a: 0x396d, 0x55b: 0x3afc, 0x55c: 0x3966, 0x55d: 0x3af5, - 0x55e: 0x397b, 0x55f: 0x3b0a, 0x560: 0x3974, 0x561: 0x3b03, 0x562: 0x3982, 0x563: 0x3b11, - 0x564: 0x31e5, 0x565: 0x34fb, 0x566: 0x31c7, 0x567: 0x34dd, 0x568: 0x39e4, 0x569: 0x3b73, - 0x56a: 0x39dd, 0x56b: 0x3b6c, 0x56c: 0x39f2, 0x56d: 0x3b81, 0x56e: 0x39eb, 0x56f: 0x3b7a, - 0x570: 0x39f9, 0x571: 0x3b88, 0x572: 0x3230, 0x573: 0x354b, 0x574: 0x3258, 0x575: 0x3578, - 0x576: 0x3253, 0x577: 0x356e, 0x578: 0x323f, 0x579: 0x355a, - // Block 0x16, offset 0x580 - 0x580: 0x4804, 0x581: 0x480a, 0x582: 0x491e, 0x583: 0x4936, 0x584: 0x4926, 0x585: 0x493e, - 0x586: 0x492e, 0x587: 0x4946, 0x588: 0x47aa, 0x589: 0x47b0, 0x58a: 0x488e, 0x58b: 0x48a6, - 0x58c: 0x4896, 0x58d: 0x48ae, 0x58e: 0x489e, 0x58f: 0x48b6, 0x590: 0x4816, 0x591: 0x481c, - 0x592: 0x3db8, 0x593: 0x3dc8, 0x594: 0x3dc0, 0x595: 0x3dd0, - 0x598: 0x47b6, 0x599: 0x47bc, 0x59a: 0x3ce8, 0x59b: 0x3cf8, 0x59c: 0x3cf0, 0x59d: 0x3d00, - 0x5a0: 0x482e, 0x5a1: 0x4834, 0x5a2: 0x494e, 0x5a3: 0x4966, - 0x5a4: 0x4956, 0x5a5: 0x496e, 0x5a6: 0x495e, 0x5a7: 0x4976, 0x5a8: 0x47c2, 0x5a9: 0x47c8, - 0x5aa: 0x48be, 0x5ab: 0x48d6, 0x5ac: 0x48c6, 0x5ad: 0x48de, 0x5ae: 0x48ce, 0x5af: 0x48e6, - 0x5b0: 0x4846, 0x5b1: 0x484c, 0x5b2: 0x3e18, 0x5b3: 0x3e30, 0x5b4: 0x3e20, 0x5b5: 0x3e38, - 0x5b6: 0x3e28, 0x5b7: 0x3e40, 0x5b8: 0x47ce, 0x5b9: 0x47d4, 0x5ba: 0x3d18, 0x5bb: 0x3d30, - 0x5bc: 0x3d20, 0x5bd: 0x3d38, 0x5be: 0x3d28, 0x5bf: 0x3d40, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x4852, 0x5c1: 0x4858, 0x5c2: 0x3e48, 0x5c3: 0x3e58, 0x5c4: 0x3e50, 0x5c5: 0x3e60, - 0x5c8: 0x47da, 0x5c9: 0x47e0, 0x5ca: 0x3d48, 0x5cb: 0x3d58, - 0x5cc: 0x3d50, 0x5cd: 0x3d60, 0x5d0: 0x4864, 0x5d1: 0x486a, - 0x5d2: 0x3e80, 0x5d3: 0x3e98, 0x5d4: 0x3e88, 0x5d5: 0x3ea0, 0x5d6: 0x3e90, 0x5d7: 0x3ea8, - 0x5d9: 0x47e6, 0x5db: 0x3d68, 0x5dd: 0x3d70, - 0x5df: 0x3d78, 0x5e0: 0x487c, 0x5e1: 0x4882, 0x5e2: 0x497e, 0x5e3: 0x4996, - 0x5e4: 0x4986, 0x5e5: 0x499e, 0x5e6: 0x498e, 0x5e7: 0x49a6, 0x5e8: 0x47ec, 0x5e9: 0x47f2, - 0x5ea: 0x48ee, 0x5eb: 0x4906, 0x5ec: 0x48f6, 0x5ed: 0x490e, 0x5ee: 0x48fe, 0x5ef: 0x4916, - 0x5f0: 0x47f8, 0x5f1: 0x431e, 0x5f2: 0x3691, 0x5f3: 0x4324, 0x5f4: 0x4822, 0x5f5: 0x432a, - 0x5f6: 0x36a3, 0x5f7: 0x4330, 0x5f8: 0x36c1, 0x5f9: 0x4336, 0x5fa: 0x36d9, 0x5fb: 0x433c, - 0x5fc: 0x4870, 0x5fd: 0x4342, - // Block 0x18, offset 0x600 - 0x600: 0x3da0, 0x601: 0x3da8, 0x602: 0x4184, 0x603: 0x41a2, 0x604: 0x418e, 0x605: 0x41ac, - 0x606: 0x4198, 0x607: 0x41b6, 0x608: 0x3cd8, 0x609: 0x3ce0, 0x60a: 0x40d0, 0x60b: 0x40ee, - 0x60c: 0x40da, 0x60d: 0x40f8, 0x60e: 0x40e4, 0x60f: 0x4102, 0x610: 0x3de8, 0x611: 0x3df0, - 0x612: 0x41c0, 0x613: 0x41de, 0x614: 0x41ca, 0x615: 0x41e8, 0x616: 0x41d4, 0x617: 0x41f2, - 0x618: 0x3d08, 0x619: 0x3d10, 0x61a: 0x410c, 0x61b: 0x412a, 0x61c: 0x4116, 0x61d: 0x4134, - 0x61e: 0x4120, 0x61f: 0x413e, 0x620: 0x3ec0, 0x621: 0x3ec8, 0x622: 0x41fc, 0x623: 0x421a, - 0x624: 0x4206, 0x625: 0x4224, 0x626: 0x4210, 0x627: 0x422e, 0x628: 0x3d80, 0x629: 0x3d88, - 0x62a: 0x4148, 0x62b: 0x4166, 0x62c: 0x4152, 0x62d: 0x4170, 0x62e: 0x415c, 0x62f: 0x417a, - 0x630: 0x3685, 0x631: 0x367f, 0x632: 0x3d90, 0x633: 0x368b, 0x634: 0x3d98, - 0x636: 0x4810, 0x637: 0x3db0, 0x638: 0x35f5, 0x639: 0x35ef, 0x63a: 0x35e3, 0x63b: 0x42ee, - 0x63c: 0x35fb, 0x63d: 0x8100, 0x63e: 0x01d3, 0x63f: 0xa100, - // Block 0x19, offset 0x640 - 0x640: 0x8100, 0x641: 0x35a7, 0x642: 0x3dd8, 0x643: 0x369d, 0x644: 0x3de0, - 0x646: 0x483a, 0x647: 0x3df8, 0x648: 0x3601, 0x649: 0x42f4, 0x64a: 0x360d, 0x64b: 0x42fa, - 0x64c: 0x3619, 0x64d: 0x3b8f, 0x64e: 0x3b96, 0x64f: 0x3b9d, 0x650: 0x36b5, 0x651: 0x36af, - 0x652: 0x3e00, 0x653: 0x44e4, 0x656: 0x36bb, 0x657: 0x3e10, - 0x658: 0x3631, 0x659: 0x362b, 0x65a: 0x361f, 0x65b: 0x4300, 0x65d: 0x3ba4, - 0x65e: 0x3bab, 0x65f: 0x3bb2, 0x660: 0x36eb, 0x661: 0x36e5, 0x662: 0x3e68, 0x663: 0x44ec, - 0x664: 0x36cd, 0x665: 0x36d3, 0x666: 0x36f1, 0x667: 0x3e78, 0x668: 0x3661, 0x669: 0x365b, - 0x66a: 0x364f, 0x66b: 0x430c, 0x66c: 0x3649, 0x66d: 0x359b, 0x66e: 0x42e8, 0x66f: 0x0081, - 0x672: 0x3eb0, 0x673: 0x36f7, 0x674: 0x3eb8, - 0x676: 0x4888, 0x677: 0x3ed0, 0x678: 0x363d, 0x679: 0x4306, 0x67a: 0x366d, 0x67b: 0x4318, - 0x67c: 0x3679, 0x67d: 0x4256, 0x67e: 0xa100, - // Block 0x1a, offset 0x680 - 0x681: 0x3c06, 0x683: 0xa000, 0x684: 0x3c0d, 0x685: 0xa000, - 0x687: 0x3c14, 0x688: 0xa000, 0x689: 0x3c1b, - 0x68d: 0xa000, - 0x6a0: 0x2f65, 0x6a1: 0xa000, 0x6a2: 0x3c29, - 0x6a4: 0xa000, 0x6a5: 0xa000, - 0x6ad: 0x3c22, 0x6ae: 0x2f60, 0x6af: 0x2f6a, - 0x6b0: 0x3c30, 0x6b1: 0x3c37, 0x6b2: 0xa000, 0x6b3: 0xa000, 0x6b4: 0x3c3e, 0x6b5: 0x3c45, - 0x6b6: 0xa000, 0x6b7: 0xa000, 0x6b8: 0x3c4c, 0x6b9: 0x3c53, 0x6ba: 0xa000, 0x6bb: 0xa000, - 0x6bc: 0xa000, 0x6bd: 0xa000, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x3c5a, 0x6c1: 0x3c61, 0x6c2: 0xa000, 0x6c3: 0xa000, 0x6c4: 0x3c76, 0x6c5: 0x3c7d, - 0x6c6: 0xa000, 0x6c7: 0xa000, 0x6c8: 0x3c84, 0x6c9: 0x3c8b, - 0x6d1: 0xa000, - 0x6d2: 0xa000, - 0x6e2: 0xa000, - 0x6e8: 0xa000, 0x6e9: 0xa000, - 0x6eb: 0xa000, 0x6ec: 0x3ca0, 0x6ed: 0x3ca7, 0x6ee: 0x3cae, 0x6ef: 0x3cb5, - 0x6f2: 0xa000, 0x6f3: 0xa000, 0x6f4: 0xa000, 0x6f5: 0xa000, - // Block 0x1c, offset 0x700 - 0x706: 0xa000, 0x70b: 0xa000, - 0x70c: 0x3f08, 0x70d: 0xa000, 0x70e: 0x3f10, 0x70f: 0xa000, 0x710: 0x3f18, 0x711: 0xa000, - 0x712: 0x3f20, 0x713: 0xa000, 0x714: 0x3f28, 0x715: 0xa000, 0x716: 0x3f30, 0x717: 0xa000, - 0x718: 0x3f38, 0x719: 0xa000, 0x71a: 0x3f40, 0x71b: 0xa000, 0x71c: 0x3f48, 0x71d: 0xa000, - 0x71e: 0x3f50, 0x71f: 0xa000, 0x720: 0x3f58, 0x721: 0xa000, 0x722: 0x3f60, - 0x724: 0xa000, 0x725: 0x3f68, 0x726: 0xa000, 0x727: 0x3f70, 0x728: 0xa000, 0x729: 0x3f78, - 0x72f: 0xa000, - 0x730: 0x3f80, 0x731: 0x3f88, 0x732: 0xa000, 0x733: 0x3f90, 0x734: 0x3f98, 0x735: 0xa000, - 0x736: 0x3fa0, 0x737: 0x3fa8, 0x738: 0xa000, 0x739: 0x3fb0, 0x73a: 0x3fb8, 0x73b: 0xa000, - 0x73c: 0x3fc0, 0x73d: 0x3fc8, - // Block 0x1d, offset 0x740 - 0x754: 0x3f00, - 0x759: 0x9903, 0x75a: 0x9903, 0x75b: 0x8100, 0x75c: 0x8100, 0x75d: 0xa000, - 0x75e: 0x3fd0, - 0x766: 0xa000, - 0x76b: 0xa000, 0x76c: 0x3fe0, 0x76d: 0xa000, 0x76e: 0x3fe8, 0x76f: 0xa000, - 0x770: 0x3ff0, 0x771: 0xa000, 0x772: 0x3ff8, 0x773: 0xa000, 0x774: 0x4000, 0x775: 0xa000, - 0x776: 0x4008, 0x777: 0xa000, 0x778: 0x4010, 0x779: 0xa000, 0x77a: 0x4018, 0x77b: 0xa000, - 0x77c: 0x4020, 0x77d: 0xa000, 0x77e: 0x4028, 0x77f: 0xa000, - // Block 0x1e, offset 0x780 - 0x780: 0x4030, 0x781: 0xa000, 0x782: 0x4038, 0x784: 0xa000, 0x785: 0x4040, - 0x786: 0xa000, 0x787: 0x4048, 0x788: 0xa000, 0x789: 0x4050, - 0x78f: 0xa000, 0x790: 0x4058, 0x791: 0x4060, - 0x792: 0xa000, 0x793: 0x4068, 0x794: 0x4070, 0x795: 0xa000, 0x796: 0x4078, 0x797: 0x4080, - 0x798: 0xa000, 0x799: 0x4088, 0x79a: 0x4090, 0x79b: 0xa000, 0x79c: 0x4098, 0x79d: 0x40a0, - 0x7af: 0xa000, - 0x7b0: 0xa000, 0x7b1: 0xa000, 0x7b2: 0xa000, 0x7b4: 0x3fd8, - 0x7b7: 0x40a8, 0x7b8: 0x40b0, 0x7b9: 0x40b8, 0x7ba: 0x40c0, - 0x7bd: 0xa000, 0x7be: 0x40c8, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x1377, 0x7c1: 0x0cfb, 0x7c2: 0x13d3, 0x7c3: 0x139f, 0x7c4: 0x0e57, 0x7c5: 0x06eb, - 0x7c6: 0x08df, 0x7c7: 0x162b, 0x7c8: 0x162b, 0x7c9: 0x0a0b, 0x7ca: 0x145f, 0x7cb: 0x0943, - 0x7cc: 0x0a07, 0x7cd: 0x0bef, 0x7ce: 0x0fcf, 0x7cf: 0x115f, 0x7d0: 0x1297, 0x7d1: 0x12d3, - 0x7d2: 0x1307, 0x7d3: 0x141b, 0x7d4: 0x0d73, 0x7d5: 0x0dff, 0x7d6: 0x0eab, 0x7d7: 0x0f43, - 0x7d8: 0x125f, 0x7d9: 0x1447, 0x7da: 0x1573, 0x7db: 0x070f, 0x7dc: 0x08b3, 0x7dd: 0x0d87, - 0x7de: 0x0ecf, 0x7df: 0x1293, 0x7e0: 0x15c3, 0x7e1: 0x0ab3, 0x7e2: 0x0e77, 0x7e3: 0x1283, - 0x7e4: 0x1317, 0x7e5: 0x0c23, 0x7e6: 0x11bb, 0x7e7: 0x12df, 0x7e8: 0x0b1f, 0x7e9: 0x0d0f, - 0x7ea: 0x0e17, 0x7eb: 0x0f1b, 0x7ec: 0x1427, 0x7ed: 0x074f, 0x7ee: 0x07e7, 0x7ef: 0x0853, - 0x7f0: 0x0c8b, 0x7f1: 0x0d7f, 0x7f2: 0x0ecb, 0x7f3: 0x0fef, 0x7f4: 0x1177, 0x7f5: 0x128b, - 0x7f6: 0x12a3, 0x7f7: 0x13c7, 0x7f8: 0x14ef, 0x7f9: 0x15a3, 0x7fa: 0x15bf, 0x7fb: 0x102b, - 0x7fc: 0x106b, 0x7fd: 0x1123, 0x7fe: 0x1243, 0x7ff: 0x147b, - // Block 0x20, offset 0x800 - 0x800: 0x15cb, 0x801: 0x134b, 0x802: 0x09c7, 0x803: 0x0b3b, 0x804: 0x10db, 0x805: 0x119b, - 0x806: 0x0eff, 0x807: 0x1033, 0x808: 0x1397, 0x809: 0x14e7, 0x80a: 0x09c3, 0x80b: 0x0a8f, - 0x80c: 0x0d77, 0x80d: 0x0e2b, 0x80e: 0x0e5f, 0x80f: 0x1113, 0x810: 0x113b, 0x811: 0x14a7, - 0x812: 0x084f, 0x813: 0x11a7, 0x814: 0x07f3, 0x815: 0x07ef, 0x816: 0x1097, 0x817: 0x1127, - 0x818: 0x125b, 0x819: 0x14af, 0x81a: 0x1367, 0x81b: 0x0c27, 0x81c: 0x0d73, 0x81d: 0x1357, - 0x81e: 0x06f7, 0x81f: 0x0a63, 0x820: 0x0b93, 0x821: 0x0f2f, 0x822: 0x0faf, 0x823: 0x0873, - 0x824: 0x103b, 0x825: 0x075f, 0x826: 0x0b77, 0x827: 0x06d7, 0x828: 0x0deb, 0x829: 0x0ca3, - 0x82a: 0x110f, 0x82b: 0x08c7, 0x82c: 0x09b3, 0x82d: 0x0ffb, 0x82e: 0x1263, 0x82f: 0x133b, - 0x830: 0x0db7, 0x831: 0x13f7, 0x832: 0x0de3, 0x833: 0x0c37, 0x834: 0x121b, 0x835: 0x0c57, - 0x836: 0x0fab, 0x837: 0x072b, 0x838: 0x07a7, 0x839: 0x07eb, 0x83a: 0x0d53, 0x83b: 0x10fb, - 0x83c: 0x11f3, 0x83d: 0x1347, 0x83e: 0x145b, 0x83f: 0x085b, - // Block 0x21, offset 0x840 - 0x840: 0x090f, 0x841: 0x0a17, 0x842: 0x0b2f, 0x843: 0x0cbf, 0x844: 0x0e7b, 0x845: 0x103f, - 0x846: 0x1497, 0x847: 0x157b, 0x848: 0x15cf, 0x849: 0x15e7, 0x84a: 0x0837, 0x84b: 0x0cf3, - 0x84c: 0x0da3, 0x84d: 0x13eb, 0x84e: 0x0afb, 0x84f: 0x0bd7, 0x850: 0x0bf3, 0x851: 0x0c83, - 0x852: 0x0e6b, 0x853: 0x0eb7, 0x854: 0x0f67, 0x855: 0x108b, 0x856: 0x112f, 0x857: 0x1193, - 0x858: 0x13db, 0x859: 0x126b, 0x85a: 0x1403, 0x85b: 0x147f, 0x85c: 0x080f, 0x85d: 0x083b, - 0x85e: 0x0923, 0x85f: 0x0ea7, 0x860: 0x12f3, 0x861: 0x133b, 0x862: 0x0b1b, 0x863: 0x0b8b, - 0x864: 0x0c4f, 0x865: 0x0daf, 0x866: 0x10d7, 0x867: 0x0f23, 0x868: 0x073b, 0x869: 0x097f, - 0x86a: 0x0a63, 0x86b: 0x0ac7, 0x86c: 0x0b97, 0x86d: 0x0f3f, 0x86e: 0x0f5b, 0x86f: 0x116b, - 0x870: 0x118b, 0x871: 0x1463, 0x872: 0x14e3, 0x873: 0x14f3, 0x874: 0x152f, 0x875: 0x0753, - 0x876: 0x107f, 0x877: 0x144f, 0x878: 0x14cb, 0x879: 0x0baf, 0x87a: 0x0717, 0x87b: 0x0777, - 0x87c: 0x0a67, 0x87d: 0x0a87, 0x87e: 0x0caf, 0x87f: 0x0d73, - // Block 0x22, offset 0x880 - 0x880: 0x0ec3, 0x881: 0x0fcb, 0x882: 0x1277, 0x883: 0x1417, 0x884: 0x1623, 0x885: 0x0ce3, - 0x886: 0x14a3, 0x887: 0x0833, 0x888: 0x0d2f, 0x889: 0x0d3b, 0x88a: 0x0e0f, 0x88b: 0x0e47, - 0x88c: 0x0f4b, 0x88d: 0x0fa7, 0x88e: 0x1027, 0x88f: 0x110b, 0x890: 0x153b, 0x891: 0x07af, - 0x892: 0x0c03, 0x893: 0x14b3, 0x894: 0x0767, 0x895: 0x0aab, 0x896: 0x0e2f, 0x897: 0x13df, - 0x898: 0x0b67, 0x899: 0x0bb7, 0x89a: 0x0d43, 0x89b: 0x0f2f, 0x89c: 0x14bb, 0x89d: 0x0817, - 0x89e: 0x08ff, 0x89f: 0x0a97, 0x8a0: 0x0cd3, 0x8a1: 0x0d1f, 0x8a2: 0x0d5f, 0x8a3: 0x0df3, - 0x8a4: 0x0f47, 0x8a5: 0x0fbb, 0x8a6: 0x1157, 0x8a7: 0x12f7, 0x8a8: 0x1303, 0x8a9: 0x1457, - 0x8aa: 0x14d7, 0x8ab: 0x0883, 0x8ac: 0x0e4b, 0x8ad: 0x0903, 0x8ae: 0x0ec7, 0x8af: 0x0f6b, - 0x8b0: 0x1287, 0x8b1: 0x14bf, 0x8b2: 0x15ab, 0x8b3: 0x15d3, 0x8b4: 0x0d37, 0x8b5: 0x0e27, - 0x8b6: 0x11c3, 0x8b7: 0x10b7, 0x8b8: 0x10c3, 0x8b9: 0x10e7, 0x8ba: 0x0f17, 0x8bb: 0x0e9f, - 0x8bc: 0x1363, 0x8bd: 0x0733, 0x8be: 0x122b, 0x8bf: 0x081b, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x080b, 0x8c1: 0x0b0b, 0x8c2: 0x0c2b, 0x8c3: 0x10f3, 0x8c4: 0x0a53, 0x8c5: 0x0e03, - 0x8c6: 0x0cef, 0x8c7: 0x13e7, 0x8c8: 0x12e7, 0x8c9: 0x14ab, 0x8ca: 0x1323, 0x8cb: 0x0b27, - 0x8cc: 0x0787, 0x8cd: 0x095b, 0x8d0: 0x09af, - 0x8d2: 0x0cdf, 0x8d5: 0x07f7, 0x8d6: 0x0f1f, 0x8d7: 0x0fe3, - 0x8d8: 0x1047, 0x8d9: 0x1063, 0x8da: 0x1067, 0x8db: 0x107b, 0x8dc: 0x14fb, 0x8dd: 0x10eb, - 0x8de: 0x116f, 0x8e0: 0x128f, 0x8e2: 0x1353, - 0x8e5: 0x1407, 0x8e6: 0x1433, - 0x8ea: 0x154f, 0x8eb: 0x1553, 0x8ec: 0x1557, 0x8ed: 0x15bb, 0x8ee: 0x142b, 0x8ef: 0x14c7, - 0x8f0: 0x0757, 0x8f1: 0x077b, 0x8f2: 0x078f, 0x8f3: 0x084b, 0x8f4: 0x0857, 0x8f5: 0x0897, - 0x8f6: 0x094b, 0x8f7: 0x0967, 0x8f8: 0x096f, 0x8f9: 0x09ab, 0x8fa: 0x09b7, 0x8fb: 0x0a93, - 0x8fc: 0x0a9b, 0x8fd: 0x0ba3, 0x8fe: 0x0bcb, 0x8ff: 0x0bd3, - // Block 0x24, offset 0x900 - 0x900: 0x0beb, 0x901: 0x0c97, 0x902: 0x0cc7, 0x903: 0x0ce7, 0x904: 0x0d57, 0x905: 0x0e1b, - 0x906: 0x0e37, 0x907: 0x0e67, 0x908: 0x0ebb, 0x909: 0x0edb, 0x90a: 0x0f4f, 0x90b: 0x102f, - 0x90c: 0x104b, 0x90d: 0x1053, 0x90e: 0x104f, 0x90f: 0x1057, 0x910: 0x105b, 0x911: 0x105f, - 0x912: 0x1073, 0x913: 0x1077, 0x914: 0x109b, 0x915: 0x10af, 0x916: 0x10cb, 0x917: 0x112f, - 0x918: 0x1137, 0x919: 0x113f, 0x91a: 0x1153, 0x91b: 0x117b, 0x91c: 0x11cb, 0x91d: 0x11ff, - 0x91e: 0x11ff, 0x91f: 0x1267, 0x920: 0x130f, 0x921: 0x1327, 0x922: 0x135b, 0x923: 0x135f, - 0x924: 0x13a3, 0x925: 0x13a7, 0x926: 0x13ff, 0x927: 0x1407, 0x928: 0x14db, 0x929: 0x151f, - 0x92a: 0x1537, 0x92b: 0x0b9b, 0x92c: 0x171e, 0x92d: 0x11e3, - 0x930: 0x06df, 0x931: 0x07e3, 0x932: 0x07a3, 0x933: 0x074b, 0x934: 0x078b, 0x935: 0x07b7, - 0x936: 0x0847, 0x937: 0x0863, 0x938: 0x094b, 0x939: 0x0937, 0x93a: 0x0947, 0x93b: 0x0963, - 0x93c: 0x09af, 0x93d: 0x09bf, 0x93e: 0x0a03, 0x93f: 0x0a0f, - // Block 0x25, offset 0x940 - 0x940: 0x0a2b, 0x941: 0x0a3b, 0x942: 0x0b23, 0x943: 0x0b2b, 0x944: 0x0b5b, 0x945: 0x0b7b, - 0x946: 0x0bab, 0x947: 0x0bc3, 0x948: 0x0bb3, 0x949: 0x0bd3, 0x94a: 0x0bc7, 0x94b: 0x0beb, - 0x94c: 0x0c07, 0x94d: 0x0c5f, 0x94e: 0x0c6b, 0x94f: 0x0c73, 0x950: 0x0c9b, 0x951: 0x0cdf, - 0x952: 0x0d0f, 0x953: 0x0d13, 0x954: 0x0d27, 0x955: 0x0da7, 0x956: 0x0db7, 0x957: 0x0e0f, - 0x958: 0x0e5b, 0x959: 0x0e53, 0x95a: 0x0e67, 0x95b: 0x0e83, 0x95c: 0x0ebb, 0x95d: 0x1013, - 0x95e: 0x0edf, 0x95f: 0x0f13, 0x960: 0x0f1f, 0x961: 0x0f5f, 0x962: 0x0f7b, 0x963: 0x0f9f, - 0x964: 0x0fc3, 0x965: 0x0fc7, 0x966: 0x0fe3, 0x967: 0x0fe7, 0x968: 0x0ff7, 0x969: 0x100b, - 0x96a: 0x1007, 0x96b: 0x1037, 0x96c: 0x10b3, 0x96d: 0x10cb, 0x96e: 0x10e3, 0x96f: 0x111b, - 0x970: 0x112f, 0x971: 0x114b, 0x972: 0x117b, 0x973: 0x122f, 0x974: 0x1257, 0x975: 0x12cb, - 0x976: 0x1313, 0x977: 0x131f, 0x978: 0x1327, 0x979: 0x133f, 0x97a: 0x1353, 0x97b: 0x1343, - 0x97c: 0x135b, 0x97d: 0x1357, 0x97e: 0x134f, 0x97f: 0x135f, - // Block 0x26, offset 0x980 - 0x980: 0x136b, 0x981: 0x13a7, 0x982: 0x13e3, 0x983: 0x1413, 0x984: 0x144b, 0x985: 0x146b, - 0x986: 0x14b7, 0x987: 0x14db, 0x988: 0x14fb, 0x989: 0x150f, 0x98a: 0x151f, 0x98b: 0x152b, - 0x98c: 0x1537, 0x98d: 0x158b, 0x98e: 0x162b, 0x98f: 0x16b5, 0x990: 0x16b0, 0x991: 0x16e2, - 0x992: 0x0607, 0x993: 0x062f, 0x994: 0x0633, 0x995: 0x1764, 0x996: 0x1791, 0x997: 0x1809, - 0x998: 0x1617, 0x999: 0x1627, - // Block 0x27, offset 0x9c0 - 0x9c0: 0x06fb, 0x9c1: 0x06f3, 0x9c2: 0x0703, 0x9c3: 0x1647, 0x9c4: 0x0747, 0x9c5: 0x0757, - 0x9c6: 0x075b, 0x9c7: 0x0763, 0x9c8: 0x076b, 0x9c9: 0x076f, 0x9ca: 0x077b, 0x9cb: 0x0773, - 0x9cc: 0x05b3, 0x9cd: 0x165b, 0x9ce: 0x078f, 0x9cf: 0x0793, 0x9d0: 0x0797, 0x9d1: 0x07b3, - 0x9d2: 0x164c, 0x9d3: 0x05b7, 0x9d4: 0x079f, 0x9d5: 0x07bf, 0x9d6: 0x1656, 0x9d7: 0x07cf, - 0x9d8: 0x07d7, 0x9d9: 0x0737, 0x9da: 0x07df, 0x9db: 0x07e3, 0x9dc: 0x1831, 0x9dd: 0x07ff, - 0x9de: 0x0807, 0x9df: 0x05bf, 0x9e0: 0x081f, 0x9e1: 0x0823, 0x9e2: 0x082b, 0x9e3: 0x082f, - 0x9e4: 0x05c3, 0x9e5: 0x0847, 0x9e6: 0x084b, 0x9e7: 0x0857, 0x9e8: 0x0863, 0x9e9: 0x0867, - 0x9ea: 0x086b, 0x9eb: 0x0873, 0x9ec: 0x0893, 0x9ed: 0x0897, 0x9ee: 0x089f, 0x9ef: 0x08af, - 0x9f0: 0x08b7, 0x9f1: 0x08bb, 0x9f2: 0x08bb, 0x9f3: 0x08bb, 0x9f4: 0x166a, 0x9f5: 0x0e93, - 0x9f6: 0x08cf, 0x9f7: 0x08d7, 0x9f8: 0x166f, 0x9f9: 0x08e3, 0x9fa: 0x08eb, 0x9fb: 0x08f3, - 0x9fc: 0x091b, 0x9fd: 0x0907, 0x9fe: 0x0913, 0x9ff: 0x0917, - // Block 0x28, offset 0xa00 - 0xa00: 0x091f, 0xa01: 0x0927, 0xa02: 0x092b, 0xa03: 0x0933, 0xa04: 0x093b, 0xa05: 0x093f, - 0xa06: 0x093f, 0xa07: 0x0947, 0xa08: 0x094f, 0xa09: 0x0953, 0xa0a: 0x095f, 0xa0b: 0x0983, - 0xa0c: 0x0967, 0xa0d: 0x0987, 0xa0e: 0x096b, 0xa0f: 0x0973, 0xa10: 0x080b, 0xa11: 0x09cf, - 0xa12: 0x0997, 0xa13: 0x099b, 0xa14: 0x099f, 0xa15: 0x0993, 0xa16: 0x09a7, 0xa17: 0x09a3, - 0xa18: 0x09bb, 0xa19: 0x1674, 0xa1a: 0x09d7, 0xa1b: 0x09db, 0xa1c: 0x09e3, 0xa1d: 0x09ef, - 0xa1e: 0x09f7, 0xa1f: 0x0a13, 0xa20: 0x1679, 0xa21: 0x167e, 0xa22: 0x0a1f, 0xa23: 0x0a23, - 0xa24: 0x0a27, 0xa25: 0x0a1b, 0xa26: 0x0a2f, 0xa27: 0x05c7, 0xa28: 0x05cb, 0xa29: 0x0a37, - 0xa2a: 0x0a3f, 0xa2b: 0x0a3f, 0xa2c: 0x1683, 0xa2d: 0x0a5b, 0xa2e: 0x0a5f, 0xa2f: 0x0a63, - 0xa30: 0x0a6b, 0xa31: 0x1688, 0xa32: 0x0a73, 0xa33: 0x0a77, 0xa34: 0x0b4f, 0xa35: 0x0a7f, - 0xa36: 0x05cf, 0xa37: 0x0a8b, 0xa38: 0x0a9b, 0xa39: 0x0aa7, 0xa3a: 0x0aa3, 0xa3b: 0x1692, - 0xa3c: 0x0aaf, 0xa3d: 0x1697, 0xa3e: 0x0abb, 0xa3f: 0x0ab7, - // Block 0x29, offset 0xa40 - 0xa40: 0x0abf, 0xa41: 0x0acf, 0xa42: 0x0ad3, 0xa43: 0x05d3, 0xa44: 0x0ae3, 0xa45: 0x0aeb, - 0xa46: 0x0aef, 0xa47: 0x0af3, 0xa48: 0x05d7, 0xa49: 0x169c, 0xa4a: 0x05db, 0xa4b: 0x0b0f, - 0xa4c: 0x0b13, 0xa4d: 0x0b17, 0xa4e: 0x0b1f, 0xa4f: 0x1863, 0xa50: 0x0b37, 0xa51: 0x16a6, - 0xa52: 0x16a6, 0xa53: 0x11d7, 0xa54: 0x0b47, 0xa55: 0x0b47, 0xa56: 0x05df, 0xa57: 0x16c9, - 0xa58: 0x179b, 0xa59: 0x0b57, 0xa5a: 0x0b5f, 0xa5b: 0x05e3, 0xa5c: 0x0b73, 0xa5d: 0x0b83, - 0xa5e: 0x0b87, 0xa5f: 0x0b8f, 0xa60: 0x0b9f, 0xa61: 0x05eb, 0xa62: 0x05e7, 0xa63: 0x0ba3, - 0xa64: 0x16ab, 0xa65: 0x0ba7, 0xa66: 0x0bbb, 0xa67: 0x0bbf, 0xa68: 0x0bc3, 0xa69: 0x0bbf, - 0xa6a: 0x0bcf, 0xa6b: 0x0bd3, 0xa6c: 0x0be3, 0xa6d: 0x0bdb, 0xa6e: 0x0bdf, 0xa6f: 0x0be7, - 0xa70: 0x0beb, 0xa71: 0x0bef, 0xa72: 0x0bfb, 0xa73: 0x0bff, 0xa74: 0x0c17, 0xa75: 0x0c1f, - 0xa76: 0x0c2f, 0xa77: 0x0c43, 0xa78: 0x16ba, 0xa79: 0x0c3f, 0xa7a: 0x0c33, 0xa7b: 0x0c4b, - 0xa7c: 0x0c53, 0xa7d: 0x0c67, 0xa7e: 0x16bf, 0xa7f: 0x0c6f, - // Block 0x2a, offset 0xa80 - 0xa80: 0x0c63, 0xa81: 0x0c5b, 0xa82: 0x05ef, 0xa83: 0x0c77, 0xa84: 0x0c7f, 0xa85: 0x0c87, - 0xa86: 0x0c7b, 0xa87: 0x05f3, 0xa88: 0x0c97, 0xa89: 0x0c9f, 0xa8a: 0x16c4, 0xa8b: 0x0ccb, - 0xa8c: 0x0cff, 0xa8d: 0x0cdb, 0xa8e: 0x05ff, 0xa8f: 0x0ce7, 0xa90: 0x05fb, 0xa91: 0x05f7, - 0xa92: 0x07c3, 0xa93: 0x07c7, 0xa94: 0x0d03, 0xa95: 0x0ceb, 0xa96: 0x11ab, 0xa97: 0x0663, - 0xa98: 0x0d0f, 0xa99: 0x0d13, 0xa9a: 0x0d17, 0xa9b: 0x0d2b, 0xa9c: 0x0d23, 0xa9d: 0x16dd, - 0xa9e: 0x0603, 0xa9f: 0x0d3f, 0xaa0: 0x0d33, 0xaa1: 0x0d4f, 0xaa2: 0x0d57, 0xaa3: 0x16e7, - 0xaa4: 0x0d5b, 0xaa5: 0x0d47, 0xaa6: 0x0d63, 0xaa7: 0x0607, 0xaa8: 0x0d67, 0xaa9: 0x0d6b, - 0xaaa: 0x0d6f, 0xaab: 0x0d7b, 0xaac: 0x16ec, 0xaad: 0x0d83, 0xaae: 0x060b, 0xaaf: 0x0d8f, - 0xab0: 0x16f1, 0xab1: 0x0d93, 0xab2: 0x060f, 0xab3: 0x0d9f, 0xab4: 0x0dab, 0xab5: 0x0db7, - 0xab6: 0x0dbb, 0xab7: 0x16f6, 0xab8: 0x168d, 0xab9: 0x16fb, 0xaba: 0x0ddb, 0xabb: 0x1700, - 0xabc: 0x0de7, 0xabd: 0x0def, 0xabe: 0x0ddf, 0xabf: 0x0dfb, - // Block 0x2b, offset 0xac0 - 0xac0: 0x0e0b, 0xac1: 0x0e1b, 0xac2: 0x0e0f, 0xac3: 0x0e13, 0xac4: 0x0e1f, 0xac5: 0x0e23, - 0xac6: 0x1705, 0xac7: 0x0e07, 0xac8: 0x0e3b, 0xac9: 0x0e3f, 0xaca: 0x0613, 0xacb: 0x0e53, - 0xacc: 0x0e4f, 0xacd: 0x170a, 0xace: 0x0e33, 0xacf: 0x0e6f, 0xad0: 0x170f, 0xad1: 0x1714, - 0xad2: 0x0e73, 0xad3: 0x0e87, 0xad4: 0x0e83, 0xad5: 0x0e7f, 0xad6: 0x0617, 0xad7: 0x0e8b, - 0xad8: 0x0e9b, 0xad9: 0x0e97, 0xada: 0x0ea3, 0xadb: 0x1651, 0xadc: 0x0eb3, 0xadd: 0x1719, - 0xade: 0x0ebf, 0xadf: 0x1723, 0xae0: 0x0ed3, 0xae1: 0x0edf, 0xae2: 0x0ef3, 0xae3: 0x1728, - 0xae4: 0x0f07, 0xae5: 0x0f0b, 0xae6: 0x172d, 0xae7: 0x1732, 0xae8: 0x0f27, 0xae9: 0x0f37, - 0xaea: 0x061b, 0xaeb: 0x0f3b, 0xaec: 0x061f, 0xaed: 0x061f, 0xaee: 0x0f53, 0xaef: 0x0f57, - 0xaf0: 0x0f5f, 0xaf1: 0x0f63, 0xaf2: 0x0f6f, 0xaf3: 0x0623, 0xaf4: 0x0f87, 0xaf5: 0x1737, - 0xaf6: 0x0fa3, 0xaf7: 0x173c, 0xaf8: 0x0faf, 0xaf9: 0x16a1, 0xafa: 0x0fbf, 0xafb: 0x1741, - 0xafc: 0x1746, 0xafd: 0x174b, 0xafe: 0x0627, 0xaff: 0x062b, - // Block 0x2c, offset 0xb00 - 0xb00: 0x0ff7, 0xb01: 0x1755, 0xb02: 0x1750, 0xb03: 0x175a, 0xb04: 0x175f, 0xb05: 0x0fff, - 0xb06: 0x1003, 0xb07: 0x1003, 0xb08: 0x100b, 0xb09: 0x0633, 0xb0a: 0x100f, 0xb0b: 0x0637, - 0xb0c: 0x063b, 0xb0d: 0x1769, 0xb0e: 0x1023, 0xb0f: 0x102b, 0xb10: 0x1037, 0xb11: 0x063f, - 0xb12: 0x176e, 0xb13: 0x105b, 0xb14: 0x1773, 0xb15: 0x1778, 0xb16: 0x107b, 0xb17: 0x1093, - 0xb18: 0x0643, 0xb19: 0x109b, 0xb1a: 0x109f, 0xb1b: 0x10a3, 0xb1c: 0x177d, 0xb1d: 0x1782, - 0xb1e: 0x1782, 0xb1f: 0x10bb, 0xb20: 0x0647, 0xb21: 0x1787, 0xb22: 0x10cf, 0xb23: 0x10d3, - 0xb24: 0x064b, 0xb25: 0x178c, 0xb26: 0x10ef, 0xb27: 0x064f, 0xb28: 0x10ff, 0xb29: 0x10f7, - 0xb2a: 0x1107, 0xb2b: 0x1796, 0xb2c: 0x111f, 0xb2d: 0x0653, 0xb2e: 0x112b, 0xb2f: 0x1133, - 0xb30: 0x1143, 0xb31: 0x0657, 0xb32: 0x17a0, 0xb33: 0x17a5, 0xb34: 0x065b, 0xb35: 0x17aa, - 0xb36: 0x115b, 0xb37: 0x17af, 0xb38: 0x1167, 0xb39: 0x1173, 0xb3a: 0x117b, 0xb3b: 0x17b4, - 0xb3c: 0x17b9, 0xb3d: 0x118f, 0xb3e: 0x17be, 0xb3f: 0x1197, - // Block 0x2d, offset 0xb40 - 0xb40: 0x16ce, 0xb41: 0x065f, 0xb42: 0x11af, 0xb43: 0x11b3, 0xb44: 0x0667, 0xb45: 0x11b7, - 0xb46: 0x0a33, 0xb47: 0x17c3, 0xb48: 0x17c8, 0xb49: 0x16d3, 0xb4a: 0x16d8, 0xb4b: 0x11d7, - 0xb4c: 0x11db, 0xb4d: 0x13f3, 0xb4e: 0x066b, 0xb4f: 0x1207, 0xb50: 0x1203, 0xb51: 0x120b, - 0xb52: 0x083f, 0xb53: 0x120f, 0xb54: 0x1213, 0xb55: 0x1217, 0xb56: 0x121f, 0xb57: 0x17cd, - 0xb58: 0x121b, 0xb59: 0x1223, 0xb5a: 0x1237, 0xb5b: 0x123b, 0xb5c: 0x1227, 0xb5d: 0x123f, - 0xb5e: 0x1253, 0xb5f: 0x1267, 0xb60: 0x1233, 0xb61: 0x1247, 0xb62: 0x124b, 0xb63: 0x124f, - 0xb64: 0x17d2, 0xb65: 0x17dc, 0xb66: 0x17d7, 0xb67: 0x066f, 0xb68: 0x126f, 0xb69: 0x1273, - 0xb6a: 0x127b, 0xb6b: 0x17f0, 0xb6c: 0x127f, 0xb6d: 0x17e1, 0xb6e: 0x0673, 0xb6f: 0x0677, - 0xb70: 0x17e6, 0xb71: 0x17eb, 0xb72: 0x067b, 0xb73: 0x129f, 0xb74: 0x12a3, 0xb75: 0x12a7, - 0xb76: 0x12ab, 0xb77: 0x12b7, 0xb78: 0x12b3, 0xb79: 0x12bf, 0xb7a: 0x12bb, 0xb7b: 0x12cb, - 0xb7c: 0x12c3, 0xb7d: 0x12c7, 0xb7e: 0x12cf, 0xb7f: 0x067f, - // Block 0x2e, offset 0xb80 - 0xb80: 0x12d7, 0xb81: 0x12db, 0xb82: 0x0683, 0xb83: 0x12eb, 0xb84: 0x12ef, 0xb85: 0x17f5, - 0xb86: 0x12fb, 0xb87: 0x12ff, 0xb88: 0x0687, 0xb89: 0x130b, 0xb8a: 0x05bb, 0xb8b: 0x17fa, - 0xb8c: 0x17ff, 0xb8d: 0x068b, 0xb8e: 0x068f, 0xb8f: 0x1337, 0xb90: 0x134f, 0xb91: 0x136b, - 0xb92: 0x137b, 0xb93: 0x1804, 0xb94: 0x138f, 0xb95: 0x1393, 0xb96: 0x13ab, 0xb97: 0x13b7, - 0xb98: 0x180e, 0xb99: 0x1660, 0xb9a: 0x13c3, 0xb9b: 0x13bf, 0xb9c: 0x13cb, 0xb9d: 0x1665, - 0xb9e: 0x13d7, 0xb9f: 0x13e3, 0xba0: 0x1813, 0xba1: 0x1818, 0xba2: 0x1423, 0xba3: 0x142f, - 0xba4: 0x1437, 0xba5: 0x181d, 0xba6: 0x143b, 0xba7: 0x1467, 0xba8: 0x1473, 0xba9: 0x1477, - 0xbaa: 0x146f, 0xbab: 0x1483, 0xbac: 0x1487, 0xbad: 0x1822, 0xbae: 0x1493, 0xbaf: 0x0693, - 0xbb0: 0x149b, 0xbb1: 0x1827, 0xbb2: 0x0697, 0xbb3: 0x14d3, 0xbb4: 0x0ac3, 0xbb5: 0x14eb, - 0xbb6: 0x182c, 0xbb7: 0x1836, 0xbb8: 0x069b, 0xbb9: 0x069f, 0xbba: 0x1513, 0xbbb: 0x183b, - 0xbbc: 0x06a3, 0xbbd: 0x1840, 0xbbe: 0x152b, 0xbbf: 0x152b, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x1533, 0xbc1: 0x1845, 0xbc2: 0x154b, 0xbc3: 0x06a7, 0xbc4: 0x155b, 0xbc5: 0x1567, - 0xbc6: 0x156f, 0xbc7: 0x1577, 0xbc8: 0x06ab, 0xbc9: 0x184a, 0xbca: 0x158b, 0xbcb: 0x15a7, - 0xbcc: 0x15b3, 0xbcd: 0x06af, 0xbce: 0x06b3, 0xbcf: 0x15b7, 0xbd0: 0x184f, 0xbd1: 0x06b7, - 0xbd2: 0x1854, 0xbd3: 0x1859, 0xbd4: 0x185e, 0xbd5: 0x15db, 0xbd6: 0x06bb, 0xbd7: 0x15ef, - 0xbd8: 0x15f7, 0xbd9: 0x15fb, 0xbda: 0x1603, 0xbdb: 0x160b, 0xbdc: 0x1613, 0xbdd: 0x1868, -} - -// nfcIndex: 22 blocks, 1408 entries, 1408 bytes -// Block 0 is the zero block. -var nfcIndex = [1408]uint8{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x2e, 0xc3: 0x01, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x2f, 0xc7: 0x04, - 0xc8: 0x05, 0xca: 0x30, 0xcb: 0x31, 0xcc: 0x06, 0xcd: 0x07, 0xce: 0x08, 0xcf: 0x32, - 0xd0: 0x09, 0xd1: 0x33, 0xd2: 0x34, 0xd3: 0x0a, 0xd6: 0x0b, 0xd7: 0x35, - 0xd8: 0x36, 0xd9: 0x0c, 0xdb: 0x37, 0xdc: 0x38, 0xdd: 0x39, 0xdf: 0x3a, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, - 0xea: 0x06, 0xeb: 0x07, 0xec: 0x08, 0xed: 0x09, 0xef: 0x0a, - 0xf0: 0x13, - // Block 0x4, offset 0x100 - 0x120: 0x3b, 0x121: 0x3c, 0x123: 0x0d, 0x124: 0x3d, 0x125: 0x3e, 0x126: 0x3f, 0x127: 0x40, - 0x128: 0x41, 0x129: 0x42, 0x12a: 0x43, 0x12b: 0x44, 0x12c: 0x3f, 0x12d: 0x45, 0x12e: 0x46, 0x12f: 0x47, - 0x131: 0x48, 0x132: 0x49, 0x133: 0x4a, 0x134: 0x4b, 0x135: 0x4c, 0x137: 0x4d, - 0x138: 0x4e, 0x139: 0x4f, 0x13a: 0x50, 0x13b: 0x51, 0x13c: 0x52, 0x13d: 0x53, 0x13e: 0x54, 0x13f: 0x55, - // Block 0x5, offset 0x140 - 0x140: 0x56, 0x142: 0x57, 0x144: 0x58, 0x145: 0x59, 0x146: 0x5a, 0x147: 0x5b, - 0x14d: 0x5c, - 0x15c: 0x5d, 0x15f: 0x5e, - 0x162: 0x5f, 0x164: 0x60, - 0x168: 0x61, 0x169: 0x62, 0x16a: 0x63, 0x16c: 0x0e, 0x16d: 0x64, 0x16e: 0x65, 0x16f: 0x66, - 0x170: 0x67, 0x173: 0x68, 0x177: 0x0f, - 0x178: 0x10, 0x179: 0x11, 0x17a: 0x12, 0x17b: 0x13, 0x17c: 0x14, 0x17d: 0x15, 0x17e: 0x16, 0x17f: 0x17, - // Block 0x6, offset 0x180 - 0x180: 0x69, 0x183: 0x6a, 0x184: 0x6b, 0x186: 0x6c, 0x187: 0x6d, - 0x188: 0x6e, 0x189: 0x18, 0x18a: 0x19, 0x18b: 0x6f, 0x18c: 0x70, - 0x1ab: 0x71, - 0x1b3: 0x72, 0x1b5: 0x73, 0x1b7: 0x74, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x75, 0x1c1: 0x1a, 0x1c2: 0x1b, 0x1c3: 0x1c, 0x1c4: 0x76, 0x1c5: 0x77, - 0x1c9: 0x78, 0x1cc: 0x79, 0x1cd: 0x7a, - // Block 0x8, offset 0x200 - 0x219: 0x7b, 0x21a: 0x7c, 0x21b: 0x7d, - 0x220: 0x7e, 0x223: 0x7f, 0x224: 0x80, 0x225: 0x81, 0x226: 0x82, 0x227: 0x83, - 0x22a: 0x84, 0x22b: 0x85, 0x22f: 0x86, - 0x230: 0x87, 0x231: 0x88, 0x232: 0x89, 0x233: 0x8a, 0x234: 0x8b, 0x235: 0x8c, 0x236: 0x8d, 0x237: 0x87, - 0x238: 0x88, 0x239: 0x89, 0x23a: 0x8a, 0x23b: 0x8b, 0x23c: 0x8c, 0x23d: 0x8d, 0x23e: 0x87, 0x23f: 0x88, - // Block 0x9, offset 0x240 - 0x240: 0x89, 0x241: 0x8a, 0x242: 0x8b, 0x243: 0x8c, 0x244: 0x8d, 0x245: 0x87, 0x246: 0x88, 0x247: 0x89, - 0x248: 0x8a, 0x249: 0x8b, 0x24a: 0x8c, 0x24b: 0x8d, 0x24c: 0x87, 0x24d: 0x88, 0x24e: 0x89, 0x24f: 0x8a, - 0x250: 0x8b, 0x251: 0x8c, 0x252: 0x8d, 0x253: 0x87, 0x254: 0x88, 0x255: 0x89, 0x256: 0x8a, 0x257: 0x8b, - 0x258: 0x8c, 0x259: 0x8d, 0x25a: 0x87, 0x25b: 0x88, 0x25c: 0x89, 0x25d: 0x8a, 0x25e: 0x8b, 0x25f: 0x8c, - 0x260: 0x8d, 0x261: 0x87, 0x262: 0x88, 0x263: 0x89, 0x264: 0x8a, 0x265: 0x8b, 0x266: 0x8c, 0x267: 0x8d, - 0x268: 0x87, 0x269: 0x88, 0x26a: 0x89, 0x26b: 0x8a, 0x26c: 0x8b, 0x26d: 0x8c, 0x26e: 0x8d, 0x26f: 0x87, - 0x270: 0x88, 0x271: 0x89, 0x272: 0x8a, 0x273: 0x8b, 0x274: 0x8c, 0x275: 0x8d, 0x276: 0x87, 0x277: 0x88, - 0x278: 0x89, 0x279: 0x8a, 0x27a: 0x8b, 0x27b: 0x8c, 0x27c: 0x8d, 0x27d: 0x87, 0x27e: 0x88, 0x27f: 0x89, - // Block 0xa, offset 0x280 - 0x280: 0x8a, 0x281: 0x8b, 0x282: 0x8c, 0x283: 0x8d, 0x284: 0x87, 0x285: 0x88, 0x286: 0x89, 0x287: 0x8a, - 0x288: 0x8b, 0x289: 0x8c, 0x28a: 0x8d, 0x28b: 0x87, 0x28c: 0x88, 0x28d: 0x89, 0x28e: 0x8a, 0x28f: 0x8b, - 0x290: 0x8c, 0x291: 0x8d, 0x292: 0x87, 0x293: 0x88, 0x294: 0x89, 0x295: 0x8a, 0x296: 0x8b, 0x297: 0x8c, - 0x298: 0x8d, 0x299: 0x87, 0x29a: 0x88, 0x29b: 0x89, 0x29c: 0x8a, 0x29d: 0x8b, 0x29e: 0x8c, 0x29f: 0x8d, - 0x2a0: 0x87, 0x2a1: 0x88, 0x2a2: 0x89, 0x2a3: 0x8a, 0x2a4: 0x8b, 0x2a5: 0x8c, 0x2a6: 0x8d, 0x2a7: 0x87, - 0x2a8: 0x88, 0x2a9: 0x89, 0x2aa: 0x8a, 0x2ab: 0x8b, 0x2ac: 0x8c, 0x2ad: 0x8d, 0x2ae: 0x87, 0x2af: 0x88, - 0x2b0: 0x89, 0x2b1: 0x8a, 0x2b2: 0x8b, 0x2b3: 0x8c, 0x2b4: 0x8d, 0x2b5: 0x87, 0x2b6: 0x88, 0x2b7: 0x89, - 0x2b8: 0x8a, 0x2b9: 0x8b, 0x2ba: 0x8c, 0x2bb: 0x8d, 0x2bc: 0x87, 0x2bd: 0x88, 0x2be: 0x89, 0x2bf: 0x8a, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x8b, 0x2c1: 0x8c, 0x2c2: 0x8d, 0x2c3: 0x87, 0x2c4: 0x88, 0x2c5: 0x89, 0x2c6: 0x8a, 0x2c7: 0x8b, - 0x2c8: 0x8c, 0x2c9: 0x8d, 0x2ca: 0x87, 0x2cb: 0x88, 0x2cc: 0x89, 0x2cd: 0x8a, 0x2ce: 0x8b, 0x2cf: 0x8c, - 0x2d0: 0x8d, 0x2d1: 0x87, 0x2d2: 0x88, 0x2d3: 0x89, 0x2d4: 0x8a, 0x2d5: 0x8b, 0x2d6: 0x8c, 0x2d7: 0x8d, - 0x2d8: 0x87, 0x2d9: 0x88, 0x2da: 0x89, 0x2db: 0x8a, 0x2dc: 0x8b, 0x2dd: 0x8c, 0x2de: 0x8e, - // Block 0xc, offset 0x300 - 0x324: 0x1d, 0x325: 0x1e, 0x326: 0x1f, 0x327: 0x20, - 0x328: 0x21, 0x329: 0x22, 0x32a: 0x23, 0x32b: 0x24, 0x32c: 0x8f, 0x32d: 0x90, 0x32e: 0x91, - 0x331: 0x92, 0x332: 0x93, 0x333: 0x94, 0x334: 0x95, - 0x338: 0x96, 0x339: 0x97, 0x33a: 0x98, 0x33b: 0x99, 0x33e: 0x9a, 0x33f: 0x9b, - // Block 0xd, offset 0x340 - 0x347: 0x9c, - 0x34b: 0x9d, 0x34d: 0x9e, - 0x368: 0x9f, 0x36b: 0xa0, - 0x374: 0xa1, - 0x37d: 0xa2, - // Block 0xe, offset 0x380 - 0x381: 0xa3, 0x382: 0xa4, 0x384: 0xa5, 0x385: 0x82, 0x387: 0xa6, - 0x388: 0xa7, 0x38b: 0xa8, 0x38c: 0xa9, 0x38d: 0xaa, - 0x391: 0xab, 0x392: 0xac, 0x393: 0xad, 0x396: 0xae, 0x397: 0xaf, - 0x398: 0x73, 0x39a: 0xb0, 0x39c: 0xb1, - 0x3a0: 0xb2, - 0x3a8: 0xb3, 0x3a9: 0xb4, 0x3aa: 0xb5, - 0x3b0: 0x73, 0x3b5: 0xb6, 0x3b6: 0xb7, - // Block 0xf, offset 0x3c0 - 0x3eb: 0xb8, 0x3ec: 0xb9, - // Block 0x10, offset 0x400 - 0x432: 0xba, - // Block 0x11, offset 0x440 - 0x445: 0xbb, 0x446: 0xbc, 0x447: 0xbd, - 0x449: 0xbe, - // Block 0x12, offset 0x480 - 0x480: 0xbf, - 0x4a3: 0xc0, 0x4a5: 0xc1, - // Block 0x13, offset 0x4c0 - 0x4c8: 0xc2, - // Block 0x14, offset 0x500 - 0x520: 0x25, 0x521: 0x26, 0x522: 0x27, 0x523: 0x28, 0x524: 0x29, 0x525: 0x2a, 0x526: 0x2b, 0x527: 0x2c, - 0x528: 0x2d, - // Block 0x15, offset 0x540 - 0x550: 0x0b, 0x551: 0x0c, 0x556: 0x0d, - 0x55b: 0x0e, 0x55d: 0x0f, 0x55e: 0x10, 0x55f: 0x11, - 0x56f: 0x12, -} - -// nfcSparseOffset: 149 entries, 298 bytes -var nfcSparseOffset = []uint16{0x0, 0x5, 0x9, 0xb, 0xd, 0x18, 0x28, 0x2a, 0x2f, 0x3a, 0x49, 0x56, 0x5e, 0x63, 0x68, 0x6a, 0x72, 0x79, 0x7c, 0x84, 0x88, 0x8c, 0x8e, 0x90, 0x99, 0x9d, 0xa4, 0xa9, 0xac, 0xb6, 0xb9, 0xc0, 0xc8, 0xcb, 0xcd, 0xcf, 0xd1, 0xd6, 0xe7, 0xf3, 0xf5, 0xfb, 0xfd, 0xff, 0x101, 0x103, 0x105, 0x107, 0x10a, 0x10d, 0x10f, 0x112, 0x115, 0x119, 0x11e, 0x127, 0x129, 0x12c, 0x12e, 0x139, 0x13d, 0x14b, 0x14e, 0x154, 0x15a, 0x165, 0x169, 0x16b, 0x16d, 0x16f, 0x171, 0x173, 0x179, 0x17d, 0x17f, 0x181, 0x189, 0x18d, 0x190, 0x192, 0x194, 0x196, 0x199, 0x19b, 0x19d, 0x19f, 0x1a1, 0x1a7, 0x1aa, 0x1ac, 0x1b3, 0x1b9, 0x1bf, 0x1c7, 0x1cd, 0x1d3, 0x1d9, 0x1dd, 0x1eb, 0x1f4, 0x1f7, 0x1fa, 0x1fc, 0x1ff, 0x201, 0x205, 0x20a, 0x20c, 0x20e, 0x213, 0x219, 0x21b, 0x21d, 0x21f, 0x225, 0x228, 0x22a, 0x230, 0x233, 0x23b, 0x242, 0x245, 0x248, 0x24a, 0x24d, 0x255, 0x259, 0x260, 0x263, 0x269, 0x26b, 0x26e, 0x270, 0x273, 0x275, 0x277, 0x279, 0x27c, 0x27e, 0x280, 0x282, 0x284, 0x291, 0x29b, 0x29d, 0x29f, 0x2a5, 0x2a7, 0x2aa} - -// nfcSparseValues: 684 entries, 2736 bytes -var nfcSparseValues = [684]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0000, lo: 0x04}, - {value: 0xa100, lo: 0xa8, hi: 0xa8}, - {value: 0x8100, lo: 0xaf, hi: 0xaf}, - {value: 0x8100, lo: 0xb4, hi: 0xb4}, - {value: 0x8100, lo: 0xb8, hi: 0xb8}, - // Block 0x1, offset 0x5 - {value: 0x0091, lo: 0x03}, - {value: 0x46e2, lo: 0xa0, hi: 0xa1}, - {value: 0x4714, lo: 0xaf, hi: 0xb0}, - {value: 0xa000, lo: 0xb7, hi: 0xb7}, - // Block 0x2, offset 0x9 - {value: 0x0000, lo: 0x01}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - // Block 0x3, offset 0xb - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0x98, hi: 0x9d}, - // Block 0x4, offset 0xd - {value: 0x0006, lo: 0x0a}, - {value: 0xa000, lo: 0x81, hi: 0x81}, - {value: 0xa000, lo: 0x85, hi: 0x85}, - {value: 0xa000, lo: 0x89, hi: 0x89}, - {value: 0x4840, lo: 0x8a, hi: 0x8a}, - {value: 0x485e, lo: 0x8b, hi: 0x8b}, - {value: 0x36c7, lo: 0x8c, hi: 0x8c}, - {value: 0x36df, lo: 0x8d, hi: 0x8d}, - {value: 0x4876, lo: 0x8e, hi: 0x8e}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x36fd, lo: 0x93, hi: 0x94}, - // Block 0x5, offset 0x18 - {value: 0x0000, lo: 0x0f}, - {value: 0xa000, lo: 0x83, hi: 0x83}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0xa000, lo: 0x8b, hi: 0x8b}, - {value: 0xa000, lo: 0x8d, hi: 0x8d}, - {value: 0x37a5, lo: 0x90, hi: 0x90}, - {value: 0x37b1, lo: 0x91, hi: 0x91}, - {value: 0x379f, lo: 0x93, hi: 0x93}, - {value: 0xa000, lo: 0x96, hi: 0x96}, - {value: 0x3817, lo: 0x97, hi: 0x97}, - {value: 0x37e1, lo: 0x9c, hi: 0x9c}, - {value: 0x37c9, lo: 0x9d, hi: 0x9d}, - {value: 0x37f3, lo: 0x9e, hi: 0x9e}, - {value: 0xa000, lo: 0xb4, hi: 0xb5}, - {value: 0x381d, lo: 0xb6, hi: 0xb6}, - {value: 0x3823, lo: 0xb7, hi: 0xb7}, - // Block 0x6, offset 0x28 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x83, hi: 0x87}, - // Block 0x7, offset 0x2a - {value: 0x0001, lo: 0x04}, - {value: 0x8113, lo: 0x81, hi: 0x82}, - {value: 0x8132, lo: 0x84, hi: 0x84}, - {value: 0x812d, lo: 0x85, hi: 0x85}, - {value: 0x810d, lo: 0x87, hi: 0x87}, - // Block 0x8, offset 0x2f - {value: 0x0000, lo: 0x0a}, - {value: 0x8132, lo: 0x90, hi: 0x97}, - {value: 0x8119, lo: 0x98, hi: 0x98}, - {value: 0x811a, lo: 0x99, hi: 0x99}, - {value: 0x811b, lo: 0x9a, hi: 0x9a}, - {value: 0x3841, lo: 0xa2, hi: 0xa2}, - {value: 0x3847, lo: 0xa3, hi: 0xa3}, - {value: 0x3853, lo: 0xa4, hi: 0xa4}, - {value: 0x384d, lo: 0xa5, hi: 0xa5}, - {value: 0x3859, lo: 0xa6, hi: 0xa6}, - {value: 0xa000, lo: 0xa7, hi: 0xa7}, - // Block 0x9, offset 0x3a - {value: 0x0000, lo: 0x0e}, - {value: 0x386b, lo: 0x80, hi: 0x80}, - {value: 0xa000, lo: 0x81, hi: 0x81}, - {value: 0x385f, lo: 0x82, hi: 0x82}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x3865, lo: 0x93, hi: 0x93}, - {value: 0xa000, lo: 0x95, hi: 0x95}, - {value: 0x8132, lo: 0x96, hi: 0x9c}, - {value: 0x8132, lo: 0x9f, hi: 0xa2}, - {value: 0x812d, lo: 0xa3, hi: 0xa3}, - {value: 0x8132, lo: 0xa4, hi: 0xa4}, - {value: 0x8132, lo: 0xa7, hi: 0xa8}, - {value: 0x812d, lo: 0xaa, hi: 0xaa}, - {value: 0x8132, lo: 0xab, hi: 0xac}, - {value: 0x812d, lo: 0xad, hi: 0xad}, - // Block 0xa, offset 0x49 - {value: 0x0000, lo: 0x0c}, - {value: 0x811f, lo: 0x91, hi: 0x91}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - {value: 0x812d, lo: 0xb1, hi: 0xb1}, - {value: 0x8132, lo: 0xb2, hi: 0xb3}, - {value: 0x812d, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb5, hi: 0xb6}, - {value: 0x812d, lo: 0xb7, hi: 0xb9}, - {value: 0x8132, lo: 0xba, hi: 0xba}, - {value: 0x812d, lo: 0xbb, hi: 0xbc}, - {value: 0x8132, lo: 0xbd, hi: 0xbd}, - {value: 0x812d, lo: 0xbe, hi: 0xbe}, - {value: 0x8132, lo: 0xbf, hi: 0xbf}, - // Block 0xb, offset 0x56 - {value: 0x0005, lo: 0x07}, - {value: 0x8132, lo: 0x80, hi: 0x80}, - {value: 0x8132, lo: 0x81, hi: 0x81}, - {value: 0x812d, lo: 0x82, hi: 0x83}, - {value: 0x812d, lo: 0x84, hi: 0x85}, - {value: 0x812d, lo: 0x86, hi: 0x87}, - {value: 0x812d, lo: 0x88, hi: 0x89}, - {value: 0x8132, lo: 0x8a, hi: 0x8a}, - // Block 0xc, offset 0x5e - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0xab, hi: 0xb1}, - {value: 0x812d, lo: 0xb2, hi: 0xb2}, - {value: 0x8132, lo: 0xb3, hi: 0xb3}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0xd, offset 0x63 - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0x96, hi: 0x99}, - {value: 0x8132, lo: 0x9b, hi: 0xa3}, - {value: 0x8132, lo: 0xa5, hi: 0xa7}, - {value: 0x8132, lo: 0xa9, hi: 0xad}, - // Block 0xe, offset 0x68 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x99, hi: 0x9b}, - // Block 0xf, offset 0x6a - {value: 0x0000, lo: 0x07}, - {value: 0xa000, lo: 0xa8, hi: 0xa8}, - {value: 0x3ed8, lo: 0xa9, hi: 0xa9}, - {value: 0xa000, lo: 0xb0, hi: 0xb0}, - {value: 0x3ee0, lo: 0xb1, hi: 0xb1}, - {value: 0xa000, lo: 0xb3, hi: 0xb3}, - {value: 0x3ee8, lo: 0xb4, hi: 0xb4}, - {value: 0x9902, lo: 0xbc, hi: 0xbc}, - // Block 0x10, offset 0x72 - {value: 0x0008, lo: 0x06}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x8132, lo: 0x91, hi: 0x91}, - {value: 0x812d, lo: 0x92, hi: 0x92}, - {value: 0x8132, lo: 0x93, hi: 0x93}, - {value: 0x8132, lo: 0x94, hi: 0x94}, - {value: 0x451c, lo: 0x98, hi: 0x9f}, - // Block 0x11, offset 0x79 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x12, offset 0x7c - {value: 0x0008, lo: 0x07}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x455c, lo: 0x9c, hi: 0x9d}, - {value: 0x456c, lo: 0x9f, hi: 0x9f}, - {value: 0x8132, lo: 0xbe, hi: 0xbe}, - // Block 0x13, offset 0x84 - {value: 0x0000, lo: 0x03}, - {value: 0x4594, lo: 0xb3, hi: 0xb3}, - {value: 0x459c, lo: 0xb6, hi: 0xb6}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - // Block 0x14, offset 0x88 - {value: 0x0008, lo: 0x03}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x4574, lo: 0x99, hi: 0x9b}, - {value: 0x458c, lo: 0x9e, hi: 0x9e}, - // Block 0x15, offset 0x8c - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - // Block 0x16, offset 0x8e - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - // Block 0x17, offset 0x90 - {value: 0x0000, lo: 0x08}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2cb6, lo: 0x88, hi: 0x88}, - {value: 0x2cae, lo: 0x8b, hi: 0x8b}, - {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x96, hi: 0x97}, - {value: 0x45a4, lo: 0x9c, hi: 0x9c}, - {value: 0x45ac, lo: 0x9d, hi: 0x9d}, - // Block 0x18, offset 0x99 - {value: 0x0000, lo: 0x03}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x2cc6, lo: 0x94, hi: 0x94}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x19, offset 0x9d - {value: 0x0000, lo: 0x06}, - {value: 0xa000, lo: 0x86, hi: 0x87}, - {value: 0x2cce, lo: 0x8a, hi: 0x8a}, - {value: 0x2cde, lo: 0x8b, hi: 0x8b}, - {value: 0x2cd6, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - // Block 0x1a, offset 0xa4 - {value: 0x1801, lo: 0x04}, - {value: 0xa000, lo: 0x86, hi: 0x86}, - {value: 0x3ef0, lo: 0x88, hi: 0x88}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x8120, lo: 0x95, hi: 0x96}, - // Block 0x1b, offset 0xa9 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - {value: 0xa000, lo: 0xbf, hi: 0xbf}, - // Block 0x1c, offset 0xac - {value: 0x0000, lo: 0x09}, - {value: 0x2ce6, lo: 0x80, hi: 0x80}, - {value: 0x9900, lo: 0x82, hi: 0x82}, - {value: 0xa000, lo: 0x86, hi: 0x86}, - {value: 0x2cee, lo: 0x87, hi: 0x87}, - {value: 0x2cf6, lo: 0x88, hi: 0x88}, - {value: 0x2f50, lo: 0x8a, hi: 0x8a}, - {value: 0x2dd8, lo: 0x8b, hi: 0x8b}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x95, hi: 0x96}, - // Block 0x1d, offset 0xb6 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xbb, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x1e, offset 0xb9 - {value: 0x0000, lo: 0x06}, - {value: 0xa000, lo: 0x86, hi: 0x87}, - {value: 0x2cfe, lo: 0x8a, hi: 0x8a}, - {value: 0x2d0e, lo: 0x8b, hi: 0x8b}, - {value: 0x2d06, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - // Block 0x1f, offset 0xc0 - {value: 0x6bea, lo: 0x07}, - {value: 0x9904, lo: 0x8a, hi: 0x8a}, - {value: 0x9900, lo: 0x8f, hi: 0x8f}, - {value: 0xa000, lo: 0x99, hi: 0x99}, - {value: 0x3ef8, lo: 0x9a, hi: 0x9a}, - {value: 0x2f58, lo: 0x9c, hi: 0x9c}, - {value: 0x2de3, lo: 0x9d, hi: 0x9d}, - {value: 0x2d16, lo: 0x9e, hi: 0x9f}, - // Block 0x20, offset 0xc8 - {value: 0x0000, lo: 0x02}, - {value: 0x8122, lo: 0xb8, hi: 0xb9}, - {value: 0x8104, lo: 0xba, hi: 0xba}, - // Block 0x21, offset 0xcb - {value: 0x0000, lo: 0x01}, - {value: 0x8123, lo: 0x88, hi: 0x8b}, - // Block 0x22, offset 0xcd - {value: 0x0000, lo: 0x01}, - {value: 0x8124, lo: 0xb8, hi: 0xb9}, - // Block 0x23, offset 0xcf - {value: 0x0000, lo: 0x01}, - {value: 0x8125, lo: 0x88, hi: 0x8b}, - // Block 0x24, offset 0xd1 - {value: 0x0000, lo: 0x04}, - {value: 0x812d, lo: 0x98, hi: 0x99}, - {value: 0x812d, lo: 0xb5, hi: 0xb5}, - {value: 0x812d, lo: 0xb7, hi: 0xb7}, - {value: 0x812b, lo: 0xb9, hi: 0xb9}, - // Block 0x25, offset 0xd6 - {value: 0x0000, lo: 0x10}, - {value: 0x2644, lo: 0x83, hi: 0x83}, - {value: 0x264b, lo: 0x8d, hi: 0x8d}, - {value: 0x2652, lo: 0x92, hi: 0x92}, - {value: 0x2659, lo: 0x97, hi: 0x97}, - {value: 0x2660, lo: 0x9c, hi: 0x9c}, - {value: 0x263d, lo: 0xa9, hi: 0xa9}, - {value: 0x8126, lo: 0xb1, hi: 0xb1}, - {value: 0x8127, lo: 0xb2, hi: 0xb2}, - {value: 0x4a84, lo: 0xb3, hi: 0xb3}, - {value: 0x8128, lo: 0xb4, hi: 0xb4}, - {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, - {value: 0x45b4, lo: 0xb6, hi: 0xb6}, - {value: 0x8200, lo: 0xb7, hi: 0xb7}, - {value: 0x45bc, lo: 0xb8, hi: 0xb8}, - {value: 0x8200, lo: 0xb9, hi: 0xb9}, - {value: 0x8127, lo: 0xba, hi: 0xbd}, - // Block 0x26, offset 0xe7 - {value: 0x0000, lo: 0x0b}, - {value: 0x8127, lo: 0x80, hi: 0x80}, - {value: 0x4a96, lo: 0x81, hi: 0x81}, - {value: 0x8132, lo: 0x82, hi: 0x83}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0x86, hi: 0x87}, - {value: 0x266e, lo: 0x93, hi: 0x93}, - {value: 0x2675, lo: 0x9d, hi: 0x9d}, - {value: 0x267c, lo: 0xa2, hi: 0xa2}, - {value: 0x2683, lo: 0xa7, hi: 0xa7}, - {value: 0x268a, lo: 0xac, hi: 0xac}, - {value: 0x2667, lo: 0xb9, hi: 0xb9}, - // Block 0x27, offset 0xf3 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x86, hi: 0x86}, - // Block 0x28, offset 0xf5 - {value: 0x0000, lo: 0x05}, - {value: 0xa000, lo: 0xa5, hi: 0xa5}, - {value: 0x2d1e, lo: 0xa6, hi: 0xa6}, - {value: 0x9900, lo: 0xae, hi: 0xae}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - {value: 0x8104, lo: 0xb9, hi: 0xba}, - // Block 0x29, offset 0xfb - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x8d, hi: 0x8d}, - // Block 0x2a, offset 0xfd - {value: 0x0000, lo: 0x01}, - {value: 0xa000, lo: 0x80, hi: 0x92}, - // Block 0x2b, offset 0xff - {value: 0x0000, lo: 0x01}, - {value: 0xb900, lo: 0xa1, hi: 0xb5}, - // Block 0x2c, offset 0x101 - {value: 0x0000, lo: 0x01}, - {value: 0x9900, lo: 0xa8, hi: 0xbf}, - // Block 0x2d, offset 0x103 - {value: 0x0000, lo: 0x01}, - {value: 0x9900, lo: 0x80, hi: 0x82}, - // Block 0x2e, offset 0x105 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x9d, hi: 0x9f}, - // Block 0x2f, offset 0x107 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x94, hi: 0x94}, - {value: 0x8104, lo: 0xb4, hi: 0xb4}, - // Block 0x30, offset 0x10a - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x92, hi: 0x92}, - {value: 0x8132, lo: 0x9d, hi: 0x9d}, - // Block 0x31, offset 0x10d - {value: 0x0000, lo: 0x01}, - {value: 0x8131, lo: 0xa9, hi: 0xa9}, - // Block 0x32, offset 0x10f - {value: 0x0004, lo: 0x02}, - {value: 0x812e, lo: 0xb9, hi: 0xba}, - {value: 0x812d, lo: 0xbb, hi: 0xbb}, - // Block 0x33, offset 0x112 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x97, hi: 0x97}, - {value: 0x812d, lo: 0x98, hi: 0x98}, - // Block 0x34, offset 0x115 - {value: 0x0000, lo: 0x03}, - {value: 0x8104, lo: 0xa0, hi: 0xa0}, - {value: 0x8132, lo: 0xb5, hi: 0xbc}, - {value: 0x812d, lo: 0xbf, hi: 0xbf}, - // Block 0x35, offset 0x119 - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0xb0, hi: 0xb4}, - {value: 0x812d, lo: 0xb5, hi: 0xba}, - {value: 0x8132, lo: 0xbb, hi: 0xbc}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0x36, offset 0x11e - {value: 0x0000, lo: 0x08}, - {value: 0x2d66, lo: 0x80, hi: 0x80}, - {value: 0x2d6e, lo: 0x81, hi: 0x81}, - {value: 0xa000, lo: 0x82, hi: 0x82}, - {value: 0x2d76, lo: 0x83, hi: 0x83}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0xab, hi: 0xab}, - {value: 0x812d, lo: 0xac, hi: 0xac}, - {value: 0x8132, lo: 0xad, hi: 0xb3}, - // Block 0x37, offset 0x127 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xaa, hi: 0xab}, - // Block 0x38, offset 0x129 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xa6, hi: 0xa6}, - {value: 0x8104, lo: 0xb2, hi: 0xb3}, - // Block 0x39, offset 0x12c - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - // Block 0x3a, offset 0x12e - {value: 0x0000, lo: 0x0a}, - {value: 0x8132, lo: 0x90, hi: 0x92}, - {value: 0x8101, lo: 0x94, hi: 0x94}, - {value: 0x812d, lo: 0x95, hi: 0x99}, - {value: 0x8132, lo: 0x9a, hi: 0x9b}, - {value: 0x812d, lo: 0x9c, hi: 0x9f}, - {value: 0x8132, lo: 0xa0, hi: 0xa0}, - {value: 0x8101, lo: 0xa2, hi: 0xa8}, - {value: 0x812d, lo: 0xad, hi: 0xad}, - {value: 0x8132, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb8, hi: 0xb9}, - // Block 0x3b, offset 0x139 - {value: 0x0004, lo: 0x03}, - {value: 0x0433, lo: 0x80, hi: 0x81}, - {value: 0x8100, lo: 0x97, hi: 0x97}, - {value: 0x8100, lo: 0xbe, hi: 0xbe}, - // Block 0x3c, offset 0x13d - {value: 0x0000, lo: 0x0d}, - {value: 0x8132, lo: 0x90, hi: 0x91}, - {value: 0x8101, lo: 0x92, hi: 0x93}, - {value: 0x8132, lo: 0x94, hi: 0x97}, - {value: 0x8101, lo: 0x98, hi: 0x9a}, - {value: 0x8132, lo: 0x9b, hi: 0x9c}, - {value: 0x8132, lo: 0xa1, hi: 0xa1}, - {value: 0x8101, lo: 0xa5, hi: 0xa6}, - {value: 0x8132, lo: 0xa7, hi: 0xa7}, - {value: 0x812d, lo: 0xa8, hi: 0xa8}, - {value: 0x8132, lo: 0xa9, hi: 0xa9}, - {value: 0x8101, lo: 0xaa, hi: 0xab}, - {value: 0x812d, lo: 0xac, hi: 0xaf}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - // Block 0x3d, offset 0x14b - {value: 0x427b, lo: 0x02}, - {value: 0x01b8, lo: 0xa6, hi: 0xa6}, - {value: 0x0057, lo: 0xaa, hi: 0xab}, - // Block 0x3e, offset 0x14e - {value: 0x0007, lo: 0x05}, - {value: 0xa000, lo: 0x90, hi: 0x90}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0xa000, lo: 0x94, hi: 0x94}, - {value: 0x3bb9, lo: 0x9a, hi: 0x9b}, - {value: 0x3bc7, lo: 0xae, hi: 0xae}, - // Block 0x3f, offset 0x154 - {value: 0x000e, lo: 0x05}, - {value: 0x3bce, lo: 0x8d, hi: 0x8e}, - {value: 0x3bd5, lo: 0x8f, hi: 0x8f}, - {value: 0xa000, lo: 0x90, hi: 0x90}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0xa000, lo: 0x94, hi: 0x94}, - // Block 0x40, offset 0x15a - {value: 0x6408, lo: 0x0a}, - {value: 0xa000, lo: 0x83, hi: 0x83}, - {value: 0x3be3, lo: 0x84, hi: 0x84}, - {value: 0xa000, lo: 0x88, hi: 0x88}, - {value: 0x3bea, lo: 0x89, hi: 0x89}, - {value: 0xa000, lo: 0x8b, hi: 0x8b}, - {value: 0x3bf1, lo: 0x8c, hi: 0x8c}, - {value: 0xa000, lo: 0xa3, hi: 0xa3}, - {value: 0x3bf8, lo: 0xa4, hi: 0xa5}, - {value: 0x3bff, lo: 0xa6, hi: 0xa6}, - {value: 0xa000, lo: 0xbc, hi: 0xbc}, - // Block 0x41, offset 0x165 - {value: 0x0007, lo: 0x03}, - {value: 0x3c68, lo: 0xa0, hi: 0xa1}, - {value: 0x3c92, lo: 0xa2, hi: 0xa3}, - {value: 0x3cbc, lo: 0xaa, hi: 0xad}, - // Block 0x42, offset 0x169 - {value: 0x0004, lo: 0x01}, - {value: 0x048b, lo: 0xa9, hi: 0xaa}, - // Block 0x43, offset 0x16b - {value: 0x0000, lo: 0x01}, - {value: 0x44dd, lo: 0x9c, hi: 0x9c}, - // Block 0x44, offset 0x16d - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xaf, hi: 0xb1}, - // Block 0x45, offset 0x16f - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x46, offset 0x171 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xa0, hi: 0xbf}, - // Block 0x47, offset 0x173 - {value: 0x0000, lo: 0x05}, - {value: 0x812c, lo: 0xaa, hi: 0xaa}, - {value: 0x8131, lo: 0xab, hi: 0xab}, - {value: 0x8133, lo: 0xac, hi: 0xac}, - {value: 0x812e, lo: 0xad, hi: 0xad}, - {value: 0x812f, lo: 0xae, hi: 0xaf}, - // Block 0x48, offset 0x179 - {value: 0x0000, lo: 0x03}, - {value: 0x4a9f, lo: 0xb3, hi: 0xb3}, - {value: 0x4a9f, lo: 0xb5, hi: 0xb6}, - {value: 0x4a9f, lo: 0xba, hi: 0xbf}, - // Block 0x49, offset 0x17d - {value: 0x0000, lo: 0x01}, - {value: 0x4a9f, lo: 0x8f, hi: 0xa3}, - // Block 0x4a, offset 0x17f - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0xae, hi: 0xbe}, - // Block 0x4b, offset 0x181 - {value: 0x0000, lo: 0x07}, - {value: 0x8100, lo: 0x84, hi: 0x84}, - {value: 0x8100, lo: 0x87, hi: 0x87}, - {value: 0x8100, lo: 0x90, hi: 0x90}, - {value: 0x8100, lo: 0x9e, hi: 0x9e}, - {value: 0x8100, lo: 0xa1, hi: 0xa1}, - {value: 0x8100, lo: 0xb2, hi: 0xb2}, - {value: 0x8100, lo: 0xbb, hi: 0xbb}, - // Block 0x4c, offset 0x189 - {value: 0x0000, lo: 0x03}, - {value: 0x8100, lo: 0x80, hi: 0x80}, - {value: 0x8100, lo: 0x8b, hi: 0x8b}, - {value: 0x8100, lo: 0x8e, hi: 0x8e}, - // Block 0x4d, offset 0x18d - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0xaf, hi: 0xaf}, - {value: 0x8132, lo: 0xb4, hi: 0xbd}, - // Block 0x4e, offset 0x190 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x9e, hi: 0x9f}, - // Block 0x4f, offset 0x192 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb0, hi: 0xb1}, - // Block 0x50, offset 0x194 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x86, hi: 0x86}, - // Block 0x51, offset 0x196 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0xa0, hi: 0xb1}, - // Block 0x52, offset 0x199 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xab, hi: 0xad}, - // Block 0x53, offset 0x19b - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x93, hi: 0x93}, - // Block 0x54, offset 0x19d - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xb3, hi: 0xb3}, - // Block 0x55, offset 0x19f - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x80, hi: 0x80}, - // Block 0x56, offset 0x1a1 - {value: 0x0000, lo: 0x05}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - {value: 0x8132, lo: 0xb2, hi: 0xb3}, - {value: 0x812d, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb7, hi: 0xb8}, - {value: 0x8132, lo: 0xbe, hi: 0xbf}, - // Block 0x57, offset 0x1a7 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x81, hi: 0x81}, - {value: 0x8104, lo: 0xb6, hi: 0xb6}, - // Block 0x58, offset 0x1aa - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xad, hi: 0xad}, - // Block 0x59, offset 0x1ac - {value: 0x0000, lo: 0x06}, - {value: 0xe500, lo: 0x80, hi: 0x80}, - {value: 0xc600, lo: 0x81, hi: 0x9b}, - {value: 0xe500, lo: 0x9c, hi: 0x9c}, - {value: 0xc600, lo: 0x9d, hi: 0xb7}, - {value: 0xe500, lo: 0xb8, hi: 0xb8}, - {value: 0xc600, lo: 0xb9, hi: 0xbf}, - // Block 0x5a, offset 0x1b3 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x93}, - {value: 0xe500, lo: 0x94, hi: 0x94}, - {value: 0xc600, lo: 0x95, hi: 0xaf}, - {value: 0xe500, lo: 0xb0, hi: 0xb0}, - {value: 0xc600, lo: 0xb1, hi: 0xbf}, - // Block 0x5b, offset 0x1b9 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x8b}, - {value: 0xe500, lo: 0x8c, hi: 0x8c}, - {value: 0xc600, lo: 0x8d, hi: 0xa7}, - {value: 0xe500, lo: 0xa8, hi: 0xa8}, - {value: 0xc600, lo: 0xa9, hi: 0xbf}, - // Block 0x5c, offset 0x1bf - {value: 0x0000, lo: 0x07}, - {value: 0xc600, lo: 0x80, hi: 0x83}, - {value: 0xe500, lo: 0x84, hi: 0x84}, - {value: 0xc600, lo: 0x85, hi: 0x9f}, - {value: 0xe500, lo: 0xa0, hi: 0xa0}, - {value: 0xc600, lo: 0xa1, hi: 0xbb}, - {value: 0xe500, lo: 0xbc, hi: 0xbc}, - {value: 0xc600, lo: 0xbd, hi: 0xbf}, - // Block 0x5d, offset 0x1c7 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x97}, - {value: 0xe500, lo: 0x98, hi: 0x98}, - {value: 0xc600, lo: 0x99, hi: 0xb3}, - {value: 0xe500, lo: 0xb4, hi: 0xb4}, - {value: 0xc600, lo: 0xb5, hi: 0xbf}, - // Block 0x5e, offset 0x1cd - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x8f}, - {value: 0xe500, lo: 0x90, hi: 0x90}, - {value: 0xc600, lo: 0x91, hi: 0xab}, - {value: 0xe500, lo: 0xac, hi: 0xac}, - {value: 0xc600, lo: 0xad, hi: 0xbf}, - // Block 0x5f, offset 0x1d3 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x87}, - {value: 0xe500, lo: 0x88, hi: 0x88}, - {value: 0xc600, lo: 0x89, hi: 0xa3}, - {value: 0xe500, lo: 0xa4, hi: 0xa4}, - {value: 0xc600, lo: 0xa5, hi: 0xbf}, - // Block 0x60, offset 0x1d9 - {value: 0x0000, lo: 0x03}, - {value: 0xc600, lo: 0x80, hi: 0x87}, - {value: 0xe500, lo: 0x88, hi: 0x88}, - {value: 0xc600, lo: 0x89, hi: 0xa3}, - // Block 0x61, offset 0x1dd - {value: 0x0006, lo: 0x0d}, - {value: 0x4390, lo: 0x9d, hi: 0x9d}, - {value: 0x8115, lo: 0x9e, hi: 0x9e}, - {value: 0x4402, lo: 0x9f, hi: 0x9f}, - {value: 0x43f0, lo: 0xaa, hi: 0xab}, - {value: 0x44f4, lo: 0xac, hi: 0xac}, - {value: 0x44fc, lo: 0xad, hi: 0xad}, - {value: 0x4348, lo: 0xae, hi: 0xb1}, - {value: 0x4366, lo: 0xb2, hi: 0xb4}, - {value: 0x437e, lo: 0xb5, hi: 0xb6}, - {value: 0x438a, lo: 0xb8, hi: 0xb8}, - {value: 0x4396, lo: 0xb9, hi: 0xbb}, - {value: 0x43ae, lo: 0xbc, hi: 0xbc}, - {value: 0x43b4, lo: 0xbe, hi: 0xbe}, - // Block 0x62, offset 0x1eb - {value: 0x0006, lo: 0x08}, - {value: 0x43ba, lo: 0x80, hi: 0x81}, - {value: 0x43c6, lo: 0x83, hi: 0x84}, - {value: 0x43d8, lo: 0x86, hi: 0x89}, - {value: 0x43fc, lo: 0x8a, hi: 0x8a}, - {value: 0x4378, lo: 0x8b, hi: 0x8b}, - {value: 0x4360, lo: 0x8c, hi: 0x8c}, - {value: 0x43a8, lo: 0x8d, hi: 0x8d}, - {value: 0x43d2, lo: 0x8e, hi: 0x8e}, - // Block 0x63, offset 0x1f4 - {value: 0x0000, lo: 0x02}, - {value: 0x8100, lo: 0xa4, hi: 0xa5}, - {value: 0x8100, lo: 0xb0, hi: 0xb1}, - // Block 0x64, offset 0x1f7 - {value: 0x0000, lo: 0x02}, - {value: 0x8100, lo: 0x9b, hi: 0x9d}, - {value: 0x8200, lo: 0x9e, hi: 0xa3}, - // Block 0x65, offset 0x1fa - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0x90, hi: 0x90}, - // Block 0x66, offset 0x1fc - {value: 0x0000, lo: 0x02}, - {value: 0x8100, lo: 0x99, hi: 0x99}, - {value: 0x8200, lo: 0xb2, hi: 0xb4}, - // Block 0x67, offset 0x1ff - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0xbc, hi: 0xbd}, - // Block 0x68, offset 0x201 - {value: 0x0000, lo: 0x03}, - {value: 0x8132, lo: 0xa0, hi: 0xa6}, - {value: 0x812d, lo: 0xa7, hi: 0xad}, - {value: 0x8132, lo: 0xae, hi: 0xaf}, - // Block 0x69, offset 0x205 - {value: 0x0000, lo: 0x04}, - {value: 0x8100, lo: 0x89, hi: 0x8c}, - {value: 0x8100, lo: 0xb0, hi: 0xb2}, - {value: 0x8100, lo: 0xb4, hi: 0xb4}, - {value: 0x8100, lo: 0xb6, hi: 0xbf}, - // Block 0x6a, offset 0x20a - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0x81, hi: 0x8c}, - // Block 0x6b, offset 0x20c - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0xb5, hi: 0xba}, - // Block 0x6c, offset 0x20e - {value: 0x0000, lo: 0x04}, - {value: 0x4a9f, lo: 0x9e, hi: 0x9f}, - {value: 0x4a9f, lo: 0xa3, hi: 0xa3}, - {value: 0x4a9f, lo: 0xa5, hi: 0xa6}, - {value: 0x4a9f, lo: 0xaa, hi: 0xaf}, - // Block 0x6d, offset 0x213 - {value: 0x0000, lo: 0x05}, - {value: 0x4a9f, lo: 0x82, hi: 0x87}, - {value: 0x4a9f, lo: 0x8a, hi: 0x8f}, - {value: 0x4a9f, lo: 0x92, hi: 0x97}, - {value: 0x4a9f, lo: 0x9a, hi: 0x9c}, - {value: 0x8100, lo: 0xa3, hi: 0xa3}, - // Block 0x6e, offset 0x219 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0x6f, offset 0x21b - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xa0, hi: 0xa0}, - // Block 0x70, offset 0x21d - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb6, hi: 0xba}, - // Block 0x71, offset 0x21f - {value: 0x002c, lo: 0x05}, - {value: 0x812d, lo: 0x8d, hi: 0x8d}, - {value: 0x8132, lo: 0x8f, hi: 0x8f}, - {value: 0x8132, lo: 0xb8, hi: 0xb8}, - {value: 0x8101, lo: 0xb9, hi: 0xba}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x72, offset 0x225 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0xa5, hi: 0xa5}, - {value: 0x812d, lo: 0xa6, hi: 0xa6}, - // Block 0x73, offset 0x228 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xa4, hi: 0xa7}, - // Block 0x74, offset 0x22a - {value: 0x0000, lo: 0x05}, - {value: 0x812d, lo: 0x86, hi: 0x87}, - {value: 0x8132, lo: 0x88, hi: 0x8a}, - {value: 0x812d, lo: 0x8b, hi: 0x8b}, - {value: 0x8132, lo: 0x8c, hi: 0x8c}, - {value: 0x812d, lo: 0x8d, hi: 0x90}, - // Block 0x75, offset 0x230 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x86, hi: 0x86}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x76, offset 0x233 - {value: 0x17fe, lo: 0x07}, - {value: 0xa000, lo: 0x99, hi: 0x99}, - {value: 0x4238, lo: 0x9a, hi: 0x9a}, - {value: 0xa000, lo: 0x9b, hi: 0x9b}, - {value: 0x4242, lo: 0x9c, hi: 0x9c}, - {value: 0xa000, lo: 0xa5, hi: 0xa5}, - {value: 0x424c, lo: 0xab, hi: 0xab}, - {value: 0x8104, lo: 0xb9, hi: 0xba}, - // Block 0x77, offset 0x23b - {value: 0x0000, lo: 0x06}, - {value: 0x8132, lo: 0x80, hi: 0x82}, - {value: 0x9900, lo: 0xa7, hi: 0xa7}, - {value: 0x2d7e, lo: 0xae, hi: 0xae}, - {value: 0x2d88, lo: 0xaf, hi: 0xaf}, - {value: 0xa000, lo: 0xb1, hi: 0xb2}, - {value: 0x8104, lo: 0xb3, hi: 0xb4}, - // Block 0x78, offset 0x242 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x80, hi: 0x80}, - {value: 0x8102, lo: 0x8a, hi: 0x8a}, - // Block 0x79, offset 0x245 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb5, hi: 0xb5}, - {value: 0x8102, lo: 0xb6, hi: 0xb6}, - // Block 0x7a, offset 0x248 - {value: 0x0002, lo: 0x01}, - {value: 0x8102, lo: 0xa9, hi: 0xaa}, - // Block 0x7b, offset 0x24a - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbb, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x7c, offset 0x24d - {value: 0x0000, lo: 0x07}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2d92, lo: 0x8b, hi: 0x8b}, - {value: 0x2d9c, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x8132, lo: 0xa6, hi: 0xac}, - {value: 0x8132, lo: 0xb0, hi: 0xb4}, - // Block 0x7d, offset 0x255 - {value: 0x0000, lo: 0x03}, - {value: 0x8104, lo: 0x82, hi: 0x82}, - {value: 0x8102, lo: 0x86, hi: 0x86}, - {value: 0x8132, lo: 0x9e, hi: 0x9e}, - // Block 0x7e, offset 0x259 - {value: 0x6b5a, lo: 0x06}, - {value: 0x9900, lo: 0xb0, hi: 0xb0}, - {value: 0xa000, lo: 0xb9, hi: 0xb9}, - {value: 0x9900, lo: 0xba, hi: 0xba}, - {value: 0x2db0, lo: 0xbb, hi: 0xbb}, - {value: 0x2da6, lo: 0xbc, hi: 0xbd}, - {value: 0x2dba, lo: 0xbe, hi: 0xbe}, - // Block 0x7f, offset 0x260 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x82, hi: 0x82}, - {value: 0x8102, lo: 0x83, hi: 0x83}, - // Block 0x80, offset 0x263 - {value: 0x0000, lo: 0x05}, - {value: 0x9900, lo: 0xaf, hi: 0xaf}, - {value: 0xa000, lo: 0xb8, hi: 0xb9}, - {value: 0x2dc4, lo: 0xba, hi: 0xba}, - {value: 0x2dce, lo: 0xbb, hi: 0xbb}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x81, offset 0x269 - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0x80, hi: 0x80}, - // Block 0x82, offset 0x26b - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb6, hi: 0xb6}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - // Block 0x83, offset 0x26e - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xab, hi: 0xab}, - // Block 0x84, offset 0x270 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb9, hi: 0xb9}, - {value: 0x8102, lo: 0xba, hi: 0xba}, - // Block 0x85, offset 0x273 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xb4, hi: 0xb4}, - // Block 0x86, offset 0x275 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x87, hi: 0x87}, - // Block 0x87, offset 0x277 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x99, hi: 0x99}, - // Block 0x88, offset 0x279 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0x82, hi: 0x82}, - {value: 0x8104, lo: 0x84, hi: 0x85}, - // Block 0x89, offset 0x27c - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x97, hi: 0x97}, - // Block 0x8a, offset 0x27e - {value: 0x0000, lo: 0x01}, - {value: 0x8101, lo: 0xb0, hi: 0xb4}, - // Block 0x8b, offset 0x280 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb0, hi: 0xb6}, - // Block 0x8c, offset 0x282 - {value: 0x0000, lo: 0x01}, - {value: 0x8101, lo: 0x9e, hi: 0x9e}, - // Block 0x8d, offset 0x284 - {value: 0x0000, lo: 0x0c}, - {value: 0x45cc, lo: 0x9e, hi: 0x9e}, - {value: 0x45d6, lo: 0x9f, hi: 0x9f}, - {value: 0x460a, lo: 0xa0, hi: 0xa0}, - {value: 0x4618, lo: 0xa1, hi: 0xa1}, - {value: 0x4626, lo: 0xa2, hi: 0xa2}, - {value: 0x4634, lo: 0xa3, hi: 0xa3}, - {value: 0x4642, lo: 0xa4, hi: 0xa4}, - {value: 0x812b, lo: 0xa5, hi: 0xa6}, - {value: 0x8101, lo: 0xa7, hi: 0xa9}, - {value: 0x8130, lo: 0xad, hi: 0xad}, - {value: 0x812b, lo: 0xae, hi: 0xb2}, - {value: 0x812d, lo: 0xbb, hi: 0xbf}, - // Block 0x8e, offset 0x291 - {value: 0x0000, lo: 0x09}, - {value: 0x812d, lo: 0x80, hi: 0x82}, - {value: 0x8132, lo: 0x85, hi: 0x89}, - {value: 0x812d, lo: 0x8a, hi: 0x8b}, - {value: 0x8132, lo: 0xaa, hi: 0xad}, - {value: 0x45e0, lo: 0xbb, hi: 0xbb}, - {value: 0x45ea, lo: 0xbc, hi: 0xbc}, - {value: 0x4650, lo: 0xbd, hi: 0xbd}, - {value: 0x466c, lo: 0xbe, hi: 0xbe}, - {value: 0x465e, lo: 0xbf, hi: 0xbf}, - // Block 0x8f, offset 0x29b - {value: 0x0000, lo: 0x01}, - {value: 0x467a, lo: 0x80, hi: 0x80}, - // Block 0x90, offset 0x29d - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x82, hi: 0x84}, - // Block 0x91, offset 0x29f - {value: 0x0000, lo: 0x05}, - {value: 0x8132, lo: 0x80, hi: 0x86}, - {value: 0x8132, lo: 0x88, hi: 0x98}, - {value: 0x8132, lo: 0x9b, hi: 0xa1}, - {value: 0x8132, lo: 0xa3, hi: 0xa4}, - {value: 0x8132, lo: 0xa6, hi: 0xaa}, - // Block 0x92, offset 0x2a5 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x90, hi: 0x96}, - // Block 0x93, offset 0x2a7 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x84, hi: 0x89}, - {value: 0x8102, lo: 0x8a, hi: 0x8a}, - // Block 0x94, offset 0x2aa - {value: 0x0000, lo: 0x01}, - {value: 0x8100, lo: 0x93, hi: 0x93}, -} - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return nfkcValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfkcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfkcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = nfkcIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *nfkcTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return nfkcValues[c0] - } - i := nfkcIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = nfkcIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = nfkcIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *nfkcTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return nfkcValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfkcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := nfkcIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = nfkcIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = nfkcIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *nfkcTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return nfkcValues[c0] - } - i := nfkcIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = nfkcIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = nfkcIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// nfkcTrie. Total size: 17248 bytes (16.84 KiB). Checksum: 4fb368372b6b1b27. -type nfkcTrie struct{} - -func newNfkcTrie(i int) *nfkcTrie { - return &nfkcTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 92: - return uint16(nfkcValues[n<<6+uint32(b)]) - default: - n -= 92 - return uint16(nfkcSparse.lookup(n, b)) - } -} - -// nfkcValues: 94 blocks, 6016 entries, 12032 bytes -// The third block is the zero block. -var nfkcValues = [6016]uint16{ - // Block 0x0, offset 0x0 - 0x3c: 0xa000, 0x3d: 0xa000, 0x3e: 0xa000, - // Block 0x1, offset 0x40 - 0x41: 0xa000, 0x42: 0xa000, 0x43: 0xa000, 0x44: 0xa000, 0x45: 0xa000, - 0x46: 0xa000, 0x47: 0xa000, 0x48: 0xa000, 0x49: 0xa000, 0x4a: 0xa000, 0x4b: 0xa000, - 0x4c: 0xa000, 0x4d: 0xa000, 0x4e: 0xa000, 0x4f: 0xa000, 0x50: 0xa000, - 0x52: 0xa000, 0x53: 0xa000, 0x54: 0xa000, 0x55: 0xa000, 0x56: 0xa000, 0x57: 0xa000, - 0x58: 0xa000, 0x59: 0xa000, 0x5a: 0xa000, - 0x61: 0xa000, 0x62: 0xa000, 0x63: 0xa000, - 0x64: 0xa000, 0x65: 0xa000, 0x66: 0xa000, 0x67: 0xa000, 0x68: 0xa000, 0x69: 0xa000, - 0x6a: 0xa000, 0x6b: 0xa000, 0x6c: 0xa000, 0x6d: 0xa000, 0x6e: 0xa000, 0x6f: 0xa000, - 0x70: 0xa000, 0x72: 0xa000, 0x73: 0xa000, 0x74: 0xa000, 0x75: 0xa000, - 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, - 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, - 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, - 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, - 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, - 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, - 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, - 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, - 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, - 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, - 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, - // Block 0x4, offset 0x100 - 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, - 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, - 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, - 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, - 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, - 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, - 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, - 0x12a: 0x3082, 0x12b: 0x3393, 0x12c: 0x3087, 0x12d: 0x3398, 0x12e: 0x30aa, 0x12f: 0x33b6, - 0x130: 0x308c, 0x132: 0x195d, 0x133: 0x19e7, 0x134: 0x30b4, 0x135: 0x33c0, - 0x136: 0x30c8, 0x137: 0x33d9, 0x139: 0x30d2, 0x13a: 0x33e3, 0x13b: 0x30dc, - 0x13c: 0x33ed, 0x13d: 0x30d7, 0x13e: 0x33e8, 0x13f: 0x1bac, - // Block 0x5, offset 0x140 - 0x140: 0x1c34, 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, - 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, 0x149: 0x1c5c, - 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, - 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, - 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, - 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, - 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, - 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, - 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, - 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, - 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0x00a7, - // Block 0x6, offset 0x180 - 0x184: 0x2dee, 0x185: 0x2df4, - 0x186: 0x2dfa, 0x187: 0x1972, 0x188: 0x1975, 0x189: 0x1a08, 0x18a: 0x1987, 0x18b: 0x198a, - 0x18c: 0x1a3e, 0x18d: 0x2f88, 0x18e: 0x3294, 0x18f: 0x3096, 0x190: 0x33a2, 0x191: 0x3140, - 0x192: 0x3451, 0x193: 0x31d6, 0x194: 0x34ec, 0x195: 0x39cf, 0x196: 0x3b5e, 0x197: 0x39c8, - 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, - 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, - 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, - 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, - 0x1b0: 0x33c5, 0x1b1: 0x1942, 0x1b2: 0x1945, 0x1b3: 0x19cf, 0x1b4: 0x3028, 0x1b5: 0x3334, - 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, - 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x2f8d, 0x1c1: 0x3299, 0x1c2: 0x2f92, 0x1c3: 0x329e, 0x1c4: 0x300a, 0x1c5: 0x3316, - 0x1c6: 0x300f, 0x1c7: 0x331b, 0x1c8: 0x309b, 0x1c9: 0x33a7, 0x1ca: 0x30a0, 0x1cb: 0x33ac, - 0x1cc: 0x3145, 0x1cd: 0x3456, 0x1ce: 0x314a, 0x1cf: 0x345b, 0x1d0: 0x3168, 0x1d1: 0x3479, - 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, - 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, - 0x1de: 0x305a, 0x1df: 0x3366, - 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, - 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, - 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, - // Block 0x8, offset 0x200 - 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, - 0x206: 0x9932, 0x207: 0x9932, 0x208: 0x9932, 0x209: 0x9932, 0x20a: 0x9932, 0x20b: 0x9932, - 0x20c: 0x9932, 0x20d: 0x8132, 0x20e: 0x8132, 0x20f: 0x9932, 0x210: 0x8132, 0x211: 0x9932, - 0x212: 0x8132, 0x213: 0x9932, 0x214: 0x9932, 0x215: 0x8133, 0x216: 0x812d, 0x217: 0x812d, - 0x218: 0x812d, 0x219: 0x812d, 0x21a: 0x8133, 0x21b: 0x992b, 0x21c: 0x812d, 0x21d: 0x812d, - 0x21e: 0x812d, 0x21f: 0x812d, 0x220: 0x812d, 0x221: 0x8129, 0x222: 0x8129, 0x223: 0x992d, - 0x224: 0x992d, 0x225: 0x992d, 0x226: 0x992d, 0x227: 0x9929, 0x228: 0x9929, 0x229: 0x812d, - 0x22a: 0x812d, 0x22b: 0x812d, 0x22c: 0x812d, 0x22d: 0x992d, 0x22e: 0x992d, 0x22f: 0x812d, - 0x230: 0x992d, 0x231: 0x992d, 0x232: 0x812d, 0x233: 0x812d, 0x234: 0x8101, 0x235: 0x8101, - 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, - 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, - // Block 0x9, offset 0x240 - 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, - 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, - 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, - 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, - 0x258: 0x8133, 0x259: 0x812d, 0x25a: 0x812d, 0x25b: 0x8132, 0x25c: 0x8134, 0x25d: 0x8135, - 0x25e: 0x8135, 0x25f: 0x8134, 0x260: 0x8135, 0x261: 0x8135, 0x262: 0x8134, 0x263: 0x8132, - 0x264: 0x8132, 0x265: 0x8132, 0x266: 0x8132, 0x267: 0x8132, 0x268: 0x8132, 0x269: 0x8132, - 0x26a: 0x8132, 0x26b: 0x8132, 0x26c: 0x8132, 0x26d: 0x8132, 0x26e: 0x8132, 0x26f: 0x8132, - 0x274: 0x0170, - 0x27a: 0x42a5, - 0x27e: 0x0037, - // Block 0xa, offset 0x280 - 0x284: 0x425a, 0x285: 0x447b, - 0x286: 0x35e9, 0x287: 0x00ce, 0x288: 0x3607, 0x289: 0x3613, 0x28a: 0x3625, - 0x28c: 0x3643, 0x28e: 0x3655, 0x28f: 0x3673, 0x290: 0x3e08, 0x291: 0xa000, - 0x295: 0xa000, 0x297: 0xa000, - 0x299: 0xa000, - 0x29f: 0xa000, 0x2a1: 0xa000, - 0x2a5: 0xa000, 0x2a9: 0xa000, - 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, - 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, - 0x2b7: 0xa000, 0x2b9: 0xa000, - 0x2bf: 0xa000, - // Block 0xb, offset 0x2c0 - 0x2c1: 0xa000, 0x2c5: 0xa000, - 0x2c9: 0xa000, 0x2ca: 0x4840, 0x2cb: 0x485e, - 0x2cc: 0x36c7, 0x2cd: 0x36df, 0x2ce: 0x4876, 0x2d0: 0x01be, 0x2d1: 0x01d0, - 0x2d2: 0x01ac, 0x2d3: 0x430c, 0x2d4: 0x4312, 0x2d5: 0x01fa, 0x2d6: 0x01e8, - 0x2f0: 0x01d6, 0x2f1: 0x01eb, 0x2f2: 0x01ee, 0x2f4: 0x0188, 0x2f5: 0x01c7, - 0x2f9: 0x01a6, - // Block 0xc, offset 0x300 - 0x300: 0x3721, 0x301: 0x372d, 0x303: 0x371b, - 0x306: 0xa000, 0x307: 0x3709, - 0x30c: 0x375d, 0x30d: 0x3745, 0x30e: 0x376f, 0x310: 0xa000, - 0x313: 0xa000, 0x315: 0xa000, 0x316: 0xa000, 0x317: 0xa000, - 0x318: 0xa000, 0x319: 0x3751, 0x31a: 0xa000, - 0x31e: 0xa000, 0x323: 0xa000, - 0x327: 0xa000, - 0x32b: 0xa000, 0x32d: 0xa000, - 0x330: 0xa000, 0x333: 0xa000, 0x335: 0xa000, - 0x336: 0xa000, 0x337: 0xa000, 0x338: 0xa000, 0x339: 0x37d5, 0x33a: 0xa000, - 0x33e: 0xa000, - // Block 0xd, offset 0x340 - 0x341: 0x3733, 0x342: 0x37b7, - 0x350: 0x370f, 0x351: 0x3793, - 0x352: 0x3715, 0x353: 0x3799, 0x356: 0x3727, 0x357: 0x37ab, - 0x358: 0xa000, 0x359: 0xa000, 0x35a: 0x3829, 0x35b: 0x382f, 0x35c: 0x3739, 0x35d: 0x37bd, - 0x35e: 0x373f, 0x35f: 0x37c3, 0x362: 0x374b, 0x363: 0x37cf, - 0x364: 0x3757, 0x365: 0x37db, 0x366: 0x3763, 0x367: 0x37e7, 0x368: 0xa000, 0x369: 0xa000, - 0x36a: 0x3835, 0x36b: 0x383b, 0x36c: 0x378d, 0x36d: 0x3811, 0x36e: 0x3769, 0x36f: 0x37ed, - 0x370: 0x3775, 0x371: 0x37f9, 0x372: 0x377b, 0x373: 0x37ff, 0x374: 0x3781, 0x375: 0x3805, - 0x378: 0x3787, 0x379: 0x380b, - // Block 0xe, offset 0x380 - 0x387: 0x1d61, - 0x391: 0x812d, - 0x392: 0x8132, 0x393: 0x8132, 0x394: 0x8132, 0x395: 0x8132, 0x396: 0x812d, 0x397: 0x8132, - 0x398: 0x8132, 0x399: 0x8132, 0x39a: 0x812e, 0x39b: 0x812d, 0x39c: 0x8132, 0x39d: 0x8132, - 0x39e: 0x8132, 0x39f: 0x8132, 0x3a0: 0x8132, 0x3a1: 0x8132, 0x3a2: 0x812d, 0x3a3: 0x812d, - 0x3a4: 0x812d, 0x3a5: 0x812d, 0x3a6: 0x812d, 0x3a7: 0x812d, 0x3a8: 0x8132, 0x3a9: 0x8132, - 0x3aa: 0x812d, 0x3ab: 0x8132, 0x3ac: 0x8132, 0x3ad: 0x812e, 0x3ae: 0x8131, 0x3af: 0x8132, - 0x3b0: 0x8105, 0x3b1: 0x8106, 0x3b2: 0x8107, 0x3b3: 0x8108, 0x3b4: 0x8109, 0x3b5: 0x810a, - 0x3b6: 0x810b, 0x3b7: 0x810c, 0x3b8: 0x810d, 0x3b9: 0x810e, 0x3ba: 0x810e, 0x3bb: 0x810f, - 0x3bc: 0x8110, 0x3bd: 0x8111, 0x3bf: 0x8112, - // Block 0xf, offset 0x3c0 - 0x3c8: 0xa000, 0x3ca: 0xa000, 0x3cb: 0x8116, - 0x3cc: 0x8117, 0x3cd: 0x8118, 0x3ce: 0x8119, 0x3cf: 0x811a, 0x3d0: 0x811b, 0x3d1: 0x811c, - 0x3d2: 0x811d, 0x3d3: 0x9932, 0x3d4: 0x9932, 0x3d5: 0x992d, 0x3d6: 0x812d, 0x3d7: 0x8132, - 0x3d8: 0x8132, 0x3d9: 0x8132, 0x3da: 0x8132, 0x3db: 0x8132, 0x3dc: 0x812d, 0x3dd: 0x8132, - 0x3de: 0x8132, 0x3df: 0x812d, - 0x3f0: 0x811e, 0x3f5: 0x1d84, - 0x3f6: 0x2013, 0x3f7: 0x204f, 0x3f8: 0x204a, - // Block 0x10, offset 0x400 - 0x413: 0x812d, 0x414: 0x8132, 0x415: 0x8132, 0x416: 0x8132, 0x417: 0x8132, - 0x418: 0x8132, 0x419: 0x8132, 0x41a: 0x8132, 0x41b: 0x8132, 0x41c: 0x8132, 0x41d: 0x8132, - 0x41e: 0x8132, 0x41f: 0x8132, 0x420: 0x8132, 0x421: 0x8132, 0x423: 0x812d, - 0x424: 0x8132, 0x425: 0x8132, 0x426: 0x812d, 0x427: 0x8132, 0x428: 0x8132, 0x429: 0x812d, - 0x42a: 0x8132, 0x42b: 0x8132, 0x42c: 0x8132, 0x42d: 0x812d, 0x42e: 0x812d, 0x42f: 0x812d, - 0x430: 0x8116, 0x431: 0x8117, 0x432: 0x8118, 0x433: 0x8132, 0x434: 0x8132, 0x435: 0x8132, - 0x436: 0x812d, 0x437: 0x8132, 0x438: 0x8132, 0x439: 0x812d, 0x43a: 0x812d, 0x43b: 0x8132, - 0x43c: 0x8132, 0x43d: 0x8132, 0x43e: 0x8132, 0x43f: 0x8132, - // Block 0x11, offset 0x440 - 0x445: 0xa000, - 0x446: 0x2d26, 0x447: 0xa000, 0x448: 0x2d2e, 0x449: 0xa000, 0x44a: 0x2d36, 0x44b: 0xa000, - 0x44c: 0x2d3e, 0x44d: 0xa000, 0x44e: 0x2d46, 0x451: 0xa000, - 0x452: 0x2d4e, - 0x474: 0x8102, 0x475: 0x9900, - 0x47a: 0xa000, 0x47b: 0x2d56, - 0x47c: 0xa000, 0x47d: 0x2d5e, 0x47e: 0xa000, 0x47f: 0xa000, - // Block 0x12, offset 0x480 - 0x480: 0x0069, 0x481: 0x006b, 0x482: 0x006f, 0x483: 0x0083, 0x484: 0x00f5, 0x485: 0x00f8, - 0x486: 0x0413, 0x487: 0x0085, 0x488: 0x0089, 0x489: 0x008b, 0x48a: 0x0104, 0x48b: 0x0107, - 0x48c: 0x010a, 0x48d: 0x008f, 0x48f: 0x0097, 0x490: 0x009b, 0x491: 0x00e0, - 0x492: 0x009f, 0x493: 0x00fe, 0x494: 0x0417, 0x495: 0x041b, 0x496: 0x00a1, 0x497: 0x00a9, - 0x498: 0x00ab, 0x499: 0x0423, 0x49a: 0x012b, 0x49b: 0x00ad, 0x49c: 0x0427, 0x49d: 0x01be, - 0x49e: 0x01c1, 0x49f: 0x01c4, 0x4a0: 0x01fa, 0x4a1: 0x01fd, 0x4a2: 0x0093, 0x4a3: 0x00a5, - 0x4a4: 0x00ab, 0x4a5: 0x00ad, 0x4a6: 0x01be, 0x4a7: 0x01c1, 0x4a8: 0x01eb, 0x4a9: 0x01fa, - 0x4aa: 0x01fd, - 0x4b8: 0x020c, - // Block 0x13, offset 0x4c0 - 0x4db: 0x00fb, 0x4dc: 0x0087, 0x4dd: 0x0101, - 0x4de: 0x00d4, 0x4df: 0x010a, 0x4e0: 0x008d, 0x4e1: 0x010d, 0x4e2: 0x0110, 0x4e3: 0x0116, - 0x4e4: 0x011c, 0x4e5: 0x011f, 0x4e6: 0x0122, 0x4e7: 0x042b, 0x4e8: 0x016a, 0x4e9: 0x0128, - 0x4ea: 0x042f, 0x4eb: 0x016d, 0x4ec: 0x0131, 0x4ed: 0x012e, 0x4ee: 0x0134, 0x4ef: 0x0137, - 0x4f0: 0x013a, 0x4f1: 0x013d, 0x4f2: 0x0140, 0x4f3: 0x014c, 0x4f4: 0x014f, 0x4f5: 0x00ec, - 0x4f6: 0x0152, 0x4f7: 0x0155, 0x4f8: 0x041f, 0x4f9: 0x0158, 0x4fa: 0x015b, 0x4fb: 0x00b5, - 0x4fc: 0x015e, 0x4fd: 0x0161, 0x4fe: 0x0164, 0x4ff: 0x01d0, - // Block 0x14, offset 0x500 - 0x500: 0x8132, 0x501: 0x8132, 0x502: 0x812d, 0x503: 0x8132, 0x504: 0x8132, 0x505: 0x8132, - 0x506: 0x8132, 0x507: 0x8132, 0x508: 0x8132, 0x509: 0x8132, 0x50a: 0x812d, 0x50b: 0x8132, - 0x50c: 0x8132, 0x50d: 0x8135, 0x50e: 0x812a, 0x50f: 0x812d, 0x510: 0x8129, 0x511: 0x8132, - 0x512: 0x8132, 0x513: 0x8132, 0x514: 0x8132, 0x515: 0x8132, 0x516: 0x8132, 0x517: 0x8132, - 0x518: 0x8132, 0x519: 0x8132, 0x51a: 0x8132, 0x51b: 0x8132, 0x51c: 0x8132, 0x51d: 0x8132, - 0x51e: 0x8132, 0x51f: 0x8132, 0x520: 0x8132, 0x521: 0x8132, 0x522: 0x8132, 0x523: 0x8132, - 0x524: 0x8132, 0x525: 0x8132, 0x526: 0x8132, 0x527: 0x8132, 0x528: 0x8132, 0x529: 0x8132, - 0x52a: 0x8132, 0x52b: 0x8132, 0x52c: 0x8132, 0x52d: 0x8132, 0x52e: 0x8132, 0x52f: 0x8132, - 0x530: 0x8132, 0x531: 0x8132, 0x532: 0x8132, 0x533: 0x8132, 0x534: 0x8132, 0x535: 0x8132, - 0x536: 0x8133, 0x537: 0x8131, 0x538: 0x8131, 0x539: 0x812d, 0x53b: 0x8132, - 0x53c: 0x8134, 0x53d: 0x812d, 0x53e: 0x8132, 0x53f: 0x812d, - // Block 0x15, offset 0x540 - 0x540: 0x2f97, 0x541: 0x32a3, 0x542: 0x2fa1, 0x543: 0x32ad, 0x544: 0x2fa6, 0x545: 0x32b2, - 0x546: 0x2fab, 0x547: 0x32b7, 0x548: 0x38cc, 0x549: 0x3a5b, 0x54a: 0x2fc4, 0x54b: 0x32d0, - 0x54c: 0x2fce, 0x54d: 0x32da, 0x54e: 0x2fdd, 0x54f: 0x32e9, 0x550: 0x2fd3, 0x551: 0x32df, - 0x552: 0x2fd8, 0x553: 0x32e4, 0x554: 0x38ef, 0x555: 0x3a7e, 0x556: 0x38f6, 0x557: 0x3a85, - 0x558: 0x3019, 0x559: 0x3325, 0x55a: 0x301e, 0x55b: 0x332a, 0x55c: 0x3904, 0x55d: 0x3a93, - 0x55e: 0x3023, 0x55f: 0x332f, 0x560: 0x3032, 0x561: 0x333e, 0x562: 0x3050, 0x563: 0x335c, - 0x564: 0x305f, 0x565: 0x336b, 0x566: 0x3055, 0x567: 0x3361, 0x568: 0x3064, 0x569: 0x3370, - 0x56a: 0x3069, 0x56b: 0x3375, 0x56c: 0x30af, 0x56d: 0x33bb, 0x56e: 0x390b, 0x56f: 0x3a9a, - 0x570: 0x30b9, 0x571: 0x33ca, 0x572: 0x30c3, 0x573: 0x33d4, 0x574: 0x30cd, 0x575: 0x33de, - 0x576: 0x46c4, 0x577: 0x4755, 0x578: 0x3912, 0x579: 0x3aa1, 0x57a: 0x30e6, 0x57b: 0x33f7, - 0x57c: 0x30e1, 0x57d: 0x33f2, 0x57e: 0x30eb, 0x57f: 0x33fc, - // Block 0x16, offset 0x580 - 0x580: 0x30f0, 0x581: 0x3401, 0x582: 0x30f5, 0x583: 0x3406, 0x584: 0x3109, 0x585: 0x341a, - 0x586: 0x3113, 0x587: 0x3424, 0x588: 0x3122, 0x589: 0x3433, 0x58a: 0x311d, 0x58b: 0x342e, - 0x58c: 0x3935, 0x58d: 0x3ac4, 0x58e: 0x3943, 0x58f: 0x3ad2, 0x590: 0x394a, 0x591: 0x3ad9, - 0x592: 0x3951, 0x593: 0x3ae0, 0x594: 0x314f, 0x595: 0x3460, 0x596: 0x3154, 0x597: 0x3465, - 0x598: 0x315e, 0x599: 0x346f, 0x59a: 0x46f1, 0x59b: 0x4782, 0x59c: 0x3997, 0x59d: 0x3b26, - 0x59e: 0x3177, 0x59f: 0x3488, 0x5a0: 0x3181, 0x5a1: 0x3492, 0x5a2: 0x4700, 0x5a3: 0x4791, - 0x5a4: 0x399e, 0x5a5: 0x3b2d, 0x5a6: 0x39a5, 0x5a7: 0x3b34, 0x5a8: 0x39ac, 0x5a9: 0x3b3b, - 0x5aa: 0x3190, 0x5ab: 0x34a1, 0x5ac: 0x319a, 0x5ad: 0x34b0, 0x5ae: 0x31ae, 0x5af: 0x34c4, - 0x5b0: 0x31a9, 0x5b1: 0x34bf, 0x5b2: 0x31ea, 0x5b3: 0x3500, 0x5b4: 0x31f9, 0x5b5: 0x350f, - 0x5b6: 0x31f4, 0x5b7: 0x350a, 0x5b8: 0x39b3, 0x5b9: 0x3b42, 0x5ba: 0x39ba, 0x5bb: 0x3b49, - 0x5bc: 0x31fe, 0x5bd: 0x3514, 0x5be: 0x3203, 0x5bf: 0x3519, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x3208, 0x5c1: 0x351e, 0x5c2: 0x320d, 0x5c3: 0x3523, 0x5c4: 0x321c, 0x5c5: 0x3532, - 0x5c6: 0x3217, 0x5c7: 0x352d, 0x5c8: 0x3221, 0x5c9: 0x353c, 0x5ca: 0x3226, 0x5cb: 0x3541, - 0x5cc: 0x322b, 0x5cd: 0x3546, 0x5ce: 0x3249, 0x5cf: 0x3564, 0x5d0: 0x3262, 0x5d1: 0x3582, - 0x5d2: 0x3271, 0x5d3: 0x3591, 0x5d4: 0x3276, 0x5d5: 0x3596, 0x5d6: 0x337a, 0x5d7: 0x34a6, - 0x5d8: 0x3537, 0x5d9: 0x3573, 0x5da: 0x1be0, 0x5db: 0x42d7, - 0x5e0: 0x46a1, 0x5e1: 0x4732, 0x5e2: 0x2f83, 0x5e3: 0x328f, - 0x5e4: 0x3878, 0x5e5: 0x3a07, 0x5e6: 0x3871, 0x5e7: 0x3a00, 0x5e8: 0x3886, 0x5e9: 0x3a15, - 0x5ea: 0x387f, 0x5eb: 0x3a0e, 0x5ec: 0x38be, 0x5ed: 0x3a4d, 0x5ee: 0x3894, 0x5ef: 0x3a23, - 0x5f0: 0x388d, 0x5f1: 0x3a1c, 0x5f2: 0x38a2, 0x5f3: 0x3a31, 0x5f4: 0x389b, 0x5f5: 0x3a2a, - 0x5f6: 0x38c5, 0x5f7: 0x3a54, 0x5f8: 0x46b5, 0x5f9: 0x4746, 0x5fa: 0x3000, 0x5fb: 0x330c, - 0x5fc: 0x2fec, 0x5fd: 0x32f8, 0x5fe: 0x38da, 0x5ff: 0x3a69, - // Block 0x18, offset 0x600 - 0x600: 0x38d3, 0x601: 0x3a62, 0x602: 0x38e8, 0x603: 0x3a77, 0x604: 0x38e1, 0x605: 0x3a70, - 0x606: 0x38fd, 0x607: 0x3a8c, 0x608: 0x3091, 0x609: 0x339d, 0x60a: 0x30a5, 0x60b: 0x33b1, - 0x60c: 0x46e7, 0x60d: 0x4778, 0x60e: 0x3136, 0x60f: 0x3447, 0x610: 0x3920, 0x611: 0x3aaf, - 0x612: 0x3919, 0x613: 0x3aa8, 0x614: 0x392e, 0x615: 0x3abd, 0x616: 0x3927, 0x617: 0x3ab6, - 0x618: 0x3989, 0x619: 0x3b18, 0x61a: 0x396d, 0x61b: 0x3afc, 0x61c: 0x3966, 0x61d: 0x3af5, - 0x61e: 0x397b, 0x61f: 0x3b0a, 0x620: 0x3974, 0x621: 0x3b03, 0x622: 0x3982, 0x623: 0x3b11, - 0x624: 0x31e5, 0x625: 0x34fb, 0x626: 0x31c7, 0x627: 0x34dd, 0x628: 0x39e4, 0x629: 0x3b73, - 0x62a: 0x39dd, 0x62b: 0x3b6c, 0x62c: 0x39f2, 0x62d: 0x3b81, 0x62e: 0x39eb, 0x62f: 0x3b7a, - 0x630: 0x39f9, 0x631: 0x3b88, 0x632: 0x3230, 0x633: 0x354b, 0x634: 0x3258, 0x635: 0x3578, - 0x636: 0x3253, 0x637: 0x356e, 0x638: 0x323f, 0x639: 0x355a, - // Block 0x19, offset 0x640 - 0x640: 0x4804, 0x641: 0x480a, 0x642: 0x491e, 0x643: 0x4936, 0x644: 0x4926, 0x645: 0x493e, - 0x646: 0x492e, 0x647: 0x4946, 0x648: 0x47aa, 0x649: 0x47b0, 0x64a: 0x488e, 0x64b: 0x48a6, - 0x64c: 0x4896, 0x64d: 0x48ae, 0x64e: 0x489e, 0x64f: 0x48b6, 0x650: 0x4816, 0x651: 0x481c, - 0x652: 0x3db8, 0x653: 0x3dc8, 0x654: 0x3dc0, 0x655: 0x3dd0, - 0x658: 0x47b6, 0x659: 0x47bc, 0x65a: 0x3ce8, 0x65b: 0x3cf8, 0x65c: 0x3cf0, 0x65d: 0x3d00, - 0x660: 0x482e, 0x661: 0x4834, 0x662: 0x494e, 0x663: 0x4966, - 0x664: 0x4956, 0x665: 0x496e, 0x666: 0x495e, 0x667: 0x4976, 0x668: 0x47c2, 0x669: 0x47c8, - 0x66a: 0x48be, 0x66b: 0x48d6, 0x66c: 0x48c6, 0x66d: 0x48de, 0x66e: 0x48ce, 0x66f: 0x48e6, - 0x670: 0x4846, 0x671: 0x484c, 0x672: 0x3e18, 0x673: 0x3e30, 0x674: 0x3e20, 0x675: 0x3e38, - 0x676: 0x3e28, 0x677: 0x3e40, 0x678: 0x47ce, 0x679: 0x47d4, 0x67a: 0x3d18, 0x67b: 0x3d30, - 0x67c: 0x3d20, 0x67d: 0x3d38, 0x67e: 0x3d28, 0x67f: 0x3d40, - // Block 0x1a, offset 0x680 - 0x680: 0x4852, 0x681: 0x4858, 0x682: 0x3e48, 0x683: 0x3e58, 0x684: 0x3e50, 0x685: 0x3e60, - 0x688: 0x47da, 0x689: 0x47e0, 0x68a: 0x3d48, 0x68b: 0x3d58, - 0x68c: 0x3d50, 0x68d: 0x3d60, 0x690: 0x4864, 0x691: 0x486a, - 0x692: 0x3e80, 0x693: 0x3e98, 0x694: 0x3e88, 0x695: 0x3ea0, 0x696: 0x3e90, 0x697: 0x3ea8, - 0x699: 0x47e6, 0x69b: 0x3d68, 0x69d: 0x3d70, - 0x69f: 0x3d78, 0x6a0: 0x487c, 0x6a1: 0x4882, 0x6a2: 0x497e, 0x6a3: 0x4996, - 0x6a4: 0x4986, 0x6a5: 0x499e, 0x6a6: 0x498e, 0x6a7: 0x49a6, 0x6a8: 0x47ec, 0x6a9: 0x47f2, - 0x6aa: 0x48ee, 0x6ab: 0x4906, 0x6ac: 0x48f6, 0x6ad: 0x490e, 0x6ae: 0x48fe, 0x6af: 0x4916, - 0x6b0: 0x47f8, 0x6b1: 0x431e, 0x6b2: 0x3691, 0x6b3: 0x4324, 0x6b4: 0x4822, 0x6b5: 0x432a, - 0x6b6: 0x36a3, 0x6b7: 0x4330, 0x6b8: 0x36c1, 0x6b9: 0x4336, 0x6ba: 0x36d9, 0x6bb: 0x433c, - 0x6bc: 0x4870, 0x6bd: 0x4342, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x3da0, 0x6c1: 0x3da8, 0x6c2: 0x4184, 0x6c3: 0x41a2, 0x6c4: 0x418e, 0x6c5: 0x41ac, - 0x6c6: 0x4198, 0x6c7: 0x41b6, 0x6c8: 0x3cd8, 0x6c9: 0x3ce0, 0x6ca: 0x40d0, 0x6cb: 0x40ee, - 0x6cc: 0x40da, 0x6cd: 0x40f8, 0x6ce: 0x40e4, 0x6cf: 0x4102, 0x6d0: 0x3de8, 0x6d1: 0x3df0, - 0x6d2: 0x41c0, 0x6d3: 0x41de, 0x6d4: 0x41ca, 0x6d5: 0x41e8, 0x6d6: 0x41d4, 0x6d7: 0x41f2, - 0x6d8: 0x3d08, 0x6d9: 0x3d10, 0x6da: 0x410c, 0x6db: 0x412a, 0x6dc: 0x4116, 0x6dd: 0x4134, - 0x6de: 0x4120, 0x6df: 0x413e, 0x6e0: 0x3ec0, 0x6e1: 0x3ec8, 0x6e2: 0x41fc, 0x6e3: 0x421a, - 0x6e4: 0x4206, 0x6e5: 0x4224, 0x6e6: 0x4210, 0x6e7: 0x422e, 0x6e8: 0x3d80, 0x6e9: 0x3d88, - 0x6ea: 0x4148, 0x6eb: 0x4166, 0x6ec: 0x4152, 0x6ed: 0x4170, 0x6ee: 0x415c, 0x6ef: 0x417a, - 0x6f0: 0x3685, 0x6f1: 0x367f, 0x6f2: 0x3d90, 0x6f3: 0x368b, 0x6f4: 0x3d98, - 0x6f6: 0x4810, 0x6f7: 0x3db0, 0x6f8: 0x35f5, 0x6f9: 0x35ef, 0x6fa: 0x35e3, 0x6fb: 0x42ee, - 0x6fc: 0x35fb, 0x6fd: 0x4287, 0x6fe: 0x01d3, 0x6ff: 0x4287, - // Block 0x1c, offset 0x700 - 0x700: 0x42a0, 0x701: 0x4482, 0x702: 0x3dd8, 0x703: 0x369d, 0x704: 0x3de0, - 0x706: 0x483a, 0x707: 0x3df8, 0x708: 0x3601, 0x709: 0x42f4, 0x70a: 0x360d, 0x70b: 0x42fa, - 0x70c: 0x3619, 0x70d: 0x4489, 0x70e: 0x4490, 0x70f: 0x4497, 0x710: 0x36b5, 0x711: 0x36af, - 0x712: 0x3e00, 0x713: 0x44e4, 0x716: 0x36bb, 0x717: 0x3e10, - 0x718: 0x3631, 0x719: 0x362b, 0x71a: 0x361f, 0x71b: 0x4300, 0x71d: 0x449e, - 0x71e: 0x44a5, 0x71f: 0x44ac, 0x720: 0x36eb, 0x721: 0x36e5, 0x722: 0x3e68, 0x723: 0x44ec, - 0x724: 0x36cd, 0x725: 0x36d3, 0x726: 0x36f1, 0x727: 0x3e78, 0x728: 0x3661, 0x729: 0x365b, - 0x72a: 0x364f, 0x72b: 0x430c, 0x72c: 0x3649, 0x72d: 0x4474, 0x72e: 0x447b, 0x72f: 0x0081, - 0x732: 0x3eb0, 0x733: 0x36f7, 0x734: 0x3eb8, - 0x736: 0x4888, 0x737: 0x3ed0, 0x738: 0x363d, 0x739: 0x4306, 0x73a: 0x366d, 0x73b: 0x4318, - 0x73c: 0x3679, 0x73d: 0x425a, 0x73e: 0x428c, - // Block 0x1d, offset 0x740 - 0x740: 0x1bd8, 0x741: 0x1bdc, 0x742: 0x0047, 0x743: 0x1c54, 0x745: 0x1be8, - 0x746: 0x1bec, 0x747: 0x00e9, 0x749: 0x1c58, 0x74a: 0x008f, 0x74b: 0x0051, - 0x74c: 0x0051, 0x74d: 0x0051, 0x74e: 0x0091, 0x74f: 0x00da, 0x750: 0x0053, 0x751: 0x0053, - 0x752: 0x0059, 0x753: 0x0099, 0x755: 0x005d, 0x756: 0x198d, - 0x759: 0x0061, 0x75a: 0x0063, 0x75b: 0x0065, 0x75c: 0x0065, 0x75d: 0x0065, - 0x760: 0x199f, 0x761: 0x1bc8, 0x762: 0x19a8, - 0x764: 0x0075, 0x766: 0x01b8, 0x768: 0x0075, - 0x76a: 0x0057, 0x76b: 0x42d2, 0x76c: 0x0045, 0x76d: 0x0047, 0x76f: 0x008b, - 0x770: 0x004b, 0x771: 0x004d, 0x773: 0x005b, 0x774: 0x009f, 0x775: 0x0215, - 0x776: 0x0218, 0x777: 0x021b, 0x778: 0x021e, 0x779: 0x0093, 0x77b: 0x1b98, - 0x77c: 0x01e8, 0x77d: 0x01c1, 0x77e: 0x0179, 0x77f: 0x01a0, - // Block 0x1e, offset 0x780 - 0x780: 0x0463, 0x785: 0x0049, - 0x786: 0x0089, 0x787: 0x008b, 0x788: 0x0093, 0x789: 0x0095, - 0x790: 0x222e, 0x791: 0x223a, - 0x792: 0x22ee, 0x793: 0x2216, 0x794: 0x229a, 0x795: 0x2222, 0x796: 0x22a0, 0x797: 0x22b8, - 0x798: 0x22c4, 0x799: 0x2228, 0x79a: 0x22ca, 0x79b: 0x2234, 0x79c: 0x22be, 0x79d: 0x22d0, - 0x79e: 0x22d6, 0x79f: 0x1cbc, 0x7a0: 0x0053, 0x7a1: 0x195a, 0x7a2: 0x1ba4, 0x7a3: 0x1963, - 0x7a4: 0x006d, 0x7a5: 0x19ab, 0x7a6: 0x1bd0, 0x7a7: 0x1d48, 0x7a8: 0x1966, 0x7a9: 0x0071, - 0x7aa: 0x19b7, 0x7ab: 0x1bd4, 0x7ac: 0x0059, 0x7ad: 0x0047, 0x7ae: 0x0049, 0x7af: 0x005b, - 0x7b0: 0x0093, 0x7b1: 0x19e4, 0x7b2: 0x1c18, 0x7b3: 0x19ed, 0x7b4: 0x00ad, 0x7b5: 0x1a62, - 0x7b6: 0x1c4c, 0x7b7: 0x1d5c, 0x7b8: 0x19f0, 0x7b9: 0x00b1, 0x7ba: 0x1a65, 0x7bb: 0x1c50, - 0x7bc: 0x0099, 0x7bd: 0x0087, 0x7be: 0x0089, 0x7bf: 0x009b, - // Block 0x1f, offset 0x7c0 - 0x7c1: 0x3c06, 0x7c3: 0xa000, 0x7c4: 0x3c0d, 0x7c5: 0xa000, - 0x7c7: 0x3c14, 0x7c8: 0xa000, 0x7c9: 0x3c1b, - 0x7cd: 0xa000, - 0x7e0: 0x2f65, 0x7e1: 0xa000, 0x7e2: 0x3c29, - 0x7e4: 0xa000, 0x7e5: 0xa000, - 0x7ed: 0x3c22, 0x7ee: 0x2f60, 0x7ef: 0x2f6a, - 0x7f0: 0x3c30, 0x7f1: 0x3c37, 0x7f2: 0xa000, 0x7f3: 0xa000, 0x7f4: 0x3c3e, 0x7f5: 0x3c45, - 0x7f6: 0xa000, 0x7f7: 0xa000, 0x7f8: 0x3c4c, 0x7f9: 0x3c53, 0x7fa: 0xa000, 0x7fb: 0xa000, - 0x7fc: 0xa000, 0x7fd: 0xa000, - // Block 0x20, offset 0x800 - 0x800: 0x3c5a, 0x801: 0x3c61, 0x802: 0xa000, 0x803: 0xa000, 0x804: 0x3c76, 0x805: 0x3c7d, - 0x806: 0xa000, 0x807: 0xa000, 0x808: 0x3c84, 0x809: 0x3c8b, - 0x811: 0xa000, - 0x812: 0xa000, - 0x822: 0xa000, - 0x828: 0xa000, 0x829: 0xa000, - 0x82b: 0xa000, 0x82c: 0x3ca0, 0x82d: 0x3ca7, 0x82e: 0x3cae, 0x82f: 0x3cb5, - 0x832: 0xa000, 0x833: 0xa000, 0x834: 0xa000, 0x835: 0xa000, - // Block 0x21, offset 0x840 - 0x860: 0x0023, 0x861: 0x0025, 0x862: 0x0027, 0x863: 0x0029, - 0x864: 0x002b, 0x865: 0x002d, 0x866: 0x002f, 0x867: 0x0031, 0x868: 0x0033, 0x869: 0x1882, - 0x86a: 0x1885, 0x86b: 0x1888, 0x86c: 0x188b, 0x86d: 0x188e, 0x86e: 0x1891, 0x86f: 0x1894, - 0x870: 0x1897, 0x871: 0x189a, 0x872: 0x189d, 0x873: 0x18a6, 0x874: 0x1a68, 0x875: 0x1a6c, - 0x876: 0x1a70, 0x877: 0x1a74, 0x878: 0x1a78, 0x879: 0x1a7c, 0x87a: 0x1a80, 0x87b: 0x1a84, - 0x87c: 0x1a88, 0x87d: 0x1c80, 0x87e: 0x1c85, 0x87f: 0x1c8a, - // Block 0x22, offset 0x880 - 0x880: 0x1c8f, 0x881: 0x1c94, 0x882: 0x1c99, 0x883: 0x1c9e, 0x884: 0x1ca3, 0x885: 0x1ca8, - 0x886: 0x1cad, 0x887: 0x1cb2, 0x888: 0x187f, 0x889: 0x18a3, 0x88a: 0x18c7, 0x88b: 0x18eb, - 0x88c: 0x190f, 0x88d: 0x1918, 0x88e: 0x191e, 0x88f: 0x1924, 0x890: 0x192a, 0x891: 0x1b60, - 0x892: 0x1b64, 0x893: 0x1b68, 0x894: 0x1b6c, 0x895: 0x1b70, 0x896: 0x1b74, 0x897: 0x1b78, - 0x898: 0x1b7c, 0x899: 0x1b80, 0x89a: 0x1b84, 0x89b: 0x1b88, 0x89c: 0x1af4, 0x89d: 0x1af8, - 0x89e: 0x1afc, 0x89f: 0x1b00, 0x8a0: 0x1b04, 0x8a1: 0x1b08, 0x8a2: 0x1b0c, 0x8a3: 0x1b10, - 0x8a4: 0x1b14, 0x8a5: 0x1b18, 0x8a6: 0x1b1c, 0x8a7: 0x1b20, 0x8a8: 0x1b24, 0x8a9: 0x1b28, - 0x8aa: 0x1b2c, 0x8ab: 0x1b30, 0x8ac: 0x1b34, 0x8ad: 0x1b38, 0x8ae: 0x1b3c, 0x8af: 0x1b40, - 0x8b0: 0x1b44, 0x8b1: 0x1b48, 0x8b2: 0x1b4c, 0x8b3: 0x1b50, 0x8b4: 0x1b54, 0x8b5: 0x1b58, - 0x8b6: 0x0043, 0x8b7: 0x0045, 0x8b8: 0x0047, 0x8b9: 0x0049, 0x8ba: 0x004b, 0x8bb: 0x004d, - 0x8bc: 0x004f, 0x8bd: 0x0051, 0x8be: 0x0053, 0x8bf: 0x0055, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x06bf, 0x8c1: 0x06e3, 0x8c2: 0x06ef, 0x8c3: 0x06ff, 0x8c4: 0x0707, 0x8c5: 0x0713, - 0x8c6: 0x071b, 0x8c7: 0x0723, 0x8c8: 0x072f, 0x8c9: 0x0783, 0x8ca: 0x079b, 0x8cb: 0x07ab, - 0x8cc: 0x07bb, 0x8cd: 0x07cb, 0x8ce: 0x07db, 0x8cf: 0x07fb, 0x8d0: 0x07ff, 0x8d1: 0x0803, - 0x8d2: 0x0837, 0x8d3: 0x085f, 0x8d4: 0x086f, 0x8d5: 0x0877, 0x8d6: 0x087b, 0x8d7: 0x0887, - 0x8d8: 0x08a3, 0x8d9: 0x08a7, 0x8da: 0x08bf, 0x8db: 0x08c3, 0x8dc: 0x08cb, 0x8dd: 0x08db, - 0x8de: 0x0977, 0x8df: 0x098b, 0x8e0: 0x09cb, 0x8e1: 0x09df, 0x8e2: 0x09e7, 0x8e3: 0x09eb, - 0x8e4: 0x09fb, 0x8e5: 0x0a17, 0x8e6: 0x0a43, 0x8e7: 0x0a4f, 0x8e8: 0x0a6f, 0x8e9: 0x0a7b, - 0x8ea: 0x0a7f, 0x8eb: 0x0a83, 0x8ec: 0x0a9b, 0x8ed: 0x0a9f, 0x8ee: 0x0acb, 0x8ef: 0x0ad7, - 0x8f0: 0x0adf, 0x8f1: 0x0ae7, 0x8f2: 0x0af7, 0x8f3: 0x0aff, 0x8f4: 0x0b07, 0x8f5: 0x0b33, - 0x8f6: 0x0b37, 0x8f7: 0x0b3f, 0x8f8: 0x0b43, 0x8f9: 0x0b4b, 0x8fa: 0x0b53, 0x8fb: 0x0b63, - 0x8fc: 0x0b7f, 0x8fd: 0x0bf7, 0x8fe: 0x0c0b, 0x8ff: 0x0c0f, - // Block 0x24, offset 0x900 - 0x900: 0x0c8f, 0x901: 0x0c93, 0x902: 0x0ca7, 0x903: 0x0cab, 0x904: 0x0cb3, 0x905: 0x0cbb, - 0x906: 0x0cc3, 0x907: 0x0ccf, 0x908: 0x0cf7, 0x909: 0x0d07, 0x90a: 0x0d1b, 0x90b: 0x0d8b, - 0x90c: 0x0d97, 0x90d: 0x0da7, 0x90e: 0x0db3, 0x90f: 0x0dbf, 0x910: 0x0dc7, 0x911: 0x0dcb, - 0x912: 0x0dcf, 0x913: 0x0dd3, 0x914: 0x0dd7, 0x915: 0x0e8f, 0x916: 0x0ed7, 0x917: 0x0ee3, - 0x918: 0x0ee7, 0x919: 0x0eeb, 0x91a: 0x0eef, 0x91b: 0x0ef7, 0x91c: 0x0efb, 0x91d: 0x0f0f, - 0x91e: 0x0f2b, 0x91f: 0x0f33, 0x920: 0x0f73, 0x921: 0x0f77, 0x922: 0x0f7f, 0x923: 0x0f83, - 0x924: 0x0f8b, 0x925: 0x0f8f, 0x926: 0x0fb3, 0x927: 0x0fb7, 0x928: 0x0fd3, 0x929: 0x0fd7, - 0x92a: 0x0fdb, 0x92b: 0x0fdf, 0x92c: 0x0ff3, 0x92d: 0x1017, 0x92e: 0x101b, 0x92f: 0x101f, - 0x930: 0x1043, 0x931: 0x1083, 0x932: 0x1087, 0x933: 0x10a7, 0x934: 0x10b7, 0x935: 0x10bf, - 0x936: 0x10df, 0x937: 0x1103, 0x938: 0x1147, 0x939: 0x114f, 0x93a: 0x1163, 0x93b: 0x116f, - 0x93c: 0x1177, 0x93d: 0x117f, 0x93e: 0x1183, 0x93f: 0x1187, - // Block 0x25, offset 0x940 - 0x940: 0x119f, 0x941: 0x11a3, 0x942: 0x11bf, 0x943: 0x11c7, 0x944: 0x11cf, 0x945: 0x11d3, - 0x946: 0x11df, 0x947: 0x11e7, 0x948: 0x11eb, 0x949: 0x11ef, 0x94a: 0x11f7, 0x94b: 0x11fb, - 0x94c: 0x129b, 0x94d: 0x12af, 0x94e: 0x12e3, 0x94f: 0x12e7, 0x950: 0x12ef, 0x951: 0x131b, - 0x952: 0x1323, 0x953: 0x132b, 0x954: 0x1333, 0x955: 0x136f, 0x956: 0x1373, 0x957: 0x137b, - 0x958: 0x137f, 0x959: 0x1383, 0x95a: 0x13af, 0x95b: 0x13b3, 0x95c: 0x13bb, 0x95d: 0x13cf, - 0x95e: 0x13d3, 0x95f: 0x13ef, 0x960: 0x13f7, 0x961: 0x13fb, 0x962: 0x141f, 0x963: 0x143f, - 0x964: 0x1453, 0x965: 0x1457, 0x966: 0x145f, 0x967: 0x148b, 0x968: 0x148f, 0x969: 0x149f, - 0x96a: 0x14c3, 0x96b: 0x14cf, 0x96c: 0x14df, 0x96d: 0x14f7, 0x96e: 0x14ff, 0x96f: 0x1503, - 0x970: 0x1507, 0x971: 0x150b, 0x972: 0x1517, 0x973: 0x151b, 0x974: 0x1523, 0x975: 0x153f, - 0x976: 0x1543, 0x977: 0x1547, 0x978: 0x155f, 0x979: 0x1563, 0x97a: 0x156b, 0x97b: 0x157f, - 0x97c: 0x1583, 0x97d: 0x1587, 0x97e: 0x158f, 0x97f: 0x1593, - // Block 0x26, offset 0x980 - 0x986: 0xa000, 0x98b: 0xa000, - 0x98c: 0x3f08, 0x98d: 0xa000, 0x98e: 0x3f10, 0x98f: 0xa000, 0x990: 0x3f18, 0x991: 0xa000, - 0x992: 0x3f20, 0x993: 0xa000, 0x994: 0x3f28, 0x995: 0xa000, 0x996: 0x3f30, 0x997: 0xa000, - 0x998: 0x3f38, 0x999: 0xa000, 0x99a: 0x3f40, 0x99b: 0xa000, 0x99c: 0x3f48, 0x99d: 0xa000, - 0x99e: 0x3f50, 0x99f: 0xa000, 0x9a0: 0x3f58, 0x9a1: 0xa000, 0x9a2: 0x3f60, - 0x9a4: 0xa000, 0x9a5: 0x3f68, 0x9a6: 0xa000, 0x9a7: 0x3f70, 0x9a8: 0xa000, 0x9a9: 0x3f78, - 0x9af: 0xa000, - 0x9b0: 0x3f80, 0x9b1: 0x3f88, 0x9b2: 0xa000, 0x9b3: 0x3f90, 0x9b4: 0x3f98, 0x9b5: 0xa000, - 0x9b6: 0x3fa0, 0x9b7: 0x3fa8, 0x9b8: 0xa000, 0x9b9: 0x3fb0, 0x9ba: 0x3fb8, 0x9bb: 0xa000, - 0x9bc: 0x3fc0, 0x9bd: 0x3fc8, - // Block 0x27, offset 0x9c0 - 0x9d4: 0x3f00, - 0x9d9: 0x9903, 0x9da: 0x9903, 0x9db: 0x42dc, 0x9dc: 0x42e2, 0x9dd: 0xa000, - 0x9de: 0x3fd0, 0x9df: 0x26b4, - 0x9e6: 0xa000, - 0x9eb: 0xa000, 0x9ec: 0x3fe0, 0x9ed: 0xa000, 0x9ee: 0x3fe8, 0x9ef: 0xa000, - 0x9f0: 0x3ff0, 0x9f1: 0xa000, 0x9f2: 0x3ff8, 0x9f3: 0xa000, 0x9f4: 0x4000, 0x9f5: 0xa000, - 0x9f6: 0x4008, 0x9f7: 0xa000, 0x9f8: 0x4010, 0x9f9: 0xa000, 0x9fa: 0x4018, 0x9fb: 0xa000, - 0x9fc: 0x4020, 0x9fd: 0xa000, 0x9fe: 0x4028, 0x9ff: 0xa000, - // Block 0x28, offset 0xa00 - 0xa00: 0x4030, 0xa01: 0xa000, 0xa02: 0x4038, 0xa04: 0xa000, 0xa05: 0x4040, - 0xa06: 0xa000, 0xa07: 0x4048, 0xa08: 0xa000, 0xa09: 0x4050, - 0xa0f: 0xa000, 0xa10: 0x4058, 0xa11: 0x4060, - 0xa12: 0xa000, 0xa13: 0x4068, 0xa14: 0x4070, 0xa15: 0xa000, 0xa16: 0x4078, 0xa17: 0x4080, - 0xa18: 0xa000, 0xa19: 0x4088, 0xa1a: 0x4090, 0xa1b: 0xa000, 0xa1c: 0x4098, 0xa1d: 0x40a0, - 0xa2f: 0xa000, - 0xa30: 0xa000, 0xa31: 0xa000, 0xa32: 0xa000, 0xa34: 0x3fd8, - 0xa37: 0x40a8, 0xa38: 0x40b0, 0xa39: 0x40b8, 0xa3a: 0x40c0, - 0xa3d: 0xa000, 0xa3e: 0x40c8, 0xa3f: 0x26c9, - // Block 0x29, offset 0xa40 - 0xa40: 0x0367, 0xa41: 0x032b, 0xa42: 0x032f, 0xa43: 0x0333, 0xa44: 0x037b, 0xa45: 0x0337, - 0xa46: 0x033b, 0xa47: 0x033f, 0xa48: 0x0343, 0xa49: 0x0347, 0xa4a: 0x034b, 0xa4b: 0x034f, - 0xa4c: 0x0353, 0xa4d: 0x0357, 0xa4e: 0x035b, 0xa4f: 0x49bd, 0xa50: 0x49c3, 0xa51: 0x49c9, - 0xa52: 0x49cf, 0xa53: 0x49d5, 0xa54: 0x49db, 0xa55: 0x49e1, 0xa56: 0x49e7, 0xa57: 0x49ed, - 0xa58: 0x49f3, 0xa59: 0x49f9, 0xa5a: 0x49ff, 0xa5b: 0x4a05, 0xa5c: 0x4a0b, 0xa5d: 0x4a11, - 0xa5e: 0x4a17, 0xa5f: 0x4a1d, 0xa60: 0x4a23, 0xa61: 0x4a29, 0xa62: 0x4a2f, 0xa63: 0x4a35, - 0xa64: 0x03c3, 0xa65: 0x035f, 0xa66: 0x0363, 0xa67: 0x03e7, 0xa68: 0x03eb, 0xa69: 0x03ef, - 0xa6a: 0x03f3, 0xa6b: 0x03f7, 0xa6c: 0x03fb, 0xa6d: 0x03ff, 0xa6e: 0x036b, 0xa6f: 0x0403, - 0xa70: 0x0407, 0xa71: 0x036f, 0xa72: 0x0373, 0xa73: 0x0377, 0xa74: 0x037f, 0xa75: 0x0383, - 0xa76: 0x0387, 0xa77: 0x038b, 0xa78: 0x038f, 0xa79: 0x0393, 0xa7a: 0x0397, 0xa7b: 0x039b, - 0xa7c: 0x039f, 0xa7d: 0x03a3, 0xa7e: 0x03a7, 0xa7f: 0x03ab, - // Block 0x2a, offset 0xa80 - 0xa80: 0x03af, 0xa81: 0x03b3, 0xa82: 0x040b, 0xa83: 0x040f, 0xa84: 0x03b7, 0xa85: 0x03bb, - 0xa86: 0x03bf, 0xa87: 0x03c7, 0xa88: 0x03cb, 0xa89: 0x03cf, 0xa8a: 0x03d3, 0xa8b: 0x03d7, - 0xa8c: 0x03db, 0xa8d: 0x03df, 0xa8e: 0x03e3, - 0xa92: 0x06bf, 0xa93: 0x071b, 0xa94: 0x06cb, 0xa95: 0x097b, 0xa96: 0x06cf, 0xa97: 0x06e7, - 0xa98: 0x06d3, 0xa99: 0x0f93, 0xa9a: 0x0707, 0xa9b: 0x06db, 0xa9c: 0x06c3, 0xa9d: 0x09ff, - 0xa9e: 0x098f, 0xa9f: 0x072f, - // Block 0x2b, offset 0xac0 - 0xac0: 0x2054, 0xac1: 0x205a, 0xac2: 0x2060, 0xac3: 0x2066, 0xac4: 0x206c, 0xac5: 0x2072, - 0xac6: 0x2078, 0xac7: 0x207e, 0xac8: 0x2084, 0xac9: 0x208a, 0xaca: 0x2090, 0xacb: 0x2096, - 0xacc: 0x209c, 0xacd: 0x20a2, 0xace: 0x2726, 0xacf: 0x272f, 0xad0: 0x2738, 0xad1: 0x2741, - 0xad2: 0x274a, 0xad3: 0x2753, 0xad4: 0x275c, 0xad5: 0x2765, 0xad6: 0x276e, 0xad7: 0x2780, - 0xad8: 0x2789, 0xad9: 0x2792, 0xada: 0x279b, 0xadb: 0x27a4, 0xadc: 0x2777, 0xadd: 0x2bac, - 0xade: 0x2aed, 0xae0: 0x20a8, 0xae1: 0x20c0, 0xae2: 0x20b4, 0xae3: 0x2108, - 0xae4: 0x20c6, 0xae5: 0x20e4, 0xae6: 0x20ae, 0xae7: 0x20de, 0xae8: 0x20ba, 0xae9: 0x20f0, - 0xaea: 0x2120, 0xaeb: 0x213e, 0xaec: 0x2138, 0xaed: 0x212c, 0xaee: 0x217a, 0xaef: 0x210e, - 0xaf0: 0x211a, 0xaf1: 0x2132, 0xaf2: 0x2126, 0xaf3: 0x2150, 0xaf4: 0x20fc, 0xaf5: 0x2144, - 0xaf6: 0x216e, 0xaf7: 0x2156, 0xaf8: 0x20ea, 0xaf9: 0x20cc, 0xafa: 0x2102, 0xafb: 0x2114, - 0xafc: 0x214a, 0xafd: 0x20d2, 0xafe: 0x2174, 0xaff: 0x20f6, - // Block 0x2c, offset 0xb00 - 0xb00: 0x215c, 0xb01: 0x20d8, 0xb02: 0x2162, 0xb03: 0x2168, 0xb04: 0x092f, 0xb05: 0x0b03, - 0xb06: 0x0ca7, 0xb07: 0x10c7, - 0xb10: 0x1bc4, 0xb11: 0x18a9, - 0xb12: 0x18ac, 0xb13: 0x18af, 0xb14: 0x18b2, 0xb15: 0x18b5, 0xb16: 0x18b8, 0xb17: 0x18bb, - 0xb18: 0x18be, 0xb19: 0x18c1, 0xb1a: 0x18ca, 0xb1b: 0x18cd, 0xb1c: 0x18d0, 0xb1d: 0x18d3, - 0xb1e: 0x18d6, 0xb1f: 0x18d9, 0xb20: 0x0313, 0xb21: 0x031b, 0xb22: 0x031f, 0xb23: 0x0327, - 0xb24: 0x032b, 0xb25: 0x032f, 0xb26: 0x0337, 0xb27: 0x033f, 0xb28: 0x0343, 0xb29: 0x034b, - 0xb2a: 0x034f, 0xb2b: 0x0353, 0xb2c: 0x0357, 0xb2d: 0x035b, 0xb2e: 0x2e18, 0xb2f: 0x2e20, - 0xb30: 0x2e28, 0xb31: 0x2e30, 0xb32: 0x2e38, 0xb33: 0x2e40, 0xb34: 0x2e48, 0xb35: 0x2e50, - 0xb36: 0x2e60, 0xb37: 0x2e68, 0xb38: 0x2e70, 0xb39: 0x2e78, 0xb3a: 0x2e80, 0xb3b: 0x2e88, - 0xb3c: 0x2ed3, 0xb3d: 0x2e9b, 0xb3e: 0x2e58, - // Block 0x2d, offset 0xb40 - 0xb40: 0x06bf, 0xb41: 0x071b, 0xb42: 0x06cb, 0xb43: 0x097b, 0xb44: 0x071f, 0xb45: 0x07af, - 0xb46: 0x06c7, 0xb47: 0x07ab, 0xb48: 0x070b, 0xb49: 0x0887, 0xb4a: 0x0d07, 0xb4b: 0x0e8f, - 0xb4c: 0x0dd7, 0xb4d: 0x0d1b, 0xb4e: 0x145f, 0xb4f: 0x098b, 0xb50: 0x0ccf, 0xb51: 0x0d4b, - 0xb52: 0x0d0b, 0xb53: 0x104b, 0xb54: 0x08fb, 0xb55: 0x0f03, 0xb56: 0x1387, 0xb57: 0x105f, - 0xb58: 0x0843, 0xb59: 0x108f, 0xb5a: 0x0f9b, 0xb5b: 0x0a17, 0xb5c: 0x140f, 0xb5d: 0x077f, - 0xb5e: 0x08ab, 0xb5f: 0x0df7, 0xb60: 0x1527, 0xb61: 0x0743, 0xb62: 0x07d3, 0xb63: 0x0d9b, - 0xb64: 0x06cf, 0xb65: 0x06e7, 0xb66: 0x06d3, 0xb67: 0x0adb, 0xb68: 0x08ef, 0xb69: 0x087f, - 0xb6a: 0x0a57, 0xb6b: 0x0a4b, 0xb6c: 0x0feb, 0xb6d: 0x073f, 0xb6e: 0x139b, 0xb6f: 0x089b, - 0xb70: 0x09f3, 0xb71: 0x18dc, 0xb72: 0x18df, 0xb73: 0x18e2, 0xb74: 0x18e5, 0xb75: 0x18ee, - 0xb76: 0x18f1, 0xb77: 0x18f4, 0xb78: 0x18f7, 0xb79: 0x18fa, 0xb7a: 0x18fd, 0xb7b: 0x1900, - 0xb7c: 0x1903, 0xb7d: 0x1906, 0xb7e: 0x1909, 0xb7f: 0x1912, - // Block 0x2e, offset 0xb80 - 0xb80: 0x1cc6, 0xb81: 0x1cd5, 0xb82: 0x1ce4, 0xb83: 0x1cf3, 0xb84: 0x1d02, 0xb85: 0x1d11, - 0xb86: 0x1d20, 0xb87: 0x1d2f, 0xb88: 0x1d3e, 0xb89: 0x218c, 0xb8a: 0x219e, 0xb8b: 0x21b0, - 0xb8c: 0x1954, 0xb8d: 0x1c04, 0xb8e: 0x19d2, 0xb8f: 0x1ba8, 0xb90: 0x04cb, 0xb91: 0x04d3, - 0xb92: 0x04db, 0xb93: 0x04e3, 0xb94: 0x04eb, 0xb95: 0x04ef, 0xb96: 0x04f3, 0xb97: 0x04f7, - 0xb98: 0x04fb, 0xb99: 0x04ff, 0xb9a: 0x0503, 0xb9b: 0x0507, 0xb9c: 0x050b, 0xb9d: 0x050f, - 0xb9e: 0x0513, 0xb9f: 0x0517, 0xba0: 0x051b, 0xba1: 0x0523, 0xba2: 0x0527, 0xba3: 0x052b, - 0xba4: 0x052f, 0xba5: 0x0533, 0xba6: 0x0537, 0xba7: 0x053b, 0xba8: 0x053f, 0xba9: 0x0543, - 0xbaa: 0x0547, 0xbab: 0x054b, 0xbac: 0x054f, 0xbad: 0x0553, 0xbae: 0x0557, 0xbaf: 0x055b, - 0xbb0: 0x055f, 0xbb1: 0x0563, 0xbb2: 0x0567, 0xbb3: 0x056f, 0xbb4: 0x0577, 0xbb5: 0x057f, - 0xbb6: 0x0583, 0xbb7: 0x0587, 0xbb8: 0x058b, 0xbb9: 0x058f, 0xbba: 0x0593, 0xbbb: 0x0597, - 0xbbc: 0x059b, 0xbbd: 0x059f, 0xbbe: 0x05a3, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x2b0c, 0xbc1: 0x29a8, 0xbc2: 0x2b1c, 0xbc3: 0x2880, 0xbc4: 0x2ee4, 0xbc5: 0x288a, - 0xbc6: 0x2894, 0xbc7: 0x2f28, 0xbc8: 0x29b5, 0xbc9: 0x289e, 0xbca: 0x28a8, 0xbcb: 0x28b2, - 0xbcc: 0x29dc, 0xbcd: 0x29e9, 0xbce: 0x29c2, 0xbcf: 0x29cf, 0xbd0: 0x2ea9, 0xbd1: 0x29f6, - 0xbd2: 0x2a03, 0xbd3: 0x2bbe, 0xbd4: 0x26bb, 0xbd5: 0x2bd1, 0xbd6: 0x2be4, 0xbd7: 0x2b2c, - 0xbd8: 0x2a10, 0xbd9: 0x2bf7, 0xbda: 0x2c0a, 0xbdb: 0x2a1d, 0xbdc: 0x28bc, 0xbdd: 0x28c6, - 0xbde: 0x2eb7, 0xbdf: 0x2a2a, 0xbe0: 0x2b3c, 0xbe1: 0x2ef5, 0xbe2: 0x28d0, 0xbe3: 0x28da, - 0xbe4: 0x2a37, 0xbe5: 0x28e4, 0xbe6: 0x28ee, 0xbe7: 0x26d0, 0xbe8: 0x26d7, 0xbe9: 0x28f8, - 0xbea: 0x2902, 0xbeb: 0x2c1d, 0xbec: 0x2a44, 0xbed: 0x2b4c, 0xbee: 0x2c30, 0xbef: 0x2a51, - 0xbf0: 0x2916, 0xbf1: 0x290c, 0xbf2: 0x2f3c, 0xbf3: 0x2a5e, 0xbf4: 0x2c43, 0xbf5: 0x2920, - 0xbf6: 0x2b5c, 0xbf7: 0x292a, 0xbf8: 0x2a78, 0xbf9: 0x2934, 0xbfa: 0x2a85, 0xbfb: 0x2f06, - 0xbfc: 0x2a6b, 0xbfd: 0x2b6c, 0xbfe: 0x2a92, 0xbff: 0x26de, - // Block 0x30, offset 0xc00 - 0xc00: 0x2f17, 0xc01: 0x293e, 0xc02: 0x2948, 0xc03: 0x2a9f, 0xc04: 0x2952, 0xc05: 0x295c, - 0xc06: 0x2966, 0xc07: 0x2b7c, 0xc08: 0x2aac, 0xc09: 0x26e5, 0xc0a: 0x2c56, 0xc0b: 0x2e90, - 0xc0c: 0x2b8c, 0xc0d: 0x2ab9, 0xc0e: 0x2ec5, 0xc0f: 0x2970, 0xc10: 0x297a, 0xc11: 0x2ac6, - 0xc12: 0x26ec, 0xc13: 0x2ad3, 0xc14: 0x2b9c, 0xc15: 0x26f3, 0xc16: 0x2c69, 0xc17: 0x2984, - 0xc18: 0x1cb7, 0xc19: 0x1ccb, 0xc1a: 0x1cda, 0xc1b: 0x1ce9, 0xc1c: 0x1cf8, 0xc1d: 0x1d07, - 0xc1e: 0x1d16, 0xc1f: 0x1d25, 0xc20: 0x1d34, 0xc21: 0x1d43, 0xc22: 0x2192, 0xc23: 0x21a4, - 0xc24: 0x21b6, 0xc25: 0x21c2, 0xc26: 0x21ce, 0xc27: 0x21da, 0xc28: 0x21e6, 0xc29: 0x21f2, - 0xc2a: 0x21fe, 0xc2b: 0x220a, 0xc2c: 0x2246, 0xc2d: 0x2252, 0xc2e: 0x225e, 0xc2f: 0x226a, - 0xc30: 0x2276, 0xc31: 0x1c14, 0xc32: 0x19c6, 0xc33: 0x1936, 0xc34: 0x1be4, 0xc35: 0x1a47, - 0xc36: 0x1a56, 0xc37: 0x19cc, 0xc38: 0x1bfc, 0xc39: 0x1c00, 0xc3a: 0x1960, 0xc3b: 0x2701, - 0xc3c: 0x270f, 0xc3d: 0x26fa, 0xc3e: 0x2708, 0xc3f: 0x2ae0, - // Block 0x31, offset 0xc40 - 0xc40: 0x1a4a, 0xc41: 0x1a32, 0xc42: 0x1c60, 0xc43: 0x1a1a, 0xc44: 0x19f3, 0xc45: 0x1969, - 0xc46: 0x1978, 0xc47: 0x1948, 0xc48: 0x1bf0, 0xc49: 0x1d52, 0xc4a: 0x1a4d, 0xc4b: 0x1a35, - 0xc4c: 0x1c64, 0xc4d: 0x1c70, 0xc4e: 0x1a26, 0xc4f: 0x19fc, 0xc50: 0x1957, 0xc51: 0x1c1c, - 0xc52: 0x1bb0, 0xc53: 0x1b9c, 0xc54: 0x1bcc, 0xc55: 0x1c74, 0xc56: 0x1a29, 0xc57: 0x19c9, - 0xc58: 0x19ff, 0xc59: 0x19de, 0xc5a: 0x1a41, 0xc5b: 0x1c78, 0xc5c: 0x1a2c, 0xc5d: 0x19c0, - 0xc5e: 0x1a02, 0xc5f: 0x1c3c, 0xc60: 0x1bf4, 0xc61: 0x1a14, 0xc62: 0x1c24, 0xc63: 0x1c40, - 0xc64: 0x1bf8, 0xc65: 0x1a17, 0xc66: 0x1c28, 0xc67: 0x22e8, 0xc68: 0x22fc, 0xc69: 0x1996, - 0xc6a: 0x1c20, 0xc6b: 0x1bb4, 0xc6c: 0x1ba0, 0xc6d: 0x1c48, 0xc6e: 0x2716, 0xc6f: 0x27ad, - 0xc70: 0x1a59, 0xc71: 0x1a44, 0xc72: 0x1c7c, 0xc73: 0x1a2f, 0xc74: 0x1a50, 0xc75: 0x1a38, - 0xc76: 0x1c68, 0xc77: 0x1a1d, 0xc78: 0x19f6, 0xc79: 0x1981, 0xc7a: 0x1a53, 0xc7b: 0x1a3b, - 0xc7c: 0x1c6c, 0xc7d: 0x1a20, 0xc7e: 0x19f9, 0xc7f: 0x1984, - // Block 0x32, offset 0xc80 - 0xc80: 0x1c2c, 0xc81: 0x1bb8, 0xc82: 0x1d4d, 0xc83: 0x1939, 0xc84: 0x19ba, 0xc85: 0x19bd, - 0xc86: 0x22f5, 0xc87: 0x1b94, 0xc88: 0x19c3, 0xc89: 0x194b, 0xc8a: 0x19e1, 0xc8b: 0x194e, - 0xc8c: 0x19ea, 0xc8d: 0x196c, 0xc8e: 0x196f, 0xc8f: 0x1a05, 0xc90: 0x1a0b, 0xc91: 0x1a0e, - 0xc92: 0x1c30, 0xc93: 0x1a11, 0xc94: 0x1a23, 0xc95: 0x1c38, 0xc96: 0x1c44, 0xc97: 0x1990, - 0xc98: 0x1d57, 0xc99: 0x1bbc, 0xc9a: 0x1993, 0xc9b: 0x1a5c, 0xc9c: 0x19a5, 0xc9d: 0x19b4, - 0xc9e: 0x22e2, 0xc9f: 0x22dc, 0xca0: 0x1cc1, 0xca1: 0x1cd0, 0xca2: 0x1cdf, 0xca3: 0x1cee, - 0xca4: 0x1cfd, 0xca5: 0x1d0c, 0xca6: 0x1d1b, 0xca7: 0x1d2a, 0xca8: 0x1d39, 0xca9: 0x2186, - 0xcaa: 0x2198, 0xcab: 0x21aa, 0xcac: 0x21bc, 0xcad: 0x21c8, 0xcae: 0x21d4, 0xcaf: 0x21e0, - 0xcb0: 0x21ec, 0xcb1: 0x21f8, 0xcb2: 0x2204, 0xcb3: 0x2240, 0xcb4: 0x224c, 0xcb5: 0x2258, - 0xcb6: 0x2264, 0xcb7: 0x2270, 0xcb8: 0x227c, 0xcb9: 0x2282, 0xcba: 0x2288, 0xcbb: 0x228e, - 0xcbc: 0x2294, 0xcbd: 0x22a6, 0xcbe: 0x22ac, 0xcbf: 0x1c10, - // Block 0x33, offset 0xcc0 - 0xcc0: 0x1377, 0xcc1: 0x0cfb, 0xcc2: 0x13d3, 0xcc3: 0x139f, 0xcc4: 0x0e57, 0xcc5: 0x06eb, - 0xcc6: 0x08df, 0xcc7: 0x162b, 0xcc8: 0x162b, 0xcc9: 0x0a0b, 0xcca: 0x145f, 0xccb: 0x0943, - 0xccc: 0x0a07, 0xccd: 0x0bef, 0xcce: 0x0fcf, 0xccf: 0x115f, 0xcd0: 0x1297, 0xcd1: 0x12d3, - 0xcd2: 0x1307, 0xcd3: 0x141b, 0xcd4: 0x0d73, 0xcd5: 0x0dff, 0xcd6: 0x0eab, 0xcd7: 0x0f43, - 0xcd8: 0x125f, 0xcd9: 0x1447, 0xcda: 0x1573, 0xcdb: 0x070f, 0xcdc: 0x08b3, 0xcdd: 0x0d87, - 0xcde: 0x0ecf, 0xcdf: 0x1293, 0xce0: 0x15c3, 0xce1: 0x0ab3, 0xce2: 0x0e77, 0xce3: 0x1283, - 0xce4: 0x1317, 0xce5: 0x0c23, 0xce6: 0x11bb, 0xce7: 0x12df, 0xce8: 0x0b1f, 0xce9: 0x0d0f, - 0xcea: 0x0e17, 0xceb: 0x0f1b, 0xcec: 0x1427, 0xced: 0x074f, 0xcee: 0x07e7, 0xcef: 0x0853, - 0xcf0: 0x0c8b, 0xcf1: 0x0d7f, 0xcf2: 0x0ecb, 0xcf3: 0x0fef, 0xcf4: 0x1177, 0xcf5: 0x128b, - 0xcf6: 0x12a3, 0xcf7: 0x13c7, 0xcf8: 0x14ef, 0xcf9: 0x15a3, 0xcfa: 0x15bf, 0xcfb: 0x102b, - 0xcfc: 0x106b, 0xcfd: 0x1123, 0xcfe: 0x1243, 0xcff: 0x147b, - // Block 0x34, offset 0xd00 - 0xd00: 0x15cb, 0xd01: 0x134b, 0xd02: 0x09c7, 0xd03: 0x0b3b, 0xd04: 0x10db, 0xd05: 0x119b, - 0xd06: 0x0eff, 0xd07: 0x1033, 0xd08: 0x1397, 0xd09: 0x14e7, 0xd0a: 0x09c3, 0xd0b: 0x0a8f, - 0xd0c: 0x0d77, 0xd0d: 0x0e2b, 0xd0e: 0x0e5f, 0xd0f: 0x1113, 0xd10: 0x113b, 0xd11: 0x14a7, - 0xd12: 0x084f, 0xd13: 0x11a7, 0xd14: 0x07f3, 0xd15: 0x07ef, 0xd16: 0x1097, 0xd17: 0x1127, - 0xd18: 0x125b, 0xd19: 0x14af, 0xd1a: 0x1367, 0xd1b: 0x0c27, 0xd1c: 0x0d73, 0xd1d: 0x1357, - 0xd1e: 0x06f7, 0xd1f: 0x0a63, 0xd20: 0x0b93, 0xd21: 0x0f2f, 0xd22: 0x0faf, 0xd23: 0x0873, - 0xd24: 0x103b, 0xd25: 0x075f, 0xd26: 0x0b77, 0xd27: 0x06d7, 0xd28: 0x0deb, 0xd29: 0x0ca3, - 0xd2a: 0x110f, 0xd2b: 0x08c7, 0xd2c: 0x09b3, 0xd2d: 0x0ffb, 0xd2e: 0x1263, 0xd2f: 0x133b, - 0xd30: 0x0db7, 0xd31: 0x13f7, 0xd32: 0x0de3, 0xd33: 0x0c37, 0xd34: 0x121b, 0xd35: 0x0c57, - 0xd36: 0x0fab, 0xd37: 0x072b, 0xd38: 0x07a7, 0xd39: 0x07eb, 0xd3a: 0x0d53, 0xd3b: 0x10fb, - 0xd3c: 0x11f3, 0xd3d: 0x1347, 0xd3e: 0x145b, 0xd3f: 0x085b, - // Block 0x35, offset 0xd40 - 0xd40: 0x090f, 0xd41: 0x0a17, 0xd42: 0x0b2f, 0xd43: 0x0cbf, 0xd44: 0x0e7b, 0xd45: 0x103f, - 0xd46: 0x1497, 0xd47: 0x157b, 0xd48: 0x15cf, 0xd49: 0x15e7, 0xd4a: 0x0837, 0xd4b: 0x0cf3, - 0xd4c: 0x0da3, 0xd4d: 0x13eb, 0xd4e: 0x0afb, 0xd4f: 0x0bd7, 0xd50: 0x0bf3, 0xd51: 0x0c83, - 0xd52: 0x0e6b, 0xd53: 0x0eb7, 0xd54: 0x0f67, 0xd55: 0x108b, 0xd56: 0x112f, 0xd57: 0x1193, - 0xd58: 0x13db, 0xd59: 0x126b, 0xd5a: 0x1403, 0xd5b: 0x147f, 0xd5c: 0x080f, 0xd5d: 0x083b, - 0xd5e: 0x0923, 0xd5f: 0x0ea7, 0xd60: 0x12f3, 0xd61: 0x133b, 0xd62: 0x0b1b, 0xd63: 0x0b8b, - 0xd64: 0x0c4f, 0xd65: 0x0daf, 0xd66: 0x10d7, 0xd67: 0x0f23, 0xd68: 0x073b, 0xd69: 0x097f, - 0xd6a: 0x0a63, 0xd6b: 0x0ac7, 0xd6c: 0x0b97, 0xd6d: 0x0f3f, 0xd6e: 0x0f5b, 0xd6f: 0x116b, - 0xd70: 0x118b, 0xd71: 0x1463, 0xd72: 0x14e3, 0xd73: 0x14f3, 0xd74: 0x152f, 0xd75: 0x0753, - 0xd76: 0x107f, 0xd77: 0x144f, 0xd78: 0x14cb, 0xd79: 0x0baf, 0xd7a: 0x0717, 0xd7b: 0x0777, - 0xd7c: 0x0a67, 0xd7d: 0x0a87, 0xd7e: 0x0caf, 0xd7f: 0x0d73, - // Block 0x36, offset 0xd80 - 0xd80: 0x0ec3, 0xd81: 0x0fcb, 0xd82: 0x1277, 0xd83: 0x1417, 0xd84: 0x1623, 0xd85: 0x0ce3, - 0xd86: 0x14a3, 0xd87: 0x0833, 0xd88: 0x0d2f, 0xd89: 0x0d3b, 0xd8a: 0x0e0f, 0xd8b: 0x0e47, - 0xd8c: 0x0f4b, 0xd8d: 0x0fa7, 0xd8e: 0x1027, 0xd8f: 0x110b, 0xd90: 0x153b, 0xd91: 0x07af, - 0xd92: 0x0c03, 0xd93: 0x14b3, 0xd94: 0x0767, 0xd95: 0x0aab, 0xd96: 0x0e2f, 0xd97: 0x13df, - 0xd98: 0x0b67, 0xd99: 0x0bb7, 0xd9a: 0x0d43, 0xd9b: 0x0f2f, 0xd9c: 0x14bb, 0xd9d: 0x0817, - 0xd9e: 0x08ff, 0xd9f: 0x0a97, 0xda0: 0x0cd3, 0xda1: 0x0d1f, 0xda2: 0x0d5f, 0xda3: 0x0df3, - 0xda4: 0x0f47, 0xda5: 0x0fbb, 0xda6: 0x1157, 0xda7: 0x12f7, 0xda8: 0x1303, 0xda9: 0x1457, - 0xdaa: 0x14d7, 0xdab: 0x0883, 0xdac: 0x0e4b, 0xdad: 0x0903, 0xdae: 0x0ec7, 0xdaf: 0x0f6b, - 0xdb0: 0x1287, 0xdb1: 0x14bf, 0xdb2: 0x15ab, 0xdb3: 0x15d3, 0xdb4: 0x0d37, 0xdb5: 0x0e27, - 0xdb6: 0x11c3, 0xdb7: 0x10b7, 0xdb8: 0x10c3, 0xdb9: 0x10e7, 0xdba: 0x0f17, 0xdbb: 0x0e9f, - 0xdbc: 0x1363, 0xdbd: 0x0733, 0xdbe: 0x122b, 0xdbf: 0x081b, - // Block 0x37, offset 0xdc0 - 0xdc0: 0x080b, 0xdc1: 0x0b0b, 0xdc2: 0x0c2b, 0xdc3: 0x10f3, 0xdc4: 0x0a53, 0xdc5: 0x0e03, - 0xdc6: 0x0cef, 0xdc7: 0x13e7, 0xdc8: 0x12e7, 0xdc9: 0x14ab, 0xdca: 0x1323, 0xdcb: 0x0b27, - 0xdcc: 0x0787, 0xdcd: 0x095b, 0xdd0: 0x09af, - 0xdd2: 0x0cdf, 0xdd5: 0x07f7, 0xdd6: 0x0f1f, 0xdd7: 0x0fe3, - 0xdd8: 0x1047, 0xdd9: 0x1063, 0xdda: 0x1067, 0xddb: 0x107b, 0xddc: 0x14fb, 0xddd: 0x10eb, - 0xdde: 0x116f, 0xde0: 0x128f, 0xde2: 0x1353, - 0xde5: 0x1407, 0xde6: 0x1433, - 0xdea: 0x154f, 0xdeb: 0x1553, 0xdec: 0x1557, 0xded: 0x15bb, 0xdee: 0x142b, 0xdef: 0x14c7, - 0xdf0: 0x0757, 0xdf1: 0x077b, 0xdf2: 0x078f, 0xdf3: 0x084b, 0xdf4: 0x0857, 0xdf5: 0x0897, - 0xdf6: 0x094b, 0xdf7: 0x0967, 0xdf8: 0x096f, 0xdf9: 0x09ab, 0xdfa: 0x09b7, 0xdfb: 0x0a93, - 0xdfc: 0x0a9b, 0xdfd: 0x0ba3, 0xdfe: 0x0bcb, 0xdff: 0x0bd3, - // Block 0x38, offset 0xe00 - 0xe00: 0x0beb, 0xe01: 0x0c97, 0xe02: 0x0cc7, 0xe03: 0x0ce7, 0xe04: 0x0d57, 0xe05: 0x0e1b, - 0xe06: 0x0e37, 0xe07: 0x0e67, 0xe08: 0x0ebb, 0xe09: 0x0edb, 0xe0a: 0x0f4f, 0xe0b: 0x102f, - 0xe0c: 0x104b, 0xe0d: 0x1053, 0xe0e: 0x104f, 0xe0f: 0x1057, 0xe10: 0x105b, 0xe11: 0x105f, - 0xe12: 0x1073, 0xe13: 0x1077, 0xe14: 0x109b, 0xe15: 0x10af, 0xe16: 0x10cb, 0xe17: 0x112f, - 0xe18: 0x1137, 0xe19: 0x113f, 0xe1a: 0x1153, 0xe1b: 0x117b, 0xe1c: 0x11cb, 0xe1d: 0x11ff, - 0xe1e: 0x11ff, 0xe1f: 0x1267, 0xe20: 0x130f, 0xe21: 0x1327, 0xe22: 0x135b, 0xe23: 0x135f, - 0xe24: 0x13a3, 0xe25: 0x13a7, 0xe26: 0x13ff, 0xe27: 0x1407, 0xe28: 0x14db, 0xe29: 0x151f, - 0xe2a: 0x1537, 0xe2b: 0x0b9b, 0xe2c: 0x171e, 0xe2d: 0x11e3, - 0xe30: 0x06df, 0xe31: 0x07e3, 0xe32: 0x07a3, 0xe33: 0x074b, 0xe34: 0x078b, 0xe35: 0x07b7, - 0xe36: 0x0847, 0xe37: 0x0863, 0xe38: 0x094b, 0xe39: 0x0937, 0xe3a: 0x0947, 0xe3b: 0x0963, - 0xe3c: 0x09af, 0xe3d: 0x09bf, 0xe3e: 0x0a03, 0xe3f: 0x0a0f, - // Block 0x39, offset 0xe40 - 0xe40: 0x0a2b, 0xe41: 0x0a3b, 0xe42: 0x0b23, 0xe43: 0x0b2b, 0xe44: 0x0b5b, 0xe45: 0x0b7b, - 0xe46: 0x0bab, 0xe47: 0x0bc3, 0xe48: 0x0bb3, 0xe49: 0x0bd3, 0xe4a: 0x0bc7, 0xe4b: 0x0beb, - 0xe4c: 0x0c07, 0xe4d: 0x0c5f, 0xe4e: 0x0c6b, 0xe4f: 0x0c73, 0xe50: 0x0c9b, 0xe51: 0x0cdf, - 0xe52: 0x0d0f, 0xe53: 0x0d13, 0xe54: 0x0d27, 0xe55: 0x0da7, 0xe56: 0x0db7, 0xe57: 0x0e0f, - 0xe58: 0x0e5b, 0xe59: 0x0e53, 0xe5a: 0x0e67, 0xe5b: 0x0e83, 0xe5c: 0x0ebb, 0xe5d: 0x1013, - 0xe5e: 0x0edf, 0xe5f: 0x0f13, 0xe60: 0x0f1f, 0xe61: 0x0f5f, 0xe62: 0x0f7b, 0xe63: 0x0f9f, - 0xe64: 0x0fc3, 0xe65: 0x0fc7, 0xe66: 0x0fe3, 0xe67: 0x0fe7, 0xe68: 0x0ff7, 0xe69: 0x100b, - 0xe6a: 0x1007, 0xe6b: 0x1037, 0xe6c: 0x10b3, 0xe6d: 0x10cb, 0xe6e: 0x10e3, 0xe6f: 0x111b, - 0xe70: 0x112f, 0xe71: 0x114b, 0xe72: 0x117b, 0xe73: 0x122f, 0xe74: 0x1257, 0xe75: 0x12cb, - 0xe76: 0x1313, 0xe77: 0x131f, 0xe78: 0x1327, 0xe79: 0x133f, 0xe7a: 0x1353, 0xe7b: 0x1343, - 0xe7c: 0x135b, 0xe7d: 0x1357, 0xe7e: 0x134f, 0xe7f: 0x135f, - // Block 0x3a, offset 0xe80 - 0xe80: 0x136b, 0xe81: 0x13a7, 0xe82: 0x13e3, 0xe83: 0x1413, 0xe84: 0x144b, 0xe85: 0x146b, - 0xe86: 0x14b7, 0xe87: 0x14db, 0xe88: 0x14fb, 0xe89: 0x150f, 0xe8a: 0x151f, 0xe8b: 0x152b, - 0xe8c: 0x1537, 0xe8d: 0x158b, 0xe8e: 0x162b, 0xe8f: 0x16b5, 0xe90: 0x16b0, 0xe91: 0x16e2, - 0xe92: 0x0607, 0xe93: 0x062f, 0xe94: 0x0633, 0xe95: 0x1764, 0xe96: 0x1791, 0xe97: 0x1809, - 0xe98: 0x1617, 0xe99: 0x1627, - // Block 0x3b, offset 0xec0 - 0xec0: 0x19d5, 0xec1: 0x19d8, 0xec2: 0x19db, 0xec3: 0x1c08, 0xec4: 0x1c0c, 0xec5: 0x1a5f, - 0xec6: 0x1a5f, - 0xed3: 0x1d75, 0xed4: 0x1d66, 0xed5: 0x1d6b, 0xed6: 0x1d7a, 0xed7: 0x1d70, - 0xedd: 0x4390, - 0xede: 0x8115, 0xedf: 0x4402, 0xee0: 0x022d, 0xee1: 0x0215, 0xee2: 0x021e, 0xee3: 0x0221, - 0xee4: 0x0224, 0xee5: 0x0227, 0xee6: 0x022a, 0xee7: 0x0230, 0xee8: 0x0233, 0xee9: 0x0017, - 0xeea: 0x43f0, 0xeeb: 0x43f6, 0xeec: 0x44f4, 0xeed: 0x44fc, 0xeee: 0x4348, 0xeef: 0x434e, - 0xef0: 0x4354, 0xef1: 0x435a, 0xef2: 0x4366, 0xef3: 0x436c, 0xef4: 0x4372, 0xef5: 0x437e, - 0xef6: 0x4384, 0xef8: 0x438a, 0xef9: 0x4396, 0xefa: 0x439c, 0xefb: 0x43a2, - 0xefc: 0x43ae, 0xefe: 0x43b4, - // Block 0x3c, offset 0xf00 - 0xf00: 0x43ba, 0xf01: 0x43c0, 0xf03: 0x43c6, 0xf04: 0x43cc, - 0xf06: 0x43d8, 0xf07: 0x43de, 0xf08: 0x43e4, 0xf09: 0x43ea, 0xf0a: 0x43fc, 0xf0b: 0x4378, - 0xf0c: 0x4360, 0xf0d: 0x43a8, 0xf0e: 0x43d2, 0xf0f: 0x1d7f, 0xf10: 0x0299, 0xf11: 0x0299, - 0xf12: 0x02a2, 0xf13: 0x02a2, 0xf14: 0x02a2, 0xf15: 0x02a2, 0xf16: 0x02a5, 0xf17: 0x02a5, - 0xf18: 0x02a5, 0xf19: 0x02a5, 0xf1a: 0x02ab, 0xf1b: 0x02ab, 0xf1c: 0x02ab, 0xf1d: 0x02ab, - 0xf1e: 0x029f, 0xf1f: 0x029f, 0xf20: 0x029f, 0xf21: 0x029f, 0xf22: 0x02a8, 0xf23: 0x02a8, - 0xf24: 0x02a8, 0xf25: 0x02a8, 0xf26: 0x029c, 0xf27: 0x029c, 0xf28: 0x029c, 0xf29: 0x029c, - 0xf2a: 0x02cf, 0xf2b: 0x02cf, 0xf2c: 0x02cf, 0xf2d: 0x02cf, 0xf2e: 0x02d2, 0xf2f: 0x02d2, - 0xf30: 0x02d2, 0xf31: 0x02d2, 0xf32: 0x02b1, 0xf33: 0x02b1, 0xf34: 0x02b1, 0xf35: 0x02b1, - 0xf36: 0x02ae, 0xf37: 0x02ae, 0xf38: 0x02ae, 0xf39: 0x02ae, 0xf3a: 0x02b4, 0xf3b: 0x02b4, - 0xf3c: 0x02b4, 0xf3d: 0x02b4, 0xf3e: 0x02b7, 0xf3f: 0x02b7, - // Block 0x3d, offset 0xf40 - 0xf40: 0x02b7, 0xf41: 0x02b7, 0xf42: 0x02c0, 0xf43: 0x02c0, 0xf44: 0x02bd, 0xf45: 0x02bd, - 0xf46: 0x02c3, 0xf47: 0x02c3, 0xf48: 0x02ba, 0xf49: 0x02ba, 0xf4a: 0x02c9, 0xf4b: 0x02c9, - 0xf4c: 0x02c6, 0xf4d: 0x02c6, 0xf4e: 0x02d5, 0xf4f: 0x02d5, 0xf50: 0x02d5, 0xf51: 0x02d5, - 0xf52: 0x02db, 0xf53: 0x02db, 0xf54: 0x02db, 0xf55: 0x02db, 0xf56: 0x02e1, 0xf57: 0x02e1, - 0xf58: 0x02e1, 0xf59: 0x02e1, 0xf5a: 0x02de, 0xf5b: 0x02de, 0xf5c: 0x02de, 0xf5d: 0x02de, - 0xf5e: 0x02e4, 0xf5f: 0x02e4, 0xf60: 0x02e7, 0xf61: 0x02e7, 0xf62: 0x02e7, 0xf63: 0x02e7, - 0xf64: 0x446e, 0xf65: 0x446e, 0xf66: 0x02ed, 0xf67: 0x02ed, 0xf68: 0x02ed, 0xf69: 0x02ed, - 0xf6a: 0x02ea, 0xf6b: 0x02ea, 0xf6c: 0x02ea, 0xf6d: 0x02ea, 0xf6e: 0x0308, 0xf6f: 0x0308, - 0xf70: 0x4468, 0xf71: 0x4468, - // Block 0x3e, offset 0xf80 - 0xf93: 0x02d8, 0xf94: 0x02d8, 0xf95: 0x02d8, 0xf96: 0x02d8, 0xf97: 0x02f6, - 0xf98: 0x02f6, 0xf99: 0x02f3, 0xf9a: 0x02f3, 0xf9b: 0x02f9, 0xf9c: 0x02f9, 0xf9d: 0x204f, - 0xf9e: 0x02ff, 0xf9f: 0x02ff, 0xfa0: 0x02f0, 0xfa1: 0x02f0, 0xfa2: 0x02fc, 0xfa3: 0x02fc, - 0xfa4: 0x0305, 0xfa5: 0x0305, 0xfa6: 0x0305, 0xfa7: 0x0305, 0xfa8: 0x028d, 0xfa9: 0x028d, - 0xfaa: 0x25aa, 0xfab: 0x25aa, 0xfac: 0x261a, 0xfad: 0x261a, 0xfae: 0x25e9, 0xfaf: 0x25e9, - 0xfb0: 0x2605, 0xfb1: 0x2605, 0xfb2: 0x25fe, 0xfb3: 0x25fe, 0xfb4: 0x260c, 0xfb5: 0x260c, - 0xfb6: 0x2613, 0xfb7: 0x2613, 0xfb8: 0x2613, 0xfb9: 0x25f0, 0xfba: 0x25f0, 0xfbb: 0x25f0, - 0xfbc: 0x0302, 0xfbd: 0x0302, 0xfbe: 0x0302, 0xfbf: 0x0302, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x25b1, 0xfc1: 0x25b8, 0xfc2: 0x25d4, 0xfc3: 0x25f0, 0xfc4: 0x25f7, 0xfc5: 0x1d89, - 0xfc6: 0x1d8e, 0xfc7: 0x1d93, 0xfc8: 0x1da2, 0xfc9: 0x1db1, 0xfca: 0x1db6, 0xfcb: 0x1dbb, - 0xfcc: 0x1dc0, 0xfcd: 0x1dc5, 0xfce: 0x1dd4, 0xfcf: 0x1de3, 0xfd0: 0x1de8, 0xfd1: 0x1ded, - 0xfd2: 0x1dfc, 0xfd3: 0x1e0b, 0xfd4: 0x1e10, 0xfd5: 0x1e15, 0xfd6: 0x1e1a, 0xfd7: 0x1e29, - 0xfd8: 0x1e2e, 0xfd9: 0x1e3d, 0xfda: 0x1e42, 0xfdb: 0x1e47, 0xfdc: 0x1e56, 0xfdd: 0x1e5b, - 0xfde: 0x1e60, 0xfdf: 0x1e6a, 0xfe0: 0x1ea6, 0xfe1: 0x1eb5, 0xfe2: 0x1ec4, 0xfe3: 0x1ec9, - 0xfe4: 0x1ece, 0xfe5: 0x1ed8, 0xfe6: 0x1ee7, 0xfe7: 0x1eec, 0xfe8: 0x1efb, 0xfe9: 0x1f00, - 0xfea: 0x1f05, 0xfeb: 0x1f14, 0xfec: 0x1f19, 0xfed: 0x1f28, 0xfee: 0x1f2d, 0xfef: 0x1f32, - 0xff0: 0x1f37, 0xff1: 0x1f3c, 0xff2: 0x1f41, 0xff3: 0x1f46, 0xff4: 0x1f4b, 0xff5: 0x1f50, - 0xff6: 0x1f55, 0xff7: 0x1f5a, 0xff8: 0x1f5f, 0xff9: 0x1f64, 0xffa: 0x1f69, 0xffb: 0x1f6e, - 0xffc: 0x1f73, 0xffd: 0x1f78, 0xffe: 0x1f7d, 0xfff: 0x1f87, - // Block 0x40, offset 0x1000 - 0x1000: 0x1f8c, 0x1001: 0x1f91, 0x1002: 0x1f96, 0x1003: 0x1fa0, 0x1004: 0x1fa5, 0x1005: 0x1faf, - 0x1006: 0x1fb4, 0x1007: 0x1fb9, 0x1008: 0x1fbe, 0x1009: 0x1fc3, 0x100a: 0x1fc8, 0x100b: 0x1fcd, - 0x100c: 0x1fd2, 0x100d: 0x1fd7, 0x100e: 0x1fe6, 0x100f: 0x1ff5, 0x1010: 0x1ffa, 0x1011: 0x1fff, - 0x1012: 0x2004, 0x1013: 0x2009, 0x1014: 0x200e, 0x1015: 0x2018, 0x1016: 0x201d, 0x1017: 0x2022, - 0x1018: 0x2031, 0x1019: 0x2040, 0x101a: 0x2045, 0x101b: 0x4420, 0x101c: 0x4426, 0x101d: 0x445c, - 0x101e: 0x44b3, 0x101f: 0x44ba, 0x1020: 0x44c1, 0x1021: 0x44c8, 0x1022: 0x44cf, 0x1023: 0x44d6, - 0x1024: 0x25c6, 0x1025: 0x25cd, 0x1026: 0x25d4, 0x1027: 0x25db, 0x1028: 0x25f0, 0x1029: 0x25f7, - 0x102a: 0x1d98, 0x102b: 0x1d9d, 0x102c: 0x1da2, 0x102d: 0x1da7, 0x102e: 0x1db1, 0x102f: 0x1db6, - 0x1030: 0x1dca, 0x1031: 0x1dcf, 0x1032: 0x1dd4, 0x1033: 0x1dd9, 0x1034: 0x1de3, 0x1035: 0x1de8, - 0x1036: 0x1df2, 0x1037: 0x1df7, 0x1038: 0x1dfc, 0x1039: 0x1e01, 0x103a: 0x1e0b, 0x103b: 0x1e10, - 0x103c: 0x1f3c, 0x103d: 0x1f41, 0x103e: 0x1f50, 0x103f: 0x1f55, - // Block 0x41, offset 0x1040 - 0x1040: 0x1f5a, 0x1041: 0x1f6e, 0x1042: 0x1f73, 0x1043: 0x1f78, 0x1044: 0x1f7d, 0x1045: 0x1f96, - 0x1046: 0x1fa0, 0x1047: 0x1fa5, 0x1048: 0x1faa, 0x1049: 0x1fbe, 0x104a: 0x1fdc, 0x104b: 0x1fe1, - 0x104c: 0x1fe6, 0x104d: 0x1feb, 0x104e: 0x1ff5, 0x104f: 0x1ffa, 0x1050: 0x445c, 0x1051: 0x2027, - 0x1052: 0x202c, 0x1053: 0x2031, 0x1054: 0x2036, 0x1055: 0x2040, 0x1056: 0x2045, 0x1057: 0x25b1, - 0x1058: 0x25b8, 0x1059: 0x25bf, 0x105a: 0x25d4, 0x105b: 0x25e2, 0x105c: 0x1d89, 0x105d: 0x1d8e, - 0x105e: 0x1d93, 0x105f: 0x1da2, 0x1060: 0x1dac, 0x1061: 0x1dbb, 0x1062: 0x1dc0, 0x1063: 0x1dc5, - 0x1064: 0x1dd4, 0x1065: 0x1dde, 0x1066: 0x1dfc, 0x1067: 0x1e15, 0x1068: 0x1e1a, 0x1069: 0x1e29, - 0x106a: 0x1e2e, 0x106b: 0x1e3d, 0x106c: 0x1e47, 0x106d: 0x1e56, 0x106e: 0x1e5b, 0x106f: 0x1e60, - 0x1070: 0x1e6a, 0x1071: 0x1ea6, 0x1072: 0x1eab, 0x1073: 0x1eb5, 0x1074: 0x1ec4, 0x1075: 0x1ec9, - 0x1076: 0x1ece, 0x1077: 0x1ed8, 0x1078: 0x1ee7, 0x1079: 0x1efb, 0x107a: 0x1f00, 0x107b: 0x1f05, - 0x107c: 0x1f14, 0x107d: 0x1f19, 0x107e: 0x1f28, 0x107f: 0x1f2d, - // Block 0x42, offset 0x1080 - 0x1080: 0x1f32, 0x1081: 0x1f37, 0x1082: 0x1f46, 0x1083: 0x1f4b, 0x1084: 0x1f5f, 0x1085: 0x1f64, - 0x1086: 0x1f69, 0x1087: 0x1f6e, 0x1088: 0x1f73, 0x1089: 0x1f87, 0x108a: 0x1f8c, 0x108b: 0x1f91, - 0x108c: 0x1f96, 0x108d: 0x1f9b, 0x108e: 0x1faf, 0x108f: 0x1fb4, 0x1090: 0x1fb9, 0x1091: 0x1fbe, - 0x1092: 0x1fcd, 0x1093: 0x1fd2, 0x1094: 0x1fd7, 0x1095: 0x1fe6, 0x1096: 0x1ff0, 0x1097: 0x1fff, - 0x1098: 0x2004, 0x1099: 0x4450, 0x109a: 0x2018, 0x109b: 0x201d, 0x109c: 0x2022, 0x109d: 0x2031, - 0x109e: 0x203b, 0x109f: 0x25d4, 0x10a0: 0x25e2, 0x10a1: 0x1da2, 0x10a2: 0x1dac, 0x10a3: 0x1dd4, - 0x10a4: 0x1dde, 0x10a5: 0x1dfc, 0x10a6: 0x1e06, 0x10a7: 0x1e6a, 0x10a8: 0x1e6f, 0x10a9: 0x1e92, - 0x10aa: 0x1e97, 0x10ab: 0x1f6e, 0x10ac: 0x1f73, 0x10ad: 0x1f96, 0x10ae: 0x1fe6, 0x10af: 0x1ff0, - 0x10b0: 0x2031, 0x10b1: 0x203b, 0x10b2: 0x4504, 0x10b3: 0x450c, 0x10b4: 0x4514, 0x10b5: 0x1ef1, - 0x10b6: 0x1ef6, 0x10b7: 0x1f0a, 0x10b8: 0x1f0f, 0x10b9: 0x1f1e, 0x10ba: 0x1f23, 0x10bb: 0x1e74, - 0x10bc: 0x1e79, 0x10bd: 0x1e9c, 0x10be: 0x1ea1, 0x10bf: 0x1e33, - // Block 0x43, offset 0x10c0 - 0x10c0: 0x1e38, 0x10c1: 0x1e1f, 0x10c2: 0x1e24, 0x10c3: 0x1e4c, 0x10c4: 0x1e51, 0x10c5: 0x1eba, - 0x10c6: 0x1ebf, 0x10c7: 0x1edd, 0x10c8: 0x1ee2, 0x10c9: 0x1e7e, 0x10ca: 0x1e83, 0x10cb: 0x1e88, - 0x10cc: 0x1e92, 0x10cd: 0x1e8d, 0x10ce: 0x1e65, 0x10cf: 0x1eb0, 0x10d0: 0x1ed3, 0x10d1: 0x1ef1, - 0x10d2: 0x1ef6, 0x10d3: 0x1f0a, 0x10d4: 0x1f0f, 0x10d5: 0x1f1e, 0x10d6: 0x1f23, 0x10d7: 0x1e74, - 0x10d8: 0x1e79, 0x10d9: 0x1e9c, 0x10da: 0x1ea1, 0x10db: 0x1e33, 0x10dc: 0x1e38, 0x10dd: 0x1e1f, - 0x10de: 0x1e24, 0x10df: 0x1e4c, 0x10e0: 0x1e51, 0x10e1: 0x1eba, 0x10e2: 0x1ebf, 0x10e3: 0x1edd, - 0x10e4: 0x1ee2, 0x10e5: 0x1e7e, 0x10e6: 0x1e83, 0x10e7: 0x1e88, 0x10e8: 0x1e92, 0x10e9: 0x1e8d, - 0x10ea: 0x1e65, 0x10eb: 0x1eb0, 0x10ec: 0x1ed3, 0x10ed: 0x1e7e, 0x10ee: 0x1e83, 0x10ef: 0x1e88, - 0x10f0: 0x1e92, 0x10f1: 0x1e6f, 0x10f2: 0x1e97, 0x10f3: 0x1eec, 0x10f4: 0x1e56, 0x10f5: 0x1e5b, - 0x10f6: 0x1e60, 0x10f7: 0x1e7e, 0x10f8: 0x1e83, 0x10f9: 0x1e88, 0x10fa: 0x1eec, 0x10fb: 0x1efb, - 0x10fc: 0x4408, 0x10fd: 0x4408, - // Block 0x44, offset 0x1100 - 0x1110: 0x2311, 0x1111: 0x2326, - 0x1112: 0x2326, 0x1113: 0x232d, 0x1114: 0x2334, 0x1115: 0x2349, 0x1116: 0x2350, 0x1117: 0x2357, - 0x1118: 0x237a, 0x1119: 0x237a, 0x111a: 0x239d, 0x111b: 0x2396, 0x111c: 0x23b2, 0x111d: 0x23a4, - 0x111e: 0x23ab, 0x111f: 0x23ce, 0x1120: 0x23ce, 0x1121: 0x23c7, 0x1122: 0x23d5, 0x1123: 0x23d5, - 0x1124: 0x23ff, 0x1125: 0x23ff, 0x1126: 0x241b, 0x1127: 0x23e3, 0x1128: 0x23e3, 0x1129: 0x23dc, - 0x112a: 0x23f1, 0x112b: 0x23f1, 0x112c: 0x23f8, 0x112d: 0x23f8, 0x112e: 0x2422, 0x112f: 0x2430, - 0x1130: 0x2430, 0x1131: 0x2437, 0x1132: 0x2437, 0x1133: 0x243e, 0x1134: 0x2445, 0x1135: 0x244c, - 0x1136: 0x2453, 0x1137: 0x2453, 0x1138: 0x245a, 0x1139: 0x2468, 0x113a: 0x2476, 0x113b: 0x246f, - 0x113c: 0x247d, 0x113d: 0x247d, 0x113e: 0x2492, 0x113f: 0x2499, - // Block 0x45, offset 0x1140 - 0x1140: 0x24ca, 0x1141: 0x24d8, 0x1142: 0x24d1, 0x1143: 0x24b5, 0x1144: 0x24b5, 0x1145: 0x24df, - 0x1146: 0x24df, 0x1147: 0x24e6, 0x1148: 0x24e6, 0x1149: 0x2510, 0x114a: 0x2517, 0x114b: 0x251e, - 0x114c: 0x24f4, 0x114d: 0x2502, 0x114e: 0x2525, 0x114f: 0x252c, - 0x1152: 0x24fb, 0x1153: 0x2580, 0x1154: 0x2587, 0x1155: 0x255d, 0x1156: 0x2564, 0x1157: 0x2548, - 0x1158: 0x2548, 0x1159: 0x254f, 0x115a: 0x2579, 0x115b: 0x2572, 0x115c: 0x259c, 0x115d: 0x259c, - 0x115e: 0x230a, 0x115f: 0x231f, 0x1160: 0x2318, 0x1161: 0x2342, 0x1162: 0x233b, 0x1163: 0x2365, - 0x1164: 0x235e, 0x1165: 0x2388, 0x1166: 0x236c, 0x1167: 0x2381, 0x1168: 0x23b9, 0x1169: 0x2406, - 0x116a: 0x23ea, 0x116b: 0x2429, 0x116c: 0x24c3, 0x116d: 0x24ed, 0x116e: 0x2595, 0x116f: 0x258e, - 0x1170: 0x25a3, 0x1171: 0x253a, 0x1172: 0x24a0, 0x1173: 0x256b, 0x1174: 0x2492, 0x1175: 0x24ca, - 0x1176: 0x2461, 0x1177: 0x24ae, 0x1178: 0x2541, 0x1179: 0x2533, 0x117a: 0x24bc, 0x117b: 0x24a7, - 0x117c: 0x24bc, 0x117d: 0x2541, 0x117e: 0x2373, 0x117f: 0x238f, - // Block 0x46, offset 0x1180 - 0x1180: 0x2509, 0x1181: 0x2484, 0x1182: 0x2303, 0x1183: 0x24a7, 0x1184: 0x244c, 0x1185: 0x241b, - 0x1186: 0x23c0, 0x1187: 0x2556, - 0x11b0: 0x2414, 0x11b1: 0x248b, 0x11b2: 0x27bf, 0x11b3: 0x27b6, 0x11b4: 0x27ec, 0x11b5: 0x27da, - 0x11b6: 0x27c8, 0x11b7: 0x27e3, 0x11b8: 0x27f5, 0x11b9: 0x240d, 0x11ba: 0x2c7c, 0x11bb: 0x2afc, - 0x11bc: 0x27d1, - // Block 0x47, offset 0x11c0 - 0x11d0: 0x0019, 0x11d1: 0x0483, - 0x11d2: 0x0487, 0x11d3: 0x0035, 0x11d4: 0x0037, 0x11d5: 0x0003, 0x11d6: 0x003f, 0x11d7: 0x04bf, - 0x11d8: 0x04c3, 0x11d9: 0x1b5c, - 0x11e0: 0x8132, 0x11e1: 0x8132, 0x11e2: 0x8132, 0x11e3: 0x8132, - 0x11e4: 0x8132, 0x11e5: 0x8132, 0x11e6: 0x8132, 0x11e7: 0x812d, 0x11e8: 0x812d, 0x11e9: 0x812d, - 0x11ea: 0x812d, 0x11eb: 0x812d, 0x11ec: 0x812d, 0x11ed: 0x812d, 0x11ee: 0x8132, 0x11ef: 0x8132, - 0x11f0: 0x1873, 0x11f1: 0x0443, 0x11f2: 0x043f, 0x11f3: 0x007f, 0x11f4: 0x007f, 0x11f5: 0x0011, - 0x11f6: 0x0013, 0x11f7: 0x00b7, 0x11f8: 0x00bb, 0x11f9: 0x04b7, 0x11fa: 0x04bb, 0x11fb: 0x04ab, - 0x11fc: 0x04af, 0x11fd: 0x0493, 0x11fe: 0x0497, 0x11ff: 0x048b, - // Block 0x48, offset 0x1200 - 0x1200: 0x048f, 0x1201: 0x049b, 0x1202: 0x049f, 0x1203: 0x04a3, 0x1204: 0x04a7, - 0x1207: 0x0077, 0x1208: 0x007b, 0x1209: 0x4269, 0x120a: 0x4269, 0x120b: 0x4269, - 0x120c: 0x4269, 0x120d: 0x007f, 0x120e: 0x007f, 0x120f: 0x007f, 0x1210: 0x0019, 0x1211: 0x0483, - 0x1212: 0x001d, 0x1214: 0x0037, 0x1215: 0x0035, 0x1216: 0x003f, 0x1217: 0x0003, - 0x1218: 0x0443, 0x1219: 0x0011, 0x121a: 0x0013, 0x121b: 0x00b7, 0x121c: 0x00bb, 0x121d: 0x04b7, - 0x121e: 0x04bb, 0x121f: 0x0007, 0x1220: 0x000d, 0x1221: 0x0015, 0x1222: 0x0017, 0x1223: 0x001b, - 0x1224: 0x0039, 0x1225: 0x003d, 0x1226: 0x003b, 0x1228: 0x0079, 0x1229: 0x0009, - 0x122a: 0x000b, 0x122b: 0x0041, - 0x1230: 0x42aa, 0x1231: 0x442c, 0x1232: 0x42af, 0x1234: 0x42b4, - 0x1236: 0x42b9, 0x1237: 0x4432, 0x1238: 0x42be, 0x1239: 0x4438, 0x123a: 0x42c3, 0x123b: 0x443e, - 0x123c: 0x42c8, 0x123d: 0x4444, 0x123e: 0x42cd, 0x123f: 0x444a, - // Block 0x49, offset 0x1240 - 0x1240: 0x0236, 0x1241: 0x440e, 0x1242: 0x440e, 0x1243: 0x4414, 0x1244: 0x4414, 0x1245: 0x4456, - 0x1246: 0x4456, 0x1247: 0x441a, 0x1248: 0x441a, 0x1249: 0x4462, 0x124a: 0x4462, 0x124b: 0x4462, - 0x124c: 0x4462, 0x124d: 0x0239, 0x124e: 0x0239, 0x124f: 0x023c, 0x1250: 0x023c, 0x1251: 0x023c, - 0x1252: 0x023c, 0x1253: 0x023f, 0x1254: 0x023f, 0x1255: 0x0242, 0x1256: 0x0242, 0x1257: 0x0242, - 0x1258: 0x0242, 0x1259: 0x0245, 0x125a: 0x0245, 0x125b: 0x0245, 0x125c: 0x0245, 0x125d: 0x0248, - 0x125e: 0x0248, 0x125f: 0x0248, 0x1260: 0x0248, 0x1261: 0x024b, 0x1262: 0x024b, 0x1263: 0x024b, - 0x1264: 0x024b, 0x1265: 0x024e, 0x1266: 0x024e, 0x1267: 0x024e, 0x1268: 0x024e, 0x1269: 0x0251, - 0x126a: 0x0251, 0x126b: 0x0254, 0x126c: 0x0254, 0x126d: 0x0257, 0x126e: 0x0257, 0x126f: 0x025a, - 0x1270: 0x025a, 0x1271: 0x025d, 0x1272: 0x025d, 0x1273: 0x025d, 0x1274: 0x025d, 0x1275: 0x0260, - 0x1276: 0x0260, 0x1277: 0x0260, 0x1278: 0x0260, 0x1279: 0x0263, 0x127a: 0x0263, 0x127b: 0x0263, - 0x127c: 0x0263, 0x127d: 0x0266, 0x127e: 0x0266, 0x127f: 0x0266, - // Block 0x4a, offset 0x1280 - 0x1280: 0x0266, 0x1281: 0x0269, 0x1282: 0x0269, 0x1283: 0x0269, 0x1284: 0x0269, 0x1285: 0x026c, - 0x1286: 0x026c, 0x1287: 0x026c, 0x1288: 0x026c, 0x1289: 0x026f, 0x128a: 0x026f, 0x128b: 0x026f, - 0x128c: 0x026f, 0x128d: 0x0272, 0x128e: 0x0272, 0x128f: 0x0272, 0x1290: 0x0272, 0x1291: 0x0275, - 0x1292: 0x0275, 0x1293: 0x0275, 0x1294: 0x0275, 0x1295: 0x0278, 0x1296: 0x0278, 0x1297: 0x0278, - 0x1298: 0x0278, 0x1299: 0x027b, 0x129a: 0x027b, 0x129b: 0x027b, 0x129c: 0x027b, 0x129d: 0x027e, - 0x129e: 0x027e, 0x129f: 0x027e, 0x12a0: 0x027e, 0x12a1: 0x0281, 0x12a2: 0x0281, 0x12a3: 0x0281, - 0x12a4: 0x0281, 0x12a5: 0x0284, 0x12a6: 0x0284, 0x12a7: 0x0284, 0x12a8: 0x0284, 0x12a9: 0x0287, - 0x12aa: 0x0287, 0x12ab: 0x0287, 0x12ac: 0x0287, 0x12ad: 0x028a, 0x12ae: 0x028a, 0x12af: 0x028d, - 0x12b0: 0x028d, 0x12b1: 0x0290, 0x12b2: 0x0290, 0x12b3: 0x0290, 0x12b4: 0x0290, 0x12b5: 0x2e00, - 0x12b6: 0x2e00, 0x12b7: 0x2e08, 0x12b8: 0x2e08, 0x12b9: 0x2e10, 0x12ba: 0x2e10, 0x12bb: 0x1f82, - 0x12bc: 0x1f82, - // Block 0x4b, offset 0x12c0 - 0x12c0: 0x0081, 0x12c1: 0x0083, 0x12c2: 0x0085, 0x12c3: 0x0087, 0x12c4: 0x0089, 0x12c5: 0x008b, - 0x12c6: 0x008d, 0x12c7: 0x008f, 0x12c8: 0x0091, 0x12c9: 0x0093, 0x12ca: 0x0095, 0x12cb: 0x0097, - 0x12cc: 0x0099, 0x12cd: 0x009b, 0x12ce: 0x009d, 0x12cf: 0x009f, 0x12d0: 0x00a1, 0x12d1: 0x00a3, - 0x12d2: 0x00a5, 0x12d3: 0x00a7, 0x12d4: 0x00a9, 0x12d5: 0x00ab, 0x12d6: 0x00ad, 0x12d7: 0x00af, - 0x12d8: 0x00b1, 0x12d9: 0x00b3, 0x12da: 0x00b5, 0x12db: 0x00b7, 0x12dc: 0x00b9, 0x12dd: 0x00bb, - 0x12de: 0x00bd, 0x12df: 0x0477, 0x12e0: 0x047b, 0x12e1: 0x0487, 0x12e2: 0x049b, 0x12e3: 0x049f, - 0x12e4: 0x0483, 0x12e5: 0x05ab, 0x12e6: 0x05a3, 0x12e7: 0x04c7, 0x12e8: 0x04cf, 0x12e9: 0x04d7, - 0x12ea: 0x04df, 0x12eb: 0x04e7, 0x12ec: 0x056b, 0x12ed: 0x0573, 0x12ee: 0x057b, 0x12ef: 0x051f, - 0x12f0: 0x05af, 0x12f1: 0x04cb, 0x12f2: 0x04d3, 0x12f3: 0x04db, 0x12f4: 0x04e3, 0x12f5: 0x04eb, - 0x12f6: 0x04ef, 0x12f7: 0x04f3, 0x12f8: 0x04f7, 0x12f9: 0x04fb, 0x12fa: 0x04ff, 0x12fb: 0x0503, - 0x12fc: 0x0507, 0x12fd: 0x050b, 0x12fe: 0x050f, 0x12ff: 0x0513, - // Block 0x4c, offset 0x1300 - 0x1300: 0x0517, 0x1301: 0x051b, 0x1302: 0x0523, 0x1303: 0x0527, 0x1304: 0x052b, 0x1305: 0x052f, - 0x1306: 0x0533, 0x1307: 0x0537, 0x1308: 0x053b, 0x1309: 0x053f, 0x130a: 0x0543, 0x130b: 0x0547, - 0x130c: 0x054b, 0x130d: 0x054f, 0x130e: 0x0553, 0x130f: 0x0557, 0x1310: 0x055b, 0x1311: 0x055f, - 0x1312: 0x0563, 0x1313: 0x0567, 0x1314: 0x056f, 0x1315: 0x0577, 0x1316: 0x057f, 0x1317: 0x0583, - 0x1318: 0x0587, 0x1319: 0x058b, 0x131a: 0x058f, 0x131b: 0x0593, 0x131c: 0x0597, 0x131d: 0x05a7, - 0x131e: 0x4a78, 0x131f: 0x4a7e, 0x1320: 0x03c3, 0x1321: 0x0313, 0x1322: 0x0317, 0x1323: 0x4a3b, - 0x1324: 0x031b, 0x1325: 0x4a41, 0x1326: 0x4a47, 0x1327: 0x031f, 0x1328: 0x0323, 0x1329: 0x0327, - 0x132a: 0x4a4d, 0x132b: 0x4a53, 0x132c: 0x4a59, 0x132d: 0x4a5f, 0x132e: 0x4a65, 0x132f: 0x4a6b, - 0x1330: 0x0367, 0x1331: 0x032b, 0x1332: 0x032f, 0x1333: 0x0333, 0x1334: 0x037b, 0x1335: 0x0337, - 0x1336: 0x033b, 0x1337: 0x033f, 0x1338: 0x0343, 0x1339: 0x0347, 0x133a: 0x034b, 0x133b: 0x034f, - 0x133c: 0x0353, 0x133d: 0x0357, 0x133e: 0x035b, - // Block 0x4d, offset 0x1340 - 0x1342: 0x49bd, 0x1343: 0x49c3, 0x1344: 0x49c9, 0x1345: 0x49cf, - 0x1346: 0x49d5, 0x1347: 0x49db, 0x134a: 0x49e1, 0x134b: 0x49e7, - 0x134c: 0x49ed, 0x134d: 0x49f3, 0x134e: 0x49f9, 0x134f: 0x49ff, - 0x1352: 0x4a05, 0x1353: 0x4a0b, 0x1354: 0x4a11, 0x1355: 0x4a17, 0x1356: 0x4a1d, 0x1357: 0x4a23, - 0x135a: 0x4a29, 0x135b: 0x4a2f, 0x135c: 0x4a35, - 0x1360: 0x00bf, 0x1361: 0x00c2, 0x1362: 0x00cb, 0x1363: 0x4264, - 0x1364: 0x00c8, 0x1365: 0x00c5, 0x1366: 0x0447, 0x1368: 0x046b, 0x1369: 0x044b, - 0x136a: 0x044f, 0x136b: 0x0453, 0x136c: 0x0457, 0x136d: 0x046f, 0x136e: 0x0473, - // Block 0x4e, offset 0x1380 - 0x1380: 0x0063, 0x1381: 0x0065, 0x1382: 0x0067, 0x1383: 0x0069, 0x1384: 0x006b, 0x1385: 0x006d, - 0x1386: 0x006f, 0x1387: 0x0071, 0x1388: 0x0073, 0x1389: 0x0075, 0x138a: 0x0083, 0x138b: 0x0085, - 0x138c: 0x0087, 0x138d: 0x0089, 0x138e: 0x008b, 0x138f: 0x008d, 0x1390: 0x008f, 0x1391: 0x0091, - 0x1392: 0x0093, 0x1393: 0x0095, 0x1394: 0x0097, 0x1395: 0x0099, 0x1396: 0x009b, 0x1397: 0x009d, - 0x1398: 0x009f, 0x1399: 0x00a1, 0x139a: 0x00a3, 0x139b: 0x00a5, 0x139c: 0x00a7, 0x139d: 0x00a9, - 0x139e: 0x00ab, 0x139f: 0x00ad, 0x13a0: 0x00af, 0x13a1: 0x00b1, 0x13a2: 0x00b3, 0x13a3: 0x00b5, - 0x13a4: 0x00dd, 0x13a5: 0x00f2, 0x13a8: 0x0173, 0x13a9: 0x0176, - 0x13aa: 0x0179, 0x13ab: 0x017c, 0x13ac: 0x017f, 0x13ad: 0x0182, 0x13ae: 0x0185, 0x13af: 0x0188, - 0x13b0: 0x018b, 0x13b1: 0x018e, 0x13b2: 0x0191, 0x13b3: 0x0194, 0x13b4: 0x0197, 0x13b5: 0x019a, - 0x13b6: 0x019d, 0x13b7: 0x01a0, 0x13b8: 0x01a3, 0x13b9: 0x0188, 0x13ba: 0x01a6, 0x13bb: 0x01a9, - 0x13bc: 0x01ac, 0x13bd: 0x01af, 0x13be: 0x01b2, 0x13bf: 0x01b5, - // Block 0x4f, offset 0x13c0 - 0x13c0: 0x01fd, 0x13c1: 0x0200, 0x13c2: 0x0203, 0x13c3: 0x045b, 0x13c4: 0x01c7, 0x13c5: 0x01d0, - 0x13c6: 0x01d6, 0x13c7: 0x01fa, 0x13c8: 0x01eb, 0x13c9: 0x01e8, 0x13ca: 0x0206, 0x13cb: 0x0209, - 0x13ce: 0x0021, 0x13cf: 0x0023, 0x13d0: 0x0025, 0x13d1: 0x0027, - 0x13d2: 0x0029, 0x13d3: 0x002b, 0x13d4: 0x002d, 0x13d5: 0x002f, 0x13d6: 0x0031, 0x13d7: 0x0033, - 0x13d8: 0x0021, 0x13d9: 0x0023, 0x13da: 0x0025, 0x13db: 0x0027, 0x13dc: 0x0029, 0x13dd: 0x002b, - 0x13de: 0x002d, 0x13df: 0x002f, 0x13e0: 0x0031, 0x13e1: 0x0033, 0x13e2: 0x0021, 0x13e3: 0x0023, - 0x13e4: 0x0025, 0x13e5: 0x0027, 0x13e6: 0x0029, 0x13e7: 0x002b, 0x13e8: 0x002d, 0x13e9: 0x002f, - 0x13ea: 0x0031, 0x13eb: 0x0033, 0x13ec: 0x0021, 0x13ed: 0x0023, 0x13ee: 0x0025, 0x13ef: 0x0027, - 0x13f0: 0x0029, 0x13f1: 0x002b, 0x13f2: 0x002d, 0x13f3: 0x002f, 0x13f4: 0x0031, 0x13f5: 0x0033, - 0x13f6: 0x0021, 0x13f7: 0x0023, 0x13f8: 0x0025, 0x13f9: 0x0027, 0x13fa: 0x0029, 0x13fb: 0x002b, - 0x13fc: 0x002d, 0x13fd: 0x002f, 0x13fe: 0x0031, 0x13ff: 0x0033, - // Block 0x50, offset 0x1400 - 0x1400: 0x0239, 0x1401: 0x023c, 0x1402: 0x0248, 0x1403: 0x0251, 0x1405: 0x028a, - 0x1406: 0x025a, 0x1407: 0x024b, 0x1408: 0x0269, 0x1409: 0x0290, 0x140a: 0x027b, 0x140b: 0x027e, - 0x140c: 0x0281, 0x140d: 0x0284, 0x140e: 0x025d, 0x140f: 0x026f, 0x1410: 0x0275, 0x1411: 0x0263, - 0x1412: 0x0278, 0x1413: 0x0257, 0x1414: 0x0260, 0x1415: 0x0242, 0x1416: 0x0245, 0x1417: 0x024e, - 0x1418: 0x0254, 0x1419: 0x0266, 0x141a: 0x026c, 0x141b: 0x0272, 0x141c: 0x0293, 0x141d: 0x02e4, - 0x141e: 0x02cc, 0x141f: 0x0296, 0x1421: 0x023c, 0x1422: 0x0248, - 0x1424: 0x0287, 0x1427: 0x024b, 0x1429: 0x0290, - 0x142a: 0x027b, 0x142b: 0x027e, 0x142c: 0x0281, 0x142d: 0x0284, 0x142e: 0x025d, 0x142f: 0x026f, - 0x1430: 0x0275, 0x1431: 0x0263, 0x1432: 0x0278, 0x1434: 0x0260, 0x1435: 0x0242, - 0x1436: 0x0245, 0x1437: 0x024e, 0x1439: 0x0266, 0x143b: 0x0272, - // Block 0x51, offset 0x1440 - 0x1442: 0x0248, - 0x1447: 0x024b, 0x1449: 0x0290, 0x144b: 0x027e, - 0x144d: 0x0284, 0x144e: 0x025d, 0x144f: 0x026f, 0x1451: 0x0263, - 0x1452: 0x0278, 0x1454: 0x0260, 0x1457: 0x024e, - 0x1459: 0x0266, 0x145b: 0x0272, 0x145d: 0x02e4, - 0x145f: 0x0296, 0x1461: 0x023c, 0x1462: 0x0248, - 0x1464: 0x0287, 0x1467: 0x024b, 0x1468: 0x0269, 0x1469: 0x0290, - 0x146a: 0x027b, 0x146c: 0x0281, 0x146d: 0x0284, 0x146e: 0x025d, 0x146f: 0x026f, - 0x1470: 0x0275, 0x1471: 0x0263, 0x1472: 0x0278, 0x1474: 0x0260, 0x1475: 0x0242, - 0x1476: 0x0245, 0x1477: 0x024e, 0x1479: 0x0266, 0x147a: 0x026c, 0x147b: 0x0272, - 0x147c: 0x0293, 0x147e: 0x02cc, - // Block 0x52, offset 0x1480 - 0x1480: 0x0239, 0x1481: 0x023c, 0x1482: 0x0248, 0x1483: 0x0251, 0x1484: 0x0287, 0x1485: 0x028a, - 0x1486: 0x025a, 0x1487: 0x024b, 0x1488: 0x0269, 0x1489: 0x0290, 0x148b: 0x027e, - 0x148c: 0x0281, 0x148d: 0x0284, 0x148e: 0x025d, 0x148f: 0x026f, 0x1490: 0x0275, 0x1491: 0x0263, - 0x1492: 0x0278, 0x1493: 0x0257, 0x1494: 0x0260, 0x1495: 0x0242, 0x1496: 0x0245, 0x1497: 0x024e, - 0x1498: 0x0254, 0x1499: 0x0266, 0x149a: 0x026c, 0x149b: 0x0272, - 0x14a1: 0x023c, 0x14a2: 0x0248, 0x14a3: 0x0251, - 0x14a5: 0x028a, 0x14a6: 0x025a, 0x14a7: 0x024b, 0x14a8: 0x0269, 0x14a9: 0x0290, - 0x14ab: 0x027e, 0x14ac: 0x0281, 0x14ad: 0x0284, 0x14ae: 0x025d, 0x14af: 0x026f, - 0x14b0: 0x0275, 0x14b1: 0x0263, 0x14b2: 0x0278, 0x14b3: 0x0257, 0x14b4: 0x0260, 0x14b5: 0x0242, - 0x14b6: 0x0245, 0x14b7: 0x024e, 0x14b8: 0x0254, 0x14b9: 0x0266, 0x14ba: 0x026c, 0x14bb: 0x0272, - // Block 0x53, offset 0x14c0 - 0x14c0: 0x1879, 0x14c1: 0x1876, 0x14c2: 0x187c, 0x14c3: 0x18a0, 0x14c4: 0x18c4, 0x14c5: 0x18e8, - 0x14c6: 0x190c, 0x14c7: 0x1915, 0x14c8: 0x191b, 0x14c9: 0x1921, 0x14ca: 0x1927, - 0x14d0: 0x1a8c, 0x14d1: 0x1a90, - 0x14d2: 0x1a94, 0x14d3: 0x1a98, 0x14d4: 0x1a9c, 0x14d5: 0x1aa0, 0x14d6: 0x1aa4, 0x14d7: 0x1aa8, - 0x14d8: 0x1aac, 0x14d9: 0x1ab0, 0x14da: 0x1ab4, 0x14db: 0x1ab8, 0x14dc: 0x1abc, 0x14dd: 0x1ac0, - 0x14de: 0x1ac4, 0x14df: 0x1ac8, 0x14e0: 0x1acc, 0x14e1: 0x1ad0, 0x14e2: 0x1ad4, 0x14e3: 0x1ad8, - 0x14e4: 0x1adc, 0x14e5: 0x1ae0, 0x14e6: 0x1ae4, 0x14e7: 0x1ae8, 0x14e8: 0x1aec, 0x14e9: 0x1af0, - 0x14ea: 0x271e, 0x14eb: 0x0047, 0x14ec: 0x0065, 0x14ed: 0x193c, 0x14ee: 0x19b1, - 0x14f0: 0x0043, 0x14f1: 0x0045, 0x14f2: 0x0047, 0x14f3: 0x0049, 0x14f4: 0x004b, 0x14f5: 0x004d, - 0x14f6: 0x004f, 0x14f7: 0x0051, 0x14f8: 0x0053, 0x14f9: 0x0055, 0x14fa: 0x0057, 0x14fb: 0x0059, - 0x14fc: 0x005b, 0x14fd: 0x005d, 0x14fe: 0x005f, 0x14ff: 0x0061, - // Block 0x54, offset 0x1500 - 0x1500: 0x26ad, 0x1501: 0x26c2, 0x1502: 0x0503, - 0x1510: 0x0c0f, 0x1511: 0x0a47, - 0x1512: 0x08d3, 0x1513: 0x45c4, 0x1514: 0x071b, 0x1515: 0x09ef, 0x1516: 0x132f, 0x1517: 0x09ff, - 0x1518: 0x0727, 0x1519: 0x0cd7, 0x151a: 0x0eaf, 0x151b: 0x0caf, 0x151c: 0x0827, 0x151d: 0x0b6b, - 0x151e: 0x07bf, 0x151f: 0x0cb7, 0x1520: 0x0813, 0x1521: 0x1117, 0x1522: 0x0f83, 0x1523: 0x138b, - 0x1524: 0x09d3, 0x1525: 0x090b, 0x1526: 0x0e63, 0x1527: 0x0c1b, 0x1528: 0x0c47, 0x1529: 0x06bf, - 0x152a: 0x06cb, 0x152b: 0x140b, 0x152c: 0x0adb, 0x152d: 0x06e7, 0x152e: 0x08ef, 0x152f: 0x0c3b, - 0x1530: 0x13b3, 0x1531: 0x0c13, 0x1532: 0x106f, 0x1533: 0x10ab, 0x1534: 0x08f7, 0x1535: 0x0e43, - 0x1536: 0x0d0b, 0x1537: 0x0d07, 0x1538: 0x0f97, 0x1539: 0x082b, 0x153a: 0x0957, 0x153b: 0x1443, - // Block 0x55, offset 0x1540 - 0x1540: 0x06fb, 0x1541: 0x06f3, 0x1542: 0x0703, 0x1543: 0x1647, 0x1544: 0x0747, 0x1545: 0x0757, - 0x1546: 0x075b, 0x1547: 0x0763, 0x1548: 0x076b, 0x1549: 0x076f, 0x154a: 0x077b, 0x154b: 0x0773, - 0x154c: 0x05b3, 0x154d: 0x165b, 0x154e: 0x078f, 0x154f: 0x0793, 0x1550: 0x0797, 0x1551: 0x07b3, - 0x1552: 0x164c, 0x1553: 0x05b7, 0x1554: 0x079f, 0x1555: 0x07bf, 0x1556: 0x1656, 0x1557: 0x07cf, - 0x1558: 0x07d7, 0x1559: 0x0737, 0x155a: 0x07df, 0x155b: 0x07e3, 0x155c: 0x1831, 0x155d: 0x07ff, - 0x155e: 0x0807, 0x155f: 0x05bf, 0x1560: 0x081f, 0x1561: 0x0823, 0x1562: 0x082b, 0x1563: 0x082f, - 0x1564: 0x05c3, 0x1565: 0x0847, 0x1566: 0x084b, 0x1567: 0x0857, 0x1568: 0x0863, 0x1569: 0x0867, - 0x156a: 0x086b, 0x156b: 0x0873, 0x156c: 0x0893, 0x156d: 0x0897, 0x156e: 0x089f, 0x156f: 0x08af, - 0x1570: 0x08b7, 0x1571: 0x08bb, 0x1572: 0x08bb, 0x1573: 0x08bb, 0x1574: 0x166a, 0x1575: 0x0e93, - 0x1576: 0x08cf, 0x1577: 0x08d7, 0x1578: 0x166f, 0x1579: 0x08e3, 0x157a: 0x08eb, 0x157b: 0x08f3, - 0x157c: 0x091b, 0x157d: 0x0907, 0x157e: 0x0913, 0x157f: 0x0917, - // Block 0x56, offset 0x1580 - 0x1580: 0x091f, 0x1581: 0x0927, 0x1582: 0x092b, 0x1583: 0x0933, 0x1584: 0x093b, 0x1585: 0x093f, - 0x1586: 0x093f, 0x1587: 0x0947, 0x1588: 0x094f, 0x1589: 0x0953, 0x158a: 0x095f, 0x158b: 0x0983, - 0x158c: 0x0967, 0x158d: 0x0987, 0x158e: 0x096b, 0x158f: 0x0973, 0x1590: 0x080b, 0x1591: 0x09cf, - 0x1592: 0x0997, 0x1593: 0x099b, 0x1594: 0x099f, 0x1595: 0x0993, 0x1596: 0x09a7, 0x1597: 0x09a3, - 0x1598: 0x09bb, 0x1599: 0x1674, 0x159a: 0x09d7, 0x159b: 0x09db, 0x159c: 0x09e3, 0x159d: 0x09ef, - 0x159e: 0x09f7, 0x159f: 0x0a13, 0x15a0: 0x1679, 0x15a1: 0x167e, 0x15a2: 0x0a1f, 0x15a3: 0x0a23, - 0x15a4: 0x0a27, 0x15a5: 0x0a1b, 0x15a6: 0x0a2f, 0x15a7: 0x05c7, 0x15a8: 0x05cb, 0x15a9: 0x0a37, - 0x15aa: 0x0a3f, 0x15ab: 0x0a3f, 0x15ac: 0x1683, 0x15ad: 0x0a5b, 0x15ae: 0x0a5f, 0x15af: 0x0a63, - 0x15b0: 0x0a6b, 0x15b1: 0x1688, 0x15b2: 0x0a73, 0x15b3: 0x0a77, 0x15b4: 0x0b4f, 0x15b5: 0x0a7f, - 0x15b6: 0x05cf, 0x15b7: 0x0a8b, 0x15b8: 0x0a9b, 0x15b9: 0x0aa7, 0x15ba: 0x0aa3, 0x15bb: 0x1692, - 0x15bc: 0x0aaf, 0x15bd: 0x1697, 0x15be: 0x0abb, 0x15bf: 0x0ab7, - // Block 0x57, offset 0x15c0 - 0x15c0: 0x0abf, 0x15c1: 0x0acf, 0x15c2: 0x0ad3, 0x15c3: 0x05d3, 0x15c4: 0x0ae3, 0x15c5: 0x0aeb, - 0x15c6: 0x0aef, 0x15c7: 0x0af3, 0x15c8: 0x05d7, 0x15c9: 0x169c, 0x15ca: 0x05db, 0x15cb: 0x0b0f, - 0x15cc: 0x0b13, 0x15cd: 0x0b17, 0x15ce: 0x0b1f, 0x15cf: 0x1863, 0x15d0: 0x0b37, 0x15d1: 0x16a6, - 0x15d2: 0x16a6, 0x15d3: 0x11d7, 0x15d4: 0x0b47, 0x15d5: 0x0b47, 0x15d6: 0x05df, 0x15d7: 0x16c9, - 0x15d8: 0x179b, 0x15d9: 0x0b57, 0x15da: 0x0b5f, 0x15db: 0x05e3, 0x15dc: 0x0b73, 0x15dd: 0x0b83, - 0x15de: 0x0b87, 0x15df: 0x0b8f, 0x15e0: 0x0b9f, 0x15e1: 0x05eb, 0x15e2: 0x05e7, 0x15e3: 0x0ba3, - 0x15e4: 0x16ab, 0x15e5: 0x0ba7, 0x15e6: 0x0bbb, 0x15e7: 0x0bbf, 0x15e8: 0x0bc3, 0x15e9: 0x0bbf, - 0x15ea: 0x0bcf, 0x15eb: 0x0bd3, 0x15ec: 0x0be3, 0x15ed: 0x0bdb, 0x15ee: 0x0bdf, 0x15ef: 0x0be7, - 0x15f0: 0x0beb, 0x15f1: 0x0bef, 0x15f2: 0x0bfb, 0x15f3: 0x0bff, 0x15f4: 0x0c17, 0x15f5: 0x0c1f, - 0x15f6: 0x0c2f, 0x15f7: 0x0c43, 0x15f8: 0x16ba, 0x15f9: 0x0c3f, 0x15fa: 0x0c33, 0x15fb: 0x0c4b, - 0x15fc: 0x0c53, 0x15fd: 0x0c67, 0x15fe: 0x16bf, 0x15ff: 0x0c6f, - // Block 0x58, offset 0x1600 - 0x1600: 0x0c63, 0x1601: 0x0c5b, 0x1602: 0x05ef, 0x1603: 0x0c77, 0x1604: 0x0c7f, 0x1605: 0x0c87, - 0x1606: 0x0c7b, 0x1607: 0x05f3, 0x1608: 0x0c97, 0x1609: 0x0c9f, 0x160a: 0x16c4, 0x160b: 0x0ccb, - 0x160c: 0x0cff, 0x160d: 0x0cdb, 0x160e: 0x05ff, 0x160f: 0x0ce7, 0x1610: 0x05fb, 0x1611: 0x05f7, - 0x1612: 0x07c3, 0x1613: 0x07c7, 0x1614: 0x0d03, 0x1615: 0x0ceb, 0x1616: 0x11ab, 0x1617: 0x0663, - 0x1618: 0x0d0f, 0x1619: 0x0d13, 0x161a: 0x0d17, 0x161b: 0x0d2b, 0x161c: 0x0d23, 0x161d: 0x16dd, - 0x161e: 0x0603, 0x161f: 0x0d3f, 0x1620: 0x0d33, 0x1621: 0x0d4f, 0x1622: 0x0d57, 0x1623: 0x16e7, - 0x1624: 0x0d5b, 0x1625: 0x0d47, 0x1626: 0x0d63, 0x1627: 0x0607, 0x1628: 0x0d67, 0x1629: 0x0d6b, - 0x162a: 0x0d6f, 0x162b: 0x0d7b, 0x162c: 0x16ec, 0x162d: 0x0d83, 0x162e: 0x060b, 0x162f: 0x0d8f, - 0x1630: 0x16f1, 0x1631: 0x0d93, 0x1632: 0x060f, 0x1633: 0x0d9f, 0x1634: 0x0dab, 0x1635: 0x0db7, - 0x1636: 0x0dbb, 0x1637: 0x16f6, 0x1638: 0x168d, 0x1639: 0x16fb, 0x163a: 0x0ddb, 0x163b: 0x1700, - 0x163c: 0x0de7, 0x163d: 0x0def, 0x163e: 0x0ddf, 0x163f: 0x0dfb, - // Block 0x59, offset 0x1640 - 0x1640: 0x0e0b, 0x1641: 0x0e1b, 0x1642: 0x0e0f, 0x1643: 0x0e13, 0x1644: 0x0e1f, 0x1645: 0x0e23, - 0x1646: 0x1705, 0x1647: 0x0e07, 0x1648: 0x0e3b, 0x1649: 0x0e3f, 0x164a: 0x0613, 0x164b: 0x0e53, - 0x164c: 0x0e4f, 0x164d: 0x170a, 0x164e: 0x0e33, 0x164f: 0x0e6f, 0x1650: 0x170f, 0x1651: 0x1714, - 0x1652: 0x0e73, 0x1653: 0x0e87, 0x1654: 0x0e83, 0x1655: 0x0e7f, 0x1656: 0x0617, 0x1657: 0x0e8b, - 0x1658: 0x0e9b, 0x1659: 0x0e97, 0x165a: 0x0ea3, 0x165b: 0x1651, 0x165c: 0x0eb3, 0x165d: 0x1719, - 0x165e: 0x0ebf, 0x165f: 0x1723, 0x1660: 0x0ed3, 0x1661: 0x0edf, 0x1662: 0x0ef3, 0x1663: 0x1728, - 0x1664: 0x0f07, 0x1665: 0x0f0b, 0x1666: 0x172d, 0x1667: 0x1732, 0x1668: 0x0f27, 0x1669: 0x0f37, - 0x166a: 0x061b, 0x166b: 0x0f3b, 0x166c: 0x061f, 0x166d: 0x061f, 0x166e: 0x0f53, 0x166f: 0x0f57, - 0x1670: 0x0f5f, 0x1671: 0x0f63, 0x1672: 0x0f6f, 0x1673: 0x0623, 0x1674: 0x0f87, 0x1675: 0x1737, - 0x1676: 0x0fa3, 0x1677: 0x173c, 0x1678: 0x0faf, 0x1679: 0x16a1, 0x167a: 0x0fbf, 0x167b: 0x1741, - 0x167c: 0x1746, 0x167d: 0x174b, 0x167e: 0x0627, 0x167f: 0x062b, - // Block 0x5a, offset 0x1680 - 0x1680: 0x0ff7, 0x1681: 0x1755, 0x1682: 0x1750, 0x1683: 0x175a, 0x1684: 0x175f, 0x1685: 0x0fff, - 0x1686: 0x1003, 0x1687: 0x1003, 0x1688: 0x100b, 0x1689: 0x0633, 0x168a: 0x100f, 0x168b: 0x0637, - 0x168c: 0x063b, 0x168d: 0x1769, 0x168e: 0x1023, 0x168f: 0x102b, 0x1690: 0x1037, 0x1691: 0x063f, - 0x1692: 0x176e, 0x1693: 0x105b, 0x1694: 0x1773, 0x1695: 0x1778, 0x1696: 0x107b, 0x1697: 0x1093, - 0x1698: 0x0643, 0x1699: 0x109b, 0x169a: 0x109f, 0x169b: 0x10a3, 0x169c: 0x177d, 0x169d: 0x1782, - 0x169e: 0x1782, 0x169f: 0x10bb, 0x16a0: 0x0647, 0x16a1: 0x1787, 0x16a2: 0x10cf, 0x16a3: 0x10d3, - 0x16a4: 0x064b, 0x16a5: 0x178c, 0x16a6: 0x10ef, 0x16a7: 0x064f, 0x16a8: 0x10ff, 0x16a9: 0x10f7, - 0x16aa: 0x1107, 0x16ab: 0x1796, 0x16ac: 0x111f, 0x16ad: 0x0653, 0x16ae: 0x112b, 0x16af: 0x1133, - 0x16b0: 0x1143, 0x16b1: 0x0657, 0x16b2: 0x17a0, 0x16b3: 0x17a5, 0x16b4: 0x065b, 0x16b5: 0x17aa, - 0x16b6: 0x115b, 0x16b7: 0x17af, 0x16b8: 0x1167, 0x16b9: 0x1173, 0x16ba: 0x117b, 0x16bb: 0x17b4, - 0x16bc: 0x17b9, 0x16bd: 0x118f, 0x16be: 0x17be, 0x16bf: 0x1197, - // Block 0x5b, offset 0x16c0 - 0x16c0: 0x16ce, 0x16c1: 0x065f, 0x16c2: 0x11af, 0x16c3: 0x11b3, 0x16c4: 0x0667, 0x16c5: 0x11b7, - 0x16c6: 0x0a33, 0x16c7: 0x17c3, 0x16c8: 0x17c8, 0x16c9: 0x16d3, 0x16ca: 0x16d8, 0x16cb: 0x11d7, - 0x16cc: 0x11db, 0x16cd: 0x13f3, 0x16ce: 0x066b, 0x16cf: 0x1207, 0x16d0: 0x1203, 0x16d1: 0x120b, - 0x16d2: 0x083f, 0x16d3: 0x120f, 0x16d4: 0x1213, 0x16d5: 0x1217, 0x16d6: 0x121f, 0x16d7: 0x17cd, - 0x16d8: 0x121b, 0x16d9: 0x1223, 0x16da: 0x1237, 0x16db: 0x123b, 0x16dc: 0x1227, 0x16dd: 0x123f, - 0x16de: 0x1253, 0x16df: 0x1267, 0x16e0: 0x1233, 0x16e1: 0x1247, 0x16e2: 0x124b, 0x16e3: 0x124f, - 0x16e4: 0x17d2, 0x16e5: 0x17dc, 0x16e6: 0x17d7, 0x16e7: 0x066f, 0x16e8: 0x126f, 0x16e9: 0x1273, - 0x16ea: 0x127b, 0x16eb: 0x17f0, 0x16ec: 0x127f, 0x16ed: 0x17e1, 0x16ee: 0x0673, 0x16ef: 0x0677, - 0x16f0: 0x17e6, 0x16f1: 0x17eb, 0x16f2: 0x067b, 0x16f3: 0x129f, 0x16f4: 0x12a3, 0x16f5: 0x12a7, - 0x16f6: 0x12ab, 0x16f7: 0x12b7, 0x16f8: 0x12b3, 0x16f9: 0x12bf, 0x16fa: 0x12bb, 0x16fb: 0x12cb, - 0x16fc: 0x12c3, 0x16fd: 0x12c7, 0x16fe: 0x12cf, 0x16ff: 0x067f, - // Block 0x5c, offset 0x1700 - 0x1700: 0x12d7, 0x1701: 0x12db, 0x1702: 0x0683, 0x1703: 0x12eb, 0x1704: 0x12ef, 0x1705: 0x17f5, - 0x1706: 0x12fb, 0x1707: 0x12ff, 0x1708: 0x0687, 0x1709: 0x130b, 0x170a: 0x05bb, 0x170b: 0x17fa, - 0x170c: 0x17ff, 0x170d: 0x068b, 0x170e: 0x068f, 0x170f: 0x1337, 0x1710: 0x134f, 0x1711: 0x136b, - 0x1712: 0x137b, 0x1713: 0x1804, 0x1714: 0x138f, 0x1715: 0x1393, 0x1716: 0x13ab, 0x1717: 0x13b7, - 0x1718: 0x180e, 0x1719: 0x1660, 0x171a: 0x13c3, 0x171b: 0x13bf, 0x171c: 0x13cb, 0x171d: 0x1665, - 0x171e: 0x13d7, 0x171f: 0x13e3, 0x1720: 0x1813, 0x1721: 0x1818, 0x1722: 0x1423, 0x1723: 0x142f, - 0x1724: 0x1437, 0x1725: 0x181d, 0x1726: 0x143b, 0x1727: 0x1467, 0x1728: 0x1473, 0x1729: 0x1477, - 0x172a: 0x146f, 0x172b: 0x1483, 0x172c: 0x1487, 0x172d: 0x1822, 0x172e: 0x1493, 0x172f: 0x0693, - 0x1730: 0x149b, 0x1731: 0x1827, 0x1732: 0x0697, 0x1733: 0x14d3, 0x1734: 0x0ac3, 0x1735: 0x14eb, - 0x1736: 0x182c, 0x1737: 0x1836, 0x1738: 0x069b, 0x1739: 0x069f, 0x173a: 0x1513, 0x173b: 0x183b, - 0x173c: 0x06a3, 0x173d: 0x1840, 0x173e: 0x152b, 0x173f: 0x152b, - // Block 0x5d, offset 0x1740 - 0x1740: 0x1533, 0x1741: 0x1845, 0x1742: 0x154b, 0x1743: 0x06a7, 0x1744: 0x155b, 0x1745: 0x1567, - 0x1746: 0x156f, 0x1747: 0x1577, 0x1748: 0x06ab, 0x1749: 0x184a, 0x174a: 0x158b, 0x174b: 0x15a7, - 0x174c: 0x15b3, 0x174d: 0x06af, 0x174e: 0x06b3, 0x174f: 0x15b7, 0x1750: 0x184f, 0x1751: 0x06b7, - 0x1752: 0x1854, 0x1753: 0x1859, 0x1754: 0x185e, 0x1755: 0x15db, 0x1756: 0x06bb, 0x1757: 0x15ef, - 0x1758: 0x15f7, 0x1759: 0x15fb, 0x175a: 0x1603, 0x175b: 0x160b, 0x175c: 0x1613, 0x175d: 0x1868, -} - -// nfkcIndex: 22 blocks, 1408 entries, 1408 bytes -// Block 0 is the zero block. -var nfkcIndex = [1408]uint8{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x5c, 0xc3: 0x01, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x5d, 0xc7: 0x04, - 0xc8: 0x05, 0xca: 0x5e, 0xcb: 0x5f, 0xcc: 0x06, 0xcd: 0x07, 0xce: 0x08, 0xcf: 0x09, - 0xd0: 0x0a, 0xd1: 0x60, 0xd2: 0x61, 0xd3: 0x0b, 0xd6: 0x0c, 0xd7: 0x62, - 0xd8: 0x63, 0xd9: 0x0d, 0xdb: 0x64, 0xdc: 0x65, 0xdd: 0x66, 0xdf: 0x67, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, - 0xea: 0x06, 0xeb: 0x07, 0xec: 0x08, 0xed: 0x09, 0xef: 0x0a, - 0xf0: 0x13, - // Block 0x4, offset 0x100 - 0x120: 0x68, 0x121: 0x69, 0x123: 0x0e, 0x124: 0x6a, 0x125: 0x6b, 0x126: 0x6c, 0x127: 0x6d, - 0x128: 0x6e, 0x129: 0x6f, 0x12a: 0x70, 0x12b: 0x71, 0x12c: 0x6c, 0x12d: 0x72, 0x12e: 0x73, 0x12f: 0x74, - 0x131: 0x75, 0x132: 0x76, 0x133: 0x77, 0x134: 0x78, 0x135: 0x79, 0x137: 0x7a, - 0x138: 0x7b, 0x139: 0x7c, 0x13a: 0x7d, 0x13b: 0x7e, 0x13c: 0x7f, 0x13d: 0x80, 0x13e: 0x81, 0x13f: 0x82, - // Block 0x5, offset 0x140 - 0x140: 0x83, 0x142: 0x84, 0x143: 0x85, 0x144: 0x86, 0x145: 0x87, 0x146: 0x88, 0x147: 0x89, - 0x14d: 0x8a, - 0x15c: 0x8b, 0x15f: 0x8c, - 0x162: 0x8d, 0x164: 0x8e, - 0x168: 0x8f, 0x169: 0x90, 0x16a: 0x91, 0x16c: 0x0f, 0x16d: 0x92, 0x16e: 0x93, 0x16f: 0x94, - 0x170: 0x95, 0x173: 0x96, 0x174: 0x97, 0x175: 0x10, 0x176: 0x11, 0x177: 0x12, - 0x178: 0x13, 0x179: 0x14, 0x17a: 0x15, 0x17b: 0x16, 0x17c: 0x17, 0x17d: 0x18, 0x17e: 0x19, 0x17f: 0x1a, - // Block 0x6, offset 0x180 - 0x180: 0x98, 0x181: 0x99, 0x182: 0x9a, 0x183: 0x9b, 0x184: 0x1b, 0x185: 0x1c, 0x186: 0x9c, 0x187: 0x9d, - 0x188: 0x9e, 0x189: 0x1d, 0x18a: 0x1e, 0x18b: 0x9f, 0x18c: 0xa0, - 0x191: 0x1f, 0x192: 0x20, 0x193: 0xa1, - 0x1a8: 0xa2, 0x1a9: 0xa3, 0x1ab: 0xa4, - 0x1b1: 0xa5, 0x1b3: 0xa6, 0x1b5: 0xa7, 0x1b7: 0xa8, - 0x1ba: 0xa9, 0x1bb: 0xaa, 0x1bc: 0x21, 0x1bd: 0x22, 0x1be: 0x23, 0x1bf: 0xab, - // Block 0x7, offset 0x1c0 - 0x1c0: 0xac, 0x1c1: 0x24, 0x1c2: 0x25, 0x1c3: 0x26, 0x1c4: 0xad, 0x1c5: 0x27, 0x1c6: 0x28, - 0x1c8: 0x29, 0x1c9: 0x2a, 0x1ca: 0x2b, 0x1cb: 0x2c, 0x1cc: 0x2d, 0x1cd: 0x2e, 0x1ce: 0x2f, 0x1cf: 0x30, - // Block 0x8, offset 0x200 - 0x219: 0xae, 0x21a: 0xaf, 0x21b: 0xb0, 0x21d: 0xb1, 0x21f: 0xb2, - 0x220: 0xb3, 0x223: 0xb4, 0x224: 0xb5, 0x225: 0xb6, 0x226: 0xb7, 0x227: 0xb8, - 0x22a: 0xb9, 0x22b: 0xba, 0x22d: 0xbb, 0x22f: 0xbc, - 0x230: 0xbd, 0x231: 0xbe, 0x232: 0xbf, 0x233: 0xc0, 0x234: 0xc1, 0x235: 0xc2, 0x236: 0xc3, 0x237: 0xbd, - 0x238: 0xbe, 0x239: 0xbf, 0x23a: 0xc0, 0x23b: 0xc1, 0x23c: 0xc2, 0x23d: 0xc3, 0x23e: 0xbd, 0x23f: 0xbe, - // Block 0x9, offset 0x240 - 0x240: 0xbf, 0x241: 0xc0, 0x242: 0xc1, 0x243: 0xc2, 0x244: 0xc3, 0x245: 0xbd, 0x246: 0xbe, 0x247: 0xbf, - 0x248: 0xc0, 0x249: 0xc1, 0x24a: 0xc2, 0x24b: 0xc3, 0x24c: 0xbd, 0x24d: 0xbe, 0x24e: 0xbf, 0x24f: 0xc0, - 0x250: 0xc1, 0x251: 0xc2, 0x252: 0xc3, 0x253: 0xbd, 0x254: 0xbe, 0x255: 0xbf, 0x256: 0xc0, 0x257: 0xc1, - 0x258: 0xc2, 0x259: 0xc3, 0x25a: 0xbd, 0x25b: 0xbe, 0x25c: 0xbf, 0x25d: 0xc0, 0x25e: 0xc1, 0x25f: 0xc2, - 0x260: 0xc3, 0x261: 0xbd, 0x262: 0xbe, 0x263: 0xbf, 0x264: 0xc0, 0x265: 0xc1, 0x266: 0xc2, 0x267: 0xc3, - 0x268: 0xbd, 0x269: 0xbe, 0x26a: 0xbf, 0x26b: 0xc0, 0x26c: 0xc1, 0x26d: 0xc2, 0x26e: 0xc3, 0x26f: 0xbd, - 0x270: 0xbe, 0x271: 0xbf, 0x272: 0xc0, 0x273: 0xc1, 0x274: 0xc2, 0x275: 0xc3, 0x276: 0xbd, 0x277: 0xbe, - 0x278: 0xbf, 0x279: 0xc0, 0x27a: 0xc1, 0x27b: 0xc2, 0x27c: 0xc3, 0x27d: 0xbd, 0x27e: 0xbe, 0x27f: 0xbf, - // Block 0xa, offset 0x280 - 0x280: 0xc0, 0x281: 0xc1, 0x282: 0xc2, 0x283: 0xc3, 0x284: 0xbd, 0x285: 0xbe, 0x286: 0xbf, 0x287: 0xc0, - 0x288: 0xc1, 0x289: 0xc2, 0x28a: 0xc3, 0x28b: 0xbd, 0x28c: 0xbe, 0x28d: 0xbf, 0x28e: 0xc0, 0x28f: 0xc1, - 0x290: 0xc2, 0x291: 0xc3, 0x292: 0xbd, 0x293: 0xbe, 0x294: 0xbf, 0x295: 0xc0, 0x296: 0xc1, 0x297: 0xc2, - 0x298: 0xc3, 0x299: 0xbd, 0x29a: 0xbe, 0x29b: 0xbf, 0x29c: 0xc0, 0x29d: 0xc1, 0x29e: 0xc2, 0x29f: 0xc3, - 0x2a0: 0xbd, 0x2a1: 0xbe, 0x2a2: 0xbf, 0x2a3: 0xc0, 0x2a4: 0xc1, 0x2a5: 0xc2, 0x2a6: 0xc3, 0x2a7: 0xbd, - 0x2a8: 0xbe, 0x2a9: 0xbf, 0x2aa: 0xc0, 0x2ab: 0xc1, 0x2ac: 0xc2, 0x2ad: 0xc3, 0x2ae: 0xbd, 0x2af: 0xbe, - 0x2b0: 0xbf, 0x2b1: 0xc0, 0x2b2: 0xc1, 0x2b3: 0xc2, 0x2b4: 0xc3, 0x2b5: 0xbd, 0x2b6: 0xbe, 0x2b7: 0xbf, - 0x2b8: 0xc0, 0x2b9: 0xc1, 0x2ba: 0xc2, 0x2bb: 0xc3, 0x2bc: 0xbd, 0x2bd: 0xbe, 0x2be: 0xbf, 0x2bf: 0xc0, - // Block 0xb, offset 0x2c0 - 0x2c0: 0xc1, 0x2c1: 0xc2, 0x2c2: 0xc3, 0x2c3: 0xbd, 0x2c4: 0xbe, 0x2c5: 0xbf, 0x2c6: 0xc0, 0x2c7: 0xc1, - 0x2c8: 0xc2, 0x2c9: 0xc3, 0x2ca: 0xbd, 0x2cb: 0xbe, 0x2cc: 0xbf, 0x2cd: 0xc0, 0x2ce: 0xc1, 0x2cf: 0xc2, - 0x2d0: 0xc3, 0x2d1: 0xbd, 0x2d2: 0xbe, 0x2d3: 0xbf, 0x2d4: 0xc0, 0x2d5: 0xc1, 0x2d6: 0xc2, 0x2d7: 0xc3, - 0x2d8: 0xbd, 0x2d9: 0xbe, 0x2da: 0xbf, 0x2db: 0xc0, 0x2dc: 0xc1, 0x2dd: 0xc2, 0x2de: 0xc4, - // Block 0xc, offset 0x300 - 0x324: 0x31, 0x325: 0x32, 0x326: 0x33, 0x327: 0x34, - 0x328: 0x35, 0x329: 0x36, 0x32a: 0x37, 0x32b: 0x38, 0x32c: 0x39, 0x32d: 0x3a, 0x32e: 0x3b, 0x32f: 0x3c, - 0x330: 0x3d, 0x331: 0x3e, 0x332: 0x3f, 0x333: 0x40, 0x334: 0x41, 0x335: 0x42, 0x336: 0x43, 0x337: 0x44, - 0x338: 0x45, 0x339: 0x46, 0x33a: 0x47, 0x33b: 0x48, 0x33c: 0xc5, 0x33d: 0x49, 0x33e: 0x4a, 0x33f: 0x4b, - // Block 0xd, offset 0x340 - 0x347: 0xc6, - 0x34b: 0xc7, 0x34d: 0xc8, - 0x368: 0xc9, 0x36b: 0xca, - 0x374: 0xcb, - 0x37d: 0xcc, - // Block 0xe, offset 0x380 - 0x381: 0xcd, 0x382: 0xce, 0x384: 0xcf, 0x385: 0xb7, 0x387: 0xd0, - 0x388: 0xd1, 0x38b: 0xd2, 0x38c: 0xd3, 0x38d: 0xd4, - 0x391: 0xd5, 0x392: 0xd6, 0x393: 0xd7, 0x396: 0xd8, 0x397: 0xd9, - 0x398: 0xda, 0x39a: 0xdb, 0x39c: 0xdc, - 0x3a0: 0xdd, - 0x3a8: 0xde, 0x3a9: 0xdf, 0x3aa: 0xe0, - 0x3b0: 0xda, 0x3b5: 0xe1, 0x3b6: 0xe2, - // Block 0xf, offset 0x3c0 - 0x3eb: 0xe3, 0x3ec: 0xe4, - // Block 0x10, offset 0x400 - 0x432: 0xe5, - // Block 0x11, offset 0x440 - 0x445: 0xe6, 0x446: 0xe7, 0x447: 0xe8, - 0x449: 0xe9, - 0x450: 0xea, 0x451: 0xeb, 0x452: 0xec, 0x453: 0xed, 0x454: 0xee, 0x455: 0xef, 0x456: 0xf0, 0x457: 0xf1, - 0x458: 0xf2, 0x459: 0xf3, 0x45a: 0x4c, 0x45b: 0xf4, 0x45c: 0xf5, 0x45d: 0xf6, 0x45e: 0xf7, 0x45f: 0x4d, - // Block 0x12, offset 0x480 - 0x480: 0xf8, - 0x4a3: 0xf9, 0x4a5: 0xfa, - 0x4b8: 0x4e, 0x4b9: 0x4f, 0x4ba: 0x50, - // Block 0x13, offset 0x4c0 - 0x4c4: 0x51, 0x4c5: 0xfb, 0x4c6: 0xfc, - 0x4c8: 0x52, 0x4c9: 0xfd, - // Block 0x14, offset 0x500 - 0x520: 0x53, 0x521: 0x54, 0x522: 0x55, 0x523: 0x56, 0x524: 0x57, 0x525: 0x58, 0x526: 0x59, 0x527: 0x5a, - 0x528: 0x5b, - // Block 0x15, offset 0x540 - 0x550: 0x0b, 0x551: 0x0c, 0x556: 0x0d, - 0x55b: 0x0e, 0x55d: 0x0f, 0x55e: 0x10, 0x55f: 0x11, - 0x56f: 0x12, -} - -// nfkcSparseOffset: 162 entries, 324 bytes -var nfkcSparseOffset = []uint16{0x0, 0xe, 0x12, 0x1b, 0x25, 0x35, 0x37, 0x3c, 0x47, 0x56, 0x63, 0x6b, 0x70, 0x75, 0x77, 0x7f, 0x86, 0x89, 0x91, 0x95, 0x99, 0x9b, 0x9d, 0xa6, 0xaa, 0xb1, 0xb6, 0xb9, 0xc3, 0xc6, 0xcd, 0xd5, 0xd9, 0xdb, 0xde, 0xe2, 0xe8, 0xf9, 0x105, 0x107, 0x10d, 0x10f, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11b, 0x11e, 0x121, 0x123, 0x126, 0x129, 0x12d, 0x132, 0x13b, 0x13d, 0x140, 0x142, 0x14d, 0x158, 0x166, 0x174, 0x184, 0x192, 0x199, 0x19f, 0x1ae, 0x1b2, 0x1b4, 0x1b8, 0x1ba, 0x1bd, 0x1bf, 0x1c2, 0x1c4, 0x1c7, 0x1c9, 0x1cb, 0x1cd, 0x1d9, 0x1e3, 0x1ed, 0x1f0, 0x1f4, 0x1f6, 0x1f8, 0x1fa, 0x1fc, 0x1ff, 0x201, 0x203, 0x205, 0x207, 0x20d, 0x210, 0x214, 0x216, 0x21d, 0x223, 0x229, 0x231, 0x237, 0x23d, 0x243, 0x247, 0x249, 0x24b, 0x24d, 0x24f, 0x255, 0x258, 0x25a, 0x260, 0x263, 0x26b, 0x272, 0x275, 0x278, 0x27a, 0x27d, 0x285, 0x289, 0x290, 0x293, 0x299, 0x29b, 0x29d, 0x2a0, 0x2a2, 0x2a5, 0x2a7, 0x2a9, 0x2ab, 0x2ae, 0x2b0, 0x2b2, 0x2b4, 0x2b6, 0x2c3, 0x2cd, 0x2cf, 0x2d1, 0x2d5, 0x2da, 0x2e6, 0x2eb, 0x2f4, 0x2fa, 0x2ff, 0x303, 0x308, 0x30c, 0x31c, 0x32a, 0x338, 0x346, 0x34c, 0x34e, 0x351, 0x35b, 0x35d} - -// nfkcSparseValues: 871 entries, 3484 bytes -var nfkcSparseValues = [871]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0002, lo: 0x0d}, - {value: 0x0001, lo: 0xa0, hi: 0xa0}, - {value: 0x4278, lo: 0xa8, hi: 0xa8}, - {value: 0x0083, lo: 0xaa, hi: 0xaa}, - {value: 0x4264, lo: 0xaf, hi: 0xaf}, - {value: 0x0025, lo: 0xb2, hi: 0xb3}, - {value: 0x425a, lo: 0xb4, hi: 0xb4}, - {value: 0x01dc, lo: 0xb5, hi: 0xb5}, - {value: 0x4291, lo: 0xb8, hi: 0xb8}, - {value: 0x0023, lo: 0xb9, hi: 0xb9}, - {value: 0x009f, lo: 0xba, hi: 0xba}, - {value: 0x221c, lo: 0xbc, hi: 0xbc}, - {value: 0x2210, lo: 0xbd, hi: 0xbd}, - {value: 0x22b2, lo: 0xbe, hi: 0xbe}, - // Block 0x1, offset 0xe - {value: 0x0091, lo: 0x03}, - {value: 0x46e2, lo: 0xa0, hi: 0xa1}, - {value: 0x4714, lo: 0xaf, hi: 0xb0}, - {value: 0xa000, lo: 0xb7, hi: 0xb7}, - // Block 0x2, offset 0x12 - {value: 0x0003, lo: 0x08}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x0091, lo: 0xb0, hi: 0xb0}, - {value: 0x0119, lo: 0xb1, hi: 0xb1}, - {value: 0x0095, lo: 0xb2, hi: 0xb2}, - {value: 0x00a5, lo: 0xb3, hi: 0xb3}, - {value: 0x0143, lo: 0xb4, hi: 0xb6}, - {value: 0x00af, lo: 0xb7, hi: 0xb7}, - {value: 0x00b3, lo: 0xb8, hi: 0xb8}, - // Block 0x3, offset 0x1b - {value: 0x000a, lo: 0x09}, - {value: 0x426e, lo: 0x98, hi: 0x98}, - {value: 0x4273, lo: 0x99, hi: 0x9a}, - {value: 0x4296, lo: 0x9b, hi: 0x9b}, - {value: 0x425f, lo: 0x9c, hi: 0x9c}, - {value: 0x4282, lo: 0x9d, hi: 0x9d}, - {value: 0x0113, lo: 0xa0, hi: 0xa0}, - {value: 0x0099, lo: 0xa1, hi: 0xa1}, - {value: 0x00a7, lo: 0xa2, hi: 0xa3}, - {value: 0x0167, lo: 0xa4, hi: 0xa4}, - // Block 0x4, offset 0x25 - {value: 0x0000, lo: 0x0f}, - {value: 0xa000, lo: 0x83, hi: 0x83}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0xa000, lo: 0x8b, hi: 0x8b}, - {value: 0xa000, lo: 0x8d, hi: 0x8d}, - {value: 0x37a5, lo: 0x90, hi: 0x90}, - {value: 0x37b1, lo: 0x91, hi: 0x91}, - {value: 0x379f, lo: 0x93, hi: 0x93}, - {value: 0xa000, lo: 0x96, hi: 0x96}, - {value: 0x3817, lo: 0x97, hi: 0x97}, - {value: 0x37e1, lo: 0x9c, hi: 0x9c}, - {value: 0x37c9, lo: 0x9d, hi: 0x9d}, - {value: 0x37f3, lo: 0x9e, hi: 0x9e}, - {value: 0xa000, lo: 0xb4, hi: 0xb5}, - {value: 0x381d, lo: 0xb6, hi: 0xb6}, - {value: 0x3823, lo: 0xb7, hi: 0xb7}, - // Block 0x5, offset 0x35 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x83, hi: 0x87}, - // Block 0x6, offset 0x37 - {value: 0x0001, lo: 0x04}, - {value: 0x8113, lo: 0x81, hi: 0x82}, - {value: 0x8132, lo: 0x84, hi: 0x84}, - {value: 0x812d, lo: 0x85, hi: 0x85}, - {value: 0x810d, lo: 0x87, hi: 0x87}, - // Block 0x7, offset 0x3c - {value: 0x0000, lo: 0x0a}, - {value: 0x8132, lo: 0x90, hi: 0x97}, - {value: 0x8119, lo: 0x98, hi: 0x98}, - {value: 0x811a, lo: 0x99, hi: 0x99}, - {value: 0x811b, lo: 0x9a, hi: 0x9a}, - {value: 0x3841, lo: 0xa2, hi: 0xa2}, - {value: 0x3847, lo: 0xa3, hi: 0xa3}, - {value: 0x3853, lo: 0xa4, hi: 0xa4}, - {value: 0x384d, lo: 0xa5, hi: 0xa5}, - {value: 0x3859, lo: 0xa6, hi: 0xa6}, - {value: 0xa000, lo: 0xa7, hi: 0xa7}, - // Block 0x8, offset 0x47 - {value: 0x0000, lo: 0x0e}, - {value: 0x386b, lo: 0x80, hi: 0x80}, - {value: 0xa000, lo: 0x81, hi: 0x81}, - {value: 0x385f, lo: 0x82, hi: 0x82}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x3865, lo: 0x93, hi: 0x93}, - {value: 0xa000, lo: 0x95, hi: 0x95}, - {value: 0x8132, lo: 0x96, hi: 0x9c}, - {value: 0x8132, lo: 0x9f, hi: 0xa2}, - {value: 0x812d, lo: 0xa3, hi: 0xa3}, - {value: 0x8132, lo: 0xa4, hi: 0xa4}, - {value: 0x8132, lo: 0xa7, hi: 0xa8}, - {value: 0x812d, lo: 0xaa, hi: 0xaa}, - {value: 0x8132, lo: 0xab, hi: 0xac}, - {value: 0x812d, lo: 0xad, hi: 0xad}, - // Block 0x9, offset 0x56 - {value: 0x0000, lo: 0x0c}, - {value: 0x811f, lo: 0x91, hi: 0x91}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - {value: 0x812d, lo: 0xb1, hi: 0xb1}, - {value: 0x8132, lo: 0xb2, hi: 0xb3}, - {value: 0x812d, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb5, hi: 0xb6}, - {value: 0x812d, lo: 0xb7, hi: 0xb9}, - {value: 0x8132, lo: 0xba, hi: 0xba}, - {value: 0x812d, lo: 0xbb, hi: 0xbc}, - {value: 0x8132, lo: 0xbd, hi: 0xbd}, - {value: 0x812d, lo: 0xbe, hi: 0xbe}, - {value: 0x8132, lo: 0xbf, hi: 0xbf}, - // Block 0xa, offset 0x63 - {value: 0x0005, lo: 0x07}, - {value: 0x8132, lo: 0x80, hi: 0x80}, - {value: 0x8132, lo: 0x81, hi: 0x81}, - {value: 0x812d, lo: 0x82, hi: 0x83}, - {value: 0x812d, lo: 0x84, hi: 0x85}, - {value: 0x812d, lo: 0x86, hi: 0x87}, - {value: 0x812d, lo: 0x88, hi: 0x89}, - {value: 0x8132, lo: 0x8a, hi: 0x8a}, - // Block 0xb, offset 0x6b - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0xab, hi: 0xb1}, - {value: 0x812d, lo: 0xb2, hi: 0xb2}, - {value: 0x8132, lo: 0xb3, hi: 0xb3}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0xc, offset 0x70 - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0x96, hi: 0x99}, - {value: 0x8132, lo: 0x9b, hi: 0xa3}, - {value: 0x8132, lo: 0xa5, hi: 0xa7}, - {value: 0x8132, lo: 0xa9, hi: 0xad}, - // Block 0xd, offset 0x75 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x99, hi: 0x9b}, - // Block 0xe, offset 0x77 - {value: 0x0000, lo: 0x07}, - {value: 0xa000, lo: 0xa8, hi: 0xa8}, - {value: 0x3ed8, lo: 0xa9, hi: 0xa9}, - {value: 0xa000, lo: 0xb0, hi: 0xb0}, - {value: 0x3ee0, lo: 0xb1, hi: 0xb1}, - {value: 0xa000, lo: 0xb3, hi: 0xb3}, - {value: 0x3ee8, lo: 0xb4, hi: 0xb4}, - {value: 0x9902, lo: 0xbc, hi: 0xbc}, - // Block 0xf, offset 0x7f - {value: 0x0008, lo: 0x06}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x8132, lo: 0x91, hi: 0x91}, - {value: 0x812d, lo: 0x92, hi: 0x92}, - {value: 0x8132, lo: 0x93, hi: 0x93}, - {value: 0x8132, lo: 0x94, hi: 0x94}, - {value: 0x451c, lo: 0x98, hi: 0x9f}, - // Block 0x10, offset 0x86 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x11, offset 0x89 - {value: 0x0008, lo: 0x07}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x455c, lo: 0x9c, hi: 0x9d}, - {value: 0x456c, lo: 0x9f, hi: 0x9f}, - {value: 0x8132, lo: 0xbe, hi: 0xbe}, - // Block 0x12, offset 0x91 - {value: 0x0000, lo: 0x03}, - {value: 0x4594, lo: 0xb3, hi: 0xb3}, - {value: 0x459c, lo: 0xb6, hi: 0xb6}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - // Block 0x13, offset 0x95 - {value: 0x0008, lo: 0x03}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x4574, lo: 0x99, hi: 0x9b}, - {value: 0x458c, lo: 0x9e, hi: 0x9e}, - // Block 0x14, offset 0x99 - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - // Block 0x15, offset 0x9b - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - // Block 0x16, offset 0x9d - {value: 0x0000, lo: 0x08}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2cb6, lo: 0x88, hi: 0x88}, - {value: 0x2cae, lo: 0x8b, hi: 0x8b}, - {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x96, hi: 0x97}, - {value: 0x45a4, lo: 0x9c, hi: 0x9c}, - {value: 0x45ac, lo: 0x9d, hi: 0x9d}, - // Block 0x17, offset 0xa6 - {value: 0x0000, lo: 0x03}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0x2cc6, lo: 0x94, hi: 0x94}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x18, offset 0xaa - {value: 0x0000, lo: 0x06}, - {value: 0xa000, lo: 0x86, hi: 0x87}, - {value: 0x2cce, lo: 0x8a, hi: 0x8a}, - {value: 0x2cde, lo: 0x8b, hi: 0x8b}, - {value: 0x2cd6, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - // Block 0x19, offset 0xb1 - {value: 0x1801, lo: 0x04}, - {value: 0xa000, lo: 0x86, hi: 0x86}, - {value: 0x3ef0, lo: 0x88, hi: 0x88}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x8120, lo: 0x95, hi: 0x96}, - // Block 0x1a, offset 0xb6 - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbc, hi: 0xbc}, - {value: 0xa000, lo: 0xbf, hi: 0xbf}, - // Block 0x1b, offset 0xb9 - {value: 0x0000, lo: 0x09}, - {value: 0x2ce6, lo: 0x80, hi: 0x80}, - {value: 0x9900, lo: 0x82, hi: 0x82}, - {value: 0xa000, lo: 0x86, hi: 0x86}, - {value: 0x2cee, lo: 0x87, hi: 0x87}, - {value: 0x2cf6, lo: 0x88, hi: 0x88}, - {value: 0x2f50, lo: 0x8a, hi: 0x8a}, - {value: 0x2dd8, lo: 0x8b, hi: 0x8b}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x95, hi: 0x96}, - // Block 0x1c, offset 0xc3 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xbb, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x1d, offset 0xc6 - {value: 0x0000, lo: 0x06}, - {value: 0xa000, lo: 0x86, hi: 0x87}, - {value: 0x2cfe, lo: 0x8a, hi: 0x8a}, - {value: 0x2d0e, lo: 0x8b, hi: 0x8b}, - {value: 0x2d06, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - // Block 0x1e, offset 0xcd - {value: 0x6bea, lo: 0x07}, - {value: 0x9904, lo: 0x8a, hi: 0x8a}, - {value: 0x9900, lo: 0x8f, hi: 0x8f}, - {value: 0xa000, lo: 0x99, hi: 0x99}, - {value: 0x3ef8, lo: 0x9a, hi: 0x9a}, - {value: 0x2f58, lo: 0x9c, hi: 0x9c}, - {value: 0x2de3, lo: 0x9d, hi: 0x9d}, - {value: 0x2d16, lo: 0x9e, hi: 0x9f}, - // Block 0x1f, offset 0xd5 - {value: 0x0000, lo: 0x03}, - {value: 0x2621, lo: 0xb3, hi: 0xb3}, - {value: 0x8122, lo: 0xb8, hi: 0xb9}, - {value: 0x8104, lo: 0xba, hi: 0xba}, - // Block 0x20, offset 0xd9 - {value: 0x0000, lo: 0x01}, - {value: 0x8123, lo: 0x88, hi: 0x8b}, - // Block 0x21, offset 0xdb - {value: 0x0000, lo: 0x02}, - {value: 0x2636, lo: 0xb3, hi: 0xb3}, - {value: 0x8124, lo: 0xb8, hi: 0xb9}, - // Block 0x22, offset 0xde - {value: 0x0000, lo: 0x03}, - {value: 0x8125, lo: 0x88, hi: 0x8b}, - {value: 0x2628, lo: 0x9c, hi: 0x9c}, - {value: 0x262f, lo: 0x9d, hi: 0x9d}, - // Block 0x23, offset 0xe2 - {value: 0x0000, lo: 0x05}, - {value: 0x030b, lo: 0x8c, hi: 0x8c}, - {value: 0x812d, lo: 0x98, hi: 0x99}, - {value: 0x812d, lo: 0xb5, hi: 0xb5}, - {value: 0x812d, lo: 0xb7, hi: 0xb7}, - {value: 0x812b, lo: 0xb9, hi: 0xb9}, - // Block 0x24, offset 0xe8 - {value: 0x0000, lo: 0x10}, - {value: 0x2644, lo: 0x83, hi: 0x83}, - {value: 0x264b, lo: 0x8d, hi: 0x8d}, - {value: 0x2652, lo: 0x92, hi: 0x92}, - {value: 0x2659, lo: 0x97, hi: 0x97}, - {value: 0x2660, lo: 0x9c, hi: 0x9c}, - {value: 0x263d, lo: 0xa9, hi: 0xa9}, - {value: 0x8126, lo: 0xb1, hi: 0xb1}, - {value: 0x8127, lo: 0xb2, hi: 0xb2}, - {value: 0x4a84, lo: 0xb3, hi: 0xb3}, - {value: 0x8128, lo: 0xb4, hi: 0xb4}, - {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, - {value: 0x45b4, lo: 0xb6, hi: 0xb6}, - {value: 0x45f4, lo: 0xb7, hi: 0xb7}, - {value: 0x45bc, lo: 0xb8, hi: 0xb8}, - {value: 0x45ff, lo: 0xb9, hi: 0xb9}, - {value: 0x8127, lo: 0xba, hi: 0xbd}, - // Block 0x25, offset 0xf9 - {value: 0x0000, lo: 0x0b}, - {value: 0x8127, lo: 0x80, hi: 0x80}, - {value: 0x4a96, lo: 0x81, hi: 0x81}, - {value: 0x8132, lo: 0x82, hi: 0x83}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0x86, hi: 0x87}, - {value: 0x266e, lo: 0x93, hi: 0x93}, - {value: 0x2675, lo: 0x9d, hi: 0x9d}, - {value: 0x267c, lo: 0xa2, hi: 0xa2}, - {value: 0x2683, lo: 0xa7, hi: 0xa7}, - {value: 0x268a, lo: 0xac, hi: 0xac}, - {value: 0x2667, lo: 0xb9, hi: 0xb9}, - // Block 0x26, offset 0x105 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x86, hi: 0x86}, - // Block 0x27, offset 0x107 - {value: 0x0000, lo: 0x05}, - {value: 0xa000, lo: 0xa5, hi: 0xa5}, - {value: 0x2d1e, lo: 0xa6, hi: 0xa6}, - {value: 0x9900, lo: 0xae, hi: 0xae}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - {value: 0x8104, lo: 0xb9, hi: 0xba}, - // Block 0x28, offset 0x10d - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x8d, hi: 0x8d}, - // Block 0x29, offset 0x10f - {value: 0x0000, lo: 0x01}, - {value: 0x030f, lo: 0xbc, hi: 0xbc}, - // Block 0x2a, offset 0x111 - {value: 0x0000, lo: 0x01}, - {value: 0xa000, lo: 0x80, hi: 0x92}, - // Block 0x2b, offset 0x113 - {value: 0x0000, lo: 0x01}, - {value: 0xb900, lo: 0xa1, hi: 0xb5}, - // Block 0x2c, offset 0x115 - {value: 0x0000, lo: 0x01}, - {value: 0x9900, lo: 0xa8, hi: 0xbf}, - // Block 0x2d, offset 0x117 - {value: 0x0000, lo: 0x01}, - {value: 0x9900, lo: 0x80, hi: 0x82}, - // Block 0x2e, offset 0x119 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x9d, hi: 0x9f}, - // Block 0x2f, offset 0x11b - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x94, hi: 0x94}, - {value: 0x8104, lo: 0xb4, hi: 0xb4}, - // Block 0x30, offset 0x11e - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x92, hi: 0x92}, - {value: 0x8132, lo: 0x9d, hi: 0x9d}, - // Block 0x31, offset 0x121 - {value: 0x0000, lo: 0x01}, - {value: 0x8131, lo: 0xa9, hi: 0xa9}, - // Block 0x32, offset 0x123 - {value: 0x0004, lo: 0x02}, - {value: 0x812e, lo: 0xb9, hi: 0xba}, - {value: 0x812d, lo: 0xbb, hi: 0xbb}, - // Block 0x33, offset 0x126 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x97, hi: 0x97}, - {value: 0x812d, lo: 0x98, hi: 0x98}, - // Block 0x34, offset 0x129 - {value: 0x0000, lo: 0x03}, - {value: 0x8104, lo: 0xa0, hi: 0xa0}, - {value: 0x8132, lo: 0xb5, hi: 0xbc}, - {value: 0x812d, lo: 0xbf, hi: 0xbf}, - // Block 0x35, offset 0x12d - {value: 0x0000, lo: 0x04}, - {value: 0x8132, lo: 0xb0, hi: 0xb4}, - {value: 0x812d, lo: 0xb5, hi: 0xba}, - {value: 0x8132, lo: 0xbb, hi: 0xbc}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0x36, offset 0x132 - {value: 0x0000, lo: 0x08}, - {value: 0x2d66, lo: 0x80, hi: 0x80}, - {value: 0x2d6e, lo: 0x81, hi: 0x81}, - {value: 0xa000, lo: 0x82, hi: 0x82}, - {value: 0x2d76, lo: 0x83, hi: 0x83}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0xab, hi: 0xab}, - {value: 0x812d, lo: 0xac, hi: 0xac}, - {value: 0x8132, lo: 0xad, hi: 0xb3}, - // Block 0x37, offset 0x13b - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xaa, hi: 0xab}, - // Block 0x38, offset 0x13d - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xa6, hi: 0xa6}, - {value: 0x8104, lo: 0xb2, hi: 0xb3}, - // Block 0x39, offset 0x140 - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - // Block 0x3a, offset 0x142 - {value: 0x0000, lo: 0x0a}, - {value: 0x8132, lo: 0x90, hi: 0x92}, - {value: 0x8101, lo: 0x94, hi: 0x94}, - {value: 0x812d, lo: 0x95, hi: 0x99}, - {value: 0x8132, lo: 0x9a, hi: 0x9b}, - {value: 0x812d, lo: 0x9c, hi: 0x9f}, - {value: 0x8132, lo: 0xa0, hi: 0xa0}, - {value: 0x8101, lo: 0xa2, hi: 0xa8}, - {value: 0x812d, lo: 0xad, hi: 0xad}, - {value: 0x8132, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb8, hi: 0xb9}, - // Block 0x3b, offset 0x14d - {value: 0x0002, lo: 0x0a}, - {value: 0x0043, lo: 0xac, hi: 0xac}, - {value: 0x00d1, lo: 0xad, hi: 0xad}, - {value: 0x0045, lo: 0xae, hi: 0xae}, - {value: 0x0049, lo: 0xb0, hi: 0xb1}, - {value: 0x00e6, lo: 0xb2, hi: 0xb2}, - {value: 0x004f, lo: 0xb3, hi: 0xba}, - {value: 0x005f, lo: 0xbc, hi: 0xbc}, - {value: 0x00ef, lo: 0xbd, hi: 0xbd}, - {value: 0x0061, lo: 0xbe, hi: 0xbe}, - {value: 0x0065, lo: 0xbf, hi: 0xbf}, - // Block 0x3c, offset 0x158 - {value: 0x0000, lo: 0x0d}, - {value: 0x0001, lo: 0x80, hi: 0x8a}, - {value: 0x043b, lo: 0x91, hi: 0x91}, - {value: 0x429b, lo: 0x97, hi: 0x97}, - {value: 0x001d, lo: 0xa4, hi: 0xa4}, - {value: 0x1873, lo: 0xa5, hi: 0xa5}, - {value: 0x1b5c, lo: 0xa6, hi: 0xa6}, - {value: 0x0001, lo: 0xaf, hi: 0xaf}, - {value: 0x2691, lo: 0xb3, hi: 0xb3}, - {value: 0x27fe, lo: 0xb4, hi: 0xb4}, - {value: 0x2698, lo: 0xb6, hi: 0xb6}, - {value: 0x2808, lo: 0xb7, hi: 0xb7}, - {value: 0x186d, lo: 0xbc, hi: 0xbc}, - {value: 0x4269, lo: 0xbe, hi: 0xbe}, - // Block 0x3d, offset 0x166 - {value: 0x0002, lo: 0x0d}, - {value: 0x1933, lo: 0x87, hi: 0x87}, - {value: 0x1930, lo: 0x88, hi: 0x88}, - {value: 0x1870, lo: 0x89, hi: 0x89}, - {value: 0x298e, lo: 0x97, hi: 0x97}, - {value: 0x0001, lo: 0x9f, hi: 0x9f}, - {value: 0x0021, lo: 0xb0, hi: 0xb0}, - {value: 0x0093, lo: 0xb1, hi: 0xb1}, - {value: 0x0029, lo: 0xb4, hi: 0xb9}, - {value: 0x0017, lo: 0xba, hi: 0xba}, - {value: 0x0467, lo: 0xbb, hi: 0xbb}, - {value: 0x003b, lo: 0xbc, hi: 0xbc}, - {value: 0x0011, lo: 0xbd, hi: 0xbe}, - {value: 0x009d, lo: 0xbf, hi: 0xbf}, - // Block 0x3e, offset 0x174 - {value: 0x0002, lo: 0x0f}, - {value: 0x0021, lo: 0x80, hi: 0x89}, - {value: 0x0017, lo: 0x8a, hi: 0x8a}, - {value: 0x0467, lo: 0x8b, hi: 0x8b}, - {value: 0x003b, lo: 0x8c, hi: 0x8c}, - {value: 0x0011, lo: 0x8d, hi: 0x8e}, - {value: 0x0083, lo: 0x90, hi: 0x90}, - {value: 0x008b, lo: 0x91, hi: 0x91}, - {value: 0x009f, lo: 0x92, hi: 0x92}, - {value: 0x00b1, lo: 0x93, hi: 0x93}, - {value: 0x0104, lo: 0x94, hi: 0x94}, - {value: 0x0091, lo: 0x95, hi: 0x95}, - {value: 0x0097, lo: 0x96, hi: 0x99}, - {value: 0x00a1, lo: 0x9a, hi: 0x9a}, - {value: 0x00a7, lo: 0x9b, hi: 0x9c}, - {value: 0x1999, lo: 0xa8, hi: 0xa8}, - // Block 0x3f, offset 0x184 - {value: 0x0000, lo: 0x0d}, - {value: 0x8132, lo: 0x90, hi: 0x91}, - {value: 0x8101, lo: 0x92, hi: 0x93}, - {value: 0x8132, lo: 0x94, hi: 0x97}, - {value: 0x8101, lo: 0x98, hi: 0x9a}, - {value: 0x8132, lo: 0x9b, hi: 0x9c}, - {value: 0x8132, lo: 0xa1, hi: 0xa1}, - {value: 0x8101, lo: 0xa5, hi: 0xa6}, - {value: 0x8132, lo: 0xa7, hi: 0xa7}, - {value: 0x812d, lo: 0xa8, hi: 0xa8}, - {value: 0x8132, lo: 0xa9, hi: 0xa9}, - {value: 0x8101, lo: 0xaa, hi: 0xab}, - {value: 0x812d, lo: 0xac, hi: 0xaf}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - // Block 0x40, offset 0x192 - {value: 0x0007, lo: 0x06}, - {value: 0x2180, lo: 0x89, hi: 0x89}, - {value: 0xa000, lo: 0x90, hi: 0x90}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0xa000, lo: 0x94, hi: 0x94}, - {value: 0x3bb9, lo: 0x9a, hi: 0x9b}, - {value: 0x3bc7, lo: 0xae, hi: 0xae}, - // Block 0x41, offset 0x199 - {value: 0x000e, lo: 0x05}, - {value: 0x3bce, lo: 0x8d, hi: 0x8e}, - {value: 0x3bd5, lo: 0x8f, hi: 0x8f}, - {value: 0xa000, lo: 0x90, hi: 0x90}, - {value: 0xa000, lo: 0x92, hi: 0x92}, - {value: 0xa000, lo: 0x94, hi: 0x94}, - // Block 0x42, offset 0x19f - {value: 0x0173, lo: 0x0e}, - {value: 0xa000, lo: 0x83, hi: 0x83}, - {value: 0x3be3, lo: 0x84, hi: 0x84}, - {value: 0xa000, lo: 0x88, hi: 0x88}, - {value: 0x3bea, lo: 0x89, hi: 0x89}, - {value: 0xa000, lo: 0x8b, hi: 0x8b}, - {value: 0x3bf1, lo: 0x8c, hi: 0x8c}, - {value: 0xa000, lo: 0xa3, hi: 0xa3}, - {value: 0x3bf8, lo: 0xa4, hi: 0xa4}, - {value: 0xa000, lo: 0xa5, hi: 0xa5}, - {value: 0x3bff, lo: 0xa6, hi: 0xa6}, - {value: 0x269f, lo: 0xac, hi: 0xad}, - {value: 0x26a6, lo: 0xaf, hi: 0xaf}, - {value: 0x281c, lo: 0xb0, hi: 0xb0}, - {value: 0xa000, lo: 0xbc, hi: 0xbc}, - // Block 0x43, offset 0x1ae - {value: 0x0007, lo: 0x03}, - {value: 0x3c68, lo: 0xa0, hi: 0xa1}, - {value: 0x3c92, lo: 0xa2, hi: 0xa3}, - {value: 0x3cbc, lo: 0xaa, hi: 0xad}, - // Block 0x44, offset 0x1b2 - {value: 0x0004, lo: 0x01}, - {value: 0x048b, lo: 0xa9, hi: 0xaa}, - // Block 0x45, offset 0x1b4 - {value: 0x0002, lo: 0x03}, - {value: 0x0057, lo: 0x80, hi: 0x8f}, - {value: 0x0083, lo: 0x90, hi: 0xa9}, - {value: 0x0021, lo: 0xaa, hi: 0xaa}, - // Block 0x46, offset 0x1b8 - {value: 0x0000, lo: 0x01}, - {value: 0x299b, lo: 0x8c, hi: 0x8c}, - // Block 0x47, offset 0x1ba - {value: 0x0263, lo: 0x02}, - {value: 0x1b8c, lo: 0xb4, hi: 0xb4}, - {value: 0x192d, lo: 0xb5, hi: 0xb6}, - // Block 0x48, offset 0x1bd - {value: 0x0000, lo: 0x01}, - {value: 0x44dd, lo: 0x9c, hi: 0x9c}, - // Block 0x49, offset 0x1bf - {value: 0x0000, lo: 0x02}, - {value: 0x0095, lo: 0xbc, hi: 0xbc}, - {value: 0x006d, lo: 0xbd, hi: 0xbd}, - // Block 0x4a, offset 0x1c2 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xaf, hi: 0xb1}, - // Block 0x4b, offset 0x1c4 - {value: 0x0000, lo: 0x02}, - {value: 0x047f, lo: 0xaf, hi: 0xaf}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x4c, offset 0x1c7 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xa0, hi: 0xbf}, - // Block 0x4d, offset 0x1c9 - {value: 0x0000, lo: 0x01}, - {value: 0x0dc3, lo: 0x9f, hi: 0x9f}, - // Block 0x4e, offset 0x1cb - {value: 0x0000, lo: 0x01}, - {value: 0x162f, lo: 0xb3, hi: 0xb3}, - // Block 0x4f, offset 0x1cd - {value: 0x0004, lo: 0x0b}, - {value: 0x1597, lo: 0x80, hi: 0x82}, - {value: 0x15af, lo: 0x83, hi: 0x83}, - {value: 0x15c7, lo: 0x84, hi: 0x85}, - {value: 0x15d7, lo: 0x86, hi: 0x89}, - {value: 0x15eb, lo: 0x8a, hi: 0x8c}, - {value: 0x15ff, lo: 0x8d, hi: 0x8d}, - {value: 0x1607, lo: 0x8e, hi: 0x8e}, - {value: 0x160f, lo: 0x8f, hi: 0x90}, - {value: 0x161b, lo: 0x91, hi: 0x93}, - {value: 0x162b, lo: 0x94, hi: 0x94}, - {value: 0x1633, lo: 0x95, hi: 0x95}, - // Block 0x50, offset 0x1d9 - {value: 0x0004, lo: 0x09}, - {value: 0x0001, lo: 0x80, hi: 0x80}, - {value: 0x812c, lo: 0xaa, hi: 0xaa}, - {value: 0x8131, lo: 0xab, hi: 0xab}, - {value: 0x8133, lo: 0xac, hi: 0xac}, - {value: 0x812e, lo: 0xad, hi: 0xad}, - {value: 0x812f, lo: 0xae, hi: 0xae}, - {value: 0x812f, lo: 0xaf, hi: 0xaf}, - {value: 0x04b3, lo: 0xb6, hi: 0xb6}, - {value: 0x0887, lo: 0xb8, hi: 0xba}, - // Block 0x51, offset 0x1e3 - {value: 0x0006, lo: 0x09}, - {value: 0x0313, lo: 0xb1, hi: 0xb1}, - {value: 0x0317, lo: 0xb2, hi: 0xb2}, - {value: 0x4a3b, lo: 0xb3, hi: 0xb3}, - {value: 0x031b, lo: 0xb4, hi: 0xb4}, - {value: 0x4a41, lo: 0xb5, hi: 0xb6}, - {value: 0x031f, lo: 0xb7, hi: 0xb7}, - {value: 0x0323, lo: 0xb8, hi: 0xb8}, - {value: 0x0327, lo: 0xb9, hi: 0xb9}, - {value: 0x4a4d, lo: 0xba, hi: 0xbf}, - // Block 0x52, offset 0x1ed - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0xaf, hi: 0xaf}, - {value: 0x8132, lo: 0xb4, hi: 0xbd}, - // Block 0x53, offset 0x1f0 - {value: 0x0000, lo: 0x03}, - {value: 0x020f, lo: 0x9c, hi: 0x9c}, - {value: 0x0212, lo: 0x9d, hi: 0x9d}, - {value: 0x8132, lo: 0x9e, hi: 0x9f}, - // Block 0x54, offset 0x1f4 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb0, hi: 0xb1}, - // Block 0x55, offset 0x1f6 - {value: 0x0000, lo: 0x01}, - {value: 0x163b, lo: 0xb0, hi: 0xb0}, - // Block 0x56, offset 0x1f8 - {value: 0x000c, lo: 0x01}, - {value: 0x00d7, lo: 0xb8, hi: 0xb9}, - // Block 0x57, offset 0x1fa - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x86, hi: 0x86}, - // Block 0x58, offset 0x1fc - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x84, hi: 0x84}, - {value: 0x8132, lo: 0xa0, hi: 0xb1}, - // Block 0x59, offset 0x1ff - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xab, hi: 0xad}, - // Block 0x5a, offset 0x201 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x93, hi: 0x93}, - // Block 0x5b, offset 0x203 - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0xb3, hi: 0xb3}, - // Block 0x5c, offset 0x205 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x80, hi: 0x80}, - // Block 0x5d, offset 0x207 - {value: 0x0000, lo: 0x05}, - {value: 0x8132, lo: 0xb0, hi: 0xb0}, - {value: 0x8132, lo: 0xb2, hi: 0xb3}, - {value: 0x812d, lo: 0xb4, hi: 0xb4}, - {value: 0x8132, lo: 0xb7, hi: 0xb8}, - {value: 0x8132, lo: 0xbe, hi: 0xbf}, - // Block 0x5e, offset 0x20d - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x81, hi: 0x81}, - {value: 0x8104, lo: 0xb6, hi: 0xb6}, - // Block 0x5f, offset 0x210 - {value: 0x0008, lo: 0x03}, - {value: 0x1637, lo: 0x9c, hi: 0x9d}, - {value: 0x0125, lo: 0x9e, hi: 0x9e}, - {value: 0x1643, lo: 0x9f, hi: 0x9f}, - // Block 0x60, offset 0x214 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xad, hi: 0xad}, - // Block 0x61, offset 0x216 - {value: 0x0000, lo: 0x06}, - {value: 0xe500, lo: 0x80, hi: 0x80}, - {value: 0xc600, lo: 0x81, hi: 0x9b}, - {value: 0xe500, lo: 0x9c, hi: 0x9c}, - {value: 0xc600, lo: 0x9d, hi: 0xb7}, - {value: 0xe500, lo: 0xb8, hi: 0xb8}, - {value: 0xc600, lo: 0xb9, hi: 0xbf}, - // Block 0x62, offset 0x21d - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x93}, - {value: 0xe500, lo: 0x94, hi: 0x94}, - {value: 0xc600, lo: 0x95, hi: 0xaf}, - {value: 0xe500, lo: 0xb0, hi: 0xb0}, - {value: 0xc600, lo: 0xb1, hi: 0xbf}, - // Block 0x63, offset 0x223 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x8b}, - {value: 0xe500, lo: 0x8c, hi: 0x8c}, - {value: 0xc600, lo: 0x8d, hi: 0xa7}, - {value: 0xe500, lo: 0xa8, hi: 0xa8}, - {value: 0xc600, lo: 0xa9, hi: 0xbf}, - // Block 0x64, offset 0x229 - {value: 0x0000, lo: 0x07}, - {value: 0xc600, lo: 0x80, hi: 0x83}, - {value: 0xe500, lo: 0x84, hi: 0x84}, - {value: 0xc600, lo: 0x85, hi: 0x9f}, - {value: 0xe500, lo: 0xa0, hi: 0xa0}, - {value: 0xc600, lo: 0xa1, hi: 0xbb}, - {value: 0xe500, lo: 0xbc, hi: 0xbc}, - {value: 0xc600, lo: 0xbd, hi: 0xbf}, - // Block 0x65, offset 0x231 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x97}, - {value: 0xe500, lo: 0x98, hi: 0x98}, - {value: 0xc600, lo: 0x99, hi: 0xb3}, - {value: 0xe500, lo: 0xb4, hi: 0xb4}, - {value: 0xc600, lo: 0xb5, hi: 0xbf}, - // Block 0x66, offset 0x237 - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x8f}, - {value: 0xe500, lo: 0x90, hi: 0x90}, - {value: 0xc600, lo: 0x91, hi: 0xab}, - {value: 0xe500, lo: 0xac, hi: 0xac}, - {value: 0xc600, lo: 0xad, hi: 0xbf}, - // Block 0x67, offset 0x23d - {value: 0x0000, lo: 0x05}, - {value: 0xc600, lo: 0x80, hi: 0x87}, - {value: 0xe500, lo: 0x88, hi: 0x88}, - {value: 0xc600, lo: 0x89, hi: 0xa3}, - {value: 0xe500, lo: 0xa4, hi: 0xa4}, - {value: 0xc600, lo: 0xa5, hi: 0xbf}, - // Block 0x68, offset 0x243 - {value: 0x0000, lo: 0x03}, - {value: 0xc600, lo: 0x80, hi: 0x87}, - {value: 0xe500, lo: 0x88, hi: 0x88}, - {value: 0xc600, lo: 0x89, hi: 0xa3}, - // Block 0x69, offset 0x247 - {value: 0x0002, lo: 0x01}, - {value: 0x0003, lo: 0x81, hi: 0xbf}, - // Block 0x6a, offset 0x249 - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xbd, hi: 0xbd}, - // Block 0x6b, offset 0x24b - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0xa0, hi: 0xa0}, - // Block 0x6c, offset 0x24d - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb6, hi: 0xba}, - // Block 0x6d, offset 0x24f - {value: 0x002c, lo: 0x05}, - {value: 0x812d, lo: 0x8d, hi: 0x8d}, - {value: 0x8132, lo: 0x8f, hi: 0x8f}, - {value: 0x8132, lo: 0xb8, hi: 0xb8}, - {value: 0x8101, lo: 0xb9, hi: 0xba}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x6e, offset 0x255 - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0xa5, hi: 0xa5}, - {value: 0x812d, lo: 0xa6, hi: 0xa6}, - // Block 0x6f, offset 0x258 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xa4, hi: 0xa7}, - // Block 0x70, offset 0x25a - {value: 0x0000, lo: 0x05}, - {value: 0x812d, lo: 0x86, hi: 0x87}, - {value: 0x8132, lo: 0x88, hi: 0x8a}, - {value: 0x812d, lo: 0x8b, hi: 0x8b}, - {value: 0x8132, lo: 0x8c, hi: 0x8c}, - {value: 0x812d, lo: 0x8d, hi: 0x90}, - // Block 0x71, offset 0x260 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x86, hi: 0x86}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x72, offset 0x263 - {value: 0x17fe, lo: 0x07}, - {value: 0xa000, lo: 0x99, hi: 0x99}, - {value: 0x4238, lo: 0x9a, hi: 0x9a}, - {value: 0xa000, lo: 0x9b, hi: 0x9b}, - {value: 0x4242, lo: 0x9c, hi: 0x9c}, - {value: 0xa000, lo: 0xa5, hi: 0xa5}, - {value: 0x424c, lo: 0xab, hi: 0xab}, - {value: 0x8104, lo: 0xb9, hi: 0xba}, - // Block 0x73, offset 0x26b - {value: 0x0000, lo: 0x06}, - {value: 0x8132, lo: 0x80, hi: 0x82}, - {value: 0x9900, lo: 0xa7, hi: 0xa7}, - {value: 0x2d7e, lo: 0xae, hi: 0xae}, - {value: 0x2d88, lo: 0xaf, hi: 0xaf}, - {value: 0xa000, lo: 0xb1, hi: 0xb2}, - {value: 0x8104, lo: 0xb3, hi: 0xb4}, - // Block 0x74, offset 0x272 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x80, hi: 0x80}, - {value: 0x8102, lo: 0x8a, hi: 0x8a}, - // Block 0x75, offset 0x275 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb5, hi: 0xb5}, - {value: 0x8102, lo: 0xb6, hi: 0xb6}, - // Block 0x76, offset 0x278 - {value: 0x0002, lo: 0x01}, - {value: 0x8102, lo: 0xa9, hi: 0xaa}, - // Block 0x77, offset 0x27a - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0xbb, hi: 0xbc}, - {value: 0x9900, lo: 0xbe, hi: 0xbe}, - // Block 0x78, offset 0x27d - {value: 0x0000, lo: 0x07}, - {value: 0xa000, lo: 0x87, hi: 0x87}, - {value: 0x2d92, lo: 0x8b, hi: 0x8b}, - {value: 0x2d9c, lo: 0x8c, hi: 0x8c}, - {value: 0x8104, lo: 0x8d, hi: 0x8d}, - {value: 0x9900, lo: 0x97, hi: 0x97}, - {value: 0x8132, lo: 0xa6, hi: 0xac}, - {value: 0x8132, lo: 0xb0, hi: 0xb4}, - // Block 0x79, offset 0x285 - {value: 0x0000, lo: 0x03}, - {value: 0x8104, lo: 0x82, hi: 0x82}, - {value: 0x8102, lo: 0x86, hi: 0x86}, - {value: 0x8132, lo: 0x9e, hi: 0x9e}, - // Block 0x7a, offset 0x289 - {value: 0x6b5a, lo: 0x06}, - {value: 0x9900, lo: 0xb0, hi: 0xb0}, - {value: 0xa000, lo: 0xb9, hi: 0xb9}, - {value: 0x9900, lo: 0xba, hi: 0xba}, - {value: 0x2db0, lo: 0xbb, hi: 0xbb}, - {value: 0x2da6, lo: 0xbc, hi: 0xbd}, - {value: 0x2dba, lo: 0xbe, hi: 0xbe}, - // Block 0x7b, offset 0x290 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0x82, hi: 0x82}, - {value: 0x8102, lo: 0x83, hi: 0x83}, - // Block 0x7c, offset 0x293 - {value: 0x0000, lo: 0x05}, - {value: 0x9900, lo: 0xaf, hi: 0xaf}, - {value: 0xa000, lo: 0xb8, hi: 0xb9}, - {value: 0x2dc4, lo: 0xba, hi: 0xba}, - {value: 0x2dce, lo: 0xbb, hi: 0xbb}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x7d, offset 0x299 - {value: 0x0000, lo: 0x01}, - {value: 0x8102, lo: 0x80, hi: 0x80}, - // Block 0x7e, offset 0x29b - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xbf, hi: 0xbf}, - // Block 0x7f, offset 0x29d - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb6, hi: 0xb6}, - {value: 0x8102, lo: 0xb7, hi: 0xb7}, - // Block 0x80, offset 0x2a0 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xab, hi: 0xab}, - // Block 0x81, offset 0x2a2 - {value: 0x0000, lo: 0x02}, - {value: 0x8104, lo: 0xb9, hi: 0xb9}, - {value: 0x8102, lo: 0xba, hi: 0xba}, - // Block 0x82, offset 0x2a5 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0xb4, hi: 0xb4}, - // Block 0x83, offset 0x2a7 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x87, hi: 0x87}, - // Block 0x84, offset 0x2a9 - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x99, hi: 0x99}, - // Block 0x85, offset 0x2ab - {value: 0x0000, lo: 0x02}, - {value: 0x8102, lo: 0x82, hi: 0x82}, - {value: 0x8104, lo: 0x84, hi: 0x85}, - // Block 0x86, offset 0x2ae - {value: 0x0000, lo: 0x01}, - {value: 0x8104, lo: 0x97, hi: 0x97}, - // Block 0x87, offset 0x2b0 - {value: 0x0000, lo: 0x01}, - {value: 0x8101, lo: 0xb0, hi: 0xb4}, - // Block 0x88, offset 0x2b2 - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0xb0, hi: 0xb6}, - // Block 0x89, offset 0x2b4 - {value: 0x0000, lo: 0x01}, - {value: 0x8101, lo: 0x9e, hi: 0x9e}, - // Block 0x8a, offset 0x2b6 - {value: 0x0000, lo: 0x0c}, - {value: 0x45cc, lo: 0x9e, hi: 0x9e}, - {value: 0x45d6, lo: 0x9f, hi: 0x9f}, - {value: 0x460a, lo: 0xa0, hi: 0xa0}, - {value: 0x4618, lo: 0xa1, hi: 0xa1}, - {value: 0x4626, lo: 0xa2, hi: 0xa2}, - {value: 0x4634, lo: 0xa3, hi: 0xa3}, - {value: 0x4642, lo: 0xa4, hi: 0xa4}, - {value: 0x812b, lo: 0xa5, hi: 0xa6}, - {value: 0x8101, lo: 0xa7, hi: 0xa9}, - {value: 0x8130, lo: 0xad, hi: 0xad}, - {value: 0x812b, lo: 0xae, hi: 0xb2}, - {value: 0x812d, lo: 0xbb, hi: 0xbf}, - // Block 0x8b, offset 0x2c3 - {value: 0x0000, lo: 0x09}, - {value: 0x812d, lo: 0x80, hi: 0x82}, - {value: 0x8132, lo: 0x85, hi: 0x89}, - {value: 0x812d, lo: 0x8a, hi: 0x8b}, - {value: 0x8132, lo: 0xaa, hi: 0xad}, - {value: 0x45e0, lo: 0xbb, hi: 0xbb}, - {value: 0x45ea, lo: 0xbc, hi: 0xbc}, - {value: 0x4650, lo: 0xbd, hi: 0xbd}, - {value: 0x466c, lo: 0xbe, hi: 0xbe}, - {value: 0x465e, lo: 0xbf, hi: 0xbf}, - // Block 0x8c, offset 0x2cd - {value: 0x0000, lo: 0x01}, - {value: 0x467a, lo: 0x80, hi: 0x80}, - // Block 0x8d, offset 0x2cf - {value: 0x0000, lo: 0x01}, - {value: 0x8132, lo: 0x82, hi: 0x84}, - // Block 0x8e, offset 0x2d1 - {value: 0x0002, lo: 0x03}, - {value: 0x0043, lo: 0x80, hi: 0x99}, - {value: 0x0083, lo: 0x9a, hi: 0xb3}, - {value: 0x0043, lo: 0xb4, hi: 0xbf}, - // Block 0x8f, offset 0x2d5 - {value: 0x0002, lo: 0x04}, - {value: 0x005b, lo: 0x80, hi: 0x8d}, - {value: 0x0083, lo: 0x8e, hi: 0x94}, - {value: 0x0093, lo: 0x96, hi: 0xa7}, - {value: 0x0043, lo: 0xa8, hi: 0xbf}, - // Block 0x90, offset 0x2da - {value: 0x0002, lo: 0x0b}, - {value: 0x0073, lo: 0x80, hi: 0x81}, - {value: 0x0083, lo: 0x82, hi: 0x9b}, - {value: 0x0043, lo: 0x9c, hi: 0x9c}, - {value: 0x0047, lo: 0x9e, hi: 0x9f}, - {value: 0x004f, lo: 0xa2, hi: 0xa2}, - {value: 0x0055, lo: 0xa5, hi: 0xa6}, - {value: 0x005d, lo: 0xa9, hi: 0xac}, - {value: 0x0067, lo: 0xae, hi: 0xb5}, - {value: 0x0083, lo: 0xb6, hi: 0xb9}, - {value: 0x008d, lo: 0xbb, hi: 0xbb}, - {value: 0x0091, lo: 0xbd, hi: 0xbf}, - // Block 0x91, offset 0x2e6 - {value: 0x0002, lo: 0x04}, - {value: 0x0097, lo: 0x80, hi: 0x83}, - {value: 0x00a1, lo: 0x85, hi: 0x8f}, - {value: 0x0043, lo: 0x90, hi: 0xa9}, - {value: 0x0083, lo: 0xaa, hi: 0xbf}, - // Block 0x92, offset 0x2eb - {value: 0x0002, lo: 0x08}, - {value: 0x00af, lo: 0x80, hi: 0x83}, - {value: 0x0043, lo: 0x84, hi: 0x85}, - {value: 0x0049, lo: 0x87, hi: 0x8a}, - {value: 0x0055, lo: 0x8d, hi: 0x94}, - {value: 0x0067, lo: 0x96, hi: 0x9c}, - {value: 0x0083, lo: 0x9e, hi: 0xb7}, - {value: 0x0043, lo: 0xb8, hi: 0xb9}, - {value: 0x0049, lo: 0xbb, hi: 0xbe}, - // Block 0x93, offset 0x2f4 - {value: 0x0002, lo: 0x05}, - {value: 0x0053, lo: 0x80, hi: 0x84}, - {value: 0x005f, lo: 0x86, hi: 0x86}, - {value: 0x0067, lo: 0x8a, hi: 0x90}, - {value: 0x0083, lo: 0x92, hi: 0xab}, - {value: 0x0043, lo: 0xac, hi: 0xbf}, - // Block 0x94, offset 0x2fa - {value: 0x0002, lo: 0x04}, - {value: 0x006b, lo: 0x80, hi: 0x85}, - {value: 0x0083, lo: 0x86, hi: 0x9f}, - {value: 0x0043, lo: 0xa0, hi: 0xb9}, - {value: 0x0083, lo: 0xba, hi: 0xbf}, - // Block 0x95, offset 0x2ff - {value: 0x0002, lo: 0x03}, - {value: 0x008f, lo: 0x80, hi: 0x93}, - {value: 0x0043, lo: 0x94, hi: 0xad}, - {value: 0x0083, lo: 0xae, hi: 0xbf}, - // Block 0x96, offset 0x303 - {value: 0x0002, lo: 0x04}, - {value: 0x00a7, lo: 0x80, hi: 0x87}, - {value: 0x0043, lo: 0x88, hi: 0xa1}, - {value: 0x0083, lo: 0xa2, hi: 0xbb}, - {value: 0x0043, lo: 0xbc, hi: 0xbf}, - // Block 0x97, offset 0x308 - {value: 0x0002, lo: 0x03}, - {value: 0x004b, lo: 0x80, hi: 0x95}, - {value: 0x0083, lo: 0x96, hi: 0xaf}, - {value: 0x0043, lo: 0xb0, hi: 0xbf}, - // Block 0x98, offset 0x30c - {value: 0x0003, lo: 0x0f}, - {value: 0x01b8, lo: 0x80, hi: 0x80}, - {value: 0x045f, lo: 0x81, hi: 0x81}, - {value: 0x01bb, lo: 0x82, hi: 0x9a}, - {value: 0x045b, lo: 0x9b, hi: 0x9b}, - {value: 0x01c7, lo: 0x9c, hi: 0x9c}, - {value: 0x01d0, lo: 0x9d, hi: 0x9d}, - {value: 0x01d6, lo: 0x9e, hi: 0x9e}, - {value: 0x01fa, lo: 0x9f, hi: 0x9f}, - {value: 0x01eb, lo: 0xa0, hi: 0xa0}, - {value: 0x01e8, lo: 0xa1, hi: 0xa1}, - {value: 0x0173, lo: 0xa2, hi: 0xb2}, - {value: 0x0188, lo: 0xb3, hi: 0xb3}, - {value: 0x01a6, lo: 0xb4, hi: 0xba}, - {value: 0x045f, lo: 0xbb, hi: 0xbb}, - {value: 0x01bb, lo: 0xbc, hi: 0xbf}, - // Block 0x99, offset 0x31c - {value: 0x0003, lo: 0x0d}, - {value: 0x01c7, lo: 0x80, hi: 0x94}, - {value: 0x045b, lo: 0x95, hi: 0x95}, - {value: 0x01c7, lo: 0x96, hi: 0x96}, - {value: 0x01d0, lo: 0x97, hi: 0x97}, - {value: 0x01d6, lo: 0x98, hi: 0x98}, - {value: 0x01fa, lo: 0x99, hi: 0x99}, - {value: 0x01eb, lo: 0x9a, hi: 0x9a}, - {value: 0x01e8, lo: 0x9b, hi: 0x9b}, - {value: 0x0173, lo: 0x9c, hi: 0xac}, - {value: 0x0188, lo: 0xad, hi: 0xad}, - {value: 0x01a6, lo: 0xae, hi: 0xb4}, - {value: 0x045f, lo: 0xb5, hi: 0xb5}, - {value: 0x01bb, lo: 0xb6, hi: 0xbf}, - // Block 0x9a, offset 0x32a - {value: 0x0003, lo: 0x0d}, - {value: 0x01d9, lo: 0x80, hi: 0x8e}, - {value: 0x045b, lo: 0x8f, hi: 0x8f}, - {value: 0x01c7, lo: 0x90, hi: 0x90}, - {value: 0x01d0, lo: 0x91, hi: 0x91}, - {value: 0x01d6, lo: 0x92, hi: 0x92}, - {value: 0x01fa, lo: 0x93, hi: 0x93}, - {value: 0x01eb, lo: 0x94, hi: 0x94}, - {value: 0x01e8, lo: 0x95, hi: 0x95}, - {value: 0x0173, lo: 0x96, hi: 0xa6}, - {value: 0x0188, lo: 0xa7, hi: 0xa7}, - {value: 0x01a6, lo: 0xa8, hi: 0xae}, - {value: 0x045f, lo: 0xaf, hi: 0xaf}, - {value: 0x01bb, lo: 0xb0, hi: 0xbf}, - // Block 0x9b, offset 0x338 - {value: 0x0003, lo: 0x0d}, - {value: 0x01eb, lo: 0x80, hi: 0x88}, - {value: 0x045b, lo: 0x89, hi: 0x89}, - {value: 0x01c7, lo: 0x8a, hi: 0x8a}, - {value: 0x01d0, lo: 0x8b, hi: 0x8b}, - {value: 0x01d6, lo: 0x8c, hi: 0x8c}, - {value: 0x01fa, lo: 0x8d, hi: 0x8d}, - {value: 0x01eb, lo: 0x8e, hi: 0x8e}, - {value: 0x01e8, lo: 0x8f, hi: 0x8f}, - {value: 0x0173, lo: 0x90, hi: 0xa0}, - {value: 0x0188, lo: 0xa1, hi: 0xa1}, - {value: 0x01a6, lo: 0xa2, hi: 0xa8}, - {value: 0x045f, lo: 0xa9, hi: 0xa9}, - {value: 0x01bb, lo: 0xaa, hi: 0xbf}, - // Block 0x9c, offset 0x346 - {value: 0x0000, lo: 0x05}, - {value: 0x8132, lo: 0x80, hi: 0x86}, - {value: 0x8132, lo: 0x88, hi: 0x98}, - {value: 0x8132, lo: 0x9b, hi: 0xa1}, - {value: 0x8132, lo: 0xa3, hi: 0xa4}, - {value: 0x8132, lo: 0xa6, hi: 0xaa}, - // Block 0x9d, offset 0x34c - {value: 0x0000, lo: 0x01}, - {value: 0x812d, lo: 0x90, hi: 0x96}, - // Block 0x9e, offset 0x34e - {value: 0x0000, lo: 0x02}, - {value: 0x8132, lo: 0x84, hi: 0x89}, - {value: 0x8102, lo: 0x8a, hi: 0x8a}, - // Block 0x9f, offset 0x351 - {value: 0x0002, lo: 0x09}, - {value: 0x0063, lo: 0x80, hi: 0x89}, - {value: 0x1951, lo: 0x8a, hi: 0x8a}, - {value: 0x1981, lo: 0x8b, hi: 0x8b}, - {value: 0x199c, lo: 0x8c, hi: 0x8c}, - {value: 0x19a2, lo: 0x8d, hi: 0x8d}, - {value: 0x1bc0, lo: 0x8e, hi: 0x8e}, - {value: 0x19ae, lo: 0x8f, hi: 0x8f}, - {value: 0x197b, lo: 0xaa, hi: 0xaa}, - {value: 0x197e, lo: 0xab, hi: 0xab}, - // Block 0xa0, offset 0x35b - {value: 0x0000, lo: 0x01}, - {value: 0x193f, lo: 0x90, hi: 0x90}, - // Block 0xa1, offset 0x35d - {value: 0x0028, lo: 0x09}, - {value: 0x2862, lo: 0x80, hi: 0x80}, - {value: 0x2826, lo: 0x81, hi: 0x81}, - {value: 0x2830, lo: 0x82, hi: 0x82}, - {value: 0x2844, lo: 0x83, hi: 0x84}, - {value: 0x284e, lo: 0x85, hi: 0x86}, - {value: 0x283a, lo: 0x87, hi: 0x87}, - {value: 0x2858, lo: 0x88, hi: 0x88}, - {value: 0x0b6f, lo: 0x90, hi: 0x90}, - {value: 0x08e7, lo: 0x91, hi: 0x91}, -} - -// recompMap: 7520 bytes (entries only) -var recompMap map[uint32]rune -var recompMapOnce sync.Once - -const recompMapPacked = "" + - "\x00A\x03\x00\x00\x00\x00\xc0" + // 0x00410300: 0x000000C0 - "\x00A\x03\x01\x00\x00\x00\xc1" + // 0x00410301: 0x000000C1 - "\x00A\x03\x02\x00\x00\x00\xc2" + // 0x00410302: 0x000000C2 - "\x00A\x03\x03\x00\x00\x00\xc3" + // 0x00410303: 0x000000C3 - "\x00A\x03\b\x00\x00\x00\xc4" + // 0x00410308: 0x000000C4 - "\x00A\x03\n\x00\x00\x00\xc5" + // 0x0041030A: 0x000000C5 - "\x00C\x03'\x00\x00\x00\xc7" + // 0x00430327: 0x000000C7 - "\x00E\x03\x00\x00\x00\x00\xc8" + // 0x00450300: 0x000000C8 - "\x00E\x03\x01\x00\x00\x00\xc9" + // 0x00450301: 0x000000C9 - "\x00E\x03\x02\x00\x00\x00\xca" + // 0x00450302: 0x000000CA - "\x00E\x03\b\x00\x00\x00\xcb" + // 0x00450308: 0x000000CB - "\x00I\x03\x00\x00\x00\x00\xcc" + // 0x00490300: 0x000000CC - "\x00I\x03\x01\x00\x00\x00\xcd" + // 0x00490301: 0x000000CD - "\x00I\x03\x02\x00\x00\x00\xce" + // 0x00490302: 0x000000CE - "\x00I\x03\b\x00\x00\x00\xcf" + // 0x00490308: 0x000000CF - "\x00N\x03\x03\x00\x00\x00\xd1" + // 0x004E0303: 0x000000D1 - "\x00O\x03\x00\x00\x00\x00\xd2" + // 0x004F0300: 0x000000D2 - "\x00O\x03\x01\x00\x00\x00\xd3" + // 0x004F0301: 0x000000D3 - "\x00O\x03\x02\x00\x00\x00\xd4" + // 0x004F0302: 0x000000D4 - "\x00O\x03\x03\x00\x00\x00\xd5" + // 0x004F0303: 0x000000D5 - "\x00O\x03\b\x00\x00\x00\xd6" + // 0x004F0308: 0x000000D6 - "\x00U\x03\x00\x00\x00\x00\xd9" + // 0x00550300: 0x000000D9 - "\x00U\x03\x01\x00\x00\x00\xda" + // 0x00550301: 0x000000DA - "\x00U\x03\x02\x00\x00\x00\xdb" + // 0x00550302: 0x000000DB - "\x00U\x03\b\x00\x00\x00\xdc" + // 0x00550308: 0x000000DC - "\x00Y\x03\x01\x00\x00\x00\xdd" + // 0x00590301: 0x000000DD - "\x00a\x03\x00\x00\x00\x00\xe0" + // 0x00610300: 0x000000E0 - "\x00a\x03\x01\x00\x00\x00\xe1" + // 0x00610301: 0x000000E1 - "\x00a\x03\x02\x00\x00\x00\xe2" + // 0x00610302: 0x000000E2 - "\x00a\x03\x03\x00\x00\x00\xe3" + // 0x00610303: 0x000000E3 - "\x00a\x03\b\x00\x00\x00\xe4" + // 0x00610308: 0x000000E4 - "\x00a\x03\n\x00\x00\x00\xe5" + // 0x0061030A: 0x000000E5 - "\x00c\x03'\x00\x00\x00\xe7" + // 0x00630327: 0x000000E7 - "\x00e\x03\x00\x00\x00\x00\xe8" + // 0x00650300: 0x000000E8 - "\x00e\x03\x01\x00\x00\x00\xe9" + // 0x00650301: 0x000000E9 - "\x00e\x03\x02\x00\x00\x00\xea" + // 0x00650302: 0x000000EA - "\x00e\x03\b\x00\x00\x00\xeb" + // 0x00650308: 0x000000EB - "\x00i\x03\x00\x00\x00\x00\xec" + // 0x00690300: 0x000000EC - "\x00i\x03\x01\x00\x00\x00\xed" + // 0x00690301: 0x000000ED - "\x00i\x03\x02\x00\x00\x00\xee" + // 0x00690302: 0x000000EE - "\x00i\x03\b\x00\x00\x00\xef" + // 0x00690308: 0x000000EF - "\x00n\x03\x03\x00\x00\x00\xf1" + // 0x006E0303: 0x000000F1 - "\x00o\x03\x00\x00\x00\x00\xf2" + // 0x006F0300: 0x000000F2 - "\x00o\x03\x01\x00\x00\x00\xf3" + // 0x006F0301: 0x000000F3 - "\x00o\x03\x02\x00\x00\x00\xf4" + // 0x006F0302: 0x000000F4 - "\x00o\x03\x03\x00\x00\x00\xf5" + // 0x006F0303: 0x000000F5 - "\x00o\x03\b\x00\x00\x00\xf6" + // 0x006F0308: 0x000000F6 - "\x00u\x03\x00\x00\x00\x00\xf9" + // 0x00750300: 0x000000F9 - "\x00u\x03\x01\x00\x00\x00\xfa" + // 0x00750301: 0x000000FA - "\x00u\x03\x02\x00\x00\x00\xfb" + // 0x00750302: 0x000000FB - "\x00u\x03\b\x00\x00\x00\xfc" + // 0x00750308: 0x000000FC - "\x00y\x03\x01\x00\x00\x00\xfd" + // 0x00790301: 0x000000FD - "\x00y\x03\b\x00\x00\x00\xff" + // 0x00790308: 0x000000FF - "\x00A\x03\x04\x00\x00\x01\x00" + // 0x00410304: 0x00000100 - "\x00a\x03\x04\x00\x00\x01\x01" + // 0x00610304: 0x00000101 - "\x00A\x03\x06\x00\x00\x01\x02" + // 0x00410306: 0x00000102 - "\x00a\x03\x06\x00\x00\x01\x03" + // 0x00610306: 0x00000103 - "\x00A\x03(\x00\x00\x01\x04" + // 0x00410328: 0x00000104 - "\x00a\x03(\x00\x00\x01\x05" + // 0x00610328: 0x00000105 - "\x00C\x03\x01\x00\x00\x01\x06" + // 0x00430301: 0x00000106 - "\x00c\x03\x01\x00\x00\x01\a" + // 0x00630301: 0x00000107 - "\x00C\x03\x02\x00\x00\x01\b" + // 0x00430302: 0x00000108 - "\x00c\x03\x02\x00\x00\x01\t" + // 0x00630302: 0x00000109 - "\x00C\x03\a\x00\x00\x01\n" + // 0x00430307: 0x0000010A - "\x00c\x03\a\x00\x00\x01\v" + // 0x00630307: 0x0000010B - "\x00C\x03\f\x00\x00\x01\f" + // 0x0043030C: 0x0000010C - "\x00c\x03\f\x00\x00\x01\r" + // 0x0063030C: 0x0000010D - "\x00D\x03\f\x00\x00\x01\x0e" + // 0x0044030C: 0x0000010E - "\x00d\x03\f\x00\x00\x01\x0f" + // 0x0064030C: 0x0000010F - "\x00E\x03\x04\x00\x00\x01\x12" + // 0x00450304: 0x00000112 - "\x00e\x03\x04\x00\x00\x01\x13" + // 0x00650304: 0x00000113 - "\x00E\x03\x06\x00\x00\x01\x14" + // 0x00450306: 0x00000114 - "\x00e\x03\x06\x00\x00\x01\x15" + // 0x00650306: 0x00000115 - "\x00E\x03\a\x00\x00\x01\x16" + // 0x00450307: 0x00000116 - "\x00e\x03\a\x00\x00\x01\x17" + // 0x00650307: 0x00000117 - "\x00E\x03(\x00\x00\x01\x18" + // 0x00450328: 0x00000118 - "\x00e\x03(\x00\x00\x01\x19" + // 0x00650328: 0x00000119 - "\x00E\x03\f\x00\x00\x01\x1a" + // 0x0045030C: 0x0000011A - "\x00e\x03\f\x00\x00\x01\x1b" + // 0x0065030C: 0x0000011B - "\x00G\x03\x02\x00\x00\x01\x1c" + // 0x00470302: 0x0000011C - "\x00g\x03\x02\x00\x00\x01\x1d" + // 0x00670302: 0x0000011D - "\x00G\x03\x06\x00\x00\x01\x1e" + // 0x00470306: 0x0000011E - "\x00g\x03\x06\x00\x00\x01\x1f" + // 0x00670306: 0x0000011F - "\x00G\x03\a\x00\x00\x01 " + // 0x00470307: 0x00000120 - "\x00g\x03\a\x00\x00\x01!" + // 0x00670307: 0x00000121 - "\x00G\x03'\x00\x00\x01\"" + // 0x00470327: 0x00000122 - "\x00g\x03'\x00\x00\x01#" + // 0x00670327: 0x00000123 - "\x00H\x03\x02\x00\x00\x01$" + // 0x00480302: 0x00000124 - "\x00h\x03\x02\x00\x00\x01%" + // 0x00680302: 0x00000125 - "\x00I\x03\x03\x00\x00\x01(" + // 0x00490303: 0x00000128 - "\x00i\x03\x03\x00\x00\x01)" + // 0x00690303: 0x00000129 - "\x00I\x03\x04\x00\x00\x01*" + // 0x00490304: 0x0000012A - "\x00i\x03\x04\x00\x00\x01+" + // 0x00690304: 0x0000012B - "\x00I\x03\x06\x00\x00\x01," + // 0x00490306: 0x0000012C - "\x00i\x03\x06\x00\x00\x01-" + // 0x00690306: 0x0000012D - "\x00I\x03(\x00\x00\x01." + // 0x00490328: 0x0000012E - "\x00i\x03(\x00\x00\x01/" + // 0x00690328: 0x0000012F - "\x00I\x03\a\x00\x00\x010" + // 0x00490307: 0x00000130 - "\x00J\x03\x02\x00\x00\x014" + // 0x004A0302: 0x00000134 - "\x00j\x03\x02\x00\x00\x015" + // 0x006A0302: 0x00000135 - "\x00K\x03'\x00\x00\x016" + // 0x004B0327: 0x00000136 - "\x00k\x03'\x00\x00\x017" + // 0x006B0327: 0x00000137 - "\x00L\x03\x01\x00\x00\x019" + // 0x004C0301: 0x00000139 - "\x00l\x03\x01\x00\x00\x01:" + // 0x006C0301: 0x0000013A - "\x00L\x03'\x00\x00\x01;" + // 0x004C0327: 0x0000013B - "\x00l\x03'\x00\x00\x01<" + // 0x006C0327: 0x0000013C - "\x00L\x03\f\x00\x00\x01=" + // 0x004C030C: 0x0000013D - "\x00l\x03\f\x00\x00\x01>" + // 0x006C030C: 0x0000013E - "\x00N\x03\x01\x00\x00\x01C" + // 0x004E0301: 0x00000143 - "\x00n\x03\x01\x00\x00\x01D" + // 0x006E0301: 0x00000144 - "\x00N\x03'\x00\x00\x01E" + // 0x004E0327: 0x00000145 - "\x00n\x03'\x00\x00\x01F" + // 0x006E0327: 0x00000146 - "\x00N\x03\f\x00\x00\x01G" + // 0x004E030C: 0x00000147 - "\x00n\x03\f\x00\x00\x01H" + // 0x006E030C: 0x00000148 - "\x00O\x03\x04\x00\x00\x01L" + // 0x004F0304: 0x0000014C - "\x00o\x03\x04\x00\x00\x01M" + // 0x006F0304: 0x0000014D - "\x00O\x03\x06\x00\x00\x01N" + // 0x004F0306: 0x0000014E - "\x00o\x03\x06\x00\x00\x01O" + // 0x006F0306: 0x0000014F - "\x00O\x03\v\x00\x00\x01P" + // 0x004F030B: 0x00000150 - "\x00o\x03\v\x00\x00\x01Q" + // 0x006F030B: 0x00000151 - "\x00R\x03\x01\x00\x00\x01T" + // 0x00520301: 0x00000154 - "\x00r\x03\x01\x00\x00\x01U" + // 0x00720301: 0x00000155 - "\x00R\x03'\x00\x00\x01V" + // 0x00520327: 0x00000156 - "\x00r\x03'\x00\x00\x01W" + // 0x00720327: 0x00000157 - "\x00R\x03\f\x00\x00\x01X" + // 0x0052030C: 0x00000158 - "\x00r\x03\f\x00\x00\x01Y" + // 0x0072030C: 0x00000159 - "\x00S\x03\x01\x00\x00\x01Z" + // 0x00530301: 0x0000015A - "\x00s\x03\x01\x00\x00\x01[" + // 0x00730301: 0x0000015B - "\x00S\x03\x02\x00\x00\x01\\" + // 0x00530302: 0x0000015C - "\x00s\x03\x02\x00\x00\x01]" + // 0x00730302: 0x0000015D - "\x00S\x03'\x00\x00\x01^" + // 0x00530327: 0x0000015E - "\x00s\x03'\x00\x00\x01_" + // 0x00730327: 0x0000015F - "\x00S\x03\f\x00\x00\x01`" + // 0x0053030C: 0x00000160 - "\x00s\x03\f\x00\x00\x01a" + // 0x0073030C: 0x00000161 - "\x00T\x03'\x00\x00\x01b" + // 0x00540327: 0x00000162 - "\x00t\x03'\x00\x00\x01c" + // 0x00740327: 0x00000163 - "\x00T\x03\f\x00\x00\x01d" + // 0x0054030C: 0x00000164 - "\x00t\x03\f\x00\x00\x01e" + // 0x0074030C: 0x00000165 - "\x00U\x03\x03\x00\x00\x01h" + // 0x00550303: 0x00000168 - "\x00u\x03\x03\x00\x00\x01i" + // 0x00750303: 0x00000169 - "\x00U\x03\x04\x00\x00\x01j" + // 0x00550304: 0x0000016A - "\x00u\x03\x04\x00\x00\x01k" + // 0x00750304: 0x0000016B - "\x00U\x03\x06\x00\x00\x01l" + // 0x00550306: 0x0000016C - "\x00u\x03\x06\x00\x00\x01m" + // 0x00750306: 0x0000016D - "\x00U\x03\n\x00\x00\x01n" + // 0x0055030A: 0x0000016E - "\x00u\x03\n\x00\x00\x01o" + // 0x0075030A: 0x0000016F - "\x00U\x03\v\x00\x00\x01p" + // 0x0055030B: 0x00000170 - "\x00u\x03\v\x00\x00\x01q" + // 0x0075030B: 0x00000171 - "\x00U\x03(\x00\x00\x01r" + // 0x00550328: 0x00000172 - "\x00u\x03(\x00\x00\x01s" + // 0x00750328: 0x00000173 - "\x00W\x03\x02\x00\x00\x01t" + // 0x00570302: 0x00000174 - "\x00w\x03\x02\x00\x00\x01u" + // 0x00770302: 0x00000175 - "\x00Y\x03\x02\x00\x00\x01v" + // 0x00590302: 0x00000176 - "\x00y\x03\x02\x00\x00\x01w" + // 0x00790302: 0x00000177 - "\x00Y\x03\b\x00\x00\x01x" + // 0x00590308: 0x00000178 - "\x00Z\x03\x01\x00\x00\x01y" + // 0x005A0301: 0x00000179 - "\x00z\x03\x01\x00\x00\x01z" + // 0x007A0301: 0x0000017A - "\x00Z\x03\a\x00\x00\x01{" + // 0x005A0307: 0x0000017B - "\x00z\x03\a\x00\x00\x01|" + // 0x007A0307: 0x0000017C - "\x00Z\x03\f\x00\x00\x01}" + // 0x005A030C: 0x0000017D - "\x00z\x03\f\x00\x00\x01~" + // 0x007A030C: 0x0000017E - "\x00O\x03\x1b\x00\x00\x01\xa0" + // 0x004F031B: 0x000001A0 - "\x00o\x03\x1b\x00\x00\x01\xa1" + // 0x006F031B: 0x000001A1 - "\x00U\x03\x1b\x00\x00\x01\xaf" + // 0x0055031B: 0x000001AF - "\x00u\x03\x1b\x00\x00\x01\xb0" + // 0x0075031B: 0x000001B0 - "\x00A\x03\f\x00\x00\x01\xcd" + // 0x0041030C: 0x000001CD - "\x00a\x03\f\x00\x00\x01\xce" + // 0x0061030C: 0x000001CE - "\x00I\x03\f\x00\x00\x01\xcf" + // 0x0049030C: 0x000001CF - "\x00i\x03\f\x00\x00\x01\xd0" + // 0x0069030C: 0x000001D0 - "\x00O\x03\f\x00\x00\x01\xd1" + // 0x004F030C: 0x000001D1 - "\x00o\x03\f\x00\x00\x01\xd2" + // 0x006F030C: 0x000001D2 - "\x00U\x03\f\x00\x00\x01\xd3" + // 0x0055030C: 0x000001D3 - "\x00u\x03\f\x00\x00\x01\xd4" + // 0x0075030C: 0x000001D4 - "\x00\xdc\x03\x04\x00\x00\x01\xd5" + // 0x00DC0304: 0x000001D5 - "\x00\xfc\x03\x04\x00\x00\x01\xd6" + // 0x00FC0304: 0x000001D6 - "\x00\xdc\x03\x01\x00\x00\x01\xd7" + // 0x00DC0301: 0x000001D7 - "\x00\xfc\x03\x01\x00\x00\x01\xd8" + // 0x00FC0301: 0x000001D8 - "\x00\xdc\x03\f\x00\x00\x01\xd9" + // 0x00DC030C: 0x000001D9 - "\x00\xfc\x03\f\x00\x00\x01\xda" + // 0x00FC030C: 0x000001DA - "\x00\xdc\x03\x00\x00\x00\x01\xdb" + // 0x00DC0300: 0x000001DB - "\x00\xfc\x03\x00\x00\x00\x01\xdc" + // 0x00FC0300: 0x000001DC - "\x00\xc4\x03\x04\x00\x00\x01\xde" + // 0x00C40304: 0x000001DE - "\x00\xe4\x03\x04\x00\x00\x01\xdf" + // 0x00E40304: 0x000001DF - "\x02&\x03\x04\x00\x00\x01\xe0" + // 0x02260304: 0x000001E0 - "\x02'\x03\x04\x00\x00\x01\xe1" + // 0x02270304: 0x000001E1 - "\x00\xc6\x03\x04\x00\x00\x01\xe2" + // 0x00C60304: 0x000001E2 - "\x00\xe6\x03\x04\x00\x00\x01\xe3" + // 0x00E60304: 0x000001E3 - "\x00G\x03\f\x00\x00\x01\xe6" + // 0x0047030C: 0x000001E6 - "\x00g\x03\f\x00\x00\x01\xe7" + // 0x0067030C: 0x000001E7 - "\x00K\x03\f\x00\x00\x01\xe8" + // 0x004B030C: 0x000001E8 - "\x00k\x03\f\x00\x00\x01\xe9" + // 0x006B030C: 0x000001E9 - "\x00O\x03(\x00\x00\x01\xea" + // 0x004F0328: 0x000001EA - "\x00o\x03(\x00\x00\x01\xeb" + // 0x006F0328: 0x000001EB - "\x01\xea\x03\x04\x00\x00\x01\xec" + // 0x01EA0304: 0x000001EC - "\x01\xeb\x03\x04\x00\x00\x01\xed" + // 0x01EB0304: 0x000001ED - "\x01\xb7\x03\f\x00\x00\x01\xee" + // 0x01B7030C: 0x000001EE - "\x02\x92\x03\f\x00\x00\x01\xef" + // 0x0292030C: 0x000001EF - "\x00j\x03\f\x00\x00\x01\xf0" + // 0x006A030C: 0x000001F0 - "\x00G\x03\x01\x00\x00\x01\xf4" + // 0x00470301: 0x000001F4 - "\x00g\x03\x01\x00\x00\x01\xf5" + // 0x00670301: 0x000001F5 - "\x00N\x03\x00\x00\x00\x01\xf8" + // 0x004E0300: 0x000001F8 - "\x00n\x03\x00\x00\x00\x01\xf9" + // 0x006E0300: 0x000001F9 - "\x00\xc5\x03\x01\x00\x00\x01\xfa" + // 0x00C50301: 0x000001FA - "\x00\xe5\x03\x01\x00\x00\x01\xfb" + // 0x00E50301: 0x000001FB - "\x00\xc6\x03\x01\x00\x00\x01\xfc" + // 0x00C60301: 0x000001FC - "\x00\xe6\x03\x01\x00\x00\x01\xfd" + // 0x00E60301: 0x000001FD - "\x00\xd8\x03\x01\x00\x00\x01\xfe" + // 0x00D80301: 0x000001FE - "\x00\xf8\x03\x01\x00\x00\x01\xff" + // 0x00F80301: 0x000001FF - "\x00A\x03\x0f\x00\x00\x02\x00" + // 0x0041030F: 0x00000200 - "\x00a\x03\x0f\x00\x00\x02\x01" + // 0x0061030F: 0x00000201 - "\x00A\x03\x11\x00\x00\x02\x02" + // 0x00410311: 0x00000202 - "\x00a\x03\x11\x00\x00\x02\x03" + // 0x00610311: 0x00000203 - "\x00E\x03\x0f\x00\x00\x02\x04" + // 0x0045030F: 0x00000204 - "\x00e\x03\x0f\x00\x00\x02\x05" + // 0x0065030F: 0x00000205 - "\x00E\x03\x11\x00\x00\x02\x06" + // 0x00450311: 0x00000206 - "\x00e\x03\x11\x00\x00\x02\a" + // 0x00650311: 0x00000207 - "\x00I\x03\x0f\x00\x00\x02\b" + // 0x0049030F: 0x00000208 - "\x00i\x03\x0f\x00\x00\x02\t" + // 0x0069030F: 0x00000209 - "\x00I\x03\x11\x00\x00\x02\n" + // 0x00490311: 0x0000020A - "\x00i\x03\x11\x00\x00\x02\v" + // 0x00690311: 0x0000020B - "\x00O\x03\x0f\x00\x00\x02\f" + // 0x004F030F: 0x0000020C - "\x00o\x03\x0f\x00\x00\x02\r" + // 0x006F030F: 0x0000020D - "\x00O\x03\x11\x00\x00\x02\x0e" + // 0x004F0311: 0x0000020E - "\x00o\x03\x11\x00\x00\x02\x0f" + // 0x006F0311: 0x0000020F - "\x00R\x03\x0f\x00\x00\x02\x10" + // 0x0052030F: 0x00000210 - "\x00r\x03\x0f\x00\x00\x02\x11" + // 0x0072030F: 0x00000211 - "\x00R\x03\x11\x00\x00\x02\x12" + // 0x00520311: 0x00000212 - "\x00r\x03\x11\x00\x00\x02\x13" + // 0x00720311: 0x00000213 - "\x00U\x03\x0f\x00\x00\x02\x14" + // 0x0055030F: 0x00000214 - "\x00u\x03\x0f\x00\x00\x02\x15" + // 0x0075030F: 0x00000215 - "\x00U\x03\x11\x00\x00\x02\x16" + // 0x00550311: 0x00000216 - "\x00u\x03\x11\x00\x00\x02\x17" + // 0x00750311: 0x00000217 - "\x00S\x03&\x00\x00\x02\x18" + // 0x00530326: 0x00000218 - "\x00s\x03&\x00\x00\x02\x19" + // 0x00730326: 0x00000219 - "\x00T\x03&\x00\x00\x02\x1a" + // 0x00540326: 0x0000021A - "\x00t\x03&\x00\x00\x02\x1b" + // 0x00740326: 0x0000021B - "\x00H\x03\f\x00\x00\x02\x1e" + // 0x0048030C: 0x0000021E - "\x00h\x03\f\x00\x00\x02\x1f" + // 0x0068030C: 0x0000021F - "\x00A\x03\a\x00\x00\x02&" + // 0x00410307: 0x00000226 - "\x00a\x03\a\x00\x00\x02'" + // 0x00610307: 0x00000227 - "\x00E\x03'\x00\x00\x02(" + // 0x00450327: 0x00000228 - "\x00e\x03'\x00\x00\x02)" + // 0x00650327: 0x00000229 - "\x00\xd6\x03\x04\x00\x00\x02*" + // 0x00D60304: 0x0000022A - "\x00\xf6\x03\x04\x00\x00\x02+" + // 0x00F60304: 0x0000022B - "\x00\xd5\x03\x04\x00\x00\x02," + // 0x00D50304: 0x0000022C - "\x00\xf5\x03\x04\x00\x00\x02-" + // 0x00F50304: 0x0000022D - "\x00O\x03\a\x00\x00\x02." + // 0x004F0307: 0x0000022E - "\x00o\x03\a\x00\x00\x02/" + // 0x006F0307: 0x0000022F - "\x02.\x03\x04\x00\x00\x020" + // 0x022E0304: 0x00000230 - "\x02/\x03\x04\x00\x00\x021" + // 0x022F0304: 0x00000231 - "\x00Y\x03\x04\x00\x00\x022" + // 0x00590304: 0x00000232 - "\x00y\x03\x04\x00\x00\x023" + // 0x00790304: 0x00000233 - "\x00\xa8\x03\x01\x00\x00\x03\x85" + // 0x00A80301: 0x00000385 - "\x03\x91\x03\x01\x00\x00\x03\x86" + // 0x03910301: 0x00000386 - "\x03\x95\x03\x01\x00\x00\x03\x88" + // 0x03950301: 0x00000388 - "\x03\x97\x03\x01\x00\x00\x03\x89" + // 0x03970301: 0x00000389 - "\x03\x99\x03\x01\x00\x00\x03\x8a" + // 0x03990301: 0x0000038A - "\x03\x9f\x03\x01\x00\x00\x03\x8c" + // 0x039F0301: 0x0000038C - "\x03\xa5\x03\x01\x00\x00\x03\x8e" + // 0x03A50301: 0x0000038E - "\x03\xa9\x03\x01\x00\x00\x03\x8f" + // 0x03A90301: 0x0000038F - "\x03\xca\x03\x01\x00\x00\x03\x90" + // 0x03CA0301: 0x00000390 - "\x03\x99\x03\b\x00\x00\x03\xaa" + // 0x03990308: 0x000003AA - "\x03\xa5\x03\b\x00\x00\x03\xab" + // 0x03A50308: 0x000003AB - "\x03\xb1\x03\x01\x00\x00\x03\xac" + // 0x03B10301: 0x000003AC - "\x03\xb5\x03\x01\x00\x00\x03\xad" + // 0x03B50301: 0x000003AD - "\x03\xb7\x03\x01\x00\x00\x03\xae" + // 0x03B70301: 0x000003AE - "\x03\xb9\x03\x01\x00\x00\x03\xaf" + // 0x03B90301: 0x000003AF - "\x03\xcb\x03\x01\x00\x00\x03\xb0" + // 0x03CB0301: 0x000003B0 - "\x03\xb9\x03\b\x00\x00\x03\xca" + // 0x03B90308: 0x000003CA - "\x03\xc5\x03\b\x00\x00\x03\xcb" + // 0x03C50308: 0x000003CB - "\x03\xbf\x03\x01\x00\x00\x03\xcc" + // 0x03BF0301: 0x000003CC - "\x03\xc5\x03\x01\x00\x00\x03\xcd" + // 0x03C50301: 0x000003CD - "\x03\xc9\x03\x01\x00\x00\x03\xce" + // 0x03C90301: 0x000003CE - "\x03\xd2\x03\x01\x00\x00\x03\xd3" + // 0x03D20301: 0x000003D3 - "\x03\xd2\x03\b\x00\x00\x03\xd4" + // 0x03D20308: 0x000003D4 - "\x04\x15\x03\x00\x00\x00\x04\x00" + // 0x04150300: 0x00000400 - "\x04\x15\x03\b\x00\x00\x04\x01" + // 0x04150308: 0x00000401 - "\x04\x13\x03\x01\x00\x00\x04\x03" + // 0x04130301: 0x00000403 - "\x04\x06\x03\b\x00\x00\x04\a" + // 0x04060308: 0x00000407 - "\x04\x1a\x03\x01\x00\x00\x04\f" + // 0x041A0301: 0x0000040C - "\x04\x18\x03\x00\x00\x00\x04\r" + // 0x04180300: 0x0000040D - "\x04#\x03\x06\x00\x00\x04\x0e" + // 0x04230306: 0x0000040E - "\x04\x18\x03\x06\x00\x00\x04\x19" + // 0x04180306: 0x00000419 - "\x048\x03\x06\x00\x00\x049" + // 0x04380306: 0x00000439 - "\x045\x03\x00\x00\x00\x04P" + // 0x04350300: 0x00000450 - "\x045\x03\b\x00\x00\x04Q" + // 0x04350308: 0x00000451 - "\x043\x03\x01\x00\x00\x04S" + // 0x04330301: 0x00000453 - "\x04V\x03\b\x00\x00\x04W" + // 0x04560308: 0x00000457 - "\x04:\x03\x01\x00\x00\x04\\" + // 0x043A0301: 0x0000045C - "\x048\x03\x00\x00\x00\x04]" + // 0x04380300: 0x0000045D - "\x04C\x03\x06\x00\x00\x04^" + // 0x04430306: 0x0000045E - "\x04t\x03\x0f\x00\x00\x04v" + // 0x0474030F: 0x00000476 - "\x04u\x03\x0f\x00\x00\x04w" + // 0x0475030F: 0x00000477 - "\x04\x16\x03\x06\x00\x00\x04\xc1" + // 0x04160306: 0x000004C1 - "\x046\x03\x06\x00\x00\x04\xc2" + // 0x04360306: 0x000004C2 - "\x04\x10\x03\x06\x00\x00\x04\xd0" + // 0x04100306: 0x000004D0 - "\x040\x03\x06\x00\x00\x04\xd1" + // 0x04300306: 0x000004D1 - "\x04\x10\x03\b\x00\x00\x04\xd2" + // 0x04100308: 0x000004D2 - "\x040\x03\b\x00\x00\x04\xd3" + // 0x04300308: 0x000004D3 - "\x04\x15\x03\x06\x00\x00\x04\xd6" + // 0x04150306: 0x000004D6 - "\x045\x03\x06\x00\x00\x04\xd7" + // 0x04350306: 0x000004D7 - "\x04\xd8\x03\b\x00\x00\x04\xda" + // 0x04D80308: 0x000004DA - "\x04\xd9\x03\b\x00\x00\x04\xdb" + // 0x04D90308: 0x000004DB - "\x04\x16\x03\b\x00\x00\x04\xdc" + // 0x04160308: 0x000004DC - "\x046\x03\b\x00\x00\x04\xdd" + // 0x04360308: 0x000004DD - "\x04\x17\x03\b\x00\x00\x04\xde" + // 0x04170308: 0x000004DE - "\x047\x03\b\x00\x00\x04\xdf" + // 0x04370308: 0x000004DF - "\x04\x18\x03\x04\x00\x00\x04\xe2" + // 0x04180304: 0x000004E2 - "\x048\x03\x04\x00\x00\x04\xe3" + // 0x04380304: 0x000004E3 - "\x04\x18\x03\b\x00\x00\x04\xe4" + // 0x04180308: 0x000004E4 - "\x048\x03\b\x00\x00\x04\xe5" + // 0x04380308: 0x000004E5 - "\x04\x1e\x03\b\x00\x00\x04\xe6" + // 0x041E0308: 0x000004E6 - "\x04>\x03\b\x00\x00\x04\xe7" + // 0x043E0308: 0x000004E7 - "\x04\xe8\x03\b\x00\x00\x04\xea" + // 0x04E80308: 0x000004EA - "\x04\xe9\x03\b\x00\x00\x04\xeb" + // 0x04E90308: 0x000004EB - "\x04-\x03\b\x00\x00\x04\xec" + // 0x042D0308: 0x000004EC - "\x04M\x03\b\x00\x00\x04\xed" + // 0x044D0308: 0x000004ED - "\x04#\x03\x04\x00\x00\x04\xee" + // 0x04230304: 0x000004EE - "\x04C\x03\x04\x00\x00\x04\xef" + // 0x04430304: 0x000004EF - "\x04#\x03\b\x00\x00\x04\xf0" + // 0x04230308: 0x000004F0 - "\x04C\x03\b\x00\x00\x04\xf1" + // 0x04430308: 0x000004F1 - "\x04#\x03\v\x00\x00\x04\xf2" + // 0x0423030B: 0x000004F2 - "\x04C\x03\v\x00\x00\x04\xf3" + // 0x0443030B: 0x000004F3 - "\x04'\x03\b\x00\x00\x04\xf4" + // 0x04270308: 0x000004F4 - "\x04G\x03\b\x00\x00\x04\xf5" + // 0x04470308: 0x000004F5 - "\x04+\x03\b\x00\x00\x04\xf8" + // 0x042B0308: 0x000004F8 - "\x04K\x03\b\x00\x00\x04\xf9" + // 0x044B0308: 0x000004F9 - "\x06'\x06S\x00\x00\x06\"" + // 0x06270653: 0x00000622 - "\x06'\x06T\x00\x00\x06#" + // 0x06270654: 0x00000623 - "\x06H\x06T\x00\x00\x06$" + // 0x06480654: 0x00000624 - "\x06'\x06U\x00\x00\x06%" + // 0x06270655: 0x00000625 - "\x06J\x06T\x00\x00\x06&" + // 0x064A0654: 0x00000626 - "\x06\xd5\x06T\x00\x00\x06\xc0" + // 0x06D50654: 0x000006C0 - "\x06\xc1\x06T\x00\x00\x06\xc2" + // 0x06C10654: 0x000006C2 - "\x06\xd2\x06T\x00\x00\x06\xd3" + // 0x06D20654: 0x000006D3 - "\t(\t<\x00\x00\t)" + // 0x0928093C: 0x00000929 - "\t0\t<\x00\x00\t1" + // 0x0930093C: 0x00000931 - "\t3\t<\x00\x00\t4" + // 0x0933093C: 0x00000934 - "\t\xc7\t\xbe\x00\x00\t\xcb" + // 0x09C709BE: 0x000009CB - "\t\xc7\t\xd7\x00\x00\t\xcc" + // 0x09C709D7: 0x000009CC - "\vG\vV\x00\x00\vH" + // 0x0B470B56: 0x00000B48 - "\vG\v>\x00\x00\vK" + // 0x0B470B3E: 0x00000B4B - "\vG\vW\x00\x00\vL" + // 0x0B470B57: 0x00000B4C - "\v\x92\v\xd7\x00\x00\v\x94" + // 0x0B920BD7: 0x00000B94 - "\v\xc6\v\xbe\x00\x00\v\xca" + // 0x0BC60BBE: 0x00000BCA - "\v\xc7\v\xbe\x00\x00\v\xcb" + // 0x0BC70BBE: 0x00000BCB - "\v\xc6\v\xd7\x00\x00\v\xcc" + // 0x0BC60BD7: 0x00000BCC - "\fF\fV\x00\x00\fH" + // 0x0C460C56: 0x00000C48 - "\f\xbf\f\xd5\x00\x00\f\xc0" + // 0x0CBF0CD5: 0x00000CC0 - "\f\xc6\f\xd5\x00\x00\f\xc7" + // 0x0CC60CD5: 0x00000CC7 - "\f\xc6\f\xd6\x00\x00\f\xc8" + // 0x0CC60CD6: 0x00000CC8 - "\f\xc6\f\xc2\x00\x00\f\xca" + // 0x0CC60CC2: 0x00000CCA - "\f\xca\f\xd5\x00\x00\f\xcb" + // 0x0CCA0CD5: 0x00000CCB - "\rF\r>\x00\x00\rJ" + // 0x0D460D3E: 0x00000D4A - "\rG\r>\x00\x00\rK" + // 0x0D470D3E: 0x00000D4B - "\rF\rW\x00\x00\rL" + // 0x0D460D57: 0x00000D4C - "\r\xd9\r\xca\x00\x00\r\xda" + // 0x0DD90DCA: 0x00000DDA - "\r\xd9\r\xcf\x00\x00\r\xdc" + // 0x0DD90DCF: 0x00000DDC - "\r\xdc\r\xca\x00\x00\r\xdd" + // 0x0DDC0DCA: 0x00000DDD - "\r\xd9\r\xdf\x00\x00\r\xde" + // 0x0DD90DDF: 0x00000DDE - "\x10%\x10.\x00\x00\x10&" + // 0x1025102E: 0x00001026 - "\x1b\x05\x1b5\x00\x00\x1b\x06" + // 0x1B051B35: 0x00001B06 - "\x1b\a\x1b5\x00\x00\x1b\b" + // 0x1B071B35: 0x00001B08 - "\x1b\t\x1b5\x00\x00\x1b\n" + // 0x1B091B35: 0x00001B0A - "\x1b\v\x1b5\x00\x00\x1b\f" + // 0x1B0B1B35: 0x00001B0C - "\x1b\r\x1b5\x00\x00\x1b\x0e" + // 0x1B0D1B35: 0x00001B0E - "\x1b\x11\x1b5\x00\x00\x1b\x12" + // 0x1B111B35: 0x00001B12 - "\x1b:\x1b5\x00\x00\x1b;" + // 0x1B3A1B35: 0x00001B3B - "\x1b<\x1b5\x00\x00\x1b=" + // 0x1B3C1B35: 0x00001B3D - "\x1b>\x1b5\x00\x00\x1b@" + // 0x1B3E1B35: 0x00001B40 - "\x1b?\x1b5\x00\x00\x1bA" + // 0x1B3F1B35: 0x00001B41 - "\x1bB\x1b5\x00\x00\x1bC" + // 0x1B421B35: 0x00001B43 - "\x00A\x03%\x00\x00\x1e\x00" + // 0x00410325: 0x00001E00 - "\x00a\x03%\x00\x00\x1e\x01" + // 0x00610325: 0x00001E01 - "\x00B\x03\a\x00\x00\x1e\x02" + // 0x00420307: 0x00001E02 - "\x00b\x03\a\x00\x00\x1e\x03" + // 0x00620307: 0x00001E03 - "\x00B\x03#\x00\x00\x1e\x04" + // 0x00420323: 0x00001E04 - "\x00b\x03#\x00\x00\x1e\x05" + // 0x00620323: 0x00001E05 - "\x00B\x031\x00\x00\x1e\x06" + // 0x00420331: 0x00001E06 - "\x00b\x031\x00\x00\x1e\a" + // 0x00620331: 0x00001E07 - "\x00\xc7\x03\x01\x00\x00\x1e\b" + // 0x00C70301: 0x00001E08 - "\x00\xe7\x03\x01\x00\x00\x1e\t" + // 0x00E70301: 0x00001E09 - "\x00D\x03\a\x00\x00\x1e\n" + // 0x00440307: 0x00001E0A - "\x00d\x03\a\x00\x00\x1e\v" + // 0x00640307: 0x00001E0B - "\x00D\x03#\x00\x00\x1e\f" + // 0x00440323: 0x00001E0C - "\x00d\x03#\x00\x00\x1e\r" + // 0x00640323: 0x00001E0D - "\x00D\x031\x00\x00\x1e\x0e" + // 0x00440331: 0x00001E0E - "\x00d\x031\x00\x00\x1e\x0f" + // 0x00640331: 0x00001E0F - "\x00D\x03'\x00\x00\x1e\x10" + // 0x00440327: 0x00001E10 - "\x00d\x03'\x00\x00\x1e\x11" + // 0x00640327: 0x00001E11 - "\x00D\x03-\x00\x00\x1e\x12" + // 0x0044032D: 0x00001E12 - "\x00d\x03-\x00\x00\x1e\x13" + // 0x0064032D: 0x00001E13 - "\x01\x12\x03\x00\x00\x00\x1e\x14" + // 0x01120300: 0x00001E14 - "\x01\x13\x03\x00\x00\x00\x1e\x15" + // 0x01130300: 0x00001E15 - "\x01\x12\x03\x01\x00\x00\x1e\x16" + // 0x01120301: 0x00001E16 - "\x01\x13\x03\x01\x00\x00\x1e\x17" + // 0x01130301: 0x00001E17 - "\x00E\x03-\x00\x00\x1e\x18" + // 0x0045032D: 0x00001E18 - "\x00e\x03-\x00\x00\x1e\x19" + // 0x0065032D: 0x00001E19 - "\x00E\x030\x00\x00\x1e\x1a" + // 0x00450330: 0x00001E1A - "\x00e\x030\x00\x00\x1e\x1b" + // 0x00650330: 0x00001E1B - "\x02(\x03\x06\x00\x00\x1e\x1c" + // 0x02280306: 0x00001E1C - "\x02)\x03\x06\x00\x00\x1e\x1d" + // 0x02290306: 0x00001E1D - "\x00F\x03\a\x00\x00\x1e\x1e" + // 0x00460307: 0x00001E1E - "\x00f\x03\a\x00\x00\x1e\x1f" + // 0x00660307: 0x00001E1F - "\x00G\x03\x04\x00\x00\x1e " + // 0x00470304: 0x00001E20 - "\x00g\x03\x04\x00\x00\x1e!" + // 0x00670304: 0x00001E21 - "\x00H\x03\a\x00\x00\x1e\"" + // 0x00480307: 0x00001E22 - "\x00h\x03\a\x00\x00\x1e#" + // 0x00680307: 0x00001E23 - "\x00H\x03#\x00\x00\x1e$" + // 0x00480323: 0x00001E24 - "\x00h\x03#\x00\x00\x1e%" + // 0x00680323: 0x00001E25 - "\x00H\x03\b\x00\x00\x1e&" + // 0x00480308: 0x00001E26 - "\x00h\x03\b\x00\x00\x1e'" + // 0x00680308: 0x00001E27 - "\x00H\x03'\x00\x00\x1e(" + // 0x00480327: 0x00001E28 - "\x00h\x03'\x00\x00\x1e)" + // 0x00680327: 0x00001E29 - "\x00H\x03.\x00\x00\x1e*" + // 0x0048032E: 0x00001E2A - "\x00h\x03.\x00\x00\x1e+" + // 0x0068032E: 0x00001E2B - "\x00I\x030\x00\x00\x1e," + // 0x00490330: 0x00001E2C - "\x00i\x030\x00\x00\x1e-" + // 0x00690330: 0x00001E2D - "\x00\xcf\x03\x01\x00\x00\x1e." + // 0x00CF0301: 0x00001E2E - "\x00\xef\x03\x01\x00\x00\x1e/" + // 0x00EF0301: 0x00001E2F - "\x00K\x03\x01\x00\x00\x1e0" + // 0x004B0301: 0x00001E30 - "\x00k\x03\x01\x00\x00\x1e1" + // 0x006B0301: 0x00001E31 - "\x00K\x03#\x00\x00\x1e2" + // 0x004B0323: 0x00001E32 - "\x00k\x03#\x00\x00\x1e3" + // 0x006B0323: 0x00001E33 - "\x00K\x031\x00\x00\x1e4" + // 0x004B0331: 0x00001E34 - "\x00k\x031\x00\x00\x1e5" + // 0x006B0331: 0x00001E35 - "\x00L\x03#\x00\x00\x1e6" + // 0x004C0323: 0x00001E36 - "\x00l\x03#\x00\x00\x1e7" + // 0x006C0323: 0x00001E37 - "\x1e6\x03\x04\x00\x00\x1e8" + // 0x1E360304: 0x00001E38 - "\x1e7\x03\x04\x00\x00\x1e9" + // 0x1E370304: 0x00001E39 - "\x00L\x031\x00\x00\x1e:" + // 0x004C0331: 0x00001E3A - "\x00l\x031\x00\x00\x1e;" + // 0x006C0331: 0x00001E3B - "\x00L\x03-\x00\x00\x1e<" + // 0x004C032D: 0x00001E3C - "\x00l\x03-\x00\x00\x1e=" + // 0x006C032D: 0x00001E3D - "\x00M\x03\x01\x00\x00\x1e>" + // 0x004D0301: 0x00001E3E - "\x00m\x03\x01\x00\x00\x1e?" + // 0x006D0301: 0x00001E3F - "\x00M\x03\a\x00\x00\x1e@" + // 0x004D0307: 0x00001E40 - "\x00m\x03\a\x00\x00\x1eA" + // 0x006D0307: 0x00001E41 - "\x00M\x03#\x00\x00\x1eB" + // 0x004D0323: 0x00001E42 - "\x00m\x03#\x00\x00\x1eC" + // 0x006D0323: 0x00001E43 - "\x00N\x03\a\x00\x00\x1eD" + // 0x004E0307: 0x00001E44 - "\x00n\x03\a\x00\x00\x1eE" + // 0x006E0307: 0x00001E45 - "\x00N\x03#\x00\x00\x1eF" + // 0x004E0323: 0x00001E46 - "\x00n\x03#\x00\x00\x1eG" + // 0x006E0323: 0x00001E47 - "\x00N\x031\x00\x00\x1eH" + // 0x004E0331: 0x00001E48 - "\x00n\x031\x00\x00\x1eI" + // 0x006E0331: 0x00001E49 - "\x00N\x03-\x00\x00\x1eJ" + // 0x004E032D: 0x00001E4A - "\x00n\x03-\x00\x00\x1eK" + // 0x006E032D: 0x00001E4B - "\x00\xd5\x03\x01\x00\x00\x1eL" + // 0x00D50301: 0x00001E4C - "\x00\xf5\x03\x01\x00\x00\x1eM" + // 0x00F50301: 0x00001E4D - "\x00\xd5\x03\b\x00\x00\x1eN" + // 0x00D50308: 0x00001E4E - "\x00\xf5\x03\b\x00\x00\x1eO" + // 0x00F50308: 0x00001E4F - "\x01L\x03\x00\x00\x00\x1eP" + // 0x014C0300: 0x00001E50 - "\x01M\x03\x00\x00\x00\x1eQ" + // 0x014D0300: 0x00001E51 - "\x01L\x03\x01\x00\x00\x1eR" + // 0x014C0301: 0x00001E52 - "\x01M\x03\x01\x00\x00\x1eS" + // 0x014D0301: 0x00001E53 - "\x00P\x03\x01\x00\x00\x1eT" + // 0x00500301: 0x00001E54 - "\x00p\x03\x01\x00\x00\x1eU" + // 0x00700301: 0x00001E55 - "\x00P\x03\a\x00\x00\x1eV" + // 0x00500307: 0x00001E56 - "\x00p\x03\a\x00\x00\x1eW" + // 0x00700307: 0x00001E57 - "\x00R\x03\a\x00\x00\x1eX" + // 0x00520307: 0x00001E58 - "\x00r\x03\a\x00\x00\x1eY" + // 0x00720307: 0x00001E59 - "\x00R\x03#\x00\x00\x1eZ" + // 0x00520323: 0x00001E5A - "\x00r\x03#\x00\x00\x1e[" + // 0x00720323: 0x00001E5B - "\x1eZ\x03\x04\x00\x00\x1e\\" + // 0x1E5A0304: 0x00001E5C - "\x1e[\x03\x04\x00\x00\x1e]" + // 0x1E5B0304: 0x00001E5D - "\x00R\x031\x00\x00\x1e^" + // 0x00520331: 0x00001E5E - "\x00r\x031\x00\x00\x1e_" + // 0x00720331: 0x00001E5F - "\x00S\x03\a\x00\x00\x1e`" + // 0x00530307: 0x00001E60 - "\x00s\x03\a\x00\x00\x1ea" + // 0x00730307: 0x00001E61 - "\x00S\x03#\x00\x00\x1eb" + // 0x00530323: 0x00001E62 - "\x00s\x03#\x00\x00\x1ec" + // 0x00730323: 0x00001E63 - "\x01Z\x03\a\x00\x00\x1ed" + // 0x015A0307: 0x00001E64 - "\x01[\x03\a\x00\x00\x1ee" + // 0x015B0307: 0x00001E65 - "\x01`\x03\a\x00\x00\x1ef" + // 0x01600307: 0x00001E66 - "\x01a\x03\a\x00\x00\x1eg" + // 0x01610307: 0x00001E67 - "\x1eb\x03\a\x00\x00\x1eh" + // 0x1E620307: 0x00001E68 - "\x1ec\x03\a\x00\x00\x1ei" + // 0x1E630307: 0x00001E69 - "\x00T\x03\a\x00\x00\x1ej" + // 0x00540307: 0x00001E6A - "\x00t\x03\a\x00\x00\x1ek" + // 0x00740307: 0x00001E6B - "\x00T\x03#\x00\x00\x1el" + // 0x00540323: 0x00001E6C - "\x00t\x03#\x00\x00\x1em" + // 0x00740323: 0x00001E6D - "\x00T\x031\x00\x00\x1en" + // 0x00540331: 0x00001E6E - "\x00t\x031\x00\x00\x1eo" + // 0x00740331: 0x00001E6F - "\x00T\x03-\x00\x00\x1ep" + // 0x0054032D: 0x00001E70 - "\x00t\x03-\x00\x00\x1eq" + // 0x0074032D: 0x00001E71 - "\x00U\x03$\x00\x00\x1er" + // 0x00550324: 0x00001E72 - "\x00u\x03$\x00\x00\x1es" + // 0x00750324: 0x00001E73 - "\x00U\x030\x00\x00\x1et" + // 0x00550330: 0x00001E74 - "\x00u\x030\x00\x00\x1eu" + // 0x00750330: 0x00001E75 - "\x00U\x03-\x00\x00\x1ev" + // 0x0055032D: 0x00001E76 - "\x00u\x03-\x00\x00\x1ew" + // 0x0075032D: 0x00001E77 - "\x01h\x03\x01\x00\x00\x1ex" + // 0x01680301: 0x00001E78 - "\x01i\x03\x01\x00\x00\x1ey" + // 0x01690301: 0x00001E79 - "\x01j\x03\b\x00\x00\x1ez" + // 0x016A0308: 0x00001E7A - "\x01k\x03\b\x00\x00\x1e{" + // 0x016B0308: 0x00001E7B - "\x00V\x03\x03\x00\x00\x1e|" + // 0x00560303: 0x00001E7C - "\x00v\x03\x03\x00\x00\x1e}" + // 0x00760303: 0x00001E7D - "\x00V\x03#\x00\x00\x1e~" + // 0x00560323: 0x00001E7E - "\x00v\x03#\x00\x00\x1e\u007f" + // 0x00760323: 0x00001E7F - "\x00W\x03\x00\x00\x00\x1e\x80" + // 0x00570300: 0x00001E80 - "\x00w\x03\x00\x00\x00\x1e\x81" + // 0x00770300: 0x00001E81 - "\x00W\x03\x01\x00\x00\x1e\x82" + // 0x00570301: 0x00001E82 - "\x00w\x03\x01\x00\x00\x1e\x83" + // 0x00770301: 0x00001E83 - "\x00W\x03\b\x00\x00\x1e\x84" + // 0x00570308: 0x00001E84 - "\x00w\x03\b\x00\x00\x1e\x85" + // 0x00770308: 0x00001E85 - "\x00W\x03\a\x00\x00\x1e\x86" + // 0x00570307: 0x00001E86 - "\x00w\x03\a\x00\x00\x1e\x87" + // 0x00770307: 0x00001E87 - "\x00W\x03#\x00\x00\x1e\x88" + // 0x00570323: 0x00001E88 - "\x00w\x03#\x00\x00\x1e\x89" + // 0x00770323: 0x00001E89 - "\x00X\x03\a\x00\x00\x1e\x8a" + // 0x00580307: 0x00001E8A - "\x00x\x03\a\x00\x00\x1e\x8b" + // 0x00780307: 0x00001E8B - "\x00X\x03\b\x00\x00\x1e\x8c" + // 0x00580308: 0x00001E8C - "\x00x\x03\b\x00\x00\x1e\x8d" + // 0x00780308: 0x00001E8D - "\x00Y\x03\a\x00\x00\x1e\x8e" + // 0x00590307: 0x00001E8E - "\x00y\x03\a\x00\x00\x1e\x8f" + // 0x00790307: 0x00001E8F - "\x00Z\x03\x02\x00\x00\x1e\x90" + // 0x005A0302: 0x00001E90 - "\x00z\x03\x02\x00\x00\x1e\x91" + // 0x007A0302: 0x00001E91 - "\x00Z\x03#\x00\x00\x1e\x92" + // 0x005A0323: 0x00001E92 - "\x00z\x03#\x00\x00\x1e\x93" + // 0x007A0323: 0x00001E93 - "\x00Z\x031\x00\x00\x1e\x94" + // 0x005A0331: 0x00001E94 - "\x00z\x031\x00\x00\x1e\x95" + // 0x007A0331: 0x00001E95 - "\x00h\x031\x00\x00\x1e\x96" + // 0x00680331: 0x00001E96 - "\x00t\x03\b\x00\x00\x1e\x97" + // 0x00740308: 0x00001E97 - "\x00w\x03\n\x00\x00\x1e\x98" + // 0x0077030A: 0x00001E98 - "\x00y\x03\n\x00\x00\x1e\x99" + // 0x0079030A: 0x00001E99 - "\x01\u007f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B - "\x00A\x03#\x00\x00\x1e\xa0" + // 0x00410323: 0x00001EA0 - "\x00a\x03#\x00\x00\x1e\xa1" + // 0x00610323: 0x00001EA1 - "\x00A\x03\t\x00\x00\x1e\xa2" + // 0x00410309: 0x00001EA2 - "\x00a\x03\t\x00\x00\x1e\xa3" + // 0x00610309: 0x00001EA3 - "\x00\xc2\x03\x01\x00\x00\x1e\xa4" + // 0x00C20301: 0x00001EA4 - "\x00\xe2\x03\x01\x00\x00\x1e\xa5" + // 0x00E20301: 0x00001EA5 - "\x00\xc2\x03\x00\x00\x00\x1e\xa6" + // 0x00C20300: 0x00001EA6 - "\x00\xe2\x03\x00\x00\x00\x1e\xa7" + // 0x00E20300: 0x00001EA7 - "\x00\xc2\x03\t\x00\x00\x1e\xa8" + // 0x00C20309: 0x00001EA8 - "\x00\xe2\x03\t\x00\x00\x1e\xa9" + // 0x00E20309: 0x00001EA9 - "\x00\xc2\x03\x03\x00\x00\x1e\xaa" + // 0x00C20303: 0x00001EAA - "\x00\xe2\x03\x03\x00\x00\x1e\xab" + // 0x00E20303: 0x00001EAB - "\x1e\xa0\x03\x02\x00\x00\x1e\xac" + // 0x1EA00302: 0x00001EAC - "\x1e\xa1\x03\x02\x00\x00\x1e\xad" + // 0x1EA10302: 0x00001EAD - "\x01\x02\x03\x01\x00\x00\x1e\xae" + // 0x01020301: 0x00001EAE - "\x01\x03\x03\x01\x00\x00\x1e\xaf" + // 0x01030301: 0x00001EAF - "\x01\x02\x03\x00\x00\x00\x1e\xb0" + // 0x01020300: 0x00001EB0 - "\x01\x03\x03\x00\x00\x00\x1e\xb1" + // 0x01030300: 0x00001EB1 - "\x01\x02\x03\t\x00\x00\x1e\xb2" + // 0x01020309: 0x00001EB2 - "\x01\x03\x03\t\x00\x00\x1e\xb3" + // 0x01030309: 0x00001EB3 - "\x01\x02\x03\x03\x00\x00\x1e\xb4" + // 0x01020303: 0x00001EB4 - "\x01\x03\x03\x03\x00\x00\x1e\xb5" + // 0x01030303: 0x00001EB5 - "\x1e\xa0\x03\x06\x00\x00\x1e\xb6" + // 0x1EA00306: 0x00001EB6 - "\x1e\xa1\x03\x06\x00\x00\x1e\xb7" + // 0x1EA10306: 0x00001EB7 - "\x00E\x03#\x00\x00\x1e\xb8" + // 0x00450323: 0x00001EB8 - "\x00e\x03#\x00\x00\x1e\xb9" + // 0x00650323: 0x00001EB9 - "\x00E\x03\t\x00\x00\x1e\xba" + // 0x00450309: 0x00001EBA - "\x00e\x03\t\x00\x00\x1e\xbb" + // 0x00650309: 0x00001EBB - "\x00E\x03\x03\x00\x00\x1e\xbc" + // 0x00450303: 0x00001EBC - "\x00e\x03\x03\x00\x00\x1e\xbd" + // 0x00650303: 0x00001EBD - "\x00\xca\x03\x01\x00\x00\x1e\xbe" + // 0x00CA0301: 0x00001EBE - "\x00\xea\x03\x01\x00\x00\x1e\xbf" + // 0x00EA0301: 0x00001EBF - "\x00\xca\x03\x00\x00\x00\x1e\xc0" + // 0x00CA0300: 0x00001EC0 - "\x00\xea\x03\x00\x00\x00\x1e\xc1" + // 0x00EA0300: 0x00001EC1 - "\x00\xca\x03\t\x00\x00\x1e\xc2" + // 0x00CA0309: 0x00001EC2 - "\x00\xea\x03\t\x00\x00\x1e\xc3" + // 0x00EA0309: 0x00001EC3 - "\x00\xca\x03\x03\x00\x00\x1e\xc4" + // 0x00CA0303: 0x00001EC4 - "\x00\xea\x03\x03\x00\x00\x1e\xc5" + // 0x00EA0303: 0x00001EC5 - "\x1e\xb8\x03\x02\x00\x00\x1e\xc6" + // 0x1EB80302: 0x00001EC6 - "\x1e\xb9\x03\x02\x00\x00\x1e\xc7" + // 0x1EB90302: 0x00001EC7 - "\x00I\x03\t\x00\x00\x1e\xc8" + // 0x00490309: 0x00001EC8 - "\x00i\x03\t\x00\x00\x1e\xc9" + // 0x00690309: 0x00001EC9 - "\x00I\x03#\x00\x00\x1e\xca" + // 0x00490323: 0x00001ECA - "\x00i\x03#\x00\x00\x1e\xcb" + // 0x00690323: 0x00001ECB - "\x00O\x03#\x00\x00\x1e\xcc" + // 0x004F0323: 0x00001ECC - "\x00o\x03#\x00\x00\x1e\xcd" + // 0x006F0323: 0x00001ECD - "\x00O\x03\t\x00\x00\x1e\xce" + // 0x004F0309: 0x00001ECE - "\x00o\x03\t\x00\x00\x1e\xcf" + // 0x006F0309: 0x00001ECF - "\x00\xd4\x03\x01\x00\x00\x1e\xd0" + // 0x00D40301: 0x00001ED0 - "\x00\xf4\x03\x01\x00\x00\x1e\xd1" + // 0x00F40301: 0x00001ED1 - "\x00\xd4\x03\x00\x00\x00\x1e\xd2" + // 0x00D40300: 0x00001ED2 - "\x00\xf4\x03\x00\x00\x00\x1e\xd3" + // 0x00F40300: 0x00001ED3 - "\x00\xd4\x03\t\x00\x00\x1e\xd4" + // 0x00D40309: 0x00001ED4 - "\x00\xf4\x03\t\x00\x00\x1e\xd5" + // 0x00F40309: 0x00001ED5 - "\x00\xd4\x03\x03\x00\x00\x1e\xd6" + // 0x00D40303: 0x00001ED6 - "\x00\xf4\x03\x03\x00\x00\x1e\xd7" + // 0x00F40303: 0x00001ED7 - "\x1e\xcc\x03\x02\x00\x00\x1e\xd8" + // 0x1ECC0302: 0x00001ED8 - "\x1e\xcd\x03\x02\x00\x00\x1e\xd9" + // 0x1ECD0302: 0x00001ED9 - "\x01\xa0\x03\x01\x00\x00\x1e\xda" + // 0x01A00301: 0x00001EDA - "\x01\xa1\x03\x01\x00\x00\x1e\xdb" + // 0x01A10301: 0x00001EDB - "\x01\xa0\x03\x00\x00\x00\x1e\xdc" + // 0x01A00300: 0x00001EDC - "\x01\xa1\x03\x00\x00\x00\x1e\xdd" + // 0x01A10300: 0x00001EDD - "\x01\xa0\x03\t\x00\x00\x1e\xde" + // 0x01A00309: 0x00001EDE - "\x01\xa1\x03\t\x00\x00\x1e\xdf" + // 0x01A10309: 0x00001EDF - "\x01\xa0\x03\x03\x00\x00\x1e\xe0" + // 0x01A00303: 0x00001EE0 - "\x01\xa1\x03\x03\x00\x00\x1e\xe1" + // 0x01A10303: 0x00001EE1 - "\x01\xa0\x03#\x00\x00\x1e\xe2" + // 0x01A00323: 0x00001EE2 - "\x01\xa1\x03#\x00\x00\x1e\xe3" + // 0x01A10323: 0x00001EE3 - "\x00U\x03#\x00\x00\x1e\xe4" + // 0x00550323: 0x00001EE4 - "\x00u\x03#\x00\x00\x1e\xe5" + // 0x00750323: 0x00001EE5 - "\x00U\x03\t\x00\x00\x1e\xe6" + // 0x00550309: 0x00001EE6 - "\x00u\x03\t\x00\x00\x1e\xe7" + // 0x00750309: 0x00001EE7 - "\x01\xaf\x03\x01\x00\x00\x1e\xe8" + // 0x01AF0301: 0x00001EE8 - "\x01\xb0\x03\x01\x00\x00\x1e\xe9" + // 0x01B00301: 0x00001EE9 - "\x01\xaf\x03\x00\x00\x00\x1e\xea" + // 0x01AF0300: 0x00001EEA - "\x01\xb0\x03\x00\x00\x00\x1e\xeb" + // 0x01B00300: 0x00001EEB - "\x01\xaf\x03\t\x00\x00\x1e\xec" + // 0x01AF0309: 0x00001EEC - "\x01\xb0\x03\t\x00\x00\x1e\xed" + // 0x01B00309: 0x00001EED - "\x01\xaf\x03\x03\x00\x00\x1e\xee" + // 0x01AF0303: 0x00001EEE - "\x01\xb0\x03\x03\x00\x00\x1e\xef" + // 0x01B00303: 0x00001EEF - "\x01\xaf\x03#\x00\x00\x1e\xf0" + // 0x01AF0323: 0x00001EF0 - "\x01\xb0\x03#\x00\x00\x1e\xf1" + // 0x01B00323: 0x00001EF1 - "\x00Y\x03\x00\x00\x00\x1e\xf2" + // 0x00590300: 0x00001EF2 - "\x00y\x03\x00\x00\x00\x1e\xf3" + // 0x00790300: 0x00001EF3 - "\x00Y\x03#\x00\x00\x1e\xf4" + // 0x00590323: 0x00001EF4 - "\x00y\x03#\x00\x00\x1e\xf5" + // 0x00790323: 0x00001EF5 - "\x00Y\x03\t\x00\x00\x1e\xf6" + // 0x00590309: 0x00001EF6 - "\x00y\x03\t\x00\x00\x1e\xf7" + // 0x00790309: 0x00001EF7 - "\x00Y\x03\x03\x00\x00\x1e\xf8" + // 0x00590303: 0x00001EF8 - "\x00y\x03\x03\x00\x00\x1e\xf9" + // 0x00790303: 0x00001EF9 - "\x03\xb1\x03\x13\x00\x00\x1f\x00" + // 0x03B10313: 0x00001F00 - "\x03\xb1\x03\x14\x00\x00\x1f\x01" + // 0x03B10314: 0x00001F01 - "\x1f\x00\x03\x00\x00\x00\x1f\x02" + // 0x1F000300: 0x00001F02 - "\x1f\x01\x03\x00\x00\x00\x1f\x03" + // 0x1F010300: 0x00001F03 - "\x1f\x00\x03\x01\x00\x00\x1f\x04" + // 0x1F000301: 0x00001F04 - "\x1f\x01\x03\x01\x00\x00\x1f\x05" + // 0x1F010301: 0x00001F05 - "\x1f\x00\x03B\x00\x00\x1f\x06" + // 0x1F000342: 0x00001F06 - "\x1f\x01\x03B\x00\x00\x1f\a" + // 0x1F010342: 0x00001F07 - "\x03\x91\x03\x13\x00\x00\x1f\b" + // 0x03910313: 0x00001F08 - "\x03\x91\x03\x14\x00\x00\x1f\t" + // 0x03910314: 0x00001F09 - "\x1f\b\x03\x00\x00\x00\x1f\n" + // 0x1F080300: 0x00001F0A - "\x1f\t\x03\x00\x00\x00\x1f\v" + // 0x1F090300: 0x00001F0B - "\x1f\b\x03\x01\x00\x00\x1f\f" + // 0x1F080301: 0x00001F0C - "\x1f\t\x03\x01\x00\x00\x1f\r" + // 0x1F090301: 0x00001F0D - "\x1f\b\x03B\x00\x00\x1f\x0e" + // 0x1F080342: 0x00001F0E - "\x1f\t\x03B\x00\x00\x1f\x0f" + // 0x1F090342: 0x00001F0F - "\x03\xb5\x03\x13\x00\x00\x1f\x10" + // 0x03B50313: 0x00001F10 - "\x03\xb5\x03\x14\x00\x00\x1f\x11" + // 0x03B50314: 0x00001F11 - "\x1f\x10\x03\x00\x00\x00\x1f\x12" + // 0x1F100300: 0x00001F12 - "\x1f\x11\x03\x00\x00\x00\x1f\x13" + // 0x1F110300: 0x00001F13 - "\x1f\x10\x03\x01\x00\x00\x1f\x14" + // 0x1F100301: 0x00001F14 - "\x1f\x11\x03\x01\x00\x00\x1f\x15" + // 0x1F110301: 0x00001F15 - "\x03\x95\x03\x13\x00\x00\x1f\x18" + // 0x03950313: 0x00001F18 - "\x03\x95\x03\x14\x00\x00\x1f\x19" + // 0x03950314: 0x00001F19 - "\x1f\x18\x03\x00\x00\x00\x1f\x1a" + // 0x1F180300: 0x00001F1A - "\x1f\x19\x03\x00\x00\x00\x1f\x1b" + // 0x1F190300: 0x00001F1B - "\x1f\x18\x03\x01\x00\x00\x1f\x1c" + // 0x1F180301: 0x00001F1C - "\x1f\x19\x03\x01\x00\x00\x1f\x1d" + // 0x1F190301: 0x00001F1D - "\x03\xb7\x03\x13\x00\x00\x1f " + // 0x03B70313: 0x00001F20 - "\x03\xb7\x03\x14\x00\x00\x1f!" + // 0x03B70314: 0x00001F21 - "\x1f \x03\x00\x00\x00\x1f\"" + // 0x1F200300: 0x00001F22 - "\x1f!\x03\x00\x00\x00\x1f#" + // 0x1F210300: 0x00001F23 - "\x1f \x03\x01\x00\x00\x1f$" + // 0x1F200301: 0x00001F24 - "\x1f!\x03\x01\x00\x00\x1f%" + // 0x1F210301: 0x00001F25 - "\x1f \x03B\x00\x00\x1f&" + // 0x1F200342: 0x00001F26 - "\x1f!\x03B\x00\x00\x1f'" + // 0x1F210342: 0x00001F27 - "\x03\x97\x03\x13\x00\x00\x1f(" + // 0x03970313: 0x00001F28 - "\x03\x97\x03\x14\x00\x00\x1f)" + // 0x03970314: 0x00001F29 - "\x1f(\x03\x00\x00\x00\x1f*" + // 0x1F280300: 0x00001F2A - "\x1f)\x03\x00\x00\x00\x1f+" + // 0x1F290300: 0x00001F2B - "\x1f(\x03\x01\x00\x00\x1f," + // 0x1F280301: 0x00001F2C - "\x1f)\x03\x01\x00\x00\x1f-" + // 0x1F290301: 0x00001F2D - "\x1f(\x03B\x00\x00\x1f." + // 0x1F280342: 0x00001F2E - "\x1f)\x03B\x00\x00\x1f/" + // 0x1F290342: 0x00001F2F - "\x03\xb9\x03\x13\x00\x00\x1f0" + // 0x03B90313: 0x00001F30 - "\x03\xb9\x03\x14\x00\x00\x1f1" + // 0x03B90314: 0x00001F31 - "\x1f0\x03\x00\x00\x00\x1f2" + // 0x1F300300: 0x00001F32 - "\x1f1\x03\x00\x00\x00\x1f3" + // 0x1F310300: 0x00001F33 - "\x1f0\x03\x01\x00\x00\x1f4" + // 0x1F300301: 0x00001F34 - "\x1f1\x03\x01\x00\x00\x1f5" + // 0x1F310301: 0x00001F35 - "\x1f0\x03B\x00\x00\x1f6" + // 0x1F300342: 0x00001F36 - "\x1f1\x03B\x00\x00\x1f7" + // 0x1F310342: 0x00001F37 - "\x03\x99\x03\x13\x00\x00\x1f8" + // 0x03990313: 0x00001F38 - "\x03\x99\x03\x14\x00\x00\x1f9" + // 0x03990314: 0x00001F39 - "\x1f8\x03\x00\x00\x00\x1f:" + // 0x1F380300: 0x00001F3A - "\x1f9\x03\x00\x00\x00\x1f;" + // 0x1F390300: 0x00001F3B - "\x1f8\x03\x01\x00\x00\x1f<" + // 0x1F380301: 0x00001F3C - "\x1f9\x03\x01\x00\x00\x1f=" + // 0x1F390301: 0x00001F3D - "\x1f8\x03B\x00\x00\x1f>" + // 0x1F380342: 0x00001F3E - "\x1f9\x03B\x00\x00\x1f?" + // 0x1F390342: 0x00001F3F - "\x03\xbf\x03\x13\x00\x00\x1f@" + // 0x03BF0313: 0x00001F40 - "\x03\xbf\x03\x14\x00\x00\x1fA" + // 0x03BF0314: 0x00001F41 - "\x1f@\x03\x00\x00\x00\x1fB" + // 0x1F400300: 0x00001F42 - "\x1fA\x03\x00\x00\x00\x1fC" + // 0x1F410300: 0x00001F43 - "\x1f@\x03\x01\x00\x00\x1fD" + // 0x1F400301: 0x00001F44 - "\x1fA\x03\x01\x00\x00\x1fE" + // 0x1F410301: 0x00001F45 - "\x03\x9f\x03\x13\x00\x00\x1fH" + // 0x039F0313: 0x00001F48 - "\x03\x9f\x03\x14\x00\x00\x1fI" + // 0x039F0314: 0x00001F49 - "\x1fH\x03\x00\x00\x00\x1fJ" + // 0x1F480300: 0x00001F4A - "\x1fI\x03\x00\x00\x00\x1fK" + // 0x1F490300: 0x00001F4B - "\x1fH\x03\x01\x00\x00\x1fL" + // 0x1F480301: 0x00001F4C - "\x1fI\x03\x01\x00\x00\x1fM" + // 0x1F490301: 0x00001F4D - "\x03\xc5\x03\x13\x00\x00\x1fP" + // 0x03C50313: 0x00001F50 - "\x03\xc5\x03\x14\x00\x00\x1fQ" + // 0x03C50314: 0x00001F51 - "\x1fP\x03\x00\x00\x00\x1fR" + // 0x1F500300: 0x00001F52 - "\x1fQ\x03\x00\x00\x00\x1fS" + // 0x1F510300: 0x00001F53 - "\x1fP\x03\x01\x00\x00\x1fT" + // 0x1F500301: 0x00001F54 - "\x1fQ\x03\x01\x00\x00\x1fU" + // 0x1F510301: 0x00001F55 - "\x1fP\x03B\x00\x00\x1fV" + // 0x1F500342: 0x00001F56 - "\x1fQ\x03B\x00\x00\x1fW" + // 0x1F510342: 0x00001F57 - "\x03\xa5\x03\x14\x00\x00\x1fY" + // 0x03A50314: 0x00001F59 - "\x1fY\x03\x00\x00\x00\x1f[" + // 0x1F590300: 0x00001F5B - "\x1fY\x03\x01\x00\x00\x1f]" + // 0x1F590301: 0x00001F5D - "\x1fY\x03B\x00\x00\x1f_" + // 0x1F590342: 0x00001F5F - "\x03\xc9\x03\x13\x00\x00\x1f`" + // 0x03C90313: 0x00001F60 - "\x03\xc9\x03\x14\x00\x00\x1fa" + // 0x03C90314: 0x00001F61 - "\x1f`\x03\x00\x00\x00\x1fb" + // 0x1F600300: 0x00001F62 - "\x1fa\x03\x00\x00\x00\x1fc" + // 0x1F610300: 0x00001F63 - "\x1f`\x03\x01\x00\x00\x1fd" + // 0x1F600301: 0x00001F64 - "\x1fa\x03\x01\x00\x00\x1fe" + // 0x1F610301: 0x00001F65 - "\x1f`\x03B\x00\x00\x1ff" + // 0x1F600342: 0x00001F66 - "\x1fa\x03B\x00\x00\x1fg" + // 0x1F610342: 0x00001F67 - "\x03\xa9\x03\x13\x00\x00\x1fh" + // 0x03A90313: 0x00001F68 - "\x03\xa9\x03\x14\x00\x00\x1fi" + // 0x03A90314: 0x00001F69 - "\x1fh\x03\x00\x00\x00\x1fj" + // 0x1F680300: 0x00001F6A - "\x1fi\x03\x00\x00\x00\x1fk" + // 0x1F690300: 0x00001F6B - "\x1fh\x03\x01\x00\x00\x1fl" + // 0x1F680301: 0x00001F6C - "\x1fi\x03\x01\x00\x00\x1fm" + // 0x1F690301: 0x00001F6D - "\x1fh\x03B\x00\x00\x1fn" + // 0x1F680342: 0x00001F6E - "\x1fi\x03B\x00\x00\x1fo" + // 0x1F690342: 0x00001F6F - "\x03\xb1\x03\x00\x00\x00\x1fp" + // 0x03B10300: 0x00001F70 - "\x03\xb5\x03\x00\x00\x00\x1fr" + // 0x03B50300: 0x00001F72 - "\x03\xb7\x03\x00\x00\x00\x1ft" + // 0x03B70300: 0x00001F74 - "\x03\xb9\x03\x00\x00\x00\x1fv" + // 0x03B90300: 0x00001F76 - "\x03\xbf\x03\x00\x00\x00\x1fx" + // 0x03BF0300: 0x00001F78 - "\x03\xc5\x03\x00\x00\x00\x1fz" + // 0x03C50300: 0x00001F7A - "\x03\xc9\x03\x00\x00\x00\x1f|" + // 0x03C90300: 0x00001F7C - "\x1f\x00\x03E\x00\x00\x1f\x80" + // 0x1F000345: 0x00001F80 - "\x1f\x01\x03E\x00\x00\x1f\x81" + // 0x1F010345: 0x00001F81 - "\x1f\x02\x03E\x00\x00\x1f\x82" + // 0x1F020345: 0x00001F82 - "\x1f\x03\x03E\x00\x00\x1f\x83" + // 0x1F030345: 0x00001F83 - "\x1f\x04\x03E\x00\x00\x1f\x84" + // 0x1F040345: 0x00001F84 - "\x1f\x05\x03E\x00\x00\x1f\x85" + // 0x1F050345: 0x00001F85 - "\x1f\x06\x03E\x00\x00\x1f\x86" + // 0x1F060345: 0x00001F86 - "\x1f\a\x03E\x00\x00\x1f\x87" + // 0x1F070345: 0x00001F87 - "\x1f\b\x03E\x00\x00\x1f\x88" + // 0x1F080345: 0x00001F88 - "\x1f\t\x03E\x00\x00\x1f\x89" + // 0x1F090345: 0x00001F89 - "\x1f\n\x03E\x00\x00\x1f\x8a" + // 0x1F0A0345: 0x00001F8A - "\x1f\v\x03E\x00\x00\x1f\x8b" + // 0x1F0B0345: 0x00001F8B - "\x1f\f\x03E\x00\x00\x1f\x8c" + // 0x1F0C0345: 0x00001F8C - "\x1f\r\x03E\x00\x00\x1f\x8d" + // 0x1F0D0345: 0x00001F8D - "\x1f\x0e\x03E\x00\x00\x1f\x8e" + // 0x1F0E0345: 0x00001F8E - "\x1f\x0f\x03E\x00\x00\x1f\x8f" + // 0x1F0F0345: 0x00001F8F - "\x1f \x03E\x00\x00\x1f\x90" + // 0x1F200345: 0x00001F90 - "\x1f!\x03E\x00\x00\x1f\x91" + // 0x1F210345: 0x00001F91 - "\x1f\"\x03E\x00\x00\x1f\x92" + // 0x1F220345: 0x00001F92 - "\x1f#\x03E\x00\x00\x1f\x93" + // 0x1F230345: 0x00001F93 - "\x1f$\x03E\x00\x00\x1f\x94" + // 0x1F240345: 0x00001F94 - "\x1f%\x03E\x00\x00\x1f\x95" + // 0x1F250345: 0x00001F95 - "\x1f&\x03E\x00\x00\x1f\x96" + // 0x1F260345: 0x00001F96 - "\x1f'\x03E\x00\x00\x1f\x97" + // 0x1F270345: 0x00001F97 - "\x1f(\x03E\x00\x00\x1f\x98" + // 0x1F280345: 0x00001F98 - "\x1f)\x03E\x00\x00\x1f\x99" + // 0x1F290345: 0x00001F99 - "\x1f*\x03E\x00\x00\x1f\x9a" + // 0x1F2A0345: 0x00001F9A - "\x1f+\x03E\x00\x00\x1f\x9b" + // 0x1F2B0345: 0x00001F9B - "\x1f,\x03E\x00\x00\x1f\x9c" + // 0x1F2C0345: 0x00001F9C - "\x1f-\x03E\x00\x00\x1f\x9d" + // 0x1F2D0345: 0x00001F9D - "\x1f.\x03E\x00\x00\x1f\x9e" + // 0x1F2E0345: 0x00001F9E - "\x1f/\x03E\x00\x00\x1f\x9f" + // 0x1F2F0345: 0x00001F9F - "\x1f`\x03E\x00\x00\x1f\xa0" + // 0x1F600345: 0x00001FA0 - "\x1fa\x03E\x00\x00\x1f\xa1" + // 0x1F610345: 0x00001FA1 - "\x1fb\x03E\x00\x00\x1f\xa2" + // 0x1F620345: 0x00001FA2 - "\x1fc\x03E\x00\x00\x1f\xa3" + // 0x1F630345: 0x00001FA3 - "\x1fd\x03E\x00\x00\x1f\xa4" + // 0x1F640345: 0x00001FA4 - "\x1fe\x03E\x00\x00\x1f\xa5" + // 0x1F650345: 0x00001FA5 - "\x1ff\x03E\x00\x00\x1f\xa6" + // 0x1F660345: 0x00001FA6 - "\x1fg\x03E\x00\x00\x1f\xa7" + // 0x1F670345: 0x00001FA7 - "\x1fh\x03E\x00\x00\x1f\xa8" + // 0x1F680345: 0x00001FA8 - "\x1fi\x03E\x00\x00\x1f\xa9" + // 0x1F690345: 0x00001FA9 - "\x1fj\x03E\x00\x00\x1f\xaa" + // 0x1F6A0345: 0x00001FAA - "\x1fk\x03E\x00\x00\x1f\xab" + // 0x1F6B0345: 0x00001FAB - "\x1fl\x03E\x00\x00\x1f\xac" + // 0x1F6C0345: 0x00001FAC - "\x1fm\x03E\x00\x00\x1f\xad" + // 0x1F6D0345: 0x00001FAD - "\x1fn\x03E\x00\x00\x1f\xae" + // 0x1F6E0345: 0x00001FAE - "\x1fo\x03E\x00\x00\x1f\xaf" + // 0x1F6F0345: 0x00001FAF - "\x03\xb1\x03\x06\x00\x00\x1f\xb0" + // 0x03B10306: 0x00001FB0 - "\x03\xb1\x03\x04\x00\x00\x1f\xb1" + // 0x03B10304: 0x00001FB1 - "\x1fp\x03E\x00\x00\x1f\xb2" + // 0x1F700345: 0x00001FB2 - "\x03\xb1\x03E\x00\x00\x1f\xb3" + // 0x03B10345: 0x00001FB3 - "\x03\xac\x03E\x00\x00\x1f\xb4" + // 0x03AC0345: 0x00001FB4 - "\x03\xb1\x03B\x00\x00\x1f\xb6" + // 0x03B10342: 0x00001FB6 - "\x1f\xb6\x03E\x00\x00\x1f\xb7" + // 0x1FB60345: 0x00001FB7 - "\x03\x91\x03\x06\x00\x00\x1f\xb8" + // 0x03910306: 0x00001FB8 - "\x03\x91\x03\x04\x00\x00\x1f\xb9" + // 0x03910304: 0x00001FB9 - "\x03\x91\x03\x00\x00\x00\x1f\xba" + // 0x03910300: 0x00001FBA - "\x03\x91\x03E\x00\x00\x1f\xbc" + // 0x03910345: 0x00001FBC - "\x00\xa8\x03B\x00\x00\x1f\xc1" + // 0x00A80342: 0x00001FC1 - "\x1ft\x03E\x00\x00\x1f\xc2" + // 0x1F740345: 0x00001FC2 - "\x03\xb7\x03E\x00\x00\x1f\xc3" + // 0x03B70345: 0x00001FC3 - "\x03\xae\x03E\x00\x00\x1f\xc4" + // 0x03AE0345: 0x00001FC4 - "\x03\xb7\x03B\x00\x00\x1f\xc6" + // 0x03B70342: 0x00001FC6 - "\x1f\xc6\x03E\x00\x00\x1f\xc7" + // 0x1FC60345: 0x00001FC7 - "\x03\x95\x03\x00\x00\x00\x1f\xc8" + // 0x03950300: 0x00001FC8 - "\x03\x97\x03\x00\x00\x00\x1f\xca" + // 0x03970300: 0x00001FCA - "\x03\x97\x03E\x00\x00\x1f\xcc" + // 0x03970345: 0x00001FCC - "\x1f\xbf\x03\x00\x00\x00\x1f\xcd" + // 0x1FBF0300: 0x00001FCD - "\x1f\xbf\x03\x01\x00\x00\x1f\xce" + // 0x1FBF0301: 0x00001FCE - "\x1f\xbf\x03B\x00\x00\x1f\xcf" + // 0x1FBF0342: 0x00001FCF - "\x03\xb9\x03\x06\x00\x00\x1f\xd0" + // 0x03B90306: 0x00001FD0 - "\x03\xb9\x03\x04\x00\x00\x1f\xd1" + // 0x03B90304: 0x00001FD1 - "\x03\xca\x03\x00\x00\x00\x1f\xd2" + // 0x03CA0300: 0x00001FD2 - "\x03\xb9\x03B\x00\x00\x1f\xd6" + // 0x03B90342: 0x00001FD6 - "\x03\xca\x03B\x00\x00\x1f\xd7" + // 0x03CA0342: 0x00001FD7 - "\x03\x99\x03\x06\x00\x00\x1f\xd8" + // 0x03990306: 0x00001FD8 - "\x03\x99\x03\x04\x00\x00\x1f\xd9" + // 0x03990304: 0x00001FD9 - "\x03\x99\x03\x00\x00\x00\x1f\xda" + // 0x03990300: 0x00001FDA - "\x1f\xfe\x03\x00\x00\x00\x1f\xdd" + // 0x1FFE0300: 0x00001FDD - "\x1f\xfe\x03\x01\x00\x00\x1f\xde" + // 0x1FFE0301: 0x00001FDE - "\x1f\xfe\x03B\x00\x00\x1f\xdf" + // 0x1FFE0342: 0x00001FDF - "\x03\xc5\x03\x06\x00\x00\x1f\xe0" + // 0x03C50306: 0x00001FE0 - "\x03\xc5\x03\x04\x00\x00\x1f\xe1" + // 0x03C50304: 0x00001FE1 - "\x03\xcb\x03\x00\x00\x00\x1f\xe2" + // 0x03CB0300: 0x00001FE2 - "\x03\xc1\x03\x13\x00\x00\x1f\xe4" + // 0x03C10313: 0x00001FE4 - "\x03\xc1\x03\x14\x00\x00\x1f\xe5" + // 0x03C10314: 0x00001FE5 - "\x03\xc5\x03B\x00\x00\x1f\xe6" + // 0x03C50342: 0x00001FE6 - "\x03\xcb\x03B\x00\x00\x1f\xe7" + // 0x03CB0342: 0x00001FE7 - "\x03\xa5\x03\x06\x00\x00\x1f\xe8" + // 0x03A50306: 0x00001FE8 - "\x03\xa5\x03\x04\x00\x00\x1f\xe9" + // 0x03A50304: 0x00001FE9 - "\x03\xa5\x03\x00\x00\x00\x1f\xea" + // 0x03A50300: 0x00001FEA - "\x03\xa1\x03\x14\x00\x00\x1f\xec" + // 0x03A10314: 0x00001FEC - "\x00\xa8\x03\x00\x00\x00\x1f\xed" + // 0x00A80300: 0x00001FED - "\x1f|\x03E\x00\x00\x1f\xf2" + // 0x1F7C0345: 0x00001FF2 - "\x03\xc9\x03E\x00\x00\x1f\xf3" + // 0x03C90345: 0x00001FF3 - "\x03\xce\x03E\x00\x00\x1f\xf4" + // 0x03CE0345: 0x00001FF4 - "\x03\xc9\x03B\x00\x00\x1f\xf6" + // 0x03C90342: 0x00001FF6 - "\x1f\xf6\x03E\x00\x00\x1f\xf7" + // 0x1FF60345: 0x00001FF7 - "\x03\x9f\x03\x00\x00\x00\x1f\xf8" + // 0x039F0300: 0x00001FF8 - "\x03\xa9\x03\x00\x00\x00\x1f\xfa" + // 0x03A90300: 0x00001FFA - "\x03\xa9\x03E\x00\x00\x1f\xfc" + // 0x03A90345: 0x00001FFC - "!\x90\x038\x00\x00!\x9a" + // 0x21900338: 0x0000219A - "!\x92\x038\x00\x00!\x9b" + // 0x21920338: 0x0000219B - "!\x94\x038\x00\x00!\xae" + // 0x21940338: 0x000021AE - "!\xd0\x038\x00\x00!\xcd" + // 0x21D00338: 0x000021CD - "!\xd4\x038\x00\x00!\xce" + // 0x21D40338: 0x000021CE - "!\xd2\x038\x00\x00!\xcf" + // 0x21D20338: 0x000021CF - "\"\x03\x038\x00\x00\"\x04" + // 0x22030338: 0x00002204 - "\"\b\x038\x00\x00\"\t" + // 0x22080338: 0x00002209 - "\"\v\x038\x00\x00\"\f" + // 0x220B0338: 0x0000220C - "\"#\x038\x00\x00\"$" + // 0x22230338: 0x00002224 - "\"%\x038\x00\x00\"&" + // 0x22250338: 0x00002226 - "\"<\x038\x00\x00\"A" + // 0x223C0338: 0x00002241 - "\"C\x038\x00\x00\"D" + // 0x22430338: 0x00002244 - "\"E\x038\x00\x00\"G" + // 0x22450338: 0x00002247 - "\"H\x038\x00\x00\"I" + // 0x22480338: 0x00002249 - "\x00=\x038\x00\x00\"`" + // 0x003D0338: 0x00002260 - "\"a\x038\x00\x00\"b" + // 0x22610338: 0x00002262 - "\"M\x038\x00\x00\"m" + // 0x224D0338: 0x0000226D - "\x00<\x038\x00\x00\"n" + // 0x003C0338: 0x0000226E - "\x00>\x038\x00\x00\"o" + // 0x003E0338: 0x0000226F - "\"d\x038\x00\x00\"p" + // 0x22640338: 0x00002270 - "\"e\x038\x00\x00\"q" + // 0x22650338: 0x00002271 - "\"r\x038\x00\x00\"t" + // 0x22720338: 0x00002274 - "\"s\x038\x00\x00\"u" + // 0x22730338: 0x00002275 - "\"v\x038\x00\x00\"x" + // 0x22760338: 0x00002278 - "\"w\x038\x00\x00\"y" + // 0x22770338: 0x00002279 - "\"z\x038\x00\x00\"\x80" + // 0x227A0338: 0x00002280 - "\"{\x038\x00\x00\"\x81" + // 0x227B0338: 0x00002281 - "\"\x82\x038\x00\x00\"\x84" + // 0x22820338: 0x00002284 - "\"\x83\x038\x00\x00\"\x85" + // 0x22830338: 0x00002285 - "\"\x86\x038\x00\x00\"\x88" + // 0x22860338: 0x00002288 - "\"\x87\x038\x00\x00\"\x89" + // 0x22870338: 0x00002289 - "\"\xa2\x038\x00\x00\"\xac" + // 0x22A20338: 0x000022AC - "\"\xa8\x038\x00\x00\"\xad" + // 0x22A80338: 0x000022AD - "\"\xa9\x038\x00\x00\"\xae" + // 0x22A90338: 0x000022AE - "\"\xab\x038\x00\x00\"\xaf" + // 0x22AB0338: 0x000022AF - "\"|\x038\x00\x00\"\xe0" + // 0x227C0338: 0x000022E0 - "\"}\x038\x00\x00\"\xe1" + // 0x227D0338: 0x000022E1 - "\"\x91\x038\x00\x00\"\xe2" + // 0x22910338: 0x000022E2 - "\"\x92\x038\x00\x00\"\xe3" + // 0x22920338: 0x000022E3 - "\"\xb2\x038\x00\x00\"\xea" + // 0x22B20338: 0x000022EA - "\"\xb3\x038\x00\x00\"\xeb" + // 0x22B30338: 0x000022EB - "\"\xb4\x038\x00\x00\"\xec" + // 0x22B40338: 0x000022EC - "\"\xb5\x038\x00\x00\"\xed" + // 0x22B50338: 0x000022ED - "0K0\x99\x00\x000L" + // 0x304B3099: 0x0000304C - "0M0\x99\x00\x000N" + // 0x304D3099: 0x0000304E - "0O0\x99\x00\x000P" + // 0x304F3099: 0x00003050 - "0Q0\x99\x00\x000R" + // 0x30513099: 0x00003052 - "0S0\x99\x00\x000T" + // 0x30533099: 0x00003054 - "0U0\x99\x00\x000V" + // 0x30553099: 0x00003056 - "0W0\x99\x00\x000X" + // 0x30573099: 0x00003058 - "0Y0\x99\x00\x000Z" + // 0x30593099: 0x0000305A - "0[0\x99\x00\x000\\" + // 0x305B3099: 0x0000305C - "0]0\x99\x00\x000^" + // 0x305D3099: 0x0000305E - "0_0\x99\x00\x000`" + // 0x305F3099: 0x00003060 - "0a0\x99\x00\x000b" + // 0x30613099: 0x00003062 - "0d0\x99\x00\x000e" + // 0x30643099: 0x00003065 - "0f0\x99\x00\x000g" + // 0x30663099: 0x00003067 - "0h0\x99\x00\x000i" + // 0x30683099: 0x00003069 - "0o0\x99\x00\x000p" + // 0x306F3099: 0x00003070 - "0o0\x9a\x00\x000q" + // 0x306F309A: 0x00003071 - "0r0\x99\x00\x000s" + // 0x30723099: 0x00003073 - "0r0\x9a\x00\x000t" + // 0x3072309A: 0x00003074 - "0u0\x99\x00\x000v" + // 0x30753099: 0x00003076 - "0u0\x9a\x00\x000w" + // 0x3075309A: 0x00003077 - "0x0\x99\x00\x000y" + // 0x30783099: 0x00003079 - "0x0\x9a\x00\x000z" + // 0x3078309A: 0x0000307A - "0{0\x99\x00\x000|" + // 0x307B3099: 0x0000307C - "0{0\x9a\x00\x000}" + // 0x307B309A: 0x0000307D - "0F0\x99\x00\x000\x94" + // 0x30463099: 0x00003094 - "0\x9d0\x99\x00\x000\x9e" + // 0x309D3099: 0x0000309E - "0\xab0\x99\x00\x000\xac" + // 0x30AB3099: 0x000030AC - "0\xad0\x99\x00\x000\xae" + // 0x30AD3099: 0x000030AE - "0\xaf0\x99\x00\x000\xb0" + // 0x30AF3099: 0x000030B0 - "0\xb10\x99\x00\x000\xb2" + // 0x30B13099: 0x000030B2 - "0\xb30\x99\x00\x000\xb4" + // 0x30B33099: 0x000030B4 - "0\xb50\x99\x00\x000\xb6" + // 0x30B53099: 0x000030B6 - "0\xb70\x99\x00\x000\xb8" + // 0x30B73099: 0x000030B8 - "0\xb90\x99\x00\x000\xba" + // 0x30B93099: 0x000030BA - "0\xbb0\x99\x00\x000\xbc" + // 0x30BB3099: 0x000030BC - "0\xbd0\x99\x00\x000\xbe" + // 0x30BD3099: 0x000030BE - "0\xbf0\x99\x00\x000\xc0" + // 0x30BF3099: 0x000030C0 - "0\xc10\x99\x00\x000\xc2" + // 0x30C13099: 0x000030C2 - "0\xc40\x99\x00\x000\xc5" + // 0x30C43099: 0x000030C5 - "0\xc60\x99\x00\x000\xc7" + // 0x30C63099: 0x000030C7 - "0\xc80\x99\x00\x000\xc9" + // 0x30C83099: 0x000030C9 - "0\xcf0\x99\x00\x000\xd0" + // 0x30CF3099: 0x000030D0 - "0\xcf0\x9a\x00\x000\xd1" + // 0x30CF309A: 0x000030D1 - "0\xd20\x99\x00\x000\xd3" + // 0x30D23099: 0x000030D3 - "0\xd20\x9a\x00\x000\xd4" + // 0x30D2309A: 0x000030D4 - "0\xd50\x99\x00\x000\xd6" + // 0x30D53099: 0x000030D6 - "0\xd50\x9a\x00\x000\xd7" + // 0x30D5309A: 0x000030D7 - "0\xd80\x99\x00\x000\xd9" + // 0x30D83099: 0x000030D9 - "0\xd80\x9a\x00\x000\xda" + // 0x30D8309A: 0x000030DA - "0\xdb0\x99\x00\x000\xdc" + // 0x30DB3099: 0x000030DC - "0\xdb0\x9a\x00\x000\xdd" + // 0x30DB309A: 0x000030DD - "0\xa60\x99\x00\x000\xf4" + // 0x30A63099: 0x000030F4 - "0\xef0\x99\x00\x000\xf7" + // 0x30EF3099: 0x000030F7 - "0\xf00\x99\x00\x000\xf8" + // 0x30F03099: 0x000030F8 - "0\xf10\x99\x00\x000\xf9" + // 0x30F13099: 0x000030F9 - "0\xf20\x99\x00\x000\xfa" + // 0x30F23099: 0x000030FA - "0\xfd0\x99\x00\x000\xfe" + // 0x30FD3099: 0x000030FE - "\x10\x99\x10\xba\x00\x01\x10\x9a" + // 0x109910BA: 0x0001109A - "\x10\x9b\x10\xba\x00\x01\x10\x9c" + // 0x109B10BA: 0x0001109C - "\x10\xa5\x10\xba\x00\x01\x10\xab" + // 0x10A510BA: 0x000110AB - "\x111\x11'\x00\x01\x11." + // 0x11311127: 0x0001112E - "\x112\x11'\x00\x01\x11/" + // 0x11321127: 0x0001112F - "\x13G\x13>\x00\x01\x13K" + // 0x1347133E: 0x0001134B - "\x13G\x13W\x00\x01\x13L" + // 0x13471357: 0x0001134C - "\x14\xb9\x14\xba\x00\x01\x14\xbb" + // 0x14B914BA: 0x000114BB - "\x14\xb9\x14\xb0\x00\x01\x14\xbc" + // 0x14B914B0: 0x000114BC - "\x14\xb9\x14\xbd\x00\x01\x14\xbe" + // 0x14B914BD: 0x000114BE - "\x15\xb8\x15\xaf\x00\x01\x15\xba" + // 0x15B815AF: 0x000115BA - "\x15\xb9\x15\xaf\x00\x01\x15\xbb" + // 0x15B915AF: 0x000115BB - "" - // Total size of tables: 53KB (54514 bytes) diff --git a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 94290692..a01274a8 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -4,8 +4,6 @@ package norm -import "sync" - const ( // Version is the Unicode edition from which the tables are derived. Version = "9.0.0" @@ -6689,949 +6687,947 @@ var nfkcSparseValues = [875]valueRange{ } // recompMap: 7520 bytes (entries only) -var recompMap map[uint32]rune -var recompMapOnce sync.Once +var recompMap = map[uint32]rune{ + 0x00410300: 0x00C0, + 0x00410301: 0x00C1, + 0x00410302: 0x00C2, + 0x00410303: 0x00C3, + 0x00410308: 0x00C4, + 0x0041030A: 0x00C5, + 0x00430327: 0x00C7, + 0x00450300: 0x00C8, + 0x00450301: 0x00C9, + 0x00450302: 0x00CA, + 0x00450308: 0x00CB, + 0x00490300: 0x00CC, + 0x00490301: 0x00CD, + 0x00490302: 0x00CE, + 0x00490308: 0x00CF, + 0x004E0303: 0x00D1, + 0x004F0300: 0x00D2, + 0x004F0301: 0x00D3, + 0x004F0302: 0x00D4, + 0x004F0303: 0x00D5, + 0x004F0308: 0x00D6, + 0x00550300: 0x00D9, + 0x00550301: 0x00DA, + 0x00550302: 0x00DB, + 0x00550308: 0x00DC, + 0x00590301: 0x00DD, + 0x00610300: 0x00E0, + 0x00610301: 0x00E1, + 0x00610302: 0x00E2, + 0x00610303: 0x00E3, + 0x00610308: 0x00E4, + 0x0061030A: 0x00E5, + 0x00630327: 0x00E7, + 0x00650300: 0x00E8, + 0x00650301: 0x00E9, + 0x00650302: 0x00EA, + 0x00650308: 0x00EB, + 0x00690300: 0x00EC, + 0x00690301: 0x00ED, + 0x00690302: 0x00EE, + 0x00690308: 0x00EF, + 0x006E0303: 0x00F1, + 0x006F0300: 0x00F2, + 0x006F0301: 0x00F3, + 0x006F0302: 0x00F4, + 0x006F0303: 0x00F5, + 0x006F0308: 0x00F6, + 0x00750300: 0x00F9, + 0x00750301: 0x00FA, + 0x00750302: 0x00FB, + 0x00750308: 0x00FC, + 0x00790301: 0x00FD, + 0x00790308: 0x00FF, + 0x00410304: 0x0100, + 0x00610304: 0x0101, + 0x00410306: 0x0102, + 0x00610306: 0x0103, + 0x00410328: 0x0104, + 0x00610328: 0x0105, + 0x00430301: 0x0106, + 0x00630301: 0x0107, + 0x00430302: 0x0108, + 0x00630302: 0x0109, + 0x00430307: 0x010A, + 0x00630307: 0x010B, + 0x0043030C: 0x010C, + 0x0063030C: 0x010D, + 0x0044030C: 0x010E, + 0x0064030C: 0x010F, + 0x00450304: 0x0112, + 0x00650304: 0x0113, + 0x00450306: 0x0114, + 0x00650306: 0x0115, + 0x00450307: 0x0116, + 0x00650307: 0x0117, + 0x00450328: 0x0118, + 0x00650328: 0x0119, + 0x0045030C: 0x011A, + 0x0065030C: 0x011B, + 0x00470302: 0x011C, + 0x00670302: 0x011D, + 0x00470306: 0x011E, + 0x00670306: 0x011F, + 0x00470307: 0x0120, + 0x00670307: 0x0121, + 0x00470327: 0x0122, + 0x00670327: 0x0123, + 0x00480302: 0x0124, + 0x00680302: 0x0125, + 0x00490303: 0x0128, + 0x00690303: 0x0129, + 0x00490304: 0x012A, + 0x00690304: 0x012B, + 0x00490306: 0x012C, + 0x00690306: 0x012D, + 0x00490328: 0x012E, + 0x00690328: 0x012F, + 0x00490307: 0x0130, + 0x004A0302: 0x0134, + 0x006A0302: 0x0135, + 0x004B0327: 0x0136, + 0x006B0327: 0x0137, + 0x004C0301: 0x0139, + 0x006C0301: 0x013A, + 0x004C0327: 0x013B, + 0x006C0327: 0x013C, + 0x004C030C: 0x013D, + 0x006C030C: 0x013E, + 0x004E0301: 0x0143, + 0x006E0301: 0x0144, + 0x004E0327: 0x0145, + 0x006E0327: 0x0146, + 0x004E030C: 0x0147, + 0x006E030C: 0x0148, + 0x004F0304: 0x014C, + 0x006F0304: 0x014D, + 0x004F0306: 0x014E, + 0x006F0306: 0x014F, + 0x004F030B: 0x0150, + 0x006F030B: 0x0151, + 0x00520301: 0x0154, + 0x00720301: 0x0155, + 0x00520327: 0x0156, + 0x00720327: 0x0157, + 0x0052030C: 0x0158, + 0x0072030C: 0x0159, + 0x00530301: 0x015A, + 0x00730301: 0x015B, + 0x00530302: 0x015C, + 0x00730302: 0x015D, + 0x00530327: 0x015E, + 0x00730327: 0x015F, + 0x0053030C: 0x0160, + 0x0073030C: 0x0161, + 0x00540327: 0x0162, + 0x00740327: 0x0163, + 0x0054030C: 0x0164, + 0x0074030C: 0x0165, + 0x00550303: 0x0168, + 0x00750303: 0x0169, + 0x00550304: 0x016A, + 0x00750304: 0x016B, + 0x00550306: 0x016C, + 0x00750306: 0x016D, + 0x0055030A: 0x016E, + 0x0075030A: 0x016F, + 0x0055030B: 0x0170, + 0x0075030B: 0x0171, + 0x00550328: 0x0172, + 0x00750328: 0x0173, + 0x00570302: 0x0174, + 0x00770302: 0x0175, + 0x00590302: 0x0176, + 0x00790302: 0x0177, + 0x00590308: 0x0178, + 0x005A0301: 0x0179, + 0x007A0301: 0x017A, + 0x005A0307: 0x017B, + 0x007A0307: 0x017C, + 0x005A030C: 0x017D, + 0x007A030C: 0x017E, + 0x004F031B: 0x01A0, + 0x006F031B: 0x01A1, + 0x0055031B: 0x01AF, + 0x0075031B: 0x01B0, + 0x0041030C: 0x01CD, + 0x0061030C: 0x01CE, + 0x0049030C: 0x01CF, + 0x0069030C: 0x01D0, + 0x004F030C: 0x01D1, + 0x006F030C: 0x01D2, + 0x0055030C: 0x01D3, + 0x0075030C: 0x01D4, + 0x00DC0304: 0x01D5, + 0x00FC0304: 0x01D6, + 0x00DC0301: 0x01D7, + 0x00FC0301: 0x01D8, + 0x00DC030C: 0x01D9, + 0x00FC030C: 0x01DA, + 0x00DC0300: 0x01DB, + 0x00FC0300: 0x01DC, + 0x00C40304: 0x01DE, + 0x00E40304: 0x01DF, + 0x02260304: 0x01E0, + 0x02270304: 0x01E1, + 0x00C60304: 0x01E2, + 0x00E60304: 0x01E3, + 0x0047030C: 0x01E6, + 0x0067030C: 0x01E7, + 0x004B030C: 0x01E8, + 0x006B030C: 0x01E9, + 0x004F0328: 0x01EA, + 0x006F0328: 0x01EB, + 0x01EA0304: 0x01EC, + 0x01EB0304: 0x01ED, + 0x01B7030C: 0x01EE, + 0x0292030C: 0x01EF, + 0x006A030C: 0x01F0, + 0x00470301: 0x01F4, + 0x00670301: 0x01F5, + 0x004E0300: 0x01F8, + 0x006E0300: 0x01F9, + 0x00C50301: 0x01FA, + 0x00E50301: 0x01FB, + 0x00C60301: 0x01FC, + 0x00E60301: 0x01FD, + 0x00D80301: 0x01FE, + 0x00F80301: 0x01FF, + 0x0041030F: 0x0200, + 0x0061030F: 0x0201, + 0x00410311: 0x0202, + 0x00610311: 0x0203, + 0x0045030F: 0x0204, + 0x0065030F: 0x0205, + 0x00450311: 0x0206, + 0x00650311: 0x0207, + 0x0049030F: 0x0208, + 0x0069030F: 0x0209, + 0x00490311: 0x020A, + 0x00690311: 0x020B, + 0x004F030F: 0x020C, + 0x006F030F: 0x020D, + 0x004F0311: 0x020E, + 0x006F0311: 0x020F, + 0x0052030F: 0x0210, + 0x0072030F: 0x0211, + 0x00520311: 0x0212, + 0x00720311: 0x0213, + 0x0055030F: 0x0214, + 0x0075030F: 0x0215, + 0x00550311: 0x0216, + 0x00750311: 0x0217, + 0x00530326: 0x0218, + 0x00730326: 0x0219, + 0x00540326: 0x021A, + 0x00740326: 0x021B, + 0x0048030C: 0x021E, + 0x0068030C: 0x021F, + 0x00410307: 0x0226, + 0x00610307: 0x0227, + 0x00450327: 0x0228, + 0x00650327: 0x0229, + 0x00D60304: 0x022A, + 0x00F60304: 0x022B, + 0x00D50304: 0x022C, + 0x00F50304: 0x022D, + 0x004F0307: 0x022E, + 0x006F0307: 0x022F, + 0x022E0304: 0x0230, + 0x022F0304: 0x0231, + 0x00590304: 0x0232, + 0x00790304: 0x0233, + 0x00A80301: 0x0385, + 0x03910301: 0x0386, + 0x03950301: 0x0388, + 0x03970301: 0x0389, + 0x03990301: 0x038A, + 0x039F0301: 0x038C, + 0x03A50301: 0x038E, + 0x03A90301: 0x038F, + 0x03CA0301: 0x0390, + 0x03990308: 0x03AA, + 0x03A50308: 0x03AB, + 0x03B10301: 0x03AC, + 0x03B50301: 0x03AD, + 0x03B70301: 0x03AE, + 0x03B90301: 0x03AF, + 0x03CB0301: 0x03B0, + 0x03B90308: 0x03CA, + 0x03C50308: 0x03CB, + 0x03BF0301: 0x03CC, + 0x03C50301: 0x03CD, + 0x03C90301: 0x03CE, + 0x03D20301: 0x03D3, + 0x03D20308: 0x03D4, + 0x04150300: 0x0400, + 0x04150308: 0x0401, + 0x04130301: 0x0403, + 0x04060308: 0x0407, + 0x041A0301: 0x040C, + 0x04180300: 0x040D, + 0x04230306: 0x040E, + 0x04180306: 0x0419, + 0x04380306: 0x0439, + 0x04350300: 0x0450, + 0x04350308: 0x0451, + 0x04330301: 0x0453, + 0x04560308: 0x0457, + 0x043A0301: 0x045C, + 0x04380300: 0x045D, + 0x04430306: 0x045E, + 0x0474030F: 0x0476, + 0x0475030F: 0x0477, + 0x04160306: 0x04C1, + 0x04360306: 0x04C2, + 0x04100306: 0x04D0, + 0x04300306: 0x04D1, + 0x04100308: 0x04D2, + 0x04300308: 0x04D3, + 0x04150306: 0x04D6, + 0x04350306: 0x04D7, + 0x04D80308: 0x04DA, + 0x04D90308: 0x04DB, + 0x04160308: 0x04DC, + 0x04360308: 0x04DD, + 0x04170308: 0x04DE, + 0x04370308: 0x04DF, + 0x04180304: 0x04E2, + 0x04380304: 0x04E3, + 0x04180308: 0x04E4, + 0x04380308: 0x04E5, + 0x041E0308: 0x04E6, + 0x043E0308: 0x04E7, + 0x04E80308: 0x04EA, + 0x04E90308: 0x04EB, + 0x042D0308: 0x04EC, + 0x044D0308: 0x04ED, + 0x04230304: 0x04EE, + 0x04430304: 0x04EF, + 0x04230308: 0x04F0, + 0x04430308: 0x04F1, + 0x0423030B: 0x04F2, + 0x0443030B: 0x04F3, + 0x04270308: 0x04F4, + 0x04470308: 0x04F5, + 0x042B0308: 0x04F8, + 0x044B0308: 0x04F9, + 0x06270653: 0x0622, + 0x06270654: 0x0623, + 0x06480654: 0x0624, + 0x06270655: 0x0625, + 0x064A0654: 0x0626, + 0x06D50654: 0x06C0, + 0x06C10654: 0x06C2, + 0x06D20654: 0x06D3, + 0x0928093C: 0x0929, + 0x0930093C: 0x0931, + 0x0933093C: 0x0934, + 0x09C709BE: 0x09CB, + 0x09C709D7: 0x09CC, + 0x0B470B56: 0x0B48, + 0x0B470B3E: 0x0B4B, + 0x0B470B57: 0x0B4C, + 0x0B920BD7: 0x0B94, + 0x0BC60BBE: 0x0BCA, + 0x0BC70BBE: 0x0BCB, + 0x0BC60BD7: 0x0BCC, + 0x0C460C56: 0x0C48, + 0x0CBF0CD5: 0x0CC0, + 0x0CC60CD5: 0x0CC7, + 0x0CC60CD6: 0x0CC8, + 0x0CC60CC2: 0x0CCA, + 0x0CCA0CD5: 0x0CCB, + 0x0D460D3E: 0x0D4A, + 0x0D470D3E: 0x0D4B, + 0x0D460D57: 0x0D4C, + 0x0DD90DCA: 0x0DDA, + 0x0DD90DCF: 0x0DDC, + 0x0DDC0DCA: 0x0DDD, + 0x0DD90DDF: 0x0DDE, + 0x1025102E: 0x1026, + 0x1B051B35: 0x1B06, + 0x1B071B35: 0x1B08, + 0x1B091B35: 0x1B0A, + 0x1B0B1B35: 0x1B0C, + 0x1B0D1B35: 0x1B0E, + 0x1B111B35: 0x1B12, + 0x1B3A1B35: 0x1B3B, + 0x1B3C1B35: 0x1B3D, + 0x1B3E1B35: 0x1B40, + 0x1B3F1B35: 0x1B41, + 0x1B421B35: 0x1B43, + 0x00410325: 0x1E00, + 0x00610325: 0x1E01, + 0x00420307: 0x1E02, + 0x00620307: 0x1E03, + 0x00420323: 0x1E04, + 0x00620323: 0x1E05, + 0x00420331: 0x1E06, + 0x00620331: 0x1E07, + 0x00C70301: 0x1E08, + 0x00E70301: 0x1E09, + 0x00440307: 0x1E0A, + 0x00640307: 0x1E0B, + 0x00440323: 0x1E0C, + 0x00640323: 0x1E0D, + 0x00440331: 0x1E0E, + 0x00640331: 0x1E0F, + 0x00440327: 0x1E10, + 0x00640327: 0x1E11, + 0x0044032D: 0x1E12, + 0x0064032D: 0x1E13, + 0x01120300: 0x1E14, + 0x01130300: 0x1E15, + 0x01120301: 0x1E16, + 0x01130301: 0x1E17, + 0x0045032D: 0x1E18, + 0x0065032D: 0x1E19, + 0x00450330: 0x1E1A, + 0x00650330: 0x1E1B, + 0x02280306: 0x1E1C, + 0x02290306: 0x1E1D, + 0x00460307: 0x1E1E, + 0x00660307: 0x1E1F, + 0x00470304: 0x1E20, + 0x00670304: 0x1E21, + 0x00480307: 0x1E22, + 0x00680307: 0x1E23, + 0x00480323: 0x1E24, + 0x00680323: 0x1E25, + 0x00480308: 0x1E26, + 0x00680308: 0x1E27, + 0x00480327: 0x1E28, + 0x00680327: 0x1E29, + 0x0048032E: 0x1E2A, + 0x0068032E: 0x1E2B, + 0x00490330: 0x1E2C, + 0x00690330: 0x1E2D, + 0x00CF0301: 0x1E2E, + 0x00EF0301: 0x1E2F, + 0x004B0301: 0x1E30, + 0x006B0301: 0x1E31, + 0x004B0323: 0x1E32, + 0x006B0323: 0x1E33, + 0x004B0331: 0x1E34, + 0x006B0331: 0x1E35, + 0x004C0323: 0x1E36, + 0x006C0323: 0x1E37, + 0x1E360304: 0x1E38, + 0x1E370304: 0x1E39, + 0x004C0331: 0x1E3A, + 0x006C0331: 0x1E3B, + 0x004C032D: 0x1E3C, + 0x006C032D: 0x1E3D, + 0x004D0301: 0x1E3E, + 0x006D0301: 0x1E3F, + 0x004D0307: 0x1E40, + 0x006D0307: 0x1E41, + 0x004D0323: 0x1E42, + 0x006D0323: 0x1E43, + 0x004E0307: 0x1E44, + 0x006E0307: 0x1E45, + 0x004E0323: 0x1E46, + 0x006E0323: 0x1E47, + 0x004E0331: 0x1E48, + 0x006E0331: 0x1E49, + 0x004E032D: 0x1E4A, + 0x006E032D: 0x1E4B, + 0x00D50301: 0x1E4C, + 0x00F50301: 0x1E4D, + 0x00D50308: 0x1E4E, + 0x00F50308: 0x1E4F, + 0x014C0300: 0x1E50, + 0x014D0300: 0x1E51, + 0x014C0301: 0x1E52, + 0x014D0301: 0x1E53, + 0x00500301: 0x1E54, + 0x00700301: 0x1E55, + 0x00500307: 0x1E56, + 0x00700307: 0x1E57, + 0x00520307: 0x1E58, + 0x00720307: 0x1E59, + 0x00520323: 0x1E5A, + 0x00720323: 0x1E5B, + 0x1E5A0304: 0x1E5C, + 0x1E5B0304: 0x1E5D, + 0x00520331: 0x1E5E, + 0x00720331: 0x1E5F, + 0x00530307: 0x1E60, + 0x00730307: 0x1E61, + 0x00530323: 0x1E62, + 0x00730323: 0x1E63, + 0x015A0307: 0x1E64, + 0x015B0307: 0x1E65, + 0x01600307: 0x1E66, + 0x01610307: 0x1E67, + 0x1E620307: 0x1E68, + 0x1E630307: 0x1E69, + 0x00540307: 0x1E6A, + 0x00740307: 0x1E6B, + 0x00540323: 0x1E6C, + 0x00740323: 0x1E6D, + 0x00540331: 0x1E6E, + 0x00740331: 0x1E6F, + 0x0054032D: 0x1E70, + 0x0074032D: 0x1E71, + 0x00550324: 0x1E72, + 0x00750324: 0x1E73, + 0x00550330: 0x1E74, + 0x00750330: 0x1E75, + 0x0055032D: 0x1E76, + 0x0075032D: 0x1E77, + 0x01680301: 0x1E78, + 0x01690301: 0x1E79, + 0x016A0308: 0x1E7A, + 0x016B0308: 0x1E7B, + 0x00560303: 0x1E7C, + 0x00760303: 0x1E7D, + 0x00560323: 0x1E7E, + 0x00760323: 0x1E7F, + 0x00570300: 0x1E80, + 0x00770300: 0x1E81, + 0x00570301: 0x1E82, + 0x00770301: 0x1E83, + 0x00570308: 0x1E84, + 0x00770308: 0x1E85, + 0x00570307: 0x1E86, + 0x00770307: 0x1E87, + 0x00570323: 0x1E88, + 0x00770323: 0x1E89, + 0x00580307: 0x1E8A, + 0x00780307: 0x1E8B, + 0x00580308: 0x1E8C, + 0x00780308: 0x1E8D, + 0x00590307: 0x1E8E, + 0x00790307: 0x1E8F, + 0x005A0302: 0x1E90, + 0x007A0302: 0x1E91, + 0x005A0323: 0x1E92, + 0x007A0323: 0x1E93, + 0x005A0331: 0x1E94, + 0x007A0331: 0x1E95, + 0x00680331: 0x1E96, + 0x00740308: 0x1E97, + 0x0077030A: 0x1E98, + 0x0079030A: 0x1E99, + 0x017F0307: 0x1E9B, + 0x00410323: 0x1EA0, + 0x00610323: 0x1EA1, + 0x00410309: 0x1EA2, + 0x00610309: 0x1EA3, + 0x00C20301: 0x1EA4, + 0x00E20301: 0x1EA5, + 0x00C20300: 0x1EA6, + 0x00E20300: 0x1EA7, + 0x00C20309: 0x1EA8, + 0x00E20309: 0x1EA9, + 0x00C20303: 0x1EAA, + 0x00E20303: 0x1EAB, + 0x1EA00302: 0x1EAC, + 0x1EA10302: 0x1EAD, + 0x01020301: 0x1EAE, + 0x01030301: 0x1EAF, + 0x01020300: 0x1EB0, + 0x01030300: 0x1EB1, + 0x01020309: 0x1EB2, + 0x01030309: 0x1EB3, + 0x01020303: 0x1EB4, + 0x01030303: 0x1EB5, + 0x1EA00306: 0x1EB6, + 0x1EA10306: 0x1EB7, + 0x00450323: 0x1EB8, + 0x00650323: 0x1EB9, + 0x00450309: 0x1EBA, + 0x00650309: 0x1EBB, + 0x00450303: 0x1EBC, + 0x00650303: 0x1EBD, + 0x00CA0301: 0x1EBE, + 0x00EA0301: 0x1EBF, + 0x00CA0300: 0x1EC0, + 0x00EA0300: 0x1EC1, + 0x00CA0309: 0x1EC2, + 0x00EA0309: 0x1EC3, + 0x00CA0303: 0x1EC4, + 0x00EA0303: 0x1EC5, + 0x1EB80302: 0x1EC6, + 0x1EB90302: 0x1EC7, + 0x00490309: 0x1EC8, + 0x00690309: 0x1EC9, + 0x00490323: 0x1ECA, + 0x00690323: 0x1ECB, + 0x004F0323: 0x1ECC, + 0x006F0323: 0x1ECD, + 0x004F0309: 0x1ECE, + 0x006F0309: 0x1ECF, + 0x00D40301: 0x1ED0, + 0x00F40301: 0x1ED1, + 0x00D40300: 0x1ED2, + 0x00F40300: 0x1ED3, + 0x00D40309: 0x1ED4, + 0x00F40309: 0x1ED5, + 0x00D40303: 0x1ED6, + 0x00F40303: 0x1ED7, + 0x1ECC0302: 0x1ED8, + 0x1ECD0302: 0x1ED9, + 0x01A00301: 0x1EDA, + 0x01A10301: 0x1EDB, + 0x01A00300: 0x1EDC, + 0x01A10300: 0x1EDD, + 0x01A00309: 0x1EDE, + 0x01A10309: 0x1EDF, + 0x01A00303: 0x1EE0, + 0x01A10303: 0x1EE1, + 0x01A00323: 0x1EE2, + 0x01A10323: 0x1EE3, + 0x00550323: 0x1EE4, + 0x00750323: 0x1EE5, + 0x00550309: 0x1EE6, + 0x00750309: 0x1EE7, + 0x01AF0301: 0x1EE8, + 0x01B00301: 0x1EE9, + 0x01AF0300: 0x1EEA, + 0x01B00300: 0x1EEB, + 0x01AF0309: 0x1EEC, + 0x01B00309: 0x1EED, + 0x01AF0303: 0x1EEE, + 0x01B00303: 0x1EEF, + 0x01AF0323: 0x1EF0, + 0x01B00323: 0x1EF1, + 0x00590300: 0x1EF2, + 0x00790300: 0x1EF3, + 0x00590323: 0x1EF4, + 0x00790323: 0x1EF5, + 0x00590309: 0x1EF6, + 0x00790309: 0x1EF7, + 0x00590303: 0x1EF8, + 0x00790303: 0x1EF9, + 0x03B10313: 0x1F00, + 0x03B10314: 0x1F01, + 0x1F000300: 0x1F02, + 0x1F010300: 0x1F03, + 0x1F000301: 0x1F04, + 0x1F010301: 0x1F05, + 0x1F000342: 0x1F06, + 0x1F010342: 0x1F07, + 0x03910313: 0x1F08, + 0x03910314: 0x1F09, + 0x1F080300: 0x1F0A, + 0x1F090300: 0x1F0B, + 0x1F080301: 0x1F0C, + 0x1F090301: 0x1F0D, + 0x1F080342: 0x1F0E, + 0x1F090342: 0x1F0F, + 0x03B50313: 0x1F10, + 0x03B50314: 0x1F11, + 0x1F100300: 0x1F12, + 0x1F110300: 0x1F13, + 0x1F100301: 0x1F14, + 0x1F110301: 0x1F15, + 0x03950313: 0x1F18, + 0x03950314: 0x1F19, + 0x1F180300: 0x1F1A, + 0x1F190300: 0x1F1B, + 0x1F180301: 0x1F1C, + 0x1F190301: 0x1F1D, + 0x03B70313: 0x1F20, + 0x03B70314: 0x1F21, + 0x1F200300: 0x1F22, + 0x1F210300: 0x1F23, + 0x1F200301: 0x1F24, + 0x1F210301: 0x1F25, + 0x1F200342: 0x1F26, + 0x1F210342: 0x1F27, + 0x03970313: 0x1F28, + 0x03970314: 0x1F29, + 0x1F280300: 0x1F2A, + 0x1F290300: 0x1F2B, + 0x1F280301: 0x1F2C, + 0x1F290301: 0x1F2D, + 0x1F280342: 0x1F2E, + 0x1F290342: 0x1F2F, + 0x03B90313: 0x1F30, + 0x03B90314: 0x1F31, + 0x1F300300: 0x1F32, + 0x1F310300: 0x1F33, + 0x1F300301: 0x1F34, + 0x1F310301: 0x1F35, + 0x1F300342: 0x1F36, + 0x1F310342: 0x1F37, + 0x03990313: 0x1F38, + 0x03990314: 0x1F39, + 0x1F380300: 0x1F3A, + 0x1F390300: 0x1F3B, + 0x1F380301: 0x1F3C, + 0x1F390301: 0x1F3D, + 0x1F380342: 0x1F3E, + 0x1F390342: 0x1F3F, + 0x03BF0313: 0x1F40, + 0x03BF0314: 0x1F41, + 0x1F400300: 0x1F42, + 0x1F410300: 0x1F43, + 0x1F400301: 0x1F44, + 0x1F410301: 0x1F45, + 0x039F0313: 0x1F48, + 0x039F0314: 0x1F49, + 0x1F480300: 0x1F4A, + 0x1F490300: 0x1F4B, + 0x1F480301: 0x1F4C, + 0x1F490301: 0x1F4D, + 0x03C50313: 0x1F50, + 0x03C50314: 0x1F51, + 0x1F500300: 0x1F52, + 0x1F510300: 0x1F53, + 0x1F500301: 0x1F54, + 0x1F510301: 0x1F55, + 0x1F500342: 0x1F56, + 0x1F510342: 0x1F57, + 0x03A50314: 0x1F59, + 0x1F590300: 0x1F5B, + 0x1F590301: 0x1F5D, + 0x1F590342: 0x1F5F, + 0x03C90313: 0x1F60, + 0x03C90314: 0x1F61, + 0x1F600300: 0x1F62, + 0x1F610300: 0x1F63, + 0x1F600301: 0x1F64, + 0x1F610301: 0x1F65, + 0x1F600342: 0x1F66, + 0x1F610342: 0x1F67, + 0x03A90313: 0x1F68, + 0x03A90314: 0x1F69, + 0x1F680300: 0x1F6A, + 0x1F690300: 0x1F6B, + 0x1F680301: 0x1F6C, + 0x1F690301: 0x1F6D, + 0x1F680342: 0x1F6E, + 0x1F690342: 0x1F6F, + 0x03B10300: 0x1F70, + 0x03B50300: 0x1F72, + 0x03B70300: 0x1F74, + 0x03B90300: 0x1F76, + 0x03BF0300: 0x1F78, + 0x03C50300: 0x1F7A, + 0x03C90300: 0x1F7C, + 0x1F000345: 0x1F80, + 0x1F010345: 0x1F81, + 0x1F020345: 0x1F82, + 0x1F030345: 0x1F83, + 0x1F040345: 0x1F84, + 0x1F050345: 0x1F85, + 0x1F060345: 0x1F86, + 0x1F070345: 0x1F87, + 0x1F080345: 0x1F88, + 0x1F090345: 0x1F89, + 0x1F0A0345: 0x1F8A, + 0x1F0B0345: 0x1F8B, + 0x1F0C0345: 0x1F8C, + 0x1F0D0345: 0x1F8D, + 0x1F0E0345: 0x1F8E, + 0x1F0F0345: 0x1F8F, + 0x1F200345: 0x1F90, + 0x1F210345: 0x1F91, + 0x1F220345: 0x1F92, + 0x1F230345: 0x1F93, + 0x1F240345: 0x1F94, + 0x1F250345: 0x1F95, + 0x1F260345: 0x1F96, + 0x1F270345: 0x1F97, + 0x1F280345: 0x1F98, + 0x1F290345: 0x1F99, + 0x1F2A0345: 0x1F9A, + 0x1F2B0345: 0x1F9B, + 0x1F2C0345: 0x1F9C, + 0x1F2D0345: 0x1F9D, + 0x1F2E0345: 0x1F9E, + 0x1F2F0345: 0x1F9F, + 0x1F600345: 0x1FA0, + 0x1F610345: 0x1FA1, + 0x1F620345: 0x1FA2, + 0x1F630345: 0x1FA3, + 0x1F640345: 0x1FA4, + 0x1F650345: 0x1FA5, + 0x1F660345: 0x1FA6, + 0x1F670345: 0x1FA7, + 0x1F680345: 0x1FA8, + 0x1F690345: 0x1FA9, + 0x1F6A0345: 0x1FAA, + 0x1F6B0345: 0x1FAB, + 0x1F6C0345: 0x1FAC, + 0x1F6D0345: 0x1FAD, + 0x1F6E0345: 0x1FAE, + 0x1F6F0345: 0x1FAF, + 0x03B10306: 0x1FB0, + 0x03B10304: 0x1FB1, + 0x1F700345: 0x1FB2, + 0x03B10345: 0x1FB3, + 0x03AC0345: 0x1FB4, + 0x03B10342: 0x1FB6, + 0x1FB60345: 0x1FB7, + 0x03910306: 0x1FB8, + 0x03910304: 0x1FB9, + 0x03910300: 0x1FBA, + 0x03910345: 0x1FBC, + 0x00A80342: 0x1FC1, + 0x1F740345: 0x1FC2, + 0x03B70345: 0x1FC3, + 0x03AE0345: 0x1FC4, + 0x03B70342: 0x1FC6, + 0x1FC60345: 0x1FC7, + 0x03950300: 0x1FC8, + 0x03970300: 0x1FCA, + 0x03970345: 0x1FCC, + 0x1FBF0300: 0x1FCD, + 0x1FBF0301: 0x1FCE, + 0x1FBF0342: 0x1FCF, + 0x03B90306: 0x1FD0, + 0x03B90304: 0x1FD1, + 0x03CA0300: 0x1FD2, + 0x03B90342: 0x1FD6, + 0x03CA0342: 0x1FD7, + 0x03990306: 0x1FD8, + 0x03990304: 0x1FD9, + 0x03990300: 0x1FDA, + 0x1FFE0300: 0x1FDD, + 0x1FFE0301: 0x1FDE, + 0x1FFE0342: 0x1FDF, + 0x03C50306: 0x1FE0, + 0x03C50304: 0x1FE1, + 0x03CB0300: 0x1FE2, + 0x03C10313: 0x1FE4, + 0x03C10314: 0x1FE5, + 0x03C50342: 0x1FE6, + 0x03CB0342: 0x1FE7, + 0x03A50306: 0x1FE8, + 0x03A50304: 0x1FE9, + 0x03A50300: 0x1FEA, + 0x03A10314: 0x1FEC, + 0x00A80300: 0x1FED, + 0x1F7C0345: 0x1FF2, + 0x03C90345: 0x1FF3, + 0x03CE0345: 0x1FF4, + 0x03C90342: 0x1FF6, + 0x1FF60345: 0x1FF7, + 0x039F0300: 0x1FF8, + 0x03A90300: 0x1FFA, + 0x03A90345: 0x1FFC, + 0x21900338: 0x219A, + 0x21920338: 0x219B, + 0x21940338: 0x21AE, + 0x21D00338: 0x21CD, + 0x21D40338: 0x21CE, + 0x21D20338: 0x21CF, + 0x22030338: 0x2204, + 0x22080338: 0x2209, + 0x220B0338: 0x220C, + 0x22230338: 0x2224, + 0x22250338: 0x2226, + 0x223C0338: 0x2241, + 0x22430338: 0x2244, + 0x22450338: 0x2247, + 0x22480338: 0x2249, + 0x003D0338: 0x2260, + 0x22610338: 0x2262, + 0x224D0338: 0x226D, + 0x003C0338: 0x226E, + 0x003E0338: 0x226F, + 0x22640338: 0x2270, + 0x22650338: 0x2271, + 0x22720338: 0x2274, + 0x22730338: 0x2275, + 0x22760338: 0x2278, + 0x22770338: 0x2279, + 0x227A0338: 0x2280, + 0x227B0338: 0x2281, + 0x22820338: 0x2284, + 0x22830338: 0x2285, + 0x22860338: 0x2288, + 0x22870338: 0x2289, + 0x22A20338: 0x22AC, + 0x22A80338: 0x22AD, + 0x22A90338: 0x22AE, + 0x22AB0338: 0x22AF, + 0x227C0338: 0x22E0, + 0x227D0338: 0x22E1, + 0x22910338: 0x22E2, + 0x22920338: 0x22E3, + 0x22B20338: 0x22EA, + 0x22B30338: 0x22EB, + 0x22B40338: 0x22EC, + 0x22B50338: 0x22ED, + 0x304B3099: 0x304C, + 0x304D3099: 0x304E, + 0x304F3099: 0x3050, + 0x30513099: 0x3052, + 0x30533099: 0x3054, + 0x30553099: 0x3056, + 0x30573099: 0x3058, + 0x30593099: 0x305A, + 0x305B3099: 0x305C, + 0x305D3099: 0x305E, + 0x305F3099: 0x3060, + 0x30613099: 0x3062, + 0x30643099: 0x3065, + 0x30663099: 0x3067, + 0x30683099: 0x3069, + 0x306F3099: 0x3070, + 0x306F309A: 0x3071, + 0x30723099: 0x3073, + 0x3072309A: 0x3074, + 0x30753099: 0x3076, + 0x3075309A: 0x3077, + 0x30783099: 0x3079, + 0x3078309A: 0x307A, + 0x307B3099: 0x307C, + 0x307B309A: 0x307D, + 0x30463099: 0x3094, + 0x309D3099: 0x309E, + 0x30AB3099: 0x30AC, + 0x30AD3099: 0x30AE, + 0x30AF3099: 0x30B0, + 0x30B13099: 0x30B2, + 0x30B33099: 0x30B4, + 0x30B53099: 0x30B6, + 0x30B73099: 0x30B8, + 0x30B93099: 0x30BA, + 0x30BB3099: 0x30BC, + 0x30BD3099: 0x30BE, + 0x30BF3099: 0x30C0, + 0x30C13099: 0x30C2, + 0x30C43099: 0x30C5, + 0x30C63099: 0x30C7, + 0x30C83099: 0x30C9, + 0x30CF3099: 0x30D0, + 0x30CF309A: 0x30D1, + 0x30D23099: 0x30D3, + 0x30D2309A: 0x30D4, + 0x30D53099: 0x30D6, + 0x30D5309A: 0x30D7, + 0x30D83099: 0x30D9, + 0x30D8309A: 0x30DA, + 0x30DB3099: 0x30DC, + 0x30DB309A: 0x30DD, + 0x30A63099: 0x30F4, + 0x30EF3099: 0x30F7, + 0x30F03099: 0x30F8, + 0x30F13099: 0x30F9, + 0x30F23099: 0x30FA, + 0x30FD3099: 0x30FE, + 0x109910BA: 0x1109A, + 0x109B10BA: 0x1109C, + 0x10A510BA: 0x110AB, + 0x11311127: 0x1112E, + 0x11321127: 0x1112F, + 0x1347133E: 0x1134B, + 0x13471357: 0x1134C, + 0x14B914BA: 0x114BB, + 0x14B914B0: 0x114BC, + 0x14B914BD: 0x114BE, + 0x15B815AF: 0x115BA, + 0x15B915AF: 0x115BB, +} -const recompMapPacked = "" + - "\x00A\x03\x00\x00\x00\x00\xc0" + // 0x00410300: 0x000000C0 - "\x00A\x03\x01\x00\x00\x00\xc1" + // 0x00410301: 0x000000C1 - "\x00A\x03\x02\x00\x00\x00\xc2" + // 0x00410302: 0x000000C2 - "\x00A\x03\x03\x00\x00\x00\xc3" + // 0x00410303: 0x000000C3 - "\x00A\x03\b\x00\x00\x00\xc4" + // 0x00410308: 0x000000C4 - "\x00A\x03\n\x00\x00\x00\xc5" + // 0x0041030A: 0x000000C5 - "\x00C\x03'\x00\x00\x00\xc7" + // 0x00430327: 0x000000C7 - "\x00E\x03\x00\x00\x00\x00\xc8" + // 0x00450300: 0x000000C8 - "\x00E\x03\x01\x00\x00\x00\xc9" + // 0x00450301: 0x000000C9 - "\x00E\x03\x02\x00\x00\x00\xca" + // 0x00450302: 0x000000CA - "\x00E\x03\b\x00\x00\x00\xcb" + // 0x00450308: 0x000000CB - "\x00I\x03\x00\x00\x00\x00\xcc" + // 0x00490300: 0x000000CC - "\x00I\x03\x01\x00\x00\x00\xcd" + // 0x00490301: 0x000000CD - "\x00I\x03\x02\x00\x00\x00\xce" + // 0x00490302: 0x000000CE - "\x00I\x03\b\x00\x00\x00\xcf" + // 0x00490308: 0x000000CF - "\x00N\x03\x03\x00\x00\x00\xd1" + // 0x004E0303: 0x000000D1 - "\x00O\x03\x00\x00\x00\x00\xd2" + // 0x004F0300: 0x000000D2 - "\x00O\x03\x01\x00\x00\x00\xd3" + // 0x004F0301: 0x000000D3 - "\x00O\x03\x02\x00\x00\x00\xd4" + // 0x004F0302: 0x000000D4 - "\x00O\x03\x03\x00\x00\x00\xd5" + // 0x004F0303: 0x000000D5 - "\x00O\x03\b\x00\x00\x00\xd6" + // 0x004F0308: 0x000000D6 - "\x00U\x03\x00\x00\x00\x00\xd9" + // 0x00550300: 0x000000D9 - "\x00U\x03\x01\x00\x00\x00\xda" + // 0x00550301: 0x000000DA - "\x00U\x03\x02\x00\x00\x00\xdb" + // 0x00550302: 0x000000DB - "\x00U\x03\b\x00\x00\x00\xdc" + // 0x00550308: 0x000000DC - "\x00Y\x03\x01\x00\x00\x00\xdd" + // 0x00590301: 0x000000DD - "\x00a\x03\x00\x00\x00\x00\xe0" + // 0x00610300: 0x000000E0 - "\x00a\x03\x01\x00\x00\x00\xe1" + // 0x00610301: 0x000000E1 - "\x00a\x03\x02\x00\x00\x00\xe2" + // 0x00610302: 0x000000E2 - "\x00a\x03\x03\x00\x00\x00\xe3" + // 0x00610303: 0x000000E3 - "\x00a\x03\b\x00\x00\x00\xe4" + // 0x00610308: 0x000000E4 - "\x00a\x03\n\x00\x00\x00\xe5" + // 0x0061030A: 0x000000E5 - "\x00c\x03'\x00\x00\x00\xe7" + // 0x00630327: 0x000000E7 - "\x00e\x03\x00\x00\x00\x00\xe8" + // 0x00650300: 0x000000E8 - "\x00e\x03\x01\x00\x00\x00\xe9" + // 0x00650301: 0x000000E9 - "\x00e\x03\x02\x00\x00\x00\xea" + // 0x00650302: 0x000000EA - "\x00e\x03\b\x00\x00\x00\xeb" + // 0x00650308: 0x000000EB - "\x00i\x03\x00\x00\x00\x00\xec" + // 0x00690300: 0x000000EC - "\x00i\x03\x01\x00\x00\x00\xed" + // 0x00690301: 0x000000ED - "\x00i\x03\x02\x00\x00\x00\xee" + // 0x00690302: 0x000000EE - "\x00i\x03\b\x00\x00\x00\xef" + // 0x00690308: 0x000000EF - "\x00n\x03\x03\x00\x00\x00\xf1" + // 0x006E0303: 0x000000F1 - "\x00o\x03\x00\x00\x00\x00\xf2" + // 0x006F0300: 0x000000F2 - "\x00o\x03\x01\x00\x00\x00\xf3" + // 0x006F0301: 0x000000F3 - "\x00o\x03\x02\x00\x00\x00\xf4" + // 0x006F0302: 0x000000F4 - "\x00o\x03\x03\x00\x00\x00\xf5" + // 0x006F0303: 0x000000F5 - "\x00o\x03\b\x00\x00\x00\xf6" + // 0x006F0308: 0x000000F6 - "\x00u\x03\x00\x00\x00\x00\xf9" + // 0x00750300: 0x000000F9 - "\x00u\x03\x01\x00\x00\x00\xfa" + // 0x00750301: 0x000000FA - "\x00u\x03\x02\x00\x00\x00\xfb" + // 0x00750302: 0x000000FB - "\x00u\x03\b\x00\x00\x00\xfc" + // 0x00750308: 0x000000FC - "\x00y\x03\x01\x00\x00\x00\xfd" + // 0x00790301: 0x000000FD - "\x00y\x03\b\x00\x00\x00\xff" + // 0x00790308: 0x000000FF - "\x00A\x03\x04\x00\x00\x01\x00" + // 0x00410304: 0x00000100 - "\x00a\x03\x04\x00\x00\x01\x01" + // 0x00610304: 0x00000101 - "\x00A\x03\x06\x00\x00\x01\x02" + // 0x00410306: 0x00000102 - "\x00a\x03\x06\x00\x00\x01\x03" + // 0x00610306: 0x00000103 - "\x00A\x03(\x00\x00\x01\x04" + // 0x00410328: 0x00000104 - "\x00a\x03(\x00\x00\x01\x05" + // 0x00610328: 0x00000105 - "\x00C\x03\x01\x00\x00\x01\x06" + // 0x00430301: 0x00000106 - "\x00c\x03\x01\x00\x00\x01\a" + // 0x00630301: 0x00000107 - "\x00C\x03\x02\x00\x00\x01\b" + // 0x00430302: 0x00000108 - "\x00c\x03\x02\x00\x00\x01\t" + // 0x00630302: 0x00000109 - "\x00C\x03\a\x00\x00\x01\n" + // 0x00430307: 0x0000010A - "\x00c\x03\a\x00\x00\x01\v" + // 0x00630307: 0x0000010B - "\x00C\x03\f\x00\x00\x01\f" + // 0x0043030C: 0x0000010C - "\x00c\x03\f\x00\x00\x01\r" + // 0x0063030C: 0x0000010D - "\x00D\x03\f\x00\x00\x01\x0e" + // 0x0044030C: 0x0000010E - "\x00d\x03\f\x00\x00\x01\x0f" + // 0x0064030C: 0x0000010F - "\x00E\x03\x04\x00\x00\x01\x12" + // 0x00450304: 0x00000112 - "\x00e\x03\x04\x00\x00\x01\x13" + // 0x00650304: 0x00000113 - "\x00E\x03\x06\x00\x00\x01\x14" + // 0x00450306: 0x00000114 - "\x00e\x03\x06\x00\x00\x01\x15" + // 0x00650306: 0x00000115 - "\x00E\x03\a\x00\x00\x01\x16" + // 0x00450307: 0x00000116 - "\x00e\x03\a\x00\x00\x01\x17" + // 0x00650307: 0x00000117 - "\x00E\x03(\x00\x00\x01\x18" + // 0x00450328: 0x00000118 - "\x00e\x03(\x00\x00\x01\x19" + // 0x00650328: 0x00000119 - "\x00E\x03\f\x00\x00\x01\x1a" + // 0x0045030C: 0x0000011A - "\x00e\x03\f\x00\x00\x01\x1b" + // 0x0065030C: 0x0000011B - "\x00G\x03\x02\x00\x00\x01\x1c" + // 0x00470302: 0x0000011C - "\x00g\x03\x02\x00\x00\x01\x1d" + // 0x00670302: 0x0000011D - "\x00G\x03\x06\x00\x00\x01\x1e" + // 0x00470306: 0x0000011E - "\x00g\x03\x06\x00\x00\x01\x1f" + // 0x00670306: 0x0000011F - "\x00G\x03\a\x00\x00\x01 " + // 0x00470307: 0x00000120 - "\x00g\x03\a\x00\x00\x01!" + // 0x00670307: 0x00000121 - "\x00G\x03'\x00\x00\x01\"" + // 0x00470327: 0x00000122 - "\x00g\x03'\x00\x00\x01#" + // 0x00670327: 0x00000123 - "\x00H\x03\x02\x00\x00\x01$" + // 0x00480302: 0x00000124 - "\x00h\x03\x02\x00\x00\x01%" + // 0x00680302: 0x00000125 - "\x00I\x03\x03\x00\x00\x01(" + // 0x00490303: 0x00000128 - "\x00i\x03\x03\x00\x00\x01)" + // 0x00690303: 0x00000129 - "\x00I\x03\x04\x00\x00\x01*" + // 0x00490304: 0x0000012A - "\x00i\x03\x04\x00\x00\x01+" + // 0x00690304: 0x0000012B - "\x00I\x03\x06\x00\x00\x01," + // 0x00490306: 0x0000012C - "\x00i\x03\x06\x00\x00\x01-" + // 0x00690306: 0x0000012D - "\x00I\x03(\x00\x00\x01." + // 0x00490328: 0x0000012E - "\x00i\x03(\x00\x00\x01/" + // 0x00690328: 0x0000012F - "\x00I\x03\a\x00\x00\x010" + // 0x00490307: 0x00000130 - "\x00J\x03\x02\x00\x00\x014" + // 0x004A0302: 0x00000134 - "\x00j\x03\x02\x00\x00\x015" + // 0x006A0302: 0x00000135 - "\x00K\x03'\x00\x00\x016" + // 0x004B0327: 0x00000136 - "\x00k\x03'\x00\x00\x017" + // 0x006B0327: 0x00000137 - "\x00L\x03\x01\x00\x00\x019" + // 0x004C0301: 0x00000139 - "\x00l\x03\x01\x00\x00\x01:" + // 0x006C0301: 0x0000013A - "\x00L\x03'\x00\x00\x01;" + // 0x004C0327: 0x0000013B - "\x00l\x03'\x00\x00\x01<" + // 0x006C0327: 0x0000013C - "\x00L\x03\f\x00\x00\x01=" + // 0x004C030C: 0x0000013D - "\x00l\x03\f\x00\x00\x01>" + // 0x006C030C: 0x0000013E - "\x00N\x03\x01\x00\x00\x01C" + // 0x004E0301: 0x00000143 - "\x00n\x03\x01\x00\x00\x01D" + // 0x006E0301: 0x00000144 - "\x00N\x03'\x00\x00\x01E" + // 0x004E0327: 0x00000145 - "\x00n\x03'\x00\x00\x01F" + // 0x006E0327: 0x00000146 - "\x00N\x03\f\x00\x00\x01G" + // 0x004E030C: 0x00000147 - "\x00n\x03\f\x00\x00\x01H" + // 0x006E030C: 0x00000148 - "\x00O\x03\x04\x00\x00\x01L" + // 0x004F0304: 0x0000014C - "\x00o\x03\x04\x00\x00\x01M" + // 0x006F0304: 0x0000014D - "\x00O\x03\x06\x00\x00\x01N" + // 0x004F0306: 0x0000014E - "\x00o\x03\x06\x00\x00\x01O" + // 0x006F0306: 0x0000014F - "\x00O\x03\v\x00\x00\x01P" + // 0x004F030B: 0x00000150 - "\x00o\x03\v\x00\x00\x01Q" + // 0x006F030B: 0x00000151 - "\x00R\x03\x01\x00\x00\x01T" + // 0x00520301: 0x00000154 - "\x00r\x03\x01\x00\x00\x01U" + // 0x00720301: 0x00000155 - "\x00R\x03'\x00\x00\x01V" + // 0x00520327: 0x00000156 - "\x00r\x03'\x00\x00\x01W" + // 0x00720327: 0x00000157 - "\x00R\x03\f\x00\x00\x01X" + // 0x0052030C: 0x00000158 - "\x00r\x03\f\x00\x00\x01Y" + // 0x0072030C: 0x00000159 - "\x00S\x03\x01\x00\x00\x01Z" + // 0x00530301: 0x0000015A - "\x00s\x03\x01\x00\x00\x01[" + // 0x00730301: 0x0000015B - "\x00S\x03\x02\x00\x00\x01\\" + // 0x00530302: 0x0000015C - "\x00s\x03\x02\x00\x00\x01]" + // 0x00730302: 0x0000015D - "\x00S\x03'\x00\x00\x01^" + // 0x00530327: 0x0000015E - "\x00s\x03'\x00\x00\x01_" + // 0x00730327: 0x0000015F - "\x00S\x03\f\x00\x00\x01`" + // 0x0053030C: 0x00000160 - "\x00s\x03\f\x00\x00\x01a" + // 0x0073030C: 0x00000161 - "\x00T\x03'\x00\x00\x01b" + // 0x00540327: 0x00000162 - "\x00t\x03'\x00\x00\x01c" + // 0x00740327: 0x00000163 - "\x00T\x03\f\x00\x00\x01d" + // 0x0054030C: 0x00000164 - "\x00t\x03\f\x00\x00\x01e" + // 0x0074030C: 0x00000165 - "\x00U\x03\x03\x00\x00\x01h" + // 0x00550303: 0x00000168 - "\x00u\x03\x03\x00\x00\x01i" + // 0x00750303: 0x00000169 - "\x00U\x03\x04\x00\x00\x01j" + // 0x00550304: 0x0000016A - "\x00u\x03\x04\x00\x00\x01k" + // 0x00750304: 0x0000016B - "\x00U\x03\x06\x00\x00\x01l" + // 0x00550306: 0x0000016C - "\x00u\x03\x06\x00\x00\x01m" + // 0x00750306: 0x0000016D - "\x00U\x03\n\x00\x00\x01n" + // 0x0055030A: 0x0000016E - "\x00u\x03\n\x00\x00\x01o" + // 0x0075030A: 0x0000016F - "\x00U\x03\v\x00\x00\x01p" + // 0x0055030B: 0x00000170 - "\x00u\x03\v\x00\x00\x01q" + // 0x0075030B: 0x00000171 - "\x00U\x03(\x00\x00\x01r" + // 0x00550328: 0x00000172 - "\x00u\x03(\x00\x00\x01s" + // 0x00750328: 0x00000173 - "\x00W\x03\x02\x00\x00\x01t" + // 0x00570302: 0x00000174 - "\x00w\x03\x02\x00\x00\x01u" + // 0x00770302: 0x00000175 - "\x00Y\x03\x02\x00\x00\x01v" + // 0x00590302: 0x00000176 - "\x00y\x03\x02\x00\x00\x01w" + // 0x00790302: 0x00000177 - "\x00Y\x03\b\x00\x00\x01x" + // 0x00590308: 0x00000178 - "\x00Z\x03\x01\x00\x00\x01y" + // 0x005A0301: 0x00000179 - "\x00z\x03\x01\x00\x00\x01z" + // 0x007A0301: 0x0000017A - "\x00Z\x03\a\x00\x00\x01{" + // 0x005A0307: 0x0000017B - "\x00z\x03\a\x00\x00\x01|" + // 0x007A0307: 0x0000017C - "\x00Z\x03\f\x00\x00\x01}" + // 0x005A030C: 0x0000017D - "\x00z\x03\f\x00\x00\x01~" + // 0x007A030C: 0x0000017E - "\x00O\x03\x1b\x00\x00\x01\xa0" + // 0x004F031B: 0x000001A0 - "\x00o\x03\x1b\x00\x00\x01\xa1" + // 0x006F031B: 0x000001A1 - "\x00U\x03\x1b\x00\x00\x01\xaf" + // 0x0055031B: 0x000001AF - "\x00u\x03\x1b\x00\x00\x01\xb0" + // 0x0075031B: 0x000001B0 - "\x00A\x03\f\x00\x00\x01\xcd" + // 0x0041030C: 0x000001CD - "\x00a\x03\f\x00\x00\x01\xce" + // 0x0061030C: 0x000001CE - "\x00I\x03\f\x00\x00\x01\xcf" + // 0x0049030C: 0x000001CF - "\x00i\x03\f\x00\x00\x01\xd0" + // 0x0069030C: 0x000001D0 - "\x00O\x03\f\x00\x00\x01\xd1" + // 0x004F030C: 0x000001D1 - "\x00o\x03\f\x00\x00\x01\xd2" + // 0x006F030C: 0x000001D2 - "\x00U\x03\f\x00\x00\x01\xd3" + // 0x0055030C: 0x000001D3 - "\x00u\x03\f\x00\x00\x01\xd4" + // 0x0075030C: 0x000001D4 - "\x00\xdc\x03\x04\x00\x00\x01\xd5" + // 0x00DC0304: 0x000001D5 - "\x00\xfc\x03\x04\x00\x00\x01\xd6" + // 0x00FC0304: 0x000001D6 - "\x00\xdc\x03\x01\x00\x00\x01\xd7" + // 0x00DC0301: 0x000001D7 - "\x00\xfc\x03\x01\x00\x00\x01\xd8" + // 0x00FC0301: 0x000001D8 - "\x00\xdc\x03\f\x00\x00\x01\xd9" + // 0x00DC030C: 0x000001D9 - "\x00\xfc\x03\f\x00\x00\x01\xda" + // 0x00FC030C: 0x000001DA - "\x00\xdc\x03\x00\x00\x00\x01\xdb" + // 0x00DC0300: 0x000001DB - "\x00\xfc\x03\x00\x00\x00\x01\xdc" + // 0x00FC0300: 0x000001DC - "\x00\xc4\x03\x04\x00\x00\x01\xde" + // 0x00C40304: 0x000001DE - "\x00\xe4\x03\x04\x00\x00\x01\xdf" + // 0x00E40304: 0x000001DF - "\x02&\x03\x04\x00\x00\x01\xe0" + // 0x02260304: 0x000001E0 - "\x02'\x03\x04\x00\x00\x01\xe1" + // 0x02270304: 0x000001E1 - "\x00\xc6\x03\x04\x00\x00\x01\xe2" + // 0x00C60304: 0x000001E2 - "\x00\xe6\x03\x04\x00\x00\x01\xe3" + // 0x00E60304: 0x000001E3 - "\x00G\x03\f\x00\x00\x01\xe6" + // 0x0047030C: 0x000001E6 - "\x00g\x03\f\x00\x00\x01\xe7" + // 0x0067030C: 0x000001E7 - "\x00K\x03\f\x00\x00\x01\xe8" + // 0x004B030C: 0x000001E8 - "\x00k\x03\f\x00\x00\x01\xe9" + // 0x006B030C: 0x000001E9 - "\x00O\x03(\x00\x00\x01\xea" + // 0x004F0328: 0x000001EA - "\x00o\x03(\x00\x00\x01\xeb" + // 0x006F0328: 0x000001EB - "\x01\xea\x03\x04\x00\x00\x01\xec" + // 0x01EA0304: 0x000001EC - "\x01\xeb\x03\x04\x00\x00\x01\xed" + // 0x01EB0304: 0x000001ED - "\x01\xb7\x03\f\x00\x00\x01\xee" + // 0x01B7030C: 0x000001EE - "\x02\x92\x03\f\x00\x00\x01\xef" + // 0x0292030C: 0x000001EF - "\x00j\x03\f\x00\x00\x01\xf0" + // 0x006A030C: 0x000001F0 - "\x00G\x03\x01\x00\x00\x01\xf4" + // 0x00470301: 0x000001F4 - "\x00g\x03\x01\x00\x00\x01\xf5" + // 0x00670301: 0x000001F5 - "\x00N\x03\x00\x00\x00\x01\xf8" + // 0x004E0300: 0x000001F8 - "\x00n\x03\x00\x00\x00\x01\xf9" + // 0x006E0300: 0x000001F9 - "\x00\xc5\x03\x01\x00\x00\x01\xfa" + // 0x00C50301: 0x000001FA - "\x00\xe5\x03\x01\x00\x00\x01\xfb" + // 0x00E50301: 0x000001FB - "\x00\xc6\x03\x01\x00\x00\x01\xfc" + // 0x00C60301: 0x000001FC - "\x00\xe6\x03\x01\x00\x00\x01\xfd" + // 0x00E60301: 0x000001FD - "\x00\xd8\x03\x01\x00\x00\x01\xfe" + // 0x00D80301: 0x000001FE - "\x00\xf8\x03\x01\x00\x00\x01\xff" + // 0x00F80301: 0x000001FF - "\x00A\x03\x0f\x00\x00\x02\x00" + // 0x0041030F: 0x00000200 - "\x00a\x03\x0f\x00\x00\x02\x01" + // 0x0061030F: 0x00000201 - "\x00A\x03\x11\x00\x00\x02\x02" + // 0x00410311: 0x00000202 - "\x00a\x03\x11\x00\x00\x02\x03" + // 0x00610311: 0x00000203 - "\x00E\x03\x0f\x00\x00\x02\x04" + // 0x0045030F: 0x00000204 - "\x00e\x03\x0f\x00\x00\x02\x05" + // 0x0065030F: 0x00000205 - "\x00E\x03\x11\x00\x00\x02\x06" + // 0x00450311: 0x00000206 - "\x00e\x03\x11\x00\x00\x02\a" + // 0x00650311: 0x00000207 - "\x00I\x03\x0f\x00\x00\x02\b" + // 0x0049030F: 0x00000208 - "\x00i\x03\x0f\x00\x00\x02\t" + // 0x0069030F: 0x00000209 - "\x00I\x03\x11\x00\x00\x02\n" + // 0x00490311: 0x0000020A - "\x00i\x03\x11\x00\x00\x02\v" + // 0x00690311: 0x0000020B - "\x00O\x03\x0f\x00\x00\x02\f" + // 0x004F030F: 0x0000020C - "\x00o\x03\x0f\x00\x00\x02\r" + // 0x006F030F: 0x0000020D - "\x00O\x03\x11\x00\x00\x02\x0e" + // 0x004F0311: 0x0000020E - "\x00o\x03\x11\x00\x00\x02\x0f" + // 0x006F0311: 0x0000020F - "\x00R\x03\x0f\x00\x00\x02\x10" + // 0x0052030F: 0x00000210 - "\x00r\x03\x0f\x00\x00\x02\x11" + // 0x0072030F: 0x00000211 - "\x00R\x03\x11\x00\x00\x02\x12" + // 0x00520311: 0x00000212 - "\x00r\x03\x11\x00\x00\x02\x13" + // 0x00720311: 0x00000213 - "\x00U\x03\x0f\x00\x00\x02\x14" + // 0x0055030F: 0x00000214 - "\x00u\x03\x0f\x00\x00\x02\x15" + // 0x0075030F: 0x00000215 - "\x00U\x03\x11\x00\x00\x02\x16" + // 0x00550311: 0x00000216 - "\x00u\x03\x11\x00\x00\x02\x17" + // 0x00750311: 0x00000217 - "\x00S\x03&\x00\x00\x02\x18" + // 0x00530326: 0x00000218 - "\x00s\x03&\x00\x00\x02\x19" + // 0x00730326: 0x00000219 - "\x00T\x03&\x00\x00\x02\x1a" + // 0x00540326: 0x0000021A - "\x00t\x03&\x00\x00\x02\x1b" + // 0x00740326: 0x0000021B - "\x00H\x03\f\x00\x00\x02\x1e" + // 0x0048030C: 0x0000021E - "\x00h\x03\f\x00\x00\x02\x1f" + // 0x0068030C: 0x0000021F - "\x00A\x03\a\x00\x00\x02&" + // 0x00410307: 0x00000226 - "\x00a\x03\a\x00\x00\x02'" + // 0x00610307: 0x00000227 - "\x00E\x03'\x00\x00\x02(" + // 0x00450327: 0x00000228 - "\x00e\x03'\x00\x00\x02)" + // 0x00650327: 0x00000229 - "\x00\xd6\x03\x04\x00\x00\x02*" + // 0x00D60304: 0x0000022A - "\x00\xf6\x03\x04\x00\x00\x02+" + // 0x00F60304: 0x0000022B - "\x00\xd5\x03\x04\x00\x00\x02," + // 0x00D50304: 0x0000022C - "\x00\xf5\x03\x04\x00\x00\x02-" + // 0x00F50304: 0x0000022D - "\x00O\x03\a\x00\x00\x02." + // 0x004F0307: 0x0000022E - "\x00o\x03\a\x00\x00\x02/" + // 0x006F0307: 0x0000022F - "\x02.\x03\x04\x00\x00\x020" + // 0x022E0304: 0x00000230 - "\x02/\x03\x04\x00\x00\x021" + // 0x022F0304: 0x00000231 - "\x00Y\x03\x04\x00\x00\x022" + // 0x00590304: 0x00000232 - "\x00y\x03\x04\x00\x00\x023" + // 0x00790304: 0x00000233 - "\x00\xa8\x03\x01\x00\x00\x03\x85" + // 0x00A80301: 0x00000385 - "\x03\x91\x03\x01\x00\x00\x03\x86" + // 0x03910301: 0x00000386 - "\x03\x95\x03\x01\x00\x00\x03\x88" + // 0x03950301: 0x00000388 - "\x03\x97\x03\x01\x00\x00\x03\x89" + // 0x03970301: 0x00000389 - "\x03\x99\x03\x01\x00\x00\x03\x8a" + // 0x03990301: 0x0000038A - "\x03\x9f\x03\x01\x00\x00\x03\x8c" + // 0x039F0301: 0x0000038C - "\x03\xa5\x03\x01\x00\x00\x03\x8e" + // 0x03A50301: 0x0000038E - "\x03\xa9\x03\x01\x00\x00\x03\x8f" + // 0x03A90301: 0x0000038F - "\x03\xca\x03\x01\x00\x00\x03\x90" + // 0x03CA0301: 0x00000390 - "\x03\x99\x03\b\x00\x00\x03\xaa" + // 0x03990308: 0x000003AA - "\x03\xa5\x03\b\x00\x00\x03\xab" + // 0x03A50308: 0x000003AB - "\x03\xb1\x03\x01\x00\x00\x03\xac" + // 0x03B10301: 0x000003AC - "\x03\xb5\x03\x01\x00\x00\x03\xad" + // 0x03B50301: 0x000003AD - "\x03\xb7\x03\x01\x00\x00\x03\xae" + // 0x03B70301: 0x000003AE - "\x03\xb9\x03\x01\x00\x00\x03\xaf" + // 0x03B90301: 0x000003AF - "\x03\xcb\x03\x01\x00\x00\x03\xb0" + // 0x03CB0301: 0x000003B0 - "\x03\xb9\x03\b\x00\x00\x03\xca" + // 0x03B90308: 0x000003CA - "\x03\xc5\x03\b\x00\x00\x03\xcb" + // 0x03C50308: 0x000003CB - "\x03\xbf\x03\x01\x00\x00\x03\xcc" + // 0x03BF0301: 0x000003CC - "\x03\xc5\x03\x01\x00\x00\x03\xcd" + // 0x03C50301: 0x000003CD - "\x03\xc9\x03\x01\x00\x00\x03\xce" + // 0x03C90301: 0x000003CE - "\x03\xd2\x03\x01\x00\x00\x03\xd3" + // 0x03D20301: 0x000003D3 - "\x03\xd2\x03\b\x00\x00\x03\xd4" + // 0x03D20308: 0x000003D4 - "\x04\x15\x03\x00\x00\x00\x04\x00" + // 0x04150300: 0x00000400 - "\x04\x15\x03\b\x00\x00\x04\x01" + // 0x04150308: 0x00000401 - "\x04\x13\x03\x01\x00\x00\x04\x03" + // 0x04130301: 0x00000403 - "\x04\x06\x03\b\x00\x00\x04\a" + // 0x04060308: 0x00000407 - "\x04\x1a\x03\x01\x00\x00\x04\f" + // 0x041A0301: 0x0000040C - "\x04\x18\x03\x00\x00\x00\x04\r" + // 0x04180300: 0x0000040D - "\x04#\x03\x06\x00\x00\x04\x0e" + // 0x04230306: 0x0000040E - "\x04\x18\x03\x06\x00\x00\x04\x19" + // 0x04180306: 0x00000419 - "\x048\x03\x06\x00\x00\x049" + // 0x04380306: 0x00000439 - "\x045\x03\x00\x00\x00\x04P" + // 0x04350300: 0x00000450 - "\x045\x03\b\x00\x00\x04Q" + // 0x04350308: 0x00000451 - "\x043\x03\x01\x00\x00\x04S" + // 0x04330301: 0x00000453 - "\x04V\x03\b\x00\x00\x04W" + // 0x04560308: 0x00000457 - "\x04:\x03\x01\x00\x00\x04\\" + // 0x043A0301: 0x0000045C - "\x048\x03\x00\x00\x00\x04]" + // 0x04380300: 0x0000045D - "\x04C\x03\x06\x00\x00\x04^" + // 0x04430306: 0x0000045E - "\x04t\x03\x0f\x00\x00\x04v" + // 0x0474030F: 0x00000476 - "\x04u\x03\x0f\x00\x00\x04w" + // 0x0475030F: 0x00000477 - "\x04\x16\x03\x06\x00\x00\x04\xc1" + // 0x04160306: 0x000004C1 - "\x046\x03\x06\x00\x00\x04\xc2" + // 0x04360306: 0x000004C2 - "\x04\x10\x03\x06\x00\x00\x04\xd0" + // 0x04100306: 0x000004D0 - "\x040\x03\x06\x00\x00\x04\xd1" + // 0x04300306: 0x000004D1 - "\x04\x10\x03\b\x00\x00\x04\xd2" + // 0x04100308: 0x000004D2 - "\x040\x03\b\x00\x00\x04\xd3" + // 0x04300308: 0x000004D3 - "\x04\x15\x03\x06\x00\x00\x04\xd6" + // 0x04150306: 0x000004D6 - "\x045\x03\x06\x00\x00\x04\xd7" + // 0x04350306: 0x000004D7 - "\x04\xd8\x03\b\x00\x00\x04\xda" + // 0x04D80308: 0x000004DA - "\x04\xd9\x03\b\x00\x00\x04\xdb" + // 0x04D90308: 0x000004DB - "\x04\x16\x03\b\x00\x00\x04\xdc" + // 0x04160308: 0x000004DC - "\x046\x03\b\x00\x00\x04\xdd" + // 0x04360308: 0x000004DD - "\x04\x17\x03\b\x00\x00\x04\xde" + // 0x04170308: 0x000004DE - "\x047\x03\b\x00\x00\x04\xdf" + // 0x04370308: 0x000004DF - "\x04\x18\x03\x04\x00\x00\x04\xe2" + // 0x04180304: 0x000004E2 - "\x048\x03\x04\x00\x00\x04\xe3" + // 0x04380304: 0x000004E3 - "\x04\x18\x03\b\x00\x00\x04\xe4" + // 0x04180308: 0x000004E4 - "\x048\x03\b\x00\x00\x04\xe5" + // 0x04380308: 0x000004E5 - "\x04\x1e\x03\b\x00\x00\x04\xe6" + // 0x041E0308: 0x000004E6 - "\x04>\x03\b\x00\x00\x04\xe7" + // 0x043E0308: 0x000004E7 - "\x04\xe8\x03\b\x00\x00\x04\xea" + // 0x04E80308: 0x000004EA - "\x04\xe9\x03\b\x00\x00\x04\xeb" + // 0x04E90308: 0x000004EB - "\x04-\x03\b\x00\x00\x04\xec" + // 0x042D0308: 0x000004EC - "\x04M\x03\b\x00\x00\x04\xed" + // 0x044D0308: 0x000004ED - "\x04#\x03\x04\x00\x00\x04\xee" + // 0x04230304: 0x000004EE - "\x04C\x03\x04\x00\x00\x04\xef" + // 0x04430304: 0x000004EF - "\x04#\x03\b\x00\x00\x04\xf0" + // 0x04230308: 0x000004F0 - "\x04C\x03\b\x00\x00\x04\xf1" + // 0x04430308: 0x000004F1 - "\x04#\x03\v\x00\x00\x04\xf2" + // 0x0423030B: 0x000004F2 - "\x04C\x03\v\x00\x00\x04\xf3" + // 0x0443030B: 0x000004F3 - "\x04'\x03\b\x00\x00\x04\xf4" + // 0x04270308: 0x000004F4 - "\x04G\x03\b\x00\x00\x04\xf5" + // 0x04470308: 0x000004F5 - "\x04+\x03\b\x00\x00\x04\xf8" + // 0x042B0308: 0x000004F8 - "\x04K\x03\b\x00\x00\x04\xf9" + // 0x044B0308: 0x000004F9 - "\x06'\x06S\x00\x00\x06\"" + // 0x06270653: 0x00000622 - "\x06'\x06T\x00\x00\x06#" + // 0x06270654: 0x00000623 - "\x06H\x06T\x00\x00\x06$" + // 0x06480654: 0x00000624 - "\x06'\x06U\x00\x00\x06%" + // 0x06270655: 0x00000625 - "\x06J\x06T\x00\x00\x06&" + // 0x064A0654: 0x00000626 - "\x06\xd5\x06T\x00\x00\x06\xc0" + // 0x06D50654: 0x000006C0 - "\x06\xc1\x06T\x00\x00\x06\xc2" + // 0x06C10654: 0x000006C2 - "\x06\xd2\x06T\x00\x00\x06\xd3" + // 0x06D20654: 0x000006D3 - "\t(\t<\x00\x00\t)" + // 0x0928093C: 0x00000929 - "\t0\t<\x00\x00\t1" + // 0x0930093C: 0x00000931 - "\t3\t<\x00\x00\t4" + // 0x0933093C: 0x00000934 - "\t\xc7\t\xbe\x00\x00\t\xcb" + // 0x09C709BE: 0x000009CB - "\t\xc7\t\xd7\x00\x00\t\xcc" + // 0x09C709D7: 0x000009CC - "\vG\vV\x00\x00\vH" + // 0x0B470B56: 0x00000B48 - "\vG\v>\x00\x00\vK" + // 0x0B470B3E: 0x00000B4B - "\vG\vW\x00\x00\vL" + // 0x0B470B57: 0x00000B4C - "\v\x92\v\xd7\x00\x00\v\x94" + // 0x0B920BD7: 0x00000B94 - "\v\xc6\v\xbe\x00\x00\v\xca" + // 0x0BC60BBE: 0x00000BCA - "\v\xc7\v\xbe\x00\x00\v\xcb" + // 0x0BC70BBE: 0x00000BCB - "\v\xc6\v\xd7\x00\x00\v\xcc" + // 0x0BC60BD7: 0x00000BCC - "\fF\fV\x00\x00\fH" + // 0x0C460C56: 0x00000C48 - "\f\xbf\f\xd5\x00\x00\f\xc0" + // 0x0CBF0CD5: 0x00000CC0 - "\f\xc6\f\xd5\x00\x00\f\xc7" + // 0x0CC60CD5: 0x00000CC7 - "\f\xc6\f\xd6\x00\x00\f\xc8" + // 0x0CC60CD6: 0x00000CC8 - "\f\xc6\f\xc2\x00\x00\f\xca" + // 0x0CC60CC2: 0x00000CCA - "\f\xca\f\xd5\x00\x00\f\xcb" + // 0x0CCA0CD5: 0x00000CCB - "\rF\r>\x00\x00\rJ" + // 0x0D460D3E: 0x00000D4A - "\rG\r>\x00\x00\rK" + // 0x0D470D3E: 0x00000D4B - "\rF\rW\x00\x00\rL" + // 0x0D460D57: 0x00000D4C - "\r\xd9\r\xca\x00\x00\r\xda" + // 0x0DD90DCA: 0x00000DDA - "\r\xd9\r\xcf\x00\x00\r\xdc" + // 0x0DD90DCF: 0x00000DDC - "\r\xdc\r\xca\x00\x00\r\xdd" + // 0x0DDC0DCA: 0x00000DDD - "\r\xd9\r\xdf\x00\x00\r\xde" + // 0x0DD90DDF: 0x00000DDE - "\x10%\x10.\x00\x00\x10&" + // 0x1025102E: 0x00001026 - "\x1b\x05\x1b5\x00\x00\x1b\x06" + // 0x1B051B35: 0x00001B06 - "\x1b\a\x1b5\x00\x00\x1b\b" + // 0x1B071B35: 0x00001B08 - "\x1b\t\x1b5\x00\x00\x1b\n" + // 0x1B091B35: 0x00001B0A - "\x1b\v\x1b5\x00\x00\x1b\f" + // 0x1B0B1B35: 0x00001B0C - "\x1b\r\x1b5\x00\x00\x1b\x0e" + // 0x1B0D1B35: 0x00001B0E - "\x1b\x11\x1b5\x00\x00\x1b\x12" + // 0x1B111B35: 0x00001B12 - "\x1b:\x1b5\x00\x00\x1b;" + // 0x1B3A1B35: 0x00001B3B - "\x1b<\x1b5\x00\x00\x1b=" + // 0x1B3C1B35: 0x00001B3D - "\x1b>\x1b5\x00\x00\x1b@" + // 0x1B3E1B35: 0x00001B40 - "\x1b?\x1b5\x00\x00\x1bA" + // 0x1B3F1B35: 0x00001B41 - "\x1bB\x1b5\x00\x00\x1bC" + // 0x1B421B35: 0x00001B43 - "\x00A\x03%\x00\x00\x1e\x00" + // 0x00410325: 0x00001E00 - "\x00a\x03%\x00\x00\x1e\x01" + // 0x00610325: 0x00001E01 - "\x00B\x03\a\x00\x00\x1e\x02" + // 0x00420307: 0x00001E02 - "\x00b\x03\a\x00\x00\x1e\x03" + // 0x00620307: 0x00001E03 - "\x00B\x03#\x00\x00\x1e\x04" + // 0x00420323: 0x00001E04 - "\x00b\x03#\x00\x00\x1e\x05" + // 0x00620323: 0x00001E05 - "\x00B\x031\x00\x00\x1e\x06" + // 0x00420331: 0x00001E06 - "\x00b\x031\x00\x00\x1e\a" + // 0x00620331: 0x00001E07 - "\x00\xc7\x03\x01\x00\x00\x1e\b" + // 0x00C70301: 0x00001E08 - "\x00\xe7\x03\x01\x00\x00\x1e\t" + // 0x00E70301: 0x00001E09 - "\x00D\x03\a\x00\x00\x1e\n" + // 0x00440307: 0x00001E0A - "\x00d\x03\a\x00\x00\x1e\v" + // 0x00640307: 0x00001E0B - "\x00D\x03#\x00\x00\x1e\f" + // 0x00440323: 0x00001E0C - "\x00d\x03#\x00\x00\x1e\r" + // 0x00640323: 0x00001E0D - "\x00D\x031\x00\x00\x1e\x0e" + // 0x00440331: 0x00001E0E - "\x00d\x031\x00\x00\x1e\x0f" + // 0x00640331: 0x00001E0F - "\x00D\x03'\x00\x00\x1e\x10" + // 0x00440327: 0x00001E10 - "\x00d\x03'\x00\x00\x1e\x11" + // 0x00640327: 0x00001E11 - "\x00D\x03-\x00\x00\x1e\x12" + // 0x0044032D: 0x00001E12 - "\x00d\x03-\x00\x00\x1e\x13" + // 0x0064032D: 0x00001E13 - "\x01\x12\x03\x00\x00\x00\x1e\x14" + // 0x01120300: 0x00001E14 - "\x01\x13\x03\x00\x00\x00\x1e\x15" + // 0x01130300: 0x00001E15 - "\x01\x12\x03\x01\x00\x00\x1e\x16" + // 0x01120301: 0x00001E16 - "\x01\x13\x03\x01\x00\x00\x1e\x17" + // 0x01130301: 0x00001E17 - "\x00E\x03-\x00\x00\x1e\x18" + // 0x0045032D: 0x00001E18 - "\x00e\x03-\x00\x00\x1e\x19" + // 0x0065032D: 0x00001E19 - "\x00E\x030\x00\x00\x1e\x1a" + // 0x00450330: 0x00001E1A - "\x00e\x030\x00\x00\x1e\x1b" + // 0x00650330: 0x00001E1B - "\x02(\x03\x06\x00\x00\x1e\x1c" + // 0x02280306: 0x00001E1C - "\x02)\x03\x06\x00\x00\x1e\x1d" + // 0x02290306: 0x00001E1D - "\x00F\x03\a\x00\x00\x1e\x1e" + // 0x00460307: 0x00001E1E - "\x00f\x03\a\x00\x00\x1e\x1f" + // 0x00660307: 0x00001E1F - "\x00G\x03\x04\x00\x00\x1e " + // 0x00470304: 0x00001E20 - "\x00g\x03\x04\x00\x00\x1e!" + // 0x00670304: 0x00001E21 - "\x00H\x03\a\x00\x00\x1e\"" + // 0x00480307: 0x00001E22 - "\x00h\x03\a\x00\x00\x1e#" + // 0x00680307: 0x00001E23 - "\x00H\x03#\x00\x00\x1e$" + // 0x00480323: 0x00001E24 - "\x00h\x03#\x00\x00\x1e%" + // 0x00680323: 0x00001E25 - "\x00H\x03\b\x00\x00\x1e&" + // 0x00480308: 0x00001E26 - "\x00h\x03\b\x00\x00\x1e'" + // 0x00680308: 0x00001E27 - "\x00H\x03'\x00\x00\x1e(" + // 0x00480327: 0x00001E28 - "\x00h\x03'\x00\x00\x1e)" + // 0x00680327: 0x00001E29 - "\x00H\x03.\x00\x00\x1e*" + // 0x0048032E: 0x00001E2A - "\x00h\x03.\x00\x00\x1e+" + // 0x0068032E: 0x00001E2B - "\x00I\x030\x00\x00\x1e," + // 0x00490330: 0x00001E2C - "\x00i\x030\x00\x00\x1e-" + // 0x00690330: 0x00001E2D - "\x00\xcf\x03\x01\x00\x00\x1e." + // 0x00CF0301: 0x00001E2E - "\x00\xef\x03\x01\x00\x00\x1e/" + // 0x00EF0301: 0x00001E2F - "\x00K\x03\x01\x00\x00\x1e0" + // 0x004B0301: 0x00001E30 - "\x00k\x03\x01\x00\x00\x1e1" + // 0x006B0301: 0x00001E31 - "\x00K\x03#\x00\x00\x1e2" + // 0x004B0323: 0x00001E32 - "\x00k\x03#\x00\x00\x1e3" + // 0x006B0323: 0x00001E33 - "\x00K\x031\x00\x00\x1e4" + // 0x004B0331: 0x00001E34 - "\x00k\x031\x00\x00\x1e5" + // 0x006B0331: 0x00001E35 - "\x00L\x03#\x00\x00\x1e6" + // 0x004C0323: 0x00001E36 - "\x00l\x03#\x00\x00\x1e7" + // 0x006C0323: 0x00001E37 - "\x1e6\x03\x04\x00\x00\x1e8" + // 0x1E360304: 0x00001E38 - "\x1e7\x03\x04\x00\x00\x1e9" + // 0x1E370304: 0x00001E39 - "\x00L\x031\x00\x00\x1e:" + // 0x004C0331: 0x00001E3A - "\x00l\x031\x00\x00\x1e;" + // 0x006C0331: 0x00001E3B - "\x00L\x03-\x00\x00\x1e<" + // 0x004C032D: 0x00001E3C - "\x00l\x03-\x00\x00\x1e=" + // 0x006C032D: 0x00001E3D - "\x00M\x03\x01\x00\x00\x1e>" + // 0x004D0301: 0x00001E3E - "\x00m\x03\x01\x00\x00\x1e?" + // 0x006D0301: 0x00001E3F - "\x00M\x03\a\x00\x00\x1e@" + // 0x004D0307: 0x00001E40 - "\x00m\x03\a\x00\x00\x1eA" + // 0x006D0307: 0x00001E41 - "\x00M\x03#\x00\x00\x1eB" + // 0x004D0323: 0x00001E42 - "\x00m\x03#\x00\x00\x1eC" + // 0x006D0323: 0x00001E43 - "\x00N\x03\a\x00\x00\x1eD" + // 0x004E0307: 0x00001E44 - "\x00n\x03\a\x00\x00\x1eE" + // 0x006E0307: 0x00001E45 - "\x00N\x03#\x00\x00\x1eF" + // 0x004E0323: 0x00001E46 - "\x00n\x03#\x00\x00\x1eG" + // 0x006E0323: 0x00001E47 - "\x00N\x031\x00\x00\x1eH" + // 0x004E0331: 0x00001E48 - "\x00n\x031\x00\x00\x1eI" + // 0x006E0331: 0x00001E49 - "\x00N\x03-\x00\x00\x1eJ" + // 0x004E032D: 0x00001E4A - "\x00n\x03-\x00\x00\x1eK" + // 0x006E032D: 0x00001E4B - "\x00\xd5\x03\x01\x00\x00\x1eL" + // 0x00D50301: 0x00001E4C - "\x00\xf5\x03\x01\x00\x00\x1eM" + // 0x00F50301: 0x00001E4D - "\x00\xd5\x03\b\x00\x00\x1eN" + // 0x00D50308: 0x00001E4E - "\x00\xf5\x03\b\x00\x00\x1eO" + // 0x00F50308: 0x00001E4F - "\x01L\x03\x00\x00\x00\x1eP" + // 0x014C0300: 0x00001E50 - "\x01M\x03\x00\x00\x00\x1eQ" + // 0x014D0300: 0x00001E51 - "\x01L\x03\x01\x00\x00\x1eR" + // 0x014C0301: 0x00001E52 - "\x01M\x03\x01\x00\x00\x1eS" + // 0x014D0301: 0x00001E53 - "\x00P\x03\x01\x00\x00\x1eT" + // 0x00500301: 0x00001E54 - "\x00p\x03\x01\x00\x00\x1eU" + // 0x00700301: 0x00001E55 - "\x00P\x03\a\x00\x00\x1eV" + // 0x00500307: 0x00001E56 - "\x00p\x03\a\x00\x00\x1eW" + // 0x00700307: 0x00001E57 - "\x00R\x03\a\x00\x00\x1eX" + // 0x00520307: 0x00001E58 - "\x00r\x03\a\x00\x00\x1eY" + // 0x00720307: 0x00001E59 - "\x00R\x03#\x00\x00\x1eZ" + // 0x00520323: 0x00001E5A - "\x00r\x03#\x00\x00\x1e[" + // 0x00720323: 0x00001E5B - "\x1eZ\x03\x04\x00\x00\x1e\\" + // 0x1E5A0304: 0x00001E5C - "\x1e[\x03\x04\x00\x00\x1e]" + // 0x1E5B0304: 0x00001E5D - "\x00R\x031\x00\x00\x1e^" + // 0x00520331: 0x00001E5E - "\x00r\x031\x00\x00\x1e_" + // 0x00720331: 0x00001E5F - "\x00S\x03\a\x00\x00\x1e`" + // 0x00530307: 0x00001E60 - "\x00s\x03\a\x00\x00\x1ea" + // 0x00730307: 0x00001E61 - "\x00S\x03#\x00\x00\x1eb" + // 0x00530323: 0x00001E62 - "\x00s\x03#\x00\x00\x1ec" + // 0x00730323: 0x00001E63 - "\x01Z\x03\a\x00\x00\x1ed" + // 0x015A0307: 0x00001E64 - "\x01[\x03\a\x00\x00\x1ee" + // 0x015B0307: 0x00001E65 - "\x01`\x03\a\x00\x00\x1ef" + // 0x01600307: 0x00001E66 - "\x01a\x03\a\x00\x00\x1eg" + // 0x01610307: 0x00001E67 - "\x1eb\x03\a\x00\x00\x1eh" + // 0x1E620307: 0x00001E68 - "\x1ec\x03\a\x00\x00\x1ei" + // 0x1E630307: 0x00001E69 - "\x00T\x03\a\x00\x00\x1ej" + // 0x00540307: 0x00001E6A - "\x00t\x03\a\x00\x00\x1ek" + // 0x00740307: 0x00001E6B - "\x00T\x03#\x00\x00\x1el" + // 0x00540323: 0x00001E6C - "\x00t\x03#\x00\x00\x1em" + // 0x00740323: 0x00001E6D - "\x00T\x031\x00\x00\x1en" + // 0x00540331: 0x00001E6E - "\x00t\x031\x00\x00\x1eo" + // 0x00740331: 0x00001E6F - "\x00T\x03-\x00\x00\x1ep" + // 0x0054032D: 0x00001E70 - "\x00t\x03-\x00\x00\x1eq" + // 0x0074032D: 0x00001E71 - "\x00U\x03$\x00\x00\x1er" + // 0x00550324: 0x00001E72 - "\x00u\x03$\x00\x00\x1es" + // 0x00750324: 0x00001E73 - "\x00U\x030\x00\x00\x1et" + // 0x00550330: 0x00001E74 - "\x00u\x030\x00\x00\x1eu" + // 0x00750330: 0x00001E75 - "\x00U\x03-\x00\x00\x1ev" + // 0x0055032D: 0x00001E76 - "\x00u\x03-\x00\x00\x1ew" + // 0x0075032D: 0x00001E77 - "\x01h\x03\x01\x00\x00\x1ex" + // 0x01680301: 0x00001E78 - "\x01i\x03\x01\x00\x00\x1ey" + // 0x01690301: 0x00001E79 - "\x01j\x03\b\x00\x00\x1ez" + // 0x016A0308: 0x00001E7A - "\x01k\x03\b\x00\x00\x1e{" + // 0x016B0308: 0x00001E7B - "\x00V\x03\x03\x00\x00\x1e|" + // 0x00560303: 0x00001E7C - "\x00v\x03\x03\x00\x00\x1e}" + // 0x00760303: 0x00001E7D - "\x00V\x03#\x00\x00\x1e~" + // 0x00560323: 0x00001E7E - "\x00v\x03#\x00\x00\x1e\u007f" + // 0x00760323: 0x00001E7F - "\x00W\x03\x00\x00\x00\x1e\x80" + // 0x00570300: 0x00001E80 - "\x00w\x03\x00\x00\x00\x1e\x81" + // 0x00770300: 0x00001E81 - "\x00W\x03\x01\x00\x00\x1e\x82" + // 0x00570301: 0x00001E82 - "\x00w\x03\x01\x00\x00\x1e\x83" + // 0x00770301: 0x00001E83 - "\x00W\x03\b\x00\x00\x1e\x84" + // 0x00570308: 0x00001E84 - "\x00w\x03\b\x00\x00\x1e\x85" + // 0x00770308: 0x00001E85 - "\x00W\x03\a\x00\x00\x1e\x86" + // 0x00570307: 0x00001E86 - "\x00w\x03\a\x00\x00\x1e\x87" + // 0x00770307: 0x00001E87 - "\x00W\x03#\x00\x00\x1e\x88" + // 0x00570323: 0x00001E88 - "\x00w\x03#\x00\x00\x1e\x89" + // 0x00770323: 0x00001E89 - "\x00X\x03\a\x00\x00\x1e\x8a" + // 0x00580307: 0x00001E8A - "\x00x\x03\a\x00\x00\x1e\x8b" + // 0x00780307: 0x00001E8B - "\x00X\x03\b\x00\x00\x1e\x8c" + // 0x00580308: 0x00001E8C - "\x00x\x03\b\x00\x00\x1e\x8d" + // 0x00780308: 0x00001E8D - "\x00Y\x03\a\x00\x00\x1e\x8e" + // 0x00590307: 0x00001E8E - "\x00y\x03\a\x00\x00\x1e\x8f" + // 0x00790307: 0x00001E8F - "\x00Z\x03\x02\x00\x00\x1e\x90" + // 0x005A0302: 0x00001E90 - "\x00z\x03\x02\x00\x00\x1e\x91" + // 0x007A0302: 0x00001E91 - "\x00Z\x03#\x00\x00\x1e\x92" + // 0x005A0323: 0x00001E92 - "\x00z\x03#\x00\x00\x1e\x93" + // 0x007A0323: 0x00001E93 - "\x00Z\x031\x00\x00\x1e\x94" + // 0x005A0331: 0x00001E94 - "\x00z\x031\x00\x00\x1e\x95" + // 0x007A0331: 0x00001E95 - "\x00h\x031\x00\x00\x1e\x96" + // 0x00680331: 0x00001E96 - "\x00t\x03\b\x00\x00\x1e\x97" + // 0x00740308: 0x00001E97 - "\x00w\x03\n\x00\x00\x1e\x98" + // 0x0077030A: 0x00001E98 - "\x00y\x03\n\x00\x00\x1e\x99" + // 0x0079030A: 0x00001E99 - "\x01\u007f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B - "\x00A\x03#\x00\x00\x1e\xa0" + // 0x00410323: 0x00001EA0 - "\x00a\x03#\x00\x00\x1e\xa1" + // 0x00610323: 0x00001EA1 - "\x00A\x03\t\x00\x00\x1e\xa2" + // 0x00410309: 0x00001EA2 - "\x00a\x03\t\x00\x00\x1e\xa3" + // 0x00610309: 0x00001EA3 - "\x00\xc2\x03\x01\x00\x00\x1e\xa4" + // 0x00C20301: 0x00001EA4 - "\x00\xe2\x03\x01\x00\x00\x1e\xa5" + // 0x00E20301: 0x00001EA5 - "\x00\xc2\x03\x00\x00\x00\x1e\xa6" + // 0x00C20300: 0x00001EA6 - "\x00\xe2\x03\x00\x00\x00\x1e\xa7" + // 0x00E20300: 0x00001EA7 - "\x00\xc2\x03\t\x00\x00\x1e\xa8" + // 0x00C20309: 0x00001EA8 - "\x00\xe2\x03\t\x00\x00\x1e\xa9" + // 0x00E20309: 0x00001EA9 - "\x00\xc2\x03\x03\x00\x00\x1e\xaa" + // 0x00C20303: 0x00001EAA - "\x00\xe2\x03\x03\x00\x00\x1e\xab" + // 0x00E20303: 0x00001EAB - "\x1e\xa0\x03\x02\x00\x00\x1e\xac" + // 0x1EA00302: 0x00001EAC - "\x1e\xa1\x03\x02\x00\x00\x1e\xad" + // 0x1EA10302: 0x00001EAD - "\x01\x02\x03\x01\x00\x00\x1e\xae" + // 0x01020301: 0x00001EAE - "\x01\x03\x03\x01\x00\x00\x1e\xaf" + // 0x01030301: 0x00001EAF - "\x01\x02\x03\x00\x00\x00\x1e\xb0" + // 0x01020300: 0x00001EB0 - "\x01\x03\x03\x00\x00\x00\x1e\xb1" + // 0x01030300: 0x00001EB1 - "\x01\x02\x03\t\x00\x00\x1e\xb2" + // 0x01020309: 0x00001EB2 - "\x01\x03\x03\t\x00\x00\x1e\xb3" + // 0x01030309: 0x00001EB3 - "\x01\x02\x03\x03\x00\x00\x1e\xb4" + // 0x01020303: 0x00001EB4 - "\x01\x03\x03\x03\x00\x00\x1e\xb5" + // 0x01030303: 0x00001EB5 - "\x1e\xa0\x03\x06\x00\x00\x1e\xb6" + // 0x1EA00306: 0x00001EB6 - "\x1e\xa1\x03\x06\x00\x00\x1e\xb7" + // 0x1EA10306: 0x00001EB7 - "\x00E\x03#\x00\x00\x1e\xb8" + // 0x00450323: 0x00001EB8 - "\x00e\x03#\x00\x00\x1e\xb9" + // 0x00650323: 0x00001EB9 - "\x00E\x03\t\x00\x00\x1e\xba" + // 0x00450309: 0x00001EBA - "\x00e\x03\t\x00\x00\x1e\xbb" + // 0x00650309: 0x00001EBB - "\x00E\x03\x03\x00\x00\x1e\xbc" + // 0x00450303: 0x00001EBC - "\x00e\x03\x03\x00\x00\x1e\xbd" + // 0x00650303: 0x00001EBD - "\x00\xca\x03\x01\x00\x00\x1e\xbe" + // 0x00CA0301: 0x00001EBE - "\x00\xea\x03\x01\x00\x00\x1e\xbf" + // 0x00EA0301: 0x00001EBF - "\x00\xca\x03\x00\x00\x00\x1e\xc0" + // 0x00CA0300: 0x00001EC0 - "\x00\xea\x03\x00\x00\x00\x1e\xc1" + // 0x00EA0300: 0x00001EC1 - "\x00\xca\x03\t\x00\x00\x1e\xc2" + // 0x00CA0309: 0x00001EC2 - "\x00\xea\x03\t\x00\x00\x1e\xc3" + // 0x00EA0309: 0x00001EC3 - "\x00\xca\x03\x03\x00\x00\x1e\xc4" + // 0x00CA0303: 0x00001EC4 - "\x00\xea\x03\x03\x00\x00\x1e\xc5" + // 0x00EA0303: 0x00001EC5 - "\x1e\xb8\x03\x02\x00\x00\x1e\xc6" + // 0x1EB80302: 0x00001EC6 - "\x1e\xb9\x03\x02\x00\x00\x1e\xc7" + // 0x1EB90302: 0x00001EC7 - "\x00I\x03\t\x00\x00\x1e\xc8" + // 0x00490309: 0x00001EC8 - "\x00i\x03\t\x00\x00\x1e\xc9" + // 0x00690309: 0x00001EC9 - "\x00I\x03#\x00\x00\x1e\xca" + // 0x00490323: 0x00001ECA - "\x00i\x03#\x00\x00\x1e\xcb" + // 0x00690323: 0x00001ECB - "\x00O\x03#\x00\x00\x1e\xcc" + // 0x004F0323: 0x00001ECC - "\x00o\x03#\x00\x00\x1e\xcd" + // 0x006F0323: 0x00001ECD - "\x00O\x03\t\x00\x00\x1e\xce" + // 0x004F0309: 0x00001ECE - "\x00o\x03\t\x00\x00\x1e\xcf" + // 0x006F0309: 0x00001ECF - "\x00\xd4\x03\x01\x00\x00\x1e\xd0" + // 0x00D40301: 0x00001ED0 - "\x00\xf4\x03\x01\x00\x00\x1e\xd1" + // 0x00F40301: 0x00001ED1 - "\x00\xd4\x03\x00\x00\x00\x1e\xd2" + // 0x00D40300: 0x00001ED2 - "\x00\xf4\x03\x00\x00\x00\x1e\xd3" + // 0x00F40300: 0x00001ED3 - "\x00\xd4\x03\t\x00\x00\x1e\xd4" + // 0x00D40309: 0x00001ED4 - "\x00\xf4\x03\t\x00\x00\x1e\xd5" + // 0x00F40309: 0x00001ED5 - "\x00\xd4\x03\x03\x00\x00\x1e\xd6" + // 0x00D40303: 0x00001ED6 - "\x00\xf4\x03\x03\x00\x00\x1e\xd7" + // 0x00F40303: 0x00001ED7 - "\x1e\xcc\x03\x02\x00\x00\x1e\xd8" + // 0x1ECC0302: 0x00001ED8 - "\x1e\xcd\x03\x02\x00\x00\x1e\xd9" + // 0x1ECD0302: 0x00001ED9 - "\x01\xa0\x03\x01\x00\x00\x1e\xda" + // 0x01A00301: 0x00001EDA - "\x01\xa1\x03\x01\x00\x00\x1e\xdb" + // 0x01A10301: 0x00001EDB - "\x01\xa0\x03\x00\x00\x00\x1e\xdc" + // 0x01A00300: 0x00001EDC - "\x01\xa1\x03\x00\x00\x00\x1e\xdd" + // 0x01A10300: 0x00001EDD - "\x01\xa0\x03\t\x00\x00\x1e\xde" + // 0x01A00309: 0x00001EDE - "\x01\xa1\x03\t\x00\x00\x1e\xdf" + // 0x01A10309: 0x00001EDF - "\x01\xa0\x03\x03\x00\x00\x1e\xe0" + // 0x01A00303: 0x00001EE0 - "\x01\xa1\x03\x03\x00\x00\x1e\xe1" + // 0x01A10303: 0x00001EE1 - "\x01\xa0\x03#\x00\x00\x1e\xe2" + // 0x01A00323: 0x00001EE2 - "\x01\xa1\x03#\x00\x00\x1e\xe3" + // 0x01A10323: 0x00001EE3 - "\x00U\x03#\x00\x00\x1e\xe4" + // 0x00550323: 0x00001EE4 - "\x00u\x03#\x00\x00\x1e\xe5" + // 0x00750323: 0x00001EE5 - "\x00U\x03\t\x00\x00\x1e\xe6" + // 0x00550309: 0x00001EE6 - "\x00u\x03\t\x00\x00\x1e\xe7" + // 0x00750309: 0x00001EE7 - "\x01\xaf\x03\x01\x00\x00\x1e\xe8" + // 0x01AF0301: 0x00001EE8 - "\x01\xb0\x03\x01\x00\x00\x1e\xe9" + // 0x01B00301: 0x00001EE9 - "\x01\xaf\x03\x00\x00\x00\x1e\xea" + // 0x01AF0300: 0x00001EEA - "\x01\xb0\x03\x00\x00\x00\x1e\xeb" + // 0x01B00300: 0x00001EEB - "\x01\xaf\x03\t\x00\x00\x1e\xec" + // 0x01AF0309: 0x00001EEC - "\x01\xb0\x03\t\x00\x00\x1e\xed" + // 0x01B00309: 0x00001EED - "\x01\xaf\x03\x03\x00\x00\x1e\xee" + // 0x01AF0303: 0x00001EEE - "\x01\xb0\x03\x03\x00\x00\x1e\xef" + // 0x01B00303: 0x00001EEF - "\x01\xaf\x03#\x00\x00\x1e\xf0" + // 0x01AF0323: 0x00001EF0 - "\x01\xb0\x03#\x00\x00\x1e\xf1" + // 0x01B00323: 0x00001EF1 - "\x00Y\x03\x00\x00\x00\x1e\xf2" + // 0x00590300: 0x00001EF2 - "\x00y\x03\x00\x00\x00\x1e\xf3" + // 0x00790300: 0x00001EF3 - "\x00Y\x03#\x00\x00\x1e\xf4" + // 0x00590323: 0x00001EF4 - "\x00y\x03#\x00\x00\x1e\xf5" + // 0x00790323: 0x00001EF5 - "\x00Y\x03\t\x00\x00\x1e\xf6" + // 0x00590309: 0x00001EF6 - "\x00y\x03\t\x00\x00\x1e\xf7" + // 0x00790309: 0x00001EF7 - "\x00Y\x03\x03\x00\x00\x1e\xf8" + // 0x00590303: 0x00001EF8 - "\x00y\x03\x03\x00\x00\x1e\xf9" + // 0x00790303: 0x00001EF9 - "\x03\xb1\x03\x13\x00\x00\x1f\x00" + // 0x03B10313: 0x00001F00 - "\x03\xb1\x03\x14\x00\x00\x1f\x01" + // 0x03B10314: 0x00001F01 - "\x1f\x00\x03\x00\x00\x00\x1f\x02" + // 0x1F000300: 0x00001F02 - "\x1f\x01\x03\x00\x00\x00\x1f\x03" + // 0x1F010300: 0x00001F03 - "\x1f\x00\x03\x01\x00\x00\x1f\x04" + // 0x1F000301: 0x00001F04 - "\x1f\x01\x03\x01\x00\x00\x1f\x05" + // 0x1F010301: 0x00001F05 - "\x1f\x00\x03B\x00\x00\x1f\x06" + // 0x1F000342: 0x00001F06 - "\x1f\x01\x03B\x00\x00\x1f\a" + // 0x1F010342: 0x00001F07 - "\x03\x91\x03\x13\x00\x00\x1f\b" + // 0x03910313: 0x00001F08 - "\x03\x91\x03\x14\x00\x00\x1f\t" + // 0x03910314: 0x00001F09 - "\x1f\b\x03\x00\x00\x00\x1f\n" + // 0x1F080300: 0x00001F0A - "\x1f\t\x03\x00\x00\x00\x1f\v" + // 0x1F090300: 0x00001F0B - "\x1f\b\x03\x01\x00\x00\x1f\f" + // 0x1F080301: 0x00001F0C - "\x1f\t\x03\x01\x00\x00\x1f\r" + // 0x1F090301: 0x00001F0D - "\x1f\b\x03B\x00\x00\x1f\x0e" + // 0x1F080342: 0x00001F0E - "\x1f\t\x03B\x00\x00\x1f\x0f" + // 0x1F090342: 0x00001F0F - "\x03\xb5\x03\x13\x00\x00\x1f\x10" + // 0x03B50313: 0x00001F10 - "\x03\xb5\x03\x14\x00\x00\x1f\x11" + // 0x03B50314: 0x00001F11 - "\x1f\x10\x03\x00\x00\x00\x1f\x12" + // 0x1F100300: 0x00001F12 - "\x1f\x11\x03\x00\x00\x00\x1f\x13" + // 0x1F110300: 0x00001F13 - "\x1f\x10\x03\x01\x00\x00\x1f\x14" + // 0x1F100301: 0x00001F14 - "\x1f\x11\x03\x01\x00\x00\x1f\x15" + // 0x1F110301: 0x00001F15 - "\x03\x95\x03\x13\x00\x00\x1f\x18" + // 0x03950313: 0x00001F18 - "\x03\x95\x03\x14\x00\x00\x1f\x19" + // 0x03950314: 0x00001F19 - "\x1f\x18\x03\x00\x00\x00\x1f\x1a" + // 0x1F180300: 0x00001F1A - "\x1f\x19\x03\x00\x00\x00\x1f\x1b" + // 0x1F190300: 0x00001F1B - "\x1f\x18\x03\x01\x00\x00\x1f\x1c" + // 0x1F180301: 0x00001F1C - "\x1f\x19\x03\x01\x00\x00\x1f\x1d" + // 0x1F190301: 0x00001F1D - "\x03\xb7\x03\x13\x00\x00\x1f " + // 0x03B70313: 0x00001F20 - "\x03\xb7\x03\x14\x00\x00\x1f!" + // 0x03B70314: 0x00001F21 - "\x1f \x03\x00\x00\x00\x1f\"" + // 0x1F200300: 0x00001F22 - "\x1f!\x03\x00\x00\x00\x1f#" + // 0x1F210300: 0x00001F23 - "\x1f \x03\x01\x00\x00\x1f$" + // 0x1F200301: 0x00001F24 - "\x1f!\x03\x01\x00\x00\x1f%" + // 0x1F210301: 0x00001F25 - "\x1f \x03B\x00\x00\x1f&" + // 0x1F200342: 0x00001F26 - "\x1f!\x03B\x00\x00\x1f'" + // 0x1F210342: 0x00001F27 - "\x03\x97\x03\x13\x00\x00\x1f(" + // 0x03970313: 0x00001F28 - "\x03\x97\x03\x14\x00\x00\x1f)" + // 0x03970314: 0x00001F29 - "\x1f(\x03\x00\x00\x00\x1f*" + // 0x1F280300: 0x00001F2A - "\x1f)\x03\x00\x00\x00\x1f+" + // 0x1F290300: 0x00001F2B - "\x1f(\x03\x01\x00\x00\x1f," + // 0x1F280301: 0x00001F2C - "\x1f)\x03\x01\x00\x00\x1f-" + // 0x1F290301: 0x00001F2D - "\x1f(\x03B\x00\x00\x1f." + // 0x1F280342: 0x00001F2E - "\x1f)\x03B\x00\x00\x1f/" + // 0x1F290342: 0x00001F2F - "\x03\xb9\x03\x13\x00\x00\x1f0" + // 0x03B90313: 0x00001F30 - "\x03\xb9\x03\x14\x00\x00\x1f1" + // 0x03B90314: 0x00001F31 - "\x1f0\x03\x00\x00\x00\x1f2" + // 0x1F300300: 0x00001F32 - "\x1f1\x03\x00\x00\x00\x1f3" + // 0x1F310300: 0x00001F33 - "\x1f0\x03\x01\x00\x00\x1f4" + // 0x1F300301: 0x00001F34 - "\x1f1\x03\x01\x00\x00\x1f5" + // 0x1F310301: 0x00001F35 - "\x1f0\x03B\x00\x00\x1f6" + // 0x1F300342: 0x00001F36 - "\x1f1\x03B\x00\x00\x1f7" + // 0x1F310342: 0x00001F37 - "\x03\x99\x03\x13\x00\x00\x1f8" + // 0x03990313: 0x00001F38 - "\x03\x99\x03\x14\x00\x00\x1f9" + // 0x03990314: 0x00001F39 - "\x1f8\x03\x00\x00\x00\x1f:" + // 0x1F380300: 0x00001F3A - "\x1f9\x03\x00\x00\x00\x1f;" + // 0x1F390300: 0x00001F3B - "\x1f8\x03\x01\x00\x00\x1f<" + // 0x1F380301: 0x00001F3C - "\x1f9\x03\x01\x00\x00\x1f=" + // 0x1F390301: 0x00001F3D - "\x1f8\x03B\x00\x00\x1f>" + // 0x1F380342: 0x00001F3E - "\x1f9\x03B\x00\x00\x1f?" + // 0x1F390342: 0x00001F3F - "\x03\xbf\x03\x13\x00\x00\x1f@" + // 0x03BF0313: 0x00001F40 - "\x03\xbf\x03\x14\x00\x00\x1fA" + // 0x03BF0314: 0x00001F41 - "\x1f@\x03\x00\x00\x00\x1fB" + // 0x1F400300: 0x00001F42 - "\x1fA\x03\x00\x00\x00\x1fC" + // 0x1F410300: 0x00001F43 - "\x1f@\x03\x01\x00\x00\x1fD" + // 0x1F400301: 0x00001F44 - "\x1fA\x03\x01\x00\x00\x1fE" + // 0x1F410301: 0x00001F45 - "\x03\x9f\x03\x13\x00\x00\x1fH" + // 0x039F0313: 0x00001F48 - "\x03\x9f\x03\x14\x00\x00\x1fI" + // 0x039F0314: 0x00001F49 - "\x1fH\x03\x00\x00\x00\x1fJ" + // 0x1F480300: 0x00001F4A - "\x1fI\x03\x00\x00\x00\x1fK" + // 0x1F490300: 0x00001F4B - "\x1fH\x03\x01\x00\x00\x1fL" + // 0x1F480301: 0x00001F4C - "\x1fI\x03\x01\x00\x00\x1fM" + // 0x1F490301: 0x00001F4D - "\x03\xc5\x03\x13\x00\x00\x1fP" + // 0x03C50313: 0x00001F50 - "\x03\xc5\x03\x14\x00\x00\x1fQ" + // 0x03C50314: 0x00001F51 - "\x1fP\x03\x00\x00\x00\x1fR" + // 0x1F500300: 0x00001F52 - "\x1fQ\x03\x00\x00\x00\x1fS" + // 0x1F510300: 0x00001F53 - "\x1fP\x03\x01\x00\x00\x1fT" + // 0x1F500301: 0x00001F54 - "\x1fQ\x03\x01\x00\x00\x1fU" + // 0x1F510301: 0x00001F55 - "\x1fP\x03B\x00\x00\x1fV" + // 0x1F500342: 0x00001F56 - "\x1fQ\x03B\x00\x00\x1fW" + // 0x1F510342: 0x00001F57 - "\x03\xa5\x03\x14\x00\x00\x1fY" + // 0x03A50314: 0x00001F59 - "\x1fY\x03\x00\x00\x00\x1f[" + // 0x1F590300: 0x00001F5B - "\x1fY\x03\x01\x00\x00\x1f]" + // 0x1F590301: 0x00001F5D - "\x1fY\x03B\x00\x00\x1f_" + // 0x1F590342: 0x00001F5F - "\x03\xc9\x03\x13\x00\x00\x1f`" + // 0x03C90313: 0x00001F60 - "\x03\xc9\x03\x14\x00\x00\x1fa" + // 0x03C90314: 0x00001F61 - "\x1f`\x03\x00\x00\x00\x1fb" + // 0x1F600300: 0x00001F62 - "\x1fa\x03\x00\x00\x00\x1fc" + // 0x1F610300: 0x00001F63 - "\x1f`\x03\x01\x00\x00\x1fd" + // 0x1F600301: 0x00001F64 - "\x1fa\x03\x01\x00\x00\x1fe" + // 0x1F610301: 0x00001F65 - "\x1f`\x03B\x00\x00\x1ff" + // 0x1F600342: 0x00001F66 - "\x1fa\x03B\x00\x00\x1fg" + // 0x1F610342: 0x00001F67 - "\x03\xa9\x03\x13\x00\x00\x1fh" + // 0x03A90313: 0x00001F68 - "\x03\xa9\x03\x14\x00\x00\x1fi" + // 0x03A90314: 0x00001F69 - "\x1fh\x03\x00\x00\x00\x1fj" + // 0x1F680300: 0x00001F6A - "\x1fi\x03\x00\x00\x00\x1fk" + // 0x1F690300: 0x00001F6B - "\x1fh\x03\x01\x00\x00\x1fl" + // 0x1F680301: 0x00001F6C - "\x1fi\x03\x01\x00\x00\x1fm" + // 0x1F690301: 0x00001F6D - "\x1fh\x03B\x00\x00\x1fn" + // 0x1F680342: 0x00001F6E - "\x1fi\x03B\x00\x00\x1fo" + // 0x1F690342: 0x00001F6F - "\x03\xb1\x03\x00\x00\x00\x1fp" + // 0x03B10300: 0x00001F70 - "\x03\xb5\x03\x00\x00\x00\x1fr" + // 0x03B50300: 0x00001F72 - "\x03\xb7\x03\x00\x00\x00\x1ft" + // 0x03B70300: 0x00001F74 - "\x03\xb9\x03\x00\x00\x00\x1fv" + // 0x03B90300: 0x00001F76 - "\x03\xbf\x03\x00\x00\x00\x1fx" + // 0x03BF0300: 0x00001F78 - "\x03\xc5\x03\x00\x00\x00\x1fz" + // 0x03C50300: 0x00001F7A - "\x03\xc9\x03\x00\x00\x00\x1f|" + // 0x03C90300: 0x00001F7C - "\x1f\x00\x03E\x00\x00\x1f\x80" + // 0x1F000345: 0x00001F80 - "\x1f\x01\x03E\x00\x00\x1f\x81" + // 0x1F010345: 0x00001F81 - "\x1f\x02\x03E\x00\x00\x1f\x82" + // 0x1F020345: 0x00001F82 - "\x1f\x03\x03E\x00\x00\x1f\x83" + // 0x1F030345: 0x00001F83 - "\x1f\x04\x03E\x00\x00\x1f\x84" + // 0x1F040345: 0x00001F84 - "\x1f\x05\x03E\x00\x00\x1f\x85" + // 0x1F050345: 0x00001F85 - "\x1f\x06\x03E\x00\x00\x1f\x86" + // 0x1F060345: 0x00001F86 - "\x1f\a\x03E\x00\x00\x1f\x87" + // 0x1F070345: 0x00001F87 - "\x1f\b\x03E\x00\x00\x1f\x88" + // 0x1F080345: 0x00001F88 - "\x1f\t\x03E\x00\x00\x1f\x89" + // 0x1F090345: 0x00001F89 - "\x1f\n\x03E\x00\x00\x1f\x8a" + // 0x1F0A0345: 0x00001F8A - "\x1f\v\x03E\x00\x00\x1f\x8b" + // 0x1F0B0345: 0x00001F8B - "\x1f\f\x03E\x00\x00\x1f\x8c" + // 0x1F0C0345: 0x00001F8C - "\x1f\r\x03E\x00\x00\x1f\x8d" + // 0x1F0D0345: 0x00001F8D - "\x1f\x0e\x03E\x00\x00\x1f\x8e" + // 0x1F0E0345: 0x00001F8E - "\x1f\x0f\x03E\x00\x00\x1f\x8f" + // 0x1F0F0345: 0x00001F8F - "\x1f \x03E\x00\x00\x1f\x90" + // 0x1F200345: 0x00001F90 - "\x1f!\x03E\x00\x00\x1f\x91" + // 0x1F210345: 0x00001F91 - "\x1f\"\x03E\x00\x00\x1f\x92" + // 0x1F220345: 0x00001F92 - "\x1f#\x03E\x00\x00\x1f\x93" + // 0x1F230345: 0x00001F93 - "\x1f$\x03E\x00\x00\x1f\x94" + // 0x1F240345: 0x00001F94 - "\x1f%\x03E\x00\x00\x1f\x95" + // 0x1F250345: 0x00001F95 - "\x1f&\x03E\x00\x00\x1f\x96" + // 0x1F260345: 0x00001F96 - "\x1f'\x03E\x00\x00\x1f\x97" + // 0x1F270345: 0x00001F97 - "\x1f(\x03E\x00\x00\x1f\x98" + // 0x1F280345: 0x00001F98 - "\x1f)\x03E\x00\x00\x1f\x99" + // 0x1F290345: 0x00001F99 - "\x1f*\x03E\x00\x00\x1f\x9a" + // 0x1F2A0345: 0x00001F9A - "\x1f+\x03E\x00\x00\x1f\x9b" + // 0x1F2B0345: 0x00001F9B - "\x1f,\x03E\x00\x00\x1f\x9c" + // 0x1F2C0345: 0x00001F9C - "\x1f-\x03E\x00\x00\x1f\x9d" + // 0x1F2D0345: 0x00001F9D - "\x1f.\x03E\x00\x00\x1f\x9e" + // 0x1F2E0345: 0x00001F9E - "\x1f/\x03E\x00\x00\x1f\x9f" + // 0x1F2F0345: 0x00001F9F - "\x1f`\x03E\x00\x00\x1f\xa0" + // 0x1F600345: 0x00001FA0 - "\x1fa\x03E\x00\x00\x1f\xa1" + // 0x1F610345: 0x00001FA1 - "\x1fb\x03E\x00\x00\x1f\xa2" + // 0x1F620345: 0x00001FA2 - "\x1fc\x03E\x00\x00\x1f\xa3" + // 0x1F630345: 0x00001FA3 - "\x1fd\x03E\x00\x00\x1f\xa4" + // 0x1F640345: 0x00001FA4 - "\x1fe\x03E\x00\x00\x1f\xa5" + // 0x1F650345: 0x00001FA5 - "\x1ff\x03E\x00\x00\x1f\xa6" + // 0x1F660345: 0x00001FA6 - "\x1fg\x03E\x00\x00\x1f\xa7" + // 0x1F670345: 0x00001FA7 - "\x1fh\x03E\x00\x00\x1f\xa8" + // 0x1F680345: 0x00001FA8 - "\x1fi\x03E\x00\x00\x1f\xa9" + // 0x1F690345: 0x00001FA9 - "\x1fj\x03E\x00\x00\x1f\xaa" + // 0x1F6A0345: 0x00001FAA - "\x1fk\x03E\x00\x00\x1f\xab" + // 0x1F6B0345: 0x00001FAB - "\x1fl\x03E\x00\x00\x1f\xac" + // 0x1F6C0345: 0x00001FAC - "\x1fm\x03E\x00\x00\x1f\xad" + // 0x1F6D0345: 0x00001FAD - "\x1fn\x03E\x00\x00\x1f\xae" + // 0x1F6E0345: 0x00001FAE - "\x1fo\x03E\x00\x00\x1f\xaf" + // 0x1F6F0345: 0x00001FAF - "\x03\xb1\x03\x06\x00\x00\x1f\xb0" + // 0x03B10306: 0x00001FB0 - "\x03\xb1\x03\x04\x00\x00\x1f\xb1" + // 0x03B10304: 0x00001FB1 - "\x1fp\x03E\x00\x00\x1f\xb2" + // 0x1F700345: 0x00001FB2 - "\x03\xb1\x03E\x00\x00\x1f\xb3" + // 0x03B10345: 0x00001FB3 - "\x03\xac\x03E\x00\x00\x1f\xb4" + // 0x03AC0345: 0x00001FB4 - "\x03\xb1\x03B\x00\x00\x1f\xb6" + // 0x03B10342: 0x00001FB6 - "\x1f\xb6\x03E\x00\x00\x1f\xb7" + // 0x1FB60345: 0x00001FB7 - "\x03\x91\x03\x06\x00\x00\x1f\xb8" + // 0x03910306: 0x00001FB8 - "\x03\x91\x03\x04\x00\x00\x1f\xb9" + // 0x03910304: 0x00001FB9 - "\x03\x91\x03\x00\x00\x00\x1f\xba" + // 0x03910300: 0x00001FBA - "\x03\x91\x03E\x00\x00\x1f\xbc" + // 0x03910345: 0x00001FBC - "\x00\xa8\x03B\x00\x00\x1f\xc1" + // 0x00A80342: 0x00001FC1 - "\x1ft\x03E\x00\x00\x1f\xc2" + // 0x1F740345: 0x00001FC2 - "\x03\xb7\x03E\x00\x00\x1f\xc3" + // 0x03B70345: 0x00001FC3 - "\x03\xae\x03E\x00\x00\x1f\xc4" + // 0x03AE0345: 0x00001FC4 - "\x03\xb7\x03B\x00\x00\x1f\xc6" + // 0x03B70342: 0x00001FC6 - "\x1f\xc6\x03E\x00\x00\x1f\xc7" + // 0x1FC60345: 0x00001FC7 - "\x03\x95\x03\x00\x00\x00\x1f\xc8" + // 0x03950300: 0x00001FC8 - "\x03\x97\x03\x00\x00\x00\x1f\xca" + // 0x03970300: 0x00001FCA - "\x03\x97\x03E\x00\x00\x1f\xcc" + // 0x03970345: 0x00001FCC - "\x1f\xbf\x03\x00\x00\x00\x1f\xcd" + // 0x1FBF0300: 0x00001FCD - "\x1f\xbf\x03\x01\x00\x00\x1f\xce" + // 0x1FBF0301: 0x00001FCE - "\x1f\xbf\x03B\x00\x00\x1f\xcf" + // 0x1FBF0342: 0x00001FCF - "\x03\xb9\x03\x06\x00\x00\x1f\xd0" + // 0x03B90306: 0x00001FD0 - "\x03\xb9\x03\x04\x00\x00\x1f\xd1" + // 0x03B90304: 0x00001FD1 - "\x03\xca\x03\x00\x00\x00\x1f\xd2" + // 0x03CA0300: 0x00001FD2 - "\x03\xb9\x03B\x00\x00\x1f\xd6" + // 0x03B90342: 0x00001FD6 - "\x03\xca\x03B\x00\x00\x1f\xd7" + // 0x03CA0342: 0x00001FD7 - "\x03\x99\x03\x06\x00\x00\x1f\xd8" + // 0x03990306: 0x00001FD8 - "\x03\x99\x03\x04\x00\x00\x1f\xd9" + // 0x03990304: 0x00001FD9 - "\x03\x99\x03\x00\x00\x00\x1f\xda" + // 0x03990300: 0x00001FDA - "\x1f\xfe\x03\x00\x00\x00\x1f\xdd" + // 0x1FFE0300: 0x00001FDD - "\x1f\xfe\x03\x01\x00\x00\x1f\xde" + // 0x1FFE0301: 0x00001FDE - "\x1f\xfe\x03B\x00\x00\x1f\xdf" + // 0x1FFE0342: 0x00001FDF - "\x03\xc5\x03\x06\x00\x00\x1f\xe0" + // 0x03C50306: 0x00001FE0 - "\x03\xc5\x03\x04\x00\x00\x1f\xe1" + // 0x03C50304: 0x00001FE1 - "\x03\xcb\x03\x00\x00\x00\x1f\xe2" + // 0x03CB0300: 0x00001FE2 - "\x03\xc1\x03\x13\x00\x00\x1f\xe4" + // 0x03C10313: 0x00001FE4 - "\x03\xc1\x03\x14\x00\x00\x1f\xe5" + // 0x03C10314: 0x00001FE5 - "\x03\xc5\x03B\x00\x00\x1f\xe6" + // 0x03C50342: 0x00001FE6 - "\x03\xcb\x03B\x00\x00\x1f\xe7" + // 0x03CB0342: 0x00001FE7 - "\x03\xa5\x03\x06\x00\x00\x1f\xe8" + // 0x03A50306: 0x00001FE8 - "\x03\xa5\x03\x04\x00\x00\x1f\xe9" + // 0x03A50304: 0x00001FE9 - "\x03\xa5\x03\x00\x00\x00\x1f\xea" + // 0x03A50300: 0x00001FEA - "\x03\xa1\x03\x14\x00\x00\x1f\xec" + // 0x03A10314: 0x00001FEC - "\x00\xa8\x03\x00\x00\x00\x1f\xed" + // 0x00A80300: 0x00001FED - "\x1f|\x03E\x00\x00\x1f\xf2" + // 0x1F7C0345: 0x00001FF2 - "\x03\xc9\x03E\x00\x00\x1f\xf3" + // 0x03C90345: 0x00001FF3 - "\x03\xce\x03E\x00\x00\x1f\xf4" + // 0x03CE0345: 0x00001FF4 - "\x03\xc9\x03B\x00\x00\x1f\xf6" + // 0x03C90342: 0x00001FF6 - "\x1f\xf6\x03E\x00\x00\x1f\xf7" + // 0x1FF60345: 0x00001FF7 - "\x03\x9f\x03\x00\x00\x00\x1f\xf8" + // 0x039F0300: 0x00001FF8 - "\x03\xa9\x03\x00\x00\x00\x1f\xfa" + // 0x03A90300: 0x00001FFA - "\x03\xa9\x03E\x00\x00\x1f\xfc" + // 0x03A90345: 0x00001FFC - "!\x90\x038\x00\x00!\x9a" + // 0x21900338: 0x0000219A - "!\x92\x038\x00\x00!\x9b" + // 0x21920338: 0x0000219B - "!\x94\x038\x00\x00!\xae" + // 0x21940338: 0x000021AE - "!\xd0\x038\x00\x00!\xcd" + // 0x21D00338: 0x000021CD - "!\xd4\x038\x00\x00!\xce" + // 0x21D40338: 0x000021CE - "!\xd2\x038\x00\x00!\xcf" + // 0x21D20338: 0x000021CF - "\"\x03\x038\x00\x00\"\x04" + // 0x22030338: 0x00002204 - "\"\b\x038\x00\x00\"\t" + // 0x22080338: 0x00002209 - "\"\v\x038\x00\x00\"\f" + // 0x220B0338: 0x0000220C - "\"#\x038\x00\x00\"$" + // 0x22230338: 0x00002224 - "\"%\x038\x00\x00\"&" + // 0x22250338: 0x00002226 - "\"<\x038\x00\x00\"A" + // 0x223C0338: 0x00002241 - "\"C\x038\x00\x00\"D" + // 0x22430338: 0x00002244 - "\"E\x038\x00\x00\"G" + // 0x22450338: 0x00002247 - "\"H\x038\x00\x00\"I" + // 0x22480338: 0x00002249 - "\x00=\x038\x00\x00\"`" + // 0x003D0338: 0x00002260 - "\"a\x038\x00\x00\"b" + // 0x22610338: 0x00002262 - "\"M\x038\x00\x00\"m" + // 0x224D0338: 0x0000226D - "\x00<\x038\x00\x00\"n" + // 0x003C0338: 0x0000226E - "\x00>\x038\x00\x00\"o" + // 0x003E0338: 0x0000226F - "\"d\x038\x00\x00\"p" + // 0x22640338: 0x00002270 - "\"e\x038\x00\x00\"q" + // 0x22650338: 0x00002271 - "\"r\x038\x00\x00\"t" + // 0x22720338: 0x00002274 - "\"s\x038\x00\x00\"u" + // 0x22730338: 0x00002275 - "\"v\x038\x00\x00\"x" + // 0x22760338: 0x00002278 - "\"w\x038\x00\x00\"y" + // 0x22770338: 0x00002279 - "\"z\x038\x00\x00\"\x80" + // 0x227A0338: 0x00002280 - "\"{\x038\x00\x00\"\x81" + // 0x227B0338: 0x00002281 - "\"\x82\x038\x00\x00\"\x84" + // 0x22820338: 0x00002284 - "\"\x83\x038\x00\x00\"\x85" + // 0x22830338: 0x00002285 - "\"\x86\x038\x00\x00\"\x88" + // 0x22860338: 0x00002288 - "\"\x87\x038\x00\x00\"\x89" + // 0x22870338: 0x00002289 - "\"\xa2\x038\x00\x00\"\xac" + // 0x22A20338: 0x000022AC - "\"\xa8\x038\x00\x00\"\xad" + // 0x22A80338: 0x000022AD - "\"\xa9\x038\x00\x00\"\xae" + // 0x22A90338: 0x000022AE - "\"\xab\x038\x00\x00\"\xaf" + // 0x22AB0338: 0x000022AF - "\"|\x038\x00\x00\"\xe0" + // 0x227C0338: 0x000022E0 - "\"}\x038\x00\x00\"\xe1" + // 0x227D0338: 0x000022E1 - "\"\x91\x038\x00\x00\"\xe2" + // 0x22910338: 0x000022E2 - "\"\x92\x038\x00\x00\"\xe3" + // 0x22920338: 0x000022E3 - "\"\xb2\x038\x00\x00\"\xea" + // 0x22B20338: 0x000022EA - "\"\xb3\x038\x00\x00\"\xeb" + // 0x22B30338: 0x000022EB - "\"\xb4\x038\x00\x00\"\xec" + // 0x22B40338: 0x000022EC - "\"\xb5\x038\x00\x00\"\xed" + // 0x22B50338: 0x000022ED - "0K0\x99\x00\x000L" + // 0x304B3099: 0x0000304C - "0M0\x99\x00\x000N" + // 0x304D3099: 0x0000304E - "0O0\x99\x00\x000P" + // 0x304F3099: 0x00003050 - "0Q0\x99\x00\x000R" + // 0x30513099: 0x00003052 - "0S0\x99\x00\x000T" + // 0x30533099: 0x00003054 - "0U0\x99\x00\x000V" + // 0x30553099: 0x00003056 - "0W0\x99\x00\x000X" + // 0x30573099: 0x00003058 - "0Y0\x99\x00\x000Z" + // 0x30593099: 0x0000305A - "0[0\x99\x00\x000\\" + // 0x305B3099: 0x0000305C - "0]0\x99\x00\x000^" + // 0x305D3099: 0x0000305E - "0_0\x99\x00\x000`" + // 0x305F3099: 0x00003060 - "0a0\x99\x00\x000b" + // 0x30613099: 0x00003062 - "0d0\x99\x00\x000e" + // 0x30643099: 0x00003065 - "0f0\x99\x00\x000g" + // 0x30663099: 0x00003067 - "0h0\x99\x00\x000i" + // 0x30683099: 0x00003069 - "0o0\x99\x00\x000p" + // 0x306F3099: 0x00003070 - "0o0\x9a\x00\x000q" + // 0x306F309A: 0x00003071 - "0r0\x99\x00\x000s" + // 0x30723099: 0x00003073 - "0r0\x9a\x00\x000t" + // 0x3072309A: 0x00003074 - "0u0\x99\x00\x000v" + // 0x30753099: 0x00003076 - "0u0\x9a\x00\x000w" + // 0x3075309A: 0x00003077 - "0x0\x99\x00\x000y" + // 0x30783099: 0x00003079 - "0x0\x9a\x00\x000z" + // 0x3078309A: 0x0000307A - "0{0\x99\x00\x000|" + // 0x307B3099: 0x0000307C - "0{0\x9a\x00\x000}" + // 0x307B309A: 0x0000307D - "0F0\x99\x00\x000\x94" + // 0x30463099: 0x00003094 - "0\x9d0\x99\x00\x000\x9e" + // 0x309D3099: 0x0000309E - "0\xab0\x99\x00\x000\xac" + // 0x30AB3099: 0x000030AC - "0\xad0\x99\x00\x000\xae" + // 0x30AD3099: 0x000030AE - "0\xaf0\x99\x00\x000\xb0" + // 0x30AF3099: 0x000030B0 - "0\xb10\x99\x00\x000\xb2" + // 0x30B13099: 0x000030B2 - "0\xb30\x99\x00\x000\xb4" + // 0x30B33099: 0x000030B4 - "0\xb50\x99\x00\x000\xb6" + // 0x30B53099: 0x000030B6 - "0\xb70\x99\x00\x000\xb8" + // 0x30B73099: 0x000030B8 - "0\xb90\x99\x00\x000\xba" + // 0x30B93099: 0x000030BA - "0\xbb0\x99\x00\x000\xbc" + // 0x30BB3099: 0x000030BC - "0\xbd0\x99\x00\x000\xbe" + // 0x30BD3099: 0x000030BE - "0\xbf0\x99\x00\x000\xc0" + // 0x30BF3099: 0x000030C0 - "0\xc10\x99\x00\x000\xc2" + // 0x30C13099: 0x000030C2 - "0\xc40\x99\x00\x000\xc5" + // 0x30C43099: 0x000030C5 - "0\xc60\x99\x00\x000\xc7" + // 0x30C63099: 0x000030C7 - "0\xc80\x99\x00\x000\xc9" + // 0x30C83099: 0x000030C9 - "0\xcf0\x99\x00\x000\xd0" + // 0x30CF3099: 0x000030D0 - "0\xcf0\x9a\x00\x000\xd1" + // 0x30CF309A: 0x000030D1 - "0\xd20\x99\x00\x000\xd3" + // 0x30D23099: 0x000030D3 - "0\xd20\x9a\x00\x000\xd4" + // 0x30D2309A: 0x000030D4 - "0\xd50\x99\x00\x000\xd6" + // 0x30D53099: 0x000030D6 - "0\xd50\x9a\x00\x000\xd7" + // 0x30D5309A: 0x000030D7 - "0\xd80\x99\x00\x000\xd9" + // 0x30D83099: 0x000030D9 - "0\xd80\x9a\x00\x000\xda" + // 0x30D8309A: 0x000030DA - "0\xdb0\x99\x00\x000\xdc" + // 0x30DB3099: 0x000030DC - "0\xdb0\x9a\x00\x000\xdd" + // 0x30DB309A: 0x000030DD - "0\xa60\x99\x00\x000\xf4" + // 0x30A63099: 0x000030F4 - "0\xef0\x99\x00\x000\xf7" + // 0x30EF3099: 0x000030F7 - "0\xf00\x99\x00\x000\xf8" + // 0x30F03099: 0x000030F8 - "0\xf10\x99\x00\x000\xf9" + // 0x30F13099: 0x000030F9 - "0\xf20\x99\x00\x000\xfa" + // 0x30F23099: 0x000030FA - "0\xfd0\x99\x00\x000\xfe" + // 0x30FD3099: 0x000030FE - "\x10\x99\x10\xba\x00\x01\x10\x9a" + // 0x109910BA: 0x0001109A - "\x10\x9b\x10\xba\x00\x01\x10\x9c" + // 0x109B10BA: 0x0001109C - "\x10\xa5\x10\xba\x00\x01\x10\xab" + // 0x10A510BA: 0x000110AB - "\x111\x11'\x00\x01\x11." + // 0x11311127: 0x0001112E - "\x112\x11'\x00\x01\x11/" + // 0x11321127: 0x0001112F - "\x13G\x13>\x00\x01\x13K" + // 0x1347133E: 0x0001134B - "\x13G\x13W\x00\x01\x13L" + // 0x13471357: 0x0001134C - "\x14\xb9\x14\xba\x00\x01\x14\xbb" + // 0x14B914BA: 0x000114BB - "\x14\xb9\x14\xb0\x00\x01\x14\xbc" + // 0x14B914B0: 0x000114BC - "\x14\xb9\x14\xbd\x00\x01\x14\xbe" + // 0x14B914BD: 0x000114BE - "\x15\xb8\x15\xaf\x00\x01\x15\xba" + // 0x15B815AF: 0x000115BA - "\x15\xb9\x15\xaf\x00\x01\x15\xbb" + // 0x15B915AF: 0x000115BB - "" - // Total size of tables: 53KB (54006 bytes) +// Total size of tables: 53KB (54006 bytes) diff --git a/vendor/golang.org/x/text/unicode/norm/transform.go b/vendor/golang.org/x/text/unicode/norm/transform.go index a1d366ae..9f47efba 100644 --- a/vendor/golang.org/x/text/unicode/norm/transform.go +++ b/vendor/golang.org/x/text/unicode/norm/transform.go @@ -18,6 +18,7 @@ func (Form) Reset() {} // Users should either catch ErrShortDst and allow dst to grow or have dst be at // least of size MaxTransformChunkSize to be guaranteed of progress. func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { + n := 0 // Cap the maximum number of src bytes to check. b := src eof := atEOF @@ -26,14 +27,13 @@ func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) eof = false b = b[:ns] } - i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof) - n := copy(dst, b[:i]) + i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof) + n += copy(dst[n:], b[n:i]) if !ok { nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) return nDst + n, nSrc + n, err } - - if err == nil && n < len(src) && !atEOF { + if n < len(src) && !atEOF { err = transform.ErrShortSrc } return n, n, err @@ -79,7 +79,7 @@ func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) nSrc += n nDst += n if ok { - if err == nil && n < rb.nsrc && !atEOF { + if n < rb.nsrc && !atEOF { err = transform.ErrShortSrc } return nDst, nSrc, err diff --git a/vendor/golang.org/x/tools/AUTHORS b/vendor/golang.org/x/tools/AUTHORS deleted file mode 100644 index 15167cd7..00000000 --- a/vendor/golang.org/x/tools/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/tools/CONTRIBUTORS b/vendor/golang.org/x/tools/CONTRIBUTORS deleted file mode 100644 index 1c4577e9..00000000 --- a/vendor/golang.org/x/tools/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/golang.org/x/tools/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/PATENTS b/vendor/golang.org/x/tools/PATENTS deleted file mode 100644 index 73309904..00000000 --- a/vendor/golang.org/x/tools/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/cmd/getgo/LICENSE b/vendor/golang.org/x/tools/cmd/getgo/LICENSE deleted file mode 100644 index 32017f8f..00000000 --- a/vendor/golang.org/x/tools/cmd/getgo/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2017 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go deleted file mode 100644 index 6b7052b8..00000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package astutil - -// This file defines utilities for working with source positions. - -import ( - "fmt" - "go/ast" - "go/token" - "sort" -) - -// PathEnclosingInterval returns the node that encloses the source -// interval [start, end), and all its ancestors up to the AST root. -// -// The definition of "enclosing" used by this function considers -// additional whitespace abutting a node to be enclosed by it. -// In this example: -// -// z := x + y // add them -// <-A-> -// <----B-----> -// -// the ast.BinaryExpr(+) node is considered to enclose interval B -// even though its [Pos()..End()) is actually only interval A. -// This behaviour makes user interfaces more tolerant of imperfect -// input. -// -// This function treats tokens as nodes, though they are not included -// in the result. e.g. PathEnclosingInterval("+") returns the -// enclosing ast.BinaryExpr("x + y"). -// -// If start==end, the 1-char interval following start is used instead. -// -// The 'exact' result is true if the interval contains only path[0] -// and perhaps some adjacent whitespace. It is false if the interval -// overlaps multiple children of path[0], or if it contains only -// interior whitespace of path[0]. -// In this example: -// -// z := x + y // add them -// <--C--> <---E--> -// ^ -// D -// -// intervals C, D and E are inexact. C is contained by the -// z-assignment statement, because it spans three of its children (:=, -// x, +). So too is the 1-char interval D, because it contains only -// interior whitespace of the assignment. E is considered interior -// whitespace of the BlockStmt containing the assignment. -// -// Precondition: [start, end) both lie within the same file as root. -// TODO(adonovan): return (nil, false) in this case and remove precond. -// Requires FileSet; see loader.tokenFileContainsPos. -// -// Postcondition: path is never nil; it always contains at least 'root'. -// -func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { - // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging - - // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end). - var visit func(node ast.Node) bool - visit = func(node ast.Node) bool { - path = append(path, node) - - nodePos := node.Pos() - nodeEnd := node.End() - - // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging - - // Intersect [start, end) with interval of node. - if start < nodePos { - start = nodePos - } - if end > nodeEnd { - end = nodeEnd - } - - // Find sole child that contains [start, end). - children := childrenOf(node) - l := len(children) - for i, child := range children { - // [childPos, childEnd) is unaugmented interval of child. - childPos := child.Pos() - childEnd := child.End() - - // [augPos, augEnd) is whitespace-augmented interval of child. - augPos := childPos - augEnd := childEnd - if i > 0 { - augPos = children[i-1].End() // start of preceding whitespace - } - if i < l-1 { - nextChildPos := children[i+1].Pos() - // Does [start, end) lie between child and next child? - if start >= augEnd && end <= nextChildPos { - return false // inexact match - } - augEnd = nextChildPos // end of following whitespace - } - - // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n", - // i, augPos, augEnd, start, end) // debugging - - // Does augmented child strictly contain [start, end)? - if augPos <= start && end <= augEnd { - _, isToken := child.(tokenNode) - return isToken || visit(child) - } - - // Does [start, end) overlap multiple children? - // i.e. left-augmented child contains start - // but LR-augmented child does not contain end. - if start < childEnd && end > augEnd { - break - } - } - - // No single child contained [start, end), - // so node is the result. Is it exact? - - // (It's tempting to put this condition before the - // child loop, but it gives the wrong result in the - // case where a node (e.g. ExprStmt) and its sole - // child have equal intervals.) - if start == nodePos && end == nodeEnd { - return true // exact match - } - - return false // inexact: overlaps multiple children - } - - if start > end { - start, end = end, start - } - - if start < root.End() && end > root.Pos() { - if start == end { - end = start + 1 // empty interval => interval of size 1 - } - exact = visit(root) - - // Reverse the path: - for i, l := 0, len(path); i < l/2; i++ { - path[i], path[l-1-i] = path[l-1-i], path[i] - } - } else { - // Selection lies within whitespace preceding the - // first (or following the last) declaration in the file. - // The result nonetheless always includes the ast.File. - path = append(path, root) - } - - return -} - -// tokenNode is a dummy implementation of ast.Node for a single token. -// They are used transiently by PathEnclosingInterval but never escape -// this package. -// -type tokenNode struct { - pos token.Pos - end token.Pos -} - -func (n tokenNode) Pos() token.Pos { - return n.pos -} - -func (n tokenNode) End() token.Pos { - return n.end -} - -func tok(pos token.Pos, len int) ast.Node { - return tokenNode{pos, pos + token.Pos(len)} -} - -// childrenOf returns the direct non-nil children of ast.Node n. -// It may include fake ast.Node implementations for bare tokens. -// it is not safe to call (e.g.) ast.Walk on such nodes. -// -func childrenOf(n ast.Node) []ast.Node { - var children []ast.Node - - // First add nodes for all true subtrees. - ast.Inspect(n, func(node ast.Node) bool { - if node == n { // push n - return true // recur - } - if node != nil { // push child - children = append(children, node) - } - return false // no recursion - }) - - // Then add fake Nodes for bare tokens. - switch n := n.(type) { - case *ast.ArrayType: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Elt.End(), len("]"))) - - case *ast.AssignStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.BasicLit: - children = append(children, - tok(n.ValuePos, len(n.Value))) - - case *ast.BinaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.BlockStmt: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("}"))) - - case *ast.BranchStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.CallExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - if n.Ellipsis != 0 { - children = append(children, tok(n.Ellipsis, len("..."))) - } - - case *ast.CaseClause: - if n.List == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.ChanType: - switch n.Dir { - case ast.RECV: - children = append(children, tok(n.Begin, len("<-chan"))) - case ast.SEND: - children = append(children, tok(n.Begin, len("chan<-"))) - case ast.RECV | ast.SEND: - children = append(children, tok(n.Begin, len("chan"))) - } - - case *ast.CommClause: - if n.Comm == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.Comment: - // nop - - case *ast.CommentGroup: - // nop - - case *ast.CompositeLit: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("{"))) - - case *ast.DeclStmt: - // nop - - case *ast.DeferStmt: - children = append(children, - tok(n.Defer, len("defer"))) - - case *ast.Ellipsis: - children = append(children, - tok(n.Ellipsis, len("..."))) - - case *ast.EmptyStmt: - // nop - - case *ast.ExprStmt: - // nop - - case *ast.Field: - // TODO(adonovan): Field.{Doc,Comment,Tag}? - - case *ast.FieldList: - children = append(children, - tok(n.Opening, len("(")), - tok(n.Closing, len(")"))) - - case *ast.File: - // TODO test: Doc - children = append(children, - tok(n.Package, len("package"))) - - case *ast.ForStmt: - children = append(children, - tok(n.For, len("for"))) - - case *ast.FuncDecl: - // TODO(adonovan): FuncDecl.Comment? - - // Uniquely, FuncDecl breaks the invariant that - // preorder traversal yields tokens in lexical order: - // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func. - // - // As a workaround, we inline the case for FuncType - // here and order things correctly. - // - children = nil // discard ast.Walk(FuncDecl) info subtrees - children = append(children, tok(n.Type.Func, len("func"))) - if n.Recv != nil { - children = append(children, n.Recv) - } - children = append(children, n.Name) - if n.Type.Params != nil { - children = append(children, n.Type.Params) - } - if n.Type.Results != nil { - children = append(children, n.Type.Results) - } - if n.Body != nil { - children = append(children, n.Body) - } - - case *ast.FuncLit: - // nop - - case *ast.FuncType: - if n.Func != 0 { - children = append(children, - tok(n.Func, len("func"))) - } - - case *ast.GenDecl: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - if n.Lparen != 0 { - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - } - - case *ast.GoStmt: - children = append(children, - tok(n.Go, len("go"))) - - case *ast.Ident: - children = append(children, - tok(n.NamePos, len(n.Name))) - - case *ast.IfStmt: - children = append(children, - tok(n.If, len("if"))) - - case *ast.ImportSpec: - // TODO(adonovan): ImportSpec.{Doc,EndPos}? - - case *ast.IncDecStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.IndexExpr: - children = append(children, - tok(n.Lbrack, len("{")), - tok(n.Rbrack, len("}"))) - - case *ast.InterfaceType: - children = append(children, - tok(n.Interface, len("interface"))) - - case *ast.KeyValueExpr: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.LabeledStmt: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.MapType: - children = append(children, - tok(n.Map, len("map"))) - - case *ast.ParenExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.RangeStmt: - children = append(children, - tok(n.For, len("for")), - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.ReturnStmt: - children = append(children, - tok(n.Return, len("return"))) - - case *ast.SelectStmt: - children = append(children, - tok(n.Select, len("select"))) - - case *ast.SelectorExpr: - // nop - - case *ast.SendStmt: - children = append(children, - tok(n.Arrow, len("<-"))) - - case *ast.SliceExpr: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Rbrack, len("]"))) - - case *ast.StarExpr: - children = append(children, tok(n.Star, len("*"))) - - case *ast.StructType: - children = append(children, tok(n.Struct, len("struct"))) - - case *ast.SwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.TypeAssertExpr: - children = append(children, - tok(n.Lparen-1, len(".")), - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.TypeSpec: - // TODO(adonovan): TypeSpec.{Doc,Comment}? - - case *ast.TypeSwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.UnaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.ValueSpec: - // TODO(adonovan): ValueSpec.{Doc,Comment}? - - case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt: - // nop - } - - // TODO(adonovan): opt: merge the logic of ast.Inspect() into - // the switch above so we can make interleaved callbacks for - // both Nodes and Tokens in the right order and avoid the need - // to sort. - sort.Sort(byPos(children)) - - return children -} - -type byPos []ast.Node - -func (sl byPos) Len() int { - return len(sl) -} -func (sl byPos) Less(i, j int) bool { - return sl[i].Pos() < sl[j].Pos() -} -func (sl byPos) Swap(i, j int) { - sl[i], sl[j] = sl[j], sl[i] -} - -// NodeDescription returns a description of the concrete type of n suitable -// for a user interface. -// -// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, -// StarExpr) we could be much more specific given the path to the AST -// root. Perhaps we should do that. -// -func NodeDescription(n ast.Node) string { - switch n := n.(type) { - case *ast.ArrayType: - return "array type" - case *ast.AssignStmt: - return "assignment" - case *ast.BadDecl: - return "bad declaration" - case *ast.BadExpr: - return "bad expression" - case *ast.BadStmt: - return "bad statement" - case *ast.BasicLit: - return "basic literal" - case *ast.BinaryExpr: - return fmt.Sprintf("binary %s operation", n.Op) - case *ast.BlockStmt: - return "block" - case *ast.BranchStmt: - switch n.Tok { - case token.BREAK: - return "break statement" - case token.CONTINUE: - return "continue statement" - case token.GOTO: - return "goto statement" - case token.FALLTHROUGH: - return "fall-through statement" - } - case *ast.CallExpr: - if len(n.Args) == 1 && !n.Ellipsis.IsValid() { - return "function call (or conversion)" - } - return "function call" - case *ast.CaseClause: - return "case clause" - case *ast.ChanType: - return "channel type" - case *ast.CommClause: - return "communication clause" - case *ast.Comment: - return "comment" - case *ast.CommentGroup: - return "comment group" - case *ast.CompositeLit: - return "composite literal" - case *ast.DeclStmt: - return NodeDescription(n.Decl) + " statement" - case *ast.DeferStmt: - return "defer statement" - case *ast.Ellipsis: - return "ellipsis" - case *ast.EmptyStmt: - return "empty statement" - case *ast.ExprStmt: - return "expression statement" - case *ast.Field: - // Can be any of these: - // struct {x, y int} -- struct field(s) - // struct {T} -- anon struct field - // interface {I} -- interface embedding - // interface {f()} -- interface method - // func (A) func(B) C -- receiver, param(s), result(s) - return "field/method/parameter" - case *ast.FieldList: - return "field/method/parameter list" - case *ast.File: - return "source file" - case *ast.ForStmt: - return "for loop" - case *ast.FuncDecl: - return "function declaration" - case *ast.FuncLit: - return "function literal" - case *ast.FuncType: - return "function type" - case *ast.GenDecl: - switch n.Tok { - case token.IMPORT: - return "import declaration" - case token.CONST: - return "constant declaration" - case token.TYPE: - return "type declaration" - case token.VAR: - return "variable declaration" - } - case *ast.GoStmt: - return "go statement" - case *ast.Ident: - return "identifier" - case *ast.IfStmt: - return "if statement" - case *ast.ImportSpec: - return "import specification" - case *ast.IncDecStmt: - if n.Tok == token.INC { - return "increment statement" - } - return "decrement statement" - case *ast.IndexExpr: - return "index expression" - case *ast.InterfaceType: - return "interface type" - case *ast.KeyValueExpr: - return "key/value association" - case *ast.LabeledStmt: - return "statement label" - case *ast.MapType: - return "map type" - case *ast.Package: - return "package" - case *ast.ParenExpr: - return "parenthesized " + NodeDescription(n.X) - case *ast.RangeStmt: - return "range loop" - case *ast.ReturnStmt: - return "return statement" - case *ast.SelectStmt: - return "select statement" - case *ast.SelectorExpr: - return "selector" - case *ast.SendStmt: - return "channel send" - case *ast.SliceExpr: - return "slice expression" - case *ast.StarExpr: - return "*-operation" // load/store expr or pointer type - case *ast.StructType: - return "struct type" - case *ast.SwitchStmt: - return "switch statement" - case *ast.TypeAssertExpr: - return "type assertion" - case *ast.TypeSpec: - return "type specification" - case *ast.TypeSwitchStmt: - return "type switch" - case *ast.UnaryExpr: - return fmt.Sprintf("unary %s operation", n.Op) - case *ast.ValueSpec: - return "value specification" - - } - panic(fmt.Sprintf("unexpected node type: %T", n)) -} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/imports.go b/vendor/golang.org/x/tools/go/ast/astutil/imports.go deleted file mode 100644 index 3e4b1953..00000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/imports.go +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package astutil contains common utilities for working with the Go AST. -package astutil // import "golang.org/x/tools/go/ast/astutil" - -import ( - "fmt" - "go/ast" - "go/token" - "strconv" - "strings" -) - -// AddImport adds the import path to the file f, if absent. -func AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) { - return AddNamedImport(fset, f, "", path) -} - -// AddNamedImport adds the import with the given name and path to the file f, if absent. -// If name is not empty, it is used to rename the import. -// -// For example, calling -// AddNamedImport(fset, f, "pathpkg", "path") -// adds -// import pathpkg "path" -func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) { - if imports(f, name, path) { - return false - } - - newImport := &ast.ImportSpec{ - Path: &ast.BasicLit{ - Kind: token.STRING, - Value: strconv.Quote(path), - }, - } - if name != "" { - newImport.Name = &ast.Ident{Name: name} - } - - // Find an import decl to add to. - // The goal is to find an existing import - // whose import path has the longest shared - // prefix with path. - var ( - bestMatch = -1 // length of longest shared prefix - lastImport = -1 // index in f.Decls of the file's final import decl - impDecl *ast.GenDecl // import decl containing the best match - impIndex = -1 // spec index in impDecl containing the best match - - isThirdPartyPath = isThirdParty(path) - ) - for i, decl := range f.Decls { - gen, ok := decl.(*ast.GenDecl) - if ok && gen.Tok == token.IMPORT { - lastImport = i - // Do not add to import "C", to avoid disrupting the - // association with its doc comment, breaking cgo. - if declImports(gen, "C") { - continue - } - - // Match an empty import decl if that's all that is available. - if len(gen.Specs) == 0 && bestMatch == -1 { - impDecl = gen - } - - // Compute longest shared prefix with imports in this group and find best - // matched import spec. - // 1. Always prefer import spec with longest shared prefix. - // 2. While match length is 0, - // - for stdlib package: prefer first import spec. - // - for third party package: prefer first third party import spec. - // We cannot use last import spec as best match for third party package - // because grouped imports are usually placed last by goimports -local - // flag. - // See issue #19190. - seenAnyThirdParty := false - for j, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - p := importPath(impspec) - n := matchLen(p, path) - if n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) { - bestMatch = n - impDecl = gen - impIndex = j - } - seenAnyThirdParty = seenAnyThirdParty || isThirdParty(p) - } - } - } - - // If no import decl found, add one after the last import. - if impDecl == nil { - impDecl = &ast.GenDecl{ - Tok: token.IMPORT, - } - if lastImport >= 0 { - impDecl.TokPos = f.Decls[lastImport].End() - } else { - // There are no existing imports. - // Our new import, preceded by a blank line, goes after the package declaration - // and after the comment, if any, that starts on the same line as the - // package declaration. - impDecl.TokPos = f.Package - - file := fset.File(f.Package) - pkgLine := file.Line(f.Package) - for _, c := range f.Comments { - if file.Line(c.Pos()) > pkgLine { - break - } - // +2 for a blank line - impDecl.TokPos = c.End() + 2 - } - } - f.Decls = append(f.Decls, nil) - copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) - f.Decls[lastImport+1] = impDecl - } - - // Insert new import at insertAt. - insertAt := 0 - if impIndex >= 0 { - // insert after the found import - insertAt = impIndex + 1 - } - impDecl.Specs = append(impDecl.Specs, nil) - copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) - impDecl.Specs[insertAt] = newImport - pos := impDecl.Pos() - if insertAt > 0 { - // If there is a comment after an existing import, preserve the comment - // position by adding the new import after the comment. - if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil { - pos = spec.Comment.End() - } else { - // Assign same position as the previous import, - // so that the sorter sees it as being in the same block. - pos = impDecl.Specs[insertAt-1].Pos() - } - } - if newImport.Name != nil { - newImport.Name.NamePos = pos - } - newImport.Path.ValuePos = pos - newImport.EndPos = pos - - // Clean up parens. impDecl contains at least one spec. - if len(impDecl.Specs) == 1 { - // Remove unneeded parens. - impDecl.Lparen = token.NoPos - } else if !impDecl.Lparen.IsValid() { - // impDecl needs parens added. - impDecl.Lparen = impDecl.Specs[0].Pos() - } - - f.Imports = append(f.Imports, newImport) - - if len(f.Decls) <= 1 { - return true - } - - // Merge all the import declarations into the first one. - var first *ast.GenDecl - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { - continue - } - if first == nil { - first = gen - continue // Don't touch the first one. - } - // We now know there is more than one package in this import - // declaration. Ensure that it ends up parenthesized. - first.Lparen = first.Pos() - // Move the imports of the other import declaration to the first one. - for _, spec := range gen.Specs { - spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() - first.Specs = append(first.Specs, spec) - } - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - i-- - } - - return true -} - -func isThirdParty(importPath string) bool { - // Third party package import path usually contains "." (".com", ".org", ...) - // This logic is taken from golang.org/x/tools/imports package. - return strings.Contains(importPath, ".") -} - -// DeleteImport deletes the import path from the file f, if present. -// If there are duplicate import declarations, all matching ones are deleted. -func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { - return DeleteNamedImport(fset, f, "", path) -} - -// DeleteNamedImport deletes the import with the given name and path from the file f, if present. -// If there are duplicate import declarations, all matching ones are deleted. -func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { - var delspecs []*ast.ImportSpec - var delcomments []*ast.CommentGroup - - // Find the import nodes that import path, if any. - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT { - continue - } - for j := 0; j < len(gen.Specs); j++ { - spec := gen.Specs[j] - impspec := spec.(*ast.ImportSpec) - if importName(impspec) != name || importPath(impspec) != path { - continue - } - - // We found an import spec that imports path. - // Delete it. - delspecs = append(delspecs, impspec) - deleted = true - copy(gen.Specs[j:], gen.Specs[j+1:]) - gen.Specs = gen.Specs[:len(gen.Specs)-1] - - // If this was the last import spec in this decl, - // delete the decl, too. - if len(gen.Specs) == 0 { - copy(f.Decls[i:], f.Decls[i+1:]) - f.Decls = f.Decls[:len(f.Decls)-1] - i-- - break - } else if len(gen.Specs) == 1 { - if impspec.Doc != nil { - delcomments = append(delcomments, impspec.Doc) - } - if impspec.Comment != nil { - delcomments = append(delcomments, impspec.Comment) - } - for _, cg := range f.Comments { - // Found comment on the same line as the import spec. - if cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line { - delcomments = append(delcomments, cg) - break - } - } - - spec := gen.Specs[0].(*ast.ImportSpec) - - // Move the documentation right after the import decl. - if spec.Doc != nil { - for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Doc.Pos()).Line { - fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) - } - } - for _, cg := range f.Comments { - if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line { - for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Pos()).Line { - fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) - } - break - } - } - } - if j > 0 { - lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) - lastLine := fset.Position(lastImpspec.Path.ValuePos).Line - line := fset.Position(impspec.Path.ValuePos).Line - - // We deleted an entry but now there may be - // a blank line-sized hole where the import was. - if line-lastLine > 1 { - // There was a blank line immediately preceding the deleted import, - // so there's no need to close the hole. - // Do nothing. - } else if line != fset.File(gen.Rparen).LineCount() { - // There was no blank line. Close the hole. - fset.File(gen.Rparen).MergeLine(line) - } - } - j-- - } - } - - // Delete imports from f.Imports. - for i := 0; i < len(f.Imports); i++ { - imp := f.Imports[i] - for j, del := range delspecs { - if imp == del { - copy(f.Imports[i:], f.Imports[i+1:]) - f.Imports = f.Imports[:len(f.Imports)-1] - copy(delspecs[j:], delspecs[j+1:]) - delspecs = delspecs[:len(delspecs)-1] - i-- - break - } - } - } - - // Delete comments from f.Comments. - for i := 0; i < len(f.Comments); i++ { - cg := f.Comments[i] - for j, del := range delcomments { - if cg == del { - copy(f.Comments[i:], f.Comments[i+1:]) - f.Comments = f.Comments[:len(f.Comments)-1] - copy(delcomments[j:], delcomments[j+1:]) - delcomments = delcomments[:len(delcomments)-1] - i-- - break - } - } - } - - if len(delspecs) > 0 { - panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs)) - } - - return -} - -// RewriteImport rewrites any import of path oldPath to path newPath. -func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) { - for _, imp := range f.Imports { - if importPath(imp) == oldPath { - rewrote = true - // record old End, because the default is to compute - // it using the length of imp.Path.Value. - imp.EndPos = imp.End() - imp.Path.Value = strconv.Quote(newPath) - } - } - return -} - -// UsesImport reports whether a given import is used. -func UsesImport(f *ast.File, path string) (used bool) { - spec := importSpec(f, path) - if spec == nil { - return - } - - name := spec.Name.String() - switch name { - case "": - // If the package name is not explicitly specified, - // make an educated guess. This is not guaranteed to be correct. - lastSlash := strings.LastIndex(path, "/") - if lastSlash == -1 { - name = path - } else { - name = path[lastSlash+1:] - } - case "_", ".": - // Not sure if this import is used - err on the side of caution. - return true - } - - ast.Walk(visitFn(func(n ast.Node) { - sel, ok := n.(*ast.SelectorExpr) - if ok && isTopName(sel.X, name) { - used = true - } - }), f) - - return -} - -type visitFn func(node ast.Node) - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - fn(node) - return fn -} - -// imports reports whether f has an import with the specified name and path. -func imports(f *ast.File, name, path string) bool { - for _, s := range f.Imports { - if importName(s) == name && importPath(s) == path { - return true - } - } - return false -} - -// importSpec returns the import spec if f imports path, -// or nil otherwise. -func importSpec(f *ast.File, path string) *ast.ImportSpec { - for _, s := range f.Imports { - if importPath(s) == path { - return s - } - } - return nil -} - -// importName returns the name of s, -// or "" if the import is not named. -func importName(s *ast.ImportSpec) string { - if s.Name == nil { - return "" - } - return s.Name.Name -} - -// importPath returns the unquoted import path of s, -// or "" if the path is not properly quoted. -func importPath(s *ast.ImportSpec) string { - t, err := strconv.Unquote(s.Path.Value) - if err != nil { - return "" - } - return t -} - -// declImports reports whether gen contains an import of path. -func declImports(gen *ast.GenDecl, path string) bool { - if gen.Tok != token.IMPORT { - return false - } - for _, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - if importPath(impspec) == path { - return true - } - } - return false -} - -// matchLen returns the length of the longest path segment prefix shared by x and y. -func matchLen(x, y string) int { - n := 0 - for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ { - if x[i] == '/' { - n++ - } - } - return n -} - -// isTopName returns true if n is a top-level unresolved identifier with the given name. -func isTopName(n ast.Expr, name string) bool { - id, ok := n.(*ast.Ident) - return ok && id.Name == name && id.Obj == nil -} - -// Imports returns the file imports grouped by paragraph. -func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { - var groups [][]*ast.ImportSpec - - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.IMPORT { - break - } - - group := []*ast.ImportSpec{} - - var lastLine int - for _, spec := range genDecl.Specs { - importSpec := spec.(*ast.ImportSpec) - pos := importSpec.Path.ValuePos - line := fset.Position(pos).Line - if lastLine > 0 && pos > 0 && line-lastLine > 1 { - groups = append(groups, group) - group = []*ast.ImportSpec{} - } - group = append(group, importSpec) - lastLine = line - } - groups = append(groups, group) - } - - return groups -} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go deleted file mode 100644 index cf72ea99..00000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go +++ /dev/null @@ -1,477 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package astutil - -import ( - "fmt" - "go/ast" - "reflect" - "sort" -) - -// An ApplyFunc is invoked by Apply for each node n, even if n is nil, -// before and/or after the node's children, using a Cursor describing -// the current node and providing operations on it. -// -// The return value of ApplyFunc controls the syntax tree traversal. -// See Apply for details. -type ApplyFunc func(*Cursor) bool - -// Apply traverses a syntax tree recursively, starting with root, -// and calling pre and post for each node as described below. -// Apply returns the syntax tree, possibly modified. -// -// If pre is not nil, it is called for each node before the node's -// children are traversed (pre-order). If pre returns false, no -// children are traversed, and post is not called for that node. -// -// If post is not nil, and a prior call of pre didn't return false, -// post is called for each node after its children are traversed -// (post-order). If post returns false, traversal is terminated and -// Apply returns immediately. -// -// Only fields that refer to AST nodes are considered children; -// i.e., token.Pos, Scopes, Objects, and fields of basic types -// (strings, etc.) are ignored. -// -// Children are traversed in the order in which they appear in the -// respective node's struct definition. A package's files are -// traversed in the filenames' alphabetical order. -// -func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) { - parent := &struct{ ast.Node }{root} - defer func() { - if r := recover(); r != nil && r != abort { - panic(r) - } - result = parent.Node - }() - a := &application{pre: pre, post: post} - a.apply(parent, "Node", nil, root) - return -} - -var abort = new(int) // singleton, to signal termination of Apply - -// A Cursor describes a node encountered during Apply. -// Information about the node and its parent is available -// from the Node, Parent, Name, and Index methods. -// -// If p is a variable of type and value of the current parent node -// c.Parent(), and f is the field identifier with name c.Name(), -// the following invariants hold: -// -// p.f == c.Node() if c.Index() < 0 -// p.f[c.Index()] == c.Node() if c.Index() >= 0 -// -// The methods Replace, Delete, InsertBefore, and InsertAfter -// can be used to change the AST without disrupting Apply. -type Cursor struct { - parent ast.Node - name string - iter *iterator // valid if non-nil - node ast.Node -} - -// Node returns the current Node. -func (c *Cursor) Node() ast.Node { return c.node } - -// Parent returns the parent of the current Node. -func (c *Cursor) Parent() ast.Node { return c.parent } - -// Name returns the name of the parent Node field that contains the current Node. -// If the parent is a *ast.Package and the current Node is a *ast.File, Name returns -// the filename for the current Node. -func (c *Cursor) Name() string { return c.name } - -// Index reports the index >= 0 of the current Node in the slice of Nodes that -// contains it, or a value < 0 if the current Node is not part of a slice. -// The index of the current node changes if InsertBefore is called while -// processing the current node. -func (c *Cursor) Index() int { - if c.iter != nil { - return c.iter.index - } - return -1 -} - -// field returns the current node's parent field value. -func (c *Cursor) field() reflect.Value { - return reflect.Indirect(reflect.ValueOf(c.parent)).FieldByName(c.name) -} - -// Replace replaces the current Node with n. -// The replacement node is not walked by Apply. -func (c *Cursor) Replace(n ast.Node) { - if _, ok := c.node.(*ast.File); ok { - file, ok := n.(*ast.File) - if !ok { - panic("attempt to replace *ast.File with non-*ast.File") - } - c.parent.(*ast.Package).Files[c.name] = file - return - } - - v := c.field() - if i := c.Index(); i >= 0 { - v = v.Index(i) - } - v.Set(reflect.ValueOf(n)) -} - -// Delete deletes the current Node from its containing slice. -// If the current Node is not part of a slice, Delete panics. -// As a special case, if the current node is a package file, -// Delete removes it from the package's Files map. -func (c *Cursor) Delete() { - if _, ok := c.node.(*ast.File); ok { - delete(c.parent.(*ast.Package).Files, c.name) - return - } - - i := c.Index() - if i < 0 { - panic("Delete node not contained in slice") - } - v := c.field() - l := v.Len() - reflect.Copy(v.Slice(i, l), v.Slice(i+1, l)) - v.Index(l - 1).Set(reflect.Zero(v.Type().Elem())) - v.SetLen(l - 1) - c.iter.step-- -} - -// InsertAfter inserts n after the current Node in its containing slice. -// If the current Node is not part of a slice, InsertAfter panics. -// Apply does not walk n. -func (c *Cursor) InsertAfter(n ast.Node) { - i := c.Index() - if i < 0 { - panic("InsertAfter node not contained in slice") - } - v := c.field() - v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) - l := v.Len() - reflect.Copy(v.Slice(i+2, l), v.Slice(i+1, l)) - v.Index(i + 1).Set(reflect.ValueOf(n)) - c.iter.step++ -} - -// InsertBefore inserts n before the current Node in its containing slice. -// If the current Node is not part of a slice, InsertBefore panics. -// Apply will not walk n. -func (c *Cursor) InsertBefore(n ast.Node) { - i := c.Index() - if i < 0 { - panic("InsertBefore node not contained in slice") - } - v := c.field() - v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) - l := v.Len() - reflect.Copy(v.Slice(i+1, l), v.Slice(i, l)) - v.Index(i).Set(reflect.ValueOf(n)) - c.iter.index++ -} - -// application carries all the shared data so we can pass it around cheaply. -type application struct { - pre, post ApplyFunc - cursor Cursor - iter iterator -} - -func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) { - // convert typed nil into untyped nil - if v := reflect.ValueOf(n); v.Kind() == reflect.Ptr && v.IsNil() { - n = nil - } - - // avoid heap-allocating a new cursor for each apply call; reuse a.cursor instead - saved := a.cursor - a.cursor.parent = parent - a.cursor.name = name - a.cursor.iter = iter - a.cursor.node = n - - if a.pre != nil && !a.pre(&a.cursor) { - a.cursor = saved - return - } - - // walk children - // (the order of the cases matches the order of the corresponding node types in go/ast) - switch n := n.(type) { - case nil: - // nothing to do - - // Comments and fields - case *ast.Comment: - // nothing to do - - case *ast.CommentGroup: - if n != nil { - a.applyList(n, "List") - } - - case *ast.Field: - a.apply(n, "Doc", nil, n.Doc) - a.applyList(n, "Names") - a.apply(n, "Type", nil, n.Type) - a.apply(n, "Tag", nil, n.Tag) - a.apply(n, "Comment", nil, n.Comment) - - case *ast.FieldList: - a.applyList(n, "List") - - // Expressions - case *ast.BadExpr, *ast.Ident, *ast.BasicLit: - // nothing to do - - case *ast.Ellipsis: - a.apply(n, "Elt", nil, n.Elt) - - case *ast.FuncLit: - a.apply(n, "Type", nil, n.Type) - a.apply(n, "Body", nil, n.Body) - - case *ast.CompositeLit: - a.apply(n, "Type", nil, n.Type) - a.applyList(n, "Elts") - - case *ast.ParenExpr: - a.apply(n, "X", nil, n.X) - - case *ast.SelectorExpr: - a.apply(n, "X", nil, n.X) - a.apply(n, "Sel", nil, n.Sel) - - case *ast.IndexExpr: - a.apply(n, "X", nil, n.X) - a.apply(n, "Index", nil, n.Index) - - case *ast.SliceExpr: - a.apply(n, "X", nil, n.X) - a.apply(n, "Low", nil, n.Low) - a.apply(n, "High", nil, n.High) - a.apply(n, "Max", nil, n.Max) - - case *ast.TypeAssertExpr: - a.apply(n, "X", nil, n.X) - a.apply(n, "Type", nil, n.Type) - - case *ast.CallExpr: - a.apply(n, "Fun", nil, n.Fun) - a.applyList(n, "Args") - - case *ast.StarExpr: - a.apply(n, "X", nil, n.X) - - case *ast.UnaryExpr: - a.apply(n, "X", nil, n.X) - - case *ast.BinaryExpr: - a.apply(n, "X", nil, n.X) - a.apply(n, "Y", nil, n.Y) - - case *ast.KeyValueExpr: - a.apply(n, "Key", nil, n.Key) - a.apply(n, "Value", nil, n.Value) - - // Types - case *ast.ArrayType: - a.apply(n, "Len", nil, n.Len) - a.apply(n, "Elt", nil, n.Elt) - - case *ast.StructType: - a.apply(n, "Fields", nil, n.Fields) - - case *ast.FuncType: - a.apply(n, "Params", nil, n.Params) - a.apply(n, "Results", nil, n.Results) - - case *ast.InterfaceType: - a.apply(n, "Methods", nil, n.Methods) - - case *ast.MapType: - a.apply(n, "Key", nil, n.Key) - a.apply(n, "Value", nil, n.Value) - - case *ast.ChanType: - a.apply(n, "Value", nil, n.Value) - - // Statements - case *ast.BadStmt: - // nothing to do - - case *ast.DeclStmt: - a.apply(n, "Decl", nil, n.Decl) - - case *ast.EmptyStmt: - // nothing to do - - case *ast.LabeledStmt: - a.apply(n, "Label", nil, n.Label) - a.apply(n, "Stmt", nil, n.Stmt) - - case *ast.ExprStmt: - a.apply(n, "X", nil, n.X) - - case *ast.SendStmt: - a.apply(n, "Chan", nil, n.Chan) - a.apply(n, "Value", nil, n.Value) - - case *ast.IncDecStmt: - a.apply(n, "X", nil, n.X) - - case *ast.AssignStmt: - a.applyList(n, "Lhs") - a.applyList(n, "Rhs") - - case *ast.GoStmt: - a.apply(n, "Call", nil, n.Call) - - case *ast.DeferStmt: - a.apply(n, "Call", nil, n.Call) - - case *ast.ReturnStmt: - a.applyList(n, "Results") - - case *ast.BranchStmt: - a.apply(n, "Label", nil, n.Label) - - case *ast.BlockStmt: - a.applyList(n, "List") - - case *ast.IfStmt: - a.apply(n, "Init", nil, n.Init) - a.apply(n, "Cond", nil, n.Cond) - a.apply(n, "Body", nil, n.Body) - a.apply(n, "Else", nil, n.Else) - - case *ast.CaseClause: - a.applyList(n, "List") - a.applyList(n, "Body") - - case *ast.SwitchStmt: - a.apply(n, "Init", nil, n.Init) - a.apply(n, "Tag", nil, n.Tag) - a.apply(n, "Body", nil, n.Body) - - case *ast.TypeSwitchStmt: - a.apply(n, "Init", nil, n.Init) - a.apply(n, "Assign", nil, n.Assign) - a.apply(n, "Body", nil, n.Body) - - case *ast.CommClause: - a.apply(n, "Comm", nil, n.Comm) - a.applyList(n, "Body") - - case *ast.SelectStmt: - a.apply(n, "Body", nil, n.Body) - - case *ast.ForStmt: - a.apply(n, "Init", nil, n.Init) - a.apply(n, "Cond", nil, n.Cond) - a.apply(n, "Post", nil, n.Post) - a.apply(n, "Body", nil, n.Body) - - case *ast.RangeStmt: - a.apply(n, "Key", nil, n.Key) - a.apply(n, "Value", nil, n.Value) - a.apply(n, "X", nil, n.X) - a.apply(n, "Body", nil, n.Body) - - // Declarations - case *ast.ImportSpec: - a.apply(n, "Doc", nil, n.Doc) - a.apply(n, "Name", nil, n.Name) - a.apply(n, "Path", nil, n.Path) - a.apply(n, "Comment", nil, n.Comment) - - case *ast.ValueSpec: - a.apply(n, "Doc", nil, n.Doc) - a.applyList(n, "Names") - a.apply(n, "Type", nil, n.Type) - a.applyList(n, "Values") - a.apply(n, "Comment", nil, n.Comment) - - case *ast.TypeSpec: - a.apply(n, "Doc", nil, n.Doc) - a.apply(n, "Name", nil, n.Name) - a.apply(n, "Type", nil, n.Type) - a.apply(n, "Comment", nil, n.Comment) - - case *ast.BadDecl: - // nothing to do - - case *ast.GenDecl: - a.apply(n, "Doc", nil, n.Doc) - a.applyList(n, "Specs") - - case *ast.FuncDecl: - a.apply(n, "Doc", nil, n.Doc) - a.apply(n, "Recv", nil, n.Recv) - a.apply(n, "Name", nil, n.Name) - a.apply(n, "Type", nil, n.Type) - a.apply(n, "Body", nil, n.Body) - - // Files and packages - case *ast.File: - a.apply(n, "Doc", nil, n.Doc) - a.apply(n, "Name", nil, n.Name) - a.applyList(n, "Decls") - // Don't walk n.Comments; they have either been walked already if - // they are Doc comments, or they can be easily walked explicitly. - - case *ast.Package: - // collect and sort names for reproducible behavior - var names []string - for name := range n.Files { - names = append(names, name) - } - sort.Strings(names) - for _, name := range names { - a.apply(n, name, nil, n.Files[name]) - } - - default: - panic(fmt.Sprintf("Apply: unexpected node type %T", n)) - } - - if a.post != nil && !a.post(&a.cursor) { - panic(abort) - } - - a.cursor = saved -} - -// An iterator controls iteration over a slice of nodes. -type iterator struct { - index, step int -} - -func (a *application) applyList(parent ast.Node, name string) { - // avoid heap-allocating a new iterator for each applyList call; reuse a.iter instead - saved := a.iter - a.iter.index = 0 - for { - // must reload parent.name each time, since cursor modifications might change it - v := reflect.Indirect(reflect.ValueOf(parent)).FieldByName(name) - if a.iter.index >= v.Len() { - break - } - - // element x may be nil in a bad AST - be cautious - var x ast.Node - if e := v.Index(a.iter.index); e.IsValid() { - x = e.Interface().(ast.Node) - } - - a.iter.step = 1 - a.apply(parent, name, &a.iter, x) - a.iter.index += a.iter.step - } - a.iter = saved -} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/util.go b/vendor/golang.org/x/tools/go/ast/astutil/util.go deleted file mode 100644 index 76306298..00000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/util.go +++ /dev/null @@ -1,14 +0,0 @@ -package astutil - -import "go/ast" - -// Unparen returns e with any enclosing parentheses stripped. -func Unparen(e ast.Expr) ast.Expr { - for { - p, ok := e.(*ast.ParenExpr) - if !ok { - return e - } - e = p.X - } -} diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go deleted file mode 100644 index 98b3987b..00000000 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gcexportdata provides functions for locating, reading, and -// writing export data files containing type information produced by the -// gc compiler. This package supports go1.7 export data format and all -// later versions. -// -// Although it might seem convenient for this package to live alongside -// go/types in the standard library, this would cause version skew -// problems for developer tools that use it, since they must be able to -// consume the outputs of the gc compiler both before and after a Go -// update such as from Go 1.7 to Go 1.8. Because this package lives in -// golang.org/x/tools, sites can update their version of this repo some -// time before the Go 1.8 release and rebuild and redeploy their -// developer tools, which will then be able to consume both Go 1.7 and -// Go 1.8 export data files, so they will work before and after the -// Go update. (See discussion at https://golang.org/issue/15651.) -// -package gcexportdata // import "golang.org/x/tools/go/gcexportdata" - -import ( - "bufio" - "bytes" - "fmt" - "go/token" - "go/types" - "io" - "io/ioutil" - - "golang.org/x/tools/go/internal/gcimporter" -) - -// Find returns the name of an object (.o) or archive (.a) file -// containing type information for the specified import path, -// using the workspace layout conventions of go/build. -// If no file was found, an empty filename is returned. -// -// A relative srcDir is interpreted relative to the current working directory. -// -// Find also returns the package's resolved (canonical) import path, -// reflecting the effects of srcDir and vendoring on importPath. -func Find(importPath, srcDir string) (filename, path string) { - return gcimporter.FindPkg(importPath, srcDir) -} - -// NewReader returns a reader for the export data section of an object -// (.o) or archive (.a) file read from r. The new reader may provide -// additional trailing data beyond the end of the export data. -func NewReader(r io.Reader) (io.Reader, error) { - buf := bufio.NewReader(r) - _, err := gcimporter.FindExportData(buf) - // If we ever switch to a zip-like archive format with the ToC - // at the end, we can return the correct portion of export data, - // but for now we must return the entire rest of the file. - return buf, err -} - -// Read reads export data from in, decodes it, and returns type -// information for the package. -// The package name is specified by path. -// File position information is added to fset. -// -// Read may inspect and add to the imports map to ensure that references -// within the export data to other packages are consistent. The caller -// must ensure that imports[path] does not exist, or exists but is -// incomplete (see types.Package.Complete), and Read inserts the -// resulting package into this map entry. -// -// On return, the state of the reader is undefined. -func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error) { - data, err := ioutil.ReadAll(in) - if err != nil { - return nil, fmt.Errorf("reading export data for %q: %v", path, err) - } - - if bytes.HasPrefix(data, []byte("!")) { - return nil, fmt.Errorf("can't read export data for %q directly from an archive file (call gcexportdata.NewReader first to extract export data)", path) - } - - // The App Engine Go runtime v1.6 uses the old export data format. - // TODO(adonovan): delete once v1.7 has been around for a while. - if bytes.HasPrefix(data, []byte("package ")) { - return gcimporter.ImportData(imports, path, path, bytes.NewReader(data)) - } - - // The indexed export format starts with an 'i'; the older - // binary export format starts with a 'c', 'd', or 'v' - // (from "version"). Select appropriate importer. - if len(data) > 0 && data[0] == 'i' { - _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) - return pkg, err - } - - _, pkg, err := gcimporter.BImportData(fset, imports, data, path) - return pkg, err -} - -// Write writes encoded type information for the specified package to out. -// The FileSet provides file position information for named objects. -func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error { - b, err := gcimporter.BExportData(fset, pkg) - if err != nil { - return err - } - _, err = out.Write(b) - return err -} diff --git a/vendor/golang.org/x/tools/go/gcexportdata/importer.go b/vendor/golang.org/x/tools/go/gcexportdata/importer.go deleted file mode 100644 index efe221e7..00000000 --- a/vendor/golang.org/x/tools/go/gcexportdata/importer.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gcexportdata - -import ( - "fmt" - "go/token" - "go/types" - "os" -) - -// NewImporter returns a new instance of the types.Importer interface -// that reads type information from export data files written by gc. -// The Importer also satisfies types.ImporterFrom. -// -// Export data files are located using "go build" workspace conventions -// and the build.Default context. -// -// Use this importer instead of go/importer.For("gc", ...) to avoid the -// version-skew problems described in the documentation of this package, -// or to control the FileSet or access the imports map populated during -// package loading. -// -func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom { - return importer{fset, imports} -} - -type importer struct { - fset *token.FileSet - imports map[string]*types.Package -} - -func (imp importer) Import(importPath string) (*types.Package, error) { - return imp.ImportFrom(importPath, "", 0) -} - -func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) { - filename, path := Find(importPath, srcDir) - if filename == "" { - if importPath == "unsafe" { - // Even for unsafe, call Find first in case - // the package was vendored. - return types.Unsafe, nil - } - return nil, fmt.Errorf("can't find import: %s", importPath) - } - - if pkg, ok := imp.imports[path]; ok && pkg.Complete() { - return pkg, nil // cache hit - } - - // open file - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer func() { - f.Close() - if err != nil { - // add file name to error - err = fmt.Errorf("reading export data: %s: %v", filename, err) - } - }() - - r, err := NewReader(f) - if err != nil { - return nil, err - } - - return Read(r, imp.fset, imp.imports, path) -} diff --git a/vendor/golang.org/x/tools/go/gcexportdata/main.go b/vendor/golang.org/x/tools/go/gcexportdata/main.go deleted file mode 100644 index 2713dce6..00000000 --- a/vendor/golang.org/x/tools/go/gcexportdata/main.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2017 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 ignore - -// The gcexportdata command is a diagnostic tool that displays the -// contents of gc export data files. -package main - -import ( - "flag" - "fmt" - "go/token" - "go/types" - "log" - "os" - - "golang.org/x/tools/go/gcexportdata" - "golang.org/x/tools/go/types/typeutil" -) - -var packageFlag = flag.String("package", "", "alternative package to print") - -func main() { - log.SetPrefix("gcexportdata: ") - log.SetFlags(0) - flag.Usage = func() { - fmt.Fprintln(os.Stderr, "usage: gcexportdata [-package path] file.a") - } - flag.Parse() - if flag.NArg() != 1 { - flag.Usage() - os.Exit(2) - } - filename := flag.Args()[0] - - f, err := os.Open(filename) - if err != nil { - log.Fatal(err) - } - - r, err := gcexportdata.NewReader(f) - if err != nil { - log.Fatalf("%s: %s", filename, err) - } - - // Decode the package. - const primary = "" - imports := make(map[string]*types.Package) - fset := token.NewFileSet() - pkg, err := gcexportdata.Read(r, fset, imports, primary) - if err != nil { - log.Fatalf("%s: %s", filename, err) - } - - // Optionally select an indirectly mentioned package. - if *packageFlag != "" { - pkg = imports[*packageFlag] - if pkg == nil { - fmt.Fprintf(os.Stderr, "export data file %s does not mention %s; has:\n", - filename, *packageFlag) - for p := range imports { - if p != primary { - fmt.Fprintf(os.Stderr, "\t%s\n", p) - } - } - os.Exit(1) - } - } - - // Print all package-level declarations, including non-exported ones. - fmt.Printf("package %s\n", pkg.Name()) - for _, imp := range pkg.Imports() { - fmt.Printf("import %q\n", imp.Path()) - } - qual := func(p *types.Package) string { - if pkg == p { - return "" - } - return p.Name() - } - scope := pkg.Scope() - for _, name := range scope.Names() { - obj := scope.Lookup(name) - fmt.Printf("%s: %s\n", - fset.Position(obj.Pos()), - types.ObjectString(obj, qual)) - - // For types, print each method. - if _, ok := obj.(*types.TypeName); ok { - for _, method := range typeutil.IntuitiveMethodSet(obj.Type(), nil) { - fmt.Printf("%s: %s\n", - fset.Position(method.Obj().Pos()), - types.SelectionString(method, qual)) - } - } - } -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go deleted file mode 100644 index a807d0aa..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go +++ /dev/null @@ -1,852 +0,0 @@ -// Copyright 2016 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. - -// Binary package export. -// This file was derived from $GOROOT/src/cmd/compile/internal/gc/bexport.go; -// see that file for specification of the format. - -package gcimporter - -import ( - "bytes" - "encoding/binary" - "fmt" - "go/ast" - "go/constant" - "go/token" - "go/types" - "math" - "math/big" - "sort" - "strings" -) - -// If debugFormat is set, each integer and string value is preceded by a marker -// and position information in the encoding. This mechanism permits an importer -// to recognize immediately when it is out of sync. The importer recognizes this -// mode automatically (i.e., it can import export data produced with debugging -// support even if debugFormat is not set at the time of import). This mode will -// lead to massively larger export data (by a factor of 2 to 3) and should only -// be enabled during development and debugging. -// -// NOTE: This flag is the first flag to enable if importing dies because of -// (suspected) format errors, and whenever a change is made to the format. -const debugFormat = false // default: false - -// If trace is set, debugging output is printed to std out. -const trace = false // default: false - -// Current export format version. Increase with each format change. -// Note: The latest binary (non-indexed) export format is at version 6. -// This exporter is still at level 4, but it doesn't matter since -// the binary importer can handle older versions just fine. -// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE -// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMEMTED HERE -// 4: type name objects support type aliases, uses aliasTag -// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used) -// 2: removed unused bool in ODCL export (compiler only) -// 1: header format change (more regular), export package for _ struct fields -// 0: Go1.7 encoding -const exportVersion = 4 - -// trackAllTypes enables cycle tracking for all types, not just named -// types. The existing compiler invariants assume that unnamed types -// that are not completely set up are not used, or else there are spurious -// errors. -// If disabled, only named types are tracked, possibly leading to slightly -// less efficient encoding in rare cases. It also prevents the export of -// some corner-case type declarations (but those are not handled correctly -// with with the textual export format either). -// TODO(gri) enable and remove once issues caused by it are fixed -const trackAllTypes = false - -type exporter struct { - fset *token.FileSet - out bytes.Buffer - - // object -> index maps, indexed in order of serialization - strIndex map[string]int - pkgIndex map[*types.Package]int - typIndex map[types.Type]int - - // position encoding - posInfoFormat bool - prevFile string - prevLine int - - // debugging support - written int // bytes written - indent int // for trace -} - -// internalError represents an error generated inside this package. -type internalError string - -func (e internalError) Error() string { return "gcimporter: " + string(e) } - -func internalErrorf(format string, args ...interface{}) error { - return internalError(fmt.Sprintf(format, args...)) -} - -// BExportData returns binary export data for pkg. -// If no file set is provided, position info will be missing. -func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return - } - // Not an internal error; panic again. - panic(e) - } - }() - - p := exporter{ - fset: fset, - strIndex: map[string]int{"": 0}, // empty string is mapped to 0 - pkgIndex: make(map[*types.Package]int), - typIndex: make(map[types.Type]int), - posInfoFormat: true, // TODO(gri) might become a flag, eventually - } - - // write version info - // The version string must start with "version %d" where %d is the version - // number. Additional debugging information may follow after a blank; that - // text is ignored by the importer. - p.rawStringln(fmt.Sprintf("version %d", exportVersion)) - var debug string - if debugFormat { - debug = "debug" - } - p.rawStringln(debug) // cannot use p.bool since it's affected by debugFormat; also want to see this clearly - p.bool(trackAllTypes) - p.bool(p.posInfoFormat) - - // --- generic export data --- - - // populate type map with predeclared "known" types - for index, typ := range predeclared() { - p.typIndex[typ] = index - } - if len(p.typIndex) != len(predeclared()) { - return nil, internalError("duplicate entries in type map?") - } - - // write package data - p.pkg(pkg, true) - if trace { - p.tracef("\n") - } - - // write objects - objcount := 0 - scope := pkg.Scope() - for _, name := range scope.Names() { - if !ast.IsExported(name) { - continue - } - if trace { - p.tracef("\n") - } - p.obj(scope.Lookup(name)) - objcount++ - } - - // indicate end of list - if trace { - p.tracef("\n") - } - p.tag(endTag) - - // for self-verification only (redundant) - p.int(objcount) - - if trace { - p.tracef("\n") - } - - // --- end of export data --- - - return p.out.Bytes(), nil -} - -func (p *exporter) pkg(pkg *types.Package, emptypath bool) { - if pkg == nil { - panic(internalError("unexpected nil pkg")) - } - - // if we saw the package before, write its index (>= 0) - if i, ok := p.pkgIndex[pkg]; ok { - p.index('P', i) - return - } - - // otherwise, remember the package, write the package tag (< 0) and package data - if trace { - p.tracef("P%d = { ", len(p.pkgIndex)) - defer p.tracef("} ") - } - p.pkgIndex[pkg] = len(p.pkgIndex) - - p.tag(packageTag) - p.string(pkg.Name()) - if emptypath { - p.string("") - } else { - p.string(pkg.Path()) - } -} - -func (p *exporter) obj(obj types.Object) { - switch obj := obj.(type) { - case *types.Const: - p.tag(constTag) - p.pos(obj) - p.qualifiedName(obj) - p.typ(obj.Type()) - p.value(obj.Val()) - - case *types.TypeName: - if obj.IsAlias() { - p.tag(aliasTag) - p.pos(obj) - p.qualifiedName(obj) - } else { - p.tag(typeTag) - } - p.typ(obj.Type()) - - case *types.Var: - p.tag(varTag) - p.pos(obj) - p.qualifiedName(obj) - p.typ(obj.Type()) - - case *types.Func: - p.tag(funcTag) - p.pos(obj) - p.qualifiedName(obj) - sig := obj.Type().(*types.Signature) - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) - - default: - panic(internalErrorf("unexpected object %v (%T)", obj, obj)) - } -} - -func (p *exporter) pos(obj types.Object) { - if !p.posInfoFormat { - return - } - - file, line := p.fileLine(obj) - if file == p.prevFile { - // common case: write line delta - // delta == 0 means different file or no line change - delta := line - p.prevLine - p.int(delta) - if delta == 0 { - p.int(-1) // -1 means no file change - } - } else { - // different file - p.int(0) - // Encode filename as length of common prefix with previous - // filename, followed by (possibly empty) suffix. Filenames - // frequently share path prefixes, so this can save a lot - // of space and make export data size less dependent on file - // path length. The suffix is unlikely to be empty because - // file names tend to end in ".go". - n := commonPrefixLen(p.prevFile, file) - p.int(n) // n >= 0 - p.string(file[n:]) // write suffix only - p.prevFile = file - p.int(line) - } - p.prevLine = line -} - -func (p *exporter) fileLine(obj types.Object) (file string, line int) { - if p.fset != nil { - pos := p.fset.Position(obj.Pos()) - file = pos.Filename - line = pos.Line - } - return -} - -func commonPrefixLen(a, b string) int { - if len(a) > len(b) { - a, b = b, a - } - // len(a) <= len(b) - i := 0 - for i < len(a) && a[i] == b[i] { - i++ - } - return i -} - -func (p *exporter) qualifiedName(obj types.Object) { - p.string(obj.Name()) - p.pkg(obj.Pkg(), false) -} - -func (p *exporter) typ(t types.Type) { - if t == nil { - panic(internalError("nil type")) - } - - // Possible optimization: Anonymous pointer types *T where - // T is a named type are common. We could canonicalize all - // such types *T to a single type PT = *T. This would lead - // to at most one *T entry in typIndex, and all future *T's - // would be encoded as the respective index directly. Would - // save 1 byte (pointerTag) per *T and reduce the typIndex - // size (at the cost of a canonicalization map). We can do - // this later, without encoding format change. - - // if we saw the type before, write its index (>= 0) - if i, ok := p.typIndex[t]; ok { - p.index('T', i) - return - } - - // otherwise, remember the type, write the type tag (< 0) and type data - if trackAllTypes { - if trace { - p.tracef("T%d = {>\n", len(p.typIndex)) - defer p.tracef("<\n} ") - } - p.typIndex[t] = len(p.typIndex) - } - - switch t := t.(type) { - case *types.Named: - if !trackAllTypes { - // if we don't track all types, track named types now - p.typIndex[t] = len(p.typIndex) - } - - p.tag(namedTag) - p.pos(t.Obj()) - p.qualifiedName(t.Obj()) - p.typ(t.Underlying()) - if !types.IsInterface(t) { - p.assocMethods(t) - } - - case *types.Array: - p.tag(arrayTag) - p.int64(t.Len()) - p.typ(t.Elem()) - - case *types.Slice: - p.tag(sliceTag) - p.typ(t.Elem()) - - case *dddSlice: - p.tag(dddTag) - p.typ(t.elem) - - case *types.Struct: - p.tag(structTag) - p.fieldList(t) - - case *types.Pointer: - p.tag(pointerTag) - p.typ(t.Elem()) - - case *types.Signature: - p.tag(signatureTag) - p.paramList(t.Params(), t.Variadic()) - p.paramList(t.Results(), false) - - case *types.Interface: - p.tag(interfaceTag) - p.iface(t) - - case *types.Map: - p.tag(mapTag) - p.typ(t.Key()) - p.typ(t.Elem()) - - case *types.Chan: - p.tag(chanTag) - p.int(int(3 - t.Dir())) // hack - p.typ(t.Elem()) - - default: - panic(internalErrorf("unexpected type %T: %s", t, t)) - } -} - -func (p *exporter) assocMethods(named *types.Named) { - // Sort methods (for determinism). - var methods []*types.Func - for i := 0; i < named.NumMethods(); i++ { - methods = append(methods, named.Method(i)) - } - sort.Sort(methodsByName(methods)) - - p.int(len(methods)) - - if trace && methods != nil { - p.tracef("associated methods {>\n") - } - - for i, m := range methods { - if trace && i > 0 { - p.tracef("\n") - } - - p.pos(m) - name := m.Name() - p.string(name) - if !exported(name) { - p.pkg(m.Pkg(), false) - } - - sig := m.Type().(*types.Signature) - p.paramList(types.NewTuple(sig.Recv()), false) - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) - p.int(0) // dummy value for go:nointerface pragma - ignored by importer - } - - if trace && methods != nil { - p.tracef("<\n} ") - } -} - -type methodsByName []*types.Func - -func (x methodsByName) Len() int { return len(x) } -func (x methodsByName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x methodsByName) Less(i, j int) bool { return x[i].Name() < x[j].Name() } - -func (p *exporter) fieldList(t *types.Struct) { - if trace && t.NumFields() > 0 { - p.tracef("fields {>\n") - defer p.tracef("<\n} ") - } - - p.int(t.NumFields()) - for i := 0; i < t.NumFields(); i++ { - if trace && i > 0 { - p.tracef("\n") - } - p.field(t.Field(i)) - p.string(t.Tag(i)) - } -} - -func (p *exporter) field(f *types.Var) { - if !f.IsField() { - panic(internalError("field expected")) - } - - p.pos(f) - p.fieldName(f) - p.typ(f.Type()) -} - -func (p *exporter) iface(t *types.Interface) { - // TODO(gri): enable importer to load embedded interfaces, - // then emit Embeddeds and ExplicitMethods separately here. - p.int(0) - - n := t.NumMethods() - if trace && n > 0 { - p.tracef("methods {>\n") - defer p.tracef("<\n} ") - } - p.int(n) - for i := 0; i < n; i++ { - if trace && i > 0 { - p.tracef("\n") - } - p.method(t.Method(i)) - } -} - -func (p *exporter) method(m *types.Func) { - sig := m.Type().(*types.Signature) - if sig.Recv() == nil { - panic(internalError("method expected")) - } - - p.pos(m) - p.string(m.Name()) - if m.Name() != "_" && !ast.IsExported(m.Name()) { - p.pkg(m.Pkg(), false) - } - - // interface method; no need to encode receiver. - p.paramList(sig.Params(), sig.Variadic()) - p.paramList(sig.Results(), false) -} - -func (p *exporter) fieldName(f *types.Var) { - name := f.Name() - - if f.Anonymous() { - // anonymous field - we distinguish between 3 cases: - // 1) field name matches base type name and is exported - // 2) field name matches base type name and is not exported - // 3) field name doesn't match base type name (alias name) - bname := basetypeName(f.Type()) - if name == bname { - if ast.IsExported(name) { - name = "" // 1) we don't need to know the field name or package - } else { - name = "?" // 2) use unexported name "?" to force package export - } - } else { - // 3) indicate alias and export name as is - // (this requires an extra "@" but this is a rare case) - p.string("@") - } - } - - p.string(name) - if name != "" && !ast.IsExported(name) { - p.pkg(f.Pkg(), false) - } -} - -func basetypeName(typ types.Type) string { - switch typ := deref(typ).(type) { - case *types.Basic: - return typ.Name() - case *types.Named: - return typ.Obj().Name() - default: - return "" // unnamed type - } -} - -func (p *exporter) paramList(params *types.Tuple, variadic bool) { - // use negative length to indicate unnamed parameters - // (look at the first parameter only since either all - // names are present or all are absent) - n := params.Len() - if n > 0 && params.At(0).Name() == "" { - n = -n - } - p.int(n) - for i := 0; i < params.Len(); i++ { - q := params.At(i) - t := q.Type() - if variadic && i == params.Len()-1 { - t = &dddSlice{t.(*types.Slice).Elem()} - } - p.typ(t) - if n > 0 { - name := q.Name() - p.string(name) - if name != "_" { - p.pkg(q.Pkg(), false) - } - } - p.string("") // no compiler-specific info - } -} - -func (p *exporter) value(x constant.Value) { - if trace { - p.tracef("= ") - } - - switch x.Kind() { - case constant.Bool: - tag := falseTag - if constant.BoolVal(x) { - tag = trueTag - } - p.tag(tag) - - case constant.Int: - if v, exact := constant.Int64Val(x); exact { - // common case: x fits into an int64 - use compact encoding - p.tag(int64Tag) - p.int64(v) - return - } - // uncommon case: large x - use float encoding - // (powers of 2 will be encoded efficiently with exponent) - p.tag(floatTag) - p.float(constant.ToFloat(x)) - - case constant.Float: - p.tag(floatTag) - p.float(x) - - case constant.Complex: - p.tag(complexTag) - p.float(constant.Real(x)) - p.float(constant.Imag(x)) - - case constant.String: - p.tag(stringTag) - p.string(constant.StringVal(x)) - - case constant.Unknown: - // package contains type errors - p.tag(unknownTag) - - default: - panic(internalErrorf("unexpected value %v (%T)", x, x)) - } -} - -func (p *exporter) float(x constant.Value) { - if x.Kind() != constant.Float { - panic(internalErrorf("unexpected constant %v, want float", x)) - } - // extract sign (there is no -0) - sign := constant.Sign(x) - if sign == 0 { - // x == 0 - p.int(0) - return - } - // x != 0 - - var f big.Float - if v, exact := constant.Float64Val(x); exact { - // float64 - f.SetFloat64(v) - } else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int { - // TODO(gri): add big.Rat accessor to constant.Value. - r := valueToRat(num) - f.SetRat(r.Quo(r, valueToRat(denom))) - } else { - // Value too large to represent as a fraction => inaccessible. - // TODO(gri): add big.Float accessor to constant.Value. - f.SetFloat64(math.MaxFloat64) // FIXME - } - - // extract exponent such that 0.5 <= m < 1.0 - var m big.Float - exp := f.MantExp(&m) - - // extract mantissa as *big.Int - // - set exponent large enough so mant satisfies mant.IsInt() - // - get *big.Int from mant - m.SetMantExp(&m, int(m.MinPrec())) - mant, acc := m.Int(nil) - if acc != big.Exact { - panic(internalError("internal error")) - } - - p.int(sign) - p.int(exp) - p.string(string(mant.Bytes())) -} - -func valueToRat(x constant.Value) *big.Rat { - // Convert little-endian to big-endian. - // I can't believe this is necessary. - bytes := constant.Bytes(x) - for i := 0; i < len(bytes)/2; i++ { - bytes[i], bytes[len(bytes)-1-i] = bytes[len(bytes)-1-i], bytes[i] - } - return new(big.Rat).SetInt(new(big.Int).SetBytes(bytes)) -} - -func (p *exporter) bool(b bool) bool { - if trace { - p.tracef("[") - defer p.tracef("= %v] ", b) - } - - x := 0 - if b { - x = 1 - } - p.int(x) - return b -} - -// ---------------------------------------------------------------------------- -// Low-level encoders - -func (p *exporter) index(marker byte, index int) { - if index < 0 { - panic(internalError("invalid index < 0")) - } - if debugFormat { - p.marker('t') - } - if trace { - p.tracef("%c%d ", marker, index) - } - p.rawInt64(int64(index)) -} - -func (p *exporter) tag(tag int) { - if tag >= 0 { - panic(internalError("invalid tag >= 0")) - } - if debugFormat { - p.marker('t') - } - if trace { - p.tracef("%s ", tagString[-tag]) - } - p.rawInt64(int64(tag)) -} - -func (p *exporter) int(x int) { - p.int64(int64(x)) -} - -func (p *exporter) int64(x int64) { - if debugFormat { - p.marker('i') - } - if trace { - p.tracef("%d ", x) - } - p.rawInt64(x) -} - -func (p *exporter) string(s string) { - if debugFormat { - p.marker('s') - } - if trace { - p.tracef("%q ", s) - } - // if we saw the string before, write its index (>= 0) - // (the empty string is mapped to 0) - if i, ok := p.strIndex[s]; ok { - p.rawInt64(int64(i)) - return - } - // otherwise, remember string and write its negative length and bytes - p.strIndex[s] = len(p.strIndex) - p.rawInt64(-int64(len(s))) - for i := 0; i < len(s); i++ { - p.rawByte(s[i]) - } -} - -// marker emits a marker byte and position information which makes -// it easy for a reader to detect if it is "out of sync". Used for -// debugFormat format only. -func (p *exporter) marker(m byte) { - p.rawByte(m) - // Enable this for help tracking down the location - // of an incorrect marker when running in debugFormat. - if false && trace { - p.tracef("#%d ", p.written) - } - p.rawInt64(int64(p.written)) -} - -// rawInt64 should only be used by low-level encoders. -func (p *exporter) rawInt64(x int64) { - var tmp [binary.MaxVarintLen64]byte - n := binary.PutVarint(tmp[:], x) - for i := 0; i < n; i++ { - p.rawByte(tmp[i]) - } -} - -// rawStringln should only be used to emit the initial version string. -func (p *exporter) rawStringln(s string) { - for i := 0; i < len(s); i++ { - p.rawByte(s[i]) - } - p.rawByte('\n') -} - -// rawByte is the bottleneck interface to write to p.out. -// rawByte escapes b as follows (any encoding does that -// hides '$'): -// -// '$' => '|' 'S' -// '|' => '|' '|' -// -// Necessary so other tools can find the end of the -// export data by searching for "$$". -// rawByte should only be used by low-level encoders. -func (p *exporter) rawByte(b byte) { - switch b { - case '$': - // write '$' as '|' 'S' - b = 'S' - fallthrough - case '|': - // write '|' as '|' '|' - p.out.WriteByte('|') - p.written++ - } - p.out.WriteByte(b) - p.written++ -} - -// tracef is like fmt.Printf but it rewrites the format string -// to take care of indentation. -func (p *exporter) tracef(format string, args ...interface{}) { - if strings.ContainsAny(format, "<>\n") { - var buf bytes.Buffer - for i := 0; i < len(format); i++ { - // no need to deal with runes - ch := format[i] - switch ch { - case '>': - p.indent++ - continue - case '<': - p.indent-- - continue - } - buf.WriteByte(ch) - if ch == '\n' { - for j := p.indent; j > 0; j-- { - buf.WriteString(". ") - } - } - } - format = buf.String() - } - fmt.Printf(format, args...) -} - -// Debugging support. -// (tagString is only used when tracing is enabled) -var tagString = [...]string{ - // Packages - -packageTag: "package", - - // Types - -namedTag: "named type", - -arrayTag: "array", - -sliceTag: "slice", - -dddTag: "ddd", - -structTag: "struct", - -pointerTag: "pointer", - -signatureTag: "signature", - -interfaceTag: "interface", - -mapTag: "map", - -chanTag: "chan", - - // Values - -falseTag: "false", - -trueTag: "true", - -int64Tag: "int64", - -floatTag: "float", - -fractionTag: "fraction", - -complexTag: "complex", - -stringTag: "string", - -unknownTag: "unknown", - - // Type aliases - -aliasTag: "alias", -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go deleted file mode 100644 index e3c31078..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go +++ /dev/null @@ -1,1036 +0,0 @@ -// Copyright 2015 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. - -// This file is a copy of $GOROOT/src/go/internal/gcimporter/bimport.go. - -package gcimporter - -import ( - "encoding/binary" - "fmt" - "go/constant" - "go/token" - "go/types" - "sort" - "strconv" - "strings" - "sync" - "unicode" - "unicode/utf8" -) - -type importer struct { - imports map[string]*types.Package - data []byte - importpath string - buf []byte // for reading strings - version int // export format version - - // object lists - strList []string // in order of appearance - pathList []string // in order of appearance - pkgList []*types.Package // in order of appearance - typList []types.Type // in order of appearance - interfaceList []*types.Interface // for delayed completion only - trackAllTypes bool - - // position encoding - posInfoFormat bool - prevFile string - prevLine int - fake fakeFileSet - - // debugging support - debugFormat bool - read int // bytes read -} - -// BImportData imports a package from the serialized package data -// and returns the number of bytes consumed and a reference to the package. -// If the export data version is not recognized or the format is otherwise -// compromised, an error is returned. -func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { - // catch panics and return them as errors - const currentVersion = 6 - version := -1 // unknown version - defer func() { - if e := recover(); e != nil { - // Return a (possibly nil or incomplete) package unchanged (see #16088). - if version > currentVersion { - err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) - } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) - } - } - }() - - p := importer{ - imports: imports, - data: data, - importpath: path, - version: version, - strList: []string{""}, // empty string is mapped to 0 - pathList: []string{""}, // empty string is mapped to 0 - fake: fakeFileSet{ - fset: fset, - files: make(map[string]*token.File), - }, - } - - // read version info - var versionstr string - if b := p.rawByte(); b == 'c' || b == 'd' { - // Go1.7 encoding; first byte encodes low-level - // encoding format (compact vs debug). - // For backward-compatibility only (avoid problems with - // old installed packages). Newly compiled packages use - // the extensible format string. - // TODO(gri) Remove this support eventually; after Go1.8. - if b == 'd' { - p.debugFormat = true - } - p.trackAllTypes = p.rawByte() == 'a' - p.posInfoFormat = p.int() != 0 - versionstr = p.string() - if versionstr == "v1" { - version = 0 - } - } else { - // Go1.8 extensible encoding - // read version string and extract version number (ignore anything after the version number) - versionstr = p.rawStringln(b) - if s := strings.SplitN(versionstr, " ", 3); len(s) >= 2 && s[0] == "version" { - if v, err := strconv.Atoi(s[1]); err == nil && v > 0 { - version = v - } - } - } - p.version = version - - // read version specific flags - extend as necessary - switch p.version { - // case currentVersion: - // ... - // fallthrough - case currentVersion, 5, 4, 3, 2, 1: - p.debugFormat = p.rawStringln(p.rawByte()) == "debug" - p.trackAllTypes = p.int() != 0 - p.posInfoFormat = p.int() != 0 - case 0: - // Go1.7 encoding format - nothing to do here - default: - errorf("unknown bexport format version %d (%q)", p.version, versionstr) - } - - // --- generic export data --- - - // populate typList with predeclared "known" types - p.typList = append(p.typList, predeclared()...) - - // read package data - pkg = p.pkg() - - // read objects of phase 1 only (see cmd/compile/internal/gc/bexport.go) - objcount := 0 - for { - tag := p.tagOrIndex() - if tag == endTag { - break - } - p.obj(tag) - objcount++ - } - - // self-verification - if count := p.int(); count != objcount { - errorf("got %d objects; want %d", objcount, count) - } - - // ignore compiler-specific import data - - // complete interfaces - // TODO(gri) re-investigate if we still need to do this in a delayed fashion - for _, typ := range p.interfaceList { - typ.Complete() - } - - // record all referenced packages as imports - list := append(([]*types.Package)(nil), p.pkgList[1:]...) - sort.Sort(byPath(list)) - pkg.SetImports(list) - - // package was imported completely and without errors - pkg.MarkComplete() - - return p.read, pkg, nil -} - -func errorf(format string, args ...interface{}) { - panic(fmt.Sprintf(format, args...)) -} - -func (p *importer) pkg() *types.Package { - // if the package was seen before, i is its index (>= 0) - i := p.tagOrIndex() - if i >= 0 { - return p.pkgList[i] - } - - // otherwise, i is the package tag (< 0) - if i != packageTag { - errorf("unexpected package tag %d version %d", i, p.version) - } - - // read package data - name := p.string() - var path string - if p.version >= 5 { - path = p.path() - } else { - path = p.string() - } - if p.version >= 6 { - p.int() // package height; unused by go/types - } - - // we should never see an empty package name - if name == "" { - errorf("empty package name in import") - } - - // an empty path denotes the package we are currently importing; - // it must be the first package we see - if (path == "") != (len(p.pkgList) == 0) { - errorf("package path %q for pkg index %d", path, len(p.pkgList)) - } - - // if the package was imported before, use that one; otherwise create a new one - if path == "" { - path = p.importpath - } - pkg := p.imports[path] - if pkg == nil { - pkg = types.NewPackage(path, name) - p.imports[path] = pkg - } else if pkg.Name() != name { - errorf("conflicting names %s and %s for package %q", pkg.Name(), name, path) - } - p.pkgList = append(p.pkgList, pkg) - - return pkg -} - -// objTag returns the tag value for each object kind. -func objTag(obj types.Object) int { - switch obj.(type) { - case *types.Const: - return constTag - case *types.TypeName: - return typeTag - case *types.Var: - return varTag - case *types.Func: - return funcTag - default: - errorf("unexpected object: %v (%T)", obj, obj) // panics - panic("unreachable") - } -} - -func sameObj(a, b types.Object) bool { - // Because unnamed types are not canonicalized, we cannot simply compare types for - // (pointer) identity. - // Ideally we'd check equality of constant values as well, but this is good enough. - return objTag(a) == objTag(b) && types.Identical(a.Type(), b.Type()) -} - -func (p *importer) declare(obj types.Object) { - pkg := obj.Pkg() - if alt := pkg.Scope().Insert(obj); alt != nil { - // This can only trigger if we import a (non-type) object a second time. - // Excluding type aliases, this cannot happen because 1) we only import a package - // once; and b) we ignore compiler-specific export data which may contain - // functions whose inlined function bodies refer to other functions that - // were already imported. - // However, type aliases require reexporting the original type, so we need - // to allow it (see also the comment in cmd/compile/internal/gc/bimport.go, - // method importer.obj, switch case importing functions). - // TODO(gri) review/update this comment once the gc compiler handles type aliases. - if !sameObj(obj, alt) { - errorf("inconsistent import:\n\t%v\npreviously imported as:\n\t%v\n", obj, alt) - } - } -} - -func (p *importer) obj(tag int) { - switch tag { - case constTag: - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - val := p.value() - p.declare(types.NewConst(pos, pkg, name, typ, val)) - - case aliasTag: - // TODO(gri) verify type alias hookup is correct - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - p.declare(types.NewTypeName(pos, pkg, name, typ)) - - case typeTag: - p.typ(nil, nil) - - case varTag: - pos := p.pos() - pkg, name := p.qualifiedName() - typ := p.typ(nil, nil) - p.declare(types.NewVar(pos, pkg, name, typ)) - - case funcTag: - pos := p.pos() - pkg, name := p.qualifiedName() - params, isddd := p.paramList() - result, _ := p.paramList() - sig := types.NewSignature(nil, params, result, isddd) - p.declare(types.NewFunc(pos, pkg, name, sig)) - - default: - errorf("unexpected object tag %d", tag) - } -} - -const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go - -func (p *importer) pos() token.Pos { - if !p.posInfoFormat { - return token.NoPos - } - - file := p.prevFile - line := p.prevLine - delta := p.int() - line += delta - if p.version >= 5 { - if delta == deltaNewFile { - if n := p.int(); n >= 0 { - // file changed - file = p.path() - line = n - } - } - } else { - if delta == 0 { - if n := p.int(); n >= 0 { - // file changed - file = p.prevFile[:n] + p.string() - line = p.int() - } - } - } - p.prevFile = file - p.prevLine = line - - return p.fake.pos(file, line) -} - -// Synthesize a token.Pos -type fakeFileSet struct { - fset *token.FileSet - files map[string]*token.File -} - -func (s *fakeFileSet) pos(file string, line int) token.Pos { - // Since we don't know the set of needed file positions, we - // reserve maxlines positions per file. - const maxlines = 64 * 1024 - f := s.files[file] - if f == nil { - f = s.fset.AddFile(file, -1, maxlines) - s.files[file] = f - // Allocate the fake linebreak indices on first use. - // TODO(adonovan): opt: save ~512KB using a more complex scheme? - fakeLinesOnce.Do(func() { - fakeLines = make([]int, maxlines) - for i := range fakeLines { - fakeLines[i] = i - } - }) - f.SetLines(fakeLines) - } - - if line > maxlines { - line = 1 - } - - // Treat the file as if it contained only newlines - // and column=1: use the line number as the offset. - return f.Pos(line - 1) -} - -var ( - fakeLines []int - fakeLinesOnce sync.Once -) - -func (p *importer) qualifiedName() (pkg *types.Package, name string) { - name = p.string() - pkg = p.pkg() - return -} - -func (p *importer) record(t types.Type) { - p.typList = append(p.typList, t) -} - -// A dddSlice is a types.Type representing ...T parameters. -// It only appears for parameter types and does not escape -// the importer. -type dddSlice struct { - elem types.Type -} - -func (t *dddSlice) Underlying() types.Type { return t } -func (t *dddSlice) String() string { return "..." + t.elem.String() } - -// parent is the package which declared the type; parent == nil means -// the package currently imported. The parent package is needed for -// exported struct fields and interface methods which don't contain -// explicit package information in the export data. -// -// A non-nil tname is used as the "owner" of the result type; i.e., -// the result type is the underlying type of tname. tname is used -// to give interface methods a named receiver type where possible. -func (p *importer) typ(parent *types.Package, tname *types.Named) types.Type { - // if the type was seen before, i is its index (>= 0) - i := p.tagOrIndex() - if i >= 0 { - return p.typList[i] - } - - // otherwise, i is the type tag (< 0) - switch i { - case namedTag: - // read type object - pos := p.pos() - parent, name := p.qualifiedName() - scope := parent.Scope() - obj := scope.Lookup(name) - - // if the object doesn't exist yet, create and insert it - if obj == nil { - obj = types.NewTypeName(pos, parent, name, nil) - scope.Insert(obj) - } - - if _, ok := obj.(*types.TypeName); !ok { - errorf("pkg = %s, name = %s => %s", parent, name, obj) - } - - // associate new named type with obj if it doesn't exist yet - t0 := types.NewNamed(obj.(*types.TypeName), nil, nil) - - // but record the existing type, if any - tname := obj.Type().(*types.Named) // tname is either t0 or the existing type - p.record(tname) - - // read underlying type - t0.SetUnderlying(p.typ(parent, t0)) - - // interfaces don't have associated methods - if types.IsInterface(t0) { - return tname - } - - // read associated methods - for i := p.int(); i > 0; i-- { - // TODO(gri) replace this with something closer to fieldName - pos := p.pos() - name := p.string() - if !exported(name) { - p.pkg() - } - - recv, _ := p.paramList() // TODO(gri) do we need a full param list for the receiver? - params, isddd := p.paramList() - result, _ := p.paramList() - p.int() // go:nointerface pragma - discarded - - sig := types.NewSignature(recv.At(0), params, result, isddd) - t0.AddMethod(types.NewFunc(pos, parent, name, sig)) - } - - return tname - - case arrayTag: - t := new(types.Array) - if p.trackAllTypes { - p.record(t) - } - - n := p.int64() - *t = *types.NewArray(p.typ(parent, nil), n) - return t - - case sliceTag: - t := new(types.Slice) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewSlice(p.typ(parent, nil)) - return t - - case dddTag: - t := new(dddSlice) - if p.trackAllTypes { - p.record(t) - } - - t.elem = p.typ(parent, nil) - return t - - case structTag: - t := new(types.Struct) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewStruct(p.fieldList(parent)) - return t - - case pointerTag: - t := new(types.Pointer) - if p.trackAllTypes { - p.record(t) - } - - *t = *types.NewPointer(p.typ(parent, nil)) - return t - - case signatureTag: - t := new(types.Signature) - if p.trackAllTypes { - p.record(t) - } - - params, isddd := p.paramList() - result, _ := p.paramList() - *t = *types.NewSignature(nil, params, result, isddd) - return t - - case interfaceTag: - // Create a dummy entry in the type list. This is safe because we - // cannot expect the interface type to appear in a cycle, as any - // such cycle must contain a named type which would have been - // first defined earlier. - // TODO(gri) Is this still true now that we have type aliases? - // See issue #23225. - n := len(p.typList) - if p.trackAllTypes { - p.record(nil) - } - - var embeddeds []types.Type - for n := p.int(); n > 0; n-- { - p.pos() - embeddeds = append(embeddeds, p.typ(parent, nil)) - } - - t := newInterface(p.methodList(parent, tname), embeddeds) - p.interfaceList = append(p.interfaceList, t) - if p.trackAllTypes { - p.typList[n] = t - } - return t - - case mapTag: - t := new(types.Map) - if p.trackAllTypes { - p.record(t) - } - - key := p.typ(parent, nil) - val := p.typ(parent, nil) - *t = *types.NewMap(key, val) - return t - - case chanTag: - t := new(types.Chan) - if p.trackAllTypes { - p.record(t) - } - - dir := chanDir(p.int()) - val := p.typ(parent, nil) - *t = *types.NewChan(dir, val) - return t - - default: - errorf("unexpected type tag %d", i) // panics - panic("unreachable") - } -} - -func chanDir(d int) types.ChanDir { - // tag values must match the constants in cmd/compile/internal/gc/go.go - switch d { - case 1 /* Crecv */ : - return types.RecvOnly - case 2 /* Csend */ : - return types.SendOnly - case 3 /* Cboth */ : - return types.SendRecv - default: - errorf("unexpected channel dir %d", d) - return 0 - } -} - -func (p *importer) fieldList(parent *types.Package) (fields []*types.Var, tags []string) { - if n := p.int(); n > 0 { - fields = make([]*types.Var, n) - tags = make([]string, n) - for i := range fields { - fields[i], tags[i] = p.field(parent) - } - } - return -} - -func (p *importer) field(parent *types.Package) (*types.Var, string) { - pos := p.pos() - pkg, name, alias := p.fieldName(parent) - typ := p.typ(parent, nil) - tag := p.string() - - anonymous := false - if name == "" { - // anonymous field - typ must be T or *T and T must be a type name - switch typ := deref(typ).(type) { - case *types.Basic: // basic types are named types - pkg = nil // // objects defined in Universe scope have no package - name = typ.Name() - case *types.Named: - name = typ.Obj().Name() - default: - errorf("named base type expected") - } - anonymous = true - } else if alias { - // anonymous field: we have an explicit name because it's an alias - anonymous = true - } - - return types.NewField(pos, pkg, name, typ, anonymous), tag -} - -func (p *importer) methodList(parent *types.Package, baseType *types.Named) (methods []*types.Func) { - if n := p.int(); n > 0 { - methods = make([]*types.Func, n) - for i := range methods { - methods[i] = p.method(parent, baseType) - } - } - return -} - -func (p *importer) method(parent *types.Package, baseType *types.Named) *types.Func { - pos := p.pos() - pkg, name, _ := p.fieldName(parent) - // If we don't have a baseType, use a nil receiver. - // A receiver using the actual interface type (which - // we don't know yet) will be filled in when we call - // types.Interface.Complete. - var recv *types.Var - if baseType != nil { - recv = types.NewVar(token.NoPos, parent, "", baseType) - } - params, isddd := p.paramList() - result, _ := p.paramList() - sig := types.NewSignature(recv, params, result, isddd) - return types.NewFunc(pos, pkg, name, sig) -} - -func (p *importer) fieldName(parent *types.Package) (pkg *types.Package, name string, alias bool) { - name = p.string() - pkg = parent - if pkg == nil { - // use the imported package instead - pkg = p.pkgList[0] - } - if p.version == 0 && name == "_" { - // version 0 didn't export a package for _ fields - return - } - switch name { - case "": - // 1) field name matches base type name and is exported: nothing to do - case "?": - // 2) field name matches base type name and is not exported: need package - name = "" - pkg = p.pkg() - case "@": - // 3) field name doesn't match type name (alias) - name = p.string() - alias = true - fallthrough - default: - if !exported(name) { - pkg = p.pkg() - } - } - return -} - -func (p *importer) paramList() (*types.Tuple, bool) { - n := p.int() - if n == 0 { - return nil, false - } - // negative length indicates unnamed parameters - named := true - if n < 0 { - n = -n - named = false - } - // n > 0 - params := make([]*types.Var, n) - isddd := false - for i := range params { - params[i], isddd = p.param(named) - } - return types.NewTuple(params...), isddd -} - -func (p *importer) param(named bool) (*types.Var, bool) { - t := p.typ(nil, nil) - td, isddd := t.(*dddSlice) - if isddd { - t = types.NewSlice(td.elem) - } - - var pkg *types.Package - var name string - if named { - name = p.string() - if name == "" { - errorf("expected named parameter") - } - if name != "_" { - pkg = p.pkg() - } - if i := strings.Index(name, "·"); i > 0 { - name = name[:i] // cut off gc-specific parameter numbering - } - } - - // read and discard compiler-specific info - p.string() - - return types.NewVar(token.NoPos, pkg, name, t), isddd -} - -func exported(name string) bool { - ch, _ := utf8.DecodeRuneInString(name) - return unicode.IsUpper(ch) -} - -func (p *importer) value() constant.Value { - switch tag := p.tagOrIndex(); tag { - case falseTag: - return constant.MakeBool(false) - case trueTag: - return constant.MakeBool(true) - case int64Tag: - return constant.MakeInt64(p.int64()) - case floatTag: - return p.float() - case complexTag: - re := p.float() - im := p.float() - return constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) - case stringTag: - return constant.MakeString(p.string()) - case unknownTag: - return constant.MakeUnknown() - default: - errorf("unexpected value tag %d", tag) // panics - panic("unreachable") - } -} - -func (p *importer) float() constant.Value { - sign := p.int() - if sign == 0 { - return constant.MakeInt64(0) - } - - exp := p.int() - mant := []byte(p.string()) // big endian - - // remove leading 0's if any - for len(mant) > 0 && mant[0] == 0 { - mant = mant[1:] - } - - // convert to little endian - // TODO(gri) go/constant should have a more direct conversion function - // (e.g., once it supports a big.Float based implementation) - for i, j := 0, len(mant)-1; i < j; i, j = i+1, j-1 { - mant[i], mant[j] = mant[j], mant[i] - } - - // adjust exponent (constant.MakeFromBytes creates an integer value, - // but mant represents the mantissa bits such that 0.5 <= mant < 1.0) - exp -= len(mant) << 3 - if len(mant) > 0 { - for msd := mant[len(mant)-1]; msd&0x80 == 0; msd <<= 1 { - exp++ - } - } - - x := constant.MakeFromBytes(mant) - switch { - case exp < 0: - d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) - x = constant.BinaryOp(x, token.QUO, d) - case exp > 0: - x = constant.Shift(x, token.SHL, uint(exp)) - } - - if sign < 0 { - x = constant.UnaryOp(token.SUB, x, 0) - } - return x -} - -// ---------------------------------------------------------------------------- -// Low-level decoders - -func (p *importer) tagOrIndex() int { - if p.debugFormat { - p.marker('t') - } - - return int(p.rawInt64()) -} - -func (p *importer) int() int { - x := p.int64() - if int64(int(x)) != x { - errorf("exported integer too large") - } - return int(x) -} - -func (p *importer) int64() int64 { - if p.debugFormat { - p.marker('i') - } - - return p.rawInt64() -} - -func (p *importer) path() string { - if p.debugFormat { - p.marker('p') - } - // if the path was seen before, i is its index (>= 0) - // (the empty string is at index 0) - i := p.rawInt64() - if i >= 0 { - return p.pathList[i] - } - // otherwise, i is the negative path length (< 0) - a := make([]string, -i) - for n := range a { - a[n] = p.string() - } - s := strings.Join(a, "/") - p.pathList = append(p.pathList, s) - return s -} - -func (p *importer) string() string { - if p.debugFormat { - p.marker('s') - } - // if the string was seen before, i is its index (>= 0) - // (the empty string is at index 0) - i := p.rawInt64() - if i >= 0 { - return p.strList[i] - } - // otherwise, i is the negative string length (< 0) - if n := int(-i); n <= cap(p.buf) { - p.buf = p.buf[:n] - } else { - p.buf = make([]byte, n) - } - for i := range p.buf { - p.buf[i] = p.rawByte() - } - s := string(p.buf) - p.strList = append(p.strList, s) - return s -} - -func (p *importer) marker(want byte) { - if got := p.rawByte(); got != want { - errorf("incorrect marker: got %c; want %c (pos = %d)", got, want, p.read) - } - - pos := p.read - if n := int(p.rawInt64()); n != pos { - errorf("incorrect position: got %d; want %d", n, pos) - } -} - -// rawInt64 should only be used by low-level decoders. -func (p *importer) rawInt64() int64 { - i, err := binary.ReadVarint(p) - if err != nil { - errorf("read error: %v", err) - } - return i -} - -// rawStringln should only be used to read the initial version string. -func (p *importer) rawStringln(b byte) string { - p.buf = p.buf[:0] - for b != '\n' { - p.buf = append(p.buf, b) - b = p.rawByte() - } - return string(p.buf) -} - -// needed for binary.ReadVarint in rawInt64 -func (p *importer) ReadByte() (byte, error) { - return p.rawByte(), nil -} - -// byte is the bottleneck interface for reading p.data. -// It unescapes '|' 'S' to '$' and '|' '|' to '|'. -// rawByte should only be used by low-level decoders. -func (p *importer) rawByte() byte { - b := p.data[0] - r := 1 - if b == '|' { - b = p.data[1] - r = 2 - switch b { - case 'S': - b = '$' - case '|': - // nothing to do - default: - errorf("unexpected escape sequence in export data") - } - } - p.data = p.data[r:] - p.read += r - return b - -} - -// ---------------------------------------------------------------------------- -// Export format - -// Tags. Must be < 0. -const ( - // Objects - packageTag = -(iota + 1) - constTag - typeTag - varTag - funcTag - endTag - - // Types - namedTag - arrayTag - sliceTag - dddTag - structTag - pointerTag - signatureTag - interfaceTag - mapTag - chanTag - - // Values - falseTag - trueTag - int64Tag - floatTag - fractionTag // not used by gc - complexTag - stringTag - nilTag // only used by gc (appears in exported inlined function bodies) - unknownTag // not used by gc (only appears in packages with errors) - - // Type aliases - aliasTag -) - -var predecl []types.Type // initialized lazily - -func predeclared() []types.Type { - if predecl == nil { - // initialize lazily to be sure that all - // elements have been initialized before - predecl = []types.Type{ // basic types - types.Typ[types.Bool], - types.Typ[types.Int], - types.Typ[types.Int8], - types.Typ[types.Int16], - types.Typ[types.Int32], - types.Typ[types.Int64], - types.Typ[types.Uint], - types.Typ[types.Uint8], - types.Typ[types.Uint16], - types.Typ[types.Uint32], - types.Typ[types.Uint64], - types.Typ[types.Uintptr], - types.Typ[types.Float32], - types.Typ[types.Float64], - types.Typ[types.Complex64], - types.Typ[types.Complex128], - types.Typ[types.String], - - // basic type aliases - types.Universe.Lookup("byte").Type(), - types.Universe.Lookup("rune").Type(), - - // error - types.Universe.Lookup("error").Type(), - - // untyped types - types.Typ[types.UntypedBool], - types.Typ[types.UntypedInt], - types.Typ[types.UntypedRune], - types.Typ[types.UntypedFloat], - types.Typ[types.UntypedComplex], - types.Typ[types.UntypedString], - types.Typ[types.UntypedNil], - - // package unsafe - types.Typ[types.UnsafePointer], - - // invalid type - types.Typ[types.Invalid], // only appears in packages with errors - - // used internally by gc; never used by this package or in .a files - anyType{}, - } - } - return predecl -} - -type anyType struct{} - -func (t anyType) Underlying() types.Type { return t } -func (t anyType) String() string { return "any" } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go deleted file mode 100644 index f33dc561..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2011 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. - -// This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go. - -// This file implements FindExportData. - -package gcimporter - -import ( - "bufio" - "fmt" - "io" - "strconv" - "strings" -) - -func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { - // See $GOROOT/include/ar.h. - hdr := make([]byte, 16+12+6+6+8+10+2) - _, err = io.ReadFull(r, hdr) - if err != nil { - return - } - // leave for debugging - if false { - fmt.Printf("header: %s", hdr) - } - s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10])) - size, err = strconv.Atoi(s) - if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' { - err = fmt.Errorf("invalid archive header") - return - } - name = strings.TrimSpace(string(hdr[:16])) - return -} - -// FindExportData positions the reader r at the beginning of the -// export data section of an underlying GC-created object/archive -// file by reading from it. The reader must be positioned at the -// start of the file before calling this function. The hdr result -// is the string before the export data, either "$$" or "$$B". -// -func FindExportData(r *bufio.Reader) (hdr string, err error) { - // Read first line to make sure this is an object file. - line, err := r.ReadSlice('\n') - if err != nil { - err = fmt.Errorf("can't find export data (%v)", err) - return - } - - if string(line) == "!\n" { - // Archive file. Scan to __.PKGDEF. - var name string - if name, _, err = readGopackHeader(r); err != nil { - return - } - - // First entry should be __.PKGDEF. - if name != "__.PKGDEF" { - err = fmt.Errorf("go archive is missing __.PKGDEF") - return - } - - // Read first line of __.PKGDEF data, so that line - // is once again the first line of the input. - if line, err = r.ReadSlice('\n'); err != nil { - err = fmt.Errorf("can't find export data (%v)", err) - return - } - } - - // Now at __.PKGDEF in archive or still at beginning of file. - // Either way, line should begin with "go object ". - if !strings.HasPrefix(string(line), "go object ") { - err = fmt.Errorf("not a Go object file") - return - } - - // Skip over object header to export data. - // Begins after first line starting with $$. - for line[0] != '$' { - if line, err = r.ReadSlice('\n'); err != nil { - err = fmt.Errorf("can't find export data (%v)", err) - return - } - } - hdr = string(line) - - return -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go deleted file mode 100644 index 9cf18660..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go +++ /dev/null @@ -1,1078 +0,0 @@ -// Copyright 2011 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. - -// This file is a modified copy of $GOROOT/src/go/internal/gcimporter/gcimporter.go, -// but it also contains the original source-based importer code for Go1.6. -// Once we stop supporting 1.6, we can remove that code. - -// Package gcimporter provides various functions for reading -// gc-generated object files that can be used to implement the -// Importer interface defined by the Go 1.5 standard library package. -package gcimporter // import "golang.org/x/tools/go/internal/gcimporter" - -import ( - "bufio" - "errors" - "fmt" - "go/build" - "go/constant" - "go/token" - "go/types" - "io" - "io/ioutil" - "os" - "path/filepath" - "sort" - "strconv" - "strings" - "text/scanner" -) - -// debugging/development support -const debug = false - -var pkgExts = [...]string{".a", ".o"} - -// FindPkg returns the filename and unique package id for an import -// path based on package information provided by build.Import (using -// the build.Default build.Context). A relative srcDir is interpreted -// relative to the current working directory. -// If no file was found, an empty filename is returned. -// -func FindPkg(path, srcDir string) (filename, id string) { - if path == "" { - return - } - - var noext string - switch { - default: - // "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x" - // Don't require the source files to be present. - if abs, err := filepath.Abs(srcDir); err == nil { // see issue 14282 - srcDir = abs - } - bp, _ := build.Import(path, srcDir, build.FindOnly|build.AllowBinary) - if bp.PkgObj == "" { - id = path // make sure we have an id to print in error message - return - } - noext = strings.TrimSuffix(bp.PkgObj, ".a") - id = bp.ImportPath - - case build.IsLocalImport(path): - // "./x" -> "/this/directory/x.ext", "/this/directory/x" - noext = filepath.Join(srcDir, path) - id = noext - - case filepath.IsAbs(path): - // for completeness only - go/build.Import - // does not support absolute imports - // "/x" -> "/x.ext", "/x" - noext = path - id = path - } - - if false { // for debugging - if path != id { - fmt.Printf("%s -> %s\n", path, id) - } - } - - // try extensions - for _, ext := range pkgExts { - filename = noext + ext - if f, err := os.Stat(filename); err == nil && !f.IsDir() { - return - } - } - - filename = "" // not found - return -} - -// ImportData imports a package by reading the gc-generated export data, -// adds the corresponding package object to the packages map indexed by id, -// and returns the object. -// -// The packages map must contains all packages already imported. The data -// reader position must be the beginning of the export data section. The -// filename is only used in error messages. -// -// If packages[id] contains the completely imported package, that package -// can be used directly, and there is no need to call this function (but -// there is also no harm but for extra time used). -// -func ImportData(packages map[string]*types.Package, filename, id string, data io.Reader) (pkg *types.Package, err error) { - // support for parser error handling - defer func() { - switch r := recover().(type) { - case nil: - // nothing to do - case importError: - err = r - default: - panic(r) // internal error - } - }() - - var p parser - p.init(filename, id, data, packages) - pkg = p.parseExport() - - return -} - -// Import imports a gc-generated package given its import path and srcDir, adds -// the corresponding package object to the packages map, and returns the object. -// The packages map must contain all packages already imported. -// -func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) { - var rc io.ReadCloser - var filename, id string - if lookup != nil { - // With custom lookup specified, assume that caller has - // converted path to a canonical import path for use in the map. - if path == "unsafe" { - return types.Unsafe, nil - } - id = path - - // No need to re-import if the package was imported completely before. - if pkg = packages[id]; pkg != nil && pkg.Complete() { - return - } - f, err := lookup(path) - if err != nil { - return nil, err - } - rc = f - } else { - filename, id = FindPkg(path, srcDir) - if filename == "" { - if path == "unsafe" { - return types.Unsafe, nil - } - return nil, fmt.Errorf("can't find import: %q", id) - } - - // no need to re-import if the package was imported completely before - if pkg = packages[id]; pkg != nil && pkg.Complete() { - return - } - - // open file - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer func() { - if err != nil { - // add file name to error - err = fmt.Errorf("%s: %v", filename, err) - } - }() - rc = f - } - defer rc.Close() - - var hdr string - buf := bufio.NewReader(rc) - if hdr, err = FindExportData(buf); err != nil { - return - } - - switch hdr { - case "$$\n": - // Work-around if we don't have a filename; happens only if lookup != nil. - // Either way, the filename is only needed for importer error messages, so - // this is fine. - if filename == "" { - filename = path - } - return ImportData(packages, filename, id, buf) - - case "$$B\n": - var data []byte - data, err = ioutil.ReadAll(buf) - if err != nil { - break - } - - // TODO(gri): allow clients of go/importer to provide a FileSet. - // Or, define a new standard go/types/gcexportdata package. - fset := token.NewFileSet() - - // The indexed export format starts with an 'i'; the older - // binary export format starts with a 'c', 'd', or 'v' - // (from "version"). Select appropriate importer. - if len(data) > 0 && data[0] == 'i' { - _, pkg, err = IImportData(fset, packages, data[1:], id) - } else { - _, pkg, err = BImportData(fset, packages, data, id) - } - - default: - err = fmt.Errorf("unknown export data header: %q", hdr) - } - - return -} - -// ---------------------------------------------------------------------------- -// Parser - -// TODO(gri) Imported objects don't have position information. -// Ideally use the debug table line info; alternatively -// create some fake position (or the position of the -// import). That way error messages referring to imported -// objects can print meaningful information. - -// parser parses the exports inside a gc compiler-produced -// object/archive file and populates its scope with the results. -type parser struct { - scanner scanner.Scanner - tok rune // current token - lit string // literal string; only valid for Ident, Int, String tokens - id string // package id of imported package - sharedPkgs map[string]*types.Package // package id -> package object (across importer) - localPkgs map[string]*types.Package // package id -> package object (just this package) -} - -func (p *parser) init(filename, id string, src io.Reader, packages map[string]*types.Package) { - p.scanner.Init(src) - p.scanner.Error = func(_ *scanner.Scanner, msg string) { p.error(msg) } - p.scanner.Mode = scanner.ScanIdents | scanner.ScanInts | scanner.ScanChars | scanner.ScanStrings | scanner.ScanComments | scanner.SkipComments - p.scanner.Whitespace = 1<<'\t' | 1<<' ' - p.scanner.Filename = filename // for good error messages - p.next() - p.id = id - p.sharedPkgs = packages - if debug { - // check consistency of packages map - for _, pkg := range packages { - if pkg.Name() == "" { - fmt.Printf("no package name for %s\n", pkg.Path()) - } - } - } -} - -func (p *parser) next() { - p.tok = p.scanner.Scan() - switch p.tok { - case scanner.Ident, scanner.Int, scanner.Char, scanner.String, '·': - p.lit = p.scanner.TokenText() - default: - p.lit = "" - } - if debug { - fmt.Printf("%s: %q -> %q\n", scanner.TokenString(p.tok), p.scanner.TokenText(), p.lit) - } -} - -func declTypeName(pkg *types.Package, name string) *types.TypeName { - scope := pkg.Scope() - if obj := scope.Lookup(name); obj != nil { - return obj.(*types.TypeName) - } - obj := types.NewTypeName(token.NoPos, pkg, name, nil) - // a named type may be referred to before the underlying type - // is known - set it up - types.NewNamed(obj, nil, nil) - scope.Insert(obj) - return obj -} - -// ---------------------------------------------------------------------------- -// Error handling - -// Internal errors are boxed as importErrors. -type importError struct { - pos scanner.Position - err error -} - -func (e importError) Error() string { - return fmt.Sprintf("import error %s (byte offset = %d): %s", e.pos, e.pos.Offset, e.err) -} - -func (p *parser) error(err interface{}) { - if s, ok := err.(string); ok { - err = errors.New(s) - } - // panic with a runtime.Error if err is not an error - panic(importError{p.scanner.Pos(), err.(error)}) -} - -func (p *parser) errorf(format string, args ...interface{}) { - p.error(fmt.Sprintf(format, args...)) -} - -func (p *parser) expect(tok rune) string { - lit := p.lit - if p.tok != tok { - p.errorf("expected %s, got %s (%s)", scanner.TokenString(tok), scanner.TokenString(p.tok), lit) - } - p.next() - return lit -} - -func (p *parser) expectSpecial(tok string) { - sep := 'x' // not white space - i := 0 - for i < len(tok) && p.tok == rune(tok[i]) && sep > ' ' { - sep = p.scanner.Peek() // if sep <= ' ', there is white space before the next token - p.next() - i++ - } - if i < len(tok) { - p.errorf("expected %q, got %q", tok, tok[0:i]) - } -} - -func (p *parser) expectKeyword(keyword string) { - lit := p.expect(scanner.Ident) - if lit != keyword { - p.errorf("expected keyword %s, got %q", keyword, lit) - } -} - -// ---------------------------------------------------------------------------- -// Qualified and unqualified names - -// PackageId = string_lit . -// -func (p *parser) parsePackageId() string { - id, err := strconv.Unquote(p.expect(scanner.String)) - if err != nil { - p.error(err) - } - // id == "" stands for the imported package id - // (only known at time of package installation) - if id == "" { - id = p.id - } - return id -} - -// PackageName = ident . -// -func (p *parser) parsePackageName() string { - return p.expect(scanner.Ident) -} - -// dotIdentifier = ( ident | '·' ) { ident | int | '·' } . -func (p *parser) parseDotIdent() string { - ident := "" - if p.tok != scanner.Int { - sep := 'x' // not white space - for (p.tok == scanner.Ident || p.tok == scanner.Int || p.tok == '·') && sep > ' ' { - ident += p.lit - sep = p.scanner.Peek() // if sep <= ' ', there is white space before the next token - p.next() - } - } - if ident == "" { - p.expect(scanner.Ident) // use expect() for error handling - } - return ident -} - -// QualifiedName = "@" PackageId "." ( "?" | dotIdentifier ) . -// -func (p *parser) parseQualifiedName() (id, name string) { - p.expect('@') - id = p.parsePackageId() - p.expect('.') - // Per rev f280b8a485fd (10/2/2013), qualified names may be used for anonymous fields. - if p.tok == '?' { - p.next() - } else { - name = p.parseDotIdent() - } - return -} - -// getPkg returns the package for a given id. If the package is -// not found, create the package and add it to the p.localPkgs -// and p.sharedPkgs maps. name is the (expected) name of the -// package. If name == "", the package name is expected to be -// set later via an import clause in the export data. -// -// id identifies a package, usually by a canonical package path like -// "encoding/json" but possibly by a non-canonical import path like -// "./json". -// -func (p *parser) getPkg(id, name string) *types.Package { - // package unsafe is not in the packages maps - handle explicitly - if id == "unsafe" { - return types.Unsafe - } - - pkg := p.localPkgs[id] - if pkg == nil { - // first import of id from this package - pkg = p.sharedPkgs[id] - if pkg == nil { - // first import of id by this importer; - // add (possibly unnamed) pkg to shared packages - pkg = types.NewPackage(id, name) - p.sharedPkgs[id] = pkg - } - // add (possibly unnamed) pkg to local packages - if p.localPkgs == nil { - p.localPkgs = make(map[string]*types.Package) - } - p.localPkgs[id] = pkg - } else if name != "" { - // package exists already and we have an expected package name; - // make sure names match or set package name if necessary - if pname := pkg.Name(); pname == "" { - pkg.SetName(name) - } else if pname != name { - p.errorf("%s package name mismatch: %s (given) vs %s (expected)", id, pname, name) - } - } - return pkg -} - -// parseExportedName is like parseQualifiedName, but -// the package id is resolved to an imported *types.Package. -// -func (p *parser) parseExportedName() (pkg *types.Package, name string) { - id, name := p.parseQualifiedName() - pkg = p.getPkg(id, "") - return -} - -// ---------------------------------------------------------------------------- -// Types - -// BasicType = identifier . -// -func (p *parser) parseBasicType() types.Type { - id := p.expect(scanner.Ident) - obj := types.Universe.Lookup(id) - if obj, ok := obj.(*types.TypeName); ok { - return obj.Type() - } - p.errorf("not a basic type: %s", id) - return nil -} - -// ArrayType = "[" int_lit "]" Type . -// -func (p *parser) parseArrayType(parent *types.Package) types.Type { - // "[" already consumed and lookahead known not to be "]" - lit := p.expect(scanner.Int) - p.expect(']') - elem := p.parseType(parent) - n, err := strconv.ParseInt(lit, 10, 64) - if err != nil { - p.error(err) - } - return types.NewArray(elem, n) -} - -// MapType = "map" "[" Type "]" Type . -// -func (p *parser) parseMapType(parent *types.Package) types.Type { - p.expectKeyword("map") - p.expect('[') - key := p.parseType(parent) - p.expect(']') - elem := p.parseType(parent) - return types.NewMap(key, elem) -} - -// Name = identifier | "?" | QualifiedName . -// -// For unqualified and anonymous names, the returned package is the parent -// package unless parent == nil, in which case the returned package is the -// package being imported. (The parent package is not nil if the the name -// is an unqualified struct field or interface method name belonging to a -// type declared in another package.) -// -// For qualified names, the returned package is nil (and not created if -// it doesn't exist yet) unless materializePkg is set (which creates an -// unnamed package with valid package path). In the latter case, a -// subsequent import clause is expected to provide a name for the package. -// -func (p *parser) parseName(parent *types.Package, materializePkg bool) (pkg *types.Package, name string) { - pkg = parent - if pkg == nil { - pkg = p.sharedPkgs[p.id] - } - switch p.tok { - case scanner.Ident: - name = p.lit - p.next() - case '?': - // anonymous - p.next() - case '@': - // exported name prefixed with package path - pkg = nil - var id string - id, name = p.parseQualifiedName() - if materializePkg { - pkg = p.getPkg(id, "") - } - default: - p.error("name expected") - } - return -} - -func deref(typ types.Type) types.Type { - if p, _ := typ.(*types.Pointer); p != nil { - return p.Elem() - } - return typ -} - -// Field = Name Type [ string_lit ] . -// -func (p *parser) parseField(parent *types.Package) (*types.Var, string) { - pkg, name := p.parseName(parent, true) - - if name == "_" { - // Blank fields should be package-qualified because they - // are unexported identifiers, but gc does not qualify them. - // Assuming that the ident belongs to the current package - // causes types to change during re-exporting, leading - // to spurious "can't assign A to B" errors from go/types. - // As a workaround, pretend all blank fields belong - // to the same unique dummy package. - const blankpkg = "<_>" - pkg = p.getPkg(blankpkg, blankpkg) - } - - typ := p.parseType(parent) - anonymous := false - if name == "" { - // anonymous field - typ must be T or *T and T must be a type name - switch typ := deref(typ).(type) { - case *types.Basic: // basic types are named types - pkg = nil // objects defined in Universe scope have no package - name = typ.Name() - case *types.Named: - name = typ.Obj().Name() - default: - p.errorf("anonymous field expected") - } - anonymous = true - } - tag := "" - if p.tok == scanner.String { - s := p.expect(scanner.String) - var err error - tag, err = strconv.Unquote(s) - if err != nil { - p.errorf("invalid struct tag %s: %s", s, err) - } - } - return types.NewField(token.NoPos, pkg, name, typ, anonymous), tag -} - -// StructType = "struct" "{" [ FieldList ] "}" . -// FieldList = Field { ";" Field } . -// -func (p *parser) parseStructType(parent *types.Package) types.Type { - var fields []*types.Var - var tags []string - - p.expectKeyword("struct") - p.expect('{') - for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ { - if i > 0 { - p.expect(';') - } - fld, tag := p.parseField(parent) - if tag != "" && tags == nil { - tags = make([]string, i) - } - if tags != nil { - tags = append(tags, tag) - } - fields = append(fields, fld) - } - p.expect('}') - - return types.NewStruct(fields, tags) -} - -// Parameter = ( identifier | "?" ) [ "..." ] Type [ string_lit ] . -// -func (p *parser) parseParameter() (par *types.Var, isVariadic bool) { - _, name := p.parseName(nil, false) - // remove gc-specific parameter numbering - if i := strings.Index(name, "·"); i >= 0 { - name = name[:i] - } - if p.tok == '.' { - p.expectSpecial("...") - isVariadic = true - } - typ := p.parseType(nil) - if isVariadic { - typ = types.NewSlice(typ) - } - // ignore argument tag (e.g. "noescape") - if p.tok == scanner.String { - p.next() - } - // TODO(gri) should we provide a package? - par = types.NewVar(token.NoPos, nil, name, typ) - return -} - -// Parameters = "(" [ ParameterList ] ")" . -// ParameterList = { Parameter "," } Parameter . -// -func (p *parser) parseParameters() (list []*types.Var, isVariadic bool) { - p.expect('(') - for p.tok != ')' && p.tok != scanner.EOF { - if len(list) > 0 { - p.expect(',') - } - par, variadic := p.parseParameter() - list = append(list, par) - if variadic { - if isVariadic { - p.error("... not on final argument") - } - isVariadic = true - } - } - p.expect(')') - - return -} - -// Signature = Parameters [ Result ] . -// Result = Type | Parameters . -// -func (p *parser) parseSignature(recv *types.Var) *types.Signature { - params, isVariadic := p.parseParameters() - - // optional result type - var results []*types.Var - if p.tok == '(' { - var variadic bool - results, variadic = p.parseParameters() - if variadic { - p.error("... not permitted on result type") - } - } - - return types.NewSignature(recv, types.NewTuple(params...), types.NewTuple(results...), isVariadic) -} - -// InterfaceType = "interface" "{" [ MethodList ] "}" . -// MethodList = Method { ";" Method } . -// Method = Name Signature . -// -// The methods of embedded interfaces are always "inlined" -// by the compiler and thus embedded interfaces are never -// visible in the export data. -// -func (p *parser) parseInterfaceType(parent *types.Package) types.Type { - var methods []*types.Func - - p.expectKeyword("interface") - p.expect('{') - for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ { - if i > 0 { - p.expect(';') - } - pkg, name := p.parseName(parent, true) - sig := p.parseSignature(nil) - methods = append(methods, types.NewFunc(token.NoPos, pkg, name, sig)) - } - p.expect('}') - - // Complete requires the type's embedded interfaces to be fully defined, - // but we do not define any - return types.NewInterface(methods, nil).Complete() -} - -// ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type . -// -func (p *parser) parseChanType(parent *types.Package) types.Type { - dir := types.SendRecv - if p.tok == scanner.Ident { - p.expectKeyword("chan") - if p.tok == '<' { - p.expectSpecial("<-") - dir = types.SendOnly - } - } else { - p.expectSpecial("<-") - p.expectKeyword("chan") - dir = types.RecvOnly - } - elem := p.parseType(parent) - return types.NewChan(dir, elem) -} - -// Type = -// BasicType | TypeName | ArrayType | SliceType | StructType | -// PointerType | FuncType | InterfaceType | MapType | ChanType | -// "(" Type ")" . -// -// BasicType = ident . -// TypeName = ExportedName . -// SliceType = "[" "]" Type . -// PointerType = "*" Type . -// FuncType = "func" Signature . -// -func (p *parser) parseType(parent *types.Package) types.Type { - switch p.tok { - case scanner.Ident: - switch p.lit { - default: - return p.parseBasicType() - case "struct": - return p.parseStructType(parent) - case "func": - // FuncType - p.next() - return p.parseSignature(nil) - case "interface": - return p.parseInterfaceType(parent) - case "map": - return p.parseMapType(parent) - case "chan": - return p.parseChanType(parent) - } - case '@': - // TypeName - pkg, name := p.parseExportedName() - return declTypeName(pkg, name).Type() - case '[': - p.next() // look ahead - if p.tok == ']' { - // SliceType - p.next() - return types.NewSlice(p.parseType(parent)) - } - return p.parseArrayType(parent) - case '*': - // PointerType - p.next() - return types.NewPointer(p.parseType(parent)) - case '<': - return p.parseChanType(parent) - case '(': - // "(" Type ")" - p.next() - typ := p.parseType(parent) - p.expect(')') - return typ - } - p.errorf("expected type, got %s (%q)", scanner.TokenString(p.tok), p.lit) - return nil -} - -// ---------------------------------------------------------------------------- -// Declarations - -// ImportDecl = "import" PackageName PackageId . -// -func (p *parser) parseImportDecl() { - p.expectKeyword("import") - name := p.parsePackageName() - p.getPkg(p.parsePackageId(), name) -} - -// int_lit = [ "+" | "-" ] { "0" ... "9" } . -// -func (p *parser) parseInt() string { - s := "" - switch p.tok { - case '-': - s = "-" - p.next() - case '+': - p.next() - } - return s + p.expect(scanner.Int) -} - -// number = int_lit [ "p" int_lit ] . -// -func (p *parser) parseNumber() (typ *types.Basic, val constant.Value) { - // mantissa - mant := constant.MakeFromLiteral(p.parseInt(), token.INT, 0) - if mant == nil { - panic("invalid mantissa") - } - - if p.lit == "p" { - // exponent (base 2) - p.next() - exp, err := strconv.ParseInt(p.parseInt(), 10, 0) - if err != nil { - p.error(err) - } - if exp < 0 { - denom := constant.MakeInt64(1) - denom = constant.Shift(denom, token.SHL, uint(-exp)) - typ = types.Typ[types.UntypedFloat] - val = constant.BinaryOp(mant, token.QUO, denom) - return - } - if exp > 0 { - mant = constant.Shift(mant, token.SHL, uint(exp)) - } - typ = types.Typ[types.UntypedFloat] - val = mant - return - } - - typ = types.Typ[types.UntypedInt] - val = mant - return -} - -// ConstDecl = "const" ExportedName [ Type ] "=" Literal . -// Literal = bool_lit | int_lit | float_lit | complex_lit | rune_lit | string_lit . -// bool_lit = "true" | "false" . -// complex_lit = "(" float_lit "+" float_lit "i" ")" . -// rune_lit = "(" int_lit "+" int_lit ")" . -// string_lit = `"` { unicode_char } `"` . -// -func (p *parser) parseConstDecl() { - p.expectKeyword("const") - pkg, name := p.parseExportedName() - - var typ0 types.Type - if p.tok != '=' { - // constant types are never structured - no need for parent type - typ0 = p.parseType(nil) - } - - p.expect('=') - var typ types.Type - var val constant.Value - switch p.tok { - case scanner.Ident: - // bool_lit - if p.lit != "true" && p.lit != "false" { - p.error("expected true or false") - } - typ = types.Typ[types.UntypedBool] - val = constant.MakeBool(p.lit == "true") - p.next() - - case '-', scanner.Int: - // int_lit - typ, val = p.parseNumber() - - case '(': - // complex_lit or rune_lit - p.next() - if p.tok == scanner.Char { - p.next() - p.expect('+') - typ = types.Typ[types.UntypedRune] - _, val = p.parseNumber() - p.expect(')') - break - } - _, re := p.parseNumber() - p.expect('+') - _, im := p.parseNumber() - p.expectKeyword("i") - p.expect(')') - typ = types.Typ[types.UntypedComplex] - val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) - - case scanner.Char: - // rune_lit - typ = types.Typ[types.UntypedRune] - val = constant.MakeFromLiteral(p.lit, token.CHAR, 0) - p.next() - - case scanner.String: - // string_lit - typ = types.Typ[types.UntypedString] - val = constant.MakeFromLiteral(p.lit, token.STRING, 0) - p.next() - - default: - p.errorf("expected literal got %s", scanner.TokenString(p.tok)) - } - - if typ0 == nil { - typ0 = typ - } - - pkg.Scope().Insert(types.NewConst(token.NoPos, pkg, name, typ0, val)) -} - -// TypeDecl = "type" ExportedName Type . -// -func (p *parser) parseTypeDecl() { - p.expectKeyword("type") - pkg, name := p.parseExportedName() - obj := declTypeName(pkg, name) - - // The type object may have been imported before and thus already - // have a type associated with it. We still need to parse the type - // structure, but throw it away if the object already has a type. - // This ensures that all imports refer to the same type object for - // a given type declaration. - typ := p.parseType(pkg) - - if name := obj.Type().(*types.Named); name.Underlying() == nil { - name.SetUnderlying(typ) - } -} - -// VarDecl = "var" ExportedName Type . -// -func (p *parser) parseVarDecl() { - p.expectKeyword("var") - pkg, name := p.parseExportedName() - typ := p.parseType(pkg) - pkg.Scope().Insert(types.NewVar(token.NoPos, pkg, name, typ)) -} - -// Func = Signature [ Body ] . -// Body = "{" ... "}" . -// -func (p *parser) parseFunc(recv *types.Var) *types.Signature { - sig := p.parseSignature(recv) - if p.tok == '{' { - p.next() - for i := 1; i > 0; p.next() { - switch p.tok { - case '{': - i++ - case '}': - i-- - } - } - } - return sig -} - -// MethodDecl = "func" Receiver Name Func . -// Receiver = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" . -// -func (p *parser) parseMethodDecl() { - // "func" already consumed - p.expect('(') - recv, _ := p.parseParameter() // receiver - p.expect(')') - - // determine receiver base type object - base := deref(recv.Type()).(*types.Named) - - // parse method name, signature, and possibly inlined body - _, name := p.parseName(nil, false) - sig := p.parseFunc(recv) - - // methods always belong to the same package as the base type object - pkg := base.Obj().Pkg() - - // add method to type unless type was imported before - // and method exists already - // TODO(gri) This leads to a quadratic algorithm - ok for now because method counts are small. - base.AddMethod(types.NewFunc(token.NoPos, pkg, name, sig)) -} - -// FuncDecl = "func" ExportedName Func . -// -func (p *parser) parseFuncDecl() { - // "func" already consumed - pkg, name := p.parseExportedName() - typ := p.parseFunc(nil) - pkg.Scope().Insert(types.NewFunc(token.NoPos, pkg, name, typ)) -} - -// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" . -// -func (p *parser) parseDecl() { - if p.tok == scanner.Ident { - switch p.lit { - case "import": - p.parseImportDecl() - case "const": - p.parseConstDecl() - case "type": - p.parseTypeDecl() - case "var": - p.parseVarDecl() - case "func": - p.next() // look ahead - if p.tok == '(' { - p.parseMethodDecl() - } else { - p.parseFuncDecl() - } - } - } - p.expect('\n') -} - -// ---------------------------------------------------------------------------- -// Export - -// Export = "PackageClause { Decl } "$$" . -// PackageClause = "package" PackageName [ "safe" ] "\n" . -// -func (p *parser) parseExport() *types.Package { - p.expectKeyword("package") - name := p.parsePackageName() - if p.tok == scanner.Ident && p.lit == "safe" { - // package was compiled with -u option - ignore - p.next() - } - p.expect('\n') - - pkg := p.getPkg(p.id, name) - - for p.tok != '$' && p.tok != scanner.EOF { - p.parseDecl() - } - - if ch := p.scanner.Peek(); p.tok != '$' || ch != '$' { - // don't call next()/expect() since reading past the - // export data may cause scanner errors (e.g. NUL chars) - p.errorf("expected '$$', got %s %c", scanner.TokenString(p.tok), ch) - } - - if n := p.scanner.ErrorCount; n != 0 { - p.errorf("expected no scanner errors, got %d", n) - } - - // Record all locally referenced packages as imports. - var imports []*types.Package - for id, pkg2 := range p.localPkgs { - if pkg2.Name() == "" { - p.errorf("%s package has no name", id) - } - if id == p.id { - continue // avoid self-edge - } - imports = append(imports, pkg2) - } - sort.Sort(byPath(imports)) - pkg.SetImports(imports) - - // package was imported completely and without errors - pkg.MarkComplete() - - return pkg -} - -type byPath []*types.Package - -func (a byPath) Len() int { return len(a) } -func (a byPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byPath) Less(i, j int) bool { return a[i].Path() < a[j].Path() } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go deleted file mode 100644 index be671c79..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright 2019 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. - -// Indexed binary package export. -// This file was derived from $GOROOT/src/cmd/compile/internal/gc/iexport.go; -// see that file for specification of the format. - -// +build go1.11 - -package gcimporter - -import ( - "bytes" - "encoding/binary" - "go/ast" - "go/constant" - "go/token" - "go/types" - "io" - "math/big" - "reflect" - "sort" -) - -// Current indexed export format version. Increase with each format change. -// 0: Go1.11 encoding -const iexportVersion = 0 - -// IExportData returns the binary export data for pkg. -// If no file set is provided, position info will be missing. -func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return - } - // Not an internal error; panic again. - panic(e) - } - }() - - p := iexporter{ - out: bytes.NewBuffer(nil), - fset: fset, - allPkgs: map[*types.Package]bool{}, - stringIndex: map[string]uint64{}, - declIndex: map[types.Object]uint64{}, - typIndex: map[types.Type]uint64{}, - } - - for i, pt := range predeclared() { - p.typIndex[pt] = uint64(i) - } - if len(p.typIndex) > predeclReserved { - panic(internalErrorf("too many predeclared types: %d > %d", len(p.typIndex), predeclReserved)) - } - - // Initialize work queue with exported declarations. - scope := pkg.Scope() - for _, name := range scope.Names() { - if ast.IsExported(name) { - p.pushDecl(scope.Lookup(name)) - } - } - - // Loop until no more work. - for !p.declTodo.empty() { - p.doDecl(p.declTodo.popHead()) - } - - // Append indices to data0 section. - dataLen := uint64(p.data0.Len()) - w := p.newWriter() - w.writeIndex(p.declIndex, pkg) - w.flush() - - // Assemble header. - var hdr intWriter - hdr.WriteByte('i') - hdr.uint64(iexportVersion) - hdr.uint64(uint64(p.strings.Len())) - hdr.uint64(dataLen) - - // Flush output. - io.Copy(p.out, &hdr) - io.Copy(p.out, &p.strings) - io.Copy(p.out, &p.data0) - - return p.out.Bytes(), nil -} - -// writeIndex writes out an object index. mainIndex indicates whether -// we're writing out the main index, which is also read by -// non-compiler tools and includes a complete package description -// (i.e., name and height). -func (w *exportWriter) writeIndex(index map[types.Object]uint64, localpkg *types.Package) { - // Build a map from packages to objects from that package. - pkgObjs := map[*types.Package][]types.Object{} - - // For the main index, make sure to include every package that - // we reference, even if we're not exporting (or reexporting) - // any symbols from it. - pkgObjs[localpkg] = nil - for pkg := range w.p.allPkgs { - pkgObjs[pkg] = nil - } - - for obj := range index { - pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj) - } - - var pkgs []*types.Package - for pkg, objs := range pkgObjs { - pkgs = append(pkgs, pkg) - - sort.Slice(objs, func(i, j int) bool { - return objs[i].Name() < objs[j].Name() - }) - } - - sort.Slice(pkgs, func(i, j int) bool { - return pkgs[i].Path() < pkgs[j].Path() - }) - - w.uint64(uint64(len(pkgs))) - for _, pkg := range pkgs { - w.string(pkg.Path()) - w.string(pkg.Name()) - w.uint64(uint64(0)) // package height is not needed for go/types - - objs := pkgObjs[pkg] - w.uint64(uint64(len(objs))) - for _, obj := range objs { - w.string(obj.Name()) - w.uint64(index[obj]) - } - } -} - -type iexporter struct { - fset *token.FileSet - out *bytes.Buffer - - // allPkgs tracks all packages that have been referenced by - // the export data, so we can ensure to include them in the - // main index. - allPkgs map[*types.Package]bool - - declTodo objQueue - - strings intWriter - stringIndex map[string]uint64 - - data0 intWriter - declIndex map[types.Object]uint64 - typIndex map[types.Type]uint64 -} - -// stringOff returns the offset of s within the string section. -// If not already present, it's added to the end. -func (p *iexporter) stringOff(s string) uint64 { - off, ok := p.stringIndex[s] - if !ok { - off = uint64(p.strings.Len()) - p.stringIndex[s] = off - - p.strings.uint64(uint64(len(s))) - p.strings.WriteString(s) - } - return off -} - -// pushDecl adds n to the declaration work queue, if not already present. -func (p *iexporter) pushDecl(obj types.Object) { - // Package unsafe is known to the compiler and predeclared. - assert(obj.Pkg() != types.Unsafe) - - if _, ok := p.declIndex[obj]; ok { - return - } - - p.declIndex[obj] = ^uint64(0) // mark n present in work queue - p.declTodo.pushTail(obj) -} - -// exportWriter handles writing out individual data section chunks. -type exportWriter struct { - p *iexporter - - data intWriter - currPkg *types.Package - prevFile string - prevLine int64 -} - -func (p *iexporter) doDecl(obj types.Object) { - w := p.newWriter() - w.setPkg(obj.Pkg(), false) - - switch obj := obj.(type) { - case *types.Var: - w.tag('V') - w.pos(obj.Pos()) - w.typ(obj.Type(), obj.Pkg()) - - case *types.Func: - sig, _ := obj.Type().(*types.Signature) - if sig.Recv() != nil { - panic(internalErrorf("unexpected method: %v", sig)) - } - w.tag('F') - w.pos(obj.Pos()) - w.signature(sig) - - case *types.Const: - w.tag('C') - w.pos(obj.Pos()) - w.value(obj.Type(), obj.Val()) - - case *types.TypeName: - if obj.IsAlias() { - w.tag('A') - w.pos(obj.Pos()) - w.typ(obj.Type(), obj.Pkg()) - break - } - - // Defined type. - w.tag('T') - w.pos(obj.Pos()) - - underlying := obj.Type().Underlying() - w.typ(underlying, obj.Pkg()) - - t := obj.Type() - if types.IsInterface(t) { - break - } - - named, ok := t.(*types.Named) - if !ok { - panic(internalErrorf("%s is not a defined type", t)) - } - - n := named.NumMethods() - w.uint64(uint64(n)) - for i := 0; i < n; i++ { - m := named.Method(i) - w.pos(m.Pos()) - w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) - w.param(sig.Recv()) - w.signature(sig) - } - - default: - panic(internalErrorf("unexpected object: %v", obj)) - } - - p.declIndex[obj] = w.flush() -} - -func (w *exportWriter) tag(tag byte) { - w.data.WriteByte(tag) -} - -func (w *exportWriter) pos(pos token.Pos) { - p := w.p.fset.Position(pos) - file := p.Filename - line := int64(p.Line) - - // When file is the same as the last position (common case), - // we can save a few bytes by delta encoding just the line - // number. - // - // Note: Because data objects may be read out of order (or not - // at all), we can only apply delta encoding within a single - // object. This is handled implicitly by tracking prevFile and - // prevLine as fields of exportWriter. - - if file == w.prevFile { - delta := line - w.prevLine - w.int64(delta) - if delta == deltaNewFile { - w.int64(-1) - } - } else { - w.int64(deltaNewFile) - w.int64(line) // line >= 0 - w.string(file) - w.prevFile = file - } - w.prevLine = line -} - -func (w *exportWriter) pkg(pkg *types.Package) { - // Ensure any referenced packages are declared in the main index. - w.p.allPkgs[pkg] = true - - w.string(pkg.Path()) -} - -func (w *exportWriter) qualifiedIdent(obj types.Object) { - // Ensure any referenced declarations are written out too. - w.p.pushDecl(obj) - - w.string(obj.Name()) - w.pkg(obj.Pkg()) -} - -func (w *exportWriter) typ(t types.Type, pkg *types.Package) { - w.data.uint64(w.p.typOff(t, pkg)) -} - -func (p *iexporter) newWriter() *exportWriter { - return &exportWriter{p: p} -} - -func (w *exportWriter) flush() uint64 { - off := uint64(w.p.data0.Len()) - io.Copy(&w.p.data0, &w.data) - return off -} - -func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 { - off, ok := p.typIndex[t] - if !ok { - w := p.newWriter() - w.doTyp(t, pkg) - off = predeclReserved + w.flush() - p.typIndex[t] = off - } - return off -} - -func (w *exportWriter) startType(k itag) { - w.data.uint64(uint64(k)) -} - -func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { - switch t := t.(type) { - case *types.Named: - w.startType(definedType) - w.qualifiedIdent(t.Obj()) - - case *types.Pointer: - w.startType(pointerType) - w.typ(t.Elem(), pkg) - - case *types.Slice: - w.startType(sliceType) - w.typ(t.Elem(), pkg) - - case *types.Array: - w.startType(arrayType) - w.uint64(uint64(t.Len())) - w.typ(t.Elem(), pkg) - - case *types.Chan: - w.startType(chanType) - // 1 RecvOnly; 2 SendOnly; 3 SendRecv - var dir uint64 - switch t.Dir() { - case types.RecvOnly: - dir = 1 - case types.SendOnly: - dir = 2 - case types.SendRecv: - dir = 3 - } - w.uint64(dir) - w.typ(t.Elem(), pkg) - - case *types.Map: - w.startType(mapType) - w.typ(t.Key(), pkg) - w.typ(t.Elem(), pkg) - - case *types.Signature: - w.startType(signatureType) - w.setPkg(pkg, true) - w.signature(t) - - case *types.Struct: - w.startType(structType) - w.setPkg(pkg, true) - - n := t.NumFields() - w.uint64(uint64(n)) - for i := 0; i < n; i++ { - f := t.Field(i) - w.pos(f.Pos()) - w.string(f.Name()) - w.typ(f.Type(), pkg) - w.bool(f.Embedded()) - w.string(t.Tag(i)) // note (or tag) - } - - case *types.Interface: - w.startType(interfaceType) - w.setPkg(pkg, true) - - n := t.NumEmbeddeds() - w.uint64(uint64(n)) - for i := 0; i < n; i++ { - f := t.Embedded(i) - w.pos(f.Obj().Pos()) - w.typ(f.Obj().Type(), f.Obj().Pkg()) - } - - n = t.NumExplicitMethods() - w.uint64(uint64(n)) - for i := 0; i < n; i++ { - m := t.ExplicitMethod(i) - w.pos(m.Pos()) - w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) - w.signature(sig) - } - - default: - panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t))) - } -} - -func (w *exportWriter) setPkg(pkg *types.Package, write bool) { - if write { - w.pkg(pkg) - } - - w.currPkg = pkg -} - -func (w *exportWriter) signature(sig *types.Signature) { - w.paramList(sig.Params()) - w.paramList(sig.Results()) - if sig.Params().Len() > 0 { - w.bool(sig.Variadic()) - } -} - -func (w *exportWriter) paramList(tup *types.Tuple) { - n := tup.Len() - w.uint64(uint64(n)) - for i := 0; i < n; i++ { - w.param(tup.At(i)) - } -} - -func (w *exportWriter) param(obj types.Object) { - w.pos(obj.Pos()) - w.localIdent(obj) - w.typ(obj.Type(), obj.Pkg()) -} - -func (w *exportWriter) value(typ types.Type, v constant.Value) { - w.typ(typ, nil) - - switch v.Kind() { - case constant.Bool: - w.bool(constant.BoolVal(v)) - case constant.Int: - var i big.Int - if i64, exact := constant.Int64Val(v); exact { - i.SetInt64(i64) - } else if ui64, exact := constant.Uint64Val(v); exact { - i.SetUint64(ui64) - } else { - i.SetString(v.ExactString(), 10) - } - w.mpint(&i, typ) - case constant.Float: - f := constantToFloat(v) - w.mpfloat(f, typ) - case constant.Complex: - w.mpfloat(constantToFloat(constant.Real(v)), typ) - w.mpfloat(constantToFloat(constant.Imag(v)), typ) - case constant.String: - w.string(constant.StringVal(v)) - case constant.Unknown: - // package contains type errors - default: - panic(internalErrorf("unexpected value %v (%T)", v, v)) - } -} - -// constantToFloat converts a constant.Value with kind constant.Float to a -// big.Float. -func constantToFloat(x constant.Value) *big.Float { - assert(x.Kind() == constant.Float) - // Use the same floating-point precision (512) as cmd/compile - // (see Mpprec in cmd/compile/internal/gc/mpfloat.go). - const mpprec = 512 - var f big.Float - f.SetPrec(mpprec) - if v, exact := constant.Float64Val(x); exact { - // float64 - f.SetFloat64(v) - } else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int { - // TODO(gri): add big.Rat accessor to constant.Value. - n := valueToRat(num) - d := valueToRat(denom) - f.SetRat(n.Quo(n, d)) - } else { - // Value too large to represent as a fraction => inaccessible. - // TODO(gri): add big.Float accessor to constant.Value. - _, ok := f.SetString(x.ExactString()) - assert(ok) - } - return &f -} - -// mpint exports a multi-precision integer. -// -// For unsigned types, small values are written out as a single -// byte. Larger values are written out as a length-prefixed big-endian -// byte string, where the length prefix is encoded as its complement. -// For example, bytes 0, 1, and 2 directly represent the integer -// values 0, 1, and 2; while bytes 255, 254, and 253 indicate a 1-, -// 2-, and 3-byte big-endian string follow. -// -// Encoding for signed types use the same general approach as for -// unsigned types, except small values use zig-zag encoding and the -// bottom bit of length prefix byte for large values is reserved as a -// sign bit. -// -// The exact boundary between small and large encodings varies -// according to the maximum number of bytes needed to encode a value -// of type typ. As a special case, 8-bit types are always encoded as a -// single byte. -// -// TODO(mdempsky): Is this level of complexity really worthwhile? -func (w *exportWriter) mpint(x *big.Int, typ types.Type) { - basic, ok := typ.Underlying().(*types.Basic) - if !ok { - panic(internalErrorf("unexpected type %v (%T)", typ.Underlying(), typ.Underlying())) - } - - signed, maxBytes := intSize(basic) - - negative := x.Sign() < 0 - if !signed && negative { - panic(internalErrorf("negative unsigned integer; type %v, value %v", typ, x)) - } - - b := x.Bytes() - if len(b) > 0 && b[0] == 0 { - panic(internalErrorf("leading zeros")) - } - if uint(len(b)) > maxBytes { - panic(internalErrorf("bad mpint length: %d > %d (type %v, value %v)", len(b), maxBytes, typ, x)) - } - - maxSmall := 256 - maxBytes - if signed { - maxSmall = 256 - 2*maxBytes - } - if maxBytes == 1 { - maxSmall = 256 - } - - // Check if x can use small value encoding. - if len(b) <= 1 { - var ux uint - if len(b) == 1 { - ux = uint(b[0]) - } - if signed { - ux <<= 1 - if negative { - ux-- - } - } - if ux < maxSmall { - w.data.WriteByte(byte(ux)) - return - } - } - - n := 256 - uint(len(b)) - if signed { - n = 256 - 2*uint(len(b)) - if negative { - n |= 1 - } - } - if n < maxSmall || n >= 256 { - panic(internalErrorf("encoding mistake: %d, %v, %v => %d", len(b), signed, negative, n)) - } - - w.data.WriteByte(byte(n)) - w.data.Write(b) -} - -// mpfloat exports a multi-precision floating point number. -// -// The number's value is decomposed into mantissa × 2**exponent, where -// mantissa is an integer. The value is written out as mantissa (as a -// multi-precision integer) and then the exponent, except exponent is -// omitted if mantissa is zero. -func (w *exportWriter) mpfloat(f *big.Float, typ types.Type) { - if f.IsInf() { - panic("infinite constant") - } - - // Break into f = mant × 2**exp, with 0.5 <= mant < 1. - var mant big.Float - exp := int64(f.MantExp(&mant)) - - // Scale so that mant is an integer. - prec := mant.MinPrec() - mant.SetMantExp(&mant, int(prec)) - exp -= int64(prec) - - manti, acc := mant.Int(nil) - if acc != big.Exact { - panic(internalErrorf("mantissa scaling failed for %f (%s)", f, acc)) - } - w.mpint(manti, typ) - if manti.Sign() != 0 { - w.int64(exp) - } -} - -func (w *exportWriter) bool(b bool) bool { - var x uint64 - if b { - x = 1 - } - w.uint64(x) - return b -} - -func (w *exportWriter) int64(x int64) { w.data.int64(x) } -func (w *exportWriter) uint64(x uint64) { w.data.uint64(x) } -func (w *exportWriter) string(s string) { w.uint64(w.p.stringOff(s)) } - -func (w *exportWriter) localIdent(obj types.Object) { - // Anonymous parameters. - if obj == nil { - w.string("") - return - } - - name := obj.Name() - if name == "_" { - w.string("_") - return - } - - w.string(name) -} - -type intWriter struct { - bytes.Buffer -} - -func (w *intWriter) int64(x int64) { - var buf [binary.MaxVarintLen64]byte - n := binary.PutVarint(buf[:], x) - w.Write(buf[:n]) -} - -func (w *intWriter) uint64(x uint64) { - var buf [binary.MaxVarintLen64]byte - n := binary.PutUvarint(buf[:], x) - w.Write(buf[:n]) -} - -func assert(cond bool) { - if !cond { - panic("internal error: assertion failed") - } -} - -// The below is copied from go/src/cmd/compile/internal/gc/syntax.go. - -// objQueue is a FIFO queue of types.Object. The zero value of objQueue is -// a ready-to-use empty queue. -type objQueue struct { - ring []types.Object - head, tail int -} - -// empty returns true if q contains no Nodes. -func (q *objQueue) empty() bool { - return q.head == q.tail -} - -// pushTail appends n to the tail of the queue. -func (q *objQueue) pushTail(obj types.Object) { - if len(q.ring) == 0 { - q.ring = make([]types.Object, 16) - } else if q.head+len(q.ring) == q.tail { - // Grow the ring. - nring := make([]types.Object, len(q.ring)*2) - // Copy the old elements. - part := q.ring[q.head%len(q.ring):] - if q.tail-q.head <= len(part) { - part = part[:q.tail-q.head] - copy(nring, part) - } else { - pos := copy(nring, part) - copy(nring[pos:], q.ring[:q.tail%len(q.ring)]) - } - q.ring, q.head, q.tail = nring, 0, q.tail-q.head - } - - q.ring[q.tail%len(q.ring)] = obj - q.tail++ -} - -// popHead pops a node from the head of the queue. It panics if q is empty. -func (q *objQueue) popHead() types.Object { - if q.empty() { - panic("dequeue empty") - } - obj := q.ring[q.head%len(q.ring)] - q.head++ - return obj -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go deleted file mode 100644 index 3cb7ae5b..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Indexed package import. -// See cmd/compile/internal/gc/iexport.go for the export data format. - -// This file is a copy of $GOROOT/src/go/internal/gcimporter/iimport.go. - -package gcimporter - -import ( - "bytes" - "encoding/binary" - "fmt" - "go/constant" - "go/token" - "go/types" - "io" - "sort" -) - -type intReader struct { - *bytes.Reader - path string -} - -func (r *intReader) int64() int64 { - i, err := binary.ReadVarint(r.Reader) - if err != nil { - errorf("import %q: read varint error: %v", r.path, err) - } - return i -} - -func (r *intReader) uint64() uint64 { - i, err := binary.ReadUvarint(r.Reader) - if err != nil { - errorf("import %q: read varint error: %v", r.path, err) - } - return i -} - -const predeclReserved = 32 - -type itag uint64 - -const ( - // Types - definedType itag = iota - pointerType - sliceType - arrayType - chanType - mapType - signatureType - structType - interfaceType -) - -// IImportData imports a package from the serialized package data -// and returns the number of bytes consumed and a reference to the package. -// If the export data version is not recognized or the format is otherwise -// compromised, an error is returned. -func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { - const currentVersion = 0 - version := -1 - defer func() { - if e := recover(); e != nil { - if version > currentVersion { - err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) - } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) - } - } - }() - - r := &intReader{bytes.NewReader(data), path} - - version = int(r.uint64()) - switch version { - case currentVersion: - default: - errorf("unknown iexport format version %d", version) - } - - sLen := int64(r.uint64()) - dLen := int64(r.uint64()) - - whence, _ := r.Seek(0, io.SeekCurrent) - stringData := data[whence : whence+sLen] - declData := data[whence+sLen : whence+sLen+dLen] - r.Seek(sLen+dLen, io.SeekCurrent) - - p := iimporter{ - ipath: path, - - stringData: stringData, - stringCache: make(map[uint64]string), - pkgCache: make(map[uint64]*types.Package), - - declData: declData, - pkgIndex: make(map[*types.Package]map[string]uint64), - typCache: make(map[uint64]types.Type), - - fake: fakeFileSet{ - fset: fset, - files: make(map[string]*token.File), - }, - } - - for i, pt := range predeclared() { - p.typCache[uint64(i)] = pt - } - - pkgList := make([]*types.Package, r.uint64()) - for i := range pkgList { - pkgPathOff := r.uint64() - pkgPath := p.stringAt(pkgPathOff) - pkgName := p.stringAt(r.uint64()) - _ = r.uint64() // package height; unused by go/types - - if pkgPath == "" { - pkgPath = path - } - pkg := imports[pkgPath] - if pkg == nil { - pkg = types.NewPackage(pkgPath, pkgName) - imports[pkgPath] = pkg - } else if pkg.Name() != pkgName { - errorf("conflicting names %s and %s for package %q", pkg.Name(), pkgName, path) - } - - p.pkgCache[pkgPathOff] = pkg - - nameIndex := make(map[string]uint64) - for nSyms := r.uint64(); nSyms > 0; nSyms-- { - name := p.stringAt(r.uint64()) - nameIndex[name] = r.uint64() - } - - p.pkgIndex[pkg] = nameIndex - pkgList[i] = pkg - } - var localpkg *types.Package - for _, pkg := range pkgList { - if pkg.Path() == path { - localpkg = pkg - } - } - - names := make([]string, 0, len(p.pkgIndex[localpkg])) - for name := range p.pkgIndex[localpkg] { - names = append(names, name) - } - sort.Strings(names) - for _, name := range names { - p.doDecl(localpkg, name) - } - - for _, typ := range p.interfaceList { - typ.Complete() - } - - // record all referenced packages as imports - list := append(([]*types.Package)(nil), pkgList[1:]...) - sort.Sort(byPath(list)) - localpkg.SetImports(list) - - // package was imported completely and without errors - localpkg.MarkComplete() - - consumed, _ := r.Seek(0, io.SeekCurrent) - return int(consumed), localpkg, nil -} - -type iimporter struct { - ipath string - - stringData []byte - stringCache map[uint64]string - pkgCache map[uint64]*types.Package - - declData []byte - pkgIndex map[*types.Package]map[string]uint64 - typCache map[uint64]types.Type - - fake fakeFileSet - interfaceList []*types.Interface -} - -func (p *iimporter) doDecl(pkg *types.Package, name string) { - // See if we've already imported this declaration. - if obj := pkg.Scope().Lookup(name); obj != nil { - return - } - - off, ok := p.pkgIndex[pkg][name] - if !ok { - errorf("%v.%v not in index", pkg, name) - } - - r := &importReader{p: p, currPkg: pkg} - r.declReader.Reset(p.declData[off:]) - - r.obj(name) -} - -func (p *iimporter) stringAt(off uint64) string { - if s, ok := p.stringCache[off]; ok { - return s - } - - slen, n := binary.Uvarint(p.stringData[off:]) - if n <= 0 { - errorf("varint failed") - } - spos := off + uint64(n) - s := string(p.stringData[spos : spos+slen]) - p.stringCache[off] = s - return s -} - -func (p *iimporter) pkgAt(off uint64) *types.Package { - if pkg, ok := p.pkgCache[off]; ok { - return pkg - } - path := p.stringAt(off) - errorf("missing package %q in %q", path, p.ipath) - return nil -} - -func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { - if t, ok := p.typCache[off]; ok && (base == nil || !isInterface(t)) { - return t - } - - if off < predeclReserved { - errorf("predeclared type missing from cache: %v", off) - } - - r := &importReader{p: p} - r.declReader.Reset(p.declData[off-predeclReserved:]) - t := r.doType(base) - - if base == nil || !isInterface(t) { - p.typCache[off] = t - } - return t -} - -type importReader struct { - p *iimporter - declReader bytes.Reader - currPkg *types.Package - prevFile string - prevLine int64 -} - -func (r *importReader) obj(name string) { - tag := r.byte() - pos := r.pos() - - switch tag { - case 'A': - typ := r.typ() - - r.declare(types.NewTypeName(pos, r.currPkg, name, typ)) - - case 'C': - typ, val := r.value() - - r.declare(types.NewConst(pos, r.currPkg, name, typ, val)) - - case 'F': - sig := r.signature(nil) - - r.declare(types.NewFunc(pos, r.currPkg, name, sig)) - - case 'T': - // Types can be recursive. We need to setup a stub - // declaration before recursing. - obj := types.NewTypeName(pos, r.currPkg, name, nil) - named := types.NewNamed(obj, nil, nil) - r.declare(obj) - - underlying := r.p.typAt(r.uint64(), named).Underlying() - named.SetUnderlying(underlying) - - if !isInterface(underlying) { - for n := r.uint64(); n > 0; n-- { - mpos := r.pos() - mname := r.ident() - recv := r.param() - msig := r.signature(recv) - - named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig)) - } - } - - case 'V': - typ := r.typ() - - r.declare(types.NewVar(pos, r.currPkg, name, typ)) - - default: - errorf("unexpected tag: %v", tag) - } -} - -func (r *importReader) declare(obj types.Object) { - obj.Pkg().Scope().Insert(obj) -} - -func (r *importReader) value() (typ types.Type, val constant.Value) { - typ = r.typ() - - switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { - case types.IsBoolean: - val = constant.MakeBool(r.bool()) - - case types.IsString: - val = constant.MakeString(r.string()) - - case types.IsInteger: - val = r.mpint(b) - - case types.IsFloat: - val = r.mpfloat(b) - - case types.IsComplex: - re := r.mpfloat(b) - im := r.mpfloat(b) - val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) - - default: - if b.Kind() == types.Invalid { - val = constant.MakeUnknown() - return - } - errorf("unexpected type %v", typ) // panics - panic("unreachable") - } - - return -} - -func intSize(b *types.Basic) (signed bool, maxBytes uint) { - if (b.Info() & types.IsUntyped) != 0 { - return true, 64 - } - - switch b.Kind() { - case types.Float32, types.Complex64: - return true, 3 - case types.Float64, types.Complex128: - return true, 7 - } - - signed = (b.Info() & types.IsUnsigned) == 0 - switch b.Kind() { - case types.Int8, types.Uint8: - maxBytes = 1 - case types.Int16, types.Uint16: - maxBytes = 2 - case types.Int32, types.Uint32: - maxBytes = 4 - default: - maxBytes = 8 - } - - return -} - -func (r *importReader) mpint(b *types.Basic) constant.Value { - signed, maxBytes := intSize(b) - - maxSmall := 256 - maxBytes - if signed { - maxSmall = 256 - 2*maxBytes - } - if maxBytes == 1 { - maxSmall = 256 - } - - n, _ := r.declReader.ReadByte() - if uint(n) < maxSmall { - v := int64(n) - if signed { - v >>= 1 - if n&1 != 0 { - v = ^v - } - } - return constant.MakeInt64(v) - } - - v := -n - if signed { - v = -(n &^ 1) >> 1 - } - if v < 1 || uint(v) > maxBytes { - errorf("weird decoding: %v, %v => %v", n, signed, v) - } - - buf := make([]byte, v) - io.ReadFull(&r.declReader, buf) - - // convert to little endian - // TODO(gri) go/constant should have a more direct conversion function - // (e.g., once it supports a big.Float based implementation) - for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 { - buf[i], buf[j] = buf[j], buf[i] - } - - x := constant.MakeFromBytes(buf) - if signed && n&1 != 0 { - x = constant.UnaryOp(token.SUB, x, 0) - } - return x -} - -func (r *importReader) mpfloat(b *types.Basic) constant.Value { - x := r.mpint(b) - if constant.Sign(x) == 0 { - return x - } - - exp := r.int64() - switch { - case exp > 0: - x = constant.Shift(x, token.SHL, uint(exp)) - case exp < 0: - d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) - x = constant.BinaryOp(x, token.QUO, d) - } - return x -} - -func (r *importReader) ident() string { - return r.string() -} - -func (r *importReader) qualifiedIdent() (*types.Package, string) { - name := r.string() - pkg := r.pkg() - return pkg, name -} - -func (r *importReader) pos() token.Pos { - delta := r.int64() - if delta != deltaNewFile { - r.prevLine += delta - } else if l := r.int64(); l == -1 { - r.prevLine += deltaNewFile - } else { - r.prevFile = r.string() - r.prevLine = l - } - - if r.prevFile == "" && r.prevLine == 0 { - return token.NoPos - } - - return r.p.fake.pos(r.prevFile, int(r.prevLine)) -} - -func (r *importReader) typ() types.Type { - return r.p.typAt(r.uint64(), nil) -} - -func isInterface(t types.Type) bool { - _, ok := t.(*types.Interface) - return ok -} - -func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) } -func (r *importReader) string() string { return r.p.stringAt(r.uint64()) } - -func (r *importReader) doType(base *types.Named) types.Type { - switch k := r.kind(); k { - default: - errorf("unexpected kind tag in %q: %v", r.p.ipath, k) - return nil - - case definedType: - pkg, name := r.qualifiedIdent() - r.p.doDecl(pkg, name) - return pkg.Scope().Lookup(name).(*types.TypeName).Type() - case pointerType: - return types.NewPointer(r.typ()) - case sliceType: - return types.NewSlice(r.typ()) - case arrayType: - n := r.uint64() - return types.NewArray(r.typ(), int64(n)) - case chanType: - dir := chanDir(int(r.uint64())) - return types.NewChan(dir, r.typ()) - case mapType: - return types.NewMap(r.typ(), r.typ()) - case signatureType: - r.currPkg = r.pkg() - return r.signature(nil) - - case structType: - r.currPkg = r.pkg() - - fields := make([]*types.Var, r.uint64()) - tags := make([]string, len(fields)) - for i := range fields { - fpos := r.pos() - fname := r.ident() - ftyp := r.typ() - emb := r.bool() - tag := r.string() - - fields[i] = types.NewField(fpos, r.currPkg, fname, ftyp, emb) - tags[i] = tag - } - return types.NewStruct(fields, tags) - - case interfaceType: - r.currPkg = r.pkg() - - embeddeds := make([]types.Type, r.uint64()) - for i := range embeddeds { - _ = r.pos() - embeddeds[i] = r.typ() - } - - methods := make([]*types.Func, r.uint64()) - for i := range methods { - mpos := r.pos() - mname := r.ident() - - // TODO(mdempsky): Matches bimport.go, but I - // don't agree with this. - var recv *types.Var - if base != nil { - recv = types.NewVar(token.NoPos, r.currPkg, "", base) - } - - msig := r.signature(recv) - methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig) - } - - typ := newInterface(methods, embeddeds) - r.p.interfaceList = append(r.p.interfaceList, typ) - return typ - } -} - -func (r *importReader) kind() itag { - return itag(r.uint64()) -} - -func (r *importReader) signature(recv *types.Var) *types.Signature { - params := r.paramList() - results := r.paramList() - variadic := params.Len() > 0 && r.bool() - return types.NewSignature(recv, params, results, variadic) -} - -func (r *importReader) paramList() *types.Tuple { - xs := make([]*types.Var, r.uint64()) - for i := range xs { - xs[i] = r.param() - } - return types.NewTuple(xs...) -} - -func (r *importReader) param() *types.Var { - pos := r.pos() - name := r.ident() - typ := r.typ() - return types.NewParam(pos, r.currPkg, name, typ) -} - -func (r *importReader) bool() bool { - return r.uint64() != 0 -} - -func (r *importReader) int64() int64 { - n, err := binary.ReadVarint(&r.declReader) - if err != nil { - errorf("readVarint: %v", err) - } - return n -} - -func (r *importReader) uint64() uint64 { - n, err := binary.ReadUvarint(&r.declReader) - if err != nil { - errorf("readUvarint: %v", err) - } - return n -} - -func (r *importReader) byte() byte { - x, err := r.declReader.ReadByte() - if err != nil { - errorf("declReader.ReadByte: %v", err) - } - return x -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go deleted file mode 100644 index 463f2522..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.11 - -package gcimporter - -import "go/types" - -func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { - named := make([]*types.Named, len(embeddeds)) - for i, e := range embeddeds { - var ok bool - named[i], ok = e.(*types.Named) - if !ok { - panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11") - } - } - return types.NewInterface(methods, named) -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go deleted file mode 100644 index ab28b95c..00000000 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.11 - -package gcimporter - -import "go/types" - -func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { - return types.NewInterfaceType(methods, embeddeds) -} diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go deleted file mode 100644 index fdc7da05..00000000 --- a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package packagesdriver fetches type sizes for go/packages and go/analysis. -package packagesdriver - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "go/types" - "log" - "os" - "os/exec" - "strings" - "time" -) - -var debug = false - -// GetSizes returns the sizes used by the underlying driver with the given parameters. -func GetSizes(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) { - // TODO(matloob): Clean this up. This code is mostly a copy of packages.findExternalDriver. - const toolPrefix = "GOPACKAGESDRIVER=" - tool := "" - for _, env := range env { - if val := strings.TrimPrefix(env, toolPrefix); val != env { - tool = val - } - } - - if tool == "" { - var err error - tool, err = exec.LookPath("gopackagesdriver") - if err != nil { - // We did not find the driver, so use "go list". - tool = "off" - } - } - - if tool == "off" { - return GetSizesGolist(ctx, buildFlags, env, dir, usesExportData) - } - - req, err := json.Marshal(struct { - Command string `json:"command"` - Env []string `json:"env"` - BuildFlags []string `json:"build_flags"` - }{ - Command: "sizes", - Env: env, - BuildFlags: buildFlags, - }) - if err != nil { - return nil, fmt.Errorf("failed to encode message to driver tool: %v", err) - } - - buf := new(bytes.Buffer) - cmd := exec.CommandContext(ctx, tool) - cmd.Dir = dir - cmd.Env = env - cmd.Stdin = bytes.NewReader(req) - cmd.Stdout = buf - cmd.Stderr = new(bytes.Buffer) - if err := cmd.Run(); err != nil { - return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr) - } - var response struct { - // Sizes, if not nil, is the types.Sizes to use when type checking. - Sizes *types.StdSizes - } - if err := json.Unmarshal(buf.Bytes(), &response); err != nil { - return nil, err - } - return response.Sizes, nil -} - -func GetSizesGolist(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) { - args := []string{"list", "-f", "{{context.GOARCH}} {{context.Compiler}}"} - args = append(args, buildFlags...) - args = append(args, "--", "unsafe") - stdout, err := InvokeGo(ctx, env, dir, usesExportData, args...) - if err != nil { - return nil, err - } - fields := strings.Fields(stdout.String()) - if len(fields) < 2 { - return nil, fmt.Errorf("could not determine GOARCH and Go compiler") - } - goarch := fields[0] - compiler := fields[1] - return types.SizesFor(compiler, goarch), nil -} - -// InvokeGo returns the stdout of a go command invocation. -func InvokeGo(ctx context.Context, env []string, dir string, usesExportData bool, args ...string) (*bytes.Buffer, error) { - if debug { - defer func(start time.Time) { log.Printf("%s for %v", time.Since(start), cmdDebugStr(env, args...)) }(time.Now()) - } - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - cmd := exec.CommandContext(ctx, "go", args...) - // On darwin the cwd gets resolved to the real path, which breaks anything that - // expects the working directory to keep the original path, including the - // go command when dealing with modules. - // The Go stdlib has a special feature where if the cwd and the PWD are the - // same node then it trusts the PWD, so by setting it in the env for the child - // process we fix up all the paths returned by the go command. - cmd.Env = append(append([]string{}, env...), "PWD="+dir) - cmd.Dir = dir - cmd.Stdout = stdout - cmd.Stderr = stderr - if err := cmd.Run(); err != nil { - exitErr, ok := err.(*exec.ExitError) - if !ok { - // Catastrophic error: - // - executable not found - // - context cancellation - return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err) - } - - // Export mode entails a build. - // If that build fails, errors appear on stderr - // (despite the -e flag) and the Export field is blank. - // Do not fail in that case. - if !usesExportData { - return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) - } - } - - // As of writing, go list -export prints some non-fatal compilation - // errors to stderr, even with -e set. We would prefer that it put - // them in the Package.Error JSON (see https://golang.org/issue/26319). - // In the meantime, there's nowhere good to put them, but they can - // be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS - // is set. - if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" { - fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(env, args...), stderr) - } - - // debugging - if false { - fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(env, args...), stdout) - } - - return stdout, nil -} - -func cmdDebugStr(envlist []string, args ...string) string { - env := make(map[string]string) - for _, kv := range envlist { - split := strings.Split(kv, "=") - k, v := split[0], split[1] - env[k] = v - } - - return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], args) -} diff --git a/vendor/golang.org/x/tools/go/packages/doc.go b/vendor/golang.org/x/tools/go/packages/doc.go deleted file mode 100644 index 3799f8ed..00000000 --- a/vendor/golang.org/x/tools/go/packages/doc.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package packages loads Go packages for inspection and analysis. - -The Load function takes as input a list of patterns and return a list of Package -structs describing individual packages matched by those patterns. -The LoadMode controls the amount of detail in the loaded packages. - -Load passes most patterns directly to the underlying build tool, -but all patterns with the prefix "query=", where query is a -non-empty string of letters from [a-z], are reserved and may be -interpreted as query operators. - -Two query operators are currently supported: "file" and "pattern". - -The query "file=path/to/file.go" matches the package or packages enclosing -the Go source file path/to/file.go. For example "file=~/go/src/fmt/print.go" -might return the packages "fmt" and "fmt [fmt.test]". - -The query "pattern=string" causes "string" to be passed directly to -the underlying build tool. In most cases this is unnecessary, -but an application can use Load("pattern=" + x) as an escaping mechanism -to ensure that x is not interpreted as a query operator if it contains '='. - -All other query operators are reserved for future use and currently -cause Load to report an error. - -The Package struct provides basic information about the package, including - - - ID, a unique identifier for the package in the returned set; - - GoFiles, the names of the package's Go source files; - - Imports, a map from source import strings to the Packages they name; - - Types, the type information for the package's exported symbols; - - Syntax, the parsed syntax trees for the package's source code; and - - TypeInfo, the result of a complete type-check of the package syntax trees. - -(See the documentation for type Package for the complete list of fields -and more detailed descriptions.) - -For example, - - Load(nil, "bytes", "unicode...") - -returns four Package structs describing the standard library packages -bytes, unicode, unicode/utf16, and unicode/utf8. Note that one pattern -can match multiple packages and that a package might be matched by -multiple patterns: in general it is not possible to determine which -packages correspond to which patterns. - -Note that the list returned by Load contains only the packages matched -by the patterns. Their dependencies can be found by walking the import -graph using the Imports fields. - -The Load function can be configured by passing a pointer to a Config as -the first argument. A nil Config is equivalent to the zero Config, which -causes Load to run in LoadFiles mode, collecting minimal information. -See the documentation for type Config for details. - -As noted earlier, the Config.Mode controls the amount of detail -reported about the loaded packages, with each mode returning all the data of the -previous mode with some extra added. See the documentation for type LoadMode -for details. - -Most tools should pass their command-line arguments (after any flags) -uninterpreted to the loader, so that the loader can interpret them -according to the conventions of the underlying build system. -See the Example function for typical usage. - -*/ -package packages // import "golang.org/x/tools/go/packages" - -/* - -Motivation and design considerations - -The new package's design solves problems addressed by two existing -packages: go/build, which locates and describes packages, and -golang.org/x/tools/go/loader, which loads, parses and type-checks them. -The go/build.Package structure encodes too much of the 'go build' way -of organizing projects, leaving us in need of a data type that describes a -package of Go source code independent of the underlying build system. -We wanted something that works equally well with go build and vgo, and -also other build systems such as Bazel and Blaze, making it possible to -construct analysis tools that work in all these environments. -Tools such as errcheck and staticcheck were essentially unavailable to -the Go community at Google, and some of Google's internal tools for Go -are unavailable externally. -This new package provides a uniform way to obtain package metadata by -querying each of these build systems, optionally supporting their -preferred command-line notations for packages, so that tools integrate -neatly with users' build environments. The Metadata query function -executes an external query tool appropriate to the current workspace. - -Loading packages always returns the complete import graph "all the way down", -even if all you want is information about a single package, because the query -mechanisms of all the build systems we currently support ({go,vgo} list, and -blaze/bazel aspect-based query) cannot provide detailed information -about one package without visiting all its dependencies too, so there is -no additional asymptotic cost to providing transitive information. -(This property might not be true of a hypothetical 5th build system.) - -In calls to TypeCheck, all initial packages, and any package that -transitively depends on one of them, must be loaded from source. -Consider A->B->C->D->E: if A,C are initial, A,B,C must be loaded from -source; D may be loaded from export data, and E may not be loaded at all -(though it's possible that D's export data mentions it, so a -types.Package may be created for it and exposed.) - -The old loader had a feature to suppress type-checking of function -bodies on a per-package basis, primarily intended to reduce the work of -obtaining type information for imported packages. Now that imports are -satisfied by export data, the optimization no longer seems necessary. - -Despite some early attempts, the old loader did not exploit export data, -instead always using the equivalent of WholeProgram mode. This was due -to the complexity of mixing source and export data packages (now -resolved by the upward traversal mentioned above), and because export data -files were nearly always missing or stale. Now that 'go build' supports -caching, all the underlying build systems can guarantee to produce -export data in a reasonable (amortized) time. - -Test "main" packages synthesized by the build system are now reported as -first-class packages, avoiding the need for clients (such as go/ssa) to -reinvent this generation logic. - -One way in which go/packages is simpler than the old loader is in its -treatment of in-package tests. In-package tests are packages that -consist of all the files of the library under test, plus the test files. -The old loader constructed in-package tests by a two-phase process of -mutation called "augmentation": first it would construct and type check -all the ordinary library packages and type-check the packages that -depend on them; then it would add more (test) files to the package and -type-check again. This two-phase approach had four major problems: -1) in processing the tests, the loader modified the library package, - leaving no way for a client application to see both the test - package and the library package; one would mutate into the other. -2) because test files can declare additional methods on types defined in - the library portion of the package, the dispatch of method calls in - the library portion was affected by the presence of the test files. - This should have been a clue that the packages were logically - different. -3) this model of "augmentation" assumed at most one in-package test - per library package, which is true of projects using 'go build', - but not other build systems. -4) because of the two-phase nature of test processing, all packages that - import the library package had to be processed before augmentation, - forcing a "one-shot" API and preventing the client from calling Load - in several times in sequence as is now possible in WholeProgram mode. - (TypeCheck mode has a similar one-shot restriction for a different reason.) - -Early drafts of this package supported "multi-shot" operation. -Although it allowed clients to make a sequence of calls (or concurrent -calls) to Load, building up the graph of Packages incrementally, -it was of marginal value: it complicated the API -(since it allowed some options to vary across calls but not others), -it complicated the implementation, -it cannot be made to work in Types mode, as explained above, -and it was less efficient than making one combined call (when this is possible). -Among the clients we have inspected, none made multiple calls to load -but could not be easily and satisfactorily modified to make only a single call. -However, applications changes may be required. -For example, the ssadump command loads the user-specified packages -and in addition the runtime package. It is tempting to simply append -"runtime" to the user-provided list, but that does not work if the user -specified an ad-hoc package such as [a.go b.go]. -Instead, ssadump no longer requests the runtime package, -but seeks it among the dependencies of the user-specified packages, -and emits an error if it is not found. - -Overlays: The Overlay field in the Config allows providing alternate contents -for Go source files, by providing a mapping from file path to contents. -go/packages will pull in new imports added in overlay files when go/packages -is run in LoadImports mode or greater. -Overlay support for the go list driver isn't complete yet: if the file doesn't -exist on disk, it will only be recognized in an overlay if it is a non-test file -and the package would be reported even without the overlay. - -Questions & Tasks - -- Add GOARCH/GOOS? - They are not portable concepts, but could be made portable. - Our goal has been to allow users to express themselves using the conventions - of the underlying build system: if the build system honors GOARCH - during a build and during a metadata query, then so should - applications built atop that query mechanism. - Conversely, if the target architecture of the build is determined by - command-line flags, the application can pass the relevant - flags through to the build system using a command such as: - myapp -query_flag="--cpu=amd64" -query_flag="--os=darwin" - However, this approach is low-level, unwieldy, and non-portable. - GOOS and GOARCH seem important enough to warrant a dedicated option. - -- How should we handle partial failures such as a mixture of good and - malformed patterns, existing and non-existent packages, successful and - failed builds, import failures, import cycles, and so on, in a call to - Load? - -- Support bazel, blaze, and go1.10 list, not just go1.11 list. - -- Handle (and test) various partial success cases, e.g. - a mixture of good packages and: - invalid patterns - nonexistent packages - empty packages - packages with malformed package or import declarations - unreadable files - import cycles - other parse errors - type errors - Make sure we record errors at the correct place in the graph. - -- Missing packages among initial arguments are not reported. - Return bogus packages for them, like golist does. - -- "undeclared name" errors (for example) are reported out of source file - order. I suspect this is due to the breadth-first resolution now used - by go/types. Is that a bug? Discuss with gri. - -*/ diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go deleted file mode 100644 index 22ff769e..00000000 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file enables an external tool to intercept package requests. -// If the tool is present then its results are used in preference to -// the go list command. - -package packages - -import ( - "bytes" - "encoding/json" - "fmt" - "os/exec" - "strings" -) - -// Driver -type driverRequest struct { - Command string `json:"command"` - Mode LoadMode `json:"mode"` - Env []string `json:"env"` - BuildFlags []string `json:"build_flags"` - Tests bool `json:"tests"` - Overlay map[string][]byte `json:"overlay"` -} - -// findExternalDriver returns the file path of a tool that supplies -// the build system package structure, or "" if not found." -// If GOPACKAGESDRIVER is set in the environment findExternalTool returns its -// value, otherwise it searches for a binary named gopackagesdriver on the PATH. -func findExternalDriver(cfg *Config) driver { - const toolPrefix = "GOPACKAGESDRIVER=" - tool := "" - for _, env := range cfg.Env { - if val := strings.TrimPrefix(env, toolPrefix); val != env { - tool = val - } - } - if tool != "" && tool == "off" { - return nil - } - if tool == "" { - var err error - tool, err = exec.LookPath("gopackagesdriver") - if err != nil { - return nil - } - } - return func(cfg *Config, words ...string) (*driverResponse, error) { - req, err := json.Marshal(driverRequest{ - Mode: cfg.Mode, - Env: cfg.Env, - BuildFlags: cfg.BuildFlags, - Tests: cfg.Tests, - Overlay: cfg.Overlay, - }) - if err != nil { - return nil, fmt.Errorf("failed to encode message to driver tool: %v", err) - } - - buf := new(bytes.Buffer) - cmd := exec.CommandContext(cfg.Context, tool, words...) - cmd.Dir = cfg.Dir - cmd.Env = cfg.Env - cmd.Stdin = bytes.NewReader(req) - cmd.Stdout = buf - cmd.Stderr = new(bytes.Buffer) - if err := cmd.Run(); err != nil { - return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr) - } - var response driverResponse - if err := json.Unmarshal(buf.Bytes(), &response); err != nil { - return nil, err - } - return &response, nil - } -} diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go deleted file mode 100644 index 2d30457e..00000000 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ /dev/null @@ -1,866 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packages - -import ( - "bytes" - "encoding/json" - "fmt" - "go/types" - "io/ioutil" - "log" - "os" - "os/exec" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/tools/go/internal/packagesdriver" - "golang.org/x/tools/internal/gopathwalk" - "golang.org/x/tools/internal/semver" -) - -// debug controls verbose logging. -var debug, _ = strconv.ParseBool(os.Getenv("GOPACKAGESDEBUG")) - -// A goTooOldError reports that the go command -// found by exec.LookPath is too old to use the new go list behavior. -type goTooOldError struct { - error -} - -// responseDeduper wraps a driverResponse, deduplicating its contents. -type responseDeduper struct { - seenRoots map[string]bool - seenPackages map[string]*Package - dr *driverResponse -} - -// init fills in r with a driverResponse. -func (r *responseDeduper) init(dr *driverResponse) { - r.dr = dr - r.seenRoots = map[string]bool{} - r.seenPackages = map[string]*Package{} - for _, pkg := range dr.Packages { - r.seenPackages[pkg.ID] = pkg - } - for _, root := range dr.Roots { - r.seenRoots[root] = true - } -} - -func (r *responseDeduper) addPackage(p *Package) { - if r.seenPackages[p.ID] != nil { - return - } - r.seenPackages[p.ID] = p - r.dr.Packages = append(r.dr.Packages, p) -} - -func (r *responseDeduper) addRoot(id string) { - if r.seenRoots[id] { - return - } - r.seenRoots[id] = true - r.dr.Roots = append(r.dr.Roots, id) -} - -// goListDriver uses the go list command to interpret the patterns and produce -// the build system package structure. -// See driver for more details. -func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { - var sizes types.Sizes - var sizeserr error - var sizeswg sync.WaitGroup - if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 { - sizeswg.Add(1) - go func() { - sizes, sizeserr = getSizes(cfg) - sizeswg.Done() - }() - } - - // Determine files requested in contains patterns - var containFiles []string - var packagesNamed []string - restPatterns := make([]string, 0, len(patterns)) - // Extract file= and other [querytype]= patterns. Report an error if querytype - // doesn't exist. -extractQueries: - for _, pattern := range patterns { - eqidx := strings.Index(pattern, "=") - if eqidx < 0 { - restPatterns = append(restPatterns, pattern) - } else { - query, value := pattern[:eqidx], pattern[eqidx+len("="):] - switch query { - case "file": - containFiles = append(containFiles, value) - case "pattern": - restPatterns = append(restPatterns, value) - case "iamashamedtousethedisabledqueryname": - packagesNamed = append(packagesNamed, value) - case "": // not a reserved query - restPatterns = append(restPatterns, pattern) - default: - for _, rune := range query { - if rune < 'a' || rune > 'z' { // not a reserved query - restPatterns = append(restPatterns, pattern) - continue extractQueries - } - } - // Reject all other patterns containing "=" - return nil, fmt.Errorf("invalid query type %q in query pattern %q", query, pattern) - } - } - } - - response := &responseDeduper{} - var err error - - // See if we have any patterns to pass through to go list. Zero initial - // patterns also requires a go list call, since it's the equivalent of - // ".". - if len(restPatterns) > 0 || len(patterns) == 0 { - dr, err := golistDriver(cfg, restPatterns...) - if err != nil { - return nil, err - } - response.init(dr) - } else { - response.init(&driverResponse{}) - } - - sizeswg.Wait() - if sizeserr != nil { - return nil, sizeserr - } - // types.SizesFor always returns nil or a *types.StdSizes - response.dr.Sizes, _ = sizes.(*types.StdSizes) - - var containsCandidates []string - - if len(containFiles) != 0 { - if err := runContainsQueries(cfg, golistDriver, response, containFiles); err != nil { - return nil, err - } - } - - if len(packagesNamed) != 0 { - if err := runNamedQueries(cfg, golistDriver, response, packagesNamed); err != nil { - return nil, err - } - } - - modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response.dr) - if err != nil { - return nil, err - } - if len(containFiles) > 0 { - containsCandidates = append(containsCandidates, modifiedPkgs...) - containsCandidates = append(containsCandidates, needPkgs...) - } - if err := addNeededOverlayPackages(cfg, golistDriver, response, needPkgs); err != nil { - return nil, err - } - // Check candidate packages for containFiles. - if len(containFiles) > 0 { - for _, id := range containsCandidates { - pkg, ok := response.seenPackages[id] - if !ok { - response.addPackage(&Package{ - ID: id, - Errors: []Error{ - { - Kind: ListError, - Msg: fmt.Sprintf("package %s expected but not seen", id), - }, - }, - }) - continue - } - for _, f := range containFiles { - for _, g := range pkg.GoFiles { - if sameFile(f, g) { - response.addRoot(id) - } - } - } - } - } - - return response.dr, nil -} - -func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string) error { - if len(pkgs) == 0 { - return nil - } - dr, err := driver(cfg, pkgs...) - if err != nil { - return err - } - for _, pkg := range dr.Packages { - response.addPackage(pkg) - } - _, needPkgs, err := processGolistOverlay(cfg, response.dr) - if err != nil { - return err - } - addNeededOverlayPackages(cfg, driver, response, needPkgs) - return nil -} - -func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error { - for _, query := range queries { - // TODO(matloob): Do only one query per directory. - fdir := filepath.Dir(query) - // Pass absolute path of directory to go list so that it knows to treat it as a directory, - // not a package path. - pattern, err := filepath.Abs(fdir) - if err != nil { - return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err) - } - dirResponse, err := driver(cfg, pattern) - if err != nil { - // Couldn't find a package for the directory. Try to load the file as an ad-hoc package. - var queryErr error - dirResponse, err = driver(cfg, query) - if queryErr != nil { - // Return the original error if the attempt to fall back failed. - return err - } - } - isRoot := make(map[string]bool, len(dirResponse.Roots)) - for _, root := range dirResponse.Roots { - isRoot[root] = true - } - for _, pkg := range dirResponse.Packages { - // Add any new packages to the main set - // We don't bother to filter packages that will be dropped by the changes of roots, - // that will happen anyway during graph construction outside this function. - // Over-reporting packages is not a problem. - response.addPackage(pkg) - // if the package was not a root one, it cannot have the file - if !isRoot[pkg.ID] { - continue - } - for _, pkgFile := range pkg.GoFiles { - if filepath.Base(query) == filepath.Base(pkgFile) { - response.addRoot(pkg.ID) - break - } - } - } - } - return nil -} - -// modCacheRegexp splits a path in a module cache into module, module version, and package. -var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) - -func runNamedQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error { - // calling `go env` isn't free; bail out if there's nothing to do. - if len(queries) == 0 { - return nil - } - // Determine which directories are relevant to scan. - roots, modRoot, err := roots(cfg) - if err != nil { - return err - } - - // Scan the selected directories. Simple matches, from GOPATH/GOROOT - // or the local module, can simply be "go list"ed. Matches from the - // module cache need special treatment. - var matchesMu sync.Mutex - var simpleMatches, modCacheMatches []string - add := func(root gopathwalk.Root, dir string) { - // Walk calls this concurrently; protect the result slices. - matchesMu.Lock() - defer matchesMu.Unlock() - - path := dir - if dir != root.Path { - path = dir[len(root.Path)+1:] - } - if pathMatchesQueries(path, queries) { - switch root.Type { - case gopathwalk.RootModuleCache: - modCacheMatches = append(modCacheMatches, path) - case gopathwalk.RootCurrentModule: - // We'd need to read go.mod to find the full - // import path. Relative's easier. - rel, err := filepath.Rel(cfg.Dir, dir) - if err != nil { - // This ought to be impossible, since - // we found dir in the current module. - panic(err) - } - simpleMatches = append(simpleMatches, "./"+rel) - case gopathwalk.RootGOPATH, gopathwalk.RootGOROOT: - simpleMatches = append(simpleMatches, path) - } - } - } - - startWalk := time.Now() - gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modRoot != "", Debug: debug}) - if debug { - log.Printf("%v for walk", time.Since(startWalk)) - } - - // Weird special case: the top-level package in a module will be in - // whatever directory the user checked the repository out into. It's - // more reasonable for that to not match the package name. So, if there - // are any Go files in the mod root, query it just to be safe. - if modRoot != "" { - rel, err := filepath.Rel(cfg.Dir, modRoot) - if err != nil { - panic(err) // See above. - } - - files, err := ioutil.ReadDir(modRoot) - for _, f := range files { - if strings.HasSuffix(f.Name(), ".go") { - simpleMatches = append(simpleMatches, rel) - break - } - } - } - - addResponse := func(r *driverResponse) { - for _, pkg := range r.Packages { - response.addPackage(pkg) - for _, name := range queries { - if pkg.Name == name { - response.addRoot(pkg.ID) - break - } - } - } - } - - if len(simpleMatches) != 0 { - resp, err := driver(cfg, simpleMatches...) - if err != nil { - return err - } - addResponse(resp) - } - - // Module cache matches are tricky. We want to avoid downloading new - // versions of things, so we need to use the ones present in the cache. - // go list doesn't accept version specifiers, so we have to write out a - // temporary module, and do the list in that module. - if len(modCacheMatches) != 0 { - // Collect all the matches, deduplicating by major version - // and preferring the newest. - type modInfo struct { - mod string - major string - } - mods := make(map[modInfo]string) - var imports []string - for _, modPath := range modCacheMatches { - matches := modCacheRegexp.FindStringSubmatch(modPath) - mod, ver := filepath.ToSlash(matches[1]), matches[2] - importPath := filepath.ToSlash(filepath.Join(matches[1], matches[3])) - - major := semver.Major(ver) - if prevVer, ok := mods[modInfo{mod, major}]; !ok || semver.Compare(ver, prevVer) > 0 { - mods[modInfo{mod, major}] = ver - } - - imports = append(imports, importPath) - } - - // Build the temporary module. - var gomod bytes.Buffer - gomod.WriteString("module modquery\nrequire (\n") - for mod, version := range mods { - gomod.WriteString("\t" + mod.mod + " " + version + "\n") - } - gomod.WriteString(")\n") - - tmpCfg := *cfg - - // We're only trying to look at stuff in the module cache, so - // disable the network. This should speed things up, and has - // prevented errors in at least one case, #28518. - tmpCfg.Env = append(append([]string{"GOPROXY=off"}, cfg.Env...)) - - var err error - tmpCfg.Dir, err = ioutil.TempDir("", "gopackages-modquery") - if err != nil { - return err - } - defer os.RemoveAll(tmpCfg.Dir) - - if err := ioutil.WriteFile(filepath.Join(tmpCfg.Dir, "go.mod"), gomod.Bytes(), 0777); err != nil { - return fmt.Errorf("writing go.mod for module cache query: %v", err) - } - - // Run the query, using the import paths calculated from the matches above. - resp, err := driver(&tmpCfg, imports...) - if err != nil { - return fmt.Errorf("querying module cache matches: %v", err) - } - addResponse(resp) - } - - return nil -} - -func getSizes(cfg *Config) (types.Sizes, error) { - return packagesdriver.GetSizesGolist(cfg.Context, cfg.BuildFlags, cfg.Env, cfg.Dir, usesExportData(cfg)) -} - -// roots selects the appropriate paths to walk based on the passed-in configuration, -// particularly the environment and the presence of a go.mod in cfg.Dir's parents. -func roots(cfg *Config) ([]gopathwalk.Root, string, error) { - stdout, err := invokeGo(cfg, "env", "GOROOT", "GOPATH", "GOMOD") - if err != nil { - return nil, "", err - } - - fields := strings.Split(stdout.String(), "\n") - if len(fields) != 4 || len(fields[3]) != 0 { - return nil, "", fmt.Errorf("go env returned unexpected output: %q", stdout.String()) - } - goroot, gopath, gomod := fields[0], filepath.SplitList(fields[1]), fields[2] - var modDir string - if gomod != "" { - modDir = filepath.Dir(gomod) - } - - var roots []gopathwalk.Root - // Always add GOROOT. - roots = append(roots, gopathwalk.Root{filepath.Join(goroot, "/src"), gopathwalk.RootGOROOT}) - // If modules are enabled, scan the module dir. - if modDir != "" { - roots = append(roots, gopathwalk.Root{modDir, gopathwalk.RootCurrentModule}) - } - // Add either GOPATH/src or GOPATH/pkg/mod, depending on module mode. - for _, p := range gopath { - if modDir != "" { - roots = append(roots, gopathwalk.Root{filepath.Join(p, "/pkg/mod"), gopathwalk.RootModuleCache}) - } else { - roots = append(roots, gopathwalk.Root{filepath.Join(p, "/src"), gopathwalk.RootGOPATH}) - } - } - - return roots, modDir, nil -} - -// These functions were copied from goimports. See further documentation there. - -// pathMatchesQueries is adapted from pkgIsCandidate. -// TODO: is it reasonable to do Contains here, rather than an exact match on a path component? -func pathMatchesQueries(path string, queries []string) bool { - lastTwo := lastTwoComponents(path) - for _, query := range queries { - if strings.Contains(lastTwo, query) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(query) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, query) { - return true - } - } - } - return false -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) -} - -// Fields must match go list; -// see $GOROOT/src/cmd/go/internal/load/pkg.go. -type jsonPackage struct { - ImportPath string - Dir string - Name string - Export string - GoFiles []string - CompiledGoFiles []string - CFiles []string - CgoFiles []string - CXXFiles []string - MFiles []string - HFiles []string - FFiles []string - SFiles []string - SwigFiles []string - SwigCXXFiles []string - SysoFiles []string - Imports []string - ImportMap map[string]string - Deps []string - TestGoFiles []string - TestImports []string - XTestGoFiles []string - XTestImports []string - ForTest string // q in a "p [q.test]" package, else "" - DepOnly bool - - Error *jsonPackageError -} - -type jsonPackageError struct { - ImportStack []string - Pos string - Err string -} - -func otherFiles(p *jsonPackage) [][]string { - return [][]string{p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.SwigFiles, p.SwigCXXFiles, p.SysoFiles} -} - -// golistDriver uses the "go list" command to expand the pattern -// words and return metadata for the specified packages. dir may be -// "" and env may be nil, as per os/exec.Command. -func golistDriver(cfg *Config, words ...string) (*driverResponse, error) { - // go list uses the following identifiers in ImportPath and Imports: - // - // "p" -- importable package or main (command) - // "q.test" -- q's test executable - // "p [q.test]" -- variant of p as built for q's test executable - // "q_test [q.test]" -- q's external test package - // - // The packages p that are built differently for a test q.test - // are q itself, plus any helpers used by the external test q_test, - // typically including "testing" and all its dependencies. - - // Run "go list" for complete - // information on the specified packages. - buf, err := invokeGo(cfg, golistargs(cfg, words)...) - if err != nil { - return nil, err - } - seen := make(map[string]*jsonPackage) - // Decode the JSON and convert it to Package form. - var response driverResponse - for dec := json.NewDecoder(buf); dec.More(); { - p := new(jsonPackage) - if err := dec.Decode(p); err != nil { - return nil, fmt.Errorf("JSON decoding failed: %v", err) - } - - if p.ImportPath == "" { - // The documentation for go list says that “[e]rroneous packages will have - // a non-empty ImportPath”. If for some reason it comes back empty, we - // prefer to error out rather than silently discarding data or handing - // back a package without any way to refer to it. - if p.Error != nil { - return nil, Error{ - Pos: p.Error.Pos, - Msg: p.Error.Err, - } - } - return nil, fmt.Errorf("package missing import path: %+v", p) - } - - if old, found := seen[p.ImportPath]; found { - if !reflect.DeepEqual(p, old) { - return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath) - } - // skip the duplicate - continue - } - seen[p.ImportPath] = p - - pkg := &Package{ - Name: p.Name, - ID: p.ImportPath, - GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles), - CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles), - OtherFiles: absJoin(p.Dir, otherFiles(p)...), - } - - // Work around https://golang.org/issue/28749: - // cmd/go puts assembly, C, and C++ files in CompiledGoFiles. - // Filter out any elements of CompiledGoFiles that are also in OtherFiles. - // We have to keep this workaround in place until go1.12 is a distant memory. - if len(pkg.OtherFiles) > 0 { - other := make(map[string]bool, len(pkg.OtherFiles)) - for _, f := range pkg.OtherFiles { - other[f] = true - } - - out := pkg.CompiledGoFiles[:0] - for _, f := range pkg.CompiledGoFiles { - if other[f] { - continue - } - out = append(out, f) - } - pkg.CompiledGoFiles = out - } - - // Extract the PkgPath from the package's ID. - if i := strings.IndexByte(pkg.ID, ' '); i >= 0 { - pkg.PkgPath = pkg.ID[:i] - } else { - pkg.PkgPath = pkg.ID - } - - if pkg.PkgPath == "unsafe" { - pkg.GoFiles = nil // ignore fake unsafe.go file - } - - // Assume go list emits only absolute paths for Dir. - if p.Dir != "" && !filepath.IsAbs(p.Dir) { - log.Fatalf("internal error: go list returned non-absolute Package.Dir: %s", p.Dir) - } - - if p.Export != "" && !filepath.IsAbs(p.Export) { - pkg.ExportFile = filepath.Join(p.Dir, p.Export) - } else { - pkg.ExportFile = p.Export - } - - // imports - // - // Imports contains the IDs of all imported packages. - // ImportsMap records (path, ID) only where they differ. - ids := make(map[string]bool) - for _, id := range p.Imports { - ids[id] = true - } - pkg.Imports = make(map[string]*Package) - for path, id := range p.ImportMap { - pkg.Imports[path] = &Package{ID: id} // non-identity import - delete(ids, id) - } - for id := range ids { - if id == "C" { - continue - } - - pkg.Imports[id] = &Package{ID: id} // identity import - } - if !p.DepOnly { - response.Roots = append(response.Roots, pkg.ID) - } - - // Work around for pre-go.1.11 versions of go list. - // TODO(matloob): they should be handled by the fallback. - // Can we delete this? - if len(pkg.CompiledGoFiles) == 0 { - pkg.CompiledGoFiles = pkg.GoFiles - } - - if p.Error != nil { - pkg.Errors = append(pkg.Errors, Error{ - Pos: p.Error.Pos, - Msg: p.Error.Err, - }) - } - - response.Packages = append(response.Packages, pkg) - } - - return &response, nil -} - -// absJoin absolutizes and flattens the lists of files. -func absJoin(dir string, fileses ...[]string) (res []string) { - for _, files := range fileses { - for _, file := range files { - if !filepath.IsAbs(file) { - file = filepath.Join(dir, file) - } - res = append(res, file) - } - } - return res -} - -func golistargs(cfg *Config, words []string) []string { - const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo - fullargs := []string{ - "list", "-e", "-json", - fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypesInfo|NeedTypesSizes) != 0), - fmt.Sprintf("-test=%t", cfg.Tests), - fmt.Sprintf("-export=%t", usesExportData(cfg)), - fmt.Sprintf("-deps=%t", cfg.Mode&NeedDeps != 0), - // go list doesn't let you pass -test and -find together, - // probably because you'd just get the TestMain. - fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0), - } - fullargs = append(fullargs, cfg.BuildFlags...) - fullargs = append(fullargs, "--") - fullargs = append(fullargs, words...) - return fullargs -} - -// invokeGo returns the stdout of a go command invocation. -func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - cmd := exec.CommandContext(cfg.Context, "go", args...) - // On darwin the cwd gets resolved to the real path, which breaks anything that - // expects the working directory to keep the original path, including the - // go command when dealing with modules. - // The Go stdlib has a special feature where if the cwd and the PWD are the - // same node then it trusts the PWD, so by setting it in the env for the child - // process we fix up all the paths returned by the go command. - cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir) - cmd.Dir = cfg.Dir - cmd.Stdout = stdout - cmd.Stderr = stderr - if debug { - defer func(start time.Time) { - log.Printf("%s for %v, stderr: <<%s>>\n", time.Since(start), cmdDebugStr(cmd, args...), stderr) - }(time.Now()) - } - - if err := cmd.Run(); err != nil { - // Check for 'go' executable not being found. - if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound { - return nil, fmt.Errorf("'go list' driver requires 'go', but %s", exec.ErrNotFound) - } - - exitErr, ok := err.(*exec.ExitError) - if !ok { - // Catastrophic error: - // - context cancellation - return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err) - } - - // Old go version? - if strings.Contains(stderr.String(), "flag provided but not defined") { - return nil, goTooOldError{fmt.Errorf("unsupported version of go: %s: %s", exitErr, stderr)} - } - - // This error only appears in stderr. See golang.org/cl/166398 for a fix in go list to show - // the error in the Err section of stdout in case -e option is provided. - // This fix is provided for backwards compatibility. - if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "named files must be .go files") { - output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, - strings.Trim(stderr.String(), "\n")) - return bytes.NewBufferString(output), nil - } - - // Workaround for #29280: go list -e has incorrect behavior when an ad-hoc package doesn't exist. - if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no such file or directory") { - output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, - strings.Trim(stderr.String(), "\n")) - return bytes.NewBufferString(output), nil - } - - // Workaround for an instance of golang.org/issue/26755: go list -e will return a non-zero exit - // status if there's a dependency on a package that doesn't exist. But it should return - // a zero exit status and set an error on that package. - if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no Go files in") { - // try to extract package name from string - stderrStr := stderr.String() - var importPath string - colon := strings.Index(stderrStr, ":") - if colon > 0 && strings.HasPrefix(stderrStr, "go build ") { - importPath = stderrStr[len("go build "):colon] - } - output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, - importPath, strings.Trim(stderrStr, "\n")) - return bytes.NewBufferString(output), nil - } - - // Export mode entails a build. - // If that build fails, errors appear on stderr - // (despite the -e flag) and the Export field is blank. - // Do not fail in that case. - // The same is true if an ad-hoc package given to go list doesn't exist. - // TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when - // packages don't exist or a build fails. - if !usesExportData(cfg) && !containsGoFile(args) { - return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) - } - } - - // As of writing, go list -export prints some non-fatal compilation - // errors to stderr, even with -e set. We would prefer that it put - // them in the Package.Error JSON (see https://golang.org/issue/26319). - // In the meantime, there's nowhere good to put them, but they can - // be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS - // is set. - if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" { - fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd, args...), stderr) - } - - // debugging - if false { - fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(cmd, args...), stdout) - } - - return stdout, nil -} - -func containsGoFile(s []string) bool { - for _, f := range s { - if strings.HasSuffix(f, ".go") { - return true - } - } - return false -} - -func cmdDebugStr(cmd *exec.Cmd, args ...string) string { - env := make(map[string]string) - for _, kv := range cmd.Env { - split := strings.Split(kv, "=") - k, v := split[0], split[1] - env[k] = v - } - var quotedArgs []string - for _, arg := range args { - quotedArgs = append(quotedArgs, strconv.Quote(arg)) - } - - return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %s", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], strings.Join(quotedArgs, " ")) -} diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go deleted file mode 100644 index ce322ce5..00000000 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ /dev/null @@ -1,262 +0,0 @@ -package packages - -import ( - "bytes" - "encoding/json" - "go/parser" - "go/token" - "path" - "path/filepath" - "strconv" - "strings" - "sync" -) - -// processGolistOverlay provides rudimentary support for adding -// files that don't exist on disk to an overlay. The results can be -// sometimes incorrect. -// TODO(matloob): Handle unsupported cases, including the following: -// - test files -// - adding test and non-test files to test variants of packages -// - determining the correct package to add given a new import path -// - creating packages that don't exist -func processGolistOverlay(cfg *Config, response *driverResponse) (modifiedPkgs, needPkgs []string, err error) { - havePkgs := make(map[string]string) // importPath -> non-test package ID - needPkgsSet := make(map[string]bool) - modifiedPkgsSet := make(map[string]bool) - - for _, pkg := range response.Packages { - // This is an approximation of import path to id. This can be - // wrong for tests, vendored packages, and a number of other cases. - havePkgs[pkg.PkgPath] = pkg.ID - } - - var rootDirs map[string]string - var onceGetRootDirs sync.Once - - for opath, contents := range cfg.Overlay { - base := filepath.Base(opath) - if strings.HasSuffix(opath, "_test.go") { - // Overlays don't support adding new test files yet. - // TODO(matloob): support adding new test files. - continue - } - dir := filepath.Dir(opath) - var pkg *Package - var fileExists bool - for _, p := range response.Packages { - for _, f := range p.GoFiles { - if !sameFile(filepath.Dir(f), dir) { - continue - } - pkg = p - if filepath.Base(f) == base { - fileExists = true - } - } - } - // The overlay could have included an entirely new package. - if pkg == nil { - onceGetRootDirs.Do(func() { - rootDirs = determineRootDirs(cfg) - }) - // Try to find the module or gopath dir the file is contained in. - // Then for modules, add the module opath to the beginning. - var pkgPath string - for rdir, rpath := range rootDirs { - // TODO(matloob): This doesn't properly handle symlinks. - r, err := filepath.Rel(rdir, dir) - if err != nil { - continue - } - pkgPath = filepath.ToSlash(r) - if rpath != "" { - pkgPath = path.Join(rpath, pkgPath) - } - // We only create one new package even it can belong in multiple modules or GOPATH entries. - // This is okay because tools (such as the LSP) that use overlays will recompute the overlay - // once the file is saved, and golist will do the right thing. - // TODO(matloob): Implement module tiebreaking? - break - } - if pkgPath == "" { - continue - } - pkgName, ok := extractPackageName(opath, contents) - if !ok { - continue - } - id := pkgPath - // Try to reclaim a package with the same id if it exists in the response. - for _, p := range response.Packages { - if reclaimPackage(p, id, opath, contents) { - pkg = p - break - } - } - // Otherwise, create a new package - if pkg == nil { - pkg = &Package{PkgPath: pkgPath, ID: id, Name: pkgName, Imports: make(map[string]*Package)} - // TODO(matloob): Is it okay to amend response.Packages this way? - response.Packages = append(response.Packages, pkg) - havePkgs[pkg.PkgPath] = id - } - } - if !fileExists { - pkg.GoFiles = append(pkg.GoFiles, opath) - // TODO(matloob): Adding the file to CompiledGoFiles can exhibit the wrong behavior - // if the file will be ignored due to its build tags. - pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, opath) - modifiedPkgsSet[pkg.ID] = true - } - imports, err := extractImports(opath, contents) - if err != nil { - // Let the parser or type checker report errors later. - continue - } - for _, imp := range imports { - _, found := pkg.Imports[imp] - if !found { - // TODO(matloob): Handle cases when the following block isn't correct. - // These include imports of test variants, imports of vendored packages, etc. - id, ok := havePkgs[imp] - if !ok { - id = imp - } - pkg.Imports[imp] = &Package{ID: id} - } - } - continue - } - - // toPkgPath tries to guess the package path given the id. - // This isn't always correct -- it's certainly wrong for - // vendored packages' paths. - toPkgPath := func(id string) string { - // TODO(matloob): Handle vendor paths. - i := strings.IndexByte(id, ' ') - if i >= 0 { - return id[:i] - } - return id - } - - // Do another pass now that new packages have been created to determine the - // set of missing packages. - for _, pkg := range response.Packages { - for _, imp := range pkg.Imports { - pkgPath := toPkgPath(imp.ID) - if _, ok := havePkgs[pkgPath]; !ok { - needPkgsSet[pkgPath] = true - } - } - } - - needPkgs = make([]string, 0, len(needPkgsSet)) - for pkg := range needPkgsSet { - needPkgs = append(needPkgs, pkg) - } - modifiedPkgs = make([]string, 0, len(modifiedPkgsSet)) - for pkg := range modifiedPkgsSet { - modifiedPkgs = append(modifiedPkgs, pkg) - } - return modifiedPkgs, needPkgs, err -} - -// determineRootDirs returns a mapping from directories code can be contained in to the -// corresponding import path prefixes of those directories. -// Its result is used to try to determine the import path for a package containing -// an overlay file. -func determineRootDirs(cfg *Config) map[string]string { - // Assume modules first: - out, err := invokeGo(cfg, "list", "-m", "-json", "all") - if err != nil { - return determineRootDirsGOPATH(cfg) - } - m := map[string]string{} - type jsonMod struct{ Path, Dir string } - for dec := json.NewDecoder(out); dec.More(); { - mod := new(jsonMod) - if err := dec.Decode(mod); err != nil { - return m // Give up and return an empty map. Package won't be found for overlay. - } - if mod.Dir != "" && mod.Path != "" { - // This is a valid module; add it to the map. - m[mod.Dir] = mod.Path - } - } - return m -} - -func determineRootDirsGOPATH(cfg *Config) map[string]string { - m := map[string]string{} - out, err := invokeGo(cfg, "env", "GOPATH") - if err != nil { - // Could not determine root dir mapping. Everything is best-effort, so just return an empty map. - // When we try to find the import path for a directory, there will be no root-dir match and - // we'll give up. - return m - } - for _, p := range filepath.SplitList(string(bytes.TrimSpace(out.Bytes()))) { - m[filepath.Join(p, "src")] = "" - } - return m -} - -func extractImports(filename string, contents []byte) ([]string, error) { - f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.ImportsOnly) // TODO(matloob): reuse fileset? - if err != nil { - return nil, err - } - var res []string - for _, imp := range f.Imports { - quotedPath := imp.Path.Value - path, err := strconv.Unquote(quotedPath) - if err != nil { - return nil, err - } - res = append(res, path) - } - return res, nil -} - -// reclaimPackage attempts to reuse a package that failed to load in an overlay. -// -// If the package has errors and has no Name, GoFiles, or Imports, -// then it's possible that it doesn't yet exist on disk. -func reclaimPackage(pkg *Package, id string, filename string, contents []byte) bool { - // TODO(rstambler): Check the message of the actual error? - // It differs between $GOPATH and module mode. - if pkg.ID != id { - return false - } - if len(pkg.Errors) != 1 { - return false - } - if pkg.Name != "" || pkg.ExportFile != "" { - return false - } - if len(pkg.GoFiles) > 0 || len(pkg.CompiledGoFiles) > 0 || len(pkg.OtherFiles) > 0 { - return false - } - if len(pkg.Imports) > 0 { - return false - } - pkgName, ok := extractPackageName(filename, contents) - if !ok { - return false - } - pkg.Name = pkgName - pkg.Errors = nil - return true -} - -func extractPackageName(filename string, contents []byte) (string, bool) { - // TODO(rstambler): Check the message of the actual error? - // It differs between $GOPATH and module mode. - f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.PackageClauseOnly) // TODO(matloob): reuse fileset? - if err != nil { - return "", false - } - return f.Name.Name, true -} diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go deleted file mode 100644 index cd151469..00000000 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ /dev/null @@ -1,1071 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package packages - -// See doc.go for package documentation and implementation notes. - -import ( - "context" - "encoding/json" - "fmt" - "go/ast" - "go/parser" - "go/scanner" - "go/token" - "go/types" - "io/ioutil" - "log" - "os" - "path/filepath" - "strings" - "sync" - - "golang.org/x/tools/go/gcexportdata" -) - -// A LoadMode controls the amount of detail to return when loading. -// The bits below can be combined to specify which fields should be -// filled in the result packages. -// The zero value is a special case, equivalent to combining -// the NeedName, NeedFiles, and NeedCompiledGoFiles bits. -// ID and Errors (if present) will always be filled. -// Load may return more information than requested. -type LoadMode int - -const ( - // NeedName adds Name and PkgPath. - NeedName LoadMode = 1 << iota - - // NeedFiles adds GoFiles and OtherFiles. - NeedFiles - - // NeedCompiledGoFiles adds CompiledGoFiles. - NeedCompiledGoFiles - - // NeedImports adds Imports. If NeedDeps is not set, the Imports field will contain - // "placeholder" Packages with only the ID set. - NeedImports - - // NeedDeps adds the fields requested by the LoadMode in the packages in Imports. If NeedImports - // is not set NeedDeps has no effect. - NeedDeps - - // NeedExportsFile adds ExportsFile. - NeedExportsFile - - // NeedTypes adds Types, Fset, and IllTyped. - NeedTypes - - // NeedSyntax adds Syntax. - NeedSyntax - - // NeedTypesInfo adds TypesInfo. - NeedTypesInfo - - // NeedTypesSizes adds TypesSizes. - NeedTypesSizes -) - -const ( - // Deprecated: LoadFiles exists for historical compatibility - // and should not be used. Please directly specify the needed fields using the Need values. - LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles - - // Deprecated: LoadImports exists for historical compatibility - // and should not be used. Please directly specify the needed fields using the Need values. - LoadImports = LoadFiles | NeedImports | NeedDeps - - // Deprecated: LoadTypes exists for historical compatibility - // and should not be used. Please directly specify the needed fields using the Need values. - LoadTypes = LoadImports | NeedTypes | NeedTypesSizes - - // Deprecated: LoadSyntax exists for historical compatibility - // and should not be used. Please directly specify the needed fields using the Need values. - LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo - - // Deprecated: LoadAllSyntax exists for historical compatibility - // and should not be used. Please directly specify the needed fields using the Need values. - LoadAllSyntax = LoadSyntax -) - -// A Config specifies details about how packages should be loaded. -// The zero value is a valid configuration. -// Calls to Load do not modify this struct. -type Config struct { - // Mode controls the level of information returned for each package. - Mode LoadMode - - // Context specifies the context for the load operation. - // If the context is cancelled, the loader may stop early - // and return an ErrCancelled error. - // If Context is nil, the load cannot be cancelled. - Context context.Context - - // Dir is the directory in which to run the build system's query tool - // that provides information about the packages. - // If Dir is empty, the tool is run in the current directory. - Dir string - - // Env is the environment to use when invoking the build system's query tool. - // If Env is nil, the current environment is used. - // As in os/exec's Cmd, only the last value in the slice for - // each environment key is used. To specify the setting of only - // a few variables, append to the current environment, as in: - // - // opt.Env = append(os.Environ(), "GOOS=plan9", "GOARCH=386") - // - Env []string - - // BuildFlags is a list of command-line flags to be passed through to - // the build system's query tool. - BuildFlags []string - - // Fset provides source position information for syntax trees and types. - // If Fset is nil, Load will use a new fileset, but preserve Fset's value. - Fset *token.FileSet - - // ParseFile is called to read and parse each file - // when preparing a package's type-checked syntax tree. - // It must be safe to call ParseFile simultaneously from multiple goroutines. - // If ParseFile is nil, the loader will uses parser.ParseFile. - // - // ParseFile should parse the source from src and use filename only for - // recording position information. - // - // An application may supply a custom implementation of ParseFile - // to change the effective file contents or the behavior of the parser, - // or to modify the syntax tree. For example, selectively eliminating - // unwanted function bodies can significantly accelerate type checking. - ParseFile func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) - - // If Tests is set, the loader includes not just the packages - // matching a particular pattern but also any related test packages, - // including test-only variants of the package and the test executable. - // - // For example, when using the go command, loading "fmt" with Tests=true - // returns four packages, with IDs "fmt" (the standard package), - // "fmt [fmt.test]" (the package as compiled for the test), - // "fmt_test" (the test functions from source files in package fmt_test), - // and "fmt.test" (the test binary). - // - // In build systems with explicit names for tests, - // setting Tests may have no effect. - Tests bool - - // Overlay provides a mapping of absolute file paths to file contents. - // If the file with the given path already exists, the parser will use the - // alternative file contents provided by the map. - // - // Overlays provide incomplete support for when a given file doesn't - // already exist on disk. See the package doc above for more details. - Overlay map[string][]byte -} - -// driver is the type for functions that query the build system for the -// packages named by the patterns. -type driver func(cfg *Config, patterns ...string) (*driverResponse, error) - -// driverResponse contains the results for a driver query. -type driverResponse struct { - // Sizes, if not nil, is the types.Sizes to use when type checking. - Sizes *types.StdSizes - - // Roots is the set of package IDs that make up the root packages. - // We have to encode this separately because when we encode a single package - // we cannot know if it is one of the roots as that requires knowledge of the - // graph it is part of. - Roots []string `json:",omitempty"` - - // Packages is the full set of packages in the graph. - // The packages are not connected into a graph. - // The Imports if populated will be stubs that only have their ID set. - // Imports will be connected and then type and syntax information added in a - // later pass (see refine). - Packages []*Package -} - -// Load loads and returns the Go packages named by the given patterns. -// -// Config specifies loading options; -// nil behaves the same as an empty Config. -// -// Load returns an error if any of the patterns was invalid -// as defined by the underlying build system. -// It may return an empty list of packages without an error, -// for instance for an empty expansion of a valid wildcard. -// Errors associated with a particular package are recorded in the -// corresponding Package's Errors list, and do not cause Load to -// return an error. Clients may need to handle such errors before -// proceeding with further analysis. The PrintErrors function is -// provided for convenient display of all errors. -func Load(cfg *Config, patterns ...string) ([]*Package, error) { - l := newLoader(cfg) - response, err := defaultDriver(&l.Config, patterns...) - if err != nil { - return nil, err - } - l.sizes = response.Sizes - return l.refine(response.Roots, response.Packages...) -} - -// defaultDriver is a driver that looks for an external driver binary, and if -// it does not find it falls back to the built in go list driver. -func defaultDriver(cfg *Config, patterns ...string) (*driverResponse, error) { - driver := findExternalDriver(cfg) - if driver == nil { - driver = goListDriver - } - return driver(cfg, patterns...) -} - -// A Package describes a loaded Go package. -type Package struct { - // ID is a unique identifier for a package, - // in a syntax provided by the underlying build system. - // - // Because the syntax varies based on the build system, - // clients should treat IDs as opaque and not attempt to - // interpret them. - ID string - - // Name is the package name as it appears in the package source code. - Name string - - // PkgPath is the package path as used by the go/types package. - PkgPath string - - // Errors contains any errors encountered querying the metadata - // of the package, or while parsing or type-checking its files. - Errors []Error - - // GoFiles lists the absolute file paths of the package's Go source files. - GoFiles []string - - // CompiledGoFiles lists the absolute file paths of the package's source - // files that were presented to the compiler. - // This may differ from GoFiles if files are processed before compilation. - CompiledGoFiles []string - - // OtherFiles lists the absolute file paths of the package's non-Go source files, - // including assembly, C, C++, Fortran, Objective-C, SWIG, and so on. - OtherFiles []string - - // ExportFile is the absolute path to a file containing type - // information for the package as provided by the build system. - ExportFile string - - // Imports maps import paths appearing in the package's Go source files - // to corresponding loaded Packages. - Imports map[string]*Package - - // Types provides type information for the package. - // The NeedTypes LoadMode bit sets this field for packages matching the - // patterns; type information for dependencies may be missing or incomplete, - // unless NeedDeps and NeedImports are also set. - Types *types.Package - - // Fset provides position information for Types, TypesInfo, and Syntax. - // It is set only when Types is set. - Fset *token.FileSet - - // IllTyped indicates whether the package or any dependency contains errors. - // It is set only when Types is set. - IllTyped bool - - // Syntax is the package's syntax trees, for the files listed in CompiledGoFiles. - // - // The NeedSyntax LoadMode bit populates this field for packages matching the patterns. - // If NeedDeps and NeedImports are also set, this field will also be populated - // for dependencies. - Syntax []*ast.File - - // TypesInfo provides type information about the package's syntax trees. - // It is set only when Syntax is set. - TypesInfo *types.Info - - // TypesSizes provides the effective size function for types in TypesInfo. - TypesSizes types.Sizes -} - -// An Error describes a problem with a package's metadata, syntax, or types. -type Error struct { - Pos string // "file:line:col" or "file:line" or "" or "-" - Msg string - Kind ErrorKind -} - -// ErrorKind describes the source of the error, allowing the user to -// differentiate between errors generated by the driver, the parser, or the -// type-checker. -type ErrorKind int - -const ( - UnknownError ErrorKind = iota - ListError - ParseError - TypeError -) - -func (err Error) Error() string { - pos := err.Pos - if pos == "" { - pos = "-" // like token.Position{}.String() - } - return pos + ": " + err.Msg -} - -// flatPackage is the JSON form of Package -// It drops all the type and syntax fields, and transforms the Imports -// -// TODO(adonovan): identify this struct with Package, effectively -// publishing the JSON protocol. -type flatPackage struct { - ID string - Name string `json:",omitempty"` - PkgPath string `json:",omitempty"` - Errors []Error `json:",omitempty"` - GoFiles []string `json:",omitempty"` - CompiledGoFiles []string `json:",omitempty"` - OtherFiles []string `json:",omitempty"` - ExportFile string `json:",omitempty"` - Imports map[string]string `json:",omitempty"` -} - -// MarshalJSON returns the Package in its JSON form. -// For the most part, the structure fields are written out unmodified, and -// the type and syntax fields are skipped. -// The imports are written out as just a map of path to package id. -// The errors are written using a custom type that tries to preserve the -// structure of error types we know about. -// -// This method exists to enable support for additional build systems. It is -// not intended for use by clients of the API and we may change the format. -func (p *Package) MarshalJSON() ([]byte, error) { - flat := &flatPackage{ - ID: p.ID, - Name: p.Name, - PkgPath: p.PkgPath, - Errors: p.Errors, - GoFiles: p.GoFiles, - CompiledGoFiles: p.CompiledGoFiles, - OtherFiles: p.OtherFiles, - ExportFile: p.ExportFile, - } - if len(p.Imports) > 0 { - flat.Imports = make(map[string]string, len(p.Imports)) - for path, ipkg := range p.Imports { - flat.Imports[path] = ipkg.ID - } - } - return json.Marshal(flat) -} - -// UnmarshalJSON reads in a Package from its JSON format. -// See MarshalJSON for details about the format accepted. -func (p *Package) UnmarshalJSON(b []byte) error { - flat := &flatPackage{} - if err := json.Unmarshal(b, &flat); err != nil { - return err - } - *p = Package{ - ID: flat.ID, - Name: flat.Name, - PkgPath: flat.PkgPath, - Errors: flat.Errors, - GoFiles: flat.GoFiles, - CompiledGoFiles: flat.CompiledGoFiles, - OtherFiles: flat.OtherFiles, - ExportFile: flat.ExportFile, - } - if len(flat.Imports) > 0 { - p.Imports = make(map[string]*Package, len(flat.Imports)) - for path, id := range flat.Imports { - p.Imports[path] = &Package{ID: id} - } - } - return nil -} - -func (p *Package) String() string { return p.ID } - -// loaderPackage augments Package with state used during the loading phase -type loaderPackage struct { - *Package - importErrors map[string]error // maps each bad import to its error - loadOnce sync.Once - color uint8 // for cycle detection - needsrc bool // load from source (Mode >= LoadTypes) - needtypes bool // type information is either requested or depended on - initial bool // package was matched by a pattern -} - -// loader holds the working state of a single call to load. -type loader struct { - pkgs map[string]*loaderPackage - Config - sizes types.Sizes - parseCache map[string]*parseValue - parseCacheMu sync.Mutex - exportMu sync.Mutex // enforces mutual exclusion of exportdata operations - - // TODO(matloob): Add an implied mode here and use that instead of mode. - // Implied mode would contain all the fields we need the data for so we can - // get the actually requested fields. We'll zero them out before returning - // packages to the user. This will make it easier for us to get the conditions - // where we need certain modes right. -} - -type parseValue struct { - f *ast.File - err error - ready chan struct{} -} - -func newLoader(cfg *Config) *loader { - ld := &loader{ - parseCache: map[string]*parseValue{}, - } - if cfg != nil { - ld.Config = *cfg - } - if ld.Config.Mode == 0 { - ld.Config.Mode = NeedName | NeedFiles | NeedCompiledGoFiles // Preserve zero behavior of Mode for backwards compatibility. - } - if ld.Config.Env == nil { - ld.Config.Env = os.Environ() - } - if ld.Context == nil { - ld.Context = context.Background() - } - if ld.Dir == "" { - if dir, err := os.Getwd(); err == nil { - ld.Dir = dir - } - } - - if ld.Mode&NeedTypes != 0 { - if ld.Fset == nil { - ld.Fset = token.NewFileSet() - } - - // ParseFile is required even in LoadTypes mode - // because we load source if export data is missing. - if ld.ParseFile == nil { - ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) { - const mode = parser.AllErrors | parser.ParseComments - return parser.ParseFile(fset, filename, src, mode) - } - } - } - return ld -} - -// refine connects the supplied packages into a graph and then adds type and -// and syntax information as requested by the LoadMode. -func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { - rootMap := make(map[string]int, len(roots)) - for i, root := range roots { - rootMap[root] = i - } - ld.pkgs = make(map[string]*loaderPackage) - // first pass, fixup and build the map and roots - var initial = make([]*loaderPackage, len(roots)) - for _, pkg := range list { - rootIndex := -1 - if i, found := rootMap[pkg.ID]; found { - rootIndex = i - } - lpkg := &loaderPackage{ - Package: pkg, - needtypes: (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0, - needsrc: (ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0 || - len(ld.Overlay) > 0 || // Overlays can invalidate export data. TODO(matloob): make this check fine-grained based on dependencies on overlaid files - pkg.ExportFile == "" && pkg.PkgPath != "unsafe", - } - ld.pkgs[lpkg.ID] = lpkg - if rootIndex >= 0 { - initial[rootIndex] = lpkg - lpkg.initial = true - } - } - for i, root := range roots { - if initial[i] == nil { - return nil, fmt.Errorf("root package %v is missing", root) - } - } - - // Materialize the import graph. - - const ( - white = 0 // new - grey = 1 // in progress - black = 2 // complete - ) - - // visit traverses the import graph, depth-first, - // and materializes the graph as Packages.Imports. - // - // Valid imports are saved in the Packages.Import map. - // Invalid imports (cycles and missing nodes) are saved in the importErrors map. - // Thus, even in the presence of both kinds of errors, the Import graph remains a DAG. - // - // visit returns whether the package needs src or has a transitive - // dependency on a package that does. These are the only packages - // for which we load source code. - var stack []*loaderPackage - var visit func(lpkg *loaderPackage) bool - var srcPkgs []*loaderPackage - visit = func(lpkg *loaderPackage) bool { - switch lpkg.color { - case black: - return lpkg.needsrc - case grey: - panic("internal error: grey node") - } - lpkg.color = grey - stack = append(stack, lpkg) // push - stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports - lpkg.Imports = make(map[string]*Package, len(stubs)) - for importPath, ipkg := range stubs { - var importErr error - imp := ld.pkgs[ipkg.ID] - if imp == nil { - // (includes package "C" when DisableCgo) - importErr = fmt.Errorf("missing package: %q", ipkg.ID) - } else if imp.color == grey { - importErr = fmt.Errorf("import cycle: %s", stack) - } - if importErr != nil { - if lpkg.importErrors == nil { - lpkg.importErrors = make(map[string]error) - } - lpkg.importErrors[importPath] = importErr - continue - } - - if visit(imp) { - lpkg.needsrc = true - } - lpkg.Imports[importPath] = imp.Package - } - if lpkg.needsrc { - srcPkgs = append(srcPkgs, lpkg) - } - if ld.Mode&NeedTypesSizes != 0 { - lpkg.TypesSizes = ld.sizes - } - stack = stack[:len(stack)-1] // pop - lpkg.color = black - - return lpkg.needsrc - } - - if ld.Mode&(NeedImports|NeedDeps) == 0 { - // We do this to drop the stub import packages that we are not even going to try to resolve. - for _, lpkg := range initial { - lpkg.Imports = nil - } - } else { - // For each initial package, create its import DAG. - for _, lpkg := range initial { - visit(lpkg) - } - } - if ld.Mode&NeedDeps != 0 { // TODO(matloob): This is only the case if NeedTypes is also set, right? - for _, lpkg := range srcPkgs { - // Complete type information is required for the - // immediate dependencies of each source package. - for _, ipkg := range lpkg.Imports { - imp := ld.pkgs[ipkg.ID] - imp.needtypes = true - } - } - } - // Load type data if needed, starting at - // the initial packages (roots of the import DAG). - if ld.Mode&NeedTypes != 0 { - var wg sync.WaitGroup - for _, lpkg := range initial { - wg.Add(1) - go func(lpkg *loaderPackage) { - ld.loadRecursive(lpkg) - wg.Done() - }(lpkg) - } - wg.Wait() - } - - result := make([]*Package, len(initial)) - importPlaceholders := make(map[string]*Package) - for i, lpkg := range initial { - result[i] = lpkg.Package - } - for i := range ld.pkgs { - // Clear all unrequested fields, for extra de-Hyrum-ization. - if ld.Mode&NeedName == 0 { - ld.pkgs[i].Name = "" - ld.pkgs[i].PkgPath = "" - } - if ld.Mode&NeedFiles == 0 { - ld.pkgs[i].GoFiles = nil - ld.pkgs[i].OtherFiles = nil - } - if ld.Mode&NeedCompiledGoFiles == 0 { - ld.pkgs[i].CompiledGoFiles = nil - } - if ld.Mode&NeedImports == 0 { - ld.pkgs[i].Imports = nil - } - if ld.Mode&NeedExportsFile == 0 { - ld.pkgs[i].ExportFile = "" - } - if ld.Mode&NeedTypes == 0 { - ld.pkgs[i].Types = nil - ld.pkgs[i].Fset = nil - ld.pkgs[i].IllTyped = false - } - if ld.Mode&NeedSyntax == 0 { - ld.pkgs[i].Syntax = nil - } - if ld.Mode&NeedTypesInfo == 0 { - ld.pkgs[i].TypesInfo = nil - } - if ld.Mode&NeedTypesSizes == 0 { - ld.pkgs[i].TypesSizes = nil - } - if ld.Mode&NeedDeps == 0 { - for j, pkg := range ld.pkgs[i].Imports { - ph, ok := importPlaceholders[pkg.ID] - if !ok { - ph = &Package{ID: pkg.ID} - importPlaceholders[pkg.ID] = ph - } - ld.pkgs[i].Imports[j] = ph - } - } - } - return result, nil -} - -// loadRecursive loads the specified package and its dependencies, -// recursively, in parallel, in topological order. -// It is atomic and idempotent. -// Precondition: ld.Mode&NeedTypes. -func (ld *loader) loadRecursive(lpkg *loaderPackage) { - lpkg.loadOnce.Do(func() { - // Load the direct dependencies, in parallel. - var wg sync.WaitGroup - for _, ipkg := range lpkg.Imports { - imp := ld.pkgs[ipkg.ID] - wg.Add(1) - go func(imp *loaderPackage) { - ld.loadRecursive(imp) - wg.Done() - }(imp) - } - wg.Wait() - - ld.loadPackage(lpkg) - }) -} - -// loadPackage loads the specified package. -// It must be called only once per Package, -// after immediate dependencies are loaded. -// Precondition: ld.Mode & NeedTypes. -func (ld *loader) loadPackage(lpkg *loaderPackage) { - if lpkg.PkgPath == "unsafe" { - // Fill in the blanks to avoid surprises. - lpkg.Types = types.Unsafe - lpkg.Fset = ld.Fset - lpkg.Syntax = []*ast.File{} - lpkg.TypesInfo = new(types.Info) - lpkg.TypesSizes = ld.sizes - return - } - - // Call NewPackage directly with explicit name. - // This avoids skew between golist and go/types when the files' - // package declarations are inconsistent. - lpkg.Types = types.NewPackage(lpkg.PkgPath, lpkg.Name) - lpkg.Fset = ld.Fset - - // Subtle: we populate all Types fields with an empty Package - // before loading export data so that export data processing - // never has to create a types.Package for an indirect dependency, - // which would then require that such created packages be explicitly - // inserted back into the Import graph as a final step after export data loading. - // The Diamond test exercises this case. - if !lpkg.needtypes { - return - } - if !lpkg.needsrc { - ld.loadFromExportData(lpkg) - return // not a source package, don't get syntax trees - } - - appendError := func(err error) { - // Convert various error types into the one true Error. - var errs []Error - switch err := err.(type) { - case Error: - // from driver - errs = append(errs, err) - - case *os.PathError: - // from parser - errs = append(errs, Error{ - Pos: err.Path + ":1", - Msg: err.Err.Error(), - Kind: ParseError, - }) - - case scanner.ErrorList: - // from parser - for _, err := range err { - errs = append(errs, Error{ - Pos: err.Pos.String(), - Msg: err.Msg, - Kind: ParseError, - }) - } - - case types.Error: - // from type checker - errs = append(errs, Error{ - Pos: err.Fset.Position(err.Pos).String(), - Msg: err.Msg, - Kind: TypeError, - }) - - default: - // unexpected impoverished error from parser? - errs = append(errs, Error{ - Pos: "-", - Msg: err.Error(), - Kind: UnknownError, - }) - - // If you see this error message, please file a bug. - log.Printf("internal error: error %q (%T) without position", err, err) - } - - lpkg.Errors = append(lpkg.Errors, errs...) - } - - files, errs := ld.parseFiles(lpkg.CompiledGoFiles) - for _, err := range errs { - appendError(err) - } - - lpkg.Syntax = files - - lpkg.TypesInfo = &types.Info{ - Types: make(map[ast.Expr]types.TypeAndValue), - Defs: make(map[*ast.Ident]types.Object), - Uses: make(map[*ast.Ident]types.Object), - Implicits: make(map[ast.Node]types.Object), - Scopes: make(map[ast.Node]*types.Scope), - Selections: make(map[*ast.SelectorExpr]*types.Selection), - } - lpkg.TypesSizes = ld.sizes - - importer := importerFunc(func(path string) (*types.Package, error) { - if path == "unsafe" { - return types.Unsafe, nil - } - - // The imports map is keyed by import path. - ipkg := lpkg.Imports[path] - if ipkg == nil { - if err := lpkg.importErrors[path]; err != nil { - return nil, err - } - // There was skew between the metadata and the - // import declarations, likely due to an edit - // race, or because the ParseFile feature was - // used to supply alternative file contents. - return nil, fmt.Errorf("no metadata for %s", path) - } - - if ipkg.Types != nil && ipkg.Types.Complete() { - return ipkg.Types, nil - } - log.Fatalf("internal error: nil Pkg importing %q from %q", path, lpkg) - panic("unreachable") - }) - - // type-check - tc := &types.Config{ - Importer: importer, - - // Type-check bodies of functions only in non-initial packages. - // Example: for import graph A->B->C and initial packages {A,C}, - // we can ignore function bodies in B. - IgnoreFuncBodies: (ld.Mode&(NeedDeps|NeedTypesInfo) == 0) && !lpkg.initial, - - Error: appendError, - Sizes: ld.sizes, - } - types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax) - - lpkg.importErrors = nil // no longer needed - - // If !Cgo, the type-checker uses FakeImportC mode, so - // it doesn't invoke the importer for import "C", - // nor report an error for the import, - // or for any undefined C.f reference. - // We must detect this explicitly and correctly - // mark the package as IllTyped (by reporting an error). - // TODO(adonovan): if these errors are annoying, - // we could just set IllTyped quietly. - if tc.FakeImportC { - outer: - for _, f := range lpkg.Syntax { - for _, imp := range f.Imports { - if imp.Path.Value == `"C"` { - err := types.Error{Fset: ld.Fset, Pos: imp.Pos(), Msg: `import "C" ignored`} - appendError(err) - break outer - } - } - } - } - - // Record accumulated errors. - illTyped := len(lpkg.Errors) > 0 - if !illTyped { - for _, imp := range lpkg.Imports { - if imp.IllTyped { - illTyped = true - break - } - } - } - lpkg.IllTyped = illTyped -} - -// An importFunc is an implementation of the single-method -// types.Importer interface based on a function value. -type importerFunc func(path string) (*types.Package, error) - -func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) } - -// We use a counting semaphore to limit -// the number of parallel I/O calls per process. -var ioLimit = make(chan bool, 20) - -func (ld *loader) parseFile(filename string) (*ast.File, error) { - ld.parseCacheMu.Lock() - v, ok := ld.parseCache[filename] - if ok { - // cache hit - ld.parseCacheMu.Unlock() - <-v.ready - } else { - // cache miss - v = &parseValue{ready: make(chan struct{})} - ld.parseCache[filename] = v - ld.parseCacheMu.Unlock() - - var src []byte - for f, contents := range ld.Config.Overlay { - if sameFile(f, filename) { - src = contents - } - } - var err error - if src == nil { - ioLimit <- true // wait - src, err = ioutil.ReadFile(filename) - <-ioLimit // signal - } - if err != nil { - v.err = err - } else { - v.f, v.err = ld.ParseFile(ld.Fset, filename, src) - } - - close(v.ready) - } - return v.f, v.err -} - -// parseFiles reads and parses the Go source files and returns the ASTs -// of the ones that could be at least partially parsed, along with a -// list of I/O and parse errors encountered. -// -// Because files are scanned in parallel, the token.Pos -// positions of the resulting ast.Files are not ordered. -// -func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) { - var wg sync.WaitGroup - n := len(filenames) - parsed := make([]*ast.File, n) - errors := make([]error, n) - for i, file := range filenames { - if ld.Config.Context.Err() != nil { - parsed[i] = nil - errors[i] = ld.Config.Context.Err() - continue - } - wg.Add(1) - go func(i int, filename string) { - parsed[i], errors[i] = ld.parseFile(filename) - wg.Done() - }(i, file) - } - wg.Wait() - - // Eliminate nils, preserving order. - var o int - for _, f := range parsed { - if f != nil { - parsed[o] = f - o++ - } - } - parsed = parsed[:o] - - o = 0 - for _, err := range errors { - if err != nil { - errors[o] = err - o++ - } - } - errors = errors[:o] - - return parsed, errors -} - -// sameFile returns true if x and y have the same basename and denote -// the same file. -// -func sameFile(x, y string) bool { - if x == y { - // It could be the case that y doesn't exist. - // For instance, it may be an overlay file that - // hasn't been written to disk. To handle that case - // let x == y through. (We added the exact absolute path - // string to the CompiledGoFiles list, so the unwritten - // overlay case implies x==y.) - return true - } - if strings.EqualFold(filepath.Base(x), filepath.Base(y)) { // (optimisation) - if xi, err := os.Stat(x); err == nil { - if yi, err := os.Stat(y); err == nil { - return os.SameFile(xi, yi) - } - } - } - return false -} - -// loadFromExportData returns type information for the specified -// package, loading it from an export data file on the first request. -func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error) { - if lpkg.PkgPath == "" { - log.Fatalf("internal error: Package %s has no PkgPath", lpkg) - } - - // Because gcexportdata.Read has the potential to create or - // modify the types.Package for each node in the transitive - // closure of dependencies of lpkg, all exportdata operations - // must be sequential. (Finer-grained locking would require - // changes to the gcexportdata API.) - // - // The exportMu lock guards the Package.Pkg field and the - // types.Package it points to, for each Package in the graph. - // - // Not all accesses to Package.Pkg need to be protected by exportMu: - // graph ordering ensures that direct dependencies of source - // packages are fully loaded before the importer reads their Pkg field. - ld.exportMu.Lock() - defer ld.exportMu.Unlock() - - if tpkg := lpkg.Types; tpkg != nil && tpkg.Complete() { - return tpkg, nil // cache hit - } - - lpkg.IllTyped = true // fail safe - - if lpkg.ExportFile == "" { - // Errors while building export data will have been printed to stderr. - return nil, fmt.Errorf("no export data file") - } - f, err := os.Open(lpkg.ExportFile) - if err != nil { - return nil, err - } - defer f.Close() - - // Read gc export data. - // - // We don't currently support gccgo export data because all - // underlying workspaces use the gc toolchain. (Even build - // systems that support gccgo don't use it for workspace - // queries.) - r, err := gcexportdata.NewReader(f) - if err != nil { - return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err) - } - - // Build the view. - // - // The gcexportdata machinery has no concept of package ID. - // It identifies packages by their PkgPath, which although not - // globally unique is unique within the scope of one invocation - // of the linker, type-checker, or gcexportdata. - // - // So, we must build a PkgPath-keyed view of the global - // (conceptually ID-keyed) cache of packages and pass it to - // gcexportdata. The view must contain every existing - // package that might possibly be mentioned by the - // current package---its transitive closure. - // - // In loadPackage, we unconditionally create a types.Package for - // each dependency so that export data loading does not - // create new ones. - // - // TODO(adonovan): it would be simpler and more efficient - // if the export data machinery invoked a callback to - // get-or-create a package instead of a map. - // - view := make(map[string]*types.Package) // view seen by gcexportdata - seen := make(map[*loaderPackage]bool) // all visited packages - var visit func(pkgs map[string]*Package) - visit = func(pkgs map[string]*Package) { - for _, p := range pkgs { - lpkg := ld.pkgs[p.ID] - if !seen[lpkg] { - seen[lpkg] = true - view[lpkg.PkgPath] = lpkg.Types - visit(lpkg.Imports) - } - } - } - visit(lpkg.Imports) - - viewLen := len(view) + 1 // adding the self package - // Parse the export data. - // (May modify incomplete packages in view but not create new ones.) - tpkg, err := gcexportdata.Read(r, ld.Fset, view, lpkg.PkgPath) - if err != nil { - return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err) - } - if viewLen != len(view) { - log.Fatalf("Unexpected package creation during export data loading") - } - - lpkg.Types = tpkg - lpkg.IllTyped = false - - return tpkg, nil -} - -func usesExportData(cfg *Config) bool { - return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedTypesInfo == 0 -} diff --git a/vendor/golang.org/x/tools/go/packages/visit.go b/vendor/golang.org/x/tools/go/packages/visit.go deleted file mode 100644 index b13cb081..00000000 --- a/vendor/golang.org/x/tools/go/packages/visit.go +++ /dev/null @@ -1,55 +0,0 @@ -package packages - -import ( - "fmt" - "os" - "sort" -) - -// Visit visits all the packages in the import graph whose roots are -// pkgs, calling the optional pre function the first time each package -// is encountered (preorder), and the optional post function after a -// package's dependencies have been visited (postorder). -// The boolean result of pre(pkg) determines whether -// the imports of package pkg are visited. -func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) { - seen := make(map[*Package]bool) - var visit func(*Package) - visit = func(pkg *Package) { - if !seen[pkg] { - seen[pkg] = true - - if pre == nil || pre(pkg) { - paths := make([]string, 0, len(pkg.Imports)) - for path := range pkg.Imports { - paths = append(paths, path) - } - sort.Strings(paths) // Imports is a map, this makes visit stable - for _, path := range paths { - visit(pkg.Imports[path]) - } - } - - if post != nil { - post(pkg) - } - } - } - for _, pkg := range pkgs { - visit(pkg) - } -} - -// PrintErrors prints to os.Stderr the accumulated errors of all -// packages in the import graph rooted at pkgs, dependencies first. -// PrintErrors returns the number of errors printed. -func PrintErrors(pkgs []*Package) int { - var n int - Visit(pkgs, nil, func(pkg *Package) { - for _, err := range pkg.Errors { - fmt.Fprintln(os.Stderr, err) - n++ - } - }) - return n -} diff --git a/vendor/golang.org/x/tools/go/types/typeutil/callee.go b/vendor/golang.org/x/tools/go/types/typeutil/callee.go deleted file mode 100644 index 38f596da..00000000 --- a/vendor/golang.org/x/tools/go/types/typeutil/callee.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package typeutil - -import ( - "go/ast" - "go/types" - - "golang.org/x/tools/go/ast/astutil" -) - -// Callee returns the named target of a function call, if any: -// a function, method, builtin, or variable. -func Callee(info *types.Info, call *ast.CallExpr) types.Object { - var obj types.Object - switch fun := astutil.Unparen(call.Fun).(type) { - case *ast.Ident: - obj = info.Uses[fun] // type, var, builtin, or declared func - case *ast.SelectorExpr: - if sel, ok := info.Selections[fun]; ok { - obj = sel.Obj() // method or field - } else { - obj = info.Uses[fun.Sel] // qualified identifier? - } - } - if _, ok := obj.(*types.TypeName); ok { - return nil // T(x) is a conversion, not a call - } - return obj -} - -// StaticCallee returns the target (function or method) of a static -// function call, if any. It returns nil for calls to builtins. -func StaticCallee(info *types.Info, call *ast.CallExpr) *types.Func { - if f, ok := Callee(info, call).(*types.Func); ok && !interfaceMethod(f) { - return f - } - return nil -} - -func interfaceMethod(f *types.Func) bool { - recv := f.Type().(*types.Signature).Recv() - return recv != nil && types.IsInterface(recv.Type()) -} diff --git a/vendor/golang.org/x/tools/go/types/typeutil/imports.go b/vendor/golang.org/x/tools/go/types/typeutil/imports.go deleted file mode 100644 index 9c441dba..00000000 --- a/vendor/golang.org/x/tools/go/types/typeutil/imports.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package typeutil - -import "go/types" - -// Dependencies returns all dependencies of the specified packages. -// -// Dependent packages appear in topological order: if package P imports -// package Q, Q appears earlier than P in the result. -// The algorithm follows import statements in the order they -// appear in the source code, so the result is a total order. -// -func Dependencies(pkgs ...*types.Package) []*types.Package { - var result []*types.Package - seen := make(map[*types.Package]bool) - var visit func(pkgs []*types.Package) - visit = func(pkgs []*types.Package) { - for _, p := range pkgs { - if !seen[p] { - seen[p] = true - visit(p.Imports()) - result = append(result, p) - } - } - } - visit(pkgs) - return result -} diff --git a/vendor/golang.org/x/tools/go/types/typeutil/map.go b/vendor/golang.org/x/tools/go/types/typeutil/map.go deleted file mode 100644 index c7f75450..00000000 --- a/vendor/golang.org/x/tools/go/types/typeutil/map.go +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package typeutil defines various utilities for types, such as Map, -// a mapping from types.Type to interface{} values. -package typeutil // import "golang.org/x/tools/go/types/typeutil" - -import ( - "bytes" - "fmt" - "go/types" - "reflect" -) - -// Map is a hash-table-based mapping from types (types.Type) to -// arbitrary interface{} values. The concrete types that implement -// the Type interface are pointers. Since they are not canonicalized, -// == cannot be used to check for equivalence, and thus we cannot -// simply use a Go map. -// -// Just as with map[K]V, a nil *Map is a valid empty map. -// -// Not thread-safe. -// -type Map struct { - hasher Hasher // shared by many Maps - table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused - length int // number of map entries -} - -// entry is an entry (key/value association) in a hash bucket. -type entry struct { - key types.Type - value interface{} -} - -// SetHasher sets the hasher used by Map. -// -// All Hashers are functionally equivalent but contain internal state -// used to cache the results of hashing previously seen types. -// -// A single Hasher created by MakeHasher() may be shared among many -// Maps. This is recommended if the instances have many keys in -// common, as it will amortize the cost of hash computation. -// -// A Hasher may grow without bound as new types are seen. Even when a -// type is deleted from the map, the Hasher never shrinks, since other -// types in the map may reference the deleted type indirectly. -// -// Hashers are not thread-safe, and read-only operations such as -// Map.Lookup require updates to the hasher, so a full Mutex lock (not a -// read-lock) is require around all Map operations if a shared -// hasher is accessed from multiple threads. -// -// If SetHasher is not called, the Map will create a private hasher at -// the first call to Insert. -// -func (m *Map) SetHasher(hasher Hasher) { - m.hasher = hasher -} - -// Delete removes the entry with the given key, if any. -// It returns true if the entry was found. -// -func (m *Map) Delete(key types.Type) bool { - if m != nil && m.table != nil { - hash := m.hasher.Hash(key) - bucket := m.table[hash] - for i, e := range bucket { - if e.key != nil && types.Identical(key, e.key) { - // We can't compact the bucket as it - // would disturb iterators. - bucket[i] = entry{} - m.length-- - return true - } - } - } - return false -} - -// At returns the map entry for the given key. -// The result is nil if the entry is not present. -// -func (m *Map) At(key types.Type) interface{} { - if m != nil && m.table != nil { - for _, e := range m.table[m.hasher.Hash(key)] { - if e.key != nil && types.Identical(key, e.key) { - return e.value - } - } - } - return nil -} - -// Set sets the map entry for key to val, -// and returns the previous entry, if any. -func (m *Map) Set(key types.Type, value interface{}) (prev interface{}) { - if m.table != nil { - hash := m.hasher.Hash(key) - bucket := m.table[hash] - var hole *entry - for i, e := range bucket { - if e.key == nil { - hole = &bucket[i] - } else if types.Identical(key, e.key) { - prev = e.value - bucket[i].value = value - return - } - } - - if hole != nil { - *hole = entry{key, value} // overwrite deleted entry - } else { - m.table[hash] = append(bucket, entry{key, value}) - } - } else { - if m.hasher.memo == nil { - m.hasher = MakeHasher() - } - hash := m.hasher.Hash(key) - m.table = map[uint32][]entry{hash: {entry{key, value}}} - } - - m.length++ - return -} - -// Len returns the number of map entries. -func (m *Map) Len() int { - if m != nil { - return m.length - } - return 0 -} - -// Iterate calls function f on each entry in the map in unspecified order. -// -// If f should mutate the map, Iterate provides the same guarantees as -// Go maps: if f deletes a map entry that Iterate has not yet reached, -// f will not be invoked for it, but if f inserts a map entry that -// Iterate has not yet reached, whether or not f will be invoked for -// it is unspecified. -// -func (m *Map) Iterate(f func(key types.Type, value interface{})) { - if m != nil { - for _, bucket := range m.table { - for _, e := range bucket { - if e.key != nil { - f(e.key, e.value) - } - } - } - } -} - -// Keys returns a new slice containing the set of map keys. -// The order is unspecified. -func (m *Map) Keys() []types.Type { - keys := make([]types.Type, 0, m.Len()) - m.Iterate(func(key types.Type, _ interface{}) { - keys = append(keys, key) - }) - return keys -} - -func (m *Map) toString(values bool) string { - if m == nil { - return "{}" - } - var buf bytes.Buffer - fmt.Fprint(&buf, "{") - sep := "" - m.Iterate(func(key types.Type, value interface{}) { - fmt.Fprint(&buf, sep) - sep = ", " - fmt.Fprint(&buf, key) - if values { - fmt.Fprintf(&buf, ": %q", value) - } - }) - fmt.Fprint(&buf, "}") - return buf.String() -} - -// String returns a string representation of the map's entries. -// Values are printed using fmt.Sprintf("%v", v). -// Order is unspecified. -// -func (m *Map) String() string { - return m.toString(true) -} - -// KeysString returns a string representation of the map's key set. -// Order is unspecified. -// -func (m *Map) KeysString() string { - return m.toString(false) -} - -//////////////////////////////////////////////////////////////////////// -// Hasher - -// A Hasher maps each type to its hash value. -// For efficiency, a hasher uses memoization; thus its memory -// footprint grows monotonically over time. -// Hashers are not thread-safe. -// Hashers have reference semantics. -// Call MakeHasher to create a Hasher. -type Hasher struct { - memo map[types.Type]uint32 -} - -// MakeHasher returns a new Hasher instance. -func MakeHasher() Hasher { - return Hasher{make(map[types.Type]uint32)} -} - -// Hash computes a hash value for the given type t such that -// Identical(t, t') => Hash(t) == Hash(t'). -func (h Hasher) Hash(t types.Type) uint32 { - hash, ok := h.memo[t] - if !ok { - hash = h.hashFor(t) - h.memo[t] = hash - } - return hash -} - -// hashString computes the Fowler–Noll–Vo hash of s. -func hashString(s string) uint32 { - var h uint32 - for i := 0; i < len(s); i++ { - h ^= uint32(s[i]) - h *= 16777619 - } - return h -} - -// hashFor computes the hash of t. -func (h Hasher) hashFor(t types.Type) uint32 { - // See Identical for rationale. - switch t := t.(type) { - case *types.Basic: - return uint32(t.Kind()) - - case *types.Array: - return 9043 + 2*uint32(t.Len()) + 3*h.Hash(t.Elem()) - - case *types.Slice: - return 9049 + 2*h.Hash(t.Elem()) - - case *types.Struct: - var hash uint32 = 9059 - for i, n := 0, t.NumFields(); i < n; i++ { - f := t.Field(i) - if f.Anonymous() { - hash += 8861 - } - hash += hashString(t.Tag(i)) - hash += hashString(f.Name()) // (ignore f.Pkg) - hash += h.Hash(f.Type()) - } - return hash - - case *types.Pointer: - return 9067 + 2*h.Hash(t.Elem()) - - case *types.Signature: - var hash uint32 = 9091 - if t.Variadic() { - hash *= 8863 - } - return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results()) - - case *types.Interface: - var hash uint32 = 9103 - for i, n := 0, t.NumMethods(); i < n; i++ { - // See go/types.identicalMethods for rationale. - // Method order is not significant. - // Ignore m.Pkg(). - m := t.Method(i) - hash += 3*hashString(m.Name()) + 5*h.Hash(m.Type()) - } - return hash - - case *types.Map: - return 9109 + 2*h.Hash(t.Key()) + 3*h.Hash(t.Elem()) - - case *types.Chan: - return 9127 + 2*uint32(t.Dir()) + 3*h.Hash(t.Elem()) - - case *types.Named: - // Not safe with a copying GC; objects may move. - return uint32(reflect.ValueOf(t.Obj()).Pointer()) - - case *types.Tuple: - return h.hashTuple(t) - } - panic(t) -} - -func (h Hasher) hashTuple(tuple *types.Tuple) uint32 { - // See go/types.identicalTypes for rationale. - n := tuple.Len() - var hash uint32 = 9137 + 2*uint32(n) - for i := 0; i < n; i++ { - hash += 3 * h.Hash(tuple.At(i).Type()) - } - return hash -} diff --git a/vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go b/vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go deleted file mode 100644 index 32084610..00000000 --- a/vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 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. - -// This file implements a cache of method sets. - -package typeutil - -import ( - "go/types" - "sync" -) - -// A MethodSetCache records the method set of each type T for which -// MethodSet(T) is called so that repeat queries are fast. -// The zero value is a ready-to-use cache instance. -type MethodSetCache struct { - mu sync.Mutex - named map[*types.Named]struct{ value, pointer *types.MethodSet } // method sets for named N and *N - others map[types.Type]*types.MethodSet // all other types -} - -// MethodSet returns the method set of type T. It is thread-safe. -// -// If cache is nil, this function is equivalent to types.NewMethodSet(T). -// Utility functions can thus expose an optional *MethodSetCache -// parameter to clients that care about performance. -// -func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet { - if cache == nil { - return types.NewMethodSet(T) - } - cache.mu.Lock() - defer cache.mu.Unlock() - - switch T := T.(type) { - case *types.Named: - return cache.lookupNamed(T).value - - case *types.Pointer: - if N, ok := T.Elem().(*types.Named); ok { - return cache.lookupNamed(N).pointer - } - } - - // all other types - // (The map uses pointer equivalence, not type identity.) - mset := cache.others[T] - if mset == nil { - mset = types.NewMethodSet(T) - if cache.others == nil { - cache.others = make(map[types.Type]*types.MethodSet) - } - cache.others[T] = mset - } - return mset -} - -func (cache *MethodSetCache) lookupNamed(named *types.Named) struct{ value, pointer *types.MethodSet } { - if cache.named == nil { - cache.named = make(map[*types.Named]struct{ value, pointer *types.MethodSet }) - } - // Avoid recomputing mset(*T) for each distinct Pointer - // instance whose underlying type is a named type. - msets, ok := cache.named[named] - if !ok { - msets.value = types.NewMethodSet(named) - msets.pointer = types.NewMethodSet(types.NewPointer(named)) - cache.named[named] = msets - } - return msets -} diff --git a/vendor/golang.org/x/tools/go/types/typeutil/ui.go b/vendor/golang.org/x/tools/go/types/typeutil/ui.go deleted file mode 100644 index 9849c24c..00000000 --- a/vendor/golang.org/x/tools/go/types/typeutil/ui.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package typeutil - -// This file defines utilities for user interfaces that display types. - -import "go/types" - -// IntuitiveMethodSet returns the intuitive method set of a type T, -// which is the set of methods you can call on an addressable value of -// that type. -// -// The result always contains MethodSet(T), and is exactly MethodSet(T) -// for interface types and for pointer-to-concrete types. -// For all other concrete types T, the result additionally -// contains each method belonging to *T if there is no identically -// named method on T itself. -// -// This corresponds to user intuition about method sets; -// this function is intended only for user interfaces. -// -// The order of the result is as for types.MethodSet(T). -// -func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection { - isPointerToConcrete := func(T types.Type) bool { - ptr, ok := T.(*types.Pointer) - return ok && !types.IsInterface(ptr.Elem()) - } - - var result []*types.Selection - mset := msets.MethodSet(T) - if types.IsInterface(T) || isPointerToConcrete(T) { - for i, n := 0, mset.Len(); i < n; i++ { - result = append(result, mset.At(i)) - } - } else { - // T is some other concrete type. - // Report methods of T and *T, preferring those of T. - pmset := msets.MethodSet(types.NewPointer(T)) - for i, n := 0, pmset.Len(); i < n; i++ { - meth := pmset.At(i) - if m := mset.Lookup(meth.Obj().Pkg(), meth.Obj().Name()); m != nil { - meth = m - } - result = append(result, meth) - } - - } - return result -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go deleted file mode 100644 index 7219c8e9..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fastwalk provides a faster version of filepath.Walk for file system -// scanning tools. -package fastwalk - -import ( - "errors" - "os" - "path/filepath" - "runtime" - "sync" -) - -// TraverseLink is used as a return value from WalkFuncs to indicate that the -// symlink named in the call may be traversed. -var TraverseLink = errors.New("fastwalk: traverse symlink, assuming target is a directory") - -// SkipFiles is a used as a return value from WalkFuncs to indicate that the -// callback should not be called for any other files in the current directory. -// Child directories will still be traversed. -var SkipFiles = errors.New("fastwalk: skip remaining files in directory") - -// Walk is a faster implementation of filepath.Walk. -// -// filepath.Walk's design necessarily calls os.Lstat on each file, -// even if the caller needs less info. -// Many tools need only the type of each file. -// On some platforms, this information is provided directly by the readdir -// system call, avoiding the need to stat each file individually. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399 -// -// Walk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If fastWalk returns filepath.SkipDir, the directory is skipped. -// -// Unlike filepath.Walk: -// * file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// * multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// * fastWalk can follow symlinks if walkFn returns the TraverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. -func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - - // Make sure to wait for all workers to finish, otherwise - // walkFn could still be called after returning. This Wait call - // runs after close(e.donec) below. - var wg sync.WaitGroup - defer wg.Wait() - - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - - for i := 0; i < numWorkers; i++ { - wg.Add(1) - go w.doWork(&wg) - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork(wg *sync.WaitGroup) { - defer wg.Done() - for { - select { - case <-w.donec: - return - case it := <-w.workc: - select { - case <-w.donec: - return - case w.resc <- w.walk(it.dir, !it.callbackDone): - } - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == TraverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} - -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go deleted file mode 100644 index ccffec5a..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 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 freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go deleted file mode 100644 index ab7fbc0a..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 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 linux darwin -// +build !appengine - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Ino) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go deleted file mode 100644 index a3b26a7b..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntNamlen(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Namlen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go deleted file mode 100644 index e880d358..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build !appengine - -package fastwalk - -import ( - "bytes" - "syscall" - "unsafe" -) - -func direntNamlen(dirent *syscall.Dirent) uint64 { - const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - const nameBufLen = uint16(len(nameBuf)) - limit := dirent.Reclen - fixedHdr - if limit > nameBufLen { - limit = nameBufLen - } - nameLen := bytes.IndexByte(nameBuf[:limit], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - return uint64(nameLen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go deleted file mode 100644 index a906b875..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 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 appengine !linux,!darwin,!freebsd,!openbsd,!netbsd - -package fastwalk - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - skipFiles := false - for _, fi := range fis { - if fi.Mode().IsRegular() && skipFiles { - continue - } - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - if err == SkipFiles { - skipFiles = true - continue - } - return err - } - } - return nil -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go deleted file mode 100644 index 3369b1a0..00000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2016 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 linux darwin freebsd openbsd netbsd -// +build !appengine - -package fastwalk - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := syscall.Open(dirName, 0, 0) - if err != nil { - return &os.PathError{Op: "open", Path: dirName, Err: err} - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - skipFiles := false - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = syscall.ReadDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if skipFiles && typ.IsRegular() { - continue - } - if err := fn(dirName, name, typ); err != nil { - if err == SkipFiles { - skipFiles = true - continue - } - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/15653 - dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0])) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := direntNamlen(dirent) - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go deleted file mode 100644 index 04bb96a3..00000000 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gopathwalk is like filepath.Walk but specialized for finding Go -// packages, particularly in $GOPATH and $GOROOT. -package gopathwalk - -import ( - "bufio" - "bytes" - "fmt" - "go/build" - "io/ioutil" - "log" - "os" - "path/filepath" - "strings" - - "golang.org/x/tools/internal/fastwalk" -) - -// Options controls the behavior of a Walk call. -type Options struct { - Debug bool // Enable debug logging - ModulesEnabled bool // Search module caches. Also disables legacy goimports ignore rules. -} - -// RootType indicates the type of a Root. -type RootType int - -const ( - RootUnknown RootType = iota - RootGOROOT - RootGOPATH - RootCurrentModule - RootModuleCache - RootOther -) - -// A Root is a starting point for a Walk. -type Root struct { - Path string - Type RootType -} - -// SrcDirsRoots returns the roots from build.Default.SrcDirs(). Not modules-compatible. -func SrcDirsRoots(ctx *build.Context) []Root { - var roots []Root - roots = append(roots, Root{filepath.Join(ctx.GOROOT, "src"), RootGOROOT}) - for _, p := range filepath.SplitList(ctx.GOPATH) { - roots = append(roots, Root{filepath.Join(p, "src"), RootGOPATH}) - } - return roots -} - -// Walk walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute -// paths of the containing source directory and the package directory. -// add will be called concurrently. -func Walk(roots []Root, add func(root Root, dir string), opts Options) { - for _, root := range roots { - walkDir(root, add, opts) - } -} - -func walkDir(root Root, add func(Root, string), opts Options) { - if _, err := os.Stat(root.Path); os.IsNotExist(err) { - if opts.Debug { - log.Printf("skipping nonexistant directory: %v", root.Path) - } - return - } - if opts.Debug { - log.Printf("scanning %s", root.Path) - } - w := &walker{ - root: root, - add: add, - opts: opts, - } - w.init() - if err := fastwalk.Walk(root.Path, w.walk); err != nil { - log.Printf("gopathwalk: scanning directory %v: %v", root.Path, err) - } - - if opts.Debug { - log.Printf("scanned %s", root.Path) - } -} - -// walker is the callback for fastwalk.Walk. -type walker struct { - root Root // The source directory to scan. - add func(Root, string) // The callback that will be invoked for every possible Go package dir. - opts Options // Options passed to Walk by the user. - - ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files. -} - -// init initializes the walker based on its Options. -func (w *walker) init() { - var ignoredPaths []string - if w.root.Type == RootModuleCache { - ignoredPaths = []string{"cache"} - } - if !w.opts.ModulesEnabled && w.root.Type == RootGOPATH { - ignoredPaths = w.getIgnoredDirs(w.root.Path) - ignoredPaths = append(ignoredPaths, "v", "mod") - } - - for _, p := range ignoredPaths { - full := filepath.Join(w.root.Path, p) - if fi, err := os.Stat(full); err == nil { - w.ignoredDirs = append(w.ignoredDirs, fi) - if w.opts.Debug { - log.Printf("Directory added to ignore list: %s", full) - } - } else if w.opts.Debug { - log.Printf("Error statting ignored directory: %v", err) - } - } -} - -// getIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func (w *walker) getIgnoredDirs(path string) []string { - file := filepath.Join(path, ".goimportsignore") - slurp, err := ioutil.ReadFile(file) - if w.opts.Debug { - if err != nil { - log.Print(err) - } else { - log.Printf("Read %s", file) - } - } - if err != nil { - return nil - } - - var ignoredDirs []string - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - ignoredDirs = append(ignoredDirs, line) - } - return ignoredDirs -} - -func (w *walker) shouldSkipDir(fi os.FileInfo) bool { - for _, ignoredDir := range w.ignoredDirs { - if os.SameFile(fi, ignoredDir) { - return true - } - } - return false -} - -func (w *walker) walk(path string, typ os.FileMode) error { - dir := filepath.Dir(path) - if typ.IsRegular() { - if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - return fastwalk.SkipFiles - } - if !strings.HasSuffix(path, ".go") { - return nil - } - - w.add(w.root, dir) - return fastwalk.SkipFiles - } - if typ == os.ModeDir { - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || - (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || - (!w.opts.ModulesEnabled && base == "node_modules") { - return filepath.SkipDir - } - fi, err := os.Lstat(path) - if err == nil && w.shouldSkipDir(fi) { - return filepath.SkipDir - } - return nil - } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil - } - fi, err := os.Lstat(path) - if err != nil { - // Just ignore it. - return nil - } - if w.shouldTraverse(dir, fi) { - return fastwalk.TraverseLink - } - } - return nil -} - -// shouldTraverse reports whether the symlink fi, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool { - path := filepath.Join(dir, fi.Name()) - target, err := filepath.EvalSymlinks(path) - if err != nil { - return false - } - ts, err := os.Stat(target) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return false - } - if !ts.IsDir() { - return false - } - if w.shouldSkipDir(ts) { - return false - } - // Check for symlink loops by statting each directory component - // and seeing if any are the same file as ts. - for { - parent := filepath.Dir(path) - if parent == path { - // Made it to the root without seeing a cycle. - // Use this symlink. - return true - } - parentInfo, err := os.Stat(parent) - if err != nil { - return false - } - if os.SameFile(ts, parentInfo) { - // Cycle. Don't traverse. - return false - } - path = parent - } - -} diff --git a/vendor/golang.org/x/tools/internal/semver/semver.go b/vendor/golang.org/x/tools/internal/semver/semver.go deleted file mode 100644 index 4af7118e..00000000 --- a/vendor/golang.org/x/tools/internal/semver/semver.go +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package semver implements comparison of semantic version strings. -// In this package, semantic version strings must begin with a leading "v", -// as in "v1.0.0". -// -// The general form of a semantic version string accepted by this package is -// -// vMAJOR[.MINOR[.PATCH[-PRERELEASE][+BUILD]]] -// -// where square brackets indicate optional parts of the syntax; -// MAJOR, MINOR, and PATCH are decimal integers without extra leading zeros; -// PRERELEASE and BUILD are each a series of non-empty dot-separated identifiers -// using only alphanumeric characters and hyphens; and -// all-numeric PRERELEASE identifiers must not have leading zeros. -// -// This package follows Semantic Versioning 2.0.0 (see semver.org) -// with two exceptions. First, it requires the "v" prefix. Second, it recognizes -// vMAJOR and vMAJOR.MINOR (with no prerelease or build suffixes) -// as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0. -package semver - -// parsed returns the parsed form of a semantic version string. -type parsed struct { - major string - minor string - patch string - short string - prerelease string - build string - err string -} - -// IsValid reports whether v is a valid semantic version string. -func IsValid(v string) bool { - _, ok := parse(v) - return ok -} - -// Canonical returns the canonical formatting of the semantic version v. -// It fills in any missing .MINOR or .PATCH and discards build metadata. -// Two semantic versions compare equal only if their canonical formattings -// are identical strings. -// The canonical invalid semantic version is the empty string. -func Canonical(v string) string { - p, ok := parse(v) - if !ok { - return "" - } - if p.build != "" { - return v[:len(v)-len(p.build)] - } - if p.short != "" { - return v + p.short - } - return v -} - -// Major returns the major version prefix of the semantic version v. -// For example, Major("v2.1.0") == "v2". -// If v is an invalid semantic version string, Major returns the empty string. -func Major(v string) string { - pv, ok := parse(v) - if !ok { - return "" - } - return v[:1+len(pv.major)] -} - -// MajorMinor returns the major.minor version prefix of the semantic version v. -// For example, MajorMinor("v2.1.0") == "v2.1". -// If v is an invalid semantic version string, MajorMinor returns the empty string. -func MajorMinor(v string) string { - pv, ok := parse(v) - if !ok { - return "" - } - i := 1 + len(pv.major) - if j := i + 1 + len(pv.minor); j <= len(v) && v[i] == '.' && v[i+1:j] == pv.minor { - return v[:j] - } - return v[:i] + "." + pv.minor -} - -// Prerelease returns the prerelease suffix of the semantic version v. -// For example, Prerelease("v2.1.0-pre+meta") == "-pre". -// If v is an invalid semantic version string, Prerelease returns the empty string. -func Prerelease(v string) string { - pv, ok := parse(v) - if !ok { - return "" - } - return pv.prerelease -} - -// Build returns the build suffix of the semantic version v. -// For example, Build("v2.1.0+meta") == "+meta". -// If v is an invalid semantic version string, Build returns the empty string. -func Build(v string) string { - pv, ok := parse(v) - if !ok { - return "" - } - return pv.build -} - -// Compare returns an integer comparing two versions according to -// according to semantic version precedence. -// The result will be 0 if v == w, -1 if v < w, or +1 if v > w. -// -// An invalid semantic version string is considered less than a valid one. -// All invalid semantic version strings compare equal to each other. -func Compare(v, w string) int { - pv, ok1 := parse(v) - pw, ok2 := parse(w) - if !ok1 && !ok2 { - return 0 - } - if !ok1 { - return -1 - } - if !ok2 { - return +1 - } - if c := compareInt(pv.major, pw.major); c != 0 { - return c - } - if c := compareInt(pv.minor, pw.minor); c != 0 { - return c - } - if c := compareInt(pv.patch, pw.patch); c != 0 { - return c - } - return comparePrerelease(pv.prerelease, pw.prerelease) -} - -// Max canonicalizes its arguments and then returns the version string -// that compares greater. -func Max(v, w string) string { - v = Canonical(v) - w = Canonical(w) - if Compare(v, w) > 0 { - return v - } - return w -} - -func parse(v string) (p parsed, ok bool) { - if v == "" || v[0] != 'v' { - p.err = "missing v prefix" - return - } - p.major, v, ok = parseInt(v[1:]) - if !ok { - p.err = "bad major version" - return - } - if v == "" { - p.minor = "0" - p.patch = "0" - p.short = ".0.0" - return - } - if v[0] != '.' { - p.err = "bad minor prefix" - ok = false - return - } - p.minor, v, ok = parseInt(v[1:]) - if !ok { - p.err = "bad minor version" - return - } - if v == "" { - p.patch = "0" - p.short = ".0" - return - } - if v[0] != '.' { - p.err = "bad patch prefix" - ok = false - return - } - p.patch, v, ok = parseInt(v[1:]) - if !ok { - p.err = "bad patch version" - return - } - if len(v) > 0 && v[0] == '-' { - p.prerelease, v, ok = parsePrerelease(v) - if !ok { - p.err = "bad prerelease" - return - } - } - if len(v) > 0 && v[0] == '+' { - p.build, v, ok = parseBuild(v) - if !ok { - p.err = "bad build" - return - } - } - if v != "" { - p.err = "junk on end" - ok = false - return - } - ok = true - return -} - -func parseInt(v string) (t, rest string, ok bool) { - if v == "" { - return - } - if v[0] < '0' || '9' < v[0] { - return - } - i := 1 - for i < len(v) && '0' <= v[i] && v[i] <= '9' { - i++ - } - if v[0] == '0' && i != 1 { - return - } - return v[:i], v[i:], true -} - -func parsePrerelease(v string) (t, rest string, ok bool) { - // "A pre-release version MAY be denoted by appending a hyphen and - // a series of dot separated identifiers immediately following the patch version. - // Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. - // Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes." - if v == "" || v[0] != '-' { - return - } - i := 1 - start := 1 - for i < len(v) && v[i] != '+' { - if !isIdentChar(v[i]) && v[i] != '.' { - return - } - if v[i] == '.' { - if start == i || isBadNum(v[start:i]) { - return - } - start = i + 1 - } - i++ - } - if start == i || isBadNum(v[start:i]) { - return - } - return v[:i], v[i:], true -} - -func parseBuild(v string) (t, rest string, ok bool) { - if v == "" || v[0] != '+' { - return - } - i := 1 - start := 1 - for i < len(v) { - if !isIdentChar(v[i]) { - return - } - if v[i] == '.' { - if start == i { - return - } - start = i + 1 - } - i++ - } - if start == i { - return - } - return v[:i], v[i:], true -} - -func isIdentChar(c byte) bool { - return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-' -} - -func isBadNum(v string) bool { - i := 0 - for i < len(v) && '0' <= v[i] && v[i] <= '9' { - i++ - } - return i == len(v) && i > 1 && v[0] == '0' -} - -func isNum(v string) bool { - i := 0 - for i < len(v) && '0' <= v[i] && v[i] <= '9' { - i++ - } - return i == len(v) -} - -func compareInt(x, y string) int { - if x == y { - return 0 - } - if len(x) < len(y) { - return -1 - } - if len(x) > len(y) { - return +1 - } - if x < y { - return -1 - } else { - return +1 - } -} - -func comparePrerelease(x, y string) int { - // "When major, minor, and patch are equal, a pre-release version has - // lower precedence than a normal version. - // Example: 1.0.0-alpha < 1.0.0. - // Precedence for two pre-release versions with the same major, minor, - // and patch version MUST be determined by comparing each dot separated - // identifier from left to right until a difference is found as follows: - // identifiers consisting of only digits are compared numerically and - // identifiers with letters or hyphens are compared lexically in ASCII - // sort order. Numeric identifiers always have lower precedence than - // non-numeric identifiers. A larger set of pre-release fields has a - // higher precedence than a smaller set, if all of the preceding - // identifiers are equal. - // Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < - // 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0." - if x == y { - return 0 - } - if x == "" { - return +1 - } - if y == "" { - return -1 - } - for x != "" && y != "" { - x = x[1:] // skip - or . - y = y[1:] // skip - or . - var dx, dy string - dx, x = nextIdent(x) - dy, y = nextIdent(y) - if dx != dy { - ix := isNum(dx) - iy := isNum(dy) - if ix != iy { - if ix { - return -1 - } else { - return +1 - } - } - if ix { - if len(dx) < len(dy) { - return -1 - } - if len(dx) > len(dy) { - return +1 - } - } - if dx < dy { - return -1 - } else { - return +1 - } - } - } - if x == "" { - return -1 - } else { - return +1 - } -} - -func nextIdent(x string) (dx, rest string) { - i := 0 - for i < len(x) && x[i] != '.' { - i++ - } - return x[:i], x[i:] -} diff --git a/vendor/golang.org/x/xerrors/LICENSE b/vendor/golang.org/x/xerrors/LICENSE deleted file mode 100644 index e4a47e17..00000000 --- a/vendor/golang.org/x/xerrors/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2019 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/xerrors/PATENTS b/vendor/golang.org/x/xerrors/PATENTS deleted file mode 100644 index 73309904..00000000 --- a/vendor/golang.org/x/xerrors/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/xerrors/README b/vendor/golang.org/x/xerrors/README deleted file mode 100644 index aac7867a..00000000 --- a/vendor/golang.org/x/xerrors/README +++ /dev/null @@ -1,2 +0,0 @@ -This repository holds the transition packages for the new Go 1.13 error values. -See golang.org/design/29934-error-values. diff --git a/vendor/golang.org/x/xerrors/adaptor_go1_12.go b/vendor/golang.org/x/xerrors/adaptor_go1_12.go deleted file mode 100644 index 6b9f2f0c..00000000 --- a/vendor/golang.org/x/xerrors/adaptor_go1_12.go +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.13 - -package xerrors - -import ( - "bytes" - "fmt" - "io" - "reflect" - "strconv" -) - -// FormatError calls the FormatError method of f with an errors.Printer -// configured according to s and verb, and writes the result to s. -func FormatError(f Formatter, s fmt.State, verb rune) { - // Assuming this function is only called from the Format method, and given - // that FormatError takes precedence over Format, it cannot be called from - // any package that supports errors.Formatter. It is therefore safe to - // disregard that State may be a specific printer implementation and use one - // of our choice instead. - - // limitations: does not support printing error as Go struct. - - var ( - sep = " " // separator before next error - p = &state{State: s} - direct = true - ) - - var err error = f - - switch verb { - // Note that this switch must match the preference order - // for ordinary string printing (%#v before %+v, and so on). - - case 'v': - if s.Flag('#') { - if stringer, ok := err.(fmt.GoStringer); ok { - io.WriteString(&p.buf, stringer.GoString()) - goto exit - } - // proceed as if it were %v - } else if s.Flag('+') { - p.printDetail = true - sep = "\n - " - } - case 's': - case 'q', 'x', 'X': - // Use an intermediate buffer in the rare cases that precision, - // truncation, or one of the alternative verbs (q, x, and X) are - // specified. - direct = false - - default: - p.buf.WriteString("%!") - p.buf.WriteRune(verb) - p.buf.WriteByte('(') - switch { - case err != nil: - p.buf.WriteString(reflect.TypeOf(f).String()) - default: - p.buf.WriteString("") - } - p.buf.WriteByte(')') - io.Copy(s, &p.buf) - return - } - -loop: - for { - switch v := err.(type) { - case Formatter: - err = v.FormatError((*printer)(p)) - case fmt.Formatter: - v.Format(p, 'v') - break loop - default: - io.WriteString(&p.buf, v.Error()) - break loop - } - if err == nil { - break - } - if p.needColon || !p.printDetail { - p.buf.WriteByte(':') - p.needColon = false - } - p.buf.WriteString(sep) - p.inDetail = false - p.needNewline = false - } - -exit: - width, okW := s.Width() - prec, okP := s.Precision() - - if !direct || (okW && width > 0) || okP { - // Construct format string from State s. - format := []byte{'%'} - if s.Flag('-') { - format = append(format, '-') - } - if s.Flag('+') { - format = append(format, '+') - } - if s.Flag(' ') { - format = append(format, ' ') - } - if okW { - format = strconv.AppendInt(format, int64(width), 10) - } - if okP { - format = append(format, '.') - format = strconv.AppendInt(format, int64(prec), 10) - } - format = append(format, string(verb)...) - fmt.Fprintf(s, string(format), p.buf.String()) - } else { - io.Copy(s, &p.buf) - } -} - -var detailSep = []byte("\n ") - -// state tracks error printing state. It implements fmt.State. -type state struct { - fmt.State - buf bytes.Buffer - - printDetail bool - inDetail bool - needColon bool - needNewline bool -} - -func (s *state) Write(b []byte) (n int, err error) { - if s.printDetail { - if len(b) == 0 { - return 0, nil - } - if s.inDetail && s.needColon { - s.needNewline = true - if b[0] == '\n' { - b = b[1:] - } - } - k := 0 - for i, c := range b { - if s.needNewline { - if s.inDetail && s.needColon { - s.buf.WriteByte(':') - s.needColon = false - } - s.buf.Write(detailSep) - s.needNewline = false - } - if c == '\n' { - s.buf.Write(b[k:i]) - k = i + 1 - s.needNewline = true - } - } - s.buf.Write(b[k:]) - if !s.inDetail { - s.needColon = true - } - } else if !s.inDetail { - s.buf.Write(b) - } - return len(b), nil -} - -// printer wraps a state to implement an xerrors.Printer. -type printer state - -func (s *printer) Print(args ...interface{}) { - if !s.inDetail || s.printDetail { - fmt.Fprint((*state)(s), args...) - } -} - -func (s *printer) Printf(format string, args ...interface{}) { - if !s.inDetail || s.printDetail { - fmt.Fprintf((*state)(s), format, args...) - } -} - -func (s *printer) Detail() bool { - s.inDetail = true - return s.printDetail -} diff --git a/vendor/golang.org/x/xerrors/adaptor_go1_13.go b/vendor/golang.org/x/xerrors/adaptor_go1_13.go deleted file mode 100644 index 57f519dc..00000000 --- a/vendor/golang.org/x/xerrors/adaptor_go1_13.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.13 - -package xerrors - -import ( - "errors" - "fmt" - "strconv" -) - -// A Frame contains part of a call stack. -type Frame = errors.Frame - -// Caller returns a Frame that describes a frame on the caller's stack. -// The argument skip is the number of frames to skip over. -// Caller(0) returns the frame for the caller of Caller. -var Caller func(skip int) Frame = errors.Caller - -// FormatError calls the FormatError method of f with an errors.Printer -// configured according to s and verb, and writes the result to s. -func FormatError(f Formatter, s fmt.State, verb rune) { - // Assuming this function is only called from the Format method, and given - // that FormatError takes precedence over Format, it cannot be called from - // any package that supports errors.Formatter. It is therefore safe to - // disregard that State may be a specific printer implementation and use one - // of our choice instead. - - width, okW := s.Width() - prec, okP := s.Precision() - - // Construct format string from State s. - format := []byte{'%'} - if s.Flag('-') { - format = append(format, '-') - } - if s.Flag('+') { - format = append(format, '+') - } - if s.Flag(' ') { - format = append(format, ' ') - } - if okW { - format = strconv.AppendInt(format, int64(width), 10) - } - if okP { - format = append(format, '.') - format = strconv.AppendInt(format, int64(prec), 10) - } - format = append(format, string(verb)...) - fmt.Fprintf(s, string(format), f) -} diff --git a/vendor/golang.org/x/xerrors/codereview.cfg b/vendor/golang.org/x/xerrors/codereview.cfg deleted file mode 100644 index 3f8b14b6..00000000 --- a/vendor/golang.org/x/xerrors/codereview.cfg +++ /dev/null @@ -1 +0,0 @@ -issuerepo: golang/go diff --git a/vendor/golang.org/x/xerrors/doc.go b/vendor/golang.org/x/xerrors/doc.go deleted file mode 100644 index 1ad48f50..00000000 --- a/vendor/golang.org/x/xerrors/doc.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package xerrors implements functions to manipulate errors. -// -// This package supports transitioning to the Go 2 proposal for error values: -// https://golang.org/design/29934-error-values -// -// Most of the functions and types in this package will be incorporated into the -// standard library's errors package in Go 1.13; the behavior of this package's -// Errorf function will be incorporated into the standard library's fmt.Errorf. -// Use this package to get equivalent behavior in all supported Go versions. For -// example, create errors using -// -// xerrors.New("write failed") -// -// or -// -// xerrors.Errorf("while reading: %v", err) -// -// If you want your error type to participate in the new formatting -// implementation for %v and %+v, provide it with a Format method that calls -// xerrors.FormatError, as shown in the example for FormatError. -package xerrors // import "golang.org/x/xerrors" diff --git a/vendor/golang.org/x/xerrors/errors.go b/vendor/golang.org/x/xerrors/errors.go deleted file mode 100644 index e88d3772..00000000 --- a/vendor/golang.org/x/xerrors/errors.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import "fmt" - -// errorString is a trivial implementation of error. -type errorString struct { - s string - frame Frame -} - -// New returns an error that formats as the given text. -// -// The returned error contains a Frame set to the caller's location and -// implements Formatter to show this information when printed with details. -func New(text string) error { - return &errorString{text, Caller(1)} -} - -func (e *errorString) Error() string { - return e.s -} - -func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *errorString) FormatError(p Printer) (next error) { - p.Print(e.s) - e.frame.Format(p) - return nil -} diff --git a/vendor/golang.org/x/xerrors/fmt.go b/vendor/golang.org/x/xerrors/fmt.go deleted file mode 100644 index 74c1c93e..00000000 --- a/vendor/golang.org/x/xerrors/fmt.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "fmt" - "strings" - - "golang.org/x/xerrors/internal" -) - -// Errorf formats according to a format specifier and returns the string as a -// value that satisfies error. -// -// The returned error includes the file and line number of the caller when -// formatted with additional detail enabled. If the last argument is an error -// the returned error's Format method will return it if the format string ends -// with ": %s", ": %v", or ": %w". If the last argument is an error and the -// format string ends with ": %w", the returned error implements Wrapper -// with an Unwrap method returning it. -func Errorf(format string, a ...interface{}) error { - err, wrap := lastError(format, a) - format = formatPlusW(format) - if err == nil { - return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)} - } - - // TODO: this is not entirely correct. The error value could be - // printed elsewhere in format if it mixes numbered with unnumbered - // substitutions. With relatively small changes to doPrintf we can - // have it optionally ignore extra arguments and pass the argument - // list in its entirety. - msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...) - frame := Frame{} - if internal.EnableTrace { - frame = Caller(1) - } - if wrap { - return &wrapError{msg, err, frame} - } - return &noWrapError{msg, err, frame} -} - -// formatPlusW is used to avoid the vet check that will barf at %w. -func formatPlusW(s string) string { - return s -} - -func lastError(format string, a []interface{}) (err error, wrap bool) { - wrap = strings.HasSuffix(format, ": %w") - if !wrap && - !strings.HasSuffix(format, ": %s") && - !strings.HasSuffix(format, ": %v") { - return nil, false - } - - if len(a) == 0 { - return nil, false - } - - err, ok := a[len(a)-1].(error) - if !ok { - return nil, false - } - - return err, wrap -} - -type noWrapError struct { - msg string - err error - frame Frame -} - -func (e *noWrapError) Error() string { - return fmt.Sprint(e) -} - -func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *noWrapError) FormatError(p Printer) (next error) { - p.Print(e.msg) - e.frame.Format(p) - return e.err -} - -type wrapError struct { - msg string - err error - frame Frame -} - -func (e *wrapError) Error() string { - return fmt.Sprint(e) -} - -func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *wrapError) FormatError(p Printer) (next error) { - p.Print(e.msg) - e.frame.Format(p) - return e.err -} - -func (e *wrapError) Unwrap() error { - return e.err -} diff --git a/vendor/golang.org/x/xerrors/format_go1_12.go b/vendor/golang.org/x/xerrors/format_go1_12.go deleted file mode 100644 index ba856fea..00000000 --- a/vendor/golang.org/x/xerrors/format_go1_12.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.13 - -package xerrors - -// A Formatter formats error messages. -type Formatter interface { - error - - // FormatError prints the receiver's first error and returns the next error in - // the error chain, if any. - FormatError(p Printer) (next error) -} - -// A Printer formats error messages. -// -// The most common implementation of Printer is the one provided by package fmt -// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message -// typically provide their own implementations. -type Printer interface { - // Print appends args to the message output. - Print(args ...interface{}) - - // Printf writes a formatted string. - Printf(format string, args ...interface{}) - - // Detail reports whether error detail is requested. - // After the first call to Detail, all text written to the Printer - // is formatted as additional detail, or ignored when - // detail has not been requested. - // If Detail returns false, the caller can avoid printing the detail at all. - Detail() bool -} diff --git a/vendor/golang.org/x/xerrors/format_go1_13.go b/vendor/golang.org/x/xerrors/format_go1_13.go deleted file mode 100644 index 95c65968..00000000 --- a/vendor/golang.org/x/xerrors/format_go1_13.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.13 - -package xerrors - -import "errors" - -// A Formatter formats error messages. -type Formatter = errors.Formatter - -// A Printer formats error messages. -// -// The most common implementation of Printer is the one provided by package fmt -// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message -// typically provide their own implementations. -type Printer = errors.Printer diff --git a/vendor/golang.org/x/xerrors/frame_go1_12.go b/vendor/golang.org/x/xerrors/frame_go1_12.go deleted file mode 100644 index 6740f7fa..00000000 --- a/vendor/golang.org/x/xerrors/frame_go1_12.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.13 - -package xerrors - -import ( - "runtime" -) - -// A Frame contains part of a call stack. -type Frame struct { - // Make room for three PCs: the one we were asked for, what it called, - // and possibly a PC for skipPleaseUseCallersFrames. See: - // https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169 - frames [3]uintptr -} - -// Caller returns a Frame that describes a frame on the caller's stack. -// The argument skip is the number of frames to skip over. -// Caller(0) returns the frame for the caller of Caller. -func Caller(skip int) Frame { - var s Frame - runtime.Callers(skip+1, s.frames[:]) - return s -} - -// location reports the file, line, and function of a frame. -// -// The returned function may be "" even if file and line are not. -func (f Frame) location() (function, file string, line int) { - frames := runtime.CallersFrames(f.frames[:]) - if _, ok := frames.Next(); !ok { - return "", "", 0 - } - fr, ok := frames.Next() - if !ok { - return "", "", 0 - } - return fr.Function, fr.File, fr.Line -} - -// Format prints the stack as error detail. -// It should be called from an error's Format implementation -// after printing any other error detail. -func (f Frame) Format(p Printer) { - if p.Detail() { - function, file, line := f.location() - if function != "" { - p.Printf("%s\n ", function) - } - if file != "" { - p.Printf("%s:%d\n", file, line) - } - } -} diff --git a/vendor/golang.org/x/xerrors/go.mod b/vendor/golang.org/x/xerrors/go.mod deleted file mode 100644 index 870d4f61..00000000 --- a/vendor/golang.org/x/xerrors/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module golang.org/x/xerrors - -go 1.11 diff --git a/vendor/golang.org/x/xerrors/wrap.go b/vendor/golang.org/x/xerrors/wrap.go deleted file mode 100644 index 9a3b5103..00000000 --- a/vendor/golang.org/x/xerrors/wrap.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "reflect" -) - -// A Wrapper provides context around another error. -type Wrapper interface { - // Unwrap returns the next error in the error chain. - // If there is no next error, Unwrap returns nil. - Unwrap() error -} - -// Opaque returns an error with the same error formatting as err -// but that does not match err and cannot be unwrapped. -func Opaque(err error) error { - return noWrapper{err} -} - -type noWrapper struct { - error -} - -func (e noWrapper) FormatError(p Printer) (next error) { - if f, ok := e.error.(Formatter); ok { - return f.FormatError(p) - } - p.Print(e.error) - return nil -} - -// Unwrap returns the result of calling the Unwrap method on err, if err implements -// Unwrap. Otherwise, Unwrap returns nil. -func Unwrap(err error) error { - u, ok := err.(Wrapper) - if !ok { - return nil - } - return u.Unwrap() -} - -// Is reports whether any error in err's chain matches target. -// -// An error is considered to match a target if it is equal to that target or if -// it implements a method Is(error) bool such that Is(target) returns true. -func Is(err, target error) bool { - if target == nil { - return err == target - } - - isComparable := reflect.TypeOf(target).Comparable() - for { - if isComparable && err == target { - return true - } - if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { - return true - } - // TODO: consider supporing target.Is(err). This would allow - // user-definable predicates, but also may allow for coping with sloppy - // APIs, thereby making it easier to get away with them. - if err = Unwrap(err); err == nil { - return false - } - } -} - -// As finds the first error in err's chain that matches the type to which target -// points, and if so, sets the target to its value and returns true. An error -// matches a type if it is assignable to the target type, or if it has a method -// As(interface{}) bool such that As(target) returns true. As will panic if target -// is not a non-nil pointer to a type which implements error or is of interface type. -// -// The As method should set the target to its value and return true if err -// matches the type to which target points. -func As(err error, target interface{}) bool { - if target == nil { - panic("errors: target cannot be nil") - } - val := reflect.ValueOf(target) - typ := val.Type() - if typ.Kind() != reflect.Ptr || val.IsNil() { - panic("errors: target must be a non-nil pointer") - } - if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) { - panic("errors: *target must be interface or implement error") - } - targetType := typ.Elem() - for err != nil { - if reflect.TypeOf(err).AssignableTo(targetType) { - val.Elem().Set(reflect.ValueOf(err)) - return true - } - if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) { - return true - } - err = Unwrap(err) - } - return false -} - -var errorType = reflect.TypeOf((*error)(nil)).Elem() diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go index 0ee738e1..a14435e8 100644 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ b/vendor/gopkg.in/yaml.v2/encode.go @@ -13,19 +13,6 @@ import ( "unicode/utf8" ) -// jsonNumber is the interface of the encoding/json.Number datatype. -// Repeating the interface here avoids a dependency on encoding/json, and also -// supports other libraries like jsoniter, which use a similar datatype with -// the same interface. Detecting this interface is useful when dealing with -// structures containing json.Number, which is a string under the hood. The -// encoder should prefer the use of Int64(), Float64() and string(), in that -// order, when encoding this type. -type jsonNumber interface { - Float64() (float64, error) - Int64() (int64, error) - String() string -} - type encoder struct { emitter yaml_emitter_t event yaml_event_t @@ -102,21 +89,6 @@ func (e *encoder) marshal(tag string, in reflect.Value) { } iface := in.Interface() switch m := iface.(type) { - case jsonNumber: - integer, err := m.Int64() - if err == nil { - // In this case the json.Number is a valid int64 - in = reflect.ValueOf(integer) - break - } - float, err := m.Float64() - if err == nil { - // In this case the json.Number is a valid float64 - in = reflect.ValueOf(float) - break - } - // fallback case - no number could be obtained - in = reflect.ValueOf(m.String()) case time.Time, *time.Time: // Although time.Time implements TextMarshaler, // we don't want to treat it as a string for YAML